From: Andrea Bianco Date: Sat, 2 Jan 2021 10:17:58 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.11 X-Git-Tag: 2.5.11 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=6b8dca8de1a6b807be7e36077511bb032e7382e5;p=motion2.git Built motion from commit (unavailable).|2.5.11 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9a3c5c1..ab55957 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-01-02T09:50:37.016Z", + "time": "2021-01-02T10:11:03.106Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9602335..f349811 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-01-02T09:50:37.016Z", + "time": "2021-01-02T10:11:03.106Z", "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 b421184..8734597 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 _0xacd2=['VIRTUAL','getDataValue','action','STRING','contactManager','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','TEXT','sequelize'];(function(_0x17dae9,_0x1ffca0){var _0x2004b7=function(_0x1ab0e8){while(--_0x1ab0e8){_0x17dae9['push'](_0x17dae9['shift']());}};_0x2004b7(++_0x1ffca0);}(_0xacd2,0x144));var _0x2acd=function(_0x69cac6,_0x1a7831){_0x69cac6=_0x69cac6-0x0;var _0x40b986=_0xacd2[_0x69cac6];return _0x40b986;};'use strict';var Sequelize=require(_0x2acd('0x0'));module['exports']={'name':{'type':Sequelize[_0x2acd('0x1')],'get':function(_0x48853b){return this[_0x2acd('0x2')](_0x2acd('0x3'));}},'action':{'type':Sequelize[_0x2acd('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x2acd('0x5'),'integration','motionbar','jscripty','urlForward',_0x2acd('0x6'),_0x2acd('0x7'),_0x2acd('0x8')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x2acd('0x9')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x2acd('0xa')},'data2':{'type':Sequelize[_0x2acd('0x4')](0x1000),'comment':_0x2acd('0xb')},'data3':{'type':Sequelize[_0x2acd('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x2acd('0x4')](0x1000)},'data5':{'type':Sequelize[_0x2acd('0x4')](0x1000)},'data6':{'type':Sequelize[_0x2acd('0x4')]},'data7':{'type':Sequelize[_0x2acd('0xc')]}}; \ No newline at end of file +var _0xe813=['VIRTUAL','getDataValue','integration','motionbar','jscripty','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','motionbar[NULL,NULL,WinAppArguments]','TEXT','exports'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xe813,0x151));var _0x3e81=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0xe813[_0x5f42f1];return _0x5534ee;};'use strict';var Sequelize=require('sequelize');module[_0x3e81('0x0')]={'name':{'type':Sequelize[_0x3e81('0x1')],'get':function(_0x31e885){return this[_0x3e81('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x3e81('0x3'),_0x3e81('0x4'),_0x3e81('0x5'),'urlForward',_0x3e81('0x6'),_0x3e81('0x7'),_0x3e81('0x8')]],'msg':_0x3e81('0x9')}},'comment':_0x3e81('0x9')},'data1':{'type':Sequelize[_0x3e81('0xa')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x3e81('0xa')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3e81('0xb')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x3e81('0xa')](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x3e81('0xc')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 86fc020..d64b850 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 _0xa423=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','set','json','apply','reject','update','then','destroy','error','stack','name','send','body','Action','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x1d4f4c,_0x3c3f4a){var _0x4ab87a=function(_0x5598ee){while(--_0x5598ee){_0x1d4f4c['push'](_0x1d4f4c['shift']());}};_0x4ab87a(++_0x3c3f4a);}(_0xa423,0x16c));var _0x3a42=function(_0x349edb,_0x2fc4b1){_0x349edb=_0x349edb-0x0;var _0x517f7e=_0xa423[_0x349edb];return _0x517f7e;};'use strict';var pdf=require(_0x3a42('0x0'));var emlformat=require(_0x3a42('0x1'));var rimraf=require(_0x3a42('0x2'));var zipdir=require(_0x3a42('0x3'));var jsonpatch=require(_0x3a42('0x4'));var rp=require('request-promise');var moment=require(_0x3a42('0x5'));var BPromise=require(_0x3a42('0x6'));var Mustache=require('mustache');var util=require(_0x3a42('0x7'));var path=require(_0x3a42('0x8'));var sox=require(_0x3a42('0x9'));var csv=require(_0x3a42('0xa'));var ejs=require(_0x3a42('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3a42('0xc'));var crypto=require(_0x3a42('0xd'));var jsforce=require(_0x3a42('0xe'));var deskjs=require(_0x3a42('0xf'));var toCsv=require(_0x3a42('0xa'));var querystring=require(_0x3a42('0x10'));var Papa=require(_0x3a42('0x11'));var Redis=require(_0x3a42('0x12'));var authService=require(_0x3a42('0x13'));var qs=require(_0x3a42('0x14'));var as=require(_0x3a42('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a42('0x16'))(_0x3a42('0x17'));var utils=require(_0x3a42('0x18'));var config=require(_0x3a42('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11ccc8,_0x4df153){_0x4df153=_0x4df153||0xcc;return function(_0x4008ea){if(_0x4008ea){return _0x11ccc8[_0x3a42('0x1a')](_0x4df153);}return _0x11ccc8[_0x3a42('0x1b')](_0x4df153)[_0x3a42('0x1c')]();};}function respondWithResult(_0x891963,_0x475602){_0x475602=_0x475602||0xc8;return function(_0x5f5244){if(_0x5f5244){return _0x891963[_0x3a42('0x1b')](_0x475602)['json'](_0x5f5244);}};}function respondWithFilteredResult(_0x469c73,_0x4b1d68){return function(_0x3e5d77){if(_0x3e5d77){var _0x5895a8=_0x3e5d77['count'],_0x46ef1e=_0x4b1d68[_0x3a42('0x1d')],_0x4edcf5=_0x4b1d68[_0x3a42('0x1d')]+_0x4b1d68[_0x3a42('0x1e')],_0x486c74;if(_0x4edcf5>=_0x5895a8){_0x4edcf5=_0x5895a8;_0x486c74=0xc8;}else{_0x486c74=0xce;}_0x469c73[_0x3a42('0x1b')](_0x486c74);return _0x469c73[_0x3a42('0x1f')]('Content-Range',_0x46ef1e+'-'+_0x4edcf5+'/'+_0x5895a8)[_0x3a42('0x20')](_0x3e5d77);}return null;};}function patchUpdates(_0x2e5e64){return function(_0x49f00e){try{jsonpatch[_0x3a42('0x21')](_0x49f00e,_0x2e5e64,!![]);}catch(_0xa89087){return BPromise[_0x3a42('0x22')](_0xa89087);}return _0x49f00e['save']();};}function saveUpdates(_0x1fcea4,_0x3f4afb){return function(_0x3bb792){if(_0x3bb792){return _0x3bb792[_0x3a42('0x23')](_0x1fcea4)[_0x3a42('0x24')](function(_0x526d7c){return _0x526d7c;});}return null;};}function removeEntity(_0x34927a,_0x42b40f){return function(_0x379fe6){if(_0x379fe6){return _0x379fe6[_0x3a42('0x25')]()[_0x3a42('0x24')](function(){_0x34927a['status'](0xcc)[_0x3a42('0x1c')]();});}};}function handleEntityNotFound(_0x41b374,_0x477cb9){return function(_0x1add9b){if(!_0x1add9b){_0x41b374[_0x3a42('0x1a')](0x194);}return _0x1add9b;};}function handleError(_0x258917,_0x2ee4b8){_0x2ee4b8=_0x2ee4b8||0x1f4;return function(_0x434044){logger[_0x3a42('0x26')](_0x434044[_0x3a42('0x27')]);if(_0x434044[_0x3a42('0x28')]){delete _0x434044['name'];}_0x258917[_0x3a42('0x1b')](_0x2ee4b8)[_0x3a42('0x29')](_0x434044);};}exports['update']=function(_0x3027dd,_0x5b5897){if(_0x3027dd[_0x3a42('0x2a')]['id']){delete _0x3027dd[_0x3a42('0x2a')]['id'];}return db[_0x3a42('0x2b')][_0x3a42('0x2c')]({'where':{'id':_0x3027dd[_0x3a42('0x2d')]['id']}})[_0x3a42('0x24')](handleEntityNotFound(_0x5b5897,null))['then'](saveUpdates(_0x3027dd[_0x3a42('0x2a')],null))[_0x3a42('0x24')](respondWithResult(_0x5b5897,null))[_0x3a42('0x2e')](handleError(_0x5b5897,null));};exports[_0x3a42('0x25')]=function(_0x1c8fe1,_0x44ef39){return db[_0x3a42('0x2b')]['find']({'where':{'id':_0x1c8fe1[_0x3a42('0x2d')]['id']}})[_0x3a42('0x24')](handleEntityNotFound(_0x44ef39,null))[_0x3a42('0x24')](removeEntity(_0x44ef39,null))[_0x3a42('0x2e')](handleError(_0x44ef39,null));}; \ No newline at end of file +var _0xa46e=['status','json','count','limit','apply','reject','save','then','destroy','end','error','stack','send','body','Action','find','params','catch','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3dad57,_0x1dd8b3){var _0x47a6b5=function(_0x6e545d){while(--_0x6e545d){_0x3dad57['push'](_0x3dad57['shift']());}};_0x47a6b5(++_0x1dd8b3);}(_0xa46e,0x8a));var _0xea46=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xa46e[_0x3ff085];return _0x2b68c3;};'use strict';var pdf=require(_0xea46('0x0'));var emlformat=require(_0xea46('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xea46('0x2'));var jsonpatch=require(_0xea46('0x3'));var rp=require(_0xea46('0x4'));var moment=require('moment');var BPromise=require(_0xea46('0x5'));var Mustache=require('mustache');var util=require(_0xea46('0x6'));var path=require('path');var sox=require(_0xea46('0x7'));var csv=require('to-csv');var ejs=require(_0xea46('0x8'));var fs=require('fs');var _=require(_0xea46('0x9'));var squel=require('squel');var crypto=require(_0xea46('0xa'));var jsforce=require(_0xea46('0xb'));var deskjs=require(_0xea46('0xc'));var toCsv=require(_0xea46('0xd'));var querystring=require(_0xea46('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xea46('0xf'));var as=require(_0xea46('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea46('0x11'))(_0xea46('0x12'));var utils=require(_0xea46('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xea46('0x14'));var db=require(_0xea46('0x15'))['db'];function respondWithStatusCode(_0x4e10f3,_0x13390c){_0x13390c=_0x13390c||0xcc;return function(_0x1a4fe2){if(_0x1a4fe2){return _0x4e10f3['sendStatus'](_0x13390c);}return _0x4e10f3[_0xea46('0x16')](_0x13390c)['end']();};}function respondWithResult(_0x3024af,_0x42c328){_0x42c328=_0x42c328||0xc8;return function(_0x6c4bc4){if(_0x6c4bc4){return _0x3024af[_0xea46('0x16')](_0x42c328)[_0xea46('0x17')](_0x6c4bc4);}};}function respondWithFilteredResult(_0x2ef436,_0x81ee45){return function(_0x20a79c){if(_0x20a79c){var _0x176ad2=_0x20a79c[_0xea46('0x18')],_0x59e1ea=_0x81ee45['offset'],_0x2fa2f9=_0x81ee45['offset']+_0x81ee45[_0xea46('0x19')],_0xbf225e;if(_0x2fa2f9>=_0x176ad2){_0x2fa2f9=_0x176ad2;_0xbf225e=0xc8;}else{_0xbf225e=0xce;}_0x2ef436[_0xea46('0x16')](_0xbf225e);return _0x2ef436['set']('Content-Range',_0x59e1ea+'-'+_0x2fa2f9+'/'+_0x176ad2)[_0xea46('0x17')](_0x20a79c);}return null;};}function patchUpdates(_0x9b7d04){return function(_0x4ff93d){try{jsonpatch[_0xea46('0x1a')](_0x4ff93d,_0x9b7d04,!![]);}catch(_0x16ae38){return BPromise[_0xea46('0x1b')](_0x16ae38);}return _0x4ff93d[_0xea46('0x1c')]();};}function saveUpdates(_0x53b8db,_0x2b6491){return function(_0x4e220f){if(_0x4e220f){return _0x4e220f['update'](_0x53b8db)[_0xea46('0x1d')](function(_0x59e431){return _0x59e431;});}return null;};}function removeEntity(_0x4cc673,_0x5064d8){return function(_0x3b25fe){if(_0x3b25fe){return _0x3b25fe[_0xea46('0x1e')]()[_0xea46('0x1d')](function(){_0x4cc673['status'](0xcc)[_0xea46('0x1f')]();});}};}function handleEntityNotFound(_0x59b10d,_0x12e688){return function(_0x2008b0){if(!_0x2008b0){_0x59b10d['sendStatus'](0x194);}return _0x2008b0;};}function handleError(_0xac33c3,_0x5480eb){_0x5480eb=_0x5480eb||0x1f4;return function(_0x2b3a8f){logger[_0xea46('0x20')](_0x2b3a8f[_0xea46('0x21')]);if(_0x2b3a8f['name']){delete _0x2b3a8f['name'];}_0xac33c3[_0xea46('0x16')](_0x5480eb)[_0xea46('0x22')](_0x2b3a8f);};}exports['update']=function(_0x3b3928,_0x4999b0){if(_0x3b3928[_0xea46('0x23')]['id']){delete _0x3b3928['body']['id'];}return db[_0xea46('0x24')][_0xea46('0x25')]({'where':{'id':_0x3b3928[_0xea46('0x26')]['id']}})[_0xea46('0x1d')](handleEntityNotFound(_0x4999b0,null))[_0xea46('0x1d')](saveUpdates(_0x3b3928[_0xea46('0x23')],null))['then'](respondWithResult(_0x4999b0,null))[_0xea46('0x27')](handleError(_0x4999b0,null));};exports[_0xea46('0x1e')]=function(_0x200e10,_0x5e0e35){return db[_0xea46('0x24')][_0xea46('0x25')]({'where':{'id':_0x200e10[_0xea46('0x26')]['id']}})['then'](handleEntityNotFound(_0x5e0e35,null))['then'](removeEntity(_0x5e0e35,null))['catch'](handleError(_0x5e0e35,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 197bfd8..8c72709 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 _0x0aa7=['bluebird','path','rimraf','Action','tools_actions','util','../../config/logger','api'];(function(_0x4f945d,_0x4856fc){var _0x35cc15=function(_0x2545a8){while(--_0x2545a8){_0x4f945d['push'](_0x4f945d['shift']());}};_0x35cc15(++_0x4856fc);}(_0x0aa7,0x175));var _0x70aa=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0x0aa7[_0x40a77f];return _0x415aa1;};'use strict';var _=require('lodash');var util=require(_0x70aa('0x0'));var logger=require(_0x70aa('0x1'))(_0x70aa('0x2'));var moment=require('moment');var BPromise=require(_0x70aa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70aa('0x4'));var rimraf=require(_0x70aa('0x5'));var config=require('../../config/environment');var attributes=require('./action.attributes');module['exports']=function(_0x1610f0,_0x21fa45){return _0x1610f0['define'](_0x70aa('0x6'),attributes,{'tableName':_0x70aa('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeba4=['./action.attributes','exports','define','Action','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x475923,_0x25d9ec){var _0x374030=function(_0x3f256b){while(--_0x3f256b){_0x475923['push'](_0x475923['shift']());}};_0x374030(++_0x25d9ec);}(_0xeba4,0x1b4));var _0x4eba=function(_0x227c59,_0x575c83){_0x227c59=_0x227c59-0x0;var _0x35aeac=_0xeba4[_0x227c59];return _0x35aeac;};'use strict';var _=require(_0x4eba('0x0'));var util=require(_0x4eba('0x1'));var logger=require('../../config/logger')(_0x4eba('0x2'));var moment=require(_0x4eba('0x3'));var BPromise=require(_0x4eba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4eba('0x5'));var rimraf=require(_0x4eba('0x6'));var config=require(_0x4eba('0x7'));var attributes=require(_0x4eba('0x8'));module[_0x4eba('0x9')]=function(_0x278bfd,_0x1f8585){return _0x278bfd[_0x4eba('0xa')](_0x4eba('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index a7e139a..63df0e6 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 _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x2d5755,_0xbf768){var _0x4d1e6c=function(_0x751aca){while(--_0x751aca){_0x2d5755['push'](_0x2d5755['shift']());}};_0x4d1e6c(++_0xbf768);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x13fb43,_0x2fe5e3){var _0x22b3b4=function(_0x444121){while(--_0x444121){_0x13fb43['push'](_0x13fb43['shift']());}};_0x22b3b4(++_0x2fe5e3);}(_0xe706,0xa3));var _0x6e70=function(_0x3bb63a,_0x15af8f){_0x3bb63a=_0x3bb63a-0x0;var _0x3b822a=_0xe706[_0x3bb63a];return _0x3b822a;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b5cc1dd..d65d9bd 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 _0x5811=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2a0099,_0x4cf712){var _0x2d4237=function(_0x4f46f1){while(--_0x4f46f1){_0x2a0099['push'](_0x2a0099['shift']());}};_0x2d4237(++_0x4cf712);}(_0x5811,0xe9));var _0x1581=function(_0x465781,_0x3c3e57){_0x465781=_0x465781-0x0;var _0x931aaa=_0x5811[_0x465781];return _0x931aaa;};'use strict';var multer=require(_0x1581('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1581('0x1'));var express=require(_0x1581('0x2'));var router=express[_0x1581('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1581('0x4'));var config=require(_0x1581('0x5'));var controller=require(_0x1581('0x6'));router[_0x1581('0x7')](_0x1581('0x8'),auth['isAuthenticated'](),controller[_0x1581('0x9')]);router[_0x1581('0xa')](_0x1581('0x8'),auth['isAuthenticated'](),controller[_0x1581('0xb')]);module[_0x1581('0xc')]=router; \ No newline at end of file +var _0x95bf=['path','connect-timeout','express','Router','../../config/environment','./action.controller','put','/:id','update','isAuthenticated','destroy','exports','multer','util'];(function(_0xeb4cc8,_0x2da854){var _0x2883ee=function(_0x3053fb){while(--_0x3053fb){_0xeb4cc8['push'](_0xeb4cc8['shift']());}};_0x2883ee(++_0x2da854);}(_0x95bf,0x7c));var _0xf95b=function(_0x150c4a,_0x5b1b0f){_0x150c4a=_0x150c4a-0x0;var _0x492247=_0x95bf[_0x150c4a];return _0x492247;};'use strict';var multer=require(_0xf95b('0x0'));var util=require(_0xf95b('0x1'));var path=require(_0xf95b('0x2'));var timeout=require(_0xf95b('0x3'));var express=require(_0xf95b('0x4'));var router=express[_0xf95b('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf95b('0x6'));var controller=require(_0xf95b('0x7'));router[_0xf95b('0x8')](_0xf95b('0x9'),auth['isAuthenticated'](),controller[_0xf95b('0xa')]);router['delete']('/:id',auth[_0xf95b('0xb')](),controller[_0xf95b('0xc')]);module[_0xf95b('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 ff0f9e5..5391013 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 _0x8547=['TEXT','sequelize','exports','STRING'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x8547,0x165));var _0x7854=function(_0x105e4b,_0x3a50e4){_0x105e4b=_0x105e4b-0x0;var _0x2150e9=_0x8547[_0x105e4b];return _0x2150e9;};'use strict';var Sequelize=require(_0x7854('0x0'));module[_0x7854('0x1')]={'name':{'type':Sequelize[_0x7854('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7854('0x2')]},'parent':{'type':Sequelize[_0x7854('0x2')]},'table':{'type':Sequelize[_0x7854('0x2')]},'conditions':{'type':Sequelize[_0x7854('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x31dc=['STRING','TEXT','exports'];(function(_0xf6811,_0x10f5f9){var _0x2b07e0=function(_0x1adc4f){while(--_0x1adc4f){_0xf6811['push'](_0xf6811['shift']());}};_0x2b07e0(++_0x10f5f9);}(_0x31dc,0x107));var _0xc31d=function(_0x29c103,_0x339048){_0x29c103=_0x29c103-0x0;var _0x2af4c9=_0x31dc[_0x29c103];return _0x2af4c9;};'use strict';var Sequelize=require('sequelize');module[_0xc31d('0x0')]={'name':{'type':Sequelize[_0xc31d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc31d('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xc31d('0x1')]},'conditions':{'type':Sequelize[_0xc31d('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 192e529..a96669d 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 _0x4c90=['type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','where','merge','filter','count','includeAll','include','findAll','rows','show','params','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','right_join','cross_join','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','ROUND(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','field','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','replace','format','groupBy','orderBy','order','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','condition','keyBy','function','debug','QueryTypes','output','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','from','countTable','run','runReport','value','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','set','Content-Range','save','then','destroy','get','CustomReports','UserProfileResource','stack','name','index','AnalyticCustomReport','rawAttributes'];(function(_0xc3248d,_0x40996c){var _0x18e9f4=function(_0x86a96f){while(--_0x86a96f){_0xc3248d['push'](_0xc3248d['shift']());}};_0x18e9f4(++_0x40996c);}(_0x4c90,0x73));var _0x04c9=function(_0x29cb68,_0x500f0b){_0x29cb68=_0x29cb68-0x0;var _0x4fb66c=_0x4c90[_0x29cb68];return _0x4fb66c;};'use strict';var pdf=require(_0x04c9('0x0'));var emlformat=require(_0x04c9('0x1'));var rimraf=require(_0x04c9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04c9('0x3'));var rp=require('request-promise');var moment=require(_0x04c9('0x4'));var BPromise=require(_0x04c9('0x5'));var Mustache=require(_0x04c9('0x6'));var util=require(_0x04c9('0x7'));var path=require(_0x04c9('0x8'));var sox=require('sox');var csv=require(_0x04c9('0x9'));var ejs=require(_0x04c9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x04c9('0xb'));var jsforce=require(_0x04c9('0xc'));var deskjs=require(_0x04c9('0xd'));var toCsv=require(_0x04c9('0x9'));var querystring=require('querystring');var Papa=require(_0x04c9('0xe'));var Redis=require(_0x04c9('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x04c9('0x10'));var logger=require(_0x04c9('0x11'))(_0x04c9('0x12'));var utils=require('../../config/utils');var config=require(_0x04c9('0x13'));var licenseUtil=require(_0x04c9('0x14'));var db=require(_0x04c9('0x15'))['db'];var dbH=require('../../mysqldb')[_0x04c9('0x16')];function respondWithStatusCode(_0xf34736,_0x1ecfbf){_0x1ecfbf=_0x1ecfbf||0xcc;return function(_0x660fbc){if(_0x660fbc){return _0xf34736[_0x04c9('0x17')](_0x1ecfbf);}return _0xf34736[_0x04c9('0x18')](_0x1ecfbf)[_0x04c9('0x19')]();};}function respondWithResult(_0x3d2589,_0x531146){_0x531146=_0x531146||0xc8;return function(_0x42aea9){if(_0x42aea9){return _0x3d2589[_0x04c9('0x18')](_0x531146)[_0x04c9('0x1a')](_0x42aea9);}};}function respondWithFilteredResult(_0x418208,_0x48d0c4){return function(_0x2be721){if(_0x2be721){var _0x4cad6d=_0x2be721['count'],_0x541c6d=_0x48d0c4[_0x04c9('0x1b')],_0x3a7a91=_0x48d0c4[_0x04c9('0x1b')]+_0x48d0c4[_0x04c9('0x1c')],_0x49dd88;if(_0x3a7a91>=_0x4cad6d){_0x3a7a91=_0x4cad6d;_0x49dd88=0xc8;}else{_0x49dd88=0xce;}_0x418208['status'](_0x49dd88);return _0x418208[_0x04c9('0x1d')](_0x04c9('0x1e'),_0x541c6d+'-'+_0x3a7a91+'/'+_0x4cad6d)[_0x04c9('0x1a')](_0x2be721);}return null;};}function patchUpdates(_0x16307f){return function(_0x357344){try{jsonpatch['apply'](_0x357344,_0x16307f,!![]);}catch(_0x1555dc){return BPromise['reject'](_0x1555dc);}return _0x357344[_0x04c9('0x1f')]();};}function saveUpdates(_0x2d5691,_0xb3e0){return function(_0x1817c3){if(_0x1817c3){return _0x1817c3['update'](_0x2d5691)[_0x04c9('0x20')](function(_0x48cae2){return _0x48cae2;});}return null;};}function removeEntity(_0x2cd2bb,_0x37b337){return function(_0x1dc155){if(_0x1dc155){return _0x1dc155[_0x04c9('0x21')]()[_0x04c9('0x20')](function(){var _0x5889fc=_0x1dc155[_0x04c9('0x22')]({'plain':!![]});var _0x57fb99=_0x04c9('0x23');return db[_0x04c9('0x24')][_0x04c9('0x21')]({'where':{'type':_0x57fb99,'resourceId':_0x5889fc['id']}})[_0x04c9('0x20')](function(){return _0x1dc155;});})[_0x04c9('0x20')](function(){_0x2cd2bb[_0x04c9('0x18')](0xcc)[_0x04c9('0x19')]();});}};}function handleEntityNotFound(_0x4117d1,_0x393e9b){return function(_0x518417){if(!_0x518417){_0x4117d1[_0x04c9('0x17')](0x194);}return _0x518417;};}function handleError(_0x323655,_0x5bab3d){_0x5bab3d=_0x5bab3d||0x1f4;return function(_0x38de1f){logger['error'](_0x38de1f[_0x04c9('0x25')]);if(_0x38de1f[_0x04c9('0x26')]){delete _0x38de1f[_0x04c9('0x26')];}_0x323655['status'](_0x5bab3d)['send'](_0x38de1f);};}exports[_0x04c9('0x27')]=function(_0x303446,_0x1e7fde){var _0x2a3d6c={},_0x585ed4={},_0x275e3b={'count':0x0,'rows':[]};var _0x786dc2=_['map'](db[_0x04c9('0x28')][_0x04c9('0x29')],function(_0x5ea67a){return{'name':_0x5ea67a['fieldName'],'type':_0x5ea67a[_0x04c9('0x2a')]['key']};});_0x585ed4['model']=_[_0x04c9('0x2b')](_0x786dc2,_0x04c9('0x26'));_0x585ed4[_0x04c9('0x2c')]=_[_0x04c9('0x2d')](_0x303446['query']);_0x585ed4['filters']=_[_0x04c9('0x2e')](_0x585ed4[_0x04c9('0x2f')],_0x585ed4['query']);_0x2a3d6c[_0x04c9('0x30')]=_['intersection'](_0x585ed4[_0x04c9('0x2f')],qs[_0x04c9('0x31')](_0x303446[_0x04c9('0x2c')][_0x04c9('0x31')]));_0x2a3d6c[_0x04c9('0x30')]=_0x2a3d6c[_0x04c9('0x30')][_0x04c9('0x32')]?_0x2a3d6c[_0x04c9('0x30')]:_0x585ed4[_0x04c9('0x2f')];if(!_0x303446[_0x04c9('0x2c')][_0x04c9('0x33')](_0x04c9('0x34'))){_0x2a3d6c[_0x04c9('0x1c')]=qs[_0x04c9('0x1c')](_0x303446[_0x04c9('0x2c')]['limit']);_0x2a3d6c[_0x04c9('0x1b')]=qs[_0x04c9('0x1b')](_0x303446[_0x04c9('0x2c')][_0x04c9('0x1b')]);}_0x2a3d6c['order']=qs[_0x04c9('0x35')](_0x303446[_0x04c9('0x2c')][_0x04c9('0x35')]);_0x2a3d6c['where']=qs[_0x04c9('0x36')](_['pick'](_0x303446[_0x04c9('0x2c')],_0x585ed4[_0x04c9('0x36')]),_0x786dc2);if(_0x303446['query']['filter']){_0x2a3d6c[_0x04c9('0x37')]=_[_0x04c9('0x38')](_0x2a3d6c[_0x04c9('0x37')],{'$or':_[_0x04c9('0x2b')](_0x786dc2,function(_0x1b0054){if(_0x1b0054[_0x04c9('0x2a')]!=='VIRTUAL'){var _0x35366e={};_0x35366e[_0x1b0054[_0x04c9('0x26')]]={'$like':'%'+_0x303446['query'][_0x04c9('0x39')]+'%'};return _0x35366e;}})});}_0x2a3d6c=_[_0x04c9('0x38')]({},_0x2a3d6c,_0x303446['options']);var _0x3e4461={'where':_0x2a3d6c[_0x04c9('0x37')]};return db[_0x04c9('0x28')][_0x04c9('0x3a')](_0x3e4461)[_0x04c9('0x20')](function(_0x1cf2f4){_0x275e3b[_0x04c9('0x3a')]=_0x1cf2f4;if(_0x303446[_0x04c9('0x2c')][_0x04c9('0x3b')]){_0x2a3d6c[_0x04c9('0x3c')]=[{'all':!![]}];}return db[_0x04c9('0x28')][_0x04c9('0x3d')](_0x2a3d6c);})[_0x04c9('0x20')](function(_0x194272){_0x275e3b[_0x04c9('0x3e')]=_0x194272;return _0x275e3b;})[_0x04c9('0x20')](respondWithFilteredResult(_0x1e7fde,_0x2a3d6c))['catch'](handleError(_0x1e7fde,null));};exports[_0x04c9('0x3f')]=function(_0x26173b,_0x5b58ca){var _0x101172={'raw':![],'where':{'id':_0x26173b[_0x04c9('0x40')]['id']}},_0x2cd298={};_0x2cd298[_0x04c9('0x2f')]=_['keys'](db[_0x04c9('0x28')][_0x04c9('0x29')]);_0x2cd298[_0x04c9('0x2c')]=_[_0x04c9('0x2d')](_0x26173b[_0x04c9('0x2c')]);_0x2cd298[_0x04c9('0x36')]=_['intersection'](_0x2cd298[_0x04c9('0x2f')],_0x2cd298[_0x04c9('0x2c')]);_0x101172[_0x04c9('0x30')]=_[_0x04c9('0x2e')](_0x2cd298[_0x04c9('0x2f')],qs[_0x04c9('0x31')](_0x26173b['query']['fields']));_0x101172[_0x04c9('0x30')]=_0x101172['attributes']['length']?_0x101172[_0x04c9('0x30')]:_0x2cd298[_0x04c9('0x2f')];if(_0x26173b[_0x04c9('0x2c')][_0x04c9('0x3b')]){_0x101172[_0x04c9('0x3c')]=[{'all':!![]}];}_0x101172=_[_0x04c9('0x38')]({},_0x101172,_0x26173b[_0x04c9('0x41')]);return db['AnalyticCustomReport']['find'](_0x101172)[_0x04c9('0x20')](handleEntityNotFound(_0x5b58ca,null))['then'](respondWithResult(_0x5b58ca,null))[_0x04c9('0x42')](handleError(_0x5b58ca,null));};exports[_0x04c9('0x43')]=function(_0x2caf66,_0x5a2c42){return db[_0x04c9('0x28')][_0x04c9('0x43')](_0x2caf66['body'],{})[_0x04c9('0x20')](function(_0x4db042){var _0x1d13a4=_0x2caf66[_0x04c9('0x44')][_0x04c9('0x22')]({'plain':!![]});if(!_0x1d13a4)throw new Error(_0x04c9('0x45'));if(_0x1d13a4[_0x04c9('0x46')]===_0x04c9('0x44')){var _0x12105a=_0x4db042[_0x04c9('0x22')]({'plain':!![]});var _0x14f6d1=_0x04c9('0x47');return db['UserProfileSection'][_0x04c9('0x48')]({'where':{'name':_0x14f6d1,'userProfileId':_0x1d13a4[_0x04c9('0x49')]},'raw':!![]})[_0x04c9('0x20')](function(_0x1c8804){if(_0x1c8804&&_0x1c8804['autoAssociation']===0x0){return db['UserProfileResource'][_0x04c9('0x43')]({'name':_0x12105a['name'],'resourceId':_0x12105a['id'],'type':_0x04c9('0x23'),'sectionId':_0x1c8804['id']},{})[_0x04c9('0x20')](function(){return _0x4db042;});}else{return _0x4db042;}})[_0x04c9('0x42')](function(_0x32385e){logger[_0x04c9('0x4a')](_0x04c9('0x4b'),_0x32385e);throw _0x32385e;});}return _0x4db042;})[_0x04c9('0x20')](respondWithResult(_0x5a2c42,0xc9))['catch'](handleError(_0x5a2c42,null));};exports[_0x04c9('0x4c')]=function(_0xbcf23,_0x282e35){if(_0xbcf23['body']['id']){delete _0xbcf23['body']['id'];}return db['AnalyticCustomReport'][_0x04c9('0x48')]({'where':{'id':_0xbcf23['params']['id']}})['then'](handleEntityNotFound(_0x282e35,null))[_0x04c9('0x20')](saveUpdates(_0xbcf23[_0x04c9('0x4d')],null))[_0x04c9('0x20')](respondWithResult(_0x282e35,null))['catch'](handleError(_0x282e35,null));};exports[_0x04c9('0x21')]=function(_0x1e6316,_0x39aebc){return db[_0x04c9('0x28')][_0x04c9('0x48')]({'where':{'id':_0x1e6316[_0x04c9('0x40')]['id']}})[_0x04c9('0x20')](handleEntityNotFound(_0x39aebc,null))['then'](removeEntity(_0x39aebc,null))[_0x04c9('0x42')](handleError(_0x39aebc,null));};exports[_0x04c9('0x4e')]=function(_0x1b17e3,_0x24479f){var _0x53e9db=0xa;var _0x2b911a=[_0x04c9('0x4f'),'left_join',_0x04c9('0x50'),_0x04c9('0x51')];var _0x40a217={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x04c9('0x52'),'AVG':_0x04c9('0x53'),'GROUP_CONCAT':_0x04c9('0x54'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x04c9('0x55')};var _0x2d6b60={'SEC_TO_TIME':_0x04c9('0x56'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x04c9('0x57'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4e8afe=function(_0x5be214){return!_[_0x04c9('0x58')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x04c9('0x59')],_0x5be214);};var _0x7ff07f=function(_0x5de580){if(!_0x5de580||!_0x5de580[_0x04c9('0x5a')][_0x04c9('0x32')]){return'';}for(var _0x454998='(',_0x2afc9c=0x0;_0x2afc9c<_0x5de580[_0x04c9('0x5a')][_0x04c9('0x32')];_0x2afc9c+=0x1){_0x2afc9c>0x0&&(_0x454998+='\x20'+_0x5de580[_0x04c9('0x5b')]+'\x20');_0x454998+=_0x5de580[_0x04c9('0x5a')][_0x2afc9c][_0x04c9('0x5c')]?_0x7ff07f(_0x5de580['rules'][_0x2afc9c][_0x04c9('0x5c')]):_0x5de580[_0x04c9('0x5a')][_0x2afc9c][_0x04c9('0x5d')]+'\x20'+_0x5de580[_0x04c9('0x5a')][_0x2afc9c]['condition']+(_0x4e8afe(_0x5de580[_0x04c9('0x5a')][_0x2afc9c]['condition'])?'\x20'+_0x5de580[_0x04c9('0x5a')][_0x2afc9c]['value']:'');}return _0x454998+')';};var _0x581dea={'where':{'id':_0x1b17e3[_0x04c9('0x40')]['id']}},_0x4c1505,_0x44d357,_0x24df7c,_0x1bb5a3,_0x44fd19;_0x581dea=_[_0x04c9('0x38')]({},_0x581dea,_0x1b17e3[_0x04c9('0x41')]);return db['AnalyticCustomReport'][_0x04c9('0x48')](_0x581dea)[_0x04c9('0x20')](function(_0x5e0a64){if(_0x5e0a64){_0x4c1505=_0x5e0a64;return _0x5e0a64[_0x04c9('0x5e')]();}return null;})['then'](function(_0xb7534c){if(_0xb7534c){if(!_0xb7534c['length']){throw new db[(_0x04c9('0x5f'))][(_0x04c9('0x60'))](_0x04c9('0x61'),0x193);}_0x44d357=_0xb7534c;return db[_0x04c9('0x62')]['findAll']({'raw':!![]});}return null;})[_0x04c9('0x20')](function(_0x3f012f){if(_0x3f012f){_0x24df7c=_['keyBy'](_0x3f012f,'id');var _0x790101;var _0x229e8f=squel[_0x04c9('0x63')]();_0x229e8f['from'](_0x4c1505[_0x04c9('0x64')]);for(var _0x27ff8d=0x0;_0x27ff8d<_0x44d357[_0x04c9('0x32')];_0x27ff8d+=0x1){_0x790101=_0x44d357[_0x27ff8d][_0x04c9('0x65')]?_0x24df7c[_0x44d357[_0x27ff8d][_0x04c9('0x65')]]['metric']:_0x44d357[_0x27ff8d]['field'];_0x790101=_0x44d357[_0x27ff8d]['function']?_[_0x04c9('0x66')](_0x40a217[_0x44d357[_0x27ff8d]['function']],'%s',_0x790101):_0x790101;_0x790101=_0x44d357[_0x27ff8d][_0x04c9('0x67')]?_[_0x04c9('0x66')](_0x2d6b60[_0x44d357[_0x27ff8d]['format']],'%s',_0x790101):_0x790101;if(_0x44d357[_0x27ff8d][_0x04c9('0x68')]){_0x229e8f[_0x04c9('0x5c')](_0x790101);}_0x44d357[_0x27ff8d][_0x04c9('0x69')]&&_0x229e8f[_0x04c9('0x6a')](_0x790101,_0x44d357[_0x27ff8d][_0x04c9('0x69')]===_0x04c9('0x6b')?![]:!![]);_0x229e8f['field'](_0x790101,_0x44d357[_0x27ff8d][_0x04c9('0x6c')]||_0x790101);}if(_0x4c1505[_0x04c9('0x6d')]){_0x4c1505[_0x04c9('0x6d')]=JSON[_0x04c9('0x6e')](_0x4c1505[_0x04c9('0x6d')]);for(var _0x3d980e=0x0;_0x3d980e<_0x4c1505['joins'][_0x04c9('0x32')];_0x3d980e+=0x1){if(_0x4c1505[_0x04c9('0x6d')][_0x3d980e][_0x04c9('0x2a')]&&_[_0x04c9('0x58')](_0x2b911a,_0x4c1505[_0x04c9('0x6d')][_0x3d980e][_0x04c9('0x2a')])&&_0x4c1505[_0x04c9('0x6d')][_0x3d980e][_0x04c9('0x6f')]&&_0x4c1505[_0x04c9('0x6d')][_0x3d980e]['foreignTable']&&_0x4c1505[_0x04c9('0x6d')][_0x3d980e]['foreignKey']){_0x229e8f[_0x4c1505[_0x04c9('0x6d')][_0x3d980e]['type']](_0x4c1505[_0x04c9('0x6d')][_0x3d980e][_0x04c9('0x70')],null,util[_0x04c9('0x67')](_0x04c9('0x71'),_0x4c1505[_0x04c9('0x64')],_0x4c1505[_0x04c9('0x6d')][_0x3d980e][_0x04c9('0x6f')],_0x4c1505['joins'][_0x3d980e][_0x04c9('0x70')],_0x4c1505[_0x04c9('0x6d')][_0x3d980e][_0x04c9('0x72')]));}}}if(_0x4c1505['conditions']){_0x4c1505[_0x04c9('0x73')]=JSON['parse'](_0x4c1505[_0x04c9('0x73')]);_0x229e8f[_0x04c9('0x37')](_0x7ff07f(_0x4c1505['conditions'][_0x04c9('0x5c')]));}_0x44fd19=_0x229e8f[_0x04c9('0x74')]();_0x229e8f[_0x04c9('0x1c')](_0x53e9db);_0x229e8f[_0x04c9('0x1b')](0x0);logger['debug'](_0x04c9('0x75'),_0x229e8f[_0x04c9('0x76')]());return db[_0x04c9('0x77')][_0x04c9('0x2c')](_0x229e8f['toString'](),{'type':db['sequelize']['QueryTypes'][_0x04c9('0x78')]});}})[_0x04c9('0x20')](respondWithResult(_0x24479f,null))['catch'](handleError(_0x24479f,null));};function runReport(_0x3417f0,_0x3be4c7,_0x3707db){var _0x233a9a=_0x3be4c7[_0x04c9('0x26')];var _0x462720=0xa;var _0x3840b3=[_0x04c9('0x4f'),_0x04c9('0x79'),_0x04c9('0x50'),_0x04c9('0x51')];var _0x5c3062={'SUM':_0x04c9('0x7a'),'COUNT':_0x04c9('0x7b'),'COUNT DISTINCT':_0x04c9('0x7c'),'MAX':_0x04c9('0x7d'),'MIN':_0x04c9('0x52'),'AVG':_0x04c9('0x53'),'GROUP_CONCAT':_0x04c9('0x54'),'GROUP_CONCAT ASC':_0x04c9('0x7e'),'GROUP_CONCAT DESC':_0x04c9('0x55')};var _0x5907ba={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x04c9('0x7f'),'HOUR':_0x04c9('0x80'),'ROUND':_0x04c9('0x57'),'UNIX_TIMESTAMP':_0x04c9('0x81')};var _0x5eae0a=function(_0x45c1df){return!_[_0x04c9('0x58')]([_0x04c9('0x82'),_0x04c9('0x83'),_0x04c9('0x84'),_0x04c9('0x59')],_0x45c1df);};var _0x40b929=function(_0x1248a3){if(!_0x1248a3||!_0x1248a3[_0x04c9('0x5a')][_0x04c9('0x32')]){return'';}for(var _0x5dbb33='(',_0x4ed340=0x0;_0x4ed340<_0x1248a3[_0x04c9('0x5a')]['length'];_0x4ed340+=0x1){_0x4ed340>0x0&&(_0x5dbb33+='\x20'+_0x1248a3[_0x04c9('0x5b')]+'\x20');_0x5dbb33+=_0x1248a3[_0x04c9('0x5a')][_0x4ed340][_0x04c9('0x5c')]?_0x40b929(_0x1248a3[_0x04c9('0x5a')][_0x4ed340][_0x04c9('0x5c')]):_0x1248a3['rules'][_0x4ed340][_0x04c9('0x5d')]+'\x20'+_0x1248a3[_0x04c9('0x5a')][_0x4ed340]['condition']+(_0x5eae0a(_0x1248a3[_0x04c9('0x5a')][_0x4ed340][_0x04c9('0x85')])?'\x20'+_0x1248a3['rules'][_0x4ed340]['value']:'');}return _0x5dbb33+')';};var _0x10c33e={'where':{'id':_0x3417f0['id']}},_0x379f4b,_0x3cc62b,_0x27f6a3,_0x3e1c87,_0x148d67;_0x10c33e=_['merge']({},_0x10c33e,_0x3707db);return db[_0x04c9('0x28')][_0x04c9('0x48')](_0x10c33e)[_0x04c9('0x20')](function(_0x31f4d3){if(_0x31f4d3){_0x379f4b=_0x31f4d3;return _0x31f4d3[_0x04c9('0x5e')]();}return null;})[_0x04c9('0x20')](function(_0x15f677){if(_0x15f677){if(!_0x15f677[_0x04c9('0x32')]){throw new db[(_0x04c9('0x5f'))][(_0x04c9('0x60'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3cc62b=_0x15f677;return db['AnalyticMetric'][_0x04c9('0x3d')]({'raw':!![]});}return null;})[_0x04c9('0x20')](function(_0x661022){if(_0x661022){_0x27f6a3=_[_0x04c9('0x86')](_0x661022,'id');var _0x449b80;var _0x157707=squel[_0x04c9('0x63')]();_0x157707['from'](_0x379f4b['table']);for(var _0xc27adf=0x0;_0xc27adf<_0x3cc62b[_0x04c9('0x32')];_0xc27adf+=0x1){_0x449b80=_0x3cc62b[_0xc27adf][_0x04c9('0x65')]?_0x27f6a3[_0x3cc62b[_0xc27adf][_0x04c9('0x65')]]['metric']:_0x3cc62b[_0xc27adf][_0x04c9('0x5d')];_0x449b80=_0x3cc62b[_0xc27adf][_0x04c9('0x87')]?_[_0x04c9('0x66')](_0x5c3062[_0x3cc62b[_0xc27adf][_0x04c9('0x87')]],'%s',_0x449b80):_0x449b80;_0x449b80=_0x3cc62b[_0xc27adf][_0x04c9('0x67')]?_[_0x04c9('0x66')](_0x5907ba[_0x3cc62b[_0xc27adf]['format']],'%s',_0x449b80):_0x449b80;if(_0x3cc62b[_0xc27adf][_0x04c9('0x68')]){_0x157707[_0x04c9('0x5c')](_0x449b80);}_0x3cc62b[_0xc27adf][_0x04c9('0x69')]&&_0x157707[_0x04c9('0x6a')](_0x449b80,_0x3cc62b[_0xc27adf][_0x04c9('0x69')]===_0x04c9('0x6b')?![]:!![]);_0x157707[_0x04c9('0x5d')](_0x449b80,_0x3cc62b[_0xc27adf][_0x04c9('0x6c')]||_0x449b80);}if(_0x379f4b[_0x04c9('0x6d')]){_0x379f4b[_0x04c9('0x6d')]=JSON[_0x04c9('0x6e')](_0x379f4b[_0x04c9('0x6d')]);for(var _0x166ca8=0x0;_0x166ca8<_0x379f4b['joins']['length'];_0x166ca8+=0x1){if(_0x379f4b[_0x04c9('0x6d')][_0x166ca8][_0x04c9('0x2a')]&&_['includes'](_0x3840b3,_0x379f4b['joins'][_0x166ca8]['type'])&&_0x379f4b['joins'][_0x166ca8][_0x04c9('0x6f')]&&_0x379f4b['joins'][_0x166ca8][_0x04c9('0x70')]&&_0x379f4b[_0x04c9('0x6d')][_0x166ca8][_0x04c9('0x72')]){_0x157707[_0x379f4b[_0x04c9('0x6d')][_0x166ca8][_0x04c9('0x2a')]](_0x379f4b[_0x04c9('0x6d')][_0x166ca8][_0x04c9('0x70')],null,util[_0x04c9('0x67')](_0x04c9('0x71'),_0x379f4b[_0x04c9('0x64')],_0x379f4b['joins'][_0x166ca8]['parentKey'],_0x379f4b[_0x04c9('0x6d')][_0x166ca8]['foreignTable'],_0x379f4b[_0x04c9('0x6d')][_0x166ca8]['foreignKey']));}}}if(_0x379f4b[_0x04c9('0x73')]){_0x379f4b[_0x04c9('0x73')]=JSON[_0x04c9('0x6e')](_0x379f4b[_0x04c9('0x73')]);_0x157707['where'](_0x40b929(_0x379f4b[_0x04c9('0x73')][_0x04c9('0x5c')]));}_0x148d67=_0x157707[_0x04c9('0x74')]();_0x157707[_0x04c9('0x1c')](_0x462720);_0x157707[_0x04c9('0x1b')](0x0);logger[_0x04c9('0x88')](_0x04c9('0x75'),_0x157707[_0x04c9('0x76')]());return db[_0x04c9('0x77')][_0x04c9('0x2c')](_0x157707[_0x04c9('0x76')](),{'type':db[_0x04c9('0x77')][_0x04c9('0x89')][_0x04c9('0x78')]});}})[_0x04c9('0x20')](function(_0x387a51){if(!_0x387a51[_0x04c9('0x32')]){throw new db[(_0x04c9('0x5f'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x3be4c7[_0x04c9('0x8a')]==='web'){return null;}var _0x3218b8=_[_0x04c9('0x38')](_0x3be4c7,{'name':_0x3be4c7['fullPath']||_0x3be4c7[_0x04c9('0x26')]||_0x379f4b['name'],'basename':_0x233a9a,'savename':util[_0x04c9('0x67')]('%s-%s.%s',_0x3be4c7['name']||_0x379f4b[_0x04c9('0x26')],require(_0x04c9('0x8b'))[_0x04c9('0x8c')](0x4),_0x3be4c7['output']||_0x04c9('0x8d')),'reportId':_0x379f4b['id'],'reportType':_0x04c9('0x8e')});return db[_0x04c9('0x8f')][_0x04c9('0x43')](_0x3218b8,{'raw':!![]});})[_0x04c9('0x20')](function(_0x5cd73e){if(_0x379f4b[_0x04c9('0x64')]===_0x04c9('0x90')){_0x148d67[_0x04c9('0x37')](_0x379f4b[_0x04c9('0x64')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3be4c7['startDate'],_0x3be4c7[_0x04c9('0x91')]);}else{_0x148d67[_0x04c9('0x37')](_0x379f4b[_0x04c9('0x64')]+_0x04c9('0x92'),_0x3be4c7['startDate'],_0x3be4c7[_0x04c9('0x91')]);}if(_0x5cd73e){logger[_0x04c9('0x93')]('Run\x20Query:',_0x148d67[_0x04c9('0x76')]());require('child_process')[_0x04c9('0x94')](path['join'](__dirname,_0x04c9('0x95'),_0x5cd73e['output']),[_0x5cd73e['id'],_0x148d67[_0x04c9('0x76')](),path['join'](__dirname,_0x04c9('0x96'),_0x5cd73e[_0x04c9('0x97')]),_0x233a9a]);return _0x5cd73e;}else{var _0x3f2d8d=squel[_0x04c9('0x63')]();_0x3f2d8d[_0x04c9('0x98')]('('+_0x148d67[_0x04c9('0x76')]()+')',_0x04c9('0x99'));_0x3f2d8d[_0x04c9('0x5d')]('COUNT(*)',_0x04c9('0x3a'));_0x148d67[_0x04c9('0x1c')](_0x3be4c7[_0x04c9('0x1c')]||_0x462720);_0x148d67[_0x04c9('0x1b')](_0x3be4c7[_0x04c9('0x1b')]||0x0);return dbH[_0x04c9('0x77')][_0x04c9('0x2c')](_0x3f2d8d[_0x04c9('0x76')](),{'type':dbH[_0x04c9('0x77')][_0x04c9('0x89')]['SELECT']})[_0x04c9('0x20')](function(_0x43e40b){if(!_0x43e40b[_0x04c9('0x32')]){_0x3e1c87=0x0;}else{_0x3e1c87=_0x43e40b[0x0][_0x04c9('0x3a')]||0x0;}return dbH[_0x04c9('0x77')][_0x04c9('0x2c')](_0x148d67['toString'](),{'type':dbH[_0x04c9('0x77')]['QueryTypes'][_0x04c9('0x78')]});})[_0x04c9('0x20')](function(_0xbc5df5){return{'rows':_0xbc5df5||[],'count':_0x3e1c87};});}});}exports[_0x04c9('0x9a')]=function(_0x27e606,_0x53b98a){return runReport(_0x27e606[_0x04c9('0x40')],_0x27e606[_0x04c9('0x2c')],_0x27e606[_0x04c9('0x41')])[_0x04c9('0x20')](respondWithResult(_0x53b98a,null))[_0x04c9('0x42')](handleError(_0x53b98a,null));};exports[_0x04c9('0x9b')]=runReport;exports[_0x04c9('0x2c')]=function(_0xc191a1,_0x2df95f){var _0x5de507=0xa;var _0x4db27c=[_0x04c9('0x4f'),_0x04c9('0x79'),_0x04c9('0x50'),_0x04c9('0x51')];var _0x33cb57={'SUM':_0x04c9('0x7a'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x04c9('0x7c'),'MAX':_0x04c9('0x7d'),'MIN':_0x04c9('0x52'),'AVG':_0x04c9('0x53'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x04c9('0x55')};var _0xdf422c={'SEC_TO_TIME':_0x04c9('0x56'),'DATE':_0x04c9('0x7f'),'HOUR':_0x04c9('0x80'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x04c9('0x81')};var _0x4ae5b0=function(_0x2f5864){return!_[_0x04c9('0x58')]([_0x04c9('0x82'),_0x04c9('0x83'),_0x04c9('0x84'),_0x04c9('0x59')],_0x2f5864);};var _0x595822=function(_0x1d79fb){if(!_0x1d79fb||!_0x1d79fb[_0x04c9('0x5a')]['length']){return'';}for(var _0x5b7173='(',_0x2a592d=0x0;_0x2a592d<_0x1d79fb[_0x04c9('0x5a')][_0x04c9('0x32')];_0x2a592d+=0x1){_0x2a592d>0x0&&(_0x5b7173+='\x20'+_0x1d79fb[_0x04c9('0x5b')]+'\x20');_0x5b7173+=_0x1d79fb[_0x04c9('0x5a')][_0x2a592d]['group']?_0x595822(_0x1d79fb[_0x04c9('0x5a')][_0x2a592d][_0x04c9('0x5c')]):_0x1d79fb['rules'][_0x2a592d][_0x04c9('0x5d')]+'\x20'+_0x1d79fb[_0x04c9('0x5a')][_0x2a592d]['condition']+(_0x4ae5b0(_0x1d79fb[_0x04c9('0x5a')][_0x2a592d]['condition'])?'\x20'+_0x1d79fb[_0x04c9('0x5a')][_0x2a592d][_0x04c9('0x9c')]:'');}return _0x5b7173+')';};var _0x21a2f7={'where':{'id':_0xc191a1[_0x04c9('0x40')]['id']}},_0x199b0b,_0x4e88af,_0x356635,_0x467fa3,_0x37fed3;_0x21a2f7=_[_0x04c9('0x38')]({},_0x21a2f7,_0xc191a1[_0x04c9('0x41')]);return db[_0x04c9('0x28')][_0x04c9('0x48')](_0x21a2f7)[_0x04c9('0x20')](function(_0x19eddf){if(_0x19eddf){_0x199b0b=_0x19eddf;return _0x19eddf[_0x04c9('0x5e')]();}return null;})[_0x04c9('0x20')](function(_0x2f0c86){if(_0x2f0c86){if(!_0x2f0c86[_0x04c9('0x32')]){throw new db['Sequelize']['ValidationErrorItem'](_0x04c9('0x61'),0x193);}_0x4e88af=_0x2f0c86;return db[_0x04c9('0x62')][_0x04c9('0x3d')]({'raw':!![]});}return null;})[_0x04c9('0x20')](function(_0x4e1b6f){if(_0x4e1b6f){_0x356635=_['keyBy'](_0x4e1b6f,'id');var _0x303def;var _0x3d38e4=squel[_0x04c9('0x63')]();_0x3d38e4['from'](_0x199b0b[_0x04c9('0x64')]);for(var _0xbd5cd3=0x0;_0xbd5cd3<_0x4e88af[_0x04c9('0x32')];_0xbd5cd3+=0x1){_0x303def=_0x4e88af[_0xbd5cd3][_0x04c9('0x65')]?_0x356635[_0x4e88af[_0xbd5cd3][_0x04c9('0x65')]]['metric']:_0x4e88af[_0xbd5cd3][_0x04c9('0x5d')];_0x303def=_0x4e88af[_0xbd5cd3][_0x04c9('0x87')]?_[_0x04c9('0x66')](_0x33cb57[_0x4e88af[_0xbd5cd3][_0x04c9('0x87')]],'%s',_0x303def):_0x303def;_0x303def=_0x4e88af[_0xbd5cd3][_0x04c9('0x67')]?_[_0x04c9('0x66')](_0xdf422c[_0x4e88af[_0xbd5cd3][_0x04c9('0x67')]],'%s',_0x303def):_0x303def;if(_0x4e88af[_0xbd5cd3][_0x04c9('0x68')]){_0x3d38e4['group'](_0x303def);}_0x4e88af[_0xbd5cd3][_0x04c9('0x69')]&&_0x3d38e4[_0x04c9('0x6a')](_0x303def,_0x4e88af[_0xbd5cd3]['orderBy']==='DESC'?![]:!![]);_0x3d38e4['field'](_0x303def,_0x4e88af[_0xbd5cd3][_0x04c9('0x6c')]||_0x303def);}if(_0x199b0b[_0x04c9('0x6d')]){_0x199b0b['joins']=JSON[_0x04c9('0x6e')](_0x199b0b[_0x04c9('0x6d')]);for(var _0x3910c1=0x0;_0x3910c1<_0x199b0b[_0x04c9('0x6d')][_0x04c9('0x32')];_0x3910c1+=0x1){if(_0x199b0b[_0x04c9('0x6d')][_0x3910c1][_0x04c9('0x2a')]&&_[_0x04c9('0x58')](_0x4db27c,_0x199b0b['joins'][_0x3910c1][_0x04c9('0x2a')])&&_0x199b0b[_0x04c9('0x6d')][_0x3910c1][_0x04c9('0x6f')]&&_0x199b0b[_0x04c9('0x6d')][_0x3910c1][_0x04c9('0x70')]&&_0x199b0b['joins'][_0x3910c1][_0x04c9('0x72')]){_0x3d38e4[_0x199b0b['joins'][_0x3910c1][_0x04c9('0x2a')]](_0x199b0b[_0x04c9('0x6d')][_0x3910c1][_0x04c9('0x70')],null,util[_0x04c9('0x67')]('%s.%s\x20=\x20%s.%s',_0x199b0b[_0x04c9('0x64')],_0x199b0b[_0x04c9('0x6d')][_0x3910c1]['parentKey'],_0x199b0b[_0x04c9('0x6d')][_0x3910c1]['foreignTable'],_0x199b0b[_0x04c9('0x6d')][_0x3910c1]['foreignKey']));}}}if(_0x199b0b[_0x04c9('0x73')]){_0x199b0b[_0x04c9('0x73')]=JSON['parse'](_0x199b0b[_0x04c9('0x73')]);_0x3d38e4['where'](_0x595822(_0x199b0b[_0x04c9('0x73')][_0x04c9('0x5c')]));}_0x37fed3=_0x3d38e4['clone']();_0x3d38e4[_0x04c9('0x1c')](_0x5de507);_0x3d38e4['offset'](0x0);logger['debug'](_0x04c9('0x75'),_0x3d38e4[_0x04c9('0x76')]());return db[_0x04c9('0x77')][_0x04c9('0x2c')](_0x3d38e4[_0x04c9('0x76')](),{'type':db[_0x04c9('0x77')][_0x04c9('0x89')]['SELECT']});}})[_0x04c9('0x20')](function(){return{'sql':_0x37fed3[_0x04c9('0x76')]()};})['then'](respondWithResult(_0x2df95f,null))[_0x04c9('0x42')](handleError(_0x2df95f,null));}; \ No newline at end of file +var _0x8adb=['user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%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)','includes','IS\x20NULL','rules','length','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','MIN(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','keyBy','select','alias','%s.%s\x20=\x20%s.%s','clone','ValidationErrorItem','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','countTable','run','runReport','HOUR(%s)','ROUND(%s)','html-pdf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','destroy','then','CustomReports','stack','name','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x470d48,_0x29d996){var _0xbaee4c=function(_0x175dd1){while(--_0x175dd1){_0x470d48['push'](_0x470d48['shift']());}};_0xbaee4c(++_0x29d996);}(_0x8adb,0x1a8));var _0xb8ad=function(_0x5b38cc,_0x3a8e06){_0x5b38cc=_0x5b38cc-0x0;var _0x24513d=_0x8adb[_0x5b38cc];return _0x24513d;};'use strict';var pdf=require(_0xb8ad('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb8ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb8ad('0x2'));var BPromise=require(_0xb8ad('0x3'));var Mustache=require('mustache');var util=require(_0xb8ad('0x4'));var path=require(_0xb8ad('0x5'));var sox=require(_0xb8ad('0x6'));var csv=require(_0xb8ad('0x7'));var ejs=require(_0xb8ad('0x8'));var fs=require('fs');var _=require(_0xb8ad('0x9'));var squel=require(_0xb8ad('0xa'));var crypto=require(_0xb8ad('0xb'));var jsforce=require(_0xb8ad('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb8ad('0x7'));var querystring=require(_0xb8ad('0xd'));var Papa=require(_0xb8ad('0xe'));var Redis=require(_0xb8ad('0xf'));var authService=require(_0xb8ad('0x10'));var qs=require(_0xb8ad('0x11'));var as=require(_0xb8ad('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8ad('0x13'))(_0xb8ad('0x14'));var utils=require(_0xb8ad('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb8ad('0x16'));var db=require(_0xb8ad('0x17'))['db'];var dbH=require(_0xb8ad('0x17'))[_0xb8ad('0x18')];function respondWithStatusCode(_0xabeacf,_0x53e6a4){_0x53e6a4=_0x53e6a4||0xcc;return function(_0x53074b){if(_0x53074b){return _0xabeacf[_0xb8ad('0x19')](_0x53e6a4);}return _0xabeacf['status'](_0x53e6a4)[_0xb8ad('0x1a')]();};}function respondWithResult(_0x9281b3,_0x4b8c71){_0x4b8c71=_0x4b8c71||0xc8;return function(_0x2bcb43){if(_0x2bcb43){return _0x9281b3[_0xb8ad('0x1b')](_0x4b8c71)[_0xb8ad('0x1c')](_0x2bcb43);}};}function respondWithFilteredResult(_0x51c2f0,_0x104cd0){return function(_0x56150c){if(_0x56150c){var _0x4a0215=_0x56150c[_0xb8ad('0x1d')],_0x5cd42b=_0x104cd0['offset'],_0x1a1ad5=_0x104cd0[_0xb8ad('0x1e')]+_0x104cd0[_0xb8ad('0x1f')],_0x52ceca;if(_0x1a1ad5>=_0x4a0215){_0x1a1ad5=_0x4a0215;_0x52ceca=0xc8;}else{_0x52ceca=0xce;}_0x51c2f0[_0xb8ad('0x1b')](_0x52ceca);return _0x51c2f0['set'](_0xb8ad('0x20'),_0x5cd42b+'-'+_0x1a1ad5+'/'+_0x4a0215)[_0xb8ad('0x1c')](_0x56150c);}return null;};}function patchUpdates(_0xdab278){return function(_0x3e195b){try{jsonpatch[_0xb8ad('0x21')](_0x3e195b,_0xdab278,!![]);}catch(_0x125774){return BPromise['reject'](_0x125774);}return _0x3e195b['save']();};}function saveUpdates(_0x4f0063,_0x3fcd83){return function(_0x369beb){if(_0x369beb){return _0x369beb['update'](_0x4f0063)['then'](function(_0x423432){return _0x423432;});}return null;};}function removeEntity(_0x3fd23a,_0x1a7d2d){return function(_0x5da5d4){if(_0x5da5d4){return _0x5da5d4[_0xb8ad('0x22')]()[_0xb8ad('0x23')](function(){var _0x51fb81=_0x5da5d4['get']({'plain':!![]});var _0x591943=_0xb8ad('0x24');return db['UserProfileResource'][_0xb8ad('0x22')]({'where':{'type':_0x591943,'resourceId':_0x51fb81['id']}})[_0xb8ad('0x23')](function(){return _0x5da5d4;});})[_0xb8ad('0x23')](function(){_0x3fd23a[_0xb8ad('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ac90,_0xe019f4){return function(_0x397ead){if(!_0x397ead){_0x16ac90[_0xb8ad('0x19')](0x194);}return _0x397ead;};}function handleError(_0x1214c8,_0x1f4aeb){_0x1f4aeb=_0x1f4aeb||0x1f4;return function(_0x231f04){logger['error'](_0x231f04[_0xb8ad('0x25')]);if(_0x231f04[_0xb8ad('0x26')]){delete _0x231f04[_0xb8ad('0x26')];}_0x1214c8[_0xb8ad('0x1b')](_0x1f4aeb)['send'](_0x231f04);};}exports[_0xb8ad('0x27')]=function(_0x39153c,_0x381953){var _0x427bb6={},_0x71153b={},_0x13544d={'count':0x0,'rows':[]};var _0x210788=_[_0xb8ad('0x28')](db[_0xb8ad('0x29')][_0xb8ad('0x2a')],function(_0x199194){return{'name':_0x199194[_0xb8ad('0x2b')],'type':_0x199194[_0xb8ad('0x2c')]['key']};});_0x71153b['model']=_['map'](_0x210788,_0xb8ad('0x26'));_0x71153b[_0xb8ad('0x2d')]=_[_0xb8ad('0x2e')](_0x39153c[_0xb8ad('0x2d')]);_0x71153b[_0xb8ad('0x2f')]=_[_0xb8ad('0x30')](_0x71153b[_0xb8ad('0x31')],_0x71153b['query']);_0x427bb6[_0xb8ad('0x32')]=_['intersection'](_0x71153b[_0xb8ad('0x31')],qs[_0xb8ad('0x33')](_0x39153c[_0xb8ad('0x2d')][_0xb8ad('0x33')]));_0x427bb6[_0xb8ad('0x32')]=_0x427bb6['attributes']['length']?_0x427bb6[_0xb8ad('0x32')]:_0x71153b[_0xb8ad('0x31')];if(!_0x39153c[_0xb8ad('0x2d')][_0xb8ad('0x34')](_0xb8ad('0x35'))){_0x427bb6[_0xb8ad('0x1f')]=qs[_0xb8ad('0x1f')](_0x39153c[_0xb8ad('0x2d')][_0xb8ad('0x1f')]);_0x427bb6[_0xb8ad('0x1e')]=qs[_0xb8ad('0x1e')](_0x39153c[_0xb8ad('0x2d')][_0xb8ad('0x1e')]);}_0x427bb6[_0xb8ad('0x36')]=qs['sort'](_0x39153c[_0xb8ad('0x2d')][_0xb8ad('0x37')]);_0x427bb6[_0xb8ad('0x38')]=qs[_0xb8ad('0x2f')](_[_0xb8ad('0x39')](_0x39153c['query'],_0x71153b[_0xb8ad('0x2f')]),_0x210788);if(_0x39153c[_0xb8ad('0x2d')][_0xb8ad('0x3a')]){_0x427bb6[_0xb8ad('0x38')]=_[_0xb8ad('0x3b')](_0x427bb6[_0xb8ad('0x38')],{'$or':_['map'](_0x210788,function(_0x5da2c7){if(_0x5da2c7[_0xb8ad('0x2c')]!==_0xb8ad('0x3c')){var _0x396769={};_0x396769[_0x5da2c7[_0xb8ad('0x26')]]={'$like':'%'+_0x39153c[_0xb8ad('0x2d')][_0xb8ad('0x3a')]+'%'};return _0x396769;}})});}_0x427bb6=_[_0xb8ad('0x3b')]({},_0x427bb6,_0x39153c[_0xb8ad('0x3d')]);var _0x2cbdaa={'where':_0x427bb6[_0xb8ad('0x38')]};return db[_0xb8ad('0x29')][_0xb8ad('0x1d')](_0x2cbdaa)[_0xb8ad('0x23')](function(_0x5eb793){_0x13544d[_0xb8ad('0x1d')]=_0x5eb793;if(_0x39153c[_0xb8ad('0x2d')][_0xb8ad('0x3e')]){_0x427bb6[_0xb8ad('0x3f')]=[{'all':!![]}];}return db[_0xb8ad('0x29')][_0xb8ad('0x40')](_0x427bb6);})['then'](function(_0x1040ed){_0x13544d[_0xb8ad('0x41')]=_0x1040ed;return _0x13544d;})[_0xb8ad('0x23')](respondWithFilteredResult(_0x381953,_0x427bb6))['catch'](handleError(_0x381953,null));};exports[_0xb8ad('0x42')]=function(_0x47cb80,_0xe348d6){var _0x3f17de={'raw':![],'where':{'id':_0x47cb80[_0xb8ad('0x43')]['id']}},_0x51eeca={};_0x51eeca[_0xb8ad('0x31')]=_['keys'](db['AnalyticCustomReport'][_0xb8ad('0x2a')]);_0x51eeca[_0xb8ad('0x2d')]=_[_0xb8ad('0x2e')](_0x47cb80[_0xb8ad('0x2d')]);_0x51eeca[_0xb8ad('0x2f')]=_['intersection'](_0x51eeca[_0xb8ad('0x31')],_0x51eeca[_0xb8ad('0x2d')]);_0x3f17de[_0xb8ad('0x32')]=_[_0xb8ad('0x30')](_0x51eeca[_0xb8ad('0x31')],qs[_0xb8ad('0x33')](_0x47cb80[_0xb8ad('0x2d')]['fields']));_0x3f17de['attributes']=_0x3f17de['attributes']['length']?_0x3f17de[_0xb8ad('0x32')]:_0x51eeca['model'];if(_0x47cb80[_0xb8ad('0x2d')][_0xb8ad('0x3e')]){_0x3f17de[_0xb8ad('0x3f')]=[{'all':!![]}];}_0x3f17de=_['merge']({},_0x3f17de,_0x47cb80['options']);return db[_0xb8ad('0x29')][_0xb8ad('0x44')](_0x3f17de)['then'](handleEntityNotFound(_0xe348d6,null))[_0xb8ad('0x23')](respondWithResult(_0xe348d6,null))['catch'](handleError(_0xe348d6,null));};exports['create']=function(_0x369c61,_0x1184bf){return db[_0xb8ad('0x29')][_0xb8ad('0x45')](_0x369c61[_0xb8ad('0x46')],{})[_0xb8ad('0x23')](function(_0x16f75c){var _0x3f57b9=_0x369c61[_0xb8ad('0x47')][_0xb8ad('0x48')]({'plain':!![]});if(!_0x3f57b9)throw new Error(_0xb8ad('0x49'));if(_0x3f57b9[_0xb8ad('0x4a')]===_0xb8ad('0x47')){var _0x26b728=_0x16f75c['get']({'plain':!![]});var _0x208c75=_0xb8ad('0x4b');return db[_0xb8ad('0x4c')]['find']({'where':{'name':_0x208c75,'userProfileId':_0x3f57b9[_0xb8ad('0x4d')]},'raw':!![]})[_0xb8ad('0x23')](function(_0x4b0157){if(_0x4b0157&&_0x4b0157[_0xb8ad('0x4e')]===0x0){return db[_0xb8ad('0x4f')]['create']({'name':_0x26b728[_0xb8ad('0x26')],'resourceId':_0x26b728['id'],'type':_0xb8ad('0x24'),'sectionId':_0x4b0157['id']},{})[_0xb8ad('0x23')](function(){return _0x16f75c;});}else{return _0x16f75c;}})[_0xb8ad('0x50')](function(_0x126559){logger[_0xb8ad('0x51')](_0xb8ad('0x52'),_0x126559);throw _0x126559;});}return _0x16f75c;})[_0xb8ad('0x23')](respondWithResult(_0x1184bf,0xc9))[_0xb8ad('0x50')](handleError(_0x1184bf,null));};exports[_0xb8ad('0x53')]=function(_0x38aea6,_0x42f82f){if(_0x38aea6[_0xb8ad('0x46')]['id']){delete _0x38aea6[_0xb8ad('0x46')]['id'];}return db['AnalyticCustomReport'][_0xb8ad('0x44')]({'where':{'id':_0x38aea6['params']['id']}})[_0xb8ad('0x23')](handleEntityNotFound(_0x42f82f,null))[_0xb8ad('0x23')](saveUpdates(_0x38aea6['body'],null))[_0xb8ad('0x23')](respondWithResult(_0x42f82f,null))['catch'](handleError(_0x42f82f,null));};exports[_0xb8ad('0x22')]=function(_0x5e6a56,_0x4b6511){return db['AnalyticCustomReport'][_0xb8ad('0x44')]({'where':{'id':_0x5e6a56[_0xb8ad('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b6511,null))['then'](removeEntity(_0x4b6511,null))[_0xb8ad('0x50')](handleError(_0x4b6511,null));};exports[_0xb8ad('0x54')]=function(_0x5bc73b,_0x5809fa){var _0x2cae88=0xa;var _0x581ff4=['join',_0xb8ad('0x55'),_0xb8ad('0x56'),'cross_join'];var _0x568972={'SUM':_0xb8ad('0x57'),'COUNT':_0xb8ad('0x58'),'COUNT DISTINCT':_0xb8ad('0x59'),'MAX':_0xb8ad('0x5a'),'MIN':'MIN(%s)','AVG':_0xb8ad('0x5b'),'GROUP_CONCAT':_0xb8ad('0x5c'),'GROUP_CONCAT ASC':_0xb8ad('0x5d'),'GROUP_CONCAT DESC':_0xb8ad('0x5e')};var _0x58c2b9={'SEC_TO_TIME':_0xb8ad('0x5f'),'DATE':_0xb8ad('0x60'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3243c4=function(_0x314d45){return!_[_0xb8ad('0x61')]([_0xb8ad('0x62'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x314d45);};var _0x118118=function(_0x337e4a){if(!_0x337e4a||!_0x337e4a[_0xb8ad('0x63')][_0xb8ad('0x64')]){return'';}for(var _0x1529d5='(',_0x130776=0x0;_0x130776<_0x337e4a[_0xb8ad('0x63')]['length'];_0x130776+=0x1){_0x130776>0x0&&(_0x1529d5+='\x20'+_0x337e4a['operator']+'\x20');_0x1529d5+=_0x337e4a[_0xb8ad('0x63')][_0x130776][_0xb8ad('0x65')]?_0x118118(_0x337e4a['rules'][_0x130776][_0xb8ad('0x65')]):_0x337e4a[_0xb8ad('0x63')][_0x130776][_0xb8ad('0x66')]+'\x20'+_0x337e4a[_0xb8ad('0x63')][_0x130776]['condition']+(_0x3243c4(_0x337e4a['rules'][_0x130776][_0xb8ad('0x67')])?'\x20'+_0x337e4a[_0xb8ad('0x63')][_0x130776][_0xb8ad('0x68')]:'');}return _0x1529d5+')';};var _0x1502e7={'where':{'id':_0x5bc73b['params']['id']}},_0xf1b7a5,_0x673ad,_0x9df6c,_0x565f21,_0x5d5e28;_0x1502e7=_[_0xb8ad('0x3b')]({},_0x1502e7,_0x5bc73b['options']);return db[_0xb8ad('0x29')]['find'](_0x1502e7)['then'](function(_0x3374ac){if(_0x3374ac){_0xf1b7a5=_0x3374ac;return _0x3374ac[_0xb8ad('0x69')]();}return null;})[_0xb8ad('0x23')](function(_0xab08d7){if(_0xab08d7){if(!_0xab08d7[_0xb8ad('0x64')]){throw new db[(_0xb8ad('0x6a'))]['ValidationErrorItem'](_0xb8ad('0x6b'),0x193);}_0x673ad=_0xab08d7;return db[_0xb8ad('0x6c')][_0xb8ad('0x40')]({'raw':!![]});}return null;})[_0xb8ad('0x23')](function(_0x55a274){if(_0x55a274){_0x9df6c=_['keyBy'](_0x55a274,'id');var _0x16f558;var _0x4d51d6=squel['select']();_0x4d51d6[_0xb8ad('0x6d')](_0xf1b7a5[_0xb8ad('0x6e')]);for(var _0x35bc8d=0x0;_0x35bc8d<_0x673ad[_0xb8ad('0x64')];_0x35bc8d+=0x1){_0x16f558=_0x673ad[_0x35bc8d][_0xb8ad('0x6f')]?_0x9df6c[_0x673ad[_0x35bc8d][_0xb8ad('0x6f')]][_0xb8ad('0x70')]:_0x673ad[_0x35bc8d][_0xb8ad('0x66')];_0x16f558=_0x673ad[_0x35bc8d][_0xb8ad('0x71')]?_[_0xb8ad('0x72')](_0x568972[_0x673ad[_0x35bc8d][_0xb8ad('0x71')]],'%s',_0x16f558):_0x16f558;_0x16f558=_0x673ad[_0x35bc8d]['format']?_[_0xb8ad('0x72')](_0x58c2b9[_0x673ad[_0x35bc8d][_0xb8ad('0x73')]],'%s',_0x16f558):_0x16f558;if(_0x673ad[_0x35bc8d][_0xb8ad('0x74')]){_0x4d51d6[_0xb8ad('0x65')](_0x16f558);}_0x673ad[_0x35bc8d][_0xb8ad('0x75')]&&_0x4d51d6['order'](_0x16f558,_0x673ad[_0x35bc8d][_0xb8ad('0x75')]===_0xb8ad('0x76')?![]:!![]);_0x4d51d6[_0xb8ad('0x66')](_0x16f558,_0x673ad[_0x35bc8d]['alias']||_0x16f558);}if(_0xf1b7a5[_0xb8ad('0x77')]){_0xf1b7a5[_0xb8ad('0x77')]=JSON[_0xb8ad('0x78')](_0xf1b7a5[_0xb8ad('0x77')]);for(var _0x34414f=0x0;_0x34414f<_0xf1b7a5['joins'][_0xb8ad('0x64')];_0x34414f+=0x1){if(_0xf1b7a5[_0xb8ad('0x77')][_0x34414f][_0xb8ad('0x2c')]&&_[_0xb8ad('0x61')](_0x581ff4,_0xf1b7a5[_0xb8ad('0x77')][_0x34414f][_0xb8ad('0x2c')])&&_0xf1b7a5['joins'][_0x34414f][_0xb8ad('0x79')]&&_0xf1b7a5['joins'][_0x34414f][_0xb8ad('0x7a')]&&_0xf1b7a5['joins'][_0x34414f]['foreignKey']){_0x4d51d6[_0xf1b7a5[_0xb8ad('0x77')][_0x34414f][_0xb8ad('0x2c')]](_0xf1b7a5['joins'][_0x34414f]['foreignTable'],null,util[_0xb8ad('0x73')]('%s.%s\x20=\x20%s.%s',_0xf1b7a5[_0xb8ad('0x6e')],_0xf1b7a5[_0xb8ad('0x77')][_0x34414f][_0xb8ad('0x79')],_0xf1b7a5['joins'][_0x34414f]['foreignTable'],_0xf1b7a5[_0xb8ad('0x77')][_0x34414f][_0xb8ad('0x7b')]));}}}if(_0xf1b7a5[_0xb8ad('0x7c')]){_0xf1b7a5[_0xb8ad('0x7c')]=JSON[_0xb8ad('0x78')](_0xf1b7a5[_0xb8ad('0x7c')]);_0x4d51d6[_0xb8ad('0x38')](_0x118118(_0xf1b7a5[_0xb8ad('0x7c')][_0xb8ad('0x65')]));}_0x5d5e28=_0x4d51d6['clone']();_0x4d51d6['limit'](_0x2cae88);_0x4d51d6[_0xb8ad('0x1e')](0x0);logger[_0xb8ad('0x7d')](_0xb8ad('0x7e'),_0x4d51d6['toString']());return db[_0xb8ad('0x7f')]['query'](_0x4d51d6[_0xb8ad('0x80')](),{'type':db['sequelize'][_0xb8ad('0x81')][_0xb8ad('0x82')]});}})[_0xb8ad('0x23')](respondWithResult(_0x5809fa,null))[_0xb8ad('0x50')](handleError(_0x5809fa,null));};function runReport(_0x466951,_0x4cb910,_0x2f25dd){var _0xd30df2=_0x4cb910[_0xb8ad('0x26')];var _0x58514c=0xa;var _0x1b8a02=[_0xb8ad('0x83'),_0xb8ad('0x55'),'right_join','cross_join'];var _0x34c7d0={'SUM':_0xb8ad('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb8ad('0x59'),'MAX':_0xb8ad('0x5a'),'MIN':_0xb8ad('0x84'),'AVG':_0xb8ad('0x5b'),'GROUP_CONCAT':_0xb8ad('0x5c'),'GROUP_CONCAT ASC':_0xb8ad('0x5d'),'GROUP_CONCAT DESC':_0xb8ad('0x5e')};var _0x386f8a={'SEC_TO_TIME':_0xb8ad('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb8ad('0x85')};var _0x58d1b6=function(_0x6916ec){return!_[_0xb8ad('0x61')]([_0xb8ad('0x62'),_0xb8ad('0x86'),_0xb8ad('0x87'),_0xb8ad('0x88')],_0x6916ec);};var _0x8e01cd=function(_0x3cec65){if(!_0x3cec65||!_0x3cec65[_0xb8ad('0x63')]['length']){return'';}for(var _0xc440c8='(',_0x3e9030=0x0;_0x3e9030<_0x3cec65[_0xb8ad('0x63')][_0xb8ad('0x64')];_0x3e9030+=0x1){_0x3e9030>0x0&&(_0xc440c8+='\x20'+_0x3cec65[_0xb8ad('0x89')]+'\x20');_0xc440c8+=_0x3cec65[_0xb8ad('0x63')][_0x3e9030]['group']?_0x8e01cd(_0x3cec65[_0xb8ad('0x63')][_0x3e9030]['group']):_0x3cec65[_0xb8ad('0x63')][_0x3e9030]['field']+'\x20'+_0x3cec65[_0xb8ad('0x63')][_0x3e9030][_0xb8ad('0x67')]+(_0x58d1b6(_0x3cec65['rules'][_0x3e9030]['condition'])?'\x20'+_0x3cec65[_0xb8ad('0x63')][_0x3e9030][_0xb8ad('0x68')]:'');}return _0xc440c8+')';};var _0x4dbfad={'where':{'id':_0x466951['id']}},_0x283e3b,_0x4f35a8,_0x5337ae,_0xc5934f,_0x5a5f81;_0x4dbfad=_[_0xb8ad('0x3b')]({},_0x4dbfad,_0x2f25dd);return db[_0xb8ad('0x29')]['find'](_0x4dbfad)[_0xb8ad('0x23')](function(_0x43684c){if(_0x43684c){_0x283e3b=_0x43684c;return _0x43684c[_0xb8ad('0x69')]();}return null;})[_0xb8ad('0x23')](function(_0x32a095){if(_0x32a095){if(!_0x32a095[_0xb8ad('0x64')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4f35a8=_0x32a095;return db['AnalyticMetric'][_0xb8ad('0x40')]({'raw':!![]});}return null;})[_0xb8ad('0x23')](function(_0x23c487){if(_0x23c487){_0x5337ae=_[_0xb8ad('0x8a')](_0x23c487,'id');var _0x2ff5b7;var _0x13814b=squel[_0xb8ad('0x8b')]();_0x13814b[_0xb8ad('0x6d')](_0x283e3b['table']);for(var _0x3de20b=0x0;_0x3de20b<_0x4f35a8['length'];_0x3de20b+=0x1){_0x2ff5b7=_0x4f35a8[_0x3de20b]['MetricId']?_0x5337ae[_0x4f35a8[_0x3de20b][_0xb8ad('0x6f')]][_0xb8ad('0x70')]:_0x4f35a8[_0x3de20b][_0xb8ad('0x66')];_0x2ff5b7=_0x4f35a8[_0x3de20b]['function']?_[_0xb8ad('0x72')](_0x34c7d0[_0x4f35a8[_0x3de20b][_0xb8ad('0x71')]],'%s',_0x2ff5b7):_0x2ff5b7;_0x2ff5b7=_0x4f35a8[_0x3de20b][_0xb8ad('0x73')]?_[_0xb8ad('0x72')](_0x386f8a[_0x4f35a8[_0x3de20b][_0xb8ad('0x73')]],'%s',_0x2ff5b7):_0x2ff5b7;if(_0x4f35a8[_0x3de20b]['groupBy']){_0x13814b['group'](_0x2ff5b7);}_0x4f35a8[_0x3de20b][_0xb8ad('0x75')]&&_0x13814b[_0xb8ad('0x36')](_0x2ff5b7,_0x4f35a8[_0x3de20b][_0xb8ad('0x75')]===_0xb8ad('0x76')?![]:!![]);_0x13814b['field'](_0x2ff5b7,_0x4f35a8[_0x3de20b][_0xb8ad('0x8c')]||_0x2ff5b7);}if(_0x283e3b[_0xb8ad('0x77')]){_0x283e3b['joins']=JSON[_0xb8ad('0x78')](_0x283e3b[_0xb8ad('0x77')]);for(var _0x1101b8=0x0;_0x1101b8<_0x283e3b[_0xb8ad('0x77')][_0xb8ad('0x64')];_0x1101b8+=0x1){if(_0x283e3b['joins'][_0x1101b8][_0xb8ad('0x2c')]&&_[_0xb8ad('0x61')](_0x1b8a02,_0x283e3b[_0xb8ad('0x77')][_0x1101b8][_0xb8ad('0x2c')])&&_0x283e3b[_0xb8ad('0x77')][_0x1101b8][_0xb8ad('0x79')]&&_0x283e3b[_0xb8ad('0x77')][_0x1101b8]['foreignTable']&&_0x283e3b[_0xb8ad('0x77')][_0x1101b8]['foreignKey']){_0x13814b[_0x283e3b[_0xb8ad('0x77')][_0x1101b8]['type']](_0x283e3b[_0xb8ad('0x77')][_0x1101b8][_0xb8ad('0x7a')],null,util[_0xb8ad('0x73')](_0xb8ad('0x8d'),_0x283e3b[_0xb8ad('0x6e')],_0x283e3b['joins'][_0x1101b8][_0xb8ad('0x79')],_0x283e3b['joins'][_0x1101b8][_0xb8ad('0x7a')],_0x283e3b['joins'][_0x1101b8]['foreignKey']));}}}if(_0x283e3b[_0xb8ad('0x7c')]){_0x283e3b[_0xb8ad('0x7c')]=JSON[_0xb8ad('0x78')](_0x283e3b['conditions']);_0x13814b[_0xb8ad('0x38')](_0x8e01cd(_0x283e3b[_0xb8ad('0x7c')][_0xb8ad('0x65')]));}_0x5a5f81=_0x13814b[_0xb8ad('0x8e')]();_0x13814b[_0xb8ad('0x1f')](_0x58514c);_0x13814b[_0xb8ad('0x1e')](0x0);logger[_0xb8ad('0x7d')](_0xb8ad('0x7e'),_0x13814b[_0xb8ad('0x80')]());return db[_0xb8ad('0x7f')][_0xb8ad('0x2d')](_0x13814b['toString'](),{'type':db['sequelize'][_0xb8ad('0x81')]['SELECT']});}})[_0xb8ad('0x23')](function(_0x5b03dd){if(!_0x5b03dd[_0xb8ad('0x64')]){throw new db[(_0xb8ad('0x6a'))][(_0xb8ad('0x8f'))](_0xb8ad('0x90'),0xcc);}if(_0x4cb910[_0xb8ad('0x91')]===_0xb8ad('0x92')){return null;}var _0x357ef2=_['merge'](_0x4cb910,{'name':_0x4cb910[_0xb8ad('0x93')]||_0x4cb910[_0xb8ad('0x26')]||_0x283e3b[_0xb8ad('0x26')],'basename':_0xd30df2,'savename':util['format'](_0xb8ad('0x94'),_0x4cb910[_0xb8ad('0x26')]||_0x283e3b[_0xb8ad('0x26')],require(_0xb8ad('0x95'))[_0xb8ad('0x96')](0x4),_0x4cb910[_0xb8ad('0x91')]||'csv'),'reportId':_0x283e3b['id'],'reportType':_0xb8ad('0x97')});return db['AnalyticExtractedReport'][_0xb8ad('0x45')](_0x357ef2,{'raw':!![]});})[_0xb8ad('0x23')](function(_0x343df0){if(_0x283e3b[_0xb8ad('0x6e')]===_0xb8ad('0x98')){_0x5a5f81[_0xb8ad('0x38')](_0x283e3b[_0xb8ad('0x6e')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4cb910[_0xb8ad('0x99')],_0x4cb910[_0xb8ad('0x9a')]);}else{_0x5a5f81[_0xb8ad('0x38')](_0x283e3b[_0xb8ad('0x6e')]+_0xb8ad('0x9b'),_0x4cb910[_0xb8ad('0x99')],_0x4cb910['endDate']);}if(_0x343df0){logger[_0xb8ad('0x9c')](_0xb8ad('0x9d'),_0x5a5f81['toString']());require(_0xb8ad('0x9e'))['fork'](path[_0xb8ad('0x83')](__dirname,_0xb8ad('0x9f'),_0x343df0['output']),[_0x343df0['id'],_0x5a5f81[_0xb8ad('0x80')](),path[_0xb8ad('0x83')](__dirname,'../../files/reports',_0x343df0['savename']),_0xd30df2]);return _0x343df0;}else{var _0x52a3b6=squel[_0xb8ad('0x8b')]();_0x52a3b6[_0xb8ad('0x6d')]('('+_0x5a5f81[_0xb8ad('0x80')]()+')',_0xb8ad('0xa0'));_0x52a3b6[_0xb8ad('0x66')]('COUNT(*)',_0xb8ad('0x1d'));_0x5a5f81[_0xb8ad('0x1f')](_0x4cb910[_0xb8ad('0x1f')]||_0x58514c);_0x5a5f81[_0xb8ad('0x1e')](_0x4cb910[_0xb8ad('0x1e')]||0x0);return dbH[_0xb8ad('0x7f')][_0xb8ad('0x2d')](_0x52a3b6[_0xb8ad('0x80')](),{'type':dbH['sequelize']['QueryTypes'][_0xb8ad('0x82')]})[_0xb8ad('0x23')](function(_0x35a7ea){if(!_0x35a7ea[_0xb8ad('0x64')]){_0xc5934f=0x0;}else{_0xc5934f=_0x35a7ea[0x0][_0xb8ad('0x1d')]||0x0;}return dbH['sequelize']['query'](_0x5a5f81[_0xb8ad('0x80')](),{'type':dbH[_0xb8ad('0x7f')]['QueryTypes'][_0xb8ad('0x82')]});})['then'](function(_0x4b0a1e){return{'rows':_0x4b0a1e||[],'count':_0xc5934f};});}});}exports[_0xb8ad('0xa1')]=function(_0x385662,_0x2eebb0){return runReport(_0x385662[_0xb8ad('0x43')],_0x385662[_0xb8ad('0x2d')],_0x385662[_0xb8ad('0x3d')])[_0xb8ad('0x23')](respondWithResult(_0x2eebb0,null))[_0xb8ad('0x50')](handleError(_0x2eebb0,null));};exports[_0xb8ad('0xa2')]=runReport;exports[_0xb8ad('0x2d')]=function(_0x595b8e,_0x5a7aa7){var _0x25b6bc=0xa;var _0x455677=[_0xb8ad('0x83'),'left_join',_0xb8ad('0x56'),'cross_join'];var _0x4a625a={'SUM':_0xb8ad('0x57'),'COUNT':_0xb8ad('0x58'),'COUNT DISTINCT':_0xb8ad('0x59'),'MAX':_0xb8ad('0x5a'),'MIN':_0xb8ad('0x84'),'AVG':_0xb8ad('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb8ad('0x5e')};var _0x4ffb23={'SEC_TO_TIME':_0xb8ad('0x5f'),'DATE':_0xb8ad('0x60'),'HOUR':_0xb8ad('0xa3'),'ROUND':_0xb8ad('0xa4'),'UNIX_TIMESTAMP':_0xb8ad('0x85')};var _0x3f976f=function(_0xb98a72){return!_[_0xb8ad('0x61')]([_0xb8ad('0x62'),'IS\x20NOT\x20NULL',_0xb8ad('0x87'),_0xb8ad('0x88')],_0xb98a72);};var _0x4a5ee4=function(_0x272d75){if(!_0x272d75||!_0x272d75[_0xb8ad('0x63')][_0xb8ad('0x64')]){return'';}for(var _0x27074d='(',_0x518f05=0x0;_0x518f05<_0x272d75[_0xb8ad('0x63')][_0xb8ad('0x64')];_0x518f05+=0x1){_0x518f05>0x0&&(_0x27074d+='\x20'+_0x272d75[_0xb8ad('0x89')]+'\x20');_0x27074d+=_0x272d75[_0xb8ad('0x63')][_0x518f05][_0xb8ad('0x65')]?_0x4a5ee4(_0x272d75[_0xb8ad('0x63')][_0x518f05]['group']):_0x272d75['rules'][_0x518f05][_0xb8ad('0x66')]+'\x20'+_0x272d75[_0xb8ad('0x63')][_0x518f05][_0xb8ad('0x67')]+(_0x3f976f(_0x272d75['rules'][_0x518f05][_0xb8ad('0x67')])?'\x20'+_0x272d75[_0xb8ad('0x63')][_0x518f05][_0xb8ad('0x68')]:'');}return _0x27074d+')';};var _0x27e972={'where':{'id':_0x595b8e[_0xb8ad('0x43')]['id']}},_0x3ac96c,_0x27c44d,_0x12fc03,_0x52daac,_0x5da4e2;_0x27e972=_[_0xb8ad('0x3b')]({},_0x27e972,_0x595b8e[_0xb8ad('0x3d')]);return db[_0xb8ad('0x29')]['find'](_0x27e972)[_0xb8ad('0x23')](function(_0x65250e){if(_0x65250e){_0x3ac96c=_0x65250e;return _0x65250e[_0xb8ad('0x69')]();}return null;})[_0xb8ad('0x23')](function(_0x264b4b){if(_0x264b4b){if(!_0x264b4b[_0xb8ad('0x64')]){throw new db[(_0xb8ad('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x27c44d=_0x264b4b;return db[_0xb8ad('0x6c')][_0xb8ad('0x40')]({'raw':!![]});}return null;})['then'](function(_0x296cf7){if(_0x296cf7){_0x12fc03=_[_0xb8ad('0x8a')](_0x296cf7,'id');var _0x12e4a9;var _0x3087c3=squel[_0xb8ad('0x8b')]();_0x3087c3['from'](_0x3ac96c[_0xb8ad('0x6e')]);for(var _0x566aee=0x0;_0x566aee<_0x27c44d['length'];_0x566aee+=0x1){_0x12e4a9=_0x27c44d[_0x566aee]['MetricId']?_0x12fc03[_0x27c44d[_0x566aee]['MetricId']]['metric']:_0x27c44d[_0x566aee]['field'];_0x12e4a9=_0x27c44d[_0x566aee][_0xb8ad('0x71')]?_['replace'](_0x4a625a[_0x27c44d[_0x566aee]['function']],'%s',_0x12e4a9):_0x12e4a9;_0x12e4a9=_0x27c44d[_0x566aee][_0xb8ad('0x73')]?_[_0xb8ad('0x72')](_0x4ffb23[_0x27c44d[_0x566aee][_0xb8ad('0x73')]],'%s',_0x12e4a9):_0x12e4a9;if(_0x27c44d[_0x566aee][_0xb8ad('0x74')]){_0x3087c3[_0xb8ad('0x65')](_0x12e4a9);}_0x27c44d[_0x566aee][_0xb8ad('0x75')]&&_0x3087c3[_0xb8ad('0x36')](_0x12e4a9,_0x27c44d[_0x566aee][_0xb8ad('0x75')]===_0xb8ad('0x76')?![]:!![]);_0x3087c3[_0xb8ad('0x66')](_0x12e4a9,_0x27c44d[_0x566aee]['alias']||_0x12e4a9);}if(_0x3ac96c['joins']){_0x3ac96c[_0xb8ad('0x77')]=JSON[_0xb8ad('0x78')](_0x3ac96c[_0xb8ad('0x77')]);for(var _0x507eee=0x0;_0x507eee<_0x3ac96c[_0xb8ad('0x77')]['length'];_0x507eee+=0x1){if(_0x3ac96c[_0xb8ad('0x77')][_0x507eee][_0xb8ad('0x2c')]&&_[_0xb8ad('0x61')](_0x455677,_0x3ac96c['joins'][_0x507eee][_0xb8ad('0x2c')])&&_0x3ac96c['joins'][_0x507eee][_0xb8ad('0x79')]&&_0x3ac96c[_0xb8ad('0x77')][_0x507eee][_0xb8ad('0x7a')]&&_0x3ac96c['joins'][_0x507eee][_0xb8ad('0x7b')]){_0x3087c3[_0x3ac96c[_0xb8ad('0x77')][_0x507eee]['type']](_0x3ac96c[_0xb8ad('0x77')][_0x507eee]['foreignTable'],null,util[_0xb8ad('0x73')](_0xb8ad('0x8d'),_0x3ac96c[_0xb8ad('0x6e')],_0x3ac96c[_0xb8ad('0x77')][_0x507eee][_0xb8ad('0x79')],_0x3ac96c['joins'][_0x507eee][_0xb8ad('0x7a')],_0x3ac96c[_0xb8ad('0x77')][_0x507eee][_0xb8ad('0x7b')]));}}}if(_0x3ac96c[_0xb8ad('0x7c')]){_0x3ac96c[_0xb8ad('0x7c')]=JSON[_0xb8ad('0x78')](_0x3ac96c[_0xb8ad('0x7c')]);_0x3087c3[_0xb8ad('0x38')](_0x4a5ee4(_0x3ac96c['conditions'][_0xb8ad('0x65')]));}_0x5da4e2=_0x3087c3[_0xb8ad('0x8e')]();_0x3087c3[_0xb8ad('0x1f')](_0x25b6bc);_0x3087c3['offset'](0x0);logger[_0xb8ad('0x7d')]('Limited\x20Query:',_0x3087c3[_0xb8ad('0x80')]());return db[_0xb8ad('0x7f')][_0xb8ad('0x2d')](_0x3087c3['toString'](),{'type':db[_0xb8ad('0x7f')]['QueryTypes'][_0xb8ad('0x82')]});}})[_0xb8ad('0x23')](function(){return{'sql':_0x5da4e2['toString']()};})[_0xb8ad('0x23')](respondWithResult(_0x5a7aa7,null))[_0xb8ad('0x50')](handleError(_0x5a7aa7,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index ba56e60..143e8ff 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 _0x3e9a=['path','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','api','bluebird','request-promise'];(function(_0x4b757c,_0x567c0f){var _0x427379=function(_0x423083){while(--_0x423083){_0x4b757c['push'](_0x4b757c['shift']());}};_0x427379(++_0x567c0f);}(_0x3e9a,0x1d2));var _0xa3e9=function(_0x56bd0c,_0x51c525){_0x56bd0c=_0x56bd0c-0x0;var _0x8b5f15=_0x3e9a[_0x56bd0c];return _0x8b5f15;};'use strict';var _=require(_0xa3e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa3e9('0x1'));var moment=require('moment');var BPromise=require(_0xa3e9('0x2'));var rp=require(_0xa3e9('0x3'));var fs=require('fs');var path=require(_0xa3e9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3e9('0x5'));module[_0xa3e9('0x6')]=function(_0x4b6a4e,_0x427d74){return _0x4b6a4e[_0xa3e9('0x7')](_0xa3e9('0x8'),attributes,{'tableName':_0xa3e9('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa79d=['lodash','util','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports'];(function(_0x4de948,_0x452a8c){var _0x48fc2c=function(_0x343a9d){while(--_0x343a9d){_0x4de948['push'](_0x4de948['shift']());}};_0x48fc2c(++_0x452a8c);}(_0xa79d,0x144));var _0xda79=function(_0x233b3a,_0x32b752){_0x233b3a=_0x233b3a-0x0;var _0x7dcdc6=_0xa79d[_0x233b3a];return _0x7dcdc6;};'use strict';var _=require(_0xda79('0x0'));var util=require(_0xda79('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xda79('0x2'));var BPromise=require('bluebird');var rp=require(_0xda79('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda79('0x4'));var config=require(_0xda79('0x5'));var attributes=require(_0xda79('0x6'));module['exports']=function(_0x967d2,_0x322683){return _0x967d2['define'](_0xda79('0x7'),attributes,{'tableName':_0xda79('0x8'),'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 9421a4f..d6897c1 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 _0xfbc1=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x599d6b,_0x462aed){var _0x4bd9dd=function(_0x29e48d){while(--_0x29e48d){_0x599d6b['push'](_0x599d6b['shift']());}};_0x4bd9dd(++_0x462aed);}(_0xfbc1,0x11b));var _0x1fbc=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xfbc1[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x1fbc('0x0'));var util=require(_0x1fbc('0x1'));var moment=require(_0x1fbc('0x2'));var BPromise=require(_0x1fbc('0x3'));var rs=require(_0x1fbc('0x4'));var fs=require('fs');var Redis=require(_0x1fbc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1fbc('0x6'));var logger=require(_0x1fbc('0x7'))(_0x1fbc('0x8'));var config=require(_0x1fbc('0x9'));var jayson=require(_0x1fbc('0xa'));var client=jayson[_0x1fbc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf97519,_0x4f9c35,_0x505904){return new BPromise(function(_0x2b5be1,_0x2dfc70){return client['request'](_0xf97519,_0x505904)[_0x1fbc('0xc')](function(_0x4f0173){logger['info'](_0x1fbc('0xd'),_0x4f9c35,_0x1fbc('0xe'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x4f9c35,_0x1fbc('0xe'),JSON[_0x1fbc('0xf')](_0x4f0173));if(_0x4f0173[_0x1fbc('0x10')]){if(_0x4f0173['error'][_0x1fbc('0x11')]===0x1f4){logger[_0x1fbc('0x10')](_0x1fbc('0xd'),_0x4f9c35,_0x4f0173[_0x1fbc('0x10')][_0x1fbc('0x12')]);return _0x2dfc70(_0x4f0173[_0x1fbc('0x10')][_0x1fbc('0x12')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4f9c35,_0x4f0173['error']['message']);return _0x2b5be1(_0x4f0173[_0x1fbc('0x10')]['message']);}else{logger[_0x1fbc('0x13')](_0x1fbc('0xd'),_0x4f9c35,_0x1fbc('0xe'));_0x2b5be1(_0x4f0173[_0x1fbc('0x14')][_0x1fbc('0x12')]);}})[_0x1fbc('0x15')](function(_0x5517de){logger['error'](_0x1fbc('0xd'),_0x4f9c35,_0x5517de);_0x2dfc70(_0x5517de);});});} \ No newline at end of file +var _0x1a49=['ioredis','../../config/utils','rpc','../../config/environment','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring'];(function(_0x37a6f6,_0x146ef8){var _0x3eea3f=function(_0x56539c){while(--_0x56539c){_0x37a6f6['push'](_0x37a6f6['shift']());}};_0x3eea3f(++_0x146ef8);}(_0x1a49,0x1c6));var _0x91a4=function(_0x22c5eb,_0x3edb6a){_0x22c5eb=_0x22c5eb-0x0;var _0xfd07e1=_0x1a49[_0x22c5eb];return _0xfd07e1;};'use strict';var _=require(_0x91a4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x91a4('0x1'));var fs=require('fs');var Redis=require(_0x91a4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x91a4('0x3'));var logger=require('../../config/logger')(_0x91a4('0x4'));var config=require(_0x91a4('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x91a4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xf91193,_0x38f575,_0x59955f){return new BPromise(function(_0x46f219,_0x3c30ae){return client[_0x91a4('0x7')](_0xf91193,_0x59955f)['then'](function(_0x443618){logger[_0x91a4('0x8')](_0x91a4('0x9'),_0x38f575,_0x91a4('0xa'));logger[_0x91a4('0xb')](_0x91a4('0xc'),_0x38f575,'request\x20sent',JSON[_0x91a4('0xd')](_0x443618));if(_0x443618['error']){if(_0x443618[_0x91a4('0xe')][_0x91a4('0xf')]===0x1f4){logger[_0x91a4('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x38f575,_0x443618[_0x91a4('0xe')][_0x91a4('0x10')]);return _0x3c30ae(_0x443618[_0x91a4('0xe')][_0x91a4('0x10')]);}logger[_0x91a4('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x38f575,_0x443618[_0x91a4('0xe')]['message']);return _0x46f219(_0x443618[_0x91a4('0xe')][_0x91a4('0x10')]);}else{logger['info'](_0x91a4('0x9'),_0x38f575,_0x91a4('0xa'));_0x46f219(_0x443618[_0x91a4('0x11')][_0x91a4('0x10')]);}})[_0x91a4('0x12')](function(_0x31b0b1){logger[_0x91a4('0xe')](_0x91a4('0x9'),_0x38f575,_0x31b0b1);_0x3c30ae(_0x31b0b1);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 01e404b..cbf70e2 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 _0x13ab=['run','/:id/query','query','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','/:id/run'];(function(_0x30ef51,_0x4170ba){var _0x329d8e=function(_0x259197){while(--_0x259197){_0x30ef51['push'](_0x30ef51['shift']());}};_0x329d8e(++_0x4170ba);}(_0x13ab,0x188));var _0xb13a=function(_0x2bfdd0,_0x2304c6){_0x2bfdd0=_0x2bfdd0-0x0;var _0x596c7b=_0x13ab[_0x2bfdd0];return _0x596c7b;};'use strict';var multer=require(_0xb13a('0x0'));var util=require(_0xb13a('0x1'));var path=require(_0xb13a('0x2'));var timeout=require(_0xb13a('0x3'));var express=require(_0xb13a('0x4'));var router=express[_0xb13a('0x5')]();var auth=require(_0xb13a('0x6'));var interaction=require(_0xb13a('0x7'));var config=require(_0xb13a('0x8'));var controller=require(_0xb13a('0x9'));router[_0xb13a('0xa')]('/',auth[_0xb13a('0xb')](),controller['index']);router['get'](_0xb13a('0xc'),auth[_0xb13a('0xb')](),controller['show']);router[_0xb13a('0xa')](_0xb13a('0xd'),auth[_0xb13a('0xb')](),controller[_0xb13a('0xe')]);router[_0xb13a('0xa')](_0xb13a('0xf'),auth['isAuthenticated'](),controller[_0xb13a('0x10')]);router[_0xb13a('0xa')](_0xb13a('0x11'),auth['isAuthenticated'](),controller[_0xb13a('0x12')]);router[_0xb13a('0x13')]('/',auth[_0xb13a('0xb')](),controller['create']);router[_0xb13a('0x14')](_0xb13a('0xc'),auth[_0xb13a('0xb')](),controller[_0xb13a('0x15')]);router['delete'](_0xb13a('0xc'),auth['isAuthenticated'](),controller[_0xb13a('0x16')]);module[_0xb13a('0x17')]=router; \ No newline at end of file +var _0x143b=['multer','util','connect-timeout','express','Router','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x143b,0x78));var _0xb143=function(_0x33cdb4,_0x26eb1a){_0x33cdb4=_0x33cdb4-0x0;var _0x5c33e1=_0x143b[_0x33cdb4];return _0x5c33e1;};'use strict';var multer=require(_0xb143('0x0'));var util=require(_0xb143('0x1'));var path=require('path');var timeout=require(_0xb143('0x2'));var express=require(_0xb143('0x3'));var router=express[_0xb143('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb143('0x5'));var controller=require(_0xb143('0x6'));router[_0xb143('0x7')]('/',auth[_0xb143('0x8')](),controller[_0xb143('0x9')]);router[_0xb143('0x7')](_0xb143('0xa'),auth[_0xb143('0x8')](),controller[_0xb143('0xb')]);router[_0xb143('0x7')]('/:id/preview',auth['isAuthenticated'](),controller[_0xb143('0xc')]);router[_0xb143('0x7')](_0xb143('0xd'),auth['isAuthenticated'](),controller[_0xb143('0xe')]);router[_0xb143('0x7')](_0xb143('0xf'),auth[_0xb143('0x8')](),controller[_0xb143('0x10')]);router[_0xb143('0x11')]('/',auth[_0xb143('0x8')](),controller[_0xb143('0x12')]);router[_0xb143('0x13')]('/:id',auth[_0xb143('0x8')](),controller[_0xb143('0x14')]);router[_0xb143('0x15')](_0xb143('0xa'),auth['isAuthenticated'](),controller[_0xb143('0x16')]);module[_0xb143('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 883b5d1..3fdcc79 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 _0x1f69=['TEXT','sequelize','exports','STRING'];(function(_0x2ef8c1,_0x2f72f4){var _0x288305=function(_0x56244b){while(--_0x56244b){_0x2ef8c1['push'](_0x2ef8c1['shift']());}};_0x288305(++_0x2f72f4);}(_0x1f69,0xe9));var _0x91f6=function(_0x18d4ee,_0x23737a){_0x18d4ee=_0x18d4ee-0x0;var _0x25d717=_0x1f69[_0x18d4ee];return _0x25d717;};'use strict';var Sequelize=require(_0x91f6('0x0'));module[_0x91f6('0x1')]={'name':{'type':Sequelize[_0x91f6('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x91f6('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x91f6('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2590=['TEXT','exports','STRING'];(function(_0x5f51e6,_0xd959b7){var _0x44127a=function(_0x4fc7b8){while(--_0x4fc7b8){_0x5f51e6['push'](_0x5f51e6['shift']());}};_0x44127a(++_0xd959b7);}(_0x2590,0x12a));var _0x0259=function(_0x28fa69,_0x3145fd){_0x28fa69=_0x28fa69-0x0;var _0x439ac2=_0x2590[_0x28fa69];return _0x439ac2;};'use strict';var Sequelize=require('sequelize');module[_0x0259('0x0')]={'name':{'type':Sequelize[_0x0259('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0259('0x1')]},'parent':{'type':Sequelize[_0x0259('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0259('0x2')]},'joins':{'type':Sequelize[_0x0259('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 708deb1..2763e57 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 _0x3731=['web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','replace','html-pdf','rimraf','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','keys','find','create','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','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\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','function','format','orderBy','DESC','alias','joins','parse','type','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20NOT\x20NULL','operator','ValidationErrorItem','metric','No\x20available\x20data','output'];(function(_0x50b0f7,_0x507fba){var _0x189c27=function(_0x5124e0){while(--_0x5124e0){_0x50b0f7['push'](_0x50b0f7['shift']());}};_0x189c27(++_0x507fba);}(_0x3731,0xba));var _0x1373=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3731[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x1373('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1373('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1373('0x2'));var Mustache=require(_0x1373('0x3'));var util=require(_0x1373('0x4'));var path=require(_0x1373('0x5'));var sox=require(_0x1373('0x6'));var csv=require('to-csv');var ejs=require(_0x1373('0x7'));var fs=require('fs');var _=require(_0x1373('0x8'));var squel=require(_0x1373('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1373('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1373('0xb'));var authService=require(_0x1373('0xc'));var qs=require(_0x1373('0xd'));var as=require(_0x1373('0xe'));var hardwareService=require(_0x1373('0xf'));var logger=require(_0x1373('0x10'))(_0x1373('0x11'));var utils=require(_0x1373('0x12'));var config=require(_0x1373('0x13'));var licenseUtil=require(_0x1373('0x14'));var db=require(_0x1373('0x15'))['db'];var dbH=require(_0x1373('0x15'))[_0x1373('0x16')];function respondWithStatusCode(_0x41742d,_0x4a98d2){_0x4a98d2=_0x4a98d2||0xcc;return function(_0x522597){if(_0x522597){return _0x41742d[_0x1373('0x17')](_0x4a98d2);}return _0x41742d[_0x1373('0x18')](_0x4a98d2)[_0x1373('0x19')]();};}function respondWithResult(_0x55cc31,_0x4b0c93){_0x4b0c93=_0x4b0c93||0xc8;return function(_0x14ac12){if(_0x14ac12){return _0x55cc31[_0x1373('0x18')](_0x4b0c93)[_0x1373('0x1a')](_0x14ac12);}};}function respondWithFilteredResult(_0x3838dc,_0x2144fa){return function(_0x4617cd){if(_0x4617cd){var _0x488501=_0x4617cd[_0x1373('0x1b')],_0x10e19c=_0x2144fa['offset'],_0x521f5b=_0x2144fa[_0x1373('0x1c')]+_0x2144fa[_0x1373('0x1d')],_0x3c37b4;if(_0x521f5b>=_0x488501){_0x521f5b=_0x488501;_0x3c37b4=0xc8;}else{_0x3c37b4=0xce;}_0x3838dc['status'](_0x3c37b4);return _0x3838dc[_0x1373('0x1e')]('Content-Range',_0x10e19c+'-'+_0x521f5b+'/'+_0x488501)[_0x1373('0x1a')](_0x4617cd);}return null;};}function patchUpdates(_0x139ae1){return function(_0x56431c){try{jsonpatch[_0x1373('0x1f')](_0x56431c,_0x139ae1,!![]);}catch(_0x3f3a21){return BPromise[_0x1373('0x20')](_0x3f3a21);}return _0x56431c[_0x1373('0x21')]();};}function saveUpdates(_0x432018,_0xfd7c5e){return function(_0x1b646a){if(_0x1b646a){return _0x1b646a[_0x1373('0x22')](_0x432018)['then'](function(_0x43651a){return _0x43651a;});}return null;};}function removeEntity(_0x520273,_0x3e0dd1){return function(_0x399296){if(_0x399296){return _0x399296[_0x1373('0x23')]()[_0x1373('0x24')](function(){var _0x629424=_0x399296['get']({'plain':!![]});var _0x344a7c=_0x1373('0x25');return db[_0x1373('0x26')][_0x1373('0x23')]({'where':{'type':_0x344a7c,'resourceId':_0x629424['id']}})[_0x1373('0x24')](function(){return _0x399296;});})[_0x1373('0x24')](function(){_0x520273[_0x1373('0x18')](0xcc)[_0x1373('0x19')]();});}};}function handleEntityNotFound(_0x17af19,_0x33786f){return function(_0x4efe17){if(!_0x4efe17){_0x17af19[_0x1373('0x17')](0x194);}return _0x4efe17;};}function handleError(_0x3854ee,_0xdc78ae){_0xdc78ae=_0xdc78ae||0x1f4;return function(_0x5a47c7){logger[_0x1373('0x27')](_0x5a47c7[_0x1373('0x28')]);if(_0x5a47c7[_0x1373('0x29')]){delete _0x5a47c7['name'];}_0x3854ee[_0x1373('0x18')](_0xdc78ae)[_0x1373('0x2a')](_0x5a47c7);};}exports[_0x1373('0x2b')]=function(_0x5545e8,_0x4e863d){var _0x3f2572={},_0x2281f9={},_0x37a967={'count':0x0,'rows':[]};var _0x1b7e33=_[_0x1373('0x2c')](db['AnalyticDefaultReport'][_0x1373('0x2d')],function(_0xc16f52){return{'name':_0xc16f52[_0x1373('0x2e')],'type':_0xc16f52['type'][_0x1373('0x2f')]};});_0x2281f9['model']=_[_0x1373('0x2c')](_0x1b7e33,_0x1373('0x29'));_0x2281f9[_0x1373('0x30')]=_['keys'](_0x5545e8[_0x1373('0x30')]);_0x2281f9[_0x1373('0x31')]=_['intersection'](_0x2281f9['model'],_0x2281f9[_0x1373('0x30')]);_0x3f2572[_0x1373('0x32')]=_[_0x1373('0x33')](_0x2281f9[_0x1373('0x34')],qs[_0x1373('0x35')](_0x5545e8['query'][_0x1373('0x35')]));_0x3f2572[_0x1373('0x32')]=_0x3f2572['attributes'][_0x1373('0x36')]?_0x3f2572[_0x1373('0x32')]:_0x2281f9['model'];if(!_0x5545e8[_0x1373('0x30')][_0x1373('0x37')](_0x1373('0x38'))){_0x3f2572[_0x1373('0x1d')]=qs[_0x1373('0x1d')](_0x5545e8['query'][_0x1373('0x1d')]);_0x3f2572['offset']=qs[_0x1373('0x1c')](_0x5545e8['query']['offset']);}_0x3f2572[_0x1373('0x39')]=qs[_0x1373('0x3a')](_0x5545e8[_0x1373('0x30')][_0x1373('0x3a')]);_0x3f2572[_0x1373('0x3b')]=qs['filters'](_[_0x1373('0x3c')](_0x5545e8[_0x1373('0x30')],_0x2281f9['filters']),_0x1b7e33);if(_0x5545e8['query'][_0x1373('0x3d')]){_0x3f2572[_0x1373('0x3b')]=_['merge'](_0x3f2572['where'],{'$or':_[_0x1373('0x2c')](_0x1b7e33,function(_0xcbb8e5){if(_0xcbb8e5['type']!==_0x1373('0x3e')){var _0x213e8e={};_0x213e8e[_0xcbb8e5[_0x1373('0x29')]]={'$like':'%'+_0x5545e8[_0x1373('0x30')][_0x1373('0x3d')]+'%'};return _0x213e8e;}})});}_0x3f2572=_[_0x1373('0x3f')]({},_0x3f2572,_0x5545e8[_0x1373('0x40')]);var _0x29af10={'where':_0x3f2572[_0x1373('0x3b')]};return db[_0x1373('0x41')][_0x1373('0x1b')](_0x29af10)[_0x1373('0x24')](function(_0x1b27f1){_0x37a967[_0x1373('0x1b')]=_0x1b27f1;if(_0x5545e8[_0x1373('0x30')][_0x1373('0x42')]){_0x3f2572[_0x1373('0x43')]=[{'all':!![]}];}return db[_0x1373('0x41')][_0x1373('0x44')](_0x3f2572);})[_0x1373('0x24')](function(_0x261926){_0x37a967[_0x1373('0x45')]=_0x261926;return _0x37a967;})['then'](respondWithFilteredResult(_0x4e863d,_0x3f2572))[_0x1373('0x46')](handleError(_0x4e863d,null));};exports[_0x1373('0x47')]=function(_0x21590a,_0x4d9955){var _0x337766={'raw':!![],'where':{'id':_0x21590a['params']['id']}},_0x488ce1={};_0x488ce1[_0x1373('0x34')]=_['keys'](db[_0x1373('0x41')][_0x1373('0x2d')]);_0x488ce1[_0x1373('0x30')]=_[_0x1373('0x48')](_0x21590a[_0x1373('0x30')]);_0x488ce1['filters']=_[_0x1373('0x33')](_0x488ce1[_0x1373('0x34')],_0x488ce1[_0x1373('0x30')]);_0x337766[_0x1373('0x32')]=_['intersection'](_0x488ce1[_0x1373('0x34')],qs[_0x1373('0x35')](_0x21590a['query']['fields']));_0x337766[_0x1373('0x32')]=_0x337766['attributes'][_0x1373('0x36')]?_0x337766['attributes']:_0x488ce1[_0x1373('0x34')];if(_0x21590a['query'][_0x1373('0x42')]){_0x337766['include']=[{'all':!![]}];}_0x337766=_[_0x1373('0x3f')]({},_0x337766,_0x21590a[_0x1373('0x40')]);return db['AnalyticDefaultReport'][_0x1373('0x49')](_0x337766)['then'](handleEntityNotFound(_0x4d9955,null))[_0x1373('0x24')](respondWithResult(_0x4d9955,null))[_0x1373('0x46')](handleError(_0x4d9955,null));};exports[_0x1373('0x4a')]=function(_0x16253c,_0x1da31a){return db[_0x1373('0x41')]['create'](_0x16253c['body'],{})[_0x1373('0x24')](function(_0x56867f){var _0x4fbdfd=_0x16253c[_0x1373('0x4b')][_0x1373('0x4c')]({'plain':!![]});if(!_0x4fbdfd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fbdfd['role']===_0x1373('0x4b')){var _0x5d89a8=_0x56867f[_0x1373('0x4c')]({'plain':!![]});var _0x5e8ea6='Reports';return db[_0x1373('0x4d')][_0x1373('0x49')]({'where':{'name':_0x5e8ea6,'userProfileId':_0x4fbdfd[_0x1373('0x4e')]},'raw':!![]})[_0x1373('0x24')](function(_0x443a4c){if(_0x443a4c&&_0x443a4c[_0x1373('0x4f')]===0x0){return db[_0x1373('0x26')]['create']({'name':_0x5d89a8[_0x1373('0x29')],'resourceId':_0x5d89a8['id'],'type':_0x1373('0x25'),'sectionId':_0x443a4c['id']},{})[_0x1373('0x24')](function(){return _0x56867f;});}else{return _0x56867f;}})[_0x1373('0x46')](function(_0x378853){logger[_0x1373('0x27')](_0x1373('0x50'),_0x378853);throw _0x378853;});}return _0x56867f;})['then'](respondWithResult(_0x1da31a,0xc9))[_0x1373('0x46')](handleError(_0x1da31a,null));};exports[_0x1373('0x22')]=function(_0x13a65a,_0x24f2e7){if(_0x13a65a[_0x1373('0x51')]['id']){delete _0x13a65a[_0x1373('0x51')]['id'];}return db[_0x1373('0x41')][_0x1373('0x49')]({'where':{'id':_0x13a65a['params']['id']}})[_0x1373('0x24')](handleEntityNotFound(_0x24f2e7,null))[_0x1373('0x24')](saveUpdates(_0x13a65a[_0x1373('0x51')],null))[_0x1373('0x24')](respondWithResult(_0x24f2e7,null))['catch'](handleError(_0x24f2e7,null));};exports[_0x1373('0x23')]=function(_0x40b2a6,_0x3219e3){return db[_0x1373('0x41')][_0x1373('0x49')]({'where':{'id':_0x40b2a6[_0x1373('0x52')]['id']}})[_0x1373('0x24')](handleEntityNotFound(_0x3219e3,null))[_0x1373('0x24')](removeEntity(_0x3219e3,null))[_0x1373('0x46')](handleError(_0x3219e3,null));};exports['preview']=function(_0x5d2092,_0x1b4f03){var _0x4eb4b2=0xa;var _0x1ca1d3=[_0x1373('0x53'),'left_join',_0x1373('0x54'),_0x1373('0x55')];var _0x1ab6de={'SUM':_0x1373('0x56'),'COUNT':_0x1373('0x57'),'COUNT DISTINCT':_0x1373('0x58'),'MAX':_0x1373('0x59'),'MIN':_0x1373('0x5a'),'AVG':_0x1373('0x5b'),'GROUP_CONCAT':_0x1373('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x1373('0x5d')};var _0x49dea1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x1373('0x5e'),'HOUR':_0x1373('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1373('0x60')};var _0x31b056=function(_0x133b57){return!_[_0x1373('0x61')]([_0x1373('0x62'),'IS\x20NOT\x20NULL',_0x1373('0x63'),_0x1373('0x64')],_0x133b57);};var _0x22b6e5=function(_0x1a529a){if(!_0x1a529a||!_0x1a529a[_0x1373('0x65')]['length']){return'';}for(var _0x5eae74='(',_0x27f3c2=0x0;_0x27f3c2<_0x1a529a[_0x1373('0x65')][_0x1373('0x36')];_0x27f3c2+=0x1){_0x27f3c2>0x0&&(_0x5eae74+='\x20'+_0x1a529a['operator']+'\x20');_0x5eae74+=_0x1a529a['rules'][_0x27f3c2]['group']?_0x22b6e5(_0x1a529a[_0x1373('0x65')][_0x27f3c2][_0x1373('0x66')]):_0x1a529a['rules'][_0x27f3c2][_0x1373('0x67')]+'\x20'+_0x1a529a['rules'][_0x27f3c2][_0x1373('0x68')]+(_0x31b056(_0x1a529a['rules'][_0x27f3c2][_0x1373('0x68')])?'\x20'+_0x1a529a[_0x1373('0x65')][_0x27f3c2][_0x1373('0x69')]:'');}return _0x5eae74+')';};var _0x4d4ab6={'where':{'id':_0x5d2092[_0x1373('0x52')]['id']}},_0x6d319a,_0x50afa5,_0xa6c6aa,_0x4093cd,_0xaa2462;_0x4d4ab6=_[_0x1373('0x3f')]({},_0x4d4ab6,_0x5d2092['options']);return db[_0x1373('0x41')][_0x1373('0x49')](_0x4d4ab6)[_0x1373('0x24')](function(_0x3ed4e8){if(_0x3ed4e8){_0x6d319a=_0x3ed4e8;return _0x3ed4e8[_0x1373('0x6a')]();}return null;})[_0x1373('0x24')](function(_0x2ea77e){if(_0x2ea77e){if(!_0x2ea77e[_0x1373('0x36')]){throw new db[(_0x1373('0x6b'))]['ValidationErrorItem'](_0x1373('0x6c'),0x193);}_0x50afa5=_0x2ea77e;return db[_0x1373('0x6d')][_0x1373('0x44')]({'raw':!![]});}return null;})[_0x1373('0x24')](function(_0x49e514){if(_0x49e514){_0xa6c6aa=_[_0x1373('0x6e')](_0x49e514,'id');var _0x53f078;var _0x1cf417=squel[_0x1373('0x6f')]();_0x1cf417[_0x1373('0x70')](_0x6d319a[_0x1373('0x71')]);for(var _0x48415c=0x0;_0x48415c<_0x50afa5[_0x1373('0x36')];_0x48415c+=0x1){_0x53f078=_0x50afa5[_0x48415c]['MetricId']?_0xa6c6aa[_0x50afa5[_0x48415c][_0x1373('0x72')]]['metric']:_0x50afa5[_0x48415c][_0x1373('0x67')];_0x53f078=_0x50afa5[_0x48415c][_0x1373('0x73')]?_['replace'](_0x1ab6de[_0x50afa5[_0x48415c][_0x1373('0x73')]],'%s',_0x53f078):_0x53f078;_0x53f078=_0x50afa5[_0x48415c][_0x1373('0x74')]?_['replace'](_0x49dea1[_0x50afa5[_0x48415c][_0x1373('0x74')]],'%s',_0x53f078):_0x53f078;if(_0x50afa5[_0x48415c]['groupBy']){_0x1cf417[_0x1373('0x66')](_0x53f078);}_0x50afa5[_0x48415c][_0x1373('0x75')]&&_0x1cf417[_0x1373('0x39')](_0x53f078,_0x50afa5[_0x48415c]['orderBy']===_0x1373('0x76')?![]:!![]);_0x1cf417[_0x1373('0x67')](_0x53f078,_0x50afa5[_0x48415c][_0x1373('0x77')]||_0x53f078);}if(_0x6d319a[_0x1373('0x78')]){_0x6d319a[_0x1373('0x78')]=JSON[_0x1373('0x79')](_0x6d319a[_0x1373('0x78')]);for(var _0x41cb0b=0x0;_0x41cb0b<_0x6d319a[_0x1373('0x78')][_0x1373('0x36')];_0x41cb0b+=0x1){if(_0x6d319a[_0x1373('0x78')][_0x41cb0b][_0x1373('0x7a')]&&_[_0x1373('0x61')](_0x1ca1d3,_0x6d319a[_0x1373('0x78')][_0x41cb0b][_0x1373('0x7a')])&&_0x6d319a['joins'][_0x41cb0b][_0x1373('0x7b')]&&_0x6d319a[_0x1373('0x78')][_0x41cb0b][_0x1373('0x7c')]&&_0x6d319a['joins'][_0x41cb0b]['foreignKey']){_0x1cf417[_0x6d319a[_0x1373('0x78')][_0x41cb0b]['type']](_0x6d319a[_0x1373('0x78')][_0x41cb0b][_0x1373('0x7c')],null,util[_0x1373('0x74')](_0x1373('0x7d'),_0x6d319a[_0x1373('0x71')],_0x6d319a[_0x1373('0x78')][_0x41cb0b]['parentKey'],_0x6d319a[_0x1373('0x78')][_0x41cb0b][_0x1373('0x7c')],_0x6d319a['joins'][_0x41cb0b][_0x1373('0x7e')]));}}}if(_0x6d319a[_0x1373('0x7f')]){_0x6d319a['conditions']=JSON[_0x1373('0x79')](_0x6d319a[_0x1373('0x7f')]);_0x1cf417[_0x1373('0x3b')](_0x22b6e5(_0x6d319a['conditions'][_0x1373('0x66')]));}_0xaa2462=_0x1cf417[_0x1373('0x80')]();_0x1cf417[_0x1373('0x1d')](_0x4eb4b2);_0x1cf417[_0x1373('0x1c')](0x0);logger[_0x1373('0x81')](_0x1373('0x82'),_0x1cf417['toString']());return db[_0x1373('0x83')][_0x1373('0x30')](_0x1cf417[_0x1373('0x84')](),{'type':db['sequelize'][_0x1373('0x85')][_0x1373('0x86')]});}})['then'](respondWithResult(_0x1b4f03,null))[_0x1373('0x46')](handleError(_0x1b4f03,null));};function runReport(_0x33eb1c,_0x3787d4,_0xceec67){var _0x5a227f=_0x3787d4[_0x1373('0x29')];var _0x5079b4=0xa;var _0xb29782=['join','left_join','right_join',_0x1373('0x55')];var _0x5c129b={'SUM':'SUM(%s)','COUNT':_0x1373('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1373('0x59'),'MIN':_0x1373('0x5a'),'AVG':_0x1373('0x5b'),'GROUP_CONCAT':_0x1373('0x5c'),'GROUP_CONCAT ASC':_0x1373('0x87'),'GROUP_CONCAT DESC':_0x1373('0x5d')};var _0x8bc897={'SEC_TO_TIME':_0x1373('0x88'),'DATE':'DATE(%s)','HOUR':_0x1373('0x5f'),'ROUND':_0x1373('0x89'),'UNIX_TIMESTAMP':_0x1373('0x60')};var _0x1d6f76=function(_0x567bad){return!_[_0x1373('0x61')]([_0x1373('0x62'),_0x1373('0x8a'),_0x1373('0x63'),'IS\x20NOT\x20EMPTY'],_0x567bad);};var _0x54a374=function(_0x611986){if(!_0x611986||!_0x611986['rules'][_0x1373('0x36')]){return'';}for(var _0x5f3f34='(',_0x52bef4=0x0;_0x52bef4<_0x611986[_0x1373('0x65')]['length'];_0x52bef4+=0x1){_0x52bef4>0x0&&(_0x5f3f34+='\x20'+_0x611986[_0x1373('0x8b')]+'\x20');_0x5f3f34+=_0x611986['rules'][_0x52bef4][_0x1373('0x66')]?_0x54a374(_0x611986[_0x1373('0x65')][_0x52bef4][_0x1373('0x66')]):_0x611986[_0x1373('0x65')][_0x52bef4][_0x1373('0x67')]+'\x20'+_0x611986[_0x1373('0x65')][_0x52bef4][_0x1373('0x68')]+(_0x1d6f76(_0x611986[_0x1373('0x65')][_0x52bef4][_0x1373('0x68')])?'\x20'+_0x611986[_0x1373('0x65')][_0x52bef4][_0x1373('0x69')]:'');}return _0x5f3f34+')';};var _0x3db5a9={'where':{'id':_0x33eb1c['id']}},_0x4d7a52,_0x859496,_0x48ec0c,_0x23019a,_0x2cb6d1;_0x3db5a9=_[_0x1373('0x3f')]({},_0x3db5a9,_0xceec67);return db['AnalyticDefaultReport'][_0x1373('0x49')](_0x3db5a9)[_0x1373('0x24')](function(_0x20cea7){if(_0x20cea7){_0x4d7a52=_0x20cea7;return _0x20cea7['getFields']();}return null;})[_0x1373('0x24')](function(_0x5a6a0b){if(_0x5a6a0b){if(!_0x5a6a0b[_0x1373('0x36')]){throw new db[(_0x1373('0x6b'))][(_0x1373('0x8c'))](_0x1373('0x6c'),0x193);}_0x859496=_0x5a6a0b;return db[_0x1373('0x6d')][_0x1373('0x44')]({'raw':!![]});}return null;})[_0x1373('0x24')](function(_0x4c4d1b){if(_0x4c4d1b){_0x48ec0c=_[_0x1373('0x6e')](_0x4c4d1b,'id');var _0x477253;var _0x3801d4=squel[_0x1373('0x6f')]();_0x3801d4[_0x1373('0x70')](_0x4d7a52[_0x1373('0x71')]);for(var _0x4c2bab=0x0;_0x4c2bab<_0x859496['length'];_0x4c2bab+=0x1){_0x477253=_0x859496[_0x4c2bab]['MetricId']?_0x48ec0c[_0x859496[_0x4c2bab]['MetricId']][_0x1373('0x8d')]:_0x859496[_0x4c2bab][_0x1373('0x67')];_0x477253=_0x859496[_0x4c2bab][_0x1373('0x73')]?_['replace'](_0x5c129b[_0x859496[_0x4c2bab][_0x1373('0x73')]],'%s',_0x477253):_0x477253;_0x477253=_0x859496[_0x4c2bab][_0x1373('0x74')]?_['replace'](_0x8bc897[_0x859496[_0x4c2bab][_0x1373('0x74')]],'%s',_0x477253):_0x477253;if(_0x859496[_0x4c2bab]['groupBy']){_0x3801d4['group'](_0x477253);}_0x859496[_0x4c2bab]['orderBy']&&_0x3801d4[_0x1373('0x39')](_0x477253,_0x859496[_0x4c2bab][_0x1373('0x75')]===_0x1373('0x76')?![]:!![]);_0x3801d4[_0x1373('0x67')](_0x477253,_0x859496[_0x4c2bab][_0x1373('0x77')]||_0x477253);}if(_0x4d7a52[_0x1373('0x78')]){_0x4d7a52[_0x1373('0x78')]=JSON[_0x1373('0x79')](_0x4d7a52[_0x1373('0x78')]);for(var _0x5452a9=0x0;_0x5452a9<_0x4d7a52[_0x1373('0x78')][_0x1373('0x36')];_0x5452a9+=0x1){if(_0x4d7a52[_0x1373('0x78')][_0x5452a9]['type']&&_[_0x1373('0x61')](_0xb29782,_0x4d7a52[_0x1373('0x78')][_0x5452a9]['type'])&&_0x4d7a52[_0x1373('0x78')][_0x5452a9][_0x1373('0x7b')]&&_0x4d7a52[_0x1373('0x78')][_0x5452a9][_0x1373('0x7c')]&&_0x4d7a52[_0x1373('0x78')][_0x5452a9]['foreignKey']){_0x3801d4[_0x4d7a52[_0x1373('0x78')][_0x5452a9][_0x1373('0x7a')]](_0x4d7a52[_0x1373('0x78')][_0x5452a9][_0x1373('0x7c')],null,util[_0x1373('0x74')](_0x1373('0x7d'),_0x4d7a52[_0x1373('0x71')],_0x4d7a52[_0x1373('0x78')][_0x5452a9]['parentKey'],_0x4d7a52['joins'][_0x5452a9][_0x1373('0x7c')],_0x4d7a52['joins'][_0x5452a9]['foreignKey']));}}}if(_0x4d7a52[_0x1373('0x7f')]){_0x4d7a52[_0x1373('0x7f')]=JSON[_0x1373('0x79')](_0x4d7a52[_0x1373('0x7f')]);_0x3801d4[_0x1373('0x3b')](_0x54a374(_0x4d7a52['conditions'][_0x1373('0x66')]));}_0x2cb6d1=_0x3801d4[_0x1373('0x80')]();_0x3801d4[_0x1373('0x1d')](_0x5079b4);_0x3801d4[_0x1373('0x1c')](0x0);logger['debug'](_0x1373('0x82'),_0x3801d4['toString']());return db[_0x1373('0x83')]['query'](_0x3801d4['toString'](),{'type':db[_0x1373('0x83')]['QueryTypes'][_0x1373('0x86')]});}})['then'](function(_0x255f23){if(!_0x255f23[_0x1373('0x36')]){throw new db[(_0x1373('0x6b'))][(_0x1373('0x8c'))](_0x1373('0x8e'),0xcc);}if(_0x3787d4[_0x1373('0x8f')]===_0x1373('0x90')){return null;}var _0x209c19=_[_0x1373('0x3f')](_0x3787d4,{'name':_0x3787d4[_0x1373('0x91')]||_0x3787d4['name']||_0x4d7a52[_0x1373('0x29')],'basename':_0x5a227f,'savename':util[_0x1373('0x74')](_0x1373('0x92'),_0x3787d4[_0x1373('0x29')]||_0x4d7a52[_0x1373('0x29')],require('randomstring')[_0x1373('0x93')](0x4),_0x3787d4[_0x1373('0x8f')]||_0x1373('0x94')),'reportId':_0x4d7a52['id'],'reportType':_0x1373('0x95')});return db[_0x1373('0x96')][_0x1373('0x4a')](_0x209c19,{'raw':!![]});})['then'](function(_0x2a244d){if(_0x4d7a52[_0x1373('0x71')]===_0x1373('0x97')){_0x2cb6d1[_0x1373('0x3b')](_0x4d7a52[_0x1373('0x71')]+_0x1373('0x98'),_0x3787d4[_0x1373('0x99')],_0x3787d4[_0x1373('0x9a')]);}else{_0x2cb6d1[_0x1373('0x3b')](_0x4d7a52['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3787d4[_0x1373('0x99')],_0x3787d4['endDate']);}if(_0x2a244d){logger[_0x1373('0x9b')]('Run\x20Query:',_0x2cb6d1[_0x1373('0x84')]());require(_0x1373('0x9c'))[_0x1373('0x9d')](path[_0x1373('0x53')](__dirname,_0x1373('0x9e'),_0x2a244d[_0x1373('0x8f')]),[_0x2a244d['id'],_0x2cb6d1['toString'](),path[_0x1373('0x53')](__dirname,_0x1373('0x9f'),_0x2a244d[_0x1373('0xa0')]),_0x5a227f]);return _0x2a244d;}else{var _0x2da3e3=squel[_0x1373('0x6f')]();_0x2da3e3['from']('('+_0x2cb6d1[_0x1373('0x84')]()+')',_0x1373('0xa1'));_0x2da3e3[_0x1373('0x67')]('COUNT(*)',_0x1373('0x1b'));_0x2cb6d1[_0x1373('0x1d')](_0x3787d4[_0x1373('0x1d')]||_0x5079b4);_0x2cb6d1['offset'](_0x3787d4['offset']||0x0);return dbH[_0x1373('0x83')][_0x1373('0x30')](_0x2da3e3[_0x1373('0x84')](),{'type':dbH[_0x1373('0x83')]['QueryTypes'][_0x1373('0x86')]})[_0x1373('0x24')](function(_0x1f9f8f){if(!_0x1f9f8f[_0x1373('0x36')]){_0x23019a=0x0;}else{_0x23019a=_0x1f9f8f[0x0][_0x1373('0x1b')]||0x0;}return dbH[_0x1373('0x83')][_0x1373('0x30')](_0x2cb6d1[_0x1373('0x84')](),{'type':dbH[_0x1373('0x83')][_0x1373('0x85')][_0x1373('0x86')]});})[_0x1373('0x24')](function(_0x497ec9){return{'rows':_0x497ec9||[],'count':_0x23019a};});}});}exports[_0x1373('0xa2')]=function(_0x5c943a,_0x44f7ae){return runReport(_0x5c943a[_0x1373('0x52')],_0x5c943a[_0x1373('0x30')],_0x5c943a[_0x1373('0x40')])[_0x1373('0x24')](respondWithResult(_0x44f7ae,null))[_0x1373('0x46')](handleError(_0x44f7ae,null));};exports[_0x1373('0xa3')]=runReport;exports[_0x1373('0x30')]=function(_0x1790d4,_0x495612){var _0x3c5f4f=0xa;var _0x1f3fa2=[_0x1373('0x53'),'left_join',_0x1373('0x54'),_0x1373('0x55')];var _0x2f89da={'SUM':_0x1373('0x56'),'COUNT':_0x1373('0x57'),'COUNT DISTINCT':_0x1373('0x58'),'MAX':_0x1373('0x59'),'MIN':_0x1373('0x5a'),'AVG':_0x1373('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x1373('0x87'),'GROUP_CONCAT DESC':_0x1373('0x5d')};var _0x2fe8d2={'SEC_TO_TIME':_0x1373('0x88'),'DATE':_0x1373('0x5e'),'HOUR':_0x1373('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1373('0x60')};var _0x4c8ecb=function(_0x5d864f){return!_[_0x1373('0x61')]([_0x1373('0x62'),_0x1373('0x8a'),_0x1373('0x63'),_0x1373('0x64')],_0x5d864f);};var _0x43be8b=function(_0x58bd2f){if(!_0x58bd2f||!_0x58bd2f[_0x1373('0x65')]['length']){return'';}for(var _0x1bd96c='(',_0x769922=0x0;_0x769922<_0x58bd2f[_0x1373('0x65')][_0x1373('0x36')];_0x769922+=0x1){_0x769922>0x0&&(_0x1bd96c+='\x20'+_0x58bd2f[_0x1373('0x8b')]+'\x20');_0x1bd96c+=_0x58bd2f[_0x1373('0x65')][_0x769922]['group']?_0x43be8b(_0x58bd2f['rules'][_0x769922]['group']):_0x58bd2f[_0x1373('0x65')][_0x769922]['field']+'\x20'+_0x58bd2f[_0x1373('0x65')][_0x769922][_0x1373('0x68')]+(_0x4c8ecb(_0x58bd2f['rules'][_0x769922][_0x1373('0x68')])?'\x20'+_0x58bd2f[_0x1373('0x65')][_0x769922][_0x1373('0x69')]:'');}return _0x1bd96c+')';};var _0xe45679={'where':{'id':_0x1790d4[_0x1373('0x52')]['id']}},_0x3ca72c,_0x31a4b3,_0x1ee8e6,_0x2cdc58,_0xbe3575;_0xe45679=_['merge']({},_0xe45679,_0x1790d4[_0x1373('0x40')]);return db[_0x1373('0x41')][_0x1373('0x49')](_0xe45679)[_0x1373('0x24')](function(_0x54cc1e){if(_0x54cc1e){_0x3ca72c=_0x54cc1e;return _0x54cc1e['getFields']();}return null;})[_0x1373('0x24')](function(_0x453f5c){if(_0x453f5c){if(!_0x453f5c[_0x1373('0x36')]){throw new db['Sequelize'][(_0x1373('0x8c'))](_0x1373('0x6c'),0x193);}_0x31a4b3=_0x453f5c;return db[_0x1373('0x6d')][_0x1373('0x44')]({'raw':!![]});}return null;})['then'](function(_0x44c535){if(_0x44c535){_0x1ee8e6=_['keyBy'](_0x44c535,'id');var _0x5d4296;var _0x372eaf=squel[_0x1373('0x6f')]();_0x372eaf[_0x1373('0x70')](_0x3ca72c[_0x1373('0x71')]);for(var _0x4ef479=0x0;_0x4ef479<_0x31a4b3[_0x1373('0x36')];_0x4ef479+=0x1){_0x5d4296=_0x31a4b3[_0x4ef479][_0x1373('0x72')]?_0x1ee8e6[_0x31a4b3[_0x4ef479][_0x1373('0x72')]][_0x1373('0x8d')]:_0x31a4b3[_0x4ef479]['field'];_0x5d4296=_0x31a4b3[_0x4ef479][_0x1373('0x73')]?_[_0x1373('0xa4')](_0x2f89da[_0x31a4b3[_0x4ef479][_0x1373('0x73')]],'%s',_0x5d4296):_0x5d4296;_0x5d4296=_0x31a4b3[_0x4ef479][_0x1373('0x74')]?_['replace'](_0x2fe8d2[_0x31a4b3[_0x4ef479][_0x1373('0x74')]],'%s',_0x5d4296):_0x5d4296;if(_0x31a4b3[_0x4ef479]['groupBy']){_0x372eaf[_0x1373('0x66')](_0x5d4296);}_0x31a4b3[_0x4ef479]['orderBy']&&_0x372eaf[_0x1373('0x39')](_0x5d4296,_0x31a4b3[_0x4ef479]['orderBy']==='DESC'?![]:!![]);_0x372eaf['field'](_0x5d4296,_0x31a4b3[_0x4ef479][_0x1373('0x77')]||_0x5d4296);}if(_0x3ca72c[_0x1373('0x78')]){_0x3ca72c[_0x1373('0x78')]=JSON[_0x1373('0x79')](_0x3ca72c[_0x1373('0x78')]);for(var _0x14f9e0=0x0;_0x14f9e0<_0x3ca72c[_0x1373('0x78')][_0x1373('0x36')];_0x14f9e0+=0x1){if(_0x3ca72c['joins'][_0x14f9e0]['type']&&_[_0x1373('0x61')](_0x1f3fa2,_0x3ca72c[_0x1373('0x78')][_0x14f9e0][_0x1373('0x7a')])&&_0x3ca72c[_0x1373('0x78')][_0x14f9e0][_0x1373('0x7b')]&&_0x3ca72c['joins'][_0x14f9e0][_0x1373('0x7c')]&&_0x3ca72c[_0x1373('0x78')][_0x14f9e0][_0x1373('0x7e')]){_0x372eaf[_0x3ca72c[_0x1373('0x78')][_0x14f9e0][_0x1373('0x7a')]](_0x3ca72c['joins'][_0x14f9e0][_0x1373('0x7c')],null,util[_0x1373('0x74')](_0x1373('0x7d'),_0x3ca72c[_0x1373('0x71')],_0x3ca72c['joins'][_0x14f9e0][_0x1373('0x7b')],_0x3ca72c['joins'][_0x14f9e0][_0x1373('0x7c')],_0x3ca72c['joins'][_0x14f9e0][_0x1373('0x7e')]));}}}if(_0x3ca72c[_0x1373('0x7f')]){_0x3ca72c[_0x1373('0x7f')]=JSON[_0x1373('0x79')](_0x3ca72c[_0x1373('0x7f')]);_0x372eaf[_0x1373('0x3b')](_0x43be8b(_0x3ca72c[_0x1373('0x7f')][_0x1373('0x66')]));}_0xbe3575=_0x372eaf[_0x1373('0x80')]();_0x372eaf[_0x1373('0x1d')](_0x3c5f4f);_0x372eaf[_0x1373('0x1c')](0x0);logger[_0x1373('0x81')]('Limited\x20Query:',_0x372eaf[_0x1373('0x84')]());return db[_0x1373('0x83')][_0x1373('0x30')](_0x372eaf[_0x1373('0x84')](),{'type':db[_0x1373('0x83')][_0x1373('0x85')][_0x1373('0x86')]});}})[_0x1373('0x24')](function(){return{'sql':_0xbe3575[_0x1373('0x84')]()};})['then'](respondWithResult(_0x495612,null))[_0x1373('0x46')](handleError(_0x495612,null));}; \ No newline at end of file +var _0x6c32=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','count','includeAll','include','findAll','rows','catch','show','attributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','left_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','condition','value','options','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','debug','Limited\x20Query:','toString','sequelize','SELECT','join','right_join','cross_join','AVG(%s)','SEC_TO_TIME(%s)','ValidationErrorItem','MetricId','metric','clone','QueryTypes','output','web','fullPath','randomstring','generate','csv','default','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','COUNT(*)','run','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','update','destroy','then','get','DefaultReports','UserProfileResource','error','stack','name','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x1f27ac,_0x4e9a8f){var _0xfbbfb6=function(_0x23627a){while(--_0x23627a){_0x1f27ac['push'](_0x1f27ac['shift']());}};_0xfbbfb6(++_0x4e9a8f);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x26c3('0x0'));var emlformat=require(_0x26c3('0x1'));var rimraf=require(_0x26c3('0x2'));var zipdir=require(_0x26c3('0x3'));var jsonpatch=require(_0x26c3('0x4'));var rp=require(_0x26c3('0x5'));var moment=require(_0x26c3('0x6'));var BPromise=require(_0x26c3('0x7'));var Mustache=require(_0x26c3('0x8'));var util=require('util');var path=require(_0x26c3('0x9'));var sox=require(_0x26c3('0xa'));var csv=require(_0x26c3('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x26c3('0xc'));var squel=require('squel');var crypto=require(_0x26c3('0xd'));var jsforce=require(_0x26c3('0xe'));var deskjs=require(_0x26c3('0xf'));var toCsv=require(_0x26c3('0xb'));var querystring=require(_0x26c3('0x10'));var Papa=require(_0x26c3('0x11'));var Redis=require(_0x26c3('0x12'));var authService=require(_0x26c3('0x13'));var qs=require(_0x26c3('0x14'));var as=require(_0x26c3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x26c3('0x16'));var licenseUtil=require(_0x26c3('0x17'));var db=require(_0x26c3('0x18'))['db'];var dbH=require(_0x26c3('0x18'))['dbH'];function respondWithStatusCode(_0x4c7b94,_0x45fd4f){_0x45fd4f=_0x45fd4f||0xcc;return function(_0x15271a){if(_0x15271a){return _0x4c7b94[_0x26c3('0x19')](_0x45fd4f);}return _0x4c7b94[_0x26c3('0x1a')](_0x45fd4f)[_0x26c3('0x1b')]();};}function respondWithResult(_0x568d0b,_0x5d4e9d){_0x5d4e9d=_0x5d4e9d||0xc8;return function(_0x2acfb1){if(_0x2acfb1){return _0x568d0b[_0x26c3('0x1a')](_0x5d4e9d)['json'](_0x2acfb1);}};}function respondWithFilteredResult(_0x4ed7c1,_0x124cb3){return function(_0x5e863f){if(_0x5e863f){var _0x3ce1ea=_0x5e863f['count'],_0x486486=_0x124cb3[_0x26c3('0x1c')],_0x5c21ea=_0x124cb3['offset']+_0x124cb3[_0x26c3('0x1d')],_0x3931d5;if(_0x5c21ea>=_0x3ce1ea){_0x5c21ea=_0x3ce1ea;_0x3931d5=0xc8;}else{_0x3931d5=0xce;}_0x4ed7c1[_0x26c3('0x1a')](_0x3931d5);return _0x4ed7c1[_0x26c3('0x1e')](_0x26c3('0x1f'),_0x486486+'-'+_0x5c21ea+'/'+_0x3ce1ea)[_0x26c3('0x20')](_0x5e863f);}return null;};}function patchUpdates(_0x497441){return function(_0x5c530f){try{jsonpatch[_0x26c3('0x21')](_0x5c530f,_0x497441,!![]);}catch(_0x39e500){return BPromise['reject'](_0x39e500);}return _0x5c530f['save']();};}function saveUpdates(_0x176795,_0x5c2f7d){return function(_0x501dfd){if(_0x501dfd){return _0x501dfd[_0x26c3('0x22')](_0x176795)['then'](function(_0x21034d){return _0x21034d;});}return null;};}function removeEntity(_0x4a76b5,_0x367b62){return function(_0x4a3ce2){if(_0x4a3ce2){return _0x4a3ce2[_0x26c3('0x23')]()[_0x26c3('0x24')](function(){var _0x2f1648=_0x4a3ce2[_0x26c3('0x25')]({'plain':!![]});var _0x3fafed=_0x26c3('0x26');return db[_0x26c3('0x27')][_0x26c3('0x23')]({'where':{'type':_0x3fafed,'resourceId':_0x2f1648['id']}})[_0x26c3('0x24')](function(){return _0x4a3ce2;});})[_0x26c3('0x24')](function(){_0x4a76b5['status'](0xcc)[_0x26c3('0x1b')]();});}};}function handleEntityNotFound(_0x4c7696,_0x50d85e){return function(_0x44b4f8){if(!_0x44b4f8){_0x4c7696[_0x26c3('0x19')](0x194);}return _0x44b4f8;};}function handleError(_0x58701e,_0x458c89){_0x458c89=_0x458c89||0x1f4;return function(_0x50c7a1){logger[_0x26c3('0x28')](_0x50c7a1[_0x26c3('0x29')]);if(_0x50c7a1[_0x26c3('0x2a')]){delete _0x50c7a1[_0x26c3('0x2a')];}_0x58701e[_0x26c3('0x1a')](_0x458c89)['send'](_0x50c7a1);};}exports[_0x26c3('0x2b')]=function(_0x27f556,_0xebb766){var _0x2b06fe={},_0x13cdbe={},_0x19200e={'count':0x0,'rows':[]};var _0x5557b8=_[_0x26c3('0x2c')](db[_0x26c3('0x2d')][_0x26c3('0x2e')],function(_0x48080f){return{'name':_0x48080f[_0x26c3('0x2f')],'type':_0x48080f[_0x26c3('0x30')][_0x26c3('0x31')]};});_0x13cdbe[_0x26c3('0x32')]=_[_0x26c3('0x2c')](_0x5557b8,_0x26c3('0x2a'));_0x13cdbe['query']=_[_0x26c3('0x33')](_0x27f556[_0x26c3('0x34')]);_0x13cdbe['filters']=_['intersection'](_0x13cdbe['model'],_0x13cdbe['query']);_0x2b06fe['attributes']=_[_0x26c3('0x35')](_0x13cdbe[_0x26c3('0x32')],qs['fields'](_0x27f556[_0x26c3('0x34')][_0x26c3('0x36')]));_0x2b06fe['attributes']=_0x2b06fe['attributes'][_0x26c3('0x37')]?_0x2b06fe['attributes']:_0x13cdbe[_0x26c3('0x32')];if(!_0x27f556['query'][_0x26c3('0x38')](_0x26c3('0x39'))){_0x2b06fe[_0x26c3('0x1d')]=qs[_0x26c3('0x1d')](_0x27f556[_0x26c3('0x34')]['limit']);_0x2b06fe[_0x26c3('0x1c')]=qs[_0x26c3('0x1c')](_0x27f556[_0x26c3('0x34')][_0x26c3('0x1c')]);}_0x2b06fe[_0x26c3('0x3a')]=qs[_0x26c3('0x3b')](_0x27f556['query']['sort']);_0x2b06fe[_0x26c3('0x3c')]=qs[_0x26c3('0x3d')](_[_0x26c3('0x3e')](_0x27f556[_0x26c3('0x34')],_0x13cdbe[_0x26c3('0x3d')]),_0x5557b8);if(_0x27f556['query']['filter']){_0x2b06fe['where']=_[_0x26c3('0x3f')](_0x2b06fe[_0x26c3('0x3c')],{'$or':_[_0x26c3('0x2c')](_0x5557b8,function(_0x3996da){if(_0x3996da[_0x26c3('0x30')]!=='VIRTUAL'){var _0x592764={};_0x592764[_0x3996da[_0x26c3('0x2a')]]={'$like':'%'+_0x27f556[_0x26c3('0x34')][_0x26c3('0x40')]+'%'};return _0x592764;}})});}_0x2b06fe=_[_0x26c3('0x3f')]({},_0x2b06fe,_0x27f556['options']);var _0x4111b6={'where':_0x2b06fe[_0x26c3('0x3c')]};return db[_0x26c3('0x2d')][_0x26c3('0x41')](_0x4111b6)[_0x26c3('0x24')](function(_0x96131d){_0x19200e[_0x26c3('0x41')]=_0x96131d;if(_0x27f556[_0x26c3('0x34')][_0x26c3('0x42')]){_0x2b06fe[_0x26c3('0x43')]=[{'all':!![]}];}return db[_0x26c3('0x2d')][_0x26c3('0x44')](_0x2b06fe);})[_0x26c3('0x24')](function(_0x5aac84){_0x19200e[_0x26c3('0x45')]=_0x5aac84;return _0x19200e;})[_0x26c3('0x24')](respondWithFilteredResult(_0xebb766,_0x2b06fe))[_0x26c3('0x46')](handleError(_0xebb766,null));};exports[_0x26c3('0x47')]=function(_0x1b6f88,_0x1bede8){var _0x567fb2={'raw':!![],'where':{'id':_0x1b6f88['params']['id']}},_0x1845ee={};_0x1845ee[_0x26c3('0x32')]=_['keys'](db[_0x26c3('0x2d')][_0x26c3('0x2e')]);_0x1845ee['query']=_[_0x26c3('0x33')](_0x1b6f88[_0x26c3('0x34')]);_0x1845ee[_0x26c3('0x3d')]=_[_0x26c3('0x35')](_0x1845ee[_0x26c3('0x32')],_0x1845ee['query']);_0x567fb2[_0x26c3('0x48')]=_['intersection'](_0x1845ee[_0x26c3('0x32')],qs['fields'](_0x1b6f88['query'][_0x26c3('0x36')]));_0x567fb2[_0x26c3('0x48')]=_0x567fb2[_0x26c3('0x48')]['length']?_0x567fb2[_0x26c3('0x48')]:_0x1845ee[_0x26c3('0x32')];if(_0x1b6f88[_0x26c3('0x34')][_0x26c3('0x42')]){_0x567fb2[_0x26c3('0x43')]=[{'all':!![]}];}_0x567fb2=_[_0x26c3('0x3f')]({},_0x567fb2,_0x1b6f88['options']);return db[_0x26c3('0x2d')][_0x26c3('0x49')](_0x567fb2)[_0x26c3('0x24')](handleEntityNotFound(_0x1bede8,null))[_0x26c3('0x24')](respondWithResult(_0x1bede8,null))['catch'](handleError(_0x1bede8,null));};exports[_0x26c3('0x4a')]=function(_0x3f4ca9,_0x480bdc){return db[_0x26c3('0x2d')][_0x26c3('0x4a')](_0x3f4ca9['body'],{})[_0x26c3('0x24')](function(_0x4827c6){var _0x2c6d8b=_0x3f4ca9[_0x26c3('0x4b')][_0x26c3('0x25')]({'plain':!![]});if(!_0x2c6d8b)throw new Error(_0x26c3('0x4c'));if(_0x2c6d8b[_0x26c3('0x4d')]===_0x26c3('0x4b')){var _0x129452=_0x4827c6['get']({'plain':!![]});var _0x1b5f08='Reports';return db['UserProfileSection'][_0x26c3('0x49')]({'where':{'name':_0x1b5f08,'userProfileId':_0x2c6d8b[_0x26c3('0x4e')]},'raw':!![]})[_0x26c3('0x24')](function(_0x4dc997){if(_0x4dc997&&_0x4dc997['autoAssociation']===0x0){return db[_0x26c3('0x27')][_0x26c3('0x4a')]({'name':_0x129452[_0x26c3('0x2a')],'resourceId':_0x129452['id'],'type':'DefaultReports','sectionId':_0x4dc997['id']},{})[_0x26c3('0x24')](function(){return _0x4827c6;});}else{return _0x4827c6;}})[_0x26c3('0x46')](function(_0x218f51){logger['error'](_0x26c3('0x4f'),_0x218f51);throw _0x218f51;});}return _0x4827c6;})['then'](respondWithResult(_0x480bdc,0xc9))[_0x26c3('0x46')](handleError(_0x480bdc,null));};exports[_0x26c3('0x22')]=function(_0x356994,_0x499445){if(_0x356994[_0x26c3('0x50')]['id']){delete _0x356994[_0x26c3('0x50')]['id'];}return db[_0x26c3('0x2d')][_0x26c3('0x49')]({'where':{'id':_0x356994[_0x26c3('0x51')]['id']}})[_0x26c3('0x24')](handleEntityNotFound(_0x499445,null))['then'](saveUpdates(_0x356994[_0x26c3('0x50')],null))[_0x26c3('0x24')](respondWithResult(_0x499445,null))['catch'](handleError(_0x499445,null));};exports[_0x26c3('0x23')]=function(_0x5169d2,_0x5c6c24){return db[_0x26c3('0x2d')]['find']({'where':{'id':_0x5169d2[_0x26c3('0x51')]['id']}})[_0x26c3('0x24')](handleEntityNotFound(_0x5c6c24,null))[_0x26c3('0x24')](removeEntity(_0x5c6c24,null))[_0x26c3('0x46')](handleError(_0x5c6c24,null));};exports['preview']=function(_0x5cc4f3,_0x3bd83e){var _0x59fbaf=0xa;var _0x4c38d6=['join',_0x26c3('0x52'),'right_join','cross_join'];var _0x1c7d72={'SUM':_0x26c3('0x53'),'COUNT':_0x26c3('0x54'),'COUNT DISTINCT':_0x26c3('0x55'),'MAX':_0x26c3('0x56'),'MIN':_0x26c3('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x26c3('0x58'),'GROUP_CONCAT ASC':_0x26c3('0x59'),'GROUP_CONCAT DESC':_0x26c3('0x5a')};var _0x2680f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x26c3('0x5b'),'HOUR':_0x26c3('0x5c'),'ROUND':_0x26c3('0x5d'),'UNIX_TIMESTAMP':_0x26c3('0x5e')};var _0x1314a3=function(_0x28cde2){return!_['includes']([_0x26c3('0x5f'),_0x26c3('0x60'),_0x26c3('0x61'),_0x26c3('0x62')],_0x28cde2);};var _0x5cc9fc=function(_0xc5e2f6){if(!_0xc5e2f6||!_0xc5e2f6[_0x26c3('0x63')][_0x26c3('0x37')]){return'';}for(var _0x416373='(',_0x4d4970=0x0;_0x4d4970<_0xc5e2f6[_0x26c3('0x63')][_0x26c3('0x37')];_0x4d4970+=0x1){_0x4d4970>0x0&&(_0x416373+='\x20'+_0xc5e2f6[_0x26c3('0x64')]+'\x20');_0x416373+=_0xc5e2f6[_0x26c3('0x63')][_0x4d4970]['group']?_0x5cc9fc(_0xc5e2f6[_0x26c3('0x63')][_0x4d4970]['group']):_0xc5e2f6[_0x26c3('0x63')][_0x4d4970]['field']+'\x20'+_0xc5e2f6[_0x26c3('0x63')][_0x4d4970][_0x26c3('0x65')]+(_0x1314a3(_0xc5e2f6['rules'][_0x4d4970][_0x26c3('0x65')])?'\x20'+_0xc5e2f6[_0x26c3('0x63')][_0x4d4970][_0x26c3('0x66')]:'');}return _0x416373+')';};var _0xe5c060={'where':{'id':_0x5cc4f3[_0x26c3('0x51')]['id']}},_0x41767d,_0x4fbd2e,_0x1dcf53,_0x6e05e3,_0x115d6a;_0xe5c060=_[_0x26c3('0x3f')]({},_0xe5c060,_0x5cc4f3[_0x26c3('0x67')]);return db[_0x26c3('0x2d')]['find'](_0xe5c060)[_0x26c3('0x24')](function(_0x45d17b){if(_0x45d17b){_0x41767d=_0x45d17b;return _0x45d17b[_0x26c3('0x68')]();}return null;})[_0x26c3('0x24')](function(_0x499849){if(_0x499849){if(!_0x499849[_0x26c3('0x37')]){throw new db[(_0x26c3('0x69'))]['ValidationErrorItem'](_0x26c3('0x6a'),0x193);}_0x4fbd2e=_0x499849;return db[_0x26c3('0x6b')][_0x26c3('0x44')]({'raw':!![]});}return null;})[_0x26c3('0x24')](function(_0x3a5c0f){if(_0x3a5c0f){_0x1dcf53=_[_0x26c3('0x6c')](_0x3a5c0f,'id');var _0x2addd3;var _0x258e32=squel[_0x26c3('0x6d')]();_0x258e32[_0x26c3('0x6e')](_0x41767d[_0x26c3('0x6f')]);for(var _0x3c8a58=0x0;_0x3c8a58<_0x4fbd2e['length'];_0x3c8a58+=0x1){_0x2addd3=_0x4fbd2e[_0x3c8a58]['MetricId']?_0x1dcf53[_0x4fbd2e[_0x3c8a58]['MetricId']]['metric']:_0x4fbd2e[_0x3c8a58][_0x26c3('0x70')];_0x2addd3=_0x4fbd2e[_0x3c8a58][_0x26c3('0x71')]?_[_0x26c3('0x72')](_0x1c7d72[_0x4fbd2e[_0x3c8a58][_0x26c3('0x71')]],'%s',_0x2addd3):_0x2addd3;_0x2addd3=_0x4fbd2e[_0x3c8a58][_0x26c3('0x73')]?_[_0x26c3('0x72')](_0x2680f5[_0x4fbd2e[_0x3c8a58][_0x26c3('0x73')]],'%s',_0x2addd3):_0x2addd3;if(_0x4fbd2e[_0x3c8a58][_0x26c3('0x74')]){_0x258e32['group'](_0x2addd3);}_0x4fbd2e[_0x3c8a58][_0x26c3('0x75')]&&_0x258e32[_0x26c3('0x3a')](_0x2addd3,_0x4fbd2e[_0x3c8a58][_0x26c3('0x75')]===_0x26c3('0x76')?![]:!![]);_0x258e32[_0x26c3('0x70')](_0x2addd3,_0x4fbd2e[_0x3c8a58][_0x26c3('0x77')]||_0x2addd3);}if(_0x41767d['joins']){_0x41767d[_0x26c3('0x78')]=JSON[_0x26c3('0x79')](_0x41767d['joins']);for(var _0x25a2cb=0x0;_0x25a2cb<_0x41767d[_0x26c3('0x78')]['length'];_0x25a2cb+=0x1){if(_0x41767d[_0x26c3('0x78')][_0x25a2cb][_0x26c3('0x30')]&&_[_0x26c3('0x7a')](_0x4c38d6,_0x41767d['joins'][_0x25a2cb][_0x26c3('0x30')])&&_0x41767d[_0x26c3('0x78')][_0x25a2cb][_0x26c3('0x7b')]&&_0x41767d[_0x26c3('0x78')][_0x25a2cb][_0x26c3('0x7c')]&&_0x41767d[_0x26c3('0x78')][_0x25a2cb][_0x26c3('0x7d')]){_0x258e32[_0x41767d['joins'][_0x25a2cb]['type']](_0x41767d[_0x26c3('0x78')][_0x25a2cb][_0x26c3('0x7c')],null,util[_0x26c3('0x73')](_0x26c3('0x7e'),_0x41767d['table'],_0x41767d[_0x26c3('0x78')][_0x25a2cb]['parentKey'],_0x41767d['joins'][_0x25a2cb][_0x26c3('0x7c')],_0x41767d[_0x26c3('0x78')][_0x25a2cb]['foreignKey']));}}}if(_0x41767d[_0x26c3('0x7f')]){_0x41767d['conditions']=JSON[_0x26c3('0x79')](_0x41767d[_0x26c3('0x7f')]);_0x258e32[_0x26c3('0x3c')](_0x5cc9fc(_0x41767d['conditions'][_0x26c3('0x80')]));}_0x115d6a=_0x258e32['clone']();_0x258e32[_0x26c3('0x1d')](_0x59fbaf);_0x258e32[_0x26c3('0x1c')](0x0);logger[_0x26c3('0x81')](_0x26c3('0x82'),_0x258e32[_0x26c3('0x83')]());return db['sequelize']['query'](_0x258e32[_0x26c3('0x83')](),{'type':db[_0x26c3('0x84')]['QueryTypes'][_0x26c3('0x85')]});}})[_0x26c3('0x24')](respondWithResult(_0x3bd83e,null))[_0x26c3('0x46')](handleError(_0x3bd83e,null));};function runReport(_0x4dd8a2,_0x179498,_0x3d5a3b){var _0x4be9ad=_0x179498['name'];var _0x1440c9=0xa;var _0x3d5bab=[_0x26c3('0x86'),_0x26c3('0x52'),_0x26c3('0x87'),_0x26c3('0x88')];var _0x483458={'SUM':_0x26c3('0x53'),'COUNT':_0x26c3('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x26c3('0x56'),'MIN':_0x26c3('0x57'),'AVG':_0x26c3('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x26c3('0x59'),'GROUP_CONCAT DESC':_0x26c3('0x5a')};var _0x174245={'SEC_TO_TIME':_0x26c3('0x8a'),'DATE':_0x26c3('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x26c3('0x5e')};var _0x469a0a=function(_0xbaa6af){return!_['includes']([_0x26c3('0x5f'),_0x26c3('0x60'),'IS\x20EMPTY',_0x26c3('0x62')],_0xbaa6af);};var _0x29494f=function(_0x29f690){if(!_0x29f690||!_0x29f690['rules'][_0x26c3('0x37')]){return'';}for(var _0x1544c4='(',_0x452a3e=0x0;_0x452a3e<_0x29f690[_0x26c3('0x63')]['length'];_0x452a3e+=0x1){_0x452a3e>0x0&&(_0x1544c4+='\x20'+_0x29f690['operator']+'\x20');_0x1544c4+=_0x29f690[_0x26c3('0x63')][_0x452a3e][_0x26c3('0x80')]?_0x29494f(_0x29f690[_0x26c3('0x63')][_0x452a3e][_0x26c3('0x80')]):_0x29f690[_0x26c3('0x63')][_0x452a3e][_0x26c3('0x70')]+'\x20'+_0x29f690['rules'][_0x452a3e][_0x26c3('0x65')]+(_0x469a0a(_0x29f690[_0x26c3('0x63')][_0x452a3e][_0x26c3('0x65')])?'\x20'+_0x29f690[_0x26c3('0x63')][_0x452a3e][_0x26c3('0x66')]:'');}return _0x1544c4+')';};var _0x23f7af={'where':{'id':_0x4dd8a2['id']}},_0x34f2ba,_0x1da826,_0x2c173e,_0x30a5f6,_0x52adff;_0x23f7af=_[_0x26c3('0x3f')]({},_0x23f7af,_0x3d5a3b);return db[_0x26c3('0x2d')][_0x26c3('0x49')](_0x23f7af)[_0x26c3('0x24')](function(_0x2ce3e3){if(_0x2ce3e3){_0x34f2ba=_0x2ce3e3;return _0x2ce3e3[_0x26c3('0x68')]();}return null;})['then'](function(_0x221978){if(_0x221978){if(!_0x221978[_0x26c3('0x37')]){throw new db[(_0x26c3('0x69'))][(_0x26c3('0x8b'))](_0x26c3('0x6a'),0x193);}_0x1da826=_0x221978;return db['AnalyticMetric'][_0x26c3('0x44')]({'raw':!![]});}return null;})['then'](function(_0x381b43){if(_0x381b43){_0x2c173e=_[_0x26c3('0x6c')](_0x381b43,'id');var _0x5c3f90;var _0x5b43aa=squel[_0x26c3('0x6d')]();_0x5b43aa[_0x26c3('0x6e')](_0x34f2ba[_0x26c3('0x6f')]);for(var _0x17e3ed=0x0;_0x17e3ed<_0x1da826[_0x26c3('0x37')];_0x17e3ed+=0x1){_0x5c3f90=_0x1da826[_0x17e3ed][_0x26c3('0x8c')]?_0x2c173e[_0x1da826[_0x17e3ed]['MetricId']][_0x26c3('0x8d')]:_0x1da826[_0x17e3ed][_0x26c3('0x70')];_0x5c3f90=_0x1da826[_0x17e3ed]['function']?_[_0x26c3('0x72')](_0x483458[_0x1da826[_0x17e3ed][_0x26c3('0x71')]],'%s',_0x5c3f90):_0x5c3f90;_0x5c3f90=_0x1da826[_0x17e3ed][_0x26c3('0x73')]?_[_0x26c3('0x72')](_0x174245[_0x1da826[_0x17e3ed][_0x26c3('0x73')]],'%s',_0x5c3f90):_0x5c3f90;if(_0x1da826[_0x17e3ed][_0x26c3('0x74')]){_0x5b43aa[_0x26c3('0x80')](_0x5c3f90);}_0x1da826[_0x17e3ed]['orderBy']&&_0x5b43aa[_0x26c3('0x3a')](_0x5c3f90,_0x1da826[_0x17e3ed][_0x26c3('0x75')]===_0x26c3('0x76')?![]:!![]);_0x5b43aa[_0x26c3('0x70')](_0x5c3f90,_0x1da826[_0x17e3ed][_0x26c3('0x77')]||_0x5c3f90);}if(_0x34f2ba[_0x26c3('0x78')]){_0x34f2ba['joins']=JSON[_0x26c3('0x79')](_0x34f2ba[_0x26c3('0x78')]);for(var _0x532c76=0x0;_0x532c76<_0x34f2ba[_0x26c3('0x78')]['length'];_0x532c76+=0x1){if(_0x34f2ba[_0x26c3('0x78')][_0x532c76][_0x26c3('0x30')]&&_[_0x26c3('0x7a')](_0x3d5bab,_0x34f2ba[_0x26c3('0x78')][_0x532c76][_0x26c3('0x30')])&&_0x34f2ba[_0x26c3('0x78')][_0x532c76][_0x26c3('0x7b')]&&_0x34f2ba[_0x26c3('0x78')][_0x532c76]['foreignTable']&&_0x34f2ba[_0x26c3('0x78')][_0x532c76][_0x26c3('0x7d')]){_0x5b43aa[_0x34f2ba[_0x26c3('0x78')][_0x532c76][_0x26c3('0x30')]](_0x34f2ba[_0x26c3('0x78')][_0x532c76]['foreignTable'],null,util[_0x26c3('0x73')](_0x26c3('0x7e'),_0x34f2ba[_0x26c3('0x6f')],_0x34f2ba['joins'][_0x532c76][_0x26c3('0x7b')],_0x34f2ba[_0x26c3('0x78')][_0x532c76][_0x26c3('0x7c')],_0x34f2ba[_0x26c3('0x78')][_0x532c76][_0x26c3('0x7d')]));}}}if(_0x34f2ba['conditions']){_0x34f2ba[_0x26c3('0x7f')]=JSON['parse'](_0x34f2ba[_0x26c3('0x7f')]);_0x5b43aa[_0x26c3('0x3c')](_0x29494f(_0x34f2ba['conditions'][_0x26c3('0x80')]));}_0x52adff=_0x5b43aa[_0x26c3('0x8e')]();_0x5b43aa['limit'](_0x1440c9);_0x5b43aa[_0x26c3('0x1c')](0x0);logger['debug'](_0x26c3('0x82'),_0x5b43aa[_0x26c3('0x83')]());return db[_0x26c3('0x84')]['query'](_0x5b43aa[_0x26c3('0x83')](),{'type':db[_0x26c3('0x84')][_0x26c3('0x8f')][_0x26c3('0x85')]});}})[_0x26c3('0x24')](function(_0x3ea02f){if(!_0x3ea02f[_0x26c3('0x37')]){throw new db[(_0x26c3('0x69'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x179498[_0x26c3('0x90')]===_0x26c3('0x91')){return null;}var _0x2f40a9=_[_0x26c3('0x3f')](_0x179498,{'name':_0x179498[_0x26c3('0x92')]||_0x179498[_0x26c3('0x2a')]||_0x34f2ba['name'],'basename':_0x4be9ad,'savename':util[_0x26c3('0x73')]('%s-%s.%s',_0x179498[_0x26c3('0x2a')]||_0x34f2ba[_0x26c3('0x2a')],require(_0x26c3('0x93'))[_0x26c3('0x94')](0x4),_0x179498[_0x26c3('0x90')]||_0x26c3('0x95')),'reportId':_0x34f2ba['id'],'reportType':_0x26c3('0x96')});return db[_0x26c3('0x97')][_0x26c3('0x4a')](_0x2f40a9,{'raw':!![]});})[_0x26c3('0x24')](function(_0x16f736){if(_0x34f2ba[_0x26c3('0x6f')]==='cdr'){_0x52adff['where'](_0x34f2ba[_0x26c3('0x6f')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x179498[_0x26c3('0x98')],_0x179498[_0x26c3('0x99')]);}else{_0x52adff[_0x26c3('0x3c')](_0x34f2ba['table']+_0x26c3('0x9a'),_0x179498[_0x26c3('0x98')],_0x179498[_0x26c3('0x99')]);}if(_0x16f736){logger[_0x26c3('0x9b')](_0x26c3('0x9c'),_0x52adff[_0x26c3('0x83')]());require(_0x26c3('0x9d'))[_0x26c3('0x9e')](path['join'](__dirname,_0x26c3('0x9f'),_0x16f736[_0x26c3('0x90')]),[_0x16f736['id'],_0x52adff[_0x26c3('0x83')](),path[_0x26c3('0x86')](__dirname,_0x26c3('0xa0'),_0x16f736['savename']),_0x4be9ad]);return _0x16f736;}else{var _0x2d4cb2=squel[_0x26c3('0x6d')]();_0x2d4cb2['from']('('+_0x52adff[_0x26c3('0x83')]()+')','countTable');_0x2d4cb2[_0x26c3('0x70')](_0x26c3('0xa1'),_0x26c3('0x41'));_0x52adff[_0x26c3('0x1d')](_0x179498['limit']||_0x1440c9);_0x52adff[_0x26c3('0x1c')](_0x179498[_0x26c3('0x1c')]||0x0);return dbH[_0x26c3('0x84')][_0x26c3('0x34')](_0x2d4cb2[_0x26c3('0x83')](),{'type':dbH[_0x26c3('0x84')]['QueryTypes']['SELECT']})['then'](function(_0x13391a){if(!_0x13391a['length']){_0x30a5f6=0x0;}else{_0x30a5f6=_0x13391a[0x0][_0x26c3('0x41')]||0x0;}return dbH[_0x26c3('0x84')]['query'](_0x52adff['toString'](),{'type':dbH[_0x26c3('0x84')]['QueryTypes']['SELECT']});})[_0x26c3('0x24')](function(_0x30568e){return{'rows':_0x30568e||[],'count':_0x30a5f6};});}});}exports[_0x26c3('0xa2')]=function(_0x40f097,_0x1a6938){return runReport(_0x40f097[_0x26c3('0x51')],_0x40f097[_0x26c3('0x34')],_0x40f097[_0x26c3('0x67')])[_0x26c3('0x24')](respondWithResult(_0x1a6938,null))['catch'](handleError(_0x1a6938,null));};exports['runReport']=runReport;exports[_0x26c3('0x34')]=function(_0x2d51b7,_0x58a6fe){var _0x220374=0xa;var _0x3bd6e0=[_0x26c3('0x86'),_0x26c3('0x52'),_0x26c3('0x87'),_0x26c3('0x88')];var _0xd29299={'SUM':_0x26c3('0x53'),'COUNT':_0x26c3('0x54'),'COUNT DISTINCT':_0x26c3('0x55'),'MAX':_0x26c3('0x56'),'MIN':_0x26c3('0x57'),'AVG':_0x26c3('0x89'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x26c3('0x59'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3d313d={'SEC_TO_TIME':_0x26c3('0x8a'),'DATE':_0x26c3('0x5b'),'HOUR':_0x26c3('0x5c'),'ROUND':_0x26c3('0x5d'),'UNIX_TIMESTAMP':_0x26c3('0x5e')};var _0x257a0e=function(_0x5646c7){return!_[_0x26c3('0x7a')]([_0x26c3('0x5f'),'IS\x20NOT\x20NULL',_0x26c3('0x61'),_0x26c3('0x62')],_0x5646c7);};var _0x3cfffe=function(_0x39900c){if(!_0x39900c||!_0x39900c[_0x26c3('0x63')][_0x26c3('0x37')]){return'';}for(var _0x3ce4f7='(',_0x298bf4=0x0;_0x298bf4<_0x39900c[_0x26c3('0x63')][_0x26c3('0x37')];_0x298bf4+=0x1){_0x298bf4>0x0&&(_0x3ce4f7+='\x20'+_0x39900c[_0x26c3('0x64')]+'\x20');_0x3ce4f7+=_0x39900c[_0x26c3('0x63')][_0x298bf4][_0x26c3('0x80')]?_0x3cfffe(_0x39900c[_0x26c3('0x63')][_0x298bf4][_0x26c3('0x80')]):_0x39900c[_0x26c3('0x63')][_0x298bf4][_0x26c3('0x70')]+'\x20'+_0x39900c[_0x26c3('0x63')][_0x298bf4][_0x26c3('0x65')]+(_0x257a0e(_0x39900c[_0x26c3('0x63')][_0x298bf4][_0x26c3('0x65')])?'\x20'+_0x39900c[_0x26c3('0x63')][_0x298bf4]['value']:'');}return _0x3ce4f7+')';};var _0x2dc706={'where':{'id':_0x2d51b7[_0x26c3('0x51')]['id']}},_0x17a862,_0x2a0099,_0xb3c12b,_0x4d480e,_0x1ffe7c;_0x2dc706=_[_0x26c3('0x3f')]({},_0x2dc706,_0x2d51b7[_0x26c3('0x67')]);return db[_0x26c3('0x2d')][_0x26c3('0x49')](_0x2dc706)['then'](function(_0xbf826){if(_0xbf826){_0x17a862=_0xbf826;return _0xbf826['getFields']();}return null;})[_0x26c3('0x24')](function(_0x405cac){if(_0x405cac){if(!_0x405cac[_0x26c3('0x37')]){throw new db[(_0x26c3('0x69'))][(_0x26c3('0x8b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2a0099=_0x405cac;return db[_0x26c3('0x6b')][_0x26c3('0x44')]({'raw':!![]});}return null;})[_0x26c3('0x24')](function(_0x3a5d0b){if(_0x3a5d0b){_0xb3c12b=_[_0x26c3('0x6c')](_0x3a5d0b,'id');var _0x23edd0;var _0x343fc7=squel[_0x26c3('0x6d')]();_0x343fc7['from'](_0x17a862[_0x26c3('0x6f')]);for(var _0x4a0bfa=0x0;_0x4a0bfa<_0x2a0099[_0x26c3('0x37')];_0x4a0bfa+=0x1){_0x23edd0=_0x2a0099[_0x4a0bfa]['MetricId']?_0xb3c12b[_0x2a0099[_0x4a0bfa][_0x26c3('0x8c')]]['metric']:_0x2a0099[_0x4a0bfa]['field'];_0x23edd0=_0x2a0099[_0x4a0bfa][_0x26c3('0x71')]?_[_0x26c3('0x72')](_0xd29299[_0x2a0099[_0x4a0bfa][_0x26c3('0x71')]],'%s',_0x23edd0):_0x23edd0;_0x23edd0=_0x2a0099[_0x4a0bfa][_0x26c3('0x73')]?_[_0x26c3('0x72')](_0x3d313d[_0x2a0099[_0x4a0bfa][_0x26c3('0x73')]],'%s',_0x23edd0):_0x23edd0;if(_0x2a0099[_0x4a0bfa]['groupBy']){_0x343fc7[_0x26c3('0x80')](_0x23edd0);}_0x2a0099[_0x4a0bfa][_0x26c3('0x75')]&&_0x343fc7[_0x26c3('0x3a')](_0x23edd0,_0x2a0099[_0x4a0bfa]['orderBy']===_0x26c3('0x76')?![]:!![]);_0x343fc7[_0x26c3('0x70')](_0x23edd0,_0x2a0099[_0x4a0bfa][_0x26c3('0x77')]||_0x23edd0);}if(_0x17a862[_0x26c3('0x78')]){_0x17a862[_0x26c3('0x78')]=JSON[_0x26c3('0x79')](_0x17a862[_0x26c3('0x78')]);for(var _0x5b201a=0x0;_0x5b201a<_0x17a862['joins'][_0x26c3('0x37')];_0x5b201a+=0x1){if(_0x17a862['joins'][_0x5b201a]['type']&&_[_0x26c3('0x7a')](_0x3bd6e0,_0x17a862[_0x26c3('0x78')][_0x5b201a][_0x26c3('0x30')])&&_0x17a862[_0x26c3('0x78')][_0x5b201a][_0x26c3('0x7b')]&&_0x17a862[_0x26c3('0x78')][_0x5b201a][_0x26c3('0x7c')]&&_0x17a862['joins'][_0x5b201a][_0x26c3('0x7d')]){_0x343fc7[_0x17a862['joins'][_0x5b201a][_0x26c3('0x30')]](_0x17a862[_0x26c3('0x78')][_0x5b201a]['foreignTable'],null,util[_0x26c3('0x73')](_0x26c3('0x7e'),_0x17a862[_0x26c3('0x6f')],_0x17a862[_0x26c3('0x78')][_0x5b201a][_0x26c3('0x7b')],_0x17a862[_0x26c3('0x78')][_0x5b201a][_0x26c3('0x7c')],_0x17a862[_0x26c3('0x78')][_0x5b201a][_0x26c3('0x7d')]));}}}if(_0x17a862[_0x26c3('0x7f')]){_0x17a862[_0x26c3('0x7f')]=JSON[_0x26c3('0x79')](_0x17a862[_0x26c3('0x7f')]);_0x343fc7['where'](_0x3cfffe(_0x17a862['conditions'][_0x26c3('0x80')]));}_0x1ffe7c=_0x343fc7[_0x26c3('0x8e')]();_0x343fc7['limit'](_0x220374);_0x343fc7[_0x26c3('0x1c')](0x0);logger[_0x26c3('0x81')](_0x26c3('0x82'),_0x343fc7[_0x26c3('0x83')]());return db[_0x26c3('0x84')]['query'](_0x343fc7['toString'](),{'type':db['sequelize'][_0x26c3('0x8f')][_0x26c3('0x85')]});}})['then'](function(){return{'sql':_0x1ffe7c['toString']()};})['then'](respondWithResult(_0x58a6fe,null))['catch'](handleError(_0x58a6fe,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 02ba5c1..09057d4 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 _0x5279=['../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x99b186,_0x1c58bf){var _0x1ba9f5=function(_0xe02465){while(--_0xe02465){_0x99b186['push'](_0x99b186['shift']());}};_0x1ba9f5(++_0x1c58bf);}(_0x5279,0xa1));var _0x9527=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x5279[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x9527('0x0'));var util=require(_0x9527('0x1'));var logger=require(_0x9527('0x2'))(_0x9527('0x3'));var moment=require(_0x9527('0x4'));var BPromise=require('bluebird');var rp=require(_0x9527('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9527('0x6'));var config=require(_0x9527('0x7'));var attributes=require(_0x9527('0x8'));module[_0x9527('0x9')]=function(_0x19bfa9,_0xbaac4f){return _0x19bfa9[_0x9527('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x9527('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b91=['moment','bluebird','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api'];(function(_0x206aa9,_0xbeebd2){var _0x1237ec=function(_0x966df){while(--_0x966df){_0x206aa9['push'](_0x206aa9['shift']());}};_0x1237ec(++_0xbeebd2);}(_0x5b91,0x128));var _0x15b9=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x5b91[_0x1bb58c];return _0x277586;};'use strict';var _=require(_0x15b9('0x0'));var util=require(_0x15b9('0x1'));var logger=require(_0x15b9('0x2'))(_0x15b9('0x3'));var moment=require(_0x15b9('0x4'));var BPromise=require(_0x15b9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x15b9('0x6'));var config=require(_0x15b9('0x7'));var attributes=require(_0x15b9('0x8'));module[_0x15b9('0x9')]=function(_0x49ebb3,_0x24009b){return _0x49ebb3['define'](_0x15b9('0xa'),attributes,{'tableName':_0x15b9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 2d09255..a94b64d 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 _0x18e0=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0x18e0,0xa2));var _0x018e=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x18e0[_0x47aa64];return _0x549c7a;};'use strict';var _=require('lodash');var util=require(_0x018e('0x0'));var moment=require('moment');var BPromise=require(_0x018e('0x1'));var rs=require(_0x018e('0x2'));var fs=require('fs');var Redis=require(_0x018e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x018e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x018e('0x5'));var jayson=require(_0x018e('0x6'));var client=jayson[_0x018e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b6638,_0x36aac8,_0x24e838){return new BPromise(function(_0x5b2267,_0xfc4a7b){return client[_0x018e('0x8')](_0x5b6638,_0x24e838)[_0x018e('0x9')](function(_0x3c1a1b){logger[_0x018e('0xa')](_0x018e('0xb'),_0x36aac8,'request\x20sent');logger[_0x018e('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x36aac8,'request\x20sent',JSON['stringify'](_0x3c1a1b));if(_0x3c1a1b[_0x018e('0xd')]){if(_0x3c1a1b[_0x018e('0xd')][_0x018e('0xe')]===0x1f4){logger[_0x018e('0xd')](_0x018e('0xb'),_0x36aac8,_0x3c1a1b[_0x018e('0xd')][_0x018e('0xf')]);return _0xfc4a7b(_0x3c1a1b[_0x018e('0xd')][_0x018e('0xf')]);}logger['error'](_0x018e('0xb'),_0x36aac8,_0x3c1a1b[_0x018e('0xd')][_0x018e('0xf')]);return _0x5b2267(_0x3c1a1b[_0x018e('0xd')][_0x018e('0xf')]);}else{logger['info'](_0x018e('0xb'),_0x36aac8,_0x018e('0x10'));_0x5b2267(_0x3c1a1b[_0x018e('0x11')][_0x018e('0xf')]);}})['catch'](function(_0x1949f4){logger[_0x018e('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x36aac8,_0x1949f4);_0xfc4a7b(_0x1949f4);});});} \ No newline at end of file +var _0x6146=['then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','AnalyticDefaultReport,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xeb3a3c,_0x1385db){var _0x206d22=function(_0x43494c){while(--_0x43494c){_0xeb3a3c['push'](_0xeb3a3c['shift']());}};_0x206d22(++_0x1385db);}(_0x6146,0xba));var _0x6614=function(_0x7815cd,_0x430226){_0x7815cd=_0x7815cd-0x0;var _0x3f47d5=_0x6146[_0x7815cd];return _0x3f47d5;};'use strict';var _=require(_0x6614('0x0'));var util=require('util');var moment=require(_0x6614('0x1'));var BPromise=require(_0x6614('0x2'));var rs=require(_0x6614('0x3'));var fs=require('fs');var Redis=require(_0x6614('0x4'));var db=require(_0x6614('0x5'))['db'];var utils=require(_0x6614('0x6'));var logger=require(_0x6614('0x7'))('rpc');var config=require(_0x6614('0x8'));var jayson=require(_0x6614('0x9'));var client=jayson[_0x6614('0xa')][_0x6614('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b158b,_0x2e84fa,_0x4116e4){return new BPromise(function(_0x209bdd,_0x9bf15){return client['request'](_0x3b158b,_0x4116e4)[_0x6614('0xc')](function(_0x267e1b){logger[_0x6614('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2e84fa,_0x6614('0xe'));logger[_0x6614('0xf')](_0x6614('0x10'),_0x2e84fa,_0x6614('0xe'),JSON[_0x6614('0x11')](_0x267e1b));if(_0x267e1b[_0x6614('0x12')]){if(_0x267e1b[_0x6614('0x12')]['code']===0x1f4){logger[_0x6614('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2e84fa,_0x267e1b[_0x6614('0x12')][_0x6614('0x13')]);return _0x9bf15(_0x267e1b[_0x6614('0x12')][_0x6614('0x13')]);}logger[_0x6614('0x12')](_0x6614('0x14'),_0x2e84fa,_0x267e1b[_0x6614('0x12')][_0x6614('0x13')]);return _0x209bdd(_0x267e1b[_0x6614('0x12')]['message']);}else{logger['info'](_0x6614('0x14'),_0x2e84fa,_0x6614('0xe'));_0x209bdd(_0x267e1b['result'][_0x6614('0x13')]);}})[_0x6614('0x15')](function(_0x3a0fee){logger['error'](_0x6614('0x14'),_0x2e84fa,_0x3a0fee);_0x9bf15(_0x3a0fee);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 080227e..70ecb6c 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 _0xb95f=['/:id/run','run','/:id/query','query','create','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb95f,0xc1));var _0xfb95=function(_0x498885,_0x4f50ab){_0x498885=_0x498885-0x0;var _0x17a28d=_0xb95f[_0x498885];return _0x17a28d;};'use strict';var multer=require(_0xfb95('0x0'));var util=require(_0xfb95('0x1'));var path=require('path');var timeout=require(_0xfb95('0x2'));var express=require(_0xfb95('0x3'));var router=express['Router']();var auth=require(_0xfb95('0x4'));var interaction=require(_0xfb95('0x5'));var config=require(_0xfb95('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0xfb95('0x7')]('/',auth[_0xfb95('0x8')](),controller[_0xfb95('0x9')]);router[_0xfb95('0x7')](_0xfb95('0xa'),auth['isAuthenticated'](),controller[_0xfb95('0xb')]);router[_0xfb95('0x7')](_0xfb95('0xc'),auth[_0xfb95('0x8')](),controller[_0xfb95('0xd')]);router[_0xfb95('0x7')](_0xfb95('0xe'),auth[_0xfb95('0x8')](),controller[_0xfb95('0xf')]);router['get'](_0xfb95('0x10'),auth[_0xfb95('0x8')](),controller[_0xfb95('0x11')]);router['post']('/',auth[_0xfb95('0x8')](),controller[_0xfb95('0x12')]);router[_0xfb95('0x13')](_0xfb95('0xa'),auth[_0xfb95('0x8')](),controller[_0xfb95('0x14')]);router[_0xfb95('0x15')](_0xfb95('0xa'),auth[_0xfb95('0x8')](),controller['destroy']);module[_0xfb95('0x16')]=router; \ No newline at end of file +var _0x43c3=['/:id/query','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview'];(function(_0x5e069d,_0x55f592){var _0x21250a=function(_0x825db3){while(--_0x825db3){_0x5e069d['push'](_0x5e069d['shift']());}};_0x21250a(++_0x55f592);}(_0x43c3,0xa0));var _0x343c=function(_0x3cb1f8,_0x306d54){_0x3cb1f8=_0x3cb1f8-0x0;var _0x3bcb20=_0x43c3[_0x3cb1f8];return _0x3bcb20;};'use strict';var multer=require(_0x343c('0x0'));var util=require(_0x343c('0x1'));var path=require(_0x343c('0x2'));var timeout=require(_0x343c('0x3'));var express=require(_0x343c('0x4'));var router=express[_0x343c('0x5')]();var auth=require(_0x343c('0x6'));var interaction=require(_0x343c('0x7'));var config=require(_0x343c('0x8'));var controller=require(_0x343c('0x9'));router[_0x343c('0xa')]('/',auth[_0x343c('0xb')](),controller[_0x343c('0xc')]);router[_0x343c('0xa')](_0x343c('0xd'),auth['isAuthenticated'](),controller[_0x343c('0xe')]);router[_0x343c('0xa')](_0x343c('0xf'),auth[_0x343c('0xb')](),controller['preview']);router[_0x343c('0xa')]('/:id/run',auth[_0x343c('0xb')](),controller['run']);router[_0x343c('0xa')](_0x343c('0x10'),auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0x343c('0xb')](),controller[_0x343c('0x11')]);router[_0x343c('0x12')](_0x343c('0xd'),auth[_0x343c('0xb')](),controller[_0x343c('0x13')]);router['delete'](_0x343c('0xd'),auth['isAuthenticated'](),controller[_0x343c('0x14')]);module[_0x343c('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 73bee64..71d798f 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 _0x39dd=['INTEGER','UNSIGNED','sequelize','moment','ENUM','csv','xlsx','STRING','DATE','Loading','manual','scheduled'];(function(_0x1843f6,_0x90fe65){var _0x12c2e6=function(_0x18ce60){while(--_0x18ce60){_0x1843f6['push'](_0x1843f6['shift']());}};_0x12c2e6(++_0x90fe65);}(_0x39dd,0x1ca));var _0xd39d=function(_0x5a5595,_0x145fa0){_0x5a5595=_0x5a5595-0x0;var _0x43809d=_0x39dd[_0x5a5595];return _0x43809d;};'use strict';var Sequelize=require(_0xd39d('0x0'));var moment=require(_0xd39d('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xd39d('0x2')](_0xd39d('0x3'),'pdf',_0xd39d('0x4')),'allowNull':![],'defaultValue':_0xd39d('0x3')},'savename':{'type':Sequelize[_0xd39d('0x5')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd39d('0x6')]},'endDate':{'type':Sequelize[_0xd39d('0x6')]},'status':{'type':Sequelize[_0xd39d('0x5')],'defaultValue':_0xd39d('0x7')},'type':{'type':Sequelize['ENUM'](_0xd39d('0x8'),_0xd39d('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xd39d('0xa')](0xb)[_0xd39d('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x113e=['moment','exports','STRING','pdf','xlsx','csv','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize'];(function(_0x3882ac,_0x42fe8e){var _0x170820=function(_0x5d76b6){while(--_0x5d76b6){_0x3882ac['push'](_0x3882ac['shift']());}};_0x170820(++_0x42fe8e);}(_0x113e,0x113));var _0xe113=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x113e[_0x58e469];return _0x4c01c5;};'use strict';var Sequelize=require(_0xe113('0x0'));var moment=require(_0xe113('0x1'));module[_0xe113('0x2')]={'name':{'type':Sequelize[_0xe113('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xe113('0x4'),_0xe113('0x5')),'allowNull':![],'defaultValue':_0xe113('0x6')},'savename':{'type':Sequelize[_0xe113('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xe113('0x3')],'defaultValue':_0xe113('0x7')},'type':{'type':Sequelize[_0xe113('0x8')](_0xe113('0x9'),_0xe113('0xa')),'allowNull':![],'defaultValue':_0xe113('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xe113('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 196341a..922fef0 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 _0x3ad8=['order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','find','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','update','params','download','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','get','ExtractedReports','UserProfileResource','destroy','then','stack','name','send','map','AnalyticExtractedReport','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x56ffb6,_0x27eab6){var _0x40b63=function(_0x201567){while(--_0x201567){_0x56ffb6['push'](_0x56ffb6['shift']());}};_0x40b63(++_0x27eab6);}(_0x3ad8,0x145));var _0x83ad=function(_0x193905,_0x4d9ac2){_0x193905=_0x193905-0x0;var _0x6c21cb=_0x3ad8[_0x193905];return _0x6c21cb;};'use strict';var pdf=require(_0x83ad('0x0'));var emlformat=require(_0x83ad('0x1'));var rimraf=require(_0x83ad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83ad('0x3'));var rp=require('request-promise');var moment=require(_0x83ad('0x4'));var BPromise=require(_0x83ad('0x5'));var Mustache=require(_0x83ad('0x6'));var util=require('util');var path=require(_0x83ad('0x7'));var sox=require(_0x83ad('0x8'));var csv=require(_0x83ad('0x9'));var ejs=require(_0x83ad('0xa'));var fs=require('fs');var _=require(_0x83ad('0xb'));var squel=require('squel');var crypto=require(_0x83ad('0xc'));var jsforce=require(_0x83ad('0xd'));var deskjs=require(_0x83ad('0xe'));var toCsv=require(_0x83ad('0x9'));var querystring=require(_0x83ad('0xf'));var Papa=require(_0x83ad('0x10'));var Redis=require(_0x83ad('0x11'));var authService=require(_0x83ad('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83ad('0x13'));var logger=require(_0x83ad('0x14'))(_0x83ad('0x15'));var utils=require(_0x83ad('0x16'));var config=require(_0x83ad('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x83ad('0x18'))['db'];function respondWithStatusCode(_0x354068,_0x11aaf7){_0x11aaf7=_0x11aaf7||0xcc;return function(_0x1a346b){if(_0x1a346b){return _0x354068[_0x83ad('0x19')](_0x11aaf7);}return _0x354068['status'](_0x11aaf7)[_0x83ad('0x1a')]();};}function respondWithResult(_0x361a29,_0x400946){_0x400946=_0x400946||0xc8;return function(_0x353d48){if(_0x353d48){return _0x361a29[_0x83ad('0x1b')](_0x400946)[_0x83ad('0x1c')](_0x353d48);}};}function respondWithFilteredResult(_0x122756,_0x54939a){return function(_0x5c84ec){if(_0x5c84ec){var _0x338bcd=_0x5c84ec[_0x83ad('0x1d')],_0x378ce3=_0x54939a[_0x83ad('0x1e')],_0x2a5cc2=_0x54939a['offset']+_0x54939a[_0x83ad('0x1f')],_0x3f5396;if(_0x2a5cc2>=_0x338bcd){_0x2a5cc2=_0x338bcd;_0x3f5396=0xc8;}else{_0x3f5396=0xce;}_0x122756['status'](_0x3f5396);return _0x122756['set'](_0x83ad('0x20'),_0x378ce3+'-'+_0x2a5cc2+'/'+_0x338bcd)[_0x83ad('0x1c')](_0x5c84ec);}return null;};}function patchUpdates(_0x36d507){return function(_0xe96e56){try{jsonpatch['apply'](_0xe96e56,_0x36d507,!![]);}catch(_0x3509a8){return BPromise['reject'](_0x3509a8);}return _0xe96e56['save']();};}function saveUpdates(_0x3be3f5,_0x1e33fd){return function(_0x5ea63d){if(_0x5ea63d){return _0x5ea63d['update'](_0x3be3f5)['then'](function(_0x490a52){return _0x490a52;});}return null;};}function removeEntity(_0x54d1f0,_0x31ee7e){return function(_0x23654c){if(_0x23654c){return _0x23654c['destroy']()['then'](function(){var _0x55ce50=_0x23654c[_0x83ad('0x21')]({'plain':!![]});var _0x5662f0=_0x83ad('0x22');return db[_0x83ad('0x23')][_0x83ad('0x24')]({'where':{'type':_0x5662f0,'resourceId':_0x55ce50['id']}})[_0x83ad('0x25')](function(){return _0x23654c;});})[_0x83ad('0x25')](function(){_0x54d1f0[_0x83ad('0x1b')](0xcc)[_0x83ad('0x1a')]();});}};}function handleEntityNotFound(_0x41c85c,_0x25e453){return function(_0x21089d){if(!_0x21089d){_0x41c85c['sendStatus'](0x194);}return _0x21089d;};}function handleError(_0x28f421,_0x75cc12){_0x75cc12=_0x75cc12||0x1f4;return function(_0x2c8f21){logger['error'](_0x2c8f21[_0x83ad('0x26')]);if(_0x2c8f21['name']){delete _0x2c8f21[_0x83ad('0x27')];}_0x28f421[_0x83ad('0x1b')](_0x75cc12)[_0x83ad('0x28')](_0x2c8f21);};}exports['index']=function(_0x24245e,_0x5c9eda){var _0x1a9ffd={},_0xd396c5={},_0x274067={'count':0x0,'rows':[]};var _0x1cf0eb=_[_0x83ad('0x29')](db[_0x83ad('0x2a')]['rawAttributes'],function(_0x272ab){return{'name':_0x272ab[_0x83ad('0x2b')],'type':_0x272ab[_0x83ad('0x2c')]['key']};});_0xd396c5[_0x83ad('0x2d')]=_[_0x83ad('0x29')](_0x1cf0eb,'name');_0xd396c5[_0x83ad('0x2e')]=_[_0x83ad('0x2f')](_0x24245e['query']);_0xd396c5[_0x83ad('0x30')]=_['intersection'](_0xd396c5['model'],_0xd396c5[_0x83ad('0x2e')]);_0x1a9ffd[_0x83ad('0x31')]=_[_0x83ad('0x32')](_0xd396c5[_0x83ad('0x2d')],qs[_0x83ad('0x33')](_0x24245e['query']['fields']));_0x1a9ffd[_0x83ad('0x31')]=_0x1a9ffd[_0x83ad('0x31')][_0x83ad('0x34')]?_0x1a9ffd[_0x83ad('0x31')]:_0xd396c5[_0x83ad('0x2d')];if(!_0x24245e[_0x83ad('0x2e')][_0x83ad('0x35')](_0x83ad('0x36'))){_0x1a9ffd[_0x83ad('0x1f')]=qs['limit'](_0x24245e[_0x83ad('0x2e')][_0x83ad('0x1f')]);_0x1a9ffd[_0x83ad('0x1e')]=qs[_0x83ad('0x1e')](_0x24245e['query'][_0x83ad('0x1e')]);}_0x1a9ffd[_0x83ad('0x37')]=qs[_0x83ad('0x38')](_0x24245e[_0x83ad('0x2e')]['sort']);_0x1a9ffd[_0x83ad('0x39')]=qs['filters'](_[_0x83ad('0x3a')](_0x24245e[_0x83ad('0x2e')],_0xd396c5[_0x83ad('0x30')]),_0x1cf0eb);if(_0x24245e[_0x83ad('0x2e')][_0x83ad('0x3b')]){_0x1a9ffd[_0x83ad('0x39')]=_['merge'](_0x1a9ffd[_0x83ad('0x39')],{'$or':_['map'](_0x1cf0eb,function(_0x34c595){if(_0x34c595['type']!=='VIRTUAL'){var _0x318665={};_0x318665[_0x34c595[_0x83ad('0x27')]]={'$like':'%'+_0x24245e[_0x83ad('0x2e')][_0x83ad('0x3b')]+'%'};return _0x318665;}})});}_0x1a9ffd=_[_0x83ad('0x3c')]({},_0x1a9ffd,_0x24245e[_0x83ad('0x3d')]);var _0x1b6e0c={'where':_0x1a9ffd[_0x83ad('0x39')]};return db[_0x83ad('0x2a')][_0x83ad('0x1d')](_0x1b6e0c)[_0x83ad('0x25')](function(_0x2c556c){_0x274067[_0x83ad('0x1d')]=_0x2c556c;if(_0x24245e[_0x83ad('0x2e')][_0x83ad('0x3e')]){_0x1a9ffd[_0x83ad('0x3f')]=[{'all':!![]}];}return db[_0x83ad('0x2a')][_0x83ad('0x40')](_0x1a9ffd);})['then'](function(_0x468868){_0x274067[_0x83ad('0x41')]=_0x468868;return _0x274067;})[_0x83ad('0x25')](respondWithFilteredResult(_0x5c9eda,_0x1a9ffd))[_0x83ad('0x42')](handleError(_0x5c9eda,null));};exports['show']=function(_0x814e75,_0xff36b3){var _0x3de78f={'raw':!![],'where':{'id':_0x814e75['params']['id']}},_0x307ddd={};_0x307ddd[_0x83ad('0x2d')]=_[_0x83ad('0x2f')](db[_0x83ad('0x2a')][_0x83ad('0x43')]);_0x307ddd[_0x83ad('0x2e')]=_[_0x83ad('0x2f')](_0x814e75[_0x83ad('0x2e')]);_0x307ddd[_0x83ad('0x30')]=_[_0x83ad('0x32')](_0x307ddd[_0x83ad('0x2d')],_0x307ddd[_0x83ad('0x2e')]);_0x3de78f[_0x83ad('0x31')]=_[_0x83ad('0x32')](_0x307ddd['model'],qs[_0x83ad('0x33')](_0x814e75[_0x83ad('0x2e')][_0x83ad('0x33')]));_0x3de78f[_0x83ad('0x31')]=_0x3de78f['attributes'][_0x83ad('0x34')]?_0x3de78f['attributes']:_0x307ddd['model'];if(_0x814e75[_0x83ad('0x2e')][_0x83ad('0x3e')]){_0x3de78f[_0x83ad('0x3f')]=[{'all':!![]}];}_0x3de78f=_['merge']({},_0x3de78f,_0x814e75[_0x83ad('0x3d')]);return db[_0x83ad('0x2a')][_0x83ad('0x44')](_0x3de78f)[_0x83ad('0x25')](handleEntityNotFound(_0xff36b3,null))[_0x83ad('0x25')](respondWithResult(_0xff36b3,null))[_0x83ad('0x42')](handleError(_0xff36b3,null));};exports['create']=function(_0x10c93c,_0x1596e1){return db[_0x83ad('0x2a')][_0x83ad('0x45')](_0x10c93c[_0x83ad('0x46')],{})['then'](function(_0x45989d){var _0x1e7c0f=_0x10c93c[_0x83ad('0x47')][_0x83ad('0x21')]({'plain':!![]});if(!_0x1e7c0f)throw new Error(_0x83ad('0x48'));if(_0x1e7c0f[_0x83ad('0x49')]===_0x83ad('0x47')){var _0x7fb5b5=_0x45989d['get']({'plain':!![]});var _0x19e327=_0x83ad('0x22');return db[_0x83ad('0x4a')]['find']({'where':{'name':_0x19e327,'userProfileId':_0x1e7c0f[_0x83ad('0x4b')]},'raw':!![]})[_0x83ad('0x25')](function(_0x5be7dd){if(_0x5be7dd&&_0x5be7dd[_0x83ad('0x4c')]===0x0){return db[_0x83ad('0x23')][_0x83ad('0x45')]({'name':_0x7fb5b5[_0x83ad('0x27')],'resourceId':_0x7fb5b5['id'],'type':_0x5be7dd['name'],'sectionId':_0x5be7dd['id']},{})[_0x83ad('0x25')](function(){return _0x45989d;});}else{return _0x45989d;}})[_0x83ad('0x42')](function(_0x2d1e5b){logger[_0x83ad('0x4d')](_0x83ad('0x4e'),_0x2d1e5b);throw _0x2d1e5b;});}return _0x45989d;})[_0x83ad('0x25')](respondWithResult(_0x1596e1,0xc9))[_0x83ad('0x42')](handleError(_0x1596e1,null));};exports[_0x83ad('0x4f')]=function(_0x15a880,_0x432e83){if(_0x15a880[_0x83ad('0x46')]['id']){delete _0x15a880[_0x83ad('0x46')]['id'];}return db[_0x83ad('0x2a')][_0x83ad('0x44')]({'where':{'id':_0x15a880['params']['id']}})[_0x83ad('0x25')](handleEntityNotFound(_0x432e83,null))[_0x83ad('0x25')](saveUpdates(_0x15a880[_0x83ad('0x46')],null))['then'](respondWithResult(_0x432e83,null))[_0x83ad('0x42')](handleError(_0x432e83,null));};exports[_0x83ad('0x24')]=function(_0x3ec26b,_0x321531){return db[_0x83ad('0x2a')][_0x83ad('0x44')]({'where':{'id':_0x3ec26b[_0x83ad('0x50')]['id']}})['then'](handleEntityNotFound(_0x321531,null))[_0x83ad('0x25')](removeEntity(_0x321531,null))['catch'](handleError(_0x321531,null));};exports[_0x83ad('0x51')]=function(_0x4fc1ca,_0x34043e,_0x4454d3){return db[_0x83ad('0x2a')]['find']({'where':{'id':_0x4fc1ca[_0x83ad('0x50')]['id']},'attributes':[_0x83ad('0x27'),'basename',_0x83ad('0x52'),_0x83ad('0x53')],'raw':!![]})[_0x83ad('0x25')](handleEntityNotFound(_0x34043e,null))[_0x83ad('0x25')](function(_0x2e7e71){if(_0x2e7e71){if(!fs[_0x83ad('0x54')](path[_0x83ad('0x55')](config[_0x83ad('0x56')],_0x83ad('0x57'),_0x2e7e71['savename']))){throw new db['Sequelize'][(_0x83ad('0x58'))](_0x83ad('0x59'));}if(_0x4fc1ca[_0x83ad('0x2e')][_0x83ad('0x5a')]){return _0x34043e[_0x83ad('0x19')](0xc8);}return _0x34043e['download'](path[_0x83ad('0x55')](config['root'],_0x83ad('0x57'),_0x2e7e71[_0x83ad('0x52')]),util[_0x83ad('0x5b')](_0x83ad('0x5c'),_0x2e7e71[_0x83ad('0x5d')]||_0x2e7e71[_0x83ad('0x27')],_0x2e7e71['output'][_0x83ad('0x5e')]()));}})[_0x83ad('0x42')](handleError(_0x34043e,null));}; \ No newline at end of file +var _0xf8b1=['then','destroy','UserProfileResource','end','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','savename','output','existsSync','join','server/files/reports','Sequelize','exists','root','format','%s.%s','basename','toLowerCase','html-pdf','rimraf','request-promise','bluebird','mustache','sox','ejs','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x4ecd60,_0x142e11){var _0x29e598=function(_0x2478e0){while(--_0x2478e0){_0x4ecd60['push'](_0x4ecd60['shift']());}};_0x29e598(++_0x142e11);}(_0xf8b1,0x1ac));var _0x1f8b=function(_0x336dbd,_0x21b342){_0x336dbd=_0x336dbd-0x0;var _0x5bcb06=_0xf8b1[_0x336dbd];return _0x5bcb06;};'use strict';var pdf=require(_0x1f8b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1f8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1f8b('0x2'));var moment=require('moment');var BPromise=require(_0x1f8b('0x3'));var Mustache=require(_0x1f8b('0x4'));var util=require('util');var path=require('path');var sox=require(_0x1f8b('0x5'));var csv=require('to-csv');var ejs=require(_0x1f8b('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f8b('0x7'));var jsforce=require(_0x1f8b('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x1f8b('0x9'));var querystring=require(_0x1f8b('0xa'));var Papa=require(_0x1f8b('0xb'));var Redis=require('ioredis');var authService=require(_0x1f8b('0xc'));var qs=require(_0x1f8b('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f8b('0xe'));var logger=require('../../config/logger')(_0x1f8b('0xf'));var utils=require(_0x1f8b('0x10'));var config=require(_0x1f8b('0x11'));var licenseUtil=require(_0x1f8b('0x12'));var db=require(_0x1f8b('0x13'))['db'];function respondWithStatusCode(_0x36af5d,_0x3d39b1){_0x3d39b1=_0x3d39b1||0xcc;return function(_0x2a11f4){if(_0x2a11f4){return _0x36af5d[_0x1f8b('0x14')](_0x3d39b1);}return _0x36af5d[_0x1f8b('0x15')](_0x3d39b1)['end']();};}function respondWithResult(_0x57a6ef,_0x253f14){_0x253f14=_0x253f14||0xc8;return function(_0x1473fe){if(_0x1473fe){return _0x57a6ef[_0x1f8b('0x15')](_0x253f14)[_0x1f8b('0x16')](_0x1473fe);}};}function respondWithFilteredResult(_0x16a11d,_0x1bea01){return function(_0x53c0c9){if(_0x53c0c9){var _0x12d150=_0x53c0c9[_0x1f8b('0x17')],_0x58436b=_0x1bea01[_0x1f8b('0x18')],_0x51a05e=_0x1bea01[_0x1f8b('0x18')]+_0x1bea01[_0x1f8b('0x19')],_0x5cdd7d;if(_0x51a05e>=_0x12d150){_0x51a05e=_0x12d150;_0x5cdd7d=0xc8;}else{_0x5cdd7d=0xce;}_0x16a11d['status'](_0x5cdd7d);return _0x16a11d[_0x1f8b('0x1a')](_0x1f8b('0x1b'),_0x58436b+'-'+_0x51a05e+'/'+_0x12d150)[_0x1f8b('0x16')](_0x53c0c9);}return null;};}function patchUpdates(_0x2d7b19){return function(_0x58f68d){try{jsonpatch[_0x1f8b('0x1c')](_0x58f68d,_0x2d7b19,!![]);}catch(_0x24819a){return BPromise[_0x1f8b('0x1d')](_0x24819a);}return _0x58f68d[_0x1f8b('0x1e')]();};}function saveUpdates(_0x21bc20,_0x1c255a){return function(_0x39f937){if(_0x39f937){return _0x39f937[_0x1f8b('0x1f')](_0x21bc20)[_0x1f8b('0x20')](function(_0x32f3b4){return _0x32f3b4;});}return null;};}function removeEntity(_0x97c36b,_0x2ed10d){return function(_0x4973a5){if(_0x4973a5){return _0x4973a5[_0x1f8b('0x21')]()[_0x1f8b('0x20')](function(){var _0x3e719c=_0x4973a5['get']({'plain':!![]});var _0x5bde8='ExtractedReports';return db[_0x1f8b('0x22')][_0x1f8b('0x21')]({'where':{'type':_0x5bde8,'resourceId':_0x3e719c['id']}})[_0x1f8b('0x20')](function(){return _0x4973a5;});})[_0x1f8b('0x20')](function(){_0x97c36b[_0x1f8b('0x15')](0xcc)[_0x1f8b('0x23')]();});}};}function handleEntityNotFound(_0x15935b,_0xeb921){return function(_0x16539e){if(!_0x16539e){_0x15935b[_0x1f8b('0x14')](0x194);}return _0x16539e;};}function handleError(_0x215836,_0x5f4f8d){_0x5f4f8d=_0x5f4f8d||0x1f4;return function(_0x409f72){logger[_0x1f8b('0x24')](_0x409f72[_0x1f8b('0x25')]);if(_0x409f72[_0x1f8b('0x26')]){delete _0x409f72[_0x1f8b('0x26')];}_0x215836[_0x1f8b('0x15')](_0x5f4f8d)[_0x1f8b('0x27')](_0x409f72);};}exports[_0x1f8b('0x28')]=function(_0x127368,_0x4b04b9){var _0x5907ed={},_0x3ffb46={},_0x14130e={'count':0x0,'rows':[]};var _0x4a4304=_[_0x1f8b('0x29')](db[_0x1f8b('0x2a')][_0x1f8b('0x2b')],function(_0x4c749a){return{'name':_0x4c749a['fieldName'],'type':_0x4c749a[_0x1f8b('0x2c')][_0x1f8b('0x2d')]};});_0x3ffb46['model']=_['map'](_0x4a4304,_0x1f8b('0x26'));_0x3ffb46[_0x1f8b('0x2e')]=_[_0x1f8b('0x2f')](_0x127368[_0x1f8b('0x2e')]);_0x3ffb46[_0x1f8b('0x30')]=_[_0x1f8b('0x31')](_0x3ffb46[_0x1f8b('0x32')],_0x3ffb46['query']);_0x5907ed['attributes']=_[_0x1f8b('0x31')](_0x3ffb46['model'],qs[_0x1f8b('0x33')](_0x127368[_0x1f8b('0x2e')]['fields']));_0x5907ed[_0x1f8b('0x34')]=_0x5907ed[_0x1f8b('0x34')][_0x1f8b('0x35')]?_0x5907ed[_0x1f8b('0x34')]:_0x3ffb46[_0x1f8b('0x32')];if(!_0x127368[_0x1f8b('0x2e')][_0x1f8b('0x36')](_0x1f8b('0x37'))){_0x5907ed[_0x1f8b('0x19')]=qs[_0x1f8b('0x19')](_0x127368[_0x1f8b('0x2e')]['limit']);_0x5907ed[_0x1f8b('0x18')]=qs[_0x1f8b('0x18')](_0x127368[_0x1f8b('0x2e')][_0x1f8b('0x18')]);}_0x5907ed[_0x1f8b('0x38')]=qs['sort'](_0x127368[_0x1f8b('0x2e')][_0x1f8b('0x39')]);_0x5907ed[_0x1f8b('0x3a')]=qs[_0x1f8b('0x30')](_[_0x1f8b('0x3b')](_0x127368['query'],_0x3ffb46[_0x1f8b('0x30')]),_0x4a4304);if(_0x127368['query'][_0x1f8b('0x3c')]){_0x5907ed[_0x1f8b('0x3a')]=_[_0x1f8b('0x3d')](_0x5907ed['where'],{'$or':_['map'](_0x4a4304,function(_0x342508){if(_0x342508[_0x1f8b('0x2c')]!==_0x1f8b('0x3e')){var _0x2e831f={};_0x2e831f[_0x342508[_0x1f8b('0x26')]]={'$like':'%'+_0x127368[_0x1f8b('0x2e')][_0x1f8b('0x3c')]+'%'};return _0x2e831f;}})});}_0x5907ed=_[_0x1f8b('0x3d')]({},_0x5907ed,_0x127368[_0x1f8b('0x3f')]);var _0x258f33={'where':_0x5907ed[_0x1f8b('0x3a')]};return db[_0x1f8b('0x2a')][_0x1f8b('0x17')](_0x258f33)[_0x1f8b('0x20')](function(_0x188f61){_0x14130e[_0x1f8b('0x17')]=_0x188f61;if(_0x127368['query'][_0x1f8b('0x40')]){_0x5907ed[_0x1f8b('0x41')]=[{'all':!![]}];}return db[_0x1f8b('0x2a')]['findAll'](_0x5907ed);})['then'](function(_0x162642){_0x14130e[_0x1f8b('0x42')]=_0x162642;return _0x14130e;})[_0x1f8b('0x20')](respondWithFilteredResult(_0x4b04b9,_0x5907ed))[_0x1f8b('0x43')](handleError(_0x4b04b9,null));};exports[_0x1f8b('0x44')]=function(_0x28b43c,_0x236f39){var _0x4103c3={'raw':!![],'where':{'id':_0x28b43c[_0x1f8b('0x45')]['id']}},_0x277dc6={};_0x277dc6['model']=_[_0x1f8b('0x2f')](db['AnalyticExtractedReport'][_0x1f8b('0x2b')]);_0x277dc6[_0x1f8b('0x2e')]=_[_0x1f8b('0x2f')](_0x28b43c[_0x1f8b('0x2e')]);_0x277dc6[_0x1f8b('0x30')]=_[_0x1f8b('0x31')](_0x277dc6[_0x1f8b('0x32')],_0x277dc6['query']);_0x4103c3['attributes']=_[_0x1f8b('0x31')](_0x277dc6['model'],qs['fields'](_0x28b43c[_0x1f8b('0x2e')][_0x1f8b('0x33')]));_0x4103c3[_0x1f8b('0x34')]=_0x4103c3[_0x1f8b('0x34')]['length']?_0x4103c3[_0x1f8b('0x34')]:_0x277dc6['model'];if(_0x28b43c[_0x1f8b('0x2e')]['includeAll']){_0x4103c3['include']=[{'all':!![]}];}_0x4103c3=_[_0x1f8b('0x3d')]({},_0x4103c3,_0x28b43c[_0x1f8b('0x3f')]);return db[_0x1f8b('0x2a')]['find'](_0x4103c3)[_0x1f8b('0x20')](handleEntityNotFound(_0x236f39,null))[_0x1f8b('0x20')](respondWithResult(_0x236f39,null))[_0x1f8b('0x43')](handleError(_0x236f39,null));};exports[_0x1f8b('0x46')]=function(_0x4e9783,_0x58479e){return db['AnalyticExtractedReport'][_0x1f8b('0x46')](_0x4e9783[_0x1f8b('0x47')],{})['then'](function(_0x10d2ed){var _0x18fb2c=_0x4e9783[_0x1f8b('0x48')][_0x1f8b('0x49')]({'plain':!![]});if(!_0x18fb2c)throw new Error(_0x1f8b('0x4a'));if(_0x18fb2c[_0x1f8b('0x4b')]===_0x1f8b('0x48')){var _0x19b6ce=_0x10d2ed[_0x1f8b('0x49')]({'plain':!![]});var _0xfeb37a='ExtractedReports';return db['UserProfileSection'][_0x1f8b('0x4c')]({'where':{'name':_0xfeb37a,'userProfileId':_0x18fb2c['userProfileId']},'raw':!![]})['then'](function(_0x6fe73){if(_0x6fe73&&_0x6fe73[_0x1f8b('0x4d')]===0x0){return db[_0x1f8b('0x22')][_0x1f8b('0x46')]({'name':_0x19b6ce['name'],'resourceId':_0x19b6ce['id'],'type':_0x6fe73[_0x1f8b('0x26')],'sectionId':_0x6fe73['id']},{})[_0x1f8b('0x20')](function(){return _0x10d2ed;});}else{return _0x10d2ed;}})['catch'](function(_0x521d90){logger[_0x1f8b('0x24')](_0x1f8b('0x4e'),_0x521d90);throw _0x521d90;});}return _0x10d2ed;})['then'](respondWithResult(_0x58479e,0xc9))[_0x1f8b('0x43')](handleError(_0x58479e,null));};exports['update']=function(_0x4b9251,_0x29d7d4){if(_0x4b9251[_0x1f8b('0x47')]['id']){delete _0x4b9251[_0x1f8b('0x47')]['id'];}return db[_0x1f8b('0x2a')][_0x1f8b('0x4c')]({'where':{'id':_0x4b9251['params']['id']}})[_0x1f8b('0x20')](handleEntityNotFound(_0x29d7d4,null))['then'](saveUpdates(_0x4b9251[_0x1f8b('0x47')],null))[_0x1f8b('0x20')](respondWithResult(_0x29d7d4,null))[_0x1f8b('0x43')](handleError(_0x29d7d4,null));};exports[_0x1f8b('0x21')]=function(_0x5e7282,_0x331a52){return db[_0x1f8b('0x2a')][_0x1f8b('0x4c')]({'where':{'id':_0x5e7282[_0x1f8b('0x45')]['id']}})[_0x1f8b('0x20')](handleEntityNotFound(_0x331a52,null))[_0x1f8b('0x20')](removeEntity(_0x331a52,null))[_0x1f8b('0x43')](handleError(_0x331a52,null));};exports[_0x1f8b('0x4f')]=function(_0x409a53,_0x49d021,_0x35e378){return db[_0x1f8b('0x2a')][_0x1f8b('0x4c')]({'where':{'id':_0x409a53[_0x1f8b('0x45')]['id']},'attributes':['name','basename',_0x1f8b('0x50'),_0x1f8b('0x51')],'raw':!![]})[_0x1f8b('0x20')](handleEntityNotFound(_0x49d021,null))[_0x1f8b('0x20')](function(_0x1633f5){if(_0x1633f5){if(!fs[_0x1f8b('0x52')](path[_0x1f8b('0x53')](config['root'],_0x1f8b('0x54'),_0x1633f5[_0x1f8b('0x50')]))){throw new db[(_0x1f8b('0x55'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x409a53[_0x1f8b('0x2e')][_0x1f8b('0x56')]){return _0x49d021[_0x1f8b('0x14')](0xc8);}return _0x49d021[_0x1f8b('0x4f')](path['join'](config[_0x1f8b('0x57')],_0x1f8b('0x54'),_0x1633f5[_0x1f8b('0x50')]),util[_0x1f8b('0x58')](_0x1f8b('0x59'),_0x1633f5[_0x1f8b('0x5a')]||_0x1633f5['name'],_0x1633f5[_0x1f8b('0x51')][_0x1f8b('0x5b')]()));}})[_0x1f8b('0x43')](handleError(_0x49d021,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 9a79641..e81628b 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 _0x4704=['analytics_extracted_reports','util','../../config/logger','api','moment','bluebird','rimraf','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport'];(function(_0x16db8b,_0xca7d28){var _0x5ba017=function(_0x35b933){while(--_0x35b933){_0x16db8b['push'](_0x16db8b['shift']());}};_0x5ba017(++_0xca7d28);}(_0x4704,0x105));var _0x4470=function(_0x160182,_0x4cf21a){_0x160182=_0x160182-0x0;var _0x1c1e78=_0x4704[_0x160182];return _0x1c1e78;};'use strict';var _=require('lodash');var util=require(_0x4470('0x0'));var logger=require(_0x4470('0x1'))(_0x4470('0x2'));var moment=require(_0x4470('0x3'));var BPromise=require(_0x4470('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4470('0x5'));var config=require('../../config/environment');var attributes=require(_0x4470('0x6'));module[_0x4470('0x7')]=function(_0x43db1f,_0x2bbf76){return _0x43db1f['define'](_0x4470('0x8'),attributes,{'tableName':_0x4470('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a52=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','analytics_extracted_reports'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x7a52,0x6e));var _0x27a5=function(_0xd97e8e,_0x48c229){_0xd97e8e=_0xd97e8e-0x0;var _0x16fe4d=_0x7a52[_0xd97e8e];return _0x16fe4d;};'use strict';var _=require(_0x27a5('0x0'));var util=require(_0x27a5('0x1'));var logger=require(_0x27a5('0x2'))('api');var moment=require(_0x27a5('0x3'));var BPromise=require(_0x27a5('0x4'));var rp=require(_0x27a5('0x5'));var fs=require('fs');var path=require(_0x27a5('0x6'));var rimraf=require('rimraf');var config=require(_0x27a5('0x7'));var attributes=require(_0x27a5('0x8'));module[_0x27a5('0x9')]=function(_0x35fb6e,_0x1f3cfe){return _0x35fb6e['define']('AnalyticExtractedReport',attributes,{'tableName':_0x27a5('0xa'),'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 2da02e0..d0df5f1 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 _0xef13=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xef13,0x1f4));var _0x3ef1=function(_0x38e656,_0x21bcb0){_0x38e656=_0x38e656-0x0;var _0x411375=_0xef13[_0x38e656];return _0x411375;};'use strict';var _=require(_0x3ef1('0x0'));var util=require(_0x3ef1('0x1'));var moment=require(_0x3ef1('0x2'));var BPromise=require('bluebird');var rs=require(_0x3ef1('0x3'));var fs=require('fs');var Redis=require(_0x3ef1('0x4'));var db=require(_0x3ef1('0x5'))['db'];var utils=require(_0x3ef1('0x6'));var logger=require(_0x3ef1('0x7'))('rpc');var config=require(_0x3ef1('0x8'));var jayson=require(_0x3ef1('0x9'));var client=jayson[_0x3ef1('0xa')][_0x3ef1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2892e8,_0x1e9104,_0x284b04){return new BPromise(function(_0x5a4765,_0x793eb8){return client[_0x3ef1('0xc')](_0x2892e8,_0x284b04)['then'](function(_0x1a821e){logger[_0x3ef1('0xd')](_0x3ef1('0xe'),_0x1e9104,_0x3ef1('0xf'));logger[_0x3ef1('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1e9104,_0x3ef1('0xf'),JSON['stringify'](_0x1a821e));if(_0x1a821e[_0x3ef1('0x11')]){if(_0x1a821e[_0x3ef1('0x11')]['code']===0x1f4){logger['error'](_0x3ef1('0xe'),_0x1e9104,_0x1a821e[_0x3ef1('0x11')][_0x3ef1('0x12')]);return _0x793eb8(_0x1a821e[_0x3ef1('0x11')]['message']);}logger[_0x3ef1('0x11')](_0x3ef1('0xe'),_0x1e9104,_0x1a821e['error'][_0x3ef1('0x12')]);return _0x5a4765(_0x1a821e[_0x3ef1('0x11')]['message']);}else{logger[_0x3ef1('0xd')](_0x3ef1('0xe'),_0x1e9104,_0x3ef1('0xf'));_0x5a4765(_0x1a821e[_0x3ef1('0x13')][_0x3ef1('0x12')]);}})[_0x3ef1('0x14')](function(_0x285faa){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1e9104,_0x285faa);_0x793eb8(_0x285faa);});});} \ No newline at end of file +var _0xb9e7=['debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1830ce,_0x305798){var _0x2bce9f=function(_0x9ea7dc){while(--_0x9ea7dc){_0x1830ce['push'](_0x1830ce['shift']());}};_0x2bce9f(++_0x305798);}(_0xb9e7,0xd7));var _0x7b9e=function(_0x4b26b5,_0x4f71fd){_0x4b26b5=_0x4b26b5-0x0;var _0x4dec71=_0xb9e7[_0x4b26b5];return _0x4dec71;};'use strict';var _=require(_0x7b9e('0x0'));var util=require(_0x7b9e('0x1'));var moment=require(_0x7b9e('0x2'));var BPromise=require(_0x7b9e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b9e('0x5'));var logger=require(_0x7b9e('0x6'))(_0x7b9e('0x7'));var config=require(_0x7b9e('0x8'));var jayson=require(_0x7b9e('0x9'));var client=jayson[_0x7b9e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14fc12,_0xd6298f,_0x434f65){return new BPromise(function(_0x37bd16,_0x2641e4){return client['request'](_0x14fc12,_0x434f65)[_0x7b9e('0xb')](function(_0x19e306){logger[_0x7b9e('0xc')](_0x7b9e('0xd'),_0xd6298f,_0x7b9e('0xe'));logger[_0x7b9e('0xf')](_0x7b9e('0x10'),_0xd6298f,'request\x20sent',JSON[_0x7b9e('0x11')](_0x19e306));if(_0x19e306[_0x7b9e('0x12')]){if(_0x19e306[_0x7b9e('0x12')][_0x7b9e('0x13')]===0x1f4){logger[_0x7b9e('0x12')](_0x7b9e('0xd'),_0xd6298f,_0x19e306[_0x7b9e('0x12')]['message']);return _0x2641e4(_0x19e306[_0x7b9e('0x12')]['message']);}logger['error'](_0x7b9e('0xd'),_0xd6298f,_0x19e306[_0x7b9e('0x12')][_0x7b9e('0x14')]);return _0x37bd16(_0x19e306['error']['message']);}else{logger['info'](_0x7b9e('0xd'),_0xd6298f,_0x7b9e('0xe'));_0x37bd16(_0x19e306[_0x7b9e('0x15')][_0x7b9e('0x14')]);}})[_0x7b9e('0x16')](function(_0xb031b4){logger[_0x7b9e('0x12')](_0x7b9e('0xd'),_0xd6298f,_0xb031b4);_0x2641e4(_0xb031b4);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a97441d..349b1ea 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 _0x6566=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','destroy','exports'];(function(_0x330740,_0x58c0c0){var _0x1cb5f2=function(_0xa5c99a){while(--_0xa5c99a){_0x330740['push'](_0x330740['shift']());}};_0x1cb5f2(++_0x58c0c0);}(_0x6566,0x17a));var _0x6656=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x6566[_0x43f881];return _0x365c14;};'use strict';var multer=require(_0x6656('0x0'));var util=require(_0x6656('0x1'));var path=require(_0x6656('0x2'));var timeout=require('connect-timeout');var express=require(_0x6656('0x3'));var router=express['Router']();var auth=require(_0x6656('0x4'));var interaction=require(_0x6656('0x5'));var config=require('../../config/environment');var controller=require(_0x6656('0x6'));router[_0x6656('0x7')]('/',auth[_0x6656('0x8')](),controller[_0x6656('0x9')]);router[_0x6656('0x7')](_0x6656('0xa'),auth[_0x6656('0x8')](),controller['show']);router[_0x6656('0x7')](_0x6656('0xb'),auth[_0x6656('0x8')](),controller[_0x6656('0xc')]);router[_0x6656('0xd')]('/',auth[_0x6656('0x8')](),controller[_0x6656('0xe')]);router[_0x6656('0xf')](_0x6656('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6656('0xa'),auth[_0x6656('0x8')](),controller[_0x6656('0x10')]);module[_0x6656('0x11')]=router; \ No newline at end of file +var _0xf81b=['isAuthenticated','show','/:id/download','download','post','create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','index'];(function(_0x574ff9,_0x4710e2){var _0x4e8d02=function(_0x183b82){while(--_0x183b82){_0x574ff9['push'](_0x574ff9['shift']());}};_0x4e8d02(++_0x4710e2);}(_0xf81b,0xdc));var _0xbf81=function(_0x3c24c0,_0x2d1815){_0x3c24c0=_0x3c24c0-0x0;var _0x45efa3=_0xf81b[_0x3c24c0];return _0x45efa3;};'use strict';var multer=require(_0xbf81('0x0'));var util=require('util');var path=require(_0xbf81('0x1'));var timeout=require(_0xbf81('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbf81('0x3'));var config=require(_0xbf81('0x4'));var controller=require(_0xbf81('0x5'));router[_0xbf81('0x6')]('/',auth['isAuthenticated'](),controller[_0xbf81('0x7')]);router[_0xbf81('0x6')]('/:id',auth[_0xbf81('0x8')](),controller[_0xbf81('0x9')]);router['get'](_0xbf81('0xa'),auth['isAuthenticated'](),controller[_0xbf81('0xb')]);router[_0xbf81('0xc')]('/',auth['isAuthenticated'](),controller[_0xbf81('0xd')]);router['put'](_0xbf81('0xe'),auth[_0xbf81('0x8')](),controller[_0xbf81('0xf')]);router[_0xbf81('0x10')](_0xbf81('0xe'),auth['isAuthenticated'](),controller[_0xbf81('0x11')]);module[_0xbf81('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0d5f71a..1881b8b 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 _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x364154,_0x399863){var _0x413d88=function(_0xfca2c5){while(--_0xfca2c5){_0x364154['push'](_0x364154['shift']());}};_0x413d88(++_0x399863);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0xa6e6bd,_0x333d97){var _0x499b54=function(_0x4ebd72){while(--_0x4ebd72){_0xa6e6bd['push'](_0xa6e6bd['shift']());}};_0x499b54(++_0x333d97);}(_0x1261,0x144));var _0x1126=function(_0x136a01,_0x3e0f10){_0x136a01=_0x136a01-0x0;var _0x39ccee=_0x1261[_0x136a01];return _0x39ccee;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('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 bf42168..60d124e 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 _0xe8db=['save','update','then','destroy','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','find','create','catch','bulkCreate','body','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe8db,0x11b));var _0xbe8d=function(_0x2534cf,_0x545be6){_0x2534cf=_0x2534cf-0x0;var _0x221461=_0xe8db[_0x2534cf];return _0x221461;};'use strict';var pdf=require(_0xbe8d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbe8d('0x1'));var zipdir=require(_0xbe8d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbe8d('0x3'));var BPromise=require(_0xbe8d('0x4'));var Mustache=require(_0xbe8d('0x5'));var util=require(_0xbe8d('0x6'));var path=require('path');var sox=require(_0xbe8d('0x7'));var csv=require(_0xbe8d('0x8'));var ejs=require(_0xbe8d('0x9'));var fs=require('fs');var _=require(_0xbe8d('0xa'));var squel=require(_0xbe8d('0xb'));var crypto=require(_0xbe8d('0xc'));var jsforce=require(_0xbe8d('0xd'));var deskjs=require(_0xbe8d('0xe'));var toCsv=require(_0xbe8d('0x8'));var querystring=require(_0xbe8d('0xf'));var Papa=require(_0xbe8d('0x10'));var Redis=require(_0xbe8d('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbe8d('0x12'));var hardwareService=require(_0xbe8d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xbe8d('0x14'));var config=require(_0xbe8d('0x15'));var licenseUtil=require(_0xbe8d('0x16'));var db=require(_0xbe8d('0x17'))['db'];function respondWithStatusCode(_0x643e24,_0x2abfd2){_0x2abfd2=_0x2abfd2||0xcc;return function(_0x56d817){if(_0x56d817){return _0x643e24[_0xbe8d('0x18')](_0x2abfd2);}return _0x643e24[_0xbe8d('0x19')](_0x2abfd2)[_0xbe8d('0x1a')]();};}function respondWithResult(_0x46af8f,_0x4b2a53){_0x4b2a53=_0x4b2a53||0xc8;return function(_0x30f888){if(_0x30f888){return _0x46af8f['status'](_0x4b2a53)[_0xbe8d('0x1b')](_0x30f888);}};}function respondWithFilteredResult(_0x5a1cbe,_0x1ea737){return function(_0x2f76cd){if(_0x2f76cd){var _0x2ef458=_0x2f76cd[_0xbe8d('0x1c')],_0x54e3b7=_0x1ea737[_0xbe8d('0x1d')],_0xb7f1e6=_0x1ea737[_0xbe8d('0x1d')]+_0x1ea737[_0xbe8d('0x1e')],_0x4ffd06;if(_0xb7f1e6>=_0x2ef458){_0xb7f1e6=_0x2ef458;_0x4ffd06=0xc8;}else{_0x4ffd06=0xce;}_0x5a1cbe['status'](_0x4ffd06);return _0x5a1cbe[_0xbe8d('0x1f')]('Content-Range',_0x54e3b7+'-'+_0xb7f1e6+'/'+_0x2ef458)[_0xbe8d('0x1b')](_0x2f76cd);}return null;};}function patchUpdates(_0x1ae1ec){return function(_0x35962f){try{jsonpatch['apply'](_0x35962f,_0x1ae1ec,!![]);}catch(_0xace065){return BPromise[_0xbe8d('0x20')](_0xace065);}return _0x35962f[_0xbe8d('0x21')]();};}function saveUpdates(_0x582bbf,_0x3439be){return function(_0x2ceb71){if(_0x2ceb71){return _0x2ceb71[_0xbe8d('0x22')](_0x582bbf)[_0xbe8d('0x23')](function(_0x1e7bea){return _0x1e7bea;});}return null;};}function removeEntity(_0x1c4b5d,_0x351260){return function(_0x407b8f){if(_0x407b8f){return _0x407b8f[_0xbe8d('0x24')]()[_0xbe8d('0x23')](function(){_0x1c4b5d[_0xbe8d('0x19')](0xcc)[_0xbe8d('0x1a')]();});}};}function handleEntityNotFound(_0x387d66,_0x426967){return function(_0x33367e){if(!_0x33367e){_0x387d66['sendStatus'](0x194);}return _0x33367e;};}function handleError(_0x2d9a9f,_0x2fd4be){_0x2fd4be=_0x2fd4be||0x1f4;return function(_0x6fd421){logger['error'](_0x6fd421[_0xbe8d('0x25')]);if(_0x6fd421[_0xbe8d('0x26')]){delete _0x6fd421['name'];}_0x2d9a9f[_0xbe8d('0x19')](_0x2fd4be)[_0xbe8d('0x27')](_0x6fd421);};}exports[_0xbe8d('0x28')]=function(_0x33eeba,_0x4787bc){var _0x453b7c={},_0x33ddc4={},_0x13180c={'count':0x0,'rows':[]};var _0x31c0d8=_[_0xbe8d('0x29')](db[_0xbe8d('0x2a')][_0xbe8d('0x2b')],function(_0x41efde){return{'name':_0x41efde['fieldName'],'type':_0x41efde[_0xbe8d('0x2c')]['key']};});_0x33ddc4[_0xbe8d('0x2d')]=_[_0xbe8d('0x29')](_0x31c0d8,_0xbe8d('0x26'));_0x33ddc4[_0xbe8d('0x2e')]=_[_0xbe8d('0x2f')](_0x33eeba[_0xbe8d('0x2e')]);_0x33ddc4[_0xbe8d('0x30')]=_[_0xbe8d('0x31')](_0x33ddc4[_0xbe8d('0x2d')],_0x33ddc4[_0xbe8d('0x2e')]);_0x453b7c[_0xbe8d('0x32')]=_['intersection'](_0x33ddc4[_0xbe8d('0x2d')],qs[_0xbe8d('0x33')](_0x33eeba[_0xbe8d('0x2e')]['fields']));_0x453b7c[_0xbe8d('0x32')]=_0x453b7c['attributes'][_0xbe8d('0x34')]?_0x453b7c[_0xbe8d('0x32')]:_0x33ddc4[_0xbe8d('0x2d')];if(!_0x33eeba[_0xbe8d('0x2e')][_0xbe8d('0x35')](_0xbe8d('0x36'))){_0x453b7c[_0xbe8d('0x1e')]=qs[_0xbe8d('0x1e')](_0x33eeba[_0xbe8d('0x2e')]['limit']);_0x453b7c[_0xbe8d('0x1d')]=qs[_0xbe8d('0x1d')](_0x33eeba[_0xbe8d('0x2e')][_0xbe8d('0x1d')]);}_0x453b7c[_0xbe8d('0x37')]=qs[_0xbe8d('0x38')](_0x33eeba[_0xbe8d('0x2e')][_0xbe8d('0x38')]);_0x453b7c[_0xbe8d('0x39')]=qs[_0xbe8d('0x30')](_[_0xbe8d('0x3a')](_0x33eeba[_0xbe8d('0x2e')],_0x33ddc4[_0xbe8d('0x30')]),_0x31c0d8);if(_0x33eeba[_0xbe8d('0x2e')][_0xbe8d('0x3b')]){_0x453b7c['where']=_[_0xbe8d('0x3c')](_0x453b7c[_0xbe8d('0x39')],{'$or':_['map'](_0x31c0d8,function(_0x5cae45){if(_0x5cae45[_0xbe8d('0x2c')]!==_0xbe8d('0x3d')){var _0x354d0b={};_0x354d0b[_0x5cae45[_0xbe8d('0x26')]]={'$like':'%'+_0x33eeba[_0xbe8d('0x2e')][_0xbe8d('0x3b')]+'%'};return _0x354d0b;}})});}_0x453b7c=_[_0xbe8d('0x3c')]({},_0x453b7c,_0x33eeba[_0xbe8d('0x3e')]);var _0x2dfe36={'where':_0x453b7c[_0xbe8d('0x39')]};return db['AnalyticFieldReport'][_0xbe8d('0x1c')](_0x2dfe36)[_0xbe8d('0x23')](function(_0xb56ff1){_0x13180c[_0xbe8d('0x1c')]=_0xb56ff1;if(_0x33eeba[_0xbe8d('0x2e')]['includeAll']){_0x453b7c[_0xbe8d('0x3f')]=[{'all':!![]}];}return db[_0xbe8d('0x2a')][_0xbe8d('0x40')](_0x453b7c);})['then'](function(_0x2aa21b){_0x13180c[_0xbe8d('0x41')]=_0x2aa21b;return _0x13180c;})[_0xbe8d('0x23')](respondWithFilteredResult(_0x4787bc,_0x453b7c))['catch'](handleError(_0x4787bc,null));};exports['show']=function(_0x384047,_0x3fc6b3){var _0x28ff47={'raw':![],'where':{'id':_0x384047[_0xbe8d('0x42')]['id']}},_0x5dbf0e={};_0x5dbf0e[_0xbe8d('0x2d')]=_[_0xbe8d('0x2f')](db[_0xbe8d('0x2a')]['rawAttributes']);_0x5dbf0e[_0xbe8d('0x2e')]=_[_0xbe8d('0x2f')](_0x384047[_0xbe8d('0x2e')]);_0x5dbf0e[_0xbe8d('0x30')]=_[_0xbe8d('0x31')](_0x5dbf0e[_0xbe8d('0x2d')],_0x5dbf0e[_0xbe8d('0x2e')]);_0x28ff47[_0xbe8d('0x32')]=_[_0xbe8d('0x31')](_0x5dbf0e[_0xbe8d('0x2d')],qs[_0xbe8d('0x33')](_0x384047[_0xbe8d('0x2e')][_0xbe8d('0x33')]));_0x28ff47[_0xbe8d('0x32')]=_0x28ff47[_0xbe8d('0x32')][_0xbe8d('0x34')]?_0x28ff47[_0xbe8d('0x32')]:_0x5dbf0e[_0xbe8d('0x2d')];if(_0x384047[_0xbe8d('0x2e')]['includeAll']){_0x28ff47[_0xbe8d('0x3f')]=[{'all':!![]}];}_0x28ff47=_[_0xbe8d('0x3c')]({},_0x28ff47,_0x384047[_0xbe8d('0x3e')]);return db[_0xbe8d('0x2a')][_0xbe8d('0x43')](_0x28ff47)['then'](handleEntityNotFound(_0x3fc6b3,null))[_0xbe8d('0x23')](respondWithResult(_0x3fc6b3,null))['catch'](handleError(_0x3fc6b3,null));};exports['create']=function(_0x1f9589,_0xb52023){return db[_0xbe8d('0x2a')][_0xbe8d('0x44')](_0x1f9589['body'],{})[_0xbe8d('0x23')](respondWithResult(_0xb52023,0xc9))[_0xbe8d('0x45')](handleError(_0xb52023,null));};exports[_0xbe8d('0x46')]=function(_0x10e0ac,_0x143aff){return db[_0xbe8d('0x2a')][_0xbe8d('0x46')](_0x10e0ac[_0xbe8d('0x47')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x143aff,0xc9))[_0xbe8d('0x45')](handleError(_0x143aff,null));};exports[_0xbe8d('0x22')]=function(_0x383c57,_0xc26d10){if(_0x383c57[_0xbe8d('0x47')]['id']){delete _0x383c57['body']['id'];}return db[_0xbe8d('0x2a')][_0xbe8d('0x43')]({'where':{'id':_0x383c57[_0xbe8d('0x42')]['id']}})[_0xbe8d('0x23')](handleEntityNotFound(_0xc26d10,null))['then'](saveUpdates(_0x383c57['body'],null))[_0xbe8d('0x23')](respondWithResult(_0xc26d10,null))[_0xbe8d('0x45')](handleError(_0xc26d10,null));};exports['destroy']=function(_0x58b9f8,_0x5008bf){return db[_0xbe8d('0x2a')]['find']({'where':{'id':_0x58b9f8[_0xbe8d('0x42')]['id']}})[_0xbe8d('0x23')](handleEntityNotFound(_0x5008bf,null))[_0xbe8d('0x23')](removeEntity(_0x5008bf,null))[_0xbe8d('0x45')](handleError(_0x5008bf,null));};exports['bulkDestroy']=function(_0x37b16e,_0xe5c97e){return db[_0xbe8d('0x2a')][_0xbe8d('0x24')]({'where':{'id':_0x37b16e['query'][_0xbe8d('0x48')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xe5c97e,0xcc))['catch'](handleError(_0xe5c97e,null));};exports[_0xbe8d('0x49')]=function(_0x1d217b,_0x53b210,_0x3e86f3){return db[_0xbe8d('0x4a')][_0xbe8d('0x4b')]({'where':{'id':_0x1d217b[_0xbe8d('0x42')]['id']}})['then'](handleEntityNotFound(_0x53b210,null))[_0xbe8d('0x23')](function(_0x5da467){if(_0x5da467){return db[_0xbe8d('0x4c')][_0xbe8d('0x4d')](function(_0x1d5e09){return db[_0xbe8d('0x2a')][_0xbe8d('0x24')]({'where':{'CustomReportId':_0x1d217b[_0xbe8d('0x42')]['id']},'transaction':_0x1d5e09})[_0xbe8d('0x23')](function(_0x26b89a){var _0x207400=_['map'](_0x1d217b[_0xbe8d('0x47')],function(_0x505809){delete _0x505809['id'];_0x505809[_0xbe8d('0x4e')]=_0x1d217b[_0xbe8d('0x42')]['id'];return _0x505809;});return db[_0xbe8d('0x2a')][_0xbe8d('0x46')](_0x207400,{'transaction':_0x1d5e09});});})[_0xbe8d('0x23')](function(){return db[_0xbe8d('0x2a')][_0xbe8d('0x40')]({'where':{'CustomReportId':_0x1d217b['params']['id']}});});}})[_0xbe8d('0x23')](respondWithResult(_0x53b210,null))[_0xbe8d('0x45')](handleError(_0x53b210,null));}; \ No newline at end of file +var _0x0e89=['end','json','count','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x5196e1,_0x5466cd){var _0xaf48e9=function(_0x41d5d0){while(--_0x41d5d0){_0x5196e1['push'](_0x5196e1['shift']());}};_0xaf48e9(++_0x5466cd);}(_0x0e89,0xd6));var _0x90e8=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x0e89[_0x465028];return _0xb783d4;};'use strict';var pdf=require(_0x90e8('0x0'));var emlformat=require(_0x90e8('0x1'));var rimraf=require(_0x90e8('0x2'));var zipdir=require(_0x90e8('0x3'));var jsonpatch=require(_0x90e8('0x4'));var rp=require(_0x90e8('0x5'));var moment=require(_0x90e8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x90e8('0x7'));var util=require(_0x90e8('0x8'));var path=require(_0x90e8('0x9'));var sox=require(_0x90e8('0xa'));var csv=require('to-csv');var ejs=require(_0x90e8('0xb'));var fs=require('fs');var _=require(_0x90e8('0xc'));var squel=require(_0x90e8('0xd'));var crypto=require(_0x90e8('0xe'));var jsforce=require(_0x90e8('0xf'));var deskjs=require(_0x90e8('0x10'));var toCsv=require(_0x90e8('0x11'));var querystring=require(_0x90e8('0x12'));var Papa=require(_0x90e8('0x13'));var Redis=require(_0x90e8('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x90e8('0x15'));var as=require(_0x90e8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x90e8('0x17'));var utils=require(_0x90e8('0x18'));var config=require(_0x90e8('0x19'));var licenseUtil=require(_0x90e8('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36bfa2,_0x51e5b0){_0x51e5b0=_0x51e5b0||0xcc;return function(_0x3af949){if(_0x3af949){return _0x36bfa2[_0x90e8('0x1b')](_0x51e5b0);}return _0x36bfa2[_0x90e8('0x1c')](_0x51e5b0)[_0x90e8('0x1d')]();};}function respondWithResult(_0x3b0099,_0x5b04bd){_0x5b04bd=_0x5b04bd||0xc8;return function(_0x5e7ce4){if(_0x5e7ce4){return _0x3b0099[_0x90e8('0x1c')](_0x5b04bd)[_0x90e8('0x1e')](_0x5e7ce4);}};}function respondWithFilteredResult(_0x231aab,_0x84db3d){return function(_0x29efcd){if(_0x29efcd){var _0x2debfd=_0x29efcd[_0x90e8('0x1f')],_0x2acbd3=_0x84db3d['offset'],_0x37b593=_0x84db3d[_0x90e8('0x20')]+_0x84db3d[_0x90e8('0x21')],_0x4df8e2;if(_0x37b593>=_0x2debfd){_0x37b593=_0x2debfd;_0x4df8e2=0xc8;}else{_0x4df8e2=0xce;}_0x231aab[_0x90e8('0x1c')](_0x4df8e2);return _0x231aab['set'](_0x90e8('0x22'),_0x2acbd3+'-'+_0x37b593+'/'+_0x2debfd)[_0x90e8('0x1e')](_0x29efcd);}return null;};}function patchUpdates(_0x3f27f4){return function(_0x5a97b4){try{jsonpatch[_0x90e8('0x23')](_0x5a97b4,_0x3f27f4,!![]);}catch(_0x420eb7){return BPromise['reject'](_0x420eb7);}return _0x5a97b4['save']();};}function saveUpdates(_0x1f24df,_0x4ed1b9){return function(_0x5a18b5){if(_0x5a18b5){return _0x5a18b5[_0x90e8('0x24')](_0x1f24df)[_0x90e8('0x25')](function(_0x44e5d6){return _0x44e5d6;});}return null;};}function removeEntity(_0x260237,_0x4df4ea){return function(_0x2bab58){if(_0x2bab58){return _0x2bab58[_0x90e8('0x26')]()[_0x90e8('0x25')](function(){_0x260237[_0x90e8('0x1c')](0xcc)[_0x90e8('0x1d')]();});}};}function handleEntityNotFound(_0x326ac1,_0x171ffb){return function(_0x25a5f1){if(!_0x25a5f1){_0x326ac1[_0x90e8('0x1b')](0x194);}return _0x25a5f1;};}function handleError(_0x5d44d5,_0x32253c){_0x32253c=_0x32253c||0x1f4;return function(_0x47fe6a){logger[_0x90e8('0x27')](_0x47fe6a[_0x90e8('0x28')]);if(_0x47fe6a[_0x90e8('0x29')]){delete _0x47fe6a[_0x90e8('0x29')];}_0x5d44d5['status'](_0x32253c)[_0x90e8('0x2a')](_0x47fe6a);};}exports['index']=function(_0x53c9a3,_0x2f0d85){var _0x30c9a2={},_0x2ab78b={},_0xb9273e={'count':0x0,'rows':[]};var _0x42a6a5=_[_0x90e8('0x2b')](db[_0x90e8('0x2c')]['rawAttributes'],function(_0x67a26b){return{'name':_0x67a26b[_0x90e8('0x2d')],'type':_0x67a26b['type'][_0x90e8('0x2e')]};});_0x2ab78b[_0x90e8('0x2f')]=_[_0x90e8('0x2b')](_0x42a6a5,_0x90e8('0x29'));_0x2ab78b[_0x90e8('0x30')]=_[_0x90e8('0x31')](_0x53c9a3[_0x90e8('0x30')]);_0x2ab78b[_0x90e8('0x32')]=_[_0x90e8('0x33')](_0x2ab78b[_0x90e8('0x2f')],_0x2ab78b[_0x90e8('0x30')]);_0x30c9a2['attributes']=_[_0x90e8('0x33')](_0x2ab78b[_0x90e8('0x2f')],qs[_0x90e8('0x34')](_0x53c9a3['query']['fields']));_0x30c9a2[_0x90e8('0x35')]=_0x30c9a2[_0x90e8('0x35')][_0x90e8('0x36')]?_0x30c9a2[_0x90e8('0x35')]:_0x2ab78b[_0x90e8('0x2f')];if(!_0x53c9a3[_0x90e8('0x30')]['hasOwnProperty'](_0x90e8('0x37'))){_0x30c9a2[_0x90e8('0x21')]=qs['limit'](_0x53c9a3[_0x90e8('0x30')]['limit']);_0x30c9a2[_0x90e8('0x20')]=qs['offset'](_0x53c9a3[_0x90e8('0x30')][_0x90e8('0x20')]);}_0x30c9a2['order']=qs['sort'](_0x53c9a3['query'][_0x90e8('0x38')]);_0x30c9a2[_0x90e8('0x39')]=qs['filters'](_['pick'](_0x53c9a3[_0x90e8('0x30')],_0x2ab78b[_0x90e8('0x32')]),_0x42a6a5);if(_0x53c9a3[_0x90e8('0x30')][_0x90e8('0x3a')]){_0x30c9a2[_0x90e8('0x39')]=_[_0x90e8('0x3b')](_0x30c9a2[_0x90e8('0x39')],{'$or':_[_0x90e8('0x2b')](_0x42a6a5,function(_0x529c29){if(_0x529c29[_0x90e8('0x3c')]!==_0x90e8('0x3d')){var _0x4ffc33={};_0x4ffc33[_0x529c29[_0x90e8('0x29')]]={'$like':'%'+_0x53c9a3[_0x90e8('0x30')]['filter']+'%'};return _0x4ffc33;}})});}_0x30c9a2=_[_0x90e8('0x3b')]({},_0x30c9a2,_0x53c9a3[_0x90e8('0x3e')]);var _0x33643b={'where':_0x30c9a2['where']};return db[_0x90e8('0x2c')][_0x90e8('0x1f')](_0x33643b)['then'](function(_0x2d6ad6){_0xb9273e['count']=_0x2d6ad6;if(_0x53c9a3[_0x90e8('0x30')][_0x90e8('0x3f')]){_0x30c9a2[_0x90e8('0x40')]=[{'all':!![]}];}return db[_0x90e8('0x2c')][_0x90e8('0x41')](_0x30c9a2);})[_0x90e8('0x25')](function(_0x5a2d7b){_0xb9273e[_0x90e8('0x42')]=_0x5a2d7b;return _0xb9273e;})['then'](respondWithFilteredResult(_0x2f0d85,_0x30c9a2))[_0x90e8('0x43')](handleError(_0x2f0d85,null));};exports[_0x90e8('0x44')]=function(_0x1edd18,_0x506a7d){var _0x38addc={'raw':![],'where':{'id':_0x1edd18[_0x90e8('0x45')]['id']}},_0x3e0d94={};_0x3e0d94[_0x90e8('0x2f')]=_[_0x90e8('0x31')](db[_0x90e8('0x2c')][_0x90e8('0x46')]);_0x3e0d94[_0x90e8('0x30')]=_[_0x90e8('0x31')](_0x1edd18[_0x90e8('0x30')]);_0x3e0d94[_0x90e8('0x32')]=_['intersection'](_0x3e0d94[_0x90e8('0x2f')],_0x3e0d94[_0x90e8('0x30')]);_0x38addc[_0x90e8('0x35')]=_[_0x90e8('0x33')](_0x3e0d94[_0x90e8('0x2f')],qs[_0x90e8('0x34')](_0x1edd18[_0x90e8('0x30')][_0x90e8('0x34')]));_0x38addc[_0x90e8('0x35')]=_0x38addc[_0x90e8('0x35')][_0x90e8('0x36')]?_0x38addc[_0x90e8('0x35')]:_0x3e0d94[_0x90e8('0x2f')];if(_0x1edd18[_0x90e8('0x30')]['includeAll']){_0x38addc[_0x90e8('0x40')]=[{'all':!![]}];}_0x38addc=_[_0x90e8('0x3b')]({},_0x38addc,_0x1edd18[_0x90e8('0x3e')]);return db['AnalyticFieldReport']['find'](_0x38addc)['then'](handleEntityNotFound(_0x506a7d,null))[_0x90e8('0x25')](respondWithResult(_0x506a7d,null))[_0x90e8('0x43')](handleError(_0x506a7d,null));};exports[_0x90e8('0x47')]=function(_0x24792d,_0x4d9c5a){return db[_0x90e8('0x2c')][_0x90e8('0x47')](_0x24792d[_0x90e8('0x48')],{})[_0x90e8('0x25')](respondWithResult(_0x4d9c5a,0xc9))[_0x90e8('0x43')](handleError(_0x4d9c5a,null));};exports['bulkCreate']=function(_0x3598e0,_0x8316f7){return db['AnalyticFieldReport'][_0x90e8('0x49')](_0x3598e0[_0x90e8('0x48')],{'raw':![],'individualHooks':!![]})[_0x90e8('0x25')](respondWithResult(_0x8316f7,0xc9))[_0x90e8('0x43')](handleError(_0x8316f7,null));};exports[_0x90e8('0x24')]=function(_0x17a773,_0x5af8c4){if(_0x17a773[_0x90e8('0x48')]['id']){delete _0x17a773[_0x90e8('0x48')]['id'];}return db['AnalyticFieldReport'][_0x90e8('0x4a')]({'where':{'id':_0x17a773['params']['id']}})[_0x90e8('0x25')](handleEntityNotFound(_0x5af8c4,null))['then'](saveUpdates(_0x17a773['body'],null))[_0x90e8('0x25')](respondWithResult(_0x5af8c4,null))[_0x90e8('0x43')](handleError(_0x5af8c4,null));};exports[_0x90e8('0x26')]=function(_0x2b3a4f,_0x33f0d7){return db[_0x90e8('0x2c')][_0x90e8('0x4a')]({'where':{'id':_0x2b3a4f['params']['id']}})[_0x90e8('0x25')](handleEntityNotFound(_0x33f0d7,null))['then'](removeEntity(_0x33f0d7,null))['catch'](handleError(_0x33f0d7,null));};exports[_0x90e8('0x4b')]=function(_0x5612fa,_0x9c1de6){return db[_0x90e8('0x2c')][_0x90e8('0x26')]({'where':{'id':_0x5612fa[_0x90e8('0x30')][_0x90e8('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x90e8('0x25')](respondWithResult(_0x9c1de6,0xcc))[_0x90e8('0x43')](handleError(_0x9c1de6,null));};exports[_0x90e8('0x4d')]=function(_0xdf025b,_0xe4dd8a,_0x5ef11d){return db[_0x90e8('0x4e')][_0x90e8('0x4f')]({'where':{'id':_0xdf025b[_0x90e8('0x45')]['id']}})[_0x90e8('0x25')](handleEntityNotFound(_0xe4dd8a,null))[_0x90e8('0x25')](function(_0x58a40f){if(_0x58a40f){return db['sequelize'][_0x90e8('0x50')](function(_0x438730){return db[_0x90e8('0x2c')][_0x90e8('0x26')]({'where':{'CustomReportId':_0xdf025b[_0x90e8('0x45')]['id']},'transaction':_0x438730})[_0x90e8('0x25')](function(_0x3c0792){var _0x48afb4=_[_0x90e8('0x2b')](_0xdf025b['body'],function(_0x5e03a1){delete _0x5e03a1['id'];_0x5e03a1['CustomReportId']=_0xdf025b[_0x90e8('0x45')]['id'];return _0x5e03a1;});return db['AnalyticFieldReport'][_0x90e8('0x49')](_0x48afb4,{'transaction':_0x438730});});})[_0x90e8('0x25')](function(){return db['AnalyticFieldReport'][_0x90e8('0x41')]({'where':{'CustomReportId':_0xdf025b[_0x90e8('0x45')]['id']}});});}})[_0x90e8('0x25')](respondWithResult(_0xe4dd8a,null))['catch'](handleError(_0xe4dd8a,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index fb58894..cdaa7a9 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 _0x8901=['path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x8901,0x8a));var _0x1890=function(_0x50499c,_0x188984){_0x50499c=_0x50499c-0x0;var _0xd422b3=_0x8901[_0x50499c];return _0xd422b3;};'use strict';var _=require(_0x1890('0x0'));var util=require(_0x1890('0x1'));var logger=require(_0x1890('0x2'))(_0x1890('0x3'));var moment=require(_0x1890('0x4'));var BPromise=require(_0x1890('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1890('0x6'));var rimraf=require(_0x1890('0x7'));var config=require('../../config/environment');var attributes=require(_0x1890('0x8'));module[_0x1890('0x9')]=function(_0x505f13,_0x5932da){return _0x505f13[_0x1890('0xa')](_0x1890('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57db=['request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','moment','bluebird'];(function(_0x3d73ba,_0x356e23){var _0x47e406=function(_0x90df31){while(--_0x90df31){_0x3d73ba['push'](_0x3d73ba['shift']());}};_0x47e406(++_0x356e23);}(_0x57db,0x110));var _0xb57d=function(_0x1f5510,_0x2688b5){_0x1f5510=_0x1f5510-0x0;var _0x3d486e=_0x57db[_0x1f5510];return _0x3d486e;};'use strict';var _=require(_0xb57d('0x0'));var util=require('util');var logger=require(_0xb57d('0x1'))('api');var moment=require(_0xb57d('0x2'));var BPromise=require(_0xb57d('0x3'));var rp=require(_0xb57d('0x4'));var fs=require('fs');var path=require(_0xb57d('0x5'));var rimraf=require('rimraf');var config=require(_0xb57d('0x6'));var attributes=require(_0xb57d('0x7'));module[_0xb57d('0x8')]=function(_0xa06f30,_0x445c4d){return _0xa06f30[_0xb57d('0x9')](_0xb57d('0xa'),attributes,{'tableName':_0xb57d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 99bc6fe..374bd55 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 _0x6acd=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','lodash'];(function(_0xb9da54,_0x17ac30){var _0x5b77b5=function(_0x1c1260){while(--_0x1c1260){_0xb9da54['push'](_0xb9da54['shift']());}};_0x5b77b5(++_0x17ac30);}(_0x6acd,0x1e3));var _0xd6ac=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6acd[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xd6ac('0x0'));var util=require('util');var moment=require(_0xd6ac('0x1'));var BPromise=require(_0xd6ac('0x2'));var rs=require(_0xd6ac('0x3'));var fs=require('fs');var Redis=require(_0xd6ac('0x4'));var db=require(_0xd6ac('0x5'))['db'];var utils=require(_0xd6ac('0x6'));var logger=require('../../config/logger')(_0xd6ac('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd6ac('0x8')][_0xd6ac('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28c829,_0x454fc8,_0x5920a0){return new BPromise(function(_0x4d47e7,_0x228600){return client[_0xd6ac('0xa')](_0x28c829,_0x5920a0)['then'](function(_0x57adba){logger[_0xd6ac('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x454fc8,_0xd6ac('0xc'));logger[_0xd6ac('0xd')](_0xd6ac('0xe'),_0x454fc8,_0xd6ac('0xc'),JSON[_0xd6ac('0xf')](_0x57adba));if(_0x57adba[_0xd6ac('0x10')]){if(_0x57adba['error'][_0xd6ac('0x11')]===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x454fc8,_0x57adba[_0xd6ac('0x10')][_0xd6ac('0x12')]);return _0x228600(_0x57adba['error'][_0xd6ac('0x12')]);}logger[_0xd6ac('0x10')](_0xd6ac('0x13'),_0x454fc8,_0x57adba[_0xd6ac('0x10')][_0xd6ac('0x12')]);return _0x4d47e7(_0x57adba[_0xd6ac('0x10')]['message']);}else{logger[_0xd6ac('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x454fc8,'request\x20sent');_0x4d47e7(_0x57adba[_0xd6ac('0x14')][_0xd6ac('0x12')]);}})[_0xd6ac('0x15')](function(_0x49de6b){logger[_0xd6ac('0x10')](_0xd6ac('0x13'),_0x454fc8,_0x49de6b);_0x228600(_0x49de6b);});});} \ No newline at end of file +var _0x816d=['request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1be7fd,_0x51ff5a){var _0x2f7949=function(_0x1eb3ed){while(--_0x1eb3ed){_0x1be7fd['push'](_0x1be7fd['shift']());}};_0x2f7949(++_0x51ff5a);}(_0x816d,0x68));var _0xd816=function(_0xf239db,_0x2922eb){_0xf239db=_0xf239db-0x0;var _0x45491b=_0x816d[_0xf239db];return _0x45491b;};'use strict';var _=require(_0xd816('0x0'));var util=require(_0xd816('0x1'));var moment=require(_0xd816('0x2'));var BPromise=require(_0xd816('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd816('0x4'));var db=require(_0xd816('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd816('0x6'))(_0xd816('0x7'));var config=require(_0xd816('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd816('0x9')][_0xd816('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x112ac5,_0x48e137,_0x1a97f1){return new BPromise(function(_0x3df144,_0x180266){return client[_0xd816('0xb')](_0x112ac5,_0x1a97f1)[_0xd816('0xc')](function(_0x4b254c){logger[_0xd816('0xd')](_0xd816('0xe'),_0x48e137,_0xd816('0xf'));logger[_0xd816('0x10')](_0xd816('0x11'),_0x48e137,_0xd816('0xf'),JSON[_0xd816('0x12')](_0x4b254c));if(_0x4b254c[_0xd816('0x13')]){if(_0x4b254c['error'][_0xd816('0x14')]===0x1f4){logger[_0xd816('0x13')](_0xd816('0xe'),_0x48e137,_0x4b254c['error']['message']);return _0x180266(_0x4b254c[_0xd816('0x13')][_0xd816('0x15')]);}logger[_0xd816('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x48e137,_0x4b254c[_0xd816('0x13')][_0xd816('0x15')]);return _0x3df144(_0x4b254c['error'][_0xd816('0x15')]);}else{logger[_0xd816('0xd')](_0xd816('0xe'),_0x48e137,_0xd816('0xf'));_0x3df144(_0x4b254c[_0xd816('0x16')][_0xd816('0x15')]);}})['catch'](function(_0x2e0046){logger[_0xd816('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x48e137,_0x2e0046);_0x180266(_0x2e0046);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index e3c62c4..5eeded8 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 _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','post','/create_many','bulkCreate','/:id/create_many','put','update','delete','/destroy_many','bulkDestroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./analyticFieldReport.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0xc')]('/',auth[_0x7995('0x9')](),controller['create']);router[_0x7995('0xc')](_0x7995('0xd'),auth[_0x7995('0x9')](),controller[_0x7995('0xe')]);router[_0x7995('0xc')](_0x7995('0xf'),auth[_0x7995('0x9')](),controller['addFields']);router[_0x7995('0x10')](_0x7995('0xb'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0x13'),auth[_0x7995('0x9')](),controller[_0x7995('0x14')]);router[_0x7995('0x12')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x326f=['/:id','show','post','/create_many','bulkCreate','/:id/create_many','addFields','update','/destroy_many','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x326f,0xd1));var _0xf326=function(_0x27ca11,_0x29162e){_0x27ca11=_0x27ca11-0x0;var _0x566b90=_0x326f[_0x27ca11];return _0x566b90;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xf326('0xe'),auth[_0xf326('0x9')](),controller[_0xf326('0xf')]);router[_0xf326('0xd')](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['put'](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x12')]);router['delete'](_0xf326('0x13'),auth[_0xf326('0x9')](),controller['bulkDestroy']);router[_0xf326('0x14')](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 4450a9a..77eafb6 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 _0x827a=['name','STRING','TEXT','sequelize'];(function(_0xced98a,_0x5cb79a){var _0x2055db=function(_0x7c4807){while(--_0x7c4807){_0xced98a['push'](_0xced98a['shift']());}};_0x2055db(++_0x5cb79a);}(_0x827a,0x167));var _0xa827=function(_0x3ca9b8,_0x5ceb5c){_0x3ca9b8=_0x3ca9b8-0x0;var _0xdd996b=_0x827a[_0x3ca9b8];return _0xdd996b;};'use strict';var Sequelize=require(_0xa827('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa827('0x1')},'table':{'type':Sequelize[_0xa827('0x2')]},'metric':{'type':Sequelize[_0xa827('0x3')]},'description':{'type':Sequelize[_0xa827('0x2')]}}; \ No newline at end of file +var _0x74fd=['STRING','name','TEXT','sequelize'];(function(_0x13159d,_0x198700){var _0x41b180=function(_0x3681b0){while(--_0x3681b0){_0x13159d['push'](_0x13159d['shift']());}};_0x41b180(++_0x198700);}(_0x74fd,0x8f));var _0xd74f=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x74fd[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require(_0xd74f('0x0'));module['exports']={'name':{'type':Sequelize[_0xd74f('0x1')],'allowNull':![],'unique':_0xd74f('0x2')},'table':{'type':Sequelize[_0xd74f('0x1')]},'metric':{'type':Sequelize[_0xd74f('0x3')]},'description':{'type':Sequelize[_0xd74f('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 66396b5..3254bd8 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 _0xa5b0=['limit','set','Content-Range','json','reject','update','then','destroy','get','Metrics','end','sendStatus','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','query','keys','model','intersection','fields','attributes','length','order','sort','filters','where','merge','VIRTUAL','filter','count','include','findAll','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','offset'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xa5b0,0xcd));var _0x0a5b=function(_0x3cf7df,_0x43b053){_0x3cf7df=_0x3cf7df-0x0;var _0x52ca51=_0xa5b0[_0x3cf7df];return _0x52ca51;};'use strict';var pdf=require(_0x0a5b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0a5b('0x1'));var zipdir=require(_0x0a5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a5b('0x3'));var moment=require(_0x0a5b('0x4'));var BPromise=require(_0x0a5b('0x5'));var Mustache=require(_0x0a5b('0x6'));var util=require(_0x0a5b('0x7'));var path=require(_0x0a5b('0x8'));var sox=require('sox');var csv=require(_0x0a5b('0x9'));var ejs=require(_0x0a5b('0xa'));var fs=require('fs');var _=require(_0x0a5b('0xb'));var squel=require('squel');var crypto=require(_0x0a5b('0xc'));var jsforce=require(_0x0a5b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0a5b('0x9'));var querystring=require(_0x0a5b('0xe'));var Papa=require(_0x0a5b('0xf'));var Redis=require('ioredis');var authService=require(_0x0a5b('0x10'));var qs=require(_0x0a5b('0x11'));var as=require(_0x0a5b('0x12'));var hardwareService=require(_0x0a5b('0x13'));var logger=require(_0x0a5b('0x14'))(_0x0a5b('0x15'));var utils=require('../../config/utils');var config=require(_0x0a5b('0x16'));var licenseUtil=require(_0x0a5b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44933c,_0x213ee7){_0x213ee7=_0x213ee7||0xcc;return function(_0x146072){if(_0x146072){return _0x44933c['sendStatus'](_0x213ee7);}return _0x44933c[_0x0a5b('0x18')](_0x213ee7)['end']();};}function respondWithResult(_0x5bd914,_0x311923){_0x311923=_0x311923||0xc8;return function(_0x12afe9){if(_0x12afe9){return _0x5bd914[_0x0a5b('0x18')](_0x311923)['json'](_0x12afe9);}};}function respondWithFilteredResult(_0x5d0fad,_0x395838){return function(_0x1204f5){if(_0x1204f5){var _0x4ec92b=_0x1204f5['count'],_0x4e1b41=_0x395838[_0x0a5b('0x19')],_0x1a97c9=_0x395838[_0x0a5b('0x19')]+_0x395838[_0x0a5b('0x1a')],_0x2630fb;if(_0x1a97c9>=_0x4ec92b){_0x1a97c9=_0x4ec92b;_0x2630fb=0xc8;}else{_0x2630fb=0xce;}_0x5d0fad['status'](_0x2630fb);return _0x5d0fad[_0x0a5b('0x1b')](_0x0a5b('0x1c'),_0x4e1b41+'-'+_0x1a97c9+'/'+_0x4ec92b)[_0x0a5b('0x1d')](_0x1204f5);}return null;};}function patchUpdates(_0x11987b){return function(_0x1e1398){try{jsonpatch['apply'](_0x1e1398,_0x11987b,!![]);}catch(_0x50ebe2){return BPromise[_0x0a5b('0x1e')](_0x50ebe2);}return _0x1e1398['save']();};}function saveUpdates(_0x1fe6b5,_0x4d3fd1){return function(_0x5df369){if(_0x5df369){return _0x5df369[_0x0a5b('0x1f')](_0x1fe6b5)[_0x0a5b('0x20')](function(_0x165ee2){return _0x165ee2;});}return null;};}function removeEntity(_0x192a90,_0x2c103e){return function(_0x433275){if(_0x433275){return _0x433275[_0x0a5b('0x21')]()[_0x0a5b('0x20')](function(){var _0x912d58=_0x433275[_0x0a5b('0x22')]({'plain':!![]});var _0x30906c=_0x0a5b('0x23');return db['UserProfileResource'][_0x0a5b('0x21')]({'where':{'type':_0x30906c,'resourceId':_0x912d58['id']}})['then'](function(){return _0x433275;});})[_0x0a5b('0x20')](function(){_0x192a90[_0x0a5b('0x18')](0xcc)[_0x0a5b('0x24')]();});}};}function handleEntityNotFound(_0x479871,_0x4066dd){return function(_0x3de486){if(!_0x3de486){_0x479871[_0x0a5b('0x25')](0x194);}return _0x3de486;};}function handleError(_0x2d9831,_0x49cd2d){_0x49cd2d=_0x49cd2d||0x1f4;return function(_0x12c1d5){logger[_0x0a5b('0x26')](_0x12c1d5[_0x0a5b('0x27')]);if(_0x12c1d5[_0x0a5b('0x28')]){delete _0x12c1d5[_0x0a5b('0x28')];}_0x2d9831['status'](_0x49cd2d)[_0x0a5b('0x29')](_0x12c1d5);};}exports[_0x0a5b('0x2a')]=function(_0x4df548,_0x878133){var _0x5c3ce0={},_0x3551b3={},_0x2e8ffc={'count':0x0,'rows':[]};var _0xbf79e3=_[_0x0a5b('0x2b')](db[_0x0a5b('0x2c')][_0x0a5b('0x2d')],function(_0x12a0d5){return{'name':_0x12a0d5[_0x0a5b('0x2e')],'type':_0x12a0d5[_0x0a5b('0x2f')]['key']};});_0x3551b3['model']=_[_0x0a5b('0x2b')](_0xbf79e3,_0x0a5b('0x28'));_0x3551b3[_0x0a5b('0x30')]=_[_0x0a5b('0x31')](_0x4df548[_0x0a5b('0x30')]);_0x3551b3['filters']=_['intersection'](_0x3551b3[_0x0a5b('0x32')],_0x3551b3['query']);_0x5c3ce0['attributes']=_[_0x0a5b('0x33')](_0x3551b3[_0x0a5b('0x32')],qs[_0x0a5b('0x34')](_0x4df548[_0x0a5b('0x30')]['fields']));_0x5c3ce0[_0x0a5b('0x35')]=_0x5c3ce0[_0x0a5b('0x35')][_0x0a5b('0x36')]?_0x5c3ce0[_0x0a5b('0x35')]:_0x3551b3[_0x0a5b('0x32')];if(!_0x4df548[_0x0a5b('0x30')]['hasOwnProperty']('nolimit')){_0x5c3ce0[_0x0a5b('0x1a')]=qs[_0x0a5b('0x1a')](_0x4df548[_0x0a5b('0x30')]['limit']);_0x5c3ce0[_0x0a5b('0x19')]=qs['offset'](_0x4df548[_0x0a5b('0x30')][_0x0a5b('0x19')]);}_0x5c3ce0[_0x0a5b('0x37')]=qs[_0x0a5b('0x38')](_0x4df548[_0x0a5b('0x30')]['sort']);_0x5c3ce0['where']=qs[_0x0a5b('0x39')](_['pick'](_0x4df548[_0x0a5b('0x30')],_0x3551b3[_0x0a5b('0x39')]),_0xbf79e3);if(_0x4df548[_0x0a5b('0x30')]['filter']){_0x5c3ce0[_0x0a5b('0x3a')]=_[_0x0a5b('0x3b')](_0x5c3ce0['where'],{'$or':_[_0x0a5b('0x2b')](_0xbf79e3,function(_0xfa035e){if(_0xfa035e['type']!==_0x0a5b('0x3c')){var _0x592f29={};_0x592f29[_0xfa035e[_0x0a5b('0x28')]]={'$like':'%'+_0x4df548[_0x0a5b('0x30')][_0x0a5b('0x3d')]+'%'};return _0x592f29;}})});}_0x5c3ce0=_[_0x0a5b('0x3b')]({},_0x5c3ce0,_0x4df548['options']);var _0x4202dd={'where':_0x5c3ce0[_0x0a5b('0x3a')]};return db[_0x0a5b('0x2c')][_0x0a5b('0x3e')](_0x4202dd)[_0x0a5b('0x20')](function(_0x3722f3){_0x2e8ffc[_0x0a5b('0x3e')]=_0x3722f3;if(_0x4df548[_0x0a5b('0x30')]['includeAll']){_0x5c3ce0[_0x0a5b('0x3f')]=[{'all':!![]}];}return db[_0x0a5b('0x2c')][_0x0a5b('0x40')](_0x5c3ce0);})[_0x0a5b('0x20')](function(_0x528478){_0x2e8ffc['rows']=_0x528478;return _0x2e8ffc;})[_0x0a5b('0x20')](respondWithFilteredResult(_0x878133,_0x5c3ce0))[_0x0a5b('0x41')](handleError(_0x878133,null));};exports[_0x0a5b('0x42')]=function(_0x550f0c,_0x5d4454){var _0x50e0ff={'raw':!![],'where':{'id':_0x550f0c[_0x0a5b('0x43')]['id']}},_0x5b8f48={};_0x5b8f48['model']=_[_0x0a5b('0x31')](db['AnalyticMetric'][_0x0a5b('0x2d')]);_0x5b8f48[_0x0a5b('0x30')]=_[_0x0a5b('0x31')](_0x550f0c[_0x0a5b('0x30')]);_0x5b8f48[_0x0a5b('0x39')]=_['intersection'](_0x5b8f48[_0x0a5b('0x32')],_0x5b8f48['query']);_0x50e0ff[_0x0a5b('0x35')]=_[_0x0a5b('0x33')](_0x5b8f48['model'],qs[_0x0a5b('0x34')](_0x550f0c[_0x0a5b('0x30')][_0x0a5b('0x34')]));_0x50e0ff[_0x0a5b('0x35')]=_0x50e0ff['attributes']['length']?_0x50e0ff[_0x0a5b('0x35')]:_0x5b8f48[_0x0a5b('0x32')];if(_0x550f0c[_0x0a5b('0x30')][_0x0a5b('0x44')]){_0x50e0ff[_0x0a5b('0x3f')]=[{'all':!![]}];}_0x50e0ff=_['merge']({},_0x50e0ff,_0x550f0c[_0x0a5b('0x45')]);return db['AnalyticMetric'][_0x0a5b('0x46')](_0x50e0ff)['then'](handleEntityNotFound(_0x5d4454,null))['then'](respondWithResult(_0x5d4454,null))[_0x0a5b('0x41')](handleError(_0x5d4454,null));};exports[_0x0a5b('0x47')]=function(_0x3abd30,_0x35ab80){return db[_0x0a5b('0x2c')][_0x0a5b('0x47')](_0x3abd30[_0x0a5b('0x48')],{})[_0x0a5b('0x20')](function(_0x28e437){var _0x1a906d=_0x3abd30[_0x0a5b('0x49')][_0x0a5b('0x22')]({'plain':!![]});if(!_0x1a906d)throw new Error(_0x0a5b('0x4a'));if(_0x1a906d['role']==='user'){var _0x10b126=_0x28e437['get']({'plain':!![]});var _0xd50996=_0x0a5b('0x23');return db[_0x0a5b('0x4b')][_0x0a5b('0x46')]({'where':{'name':_0xd50996,'userProfileId':_0x1a906d[_0x0a5b('0x4c')]},'raw':!![]})[_0x0a5b('0x20')](function(_0x4f5126){if(_0x4f5126&&_0x4f5126['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a5b('0x47')]({'name':_0x10b126[_0x0a5b('0x28')],'resourceId':_0x10b126['id'],'type':_0x4f5126[_0x0a5b('0x28')],'sectionId':_0x4f5126['id']},{})['then'](function(){return _0x28e437;});}else{return _0x28e437;}})['catch'](function(_0x506f1b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x506f1b);throw _0x506f1b;});}return _0x28e437;})['then'](respondWithResult(_0x35ab80,0xc9))[_0x0a5b('0x41')](handleError(_0x35ab80,null));};exports['update']=function(_0xfb14c2,_0x64a36d){if(_0xfb14c2[_0x0a5b('0x48')]['id']){delete _0xfb14c2[_0x0a5b('0x48')]['id'];}return db[_0x0a5b('0x2c')][_0x0a5b('0x46')]({'where':{'id':_0xfb14c2[_0x0a5b('0x43')]['id']}})['then'](handleEntityNotFound(_0x64a36d,null))[_0x0a5b('0x20')](saveUpdates(_0xfb14c2[_0x0a5b('0x48')],null))['then'](respondWithResult(_0x64a36d,null))[_0x0a5b('0x41')](handleError(_0x64a36d,null));};exports['destroy']=function(_0x10f7c5,_0xae9176){return db['AnalyticMetric']['find']({'where':{'id':_0x10f7c5['params']['id']}})[_0x0a5b('0x20')](handleEntityNotFound(_0xae9176,null))[_0x0a5b('0x20')](removeEntity(_0xae9176,null))[_0x0a5b('0x41')](handleError(_0xae9176,null));}; \ No newline at end of file +var _0x74be=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count','set','Content-Range','apply','reject','save','update','destroy','Metrics','then','error','stack','name','status','send','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','offset','sort','pick','merge','where','VIRTUAL','filter','AnalyticMetric','includeAll','include','findAll','rows','catch','show','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3ca1fa,_0x44c6b6){var _0x359b9a=function(_0x14dee6){while(--_0x14dee6){_0x3ca1fa['push'](_0x3ca1fa['shift']());}};_0x359b9a(++_0x44c6b6);}(_0x74be,0x8d));var _0xe74b=function(_0x3e1e81,_0x5516f7){_0x3e1e81=_0x3e1e81-0x0;var _0x53fe04=_0x74be[_0x3e1e81];return _0x53fe04;};'use strict';var pdf=require(_0xe74b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe74b('0x1'));var zipdir=require(_0xe74b('0x2'));var jsonpatch=require(_0xe74b('0x3'));var rp=require(_0xe74b('0x4'));var moment=require(_0xe74b('0x5'));var BPromise=require(_0xe74b('0x6'));var Mustache=require('mustache');var util=require(_0xe74b('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xe74b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe74b('0x9'));var squel=require(_0xe74b('0xa'));var crypto=require('crypto');var jsforce=require(_0xe74b('0xb'));var deskjs=require(_0xe74b('0xc'));var toCsv=require(_0xe74b('0x8'));var querystring=require(_0xe74b('0xd'));var Papa=require(_0xe74b('0xe'));var Redis=require('ioredis');var authService=require(_0xe74b('0xf'));var qs=require(_0xe74b('0x10'));var as=require(_0xe74b('0x11'));var hardwareService=require(_0xe74b('0x12'));var logger=require(_0xe74b('0x13'))(_0xe74b('0x14'));var utils=require(_0xe74b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe74b('0x16'));var db=require(_0xe74b('0x17'))['db'];function respondWithStatusCode(_0x4ccd66,_0x3ece67){_0x3ece67=_0x3ece67||0xcc;return function(_0x5356aa){if(_0x5356aa){return _0x4ccd66[_0xe74b('0x18')](_0x3ece67);}return _0x4ccd66['status'](_0x3ece67)[_0xe74b('0x19')]();};}function respondWithResult(_0x622867,_0x1bfb53){_0x1bfb53=_0x1bfb53||0xc8;return function(_0x4d50cc){if(_0x4d50cc){return _0x622867['status'](_0x1bfb53)[_0xe74b('0x1a')](_0x4d50cc);}};}function respondWithFilteredResult(_0x358e31,_0x5c31e1){return function(_0x626b84){if(_0x626b84){var _0x29f16a=_0x626b84[_0xe74b('0x1b')],_0x213c5d=_0x5c31e1['offset'],_0x491c30=_0x5c31e1['offset']+_0x5c31e1['limit'],_0x590baa;if(_0x491c30>=_0x29f16a){_0x491c30=_0x29f16a;_0x590baa=0xc8;}else{_0x590baa=0xce;}_0x358e31['status'](_0x590baa);return _0x358e31[_0xe74b('0x1c')](_0xe74b('0x1d'),_0x213c5d+'-'+_0x491c30+'/'+_0x29f16a)[_0xe74b('0x1a')](_0x626b84);}return null;};}function patchUpdates(_0xff5dd7){return function(_0xb2a2f5){try{jsonpatch[_0xe74b('0x1e')](_0xb2a2f5,_0xff5dd7,!![]);}catch(_0x3f7187){return BPromise[_0xe74b('0x1f')](_0x3f7187);}return _0xb2a2f5[_0xe74b('0x20')]();};}function saveUpdates(_0x49e1e4,_0x492788){return function(_0x315ba7){if(_0x315ba7){return _0x315ba7[_0xe74b('0x21')](_0x49e1e4)['then'](function(_0x4b357b){return _0x4b357b;});}return null;};}function removeEntity(_0x1de835,_0x519187){return function(_0x17df19){if(_0x17df19){return _0x17df19[_0xe74b('0x22')]()['then'](function(){var _0x58bd8a=_0x17df19['get']({'plain':!![]});var _0x5738e7=_0xe74b('0x23');return db['UserProfileResource'][_0xe74b('0x22')]({'where':{'type':_0x5738e7,'resourceId':_0x58bd8a['id']}})['then'](function(){return _0x17df19;});})[_0xe74b('0x24')](function(){_0x1de835['status'](0xcc)[_0xe74b('0x19')]();});}};}function handleEntityNotFound(_0x56bd65,_0xeb0182){return function(_0x3cbece){if(!_0x3cbece){_0x56bd65[_0xe74b('0x18')](0x194);}return _0x3cbece;};}function handleError(_0x5ae1c5,_0x3057fe){_0x3057fe=_0x3057fe||0x1f4;return function(_0x1a43b7){logger[_0xe74b('0x25')](_0x1a43b7[_0xe74b('0x26')]);if(_0x1a43b7[_0xe74b('0x27')]){delete _0x1a43b7['name'];}_0x5ae1c5[_0xe74b('0x28')](_0x3057fe)[_0xe74b('0x29')](_0x1a43b7);};}exports['index']=function(_0x3133e5,_0x4f675e){var _0x28c1ce={},_0x36652f={},_0x4cdca9={'count':0x0,'rows':[]};var _0x510486=_[_0xe74b('0x2a')](db['AnalyticMetric'][_0xe74b('0x2b')],function(_0x1c24da){return{'name':_0x1c24da['fieldName'],'type':_0x1c24da[_0xe74b('0x2c')]['key']};});_0x36652f['model']=_[_0xe74b('0x2a')](_0x510486,_0xe74b('0x27'));_0x36652f[_0xe74b('0x2d')]=_[_0xe74b('0x2e')](_0x3133e5['query']);_0x36652f[_0xe74b('0x2f')]=_[_0xe74b('0x30')](_0x36652f[_0xe74b('0x31')],_0x36652f[_0xe74b('0x2d')]);_0x28c1ce[_0xe74b('0x32')]=_[_0xe74b('0x30')](_0x36652f['model'],qs[_0xe74b('0x33')](_0x3133e5[_0xe74b('0x2d')][_0xe74b('0x33')]));_0x28c1ce[_0xe74b('0x32')]=_0x28c1ce['attributes'][_0xe74b('0x34')]?_0x28c1ce[_0xe74b('0x32')]:_0x36652f['model'];if(!_0x3133e5[_0xe74b('0x2d')]['hasOwnProperty'](_0xe74b('0x35'))){_0x28c1ce['limit']=qs[_0xe74b('0x36')](_0x3133e5['query'][_0xe74b('0x36')]);_0x28c1ce[_0xe74b('0x37')]=qs[_0xe74b('0x37')](_0x3133e5[_0xe74b('0x2d')][_0xe74b('0x37')]);}_0x28c1ce['order']=qs[_0xe74b('0x38')](_0x3133e5[_0xe74b('0x2d')][_0xe74b('0x38')]);_0x28c1ce['where']=qs['filters'](_[_0xe74b('0x39')](_0x3133e5[_0xe74b('0x2d')],_0x36652f['filters']),_0x510486);if(_0x3133e5[_0xe74b('0x2d')]['filter']){_0x28c1ce['where']=_[_0xe74b('0x3a')](_0x28c1ce[_0xe74b('0x3b')],{'$or':_[_0xe74b('0x2a')](_0x510486,function(_0x189f1f){if(_0x189f1f[_0xe74b('0x2c')]!==_0xe74b('0x3c')){var _0x330232={};_0x330232[_0x189f1f[_0xe74b('0x27')]]={'$like':'%'+_0x3133e5[_0xe74b('0x2d')][_0xe74b('0x3d')]+'%'};return _0x330232;}})});}_0x28c1ce=_[_0xe74b('0x3a')]({},_0x28c1ce,_0x3133e5['options']);var _0x271a80={'where':_0x28c1ce[_0xe74b('0x3b')]};return db[_0xe74b('0x3e')]['count'](_0x271a80)['then'](function(_0x1fec2c){_0x4cdca9[_0xe74b('0x1b')]=_0x1fec2c;if(_0x3133e5['query'][_0xe74b('0x3f')]){_0x28c1ce[_0xe74b('0x40')]=[{'all':!![]}];}return db['AnalyticMetric'][_0xe74b('0x41')](_0x28c1ce);})['then'](function(_0x17b4c0){_0x4cdca9[_0xe74b('0x42')]=_0x17b4c0;return _0x4cdca9;})[_0xe74b('0x24')](respondWithFilteredResult(_0x4f675e,_0x28c1ce))[_0xe74b('0x43')](handleError(_0x4f675e,null));};exports[_0xe74b('0x44')]=function(_0x26c550,_0x51a0c3){var _0x3cafe5={'raw':!![],'where':{'id':_0x26c550['params']['id']}},_0x5d4340={};_0x5d4340[_0xe74b('0x31')]=_[_0xe74b('0x2e')](db['AnalyticMetric']['rawAttributes']);_0x5d4340[_0xe74b('0x2d')]=_['keys'](_0x26c550[_0xe74b('0x2d')]);_0x5d4340['filters']=_[_0xe74b('0x30')](_0x5d4340[_0xe74b('0x31')],_0x5d4340[_0xe74b('0x2d')]);_0x3cafe5[_0xe74b('0x32')]=_[_0xe74b('0x30')](_0x5d4340[_0xe74b('0x31')],qs[_0xe74b('0x33')](_0x26c550[_0xe74b('0x2d')][_0xe74b('0x33')]));_0x3cafe5[_0xe74b('0x32')]=_0x3cafe5[_0xe74b('0x32')][_0xe74b('0x34')]?_0x3cafe5[_0xe74b('0x32')]:_0x5d4340[_0xe74b('0x31')];if(_0x26c550[_0xe74b('0x2d')][_0xe74b('0x3f')]){_0x3cafe5[_0xe74b('0x40')]=[{'all':!![]}];}_0x3cafe5=_[_0xe74b('0x3a')]({},_0x3cafe5,_0x26c550[_0xe74b('0x45')]);return db['AnalyticMetric'][_0xe74b('0x46')](_0x3cafe5)[_0xe74b('0x24')](handleEntityNotFound(_0x51a0c3,null))['then'](respondWithResult(_0x51a0c3,null))[_0xe74b('0x43')](handleError(_0x51a0c3,null));};exports[_0xe74b('0x47')]=function(_0x203e4a,_0x251cd3){return db[_0xe74b('0x3e')][_0xe74b('0x47')](_0x203e4a['body'],{})[_0xe74b('0x24')](function(_0x53e516){var _0x597f14=_0x203e4a[_0xe74b('0x48')][_0xe74b('0x49')]({'plain':!![]});if(!_0x597f14)throw new Error(_0xe74b('0x4a'));if(_0x597f14[_0xe74b('0x4b')]===_0xe74b('0x48')){var _0x58ec19=_0x53e516['get']({'plain':!![]});var _0x287a01=_0xe74b('0x23');return db[_0xe74b('0x4c')]['find']({'where':{'name':_0x287a01,'userProfileId':_0x597f14[_0xe74b('0x4d')]},'raw':!![]})['then'](function(_0x26cb42){if(_0x26cb42&&_0x26cb42['autoAssociation']===0x0){return db[_0xe74b('0x4e')]['create']({'name':_0x58ec19[_0xe74b('0x27')],'resourceId':_0x58ec19['id'],'type':_0x26cb42[_0xe74b('0x27')],'sectionId':_0x26cb42['id']},{})['then'](function(){return _0x53e516;});}else{return _0x53e516;}})['catch'](function(_0x3d5a58){logger[_0xe74b('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d5a58);throw _0x3d5a58;});}return _0x53e516;})[_0xe74b('0x24')](respondWithResult(_0x251cd3,0xc9))[_0xe74b('0x43')](handleError(_0x251cd3,null));};exports[_0xe74b('0x21')]=function(_0x4d4fc5,_0x13a29e){if(_0x4d4fc5[_0xe74b('0x4f')]['id']){delete _0x4d4fc5[_0xe74b('0x4f')]['id'];}return db[_0xe74b('0x3e')][_0xe74b('0x46')]({'where':{'id':_0x4d4fc5['params']['id']}})['then'](handleEntityNotFound(_0x13a29e,null))[_0xe74b('0x24')](saveUpdates(_0x4d4fc5[_0xe74b('0x4f')],null))[_0xe74b('0x24')](respondWithResult(_0x13a29e,null))[_0xe74b('0x43')](handleError(_0x13a29e,null));};exports['destroy']=function(_0x100767,_0x20abf2){return db['AnalyticMetric'][_0xe74b('0x46')]({'where':{'id':_0x100767['params']['id']}})[_0xe74b('0x24')](handleEntityNotFound(_0x20abf2,null))[_0xe74b('0x24')](removeEntity(_0x20abf2,null))[_0xe74b('0x43')](handleError(_0x20abf2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 603a267..4ffa32b 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 _0x7527=['AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','moment','request-promise','./analyticMetric.attributes','exports','define'];(function(_0x134192,_0x36adc5){var _0x3cd080=function(_0x134371){while(--_0x134371){_0x134192['push'](_0x134192['shift']());}};_0x3cd080(++_0x36adc5);}(_0x7527,0x14c));var _0x7752=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7527[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7752('0x0'));var util=require('util');var logger=require(_0x7752('0x1'))(_0x7752('0x2'));var moment=require(_0x7752('0x3'));var BPromise=require('bluebird');var rp=require(_0x7752('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7752('0x5'));module[_0x7752('0x6')]=function(_0x72bf4b,_0x19cff8){return _0x72bf4b[_0x7752('0x7')](_0x7752('0x8'),attributes,{'tableName':_0x7752('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb467=['define','AnalyticMetric','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes'];(function(_0x1be48a,_0x3a8218){var _0x31151d=function(_0x5caf01){while(--_0x5caf01){_0x1be48a['push'](_0x1be48a['shift']());}};_0x31151d(++_0x3a8218);}(_0xb467,0x66));var _0x7b46=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0xb467[_0x1ebe90];return _0x447c82;};'use strict';var _=require('lodash');var util=require(_0x7b46('0x0'));var logger=require(_0x7b46('0x1'))(_0x7b46('0x2'));var moment=require('moment');var BPromise=require(_0x7b46('0x3'));var rp=require(_0x7b46('0x4'));var fs=require('fs');var path=require(_0x7b46('0x5'));var rimraf=require('rimraf');var config=require(_0x7b46('0x6'));var attributes=require(_0x7b46('0x7'));module['exports']=function(_0x1933f1,_0x577d70){return _0x1933f1[_0x7b46('0x8')](_0x7b46('0x9'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index c1028f4..3d0e8a3 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 _0xb22d=['message','request\x20sent','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0xb22d,0x67));var _0xdb22=function(_0x246227,_0x12bfcb){_0x246227=_0x246227-0x0;var _0x37bd4a=_0xb22d[_0x246227];return _0x37bd4a;};'use strict';var _=require(_0xdb22('0x0'));var util=require('util');var moment=require(_0xdb22('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb22('0x2'));var fs=require('fs');var Redis=require(_0xdb22('0x3'));var db=require(_0xdb22('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb22('0x5'))(_0xdb22('0x6'));var config=require(_0xdb22('0x7'));var jayson=require(_0xdb22('0x8'));var client=jayson[_0xdb22('0x9')][_0xdb22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4386ce,_0x34a48c,_0x34e8bb){return new BPromise(function(_0xe758b5,_0x27239f){return client['request'](_0x4386ce,_0x34e8bb)['then'](function(_0x54ee8b){logger[_0xdb22('0xb')](_0xdb22('0xc'),_0x34a48c,'request\x20sent');logger[_0xdb22('0xd')](_0xdb22('0xe'),_0x34a48c,'request\x20sent',JSON['stringify'](_0x54ee8b));if(_0x54ee8b[_0xdb22('0xf')]){if(_0x54ee8b[_0xdb22('0xf')][_0xdb22('0x10')]===0x1f4){logger[_0xdb22('0xf')](_0xdb22('0xc'),_0x34a48c,_0x54ee8b[_0xdb22('0xf')][_0xdb22('0x11')]);return _0x27239f(_0x54ee8b[_0xdb22('0xf')][_0xdb22('0x11')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x34a48c,_0x54ee8b[_0xdb22('0xf')][_0xdb22('0x11')]);return _0xe758b5(_0x54ee8b['error'][_0xdb22('0x11')]);}else{logger[_0xdb22('0xb')]('AnalyticMetric,\x20%s,\x20%s',_0x34a48c,_0xdb22('0x12'));_0xe758b5(_0x54ee8b[_0xdb22('0x13')][_0xdb22('0x11')]);}})['catch'](function(_0x426a08){logger[_0xdb22('0xf')](_0xdb22('0xc'),_0x34a48c,_0x426a08);_0x27239f(_0x426a08);});});} \ No newline at end of file +var _0x2e9b=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','result','moment'];(function(_0x44913c,_0x754aad){var _0x4b7ca2=function(_0x35345e){while(--_0x35345e){_0x44913c['push'](_0x44913c['shift']());}};_0x4b7ca2(++_0x754aad);}(_0x2e9b,0x179));var _0xb2e9=function(_0x373767,_0x3b3587){_0x373767=_0x373767-0x0;var _0xd808fb=_0x2e9b[_0x373767];return _0xd808fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb2e9('0x0'));var BPromise=require(_0xb2e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2e9('0x2'));var db=require(_0xb2e9('0x3'))['db'];var utils=require(_0xb2e9('0x4'));var logger=require(_0xb2e9('0x5'))(_0xb2e9('0x6'));var config=require(_0xb2e9('0x7'));var jayson=require(_0xb2e9('0x8'));var client=jayson[_0xb2e9('0x9')][_0xb2e9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12eb46,_0xb4bec,_0x418aa9){return new BPromise(function(_0x370d36,_0x194128){return client[_0xb2e9('0xb')](_0x12eb46,_0x418aa9)[_0xb2e9('0xc')](function(_0x304d52){logger[_0xb2e9('0xd')](_0xb2e9('0xe'),_0xb4bec,_0xb2e9('0xf'));logger[_0xb2e9('0x10')](_0xb2e9('0x11'),_0xb4bec,_0xb2e9('0xf'),JSON['stringify'](_0x304d52));if(_0x304d52['error']){if(_0x304d52['error']['code']===0x1f4){logger[_0xb2e9('0x12')](_0xb2e9('0xe'),_0xb4bec,_0x304d52[_0xb2e9('0x12')]['message']);return _0x194128(_0x304d52['error'][_0xb2e9('0x13')]);}logger[_0xb2e9('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0xb4bec,_0x304d52[_0xb2e9('0x12')][_0xb2e9('0x13')]);return _0x370d36(_0x304d52[_0xb2e9('0x12')][_0xb2e9('0x13')]);}else{logger['info'](_0xb2e9('0xe'),_0xb4bec,_0xb2e9('0xf'));_0x370d36(_0x304d52[_0xb2e9('0x14')][_0xb2e9('0x13')]);}})['catch'](function(_0x2275f3){logger['error'](_0xb2e9('0xe'),_0xb4bec,_0x2275f3);_0x194128(_0x2275f3);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3d0f4c2..71eebdd 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 _0x7880=['Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0x7880,0x1f4));var _0x0788=function(_0x8b9e62,_0x173b44){_0x8b9e62=_0x8b9e62-0x0;var _0x31a9a0=_0x7880[_0x8b9e62];return _0x31a9a0;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var auth=require(_0x0788('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0788('0x6'));var controller=require(_0x0788('0x7'));router[_0x0788('0x8')]('/',auth[_0x0788('0x9')](),controller[_0x0788('0xa')]);router[_0x0788('0x8')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0xc')]);router[_0x0788('0xd')]('/',auth['isAuthenticated'](),controller[_0x0788('0xe')]);router['put'](_0x0788('0xb'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router[_0x0788('0x10')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2675=['post','put','update','delete','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x191f98,_0x30dcf4){var _0x4bc96f=function(_0xc91b37){while(--_0xc91b37){_0x191f98['push'](_0x191f98['shift']());}};_0x4bc96f(++_0x30dcf4);}(_0x2675,0x75));var _0x5267=function(_0x56e75d,_0x1b2f85){_0x56e75d=_0x56e75d-0x0;var _0x380ca8=_0x2675[_0x56e75d];return _0x380ca8;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./analyticMetric.controller');router[_0x5267('0x5')]('/',auth[_0x5267('0x6')](),controller[_0x5267('0x7')]);router[_0x5267('0x5')](_0x5267('0x8'),auth[_0x5267('0x6')](),controller['show']);router[_0x5267('0x9')]('/',auth[_0x5267('0x6')](),controller['create']);router[_0x5267('0xa')]('/:id',auth[_0x5267('0x6')](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x6')](),controller['destroy']);module[_0x5267('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index e60c9fa..b850104 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 _0x0ccc=['exports'];(function(_0x1a31aa,_0x27f6eb){var _0xd1de65=function(_0x843f4e){while(--_0x843f4e){_0x1a31aa['push'](_0x1a31aa['shift']());}};_0xd1de65(++_0x27f6eb);}(_0x0ccc,0x19c));var _0xc0cc=function(_0x5c8a84,_0xfd6bba){_0x5c8a84=_0x5c8a84-0x0;var _0x276b31=_0x0ccc[_0x5c8a84];return _0x276b31;};'use strict';var Sequelize=require('sequelize');module[_0xc0cc('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x0437=['exports','TEXT'];(function(_0x1a1ef8,_0x275a0b){var _0x3da82e=function(_0x3558e0){while(--_0x3558e0){_0x1a1ef8['push'](_0x1a1ef8['shift']());}};_0x3da82e(++_0x275a0b);}(_0x0437,0x116));var _0x7043=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x0437[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require('sequelize');module[_0x7043('0x0')]={'tree':{'type':Sequelize[_0x7043('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index ae3a545..1c65bd4 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 _0xb1b4=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','filter','where','type','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb1b4,0xde));var _0x4b1b=function(_0x49d19d,_0x245cf5){_0x49d19d=_0x49d19d-0x0;var _0x4ebef1=_0xb1b4[_0x49d19d];return _0x4ebef1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4b1b('0x0'));var rimraf=require(_0x4b1b('0x1'));var zipdir=require(_0x4b1b('0x2'));var jsonpatch=require(_0x4b1b('0x3'));var rp=require(_0x4b1b('0x4'));var moment=require(_0x4b1b('0x5'));var BPromise=require(_0x4b1b('0x6'));var Mustache=require(_0x4b1b('0x7'));var util=require(_0x4b1b('0x8'));var path=require(_0x4b1b('0x9'));var sox=require(_0x4b1b('0xa'));var csv=require(_0x4b1b('0xb'));var ejs=require(_0x4b1b('0xc'));var fs=require('fs');var _=require(_0x4b1b('0xd'));var squel=require('squel');var crypto=require(_0x4b1b('0xe'));var jsforce=require(_0x4b1b('0xf'));var deskjs=require(_0x4b1b('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4b1b('0x11'));var Redis=require(_0x4b1b('0x12'));var authService=require(_0x4b1b('0x13'));var qs=require(_0x4b1b('0x14'));var as=require(_0x4b1b('0x15'));var hardwareService=require(_0x4b1b('0x16'));var logger=require(_0x4b1b('0x17'))(_0x4b1b('0x18'));var utils=require(_0x4b1b('0x19'));var config=require(_0x4b1b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b1b('0x1b'))['db'];function respondWithStatusCode(_0x24b85e,_0x271719){_0x271719=_0x271719||0xcc;return function(_0x13930f){if(_0x13930f){return _0x24b85e['sendStatus'](_0x271719);}return _0x24b85e['status'](_0x271719)['end']();};}function respondWithResult(_0x24cf4a,_0x345935){_0x345935=_0x345935||0xc8;return function(_0x24acb6){if(_0x24acb6){return _0x24cf4a[_0x4b1b('0x1c')](_0x345935)[_0x4b1b('0x1d')](_0x24acb6);}};}function respondWithFilteredResult(_0xa1db4f,_0x13b359){return function(_0x3ae2c8){if(_0x3ae2c8){var _0x4e90bd=_0x3ae2c8['count'],_0x21f7d0=_0x13b359[_0x4b1b('0x1e')],_0x20648d=_0x13b359[_0x4b1b('0x1e')]+_0x13b359[_0x4b1b('0x1f')],_0x1e5bd4;if(_0x20648d>=_0x4e90bd){_0x20648d=_0x4e90bd;_0x1e5bd4=0xc8;}else{_0x1e5bd4=0xce;}_0xa1db4f[_0x4b1b('0x1c')](_0x1e5bd4);return _0xa1db4f[_0x4b1b('0x20')](_0x4b1b('0x21'),_0x21f7d0+'-'+_0x20648d+'/'+_0x4e90bd)[_0x4b1b('0x1d')](_0x3ae2c8);}return null;};}function patchUpdates(_0x5ee2b7){return function(_0x40d650){try{jsonpatch[_0x4b1b('0x22')](_0x40d650,_0x5ee2b7,!![]);}catch(_0x5923cf){return BPromise[_0x4b1b('0x23')](_0x5923cf);}return _0x40d650['save']();};}function saveUpdates(_0x2d91c5,_0x341b33){return function(_0x3d9fca){if(_0x3d9fca){return _0x3d9fca[_0x4b1b('0x24')](_0x2d91c5)[_0x4b1b('0x25')](function(_0x7d3d96){return _0x7d3d96;});}return null;};}function removeEntity(_0x4e43ba,_0x4e7f77){return function(_0x30c0df){if(_0x30c0df){return _0x30c0df[_0x4b1b('0x26')]()[_0x4b1b('0x25')](function(){_0x4e43ba['status'](0xcc)[_0x4b1b('0x27')]();});}};}function handleEntityNotFound(_0x2b18af,_0x23c538){return function(_0x3548ef){if(!_0x3548ef){_0x2b18af[_0x4b1b('0x28')](0x194);}return _0x3548ef;};}function handleError(_0xa4679d,_0x154300){_0x154300=_0x154300||0x1f4;return function(_0x981047){logger[_0x4b1b('0x29')](_0x981047[_0x4b1b('0x2a')]);if(_0x981047['name']){delete _0x981047[_0x4b1b('0x2b')];}_0xa4679d[_0x4b1b('0x1c')](_0x154300)[_0x4b1b('0x2c')](_0x981047);};}exports[_0x4b1b('0x2d')]=function(_0x599a60,_0x1a701e){var _0x479443={},_0x3cd954={},_0x77f585={'count':0x0,'rows':[]};var _0x55cae1=_[_0x4b1b('0x2e')](db[_0x4b1b('0x2f')][_0x4b1b('0x30')],function(_0x4c49d4){return{'name':_0x4c49d4[_0x4b1b('0x31')],'type':_0x4c49d4['type'][_0x4b1b('0x32')]};});_0x3cd954[_0x4b1b('0x33')]=_[_0x4b1b('0x2e')](_0x55cae1,_0x4b1b('0x2b'));_0x3cd954['query']=_[_0x4b1b('0x34')](_0x599a60['query']);_0x3cd954[_0x4b1b('0x35')]=_['intersection'](_0x3cd954['model'],_0x3cd954[_0x4b1b('0x36')]);_0x479443[_0x4b1b('0x37')]=_[_0x4b1b('0x38')](_0x3cd954[_0x4b1b('0x33')],qs[_0x4b1b('0x39')](_0x599a60[_0x4b1b('0x36')]['fields']));_0x479443[_0x4b1b('0x37')]=_0x479443[_0x4b1b('0x37')][_0x4b1b('0x3a')]?_0x479443['attributes']:_0x3cd954[_0x4b1b('0x33')];if(!_0x599a60[_0x4b1b('0x36')][_0x4b1b('0x3b')](_0x4b1b('0x3c'))){_0x479443[_0x4b1b('0x1f')]=qs[_0x4b1b('0x1f')](_0x599a60[_0x4b1b('0x36')][_0x4b1b('0x1f')]);_0x479443[_0x4b1b('0x1e')]=qs[_0x4b1b('0x1e')](_0x599a60[_0x4b1b('0x36')][_0x4b1b('0x1e')]);}_0x479443[_0x4b1b('0x3d')]=qs['sort'](_0x599a60[_0x4b1b('0x36')]['sort']);_0x479443['where']=qs[_0x4b1b('0x35')](_[_0x4b1b('0x3e')](_0x599a60[_0x4b1b('0x36')],_0x3cd954[_0x4b1b('0x35')]),_0x55cae1);if(_0x599a60['query'][_0x4b1b('0x3f')]){_0x479443['where']=_['merge'](_0x479443[_0x4b1b('0x40')],{'$or':_[_0x4b1b('0x2e')](_0x55cae1,function(_0x2d74df){if(_0x2d74df[_0x4b1b('0x41')]!==_0x4b1b('0x42')){var _0x35f53c={};_0x35f53c[_0x2d74df[_0x4b1b('0x2b')]]={'$like':'%'+_0x599a60[_0x4b1b('0x36')][_0x4b1b('0x3f')]+'%'};return _0x35f53c;}})});}_0x479443=_[_0x4b1b('0x43')]({},_0x479443,_0x599a60[_0x4b1b('0x44')]);var _0x43e7e1={'where':_0x479443[_0x4b1b('0x40')]};return db['AnalyticTreeReport'][_0x4b1b('0x45')](_0x43e7e1)['then'](function(_0x3faa56){_0x77f585[_0x4b1b('0x45')]=_0x3faa56;if(_0x599a60['query'][_0x4b1b('0x46')]){_0x479443[_0x4b1b('0x47')]=[{'all':!![]}];}return db[_0x4b1b('0x2f')]['findAll'](_0x479443);})[_0x4b1b('0x25')](function(_0x3a3406){_0x77f585[_0x4b1b('0x48')]=_0x3a3406;return _0x77f585;})[_0x4b1b('0x25')](respondWithFilteredResult(_0x1a701e,_0x479443))['catch'](handleError(_0x1a701e,null));};exports[_0x4b1b('0x49')]=function(_0x59c8bb,_0xda889e){var _0x4dacfe={'raw':!![],'where':{'id':_0x59c8bb[_0x4b1b('0x4a')]['id']}},_0x4fbc0f={};_0x4fbc0f[_0x4b1b('0x33')]=_[_0x4b1b('0x34')](db['AnalyticTreeReport'][_0x4b1b('0x30')]);_0x4fbc0f[_0x4b1b('0x36')]=_[_0x4b1b('0x34')](_0x59c8bb['query']);_0x4fbc0f[_0x4b1b('0x35')]=_[_0x4b1b('0x38')](_0x4fbc0f['model'],_0x4fbc0f[_0x4b1b('0x36')]);_0x4dacfe[_0x4b1b('0x37')]=_['intersection'](_0x4fbc0f[_0x4b1b('0x33')],qs[_0x4b1b('0x39')](_0x59c8bb[_0x4b1b('0x36')][_0x4b1b('0x39')]));_0x4dacfe[_0x4b1b('0x37')]=_0x4dacfe[_0x4b1b('0x37')]['length']?_0x4dacfe[_0x4b1b('0x37')]:_0x4fbc0f[_0x4b1b('0x33')];if(_0x59c8bb[_0x4b1b('0x36')][_0x4b1b('0x46')]){_0x4dacfe[_0x4b1b('0x47')]=[{'all':!![]}];}_0x4dacfe=_[_0x4b1b('0x43')]({},_0x4dacfe,_0x59c8bb['options']);return db[_0x4b1b('0x2f')][_0x4b1b('0x4b')](_0x4dacfe)[_0x4b1b('0x25')](handleEntityNotFound(_0xda889e,null))[_0x4b1b('0x25')](respondWithResult(_0xda889e,null))[_0x4b1b('0x4c')](handleError(_0xda889e,null));};exports[_0x4b1b('0x4d')]=function(_0x56aac7,_0x30e60e){return db[_0x4b1b('0x2f')][_0x4b1b('0x4d')](_0x56aac7['body'],{})[_0x4b1b('0x25')](respondWithResult(_0x30e60e,0xc9))[_0x4b1b('0x4c')](handleError(_0x30e60e,null));};exports[_0x4b1b('0x24')]=function(_0x402861,_0x4cc6bd){if(_0x402861[_0x4b1b('0x4e')]['id']){delete _0x402861[_0x4b1b('0x4e')]['id'];}return db[_0x4b1b('0x2f')][_0x4b1b('0x4b')]({'where':{'id':_0x402861['params']['id']}})['then'](handleEntityNotFound(_0x4cc6bd,null))[_0x4b1b('0x25')](saveUpdates(_0x402861[_0x4b1b('0x4e')],null))[_0x4b1b('0x25')](respondWithResult(_0x4cc6bd,null))[_0x4b1b('0x4c')](handleError(_0x4cc6bd,null));};exports[_0x4b1b('0x26')]=function(_0x202957,_0x5667a6){return db[_0x4b1b('0x2f')]['find']({'where':{'id':_0x202957['params']['id']}})[_0x4b1b('0x25')](handleEntityNotFound(_0x5667a6,null))[_0x4b1b('0x25')](removeEntity(_0x5667a6,null))[_0x4b1b('0x4c')](handleError(_0x5667a6,null));}; \ No newline at end of file +var _0x6be6=['error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','AnalyticTreeReport','includeAll','include','rows','show','params','keys','options','find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','end','sendStatus'];(function(_0x103882,_0x185710){var _0x326fc7=function(_0x486a87){while(--_0x486a87){_0x103882['push'](_0x103882['shift']());}};_0x326fc7(++_0x185710);}(_0x6be6,0xfa));var _0x66be=function(_0x2dd10c,_0x2e3d35){_0x2dd10c=_0x2dd10c-0x0;var _0x27575e=_0x6be6[_0x2dd10c];return _0x27575e;};'use strict';var pdf=require(_0x66be('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x66be('0x1'));var zipdir=require(_0x66be('0x2'));var jsonpatch=require(_0x66be('0x3'));var rp=require(_0x66be('0x4'));var moment=require('moment');var BPromise=require(_0x66be('0x5'));var Mustache=require('mustache');var util=require(_0x66be('0x6'));var path=require(_0x66be('0x7'));var sox=require(_0x66be('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x66be('0x9'));var crypto=require(_0x66be('0xa'));var jsforce=require(_0x66be('0xb'));var deskjs=require(_0x66be('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x66be('0xd'));var Redis=require('ioredis');var authService=require(_0x66be('0xe'));var qs=require(_0x66be('0xf'));var as=require(_0x66be('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x66be('0x11'));var utils=require(_0x66be('0x12'));var config=require(_0x66be('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x66be('0x14'))['db'];function respondWithStatusCode(_0x2169b0,_0x49f353){_0x49f353=_0x49f353||0xcc;return function(_0x21f229){if(_0x21f229){return _0x2169b0['sendStatus'](_0x49f353);}return _0x2169b0[_0x66be('0x15')](_0x49f353)['end']();};}function respondWithResult(_0x4333b6,_0x3abd2d){_0x3abd2d=_0x3abd2d||0xc8;return function(_0x4e0513){if(_0x4e0513){return _0x4333b6[_0x66be('0x15')](_0x3abd2d)[_0x66be('0x16')](_0x4e0513);}};}function respondWithFilteredResult(_0x3761e1,_0x1061ed){return function(_0x3297f4){if(_0x3297f4){var _0x579537=_0x3297f4[_0x66be('0x17')],_0x3a8661=_0x1061ed['offset'],_0x1e503b=_0x1061ed[_0x66be('0x18')]+_0x1061ed['limit'],_0x20b0d5;if(_0x1e503b>=_0x579537){_0x1e503b=_0x579537;_0x20b0d5=0xc8;}else{_0x20b0d5=0xce;}_0x3761e1[_0x66be('0x15')](_0x20b0d5);return _0x3761e1[_0x66be('0x19')](_0x66be('0x1a'),_0x3a8661+'-'+_0x1e503b+'/'+_0x579537)[_0x66be('0x16')](_0x3297f4);}return null;};}function patchUpdates(_0x3f0942){return function(_0x5b875e){try{jsonpatch['apply'](_0x5b875e,_0x3f0942,!![]);}catch(_0x53f123){return BPromise[_0x66be('0x1b')](_0x53f123);}return _0x5b875e[_0x66be('0x1c')]();};}function saveUpdates(_0x3681cf,_0x42aafc){return function(_0x34f67c){if(_0x34f67c){return _0x34f67c[_0x66be('0x1d')](_0x3681cf)[_0x66be('0x1e')](function(_0x51696a){return _0x51696a;});}return null;};}function removeEntity(_0x2c3625,_0x424595){return function(_0x358196){if(_0x358196){return _0x358196[_0x66be('0x1f')]()[_0x66be('0x1e')](function(){_0x2c3625[_0x66be('0x15')](0xcc)[_0x66be('0x20')]();});}};}function handleEntityNotFound(_0x304959,_0x189053){return function(_0x1f6e42){if(!_0x1f6e42){_0x304959[_0x66be('0x21')](0x194);}return _0x1f6e42;};}function handleError(_0x3f1dad,_0x3baab5){_0x3baab5=_0x3baab5||0x1f4;return function(_0x154b72){logger[_0x66be('0x22')](_0x154b72[_0x66be('0x23')]);if(_0x154b72[_0x66be('0x24')]){delete _0x154b72[_0x66be('0x24')];}_0x3f1dad[_0x66be('0x15')](_0x3baab5)[_0x66be('0x25')](_0x154b72);};}exports[_0x66be('0x26')]=function(_0x14ef53,_0x17655d){var _0x29249a={},_0x33e782={},_0x19d82a={'count':0x0,'rows':[]};var _0x421c52=_[_0x66be('0x27')](db['AnalyticTreeReport'][_0x66be('0x28')],function(_0x442a58){return{'name':_0x442a58[_0x66be('0x29')],'type':_0x442a58[_0x66be('0x2a')][_0x66be('0x2b')]};});_0x33e782[_0x66be('0x2c')]=_['map'](_0x421c52,'name');_0x33e782['query']=_['keys'](_0x14ef53[_0x66be('0x2d')]);_0x33e782[_0x66be('0x2e')]=_[_0x66be('0x2f')](_0x33e782['model'],_0x33e782[_0x66be('0x2d')]);_0x29249a[_0x66be('0x30')]=_[_0x66be('0x2f')](_0x33e782[_0x66be('0x2c')],qs[_0x66be('0x31')](_0x14ef53[_0x66be('0x2d')][_0x66be('0x31')]));_0x29249a[_0x66be('0x30')]=_0x29249a[_0x66be('0x30')][_0x66be('0x32')]?_0x29249a['attributes']:_0x33e782[_0x66be('0x2c')];if(!_0x14ef53[_0x66be('0x2d')]['hasOwnProperty'](_0x66be('0x33'))){_0x29249a['limit']=qs[_0x66be('0x34')](_0x14ef53[_0x66be('0x2d')][_0x66be('0x34')]);_0x29249a[_0x66be('0x18')]=qs[_0x66be('0x18')](_0x14ef53[_0x66be('0x2d')][_0x66be('0x18')]);}_0x29249a[_0x66be('0x35')]=qs[_0x66be('0x36')](_0x14ef53[_0x66be('0x2d')][_0x66be('0x36')]);_0x29249a[_0x66be('0x37')]=qs['filters'](_['pick'](_0x14ef53[_0x66be('0x2d')],_0x33e782['filters']),_0x421c52);if(_0x14ef53[_0x66be('0x2d')][_0x66be('0x38')]){_0x29249a['where']=_['merge'](_0x29249a[_0x66be('0x37')],{'$or':_[_0x66be('0x27')](_0x421c52,function(_0x1c2d88){if(_0x1c2d88[_0x66be('0x2a')]!==_0x66be('0x39')){var _0x4ce9a9={};_0x4ce9a9[_0x1c2d88[_0x66be('0x24')]]={'$like':'%'+_0x14ef53[_0x66be('0x2d')]['filter']+'%'};return _0x4ce9a9;}})});}_0x29249a=_[_0x66be('0x3a')]({},_0x29249a,_0x14ef53['options']);var _0x52fa68={'where':_0x29249a[_0x66be('0x37')]};return db[_0x66be('0x3b')][_0x66be('0x17')](_0x52fa68)[_0x66be('0x1e')](function(_0x19b53){_0x19d82a[_0x66be('0x17')]=_0x19b53;if(_0x14ef53[_0x66be('0x2d')][_0x66be('0x3c')]){_0x29249a[_0x66be('0x3d')]=[{'all':!![]}];}return db[_0x66be('0x3b')]['findAll'](_0x29249a);})[_0x66be('0x1e')](function(_0x3c1b7e){_0x19d82a[_0x66be('0x3e')]=_0x3c1b7e;return _0x19d82a;})['then'](respondWithFilteredResult(_0x17655d,_0x29249a))['catch'](handleError(_0x17655d,null));};exports[_0x66be('0x3f')]=function(_0x57139c,_0x129741){var _0x432418={'raw':!![],'where':{'id':_0x57139c[_0x66be('0x40')]['id']}},_0x262290={};_0x262290[_0x66be('0x2c')]=_[_0x66be('0x41')](db[_0x66be('0x3b')][_0x66be('0x28')]);_0x262290[_0x66be('0x2d')]=_['keys'](_0x57139c[_0x66be('0x2d')]);_0x262290[_0x66be('0x2e')]=_['intersection'](_0x262290[_0x66be('0x2c')],_0x262290[_0x66be('0x2d')]);_0x432418['attributes']=_['intersection'](_0x262290[_0x66be('0x2c')],qs[_0x66be('0x31')](_0x57139c[_0x66be('0x2d')]['fields']));_0x432418[_0x66be('0x30')]=_0x432418[_0x66be('0x30')][_0x66be('0x32')]?_0x432418['attributes']:_0x262290['model'];if(_0x57139c[_0x66be('0x2d')][_0x66be('0x3c')]){_0x432418['include']=[{'all':!![]}];}_0x432418=_['merge']({},_0x432418,_0x57139c[_0x66be('0x42')]);return db[_0x66be('0x3b')][_0x66be('0x43')](_0x432418)[_0x66be('0x1e')](handleEntityNotFound(_0x129741,null))[_0x66be('0x1e')](respondWithResult(_0x129741,null))[_0x66be('0x44')](handleError(_0x129741,null));};exports['create']=function(_0x2a29f8,_0x5268f6){return db[_0x66be('0x3b')][_0x66be('0x45')](_0x2a29f8['body'],{})[_0x66be('0x1e')](respondWithResult(_0x5268f6,0xc9))[_0x66be('0x44')](handleError(_0x5268f6,null));};exports['update']=function(_0x2613a2,_0x1a4e45){if(_0x2613a2[_0x66be('0x46')]['id']){delete _0x2613a2[_0x66be('0x46')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x2613a2[_0x66be('0x40')]['id']}})[_0x66be('0x1e')](handleEntityNotFound(_0x1a4e45,null))[_0x66be('0x1e')](saveUpdates(_0x2613a2['body'],null))[_0x66be('0x1e')](respondWithResult(_0x1a4e45,null))[_0x66be('0x44')](handleError(_0x1a4e45,null));};exports[_0x66be('0x1f')]=function(_0x1b829d,_0x566ac0){return db['AnalyticTreeReport']['find']({'where':{'id':_0x1b829d[_0x66be('0x40')]['id']}})[_0x66be('0x1e')](handleEntityNotFound(_0x566ac0,null))[_0x66be('0x1e')](removeEntity(_0x566ac0,null))['catch'](handleError(_0x566ac0,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 767e20a..92fdbf4 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 _0xe2fe=['../../config/environment','exports','define','AnalyticTreeReport','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x97c6ea,_0x4cffce){var _0x2d7f50=function(_0x54010e){while(--_0x54010e){_0x97c6ea['push'](_0x97c6ea['shift']());}};_0x2d7f50(++_0x4cffce);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc48=['rimraf','./analyticTreeReport.attributes','define','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x247b1d,_0x36e266){var _0x1fdbb6=function(_0x598856){while(--_0x598856){_0x247b1d['push'](_0x247b1d['shift']());}};_0x1fdbb6(++_0x36e266);}(_0xbc48,0x111));var _0x8bc4=function(_0x26120e,_0x5de509){_0x26120e=_0x26120e-0x0;var _0x362934=_0xbc48[_0x26120e];return _0x362934;};'use strict';var _=require(_0x8bc4('0x0'));var util=require(_0x8bc4('0x1'));var logger=require(_0x8bc4('0x2'))(_0x8bc4('0x3'));var moment=require('moment');var BPromise=require(_0x8bc4('0x4'));var rp=require(_0x8bc4('0x5'));var fs=require('fs');var path=require(_0x8bc4('0x6'));var rimraf=require(_0x8bc4('0x7'));var config=require('../../config/environment');var attributes=require(_0x8bc4('0x8'));module['exports']=function(_0x59e2cc,_0x5ebb13){return _0x59e2cc[_0x8bc4('0x9')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 04f78d5..71c398e 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 _0x2dad=['then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x20c3fc,_0x12080c){var _0xafcb51=function(_0x424a81){while(--_0x424a81){_0x20c3fc['push'](_0x20c3fc['shift']());}};_0xafcb51(++_0x12080c);}(_0x2dad,0x191));var _0xd2da=function(_0xdcb8cd,_0x36101e){_0xdcb8cd=_0xdcb8cd-0x0;var _0x3ab311=_0x2dad[_0xdcb8cd];return _0x3ab311;};'use strict';var _=require(_0xd2da('0x0'));var util=require('util');var moment=require(_0xd2da('0x1'));var BPromise=require(_0xd2da('0x2'));var rs=require(_0xd2da('0x3'));var fs=require('fs');var Redis=require(_0xd2da('0x4'));var db=require(_0xd2da('0x5'))['db'];var utils=require(_0xd2da('0x6'));var logger=require('../../config/logger')(_0xd2da('0x7'));var config=require(_0xd2da('0x8'));var jayson=require(_0xd2da('0x9'));var client=jayson[_0xd2da('0xa')][_0xd2da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16bff6,_0x1e9e83,_0x1ea256){return new BPromise(function(_0xaacae5,_0x5006c8){return client[_0xd2da('0xc')](_0x16bff6,_0x1ea256)[_0xd2da('0xd')](function(_0x17f376){logger['info'](_0xd2da('0xe'),_0x1e9e83,_0xd2da('0xf'));logger[_0xd2da('0x10')](_0xd2da('0x11'),_0x1e9e83,'request\x20sent',JSON[_0xd2da('0x12')](_0x17f376));if(_0x17f376[_0xd2da('0x13')]){if(_0x17f376[_0xd2da('0x13')][_0xd2da('0x14')]===0x1f4){logger[_0xd2da('0x13')](_0xd2da('0xe'),_0x1e9e83,_0x17f376[_0xd2da('0x13')][_0xd2da('0x15')]);return _0x5006c8(_0x17f376[_0xd2da('0x13')][_0xd2da('0x15')]);}logger['error'](_0xd2da('0xe'),_0x1e9e83,_0x17f376[_0xd2da('0x13')][_0xd2da('0x15')]);return _0xaacae5(_0x17f376[_0xd2da('0x13')][_0xd2da('0x15')]);}else{logger[_0xd2da('0x16')](_0xd2da('0xe'),_0x1e9e83,_0xd2da('0xf'));_0xaacae5(_0x17f376['result'][_0xd2da('0x15')]);}})['catch'](function(_0x2eb652){logger[_0xd2da('0x13')](_0xd2da('0xe'),_0x1e9e83,_0x2eb652);_0x5006c8(_0x2eb652);});});} \ No newline at end of file +var _0x3a21=['jayson/promise','client','http','request','then','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x41ac5c,_0x300a26){var _0xeb9c12=function(_0x587593){while(--_0x587593){_0x41ac5c['push'](_0x41ac5c['shift']());}};_0xeb9c12(++_0x300a26);}(_0x3a21,0x117));var _0x13a2=function(_0x1bbbe1,_0x4d7456){_0x1bbbe1=_0x1bbbe1-0x0;var _0x1f8839=_0x3a21[_0x1bbbe1];return _0x1f8839;};'use strict';var _=require('lodash');var util=require(_0x13a2('0x0'));var moment=require(_0x13a2('0x1'));var BPromise=require(_0x13a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x13a2('0x3'));var db=require(_0x13a2('0x4'))['db'];var utils=require(_0x13a2('0x5'));var logger=require(_0x13a2('0x6'))(_0x13a2('0x7'));var config=require(_0x13a2('0x8'));var jayson=require(_0x13a2('0x9'));var client=jayson[_0x13a2('0xa')][_0x13a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x409f1b,_0x59d905,_0x4c9eb7){return new BPromise(function(_0x4ae8b7,_0x10d0c2){return client[_0x13a2('0xc')](_0x409f1b,_0x4c9eb7)[_0x13a2('0xd')](function(_0x2b3a65){logger['info']('AnalyticTreeReport,\x20%s,\x20%s',_0x59d905,_0x13a2('0xe'));logger[_0x13a2('0xf')](_0x13a2('0x10'),_0x59d905,'request\x20sent',JSON[_0x13a2('0x11')](_0x2b3a65));if(_0x2b3a65[_0x13a2('0x12')]){if(_0x2b3a65['error'][_0x13a2('0x13')]===0x1f4){logger[_0x13a2('0x12')](_0x13a2('0x14'),_0x59d905,_0x2b3a65[_0x13a2('0x12')][_0x13a2('0x15')]);return _0x10d0c2(_0x2b3a65[_0x13a2('0x12')][_0x13a2('0x15')]);}logger[_0x13a2('0x12')](_0x13a2('0x14'),_0x59d905,_0x2b3a65[_0x13a2('0x12')][_0x13a2('0x15')]);return _0x4ae8b7(_0x2b3a65[_0x13a2('0x12')][_0x13a2('0x15')]);}else{logger[_0x13a2('0x16')](_0x13a2('0x14'),_0x59d905,'request\x20sent');_0x4ae8b7(_0x2b3a65[_0x13a2('0x17')]['message']);}})['catch'](function(_0x19e988){logger[_0x13a2('0x12')]('AnalyticTreeReport,\x20%s,\x20%s',_0x59d905,_0x19e988);_0x10d0c2(_0x19e988);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 2df73ac..2a14056 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 _0x17f8=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x17f8,0x1cd));var _0x817f=function(_0x2d78a4,_0x362f5){_0x2d78a4=_0x2d78a4-0x0;var _0x38d29a=_0x17f8[_0x2d78a4];return _0x38d29a;};'use strict';var multer=require(_0x817f('0x0'));var util=require(_0x817f('0x1'));var path=require(_0x817f('0x2'));var timeout=require(_0x817f('0x3'));var express=require(_0x817f('0x4'));var router=express[_0x817f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x817f('0x6'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x817f('0x7')]('/',auth[_0x817f('0x8')](),controller[_0x817f('0x9')]);router[_0x817f('0x7')](_0x817f('0xa'),auth[_0x817f('0x8')](),controller[_0x817f('0xb')]);router['post']('/',auth[_0x817f('0x8')](),controller[_0x817f('0xc')]);router[_0x817f('0xd')](_0x817f('0xa'),auth[_0x817f('0x8')](),controller[_0x817f('0xe')]);router[_0x817f('0xf')](_0x817f('0xa'),auth['isAuthenticated'](),controller[_0x817f('0x10')]);module[_0x817f('0x11')]=router; \ No newline at end of file +var _0x65ab=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','show','post'];(function(_0x33d3c9,_0x2c95a8){var _0x1b9229=function(_0x1d4faf){while(--_0x1d4faf){_0x33d3c9['push'](_0x33d3c9['shift']());}};_0x1b9229(++_0x2c95a8);}(_0x65ab,0x66));var _0xb65a=function(_0x1ff0cb,_0x2b1303){_0x1ff0cb=_0x1ff0cb-0x0;var _0x1afb20=_0x65ab[_0x1ff0cb];return _0x1afb20;};'use strict';var multer=require('multer');var util=require(_0xb65a('0x0'));var path=require(_0xb65a('0x1'));var timeout=require('connect-timeout');var express=require(_0xb65a('0x2'));var router=express[_0xb65a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb65a('0x4'));var config=require(_0xb65a('0x5'));var controller=require(_0xb65a('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xb65a('0x7')](),controller[_0xb65a('0x8')]);router[_0xb65a('0x9')]('/',auth[_0xb65a('0x7')](),controller[_0xb65a('0xa')]);router[_0xb65a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xb65a('0xc')]);router[_0xb65a('0xd')]('/:id',auth[_0xb65a('0x7')](),controller[_0xb65a('0xe')]);module[_0xb65a('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f5155d7..10f8086 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 _0x6999=['STRING','exports'];(function(_0x315a70,_0x3478fd){var _0xbc6674=function(_0x255642){while(--_0x255642){_0x315a70['push'](_0x315a70['shift']());}};_0xbc6674(++_0x3478fd);}(_0x6999,0xff));var _0x9699=function(_0x25cd01,_0x24c3ad){_0x25cd01=_0x25cd01-0x0;var _0x1176cf=_0x6999[_0x25cd01];return _0x1176cf;};'use strict';var Sequelize=require('sequelize');module[_0x9699('0x0')]={'name':{'type':Sequelize[_0x9699('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa4cb=['STRING','sequelize','exports'];(function(_0x3f088c,_0x1e3b3c){var _0x5f065b=function(_0x460e6e){while(--_0x460e6e){_0x3f088c['push'](_0x3f088c['shift']());}};_0x5f065b(++_0x1e3b3c);}(_0xa4cb,0x115));var _0xba4c=function(_0x5299a5,_0x375891){_0x5299a5=_0x5299a5-0x0;var _0xfb00b=_0xa4cb[_0x5299a5];return _0xfb00b;};'use strict';var Sequelize=require(_0xba4c('0x0'));module[_0xba4c('0x1')]={'name':{'type':Sequelize[_0xba4c('0x2')]},'basename':{'type':Sequelize[_0xba4c('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 38190cb..c25ae82 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 _0x424a=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','Attachment','includeAll','include','rows','catch','show','params','keys','rawAttributes','merge','clone','find','get','omit','createdAt','body','updatedAt','create','destroy','file','originalname','filename','download','findOne','server/files/attachments/','basename','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type'];(function(_0x19eb9b,_0x3d2e20){var _0x22ea05=function(_0x7af6fd){while(--_0x7af6fd){_0x19eb9b['push'](_0x19eb9b['shift']());}};_0x22ea05(++_0x3d2e20);}(_0x424a,0xc9));var _0xa424=function(_0x2a7210,_0x2f3d23){_0x2a7210=_0x2a7210-0x0;var _0x460766=_0x424a[_0x2a7210];return _0x460766;};'use strict';var pdf=require(_0xa424('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa424('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa424('0x2'));var rp=require(_0xa424('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa424('0x4'));var util=require(_0xa424('0x5'));var path=require('path');var sox=require(_0xa424('0x6'));var csv=require(_0xa424('0x7'));var ejs=require(_0xa424('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa424('0x9'));var crypto=require(_0xa424('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa424('0x7'));var querystring=require(_0xa424('0xb'));var Papa=require('papaparse');var Redis=require(_0xa424('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa424('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa424('0xe'));var config=require(_0xa424('0xf'));var licenseUtil=require(_0xa424('0x10'));var db=require(_0xa424('0x11'))['db'];function respondWithStatusCode(_0x59f7a8,_0x4d0127){_0x4d0127=_0x4d0127||0xcc;return function(_0x57bf72){if(_0x57bf72){return _0x59f7a8[_0xa424('0x12')](_0x4d0127);}return _0x59f7a8['status'](_0x4d0127)[_0xa424('0x13')]();};}function respondWithResult(_0x5640cc,_0x3fea1f){_0x3fea1f=_0x3fea1f||0xc8;return function(_0x5605e8){if(_0x5605e8){return _0x5640cc['status'](_0x3fea1f)['json'](_0x5605e8);}};}function respondWithFilteredResult(_0x387c29,_0x5831a3){return function(_0xc6b763){if(_0xc6b763){var _0x557794=_0xc6b763[_0xa424('0x14')],_0x196d35=_0x5831a3[_0xa424('0x15')],_0x5e8c49=_0x5831a3[_0xa424('0x15')]+_0x5831a3[_0xa424('0x16')],_0x4acd92;if(_0x5e8c49>=_0x557794){_0x5e8c49=_0x557794;_0x4acd92=0xc8;}else{_0x4acd92=0xce;}_0x387c29[_0xa424('0x17')](_0x4acd92);return _0x387c29['set'](_0xa424('0x18'),_0x196d35+'-'+_0x5e8c49+'/'+_0x557794)[_0xa424('0x19')](_0xc6b763);}return null;};}function patchUpdates(_0x3d1c8a){return function(_0xb9cbdd){try{jsonpatch[_0xa424('0x1a')](_0xb9cbdd,_0x3d1c8a,!![]);}catch(_0x37df2a){return BPromise[_0xa424('0x1b')](_0x37df2a);}return _0xb9cbdd[_0xa424('0x1c')]();};}function saveUpdates(_0x20192d,_0x86d3b2){return function(_0x4d6717){if(_0x4d6717){return _0x4d6717[_0xa424('0x1d')](_0x20192d)[_0xa424('0x1e')](function(_0x36ca98){return _0x36ca98;});}return null;};}function removeEntity(_0x1bea37,_0x3a71c1){return function(_0x280c47){if(_0x280c47){return _0x280c47['destroy']()[_0xa424('0x1e')](function(){_0x1bea37[_0xa424('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33848f,_0x4fa730){return function(_0x52cbcc){if(!_0x52cbcc){_0x33848f['sendStatus'](0x194);}return _0x52cbcc;};}function handleError(_0x165837,_0x3ce024){_0x3ce024=_0x3ce024||0x1f4;return function(_0x1204a6){logger[_0xa424('0x1f')](_0x1204a6[_0xa424('0x20')]);if(_0x1204a6[_0xa424('0x21')]){delete _0x1204a6[_0xa424('0x21')];}_0x165837[_0xa424('0x17')](_0x3ce024)[_0xa424('0x22')](_0x1204a6);};}exports[_0xa424('0x23')]=function(_0x12a288,_0xea2c00){var _0x41e00d={},_0x276e76={},_0x3d5fa1={'count':0x0,'rows':[]};var _0x5a75c8=_[_0xa424('0x24')](db['Attachment']['rawAttributes'],function(_0xc86af5){return{'name':_0xc86af5[_0xa424('0x25')],'type':_0xc86af5[_0xa424('0x26')]['key']};});_0x276e76[_0xa424('0x27')]=_[_0xa424('0x24')](_0x5a75c8,_0xa424('0x21'));_0x276e76[_0xa424('0x28')]=_['keys'](_0x12a288[_0xa424('0x28')]);_0x276e76[_0xa424('0x29')]=_['intersection'](_0x276e76[_0xa424('0x27')],_0x276e76[_0xa424('0x28')]);_0x41e00d['attributes']=_[_0xa424('0x2a')](_0x276e76['model'],qs[_0xa424('0x2b')](_0x12a288[_0xa424('0x28')][_0xa424('0x2b')]));_0x41e00d[_0xa424('0x2c')]=_0x41e00d[_0xa424('0x2c')][_0xa424('0x2d')]?_0x41e00d['attributes']:_0x276e76['model'];if(!_0x12a288['query'][_0xa424('0x2e')]('nolimit')){_0x41e00d[_0xa424('0x16')]=qs[_0xa424('0x16')](_0x12a288[_0xa424('0x28')][_0xa424('0x16')]);_0x41e00d[_0xa424('0x15')]=qs[_0xa424('0x15')](_0x12a288[_0xa424('0x28')][_0xa424('0x15')]);}_0x41e00d[_0xa424('0x2f')]=qs['sort'](_0x12a288[_0xa424('0x28')][_0xa424('0x30')]);_0x41e00d[_0xa424('0x31')]=qs['filters'](_[_0xa424('0x32')](_0x12a288[_0xa424('0x28')],_0x276e76[_0xa424('0x29')]),_0x5a75c8);if(_0x12a288['query'][_0xa424('0x33')]){_0x41e00d[_0xa424('0x31')]=_['merge'](_0x41e00d[_0xa424('0x31')],{'$or':_['map'](_0x5a75c8,function(_0x2e5e0d){if(_0x2e5e0d[_0xa424('0x26')]!==_0xa424('0x34')){var _0x17be51={};_0x17be51[_0x2e5e0d[_0xa424('0x21')]]={'$like':'%'+_0x12a288[_0xa424('0x28')]['filter']+'%'};return _0x17be51;}})});}_0x41e00d=_['merge']({},_0x41e00d,_0x12a288[_0xa424('0x35')]);var _0x40ea4a={'where':_0x41e00d[_0xa424('0x31')]};return db[_0xa424('0x36')]['count'](_0x40ea4a)[_0xa424('0x1e')](function(_0x4e379d){_0x3d5fa1['count']=_0x4e379d;if(_0x12a288[_0xa424('0x28')][_0xa424('0x37')]){_0x41e00d[_0xa424('0x38')]=[{'all':!![]}];}return db[_0xa424('0x36')]['findAll'](_0x41e00d);})[_0xa424('0x1e')](function(_0x516d6e){_0x3d5fa1[_0xa424('0x39')]=_0x516d6e;return _0x3d5fa1;})[_0xa424('0x1e')](respondWithFilteredResult(_0xea2c00,_0x41e00d))[_0xa424('0x3a')](handleError(_0xea2c00,null));};exports[_0xa424('0x3b')]=function(_0x9e18f,_0x46110e){var _0x33fd71={'raw':!![],'where':{'id':_0x9e18f[_0xa424('0x3c')]['id']}},_0x3db587={};_0x3db587['model']=_[_0xa424('0x3d')](db[_0xa424('0x36')][_0xa424('0x3e')]);_0x3db587[_0xa424('0x28')]=_['keys'](_0x9e18f[_0xa424('0x28')]);_0x3db587['filters']=_[_0xa424('0x2a')](_0x3db587[_0xa424('0x27')],_0x3db587[_0xa424('0x28')]);_0x33fd71['attributes']=_['intersection'](_0x3db587[_0xa424('0x27')],qs[_0xa424('0x2b')](_0x9e18f['query']['fields']));_0x33fd71[_0xa424('0x2c')]=_0x33fd71[_0xa424('0x2c')][_0xa424('0x2d')]?_0x33fd71['attributes']:_0x3db587[_0xa424('0x27')];if(_0x9e18f[_0xa424('0x28')]['includeAll']){_0x33fd71[_0xa424('0x38')]=[{'all':!![]}];}_0x33fd71=_[_0xa424('0x3f')]({},_0x33fd71,_0x9e18f[_0xa424('0x35')]);return db['Attachment']['find'](_0x33fd71)['then'](handleEntityNotFound(_0x46110e,null))[_0xa424('0x1e')](respondWithResult(_0x46110e,null))['catch'](handleError(_0x46110e,null));};exports[_0xa424('0x40')]=function(_0x2f08b1,_0x4e4651){var _0x4bf277={'where':{'id':_0x2f08b1[_0xa424('0x3c')]['id']}},_0x57df12={};_0x57df12['model']=_[_0xa424('0x3d')](db['Attachment']['rawAttributes']);_0x4bf277['attributes']=_['intersection'](_0x57df12[_0xa424('0x27')],qs[_0xa424('0x2b')](_0x2f08b1[_0xa424('0x28')][_0xa424('0x2b')]));_0x4bf277['attributes']=_0x4bf277[_0xa424('0x2c')][_0xa424('0x2d')]?_0x4bf277['attributes']:_0x57df12[_0xa424('0x27')];if(_0x2f08b1[_0xa424('0x28')][_0xa424('0x37')]){_0x4bf277['include']=[{'all':!![]}];}_0x4bf277=_[_0xa424('0x3f')]({},_0x4bf277,_0x2f08b1[_0xa424('0x35')]);return db[_0xa424('0x36')][_0xa424('0x41')](_0x4bf277)[_0xa424('0x1e')](handleEntityNotFound(_0x4e4651,null))['then'](function(_0x32f829){if(_0x32f829){var _0x3db847=_0x32f829[_0xa424('0x42')]({'plain':!![]});_0x3db847=qs[_0xa424('0x43')](_0x3db847,['id',_0xa424('0x44'),'updatedAt']);_0x2f08b1['body']=_[_0xa424('0x43')](_0x2f08b1[_0xa424('0x45')],['id',_0xa424('0x44'),_0xa424('0x46')]);return db[_0xa424('0x36')][_0xa424('0x47')](_[_0xa424('0x3f')](_0x3db847,_0x2f08b1[_0xa424('0x45')]),{'include':_0x2f08b1[_0xa424('0x28')][_0xa424('0x37')]?[{'all':!![]}]:undefined});}})[_0xa424('0x1e')](respondWithResult(_0x4e4651,0xc9))[_0xa424('0x3a')](handleError(_0x4e4651,null));};exports[_0xa424('0x1d')]=function(_0x15cc66,_0x32df48){if(_0x15cc66[_0xa424('0x45')]['id']){delete _0x15cc66[_0xa424('0x45')]['id'];}return db[_0xa424('0x36')][_0xa424('0x41')]({'where':{'id':_0x15cc66[_0xa424('0x3c')]['id']}})[_0xa424('0x1e')](handleEntityNotFound(_0x32df48,null))['then'](saveUpdates(_0x15cc66[_0xa424('0x45')],null))['then'](respondWithResult(_0x32df48,null))[_0xa424('0x3a')](handleError(_0x32df48,null));};exports[_0xa424('0x48')]=function(_0x5267ac,_0x6608b2){return db[_0xa424('0x36')][_0xa424('0x41')]({'where':{'id':_0x5267ac['params']['id']}})[_0xa424('0x1e')](handleEntityNotFound(_0x6608b2,null))[_0xa424('0x1e')](removeEntity(_0x6608b2,null))[_0xa424('0x3a')](handleError(_0x6608b2,null));};exports[_0xa424('0x47')]=function(_0x1c6465,_0x1dee6a,_0x4fe846){_0x1c6465['body'][_0xa424('0x21')]=_0x1c6465[_0xa424('0x49')][_0xa424('0x4a')];_0x1c6465[_0xa424('0x45')]['basename']=_0x1c6465[_0xa424('0x49')][_0xa424('0x4b')];_0x1c6465[_0xa424('0x45')]['type']=_0x1c6465['file']['mimetype'];return db[_0xa424('0x36')][_0xa424('0x47')](_0x1c6465[_0xa424('0x45')])[_0xa424('0x1e')](respondWithResult(_0x1dee6a,0xc9))['catch'](handleError(_0x1dee6a,null));};exports[_0xa424('0x4c')]=function(_0x4dedef,_0x30741f,_0x56947c){return db['Attachment'][_0xa424('0x4d')]({'where':{'id':_0x4dedef[_0xa424('0x3c')]['id']},'raw':!![]})[_0xa424('0x1e')](handleEntityNotFound(_0x30741f,null))[_0xa424('0x1e')](function(_0x3d57d6){if(_0x3d57d6){return _0x30741f['download'](path['join'](config['root'],_0xa424('0x4e'),_0x3d57d6[_0xa424('0x4f')]));}})[_0xa424('0x3a')](handleError(_0x30741f,null));}; \ No newline at end of file +var _0xb1ee=['attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','clone','omit','createdAt','updatedAt','body','update','create','file','originalname','basename','download','findOne','root','server/files/attachments/','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','stack','name','index','map','Attachment','fieldName','type','key','model','query','keys','filters'];(function(_0x34a14d,_0xc49d24){var _0x2015f2=function(_0x2a0b48){while(--_0x2a0b48){_0x34a14d['push'](_0x34a14d['shift']());}};_0x2015f2(++_0xc49d24);}(_0xb1ee,0x172));var _0xeb1e=function(_0x380a3f,_0x202483){_0x380a3f=_0x380a3f-0x0;var _0x2b4eca=_0xb1ee[_0x380a3f];return _0x2b4eca;};'use strict';var pdf=require(_0xeb1e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeb1e('0x1'));var zipdir=require(_0xeb1e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb1e('0x3'));var moment=require(_0xeb1e('0x4'));var BPromise=require(_0xeb1e('0x5'));var Mustache=require(_0xeb1e('0x6'));var util=require(_0xeb1e('0x7'));var path=require(_0xeb1e('0x8'));var sox=require(_0xeb1e('0x9'));var csv=require(_0xeb1e('0xa'));var ejs=require(_0xeb1e('0xb'));var fs=require('fs');var _=require(_0xeb1e('0xc'));var squel=require(_0xeb1e('0xd'));var crypto=require('crypto');var jsforce=require(_0xeb1e('0xe'));var deskjs=require(_0xeb1e('0xf'));var toCsv=require(_0xeb1e('0xa'));var querystring=require('querystring');var Papa=require(_0xeb1e('0x10'));var Redis=require('ioredis');var authService=require(_0xeb1e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xeb1e('0x12'));var hardwareService=require(_0xeb1e('0x13'));var logger=require('../../config/logger')(_0xeb1e('0x14'));var utils=require(_0xeb1e('0x15'));var config=require(_0xeb1e('0x16'));var licenseUtil=require(_0xeb1e('0x17'));var db=require(_0xeb1e('0x18'))['db'];function respondWithStatusCode(_0x1e8fb0,_0x244c4c){_0x244c4c=_0x244c4c||0xcc;return function(_0x49c161){if(_0x49c161){return _0x1e8fb0[_0xeb1e('0x19')](_0x244c4c);}return _0x1e8fb0[_0xeb1e('0x1a')](_0x244c4c)[_0xeb1e('0x1b')]();};}function respondWithResult(_0xfdd3cf,_0x10af15){_0x10af15=_0x10af15||0xc8;return function(_0x37aab9){if(_0x37aab9){return _0xfdd3cf[_0xeb1e('0x1a')](_0x10af15)[_0xeb1e('0x1c')](_0x37aab9);}};}function respondWithFilteredResult(_0x5b5a27,_0x37faf4){return function(_0x320f89){if(_0x320f89){var _0x79878c=_0x320f89[_0xeb1e('0x1d')],_0x338d50=_0x37faf4['offset'],_0x1ee4ef=_0x37faf4[_0xeb1e('0x1e')]+_0x37faf4[_0xeb1e('0x1f')],_0x4e89b9;if(_0x1ee4ef>=_0x79878c){_0x1ee4ef=_0x79878c;_0x4e89b9=0xc8;}else{_0x4e89b9=0xce;}_0x5b5a27[_0xeb1e('0x1a')](_0x4e89b9);return _0x5b5a27[_0xeb1e('0x20')](_0xeb1e('0x21'),_0x338d50+'-'+_0x1ee4ef+'/'+_0x79878c)[_0xeb1e('0x1c')](_0x320f89);}return null;};}function patchUpdates(_0x57209d){return function(_0x28031e){try{jsonpatch['apply'](_0x28031e,_0x57209d,!![]);}catch(_0x56756c){return BPromise[_0xeb1e('0x22')](_0x56756c);}return _0x28031e[_0xeb1e('0x23')]();};}function saveUpdates(_0x120273,_0x13b320){return function(_0x43bdfb){if(_0x43bdfb){return _0x43bdfb['update'](_0x120273)['then'](function(_0x265aff){return _0x265aff;});}return null;};}function removeEntity(_0x3ec261,_0x452a2c){return function(_0x255858){if(_0x255858){return _0x255858[_0xeb1e('0x24')]()[_0xeb1e('0x25')](function(){_0x3ec261[_0xeb1e('0x1a')](0xcc)[_0xeb1e('0x1b')]();});}};}function handleEntityNotFound(_0x181808,_0x4e6296){return function(_0x6548f2){if(!_0x6548f2){_0x181808['sendStatus'](0x194);}return _0x6548f2;};}function handleError(_0x6db47e,_0x332345){_0x332345=_0x332345||0x1f4;return function(_0x23e235){logger['error'](_0x23e235[_0xeb1e('0x26')]);if(_0x23e235[_0xeb1e('0x27')]){delete _0x23e235[_0xeb1e('0x27')];}_0x6db47e[_0xeb1e('0x1a')](_0x332345)['send'](_0x23e235);};}exports[_0xeb1e('0x28')]=function(_0x494c5f,_0x36b1d1){var _0x450d45={},_0x1babbc={},_0x11fe99={'count':0x0,'rows':[]};var _0x1f92b3=_[_0xeb1e('0x29')](db[_0xeb1e('0x2a')]['rawAttributes'],function(_0x17cac8){return{'name':_0x17cac8[_0xeb1e('0x2b')],'type':_0x17cac8[_0xeb1e('0x2c')][_0xeb1e('0x2d')]};});_0x1babbc[_0xeb1e('0x2e')]=_[_0xeb1e('0x29')](_0x1f92b3,_0xeb1e('0x27'));_0x1babbc[_0xeb1e('0x2f')]=_[_0xeb1e('0x30')](_0x494c5f['query']);_0x1babbc[_0xeb1e('0x31')]=_['intersection'](_0x1babbc[_0xeb1e('0x2e')],_0x1babbc[_0xeb1e('0x2f')]);_0x450d45[_0xeb1e('0x32')]=_[_0xeb1e('0x33')](_0x1babbc[_0xeb1e('0x2e')],qs[_0xeb1e('0x34')](_0x494c5f[_0xeb1e('0x2f')][_0xeb1e('0x34')]));_0x450d45[_0xeb1e('0x32')]=_0x450d45[_0xeb1e('0x32')][_0xeb1e('0x35')]?_0x450d45[_0xeb1e('0x32')]:_0x1babbc[_0xeb1e('0x2e')];if(!_0x494c5f['query'][_0xeb1e('0x36')](_0xeb1e('0x37'))){_0x450d45[_0xeb1e('0x1f')]=qs['limit'](_0x494c5f[_0xeb1e('0x2f')][_0xeb1e('0x1f')]);_0x450d45['offset']=qs[_0xeb1e('0x1e')](_0x494c5f['query']['offset']);}_0x450d45['order']=qs[_0xeb1e('0x38')](_0x494c5f[_0xeb1e('0x2f')][_0xeb1e('0x38')]);_0x450d45[_0xeb1e('0x39')]=qs[_0xeb1e('0x31')](_['pick'](_0x494c5f[_0xeb1e('0x2f')],_0x1babbc[_0xeb1e('0x31')]),_0x1f92b3);if(_0x494c5f['query'][_0xeb1e('0x3a')]){_0x450d45['where']=_['merge'](_0x450d45[_0xeb1e('0x39')],{'$or':_[_0xeb1e('0x29')](_0x1f92b3,function(_0x58c9b1){if(_0x58c9b1[_0xeb1e('0x2c')]!=='VIRTUAL'){var _0x2e4037={};_0x2e4037[_0x58c9b1[_0xeb1e('0x27')]]={'$like':'%'+_0x494c5f[_0xeb1e('0x2f')][_0xeb1e('0x3a')]+'%'};return _0x2e4037;}})});}_0x450d45=_[_0xeb1e('0x3b')]({},_0x450d45,_0x494c5f[_0xeb1e('0x3c')]);var _0x55baec={'where':_0x450d45[_0xeb1e('0x39')]};return db[_0xeb1e('0x2a')][_0xeb1e('0x1d')](_0x55baec)[_0xeb1e('0x25')](function(_0x3695c8){_0x11fe99[_0xeb1e('0x1d')]=_0x3695c8;if(_0x494c5f[_0xeb1e('0x2f')]['includeAll']){_0x450d45[_0xeb1e('0x3d')]=[{'all':!![]}];}return db[_0xeb1e('0x2a')][_0xeb1e('0x3e')](_0x450d45);})[_0xeb1e('0x25')](function(_0x25a5a3){_0x11fe99[_0xeb1e('0x3f')]=_0x25a5a3;return _0x11fe99;})[_0xeb1e('0x25')](respondWithFilteredResult(_0x36b1d1,_0x450d45))['catch'](handleError(_0x36b1d1,null));};exports[_0xeb1e('0x40')]=function(_0x3fd44c,_0x42f029){var _0x2c5ab2={'raw':!![],'where':{'id':_0x3fd44c[_0xeb1e('0x41')]['id']}},_0x3e68bf={};_0x3e68bf[_0xeb1e('0x2e')]=_[_0xeb1e('0x30')](db['Attachment'][_0xeb1e('0x42')]);_0x3e68bf[_0xeb1e('0x2f')]=_['keys'](_0x3fd44c[_0xeb1e('0x2f')]);_0x3e68bf['filters']=_[_0xeb1e('0x33')](_0x3e68bf[_0xeb1e('0x2e')],_0x3e68bf[_0xeb1e('0x2f')]);_0x2c5ab2[_0xeb1e('0x32')]=_[_0xeb1e('0x33')](_0x3e68bf['model'],qs[_0xeb1e('0x34')](_0x3fd44c[_0xeb1e('0x2f')]['fields']));_0x2c5ab2['attributes']=_0x2c5ab2[_0xeb1e('0x32')][_0xeb1e('0x35')]?_0x2c5ab2[_0xeb1e('0x32')]:_0x3e68bf['model'];if(_0x3fd44c[_0xeb1e('0x2f')][_0xeb1e('0x43')]){_0x2c5ab2[_0xeb1e('0x3d')]=[{'all':!![]}];}_0x2c5ab2=_[_0xeb1e('0x3b')]({},_0x2c5ab2,_0x3fd44c[_0xeb1e('0x3c')]);return db[_0xeb1e('0x2a')][_0xeb1e('0x44')](_0x2c5ab2)[_0xeb1e('0x25')](handleEntityNotFound(_0x42f029,null))[_0xeb1e('0x25')](respondWithResult(_0x42f029,null))[_0xeb1e('0x45')](handleError(_0x42f029,null));};exports[_0xeb1e('0x46')]=function(_0x1c9673,_0x72b375){var _0x3990b5={'where':{'id':_0x1c9673[_0xeb1e('0x41')]['id']}},_0x1bf8d9={};_0x1bf8d9['model']=_[_0xeb1e('0x30')](db[_0xeb1e('0x2a')][_0xeb1e('0x42')]);_0x3990b5[_0xeb1e('0x32')]=_['intersection'](_0x1bf8d9[_0xeb1e('0x2e')],qs[_0xeb1e('0x34')](_0x1c9673['query'][_0xeb1e('0x34')]));_0x3990b5['attributes']=_0x3990b5[_0xeb1e('0x32')][_0xeb1e('0x35')]?_0x3990b5[_0xeb1e('0x32')]:_0x1bf8d9[_0xeb1e('0x2e')];if(_0x1c9673[_0xeb1e('0x2f')][_0xeb1e('0x43')]){_0x3990b5[_0xeb1e('0x3d')]=[{'all':!![]}];}_0x3990b5=_['merge']({},_0x3990b5,_0x1c9673[_0xeb1e('0x3c')]);return db[_0xeb1e('0x2a')][_0xeb1e('0x44')](_0x3990b5)[_0xeb1e('0x25')](handleEntityNotFound(_0x72b375,null))[_0xeb1e('0x25')](function(_0x3c30b6){if(_0x3c30b6){var _0x343a10=_0x3c30b6['get']({'plain':!![]});_0x343a10=qs[_0xeb1e('0x47')](_0x343a10,['id',_0xeb1e('0x48'),_0xeb1e('0x49')]);_0x1c9673[_0xeb1e('0x4a')]=_[_0xeb1e('0x47')](_0x1c9673[_0xeb1e('0x4a')],['id',_0xeb1e('0x48'),_0xeb1e('0x49')]);return db['Attachment']['create'](_[_0xeb1e('0x3b')](_0x343a10,_0x1c9673[_0xeb1e('0x4a')]),{'include':_0x1c9673[_0xeb1e('0x2f')][_0xeb1e('0x43')]?[{'all':!![]}]:undefined});}})[_0xeb1e('0x25')](respondWithResult(_0x72b375,0xc9))[_0xeb1e('0x45')](handleError(_0x72b375,null));};exports[_0xeb1e('0x4b')]=function(_0x31bd8e,_0x1fd543){if(_0x31bd8e['body']['id']){delete _0x31bd8e['body']['id'];}return db[_0xeb1e('0x2a')][_0xeb1e('0x44')]({'where':{'id':_0x31bd8e[_0xeb1e('0x41')]['id']}})[_0xeb1e('0x25')](handleEntityNotFound(_0x1fd543,null))['then'](saveUpdates(_0x31bd8e['body'],null))[_0xeb1e('0x25')](respondWithResult(_0x1fd543,null))['catch'](handleError(_0x1fd543,null));};exports[_0xeb1e('0x24')]=function(_0x44a25a,_0xafe438){return db['Attachment'][_0xeb1e('0x44')]({'where':{'id':_0x44a25a[_0xeb1e('0x41')]['id']}})[_0xeb1e('0x25')](handleEntityNotFound(_0xafe438,null))[_0xeb1e('0x25')](removeEntity(_0xafe438,null))[_0xeb1e('0x45')](handleError(_0xafe438,null));};exports[_0xeb1e('0x4c')]=function(_0x3dd798,_0x55b269,_0x2e5d75){_0x3dd798[_0xeb1e('0x4a')]['name']=_0x3dd798[_0xeb1e('0x4d')][_0xeb1e('0x4e')];_0x3dd798[_0xeb1e('0x4a')][_0xeb1e('0x4f')]=_0x3dd798[_0xeb1e('0x4d')]['filename'];_0x3dd798['body'][_0xeb1e('0x2c')]=_0x3dd798[_0xeb1e('0x4d')]['mimetype'];return db[_0xeb1e('0x2a')][_0xeb1e('0x4c')](_0x3dd798['body'])[_0xeb1e('0x25')](respondWithResult(_0x55b269,0xc9))[_0xeb1e('0x45')](handleError(_0x55b269,null));};exports[_0xeb1e('0x50')]=function(_0x271980,_0x4c4931,_0x16ae44){return db[_0xeb1e('0x2a')][_0xeb1e('0x51')]({'where':{'id':_0x271980[_0xeb1e('0x41')]['id']},'raw':!![]})[_0xeb1e('0x25')](handleEntityNotFound(_0x4c4931,null))[_0xeb1e('0x25')](function(_0x47ed64){if(_0x47ed64){return _0x4c4931['download'](path['join'](config[_0xeb1e('0x52')],_0xeb1e('0x53'),_0x47ed64[_0xeb1e('0x4f')]));}})[_0xeb1e('0x45')](handleError(_0x4c4931,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 3e81432..70b637a 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 _0x25c2=['attachments','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','Attachment'];(function(_0x14d582,_0x1a1229){var _0x54c4ce=function(_0x3bb626){while(--_0x3bb626){_0x14d582['push'](_0x14d582['shift']());}};_0x54c4ce(++_0x1a1229);}(_0x25c2,0xdd));var _0x225c=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x25c2[_0x999b85];return _0x1d7124;};'use strict';var _=require(_0x225c('0x0'));var util=require('util');var logger=require(_0x225c('0x1'))(_0x225c('0x2'));var moment=require('moment');var BPromise=require(_0x225c('0x3'));var rp=require(_0x225c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x225c('0x5'));var config=require(_0x225c('0x6'));var attributes=require('./attachment.attributes');module[_0x225c('0x7')]=function(_0x1f3b42,_0x1fac61){return _0x1f3b42[_0x225c('0x8')](_0x225c('0x9'),attributes,{'tableName':_0x225c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ab=['../../config/environment','./attachment.attributes','define','attachments','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x225773,_0x65c42a){var _0x27643d=function(_0x143a68){while(--_0x143a68){_0x225773['push'](_0x225773['shift']());}};_0x27643d(++_0x65c42a);}(_0xe2ab,0xc4));var _0xbe2a=function(_0xcac5e5,_0x5f4a78){_0xcac5e5=_0xcac5e5-0x0;var _0x17899e=_0xe2ab[_0xcac5e5];return _0x17899e;};'use strict';var _=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var logger=require(_0xbe2a('0x2'))(_0xbe2a('0x3'));var moment=require(_0xbe2a('0x4'));var BPromise=require(_0xbe2a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe2a('0x6'));var rimraf=require(_0xbe2a('0x7'));var config=require(_0xbe2a('0x8'));var attributes=require(_0xbe2a('0x9'));module['exports']=function(_0x2023d3,_0x521365){return _0x2023d3[_0xbe2a('0xa')]('Attachment',attributes,{'tableName':_0xbe2a('0xb'),'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 3da52e4..1aa5eae 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 _0xcea7=['request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Attachment','create','body','options','raw','CreateAttachment','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s'];(function(_0x4db410,_0x422664){var _0x1522b2=function(_0x4474fd){while(--_0x4474fd){_0x4db410['push'](_0x4db410['shift']());}};_0x1522b2(++_0x422664);}(_0xcea7,0x159));var _0x7cea=function(_0x5042c4,_0x21b8d3){_0x5042c4=_0x5042c4-0x0;var _0x5bc3c7=_0xcea7[_0x5042c4];return _0x5bc3c7;};'use strict';var _=require(_0x7cea('0x0'));var util=require(_0x7cea('0x1'));var moment=require('moment');var BPromise=require(_0x7cea('0x2'));var rs=require(_0x7cea('0x3'));var fs=require('fs');var Redis=require(_0x7cea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7cea('0x5'));var logger=require(_0x7cea('0x6'))(_0x7cea('0x7'));var config=require(_0x7cea('0x8'));var jayson=require(_0x7cea('0x9'));var client=jayson[_0x7cea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2194d1,_0x29e3b1,_0xaea7d8){return new BPromise(function(_0x1c3ec8,_0x5c84d3){return client[_0x7cea('0xb')](_0x2194d1,_0xaea7d8)[_0x7cea('0xc')](function(_0x47bbef){logger[_0x7cea('0xd')](_0x7cea('0xe'),_0x29e3b1,_0x7cea('0xf'));logger[_0x7cea('0x10')](_0x7cea('0x11'),_0x29e3b1,_0x7cea('0xf'),JSON[_0x7cea('0x12')](_0x47bbef));if(_0x47bbef[_0x7cea('0x13')]){if(_0x47bbef[_0x7cea('0x13')][_0x7cea('0x14')]===0x1f4){logger[_0x7cea('0x13')]('Attachment,\x20%s,\x20%s',_0x29e3b1,_0x47bbef['error'][_0x7cea('0x15')]);return _0x5c84d3(_0x47bbef[_0x7cea('0x13')][_0x7cea('0x15')]);}logger[_0x7cea('0x13')](_0x7cea('0xe'),_0x29e3b1,_0x47bbef[_0x7cea('0x13')][_0x7cea('0x15')]);return _0x1c3ec8(_0x47bbef['error'][_0x7cea('0x15')]);}else{logger['info'](_0x7cea('0xe'),_0x29e3b1,'request\x20sent');_0x1c3ec8(_0x47bbef[_0x7cea('0x16')][_0x7cea('0x15')]);}})['catch'](function(_0x49f826){logger[_0x7cea('0x13')](_0x7cea('0xe'),_0x29e3b1,_0x49f826);_0x5c84d3(_0x49f826);});});}exports['CreateAttachment']=function(_0x1fddd0){var _0x4ea4ae=this;return new Promise(function(_0x4ebac3,_0x1ed0ad){return db[_0x7cea('0x17')][_0x7cea('0x18')](_0x1fddd0[_0x7cea('0x19')],{'raw':_0x1fddd0[_0x7cea('0x1a')]?_0x1fddd0[_0x7cea('0x1a')][_0x7cea('0x1b')]===undefined?!![]:![]:!![]})[_0x7cea('0xc')](function(_0x47a77f){logger[_0x7cea('0xd')](_0x7cea('0x1c'),_0x1fddd0);logger['debug'](_0x7cea('0x1c'),_0x1fddd0,JSON[_0x7cea('0x12')](_0x47a77f));_0x4ebac3(_0x47a77f);})[_0x7cea('0x1d')](function(_0x306240){logger[_0x7cea('0x13')]('CreateAttachment',_0x306240[_0x7cea('0x15')],_0x1fddd0);_0x1ed0ad(_0x4ea4ae[_0x7cea('0x13')](0x1f4,_0x306240[_0x7cea('0x15')]));});});}; \ No newline at end of file +var _0xc1a0=['stringify','error','code','message','result','create','body','options','raw','info','CreateAttachment','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xc1a0,0xfc));var _0x0c1a=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xc1a0[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require(_0x0c1a('0x0'));var util=require(_0x0c1a('0x1'));var moment=require('moment');var BPromise=require(_0x0c1a('0x2'));var rs=require(_0x0c1a('0x3'));var fs=require('fs');var Redis=require(_0x0c1a('0x4'));var db=require(_0x0c1a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c1a('0x6'))(_0x0c1a('0x7'));var config=require(_0x0c1a('0x8'));var jayson=require(_0x0c1a('0x9'));var client=jayson[_0x0c1a('0xa')][_0x0c1a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e58f4,_0x4687de,_0x36a5d3){return new BPromise(function(_0x5a54a3,_0x38d64f){return client[_0x0c1a('0xc')](_0x3e58f4,_0x36a5d3)[_0x0c1a('0xd')](function(_0x18bf47){logger['info'](_0x0c1a('0xe'),_0x4687de,_0x0c1a('0xf'));logger[_0x0c1a('0x10')](_0x0c1a('0x11'),_0x4687de,_0x0c1a('0xf'),JSON[_0x0c1a('0x12')](_0x18bf47));if(_0x18bf47['error']){if(_0x18bf47[_0x0c1a('0x13')][_0x0c1a('0x14')]===0x1f4){logger[_0x0c1a('0x13')]('Attachment,\x20%s,\x20%s',_0x4687de,_0x18bf47[_0x0c1a('0x13')][_0x0c1a('0x15')]);return _0x38d64f(_0x18bf47['error'][_0x0c1a('0x15')]);}logger[_0x0c1a('0x13')](_0x0c1a('0xe'),_0x4687de,_0x18bf47[_0x0c1a('0x13')]['message']);return _0x5a54a3(_0x18bf47[_0x0c1a('0x13')][_0x0c1a('0x15')]);}else{logger['info'](_0x0c1a('0xe'),_0x4687de,_0x0c1a('0xf'));_0x5a54a3(_0x18bf47[_0x0c1a('0x16')][_0x0c1a('0x15')]);}})['catch'](function(_0x424a7a){logger[_0x0c1a('0x13')](_0x0c1a('0xe'),_0x4687de,_0x424a7a);_0x38d64f(_0x424a7a);});});}exports['CreateAttachment']=function(_0x2c3644){var _0x4c085f=this;return new Promise(function(_0xb9ffd5,_0x4355ca){return db['Attachment'][_0x0c1a('0x17')](_0x2c3644[_0x0c1a('0x18')],{'raw':_0x2c3644['options']?_0x2c3644[_0x0c1a('0x19')][_0x0c1a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x54e4ac){logger[_0x0c1a('0x1b')](_0x0c1a('0x1c'),_0x2c3644);logger['debug'](_0x0c1a('0x1c'),_0x2c3644,JSON[_0x0c1a('0x12')](_0x54e4ac));_0xb9ffd5(_0x54e4ac);})[_0x0c1a('0x1d')](function(_0x4c6d94){logger[_0x0c1a('0x13')]('CreateAttachment',_0x4c6d94[_0x0c1a('0x15')],_0x2c3644);_0x4355ca(_0x4c085f[_0x0c1a('0x13')](0x1f4,_0x4c6d94['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index e1cbea4..a51b1cc 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 _0x582b=['path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','/:id/clone','clone','diskStorage','join','root','server/files/attachments/','format','now','originalname','replace','post','single','create','/:id','update','delete','destroy','exports','util'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0x582b,0x185));var _0xb582=function(_0x47a90a,_0x5c3276){_0x47a90a=_0x47a90a-0x0;var _0x1557b0=_0x582b[_0x47a90a];return _0x1557b0;};'use strict';var multer=require('multer');var util=require(_0xb582('0x0'));var path=require(_0xb582('0x1'));var timeout=require('connect-timeout');var express=require(_0xb582('0x2'));var router=express['Router']();var auth=require(_0xb582('0x3'));var interaction=require(_0xb582('0x4'));var config=require(_0xb582('0x5'));var controller=require(_0xb582('0x6'));router[_0xb582('0x7')]('/',auth[_0xb582('0x8')](),controller[_0xb582('0x9')]);router[_0xb582('0x7')]('/:id',auth[_0xb582('0x8')](),controller[_0xb582('0xa')]);router['get'](_0xb582('0xb'),auth['isAuthenticated'](),controller['download']);router['post'](_0xb582('0xc'),auth[_0xb582('0x8')](),controller[_0xb582('0xd')]);var upload=multer({'storage':multer[_0xb582('0xe')]({'destination':function(_0x914dec,_0x36b8b2,_0x373cc4){_0x373cc4(null,path[_0xb582('0xf')](config[_0xb582('0x10')],_0xb582('0x11')));},'filename':function(_0x6409d5,_0x361e01,_0x593a8b){_0x593a8b(null,util[_0xb582('0x12')]('%s-%s',Date[_0xb582('0x13')](),_0x361e01[_0xb582('0x14')][_0xb582('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb582('0x16')]('/',upload[_0xb582('0x17')]('file'),controller[_0xb582('0x18')]);router['put'](_0xb582('0x19'),auth[_0xb582('0x8')](),controller[_0xb582('0x1a')]);router[_0xb582('0x1b')](_0xb582('0x19'),auth[_0xb582('0x8')](),controller[_0xb582('0x1c')]);module[_0xb582('0x1d')]=router; \ No newline at end of file +var _0xc3b7=['isAuthenticated','/:id/download','download','post','/:id/clone','clone','diskStorage','join','root','format','%s-%s','now','replace','single','file','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','index','get','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc3b7,0xb4));var _0x7c3b=function(_0x5463c7,_0x143458){_0x5463c7=_0x5463c7-0x0;var _0x2340c1=_0xc3b7[_0x5463c7];return _0x2340c1;};'use strict';var multer=require('multer');var util=require(_0x7c3b('0x0'));var path=require(_0x7c3b('0x1'));var timeout=require(_0x7c3b('0x2'));var express=require(_0x7c3b('0x3'));var router=express[_0x7c3b('0x4')]();var auth=require(_0x7c3b('0x5'));var interaction=require(_0x7c3b('0x6'));var config=require(_0x7c3b('0x7'));var controller=require(_0x7c3b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x7c3b('0x9')]);router[_0x7c3b('0xa')](_0x7c3b('0xb'),auth[_0x7c3b('0xc')](),controller['show']);router[_0x7c3b('0xa')](_0x7c3b('0xd'),auth[_0x7c3b('0xc')](),controller[_0x7c3b('0xe')]);router[_0x7c3b('0xf')](_0x7c3b('0x10'),auth[_0x7c3b('0xc')](),controller[_0x7c3b('0x11')]);var upload=multer({'storage':multer[_0x7c3b('0x12')]({'destination':function(_0x220f21,_0x74dc35,_0xf4883f){_0xf4883f(null,path[_0x7c3b('0x13')](config[_0x7c3b('0x14')],'server/files/attachments/'));},'filename':function(_0x157e55,_0x455145,_0x4c7871){_0x4c7871(null,util[_0x7c3b('0x15')](_0x7c3b('0x16'),Date[_0x7c3b('0x17')](),_0x455145['originalname'][_0x7c3b('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7c3b('0xf')]('/',upload[_0x7c3b('0x19')](_0x7c3b('0x1a')),controller['create']);router[_0x7c3b('0x1b')](_0x7c3b('0xb'),auth['isAuthenticated'](),controller[_0x7c3b('0x1c')]);router[_0x7c3b('0x1d')](_0x7c3b('0xb'),auth[_0x7c3b('0xc')](),controller[_0x7c3b('0x1e')]);module[_0x7c3b('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 78c68f3..6c1d2c2 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 _0xc2d5=['allowedLoginAttempts','then','User','find','map','admin','agent','disabled','blockDuration','blocked','blockedAt','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','email','callback','/login','use','secret','callbackURL','findOne'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2d5,0x1ca));var _0x5c2d=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xc2d5[_0x251d9c];return _0x16ae64;};'use strict';var _=require(_0x5c2d('0x0'));var passport=require(_0x5c2d('0x1'));var GoogleStrategy=require(_0x5c2d('0x2'))[_0x5c2d('0x3')];var moment=require('moment');var db=require(_0x5c2d('0x4'))['db'];var config=require(_0x5c2d('0x5'));var signToken=require(_0x5c2d('0x6'))['signToken'];var utils=require(_0x5c2d('0x7'));exports[_0x5c2d('0x8')]=passport[_0x5c2d('0x9')](_0x5c2d('0xa'),{'failureRedirect':'/login','scope':['profile',_0x5c2d('0xb')],'session':![]});exports[_0x5c2d('0xc')]=passport['authenticate']('google',{'failureRedirect':_0x5c2d('0xd'),'session':![]});passport[_0x5c2d('0xe')](new GoogleStrategy({'clientID':config[_0x5c2d('0xa')]?config[_0x5c2d('0xa')]['clientID']:'id','clientSecret':config[_0x5c2d('0xa')]?config[_0x5c2d('0xa')]['clientSecret']:_0x5c2d('0xf'),'callbackURL':config[_0x5c2d('0xa')]?config[_0x5c2d('0xa')][_0x5c2d('0x10')]:''},function(_0x126492,_0x32a57,_0x759f80,_0x3eed99){var _0xf6f357,_0x4ff86e;return db['Setting'][_0x5c2d('0x11')]({'where':{'id':0x1},'attributes':[_0x5c2d('0x12'),'blockDuration'],'raw':!![]})[_0x5c2d('0x13')](function(_0x312eed){_0xf6f357=_0x312eed;return db[_0x5c2d('0x14')][_0x5c2d('0x15')]({'where':{'email':_[_0x5c2d('0x16')](_0x759f80['emails'],'value'),'role':{'$or':[_0x5c2d('0x17'),'user',_0x5c2d('0x18')]}}});})['then'](function(_0x24efe0){_0x4ff86e=_0x24efe0;if(_0x4ff86e){if(_0x4ff86e[_0x5c2d('0x19')]){return _0x3eed99('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0xf6f357[_0x5c2d('0x1a')]>0x0){if(_0x4ff86e[_0x5c2d('0x1b')]){if(moment(_0x4ff86e[_0x5c2d('0x1c')])['add'](_0xf6f357[_0x5c2d('0x1a')],_0x5c2d('0x1d'))>moment()){return _0x3eed99(_0x5c2d('0x1e'));}else{return utils[_0x5c2d('0x1f')](_0x4ff86e,0x0,![],null)[_0x5c2d('0x13')](function(){return utils[_0x5c2d('0x20')](_0x4ff86e);})['then'](function(){return _0x3eed99(null,_0x4ff86e);});}}else{return utils[_0x5c2d('0x20')](_0x4ff86e)['then'](function(){return _0x3eed99(null,_0x4ff86e);});}}else{return utils[_0x5c2d('0x20')](_0x4ff86e)[_0x5c2d('0x13')](function(){return _0x3eed99(null,_0x4ff86e);});}}return _0x3eed99(_0x5c2d('0x1e'));})[_0x5c2d('0x21')](function(_0x405f58){_0x3eed99(_0x405f58);});})); \ No newline at end of file +var _0x4bbb=['signToken','authenticate','google','/login','profile','email','use','clientID','clientSecret','secret','Setting','allowedLoginAttempts','blockDuration','User','map','emails','value','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser','then','getLicense','catch','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service'];(function(_0xe29b6d,_0x48731f){var _0x41cf6d=function(_0x230919){while(--_0x230919){_0xe29b6d['push'](_0xe29b6d['shift']());}};_0x41cf6d(++_0x48731f);}(_0x4bbb,0x11b));var _0xb4bb=function(_0x1cc49f,_0x292d58){_0x1cc49f=_0x1cc49f-0x0;var _0x44069c=_0x4bbb[_0x1cc49f];return _0x44069c;};'use strict';var _=require('lodash');var passport=require('passport');var GoogleStrategy=require(_0xb4bb('0x0'))[_0xb4bb('0x1')];var moment=require(_0xb4bb('0x2'));var db=require(_0xb4bb('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0xb4bb('0x4'))[_0xb4bb('0x5')];var utils=require('../../config/utils');exports['login']=passport[_0xb4bb('0x6')](_0xb4bb('0x7'),{'failureRedirect':_0xb4bb('0x8'),'scope':[_0xb4bb('0x9'),_0xb4bb('0xa')],'session':![]});exports['callback']=passport['authenticate']('google',{'failureRedirect':_0xb4bb('0x8'),'session':![]});passport[_0xb4bb('0xb')](new GoogleStrategy({'clientID':config[_0xb4bb('0x7')]?config['google'][_0xb4bb('0xc')]:'id','clientSecret':config[_0xb4bb('0x7')]?config[_0xb4bb('0x7')][_0xb4bb('0xd')]:_0xb4bb('0xe'),'callbackURL':config[_0xb4bb('0x7')]?config[_0xb4bb('0x7')]['callbackURL']:''},function(_0x53e981,_0x79369d,_0x4acec4,_0xf261fe){var _0x5dab79,_0x2926f6;return db[_0xb4bb('0xf')]['findOne']({'where':{'id':0x1},'attributes':[_0xb4bb('0x10'),_0xb4bb('0x11')],'raw':!![]})['then'](function(_0x2cabb6){_0x5dab79=_0x2cabb6;return db[_0xb4bb('0x12')]['find']({'where':{'email':_[_0xb4bb('0x13')](_0x4acec4[_0xb4bb('0x14')],_0xb4bb('0x15')),'role':{'$or':[_0xb4bb('0x16'),_0xb4bb('0x17'),'agent']}}});})['then'](function(_0x4903b2){_0x2926f6=_0x4903b2;if(_0x2926f6){if(_0x2926f6['disabled']){return _0xf261fe(_0xb4bb('0x18'));}else if(_0x5dab79['blockDuration']>0x0){if(_0x2926f6[_0xb4bb('0x19')]){if(moment(_0x2926f6[_0xb4bb('0x1a')])[_0xb4bb('0x1b')](_0x5dab79[_0xb4bb('0x11')],'minutes')>moment()){return _0xf261fe(_0xb4bb('0x18'));}else{return utils[_0xb4bb('0x1c')](_0x2926f6,0x0,![],null)[_0xb4bb('0x1d')](function(){return utils['getLicense'](_0x2926f6);})[_0xb4bb('0x1d')](function(){return _0xf261fe(null,_0x2926f6);});}}else{return utils['getLicense'](_0x2926f6)[_0xb4bb('0x1d')](function(){return _0xf261fe(null,_0x2926f6);});}}else{return utils[_0xb4bb('0x1e')](_0x2926f6)[_0xb4bb('0x1d')](function(){return _0xf261fe(null,_0x2926f6);});}}return _0xf261fe(_0xb4bb('0x18'));})[_0xb4bb('0x1f')](function(_0x479f7f){_0xf261fe(_0x479f7f);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index f435dc9..611acca 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 _0x6953=['exports','express','passport','../../components/auth/service','login','get','/callback','isMiddleware','setTokenCookie'];(function(_0x337cf7,_0x1e7a41){var _0x175ae5=function(_0x457c9f){while(--_0x457c9f){_0x337cf7['push'](_0x337cf7['shift']());}};_0x175ae5(++_0x1e7a41);}(_0x6953,0x91));var _0x3695=function(_0x2f2526,_0x2d32cd){_0x2f2526=_0x2f2526-0x0;var _0x160820=_0x6953[_0x2f2526];return _0x160820;};'use strict';var express=require(_0x3695('0x0'));var passport=require(_0x3695('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x3695('0x2'));router['get']('/',controller[_0x3695('0x3')]);router[_0x3695('0x4')](_0x3695('0x5'),controller['callback'],authService[_0x3695('0x6')],userController['login'],authService[_0x3695('0x7')]);module[_0x3695('0x8')]=router; \ No newline at end of file +var _0xd816=['login','get','/callback','callback','exports','express','passport','./authGoogle.controller'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xd816,0xd5));var _0x6d81=function(_0x39a1b2,_0x434c52){_0x39a1b2=_0x39a1b2-0x0;var _0x4cd3dd=_0xd816[_0x39a1b2];return _0x4cd3dd;};'use strict';var express=require(_0x6d81('0x0'));var passport=require(_0x6d81('0x1'));var router=express['Router']();var controller=require(_0x6d81('0x2'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0x6d81('0x3')]);router[_0x6d81('0x4')](_0x6d81('0x5'),controller[_0x6d81('0x6')],authService['isMiddleware'],userController[_0x6d81('0x3')],authService['setTokenCookie']);module[_0x6d81('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 08e896f..19513e0 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 _0x32f4=['passwordHistoryLimit','save','Password\x20reset!','use','util','passport','passport-local','Strategy','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','salt','disabled','blocked','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','user','pass','merge','format','\x22%s\x22\x20<%s>','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','local','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','Setting','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','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','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','send','reset','params','token','enforcePasswordHistory','securePassword','validatePasswordPattern','password','previousPasswords'];(function(_0x1c3386,_0x2868c0){var _0x2cc8e9=function(_0x556aa2){while(--_0x556aa2){_0x1c3386['push'](_0x1c3386['shift']());}};_0x2cc8e9(++_0x2868c0);}(_0x32f4,0x154));var _0x432f=function(_0x281037,_0x219e39){_0x281037=_0x281037-0x0;var _0x3e912c=_0x32f4[_0x281037];return _0x3e912c;};'use strict';var util=require(_0x432f('0x0'));var passport=require(_0x432f('0x1'));var LocalStrategy=require(_0x432f('0x2'))[_0x432f('0x3')];var jayson=require('jayson/promise');var _=require(_0x432f('0x4'));var rs=require(_0x432f('0x5'));var moment=require('moment');var db=require(_0x432f('0x6'))['db'];var authService=require(_0x432f('0x7'));var utils=require(_0x432f('0x8'));var client=jayson[_0x432f('0x9')][_0x432f('0xa')]({'port':0x232b});function localAuthenticate(_0x5d8cc0,_0x5b5f08,_0x2f66fd,_0x32b062){var _0x4a5b56,_0x2a2ef6;return db['Setting'][_0x432f('0xb')]({'where':{'id':0x1},'attributes':[_0x432f('0xc'),_0x432f('0xd')],'raw':!![]})[_0x432f('0xe')](function(_0x53f3ef){_0x4a5b56=_0x53f3ef;return _0x5d8cc0['findOne']({'attributes':['id',_0x432f('0xf'),'password',_0x432f('0x10'),'role',_0x432f('0x11'),_0x432f('0x12'),'blockedAt',_0x432f('0x13')],'where':{'name':_0x5b5f08,'role':{'$or':[_0x432f('0x14'),'user',_0x432f('0x15')]}}});})[_0x432f('0xe')](function(_0x5dd518){if(!_0x5dd518||_0x5dd518&&_0x5dd518['name']!==_0x5b5f08){throw new Error(_0x432f('0x16'));}else{_0x2a2ef6=_0x5dd518;return _0x2a2ef6;}})[_0x432f('0xe')](function(){_0x2a2ef6[_0x432f('0x17')](_0x2f66fd,function(_0x453725,_0x419bfe){var _0x4f91c5=_0x2a2ef6[_0x432f('0x13')]+0x1;if(_0x453725){return _0x32b062(_0x453725);}else if(!_0x419bfe){if(_0x2a2ef6[_0x432f('0x11')]){return _0x32b062(null,![],{'message':_0x432f('0x16')});}else if(_0x4a5b56[_0x432f('0xc')]>0x0){if(_0x2a2ef6['blocked']){if(_0x4a5b56[_0x432f('0xd')]>0x0){if(moment(_0x2a2ef6[_0x432f('0x18')])[_0x432f('0x19')](_0x4a5b56[_0x432f('0xd')],_0x432f('0x1a'))>moment()){return _0x32b062(null,![],{'message':_0x432f('0x16')});}else{return utils['clearBlockUser'](_0x2a2ef6,_0x4f91c5,![],null)[_0x432f('0xe')](function(){return _0x32b062(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x32b062(null,![],{'message':_0x432f('0x16')});}}else{if(_0x4f91c5>=_0x4a5b56[_0x432f('0xc')]){return utils[_0x432f('0x1b')](_0x2a2ef6,0x0,!![],moment())[_0x432f('0xe')](function(){return _0x32b062(null,![],{'message':_0x432f('0x16')});});}else{return utils[_0x432f('0x1b')](_0x2a2ef6,_0x4f91c5,![],null)[_0x432f('0xe')](function(){return _0x32b062(null,![],{'message':_0x432f('0x16')});});}}}else{return _0x32b062(null,![],{'message':_0x432f('0x16')});}}else{if(_0x2a2ef6[_0x432f('0x11')]){return _0x32b062(null,![],{'message':_0x432f('0x16')});}else if(_0x4a5b56[_0x432f('0xc')]>0x0){if(_0x2a2ef6['blocked']){if(_0x4a5b56['blockDuration']>0x0){if(moment(_0x2a2ef6[_0x432f('0x18')])['add'](_0x4a5b56[_0x432f('0xd')],'minutes')>moment()){return _0x32b062(null,![],{'message':_0x432f('0x16')});}else{return utils[_0x432f('0x1b')](_0x2a2ef6,0x0,![],null)[_0x432f('0xe')](function(){return utils[_0x432f('0x1c')](_0x2a2ef6);})[_0x432f('0xe')](function(){return _0x32b062(null,_0x2a2ef6);});}}else{return _0x32b062(null,![],{'message':_0x432f('0x16')});}}else{return utils['clearBlockUser'](_0x2a2ef6,0x0,![],null)[_0x432f('0xe')](function(){return utils[_0x432f('0x1c')](_0x2a2ef6);})['then'](function(){return _0x32b062(null,_0x2a2ef6);})[_0x432f('0x1d')](function(_0x3e37ec){return _0x32b062(null,![],_0x3e37ec);});}}else{if(_0x2a2ef6[_0x432f('0x12')]){return _0x32b062(null,![],{'message':_0x432f('0x16')});}else{return utils[_0x432f('0x1c')](_0x2a2ef6)[_0x432f('0xe')](function(){return _0x32b062(null,_0x2a2ef6);});}}}});})[_0x432f('0x1d')](function(_0x5a3d18){return _0x32b062(null,![],_0x5a3d18);});}function sendServiceMail(_0x294bfe){return db['MailAccount'][_0x432f('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x432f('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x432f('0x20')}]})['then'](function(_0x325a9c){if(!_0x325a9c){throw new Error(_0x432f('0x21'));}var _0x263cd8={'tls':{'rejectUnauthorized':![]}};if(_0x325a9c['Smtp'][_0x432f('0x22')]){_0x263cd8[_0x432f('0x22')]=_0x325a9c['Smtp']['service'];}else{_0x263cd8[_0x432f('0x23')]=_0x325a9c[_0x432f('0x20')][_0x432f('0x23')];_0x263cd8[_0x432f('0x24')]=_0x325a9c[_0x432f('0x20')][_0x432f('0x24')];_0x263cd8['secure']=_0x325a9c['Smtp'][_0x432f('0x25')];}if(_0x325a9c[_0x432f('0x20')][_0x432f('0x26')]){_0x263cd8['auth']={'user':_0x325a9c[_0x432f('0x20')][_0x432f('0x27')],'pass':_0x325a9c[_0x432f('0x20')][_0x432f('0x28')]};}var _0x4464f3={'account':_0x263cd8,'message':_[_0x432f('0x29')]({'from':util[_0x432f('0x2a')](_0x432f('0x2b'),_0x325a9c['name'],_0x325a9c['email']||_0x325a9c[_0x432f('0x20')][_0x432f('0x27')])},_0x294bfe)};return client['request']('SendMail',_0x4464f3);})['then'](function(_0x1727b7){if(_0x1727b7[_0x432f('0x2c')]){throw new Error(util['format'](_0x432f('0x2d'),_0x1727b7[_0x432f('0x2c')][_0x432f('0x2e')]||JSON['stringify'](_0x1727b7[_0x432f('0x2c')])));}return!![];});}function handleError(_0x440420,_0x499e58,_0x2ffa04){return _0x440420[_0x432f('0x2f')](_0x499e58||0x1f4)['send']({'message':_0x2ffa04?_0x2ffa04[_0x432f('0x2e')]||_0x2ffa04:''});}exports[_0x432f('0x30')]=function(_0x148a95,_0x1a3273,_0x4190c7){passport[_0x432f('0x17')](_0x432f('0x31'),function(_0x2d0d80,_0x244970,_0x2545b7){var _0xbb7bee=_0x2d0d80||_0x2545b7;if(_0xbb7bee){return handleError(_0x1a3273,0x191,_0xbb7bee);}if(!_0x244970){return handleError(_0x1a3273,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3d835e={'payload':{'id':_0x244970['id'],'role':_0x244970['role']},'options':{'expiresIn':0x15180}};return authService[_0x432f('0x32')](_0x3d835e)[_0x432f('0xe')](function(_0x4f38e5){_0x1a3273[_0x432f('0x33')]({'id':_0x244970['id'],'token':_0x4f38e5,'statusCall':'','isAlreadyLogged':_0x244970['online']});});}})(_0x148a95,_0x1a3273,_0x4190c7);};exports[_0x432f('0x34')]=function(_0x3aca68,_0x5e418c,_0x490db5){if(!_0x3aca68[_0x432f('0x35')][_0x432f('0x1f')]){return handleError(_0x5e418c,0x1f4,{'message':_0x432f('0x36')});}var _0x121687=rs[_0x432f('0x37')]();_0x3aca68['body']['email']=_0x3aca68['body'][_0x432f('0x1f')][_0x432f('0x38')]()['toLowerCase']();var _0x1f58af;return db[_0x432f('0x39')][_0x432f('0xb')]({'where':{'id':0x1},'attributes':[_0x432f('0xc'),_0x432f('0xd')],'raw':!![]})[_0x432f('0xe')](function(_0x2c32d1){_0x1f58af=_0x2c32d1;return db[_0x432f('0x3a')][_0x432f('0x1e')]({'where':{'email':_0x3aca68['body'][_0x432f('0x1f')]}});})[_0x432f('0xe')](function(_0x5227e4){if(!_0x5227e4){throw new Error(_0x432f('0x3b'));}if(_0x5227e4[_0x432f('0x11')]){throw new Error(_0x432f('0x3c'));}if(_0x5227e4[_0x432f('0x12')]){if(moment(_0x5227e4[_0x432f('0x18')])[_0x432f('0x19')](_0x1f58af[_0x432f('0xd')],_0x432f('0x1a'))>moment()){throw new Error(_0x432f('0x3d'));}else{_0x5227e4[_0x432f('0x12')]=![];_0x5227e4[_0x432f('0x18')]=null;}}_0x5227e4[_0x432f('0x3e')]=_0x121687;_0x5227e4[_0x432f('0x3f')]=Date[_0x432f('0x40')]()+0x36ee80;return _0x5227e4['save']();})['then'](function(){return sendServiceMail({'to':_0x3aca68[_0x432f('0x35')][_0x432f('0x1f')],'subject':_0x432f('0x41'),'text':_0x432f('0x42')+_0x432f('0x43')+'https://'+_0x3aca68[_0x432f('0x44')][_0x432f('0x23')]+_0x432f('0x45')+_0x121687+'\x0a\x0a'+_0x432f('0x46')});})[_0x432f('0xe')](function(){_0x5e418c[_0x432f('0x2f')](0xc8)[_0x432f('0x47')]({'message':'Reset\x20Email\x20sent!'});})[_0x432f('0x1d')](function(_0x2dd9c2){return handleError(_0x5e418c,0x1f4,_0x2dd9c2);});};exports[_0x432f('0x48')]=function(_0x547bd0,_0x2c023d,_0x2cdb82){return db['User']['find']({'where':{'resetPasswordToken':_0x547bd0[_0x432f('0x49')][_0x432f('0x4a')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x33214e){if(!_0x33214e){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x432f('0x39')][_0x432f('0xb')]({'attributes':['id','securePassword',_0x432f('0x4b'),'passwordHistoryLimit']})[_0x432f('0xe')](function(_0x4162ee){if(_0x4162ee[_0x432f('0x4c')])authService[_0x432f('0x4d')](_0x547bd0[_0x432f('0x35')][_0x432f('0x4e')]);if(!_0x4162ee['enforcePasswordHistory']||!_0x33214e[_0x432f('0x4f')])return _0x33214e;authService['validatePasswordHistory'](_0x547bd0[_0x432f('0x35')][_0x432f('0x4e')],_0x33214e[_0x432f('0x4f')],_0x4162ee[_0x432f('0x50')]);return _0x33214e;})['then'](function(){_0x33214e[_0x432f('0x4e')]=_0x547bd0[_0x432f('0x35')][_0x432f('0x4e')];_0x33214e[_0x432f('0x3e')]=null;_0x33214e[_0x432f('0x3f')]=null;return _0x33214e[_0x432f('0x51')]();});})[_0x432f('0xe')](function(){_0x2c023d['status'](0xc8)['send']({'message':_0x432f('0x52')});})[_0x432f('0x1d')](function(_0x2e318b){return handleError(_0x2c023d,0x1f4,_0x2e318b);});};passport[_0x432f('0x53')](new LocalStrategy({'usernameField':_0x432f('0xf'),'passwordField':_0x432f('0x4e')},function(_0x54aa87,_0x134d9b,_0x545035){return localAuthenticate(db['User'],_0x54aa87,_0x134d9b,_0x545035);})); \ No newline at end of file +var _0x7b84=['authenticate','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','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.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','minutes','clearBlockUser','add','getLicense','catch','MailAccount','MailServerOut','Smtp','service','port','authentication','auth','pass','merge','format','email','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message'];(function(_0x404c7f,_0x280229){var _0x210d2f=function(_0x392c4e){while(--_0x392c4e){_0x404c7f['push'](_0x404c7f['shift']());}};_0x210d2f(++_0x280229);}(_0x7b84,0x17c));var _0x47b8=function(_0x4f63e9,_0x560ea4){_0x4f63e9=_0x4f63e9-0x0;var _0x318bed=_0x7b84[_0x4f63e9];return _0x318bed;};'use strict';var util=require(_0x47b8('0x0'));var passport=require(_0x47b8('0x1'));var LocalStrategy=require(_0x47b8('0x2'))[_0x47b8('0x3')];var jayson=require(_0x47b8('0x4'));var _=require(_0x47b8('0x5'));var rs=require(_0x47b8('0x6'));var moment=require('moment');var db=require(_0x47b8('0x7'))['db'];var authService=require(_0x47b8('0x8'));var utils=require(_0x47b8('0x9'));var client=jayson[_0x47b8('0xa')][_0x47b8('0xb')]({'port':0x232b});function localAuthenticate(_0xafe88a,_0x53e656,_0x3867ca,_0x3ce846){var _0x46245a,_0xb845c9;return db[_0x47b8('0xc')][_0x47b8('0xd')]({'where':{'id':0x1},'attributes':[_0x47b8('0xe'),_0x47b8('0xf')],'raw':!![]})[_0x47b8('0x10')](function(_0x429262){_0x46245a=_0x429262;return _0xafe88a[_0x47b8('0xd')]({'attributes':['id',_0x47b8('0x11'),_0x47b8('0x12'),_0x47b8('0x13'),_0x47b8('0x14'),_0x47b8('0x15'),_0x47b8('0x16'),_0x47b8('0x17'),_0x47b8('0x18')],'where':{'name':_0x53e656,'role':{'$or':[_0x47b8('0x19'),_0x47b8('0x1a'),_0x47b8('0x1b')]}}});})[_0x47b8('0x10')](function(_0x268440){if(!_0x268440||_0x268440&&_0x268440[_0x47b8('0x11')]!==_0x53e656){throw new Error(_0x47b8('0x1c'));}else{_0xb845c9=_0x268440;return _0xb845c9;}})[_0x47b8('0x10')](function(){_0xb845c9['authenticate'](_0x3867ca,function(_0x1fe3b7,_0x340da0){var _0x3e760a=_0xb845c9[_0x47b8('0x18')]+0x1;if(_0x1fe3b7){return _0x3ce846(_0x1fe3b7);}else if(!_0x340da0){if(_0xb845c9[_0x47b8('0x15')]){return _0x3ce846(null,![],{'message':_0x47b8('0x1c')});}else if(_0x46245a[_0x47b8('0xe')]>0x0){if(_0xb845c9['blocked']){if(_0x46245a[_0x47b8('0xf')]>0x0){if(moment(_0xb845c9['blockedAt'])['add'](_0x46245a['blockDuration'],_0x47b8('0x1d'))>moment()){return _0x3ce846(null,![],{'message':_0x47b8('0x1c')});}else{return utils[_0x47b8('0x1e')](_0xb845c9,_0x3e760a,![],null)['then'](function(){return _0x3ce846(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x3ce846(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3e760a>=_0x46245a[_0x47b8('0xe')]){return utils['clearBlockUser'](_0xb845c9,0x0,!![],moment())[_0x47b8('0x10')](function(){return _0x3ce846(null,![],{'message':_0x47b8('0x1c')});});}else{return utils[_0x47b8('0x1e')](_0xb845c9,_0x3e760a,![],null)[_0x47b8('0x10')](function(){return _0x3ce846(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3ce846(null,![],{'message':_0x47b8('0x1c')});}}else{if(_0xb845c9[_0x47b8('0x15')]){return _0x3ce846(null,![],{'message':_0x47b8('0x1c')});}else if(_0x46245a[_0x47b8('0xe')]>0x0){if(_0xb845c9[_0x47b8('0x16')]){if(_0x46245a[_0x47b8('0xf')]>0x0){if(moment(_0xb845c9['blockedAt'])[_0x47b8('0x1f')](_0x46245a[_0x47b8('0xf')],'minutes')>moment()){return _0x3ce846(null,![],{'message':_0x47b8('0x1c')});}else{return utils[_0x47b8('0x1e')](_0xb845c9,0x0,![],null)[_0x47b8('0x10')](function(){return utils[_0x47b8('0x20')](_0xb845c9);})['then'](function(){return _0x3ce846(null,_0xb845c9);});}}else{return _0x3ce846(null,![],{'message':_0x47b8('0x1c')});}}else{return utils[_0x47b8('0x1e')](_0xb845c9,0x0,![],null)[_0x47b8('0x10')](function(){return utils[_0x47b8('0x20')](_0xb845c9);})[_0x47b8('0x10')](function(){return _0x3ce846(null,_0xb845c9);})[_0x47b8('0x21')](function(_0x40918f){return _0x3ce846(null,![],_0x40918f);});}}else{if(_0xb845c9['blocked']){return _0x3ce846(null,![],{'message':_0x47b8('0x1c')});}else{return utils[_0x47b8('0x20')](_0xb845c9)['then'](function(){return _0x3ce846(null,_0xb845c9);});}}}});})[_0x47b8('0x21')](function(_0x6d517a){return _0x3ce846(null,![],_0x6d517a);});}function sendServiceMail(_0x147878){return db[_0x47b8('0x22')]['find']({'where':{'service':!![]},'attributes':['id',_0x47b8('0x11'),'email'],'include':[{'model':db[_0x47b8('0x23')],'as':_0x47b8('0x24')}]})[_0x47b8('0x10')](function(_0x2e540d){if(!_0x2e540d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x35fbbb={'tls':{'rejectUnauthorized':![]}};if(_0x2e540d[_0x47b8('0x24')][_0x47b8('0x25')]){_0x35fbbb[_0x47b8('0x25')]=_0x2e540d[_0x47b8('0x24')][_0x47b8('0x25')];}else{_0x35fbbb['host']=_0x2e540d['Smtp']['host'];_0x35fbbb[_0x47b8('0x26')]=_0x2e540d[_0x47b8('0x24')][_0x47b8('0x26')];_0x35fbbb['secure']=_0x2e540d['Smtp']['secure'];}if(_0x2e540d['Smtp'][_0x47b8('0x27')]){_0x35fbbb[_0x47b8('0x28')]={'user':_0x2e540d[_0x47b8('0x24')][_0x47b8('0x1a')],'pass':_0x2e540d[_0x47b8('0x24')][_0x47b8('0x29')]};}var _0x447ed5={'account':_0x35fbbb,'message':_[_0x47b8('0x2a')]({'from':util[_0x47b8('0x2b')]('\x22%s\x22\x20<%s>',_0x2e540d['name'],_0x2e540d[_0x47b8('0x2c')]||_0x2e540d[_0x47b8('0x24')]['user'])},_0x147878)};return client['request'](_0x47b8('0x2d'),_0x447ed5);})[_0x47b8('0x10')](function(_0x171e2f){if(_0x171e2f['error']){throw new Error(util[_0x47b8('0x2b')](_0x47b8('0x2e'),_0x171e2f['error']['message']||JSON['stringify'](_0x171e2f['error'])));}return!![];});}function handleError(_0x8ec36e,_0x12078e,_0x3b09ce){return _0x8ec36e[_0x47b8('0x2f')](_0x12078e||0x1f4)[_0x47b8('0x30')]({'message':_0x3b09ce?_0x3b09ce[_0x47b8('0x31')]||_0x3b09ce:''});}exports['login']=function(_0x494a53,_0x1259b7,_0x2faffc){passport[_0x47b8('0x32')]('local',function(_0x50127f,_0x996261,_0x2c89bc){var _0x5b1359=_0x50127f||_0x2c89bc;if(_0x5b1359){return handleError(_0x1259b7,0x191,_0x5b1359);}if(!_0x996261){return handleError(_0x1259b7,0x194,{'message':_0x47b8('0x33')});}else{var _0x19082a={'payload':{'id':_0x996261['id'],'role':_0x996261['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x19082a)['then'](function(_0x508947){_0x1259b7[_0x47b8('0x34')]({'id':_0x996261['id'],'token':_0x508947,'statusCall':'','isAlreadyLogged':_0x996261[_0x47b8('0x35')]});});}})(_0x494a53,_0x1259b7,_0x2faffc);};exports[_0x47b8('0x36')]=function(_0x28cf2c,_0x3289c1,_0x5abcd1){if(!_0x28cf2c[_0x47b8('0x37')]['email']){return handleError(_0x3289c1,0x1f4,{'message':_0x47b8('0x38')});}var _0x8dc3fd=rs[_0x47b8('0x39')]();_0x28cf2c['body'][_0x47b8('0x2c')]=_0x28cf2c[_0x47b8('0x37')][_0x47b8('0x2c')][_0x47b8('0x3a')]()[_0x47b8('0x3b')]();var _0x15b9a1;return db[_0x47b8('0xc')]['findOne']({'where':{'id':0x1},'attributes':[_0x47b8('0xe'),'blockDuration'],'raw':!![]})[_0x47b8('0x10')](function(_0x31c653){_0x15b9a1=_0x31c653;return db[_0x47b8('0x3c')][_0x47b8('0x3d')]({'where':{'email':_0x28cf2c[_0x47b8('0x37')][_0x47b8('0x2c')]}});})['then'](function(_0x493730){if(!_0x493730){throw new Error(_0x47b8('0x3e'));}if(_0x493730[_0x47b8('0x15')]){throw new Error(_0x47b8('0x3f'));}if(_0x493730['blocked']){if(moment(_0x493730[_0x47b8('0x17')])['add'](_0x15b9a1[_0x47b8('0xf')],_0x47b8('0x1d'))>moment()){throw new Error(_0x47b8('0x40'));}else{_0x493730[_0x47b8('0x16')]=![];_0x493730[_0x47b8('0x17')]=null;}}_0x493730['resetPasswordToken']=_0x8dc3fd;_0x493730[_0x47b8('0x41')]=Date[_0x47b8('0x42')]()+0x36ee80;return _0x493730[_0x47b8('0x43')]();})[_0x47b8('0x10')](function(){return sendServiceMail({'to':_0x28cf2c[_0x47b8('0x37')][_0x47b8('0x2c')],'subject':_0x47b8('0x44'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x47b8('0x45')+'https://'+_0x28cf2c[_0x47b8('0x46')][_0x47b8('0x47')]+'/reset/'+_0x8dc3fd+'\x0a\x0a'+_0x47b8('0x48')});})[_0x47b8('0x10')](function(){_0x3289c1[_0x47b8('0x2f')](0xc8)[_0x47b8('0x30')]({'message':_0x47b8('0x49')});})[_0x47b8('0x21')](function(_0x1b1733){return handleError(_0x3289c1,0x1f4,_0x1b1733);});};exports[_0x47b8('0x4a')]=function(_0x4ad8a8,_0xf69232,_0x2e5996){return db[_0x47b8('0x3c')]['find']({'where':{'resetPasswordToken':_0x4ad8a8[_0x47b8('0x4b')][_0x47b8('0x4c')],'resetPasswordExpires':{'$gt':Date[_0x47b8('0x42')]()}}})[_0x47b8('0x10')](function(_0x5edde7){if(!_0x5edde7){throw new Error(_0x47b8('0x4d'));}return db[_0x47b8('0xc')]['findOne']({'attributes':['id',_0x47b8('0x4e'),_0x47b8('0x4f'),_0x47b8('0x50')]})['then'](function(_0x267aef){if(_0x267aef['securePassword'])authService[_0x47b8('0x51')](_0x4ad8a8['body'][_0x47b8('0x12')]);if(!_0x267aef['enforcePasswordHistory']||!_0x5edde7[_0x47b8('0x52')])return _0x5edde7;authService[_0x47b8('0x53')](_0x4ad8a8[_0x47b8('0x37')][_0x47b8('0x12')],_0x5edde7['previousPasswords'],_0x267aef[_0x47b8('0x50')]);return _0x5edde7;})[_0x47b8('0x10')](function(){_0x5edde7[_0x47b8('0x12')]=_0x4ad8a8[_0x47b8('0x37')]['password'];_0x5edde7[_0x47b8('0x54')]=null;_0x5edde7[_0x47b8('0x41')]=null;return _0x5edde7[_0x47b8('0x43')]();});})['then'](function(){_0xf69232['status'](0xc8)[_0x47b8('0x30')]({'message':'Password\x20reset!'});})[_0x47b8('0x21')](function(_0x3128ef){return handleError(_0xf69232,0x1f4,_0x3128ef);});};passport[_0x47b8('0x55')](new LocalStrategy({'usernameField':_0x47b8('0x11'),'passwordField':'password'},function(_0x27d91c,_0x3bfeee,_0x157bf5){return localAuthenticate(db['User'],_0x27d91c,_0x3bfeee,_0x157bf5);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 56e123d..0d6d8dc 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 _0xbe8e=['post','login','/forgot','forgot','exports','express','Router','./authLocal.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe8e,0xd5));var _0xebe8=function(_0x2475e4,_0x2845d2){_0x2475e4=_0x2475e4-0x0;var _0x2d3af3=_0xbe8e[_0x2475e4];return _0x2d3af3;};'use strict';var express=require(_0xebe8('0x0'));var router=express[_0xebe8('0x1')]();var controller=require(_0xebe8('0x2'));router[_0xebe8('0x3')]('/',controller[_0xebe8('0x4')]);router['post'](_0xebe8('0x5'),controller[_0xebe8('0x6')]);router[_0xebe8('0x3')]('/reset/:token',controller['reset']);module[_0xebe8('0x7')]=router; \ No newline at end of file +var _0x9973=['express','./authLocal.controller','login','/forgot','forgot','post','reset','exports'];(function(_0x53e4d4,_0x23432e){var _0x1a02f6=function(_0x46b2ef){while(--_0x46b2ef){_0x53e4d4['push'](_0x53e4d4['shift']());}};_0x1a02f6(++_0x23432e);}(_0x9973,0x130));var _0x3997=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9973[_0x122ef9];return _0x42fba0;};'use strict';var express=require(_0x3997('0x0'));var router=express['Router']();var controller=require(_0x3997('0x1'));router['post']('/',controller[_0x3997('0x2')]);router['post'](_0x3997('0x3'),controller[_0x3997('0x4')]);router[_0x3997('0x5')]('/reset/:token',controller[_0x3997('0x6')]);module[_0x3997('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 6aef742..8872432 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 _0xbe2a=['INTEGER','sequelize','STRING'];(function(_0x1986b6,_0x53b923){var _0x4fbf17=function(_0x48bcdb){while(--_0x48bcdb){_0x1986b6['push'](_0x1986b6['shift']());}};_0x4fbf17(++_0x53b923);}(_0xbe2a,0x15a));var _0xabe2=function(_0x11e182,_0x7bd3cd){_0x11e182=_0x11e182-0x0;var _0x438579=_0xbe2a[_0x11e182];return _0x438579;};'use strict';var Sequelize=require(_0xabe2('0x0'));module['exports']={'name':{'type':Sequelize[_0xabe2('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xabe2('0x1')]},'description':{'type':Sequelize[_0xabe2('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xabe2('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x88e3=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x88e3,0x157));var _0x388e=function(_0x1dc01f,_0x157a75){_0x1dc01f=_0x1dc01f-0x0;var _0x298041=_0x88e3[_0x1dc01f];return _0x298041;};'use strict';var Sequelize=require(_0x388e('0x0'));module['exports']={'name':{'type':Sequelize[_0x388e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x388e('0x1')]},'description':{'type':Sequelize[_0x388e('0x1')]},'status':{'type':Sequelize[_0x388e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x388e('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 a5c2700..c8d39b4 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 _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0x4958ce,_0x5c963c){var _0xe36f28=function(_0x2b86c8){while(--_0x2b86c8){_0x4958ce['push'](_0x4958ce['shift']());}};_0xe36f28(++_0x5c963c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0x11645b,_0x26eb5c){var _0x361e60=function(_0x449acf){while(--_0x449acf){_0x11645b['push'](_0x11645b['shift']());}};_0x361e60(++_0x26eb5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index b79035b..d91ebc0 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 _0xf865=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','define','tools_automations','lodash','util','../../config/logger','api'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xf865,0x11a));var _0x5f86=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xf865[_0x770f7];return _0xe797c6;};'use strict';var _=require(_0x5f86('0x0'));var util=require(_0x5f86('0x1'));var logger=require(_0x5f86('0x2'))(_0x5f86('0x3'));var moment=require(_0x5f86('0x4'));var BPromise=require(_0x5f86('0x5'));var rp=require(_0x5f86('0x6'));var fs=require('fs');var path=require(_0x5f86('0x7'));var rimraf=require(_0x5f86('0x8'));var config=require(_0x5f86('0x9'));var attributes=require(_0x5f86('0xa'));module['exports']=function(_0x341d37,_0x5332e4){return _0x341d37[_0x5f86('0xb')]('Automation',attributes,{'tableName':_0x5f86('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc5d=['exports','define','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x305551,_0x868339){var _0x115ce2=function(_0x49265b){while(--_0x49265b){_0x305551['push'](_0x305551['shift']());}};_0x115ce2(++_0x868339);}(_0xdc5d,0x14d));var _0xddc5=function(_0x13ff53,_0x5e1424){_0x13ff53=_0x13ff53-0x0;var _0x290228=_0xdc5d[_0x13ff53];return _0x290228;};'use strict';var _=require(_0xddc5('0x0'));var util=require(_0xddc5('0x1'));var logger=require(_0xddc5('0x2'))(_0xddc5('0x3'));var moment=require(_0xddc5('0x4'));var BPromise=require(_0xddc5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddc5('0x6'));var rimraf=require(_0xddc5('0x7'));var config=require('../../config/environment');var attributes=require('./automation.attributes');module[_0xddc5('0x8')]=function(_0x29fb3a,_0x55edd4){return _0x29fb3a[_0xddc5('0x9')]('Automation',attributes,{'tableName':_0xddc5('0xa'),'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 b9b547a..de05ee5 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 _0x153a=['Automation,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xf175ff,_0x2ec742){var _0x34f944=function(_0x3e245a){while(--_0x3e245a){_0xf175ff['push'](_0xf175ff['shift']());}};_0x34f944(++_0x2ec742);}(_0x153a,0x172));var _0xa153=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x153a[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0xa153('0x0'));var util=require(_0xa153('0x1'));var moment=require(_0xa153('0x2'));var BPromise=require(_0xa153('0x3'));var rs=require(_0xa153('0x4'));var fs=require('fs');var Redis=require(_0xa153('0x5'));var db=require(_0xa153('0x6'))['db'];var utils=require(_0xa153('0x7'));var logger=require(_0xa153('0x8'))(_0xa153('0x9'));var config=require(_0xa153('0xa'));var jayson=require(_0xa153('0xb'));var client=jayson['client'][_0xa153('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ca177,_0x36c970,_0x11457a){return new BPromise(function(_0x5b2676,_0x5423f7){return client['request'](_0x3ca177,_0x11457a)[_0xa153('0xd')](function(_0x3e7328){logger[_0xa153('0xe')]('Automation,\x20%s,\x20%s',_0x36c970,_0xa153('0xf'));logger[_0xa153('0x10')](_0xa153('0x11'),_0x36c970,_0xa153('0xf'),JSON[_0xa153('0x12')](_0x3e7328));if(_0x3e7328[_0xa153('0x13')]){if(_0x3e7328[_0xa153('0x13')][_0xa153('0x14')]===0x1f4){logger['error'](_0xa153('0x15'),_0x36c970,_0x3e7328[_0xa153('0x13')][_0xa153('0x16')]);return _0x5423f7(_0x3e7328[_0xa153('0x13')][_0xa153('0x16')]);}logger[_0xa153('0x13')]('Automation,\x20%s,\x20%s',_0x36c970,_0x3e7328['error'][_0xa153('0x16')]);return _0x5b2676(_0x3e7328[_0xa153('0x13')][_0xa153('0x16')]);}else{logger[_0xa153('0xe')](_0xa153('0x15'),_0x36c970,_0xa153('0xf'));_0x5b2676(_0x3e7328['result'][_0xa153('0x16')]);}})['catch'](function(_0x13e807){logger[_0xa153('0x13')](_0xa153('0x15'),_0x36c970,_0x13e807);_0x5423f7(_0x13e807);});});} \ No newline at end of file +var _0x8f73=['info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then'];(function(_0x8d695e,_0x394999){var _0x3d156e=function(_0x38cf6f){while(--_0x38cf6f){_0x8d695e['push'](_0x8d695e['shift']());}};_0x3d156e(++_0x394999);}(_0x8f73,0x12b));var _0x38f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8f73[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x38f7('0x0'));var util=require(_0x38f7('0x1'));var moment=require(_0x38f7('0x2'));var BPromise=require(_0x38f7('0x3'));var rs=require(_0x38f7('0x4'));var fs=require('fs');var Redis=require(_0x38f7('0x5'));var db=require(_0x38f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x38f7('0x7'));var config=require(_0x38f7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38f7('0x9')][_0x38f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ef086,_0x5a8dc8,_0x53e886){return new BPromise(function(_0x12959e,_0x268acf){return client[_0x38f7('0xb')](_0x4ef086,_0x53e886)[_0x38f7('0xc')](function(_0x3a0c27){logger[_0x38f7('0xd')](_0x38f7('0xe'),_0x5a8dc8,'request\x20sent');logger[_0x38f7('0xf')](_0x38f7('0x10'),_0x5a8dc8,_0x38f7('0x11'),JSON[_0x38f7('0x12')](_0x3a0c27));if(_0x3a0c27[_0x38f7('0x13')]){if(_0x3a0c27[_0x38f7('0x13')][_0x38f7('0x14')]===0x1f4){logger['error'](_0x38f7('0xe'),_0x5a8dc8,_0x3a0c27['error']['message']);return _0x268acf(_0x3a0c27[_0x38f7('0x13')][_0x38f7('0x15')]);}logger['error'](_0x38f7('0xe'),_0x5a8dc8,_0x3a0c27[_0x38f7('0x13')][_0x38f7('0x15')]);return _0x12959e(_0x3a0c27[_0x38f7('0x13')][_0x38f7('0x15')]);}else{logger['info'](_0x38f7('0xe'),_0x5a8dc8,_0x38f7('0x11'));_0x12959e(_0x3a0c27[_0x38f7('0x16')]['message']);}})[_0x38f7('0x17')](function(_0x87e53e){logger[_0x38f7('0x13')](_0x38f7('0xe'),_0x5a8dc8,_0x87e53e);_0x268acf(_0x87e53e);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 4b85ee5..6e090f0 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 _0xd6aa=['destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addActions','update','delete'];(function(_0x1f5c85,_0x5e4141){var _0xc6dd55=function(_0x35b107){while(--_0x35b107){_0x1f5c85['push'](_0x1f5c85['shift']());}};_0xc6dd55(++_0x5e4141);}(_0xd6aa,0x182));var _0xad6a=function(_0x59bffa,_0x598dd8){_0x59bffa=_0x59bffa-0x0;var _0x8ea3ba=_0xd6aa[_0x59bffa];return _0x8ea3ba;};'use strict';var multer=require(_0xad6a('0x0'));var util=require(_0xad6a('0x1'));var path=require('path');var timeout=require(_0xad6a('0x2'));var express=require('express');var router=express[_0xad6a('0x3')]();var auth=require(_0xad6a('0x4'));var interaction=require(_0xad6a('0x5'));var config=require(_0xad6a('0x6'));var controller=require(_0xad6a('0x7'));router[_0xad6a('0x8')]('/',auth[_0xad6a('0x9')](),controller[_0xad6a('0xa')]);router[_0xad6a('0x8')](_0xad6a('0xb'),auth['isAuthenticated'](),controller[_0xad6a('0xc')]);router['get'](_0xad6a('0xd'),auth['isAuthenticated'](),controller[_0xad6a('0xe')]);router[_0xad6a('0x8')](_0xad6a('0xf'),auth[_0xad6a('0x9')](),controller[_0xad6a('0x10')]);router['post']('/',auth[_0xad6a('0x9')](),controller[_0xad6a('0x11')]);router[_0xad6a('0x12')]('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0xad6a('0x12')]('/:id/actions',auth['isAuthenticated'](),controller[_0xad6a('0x13')]);router['put'](_0xad6a('0xb'),auth[_0xad6a('0x9')](),controller[_0xad6a('0x14')]);router[_0xad6a('0x15')](_0xad6a('0xb'),auth[_0xad6a('0x9')](),controller[_0xad6a('0x16')]);module[_0xad6a('0x17')]=router; \ No newline at end of file +var _0x597c=['/:id','show','/:id/conditions','getConditions','getActions','post','create','addConditions','/:id/actions','addActions','put','update','delete','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x480f4a,_0x2ea3f8){var _0xdccb7d=function(_0x151258){while(--_0x151258){_0x480f4a['push'](_0x480f4a['shift']());}};_0xdccb7d(++_0x2ea3f8);}(_0x597c,0x16d));var _0xc597=function(_0x212dcf,_0x4f4e83){_0x212dcf=_0x212dcf-0x0;var _0x53f0b1=_0x597c[_0x212dcf];return _0x53f0b1;};'use strict';var multer=require(_0xc597('0x0'));var util=require(_0xc597('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc597('0x2')]();var auth=require(_0xc597('0x3'));var interaction=require(_0xc597('0x4'));var config=require(_0xc597('0x5'));var controller=require('./automation.controller');router[_0xc597('0x6')]('/',auth[_0xc597('0x7')](),controller[_0xc597('0x8')]);router[_0xc597('0x6')](_0xc597('0x9'),auth[_0xc597('0x7')](),controller[_0xc597('0xa')]);router['get'](_0xc597('0xb'),auth[_0xc597('0x7')](),controller[_0xc597('0xc')]);router[_0xc597('0x6')]('/:id/actions',auth[_0xc597('0x7')](),controller[_0xc597('0xd')]);router[_0xc597('0xe')]('/',auth[_0xc597('0x7')](),controller[_0xc597('0xf')]);router[_0xc597('0xe')](_0xc597('0xb'),auth[_0xc597('0x7')](),controller[_0xc597('0x10')]);router[_0xc597('0xe')](_0xc597('0x11'),auth['isAuthenticated'](),controller[_0xc597('0x12')]);router[_0xc597('0x13')](_0xc597('0x9'),auth[_0xc597('0x7')](),controller[_0xc597('0x14')]);router[_0xc597('0x15')](_0xc597('0x9'),auth[_0xc597('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index b9453c1..f0f7ed5 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 _0x23e8=['exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#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'];(function(_0x235802,_0x423aaa){var _0xd80393=function(_0x2e061a){while(--_0x2e061a){_0x235802['push'](_0x235802['shift']());}};_0xd80393(++_0x423aaa);}(_0x23e8,0x180));var _0x823e=function(_0x53d48b,_0x23ceb3){_0x53d48b=_0x53d48b-0x0;var _0x1d95f6=_0x23e8[_0x53d48b];return _0x1d95f6;};'use strict';var Sequelize=require(_0x823e('0x0'));module[_0x823e('0x1')]={'name':{'type':Sequelize[_0x823e('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x823e('0x3')](_0x823e('0x4')),'allowNull':![],'defaultValue':_0x823e('0x4')},'description':{'type':Sequelize[_0x823e('0x2')]},'active':{'type':Sequelize[_0x823e('0x5')],'defaultValue':0x0,'comment':_0x823e('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x823e('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x823e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x823e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x823e('0x8')](0x3)[_0x823e('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x823e('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x823e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x823e('0x8')](0x5)[_0x823e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x823e('0x8')](0x3)[_0x823e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x823e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x823e('0x8')](0x5)[_0x823e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x823e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x823e('0x8')](0x3)[_0x823e('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x823e('0x8')](0x5)[_0x823e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x823e('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x823e('0x8')](0x3)[_0x823e('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x823e('0xe')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x823e('0x3')](_0x823e('0xf'),_0x823e('0x10'),'onlyIfOpen'),'defaultValue':_0x823e('0xf')},'dialAMDActive':{'type':Sequelize[_0x823e('0x5')],'defaultValue':0x0,'comment':_0x823e('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x823e('0x8')](0x9)[_0x823e('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x823e('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x823e('0x8')](0x9)[_0x823e('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x823e('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x823e('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x823e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x823e('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x823e('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x823e('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x823e('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x823e('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x823e('0x8')](0x5)[_0x823e('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x823e('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x823e('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x823e('0x17'),'ASC'),'defaultValue':_0x823e('0x17')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x823e('0x18')},'dialCutDigit':{'type':Sequelize[_0x823e('0x8')](0x3)[_0x823e('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x823e('0x19')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x823e('0x8')](0x3)[_0x823e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x823e('0x1a')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x823e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x823e('0x1b')},'dialDropMaxRetry':{'type':Sequelize[_0x823e('0x8')](0x3)[_0x823e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x823e('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0x823e('0x8')](0x5)[_0x823e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x823e('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x823e('0x8')](0x3)[_0x823e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x823e('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x823e('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x823e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x823e('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x823e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x823e('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x823e('0x8')](0x3)[_0x823e('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x823e('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x823e('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x823e('0x22')}}; \ No newline at end of file +var _0xa162=['NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xa162,0x15f));var _0x2a16=function(_0x140466,_0x3d32d1){_0x140466=_0x140466-0x0;var _0x2bbe06=_0xa162[_0x140466];return _0x2bbe06;};'use strict';var Sequelize=require(_0x2a16('0x0'));module[_0x2a16('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2a16('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2a16('0x3')](_0x2a16('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x2a16('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x2a16('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2a16('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2a16('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2a16('0x5')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x2a16('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a16('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2a16('0x9')](0x3)[_0x2a16('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a16('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2a16('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2a16('0x9')](0x3)[_0x2a16('0x6')],'defaultValue':0x3,'comment':_0x2a16('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2a16('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a16('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2a16('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2a16('0xd')},'dialTimezone':{'type':Sequelize[_0x2a16('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2a16('0x5')],'defaultValue':_0x2a16('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x2a16('0x3')]('always',_0x2a16('0xf'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x2a16('0x10')],'defaultValue':0x0,'comment':_0x2a16('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x2a16('0x9')](0x9)[_0x2a16('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x2a16('0x9')](0x9)[_0x2a16('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2a16('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2a16('0x9')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2a16('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2a16('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x2a16('0x9')](0x9)[_0x2a16('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2a16('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2a16('0x9')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2a16('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x2a16('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2a16('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2a16('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2a16('0x3')](_0x2a16('0x18'),_0x2a16('0x19')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x2a16('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2a16('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2a16('0x1a')},'dialCutDigit':{'type':Sequelize[_0x2a16('0x9')](0x3)[_0x2a16('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2a16('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2a16('0x9')](0x3)[_0x2a16('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a16('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2a16('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a16('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x2a16('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x2a16('0x9')](0x5)[_0x2a16('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a16('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2a16('0x9')](0x3)[_0x2a16('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2a16('0x9')](0x5)[_0x2a16('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a16('0x1f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a16('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x2a16('0x9')](0x5)[_0x2a16('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a16('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2a16('0x9')](0x3)[_0x2a16('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2a16('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3d03c94..808a7f6 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 _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x43a847,_0x6219a7){var _0x40366b=function(_0x10e153){while(--_0x10e153){_0x43a847['push'](_0x43a847['shift']());}};_0x40366b(++_0x6219a7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file +var _0xa9e0=['NOW()','scheduledAt','ContactId','CmListId','toString','from','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','IvrCampaigns','UserProfileResource','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','createdAt','autoAssociation','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ListId','select','field'];(function(_0x43474f,_0x17b0fb){var _0x2ee9de=function(_0x400234){while(--_0x400234){_0x43474f['push'](_0x43474f['shift']());}};_0x2ee9de(++_0x17b0fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x47')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_0x8d6dd1[_0x0a9e('0x48')],{})[_0x0a9e('0x22')](function(_0x45c845){var _0x37be73=_0x8d6dd1[_0x0a9e('0x49')]['get']({'plain':!![]});if(!_0x37be73)throw new Error(_0x0a9e('0x4a'));if(_0x37be73[_0x0a9e('0x4b')]===_0x0a9e('0x49')){var _0x16f976=_0x45c845[_0x0a9e('0x4c')]({'plain':!![]});var _0x992c77=_0x0a9e('0x23');return db[_0x0a9e('0x4d')][_0x0a9e('0x4e')]({'where':{'name':_0x992c77,'userProfileId':_0x37be73['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x3fe430){if(_0x3fe430&&_0x3fe430['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x16f976[_0x0a9e('0x26')],'resourceId':_0x16f976['id'],'type':_0x3fe430[_0x0a9e('0x26')],'sectionId':_0x3fe430['id']},{})[_0x0a9e('0x22')](function(){return _0x45c845;});}else{return _0x45c845;}})[_0x0a9e('0x42')](function(_0x61bb17){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0x61bb17);throw _0x61bb17;});}return _0x45c845;})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))['catch'](handleError(_0x562fb4,null));};exports['clone']=function(_0x53975a,_0x39d77d){var _0x204173={'where':{'id':_0x53975a['params']['id']}},_0x14d602={};_0x14d602[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db['Campaign']['rawAttributes']);_0x204173[_0x0a9e('0x33')]=_['intersection'](_0x14d602[_0x0a9e('0x2f')],qs['fields'](_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x204173[_0x0a9e('0x33')]=_0x204173['attributes'][_0x0a9e('0x35')]?_0x204173[_0x0a9e('0x33')]:_0x14d602['model'];if(_0x53975a['query'][_0x0a9e('0x45')]){_0x204173[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x204173=_['merge']({},_0x204173,_0x53975a[_0x0a9e('0x46')]);return db['Campaign'][_0x0a9e('0x4e')](_0x204173)['then'](handleEntityNotFound(_0x39d77d,null))[_0x0a9e('0x22')](function(_0x4a6deb){if(_0x4a6deb){var _0x5da27d=_0x4a6deb['get']({'plain':!![]});_0x5da27d=qs[_0x0a9e('0x51')](_0x5da27d,['id','createdAt',_0x0a9e('0x52')]);_0x53975a[_0x0a9e('0x48')]=_[_0x0a9e('0x51')](_0x53975a[_0x0a9e('0x48')],['id',_0x0a9e('0x53'),_0x0a9e('0x52')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x47')](_['merge'](_0x5da27d,_0x53975a[_0x0a9e('0x48')]),{'include':_0x53975a[_0x0a9e('0x30')][_0x0a9e('0x45')]?[{'all':!![]}]:undefined})[_0x0a9e('0x22')](function(_0xb83dfd){var _0x156662=_0x53975a['user'][_0x0a9e('0x4c')]({'plain':!![]});if(!_0x156662)throw new Error(_0x0a9e('0x4a'));if(_0x156662['role']===_0x0a9e('0x49')){var _0x5cc8fb=_0xb83dfd[_0x0a9e('0x4c')]({'plain':!![]});var _0x5ba1f9='IvrCampaigns';return db['UserProfileSection'][_0x0a9e('0x4e')]({'where':{'name':_0x5ba1f9,'userProfileId':_0x156662['userProfileId']},'raw':!![]})[_0x0a9e('0x22')](function(_0x1fc70e){if(_0x1fc70e&&_0x1fc70e[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x47')]({'name':_0x5cc8fb[_0x0a9e('0x26')],'resourceId':_0x5cc8fb['id'],'type':_0x1fc70e['name'],'sectionId':_0x1fc70e['id']},{})[_0x0a9e('0x22')](function(){return _0xb83dfd;});}else{return _0xb83dfd;}})['catch'](function(_0xca4ade){logger[_0x0a9e('0x4f')](_0x0a9e('0x50'),_0xca4ade);throw _0xca4ade;});}return _0xb83dfd;});}})['then'](respondWithResult(_0x39d77d,0xc9))[_0x0a9e('0x42')](handleError(_0x39d77d,null));};exports[_0x0a9e('0x20')]=function(_0x119677,_0x32e134){if(_0x119677['body']['id']){delete _0x119677[_0x0a9e('0x48')]['id'];}return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x119677[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x32e134,null))[_0x0a9e('0x22')](saveUpdates(_0x119677[_0x0a9e('0x48')],null))[_0x0a9e('0x22')](respondWithResult(_0x32e134,null))['catch'](handleError(_0x32e134,null));};exports[_0x0a9e('0x21')]=function(_0x2937e0,_0x281c7d){return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x2937e0['params']['id']}})['then'](handleEntityNotFound(_0x281c7d,null))[_0x0a9e('0x22')](removeEntity(_0x281c7d,null))[_0x0a9e('0x42')](handleError(_0x281c7d,null));};exports[_0x0a9e('0x55')]=function(_0x19c995,_0x186f39,_0xc8c264){var _0x387489={'raw':!![],'where':{}};var _0x54a37d={};var _0x2d7205={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x19c995[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x186f39,null))[_0x0a9e('0x22')](function(_0x320898){if(_0x320898){_0x54a37d[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x57')]['rawAttributes']);_0x54a37d[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x19c995[_0x0a9e('0x30')]);_0x54a37d['filters']=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],_0x54a37d['query']);_0x387489[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x54a37d[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x19c995[_0x0a9e('0x30')]['fields']));_0x387489['attributes']=_0x387489['attributes'][_0x0a9e('0x35')]?_0x387489[_0x0a9e('0x33')]:_0x54a37d[_0x0a9e('0x2f')];if(!_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x387489[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x19c995['query'][_0x0a9e('0x1a')]);_0x387489[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x19c995['query'][_0x0a9e('0x19')]);}_0x387489['order']=qs[_0x0a9e('0x38')](_0x19c995[_0x0a9e('0x30')]['sort']);_0x387489[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x19c995[_0x0a9e('0x30')],_0x54a37d['filters']));_0x387489[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x320898['id'];if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x387489['where']=_[_0x0a9e('0x3b')](_0x387489[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x387489[_0x0a9e('0x33')],function(_0x4abc8f){var _0x290d43={};_0x290d43[_0x4abc8f]={'$like':'%'+_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x290d43;})});}_0x387489=_[_0x0a9e('0x3b')]({},_0x387489,_0x19c995[_0x0a9e('0x46')]);return db[_0x0a9e('0x57')][_0x0a9e('0x3e')]({'where':_0x387489[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x336dc3){_0x2d7205[_0x0a9e('0x3e')]=_0x336dc3;if(_0x19c995[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x387489[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0x0a9e('0x40')](_0x387489);})[_0x0a9e('0x22')](function(_0xc599b3){_0x2d7205['rows']=_0xc599b3;return _0x2d7205;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x186f39,_0x387489))[_0x0a9e('0x42')](handleError(_0x186f39,null));};exports[_0x0a9e('0x5b')]=function(_0x2b9463,_0x56d650,_0x541e80){var _0x7ebea8={'raw':!![],'where':{}};var _0x2bbdb5={};var _0x4c54fa={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')]['findOne']({'where':{'id':_0x2b9463[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x56d650,null))['then'](function(_0x28a942){if(_0x28a942){_0x2bbdb5[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5c')][_0x0a9e('0x2b')]);_0x2bbdb5[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2b9463['query']);_0x2bbdb5[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],_0x2bbdb5[_0x0a9e('0x30')]);_0x7ebea8['attributes']=_[_0x0a9e('0x32')](_0x2bbdb5[_0x0a9e('0x2f')],qs['fields'](_0x2b9463[_0x0a9e('0x30')]['fields']));_0x7ebea8[_0x0a9e('0x33')]=_0x7ebea8[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x7ebea8[_0x0a9e('0x33')]:_0x2bbdb5['model'];if(!_0x2b9463['query'][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x7ebea8[_0x0a9e('0x1a')]=qs['limit'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x7ebea8['offset']=qs['offset'](_0x2b9463[_0x0a9e('0x30')]['offset']);}_0x7ebea8['order']=qs['sort'](_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x7ebea8[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x2b9463[_0x0a9e('0x30')],_0x2bbdb5['filters']));_0x7ebea8[_0x0a9e('0x3c')]['CampaignId']=_0x28a942['id'];if(_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x7ebea8[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x7ebea8['where'],{'$or':_[_0x0a9e('0x29')](_0x7ebea8[_0x0a9e('0x33')],function(_0x1d4877){var _0x5b74c3={};_0x5b74c3[_0x1d4877]={'$like':'%'+_0x2b9463[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x5b74c3;})});}_0x7ebea8=_[_0x0a9e('0x3b')]({},_0x7ebea8,_0x2b9463[_0x0a9e('0x46')]);return db[_0x0a9e('0x5c')][_0x0a9e('0x3e')]({'where':_0x7ebea8[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x509efe){_0x4c54fa[_0x0a9e('0x3e')]=_0x509efe;if(_0x2b9463[_0x0a9e('0x30')]['includeAll']){_0x7ebea8[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5c')][_0x0a9e('0x40')](_0x7ebea8);})['then'](function(_0x96672f){_0x4c54fa['rows']=_0x96672f;return _0x4c54fa;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x56d650,_0x7ebea8))[_0x0a9e('0x42')](handleError(_0x56d650,null));};exports[_0x0a9e('0x5d')]=function(_0x1f29bd,_0x842d6f,_0x16341a){var _0x16a039={'raw':!![],'where':{}};var _0x3a9a85={};var _0x501050={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x1f29bd[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x842d6f,null))[_0x0a9e('0x22')](function(_0x3df9e4){if(_0x3df9e4){_0x3a9a85[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x5e')][_0x0a9e('0x2b')]);_0x3a9a85[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1f29bd[_0x0a9e('0x30')]);_0x3a9a85['filters']=_[_0x0a9e('0x32')](_0x3a9a85[_0x0a9e('0x2f')],_0x3a9a85[_0x0a9e('0x30')]);_0x16a039[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x3a9a85['model'],qs[_0x0a9e('0x34')](_0x1f29bd[_0x0a9e('0x30')]['fields']));_0x16a039[_0x0a9e('0x33')]=_0x16a039['attributes'][_0x0a9e('0x35')]?_0x16a039[_0x0a9e('0x33')]:_0x3a9a85[_0x0a9e('0x2f')];if(!_0x1f29bd[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x58'))){_0x16a039['limit']=qs[_0x0a9e('0x1a')](_0x1f29bd[_0x0a9e('0x30')]['limit']);_0x16a039[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x1f29bd[_0x0a9e('0x30')]['offset']);}_0x16a039['order']=qs[_0x0a9e('0x38')](_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x16a039[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x1f29bd[_0x0a9e('0x30')],_0x3a9a85[_0x0a9e('0x39')]));_0x16a039[_0x0a9e('0x3c')]['CampaignId']=_0x3df9e4['id'];if(_0x1f29bd[_0x0a9e('0x30')]['filter']){_0x16a039[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x16a039[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x16a039[_0x0a9e('0x33')],function(_0x4e7273){var _0x436313={};_0x436313[_0x4e7273]={'$like':'%'+_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x436313;})});}_0x16a039=_[_0x0a9e('0x3b')]({},_0x16a039,_0x1f29bd[_0x0a9e('0x46')]);return db['CmHopperFinal']['count']({'where':_0x16a039[_0x0a9e('0x3c')]})['then'](function(_0x25eae0){_0x501050[_0x0a9e('0x3e')]=_0x25eae0;if(_0x1f29bd[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x16a039[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x5e')]['findAll'](_0x16a039);})['then'](function(_0x1889ed){_0x501050['rows']=_0x1889ed;return _0x501050;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x842d6f,_0x16a039))['catch'](handleError(_0x842d6f,null));};exports[_0x0a9e('0x5f')]=function(_0x564db2,_0x558d60,_0x1c49dc){var _0xb8db59={'raw':!![],'where':{}};var _0x5e9b0b={};var _0x170af6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x564db2[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x558d60,null))['then'](function(_0x5505f4){if(_0x5505f4){_0x5e9b0b[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x60')][_0x0a9e('0x2b')]);_0x5e9b0b[_0x0a9e('0x30')]=_['keys'](_0x564db2[_0x0a9e('0x30')]);_0x5e9b0b[_0x0a9e('0x39')]=_['intersection'](_0x5e9b0b[_0x0a9e('0x2f')],_0x5e9b0b[_0x0a9e('0x30')]);_0xb8db59[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x5e9b0b[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0xb8db59[_0x0a9e('0x33')]=_0xb8db59[_0x0a9e('0x33')]['length']?_0xb8db59[_0x0a9e('0x33')]:_0x5e9b0b[_0x0a9e('0x2f')];if(!_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0xb8db59['limit']=qs['limit'](_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0xb8db59[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x564db2[_0x0a9e('0x30')]['offset']);}_0xb8db59[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x564db2[_0x0a9e('0x30')]['sort']);_0xb8db59[_0x0a9e('0x3c')]=qs['filters'](_[_0x0a9e('0x59')](_0x564db2['query'],_0x5e9b0b[_0x0a9e('0x39')]));_0xb8db59[_0x0a9e('0x3c')][_0x0a9e('0x5a')]=_0x5505f4['id'];if(_0x564db2['query'][_0x0a9e('0x3a')]){_0xb8db59['where']=_[_0x0a9e('0x3b')](_0xb8db59[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0xb8db59[_0x0a9e('0x33')],function(_0x3a5836){var _0x1bee04={};_0x1bee04[_0x3a5836]={'$like':'%'+_0x564db2[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x1bee04;})});}_0xb8db59=_[_0x0a9e('0x3b')]({},_0xb8db59,_0x564db2[_0x0a9e('0x46')]);return db[_0x0a9e('0x60')][_0x0a9e('0x3e')]({'where':_0xb8db59[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0x98c62c){_0x170af6[_0x0a9e('0x3e')]=_0x98c62c;if(_0x564db2['query']['includeAll']){_0xb8db59[_0x0a9e('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0a9e('0x40')](_0xb8db59);})[_0x0a9e('0x22')](function(_0x5d6b69){_0x170af6[_0x0a9e('0x41')]=_0x5d6b69;return _0x170af6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x558d60,_0xb8db59))[_0x0a9e('0x42')](handleError(_0x558d60,null));};exports[_0x0a9e('0x61')]=function(_0x5585d5,_0x148fd9,_0x26cb76){var _0x374f0b={};var _0x34a791={};var _0x5d0e1f;var _0x19e9ed;return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x5585d5['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x148fd9,null))[_0x0a9e('0x22')](function(_0x17b29d){if(_0x17b29d){_0x5d0e1f=_0x17b29d;_0x34a791['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x62')][_0x0a9e('0x2b')]);_0x34a791[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x5585d5['query']);_0x34a791[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x34a791['model'],_0x34a791[_0x0a9e('0x30')]);_0x374f0b[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x34a791['model'],qs['fields'](_0x5585d5['query'][_0x0a9e('0x34')]));_0x374f0b[_0x0a9e('0x33')]=_0x374f0b['attributes'][_0x0a9e('0x35')]?_0x374f0b[_0x0a9e('0x33')]:_0x34a791[_0x0a9e('0x2f')];_0x374f0b['order']=qs[_0x0a9e('0x38')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x374f0b[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x5585d5[_0x0a9e('0x30')],_0x34a791[_0x0a9e('0x39')]));if(_0x5585d5[_0x0a9e('0x30')]['filter']){_0x374f0b[_0x0a9e('0x3c')]=_['merge'](_0x374f0b[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x374f0b[_0x0a9e('0x33')],function(_0x3cf222){var _0x407e9d={};_0x407e9d[_0x3cf222]={'$like':'%'+_0x5585d5[_0x0a9e('0x30')]['filter']+'%'};return _0x407e9d;})});}_0x374f0b=_[_0x0a9e('0x3b')]({},_0x374f0b,_0x5585d5[_0x0a9e('0x46')]);return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x51aa2f){if(_0x51aa2f){_0x19e9ed=_0x51aa2f[_0x0a9e('0x35')];if(!_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x374f0b[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x5585d5[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x374f0b[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x5585d5['query'][_0x0a9e('0x19')]);}return _0x5d0e1f[_0x0a9e('0x61')](_0x374f0b);}})[_0x0a9e('0x22')](function(_0x26b826){if(_0x26b826){return _0x26b826?{'count':_0x19e9ed,'rows':_0x26b826}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x148fd9,null))[_0x0a9e('0x42')](handleError(_0x148fd9,null));};exports[_0x0a9e('0x63')]=function(_0x20ae21,_0x566b90,_0x3b581c){var _0xd2391,_0x1a9ef1;return db['Campaign'][_0x0a9e('0x4e')]({'where':{'id':_0x20ae21[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x566b90,null))[_0x0a9e('0x22')](function(_0x370b5e){if(_0x370b5e){_0x1a9ef1=_0x370b5e;return _0x370b5e[_0x0a9e('0x63')](_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x64')],_[_0x0a9e('0x51')](_0x20ae21[_0x0a9e('0x48')],['ids','id'])||{});}return null;})[_0x0a9e('0x65')](function(_0x446e6){var _0x15a9ed;_0xd2391=_0x446e6||[];var _0x3db98f=[];if(_0x446e6){for(var _0x2b624e=0x0;_0x2b624e<_0x446e6[_0x0a9e('0x35')];_0x2b624e+=0x1){var _0x5cb48d=_0x446e6[_0x2b624e][_0x0a9e('0x4c')]({'plain':!![]});_0x1a9ef1['dialCheckDuplicateType']=_0x20ae21['body']['dialCheckDuplicateType']?_0x20ae21[_0x0a9e('0x48')][_0x0a9e('0x66')]:_0x1a9ef1[_0x0a9e('0x66')];switch(_0x1a9ef1[_0x0a9e('0x66')]){case'always':_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt','ContactId',_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),'updatedAt'],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))['field']('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')]['toString'](),'ListId')['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')]('ListId\x20=\x20?',_0x5cb48d[_0x0a9e('0x72')]['toString']())[_0x0a9e('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x76'))[_0x0a9e('0x74')](_0x0a9e('0x77'))[_0x0a9e('0x3c')](_0x0a9e('0x78'),_0x20ae21['params']['id'][_0x0a9e('0x73')]()))[_0x0a9e('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('COALESCE(phone,\x27\x27)')[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;case _0x0a9e('0x79'):_0x15a9ed=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x70'),'ContactId',_0x0a9e('0x6c'),'CampaignId',_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),_0x0a9e('0x6b'))['field'](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')[_0x0a9e('0x6e')](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))[_0x0a9e('0x6e')](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')]('cm_contacts')['where'](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b'))['where'](_0x0a9e('0x7c'),squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x7d'))[_0x0a9e('0x74')](_0x0a9e('0x69'))[_0x0a9e('0x3c')]('CampaignId\x20=\x20?',_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')]())))[_0x0a9e('0x73')]();break;default:_0x15a9ed=squel['insert']()[_0x0a9e('0x68')](_0x0a9e('0x69'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),'scheduledAt',_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')](_0x0a9e('0x6b'),'phone')[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x70'))[_0x0a9e('0x6e')]('id','ContactId')['field'](_0x5cb48d[_0x0a9e('0x72')][_0x0a9e('0x73')](),_0x0a9e('0x6c'))['field'](_0x20ae21[_0x0a9e('0x44')]['id'][_0x0a9e('0x73')](),'CampaignId')[_0x0a9e('0x6e')]('NOW()',_0x0a9e('0x53'))['field']('NOW()','updatedAt')[_0x0a9e('0x74')](_0x0a9e('0x7e'))[_0x0a9e('0x3c')](_0x0a9e('0x75'))[_0x0a9e('0x3c')](_0x0a9e('0x7a'),_0x5cb48d['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))[_0x0a9e('0x73')]();}_0x3db98f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')][_0x0a9e('0x30')](_0x15a9ed));}return BPromise['all'](_0x3db98f);}})['then'](function(){return _0xd2391;})[_0x0a9e('0x22')](respondWithResult(_0x566b90,null))['catch'](handleError(_0x566b90,null));};exports[_0x0a9e('0x81')]=function(_0xb326cb,_0x1f0318,_0xa3695f){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0xb326cb['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1f0318,null))['then'](function(_0x50e32a){if(_0x50e32a){return _0x50e32a[_0x0a9e('0x81')](_0xb326cb['query'][_0x0a9e('0x64')]);}})['then'](function(_0x550cbf){if(_0x550cbf){return db[_0x0a9e('0x57')]['destroy']({'where':{'ListId':_0xb326cb[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0xb326cb[_0x0a9e('0x44')]['id']}})['then'](function(){return _0x550cbf;});}})[_0x0a9e('0x22')](respondWithStatusCode(_0x1f0318,null))[_0x0a9e('0x42')](handleError(_0x1f0318,null));};exports[_0x0a9e('0x82')]=function(_0x55b69e,_0x5236c9,_0xdc77d){var _0x948aab={'raw':!![],'where':{}};var _0x89d2cb={};var _0x2f79fb={'count':0x0,'rows':[]};return db[_0x0a9e('0x2a')][_0x0a9e('0x56')]({'where':{'id':_0x55b69e[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5236c9,null))[_0x0a9e('0x22')](function(_0x1020a0){if(_0x1020a0){_0x89d2cb['model']=_['keys'](db['CmList'][_0x0a9e('0x2b')]);_0x89d2cb[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x55b69e[_0x0a9e('0x30')]);_0x89d2cb[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x89d2cb[_0x0a9e('0x2f')],_0x89d2cb[_0x0a9e('0x30')]);_0x948aab['attributes']=_['intersection'](_0x89d2cb[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x55b69e['query'][_0x0a9e('0x34')]));_0x948aab[_0x0a9e('0x33')]=_0x948aab[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x948aab[_0x0a9e('0x33')]:_0x89d2cb[_0x0a9e('0x2f')];if(!_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x36')](_0x0a9e('0x58'))){_0x948aab[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x55b69e[_0x0a9e('0x30')]['limit']);_0x948aab[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x19')]);}_0x948aab[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x38')]);_0x948aab[_0x0a9e('0x3c')]=qs[_0x0a9e('0x39')](_[_0x0a9e('0x59')](_0x55b69e[_0x0a9e('0x30')],_0x89d2cb['filters']));_0x948aab['where'][_0x0a9e('0x5a')]=_0x1020a0['id'];if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x948aab[_0x0a9e('0x3c')]=_[_0x0a9e('0x3b')](_0x948aab[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x948aab['attributes'],function(_0x26a204){var _0x49fd0e={};_0x49fd0e[_0x26a204]={'$like':'%'+_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x3a')]+'%'};return _0x49fd0e;})});}_0x948aab=_[_0x0a9e('0x3b')]({},_0x948aab,_0x55b69e[_0x0a9e('0x46')]);return db[_0x0a9e('0x62')][_0x0a9e('0x3e')]({'where':_0x948aab[_0x0a9e('0x3c')]})[_0x0a9e('0x22')](function(_0xa7a754){_0x2f79fb[_0x0a9e('0x3e')]=_0xa7a754;if(_0x55b69e[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x948aab[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x62')][_0x0a9e('0x40')](_0x948aab);})[_0x0a9e('0x22')](function(_0x5b78a8){_0x2f79fb['rows']=_0x5b78a8;return _0x2f79fb;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5236c9,_0x948aab))[_0x0a9e('0x42')](handleError(_0x5236c9,null));};exports['addBlackLists']=function(_0x5500de,_0x2cb05c,_0x1feb9){var _0x3304a1,_0x596178;return db[_0x0a9e('0x2a')]['find']({'where':{'id':_0x5500de[_0x0a9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2cb05c,null))[_0x0a9e('0x22')](function(_0x5e9c92){if(_0x5e9c92){_0x596178=_0x5e9c92;return _0x5e9c92[_0x0a9e('0x83')](_0x5500de[_0x0a9e('0x48')][_0x0a9e('0x64')],_['omit'](_0x5500de[_0x0a9e('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x44b7af){var _0x23993f;_0x3304a1=_0x44b7af||[];var _0x3c691f=[];if(_0x44b7af){for(var _0x1542e8=0x0;_0x1542e8<_0x44b7af[_0x0a9e('0x35')];_0x1542e8+=0x1){var _0x7b05ba=_0x44b7af[_0x1542e8][_0x0a9e('0x4c')]({'plain':!![]});_0x23993f=squel[_0x0a9e('0x67')]()[_0x0a9e('0x68')](_0x0a9e('0x84'))[_0x0a9e('0x6a')]([_0x0a9e('0x6b'),_0x0a9e('0x71'),_0x0a9e('0x6c'),_0x0a9e('0x5a'),_0x0a9e('0x53'),_0x0a9e('0x52')],squel[_0x0a9e('0x6d')]()[_0x0a9e('0x6e')]('phone',_0x0a9e('0x6b'))[_0x0a9e('0x6e')]('id',_0x0a9e('0x71'))[_0x0a9e('0x6e')](_0x7b05ba['CmListId']['toString'](),'ListId')[_0x0a9e('0x6e')](_0x5500de['params']['id'][_0x0a9e('0x73')](),_0x0a9e('0x5a'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x53'))[_0x0a9e('0x6e')](_0x0a9e('0x6f'),_0x0a9e('0x52'))[_0x0a9e('0x74')](_0x0a9e('0x7e'))['where'](_0x0a9e('0x75'))['where'](_0x0a9e('0x7a'),_0x7b05ba['CmListId'][_0x0a9e('0x73')]())[_0x0a9e('0x3c')](_0x0a9e('0x7b')))['toString']();_0x3c691f[_0x0a9e('0x7f')](db[_0x0a9e('0x80')]['query'](_0x23993f));}return BPromise['all'](_0x3c691f);}})[_0x0a9e('0x22')](function(){return _0x3304a1;})[_0x0a9e('0x22')](respondWithResult(_0x2cb05c,null))[_0x0a9e('0x42')](handleError(_0x2cb05c,null));};exports['removeBlackLists']=function(_0x578e8d,_0x4869c1,_0x374964){return db[_0x0a9e('0x2a')][_0x0a9e('0x4e')]({'where':{'id':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4869c1,null))[_0x0a9e('0x22')](function(_0x183b9b){if(_0x183b9b){return _0x183b9b[_0x0a9e('0x85')](_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')]);}})[_0x0a9e('0x22')](function(_0x2f4de1){if(_0x2f4de1){return db[_0x0a9e('0x60')][_0x0a9e('0x21')]({'where':{'ListId':_0x578e8d[_0x0a9e('0x30')][_0x0a9e('0x64')],'CampaignId':_0x578e8d[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](function(){return _0x2f4de1;});}})['then'](respondWithStatusCode(_0x4869c1,null))[_0x0a9e('0x42')](handleError(_0x4869c1,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 94ab438..98d70d1 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 _0x98ce=['moment','bluebird','path','../../config/environment','./campaign.attributes','exports','define','Campaign','util','../../config/logger','api'];(function(_0x4a99d6,_0x2026d4){var _0x3ccebc=function(_0xa9637d){while(--_0xa9637d){_0x4a99d6['push'](_0x4a99d6['shift']());}};_0x3ccebc(++_0x2026d4);}(_0x98ce,0x126));var _0xe98c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x98ce[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0xe98c('0x0'));var logger=require(_0xe98c('0x1'))(_0xe98c('0x2'));var moment=require(_0xe98c('0x3'));var BPromise=require(_0xe98c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe98c('0x5'));var rimraf=require('rimraf');var config=require(_0xe98c('0x6'));var attributes=require(_0xe98c('0x7'));module[_0xe98c('0x8')]=function(_0xee8bc7,_0x289537){return _0xee8bc7[_0xe98c('0x9')](_0xe98c('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a1a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','campaigns'];(function(_0x49f0d2,_0x1e20e4){var _0x2a9f08=function(_0x26295d){while(--_0x26295d){_0x49f0d2['push'](_0x49f0d2['shift']());}};_0x2a9f08(++_0x1e20e4);}(_0x3a1a,0x11e));var _0xa3a1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3a1a[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xa3a1('0x0'));var logger=require(_0xa3a1('0x1'))(_0xa3a1('0x2'));var moment=require(_0xa3a1('0x3'));var BPromise=require(_0xa3a1('0x4'));var rp=require(_0xa3a1('0x5'));var fs=require('fs');var path=require(_0xa3a1('0x6'));var rimraf=require(_0xa3a1('0x7'));var config=require(_0xa3a1('0x8'));var attributes=require(_0xa3a1('0x9'));module[_0xa3a1('0xa')]=function(_0x22fb69,_0x5b231a){return _0x22fb69[_0xa3a1('0xb')]('Campaign',attributes,{'tableName':_0xa3a1('0xc'),'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 7dfd466..807be3f 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 _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1d982d,_0xfb3a79){var _0x2d24ba=function(_0xee2fd){while(--_0xee2fd){_0x1d982d['push'](_0x1d982d['shift']());}};_0x2d24ba(++_0xfb3a79);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('Campaign,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x329f22,_0xe1ba1d){var _0x3490b3=function(_0x344268){while(--_0x344268){_0x329f22['push'](_0x329f22['shift']());}};_0x3490b3(++_0xe1ba1d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('Campaign,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 9508aa5..4a677af 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 _0xc8a8=['addBlackLists','put','delete','destroy','removeBlackLists','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','addLists'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc8a8,0xde));var _0x8c8a=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0xc8a8[_0x595604];return _0x1466f3;};'use strict';var multer=require(_0x8c8a('0x0'));var util=require(_0x8c8a('0x1'));var path=require(_0x8c8a('0x2'));var timeout=require(_0x8c8a('0x3'));var express=require('express');var router=express[_0x8c8a('0x4')]();var auth=require(_0x8c8a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c8a('0x6'));var controller=require(_0x8c8a('0x7'));router[_0x8c8a('0x8')]('/',auth[_0x8c8a('0x9')](),controller[_0x8c8a('0xa')]);router[_0x8c8a('0x8')](_0x8c8a('0xb'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0xc')]);router[_0x8c8a('0x8')](_0x8c8a('0xd'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0xe')]);router[_0x8c8a('0x8')](_0x8c8a('0xf'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0x10')]);router[_0x8c8a('0x8')](_0x8c8a('0x11'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0x12')]);router[_0x8c8a('0x8')](_0x8c8a('0x13'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x8c8a('0x8')](_0x8c8a('0x14'),auth[_0x8c8a('0x9')](),controller['getLists']);router[_0x8c8a('0x8')](_0x8c8a('0x15'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0x16')]);router['post']('/',auth[_0x8c8a('0x9')](),controller['create']);router[_0x8c8a('0x17')](_0x8c8a('0x18'),auth[_0x8c8a('0x9')](),controller['clone']);router[_0x8c8a('0x17')](_0x8c8a('0x14'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0x19')]);router[_0x8c8a('0x17')](_0x8c8a('0x15'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0x1a')]);router[_0x8c8a('0x1b')](_0x8c8a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8c8a('0x1c')](_0x8c8a('0xb'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0x1d')]);router[_0x8c8a('0x1c')](_0x8c8a('0x14'),auth['isAuthenticated'](),controller['removeLists']);router[_0x8c8a('0x1c')](_0x8c8a('0x15'),auth[_0x8c8a('0x9')](),controller[_0x8c8a('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x7604=['./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','put','update','delete','destroy','removeLists','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc29e32,_0x4e79bf){var _0x4506f9=function(_0x1ee869){while(--_0x1ee869){_0xc29e32['push'](_0xc29e32['shift']());}};_0x4506f9(++_0x4e79bf);}(_0x7604,0x127));var _0x4760=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7604[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x4760('0x0'));var path=require(_0x4760('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x4760('0x2'));var interaction=require(_0x4760('0x3'));var config=require(_0x4760('0x4'));var controller=require(_0x4760('0x5'));router[_0x4760('0x6')]('/',auth['isAuthenticated'](),controller[_0x4760('0x7')]);router[_0x4760('0x6')](_0x4760('0x8'),auth[_0x4760('0x9')](),controller[_0x4760('0xa')]);router[_0x4760('0x6')](_0x4760('0xb'),auth[_0x4760('0x9')](),controller[_0x4760('0xc')]);router[_0x4760('0x6')](_0x4760('0xd'),auth[_0x4760('0x9')](),controller[_0x4760('0xe')]);router[_0x4760('0x6')]('/:id/hopper_finals',auth[_0x4760('0x9')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0x4760('0x9')](),controller[_0x4760('0xf')]);router[_0x4760('0x6')](_0x4760('0x10'),auth[_0x4760('0x9')](),controller[_0x4760('0x11')]);router['get'](_0x4760('0x12'),auth[_0x4760('0x9')](),controller[_0x4760('0x13')]);router[_0x4760('0x14')]('/',auth[_0x4760('0x9')](),controller['create']);router['post'](_0x4760('0x15'),auth[_0x4760('0x9')](),controller[_0x4760('0x16')]);router[_0x4760('0x14')](_0x4760('0x10'),auth['isAuthenticated'](),controller[_0x4760('0x17')]);router[_0x4760('0x14')]('/:id/blacklists',auth[_0x4760('0x9')](),controller['addBlackLists']);router[_0x4760('0x18')](_0x4760('0x8'),auth[_0x4760('0x9')](),controller[_0x4760('0x19')]);router[_0x4760('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x4760('0x1b')]);router[_0x4760('0x1a')]('/:id/lists',auth[_0x4760('0x9')](),controller[_0x4760('0x1c')]);router[_0x4760('0x1a')](_0x4760('0x12'),auth[_0x4760('0x9')](),controller['removeBlackLists']);module[_0x4760('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 984adf4..efccdb3 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 _0x725a=['TEXT','VIRTUAL','exports','STRING'];(function(_0x2e8ba4,_0x409f8f){var _0x1ac85e=function(_0x419e35){while(--_0x419e35){_0x2e8ba4['push'](_0x2e8ba4['shift']());}};_0x1ac85e(++_0x409f8f);}(_0x725a,0x1de));var _0xa725=function(_0x3e1926,_0x11e729){_0x3e1926=_0x3e1926-0x0;var _0x5517e9=_0x725a[_0x3e1926];return _0x5517e9;};'use strict';var Sequelize=require('sequelize');module[_0xa725('0x0')]={'key':{'type':Sequelize[_0xa725('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xa725('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa725('0x1')]},'name':{'type':Sequelize[_0xa725('0x3')],'get':function(){return this['getDataValue']('key');}}}; \ No newline at end of file +var _0x1b5e=['TEXT','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x1b5e,0x74));var _0xe1b5=function(_0x35ca08,_0x18ff82){_0x35ca08=_0x35ca08-0x0;var _0x5108ce=_0x1b5e[_0x35ca08];return _0x5108ce;};'use strict';var Sequelize=require(_0xe1b5('0x0'));module[_0xe1b5('0x1')]={'key':{'type':Sequelize[_0xe1b5('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe1b5('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xe1b5('0x4')],'get':function(){return this[_0xe1b5('0x5')](_0xe1b5('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index a5b92e0..5cf3a1a 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 _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file +var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 82a7fdc..1eca588 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 _0xbfd5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dfb84,_0x430ee0){var _0x5ca5e4=function(_0x4863ac){while(--_0x4863ac){_0x3dfb84['push'](_0x3dfb84['shift']());}};_0x5ca5e4(++_0x430ee0);}(_0xbfd5,0x1dc));var _0x5bfd=function(_0x2ee810,_0x59c070){_0x2ee810=_0x2ee810-0x0;var _0x257dd4=_0xbfd5[_0x2ee810];return _0x257dd4;};'use strict';var _=require(_0x5bfd('0x0'));var util=require(_0x5bfd('0x1'));var logger=require(_0x5bfd('0x2'))(_0x5bfd('0x3'));var moment=require(_0x5bfd('0x4'));var BPromise=require(_0x5bfd('0x5'));var rp=require(_0x5bfd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bfd('0x7'));var config=require(_0x5bfd('0x8'));var attributes=require(_0x5bfd('0x9'));module[_0x5bfd('0xa')]=function(_0x162375,_0x2042e5){return _0x162375['define']('CannedAnswer',attributes,{'tableName':_0x5bfd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5bfd('0xc'),'collate':_0x5bfd('0xd')});}; \ No newline at end of file +var _0xe79c=['moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x55f78c,_0x364b1f){var _0x33f2d6=function(_0x203a09){while(--_0x203a09){_0x55f78c['push'](_0x55f78c['shift']());}};_0x33f2d6(++_0x364b1f);}(_0xe79c,0x106));var _0xce79=function(_0x1a34b7,_0x59f119){_0x1a34b7=_0x1a34b7-0x0;var _0x521179=_0xe79c[_0x1a34b7];return _0x521179;};'use strict';var _=require(_0xce79('0x0'));var util=require(_0xce79('0x1'));var logger=require(_0xce79('0x2'))(_0xce79('0x3'));var moment=require(_0xce79('0x4'));var BPromise=require(_0xce79('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xce79('0x6'));var rimraf=require(_0xce79('0x7'));var config=require(_0xce79('0x8'));var attributes=require(_0xce79('0x9'));module['exports']=function(_0x1f9d9b,_0x3ce3af){return _0x1f9d9b[_0xce79('0xa')](_0xce79('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xce79('0xc'),'collate':_0xce79('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 15710b9..89f84b8 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 _0x2d53=['../../config/utils','../../config/logger','rpc','client','http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x4bd1d0,_0x17c43f){var _0x1fea67=function(_0x9eb66c){while(--_0x9eb66c){_0x4bd1d0['push'](_0x4bd1d0['shift']());}};_0x1fea67(++_0x17c43f);}(_0x2d53,0x1c3));var _0x32d5=function(_0x1c1172,_0x27c3c4){_0x1c1172=_0x1c1172-0x0;var _0x300943=_0x2d53[_0x1c1172];return _0x300943;};'use strict';var _=require(_0x32d5('0x0'));var util=require(_0x32d5('0x1'));var moment=require(_0x32d5('0x2'));var BPromise=require(_0x32d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32d5('0x4'))['db'];var utils=require(_0x32d5('0x5'));var logger=require(_0x32d5('0x6'))(_0x32d5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x32d5('0x8')][_0x32d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f5546,_0x297217,_0x590ccf){return new BPromise(function(_0x5585e1,_0x3ef505){return client['request'](_0x2f5546,_0x590ccf)['then'](function(_0x3bdb41){logger[_0x32d5('0xa')](_0x32d5('0xb'),_0x297217,_0x32d5('0xc'));logger['debug'](_0x32d5('0xd'),_0x297217,_0x32d5('0xc'),JSON['stringify'](_0x3bdb41));if(_0x3bdb41[_0x32d5('0xe')]){if(_0x3bdb41[_0x32d5('0xe')][_0x32d5('0xf')]===0x1f4){logger[_0x32d5('0xe')](_0x32d5('0xb'),_0x297217,_0x3bdb41[_0x32d5('0xe')]['message']);return _0x3ef505(_0x3bdb41[_0x32d5('0xe')][_0x32d5('0x10')]);}logger[_0x32d5('0xe')](_0x32d5('0xb'),_0x297217,_0x3bdb41[_0x32d5('0xe')][_0x32d5('0x10')]);return _0x5585e1(_0x3bdb41[_0x32d5('0xe')][_0x32d5('0x10')]);}else{logger[_0x32d5('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x297217,'request\x20sent');_0x5585e1(_0x3bdb41[_0x32d5('0x11')][_0x32d5('0x10')]);}})[_0x32d5('0x12')](function(_0x81c3d8){logger[_0x32d5('0xe')](_0x32d5('0xb'),_0x297217,_0x81c3d8);_0x3ef505(_0x81c3d8);});});} \ No newline at end of file +var _0xd529=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x2e10ae,_0x2f7199){var _0x59710a=function(_0xe3403c){while(--_0xe3403c){_0x2e10ae['push'](_0x2e10ae['shift']());}};_0x59710a(++_0x2f7199);}(_0xd529,0x17d));var _0x9d52=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd529[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x9d52('0x0'));var util=require(_0x9d52('0x1'));var moment=require('moment');var BPromise=require(_0x9d52('0x2'));var rs=require(_0x9d52('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d52('0x4'))['db'];var utils=require(_0x9d52('0x5'));var logger=require(_0x9d52('0x6'))(_0x9d52('0x7'));var config=require(_0x9d52('0x8'));var jayson=require(_0x9d52('0x9'));var client=jayson[_0x9d52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17387c,_0x3bdfc3,_0x2336cd){return new BPromise(function(_0x306886,_0x2c3853){return client[_0x9d52('0xb')](_0x17387c,_0x2336cd)['then'](function(_0x452936){logger['info'](_0x9d52('0xc'),_0x3bdfc3,_0x9d52('0xd'));logger[_0x9d52('0xe')](_0x9d52('0xf'),_0x3bdfc3,_0x9d52('0xd'),JSON['stringify'](_0x452936));if(_0x452936[_0x9d52('0x10')]){if(_0x452936['error']['code']===0x1f4){logger[_0x9d52('0x10')](_0x9d52('0xc'),_0x3bdfc3,_0x452936['error'][_0x9d52('0x11')]);return _0x2c3853(_0x452936[_0x9d52('0x10')][_0x9d52('0x11')]);}logger[_0x9d52('0x10')](_0x9d52('0xc'),_0x3bdfc3,_0x452936[_0x9d52('0x10')][_0x9d52('0x11')]);return _0x306886(_0x452936[_0x9d52('0x10')][_0x9d52('0x11')]);}else{logger[_0x9d52('0x12')](_0x9d52('0xc'),_0x3bdfc3,_0x9d52('0xd'));_0x306886(_0x452936['result'][_0x9d52('0x11')]);}})[_0x9d52('0x13')](function(_0x21896c){logger[_0x9d52('0x10')](_0x9d52('0xc'),_0x3bdfc3,_0x21896c);_0x2c3853(_0x21896c);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index bdd890c..ded1a23 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 _0x00b3=['/:id','show','post','create','put','update','destroy','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','get'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x00b3,0x97));var _0x300b=function(_0x1a9a81,_0x4e04c7){_0x1a9a81=_0x1a9a81-0x0;var _0x59bf1f=_0x00b3[_0x1a9a81];return _0x59bf1f;};'use strict';var multer=require(_0x300b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x300b('0x1'));var express=require(_0x300b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x300b('0x3'));var config=require(_0x300b('0x4'));var controller=require(_0x300b('0x5'));router['get']('/',auth[_0x300b('0x6')](),controller[_0x300b('0x7')]);router[_0x300b('0x8')](_0x300b('0x9'),auth[_0x300b('0x6')](),controller[_0x300b('0xa')]);router[_0x300b('0xb')]('/',auth[_0x300b('0x6')](),controller[_0x300b('0xc')]);router[_0x300b('0xd')](_0x300b('0x9'),auth[_0x300b('0x6')](),controller[_0x300b('0xe')]);router['delete'](_0x300b('0x9'),auth[_0x300b('0x6')](),controller[_0x300b('0xf')]);module['exports']=router; \ No newline at end of file +var _0xeea1=['Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','create','update','delete','exports','multer','connect-timeout'];(function(_0x4a88b5,_0x5cd99c){var _0xc55b9b=function(_0x51559c){while(--_0x51559c){_0x4a88b5['push'](_0x4a88b5['shift']());}};_0xc55b9b(++_0x5cd99c);}(_0xeea1,0xfd));var _0x1eea=function(_0x1e2532,_0xb156e8){_0x1e2532=_0x1e2532-0x0;var _0x159658=_0xeea1[_0x1e2532];return _0x159658;};'use strict';var multer=require(_0x1eea('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1eea('0x1'));var express=require('express');var router=express[_0x1eea('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x1eea('0x3'));var config=require(_0x1eea('0x4'));var controller=require(_0x1eea('0x5'));router[_0x1eea('0x6')]('/',auth['isAuthenticated'](),controller[_0x1eea('0x7')]);router[_0x1eea('0x6')](_0x1eea('0x8'),auth[_0x1eea('0x9')](),controller[_0x1eea('0xa')]);router['post']('/',auth[_0x1eea('0x9')](),controller[_0x1eea('0xb')]);router['put'](_0x1eea('0x8'),auth[_0x1eea('0x9')](),controller[_0x1eea('0xc')]);router[_0x1eea('0xd')](_0x1eea('0x8'),auth[_0x1eea('0x9')](),controller['destroy']);module[_0x1eea('0xe')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 276698d..4886a4d 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 _0x9692=['STRING','INTEGER','sequelize','DATE','1970-01-01\x2000:00:01'];(function(_0x205328,_0x12c15a){var _0x4a30eb=function(_0x226d48){while(--_0x226d48){_0x205328['push'](_0x205328['shift']());}};_0x4a30eb(++_0x12c15a);}(_0x9692,0xa2));var _0x2969=function(_0x28c188,_0x1951e4){_0x28c188=_0x28c188-0x0;var _0x880523=_0x9692[_0x28c188];return _0x880523;};'use strict';var Sequelize=require(_0x2969('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x2969('0x1')],'allowNull':![],'defaultValue':_0x2969('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x2969('0x3')]},'dst':{'type':Sequelize[_0x2969('0x3')]},'dcontext':{'type':Sequelize[_0x2969('0x3')]},'channel':{'type':Sequelize[_0x2969('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x2969('0x3')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x2969('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x2969('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2969('0x3')]},'amaflags':{'type':Sequelize[_0x2969('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x2969('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2969('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x2969('0x3')]},'peeraccount':{'type':Sequelize[_0x2969('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x2969('0x3')]}}; \ No newline at end of file +var _0x4e40=['DATE','STRING','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e40,0x166));var _0x04e4=function(_0x439e0a,_0x5b465f){_0x439e0a=_0x439e0a-0x0;var _0x462d66=_0x4e40[_0x439e0a];return _0x462d66;};'use strict';var Sequelize=require(_0x04e4('0x0'));module[_0x04e4('0x1')]={'calldate':{'type':Sequelize[_0x04e4('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x04e4('0x3')]},'src':{'type':Sequelize[_0x04e4('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x04e4('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x04e4('0x3')]},'lastdata':{'type':Sequelize[_0x04e4('0x3')]},'duration':{'type':Sequelize[_0x04e4('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x04e4('0x3')]},'amaflags':{'type':Sequelize[_0x04e4('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x04e4('0x3')]},'userfield':{'type':Sequelize[_0x04e4('0x3')]},'uniqueid':{'type':Sequelize[_0x04e4('0x3')]},'linkedid':{'type':Sequelize[_0x04e4('0x3')]},'sequence':{'type':Sequelize[_0x04e4('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x04e4('0x3')]},'tag':{'type':Sequelize[_0x04e4('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 713c646..bf7df38 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 _0xd384=['show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Cdr','include','rows','catch'];(function(_0x4f20a9,_0x329426){var _0x4ebe5b=function(_0x17e0cb){while(--_0x17e0cb){_0x4f20a9['push'](_0x4f20a9['shift']());}};_0x4ebe5b(++_0x329426);}(_0xd384,0x133));var _0x4d38=function(_0x5696a4,_0xb07ad0){_0x5696a4=_0x5696a4-0x0;var _0x6dec9d=_0xd384[_0x5696a4];return _0x6dec9d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4d38('0x0'));var rimraf=require(_0x4d38('0x1'));var zipdir=require(_0x4d38('0x2'));var jsonpatch=require(_0x4d38('0x3'));var rp=require('request-promise');var moment=require(_0x4d38('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4d38('0x5'));var util=require(_0x4d38('0x6'));var path=require(_0x4d38('0x7'));var sox=require(_0x4d38('0x8'));var csv=require(_0x4d38('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4d38('0xa'));var squel=require('squel');var crypto=require(_0x4d38('0xb'));var jsforce=require(_0x4d38('0xc'));var deskjs=require(_0x4d38('0xd'));var toCsv=require(_0x4d38('0x9'));var querystring=require(_0x4d38('0xe'));var Papa=require(_0x4d38('0xf'));var Redis=require(_0x4d38('0x10'));var authService=require(_0x4d38('0x11'));var qs=require(_0x4d38('0x12'));var as=require(_0x4d38('0x13'));var hardwareService=require(_0x4d38('0x14'));var logger=require(_0x4d38('0x15'))('api');var utils=require(_0x4d38('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4d38('0x17'))['db'];function respondWithStatusCode(_0x2e6c51,_0xec6def){_0xec6def=_0xec6def||0xcc;return function(_0xb86d71){if(_0xb86d71){return _0x2e6c51[_0x4d38('0x18')](_0xec6def);}return _0x2e6c51[_0x4d38('0x19')](_0xec6def)[_0x4d38('0x1a')]();};}function respondWithResult(_0x4fbec8,_0x3c69fb){_0x3c69fb=_0x3c69fb||0xc8;return function(_0x4700e9){if(_0x4700e9){return _0x4fbec8[_0x4d38('0x19')](_0x3c69fb)[_0x4d38('0x1b')](_0x4700e9);}};}function respondWithFilteredResult(_0x428a05,_0x12250d){return function(_0x5e1ea5){if(_0x5e1ea5){var _0x30b868=_0x5e1ea5[_0x4d38('0x1c')],_0x1bbb7f=_0x12250d['offset'],_0x55abe6=_0x12250d[_0x4d38('0x1d')]+_0x12250d['limit'],_0x230745;if(_0x55abe6>=_0x30b868){_0x55abe6=_0x30b868;_0x230745=0xc8;}else{_0x230745=0xce;}_0x428a05[_0x4d38('0x19')](_0x230745);return _0x428a05[_0x4d38('0x1e')]('Content-Range',_0x1bbb7f+'-'+_0x55abe6+'/'+_0x30b868)[_0x4d38('0x1b')](_0x5e1ea5);}return null;};}function patchUpdates(_0x641979){return function(_0x3e3079){try{jsonpatch[_0x4d38('0x1f')](_0x3e3079,_0x641979,!![]);}catch(_0x2e137b){return BPromise[_0x4d38('0x20')](_0x2e137b);}return _0x3e3079[_0x4d38('0x21')]();};}function saveUpdates(_0x1737c6,_0x444c0d){return function(_0x23a64c){if(_0x23a64c){return _0x23a64c[_0x4d38('0x22')](_0x1737c6)['then'](function(_0x7aaebd){return _0x7aaebd;});}return null;};}function removeEntity(_0x524f33,_0x448b34){return function(_0x4ac26b){if(_0x4ac26b){return _0x4ac26b[_0x4d38('0x23')]()[_0x4d38('0x24')](function(){_0x524f33[_0x4d38('0x19')](0xcc)[_0x4d38('0x1a')]();});}};}function handleEntityNotFound(_0x30c1a4,_0x7eb685){return function(_0x426a5d){if(!_0x426a5d){_0x30c1a4['sendStatus'](0x194);}return _0x426a5d;};}function handleError(_0x57242e,_0x479a04){_0x479a04=_0x479a04||0x1f4;return function(_0x641a30){logger[_0x4d38('0x25')](_0x641a30[_0x4d38('0x26')]);if(_0x641a30['name']){delete _0x641a30[_0x4d38('0x27')];}_0x57242e[_0x4d38('0x19')](_0x479a04)['send'](_0x641a30);};}exports[_0x4d38('0x28')]=function(_0x5322d4,_0x555a12){var _0x359278={},_0x457a60={},_0x32be32={'count':0x0,'rows':[]};var _0x3a5416=_[_0x4d38('0x29')](db['Cdr'][_0x4d38('0x2a')],function(_0x215f0e){return{'name':_0x215f0e[_0x4d38('0x2b')],'type':_0x215f0e['type']['key']};});_0x457a60['model']=_[_0x4d38('0x29')](_0x3a5416,_0x4d38('0x27'));_0x457a60[_0x4d38('0x2c')]=_[_0x4d38('0x2d')](_0x5322d4[_0x4d38('0x2c')]);_0x457a60[_0x4d38('0x2e')]=_[_0x4d38('0x2f')](_0x457a60[_0x4d38('0x30')],_0x457a60[_0x4d38('0x2c')]);_0x359278[_0x4d38('0x31')]=_[_0x4d38('0x2f')](_0x457a60[_0x4d38('0x30')],qs[_0x4d38('0x32')](_0x5322d4['query'][_0x4d38('0x32')]));_0x359278[_0x4d38('0x31')]=_0x359278[_0x4d38('0x31')][_0x4d38('0x33')]?_0x359278[_0x4d38('0x31')]:_0x457a60[_0x4d38('0x30')];if(!_0x5322d4[_0x4d38('0x2c')][_0x4d38('0x34')](_0x4d38('0x35'))){_0x359278[_0x4d38('0x36')]=qs['limit'](_0x5322d4[_0x4d38('0x2c')][_0x4d38('0x36')]);_0x359278['offset']=qs[_0x4d38('0x1d')](_0x5322d4[_0x4d38('0x2c')]['offset']);}_0x359278[_0x4d38('0x37')]=qs['sort'](_0x5322d4[_0x4d38('0x2c')][_0x4d38('0x38')]);_0x359278[_0x4d38('0x39')]=qs[_0x4d38('0x2e')](_[_0x4d38('0x3a')](_0x5322d4['query'],_0x457a60[_0x4d38('0x2e')]),_0x3a5416);if(_0x5322d4[_0x4d38('0x2c')][_0x4d38('0x3b')]){_0x359278[_0x4d38('0x39')]=_['merge'](_0x359278[_0x4d38('0x39')],{'$or':_['map'](_0x3a5416,function(_0x2d1234){if(_0x2d1234[_0x4d38('0x3c')]!==_0x4d38('0x3d')){var _0x4c9ea3={};_0x4c9ea3[_0x2d1234[_0x4d38('0x27')]]={'$like':'%'+_0x5322d4[_0x4d38('0x2c')][_0x4d38('0x3b')]+'%'};return _0x4c9ea3;}})});}_0x359278=_[_0x4d38('0x3e')]({},_0x359278,_0x5322d4[_0x4d38('0x3f')]);var _0x336cc8={'where':_0x359278[_0x4d38('0x39')]};return db[_0x4d38('0x40')][_0x4d38('0x1c')](_0x336cc8)[_0x4d38('0x24')](function(_0x3cf2b8){_0x32be32[_0x4d38('0x1c')]=_0x3cf2b8;if(_0x5322d4[_0x4d38('0x2c')]['includeAll']){_0x359278[_0x4d38('0x41')]=[{'all':!![]}];}return db[_0x4d38('0x40')]['findAll'](_0x359278);})[_0x4d38('0x24')](function(_0x39280b){_0x32be32[_0x4d38('0x42')]=_0x39280b;return _0x32be32;})['then'](respondWithFilteredResult(_0x555a12,_0x359278))[_0x4d38('0x43')](handleError(_0x555a12,null));};exports[_0x4d38('0x44')]=function(_0x893756,_0x2cd10d){var _0x54362e={'raw':!![],'where':{'id':_0x893756[_0x4d38('0x45')]['id']}},_0x38ba1f={};_0x38ba1f['model']=_['keys'](db[_0x4d38('0x40')][_0x4d38('0x2a')]);_0x38ba1f[_0x4d38('0x2c')]=_[_0x4d38('0x2d')](_0x893756[_0x4d38('0x2c')]);_0x38ba1f[_0x4d38('0x2e')]=_[_0x4d38('0x2f')](_0x38ba1f['model'],_0x38ba1f[_0x4d38('0x2c')]);_0x54362e[_0x4d38('0x31')]=_[_0x4d38('0x2f')](_0x38ba1f[_0x4d38('0x30')],qs[_0x4d38('0x32')](_0x893756[_0x4d38('0x2c')][_0x4d38('0x32')]));_0x54362e[_0x4d38('0x31')]=_0x54362e[_0x4d38('0x31')][_0x4d38('0x33')]?_0x54362e[_0x4d38('0x31')]:_0x38ba1f[_0x4d38('0x30')];if(_0x893756['query'][_0x4d38('0x46')]){_0x54362e['include']=[{'all':!![]}];}_0x54362e=_[_0x4d38('0x3e')]({},_0x54362e,_0x893756[_0x4d38('0x3f')]);return db['Cdr'][_0x4d38('0x47')](_0x54362e)['then'](handleEntityNotFound(_0x2cd10d,null))['then'](respondWithResult(_0x2cd10d,null))[_0x4d38('0x43')](handleError(_0x2cd10d,null));};exports['create']=function(_0x40f507,_0x6ee63){return db['Cdr'][_0x4d38('0x48')](_0x40f507[_0x4d38('0x49')],{})['then'](respondWithResult(_0x6ee63,0xc9))['catch'](handleError(_0x6ee63,null));};exports['update']=function(_0xb77936,_0x28bce5){if(_0xb77936[_0x4d38('0x49')]['id']){delete _0xb77936[_0x4d38('0x49')]['id'];}return db[_0x4d38('0x40')]['find']({'where':{'id':_0xb77936['params']['id']}})[_0x4d38('0x24')](handleEntityNotFound(_0x28bce5,null))['then'](saveUpdates(_0xb77936[_0x4d38('0x49')],null))[_0x4d38('0x24')](respondWithResult(_0x28bce5,null))[_0x4d38('0x43')](handleError(_0x28bce5,null));};exports[_0x4d38('0x23')]=function(_0x5bb2e4,_0x491945){return db[_0x4d38('0x40')][_0x4d38('0x47')]({'where':{'id':_0x5bb2e4[_0x4d38('0x45')]['id']}})[_0x4d38('0x24')](handleEntityNotFound(_0x491945,null))[_0x4d38('0x24')](removeEntity(_0x491945,null))[_0x4d38('0x43')](handleError(_0x491945,null));};exports[_0x4d38('0x4a')]=function(_0x56ed05,_0x1a093b){return db[_0x4d38('0x40')][_0x4d38('0x4a')]()[_0x4d38('0x24')](respondWithResult(_0x1a093b,null))[_0x4d38('0x43')](handleError(_0x1a093b,null));}; \ No newline at end of file +var _0xc0e2=['map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','show','params','find','create','body','update','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','destroy','error','stack','name','Cdr','rawAttributes','type','key'];(function(_0x5a9841,_0x950566){var _0xb4f748=function(_0xdecea8){while(--_0xdecea8){_0x5a9841['push'](_0x5a9841['shift']());}};_0xb4f748(++_0x950566);}(_0xc0e2,0xb1));var _0x2c0e=function(_0xa69f72,_0x2f95b6){_0xa69f72=_0xa69f72-0x0;var _0x3ab3e8=_0xc0e2[_0xa69f72];return _0x3ab3e8;};'use strict';var pdf=require(_0x2c0e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2c0e('0x1'));var jsonpatch=require(_0x2c0e('0x2'));var rp=require(_0x2c0e('0x3'));var moment=require(_0x2c0e('0x4'));var BPromise=require(_0x2c0e('0x5'));var Mustache=require(_0x2c0e('0x6'));var util=require(_0x2c0e('0x7'));var path=require(_0x2c0e('0x8'));var sox=require(_0x2c0e('0x9'));var csv=require(_0x2c0e('0xa'));var ejs=require(_0x2c0e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2c0e('0xc'));var crypto=require(_0x2c0e('0xd'));var jsforce=require(_0x2c0e('0xe'));var deskjs=require(_0x2c0e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2c0e('0x10'));var authService=require(_0x2c0e('0x11'));var qs=require(_0x2c0e('0x12'));var as=require(_0x2c0e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2c0e('0x14'))(_0x2c0e('0x15'));var utils=require(_0x2c0e('0x16'));var config=require(_0x2c0e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x372630,_0x236b8c){_0x236b8c=_0x236b8c||0xcc;return function(_0x565d95){if(_0x565d95){return _0x372630[_0x2c0e('0x18')](_0x236b8c);}return _0x372630['status'](_0x236b8c)[_0x2c0e('0x19')]();};}function respondWithResult(_0x536665,_0x519634){_0x519634=_0x519634||0xc8;return function(_0x2c1a52){if(_0x2c1a52){return _0x536665[_0x2c0e('0x1a')](_0x519634)[_0x2c0e('0x1b')](_0x2c1a52);}};}function respondWithFilteredResult(_0xbe67af,_0x228578){return function(_0x31ac77){if(_0x31ac77){var _0x5e97dc=_0x31ac77[_0x2c0e('0x1c')],_0x269ffa=_0x228578[_0x2c0e('0x1d')],_0x284e20=_0x228578['offset']+_0x228578[_0x2c0e('0x1e')],_0x79a65;if(_0x284e20>=_0x5e97dc){_0x284e20=_0x5e97dc;_0x79a65=0xc8;}else{_0x79a65=0xce;}_0xbe67af[_0x2c0e('0x1a')](_0x79a65);return _0xbe67af[_0x2c0e('0x1f')](_0x2c0e('0x20'),_0x269ffa+'-'+_0x284e20+'/'+_0x5e97dc)[_0x2c0e('0x1b')](_0x31ac77);}return null;};}function patchUpdates(_0x31c4c4){return function(_0x51ce38){try{jsonpatch['apply'](_0x51ce38,_0x31c4c4,!![]);}catch(_0x3b3fee){return BPromise['reject'](_0x3b3fee);}return _0x51ce38[_0x2c0e('0x21')]();};}function saveUpdates(_0x40817a,_0xd8cd68){return function(_0xaf0062){if(_0xaf0062){return _0xaf0062['update'](_0x40817a)['then'](function(_0x2e1236){return _0x2e1236;});}return null;};}function removeEntity(_0x5e69da,_0x2b4578){return function(_0x45420a){if(_0x45420a){return _0x45420a[_0x2c0e('0x22')]()['then'](function(){_0x5e69da[_0x2c0e('0x1a')](0xcc)[_0x2c0e('0x19')]();});}};}function handleEntityNotFound(_0x366864,_0x1b2451){return function(_0x33b2d0){if(!_0x33b2d0){_0x366864[_0x2c0e('0x18')](0x194);}return _0x33b2d0;};}function handleError(_0x3e3664,_0x5c2a46){_0x5c2a46=_0x5c2a46||0x1f4;return function(_0x3de47d){logger[_0x2c0e('0x23')](_0x3de47d[_0x2c0e('0x24')]);if(_0x3de47d[_0x2c0e('0x25')]){delete _0x3de47d[_0x2c0e('0x25')];}_0x3e3664[_0x2c0e('0x1a')](_0x5c2a46)['send'](_0x3de47d);};}exports['index']=function(_0x7dd1ae,_0x36874e){var _0x47a5d8={},_0x5d67f6={},_0x428ff5={'count':0x0,'rows':[]};var _0x36d735=_['map'](db[_0x2c0e('0x26')][_0x2c0e('0x27')],function(_0x2f20ee){return{'name':_0x2f20ee['fieldName'],'type':_0x2f20ee[_0x2c0e('0x28')][_0x2c0e('0x29')]};});_0x5d67f6['model']=_[_0x2c0e('0x2a')](_0x36d735,_0x2c0e('0x25'));_0x5d67f6['query']=_[_0x2c0e('0x2b')](_0x7dd1ae[_0x2c0e('0x2c')]);_0x5d67f6[_0x2c0e('0x2d')]=_[_0x2c0e('0x2e')](_0x5d67f6[_0x2c0e('0x2f')],_0x5d67f6[_0x2c0e('0x2c')]);_0x47a5d8[_0x2c0e('0x30')]=_[_0x2c0e('0x2e')](_0x5d67f6[_0x2c0e('0x2f')],qs[_0x2c0e('0x31')](_0x7dd1ae[_0x2c0e('0x2c')][_0x2c0e('0x31')]));_0x47a5d8[_0x2c0e('0x30')]=_0x47a5d8[_0x2c0e('0x30')][_0x2c0e('0x32')]?_0x47a5d8['attributes']:_0x5d67f6[_0x2c0e('0x2f')];if(!_0x7dd1ae['query'][_0x2c0e('0x33')](_0x2c0e('0x34'))){_0x47a5d8[_0x2c0e('0x1e')]=qs['limit'](_0x7dd1ae[_0x2c0e('0x2c')][_0x2c0e('0x1e')]);_0x47a5d8[_0x2c0e('0x1d')]=qs['offset'](_0x7dd1ae[_0x2c0e('0x2c')][_0x2c0e('0x1d')]);}_0x47a5d8['order']=qs[_0x2c0e('0x35')](_0x7dd1ae[_0x2c0e('0x2c')][_0x2c0e('0x35')]);_0x47a5d8[_0x2c0e('0x36')]=qs[_0x2c0e('0x2d')](_[_0x2c0e('0x37')](_0x7dd1ae[_0x2c0e('0x2c')],_0x5d67f6[_0x2c0e('0x2d')]),_0x36d735);if(_0x7dd1ae[_0x2c0e('0x2c')][_0x2c0e('0x38')]){_0x47a5d8[_0x2c0e('0x36')]=_[_0x2c0e('0x39')](_0x47a5d8[_0x2c0e('0x36')],{'$or':_[_0x2c0e('0x2a')](_0x36d735,function(_0x2f5be4){if(_0x2f5be4[_0x2c0e('0x28')]!==_0x2c0e('0x3a')){var _0x4b503b={};_0x4b503b[_0x2f5be4['name']]={'$like':'%'+_0x7dd1ae[_0x2c0e('0x2c')][_0x2c0e('0x38')]+'%'};return _0x4b503b;}})});}_0x47a5d8=_[_0x2c0e('0x39')]({},_0x47a5d8,_0x7dd1ae[_0x2c0e('0x3b')]);var _0x156b92={'where':_0x47a5d8[_0x2c0e('0x36')]};return db[_0x2c0e('0x26')][_0x2c0e('0x1c')](_0x156b92)['then'](function(_0x1d5aa4){_0x428ff5['count']=_0x1d5aa4;if(_0x7dd1ae[_0x2c0e('0x2c')][_0x2c0e('0x3c')]){_0x47a5d8[_0x2c0e('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x2c0e('0x3e')](_0x47a5d8);})['then'](function(_0x410033){_0x428ff5[_0x2c0e('0x3f')]=_0x410033;return _0x428ff5;})[_0x2c0e('0x40')](respondWithFilteredResult(_0x36874e,_0x47a5d8))[_0x2c0e('0x41')](handleError(_0x36874e,null));};exports[_0x2c0e('0x42')]=function(_0x5b6685,_0x2f91a7){var _0x268a63={'raw':!![],'where':{'id':_0x5b6685[_0x2c0e('0x43')]['id']}},_0x180313={};_0x180313['model']=_['keys'](db[_0x2c0e('0x26')][_0x2c0e('0x27')]);_0x180313[_0x2c0e('0x2c')]=_[_0x2c0e('0x2b')](_0x5b6685['query']);_0x180313['filters']=_[_0x2c0e('0x2e')](_0x180313[_0x2c0e('0x2f')],_0x180313[_0x2c0e('0x2c')]);_0x268a63[_0x2c0e('0x30')]=_[_0x2c0e('0x2e')](_0x180313[_0x2c0e('0x2f')],qs['fields'](_0x5b6685['query'][_0x2c0e('0x31')]));_0x268a63[_0x2c0e('0x30')]=_0x268a63[_0x2c0e('0x30')][_0x2c0e('0x32')]?_0x268a63['attributes']:_0x180313[_0x2c0e('0x2f')];if(_0x5b6685['query'][_0x2c0e('0x3c')]){_0x268a63['include']=[{'all':!![]}];}_0x268a63=_[_0x2c0e('0x39')]({},_0x268a63,_0x5b6685[_0x2c0e('0x3b')]);return db[_0x2c0e('0x26')][_0x2c0e('0x44')](_0x268a63)[_0x2c0e('0x40')](handleEntityNotFound(_0x2f91a7,null))[_0x2c0e('0x40')](respondWithResult(_0x2f91a7,null))[_0x2c0e('0x41')](handleError(_0x2f91a7,null));};exports[_0x2c0e('0x45')]=function(_0x3ebc81,_0x2e04b1){return db[_0x2c0e('0x26')]['create'](_0x3ebc81[_0x2c0e('0x46')],{})[_0x2c0e('0x40')](respondWithResult(_0x2e04b1,0xc9))[_0x2c0e('0x41')](handleError(_0x2e04b1,null));};exports[_0x2c0e('0x47')]=function(_0x227f26,_0x4c04d5){if(_0x227f26[_0x2c0e('0x46')]['id']){delete _0x227f26[_0x2c0e('0x46')]['id'];}return db[_0x2c0e('0x26')]['find']({'where':{'id':_0x227f26[_0x2c0e('0x43')]['id']}})[_0x2c0e('0x40')](handleEntityNotFound(_0x4c04d5,null))['then'](saveUpdates(_0x227f26[_0x2c0e('0x46')],null))[_0x2c0e('0x40')](respondWithResult(_0x4c04d5,null))['catch'](handleError(_0x4c04d5,null));};exports[_0x2c0e('0x22')]=function(_0x312c8b,_0x634081){return db['Cdr'][_0x2c0e('0x44')]({'where':{'id':_0x312c8b[_0x2c0e('0x43')]['id']}})[_0x2c0e('0x40')](handleEntityNotFound(_0x634081,null))[_0x2c0e('0x40')](removeEntity(_0x634081,null))[_0x2c0e('0x41')](handleError(_0x634081,null));};exports[_0x2c0e('0x48')]=function(_0x1bfc7f,_0x5e2427){return db['Cdr'][_0x2c0e('0x48')]()[_0x2c0e('0x40')](respondWithResult(_0x5e2427,null))[_0x2c0e('0x41')](handleError(_0x5e2427,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4274fa4..5ed0484 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 _0x4991=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid'];(function(_0x17278e,_0x1e3e64){var _0x370d47=function(_0x41bb5f){while(--_0x41bb5f){_0x17278e['push'](_0x17278e['shift']());}};_0x370d47(++_0x1e3e64);}(_0x4991,0xf7));var _0x1499=function(_0x4ba660,_0x3f299f){_0x4ba660=_0x4ba660-0x0;var _0x120b2b=_0x4991[_0x4ba660];return _0x120b2b;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require(_0x1499('0x4'));var fs=require('fs');var path=require(_0x1499('0x5'));var rimraf=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var attributes=require(_0x1499('0x8'));module[_0x1499('0x9')]=function(_0x4b6154,_0x2a8e96){return _0x4b6154[_0x1499('0xa')](_0x1499('0xb'),attributes,{'tableName':_0x1499('0xc'),'paranoid':![],'indexes':[{'name':_0x1499('0xd'),'fields':[_0x1499('0xd')]},{'name':_0x1499('0xe'),'fields':[_0x1499('0xe')]},{'name':'disposition','fields':[_0x1499('0xf')]},{'name':_0x1499('0x10'),'fields':['dst']},{'name':_0x1499('0x11'),'fields':[_0x1499('0x11')]},{'name':'uniqueid','fields':[_0x1499('0x12')]}],'timestamps':![]});}; \ No newline at end of file +var _0x57ca=['rimraf','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x20e283,_0x2b5a6e){var _0x199e10=function(_0xaccd3a){while(--_0xaccd3a){_0x20e283['push'](_0x20e283['shift']());}};_0x199e10(++_0x2b5a6e);}(_0x57ca,0x108));var _0xa57c=function(_0x43ab88,_0x1a9e35){_0x43ab88=_0x43ab88-0x0;var _0x2bafa0=_0x57ca[_0x43ab88];return _0x2bafa0;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('0xb'),'paranoid':![],'indexes':[{'name':_0xa57c('0xc'),'fields':['accountcode']},{'name':_0xa57c('0xd'),'fields':['calldate']},{'name':_0xa57c('0xe'),'fields':[_0xa57c('0xe')]},{'name':'dst','fields':[_0xa57c('0xf')]},{'name':'src','fields':[_0xa57c('0x10')]},{'name':_0xa57c('0x11'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 4b5e9c2..30633b6 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 _0xed5e=['client','http','then','info','request\x20sent','stringify','error','code','message','Cdr,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x24003a,_0x4f4649){var _0x1d76b0=function(_0x5d020c){while(--_0x5d020c){_0x24003a['push'](_0x24003a['shift']());}};_0x1d76b0(++_0x4f4649);}(_0xed5e,0x102));var _0xeed5=function(_0x13b948,_0x2a5a86){_0x13b948=_0x13b948-0x0;var _0x2f0044=_0xed5e[_0x13b948];return _0x2f0044;};'use strict';var _=require(_0xeed5('0x0'));var util=require('util');var moment=require(_0xeed5('0x1'));var BPromise=require(_0xeed5('0x2'));var rs=require(_0xeed5('0x3'));var fs=require('fs');var Redis=require(_0xeed5('0x4'));var db=require(_0xeed5('0x5'))['db'];var utils=require(_0xeed5('0x6'));var logger=require('../../config/logger')(_0xeed5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeed5('0x8')][_0xeed5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b33e2,_0x2d00f4,_0x5aa5e6){return new BPromise(function(_0x1cb839,_0x12a6fd){return client['request'](_0x1b33e2,_0x5aa5e6)[_0xeed5('0xa')](function(_0x4ffe57){logger[_0xeed5('0xb')]('Cdr,\x20%s,\x20%s',_0x2d00f4,_0xeed5('0xc'));logger['debug']('Cdr,\x20%s,\x20%s,\x20%s',_0x2d00f4,_0xeed5('0xc'),JSON[_0xeed5('0xd')](_0x4ffe57));if(_0x4ffe57[_0xeed5('0xe')]){if(_0x4ffe57['error'][_0xeed5('0xf')]===0x1f4){logger[_0xeed5('0xe')]('Cdr,\x20%s,\x20%s',_0x2d00f4,_0x4ffe57[_0xeed5('0xe')]['message']);return _0x12a6fd(_0x4ffe57[_0xeed5('0xe')][_0xeed5('0x10')]);}logger[_0xeed5('0xe')](_0xeed5('0x11'),_0x2d00f4,_0x4ffe57[_0xeed5('0xe')][_0xeed5('0x10')]);return _0x1cb839(_0x4ffe57[_0xeed5('0xe')]['message']);}else{logger['info'](_0xeed5('0x11'),_0x2d00f4,'request\x20sent');_0x1cb839(_0x4ffe57[_0xeed5('0x12')][_0xeed5('0x10')]);}})['catch'](function(_0x37f890){logger[_0xeed5('0xe')](_0xeed5('0x11'),_0x2d00f4,_0x37f890);_0x12a6fd(_0x37f890);});});} \ No newline at end of file +var _0x1a96=['debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent'];(function(_0x1e6f26,_0x27d992){var _0x4820f9=function(_0x2d0c4b){while(--_0x2d0c4b){_0x1e6f26['push'](_0x1e6f26['shift']());}};_0x4820f9(++_0x27d992);}(_0x1a96,0x18e));var _0x61a9=function(_0x539243,_0x60bc3d){_0x539243=_0x539243-0x0;var _0x5cc843=_0x1a96[_0x539243];return _0x5cc843;};'use strict';var _=require(_0x61a9('0x0'));var util=require(_0x61a9('0x1'));var moment=require(_0x61a9('0x2'));var BPromise=require(_0x61a9('0x3'));var rs=require(_0x61a9('0x4'));var fs=require('fs');var Redis=require(_0x61a9('0x5'));var db=require(_0x61a9('0x6'))['db'];var utils=require(_0x61a9('0x7'));var logger=require(_0x61a9('0x8'))('rpc');var config=require(_0x61a9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x61a9('0xa')][_0x61a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12d882,_0x81d646,_0xf4cdd9){return new BPromise(function(_0x399c6c,_0x4a6c6e){return client[_0x61a9('0xc')](_0x12d882,_0xf4cdd9)['then'](function(_0x13cdc4){logger[_0x61a9('0xd')](_0x61a9('0xe'),_0x81d646,_0x61a9('0xf'));logger[_0x61a9('0x10')](_0x61a9('0x11'),_0x81d646,_0x61a9('0xf'),JSON[_0x61a9('0x12')](_0x13cdc4));if(_0x13cdc4['error']){if(_0x13cdc4[_0x61a9('0x13')][_0x61a9('0x14')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x81d646,_0x13cdc4[_0x61a9('0x13')][_0x61a9('0x15')]);return _0x4a6c6e(_0x13cdc4[_0x61a9('0x13')][_0x61a9('0x15')]);}logger['error'](_0x61a9('0xe'),_0x81d646,_0x13cdc4[_0x61a9('0x13')][_0x61a9('0x15')]);return _0x399c6c(_0x13cdc4[_0x61a9('0x13')][_0x61a9('0x15')]);}else{logger['info'](_0x61a9('0xe'),_0x81d646,_0x61a9('0xf'));_0x399c6c(_0x13cdc4['result'][_0x61a9('0x15')]);}})[_0x61a9('0x16')](function(_0x3b5931){logger[_0x61a9('0x13')](_0x61a9('0xe'),_0x81d646,_0x3b5931);_0x4a6c6e(_0x3b5931);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 18e5d54..69a86de 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 _0xd5b6=['../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service'];(function(_0x1fd2e8,_0x49432f){var _0x32524e=function(_0x15a743){while(--_0x15a743){_0x1fd2e8['push'](_0x1fd2e8['shift']());}};_0x32524e(++_0x49432f);}(_0xd5b6,0x14a));var _0x6d5b=function(_0x4d0c8a,_0x2a57e2){_0x4d0c8a=_0x4d0c8a-0x0;var _0x1b53e5=_0xd5b6[_0x4d0c8a];return _0x1b53e5;};'use strict';var multer=require(_0x6d5b('0x0'));var util=require(_0x6d5b('0x1'));var path=require(_0x6d5b('0x2'));var timeout=require(_0x6d5b('0x3'));var express=require(_0x6d5b('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6d5b('0x5'));var config=require(_0x6d5b('0x6'));var controller=require(_0x6d5b('0x7'));router[_0x6d5b('0x8')]('/',auth[_0x6d5b('0x9')](),controller[_0x6d5b('0xa')]);router[_0x6d5b('0x8')](_0x6d5b('0xb'),auth[_0x6d5b('0x9')](),controller[_0x6d5b('0xc')]);router[_0x6d5b('0x8')]('/:id',auth[_0x6d5b('0x9')](),controller[_0x6d5b('0xd')]);router[_0x6d5b('0xe')]('/',auth[_0x6d5b('0x9')](),controller[_0x6d5b('0xf')]);router[_0x6d5b('0x10')](_0x6d5b('0x11'),auth[_0x6d5b('0x9')](),controller['update']);router[_0x6d5b('0x12')](_0x6d5b('0x11'),auth[_0x6d5b('0x9')](),controller[_0x6d5b('0x13')]);module[_0x6d5b('0x14')]=router; \ No newline at end of file +var _0xe95e=['post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cdr.controller','isAuthenticated','index','get','show'];(function(_0x5e3b5d,_0x2deeb2){var _0x5ae21a=function(_0xb885f0){while(--_0xb885f0){_0x5e3b5d['push'](_0x5e3b5d['shift']());}};_0x5ae21a(++_0x2deeb2);}(_0xe95e,0x7a));var _0xee95=function(_0x333798,_0x9f6561){_0x333798=_0x333798-0x0;var _0x389f4e=_0xe95e[_0x333798];return _0x389f4e;};'use strict';var multer=require(_0xee95('0x0'));var util=require(_0xee95('0x1'));var path=require(_0xee95('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xee95('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xee95('0x4'));var config=require(_0xee95('0x5'));var controller=require(_0xee95('0x6'));router['get']('/',auth[_0xee95('0x7')](),controller[_0xee95('0x8')]);router[_0xee95('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xee95('0x9')]('/:id',auth[_0xee95('0x7')](),controller[_0xee95('0xa')]);router[_0xee95('0xb')]('/',auth['isAuthenticated'](),controller[_0xee95('0xc')]);router[_0xee95('0xd')](_0xee95('0xe'),auth[_0xee95('0x7')](),controller[_0xee95('0xf')]);router[_0xee95('0x10')](_0xee95('0xe'),auth['isAuthenticated'](),controller[_0xee95('0x11')]);module[_0xee95('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 67bf964..a61f4f4 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 _0xd505=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x2d67fa,_0x4edc78){var _0x350f91=function(_0x46eeeb){while(--_0x46eeeb){_0x2d67fa['push'](_0x2d67fa['shift']());}};_0x350f91(++_0x4edc78);}(_0xd505,0x111));var _0x5d50=function(_0x4d5ff3,_0x16d226){_0x4d5ff3=_0x4d5ff3-0x0;var _0x45038a=_0xd505[_0x4d5ff3];return _0x45038a;};'use strict';var Sequelize=require(_0x5d50('0x0'));module[_0x5d50('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5d50('0x2')],'allowNull':![],'defaultValue':_0x5d50('0x3')},'appdata':{'type':Sequelize[_0x5d50('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5d50('0x2')],'defaultValue':_0x5d50('0x5')}}; \ No newline at end of file +var _0x2de1=['sequelize','exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x4d7f3f,_0x4d2803){var _0x5d67cc=function(_0x2c37f4){while(--_0x2c37f4){_0x4d7f3f['push'](_0x4d7f3f['shift']());}};_0x5d67cc(++_0x4d2803);}(_0x2de1,0x157));var _0x12de=function(_0x501041,_0x34fc51){_0x501041=_0x501041-0x0;var _0x335489=_0x2de1[_0x501041];return _0x335489;};'use strict';var Sequelize=require(_0x12de('0x0'));module[_0x12de('0x1')]={'priority':{'type':Sequelize[_0x12de('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x12de('0x3')},'appdata':{'type':Sequelize[_0x12de('0x4')]()},'description':{'type':Sequelize[_0x12de('0x5')]},'interval':{'type':Sequelize[_0x12de('0x5')],'defaultValue':_0x12de('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 8cc0142..8e4b7e8 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 _0xae02=['params','model','ChatApplication','rawAttributes','query','intersection','fields','attributes','length','merge','options','find','catch','body','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','ejs','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','destroy','then','error','stack','name','send','show'];(function(_0x48677d,_0x5d5fa1){var _0x27d5c6=function(_0x4dac92){while(--_0x4dac92){_0x48677d['push'](_0x48677d['shift']());}};_0x27d5c6(++_0x5d5fa1);}(_0xae02,0xa7));var _0x2ae0=function(_0x3833ce,_0xfec06c){_0x3833ce=_0x3833ce-0x0;var _0x659602=_0xae02[_0x3833ce];return _0x659602;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2ae0('0x0'));var rimraf=require(_0x2ae0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2ae0('0x2'));var Mustache=require(_0x2ae0('0x3'));var util=require(_0x2ae0('0x4'));var path=require('path');var sox=require(_0x2ae0('0x5'));var csv=require(_0x2ae0('0x6'));var ejs=require(_0x2ae0('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2ae0('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2ae0('0x6'));var querystring=require(_0x2ae0('0x9'));var Papa=require(_0x2ae0('0xa'));var Redis=require(_0x2ae0('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x2ae0('0xc'));var as=require(_0x2ae0('0xd'));var hardwareService=require(_0x2ae0('0xe'));var logger=require(_0x2ae0('0xf'))(_0x2ae0('0x10'));var utils=require('../../config/utils');var config=require(_0x2ae0('0x11'));var licenseUtil=require(_0x2ae0('0x12'));var db=require(_0x2ae0('0x13'))['db'];function respondWithStatusCode(_0xb199fa,_0x427a54){_0x427a54=_0x427a54||0xcc;return function(_0x49ab41){if(_0x49ab41){return _0xb199fa[_0x2ae0('0x14')](_0x427a54);}return _0xb199fa[_0x2ae0('0x15')](_0x427a54)[_0x2ae0('0x16')]();};}function respondWithResult(_0x365370,_0x30c5e2){_0x30c5e2=_0x30c5e2||0xc8;return function(_0xdcb2bc){if(_0xdcb2bc){return _0x365370[_0x2ae0('0x15')](_0x30c5e2)[_0x2ae0('0x17')](_0xdcb2bc);}};}function respondWithFilteredResult(_0x182bf3,_0x1ea033){return function(_0x235e3a){if(_0x235e3a){var _0x31e3ed=_0x235e3a[_0x2ae0('0x18')],_0x4803c8=_0x1ea033[_0x2ae0('0x19')],_0x1fc5f4=_0x1ea033[_0x2ae0('0x19')]+_0x1ea033[_0x2ae0('0x1a')],_0x297689;if(_0x1fc5f4>=_0x31e3ed){_0x1fc5f4=_0x31e3ed;_0x297689=0xc8;}else{_0x297689=0xce;}_0x182bf3[_0x2ae0('0x15')](_0x297689);return _0x182bf3[_0x2ae0('0x1b')]('Content-Range',_0x4803c8+'-'+_0x1fc5f4+'/'+_0x31e3ed)['json'](_0x235e3a);}return null;};}function patchUpdates(_0x3e9edd){return function(_0x3e8319){try{jsonpatch['apply'](_0x3e8319,_0x3e9edd,!![]);}catch(_0x37216d){return BPromise[_0x2ae0('0x1c')](_0x37216d);}return _0x3e8319[_0x2ae0('0x1d')]();};}function saveUpdates(_0x1bf027,_0x5d6b57){return function(_0x1fd01b){if(_0x1fd01b){return _0x1fd01b['update'](_0x1bf027)['then'](function(_0x338958){return _0x338958;});}return null;};}function removeEntity(_0x212e5f,_0x10a0b1){return function(_0x444ac8){if(_0x444ac8){return _0x444ac8[_0x2ae0('0x1e')]()[_0x2ae0('0x1f')](function(){_0x212e5f[_0x2ae0('0x15')](0xcc)[_0x2ae0('0x16')]();});}};}function handleEntityNotFound(_0x50a0ab,_0x49fded){return function(_0x892f55){if(!_0x892f55){_0x50a0ab[_0x2ae0('0x14')](0x194);}return _0x892f55;};}function handleError(_0x207dee,_0x237fce){_0x237fce=_0x237fce||0x1f4;return function(_0x548632){logger[_0x2ae0('0x20')](_0x548632[_0x2ae0('0x21')]);if(_0x548632[_0x2ae0('0x22')]){delete _0x548632['name'];}_0x207dee[_0x2ae0('0x15')](_0x237fce)[_0x2ae0('0x23')](_0x548632);};}exports[_0x2ae0('0x24')]=function(_0x541d5e,_0x4c7dba){var _0x3d1dde={'raw':!![],'where':{'id':_0x541d5e[_0x2ae0('0x25')]['id']}},_0x56316e={};_0x56316e[_0x2ae0('0x26')]=_['keys'](db[_0x2ae0('0x27')][_0x2ae0('0x28')]);_0x56316e['query']=_['keys'](_0x541d5e[_0x2ae0('0x29')]);_0x56316e['filters']=_[_0x2ae0('0x2a')](_0x56316e[_0x2ae0('0x26')],_0x56316e[_0x2ae0('0x29')]);_0x3d1dde['attributes']=_['intersection'](_0x56316e[_0x2ae0('0x26')],qs[_0x2ae0('0x2b')](_0x541d5e[_0x2ae0('0x29')]['fields']));_0x3d1dde[_0x2ae0('0x2c')]=_0x3d1dde[_0x2ae0('0x2c')][_0x2ae0('0x2d')]?_0x3d1dde[_0x2ae0('0x2c')]:_0x56316e[_0x2ae0('0x26')];if(_0x541d5e[_0x2ae0('0x29')]['includeAll']){_0x3d1dde['include']=[{'all':!![]}];}_0x3d1dde=_[_0x2ae0('0x2e')]({},_0x3d1dde,_0x541d5e[_0x2ae0('0x2f')]);return db[_0x2ae0('0x27')][_0x2ae0('0x30')](_0x3d1dde)['then'](handleEntityNotFound(_0x4c7dba,null))['then'](respondWithResult(_0x4c7dba,null))[_0x2ae0('0x31')](handleError(_0x4c7dba,null));};exports['update']=function(_0x3e839c,_0x166f21){if(_0x3e839c[_0x2ae0('0x32')]['id']){delete _0x3e839c[_0x2ae0('0x32')]['id'];}return db[_0x2ae0('0x27')][_0x2ae0('0x30')]({'where':{'id':_0x3e839c['params']['id']}})[_0x2ae0('0x1f')](handleEntityNotFound(_0x166f21,null))[_0x2ae0('0x1f')](saveUpdates(_0x3e839c['body'],null))[_0x2ae0('0x1f')](respondWithResult(_0x166f21,null))[_0x2ae0('0x31')](handleError(_0x166f21,null));};exports[_0x2ae0('0x1e')]=function(_0x418ff2,_0x537f0c){return db[_0x2ae0('0x27')][_0x2ae0('0x30')]({'where':{'id':_0x418ff2[_0x2ae0('0x25')]['id']}})[_0x2ae0('0x1f')](handleEntityNotFound(_0x537f0c,null))[_0x2ae0('0x1f')](removeEntity(_0x537f0c,null))[_0x2ae0('0x31')](handleError(_0x537f0c,null));}; \ No newline at end of file +var _0xa095=['includeAll','include','options','find','catch','body','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','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','count','offset','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0xa095,0x7c));var _0x5a09=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0xa095[_0x5db313];return _0x36d503;};'use strict';var pdf=require(_0x5a09('0x0'));var emlformat=require(_0x5a09('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5a09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a09('0x3'));var moment=require(_0x5a09('0x4'));var BPromise=require(_0x5a09('0x5'));var Mustache=require(_0x5a09('0x6'));var util=require('util');var path=require(_0x5a09('0x7'));var sox=require(_0x5a09('0x8'));var csv=require(_0x5a09('0x9'));var ejs=require(_0x5a09('0xa'));var fs=require('fs');var _=require(_0x5a09('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5a09('0xc'));var toCsv=require(_0x5a09('0x9'));var querystring=require(_0x5a09('0xd'));var Papa=require(_0x5a09('0xe'));var Redis=require(_0x5a09('0xf'));var authService=require(_0x5a09('0x10'));var qs=require(_0x5a09('0x11'));var as=require(_0x5a09('0x12'));var hardwareService=require(_0x5a09('0x13'));var logger=require(_0x5a09('0x14'))(_0x5a09('0x15'));var utils=require(_0x5a09('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5a09('0x17'));var db=require(_0x5a09('0x18'))['db'];function respondWithStatusCode(_0xec677d,_0x49045e){_0x49045e=_0x49045e||0xcc;return function(_0x4706c4){if(_0x4706c4){return _0xec677d['sendStatus'](_0x49045e);}return _0xec677d[_0x5a09('0x19')](_0x49045e)[_0x5a09('0x1a')]();};}function respondWithResult(_0x2f22df,_0x2bf0a5){_0x2bf0a5=_0x2bf0a5||0xc8;return function(_0x36045d){if(_0x36045d){return _0x2f22df['status'](_0x2bf0a5)[_0x5a09('0x1b')](_0x36045d);}};}function respondWithFilteredResult(_0x23d47c,_0x10e59d){return function(_0x1cb5c0){if(_0x1cb5c0){var _0x460d30=_0x1cb5c0[_0x5a09('0x1c')],_0x245af7=_0x10e59d['offset'],_0x2398c5=_0x10e59d[_0x5a09('0x1d')]+_0x10e59d['limit'],_0x477977;if(_0x2398c5>=_0x460d30){_0x2398c5=_0x460d30;_0x477977=0xc8;}else{_0x477977=0xce;}_0x23d47c[_0x5a09('0x19')](_0x477977);return _0x23d47c[_0x5a09('0x1e')](_0x5a09('0x1f'),_0x245af7+'-'+_0x2398c5+'/'+_0x460d30)[_0x5a09('0x1b')](_0x1cb5c0);}return null;};}function patchUpdates(_0x6ebf91){return function(_0x224618){try{jsonpatch[_0x5a09('0x20')](_0x224618,_0x6ebf91,!![]);}catch(_0xaf3bbe){return BPromise[_0x5a09('0x21')](_0xaf3bbe);}return _0x224618['save']();};}function saveUpdates(_0x4d9189,_0x5eb523){return function(_0x4d0767){if(_0x4d0767){return _0x4d0767[_0x5a09('0x22')](_0x4d9189)['then'](function(_0x58bd32){return _0x58bd32;});}return null;};}function removeEntity(_0x24f5ba,_0x4f6842){return function(_0x4784b1){if(_0x4784b1){return _0x4784b1[_0x5a09('0x23')]()[_0x5a09('0x24')](function(){_0x24f5ba[_0x5a09('0x19')](0xcc)[_0x5a09('0x1a')]();});}};}function handleEntityNotFound(_0x116ef0,_0x17e3f7){return function(_0x195435){if(!_0x195435){_0x116ef0[_0x5a09('0x25')](0x194);}return _0x195435;};}function handleError(_0x35c242,_0x437d9d){_0x437d9d=_0x437d9d||0x1f4;return function(_0x542d97){logger[_0x5a09('0x26')](_0x542d97[_0x5a09('0x27')]);if(_0x542d97[_0x5a09('0x28')]){delete _0x542d97['name'];}_0x35c242[_0x5a09('0x19')](_0x437d9d)['send'](_0x542d97);};}exports[_0x5a09('0x29')]=function(_0x2cc527,_0x3deeb2){var _0x1269f1={'raw':!![],'where':{'id':_0x2cc527[_0x5a09('0x2a')]['id']}},_0x946242={};_0x946242[_0x5a09('0x2b')]=_[_0x5a09('0x2c')](db[_0x5a09('0x2d')][_0x5a09('0x2e')]);_0x946242['query']=_[_0x5a09('0x2c')](_0x2cc527[_0x5a09('0x2f')]);_0x946242[_0x5a09('0x30')]=_[_0x5a09('0x31')](_0x946242[_0x5a09('0x2b')],_0x946242['query']);_0x1269f1[_0x5a09('0x32')]=_[_0x5a09('0x31')](_0x946242[_0x5a09('0x2b')],qs[_0x5a09('0x33')](_0x2cc527[_0x5a09('0x2f')]['fields']));_0x1269f1[_0x5a09('0x32')]=_0x1269f1[_0x5a09('0x32')][_0x5a09('0x34')]?_0x1269f1[_0x5a09('0x32')]:_0x946242[_0x5a09('0x2b')];if(_0x2cc527[_0x5a09('0x2f')][_0x5a09('0x35')]){_0x1269f1[_0x5a09('0x36')]=[{'all':!![]}];}_0x1269f1=_['merge']({},_0x1269f1,_0x2cc527[_0x5a09('0x37')]);return db['ChatApplication'][_0x5a09('0x38')](_0x1269f1)['then'](handleEntityNotFound(_0x3deeb2,null))[_0x5a09('0x24')](respondWithResult(_0x3deeb2,null))[_0x5a09('0x39')](handleError(_0x3deeb2,null));};exports['update']=function(_0x386da8,_0x38a5db){if(_0x386da8['body']['id']){delete _0x386da8['body']['id'];}return db['ChatApplication'][_0x5a09('0x38')]({'where':{'id':_0x386da8[_0x5a09('0x2a')]['id']}})[_0x5a09('0x24')](handleEntityNotFound(_0x38a5db,null))[_0x5a09('0x24')](saveUpdates(_0x386da8[_0x5a09('0x3a')],null))[_0x5a09('0x24')](respondWithResult(_0x38a5db,null))['catch'](handleError(_0x38a5db,null));};exports[_0x5a09('0x23')]=function(_0x462b07,_0x437200){return db['ChatApplication'][_0x5a09('0x38')]({'where':{'id':_0x462b07[_0x5a09('0x2a')]['id']}})['then'](handleEntityNotFound(_0x437200,null))[_0x5a09('0x24')](removeEntity(_0x437200,null))['catch'](handleError(_0x437200,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index d3fca52..d24963b 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0980aef..edb35e2 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 _0xfcfb=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring'];(function(_0x5647c8,_0x590008){var _0x1e464f=function(_0x2224a4){while(--_0x2224a4){_0x5647c8['push'](_0x5647c8['shift']());}};_0x1e464f(++_0x590008);}(_0xfcfb,0x9d));var _0xbfcf=function(_0x4ce15c,_0x1bbcbd){_0x4ce15c=_0x4ce15c-0x0;var _0x5ee259=_0xfcfb[_0x4ce15c];return _0x5ee259;};'use strict';var _=require(_0xbfcf('0x0'));var util=require('util');var moment=require(_0xbfcf('0x1'));var BPromise=require(_0xbfcf('0x2'));var rs=require(_0xbfcf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfcf('0x4'))['db'];var utils=require(_0xbfcf('0x5'));var logger=require(_0xbfcf('0x6'))('rpc');var config=require(_0xbfcf('0x7'));var jayson=require(_0xbfcf('0x8'));var client=jayson[_0xbfcf('0x9')][_0xbfcf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39011a,_0x531aa6,_0x4681c2){return new BPromise(function(_0x18bd30,_0x5da9fa){return client[_0xbfcf('0xb')](_0x39011a,_0x4681c2)[_0xbfcf('0xc')](function(_0x1ca392){logger[_0xbfcf('0xd')]('ChatApplication,\x20%s,\x20%s',_0x531aa6,_0xbfcf('0xe'));logger[_0xbfcf('0xf')](_0xbfcf('0x10'),_0x531aa6,_0xbfcf('0xe'),JSON[_0xbfcf('0x11')](_0x1ca392));if(_0x1ca392[_0xbfcf('0x12')]){if(_0x1ca392[_0xbfcf('0x12')][_0xbfcf('0x13')]===0x1f4){logger[_0xbfcf('0x12')](_0xbfcf('0x14'),_0x531aa6,_0x1ca392[_0xbfcf('0x12')][_0xbfcf('0x15')]);return _0x5da9fa(_0x1ca392[_0xbfcf('0x12')][_0xbfcf('0x15')]);}logger[_0xbfcf('0x12')]('ChatApplication,\x20%s,\x20%s',_0x531aa6,_0x1ca392[_0xbfcf('0x12')][_0xbfcf('0x15')]);return _0x18bd30(_0x1ca392[_0xbfcf('0x12')][_0xbfcf('0x15')]);}else{logger[_0xbfcf('0xd')](_0xbfcf('0x14'),_0x531aa6,_0xbfcf('0xe'));_0x18bd30(_0x1ca392[_0xbfcf('0x16')][_0xbfcf('0x15')]);}})['catch'](function(_0x2a6a4e){logger[_0xbfcf('0x12')](_0xbfcf('0x14'),_0x531aa6,_0x2a6a4e);_0x5da9fa(_0x2a6a4e);});});} \ No newline at end of file +var _0x295a=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x295a,0x10e));var _0xa295=function(_0x518cde,_0x3b8f9){_0x518cde=_0x518cde-0x0;var _0x2abde1=_0x295a[_0x518cde];return _0x2abde1;};'use strict';var _=require(_0xa295('0x0'));var util=require(_0xa295('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa295('0x2'));var fs=require('fs');var Redis=require(_0xa295('0x3'));var db=require(_0xa295('0x4'))['db'];var utils=require(_0xa295('0x5'));var logger=require(_0xa295('0x6'))('rpc');var config=require(_0xa295('0x7'));var jayson=require(_0xa295('0x8'));var client=jayson[_0xa295('0x9')][_0xa295('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25ff74,_0x44206d,_0x459c92){return new BPromise(function(_0x28d67c,_0x357206){return client[_0xa295('0xb')](_0x25ff74,_0x459c92)[_0xa295('0xc')](function(_0x3d3270){logger[_0xa295('0xd')](_0xa295('0xe'),_0x44206d,'request\x20sent');logger[_0xa295('0xf')](_0xa295('0x10'),_0x44206d,_0xa295('0x11'),JSON[_0xa295('0x12')](_0x3d3270));if(_0x3d3270[_0xa295('0x13')]){if(_0x3d3270['error']['code']===0x1f4){logger[_0xa295('0x13')](_0xa295('0xe'),_0x44206d,_0x3d3270[_0xa295('0x13')][_0xa295('0x14')]);return _0x357206(_0x3d3270[_0xa295('0x13')][_0xa295('0x14')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x44206d,_0x3d3270[_0xa295('0x13')][_0xa295('0x14')]);return _0x28d67c(_0x3d3270[_0xa295('0x13')]['message']);}else{logger[_0xa295('0xd')](_0xa295('0xe'),_0x44206d,_0xa295('0x11'));_0x28d67c(_0x3d3270[_0xa295('0x15')][_0xa295('0x14')]);}})[_0xa295('0x16')](function(_0x1d33fa){logger[_0xa295('0x13')](_0xa295('0xe'),_0x44206d,_0x1d33fa);_0x357206(_0x1d33fa);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 20a0571..7a64606 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 _0x60ab=['isAuthenticated','show','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x4690e0,_0x5303be){var _0x571881=function(_0x382776){while(--_0x382776){_0x4690e0['push'](_0x4690e0['shift']());}};_0x571881(++_0x5303be);}(_0x60ab,0x141));var _0xb60a=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0x60ab[_0x602ca8];return _0x26e8ab;};'use strict';var multer=require(_0xb60a('0x0'));var util=require(_0xb60a('0x1'));var path=require(_0xb60a('0x2'));var timeout=require(_0xb60a('0x3'));var express=require(_0xb60a('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb60a('0x5'));var config=require(_0xb60a('0x6'));var controller=require('./chatApplication.controller');router[_0xb60a('0x7')](_0xb60a('0x8'),auth[_0xb60a('0x9')](),controller[_0xb60a('0xa')]);router[_0xb60a('0xb')](_0xb60a('0x8'),auth[_0xb60a('0x9')](),controller[_0xb60a('0xc')]);router[_0xb60a('0xd')](_0xb60a('0x8'),auth[_0xb60a('0x9')](),controller[_0xb60a('0xe')]);module['exports']=router; \ No newline at end of file +var _0x01b1=['put','/:id','isAuthenticated','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatApplication.controller','get'];(function(_0x3595ca,_0x14fcf0){var _0x51390a=function(_0x14b9a7){while(--_0x14b9a7){_0x3595ca['push'](_0x3595ca['shift']());}};_0x51390a(++_0x14fcf0);}(_0x01b1,0x1ef));var _0x101b=function(_0x57ddbd,_0x1d83de){_0x57ddbd=_0x57ddbd-0x0;var _0x10da80=_0x01b1[_0x57ddbd];return _0x10da80;};'use strict';var multer=require('multer');var util=require(_0x101b('0x0'));var path=require(_0x101b('0x1'));var timeout=require(_0x101b('0x2'));var express=require(_0x101b('0x3'));var router=express[_0x101b('0x4')]();var auth=require(_0x101b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x101b('0x6'));var controller=require(_0x101b('0x7'));router[_0x101b('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x101b('0x9')](_0x101b('0xa'),auth[_0x101b('0xb')](),controller[_0x101b('0xc')]);router['delete']('/:id',auth[_0x101b('0xb')](),controller[_0x101b('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 3874eca..5b2fffe 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 _0x2fab=['exports','STRING','BOOLEAN'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0x2fab,0x9c));var _0xb2fa=function(_0xd458a6,_0x1fdf04){_0xd458a6=_0xd458a6-0x0;var _0x28e696=_0x2fab[_0xd458a6];return _0x28e696;};'use strict';var Sequelize=require('sequelize');module[_0xb2fa('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb2fa('0x1')]},'write':{'type':Sequelize[_0xb2fa('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaf1c=['BOOLEAN','sequelize','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xaf1c,0x7f));var _0xcaf1=function(_0x548e3c,_0x2fb9d1){_0x548e3c=_0x548e3c-0x0;var _0x512542=_0xaf1c[_0x548e3c];return _0x512542;};'use strict';var Sequelize=require(_0xcaf1('0x0'));module['exports']={'name':{'type':Sequelize[_0xcaf1('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xcaf1('0x1')]},'write':{'type':Sequelize[_0xcaf1('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 5331414..1bb67b5 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 _0xdab3=['describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','pick','nolimit','find','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','format','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','client','http','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','name','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','keys','catch','create','body'];(function(_0x122fb3,_0x4bea2d){var _0x29c5f7=function(_0x42d8e1){while(--_0x42d8e1){_0x122fb3['push'](_0x122fb3['shift']());}};_0x29c5f7(++_0x4bea2d);}(_0xdab3,0xeb));var _0x3dab=function(_0x44a3d6,_0x1d93f9){_0x44a3d6=_0x44a3d6-0x0;var _0x24234b=_0xdab3[_0x44a3d6];return _0x24234b;};'use strict';var pdf=require(_0x3dab('0x0'));var emlformat=require(_0x3dab('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3dab('0x2'));var jsonpatch=require(_0x3dab('0x3'));var rp=require(_0x3dab('0x4'));var moment=require(_0x3dab('0x5'));var BPromise=require(_0x3dab('0x6'));var Mustache=require(_0x3dab('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3dab('0x8'));var csv=require(_0x3dab('0x9'));var ejs=require(_0x3dab('0xa'));var fs=require('fs');var _=require(_0x3dab('0xb'));var squel=require(_0x3dab('0xc'));var crypto=require(_0x3dab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3dab('0xe'));var toCsv=require(_0x3dab('0x9'));var querystring=require(_0x3dab('0xf'));var Papa=require(_0x3dab('0x10'));var Redis=require(_0x3dab('0x11'));var authService=require(_0x3dab('0x12'));var qs=require(_0x3dab('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dab('0x14'));var logger=require(_0x3dab('0x15'))(_0x3dab('0x16'));var utils=require(_0x3dab('0x17'));var config=require(_0x3dab('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3dab('0x19')]=_[_0x3dab('0x1a')](config[_0x3dab('0x19')],{'host':_0x3dab('0x1b'),'port':0x18eb});var socket=require(_0x3dab('0x1c'))(new Redis(config[_0x3dab('0x19')]));require(_0x3dab('0x1d'))[_0x3dab('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3dab('0x1f')][_0x3dab('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5b0784,_0x1bd550,_0x60120a,_0x55cb0a){return new BPromise(function(_0x4bd3f1,_0xbeeee2){var _0x2e9933=_0x55cb0a||client;return _0x2e9933[_0x3dab('0x21')](_0x5b0784,_0x60120a)[_0x3dab('0x22')](function(_0xd70f9a){logger['info'](_0x3dab('0x23'),_0x1bd550,_0x3dab('0x24'));logger['debug'](_0x3dab('0x25'),_0x1bd550,_0x3dab('0x24'),JSON[_0x3dab('0x26')](_0xd70f9a));if(_0xd70f9a[_0x3dab('0x27')]){if(_0xd70f9a['error'][_0x3dab('0x28')]===0x1f4){logger[_0x3dab('0x27')](_0x3dab('0x23'),_0x1bd550,_0xd70f9a[_0x3dab('0x27')][_0x3dab('0x29')]);return _0xbeeee2(_0xd70f9a[_0x3dab('0x27')][_0x3dab('0x29')]);}logger[_0x3dab('0x27')](_0x3dab('0x23'),_0x1bd550,_0xd70f9a['error'][_0x3dab('0x29')]);return _0x4bd3f1(_0xd70f9a['error'][_0x3dab('0x29')]);}else{logger[_0x3dab('0x2a')](_0x3dab('0x23'),_0x1bd550,_0x3dab('0x24'));_0x4bd3f1(_0xd70f9a[_0x3dab('0x2b')][_0x3dab('0x29')]);}})['catch'](function(_0x50bd53){logger[_0x3dab('0x27')](_0x3dab('0x23'),_0x1bd550,_0x50bd53);_0xbeeee2(_0x50bd53);});});}function respondWithStatusCode(_0x4f96aa,_0x21880a){_0x21880a=_0x21880a||0xcc;return function(_0x2f78d7){if(_0x2f78d7){return _0x4f96aa[_0x3dab('0x2c')](_0x21880a);}return _0x4f96aa[_0x3dab('0x2d')](_0x21880a)['end']();};}function respondWithResult(_0x2215d7,_0x4999c4){_0x4999c4=_0x4999c4||0xc8;return function(_0x803cc1){if(_0x803cc1){return _0x2215d7[_0x3dab('0x2d')](_0x4999c4)[_0x3dab('0x2e')](_0x803cc1);}};}function respondWithFilteredResult(_0x464d84,_0x4f81dc){return function(_0x4e562c){if(_0x4e562c){var _0x36f834=_0x4e562c['count'],_0x5bfe9e=_0x4f81dc[_0x3dab('0x2f')],_0x483bce=_0x4f81dc[_0x3dab('0x2f')]+_0x4f81dc[_0x3dab('0x30')],_0x5b6026;if(_0x483bce>=_0x36f834){_0x483bce=_0x36f834;_0x5b6026=0xc8;}else{_0x5b6026=0xce;}_0x464d84[_0x3dab('0x2d')](_0x5b6026);return _0x464d84[_0x3dab('0x31')](_0x3dab('0x32'),_0x5bfe9e+'-'+_0x483bce+'/'+_0x36f834)[_0x3dab('0x2e')](_0x4e562c);}return null;};}function patchUpdates(_0x9d2420){return function(_0x2e67cb){try{jsonpatch[_0x3dab('0x33')](_0x2e67cb,_0x9d2420,!![]);}catch(_0x122437){return BPromise[_0x3dab('0x34')](_0x122437);}return _0x2e67cb[_0x3dab('0x35')]();};}function saveUpdates(_0x477f9f,_0x10f2a0){return function(_0x1226ef){if(_0x1226ef){return _0x1226ef[_0x3dab('0x36')](_0x477f9f)[_0x3dab('0x22')](function(_0x341c2d){return _0x341c2d;});}return null;};}function removeEntity(_0x383ef8,_0x5470ec){return function(_0x599b21){if(_0x599b21){return _0x599b21[_0x3dab('0x37')]()['then'](function(){_0x383ef8[_0x3dab('0x2d')](0xcc)[_0x3dab('0x38')]();});}};}function handleEntityNotFound(_0x492556,_0x325d42){return function(_0x1ea6f1){if(!_0x1ea6f1){_0x492556[_0x3dab('0x2c')](0x194);}return _0x1ea6f1;};}function handleError(_0x45e10d,_0x5430e3){_0x5430e3=_0x5430e3||0x1f4;return function(_0x5ce8e5){logger[_0x3dab('0x27')](_0x5ce8e5['stack']);if(_0x5ce8e5[_0x3dab('0x39')]){delete _0x5ce8e5[_0x3dab('0x39')];}_0x45e10d[_0x3dab('0x2d')](_0x5430e3)['send'](_0x5ce8e5);};}exports['index']=function(_0x372348,_0x20ab66){var _0xac866b={},_0x5b8956={},_0x239212={'count':0x0,'rows':[]};var _0x125d19=_[_0x3dab('0x3a')](db[_0x3dab('0x3b')][_0x3dab('0x3c')],function(_0x5ce6dd){return{'name':_0x5ce6dd[_0x3dab('0x3d')],'type':_0x5ce6dd[_0x3dab('0x3e')][_0x3dab('0x3f')]};});_0x5b8956[_0x3dab('0x40')]=_[_0x3dab('0x3a')](_0x125d19,_0x3dab('0x39'));_0x5b8956[_0x3dab('0x41')]=_['keys'](_0x372348[_0x3dab('0x41')]);_0x5b8956[_0x3dab('0x42')]=_[_0x3dab('0x43')](_0x5b8956['model'],_0x5b8956['query']);_0xac866b[_0x3dab('0x44')]=_[_0x3dab('0x43')](_0x5b8956[_0x3dab('0x40')],qs[_0x3dab('0x45')](_0x372348['query'][_0x3dab('0x45')]));_0xac866b[_0x3dab('0x44')]=_0xac866b[_0x3dab('0x44')][_0x3dab('0x46')]?_0xac866b[_0x3dab('0x44')]:_0x5b8956[_0x3dab('0x40')];if(!_0x372348['query'][_0x3dab('0x47')]('nolimit')){_0xac866b['limit']=qs[_0x3dab('0x30')](_0x372348['query'][_0x3dab('0x30')]);_0xac866b[_0x3dab('0x2f')]=qs[_0x3dab('0x2f')](_0x372348['query'][_0x3dab('0x2f')]);}_0xac866b[_0x3dab('0x48')]=qs[_0x3dab('0x49')](_0x372348[_0x3dab('0x41')][_0x3dab('0x49')]);_0xac866b[_0x3dab('0x4a')]=qs[_0x3dab('0x42')](_['pick'](_0x372348[_0x3dab('0x41')],_0x5b8956['filters']),_0x125d19);if(_0x372348[_0x3dab('0x41')][_0x3dab('0x4b')]){_0xac866b[_0x3dab('0x4a')]=_['merge'](_0xac866b[_0x3dab('0x4a')],{'$or':_[_0x3dab('0x3a')](_0x125d19,function(_0x56422c){if(_0x56422c['type']!==_0x3dab('0x4c')){var _0xf42017={};_0xf42017[_0x56422c[_0x3dab('0x39')]]={'$like':'%'+_0x372348[_0x3dab('0x41')][_0x3dab('0x4b')]+'%'};return _0xf42017;}})});}_0xac866b=_[_0x3dab('0x4d')]({},_0xac866b,_0x372348[_0x3dab('0x4e')]);var _0x24cc78={'where':_0xac866b[_0x3dab('0x4a')]};return db['ChatGroup']['count'](_0x24cc78)['then'](function(_0x14960d){_0x239212[_0x3dab('0x4f')]=_0x14960d;if(_0x372348['query'][_0x3dab('0x50')]){_0xac866b[_0x3dab('0x51')]=[{'all':!![]}];}return db[_0x3dab('0x3b')][_0x3dab('0x52')](_0xac866b);})[_0x3dab('0x22')](function(_0x3fe80f){_0x239212['rows']=_0x3fe80f;return _0x239212;})[_0x3dab('0x22')](respondWithFilteredResult(_0x20ab66,_0xac866b))['catch'](handleError(_0x20ab66,null));};exports[_0x3dab('0x53')]=function(_0x396e5e,_0x2341cd){var _0x3d6844={'raw':!![],'where':{'id':_0x396e5e[_0x3dab('0x54')]['id']}},_0x5afba8={};_0x5afba8[_0x3dab('0x40')]=_[_0x3dab('0x55')](db[_0x3dab('0x3b')]['rawAttributes']);_0x5afba8[_0x3dab('0x41')]=_[_0x3dab('0x55')](_0x396e5e[_0x3dab('0x41')]);_0x5afba8[_0x3dab('0x42')]=_[_0x3dab('0x43')](_0x5afba8['model'],_0x5afba8[_0x3dab('0x41')]);_0x3d6844['attributes']=_[_0x3dab('0x43')](_0x5afba8[_0x3dab('0x40')],qs[_0x3dab('0x45')](_0x396e5e['query']['fields']));_0x3d6844[_0x3dab('0x44')]=_0x3d6844[_0x3dab('0x44')][_0x3dab('0x46')]?_0x3d6844[_0x3dab('0x44')]:_0x5afba8['model'];if(_0x396e5e[_0x3dab('0x41')][_0x3dab('0x50')]){_0x3d6844[_0x3dab('0x51')]=[{'all':!![]}];}_0x3d6844=_[_0x3dab('0x4d')]({},_0x3d6844,_0x396e5e['options']);return db['ChatGroup']['find'](_0x3d6844)[_0x3dab('0x22')](handleEntityNotFound(_0x2341cd,null))[_0x3dab('0x22')](respondWithResult(_0x2341cd,null))[_0x3dab('0x56')](handleError(_0x2341cd,null));};exports[_0x3dab('0x57')]=function(_0x38fbbe,_0x4d9c9a){return db[_0x3dab('0x3b')][_0x3dab('0x57')](_0x38fbbe[_0x3dab('0x58')],{})[_0x3dab('0x22')](respondWithResult(_0x4d9c9a,0xc9))[_0x3dab('0x56')](handleError(_0x4d9c9a,null));};exports['update']=function(_0x565443,_0x593ab9){if(_0x565443[_0x3dab('0x58')]['id']){delete _0x565443[_0x3dab('0x58')]['id'];}return db[_0x3dab('0x3b')]['find']({'where':{'id':_0x565443[_0x3dab('0x54')]['id']}})[_0x3dab('0x22')](handleEntityNotFound(_0x593ab9,null))[_0x3dab('0x22')](saveUpdates(_0x565443[_0x3dab('0x58')],null))[_0x3dab('0x22')](respondWithResult(_0x593ab9,null))['catch'](handleError(_0x593ab9,null));};exports[_0x3dab('0x37')]=function(_0x47d734,_0x5aa4b7){return db[_0x3dab('0x3b')]['find']({'where':{'id':_0x47d734[_0x3dab('0x54')]['id']}})[_0x3dab('0x22')](handleEntityNotFound(_0x5aa4b7,null))[_0x3dab('0x22')](removeEntity(_0x5aa4b7,null))[_0x3dab('0x56')](handleError(_0x5aa4b7,null));};exports[_0x3dab('0x59')]=function(_0x1d776f,_0x39fe65){return db[_0x3dab('0x3b')]['describe']()[_0x3dab('0x22')](respondWithResult(_0x39fe65,null))[_0x3dab('0x56')](handleError(_0x39fe65,null));};exports[_0x3dab('0x5a')]=function(_0x398dd5,_0x2d8760,_0x155af1){return db[_0x3dab('0x5b')][_0x3dab('0x4f')]({'where':{'ChatGroupId':_0x398dd5[_0x3dab('0x54')]['id'],'ToId':_0x398dd5[_0x3dab('0x5c')]['id'],'read':![]}})[_0x3dab('0x22')](function(_0xb541d4){return{'id':_[_0x3dab('0x5d')](_0x398dd5[_0x3dab('0x54')]['id']),'count':_0xb541d4};})[_0x3dab('0x22')](respondWithResult(_0x2d8760,null))[_0x3dab('0x56')](handleError(_0x2d8760,null));};exports[_0x3dab('0x5e')]=function(_0x5df44b,_0x162bad,_0x402ef0){return db[_0x3dab('0x3b')]['find']({'where':{'id':_0x5df44b['params']['id']}})[_0x3dab('0x22')](handleEntityNotFound(_0x162bad,null))[_0x3dab('0x22')](function(_0x16ec26){if(_0x16ec26){return _0x16ec26[_0x3dab('0x5e')](_0x5df44b[_0x3dab('0x58')][_0x3dab('0x5f')],_[_0x3dab('0x60')](_0x5df44b[_0x3dab('0x58')],[_0x3dab('0x5f'),'id'])||{});}})[_0x3dab('0x22')](respondWithResult(_0x162bad,null))[_0x3dab('0x56')](handleError(_0x162bad,null));};exports[_0x3dab('0x61')]=function(_0x1b02e5,_0x4701aa,_0x234b84){var _0x42d400={};var _0x3d5fa7={};var _0x4a97c7;var _0x4983c9;return db[_0x3dab('0x3b')]['findOne']({'where':{'id':_0x1b02e5[_0x3dab('0x54')]['id']}})[_0x3dab('0x22')](handleEntityNotFound(_0x4701aa,null))['then'](function(_0xd8fddd){if(_0xd8fddd){_0x4a97c7=_0xd8fddd;_0x3d5fa7[_0x3dab('0x40')]=_[_0x3dab('0x55')](db['User'][_0x3dab('0x3c')]);_0x3d5fa7[_0x3dab('0x41')]=_['keys'](_0x1b02e5[_0x3dab('0x41')]);_0x3d5fa7[_0x3dab('0x42')]=_['intersection'](_0x3d5fa7[_0x3dab('0x40')],_0x3d5fa7[_0x3dab('0x41')]);_0x42d400[_0x3dab('0x44')]=_['intersection'](_0x3d5fa7['model'],qs[_0x3dab('0x45')](_0x1b02e5[_0x3dab('0x41')][_0x3dab('0x45')]));_0x42d400[_0x3dab('0x44')]=_0x42d400[_0x3dab('0x44')][_0x3dab('0x46')]?_0x42d400[_0x3dab('0x44')]:_0x3d5fa7[_0x3dab('0x40')];_0x42d400['order']=qs['sort'](_0x1b02e5['query'][_0x3dab('0x49')]);_0x42d400['where']=qs['filters'](_[_0x3dab('0x62')](_0x1b02e5[_0x3dab('0x41')],_0x3d5fa7[_0x3dab('0x42')]));if(_0x1b02e5[_0x3dab('0x41')][_0x3dab('0x4b')]){_0x42d400[_0x3dab('0x4a')]=_[_0x3dab('0x4d')](_0x42d400[_0x3dab('0x4a')],{'$or':_[_0x3dab('0x3a')](_0x42d400['attributes'],function(_0x4a16b4){var _0x41c705={};_0x41c705[_0x4a16b4]={'$like':'%'+_0x1b02e5[_0x3dab('0x41')][_0x3dab('0x4b')]+'%'};return _0x41c705;})});}_0x42d400=_[_0x3dab('0x4d')]({},_0x42d400,_0x1b02e5[_0x3dab('0x4e')]);return _0x4a97c7[_0x3dab('0x61')](_0x42d400);}})[_0x3dab('0x22')](function(_0xb21c3b){if(_0xb21c3b){_0x4983c9=_0xb21c3b[_0x3dab('0x46')];if(!_0x1b02e5[_0x3dab('0x41')][_0x3dab('0x47')](_0x3dab('0x63'))){_0x42d400[_0x3dab('0x30')]=qs['limit'](_0x1b02e5[_0x3dab('0x41')][_0x3dab('0x30')]);_0x42d400['offset']=qs[_0x3dab('0x2f')](_0x1b02e5[_0x3dab('0x41')]['offset']);}return _0x4a97c7['getMembers'](_0x42d400);}})[_0x3dab('0x22')](function(_0x5b9133){if(_0x5b9133){return _0x5b9133?{'count':_0x4983c9,'rows':_0x5b9133}:null;}})[_0x3dab('0x22')](respondWithResult(_0x4701aa,null))[_0x3dab('0x56')](handleError(_0x4701aa,null));};exports['removeMembers']=function(_0x1afd42,_0x2e5ec7,_0x574822){return db['ChatGroup'][_0x3dab('0x64')]({'where':{'id':_0x1afd42[_0x3dab('0x54')]['id']}})[_0x3dab('0x22')](handleEntityNotFound(_0x2e5ec7,null))[_0x3dab('0x22')](function(_0x59bd8a){if(_0x59bd8a){return _0x59bd8a[_0x3dab('0x65')](_0x1afd42[_0x3dab('0x41')]['ids']);}})['then'](respondWithStatusCode(_0x2e5ec7,null))[_0x3dab('0x56')](handleError(_0x2e5ec7,null));};exports[_0x3dab('0x66')]=function(_0x40b5cc,_0x178160,_0x17086b){if(_0x40b5cc[_0x3dab('0x58')]['id']){delete _0x40b5cc[_0x3dab('0x58')]['id'];}return db[_0x3dab('0x3b')][_0x3dab('0x64')]({'where':{'id':_0x40b5cc[_0x3dab('0x54')]['id']}})[_0x3dab('0x22')](handleEntityNotFound(_0x178160,null))['then'](function(_0x46e0da){if(_0x46e0da){_0x40b5cc['body'][_0x3dab('0x67')]=_0x46e0da['id'];return db[_0x3dab('0x5b')][_0x3dab('0x57')](_0x40b5cc['body']);}})['then'](respondWithResult(_0x178160,null))[_0x3dab('0x56')](handleError(_0x178160,null));};exports[_0x3dab('0x68')]=function(_0xd2a7b5,_0x54229e,_0x45d770){var _0x3d133f={};var _0xfdbb58={};var _0x80e5a2;var _0x32a092;return db[_0x3dab('0x3b')][_0x3dab('0x69')]({'where':{'id':_0xd2a7b5[_0x3dab('0x54')]['id']}})['then'](handleEntityNotFound(_0x54229e,null))['then'](function(_0x3207f6){if(_0x3207f6){_0x80e5a2=_0x3207f6;_0xfdbb58['model']=_[_0x3dab('0x55')](db['ChatInternalMessage'][_0x3dab('0x3c')]);_0xfdbb58['query']=_[_0x3dab('0x55')](_0xd2a7b5[_0x3dab('0x41')]);_0xfdbb58[_0x3dab('0x42')]=_[_0x3dab('0x43')](_0xfdbb58[_0x3dab('0x40')],_0xfdbb58['query']);_0x3d133f[_0x3dab('0x44')]=_[_0x3dab('0x43')](_0xfdbb58['model'],qs['fields'](_0xd2a7b5[_0x3dab('0x41')]['fields']));_0x3d133f[_0x3dab('0x44')]=_0x3d133f[_0x3dab('0x44')][_0x3dab('0x46')]?_0x3d133f[_0x3dab('0x44')]:_0xfdbb58[_0x3dab('0x40')];_0x3d133f[_0x3dab('0x48')]=qs[_0x3dab('0x49')](_0xd2a7b5[_0x3dab('0x41')][_0x3dab('0x49')]);_0x3d133f['where']=qs['filters'](_[_0x3dab('0x62')](_0xd2a7b5[_0x3dab('0x41')],_0xfdbb58[_0x3dab('0x42')]));if(_0xd2a7b5[_0x3dab('0x41')][_0x3dab('0x4b')]){_0x3d133f['where']=_['merge'](_0x3d133f[_0x3dab('0x4a')],{'$or':_['map'](_0x3d133f[_0x3dab('0x44')],function(_0x53df3a){var _0x404294={};_0x404294[_0x53df3a]={'$like':'%'+_0xd2a7b5[_0x3dab('0x41')][_0x3dab('0x4b')]+'%'};return _0x404294;})});}if(_0xd2a7b5['query'][_0x3dab('0x6a')]){var _0x472ebe=_0xd2a7b5[_0x3dab('0x41')][_0x3dab('0x6a')]['split'](',');var _0x25241c={};_0x25241c[_0x472ebe[0x0]]={'$gte':moment(_0x472ebe[0x1])[_0x3dab('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3d133f[_0x3dab('0x4a')]=_[_0x3dab('0x4d')](_0x3d133f[_0x3dab('0x4a')],_0x25241c);}_0x3d133f=_[_0x3dab('0x4d')]({},_0x3d133f,_0xd2a7b5[_0x3dab('0x4e')]);return _0x80e5a2[_0x3dab('0x68')](_0x3d133f);}})['then'](function(_0x5ccef5){if(_0x5ccef5){_0x32a092=_0x5ccef5[_0x3dab('0x46')];if(!_0xd2a7b5[_0x3dab('0x41')][_0x3dab('0x47')](_0x3dab('0x63'))){_0x3d133f['limit']=qs[_0x3dab('0x30')](_0xd2a7b5[_0x3dab('0x41')][_0x3dab('0x30')]);_0x3d133f[_0x3dab('0x2f')]=qs[_0x3dab('0x2f')](_0xd2a7b5['query'][_0x3dab('0x2f')]);}return _0x80e5a2['getMessages'](_0x3d133f);}})[_0x3dab('0x22')](function(_0x57b677){if(_0x57b677){return _0x57b677?{'count':_0x32a092,'rows':_0x57b677}:null;}})[_0x3dab('0x22')](respondWithResult(_0x54229e,null))['catch'](handleError(_0x54229e,null));}; \ No newline at end of file +var _0xc7da=['options','find','create','body','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','client','http','request','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','status','end','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','offset','order','sort','where','pick','filter','map','VIRTUAL','merge','ChatGroup','count','includeAll','include','findAll','show','params'];(function(_0x1f96d7,_0x20d141){var _0x728705=function(_0x55e0fd){while(--_0x55e0fd){_0x1f96d7['push'](_0x1f96d7['shift']());}};_0x728705(++_0x20d141);}(_0xc7da,0xf2));var _0xac7d=function(_0x4cce3d,_0x3e77b9){_0x4cce3d=_0x4cce3d-0x0;var _0x58ec78=_0xc7da[_0x4cce3d];return _0x58ec78;};'use strict';var pdf=require(_0xac7d('0x0'));var emlformat=require(_0xac7d('0x1'));var rimraf=require(_0xac7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac7d('0x3'));var rp=require(_0xac7d('0x4'));var moment=require('moment');var BPromise=require(_0xac7d('0x5'));var Mustache=require(_0xac7d('0x6'));var util=require('util');var path=require(_0xac7d('0x7'));var sox=require(_0xac7d('0x8'));var csv=require(_0xac7d('0x9'));var ejs=require(_0xac7d('0xa'));var fs=require('fs');var _=require(_0xac7d('0xb'));var squel=require(_0xac7d('0xc'));var crypto=require('crypto');var jsforce=require(_0xac7d('0xd'));var deskjs=require(_0xac7d('0xe'));var toCsv=require(_0xac7d('0x9'));var querystring=require(_0xac7d('0xf'));var Papa=require(_0xac7d('0x10'));var Redis=require(_0xac7d('0x11'));var authService=require(_0xac7d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xac7d('0x13'));var hardwareService=require(_0xac7d('0x14'));var logger=require(_0xac7d('0x15'))('api');var utils=require(_0xac7d('0x16'));var config=require(_0xac7d('0x17'));var licenseUtil=require(_0xac7d('0x18'));var db=require(_0xac7d('0x19'))['db'];config['redis']=_[_0xac7d('0x1a')](config[_0xac7d('0x1b')],{'host':_0xac7d('0x1c'),'port':0x18eb});var socket=require(_0xac7d('0x1d'))(new Redis(config[_0xac7d('0x1b')]));require('./chatGroup.socket')[_0xac7d('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xac7d('0x1f')][_0xac7d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x34980f,_0x355209,_0x533bac,_0x19e7ba){return new BPromise(function(_0x4283dd,_0x27ed38){var _0x12813a=_0x19e7ba||client;return _0x12813a[_0xac7d('0x21')](_0x34980f,_0x533bac)['then'](function(_0x7df8e0){logger[_0xac7d('0x22')]('ChatGroup,\x20%s,\x20%s',_0x355209,_0xac7d('0x23'));logger[_0xac7d('0x24')](_0xac7d('0x25'),_0x355209,_0xac7d('0x23'),JSON['stringify'](_0x7df8e0));if(_0x7df8e0[_0xac7d('0x26')]){if(_0x7df8e0[_0xac7d('0x26')][_0xac7d('0x27')]===0x1f4){logger['error'](_0xac7d('0x28'),_0x355209,_0x7df8e0['error'][_0xac7d('0x29')]);return _0x27ed38(_0x7df8e0[_0xac7d('0x26')][_0xac7d('0x29')]);}logger[_0xac7d('0x26')](_0xac7d('0x28'),_0x355209,_0x7df8e0[_0xac7d('0x26')]['message']);return _0x4283dd(_0x7df8e0['error'][_0xac7d('0x29')]);}else{logger[_0xac7d('0x22')]('ChatGroup,\x20%s,\x20%s',_0x355209,_0xac7d('0x23'));_0x4283dd(_0x7df8e0[_0xac7d('0x2a')][_0xac7d('0x29')]);}})[_0xac7d('0x2b')](function(_0x43aa8e){logger[_0xac7d('0x26')](_0xac7d('0x28'),_0x355209,_0x43aa8e);_0x27ed38(_0x43aa8e);});});}function respondWithStatusCode(_0x3bb7dd,_0x42e313){_0x42e313=_0x42e313||0xcc;return function(_0x26a8c4){if(_0x26a8c4){return _0x3bb7dd['sendStatus'](_0x42e313);}return _0x3bb7dd[_0xac7d('0x2c')](_0x42e313)[_0xac7d('0x2d')]();};}function respondWithResult(_0x31e220,_0x1bcfd5){_0x1bcfd5=_0x1bcfd5||0xc8;return function(_0x4cc590){if(_0x4cc590){return _0x31e220['status'](_0x1bcfd5)['json'](_0x4cc590);}};}function respondWithFilteredResult(_0xc30df3,_0x32b12c){return function(_0xac3f87){if(_0xac3f87){var _0x5bd39b=_0xac3f87['count'],_0x51df23=_0x32b12c['offset'],_0x506b88=_0x32b12c['offset']+_0x32b12c[_0xac7d('0x2e')],_0x4e2456;if(_0x506b88>=_0x5bd39b){_0x506b88=_0x5bd39b;_0x4e2456=0xc8;}else{_0x4e2456=0xce;}_0xc30df3[_0xac7d('0x2c')](_0x4e2456);return _0xc30df3[_0xac7d('0x2f')](_0xac7d('0x30'),_0x51df23+'-'+_0x506b88+'/'+_0x5bd39b)[_0xac7d('0x31')](_0xac3f87);}return null;};}function patchUpdates(_0x5c3c15){return function(_0x4ce2ed){try{jsonpatch[_0xac7d('0x32')](_0x4ce2ed,_0x5c3c15,!![]);}catch(_0xfbfbf7){return BPromise[_0xac7d('0x33')](_0xfbfbf7);}return _0x4ce2ed[_0xac7d('0x34')]();};}function saveUpdates(_0x39dc77,_0x500161){return function(_0x3ba58d){if(_0x3ba58d){return _0x3ba58d[_0xac7d('0x35')](_0x39dc77)[_0xac7d('0x36')](function(_0x96e66b){return _0x96e66b;});}return null;};}function removeEntity(_0x41c60a,_0x2e10f7){return function(_0x29163c){if(_0x29163c){return _0x29163c[_0xac7d('0x37')]()[_0xac7d('0x36')](function(){_0x41c60a[_0xac7d('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2237be,_0x1835d2){return function(_0x64724b){if(!_0x64724b){_0x2237be[_0xac7d('0x38')](0x194);}return _0x64724b;};}function handleError(_0x204717,_0x5690e4){_0x5690e4=_0x5690e4||0x1f4;return function(_0x2bfc9e){logger['error'](_0x2bfc9e['stack']);if(_0x2bfc9e[_0xac7d('0x39')]){delete _0x2bfc9e[_0xac7d('0x39')];}_0x204717[_0xac7d('0x2c')](_0x5690e4)[_0xac7d('0x3a')](_0x2bfc9e);};}exports[_0xac7d('0x3b')]=function(_0x24cdfb,_0x330fb0){var _0x1e48df={},_0x105bac={},_0x3a0bc2={'count':0x0,'rows':[]};var _0x1c5df3=_['map'](db['ChatGroup'][_0xac7d('0x3c')],function(_0x586b63){return{'name':_0x586b63[_0xac7d('0x3d')],'type':_0x586b63[_0xac7d('0x3e')][_0xac7d('0x3f')]};});_0x105bac[_0xac7d('0x40')]=_['map'](_0x1c5df3,'name');_0x105bac[_0xac7d('0x41')]=_[_0xac7d('0x42')](_0x24cdfb[_0xac7d('0x41')]);_0x105bac[_0xac7d('0x43')]=_[_0xac7d('0x44')](_0x105bac['model'],_0x105bac['query']);_0x1e48df[_0xac7d('0x45')]=_['intersection'](_0x105bac[_0xac7d('0x40')],qs[_0xac7d('0x46')](_0x24cdfb[_0xac7d('0x41')]['fields']));_0x1e48df[_0xac7d('0x45')]=_0x1e48df[_0xac7d('0x45')][_0xac7d('0x47')]?_0x1e48df[_0xac7d('0x45')]:_0x105bac[_0xac7d('0x40')];if(!_0x24cdfb[_0xac7d('0x41')]['hasOwnProperty']('nolimit')){_0x1e48df[_0xac7d('0x2e')]=qs[_0xac7d('0x2e')](_0x24cdfb['query'][_0xac7d('0x2e')]);_0x1e48df[_0xac7d('0x48')]=qs[_0xac7d('0x48')](_0x24cdfb['query']['offset']);}_0x1e48df[_0xac7d('0x49')]=qs['sort'](_0x24cdfb[_0xac7d('0x41')][_0xac7d('0x4a')]);_0x1e48df[_0xac7d('0x4b')]=qs[_0xac7d('0x43')](_[_0xac7d('0x4c')](_0x24cdfb[_0xac7d('0x41')],_0x105bac[_0xac7d('0x43')]),_0x1c5df3);if(_0x24cdfb[_0xac7d('0x41')][_0xac7d('0x4d')]){_0x1e48df[_0xac7d('0x4b')]=_['merge'](_0x1e48df[_0xac7d('0x4b')],{'$or':_[_0xac7d('0x4e')](_0x1c5df3,function(_0x37dca1){if(_0x37dca1[_0xac7d('0x3e')]!==_0xac7d('0x4f')){var _0x4092d1={};_0x4092d1[_0x37dca1[_0xac7d('0x39')]]={'$like':'%'+_0x24cdfb['query'][_0xac7d('0x4d')]+'%'};return _0x4092d1;}})});}_0x1e48df=_[_0xac7d('0x50')]({},_0x1e48df,_0x24cdfb['options']);var _0x1905c5={'where':_0x1e48df[_0xac7d('0x4b')]};return db[_0xac7d('0x51')][_0xac7d('0x52')](_0x1905c5)[_0xac7d('0x36')](function(_0x40abbb){_0x3a0bc2[_0xac7d('0x52')]=_0x40abbb;if(_0x24cdfb['query'][_0xac7d('0x53')]){_0x1e48df[_0xac7d('0x54')]=[{'all':!![]}];}return db['ChatGroup'][_0xac7d('0x55')](_0x1e48df);})[_0xac7d('0x36')](function(_0x3f3e3d){_0x3a0bc2['rows']=_0x3f3e3d;return _0x3a0bc2;})[_0xac7d('0x36')](respondWithFilteredResult(_0x330fb0,_0x1e48df))[_0xac7d('0x2b')](handleError(_0x330fb0,null));};exports[_0xac7d('0x56')]=function(_0x302794,_0x57e0c2){var _0x2cf14d={'raw':!![],'where':{'id':_0x302794[_0xac7d('0x57')]['id']}},_0x14901d={};_0x14901d[_0xac7d('0x40')]=_[_0xac7d('0x42')](db['ChatGroup']['rawAttributes']);_0x14901d[_0xac7d('0x41')]=_[_0xac7d('0x42')](_0x302794[_0xac7d('0x41')]);_0x14901d['filters']=_[_0xac7d('0x44')](_0x14901d['model'],_0x14901d[_0xac7d('0x41')]);_0x2cf14d[_0xac7d('0x45')]=_[_0xac7d('0x44')](_0x14901d[_0xac7d('0x40')],qs[_0xac7d('0x46')](_0x302794[_0xac7d('0x41')]['fields']));_0x2cf14d[_0xac7d('0x45')]=_0x2cf14d[_0xac7d('0x45')][_0xac7d('0x47')]?_0x2cf14d[_0xac7d('0x45')]:_0x14901d[_0xac7d('0x40')];if(_0x302794[_0xac7d('0x41')][_0xac7d('0x53')]){_0x2cf14d[_0xac7d('0x54')]=[{'all':!![]}];}_0x2cf14d=_[_0xac7d('0x50')]({},_0x2cf14d,_0x302794[_0xac7d('0x58')]);return db[_0xac7d('0x51')][_0xac7d('0x59')](_0x2cf14d)[_0xac7d('0x36')](handleEntityNotFound(_0x57e0c2,null))[_0xac7d('0x36')](respondWithResult(_0x57e0c2,null))[_0xac7d('0x2b')](handleError(_0x57e0c2,null));};exports[_0xac7d('0x5a')]=function(_0xda0b68,_0x4c5e10){return db[_0xac7d('0x51')][_0xac7d('0x5a')](_0xda0b68[_0xac7d('0x5b')],{})[_0xac7d('0x36')](respondWithResult(_0x4c5e10,0xc9))[_0xac7d('0x2b')](handleError(_0x4c5e10,null));};exports[_0xac7d('0x35')]=function(_0x5e9fa4,_0x5625f9){if(_0x5e9fa4[_0xac7d('0x5b')]['id']){delete _0x5e9fa4[_0xac7d('0x5b')]['id'];}return db[_0xac7d('0x51')][_0xac7d('0x59')]({'where':{'id':_0x5e9fa4['params']['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x5625f9,null))[_0xac7d('0x36')](saveUpdates(_0x5e9fa4[_0xac7d('0x5b')],null))[_0xac7d('0x36')](respondWithResult(_0x5625f9,null))[_0xac7d('0x2b')](handleError(_0x5625f9,null));};exports['destroy']=function(_0x28329b,_0x36d8bd){return db[_0xac7d('0x51')][_0xac7d('0x59')]({'where':{'id':_0x28329b['params']['id']}})['then'](handleEntityNotFound(_0x36d8bd,null))[_0xac7d('0x36')](removeEntity(_0x36d8bd,null))[_0xac7d('0x2b')](handleError(_0x36d8bd,null));};exports[_0xac7d('0x5c')]=function(_0x29fc2c,_0x430260){return db[_0xac7d('0x51')][_0xac7d('0x5c')]()[_0xac7d('0x36')](respondWithResult(_0x430260,null))[_0xac7d('0x2b')](handleError(_0x430260,null));};exports['getUnread']=function(_0x3fedfc,_0x26617a,_0x7a9823){return db[_0xac7d('0x5d')]['count']({'where':{'ChatGroupId':_0x3fedfc[_0xac7d('0x57')]['id'],'ToId':_0x3fedfc[_0xac7d('0x5e')]['id'],'read':![]}})[_0xac7d('0x36')](function(_0x45097a){return{'id':_[_0xac7d('0x5f')](_0x3fedfc['params']['id']),'count':_0x45097a};})[_0xac7d('0x36')](respondWithResult(_0x26617a,null))[_0xac7d('0x2b')](handleError(_0x26617a,null));};exports[_0xac7d('0x60')]=function(_0x13dc6b,_0x336cb2,_0x1b2c24){return db[_0xac7d('0x51')]['find']({'where':{'id':_0x13dc6b[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x336cb2,null))[_0xac7d('0x36')](function(_0x3b670d){if(_0x3b670d){return _0x3b670d[_0xac7d('0x60')](_0x13dc6b[_0xac7d('0x5b')][_0xac7d('0x61')],_[_0xac7d('0x62')](_0x13dc6b[_0xac7d('0x5b')],[_0xac7d('0x61'),'id'])||{});}})[_0xac7d('0x36')](respondWithResult(_0x336cb2,null))[_0xac7d('0x2b')](handleError(_0x336cb2,null));};exports[_0xac7d('0x63')]=function(_0x5b8458,_0x2a6904,_0x388a95){var _0x7b4c80={};var _0x5823fa={};var _0xb0118a;var _0x4d8265;return db['ChatGroup'][_0xac7d('0x64')]({'where':{'id':_0x5b8458[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x2a6904,null))[_0xac7d('0x36')](function(_0x2c7f9d){if(_0x2c7f9d){_0xb0118a=_0x2c7f9d;_0x5823fa['model']=_[_0xac7d('0x42')](db['User'][_0xac7d('0x3c')]);_0x5823fa['query']=_[_0xac7d('0x42')](_0x5b8458[_0xac7d('0x41')]);_0x5823fa[_0xac7d('0x43')]=_['intersection'](_0x5823fa[_0xac7d('0x40')],_0x5823fa[_0xac7d('0x41')]);_0x7b4c80[_0xac7d('0x45')]=_[_0xac7d('0x44')](_0x5823fa['model'],qs[_0xac7d('0x46')](_0x5b8458[_0xac7d('0x41')][_0xac7d('0x46')]));_0x7b4c80['attributes']=_0x7b4c80['attributes'][_0xac7d('0x47')]?_0x7b4c80[_0xac7d('0x45')]:_0x5823fa['model'];_0x7b4c80['order']=qs[_0xac7d('0x4a')](_0x5b8458['query'][_0xac7d('0x4a')]);_0x7b4c80[_0xac7d('0x4b')]=qs[_0xac7d('0x43')](_[_0xac7d('0x4c')](_0x5b8458[_0xac7d('0x41')],_0x5823fa['filters']));if(_0x5b8458[_0xac7d('0x41')][_0xac7d('0x4d')]){_0x7b4c80['where']=_[_0xac7d('0x50')](_0x7b4c80[_0xac7d('0x4b')],{'$or':_[_0xac7d('0x4e')](_0x7b4c80['attributes'],function(_0x28e419){var _0xca2186={};_0xca2186[_0x28e419]={'$like':'%'+_0x5b8458[_0xac7d('0x41')][_0xac7d('0x4d')]+'%'};return _0xca2186;})});}_0x7b4c80=_[_0xac7d('0x50')]({},_0x7b4c80,_0x5b8458[_0xac7d('0x58')]);return _0xb0118a['getMembers'](_0x7b4c80);}})['then'](function(_0x45d0fd){if(_0x45d0fd){_0x4d8265=_0x45d0fd[_0xac7d('0x47')];if(!_0x5b8458[_0xac7d('0x41')]['hasOwnProperty'](_0xac7d('0x65'))){_0x7b4c80[_0xac7d('0x2e')]=qs[_0xac7d('0x2e')](_0x5b8458[_0xac7d('0x41')][_0xac7d('0x2e')]);_0x7b4c80[_0xac7d('0x48')]=qs[_0xac7d('0x48')](_0x5b8458[_0xac7d('0x41')][_0xac7d('0x48')]);}return _0xb0118a['getMembers'](_0x7b4c80);}})['then'](function(_0x5c61d1){if(_0x5c61d1){return _0x5c61d1?{'count':_0x4d8265,'rows':_0x5c61d1}:null;}})[_0xac7d('0x36')](respondWithResult(_0x2a6904,null))['catch'](handleError(_0x2a6904,null));};exports[_0xac7d('0x66')]=function(_0x3a660e,_0x979958,_0xc5ba36){return db[_0xac7d('0x51')][_0xac7d('0x59')]({'where':{'id':_0x3a660e[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x979958,null))['then'](function(_0x2e5a61){if(_0x2e5a61){return _0x2e5a61[_0xac7d('0x66')](_0x3a660e['query'][_0xac7d('0x61')]);}})['then'](respondWithStatusCode(_0x979958,null))[_0xac7d('0x2b')](handleError(_0x979958,null));};exports[_0xac7d('0x67')]=function(_0x413871,_0x23555d,_0x2d766d){if(_0x413871[_0xac7d('0x5b')]['id']){delete _0x413871['body']['id'];}return db[_0xac7d('0x51')][_0xac7d('0x59')]({'where':{'id':_0x413871[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x23555d,null))['then'](function(_0x54fa30){if(_0x54fa30){_0x413871['body'][_0xac7d('0x68')]=_0x54fa30['id'];return db['ChatInternalMessage'][_0xac7d('0x5a')](_0x413871[_0xac7d('0x5b')]);}})['then'](respondWithResult(_0x23555d,null))[_0xac7d('0x2b')](handleError(_0x23555d,null));};exports[_0xac7d('0x69')]=function(_0x834710,_0x22a3ab,_0x2bc2c8){var _0xe4c0b={};var _0x1a2b21={};var _0x17dbc1;var _0x22e406;return db[_0xac7d('0x51')][_0xac7d('0x64')]({'where':{'id':_0x834710[_0xac7d('0x57')]['id']}})[_0xac7d('0x36')](handleEntityNotFound(_0x22a3ab,null))[_0xac7d('0x36')](function(_0x2cde10){if(_0x2cde10){_0x17dbc1=_0x2cde10;_0x1a2b21[_0xac7d('0x40')]=_[_0xac7d('0x42')](db[_0xac7d('0x5d')][_0xac7d('0x3c')]);_0x1a2b21['query']=_['keys'](_0x834710[_0xac7d('0x41')]);_0x1a2b21[_0xac7d('0x43')]=_[_0xac7d('0x44')](_0x1a2b21[_0xac7d('0x40')],_0x1a2b21['query']);_0xe4c0b[_0xac7d('0x45')]=_[_0xac7d('0x44')](_0x1a2b21[_0xac7d('0x40')],qs['fields'](_0x834710[_0xac7d('0x41')][_0xac7d('0x46')]));_0xe4c0b[_0xac7d('0x45')]=_0xe4c0b[_0xac7d('0x45')]['length']?_0xe4c0b[_0xac7d('0x45')]:_0x1a2b21[_0xac7d('0x40')];_0xe4c0b[_0xac7d('0x49')]=qs['sort'](_0x834710[_0xac7d('0x41')]['sort']);_0xe4c0b[_0xac7d('0x4b')]=qs[_0xac7d('0x43')](_[_0xac7d('0x4c')](_0x834710[_0xac7d('0x41')],_0x1a2b21['filters']));if(_0x834710[_0xac7d('0x41')][_0xac7d('0x4d')]){_0xe4c0b['where']=_[_0xac7d('0x50')](_0xe4c0b[_0xac7d('0x4b')],{'$or':_['map'](_0xe4c0b[_0xac7d('0x45')],function(_0x2be9ff){var _0x4efd06={};_0x4efd06[_0x2be9ff]={'$like':'%'+_0x834710['query'][_0xac7d('0x4d')]+'%'};return _0x4efd06;})});}if(_0x834710[_0xac7d('0x41')]['$gte']){var _0x3ca960=_0x834710[_0xac7d('0x41')][_0xac7d('0x6a')][_0xac7d('0x6b')](',');var _0x4d3bb9={};_0x4d3bb9[_0x3ca960[0x0]]={'$gte':moment(_0x3ca960[0x1])[_0xac7d('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')};_0xe4c0b['where']=_[_0xac7d('0x50')](_0xe4c0b[_0xac7d('0x4b')],_0x4d3bb9);}_0xe4c0b=_['merge']({},_0xe4c0b,_0x834710[_0xac7d('0x58')]);return _0x17dbc1[_0xac7d('0x69')](_0xe4c0b);}})[_0xac7d('0x36')](function(_0x441022){if(_0x441022){_0x22e406=_0x441022[_0xac7d('0x47')];if(!_0x834710[_0xac7d('0x41')][_0xac7d('0x6d')](_0xac7d('0x65'))){_0xe4c0b[_0xac7d('0x2e')]=qs[_0xac7d('0x2e')](_0x834710[_0xac7d('0x41')][_0xac7d('0x2e')]);_0xe4c0b[_0xac7d('0x48')]=qs[_0xac7d('0x48')](_0x834710[_0xac7d('0x41')][_0xac7d('0x48')]);}return _0x17dbc1[_0xac7d('0x69')](_0xe4c0b);}})[_0xac7d('0x36')](function(_0x39b19d){if(_0x39b19d){return _0x39b19d?{'count':_0x22e406,'rows':_0x39b19d}:null;}})['then'](respondWithResult(_0x22a3ab,null))[_0xac7d('0x2b')](handleError(_0x22a3ab,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index e098008..cdad990 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 _0x0b0e=['ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x435122,_0x502c99){var _0x3a4d69=function(_0x289d25){while(--_0x289d25){_0x435122['push'](_0x435122['shift']());}};_0x3a4d69(++_0x502c99);}(_0x0b0e,0x187));var _0xe0b0=function(_0x260f28,_0x4e9b30){_0x260f28=_0x260f28-0x0;var _0x3aefcc=_0x0b0e[_0x260f28];return _0x3aefcc;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatGroupEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatGroupEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatGroup[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','update'];(function(_0x9ee1ff,_0x551dc9){var _0x42e791=function(_0x33a7d2){while(--_0x33a7d2){_0x9ee1ff['push'](_0x9ee1ff['shift']());}};_0x42e791(++_0x551dc9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5624df,_0x527728){_0x5624df=_0x5624df-0x0;var _0x7aea7=_0x5f2f[_0x5624df];return _0x7aea7;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatGroup=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatGroupEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatGroupEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatGroup[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 53a8b39..261e1d5 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 _0x8832=['lodash','util','moment','bluebird','request-promise','rimraf','./chatGroup.attributes','exports','define','chat_groups'];(function(_0x1a08cf,_0x186382){var _0x4174b7=function(_0x263861){while(--_0x263861){_0x1a08cf['push'](_0x1a08cf['shift']());}};_0x4174b7(++_0x186382);}(_0x8832,0x1f4));var _0x2883=function(_0x4d7d63,_0x3b6c22){_0x4d7d63=_0x4d7d63-0x0;var _0x36cc67=_0x8832[_0x4d7d63];return _0x36cc67;};'use strict';var _=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2883('0x2'));var BPromise=require(_0x2883('0x3'));var rp=require(_0x2883('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2883('0x5'));var config=require('../../config/environment');var attributes=require(_0x2883('0x6'));module[_0x2883('0x7')]=function(_0x278026,_0x556903){return _0x278026[_0x2883('0x8')]('ChatGroup',attributes,{'tableName':_0x2883('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc770=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','util','moment','bluebird','request-promise'];(function(_0x2addab,_0x511cec){var _0x180d4f=function(_0x26f64d){while(--_0x26f64d){_0x2addab['push'](_0x2addab['shift']());}};_0x180d4f(++_0x511cec);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var util=require(_0x0c77('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0c77('0x2'));var BPromise=require(_0x0c77('0x3'));var rp=require(_0x0c77('0x4'));var fs=require('fs');var path=require(_0x0c77('0x5'));var rimraf=require(_0x0c77('0x6'));var config=require(_0x0c77('0x7'));var attributes=require(_0x0c77('0x8'));module[_0x0c77('0x9')]=function(_0x575bb3,_0x26a0ff){return _0x575bb3[_0x0c77('0xa')]('ChatGroup',attributes,{'tableName':_0x0c77('0xb'),'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 167394b..7e81797 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 _0xa4cb=['message','info','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./chatGroup.socket','register','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error'];(function(_0x263e6d,_0x585ebb){var _0xc8d72=function(_0x54afe4){while(--_0x54afe4){_0x263e6d['push'](_0x263e6d['shift']());}};_0xc8d72(++_0x585ebb);}(_0xa4cb,0x118));var _0xba4c=function(_0x2a18cd,_0x47043f){_0x2a18cd=_0x2a18cd-0x0;var _0x259ce2=_0xa4cb[_0x2a18cd];return _0x259ce2;};'use strict';var _=require(_0xba4c('0x0'));var util=require('util');var moment=require(_0xba4c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba4c('0x2'))['db'];var utils=require(_0xba4c('0x3'));var logger=require(_0xba4c('0x4'))(_0xba4c('0x5'));var config=require(_0xba4c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xba4c('0x7')][_0xba4c('0x8')]({'port':0x232a});config[_0xba4c('0x9')]=_[_0xba4c('0xa')](config[_0xba4c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xba4c('0x9')]));require(_0xba4c('0xb'))[_0xba4c('0xc')](socket);function respondWithRpcPromise(_0x367e13,_0x3adf2a,_0x2ca59f){return new BPromise(function(_0x2b6802,_0x39bbda){return client['request'](_0x367e13,_0x2ca59f)['then'](function(_0x18f814){logger['info'](_0xba4c('0xd'),_0x3adf2a,_0xba4c('0xe'));logger[_0xba4c('0xf')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3adf2a,_0xba4c('0xe'),JSON[_0xba4c('0x10')](_0x18f814));if(_0x18f814['error']){if(_0x18f814['error'][_0xba4c('0x11')]===0x1f4){logger[_0xba4c('0x12')](_0xba4c('0xd'),_0x3adf2a,_0x18f814[_0xba4c('0x12')][_0xba4c('0x13')]);return _0x39bbda(_0x18f814[_0xba4c('0x12')][_0xba4c('0x13')]);}logger[_0xba4c('0x12')](_0xba4c('0xd'),_0x3adf2a,_0x18f814[_0xba4c('0x12')][_0xba4c('0x13')]);return _0x2b6802(_0x18f814[_0xba4c('0x12')][_0xba4c('0x13')]);}else{logger[_0xba4c('0x14')](_0xba4c('0xd'),_0x3adf2a,_0xba4c('0xe'));_0x2b6802(_0x18f814[_0xba4c('0x15')][_0xba4c('0x13')]);}})[_0xba4c('0x16')](function(_0x2f6cac){logger[_0xba4c('0x12')](_0xba4c('0xd'),_0x3adf2a,_0x2f6cac);_0x39bbda(_0x2f6cac);});});} \ No newline at end of file +var _0x6b9b=['../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x462053,_0x20ecad){var _0x355ec5=function(_0x246146){while(--_0x246146){_0x462053['push'](_0x462053['shift']());}};_0x355ec5(++_0x20ecad);}(_0x6b9b,0x1c1));var _0xb6b9=function(_0x52cef3,_0x4e970f){_0x52cef3=_0x52cef3-0x0;var _0x3adc4b=_0x6b9b[_0x52cef3];return _0x3adc4b;};'use strict';var _=require(_0xb6b9('0x0'));var util=require(_0xb6b9('0x1'));var moment=require(_0xb6b9('0x2'));var BPromise=require(_0xb6b9('0x3'));var rs=require(_0xb6b9('0x4'));var fs=require('fs');var Redis=require(_0xb6b9('0x5'));var db=require(_0xb6b9('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb6b9('0x7'))(_0xb6b9('0x8'));var config=require(_0xb6b9('0x9'));var jayson=require(_0xb6b9('0xa'));var client=jayson['client'][_0xb6b9('0xb')]({'port':0x232a});config['redis']=_[_0xb6b9('0xc')](config[_0xb6b9('0xd')],{'host':_0xb6b9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6b9('0xd')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x16291d,_0x43289e,_0x233fd9){return new BPromise(function(_0x3b01b9,_0x237a55){return client['request'](_0x16291d,_0x233fd9)['then'](function(_0x35b631){logger[_0xb6b9('0xf')]('ChatGroup,\x20%s,\x20%s',_0x43289e,_0xb6b9('0x10'));logger[_0xb6b9('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x43289e,'request\x20sent',JSON[_0xb6b9('0x12')](_0x35b631));if(_0x35b631[_0xb6b9('0x13')]){if(_0x35b631[_0xb6b9('0x13')][_0xb6b9('0x14')]===0x1f4){logger['error'](_0xb6b9('0x15'),_0x43289e,_0x35b631[_0xb6b9('0x13')][_0xb6b9('0x16')]);return _0x237a55(_0x35b631['error'][_0xb6b9('0x16')]);}logger[_0xb6b9('0x13')](_0xb6b9('0x15'),_0x43289e,_0x35b631[_0xb6b9('0x13')][_0xb6b9('0x16')]);return _0x3b01b9(_0x35b631[_0xb6b9('0x13')][_0xb6b9('0x16')]);}else{logger[_0xb6b9('0xf')](_0xb6b9('0x15'),_0x43289e,_0xb6b9('0x10'));_0x3b01b9(_0x35b631['result'][_0xb6b9('0x16')]);}})[_0xb6b9('0x17')](function(_0x589dbc){logger[_0xb6b9('0x13')](_0xb6b9('0x15'),_0x43289e,_0x589dbc);_0x237a55(_0x589dbc);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 5cd734a..25da54a 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 _0xd9bc=['emit','removeListener','register','length','save','remove','update'];(function(_0x27d0d8,_0x2b657d){var _0x2b79d1=function(_0x249ec1){while(--_0x249ec1){_0x27d0d8['push'](_0x27d0d8['shift']());}};_0x2b79d1(++_0x2b657d);}(_0xd9bc,0xa5));var _0xcd9b=function(_0xcffe38,_0x48fe40){_0xcffe38=_0xcffe38-0x0;var _0x576987=_0xd9bc[_0xcffe38];return _0x576987;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xcd9b('0x0'),_0xcd9b('0x1'),_0xcd9b('0x2')];function createListener(_0x4f02a7,_0x3195c3){return function(_0x38c120){_0x3195c3[_0xcd9b('0x3')](_0x4f02a7,_0x38c120);};}function removeListener(_0x144836,_0x11e26e){return function(){ChatGroupEvents[_0xcd9b('0x4')](_0x144836,_0x11e26e);};}exports[_0xcd9b('0x5')]=function(_0x26f4af){for(var _0x2ea37e=0x0,_0x4aefb2=events[_0xcd9b('0x6')];_0x2ea37e<_0x4aefb2;_0x2ea37e++){var _0x3670e8=events[_0x2ea37e];var _0x297365=createListener('chatGroup:'+_0x3670e8,_0x26f4af);ChatGroupEvents['on'](_0x3670e8,_0x297365);}}; \ No newline at end of file +var _0x833a=['remove','update','emit','removeListener','./chatGroup.events','save'];(function(_0x29d8a6,_0x287cc6){var _0x447dd9=function(_0x16ff8b){while(--_0x16ff8b){_0x29d8a6['push'](_0x29d8a6['shift']());}};_0x447dd9(++_0x287cc6);}(_0x833a,0x9a));var _0xa833=function(_0x1292b1,_0x4647f4){_0x1292b1=_0x1292b1-0x0;var _0x56df74=_0x833a[_0x1292b1];return _0x56df74;};'use strict';var ChatGroupEvents=require(_0xa833('0x0'));var events=[_0xa833('0x1'),_0xa833('0x2'),_0xa833('0x3')];function createListener(_0x47c396,_0xf55a36){return function(_0x396753){_0xf55a36[_0xa833('0x4')](_0x47c396,_0x396753);};}function removeListener(_0x4a2394,_0x46e8f4){return function(){ChatGroupEvents[_0xa833('0x5')](_0x4a2394,_0x46e8f4);};}exports['register']=function(_0x5825d6){for(var _0x5360e8=0x0,_0x37608b=events['length'];_0x5360e8<_0x37608b;_0x5360e8++){var _0x744726=events[_0x5360e8];var _0x560832=createListener('chatGroup:'+_0x744726,_0x5825d6);ChatGroupEvents['on'](_0x744726,_0x560832);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 1e1f273..951504b 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 _0x02fb=['/:id/members','addMessage','put','update','delete','destroy','removeMembers','exports','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','getUnread','/:id/messages','getMessages','post','create'];(function(_0x4ae0f8,_0x481211){var _0xcd39f7=function(_0x2a4134){while(--_0x2a4134){_0x4ae0f8['push'](_0x4ae0f8['shift']());}};_0xcd39f7(++_0x481211);}(_0x02fb,0x198));var _0xb02f=function(_0x53dcd9,_0x4bb8db){_0x53dcd9=_0x53dcd9-0x0;var _0xeeaf58=_0x02fb[_0x53dcd9];return _0xeeaf58;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb02f('0x0'));var express=require(_0xb02f('0x1'));var router=express[_0xb02f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xb02f('0x3'));var config=require(_0xb02f('0x4'));var controller=require(_0xb02f('0x5'));router[_0xb02f('0x6')]('/',auth[_0xb02f('0x7')](),controller['index']);router['get'](_0xb02f('0x8'),auth[_0xb02f('0x7')](),controller[_0xb02f('0x9')]);router[_0xb02f('0x6')](_0xb02f('0xa'),auth[_0xb02f('0x7')](),controller[_0xb02f('0xb')]);router[_0xb02f('0x6')]('/:id/unread',auth[_0xb02f('0x7')](),controller[_0xb02f('0xc')]);router[_0xb02f('0x6')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xb02f('0x6')](_0xb02f('0xd'),auth['isAuthenticated'](),controller[_0xb02f('0xe')]);router[_0xb02f('0xf')]('/',auth[_0xb02f('0x7')](),controller[_0xb02f('0x10')]);router[_0xb02f('0xf')](_0xb02f('0x11'),auth[_0xb02f('0x7')](),controller['addMembers']);router['post'](_0xb02f('0xd'),auth['isAuthenticated'](),controller[_0xb02f('0x12')]);router[_0xb02f('0x13')]('/:id',auth[_0xb02f('0x7')](),controller[_0xb02f('0x14')]);router[_0xb02f('0x15')](_0xb02f('0xa'),auth['isAuthenticated'](),controller[_0xb02f('0x16')]);router[_0xb02f('0x15')](_0xb02f('0x11'),auth[_0xb02f('0x7')](),controller[_0xb02f('0x17')]);module[_0xb02f('0x18')]=router; \ No newline at end of file +var _0x0e3a=['index','/describe','getUnread','/:id/members','/:id/messages','create','post','addMembers','addMessage','/:id','update','destroy','removeMembers','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated'];(function(_0x4d1616,_0x541ef6){var _0x593dab=function(_0xf9e565){while(--_0xf9e565){_0x4d1616['push'](_0x4d1616['shift']());}};_0x593dab(++_0x541ef6);}(_0x0e3a,0x16e));var _0xa0e3=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0e3a[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xa0e3('0x0'));var util=require('util');var path=require(_0xa0e3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa0e3('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xa0e3('0x3'));var config=require(_0xa0e3('0x4'));var controller=require(_0xa0e3('0x5'));router[_0xa0e3('0x6')]('/',auth[_0xa0e3('0x7')](),controller[_0xa0e3('0x8')]);router['get'](_0xa0e3('0x9'),auth[_0xa0e3('0x7')](),controller['describe']);router['get']('/:id',auth[_0xa0e3('0x7')](),controller['show']);router['get']('/:id/unread',auth['isAuthenticated'](),controller[_0xa0e3('0xa')]);router[_0xa0e3('0x6')](_0xa0e3('0xb'),auth[_0xa0e3('0x7')](),controller['getMembers']);router[_0xa0e3('0x6')](_0xa0e3('0xc'),auth['isAuthenticated'](),controller['getMessages']);router['post']('/',auth[_0xa0e3('0x7')](),controller[_0xa0e3('0xd')]);router[_0xa0e3('0xe')]('/:id/members',auth[_0xa0e3('0x7')](),controller[_0xa0e3('0xf')]);router[_0xa0e3('0xe')](_0xa0e3('0xc'),auth[_0xa0e3('0x7')](),controller[_0xa0e3('0x10')]);router['put'](_0xa0e3('0x11'),auth['isAuthenticated'](),controller[_0xa0e3('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa0e3('0x13')]);router['delete'](_0xa0e3('0xb'),auth[_0xa0e3('0x7')](),controller[_0xa0e3('0x14')]);module[_0xa0e3('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index f08cbf4..f68a718 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 _0xb1a6=['ENUM','thumb','star','TEXT','STRING','long','DATE','sequelize','exports','INTEGER'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0xb1a6,0x147));var _0x6b1a=function(_0xdfde4c,_0x18c4f4){_0xdfde4c=_0xdfde4c-0x0;var _0x3260fa=_0xb1a6[_0xdfde4c];return _0x3260fa;};'use strict';var Sequelize=require(_0x6b1a('0x0'));module[_0x6b1a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x6b1a('0x2')]},'ratingType':{'type':Sequelize[_0x6b1a('0x3')]('star',_0x6b1a('0x4')),'defaultValue':_0x6b1a('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x6b1a('0x6')]},'mailTranscript':{'type':Sequelize[_0x6b1a('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6b1a('0x7')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6b1a('0x7')]},'note':{'type':Sequelize[_0x6b1a('0x7')]},'browserName':{'type':Sequelize[_0x6b1a('0x7')]},'browserVersion':{'type':Sequelize[_0x6b1a('0x7')]},'osName':{'type':Sequelize[_0x6b1a('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x6b1a('0x7')]},'deviceVendor':{'type':Sequelize[_0x6b1a('0x7')]},'deviceType':{'type':Sequelize[_0x6b1a('0x7')]},'referer':{'type':Sequelize[_0x6b1a('0x6')]},'customerIp':{'type':Sequelize[_0x6b1a('0x7')]},'formData':{'type':Sequelize[_0x6b1a('0x6')](_0x6b1a('0x8'))},'read1stAt':{'type':Sequelize[_0x6b1a('0x9')]},'lastMsgAt':{'type':Sequelize[_0x6b1a('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x6b1a('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x6b1a('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x6b1a('0x6')]}}; \ No newline at end of file +var _0x608a=['TEXT','STRING','long','DATE','out','exports','BOOLEAN','ENUM','star','thumb'];(function(_0xabae1e,_0x3f7e5a){var _0x159597=function(_0xf16cf6){while(--_0xf16cf6){_0xabae1e['push'](_0xabae1e['shift']());}};_0x159597(++_0x3f7e5a);}(_0x608a,0xff));var _0xa608=function(_0x526f38,_0x584c8f){_0x526f38=_0x526f38-0x0;var _0x42f8cf=_0x608a[_0x526f38];return _0x42f8cf;};'use strict';var Sequelize=require('sequelize');module[_0xa608('0x0')]={'closed':{'type':Sequelize[_0xa608('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa608('0x2')](_0xa608('0x3'),_0xa608('0x4')),'defaultValue':_0xa608('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xa608('0x5')]},'mailTranscript':{'type':Sequelize[_0xa608('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa608('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa608('0x6')]},'browserName':{'type':Sequelize[_0xa608('0x6')]},'browserVersion':{'type':Sequelize[_0xa608('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xa608('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xa608('0x6')]},'deviceType':{'type':Sequelize[_0xa608('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xa608('0x6')]},'formData':{'type':Sequelize[_0xa608('0x5')](_0xa608('0x7'))},'read1stAt':{'type':Sequelize[_0xa608('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa608('0x2')]('in',_0xa608('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xa608('0x6')]},'customerPort':{'type':Sequelize[_0xa608('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xa608('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 359a85c..912679a 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 _0x0598=['i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','show','include','options','create','params','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','attachmentDownload','Attachment','attachId','join','server/files/attachments/','close','root','transcript-%s.txt','pathTranscript','Messages','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','fullname','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','MailServerOut','Smtp','service','host','port','secure','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','nolimit','secret','includeAgent','includeAll','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','transcript-%d-%s.zip','CmContact','Contact','lastName','Account','Owner','get','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','closedAt','browserName','osName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','direction','out','firstName','toFile','transcript-','.pdf','log','err','html-pdf','eml-format','zip-dir','moment','bluebird','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','client','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','Users','TagIds','Tags','push','index','map','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','select','field','from','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','parseSearch','search','sqlOperator','length','conditions','find','value','having','`\x20>\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','ChatWebsiteId','concat','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','Sequelize','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition'];(function(_0x4515dd,_0x436dad){var _0x3d49b5=function(_0x19fe92){while(--_0x19fe92){_0x4515dd['push'](_0x4515dd['shift']());}};_0x3d49b5(++_0x436dad);}(_0x0598,0x92));var _0x8059=function(_0x5cf983,_0x1c784d){_0x5cf983=_0x5cf983-0x0;var _0x5c73b0=_0x0598[_0x5cf983];return _0x5c73b0;};'use strict';var pdf=require(_0x8059('0x0'));var emlformat=require(_0x8059('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8059('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8059('0x3'));var BPromise=require(_0x8059('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8059('0x5'));var csv=require(_0x8059('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8059('0x7'));var crypto=require(_0x8059('0x8'));var jsforce=require(_0x8059('0x9'));var deskjs=require(_0x8059('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8059('0xb'));var Redis=require(_0x8059('0xc'));var authService=require(_0x8059('0xd'));var qs=require(_0x8059('0xe'));var as=require(_0x8059('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8059('0x10'));var utils=require(_0x8059('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8059('0x12')]=_[_0x8059('0x13')](config[_0x8059('0x12')],{'host':_0x8059('0x14'),'port':0x18eb});var socket=require(_0x8059('0x15'))(new Redis(config['redis']));require(_0x8059('0x16'))['register'](socket);var jayson=require(_0x8059('0x17'));var client=jayson['client'][_0x8059('0x18')]({'port':0x232b});var client9004=jayson[_0x8059('0x19')][_0x8059('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x4d3873,_0x516c1f,_0x5cda43,_0x3b8f18){return new BPromise(function(_0x239195,_0x2ffebf){var _0x246c9d=_0x3b8f18||client;return _0x246c9d[_0x8059('0x1a')](_0x4d3873,_0x5cda43)['then'](function(_0x10ad98){logger[_0x8059('0x1b')](_0x8059('0x1c'),_0x516c1f,_0x8059('0x1d'));logger['debug'](_0x8059('0x1e'),_0x516c1f,'request\x20sent',JSON[_0x8059('0x1f')](_0x10ad98));if(_0x10ad98['error']){if(_0x10ad98[_0x8059('0x20')]['code']===0x1f4){logger[_0x8059('0x20')](_0x8059('0x1c'),_0x516c1f,_0x10ad98[_0x8059('0x20')]['message']);return _0x2ffebf(_0x10ad98['error'][_0x8059('0x21')]);}logger[_0x8059('0x20')](_0x8059('0x1c'),_0x516c1f,_0x10ad98[_0x8059('0x20')]['message']);return _0x239195(_0x10ad98[_0x8059('0x20')][_0x8059('0x21')]);}else{logger[_0x8059('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x516c1f,_0x8059('0x1d'));_0x239195(_0x10ad98[_0x8059('0x22')][_0x8059('0x21')]);}})[_0x8059('0x23')](function(_0x59d3a6){logger[_0x8059('0x20')](_0x8059('0x1c'),_0x516c1f,_0x59d3a6);_0x2ffebf(_0x59d3a6);});});}function respondWithStatusCode(_0x4781e2,_0x3e2d2b){_0x3e2d2b=_0x3e2d2b||0xcc;return function(_0x202b30){if(_0x202b30){return _0x4781e2['sendStatus'](_0x3e2d2b);}return _0x4781e2[_0x8059('0x24')](_0x3e2d2b)[_0x8059('0x25')]();};}function respondWithResult(_0xd1fa7e,_0x4a294f){_0x4a294f=_0x4a294f||0xc8;return function(_0x582321){if(_0x582321){return _0xd1fa7e['status'](_0x4a294f)[_0x8059('0x26')](_0x582321);}};}function respondWithFilteredResult(_0xbebe0e,_0xc32b1f){return function(_0x1009af){if(_0x1009af){var _0x59abe9=_0x1009af[_0x8059('0x27')],_0x1eb71b=_0xc32b1f['offset'],_0x50b737=_0xc32b1f[_0x8059('0x28')]+_0xc32b1f[_0x8059('0x29')],_0x2f887c;if(_0x50b737>=_0x59abe9){_0x50b737=_0x59abe9;_0x2f887c=0xc8;}else{_0x2f887c=0xce;}_0xbebe0e[_0x8059('0x24')](_0x2f887c);return _0xbebe0e[_0x8059('0x2a')](_0x8059('0x2b'),_0x1eb71b+'-'+_0x50b737+'/'+_0x59abe9)[_0x8059('0x26')](_0x1009af);}return null;};}function patchUpdates(_0x46b6a1){return function(_0x2016ea){try{jsonpatch['apply'](_0x2016ea,_0x46b6a1,!![]);}catch(_0xb3c36e){return BPromise[_0x8059('0x2c')](_0xb3c36e);}return _0x2016ea[_0x8059('0x2d')]();};}function saveUpdates(_0x15f843,_0x289992){return function(_0x53fb30){if(_0x53fb30){return _0x53fb30[_0x8059('0x2e')](_0x15f843)[_0x8059('0x2f')](function(_0x27c947){return _0x27c947;});}return null;};}function removeEntity(_0x15160a,_0x3ee515){return function(_0x22fd6f){if(_0x22fd6f){return _0x22fd6f[_0x8059('0x30')]()[_0x8059('0x2f')](function(){_0x15160a[_0x8059('0x24')](0xcc)[_0x8059('0x25')]();});}};}function handleEntityNotFound(_0x521ca4,_0x45c175){return function(_0x5b0070){if(!_0x5b0070){_0x521ca4[_0x8059('0x31')](0x194);}return _0x5b0070;};}function handleError(_0x5dc3f7,_0x49fb7e){_0x49fb7e=_0x49fb7e||0x1f4;return function(_0x2191a0){logger['error'](_0x2191a0[_0x8059('0x32')]);if(_0x2191a0['name']){delete _0x2191a0[_0x8059('0x33')];}_0x5dc3f7['status'](_0x49fb7e)[_0x8059('0x34')](_0x2191a0);};}function getInteractionUsers(_0x5c4aa0,_0x53252a){return new BPromise(function(_0x3a3e20,_0x7961af){try{if(_0x53252a[_0x5c4aa0['id']]){_0x5c4aa0[_0x8059('0x35')]=_['map'](_0x53252a[_0x5c4aa0['id']],function(_0x241403){return{'id':_0x241403['id'],'fullname':_0x241403['fullname']};});}}catch(_0x1e8596){_0x7961af(_0x1e8596);}_0x3a3e20(_0x5c4aa0);});}function getInteractionTags(_0x50a685,_0x2034ec){return new BPromise(function(_0x1cee2b,_0x45393b){try{if(_0x50a685[_0x8059('0x36')]){_0x50a685['Tags']=[];_0x50a685[_0x8059('0x36')]['split'](',')['forEach'](function(_0x33b3b7){_0x50a685[_0x8059('0x37')][_0x8059('0x38')](_0x2034ec[_0x33b3b7]);});}delete _0x50a685[_0x8059('0x36')];}catch(_0x2f68b0){_0x45393b(_0x2f68b0);}_0x1cee2b(_0x50a685);});}function updateChatInteraction(_0x5b322f,_0x47c3b9,_0x4872f2){return new BPromise(function(_0x5f0c8e,_0x373e10){return getInteractionUsers(_0x5b322f,_0x4872f2)[_0x8059('0x2f')](function(_0xc84f04){return getInteractionTags(_0xc84f04,_0x47c3b9);})['then'](function(_0x29ae1f){_0x5f0c8e(_0x29ae1f);})[_0x8059('0x23')](function(_0x52919a){_0x373e10(_0x52919a);});});}exports[_0x8059('0x39')]=function(_0x2980cb,_0x12c5fa){var _0x5362b5={},_0x2c48cf={},_0x38c320={'count':0x0,'rows':[]};var _0x57eb56=_[_0x8059('0x3a')](db[_0x8059('0x3b')][_0x8059('0x3c')],function(_0x40763d){return{'name':_0x40763d[_0x8059('0x3d')],'type':_0x40763d[_0x8059('0x3e')][_0x8059('0x3f')]};});_0x2c48cf[_0x8059('0x40')]=_[_0x8059('0x3a')](_0x57eb56,_0x8059('0x33'));_0x2c48cf[_0x8059('0x41')]=_[_0x8059('0x42')](_0x2980cb[_0x8059('0x41')]);_0x2c48cf[_0x8059('0x43')]=_[_0x8059('0x44')](_0x2c48cf[_0x8059('0x40')],_0x2c48cf[_0x8059('0x41')]);_0x5362b5[_0x8059('0x45')]=_[_0x8059('0x44')](_0x2c48cf[_0x8059('0x40')],qs[_0x8059('0x46')](_0x2980cb[_0x8059('0x41')][_0x8059('0x46')]));_0x5362b5['attributes']=_0x5362b5[_0x8059('0x45')]['length']?_0x5362b5['attributes']:_0x2c48cf[_0x8059('0x40')];if(!_0x2980cb['query'][_0x8059('0x47')]('nolimit')){_0x5362b5[_0x8059('0x29')]=qs[_0x8059('0x29')](_0x2980cb[_0x8059('0x41')][_0x8059('0x29')]);_0x5362b5[_0x8059('0x28')]=qs[_0x8059('0x28')](_0x2980cb['query'][_0x8059('0x28')]);}_0x5362b5['order']=qs[_0x8059('0x48')](_0x2980cb[_0x8059('0x41')][_0x8059('0x48')]);_0x5362b5['where']=qs[_0x8059('0x43')](_[_0x8059('0x49')](_0x2980cb[_0x8059('0x41')],_0x2c48cf[_0x8059('0x43')]),_0x57eb56);var _0x584e13=[];var _0x3ccfb1=squel[_0x8059('0x4a')]()[_0x8059('0x4b')]('id')['field'](_0x8059('0x33'))['field']('color')[_0x8059('0x4c')]('tools_tags');var _0x20caa3=squel['select']()[_0x8059('0x4b')](_0x8059('0x4d'))['field'](_0x8059('0x4e'))['field'](_0x8059('0x4f'))[_0x8059('0x4c')](_0x8059('0x50'),'ui')['left_join'](_0x8059('0x51'),'u','u.id\x20=\x20ui.UserId');var _0x21ceef=squel[_0x8059('0x4a')]()[_0x8059('0x4c')](_0x8059('0x52'),'i')['left_join'](_0x8059('0x53'),'c',_0x8059('0x54'))['left_join'](_0x8059('0x51'),'o','o.id\x20=\x20i.UserId')[_0x8059('0x55')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x8059('0x55')](_0x8059('0x56'),'me',_0x8059('0x57'))[_0x8059('0x55')](_0x8059('0x58'),'it',_0x8059('0x59'))[_0x8059('0x55')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x52ed37=squel['expr']();var _0x37c254=[];var _0x21d53c=squel['expr']();var _0x411fe1;if(_0x2980cb['query']['search']){_0x411fe1=as[_0x8059('0x5a')](_0x2980cb['query'][_0x8059('0x5b')]);var _0x27dfa5=_0x411fe1[_0x8059('0x5c')];for(var _0x5928a4=0x0;_0x5928a4<_0x411fe1['conditions'][_0x8059('0x5d')];_0x5928a4++){var _0x39b9f6=_0x411fe1[_0x8059('0x5e')][_0x5928a4];var _0x5056e6='i';var _0x501f2c=_[_0x8059('0x5f')](_0x57eb56,['name',_0x39b9f6['field']]);if(!_0x501f2c){switch(_0x39b9f6[_0x8059('0x4b')]){case'unreadMessages':if(_0x39b9f6[_0x8059('0x60')]==0x1){_0x21ceef[_0x8059('0x61')]('`'+_0x39b9f6['field']+'`\x20=\x200');}else{_0x21ceef[_0x8059('0x61')]('`'+_0x39b9f6[_0x8059('0x4b')]+_0x8059('0x62'));}break;case'Contact':if(_0x39b9f6[_0x8059('0x63')]===_0x8059('0x64')){if(_0x39b9f6[_0x8059('0x60')][_0x8059('0x65')]('\x20')['length']>0x1){_0x52ed37[_0x27dfa5](_0x8059('0x66'),qs['getFullTextValue'](_0x39b9f6[_0x8059('0x60')]),null);}else{var _0x176f8a='%'+_0x39b9f6['value']+'%';_0x52ed37[_0x27dfa5](_0x8059('0x67'),_0x176f8a,_0x176f8a,_0x176f8a);}}else{_0x501f2c=_['find'](_0x57eb56,[_0x8059('0x33'),_0x8059('0x68')]);_0x39b9f6[_0x8059('0x4b')]=_0x8059('0x68');_0x3f13a3=as[_0x8059('0x69')](_0x5056e6,_0x501f2c[_0x8059('0x3e')],_0x39b9f6);_0x52ed37[_0x27dfa5](_0x3f13a3[_0x8059('0x6a')],_0x3f13a3[_0x8059('0x60')][_0x8059('0x6b')],_0x3f13a3[_0x8059('0x60')][_0x8059('0x25')]);}break;case _0x8059('0x6c'):var _0x325f9c=_0x39b9f6['value'][_0x8059('0x65')](',')[_0x8059('0x3a')](function(_0x391924){return Number(_0x391924);});_0x325f9c[_0x8059('0x6d')](function(_0x2cf1fd){_0x21d53c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2cf1fd+',%');});_0x37c254=_[_0x8059('0x6e')](_0x37c254,_0x325f9c);break;case _0x8059('0x6f'):if(_0x39b9f6[_0x8059('0x63')]===_0x8059('0x64')){_0x52ed37[_0x27dfa5](_0x8059('0x70'),'%'+_0x39b9f6[_0x8059('0x60')]+'%',null);}else{_0x501f2c=_[_0x8059('0x5f')](_0x57eb56,[_0x8059('0x33'),_0x8059('0x71')]);_0x39b9f6['field']=_0x8059('0x71');_0x3f13a3=as[_0x8059('0x69')](_0x5056e6,_0x501f2c[_0x8059('0x3e')],_0x39b9f6);_0x52ed37[_0x27dfa5](_0x3f13a3['text'],_0x3f13a3['value'][_0x8059('0x6b')],_0x3f13a3[_0x8059('0x60')][_0x8059('0x25')]);}break;case _0x8059('0x72'):_0x3f13a3=as[_0x8059('0x69')]('me',null,_0x39b9f6);_0x52ed37[_0x27dfa5](_0x3f13a3[_0x8059('0x6a')],_0x3f13a3[_0x8059('0x60')]['start'],_0x3f13a3[_0x8059('0x60')][_0x8059('0x25')]);break;}}else{var _0x3f13a3=as['buildExpression'](_0x5056e6,_0x501f2c[_0x8059('0x3e')],_0x39b9f6);_0x52ed37[_0x27dfa5](_0x3f13a3[_0x8059('0x6a')],_0x3f13a3[_0x8059('0x60')][_0x8059('0x6b')],_0x3f13a3['value']['end']);}}}else{var _0x2aa4a0=_(_0x2980cb[_0x8059('0x41')])['keys']()[_0x8059('0x3a')](function(_0x1c19b0){return _[_0x8059('0x73')](_0x57eb56,[_0x8059('0x33'),_0x1c19b0])?_0x1c19b0:undefined;})[_0x8059('0x74')]()[_0x8059('0x60')]();if(!_['isEmpty'](_0x2aa4a0)){_0x2aa4a0[_0x8059('0x6d')](function(_0x2cdcc4){if(_0x2cdcc4===_0x8059('0x75')){_0x21ceef['where']('i.ChatWebsiteId\x20IN\x20?',[][_0x8059('0x76')](_0x2980cb[_0x8059('0x41')][_0x2cdcc4]));}else if(_0x2cdcc4==='createdAt'){var _0x1f9c4f=JSON[_0x8059('0x77')](_0x2980cb[_0x8059('0x41')][_0x2cdcc4])[_0x8059('0x78')];var _0x2009d9=JSON[_0x8059('0x77')](_0x2980cb[_0x8059('0x41')][_0x2cdcc4])[_0x8059('0x79')];_0x21ceef[_0x8059('0x7a')](_0x8059('0x7b'),_0x1f9c4f,_0x2009d9);}else{if(_0x2980cb[_0x8059('0x41')][_0x2cdcc4]===_0x8059('0x7c')){_0x21ceef['where']('i.'+_0x2cdcc4+_0x8059('0x7d'));}else{_0x21ceef[_0x8059('0x7a')]('i.'+_0x2cdcc4+_0x8059('0x7e'),_0x2980cb['query'][_0x2cdcc4]);}}});}if(_0x2980cb['query'][_0x8059('0x7f')]){if(_0x2980cb['query']['read']==0x1){_0x21ceef[_0x8059('0x61')](_0x8059('0x80'));}else{_0x21ceef['having'](_0x8059('0x81'));}}if(_0x2980cb[_0x8059('0x41')]['tag']){_0x37c254=_['isArray'](_0x2980cb[_0x8059('0x41')]['tag'])?_0x2980cb['query'][_0x8059('0x82')]:new Array(_0x2980cb[_0x8059('0x41')][_0x8059('0x82')]);_0x37c254[_0x8059('0x6d')](function(_0x55257a){_0x21d53c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x55257a+',%');});}if(_0x2980cb[_0x8059('0x41')][_0x8059('0x83')]){var _0x402120=_0x2980cb[_0x8059('0x41')][_0x8059('0x83')][_0x8059('0x84')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x402120)){_0x52ed37['or'](_0x8059('0x85'),_0x402120+'%');}else{_0x52ed37['or'](_0x8059('0x86'),qs[_0x8059('0x87')](_0x402120))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x402120+'%');}}}_0x21ceef[_0x8059('0x7a')](_0x52ed37);_0x21ceef[_0x8059('0x88')]('i.id');var _0x5a5c7={'type':db[_0x8059('0x89')]['QueryTypes'][_0x8059('0x8a')],'raw':!![]};var _0x3c5ae0=_0x21ceef[_0x8059('0x8b')]();_0x3c5ae0[_0x8059('0x4b')](_0x8059('0x8c'));_0x3c5ae0[_0x8059('0x4b')](_0x8059('0x8d'),_0x8059('0x8e'));if(_0x5362b5[_0x8059('0x8f')]){_0x5362b5['order']['forEach'](function(_0x1b9f1a){var _0x1452ed=_0x1b9f1a[0x0]===_0x8059('0x90')?_0x1b9f1a[0x0]:'i.'+_0x1b9f1a[0x0];_0x21ceef[_0x8059('0x8f')](_0x1452ed,_0x1b9f1a[0x1]===_0x8059('0x91')?![]:!![]);});}if(!_[_0x8059('0x92')](_0x37c254)){_0x21ceef['having'](_0x21d53c);_0x3c5ae0[_0x8059('0x7a')](_0x8059('0x93'),_0x37c254);}BPromise[_0x8059('0x94')]()['then'](function(){if(!_0x411fe1){if(_0x2980cb[_0x8059('0x41')][_0x8059('0x75')]||_0x2980cb[_0x8059('0x41')][_0x8059('0x95')])return;_0x3c5ae0[_0x8059('0x7a')](_0x8059('0x96'));_0x21ceef[_0x8059('0x7a')](_0x8059('0x96'));return;}if(_0x2980cb[_0x8059('0x97')][_0x8059('0x98')]!==_0x8059('0x99'))return;return _0x2980cb[_0x8059('0x97')][_0x8059('0x9a')]({'attributes':['id'],'raw':!![]})[_0x8059('0x2f')](function(_0x397d77){if(_['isEmpty'](_0x397d77)){_0x3c5ae0[_0x8059('0x7a')](_0x8059('0x9b'));_0x21ceef['where'](_0x8059('0x9b'));}else{_0x3c5ae0['where'](_0x8059('0x9c'),_[_0x8059('0x3a')](_0x397d77,'id'));_0x21ceef[_0x8059('0x7a')](_0x8059('0x9c'),_[_0x8059('0x3a')](_0x397d77,'id'));}});})[_0x8059('0x2f')](function(){if(_0x2980cb[_0x8059('0x97')][_0x8059('0x98')]===_0x8059('0x99')&&!_0x411fe1&&!_0x2980cb[_0x8059('0x41')][_0x8059('0x75')])return[];return db[_0x8059('0x9d')]['query'](_0x3c5ae0['toString'](),_0x5a5c7);})[_0x8059('0x2f')](function(_0x276c67){_0x38c320['count']=_0x276c67[_0x8059('0x5d')];if(_0x38c320['count']===0x0)return[];return db[_0x8059('0x9d')][_0x8059('0x41')](_0x3ccfb1[_0x8059('0x9e')](),_0x5a5c7)[_0x8059('0x2f')](function(_0x137855){_0x584e13=_[_0x8059('0x9f')](_0x137855,'id');_0x5a5c7=_[_0x8059('0xa0')](_0x5a5c7,{'model':db[_0x8059('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2980cb[_0x8059('0x41')][_0x8059('0x46')]){_0x5362b5['attributes'][_0x8059('0x6d')](function(_0xdb578){_0x21ceef['field']('i.'+_0xdb578);});}else{_0x21ceef[_0x8059('0x4b')](_0x8059('0x8d'),_0x8059('0x8e'));_0x21ceef[_0x8059('0x4b')](_0x8059('0xa1'),'Account.key');_0x21ceef[_0x8059('0x4b')](_0x8059('0xa2'),_0x8059('0xa3'));_0x21ceef[_0x8059('0x4b')]('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',_0x8059('0x90'));_0x21ceef[_0x8059('0x4b')](_0x8059('0xa4'));_0x21ceef[_0x8059('0x4b')](_0x8059('0xa5'),_0x8059('0xa6'));_0x21ceef[_0x8059('0x4b')](_0x8059('0xa7'),_0x8059('0xa8'));_0x21ceef[_0x8059('0x4b')]('c.email',_0x8059('0xa9'));_0x21ceef[_0x8059('0x4b')](_0x8059('0xaa'),_0x8059('0xab'));_0x21ceef[_0x8059('0x4b')](_0x8059('0xac'),_0x8059('0xad'));_0x21ceef[_0x8059('0x4b')](_0x8059('0xae'),_0x8059('0xaf'));_0x21ceef['field'](_0x8059('0xb0'),_0x8059('0xb1'));_0x21ceef[_0x8059('0x4b')](_0x8059('0xb2'),_0x8059('0xb3'));_0x21ceef[_0x8059('0x4b')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5362b5[_0x8059('0x29')])_0x21ceef['limit'](_0x5362b5['limit']);if(_0x5362b5['offset'])_0x21ceef[_0x8059('0x28')](_0x5362b5[_0x8059('0x28')]);return db[_0x8059('0x9d')][_0x8059('0x41')](_0x21ceef['toString'](),_0x5a5c7);})[_0x8059('0x2f')](function(_0x3fbf03){_0x20caa3[_0x8059('0x7a')](_0x8059('0xb4'),_[_0x8059('0x3a')](_0x3fbf03,'id'));return db[_0x8059('0x9d')]['query'](_0x20caa3[_0x8059('0x9e')](),_0x5a5c7)[_0x8059('0x2f')](function(_0x3aa43b){var _0x111e96=_[_0x8059('0xb5')](_0x3aa43b,_0x8059('0xb6'));var _0x3e2fec=[];_0x3fbf03[_0x8059('0x6d')](function(_0x15a50f){_0x3e2fec[_0x8059('0x38')](updateChatInteraction(_0x15a50f,_0x584e13,_0x111e96));});return BPromise[_0x8059('0xb7')](_0x3e2fec);});});})[_0x8059('0x2f')](function(_0xa088b){_0x38c320[_0x8059('0xb8')]=_0xa088b;return _0x38c320;})['then'](respondWithFilteredResult(_0x12c5fa,_0x5362b5))[_0x8059('0x23')](handleError(_0x12c5fa,null));};exports[_0x8059('0xb9')]=function(_0x247c9f,_0x1c1b32){var _0x5aaff4={'raw':![],'where':{'id':_0x247c9f['params']['id']}},_0x58d66f={};_0x58d66f['model']=_[_0x8059('0x42')](db[_0x8059('0x3b')][_0x8059('0x3c')]);_0x58d66f[_0x8059('0x41')]=_[_0x8059('0x42')](_0x247c9f[_0x8059('0x41')]);_0x58d66f[_0x8059('0x43')]=_[_0x8059('0x44')](_0x58d66f[_0x8059('0x40')],_0x58d66f[_0x8059('0x41')]);_0x5aaff4[_0x8059('0x45')]=_[_0x8059('0x44')](_0x58d66f['model'],qs[_0x8059('0x46')](_0x247c9f[_0x8059('0x41')][_0x8059('0x46')]));_0x5aaff4[_0x8059('0x45')]=_0x5aaff4['attributes'][_0x8059('0x5d')]?_0x5aaff4[_0x8059('0x45')]:_0x58d66f['model'];if(_0x247c9f[_0x8059('0x41')]['includeAll']){_0x5aaff4[_0x8059('0xba')]=[{'all':!![]}];}_0x5aaff4=_[_0x8059('0xa0')]({},_0x5aaff4,_0x247c9f[_0x8059('0xbb')]);return db[_0x8059('0x3b')][_0x8059('0x5f')](_0x5aaff4)[_0x8059('0x2f')](handleEntityNotFound(_0x1c1b32,null))[_0x8059('0x2f')](respondWithResult(_0x1c1b32,null))[_0x8059('0x23')](handleError(_0x1c1b32,null));};exports[_0x8059('0xbc')]=function(_0x267dd9,_0x2dfb03){return db[_0x8059('0x3b')][_0x8059('0xbc')](_0x267dd9[_0x8059('0x72')],{})[_0x8059('0x2f')](respondWithResult(_0x2dfb03,0xc9))['catch'](handleError(_0x2dfb03,null));};exports[_0x8059('0x2e')]=function(_0x597a10,_0x396e77){if(_0x597a10[_0x8059('0x72')]['id']){delete _0x597a10[_0x8059('0x72')]['id'];}return db[_0x8059('0x3b')]['find']({'where':{'id':_0x597a10[_0x8059('0xbd')]['id']}})[_0x8059('0x2f')](handleEntityNotFound(_0x396e77,null))['then'](saveUpdates(_0x597a10['body'],null))[_0x8059('0x2f')](respondWithResult(_0x396e77,null))['catch'](handleError(_0x396e77,null));};exports[_0x8059('0x30')]=function(_0x924189,_0x3464fa){return db[_0x8059('0x3b')][_0x8059('0x5f')]({'where':{'id':_0x924189['params']['id']}})['then'](handleEntityNotFound(_0x3464fa,null))['then'](removeEntity(_0x3464fa,null))['catch'](handleError(_0x3464fa,null));};exports[_0x8059('0xbe')]=function(_0x30fa8e,_0x3741b9){return db['ChatInteraction'][_0x8059('0xbe')]()[_0x8059('0x2f')](respondWithResult(_0x3741b9,null))[_0x8059('0x23')](handleError(_0x3741b9,null));};exports[_0x8059('0xbf')]=function(_0x39dd43,_0x57633f){var _0x4dec29=_0x39dd43['params']['id'];var _0x13f867;var _0xe6758c;var _0x11b71b;return db[_0x8059('0x3b')]['findOne']({'where':{'id':_0x4dec29}})['then'](function(_0x5282b2){_0x13f867=_0x5282b2;return db[_0x8059('0xc0')][_0x8059('0xc1')]({'where':{'id':_0x5282b2['ChatWebsiteId']},'attributes':['id',_0x8059('0xc2'),_0x8059('0xc3')],'raw':!![]});})[_0x8059('0x2f')](function(_0x21fc4b){if(_0x21fc4b&&_0x21fc4b['vidaooApiKey']&&_0x21fc4b[_0x8059('0xc3')]){_0xe6758c=_0x21fc4b;var _0x2823d7={'rejectUnauthorized':![],'method':_0x8059('0xc4'),'uri':_0x8059('0xc5'),'headers':{'X-APIKEY':_0x21fc4b[_0x8059('0xc2')]},'body':{'name':_0x8059('0xc6')+_0x4dec29},'redirect':_0x8059('0xc7'),'json':!![]};return rp(_0x2823d7);}else{throw new db[(_0x8059('0x89'))][(_0x8059('0xc8'))](_0x8059('0xc9'));}})[_0x8059('0x2f')](function(_0x1e5ff8){_0x11b71b=_0x1e5ff8;if(_0x11b71b['id']){var _0x28ed70={'body':_0x11b71b['join_url'],'ChatWebsiteId':_0xe6758c['id'],'ChatInteractionId':_0x13f867['id'],'direction':'out','UserId':_0x39dd43['user']['id']};return db[_0x8059('0xca')][_0x8059('0xbc')](_0x28ed70,{});}else{throw new db[(_0x8059('0x89'))][(_0x8059('0xc8'))](_0x8059('0xcb'));}})[_0x8059('0x2f')](function(){return _0x13f867[_0x8059('0xcc')]({'vidaooSessionId':_0x11b71b['id']});})[_0x8059('0x2f')](respondWithResult(_0x57633f,null))[_0x8059('0x23')](handleError(_0x57633f,null));};exports[_0x8059('0xcd')]=function(_0x3819b8,_0x5aceac){if(_0x3819b8['body']['id']){delete _0x3819b8[_0x8059('0x72')]['id'];}return db['ChatInteraction'][_0x8059('0x5f')]({'where':{'id':_0x3819b8[_0x8059('0xbd')]['id']}})[_0x8059('0x2f')](handleEntityNotFound(_0x5aceac,null))[_0x8059('0x2f')](saveUpdates(_0x3819b8[_0x8059('0x72')],null))[_0x8059('0x2f')](respondWithResult(_0x5aceac,null))['catch'](handleError(_0x5aceac,null));};exports[_0x8059('0xce')]=function(_0x109e26,_0x373d0b,_0x3a5e9a){if(_0x109e26[_0x8059('0x72')]['id']){delete _0x109e26[_0x8059('0x72')]['id'];}return db[_0x8059('0x3b')][_0x8059('0x5f')]({'where':{'id':_0x109e26[_0x8059('0xbd')]['id']}})[_0x8059('0x2f')](function(_0xe04499){if(!_0xe04499){logger[_0x8059('0x20')](_0x8059('0xcf'),_0x8059('0xce'),0x194,'entity\x20not\x20found');_0x373d0b[_0x8059('0x31')](0x194);}else{if(_0xe04499['UserId']){throw new db['Sequelize']['ValidationError'](_0x8059('0xd0'));}}return _0xe04499;})['then'](function(_0x34d821){if(_0x34d821){return _0x34d821['update']({'closed':_0x109e26[_0x8059('0x72')][_0x8059('0xd1')],'disposition':_0x109e26[_0x8059('0x72')][_0x8059('0xd2')]})[_0x8059('0x2f')](function(_0x457e49){return _0x457e49;});}})[_0x8059('0x2f')](function(_0x5217ab){return respondWithRpcPromise(_0x8059('0xd3'),'abandon',_0x109e26['body'],client9004);})['then'](respondWithResult(_0x373d0b,null))['catch'](handleError(_0x373d0b,null));};exports[_0x8059('0xd4')]=function(_0x417ba6,_0xeb9f3a,_0x3b3cfe){_0x417ba6[_0x8059('0x72')][_0x8059('0x33')]=_0x417ba6['file'][_0x8059('0xd5')];_0x417ba6[_0x8059('0x72')][_0x8059('0xd6')]=_0x417ba6[_0x8059('0xd7')][_0x8059('0xd8')];_0x417ba6[_0x8059('0x72')]['type']=_0x417ba6[_0x8059('0xd7')][_0x8059('0xd9')];return db['Attachment'][_0x8059('0xbc')](_0x417ba6[_0x8059('0x72')])[_0x8059('0x2f')](respondWithResult(_0xeb9f3a,0xc9))[_0x8059('0x23')](handleError(_0xeb9f3a,null));};exports[_0x8059('0xda')]=function(_0x53bf3d,_0x35cbf0,_0x5f1f){return db[_0x8059('0x3b')][_0x8059('0xc1')]({'where':{'id':_0x53bf3d['params']['id']},'raw':!![]})[_0x8059('0x2f')](handleEntityNotFound(_0x35cbf0,null))[_0x8059('0x2f')](function(_0x556e15){if(_0x556e15){if(_0x556e15[_0x8059('0xd1')]){return _0x35cbf0[_0x8059('0x24')](0x193)[_0x8059('0x26')]({'status':0x193,'message':'Unauthorized'});}return db[_0x8059('0xdb')]['findOne']({'where':{'id':_0x53bf3d[_0x8059('0x41')][_0x8059('0xdc')]},'raw':!![]})[_0x8059('0x2f')](handleEntityNotFound(_0x35cbf0,null));}})[_0x8059('0x2f')](function(_0x3d8049){if(_0x3d8049){return _0x35cbf0['download'](path[_0x8059('0xdd')](config['root'],_0x8059('0xde'),_0x3d8049[_0x8059('0xd6')]));}})[_0x8059('0x23')](handleError(_0x35cbf0,null));};exports[_0x8059('0xdf')]=function(_0x381b38,_0x4ce086){var _0x258479=null;var _0x48cf24=null;var _0x54a4f1=null;var _0x49fa00=null;if(_0x381b38[_0x8059('0x72')]['id']){delete _0x381b38[_0x8059('0x72')]['id'];}if(_0x381b38[_0x8059('0x72')]['mailTranscript']){_0x49fa00=path['join'](config[_0x8059('0xe0')],'server/files/chat/upload/',util['format'](_0x8059('0xe1'),Date['now']()));_0x381b38[_0x8059('0x72')][_0x8059('0xe2')]=_0x49fa00;}return db[_0x8059('0x3b')][_0x8059('0x5f')]({'where':{'id':_0x381b38[_0x8059('0xbd')]['id']},'include':[{'model':db[_0x8059('0xca')],'as':_0x8059('0xe3'),'include':[{'model':db[_0x8059('0x6f')],'as':_0x8059('0x6f')}]}]})[_0x8059('0x2f')](handleEntityNotFound(_0x4ce086,null))[_0x8059('0x2f')](saveUpdates(_0x381b38[_0x8059('0x72')],null))['then'](function(_0x9e0b23){if(_0x9e0b23){_0x258479=_0x9e0b23;return db[_0x8059('0xc0')]['find']({'where':{'id':_0x258479[_0x8059('0x75')]}});}})[_0x8059('0x2f')](function(_0x5ad5ea){if(_0x5ad5ea){_0x54a4f1=_0x5ad5ea;return db['CmContact'][_0x8059('0x5f')]({'where':{'id':_0x258479[_0x8059('0x68')]}});}})[_0x8059('0x2f')](function(_0x279857){if(_0x279857){_0x48cf24=_0x279857;if(_0x49fa00){var _0x2acfe3=null;for(var _0xdde277=0x1;_0xdde277<_0x258479['Messages']['length'];++_0xdde277){_0x2acfe3=_0x258479[_0x8059('0xe3')][_0xdde277];var _0x72fd77=_0x2acfe3[_0x8059('0x71')]?util[_0x8059('0xe4')](_0x8059('0xe5'),_0x54a4f1[_0x8059('0xe6')],_0x2acfe3[_0x8059('0x71')]):_0x8059('0xe7');var _0x4ae806=_0x381b38[_0x8059('0x72')][_0x8059('0xe8')]||util['format'](_0x8059('0xe5'),_0x8059('0xe9'),_0x2acfe3[_0x8059('0x68')]);switch(_0x54a4f1[_0x8059('0xea')]){case _0x8059('0xeb'):_0x72fd77=_0x2acfe3[_0x8059('0x71')]?util['format'](_0x8059('0xe5'),_0x54a4f1['agentAlias'],_0x2acfe3[_0x8059('0x71')]):_0x8059('0xe7');break;case _0x8059('0xec'):_0x72fd77=_0x2acfe3[_0x8059('0x71')]?_0x2acfe3[_0x8059('0x6f')][_0x8059('0xed')]||_0x2acfe3[_0x8059('0x6f')][_0x8059('0xee')]:_0x8059('0xe7');break;case _0x8059('0xef'):_0x72fd77=_0x2acfe3[_0x8059('0x71')]?_0x2acfe3[_0x8059('0x6f')][_0x8059('0xee')]:'System';break;default:_0x72fd77=_0x2acfe3[_0x8059('0x71')]?util['format'](_0x8059('0xe5'),_0x54a4f1['agentAlias'],_0x2acfe3[_0x8059('0x71')]):_0x8059('0xe7');}var _0x4250c0=util[_0x8059('0xe4')]('[%s]\x20%s:\x20%s\x0a',moment(_0x2acfe3[_0x8059('0xf0')])[_0x8059('0xe4')](_0x8059('0xf1')),_0x2acfe3['direction']==='in'?_0x4ae806:_0x72fd77,_0x2acfe3[_0x8059('0x72')]);if(!_0x2acfe3['secret']){fs['appendFileSync'](_0x49fa00,_0x4250c0);}}return db['MailAccount'][_0x8059('0xc1')]({'where':{'service':!![]},'include':[{'model':db[_0x8059('0xf2')],'as':_0x8059('0xf3'),'raw':!![]}]});}}})['then'](function(_0x4b8496){if(_0x4b8496&&_0x4b8496[_0x8059('0xf3')]&&_0x381b38['body']){var _0x2d213b={'tls':{'rejectUnauthorized':![]}};if(_0x4b8496[_0x8059('0xf3')][_0x8059('0xf4')]){_0x2d213b[_0x8059('0xf4')]=_0x4b8496[_0x8059('0xf3')][_0x8059('0xf4')];}else{_0x2d213b['host']=_0x4b8496[_0x8059('0xf3')][_0x8059('0xf5')];_0x2d213b[_0x8059('0xf6')]=_0x4b8496[_0x8059('0xf3')]['port'];_0x2d213b[_0x8059('0xf7')]=_0x4b8496[_0x8059('0xf3')][_0x8059('0xf7')];}if(_0x4b8496[_0x8059('0xf3')]['authentication']){_0x2d213b[_0x8059('0xf8')]={'user':_0x4b8496['Smtp'][_0x8059('0x97')],'pass':_0x4b8496[_0x8059('0xf3')]['pass']};}return respondWithRpcPromise(_0x8059('0xf9'),_0x8059('0xfa'),{'account':_0x2d213b,'message':{'from':util[_0x8059('0xe4')](_0x8059('0xfb'),_0x4b8496[_0x8059('0x33')],_0x4b8496[_0x8059('0xfc')]||_0x4b8496[_0x8059('0xf3')][_0x8059('0x97')]),'to':_0x381b38[_0x8059('0x72')][_0x8059('0xfd')],'subject':'Mail\x20Transcript','text':util[_0x8059('0xe4')](_0x8059('0xfe'),_0x381b38[_0x8059('0x72')][_0x8059('0xfd')]),'attachments':[{'path':_0x49fa00}]}})[_0x8059('0x2f')](function(){return _0x258479;})['catch'](function(_0x4198d6){console['error'](_0x4198d6);});}else{return _0x258479;}})['then'](respondWithStatusCode(_0x4ce086,0xc8))['catch'](handleError(_0x4ce086,null));};exports[_0x8059('0xff')]=function(_0x2a863b,_0x173efd,_0x11b68e){return db[_0x8059('0xca')][_0x8059('0x5f')]({'where':{'id':_0x2a863b[_0x8059('0xbd')]['id']}})['then'](handleEntityNotFound(_0x173efd,null))[_0x8059('0x2f')](function(_0x2039b7){if(_0x2039b7){return _0x2039b7[_0x8059('0xff')](_0x2a863b[_0x8059('0x72')][_0x8059('0x100')],_[_0x8059('0x101')](_0x2a863b['body'],[_0x8059('0x100'),'id'])||{});}})[_0x8059('0x2f')](respondWithResult(_0x173efd,null))[_0x8059('0x23')](handleError(_0x173efd,null));};exports[_0x8059('0x102')]=function(_0x20373b,_0x2088d9,_0x3c5599){var _0x59e7e4={'raw':![],'where':{}};var _0x31c971={};var _0x3804d4={'count':0x0,'rows':[]};return db[_0x8059('0x3b')][_0x8059('0xc1')]({'where':{'id':_0x20373b[_0x8059('0xbd')]['id']}})[_0x8059('0x2f')](handleEntityNotFound(_0x2088d9,null))[_0x8059('0x2f')](function(_0x46c19b){if(_0x46c19b){_0x31c971[_0x8059('0x40')]=_[_0x8059('0x42')](db[_0x8059('0xca')][_0x8059('0x3c')]);_0x31c971['query']=_[_0x8059('0x42')](_0x20373b[_0x8059('0x41')]);_0x31c971[_0x8059('0x43')]=_['intersection'](_0x31c971['model'],_0x31c971['query']);_0x59e7e4[_0x8059('0x45')]=_[_0x8059('0x44')](_0x31c971['model'],qs[_0x8059('0x46')](_0x20373b['query'][_0x8059('0x46')]));_0x59e7e4[_0x8059('0x45')]=_0x59e7e4[_0x8059('0x45')][_0x8059('0x5d')]?_0x59e7e4[_0x8059('0x45')]:_0x31c971['model'];if(!_0x20373b['query'][_0x8059('0x47')]('nolimit')){_0x59e7e4[_0x8059('0x29')]=qs[_0x8059('0x29')](_0x20373b[_0x8059('0x41')][_0x8059('0x29')]);_0x59e7e4[_0x8059('0x28')]=qs[_0x8059('0x28')](_0x20373b['query'][_0x8059('0x28')]);}_0x59e7e4[_0x8059('0x8f')]=qs['sort'](_0x20373b[_0x8059('0x41')][_0x8059('0x48')]);_0x59e7e4['where']=qs['filters'](_[_0x8059('0x49')](_0x20373b['query'],_0x31c971[_0x8059('0x43')]));_0x59e7e4[_0x8059('0x7a')][_0x8059('0xb6')]=_0x46c19b['id'];if(_0x20373b[_0x8059('0x41')][_0x8059('0x83')]){_0x59e7e4[_0x8059('0x7a')]=_[_0x8059('0xa0')](_0x59e7e4['where'],{'$or':_['map'](_0x59e7e4[_0x8059('0x45')],function(_0x1462e5){var _0x5a3edb={};_0x5a3edb[_0x1462e5]={'$like':'%'+_0x20373b[_0x8059('0x41')]['filter']+'%'};return _0x5a3edb;})});}if(_0x20373b[_0x8059('0x41')][_0x8059('0x78')]){var _0x281605=_0x20373b[_0x8059('0x41')][_0x8059('0x78')][_0x8059('0x65')](',');var _0x4a923f={};_0x4a923f[_0x281605[0x0]]={'$gte':moment(_0x281605[0x1])['format'](_0x8059('0x103'))};_0x59e7e4['where']=_[_0x8059('0xa0')](_0x59e7e4[_0x8059('0x7a')],_0x4a923f);}_0x59e7e4=_[_0x8059('0xa0')]({},_0x59e7e4,_0x20373b[_0x8059('0xbb')]);return db['ChatMessage']['count']({'where':_0x59e7e4[_0x8059('0x7a')]})[_0x8059('0x2f')](function(_0x3a95f5){_0x3804d4[_0x8059('0x27')]=_0x3a95f5;if(_0x20373b['query']['includeAll']){_0x59e7e4[_0x8059('0xba')]=[{'all':!![]}];}return db[_0x8059('0xca')][_0x8059('0x104')](_0x59e7e4);})['then'](function(_0x3273b7){_0x3804d4[_0x8059('0xb8')]=_0x3273b7;return _0x3804d4;});}})[_0x8059('0x2f')](respondWithFilteredResult(_0x2088d9,_0x59e7e4))[_0x8059('0x23')](handleError(_0x2088d9,null));};exports[_0x8059('0x105')]=function(_0x561503,_0x37ad2d,_0x3334d6){var _0xa006fc={'where':{}},_0x42d9fd={},_0x3462aa={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8059('0xc1')]({'where':{'id':_0x561503[_0x8059('0xbd')]['id']}})[_0x8059('0x2f')](handleEntityNotFound(_0x37ad2d,null))[_0x8059('0x2f')](function(_0x38848c){if(_0x38848c){_0x42d9fd['model']=_[_0x8059('0x42')](db[_0x8059('0xca')][_0x8059('0x3c')]);_0x42d9fd[_0x8059('0x41')]=_[_0x8059('0x42')](_0x561503[_0x8059('0x41')]);_0x42d9fd[_0x8059('0x43')]=_[_0x8059('0x44')](_0x42d9fd[_0x8059('0x40')],_0x42d9fd['query']);_0xa006fc[_0x8059('0x45')]=_[_0x8059('0x44')](_0x42d9fd[_0x8059('0x40')],qs[_0x8059('0x46')](_0x561503[_0x8059('0x41')][_0x8059('0x46')]));_0xa006fc[_0x8059('0x45')]=_0xa006fc[_0x8059('0x45')][_0x8059('0x5d')]?_0xa006fc[_0x8059('0x45')]:_0x42d9fd[_0x8059('0x40')];if(!_0x561503[_0x8059('0x41')][_0x8059('0x47')](_0x8059('0x106'))){_0xa006fc[_0x8059('0x29')]=qs[_0x8059('0x29')](_0x561503['query']['limit']);_0xa006fc[_0x8059('0x28')]=qs['offset'](_0x561503[_0x8059('0x41')][_0x8059('0x28')]);}_0xa006fc['order']=qs[_0x8059('0x48')](_0x561503[_0x8059('0x41')][_0x8059('0x48')]);_0xa006fc['where']=qs[_0x8059('0x43')](_[_0x8059('0x49')](_0x561503[_0x8059('0x41')],_0x42d9fd[_0x8059('0x43')]));_0xa006fc[_0x8059('0x7a')][_0x8059('0xb6')]=_0x38848c['id'];if(_0x561503[_0x8059('0x41')][_0x8059('0x83')]){_0xa006fc['where']=_[_0x8059('0xa0')](_0xa006fc[_0x8059('0x7a')],{'$or':_[_0x8059('0x3a')](_0xa006fc[_0x8059('0x45')],function(_0x5d353a){var _0x43e61e={};_0x43e61e[_0x5d353a]={'$like':'%'+_0x561503['query'][_0x8059('0x83')]+'%'};return _0x43e61e;})});}_0xa006fc[_0x8059('0x7a')][_0x8059('0x107')]=![];if(_0x561503[_0x8059('0x41')]['id']){_0xa006fc[_0x8059('0x7a')]['id']={'$gt':_0x561503[_0x8059('0x41')]['id']};}_0xa006fc=_[_0x8059('0xa0')]({},_0xa006fc,_0x561503[_0x8059('0xbb')]);return db[_0x8059('0xca')]['count']({'where':_0xa006fc['where']})['then'](function(_0x4e4c9c){_0x3462aa[_0x8059('0x27')]=_0x4e4c9c;_0xa006fc['include']=[];if(_0x561503[_0x8059('0x41')][_0x8059('0x108')]){_0xa006fc[_0x8059('0xba')][_0x8059('0x38')]({'model':db[_0x8059('0x6f')],'as':'User','attributes':['id',_0x8059('0xee'),_0x8059('0xed')]});}if(_0x561503['query'][_0x8059('0x109')]){_0xa006fc['include']=[{'all':!![]}];}return db[_0x8059('0xca')]['findAll'](_0xa006fc);})[_0x8059('0x2f')](function(_0x5d1c3a){_0x3462aa[_0x8059('0xb8')]=_0x5d1c3a;return _0x3462aa;});}})[_0x8059('0x2f')](respondWithFilteredResult(_0x37ad2d,_0xa006fc))[_0x8059('0x23')](handleError(_0x37ad2d,null));};exports[_0x8059('0x10a')]=function(_0x371bd7,_0x29782b,_0x5ab520){return db[_0x8059('0x3b')][_0x8059('0x5f')]({'where':{'id':_0x371bd7[_0x8059('0xbd')]['id']}})['then'](handleEntityNotFound(_0x29782b,null))['then'](function(_0x4caca7){if(_0x4caca7){return _0x4caca7[_0x8059('0x10b')](_0x371bd7['body'][_0x8059('0x100')],_[_0x8059('0x101')](_0x371bd7[_0x8059('0x72')],[_0x8059('0x100'),'id'])||{})[_0x8059('0x10c')](function(){return db[_0x8059('0x6c')][_0x8059('0x104')]({'attributes':['id',_0x8059('0x33'),_0x8059('0x10d')],'where':{'id':_0x371bd7[_0x8059('0x72')][_0x8059('0x100')]}});})['then'](function(_0x3f6b10){socket['emit'](_0x8059('0x10e'),{'id':Number(_0x371bd7[_0x8059('0xbd')]['id']),'tags':_0x3f6b10||[]});return{'id':Number(_0x371bd7[_0x8059('0xbd')]['id']),'tags':_0x3f6b10||[]};});}})[_0x8059('0x2f')](respondWithResult(_0x29782b,null))['catch'](handleError(_0x29782b,null));};exports['removeTags']=function(_0x5b9874,_0x2288cb,_0x39741f){return db[_0x8059('0x3b')][_0x8059('0x5f')]({'where':{'id':_0x5b9874[_0x8059('0xbd')]['id']}})[_0x8059('0x2f')](handleEntityNotFound(_0x2288cb,null))[_0x8059('0x2f')](function(_0x2c945f){if(_0x2c945f){return _0x2c945f[_0x8059('0x10f')](_0x5b9874[_0x8059('0x41')]['ids']);}})['then'](respondWithStatusCode(_0x2288cb,null))['catch'](handleError(_0x2288cb,null));};exports[_0x8059('0x110')]=function(_0x1fd4cd,_0x4cf7fa){var _0x2d5f75=moment()[_0x8059('0x111')]()['toString']();var _0x405af0=path['join'](config[_0x8059('0xe0')],_0x8059('0x112'),_0x8059('0x113'),_0x8059('0x114'));var _0x19607d=path['join'](config[_0x8059('0xe0')],_0x8059('0x112'),_0x8059('0x113'),'attachments');var _0xb3101c=path[_0x8059('0xdd')](_0x405af0,_0x2d5f75);var _0x36cc44=util[_0x8059('0xe4')](_0x8059('0x115'),_0x1fd4cd[_0x8059('0xbd')]['id'],_0x2d5f75);var _0x566258=path['join'](_0x405af0,_0x36cc44);var _0x46ddb9=[];_0x46ddb9[_0x8059('0x38')]({'model':db[_0x8059('0x6f')],'as':_0x8059('0x6f'),'attributes':['id','fullname'],'raw':!![]});_0x46ddb9[_0x8059('0x38')]({'model':db[_0x8059('0x116')],'as':_0x8059('0x117'),'attributes':['id','firstName',_0x8059('0x118')],'raw':!![]});if(_0x1fd4cd['query']['attachments']){_0x46ddb9[_0x8059('0x38')]({'model':db[_0x8059('0xdb')],'as':_0x8059('0xdb'),'raw':!![]});}var _0x149088=[{'model':db['ChatMessage'],'as':_0x8059('0xe3'),'attributes':['id','body',_0x8059('0xf0'),'direction',_0x8059('0x107'),_0x8059('0x7f')],'include':_0x46ddb9}];_0x149088[_0x8059('0x38')]({'model':db[_0x8059('0xc0')],'as':_0x8059('0x119'),'attributes':['id','name']});_0x149088['push']({'model':db[_0x8059('0x6f')],'as':_0x8059('0x11a'),'attributes':['id','fullname']});return db[_0x8059('0x3b')][_0x8059('0x5f')]({'where':{'id':_0x1fd4cd[_0x8059('0xbd')]['id']},'include':_0x149088})['then'](handleEntityNotFound(_0x4cf7fa,null))[_0x8059('0x2f')](function(_0x1e5ea4){if(_0x1e5ea4){var _0x4bbf2b=_0x1e5ea4[_0x8059('0x11b')]({'plain':!![]});fs['mkdirSync'](_0xb3101c);var _0x47ab82={'format':'A4','border':_0x8059('0x11c'),'header':{'height':_0x8059('0x11d'),'contents':{'first':_0x8059('0x11e')}},'footer':{'height':_0x8059('0x11f'),'contents':{'default':util['format'](_0x8059('0x120'),util[_0x8059('0xe4')](_0x8059('0x121'),_0x8059('0x122'),_0x4bbf2b['id']),moment()[_0x8059('0xe4')](_0x8059('0x123'))[_0x8059('0x9e')]())}}};var _0x370967={'channel':_0x8059('0x122'),'account':_0x4bbf2b[_0x8059('0x119')][_0x8059('0x33')],'agent':_0x4bbf2b['Owner']?_0x4bbf2b['Owner'][_0x8059('0xee')]:_0x8059('0x124'),'createdAt':moment(_0x4bbf2b['createdAt'])[_0x8059('0xe4')](_0x8059('0x103'))[_0x8059('0x9e')](),'closedAt':_0x4bbf2b[_0x8059('0xd1')]?moment(_0x4bbf2b[_0x8059('0x125')])[_0x8059('0xe4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8059('0x9e')]():'','disposition':_0x4bbf2b[_0x8059('0xd2')],'chatInfo':{'browser':_0x4bbf2b[_0x8059('0x126')],'os':_0x4bbf2b[_0x8059('0x127')],'referer':_0x4bbf2b['referer'],'customerIp':_0x4bbf2b['customerIp'],'customerPort':_0x4bbf2b['customerPort']?_0x4bbf2b[_0x8059('0x128')]:_0x8059('0x124')},'messages':_(_0x4bbf2b[_0x8059('0xe3')])[_0x8059('0x129')]()[_0x8059('0x83')]({'secret':![]})[_0x8059('0x3a')](function(_0x31d300){if(_0x31d300['Attachment']){var _0x1eab02=path[_0x8059('0xdd')](_0x19607d,_0x31d300[_0x8059('0xdb')][_0x8059('0xd6')]);if(fs[_0x8059('0x12a')](_0x1eab02)){fs[_0x8059('0x12b')](_0x1eab02)[_0x8059('0x12c')](fs[_0x8059('0x12d')](path[_0x8059('0xdd')](_0xb3101c,_0x31d300['Attachment'][_0x8059('0xd6')])));}}return{'date':moment(_0x31d300[_0x8059('0xf0')])[_0x8059('0xe4')](_0x8059('0x103'))['toString'](),'sender':_0x31d300[_0x8059('0x12e')]===_0x8059('0x12f')?_0x31d300['User']?_0x31d300[_0x8059('0x6f')][_0x8059('0xee')]:'System':_0x31d300['Contact'][_0x8059('0x130')]+(_0x31d300[_0x8059('0x117')][_0x8059('0x118')]?'\x20'+_0x31d300['Contact'][_0x8059('0x118')]:''),'body':_0x31d300[_0x8059('0xdb')]?_0x31d300[_0x8059('0xdb')][_0x8059('0xd6')]:_0x31d300[_0x8059('0x72')],'direction':_0x31d300[_0x8059('0x12e')]===_0x8059('0x12f')?'A':'C','secret':_0x31d300['secret'],'read':_0x31d300['read'],'attachment':_0x31d300[_0x8059('0xdb')]};})[_0x8059('0x60')]()};return ejs['renderFile'](path[_0x8059('0xdd')](config[_0x8059('0xe0')],_0x8059('0x112'),'views','downloadInteraction.html'),{'interaction':_0x370967})['then'](function(_0x469c93){return new BPromise(function(_0x4ff4fb,_0x548293){pdf[_0x8059('0xbc')](_0x469c93,_0x47ab82)[_0x8059('0x131')](path[_0x8059('0xdd')](_0xb3101c,_0x8059('0x132')+_0x4bbf2b['id']+'-'+_0x2d5f75+_0x8059('0x133')),function(_0x1e36a3,_0xb53796){if(_0x1e36a3)return _0x548293(_0x1e36a3);_0x4ff4fb(_0xb53796);});});})[_0x8059('0x2f')](function(){return new BPromise(function(_0x2b3ae4,_0x58a00c){zipdir(_0xb3101c,{'saveTo':_0x566258},function(_0x1d612c,_0x452145){if(_0x1d612c)return _0x58a00c(_0x1d612c);return _0x2b3ae4(_0x452145);});})['then'](function(){return new BPromise(function(_0x19df7a,_0x138e3a){rimraf(_0xb3101c,function(_0x446b0d){if(_0x446b0d)_0x138e3a(_0x446b0d);return _0x19df7a();});});})[_0x8059('0x2f')](function(){return _0x4cf7fa['download'](_0x566258,_0x36cc44,function(_0x32eba7){if(_0x32eba7){console[_0x8059('0x134')](_0x8059('0x135'),_0x32eba7);}else{fs['unlinkSync'](_0x566258);}});});});}else{return _0x4cf7fa['sendStatus'](0xc8);}})[_0x8059('0x23')](handleError(_0x4cf7fa,null));}; \ No newline at end of file +var _0xc2a2=['Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','includeAll','merge','options','create','update','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','file','originalname','mimetype','Attachment','attachmentDownload','attachId','download','root','server/files/attachments/','basename','close','join','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','System','customer','Visitor','agentAlias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','secret','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','ChatInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','includeAgent','addTags','setTags','spread','emit','removeTags','server','files','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','direction','Account','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Owner','closedAt','browserName','osName','referer','customerPort','N.A.','existsSync','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','desk.js','querystring','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','register','client','http','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','pick','filters','field','color','from','select','u.id','user_has_chat_interactions','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20=\x200','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','ChatWebsiteId','createdAt','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','user','agent','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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.mobile'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0xc2a2,0x84));var _0x2c2a=function(_0x36bf50,_0x4fbf4e){_0x36bf50=_0x36bf50-0x0;var _0x35babc=_0xc2a2[_0x36bf50];return _0x35babc;};'use strict';var pdf=require(_0x2c2a('0x0'));var emlformat=require(_0x2c2a('0x1'));var rimraf=require(_0x2c2a('0x2'));var zipdir=require(_0x2c2a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c2a('0x4'));var moment=require(_0x2c2a('0x5'));var BPromise=require(_0x2c2a('0x6'));var Mustache=require('mustache');var util=require(_0x2c2a('0x7'));var path=require(_0x2c2a('0x8'));var sox=require(_0x2c2a('0x9'));var csv=require(_0x2c2a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c2a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2c2a('0xc'));var Papa=require('papaparse');var Redis=require(_0x2c2a('0xd'));var authService=require(_0x2c2a('0xe'));var qs=require(_0x2c2a('0xf'));var as=require(_0x2c2a('0x10'));var hardwareService=require(_0x2c2a('0x11'));var logger=require(_0x2c2a('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2c2a('0x13'));var licenseUtil=require(_0x2c2a('0x14'));var db=require(_0x2c2a('0x15'))['db'];config[_0x2c2a('0x16')]=_[_0x2c2a('0x17')](config[_0x2c2a('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c2a('0x18'))(new Redis(config[_0x2c2a('0x16')]));require('./chatInteraction.socket')[_0x2c2a('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2c2a('0x1a')]['http']({'port':0x232b});var client9004=jayson[_0x2c2a('0x1a')][_0x2c2a('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x523692,_0x10b98e,_0x1c9a04,_0x250d08){return new BPromise(function(_0x7af854,_0x93d544){var _0x14486f=_0x250d08||client;return _0x14486f['request'](_0x523692,_0x1c9a04)['then'](function(_0x4149e2){logger['info'](_0x2c2a('0x1c'),_0x10b98e,_0x2c2a('0x1d'));logger[_0x2c2a('0x1e')](_0x2c2a('0x1f'),_0x10b98e,_0x2c2a('0x1d'),JSON[_0x2c2a('0x20')](_0x4149e2));if(_0x4149e2[_0x2c2a('0x21')]){if(_0x4149e2[_0x2c2a('0x21')][_0x2c2a('0x22')]===0x1f4){logger[_0x2c2a('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x10b98e,_0x4149e2[_0x2c2a('0x21')]['message']);return _0x93d544(_0x4149e2[_0x2c2a('0x21')][_0x2c2a('0x23')]);}logger['error'](_0x2c2a('0x1c'),_0x10b98e,_0x4149e2[_0x2c2a('0x21')][_0x2c2a('0x23')]);return _0x7af854(_0x4149e2['error'][_0x2c2a('0x23')]);}else{logger[_0x2c2a('0x24')](_0x2c2a('0x1c'),_0x10b98e,_0x2c2a('0x1d'));_0x7af854(_0x4149e2[_0x2c2a('0x25')][_0x2c2a('0x23')]);}})[_0x2c2a('0x26')](function(_0x459aee){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x10b98e,_0x459aee);_0x93d544(_0x459aee);});});}function respondWithStatusCode(_0x5afa5f,_0x5b0530){_0x5b0530=_0x5b0530||0xcc;return function(_0x35f048){if(_0x35f048){return _0x5afa5f[_0x2c2a('0x27')](_0x5b0530);}return _0x5afa5f[_0x2c2a('0x28')](_0x5b0530)[_0x2c2a('0x29')]();};}function respondWithResult(_0x39e3d6,_0x43239d){_0x43239d=_0x43239d||0xc8;return function(_0x51b536){if(_0x51b536){return _0x39e3d6['status'](_0x43239d)[_0x2c2a('0x2a')](_0x51b536);}};}function respondWithFilteredResult(_0x1d907f,_0x10e371){return function(_0x27dc1b){if(_0x27dc1b){var _0x5c2fbb=_0x27dc1b[_0x2c2a('0x2b')],_0xe8bd4b=_0x10e371[_0x2c2a('0x2c')],_0x735b1b=_0x10e371[_0x2c2a('0x2c')]+_0x10e371[_0x2c2a('0x2d')],_0x134a64;if(_0x735b1b>=_0x5c2fbb){_0x735b1b=_0x5c2fbb;_0x134a64=0xc8;}else{_0x134a64=0xce;}_0x1d907f[_0x2c2a('0x28')](_0x134a64);return _0x1d907f[_0x2c2a('0x2e')](_0x2c2a('0x2f'),_0xe8bd4b+'-'+_0x735b1b+'/'+_0x5c2fbb)[_0x2c2a('0x2a')](_0x27dc1b);}return null;};}function patchUpdates(_0x19a2f6){return function(_0x3fa5e7){try{jsonpatch[_0x2c2a('0x30')](_0x3fa5e7,_0x19a2f6,!![]);}catch(_0x570152){return BPromise[_0x2c2a('0x31')](_0x570152);}return _0x3fa5e7[_0x2c2a('0x32')]();};}function saveUpdates(_0x19b86f,_0x42db35){return function(_0x10f66f){if(_0x10f66f){return _0x10f66f['update'](_0x19b86f)[_0x2c2a('0x33')](function(_0x307c07){return _0x307c07;});}return null;};}function removeEntity(_0x51536b,_0x1c734c){return function(_0x4d94f2){if(_0x4d94f2){return _0x4d94f2[_0x2c2a('0x34')]()[_0x2c2a('0x33')](function(){_0x51536b[_0x2c2a('0x28')](0xcc)[_0x2c2a('0x29')]();});}};}function handleEntityNotFound(_0x1d3152,_0x39d341){return function(_0x3ff77b){if(!_0x3ff77b){_0x1d3152['sendStatus'](0x194);}return _0x3ff77b;};}function handleError(_0x3e9678,_0x385a19){_0x385a19=_0x385a19||0x1f4;return function(_0x231a98){logger['error'](_0x231a98['stack']);if(_0x231a98[_0x2c2a('0x35')]){delete _0x231a98['name'];}_0x3e9678[_0x2c2a('0x28')](_0x385a19)[_0x2c2a('0x36')](_0x231a98);};}function getInteractionUsers(_0x126730,_0x3e6b12){return new BPromise(function(_0x223302,_0x4e4130){try{if(_0x3e6b12[_0x126730['id']]){_0x126730[_0x2c2a('0x37')]=_[_0x2c2a('0x38')](_0x3e6b12[_0x126730['id']],function(_0x439aad){return{'id':_0x439aad['id'],'fullname':_0x439aad[_0x2c2a('0x39')]};});}}catch(_0x38e289){_0x4e4130(_0x38e289);}_0x223302(_0x126730);});}function getInteractionTags(_0x25eec5,_0x10452e){return new BPromise(function(_0x3adb1f,_0x2e7061){try{if(_0x25eec5[_0x2c2a('0x3a')]){_0x25eec5['Tags']=[];_0x25eec5['TagIds'][_0x2c2a('0x3b')](',')[_0x2c2a('0x3c')](function(_0x3c38ed){_0x25eec5[_0x2c2a('0x3d')][_0x2c2a('0x3e')](_0x10452e[_0x3c38ed]);});}delete _0x25eec5[_0x2c2a('0x3a')];}catch(_0x5d4fc4){_0x2e7061(_0x5d4fc4);}_0x3adb1f(_0x25eec5);});}function updateChatInteraction(_0x57e2a4,_0x46928,_0x8eadc3){return new BPromise(function(_0x2589b9,_0x42d135){return getInteractionUsers(_0x57e2a4,_0x8eadc3)[_0x2c2a('0x33')](function(_0x178269){return getInteractionTags(_0x178269,_0x46928);})[_0x2c2a('0x33')](function(_0x1b9ab3){_0x2589b9(_0x1b9ab3);})[_0x2c2a('0x26')](function(_0xa05230){_0x42d135(_0xa05230);});});}exports['index']=function(_0x87a74,_0x5ab83d){var _0x349f9b={},_0x3e339f={},_0x3d6ba6={'count':0x0,'rows':[]};var _0x381b6d=_['map'](db[_0x2c2a('0x3f')][_0x2c2a('0x40')],function(_0x5706f2){return{'name':_0x5706f2[_0x2c2a('0x41')],'type':_0x5706f2[_0x2c2a('0x42')][_0x2c2a('0x43')]};});_0x3e339f[_0x2c2a('0x44')]=_[_0x2c2a('0x38')](_0x381b6d,_0x2c2a('0x35'));_0x3e339f[_0x2c2a('0x45')]=_[_0x2c2a('0x46')](_0x87a74['query']);_0x3e339f['filters']=_[_0x2c2a('0x47')](_0x3e339f['model'],_0x3e339f[_0x2c2a('0x45')]);_0x349f9b['attributes']=_[_0x2c2a('0x47')](_0x3e339f['model'],qs[_0x2c2a('0x48')](_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x48')]));_0x349f9b[_0x2c2a('0x49')]=_0x349f9b['attributes']['length']?_0x349f9b[_0x2c2a('0x49')]:_0x3e339f['model'];if(!_0x87a74[_0x2c2a('0x45')]['hasOwnProperty'](_0x2c2a('0x4a'))){_0x349f9b[_0x2c2a('0x2d')]=qs['limit'](_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x2d')]);_0x349f9b['offset']=qs['offset'](_0x87a74[_0x2c2a('0x45')]['offset']);}_0x349f9b[_0x2c2a('0x4b')]=qs[_0x2c2a('0x4c')](_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x4c')]);_0x349f9b['where']=qs['filters'](_[_0x2c2a('0x4d')](_0x87a74[_0x2c2a('0x45')],_0x3e339f[_0x2c2a('0x4e')]),_0x381b6d);var _0x2030b7=[];var _0x5370cc=squel['select']()[_0x2c2a('0x4f')]('id')['field'](_0x2c2a('0x35'))['field'](_0x2c2a('0x50'))[_0x2c2a('0x51')]('tools_tags');var _0x4e2602=squel[_0x2c2a('0x52')]()[_0x2c2a('0x4f')](_0x2c2a('0x53'))[_0x2c2a('0x4f')]('u.fullname')[_0x2c2a('0x4f')]('ui.ChatInteractionId')[_0x2c2a('0x51')](_0x2c2a('0x54'),'ui')['left_join']('users','u',_0x2c2a('0x55'));var _0x3b3dec=squel[_0x2c2a('0x52')]()[_0x2c2a('0x51')](_0x2c2a('0x56'),'i')[_0x2c2a('0x57')](_0x2c2a('0x58'),'c',_0x2c2a('0x59'))['left_join'](_0x2c2a('0x5a'),'o',_0x2c2a('0x5b'))['left_join'](_0x2c2a('0x5c'),'a',_0x2c2a('0x5d'))[_0x2c2a('0x57')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')['left_join'](_0x2c2a('0x5e'),'it',_0x2c2a('0x5f'))[_0x2c2a('0x57')](_0x2c2a('0x60'),'t','t.id\x20=\x20it.TagId');var _0x1702d2=squel[_0x2c2a('0x61')]();var _0x15c1af=[];var _0x4f1bed=squel[_0x2c2a('0x61')]();var _0x5eca2d;if(_0x87a74['query'][_0x2c2a('0x62')]){_0x5eca2d=as[_0x2c2a('0x63')](_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x62')]);var _0x157967=_0x5eca2d[_0x2c2a('0x64')];for(var _0x5b65be=0x0;_0x5b65be<_0x5eca2d[_0x2c2a('0x65')][_0x2c2a('0x66')];_0x5b65be++){var _0x106de3=_0x5eca2d[_0x2c2a('0x65')][_0x5b65be];var _0x3b243f='i';var _0x2f2529=_[_0x2c2a('0x67')](_0x381b6d,[_0x2c2a('0x35'),_0x106de3[_0x2c2a('0x4f')]]);if(!_0x2f2529){switch(_0x106de3[_0x2c2a('0x4f')]){case _0x2c2a('0x68'):if(_0x106de3['value']==0x1){_0x3b3dec[_0x2c2a('0x69')]('`'+_0x106de3['field']+_0x2c2a('0x6a'));}else{_0x3b3dec[_0x2c2a('0x69')]('`'+_0x106de3[_0x2c2a('0x4f')]+'`\x20>\x200');}break;case'Contact':if(_0x106de3['operator']===_0x2c2a('0x6b')){if(_0x106de3[_0x2c2a('0x6c')]['split']('\x20')[_0x2c2a('0x66')]>0x1){_0x1702d2[_0x157967](_0x2c2a('0x6d'),qs['getFullTextValue'](_0x106de3['value']),null);}else{var _0x38087e='%'+_0x106de3['value']+'%';_0x1702d2[_0x157967]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x38087e,_0x38087e,_0x38087e);}}else{_0x2f2529=_['find'](_0x381b6d,[_0x2c2a('0x35'),_0x2c2a('0x6e')]);_0x106de3['field']=_0x2c2a('0x6e');_0x3097af=as[_0x2c2a('0x6f')](_0x3b243f,_0x2f2529[_0x2c2a('0x42')],_0x106de3);_0x1702d2[_0x157967](_0x3097af[_0x2c2a('0x70')],_0x3097af['value'][_0x2c2a('0x71')],_0x3097af['value']['end']);}break;case _0x2c2a('0x72'):var _0x503821=_0x106de3[_0x2c2a('0x6c')][_0x2c2a('0x3b')](',')[_0x2c2a('0x38')](function(_0x120770){return Number(_0x120770);});_0x503821[_0x2c2a('0x3c')](function(_0x2b4032){_0x4f1bed['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2b4032+',%');});_0x15c1af=_[_0x2c2a('0x73')](_0x15c1af,_0x503821);break;case _0x2c2a('0x74'):if(_0x106de3['operator']===_0x2c2a('0x6b')){_0x1702d2[_0x157967](_0x2c2a('0x75'),'%'+_0x106de3[_0x2c2a('0x6c')]+'%',null);}else{_0x2f2529=_[_0x2c2a('0x67')](_0x381b6d,[_0x2c2a('0x35'),_0x2c2a('0x76')]);_0x106de3[_0x2c2a('0x4f')]='UserId';_0x3097af=as[_0x2c2a('0x6f')](_0x3b243f,_0x2f2529[_0x2c2a('0x42')],_0x106de3);_0x1702d2[_0x157967](_0x3097af['text'],_0x3097af['value'][_0x2c2a('0x71')],_0x3097af[_0x2c2a('0x6c')][_0x2c2a('0x29')]);}break;case _0x2c2a('0x77'):_0x3097af=as[_0x2c2a('0x6f')]('me',null,_0x106de3);_0x1702d2[_0x157967](_0x3097af['text'],_0x3097af[_0x2c2a('0x6c')][_0x2c2a('0x71')],_0x3097af['value'][_0x2c2a('0x29')]);break;}}else{var _0x3097af=as[_0x2c2a('0x6f')](_0x3b243f,_0x2f2529[_0x2c2a('0x42')],_0x106de3);_0x1702d2[_0x157967](_0x3097af['text'],_0x3097af[_0x2c2a('0x6c')][_0x2c2a('0x71')],_0x3097af['value'][_0x2c2a('0x29')]);}}}else{var _0x16dbc3=_(_0x87a74['query'])[_0x2c2a('0x46')]()[_0x2c2a('0x38')](function(_0x484165){return _['some'](_0x381b6d,[_0x2c2a('0x35'),_0x484165])?_0x484165:undefined;})[_0x2c2a('0x78')]()[_0x2c2a('0x6c')]();if(!_[_0x2c2a('0x79')](_0x16dbc3)){_0x16dbc3[_0x2c2a('0x3c')](function(_0x4d01a6){if(_0x4d01a6===_0x2c2a('0x7a')){_0x3b3dec['where']('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x87a74['query'][_0x4d01a6]));}else if(_0x4d01a6===_0x2c2a('0x7b')){var _0x1a1725=JSON[_0x2c2a('0x7c')](_0x87a74[_0x2c2a('0x45')][_0x4d01a6])['$gte'];var _0x3acb44=JSON[_0x2c2a('0x7c')](_0x87a74[_0x2c2a('0x45')][_0x4d01a6])[_0x2c2a('0x7d')];_0x3b3dec[_0x2c2a('0x7e')](_0x2c2a('0x7f'),_0x1a1725,_0x3acb44);}else{if(_0x87a74[_0x2c2a('0x45')][_0x4d01a6]===_0x2c2a('0x80')){_0x3b3dec[_0x2c2a('0x7e')]('i.'+_0x4d01a6+'\x20IS\x20NULL');}else{_0x3b3dec['where']('i.'+_0x4d01a6+_0x2c2a('0x81'),_0x87a74[_0x2c2a('0x45')][_0x4d01a6]);}}});}if(_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x82')]){if(_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x82')]==0x1){_0x3b3dec[_0x2c2a('0x69')](_0x2c2a('0x83'));}else{_0x3b3dec[_0x2c2a('0x69')](_0x2c2a('0x84'));}}if(_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x85')]){_0x15c1af=_['isArray'](_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x85')])?_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x85')]:new Array(_0x87a74['query'][_0x2c2a('0x85')]);_0x15c1af[_0x2c2a('0x3c')](function(_0x40aefe){_0x4f1bed['or'](_0x2c2a('0x86'),'%,'+_0x40aefe+',%');});}if(_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x87')]){var _0x37440a=_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x87')]['replace']('\x5c','\x5c\x5c')[_0x2c2a('0x88')](/'/g,'\x27\x27');if(qs[_0x2c2a('0x89')](_0x37440a)){_0x1702d2['or']('i.id\x20LIKE\x20?',_0x37440a+'%');}else{_0x1702d2['or'](_0x2c2a('0x8a'),qs[_0x2c2a('0x8b')](_0x37440a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x37440a+'%');}}}_0x3b3dec[_0x2c2a('0x7e')](_0x1702d2);_0x3b3dec['group'](_0x2c2a('0x8c'));var _0x2ce170={'type':db[_0x2c2a('0x8d')][_0x2c2a('0x8e')]['SELECT'],'raw':!![]};var _0x135250=_0x3b3dec[_0x2c2a('0x8f')]();_0x135250['field']('i.id');_0x135250[_0x2c2a('0x4f')](_0x2c2a('0x90'),_0x2c2a('0x68'));if(_0x349f9b['order']){_0x349f9b[_0x2c2a('0x4b')][_0x2c2a('0x3c')](function(_0x92f953){var _0x56cc77=_0x92f953[0x0]===_0x2c2a('0x91')?_0x92f953[0x0]:'i.'+_0x92f953[0x0];_0x3b3dec[_0x2c2a('0x4b')](_0x56cc77,_0x92f953[0x1]===_0x2c2a('0x92')?![]:!![]);});}if(!_[_0x2c2a('0x79')](_0x15c1af)){_0x3b3dec['having'](_0x4f1bed);_0x135250[_0x2c2a('0x7e')](_0x2c2a('0x93'),_0x15c1af);}BPromise[_0x2c2a('0x94')]()[_0x2c2a('0x33')](function(){if(!_0x5eca2d){if(_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x7a')]||_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x95')])return;_0x135250[_0x2c2a('0x7e')](_0x2c2a('0x96'));_0x3b3dec['where'](_0x2c2a('0x96'));return;}if(_0x87a74['user'][_0x2c2a('0x97')]!=='agent')return;return _0x87a74['user'][_0x2c2a('0x98')]({'attributes':['id'],'raw':!![]})[_0x2c2a('0x33')](function(_0x41bc3b){if(_['isEmpty'](_0x41bc3b)){_0x135250[_0x2c2a('0x7e')](_0x2c2a('0x99'));_0x3b3dec[_0x2c2a('0x7e')](_0x2c2a('0x99'));}else{_0x135250[_0x2c2a('0x7e')](_0x2c2a('0x9a'),_[_0x2c2a('0x38')](_0x41bc3b,'id'));_0x3b3dec[_0x2c2a('0x7e')]('i.ChatWebsiteId\x20IN\x20?',_[_0x2c2a('0x38')](_0x41bc3b,'id'));}});})[_0x2c2a('0x33')](function(){if(_0x87a74[_0x2c2a('0x9b')][_0x2c2a('0x97')]===_0x2c2a('0x9c')&&!_0x5eca2d&&!_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x7a')])return[];return db[_0x2c2a('0x9d')][_0x2c2a('0x45')](_0x135250['toString'](),_0x2ce170);})[_0x2c2a('0x33')](function(_0x2d63c2){_0x3d6ba6[_0x2c2a('0x2b')]=_0x2d63c2[_0x2c2a('0x66')];if(_0x3d6ba6[_0x2c2a('0x2b')]===0x0)return[];return db[_0x2c2a('0x9d')][_0x2c2a('0x45')](_0x5370cc[_0x2c2a('0x9e')](),_0x2ce170)['then'](function(_0x7d7d53){_0x2030b7=_[_0x2c2a('0x9f')](_0x7d7d53,'id');_0x2ce170=_['merge'](_0x2ce170,{'model':db[_0x2c2a('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87a74[_0x2c2a('0x45')][_0x2c2a('0x48')]){_0x349f9b[_0x2c2a('0x49')][_0x2c2a('0x3c')](function(_0x3c23e6){_0x3b3dec[_0x2c2a('0x4f')]('i.'+_0x3c23e6);});}else{_0x3b3dec['field'](_0x2c2a('0x90'),_0x2c2a('0x68'));_0x3b3dec[_0x2c2a('0x4f')](_0x2c2a('0xa0'),_0x2c2a('0xa1'));_0x3b3dec[_0x2c2a('0x4f')]('a.mandatoryDisposition',_0x2c2a('0xa2'));_0x3b3dec[_0x2c2a('0x4f')](_0x2c2a('0xa3'),_0x2c2a('0x91'));_0x3b3dec[_0x2c2a('0x4f')](_0x2c2a('0xa4'));_0x3b3dec['field'](_0x2c2a('0xa5'),_0x2c2a('0xa6'));_0x3b3dec[_0x2c2a('0x4f')](_0x2c2a('0xa7'),_0x2c2a('0xa8'));_0x3b3dec[_0x2c2a('0x4f')](_0x2c2a('0xa9'),'Contact.email');_0x3b3dec[_0x2c2a('0x4f')]('c.phone','Contact.phone');_0x3b3dec['field'](_0x2c2a('0xaa'),_0x2c2a('0xab'));_0x3b3dec[_0x2c2a('0x4f')](_0x2c2a('0xac'),_0x2c2a('0xad'));_0x3b3dec[_0x2c2a('0x4f')](_0x2c2a('0xae'),_0x2c2a('0xaf'));_0x3b3dec[_0x2c2a('0x4f')](_0x2c2a('0xb0'),_0x2c2a('0xb1'));_0x3b3dec[_0x2c2a('0x4f')](_0x2c2a('0xb2'),_0x2c2a('0x3a'));}if(_0x349f9b[_0x2c2a('0x2d')])_0x3b3dec[_0x2c2a('0x2d')](_0x349f9b[_0x2c2a('0x2d')]);if(_0x349f9b[_0x2c2a('0x2c')])_0x3b3dec[_0x2c2a('0x2c')](_0x349f9b['offset']);return db[_0x2c2a('0x9d')][_0x2c2a('0x45')](_0x3b3dec['toString'](),_0x2ce170);})[_0x2c2a('0x33')](function(_0x2d0479){_0x4e2602['where']('ui.ChatInteractionId\x20IN\x20?',_[_0x2c2a('0x38')](_0x2d0479,'id'));return db['sequelize'][_0x2c2a('0x45')](_0x4e2602[_0x2c2a('0x9e')](),_0x2ce170)['then'](function(_0x51560b){var _0x5bbc9f=_[_0x2c2a('0xb3')](_0x51560b,'ChatInteractionId');var _0x281c59=[];_0x2d0479[_0x2c2a('0x3c')](function(_0x2f10cf){_0x281c59['push'](updateChatInteraction(_0x2f10cf,_0x2030b7,_0x5bbc9f));});return BPromise[_0x2c2a('0xb4')](_0x281c59);});});})['then'](function(_0x1af3ed){_0x3d6ba6[_0x2c2a('0xb5')]=_0x1af3ed;return _0x3d6ba6;})[_0x2c2a('0x33')](respondWithFilteredResult(_0x5ab83d,_0x349f9b))[_0x2c2a('0x26')](handleError(_0x5ab83d,null));};exports['show']=function(_0x3d6f59,_0x3c6617){var _0x5e60cc={'raw':![],'where':{'id':_0x3d6f59['params']['id']}},_0x49698d={};_0x49698d['model']=_[_0x2c2a('0x46')](db[_0x2c2a('0x3f')][_0x2c2a('0x40')]);_0x49698d[_0x2c2a('0x45')]=_[_0x2c2a('0x46')](_0x3d6f59[_0x2c2a('0x45')]);_0x49698d[_0x2c2a('0x4e')]=_[_0x2c2a('0x47')](_0x49698d['model'],_0x49698d[_0x2c2a('0x45')]);_0x5e60cc[_0x2c2a('0x49')]=_[_0x2c2a('0x47')](_0x49698d[_0x2c2a('0x44')],qs[_0x2c2a('0x48')](_0x3d6f59[_0x2c2a('0x45')][_0x2c2a('0x48')]));_0x5e60cc[_0x2c2a('0x49')]=_0x5e60cc[_0x2c2a('0x49')][_0x2c2a('0x66')]?_0x5e60cc['attributes']:_0x49698d['model'];if(_0x3d6f59[_0x2c2a('0x45')][_0x2c2a('0xb6')]){_0x5e60cc['include']=[{'all':!![]}];}_0x5e60cc=_[_0x2c2a('0xb7')]({},_0x5e60cc,_0x3d6f59[_0x2c2a('0xb8')]);return db['ChatInteraction'][_0x2c2a('0x67')](_0x5e60cc)[_0x2c2a('0x33')](handleEntityNotFound(_0x3c6617,null))[_0x2c2a('0x33')](respondWithResult(_0x3c6617,null))[_0x2c2a('0x26')](handleError(_0x3c6617,null));};exports[_0x2c2a('0xb9')]=function(_0x39fc80,_0x345c30){return db['ChatInteraction'][_0x2c2a('0xb9')](_0x39fc80[_0x2c2a('0x77')],{})[_0x2c2a('0x33')](respondWithResult(_0x345c30,0xc9))['catch'](handleError(_0x345c30,null));};exports[_0x2c2a('0xba')]=function(_0x4c48b2,_0x2b1ef3){if(_0x4c48b2['body']['id']){delete _0x4c48b2[_0x2c2a('0x77')]['id'];}return db[_0x2c2a('0x3f')][_0x2c2a('0x67')]({'where':{'id':_0x4c48b2['params']['id']}})['then'](handleEntityNotFound(_0x2b1ef3,null))['then'](saveUpdates(_0x4c48b2[_0x2c2a('0x77')],null))[_0x2c2a('0x33')](respondWithResult(_0x2b1ef3,null))[_0x2c2a('0x26')](handleError(_0x2b1ef3,null));};exports[_0x2c2a('0x34')]=function(_0x946ea1,_0x4e1813){return db[_0x2c2a('0x3f')][_0x2c2a('0x67')]({'where':{'id':_0x946ea1[_0x2c2a('0xbb')]['id']}})['then'](handleEntityNotFound(_0x4e1813,null))['then'](removeEntity(_0x4e1813,null))[_0x2c2a('0x26')](handleError(_0x4e1813,null));};exports['describe']=function(_0x1e3eeb,_0x4b1719){return db[_0x2c2a('0x3f')][_0x2c2a('0xbc')]()[_0x2c2a('0x33')](respondWithResult(_0x4b1719,null))[_0x2c2a('0x26')](handleError(_0x4b1719,null));};exports[_0x2c2a('0xbd')]=function(_0x4fbb13,_0x4c74f1){var _0xecbe68=_0x4fbb13[_0x2c2a('0xbb')]['id'];var _0x19b35f;var _0x8cc163;var _0x20b867;return db[_0x2c2a('0x3f')][_0x2c2a('0xbe')]({'where':{'id':_0xecbe68}})[_0x2c2a('0x33')](function(_0x379cc7){_0x19b35f=_0x379cc7;return db[_0x2c2a('0xbf')][_0x2c2a('0xbe')]({'where':{'id':_0x379cc7[_0x2c2a('0x7a')]},'attributes':['id',_0x2c2a('0xc0'),_0x2c2a('0xc1')],'raw':!![]});})[_0x2c2a('0x33')](function(_0x66f592){if(_0x66f592&&_0x66f592[_0x2c2a('0xc0')]&&_0x66f592[_0x2c2a('0xc1')]){_0x8cc163=_0x66f592;var _0x4c9014={'rejectUnauthorized':![],'method':_0x2c2a('0xc2'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x66f592[_0x2c2a('0xc0')]},'body':{'name':_0x2c2a('0xc3')+_0xecbe68},'redirect':_0x2c2a('0xc4'),'json':!![]};return rp(_0x4c9014);}else{throw new db[(_0x2c2a('0x8d'))][(_0x2c2a('0xc5'))](_0x2c2a('0xc6'));}})[_0x2c2a('0x33')](function(_0x45f138){_0x20b867=_0x45f138;if(_0x20b867['id']){var _0x21d734={'body':_0x20b867[_0x2c2a('0xc7')],'ChatWebsiteId':_0x8cc163['id'],'ChatInteractionId':_0x19b35f['id'],'direction':_0x2c2a('0xc8'),'UserId':_0x4fbb13[_0x2c2a('0x9b')]['id']};return db[_0x2c2a('0xc9')][_0x2c2a('0xb9')](_0x21d734,{});}else{throw new db[(_0x2c2a('0x8d'))]['ValidationError'](_0x2c2a('0xca'));}})[_0x2c2a('0x33')](function(){return _0x19b35f[_0x2c2a('0xcb')]({'vidaooSessionId':_0x20b867['id']});})[_0x2c2a('0x33')](respondWithResult(_0x4c74f1,null))[_0x2c2a('0x26')](handleError(_0x4c74f1,null));};exports[_0x2c2a('0xcc')]=function(_0x4d50ed,_0x51f687){if(_0x4d50ed[_0x2c2a('0x77')]['id']){delete _0x4d50ed[_0x2c2a('0x77')]['id'];}return db[_0x2c2a('0x3f')][_0x2c2a('0x67')]({'where':{'id':_0x4d50ed[_0x2c2a('0xbb')]['id']}})[_0x2c2a('0x33')](handleEntityNotFound(_0x51f687,null))[_0x2c2a('0x33')](saveUpdates(_0x4d50ed[_0x2c2a('0x77')],null))[_0x2c2a('0x33')](respondWithResult(_0x51f687,null))[_0x2c2a('0x26')](handleError(_0x51f687,null));};exports[_0x2c2a('0xcd')]=function(_0x1ab982,_0x5354a7,_0x3f4982){if(_0x1ab982[_0x2c2a('0x77')]['id']){delete _0x1ab982[_0x2c2a('0x77')]['id'];}return db[_0x2c2a('0x3f')][_0x2c2a('0x67')]({'where':{'id':_0x1ab982[_0x2c2a('0xbb')]['id']}})[_0x2c2a('0x33')](function(_0xe91256){if(!_0xe91256){logger[_0x2c2a('0x21')](_0x2c2a('0xce'),'abandon',0x194,_0x2c2a('0xcf'));_0x5354a7[_0x2c2a('0x27')](0x194);}else{if(_0xe91256[_0x2c2a('0x76')]){throw new db['Sequelize'][(_0x2c2a('0xc5'))](_0x2c2a('0xd0'));}}return _0xe91256;})['then'](function(_0x40a1b5){if(_0x40a1b5){return _0x40a1b5[_0x2c2a('0xba')]({'closed':_0x1ab982['body'][_0x2c2a('0xd1')],'disposition':_0x1ab982[_0x2c2a('0x77')][_0x2c2a('0xd2')]})[_0x2c2a('0x33')](function(_0x134606){return _0x134606;});}})[_0x2c2a('0x33')](function(_0x17d2ed){return respondWithRpcPromise('AbandonInteraction',_0x2c2a('0xcd'),_0x1ab982[_0x2c2a('0x77')],client9004);})[_0x2c2a('0x33')](respondWithResult(_0x5354a7,null))[_0x2c2a('0x26')](handleError(_0x5354a7,null));};exports['attachmentUpload']=function(_0x3d12c5,_0x13c073,_0xeec6a8){_0x3d12c5[_0x2c2a('0x77')]['name']=_0x3d12c5[_0x2c2a('0xd3')][_0x2c2a('0xd4')];_0x3d12c5[_0x2c2a('0x77')]['basename']=_0x3d12c5[_0x2c2a('0xd3')]['filename'];_0x3d12c5[_0x2c2a('0x77')]['type']=_0x3d12c5[_0x2c2a('0xd3')][_0x2c2a('0xd5')];return db[_0x2c2a('0xd6')][_0x2c2a('0xb9')](_0x3d12c5[_0x2c2a('0x77')])[_0x2c2a('0x33')](respondWithResult(_0x13c073,0xc9))[_0x2c2a('0x26')](handleError(_0x13c073,null));};exports[_0x2c2a('0xd7')]=function(_0x541f0e,_0x4858f1,_0x421205){return db[_0x2c2a('0x3f')][_0x2c2a('0xbe')]({'where':{'id':_0x541f0e[_0x2c2a('0xbb')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4858f1,null))['then'](function(_0x2aee0d){if(_0x2aee0d){if(_0x2aee0d[_0x2c2a('0xd1')]){return _0x4858f1[_0x2c2a('0x28')](0x193)[_0x2c2a('0x2a')]({'status':0x193,'message':'Unauthorized'});}return db[_0x2c2a('0xd6')][_0x2c2a('0xbe')]({'where':{'id':_0x541f0e[_0x2c2a('0x45')][_0x2c2a('0xd8')]},'raw':!![]})['then'](handleEntityNotFound(_0x4858f1,null));}})[_0x2c2a('0x33')](function(_0x2a3be2){if(_0x2a3be2){return _0x4858f1[_0x2c2a('0xd9')](path['join'](config[_0x2c2a('0xda')],_0x2c2a('0xdb'),_0x2a3be2[_0x2c2a('0xdc')]));}})[_0x2c2a('0x26')](handleError(_0x4858f1,null));};exports[_0x2c2a('0xdd')]=function(_0x3396fe,_0x2af202){var _0x162068=null;var _0x35dd7b=null;var _0x1a58ea=null;var _0x57250f=null;if(_0x3396fe[_0x2c2a('0x77')]['id']){delete _0x3396fe[_0x2c2a('0x77')]['id'];}if(_0x3396fe[_0x2c2a('0x77')]['mailTranscript']){_0x57250f=path[_0x2c2a('0xde')](config[_0x2c2a('0xda')],_0x2c2a('0xdf'),util[_0x2c2a('0xe0')](_0x2c2a('0xe1'),Date[_0x2c2a('0xe2')]()));_0x3396fe[_0x2c2a('0x77')][_0x2c2a('0xe3')]=_0x57250f;}return db[_0x2c2a('0x3f')][_0x2c2a('0x67')]({'where':{'id':_0x3396fe[_0x2c2a('0xbb')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x2c2a('0xe4'),'include':[{'model':db[_0x2c2a('0x74')],'as':_0x2c2a('0x74')}]}]})['then'](handleEntityNotFound(_0x2af202,null))[_0x2c2a('0x33')](saveUpdates(_0x3396fe['body'],null))[_0x2c2a('0x33')](function(_0x53c345){if(_0x53c345){_0x162068=_0x53c345;return db['ChatWebsite'][_0x2c2a('0x67')]({'where':{'id':_0x162068[_0x2c2a('0x7a')]}});}})[_0x2c2a('0x33')](function(_0x2712fb){if(_0x2712fb){_0x1a58ea=_0x2712fb;return db[_0x2c2a('0xe5')][_0x2c2a('0x67')]({'where':{'id':_0x162068[_0x2c2a('0x6e')]}});}})['then'](function(_0x425073){if(_0x425073){_0x35dd7b=_0x425073;if(_0x57250f){var _0x52b938=null;for(var _0x2ab1b8=0x1;_0x2ab1b8<_0x162068['Messages'][_0x2c2a('0x66')];++_0x2ab1b8){_0x52b938=_0x162068[_0x2c2a('0xe4')][_0x2ab1b8];var _0x2c2816=_0x52b938[_0x2c2a('0x76')]?util[_0x2c2a('0xe0')](_0x2c2a('0xe6'),_0x1a58ea['agentAlias'],_0x52b938[_0x2c2a('0x76')]):_0x2c2a('0xe7');var _0x42abcb=_0x3396fe['body'][_0x2c2a('0xe8')]||util[_0x2c2a('0xe0')](_0x2c2a('0xe6'),_0x2c2a('0xe9'),_0x52b938[_0x2c2a('0x6e')]);switch(_0x1a58ea['agentIdentifier']){case'website_alias':_0x2c2816=_0x52b938[_0x2c2a('0x76')]?util[_0x2c2a('0xe0')](_0x2c2a('0xe6'),_0x1a58ea[_0x2c2a('0xea')],_0x52b938[_0x2c2a('0x76')]):_0x2c2a('0xe7');break;case _0x2c2a('0xeb'):_0x2c2816=_0x52b938['UserId']?_0x52b938[_0x2c2a('0x74')][_0x2c2a('0xec')]||_0x52b938[_0x2c2a('0x74')][_0x2c2a('0x39')]:'System';break;case'agent_fullname':_0x2c2816=_0x52b938[_0x2c2a('0x76')]?_0x52b938[_0x2c2a('0x74')][_0x2c2a('0x39')]:_0x2c2a('0xe7');break;default:_0x2c2816=_0x52b938[_0x2c2a('0x76')]?util[_0x2c2a('0xe0')](_0x2c2a('0xe6'),_0x1a58ea['agentAlias'],_0x52b938[_0x2c2a('0x76')]):_0x2c2a('0xe7');}var _0x569e5a=util[_0x2c2a('0xe0')](_0x2c2a('0xed'),moment(_0x52b938[_0x2c2a('0x7b')])[_0x2c2a('0xe0')]('MM/DD/YYYY\x20HH:mm:ss'),_0x52b938['direction']==='in'?_0x42abcb:_0x2c2816,_0x52b938[_0x2c2a('0x77')]);if(!_0x52b938[_0x2c2a('0xee')]){fs[_0x2c2a('0xef')](_0x57250f,_0x569e5a);}}return db[_0x2c2a('0xf0')][_0x2c2a('0xbe')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x2c2a('0xf1'),'raw':!![]}]});}}})['then'](function(_0x4acb27){if(_0x4acb27&&_0x4acb27['Smtp']&&_0x3396fe['body']){var _0x5b2238={'tls':{'rejectUnauthorized':![]}};if(_0x4acb27[_0x2c2a('0xf1')][_0x2c2a('0xf2')]){_0x5b2238[_0x2c2a('0xf2')]=_0x4acb27['Smtp'][_0x2c2a('0xf2')];}else{_0x5b2238[_0x2c2a('0xf3')]=_0x4acb27[_0x2c2a('0xf1')][_0x2c2a('0xf3')];_0x5b2238[_0x2c2a('0xf4')]=_0x4acb27[_0x2c2a('0xf1')][_0x2c2a('0xf4')];_0x5b2238[_0x2c2a('0xf5')]=_0x4acb27[_0x2c2a('0xf1')][_0x2c2a('0xf5')];}if(_0x4acb27['Smtp'][_0x2c2a('0xf6')]){_0x5b2238['auth']={'user':_0x4acb27[_0x2c2a('0xf1')]['user'],'pass':_0x4acb27[_0x2c2a('0xf1')][_0x2c2a('0xf7')]};}return respondWithRpcPromise(_0x2c2a('0xf8'),_0x2c2a('0xf9'),{'account':_0x5b2238,'message':{'from':util[_0x2c2a('0xe0')](_0x2c2a('0xfa'),_0x4acb27[_0x2c2a('0x35')],_0x4acb27[_0x2c2a('0xfb')]||_0x4acb27[_0x2c2a('0xf1')][_0x2c2a('0x9b')]),'to':_0x3396fe[_0x2c2a('0x77')][_0x2c2a('0xfc')],'subject':_0x2c2a('0xfd'),'text':util[_0x2c2a('0xe0')](_0x2c2a('0xfe'),_0x3396fe['body'][_0x2c2a('0xfc')]),'attachments':[{'path':_0x57250f}]}})[_0x2c2a('0x33')](function(){return _0x162068;})[_0x2c2a('0x26')](function(_0x1879ac){console[_0x2c2a('0x21')](_0x1879ac);});}else{return _0x162068;}})['then'](respondWithStatusCode(_0x2af202,0xc8))[_0x2c2a('0x26')](handleError(_0x2af202,null));};exports[_0x2c2a('0xff')]=function(_0x4c7e40,_0x46ffb0,_0x4d657c){return db['ChatMessage'][_0x2c2a('0x67')]({'where':{'id':_0x4c7e40['params']['id']}})[_0x2c2a('0x33')](handleEntityNotFound(_0x46ffb0,null))[_0x2c2a('0x33')](function(_0x3965c6){if(_0x3965c6){return _0x3965c6[_0x2c2a('0xff')](_0x4c7e40[_0x2c2a('0x77')][_0x2c2a('0x100')],_[_0x2c2a('0x101')](_0x4c7e40['body'],[_0x2c2a('0x100'),'id'])||{});}})['then'](respondWithResult(_0x46ffb0,null))[_0x2c2a('0x26')](handleError(_0x46ffb0,null));};exports[_0x2c2a('0x102')]=function(_0x2dec23,_0x56645b,_0x50d056){var _0x1a2ff5={'raw':![],'where':{}};var _0x286d07={};var _0x472f9a={'count':0x0,'rows':[]};return db[_0x2c2a('0x3f')][_0x2c2a('0xbe')]({'where':{'id':_0x2dec23[_0x2c2a('0xbb')]['id']}})[_0x2c2a('0x33')](handleEntityNotFound(_0x56645b,null))[_0x2c2a('0x33')](function(_0x346d05){if(_0x346d05){_0x286d07['model']=_[_0x2c2a('0x46')](db[_0x2c2a('0xc9')][_0x2c2a('0x40')]);_0x286d07[_0x2c2a('0x45')]=_[_0x2c2a('0x46')](_0x2dec23[_0x2c2a('0x45')]);_0x286d07[_0x2c2a('0x4e')]=_['intersection'](_0x286d07[_0x2c2a('0x44')],_0x286d07[_0x2c2a('0x45')]);_0x1a2ff5[_0x2c2a('0x49')]=_[_0x2c2a('0x47')](_0x286d07[_0x2c2a('0x44')],qs[_0x2c2a('0x48')](_0x2dec23['query'][_0x2c2a('0x48')]));_0x1a2ff5[_0x2c2a('0x49')]=_0x1a2ff5[_0x2c2a('0x49')][_0x2c2a('0x66')]?_0x1a2ff5['attributes']:_0x286d07[_0x2c2a('0x44')];if(!_0x2dec23['query'][_0x2c2a('0x103')]('nolimit')){_0x1a2ff5[_0x2c2a('0x2d')]=qs['limit'](_0x2dec23[_0x2c2a('0x45')][_0x2c2a('0x2d')]);_0x1a2ff5['offset']=qs[_0x2c2a('0x2c')](_0x2dec23[_0x2c2a('0x45')]['offset']);}_0x1a2ff5[_0x2c2a('0x4b')]=qs[_0x2c2a('0x4c')](_0x2dec23['query'][_0x2c2a('0x4c')]);_0x1a2ff5['where']=qs[_0x2c2a('0x4e')](_[_0x2c2a('0x4d')](_0x2dec23['query'],_0x286d07[_0x2c2a('0x4e')]));_0x1a2ff5[_0x2c2a('0x7e')][_0x2c2a('0x104')]=_0x346d05['id'];if(_0x2dec23[_0x2c2a('0x45')]['filter']){_0x1a2ff5['where']=_['merge'](_0x1a2ff5['where'],{'$or':_['map'](_0x1a2ff5[_0x2c2a('0x49')],function(_0x5978e8){var _0x55ed61={};_0x55ed61[_0x5978e8]={'$like':'%'+_0x2dec23[_0x2c2a('0x45')][_0x2c2a('0x87')]+'%'};return _0x55ed61;})});}if(_0x2dec23['query'][_0x2c2a('0x105')]){var _0x200e2c=_0x2dec23[_0x2c2a('0x45')][_0x2c2a('0x105')][_0x2c2a('0x3b')](',');var _0xa61691={};_0xa61691[_0x200e2c[0x0]]={'$gte':moment(_0x200e2c[0x1])[_0x2c2a('0xe0')](_0x2c2a('0x106'))};_0x1a2ff5[_0x2c2a('0x7e')]=_['merge'](_0x1a2ff5['where'],_0xa61691);}_0x1a2ff5=_[_0x2c2a('0xb7')]({},_0x1a2ff5,_0x2dec23[_0x2c2a('0xb8')]);return db[_0x2c2a('0xc9')][_0x2c2a('0x2b')]({'where':_0x1a2ff5[_0x2c2a('0x7e')]})[_0x2c2a('0x33')](function(_0x2d1891){_0x472f9a[_0x2c2a('0x2b')]=_0x2d1891;if(_0x2dec23[_0x2c2a('0x45')][_0x2c2a('0xb6')]){_0x1a2ff5[_0x2c2a('0x107')]=[{'all':!![]}];}return db[_0x2c2a('0xc9')][_0x2c2a('0x108')](_0x1a2ff5);})[_0x2c2a('0x33')](function(_0x39788b){_0x472f9a[_0x2c2a('0xb5')]=_0x39788b;return _0x472f9a;});}})[_0x2c2a('0x33')](respondWithFilteredResult(_0x56645b,_0x1a2ff5))[_0x2c2a('0x26')](handleError(_0x56645b,null));};exports[_0x2c2a('0x109')]=function(_0x5744b9,_0x14f473,_0x4e40ee){var _0x129699={'where':{}},_0x434aa2={},_0x67184={'count':0x0,'rows':[]};return db[_0x2c2a('0x3f')][_0x2c2a('0xbe')]({'where':{'id':_0x5744b9['params']['id']}})[_0x2c2a('0x33')](handleEntityNotFound(_0x14f473,null))[_0x2c2a('0x33')](function(_0x4b218a){if(_0x4b218a){_0x434aa2[_0x2c2a('0x44')]=_[_0x2c2a('0x46')](db['ChatMessage'][_0x2c2a('0x40')]);_0x434aa2['query']=_['keys'](_0x5744b9[_0x2c2a('0x45')]);_0x434aa2[_0x2c2a('0x4e')]=_[_0x2c2a('0x47')](_0x434aa2[_0x2c2a('0x44')],_0x434aa2[_0x2c2a('0x45')]);_0x129699[_0x2c2a('0x49')]=_[_0x2c2a('0x47')](_0x434aa2['model'],qs[_0x2c2a('0x48')](_0x5744b9['query'][_0x2c2a('0x48')]));_0x129699['attributes']=_0x129699['attributes']['length']?_0x129699[_0x2c2a('0x49')]:_0x434aa2[_0x2c2a('0x44')];if(!_0x5744b9[_0x2c2a('0x45')][_0x2c2a('0x103')](_0x2c2a('0x4a'))){_0x129699[_0x2c2a('0x2d')]=qs[_0x2c2a('0x2d')](_0x5744b9[_0x2c2a('0x45')][_0x2c2a('0x2d')]);_0x129699[_0x2c2a('0x2c')]=qs['offset'](_0x5744b9[_0x2c2a('0x45')][_0x2c2a('0x2c')]);}_0x129699['order']=qs[_0x2c2a('0x4c')](_0x5744b9[_0x2c2a('0x45')][_0x2c2a('0x4c')]);_0x129699['where']=qs[_0x2c2a('0x4e')](_['pick'](_0x5744b9[_0x2c2a('0x45')],_0x434aa2['filters']));_0x129699[_0x2c2a('0x7e')][_0x2c2a('0x104')]=_0x4b218a['id'];if(_0x5744b9[_0x2c2a('0x45')][_0x2c2a('0x87')]){_0x129699['where']=_['merge'](_0x129699[_0x2c2a('0x7e')],{'$or':_['map'](_0x129699['attributes'],function(_0x252c62){var _0x2e74a2={};_0x2e74a2[_0x252c62]={'$like':'%'+_0x5744b9[_0x2c2a('0x45')][_0x2c2a('0x87')]+'%'};return _0x2e74a2;})});}_0x129699[_0x2c2a('0x7e')][_0x2c2a('0xee')]=![];if(_0x5744b9[_0x2c2a('0x45')]['id']){_0x129699[_0x2c2a('0x7e')]['id']={'$gt':_0x5744b9[_0x2c2a('0x45')]['id']};}_0x129699=_[_0x2c2a('0xb7')]({},_0x129699,_0x5744b9[_0x2c2a('0xb8')]);return db['ChatMessage'][_0x2c2a('0x2b')]({'where':_0x129699[_0x2c2a('0x7e')]})[_0x2c2a('0x33')](function(_0x5aa471){_0x67184[_0x2c2a('0x2b')]=_0x5aa471;_0x129699[_0x2c2a('0x107')]=[];if(_0x5744b9[_0x2c2a('0x45')][_0x2c2a('0x10a')]){_0x129699[_0x2c2a('0x107')][_0x2c2a('0x3e')]({'model':db[_0x2c2a('0x74')],'as':_0x2c2a('0x74'),'attributes':['id',_0x2c2a('0x39'),'alias']});}if(_0x5744b9['query']['includeAll']){_0x129699[_0x2c2a('0x107')]=[{'all':!![]}];}return db[_0x2c2a('0xc9')][_0x2c2a('0x108')](_0x129699);})[_0x2c2a('0x33')](function(_0x13265b){_0x67184[_0x2c2a('0xb5')]=_0x13265b;return _0x67184;});}})[_0x2c2a('0x33')](respondWithFilteredResult(_0x14f473,_0x129699))[_0x2c2a('0x26')](handleError(_0x14f473,null));};exports[_0x2c2a('0x10b')]=function(_0xd8110,_0x585549,_0x1cc531){return db['ChatInteraction']['find']({'where':{'id':_0xd8110['params']['id']}})[_0x2c2a('0x33')](handleEntityNotFound(_0x585549,null))['then'](function(_0x177bda){if(_0x177bda){return _0x177bda[_0x2c2a('0x10c')](_0xd8110[_0x2c2a('0x77')][_0x2c2a('0x100')],_[_0x2c2a('0x101')](_0xd8110[_0x2c2a('0x77')],['ids','id'])||{})[_0x2c2a('0x10d')](function(){return db[_0x2c2a('0x72')]['findAll']({'attributes':['id','name',_0x2c2a('0x50')],'where':{'id':_0xd8110['body'][_0x2c2a('0x100')]}});})['then'](function(_0x1831ee){socket[_0x2c2a('0x10e')]('chatInteractionTags:save',{'id':Number(_0xd8110['params']['id']),'tags':_0x1831ee||[]});return{'id':Number(_0xd8110['params']['id']),'tags':_0x1831ee||[]};});}})[_0x2c2a('0x33')](respondWithResult(_0x585549,null))[_0x2c2a('0x26')](handleError(_0x585549,null));};exports[_0x2c2a('0x10f')]=function(_0x4b71f9,_0x41c59f,_0x1494ea){return db[_0x2c2a('0x3f')]['find']({'where':{'id':_0x4b71f9['params']['id']}})['then'](handleEntityNotFound(_0x41c59f,null))[_0x2c2a('0x33')](function(_0x21ec57){if(_0x21ec57){return _0x21ec57[_0x2c2a('0x10f')](_0x4b71f9[_0x2c2a('0x45')][_0x2c2a('0x100')]);}})[_0x2c2a('0x33')](respondWithStatusCode(_0x41c59f,null))[_0x2c2a('0x26')](handleError(_0x41c59f,null));};exports[_0x2c2a('0xd9')]=function(_0x5a08ad,_0x17f768){var _0x350478=moment()['unix']()[_0x2c2a('0x9e')]();var _0xd5472f=path['join'](config[_0x2c2a('0xda')],_0x2c2a('0x110'),_0x2c2a('0x111'),'tmp');var _0x10a692=path['join'](config['root'],'server',_0x2c2a('0x111'),_0x2c2a('0x112'));var _0x158af7=path[_0x2c2a('0xde')](_0xd5472f,_0x350478);var _0x47f278=util[_0x2c2a('0xe0')](_0x2c2a('0x113'),_0x5a08ad[_0x2c2a('0xbb')]['id'],_0x350478);var _0x4cef8a=path['join'](_0xd5472f,_0x47f278);var _0x58e5a8=[];_0x58e5a8[_0x2c2a('0x3e')]({'model':db[_0x2c2a('0x74')],'as':'User','attributes':['id',_0x2c2a('0x39')],'raw':!![]});_0x58e5a8[_0x2c2a('0x3e')]({'model':db[_0x2c2a('0xe5')],'as':_0x2c2a('0x114'),'attributes':['id',_0x2c2a('0x115'),_0x2c2a('0x116')],'raw':!![]});if(_0x5a08ad[_0x2c2a('0x45')][_0x2c2a('0x112')]){_0x58e5a8[_0x2c2a('0x3e')]({'model':db[_0x2c2a('0xd6')],'as':'Attachment','raw':!![]});}var _0x136d62=[{'model':db[_0x2c2a('0xc9')],'as':_0x2c2a('0xe4'),'attributes':['id','body','createdAt',_0x2c2a('0x117'),_0x2c2a('0xee'),'read'],'include':_0x58e5a8}];_0x136d62[_0x2c2a('0x3e')]({'model':db[_0x2c2a('0xbf')],'as':_0x2c2a('0x118'),'attributes':['id',_0x2c2a('0x35')]});_0x136d62[_0x2c2a('0x3e')]({'model':db[_0x2c2a('0x74')],'as':'Owner','attributes':['id','fullname']});return db[_0x2c2a('0x3f')][_0x2c2a('0x67')]({'where':{'id':_0x5a08ad['params']['id']},'include':_0x136d62})[_0x2c2a('0x33')](handleEntityNotFound(_0x17f768,null))[_0x2c2a('0x33')](function(_0x125b91){if(_0x125b91){var _0x55a008=_0x125b91['get']({'plain':!![]});fs['mkdirSync'](_0x158af7);var _0x1edc3d={'format':'A4','border':_0x2c2a('0x119'),'header':{'height':'40px','contents':{'first':_0x2c2a('0x11a')}},'footer':{'height':'30px','contents':{'default':util['format'](_0x2c2a('0x11b'),util['format'](_0x2c2a('0x11c'),_0x2c2a('0x11d'),_0x55a008['id']),moment()[_0x2c2a('0xe0')](_0x2c2a('0x11e'))[_0x2c2a('0x9e')]())}}};var _0x401adf={'channel':_0x2c2a('0x11d'),'account':_0x55a008[_0x2c2a('0x118')]['name'],'agent':_0x55a008[_0x2c2a('0x11f')]?_0x55a008[_0x2c2a('0x11f')][_0x2c2a('0x39')]:'N.A.','createdAt':moment(_0x55a008['createdAt'])[_0x2c2a('0xe0')](_0x2c2a('0x106'))['toString'](),'closedAt':_0x55a008['closed']?moment(_0x55a008[_0x2c2a('0x120')])[_0x2c2a('0xe0')](_0x2c2a('0x106'))[_0x2c2a('0x9e')]():'','disposition':_0x55a008[_0x2c2a('0xd2')],'chatInfo':{'browser':_0x55a008[_0x2c2a('0x121')],'os':_0x55a008[_0x2c2a('0x122')],'referer':_0x55a008[_0x2c2a('0x123')],'customerIp':_0x55a008['customerIp'],'customerPort':_0x55a008[_0x2c2a('0x124')]?_0x55a008[_0x2c2a('0x124')]:_0x2c2a('0x125')},'messages':_(_0x55a008[_0x2c2a('0xe4')])['tail']()['filter']({'secret':![]})[_0x2c2a('0x38')](function(_0x292568){if(_0x292568[_0x2c2a('0xd6')]){var _0x2cc34c=path[_0x2c2a('0xde')](_0x10a692,_0x292568[_0x2c2a('0xd6')][_0x2c2a('0xdc')]);if(fs[_0x2c2a('0x126')](_0x2cc34c)){fs['createReadStream'](_0x2cc34c)['pipe'](fs['createWriteStream'](path[_0x2c2a('0xde')](_0x158af7,_0x292568[_0x2c2a('0xd6')][_0x2c2a('0xdc')])));}}return{'date':moment(_0x292568[_0x2c2a('0x7b')])[_0x2c2a('0xe0')](_0x2c2a('0x106'))['toString'](),'sender':_0x292568['direction']===_0x2c2a('0xc8')?_0x292568['User']?_0x292568[_0x2c2a('0x74')][_0x2c2a('0x39')]:_0x2c2a('0xe7'):_0x292568[_0x2c2a('0x114')][_0x2c2a('0x115')]+(_0x292568[_0x2c2a('0x114')]['lastName']?'\x20'+_0x292568[_0x2c2a('0x114')][_0x2c2a('0x116')]:''),'body':_0x292568[_0x2c2a('0xd6')]?_0x292568[_0x2c2a('0xd6')][_0x2c2a('0xdc')]:_0x292568[_0x2c2a('0x77')],'direction':_0x292568['direction']===_0x2c2a('0xc8')?'A':'C','secret':_0x292568[_0x2c2a('0xee')],'read':_0x292568['read'],'attachment':_0x292568[_0x2c2a('0xd6')]};})[_0x2c2a('0x6c')]()};return ejs[_0x2c2a('0x127')](path['join'](config[_0x2c2a('0xda')],'server',_0x2c2a('0x128'),_0x2c2a('0x129')),{'interaction':_0x401adf})[_0x2c2a('0x33')](function(_0x386419){return new BPromise(function(_0x4657e4,_0x421bdc){pdf[_0x2c2a('0xb9')](_0x386419,_0x1edc3d)[_0x2c2a('0x12a')](path['join'](_0x158af7,_0x2c2a('0x12b')+_0x55a008['id']+'-'+_0x350478+'.pdf'),function(_0x5e1827,_0xe3dc9c){if(_0x5e1827)return _0x421bdc(_0x5e1827);_0x4657e4(_0xe3dc9c);});});})[_0x2c2a('0x33')](function(){return new BPromise(function(_0x10b942,_0x1530ae){zipdir(_0x158af7,{'saveTo':_0x4cef8a},function(_0x40e555,_0x2af57a){if(_0x40e555)return _0x1530ae(_0x40e555);return _0x10b942(_0x2af57a);});})[_0x2c2a('0x33')](function(){return new BPromise(function(_0x37339b,_0x3aa78e){rimraf(_0x158af7,function(_0x2642ee){if(_0x2642ee)_0x3aa78e(_0x2642ee);return _0x37339b();});});})['then'](function(){return _0x17f768[_0x2c2a('0xd9')](_0x4cef8a,_0x47f278,function(_0x546b24){if(_0x546b24){console[_0x2c2a('0x12c')](_0x2c2a('0x12d'),_0x546b24);}else{fs[_0x2c2a('0x12e')](_0x4cef8a);}});});});}else{return _0x17f768[_0x2c2a('0x27')](0xc8);}})['catch'](handleError(_0x17f768,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index ca7973a..7889525 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 _0xacfd=['map','findAll','then','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','setMaxListeners','save','update','getUsers','setDataValue','Users'];(function(_0x25678f,_0x5958d5){var _0x1961b5=function(_0x3d0258){while(--_0x3d0258){_0x25678f['push'](_0x25678f['shift']());}};_0x1961b5(++_0x5958d5);}(_0xacfd,0x119));var _0xdacf=function(_0x26b366,_0x1c0399){_0x26b366=_0x26b366-0x0;var _0x52a840=_0xacfd[_0x26b366];return _0x52a840;};'use strict';var EventEmitter=require(_0xdacf('0x0'));var ChatInteraction=require(_0xdacf('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xdacf('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdacf('0x2')](0x0);var events={'afterCreate':_0xdacf('0x3'),'afterUpdate':_0xdacf('0x4'),'afterDestroy':'remove'};function emitEvent(_0x31dc33){return function(_0xc430a3,_0x72e494,_0x5e84b4){_0xc430a3[_0xdacf('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5e582b){_0xc430a3[_0xdacf('0x6')](_0xdacf('0x7'),_0x5e582b[_0xdacf('0x8')](function(_0x4febf6){return{'id':_0x4febf6['id']};}));return ChatMessage[_0xdacf('0x9')]({'where':{'ChatInteractionId':_0xc430a3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdacf('0xa')](function(_0xd56dd3){_0xc430a3[_0xdacf('0x6')](_0xdacf('0xb'),_0xd56dd3[_0xdacf('0xc')]);ChatInteractionEvents[_0xdacf('0xd')](_0x31dc33+':'+_0xc430a3['id'],_0xc430a3);ChatInteractionEvents[_0xdacf('0xd')](_0x31dc33,_0xc430a3);_0x5e84b4(null);})[_0xdacf('0xe')](_0x5e84b4(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xdacf('0xf')](e,emitEvent(event));}}module[_0xdacf('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x30d4=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x30d4,0xed));var _0x430d=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x30d4[_0x376b45];return _0x2341b3;};'use strict';var EventEmitter=require(_0x430d('0x0'));var ChatInteraction=require(_0x430d('0x1'))['db'][_0x430d('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x430d('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x430d('0x4'),'afterUpdate':_0x430d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x121ec1){return function(_0x34d4f9,_0x197d7b,_0x44dffe){_0x34d4f9[_0x430d('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x391fe8){_0x34d4f9[_0x430d('0x7')](_0x430d('0x8'),_0x391fe8[_0x430d('0x9')](function(_0x570cd5){return{'id':_0x570cd5['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x34d4f9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x430d('0xa')](function(_0x14d62f){_0x34d4f9[_0x430d('0x7')](_0x430d('0xb'),_0x14d62f[_0x430d('0xc')]);ChatInteractionEvents['emit'](_0x121ec1+':'+_0x34d4f9['id'],_0x34d4f9);ChatInteractionEvents[_0x430d('0xd')](_0x121ec1,_0x34d4f9);_0x44dffe(null);})[_0x430d('0xe')](_0x44dffe(null));};}for(var e in events){if(events[_0x430d('0xf')](e)){var event=events[e];ChatInteraction[_0x430d('0x10')](e,emitEvent(event));}}module[_0x430d('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 caa7698..e06d4e0 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 _0x85cb=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x33fd2d,_0x3a1843){var _0x20bfc5=function(_0x2dcd10){while(--_0x2dcd10){_0x33fd2d['push'](_0x33fd2d['shift']());}};_0x20bfc5(++_0x3a1843);}(_0x85cb,0x164));var _0xb85c=function(_0x544b7c,_0x306ded){_0x544b7c=_0x544b7c-0x0;var _0x5b0f0a=_0x85cb[_0x544b7c];return _0x5b0f0a;};'use strict';var _=require(_0xb85c('0x0'));var util=require(_0xb85c('0x1'));var logger=require(_0xb85c('0x2'))(_0xb85c('0x3'));var moment=require(_0xb85c('0x4'));var BPromise=require(_0xb85c('0x5'));var rp=require(_0xb85c('0x6'));var fs=require('fs');var path=require(_0xb85c('0x7'));var rimraf=require(_0xb85c('0x8'));var config=require(_0xb85c('0x9'));var attributes=require('./chatInteraction.attributes');module[_0xb85c('0xa')]=function(_0x21614e,_0x1013c1){return _0x21614e[_0xb85c('0xb')](_0xb85c('0xc'),attributes,{'tableName':_0xb85c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b9d28,_0xcad977,_0x26a69a){if(_0x5b9d28[_0xb85c('0xe')](_0xb85c('0xf'))){_0x5b9d28[_0xb85c('0x10')]=moment()[_0xb85c('0x11')](_0xb85c('0x12'));}_0x26a69a(null,_0x5b9d28);}},'charset':_0xb85c('0x13'),'collate':_0xb85c('0x14')});}; \ No newline at end of file +var _0xd1f7=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions'];(function(_0xd812c8,_0x2d76b2){var _0x303c48=function(_0x1d43a2){while(--_0x1d43a2){_0xd812c8['push'](_0xd812c8['shift']());}};_0x303c48(++_0x2d76b2);}(_0xd1f7,0x1ab));var _0x7d1f=function(_0x5f4f34,_0x45345b){_0x5f4f34=_0x5f4f34-0x0;var _0x30311b=_0xd1f7[_0x5f4f34];return _0x30311b;};'use strict';var _=require(_0x7d1f('0x0'));var util=require(_0x7d1f('0x1'));var logger=require(_0x7d1f('0x2'))('api');var moment=require(_0x7d1f('0x3'));var BPromise=require(_0x7d1f('0x4'));var rp=require(_0x7d1f('0x5'));var fs=require('fs');var path=require(_0x7d1f('0x6'));var rimraf=require(_0x7d1f('0x7'));var config=require(_0x7d1f('0x8'));var attributes=require(_0x7d1f('0x9'));module[_0x7d1f('0xa')]=function(_0x44fd33,_0x231407){return _0x44fd33[_0x7d1f('0xb')]('ChatInteraction',attributes,{'tableName':_0x7d1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x201b50,_0x5ed375,_0x15db5f){if(_0x201b50[_0x7d1f('0xd')](_0x7d1f('0xe'))){_0x201b50[_0x7d1f('0xf')]=moment()[_0x7d1f('0x10')](_0x7d1f('0x11'));}_0x15db5f(null,_0x201b50);}},'charset':_0x7d1f('0x12'),'collate':_0x7d1f('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3b95272..215e4b7 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 _0x99e6=['options','raw','where','attributes','then','stringify','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x99e6,0x18e));var _0x699e=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x99e6[_0x585133];return _0x18254a;};'use strict';var _=require(_0x699e('0x0'));var util=require(_0x699e('0x1'));var moment=require(_0x699e('0x2'));var BPromise=require(_0x699e('0x3'));var rs=require(_0x699e('0x4'));var fs=require('fs');var Redis=require(_0x699e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x699e('0x6'));var logger=require(_0x699e('0x7'))(_0x699e('0x8'));var config=require(_0x699e('0x9'));var jayson=require(_0x699e('0xa'));var client=jayson[_0x699e('0xb')][_0x699e('0xc')]({'port':0x232a});config[_0x699e('0xd')]=_['defaults'](config[_0x699e('0xd')],{'host':_0x699e('0xe'),'port':0x18eb});var socket=require(_0x699e('0xf'))(new Redis(config[_0x699e('0xd')]));require(_0x699e('0x10'))['register'](socket);function respondWithRpcPromise(_0x567019,_0x44d958,_0xd99302){return new BPromise(function(_0x2efca8,_0x3090cc){return client[_0x699e('0x11')](_0x567019,_0xd99302)['then'](function(_0x80ee8c){logger['info'](_0x699e('0x12'),_0x44d958,_0x699e('0x13'));logger[_0x699e('0x14')](_0x699e('0x15'),_0x44d958,_0x699e('0x13'),JSON['stringify'](_0x80ee8c));if(_0x80ee8c[_0x699e('0x16')]){if(_0x80ee8c[_0x699e('0x16')][_0x699e('0x17')]===0x1f4){logger[_0x699e('0x16')](_0x699e('0x12'),_0x44d958,_0x80ee8c[_0x699e('0x16')][_0x699e('0x18')]);return _0x3090cc(_0x80ee8c[_0x699e('0x16')][_0x699e('0x18')]);}logger[_0x699e('0x16')](_0x699e('0x12'),_0x44d958,_0x80ee8c['error'][_0x699e('0x18')]);return _0x2efca8(_0x80ee8c[_0x699e('0x16')][_0x699e('0x18')]);}else{logger[_0x699e('0x19')](_0x699e('0x12'),_0x44d958,'request\x20sent');_0x2efca8(_0x80ee8c[_0x699e('0x1a')][_0x699e('0x18')]);}})[_0x699e('0x1b')](function(_0x427ace){logger['error'](_0x699e('0x12'),_0x44d958,_0x427ace);_0x3090cc(_0x427ace);});});}exports[_0x699e('0x1c')]=function(_0x520834){var _0x37f93a=this;return new Promise(function(_0x59c6d1,_0x505493){return db[_0x699e('0x1d')][_0x699e('0x1e')](_0x520834[_0x699e('0x1f')],{'raw':_0x520834[_0x699e('0x20')]?_0x520834[_0x699e('0x20')][_0x699e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x520834[_0x699e('0x20')]?_0x520834[_0x699e('0x20')][_0x699e('0x22')]||null:null,'attributes':_0x520834['options']?_0x520834[_0x699e('0x20')][_0x699e('0x23')]||null:null,'limit':_0x520834['options']?_0x520834['options']['limit']||null:null})[_0x699e('0x24')](function(_0x3671fa){logger[_0x699e('0x19')](_0x699e('0x1c'),_0x520834);logger['debug'](_0x699e('0x1c'),_0x520834,JSON[_0x699e('0x25')](_0x3671fa));_0x59c6d1(_0x3671fa);})[_0x699e('0x1b')](function(_0x4e4272){logger['error'](_0x699e('0x1c'),_0x4e4272[_0x699e('0x18')],_0x520834);_0x505493(_0x37f93a[_0x699e('0x16')](0x1f4,_0x4e4272[_0x699e('0x18')]));});});};exports['AddTagsToChatInteraction']=function(_0x459606){return new Promise(function(_0x58b517,_0x158276){return db['ChatInteraction']['find']({'where':_0x459606['options']?_0x459606[_0x699e('0x20')][_0x699e('0x22')]||null:null})[_0x699e('0x24')](function(_0x11998e){if(_0x11998e){return _0x11998e[_0x699e('0x26')](_0x459606[_0x699e('0x1f')][_0x699e('0x27')],_[_0x699e('0x28')](_0x459606[_0x699e('0x1f')],[_0x699e('0x27'),'id'])||{});}})[_0x699e('0x29')](function(_0x4d93a5){logger[_0x699e('0x19')](_0x699e('0x2a'),_0x459606);logger[_0x699e('0x14')](_0x699e('0x2a'),_0x459606,JSON['stringify'](_0x4d93a5));_0x58b517(_0x4d93a5);})[_0x699e('0x1b')](function(_0x473dfa){logger['error'](_0x699e('0x2a'),_0x473dfa[_0x699e('0x18')],_0x459606);_0x158276(_this['error'](0x1f4,_0x473dfa['message']));});});}; \ No newline at end of file +var _0x02b3=['where','attributes','limit','info','find','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw'];(function(_0x1ef38c,_0x145209){var _0x239516=function(_0x1dd66b){while(--_0x1dd66b){_0x1ef38c['push'](_0x1ef38c['shift']());}};_0x239516(++_0x145209);}(_0x02b3,0x183));var _0x302b=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x02b3[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x302b('0x0'));var util=require('util');var moment=require(_0x302b('0x1'));var BPromise=require(_0x302b('0x2'));var rs=require(_0x302b('0x3'));var fs=require('fs');var Redis=require(_0x302b('0x4'));var db=require(_0x302b('0x5'))['db'];var utils=require(_0x302b('0x6'));var logger=require(_0x302b('0x7'))(_0x302b('0x8'));var config=require(_0x302b('0x9'));var jayson=require(_0x302b('0xa'));var client=jayson[_0x302b('0xb')][_0x302b('0xc')]({'port':0x232a});config[_0x302b('0xd')]=_[_0x302b('0xe')](config[_0x302b('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x302b('0xf'))[_0x302b('0x10')](socket);function respondWithRpcPromise(_0x1b2e18,_0xdf7711,_0x5ea398){return new BPromise(function(_0x22d281,_0x78266c){return client[_0x302b('0x11')](_0x1b2e18,_0x5ea398)[_0x302b('0x12')](function(_0x25bf64){logger['info'](_0x302b('0x13'),_0xdf7711,_0x302b('0x14'));logger[_0x302b('0x15')](_0x302b('0x16'),_0xdf7711,'request\x20sent',JSON[_0x302b('0x17')](_0x25bf64));if(_0x25bf64[_0x302b('0x18')]){if(_0x25bf64[_0x302b('0x18')]['code']===0x1f4){logger['error'](_0x302b('0x13'),_0xdf7711,_0x25bf64[_0x302b('0x18')][_0x302b('0x19')]);return _0x78266c(_0x25bf64[_0x302b('0x18')][_0x302b('0x19')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0xdf7711,_0x25bf64[_0x302b('0x18')]['message']);return _0x22d281(_0x25bf64[_0x302b('0x18')]['message']);}else{logger['info'](_0x302b('0x13'),_0xdf7711,_0x302b('0x14'));_0x22d281(_0x25bf64['result']['message']);}})[_0x302b('0x1a')](function(_0x2784fd){logger[_0x302b('0x18')]('ChatInteraction,\x20%s,\x20%s',_0xdf7711,_0x2784fd);_0x78266c(_0x2784fd);});});}exports[_0x302b('0x1b')]=function(_0x137521){var _0x41979a=this;return new Promise(function(_0x16438c,_0x3b530a){return db[_0x302b('0x1c')][_0x302b('0x1d')](_0x137521[_0x302b('0x1e')],{'raw':_0x137521[_0x302b('0x1f')]?_0x137521['options'][_0x302b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x137521[_0x302b('0x1f')]?_0x137521[_0x302b('0x1f')][_0x302b('0x21')]||null:null,'attributes':_0x137521[_0x302b('0x1f')]?_0x137521[_0x302b('0x1f')][_0x302b('0x22')]||null:null,'limit':_0x137521[_0x302b('0x1f')]?_0x137521[_0x302b('0x1f')][_0x302b('0x23')]||null:null})[_0x302b('0x12')](function(_0x1d81ce){logger[_0x302b('0x24')](_0x302b('0x1b'),_0x137521);logger[_0x302b('0x15')]('UpdateChatInteraction',_0x137521,JSON[_0x302b('0x17')](_0x1d81ce));_0x16438c(_0x1d81ce);})['catch'](function(_0x9c9d81){logger[_0x302b('0x18')](_0x302b('0x1b'),_0x9c9d81[_0x302b('0x19')],_0x137521);_0x3b530a(_0x41979a['error'](0x1f4,_0x9c9d81[_0x302b('0x19')]));});});};exports['AddTagsToChatInteraction']=function(_0x5e4e72){return new Promise(function(_0x4df5d6,_0x919897){return db[_0x302b('0x1c')][_0x302b('0x25')]({'where':_0x5e4e72[_0x302b('0x1f')]?_0x5e4e72[_0x302b('0x1f')][_0x302b('0x21')]||null:null})[_0x302b('0x12')](function(_0x1f09da){if(_0x1f09da){return _0x1f09da['addTags'](_0x5e4e72['body'][_0x302b('0x26')],_[_0x302b('0x27')](_0x5e4e72['body'],[_0x302b('0x26'),'id'])||{});}})[_0x302b('0x28')](function(_0x5f171d){logger[_0x302b('0x24')](_0x302b('0x29'),_0x5e4e72);logger['debug'](_0x302b('0x29'),_0x5e4e72,JSON[_0x302b('0x17')](_0x5f171d));_0x4df5d6(_0x5f171d);})[_0x302b('0x1a')](function(_0xba0cfb){logger[_0x302b('0x18')]('AddTags',_0xba0cfb[_0x302b('0x19')],_0x5e4e72);_0x919897(_this['error'](0x1f4,_0xba0cfb['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0799493..7e21ed6 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 _0x4444=['length','chatInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x5850b0,_0x4e7c3c){var _0x43b448=function(_0x320407){while(--_0x320407){_0x5850b0['push'](_0x5850b0['shift']());}};_0x43b448(++_0x4e7c3c);}(_0x4444,0x1a2));var _0x4444=function(_0x30f020,_0x7d2cfa){_0x30f020=_0x30f020-0x0;var _0x3933c0=_0x4444[_0x30f020];return _0x3933c0;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x4444('0x0'),_0x4444('0x1'),_0x4444('0x2')];function createListener(_0x3907b8,_0x567b2d){return function(_0x5e3530){_0x567b2d[_0x4444('0x3')](_0x3907b8,_0x5e3530);};}function removeListener(_0x48082e,_0x2fbd55){return function(){ChatInteractionEvents[_0x4444('0x4')](_0x48082e,_0x2fbd55);};}exports[_0x4444('0x5')]=function(_0x1000ed){for(var _0x2ee1ed=0x0,_0x23a792=events[_0x4444('0x6')];_0x2ee1ed<_0x23a792;_0x2ee1ed++){var _0x21073e=events[_0x2ee1ed];var _0x4222ff=createListener(_0x4444('0x7')+_0x21073e,_0x1000ed);ChatInteractionEvents['on'](_0x21073e,_0x4222ff);}}; \ No newline at end of file +var _0x5964=['update','emit','removeListener','length','chatInteraction:','./chatInteraction.events'];(function(_0x2b05a6,_0x32ebdc){var _0x17501c=function(_0x5ca941){while(--_0x5ca941){_0x2b05a6['push'](_0x2b05a6['shift']());}};_0x17501c(++_0x32ebdc);}(_0x5964,0x1d3));var _0x4596=function(_0x405778,_0xa4dd3b){_0x405778=_0x405778-0x0;var _0x341735=_0x5964[_0x405778];return _0x341735;};'use strict';var ChatInteractionEvents=require(_0x4596('0x0'));var events=['save','remove',_0x4596('0x1')];function createListener(_0x711794,_0x1fa543){return function(_0x43b163){_0x1fa543[_0x4596('0x2')](_0x711794,_0x43b163);};}function removeListener(_0x290f5d,_0x5ee1aa){return function(){ChatInteractionEvents[_0x4596('0x3')](_0x290f5d,_0x5ee1aa);};}exports['register']=function(_0x361f28){for(var _0x59f356=0x0,_0x4181e9=events[_0x4596('0x4')];_0x59f356<_0x4181e9;_0x59f356++){var _0x339446=events[_0x59f356];var _0x517ae6=createListener(_0x4596('0x5')+_0x339446,_0x361f28);ChatInteractionEvents['on'](_0x339446,_0x517ae6);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 45adbf6..9339977 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 _0xf720=['isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','replace','single','file','attachmentUpload','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','Router','./chatInteraction.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x430469,_0x20e783){var _0x1ca55e=function(_0x42e6e6){while(--_0x42e6e6){_0x430469['push'](_0x430469['shift']());}};_0x1ca55e(++_0x20e783);}(_0xf720,0x16e));var _0x0f72=function(_0x1a788a,_0x3d0b62){_0x1a788a=_0x1a788a-0x0;var _0x86edb3=_0xf720[_0x1a788a];return _0x86edb3;};'use strict';var multer=require(_0x0f72('0x0'));var util=require(_0x0f72('0x1'));var path=require('path');var timeout=require(_0x0f72('0x2'));var express=require('express');var router=express[_0x0f72('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0f72('0x4'));router[_0x0f72('0x5')]('/',auth[_0x0f72('0x6')](),controller[_0x0f72('0x7')]);router[_0x0f72('0x5')]('/describe',auth[_0x0f72('0x6')](),controller[_0x0f72('0x8')]);router[_0x0f72('0x5')](_0x0f72('0x9'),auth[_0x0f72('0xa')](),controller['show']);router['get'](_0x0f72('0xb'),auth['isChatInteractionAuthorized'](),controller[_0x0f72('0xc')]);router[_0x0f72('0x5')](_0x0f72('0xd'),auth['isAuthenticated'](),controller[_0x0f72('0xe')]);router[_0x0f72('0x5')](_0x0f72('0xf'),auth['isChatInteractionAuthorized'](),controller[_0x0f72('0x10')]);router[_0x0f72('0x5')](_0x0f72('0x11'),auth['isAuthenticated'](),controller['download']);router[_0x0f72('0x12')]('/',auth[_0x0f72('0x6')](),controller['create']);router['post'](_0x0f72('0x13'),auth[_0x0f72('0x6')](),controller[_0x0f72('0x14')]);var upload=multer({'storage':multer[_0x0f72('0x15')]({'destination':function(_0x3d2888,_0x4ca380,_0x1a69bc){_0x1a69bc(null,path[_0x0f72('0x16')](config[_0x0f72('0x17')],_0x0f72('0x18')));},'filename':function(_0xa6221,_0x3fa20f,_0x203efa){_0x203efa(null,util[_0x0f72('0x19')]('%s-%s',Date['now'](),_0x3fa20f['originalname'][_0x0f72('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x0f72('0x1b')](_0x0f72('0x1c')),controller[_0x0f72('0x1d')]);router[_0x0f72('0x12')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router['post'](_0x0f72('0x1e'),auth[_0x0f72('0x6')](),interaction[_0x0f72('0x1f')](_0x0f72('0x20'),'chatinteraction:addtags'),controller[_0x0f72('0x21')]);router[_0x0f72('0x22')](_0x0f72('0x9'),auth[_0x0f72('0x6')](),interaction[_0x0f72('0x1f')](_0x0f72('0x20'),_0x0f72('0x23')),controller[_0x0f72('0x24')]);router[_0x0f72('0x22')](_0x0f72('0x25'),controller['customUpdate']);router[_0x0f72('0x22')](_0x0f72('0x26'),auth[_0x0f72('0xa')](),controller[_0x0f72('0x27')]);router[_0x0f72('0x22')](_0x0f72('0x28'),controller[_0x0f72('0x29')]);router[_0x0f72('0x2a')](_0x0f72('0x9'),auth[_0x0f72('0x6')](),interaction[_0x0f72('0x1f')](_0x0f72('0x20'),_0x0f72('0x2b')),controller[_0x0f72('0x2c')]);router[_0x0f72('0x2a')](_0x0f72('0x1e'),auth[_0x0f72('0x6')](),controller[_0x0f72('0x2d')]);module[_0x0f72('0x2e')]=router; \ No newline at end of file +var _0xec3d=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','isChatInteractionAuthorized','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','now','originalname','single','file','/:id/messages','addMessage','tracked','addTags','put','chatinteraction:update','update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./chatInteraction.controller'];(function(_0x2cd180,_0x441df6){var _0x33140f=function(_0x285971){while(--_0x285971){_0x2cd180['push'](_0x2cd180['shift']());}};_0x33140f(++_0x441df6);}(_0xec3d,0x179));var _0xdec3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec3d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xdec3('0x0'));var util=require(_0xdec3('0x1'));var path=require(_0xdec3('0x2'));var timeout=require(_0xdec3('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xdec3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdec3('0x5'));var controller=require(_0xdec3('0x6'));router[_0xdec3('0x7')]('/',auth[_0xdec3('0x8')](),controller[_0xdec3('0x9')]);router[_0xdec3('0x7')](_0xdec3('0xa'),auth[_0xdec3('0x8')](),controller[_0xdec3('0xb')]);router[_0xdec3('0x7')](_0xdec3('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xdec3('0xd')]);router['get'](_0xdec3('0xe'),auth['isChatInteractionAuthorized'](),controller[_0xdec3('0xf')]);router[_0xdec3('0x7')]('/:id/messages',auth[_0xdec3('0x8')](),controller[_0xdec3('0x10')]);router[_0xdec3('0x7')](_0xdec3('0x11'),auth[_0xdec3('0x12')](),controller[_0xdec3('0x13')]);router[_0xdec3('0x7')](_0xdec3('0x14'),auth[_0xdec3('0x8')](),controller[_0xdec3('0x15')]);router[_0xdec3('0x16')]('/',auth[_0xdec3('0x8')](),controller[_0xdec3('0x17')]);router['post'](_0xdec3('0x18'),auth[_0xdec3('0x8')](),controller[_0xdec3('0x19')]);var upload=multer({'storage':multer[_0xdec3('0x1a')]({'destination':function(_0x462c41,_0x1980a2,_0xaa4683){_0xaa4683(null,path['join'](config['root'],_0xdec3('0x1b')));},'filename':function(_0x4d2663,_0x5d8d2e,_0x262074){_0x262074(null,util['format']('%s-%s',Date[_0xdec3('0x1c')](),_0x5d8d2e[_0xdec3('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xdec3('0x16')]('/:id/attachment_upload',upload[_0xdec3('0x1e')](_0xdec3('0x1f')),controller['attachmentUpload']);router[_0xdec3('0x16')](_0xdec3('0x20'),auth[_0xdec3('0x12')](),controller[_0xdec3('0x21')]);router['post']('/:id/tags',auth[_0xdec3('0x8')](),interaction[_0xdec3('0x22')]('chat','chatinteraction:addtags'),controller[_0xdec3('0x23')]);router[_0xdec3('0x24')](_0xdec3('0xc'),auth['isAuthenticated'](),interaction['tracked']('chat',_0xdec3('0x25')),controller[_0xdec3('0x26')]);router[_0xdec3('0x24')]('/:id/custom_update',controller[_0xdec3('0x27')]);router['put'](_0xdec3('0x28'),auth[_0xdec3('0x12')](),controller[_0xdec3('0x29')]);router[_0xdec3('0x24')]('/:id/close',controller[_0xdec3('0x2a')]);router[_0xdec3('0x2b')](_0xdec3('0xc'),auth[_0xdec3('0x8')](),interaction[_0xdec3('0x22')]('chat',_0xdec3('0x2c')),controller[_0xdec3('0x2d')]);router[_0xdec3('0x2b')](_0xdec3('0x2e'),auth['isAuthenticated'](),controller[_0xdec3('0x2f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index b9606be..0416874 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 _0x5f66=['exports','medium','BOOLEAN','INTEGER'];(function(_0x4915bb,_0x1fd2ca){var _0x5e8bad=function(_0x189cd6){while(--_0x189cd6){_0x4915bb['push'](_0x4915bb['shift']());}};_0x5e8bad(++_0x1fd2ca);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x65f6('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x65f6('0x3')]}}; \ No newline at end of file +var _0xda2d=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x5ca581,_0x1e7ed8){var _0x10e67a=function(_0x2c7b65){while(--_0x2c7b65){_0x5ca581['push'](_0x5ca581['shift']());}};_0x10e67a(++_0x1e7ed8);}(_0xda2d,0x102));var _0xdda2=function(_0x1eaeee,_0x291a3d){_0x1eaeee=_0x1eaeee-0x0;var _0xc324b=_0xda2d[_0x1eaeee];return _0xc324b;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'body':{'type':Sequelize[_0xdda2('0x1')](_0xdda2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdda2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 6817ce4..1d1a0c1 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 _0x6659=['find','create','body','params','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','agent','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','length','push','FromId','ToId','read','all','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','keys'];(function(_0x32b0b2,_0x4f3f45){var _0x5b595e=function(_0x5e6952){while(--_0x5e6952){_0x32b0b2['push'](_0x32b0b2['shift']());}};_0x5b595e(++_0x4f3f45);}(_0x6659,0x176));var _0x9665=function(_0x132ca3,_0x4be008){_0x132ca3=_0x132ca3-0x0;var _0x3e2ee0=_0x6659[_0x132ca3];return _0x3e2ee0;};'use strict';var pdf=require(_0x9665('0x0'));var emlformat=require(_0x9665('0x1'));var rimraf=require(_0x9665('0x2'));var zipdir=require(_0x9665('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9665('0x4'));var moment=require(_0x9665('0x5'));var BPromise=require(_0x9665('0x6'));var Mustache=require(_0x9665('0x7'));var util=require(_0x9665('0x8'));var path=require(_0x9665('0x9'));var sox=require(_0x9665('0xa'));var csv=require(_0x9665('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9665('0xc'));var squel=require(_0x9665('0xd'));var crypto=require(_0x9665('0xe'));var jsforce=require(_0x9665('0xf'));var deskjs=require(_0x9665('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9665('0x11'));var Papa=require(_0x9665('0x12'));var Redis=require(_0x9665('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9665('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9665('0x15'));var logger=require(_0x9665('0x16'))(_0x9665('0x17'));var utils=require(_0x9665('0x18'));var config=require(_0x9665('0x19'));var licenseUtil=require(_0x9665('0x1a'));var db=require(_0x9665('0x1b'))['db'];config[_0x9665('0x1c')]=_[_0x9665('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9665('0x1e'))(new Redis(config['redis']));require(_0x9665('0x1f'))[_0x9665('0x20')](socket);function respondWithStatusCode(_0x50fe25,_0x314b67){_0x314b67=_0x314b67||0xcc;return function(_0xd93bc1){if(_0xd93bc1){return _0x50fe25[_0x9665('0x21')](_0x314b67);}return _0x50fe25[_0x9665('0x22')](_0x314b67)[_0x9665('0x23')]();};}function respondWithResult(_0xdb5d65,_0x73cd12){_0x73cd12=_0x73cd12||0xc8;return function(_0x362ed4){if(_0x362ed4){return _0xdb5d65['status'](_0x73cd12)['json'](_0x362ed4);}};}function respondWithFilteredResult(_0x26125b,_0x23b0b0){return function(_0x15f797){if(_0x15f797){var _0x364a03=_0x15f797[_0x9665('0x24')],_0x2b59d7=_0x23b0b0[_0x9665('0x25')],_0x200ea5=_0x23b0b0['offset']+_0x23b0b0[_0x9665('0x26')],_0x5ea7a1;if(_0x200ea5>=_0x364a03){_0x200ea5=_0x364a03;_0x5ea7a1=0xc8;}else{_0x5ea7a1=0xce;}_0x26125b[_0x9665('0x22')](_0x5ea7a1);return _0x26125b['set'](_0x9665('0x27'),_0x2b59d7+'-'+_0x200ea5+'/'+_0x364a03)[_0x9665('0x28')](_0x15f797);}return null;};}function patchUpdates(_0x4672a2){return function(_0x17a0bb){try{jsonpatch[_0x9665('0x29')](_0x17a0bb,_0x4672a2,!![]);}catch(_0x38b564){return BPromise[_0x9665('0x2a')](_0x38b564);}return _0x17a0bb[_0x9665('0x2b')]();};}function saveUpdates(_0xd6857c,_0x29c7d0){return function(_0x267e88){if(_0x267e88){return _0x267e88[_0x9665('0x2c')](_0xd6857c)[_0x9665('0x2d')](function(_0x3190d4){return _0x3190d4;});}return null;};}function removeEntity(_0x5c0fbf,_0x2d15b7){return function(_0x2366ee){if(_0x2366ee){return _0x2366ee[_0x9665('0x2e')]()[_0x9665('0x2d')](function(){_0x5c0fbf[_0x9665('0x22')](0xcc)[_0x9665('0x23')]();});}};}function handleEntityNotFound(_0x545500,_0x6c68bd){return function(_0x57b67f){if(!_0x57b67f){_0x545500['sendStatus'](0x194);}return _0x57b67f;};}function handleError(_0x251cb0,_0x4427df){_0x4427df=_0x4427df||0x1f4;return function(_0x36f637){logger[_0x9665('0x2f')](_0x36f637['stack']);if(_0x36f637[_0x9665('0x30')]){delete _0x36f637['name'];}_0x251cb0['status'](_0x4427df)[_0x9665('0x31')](_0x36f637);};}exports[_0x9665('0x32')]=function(_0x54c0f5,_0x3aa324){var _0x4208b5={},_0x16637f={},_0x336c32={'count':0x0,'rows':[]};var _0x7efa76=_[_0x9665('0x33')](db['ChatInternalMessage'][_0x9665('0x34')],function(_0x493544){return{'name':_0x493544[_0x9665('0x35')],'type':_0x493544['type']['key']};});_0x16637f[_0x9665('0x36')]=_[_0x9665('0x33')](_0x7efa76,_0x9665('0x30'));_0x16637f[_0x9665('0x37')]=_['keys'](_0x54c0f5[_0x9665('0x37')]);_0x16637f[_0x9665('0x38')]=_['intersection'](_0x16637f['model'],_0x16637f[_0x9665('0x37')]);_0x4208b5[_0x9665('0x39')]=_[_0x9665('0x3a')](_0x16637f['model'],qs[_0x9665('0x3b')](_0x54c0f5['query'][_0x9665('0x3b')]));_0x4208b5[_0x9665('0x39')]=_0x4208b5[_0x9665('0x39')]['length']?_0x4208b5['attributes']:_0x16637f[_0x9665('0x36')];if(!_0x54c0f5[_0x9665('0x37')][_0x9665('0x3c')](_0x9665('0x3d'))){_0x4208b5[_0x9665('0x26')]=qs['limit'](_0x54c0f5[_0x9665('0x37')][_0x9665('0x26')]);_0x4208b5[_0x9665('0x25')]=qs[_0x9665('0x25')](_0x54c0f5[_0x9665('0x37')][_0x9665('0x25')]);}_0x4208b5[_0x9665('0x3e')]=qs[_0x9665('0x3f')](_0x54c0f5['query'][_0x9665('0x3f')]);_0x4208b5[_0x9665('0x40')]=qs[_0x9665('0x38')](_[_0x9665('0x41')](_0x54c0f5[_0x9665('0x37')],_0x16637f[_0x9665('0x38')]),_0x7efa76);if(_0x54c0f5[_0x9665('0x37')][_0x9665('0x42')]){_0x4208b5[_0x9665('0x40')]=_[_0x9665('0x43')](_0x4208b5[_0x9665('0x40')],{'$or':_[_0x9665('0x33')](_0x7efa76,function(_0x54a57){if(_0x54a57[_0x9665('0x44')]!==_0x9665('0x45')){var _0x35771d={};_0x35771d[_0x54a57['name']]={'$like':'%'+_0x54c0f5[_0x9665('0x37')][_0x9665('0x42')]+'%'};return _0x35771d;}})});}_0x4208b5=_[_0x9665('0x43')]({},_0x4208b5,_0x54c0f5[_0x9665('0x46')]);var _0x493c0e={'where':_0x4208b5[_0x9665('0x40')]};return db[_0x9665('0x47')]['count'](_0x493c0e)[_0x9665('0x2d')](function(_0x570f5c){_0x336c32[_0x9665('0x24')]=_0x570f5c;if(_0x54c0f5[_0x9665('0x37')][_0x9665('0x48')]){_0x4208b5[_0x9665('0x49')]=[{'all':!![]}];}return db[_0x9665('0x47')][_0x9665('0x4a')](_0x4208b5);})['then'](function(_0x234610){_0x336c32[_0x9665('0x4b')]=_0x234610;return _0x336c32;})[_0x9665('0x2d')](respondWithFilteredResult(_0x3aa324,_0x4208b5))[_0x9665('0x4c')](handleError(_0x3aa324,null));};exports['show']=function(_0x3d2d67,_0x12d574){var _0x590fd4={'raw':!![],'where':{'id':_0x3d2d67['params']['id']}},_0x4ec039={};_0x4ec039['model']=_[_0x9665('0x4d')](db['ChatInternalMessage'][_0x9665('0x34')]);_0x4ec039[_0x9665('0x37')]=_[_0x9665('0x4d')](_0x3d2d67['query']);_0x4ec039['filters']=_[_0x9665('0x3a')](_0x4ec039['model'],_0x4ec039[_0x9665('0x37')]);_0x590fd4[_0x9665('0x39')]=_[_0x9665('0x3a')](_0x4ec039[_0x9665('0x36')],qs[_0x9665('0x3b')](_0x3d2d67[_0x9665('0x37')][_0x9665('0x3b')]));_0x590fd4[_0x9665('0x39')]=_0x590fd4[_0x9665('0x39')]['length']?_0x590fd4[_0x9665('0x39')]:_0x4ec039[_0x9665('0x36')];if(_0x3d2d67['query'][_0x9665('0x48')]){_0x590fd4['include']=[{'all':!![]}];}_0x590fd4=_[_0x9665('0x43')]({},_0x590fd4,_0x3d2d67[_0x9665('0x46')]);return db['ChatInternalMessage'][_0x9665('0x4e')](_0x590fd4)[_0x9665('0x2d')](handleEntityNotFound(_0x12d574,null))[_0x9665('0x2d')](respondWithResult(_0x12d574,null))[_0x9665('0x4c')](handleError(_0x12d574,null));};exports[_0x9665('0x4f')]=function(_0x2d3f1b,_0x4d9360){return db[_0x9665('0x47')][_0x9665('0x4f')](_0x2d3f1b['body'],{})[_0x9665('0x2d')](respondWithResult(_0x4d9360,0xc9))[_0x9665('0x4c')](handleError(_0x4d9360,null));};exports[_0x9665('0x2c')]=function(_0x3a22c7,_0x179280){if(_0x3a22c7[_0x9665('0x50')]['id']){delete _0x3a22c7['body']['id'];}return db[_0x9665('0x47')][_0x9665('0x4e')]({'where':{'id':_0x3a22c7[_0x9665('0x51')]['id']}})['then'](handleEntityNotFound(_0x179280,null))['then'](saveUpdates(_0x3a22c7[_0x9665('0x50')],null))[_0x9665('0x2d')](respondWithResult(_0x179280,null))[_0x9665('0x4c')](handleError(_0x179280,null));};exports[_0x9665('0x2e')]=function(_0x5e91aa,_0x27612a){return db[_0x9665('0x47')][_0x9665('0x4e')]({'where':{'id':_0x5e91aa[_0x9665('0x51')]['id']}})['then'](handleEntityNotFound(_0x27612a,null))[_0x9665('0x2d')](removeEntity(_0x27612a,null))['catch'](handleError(_0x27612a,null));};exports['describe']=function(_0x245b93,_0x4c5e41){return db[_0x9665('0x47')]['describe']()[_0x9665('0x2d')](respondWithResult(_0x4c5e41,null))[_0x9665('0x4c')](handleError(_0x4c5e41,null));};function wrapUser(_0x16825e){return function(_0x10d33b){var _0x2fdd32=_0x16825e[_0x9665('0x52')]({'plain':!![]});_0x2fdd32[_0x9665('0x53')]=[];if(_0x10d33b){_0x2fdd32[_0x9665('0x54')]=_0x10d33b[_0x9665('0x55')];_0x2fdd32[_0x9665('0x56')]=_0x10d33b;}else{_0x2fdd32[_0x9665('0x54')]=moment(0x0)[_0x9665('0x57')](_0x9665('0x58'));_0x2fdd32[_0x9665('0x56')]={};}return _0x2fdd32;};}exports['getUsers']=function(_0x32ed5e,_0x5f119c,_0x56124b){var _0x4a180b=[];return db['User'][_0x9665('0x4a')]({'where':{'role':[_0x9665('0x59'),'admin',_0x9665('0x5a')]},'attributes':['id',_0x9665('0x5b'),_0x9665('0x30'),_0x9665('0x5c'),_0x9665('0x5d'),_0x9665('0x5e'),_0x9665('0x5f'),_0x9665('0x60'),_0x9665('0x61'),_0x9665('0x62')],'order':qs[_0x9665('0x3f')](_0x9665('0x63')),'include':[{'model':db[_0x9665('0x64')],'as':'VoiceQueues','attributes':['id','name',_0x9665('0x44')],'through':{'attributes':[]}}]})['then'](function(_0x3dcbfc){if(_0x3dcbfc){var _0x1c73b0=_0x32ed5e[_0x9665('0x5a')][_0x9665('0x52')]({'plain':!![]});if(!_0x1c73b0)throw new Error(_0x9665('0x65'));if(_0x1c73b0['role']==='user'){return db[_0x9665('0x66')][_0x9665('0x4e')]({'where':{'name':_0x9665('0x67'),'userProfileId':_0x1c73b0[_0x9665('0x68')]},'raw':!![]})[_0x9665('0x2d')](function(_0x52333c){if(_0x52333c){if(_0x52333c[_0x9665('0x69')]===0x0){return db[_0x9665('0x6a')]['findAll']({'where':{'sectionId':_0x52333c['id']},'raw':!![]})['then'](function(_0x404889){var _0x358a89=[];if(_['isEmpty'](_0x404889)){_0x358a89=_['filter'](_0x3dcbfc,function(_0x1eef79){if(_0x1eef79[_0x9665('0x5c')]!==_0x9665('0x59')){return _0x1eef79;}});return _0x358a89;}else{for(var _0x4d6f4e=0x0;_0x4d6f4e<_0x3dcbfc[_0x9665('0x6b')];_0x4d6f4e++){var _0x40cf59=_0x3dcbfc[_0x4d6f4e];if(_0x40cf59['role']==='agent'){var _0x5be196=_[_0x9665('0x4e')](_0x404889,function(_0x43b8df){return _0x43b8df['resourceId']===_0x40cf59['id'];});if(_0x5be196)_0x358a89['push'](_0x40cf59);}else{_0x358a89[_0x9665('0x6c')](_0x40cf59);}}return _0x358a89;}});}else{return _0x3dcbfc;}}else{var _0x5b4892=_[_0x9665('0x42')](_0x3dcbfc,function(_0x55f4a4){if(_0x55f4a4[_0x9665('0x5c')]!==_0x9665('0x59')){return _0x55f4a4;}});return _0x5b4892;}});}else{return _0x3dcbfc;}}})[_0x9665('0x2d')](function(_0x2e2eb7){var _0x33876e=[];if(_0x2e2eb7){_0x4a180b=_0x2e2eb7;for(var _0x440e39=0x0;_0x440e39<_0x2e2eb7[_0x9665('0x6b')];_0x440e39+=0x1){_0x4a180b[_0x440e39][_0x9665('0x53')]=[];_0x33876e[_0x9665('0x6c')](db[_0x9665('0x47')][_0x9665('0x4e')]({'where':{'FromId':[_0x32ed5e[_0x9665('0x5a')]['id'],_0x2e2eb7[_0x440e39]['id']],'ToId':[_0x32ed5e['user']['id'],_0x2e2eb7[_0x440e39]['id']],'ChatGroupId':null},'attributes':['id',_0x9665('0x55'),_0x9665('0x6d'),_0x9665('0x6e'),_0x9665('0x6f'),_0x9665('0x50')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9665('0x2d')](wrapUser(_0x2e2eb7[_0x440e39])));}return BPromise[_0x9665('0x70')](_0x33876e);}return[];})[_0x9665('0x2d')](function(_0x1e36e0){return{'rows':_0x1e36e0,'count':_0x1e36e0[_0x9665('0x6b')]};})[_0x9665('0x2d')](respondWithResult(_0x5f119c,null))[_0x9665('0x4c')](handleError(_0x5f119c,null));}; \ No newline at end of file +var _0x326c=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./chatInternalMessage.socket','register','status','json','count','offset','set','Content-Range','apply','reject','update','then','end','sendStatus','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','model','find','create','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','admin','user','fullname','role','userpic','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues','Agents','userProfileId','agent','resourceId','push','ToId','read','all','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x6788fd,_0x1b5fb2){var _0x2c218b=function(_0x4c2abf){while(--_0x4c2abf){_0x6788fd['push'](_0x6788fd['shift']());}};_0x2c218b(++_0x1b5fb2);}(_0x326c,0x13b));var _0xc326=function(_0x619634,_0x5e5e62){_0x619634=_0x619634-0x0;var _0x5f4629=_0x326c[_0x619634];return _0x5f4629;};'use strict';var pdf=require(_0xc326('0x0'));var emlformat=require(_0xc326('0x1'));var rimraf=require(_0xc326('0x2'));var zipdir=require(_0xc326('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc326('0x4'));var moment=require(_0xc326('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc326('0x6'));var util=require(_0xc326('0x7'));var path=require(_0xc326('0x8'));var sox=require(_0xc326('0x9'));var csv=require(_0xc326('0xa'));var ejs=require(_0xc326('0xb'));var fs=require('fs');var _=require(_0xc326('0xc'));var squel=require(_0xc326('0xd'));var crypto=require(_0xc326('0xe'));var jsforce=require(_0xc326('0xf'));var deskjs=require(_0xc326('0x10'));var toCsv=require(_0xc326('0xa'));var querystring=require(_0xc326('0x11'));var Papa=require(_0xc326('0x12'));var Redis=require(_0xc326('0x13'));var authService=require(_0xc326('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc326('0x15'));var hardwareService=require(_0xc326('0x16'));var logger=require(_0xc326('0x17'))(_0xc326('0x18'));var utils=require(_0xc326('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xc326('0x1a'));var db=require(_0xc326('0x1b'))['db'];config[_0xc326('0x1c')]=_[_0xc326('0x1d')](config[_0xc326('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc326('0x1c')]));require(_0xc326('0x1e'))[_0xc326('0x1f')](socket);function respondWithStatusCode(_0x46a1d0,_0x4817e4){_0x4817e4=_0x4817e4||0xcc;return function(_0x2d5a20){if(_0x2d5a20){return _0x46a1d0['sendStatus'](_0x4817e4);}return _0x46a1d0[_0xc326('0x20')](_0x4817e4)['end']();};}function respondWithResult(_0x215582,_0x225731){_0x225731=_0x225731||0xc8;return function(_0x1a8f06){if(_0x1a8f06){return _0x215582['status'](_0x225731)[_0xc326('0x21')](_0x1a8f06);}};}function respondWithFilteredResult(_0x40e63b,_0x14b772){return function(_0x22a4b0){if(_0x22a4b0){var _0x3b8846=_0x22a4b0[_0xc326('0x22')],_0x5d3bcb=_0x14b772[_0xc326('0x23')],_0x5a4f08=_0x14b772[_0xc326('0x23')]+_0x14b772['limit'],_0x8e2d24;if(_0x5a4f08>=_0x3b8846){_0x5a4f08=_0x3b8846;_0x8e2d24=0xc8;}else{_0x8e2d24=0xce;}_0x40e63b[_0xc326('0x20')](_0x8e2d24);return _0x40e63b[_0xc326('0x24')](_0xc326('0x25'),_0x5d3bcb+'-'+_0x5a4f08+'/'+_0x3b8846)[_0xc326('0x21')](_0x22a4b0);}return null;};}function patchUpdates(_0x42523d){return function(_0x2b0280){try{jsonpatch[_0xc326('0x26')](_0x2b0280,_0x42523d,!![]);}catch(_0x5a2614){return BPromise[_0xc326('0x27')](_0x5a2614);}return _0x2b0280['save']();};}function saveUpdates(_0x1f98ed,_0x1b61f7){return function(_0x121481){if(_0x121481){return _0x121481[_0xc326('0x28')](_0x1f98ed)[_0xc326('0x29')](function(_0x37e692){return _0x37e692;});}return null;};}function removeEntity(_0x4f1b36,_0x96b734){return function(_0x38a6fc){if(_0x38a6fc){return _0x38a6fc['destroy']()[_0xc326('0x29')](function(){_0x4f1b36[_0xc326('0x20')](0xcc)[_0xc326('0x2a')]();});}};}function handleEntityNotFound(_0x237fb6,_0x46c7fd){return function(_0x2181ae){if(!_0x2181ae){_0x237fb6[_0xc326('0x2b')](0x194);}return _0x2181ae;};}function handleError(_0x3973f2,_0x1ca974){_0x1ca974=_0x1ca974||0x1f4;return function(_0x4d62ac){logger[_0xc326('0x2c')](_0x4d62ac[_0xc326('0x2d')]);if(_0x4d62ac['name']){delete _0x4d62ac[_0xc326('0x2e')];}_0x3973f2[_0xc326('0x20')](_0x1ca974)[_0xc326('0x2f')](_0x4d62ac);};}exports[_0xc326('0x30')]=function(_0x42c7b1,_0x5ac16b){var _0x37428c={},_0x1d6881={},_0xb38f15={'count':0x0,'rows':[]};var _0xc1b701=_[_0xc326('0x31')](db[_0xc326('0x32')][_0xc326('0x33')],function(_0x3cc520){return{'name':_0x3cc520[_0xc326('0x34')],'type':_0x3cc520[_0xc326('0x35')][_0xc326('0x36')]};});_0x1d6881['model']=_[_0xc326('0x31')](_0xc1b701,_0xc326('0x2e'));_0x1d6881['query']=_[_0xc326('0x37')](_0x42c7b1[_0xc326('0x38')]);_0x1d6881['filters']=_[_0xc326('0x39')](_0x1d6881['model'],_0x1d6881[_0xc326('0x38')]);_0x37428c[_0xc326('0x3a')]=_[_0xc326('0x39')](_0x1d6881['model'],qs[_0xc326('0x3b')](_0x42c7b1[_0xc326('0x38')][_0xc326('0x3b')]));_0x37428c['attributes']=_0x37428c[_0xc326('0x3a')][_0xc326('0x3c')]?_0x37428c['attributes']:_0x1d6881['model'];if(!_0x42c7b1['query'][_0xc326('0x3d')](_0xc326('0x3e'))){_0x37428c[_0xc326('0x3f')]=qs[_0xc326('0x3f')](_0x42c7b1[_0xc326('0x38')]['limit']);_0x37428c[_0xc326('0x23')]=qs['offset'](_0x42c7b1['query'][_0xc326('0x23')]);}_0x37428c[_0xc326('0x40')]=qs[_0xc326('0x41')](_0x42c7b1[_0xc326('0x38')][_0xc326('0x41')]);_0x37428c[_0xc326('0x42')]=qs['filters'](_['pick'](_0x42c7b1[_0xc326('0x38')],_0x1d6881[_0xc326('0x43')]),_0xc1b701);if(_0x42c7b1[_0xc326('0x38')]['filter']){_0x37428c['where']=_[_0xc326('0x44')](_0x37428c['where'],{'$or':_['map'](_0xc1b701,function(_0x2cbf7a){if(_0x2cbf7a['type']!==_0xc326('0x45')){var _0x34663f={};_0x34663f[_0x2cbf7a[_0xc326('0x2e')]]={'$like':'%'+_0x42c7b1['query'][_0xc326('0x46')]+'%'};return _0x34663f;}})});}_0x37428c=_[_0xc326('0x44')]({},_0x37428c,_0x42c7b1[_0xc326('0x47')]);var _0x5115cd={'where':_0x37428c['where']};return db[_0xc326('0x32')][_0xc326('0x22')](_0x5115cd)[_0xc326('0x29')](function(_0x3ec512){_0xb38f15[_0xc326('0x22')]=_0x3ec512;if(_0x42c7b1[_0xc326('0x38')][_0xc326('0x48')]){_0x37428c[_0xc326('0x49')]=[{'all':!![]}];}return db[_0xc326('0x32')][_0xc326('0x4a')](_0x37428c);})[_0xc326('0x29')](function(_0x4b1ef3){_0xb38f15['rows']=_0x4b1ef3;return _0xb38f15;})[_0xc326('0x29')](respondWithFilteredResult(_0x5ac16b,_0x37428c))[_0xc326('0x4b')](handleError(_0x5ac16b,null));};exports[_0xc326('0x4c')]=function(_0x1b880a,_0x5dafae){var _0x5dd9cf={'raw':!![],'where':{'id':_0x1b880a[_0xc326('0x4d')]['id']}},_0x31c26a={};_0x31c26a[_0xc326('0x4e')]=_[_0xc326('0x37')](db['ChatInternalMessage'][_0xc326('0x33')]);_0x31c26a[_0xc326('0x38')]=_[_0xc326('0x37')](_0x1b880a[_0xc326('0x38')]);_0x31c26a['filters']=_[_0xc326('0x39')](_0x31c26a[_0xc326('0x4e')],_0x31c26a['query']);_0x5dd9cf[_0xc326('0x3a')]=_[_0xc326('0x39')](_0x31c26a[_0xc326('0x4e')],qs[_0xc326('0x3b')](_0x1b880a[_0xc326('0x38')][_0xc326('0x3b')]));_0x5dd9cf[_0xc326('0x3a')]=_0x5dd9cf[_0xc326('0x3a')][_0xc326('0x3c')]?_0x5dd9cf[_0xc326('0x3a')]:_0x31c26a['model'];if(_0x1b880a[_0xc326('0x38')]['includeAll']){_0x5dd9cf[_0xc326('0x49')]=[{'all':!![]}];}_0x5dd9cf=_[_0xc326('0x44')]({},_0x5dd9cf,_0x1b880a[_0xc326('0x47')]);return db[_0xc326('0x32')][_0xc326('0x4f')](_0x5dd9cf)['then'](handleEntityNotFound(_0x5dafae,null))[_0xc326('0x29')](respondWithResult(_0x5dafae,null))['catch'](handleError(_0x5dafae,null));};exports['create']=function(_0x3a0c97,_0x549a44){return db[_0xc326('0x32')][_0xc326('0x50')](_0x3a0c97['body'],{})[_0xc326('0x29')](respondWithResult(_0x549a44,0xc9))[_0xc326('0x4b')](handleError(_0x549a44,null));};exports[_0xc326('0x28')]=function(_0x3da64d,_0x5b2e8d){if(_0x3da64d[_0xc326('0x51')]['id']){delete _0x3da64d['body']['id'];}return db[_0xc326('0x32')]['find']({'where':{'id':_0x3da64d[_0xc326('0x4d')]['id']}})[_0xc326('0x29')](handleEntityNotFound(_0x5b2e8d,null))[_0xc326('0x29')](saveUpdates(_0x3da64d[_0xc326('0x51')],null))[_0xc326('0x29')](respondWithResult(_0x5b2e8d,null))[_0xc326('0x4b')](handleError(_0x5b2e8d,null));};exports[_0xc326('0x52')]=function(_0x4137c2,_0x38bf1f){return db[_0xc326('0x32')][_0xc326('0x4f')]({'where':{'id':_0x4137c2[_0xc326('0x4d')]['id']}})[_0xc326('0x29')](handleEntityNotFound(_0x38bf1f,null))[_0xc326('0x29')](removeEntity(_0x38bf1f,null))[_0xc326('0x4b')](handleError(_0x38bf1f,null));};exports['describe']=function(_0x571733,_0x64d584){return db[_0xc326('0x32')][_0xc326('0x53')]()[_0xc326('0x29')](respondWithResult(_0x64d584,null))[_0xc326('0x4b')](handleError(_0x64d584,null));};function wrapUser(_0x2b5686){return function(_0x4c2c32){var _0x5f09c7=_0x2b5686[_0xc326('0x54')]({'plain':!![]});_0x5f09c7[_0xc326('0x55')]=[];if(_0x4c2c32){_0x5f09c7[_0xc326('0x56')]=_0x4c2c32[_0xc326('0x57')];_0x5f09c7[_0xc326('0x58')]=_0x4c2c32;}else{_0x5f09c7[_0xc326('0x56')]=moment(0x0)[_0xc326('0x59')](_0xc326('0x5a'));_0x5f09c7[_0xc326('0x58')]={};}return _0x5f09c7;};}exports['getUsers']=function(_0x15f877,_0x5306f9,_0x2263a3){var _0x596686=[];return db['User']['findAll']({'where':{'role':['agent',_0xc326('0x5b'),_0xc326('0x5c')]},'attributes':['id',_0xc326('0x5d'),_0xc326('0x2e'),_0xc326('0x5e'),_0xc326('0x5f'),'internal','online',_0xc326('0x60'),'allowmessenger',_0xc326('0x61')],'order':qs['sort'](_0xc326('0x62')),'include':[{'model':db[_0xc326('0x63')],'as':_0xc326('0x64'),'attributes':['id',_0xc326('0x2e'),_0xc326('0x35')],'through':{'attributes':[]}}]})['then'](function(_0x52eed0){if(_0x52eed0){var _0x3cc200=_0x15f877[_0xc326('0x5c')][_0xc326('0x54')]({'plain':!![]});if(!_0x3cc200)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cc200['role']===_0xc326('0x5c')){return db['UserProfileSection']['find']({'where':{'name':_0xc326('0x65'),'userProfileId':_0x3cc200[_0xc326('0x66')]},'raw':!![]})[_0xc326('0x29')](function(_0x24b9a4){if(_0x24b9a4){if(_0x24b9a4['autoAssociation']===0x0){return db['UserProfileResource'][_0xc326('0x4a')]({'where':{'sectionId':_0x24b9a4['id']},'raw':!![]})[_0xc326('0x29')](function(_0xfcf0d2){var _0x1340ea=[];if(_['isEmpty'](_0xfcf0d2)){_0x1340ea=_[_0xc326('0x46')](_0x52eed0,function(_0x5942d5){if(_0x5942d5[_0xc326('0x5e')]!=='agent'){return _0x5942d5;}});return _0x1340ea;}else{for(var _0x55f2f9=0x0;_0x55f2f9<_0x52eed0[_0xc326('0x3c')];_0x55f2f9++){var _0x4dba01=_0x52eed0[_0x55f2f9];if(_0x4dba01[_0xc326('0x5e')]===_0xc326('0x67')){var _0x1f1d9d=_[_0xc326('0x4f')](_0xfcf0d2,function(_0x1d7711){return _0x1d7711[_0xc326('0x68')]===_0x4dba01['id'];});if(_0x1f1d9d)_0x1340ea[_0xc326('0x69')](_0x4dba01);}else{_0x1340ea[_0xc326('0x69')](_0x4dba01);}}return _0x1340ea;}});}else{return _0x52eed0;}}else{var _0x2161bd=_['filter'](_0x52eed0,function(_0x1462df){if(_0x1462df[_0xc326('0x5e')]!=='agent'){return _0x1462df;}});return _0x2161bd;}});}else{return _0x52eed0;}}})['then'](function(_0x483dd4){var _0x127d09=[];if(_0x483dd4){_0x596686=_0x483dd4;for(var _0x26b51f=0x0;_0x26b51f<_0x483dd4[_0xc326('0x3c')];_0x26b51f+=0x1){_0x596686[_0x26b51f][_0xc326('0x55')]=[];_0x127d09[_0xc326('0x69')](db[_0xc326('0x32')][_0xc326('0x4f')]({'where':{'FromId':[_0x15f877[_0xc326('0x5c')]['id'],_0x483dd4[_0x26b51f]['id']],'ToId':[_0x15f877[_0xc326('0x5c')]['id'],_0x483dd4[_0x26b51f]['id']],'ChatGroupId':null},'attributes':['id',_0xc326('0x57'),'FromId',_0xc326('0x6a'),_0xc326('0x6b'),'body'],'order':qs[_0xc326('0x41')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc326('0x29')](wrapUser(_0x483dd4[_0x26b51f])));}return BPromise[_0xc326('0x6c')](_0x127d09);}return[];})['then'](function(_0x17fc00){return{'rows':_0x17fc00,'count':_0x17fc00[_0xc326('0x3c')]};})['then'](respondWithResult(_0x5306f9,null))[_0xc326('0x4b')](handleError(_0x5306f9,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 3fe627b..d0d1c1d 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 _0x5af9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','save'];(function(_0x2db4b2,_0x5a978b){var _0x1e993b=function(_0xd57833){while(--_0xd57833){_0x2db4b2['push'](_0x2db4b2['shift']());}};_0x1e993b(++_0x5a978b);}(_0x5af9,0xdc));var _0x95af=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x5af9[_0x710815];return _0x5b3b89;};'use strict';var EventEmitter=require(_0x95af('0x0'));var ChatInternalMessage=require(_0x95af('0x1'))['db'][_0x95af('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x95af('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3fe14a){return function(_0x111852,_0x44f419,_0x583ef1){ChatInternalMessageEvents[_0x95af('0x4')](_0x3fe14a+':'+_0x111852['id'],_0x111852);ChatInternalMessageEvents[_0x95af('0x4')](_0x3fe14a,_0x111852);_0x583ef1(null);};}for(var e in events){if(events[_0x95af('0x5')](e)){var event=events[e];ChatInternalMessage[_0x95af('0x6')](e,emitEvent(event));}}module[_0x95af('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x8838=['exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x8838,0xeb));var _0x8883=function(_0x40ec80,_0x349400){_0x40ec80=_0x40ec80-0x0;var _0x37bde8=_0x8838[_0x40ec80];return _0x37bde8;};'use strict';var EventEmitter=require(_0x8883('0x0'));var ChatInternalMessage=require(_0x8883('0x1'))['db'][_0x8883('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8883('0x3')](0x0);var events={'afterCreate':_0x8883('0x4'),'afterUpdate':'update','afterDestroy':_0x8883('0x5')};function emitEvent(_0x5cd654){return function(_0x38fe28,_0x11bac0,_0x2c689d){ChatInternalMessageEvents['emit'](_0x5cd654+':'+_0x38fe28['id'],_0x38fe28);ChatInternalMessageEvents[_0x8883('0x6')](_0x5cd654,_0x38fe28);_0x2c689d(null);};}for(var e in events){if(events[_0x8883('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x8883('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index d48b0bc..aab7f57 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 _0x9ffd=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','chat_internal_messages'];(function(_0x3bd56a,_0x5b0eb5){var _0x4b2849=function(_0x380730){while(--_0x380730){_0x3bd56a['push'](_0x3bd56a['shift']());}};_0x4b2849(++_0x5b0eb5);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1a1bc6,_0x1763c1){_0x1a1bc6=_0x1a1bc6-0x0;var _0xf264c5=_0x9ffd[_0x1a1bc6];return _0xf264c5;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('api');var moment=require(_0xd9ff('0x3'));var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require('rimraf');var config=require(_0xd9ff('0x7'));var attributes=require(_0xd9ff('0x8'));module['exports']=function(_0x3aa26b,_0x2982c3){return _0x3aa26b[_0xd9ff('0x9')](_0xd9ff('0xa'),attributes,{'tableName':_0xd9ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9ff('0xc'),'collate':_0xd9ff('0xd')});}; \ No newline at end of file +var _0xbdb7=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2fac71,_0x2ae81d){_0x2fac71=_0x2fac71-0x0;var _0x28cb27=_0xbdb7[_0x2fac71];return _0x28cb27;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var moment=require(_0x7bdb('0x4'));var BPromise=require(_0x7bdb('0x5'));var rp=require(_0x7bdb('0x6'));var fs=require('fs');var path=require(_0x7bdb('0x7'));var rimraf=require(_0x7bdb('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bdb('0x9'));module['exports']=function(_0x4b5fff,_0xffdc86){return _0x4b5fff[_0x7bdb('0xa')]('ChatInternalMessage',attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7bdb('0xb'),'collate':_0x7bdb('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index c7f8b37..6c46504 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 _0xd884=['stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','http','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s'];(function(_0x124033,_0x422590){var _0x453b40=function(_0x352fd8){while(--_0x352fd8){_0x124033['push'](_0x124033['shift']());}};_0x453b40(++_0x422590);}(_0xd884,0x6f));var _0x4d88=function(_0x46b5b1,_0x373190){_0x46b5b1=_0x46b5b1-0x0;var _0x344652=_0xd884[_0x46b5b1];return _0x344652;};'use strict';var _=require(_0x4d88('0x0'));var util=require(_0x4d88('0x1'));var moment=require(_0x4d88('0x2'));var BPromise=require(_0x4d88('0x3'));var rs=require(_0x4d88('0x4'));var fs=require('fs');var Redis=require(_0x4d88('0x5'));var db=require(_0x4d88('0x6'))['db'];var utils=require(_0x4d88('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4d88('0x8')]({'port':0x232a});config[_0x4d88('0x9')]=_['defaults'](config[_0x4d88('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d88('0xa'))(new Redis(config[_0x4d88('0x9')]));require(_0x4d88('0xb'))[_0x4d88('0xc')](socket);function respondWithRpcPromise(_0x6e66e1,_0x43ac77,_0x46cc5b){return new BPromise(function(_0x339e16,_0x46b18c){return client[_0x4d88('0xd')](_0x6e66e1,_0x46cc5b)[_0x4d88('0xe')](function(_0x204f82){logger[_0x4d88('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x43ac77,_0x4d88('0x10'));logger[_0x4d88('0x11')](_0x4d88('0x12'),_0x43ac77,_0x4d88('0x10'),JSON[_0x4d88('0x13')](_0x204f82));if(_0x204f82[_0x4d88('0x14')]){if(_0x204f82[_0x4d88('0x14')][_0x4d88('0x15')]===0x1f4){logger[_0x4d88('0x14')](_0x4d88('0x16'),_0x43ac77,_0x204f82[_0x4d88('0x14')][_0x4d88('0x17')]);return _0x46b18c(_0x204f82[_0x4d88('0x14')]['message']);}logger[_0x4d88('0x14')](_0x4d88('0x16'),_0x43ac77,_0x204f82[_0x4d88('0x14')][_0x4d88('0x17')]);return _0x339e16(_0x204f82[_0x4d88('0x14')]['message']);}else{logger[_0x4d88('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x43ac77,_0x4d88('0x10'));_0x339e16(_0x204f82[_0x4d88('0x18')][_0x4d88('0x17')]);}})[_0x4d88('0x19')](function(_0x3ccbed){logger[_0x4d88('0x14')](_0x4d88('0x16'),_0x43ac77,_0x3ccbed);_0x46b18c(_0x3ccbed);});});} \ No newline at end of file +var _0xf8b2=['error','code','ChatInternalMessage,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatInternalMessage.socket','register','request','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e3b0e,_0xf2d310){var _0x20069e=function(_0x44828c){while(--_0x44828c){_0x3e3b0e['push'](_0x3e3b0e['shift']());}};_0x20069e(++_0xf2d310);}(_0xf8b2,0xc1));var _0x2f8b=function(_0x55b35e,_0x12e037){_0x55b35e=_0x55b35e-0x0;var _0x1278ac=_0xf8b2[_0x55b35e];return _0x1278ac;};'use strict';var _=require('lodash');var util=require(_0x2f8b('0x0'));var moment=require(_0x2f8b('0x1'));var BPromise=require(_0x2f8b('0x2'));var rs=require(_0x2f8b('0x3'));var fs=require('fs');var Redis=require(_0x2f8b('0x4'));var db=require(_0x2f8b('0x5'))['db'];var utils=require(_0x2f8b('0x6'));var logger=require(_0x2f8b('0x7'))(_0x2f8b('0x8'));var config=require(_0x2f8b('0x9'));var jayson=require(_0x2f8b('0xa'));var client=jayson['client'][_0x2f8b('0xb')]({'port':0x232a});config[_0x2f8b('0xc')]=_[_0x2f8b('0xd')](config[_0x2f8b('0xc')],{'host':_0x2f8b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f8b('0xc')]));require(_0x2f8b('0xf'))[_0x2f8b('0x10')](socket);function respondWithRpcPromise(_0x250a24,_0x3267b6,_0x41a5ff){return new BPromise(function(_0x107242,_0xb05108){return client[_0x2f8b('0x11')](_0x250a24,_0x41a5ff)['then'](function(_0x36f25a){logger[_0x2f8b('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x3267b6,_0x2f8b('0x13'));logger[_0x2f8b('0x14')](_0x2f8b('0x15'),_0x3267b6,_0x2f8b('0x13'),JSON[_0x2f8b('0x16')](_0x36f25a));if(_0x36f25a[_0x2f8b('0x17')]){if(_0x36f25a[_0x2f8b('0x17')][_0x2f8b('0x18')]===0x1f4){logger[_0x2f8b('0x17')](_0x2f8b('0x19'),_0x3267b6,_0x36f25a['error'][_0x2f8b('0x1a')]);return _0xb05108(_0x36f25a[_0x2f8b('0x17')][_0x2f8b('0x1a')]);}logger['error'](_0x2f8b('0x19'),_0x3267b6,_0x36f25a[_0x2f8b('0x17')][_0x2f8b('0x1a')]);return _0x107242(_0x36f25a[_0x2f8b('0x17')]['message']);}else{logger[_0x2f8b('0x12')](_0x2f8b('0x19'),_0x3267b6,'request\x20sent');_0x107242(_0x36f25a['result'][_0x2f8b('0x1a')]);}})['catch'](function(_0x5df48b){logger['error'](_0x2f8b('0x19'),_0x3267b6,_0x5df48b);_0xb05108(_0x5df48b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 7dc26f4..1ccc59f 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 _0x7333=['./chatInternalMessage.events','remove','removeListener','length'];(function(_0x4adac9,_0x29cd19){var _0x187968=function(_0x289b54){while(--_0x289b54){_0x4adac9['push'](_0x4adac9['shift']());}};_0x187968(++_0x29cd19);}(_0x7333,0xfc));var _0x3733=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7333[_0x17d9e3];return _0x14192d;};'use strict';var ChatInternalMessageEvents=require(_0x3733('0x0'));var events=['save',_0x3733('0x1'),'update'];function createListener(_0x2b6c52,_0x146076){return function(_0x1c96f5){_0x146076['emit'](_0x2b6c52,_0x1c96f5);};}function removeListener(_0x1bf202,_0x3959ac){return function(){ChatInternalMessageEvents[_0x3733('0x2')](_0x1bf202,_0x3959ac);};}exports['register']=function(_0xa51fdb){for(var _0x27c9b7=0x0,_0x3330c6=events[_0x3733('0x3')];_0x27c9b7<_0x3330c6;_0x27c9b7++){var _0x5b5a50=events[_0x27c9b7];var _0x1ee542=createListener('chatInternalMessage:'+_0x5b5a50,_0xa51fdb);ChatInternalMessageEvents['on'](_0x5b5a50,_0x1ee542);}}; \ No newline at end of file +var _0xd847=['length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xd847,0x18a));var _0x7d84=function(_0x1d96b6,_0x289b87){_0x1d96b6=_0x1d96b6-0x0;var _0x2667d2=_0xd847[_0x1d96b6];return _0x2667d2;};'use strict';var ChatInternalMessageEvents=require(_0x7d84('0x0'));var events=[_0x7d84('0x1'),_0x7d84('0x2'),_0x7d84('0x3')];function createListener(_0x58816d,_0x5a1e39){return function(_0x4492d5){_0x5a1e39[_0x7d84('0x4')](_0x58816d,_0x4492d5);};}function removeListener(_0x207e6f,_0x15f200){return function(){ChatInternalMessageEvents[_0x7d84('0x5')](_0x207e6f,_0x15f200);};}exports['register']=function(_0x1544e7){for(var _0x5d8f76=0x0,_0x3c57cd=events[_0x7d84('0x6')];_0x5d8f76<_0x3c57cd;_0x5d8f76++){var _0x1d6297=events[_0x5d8f76];var _0x32da6d=createListener(_0x7d84('0x7')+_0x1d6297,_0x1544e7);ChatInternalMessageEvents['on'](_0x1d6297,_0x32da6d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index bc99df2..5ca212b 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 _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x15bb81,_0xa0b321){var _0x4c7218=function(_0xc44f74){while(--_0xc44f74){_0x15bb81['push'](_0x15bb81['shift']());}};_0x4c7218(++_0xa0b321);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xb7e7[_0x1ae5ab];return _0x1ce001;};'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 auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0xc')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['destroy']);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x8ea77e,_0x3996d6){var _0x395958=function(_0x30271c){while(--_0x30271c){_0x8ea77e['push'](_0x8ea77e['shift']());}};_0x395958(++_0x3996d6);}(_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 auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0xc')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['destroy']);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 79e0669..5e39919 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 _0x235b=['exports','TEXT','medium','BOOLEAN','out','STRING','sequelize'];(function(_0xa9714f,_0x5ef031){var _0x3bf072=function(_0x342134){while(--_0x342134){_0xa9714f['push'](_0xa9714f['shift']());}};_0x3bf072(++_0x5ef031);}(_0x235b,0xca));var _0xb235=function(_0x469889,_0x1e640a){_0x469889=_0x469889-0x0;var _0x3e72c1=_0x235b[_0x469889];return _0x3e72c1;};'use strict';var Sequelize=require(_0xb235('0x0'));module[_0xb235('0x1')]={'body':{'type':Sequelize[_0xb235('0x2')](_0xb235('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb235('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb235('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb235('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb235('0x6')]},'providerResponse':{'type':Sequelize[_0xb235('0x2')]}}; \ No newline at end of file +var _0xfc18=['out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc18,0xc7));var _0x8fc1=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0xfc18[_0x35af23];return _0x340506;};'use strict';var Sequelize=require('sequelize');module[_0x8fc1('0x0')]={'body':{'type':Sequelize[_0x8fc1('0x1')](_0x8fc1('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8fc1('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8fc1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8fc1('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8fc1('0x5')]},'providerName':{'type':Sequelize[_0x8fc1('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 59b3cf8..564bc29 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 _0xc6e3=['includeAll','include','findAll','show','intersection','length','find','create','body','params','describe','chat-interactions','accept','read','readAt','format','UserId','CmContact','Contact','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','stringify','acceptMessage','manual','channel','event','EventManager','acceptmessage','parse','chat','agent','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','ChatMessage,\x20%s,\x20%s','message','catch','status','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','count'];(function(_0x490da9,_0x31214f){var _0x5b9821=function(_0x1423e0){while(--_0x1423e0){_0x490da9['push'](_0x490da9['shift']());}};_0x5b9821(++_0x31214f);}(_0xc6e3,0x11e));var _0x3c6e=function(_0x239e6d,_0x31be14){_0x239e6d=_0x239e6d-0x0;var _0x8d1bd5=_0xc6e3[_0x239e6d];return _0x8d1bd5;};'use strict';var pdf=require(_0x3c6e('0x0'));var emlformat=require(_0x3c6e('0x1'));var rimraf=require(_0x3c6e('0x2'));var zipdir=require(_0x3c6e('0x3'));var jsonpatch=require(_0x3c6e('0x4'));var rp=require(_0x3c6e('0x5'));var moment=require(_0x3c6e('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3c6e('0x7'));var sox=require(_0x3c6e('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3c6e('0x9'));var squel=require(_0x3c6e('0xa'));var crypto=require('crypto');var jsforce=require(_0x3c6e('0xb'));var deskjs=require(_0x3c6e('0xc'));var toCsv=require(_0x3c6e('0xd'));var querystring=require(_0x3c6e('0xe'));var Papa=require(_0x3c6e('0xf'));var Redis=require(_0x3c6e('0x10'));var authService=require(_0x3c6e('0x11'));var qs=require(_0x3c6e('0x12'));var as=require(_0x3c6e('0x13'));var hardwareService=require(_0x3c6e('0x14'));var logger=require(_0x3c6e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3c6e('0x16'));var licenseUtil=require(_0x3c6e('0x17'));var db=require(_0x3c6e('0x18'))['db'];config[_0x3c6e('0x19')]=_['defaults'](config[_0x3c6e('0x19')],{'host':_0x3c6e('0x1a'),'port':0x18eb});var socket=require(_0x3c6e('0x1b'))(new Redis(config[_0x3c6e('0x19')]));require('./chatMessage.socket')[_0x3c6e('0x1c')](socket);var jayson=require(_0x3c6e('0x1d'));var client=jayson[_0x3c6e('0x1e')][_0x3c6e('0x1f')]({'port':0x232c});var client9002=jayson[_0x3c6e('0x1e')][_0x3c6e('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4750af,_0x17f603,_0x27e192,_0x3643ba){return new BPromise(function(_0x3f48a9,_0x366e6e){var _0x4d8f10=_0x3643ba||client;return _0x4d8f10[_0x3c6e('0x20')](_0x4750af,_0x27e192)['then'](function(_0x5bad43){logger[_0x3c6e('0x21')]('ChatMessage,\x20%s,\x20%s',_0x17f603,_0x3c6e('0x22'));logger[_0x3c6e('0x23')](_0x3c6e('0x24'),_0x17f603,_0x3c6e('0x22'),JSON['stringify'](_0x5bad43));if(_0x5bad43['error']){if(_0x5bad43[_0x3c6e('0x25')][_0x3c6e('0x26')]===0x1f4){logger[_0x3c6e('0x25')](_0x3c6e('0x27'),_0x17f603,_0x5bad43[_0x3c6e('0x25')]['message']);return _0x366e6e(_0x5bad43[_0x3c6e('0x25')][_0x3c6e('0x28')]);}logger[_0x3c6e('0x25')](_0x3c6e('0x27'),_0x17f603,_0x5bad43[_0x3c6e('0x25')][_0x3c6e('0x28')]);return _0x3f48a9(_0x5bad43['error'][_0x3c6e('0x28')]);}else{logger[_0x3c6e('0x21')](_0x3c6e('0x27'),_0x17f603,_0x3c6e('0x22'));_0x3f48a9(_0x5bad43['result'][_0x3c6e('0x28')]);}})[_0x3c6e('0x29')](function(_0x1eb0d0){logger['error'](_0x3c6e('0x27'),_0x17f603,_0x1eb0d0);_0x366e6e(_0x1eb0d0);});});}function respondWithStatusCode(_0x33b540,_0x21a4d9){_0x21a4d9=_0x21a4d9||0xcc;return function(_0xf792c0){if(_0xf792c0){return _0x33b540['sendStatus'](_0x21a4d9);}return _0x33b540[_0x3c6e('0x2a')](_0x21a4d9)['end']();};}function respondWithResult(_0x53518f,_0x1108f1){_0x1108f1=_0x1108f1||0xc8;return function(_0x2aaef7){if(_0x2aaef7){return _0x53518f[_0x3c6e('0x2a')](_0x1108f1)['json'](_0x2aaef7);}};}function respondWithFilteredResult(_0x262f44,_0x1f145c){return function(_0x32acb8){if(_0x32acb8){var _0x355ccd=_0x32acb8['count'],_0x3c0c11=_0x1f145c[_0x3c6e('0x2b')],_0x247cfb=_0x1f145c[_0x3c6e('0x2b')]+_0x1f145c[_0x3c6e('0x2c')],_0x42952f;if(_0x247cfb>=_0x355ccd){_0x247cfb=_0x355ccd;_0x42952f=0xc8;}else{_0x42952f=0xce;}_0x262f44['status'](_0x42952f);return _0x262f44['set'](_0x3c6e('0x2d'),_0x3c0c11+'-'+_0x247cfb+'/'+_0x355ccd)[_0x3c6e('0x2e')](_0x32acb8);}return null;};}function patchUpdates(_0x36cac7){return function(_0x3e2a87){try{jsonpatch[_0x3c6e('0x2f')](_0x3e2a87,_0x36cac7,!![]);}catch(_0x455f6f){return BPromise[_0x3c6e('0x30')](_0x455f6f);}return _0x3e2a87[_0x3c6e('0x31')]();};}function saveUpdates(_0x33d6a6,_0x2feea4){return function(_0x1bb111){if(_0x1bb111){return _0x1bb111[_0x3c6e('0x32')](_0x33d6a6)[_0x3c6e('0x33')](function(_0x43d445){return _0x43d445;});}return null;};}function removeEntity(_0x2174d9,_0x21f2d3){return function(_0x47df04){if(_0x47df04){return _0x47df04[_0x3c6e('0x34')]()[_0x3c6e('0x33')](function(){_0x2174d9[_0x3c6e('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4551eb,_0x2feb74){return function(_0x5bfbc0){if(!_0x5bfbc0){_0x4551eb[_0x3c6e('0x35')](0x194);}return _0x5bfbc0;};}function handleError(_0x3a7a3e,_0x2dfef7){_0x2dfef7=_0x2dfef7||0x1f4;return function(_0x8c726e){logger[_0x3c6e('0x25')](_0x8c726e[_0x3c6e('0x36')]);if(_0x8c726e[_0x3c6e('0x37')]){delete _0x8c726e[_0x3c6e('0x37')];}_0x3a7a3e[_0x3c6e('0x2a')](_0x2dfef7)[_0x3c6e('0x38')](_0x8c726e);};}exports[_0x3c6e('0x39')]=function(_0x49792a,_0x3a67b){var _0x5e582c={},_0x4dfb13={},_0x5ccd97={'count':0x0,'rows':[]};var _0x5c3ca3=_[_0x3c6e('0x3a')](db[_0x3c6e('0x3b')][_0x3c6e('0x3c')],function(_0x48ce6c){return{'name':_0x48ce6c[_0x3c6e('0x3d')],'type':_0x48ce6c['type']['key']};});_0x4dfb13['model']=_[_0x3c6e('0x3a')](_0x5c3ca3,_0x3c6e('0x37'));_0x4dfb13['query']=_[_0x3c6e('0x3e')](_0x49792a[_0x3c6e('0x3f')]);_0x4dfb13[_0x3c6e('0x40')]=_['intersection'](_0x4dfb13[_0x3c6e('0x41')],_0x4dfb13[_0x3c6e('0x3f')]);_0x5e582c[_0x3c6e('0x42')]=_['intersection'](_0x4dfb13[_0x3c6e('0x41')],qs[_0x3c6e('0x43')](_0x49792a[_0x3c6e('0x3f')][_0x3c6e('0x43')]));_0x5e582c[_0x3c6e('0x42')]=_0x5e582c[_0x3c6e('0x42')]['length']?_0x5e582c[_0x3c6e('0x42')]:_0x4dfb13[_0x3c6e('0x41')];if(!_0x49792a[_0x3c6e('0x3f')][_0x3c6e('0x44')](_0x3c6e('0x45'))){_0x5e582c[_0x3c6e('0x2c')]=qs[_0x3c6e('0x2c')](_0x49792a[_0x3c6e('0x3f')]['limit']);_0x5e582c[_0x3c6e('0x2b')]=qs['offset'](_0x49792a['query'][_0x3c6e('0x2b')]);}_0x5e582c[_0x3c6e('0x46')]=qs['sort'](_0x49792a[_0x3c6e('0x3f')]['sort']);_0x5e582c[_0x3c6e('0x47')]=qs[_0x3c6e('0x40')](_[_0x3c6e('0x48')](_0x49792a[_0x3c6e('0x3f')],_0x4dfb13[_0x3c6e('0x40')]),_0x5c3ca3);if(_0x49792a[_0x3c6e('0x3f')][_0x3c6e('0x49')]){_0x5e582c['where']=_[_0x3c6e('0x4a')](_0x5e582c[_0x3c6e('0x47')],{'$or':_[_0x3c6e('0x3a')](_0x5c3ca3,function(_0xa88f4a){if(_0xa88f4a['type']!=='VIRTUAL'){var _0x449b1={};_0x449b1[_0xa88f4a[_0x3c6e('0x37')]]={'$like':'%'+_0x49792a[_0x3c6e('0x3f')]['filter']+'%'};return _0x449b1;}})});}_0x5e582c=_['merge']({},_0x5e582c,_0x49792a[_0x3c6e('0x4b')]);var _0x1ecc06={'where':_0x5e582c[_0x3c6e('0x47')]};return db['ChatMessage']['count'](_0x1ecc06)[_0x3c6e('0x33')](function(_0x1c6129){_0x5ccd97[_0x3c6e('0x4c')]=_0x1c6129;if(_0x49792a[_0x3c6e('0x3f')][_0x3c6e('0x4d')]){_0x5e582c[_0x3c6e('0x4e')]=[{'all':!![]}];}return db[_0x3c6e('0x3b')][_0x3c6e('0x4f')](_0x5e582c);})[_0x3c6e('0x33')](function(_0x502938){_0x5ccd97['rows']=_0x502938;return _0x5ccd97;})[_0x3c6e('0x33')](respondWithFilteredResult(_0x3a67b,_0x5e582c))[_0x3c6e('0x29')](handleError(_0x3a67b,null));};exports[_0x3c6e('0x50')]=function(_0x437a96,_0x349916){var _0x17fc29={'raw':!![],'where':{'id':_0x437a96['params']['id']}},_0x3ce16f={};_0x3ce16f[_0x3c6e('0x41')]=_[_0x3c6e('0x3e')](db[_0x3c6e('0x3b')][_0x3c6e('0x3c')]);_0x3ce16f[_0x3c6e('0x3f')]=_[_0x3c6e('0x3e')](_0x437a96[_0x3c6e('0x3f')]);_0x3ce16f[_0x3c6e('0x40')]=_[_0x3c6e('0x51')](_0x3ce16f[_0x3c6e('0x41')],_0x3ce16f[_0x3c6e('0x3f')]);_0x17fc29[_0x3c6e('0x42')]=_['intersection'](_0x3ce16f[_0x3c6e('0x41')],qs[_0x3c6e('0x43')](_0x437a96[_0x3c6e('0x3f')]['fields']));_0x17fc29[_0x3c6e('0x42')]=_0x17fc29[_0x3c6e('0x42')][_0x3c6e('0x52')]?_0x17fc29[_0x3c6e('0x42')]:_0x3ce16f['model'];if(_0x437a96[_0x3c6e('0x3f')]['includeAll']){_0x17fc29[_0x3c6e('0x4e')]=[{'all':!![]}];}_0x17fc29=_[_0x3c6e('0x4a')]({},_0x17fc29,_0x437a96[_0x3c6e('0x4b')]);return db['ChatMessage'][_0x3c6e('0x53')](_0x17fc29)[_0x3c6e('0x33')](handleEntityNotFound(_0x349916,null))[_0x3c6e('0x33')](respondWithResult(_0x349916,null))[_0x3c6e('0x29')](handleError(_0x349916,null));};exports[_0x3c6e('0x54')]=function(_0x355736,_0x4773be){return db['ChatMessage'][_0x3c6e('0x54')](_0x355736[_0x3c6e('0x55')],{})[_0x3c6e('0x33')](respondWithResult(_0x4773be,0xc9))[_0x3c6e('0x29')](handleError(_0x4773be,null));};exports[_0x3c6e('0x32')]=function(_0x2c73bc,_0x14190a){if(_0x2c73bc['body']['id']){delete _0x2c73bc[_0x3c6e('0x55')]['id'];}return db[_0x3c6e('0x3b')][_0x3c6e('0x53')]({'where':{'id':_0x2c73bc[_0x3c6e('0x56')]['id']}})[_0x3c6e('0x33')](handleEntityNotFound(_0x14190a,null))[_0x3c6e('0x33')](saveUpdates(_0x2c73bc[_0x3c6e('0x55')],null))[_0x3c6e('0x33')](respondWithResult(_0x14190a,null))['catch'](handleError(_0x14190a,null));};exports[_0x3c6e('0x34')]=function(_0x462180,_0x1ae05){return db['ChatMessage']['find']({'where':{'id':_0x462180['params']['id']}})['then'](handleEntityNotFound(_0x1ae05,null))['then'](removeEntity(_0x1ae05,null))[_0x3c6e('0x29')](handleError(_0x1ae05,null));};exports[_0x3c6e('0x57')]=function(_0x1ac792,_0x211943){return db[_0x3c6e('0x3b')]['describe']()['then'](respondWithResult(_0x211943,null))[_0x3c6e('0x29')](handleError(_0x211943,null));};var interaction_log=require('../../config/logger')(_0x3c6e('0x58'));exports[_0x3c6e('0x59')]=function(_0x48a1c5,_0x9e2cf5,_0x4d029e){var _0x21de82={'channel':'chat'};if(_0x48a1c5['body']['id']){delete _0x48a1c5['body']['id'];}_0x48a1c5['body'][_0x3c6e('0x5a')]=!![];_0x48a1c5[_0x3c6e('0x55')][_0x3c6e('0x5b')]=moment()[_0x3c6e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x48a1c5[_0x3c6e('0x55')][_0x3c6e('0x5d')]=_0x48a1c5['body'][_0x3c6e('0x5d')]||_0x48a1c5['user']['id'];return db[_0x3c6e('0x3b')]['find']({'where':{'id':_0x48a1c5[_0x3c6e('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x3c6e('0x5e')],'as':_0x3c6e('0x5f')}]})[_0x3c6e('0x33')](handleEntityNotFound(_0x9e2cf5,null))[_0x3c6e('0x33')](saveUpdates(_0x48a1c5['body'],null))['then'](function(_0x5e0aa3){if(_0x5e0aa3){_0x21de82[_0x3c6e('0x28')]=_0x5e0aa3['get']({'plain':!![]});return db['ChatInteraction'][_0x3c6e('0x53')]({'where':{'id':_0x5e0aa3[_0x3c6e('0x60')]}});}return null;})[_0x3c6e('0x33')](handleEntityNotFound(_0x9e2cf5,null))[_0x3c6e('0x33')](function(_0x8d1702){if(_0x8d1702){return _0x8d1702['update']({'UserId':_0x48a1c5[_0x3c6e('0x55')][_0x3c6e('0x5d')],'read1stAt':_['isNil'](_0x8d1702[_0x3c6e('0x61')])?moment()[_0x3c6e('0x5c')](_0x3c6e('0x62')):undefined});}return null;})[_0x3c6e('0x33')](function(_0x434c3c){if(_0x434c3c){_0x21de82['interaction']=_0x434c3c[_0x3c6e('0x63')]({'plain':!![]});interaction_log[_0x3c6e('0x21')](_0x3c6e('0x64'),_0x48a1c5[_0x3c6e('0x65')]['id'],_0x48a1c5[_0x3c6e('0x65')][_0x3c6e('0x37')],_0x48a1c5['user'][_0x3c6e('0x66')],_0x21de82[_0x3c6e('0x67')]['id'],_0x48a1c5[_0x3c6e('0x55')]?JSON[_0x3c6e('0x68')](_0x48a1c5[_0x3c6e('0x55')]):'null');return respondWithRpcPromise('AcceptMessage',_0x3c6e('0x69'),_0x21de82);}return null;})[_0x3c6e('0x33')](function(_0x2371f0){if(_0x2371f0){if(_0x48a1c5[_0x3c6e('0x55')][_0x3c6e('0x6a')]){_0x21de82[_0x3c6e('0x28')]['interface']=util[_0x3c6e('0x5c')]('SIP/%s',_0x48a1c5[_0x3c6e('0x65')][_0x3c6e('0x37')]);_0x21de82[_0x3c6e('0x28')]['channel']=_0x21de82[_0x3c6e('0x6b')];_0x21de82[_0x3c6e('0x28')][_0x3c6e('0x6c')]=_0x3c6e('0x59');return respondWithRpcPromise('EventManager',_0x3c6e('0x6d'),{'event':_0x3c6e('0x6e'),'message':_['merge'](_0x21de82[_0x3c6e('0x28')],JSON[_0x3c6e('0x6f')](_0x21de82['interaction']['formData']))},client9002)[_0x3c6e('0x33')](function(){return _0x21de82;});}return _0x21de82;}return null;})['then'](respondWithResult(_0x9e2cf5,null))[_0x3c6e('0x29')](handleError(_0x9e2cf5,null));};var interaction_log=require(_0x3c6e('0x15'))(_0x3c6e('0x58'));exports[_0x3c6e('0x30')]=function(_0x49b848,_0x2b9433,_0x2d8b5f){var _0x16ef07={'agent':{},'channel':_0x3c6e('0x70')};if(_0x49b848[_0x3c6e('0x55')]['id']){delete _0x49b848[_0x3c6e('0x55')]['id'];}_0x49b848[_0x3c6e('0x55')][_0x3c6e('0x5d')]=_0x49b848['body'][_0x3c6e('0x5d')]||_0x49b848['user']['id'];_0x16ef07[_0x3c6e('0x71')]['id']=_0x49b848[_0x3c6e('0x55')][_0x3c6e('0x5d')];return db['ChatMessage'][_0x3c6e('0x53')]({'where':{'id':_0x49b848['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2b9433,null))[_0x3c6e('0x33')](function(_0x311f0a){if(_0x311f0a){_0x16ef07['message']=_0x311f0a[_0x3c6e('0x63')]({'plain':!![]});return db[_0x3c6e('0x72')]['find']({'where':{'id':_0x311f0a[_0x3c6e('0x60')]}});}return null;})[_0x3c6e('0x33')](handleEntityNotFound(_0x2b9433,null))['then'](function(_0xa6aaf6){if(_0xa6aaf6){_0x16ef07[_0x3c6e('0x67')]=_0xa6aaf6['get']({'plain':!![]});interaction_log[_0x3c6e('0x21')](_0x3c6e('0x73'),_0x49b848['user']['id'],_0x49b848[_0x3c6e('0x65')][_0x3c6e('0x37')],_0x49b848[_0x3c6e('0x65')]['role'],_0x16ef07[_0x3c6e('0x67')]['id'],_0x49b848[_0x3c6e('0x55')]?JSON[_0x3c6e('0x68')](_0x49b848['body']):_0x3c6e('0x74'));return respondWithRpcPromise(_0x3c6e('0x75'),_0x3c6e('0x76'),_0x16ef07);}return null;})['then'](function(_0x12ccda){if(_0x12ccda){_0x12ccda[_0x3c6e('0x28')][_0x3c6e('0x77')]=util['format']('SIP/%s',_0x49b848[_0x3c6e('0x65')][_0x3c6e('0x37')]);_0x12ccda['message'][_0x3c6e('0x6b')]=_0x16ef07[_0x3c6e('0x6b')];_0x12ccda[_0x3c6e('0x28')]['event']=_0x3c6e('0x30');respondWithRpcPromise(_0x3c6e('0x6d'),'EventManager',{'event':_0x3c6e('0x78'),'message':_0x12ccda[_0x3c6e('0x28')]},client9002);return _0x16ef07;}return null;})[_0x3c6e('0x33')](respondWithResult(_0x2b9433,null))['catch'](handleError(_0x2b9433,null));}; \ No newline at end of file +var _0x5d84=['map','ChatMessage','rawAttributes','fieldName','type','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','keys','include','options','find','create','body','update','destroy','chat','read','readAt','format','UserId','user','CmContact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','parse','formData','chat-interactions','agent','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','client','http','request','request\x20sent','debug','stringify','error','ChatMessage,\x20%s,\x20%s','message','info','catch','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','then','end','stack','send','index'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x5d84,0x1ad));var _0x45d8=function(_0x3c5e1d,_0x713313){_0x3c5e1d=_0x3c5e1d-0x0;var _0x1bd0ed=_0x5d84[_0x3c5e1d];return _0x1bd0ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x45d8('0x0'));var rimraf=require(_0x45d8('0x1'));var zipdir=require(_0x45d8('0x2'));var jsonpatch=require(_0x45d8('0x3'));var rp=require(_0x45d8('0x4'));var moment=require(_0x45d8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x45d8('0x6'));var sox=require(_0x45d8('0x7'));var csv=require(_0x45d8('0x8'));var ejs=require(_0x45d8('0x9'));var fs=require('fs');var _=require(_0x45d8('0xa'));var squel=require(_0x45d8('0xb'));var crypto=require(_0x45d8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x45d8('0xd'));var toCsv=require(_0x45d8('0x8'));var querystring=require(_0x45d8('0xe'));var Papa=require('papaparse');var Redis=require(_0x45d8('0xf'));var authService=require(_0x45d8('0x10'));var qs=require(_0x45d8('0x11'));var as=require(_0x45d8('0x12'));var hardwareService=require(_0x45d8('0x13'));var logger=require(_0x45d8('0x14'))(_0x45d8('0x15'));var utils=require('../../config/utils');var config=require(_0x45d8('0x16'));var licenseUtil=require(_0x45d8('0x17'));var db=require(_0x45d8('0x18'))['db'];config['redis']=_[_0x45d8('0x19')](config['redis'],{'host':_0x45d8('0x1a'),'port':0x18eb});var socket=require(_0x45d8('0x1b'))(new Redis(config[_0x45d8('0x1c')]));require(_0x45d8('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x45d8('0x1e')][_0x45d8('0x1f')]({'port':0x232c});var client9002=jayson[_0x45d8('0x1e')][_0x45d8('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1ca540,_0x1b32fc,_0x3f5e9a,_0x226a38){return new BPromise(function(_0x48c667,_0x5d310b){var _0x424357=_0x226a38||client;return _0x424357[_0x45d8('0x20')](_0x1ca540,_0x3f5e9a)['then'](function(_0x5301ec){logger['info']('ChatMessage,\x20%s,\x20%s',_0x1b32fc,_0x45d8('0x21'));logger[_0x45d8('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1b32fc,_0x45d8('0x21'),JSON[_0x45d8('0x23')](_0x5301ec));if(_0x5301ec[_0x45d8('0x24')]){if(_0x5301ec[_0x45d8('0x24')]['code']===0x1f4){logger['error'](_0x45d8('0x25'),_0x1b32fc,_0x5301ec[_0x45d8('0x24')][_0x45d8('0x26')]);return _0x5d310b(_0x5301ec['error']['message']);}logger[_0x45d8('0x24')](_0x45d8('0x25'),_0x1b32fc,_0x5301ec[_0x45d8('0x24')][_0x45d8('0x26')]);return _0x48c667(_0x5301ec[_0x45d8('0x24')][_0x45d8('0x26')]);}else{logger[_0x45d8('0x27')]('ChatMessage,\x20%s,\x20%s',_0x1b32fc,_0x45d8('0x21'));_0x48c667(_0x5301ec['result'][_0x45d8('0x26')]);}})[_0x45d8('0x28')](function(_0x245754){logger[_0x45d8('0x24')]('ChatMessage,\x20%s,\x20%s',_0x1b32fc,_0x245754);_0x5d310b(_0x245754);});});}function respondWithStatusCode(_0x82037d,_0x34c011){_0x34c011=_0x34c011||0xcc;return function(_0x2d439f){if(_0x2d439f){return _0x82037d[_0x45d8('0x29')](_0x34c011);}return _0x82037d[_0x45d8('0x2a')](_0x34c011)['end']();};}function respondWithResult(_0x1f5f3a,_0x62fbba){_0x62fbba=_0x62fbba||0xc8;return function(_0x3e92bd){if(_0x3e92bd){return _0x1f5f3a[_0x45d8('0x2a')](_0x62fbba)[_0x45d8('0x2b')](_0x3e92bd);}};}function respondWithFilteredResult(_0x3c9683,_0x455164){return function(_0x1213f1){if(_0x1213f1){var _0x312267=_0x1213f1[_0x45d8('0x2c')],_0x4e3c0f=_0x455164['offset'],_0x2edb11=_0x455164['offset']+_0x455164[_0x45d8('0x2d')],_0x57a9e8;if(_0x2edb11>=_0x312267){_0x2edb11=_0x312267;_0x57a9e8=0xc8;}else{_0x57a9e8=0xce;}_0x3c9683[_0x45d8('0x2a')](_0x57a9e8);return _0x3c9683[_0x45d8('0x2e')](_0x45d8('0x2f'),_0x4e3c0f+'-'+_0x2edb11+'/'+_0x312267)[_0x45d8('0x2b')](_0x1213f1);}return null;};}function patchUpdates(_0x362b8c){return function(_0x4c65d8){try{jsonpatch[_0x45d8('0x30')](_0x4c65d8,_0x362b8c,!![]);}catch(_0x8de9b8){return BPromise[_0x45d8('0x31')](_0x8de9b8);}return _0x4c65d8['save']();};}function saveUpdates(_0x1e2156,_0xee4d10){return function(_0x308883){if(_0x308883){return _0x308883['update'](_0x1e2156)[_0x45d8('0x32')](function(_0x2d207c){return _0x2d207c;});}return null;};}function removeEntity(_0x9f6d4f,_0x59e3ba){return function(_0x5726a3){if(_0x5726a3){return _0x5726a3['destroy']()[_0x45d8('0x32')](function(){_0x9f6d4f[_0x45d8('0x2a')](0xcc)[_0x45d8('0x33')]();});}};}function handleEntityNotFound(_0x4feaa3,_0x35641c){return function(_0x6356c9){if(!_0x6356c9){_0x4feaa3[_0x45d8('0x29')](0x194);}return _0x6356c9;};}function handleError(_0x4157df,_0x1805f5){_0x1805f5=_0x1805f5||0x1f4;return function(_0x3c9cef){logger[_0x45d8('0x24')](_0x3c9cef[_0x45d8('0x34')]);if(_0x3c9cef['name']){delete _0x3c9cef['name'];}_0x4157df[_0x45d8('0x2a')](_0x1805f5)[_0x45d8('0x35')](_0x3c9cef);};}exports[_0x45d8('0x36')]=function(_0x467859,_0x34e996){var _0x2257fa={},_0x207b5f={},_0x4313b2={'count':0x0,'rows':[]};var _0x41b716=_[_0x45d8('0x37')](db[_0x45d8('0x38')][_0x45d8('0x39')],function(_0x56aaaa){return{'name':_0x56aaaa[_0x45d8('0x3a')],'type':_0x56aaaa[_0x45d8('0x3b')]['key']};});_0x207b5f[_0x45d8('0x3c')]=_[_0x45d8('0x37')](_0x41b716,_0x45d8('0x3d'));_0x207b5f[_0x45d8('0x3e')]=_['keys'](_0x467859[_0x45d8('0x3e')]);_0x207b5f[_0x45d8('0x3f')]=_[_0x45d8('0x40')](_0x207b5f[_0x45d8('0x3c')],_0x207b5f[_0x45d8('0x3e')]);_0x2257fa['attributes']=_[_0x45d8('0x40')](_0x207b5f[_0x45d8('0x3c')],qs['fields'](_0x467859[_0x45d8('0x3e')][_0x45d8('0x41')]));_0x2257fa[_0x45d8('0x42')]=_0x2257fa['attributes'][_0x45d8('0x43')]?_0x2257fa['attributes']:_0x207b5f['model'];if(!_0x467859['query'][_0x45d8('0x44')]('nolimit')){_0x2257fa['limit']=qs[_0x45d8('0x2d')](_0x467859['query'][_0x45d8('0x2d')]);_0x2257fa['offset']=qs[_0x45d8('0x45')](_0x467859[_0x45d8('0x3e')][_0x45d8('0x45')]);}_0x2257fa[_0x45d8('0x46')]=qs[_0x45d8('0x47')](_0x467859[_0x45d8('0x3e')][_0x45d8('0x47')]);_0x2257fa[_0x45d8('0x48')]=qs[_0x45d8('0x3f')](_[_0x45d8('0x49')](_0x467859[_0x45d8('0x3e')],_0x207b5f[_0x45d8('0x3f')]),_0x41b716);if(_0x467859[_0x45d8('0x3e')][_0x45d8('0x4a')]){_0x2257fa[_0x45d8('0x48')]=_[_0x45d8('0x4b')](_0x2257fa['where'],{'$or':_[_0x45d8('0x37')](_0x41b716,function(_0x2f373d){if(_0x2f373d[_0x45d8('0x3b')]!=='VIRTUAL'){var _0x126c01={};_0x126c01[_0x2f373d[_0x45d8('0x3d')]]={'$like':'%'+_0x467859[_0x45d8('0x3e')]['filter']+'%'};return _0x126c01;}})});}_0x2257fa=_[_0x45d8('0x4b')]({},_0x2257fa,_0x467859['options']);var _0x19b353={'where':_0x2257fa[_0x45d8('0x48')]};return db['ChatMessage']['count'](_0x19b353)[_0x45d8('0x32')](function(_0x49c977){_0x4313b2[_0x45d8('0x2c')]=_0x49c977;if(_0x467859[_0x45d8('0x3e')][_0x45d8('0x4c')]){_0x2257fa['include']=[{'all':!![]}];}return db[_0x45d8('0x38')][_0x45d8('0x4d')](_0x2257fa);})[_0x45d8('0x32')](function(_0x3dfb7f){_0x4313b2[_0x45d8('0x4e')]=_0x3dfb7f;return _0x4313b2;})[_0x45d8('0x32')](respondWithFilteredResult(_0x34e996,_0x2257fa))['catch'](handleError(_0x34e996,null));};exports[_0x45d8('0x4f')]=function(_0x4e2b82,_0x20af67){var _0x51dc1a={'raw':!![],'where':{'id':_0x4e2b82[_0x45d8('0x50')]['id']}},_0x322196={};_0x322196['model']=_[_0x45d8('0x51')](db[_0x45d8('0x38')][_0x45d8('0x39')]);_0x322196[_0x45d8('0x3e')]=_[_0x45d8('0x51')](_0x4e2b82[_0x45d8('0x3e')]);_0x322196[_0x45d8('0x3f')]=_[_0x45d8('0x40')](_0x322196[_0x45d8('0x3c')],_0x322196['query']);_0x51dc1a['attributes']=_[_0x45d8('0x40')](_0x322196[_0x45d8('0x3c')],qs[_0x45d8('0x41')](_0x4e2b82[_0x45d8('0x3e')][_0x45d8('0x41')]));_0x51dc1a[_0x45d8('0x42')]=_0x51dc1a['attributes'][_0x45d8('0x43')]?_0x51dc1a[_0x45d8('0x42')]:_0x322196[_0x45d8('0x3c')];if(_0x4e2b82['query'][_0x45d8('0x4c')]){_0x51dc1a[_0x45d8('0x52')]=[{'all':!![]}];}_0x51dc1a=_[_0x45d8('0x4b')]({},_0x51dc1a,_0x4e2b82[_0x45d8('0x53')]);return db['ChatMessage'][_0x45d8('0x54')](_0x51dc1a)['then'](handleEntityNotFound(_0x20af67,null))[_0x45d8('0x32')](respondWithResult(_0x20af67,null))[_0x45d8('0x28')](handleError(_0x20af67,null));};exports[_0x45d8('0x55')]=function(_0x5d8830,_0xdb4c){return db[_0x45d8('0x38')][_0x45d8('0x55')](_0x5d8830[_0x45d8('0x56')],{})[_0x45d8('0x32')](respondWithResult(_0xdb4c,0xc9))['catch'](handleError(_0xdb4c,null));};exports[_0x45d8('0x57')]=function(_0x255ce6,_0x325981){if(_0x255ce6['body']['id']){delete _0x255ce6[_0x45d8('0x56')]['id'];}return db[_0x45d8('0x38')][_0x45d8('0x54')]({'where':{'id':_0x255ce6[_0x45d8('0x50')]['id']}})[_0x45d8('0x32')](handleEntityNotFound(_0x325981,null))['then'](saveUpdates(_0x255ce6[_0x45d8('0x56')],null))[_0x45d8('0x32')](respondWithResult(_0x325981,null))[_0x45d8('0x28')](handleError(_0x325981,null));};exports[_0x45d8('0x58')]=function(_0xb4436f,_0x349796){return db[_0x45d8('0x38')][_0x45d8('0x54')]({'where':{'id':_0xb4436f[_0x45d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x349796,null))[_0x45d8('0x32')](removeEntity(_0x349796,null))[_0x45d8('0x28')](handleError(_0x349796,null));};exports['describe']=function(_0x2c5be2,_0x118fd8){return db['ChatMessage']['describe']()[_0x45d8('0x32')](respondWithResult(_0x118fd8,null))[_0x45d8('0x28')](handleError(_0x118fd8,null));};var interaction_log=require(_0x45d8('0x14'))('chat-interactions');exports['accept']=function(_0x5583ab,_0x364955,_0x423af5){var _0x13fe48={'channel':_0x45d8('0x59')};if(_0x5583ab[_0x45d8('0x56')]['id']){delete _0x5583ab['body']['id'];}_0x5583ab[_0x45d8('0x56')][_0x45d8('0x5a')]=!![];_0x5583ab['body'][_0x45d8('0x5b')]=moment()[_0x45d8('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x5583ab[_0x45d8('0x56')]['UserId']=_0x5583ab[_0x45d8('0x56')][_0x45d8('0x5d')]||_0x5583ab[_0x45d8('0x5e')]['id'];return db['ChatMessage'][_0x45d8('0x54')]({'where':{'id':_0x5583ab['params']['id'],'UserId':null},'include':[{'model':db[_0x45d8('0x5f')],'as':'Contact'}]})[_0x45d8('0x32')](handleEntityNotFound(_0x364955,null))['then'](saveUpdates(_0x5583ab[_0x45d8('0x56')],null))[_0x45d8('0x32')](function(_0x4553c1){if(_0x4553c1){_0x13fe48[_0x45d8('0x26')]=_0x4553c1[_0x45d8('0x60')]({'plain':!![]});return db[_0x45d8('0x61')][_0x45d8('0x54')]({'where':{'id':_0x4553c1[_0x45d8('0x62')]}});}return null;})[_0x45d8('0x32')](handleEntityNotFound(_0x364955,null))[_0x45d8('0x32')](function(_0x1b7d32){if(_0x1b7d32){return _0x1b7d32['update']({'UserId':_0x5583ab[_0x45d8('0x56')][_0x45d8('0x5d')],'read1stAt':_[_0x45d8('0x63')](_0x1b7d32[_0x45d8('0x64')])?moment()[_0x45d8('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x45d8('0x32')](function(_0x1bee78){if(_0x1bee78){_0x13fe48[_0x45d8('0x65')]=_0x1bee78['get']({'plain':!![]});interaction_log[_0x45d8('0x27')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5583ab[_0x45d8('0x5e')]['id'],_0x5583ab[_0x45d8('0x5e')][_0x45d8('0x3d')],_0x5583ab[_0x45d8('0x5e')][_0x45d8('0x66')],_0x13fe48[_0x45d8('0x65')]['id'],_0x5583ab['body']?JSON[_0x45d8('0x23')](_0x5583ab[_0x45d8('0x56')]):_0x45d8('0x67'));return respondWithRpcPromise(_0x45d8('0x68'),_0x45d8('0x69'),_0x13fe48);}return null;})[_0x45d8('0x32')](function(_0x3e43c3){if(_0x3e43c3){if(_0x5583ab['body'][_0x45d8('0x6a')]){_0x13fe48[_0x45d8('0x26')][_0x45d8('0x6b')]=util[_0x45d8('0x5c')](_0x45d8('0x6c'),_0x5583ab[_0x45d8('0x5e')][_0x45d8('0x3d')]);_0x13fe48[_0x45d8('0x26')][_0x45d8('0x6d')]=_0x13fe48[_0x45d8('0x6d')];_0x13fe48['message'][_0x45d8('0x6e')]=_0x45d8('0x6f');return respondWithRpcPromise(_0x45d8('0x70'),_0x45d8('0x70'),{'event':'acceptmessage','message':_['merge'](_0x13fe48['message'],JSON[_0x45d8('0x71')](_0x13fe48['interaction'][_0x45d8('0x72')]))},client9002)[_0x45d8('0x32')](function(){return _0x13fe48;});}return _0x13fe48;}return null;})[_0x45d8('0x32')](respondWithResult(_0x364955,null))[_0x45d8('0x28')](handleError(_0x364955,null));};var interaction_log=require(_0x45d8('0x14'))(_0x45d8('0x73'));exports[_0x45d8('0x31')]=function(_0xf44b75,_0x5b6e08,_0x502d2c){var _0x2ec559={'agent':{},'channel':_0x45d8('0x59')};if(_0xf44b75[_0x45d8('0x56')]['id']){delete _0xf44b75['body']['id'];}_0xf44b75[_0x45d8('0x56')]['UserId']=_0xf44b75[_0x45d8('0x56')][_0x45d8('0x5d')]||_0xf44b75['user']['id'];_0x2ec559[_0x45d8('0x74')]['id']=_0xf44b75[_0x45d8('0x56')]['UserId'];return db[_0x45d8('0x38')][_0x45d8('0x54')]({'where':{'id':_0xf44b75[_0x45d8('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b6e08,null))[_0x45d8('0x32')](function(_0x32cd2f){if(_0x32cd2f){_0x2ec559['message']=_0x32cd2f['get']({'plain':!![]});return db[_0x45d8('0x61')][_0x45d8('0x54')]({'where':{'id':_0x32cd2f['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5b6e08,null))[_0x45d8('0x32')](function(_0x59d3a8){if(_0x59d3a8){_0x2ec559['interaction']=_0x59d3a8[_0x45d8('0x60')]({'plain':!![]});interaction_log[_0x45d8('0x27')](_0x45d8('0x75'),_0xf44b75[_0x45d8('0x5e')]['id'],_0xf44b75[_0x45d8('0x5e')]['name'],_0xf44b75[_0x45d8('0x5e')][_0x45d8('0x66')],_0x2ec559['interaction']['id'],_0xf44b75['body']?JSON['stringify'](_0xf44b75[_0x45d8('0x56')]):'null');return respondWithRpcPromise(_0x45d8('0x76'),_0x45d8('0x77'),_0x2ec559);}return null;})[_0x45d8('0x32')](function(_0x405e3a){if(_0x405e3a){_0x405e3a['message']['interface']=util['format']('SIP/%s',_0xf44b75['user']['name']);_0x405e3a[_0x45d8('0x26')]['channel']=_0x2ec559[_0x45d8('0x6d')];_0x405e3a[_0x45d8('0x26')][_0x45d8('0x6e')]=_0x45d8('0x31');respondWithRpcPromise(_0x45d8('0x70'),_0x45d8('0x70'),{'event':_0x45d8('0x78'),'message':_0x405e3a[_0x45d8('0x26')]},client9002);return _0x2ec559;}return null;})[_0x45d8('0x32')](respondWithResult(_0x5b6e08,null))[_0x45d8('0x28')](handleError(_0x5b6e08,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index b97c780..3b0a96f 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 _0xaa1f=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xaa1f,0xde));var _0xfaa1=function(_0xccf1b4,_0x43b32d){_0xccf1b4=_0xccf1b4-0x0;var _0x13f1ab=_0xaa1f[_0xccf1b4];return _0x13f1ab;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xfaa1('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xfaa1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfaa1('0x2'),'afterDestroy':_0xfaa1('0x3')};function emitEvent(_0x4e6515){return function(_0x599bf6,_0x42412e,_0x22bd18){ChatMessageEvents[_0xfaa1('0x4')](_0x4e6515+':'+_0x599bf6['id'],_0x599bf6);ChatMessageEvents['emit'](_0x4e6515,_0x599bf6);_0x22bd18(null);};}for(var e in events){if(events[_0xfaa1('0x5')](e)){var event=events[e];ChatMessage[_0xfaa1('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xfc18=['hook','exports','events','ChatMessage','save','update','emit','hasOwnProperty'];(function(_0x4fa08c,_0x30cac4){var _0x7a920a=function(_0x213fd1){while(--_0x213fd1){_0x4fa08c['push'](_0x4fa08c['shift']());}};_0x7a920a(++_0x30cac4);}(_0xfc18,0xa2));var _0x8fc1=function(_0x1b92a6,_0x14444b){_0x1b92a6=_0x1b92a6-0x0;var _0x24be5b=_0xfc18[_0x1b92a6];return _0x24be5b;};'use strict';var EventEmitter=require(_0x8fc1('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x8fc1('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8fc1('0x2'),'afterUpdate':_0x8fc1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3e800c){return function(_0x5e9fe3,_0x15d03e,_0x139e69){ChatMessageEvents[_0x8fc1('0x4')](_0x3e800c+':'+_0x5e9fe3['id'],_0x5e9fe3);ChatMessageEvents['emit'](_0x3e800c,_0x5e9fe3);_0x139e69(null);};}for(var e in events){if(events[_0x8fc1('0x5')](e)){var event=events[e];ChatMessage[_0x8fc1('0x6')](e,emitEvent(event));}}module[_0x8fc1('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index fbbfbda..442ecd0 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 _0x64b6=['UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','models','direction','toLowerCase','secret'];(function(_0x3a6c31,_0xd178e2){var _0xf99bc9=function(_0x38b90a){while(--_0x38b90a){_0x3a6c31['push'](_0x3a6c31['shift']());}};_0xf99bc9(++_0xd178e2);}(_0x64b6,0x13d));var _0x664b=function(_0x7a6aed,_0x335e68){_0x7a6aed=_0x7a6aed-0x0;var _0x9dbabf=_0x64b6[_0x7a6aed];return _0x9dbabf;};'use strict';var _=require(_0x664b('0x0'));var util=require('util');var logger=require(_0x664b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x664b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x664b('0x3'));var config=require(_0x664b('0x4'));var attributes=require(_0x664b('0x5'));module['exports']=function(_0x268a35,_0x268e73){return _0x268a35[_0x664b('0x6')](_0x664b('0x7'),attributes,{'tableName':_0x664b('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3949e0,_0x993dad,_0x356727){var _0x53a28a=_0x268a35[_0x664b('0x9')];var _0x916a3c=_0x3949e0['get']({'plain':!![]});if(_0x916a3c[_0x664b('0xa')][_0x664b('0xb')]()==='in'||_0x916a3c['direction'][_0x664b('0xb')]()==='out'&&!_0x916a3c[_0x664b('0xc')]&&!_['isNil'](_0x916a3c[_0x664b('0xd')])){_0x53a28a[_0x664b('0xe')]['findOne']({'where':{'id':_0x916a3c[_0x664b('0xf')]}})[_0x664b('0x10')](function(_0x5f2ec1){if(_0x5f2ec1){_0x5f2ec1[_0x664b('0x11')]({'lastMsgAt':_0x916a3c[_0x664b('0x12')],'lastMsgDirection':_0x916a3c['direction']['toLowerCase']()});}})[_0x664b('0x13')](function(_0x56e0fa){console['error'](_0x56e0fa);});}_0x356727();}},'charset':_0x664b('0x14'),'collate':_0x664b('0x15')});}; \ No newline at end of file +var _0xd01d=['models','direction','toLowerCase','secret','isNil','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','chat_messages','fti_chat_messages','body'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xd01d,0x1b2));var _0xdd01=function(_0x154d33,_0x1fbe10){_0x154d33=_0x154d33-0x0;var _0x300ce6=_0xd01d[_0x154d33];return _0x300ce6;};'use strict';var _=require(_0xdd01('0x0'));var util=require(_0xdd01('0x1'));var logger=require(_0xdd01('0x2'))(_0xdd01('0x3'));var moment=require(_0xdd01('0x4'));var BPromise=require(_0xdd01('0x5'));var rp=require(_0xdd01('0x6'));var fs=require('fs');var path=require(_0xdd01('0x7'));var rimraf=require(_0xdd01('0x8'));var config=require(_0xdd01('0x9'));var attributes=require(_0xdd01('0xa'));module[_0xdd01('0xb')]=function(_0x1728dd,_0x27ccf3){return _0x1728dd[_0xdd01('0xc')]('ChatMessage',attributes,{'tableName':_0xdd01('0xd'),'paranoid':![],'indexes':[{'name':_0xdd01('0xe'),'fields':[_0xdd01('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56e2ec,_0x5dd662,_0x3d0cbe){var _0x2cf00d=_0x1728dd[_0xdd01('0x10')];var _0x1489fb=_0x56e2ec['get']({'plain':!![]});if(_0x1489fb[_0xdd01('0x11')][_0xdd01('0x12')]()==='in'||_0x1489fb[_0xdd01('0x11')][_0xdd01('0x12')]()==='out'&&!_0x1489fb[_0xdd01('0x13')]&&!_[_0xdd01('0x14')](_0x1489fb['UserId'])){_0x2cf00d[_0xdd01('0x15')]['findOne']({'where':{'id':_0x1489fb[_0xdd01('0x16')]}})[_0xdd01('0x17')](function(_0x33f1f7){if(_0x33f1f7){_0x33f1f7[_0xdd01('0x18')]({'lastMsgAt':_0x1489fb[_0xdd01('0x19')],'lastMsgDirection':_0x1489fb[_0xdd01('0x11')][_0xdd01('0x12')]()});}})[_0xdd01('0x1a')](function(_0x1c6987){console[_0xdd01('0x1b')](_0x1c6987);});}_0x3d0cbe();}},'charset':_0xdd01('0x1c'),'collate':_0xdd01('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 049bea0..f953f0f 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 _0x1c53=['debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateChatMessage','ChatMessage','body','options','then'];(function(_0x42c7f4,_0x4898f4){var _0x51cdd9=function(_0x35d53d){while(--_0x35d53d){_0x42c7f4['push'](_0x42c7f4['shift']());}};_0x51cdd9(++_0x4898f4);}(_0x1c53,0x18e));var _0x31c5=function(_0x172a34,_0x587d42){_0x172a34=_0x172a34-0x0;var _0x5d2b80=_0x1c53[_0x172a34];return _0x5d2b80;};'use strict';var _=require(_0x31c5('0x0'));var util=require(_0x31c5('0x1'));var moment=require(_0x31c5('0x2'));var BPromise=require(_0x31c5('0x3'));var rs=require(_0x31c5('0x4'));var fs=require('fs');var Redis=require(_0x31c5('0x5'));var db=require(_0x31c5('0x6'))['db'];var utils=require(_0x31c5('0x7'));var logger=require(_0x31c5('0x8'))(_0x31c5('0x9'));var config=require(_0x31c5('0xa'));var jayson=require(_0x31c5('0xb'));var client=jayson[_0x31c5('0xc')][_0x31c5('0xd')]({'port':0x232a});config[_0x31c5('0xe')]=_[_0x31c5('0xf')](config[_0x31c5('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x31c5('0x10'))(new Redis(config[_0x31c5('0xe')]));require(_0x31c5('0x11'))[_0x31c5('0x12')](socket);function respondWithRpcPromise(_0x36dd24,_0x5bb402,_0x3b03af){return new BPromise(function(_0x36e25e,_0x1e6389){return client[_0x31c5('0x13')](_0x36dd24,_0x3b03af)['then'](function(_0x1f94d6){logger['info'](_0x31c5('0x14'),_0x5bb402,_0x31c5('0x15'));logger['debug'](_0x31c5('0x16'),_0x5bb402,_0x31c5('0x15'),JSON['stringify'](_0x1f94d6));if(_0x1f94d6[_0x31c5('0x17')]){if(_0x1f94d6[_0x31c5('0x17')]['code']===0x1f4){logger[_0x31c5('0x17')](_0x31c5('0x14'),_0x5bb402,_0x1f94d6[_0x31c5('0x17')][_0x31c5('0x18')]);return _0x1e6389(_0x1f94d6[_0x31c5('0x17')][_0x31c5('0x18')]);}logger[_0x31c5('0x17')](_0x31c5('0x14'),_0x5bb402,_0x1f94d6[_0x31c5('0x17')][_0x31c5('0x18')]);return _0x36e25e(_0x1f94d6['error']['message']);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x5bb402,_0x31c5('0x15'));_0x36e25e(_0x1f94d6[_0x31c5('0x19')][_0x31c5('0x18')]);}})['catch'](function(_0x486201){logger[_0x31c5('0x17')](_0x31c5('0x14'),_0x5bb402,_0x486201);_0x1e6389(_0x486201);});});}exports[_0x31c5('0x1a')]=function(_0x256afb){var _0x34a348=this;return new Promise(function(_0x500448,_0x46630f){return db[_0x31c5('0x1b')]['create'](_0x256afb[_0x31c5('0x1c')],{'raw':_0x256afb[_0x31c5('0x1d')]?_0x256afb['options']['raw']===undefined?!![]:![]:!![]})[_0x31c5('0x1e')](function(_0x5b3659){logger['info']('CreateChatMessage',_0x256afb);logger[_0x31c5('0x1f')](_0x31c5('0x1a'),_0x256afb,JSON['stringify'](_0x5b3659));_0x500448(_0x5b3659);})[_0x31c5('0x20')](function(_0x197f6d){logger[_0x31c5('0x17')](_0x31c5('0x1a'),_0x197f6d[_0x31c5('0x18')],_0x256afb);_0x46630f(_0x34a348[_0x31c5('0x17')](0x1f4,_0x197f6d['message']));});});}; \ No newline at end of file +var _0x3026=['message','result','catch','CreateChatMessage','body','options','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s'];(function(_0x7f878d,_0x52e6b8){var _0xb81fb4=function(_0xdb6d73){while(--_0xdb6d73){_0x7f878d['push'](_0x7f878d['shift']());}};_0xb81fb4(++_0x52e6b8);}(_0x3026,0xe0));var _0x6302=function(_0x4802ac,_0xf1b1cf){_0x4802ac=_0x4802ac-0x0;var _0x2055ea=_0x3026[_0x4802ac];return _0x2055ea;};'use strict';var _=require(_0x6302('0x0'));var util=require(_0x6302('0x1'));var moment=require(_0x6302('0x2'));var BPromise=require('bluebird');var rs=require(_0x6302('0x3'));var fs=require('fs');var Redis=require(_0x6302('0x4'));var db=require(_0x6302('0x5'))['db'];var utils=require(_0x6302('0x6'));var logger=require(_0x6302('0x7'))(_0x6302('0x8'));var config=require(_0x6302('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x6302('0xa')]=_['defaults'](config['redis'],{'host':_0x6302('0xb'),'port':0x18eb});var socket=require(_0x6302('0xc'))(new Redis(config[_0x6302('0xa')]));require(_0x6302('0xd'))[_0x6302('0xe')](socket);function respondWithRpcPromise(_0x2e02a2,_0x4a481a,_0x2d36f2){return new BPromise(function(_0x5be8ee,_0x405ea2){return client[_0x6302('0xf')](_0x2e02a2,_0x2d36f2)['then'](function(_0x46a320){logger[_0x6302('0x10')]('ChatMessage,\x20%s,\x20%s',_0x4a481a,_0x6302('0x11'));logger[_0x6302('0x12')](_0x6302('0x13'),_0x4a481a,_0x6302('0x11'),JSON[_0x6302('0x14')](_0x46a320));if(_0x46a320['error']){if(_0x46a320[_0x6302('0x15')][_0x6302('0x16')]===0x1f4){logger['error'](_0x6302('0x17'),_0x4a481a,_0x46a320[_0x6302('0x15')]['message']);return _0x405ea2(_0x46a320[_0x6302('0x15')][_0x6302('0x18')]);}logger[_0x6302('0x15')](_0x6302('0x17'),_0x4a481a,_0x46a320[_0x6302('0x15')]['message']);return _0x5be8ee(_0x46a320['error'][_0x6302('0x18')]);}else{logger[_0x6302('0x10')](_0x6302('0x17'),_0x4a481a,'request\x20sent');_0x5be8ee(_0x46a320[_0x6302('0x19')][_0x6302('0x18')]);}})[_0x6302('0x1a')](function(_0x597640){logger[_0x6302('0x15')]('ChatMessage,\x20%s,\x20%s',_0x4a481a,_0x597640);_0x405ea2(_0x597640);});});}exports[_0x6302('0x1b')]=function(_0x1e9cef){var _0x516c57=this;return new Promise(function(_0x4ede6b,_0x5c8a55){return db['ChatMessage']['create'](_0x1e9cef[_0x6302('0x1c')],{'raw':_0x1e9cef[_0x6302('0x1d')]?_0x1e9cef[_0x6302('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x6302('0x1e')](function(_0x12a843){logger[_0x6302('0x10')](_0x6302('0x1b'),_0x1e9cef);logger['debug'](_0x6302('0x1b'),_0x1e9cef,JSON[_0x6302('0x14')](_0x12a843));_0x4ede6b(_0x12a843);})[_0x6302('0x1a')](function(_0x10be7a){logger['error']('CreateChatMessage',_0x10be7a[_0x6302('0x18')],_0x1e9cef);_0x5c8a55(_0x516c57[_0x6302('0x15')](0x1f4,_0x10be7a[_0x6302('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 19abcdc..5849c0d 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 _0xc2c7=['register','chatMessage:','save','remove','update','emit'];(function(_0x5b7f4d,_0x1370b6){var _0x296966=function(_0x4d982b){while(--_0x4d982b){_0x5b7f4d['push'](_0x5b7f4d['shift']());}};_0x296966(++_0x1370b6);}(_0xc2c7,0x134));var _0x7c2c=function(_0x271de4,_0x197b86){_0x271de4=_0x271de4-0x0;var _0x4f80c7=_0xc2c7[_0x271de4];return _0x4f80c7;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x7c2c('0x0'),_0x7c2c('0x1'),_0x7c2c('0x2')];function createListener(_0x330870,_0x380d13){return function(_0x237e4d){_0x380d13[_0x7c2c('0x3')](_0x330870,_0x237e4d);};}function removeListener(_0x116f8a,_0x4bbc14){return function(){ChatMessageEvents['removeListener'](_0x116f8a,_0x4bbc14);};}exports[_0x7c2c('0x4')]=function(_0x42ecc9){for(var _0x23c038=0x0,_0x54f027=events['length'];_0x23c038<_0x54f027;_0x23c038++){var _0x5a1027=events[_0x23c038];var _0x2274cd=createListener(_0x7c2c('0x5')+_0x5a1027,_0x42ecc9);ChatMessageEvents['on'](_0x5a1027,_0x2274cd);}}; \ No newline at end of file +var _0x1967=['remove','update','emit','removeListener','length','save'];(function(_0x1fba44,_0x19210a){var _0x2e0606=function(_0x3db95d){while(--_0x3db95d){_0x1fba44['push'](_0x1fba44['shift']());}};_0x2e0606(++_0x19210a);}(_0x1967,0x173));var _0x7196=function(_0x32ef2e,_0x19aeb6){_0x32ef2e=_0x32ef2e-0x0;var _0x4aa9d0=_0x1967[_0x32ef2e];return _0x4aa9d0;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2')];function createListener(_0x35803d,_0x3319fa){return function(_0xa80a3f){_0x3319fa[_0x7196('0x3')](_0x35803d,_0xa80a3f);};}function removeListener(_0x1aaddd,_0x458ae8){return function(){ChatMessageEvents[_0x7196('0x4')](_0x1aaddd,_0x458ae8);};}exports['register']=function(_0x36b01e){for(var _0x186175=0x0,_0x194746=events[_0x7196('0x5')];_0x186175<_0x194746;_0x186175++){var _0x266a6e=events[_0x186175];var _0xad78a=createListener('chatMessage:'+_0x266a6e,_0x36b01e);ChatMessageEvents['on'](_0x266a6e,_0xad78a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 244b330..0666048 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 _0x1d7d=['/:id/reject','delete','/:id','destroy','exports','multer','util','path','Router','../../components/interaction/service','./chatMessage.controller','isAuthenticated','index','get','/describe','show','tracked','chat','chatmessage:create','create','update','/:id/accept','accept','put'];(function(_0x85d56d,_0x37f5c1){var _0x51f613=function(_0x4927df){while(--_0x4927df){_0x85d56d['push'](_0x85d56d['shift']());}};_0x51f613(++_0x37f5c1);}(_0x1d7d,0x1b5));var _0xd1d7=function(_0x41558a,_0x2950e5){_0x41558a=_0x41558a-0x0;var _0x371c3e=_0x1d7d[_0x41558a];return _0x371c3e;};'use strict';var multer=require(_0xd1d7('0x0'));var util=require(_0xd1d7('0x1'));var path=require(_0xd1d7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd1d7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd1d7('0x4'));var config=require('../../config/environment');var controller=require(_0xd1d7('0x5'));router['get']('/',auth[_0xd1d7('0x6')](),controller[_0xd1d7('0x7')]);router[_0xd1d7('0x8')](_0xd1d7('0x9'),auth[_0xd1d7('0x6')](),controller['describe']);router['get']('/:id',auth[_0xd1d7('0x6')](),controller[_0xd1d7('0xa')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xd1d7('0xb')](_0xd1d7('0xc'),_0xd1d7('0xd')),controller[_0xd1d7('0xe')]);router['put']('/:id',controller[_0xd1d7('0xf')]);router['put'](_0xd1d7('0x10'),auth[_0xd1d7('0x6')](),controller[_0xd1d7('0x11')]);router[_0xd1d7('0x12')](_0xd1d7('0x13'),auth[_0xd1d7('0x6')](),controller['reject']);router[_0xd1d7('0x14')](_0xd1d7('0x15'),auth[_0xd1d7('0x6')](),controller[_0xd1d7('0x16')]);module[_0xd1d7('0x17')]=router; \ No newline at end of file +var _0x35a6=['get','isAuthenticated','index','/:id','show','post','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatMessage.controller'];(function(_0x53ed59,_0x4beb34){var _0x5834ca=function(_0x5f51f0){while(--_0x5f51f0){_0x53ed59['push'](_0x53ed59['shift']());}};_0x5834ca(++_0x4beb34);}(_0x35a6,0x13b));var _0x635a=function(_0x718eaf,_0x41155c){_0x718eaf=_0x718eaf-0x0;var _0x1e4944=_0x35a6[_0x718eaf];return _0x1e4944;};'use strict';var multer=require(_0x635a('0x0'));var util=require('util');var path=require(_0x635a('0x1'));var timeout=require(_0x635a('0x2'));var express=require(_0x635a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x635a('0x4'));var config=require(_0x635a('0x5'));var controller=require(_0x635a('0x6'));router[_0x635a('0x7')]('/',auth[_0x635a('0x8')](),controller[_0x635a('0x9')]);router[_0x635a('0x7')]('/describe',auth[_0x635a('0x8')](),controller['describe']);router[_0x635a('0x7')](_0x635a('0xa'),auth[_0x635a('0x8')](),controller[_0x635a('0xb')]);router[_0x635a('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x635a('0xd'),_0x635a('0xe')),controller['create']);router[_0x635a('0xf')](_0x635a('0xa'),controller[_0x635a('0x10')]);router['put'](_0x635a('0x11'),auth['isAuthenticated'](),controller[_0x635a('0x12')]);router[_0x635a('0xf')](_0x635a('0x13'),auth[_0x635a('0x8')](),controller[_0x635a('0x14')]);router['delete'](_0x635a('0xa'),auth['isAuthenticated'](),controller[_0x635a('0x15')]);module[_0x635a('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 71b26fb..44b9d03 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 _0xb029=['exports','TEXT','medium'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0xb029,0x8a));var _0x9b02=function(_0x368084,_0x401d23){_0x368084=_0x368084-0x0;var _0x2e4477=_0xb029[_0x368084];return _0x2e4477;};'use strict';var Sequelize=require('sequelize');module[_0x9b02('0x0')]={'body':{'type':Sequelize[_0x9b02('0x1')](_0x9b02('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x5981=['medium','sequelize','exports'];(function(_0x465fac,_0x442b2e){var _0x24282d=function(_0x39dd44){while(--_0x39dd44){_0x465fac['push'](_0x465fac['shift']());}};_0x24282d(++_0x442b2e);}(_0x5981,0x163));var _0x1598=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5981[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1598('0x0'));module[_0x1598('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1598('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index ef32ae2..7959dd8 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 _0xc648=['bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','Content-Range','json','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','ChatOfflineMessage','includeAll','include','findAll','rows','show','params','keys','fields','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc648,0x171));var _0x8c64=function(_0xed4430,_0x28d1e4){_0xed4430=_0xed4430-0x0;var _0x82a008=_0xc648[_0xed4430];return _0x82a008;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c64('0x0'));var rimraf=require(_0x8c64('0x1'));var zipdir=require(_0x8c64('0x2'));var jsonpatch=require(_0x8c64('0x3'));var rp=require(_0x8c64('0x4'));var moment=require(_0x8c64('0x5'));var BPromise=require(_0x8c64('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8c64('0x7'));var csv=require(_0x8c64('0x8'));var ejs=require(_0x8c64('0x9'));var fs=require('fs');var _=require(_0x8c64('0xa'));var squel=require('squel');var crypto=require(_0x8c64('0xb'));var jsforce=require(_0x8c64('0xc'));var deskjs=require(_0x8c64('0xd'));var toCsv=require(_0x8c64('0x8'));var querystring=require(_0x8c64('0xe'));var Papa=require('papaparse');var Redis=require(_0x8c64('0xf'));var authService=require(_0x8c64('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c64('0x11'));var hardwareService=require(_0x8c64('0x12'));var logger=require(_0x8c64('0x13'))(_0x8c64('0x14'));var utils=require(_0x8c64('0x15'));var config=require(_0x8c64('0x16'));var licenseUtil=require(_0x8c64('0x17'));var db=require(_0x8c64('0x18'))['db'];function respondWithStatusCode(_0x3834e6,_0x19a173){_0x19a173=_0x19a173||0xcc;return function(_0x54e0f0){if(_0x54e0f0){return _0x3834e6[_0x8c64('0x19')](_0x19a173);}return _0x3834e6[_0x8c64('0x1a')](_0x19a173)[_0x8c64('0x1b')]();};}function respondWithResult(_0x36e227,_0x3a4cbf){_0x3a4cbf=_0x3a4cbf||0xc8;return function(_0xeb374){if(_0xeb374){return _0x36e227[_0x8c64('0x1a')](_0x3a4cbf)['json'](_0xeb374);}};}function respondWithFilteredResult(_0x14df4a,_0x16c84e){return function(_0x4dbf8d){if(_0x4dbf8d){var _0xfacf06=_0x4dbf8d[_0x8c64('0x1c')],_0x232c95=_0x16c84e['offset'],_0x4cd286=_0x16c84e['offset']+_0x16c84e[_0x8c64('0x1d')],_0x2c3739;if(_0x4cd286>=_0xfacf06){_0x4cd286=_0xfacf06;_0x2c3739=0xc8;}else{_0x2c3739=0xce;}_0x14df4a[_0x8c64('0x1a')](_0x2c3739);return _0x14df4a['set'](_0x8c64('0x1e'),_0x232c95+'-'+_0x4cd286+'/'+_0xfacf06)[_0x8c64('0x1f')](_0x4dbf8d);}return null;};}function patchUpdates(_0x550d38){return function(_0x4d7350){try{jsonpatch['apply'](_0x4d7350,_0x550d38,!![]);}catch(_0xb94635){return BPromise['reject'](_0xb94635);}return _0x4d7350['save']();};}function saveUpdates(_0x45839d,_0x6d288f){return function(_0x400b92){if(_0x400b92){return _0x400b92[_0x8c64('0x20')](_0x45839d)[_0x8c64('0x21')](function(_0x17a1ab){return _0x17a1ab;});}return null;};}function removeEntity(_0x4e7853,_0x28b7dd){return function(_0x51c459){if(_0x51c459){return _0x51c459[_0x8c64('0x22')]()['then'](function(){_0x4e7853[_0x8c64('0x1a')](0xcc)[_0x8c64('0x1b')]();});}};}function handleEntityNotFound(_0x4b2f7b,_0x400bf7){return function(_0x1300b4){if(!_0x1300b4){_0x4b2f7b[_0x8c64('0x19')](0x194);}return _0x1300b4;};}function handleError(_0x55e11c,_0x84ac89){_0x84ac89=_0x84ac89||0x1f4;return function(_0x4ddd8f){logger[_0x8c64('0x23')](_0x4ddd8f[_0x8c64('0x24')]);if(_0x4ddd8f[_0x8c64('0x25')]){delete _0x4ddd8f[_0x8c64('0x25')];}_0x55e11c[_0x8c64('0x1a')](_0x84ac89)['send'](_0x4ddd8f);};}exports[_0x8c64('0x26')]=function(_0x5cf51b,_0x4c1367){var _0x3649f9={},_0x5ec6a0={},_0x33027f={'count':0x0,'rows':[]};var _0x1b4c9d=_[_0x8c64('0x27')](db['ChatOfflineMessage'][_0x8c64('0x28')],function(_0x2d7548){return{'name':_0x2d7548[_0x8c64('0x29')],'type':_0x2d7548[_0x8c64('0x2a')][_0x8c64('0x2b')]};});_0x5ec6a0[_0x8c64('0x2c')]=_[_0x8c64('0x27')](_0x1b4c9d,_0x8c64('0x25'));_0x5ec6a0['query']=_['keys'](_0x5cf51b['query']);_0x5ec6a0[_0x8c64('0x2d')]=_[_0x8c64('0x2e')](_0x5ec6a0[_0x8c64('0x2c')],_0x5ec6a0[_0x8c64('0x2f')]);_0x3649f9['attributes']=_[_0x8c64('0x2e')](_0x5ec6a0[_0x8c64('0x2c')],qs['fields'](_0x5cf51b[_0x8c64('0x2f')]['fields']));_0x3649f9['attributes']=_0x3649f9[_0x8c64('0x30')][_0x8c64('0x31')]?_0x3649f9['attributes']:_0x5ec6a0['model'];if(!_0x5cf51b['query'][_0x8c64('0x32')](_0x8c64('0x33'))){_0x3649f9[_0x8c64('0x1d')]=qs[_0x8c64('0x1d')](_0x5cf51b[_0x8c64('0x2f')][_0x8c64('0x1d')]);_0x3649f9[_0x8c64('0x34')]=qs[_0x8c64('0x34')](_0x5cf51b[_0x8c64('0x2f')]['offset']);}_0x3649f9[_0x8c64('0x35')]=qs[_0x8c64('0x36')](_0x5cf51b[_0x8c64('0x2f')]['sort']);_0x3649f9[_0x8c64('0x37')]=qs[_0x8c64('0x2d')](_[_0x8c64('0x38')](_0x5cf51b['query'],_0x5ec6a0[_0x8c64('0x2d')]),_0x1b4c9d);if(_0x5cf51b[_0x8c64('0x2f')][_0x8c64('0x39')]){_0x3649f9[_0x8c64('0x37')]=_[_0x8c64('0x3a')](_0x3649f9[_0x8c64('0x37')],{'$or':_[_0x8c64('0x27')](_0x1b4c9d,function(_0x2d1811){if(_0x2d1811[_0x8c64('0x2a')]!==_0x8c64('0x3b')){var _0x2d84da={};_0x2d84da[_0x2d1811[_0x8c64('0x25')]]={'$like':'%'+_0x5cf51b[_0x8c64('0x2f')][_0x8c64('0x39')]+'%'};return _0x2d84da;}})});}_0x3649f9=_['merge']({},_0x3649f9,_0x5cf51b['options']);var _0x444a5b={'where':_0x3649f9[_0x8c64('0x37')]};return db[_0x8c64('0x3c')][_0x8c64('0x1c')](_0x444a5b)['then'](function(_0x46e491){_0x33027f[_0x8c64('0x1c')]=_0x46e491;if(_0x5cf51b[_0x8c64('0x2f')][_0x8c64('0x3d')]){_0x3649f9[_0x8c64('0x3e')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x8c64('0x3f')](_0x3649f9);})[_0x8c64('0x21')](function(_0x5348b3){_0x33027f[_0x8c64('0x40')]=_0x5348b3;return _0x33027f;})['then'](respondWithFilteredResult(_0x4c1367,_0x3649f9))['catch'](handleError(_0x4c1367,null));};exports[_0x8c64('0x41')]=function(_0x1b3b11,_0x5f3c6d){var _0x1d2dd6={'raw':!![],'where':{'id':_0x1b3b11[_0x8c64('0x42')]['id']}},_0x38163e={};_0x38163e[_0x8c64('0x2c')]=_[_0x8c64('0x43')](db[_0x8c64('0x3c')][_0x8c64('0x28')]);_0x38163e[_0x8c64('0x2f')]=_[_0x8c64('0x43')](_0x1b3b11[_0x8c64('0x2f')]);_0x38163e[_0x8c64('0x2d')]=_['intersection'](_0x38163e[_0x8c64('0x2c')],_0x38163e[_0x8c64('0x2f')]);_0x1d2dd6[_0x8c64('0x30')]=_['intersection'](_0x38163e[_0x8c64('0x2c')],qs[_0x8c64('0x44')](_0x1b3b11[_0x8c64('0x2f')]['fields']));_0x1d2dd6[_0x8c64('0x30')]=_0x1d2dd6[_0x8c64('0x30')][_0x8c64('0x31')]?_0x1d2dd6[_0x8c64('0x30')]:_0x38163e[_0x8c64('0x2c')];if(_0x1b3b11[_0x8c64('0x2f')]['includeAll']){_0x1d2dd6[_0x8c64('0x3e')]=[{'all':!![]}];}_0x1d2dd6=_[_0x8c64('0x3a')]({},_0x1d2dd6,_0x1b3b11[_0x8c64('0x45')]);return db[_0x8c64('0x3c')][_0x8c64('0x46')](_0x1d2dd6)[_0x8c64('0x21')](handleEntityNotFound(_0x5f3c6d,null))[_0x8c64('0x21')](respondWithResult(_0x5f3c6d,null))[_0x8c64('0x47')](handleError(_0x5f3c6d,null));};exports[_0x8c64('0x48')]=function(_0x1697fd,_0x2385eb){return db[_0x8c64('0x3c')][_0x8c64('0x48')](_0x1697fd[_0x8c64('0x49')],{})[_0x8c64('0x21')](respondWithResult(_0x2385eb,0xc9))['catch'](handleError(_0x2385eb,null));};exports[_0x8c64('0x20')]=function(_0x3c0ee7,_0x10ee57){if(_0x3c0ee7[_0x8c64('0x49')]['id']){delete _0x3c0ee7[_0x8c64('0x49')]['id'];}return db[_0x8c64('0x3c')]['find']({'where':{'id':_0x3c0ee7[_0x8c64('0x42')]['id']}})[_0x8c64('0x21')](handleEntityNotFound(_0x10ee57,null))[_0x8c64('0x21')](saveUpdates(_0x3c0ee7[_0x8c64('0x49')],null))[_0x8c64('0x21')](respondWithResult(_0x10ee57,null))[_0x8c64('0x47')](handleError(_0x10ee57,null));};exports[_0x8c64('0x22')]=function(_0x4ac42d,_0x2e8082){return db[_0x8c64('0x3c')]['find']({'where':{'id':_0x4ac42d['params']['id']}})[_0x8c64('0x21')](handleEntityNotFound(_0x2e8082,null))[_0x8c64('0x21')](removeEntity(_0x2e8082,null))[_0x8c64('0x47')](handleError(_0x2e8082,null));};exports[_0x8c64('0x4a')]=function(_0xa38f40,_0x411850){return db[_0x8c64('0x3c')]['describe']()[_0x8c64('0x21')](respondWithResult(_0x411850,null))[_0x8c64('0x47')](handleError(_0x411850,null));}; \ No newline at end of file +var _0x671e=['bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','ChatOfflineMessage','rows','catch','show','length','body','find','params','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x27f5de,_0x577080){var _0x484149=function(_0x7e9adb){while(--_0x7e9adb){_0x27f5de['push'](_0x27f5de['shift']());}};_0x484149(++_0x577080);}(_0x671e,0xd6));var _0xe671=function(_0x1a8770,_0x344224){_0x1a8770=_0x1a8770-0x0;var _0x1528ef=_0x671e[_0x1a8770];return _0x1528ef;};'use strict';var pdf=require(_0xe671('0x0'));var emlformat=require(_0xe671('0x1'));var rimraf=require(_0xe671('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe671('0x3'));var rp=require(_0xe671('0x4'));var moment=require('moment');var BPromise=require(_0xe671('0x5'));var Mustache=require(_0xe671('0x6'));var util=require(_0xe671('0x7'));var path=require('path');var sox=require(_0xe671('0x8'));var csv=require(_0xe671('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe671('0xa'));var squel=require(_0xe671('0xb'));var crypto=require(_0xe671('0xc'));var jsforce=require(_0xe671('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe671('0x9'));var querystring=require(_0xe671('0xe'));var Papa=require(_0xe671('0xf'));var Redis=require(_0xe671('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe671('0x11'));var hardwareService=require(_0xe671('0x12'));var logger=require(_0xe671('0x13'))('api');var utils=require(_0xe671('0x14'));var config=require(_0xe671('0x15'));var licenseUtil=require(_0xe671('0x16'));var db=require(_0xe671('0x17'))['db'];function respondWithStatusCode(_0x57767b,_0x3a051e){_0x3a051e=_0x3a051e||0xcc;return function(_0x4f8054){if(_0x4f8054){return _0x57767b[_0xe671('0x18')](_0x3a051e);}return _0x57767b['status'](_0x3a051e)['end']();};}function respondWithResult(_0x5222a7,_0x59688e){_0x59688e=_0x59688e||0xc8;return function(_0xcf6e92){if(_0xcf6e92){return _0x5222a7[_0xe671('0x19')](_0x59688e)[_0xe671('0x1a')](_0xcf6e92);}};}function respondWithFilteredResult(_0x2d427f,_0x53ceee){return function(_0x19d49c){if(_0x19d49c){var _0x6aea49=_0x19d49c['count'],_0x297452=_0x53ceee[_0xe671('0x1b')],_0x29cae4=_0x53ceee[_0xe671('0x1b')]+_0x53ceee[_0xe671('0x1c')],_0x381dd6;if(_0x29cae4>=_0x6aea49){_0x29cae4=_0x6aea49;_0x381dd6=0xc8;}else{_0x381dd6=0xce;}_0x2d427f[_0xe671('0x19')](_0x381dd6);return _0x2d427f[_0xe671('0x1d')](_0xe671('0x1e'),_0x297452+'-'+_0x29cae4+'/'+_0x6aea49)[_0xe671('0x1a')](_0x19d49c);}return null;};}function patchUpdates(_0x18c364){return function(_0x4a24bf){try{jsonpatch[_0xe671('0x1f')](_0x4a24bf,_0x18c364,!![]);}catch(_0x32484a){return BPromise[_0xe671('0x20')](_0x32484a);}return _0x4a24bf[_0xe671('0x21')]();};}function saveUpdates(_0x565623,_0x1f6521){return function(_0x5d5672){if(_0x5d5672){return _0x5d5672[_0xe671('0x22')](_0x565623)[_0xe671('0x23')](function(_0x59c49c){return _0x59c49c;});}return null;};}function removeEntity(_0x50bc70,_0x2e9d94){return function(_0x23f1db){if(_0x23f1db){return _0x23f1db['destroy']()['then'](function(){_0x50bc70[_0xe671('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1479e9,_0x511ff5){return function(_0x285471){if(!_0x285471){_0x1479e9[_0xe671('0x18')](0x194);}return _0x285471;};}function handleError(_0x49f190,_0x276da8){_0x276da8=_0x276da8||0x1f4;return function(_0x15e433){logger[_0xe671('0x24')](_0x15e433[_0xe671('0x25')]);if(_0x15e433[_0xe671('0x26')]){delete _0x15e433[_0xe671('0x26')];}_0x49f190[_0xe671('0x19')](_0x276da8)['send'](_0x15e433);};}exports[_0xe671('0x27')]=function(_0x2ca3d0,_0x346991){var _0x559872={},_0x1e1d55={},_0x6daba5={'count':0x0,'rows':[]};var _0x3988b7=_[_0xe671('0x28')](db['ChatOfflineMessage'][_0xe671('0x29')],function(_0x1ba7bb){return{'name':_0x1ba7bb[_0xe671('0x2a')],'type':_0x1ba7bb['type'][_0xe671('0x2b')]};});_0x1e1d55[_0xe671('0x2c')]=_['map'](_0x3988b7,_0xe671('0x26'));_0x1e1d55[_0xe671('0x2d')]=_[_0xe671('0x2e')](_0x2ca3d0[_0xe671('0x2d')]);_0x1e1d55[_0xe671('0x2f')]=_[_0xe671('0x30')](_0x1e1d55[_0xe671('0x2c')],_0x1e1d55['query']);_0x559872[_0xe671('0x31')]=_['intersection'](_0x1e1d55[_0xe671('0x2c')],qs[_0xe671('0x32')](_0x2ca3d0[_0xe671('0x2d')]['fields']));_0x559872[_0xe671('0x31')]=_0x559872[_0xe671('0x31')]['length']?_0x559872['attributes']:_0x1e1d55['model'];if(!_0x2ca3d0[_0xe671('0x2d')]['hasOwnProperty'](_0xe671('0x33'))){_0x559872[_0xe671('0x1c')]=qs['limit'](_0x2ca3d0['query'][_0xe671('0x1c')]);_0x559872[_0xe671('0x1b')]=qs[_0xe671('0x1b')](_0x2ca3d0[_0xe671('0x2d')]['offset']);}_0x559872[_0xe671('0x34')]=qs[_0xe671('0x35')](_0x2ca3d0[_0xe671('0x2d')][_0xe671('0x35')]);_0x559872['where']=qs['filters'](_[_0xe671('0x36')](_0x2ca3d0[_0xe671('0x2d')],_0x1e1d55[_0xe671('0x2f')]),_0x3988b7);if(_0x2ca3d0[_0xe671('0x2d')][_0xe671('0x37')]){_0x559872[_0xe671('0x38')]=_[_0xe671('0x39')](_0x559872[_0xe671('0x38')],{'$or':_[_0xe671('0x28')](_0x3988b7,function(_0x12e6c9){if(_0x12e6c9['type']!==_0xe671('0x3a')){var _0x42bcb5={};_0x42bcb5[_0x12e6c9[_0xe671('0x26')]]={'$like':'%'+_0x2ca3d0['query'][_0xe671('0x37')]+'%'};return _0x42bcb5;}})});}_0x559872=_[_0xe671('0x39')]({},_0x559872,_0x2ca3d0[_0xe671('0x3b')]);var _0x538e4a={'where':_0x559872['where']};return db['ChatOfflineMessage']['count'](_0x538e4a)[_0xe671('0x23')](function(_0x56bf3c){_0x6daba5[_0xe671('0x3c')]=_0x56bf3c;if(_0x2ca3d0[_0xe671('0x2d')][_0xe671('0x3d')]){_0x559872[_0xe671('0x3e')]=[{'all':!![]}];}return db[_0xe671('0x3f')]['findAll'](_0x559872);})[_0xe671('0x23')](function(_0x3cbbe1){_0x6daba5[_0xe671('0x40')]=_0x3cbbe1;return _0x6daba5;})[_0xe671('0x23')](respondWithFilteredResult(_0x346991,_0x559872))[_0xe671('0x41')](handleError(_0x346991,null));};exports[_0xe671('0x42')]=function(_0xd03ce2,_0xc0e8ce){var _0x39f8c6={'raw':!![],'where':{'id':_0xd03ce2['params']['id']}},_0x226a42={};_0x226a42[_0xe671('0x2c')]=_['keys'](db[_0xe671('0x3f')][_0xe671('0x29')]);_0x226a42['query']=_['keys'](_0xd03ce2[_0xe671('0x2d')]);_0x226a42[_0xe671('0x2f')]=_[_0xe671('0x30')](_0x226a42[_0xe671('0x2c')],_0x226a42[_0xe671('0x2d')]);_0x39f8c6[_0xe671('0x31')]=_[_0xe671('0x30')](_0x226a42['model'],qs[_0xe671('0x32')](_0xd03ce2[_0xe671('0x2d')][_0xe671('0x32')]));_0x39f8c6['attributes']=_0x39f8c6['attributes'][_0xe671('0x43')]?_0x39f8c6[_0xe671('0x31')]:_0x226a42['model'];if(_0xd03ce2[_0xe671('0x2d')]['includeAll']){_0x39f8c6[_0xe671('0x3e')]=[{'all':!![]}];}_0x39f8c6=_[_0xe671('0x39')]({},_0x39f8c6,_0xd03ce2[_0xe671('0x3b')]);return db[_0xe671('0x3f')]['find'](_0x39f8c6)[_0xe671('0x23')](handleEntityNotFound(_0xc0e8ce,null))[_0xe671('0x23')](respondWithResult(_0xc0e8ce,null))['catch'](handleError(_0xc0e8ce,null));};exports['create']=function(_0x4d7134,_0x19a625){return db[_0xe671('0x3f')]['create'](_0x4d7134[_0xe671('0x44')],{})[_0xe671('0x23')](respondWithResult(_0x19a625,0xc9))[_0xe671('0x41')](handleError(_0x19a625,null));};exports['update']=function(_0x3d216e,_0x56a403){if(_0x3d216e[_0xe671('0x44')]['id']){delete _0x3d216e['body']['id'];}return db[_0xe671('0x3f')][_0xe671('0x45')]({'where':{'id':_0x3d216e[_0xe671('0x46')]['id']}})['then'](handleEntityNotFound(_0x56a403,null))['then'](saveUpdates(_0x3d216e[_0xe671('0x44')],null))[_0xe671('0x23')](respondWithResult(_0x56a403,null))[_0xe671('0x41')](handleError(_0x56a403,null));};exports[_0xe671('0x47')]=function(_0x25c708,_0x218ef3){return db[_0xe671('0x3f')][_0xe671('0x45')]({'where':{'id':_0x25c708['params']['id']}})[_0xe671('0x23')](handleEntityNotFound(_0x218ef3,null))[_0xe671('0x23')](removeEntity(_0x218ef3,null))[_0xe671('0x41')](handleError(_0x218ef3,null));};exports[_0xe671('0x48')]=function(_0x59e40d,_0x4ce59a){return db[_0xe671('0x3f')][_0xe671('0x48')]()['then'](respondWithResult(_0x4ce59a,null))[_0xe671('0x41')](handleError(_0x4ce59a,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 128e2b9..3194655 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 _0x4fdb=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatOfflineMessage.attributes','ChatOfflineMessage','chat_offline_messages','utf8mb4'];(function(_0x39ddd4,_0x38ce35){var _0x3d642a=function(_0xa05ced){while(--_0xa05ced){_0x39ddd4['push'](_0x39ddd4['shift']());}};_0x3d642a(++_0x38ce35);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x4fdd37,_0x6ddb6){_0x4fdd37=_0x4fdd37-0x0;var _0x46d6d1=_0x4fdb[_0x4fdd37];return _0x46d6d1;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var moment=require(_0xb4fd('0x4'));var BPromise=require(_0xb4fd('0x5'));var rp=require(_0xb4fd('0x6'));var fs=require('fs');var path=require(_0xb4fd('0x7'));var rimraf=require(_0xb4fd('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4fd('0x9'));module['exports']=function(_0x14052b,_0x5d8b39){return _0x14052b['define'](_0xb4fd('0xa'),attributes,{'tableName':_0xb4fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb4fd('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xdace=['../../config/environment','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x82a03f,_0x83d124){var _0x1da06f=function(_0x3c84e1){while(--_0x3c84e1){_0x82a03f['push'](_0x82a03f['shift']());}};_0x1da06f(++_0x83d124);}(_0xdace,0xc5));var _0xedac=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xdace[_0x3305de];return _0x3b5a84;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./chatOfflineMessage.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xedac('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 3c5718e..1a16c6a 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 _0x5b0e=['ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x5e74a5,_0x150257){var _0x2b1172=function(_0xe202a2){while(--_0xe202a2){_0x5e74a5['push'](_0x5e74a5['shift']());}};_0x2b1172(++_0x150257);}(_0x5b0e,0x8e));var _0xe5b0=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0x5b0e[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require('lodash');var util=require(_0xe5b0('0x0'));var moment=require('moment');var BPromise=require(_0xe5b0('0x1'));var rs=require(_0xe5b0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe5b0('0x3'));var logger=require(_0xe5b0('0x4'))(_0xe5b0('0x5'));var config=require('../../config/environment');var jayson=require(_0xe5b0('0x6'));var client=jayson['client'][_0xe5b0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x490a99,_0x55f7ec,_0x3ac72c){return new BPromise(function(_0x3429b4,_0x2e353b){return client[_0xe5b0('0x8')](_0x490a99,_0x3ac72c)[_0xe5b0('0x9')](function(_0x4ef294){logger['info'](_0xe5b0('0xa'),_0x55f7ec,'request\x20sent');logger['debug'](_0xe5b0('0xb'),_0x55f7ec,_0xe5b0('0xc'),JSON[_0xe5b0('0xd')](_0x4ef294));if(_0x4ef294[_0xe5b0('0xe')]){if(_0x4ef294[_0xe5b0('0xe')]['code']===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x55f7ec,_0x4ef294[_0xe5b0('0xe')][_0xe5b0('0xf')]);return _0x2e353b(_0x4ef294[_0xe5b0('0xe')][_0xe5b0('0xf')]);}logger[_0xe5b0('0xe')](_0xe5b0('0xa'),_0x55f7ec,_0x4ef294[_0xe5b0('0xe')][_0xe5b0('0xf')]);return _0x3429b4(_0x4ef294[_0xe5b0('0xe')]['message']);}else{logger[_0xe5b0('0x10')](_0xe5b0('0xa'),_0x55f7ec,_0xe5b0('0xc'));_0x3429b4(_0x4ef294[_0xe5b0('0x11')]['message']);}})[_0xe5b0('0x12')](function(_0x288355){logger['error'](_0xe5b0('0xa'),_0x55f7ec,_0x288355);_0x2e353b(_0x288355);});});} \ No newline at end of file +var _0x8b33=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x8b33,0x8f));var _0x38b3=function(_0x2f34d1,_0x3ca5f9){_0x2f34d1=_0x2f34d1-0x0;var _0x2d9e58=_0x8b33[_0x2f34d1];return _0x2d9e58;};'use strict';var _=require(_0x38b3('0x0'));var util=require(_0x38b3('0x1'));var moment=require('moment');var BPromise=require(_0x38b3('0x2'));var rs=require(_0x38b3('0x3'));var fs=require('fs');var Redis=require(_0x38b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x38b3('0x5'));var logger=require(_0x38b3('0x6'))(_0x38b3('0x7'));var config=require(_0x38b3('0x8'));var jayson=require(_0x38b3('0x9'));var client=jayson[_0x38b3('0xa')][_0x38b3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c23ca,_0x259df8,_0x2cda72){return new BPromise(function(_0x20a7b3,_0xfaae6f){return client['request'](_0x3c23ca,_0x2cda72)['then'](function(_0x3ee26b){logger['info'](_0x38b3('0xc'),_0x259df8,_0x38b3('0xd'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x259df8,'request\x20sent',JSON[_0x38b3('0xe')](_0x3ee26b));if(_0x3ee26b[_0x38b3('0xf')]){if(_0x3ee26b['error'][_0x38b3('0x10')]===0x1f4){logger[_0x38b3('0xf')](_0x38b3('0xc'),_0x259df8,_0x3ee26b[_0x38b3('0xf')][_0x38b3('0x11')]);return _0xfaae6f(_0x3ee26b['error']['message']);}logger[_0x38b3('0xf')](_0x38b3('0xc'),_0x259df8,_0x3ee26b[_0x38b3('0xf')]['message']);return _0x20a7b3(_0x3ee26b[_0x38b3('0xf')][_0x38b3('0x11')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x259df8,'request\x20sent');_0x20a7b3(_0x3ee26b[_0x38b3('0x12')][_0x38b3('0x11')]);}})[_0x38b3('0x13')](function(_0x36de00){logger[_0x38b3('0xf')](_0x38b3('0xc'),_0x259df8,_0x36de00);_0xfaae6f(_0x36de00);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index b006e80..57d118e 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 _0x2add=['./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x37aebb,_0x5309f4){var _0x97ad33=function(_0x38827c){while(--_0x38827c){_0x37aebb['push'](_0x37aebb['shift']());}};_0x97ad33(++_0x5309f4);}(_0x2add,0x12a));var _0xd2ad=function(_0x4d6767,_0x4c024e){_0x4d6767=_0x4d6767-0x0;var _0x37a4d9=_0x2add[_0x4d6767];return _0x37a4d9;};'use strict';var multer=require('multer');var util=require(_0xd2ad('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd2ad('0x1'));var router=express[_0xd2ad('0x2')]();var auth=require(_0xd2ad('0x3'));var interaction=require(_0xd2ad('0x4'));var config=require(_0xd2ad('0x5'));var controller=require(_0xd2ad('0x6'));router[_0xd2ad('0x7')]('/',auth[_0xd2ad('0x8')](),controller[_0xd2ad('0x9')]);router[_0xd2ad('0x7')](_0xd2ad('0xa'),auth[_0xd2ad('0x8')](),controller[_0xd2ad('0xb')]);router['get'](_0xd2ad('0xc'),auth[_0xd2ad('0x8')](),controller['show']);router['post']('/',auth[_0xd2ad('0x8')](),controller[_0xd2ad('0xd')]);router[_0xd2ad('0xe')](_0xd2ad('0xc'),auth[_0xd2ad('0x8')](),controller[_0xd2ad('0xf')]);router[_0xd2ad('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd2ad('0x11')]);module[_0xd2ad('0x12')]=router; \ No newline at end of file +var _0xbe2e=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','isAuthenticated','describe','/:id','show','put'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0xbe2e,0x112));var _0xebe2=function(_0x1c4b30,_0x21d23b){_0x1c4b30=_0x1c4b30-0x0;var _0x536864=_0xbe2e[_0x1c4b30];return _0x536864;};'use strict';var multer=require(_0xebe2('0x0'));var util=require(_0xebe2('0x1'));var path=require(_0xebe2('0x2'));var timeout=require(_0xebe2('0x3'));var express=require(_0xebe2('0x4'));var router=express[_0xebe2('0x5')]();var auth=require(_0xebe2('0x6'));var interaction=require(_0xebe2('0x7'));var config=require('../../config/environment');var controller=require(_0xebe2('0x8'));router[_0xebe2('0x9')]('/',auth[_0xebe2('0xa')](),controller['index']);router[_0xebe2('0x9')]('/describe',auth[_0xebe2('0xa')](),controller[_0xebe2('0xb')]);router[_0xebe2('0x9')](_0xebe2('0xc'),auth[_0xebe2('0xa')](),controller[_0xebe2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xebe2('0xe')](_0xebe2('0xc'),auth[_0xebe2('0xa')](),controller[_0xebe2('0xf')]);router['delete'](_0xebe2('0xc'),auth[_0xebe2('0xa')](),controller[_0xebe2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 3226e80..379f5a2 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 _0x6c07=['exports','STRING','ENUM','mouseOver','INTEGER','sequelize'];(function(_0x4da4ea,_0x2875d3){var _0x3cc102=function(_0x5549c2){while(--_0x5549c2){_0x4da4ea['push'](_0x4da4ea['shift']());}};_0x3cc102(++_0x2875d3);}(_0x6c07,0x143));var _0x76c0=function(_0x2ee8e7,_0x44a4b2){_0x2ee8e7=_0x2ee8e7-0x0;var _0x2594d0=_0x6c07[_0x2ee8e7];return _0x2594d0;};'use strict';var Sequelize=require(_0x76c0('0x0'));module[_0x76c0('0x1')]={'name':{'type':Sequelize[_0x76c0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x76c0('0x3')](_0x76c0('0x4'),'timeout'),'defaultValue':_0x76c0('0x4')},'selector':{'type':Sequelize[_0x76c0('0x2')]},'timeout':{'type':Sequelize[_0x76c0('0x5')]}}; \ No newline at end of file +var _0x9c19=['ENUM','mouseOver','timeout','INTEGER','exports','STRING'];(function(_0x25cb7d,_0x364692){var _0x2e4663=function(_0x8ff107){while(--_0x8ff107){_0x25cb7d['push'](_0x25cb7d['shift']());}};_0x2e4663(++_0x364692);}(_0x9c19,0xe8));var _0x99c1=function(_0xe4dfd9,_0x34dda4){_0xe4dfd9=_0xe4dfd9-0x0;var _0x1c2a0f=_0x9c19[_0xe4dfd9];return _0x1c2a0f;};'use strict';var Sequelize=require('sequelize');module[_0x99c1('0x0')]={'name':{'type':Sequelize[_0x99c1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x99c1('0x2')](_0x99c1('0x3'),_0x99c1('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x99c1('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index d2a7ee1..0409650 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 _0x135c=['rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','then','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','options','find','catch','create','body','update','html-pdf'];(function(_0x95cfc5,_0x189bc2){var _0x364a9f=function(_0x134e9f){while(--_0x134e9f){_0x95cfc5['push'](_0x95cfc5['shift']());}};_0x364a9f(++_0x189bc2);}(_0x135c,0xa1));var _0xc135=function(_0x13b3ce,_0x3f37c9){_0x13b3ce=_0x13b3ce-0x0;var _0x24cc3a=_0x135c[_0x13b3ce];return _0x24cc3a;};'use strict';var pdf=require(_0xc135('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc135('0x1'));var zipdir=require(_0xc135('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc135('0x3'));var moment=require(_0xc135('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc135('0x5'));var util=require(_0xc135('0x6'));var path=require(_0xc135('0x7'));var sox=require(_0xc135('0x8'));var csv=require(_0xc135('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc135('0xa'));var squel=require(_0xc135('0xb'));var crypto=require(_0xc135('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc135('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc135('0xe'));var authService=require(_0xc135('0xf'));var qs=require(_0xc135('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc135('0x11'))(_0xc135('0x12'));var utils=require('../../config/utils');var config=require(_0xc135('0x13'));var licenseUtil=require(_0xc135('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f8100,_0x4eca0a){_0x4eca0a=_0x4eca0a||0xcc;return function(_0x5df49f){if(_0x5df49f){return _0x4f8100[_0xc135('0x15')](_0x4eca0a);}return _0x4f8100[_0xc135('0x16')](_0x4eca0a)[_0xc135('0x17')]();};}function respondWithResult(_0x351f03,_0x49efac){_0x49efac=_0x49efac||0xc8;return function(_0x4f15a7){if(_0x4f15a7){return _0x351f03[_0xc135('0x16')](_0x49efac)['json'](_0x4f15a7);}};}function respondWithFilteredResult(_0x4d886a,_0x29e817){return function(_0xee3b7f){if(_0xee3b7f){var _0x53be23=_0xee3b7f[_0xc135('0x18')],_0x4fbefa=_0x29e817[_0xc135('0x19')],_0x1dd6e7=_0x29e817[_0xc135('0x19')]+_0x29e817[_0xc135('0x1a')],_0x211edf;if(_0x1dd6e7>=_0x53be23){_0x1dd6e7=_0x53be23;_0x211edf=0xc8;}else{_0x211edf=0xce;}_0x4d886a[_0xc135('0x16')](_0x211edf);return _0x4d886a[_0xc135('0x1b')](_0xc135('0x1c'),_0x4fbefa+'-'+_0x1dd6e7+'/'+_0x53be23)['json'](_0xee3b7f);}return null;};}function patchUpdates(_0x2470e4){return function(_0x4beda1){try{jsonpatch[_0xc135('0x1d')](_0x4beda1,_0x2470e4,!![]);}catch(_0x4adc0a){return BPromise['reject'](_0x4adc0a);}return _0x4beda1['save']();};}function saveUpdates(_0x11acdf,_0x27a731){return function(_0x3b14a3){if(_0x3b14a3){return _0x3b14a3['update'](_0x11acdf)[_0xc135('0x1e')](function(_0x19542c){return _0x19542c;});}return null;};}function removeEntity(_0x6b197b,_0x3e3f32){return function(_0x38283f){if(_0x38283f){return _0x38283f['destroy']()[_0xc135('0x1e')](function(){_0x6b197b[_0xc135('0x16')](0xcc)[_0xc135('0x17')]();});}};}function handleEntityNotFound(_0x5ee826,_0x4446dc){return function(_0x542689){if(!_0x542689){_0x5ee826[_0xc135('0x15')](0x194);}return _0x542689;};}function handleError(_0x61f89d,_0x14be59){_0x14be59=_0x14be59||0x1f4;return function(_0x17c80c){logger[_0xc135('0x1f')](_0x17c80c[_0xc135('0x20')]);if(_0x17c80c[_0xc135('0x21')]){delete _0x17c80c[_0xc135('0x21')];}_0x61f89d[_0xc135('0x16')](_0x14be59)[_0xc135('0x22')](_0x17c80c);};}exports[_0xc135('0x23')]=function(_0x253270,_0x3889ee){var _0x3a6fb6={'raw':!![],'where':{'id':_0x253270[_0xc135('0x24')]['id']}},_0x134f24={};_0x134f24[_0xc135('0x25')]=_[_0xc135('0x26')](db[_0xc135('0x27')][_0xc135('0x28')]);_0x134f24[_0xc135('0x29')]=_[_0xc135('0x26')](_0x253270['query']);_0x134f24[_0xc135('0x2a')]=_[_0xc135('0x2b')](_0x134f24['model'],_0x134f24[_0xc135('0x29')]);_0x3a6fb6[_0xc135('0x2c')]=_[_0xc135('0x2b')](_0x134f24['model'],qs['fields'](_0x253270[_0xc135('0x29')][_0xc135('0x2d')]));_0x3a6fb6[_0xc135('0x2c')]=_0x3a6fb6[_0xc135('0x2c')]['length']?_0x3a6fb6[_0xc135('0x2c')]:_0x134f24['model'];if(_0x253270['query'][_0xc135('0x2e')]){_0x3a6fb6[_0xc135('0x2f')]=[{'all':!![]}];}_0x3a6fb6=_['merge']({},_0x3a6fb6,_0x253270[_0xc135('0x30')]);return db['ChatProactiveAction'][_0xc135('0x31')](_0x3a6fb6)[_0xc135('0x1e')](handleEntityNotFound(_0x3889ee,null))['then'](respondWithResult(_0x3889ee,null))[_0xc135('0x32')](handleError(_0x3889ee,null));};exports['create']=function(_0x33dc47,_0x8a8074){return db['ChatProactiveAction'][_0xc135('0x33')](_0x33dc47[_0xc135('0x34')],{})[_0xc135('0x1e')](respondWithResult(_0x8a8074,0xc9))['catch'](handleError(_0x8a8074,null));};exports[_0xc135('0x35')]=function(_0x162104,_0x44a847){if(_0x162104['body']['id']){delete _0x162104[_0xc135('0x34')]['id'];}return db[_0xc135('0x27')][_0xc135('0x31')]({'where':{'id':_0x162104['params']['id']}})[_0xc135('0x1e')](handleEntityNotFound(_0x44a847,null))[_0xc135('0x1e')](saveUpdates(_0x162104['body'],null))['then'](respondWithResult(_0x44a847,null))['catch'](handleError(_0x44a847,null));};exports['destroy']=function(_0xd01bf7,_0xcf5714){return db['ChatProactiveAction'][_0xc135('0x31')]({'where':{'id':_0xd01bf7[_0xc135('0x24')]['id']}})[_0xc135('0x1e')](handleEntityNotFound(_0xcf5714,null))['then'](removeEntity(_0xcf5714,null))['catch'](handleError(_0xcf5714,null));}; \ No newline at end of file +var _0x3f7c=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','apply','save','update','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','fields','attributes','length','includeAll','merge','find','then','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x3f7c,0x13d));var _0xc3f7=function(_0x32fc1d,_0x1bd713){_0x32fc1d=_0x32fc1d-0x0;var _0x3a3714=_0x3f7c[_0x32fc1d];return _0x3a3714;};'use strict';var pdf=require(_0xc3f7('0x0'));var emlformat=require(_0xc3f7('0x1'));var rimraf=require(_0xc3f7('0x2'));var zipdir=require(_0xc3f7('0x3'));var jsonpatch=require(_0xc3f7('0x4'));var rp=require('request-promise');var moment=require(_0xc3f7('0x5'));var BPromise=require(_0xc3f7('0x6'));var Mustache=require(_0xc3f7('0x7'));var util=require(_0xc3f7('0x8'));var path=require(_0xc3f7('0x9'));var sox=require(_0xc3f7('0xa'));var csv=require(_0xc3f7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc3f7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc3f7('0xd'));var deskjs=require(_0xc3f7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc3f7('0xf'));var Redis=require(_0xc3f7('0x10'));var authService=require(_0xc3f7('0x11'));var qs=require(_0xc3f7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3f7('0x13'));var logger=require(_0xc3f7('0x14'))(_0xc3f7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc3f7('0x16'));var db=require(_0xc3f7('0x17'))['db'];function respondWithStatusCode(_0x1e6648,_0x497265){_0x497265=_0x497265||0xcc;return function(_0x476a9f){if(_0x476a9f){return _0x1e6648[_0xc3f7('0x18')](_0x497265);}return _0x1e6648[_0xc3f7('0x19')](_0x497265)[_0xc3f7('0x1a')]();};}function respondWithResult(_0xc5f8bc,_0x4309ce){_0x4309ce=_0x4309ce||0xc8;return function(_0x293c60){if(_0x293c60){return _0xc5f8bc[_0xc3f7('0x19')](_0x4309ce)[_0xc3f7('0x1b')](_0x293c60);}};}function respondWithFilteredResult(_0x31a8e5,_0xe1bbe9){return function(_0x429159){if(_0x429159){var _0x5eb078=_0x429159[_0xc3f7('0x1c')],_0x13f6b7=_0xe1bbe9[_0xc3f7('0x1d')],_0x4d65fa=_0xe1bbe9[_0xc3f7('0x1d')]+_0xe1bbe9['limit'],_0x3a1b04;if(_0x4d65fa>=_0x5eb078){_0x4d65fa=_0x5eb078;_0x3a1b04=0xc8;}else{_0x3a1b04=0xce;}_0x31a8e5[_0xc3f7('0x19')](_0x3a1b04);return _0x31a8e5['set']('Content-Range',_0x13f6b7+'-'+_0x4d65fa+'/'+_0x5eb078)['json'](_0x429159);}return null;};}function patchUpdates(_0x5ee21a){return function(_0x5b7304){try{jsonpatch[_0xc3f7('0x1e')](_0x5b7304,_0x5ee21a,!![]);}catch(_0x6d02f3){return BPromise['reject'](_0x6d02f3);}return _0x5b7304[_0xc3f7('0x1f')]();};}function saveUpdates(_0x1ff3a6,_0x4a450f){return function(_0x3f1da1){if(_0x3f1da1){return _0x3f1da1[_0xc3f7('0x20')](_0x1ff3a6)['then'](function(_0x469a04){return _0x469a04;});}return null;};}function removeEntity(_0x4c3489,_0x43fb2d){return function(_0x4b2ded){if(_0x4b2ded){return _0x4b2ded[_0xc3f7('0x21')]()['then'](function(){_0x4c3489[_0xc3f7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ae711,_0x2304c3){return function(_0x2edd1d){if(!_0x2edd1d){_0x2ae711[_0xc3f7('0x18')](0x194);}return _0x2edd1d;};}function handleError(_0x32357e,_0x5bb994){_0x5bb994=_0x5bb994||0x1f4;return function(_0x1f96bc){logger[_0xc3f7('0x22')](_0x1f96bc[_0xc3f7('0x23')]);if(_0x1f96bc[_0xc3f7('0x24')]){delete _0x1f96bc[_0xc3f7('0x24')];}_0x32357e[_0xc3f7('0x19')](_0x5bb994)[_0xc3f7('0x25')](_0x1f96bc);};}exports[_0xc3f7('0x26')]=function(_0x5b29db,_0x1312f4){var _0x405aa6={'raw':!![],'where':{'id':_0x5b29db[_0xc3f7('0x27')]['id']}},_0x555ddf={};_0x555ddf[_0xc3f7('0x28')]=_[_0xc3f7('0x29')](db[_0xc3f7('0x2a')][_0xc3f7('0x2b')]);_0x555ddf[_0xc3f7('0x2c')]=_['keys'](_0x5b29db[_0xc3f7('0x2c')]);_0x555ddf['filters']=_[_0xc3f7('0x2d')](_0x555ddf[_0xc3f7('0x28')],_0x555ddf[_0xc3f7('0x2c')]);_0x405aa6['attributes']=_[_0xc3f7('0x2d')](_0x555ddf[_0xc3f7('0x28')],qs[_0xc3f7('0x2e')](_0x5b29db[_0xc3f7('0x2c')][_0xc3f7('0x2e')]));_0x405aa6[_0xc3f7('0x2f')]=_0x405aa6[_0xc3f7('0x2f')][_0xc3f7('0x30')]?_0x405aa6['attributes']:_0x555ddf[_0xc3f7('0x28')];if(_0x5b29db[_0xc3f7('0x2c')][_0xc3f7('0x31')]){_0x405aa6['include']=[{'all':!![]}];}_0x405aa6=_[_0xc3f7('0x32')]({},_0x405aa6,_0x5b29db['options']);return db[_0xc3f7('0x2a')][_0xc3f7('0x33')](_0x405aa6)[_0xc3f7('0x34')](handleEntityNotFound(_0x1312f4,null))[_0xc3f7('0x34')](respondWithResult(_0x1312f4,null))[_0xc3f7('0x35')](handleError(_0x1312f4,null));};exports[_0xc3f7('0x36')]=function(_0x51154b,_0x379aa5){return db[_0xc3f7('0x2a')][_0xc3f7('0x36')](_0x51154b[_0xc3f7('0x37')],{})[_0xc3f7('0x34')](respondWithResult(_0x379aa5,0xc9))['catch'](handleError(_0x379aa5,null));};exports[_0xc3f7('0x20')]=function(_0x35b5a9,_0x3bc1cb){if(_0x35b5a9[_0xc3f7('0x37')]['id']){delete _0x35b5a9[_0xc3f7('0x37')]['id'];}return db[_0xc3f7('0x2a')][_0xc3f7('0x33')]({'where':{'id':_0x35b5a9[_0xc3f7('0x27')]['id']}})[_0xc3f7('0x34')](handleEntityNotFound(_0x3bc1cb,null))[_0xc3f7('0x34')](saveUpdates(_0x35b5a9[_0xc3f7('0x37')],null))[_0xc3f7('0x34')](respondWithResult(_0x3bc1cb,null))['catch'](handleError(_0x3bc1cb,null));};exports[_0xc3f7('0x21')]=function(_0x274566,_0x549381){return db[_0xc3f7('0x2a')]['find']({'where':{'id':_0x274566[_0xc3f7('0x27')]['id']}})[_0xc3f7('0x34')](handleEntityNotFound(_0x549381,null))['then'](removeEntity(_0x549381,null))[_0xc3f7('0x35')](handleError(_0x549381,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7bc9b51..a9728db 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 _0xc37d=['exports','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x10f43f,_0x4b53d6){var _0x10cfda=function(_0x4dc3b1){while(--_0x4dc3b1){_0x10f43f['push'](_0x10f43f['shift']());}};_0x10cfda(++_0x4b53d6);}(_0xc37d,0x1a7));var _0xdc37=function(_0x3fdcf7,_0x233df7){_0x3fdcf7=_0x3fdcf7-0x0;var _0x624416=_0xc37d[_0x3fdcf7];return _0x624416;};'use strict';var _=require('lodash');var util=require(_0xdc37('0x0'));var logger=require(_0xdc37('0x1'))('api');var moment=require(_0xdc37('0x2'));var BPromise=require(_0xdc37('0x3'));var rp=require(_0xdc37('0x4'));var fs=require('fs');var path=require(_0xdc37('0x5'));var rimraf=require(_0xdc37('0x6'));var config=require(_0xdc37('0x7'));var attributes=require(_0xdc37('0x8'));module[_0xdc37('0x9')]=function(_0x4afbab,_0x1b623c){return _0x4afbab['define'](_0xdc37('0xa'),attributes,{'tableName':_0xdc37('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5b4=['moment','bluebird','request-promise','rimraf','./chatProactiveAction.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xd5b4,0x1e0));var _0x4d5b=function(_0x36cbc8,_0x2faacc){_0x36cbc8=_0x36cbc8-0x0;var _0x1329c6=_0xd5b4[_0x36cbc8];return _0x1329c6;};'use strict';var _=require(_0x4d5b('0x0'));var util=require(_0x4d5b('0x1'));var logger=require(_0x4d5b('0x2'))(_0x4d5b('0x3'));var moment=require(_0x4d5b('0x4'));var BPromise=require(_0x4d5b('0x5'));var rp=require(_0x4d5b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d5b('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d5b('0x8'));module[_0x4d5b('0x9')]=function(_0x76be97,_0x5cc333){return _0x76be97[_0x4d5b('0xa')]('ChatProactiveAction',attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 9f396b0..fe717bc 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 _0x08dd=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2be01d,_0x5e7bae){var _0x2918a9=function(_0x1bd70e){while(--_0x1bd70e){_0x2be01d['push'](_0x2be01d['shift']());}};_0x2918a9(++_0x5e7bae);}(_0x08dd,0x1f2));var _0xd08d=function(_0x4a339e,_0xc55463){_0x4a339e=_0x4a339e-0x0;var _0x401b5=_0x08dd[_0x4a339e];return _0x401b5;};'use strict';var _=require(_0xd08d('0x0'));var util=require(_0xd08d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd08d('0x2'));var fs=require('fs');var Redis=require(_0xd08d('0x3'));var db=require(_0xd08d('0x4'))['db'];var utils=require(_0xd08d('0x5'));var logger=require('../../config/logger')(_0xd08d('0x6'));var config=require('../../config/environment');var jayson=require(_0xd08d('0x7'));var client=jayson[_0xd08d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x597ae1,_0x5745e7,_0x1bca82){return new BPromise(function(_0x4cb8fe,_0x285bfc){return client['request'](_0x597ae1,_0x1bca82)[_0xd08d('0x9')](function(_0x38779d){logger[_0xd08d('0xa')](_0xd08d('0xb'),_0x5745e7,_0xd08d('0xc'));logger[_0xd08d('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x5745e7,_0xd08d('0xc'),JSON[_0xd08d('0xe')](_0x38779d));if(_0x38779d[_0xd08d('0xf')]){if(_0x38779d[_0xd08d('0xf')][_0xd08d('0x10')]===0x1f4){logger['error'](_0xd08d('0xb'),_0x5745e7,_0x38779d[_0xd08d('0xf')]['message']);return _0x285bfc(_0x38779d['error']['message']);}logger[_0xd08d('0xf')](_0xd08d('0xb'),_0x5745e7,_0x38779d[_0xd08d('0xf')][_0xd08d('0x11')]);return _0x4cb8fe(_0x38779d[_0xd08d('0xf')][_0xd08d('0x11')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5745e7,'request\x20sent');_0x4cb8fe(_0x38779d[_0xd08d('0x12')][_0xd08d('0x11')]);}})[_0xd08d('0x13')](function(_0x5710db){logger[_0xd08d('0xf')](_0xd08d('0xb'),_0x5745e7,_0x5710db);_0x285bfc(_0x5710db);});});} \ No newline at end of file +var _0xf7a8=['error','message','result','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5d54ff,_0x1607de){var _0x2795a7=function(_0x2a1ed6){while(--_0x2a1ed6){_0x5d54ff['push'](_0x5d54ff['shift']());}};_0x2795a7(++_0x1607de);}(_0xf7a8,0x1c5));var _0x8f7a=function(_0x27fe50,_0x44a45a){_0x27fe50=_0x27fe50-0x0;var _0x233ebc=_0xf7a8[_0x27fe50];return _0x233ebc;};'use strict';var _=require('lodash');var util=require(_0x8f7a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8f7a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8f7a('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f7a('0x3'))(_0x8f7a('0x4'));var config=require(_0x8f7a('0x5'));var jayson=require(_0x8f7a('0x6'));var client=jayson[_0x8f7a('0x7')][_0x8f7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2aebdb,_0x1d001a,_0x484313){return new BPromise(function(_0x4de355,_0x327b20){return client['request'](_0x2aebdb,_0x484313)[_0x8f7a('0x9')](function(_0x18abb2){logger[_0x8f7a('0xa')](_0x8f7a('0xb'),_0x1d001a,_0x8f7a('0xc'));logger['debug'](_0x8f7a('0xd'),_0x1d001a,_0x8f7a('0xc'),JSON[_0x8f7a('0xe')](_0x18abb2));if(_0x18abb2[_0x8f7a('0xf')]){if(_0x18abb2[_0x8f7a('0xf')]['code']===0x1f4){logger[_0x8f7a('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x1d001a,_0x18abb2[_0x8f7a('0xf')][_0x8f7a('0x10')]);return _0x327b20(_0x18abb2[_0x8f7a('0xf')][_0x8f7a('0x10')]);}logger[_0x8f7a('0xf')](_0x8f7a('0xb'),_0x1d001a,_0x18abb2['error']['message']);return _0x4de355(_0x18abb2[_0x8f7a('0xf')]['message']);}else{logger['info'](_0x8f7a('0xb'),_0x1d001a,_0x8f7a('0xc'));_0x4de355(_0x18abb2[_0x8f7a('0x11')]['message']);}})['catch'](function(_0x2a0af4){logger[_0x8f7a('0xf')](_0x8f7a('0xb'),_0x1d001a,_0x2a0af4);_0x327b20(_0x2a0af4);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 45122f4..1452883 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 _0x1b99=['show','post','delete','multer','util','path','express','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x5709ea,_0x5c0089){var _0x1998b4=function(_0x3bab6b){while(--_0x3bab6b){_0x5709ea['push'](_0x5709ea['shift']());}};_0x1998b4(++_0x5c0089);}(_0x1b99,0x17c));var _0x91b9=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0x1b99[_0x51b661];return _0x5d1971;};'use strict';var multer=require(_0x91b9('0x0'));var util=require(_0x91b9('0x1'));var path=require(_0x91b9('0x2'));var timeout=require('connect-timeout');var express=require(_0x91b9('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x91b9('0x4'));var config=require(_0x91b9('0x5'));var controller=require(_0x91b9('0x6'));router[_0x91b9('0x7')](_0x91b9('0x8'),auth[_0x91b9('0x9')](),controller[_0x91b9('0xa')]);router[_0x91b9('0xb')]('/',auth[_0x91b9('0x9')](),controller['create']);router['put'](_0x91b9('0x8'),auth[_0x91b9('0x9')](),controller['update']);router[_0x91b9('0xc')](_0x91b9('0x8'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3aff=['update','delete','exports','multer','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3aff,0x148));var _0xf3af=function(_0x36ae93,_0x17b708){_0x36ae93=_0x36ae93-0x0;var _0x57ce16=_0x3aff[_0x36ae93];return _0x57ce16;};'use strict';var multer=require(_0xf3af('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf3af('0x1'));var router=express['Router']();var auth=require(_0xf3af('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xf3af('0x3'));var controller=require('./chatProactiveAction.controller');router[_0xf3af('0x4')](_0xf3af('0x5'),auth[_0xf3af('0x6')](),controller[_0xf3af('0x7')]);router[_0xf3af('0x8')]('/',auth['isAuthenticated'](),controller[_0xf3af('0x9')]);router['put'](_0xf3af('0x5'),auth[_0xf3af('0x6')](),controller[_0xf3af('0xa')]);router[_0xf3af('0xb')]('/:id',auth[_0xf3af('0x6')](),controller['destroy']);module[_0xf3af('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 32d0298..2a23d8e 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 _0xb061=['roundrobin','sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1026e5,_0x586b6e){var _0x455c4f=function(_0x5d7534){while(--_0x5d7534){_0x1026e5['push'](_0x1026e5['shift']());}};_0x455c4f(++_0x586b6e);}(_0xb061,0xbe));var _0x1b06=function(_0x3e8c34,_0x549d3c){_0x3e8c34=_0x3e8c34-0x0;var _0x14969e=_0xb061[_0x3e8c34];return _0x14969e;};'use strict';var Sequelize=require(_0x1b06('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b06('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1b06('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b06('0x3')](_0x1b06('0x4'),_0x1b06('0x5'),_0x1b06('0x6'))}}; \ No newline at end of file +var _0xaa32=['INTEGER','beepall','sequelize','STRING','name'];(function(_0x2cdf04,_0x3b40ec){var _0x383eb3=function(_0x356d7a){while(--_0x356d7a){_0x2cdf04['push'](_0x2cdf04['shift']());}};_0x383eb3(++_0x3b40ec);}(_0xaa32,0xb1));var _0x2aa3=function(_0x5595b0,_0x2a2d18){_0x5595b0=_0x5595b0-0x0;var _0x17a66c=_0xaa32[_0x5595b0];return _0x17a66c;};'use strict';var Sequelize=require(_0x2aa3('0x0'));module['exports']={'name':{'type':Sequelize[_0x2aa3('0x1')],'unique':_0x2aa3('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2aa3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x2aa3('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 75f53af..6de3f10 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 _0xb680=['rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','find','autoAssociation','describe','getMembers','findOne','keys','UserChatQueue','nolimit','ChatQueueId','findAndCountAll','UserId','agent','chatPause','%s/%s','SIP','createdAt','updatedAt','getTeams','hasOwnProperty','addTeams','ids','Team','online','voicePause','flatMap','Agents','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','User','select','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','ChatQueue,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','ChatQueues','UserProfileResource','destroy','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x58a4ac,_0x26f3e7){var _0x435e2d=function(_0x1a5660){while(--_0x1a5660){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x435e2d(++_0x26f3e7);}(_0xb680,0x177));var _0x0b68=function(_0x871ef5,_0x58880b){_0x871ef5=_0x871ef5-0x0;var _0x1f62ea=_0xb680[_0x871ef5];return _0x1f62ea;};'use strict';var pdf=require(_0x0b68('0x0'));var emlformat=require(_0x0b68('0x1'));var rimraf=require(_0x0b68('0x2'));var zipdir=require(_0x0b68('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b68('0x4'));var moment=require(_0x0b68('0x5'));var BPromise=require(_0x0b68('0x6'));var Mustache=require(_0x0b68('0x7'));var util=require(_0x0b68('0x8'));var path=require('path');var sox=require(_0x0b68('0x9'));var csv=require(_0x0b68('0xa'));var ejs=require(_0x0b68('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0b68('0xc'));var crypto=require(_0x0b68('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0b68('0xa'));var querystring=require(_0x0b68('0xe'));var Papa=require(_0x0b68('0xf'));var Redis=require(_0x0b68('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0b68('0x11'));var as=require(_0x0b68('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b68('0x13'))(_0x0b68('0x14'));var utils=require(_0x0b68('0x15'));var config=require(_0x0b68('0x16'));var licenseUtil=require(_0x0b68('0x17'));var db=require(_0x0b68('0x18'))['db'];config[_0x0b68('0x19')]=_[_0x0b68('0x1a')](config['redis'],{'host':_0x0b68('0x1b'),'port':0x18eb});var socket=require(_0x0b68('0x1c'))(new Redis(config[_0x0b68('0x19')]));require(_0x0b68('0x1d'))[_0x0b68('0x1e')](socket);var jayson=require(_0x0b68('0x1f'));var client=jayson[_0x0b68('0x20')][_0x0b68('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x307c99,_0x90b9a5,_0x10a434,_0x297377){return new BPromise(function(_0x5a77b1,_0x27fd5c){var _0x3dd613=_0x297377||client;return _0x3dd613['request'](_0x307c99,_0x10a434)[_0x0b68('0x22')](function(_0x147f6c){logger['info']('ChatQueue,\x20%s,\x20%s',_0x90b9a5,'request\x20sent');logger[_0x0b68('0x23')](_0x0b68('0x24'),_0x90b9a5,_0x0b68('0x25'),JSON['stringify'](_0x147f6c));if(_0x147f6c['error']){if(_0x147f6c['error'][_0x0b68('0x26')]===0x1f4){logger[_0x0b68('0x27')](_0x0b68('0x28'),_0x90b9a5,_0x147f6c[_0x0b68('0x27')][_0x0b68('0x29')]);return _0x27fd5c(_0x147f6c[_0x0b68('0x27')][_0x0b68('0x29')]);}logger['error'](_0x0b68('0x28'),_0x90b9a5,_0x147f6c[_0x0b68('0x27')]['message']);return _0x5a77b1(_0x147f6c[_0x0b68('0x27')][_0x0b68('0x29')]);}else{logger[_0x0b68('0x2a')]('ChatQueue,\x20%s,\x20%s',_0x90b9a5,_0x0b68('0x25'));_0x5a77b1(_0x147f6c[_0x0b68('0x2b')][_0x0b68('0x29')]);}})[_0x0b68('0x2c')](function(_0x16ac28){logger[_0x0b68('0x27')](_0x0b68('0x28'),_0x90b9a5,_0x16ac28);_0x27fd5c(_0x16ac28);});});}function respondWithStatusCode(_0x1b31de,_0x52fca7){_0x52fca7=_0x52fca7||0xcc;return function(_0x5637b6){if(_0x5637b6){return _0x1b31de[_0x0b68('0x2d')](_0x52fca7);}return _0x1b31de[_0x0b68('0x2e')](_0x52fca7)[_0x0b68('0x2f')]();};}function respondWithResult(_0xb754fc,_0x16b6e5){_0x16b6e5=_0x16b6e5||0xc8;return function(_0x2ffabc){if(_0x2ffabc){return _0xb754fc[_0x0b68('0x2e')](_0x16b6e5)['json'](_0x2ffabc);}};}function respondWithFilteredResult(_0x4e6652,_0x330a34){return function(_0x22d08c){if(_0x22d08c){var _0x20bad7=_0x22d08c[_0x0b68('0x30')],_0x16efb9=_0x330a34[_0x0b68('0x31')],_0x3d8fb7=_0x330a34[_0x0b68('0x31')]+_0x330a34[_0x0b68('0x32')],_0x1d734f;if(_0x3d8fb7>=_0x20bad7){_0x3d8fb7=_0x20bad7;_0x1d734f=0xc8;}else{_0x1d734f=0xce;}_0x4e6652[_0x0b68('0x2e')](_0x1d734f);return _0x4e6652[_0x0b68('0x33')](_0x0b68('0x34'),_0x16efb9+'-'+_0x3d8fb7+'/'+_0x20bad7)[_0x0b68('0x35')](_0x22d08c);}return null;};}function patchUpdates(_0x40198d){return function(_0x5b3068){try{jsonpatch[_0x0b68('0x36')](_0x5b3068,_0x40198d,!![]);}catch(_0x2025a5){return BPromise[_0x0b68('0x37')](_0x2025a5);}return _0x5b3068['save']();};}function saveUpdates(_0x259b0f,_0x4201e0){return function(_0x5ba379){if(_0x5ba379){return _0x5ba379[_0x0b68('0x38')](_0x259b0f)[_0x0b68('0x22')](function(_0xddaa43){return _0xddaa43;});}return null;};}function removeEntity(_0x534a19,_0x577aba){return function(_0x3cb5bb){if(_0x3cb5bb){return _0x3cb5bb['destroy']()[_0x0b68('0x22')](function(){var _0x2062f3=_0x3cb5bb['get']({'plain':!![]});var _0x5c20ab=_0x0b68('0x39');return db[_0x0b68('0x3a')][_0x0b68('0x3b')]({'where':{'type':_0x5c20ab,'resourceId':_0x2062f3['id']}})[_0x0b68('0x22')](function(){return _0x3cb5bb;});})[_0x0b68('0x22')](function(){_0x534a19[_0x0b68('0x2e')](0xcc)[_0x0b68('0x2f')]();});}};}function handleEntityNotFound(_0x25b22d,_0x1a2ef1){return function(_0x444ef0){if(!_0x444ef0){_0x25b22d[_0x0b68('0x2d')](0x194);}return _0x444ef0;};}function handleError(_0x279f06,_0x10656a){_0x10656a=_0x10656a||0x1f4;return function(_0x57c69d){logger['error'](_0x57c69d[_0x0b68('0x3c')]);if(_0x57c69d['name']){delete _0x57c69d[_0x0b68('0x3d')];}_0x279f06[_0x0b68('0x2e')](_0x10656a)[_0x0b68('0x3e')](_0x57c69d);};}exports['index']=function(_0x3ad6d9,_0xab3bc9){var _0x227a3f={},_0x240543={},_0x4e26d0={'count':0x0,'rows':[]};var _0x3bc96c=_[_0x0b68('0x3f')](db[_0x0b68('0x40')][_0x0b68('0x41')],function(_0x5281a5){return{'name':_0x5281a5[_0x0b68('0x42')],'type':_0x5281a5[_0x0b68('0x43')][_0x0b68('0x44')]};});_0x240543['model']=_[_0x0b68('0x3f')](_0x3bc96c,_0x0b68('0x3d'));_0x240543['query']=_['keys'](_0x3ad6d9[_0x0b68('0x45')]);_0x240543[_0x0b68('0x46')]=_[_0x0b68('0x47')](_0x240543[_0x0b68('0x48')],_0x240543[_0x0b68('0x45')]);_0x227a3f[_0x0b68('0x49')]=_[_0x0b68('0x47')](_0x240543[_0x0b68('0x48')],qs[_0x0b68('0x4a')](_0x3ad6d9[_0x0b68('0x45')][_0x0b68('0x4a')]));_0x227a3f[_0x0b68('0x49')]=_0x227a3f[_0x0b68('0x49')][_0x0b68('0x4b')]?_0x227a3f[_0x0b68('0x49')]:_0x240543[_0x0b68('0x48')];if(!_0x3ad6d9[_0x0b68('0x45')]['hasOwnProperty']('nolimit')){_0x227a3f[_0x0b68('0x32')]=qs[_0x0b68('0x32')](_0x3ad6d9['query'][_0x0b68('0x32')]);_0x227a3f[_0x0b68('0x31')]=qs[_0x0b68('0x31')](_0x3ad6d9[_0x0b68('0x45')][_0x0b68('0x31')]);}_0x227a3f[_0x0b68('0x4c')]=qs['sort'](_0x3ad6d9['query'][_0x0b68('0x4d')]);_0x227a3f[_0x0b68('0x4e')]=qs[_0x0b68('0x46')](_[_0x0b68('0x4f')](_0x3ad6d9[_0x0b68('0x45')],_0x240543[_0x0b68('0x46')]),_0x3bc96c);if(_0x3ad6d9[_0x0b68('0x45')][_0x0b68('0x50')]){_0x227a3f[_0x0b68('0x4e')]=_[_0x0b68('0x51')](_0x227a3f[_0x0b68('0x4e')],{'$or':_['map'](_0x3bc96c,function(_0x425571){if(_0x425571[_0x0b68('0x43')]!==_0x0b68('0x52')){var _0x1c23b6={};_0x1c23b6[_0x425571[_0x0b68('0x3d')]]={'$like':'%'+_0x3ad6d9[_0x0b68('0x45')][_0x0b68('0x50')]+'%'};return _0x1c23b6;}})});}_0x227a3f=_['merge']({},_0x227a3f,_0x3ad6d9[_0x0b68('0x53')]);var _0x15bef4={'where':_0x227a3f[_0x0b68('0x4e')]};return db[_0x0b68('0x40')][_0x0b68('0x30')](_0x15bef4)[_0x0b68('0x22')](function(_0x21cbec){_0x4e26d0[_0x0b68('0x30')]=_0x21cbec;if(_0x3ad6d9[_0x0b68('0x45')][_0x0b68('0x54')]){_0x227a3f[_0x0b68('0x55')]=[{'all':!![]}];}return db[_0x0b68('0x40')][_0x0b68('0x56')](_0x227a3f);})[_0x0b68('0x22')](function(_0x3189ea){_0x4e26d0[_0x0b68('0x57')]=_0x3189ea;return _0x4e26d0;})['then'](respondWithFilteredResult(_0xab3bc9,_0x227a3f))['catch'](handleError(_0xab3bc9,null));};exports[_0x0b68('0x58')]=function(_0xaa6d53,_0x1d9557){var _0x462cf5={'raw':!![],'where':{'id':_0xaa6d53[_0x0b68('0x59')]['id']}},_0x501fac={};_0x501fac[_0x0b68('0x48')]=_['keys'](db[_0x0b68('0x40')][_0x0b68('0x41')]);_0x501fac[_0x0b68('0x45')]=_['keys'](_0xaa6d53[_0x0b68('0x45')]);_0x501fac[_0x0b68('0x46')]=_[_0x0b68('0x47')](_0x501fac[_0x0b68('0x48')],_0x501fac[_0x0b68('0x45')]);_0x462cf5[_0x0b68('0x49')]=_['intersection'](_0x501fac[_0x0b68('0x48')],qs['fields'](_0xaa6d53[_0x0b68('0x45')]['fields']));_0x462cf5[_0x0b68('0x49')]=_0x462cf5[_0x0b68('0x49')][_0x0b68('0x4b')]?_0x462cf5['attributes']:_0x501fac[_0x0b68('0x48')];if(_0xaa6d53[_0x0b68('0x45')][_0x0b68('0x54')]){_0x462cf5[_0x0b68('0x55')]=[{'all':!![]}];}_0x462cf5=_[_0x0b68('0x51')]({},_0x462cf5,_0xaa6d53[_0x0b68('0x53')]);return db[_0x0b68('0x40')]['find'](_0x462cf5)[_0x0b68('0x22')](handleEntityNotFound(_0x1d9557,null))[_0x0b68('0x22')](respondWithResult(_0x1d9557,null))[_0x0b68('0x2c')](handleError(_0x1d9557,null));};exports[_0x0b68('0x5a')]=function(_0x34eff4,_0xd3a2e1){return db[_0x0b68('0x40')]['create'](_0x34eff4[_0x0b68('0x5b')],{})[_0x0b68('0x22')](function(_0x59b1f9){var _0x5b858f=_0x34eff4[_0x0b68('0x5c')]['get']({'plain':!![]});if(!_0x5b858f)throw new Error(_0x0b68('0x5d'));if(_0x5b858f['role']===_0x0b68('0x5c')){var _0x24498a=_0x59b1f9[_0x0b68('0x5e')]({'plain':!![]});var _0x591f89=_0x0b68('0x39');return db[_0x0b68('0x5f')][_0x0b68('0x60')]({'where':{'name':_0x591f89,'userProfileId':_0x5b858f['userProfileId']},'raw':!![]})['then'](function(_0x328476){if(_0x328476&&_0x328476[_0x0b68('0x61')]===0x0){return db[_0x0b68('0x3a')]['create']({'name':_0x24498a['name'],'resourceId':_0x24498a['id'],'type':_0x328476[_0x0b68('0x3d')],'sectionId':_0x328476['id']},{})[_0x0b68('0x22')](function(){return _0x59b1f9;});}else{return _0x59b1f9;}})[_0x0b68('0x2c')](function(_0x12f798){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12f798);throw _0x12f798;});}return _0x59b1f9;})['then'](respondWithResult(_0xd3a2e1,0xc9))[_0x0b68('0x2c')](handleError(_0xd3a2e1,null));};exports[_0x0b68('0x38')]=function(_0x1ce6c3,_0x1a231d){if(_0x1ce6c3[_0x0b68('0x5b')]['id']){delete _0x1ce6c3[_0x0b68('0x5b')]['id'];}return db[_0x0b68('0x40')][_0x0b68('0x60')]({'where':{'id':_0x1ce6c3[_0x0b68('0x59')]['id']}})['then'](handleEntityNotFound(_0x1a231d,null))['then'](saveUpdates(_0x1ce6c3['body'],null))['then'](respondWithResult(_0x1a231d,null))[_0x0b68('0x2c')](handleError(_0x1a231d,null));};exports[_0x0b68('0x3b')]=function(_0x59c6fa,_0x11196b){return db[_0x0b68('0x40')]['find']({'where':{'id':_0x59c6fa[_0x0b68('0x59')]['id']}})[_0x0b68('0x22')](handleEntityNotFound(_0x11196b,null))[_0x0b68('0x22')](removeEntity(_0x11196b,null))[_0x0b68('0x2c')](handleError(_0x11196b,null));};exports[_0x0b68('0x62')]=function(_0x12852d,_0x3b2ab2){return db['ChatQueue'][_0x0b68('0x62')]()[_0x0b68('0x22')](respondWithResult(_0x3b2ab2,null))[_0x0b68('0x2c')](handleError(_0x3b2ab2,null));};exports[_0x0b68('0x63')]=function(_0x5bb45f,_0xd26664,_0x157116){var _0x29e9ea={'raw':!![],'where':{}},_0x1a5fea={},_0x32eed2;return db['ChatQueue'][_0x0b68('0x64')]({'where':{'id':_0x5bb45f[_0x0b68('0x59')]['id']}})[_0x0b68('0x22')](handleEntityNotFound(_0xd26664,null))[_0x0b68('0x22')](function(_0x117935){if(_0x117935){_0x32eed2=_0x117935['get']({'plain':!![]});_0x1a5fea[_0x0b68('0x48')]=_[_0x0b68('0x65')](db[_0x0b68('0x66')][_0x0b68('0x41')]);_0x1a5fea[_0x0b68('0x45')]=_[_0x0b68('0x65')](_0x5bb45f[_0x0b68('0x45')]);_0x1a5fea[_0x0b68('0x46')]=_[_0x0b68('0x47')](_0x1a5fea['model'],_0x1a5fea[_0x0b68('0x45')]);_0x29e9ea[_0x0b68('0x49')]=_[_0x0b68('0x47')](_0x1a5fea[_0x0b68('0x48')],qs[_0x0b68('0x4a')](_0x5bb45f[_0x0b68('0x45')][_0x0b68('0x4a')]));_0x29e9ea[_0x0b68('0x49')]=_0x29e9ea['attributes'][_0x0b68('0x4b')]?_0x29e9ea[_0x0b68('0x49')]:_0x1a5fea[_0x0b68('0x48')];if(!_0x5bb45f[_0x0b68('0x45')]['hasOwnProperty'](_0x0b68('0x67'))){_0x29e9ea[_0x0b68('0x32')]=qs[_0x0b68('0x32')](_0x5bb45f[_0x0b68('0x45')][_0x0b68('0x32')]);_0x29e9ea['offset']=qs[_0x0b68('0x31')](_0x5bb45f['query']['offset']);}_0x29e9ea[_0x0b68('0x4c')]=qs[_0x0b68('0x4d')](_0x5bb45f[_0x0b68('0x45')][_0x0b68('0x4d')]);_0x29e9ea[_0x0b68('0x4e')]=qs[_0x0b68('0x46')](_[_0x0b68('0x4f')](_0x5bb45f[_0x0b68('0x45')],_0x1a5fea[_0x0b68('0x46')]));_0x29e9ea[_0x0b68('0x4e')][_0x0b68('0x68')]=_0x117935['id'];if(_0x5bb45f[_0x0b68('0x45')][_0x0b68('0x50')]){_0x29e9ea['where']=_[_0x0b68('0x51')](_0x29e9ea[_0x0b68('0x4e')],{'$or':_[_0x0b68('0x3f')](_0x29e9ea[_0x0b68('0x49')],function(_0x236265){var _0x85e510={};_0x85e510[_0x236265]={'$like':'%'+_0x5bb45f[_0x0b68('0x45')][_0x0b68('0x50')]+'%'};return _0x85e510;})});}_0x29e9ea=_[_0x0b68('0x51')]({},_0x29e9ea,_0x5bb45f[_0x0b68('0x53')]);return db['UserChatQueue'][_0x0b68('0x56')](_0x29e9ea);}})[_0x0b68('0x22')](function(_0x4691dd){if(_0x4691dd){return db['User'][_0x0b68('0x69')]({'where':{'id':_[_0x0b68('0x3f')](_0x4691dd,_0x0b68('0x6a')),'role':_0x0b68('0x6b')},'attributes':['id',_0x0b68('0x3d'),_0x0b68('0x6c'),'updatedAt','createdAt']});}})[_0x0b68('0x22')](function(_0x4f7e4a){if(_0x4f7e4a){return{'count':_0x4f7e4a[_0x0b68('0x30')],'rows':_[_0x0b68('0x3f')](_0x4f7e4a['rows'],function(_0x50b7e5){return{'membername':_0x50b7e5[_0x0b68('0x3d')],'UserId':_0x50b7e5['id'],'queue_name':_0x32eed2[_0x0b68('0x3d')],'ChatQueueId':_0x32eed2['id'],'interface':util['format'](_0x0b68('0x6d'),_0x0b68('0x6e'),_0x50b7e5[_0x0b68('0x3d')]),'penalty':0x0,'paused':_0x50b7e5[_0x0b68('0x6c')],'createdAt':_0x50b7e5[_0x0b68('0x6f')],'updatedAt':_0x50b7e5[_0x0b68('0x70')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0b68('0x22')](respondWithFilteredResult(_0xd26664,_0x29e9ea))[_0x0b68('0x2c')](handleError(_0xd26664,null));};exports[_0x0b68('0x71')]=function(_0x43ceaf,_0x5ba2b2,_0x2529b0){var _0x31d4e2={};var _0x1f9c83={};var _0x397c38;var _0x48133c;return db[_0x0b68('0x40')][_0x0b68('0x64')]({'where':{'id':_0x43ceaf[_0x0b68('0x59')]['id']}})[_0x0b68('0x22')](handleEntityNotFound(_0x5ba2b2,null))[_0x0b68('0x22')](function(_0x458170){if(_0x458170){_0x397c38=_0x458170;_0x1f9c83[_0x0b68('0x48')]=_['keys'](db['Team'][_0x0b68('0x41')]);_0x1f9c83['query']=_[_0x0b68('0x65')](_0x43ceaf[_0x0b68('0x45')]);_0x1f9c83[_0x0b68('0x46')]=_[_0x0b68('0x47')](_0x1f9c83[_0x0b68('0x48')],_0x1f9c83[_0x0b68('0x45')]);_0x31d4e2[_0x0b68('0x49')]=_[_0x0b68('0x47')](_0x1f9c83['model'],qs[_0x0b68('0x4a')](_0x43ceaf['query']['fields']));_0x31d4e2['attributes']=_0x31d4e2[_0x0b68('0x49')][_0x0b68('0x4b')]?_0x31d4e2[_0x0b68('0x49')]:_0x1f9c83[_0x0b68('0x48')];_0x31d4e2['order']=qs[_0x0b68('0x4d')](_0x43ceaf[_0x0b68('0x45')][_0x0b68('0x4d')]);_0x31d4e2[_0x0b68('0x4e')]=qs[_0x0b68('0x46')](_[_0x0b68('0x4f')](_0x43ceaf[_0x0b68('0x45')],_0x1f9c83[_0x0b68('0x46')]));if(_0x43ceaf['query'][_0x0b68('0x50')]){_0x31d4e2[_0x0b68('0x4e')]=_['merge'](_0x31d4e2['where'],{'$or':_['map'](_0x31d4e2['attributes'],function(_0x232866){var _0x3869ac={};_0x3869ac[_0x232866]={'$like':'%'+_0x43ceaf[_0x0b68('0x45')][_0x0b68('0x50')]+'%'};return _0x3869ac;})});}_0x31d4e2=_['merge']({},_0x31d4e2,_0x43ceaf[_0x0b68('0x53')]);return _0x397c38[_0x0b68('0x71')](_0x31d4e2);}})[_0x0b68('0x22')](function(_0xc70db7){if(_0xc70db7){_0x48133c=_0xc70db7['length'];if(!_0x43ceaf[_0x0b68('0x45')][_0x0b68('0x72')](_0x0b68('0x67'))){_0x31d4e2['limit']=qs[_0x0b68('0x32')](_0x43ceaf['query'][_0x0b68('0x32')]);_0x31d4e2[_0x0b68('0x31')]=qs['offset'](_0x43ceaf[_0x0b68('0x45')][_0x0b68('0x31')]);}return _0x397c38[_0x0b68('0x71')](_0x31d4e2);}})[_0x0b68('0x22')](function(_0x3a304e){if(_0x3a304e){return _0x3a304e?{'count':_0x48133c,'rows':_0x3a304e}:null;}})[_0x0b68('0x22')](respondWithResult(_0x5ba2b2,null))[_0x0b68('0x2c')](handleError(_0x5ba2b2,null));};exports[_0x0b68('0x73')]=function(_0x47d711,_0x28d224,_0x5712ad){var _0x472940=_0x47d711[_0x0b68('0x5b')][_0x0b68('0x74')];return db[_0x0b68('0x75')]['findAll']({'where':{'id':_0x472940},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x0b68('0x3d'),_0x0b68('0x76'),_0x0b68('0x77'),'interface'],'raw':!![]}]})['then'](function(_0x470e02){if(_0x470e02){var _0x1f927e=_[_0x0b68('0x78')](_0x470e02,function(_0x43aac9){var _0x367b57=_0x43aac9[_0x0b68('0x5e')]({'plain':!![]});return _0x367b57[_0x0b68('0x79')];});return db[_0x0b68('0x40')][_0x0b68('0x60')]({'where':{'id':_0x47d711['params']['id']}})['then'](function(_0x301f80){return db['sequelize']['transaction'](function(_0x1af5f2){return _0x301f80['addTeams'](_0x472940,{'transaction':_0x1af5f2})[_0x0b68('0x22')](function(){return BPromise[_0x0b68('0x7a')](_0x1f927e,function(_0x255b23){return db[_0x0b68('0x66')][_0x0b68('0x7b')]({'where':{'UserId':_0x255b23['id'],'ChatQueueId':_0x47d711[_0x0b68('0x59')]['id']},'transaction':_0x1af5f2});});})[_0x0b68('0x22')](function(){_0x1f927e[_0x0b68('0x7c')](function(_0x27e4fc){socket[_0x0b68('0x7d')](_0x0b68('0x7e'),{'UserId':_0x27e4fc['id'],'ChatQueueId':_0x301f80['id']});});});});});}})[_0x0b68('0x22')](respondWithStatusCode(_0x28d224,null))[_0x0b68('0x2c')](handleError(_0x28d224,null));};exports[_0x0b68('0x7f')]=function(_0x2acacb,_0x3fadd0,_0xe0f964){return db['Team'][_0x0b68('0x56')]({'where':{'id':_0x2acacb['query'][_0x0b68('0x74')]},'attributes':['id'],'include':[{'model':db[_0x0b68('0x80')],'as':_0x0b68('0x79'),'attributes':['id'],'raw':!![]}]})[_0x0b68('0x22')](handleEntityNotFound(_0x3fadd0,null))[_0x0b68('0x22')](function(_0x3ee6c1){var _0x36d0bf=_[_0x0b68('0x3f')](_0x3ee6c1,'id');var _0x5c000b=[];var _0xc4b958=[];var _0x35acbc=squel[_0x0b68('0x81')]();_0x35acbc['field'](_0x0b68('0x82'))['from'](_0x0b68('0x83'),'tq')[_0x0b68('0x84')](_0x0b68('0x85'),'ut',_0x0b68('0x86'))[_0x0b68('0x4e')](_0x0b68('0x87'),_0x2acacb[_0x0b68('0x59')]['id']);for(var _0x3f01ea=0x0;_0x3f01ea<_0x3ee6c1['length'];_0x3f01ea+=0x1){let _0x495f80=_0x3ee6c1[_0x3f01ea];for(var _0x36785c=0x0;_0x36785c<_0x495f80['Agents'][_0x0b68('0x4b')];_0x36785c+=0x1){let _0x2b9595=_0x495f80['Agents'][_0x36785c];var _0x247ab0=_0x35acbc[_0x0b68('0x88')]();_0x247ab0[_0x0b68('0x4e')](_0x0b68('0x89'),_0x2b9595['id']);_0xc4b958[_0x0b68('0x8a')](db['sequelize']['query'](_0x247ab0['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})[_0x0b68('0x22')](function(_0x4a95a1){if(_0x4a95a1[_0x0b68('0x4b')]===0x1){return _0x2b9595['id'];}else{var _0x5c3624=_[_0x0b68('0x8b')](_[_0x0b68('0x3f')](_0x4a95a1,_0x0b68('0x8c')),function(_0x154383){return _[_0x0b68('0x8d')](_0x36d0bf,_0x154383);});if(_0x5c3624){return _0x2b9595['id'];}}}));}}return BPromise[_0x0b68('0x8e')](_0xc4b958)[_0x0b68('0x22')](function(_0x26b358){_0x5c000b=_(_0x5c000b)[_0x0b68('0x8f')](_0x26b358)[_0x0b68('0x90')]()[_0x0b68('0x91')]();return db[_0x0b68('0x40')]['find']({'where':{'id':_0x2acacb[_0x0b68('0x59')]['id']}})['then'](function(_0x1a8353){return db[_0x0b68('0x92')][_0x0b68('0x93')](function(_0x2a4378){return _0x1a8353[_0x0b68('0x7f')](_0x2acacb[_0x0b68('0x45')]['ids'],{'transaction':_0x2a4378})['then'](function(){if(!_[_0x0b68('0x94')](_0x5c000b)){return _0x1a8353[_0x0b68('0x95')](_0x5c000b,{'transaction':_0x2a4378});}})[_0x0b68('0x22')](function(){_0x5c000b['forEach'](function(_0xad0874){socket[_0x0b68('0x7d')](_0x0b68('0x96'),{'UserId':_0xad0874,'ChatQueueId':_0x1a8353['id']});});});});});});})['then'](respondWithStatusCode(_0x3fadd0,null))[_0x0b68('0x2c')](handleError(_0x3fadd0,null));};exports[_0x0b68('0x97')]=function(_0x33644e,_0x38b0bb,_0xdb8201){return db['ChatQueue'][_0x0b68('0x60')]({'where':{'id':_0x33644e[_0x0b68('0x59')]['id']}})[_0x0b68('0x22')](handleEntityNotFound(_0x38b0bb,null))[_0x0b68('0x22')](function(_0x413ab9){if(_0x413ab9){return _0x413ab9[_0x0b68('0x97')](_0x33644e['body']['ids'],_['omit'](_0x33644e[_0x0b68('0x5b')],['ids','id'])||{})[_0x0b68('0x98')](function(_0x5060f5){for(var _0x16e4b8=0x0;_0x16e4b8<_0x33644e[_0x0b68('0x5b')][_0x0b68('0x74')][_0x0b68('0x4b')];_0x16e4b8+=0x1){socket[_0x0b68('0x7d')]('userChatQueue:save',{'UserId':_0x33644e[_0x0b68('0x5b')][_0x0b68('0x74')][_0x16e4b8],'ChatQueueId':_0x33644e[_0x0b68('0x59')]['id']});}return _0x5060f5;});}})[_0x0b68('0x22')](respondWithResult(_0x38b0bb,null))[_0x0b68('0x2c')](handleError(_0x38b0bb,null));};exports[_0x0b68('0x95')]=function(_0x20c61a,_0x347577,_0x361da2){return db[_0x0b68('0x40')][_0x0b68('0x60')]({'where':{'id':_0x20c61a[_0x0b68('0x59')]['id']}})[_0x0b68('0x22')](handleEntityNotFound(_0x347577,null))[_0x0b68('0x22')](function(_0x5500db){if(_0x5500db){return _0x5500db[_0x0b68('0x95')](_0x20c61a['query'][_0x0b68('0x74')])[_0x0b68('0x22')](function(){if(_['isArray'](_0x20c61a[_0x0b68('0x45')][_0x0b68('0x74')])){for(var _0x4d6185=0x0;_0x4d6185<_0x20c61a[_0x0b68('0x45')][_0x0b68('0x74')][_0x0b68('0x4b')];_0x4d6185+=0x1){socket['emit'](_0x0b68('0x96'),{'UserId':Number(_0x20c61a['query']['ids'][_0x4d6185]),'ChatQueueId':Number(_0x20c61a['params']['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x20c61a['query']['ids']),'ChatQueueId':Number(_0x20c61a['params']['id'])});}});}})[_0x0b68('0x22')](respondWithStatusCode(_0x347577,null))[_0x0b68('0x2c')](handleError(_0x347577,null));};exports[_0x0b68('0x99')]=function(_0x5af9bb,_0x24c2e9,_0x1fa6d1){var _0x3daf26={};var _0x13e396={};var _0x11f318;var _0x3dcb00;return db[_0x0b68('0x40')][_0x0b68('0x64')]({'where':{'id':_0x5af9bb['params']['id']}})['then'](handleEntityNotFound(_0x24c2e9,null))['then'](function(_0x37c1b5){if(_0x37c1b5){_0x11f318=_0x37c1b5;_0x13e396[_0x0b68('0x48')]=_[_0x0b68('0x65')](db[_0x0b68('0x80')]['rawAttributes']);_0x13e396[_0x0b68('0x45')]=_[_0x0b68('0x65')](_0x5af9bb[_0x0b68('0x45')]);_0x13e396[_0x0b68('0x46')]=_[_0x0b68('0x47')](_0x13e396[_0x0b68('0x48')],_0x13e396[_0x0b68('0x45')]);_0x3daf26[_0x0b68('0x49')]=_['intersection'](_0x13e396['model'],qs[_0x0b68('0x4a')](_0x5af9bb[_0x0b68('0x45')][_0x0b68('0x4a')]));_0x3daf26[_0x0b68('0x49')]=_0x3daf26['attributes'][_0x0b68('0x4b')]?_0x3daf26[_0x0b68('0x49')]:_0x13e396[_0x0b68('0x48')];_0x3daf26[_0x0b68('0x4c')]=qs['sort'](_0x5af9bb[_0x0b68('0x45')][_0x0b68('0x4d')]);_0x3daf26['where']=qs[_0x0b68('0x46')](_[_0x0b68('0x4f')](_0x5af9bb[_0x0b68('0x45')],_0x13e396['filters']));if(_0x5af9bb[_0x0b68('0x45')][_0x0b68('0x50')]){_0x3daf26[_0x0b68('0x4e')]=_[_0x0b68('0x51')](_0x3daf26[_0x0b68('0x4e')],{'$or':_[_0x0b68('0x3f')](_0x3daf26[_0x0b68('0x49')],function(_0xa606b6){var _0x430eb5={};_0x430eb5[_0xa606b6]={'$like':'%'+_0x5af9bb['query']['filter']+'%'};return _0x430eb5;})});}_0x3daf26=_['merge']({},_0x3daf26,_0x5af9bb[_0x0b68('0x53')]);return _0x11f318[_0x0b68('0x99')](_0x3daf26);}})[_0x0b68('0x22')](function(_0x328923){if(_0x328923){_0x3dcb00=_0x328923[_0x0b68('0x4b')];if(!_0x5af9bb['query'][_0x0b68('0x72')]('nolimit')){_0x3daf26[_0x0b68('0x32')]=qs[_0x0b68('0x32')](_0x5af9bb[_0x0b68('0x45')][_0x0b68('0x32')]);_0x3daf26[_0x0b68('0x31')]=qs[_0x0b68('0x31')](_0x5af9bb[_0x0b68('0x45')][_0x0b68('0x31')]);}return _0x11f318[_0x0b68('0x99')](_0x3daf26);}})[_0x0b68('0x22')](function(_0x303226){if(_0x303226){return _0x303226?{'count':_0x3dcb00,'rows':_0x303226}:null;}})['then'](respondWithResult(_0x24c2e9,null))[_0x0b68('0x2c')](handleError(_0x24c2e9,null));}; \ No newline at end of file +var _0xfaca=['isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','set','reject','save','destroy','get','ChatQueues','stack','name','index','ChatQueue','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','show','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','chatPause','rows','%s/%s','SIP','createdAt','updatedAt','getTeams','ids','Team','findAll','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','userChatQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','union','compact','transaction','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','spread'];(function(_0x545d01,_0x4404a2){var _0x575b3e=function(_0x5462f9){while(--_0x5462f9){_0x545d01['push'](_0x545d01['shift']());}};_0x575b3e(++_0x4404a2);}(_0xfaca,0x120));var _0xafac=function(_0x384a78,_0x5ba914){_0x384a78=_0x384a78-0x0;var _0xf4933b=_0xfaca[_0x384a78];return _0xf4933b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xafac('0x0'));var rimraf=require(_0xafac('0x1'));var zipdir=require(_0xafac('0x2'));var jsonpatch=require(_0xafac('0x3'));var rp=require(_0xafac('0x4'));var moment=require(_0xafac('0x5'));var BPromise=require(_0xafac('0x6'));var Mustache=require(_0xafac('0x7'));var util=require(_0xafac('0x8'));var path=require('path');var sox=require(_0xafac('0x9'));var csv=require(_0xafac('0xa'));var ejs=require(_0xafac('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xafac('0xc'));var jsforce=require(_0xafac('0xd'));var deskjs=require(_0xafac('0xe'));var toCsv=require(_0xafac('0xa'));var querystring=require(_0xafac('0xf'));var Papa=require('papaparse');var Redis=require(_0xafac('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xafac('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xafac('0x12'));var logger=require('../../config/logger')(_0xafac('0x13'));var utils=require(_0xafac('0x14'));var config=require(_0xafac('0x15'));var licenseUtil=require(_0xafac('0x16'));var db=require(_0xafac('0x17'))['db'];config[_0xafac('0x18')]=_['defaults'](config[_0xafac('0x18')],{'host':_0xafac('0x19'),'port':0x18eb});var socket=require(_0xafac('0x1a'))(new Redis(config[_0xafac('0x18')]));require(_0xafac('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xafac('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4bc386,_0x4c4e10,_0x4ae948,_0x221be0){return new BPromise(function(_0xc3180b,_0x23cb88){var _0x20251b=_0x221be0||client;return _0x20251b[_0xafac('0x1d')](_0x4bc386,_0x4ae948)[_0xafac('0x1e')](function(_0x4e2c3f){logger[_0xafac('0x1f')](_0xafac('0x20'),_0x4c4e10,_0xafac('0x21'));logger['debug'](_0xafac('0x22'),_0x4c4e10,'request\x20sent',JSON[_0xafac('0x23')](_0x4e2c3f));if(_0x4e2c3f[_0xafac('0x24')]){if(_0x4e2c3f[_0xafac('0x24')][_0xafac('0x25')]===0x1f4){logger[_0xafac('0x24')]('ChatQueue,\x20%s,\x20%s',_0x4c4e10,_0x4e2c3f['error']['message']);return _0x23cb88(_0x4e2c3f[_0xafac('0x24')]['message']);}logger[_0xafac('0x24')]('ChatQueue,\x20%s,\x20%s',_0x4c4e10,_0x4e2c3f[_0xafac('0x24')][_0xafac('0x26')]);return _0xc3180b(_0x4e2c3f[_0xafac('0x24')][_0xafac('0x26')]);}else{logger[_0xafac('0x1f')](_0xafac('0x20'),_0x4c4e10,'request\x20sent');_0xc3180b(_0x4e2c3f[_0xafac('0x27')][_0xafac('0x26')]);}})[_0xafac('0x28')](function(_0x402763){logger['error'](_0xafac('0x20'),_0x4c4e10,_0x402763);_0x23cb88(_0x402763);});});}function respondWithStatusCode(_0x1cba83,_0x41e18b){_0x41e18b=_0x41e18b||0xcc;return function(_0x4c6c15){if(_0x4c6c15){return _0x1cba83[_0xafac('0x29')](_0x41e18b);}return _0x1cba83['status'](_0x41e18b)['end']();};}function respondWithResult(_0x4df34c,_0x213779){_0x213779=_0x213779||0xc8;return function(_0x48c2cb){if(_0x48c2cb){return _0x4df34c[_0xafac('0x2a')](_0x213779)[_0xafac('0x2b')](_0x48c2cb);}};}function respondWithFilteredResult(_0x54965a,_0x2b75ba){return function(_0x4e18ab){if(_0x4e18ab){var _0xf1f997=_0x4e18ab['count'],_0x1cc2ce=_0x2b75ba[_0xafac('0x2c')],_0x17c71b=_0x2b75ba[_0xafac('0x2c')]+_0x2b75ba['limit'],_0x24b9a9;if(_0x17c71b>=_0xf1f997){_0x17c71b=_0xf1f997;_0x24b9a9=0xc8;}else{_0x24b9a9=0xce;}_0x54965a[_0xafac('0x2a')](_0x24b9a9);return _0x54965a[_0xafac('0x2d')]('Content-Range',_0x1cc2ce+'-'+_0x17c71b+'/'+_0xf1f997)['json'](_0x4e18ab);}return null;};}function patchUpdates(_0x4fb9a8){return function(_0xa50fab){try{jsonpatch['apply'](_0xa50fab,_0x4fb9a8,!![]);}catch(_0x31ffbf){return BPromise[_0xafac('0x2e')](_0x31ffbf);}return _0xa50fab[_0xafac('0x2f')]();};}function saveUpdates(_0x2acc38,_0x27f7c0){return function(_0x2f092f){if(_0x2f092f){return _0x2f092f['update'](_0x2acc38)[_0xafac('0x1e')](function(_0x266f24){return _0x266f24;});}return null;};}function removeEntity(_0x260960,_0x458366){return function(_0x3fbd59){if(_0x3fbd59){return _0x3fbd59[_0xafac('0x30')]()[_0xafac('0x1e')](function(){var _0x4b0b6e=_0x3fbd59[_0xafac('0x31')]({'plain':!![]});var _0x17c02e=_0xafac('0x32');return db['UserProfileResource'][_0xafac('0x30')]({'where':{'type':_0x17c02e,'resourceId':_0x4b0b6e['id']}})['then'](function(){return _0x3fbd59;});})[_0xafac('0x1e')](function(){_0x260960[_0xafac('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48bc6a,_0x57aa69){return function(_0x50a91e){if(!_0x50a91e){_0x48bc6a[_0xafac('0x29')](0x194);}return _0x50a91e;};}function handleError(_0x119ffa,_0x2289c8){_0x2289c8=_0x2289c8||0x1f4;return function(_0x487cde){logger[_0xafac('0x24')](_0x487cde[_0xafac('0x33')]);if(_0x487cde['name']){delete _0x487cde[_0xafac('0x34')];}_0x119ffa['status'](_0x2289c8)['send'](_0x487cde);};}exports[_0xafac('0x35')]=function(_0x54c501,_0x17ba00){var _0x5a0369={},_0x69bd30={},_0x370437={'count':0x0,'rows':[]};var _0x2e6a56=_['map'](db[_0xafac('0x36')]['rawAttributes'],function(_0x173981){return{'name':_0x173981[_0xafac('0x37')],'type':_0x173981['type'][_0xafac('0x38')]};});_0x69bd30[_0xafac('0x39')]=_[_0xafac('0x3a')](_0x2e6a56,_0xafac('0x34'));_0x69bd30['query']=_[_0xafac('0x3b')](_0x54c501[_0xafac('0x3c')]);_0x69bd30[_0xafac('0x3d')]=_[_0xafac('0x3e')](_0x69bd30[_0xafac('0x39')],_0x69bd30[_0xafac('0x3c')]);_0x5a0369[_0xafac('0x3f')]=_['intersection'](_0x69bd30[_0xafac('0x39')],qs['fields'](_0x54c501['query'][_0xafac('0x40')]));_0x5a0369[_0xafac('0x3f')]=_0x5a0369[_0xafac('0x3f')][_0xafac('0x41')]?_0x5a0369[_0xafac('0x3f')]:_0x69bd30[_0xafac('0x39')];if(!_0x54c501[_0xafac('0x3c')][_0xafac('0x42')]('nolimit')){_0x5a0369['limit']=qs[_0xafac('0x43')](_0x54c501['query'][_0xafac('0x43')]);_0x5a0369[_0xafac('0x2c')]=qs[_0xafac('0x2c')](_0x54c501[_0xafac('0x3c')][_0xafac('0x2c')]);}_0x5a0369[_0xafac('0x44')]=qs[_0xafac('0x45')](_0x54c501['query'][_0xafac('0x45')]);_0x5a0369['where']=qs[_0xafac('0x3d')](_[_0xafac('0x46')](_0x54c501[_0xafac('0x3c')],_0x69bd30[_0xafac('0x3d')]),_0x2e6a56);if(_0x54c501[_0xafac('0x3c')][_0xafac('0x47')]){_0x5a0369[_0xafac('0x48')]=_[_0xafac('0x49')](_0x5a0369[_0xafac('0x48')],{'$or':_[_0xafac('0x3a')](_0x2e6a56,function(_0x42ebc3){if(_0x42ebc3[_0xafac('0x4a')]!==_0xafac('0x4b')){var _0x991378={};_0x991378[_0x42ebc3[_0xafac('0x34')]]={'$like':'%'+_0x54c501[_0xafac('0x3c')]['filter']+'%'};return _0x991378;}})});}_0x5a0369=_['merge']({},_0x5a0369,_0x54c501[_0xafac('0x4c')]);var _0x16e5dd={'where':_0x5a0369[_0xafac('0x48')]};return db['ChatQueue'][_0xafac('0x4d')](_0x16e5dd)[_0xafac('0x1e')](function(_0x2ce5bf){_0x370437[_0xafac('0x4d')]=_0x2ce5bf;if(_0x54c501[_0xafac('0x3c')][_0xafac('0x4e')]){_0x5a0369[_0xafac('0x4f')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x5a0369);})[_0xafac('0x1e')](function(_0x2b8b48){_0x370437['rows']=_0x2b8b48;return _0x370437;})[_0xafac('0x1e')](respondWithFilteredResult(_0x17ba00,_0x5a0369))[_0xafac('0x28')](handleError(_0x17ba00,null));};exports[_0xafac('0x50')]=function(_0x136c50,_0x3a3e60){var _0x25e6c0={'raw':!![],'where':{'id':_0x136c50['params']['id']}},_0x757de2={};_0x757de2[_0xafac('0x39')]=_[_0xafac('0x3b')](db[_0xafac('0x36')][_0xafac('0x51')]);_0x757de2['query']=_[_0xafac('0x3b')](_0x136c50[_0xafac('0x3c')]);_0x757de2['filters']=_[_0xafac('0x3e')](_0x757de2[_0xafac('0x39')],_0x757de2[_0xafac('0x3c')]);_0x25e6c0[_0xafac('0x3f')]=_[_0xafac('0x3e')](_0x757de2['model'],qs['fields'](_0x136c50[_0xafac('0x3c')]['fields']));_0x25e6c0[_0xafac('0x3f')]=_0x25e6c0['attributes'][_0xafac('0x41')]?_0x25e6c0['attributes']:_0x757de2[_0xafac('0x39')];if(_0x136c50[_0xafac('0x3c')]['includeAll']){_0x25e6c0['include']=[{'all':!![]}];}_0x25e6c0=_['merge']({},_0x25e6c0,_0x136c50[_0xafac('0x4c')]);return db[_0xafac('0x36')]['find'](_0x25e6c0)[_0xafac('0x1e')](handleEntityNotFound(_0x3a3e60,null))[_0xafac('0x1e')](respondWithResult(_0x3a3e60,null))[_0xafac('0x28')](handleError(_0x3a3e60,null));};exports[_0xafac('0x52')]=function(_0x4f95e1,_0xd2bc4){return db[_0xafac('0x36')][_0xafac('0x52')](_0x4f95e1[_0xafac('0x53')],{})[_0xafac('0x1e')](function(_0x3c6134){var _0x5a6dca=_0x4f95e1[_0xafac('0x54')][_0xafac('0x31')]({'plain':!![]});if(!_0x5a6dca)throw new Error(_0xafac('0x55'));if(_0x5a6dca[_0xafac('0x56')]===_0xafac('0x54')){var _0x39a455=_0x3c6134[_0xafac('0x31')]({'plain':!![]});var _0x3a9238=_0xafac('0x32');return db[_0xafac('0x57')][_0xafac('0x58')]({'where':{'name':_0x3a9238,'userProfileId':_0x5a6dca[_0xafac('0x59')]},'raw':!![]})['then'](function(_0x21989c){if(_0x21989c&&_0x21989c[_0xafac('0x5a')]===0x0){return db[_0xafac('0x5b')][_0xafac('0x52')]({'name':_0x39a455['name'],'resourceId':_0x39a455['id'],'type':_0x21989c[_0xafac('0x34')],'sectionId':_0x21989c['id']},{})[_0xafac('0x1e')](function(){return _0x3c6134;});}else{return _0x3c6134;}})[_0xafac('0x28')](function(_0x4c5579){logger[_0xafac('0x24')](_0xafac('0x5c'),_0x4c5579);throw _0x4c5579;});}return _0x3c6134;})[_0xafac('0x1e')](respondWithResult(_0xd2bc4,0xc9))[_0xafac('0x28')](handleError(_0xd2bc4,null));};exports['update']=function(_0x361b40,_0x3af65d){if(_0x361b40[_0xafac('0x53')]['id']){delete _0x361b40[_0xafac('0x53')]['id'];}return db[_0xafac('0x36')][_0xafac('0x58')]({'where':{'id':_0x361b40['params']['id']}})[_0xafac('0x1e')](handleEntityNotFound(_0x3af65d,null))[_0xafac('0x1e')](saveUpdates(_0x361b40[_0xafac('0x53')],null))[_0xafac('0x1e')](respondWithResult(_0x3af65d,null))[_0xafac('0x28')](handleError(_0x3af65d,null));};exports[_0xafac('0x30')]=function(_0x2f9dbc,_0x4439d7){return db[_0xafac('0x36')][_0xafac('0x58')]({'where':{'id':_0x2f9dbc[_0xafac('0x5d')]['id']}})[_0xafac('0x1e')](handleEntityNotFound(_0x4439d7,null))['then'](removeEntity(_0x4439d7,null))['catch'](handleError(_0x4439d7,null));};exports[_0xafac('0x5e')]=function(_0x52cecb,_0x4fc726){return db[_0xafac('0x36')]['describe']()[_0xafac('0x1e')](respondWithResult(_0x4fc726,null))[_0xafac('0x28')](handleError(_0x4fc726,null));};exports['getMembers']=function(_0x2a8c04,_0x2e997e,_0x469bc8){var _0x54d6d4={'raw':!![],'where':{}},_0x43db3c={},_0x7640b7;return db[_0xafac('0x36')][_0xafac('0x5f')]({'where':{'id':_0x2a8c04['params']['id']}})['then'](handleEntityNotFound(_0x2e997e,null))['then'](function(_0x502671){if(_0x502671){_0x7640b7=_0x502671[_0xafac('0x31')]({'plain':!![]});_0x43db3c[_0xafac('0x39')]=_['keys'](db[_0xafac('0x60')][_0xafac('0x51')]);_0x43db3c[_0xafac('0x3c')]=_[_0xafac('0x3b')](_0x2a8c04[_0xafac('0x3c')]);_0x43db3c[_0xafac('0x3d')]=_[_0xafac('0x3e')](_0x43db3c['model'],_0x43db3c[_0xafac('0x3c')]);_0x54d6d4[_0xafac('0x3f')]=_['intersection'](_0x43db3c[_0xafac('0x39')],qs[_0xafac('0x40')](_0x2a8c04[_0xafac('0x3c')][_0xafac('0x40')]));_0x54d6d4['attributes']=_0x54d6d4[_0xafac('0x3f')][_0xafac('0x41')]?_0x54d6d4[_0xafac('0x3f')]:_0x43db3c[_0xafac('0x39')];if(!_0x2a8c04[_0xafac('0x3c')][_0xafac('0x42')]('nolimit')){_0x54d6d4[_0xafac('0x43')]=qs['limit'](_0x2a8c04[_0xafac('0x3c')][_0xafac('0x43')]);_0x54d6d4[_0xafac('0x2c')]=qs[_0xafac('0x2c')](_0x2a8c04[_0xafac('0x3c')][_0xafac('0x2c')]);}_0x54d6d4[_0xafac('0x44')]=qs['sort'](_0x2a8c04[_0xafac('0x3c')][_0xafac('0x45')]);_0x54d6d4['where']=qs[_0xafac('0x3d')](_[_0xafac('0x46')](_0x2a8c04[_0xafac('0x3c')],_0x43db3c['filters']));_0x54d6d4[_0xafac('0x48')][_0xafac('0x61')]=_0x502671['id'];if(_0x2a8c04[_0xafac('0x3c')][_0xafac('0x47')]){_0x54d6d4[_0xafac('0x48')]=_[_0xafac('0x49')](_0x54d6d4['where'],{'$or':_[_0xafac('0x3a')](_0x54d6d4[_0xafac('0x3f')],function(_0x50691d){var _0x57fba9={};_0x57fba9[_0x50691d]={'$like':'%'+_0x2a8c04[_0xafac('0x3c')][_0xafac('0x47')]+'%'};return _0x57fba9;})});}_0x54d6d4=_[_0xafac('0x49')]({},_0x54d6d4,_0x2a8c04[_0xafac('0x4c')]);return db['UserChatQueue']['findAll'](_0x54d6d4);}})[_0xafac('0x1e')](function(_0x2d61e9){if(_0x2d61e9){return db[_0xafac('0x62')][_0xafac('0x63')]({'where':{'id':_[_0xafac('0x3a')](_0x2d61e9,_0xafac('0x64')),'role':'agent'},'attributes':['id',_0xafac('0x34'),_0xafac('0x65'),'updatedAt','createdAt']});}})[_0xafac('0x1e')](function(_0x5622fa){if(_0x5622fa){return{'count':_0x5622fa['count'],'rows':_[_0xafac('0x3a')](_0x5622fa[_0xafac('0x66')],function(_0x17733e){return{'membername':_0x17733e[_0xafac('0x34')],'UserId':_0x17733e['id'],'queue_name':_0x7640b7[_0xafac('0x34')],'ChatQueueId':_0x7640b7['id'],'interface':util['format'](_0xafac('0x67'),_0xafac('0x68'),_0x17733e[_0xafac('0x34')]),'penalty':0x0,'paused':_0x17733e[_0xafac('0x65')],'createdAt':_0x17733e[_0xafac('0x69')],'updatedAt':_0x17733e[_0xafac('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xafac('0x1e')](respondWithFilteredResult(_0x2e997e,_0x54d6d4))[_0xafac('0x28')](handleError(_0x2e997e,null));};exports[_0xafac('0x6b')]=function(_0x5af887,_0x57b562,_0x7d654e){var _0x55dad2={};var _0xdcb8f9={};var _0x23f8d2;var _0x3f2e7d;return db[_0xafac('0x36')]['findOne']({'where':{'id':_0x5af887['params']['id']}})[_0xafac('0x1e')](handleEntityNotFound(_0x57b562,null))['then'](function(_0x3480b9){if(_0x3480b9){_0x23f8d2=_0x3480b9;_0xdcb8f9['model']=_[_0xafac('0x3b')](db['Team'][_0xafac('0x51')]);_0xdcb8f9[_0xafac('0x3c')]=_[_0xafac('0x3b')](_0x5af887[_0xafac('0x3c')]);_0xdcb8f9[_0xafac('0x3d')]=_[_0xafac('0x3e')](_0xdcb8f9[_0xafac('0x39')],_0xdcb8f9[_0xafac('0x3c')]);_0x55dad2[_0xafac('0x3f')]=_[_0xafac('0x3e')](_0xdcb8f9[_0xafac('0x39')],qs[_0xafac('0x40')](_0x5af887[_0xafac('0x3c')][_0xafac('0x40')]));_0x55dad2['attributes']=_0x55dad2[_0xafac('0x3f')][_0xafac('0x41')]?_0x55dad2[_0xafac('0x3f')]:_0xdcb8f9[_0xafac('0x39')];_0x55dad2['order']=qs[_0xafac('0x45')](_0x5af887[_0xafac('0x3c')][_0xafac('0x45')]);_0x55dad2[_0xafac('0x48')]=qs[_0xafac('0x3d')](_[_0xafac('0x46')](_0x5af887[_0xafac('0x3c')],_0xdcb8f9[_0xafac('0x3d')]));if(_0x5af887[_0xafac('0x3c')][_0xafac('0x47')]){_0x55dad2[_0xafac('0x48')]=_[_0xafac('0x49')](_0x55dad2['where'],{'$or':_[_0xafac('0x3a')](_0x55dad2[_0xafac('0x3f')],function(_0x5002a1){var _0x37f14a={};_0x37f14a[_0x5002a1]={'$like':'%'+_0x5af887[_0xafac('0x3c')][_0xafac('0x47')]+'%'};return _0x37f14a;})});}_0x55dad2=_[_0xafac('0x49')]({},_0x55dad2,_0x5af887[_0xafac('0x4c')]);return _0x23f8d2['getTeams'](_0x55dad2);}})[_0xafac('0x1e')](function(_0x266d61){if(_0x266d61){_0x3f2e7d=_0x266d61[_0xafac('0x41')];if(!_0x5af887[_0xafac('0x3c')][_0xafac('0x42')]('nolimit')){_0x55dad2[_0xafac('0x43')]=qs[_0xafac('0x43')](_0x5af887[_0xafac('0x3c')][_0xafac('0x43')]);_0x55dad2[_0xafac('0x2c')]=qs[_0xafac('0x2c')](_0x5af887[_0xafac('0x3c')][_0xafac('0x2c')]);}return _0x23f8d2[_0xafac('0x6b')](_0x55dad2);}})[_0xafac('0x1e')](function(_0x27adae){if(_0x27adae){return _0x27adae?{'count':_0x3f2e7d,'rows':_0x27adae}:null;}})[_0xafac('0x1e')](respondWithResult(_0x57b562,null))[_0xafac('0x28')](handleError(_0x57b562,null));};exports['addTeams']=function(_0x4470b7,_0x82092c,_0x2d89d5){var _0x78021e=_0x4470b7['body'][_0xafac('0x6c')];return db[_0xafac('0x6d')][_0xafac('0x6e')]({'where':{'id':_0x78021e},'attributes':['id'],'include':[{'model':db[_0xafac('0x62')],'as':_0xafac('0x6f'),'attributes':['id','name',_0xafac('0x70'),_0xafac('0x71'),'interface'],'raw':!![]}]})['then'](function(_0x22efa6){if(_0x22efa6){var _0x2b6517=_[_0xafac('0x72')](_0x22efa6,function(_0xcd6a75){var _0x1332b9=_0xcd6a75[_0xafac('0x31')]({'plain':!![]});return _0x1332b9['Agents'];});return db[_0xafac('0x36')][_0xafac('0x58')]({'where':{'id':_0x4470b7['params']['id']}})[_0xafac('0x1e')](function(_0x2ef702){return db[_0xafac('0x73')]['transaction'](function(_0x9ffbfe){return _0x2ef702['addTeams'](_0x78021e,{'transaction':_0x9ffbfe})[_0xafac('0x1e')](function(){return BPromise[_0xafac('0x74')](_0x2b6517,function(_0x408309){return db[_0xafac('0x60')][_0xafac('0x75')]({'where':{'UserId':_0x408309['id'],'ChatQueueId':_0x4470b7[_0xafac('0x5d')]['id']},'transaction':_0x9ffbfe});});})['then'](function(){_0x2b6517[_0xafac('0x76')](function(_0x2dab58){socket['emit'](_0xafac('0x77'),{'UserId':_0x2dab58['id'],'ChatQueueId':_0x2ef702['id']});});});});});}})[_0xafac('0x1e')](respondWithStatusCode(_0x82092c,null))['catch'](handleError(_0x82092c,null));};exports[_0xafac('0x78')]=function(_0x4edc04,_0x1c3e2a,_0x4edbb1){return db[_0xafac('0x6d')]['findAll']({'where':{'id':_0x4edc04[_0xafac('0x3c')][_0xafac('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xafac('0x62')],'as':_0xafac('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xafac('0x1e')](handleEntityNotFound(_0x1c3e2a,null))['then'](function(_0x536bd9){var _0x270db8=_[_0xafac('0x3a')](_0x536bd9,'id');var _0x1fb7f5=[];var _0x4a650c=[];var _0x49cbfe=squel[_0xafac('0x79')]();_0x49cbfe['field'](_0xafac('0x7a'))[_0xafac('0x7b')]('team_has_chat_queues','tq')[_0xafac('0x7c')](_0xafac('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xafac('0x48')]('ChatQueueId\x20=\x20?',_0x4edc04[_0xafac('0x5d')]['id']);for(var _0x17a6af=0x0;_0x17a6af<_0x536bd9[_0xafac('0x41')];_0x17a6af+=0x1){let _0x1ad148=_0x536bd9[_0x17a6af];for(var _0x912803=0x0;_0x912803<_0x1ad148[_0xafac('0x6f')]['length'];_0x912803+=0x1){let _0x433224=_0x1ad148[_0xafac('0x6f')][_0x912803];var _0x3ff16a=_0x49cbfe[_0xafac('0x7e')]();_0x3ff16a[_0xafac('0x48')](_0xafac('0x7f'),_0x433224['id']);_0x4a650c[_0xafac('0x80')](db[_0xafac('0x73')][_0xafac('0x3c')](_0x3ff16a['toString'](),{'type':db[_0xafac('0x73')][_0xafac('0x81')]['SELECT']})['then'](function(_0x127788){if(_0x127788[_0xafac('0x41')]===0x1){return _0x433224['id'];}else{var _0x301c7f=_['every'](_[_0xafac('0x3a')](_0x127788,_0xafac('0x82')),function(_0x2118c6){return _[_0xafac('0x83')](_0x270db8,_0x2118c6);});if(_0x301c7f){return _0x433224['id'];}}}));}}return BPromise['all'](_0x4a650c)['then'](function(_0x4482c9){_0x1fb7f5=_(_0x1fb7f5)[_0xafac('0x84')](_0x4482c9)[_0xafac('0x85')]()['value']();return db[_0xafac('0x36')][_0xafac('0x58')]({'where':{'id':_0x4edc04['params']['id']}})[_0xafac('0x1e')](function(_0x64a183){return db[_0xafac('0x73')][_0xafac('0x86')](function(_0x14881d){return _0x64a183[_0xafac('0x78')](_0x4edc04['query'][_0xafac('0x6c')],{'transaction':_0x14881d})[_0xafac('0x1e')](function(){if(!_[_0xafac('0x87')](_0x1fb7f5)){return _0x64a183[_0xafac('0x88')](_0x1fb7f5,{'transaction':_0x14881d});}})[_0xafac('0x1e')](function(){_0x1fb7f5[_0xafac('0x76')](function(_0x3e879b){socket[_0xafac('0x89')](_0xafac('0x8a'),{'UserId':_0x3e879b,'ChatQueueId':_0x64a183['id']});});});});});});})[_0xafac('0x1e')](respondWithStatusCode(_0x1c3e2a,null))[_0xafac('0x28')](handleError(_0x1c3e2a,null));};exports[_0xafac('0x8b')]=function(_0x52f5d9,_0xaabaaf,_0x6e3535){return db[_0xafac('0x36')][_0xafac('0x58')]({'where':{'id':_0x52f5d9[_0xafac('0x5d')]['id']}})[_0xafac('0x1e')](handleEntityNotFound(_0xaabaaf,null))[_0xafac('0x1e')](function(_0x3ad5b3){if(_0x3ad5b3){return _0x3ad5b3[_0xafac('0x8b')](_0x52f5d9[_0xafac('0x53')][_0xafac('0x6c')],_['omit'](_0x52f5d9['body'],[_0xafac('0x6c'),'id'])||{})[_0xafac('0x8c')](function(_0x3e14c6){for(var _0x384cbb=0x0;_0x384cbb<_0x52f5d9['body']['ids'][_0xafac('0x41')];_0x384cbb+=0x1){socket[_0xafac('0x89')]('userChatQueue:save',{'UserId':_0x52f5d9[_0xafac('0x53')][_0xafac('0x6c')][_0x384cbb],'ChatQueueId':_0x52f5d9['params']['id']});}return _0x3e14c6;});}})[_0xafac('0x1e')](respondWithResult(_0xaabaaf,null))[_0xafac('0x28')](handleError(_0xaabaaf,null));};exports[_0xafac('0x88')]=function(_0x210adf,_0x1cba3f,_0x56612d){return db['ChatQueue'][_0xafac('0x58')]({'where':{'id':_0x210adf['params']['id']}})['then'](handleEntityNotFound(_0x1cba3f,null))['then'](function(_0x48fbb3){if(_0x48fbb3){return _0x48fbb3[_0xafac('0x88')](_0x210adf[_0xafac('0x3c')]['ids'])[_0xafac('0x1e')](function(){if(_[_0xafac('0x8d')](_0x210adf[_0xafac('0x3c')]['ids'])){for(var _0xe018e1=0x0;_0xe018e1<_0x210adf[_0xafac('0x3c')][_0xafac('0x6c')]['length'];_0xe018e1+=0x1){socket[_0xafac('0x89')](_0xafac('0x8a'),{'UserId':Number(_0x210adf['query'][_0xafac('0x6c')][_0xe018e1]),'ChatQueueId':Number(_0x210adf[_0xafac('0x5d')]['id'])});}}else{socket[_0xafac('0x89')]('userChatQueue:remove',{'UserId':Number(_0x210adf[_0xafac('0x3c')][_0xafac('0x6c')]),'ChatQueueId':Number(_0x210adf[_0xafac('0x5d')]['id'])});}});}})[_0xafac('0x1e')](respondWithStatusCode(_0x1cba3f,null))[_0xafac('0x28')](handleError(_0x1cba3f,null));};exports[_0xafac('0x8e')]=function(_0x23a6cf,_0x499492,_0x45c12b){var _0x5b013b={};var _0x12e8e5={};var _0x3a4b61;var _0x5c473d;return db['ChatQueue'][_0xafac('0x5f')]({'where':{'id':_0x23a6cf['params']['id']}})['then'](handleEntityNotFound(_0x499492,null))[_0xafac('0x1e')](function(_0xa3dcaf){if(_0xa3dcaf){_0x3a4b61=_0xa3dcaf;_0x12e8e5['model']=_[_0xafac('0x3b')](db['User'][_0xafac('0x51')]);_0x12e8e5[_0xafac('0x3c')]=_[_0xafac('0x3b')](_0x23a6cf['query']);_0x12e8e5[_0xafac('0x3d')]=_[_0xafac('0x3e')](_0x12e8e5[_0xafac('0x39')],_0x12e8e5[_0xafac('0x3c')]);_0x5b013b['attributes']=_[_0xafac('0x3e')](_0x12e8e5[_0xafac('0x39')],qs['fields'](_0x23a6cf['query'][_0xafac('0x40')]));_0x5b013b[_0xafac('0x3f')]=_0x5b013b[_0xafac('0x3f')][_0xafac('0x41')]?_0x5b013b[_0xafac('0x3f')]:_0x12e8e5['model'];_0x5b013b['order']=qs[_0xafac('0x45')](_0x23a6cf['query'][_0xafac('0x45')]);_0x5b013b['where']=qs[_0xafac('0x3d')](_[_0xafac('0x46')](_0x23a6cf['query'],_0x12e8e5[_0xafac('0x3d')]));if(_0x23a6cf[_0xafac('0x3c')]['filter']){_0x5b013b[_0xafac('0x48')]=_[_0xafac('0x49')](_0x5b013b[_0xafac('0x48')],{'$or':_[_0xafac('0x3a')](_0x5b013b[_0xafac('0x3f')],function(_0x56a913){var _0x3d0a18={};_0x3d0a18[_0x56a913]={'$like':'%'+_0x23a6cf[_0xafac('0x3c')][_0xafac('0x47')]+'%'};return _0x3d0a18;})});}_0x5b013b=_[_0xafac('0x49')]({},_0x5b013b,_0x23a6cf['options']);return _0x3a4b61['getAgents'](_0x5b013b);}})[_0xafac('0x1e')](function(_0x3e9609){if(_0x3e9609){_0x5c473d=_0x3e9609[_0xafac('0x41')];if(!_0x23a6cf[_0xafac('0x3c')][_0xafac('0x42')]('nolimit')){_0x5b013b[_0xafac('0x43')]=qs[_0xafac('0x43')](_0x23a6cf['query'][_0xafac('0x43')]);_0x5b013b['offset']=qs[_0xafac('0x2c')](_0x23a6cf[_0xafac('0x3c')][_0xafac('0x2c')]);}return _0x3a4b61[_0xafac('0x8e')](_0x5b013b);}})[_0xafac('0x1e')](function(_0x509a10){if(_0x509a10){return _0x509a10?{'count':_0x5c473d,'rows':_0x509a10}:null;}})['then'](respondWithResult(_0x499492,null))['catch'](handleError(_0x499492,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 78ddb1e..2cbe92c 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x51b2c9,_0x155ab8){var _0x1490ea=function(_0x3a1b46){while(--_0x3a1b46){_0x51b2c9['push'](_0x51b2c9['shift']());}};_0x1490ea(++_0x155ab8);}(_0xb10b,0x12a));var _0xbb10=function(_0x22fc1d,_0x5b8ee1){_0x22fc1d=_0x22fc1d-0x0;var _0x29e032=_0xb10b[_0x22fc1d];return _0x29e032;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x0b0e=['ChatQueue','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0xc7272c,_0x281fe1){var _0x2760ca=function(_0x3393b4){while(--_0x3393b4){_0xc7272c['push'](_0xc7272c['shift']());}};_0x2760ca(++_0x281fe1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x0b0e[_0x5ce3c8];return _0xa76867;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xe0b0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){ChatQueueEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);ChatQueueEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];ChatQueue[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index bdb152d..937ba25 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 _0x30de=['exports','define','ChatQueue','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./chatQueue.attributes'];(function(_0xaffe9a,_0x13bf53){var _0x4e01bf=function(_0x58ea84){while(--_0x58ea84){_0xaffe9a['push'](_0xaffe9a['shift']());}};_0x4e01bf(++_0x13bf53);}(_0x30de,0x158));var _0xe30d=function(_0x29ad3b,_0x1a729a){_0x29ad3b=_0x29ad3b-0x0;var _0x97be17=_0x30de[_0x29ad3b];return _0x97be17;};'use strict';var _=require(_0xe30d('0x0'));var util=require('util');var logger=require(_0xe30d('0x1'))(_0xe30d('0x2'));var moment=require('moment');var BPromise=require(_0xe30d('0x3'));var rp=require(_0xe30d('0x4'));var fs=require('fs');var path=require(_0xe30d('0x5'));var rimraf=require('rimraf');var config=require(_0xe30d('0x6'));var attributes=require(_0xe30d('0x7'));module[_0xe30d('0x8')]=function(_0x14d5b8,_0x2fa123){return _0x14d5b8[_0xe30d('0x9')](_0xe30d('0xa'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37e8=['exports','define','chat_queues','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x37e8,0x111));var _0x837e=function(_0x3e9e2c,_0x3e2062){_0x3e9e2c=_0x3e9e2c-0x0;var _0x3af1a2=_0x37e8[_0x3e9e2c];return _0x3af1a2;};'use strict';var _=require(_0x837e('0x0'));var util=require(_0x837e('0x1'));var logger=require(_0x837e('0x2'))('api');var moment=require(_0x837e('0x3'));var BPromise=require('bluebird');var rp=require(_0x837e('0x4'));var fs=require('fs');var path=require(_0x837e('0x5'));var rimraf=require('rimraf');var config=require(_0x837e('0x6'));var attributes=require('./chatQueue.attributes');module[_0x837e('0x7')]=function(_0x56a186,_0x51d2d3){return _0x56a186[_0x837e('0x8')]('ChatQueue',attributes,{'tableName':_0x837e('0x9'),'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 92381ec..6990dec 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 _0x316b=['attributes','ShowChatQueue','find','where','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','limit','include','map','model'];(function(_0x3e5dc7,_0x375600){var _0x49a701=function(_0x3f8048){while(--_0x3f8048){_0x3e5dc7['push'](_0x3e5dc7['shift']());}};_0x49a701(++_0x375600);}(_0x316b,0x17e));var _0xb316=function(_0x316c42,_0x3391f0){_0x316c42=_0x316c42-0x0;var _0x2b38f7=_0x316b[_0x316c42];return _0x2b38f7;};'use strict';var _=require(_0xb316('0x0'));var util=require('util');var moment=require(_0xb316('0x1'));var BPromise=require('bluebird');var rs=require(_0xb316('0x2'));var fs=require('fs');var Redis=require(_0xb316('0x3'));var db=require(_0xb316('0x4'))['db'];var utils=require(_0xb316('0x5'));var logger=require(_0xb316('0x6'))(_0xb316('0x7'));var config=require(_0xb316('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb316('0x9')][_0xb316('0xa')]({'port':0x232a});config[_0xb316('0xb')]=_[_0xb316('0xc')](config['redis'],{'host':_0xb316('0xd'),'port':0x18eb});var socket=require(_0xb316('0xe'))(new Redis(config['redis']));require(_0xb316('0xf'))[_0xb316('0x10')](socket);function respondWithRpcPromise(_0x23dda9,_0x337c5c,_0x58d622){return new BPromise(function(_0x1d376c,_0xba6dd6){return client[_0xb316('0x11')](_0x23dda9,_0x58d622)[_0xb316('0x12')](function(_0x7d3df7){logger[_0xb316('0x13')](_0xb316('0x14'),_0x337c5c,_0xb316('0x15'));logger[_0xb316('0x16')](_0xb316('0x17'),_0x337c5c,'request\x20sent',JSON[_0xb316('0x18')](_0x7d3df7));if(_0x7d3df7[_0xb316('0x19')]){if(_0x7d3df7['error'][_0xb316('0x1a')]===0x1f4){logger[_0xb316('0x19')](_0xb316('0x14'),_0x337c5c,_0x7d3df7[_0xb316('0x19')]['message']);return _0xba6dd6(_0x7d3df7[_0xb316('0x19')][_0xb316('0x1b')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x337c5c,_0x7d3df7['error'][_0xb316('0x1b')]);return _0x1d376c(_0x7d3df7['error'][_0xb316('0x1b')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x337c5c,_0xb316('0x15'));_0x1d376c(_0x7d3df7['result']['message']);}})[_0xb316('0x1c')](function(_0x515543){logger['error'](_0xb316('0x14'),_0x337c5c,_0x515543);_0xba6dd6(_0x515543);});});}exports[_0xb316('0x1d')]=function(_0xbbd51a){var _0x4df491=this;return new Promise(function(_0x4b9b83,_0x3f0c08){return db[_0xb316('0x1e')][_0xb316('0x1f')]({'raw':_0xbbd51a[_0xb316('0x20')]?_0xbbd51a[_0xb316('0x20')][_0xb316('0x21')]===undefined?!![]:![]:!![],'where':_0xbbd51a['options']?_0xbbd51a[_0xb316('0x20')]['where']||null:null,'attributes':_0xbbd51a[_0xb316('0x20')]?_0xbbd51a[_0xb316('0x20')]['attributes']||null:null,'limit':_0xbbd51a['options']?_0xbbd51a['options'][_0xb316('0x22')]||null:null,'include':_0xbbd51a['options']?_0xbbd51a[_0xb316('0x20')][_0xb316('0x23')]?_[_0xb316('0x24')](_0xbbd51a[_0xb316('0x20')][_0xb316('0x23')],function(_0x2ddcf8){return{'model':db[_0x2ddcf8[_0xb316('0x25')]],'as':_0x2ddcf8['as'],'attributes':_0x2ddcf8[_0xb316('0x26')],'include':_0x2ddcf8[_0xb316('0x23')]?_[_0xb316('0x24')](_0x2ddcf8['include'],function(_0x152686){return{'model':db[_0x152686['model']],'as':_0x152686['as'],'attributes':_0x152686[_0xb316('0x26')],'include':_0x152686[_0xb316('0x23')]?_[_0xb316('0x24')](_0x152686[_0xb316('0x23')],function(_0x1dc996){return{'model':db[_0x1dc996['model']],'as':_0x1dc996['as'],'attributes':_0x1dc996[_0xb316('0x26')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23fe76){logger['info']('GetChatQueue',_0xbbd51a);logger['debug']('GetChatQueue',_0xbbd51a,JSON[_0xb316('0x18')](_0x23fe76));_0x4b9b83(_0x23fe76);})['catch'](function(_0xd51317){logger[_0xb316('0x19')](_0xb316('0x1d'),_0xd51317['message'],_0xbbd51a);_0x3f0c08(_0x4df491['error'](0x1f4,_0xd51317[_0xb316('0x1b')]));});});};exports[_0xb316('0x27')]=function(_0xbea147){var _0xcea573=this;return new Promise(function(_0x46ee17,_0xc41882){return db[_0xb316('0x1e')][_0xb316('0x28')]({'raw':_0xbea147[_0xb316('0x20')]?_0xbea147['options'][_0xb316('0x21')]===undefined?!![]:![]:!![],'where':_0xbea147[_0xb316('0x20')]?_0xbea147['options'][_0xb316('0x29')]||null:null,'attributes':_0xbea147[_0xb316('0x20')]?_0xbea147[_0xb316('0x20')]['attributes']||null:null,'include':_0xbea147[_0xb316('0x20')]?_0xbea147[_0xb316('0x20')][_0xb316('0x23')]?_[_0xb316('0x24')](_0xbea147['options'][_0xb316('0x23')],function(_0x57b51d){return{'model':db[_0x57b51d[_0xb316('0x25')]],'as':_0x57b51d['as'],'attributes':_0x57b51d[_0xb316('0x26')],'include':_0x57b51d['include']?_[_0xb316('0x24')](_0x57b51d['include'],function(_0x44beb7){return{'model':db[_0x44beb7[_0xb316('0x25')]],'as':_0x44beb7['as'],'attributes':_0x44beb7[_0xb316('0x26')],'include':_0x44beb7[_0xb316('0x23')]?_[_0xb316('0x24')](_0x44beb7[_0xb316('0x23')],function(_0x2f7e73){return{'model':db[_0x2f7e73[_0xb316('0x25')]],'as':_0x2f7e73['as'],'attributes':_0x2f7e73[_0xb316('0x26')]};}):[]};}):[]};}):[]:[]})[_0xb316('0x12')](function(_0x30767f){logger[_0xb316('0x13')](_0xb316('0x27'),_0xbea147);logger['debug'](_0xb316('0x27'),_0xbea147,JSON[_0xb316('0x18')](_0x30767f));_0x46ee17(_0x30767f);})[_0xb316('0x1c')](function(_0x599c86){logger[_0xb316('0x19')](_0xb316('0x27'),_0x599c86['message'],_0xbea147);_0xc41882(_0xcea573[_0xb316('0x19')](0x1f4,_0x599c86[_0xb316('0x1b')]));});});}; \ No newline at end of file +var _0x6f24=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','find','where','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2436bf,_0x5bf69f){var _0x173ab5=function(_0x49ec39){while(--_0x49ec39){_0x2436bf['push'](_0x2436bf['shift']());}};_0x173ab5(++_0x5bf69f);}(_0x6f24,0x76));var _0x46f2=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0x6f24[_0x25df80];return _0x17b6d0;};'use strict';var _=require(_0x46f2('0x0'));var util=require(_0x46f2('0x1'));var moment=require('moment');var BPromise=require(_0x46f2('0x2'));var rs=require(_0x46f2('0x3'));var fs=require('fs');var Redis=require(_0x46f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46f2('0x5'));var logger=require('../../config/logger')(_0x46f2('0x6'));var config=require(_0x46f2('0x7'));var jayson=require(_0x46f2('0x8'));var client=jayson[_0x46f2('0x9')][_0x46f2('0xa')]({'port':0x232a});config['redis']=_[_0x46f2('0xb')](config[_0x46f2('0xc')],{'host':_0x46f2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x46f2('0xc')]));require(_0x46f2('0xe'))[_0x46f2('0xf')](socket);function respondWithRpcPromise(_0x1504b5,_0x588630,_0x49e81a){return new BPromise(function(_0x42d435,_0x3267d4){return client[_0x46f2('0x10')](_0x1504b5,_0x49e81a)[_0x46f2('0x11')](function(_0x52b5ca){logger[_0x46f2('0x12')](_0x46f2('0x13'),_0x588630,_0x46f2('0x14'));logger[_0x46f2('0x15')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x588630,_0x46f2('0x14'),JSON[_0x46f2('0x16')](_0x52b5ca));if(_0x52b5ca[_0x46f2('0x17')]){if(_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x18')]===0x1f4){logger[_0x46f2('0x17')](_0x46f2('0x13'),_0x588630,_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x19')]);return _0x3267d4(_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x19')]);}logger[_0x46f2('0x17')](_0x46f2('0x13'),_0x588630,_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x19')]);return _0x42d435(_0x52b5ca[_0x46f2('0x17')][_0x46f2('0x19')]);}else{logger[_0x46f2('0x12')](_0x46f2('0x13'),_0x588630,_0x46f2('0x14'));_0x42d435(_0x52b5ca[_0x46f2('0x1a')]['message']);}})[_0x46f2('0x1b')](function(_0x5a1380){logger[_0x46f2('0x17')](_0x46f2('0x13'),_0x588630,_0x5a1380);_0x3267d4(_0x5a1380);});});}exports['GetChatQueue']=function(_0x5970a1){var _0x45ea96=this;return new Promise(function(_0x1fac0d,_0x170b5e){return db[_0x46f2('0x1c')][_0x46f2('0x1d')]({'raw':_0x5970a1[_0x46f2('0x1e')]?_0x5970a1['options'][_0x46f2('0x1f')]===undefined?!![]:![]:!![],'where':_0x5970a1['options']?_0x5970a1[_0x46f2('0x1e')]['where']||null:null,'attributes':_0x5970a1[_0x46f2('0x1e')]?_0x5970a1[_0x46f2('0x1e')][_0x46f2('0x20')]||null:null,'limit':_0x5970a1[_0x46f2('0x1e')]?_0x5970a1[_0x46f2('0x1e')][_0x46f2('0x21')]||null:null,'include':_0x5970a1['options']?_0x5970a1[_0x46f2('0x1e')][_0x46f2('0x22')]?_[_0x46f2('0x23')](_0x5970a1[_0x46f2('0x1e')]['include'],function(_0x3017c9){return{'model':db[_0x3017c9[_0x46f2('0x24')]],'as':_0x3017c9['as'],'attributes':_0x3017c9[_0x46f2('0x20')],'include':_0x3017c9['include']?_[_0x46f2('0x23')](_0x3017c9['include'],function(_0x5807d9){return{'model':db[_0x5807d9[_0x46f2('0x24')]],'as':_0x5807d9['as'],'attributes':_0x5807d9['attributes'],'include':_0x5807d9[_0x46f2('0x22')]?_[_0x46f2('0x23')](_0x5807d9['include'],function(_0x58e2d8){return{'model':db[_0x58e2d8[_0x46f2('0x24')]],'as':_0x58e2d8['as'],'attributes':_0x58e2d8[_0x46f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x46f2('0x11')](function(_0x4b42c2){logger[_0x46f2('0x12')]('GetChatQueue',_0x5970a1);logger[_0x46f2('0x15')]('GetChatQueue',_0x5970a1,JSON[_0x46f2('0x16')](_0x4b42c2));_0x1fac0d(_0x4b42c2);})[_0x46f2('0x1b')](function(_0x881bf8){logger[_0x46f2('0x17')](_0x46f2('0x25'),_0x881bf8[_0x46f2('0x19')],_0x5970a1);_0x170b5e(_0x45ea96[_0x46f2('0x17')](0x1f4,_0x881bf8[_0x46f2('0x19')]));});});};exports[_0x46f2('0x26')]=function(_0x5ef16f){var _0x4ad380=this;return new Promise(function(_0x1971a5,_0x434ba2){return db[_0x46f2('0x1c')][_0x46f2('0x27')]({'raw':_0x5ef16f['options']?_0x5ef16f[_0x46f2('0x1e')][_0x46f2('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ef16f[_0x46f2('0x1e')]?_0x5ef16f['options'][_0x46f2('0x28')]||null:null,'attributes':_0x5ef16f[_0x46f2('0x1e')]?_0x5ef16f['options'][_0x46f2('0x20')]||null:null,'include':_0x5ef16f[_0x46f2('0x1e')]?_0x5ef16f[_0x46f2('0x1e')][_0x46f2('0x22')]?_['map'](_0x5ef16f[_0x46f2('0x1e')][_0x46f2('0x22')],function(_0x3e9ef5){return{'model':db[_0x3e9ef5[_0x46f2('0x24')]],'as':_0x3e9ef5['as'],'attributes':_0x3e9ef5[_0x46f2('0x20')],'include':_0x3e9ef5[_0x46f2('0x22')]?_['map'](_0x3e9ef5['include'],function(_0x1f4f6c){return{'model':db[_0x1f4f6c['model']],'as':_0x1f4f6c['as'],'attributes':_0x1f4f6c['attributes'],'include':_0x1f4f6c[_0x46f2('0x22')]?_[_0x46f2('0x23')](_0x1f4f6c['include'],function(_0x2b6598){return{'model':db[_0x2b6598[_0x46f2('0x24')]],'as':_0x2b6598['as'],'attributes':_0x2b6598['attributes']};}):[]};}):[]};}):[]:[]})[_0x46f2('0x11')](function(_0x56369a){logger[_0x46f2('0x12')](_0x46f2('0x26'),_0x5ef16f);logger[_0x46f2('0x15')](_0x46f2('0x26'),_0x5ef16f,JSON[_0x46f2('0x16')](_0x56369a));_0x1971a5(_0x56369a);})[_0x46f2('0x1b')](function(_0x5d6049){logger['error']('ShowChatQueue',_0x5d6049[_0x46f2('0x19')],_0x5ef16f);_0x434ba2(_0x4ad380[_0x46f2('0x17')](0x1f4,_0x5d6049[_0x46f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 6e5f57c..b1afbd2 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 _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0xb62e11,_0x5be8ed){var _0x5cfc1b=function(_0x5e0bdd){while(--_0x5e0bdd){_0xb62e11['push'](_0xb62e11['shift']());}};_0x5cfc1b(++_0x5be8ed);}(_0x0b0e,0x187));var _0xe0b0=function(_0x22f9c0,_0x35410c){_0x22f9c0=_0x22f9c0-0x0;var _0x1883fe=_0x0b0e[_0x22f9c0];return _0x1883fe;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x5e3139,_0x5bad26){var _0x3cdf31=function(_0x51647e){while(--_0x51647e){_0x5e3139['push'](_0x5e3139['shift']());}};_0x3cdf31(++_0x5bad26);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2bece8,_0x27c181){_0x2bece8=_0x2bece8-0x0;var _0xc01f33=_0x5f2f[_0x2bece8];return _0xc01f33;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 80232f0..3ce5db7 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 _0x9ed9=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getAgents','create','post','addTeams','/:id/users','put','delete','destroy','removeTeams'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ed9,0x15e));var _0x99ed=function(_0x56107e,_0x2bdce4){_0x56107e=_0x56107e-0x0;var _0x2f1322=_0x9ed9[_0x56107e];return _0x2f1322;};'use strict';var multer=require(_0x99ed('0x0'));var util=require(_0x99ed('0x1'));var path=require(_0x99ed('0x2'));var timeout=require('connect-timeout');var express=require(_0x99ed('0x3'));var router=express[_0x99ed('0x4')]();var auth=require(_0x99ed('0x5'));var interaction=require(_0x99ed('0x6'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x99ed('0x7')]);router[_0x99ed('0x8')](_0x99ed('0x9'),auth[_0x99ed('0xa')](),controller[_0x99ed('0xb')]);router[_0x99ed('0x8')](_0x99ed('0xc'),auth[_0x99ed('0xa')](),controller[_0x99ed('0xd')]);router[_0x99ed('0x8')](_0x99ed('0xe'),auth[_0x99ed('0xa')](),controller['getMembers']);router['get'](_0x99ed('0xf'),auth[_0x99ed('0xa')](),controller['getTeams']);router['get']('/:id/users',auth[_0x99ed('0xa')](),controller[_0x99ed('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x99ed('0x11')]);router[_0x99ed('0x12')]('/:id/teams',auth['isAuthenticated'](),controller[_0x99ed('0x13')]);router[_0x99ed('0x12')](_0x99ed('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0x99ed('0x15')](_0x99ed('0xc'),auth[_0x99ed('0xa')](),controller['update']);router[_0x99ed('0x16')](_0x99ed('0xc'),auth[_0x99ed('0xa')](),controller[_0x99ed('0x17')]);router['delete']('/:id/teams',auth[_0x99ed('0xa')](),controller[_0x99ed('0x18')]);router['delete'](_0x99ed('0x14'),auth[_0x99ed('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xab96=['/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getAgents','create','post','/:id/teams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index'];(function(_0x4f0fba,_0x4faa95){var _0x13e196=function(_0x5ce11f){while(--_0x5ce11f){_0x4f0fba['push'](_0x4f0fba['shift']());}};_0x13e196(++_0x4faa95);}(_0xab96,0x66));var _0x6ab9=function(_0x49de6f,_0x148549){_0x49de6f=_0x49de6f-0x0;var _0x2761da=_0xab96[_0x49de6f];return _0x2761da;};'use strict';var multer=require(_0x6ab9('0x0'));var util=require(_0x6ab9('0x1'));var path=require(_0x6ab9('0x2'));var timeout=require(_0x6ab9('0x3'));var express=require(_0x6ab9('0x4'));var router=express[_0x6ab9('0x5')]();var auth=require(_0x6ab9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6ab9('0x7'));var controller=require('./chatQueue.controller');router[_0x6ab9('0x8')]('/',auth['isAuthenticated'](),controller[_0x6ab9('0x9')]);router[_0x6ab9('0x8')](_0x6ab9('0xa'),auth[_0x6ab9('0xb')](),controller['describe']);router['get'](_0x6ab9('0xc'),auth[_0x6ab9('0xb')](),controller[_0x6ab9('0xd')]);router[_0x6ab9('0x8')](_0x6ab9('0xe'),auth[_0x6ab9('0xb')](),controller[_0x6ab9('0xf')]);router['get']('/:id/teams',auth[_0x6ab9('0xb')](),controller['getTeams']);router[_0x6ab9('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x6ab9('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6ab9('0x11')]);router[_0x6ab9('0x12')](_0x6ab9('0x13'),auth[_0x6ab9('0xb')](),controller['addTeams']);router[_0x6ab9('0x12')](_0x6ab9('0x14'),auth[_0x6ab9('0xb')](),controller[_0x6ab9('0x15')]);router[_0x6ab9('0x16')](_0x6ab9('0xc'),auth[_0x6ab9('0xb')](),controller['update']);router[_0x6ab9('0x17')](_0x6ab9('0xc'),auth[_0x6ab9('0xb')](),controller[_0x6ab9('0x18')]);router[_0x6ab9('0x17')](_0x6ab9('0x13'),auth[_0x6ab9('0xb')](),controller[_0x6ab9('0x19')]);router[_0x6ab9('0x17')](_0x6ab9('0x14'),auth['isAuthenticated'](),controller[_0x6ab9('0x1a')]);module[_0x6ab9('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 ee0af5a..be7e2a8 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 _0x46da=['sequelize','exports','STRING','DATE','moment'];(function(_0x2a3113,_0x4a16c6){var _0x981cf2=function(_0x27c266){while(--_0x27c266){_0x2a3113['push'](_0x2a3113['shift']());}};_0x981cf2(++_0x4a16c6);}(_0x46da,0x199));var _0xa46d=function(_0x5f0e5c,_0x1a621d){_0x5f0e5c=_0x5f0e5c-0x0;var _0x2ded8a=_0x46da[_0x5f0e5c];return _0x2ded8a;};'use strict';var moment=require(_0xa46d('0x0'));var Sequelize=require(_0xa46d('0x1'));module[_0xa46d('0x2')]={'uniqueid':{'type':Sequelize[_0xa46d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa46d('0x3')]},'joinAt':{'type':Sequelize[_0xa46d('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x09e1=['sequelize','exports','STRING','DATE','moment'];(function(_0x14e7e8,_0x5e60df){var _0x402654=function(_0x373543){while(--_0x373543){_0x14e7e8['push'](_0x14e7e8['shift']());}};_0x402654(++_0x5e60df);}(_0x09e1,0x176));var _0x109e=function(_0x1a5726,_0xaad56f){_0x1a5726=_0x1a5726-0x0;var _0x118362=_0x09e1[_0x1a5726];return _0x118362;};'use strict';var moment=require(_0x109e('0x0'));var Sequelize=require(_0x109e('0x1'));module[_0x109e('0x2')]={'uniqueid':{'type':Sequelize[_0x109e('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x109e('0x3')]},'joinAt':{'type':Sequelize[_0x109e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x109e('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b2d9455..27d83d0 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 _0xce8c=['update','then','destroy','error','name','index','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x423a7c,_0x5efcb3){var _0x13be1c=function(_0x14e87b){while(--_0x14e87b){_0x423a7c['push'](_0x423a7c['shift']());}};_0x13be1c(++_0x5efcb3);}(_0xce8c,0x157));var _0xcce8=function(_0x3eba1e,_0x420ac5){_0x3eba1e=_0x3eba1e-0x0;var _0x312ee8=_0xce8c[_0x3eba1e];return _0x312ee8;};'use strict';var pdf=require(_0xcce8('0x0'));var emlformat=require(_0xcce8('0x1'));var rimraf=require(_0xcce8('0x2'));var zipdir=require(_0xcce8('0x3'));var jsonpatch=require(_0xcce8('0x4'));var rp=require(_0xcce8('0x5'));var moment=require(_0xcce8('0x6'));var BPromise=require(_0xcce8('0x7'));var Mustache=require(_0xcce8('0x8'));var util=require('util');var path=require(_0xcce8('0x9'));var sox=require(_0xcce8('0xa'));var csv=require(_0xcce8('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcce8('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcce8('0xd'));var deskjs=require(_0xcce8('0xe'));var toCsv=require(_0xcce8('0xb'));var querystring=require(_0xcce8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcce8('0x10'));var qs=require(_0xcce8('0x11'));var as=require(_0xcce8('0x12'));var hardwareService=require(_0xcce8('0x13'));var logger=require(_0xcce8('0x14'))(_0xcce8('0x15'));var utils=require(_0xcce8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcce8('0x17'));var db=require(_0xcce8('0x18'))['db'];function respondWithStatusCode(_0x477e19,_0x1004d3){_0x1004d3=_0x1004d3||0xcc;return function(_0x4d9727){if(_0x4d9727){return _0x477e19[_0xcce8('0x19')](_0x1004d3);}return _0x477e19[_0xcce8('0x1a')](_0x1004d3)[_0xcce8('0x1b')]();};}function respondWithResult(_0x149ce3,_0x22a208){_0x22a208=_0x22a208||0xc8;return function(_0x24f974){if(_0x24f974){return _0x149ce3['status'](_0x22a208)[_0xcce8('0x1c')](_0x24f974);}};}function respondWithFilteredResult(_0x51adc7,_0x5172b1){return function(_0x4454d1){if(_0x4454d1){var _0x5911f6=_0x4454d1[_0xcce8('0x1d')],_0x53b18d=_0x5172b1[_0xcce8('0x1e')],_0x20ece5=_0x5172b1[_0xcce8('0x1e')]+_0x5172b1[_0xcce8('0x1f')],_0x34a1ca;if(_0x20ece5>=_0x5911f6){_0x20ece5=_0x5911f6;_0x34a1ca=0xc8;}else{_0x34a1ca=0xce;}_0x51adc7[_0xcce8('0x1a')](_0x34a1ca);return _0x51adc7[_0xcce8('0x20')](_0xcce8('0x21'),_0x53b18d+'-'+_0x20ece5+'/'+_0x5911f6)[_0xcce8('0x1c')](_0x4454d1);}return null;};}function patchUpdates(_0x20b6fb){return function(_0x5cfb67){try{jsonpatch[_0xcce8('0x22')](_0x5cfb67,_0x20b6fb,!![]);}catch(_0x18a1fd){return BPromise[_0xcce8('0x23')](_0x18a1fd);}return _0x5cfb67[_0xcce8('0x24')]();};}function saveUpdates(_0x4d1b90,_0x37973a){return function(_0x4e42e4){if(_0x4e42e4){return _0x4e42e4[_0xcce8('0x25')](_0x4d1b90)[_0xcce8('0x26')](function(_0x1e4339){return _0x1e4339;});}return null;};}function removeEntity(_0x8fe904,_0x2cf9eb){return function(_0x52b4dd){if(_0x52b4dd){return _0x52b4dd[_0xcce8('0x27')]()[_0xcce8('0x26')](function(){_0x8fe904[_0xcce8('0x1a')](0xcc)[_0xcce8('0x1b')]();});}};}function handleEntityNotFound(_0x5b83df,_0x13b13a){return function(_0x508bfa){if(!_0x508bfa){_0x5b83df[_0xcce8('0x19')](0x194);}return _0x508bfa;};}function handleError(_0x1b3bf9,_0x250f9b){_0x250f9b=_0x250f9b||0x1f4;return function(_0x4d7715){logger[_0xcce8('0x28')](_0x4d7715['stack']);if(_0x4d7715[_0xcce8('0x29')]){delete _0x4d7715['name'];}_0x1b3bf9['status'](_0x250f9b)['send'](_0x4d7715);};}exports[_0xcce8('0x2a')]=function(_0x56b13f,_0x3e0471){var _0x1ea0f6={},_0x31bb5a={},_0x1fa558={'count':0x0,'rows':[]};var _0x542629=_[_0xcce8('0x2b')](db[_0xcce8('0x2c')][_0xcce8('0x2d')],function(_0x3292f2){return{'name':_0x3292f2['fieldName'],'type':_0x3292f2[_0xcce8('0x2e')][_0xcce8('0x2f')]};});_0x31bb5a[_0xcce8('0x30')]=_[_0xcce8('0x2b')](_0x542629,_0xcce8('0x29'));_0x31bb5a[_0xcce8('0x31')]=_[_0xcce8('0x32')](_0x56b13f[_0xcce8('0x31')]);_0x31bb5a['filters']=_[_0xcce8('0x33')](_0x31bb5a[_0xcce8('0x30')],_0x31bb5a[_0xcce8('0x31')]);_0x1ea0f6[_0xcce8('0x34')]=_['intersection'](_0x31bb5a[_0xcce8('0x30')],qs[_0xcce8('0x35')](_0x56b13f[_0xcce8('0x31')][_0xcce8('0x35')]));_0x1ea0f6[_0xcce8('0x34')]=_0x1ea0f6[_0xcce8('0x34')][_0xcce8('0x36')]?_0x1ea0f6[_0xcce8('0x34')]:_0x31bb5a['model'];if(!_0x56b13f['query'][_0xcce8('0x37')](_0xcce8('0x38'))){_0x1ea0f6[_0xcce8('0x1f')]=qs[_0xcce8('0x1f')](_0x56b13f[_0xcce8('0x31')][_0xcce8('0x1f')]);_0x1ea0f6[_0xcce8('0x1e')]=qs['offset'](_0x56b13f[_0xcce8('0x31')][_0xcce8('0x1e')]);}_0x1ea0f6[_0xcce8('0x39')]=qs[_0xcce8('0x3a')](_0x56b13f[_0xcce8('0x31')]['sort']);_0x1ea0f6[_0xcce8('0x3b')]=qs[_0xcce8('0x3c')](_[_0xcce8('0x3d')](_0x56b13f[_0xcce8('0x31')],_0x31bb5a[_0xcce8('0x3c')]),_0x542629);if(_0x56b13f[_0xcce8('0x31')][_0xcce8('0x3e')]){_0x1ea0f6['where']=_[_0xcce8('0x3f')](_0x1ea0f6['where'],{'$or':_[_0xcce8('0x2b')](_0x542629,function(_0x121a85){if(_0x121a85['type']!==_0xcce8('0x40')){var _0x3b0872={};_0x3b0872[_0x121a85['name']]={'$like':'%'+_0x56b13f['query'][_0xcce8('0x3e')]+'%'};return _0x3b0872;}})});}_0x1ea0f6=_[_0xcce8('0x3f')]({},_0x1ea0f6,_0x56b13f[_0xcce8('0x41')]);var _0x3d3ce3={'where':_0x1ea0f6[_0xcce8('0x3b')]};return db[_0xcce8('0x2c')][_0xcce8('0x1d')](_0x3d3ce3)[_0xcce8('0x26')](function(_0x483745){_0x1fa558[_0xcce8('0x1d')]=_0x483745;if(_0x56b13f['query'][_0xcce8('0x42')]){_0x1ea0f6[_0xcce8('0x43')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x1ea0f6);})[_0xcce8('0x26')](function(_0x84450b){_0x1fa558[_0xcce8('0x44')]=_0x84450b;return _0x1fa558;})['then'](respondWithFilteredResult(_0x3e0471,_0x1ea0f6))[_0xcce8('0x45')](handleError(_0x3e0471,null));};exports[_0xcce8('0x46')]=function(_0x4e60c4,_0x47cec8){var _0x3d6d0c={'raw':!![],'where':{'id':_0x4e60c4[_0xcce8('0x47')]['id']}},_0x567fa3={};_0x567fa3['model']=_[_0xcce8('0x32')](db[_0xcce8('0x2c')]['rawAttributes']);_0x567fa3[_0xcce8('0x31')]=_[_0xcce8('0x32')](_0x4e60c4[_0xcce8('0x31')]);_0x567fa3[_0xcce8('0x3c')]=_[_0xcce8('0x33')](_0x567fa3[_0xcce8('0x30')],_0x567fa3[_0xcce8('0x31')]);_0x3d6d0c[_0xcce8('0x34')]=_[_0xcce8('0x33')](_0x567fa3[_0xcce8('0x30')],qs[_0xcce8('0x35')](_0x4e60c4['query']['fields']));_0x3d6d0c[_0xcce8('0x34')]=_0x3d6d0c['attributes']['length']?_0x3d6d0c[_0xcce8('0x34')]:_0x567fa3[_0xcce8('0x30')];if(_0x4e60c4['query'][_0xcce8('0x42')]){_0x3d6d0c[_0xcce8('0x43')]=[{'all':!![]}];}_0x3d6d0c=_[_0xcce8('0x3f')]({},_0x3d6d0c,_0x4e60c4[_0xcce8('0x41')]);return db[_0xcce8('0x2c')][_0xcce8('0x48')](_0x3d6d0c)['then'](handleEntityNotFound(_0x47cec8,null))[_0xcce8('0x26')](respondWithResult(_0x47cec8,null))['catch'](handleError(_0x47cec8,null));};exports[_0xcce8('0x49')]=function(_0x4a5279,_0x254557){return db[_0xcce8('0x2c')][_0xcce8('0x49')](_0x4a5279['body'],{})[_0xcce8('0x26')](respondWithResult(_0x254557,0xc9))['catch'](handleError(_0x254557,null));};exports[_0xcce8('0x25')]=function(_0x100553,_0x16d169){if(_0x100553['body']['id']){delete _0x100553['body']['id'];}return db[_0xcce8('0x2c')][_0xcce8('0x48')]({'where':{'id':_0x100553[_0xcce8('0x47')]['id']}})[_0xcce8('0x26')](handleEntityNotFound(_0x16d169,null))[_0xcce8('0x26')](saveUpdates(_0x100553[_0xcce8('0x4a')],null))[_0xcce8('0x26')](respondWithResult(_0x16d169,null))['catch'](handleError(_0x16d169,null));};exports[_0xcce8('0x27')]=function(_0x1c7197,_0x321929){return db[_0xcce8('0x2c')][_0xcce8('0x48')]({'where':{'id':_0x1c7197[_0xcce8('0x47')]['id']}})['then'](handleEntityNotFound(_0x321929,null))[_0xcce8('0x26')](removeEntity(_0x321929,null))[_0xcce8('0x45')](handleError(_0x321929,null));};exports[_0xcce8('0x4b')]=function(_0x1f3379,_0x1d63d0){return db[_0xcce8('0x2c')]['describe']()[_0xcce8('0x26')](respondWithResult(_0x1d63d0,null))['catch'](handleError(_0x1d63d0,null));}; \ No newline at end of file +var _0x0466=['params','rawAttributes','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','end','name','send','index','ChatQueueReport','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','rows','catch','show'];(function(_0x478cd0,_0x12c1df){var _0x430972=function(_0x13b5ad){while(--_0x13b5ad){_0x478cd0['push'](_0x478cd0['shift']());}};_0x430972(++_0x12c1df);}(_0x0466,0x1c3));var _0x6046=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x0466[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x6046('0x0'));var emlformat=require(_0x6046('0x1'));var rimraf=require(_0x6046('0x2'));var zipdir=require(_0x6046('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6046('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6046('0x5'));var util=require('util');var path=require(_0x6046('0x6'));var sox=require(_0x6046('0x7'));var csv=require(_0x6046('0x8'));var ejs=require(_0x6046('0x9'));var fs=require('fs');var _=require(_0x6046('0xa'));var squel=require(_0x6046('0xb'));var crypto=require(_0x6046('0xc'));var jsforce=require(_0x6046('0xd'));var deskjs=require(_0x6046('0xe'));var toCsv=require(_0x6046('0x8'));var querystring=require(_0x6046('0xf'));var Papa=require(_0x6046('0x10'));var Redis=require(_0x6046('0x11'));var authService=require(_0x6046('0x12'));var qs=require(_0x6046('0x13'));var as=require(_0x6046('0x14'));var hardwareService=require(_0x6046('0x15'));var logger=require(_0x6046('0x16'))(_0x6046('0x17'));var utils=require(_0x6046('0x18'));var config=require(_0x6046('0x19'));var licenseUtil=require(_0x6046('0x1a'));var db=require(_0x6046('0x1b'))['db'];function respondWithStatusCode(_0x1ef731,_0x46873f){_0x46873f=_0x46873f||0xcc;return function(_0x297924){if(_0x297924){return _0x1ef731[_0x6046('0x1c')](_0x46873f);}return _0x1ef731[_0x6046('0x1d')](_0x46873f)['end']();};}function respondWithResult(_0x1d8548,_0x4582a8){_0x4582a8=_0x4582a8||0xc8;return function(_0x7589){if(_0x7589){return _0x1d8548[_0x6046('0x1d')](_0x4582a8)[_0x6046('0x1e')](_0x7589);}};}function respondWithFilteredResult(_0x565174,_0x413e2a){return function(_0x2d951e){if(_0x2d951e){var _0x55c52c=_0x2d951e[_0x6046('0x1f')],_0x3e084e=_0x413e2a[_0x6046('0x20')],_0x41c876=_0x413e2a[_0x6046('0x20')]+_0x413e2a[_0x6046('0x21')],_0x3bc9d2;if(_0x41c876>=_0x55c52c){_0x41c876=_0x55c52c;_0x3bc9d2=0xc8;}else{_0x3bc9d2=0xce;}_0x565174[_0x6046('0x1d')](_0x3bc9d2);return _0x565174['set']('Content-Range',_0x3e084e+'-'+_0x41c876+'/'+_0x55c52c)[_0x6046('0x1e')](_0x2d951e);}return null;};}function patchUpdates(_0x2586b1){return function(_0x3abf5e){try{jsonpatch[_0x6046('0x22')](_0x3abf5e,_0x2586b1,!![]);}catch(_0x4b4e07){return BPromise['reject'](_0x4b4e07);}return _0x3abf5e[_0x6046('0x23')]();};}function saveUpdates(_0x23cf2c,_0x484f33){return function(_0x1c0618){if(_0x1c0618){return _0x1c0618[_0x6046('0x24')](_0x23cf2c)[_0x6046('0x25')](function(_0x95ec31){return _0x95ec31;});}return null;};}function removeEntity(_0xe8fa1d,_0x551a6e){return function(_0x2a9070){if(_0x2a9070){return _0x2a9070[_0x6046('0x26')]()[_0x6046('0x25')](function(){_0xe8fa1d[_0x6046('0x1d')](0xcc)[_0x6046('0x27')]();});}};}function handleEntityNotFound(_0xcc3328,_0x14b416){return function(_0x332ccf){if(!_0x332ccf){_0xcc3328['sendStatus'](0x194);}return _0x332ccf;};}function handleError(_0x3722cf,_0x413fb3){_0x413fb3=_0x413fb3||0x1f4;return function(_0x582673){logger['error'](_0x582673['stack']);if(_0x582673[_0x6046('0x28')]){delete _0x582673['name'];}_0x3722cf[_0x6046('0x1d')](_0x413fb3)[_0x6046('0x29')](_0x582673);};}exports[_0x6046('0x2a')]=function(_0x1abe23,_0x297db7){var _0x319b6b={},_0x2657eb={},_0x276a29={'count':0x0,'rows':[]};var _0x319ca1=_['map'](db[_0x6046('0x2b')]['rawAttributes'],function(_0x590237){return{'name':_0x590237['fieldName'],'type':_0x590237['type'][_0x6046('0x2c')]};});_0x2657eb[_0x6046('0x2d')]=_[_0x6046('0x2e')](_0x319ca1,_0x6046('0x28'));_0x2657eb[_0x6046('0x2f')]=_[_0x6046('0x30')](_0x1abe23[_0x6046('0x2f')]);_0x2657eb[_0x6046('0x31')]=_[_0x6046('0x32')](_0x2657eb[_0x6046('0x2d')],_0x2657eb[_0x6046('0x2f')]);_0x319b6b[_0x6046('0x33')]=_['intersection'](_0x2657eb[_0x6046('0x2d')],qs['fields'](_0x1abe23[_0x6046('0x2f')][_0x6046('0x34')]));_0x319b6b[_0x6046('0x33')]=_0x319b6b[_0x6046('0x33')][_0x6046('0x35')]?_0x319b6b[_0x6046('0x33')]:_0x2657eb[_0x6046('0x2d')];if(!_0x1abe23[_0x6046('0x2f')]['hasOwnProperty']('nolimit')){_0x319b6b[_0x6046('0x21')]=qs['limit'](_0x1abe23[_0x6046('0x2f')][_0x6046('0x21')]);_0x319b6b['offset']=qs['offset'](_0x1abe23['query'][_0x6046('0x20')]);}_0x319b6b[_0x6046('0x36')]=qs[_0x6046('0x37')](_0x1abe23[_0x6046('0x2f')][_0x6046('0x37')]);_0x319b6b[_0x6046('0x38')]=qs[_0x6046('0x31')](_[_0x6046('0x39')](_0x1abe23['query'],_0x2657eb[_0x6046('0x31')]),_0x319ca1);if(_0x1abe23[_0x6046('0x2f')]['filter']){_0x319b6b[_0x6046('0x38')]=_[_0x6046('0x3a')](_0x319b6b[_0x6046('0x38')],{'$or':_[_0x6046('0x2e')](_0x319ca1,function(_0x1b69fb){if(_0x1b69fb[_0x6046('0x3b')]!==_0x6046('0x3c')){var _0x3e4fbe={};_0x3e4fbe[_0x1b69fb[_0x6046('0x28')]]={'$like':'%'+_0x1abe23[_0x6046('0x2f')][_0x6046('0x3d')]+'%'};return _0x3e4fbe;}})});}_0x319b6b=_[_0x6046('0x3a')]({},_0x319b6b,_0x1abe23[_0x6046('0x3e')]);var _0x4c964c={'where':_0x319b6b[_0x6046('0x38')]};return db[_0x6046('0x2b')][_0x6046('0x1f')](_0x4c964c)['then'](function(_0x2995f3){_0x276a29[_0x6046('0x1f')]=_0x2995f3;if(_0x1abe23[_0x6046('0x2f')]['includeAll']){_0x319b6b[_0x6046('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x319b6b);})[_0x6046('0x25')](function(_0x316d32){_0x276a29[_0x6046('0x40')]=_0x316d32;return _0x276a29;})['then'](respondWithFilteredResult(_0x297db7,_0x319b6b))[_0x6046('0x41')](handleError(_0x297db7,null));};exports[_0x6046('0x42')]=function(_0x3cac01,_0x416621){var _0x3520dd={'raw':!![],'where':{'id':_0x3cac01[_0x6046('0x43')]['id']}},_0x1930e2={};_0x1930e2[_0x6046('0x2d')]=_[_0x6046('0x30')](db['ChatQueueReport'][_0x6046('0x44')]);_0x1930e2[_0x6046('0x2f')]=_[_0x6046('0x30')](_0x3cac01[_0x6046('0x2f')]);_0x1930e2[_0x6046('0x31')]=_[_0x6046('0x32')](_0x1930e2[_0x6046('0x2d')],_0x1930e2['query']);_0x3520dd['attributes']=_[_0x6046('0x32')](_0x1930e2[_0x6046('0x2d')],qs[_0x6046('0x34')](_0x3cac01[_0x6046('0x2f')]['fields']));_0x3520dd['attributes']=_0x3520dd[_0x6046('0x33')][_0x6046('0x35')]?_0x3520dd[_0x6046('0x33')]:_0x1930e2[_0x6046('0x2d')];if(_0x3cac01['query'][_0x6046('0x45')]){_0x3520dd[_0x6046('0x3f')]=[{'all':!![]}];}_0x3520dd=_[_0x6046('0x3a')]({},_0x3520dd,_0x3cac01['options']);return db[_0x6046('0x2b')][_0x6046('0x46')](_0x3520dd)[_0x6046('0x25')](handleEntityNotFound(_0x416621,null))[_0x6046('0x25')](respondWithResult(_0x416621,null))['catch'](handleError(_0x416621,null));};exports['create']=function(_0x54f760,_0x1cd83a){return db[_0x6046('0x2b')][_0x6046('0x47')](_0x54f760[_0x6046('0x48')],{})['then'](respondWithResult(_0x1cd83a,0xc9))[_0x6046('0x41')](handleError(_0x1cd83a,null));};exports[_0x6046('0x24')]=function(_0x422d7f,_0x26e7c8){if(_0x422d7f[_0x6046('0x48')]['id']){delete _0x422d7f[_0x6046('0x48')]['id'];}return db[_0x6046('0x2b')][_0x6046('0x46')]({'where':{'id':_0x422d7f[_0x6046('0x43')]['id']}})[_0x6046('0x25')](handleEntityNotFound(_0x26e7c8,null))[_0x6046('0x25')](saveUpdates(_0x422d7f[_0x6046('0x48')],null))[_0x6046('0x25')](respondWithResult(_0x26e7c8,null))['catch'](handleError(_0x26e7c8,null));};exports[_0x6046('0x26')]=function(_0x4f4a9d,_0x1ae3e9){return db[_0x6046('0x2b')][_0x6046('0x46')]({'where':{'id':_0x4f4a9d['params']['id']}})[_0x6046('0x25')](handleEntityNotFound(_0x1ae3e9,null))[_0x6046('0x25')](removeEntity(_0x1ae3e9,null))['catch'](handleError(_0x1ae3e9,null));};exports[_0x6046('0x49')]=function(_0x22c011,_0x4c9ce9){return db[_0x6046('0x2b')][_0x6046('0x49')]()['then'](respondWithResult(_0x4c9ce9,null))[_0x6046('0x41')](handleError(_0x4c9ce9,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index b7bb274..c0bb0d9 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 _0x904a=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid'];(function(_0x4c1dca,_0x1d4587){var _0x3b2ee2=function(_0x28b151){while(--_0x28b151){_0x4c1dca['push'](_0x4c1dca['shift']());}};_0x3b2ee2(++_0x1d4587);}(_0x904a,0x145));var _0xa904=function(_0x3835ec,_0x49c314){_0x3835ec=_0x3835ec-0x0;var _0x9d029c=_0x904a[_0x3835ec];return _0x9d029c;};'use strict';var _=require(_0xa904('0x0'));var util=require(_0xa904('0x1'));var logger=require(_0xa904('0x2'))(_0xa904('0x3'));var moment=require(_0xa904('0x4'));var BPromise=require(_0xa904('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa904('0x6'));var rimraf=require(_0xa904('0x7'));var config=require('../../config/environment');var attributes=require(_0xa904('0x8'));module[_0xa904('0x9')]=function(_0x3a959a,_0x46daba){return _0x3a959a[_0xa904('0xa')]('ChatQueueReport',attributes,{'tableName':_0xa904('0xb'),'paranoid':![],'indexes':[{'name':_0xa904('0xc'),'fields':[_0xa904('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6e4=['bluebird','request-promise','path','rimraf','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x18d36f,_0x31b65f){var _0x10034d=function(_0x38bb30){while(--_0x38bb30){_0x18d36f['push'](_0x18d36f['shift']());}};_0x10034d(++_0x31b65f);}(_0xd6e4,0x104));var _0x4d6e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xd6e4[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x4d6e('0x0'));var util=require(_0x4d6e('0x1'));var logger=require(_0x4d6e('0x2'))(_0x4d6e('0x3'));var moment=require('moment');var BPromise=require(_0x4d6e('0x4'));var rp=require(_0x4d6e('0x5'));var fs=require('fs');var path=require(_0x4d6e('0x6'));var rimraf=require(_0x4d6e('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d6e('0x8'));module['exports']=function(_0x271c4c,_0x1fd8d8){return _0x271c4c[_0x4d6e('0x9')](_0x4d6e('0xa'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x4d6e('0xb'),'fields':[_0x4d6e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 1919887..79d1d85 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 _0x9fb4=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','create','body','options','raw','then','stringify','UpdateChatQueueReport','ChatQueueReport','update','where','attributes'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9fb4,0x96));var _0x49fb=function(_0x4fc702,_0x590060){_0x4fc702=_0x4fc702-0x0;var _0x1357d3=_0x9fb4[_0x4fc702];return _0x1357d3;};'use strict';var _=require(_0x49fb('0x0'));var util=require('util');var moment=require(_0x49fb('0x1'));var BPromise=require('bluebird');var rs=require(_0x49fb('0x2'));var fs=require('fs');var Redis=require(_0x49fb('0x3'));var db=require(_0x49fb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x49fb('0x5'))('rpc');var config=require(_0x49fb('0x6'));var jayson=require(_0x49fb('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x150e99,_0x7f4d0a,_0x4efff6){return new BPromise(function(_0x49fcdc,_0x3bf8ce){return client[_0x49fb('0x8')](_0x150e99,_0x4efff6)['then'](function(_0x55938b){logger[_0x49fb('0x9')]('ChatQueueReport,\x20%s,\x20%s',_0x7f4d0a,_0x49fb('0xa'));logger[_0x49fb('0xb')](_0x49fb('0xc'),_0x7f4d0a,'request\x20sent',JSON['stringify'](_0x55938b));if(_0x55938b[_0x49fb('0xd')]){if(_0x55938b[_0x49fb('0xd')]['code']===0x1f4){logger[_0x49fb('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x7f4d0a,_0x55938b[_0x49fb('0xd')][_0x49fb('0xe')]);return _0x3bf8ce(_0x55938b[_0x49fb('0xd')]['message']);}logger['error'](_0x49fb('0xf'),_0x7f4d0a,_0x55938b[_0x49fb('0xd')][_0x49fb('0xe')]);return _0x49fcdc(_0x55938b[_0x49fb('0xd')][_0x49fb('0xe')]);}else{logger['info'](_0x49fb('0xf'),_0x7f4d0a,_0x49fb('0xa'));_0x49fcdc(_0x55938b[_0x49fb('0x10')][_0x49fb('0xe')]);}})[_0x49fb('0x11')](function(_0x2e3651){logger[_0x49fb('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x7f4d0a,_0x2e3651);_0x3bf8ce(_0x2e3651);});});}exports[_0x49fb('0x12')]=function(_0x55b461){var _0x95af62=this;return new Promise(function(_0x9c462c,_0x2e492d){return db['ChatQueueReport'][_0x49fb('0x13')](_0x55b461[_0x49fb('0x14')],{'raw':_0x55b461[_0x49fb('0x15')]?_0x55b461[_0x49fb('0x15')][_0x49fb('0x16')]===undefined?!![]:![]:!![]})[_0x49fb('0x17')](function(_0x515dc2){logger['info'](_0x49fb('0x12'),_0x55b461);logger['debug'](_0x49fb('0x12'),_0x55b461,JSON[_0x49fb('0x18')](_0x515dc2));_0x9c462c(_0x515dc2);})[_0x49fb('0x11')](function(_0x168a7e){logger[_0x49fb('0xd')](_0x49fb('0x12'),_0x168a7e[_0x49fb('0xe')],_0x55b461);_0x2e492d(_0x95af62[_0x49fb('0xd')](0x1f4,_0x168a7e[_0x49fb('0xe')]));});});};exports[_0x49fb('0x19')]=function(_0x2adadc){var _0x1b0c35=this;return new Promise(function(_0x221a24,_0x18769a){return db[_0x49fb('0x1a')][_0x49fb('0x1b')](_0x2adadc[_0x49fb('0x14')],{'raw':_0x2adadc[_0x49fb('0x15')]?_0x2adadc['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2adadc[_0x49fb('0x15')]?_0x2adadc[_0x49fb('0x15')][_0x49fb('0x1c')]||null:null,'attributes':_0x2adadc[_0x49fb('0x15')]?_0x2adadc[_0x49fb('0x15')][_0x49fb('0x1d')]||null:null,'limit':_0x2adadc[_0x49fb('0x15')]?_0x2adadc[_0x49fb('0x15')]['limit']||null:null})[_0x49fb('0x17')](function(_0x46939b){logger[_0x49fb('0x9')](_0x49fb('0x19'),_0x2adadc);logger[_0x49fb('0xb')](_0x49fb('0x19'),_0x2adadc,JSON['stringify'](_0x46939b));_0x221a24(_0x46939b);})[_0x49fb('0x11')](function(_0x1f5b02){logger[_0x49fb('0xd')](_0x49fb('0x19'),_0x1f5b02['message'],_0x2adadc);_0x18769a(_0x1b0c35[_0x49fb('0xd')](0x1f4,_0x1f5b02[_0x49fb('0xe')]));});});}; \ No newline at end of file +var _0x6d4a=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','info','debug','catch','UpdateChatQueueReport','update','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x14f2c0,_0xe0b572){var _0x43196e=function(_0x5b5537){while(--_0x5b5537){_0x14f2c0['push'](_0x14f2c0['shift']());}};_0x43196e(++_0xe0b572);}(_0x6d4a,0x132));var _0xa6d4=function(_0x10d830,_0x1b7aa7){_0x10d830=_0x10d830-0x0;var _0x3814ee=_0x6d4a[_0x10d830];return _0x3814ee;};'use strict';var _=require('lodash');var util=require(_0xa6d4('0x0'));var moment=require(_0xa6d4('0x1'));var BPromise=require(_0xa6d4('0x2'));var rs=require(_0xa6d4('0x3'));var fs=require('fs');var Redis=require(_0xa6d4('0x4'));var db=require(_0xa6d4('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa6d4('0x6'));var config=require(_0xa6d4('0x7'));var jayson=require(_0xa6d4('0x8'));var client=jayson[_0xa6d4('0x9')][_0xa6d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f5951,_0x236df9,_0x4fea09){return new BPromise(function(_0x38a78c,_0x173aa2){return client['request'](_0x1f5951,_0x4fea09)[_0xa6d4('0xb')](function(_0x54770d){logger['info'](_0xa6d4('0xc'),_0x236df9,_0xa6d4('0xd'));logger['debug'](_0xa6d4('0xe'),_0x236df9,'request\x20sent',JSON[_0xa6d4('0xf')](_0x54770d));if(_0x54770d[_0xa6d4('0x10')]){if(_0x54770d[_0xa6d4('0x10')]['code']===0x1f4){logger[_0xa6d4('0x10')](_0xa6d4('0xc'),_0x236df9,_0x54770d['error'][_0xa6d4('0x11')]);return _0x173aa2(_0x54770d['error']['message']);}logger[_0xa6d4('0x10')](_0xa6d4('0xc'),_0x236df9,_0x54770d[_0xa6d4('0x10')][_0xa6d4('0x11')]);return _0x38a78c(_0x54770d['error'][_0xa6d4('0x11')]);}else{logger['info'](_0xa6d4('0xc'),_0x236df9,_0xa6d4('0xd'));_0x38a78c(_0x54770d[_0xa6d4('0x12')]['message']);}})['catch'](function(_0x40393c){logger[_0xa6d4('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x236df9,_0x40393c);_0x173aa2(_0x40393c);});});}exports[_0xa6d4('0x13')]=function(_0x35955d){var _0x1d4e4c=this;return new Promise(function(_0x482824,_0x1a909e){return db[_0xa6d4('0x14')][_0xa6d4('0x15')](_0x35955d[_0xa6d4('0x16')],{'raw':_0x35955d[_0xa6d4('0x17')]?_0x35955d[_0xa6d4('0x17')][_0xa6d4('0x18')]===undefined?!![]:![]:!![]})[_0xa6d4('0xb')](function(_0x125039){logger[_0xa6d4('0x19')](_0xa6d4('0x13'),_0x35955d);logger[_0xa6d4('0x1a')](_0xa6d4('0x13'),_0x35955d,JSON[_0xa6d4('0xf')](_0x125039));_0x482824(_0x125039);})[_0xa6d4('0x1b')](function(_0x371200){logger[_0xa6d4('0x10')](_0xa6d4('0x13'),_0x371200[_0xa6d4('0x11')],_0x35955d);_0x1a909e(_0x1d4e4c[_0xa6d4('0x10')](0x1f4,_0x371200[_0xa6d4('0x11')]));});});};exports[_0xa6d4('0x1c')]=function(_0x1fcd2f){var _0x11ec8d=this;return new Promise(function(_0x4b7563,_0x4b090d){return db[_0xa6d4('0x14')][_0xa6d4('0x1d')](_0x1fcd2f['body'],{'raw':_0x1fcd2f['options']?_0x1fcd2f[_0xa6d4('0x17')][_0xa6d4('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fcd2f[_0xa6d4('0x17')]?_0x1fcd2f[_0xa6d4('0x17')][_0xa6d4('0x1e')]||null:null,'attributes':_0x1fcd2f[_0xa6d4('0x17')]?_0x1fcd2f[_0xa6d4('0x17')]['attributes']||null:null,'limit':_0x1fcd2f[_0xa6d4('0x17')]?_0x1fcd2f['options'][_0xa6d4('0x1f')]||null:null})['then'](function(_0x155f58){logger[_0xa6d4('0x19')](_0xa6d4('0x1c'),_0x1fcd2f);logger['debug'](_0xa6d4('0x1c'),_0x1fcd2f,JSON[_0xa6d4('0xf')](_0x155f58));_0x4b7563(_0x155f58);})[_0xa6d4('0x1b')](function(_0x431ff6){logger[_0xa6d4('0x10')](_0xa6d4('0x1c'),_0x431ff6[_0xa6d4('0x11')],_0x1fcd2f);_0x4b090d(_0x11ec8d['error'](0x1f4,_0x431ff6['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2405588..7ff0e03 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 _0x3407=['get','/:id','show','post','create','put','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index'];(function(_0x1d5ddb,_0x43a169){var _0xfca6a=function(_0x2f691c){while(--_0x2f691c){_0x1d5ddb['push'](_0x1d5ddb['shift']());}};_0xfca6a(++_0x43a169);}(_0x3407,0x1a6));var _0x7340=function(_0x5a31ea,_0x48622b){_0x5a31ea=_0x5a31ea-0x0;var _0x2466d6=_0x3407[_0x5a31ea];return _0x2466d6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7340('0x0'));var timeout=require(_0x7340('0x1'));var express=require(_0x7340('0x2'));var router=express[_0x7340('0x3')]();var auth=require(_0x7340('0x4'));var interaction=require(_0x7340('0x5'));var config=require(_0x7340('0x6'));var controller=require(_0x7340('0x7'));router['get']('/',auth[_0x7340('0x8')](),controller[_0x7340('0x9')]);router['get']('/describe',auth[_0x7340('0x8')](),controller['describe']);router[_0x7340('0xa')](_0x7340('0xb'),auth['isAuthenticated'](),controller[_0x7340('0xc')]);router[_0x7340('0xd')]('/',auth[_0x7340('0x8')](),controller[_0x7340('0xe')]);router[_0x7340('0xf')](_0x7340('0xb'),auth[_0x7340('0x8')](),controller['update']);router['delete']('/:id',auth[_0x7340('0x8')](),controller[_0x7340('0x10')]);module[_0x7340('0x11')]=router; \ No newline at end of file +var _0xd22f=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index','get','describe','/:id','post'];(function(_0x2614e1,_0x50d107){var _0x50a01d=function(_0x13cf3a){while(--_0x13cf3a){_0x2614e1['push'](_0x2614e1['shift']());}};_0x50a01d(++_0x50d107);}(_0xd22f,0x125));var _0xfd22=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xd22f[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xfd22('0x0'));var util=require(_0xfd22('0x1'));var path=require(_0xfd22('0x2'));var timeout=require(_0xfd22('0x3'));var express=require(_0xfd22('0x4'));var router=express[_0xfd22('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfd22('0x6'));var controller=require('./chatQueueReport.controller');router['get']('/',auth[_0xfd22('0x7')](),controller[_0xfd22('0x8')]);router[_0xfd22('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xfd22('0xa')]);router[_0xfd22('0x9')](_0xfd22('0xb'),auth[_0xfd22('0x7')](),controller['show']);router[_0xfd22('0xc')]('/',auth[_0xfd22('0x7')](),controller[_0xfd22('0xd')]);router['put'](_0xfd22('0xb'),auth[_0xfd22('0x7')](),controller[_0xfd22('0xe')]);router[_0xfd22('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xfd22('0x10')]);module[_0xfd22('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 5fc031b..5710090 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 _0x35f8=['queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x177f23,_0x21f7b3){var _0x33303e=function(_0x2a4037){while(--_0x2a4037){_0x177f23['push'](_0x177f23['shift']());}};_0x33303e(++_0x21f7b3);}(_0x35f8,0xb7));var _0x835f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x35f8[_0x501510];return _0x1e6ee5;};'use strict';var moment=require(_0x835f('0x0'));var Sequelize=require(_0x835f('0x1'));module[_0x835f('0x2')]={'uniqueid':{'type':Sequelize[_0x835f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x835f('0x4')](_0x835f('0x5'),'agent',_0x835f('0x6')),'allowNull':![],'defaultValue':_0x835f('0x6')},'transferredAt':{'type':Sequelize[_0x835f('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x835f('0x8')]}}; \ No newline at end of file +var _0x2ba9=['NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x2ba9,0x1b3));var _0x92ba=function(_0x2af733,_0x30cf83){_0x2af733=_0x2af733-0x0;var _0x41dbe0=_0x2ba9[_0x2af733];return _0x41dbe0;};'use strict';var moment=require(_0x92ba('0x0'));var Sequelize=require(_0x92ba('0x1'));module[_0x92ba('0x2')]={'uniqueid':{'type':Sequelize[_0x92ba('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x92ba('0x4')](_0x92ba('0x5'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x92ba('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 6cbf019..842b35d 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 _0x022d=['../../config/logger','api','sendStatus','end','status','json','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','limit','offset','sort','pick','filter','where','merge','options','then','includeAll','include','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xc91e81,_0x2492a7){var _0x4c364c=function(_0x58c5c9){while(--_0x58c5c9){_0xc91e81['push'](_0xc91e81['shift']());}};_0x4c364c(++_0x2492a7);}(_0x022d,0x14f));var _0xd022=function(_0xa080b5,_0x321624){_0xa080b5=_0xa080b5-0x0;var _0x47b47d=_0x022d[_0xa080b5];return _0x47b47d;};'use strict';var pdf=require(_0xd022('0x0'));var emlformat=require(_0xd022('0x1'));var rimraf=require(_0xd022('0x2'));var zipdir=require(_0xd022('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd022('0x4'));var moment=require(_0xd022('0x5'));var BPromise=require(_0xd022('0x6'));var Mustache=require(_0xd022('0x7'));var util=require(_0xd022('0x8'));var path=require(_0xd022('0x9'));var sox=require(_0xd022('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd022('0xb'));var squel=require('squel');var crypto=require(_0xd022('0xc'));var jsforce=require(_0xd022('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd022('0xe'));var Papa=require(_0xd022('0xf'));var Redis=require(_0xd022('0x10'));var authService=require(_0xd022('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd022('0x12'));var hardwareService=require(_0xd022('0x13'));var logger=require(_0xd022('0x14'))(_0xd022('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d3962,_0x2ca32c){_0x2ca32c=_0x2ca32c||0xcc;return function(_0x2569d0){if(_0x2569d0){return _0x1d3962[_0xd022('0x16')](_0x2ca32c);}return _0x1d3962['status'](_0x2ca32c)[_0xd022('0x17')]();};}function respondWithResult(_0x305fd4,_0x21f896){_0x21f896=_0x21f896||0xc8;return function(_0x3c8589){if(_0x3c8589){return _0x305fd4[_0xd022('0x18')](_0x21f896)[_0xd022('0x19')](_0x3c8589);}};}function respondWithFilteredResult(_0x24b739,_0x4bb7cc){return function(_0x1ca6ba){if(_0x1ca6ba){var _0x344828=_0x1ca6ba[_0xd022('0x1a')],_0x2bb27c=_0x4bb7cc['offset'],_0x58e35d=_0x4bb7cc['offset']+_0x4bb7cc['limit'],_0x2bb3a3;if(_0x58e35d>=_0x344828){_0x58e35d=_0x344828;_0x2bb3a3=0xc8;}else{_0x2bb3a3=0xce;}_0x24b739[_0xd022('0x18')](_0x2bb3a3);return _0x24b739[_0xd022('0x1b')](_0xd022('0x1c'),_0x2bb27c+'-'+_0x58e35d+'/'+_0x344828)[_0xd022('0x19')](_0x1ca6ba);}return null;};}function patchUpdates(_0x50df7c){return function(_0x364a21){try{jsonpatch[_0xd022('0x1d')](_0x364a21,_0x50df7c,!![]);}catch(_0x16ab5c){return BPromise[_0xd022('0x1e')](_0x16ab5c);}return _0x364a21[_0xd022('0x1f')]();};}function saveUpdates(_0x4ef508,_0x5720f2){return function(_0x238b9a){if(_0x238b9a){return _0x238b9a[_0xd022('0x20')](_0x4ef508)['then'](function(_0xbbc500){return _0xbbc500;});}return null;};}function removeEntity(_0x45122e,_0xa252a3){return function(_0x44c1fb){if(_0x44c1fb){return _0x44c1fb[_0xd022('0x21')]()['then'](function(){_0x45122e[_0xd022('0x18')](0xcc)[_0xd022('0x17')]();});}};}function handleEntityNotFound(_0x95f7ae,_0x5518b4){return function(_0x4c2a3b){if(!_0x4c2a3b){_0x95f7ae[_0xd022('0x16')](0x194);}return _0x4c2a3b;};}function handleError(_0x447a49,_0x1033cf){_0x1033cf=_0x1033cf||0x1f4;return function(_0x1b6b82){logger[_0xd022('0x22')](_0x1b6b82[_0xd022('0x23')]);if(_0x1b6b82[_0xd022('0x24')]){delete _0x1b6b82['name'];}_0x447a49[_0xd022('0x18')](_0x1033cf)[_0xd022('0x25')](_0x1b6b82);};}exports[_0xd022('0x26')]=function(_0x2be19f,_0x3f8705){var _0x138baf={},_0xb17d={},_0x1dd5ef={'count':0x0,'rows':[]};var _0x40ef8f=_[_0xd022('0x27')](db[_0xd022('0x28')][_0xd022('0x29')],function(_0x475f03){return{'name':_0x475f03[_0xd022('0x2a')],'type':_0x475f03[_0xd022('0x2b')][_0xd022('0x2c')]};});_0xb17d[_0xd022('0x2d')]=_[_0xd022('0x27')](_0x40ef8f,_0xd022('0x24'));_0xb17d[_0xd022('0x2e')]=_['keys'](_0x2be19f[_0xd022('0x2e')]);_0xb17d[_0xd022('0x2f')]=_[_0xd022('0x30')](_0xb17d['model'],_0xb17d[_0xd022('0x2e')]);_0x138baf[_0xd022('0x31')]=_[_0xd022('0x30')](_0xb17d[_0xd022('0x2d')],qs[_0xd022('0x32')](_0x2be19f[_0xd022('0x2e')]['fields']));_0x138baf[_0xd022('0x31')]=_0x138baf['attributes'][_0xd022('0x33')]?_0x138baf[_0xd022('0x31')]:_0xb17d[_0xd022('0x2d')];if(!_0x2be19f[_0xd022('0x2e')]['hasOwnProperty']('nolimit')){_0x138baf['limit']=qs[_0xd022('0x34')](_0x2be19f[_0xd022('0x2e')][_0xd022('0x34')]);_0x138baf[_0xd022('0x35')]=qs[_0xd022('0x35')](_0x2be19f[_0xd022('0x2e')][_0xd022('0x35')]);}_0x138baf['order']=qs[_0xd022('0x36')](_0x2be19f[_0xd022('0x2e')]['sort']);_0x138baf['where']=qs[_0xd022('0x2f')](_[_0xd022('0x37')](_0x2be19f[_0xd022('0x2e')],_0xb17d['filters']),_0x40ef8f);if(_0x2be19f[_0xd022('0x2e')][_0xd022('0x38')]){_0x138baf[_0xd022('0x39')]=_[_0xd022('0x3a')](_0x138baf[_0xd022('0x39')],{'$or':_[_0xd022('0x27')](_0x40ef8f,function(_0x43bab9){if(_0x43bab9[_0xd022('0x2b')]!=='VIRTUAL'){var _0x55079d={};_0x55079d[_0x43bab9[_0xd022('0x24')]]={'$like':'%'+_0x2be19f['query']['filter']+'%'};return _0x55079d;}})});}_0x138baf=_[_0xd022('0x3a')]({},_0x138baf,_0x2be19f[_0xd022('0x3b')]);var _0x397880={'where':_0x138baf[_0xd022('0x39')]};return db[_0xd022('0x28')][_0xd022('0x1a')](_0x397880)[_0xd022('0x3c')](function(_0x463524){_0x1dd5ef['count']=_0x463524;if(_0x2be19f['query'][_0xd022('0x3d')]){_0x138baf[_0xd022('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x138baf);})[_0xd022('0x3c')](function(_0x1882bd){_0x1dd5ef['rows']=_0x1882bd;return _0x1dd5ef;})[_0xd022('0x3c')](respondWithFilteredResult(_0x3f8705,_0x138baf))[_0xd022('0x3f')](handleError(_0x3f8705,null));};exports[_0xd022('0x40')]=function(_0x481b99,_0x93e29e){var _0x3ca156={'raw':!![],'where':{'id':_0x481b99[_0xd022('0x41')]['id']}},_0x23029d={};_0x23029d[_0xd022('0x2d')]=_[_0xd022('0x42')](db[_0xd022('0x28')][_0xd022('0x29')]);_0x23029d[_0xd022('0x2e')]=_[_0xd022('0x42')](_0x481b99[_0xd022('0x2e')]);_0x23029d['filters']=_['intersection'](_0x23029d[_0xd022('0x2d')],_0x23029d[_0xd022('0x2e')]);_0x3ca156['attributes']=_[_0xd022('0x30')](_0x23029d[_0xd022('0x2d')],qs['fields'](_0x481b99['query'][_0xd022('0x32')]));_0x3ca156['attributes']=_0x3ca156[_0xd022('0x31')][_0xd022('0x33')]?_0x3ca156[_0xd022('0x31')]:_0x23029d[_0xd022('0x2d')];if(_0x481b99[_0xd022('0x2e')][_0xd022('0x3d')]){_0x3ca156[_0xd022('0x3e')]=[{'all':!![]}];}_0x3ca156=_[_0xd022('0x3a')]({},_0x3ca156,_0x481b99['options']);return db[_0xd022('0x28')][_0xd022('0x43')](_0x3ca156)[_0xd022('0x3c')](handleEntityNotFound(_0x93e29e,null))['then'](respondWithResult(_0x93e29e,null))[_0xd022('0x3f')](handleError(_0x93e29e,null));};exports[_0xd022('0x44')]=function(_0xe47ece,_0x5e3b0d){return db[_0xd022('0x28')]['create'](_0xe47ece[_0xd022('0x45')],{})[_0xd022('0x3c')](respondWithResult(_0x5e3b0d,0xc9))[_0xd022('0x3f')](handleError(_0x5e3b0d,null));};exports[_0xd022('0x20')]=function(_0x3e91b4,_0x498631){if(_0x3e91b4[_0xd022('0x45')]['id']){delete _0x3e91b4['body']['id'];}return db[_0xd022('0x28')]['find']({'where':{'id':_0x3e91b4['params']['id']}})[_0xd022('0x3c')](handleEntityNotFound(_0x498631,null))[_0xd022('0x3c')](saveUpdates(_0x3e91b4[_0xd022('0x45')],null))['then'](respondWithResult(_0x498631,null))[_0xd022('0x3f')](handleError(_0x498631,null));};exports[_0xd022('0x21')]=function(_0x5793a6,_0x18ae9b){return db[_0xd022('0x28')]['find']({'where':{'id':_0x5793a6[_0xd022('0x41')]['id']}})[_0xd022('0x3c')](handleEntityNotFound(_0x18ae9b,null))[_0xd022('0x3c')](removeEntity(_0x18ae9b,null))[_0xd022('0x3f')](handleError(_0x18ae9b,null));};exports[_0xd022('0x46')]=function(_0x593131,_0x385026){return db[_0xd022('0x28')][_0xd022('0x46')]()['then'](respondWithResult(_0x385026,null))[_0xd022('0x3f')](handleError(_0x385026,null));}; \ No newline at end of file +var _0x350c=['error','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','count','includeAll','findAll','rows','catch','params','length','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x1cb28d,_0x34ff99){var _0x4952d6=function(_0x4a96f6){while(--_0x4a96f6){_0x1cb28d['push'](_0x1cb28d['shift']());}};_0x4952d6(++_0x34ff99);}(_0x350c,0xc6));var _0xc350=function(_0x51181a,_0x39f9a3){_0x51181a=_0x51181a-0x0;var _0x3dc991=_0x350c[_0x51181a];return _0x3dc991;};'use strict';var pdf=require(_0xc350('0x0'));var emlformat=require(_0xc350('0x1'));var rimraf=require(_0xc350('0x2'));var zipdir=require(_0xc350('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc350('0x4'));var moment=require(_0xc350('0x5'));var BPromise=require(_0xc350('0x6'));var Mustache=require(_0xc350('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc350('0x8'));var csv=require('to-csv');var ejs=require(_0xc350('0x9'));var fs=require('fs');var _=require(_0xc350('0xa'));var squel=require(_0xc350('0xb'));var crypto=require(_0xc350('0xc'));var jsforce=require(_0xc350('0xd'));var deskjs=require(_0xc350('0xe'));var toCsv=require(_0xc350('0xf'));var querystring=require(_0xc350('0x10'));var Papa=require(_0xc350('0x11'));var Redis=require(_0xc350('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc350('0x13'));var as=require(_0xc350('0x14'));var hardwareService=require(_0xc350('0x15'));var logger=require(_0xc350('0x16'))(_0xc350('0x17'));var utils=require(_0xc350('0x18'));var config=require(_0xc350('0x19'));var licenseUtil=require(_0xc350('0x1a'));var db=require(_0xc350('0x1b'))['db'];function respondWithStatusCode(_0x3f687b,_0x3c2326){_0x3c2326=_0x3c2326||0xcc;return function(_0x26ccb2){if(_0x26ccb2){return _0x3f687b[_0xc350('0x1c')](_0x3c2326);}return _0x3f687b[_0xc350('0x1d')](_0x3c2326)[_0xc350('0x1e')]();};}function respondWithResult(_0x5a5b3f,_0x27499a){_0x27499a=_0x27499a||0xc8;return function(_0x7712e5){if(_0x7712e5){return _0x5a5b3f[_0xc350('0x1d')](_0x27499a)[_0xc350('0x1f')](_0x7712e5);}};}function respondWithFilteredResult(_0x243686,_0x3cda39){return function(_0x15071a){if(_0x15071a){var _0x5c649f=_0x15071a['count'],_0x5e8d48=_0x3cda39[_0xc350('0x20')],_0x564191=_0x3cda39[_0xc350('0x20')]+_0x3cda39[_0xc350('0x21')],_0x280c78;if(_0x564191>=_0x5c649f){_0x564191=_0x5c649f;_0x280c78=0xc8;}else{_0x280c78=0xce;}_0x243686['status'](_0x280c78);return _0x243686[_0xc350('0x22')](_0xc350('0x23'),_0x5e8d48+'-'+_0x564191+'/'+_0x5c649f)[_0xc350('0x1f')](_0x15071a);}return null;};}function patchUpdates(_0xbb2161){return function(_0x1a37a2){try{jsonpatch[_0xc350('0x24')](_0x1a37a2,_0xbb2161,!![]);}catch(_0x1e2236){return BPromise[_0xc350('0x25')](_0x1e2236);}return _0x1a37a2[_0xc350('0x26')]();};}function saveUpdates(_0x2bbe81,_0x3864a4){return function(_0x1992b5){if(_0x1992b5){return _0x1992b5[_0xc350('0x27')](_0x2bbe81)[_0xc350('0x28')](function(_0x52f84a){return _0x52f84a;});}return null;};}function removeEntity(_0x2c7ae1,_0x3b156a){return function(_0x35db61){if(_0x35db61){return _0x35db61[_0xc350('0x29')]()[_0xc350('0x28')](function(){_0x2c7ae1[_0xc350('0x1d')](0xcc)[_0xc350('0x1e')]();});}};}function handleEntityNotFound(_0x76b70,_0x58f57f){return function(_0xed77ea){if(!_0xed77ea){_0x76b70['sendStatus'](0x194);}return _0xed77ea;};}function handleError(_0x3394a8,_0x196614){_0x196614=_0x196614||0x1f4;return function(_0x540ead){logger[_0xc350('0x2a')](_0x540ead['stack']);if(_0x540ead[_0xc350('0x2b')]){delete _0x540ead[_0xc350('0x2b')];}_0x3394a8[_0xc350('0x1d')](_0x196614)[_0xc350('0x2c')](_0x540ead);};}exports[_0xc350('0x2d')]=function(_0x3802b4,_0x21938f){var _0x75fa34={},_0x3cb262={},_0x5c0212={'count':0x0,'rows':[]};var _0x1bddd4=_['map'](db[_0xc350('0x2e')][_0xc350('0x2f')],function(_0x2988b8){return{'name':_0x2988b8[_0xc350('0x30')],'type':_0x2988b8[_0xc350('0x31')][_0xc350('0x32')]};});_0x3cb262[_0xc350('0x33')]=_['map'](_0x1bddd4,_0xc350('0x2b'));_0x3cb262[_0xc350('0x34')]=_[_0xc350('0x35')](_0x3802b4['query']);_0x3cb262[_0xc350('0x36')]=_[_0xc350('0x37')](_0x3cb262[_0xc350('0x33')],_0x3cb262[_0xc350('0x34')]);_0x75fa34[_0xc350('0x38')]=_[_0xc350('0x37')](_0x3cb262[_0xc350('0x33')],qs[_0xc350('0x39')](_0x3802b4[_0xc350('0x34')]['fields']));_0x75fa34['attributes']=_0x75fa34[_0xc350('0x38')]['length']?_0x75fa34[_0xc350('0x38')]:_0x3cb262[_0xc350('0x33')];if(!_0x3802b4[_0xc350('0x34')][_0xc350('0x3a')](_0xc350('0x3b'))){_0x75fa34[_0xc350('0x21')]=qs['limit'](_0x3802b4[_0xc350('0x34')][_0xc350('0x21')]);_0x75fa34['offset']=qs[_0xc350('0x20')](_0x3802b4[_0xc350('0x34')][_0xc350('0x20')]);}_0x75fa34[_0xc350('0x3c')]=qs['sort'](_0x3802b4[_0xc350('0x34')][_0xc350('0x3d')]);_0x75fa34[_0xc350('0x3e')]=qs[_0xc350('0x36')](_[_0xc350('0x3f')](_0x3802b4[_0xc350('0x34')],_0x3cb262[_0xc350('0x36')]),_0x1bddd4);if(_0x3802b4[_0xc350('0x34')][_0xc350('0x40')]){_0x75fa34['where']=_[_0xc350('0x41')](_0x75fa34['where'],{'$or':_[_0xc350('0x42')](_0x1bddd4,function(_0x46a99b){if(_0x46a99b['type']!=='VIRTUAL'){var _0x13d385={};_0x13d385[_0x46a99b[_0xc350('0x2b')]]={'$like':'%'+_0x3802b4[_0xc350('0x34')][_0xc350('0x40')]+'%'};return _0x13d385;}})});}_0x75fa34=_[_0xc350('0x41')]({},_0x75fa34,_0x3802b4[_0xc350('0x43')]);var _0x2d2467={'where':_0x75fa34['where']};return db[_0xc350('0x2e')][_0xc350('0x44')](_0x2d2467)[_0xc350('0x28')](function(_0x32d09b){_0x5c0212[_0xc350('0x44')]=_0x32d09b;if(_0x3802b4['query'][_0xc350('0x45')]){_0x75fa34['include']=[{'all':!![]}];}return db[_0xc350('0x2e')][_0xc350('0x46')](_0x75fa34);})[_0xc350('0x28')](function(_0x12cb19){_0x5c0212[_0xc350('0x47')]=_0x12cb19;return _0x5c0212;})['then'](respondWithFilteredResult(_0x21938f,_0x75fa34))[_0xc350('0x48')](handleError(_0x21938f,null));};exports['show']=function(_0x560659,_0x17fd0b){var _0xbe33dd={'raw':!![],'where':{'id':_0x560659[_0xc350('0x49')]['id']}},_0x407cf2={};_0x407cf2[_0xc350('0x33')]=_['keys'](db['ChatTransferReport'][_0xc350('0x2f')]);_0x407cf2[_0xc350('0x34')]=_[_0xc350('0x35')](_0x560659[_0xc350('0x34')]);_0x407cf2[_0xc350('0x36')]=_[_0xc350('0x37')](_0x407cf2['model'],_0x407cf2['query']);_0xbe33dd['attributes']=_[_0xc350('0x37')](_0x407cf2[_0xc350('0x33')],qs[_0xc350('0x39')](_0x560659[_0xc350('0x34')]['fields']));_0xbe33dd[_0xc350('0x38')]=_0xbe33dd[_0xc350('0x38')][_0xc350('0x4a')]?_0xbe33dd[_0xc350('0x38')]:_0x407cf2[_0xc350('0x33')];if(_0x560659[_0xc350('0x34')][_0xc350('0x45')]){_0xbe33dd[_0xc350('0x4b')]=[{'all':!![]}];}_0xbe33dd=_['merge']({},_0xbe33dd,_0x560659[_0xc350('0x43')]);return db[_0xc350('0x2e')][_0xc350('0x4c')](_0xbe33dd)[_0xc350('0x28')](handleEntityNotFound(_0x17fd0b,null))['then'](respondWithResult(_0x17fd0b,null))[_0xc350('0x48')](handleError(_0x17fd0b,null));};exports[_0xc350('0x4d')]=function(_0x4c2cba,_0x2c8fa5){return db[_0xc350('0x2e')][_0xc350('0x4d')](_0x4c2cba[_0xc350('0x4e')],{})[_0xc350('0x28')](respondWithResult(_0x2c8fa5,0xc9))['catch'](handleError(_0x2c8fa5,null));};exports[_0xc350('0x27')]=function(_0x3b1744,_0x2319c3){if(_0x3b1744[_0xc350('0x4e')]['id']){delete _0x3b1744[_0xc350('0x4e')]['id'];}return db[_0xc350('0x2e')][_0xc350('0x4c')]({'where':{'id':_0x3b1744[_0xc350('0x49')]['id']}})[_0xc350('0x28')](handleEntityNotFound(_0x2319c3,null))[_0xc350('0x28')](saveUpdates(_0x3b1744[_0xc350('0x4e')],null))[_0xc350('0x28')](respondWithResult(_0x2319c3,null))[_0xc350('0x48')](handleError(_0x2319c3,null));};exports[_0xc350('0x29')]=function(_0x2905bb,_0x2bcebf){return db['ChatTransferReport'][_0xc350('0x4c')]({'where':{'id':_0x2905bb[_0xc350('0x49')]['id']}})[_0xc350('0x28')](handleEntityNotFound(_0x2bcebf,null))[_0xc350('0x28')](removeEntity(_0x2bcebf,null))['catch'](handleError(_0x2bcebf,null));};exports['describe']=function(_0x4fcefc,_0x2e3a33){return db['ChatTransferReport'][_0xc350('0x4f')]()['then'](respondWithResult(_0x2e3a33,null))[_0xc350('0x48')](handleError(_0x2e3a33,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 7ea4645..82ab305 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 _0xa711=['ChatTransferReport','report_chat_transfer','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./chatTransferReport.attributes','define'];(function(_0x435ff1,_0x219988){var _0x531991=function(_0x57afda){while(--_0x57afda){_0x435ff1['push'](_0x435ff1['shift']());}};_0x531991(++_0x219988);}(_0xa711,0x6e));var _0x1a71=function(_0x88a94f,_0x3cd27d){_0x88a94f=_0x88a94f-0x0;var _0x4db244=_0xa711[_0x88a94f];return _0x4db244;};'use strict';var _=require(_0x1a71('0x0'));var util=require(_0x1a71('0x1'));var logger=require('../../config/logger')(_0x1a71('0x2'));var moment=require(_0x1a71('0x3'));var BPromise=require(_0x1a71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a71('0x5'));var rimraf=require(_0x1a71('0x6'));var config=require(_0x1a71('0x7'));var attributes=require(_0x1a71('0x8'));module['exports']=function(_0x43455c,_0x5501d6){return _0x43455c[_0x1a71('0x9')](_0x1a71('0xa'),attributes,{'tableName':_0x1a71('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6a7a=['api','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define','uniqueid','lodash','util','../../config/logger'];(function(_0x56b273,_0x23d8e2){var _0x3fcd07=function(_0x5655a){while(--_0x5655a){_0x56b273['push'](_0x56b273['shift']());}};_0x3fcd07(++_0x23d8e2);}(_0x6a7a,0x1ad));var _0xa6a7=function(_0x58067e,_0x16acce){_0x58067e=_0x58067e-0x0;var _0xfb88bd=_0x6a7a[_0x58067e];return _0xfb88bd;};'use strict';var _=require(_0xa6a7('0x0'));var util=require(_0xa6a7('0x1'));var logger=require(_0xa6a7('0x2'))(_0xa6a7('0x3'));var moment=require('moment');var BPromise=require(_0xa6a7('0x4'));var rp=require(_0xa6a7('0x5'));var fs=require('fs');var path=require(_0xa6a7('0x6'));var rimraf=require('rimraf');var config=require(_0xa6a7('0x7'));var attributes=require(_0xa6a7('0x8'));module[_0xa6a7('0x9')]=function(_0x56434e,_0x4f2375){return _0x56434e[_0xa6a7('0xa')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xa6a7('0xb'),'fields':[_0xa6a7('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 fb87d3a..fb37043 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 _0xc36a=['jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3b9716,_0x5218e7){var _0x4a0917=function(_0x5798ec){while(--_0x5798ec){_0x3b9716['push'](_0x3b9716['shift']());}};_0x4a0917(++_0x5218e7);}(_0xc36a,0x1b0));var _0xac36=function(_0x5ec83b,_0x2190e1){_0x5ec83b=_0x5ec83b-0x0;var _0x1c5c08=_0xc36a[_0x5ec83b];return _0x1c5c08;};'use strict';var _=require(_0xac36('0x0'));var util=require('util');var moment=require(_0xac36('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac36('0x2'));var db=require(_0xac36('0x3'))['db'];var utils=require(_0xac36('0x4'));var logger=require(_0xac36('0x5'))(_0xac36('0x6'));var config=require(_0xac36('0x7'));var jayson=require(_0xac36('0x8'));var client=jayson[_0xac36('0x9')][_0xac36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xee0d05,_0x57cce1,_0xd462ae){return new BPromise(function(_0x36a6a3,_0x48a356){return client[_0xac36('0xb')](_0xee0d05,_0xd462ae)['then'](function(_0x107d2d){logger[_0xac36('0xc')](_0xac36('0xd'),_0x57cce1,_0xac36('0xe'));logger[_0xac36('0xf')](_0xac36('0x10'),_0x57cce1,_0xac36('0xe'),JSON[_0xac36('0x11')](_0x107d2d));if(_0x107d2d[_0xac36('0x12')]){if(_0x107d2d[_0xac36('0x12')][_0xac36('0x13')]===0x1f4){logger[_0xac36('0x12')](_0xac36('0xd'),_0x57cce1,_0x107d2d[_0xac36('0x12')][_0xac36('0x14')]);return _0x48a356(_0x107d2d[_0xac36('0x12')][_0xac36('0x14')]);}logger[_0xac36('0x12')](_0xac36('0xd'),_0x57cce1,_0x107d2d[_0xac36('0x12')]['message']);return _0x36a6a3(_0x107d2d[_0xac36('0x12')]['message']);}else{logger['info'](_0xac36('0xd'),_0x57cce1,_0xac36('0xe'));_0x36a6a3(_0x107d2d['result'][_0xac36('0x14')]);}})[_0xac36('0x15')](function(_0x54823f){logger[_0xac36('0x12')](_0xac36('0xd'),_0x57cce1,_0x54823f);_0x48a356(_0x54823f);});});} \ No newline at end of file +var _0xf915=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x3dbd6d,_0x3ee9d7){var _0x1216f1=function(_0x27b7ad){while(--_0x27b7ad){_0x3dbd6d['push'](_0x3dbd6d['shift']());}};_0x1216f1(++_0x3ee9d7);}(_0xf915,0x6e));var _0x5f91=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf915[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5f91('0x0'));var util=require(_0x5f91('0x1'));var moment=require('moment');var BPromise=require(_0x5f91('0x2'));var rs=require(_0x5f91('0x3'));var fs=require('fs');var Redis=require(_0x5f91('0x4'));var db=require(_0x5f91('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f91('0x6'))(_0x5f91('0x7'));var config=require(_0x5f91('0x8'));var jayson=require(_0x5f91('0x9'));var client=jayson[_0x5f91('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42928e,_0xe9c58c,_0x3a88a5){return new BPromise(function(_0x1f70e0,_0x126dc9){return client[_0x5f91('0xb')](_0x42928e,_0x3a88a5)[_0x5f91('0xc')](function(_0x238553){logger[_0x5f91('0xd')](_0x5f91('0xe'),_0xe9c58c,_0x5f91('0xf'));logger[_0x5f91('0x10')](_0x5f91('0x11'),_0xe9c58c,_0x5f91('0xf'),JSON[_0x5f91('0x12')](_0x238553));if(_0x238553[_0x5f91('0x13')]){if(_0x238553['error'][_0x5f91('0x14')]===0x1f4){logger[_0x5f91('0x13')](_0x5f91('0xe'),_0xe9c58c,_0x238553[_0x5f91('0x13')][_0x5f91('0x15')]);return _0x126dc9(_0x238553[_0x5f91('0x13')][_0x5f91('0x15')]);}logger[_0x5f91('0x13')](_0x5f91('0xe'),_0xe9c58c,_0x238553['error'][_0x5f91('0x15')]);return _0x1f70e0(_0x238553['error']['message']);}else{logger[_0x5f91('0xd')](_0x5f91('0xe'),_0xe9c58c,_0x5f91('0xf'));_0x1f70e0(_0x238553[_0x5f91('0x16')][_0x5f91('0x15')]);}})['catch'](function(_0x2ffda9){logger[_0x5f91('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0xe9c58c,_0x2ffda9);_0x126dc9(_0x2ffda9);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 7ce6a05..0b7c9f9 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 _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'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 auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'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 auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);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 ef25c0f..842f6f0 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 _0xbb36=['website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','address','email','Agent','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x4a1320,_0x54a777){var _0xa824b0=function(_0xa52354){while(--_0xa52354){_0x4a1320['push'](_0x4a1320['shift']());}};_0xa824b0(++_0x54a777);}(_0xbb36,0x92));var _0x6bb3=function(_0x8f6832,_0x280948){_0x8f6832=_0x8f6832-0x0;var _0x50f773=_0xbb36[_0x8f6832];return _0x50f773;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x6bb3('0x0'));module[_0x6bb3('0x1')]={'name':{'type':Sequelize[_0x6bb3('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x6bb3('0x2')],'allowNull':![],'unique':_0x6bb3('0x3')},'description':{'type':Sequelize[_0x6bb3('0x2')]},'mapKey':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x6bb3('0x4')},'key':{'type':Sequelize[_0x6bb3('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x5')},'customerAlias':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6bb3('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6bb3('0x2')],'allowNull':![],'defaultValue':_0x6bb3('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6bb3('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6bb3('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6bb3('0x9')](_0x6bb3('0xa'),_0x6bb3('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x6bb3('0xc')},'header_offline':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0xd')},'download_transcript':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6bb3('0xe')]},'closingQuestion':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6bb3('0x10')},'noteTitle':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x11')},'placeholderMessage':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0xc')},'skipMessageButton':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x12')},'conditionAgreement':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6bb3('0x13')},'ratingType':{'type':Sequelize[_0x6bb3('0x9')](_0x6bb3('0x14'),_0x6bb3('0x15')),'defaultValue':_0x6bb3('0x14')},'ratingStarsNumber':{'type':Sequelize[_0x6bb3('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6bb3('0xe')],'defaultValue':function(){return JSON[_0x6bb3('0x16')]({'items':[{'type':_0x6bb3('0x17'),'variable':null,'config':{'placeholder':'name','type':_0x6bb3('0x18'),'required':!![]},'props':{'title':_0x6bb3('0x19'),'helpText':''}},{'type':_0x6bb3('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x6bb3('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6bb3('0x1a')]('onlineForm')?JSON[_0x6bb3('0x1b')](this[_0x6bb3('0x1a')](_0x6bb3('0x1c'))):{};},'set':function(_0x535494){return this[_0x6bb3('0x1d')](_0x6bb3('0x1c'),JSON[_0x6bb3('0x16')](_0x535494));}},'offlineForm':{'type':Sequelize[_0x6bb3('0xe')],'defaultValue':function(){return JSON[_0x6bb3('0x16')]({'items':[{'type':_0x6bb3('0x17'),'props':{'title':_0x6bb3('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x6bb3('0x4')},'variable':null},{'type':_0x6bb3('0x1e'),'config':{'placeholder':_0x6bb3('0x1f')},'props':{'title':'Comments','helpText':_0x6bb3('0x20')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0x6bb3('0x21'))?JSON[_0x6bb3('0x1b')](this[_0x6bb3('0x1a')](_0x6bb3('0x21'))):{};},'set':function(_0x5876a7){return this[_0x6bb3('0x1d')](_0x6bb3('0x21'),JSON[_0x6bb3('0x16')](_0x5876a7));}},'token':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6bb3('0x2')]},'forwardOffline':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6bb3('0x2')]},'waitingTitle':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x22')},'waitingMessage':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x23')},'offlineMessageSubject':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x24')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x12')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6bb3('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6bb3('0xe')]},'showAgentAvatar':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6bb3('0x25');}},'notificationSound':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x26')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x27')},'verticalAlignment':{'type':Sequelize[_0x6bb3('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x28')},'defaultTitle':{'type':Sequelize[_0x6bb3('0x2')]},'customerAvatar':{'type':Sequelize[_0x6bb3('0xe')]},'showCustomerAvatar':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6bb3('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6bb3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6bb3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':_0x6bb3('0x29')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6bb3('0x7')],'comment':_0x6bb3('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0x6bb3('0x8')],'defaultValue':![],'comment':_0x6bb3('0x2b'),'set':function(_0x1c57bc){if(!_0x1c57bc)this['setDataValue'](_0x6bb3('0x2c'),null);this[_0x6bb3('0x1d')](_0x6bb3('0x2d'),_0x1c57bc);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6bb3('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x96aa=['Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Skip','Feedback','star','TEXT','input','name','getDataValue','onlineForm','setDataValue','stringify','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'];(function(_0x26e424,_0xfcf210){var _0x2c81d6=function(_0x58feef){while(--_0x58feef){_0x26e424['push'](_0x26e424['shift']());}};_0x2c81d6(++_0xfcf210);}(_0x96aa,0x67));var _0xa96a=function(_0x41ee7a,_0x2f9689){_0x41ee7a=_0x41ee7a-0x0;var _0x41f6ab=_0x96aa[_0x41ee7a];return _0x41f6ab;};'use strict';var Sequelize=require(_0xa96a('0x0'));var rs=require(_0xa96a('0x1'));module['exports']={'name':{'type':Sequelize[_0xa96a('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xa96a('0x2')],'allowNull':![],'unique':_0xa96a('0x3')},'description':{'type':Sequelize[_0xa96a('0x2')]},'mapKey':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x5')},'customerAlias':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa96a('0x2')],'allowNull':![],'defaultValue':_0xa96a('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa96a('0x2')],'allowNull':![],'defaultValue':_0xa96a('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa96a('0x2')],'allowNull':![],'defaultValue':_0xa96a('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa96a('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa96a('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa96a('0x9')]('rounded',_0xa96a('0xa')),'defaultValue':_0xa96a('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xa96a('0xc')},'start_chat_button':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0xd')},'offline_chat_button':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0xe')},'header_offline':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0xf')},'download_transcript':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa96a('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xa96a('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa96a('0x13')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xa96a('0x14')},'noteTitle':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x15')},'placeholderMessage':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x16')},'closingMessage':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xa96a('0x17')},'conditionAgreement':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x18')},'ratingType':{'type':Sequelize[_0xa96a('0x9')](_0xa96a('0x19'),'thumb'),'defaultValue':_0xa96a('0x19')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa96a('0x1a')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa96a('0x1b'),'variable':null,'config':{'placeholder':_0xa96a('0x1c'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xa96a('0x1b'),'props':{'title':_0xa96a('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xa96a('0x4'),'type':_0xa96a('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xa96a('0x1d')](_0xa96a('0x1e'))?JSON['parse'](this['getDataValue'](_0xa96a('0x1e'))):{};},'set':function(_0x5916af){return this[_0xa96a('0x1f')](_0xa96a('0x1e'),JSON[_0xa96a('0x20')](_0x5916af));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xa96a('0x20')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa96a('0x4'),'type':'email'},'variable':null},{'type':_0xa96a('0x21'),'config':{'placeholder':_0xa96a('0x22')},'props':{'title':_0xa96a('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xa96a('0x1d')]('offlineForm')?JSON['parse'](this[_0xa96a('0x1d')]('offlineForm')):{};},'set':function(_0x585af1){return this[_0xa96a('0x1f')](_0xa96a('0x23'),JSON['stringify'](_0x585af1));}},'token':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':function(){return rs[_0xa96a('0x24')]();}},'autoclose':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa96a('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa96a('0x25')},'waitingMessage':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x27')},'offlineMessageBody':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x28')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x29')},'skipUnmanaged':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x17')},'sendUnmanaged':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa96a('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa96a('0x1a')],'defaultValue':function(){return _0xa96a('0x2a');}},'notificationSound':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xa96a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x2c')},'verticalAlignment':{'type':Sequelize[_0xa96a('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xa96a('0x2')]},'customerAvatar':{'type':Sequelize[_0xa96a('0x1a')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa96a('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa96a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa96a('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa96a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':_0xa96a('0x2d')},'systemAvatar':{'type':Sequelize[_0xa96a('0x1a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa96a('0x8')],'comment':_0xa96a('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa96a('0x2f'),'set':function(_0xc02bee){if(!_0xc02bee)this[_0xa96a('0x1f')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0xc02bee);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa96a('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3eadb98..9cd0563 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 _0x5d1b=['user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','asc','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','lastName','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','contact','messageId','created','autoclose','push','unmanaged','ChatMessage','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','offline','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','addInteraction','ids','Contact','Owner','fullname','internal','Tag','color','tag','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','getProactiveActions','virtual','custom','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.js','utf8','remote','x-real-ip','connection','referer','alignment','verticalAlignment','textColor','transaction','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','omit','ChatProactiveAction','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','to-csv','ejs','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','../../mysqldb','redis','defaults','./chatWebsite.socket','jayson/promise','client','http','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','getDispositions','findOne','Disposition','rawAttributes','hasOwnProperty','pick','merge','removeDispositions','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','isNil','existsSync','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/','getSystemAvatar','notify','user-agent-parser','setUA'];(function(_0x56c3eb,_0x5230c6){var _0x518779=function(_0x383c91){while(--_0x383c91){_0x56c3eb['push'](_0x56c3eb['shift']());}};_0x518779(++_0x5230c6);}(_0x5d1b,0x91));var _0xb5d1=function(_0x183a26,_0x19e750){_0x183a26=_0x183a26-0x0;var _0xd92d3e=_0x5d1b[_0x183a26];return _0xd92d3e;};'use strict';var pdf=require(_0xb5d1('0x0'));var emlformat=require(_0xb5d1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb5d1('0x3'));var BPromise=require(_0xb5d1('0x4'));var Mustache=require(_0xb5d1('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xb5d1('0x6'));var ejs=require(_0xb5d1('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb5d1('0x8'));var crypto=require('crypto');var jsforce=require(_0xb5d1('0x9'));var deskjs=require(_0xb5d1('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb5d1('0xb'));var Papa=require(_0xb5d1('0xc'));var Redis=require(_0xb5d1('0xd'));var authService=require(_0xb5d1('0xe'));var qs=require(_0xb5d1('0xf'));var as=require(_0xb5d1('0x10'));var hardwareService=require(_0xb5d1('0x11'));var logger=require(_0xb5d1('0x12'))(_0xb5d1('0x13'));var utils=require(_0xb5d1('0x14'));var config=require(_0xb5d1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb5d1('0x16'))['db'];config[_0xb5d1('0x17')]=_[_0xb5d1('0x18')](config[_0xb5d1('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5d1('0x17')]));require(_0xb5d1('0x19'))['register'](socket);var jayson=require(_0xb5d1('0x1a'));var client=jayson[_0xb5d1('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0xb5d1('0x1c')]({'port':0x232a});var client9003=jayson['client'][_0xb5d1('0x1c')]({'port':0x232b});function respondWithRpcPromise(_0x1aa60b,_0x229864,_0x1523f8,_0x468f87){return new BPromise(function(_0x3fafaf,_0x5af7e3){var _0x3061cb=_0x468f87||client;return _0x3061cb['request'](_0x1aa60b,_0x1523f8)['then'](function(_0x496515){logger[_0xb5d1('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x229864,_0xb5d1('0x1e'));logger[_0xb5d1('0x1f')](_0xb5d1('0x20'),_0x229864,'request\x20sent',JSON[_0xb5d1('0x21')](_0x496515));if(_0x496515[_0xb5d1('0x22')]){if(_0x496515['error'][_0xb5d1('0x23')]===0x1f4){logger[_0xb5d1('0x22')](_0xb5d1('0x24'),_0x229864,_0x496515[_0xb5d1('0x22')]['message']);return _0x5af7e3(_0x496515[_0xb5d1('0x22')][_0xb5d1('0x25')]);}logger[_0xb5d1('0x22')](_0xb5d1('0x24'),_0x229864,_0x496515['error'][_0xb5d1('0x25')]);return _0x3fafaf(_0x496515[_0xb5d1('0x22')][_0xb5d1('0x25')]);}else{logger[_0xb5d1('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x229864,_0xb5d1('0x1e'));_0x3fafaf(_0x496515[_0xb5d1('0x26')]['message']);}})['catch'](function(_0xc7377b){logger[_0xb5d1('0x22')](_0xb5d1('0x24'),_0x229864,_0xc7377b);_0x5af7e3(_0xc7377b);});});}function respondWithStatusCode(_0x3ac67a,_0x36ddc3){_0x36ddc3=_0x36ddc3||0xcc;return function(_0x4d5bb1){if(_0x4d5bb1){return _0x3ac67a['sendStatus'](_0x36ddc3);}return _0x3ac67a[_0xb5d1('0x27')](_0x36ddc3)[_0xb5d1('0x28')]();};}function respondWithResult(_0x1dcb0c,_0x5b35ee){_0x5b35ee=_0x5b35ee||0xc8;return function(_0x4a36ae){if(_0x4a36ae){return _0x1dcb0c[_0xb5d1('0x27')](_0x5b35ee)[_0xb5d1('0x29')](_0x4a36ae);}};}function respondWithFilteredResult(_0x55cd8e,_0x4d9a68){return function(_0x6cebde){if(_0x6cebde){var _0x386d01=_0x6cebde[_0xb5d1('0x2a')],_0x39d118=_0x4d9a68[_0xb5d1('0x2b')],_0x2231f7=_0x4d9a68[_0xb5d1('0x2b')]+_0x4d9a68[_0xb5d1('0x2c')],_0x2d4631;if(_0x2231f7>=_0x386d01){_0x2231f7=_0x386d01;_0x2d4631=0xc8;}else{_0x2d4631=0xce;}_0x55cd8e['status'](_0x2d4631);return _0x55cd8e[_0xb5d1('0x2d')](_0xb5d1('0x2e'),_0x39d118+'-'+_0x2231f7+'/'+_0x386d01)[_0xb5d1('0x29')](_0x6cebde);}return null;};}function patchUpdates(_0x4e58da){return function(_0x5d6ca7){try{jsonpatch['apply'](_0x5d6ca7,_0x4e58da,!![]);}catch(_0x5aa1b4){return BPromise['reject'](_0x5aa1b4);}return _0x5d6ca7[_0xb5d1('0x2f')]();};}function saveUpdates(_0x4eb712,_0x58f301){return function(_0x493598){if(_0x493598){return _0x493598[_0xb5d1('0x30')](_0x4eb712)[_0xb5d1('0x31')](function(_0x30f53d){return _0x30f53d;});}return null;};}function removeEntity(_0x42c89b,_0x1687ce){return function(_0x3541d7){if(_0x3541d7){return _0x3541d7[_0xb5d1('0x32')]()[_0xb5d1('0x31')](function(){var _0x1cd88b=_0x3541d7['get']({'plain':!![]});var _0x19140b='ChatWebsites';return db[_0xb5d1('0x33')][_0xb5d1('0x32')]({'where':{'type':_0x19140b,'resourceId':_0x1cd88b['id']}})['then'](function(){return _0x3541d7;});})[_0xb5d1('0x31')](function(){_0x42c89b[_0xb5d1('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x343630,_0x20445c){return function(_0x1b13f9){if(!_0x1b13f9){_0x343630[_0xb5d1('0x34')](0x194);}return _0x1b13f9;};}function handleError(_0x5aa386,_0xc4a7c){_0xc4a7c=_0xc4a7c||0x1f4;return function(_0x13b1a4){logger['error'](_0x13b1a4[_0xb5d1('0x35')]);if(_0x13b1a4[_0xb5d1('0x36')]){delete _0x13b1a4[_0xb5d1('0x36')];}_0x5aa386['status'](_0xc4a7c)[_0xb5d1('0x37')](_0x13b1a4);};}exports[_0xb5d1('0x38')]=function(_0x2cd1fc,_0x571f48){var _0x207f29={'include':[{'model':db[_0xb5d1('0x39')],'as':_0xb5d1('0x3a')}]},_0x44eb1a={},_0xec42c={'count':0x0,'rows':[]};var _0x338d45=_[_0xb5d1('0x3b')](db[_0xb5d1('0x3c')]['rawAttributes'],function(_0x3d875a){return{'name':_0x3d875a[_0xb5d1('0x3d')],'type':_0x3d875a[_0xb5d1('0x3e')][_0xb5d1('0x3f')]};});_0x44eb1a[_0xb5d1('0x40')]=_[_0xb5d1('0x3b')](_0x338d45,'name');_0x44eb1a['query']=_['keys'](_0x2cd1fc[_0xb5d1('0x41')]);_0x44eb1a[_0xb5d1('0x42')]=_[_0xb5d1('0x43')](_0x44eb1a[_0xb5d1('0x40')],_0x44eb1a[_0xb5d1('0x41')]);_0x207f29[_0xb5d1('0x44')]=_['intersection'](_0x44eb1a[_0xb5d1('0x40')],qs[_0xb5d1('0x45')](_0x2cd1fc[_0xb5d1('0x41')][_0xb5d1('0x45')]));_0x207f29['attributes']=_0x207f29[_0xb5d1('0x44')][_0xb5d1('0x46')]?_0x207f29[_0xb5d1('0x44')]:_0x44eb1a[_0xb5d1('0x40')];if(!_0x2cd1fc['query']['hasOwnProperty'](_0xb5d1('0x47'))){_0x207f29[_0xb5d1('0x2c')]=qs[_0xb5d1('0x2c')](_0x2cd1fc[_0xb5d1('0x41')][_0xb5d1('0x2c')]);_0x207f29[_0xb5d1('0x2b')]=qs[_0xb5d1('0x2b')](_0x2cd1fc[_0xb5d1('0x41')][_0xb5d1('0x2b')]);}_0x207f29[_0xb5d1('0x48')]=qs['sort'](_0x2cd1fc['query'][_0xb5d1('0x49')]);_0x207f29['where']=qs[_0xb5d1('0x42')](_['pick'](_0x2cd1fc[_0xb5d1('0x41')],_0x44eb1a[_0xb5d1('0x42')]),_0x338d45);if(_0x2cd1fc[_0xb5d1('0x41')][_0xb5d1('0x4a')]){_0x207f29[_0xb5d1('0x4b')]=_['merge'](_0x207f29[_0xb5d1('0x4b')],{'$or':_[_0xb5d1('0x3b')](_0x338d45,function(_0x52dc31){if(_0x52dc31['type']!=='VIRTUAL'){var _0x40d5a6={};_0x40d5a6[_0x52dc31[_0xb5d1('0x36')]]={'$like':'%'+_0x2cd1fc[_0xb5d1('0x41')][_0xb5d1('0x4a')]+'%'};return _0x40d5a6;}})});}_0x207f29=_['merge']({},_0x207f29,_0x2cd1fc[_0xb5d1('0x4c')]);var _0xe40f68={'where':_0x207f29[_0xb5d1('0x4b')]};return db['ChatWebsite']['count'](_0xe40f68)['then'](function(_0x332048){_0xec42c['count']=_0x332048;if(_0x2cd1fc[_0xb5d1('0x41')][_0xb5d1('0x4d')]){_0x207f29['include']=[{'all':!![]}];}return db[_0xb5d1('0x3c')][_0xb5d1('0x4e')](_0x207f29);})[_0xb5d1('0x31')](function(_0x2a2a51){_0xec42c[_0xb5d1('0x4f')]=_0x2a2a51;return _0xec42c;})['then'](respondWithFilteredResult(_0x571f48,_0x207f29))[_0xb5d1('0x50')](handleError(_0x571f48,null));};exports[_0xb5d1('0x51')]=function(_0x2681e7,_0x551601){var _0x38463e={'raw':![],'where':{'id':_0x2681e7[_0xb5d1('0x52')]['id']},'include':[{'model':db[_0xb5d1('0x39')],'as':_0xb5d1('0x3a')}]},_0x2f9af0={};_0x2f9af0['model']=_[_0xb5d1('0x53')](db[_0xb5d1('0x3c')]['rawAttributes']);_0x2f9af0['query']=_[_0xb5d1('0x53')](_0x2681e7[_0xb5d1('0x41')]);_0x2f9af0[_0xb5d1('0x42')]=_[_0xb5d1('0x43')](_0x2f9af0[_0xb5d1('0x40')],_0x2f9af0[_0xb5d1('0x41')]);_0x38463e[_0xb5d1('0x44')]=_[_0xb5d1('0x43')](_0x2f9af0[_0xb5d1('0x40')],qs[_0xb5d1('0x45')](_0x2681e7[_0xb5d1('0x41')][_0xb5d1('0x45')]));_0x38463e[_0xb5d1('0x44')]=_0x38463e[_0xb5d1('0x44')][_0xb5d1('0x46')]?_0x38463e[_0xb5d1('0x44')]:_0x2f9af0[_0xb5d1('0x40')];if(_0x2681e7[_0xb5d1('0x41')][_0xb5d1('0x4d')]){_0x38463e[_0xb5d1('0x54')]=[{'all':!![]}];}_0x38463e=_['merge']({},_0x38463e,_0x2681e7[_0xb5d1('0x4c')]);return db['ChatWebsite'][_0xb5d1('0x55')](_0x38463e)['then'](handleEntityNotFound(_0x551601,null))['then'](respondWithResult(_0x551601,null))[_0xb5d1('0x50')](handleError(_0x551601,null));};exports[_0xb5d1('0x56')]=function(_0x1438ad,_0x15234c){return db[_0xb5d1('0x3c')]['create'](_0x1438ad[_0xb5d1('0x57')],{})[_0xb5d1('0x31')](function(_0x4b62a4){var _0x2c5556=_0x1438ad[_0xb5d1('0x58')][_0xb5d1('0x59')]({'plain':!![]});if(!_0x2c5556)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c5556[_0xb5d1('0x5a')]===_0xb5d1('0x58')){var _0xcb6175=_0x4b62a4[_0xb5d1('0x59')]({'plain':!![]});var _0x4870bb='ChatWebsites';return db[_0xb5d1('0x5b')][_0xb5d1('0x55')]({'where':{'name':_0x4870bb,'userProfileId':_0x2c5556[_0xb5d1('0x5c')]},'raw':!![]})['then'](function(_0x198719){if(_0x198719&&_0x198719['autoAssociation']===0x0){return db[_0xb5d1('0x33')][_0xb5d1('0x56')]({'name':_0xcb6175[_0xb5d1('0x36')],'resourceId':_0xcb6175['id'],'type':_0x198719[_0xb5d1('0x36')],'sectionId':_0x198719['id']},{})['then'](function(){return _0x4b62a4;});}else{return _0x4b62a4;}})[_0xb5d1('0x50')](function(_0x436106){logger[_0xb5d1('0x22')](_0xb5d1('0x5d'),_0x436106);throw _0x436106;});}return _0x4b62a4;})[_0xb5d1('0x31')](respondWithResult(_0x15234c,0xc9))[_0xb5d1('0x50')](handleError(_0x15234c,null));};exports[_0xb5d1('0x30')]=function(_0x47fefb,_0x4714d6){if(_0x47fefb[_0xb5d1('0x57')]['id']){delete _0x47fefb[_0xb5d1('0x57')]['id'];}return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0x47fefb[_0xb5d1('0x52')]['id']},'include':[{'model':db[_0xb5d1('0x39')],'as':_0xb5d1('0x3a')}]})['then'](handleEntityNotFound(_0x4714d6,null))[_0xb5d1('0x31')](saveUpdates(_0x47fefb[_0xb5d1('0x57')],null))[_0xb5d1('0x31')](respondWithResult(_0x4714d6,null))[_0xb5d1('0x50')](handleError(_0x4714d6,null));};exports[_0xb5d1('0x32')]=function(_0xa84d23,_0x269a73){return db[_0xb5d1('0x3c')]['find']({'where':{'id':_0xa84d23['params']['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x269a73,null))[_0xb5d1('0x31')](removeEntity(_0x269a73,null))[_0xb5d1('0x50')](handleError(_0x269a73,null));};exports[_0xb5d1('0x5e')]=function(_0x99722d,_0x1468c6){return db[_0xb5d1('0x3c')]['describe']()[_0xb5d1('0x31')](respondWithResult(_0x1468c6,null))[_0xb5d1('0x50')](handleError(_0x1468c6,null));};exports['addDisposition']=function(_0xc2fb7b,_0x1a99ca,_0x598890){if(_0xc2fb7b['body']['id']){delete _0xc2fb7b[_0xb5d1('0x57')]['id'];}return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0xc2fb7b[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x1a99ca,null))[_0xb5d1('0x31')](function(_0xb9e359){if(_0xb9e359){_0xc2fb7b['body'][_0xb5d1('0x5f')]=_0xb9e359['id'];return db['Disposition']['create'](_0xc2fb7b['body']);}})[_0xb5d1('0x31')](respondWithResult(_0x1a99ca,null))['catch'](handleError(_0x1a99ca,null));};exports[_0xb5d1('0x60')]=function(_0x1a96a5,_0x2b1bb4,_0x563bf4){var _0x3c9a53={'raw':![],'where':{}};var _0x1ad100={};var _0xd585d2={'count':0x0,'rows':[]};return db[_0xb5d1('0x3c')][_0xb5d1('0x61')]({'where':{'id':_0x1a96a5[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x2b1bb4,null))[_0xb5d1('0x31')](function(_0x31eed9){if(_0x31eed9){_0x1ad100[_0xb5d1('0x40')]=_[_0xb5d1('0x53')](db[_0xb5d1('0x62')][_0xb5d1('0x63')]);_0x1ad100[_0xb5d1('0x41')]=_[_0xb5d1('0x53')](_0x1a96a5[_0xb5d1('0x41')]);_0x1ad100[_0xb5d1('0x42')]=_['intersection'](_0x1ad100[_0xb5d1('0x40')],_0x1ad100[_0xb5d1('0x41')]);_0x3c9a53['attributes']=_[_0xb5d1('0x43')](_0x1ad100[_0xb5d1('0x40')],qs[_0xb5d1('0x45')](_0x1a96a5[_0xb5d1('0x41')][_0xb5d1('0x45')]));_0x3c9a53[_0xb5d1('0x44')]=_0x3c9a53[_0xb5d1('0x44')][_0xb5d1('0x46')]?_0x3c9a53['attributes']:_0x1ad100[_0xb5d1('0x40')];if(!_0x1a96a5['query'][_0xb5d1('0x64')](_0xb5d1('0x47'))){_0x3c9a53[_0xb5d1('0x2c')]=qs['limit'](_0x1a96a5['query'][_0xb5d1('0x2c')]);_0x3c9a53[_0xb5d1('0x2b')]=qs['offset'](_0x1a96a5[_0xb5d1('0x41')][_0xb5d1('0x2b')]);}_0x3c9a53[_0xb5d1('0x48')]=qs[_0xb5d1('0x49')](_0x1a96a5[_0xb5d1('0x41')][_0xb5d1('0x49')]);_0x3c9a53[_0xb5d1('0x4b')]=qs[_0xb5d1('0x42')](_[_0xb5d1('0x65')](_0x1a96a5[_0xb5d1('0x41')],_0x1ad100[_0xb5d1('0x42')]));_0x3c9a53[_0xb5d1('0x4b')][_0xb5d1('0x5f')]=_0x31eed9['id'];if(_0x1a96a5[_0xb5d1('0x41')][_0xb5d1('0x4a')]){_0x3c9a53[_0xb5d1('0x4b')]=_[_0xb5d1('0x66')](_0x3c9a53[_0xb5d1('0x4b')],{'$or':_[_0xb5d1('0x3b')](_0x3c9a53[_0xb5d1('0x44')],function(_0x25c2cb){var _0x4b9ef5={};_0x4b9ef5[_0x25c2cb]={'$like':'%'+_0x1a96a5[_0xb5d1('0x41')][_0xb5d1('0x4a')]+'%'};return _0x4b9ef5;})});}_0x3c9a53=_[_0xb5d1('0x66')]({},_0x3c9a53,_0x1a96a5[_0xb5d1('0x4c')]);return db[_0xb5d1('0x62')][_0xb5d1('0x2a')]({'where':_0x3c9a53[_0xb5d1('0x4b')]})['then'](function(_0xa89bb0){_0xd585d2[_0xb5d1('0x2a')]=_0xa89bb0;if(_0x1a96a5['query'][_0xb5d1('0x4d')]){_0x3c9a53[_0xb5d1('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xb5d1('0x4e')](_0x3c9a53);})[_0xb5d1('0x31')](function(_0x50ac77){_0xd585d2[_0xb5d1('0x4f')]=_0x50ac77;return _0xd585d2;});}})[_0xb5d1('0x31')](respondWithFilteredResult(_0x2b1bb4,_0x3c9a53))[_0xb5d1('0x50')](handleError(_0x2b1bb4,null));};exports[_0xb5d1('0x67')]=function(_0x3786fb,_0x53cfd3,_0x4bc178){return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0x3786fb[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x53cfd3,null))[_0xb5d1('0x31')](function(_0x75a697){if(_0x75a697){return _0x75a697['removeDispositions'](_0x3786fb[_0xb5d1('0x41')]['ids']);}})[_0xb5d1('0x31')](respondWithStatusCode(_0x53cfd3,null))[_0xb5d1('0x50')](handleError(_0x53cfd3,null));};exports['addAnswer']=function(_0x4befc4,_0x390cd5,_0x3a0451){if(_0x4befc4[_0xb5d1('0x57')]['id']){delete _0x4befc4[_0xb5d1('0x57')]['id'];}return db[_0xb5d1('0x3c')]['find']({'where':{'id':_0x4befc4['params']['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x390cd5,null))[_0xb5d1('0x31')](function(_0x4c658f){if(_0x4c658f){_0x4befc4[_0xb5d1('0x57')]['ChatWebsiteId']=_0x4c658f['id'];return db[_0xb5d1('0x68')][_0xb5d1('0x56')](_0x4befc4[_0xb5d1('0x57')]);}})['then'](respondWithResult(_0x390cd5,null))[_0xb5d1('0x50')](handleError(_0x390cd5,null));};exports[_0xb5d1('0x69')]=function(_0x1e2266,_0x60059f,_0x40e909){var _0x5c21c1={'raw':![],'where':{}};var _0x303d08={};var _0x2b3e7d={'count':0x0,'rows':[]};return db[_0xb5d1('0x3c')]['findOne']({'where':{'id':_0x1e2266[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x60059f,null))[_0xb5d1('0x31')](function(_0x5c3550){if(_0x5c3550){_0x303d08['model']=_['keys'](db['CannedAnswer'][_0xb5d1('0x63')]);_0x303d08['query']=_['keys'](_0x1e2266[_0xb5d1('0x41')]);_0x303d08[_0xb5d1('0x42')]=_[_0xb5d1('0x43')](_0x303d08[_0xb5d1('0x40')],_0x303d08[_0xb5d1('0x41')]);_0x5c21c1[_0xb5d1('0x44')]=_[_0xb5d1('0x43')](_0x303d08[_0xb5d1('0x40')],qs[_0xb5d1('0x45')](_0x1e2266[_0xb5d1('0x41')]['fields']));_0x5c21c1['attributes']=_0x5c21c1[_0xb5d1('0x44')]['length']?_0x5c21c1[_0xb5d1('0x44')]:_0x303d08['model'];if(!_0x1e2266[_0xb5d1('0x41')]['hasOwnProperty']('nolimit')){_0x5c21c1[_0xb5d1('0x2c')]=qs[_0xb5d1('0x2c')](_0x1e2266[_0xb5d1('0x41')][_0xb5d1('0x2c')]);_0x5c21c1[_0xb5d1('0x2b')]=qs[_0xb5d1('0x2b')](_0x1e2266[_0xb5d1('0x41')][_0xb5d1('0x2b')]);}_0x5c21c1[_0xb5d1('0x48')]=qs['sort'](_0x1e2266['query'][_0xb5d1('0x49')]);_0x5c21c1[_0xb5d1('0x4b')]=qs[_0xb5d1('0x42')](_[_0xb5d1('0x65')](_0x1e2266[_0xb5d1('0x41')],_0x303d08[_0xb5d1('0x42')]));_0x5c21c1[_0xb5d1('0x4b')][_0xb5d1('0x5f')]=_0x5c3550['id'];if(_0x1e2266[_0xb5d1('0x41')][_0xb5d1('0x4a')]){_0x5c21c1[_0xb5d1('0x4b')]=_['merge'](_0x5c21c1[_0xb5d1('0x4b')],{'$or':_[_0xb5d1('0x3b')](_0x5c21c1[_0xb5d1('0x44')],function(_0xfffaec){var _0x527512={};_0x527512[_0xfffaec]={'$like':'%'+_0x1e2266[_0xb5d1('0x41')][_0xb5d1('0x4a')]+'%'};return _0x527512;})});}_0x5c21c1=_[_0xb5d1('0x66')]({},_0x5c21c1,_0x1e2266[_0xb5d1('0x4c')]);return db[_0xb5d1('0x68')]['count']({'where':_0x5c21c1['where']})[_0xb5d1('0x31')](function(_0x2cef42){_0x2b3e7d['count']=_0x2cef42;if(_0x1e2266[_0xb5d1('0x41')]['includeAll']){_0x5c21c1[_0xb5d1('0x54')]=[{'all':!![]}];}return db[_0xb5d1('0x68')][_0xb5d1('0x4e')](_0x5c21c1);})['then'](function(_0x8b4bf7){_0x2b3e7d[_0xb5d1('0x4f')]=_0x8b4bf7;return _0x2b3e7d;});}})['then'](respondWithFilteredResult(_0x60059f,_0x5c21c1))[_0xb5d1('0x50')](handleError(_0x60059f,null));};exports[_0xb5d1('0x6a')]=function(_0x2c82f3,_0x36953f,_0x16c894){return db[_0xb5d1('0x3c')]['find']({'where':{'id':_0x2c82f3['params']['id']}})['then'](handleEntityNotFound(_0x36953f,null))[_0xb5d1('0x31')](function(_0xf411cf){if(_0xf411cf){return _0xf411cf[_0xb5d1('0x6a')](_0x2c82f3[_0xb5d1('0x41')]['ids']);}})[_0xb5d1('0x31')](respondWithStatusCode(_0x36953f,null))[_0xb5d1('0x50')](handleError(_0x36953f,null));};exports[_0xb5d1('0x6b')]=function(_0x874a02,_0x42a2ba,_0x4254a2){_0x874a02[_0xb5d1('0x57')]['sitepic']=_0x874a02[_0xb5d1('0x6c')][_0xb5d1('0x6d')];return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0x874a02[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x42a2ba,null))['then'](saveUpdates(_0x874a02['body'],null))[_0xb5d1('0x31')](respondWithResult(_0x42a2ba,null))[_0xb5d1('0x50')](handleError(_0x42a2ba,null));};exports[_0xb5d1('0x6e')]=function(_0x229192,_0x40f7a4,_0x53e985){_0x229192[_0xb5d1('0x57')][_0xb5d1('0x6f')]=_0x229192[_0xb5d1('0x6c')][_0xb5d1('0x6d')];return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0x229192[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x40f7a4,null))['then'](saveUpdates(_0x229192['body'],null))['then'](respondWithResult(_0x40f7a4,null))['catch'](handleError(_0x40f7a4,null));};exports[_0xb5d1('0x70')]=function(_0xf32f,_0x62c697,_0x3204d3){_0xf32f['body'][_0xb5d1('0x71')]=_0xf32f['file'][_0xb5d1('0x6d')];return db['ChatWebsite'][_0xb5d1('0x55')]({'where':{'id':_0xf32f['params']['id']}})['then'](handleEntityNotFound(_0x62c697,null))[_0xb5d1('0x31')](saveUpdates(_0xf32f[_0xb5d1('0x57')],null))['then'](respondWithResult(_0x62c697,null))['catch'](handleError(_0x62c697,null));};exports[_0xb5d1('0x72')]=function(_0x4b4bf8,_0x130668,_0xee5d9f){_0x4b4bf8[_0xb5d1('0x57')][_0xb5d1('0x73')]=_0x4b4bf8[_0xb5d1('0x6c')][_0xb5d1('0x6d')];return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0x4b4bf8[_0xb5d1('0x52')]['id']}})['then'](handleEntityNotFound(_0x130668,null))['then'](saveUpdates(_0x4b4bf8['body'],null))[_0xb5d1('0x31')](respondWithResult(_0x130668,null))['catch'](handleError(_0x130668,null));};exports[_0xb5d1('0x74')]=function(_0x175f72,_0x30a85f,_0x51bd07){var _0x34a112=path['join'](config[_0xb5d1('0x75')],_0xb5d1('0x76'));var _0x10bded={'where':{'id':_0x175f72[_0xb5d1('0x52')]['id']},'attributes':['id',_0xb5d1('0x77')],'raw':!![]};var _0x2b6bd4=![];return require(_0xb5d1('0x78'))[_0xb5d1('0x79')]()[_0xb5d1('0x31')](function(_0x49d2cc){if(_0x49d2cc){_0x2b6bd4=_0x49d2cc['custom'];}})[_0xb5d1('0x31')](function(){return db[_0xb5d1('0x3c')][_0xb5d1('0x55')](_0x10bded);})[_0xb5d1('0x31')](handleEntityNotFound(_0x30a85f,null))['then'](function(_0x32e8b9){if(_0x32e8b9){if(!_[_0xb5d1('0x7a')](_0x32e8b9[_0xb5d1('0x77')])){if(fs[_0xb5d1('0x7b')](path[_0xb5d1('0x7c')](config[_0xb5d1('0x75')],'server/files/images/logos/',_0x32e8b9['sitepic']))&&_0x2b6bd4){_0x34a112=path[_0xb5d1('0x7c')](config[_0xb5d1('0x75')],_0xb5d1('0x7d'),_0x32e8b9['sitepic']);}}return _0x30a85f[_0xb5d1('0x7e')](_0x34a112);}})[_0xb5d1('0x50')](handleError(_0x30a85f,null));};exports[_0xb5d1('0x7f')]=function(_0x23e361,_0x4e8b6d,_0x227e72){var _0x36990e=path[_0xb5d1('0x7c')](config[_0xb5d1('0x75')],_0xb5d1('0x80'));var _0x60259c={'where':{'id':_0x23e361['params']['id']},'attributes':['id',_0xb5d1('0x6f')],'raw':!![]};return db[_0xb5d1('0x3c')]['find'](_0x60259c)[_0xb5d1('0x31')](handleEntityNotFound(_0x4e8b6d,null))['then'](function(_0x2092f2){if(_0x2092f2){if(!_[_0xb5d1('0x7a')](_0x2092f2['agentAvatar'])){if(fs[_0xb5d1('0x7b')](path['join'](config[_0xb5d1('0x75')],'server/files/images/avatars/',_0x2092f2[_0xb5d1('0x6f')]))){_0x36990e=path[_0xb5d1('0x7c')](config[_0xb5d1('0x75')],'server/files/images/avatars/',_0x2092f2[_0xb5d1('0x6f')]);}}return _0x4e8b6d[_0xb5d1('0x7e')](_0x36990e);}})[_0xb5d1('0x50')](handleError(_0x4e8b6d,null));};exports['getCustomerAvatar']=function(_0x1fa7f8,_0x1ecc7c,_0x1971b6){var _0x44f3c8=path['join'](config[_0xb5d1('0x75')],_0xb5d1('0x81'));var _0x2b8dd1={'where':{'id':_0x1fa7f8[_0xb5d1('0x52')]['id']},'attributes':['id',_0xb5d1('0x71'),_0xb5d1('0x82')],'raw':!![]};return db[_0xb5d1('0x3c')]['find'](_0x2b8dd1)[_0xb5d1('0x31')](handleEntityNotFound(_0x1ecc7c,null))[_0xb5d1('0x31')](function(_0x13371f){if(_0x13371f){if(!_['isNil'](_0x13371f[_0xb5d1('0x71')])){if(fs['existsSync'](path[_0xb5d1('0x7c')](config[_0xb5d1('0x75')],_0xb5d1('0x83'),_0x13371f[_0xb5d1('0x71')]))&&_0x13371f[_0xb5d1('0x82')]){_0x44f3c8=path[_0xb5d1('0x7c')](config[_0xb5d1('0x75')],_0xb5d1('0x83'),_0x13371f[_0xb5d1('0x71')]);}}return _0x1ecc7c[_0xb5d1('0x7e')](_0x44f3c8);}})[_0xb5d1('0x50')](handleError(_0x1ecc7c,null));};exports[_0xb5d1('0x84')]=function(_0x411bd9,_0x161db8,_0x44b417){var _0x2ac0e9=path[_0xb5d1('0x7c')](config[_0xb5d1('0x75')],'server/files/images/avatars/system_avatar.png');var _0x358044={'where':{'id':_0x411bd9[_0xb5d1('0x52')]['id']},'attributes':['id',_0xb5d1('0x73')],'raw':!![]};return db['ChatWebsite'][_0xb5d1('0x55')](_0x358044)[_0xb5d1('0x31')](handleEntityNotFound(_0x161db8,null))[_0xb5d1('0x31')](function(_0x20647c){if(_0x20647c){if(!_['isNil'](_0x20647c[_0xb5d1('0x73')])){if(fs['existsSync'](path['join'](config[_0xb5d1('0x75')],_0xb5d1('0x83'),_0x20647c[_0xb5d1('0x73')]))){_0x2ac0e9=path[_0xb5d1('0x7c')](config[_0xb5d1('0x75')],_0xb5d1('0x83'),_0x20647c[_0xb5d1('0x73')]);}}return _0x161db8[_0xb5d1('0x7e')](_0x2ac0e9);}})[_0xb5d1('0x50')](handleError(_0x161db8,null));};exports[_0xb5d1('0x85')]=function(_0x5870b4,_0x4d3ee9,_0x3e1921){var _0x3febb2=require(_0xb5d1('0x86'));var _0x27a7ac=new _0x3febb2();var _0x2e5f30=_0x27a7ac[_0xb5d1('0x87')](_0x5870b4['headers'][_0xb5d1('0x88')])[_0xb5d1('0x89')]();var _0x24afba={'body':_0x5870b4[_0xb5d1('0x57')],'channel':_0xb5d1('0x8a')};var _0x3b1b63=[];var _0x384b88=[];var _0x79f748={};var _0x464daa=![];return db[_0xb5d1('0x8b')][_0xb5d1('0x5e')]()[_0xb5d1('0x31')](function(_0x3f5e0e){if(!_0x3f5e0e){throw new db[(_0xb5d1('0x8c'))][(_0xb5d1('0x8d'))](_0xb5d1('0x8e'));}_0x3b1b63=_[_0xb5d1('0x8f')](_['keys'](_0x3f5e0e),[_0xb5d1('0x90'),'updatedAt']);_0x384b88=_[_0xb5d1('0x8f')](_['keys'](_0x3f5e0e),[_0xb5d1('0x90'),_0xb5d1('0x91'),'CompanyId',_0xb5d1('0x92')]);if(_0x5870b4['body']['id']){delete _0x5870b4[_0xb5d1('0x57')]['id'];}if(_[_0xb5d1('0x7a')](_0x5870b4['body'][_0xb5d1('0x93')])){throw new db[(_0xb5d1('0x8c'))][(_0xb5d1('0x8d'))](_0xb5d1('0x94'));}if(_[_0xb5d1('0x7a')](_0x5870b4['body'][_0xb5d1('0x57')])||_0x5870b4['body'][_0xb5d1('0x57')]===''){throw new db['Sequelize'][(_0xb5d1('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb5d1('0x7a')](_0x5870b4[_0xb5d1('0x57')]['mapKey'])){throw new db[(_0xb5d1('0x8c'))][(_0xb5d1('0x8d'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x384b88);}if(!_[_0xb5d1('0x95')](_0x384b88,_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0x96')])){throw new db['Sequelize'][(_0xb5d1('0x8d'))](_0xb5d1('0x97')+_0x384b88);}_0x79f748[_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0x96')]]=_0x5870b4['body'][_0xb5d1('0x93')];})[_0xb5d1('0x31')](function(){return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0x5870b4[_0xb5d1('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0xb5d1('0x98'),'include':[{'model':db[_0xb5d1('0x8b')],'as':_0xb5d1('0x99'),'where':_0x79f748,'limit':0x1,'order':[[_0xb5d1('0x91'),_0xb5d1('0x9a')]]}]},{'model':db[_0xb5d1('0x9b')],'as':_0xb5d1('0x9c')}]});})[_0xb5d1('0x31')](handleEntityNotFound(_0x4d3ee9,null))[_0xb5d1('0x31')](function(_0x2f9fd7){if(_0x2f9fd7&&_0x2f9fd7['List']){_0x24afba[_0xb5d1('0x9d')]=_0x2f9fd7;_0x24afba[_0xb5d1('0x9e')]=_0x2f9fd7[_0xb5d1('0x9c')];_0x24afba[_0xb5d1('0x9f')]=_0x2f9fd7['List'];_0x24afba['applications']=_[_0xb5d1('0xa0')](_0x24afba[_0xb5d1('0x9e')],['priority'],[_0xb5d1('0xa1')]);if(_0x24afba['account'][_0xb5d1('0x9c')]){delete _0x24afba[_0xb5d1('0x9d')][_0xb5d1('0x9c')];}if(_0x24afba[_0xb5d1('0x9d')][_0xb5d1('0x98')]&&_0x24afba[_0xb5d1('0x9d')][_0xb5d1('0x98')][_0xb5d1('0x99')][_0xb5d1('0x46')]){return _0x24afba[_0xb5d1('0x9d')][_0xb5d1('0x98')][_0xb5d1('0x99')][0x0];}var _0x2c23bd=_[_0xb5d1('0x18')](_0x5870b4['body'],{'firstName':_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0x93')],'ListId':_0x2f9fd7[_0xb5d1('0x92')]});_0x2c23bd[_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0x96')]]=_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0x93')];return db['CmContact']['create'](_0x2c23bd,{'fields':_0x3b1b63,'raw':!![]});}})[_0xb5d1('0x31')](handleEntityNotFound(_0x4d3ee9,null))[_0xb5d1('0x31')](function(_0x4a6736){_0x24afba['contact']=_0x4a6736;var _0x5187c0=_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0xa2')];if(_0x5870b4['headers']['cf-connecting-ip']){_0x5187c0=_0x5870b4[_0xb5d1('0xa3')][_0xb5d1('0xa4')];}else if(_0x5870b4[_0xb5d1('0xa3')][_0xb5d1('0xa5')]){_0x5187c0=_[_0xb5d1('0xa6')](_0x5870b4[_0xb5d1('0xa3')][_0xb5d1('0xa5')]['split'](','));}if(_0x4a6736){var _0x5a3a7a={'ContactId':_0x4a6736['id'],'ChatWebsiteId':_0x5870b4[_0xb5d1('0x52')]['id'],'from':(_0x4a6736['firstName']||'')+'\x20'+(_0x4a6736[_0xb5d1('0xa7')]||''),'customerIp':_0x5187c0,'customerPort':_0x5870b4[_0xb5d1('0xa3')]['x-real-port']?_0x5870b4['headers']['x-real-port']:null,'referer':_0x5870b4[_0xb5d1('0x57')]['referer'],'browserName':_0x2e5f30[_0xb5d1('0xa8')][_0xb5d1('0x36')]&&_0x2e5f30[_0xb5d1('0xa8')]['version']?util[_0xb5d1('0xa9')](_0xb5d1('0xaa'),_0x2e5f30[_0xb5d1('0xa8')][_0xb5d1('0x36')],_0x2e5f30[_0xb5d1('0xa8')][_0xb5d1('0xab')]):_0xb5d1('0xac'),'browserVersion':_0x2e5f30['browser'][_0xb5d1('0xab')]||_0xb5d1('0xac'),'osName':util[_0xb5d1('0xa9')](_0xb5d1('0xaa'),_0x2e5f30['os'][_0xb5d1('0x36')],_0x2e5f30['os'][_0xb5d1('0xab')]),'osVersion':_0x2e5f30['os'][_0xb5d1('0xab')],'deviceModel':_0x2e5f30['device'][_0xb5d1('0x40')]&&_0x2e5f30[_0xb5d1('0xad')][_0xb5d1('0xae')]?util[_0xb5d1('0xa9')](_0xb5d1('0xaf'),_0x2e5f30['device'][_0xb5d1('0x40')],_0x2e5f30[_0xb5d1('0xad')][_0xb5d1('0xae')],_0x2e5f30[_0xb5d1('0xad')][_0xb5d1('0x3e')]):null,'deviceVendor':_0x2e5f30[_0xb5d1('0xad')][_0xb5d1('0xae')],'deviceType':_0x2e5f30['device'][_0xb5d1('0x3e')],'formData':JSON[_0xb5d1('0x21')](_0x5870b4[_0xb5d1('0x57')])};var _0x3af070={'ChatWebsiteId':_0x5870b4[_0xb5d1('0x52')]['id'],'closed':![]};if(_0x5870b4['body'][_0xb5d1('0xb0')]){_0x3af070[_0xb5d1('0xb0')]=_0x5870b4[_0xb5d1('0x57')]['threadId'];return db['ChatInteraction'][_0xb5d1('0x55')]({'where':_0x3af070})[_0xb5d1('0x31')](function(_0x567513){if(_0x567513){return[_0x567513,![]];}_0x5a3a7a[_0xb5d1('0xb0')]=_0x5870b4['body'][_0xb5d1('0xb0')];_0x5a3a7a[_0xb5d1('0xb1')]=_0x5870b4[_0xb5d1('0x57')]['externalUrl'];return db[_0xb5d1('0xb2')][_0xb5d1('0x56')](_0x5a3a7a)[_0xb5d1('0x31')](function(_0x28dce2){return[_0x28dce2,!![]];});});}_0x3af070[_0xb5d1('0xb3')]=_0x4a6736['id'];if(_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0xb4')]&&_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0xb4')]['id']){_0x3af070['id']=_0x5870b4[_0xb5d1('0x57')]['interaction']['id'];return db[_0xb5d1('0xb2')][_0xb5d1('0x55')]({'where':_0x3af070})[_0xb5d1('0x31')](function(_0x57f913){if(_0x57f913){return[_0x57f913,![]];}return db[_0xb5d1('0xb2')][_0xb5d1('0x56')](_0x5a3a7a)[_0xb5d1('0x31')](function(_0x2180ca){return[_0x2180ca,!![]];});});}return db[_0xb5d1('0xb2')][_0xb5d1('0x56')](_0x5a3a7a)[_0xb5d1('0x31')](function(_0x590bd5){return[_0x590bd5,!![]];});}})[_0xb5d1('0xb5')](function(_0x1c8658,_0x26fb32){if(_0x1c8658){_0x464daa=_0x26fb32;if(!_0x26fb32){var _0x3e6ba2={'from':(_0x24afba[_0xb5d1('0xb6')]['firstName']||'')+'\x20'+(_0x24afba[_0xb5d1('0xb6')][_0xb5d1('0xa7')]||'')};if(_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0xb0')]&&_0x5870b4[_0xb5d1('0x57')]['messageId']&&_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0xb0')]!=_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0xb7')]){_0x3e6ba2[_0xb5d1('0xb0')]=_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0xb7')];}return _0x1c8658[_0xb5d1('0x30')](_0x3e6ba2);}else{return _0x1c8658;}}})[_0xb5d1('0x31')](function(_0x46ccc5){_0x24afba['interaction']=_0x46ccc5['get']({'plain':!![]});_0x24afba[_0xb5d1('0xb4')][_0xb5d1('0xb8')]=_0x464daa;if(_0x24afba[_0xb5d1('0xb4')][_0xb5d1('0xb8')]){if(_0x24afba[_0xb5d1('0x9d')][_0xb5d1('0xb9')]){_0x24afba[_0xb5d1('0x9e')][_0xb5d1('0xba')]({'id':0x0,'priority':_0x24afba[_0xb5d1('0x9e')][_0xb5d1('0x46')]+0x1,'app':'close','appdata':_0xb5d1('0xbb'),'interval':'*,*,*,*'});}}return db[_0xb5d1('0xbc')][_0xb5d1('0x56')]({'body':_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0x57')],'ChatWebsiteId':_0x5870b4['params']['id'],'ChatInteractionId':_0x46ccc5['id'],'direction':'in','ContactId':_0x24afba[_0xb5d1('0xb6')]['id'],'AttachmentId':_0x5870b4[_0xb5d1('0x57')][_0xb5d1('0xbd')]});})[_0xb5d1('0x31')](function(_0x151eaf){_0x24afba[_0xb5d1('0x25')]=_0x151eaf;if(_0x24afba[_0xb5d1('0xb4')]['UserId']){return db[_0xb5d1('0xbe')][_0xb5d1('0x55')]({'attributes':['id',_0xb5d1('0x36')],'where':{'id':_0x24afba[_0xb5d1('0xb4')][_0xb5d1('0xbf')]}})[_0xb5d1('0x31')](function(_0x2137c2){if(_0x2137c2){_0x24afba[_0xb5d1('0x9e')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb5d1('0xc0'),'appdata':_0x2137c2[_0xb5d1('0x36')]+','+(_0x24afba[_0xb5d1('0x9d')][_0xb5d1('0xc1')]||0xa),'interval':'*,*,*,*'});_0x24afba[_0xb5d1('0xc2')]=!![];}return respondWithRpcPromise(_0xb5d1('0xc3'),'startRouting',_0x24afba);});}return respondWithRpcPromise(_0xb5d1('0xc3'),'startRouting',_0x24afba);})['then'](function(_0x473897){respondWithRpcPromise(_0xb5d1('0xc4'),_0xb5d1('0xc4'),{'event':_0xb5d1('0x85'),'message':_0x473897},client9002);return _0x473897;})[_0xb5d1('0x31')](respondWithResult(_0x4d3ee9,null))[_0xb5d1('0x50')](handleError(_0x4d3ee9,null));};exports[_0xb5d1('0xc5')]=function(_0x4064e4,_0x44fffd,_0x502eae){var _0x4887ea,_0x7760ed,_0x4c7bba;var _0xf9af7=[];var _0x3aa158=[];var _0x4fc295={};return db[_0xb5d1('0x8b')][_0xb5d1('0x5e')]()[_0xb5d1('0x31')](function(_0x4228c2){if(!_0x4228c2){throw new db[(_0xb5d1('0x8c'))][(_0xb5d1('0x8d'))](_0xb5d1('0x8e'));}_0x3aa158=_[_0xb5d1('0x8f')](_[_0xb5d1('0x53')](_0x4228c2),[_0xb5d1('0x90'),_0xb5d1('0x91')]);_0xf9af7=_[_0xb5d1('0x8f')](_[_0xb5d1('0x53')](_0x4228c2),[_0xb5d1('0x90'),_0xb5d1('0x91'),_0xb5d1('0xc6'),_0xb5d1('0x92')]);if(_0x4064e4[_0xb5d1('0x57')]['id']){delete _0x4064e4[_0xb5d1('0x57')]['id'];}if(_[_0xb5d1('0x7a')](_0x4064e4[_0xb5d1('0x57')][_0xb5d1('0x93')])){throw _0x44fffd['status'](0x1f4)['send'](new db[(_0xb5d1('0x8c'))][(_0xb5d1('0x8d'))](_0xb5d1('0x94')));}if(_[_0xb5d1('0x7a')](_0x4064e4[_0xb5d1('0x57')][_0xb5d1('0x57')])||_0x4064e4['body'][_0xb5d1('0x57')]===''){throw _0x44fffd[_0xb5d1('0x27')](0x1f4)[_0xb5d1('0x37')](new db[(_0xb5d1('0x8c'))][(_0xb5d1('0x8d'))](_0xb5d1('0xc7')));}if(_[_0xb5d1('0x7a')](_0x4064e4[_0xb5d1('0x57')][_0xb5d1('0xc8')])){throw _0x44fffd['status'](0x1f4)[_0xb5d1('0x37')](new db[(_0xb5d1('0x8c'))][(_0xb5d1('0x8d'))](_0xb5d1('0xc9')+_0xf9af7));}if(!_['includes'](_0xf9af7,_0x4064e4['body'][_0xb5d1('0xc8')])){throw _0x44fffd[_0xb5d1('0x27')](0x1f4)[_0xb5d1('0x37')](new db[(_0xb5d1('0x8c'))]['ValidationError'](_0xb5d1('0xca')+_0xf9af7));}_0x4fc295[_0x4064e4['body'][_0xb5d1('0xc8')]]=_0x4064e4[_0xb5d1('0x57')][_0xb5d1('0x93')];})[_0xb5d1('0x31')](function(){return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0x4064e4[_0xb5d1('0x52')]['id']},'include':[{'model':db[_0xb5d1('0xcb')],'as':_0xb5d1('0x98')}]});})[_0xb5d1('0x31')](handleEntityNotFound(_0x44fffd,null))[_0xb5d1('0x31')](function(_0x1bdf0f){if(_0x1bdf0f&&_0x1bdf0f[_0xb5d1('0x98')]){_0x7760ed=_0x1bdf0f;var _0x281d8d=_[_0xb5d1('0x18')](_0x4064e4[_0xb5d1('0x57')],{'firstName':_0x4064e4[_0xb5d1('0x57')][_0xb5d1('0x93')],'phone':_0x4064e4[_0xb5d1('0x57')]['from'],'ListId':_0x1bdf0f[_0xb5d1('0x92')]});_0x281d8d[_0x4064e4[_0xb5d1('0x57')][_0xb5d1('0xc8')]]=_0x4064e4[_0xb5d1('0x57')]['from'];return db[_0xb5d1('0x8b')][_0xb5d1('0xcc')]({'where':_0x4fc295,'defaults':_0x281d8d});}})[_0xb5d1('0xb5')](function(_0x4497c1){if(_0x4497c1){_0x4c7bba=_0x4497c1;var _0x2acecd=fs[_0xb5d1('0xcd')](path[_0xb5d1('0x7c')](config['root'],_0xb5d1('0xce')),'utf8');var _0x2e3e80=ejs[_0xb5d1('0xcf')](_0x2acecd,{'body':_['toPairs'](_0x4064e4[_0xb5d1('0x57')]['body']),'bodyTitle':_0x7760ed['offlineMessageBody']});return db[_0xb5d1('0xd0')][_0xb5d1('0x56')]({'body':_0x2e3e80,'ContactId':_0x4497c1['id'],'ChatWebsiteId':_0x7760ed['id']});}})['then'](function(_0x41f9f8){if(_0x41f9f8){_0x4887ea=_0x41f9f8;return db[_0xb5d1('0xd1')][_0xb5d1('0x61')]({'where':{'service':!![]},'include':[{'model':db[_0xb5d1('0xd2')],'as':_0xb5d1('0xd3'),'raw':!![]}]});}})[_0xb5d1('0x31')](function(_0x5ca92d){if(_0x5ca92d&&_0x5ca92d['Smtp']&&_0x7760ed['forwardOfflineAddress']){var _0x14e60b={'tls':{'rejectUnauthorized':![]}};if(_0x5ca92d[_0xb5d1('0xd3')][_0xb5d1('0xd4')]){_0x14e60b[_0xb5d1('0xd4')]=_0x5ca92d[_0xb5d1('0xd3')]['service'];}else{_0x14e60b[_0xb5d1('0xd5')]=_0x5ca92d[_0xb5d1('0xd3')][_0xb5d1('0xd5')];_0x14e60b[_0xb5d1('0xd6')]=_0x5ca92d[_0xb5d1('0xd3')][_0xb5d1('0xd6')];_0x14e60b['secure']=_0x5ca92d['Smtp'][_0xb5d1('0xd7')];}if(_0x5ca92d[_0xb5d1('0xd3')][_0xb5d1('0xd8')]){_0x14e60b[_0xb5d1('0xd9')]={'user':_0x5ca92d[_0xb5d1('0xd3')][_0xb5d1('0x58')],'pass':_0x5ca92d[_0xb5d1('0xd3')]['pass']};}return respondWithRpcPromise(_0xb5d1('0xda'),_0xb5d1('0xdb'),{'account':_0x14e60b,'message':{'from':util[_0xb5d1('0xa9')](_0xb5d1('0xdc'),_0x5ca92d['name'],_0x5ca92d['email']||_0x5ca92d['Smtp'][_0xb5d1('0x58')]),'to':_0x7760ed[_0xb5d1('0xdd')],'subject':_0x7760ed[_0xb5d1('0xde')],'text':_0x4887ea[_0xb5d1('0x57')]}},client9003)[_0xb5d1('0x31')](function(){return _0x4887ea;})[_0xb5d1('0x50')](function(_0x26bbbc){console[_0xb5d1('0x22')](_0x26bbbc);});}})[_0xb5d1('0x31')](function(){if(_0x4887ea){return _0x4887ea;}})[_0xb5d1('0x31')](respondWithResult(_0x44fffd,null))[_0xb5d1('0x50')](handleError(_0x44fffd,null));};exports[_0xb5d1('0xdf')]=function(_0x121958,_0x5a3b3b,_0x51e1ec){return db[_0xb5d1('0xb2')][_0xb5d1('0x55')]({'where':{'id':_0x121958[_0xb5d1('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a3b3b,null))['then'](function(_0x2b08c0){if(_0x2b08c0){return _0x2b08c0[_0xb5d1('0xdf')](_0x121958[_0xb5d1('0x57')]['ids'],_['omit'](_0x121958['body'],[_0xb5d1('0xe0'),'id'])||{});}})['then'](respondWithResult(_0x5a3b3b,null))[_0xb5d1('0x50')](handleError(_0x5a3b3b,null));};exports['getInteractions']=function(_0x43d0eb,_0x396d24,_0x12bdd8){var _0x1e7693={'raw':![],'where':{}};var _0x1f0bcb={};var _0x1471db={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x43d0eb[_0xb5d1('0x52')]['id']}})['then'](handleEntityNotFound(_0x396d24,null))[_0xb5d1('0x31')](function(_0x54a041){if(_0x54a041){_0x1f0bcb[_0xb5d1('0x40')]=_['keys'](db['ChatInteraction'][_0xb5d1('0x63')]);_0x1f0bcb[_0xb5d1('0x41')]=_['keys'](_0x43d0eb[_0xb5d1('0x41')]);_0x1f0bcb[_0xb5d1('0x42')]=_['intersection'](_0x1f0bcb[_0xb5d1('0x40')],_0x1f0bcb[_0xb5d1('0x41')]);_0x1e7693[_0xb5d1('0x44')]=_[_0xb5d1('0x43')](_0x1f0bcb[_0xb5d1('0x40')],qs[_0xb5d1('0x45')](_0x43d0eb[_0xb5d1('0x41')][_0xb5d1('0x45')]));_0x1e7693[_0xb5d1('0x44')]=_0x1e7693[_0xb5d1('0x44')][_0xb5d1('0x46')]?_0x1e7693[_0xb5d1('0x44')]:_0x1f0bcb[_0xb5d1('0x40')];if(!_0x43d0eb[_0xb5d1('0x41')][_0xb5d1('0x64')]('nolimit')){_0x1e7693['limit']=qs[_0xb5d1('0x2c')](_0x43d0eb['query']['limit']);_0x1e7693[_0xb5d1('0x2b')]=qs[_0xb5d1('0x2b')](_0x43d0eb[_0xb5d1('0x41')][_0xb5d1('0x2b')]);}_0x1e7693[_0xb5d1('0x48')]=qs[_0xb5d1('0x49')](_0x43d0eb[_0xb5d1('0x41')][_0xb5d1('0x49')]);_0x1e7693[_0xb5d1('0x4b')]=qs[_0xb5d1('0x42')](_[_0xb5d1('0x65')](_0x43d0eb[_0xb5d1('0x41')],_0x1f0bcb[_0xb5d1('0x42')]));_0x1e7693[_0xb5d1('0x4b')][_0xb5d1('0x5f')]=_0x54a041['id'];if(_0x43d0eb[_0xb5d1('0x41')][_0xb5d1('0x4a')]){_0x1e7693[_0xb5d1('0x4b')]=_[_0xb5d1('0x66')](_0x1e7693[_0xb5d1('0x4b')],{'$or':_[_0xb5d1('0x3b')](_0x1e7693['attributes'],function(_0x203bc8){var _0x3653c5={};_0x3653c5[_0x203bc8]={'$like':'%'+_0x43d0eb[_0xb5d1('0x41')][_0xb5d1('0x4a')]+'%'};return _0x3653c5;})});}_0x1e7693=_['merge']({},_0x1e7693,_0x43d0eb[_0xb5d1('0x4c')]);return db['ChatInteraction'][_0xb5d1('0x2a')]({'where':_0x1e7693[_0xb5d1('0x4b')]})[_0xb5d1('0x31')](function(_0x1fee13){_0x1471db[_0xb5d1('0x2a')]=_0x1fee13;if(_0x43d0eb[_0xb5d1('0x41')][_0xb5d1('0x4d')]){_0x1e7693['include']=[{'model':db[_0xb5d1('0x8b')],'as':_0xb5d1('0xe1'),'required':![]},{'model':db[_0xb5d1('0xbe')],'as':_0xb5d1('0xe2'),'attributes':[_0xb5d1('0x36'),_0xb5d1('0xe3'),_0xb5d1('0xe4')],'required':![]},{'model':db[_0xb5d1('0xe5')],'as':'Tags','attributes':['id','name',_0xb5d1('0xe6')],'where':_0x43d0eb[_0xb5d1('0x41')][_0xb5d1('0xe7')]?{'id':_0x43d0eb[_0xb5d1('0x41')][_0xb5d1('0xe7')]}:undefined,'required':_0x43d0eb['query'][_0xb5d1('0xe7')]?!![]:![]}];}return db['ChatInteraction'][_0xb5d1('0x4e')](_0x1e7693);})['then'](function(_0x3c3f6b){_0x1471db[_0xb5d1('0x4f')]=_0x3c3f6b;return _0x1471db;});}})[_0xb5d1('0x31')](respondWithFilteredResult(_0x396d24,_0x1e7693))[_0xb5d1('0x50')](handleError(_0x396d24,null));};function iftimePromise(_0x416e47,_0xe1844a){return respondWithRpcPromise('Command','getSnippet',{'command':_0xe1844a[_0xb5d1('0xe8')]?util[_0xb5d1('0xa9')](_0xb5d1('0xe9'),_0x416e47[_0xb5d1('0xea')],_0xe1844a[_0xb5d1('0xe8')]):util['format'](_0xb5d1('0xeb'),_0x416e47[_0xb5d1('0xea')])},client9002)['then'](function(_0x211e91){var _0x2f3f48=_0x211e91&&_0x211e91[_0xb5d1('0xec')]('true')>=0x0?!![]:![];logger['info'](_0xb5d1('0xed'),_0xe1844a['id'],_0x416e47['id'],_0x416e47[_0xb5d1('0xea')],_0x2f3f48?_0xb5d1('0xee'):_0xb5d1('0xef'),_0xe1844a['timezone']?_0xe1844a[_0xb5d1('0xe8')]:_0xb5d1('0xf0'));return _0x2f3f48;})[_0xb5d1('0x50')](function(_0x427acf){logger['error']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xe1844a['id'],_0x416e47['id'],_0x416e47[_0xb5d1('0xea')],util[_0xb5d1('0xf1')](_0x427acf,{'showHidden':![],'depth':null}),_0xe1844a[_0xb5d1('0xe8')]?_0xe1844a['timezone']:_0xb5d1('0xf0'));return![];});}exports[_0xb5d1('0xf2')]=function(_0x249a51,_0x1d909c,_0x595ce5){var _0xd224bb=0x0;var _0x1f67e9=0x0;var _0x4d17c2=![];var _0x25ed1f;var _0x318f02;return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0x249a51[_0xb5d1('0x52')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0xb5d1('0xf3')],'as':_0xb5d1('0xf4'),'attributes':['id',_0xb5d1('0xea')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x1d909c,null))[_0xb5d1('0x31')](function(_0x48260f){if(_0x48260f){_0x25ed1f=_0x48260f;return _0x48260f[_0xb5d1('0xf5')]({'raw':!![]});}})[_0xb5d1('0x31')](function(_0xa06a88){if(_0x25ed1f){if(_0xa06a88){_0x318f02=_0xa06a88;}}return require(_0xb5d1('0x78'))[_0xb5d1('0x79')]();})[_0xb5d1('0x31')](function(_0x5afb26){if(_0x5afb26){_0x1f67e9=_0x5afb26[_0xb5d1('0xf6')];_0x4d17c2=_0x5afb26[_0xb5d1('0xf7')];}})[_0xb5d1('0x31')](function(){return db[_0xb5d1('0xb2')][_0xb5d1('0x2a')]({'where':{'closed':![]}});})[_0xb5d1('0x31')](function(_0x23afe5){_0xd224bb=_0x23afe5;if(_0x1f67e9&&_0x23afe5>_0x1f67e9){return db['License'][_0xb5d1('0x61')]({'where':{'id':0x1}})['then'](function(_0x317feb){if(_0x317feb){_0x317feb[_0xb5d1('0xf8')](_0xb5d1('0xf9'));}});}})[_0xb5d1('0x31')](function(){if(_0x25ed1f[_0xb5d1('0xf3')]&&_0x25ed1f[_0xb5d1('0xf3')][_0xb5d1('0xf4')]){var _0x674a7d=[];for(var _0x4794f3=0x0;_0x4794f3<_0x25ed1f['Interval'][_0xb5d1('0xf4')][_0xb5d1('0x46')];_0x4794f3++){var _0x34cefa=_0x25ed1f[_0xb5d1('0xf3')][_0xb5d1('0xf4')][_0x4794f3]['get']({'plain':!![]});_0x674a7d[_0xb5d1('0xba')](iftimePromise(_0x34cefa,_0x25ed1f));}return BPromise[_0xb5d1('0xfa')](_0x674a7d)[_0xb5d1('0x31')](function(_0x401c21){return _[_0xb5d1('0xfb')](_0x401c21);});}else{return!![];}})[_0xb5d1('0x31')](function(_0x46733a){var _0x4ec414=fs[_0xb5d1('0xcd')](path[_0xb5d1('0x7c')](config['root'],_0xb5d1('0xfc')),_0xb5d1('0xfd'));var _0xed5ec9={'remote':_0x25ed1f[_0xb5d1('0xfe')],'query':querystring[_0xb5d1('0x21')](_['merge'](_0x25ed1f[_0xb5d1('0x59')]({'plain':!![]}),{'customerIp':_0x249a51[_0xb5d1('0xa3')][_0xb5d1('0xa5')]||_0x249a51[_0xb5d1('0xa3')][_0xb5d1('0xff')]||_0x249a51[_0xb5d1('0x100')]['remoteAddress']||_0x249a51['ip'],'referer':_0x249a51[_0xb5d1('0xa3')][_0xb5d1('0x101')],'openedInteractions':_0xd224bb,'maxInteractions':_0x1f67e9,'virtual':_0x4d17c2[_0xb5d1('0xf6')],'online':_0x46733a,'custom':_0x4d17c2}))['replace'](/'/g,'\x5c\x27')};_0x1d909c[_0xb5d1('0x37')](ejs[_0xb5d1('0xcf')](Mustache['render'](_0x4ec414,_0xed5ec9),{'proactiveActions':_0x318f02,'alignment':_0x25ed1f[_0xb5d1('0x102')],'verticalAlignment':_0x25ed1f[_0xb5d1('0x103')],'div_color':_0x25ed1f[_0xb5d1('0xe6')],'text_color':_0x25ed1f[_0xb5d1('0x104')]}));})['catch'](handleError(_0x1d909c,null));};exports['addApplications']=function(_0x6547f4,_0x32e6c6,_0x469a7d){return db[_0xb5d1('0x3c')][_0xb5d1('0x61')]({'where':{'id':_0x6547f4[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x32e6c6,null))[_0xb5d1('0x31')](function(_0x16a5ba){if(_0x16a5ba){return db['sequelize'][_0xb5d1('0x105')](function(_0x34f46a){return db[_0xb5d1('0x9b')][_0xb5d1('0x32')]({'where':{'ChatWebsiteId':_0x6547f4['params']['id']},'transaction':_0x34f46a})['then'](function(_0x43988a){var _0xd886f0=_[_0xb5d1('0x3b')](_0x6547f4[_0xb5d1('0x57')],function(_0x41d26f){_0x41d26f[_0xb5d1('0x5f')]=_0x6547f4[_0xb5d1('0x52')]['id'];return _0x41d26f;});return db[_0xb5d1('0x9b')][_0xb5d1('0x106')](_0xd886f0,{'transaction':_0x34f46a});});})[_0xb5d1('0x31')](function(){return db[_0xb5d1('0x9b')][_0xb5d1('0x107')]({'where':{'ChatWebsiteId':_0x6547f4[_0xb5d1('0x52')]['id']},'order':'priority'});});}})[_0xb5d1('0x31')](respondWithResult(_0x32e6c6,null))[_0xb5d1('0x50')](handleError(_0x32e6c6,null));};exports[_0xb5d1('0x108')]=function(_0x333de6,_0x222661,_0x553a74){var _0x1d3433={};var _0x4315de={};var _0x146642;var _0xd8d952;return db['ChatWebsite'][_0xb5d1('0x61')]({'where':{'id':_0x333de6['params']['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x222661,null))['then'](function(_0x362582){if(_0x362582){_0x146642=_0x362582;_0x4315de[_0xb5d1('0x40')]=_[_0xb5d1('0x53')](db[_0xb5d1('0x9b')]['rawAttributes']);_0x4315de['query']=_[_0xb5d1('0x53')](_0x333de6[_0xb5d1('0x41')]);_0x4315de['filters']=_[_0xb5d1('0x43')](_0x4315de[_0xb5d1('0x40')],_0x4315de[_0xb5d1('0x41')]);_0x1d3433[_0xb5d1('0x44')]=_['intersection'](_0x4315de[_0xb5d1('0x40')],qs['fields'](_0x333de6[_0xb5d1('0x41')]['fields']));_0x1d3433[_0xb5d1('0x44')]=_0x1d3433['attributes'][_0xb5d1('0x46')]?_0x1d3433['attributes']:_0x4315de['model'];_0x1d3433[_0xb5d1('0x48')]=qs['sort'](_0x333de6[_0xb5d1('0x41')]['sort']);_0x1d3433[_0xb5d1('0x4b')]=qs[_0xb5d1('0x42')](_[_0xb5d1('0x65')](_0x333de6['query'],_0x4315de[_0xb5d1('0x42')]));if(_0x333de6['query']['filter']){_0x1d3433[_0xb5d1('0x4b')]=_[_0xb5d1('0x66')](_0x1d3433[_0xb5d1('0x4b')],{'$or':_[_0xb5d1('0x3b')](_0x1d3433[_0xb5d1('0x44')],function(_0x211449){var _0x85ddce={};_0x85ddce[_0x211449]={'$like':'%'+_0x333de6[_0xb5d1('0x41')][_0xb5d1('0x4a')]+'%'};return _0x85ddce;})});}_0x1d3433=_[_0xb5d1('0x66')]({},_0x1d3433,_0x333de6[_0xb5d1('0x4c')]);return _0x146642[_0xb5d1('0x108')](_0x1d3433);}})[_0xb5d1('0x31')](function(_0x56762c){if(_0x56762c){_0xd8d952=_0x56762c[_0xb5d1('0x46')];if(!_0x333de6[_0xb5d1('0x41')][_0xb5d1('0x64')](_0xb5d1('0x47'))){_0x1d3433[_0xb5d1('0x2c')]=qs[_0xb5d1('0x2c')](_0x333de6[_0xb5d1('0x41')][_0xb5d1('0x2c')]);_0x1d3433[_0xb5d1('0x2b')]=qs[_0xb5d1('0x2b')](_0x333de6[_0xb5d1('0x41')][_0xb5d1('0x2b')]);}return _0x146642[_0xb5d1('0x108')](_0x1d3433);}})[_0xb5d1('0x31')](function(_0x106d49){if(_0x106d49){return _0x106d49?{'count':_0xd8d952,'rows':_0x106d49}:null;}})['then'](respondWithResult(_0x222661,null))[_0xb5d1('0x50')](handleError(_0x222661,null));};exports['addProactiveActions']=function(_0x5c261b,_0x307096,_0x3f271d){return db[_0xb5d1('0x109')][_0xb5d1('0x55')]({'where':{'id':_0x5c261b[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x307096,null))['then'](function(_0x242406){if(_0x242406){return _0x242406['addProactiveActions'](_0x5c261b[_0xb5d1('0x57')][_0xb5d1('0xe0')],_[_0xb5d1('0x10a')](_0x5c261b[_0xb5d1('0x57')],[_0xb5d1('0xe0'),'id'])||{});}})[_0xb5d1('0x31')](respondWithResult(_0x307096,null))['catch'](handleError(_0x307096,null));};exports[_0xb5d1('0xf5')]=function(_0x20689e,_0x11fdba,_0x4ce89a){var _0x2b44d1={};var _0x56ee1a={};var _0x2de698;var _0x4c5bf6;return db[_0xb5d1('0x3c')][_0xb5d1('0x61')]({'where':{'id':_0x20689e[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x11fdba,null))[_0xb5d1('0x31')](function(_0x45250c){if(_0x45250c){_0x2de698=_0x45250c;_0x56ee1a[_0xb5d1('0x40')]=_[_0xb5d1('0x53')](db[_0xb5d1('0x10b')][_0xb5d1('0x63')]);_0x56ee1a[_0xb5d1('0x41')]=_[_0xb5d1('0x53')](_0x20689e[_0xb5d1('0x41')]);_0x56ee1a[_0xb5d1('0x42')]=_[_0xb5d1('0x43')](_0x56ee1a[_0xb5d1('0x40')],_0x56ee1a['query']);_0x2b44d1[_0xb5d1('0x44')]=_[_0xb5d1('0x43')](_0x56ee1a[_0xb5d1('0x40')],qs[_0xb5d1('0x45')](_0x20689e[_0xb5d1('0x41')]['fields']));_0x2b44d1['attributes']=_0x2b44d1[_0xb5d1('0x44')][_0xb5d1('0x46')]?_0x2b44d1[_0xb5d1('0x44')]:_0x56ee1a[_0xb5d1('0x40')];_0x2b44d1[_0xb5d1('0x48')]=qs['sort'](_0x20689e[_0xb5d1('0x41')][_0xb5d1('0x49')]);_0x2b44d1[_0xb5d1('0x4b')]=qs[_0xb5d1('0x42')](_[_0xb5d1('0x65')](_0x20689e[_0xb5d1('0x41')],_0x56ee1a[_0xb5d1('0x42')]));if(_0x20689e[_0xb5d1('0x41')][_0xb5d1('0x4a')]){_0x2b44d1[_0xb5d1('0x4b')]=_['merge'](_0x2b44d1['where'],{'$or':_[_0xb5d1('0x3b')](_0x2b44d1['attributes'],function(_0x23f2a4){var _0x19be5b={};_0x19be5b[_0x23f2a4]={'$like':'%'+_0x20689e['query'][_0xb5d1('0x4a')]+'%'};return _0x19be5b;})});}_0x2b44d1=_[_0xb5d1('0x66')]({},_0x2b44d1,_0x20689e[_0xb5d1('0x4c')]);return _0x2de698['getProactiveActions'](_0x2b44d1);}})[_0xb5d1('0x31')](function(_0x32bfbe){if(_0x32bfbe){_0x4c5bf6=_0x32bfbe['length'];if(!_0x20689e[_0xb5d1('0x41')][_0xb5d1('0x64')](_0xb5d1('0x47'))){_0x2b44d1['limit']=qs[_0xb5d1('0x2c')](_0x20689e[_0xb5d1('0x41')][_0xb5d1('0x2c')]);_0x2b44d1[_0xb5d1('0x2b')]=qs[_0xb5d1('0x2b')](_0x20689e['query']['offset']);}return _0x2de698[_0xb5d1('0xf5')](_0x2b44d1);}})[_0xb5d1('0x31')](function(_0x26ea1c){if(_0x26ea1c){return _0x26ea1c?{'count':_0x4c5bf6,'rows':_0x26ea1c}:null;}})[_0xb5d1('0x31')](respondWithResult(_0x11fdba,null))[_0xb5d1('0x50')](handleError(_0x11fdba,null));};exports['getFields']=function(_0x1315e2,_0x3761cc,_0x2ddda4){var _0x59806d=_0x1315e2[_0xb5d1('0x41')][_0xb5d1('0x10c')]==='false'?_0xb5d1('0x10d'):_0xb5d1('0x10e');return db[_0xb5d1('0x3c')]['find']({'attributes':['id',_0x59806d],'where':{'id':_0x1315e2[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x3761cc,null))[_0xb5d1('0x31')](function(_0x2e4df0){if(_0x2e4df0){var _0x3a76e7=_0x2e4df0[_0x59806d];var _0x50f769=_0x3a76e7&&_0x3a76e7['items']?_0x3a76e7[_0xb5d1('0x10f')]:[];_0x3761cc['send']({'fromKey':_[_0xb5d1('0x7a')](_0x3a76e7[_0xb5d1('0x110')])?undefined:_0x3a76e7['fromKey'],'count':_0x50f769[_0xb5d1('0x46')],'rows':_0x50f769});}})[_0xb5d1('0x50')](handleError(_0x3761cc,null));};exports[_0xb5d1('0x111')]=function(_0xcbaf02,_0x210654,_0x3306eb){var _0x37d91d={'raw':![],'where':{}};var _0xe2e775={};var _0x42719a={'count':0x0,'rows':[]};return db[_0xb5d1('0x3c')][_0xb5d1('0x61')]({'where':{'id':_0xcbaf02[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x210654,null))[_0xb5d1('0x31')](function(_0x406ca0){if(_0x406ca0){_0xe2e775['model']=_[_0xb5d1('0x53')](db[_0xb5d1('0xd0')][_0xb5d1('0x63')]);_0xe2e775[_0xb5d1('0x41')]=_[_0xb5d1('0x53')](_0xcbaf02[_0xb5d1('0x41')]);_0xe2e775['filters']=_['intersection'](_0xe2e775['model'],_0xe2e775[_0xb5d1('0x41')]);_0x37d91d[_0xb5d1('0x44')]=_[_0xb5d1('0x43')](_0xe2e775[_0xb5d1('0x40')],qs[_0xb5d1('0x45')](_0xcbaf02['query'][_0xb5d1('0x45')]));_0x37d91d[_0xb5d1('0x44')]=_0x37d91d[_0xb5d1('0x44')][_0xb5d1('0x46')]?_0x37d91d[_0xb5d1('0x44')]:_0xe2e775['model'];if(!_0xcbaf02['query'][_0xb5d1('0x64')](_0xb5d1('0x47'))){_0x37d91d[_0xb5d1('0x2c')]=qs['limit'](_0xcbaf02[_0xb5d1('0x41')]['limit']);_0x37d91d[_0xb5d1('0x2b')]=qs[_0xb5d1('0x2b')](_0xcbaf02['query'][_0xb5d1('0x2b')]);}_0x37d91d[_0xb5d1('0x48')]=qs[_0xb5d1('0x49')](_0xcbaf02[_0xb5d1('0x41')][_0xb5d1('0x49')]);_0x37d91d[_0xb5d1('0x4b')]=qs[_0xb5d1('0x42')](_['pick'](_0xcbaf02[_0xb5d1('0x41')],_0xe2e775[_0xb5d1('0x42')]));_0x37d91d[_0xb5d1('0x4b')][_0xb5d1('0x5f')]=_0x406ca0['id'];if(_0xcbaf02[_0xb5d1('0x41')][_0xb5d1('0x4a')]){_0x37d91d[_0xb5d1('0x4b')]=_[_0xb5d1('0x66')](_0x37d91d[_0xb5d1('0x4b')],{'$or':_['map'](_0x37d91d[_0xb5d1('0x44')],function(_0x1002e4){var _0x3ac23b={};_0x3ac23b[_0x1002e4]={'$like':'%'+_0xcbaf02[_0xb5d1('0x41')]['filter']+'%'};return _0x3ac23b;})});}_0x37d91d=_[_0xb5d1('0x66')]({},_0x37d91d,_0xcbaf02[_0xb5d1('0x4c')]);return db['ChatOfflineMessage'][_0xb5d1('0x2a')]({'where':_0x37d91d['where']})[_0xb5d1('0x31')](function(_0x1cecd4){_0x42719a[_0xb5d1('0x2a')]=_0x1cecd4;if(_0xcbaf02[_0xb5d1('0x41')][_0xb5d1('0x4d')]){_0x37d91d[_0xb5d1('0x54')]=[{'all':!![]}];}else{_0x37d91d[_0xb5d1('0x54')]=[{'model':db[_0xb5d1('0x8b')],'as':_0xb5d1('0xe1'),'required':![]}];}return db['ChatOfflineMessage'][_0xb5d1('0x4e')](_0x37d91d);})[_0xb5d1('0x31')](function(_0x348a24){_0x42719a['rows']=_0x348a24;return _0x42719a;});}})[_0xb5d1('0x31')](respondWithFilteredResult(_0x210654,_0x37d91d))[_0xb5d1('0x50')](handleError(_0x210654,null));};exports[_0xb5d1('0x112')]=function(_0x5480ef,_0x3347ec,_0x309c48){return db['ChatWebsite']['find']({'where':{'id':_0x5480ef[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x3347ec,null))[_0xb5d1('0x31')](function(_0x5c508b){if(_0x5c508b){return _0x5c508b[_0xb5d1('0x112')](_0x5480ef[_0xb5d1('0x57')]['ids'],_[_0xb5d1('0x10a')](_0x5480ef[_0xb5d1('0x57')],[_0xb5d1('0xe0'),'id'])||{})[_0xb5d1('0xb5')](function(_0x49f8a4){for(var _0x5dc153=0x0;_0x5dc153<_0x5480ef['body'][_0xb5d1('0xe0')][_0xb5d1('0x46')];_0x5dc153+=0x1){socket[_0xb5d1('0x113')](_0xb5d1('0x114'),{'UserId':_0x5480ef[_0xb5d1('0x57')]['ids'][_0x5dc153],'ChatWebsiteId':_0x5480ef[_0xb5d1('0x52')]['id']});}return _0x49f8a4;});}})[_0xb5d1('0x31')](respondWithResult(_0x3347ec,null))[_0xb5d1('0x50')](handleError(_0x3347ec,null));};exports[_0xb5d1('0x115')]=function(_0x3bd029,_0x4b6511,_0xb7d71){return db[_0xb5d1('0x3c')][_0xb5d1('0x55')]({'where':{'id':_0x3bd029[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x4b6511,null))['then'](function(_0x349e04){if(_0x349e04){return _0x349e04['removeAgents'](_0x3bd029[_0xb5d1('0x41')][_0xb5d1('0xe0')])[_0xb5d1('0x31')](function(){if(_[_0xb5d1('0x116')](_0x3bd029[_0xb5d1('0x41')][_0xb5d1('0xe0')])){for(var _0x196b69=0x0;_0x196b69<_0x3bd029['query'][_0xb5d1('0xe0')][_0xb5d1('0x46')];_0x196b69+=0x1){socket[_0xb5d1('0x113')](_0xb5d1('0x117'),{'UserId':Number(_0x3bd029[_0xb5d1('0x41')]['ids'][_0x196b69]),'ChatWebsiteId':Number(_0x3bd029[_0xb5d1('0x52')]['id'])});}}else{socket[_0xb5d1('0x113')]('userChatWebsite:remove',{'UserId':Number(_0x3bd029[_0xb5d1('0x41')][_0xb5d1('0xe0')]),'ChatWebsiteId':Number(_0x3bd029['params']['id'])});}});}})[_0xb5d1('0x31')](respondWithStatusCode(_0x4b6511,null))[_0xb5d1('0x50')](handleError(_0x4b6511,null));};exports[_0xb5d1('0x118')]=function(_0x27b224,_0x3048ba,_0x207dce){var _0x588173={};var _0x17fe61={};var _0x18abe6;var _0x5116fc;return db[_0xb5d1('0x3c')][_0xb5d1('0x61')]({'where':{'id':_0x27b224[_0xb5d1('0x52')]['id']}})[_0xb5d1('0x31')](handleEntityNotFound(_0x3048ba,null))[_0xb5d1('0x31')](function(_0x4f3e25){if(_0x4f3e25){_0x18abe6=_0x4f3e25;_0x17fe61[_0xb5d1('0x40')]=_[_0xb5d1('0x53')](db[_0xb5d1('0xbe')][_0xb5d1('0x63')]);_0x17fe61['query']=_['keys'](_0x27b224[_0xb5d1('0x41')]);_0x17fe61['filters']=_[_0xb5d1('0x43')](_0x17fe61['model'],_0x17fe61[_0xb5d1('0x41')]);_0x588173['attributes']=_[_0xb5d1('0x43')](_0x17fe61[_0xb5d1('0x40')],qs[_0xb5d1('0x45')](_0x27b224[_0xb5d1('0x41')][_0xb5d1('0x45')]));_0x588173[_0xb5d1('0x44')]=_0x588173[_0xb5d1('0x44')][_0xb5d1('0x46')]?_0x588173[_0xb5d1('0x44')]:_0x17fe61['model'];_0x588173[_0xb5d1('0x48')]=qs['sort'](_0x27b224['query'][_0xb5d1('0x49')]);_0x588173[_0xb5d1('0x4b')]=qs[_0xb5d1('0x42')](_[_0xb5d1('0x65')](_0x27b224['query'],_0x17fe61[_0xb5d1('0x42')]));if(_0x27b224['query'][_0xb5d1('0x4a')]){_0x588173['where']=_[_0xb5d1('0x66')](_0x588173[_0xb5d1('0x4b')],{'$or':_[_0xb5d1('0x3b')](_0x588173[_0xb5d1('0x44')],function(_0x329172){var _0x4a0115={};_0x4a0115[_0x329172]={'$like':'%'+_0x27b224['query'][_0xb5d1('0x4a')]+'%'};return _0x4a0115;})});}_0x588173=_[_0xb5d1('0x66')]({},_0x588173,_0x27b224[_0xb5d1('0x4c')]);return _0x18abe6[_0xb5d1('0x118')](_0x588173);}})['then'](function(_0x4fea11){if(_0x4fea11){_0x5116fc=_0x4fea11[_0xb5d1('0x46')];if(!_0x27b224['query']['hasOwnProperty']('nolimit')){_0x588173[_0xb5d1('0x2c')]=qs['limit'](_0x27b224[_0xb5d1('0x41')][_0xb5d1('0x2c')]);_0x588173['offset']=qs['offset'](_0x27b224[_0xb5d1('0x41')][_0xb5d1('0x2b')]);}return _0x18abe6[_0xb5d1('0x118')](_0x588173);}})['then'](function(_0x590407){if(_0x590407){return _0x590407?{'count':_0x5116fc,'rows':_0x590407}:null;}})['then'](respondWithResult(_0x3048ba,null))[_0xb5d1('0x50')](handleError(_0x3048ba,null));}; \ No newline at end of file +var _0x7791=['messageId','autoclose','close','unmanaged','*,*,*,*','ChatMessage','UserId','unshift','agent','forcedOwnership','Start','startRouting','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','authentication','auth','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','User','fullname','internal','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','License','increment','chatLicenseExceeded','Intervals','push','some','readFileSync','server/files/chat/iframe.js','remote','connection','remoteAddress','referer','virtual','replace','alignment','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','get','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','params','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','findAll','addAnswer','CannedAnswer','pick','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','download','agentAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','ChatApplication','Applications','applications','list','asc','account','Contacts','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','firstName','x-real-port','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','contact','lastName'];(function(_0x14b195,_0x460868){var _0x42f003=function(_0x266e88){while(--_0x266e88){_0x14b195['push'](_0x14b195['shift']());}};_0x42f003(++_0x460868);}(_0x7791,0x17c));var _0x1779=function(_0x331958,_0x383b87){_0x331958=_0x331958-0x0;var _0x4d6768=_0x7791[_0x331958];return _0x4d6768;};'use strict';var pdf=require(_0x1779('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1779('0x1'));var zipdir=require(_0x1779('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1779('0x3'));var moment=require(_0x1779('0x4'));var BPromise=require(_0x1779('0x5'));var Mustache=require(_0x1779('0x6'));var util=require(_0x1779('0x7'));var path=require(_0x1779('0x8'));var sox=require(_0x1779('0x9'));var csv=require(_0x1779('0xa'));var ejs=require(_0x1779('0xb'));var fs=require('fs');var _=require(_0x1779('0xc'));var squel=require(_0x1779('0xd'));var crypto=require('crypto');var jsforce=require(_0x1779('0xe'));var deskjs=require(_0x1779('0xf'));var toCsv=require(_0x1779('0xa'));var querystring=require(_0x1779('0x10'));var Papa=require(_0x1779('0x11'));var Redis=require(_0x1779('0x12'));var authService=require(_0x1779('0x13'));var qs=require(_0x1779('0x14'));var as=require(_0x1779('0x15'));var hardwareService=require(_0x1779('0x16'));var logger=require(_0x1779('0x17'))(_0x1779('0x18'));var utils=require(_0x1779('0x19'));var config=require(_0x1779('0x1a'));var licenseUtil=require(_0x1779('0x1b'));var db=require(_0x1779('0x1c'))['db'];config['redis']=_[_0x1779('0x1d')](config[_0x1779('0x1e')],{'host':_0x1779('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1779('0x1e')]));require(_0x1779('0x20'))['register'](socket);var jayson=require(_0x1779('0x21'));var client=jayson[_0x1779('0x22')][_0x1779('0x23')]({'port':0x232c});var client9002=jayson[_0x1779('0x22')][_0x1779('0x23')]({'port':0x232a});var client9003=jayson[_0x1779('0x22')][_0x1779('0x23')]({'port':0x232b});function respondWithRpcPromise(_0x52195d,_0x17a2e5,_0x300f69,_0x29aa39){return new BPromise(function(_0x198b64,_0x5dd983){var _0x33ab85=_0x29aa39||client;return _0x33ab85[_0x1779('0x24')](_0x52195d,_0x300f69)[_0x1779('0x25')](function(_0x546845){logger[_0x1779('0x26')](_0x1779('0x27'),_0x17a2e5,'request\x20sent');logger[_0x1779('0x28')](_0x1779('0x29'),_0x17a2e5,_0x1779('0x2a'),JSON[_0x1779('0x2b')](_0x546845));if(_0x546845[_0x1779('0x2c')]){if(_0x546845[_0x1779('0x2c')]['code']===0x1f4){logger[_0x1779('0x2c')](_0x1779('0x27'),_0x17a2e5,_0x546845[_0x1779('0x2c')][_0x1779('0x2d')]);return _0x5dd983(_0x546845[_0x1779('0x2c')]['message']);}logger[_0x1779('0x2c')](_0x1779('0x27'),_0x17a2e5,_0x546845['error']['message']);return _0x198b64(_0x546845[_0x1779('0x2c')][_0x1779('0x2d')]);}else{logger[_0x1779('0x26')](_0x1779('0x27'),_0x17a2e5,_0x1779('0x2a'));_0x198b64(_0x546845['result'][_0x1779('0x2d')]);}})[_0x1779('0x2e')](function(_0x3d2975){logger[_0x1779('0x2c')]('ChatWebsite,\x20%s,\x20%s',_0x17a2e5,_0x3d2975);_0x5dd983(_0x3d2975);});});}function respondWithStatusCode(_0x234d5f,_0x327af8){_0x327af8=_0x327af8||0xcc;return function(_0x2a1b89){if(_0x2a1b89){return _0x234d5f[_0x1779('0x2f')](_0x327af8);}return _0x234d5f['status'](_0x327af8)[_0x1779('0x30')]();};}function respondWithResult(_0x3e0e4e,_0x128929){_0x128929=_0x128929||0xc8;return function(_0x12e25a){if(_0x12e25a){return _0x3e0e4e[_0x1779('0x31')](_0x128929)[_0x1779('0x32')](_0x12e25a);}};}function respondWithFilteredResult(_0x39c107,_0x7e2f96){return function(_0x419bfa){if(_0x419bfa){var _0xe116=_0x419bfa[_0x1779('0x33')],_0x1d7d7c=_0x7e2f96[_0x1779('0x34')],_0x4ad5ec=_0x7e2f96['offset']+_0x7e2f96[_0x1779('0x35')],_0x36f0a4;if(_0x4ad5ec>=_0xe116){_0x4ad5ec=_0xe116;_0x36f0a4=0xc8;}else{_0x36f0a4=0xce;}_0x39c107[_0x1779('0x31')](_0x36f0a4);return _0x39c107[_0x1779('0x36')](_0x1779('0x37'),_0x1d7d7c+'-'+_0x4ad5ec+'/'+_0xe116)[_0x1779('0x32')](_0x419bfa);}return null;};}function patchUpdates(_0xb25b7f){return function(_0x555f59){try{jsonpatch['apply'](_0x555f59,_0xb25b7f,!![]);}catch(_0x50a94a){return BPromise['reject'](_0x50a94a);}return _0x555f59[_0x1779('0x38')]();};}function saveUpdates(_0x4b1612,_0x2ec291){return function(_0x39f9c2){if(_0x39f9c2){return _0x39f9c2[_0x1779('0x39')](_0x4b1612)[_0x1779('0x25')](function(_0x363032){return _0x363032;});}return null;};}function removeEntity(_0x32f6f2,_0x1da3de){return function(_0x59378d){if(_0x59378d){return _0x59378d[_0x1779('0x3a')]()[_0x1779('0x25')](function(){var _0x4002c6=_0x59378d[_0x1779('0x3b')]({'plain':!![]});var _0x5804a6='ChatWebsites';return db['UserProfileResource'][_0x1779('0x3a')]({'where':{'type':_0x5804a6,'resourceId':_0x4002c6['id']}})[_0x1779('0x25')](function(){return _0x59378d;});})[_0x1779('0x25')](function(){_0x32f6f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ab898,_0x9a3d5d){return function(_0x1eb269){if(!_0x1eb269){_0x1ab898[_0x1779('0x2f')](0x194);}return _0x1eb269;};}function handleError(_0x412d54,_0x119220){_0x119220=_0x119220||0x1f4;return function(_0x2a9d2c){logger[_0x1779('0x2c')](_0x2a9d2c['stack']);if(_0x2a9d2c[_0x1779('0x3c')]){delete _0x2a9d2c[_0x1779('0x3c')];}_0x412d54[_0x1779('0x31')](_0x119220)[_0x1779('0x3d')](_0x2a9d2c);};}exports['index']=function(_0x9d0bf4,_0x236574){var _0x545e98={'include':[{'model':db[_0x1779('0x3e')],'as':_0x1779('0x3f')}]},_0x328b5f={},_0x5efa05={'count':0x0,'rows':[]};var _0x456350=_[_0x1779('0x40')](db[_0x1779('0x41')][_0x1779('0x42')],function(_0x1a76c3){return{'name':_0x1a76c3[_0x1779('0x43')],'type':_0x1a76c3[_0x1779('0x44')][_0x1779('0x45')]};});_0x328b5f[_0x1779('0x46')]=_[_0x1779('0x40')](_0x456350,_0x1779('0x3c'));_0x328b5f['query']=_[_0x1779('0x47')](_0x9d0bf4[_0x1779('0x48')]);_0x328b5f[_0x1779('0x49')]=_[_0x1779('0x4a')](_0x328b5f[_0x1779('0x46')],_0x328b5f[_0x1779('0x48')]);_0x545e98[_0x1779('0x4b')]=_[_0x1779('0x4a')](_0x328b5f[_0x1779('0x46')],qs['fields'](_0x9d0bf4['query']['fields']));_0x545e98[_0x1779('0x4b')]=_0x545e98['attributes'][_0x1779('0x4c')]?_0x545e98[_0x1779('0x4b')]:_0x328b5f[_0x1779('0x46')];if(!_0x9d0bf4[_0x1779('0x48')][_0x1779('0x4d')](_0x1779('0x4e'))){_0x545e98[_0x1779('0x35')]=qs[_0x1779('0x35')](_0x9d0bf4[_0x1779('0x48')][_0x1779('0x35')]);_0x545e98[_0x1779('0x34')]=qs['offset'](_0x9d0bf4[_0x1779('0x48')][_0x1779('0x34')]);}_0x545e98[_0x1779('0x4f')]=qs[_0x1779('0x50')](_0x9d0bf4['query']['sort']);_0x545e98['where']=qs[_0x1779('0x49')](_['pick'](_0x9d0bf4[_0x1779('0x48')],_0x328b5f[_0x1779('0x49')]),_0x456350);if(_0x9d0bf4[_0x1779('0x48')][_0x1779('0x51')]){_0x545e98['where']=_[_0x1779('0x52')](_0x545e98[_0x1779('0x53')],{'$or':_[_0x1779('0x40')](_0x456350,function(_0x5c434f){if(_0x5c434f[_0x1779('0x44')]!==_0x1779('0x54')){var _0x276d63={};_0x276d63[_0x5c434f[_0x1779('0x3c')]]={'$like':'%'+_0x9d0bf4[_0x1779('0x48')][_0x1779('0x51')]+'%'};return _0x276d63;}})});}_0x545e98=_[_0x1779('0x52')]({},_0x545e98,_0x9d0bf4[_0x1779('0x55')]);var _0x116434={'where':_0x545e98[_0x1779('0x53')]};return db['ChatWebsite'][_0x1779('0x33')](_0x116434)['then'](function(_0x29b5de){_0x5efa05[_0x1779('0x33')]=_0x29b5de;if(_0x9d0bf4['query'][_0x1779('0x56')]){_0x545e98[_0x1779('0x57')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x545e98);})[_0x1779('0x25')](function(_0x10b022){_0x5efa05[_0x1779('0x58')]=_0x10b022;return _0x5efa05;})[_0x1779('0x25')](respondWithFilteredResult(_0x236574,_0x545e98))[_0x1779('0x2e')](handleError(_0x236574,null));};exports['show']=function(_0x47da77,_0x93d1ec){var _0x3b5668={'raw':![],'where':{'id':_0x47da77[_0x1779('0x59')]['id']},'include':[{'model':db[_0x1779('0x3e')],'as':_0x1779('0x3f')}]},_0x4cc5ea={};_0x4cc5ea['model']=_[_0x1779('0x47')](db[_0x1779('0x41')][_0x1779('0x42')]);_0x4cc5ea[_0x1779('0x48')]=_[_0x1779('0x47')](_0x47da77[_0x1779('0x48')]);_0x4cc5ea[_0x1779('0x49')]=_[_0x1779('0x4a')](_0x4cc5ea[_0x1779('0x46')],_0x4cc5ea[_0x1779('0x48')]);_0x3b5668[_0x1779('0x4b')]=_[_0x1779('0x4a')](_0x4cc5ea[_0x1779('0x46')],qs[_0x1779('0x5a')](_0x47da77[_0x1779('0x48')][_0x1779('0x5a')]));_0x3b5668[_0x1779('0x4b')]=_0x3b5668['attributes'][_0x1779('0x4c')]?_0x3b5668[_0x1779('0x4b')]:_0x4cc5ea['model'];if(_0x47da77[_0x1779('0x48')][_0x1779('0x56')]){_0x3b5668[_0x1779('0x57')]=[{'all':!![]}];}_0x3b5668=_[_0x1779('0x52')]({},_0x3b5668,_0x47da77['options']);return db['ChatWebsite']['find'](_0x3b5668)[_0x1779('0x25')](handleEntityNotFound(_0x93d1ec,null))[_0x1779('0x25')](respondWithResult(_0x93d1ec,null))['catch'](handleError(_0x93d1ec,null));};exports[_0x1779('0x5b')]=function(_0x7d1aaa,_0x2abb33){return db[_0x1779('0x41')][_0x1779('0x5b')](_0x7d1aaa[_0x1779('0x5c')],{})['then'](function(_0x3c3bf3){var _0x25134f=_0x7d1aaa[_0x1779('0x5d')]['get']({'plain':!![]});if(!_0x25134f)throw new Error(_0x1779('0x5e'));if(_0x25134f[_0x1779('0x5f')]===_0x1779('0x5d')){var _0x2b9274=_0x3c3bf3[_0x1779('0x3b')]({'plain':!![]});var _0x44b95e=_0x1779('0x60');return db[_0x1779('0x61')][_0x1779('0x62')]({'where':{'name':_0x44b95e,'userProfileId':_0x25134f[_0x1779('0x63')]},'raw':!![]})[_0x1779('0x25')](function(_0x3c1a7a){if(_0x3c1a7a&&_0x3c1a7a[_0x1779('0x64')]===0x0){return db['UserProfileResource'][_0x1779('0x5b')]({'name':_0x2b9274[_0x1779('0x3c')],'resourceId':_0x2b9274['id'],'type':_0x3c1a7a['name'],'sectionId':_0x3c1a7a['id']},{})['then'](function(){return _0x3c3bf3;});}else{return _0x3c3bf3;}})['catch'](function(_0x10e35d){logger[_0x1779('0x2c')](_0x1779('0x65'),_0x10e35d);throw _0x10e35d;});}return _0x3c3bf3;})['then'](respondWithResult(_0x2abb33,0xc9))['catch'](handleError(_0x2abb33,null));};exports[_0x1779('0x39')]=function(_0x30fb9c,_0xa33f34){if(_0x30fb9c['body']['id']){delete _0x30fb9c['body']['id'];}return db[_0x1779('0x41')]['find']({'where':{'id':_0x30fb9c['params']['id']},'include':[{'model':db[_0x1779('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x1779('0x25')](handleEntityNotFound(_0xa33f34,null))[_0x1779('0x25')](saveUpdates(_0x30fb9c['body'],null))['then'](respondWithResult(_0xa33f34,null))[_0x1779('0x2e')](handleError(_0xa33f34,null));};exports['destroy']=function(_0x1e90f0,_0x501e7f){return db['ChatWebsite'][_0x1779('0x62')]({'where':{'id':_0x1e90f0[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x501e7f,null))[_0x1779('0x25')](removeEntity(_0x501e7f,null))[_0x1779('0x2e')](handleError(_0x501e7f,null));};exports['describe']=function(_0xa85efb,_0x13e09d){return db[_0x1779('0x41')]['describe']()[_0x1779('0x25')](respondWithResult(_0x13e09d,null))['catch'](handleError(_0x13e09d,null));};exports[_0x1779('0x66')]=function(_0x5ef17f,_0x2aab13,_0x49348c){if(_0x5ef17f[_0x1779('0x5c')]['id']){delete _0x5ef17f['body']['id'];}return db[_0x1779('0x41')][_0x1779('0x62')]({'where':{'id':_0x5ef17f[_0x1779('0x59')]['id']}})['then'](handleEntityNotFound(_0x2aab13,null))[_0x1779('0x25')](function(_0x4bb943){if(_0x4bb943){_0x5ef17f['body'][_0x1779('0x67')]=_0x4bb943['id'];return db[_0x1779('0x68')][_0x1779('0x5b')](_0x5ef17f['body']);}})[_0x1779('0x25')](respondWithResult(_0x2aab13,null))[_0x1779('0x2e')](handleError(_0x2aab13,null));};exports[_0x1779('0x69')]=function(_0x5da55b,_0x24b51f,_0x11c5c1){var _0xf91572={'raw':![],'where':{}};var _0x82103c={};var _0x3c1e81={'count':0x0,'rows':[]};return db[_0x1779('0x41')][_0x1779('0x6a')]({'where':{'id':_0x5da55b['params']['id']}})['then'](handleEntityNotFound(_0x24b51f,null))[_0x1779('0x25')](function(_0x1e2741){if(_0x1e2741){_0x82103c['model']=_['keys'](db['Disposition']['rawAttributes']);_0x82103c[_0x1779('0x48')]=_[_0x1779('0x47')](_0x5da55b[_0x1779('0x48')]);_0x82103c[_0x1779('0x49')]=_[_0x1779('0x4a')](_0x82103c[_0x1779('0x46')],_0x82103c[_0x1779('0x48')]);_0xf91572[_0x1779('0x4b')]=_[_0x1779('0x4a')](_0x82103c[_0x1779('0x46')],qs['fields'](_0x5da55b['query']['fields']));_0xf91572[_0x1779('0x4b')]=_0xf91572[_0x1779('0x4b')][_0x1779('0x4c')]?_0xf91572[_0x1779('0x4b')]:_0x82103c[_0x1779('0x46')];if(!_0x5da55b['query'][_0x1779('0x4d')](_0x1779('0x4e'))){_0xf91572[_0x1779('0x35')]=qs[_0x1779('0x35')](_0x5da55b['query'][_0x1779('0x35')]);_0xf91572['offset']=qs[_0x1779('0x34')](_0x5da55b[_0x1779('0x48')][_0x1779('0x34')]);}_0xf91572['order']=qs[_0x1779('0x50')](_0x5da55b[_0x1779('0x48')][_0x1779('0x50')]);_0xf91572[_0x1779('0x53')]=qs[_0x1779('0x49')](_['pick'](_0x5da55b[_0x1779('0x48')],_0x82103c[_0x1779('0x49')]));_0xf91572[_0x1779('0x53')][_0x1779('0x67')]=_0x1e2741['id'];if(_0x5da55b[_0x1779('0x48')][_0x1779('0x51')]){_0xf91572[_0x1779('0x53')]=_[_0x1779('0x52')](_0xf91572[_0x1779('0x53')],{'$or':_['map'](_0xf91572[_0x1779('0x4b')],function(_0x5aab8a){var _0x274625={};_0x274625[_0x5aab8a]={'$like':'%'+_0x5da55b[_0x1779('0x48')][_0x1779('0x51')]+'%'};return _0x274625;})});}_0xf91572=_['merge']({},_0xf91572,_0x5da55b['options']);return db[_0x1779('0x68')][_0x1779('0x33')]({'where':_0xf91572['where']})[_0x1779('0x25')](function(_0x5674a1){_0x3c1e81[_0x1779('0x33')]=_0x5674a1;if(_0x5da55b[_0x1779('0x48')][_0x1779('0x56')]){_0xf91572[_0x1779('0x57')]=[{'all':!![]}];}return db[_0x1779('0x68')][_0x1779('0x6b')](_0xf91572);})[_0x1779('0x25')](function(_0x357c0e){_0x3c1e81[_0x1779('0x58')]=_0x357c0e;return _0x3c1e81;});}})[_0x1779('0x25')](respondWithFilteredResult(_0x24b51f,_0xf91572))[_0x1779('0x2e')](handleError(_0x24b51f,null));};exports['removeDispositions']=function(_0x43ee42,_0x555d3b,_0x407ae4){return db[_0x1779('0x41')]['find']({'where':{'id':_0x43ee42[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x555d3b,null))['then'](function(_0x4af279){if(_0x4af279){return _0x4af279['removeDispositions'](_0x43ee42['query']['ids']);}})[_0x1779('0x25')](respondWithStatusCode(_0x555d3b,null))[_0x1779('0x2e')](handleError(_0x555d3b,null));};exports[_0x1779('0x6c')]=function(_0x919480,_0x5ad64c,_0x52313d){if(_0x919480[_0x1779('0x5c')]['id']){delete _0x919480[_0x1779('0x5c')]['id'];}return db[_0x1779('0x41')]['find']({'where':{'id':_0x919480['params']['id']}})['then'](handleEntityNotFound(_0x5ad64c,null))[_0x1779('0x25')](function(_0x1ed042){if(_0x1ed042){_0x919480[_0x1779('0x5c')][_0x1779('0x67')]=_0x1ed042['id'];return db[_0x1779('0x6d')][_0x1779('0x5b')](_0x919480[_0x1779('0x5c')]);}})[_0x1779('0x25')](respondWithResult(_0x5ad64c,null))[_0x1779('0x2e')](handleError(_0x5ad64c,null));};exports['getAnswers']=function(_0x3a56c8,_0x24d064,_0x2612ec){var _0x257c98={'raw':![],'where':{}};var _0x216fa3={};var _0x4027ce={'count':0x0,'rows':[]};return db[_0x1779('0x41')]['findOne']({'where':{'id':_0x3a56c8[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x24d064,null))[_0x1779('0x25')](function(_0x1ec063){if(_0x1ec063){_0x216fa3[_0x1779('0x46')]=_[_0x1779('0x47')](db[_0x1779('0x6d')][_0x1779('0x42')]);_0x216fa3[_0x1779('0x48')]=_[_0x1779('0x47')](_0x3a56c8[_0x1779('0x48')]);_0x216fa3[_0x1779('0x49')]=_['intersection'](_0x216fa3[_0x1779('0x46')],_0x216fa3[_0x1779('0x48')]);_0x257c98[_0x1779('0x4b')]=_[_0x1779('0x4a')](_0x216fa3['model'],qs[_0x1779('0x5a')](_0x3a56c8['query']['fields']));_0x257c98['attributes']=_0x257c98[_0x1779('0x4b')][_0x1779('0x4c')]?_0x257c98[_0x1779('0x4b')]:_0x216fa3[_0x1779('0x46')];if(!_0x3a56c8['query']['hasOwnProperty'](_0x1779('0x4e'))){_0x257c98[_0x1779('0x35')]=qs[_0x1779('0x35')](_0x3a56c8[_0x1779('0x48')][_0x1779('0x35')]);_0x257c98['offset']=qs['offset'](_0x3a56c8[_0x1779('0x48')]['offset']);}_0x257c98[_0x1779('0x4f')]=qs['sort'](_0x3a56c8[_0x1779('0x48')][_0x1779('0x50')]);_0x257c98['where']=qs[_0x1779('0x49')](_[_0x1779('0x6e')](_0x3a56c8[_0x1779('0x48')],_0x216fa3[_0x1779('0x49')]));_0x257c98[_0x1779('0x53')][_0x1779('0x67')]=_0x1ec063['id'];if(_0x3a56c8[_0x1779('0x48')][_0x1779('0x51')]){_0x257c98[_0x1779('0x53')]=_[_0x1779('0x52')](_0x257c98['where'],{'$or':_['map'](_0x257c98[_0x1779('0x4b')],function(_0x2bd580){var _0x714189={};_0x714189[_0x2bd580]={'$like':'%'+_0x3a56c8[_0x1779('0x48')][_0x1779('0x51')]+'%'};return _0x714189;})});}_0x257c98=_[_0x1779('0x52')]({},_0x257c98,_0x3a56c8['options']);return db['CannedAnswer']['count']({'where':_0x257c98['where']})[_0x1779('0x25')](function(_0xd2a1e){_0x4027ce[_0x1779('0x33')]=_0xd2a1e;if(_0x3a56c8[_0x1779('0x48')][_0x1779('0x56')]){_0x257c98['include']=[{'all':!![]}];}return db[_0x1779('0x6d')][_0x1779('0x6b')](_0x257c98);})[_0x1779('0x25')](function(_0x3327aa){_0x4027ce[_0x1779('0x58')]=_0x3327aa;return _0x4027ce;});}})[_0x1779('0x25')](respondWithFilteredResult(_0x24d064,_0x257c98))['catch'](handleError(_0x24d064,null));};exports[_0x1779('0x6f')]=function(_0x46fb8a,_0x5484c8,_0x57c910){return db['ChatWebsite'][_0x1779('0x62')]({'where':{'id':_0x46fb8a[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x5484c8,null))[_0x1779('0x25')](function(_0x1691c8){if(_0x1691c8){return _0x1691c8[_0x1779('0x6f')](_0x46fb8a['query'][_0x1779('0x70')]);}})[_0x1779('0x25')](respondWithStatusCode(_0x5484c8,null))[_0x1779('0x2e')](handleError(_0x5484c8,null));};exports[_0x1779('0x71')]=function(_0x50cfa6,_0x5716f2,_0x5d70c1){_0x50cfa6[_0x1779('0x5c')][_0x1779('0x72')]=_0x50cfa6[_0x1779('0x73')][_0x1779('0x74')];return db[_0x1779('0x41')][_0x1779('0x62')]({'where':{'id':_0x50cfa6[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x5716f2,null))[_0x1779('0x25')](saveUpdates(_0x50cfa6[_0x1779('0x5c')],null))['then'](respondWithResult(_0x5716f2,null))[_0x1779('0x2e')](handleError(_0x5716f2,null));};exports[_0x1779('0x75')]=function(_0x24b0c0,_0x1e5ee8,_0x1d45a1){_0x24b0c0[_0x1779('0x5c')]['agentAvatar']=_0x24b0c0['file'][_0x1779('0x74')];return db['ChatWebsite'][_0x1779('0x62')]({'where':{'id':_0x24b0c0['params']['id']}})['then'](handleEntityNotFound(_0x1e5ee8,null))[_0x1779('0x25')](saveUpdates(_0x24b0c0['body'],null))[_0x1779('0x25')](respondWithResult(_0x1e5ee8,null))['catch'](handleError(_0x1e5ee8,null));};exports[_0x1779('0x76')]=function(_0x328b9a,_0x36238d,_0x40507d){_0x328b9a[_0x1779('0x5c')][_0x1779('0x77')]=_0x328b9a[_0x1779('0x73')]['filename'];return db[_0x1779('0x41')]['find']({'where':{'id':_0x328b9a[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x36238d,null))[_0x1779('0x25')](saveUpdates(_0x328b9a['body'],null))[_0x1779('0x25')](respondWithResult(_0x36238d,null))['catch'](handleError(_0x36238d,null));};exports[_0x1779('0x78')]=function(_0x238d1f,_0x35137f,_0xd7904e){_0x238d1f[_0x1779('0x5c')]['systemAvatar']=_0x238d1f['file']['filename'];return db[_0x1779('0x41')][_0x1779('0x62')]({'where':{'id':_0x238d1f[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x35137f,null))['then'](saveUpdates(_0x238d1f[_0x1779('0x5c')],null))[_0x1779('0x25')](respondWithResult(_0x35137f,null))[_0x1779('0x2e')](handleError(_0x35137f,null));};exports['getLogo']=function(_0x3f6c2f,_0x33fde1,_0x3b5c94){var _0x2478ed=path['join'](config[_0x1779('0x79')],_0x1779('0x7a'));var _0xb4b48f={'where':{'id':_0x3f6c2f[_0x1779('0x59')]['id']},'attributes':['id',_0x1779('0x72')],'raw':!![]};var _0x1b252b=![];return require(_0x1779('0x1b'))[_0x1779('0x7b')]()[_0x1779('0x25')](function(_0x19f322){if(_0x19f322){_0x1b252b=_0x19f322[_0x1779('0x7c')];}})[_0x1779('0x25')](function(){return db[_0x1779('0x41')][_0x1779('0x62')](_0xb4b48f);})['then'](handleEntityNotFound(_0x33fde1,null))['then'](function(_0x2ea1be){if(_0x2ea1be){if(!_[_0x1779('0x7d')](_0x2ea1be['sitepic'])){if(fs[_0x1779('0x7e')](path[_0x1779('0x7f')](config[_0x1779('0x79')],_0x1779('0x80'),_0x2ea1be[_0x1779('0x72')]))&&_0x1b252b){_0x2478ed=path[_0x1779('0x7f')](config['root'],_0x1779('0x80'),_0x2ea1be['sitepic']);}}return _0x33fde1[_0x1779('0x81')](_0x2478ed);}})[_0x1779('0x2e')](handleError(_0x33fde1,null));};exports['getAvatar']=function(_0x22eafd,_0xca9260,_0x3ddef9){var _0x1263cb=path[_0x1779('0x7f')](config[_0x1779('0x79')],'server/files/images/avatars/default_avatar.png');var _0x2ee7a5={'where':{'id':_0x22eafd[_0x1779('0x59')]['id']},'attributes':['id',_0x1779('0x82')],'raw':!![]};return db[_0x1779('0x41')]['find'](_0x2ee7a5)[_0x1779('0x25')](handleEntityNotFound(_0xca9260,null))[_0x1779('0x25')](function(_0x1f7018){if(_0x1f7018){if(!_[_0x1779('0x7d')](_0x1f7018[_0x1779('0x82')])){if(fs[_0x1779('0x7e')](path[_0x1779('0x7f')](config['root'],'server/files/images/avatars/',_0x1f7018['agentAvatar']))){_0x1263cb=path[_0x1779('0x7f')](config['root'],_0x1779('0x83'),_0x1f7018['agentAvatar']);}}return _0xca9260[_0x1779('0x81')](_0x1263cb);}})[_0x1779('0x2e')](handleError(_0xca9260,null));};exports[_0x1779('0x84')]=function(_0x298561,_0x2d457c,_0x10b0d2){var _0x2fefb8=path[_0x1779('0x7f')](config[_0x1779('0x79')],'server/files/images/avatars/customer_avatar.png');var _0x66eb54={'where':{'id':_0x298561[_0x1779('0x59')]['id']},'attributes':['id',_0x1779('0x77'),_0x1779('0x85')],'raw':!![]};return db[_0x1779('0x41')][_0x1779('0x62')](_0x66eb54)[_0x1779('0x25')](handleEntityNotFound(_0x2d457c,null))[_0x1779('0x25')](function(_0x2872ed){if(_0x2872ed){if(!_[_0x1779('0x7d')](_0x2872ed[_0x1779('0x77')])){if(fs[_0x1779('0x7e')](path[_0x1779('0x7f')](config[_0x1779('0x79')],_0x1779('0x83'),_0x2872ed[_0x1779('0x77')]))&&_0x2872ed[_0x1779('0x85')]){_0x2fefb8=path[_0x1779('0x7f')](config[_0x1779('0x79')],_0x1779('0x83'),_0x2872ed['customerAvatar']);}}return _0x2d457c[_0x1779('0x81')](_0x2fefb8);}})[_0x1779('0x2e')](handleError(_0x2d457c,null));};exports['getSystemAvatar']=function(_0x596a85,_0x72b7bb,_0x21f2c6){var _0x268673=path[_0x1779('0x7f')](config[_0x1779('0x79')],_0x1779('0x86'));var _0x2dd3e3={'where':{'id':_0x596a85['params']['id']},'attributes':['id',_0x1779('0x87')],'raw':!![]};return db['ChatWebsite'][_0x1779('0x62')](_0x2dd3e3)[_0x1779('0x25')](handleEntityNotFound(_0x72b7bb,null))[_0x1779('0x25')](function(_0x374b0e){if(_0x374b0e){if(!_[_0x1779('0x7d')](_0x374b0e[_0x1779('0x87')])){if(fs[_0x1779('0x7e')](path['join'](config['root'],_0x1779('0x83'),_0x374b0e['systemAvatar']))){_0x268673=path['join'](config[_0x1779('0x79')],'server/files/images/avatars/',_0x374b0e[_0x1779('0x87')]);}}return _0x72b7bb[_0x1779('0x81')](_0x268673);}})['catch'](handleError(_0x72b7bb,null));};exports[_0x1779('0x88')]=function(_0x273e88,_0x1fff8b,_0x5c6673){var _0xc8f6cb=require(_0x1779('0x89'));var _0x493bcd=new _0xc8f6cb();var _0x58f933=_0x493bcd[_0x1779('0x8a')](_0x273e88['headers']['user-agent'])[_0x1779('0x8b')]();var _0x2747e4={'body':_0x273e88[_0x1779('0x5c')],'channel':_0x1779('0x8c')};var _0x6a893d=[];var _0x2fe12c=[];var _0x569695={};var _0x584de5=![];return db[_0x1779('0x8d')]['describe']()[_0x1779('0x25')](function(_0x105e5a){if(!_0x105e5a){throw new db[(_0x1779('0x8e'))][(_0x1779('0x8f'))](_0x1779('0x90'));}_0x6a893d=_[_0x1779('0x91')](_[_0x1779('0x47')](_0x105e5a),[_0x1779('0x92'),_0x1779('0x93')]);_0x2fe12c=_[_0x1779('0x91')](_[_0x1779('0x47')](_0x105e5a),['createdAt',_0x1779('0x93'),'CompanyId',_0x1779('0x94')]);if(_0x273e88[_0x1779('0x5c')]['id']){delete _0x273e88['body']['id'];}if(_[_0x1779('0x7d')](_0x273e88['body'][_0x1779('0x95')])){throw new db[(_0x1779('0x8e'))][(_0x1779('0x8f'))](_0x1779('0x96'));}if(_[_0x1779('0x7d')](_0x273e88[_0x1779('0x5c')][_0x1779('0x5c')])||_0x273e88[_0x1779('0x5c')][_0x1779('0x5c')]===''){throw new db[(_0x1779('0x8e'))][(_0x1779('0x8f'))](_0x1779('0x97'));}if(_[_0x1779('0x7d')](_0x273e88[_0x1779('0x5c')][_0x1779('0x98')])){throw new db[(_0x1779('0x8e'))][(_0x1779('0x8f'))](_0x1779('0x99')+_0x2fe12c);}if(!_[_0x1779('0x9a')](_0x2fe12c,_0x273e88[_0x1779('0x5c')]['mapKey'])){throw new db[(_0x1779('0x8e'))][(_0x1779('0x8f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2fe12c);}_0x569695[_0x273e88[_0x1779('0x5c')][_0x1779('0x98')]]=_0x273e88[_0x1779('0x5c')]['from'];})[_0x1779('0x25')](function(){return db[_0x1779('0x41')]['find']({'where':{'id':_0x273e88['params']['id']},'include':[{'model':db[_0x1779('0x9b')],'as':_0x1779('0x9c'),'include':[{'model':db[_0x1779('0x8d')],'as':'Contacts','where':_0x569695,'limit':0x1,'order':[['updatedAt',_0x1779('0x9d')]]}]},{'model':db[_0x1779('0x9e')],'as':_0x1779('0x9f')}]});})[_0x1779('0x25')](handleEntityNotFound(_0x1fff8b,null))['then'](function(_0x2a1c42){if(_0x2a1c42&&_0x2a1c42[_0x1779('0x9c')]){_0x2747e4['account']=_0x2a1c42;_0x2747e4[_0x1779('0xa0')]=_0x2a1c42[_0x1779('0x9f')];_0x2747e4[_0x1779('0xa1')]=_0x2a1c42['List'];_0x2747e4[_0x1779('0xa0')]=_['orderBy'](_0x2747e4['applications'],['priority'],[_0x1779('0xa2')]);if(_0x2747e4['account']['Applications']){delete _0x2747e4[_0x1779('0xa3')][_0x1779('0x9f')];}if(_0x2747e4[_0x1779('0xa3')][_0x1779('0x9c')]&&_0x2747e4[_0x1779('0xa3')][_0x1779('0x9c')][_0x1779('0xa4')][_0x1779('0x4c')]){return _0x2747e4[_0x1779('0xa3')][_0x1779('0x9c')][_0x1779('0xa4')][0x0];}var _0x2a26e6=_[_0x1779('0x1d')](_0x273e88['body'],{'firstName':_0x273e88[_0x1779('0x5c')][_0x1779('0x95')],'ListId':_0x2a1c42[_0x1779('0x94')]});_0x2a26e6[_0x273e88[_0x1779('0x5c')][_0x1779('0x98')]]=_0x273e88[_0x1779('0x5c')]['from'];return db['CmContact'][_0x1779('0x5b')](_0x2a26e6,{'fields':_0x6a893d,'raw':!![]});}})[_0x1779('0x25')](handleEntityNotFound(_0x1fff8b,null))[_0x1779('0x25')](function(_0x529bfc){_0x2747e4['contact']=_0x529bfc;var _0x20f75f=_0x273e88[_0x1779('0x5c')][_0x1779('0xa5')];if(_0x273e88[_0x1779('0xa6')][_0x1779('0xa7')]){_0x20f75f=_0x273e88['headers'][_0x1779('0xa7')];}else if(_0x273e88[_0x1779('0xa6')][_0x1779('0xa8')]){_0x20f75f=_[_0x1779('0xa9')](_0x273e88[_0x1779('0xa6')]['x-forwarded-for']['split'](','));}if(_0x529bfc){var _0x4d2175={'ContactId':_0x529bfc['id'],'ChatWebsiteId':_0x273e88[_0x1779('0x59')]['id'],'from':(_0x529bfc[_0x1779('0xaa')]||'')+'\x20'+(_0x529bfc['lastName']||''),'customerIp':_0x20f75f,'customerPort':_0x273e88['headers'][_0x1779('0xab')]?_0x273e88[_0x1779('0xa6')][_0x1779('0xab')]:null,'referer':_0x273e88[_0x1779('0x5c')]['referer'],'browserName':_0x58f933[_0x1779('0xac')]['name']&&_0x58f933[_0x1779('0xac')][_0x1779('0xad')]?util[_0x1779('0xae')]('%s\x20%s',_0x58f933['browser']['name'],_0x58f933[_0x1779('0xac')][_0x1779('0xad')]):'unknown','browserVersion':_0x58f933['browser'][_0x1779('0xad')]||_0x1779('0xaf'),'osName':util['format'](_0x1779('0xb0'),_0x58f933['os'][_0x1779('0x3c')],_0x58f933['os'][_0x1779('0xad')]),'osVersion':_0x58f933['os'][_0x1779('0xad')],'deviceModel':_0x58f933['device'][_0x1779('0x46')]&&_0x58f933[_0x1779('0xb1')][_0x1779('0xb2')]?util[_0x1779('0xae')](_0x1779('0xb3'),_0x58f933['device']['model'],_0x58f933[_0x1779('0xb1')][_0x1779('0xb2')],_0x58f933[_0x1779('0xb1')][_0x1779('0x44')]):null,'deviceVendor':_0x58f933[_0x1779('0xb1')][_0x1779('0xb2')],'deviceType':_0x58f933[_0x1779('0xb1')][_0x1779('0x44')],'formData':JSON['stringify'](_0x273e88['body'])};var _0x2b3bc8={'ChatWebsiteId':_0x273e88[_0x1779('0x59')]['id'],'closed':![]};if(_0x273e88[_0x1779('0x5c')][_0x1779('0xb4')]){_0x2b3bc8[_0x1779('0xb4')]=_0x273e88['body'][_0x1779('0xb4')];return db['ChatInteraction'][_0x1779('0x62')]({'where':_0x2b3bc8})[_0x1779('0x25')](function(_0x2d9d5f){if(_0x2d9d5f){return[_0x2d9d5f,![]];}_0x4d2175[_0x1779('0xb4')]=_0x273e88[_0x1779('0x5c')][_0x1779('0xb4')];_0x4d2175['externalUrl']=_0x273e88[_0x1779('0x5c')][_0x1779('0xb5')];return db[_0x1779('0xb6')][_0x1779('0x5b')](_0x4d2175)[_0x1779('0x25')](function(_0x4250f1){return[_0x4250f1,!![]];});});}_0x2b3bc8[_0x1779('0xb7')]=_0x529bfc['id'];if(_0x273e88[_0x1779('0x5c')][_0x1779('0xb8')]&&_0x273e88['body']['interaction']['id']){_0x2b3bc8['id']=_0x273e88['body'][_0x1779('0xb8')]['id'];return db['ChatInteraction'][_0x1779('0x62')]({'where':_0x2b3bc8})['then'](function(_0x571de1){if(_0x571de1){return[_0x571de1,![]];}return db[_0x1779('0xb6')][_0x1779('0x5b')](_0x4d2175)[_0x1779('0x25')](function(_0x139b29){return[_0x139b29,!![]];});});}return db['ChatInteraction'][_0x1779('0x5b')](_0x4d2175)[_0x1779('0x25')](function(_0x851f45){return[_0x851f45,!![]];});}})[_0x1779('0xb9')](function(_0x22c271,_0x37fe04){if(_0x22c271){_0x584de5=_0x37fe04;if(!_0x37fe04){var _0x541a10={'from':(_0x2747e4['contact'][_0x1779('0xaa')]||'')+'\x20'+(_0x2747e4[_0x1779('0xba')][_0x1779('0xbb')]||'')};if(_0x273e88[_0x1779('0x5c')][_0x1779('0xb4')]&&_0x273e88[_0x1779('0x5c')][_0x1779('0xbc')]&&_0x273e88[_0x1779('0x5c')][_0x1779('0xb4')]!=_0x273e88[_0x1779('0x5c')]['messageId']){_0x541a10[_0x1779('0xb4')]=_0x273e88[_0x1779('0x5c')][_0x1779('0xbc')];}return _0x22c271[_0x1779('0x39')](_0x541a10);}else{return _0x22c271;}}})[_0x1779('0x25')](function(_0x5d0a2c){_0x2747e4['interaction']=_0x5d0a2c[_0x1779('0x3b')]({'plain':!![]});_0x2747e4[_0x1779('0xb8')]['created']=_0x584de5;if(_0x2747e4[_0x1779('0xb8')]['created']){if(_0x2747e4[_0x1779('0xa3')][_0x1779('0xbd')]){_0x2747e4['applications']['push']({'id':0x0,'priority':_0x2747e4['applications'][_0x1779('0x4c')]+0x1,'app':_0x1779('0xbe'),'appdata':_0x1779('0xbf'),'interval':_0x1779('0xc0')});}}return db[_0x1779('0xc1')][_0x1779('0x5b')]({'body':_0x273e88[_0x1779('0x5c')][_0x1779('0x5c')],'ChatWebsiteId':_0x273e88[_0x1779('0x59')]['id'],'ChatInteractionId':_0x5d0a2c['id'],'direction':'in','ContactId':_0x2747e4[_0x1779('0xba')]['id'],'AttachmentId':_0x273e88[_0x1779('0x5c')]['AttachmentId']});})[_0x1779('0x25')](function(_0x1f7e17){_0x2747e4[_0x1779('0x2d')]=_0x1f7e17;if(_0x2747e4[_0x1779('0xb8')]['UserId']){return db['User'][_0x1779('0x62')]({'attributes':['id','name'],'where':{'id':_0x2747e4[_0x1779('0xb8')][_0x1779('0xc2')]}})['then'](function(_0x3f892b){if(_0x3f892b){_0x2747e4[_0x1779('0xa0')][_0x1779('0xc3')]({'id':0x0,'priority':0x0,'app':_0x1779('0xc4'),'appdata':_0x3f892b['name']+','+(_0x2747e4[_0x1779('0xa3')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x2747e4[_0x1779('0xc5')]=!![];}return respondWithRpcPromise(_0x1779('0xc6'),_0x1779('0xc7'),_0x2747e4);});}return respondWithRpcPromise(_0x1779('0xc6'),_0x1779('0xc7'),_0x2747e4);})['then'](function(_0xbd263){respondWithRpcPromise('EventManager','EventManager',{'event':_0x1779('0x88'),'message':_0xbd263},client9002);return _0xbd263;})[_0x1779('0x25')](respondWithResult(_0x1fff8b,null))[_0x1779('0x2e')](handleError(_0x1fff8b,null));};exports[_0x1779('0xc8')]=function(_0x44ed72,_0x4662dd,_0x580880){var _0x45d97e,_0x707007,_0x2f18df;var _0x467c88=[];var _0xefc1ff=[];var _0x16daa8={};return db[_0x1779('0x8d')]['describe']()[_0x1779('0x25')](function(_0x3822a2){if(!_0x3822a2){throw new db[(_0x1779('0x8e'))]['ValidationError']('no\x20available\x20attributes');}_0xefc1ff=_['difference'](_['keys'](_0x3822a2),[_0x1779('0x92'),_0x1779('0x93')]);_0x467c88=_[_0x1779('0x91')](_[_0x1779('0x47')](_0x3822a2),['createdAt','updatedAt',_0x1779('0xc9'),'ListId']);if(_0x44ed72['body']['id']){delete _0x44ed72['body']['id'];}if(_[_0x1779('0x7d')](_0x44ed72[_0x1779('0x5c')][_0x1779('0x95')])){throw _0x4662dd[_0x1779('0x31')](0x1f4)[_0x1779('0x3d')](new db['Sequelize'][(_0x1779('0x8f'))]('from\x20is\x20mandatory'));}if(_[_0x1779('0x7d')](_0x44ed72[_0x1779('0x5c')][_0x1779('0x5c')])||_0x44ed72[_0x1779('0x5c')]['body']===''){throw _0x4662dd[_0x1779('0x31')](0x1f4)['send'](new db[(_0x1779('0x8e'))][(_0x1779('0x8f'))](_0x1779('0x97')));}if(_[_0x1779('0x7d')](_0x44ed72[_0x1779('0x5c')][_0x1779('0xca')])){throw _0x4662dd[_0x1779('0x31')](0x1f4)[_0x1779('0x3d')](new db[(_0x1779('0x8e'))][(_0x1779('0x8f'))](_0x1779('0xcb')+_0x467c88));}if(!_['includes'](_0x467c88,_0x44ed72[_0x1779('0x5c')][_0x1779('0xca')])){throw _0x4662dd['status'](0x1f4)[_0x1779('0x3d')](new db[(_0x1779('0x8e'))][(_0x1779('0x8f'))](_0x1779('0xcc')+_0x467c88));}_0x16daa8[_0x44ed72[_0x1779('0x5c')][_0x1779('0xca')]]=_0x44ed72[_0x1779('0x5c')][_0x1779('0x95')];})['then'](function(){return db[_0x1779('0x41')][_0x1779('0x62')]({'where':{'id':_0x44ed72[_0x1779('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x1779('0x9c')}]});})[_0x1779('0x25')](handleEntityNotFound(_0x4662dd,null))['then'](function(_0x1ac0d1){if(_0x1ac0d1&&_0x1ac0d1[_0x1779('0x9c')]){_0x707007=_0x1ac0d1;var _0x253edb=_[_0x1779('0x1d')](_0x44ed72[_0x1779('0x5c')],{'firstName':_0x44ed72[_0x1779('0x5c')][_0x1779('0x95')],'phone':_0x44ed72[_0x1779('0x5c')][_0x1779('0x95')],'ListId':_0x1ac0d1['ListId']});_0x253edb[_0x44ed72[_0x1779('0x5c')][_0x1779('0xca')]]=_0x44ed72['body'][_0x1779('0x95')];return db['CmContact'][_0x1779('0xcd')]({'where':_0x16daa8,'defaults':_0x253edb});}})[_0x1779('0xb9')](function(_0x4eec0a){if(_0x4eec0a){_0x2f18df=_0x4eec0a;var _0x3c7619=fs['readFileSync'](path[_0x1779('0x7f')](config[_0x1779('0x79')],_0x1779('0xce')),_0x1779('0xcf'));var _0x32addf=ejs[_0x1779('0xd0')](_0x3c7619,{'body':_['toPairs'](_0x44ed72['body'][_0x1779('0x5c')]),'bodyTitle':_0x707007[_0x1779('0xd1')]});return db[_0x1779('0xd2')][_0x1779('0x5b')]({'body':_0x32addf,'ContactId':_0x4eec0a['id'],'ChatWebsiteId':_0x707007['id']});}})[_0x1779('0x25')](function(_0x2b6251){if(_0x2b6251){_0x45d97e=_0x2b6251;return db[_0x1779('0xd3')][_0x1779('0x6a')]({'where':{'service':!![]},'include':[{'model':db[_0x1779('0xd4')],'as':'Smtp','raw':!![]}]});}})[_0x1779('0x25')](function(_0x247ed8){if(_0x247ed8&&_0x247ed8[_0x1779('0xd5')]&&_0x707007[_0x1779('0xd6')]){var _0x59a355={'tls':{'rejectUnauthorized':![]}};if(_0x247ed8[_0x1779('0xd5')]['service']){_0x59a355[_0x1779('0xd7')]=_0x247ed8[_0x1779('0xd5')][_0x1779('0xd7')];}else{_0x59a355[_0x1779('0xd8')]=_0x247ed8['Smtp'][_0x1779('0xd8')];_0x59a355[_0x1779('0xd9')]=_0x247ed8[_0x1779('0xd5')][_0x1779('0xd9')];_0x59a355['secure']=_0x247ed8[_0x1779('0xd5')]['secure'];}if(_0x247ed8[_0x1779('0xd5')][_0x1779('0xda')]){_0x59a355[_0x1779('0xdb')]={'user':_0x247ed8[_0x1779('0xd5')][_0x1779('0x5d')],'pass':_0x247ed8['Smtp']['pass']};}return respondWithRpcPromise(_0x1779('0xdc'),'sendMail',{'account':_0x59a355,'message':{'from':util[_0x1779('0xae')](_0x1779('0xdd'),_0x247ed8[_0x1779('0x3c')],_0x247ed8[_0x1779('0xde')]||_0x247ed8[_0x1779('0xd5')][_0x1779('0x5d')]),'to':_0x707007[_0x1779('0xd6')],'subject':_0x707007[_0x1779('0xdf')],'text':_0x45d97e['body']}},client9003)['then'](function(){return _0x45d97e;})['catch'](function(_0x188469){console[_0x1779('0x2c')](_0x188469);});}})[_0x1779('0x25')](function(){if(_0x45d97e){return _0x45d97e;}})[_0x1779('0x25')](respondWithResult(_0x4662dd,null))['catch'](handleError(_0x4662dd,null));};exports['addInteraction']=function(_0x144397,_0xe6ae0d,_0xc75853){return db[_0x1779('0xb6')][_0x1779('0x62')]({'where':{'id':_0x144397[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0xe6ae0d,null))[_0x1779('0x25')](function(_0x1856c7){if(_0x1856c7){return _0x1856c7[_0x1779('0xe0')](_0x144397[_0x1779('0x5c')]['ids'],_[_0x1779('0xe1')](_0x144397['body'],['ids','id'])||{});}})[_0x1779('0x25')](respondWithResult(_0xe6ae0d,null))[_0x1779('0x2e')](handleError(_0xe6ae0d,null));};exports[_0x1779('0xe2')]=function(_0x86292,_0x1716a3,_0x57a3a5){var _0x2cbef3={'raw':![],'where':{}};var _0x5b3268={};var _0x878e6c={'count':0x0,'rows':[]};return db[_0x1779('0x41')]['findOne']({'where':{'id':_0x86292['params']['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x1716a3,null))[_0x1779('0x25')](function(_0x21d3cf){if(_0x21d3cf){_0x5b3268[_0x1779('0x46')]=_[_0x1779('0x47')](db[_0x1779('0xb6')][_0x1779('0x42')]);_0x5b3268[_0x1779('0x48')]=_[_0x1779('0x47')](_0x86292[_0x1779('0x48')]);_0x5b3268[_0x1779('0x49')]=_['intersection'](_0x5b3268[_0x1779('0x46')],_0x5b3268[_0x1779('0x48')]);_0x2cbef3['attributes']=_[_0x1779('0x4a')](_0x5b3268['model'],qs[_0x1779('0x5a')](_0x86292[_0x1779('0x48')]['fields']));_0x2cbef3['attributes']=_0x2cbef3[_0x1779('0x4b')][_0x1779('0x4c')]?_0x2cbef3[_0x1779('0x4b')]:_0x5b3268[_0x1779('0x46')];if(!_0x86292[_0x1779('0x48')][_0x1779('0x4d')](_0x1779('0x4e'))){_0x2cbef3[_0x1779('0x35')]=qs['limit'](_0x86292['query'][_0x1779('0x35')]);_0x2cbef3[_0x1779('0x34')]=qs['offset'](_0x86292[_0x1779('0x48')][_0x1779('0x34')]);}_0x2cbef3['order']=qs['sort'](_0x86292[_0x1779('0x48')][_0x1779('0x50')]);_0x2cbef3['where']=qs[_0x1779('0x49')](_['pick'](_0x86292[_0x1779('0x48')],_0x5b3268[_0x1779('0x49')]));_0x2cbef3[_0x1779('0x53')][_0x1779('0x67')]=_0x21d3cf['id'];if(_0x86292[_0x1779('0x48')][_0x1779('0x51')]){_0x2cbef3[_0x1779('0x53')]=_[_0x1779('0x52')](_0x2cbef3[_0x1779('0x53')],{'$or':_[_0x1779('0x40')](_0x2cbef3[_0x1779('0x4b')],function(_0x5477ed){var _0x2b57e7={};_0x2b57e7[_0x5477ed]={'$like':'%'+_0x86292[_0x1779('0x48')][_0x1779('0x51')]+'%'};return _0x2b57e7;})});}_0x2cbef3=_[_0x1779('0x52')]({},_0x2cbef3,_0x86292[_0x1779('0x55')]);return db[_0x1779('0xb6')][_0x1779('0x33')]({'where':_0x2cbef3['where']})[_0x1779('0x25')](function(_0x4d011f){_0x878e6c['count']=_0x4d011f;if(_0x86292[_0x1779('0x48')][_0x1779('0x56')]){_0x2cbef3['include']=[{'model':db[_0x1779('0x8d')],'as':_0x1779('0xe3'),'required':![]},{'model':db[_0x1779('0xe4')],'as':'Owner','attributes':[_0x1779('0x3c'),_0x1779('0xe5'),_0x1779('0xe6')],'required':![]},{'model':db[_0x1779('0xe7')],'as':'Tags','attributes':['id',_0x1779('0x3c'),_0x1779('0xe8')],'where':_0x86292[_0x1779('0x48')][_0x1779('0xe9')]?{'id':_0x86292[_0x1779('0x48')][_0x1779('0xe9')]}:undefined,'required':_0x86292['query']['tag']?!![]:![]}];}return db[_0x1779('0xb6')][_0x1779('0x6b')](_0x2cbef3);})[_0x1779('0x25')](function(_0x38471e){_0x878e6c[_0x1779('0x58')]=_0x38471e;return _0x878e6c;});}})[_0x1779('0x25')](respondWithFilteredResult(_0x1716a3,_0x2cbef3))[_0x1779('0x2e')](handleError(_0x1716a3,null));};function iftimePromise(_0x12415a,_0x5edd3e){return respondWithRpcPromise('Command',_0x1779('0xea'),{'command':_0x5edd3e[_0x1779('0xeb')]?util[_0x1779('0xae')](_0x1779('0xec'),_0x12415a[_0x1779('0xed')],_0x5edd3e[_0x1779('0xeb')]):util[_0x1779('0xae')]('iftime\x20%s',_0x12415a[_0x1779('0xed')])},client9002)[_0x1779('0x25')](function(_0x12263c){var _0x2a54e2=_0x12263c&&_0x12263c[_0x1779('0xee')](_0x1779('0xef'))>=0x0?!![]:![];logger[_0x1779('0x26')](_0x1779('0xf0'),_0x5edd3e['id'],_0x12415a['id'],_0x12415a[_0x1779('0xed')],_0x2a54e2?_0x1779('0xf1'):_0x1779('0xf2'),_0x5edd3e[_0x1779('0xeb')]?_0x5edd3e['timezone']:_0x1779('0xf3'));return _0x2a54e2;})[_0x1779('0x2e')](function(_0x3766a3){logger['error'](_0x1779('0xf0'),_0x5edd3e['id'],_0x12415a['id'],_0x12415a['interval'],util[_0x1779('0xf4')](_0x3766a3,{'showHidden':![],'depth':null}),_0x5edd3e[_0x1779('0xeb')]?_0x5edd3e[_0x1779('0xeb')]:_0x1779('0xf3'));return![];});}exports['getSnippet']=function(_0x2fee15,_0x5a858b,_0x52cdda){var _0x2a02f2=0x0;var _0x178064=0x0;var _0x404ff1=![];var _0xb9bceb;var _0x4252f0;return db[_0x1779('0x41')][_0x1779('0x62')]({'where':{'id':_0x2fee15[_0x1779('0x59')]['id']},'include':[{'model':db[_0x1779('0xf5')],'as':_0x1779('0xf5'),'include':[{'model':db[_0x1779('0xf5')],'as':'Intervals','attributes':['id',_0x1779('0xed')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5a858b,null))[_0x1779('0x25')](function(_0x4c8a74){if(_0x4c8a74){_0xb9bceb=_0x4c8a74;return _0x4c8a74['getProactiveActions']({'raw':!![]});}})[_0x1779('0x25')](function(_0x5e0a6e){if(_0xb9bceb){if(_0x5e0a6e){_0x4252f0=_0x5e0a6e;}}return require(_0x1779('0x1b'))[_0x1779('0x7b')]();})[_0x1779('0x25')](function(_0x42ed2a){if(_0x42ed2a){_0x178064=_0x42ed2a['virtual'];_0x404ff1=_0x42ed2a[_0x1779('0x7c')];}})[_0x1779('0x25')](function(){return db[_0x1779('0xb6')]['count']({'where':{'closed':![]}});})[_0x1779('0x25')](function(_0x4738fb){_0x2a02f2=_0x4738fb;if(_0x178064&&_0x4738fb>_0x178064){return db[_0x1779('0xf6')][_0x1779('0x6a')]({'where':{'id':0x1}})[_0x1779('0x25')](function(_0x4125b7){if(_0x4125b7){_0x4125b7[_0x1779('0xf7')](_0x1779('0xf8'));}});}})[_0x1779('0x25')](function(){if(_0xb9bceb['Interval']&&_0xb9bceb[_0x1779('0xf5')]['Intervals']){var _0xc1d1fa=[];for(var _0x1213e8=0x0;_0x1213e8<_0xb9bceb[_0x1779('0xf5')][_0x1779('0xf9')][_0x1779('0x4c')];_0x1213e8++){var _0x2a0b19=_0xb9bceb[_0x1779('0xf5')][_0x1779('0xf9')][_0x1213e8][_0x1779('0x3b')]({'plain':!![]});_0xc1d1fa[_0x1779('0xfa')](iftimePromise(_0x2a0b19,_0xb9bceb));}return BPromise['all'](_0xc1d1fa)[_0x1779('0x25')](function(_0x555223){return _[_0x1779('0xfb')](_0x555223);});}else{return!![];}})[_0x1779('0x25')](function(_0x5d8f6d){var _0x4ae3fc=fs[_0x1779('0xfc')](path['join'](config['root'],_0x1779('0xfd')),'utf8');var _0x37905b={'remote':_0xb9bceb[_0x1779('0xfe')],'query':querystring[_0x1779('0x2b')](_[_0x1779('0x52')](_0xb9bceb['get']({'plain':!![]}),{'customerIp':_0x2fee15[_0x1779('0xa6')][_0x1779('0xa8')]||_0x2fee15[_0x1779('0xa6')]['x-real-ip']||_0x2fee15[_0x1779('0xff')][_0x1779('0x100')]||_0x2fee15['ip'],'referer':_0x2fee15[_0x1779('0xa6')][_0x1779('0x101')],'openedInteractions':_0x2a02f2,'maxInteractions':_0x178064,'virtual':_0x404ff1[_0x1779('0x102')],'online':_0x5d8f6d,'custom':_0x404ff1}))[_0x1779('0x103')](/'/g,'\x5c\x27')};_0x5a858b['send'](ejs[_0x1779('0xd0')](Mustache[_0x1779('0xd0')](_0x4ae3fc,_0x37905b),{'proactiveActions':_0x4252f0,'alignment':_0xb9bceb[_0x1779('0x104')],'verticalAlignment':_0xb9bceb['verticalAlignment'],'div_color':_0xb9bceb['color'],'text_color':_0xb9bceb['textColor']}));})[_0x1779('0x2e')](handleError(_0x5a858b,null));};exports[_0x1779('0x105')]=function(_0x3bf1e5,_0x44a8ca,_0x2e4b32){return db['ChatWebsite']['findOne']({'where':{'id':_0x3bf1e5[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x44a8ca,null))[_0x1779('0x25')](function(_0x3ab7c9){if(_0x3ab7c9){return db[_0x1779('0x106')][_0x1779('0x107')](function(_0x1da2f8){return db['ChatApplication'][_0x1779('0x3a')]({'where':{'ChatWebsiteId':_0x3bf1e5[_0x1779('0x59')]['id']},'transaction':_0x1da2f8})[_0x1779('0x25')](function(_0x48ec3c){var _0xeffe81=_[_0x1779('0x40')](_0x3bf1e5['body'],function(_0x4d81ae){_0x4d81ae[_0x1779('0x67')]=_0x3bf1e5['params']['id'];return _0x4d81ae;});return db[_0x1779('0x9e')][_0x1779('0x108')](_0xeffe81,{'transaction':_0x1da2f8});});})[_0x1779('0x25')](function(){return db[_0x1779('0x9e')][_0x1779('0x109')]({'where':{'ChatWebsiteId':_0x3bf1e5['params']['id']},'order':_0x1779('0x10a')});});}})[_0x1779('0x25')](respondWithResult(_0x44a8ca,null))[_0x1779('0x2e')](handleError(_0x44a8ca,null));};exports[_0x1779('0x10b')]=function(_0x928a6,_0x2f2125,_0x4eb054){var _0x1e5410={};var _0x56ab6b={};var _0x1adabd;var _0x2dd0bd;return db[_0x1779('0x41')][_0x1779('0x6a')]({'where':{'id':_0x928a6['params']['id']}})['then'](handleEntityNotFound(_0x2f2125,null))[_0x1779('0x25')](function(_0x3cb3cc){if(_0x3cb3cc){_0x1adabd=_0x3cb3cc;_0x56ab6b[_0x1779('0x46')]=_[_0x1779('0x47')](db[_0x1779('0x9e')][_0x1779('0x42')]);_0x56ab6b['query']=_[_0x1779('0x47')](_0x928a6[_0x1779('0x48')]);_0x56ab6b[_0x1779('0x49')]=_['intersection'](_0x56ab6b[_0x1779('0x46')],_0x56ab6b['query']);_0x1e5410['attributes']=_[_0x1779('0x4a')](_0x56ab6b[_0x1779('0x46')],qs[_0x1779('0x5a')](_0x928a6['query'][_0x1779('0x5a')]));_0x1e5410[_0x1779('0x4b')]=_0x1e5410['attributes'][_0x1779('0x4c')]?_0x1e5410[_0x1779('0x4b')]:_0x56ab6b[_0x1779('0x46')];_0x1e5410[_0x1779('0x4f')]=qs[_0x1779('0x50')](_0x928a6[_0x1779('0x48')]['sort']);_0x1e5410[_0x1779('0x53')]=qs['filters'](_[_0x1779('0x6e')](_0x928a6['query'],_0x56ab6b[_0x1779('0x49')]));if(_0x928a6[_0x1779('0x48')][_0x1779('0x51')]){_0x1e5410[_0x1779('0x53')]=_[_0x1779('0x52')](_0x1e5410[_0x1779('0x53')],{'$or':_[_0x1779('0x40')](_0x1e5410[_0x1779('0x4b')],function(_0x591f0b){var _0x3a331b={};_0x3a331b[_0x591f0b]={'$like':'%'+_0x928a6[_0x1779('0x48')][_0x1779('0x51')]+'%'};return _0x3a331b;})});}_0x1e5410=_[_0x1779('0x52')]({},_0x1e5410,_0x928a6['options']);return _0x1adabd[_0x1779('0x10b')](_0x1e5410);}})['then'](function(_0x58275e){if(_0x58275e){_0x2dd0bd=_0x58275e['length'];if(!_0x928a6[_0x1779('0x48')]['hasOwnProperty']('nolimit')){_0x1e5410[_0x1779('0x35')]=qs['limit'](_0x928a6[_0x1779('0x48')][_0x1779('0x35')]);_0x1e5410[_0x1779('0x34')]=qs[_0x1779('0x34')](_0x928a6['query']['offset']);}return _0x1adabd['getApplications'](_0x1e5410);}})[_0x1779('0x25')](function(_0x363bdd){if(_0x363bdd){return _0x363bdd?{'count':_0x2dd0bd,'rows':_0x363bdd}:null;}})['then'](respondWithResult(_0x2f2125,null))['catch'](handleError(_0x2f2125,null));};exports[_0x1779('0x10c')]=function(_0x4b96a5,_0x469d84,_0x475f95){return db[_0x1779('0x10d')]['find']({'where':{'id':_0x4b96a5[_0x1779('0x59')]['id']}})['then'](handleEntityNotFound(_0x469d84,null))[_0x1779('0x25')](function(_0x5c2c92){if(_0x5c2c92){return _0x5c2c92['addProactiveActions'](_0x4b96a5[_0x1779('0x5c')][_0x1779('0x70')],_[_0x1779('0xe1')](_0x4b96a5['body'],[_0x1779('0x70'),'id'])||{});}})['then'](respondWithResult(_0x469d84,null))[_0x1779('0x2e')](handleError(_0x469d84,null));};exports[_0x1779('0x10e')]=function(_0x370c77,_0x43187a,_0x2bd780){var _0x20ebea={};var _0x5ea109={};var _0x5831c6;var _0x310dce;return db[_0x1779('0x41')][_0x1779('0x6a')]({'where':{'id':_0x370c77[_0x1779('0x59')]['id']}})['then'](handleEntityNotFound(_0x43187a,null))['then'](function(_0x19ef0a){if(_0x19ef0a){_0x5831c6=_0x19ef0a;_0x5ea109[_0x1779('0x46')]=_['keys'](db[_0x1779('0x10f')]['rawAttributes']);_0x5ea109[_0x1779('0x48')]=_[_0x1779('0x47')](_0x370c77[_0x1779('0x48')]);_0x5ea109[_0x1779('0x49')]=_[_0x1779('0x4a')](_0x5ea109[_0x1779('0x46')],_0x5ea109['query']);_0x20ebea[_0x1779('0x4b')]=_['intersection'](_0x5ea109[_0x1779('0x46')],qs[_0x1779('0x5a')](_0x370c77[_0x1779('0x48')][_0x1779('0x5a')]));_0x20ebea[_0x1779('0x4b')]=_0x20ebea['attributes']['length']?_0x20ebea['attributes']:_0x5ea109[_0x1779('0x46')];_0x20ebea[_0x1779('0x4f')]=qs[_0x1779('0x50')](_0x370c77['query'][_0x1779('0x50')]);_0x20ebea['where']=qs[_0x1779('0x49')](_[_0x1779('0x6e')](_0x370c77['query'],_0x5ea109['filters']));if(_0x370c77['query'][_0x1779('0x51')]){_0x20ebea[_0x1779('0x53')]=_['merge'](_0x20ebea[_0x1779('0x53')],{'$or':_[_0x1779('0x40')](_0x20ebea['attributes'],function(_0x10208d){var _0x3c68ac={};_0x3c68ac[_0x10208d]={'$like':'%'+_0x370c77[_0x1779('0x48')][_0x1779('0x51')]+'%'};return _0x3c68ac;})});}_0x20ebea=_[_0x1779('0x52')]({},_0x20ebea,_0x370c77[_0x1779('0x55')]);return _0x5831c6[_0x1779('0x10e')](_0x20ebea);}})[_0x1779('0x25')](function(_0xa0a06f){if(_0xa0a06f){_0x310dce=_0xa0a06f[_0x1779('0x4c')];if(!_0x370c77['query'][_0x1779('0x4d')](_0x1779('0x4e'))){_0x20ebea['limit']=qs[_0x1779('0x35')](_0x370c77['query'][_0x1779('0x35')]);_0x20ebea[_0x1779('0x34')]=qs['offset'](_0x370c77[_0x1779('0x48')]['offset']);}return _0x5831c6[_0x1779('0x10e')](_0x20ebea);}})[_0x1779('0x25')](function(_0x304d33){if(_0x304d33){return _0x304d33?{'count':_0x310dce,'rows':_0x304d33}:null;}})['then'](respondWithResult(_0x43187a,null))[_0x1779('0x2e')](handleError(_0x43187a,null));};exports[_0x1779('0x110')]=function(_0x5273b7,_0x305df6,_0x2143a3){var _0x771074=_0x5273b7[_0x1779('0x48')]['online']===_0x1779('0x111')?_0x1779('0x112'):_0x1779('0x113');return db['ChatWebsite']['find']({'attributes':['id',_0x771074],'where':{'id':_0x5273b7[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x305df6,null))['then'](function(_0x450863){if(_0x450863){var _0x43d299=_0x450863[_0x771074];var _0x546cbf=_0x43d299&&_0x43d299[_0x1779('0x114')]?_0x43d299[_0x1779('0x114')]:[];_0x305df6[_0x1779('0x3d')]({'fromKey':_[_0x1779('0x7d')](_0x43d299[_0x1779('0x115')])?undefined:_0x43d299[_0x1779('0x115')],'count':_0x546cbf[_0x1779('0x4c')],'rows':_0x546cbf});}})[_0x1779('0x2e')](handleError(_0x305df6,null));};exports['getOfflineMessages']=function(_0x377425,_0x36c52e,_0x1d8a93){var _0xda2fb5={'raw':![],'where':{}};var _0x832ca2={};var _0xb31c6d={'count':0x0,'rows':[]};return db[_0x1779('0x41')]['findOne']({'where':{'id':_0x377425['params']['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x36c52e,null))['then'](function(_0x4983e3){if(_0x4983e3){_0x832ca2['model']=_[_0x1779('0x47')](db[_0x1779('0xd2')][_0x1779('0x42')]);_0x832ca2[_0x1779('0x48')]=_[_0x1779('0x47')](_0x377425[_0x1779('0x48')]);_0x832ca2[_0x1779('0x49')]=_[_0x1779('0x4a')](_0x832ca2[_0x1779('0x46')],_0x832ca2['query']);_0xda2fb5[_0x1779('0x4b')]=_['intersection'](_0x832ca2['model'],qs[_0x1779('0x5a')](_0x377425['query'][_0x1779('0x5a')]));_0xda2fb5['attributes']=_0xda2fb5[_0x1779('0x4b')][_0x1779('0x4c')]?_0xda2fb5[_0x1779('0x4b')]:_0x832ca2['model'];if(!_0x377425[_0x1779('0x48')][_0x1779('0x4d')](_0x1779('0x4e'))){_0xda2fb5[_0x1779('0x35')]=qs['limit'](_0x377425[_0x1779('0x48')][_0x1779('0x35')]);_0xda2fb5[_0x1779('0x34')]=qs[_0x1779('0x34')](_0x377425[_0x1779('0x48')]['offset']);}_0xda2fb5['order']=qs['sort'](_0x377425[_0x1779('0x48')]['sort']);_0xda2fb5[_0x1779('0x53')]=qs[_0x1779('0x49')](_[_0x1779('0x6e')](_0x377425['query'],_0x832ca2[_0x1779('0x49')]));_0xda2fb5[_0x1779('0x53')]['ChatWebsiteId']=_0x4983e3['id'];if(_0x377425[_0x1779('0x48')][_0x1779('0x51')]){_0xda2fb5[_0x1779('0x53')]=_[_0x1779('0x52')](_0xda2fb5[_0x1779('0x53')],{'$or':_['map'](_0xda2fb5[_0x1779('0x4b')],function(_0x3773c7){var _0x1d50a4={};_0x1d50a4[_0x3773c7]={'$like':'%'+_0x377425['query']['filter']+'%'};return _0x1d50a4;})});}_0xda2fb5=_[_0x1779('0x52')]({},_0xda2fb5,_0x377425[_0x1779('0x55')]);return db[_0x1779('0xd2')][_0x1779('0x33')]({'where':_0xda2fb5[_0x1779('0x53')]})[_0x1779('0x25')](function(_0x12a255){_0xb31c6d[_0x1779('0x33')]=_0x12a255;if(_0x377425['query']['includeAll']){_0xda2fb5[_0x1779('0x57')]=[{'all':!![]}];}else{_0xda2fb5[_0x1779('0x57')]=[{'model':db[_0x1779('0x8d')],'as':_0x1779('0xe3'),'required':![]}];}return db[_0x1779('0xd2')]['findAll'](_0xda2fb5);})[_0x1779('0x25')](function(_0x4dd5d2){_0xb31c6d['rows']=_0x4dd5d2;return _0xb31c6d;});}})[_0x1779('0x25')](respondWithFilteredResult(_0x36c52e,_0xda2fb5))[_0x1779('0x2e')](handleError(_0x36c52e,null));};exports[_0x1779('0x116')]=function(_0x2c11ef,_0x181287,_0x53be52){return db[_0x1779('0x41')][_0x1779('0x62')]({'where':{'id':_0x2c11ef['params']['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x181287,null))[_0x1779('0x25')](function(_0x1ed058){if(_0x1ed058){return _0x1ed058[_0x1779('0x116')](_0x2c11ef['body'][_0x1779('0x70')],_[_0x1779('0xe1')](_0x2c11ef[_0x1779('0x5c')],[_0x1779('0x70'),'id'])||{})[_0x1779('0xb9')](function(_0x28ac53){for(var _0x52de17=0x0;_0x52de17<_0x2c11ef[_0x1779('0x5c')][_0x1779('0x70')][_0x1779('0x4c')];_0x52de17+=0x1){socket[_0x1779('0x117')]('userChatWebsite:save',{'UserId':_0x2c11ef[_0x1779('0x5c')][_0x1779('0x70')][_0x52de17],'ChatWebsiteId':_0x2c11ef[_0x1779('0x59')]['id']});}return _0x28ac53;});}})[_0x1779('0x25')](respondWithResult(_0x181287,null))[_0x1779('0x2e')](handleError(_0x181287,null));};exports[_0x1779('0x118')]=function(_0x1fe8c7,_0x48206b,_0x1d62fc){return db[_0x1779('0x41')][_0x1779('0x62')]({'where':{'id':_0x1fe8c7[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x48206b,null))[_0x1779('0x25')](function(_0x5895dd){if(_0x5895dd){return _0x5895dd[_0x1779('0x118')](_0x1fe8c7['query']['ids'])[_0x1779('0x25')](function(){if(_[_0x1779('0x119')](_0x1fe8c7[_0x1779('0x48')][_0x1779('0x70')])){for(var _0x4a5c36=0x0;_0x4a5c36<_0x1fe8c7['query'][_0x1779('0x70')][_0x1779('0x4c')];_0x4a5c36+=0x1){socket[_0x1779('0x117')](_0x1779('0x11a'),{'UserId':Number(_0x1fe8c7['query']['ids'][_0x4a5c36]),'ChatWebsiteId':Number(_0x1fe8c7[_0x1779('0x59')]['id'])});}}else{socket[_0x1779('0x117')](_0x1779('0x11a'),{'UserId':Number(_0x1fe8c7[_0x1779('0x48')][_0x1779('0x70')]),'ChatWebsiteId':Number(_0x1fe8c7[_0x1779('0x59')]['id'])});}});}})[_0x1779('0x25')](respondWithStatusCode(_0x48206b,null))['catch'](handleError(_0x48206b,null));};exports[_0x1779('0x11b')]=function(_0x5b9d58,_0x4a57d4,_0xc2200){var _0x13ea6f={};var _0x2f7bfa={};var _0x15adc7;var _0xba34a7;return db[_0x1779('0x41')]['findOne']({'where':{'id':_0x5b9d58[_0x1779('0x59')]['id']}})[_0x1779('0x25')](handleEntityNotFound(_0x4a57d4,null))[_0x1779('0x25')](function(_0x158db8){if(_0x158db8){_0x15adc7=_0x158db8;_0x2f7bfa[_0x1779('0x46')]=_[_0x1779('0x47')](db[_0x1779('0xe4')][_0x1779('0x42')]);_0x2f7bfa[_0x1779('0x48')]=_[_0x1779('0x47')](_0x5b9d58[_0x1779('0x48')]);_0x2f7bfa[_0x1779('0x49')]=_['intersection'](_0x2f7bfa[_0x1779('0x46')],_0x2f7bfa[_0x1779('0x48')]);_0x13ea6f[_0x1779('0x4b')]=_[_0x1779('0x4a')](_0x2f7bfa['model'],qs['fields'](_0x5b9d58[_0x1779('0x48')][_0x1779('0x5a')]));_0x13ea6f[_0x1779('0x4b')]=_0x13ea6f[_0x1779('0x4b')]['length']?_0x13ea6f[_0x1779('0x4b')]:_0x2f7bfa[_0x1779('0x46')];_0x13ea6f[_0x1779('0x4f')]=qs[_0x1779('0x50')](_0x5b9d58['query'][_0x1779('0x50')]);_0x13ea6f[_0x1779('0x53')]=qs['filters'](_['pick'](_0x5b9d58[_0x1779('0x48')],_0x2f7bfa[_0x1779('0x49')]));if(_0x5b9d58[_0x1779('0x48')][_0x1779('0x51')]){_0x13ea6f[_0x1779('0x53')]=_[_0x1779('0x52')](_0x13ea6f['where'],{'$or':_['map'](_0x13ea6f[_0x1779('0x4b')],function(_0x54c11e){var _0x330eae={};_0x330eae[_0x54c11e]={'$like':'%'+_0x5b9d58[_0x1779('0x48')][_0x1779('0x51')]+'%'};return _0x330eae;})});}_0x13ea6f=_[_0x1779('0x52')]({},_0x13ea6f,_0x5b9d58['options']);return _0x15adc7[_0x1779('0x11b')](_0x13ea6f);}})[_0x1779('0x25')](function(_0x2a9c55){if(_0x2a9c55){_0xba34a7=_0x2a9c55[_0x1779('0x4c')];if(!_0x5b9d58['query'][_0x1779('0x4d')]('nolimit')){_0x13ea6f['limit']=qs[_0x1779('0x35')](_0x5b9d58[_0x1779('0x48')][_0x1779('0x35')]);_0x13ea6f['offset']=qs['offset'](_0x5b9d58['query'][_0x1779('0x34')]);}return _0x15adc7[_0x1779('0x11b')](_0x13ea6f);}})['then'](function(_0x1afeed){if(_0x1afeed){return _0x1afeed?{'count':_0xba34a7,'rows':_0x1afeed}:null;}})[_0x1779('0x25')](respondWithResult(_0x4a57d4,null))[_0x1779('0x2e')](handleError(_0x4a57d4,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3ee4504..aab4403 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 _0xa1a5=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x198b4d,_0xd5c48e){_0x198b4d=_0x198b4d-0x0;var _0x4546e9=_0xa1a5[_0x198b4d];return _0x4546e9;};'use strict';var EventEmitter=require(_0x5a1a('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x5a1a('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x5a1a('0x2')](0x0);var events={'afterCreate':_0x5a1a('0x3'),'afterUpdate':_0x5a1a('0x4'),'afterDestroy':_0x5a1a('0x5')};function emitEvent(_0x57cba4){return function(_0x3d3652,_0x12138d,_0xfbcda1){ChatWebsiteEvents[_0x5a1a('0x6')](_0x57cba4+':'+_0x3d3652['id'],_0x3d3652);ChatWebsiteEvents[_0x5a1a('0x6')](_0x57cba4,_0x3d3652);_0xfbcda1(null);};}for(var e in events){if(events[_0x5a1a('0x7')](e)){var event=events[e];ChatWebsite[_0x5a1a('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xe599=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save'];(function(_0x210051,_0x58a9eb){var _0x2f7709=function(_0x56aeb2){while(--_0x56aeb2){_0x210051['push'](_0x210051['shift']());}};_0x2f7709(++_0x58a9eb);}(_0xe599,0x1e5));var _0x9e59=function(_0x472531,_0x1d2b2c){_0x472531=_0x472531-0x0;var _0x1922ec=_0xe599[_0x472531];return _0x1922ec;};'use strict';var EventEmitter=require(_0x9e59('0x0'));var ChatWebsite=require(_0x9e59('0x1'))['db'][_0x9e59('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9e59('0x3')](0x0);var events={'afterCreate':_0x9e59('0x4'),'afterUpdate':_0x9e59('0x5'),'afterDestroy':_0x9e59('0x6')};function emitEvent(_0x296a98){return function(_0x3b40cc,_0x568c08,_0x156af6){ChatWebsiteEvents[_0x9e59('0x7')](_0x296a98+':'+_0x3b40cc['id'],_0x3b40cc);ChatWebsiteEvents['emit'](_0x296a98,_0x3b40cc);_0x156af6(null);};}for(var e in events){if(events[_0x9e59('0x8')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x9e59('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e783f0c..ab532ea 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 _0x6953=['../../config/environment','exports','define','ChatWebsite','chat_websites','lodash','util','bluebird','path','rimraf'];(function(_0x3bb651,_0xe2503e){var _0x429075=function(_0x47980f){while(--_0x47980f){_0x3bb651['push'](_0x3bb651['shift']());}};_0x429075(++_0xe2503e);}(_0x6953,0x91));var _0x3695=function(_0x57b96a,_0x14b0cc){_0x57b96a=_0x57b96a-0x0;var _0x53f527=_0x6953[_0x57b96a];return _0x53f527;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3695('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3695('0x3'));var rimraf=require(_0x3695('0x4'));var config=require(_0x3695('0x5'));var attributes=require('./chatWebsite.attributes');module[_0x3695('0x6')]=function(_0x558026,_0x2d7d98){return _0x558026[_0x3695('0x7')](_0x3695('0x8'),attributes,{'tableName':_0x3695('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00b3=['util','../../config/logger','api','moment','request-promise','rimraf','./chatWebsite.attributes','exports','chat_websites'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0x00b3,0x17a));var _0x300b=function(_0x5cc9e3,_0xf8dc92){_0x5cc9e3=_0x5cc9e3-0x0;var _0x555212=_0x00b3[_0x5cc9e3];return _0x555212;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var logger=require(_0x300b('0x1'))(_0x300b('0x2'));var moment=require(_0x300b('0x3'));var BPromise=require('bluebird');var rp=require(_0x300b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x300b('0x5'));var config=require('../../config/environment');var attributes=require(_0x300b('0x6'));module[_0x300b('0x7')]=function(_0x3a8c64,_0x10b0a2){return _0x3a8c64['define']('ChatWebsite',attributes,{'tableName':_0x300b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 7e6378e..bd68b56 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 _0x524e=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment'];(function(_0x539709,_0x2c9edd){var _0x73cc7e=function(_0x5d20ea){while(--_0x5d20ea){_0x539709['push'](_0x539709['shift']());}};_0x73cc7e(++_0x2c9edd);}(_0x524e,0x15e));var _0xe524=function(_0x31aa51,_0x64a752){_0x31aa51=_0x31aa51-0x0;var _0x5612bd=_0x524e[_0x31aa51];return _0x5612bd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});config[_0xe524('0xb')]=_[_0xe524('0xc')](config['redis'],{'host':_0xe524('0xd'),'port':0x18eb});var socket=require(_0xe524('0xe'))(new Redis(config[_0xe524('0xb')]));require(_0xe524('0xf'))[_0xe524('0x10')](socket);function respondWithRpcPromise(_0x4082b1,_0x1a08e2,_0xb3eb9f){return new BPromise(function(_0x1b75bd,_0x1641ec){return client[_0xe524('0x11')](_0x4082b1,_0xb3eb9f)[_0xe524('0x12')](function(_0x1184df){logger[_0xe524('0x13')](_0xe524('0x14'),_0x1a08e2,_0xe524('0x15'));logger['debug']('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1a08e2,_0xe524('0x15'),JSON[_0xe524('0x16')](_0x1184df));if(_0x1184df[_0xe524('0x17')]){if(_0x1184df[_0xe524('0x17')][_0xe524('0x18')]===0x1f4){logger['error'](_0xe524('0x14'),_0x1a08e2,_0x1184df['error'][_0xe524('0x19')]);return _0x1641ec(_0x1184df[_0xe524('0x17')]['message']);}logger[_0xe524('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1a08e2,_0x1184df[_0xe524('0x17')]['message']);return _0x1b75bd(_0x1184df[_0xe524('0x17')]['message']);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1a08e2,_0xe524('0x15'));_0x1b75bd(_0x1184df['result'][_0xe524('0x19')]);}})[_0xe524('0x1a')](function(_0x278de9){logger[_0xe524('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1a08e2,_0x278de9);_0x1641ec(_0x278de9);});});} \ No newline at end of file +var _0x687b=['request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register'];(function(_0x4be0e0,_0x55c777){var _0x5c8b77=function(_0x23cc3e){while(--_0x23cc3e){_0x4be0e0['push'](_0x4be0e0['shift']());}};_0x5c8b77(++_0x55c777);}(_0x687b,0x14a));var _0xb687=function(_0x3d9cfa,_0x596edc){_0x3d9cfa=_0x3d9cfa-0x0;var _0x21d89d=_0x687b[_0x3d9cfa];return _0x21d89d;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});config[_0xb687('0xc')]=_[_0xb687('0xd')](config['redis'],{'host':_0xb687('0xe'),'port':0x18eb});var socket=require(_0xb687('0xf'))(new Redis(config['redis']));require(_0xb687('0x10'))[_0xb687('0x11')](socket);function respondWithRpcPromise(_0x825ad,_0x15dc9a,_0x404fdb){return new BPromise(function(_0x309d84,_0x3e6271){return client[_0xb687('0x12')](_0x825ad,_0x404fdb)[_0xb687('0x13')](function(_0x5103b9){logger[_0xb687('0x14')](_0xb687('0x15'),_0x15dc9a,_0xb687('0x16'));logger[_0xb687('0x17')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x15dc9a,'request\x20sent',JSON[_0xb687('0x18')](_0x5103b9));if(_0x5103b9[_0xb687('0x19')]){if(_0x5103b9['error'][_0xb687('0x1a')]===0x1f4){logger[_0xb687('0x19')](_0xb687('0x15'),_0x15dc9a,_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);return _0x3e6271(_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);}logger[_0xb687('0x19')](_0xb687('0x15'),_0x15dc9a,_0x5103b9[_0xb687('0x19')][_0xb687('0x1b')]);return _0x309d84(_0x5103b9[_0xb687('0x19')]['message']);}else{logger[_0xb687('0x14')](_0xb687('0x15'),_0x15dc9a,_0xb687('0x16'));_0x309d84(_0x5103b9['result']['message']);}})[_0xb687('0x1c')](function(_0x3a10ef){logger[_0xb687('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x15dc9a,_0x3a10ef);_0x3e6271(_0x3a10ef);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 11f824e..b41c6ef 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 _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4eec46,_0x513505){var _0x125ca7=function(_0x6cdfb6){while(--_0x6cdfb6){_0x4eec46['push'](_0x4eec46['shift']());}};_0x125ca7(++_0x513505);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f06e0,_0x2e1c2a){_0x2f06e0=_0x2f06e0-0x0;var _0xf2711b=_0x5f2f[_0x2f06e0];return _0xf2711b;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x2a5042,_0x307d04){var _0x4bc22f=function(_0x2ef928){while(--_0x2ef928){_0x2a5042['push'](_0x2a5042['shift']());}};_0x4bc22f(++_0x307d04);}(_0xb10b,0x12a));var _0xbb10=function(_0xbd3a05,_0xe6c6b7){_0xbd3a05=_0xbd3a05-0x0;var _0x101f90=_0xb10b[_0xbd3a05];return _0x101f90;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index cb4b9b9..c943e1a 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 _0xbe7f=['/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','file','addLogo','join','server/files/images/avatars/','/:id/avatar','originalname','single','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','/:id/interactions','addInteraction','addProactiveActions','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','index','/describe','isAuthenticated','get','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xbe7f,0xa7));var _0xfbe7=function(_0x23d7a7,_0x4b0f57){_0x23d7a7=_0x23d7a7-0x0;var _0x43f390=_0xbe7f[_0x23d7a7];return _0x43f390;};'use strict';var multer=require(_0xfbe7('0x0'));var util=require(_0xfbe7('0x1'));var path=require(_0xfbe7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfbe7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xfbe7('0x4'));var config=require(_0xfbe7('0x5'));var controller=require(_0xfbe7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xfbe7('0x7')]);router['get'](_0xfbe7('0x8'),auth[_0xfbe7('0x9')](),controller['describe']);router[_0xfbe7('0xa')]('/:id',auth[_0xfbe7('0x9')](),controller['show']);router['get'](_0xfbe7('0xb'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0xc')]);router['get'](_0xfbe7('0xd'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0xe')]);router['get'](_0xfbe7('0xf'),controller[_0xfbe7('0x10')]);router[_0xfbe7('0xa')]('/:id/avatar',controller['getAvatar']);router['get'](_0xfbe7('0x11'),controller[_0xfbe7('0x12')]);router[_0xfbe7('0xa')]('/:id/system_avatar',controller[_0xfbe7('0x13')]);router[_0xfbe7('0xa')]('/:id/interactions',auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x14')]);router[_0xfbe7('0xa')]('/:id/snippet',controller[_0xfbe7('0x15')]);router[_0xfbe7('0xa')](_0xfbe7('0x16'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x17')]);router['get'](_0xfbe7('0x18'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x19')]);router[_0xfbe7('0xa')](_0xfbe7('0x1a'),controller[_0xfbe7('0x1b')]);router[_0xfbe7('0xa')](_0xfbe7('0x1c'),auth['isAuthenticated'](),controller[_0xfbe7('0x1d')]);router[_0xfbe7('0xa')](_0xfbe7('0x1e'),auth[_0xfbe7('0x9')](),controller['getAgents']);router[_0xfbe7('0x1f')]('/',auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x20')]);router[_0xfbe7('0x1f')](_0xfbe7('0xb'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x21')]);router[_0xfbe7('0x1f')]('/:id/canned_answers',auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x22')]);var upload=multer({'storage':multer[_0xfbe7('0x23')]({'destination':function(_0x12f0dd,_0x4f3273,_0x31252d){_0x31252d(null,path['join'](config[_0xfbe7('0x24')],_0xfbe7('0x25')));},'filename':function(_0x2bb79c,_0x1cdba9,_0x162438){_0x162438(null,util[_0xfbe7('0x26')](_0xfbe7('0x27'),Date[_0xfbe7('0x28')](),_0x1cdba9['originalname']));}})});router['post'](_0xfbe7('0xf'),upload['single'](_0xfbe7('0x29')),controller[_0xfbe7('0x2a')]);var upload=multer({'storage':multer[_0xfbe7('0x23')]({'destination':function(_0x2253d1,_0x2328b7,_0x46264e){_0x46264e(null,path[_0xfbe7('0x2b')](config[_0xfbe7('0x24')],_0xfbe7('0x2c')));},'filename':function(_0x20e300,_0x151f25,_0x1b994){_0x1b994(null,util['format'](_0xfbe7('0x27'),Date['now'](),_0x151f25['originalname']));}})});router['post'](_0xfbe7('0x2d'),upload['single'](_0xfbe7('0x29')),controller['addAvatar']);var upload=multer({'storage':multer[_0xfbe7('0x23')]({'destination':function(_0x430428,_0x3ff9cb,_0x571593){_0x571593(null,path[_0xfbe7('0x2b')](config[_0xfbe7('0x24')],_0xfbe7('0x2c')));},'filename':function(_0x37a41d,_0x42c612,_0x5e4e66){_0x5e4e66(null,util[_0xfbe7('0x26')](_0xfbe7('0x27'),Date[_0xfbe7('0x28')](),_0x42c612[_0xfbe7('0x2e')]));}})});router[_0xfbe7('0x1f')](_0xfbe7('0x11'),upload[_0xfbe7('0x2f')](_0xfbe7('0x29')),controller[_0xfbe7('0x30')]);var upload=multer({'storage':multer[_0xfbe7('0x23')]({'destination':function(_0x2e8215,_0x236fe8,_0x4c7c8f){_0x4c7c8f(null,path[_0xfbe7('0x2b')](config[_0xfbe7('0x24')],_0xfbe7('0x2c')));},'filename':function(_0x2942b7,_0x5e2e3e,_0x3aada4){_0x3aada4(null,util[_0xfbe7('0x26')](_0xfbe7('0x27'),Date['now'](),_0x5e2e3e[_0xfbe7('0x2e')]));}})});router[_0xfbe7('0x1f')](_0xfbe7('0x31'),upload[_0xfbe7('0x2f')](_0xfbe7('0x29')),controller[_0xfbe7('0x32')]);router[_0xfbe7('0x1f')](_0xfbe7('0x33'),controller[_0xfbe7('0x34')]);router[_0xfbe7('0x1f')](_0xfbe7('0x35'),controller[_0xfbe7('0x36')]);router[_0xfbe7('0x1f')](_0xfbe7('0x37'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x38')]);router['post'](_0xfbe7('0x16'),auth[_0xfbe7('0x9')](),controller['addApplications']);router['post'](_0xfbe7('0x18'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x39')]);router[_0xfbe7('0x1f')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0xfbe7('0x3a')](_0xfbe7('0x3b'),auth['isAuthenticated'](),controller[_0xfbe7('0x3c')]);router[_0xfbe7('0x3d')](_0xfbe7('0x3b'),auth[_0xfbe7('0x9')](),controller['destroy']);router[_0xfbe7('0x3d')](_0xfbe7('0xb'),auth['isAuthenticated'](),controller[_0xfbe7('0x3e')]);router[_0xfbe7('0x3d')]('/:id/canned_answers',auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x3f')]);router[_0xfbe7('0x3d')](_0xfbe7('0x1e'),auth[_0xfbe7('0x9')](),controller[_0xfbe7('0x40')]);module['exports']=router; \ No newline at end of file +var _0x5f3e=['put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','single','addLogo','server/files/images/avatars/','originalname','file','addAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction'];(function(_0x407b52,_0x5ddf71){var _0x58f49c=function(_0x1bd2cb){while(--_0x1bd2cb){_0x407b52['push'](_0x407b52['shift']());}};_0x58f49c(++_0x5ddf71);}(_0x5f3e,0x117));var _0xe5f3=function(_0x3d9167,_0x2439d3){_0x3d9167=_0x3d9167-0x0;var _0x3c85be=_0x5f3e[_0x3d9167];return _0x3c85be;};'use strict';var multer=require(_0xe5f3('0x0'));var util=require(_0xe5f3('0x1'));var path=require(_0xe5f3('0x2'));var timeout=require(_0xe5f3('0x3'));var express=require(_0xe5f3('0x4'));var router=express[_0xe5f3('0x5')]();var auth=require(_0xe5f3('0x6'));var interaction=require(_0xe5f3('0x7'));var config=require(_0xe5f3('0x8'));var controller=require(_0xe5f3('0x9'));router[_0xe5f3('0xa')]('/',auth['isAuthenticated'](),controller[_0xe5f3('0xb')]);router[_0xe5f3('0xa')](_0xe5f3('0xc'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0xe')]);router[_0xe5f3('0xa')](_0xe5f3('0xf'),auth['isAuthenticated'](),controller[_0xe5f3('0x10')]);router['get'](_0xe5f3('0x11'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x12')]);router[_0xe5f3('0xa')](_0xe5f3('0x13'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x14')]);router[_0xe5f3('0xa')]('/:id/logo',controller[_0xe5f3('0x15')]);router[_0xe5f3('0xa')](_0xe5f3('0x16'),controller[_0xe5f3('0x17')]);router[_0xe5f3('0xa')](_0xe5f3('0x18'),controller[_0xe5f3('0x19')]);router[_0xe5f3('0xa')](_0xe5f3('0x1a'),controller['getSystemAvatar']);router[_0xe5f3('0xa')](_0xe5f3('0x1b'),auth['isAuthenticated'](),controller[_0xe5f3('0x1c')]);router[_0xe5f3('0xa')](_0xe5f3('0x1d'),controller[_0xe5f3('0x1e')]);router[_0xe5f3('0xa')](_0xe5f3('0x1f'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x20')]);router[_0xe5f3('0xa')](_0xe5f3('0x21'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x22')]);router[_0xe5f3('0xa')](_0xe5f3('0x23'),controller[_0xe5f3('0x24')]);router[_0xe5f3('0xa')]('/:id/offline_messages',auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x25')]);router[_0xe5f3('0xa')](_0xe5f3('0x26'),auth['isAuthenticated'](),controller[_0xe5f3('0x27')]);router[_0xe5f3('0x28')]('/',auth[_0xe5f3('0xd')](),controller['create']);router[_0xe5f3('0x28')](_0xe5f3('0x11'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x29')]);router[_0xe5f3('0x28')](_0xe5f3('0x13'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x2a')]);var upload=multer({'storage':multer[_0xe5f3('0x2b')]({'destination':function(_0x3c1797,_0x5309a7,_0x3dd7a6){_0x3dd7a6(null,path[_0xe5f3('0x2c')](config[_0xe5f3('0x2d')],_0xe5f3('0x2e')));},'filename':function(_0x5618cc,_0x1074e1,_0x52d262){_0x52d262(null,util[_0xe5f3('0x2f')](_0xe5f3('0x30'),Date[_0xe5f3('0x31')](),_0x1074e1['originalname']));}})});router[_0xe5f3('0x28')]('/:id/logo',upload[_0xe5f3('0x32')]('file'),controller[_0xe5f3('0x33')]);var upload=multer({'storage':multer[_0xe5f3('0x2b')]({'destination':function(_0xc535fc,_0xc178fc,_0x7008c6){_0x7008c6(null,path['join'](config[_0xe5f3('0x2d')],_0xe5f3('0x34')));},'filename':function(_0x4cac62,_0x16a7a2,_0x29f0e7){_0x29f0e7(null,util[_0xe5f3('0x2f')]('%s-%s',Date['now'](),_0x16a7a2[_0xe5f3('0x35')]));}})});router[_0xe5f3('0x28')](_0xe5f3('0x16'),upload[_0xe5f3('0x32')](_0xe5f3('0x36')),controller[_0xe5f3('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfd9a71,_0x1d0e63,_0x2d2292){_0x2d2292(null,path[_0xe5f3('0x2c')](config[_0xe5f3('0x2d')],_0xe5f3('0x34')));},'filename':function(_0x4da826,_0x513bad,_0x395bb7){_0x395bb7(null,util[_0xe5f3('0x2f')](_0xe5f3('0x30'),Date[_0xe5f3('0x31')](),_0x513bad['originalname']));}})});router[_0xe5f3('0x28')]('/:id/customer_avatar',upload[_0xe5f3('0x32')](_0xe5f3('0x36')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xe5f3('0x2b')]({'destination':function(_0x2284fd,_0x10a053,_0x51666e){_0x51666e(null,path[_0xe5f3('0x2c')](config['root'],_0xe5f3('0x34')));},'filename':function(_0x31bb1e,_0x293ae3,_0x1248a6){_0x1248a6(null,util[_0xe5f3('0x2f')]('%s-%s',Date[_0xe5f3('0x31')](),_0x293ae3[_0xe5f3('0x35')]));}})});router['post'](_0xe5f3('0x1a'),upload[_0xe5f3('0x32')]('file'),controller['addSystemAvatar']);router[_0xe5f3('0x28')](_0xe5f3('0x38'),controller[_0xe5f3('0x39')]);router[_0xe5f3('0x28')](_0xe5f3('0x3a'),controller[_0xe5f3('0x3b')]);router[_0xe5f3('0x28')]('/:id/interactions',auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x3c')]);router[_0xe5f3('0x28')](_0xe5f3('0x1f'),auth[_0xe5f3('0xd')](),controller['addApplications']);router[_0xe5f3('0x28')](_0xe5f3('0x21'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0xe5f3('0x28')](_0xe5f3('0x26'),auth['isAuthenticated'](),controller['addAgents']);router[_0xe5f3('0x3d')](_0xe5f3('0xf'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x3e')]);router[_0xe5f3('0x3f')](_0xe5f3('0xf'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x40')]);router[_0xe5f3('0x3f')](_0xe5f3('0x11'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x41')]);router[_0xe5f3('0x3f')](_0xe5f3('0x13'),auth[_0xe5f3('0xd')](),controller[_0xe5f3('0x42')]);router[_0xe5f3('0x3f')](_0xe5f3('0x26'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xe5f3('0x43')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f7fe0c2..97e4508 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 _0x980e=['Google','STRING','sequelize','ENUM'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe980('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe980('0x1')]('AmazonAWS',_0xe980('0x2')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xe980('0x3')]}}; \ No newline at end of file +var _0x287e=['ENUM','AmazonAWS','Google','sequelize','exports','STRING'];(function(_0x496a97,_0x17bb54){var _0x3fa053=function(_0xe93214){while(--_0xe93214){_0x496a97['push'](_0x496a97['shift']());}};_0x3fa053(++_0x17bb54);}(_0x287e,0x1e3));var _0xe287=function(_0x19ea88,_0xcddbf0){_0x19ea88=_0x19ea88-0x0;var _0x4e58d3=_0x287e[_0x19ea88];return _0x4e58d3;};'use strict';var Sequelize=require(_0xe287('0x0'));module[_0xe287('0x1')]={'name':{'type':Sequelize[_0xe287('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe287('0x3')](_0xe287('0x4'),_0xe287('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xe287('0x2')]},'data2':{'type':Sequelize[_0xe287('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2c2d7a5..0c6de8d 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 _0xbb46=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','error','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filters','filter','merge','options','then','includeAll','catch','params','length','include','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x24422b,_0x1bdee7){var _0x1b7069=function(_0x3e58f3){while(--_0x3e58f3){_0x24422b['push'](_0x24422b['shift']());}};_0x1b7069(++_0x1bdee7);}(_0xbb46,0x80));var _0x6bb4=function(_0xd921e9,_0x301ae3){_0xd921e9=_0xd921e9-0x0;var _0x223407=_0xbb46[_0xd921e9];return _0x223407;};'use strict';var pdf=require(_0x6bb4('0x0'));var emlformat=require(_0x6bb4('0x1'));var rimraf=require(_0x6bb4('0x2'));var zipdir=require(_0x6bb4('0x3'));var jsonpatch=require(_0x6bb4('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6bb4('0x5'));var Mustache=require(_0x6bb4('0x6'));var util=require(_0x6bb4('0x7'));var path=require('path');var sox=require(_0x6bb4('0x8'));var csv=require(_0x6bb4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6bb4('0xa'));var squel=require(_0x6bb4('0xb'));var crypto=require(_0x6bb4('0xc'));var jsforce=require(_0x6bb4('0xd'));var deskjs=require(_0x6bb4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6bb4('0xf'));var Papa=require(_0x6bb4('0x10'));var Redis=require(_0x6bb4('0x11'));var authService=require(_0x6bb4('0x12'));var qs=require(_0x6bb4('0x13'));var as=require(_0x6bb4('0x14'));var hardwareService=require(_0x6bb4('0x15'));var logger=require(_0x6bb4('0x16'))(_0x6bb4('0x17'));var utils=require(_0x6bb4('0x18'));var config=require(_0x6bb4('0x19'));var licenseUtil=require(_0x6bb4('0x1a'));var db=require(_0x6bb4('0x1b'))['db'];function respondWithStatusCode(_0x2d557a,_0x2195b2){_0x2195b2=_0x2195b2||0xcc;return function(_0x167d2f){if(_0x167d2f){return _0x2d557a[_0x6bb4('0x1c')](_0x2195b2);}return _0x2d557a[_0x6bb4('0x1d')](_0x2195b2)[_0x6bb4('0x1e')]();};}function respondWithResult(_0x4dad9b,_0x5b071b){_0x5b071b=_0x5b071b||0xc8;return function(_0x15dd99){if(_0x15dd99){return _0x4dad9b[_0x6bb4('0x1d')](_0x5b071b)[_0x6bb4('0x1f')](_0x15dd99);}};}function respondWithFilteredResult(_0x1a0d81,_0x2c97e1){return function(_0x5789ce){if(_0x5789ce){var _0x27f6ca=_0x5789ce[_0x6bb4('0x20')],_0xda2a19=_0x2c97e1[_0x6bb4('0x21')],_0x2b7239=_0x2c97e1[_0x6bb4('0x21')]+_0x2c97e1['limit'],_0x46cd37;if(_0x2b7239>=_0x27f6ca){_0x2b7239=_0x27f6ca;_0x46cd37=0xc8;}else{_0x46cd37=0xce;}_0x1a0d81['status'](_0x46cd37);return _0x1a0d81[_0x6bb4('0x22')](_0x6bb4('0x23'),_0xda2a19+'-'+_0x2b7239+'/'+_0x27f6ca)[_0x6bb4('0x1f')](_0x5789ce);}return null;};}function patchUpdates(_0x5826cb){return function(_0x1a04f3){try{jsonpatch[_0x6bb4('0x24')](_0x1a04f3,_0x5826cb,!![]);}catch(_0x28d90f){return BPromise[_0x6bb4('0x25')](_0x28d90f);}return _0x1a04f3[_0x6bb4('0x26')]();};}function saveUpdates(_0x3b1bb4,_0x320227){return function(_0x28bce0){if(_0x28bce0){return _0x28bce0[_0x6bb4('0x27')](_0x3b1bb4)['then'](function(_0x3a49d5){return _0x3a49d5;});}return null;};}function removeEntity(_0x1b6ded,_0x46103e){return function(_0x23b500){if(_0x23b500){return _0x23b500['destroy']()['then'](function(){_0x1b6ded[_0x6bb4('0x1d')](0xcc)[_0x6bb4('0x1e')]();});}};}function handleEntityNotFound(_0x5491d3,_0x147a25){return function(_0x4a6e80){if(!_0x4a6e80){_0x5491d3[_0x6bb4('0x1c')](0x194);}return _0x4a6e80;};}function handleError(_0x22b2b0,_0x6b2682){_0x6b2682=_0x6b2682||0x1f4;return function(_0x2f8b23){logger[_0x6bb4('0x28')](_0x2f8b23['stack']);if(_0x2f8b23[_0x6bb4('0x29')]){delete _0x2f8b23['name'];}_0x22b2b0[_0x6bb4('0x1d')](_0x6b2682)[_0x6bb4('0x2a')](_0x2f8b23);};}exports[_0x6bb4('0x2b')]=function(_0x3acf1a,_0x46235b){var _0x237fc7={},_0x339cd8={},_0x1c7a3f={'count':0x0,'rows':[]};var _0x2802fc=_[_0x6bb4('0x2c')](db[_0x6bb4('0x2d')][_0x6bb4('0x2e')],function(_0x361c74){return{'name':_0x361c74[_0x6bb4('0x2f')],'type':_0x361c74[_0x6bb4('0x30')][_0x6bb4('0x31')]};});_0x339cd8[_0x6bb4('0x32')]=_[_0x6bb4('0x2c')](_0x2802fc,_0x6bb4('0x29'));_0x339cd8[_0x6bb4('0x33')]=_[_0x6bb4('0x34')](_0x3acf1a[_0x6bb4('0x33')]);_0x339cd8['filters']=_[_0x6bb4('0x35')](_0x339cd8[_0x6bb4('0x32')],_0x339cd8[_0x6bb4('0x33')]);_0x237fc7[_0x6bb4('0x36')]=_['intersection'](_0x339cd8[_0x6bb4('0x32')],qs[_0x6bb4('0x37')](_0x3acf1a['query'][_0x6bb4('0x37')]));_0x237fc7['attributes']=_0x237fc7[_0x6bb4('0x36')]['length']?_0x237fc7[_0x6bb4('0x36')]:_0x339cd8[_0x6bb4('0x32')];if(!_0x3acf1a[_0x6bb4('0x33')][_0x6bb4('0x38')](_0x6bb4('0x39'))){_0x237fc7['limit']=qs[_0x6bb4('0x3a')](_0x3acf1a[_0x6bb4('0x33')][_0x6bb4('0x3a')]);_0x237fc7[_0x6bb4('0x21')]=qs[_0x6bb4('0x21')](_0x3acf1a[_0x6bb4('0x33')]['offset']);}_0x237fc7['order']=qs['sort'](_0x3acf1a[_0x6bb4('0x33')][_0x6bb4('0x3b')]);_0x237fc7[_0x6bb4('0x3c')]=qs['filters'](_[_0x6bb4('0x3d')](_0x3acf1a[_0x6bb4('0x33')],_0x339cd8[_0x6bb4('0x3e')]),_0x2802fc);if(_0x3acf1a['query'][_0x6bb4('0x3f')]){_0x237fc7['where']=_['merge'](_0x237fc7[_0x6bb4('0x3c')],{'$or':_[_0x6bb4('0x2c')](_0x2802fc,function(_0x2ff6c1){if(_0x2ff6c1[_0x6bb4('0x30')]!=='VIRTUAL'){var _0x4fc887={};_0x4fc887[_0x2ff6c1[_0x6bb4('0x29')]]={'$like':'%'+_0x3acf1a[_0x6bb4('0x33')]['filter']+'%'};return _0x4fc887;}})});}_0x237fc7=_[_0x6bb4('0x40')]({},_0x237fc7,_0x3acf1a[_0x6bb4('0x41')]);var _0x2e7e9c={'where':_0x237fc7[_0x6bb4('0x3c')]};return db[_0x6bb4('0x2d')]['count'](_0x2e7e9c)[_0x6bb4('0x42')](function(_0x55354e){_0x1c7a3f[_0x6bb4('0x20')]=_0x55354e;if(_0x3acf1a['query'][_0x6bb4('0x43')]){_0x237fc7['include']=[{'all':!![]}];}return db[_0x6bb4('0x2d')]['findAll'](_0x237fc7);})[_0x6bb4('0x42')](function(_0x20d2eb){_0x1c7a3f['rows']=_0x20d2eb;return _0x1c7a3f;})['then'](respondWithFilteredResult(_0x46235b,_0x237fc7))[_0x6bb4('0x44')](handleError(_0x46235b,null));};exports['show']=function(_0x14c87e,_0x58c126){var _0x424b8b={'raw':!![],'where':{'id':_0x14c87e[_0x6bb4('0x45')]['id']}},_0x264493={};_0x264493[_0x6bb4('0x32')]=_[_0x6bb4('0x34')](db[_0x6bb4('0x2d')][_0x6bb4('0x2e')]);_0x264493[_0x6bb4('0x33')]=_[_0x6bb4('0x34')](_0x14c87e[_0x6bb4('0x33')]);_0x264493['filters']=_[_0x6bb4('0x35')](_0x264493[_0x6bb4('0x32')],_0x264493[_0x6bb4('0x33')]);_0x424b8b['attributes']=_[_0x6bb4('0x35')](_0x264493[_0x6bb4('0x32')],qs['fields'](_0x14c87e['query'][_0x6bb4('0x37')]));_0x424b8b[_0x6bb4('0x36')]=_0x424b8b[_0x6bb4('0x36')][_0x6bb4('0x46')]?_0x424b8b[_0x6bb4('0x36')]:_0x264493['model'];if(_0x14c87e[_0x6bb4('0x33')][_0x6bb4('0x43')]){_0x424b8b[_0x6bb4('0x47')]=[{'all':!![]}];}_0x424b8b=_[_0x6bb4('0x40')]({},_0x424b8b,_0x14c87e[_0x6bb4('0x41')]);return db[_0x6bb4('0x2d')][_0x6bb4('0x48')](_0x424b8b)[_0x6bb4('0x42')](handleEntityNotFound(_0x58c126,null))[_0x6bb4('0x42')](respondWithResult(_0x58c126,null))[_0x6bb4('0x44')](handleError(_0x58c126,null));};exports[_0x6bb4('0x49')]=function(_0x2619f8,_0x38739a){return db[_0x6bb4('0x2d')][_0x6bb4('0x49')](_0x2619f8['body'],{})[_0x6bb4('0x42')](respondWithResult(_0x38739a,0xc9))[_0x6bb4('0x44')](handleError(_0x38739a,null));};exports['update']=function(_0x28fe13,_0x5dc0d3){if(_0x28fe13[_0x6bb4('0x4a')]['id']){delete _0x28fe13[_0x6bb4('0x4a')]['id'];}return db[_0x6bb4('0x2d')][_0x6bb4('0x48')]({'where':{'id':_0x28fe13[_0x6bb4('0x45')]['id']}})[_0x6bb4('0x42')](handleEntityNotFound(_0x5dc0d3,null))[_0x6bb4('0x42')](saveUpdates(_0x28fe13[_0x6bb4('0x4a')],null))[_0x6bb4('0x42')](respondWithResult(_0x5dc0d3,null))['catch'](handleError(_0x5dc0d3,null));};exports[_0x6bb4('0x4b')]=function(_0xc1a062,_0x290f8f){return db[_0x6bb4('0x2d')]['find']({'where':{'id':_0xc1a062['params']['id']}})[_0x6bb4('0x42')](handleEntityNotFound(_0x290f8f,null))[_0x6bb4('0x42')](removeEntity(_0x290f8f,null))['catch'](handleError(_0x290f8f,null));}; \ No newline at end of file +var _0xcc65=['then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','CloudProvider','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','update'];(function(_0x5bf969,_0x11f7e3){var _0x4055a2=function(_0x3cfe68){while(--_0x3cfe68){_0x5bf969['push'](_0x5bf969['shift']());}};_0x4055a2(++_0x11f7e3);}(_0xcc65,0x71));var _0x5cc6=function(_0x49ca95,_0x50c62b){_0x49ca95=_0x49ca95-0x0;var _0x4699f9=_0xcc65[_0x49ca95];return _0x4699f9;};'use strict';var pdf=require(_0x5cc6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5cc6('0x1'));var zipdir=require(_0x5cc6('0x2'));var jsonpatch=require(_0x5cc6('0x3'));var rp=require(_0x5cc6('0x4'));var moment=require(_0x5cc6('0x5'));var BPromise=require(_0x5cc6('0x6'));var Mustache=require(_0x5cc6('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5cc6('0x8'));var fs=require('fs');var _=require(_0x5cc6('0x9'));var squel=require(_0x5cc6('0xa'));var crypto=require('crypto');var jsforce=require(_0x5cc6('0xb'));var deskjs=require(_0x5cc6('0xc'));var toCsv=require(_0x5cc6('0xd'));var querystring=require('querystring');var Papa=require(_0x5cc6('0xe'));var Redis=require('ioredis');var authService=require(_0x5cc6('0xf'));var qs=require(_0x5cc6('0x10'));var as=require(_0x5cc6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cc6('0x12'))('api');var utils=require(_0x5cc6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5cc6('0x14'));var db=require(_0x5cc6('0x15'))['db'];function respondWithStatusCode(_0x247b5b,_0x2a3ffa){_0x2a3ffa=_0x2a3ffa||0xcc;return function(_0x2f73af){if(_0x2f73af){return _0x247b5b[_0x5cc6('0x16')](_0x2a3ffa);}return _0x247b5b[_0x5cc6('0x17')](_0x2a3ffa)[_0x5cc6('0x18')]();};}function respondWithResult(_0x29c692,_0x86e927){_0x86e927=_0x86e927||0xc8;return function(_0x4b9d09){if(_0x4b9d09){return _0x29c692['status'](_0x86e927)['json'](_0x4b9d09);}};}function respondWithFilteredResult(_0x53dd74,_0x33b577){return function(_0x211a0a){if(_0x211a0a){var _0x2da7eb=_0x211a0a['count'],_0x2bb742=_0x33b577[_0x5cc6('0x19')],_0x80bbf3=_0x33b577[_0x5cc6('0x19')]+_0x33b577['limit'],_0x1291c8;if(_0x80bbf3>=_0x2da7eb){_0x80bbf3=_0x2da7eb;_0x1291c8=0xc8;}else{_0x1291c8=0xce;}_0x53dd74[_0x5cc6('0x17')](_0x1291c8);return _0x53dd74[_0x5cc6('0x1a')](_0x5cc6('0x1b'),_0x2bb742+'-'+_0x80bbf3+'/'+_0x2da7eb)[_0x5cc6('0x1c')](_0x211a0a);}return null;};}function patchUpdates(_0x3edad8){return function(_0x48e7f2){try{jsonpatch[_0x5cc6('0x1d')](_0x48e7f2,_0x3edad8,!![]);}catch(_0x3f65b2){return BPromise['reject'](_0x3f65b2);}return _0x48e7f2['save']();};}function saveUpdates(_0xab0849,_0x53f378){return function(_0x182afa){if(_0x182afa){return _0x182afa[_0x5cc6('0x1e')](_0xab0849)[_0x5cc6('0x1f')](function(_0xbb4f0e){return _0xbb4f0e;});}return null;};}function removeEntity(_0x5a34e9,_0xc0568a){return function(_0x20bf67){if(_0x20bf67){return _0x20bf67[_0x5cc6('0x20')]()[_0x5cc6('0x1f')](function(){_0x5a34e9[_0x5cc6('0x17')](0xcc)[_0x5cc6('0x18')]();});}};}function handleEntityNotFound(_0x2b08c3,_0x25dc21){return function(_0x4a6979){if(!_0x4a6979){_0x2b08c3[_0x5cc6('0x16')](0x194);}return _0x4a6979;};}function handleError(_0x5d7482,_0x547003){_0x547003=_0x547003||0x1f4;return function(_0x5ec49a){logger[_0x5cc6('0x21')](_0x5ec49a['stack']);if(_0x5ec49a[_0x5cc6('0x22')]){delete _0x5ec49a[_0x5cc6('0x22')];}_0x5d7482[_0x5cc6('0x17')](_0x547003)[_0x5cc6('0x23')](_0x5ec49a);};}exports[_0x5cc6('0x24')]=function(_0x48d543,_0x1875bf){var _0x39ff8a={},_0x1e73a2={},_0x42f0e2={'count':0x0,'rows':[]};var _0x346ec1=_[_0x5cc6('0x25')](db['CloudProvider'][_0x5cc6('0x26')],function(_0xc4d1ee){return{'name':_0xc4d1ee[_0x5cc6('0x27')],'type':_0xc4d1ee[_0x5cc6('0x28')]['key']};});_0x1e73a2[_0x5cc6('0x29')]=_['map'](_0x346ec1,_0x5cc6('0x22'));_0x1e73a2['query']=_[_0x5cc6('0x2a')](_0x48d543[_0x5cc6('0x2b')]);_0x1e73a2[_0x5cc6('0x2c')]=_[_0x5cc6('0x2d')](_0x1e73a2['model'],_0x1e73a2['query']);_0x39ff8a[_0x5cc6('0x2e')]=_[_0x5cc6('0x2d')](_0x1e73a2[_0x5cc6('0x29')],qs[_0x5cc6('0x2f')](_0x48d543[_0x5cc6('0x2b')][_0x5cc6('0x2f')]));_0x39ff8a[_0x5cc6('0x2e')]=_0x39ff8a[_0x5cc6('0x2e')][_0x5cc6('0x30')]?_0x39ff8a[_0x5cc6('0x2e')]:_0x1e73a2[_0x5cc6('0x29')];if(!_0x48d543[_0x5cc6('0x2b')][_0x5cc6('0x31')](_0x5cc6('0x32'))){_0x39ff8a[_0x5cc6('0x33')]=qs[_0x5cc6('0x33')](_0x48d543[_0x5cc6('0x2b')]['limit']);_0x39ff8a[_0x5cc6('0x19')]=qs[_0x5cc6('0x19')](_0x48d543[_0x5cc6('0x2b')][_0x5cc6('0x19')]);}_0x39ff8a[_0x5cc6('0x34')]=qs[_0x5cc6('0x35')](_0x48d543[_0x5cc6('0x2b')][_0x5cc6('0x35')]);_0x39ff8a[_0x5cc6('0x36')]=qs[_0x5cc6('0x2c')](_[_0x5cc6('0x37')](_0x48d543[_0x5cc6('0x2b')],_0x1e73a2[_0x5cc6('0x2c')]),_0x346ec1);if(_0x48d543[_0x5cc6('0x2b')][_0x5cc6('0x38')]){_0x39ff8a['where']=_[_0x5cc6('0x39')](_0x39ff8a[_0x5cc6('0x36')],{'$or':_['map'](_0x346ec1,function(_0x236693){if(_0x236693['type']!==_0x5cc6('0x3a')){var _0x3c7e15={};_0x3c7e15[_0x236693[_0x5cc6('0x22')]]={'$like':'%'+_0x48d543[_0x5cc6('0x2b')][_0x5cc6('0x38')]+'%'};return _0x3c7e15;}})});}_0x39ff8a=_[_0x5cc6('0x39')]({},_0x39ff8a,_0x48d543['options']);var _0x54bb1d={'where':_0x39ff8a[_0x5cc6('0x36')]};return db[_0x5cc6('0x3b')][_0x5cc6('0x3c')](_0x54bb1d)[_0x5cc6('0x1f')](function(_0x9e3e22){_0x42f0e2[_0x5cc6('0x3c')]=_0x9e3e22;if(_0x48d543[_0x5cc6('0x2b')][_0x5cc6('0x3d')]){_0x39ff8a[_0x5cc6('0x3e')]=[{'all':!![]}];}return db['CloudProvider'][_0x5cc6('0x3f')](_0x39ff8a);})['then'](function(_0x44dd27){_0x42f0e2[_0x5cc6('0x40')]=_0x44dd27;return _0x42f0e2;})[_0x5cc6('0x1f')](respondWithFilteredResult(_0x1875bf,_0x39ff8a))[_0x5cc6('0x41')](handleError(_0x1875bf,null));};exports[_0x5cc6('0x42')]=function(_0x1a6ab9,_0x3e4c67){var _0x248804={'raw':!![],'where':{'id':_0x1a6ab9[_0x5cc6('0x43')]['id']}},_0x212449={};_0x212449[_0x5cc6('0x29')]=_[_0x5cc6('0x2a')](db['CloudProvider'][_0x5cc6('0x26')]);_0x212449[_0x5cc6('0x2b')]=_['keys'](_0x1a6ab9[_0x5cc6('0x2b')]);_0x212449[_0x5cc6('0x2c')]=_[_0x5cc6('0x2d')](_0x212449[_0x5cc6('0x29')],_0x212449[_0x5cc6('0x2b')]);_0x248804[_0x5cc6('0x2e')]=_[_0x5cc6('0x2d')](_0x212449[_0x5cc6('0x29')],qs['fields'](_0x1a6ab9['query'][_0x5cc6('0x2f')]));_0x248804['attributes']=_0x248804[_0x5cc6('0x2e')][_0x5cc6('0x30')]?_0x248804[_0x5cc6('0x2e')]:_0x212449[_0x5cc6('0x29')];if(_0x1a6ab9['query'][_0x5cc6('0x3d')]){_0x248804[_0x5cc6('0x3e')]=[{'all':!![]}];}_0x248804=_[_0x5cc6('0x39')]({},_0x248804,_0x1a6ab9[_0x5cc6('0x44')]);return db[_0x5cc6('0x3b')]['find'](_0x248804)[_0x5cc6('0x1f')](handleEntityNotFound(_0x3e4c67,null))[_0x5cc6('0x1f')](respondWithResult(_0x3e4c67,null))[_0x5cc6('0x41')](handleError(_0x3e4c67,null));};exports[_0x5cc6('0x45')]=function(_0x8eb680,_0x460e7e){return db[_0x5cc6('0x3b')][_0x5cc6('0x45')](_0x8eb680[_0x5cc6('0x46')],{})['then'](respondWithResult(_0x460e7e,0xc9))[_0x5cc6('0x41')](handleError(_0x460e7e,null));};exports[_0x5cc6('0x1e')]=function(_0x199f4e,_0x884e8e){if(_0x199f4e[_0x5cc6('0x46')]['id']){delete _0x199f4e['body']['id'];}return db[_0x5cc6('0x3b')][_0x5cc6('0x47')]({'where':{'id':_0x199f4e['params']['id']}})['then'](handleEntityNotFound(_0x884e8e,null))[_0x5cc6('0x1f')](saveUpdates(_0x199f4e[_0x5cc6('0x46')],null))[_0x5cc6('0x1f')](respondWithResult(_0x884e8e,null))[_0x5cc6('0x41')](handleError(_0x884e8e,null));};exports[_0x5cc6('0x20')]=function(_0x295c25,_0x739400){return db[_0x5cc6('0x3b')]['find']({'where':{'id':_0x295c25[_0x5cc6('0x43')]['id']}})['then'](handleEntityNotFound(_0x739400,null))[_0x5cc6('0x1f')](removeEntity(_0x739400,null))['catch'](handleError(_0x739400,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index d0fff7e..0d3d4ae 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 _0x74ec=['bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','util','../../config/logger','moment'];(function(_0x400164,_0x104c28){var _0x55db29=function(_0x1bfb6a){while(--_0x1bfb6a){_0x400164['push'](_0x400164['shift']());}};_0x55db29(++_0x104c28);}(_0x74ec,0x1d1));var _0xc74e=function(_0x410b37,_0x2e74be){_0x410b37=_0x410b37-0x0;var _0x5049df=_0x74ec[_0x410b37];return _0x5049df;};'use strict';var _=require('lodash');var util=require(_0xc74e('0x0'));var logger=require(_0xc74e('0x1'))('api');var moment=require(_0xc74e('0x2'));var BPromise=require(_0xc74e('0x3'));var rp=require(_0xc74e('0x4'));var fs=require('fs');var path=require(_0xc74e('0x5'));var rimraf=require(_0xc74e('0x6'));var config=require(_0xc74e('0x7'));var attributes=require(_0xc74e('0x8'));module[_0xc74e('0x9')]=function(_0x3cca53,_0x32cc89){return _0x3cca53[_0xc74e('0xa')]('CloudProvider',attributes,{'tableName':_0xc74e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x998c=['define','CloudProvider','cloud_providers','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x998c,0x1bb));var _0xc998=function(_0xdb4e73,_0x30b446){_0xdb4e73=_0xdb4e73-0x0;var _0x4578b4=_0x998c[_0xdb4e73];return _0x4578b4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc998('0x0'));var moment=require('moment');var BPromise=require(_0xc998('0x1'));var rp=require(_0xc998('0x2'));var fs=require('fs');var path=require(_0xc998('0x3'));var rimraf=require(_0xc998('0x4'));var config=require(_0xc998('0x5'));var attributes=require('./cloudProvider.attributes');module[_0xc998('0x6')]=function(_0x5ee61b,_0x491a35){return _0x5ee61b[_0xc998('0x7')](_0xc998('0x8'),attributes,{'tableName':_0xc998('0x9'),'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 defc184..68d614d 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 _0x644f=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x2113da,_0x3579c3){var _0x505149=function(_0x1e9829){while(--_0x1e9829){_0x2113da['push'](_0x2113da['shift']());}};_0x505149(++_0x3579c3);}(_0x644f,0xce));var _0xf644=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0x644f[_0x2998db];return _0x115fea;};'use strict';var _=require(_0xf644('0x0'));var util=require(_0xf644('0x1'));var moment=require(_0xf644('0x2'));var BPromise=require(_0xf644('0x3'));var rs=require(_0xf644('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf644('0x5'));var logger=require(_0xf644('0x6'))(_0xf644('0x7'));var config=require(_0xf644('0x8'));var jayson=require(_0xf644('0x9'));var client=jayson[_0xf644('0xa')][_0xf644('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d722d,_0x3ec341,_0x2e2700){return new BPromise(function(_0x292166,_0x2419bd){return client['request'](_0x1d722d,_0x2e2700)[_0xf644('0xc')](function(_0xde48f9){logger[_0xf644('0xd')](_0xf644('0xe'),_0x3ec341,_0xf644('0xf'));logger[_0xf644('0x10')](_0xf644('0x11'),_0x3ec341,_0xf644('0xf'),JSON[_0xf644('0x12')](_0xde48f9));if(_0xde48f9['error']){if(_0xde48f9[_0xf644('0x13')]['code']===0x1f4){logger[_0xf644('0x13')](_0xf644('0xe'),_0x3ec341,_0xde48f9['error'][_0xf644('0x14')]);return _0x2419bd(_0xde48f9[_0xf644('0x13')][_0xf644('0x14')]);}logger['error'](_0xf644('0xe'),_0x3ec341,_0xde48f9[_0xf644('0x13')][_0xf644('0x14')]);return _0x292166(_0xde48f9['error'][_0xf644('0x14')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x3ec341,'request\x20sent');_0x292166(_0xde48f9[_0xf644('0x15')]['message']);}})[_0xf644('0x16')](function(_0x47cbc3){logger[_0xf644('0x13')]('CloudProvider,\x20%s,\x20%s',_0x3ec341,_0x47cbc3);_0x2419bd(_0x47cbc3);});});} \ No newline at end of file +var _0x39ff=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util'];(function(_0x22e76d,_0x588d78){var _0x2c631a=function(_0x2d51c2){while(--_0x2d51c2){_0x22e76d['push'](_0x22e76d['shift']());}};_0x2c631a(++_0x588d78);}(_0x39ff,0xe6));var _0xf39f=function(_0x45e1aa,_0x4e1ea5){_0x45e1aa=_0x45e1aa-0x0;var _0xc3a923=_0x39ff[_0x45e1aa];return _0xc3a923;};'use strict';var _=require('lodash');var util=require(_0xf39f('0x0'));var moment=require(_0xf39f('0x1'));var BPromise=require(_0xf39f('0x2'));var rs=require(_0xf39f('0x3'));var fs=require('fs');var Redis=require(_0xf39f('0x4'));var db=require(_0xf39f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf39f('0x6'))('rpc');var config=require(_0xf39f('0x7'));var jayson=require(_0xf39f('0x8'));var client=jayson['client'][_0xf39f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48960f,_0x21d3eb,_0x84b2ca){return new BPromise(function(_0x38a03e,_0x39412a){return client[_0xf39f('0xa')](_0x48960f,_0x84b2ca)[_0xf39f('0xb')](function(_0x1ca827){logger[_0xf39f('0xc')](_0xf39f('0xd'),_0x21d3eb,_0xf39f('0xe'));logger[_0xf39f('0xf')](_0xf39f('0x10'),_0x21d3eb,_0xf39f('0xe'),JSON[_0xf39f('0x11')](_0x1ca827));if(_0x1ca827['error']){if(_0x1ca827[_0xf39f('0x12')]['code']===0x1f4){logger[_0xf39f('0x12')](_0xf39f('0xd'),_0x21d3eb,_0x1ca827[_0xf39f('0x12')][_0xf39f('0x13')]);return _0x39412a(_0x1ca827[_0xf39f('0x12')][_0xf39f('0x13')]);}logger['error'](_0xf39f('0xd'),_0x21d3eb,_0x1ca827[_0xf39f('0x12')]['message']);return _0x38a03e(_0x1ca827['error'][_0xf39f('0x13')]);}else{logger['info'](_0xf39f('0xd'),_0x21d3eb,_0xf39f('0xe'));_0x38a03e(_0x1ca827[_0xf39f('0x14')][_0xf39f('0x13')]);}})['catch'](function(_0x5bb673){logger[_0xf39f('0x12')](_0xf39f('0xd'),_0x21d3eb,_0x5bb673);_0x39412a(_0x5bb673);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index b621078..ee8590f 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 _0x1e0c=['show','post','create','put','update','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id'];(function(_0x1d292c,_0x57bbbe){var _0x5d08ca=function(_0x4f0a30){while(--_0x4f0a30){_0x1d292c['push'](_0x1d292c['shift']());}};_0x5d08ca(++_0x57bbbe);}(_0x1e0c,0xb5));var _0xc1e0=function(_0x4ba666,_0x5c7893){_0x4ba666=_0x4ba666-0x0;var _0x1526a1=_0x1e0c[_0x4ba666];return _0x1526a1;};'use strict';var multer=require('multer');var util=require(_0xc1e0('0x0'));var path=require(_0xc1e0('0x1'));var timeout=require(_0xc1e0('0x2'));var express=require('express');var router=express[_0xc1e0('0x3')]();var auth=require(_0xc1e0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc1e0('0x5'));var controller=require(_0xc1e0('0x6'));router[_0xc1e0('0x7')]('/',auth[_0xc1e0('0x8')](),controller[_0xc1e0('0x9')]);router[_0xc1e0('0x7')](_0xc1e0('0xa'),auth[_0xc1e0('0x8')](),controller[_0xc1e0('0xb')]);router[_0xc1e0('0xc')]('/',auth[_0xc1e0('0x8')](),controller[_0xc1e0('0xd')]);router[_0xc1e0('0xe')](_0xc1e0('0xa'),auth[_0xc1e0('0x8')](),controller[_0xc1e0('0xf')]);router['delete'](_0xc1e0('0xa'),auth[_0xc1e0('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x28e1=['isAuthenticated','index','show','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0x28e1,0x13a));var _0x128e=function(_0x44dcfd,_0x4ac1a9){_0x44dcfd=_0x44dcfd-0x0;var _0x2d2a46=_0x28e1[_0x44dcfd];return _0x2d2a46;};'use strict';var multer=require(_0x128e('0x0'));var util=require(_0x128e('0x1'));var path=require(_0x128e('0x2'));var timeout=require(_0x128e('0x3'));var express=require(_0x128e('0x4'));var router=express[_0x128e('0x5')]();var auth=require(_0x128e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x128e('0x7'));var controller=require('./cloudProvider.controller');router[_0x128e('0x8')]('/',auth[_0x128e('0x9')](),controller[_0x128e('0xa')]);router[_0x128e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x128e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x128e('0xc')]);router[_0x128e('0xd')](_0x128e('0xe'),auth['isAuthenticated'](),controller[_0x128e('0xf')]);router[_0x128e('0x10')](_0x128e('0xe'),auth[_0x128e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8a67228..d4ded9e 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 _0x7d6c=['STRING','name','sequelize'];(function(_0x59ca94,_0x22f2ab){var _0x663f19=function(_0x29f0fb){while(--_0x29f0fb){_0x59ca94['push'](_0x59ca94['shift']());}};_0x663f19(++_0x22f2ab);}(_0x7d6c,0xd1));var _0xc7d6=function(_0x1f8be7,_0x434d58){_0x1f8be7=_0x1f8be7-0x0;var _0x4f6182=_0x7d6c[_0x1f8be7];return _0x4f6182;};'use strict';var Sequelize=require(_0xc7d6('0x0'));module['exports']={'name':{'type':Sequelize[_0xc7d6('0x1')],'unique':_0xc7d6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xc7d6('0x1')]},'companyId':{'type':Sequelize[_0xc7d6('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc7d6('0x1')]},'fax':{'type':Sequelize[_0xc7d6('0x1')]},'type':{'type':Sequelize[_0xc7d6('0x1')]},'street':{'type':Sequelize[_0xc7d6('0x1')]},'postalCode':{'type':Sequelize[_0xc7d6('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc7d6('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xc7d6('0x1')]},'sStreet':{'type':Sequelize[_0xc7d6('0x1')]},'sPostalCode':{'type':Sequelize[_0xc7d6('0x1')]},'sCity':{'type':Sequelize[_0xc7d6('0x1')]},'sCountry':{'type':Sequelize[_0xc7d6('0x1')]},'description':{'type':Sequelize[_0xc7d6('0x1')]}}; \ No newline at end of file +var _0xf4fd=['STRING','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4fd,0x11f));var _0xdf4f=function(_0x5c5e16,_0x111fe7){_0x5c5e16=_0x5c5e16-0x0;var _0x3f890d=_0xf4fd[_0x5c5e16];return _0x3f890d;};'use strict';var Sequelize=require('sequelize');module[_0xdf4f('0x0')]={'name':{'type':Sequelize[_0xdf4f('0x1')],'unique':_0xdf4f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xdf4f('0x1')]},'companyId':{'type':Sequelize[_0xdf4f('0x1')]},'website':{'type':Sequelize[_0xdf4f('0x1')]},'phone':{'type':Sequelize[_0xdf4f('0x1')]},'fax':{'type':Sequelize[_0xdf4f('0x1')]},'type':{'type':Sequelize[_0xdf4f('0x1')]},'street':{'type':Sequelize[_0xdf4f('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xdf4f('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdf4f('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xdf4f('0x1')]},'sStreet':{'type':Sequelize[_0xdf4f('0x1')]},'sPostalCode':{'type':Sequelize[_0xdf4f('0x1')]},'sCity':{'type':Sequelize[_0xdf4f('0x1')]},'sCountry':{'type':Sequelize[_0xdf4f('0x1')]},'description':{'type':Sequelize[_0xdf4f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index fb24ff2..5d67112 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 _0xf1dc=['destroy','error','name','CmCompany','describe','model','keys','query','filters','attributes','fields','length','nolimit','order','sort','where','merge','filter','options','includeAll','findAll','catch','show','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','CmContact','addContacts','ids','omit','getContacts','findOne','rawAttributes','intersection','pick','map','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Companies'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf1dc,0x1db));var _0xcf1d=function(_0x3acb71,_0x3862cd){_0x3acb71=_0x3acb71-0x0;var _0x28ab85=_0xf1dc[_0x3acb71];return _0x28ab85;};'use strict';var pdf=require(_0xcf1d('0x0'));var emlformat=require(_0xcf1d('0x1'));var rimraf=require(_0xcf1d('0x2'));var zipdir=require(_0xcf1d('0x3'));var jsonpatch=require(_0xcf1d('0x4'));var rp=require(_0xcf1d('0x5'));var moment=require(_0xcf1d('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcf1d('0x7'));var path=require('path');var sox=require(_0xcf1d('0x8'));var csv=require('to-csv');var ejs=require(_0xcf1d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xcf1d('0xa'));var jsforce=require(_0xcf1d('0xb'));var deskjs=require(_0xcf1d('0xc'));var toCsv=require(_0xcf1d('0xd'));var querystring=require(_0xcf1d('0xe'));var Papa=require(_0xcf1d('0xf'));var Redis=require(_0xcf1d('0x10'));var authService=require(_0xcf1d('0x11'));var qs=require(_0xcf1d('0x12'));var as=require(_0xcf1d('0x13'));var hardwareService=require(_0xcf1d('0x14'));var logger=require(_0xcf1d('0x15'))('api');var utils=require(_0xcf1d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcf1d('0x17'));var db=require(_0xcf1d('0x18'))['db'];function respondWithStatusCode(_0x4cb010,_0x26b401){_0x26b401=_0x26b401||0xcc;return function(_0x519311){if(_0x519311){return _0x4cb010[_0xcf1d('0x19')](_0x26b401);}return _0x4cb010[_0xcf1d('0x1a')](_0x26b401)[_0xcf1d('0x1b')]();};}function respondWithResult(_0x331ac8,_0x5eff2f){_0x5eff2f=_0x5eff2f||0xc8;return function(_0x8c8cfb){if(_0x8c8cfb){return _0x331ac8[_0xcf1d('0x1a')](_0x5eff2f)[_0xcf1d('0x1c')](_0x8c8cfb);}};}function respondWithFilteredResult(_0x64bc0b,_0x5c3b93){return function(_0xe6a165){if(_0xe6a165){var _0xa8265d=_0xe6a165[_0xcf1d('0x1d')],_0x5377b7=_0x5c3b93[_0xcf1d('0x1e')],_0x18326b=_0x5c3b93[_0xcf1d('0x1e')]+_0x5c3b93[_0xcf1d('0x1f')],_0x28d309;if(_0x18326b>=_0xa8265d){_0x18326b=_0xa8265d;_0x28d309=0xc8;}else{_0x28d309=0xce;}_0x64bc0b[_0xcf1d('0x1a')](_0x28d309);return _0x64bc0b[_0xcf1d('0x20')](_0xcf1d('0x21'),_0x5377b7+'-'+_0x18326b+'/'+_0xa8265d)[_0xcf1d('0x1c')](_0xe6a165);}return null;};}function patchUpdates(_0x250499){return function(_0x30bc58){try{jsonpatch[_0xcf1d('0x22')](_0x30bc58,_0x250499,!![]);}catch(_0x2df8a6){return BPromise[_0xcf1d('0x23')](_0x2df8a6);}return _0x30bc58[_0xcf1d('0x24')]();};}function saveUpdates(_0x4dafeb,_0x25a004){return function(_0x4e1573){if(_0x4e1573){return _0x4e1573[_0xcf1d('0x25')](_0x4dafeb)[_0xcf1d('0x26')](function(_0x47db34){return _0x47db34;});}return null;};}function removeEntity(_0x36afe4,_0x41bfa7){return function(_0x206094){if(_0x206094){return _0x206094['destroy']()[_0xcf1d('0x26')](function(){var _0x5f58f0=_0x206094[_0xcf1d('0x27')]({'plain':!![]});var _0x84f50d=_0xcf1d('0x28');return db['UserProfileResource'][_0xcf1d('0x29')]({'where':{'type':_0x84f50d,'resourceId':_0x5f58f0['id']}})['then'](function(){return _0x206094;});})[_0xcf1d('0x26')](function(){_0x36afe4[_0xcf1d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f4443,_0x161805){return function(_0x47452e){if(!_0x47452e){_0x5f4443[_0xcf1d('0x19')](0x194);}return _0x47452e;};}function handleError(_0x2fcd51,_0x46c565){_0x46c565=_0x46c565||0x1f4;return function(_0x5c2277){logger[_0xcf1d('0x2a')](_0x5c2277['stack']);if(_0x5c2277[_0xcf1d('0x2b')]){delete _0x5c2277[_0xcf1d('0x2b')];}_0x2fcd51[_0xcf1d('0x1a')](_0x46c565)['send'](_0x5c2277);};}exports['index']=function(_0x42cc51,_0x536337){var _0x13d47a={},_0x16326d={},_0x1ae81d={'count':0x0,'rows':[]};return db[_0xcf1d('0x2c')][_0xcf1d('0x2d')]()[_0xcf1d('0x26')](function(_0x59c7ed){_0x16326d[_0xcf1d('0x2e')]=_[_0xcf1d('0x2f')](_0x59c7ed);_0x16326d[_0xcf1d('0x30')]=_[_0xcf1d('0x2f')](_0x42cc51[_0xcf1d('0x30')]);_0x16326d[_0xcf1d('0x31')]=_['intersection'](_0x16326d['model'],_0x16326d[_0xcf1d('0x30')]);_0x13d47a[_0xcf1d('0x32')]=_['intersection'](_0x16326d[_0xcf1d('0x2e')],qs['fields'](_0x42cc51[_0xcf1d('0x30')][_0xcf1d('0x33')]));_0x13d47a[_0xcf1d('0x32')]=_0x13d47a[_0xcf1d('0x32')][_0xcf1d('0x34')]?_0x13d47a[_0xcf1d('0x32')]:_0x16326d[_0xcf1d('0x2e')];if(!_0x42cc51[_0xcf1d('0x30')]['hasOwnProperty'](_0xcf1d('0x35'))){_0x13d47a['limit']=qs[_0xcf1d('0x1f')](_0x42cc51['query'][_0xcf1d('0x1f')]);_0x13d47a[_0xcf1d('0x1e')]=qs['offset'](_0x42cc51[_0xcf1d('0x30')][_0xcf1d('0x1e')]);}_0x13d47a[_0xcf1d('0x36')]=qs[_0xcf1d('0x37')](_0x42cc51[_0xcf1d('0x30')][_0xcf1d('0x37')]);_0x13d47a['where']=qs['filters'](_['pick'](_0x42cc51[_0xcf1d('0x30')],_0x16326d[_0xcf1d('0x31')]),_0x59c7ed);if(_0x42cc51[_0xcf1d('0x30')]['filter']){_0x13d47a[_0xcf1d('0x38')]=_[_0xcf1d('0x39')](_0x13d47a[_0xcf1d('0x38')],{'$or':_['map'](_0x13d47a[_0xcf1d('0x32')],function(_0x4685a2){var _0x376a37={};_0x376a37[_0x4685a2]={'$like':'%'+_0x42cc51[_0xcf1d('0x30')][_0xcf1d('0x3a')]+'%'};return _0x376a37;})});}_0x13d47a=_[_0xcf1d('0x39')]({},_0x13d47a,_0x42cc51[_0xcf1d('0x3b')]);var _0x461c5b={'where':_0x13d47a[_0xcf1d('0x38')]};return db['CmCompany'][_0xcf1d('0x1d')](_0x461c5b)[_0xcf1d('0x26')](function(_0x4753ce){_0x1ae81d[_0xcf1d('0x1d')]=_0x4753ce;if(_0x42cc51[_0xcf1d('0x30')][_0xcf1d('0x3c')]){_0x13d47a['include']=[{'all':!![]}];}return db[_0xcf1d('0x2c')][_0xcf1d('0x3d')](_0x13d47a);})[_0xcf1d('0x26')](function(_0x386bab){_0x1ae81d['rows']=_0x386bab;return _0x1ae81d;})[_0xcf1d('0x26')](respondWithFilteredResult(_0x536337,_0x13d47a))[_0xcf1d('0x3e')](handleError(_0x536337,null));})[_0xcf1d('0x3e')](handleError(_0x536337,null));};exports[_0xcf1d('0x3f')]=function(_0x192a9f,_0x372033){var _0x409e7a={'raw':![],'where':{'id':_0x192a9f['params']['id']}},_0xee3f2d={};_0xee3f2d['model']=_['keys'](db[_0xcf1d('0x2c')]['rawAttributes']);_0xee3f2d['query']=_[_0xcf1d('0x2f')](_0x192a9f[_0xcf1d('0x30')]);_0xee3f2d[_0xcf1d('0x31')]=_['intersection'](_0xee3f2d[_0xcf1d('0x2e')],_0xee3f2d[_0xcf1d('0x30')]);_0x409e7a[_0xcf1d('0x32')]=_['intersection'](_0xee3f2d[_0xcf1d('0x2e')],qs[_0xcf1d('0x33')](_0x192a9f[_0xcf1d('0x30')][_0xcf1d('0x33')]));_0x409e7a[_0xcf1d('0x32')]=_0x409e7a[_0xcf1d('0x32')][_0xcf1d('0x34')]?_0x409e7a[_0xcf1d('0x32')]:_0xee3f2d[_0xcf1d('0x2e')];if(_0x192a9f['query'][_0xcf1d('0x3c')]){_0x409e7a['include']=[{'all':!![]}];}_0x409e7a=_['merge']({},_0x409e7a,_0x192a9f['options']);return db[_0xcf1d('0x2c')][_0xcf1d('0x40')](_0x409e7a)[_0xcf1d('0x26')](handleEntityNotFound(_0x372033,null))[_0xcf1d('0x26')](respondWithResult(_0x372033,null))[_0xcf1d('0x3e')](handleError(_0x372033,null));};exports['create']=function(_0x5eb4e8,_0x38c239){return db[_0xcf1d('0x2c')]['create'](_0x5eb4e8['body'],{})[_0xcf1d('0x26')](function(_0x407632){var _0x37641e=_0x5eb4e8[_0xcf1d('0x41')][_0xcf1d('0x27')]({'plain':!![]});if(!_0x37641e)throw new Error(_0xcf1d('0x42'));if(_0x37641e['role']==='user'){var _0x5c5ea9=_0x407632['get']({'plain':!![]});var _0x25202e=_0xcf1d('0x28');return db[_0xcf1d('0x43')][_0xcf1d('0x40')]({'where':{'name':_0x25202e,'userProfileId':_0x37641e[_0xcf1d('0x44')]},'raw':!![]})[_0xcf1d('0x26')](function(_0x1e894f){if(_0x1e894f&&_0x1e894f[_0xcf1d('0x45')]===0x0){return db[_0xcf1d('0x46')][_0xcf1d('0x47')]({'name':_0x5c5ea9[_0xcf1d('0x2b')],'resourceId':_0x5c5ea9['id'],'type':_0x1e894f['name'],'sectionId':_0x1e894f['id']},{})[_0xcf1d('0x26')](function(){return _0x407632;});}else{return _0x407632;}})[_0xcf1d('0x3e')](function(_0x404951){logger[_0xcf1d('0x2a')](_0xcf1d('0x48'),_0x404951);throw _0x404951;});}return _0x407632;})[_0xcf1d('0x26')](respondWithResult(_0x38c239,0xc9))['catch'](handleError(_0x38c239,null));};exports['update']=function(_0x2f3239,_0x599192){if(_0x2f3239[_0xcf1d('0x49')]['id']){delete _0x2f3239['body']['id'];}return db[_0xcf1d('0x2c')]['find']({'where':{'id':_0x2f3239[_0xcf1d('0x4a')]['id']}})[_0xcf1d('0x26')](handleEntityNotFound(_0x599192,null))[_0xcf1d('0x26')](saveUpdates(_0x2f3239[_0xcf1d('0x49')],null))[_0xcf1d('0x26')](respondWithResult(_0x599192,null))[_0xcf1d('0x3e')](handleError(_0x599192,null));};exports[_0xcf1d('0x29')]=function(_0x430fcd,_0x24812c){return db['CmCompany'][_0xcf1d('0x40')]({'where':{'id':_0x430fcd[_0xcf1d('0x4a')]['id']}})[_0xcf1d('0x26')](handleEntityNotFound(_0x24812c,null))[_0xcf1d('0x26')](removeEntity(_0x24812c,null))['catch'](handleError(_0x24812c,null));};exports[_0xcf1d('0x2d')]=function(_0x3a0001,_0xf35d71){return db['CmCompany'][_0xcf1d('0x2d')]()[_0xcf1d('0x26')](respondWithResult(_0xf35d71,null))[_0xcf1d('0x3e')](handleError(_0xf35d71,null));};exports['addContacts']=function(_0x1b241c,_0x3f3266,_0x22c7f7){return db[_0xcf1d('0x4b')][_0xcf1d('0x40')]({'where':{'id':_0x1b241c['params']['id']}})['then'](handleEntityNotFound(_0x3f3266,null))[_0xcf1d('0x26')](function(_0x3144ed){if(_0x3144ed){return _0x3144ed[_0xcf1d('0x4c')](_0x1b241c[_0xcf1d('0x49')][_0xcf1d('0x4d')],_[_0xcf1d('0x4e')](_0x1b241c[_0xcf1d('0x49')],[_0xcf1d('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x3f3266,null))['catch'](handleError(_0x3f3266,null));};exports[_0xcf1d('0x4f')]=function(_0x2cbdd5,_0x5b9e90,_0x17c5bd){var _0x576e5c={};var _0x53c237={};var _0x3da107;var _0x42bd90;return db[_0xcf1d('0x2c')][_0xcf1d('0x50')]({'where':{'id':_0x2cbdd5[_0xcf1d('0x4a')]['id']}})[_0xcf1d('0x26')](handleEntityNotFound(_0x5b9e90,null))['then'](function(_0x28ba5b){if(_0x28ba5b){_0x3da107=_0x28ba5b;_0x53c237['model']=_[_0xcf1d('0x2f')](db[_0xcf1d('0x4b')][_0xcf1d('0x51')]);_0x53c237['query']=_[_0xcf1d('0x2f')](_0x2cbdd5[_0xcf1d('0x30')]);_0x53c237['filters']=_[_0xcf1d('0x52')](_0x53c237[_0xcf1d('0x2e')],_0x53c237[_0xcf1d('0x30')]);_0x576e5c[_0xcf1d('0x32')]=_[_0xcf1d('0x52')](_0x53c237[_0xcf1d('0x2e')],qs['fields'](_0x2cbdd5[_0xcf1d('0x30')]['fields']));_0x576e5c['attributes']=_0x576e5c[_0xcf1d('0x32')][_0xcf1d('0x34')]?_0x576e5c[_0xcf1d('0x32')]:_0x53c237['model'];_0x576e5c[_0xcf1d('0x36')]=qs['sort'](_0x2cbdd5[_0xcf1d('0x30')][_0xcf1d('0x37')]);_0x576e5c[_0xcf1d('0x38')]=qs[_0xcf1d('0x31')](_[_0xcf1d('0x53')](_0x2cbdd5[_0xcf1d('0x30')],_0x53c237[_0xcf1d('0x31')]));if(_0x2cbdd5[_0xcf1d('0x30')][_0xcf1d('0x3a')]){_0x576e5c[_0xcf1d('0x38')]=_[_0xcf1d('0x39')](_0x576e5c[_0xcf1d('0x38')],{'$or':_[_0xcf1d('0x54')](_0x576e5c['attributes'],function(_0x15ce5f){var _0x501c45={};_0x501c45[_0x15ce5f]={'$like':'%'+_0x2cbdd5[_0xcf1d('0x30')][_0xcf1d('0x3a')]+'%'};return _0x501c45;})});}_0x576e5c=_['merge']({},_0x576e5c,_0x2cbdd5[_0xcf1d('0x3b')]);return _0x3da107[_0xcf1d('0x4f')](_0x576e5c);}})[_0xcf1d('0x26')](function(_0x4850ab){if(_0x4850ab){_0x42bd90=_0x4850ab[_0xcf1d('0x34')];if(!_0x2cbdd5[_0xcf1d('0x30')][_0xcf1d('0x55')](_0xcf1d('0x35'))){_0x576e5c[_0xcf1d('0x1f')]=qs[_0xcf1d('0x1f')](_0x2cbdd5[_0xcf1d('0x30')][_0xcf1d('0x1f')]);_0x576e5c[_0xcf1d('0x1e')]=qs[_0xcf1d('0x1e')](_0x2cbdd5[_0xcf1d('0x30')][_0xcf1d('0x1e')]);}return _0x3da107['getContacts'](_0x576e5c);}})[_0xcf1d('0x26')](function(_0x482828){if(_0x482828){return _0x482828?{'count':_0x42bd90,'rows':_0x482828}:null;}})[_0xcf1d('0x26')](respondWithResult(_0x5b9e90,null))[_0xcf1d('0x3e')](handleError(_0x5b9e90,null));}; \ No newline at end of file +var _0x276f=['path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','reject','save','then','destroy','get','Companies','UserProfileResource','stack','name','send','index','CmCompany','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','count','includeAll','include','findAll','rawAttributes','filters','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','addContacts','CmContact','ids','omit','getContacts','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4f00b1,_0x3f3728){var _0x4d5f5b=function(_0x34c824){while(--_0x34c824){_0x4f00b1['push'](_0x4f00b1['shift']());}};_0x4d5f5b(++_0x3f3728);}(_0x276f,0x14e));var _0xf276=function(_0xe20045,_0x3fade1){_0xe20045=_0xe20045-0x0;var _0x6c10f3=_0x276f[_0xe20045];return _0x6c10f3;};'use strict';var pdf=require(_0xf276('0x0'));var emlformat=require(_0xf276('0x1'));var rimraf=require(_0xf276('0x2'));var zipdir=require(_0xf276('0x3'));var jsonpatch=require(_0xf276('0x4'));var rp=require(_0xf276('0x5'));var moment=require(_0xf276('0x6'));var BPromise=require(_0xf276('0x7'));var Mustache=require(_0xf276('0x8'));var util=require(_0xf276('0x9'));var path=require(_0xf276('0xa'));var sox=require(_0xf276('0xb'));var csv=require(_0xf276('0xc'));var ejs=require(_0xf276('0xd'));var fs=require('fs');var _=require(_0xf276('0xe'));var squel=require(_0xf276('0xf'));var crypto=require(_0xf276('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf276('0x11'));var Redis=require('ioredis');var authService=require(_0xf276('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf276('0x13'));var logger=require(_0xf276('0x14'))(_0xf276('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf276('0x16'));var db=require(_0xf276('0x17'))['db'];function respondWithStatusCode(_0xac7fe7,_0x1dd50d){_0x1dd50d=_0x1dd50d||0xcc;return function(_0x2f0518){if(_0x2f0518){return _0xac7fe7[_0xf276('0x18')](_0x1dd50d);}return _0xac7fe7[_0xf276('0x19')](_0x1dd50d)[_0xf276('0x1a')]();};}function respondWithResult(_0xd2a0a5,_0x128022){_0x128022=_0x128022||0xc8;return function(_0x30feac){if(_0x30feac){return _0xd2a0a5[_0xf276('0x19')](_0x128022)[_0xf276('0x1b')](_0x30feac);}};}function respondWithFilteredResult(_0x345a17,_0x318d5a){return function(_0x5a5594){if(_0x5a5594){var _0x22ce8c=_0x5a5594['count'],_0x39ed83=_0x318d5a[_0xf276('0x1c')],_0x1047f0=_0x318d5a['offset']+_0x318d5a[_0xf276('0x1d')],_0x4f7e35;if(_0x1047f0>=_0x22ce8c){_0x1047f0=_0x22ce8c;_0x4f7e35=0xc8;}else{_0x4f7e35=0xce;}_0x345a17[_0xf276('0x19')](_0x4f7e35);return _0x345a17[_0xf276('0x1e')]('Content-Range',_0x39ed83+'-'+_0x1047f0+'/'+_0x22ce8c)['json'](_0x5a5594);}return null;};}function patchUpdates(_0x12822e){return function(_0x16f4f7){try{jsonpatch['apply'](_0x16f4f7,_0x12822e,!![]);}catch(_0x1ec2b6){return BPromise[_0xf276('0x1f')](_0x1ec2b6);}return _0x16f4f7[_0xf276('0x20')]();};}function saveUpdates(_0x8fab04,_0x886659){return function(_0x17e051){if(_0x17e051){return _0x17e051['update'](_0x8fab04)[_0xf276('0x21')](function(_0x11836e){return _0x11836e;});}return null;};}function removeEntity(_0x6ec0f1,_0x107fd9){return function(_0x4b64a0){if(_0x4b64a0){return _0x4b64a0[_0xf276('0x22')]()[_0xf276('0x21')](function(){var _0x16e744=_0x4b64a0[_0xf276('0x23')]({'plain':!![]});var _0x15af06=_0xf276('0x24');return db[_0xf276('0x25')][_0xf276('0x22')]({'where':{'type':_0x15af06,'resourceId':_0x16e744['id']}})['then'](function(){return _0x4b64a0;});})[_0xf276('0x21')](function(){_0x6ec0f1[_0xf276('0x19')](0xcc)[_0xf276('0x1a')]();});}};}function handleEntityNotFound(_0x1f40b8,_0x4af400){return function(_0x50867b){if(!_0x50867b){_0x1f40b8['sendStatus'](0x194);}return _0x50867b;};}function handleError(_0x31e44c,_0x3b172f){_0x3b172f=_0x3b172f||0x1f4;return function(_0x476679){logger['error'](_0x476679[_0xf276('0x26')]);if(_0x476679[_0xf276('0x27')]){delete _0x476679[_0xf276('0x27')];}_0x31e44c[_0xf276('0x19')](_0x3b172f)[_0xf276('0x28')](_0x476679);};}exports[_0xf276('0x29')]=function(_0x358a76,_0x3332a4){var _0x3a613a={},_0x152155={},_0x454f94={'count':0x0,'rows':[]};return db[_0xf276('0x2a')]['describe']()['then'](function(_0x36a300){_0x152155[_0xf276('0x2b')]=_[_0xf276('0x2c')](_0x36a300);_0x152155[_0xf276('0x2d')]=_[_0xf276('0x2c')](_0x358a76[_0xf276('0x2d')]);_0x152155['filters']=_['intersection'](_0x152155['model'],_0x152155[_0xf276('0x2d')]);_0x3a613a[_0xf276('0x2e')]=_[_0xf276('0x2f')](_0x152155[_0xf276('0x2b')],qs['fields'](_0x358a76[_0xf276('0x2d')][_0xf276('0x30')]));_0x3a613a[_0xf276('0x2e')]=_0x3a613a[_0xf276('0x2e')][_0xf276('0x31')]?_0x3a613a[_0xf276('0x2e')]:_0x152155['model'];if(!_0x358a76[_0xf276('0x2d')][_0xf276('0x32')](_0xf276('0x33'))){_0x3a613a[_0xf276('0x1d')]=qs[_0xf276('0x1d')](_0x358a76['query'][_0xf276('0x1d')]);_0x3a613a['offset']=qs[_0xf276('0x1c')](_0x358a76['query'][_0xf276('0x1c')]);}_0x3a613a[_0xf276('0x34')]=qs[_0xf276('0x35')](_0x358a76[_0xf276('0x2d')][_0xf276('0x35')]);_0x3a613a[_0xf276('0x36')]=qs['filters'](_[_0xf276('0x37')](_0x358a76[_0xf276('0x2d')],_0x152155['filters']),_0x36a300);if(_0x358a76[_0xf276('0x2d')]['filter']){_0x3a613a[_0xf276('0x36')]=_[_0xf276('0x38')](_0x3a613a['where'],{'$or':_[_0xf276('0x39')](_0x3a613a['attributes'],function(_0xe9d9e4){var _0x1113c0={};_0x1113c0[_0xe9d9e4]={'$like':'%'+_0x358a76[_0xf276('0x2d')][_0xf276('0x3a')]+'%'};return _0x1113c0;})});}_0x3a613a=_[_0xf276('0x38')]({},_0x3a613a,_0x358a76[_0xf276('0x3b')]);var _0x53bf0a={'where':_0x3a613a['where']};return db[_0xf276('0x2a')][_0xf276('0x3c')](_0x53bf0a)[_0xf276('0x21')](function(_0x214fc9){_0x454f94[_0xf276('0x3c')]=_0x214fc9;if(_0x358a76[_0xf276('0x2d')][_0xf276('0x3d')]){_0x3a613a[_0xf276('0x3e')]=[{'all':!![]}];}return db[_0xf276('0x2a')][_0xf276('0x3f')](_0x3a613a);})[_0xf276('0x21')](function(_0x48ef13){_0x454f94['rows']=_0x48ef13;return _0x454f94;})[_0xf276('0x21')](respondWithFilteredResult(_0x3332a4,_0x3a613a))['catch'](handleError(_0x3332a4,null));})['catch'](handleError(_0x3332a4,null));};exports['show']=function(_0x487770,_0x1421b7){var _0x163e94={'raw':![],'where':{'id':_0x487770['params']['id']}},_0x3fa1a3={};_0x3fa1a3[_0xf276('0x2b')]=_[_0xf276('0x2c')](db['CmCompany'][_0xf276('0x40')]);_0x3fa1a3[_0xf276('0x2d')]=_[_0xf276('0x2c')](_0x487770[_0xf276('0x2d')]);_0x3fa1a3[_0xf276('0x41')]=_['intersection'](_0x3fa1a3[_0xf276('0x2b')],_0x3fa1a3['query']);_0x163e94[_0xf276('0x2e')]=_[_0xf276('0x2f')](_0x3fa1a3[_0xf276('0x2b')],qs[_0xf276('0x30')](_0x487770[_0xf276('0x2d')][_0xf276('0x30')]));_0x163e94[_0xf276('0x2e')]=_0x163e94[_0xf276('0x2e')][_0xf276('0x31')]?_0x163e94['attributes']:_0x3fa1a3[_0xf276('0x2b')];if(_0x487770[_0xf276('0x2d')][_0xf276('0x3d')]){_0x163e94[_0xf276('0x3e')]=[{'all':!![]}];}_0x163e94=_[_0xf276('0x38')]({},_0x163e94,_0x487770[_0xf276('0x3b')]);return db['CmCompany'][_0xf276('0x42')](_0x163e94)[_0xf276('0x21')](handleEntityNotFound(_0x1421b7,null))[_0xf276('0x21')](respondWithResult(_0x1421b7,null))[_0xf276('0x43')](handleError(_0x1421b7,null));};exports[_0xf276('0x44')]=function(_0x325197,_0x5b5df7){return db[_0xf276('0x2a')][_0xf276('0x44')](_0x325197['body'],{})['then'](function(_0x14ef0b){var _0xe6aca3=_0x325197[_0xf276('0x45')]['get']({'plain':!![]});if(!_0xe6aca3)throw new Error(_0xf276('0x46'));if(_0xe6aca3[_0xf276('0x47')]===_0xf276('0x45')){var _0x58ad84=_0x14ef0b[_0xf276('0x23')]({'plain':!![]});var _0xe10f0f=_0xf276('0x24');return db[_0xf276('0x48')]['find']({'where':{'name':_0xe10f0f,'userProfileId':_0xe6aca3[_0xf276('0x49')]},'raw':!![]})[_0xf276('0x21')](function(_0x5ae2a8){if(_0x5ae2a8&&_0x5ae2a8[_0xf276('0x4a')]===0x0){return db[_0xf276('0x25')][_0xf276('0x44')]({'name':_0x58ad84[_0xf276('0x27')],'resourceId':_0x58ad84['id'],'type':_0x5ae2a8[_0xf276('0x27')],'sectionId':_0x5ae2a8['id']},{})[_0xf276('0x21')](function(){return _0x14ef0b;});}else{return _0x14ef0b;}})[_0xf276('0x43')](function(_0xfc15a8){logger['error'](_0xf276('0x4b'),_0xfc15a8);throw _0xfc15a8;});}return _0x14ef0b;})[_0xf276('0x21')](respondWithResult(_0x5b5df7,0xc9))['catch'](handleError(_0x5b5df7,null));};exports[_0xf276('0x4c')]=function(_0x1e55e0,_0x2b8743){if(_0x1e55e0[_0xf276('0x4d')]['id']){delete _0x1e55e0[_0xf276('0x4d')]['id'];}return db[_0xf276('0x2a')][_0xf276('0x42')]({'where':{'id':_0x1e55e0['params']['id']}})[_0xf276('0x21')](handleEntityNotFound(_0x2b8743,null))[_0xf276('0x21')](saveUpdates(_0x1e55e0[_0xf276('0x4d')],null))[_0xf276('0x21')](respondWithResult(_0x2b8743,null))[_0xf276('0x43')](handleError(_0x2b8743,null));};exports['destroy']=function(_0x5b60e1,_0x9282aa){return db[_0xf276('0x2a')][_0xf276('0x42')]({'where':{'id':_0x5b60e1[_0xf276('0x4e')]['id']}})[_0xf276('0x21')](handleEntityNotFound(_0x9282aa,null))[_0xf276('0x21')](removeEntity(_0x9282aa,null))[_0xf276('0x43')](handleError(_0x9282aa,null));};exports[_0xf276('0x4f')]=function(_0x2e5691,_0xe6ea0f){return db[_0xf276('0x2a')][_0xf276('0x4f')]()['then'](respondWithResult(_0xe6ea0f,null))[_0xf276('0x43')](handleError(_0xe6ea0f,null));};exports[_0xf276('0x50')]=function(_0x5aff55,_0x89b47e,_0x11d105){return db[_0xf276('0x51')][_0xf276('0x42')]({'where':{'id':_0x5aff55[_0xf276('0x4e')]['id']}})[_0xf276('0x21')](handleEntityNotFound(_0x89b47e,null))[_0xf276('0x21')](function(_0x484e9f){if(_0x484e9f){return _0x484e9f[_0xf276('0x50')](_0x5aff55[_0xf276('0x4d')][_0xf276('0x52')],_[_0xf276('0x53')](_0x5aff55['body'],[_0xf276('0x52'),'id'])||{});}})[_0xf276('0x21')](respondWithResult(_0x89b47e,null))['catch'](handleError(_0x89b47e,null));};exports[_0xf276('0x54')]=function(_0x4c4328,_0x40dd5a,_0x37d5a3){var _0x20b85a={};var _0x190a3a={};var _0xf05787;var _0x210c5e;return db[_0xf276('0x2a')][_0xf276('0x55')]({'where':{'id':_0x4c4328[_0xf276('0x4e')]['id']}})[_0xf276('0x21')](handleEntityNotFound(_0x40dd5a,null))[_0xf276('0x21')](function(_0x24491f){if(_0x24491f){_0xf05787=_0x24491f;_0x190a3a[_0xf276('0x2b')]=_[_0xf276('0x2c')](db['CmContact'][_0xf276('0x40')]);_0x190a3a['query']=_[_0xf276('0x2c')](_0x4c4328[_0xf276('0x2d')]);_0x190a3a[_0xf276('0x41')]=_[_0xf276('0x2f')](_0x190a3a[_0xf276('0x2b')],_0x190a3a['query']);_0x20b85a[_0xf276('0x2e')]=_[_0xf276('0x2f')](_0x190a3a[_0xf276('0x2b')],qs[_0xf276('0x30')](_0x4c4328[_0xf276('0x2d')][_0xf276('0x30')]));_0x20b85a['attributes']=_0x20b85a['attributes']['length']?_0x20b85a['attributes']:_0x190a3a['model'];_0x20b85a[_0xf276('0x34')]=qs[_0xf276('0x35')](_0x4c4328['query'][_0xf276('0x35')]);_0x20b85a[_0xf276('0x36')]=qs[_0xf276('0x41')](_[_0xf276('0x37')](_0x4c4328['query'],_0x190a3a[_0xf276('0x41')]));if(_0x4c4328[_0xf276('0x2d')][_0xf276('0x3a')]){_0x20b85a['where']=_[_0xf276('0x38')](_0x20b85a[_0xf276('0x36')],{'$or':_[_0xf276('0x39')](_0x20b85a[_0xf276('0x2e')],function(_0x44dca3){var _0x5cdfc7={};_0x5cdfc7[_0x44dca3]={'$like':'%'+_0x4c4328['query'][_0xf276('0x3a')]+'%'};return _0x5cdfc7;})});}_0x20b85a=_[_0xf276('0x38')]({},_0x20b85a,_0x4c4328[_0xf276('0x3b')]);return _0xf05787[_0xf276('0x54')](_0x20b85a);}})[_0xf276('0x21')](function(_0x142e06){if(_0x142e06){_0x210c5e=_0x142e06['length'];if(!_0x4c4328[_0xf276('0x2d')][_0xf276('0x32')]('nolimit')){_0x20b85a[_0xf276('0x1d')]=qs['limit'](_0x4c4328[_0xf276('0x2d')][_0xf276('0x1d')]);_0x20b85a['offset']=qs[_0xf276('0x1c')](_0x4c4328[_0xf276('0x2d')][_0xf276('0x1c')]);}return _0xf05787[_0xf276('0x54')](_0x20b85a);}})['then'](function(_0x15ad13){if(_0x15ad13){return _0x15ad13?{'count':_0x210c5e,'rows':_0x15ad13}:null;}})[_0xf276('0x21')](respondWithResult(_0x40dd5a,null))[_0xf276('0x43')](handleError(_0x40dd5a,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 1ea5b97..fc1eb5a 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 _0x0207=['CmCompany','cm_companies','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define'];(function(_0x47bbd5,_0xfab6bc){var _0xea2a13=function(_0xc1964c){while(--_0xc1964c){_0x47bbd5['push'](_0x47bbd5['shift']());}};_0xea2a13(++_0xfab6bc);}(_0x0207,0x162));var _0x7020=function(_0x1d006a,_0x2812b5){_0x1d006a=_0x1d006a-0x0;var _0x20a76b=_0x0207[_0x1d006a];return _0x20a76b;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7020('0x1'));var BPromise=require(_0x7020('0x2'));var rp=require(_0x7020('0x3'));var fs=require('fs');var path=require(_0x7020('0x4'));var rimraf=require(_0x7020('0x5'));var config=require(_0x7020('0x6'));var attributes=require(_0x7020('0x7'));module['exports']=function(_0x5074d7,_0x38c320){return _0x5074d7[_0x7020('0x8')](_0x7020('0x9'),attributes,{'tableName':_0x7020('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f42=['bluebird','path','../../config/environment','exports','define','CmCompany','cm_companies','lodash','../../config/logger','api'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x7f42,0x1dd));var _0x27f4=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x7f42[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x27f4('0x0'));var util=require('util');var logger=require(_0x27f4('0x1'))(_0x27f4('0x2'));var moment=require('moment');var BPromise=require(_0x27f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x27f4('0x4'));var rimraf=require('rimraf');var config=require(_0x27f4('0x5'));var attributes=require('./cmCompany.attributes');module[_0x27f4('0x6')]=function(_0x5c9286,_0x256ac9){return _0x5c9286[_0x27f4('0x7')](_0x27f4('0x8'),attributes,{'tableName':_0x27f4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index b10f3f2..0ad3de0 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 _0x330d=['CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x204922,_0x2322e8){var _0x174e4a=function(_0x21d57d){while(--_0x21d57d){_0x204922['push'](_0x204922['shift']());}};_0x174e4a(++_0x2322e8);}(_0x330d,0xb2));var _0xd330=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x330d[_0xd0a847];return _0x2536ec;};'use strict';var _=require(_0xd330('0x0'));var util=require(_0xd330('0x1'));var moment=require(_0xd330('0x2'));var BPromise=require('bluebird');var rs=require(_0xd330('0x3'));var fs=require('fs');var Redis=require(_0xd330('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd330('0x5'));var logger=require(_0xd330('0x6'))('rpc');var config=require(_0xd330('0x7'));var jayson=require(_0xd330('0x8'));var client=jayson[_0xd330('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23fa2f,_0x55d0d0,_0x42cc42){return new BPromise(function(_0x1eed0f,_0x4eee71){return client['request'](_0x23fa2f,_0x42cc42)[_0xd330('0xa')](function(_0x3877ce){logger['info'](_0xd330('0xb'),_0x55d0d0,_0xd330('0xc'));logger['debug'](_0xd330('0xd'),_0x55d0d0,_0xd330('0xc'),JSON[_0xd330('0xe')](_0x3877ce));if(_0x3877ce[_0xd330('0xf')]){if(_0x3877ce[_0xd330('0xf')][_0xd330('0x10')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x55d0d0,_0x3877ce[_0xd330('0xf')][_0xd330('0x11')]);return _0x4eee71(_0x3877ce[_0xd330('0xf')][_0xd330('0x11')]);}logger[_0xd330('0xf')]('CmCompany,\x20%s,\x20%s',_0x55d0d0,_0x3877ce[_0xd330('0xf')][_0xd330('0x11')]);return _0x1eed0f(_0x3877ce[_0xd330('0xf')][_0xd330('0x11')]);}else{logger[_0xd330('0x12')](_0xd330('0xb'),_0x55d0d0,_0xd330('0xc'));_0x1eed0f(_0x3877ce[_0xd330('0x13')][_0xd330('0x11')]);}})[_0xd330('0x14')](function(_0x319ab6){logger[_0xd330('0xf')](_0xd330('0xb'),_0x55d0d0,_0x319ab6);_0x4eee71(_0x319ab6);});});} \ No newline at end of file +var _0x3986=['error','code','message','info','result','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3986,0x16e));var _0x6398=function(_0x287015,_0x217115){_0x287015=_0x287015-0x0;var _0x31ac71=_0x3986[_0x287015];return _0x31ac71;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6398('0x0'));var fs=require('fs');var Redis=require(_0x6398('0x1'));var db=require(_0x6398('0x2'))['db'];var utils=require(_0x6398('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x6398('0x4'));var jayson=require(_0x6398('0x5'));var client=jayson[_0x6398('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x474359,_0x1854da,_0x41200a){return new BPromise(function(_0x3e2f15,_0x374939){return client[_0x6398('0x7')](_0x474359,_0x41200a)[_0x6398('0x8')](function(_0x276335){logger['info'](_0x6398('0x9'),_0x1854da,_0x6398('0xa'));logger[_0x6398('0xb')](_0x6398('0xc'),_0x1854da,_0x6398('0xa'),JSON[_0x6398('0xd')](_0x276335));if(_0x276335[_0x6398('0xe')]){if(_0x276335[_0x6398('0xe')][_0x6398('0xf')]===0x1f4){logger[_0x6398('0xe')]('CmCompany,\x20%s,\x20%s',_0x1854da,_0x276335[_0x6398('0xe')][_0x6398('0x10')]);return _0x374939(_0x276335[_0x6398('0xe')][_0x6398('0x10')]);}logger[_0x6398('0xe')]('CmCompany,\x20%s,\x20%s',_0x1854da,_0x276335[_0x6398('0xe')][_0x6398('0x10')]);return _0x3e2f15(_0x276335[_0x6398('0xe')]['message']);}else{logger[_0x6398('0x11')](_0x6398('0x9'),_0x1854da,_0x6398('0xa'));_0x3e2f15(_0x276335[_0x6398('0x12')]['message']);}})['catch'](function(_0x166f26){logger[_0x6398('0xe')](_0x6398('0x9'),_0x1854da,_0x166f26);_0x374939(_0x166f26);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 164adc4..ae421d5 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 _0x66fa=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','create','addContacts','update','multer'];(function(_0x341e80,_0x205963){var _0x4494f9=function(_0x5c8497){while(--_0x5c8497){_0x341e80['push'](_0x341e80['shift']());}};_0x4494f9(++_0x205963);}(_0x66fa,0x117));var _0xa66f=function(_0x223c41,_0x5033cd){_0x223c41=_0x223c41-0x0;var _0x5c485b=_0x66fa[_0x223c41];return _0x5c485b;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var auth=require(_0xa66f('0x5'));var interaction=require(_0xa66f('0x6'));var config=require(_0xa66f('0x7'));var controller=require(_0xa66f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa66f('0x9')]);router[_0xa66f('0xa')](_0xa66f('0xb'),auth[_0xa66f('0xc')](),controller[_0xa66f('0xd')]);router['get'](_0xa66f('0xe'),auth['isAuthenticated'](),controller[_0xa66f('0xf')]);router['get'](_0xa66f('0x10'),auth['isAuthenticated'](),controller['getContacts']);router['post']('/',auth[_0xa66f('0xc')](),controller[_0xa66f('0x11')]);router['post'](_0xa66f('0x10'),auth['isAuthenticated'](),controller[_0xa66f('0x12')]);router['put'](_0xa66f('0xe'),auth[_0xa66f('0xc')](),controller[_0xa66f('0x13')]);router['delete']('/:id',auth[_0xa66f('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x01d9=['post','create','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/contacts','getContacts'];(function(_0x376f6d,_0x3fa87d){var _0x532949=function(_0x4220ff){while(--_0x4220ff){_0x376f6d['push'](_0x376f6d['shift']());}};_0x532949(++_0x3fa87d);}(_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 auth=require(_0x901d('0x5'));var interaction=require(_0x901d('0x6'));var config=require(_0x901d('0x7'));var controller=require(_0x901d('0x8'));router[_0x901d('0x9')]('/',auth[_0x901d('0xa')](),controller['index']);router[_0x901d('0x9')](_0x901d('0xb'),auth[_0x901d('0xa')](),controller[_0x901d('0xc')]);router[_0x901d('0x9')](_0x901d('0xd'),auth[_0x901d('0xa')](),controller[_0x901d('0xe')]);router[_0x901d('0x9')](_0x901d('0xf'),auth[_0x901d('0xa')](),controller[_0x901d('0x10')]);router[_0x901d('0x11')]('/',auth['isAuthenticated'](),controller[_0x901d('0x12')]);router['post'](_0x901d('0xf'),auth[_0x901d('0xa')](),controller[_0x901d('0x13')]);router[_0x901d('0x14')](_0x901d('0xd'),auth['isAuthenticated'](),controller[_0x901d('0x15')]);router[_0x901d('0x16')](_0x901d('0xd'),auth[_0x901d('0xa')](),controller[_0x901d('0x17')]);module[_0x901d('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 6231638..bd1137c 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 _0x50c8=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','INTEGER'];(function(_0x4ce93d,_0x552831){var _0x209b1a=function(_0x40358a){while(--_0x40358a){_0x4ce93d['push'](_0x4ce93d['shift']());}};_0x209b1a(++_0x552831);}(_0x50c8,0xcb));var _0x850c=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x50c8[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x850c('0x0'));var Sequelize=require(_0x850c('0x1'));module[_0x850c('0x2')]={'firstName':{'type':Sequelize[_0x850c('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x850c('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x850c('0x3')]},'country':{'type':Sequelize[_0x850c('0x3')]},'dateOfBirth':{'type':Sequelize[_0x850c('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x850c('0x3')]},'mobile':{'type':Sequelize[_0x850c('0x3')]},'fax':{'type':Sequelize[_0x850c('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x850c('0x3')]},'facebook':{'type':Sequelize[_0x850c('0x3')]},'fb_data':{'type':Sequelize[_0x850c('0x3')]},'twitter':{'type':Sequelize[_0x850c('0x3')]},'skype':{'type':Sequelize[_0x850c('0x3')]},'teams':{'type':Sequelize[_0x850c('0x3')]},'viber':{'type':Sequelize[_0x850c('0x3')]},'line':{'type':Sequelize[_0x850c('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x850c('0x3')]},'UserId':{'type':Sequelize[_0x850c('0x4')]},'priority':{'type':Sequelize[_0x850c('0x4')](0x2)[_0x850c('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x850c('0x6')],'defaultValue':Sequelize[_0x850c('0x7')]}}; \ No newline at end of file +var _0x9d03=['UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x2ec112,_0x17df50){var _0x1cc13b=function(_0x52ce5a){while(--_0x52ce5a){_0x2ec112['push'](_0x2ec112['shift']());}};_0x1cc13b(++_0x17df50);}(_0x9d03,0xdb));var _0x39d0=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9d03[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x39d0('0x0'));var Sequelize=require(_0x39d0('0x1'));module[_0x39d0('0x2')]={'firstName':{'type':Sequelize[_0x39d0('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x39d0('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x39d0('0x3')]},'city':{'type':Sequelize[_0x39d0('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x39d0('0x3')]},'description':{'type':Sequelize[_0x39d0('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x39d0('0x3')]},'fax':{'type':Sequelize[_0x39d0('0x3')]},'email':{'type':Sequelize[_0x39d0('0x3')]},'url':{'type':Sequelize[_0x39d0('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x39d0('0x3')]},'teams':{'type':Sequelize[_0x39d0('0x3')]},'viber':{'type':Sequelize[_0x39d0('0x3')]},'line':{'type':Sequelize[_0x39d0('0x3')]},'wechat':{'type':Sequelize[_0x39d0('0x3')]},'telegram':{'type':Sequelize[_0x39d0('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x39d0('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x39d0('0x6')],'defaultValue':Sequelize[_0x39d0('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index a233292..77f44c1 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 _0x7a83=['sort','pick','select','field','color','from','tools_tags','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','expr','search','sqlOperator','conditions','find','Tag','value','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','buildExpression','text','start','filter','isNil','push','isEmpty','ListId','where','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','split','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','having','t.id\x20IN\x20?','resolve','user','some','getLists','c.ListId\x20IS\x20NULL','role','sequelize','toString','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.ListId','c.createdAt','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','startsWith','displayName','findAll','alias','custom','columnName','body','get','mergeWith','join','info','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','show','$and','cf_%d','omit','pickBy','format','setFields','toParam','values','phone','getTags','rawAttributes','options','setTags','ids','getHoppers','includeAll','include','ContactId','getHopperFinals','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','0777','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','agent','binding','child_process','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./cmContact.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','CmContact','describe','length','cf_','CmCustomField','findOne','trimStart','fieldType','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x5d35ee,_0x1b0884){var _0xfe7874=function(_0x18b3fe){while(--_0x18b3fe){_0x5d35ee['push'](_0x5d35ee['shift']());}};_0xfe7874(++_0x1b0884);}(_0x7a83,0x1a1));var _0x37a8=function(_0x5ce15c,_0x19c917){_0x5ce15c=_0x5ce15c-0x0;var _0x36e4f5=_0x7a83[_0x5ce15c];return _0x36e4f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x37a8('0x0'));var rimraf=require(_0x37a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x37a8('0x2'));var rp=require(_0x37a8('0x3'));var moment=require('moment');var BPromise=require(_0x37a8('0x4'));var Mustache=require(_0x37a8('0x5'));var util=require('util');var path=require(_0x37a8('0x6'));var sox=require(_0x37a8('0x7'));var csv=require(_0x37a8('0x8'));var ejs=require(_0x37a8('0x9'));var fs=require('fs');var _=require(_0x37a8('0xa'));var squel=require(_0x37a8('0xb'));var crypto=require('crypto');var jsforce=require(_0x37a8('0xc'));var deskjs=require(_0x37a8('0xd'));var toCsv=require(_0x37a8('0x8'));var querystring=require(_0x37a8('0xe'));var Papa=require(_0x37a8('0xf'));var Redis=require(_0x37a8('0x10'));var authService=require(_0x37a8('0x11'));var qs=require(_0x37a8('0x12'));var as=require(_0x37a8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x37a8('0x14'));var utils=require(_0x37a8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x37a8('0x16'));var db=require(_0x37a8('0x17'))['db'];config[_0x37a8('0x18')]=_[_0x37a8('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37a8('0x18')]));require(_0x37a8('0x1a'))[_0x37a8('0x1b')](socket);function respondWithStatusCode(_0x2a65ed,_0x479ab1){_0x479ab1=_0x479ab1||0xcc;return function(_0x43a52c){if(_0x43a52c){return _0x2a65ed[_0x37a8('0x1c')](_0x479ab1);}return _0x2a65ed['status'](_0x479ab1)['end']();};}function respondWithResult(_0xf11550,_0xbbdf92){_0xbbdf92=_0xbbdf92||0xc8;return function(_0x10bf03){if(_0x10bf03){return _0xf11550[_0x37a8('0x1d')](_0xbbdf92)[_0x37a8('0x1e')](_0x10bf03);}};}function respondWithFilteredResult(_0x45ba35,_0x75bb23){return function(_0x51111e){if(_0x51111e){var _0x12a50e=_0x51111e[_0x37a8('0x1f')],_0x4bb823=_0x75bb23[_0x37a8('0x20')],_0x324350=_0x75bb23['offset']+_0x75bb23[_0x37a8('0x21')],_0x57e4e0;if(_0x324350>=_0x12a50e){_0x324350=_0x12a50e;_0x57e4e0=0xc8;}else{_0x57e4e0=0xce;}_0x45ba35[_0x37a8('0x1d')](_0x57e4e0);return _0x45ba35['set'](_0x37a8('0x22'),_0x4bb823+'-'+_0x324350+'/'+_0x12a50e)[_0x37a8('0x1e')](_0x51111e);}return null;};}function patchUpdates(_0x5597b4){return function(_0x2326e4){try{jsonpatch[_0x37a8('0x23')](_0x2326e4,_0x5597b4,!![]);}catch(_0x442735){return BPromise['reject'](_0x442735);}return _0x2326e4['save']();};}function saveUpdates(_0x34061f,_0x19a607){return function(_0x1c8ccc){if(_0x1c8ccc){return _0x1c8ccc[_0x37a8('0x24')](_0x34061f)[_0x37a8('0x25')](function(_0x1beb15){return _0x1beb15;});}return null;};}function removeEntity(_0x28aaa7,_0x4d8615){return function(_0xb9275d){if(_0xb9275d){return _0xb9275d[_0x37a8('0x26')]()['then'](function(){_0x28aaa7['status'](0xcc)[_0x37a8('0x27')]();});}};}function handleEntityNotFound(_0x84b6a6,_0x94226c){return function(_0x3d97bc){if(!_0x3d97bc){_0x84b6a6['sendStatus'](0x194);}return _0x3d97bc;};}function handleError(_0x5ec3f7,_0x1997d6){_0x1997d6=_0x1997d6||0x1f4;return function(_0x7991c5){logger[_0x37a8('0x28')](_0x7991c5[_0x37a8('0x29')]);if(_0x7991c5[_0x37a8('0x2a')]){delete _0x7991c5[_0x37a8('0x2a')];}_0x5ec3f7[_0x37a8('0x1d')](_0x1997d6)[_0x37a8('0x2b')](_0x7991c5);};}exports[_0x37a8('0x2c')]=function(_0x359538,_0x8d3c48){var _0x3bc52b={},_0x56ef63={},_0x3eef5d={'count':0x0,'rows':[]};return db[_0x37a8('0x2d')][_0x37a8('0x2e')]()[_0x37a8('0x25')](function(_0x46de80){var _0x3355df=[];for(var _0x3d6750=0x0;_0x3d67500x1){_0x155f96['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x22899e),null);}else{if(qs[_0x37a8('0x6e')](_0x22899e)){_0x155f96['or']('c.id\x20LIKE\x20?',_0x22899e+'%');_0x155f96['or'](_0x37a8('0x6f'),_0x22899e+'%');_0x155f96['or'](_0x37a8('0x70'),_0x22899e+'%');_0x155f96['or'](_0x37a8('0x71'),_0x22899e+'%');}else if(qs['isEmail'](_0x22899e)){_0x155f96['or'](_0x37a8('0x72'),_0x22899e+'%');}else{_0x155f96['or']('c.firstName\x20LIKE\x20?','%'+_0x22899e+'%');_0x155f96['or']('c.lastName\x20LIKE\x20?','%'+_0x22899e+'%');_0x155f96['or'](_0x37a8('0x72'),'%'+_0x22899e+'%');}}}}_0xc64cb2[_0x37a8('0x65')](_0x155f96);_0xc64cb2[_0x37a8('0x73')](_0x37a8('0x74'));var _0x178b46={'type':db[_0x37a8('0x75')][_0x37a8('0x76')][_0x37a8('0x77')],'raw':!![]};var _0x48b286=_0xc64cb2[_0x37a8('0x78')]()['field'](_0x37a8('0x74'));if(_0x3bc52b[_0x37a8('0x79')]){_0x3bc52b[_0x37a8('0x79')][_0x37a8('0x55')](function(_0xf3a8ae){_0xc64cb2[_0x37a8('0x79')]('c.'+_0xf3a8ae[0x0],_0xf3a8ae[0x1]===_0x37a8('0x7a')?![]:!![]);});}if(!_[_0x37a8('0x63')](_0x7cbd7b)){_0xc64cb2[_0x37a8('0x7b')](_0x4694aa);_0x48b286['where'](_0x37a8('0x7c'),_0x7cbd7b);}BPromise[_0x37a8('0x7d')]()[_0x37a8('0x25')](function(){if(!_0xc3c1a6)return;if(_0x359538[_0x37a8('0x7e')]['role']!=='agent')return;if(!_[_0x37a8('0x7f')](_0xc3c1a6[_0x37a8('0x50')],[_0x37a8('0x42'),'User'])){return _0x359538[_0x37a8('0x7e')][_0x37a8('0x80')]({'attributes':['id'],'raw':!![]})[_0x37a8('0x25')](function(_0xcf6e16){if(_[_0x37a8('0x63')](_0xcf6e16)){_0x48b286[_0x37a8('0x65')](_0x37a8('0x81'));_0xc64cb2[_0x37a8('0x65')](_0x37a8('0x81'));}else{_0x48b286[_0x37a8('0x65')](_0x37a8('0x66'),_['map'](_0xcf6e16,'id'));_0xc64cb2[_0x37a8('0x65')]('c.ListId\x20IN\x20?',_['map'](_0xcf6e16,'id'));}});}})[_0x37a8('0x25')](function(){if(_0x359538[_0x37a8('0x7e')][_0x37a8('0x82')]==='agent'&&!_0xc3c1a6&&!_0x359538[_0x37a8('0x38')][_0x37a8('0x64')])return[];return db[_0x37a8('0x83')][_0x37a8('0x38')](_0x48b286['toString'](),_0x178b46);})['then'](function(_0x398a6f){_0x3eef5d[_0x37a8('0x1f')]=_0x398a6f[_0x37a8('0x2f')];if(_0x3eef5d[_0x37a8('0x1f')]===0x0)return[];return db['sequelize'][_0x37a8('0x38')](_0x4a6d41[_0x37a8('0x84')](),_0x178b46)['then'](function(_0x3af07d){_0x27d22d=_['keyBy'](_0x3af07d,'id');_0x178b46=_[_0x37a8('0x85')](_0x178b46,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x359538[_0x37a8('0x38')]['fields']){_0x3bc52b[_0x37a8('0x3b')][_0x37a8('0x55')](function(_0x2fd0ab){_0xc64cb2[_0x37a8('0x42')]('c.'+_0x2fd0ab);});}else{_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x74'));_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x86'));_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x87'));_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x88'));_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x89'));_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x8a'));_0xc64cb2[_0x37a8('0x42')]('c.email');_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x8b'));_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x8c'));_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x8d'));_0xc64cb2[_0x37a8('0x42')](_0x37a8('0x8e'),'TagIds');}if(_0x3bc52b[_0x37a8('0x21')])_0xc64cb2[_0x37a8('0x21')](_0x3bc52b[_0x37a8('0x21')]);if(_0x3bc52b[_0x37a8('0x20')])_0xc64cb2[_0x37a8('0x20')](_0x3bc52b[_0x37a8('0x20')]);return db[_0x37a8('0x83')][_0x37a8('0x38')](_0xc64cb2[_0x37a8('0x84')](),_0x178b46);});})[_0x37a8('0x25')](function(_0x1aec0f){_0x1aec0f['forEach'](function(_0x3b18c4){if(_0x3b18c4[_0x37a8('0x8f')]){_0x3b18c4[_0x37a8('0x90')]=[];_0x3b18c4[_0x37a8('0x8f')][_0x37a8('0x6d')](',')[_0x37a8('0x55')](function(_0x403295){_0x3b18c4['Tags'][_0x37a8('0x62')](_0x27d22d[_0x403295]);});}delete _0x3b18c4['TagIds'];});_0x3eef5d[_0x37a8('0x91')]=_0x1aec0f;return _0x3eef5d;})['then'](respondWithFilteredResult(_0x8d3c48,_0x3bc52b));})[_0x37a8('0x92')](handleError(_0x8d3c48,null));};exports[_0x37a8('0x26')]=function(_0x40ee59,_0x5ef928){return db[_0x37a8('0x2d')]['find']({'where':{'id':_0x40ee59[_0x37a8('0x93')]['id']}})[_0x37a8('0x25')](handleEntityNotFound(_0x5ef928,null))[_0x37a8('0x25')](removeEntity(_0x5ef928,null))['catch'](handleError(_0x5ef928,null));};exports[_0x37a8('0x2e')]=function(_0x5481b2,_0x54718f){return db[_0x37a8('0x2d')]['describe']()['then'](function(_0x1f9433){delete _0x1f9433[_0x37a8('0x94')];for(var _0x32f9a0=0x0;_0x32f9a0=_0x1315ea){_0x46a747=_0x1315ea;_0x276ff8=0xc8;}else{_0x276ff8=0xce;}_0x253731['status'](_0x276ff8);return _0x253731[_0x767f('0x22')](_0x767f('0x23'),_0x1ef774+'-'+_0x46a747+'/'+_0x1315ea)['json'](_0x3a5e10);}return null;};}function patchUpdates(_0x234375){return function(_0x31e67f){try{jsonpatch[_0x767f('0x24')](_0x31e67f,_0x234375,!![]);}catch(_0x1c4de7){return BPromise[_0x767f('0x25')](_0x1c4de7);}return _0x31e67f['save']();};}function saveUpdates(_0x4e21f7,_0x5629b6){return function(_0x40869a){if(_0x40869a){return _0x40869a[_0x767f('0x26')](_0x4e21f7)[_0x767f('0x27')](function(_0x587b4b){return _0x587b4b;});}return null;};}function removeEntity(_0x386298,_0x1645f4){return function(_0x631f96){if(_0x631f96){return _0x631f96['destroy']()[_0x767f('0x27')](function(){_0x386298[_0x767f('0x1e')](0xcc)[_0x767f('0x1f')]();});}};}function handleEntityNotFound(_0x162dcf,_0x103eec){return function(_0x3182a6){if(!_0x3182a6){_0x162dcf[_0x767f('0x28')](0x194);}return _0x3182a6;};}function handleError(_0x15e596,_0x45a533){_0x45a533=_0x45a533||0x1f4;return function(_0x4b9f48){logger['error'](_0x4b9f48[_0x767f('0x29')]);if(_0x4b9f48[_0x767f('0x2a')]){delete _0x4b9f48['name'];}_0x15e596['status'](_0x45a533)[_0x767f('0x2b')](_0x4b9f48);};}exports[_0x767f('0x2c')]=function(_0x4bcc0c,_0x434d47){var _0x12d52e={},_0x27fc28={},_0x13fbb8={'count':0x0,'rows':[]};return db[_0x767f('0x2d')][_0x767f('0x2e')]()[_0x767f('0x27')](function(_0x3b9f5b){var _0x53e9c6=[];for(var _0x3daa2c=0x0;_0x3daa2c0x1){_0x339e63['or'](_0x767f('0x72'),qs[_0x767f('0x73')](_0x2de30b),null);}else{if(qs[_0x767f('0x74')](_0x2de30b)){_0x339e63['or'](_0x767f('0x75'),_0x2de30b+'%');_0x339e63['or'](_0x767f('0x76'),_0x2de30b+'%');_0x339e63['or'](_0x767f('0x77'),_0x2de30b+'%');_0x339e63['or'](_0x767f('0x78'),_0x2de30b+'%');}else if(qs[_0x767f('0x79')](_0x2de30b)){_0x339e63['or']('c.email\x20LIKE\x20?',_0x2de30b+'%');}else{_0x339e63['or'](_0x767f('0x7a'),'%'+_0x2de30b+'%');_0x339e63['or'](_0x767f('0x7b'),'%'+_0x2de30b+'%');_0x339e63['or']('c.email\x20LIKE\x20?','%'+_0x2de30b+'%');}}}}_0x3031b7[_0x767f('0x50')](_0x339e63);_0x3031b7[_0x767f('0x7c')](_0x767f('0x7d'));var _0x2e8afe={'type':db['Sequelize'][_0x767f('0x7e')][_0x767f('0x7f')],'raw':!![]};var _0x120d38=_0x3031b7[_0x767f('0x80')]()['field'](_0x767f('0x7d'));if(_0x12d52e[_0x767f('0x42')]){_0x12d52e[_0x767f('0x42')][_0x767f('0x59')](function(_0x5559b0){_0x3031b7[_0x767f('0x42')]('c.'+_0x5559b0[0x0],_0x5559b0[0x1]===_0x767f('0x81')?![]:!![]);});}if(!_[_0x767f('0x69')](_0x399173)){_0x3031b7['having'](_0xc2f11f);_0x120d38[_0x767f('0x50')](_0x767f('0x82'),_0x399173);}BPromise[_0x767f('0x83')]()[_0x767f('0x27')](function(){if(!_0x4a8087)return;if(_0x4bcc0c[_0x767f('0x84')][_0x767f('0x85')]!==_0x767f('0x86'))return;if(!_[_0x767f('0x87')](_0x4a8087[_0x767f('0x56')],[_0x767f('0x46'),'User'])){return _0x4bcc0c[_0x767f('0x84')][_0x767f('0x88')]({'attributes':['id'],'raw':!![]})[_0x767f('0x27')](function(_0x1acaef){if(_['isEmpty'](_0x1acaef)){_0x120d38[_0x767f('0x50')](_0x767f('0x89'));_0x3031b7['where'](_0x767f('0x89'));}else{_0x120d38[_0x767f('0x50')](_0x767f('0x6b'),_[_0x767f('0x58')](_0x1acaef,'id'));_0x3031b7[_0x767f('0x50')](_0x767f('0x6b'),_[_0x767f('0x58')](_0x1acaef,'id'));}});}})[_0x767f('0x27')](function(){if(_0x4bcc0c[_0x767f('0x84')]['role']===_0x767f('0x86')&&!_0x4a8087&&!_0x4bcc0c[_0x767f('0x3a')]['ListId'])return[];return db[_0x767f('0x8a')][_0x767f('0x3a')](_0x120d38[_0x767f('0x8b')](),_0x2e8afe);})[_0x767f('0x27')](function(_0x25fbf1){_0x13fbb8['count']=_0x25fbf1[_0x767f('0x30')];if(_0x13fbb8[_0x767f('0x8c')]===0x0)return[];return db['sequelize']['query'](_0x45efb2[_0x767f('0x8b')](),_0x2e8afe)[_0x767f('0x27')](function(_0x2bd397){_0x122b7f=_[_0x767f('0x8d')](_0x2bd397,'id');_0x2e8afe=_[_0x767f('0x8e')](_0x2e8afe,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4bcc0c['query'][_0x767f('0x3e')]){_0x12d52e['attributes'][_0x767f('0x59')](function(_0x1a51cb){_0x3031b7[_0x767f('0x46')]('c.'+_0x1a51cb);});}else{_0x3031b7['field']('c.id');_0x3031b7['field'](_0x767f('0x8f'));_0x3031b7[_0x767f('0x46')]('c.lastName');_0x3031b7[_0x767f('0x46')]('c.phone');_0x3031b7['field'](_0x767f('0x90'));_0x3031b7['field']('c.fax');_0x3031b7['field']('c.email');_0x3031b7[_0x767f('0x46')](_0x767f('0x91'));_0x3031b7[_0x767f('0x46')](_0x767f('0x92'));_0x3031b7['field'](_0x767f('0x93'));_0x3031b7[_0x767f('0x46')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x767f('0x94'));}if(_0x12d52e[_0x767f('0x41')])_0x3031b7[_0x767f('0x41')](_0x12d52e[_0x767f('0x41')]);if(_0x12d52e[_0x767f('0x21')])_0x3031b7[_0x767f('0x21')](_0x12d52e[_0x767f('0x21')]);return db['sequelize']['query'](_0x3031b7[_0x767f('0x8b')](),_0x2e8afe);});})['then'](function(_0x8742b8){_0x8742b8[_0x767f('0x59')](function(_0x2f7f00){if(_0x2f7f00[_0x767f('0x94')]){_0x2f7f00['Tags']=[];_0x2f7f00[_0x767f('0x94')][_0x767f('0x71')](',')[_0x767f('0x59')](function(_0x185578){_0x2f7f00[_0x767f('0x95')][_0x767f('0x68')](_0x122b7f[_0x185578]);});}delete _0x2f7f00[_0x767f('0x94')];});_0x13fbb8['rows']=_0x8742b8;return _0x13fbb8;})[_0x767f('0x27')](respondWithFilteredResult(_0x434d47,_0x12d52e));})[_0x767f('0x96')](handleError(_0x434d47,null));};exports[_0x767f('0x97')]=function(_0x2b8f4f,_0x5c2f9b){return db[_0x767f('0x2d')]['find']({'where':{'id':_0x2b8f4f[_0x767f('0x98')]['id']}})[_0x767f('0x27')](handleEntityNotFound(_0x5c2f9b,null))[_0x767f('0x27')](removeEntity(_0x5c2f9b,null))['catch'](handleError(_0x5c2f9b,null));};exports[_0x767f('0x2e')]=function(_0x49d737,_0x13d447){return db[_0x767f('0x2d')]['describe']()[_0x767f('0x27')](function(_0x5987ed){delete _0x5987ed['tags'];for(var _0x244f7b=0x0;_0x244f7b{}\s\\|]/g,'-');_0xf6cc70(null,util[_0x75d1('0x1e')](_0x75d1('0x1f'),path['basename'](_0x579731[_0x75d1('0x1d')],path[_0x75d1('0x20')](_0x579731['originalname'])),Date[_0x75d1('0x21')](),path['extname'](_0x579731[_0x75d1('0x1d')])));}})});router[_0x75d1('0x16')](_0x75d1('0x22'),upload['single']('file'),controller[_0x75d1('0x23')]);var upload=multer({'storage':multer[_0x75d1('0x1a')]({'destination':function(_0x315ce5,_0x18184b,_0x51d043){_0x51d043(null,path[_0x75d1('0x1b')](config[_0x75d1('0x24')],_0x75d1('0x1c')));},'filename':function(_0x51138e,_0x54095d,_0x57efd6){_0x54095d[_0x75d1('0x1d')]=_0x54095d[_0x75d1('0x1d')][_0x75d1('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x57efd6(null,util[_0x75d1('0x1e')](_0x75d1('0x1f'),path['basename'](_0x54095d['originalname'],path[_0x75d1('0x20')](_0x54095d[_0x75d1('0x1d')])),Date['now'](),path[_0x75d1('0x20')](_0x54095d['originalname'])));}})});router[_0x75d1('0x16')](_0x75d1('0x26'),upload[_0x75d1('0x27')](_0x75d1('0x28')),controller[_0x75d1('0x29')]);router['post'](_0x75d1('0x2a'),auth[_0x75d1('0x8')](),controller[_0x75d1('0x2b')]);router[_0x75d1('0x2c')]('/:id',auth[_0x75d1('0x8')](),controller['update']);router[_0x75d1('0x2d')](_0x75d1('0xb'),auth['isAuthenticated'](),controller[_0x75d1('0x2e')]);module[_0x75d1('0x2f')]=router; \ No newline at end of file +var _0x6f47=['join','root','server/files/tmp','originalname','replace','format','%s-%s%s','now','extname','/csv','single','file','upload','/upload/:id','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','/describe','/:id','show','getTags','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','merge','post','create','/create_many','bulkCreate','/:id/tags','setTags','diskStorage'];(function(_0x696651,_0x5414ad){var _0x555094=function(_0x4a2f47){while(--_0x4a2f47){_0x696651['push'](_0x696651['shift']());}};_0x555094(++_0x5414ad);}(_0x6f47,0xc7));var _0x76f4=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x6f47[_0x2ec461];return _0x28603d;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var auth=require(_0x76f4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76f4('0x4'));var controller=require(_0x76f4('0x5'));router[_0x76f4('0x6')]('/',auth[_0x76f4('0x7')](),controller['index']);router[_0x76f4('0x6')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller['describe']);router[_0x76f4('0x6')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xa')]);router[_0x76f4('0x6')]('/:id/tags',auth['isAuthenticated'](),controller[_0x76f4('0xb')]);router[_0x76f4('0x6')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x76f4('0xc')]);router[_0x76f4('0x6')](_0x76f4('0xd'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xe')]);router[_0x76f4('0x6')](_0x76f4('0xf'),auth[_0x76f4('0x7')](),controller[_0x76f4('0x10')]);router['get'](_0x76f4('0x11'),auth[_0x76f4('0x7')](),controller['getJscriptySessions']);router['post']('/merge',auth[_0x76f4('0x7')](),controller[_0x76f4('0x12')]);router[_0x76f4('0x13')]('/',auth[_0x76f4('0x7')](),controller[_0x76f4('0x14')]);router[_0x76f4('0x13')](_0x76f4('0x15'),auth[_0x76f4('0x7')](),controller[_0x76f4('0x16')]);router[_0x76f4('0x13')](_0x76f4('0x17'),auth[_0x76f4('0x7')](),controller[_0x76f4('0x18')]);var upload=multer({'storage':multer[_0x76f4('0x19')]({'destination':function(_0x17625e,_0x397360,_0xfedbe4){_0xfedbe4(null,path[_0x76f4('0x1a')](config[_0x76f4('0x1b')],_0x76f4('0x1c')));},'filename':function(_0x46f057,_0x285232,_0x5bf3d5){_0x285232[_0x76f4('0x1d')]=_0x285232['originalname'][_0x76f4('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5bf3d5(null,util[_0x76f4('0x1f')](_0x76f4('0x20'),path['basename'](_0x285232['originalname'],path['extname'](_0x285232[_0x76f4('0x1d')])),Date[_0x76f4('0x21')](),path[_0x76f4('0x22')](_0x285232[_0x76f4('0x1d')])));}})});router[_0x76f4('0x13')](_0x76f4('0x23'),upload[_0x76f4('0x24')]('file'),controller['uploadCsv']);var upload=multer({'storage':multer[_0x76f4('0x19')]({'destination':function(_0x497913,_0x288365,_0x5355bd){_0x5355bd(null,path['join'](config['root'],_0x76f4('0x1c')));},'filename':function(_0x38300d,_0xd368a2,_0x1d1fe6){_0xd368a2[_0x76f4('0x1d')]=_0xd368a2[_0x76f4('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d1fe6(null,util[_0x76f4('0x1f')]('%s-%s%s',path['basename'](_0xd368a2['originalname'],path[_0x76f4('0x22')](_0xd368a2[_0x76f4('0x1d')])),Date[_0x76f4('0x21')](),path[_0x76f4('0x22')](_0xd368a2['originalname'])));}})});router[_0x76f4('0x13')]('/upload',upload[_0x76f4('0x24')](_0x76f4('0x25')),controller[_0x76f4('0x26')]);router[_0x76f4('0x13')](_0x76f4('0x27'),auth['isAuthenticated'](),controller['import']);router[_0x76f4('0x28')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0x29')]);router[_0x76f4('0x2a')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0x2b')]);module[_0x76f4('0x2c')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 43df06c..097328e 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 _0xac31=['stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','select','values','isArray'];(function(_0x31f820,_0x4bf95e){var _0x93c5f2=function(_0x517871){while(--_0x517871){_0x31f820['push'](_0x31f820['shift']());}};_0x93c5f2(++_0x4bf95e);}(_0xac31,0xca));var _0x1ac3=function(_0x50563e,_0x5c616d){_0x50563e=_0x50563e-0x0;var _0x37b3a5=_0xac31[_0x50563e];return _0x37b3a5;};'use strict';var Sequelize=require(_0x1ac3('0x0'));var _=require(_0x1ac3('0x1'));module[_0x1ac3('0x2')]={'name':{'type':Sequelize[_0x1ac3('0x3')],'get':function(_0xd6934){return this[_0x1ac3('0x4')](_0x1ac3('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x33b5ab){this[_0x1ac3('0x6')]('alias',_0x33b5ab?_0x33b5ab:this['getDataValue'](_0x1ac3('0x7')));}},'type':{'type':Sequelize[_0x1ac3('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x1ac3('0x9')](_0x1ac3('0xa')),'get':function(){if(this[_0x1ac3('0x4')]('type')===_0x1ac3('0xb')){return JSON['parse'](this[_0x1ac3('0x4')](_0x1ac3('0xc')));}else{return this[_0x1ac3('0x4')]('values');}},'set':function(_0xa26c88){if(Array[_0x1ac3('0xd')](_0xa26c88)){this[_0x1ac3('0x6')](_0x1ac3('0xc'),JSON[_0x1ac3('0xe')](_0xa26c88));}else{this[_0x1ac3('0x6')]('values',_0xa26c88);}}},'required':{'type':Sequelize[_0x1ac3('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1ac3('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1ac3('0x10')](_0x1ac3('0x11'))}}; \ No newline at end of file +var _0xc73e=['TEXT','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','setDataValue','getDataValue','name','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc73e,0x1e9));var _0xec73=function(_0x2fbd18,_0x51a739){_0x2fbd18=_0x2fbd18-0x0;var _0x2fc8f8=_0xc73e[_0x2fbd18];return _0x2fc8f8;};'use strict';var Sequelize=require(_0xec73('0x0'));var _=require(_0xec73('0x1'));module['exports']={'name':{'type':Sequelize[_0xec73('0x2')],'get':function(_0x39de1c){return this['getDataValue']('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x36ed48){this[_0xec73('0x3')]('alias',_0x36ed48?_0x36ed48:this[_0xec73('0x4')](_0xec73('0x5')));}},'type':{'type':Sequelize[_0xec73('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xec73('0x7')]('long'),'get':function(){if(this[_0xec73('0x4')]('type')===_0xec73('0x8')){return JSON[_0xec73('0x9')](this[_0xec73('0x4')](_0xec73('0xa')));}else{return this['getDataValue']('values');}},'set':function(_0x554973){if(Array[_0xec73('0xb')](_0x554973)){this['setDataValue']('values',JSON[_0xec73('0xc')](_0x554973));}else{this[_0xec73('0x3')](_0xec73('0xa'),_0x554973);}}},'required':{'type':Sequelize[_0xec73('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xec73('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xec73('0xe')](_0xec73('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 2feb58f..9c93267 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 _0x312f=['where','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','find','create','sequelize','transaction','body','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','limit','set','reject','save','update','destroy','then','status','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','sort'];(function(_0x5c7ba6,_0x544cb1){var _0x1eab97=function(_0x2595b0){while(--_0x2595b0){_0x5c7ba6['push'](_0x5c7ba6['shift']());}};_0x1eab97(++_0x544cb1);}(_0x312f,0xbf));var _0xf312=function(_0x3e7ae4,_0x91f9c5){_0x3e7ae4=_0x3e7ae4-0x0;var _0x3ddbbc=_0x312f[_0x3e7ae4];return _0x3ddbbc;};'use strict';var pdf=require(_0xf312('0x0'));var emlformat=require(_0xf312('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf312('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf312('0x3'));var moment=require(_0xf312('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf312('0x5'));var util=require('util');var path=require(_0xf312('0x6'));var sox=require('sox');var csv=require(_0xf312('0x7'));var ejs=require(_0xf312('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf312('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf312('0x7'));var querystring=require(_0xf312('0xa'));var Papa=require(_0xf312('0xb'));var Redis=require(_0xf312('0xc'));var authService=require(_0xf312('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf312('0xe'));var hardwareService=require(_0xf312('0xf'));var logger=require(_0xf312('0x10'))(_0xf312('0x11'));var utils=require(_0xf312('0x12'));var config=require(_0xf312('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf312('0x14'))['db'];function respondWithStatusCode(_0x4e14ad,_0x49793a){_0x49793a=_0x49793a||0xcc;return function(_0x59625b){if(_0x59625b){return _0x4e14ad[_0xf312('0x15')](_0x49793a);}return _0x4e14ad['status'](_0x49793a)[_0xf312('0x16')]();};}function respondWithResult(_0x55ab94,_0x12156f){_0x12156f=_0x12156f||0xc8;return function(_0x11810e){if(_0x11810e){return _0x55ab94['status'](_0x12156f)[_0xf312('0x17')](_0x11810e);}};}function respondWithFilteredResult(_0x5b460e,_0x25a3cc){return function(_0x288661){if(_0x288661){var _0x4b45ee=_0x288661['count'],_0xb14543=_0x25a3cc['offset'],_0x2f3708=_0x25a3cc['offset']+_0x25a3cc[_0xf312('0x18')],_0x43e5eb;if(_0x2f3708>=_0x4b45ee){_0x2f3708=_0x4b45ee;_0x43e5eb=0xc8;}else{_0x43e5eb=0xce;}_0x5b460e['status'](_0x43e5eb);return _0x5b460e[_0xf312('0x19')]('Content-Range',_0xb14543+'-'+_0x2f3708+'/'+_0x4b45ee)[_0xf312('0x17')](_0x288661);}return null;};}function patchUpdates(_0x1166f7){return function(_0x519649){try{jsonpatch['apply'](_0x519649,_0x1166f7,!![]);}catch(_0x111495){return BPromise[_0xf312('0x1a')](_0x111495);}return _0x519649[_0xf312('0x1b')]();};}function saveUpdates(_0x42c68a,_0x502543){return function(_0x2a5e3d){if(_0x2a5e3d){return _0x2a5e3d[_0xf312('0x1c')](_0x42c68a)['then'](function(_0x226649){return _0x226649;});}return null;};}function removeEntity(_0xee436e,_0x561294){return function(_0x1b9581){if(_0x1b9581){return _0x1b9581[_0xf312('0x1d')]()[_0xf312('0x1e')](function(){_0xee436e[_0xf312('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5542b4,_0x51a2e5){return function(_0x551b6e){if(!_0x551b6e){_0x5542b4['sendStatus'](0x194);}return _0x551b6e;};}function handleError(_0x24c54c,_0x55a38b){_0x55a38b=_0x55a38b||0x1f4;return function(_0x573b4d){logger[_0xf312('0x20')](_0x573b4d[_0xf312('0x21')]);if(_0x573b4d[_0xf312('0x22')]){delete _0x573b4d[_0xf312('0x22')];}_0x24c54c['status'](_0x55a38b)[_0xf312('0x23')](_0x573b4d);};}exports[_0xf312('0x24')]=function(_0xd07ba6,_0x5a805c){var _0x2bb678={},_0x40a5a3={},_0x5dd787={'count':0x0,'rows':[]};var _0x34ca35=_[_0xf312('0x25')](db[_0xf312('0x26')][_0xf312('0x27')],function(_0x20f75c){return{'name':_0x20f75c[_0xf312('0x28')],'type':_0x20f75c[_0xf312('0x29')]['key']};});_0x40a5a3['model']=_['differenceBy'](_[_0xf312('0x25')](_0x34ca35,_0xf312('0x22')),[_0xf312('0x22')]);_0x40a5a3[_0xf312('0x2a')]=_['keys'](_0xd07ba6[_0xf312('0x2a')]);_0x40a5a3['filters']=_[_0xf312('0x2b')](_0x40a5a3['model'],_0x40a5a3[_0xf312('0x2a')]);_0x2bb678[_0xf312('0x2c')]=_[_0xf312('0x2b')](_0x40a5a3[_0xf312('0x2d')],qs[_0xf312('0x2e')](_0xd07ba6[_0xf312('0x2a')][_0xf312('0x2e')]));_0x2bb678[_0xf312('0x2c')]=_0x2bb678[_0xf312('0x2c')][_0xf312('0x2f')]?_0x2bb678[_0xf312('0x2c')]:_0x40a5a3[_0xf312('0x2d')];if(!_0xd07ba6[_0xf312('0x2a')][_0xf312('0x30')](_0xf312('0x31'))){_0x2bb678[_0xf312('0x18')]=qs[_0xf312('0x18')](_0xd07ba6[_0xf312('0x2a')][_0xf312('0x18')]);_0x2bb678[_0xf312('0x32')]=qs[_0xf312('0x32')](_0xd07ba6[_0xf312('0x2a')][_0xf312('0x32')]);}_0x2bb678['order']=qs[_0xf312('0x33')](_0xd07ba6[_0xf312('0x2a')][_0xf312('0x33')]);_0x2bb678[_0xf312('0x34')]=qs['filters'](_['pick'](_0xd07ba6[_0xf312('0x2a')],_0x40a5a3[_0xf312('0x35')]),_0x34ca35);if(_0xd07ba6[_0xf312('0x2a')][_0xf312('0x36')]){_0x2bb678[_0xf312('0x34')]=_[_0xf312('0x37')](_0x2bb678['where'],{'$or':_[_0xf312('0x25')](_0x34ca35,function(_0x5ef78d){if(_0x5ef78d['type']!==_0xf312('0x38')){var _0x171a06={};_0x171a06[_0x5ef78d[_0xf312('0x22')]]={'$like':'%'+_0xd07ba6[_0xf312('0x2a')][_0xf312('0x36')]+'%'};return _0x171a06;}})});}_0x2bb678=_[_0xf312('0x37')]({},_0x2bb678,_0xd07ba6[_0xf312('0x39')]);var _0x26addb={'where':_0x2bb678[_0xf312('0x34')]};return db[_0xf312('0x26')]['count'](_0x26addb)[_0xf312('0x1e')](function(_0x4fffd2){_0x5dd787['count']=_0x4fffd2;if(_0xd07ba6[_0xf312('0x2a')][_0xf312('0x3a')]){_0x2bb678[_0xf312('0x3b')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x2bb678);})[_0xf312('0x1e')](function(_0x4a4a78){_0x5dd787['rows']=_0x4a4a78;return _0x5dd787;})[_0xf312('0x1e')](respondWithFilteredResult(_0x5a805c,_0x2bb678))[_0xf312('0x3c')](handleError(_0x5a805c,null));};exports[_0xf312('0x3d')]=function(_0x51929d,_0x31f3c2){var _0x1e0036={'raw':!![],'where':{'id':_0x51929d[_0xf312('0x3e')]['id']}},_0x16ff07={};_0x16ff07[_0xf312('0x2d')]=_[_0xf312('0x3f')](db[_0xf312('0x26')]['rawAttributes']);_0x16ff07[_0xf312('0x2a')]=_[_0xf312('0x3f')](_0x51929d[_0xf312('0x2a')]);_0x16ff07[_0xf312('0x35')]=_[_0xf312('0x2b')](_0x16ff07[_0xf312('0x2d')],_0x16ff07['query']);_0x1e0036[_0xf312('0x2c')]=_[_0xf312('0x2b')](_0x16ff07[_0xf312('0x2d')],qs['fields'](_0x51929d[_0xf312('0x2a')]['fields']));_0x1e0036['attributes']=_0x1e0036[_0xf312('0x2c')][_0xf312('0x2f')]?_0x1e0036[_0xf312('0x2c')]:_0x16ff07[_0xf312('0x2d')];if(_0x51929d[_0xf312('0x2a')][_0xf312('0x3a')]){_0x1e0036[_0xf312('0x3b')]=[{'all':!![]}];}_0x1e0036=_[_0xf312('0x37')]({},_0x1e0036,_0x51929d[_0xf312('0x39')]);return db['CmCustomField'][_0xf312('0x40')](_0x1e0036)[_0xf312('0x1e')](handleEntityNotFound(_0x31f3c2,null))['then'](respondWithResult(_0x31f3c2,null))[_0xf312('0x3c')](handleError(_0x31f3c2,null));};exports[_0xf312('0x1c')]=function(_0x85a507,_0x21fb1d){if(_0x85a507['body']['id']){delete _0x85a507['body']['id'];}return db[_0xf312('0x26')][_0xf312('0x40')]({'where':{'id':_0x85a507['params']['id']}})[_0xf312('0x1e')](handleEntityNotFound(_0x21fb1d,null))[_0xf312('0x1e')](saveUpdates(_0x85a507['body'],null))[_0xf312('0x1e')](respondWithResult(_0x21fb1d,null))[_0xf312('0x3c')](handleError(_0x21fb1d,null));};exports[_0xf312('0x1d')]=function(_0x5f021f,_0x35ca62){return db[_0xf312('0x26')][_0xf312('0x40')]({'where':{'id':_0x5f021f['params']['id']}})['then'](handleEntityNotFound(_0x35ca62,null))[_0xf312('0x1e')](removeEntity(_0x35ca62,null))[_0xf312('0x3c')](handleError(_0x35ca62,null));};exports[_0xf312('0x41')]=function(_0x38e3a8,_0x976bc1){var _0x17b25a;return db[_0xf312('0x42')][_0xf312('0x43')](function(_0x346a20){return db[_0xf312('0x26')][_0xf312('0x41')](_0x38e3a8[_0xf312('0x44')],{'transaction':_0x346a20})[_0xf312('0x1e')](function(_0x270559){_0x17b25a=_0x270559;var _0x55e290={'type':db[_0xf312('0x45')][_0xf312('0x46')],'transaction':_0x346a20};switch(_0x38e3a8[_0xf312('0x44')][_0xf312('0x29')]){case _0xf312('0x47'):_0x55e290[_0xf312('0x29')]=db[_0xf312('0x45')][_0xf312('0x46')];break;case _0xf312('0x48'):_0x55e290[_0xf312('0x29')]=db[_0xf312('0x45')][_0xf312('0x49')];break;case _0xf312('0x4a'):_0x55e290[_0xf312('0x29')]=db[_0xf312('0x45')]['BOOLEAN'];_0x55e290[_0xf312('0x4b')]=![];break;default:}return db[_0xf312('0x42')][_0xf312('0x4c')][_0xf312('0x4d')](_0xf312('0x4e'),util[_0xf312('0x4f')](_0xf312('0x50'),_0x17b25a['id']),_0x55e290);})['then'](function(){return _0x17b25a;});})[_0xf312('0x1e')](respondWithResult(_0x976bc1,0xc9))[_0xf312('0x3c')](handleError(_0x976bc1,null));}; \ No newline at end of file +var _0xa990=['sort','where','filters','pick','filter','merge','options','count','includeAll','include','CmCustomField','show','params','intersection','find','catch','body','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','json','apply','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3b40b4,_0x514d14){var _0x31f139=function(_0x30d0ed){while(--_0x30d0ed){_0x3b40b4['push'](_0x3b40b4['shift']());}};_0x31f139(++_0x514d14);}(_0xa990,0xc9));var _0x0a99=function(_0x267f45,_0x3ff7c4){_0x267f45=_0x267f45-0x0;var _0x3b1361=_0xa990[_0x267f45];return _0x3b1361;};'use strict';var pdf=require(_0x0a99('0x0'));var emlformat=require(_0x0a99('0x1'));var rimraf=require(_0x0a99('0x2'));var zipdir=require(_0x0a99('0x3'));var jsonpatch=require(_0x0a99('0x4'));var rp=require(_0x0a99('0x5'));var moment=require(_0x0a99('0x6'));var BPromise=require(_0x0a99('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0a99('0x8'));var sox=require(_0x0a99('0x9'));var csv=require(_0x0a99('0xa'));var ejs=require(_0x0a99('0xb'));var fs=require('fs');var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0xa'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x19'))['db'];function respondWithStatusCode(_0x3aaaad,_0x57ab88){_0x57ab88=_0x57ab88||0xcc;return function(_0xb6a34d){if(_0xb6a34d){return _0x3aaaad[_0x0a99('0x1a')](_0x57ab88);}return _0x3aaaad[_0x0a99('0x1b')](_0x57ab88)[_0x0a99('0x1c')]();};}function respondWithResult(_0x346061,_0x23d018){_0x23d018=_0x23d018||0xc8;return function(_0x18c124){if(_0x18c124){return _0x346061[_0x0a99('0x1b')](_0x23d018)['json'](_0x18c124);}};}function respondWithFilteredResult(_0x5a17e1,_0x2c40db){return function(_0x3ac17e){if(_0x3ac17e){var _0xb7356c=_0x3ac17e['count'],_0x49653c=_0x2c40db[_0x0a99('0x1d')],_0x3483a7=_0x2c40db[_0x0a99('0x1d')]+_0x2c40db[_0x0a99('0x1e')],_0x5c91f9;if(_0x3483a7>=_0xb7356c){_0x3483a7=_0xb7356c;_0x5c91f9=0xc8;}else{_0x5c91f9=0xce;}_0x5a17e1[_0x0a99('0x1b')](_0x5c91f9);return _0x5a17e1['set']('Content-Range',_0x49653c+'-'+_0x3483a7+'/'+_0xb7356c)[_0x0a99('0x1f')](_0x3ac17e);}return null;};}function patchUpdates(_0x13df0b){return function(_0xbe23f3){try{jsonpatch[_0x0a99('0x20')](_0xbe23f3,_0x13df0b,!![]);}catch(_0x5e6c7e){return BPromise['reject'](_0x5e6c7e);}return _0xbe23f3[_0x0a99('0x21')]();};}function saveUpdates(_0x4d0c78,_0x1e8d30){return function(_0x549d24){if(_0x549d24){return _0x549d24[_0x0a99('0x22')](_0x4d0c78)['then'](function(_0x1b8324){return _0x1b8324;});}return null;};}function removeEntity(_0x356681,_0x3b1d60){return function(_0x1c1e5c){if(_0x1c1e5c){return _0x1c1e5c[_0x0a99('0x23')]()[_0x0a99('0x24')](function(){_0x356681[_0x0a99('0x1b')](0xcc)[_0x0a99('0x1c')]();});}};}function handleEntityNotFound(_0x398dd2,_0x5745ca){return function(_0x5258b9){if(!_0x5258b9){_0x398dd2[_0x0a99('0x1a')](0x194);}return _0x5258b9;};}function handleError(_0xcd088,_0x5cbf1f){_0x5cbf1f=_0x5cbf1f||0x1f4;return function(_0x518617){logger['error'](_0x518617[_0x0a99('0x25')]);if(_0x518617[_0x0a99('0x26')]){delete _0x518617[_0x0a99('0x26')];}_0xcd088[_0x0a99('0x1b')](_0x5cbf1f)[_0x0a99('0x27')](_0x518617);};}exports[_0x0a99('0x28')]=function(_0x25b4c0,_0x2f104a){var _0x163031={},_0x5722f9={},_0x411233={'count':0x0,'rows':[]};var _0x4f032a=_['map'](db['CmCustomField'][_0x0a99('0x29')],function(_0x379c7e){return{'name':_0x379c7e[_0x0a99('0x2a')],'type':_0x379c7e[_0x0a99('0x2b')][_0x0a99('0x2c')]};});_0x5722f9[_0x0a99('0x2d')]=_[_0x0a99('0x2e')](_['map'](_0x4f032a,_0x0a99('0x26')),[_0x0a99('0x26')]);_0x5722f9[_0x0a99('0x2f')]=_[_0x0a99('0x30')](_0x25b4c0['query']);_0x5722f9['filters']=_['intersection'](_0x5722f9[_0x0a99('0x2d')],_0x5722f9[_0x0a99('0x2f')]);_0x163031[_0x0a99('0x31')]=_['intersection'](_0x5722f9[_0x0a99('0x2d')],qs[_0x0a99('0x32')](_0x25b4c0[_0x0a99('0x2f')][_0x0a99('0x32')]));_0x163031[_0x0a99('0x31')]=_0x163031[_0x0a99('0x31')][_0x0a99('0x33')]?_0x163031['attributes']:_0x5722f9[_0x0a99('0x2d')];if(!_0x25b4c0[_0x0a99('0x2f')][_0x0a99('0x34')](_0x0a99('0x35'))){_0x163031[_0x0a99('0x1e')]=qs['limit'](_0x25b4c0[_0x0a99('0x2f')]['limit']);_0x163031['offset']=qs['offset'](_0x25b4c0['query'][_0x0a99('0x1d')]);}_0x163031['order']=qs[_0x0a99('0x36')](_0x25b4c0[_0x0a99('0x2f')][_0x0a99('0x36')]);_0x163031[_0x0a99('0x37')]=qs[_0x0a99('0x38')](_[_0x0a99('0x39')](_0x25b4c0[_0x0a99('0x2f')],_0x5722f9[_0x0a99('0x38')]),_0x4f032a);if(_0x25b4c0[_0x0a99('0x2f')][_0x0a99('0x3a')]){_0x163031[_0x0a99('0x37')]=_[_0x0a99('0x3b')](_0x163031[_0x0a99('0x37')],{'$or':_['map'](_0x4f032a,function(_0x34f122){if(_0x34f122[_0x0a99('0x2b')]!=='VIRTUAL'){var _0x3f0a9={};_0x3f0a9[_0x34f122['name']]={'$like':'%'+_0x25b4c0[_0x0a99('0x2f')]['filter']+'%'};return _0x3f0a9;}})});}_0x163031=_[_0x0a99('0x3b')]({},_0x163031,_0x25b4c0[_0x0a99('0x3c')]);var _0x27af76={'where':_0x163031[_0x0a99('0x37')]};return db['CmCustomField'][_0x0a99('0x3d')](_0x27af76)[_0x0a99('0x24')](function(_0x3b7efc){_0x411233['count']=_0x3b7efc;if(_0x25b4c0[_0x0a99('0x2f')][_0x0a99('0x3e')]){_0x163031[_0x0a99('0x3f')]=[{'all':!![]}];}return db[_0x0a99('0x40')]['findAll'](_0x163031);})[_0x0a99('0x24')](function(_0x5bb032){_0x411233['rows']=_0x5bb032;return _0x411233;})[_0x0a99('0x24')](respondWithFilteredResult(_0x2f104a,_0x163031))['catch'](handleError(_0x2f104a,null));};exports[_0x0a99('0x41')]=function(_0x583dca,_0x39dd72){var _0x2cfd3d={'raw':!![],'where':{'id':_0x583dca[_0x0a99('0x42')]['id']}},_0x129e71={};_0x129e71['model']=_[_0x0a99('0x30')](db[_0x0a99('0x40')][_0x0a99('0x29')]);_0x129e71[_0x0a99('0x2f')]=_['keys'](_0x583dca['query']);_0x129e71['filters']=_[_0x0a99('0x43')](_0x129e71['model'],_0x129e71[_0x0a99('0x2f')]);_0x2cfd3d['attributes']=_['intersection'](_0x129e71['model'],qs['fields'](_0x583dca[_0x0a99('0x2f')]['fields']));_0x2cfd3d[_0x0a99('0x31')]=_0x2cfd3d[_0x0a99('0x31')]['length']?_0x2cfd3d[_0x0a99('0x31')]:_0x129e71[_0x0a99('0x2d')];if(_0x583dca['query'][_0x0a99('0x3e')]){_0x2cfd3d['include']=[{'all':!![]}];}_0x2cfd3d=_[_0x0a99('0x3b')]({},_0x2cfd3d,_0x583dca[_0x0a99('0x3c')]);return db['CmCustomField'][_0x0a99('0x44')](_0x2cfd3d)['then'](handleEntityNotFound(_0x39dd72,null))['then'](respondWithResult(_0x39dd72,null))[_0x0a99('0x45')](handleError(_0x39dd72,null));};exports[_0x0a99('0x22')]=function(_0xf91e54,_0x169990){if(_0xf91e54[_0x0a99('0x46')]['id']){delete _0xf91e54['body']['id'];}return db[_0x0a99('0x40')][_0x0a99('0x44')]({'where':{'id':_0xf91e54[_0x0a99('0x42')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x169990,null))[_0x0a99('0x24')](saveUpdates(_0xf91e54[_0x0a99('0x46')],null))[_0x0a99('0x24')](respondWithResult(_0x169990,null))[_0x0a99('0x45')](handleError(_0x169990,null));};exports[_0x0a99('0x23')]=function(_0x1621d9,_0x52c754){return db['CmCustomField'][_0x0a99('0x44')]({'where':{'id':_0x1621d9[_0x0a99('0x42')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x52c754,null))[_0x0a99('0x24')](removeEntity(_0x52c754,null))[_0x0a99('0x45')](handleError(_0x52c754,null));};exports[_0x0a99('0x47')]=function(_0x5cda7d,_0x3d989b){var _0x31829a;return db['sequelize'][_0x0a99('0x48')](function(_0x474e8b){return db['CmCustomField'][_0x0a99('0x47')](_0x5cda7d[_0x0a99('0x46')],{'transaction':_0x474e8b})[_0x0a99('0x24')](function(_0x2befdc){_0x31829a=_0x2befdc;var _0x408dc3={'type':db[_0x0a99('0x49')][_0x0a99('0x4a')],'transaction':_0x474e8b};switch(_0x5cda7d['body'][_0x0a99('0x2b')]){case _0x0a99('0x4b'):_0x408dc3[_0x0a99('0x2b')]=db['Sequelize'][_0x0a99('0x4a')];break;case _0x0a99('0x4c'):_0x408dc3[_0x0a99('0x2b')]=db['Sequelize'][_0x0a99('0x4d')];break;case _0x0a99('0x4e'):_0x408dc3[_0x0a99('0x2b')]=db[_0x0a99('0x49')][_0x0a99('0x4f')];_0x408dc3[_0x0a99('0x50')]=![];break;default:}return db['sequelize'][_0x0a99('0x51')]['addColumn'](_0x0a99('0x52'),util[_0x0a99('0x53')](_0x0a99('0x54'),_0x31829a['id']),_0x408dc3);})[_0x0a99('0x24')](function(){return _0x31829a;});})['then'](respondWithResult(_0x3d989b,0xc9))[_0x0a99('0x45')](handleError(_0x3d989b,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f075164..40ea7d1 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 _0x5686=['bluebird','request-promise','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5686,0x167));var _0x6568=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x5686[_0x46f1a6];return _0x38429a;};'use strict';var _=require('lodash');var util=require(_0x6568('0x0'));var logger=require(_0x6568('0x1'))(_0x6568('0x2'));var moment=require(_0x6568('0x3'));var BPromise=require(_0x6568('0x4'));var rp=require(_0x6568('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6568('0x6'));var attributes=require(_0x6568('0x7'));module[_0x6568('0x8')]=function(_0x22db0e,_0x54bdf3){return _0x22db0e['define'](_0x6568('0x9'),attributes,{'tableName':_0x6568('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1104=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','CmCustomField','cm_custom_fields','lodash','util','api'];(function(_0x4a6c4d,_0x455768){var _0x31800b=function(_0x203513){while(--_0x203513){_0x4a6c4d['push'](_0x4a6c4d['shift']());}};_0x31800b(++_0x455768);}(_0x1104,0x11d));var _0x4110=function(_0x560efb,_0x31016b){_0x560efb=_0x560efb-0x0;var _0x11b071=_0x1104[_0x560efb];return _0x11b071;};'use strict';var _=require(_0x4110('0x0'));var util=require(_0x4110('0x1'));var logger=require('../../config/logger')(_0x4110('0x2'));var moment=require(_0x4110('0x3'));var BPromise=require(_0x4110('0x4'));var rp=require(_0x4110('0x5'));var fs=require('fs');var path=require(_0x4110('0x6'));var rimraf=require(_0x4110('0x7'));var config=require(_0x4110('0x8'));var attributes=require(_0x4110('0x9'));module['exports']=function(_0x32f4ce,_0x15de25){return _0x32f4ce['define'](_0x4110('0xa'),attributes,{'tableName':_0x4110('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 e6873e0..b4e1413 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 _0xd3d1=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x497493,_0x2c429d){var _0x33b5ca=function(_0xc323cc){while(--_0xc323cc){_0x497493['push'](_0x497493['shift']());}};_0x33b5ca(++_0x2c429d);}(_0xd3d1,0x172));var _0x1d3d=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xd3d1[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1d3d('0x2'));var fs=require('fs');var Redis=require(_0x1d3d('0x3'));var db=require(_0x1d3d('0x4'))['db'];var utils=require(_0x1d3d('0x5'));var logger=require(_0x1d3d('0x6'))(_0x1d3d('0x7'));var config=require(_0x1d3d('0x8'));var jayson=require(_0x1d3d('0x9'));var client=jayson[_0x1d3d('0xa')][_0x1d3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3831ce,_0xb1b3c6,_0xe10bca){return new BPromise(function(_0x2c377c,_0xbea61e){return client[_0x1d3d('0xc')](_0x3831ce,_0xe10bca)[_0x1d3d('0xd')](function(_0x510a37){logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));logger[_0x1d3d('0x11')](_0x1d3d('0x12'),_0xb1b3c6,_0x1d3d('0x10'),JSON[_0x1d3d('0x13')](_0x510a37));if(_0x510a37[_0x1d3d('0x14')]){if(_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x15')]===0x1f4){logger[_0x1d3d('0x14')]('CmCustomField,\x20%s,\x20%s',_0xb1b3c6,_0x510a37[_0x1d3d('0x14')][_0x1d3d('0x16')]);return _0xbea61e(_0x510a37['error']['message']);}logger[_0x1d3d('0x14')](_0x1d3d('0xf'),_0xb1b3c6,_0x510a37[_0x1d3d('0x14')]['message']);return _0x2c377c(_0x510a37[_0x1d3d('0x14')]['message']);}else{logger[_0x1d3d('0xe')](_0x1d3d('0xf'),_0xb1b3c6,_0x1d3d('0x10'));_0x2c377c(_0x510a37[_0x1d3d('0x17')][_0x1d3d('0x16')]);}})[_0x1d3d('0x18')](function(_0x3dcb67){logger['error']('CmCustomField,\x20%s,\x20%s',_0xb1b3c6,_0x3dcb67);_0xbea61e(_0x3dcb67);});});} \ No newline at end of file +var _0xca66=['http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0x3436bf,_0x20abb5){var _0x3ee214=function(_0x4ae069){while(--_0x4ae069){_0x3436bf['push'](_0x3436bf['shift']());}};_0x3ee214(++_0x20abb5);}(_0xca66,0x8b));var _0x6ca6=function(_0x34bde8,_0x2437ee){_0x34bde8=_0x34bde8-0x0;var _0xd2f15e=_0xca66[_0x34bde8];return _0xd2f15e;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('CmCustomField,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 511bb38..4b8964e 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 _0xd6c9=['isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./cmCustomField.controller','get'];(function(_0x2a1049,_0x4844f7){var _0x59054a=function(_0x4c42db){while(--_0x4c42db){_0x2a1049['push'](_0x2a1049['shift']());}};_0x59054a(++_0x4844f7);}(_0xd6c9,0xa2));var _0x9d6c=function(_0x40ba7c,_0x3622f5){_0x40ba7c=_0x40ba7c-0x0;var _0x59b6b6=_0xd6c9[_0x40ba7c];return _0x59b6b6;};'use strict';var multer=require(_0x9d6c('0x0'));var util=require(_0x9d6c('0x1'));var path=require('path');var timeout=require(_0x9d6c('0x2'));var express=require(_0x9d6c('0x3'));var router=express[_0x9d6c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9d6c('0x5'));var config=require('../../config/environment');var controller=require(_0x9d6c('0x6'));router[_0x9d6c('0x7')]('/',auth[_0x9d6c('0x8')](),controller[_0x9d6c('0x9')]);router[_0x9d6c('0x7')](_0x9d6c('0xa'),auth['isAuthenticated'](),controller[_0x9d6c('0xb')]);router[_0x9d6c('0xc')]('/',auth['isAuthenticated'](),controller[_0x9d6c('0xd')]);router['put']('/:id',auth[_0x9d6c('0x8')](),controller[_0x9d6c('0xe')]);router[_0x9d6c('0xf')](_0x9d6c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x9d6c('0x10')]=router; \ No newline at end of file +var _0xbcff=['../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','show','post','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x380f7c,_0x3bb141){var _0x1dac53=function(_0x2510c0){while(--_0x2510c0){_0x380f7c['push'](_0x380f7c['shift']());}};_0x1dac53(++_0x3bb141);}(_0xbcff,0x108));var _0xfbcf=function(_0x297e02,_0x9826f8){_0x297e02=_0x297e02-0x0;var _0x2bcb76=_0xbcff[_0x297e02];return _0x2bcb76;};'use strict';var multer=require(_0xfbcf('0x0'));var util=require('util');var path=require(_0xfbcf('0x1'));var timeout=require(_0xfbcf('0x2'));var express=require(_0xfbcf('0x3'));var router=express[_0xfbcf('0x4')]();var auth=require(_0xfbcf('0x5'));var interaction=require(_0xfbcf('0x6'));var config=require('../../config/environment');var controller=require(_0xfbcf('0x7'));router[_0xfbcf('0x8')]('/',auth[_0xfbcf('0x9')](),controller[_0xfbcf('0xa')]);router[_0xfbcf('0x8')]('/:id',auth[_0xfbcf('0x9')](),controller[_0xfbcf('0xb')]);router[_0xfbcf('0xc')]('/',auth[_0xfbcf('0x9')](),controller['create']);router[_0xfbcf('0xd')](_0xfbcf('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xfbcf('0xf')](_0xfbcf('0xe'),auth[_0xfbcf('0x9')](),controller[_0xfbcf('0x10')]);module[_0xfbcf('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 24e5f1d..de11e0c 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 _0xed1f=['BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x3e87ea,_0x27a7f4){var _0x4303ab=function(_0x1b9a0d){while(--_0x1b9a0d){_0x3e87ea['push'](_0x3e87ea['shift']());}};_0x4303ab(++_0x27a7f4);}(_0xed1f,0x6a));var _0xfed1=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xed1f[_0x12fc8d];return _0x3f9d04;};'use strict';var moment=require(_0xfed1('0x0'));var Sequelize=require(_0xfed1('0x1'));module[_0xfed1('0x2')]={'phone':{'type':Sequelize[_0xfed1('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xfed1('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':moment()[_0xfed1('0x6')](_0xfed1('0x7'))},'countbusyretry':{'type':Sequelize[_0xfed1('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfed1('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfed1('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xfed1('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfed1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xfed1('0x5')]},'priority':{'type':Sequelize[_0xfed1('0x8')](0x2)[_0xfed1('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xfed1('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xfed1('0x8')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfed1('0x8')],'unique':_0xfed1('0xa')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xfed1('0x8')],'unique':_0xfed1('0xa')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xfed1('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfed1('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfed1('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf873=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','sequelize','exports'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0xf873,0xb2));var _0x3f87=function(_0xbaf0d3,_0x35fa48){_0xbaf0d3=_0xbaf0d3-0x0;var _0x1a7e4f=_0xf873[_0xbaf0d3];return _0x1a7e4f;};'use strict';var moment=require('moment');var Sequelize=require(_0x3f87('0x0'));module[_0x3f87('0x1')]={'phone':{'type':Sequelize[_0x3f87('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x3f87('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x3f87('0x4')],'defaultValue':moment()[_0x3f87('0x5')](_0x3f87('0x6'))},'countbusyretry':{'type':Sequelize[_0x3f87('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3f87('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3f87('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3f87('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3f87('0x4')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x3f87('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x3f87('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x3f87('0x7')],'unique':_0x3f87('0x9')},'ListId':{'type':Sequelize[_0x3f87('0x7')],'unique':_0x3f87('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x3f87('0x7')],'unique':_0x3f87('0x9')},'CampaignId':{'type':Sequelize[_0x3f87('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x3f87('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3f87('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3f87('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3f87('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3f87('0x7')],'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 8c93784..359b50e 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 _0xb98f=['nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','rawAttributes','includeAll','options','find','create','body','update','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','calleridnum','queue','ivr','CmContact','firstName','isNil','lastName','calleridname','finally','CmHopperFinal','getPreview','outbound','dialOrderByScheduledAt','sequelize','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Company','Queue','dialActive','getOpenContacts','preview','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','crypto','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','CmHopper','query','keys','filters','intersection','concat','$or','$gt','$gte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','attributes','model','fields','length'];(function(_0x1ccf85,_0x485eac){var _0x314ded=function(_0x291871){while(--_0x291871){_0x1ccf85['push'](_0x1ccf85['shift']());}};_0x314ded(++_0x485eac);}(_0xb98f,0xce));var _0xfb98=function(_0x300119,_0x3b894c){_0x300119=_0x300119-0x0;var _0x583738=_0xb98f[_0x300119];return _0x583738;};'use strict';var pdf=require(_0xfb98('0x0'));var emlformat=require(_0xfb98('0x1'));var rimraf=require(_0xfb98('0x2'));var zipdir=require(_0xfb98('0x3'));var jsonpatch=require(_0xfb98('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfb98('0x5'));var util=require(_0xfb98('0x6'));var path=require(_0xfb98('0x7'));var sox=require(_0xfb98('0x8'));var csv=require('to-csv');var ejs=require(_0xfb98('0x9'));var fs=require('fs');var _=require(_0xfb98('0xa'));var squel=require('squel');var crypto=require(_0xfb98('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfb98('0xc'));var authService=require(_0xfb98('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb98('0xe'));var logger=require('../../config/logger')(_0xfb98('0xf'));var utils=require(_0xfb98('0x10'));var config=require(_0xfb98('0x11'));var licenseUtil=require(_0xfb98('0x12'));var db=require(_0xfb98('0x13'))['db'];function respondWithStatusCode(_0x3cc48e,_0x77a949){_0x77a949=_0x77a949||0xcc;return function(_0x1c9933){if(_0x1c9933){return _0x3cc48e[_0xfb98('0x14')](_0x77a949);}return _0x3cc48e[_0xfb98('0x15')](_0x77a949)[_0xfb98('0x16')]();};}function respondWithResult(_0x3cdeb9,_0x14c9a3){_0x14c9a3=_0x14c9a3||0xc8;return function(_0x201b04){if(_0x201b04){return _0x3cdeb9['status'](_0x14c9a3)[_0xfb98('0x17')](_0x201b04);}};}function respondWithFilteredResult(_0x515864,_0x3e7e25){return function(_0x2d4efd){if(_0x2d4efd){var _0x3c6ca5=_0x2d4efd[_0xfb98('0x18')],_0x471299=_0x3e7e25[_0xfb98('0x19')],_0x26e10f=_0x3e7e25[_0xfb98('0x19')]+_0x3e7e25[_0xfb98('0x1a')],_0x4c030a;if(_0x26e10f>=_0x3c6ca5){_0x26e10f=_0x3c6ca5;_0x4c030a=0xc8;}else{_0x4c030a=0xce;}_0x515864[_0xfb98('0x15')](_0x4c030a);return _0x515864[_0xfb98('0x1b')](_0xfb98('0x1c'),_0x471299+'-'+_0x26e10f+'/'+_0x3c6ca5)[_0xfb98('0x17')](_0x2d4efd);}return null;};}function patchUpdates(_0x56af09){return function(_0x15932f){try{jsonpatch[_0xfb98('0x1d')](_0x15932f,_0x56af09,!![]);}catch(_0x278de4){return BPromise[_0xfb98('0x1e')](_0x278de4);}return _0x15932f[_0xfb98('0x1f')]();};}function saveUpdates(_0x23bc24,_0x46a120){return function(_0x33645e){if(_0x33645e){return _0x33645e['update'](_0x23bc24)[_0xfb98('0x20')](function(_0x36c7ce){return _0x36c7ce;});}return null;};}function removeEntity(_0x14eaff,_0x284b59){return function(_0x4c3f10){if(_0x4c3f10){return _0x4c3f10[_0xfb98('0x21')]()[_0xfb98('0x20')](function(){_0x14eaff[_0xfb98('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x568d6c,_0x433fce){return function(_0x269576){if(!_0x269576){_0x568d6c['sendStatus'](0x194);}return _0x269576;};}function handleError(_0x22523a,_0x4a1934){_0x4a1934=_0x4a1934||0x1f4;return function(_0x383057){logger[_0xfb98('0x22')](_0x383057['stack']);if(_0x383057['name']){delete _0x383057[_0xfb98('0x23')];}_0x22523a[_0xfb98('0x15')](_0x4a1934)['send'](_0x383057);};}exports[_0xfb98('0x24')]=function(_0x52e094,_0x16b961){var _0x11e0bc={},_0x3863ba={},_0x416caf={'count':0x0,'rows':[]};var _0x5d53d6=_[_0xfb98('0x25')](db[_0xfb98('0x26')]['rawAttributes'],function(_0x3c6e77){return{'name':_0x3c6e77['fieldName'],'type':_0x3c6e77['type']['key']};});_0x3863ba['model']=_['map'](_0x5d53d6,_0xfb98('0x23'));_0x3863ba[_0xfb98('0x27')]=_[_0xfb98('0x28')](_0x52e094['query']);_0x3863ba[_0xfb98('0x29')]=_[_0xfb98('0x2a')](_0x3863ba['model'],_0x3863ba[_0xfb98('0x27')]);_0x3863ba[_0xfb98('0x29')]=_[_0xfb98('0x2b')](_0x3863ba[_0xfb98('0x29')],['$and',_0xfb98('0x2c'),_0xfb98('0x2d'),_0xfb98('0x2e'),'$lt','$lte',_0xfb98('0x2f'),'$eq',_0xfb98('0x30'),_0xfb98('0x31'),_0xfb98('0x32'),_0xfb98('0x33'),_0xfb98('0x34'),_0xfb98('0x35'),_0xfb98('0x36'),_0xfb98('0x37'),_0xfb98('0x38'),_0xfb98('0x35'),_0xfb98('0x39'),_0xfb98('0x3a'),_0xfb98('0x3b'),'$any']);_0x11e0bc[_0xfb98('0x3c')]=_[_0xfb98('0x2a')](_0x3863ba[_0xfb98('0x3d')],qs[_0xfb98('0x3e')](_0x52e094[_0xfb98('0x27')][_0xfb98('0x3e')]));_0x11e0bc['attributes']=_0x11e0bc['attributes'][_0xfb98('0x3f')]?_0x11e0bc['attributes']:_0x3863ba['model'];if(!_0x52e094['query']['hasOwnProperty'](_0xfb98('0x40'))){_0x11e0bc[_0xfb98('0x1a')]=qs['limit'](_0x52e094[_0xfb98('0x27')][_0xfb98('0x1a')]);_0x11e0bc[_0xfb98('0x19')]=qs[_0xfb98('0x19')](_0x52e094['query'][_0xfb98('0x19')]);}_0x11e0bc[_0xfb98('0x41')]=qs[_0xfb98('0x42')](_0x52e094['query'][_0xfb98('0x42')]);_0x11e0bc[_0xfb98('0x43')]=qs[_0xfb98('0x29')](_[_0xfb98('0x44')](_0x52e094[_0xfb98('0x27')],_0x3863ba['filters']),_0x5d53d6);if(_0x52e094['query'][_0xfb98('0x45')]){_0x11e0bc['where']=_['merge'](_0x11e0bc['where'],{'$or':_['map'](_0x5d53d6,function(_0x4cc1cf){if(_0x4cc1cf['type']!==_0xfb98('0x46')){var _0x31694a={};_0x31694a[_0x4cc1cf[_0xfb98('0x23')]]={'$like':'%'+_0x52e094[_0xfb98('0x27')][_0xfb98('0x45')]+'%'};return _0x31694a;}})});}_0x11e0bc=_[_0xfb98('0x47')]({},_0x11e0bc,_0x52e094['options']);var _0x253ab1={'where':_0x11e0bc[_0xfb98('0x43')]};return db[_0xfb98('0x26')]['count'](_0x253ab1)[_0xfb98('0x20')](function(_0xe7ee59){_0x416caf['count']=_0xe7ee59;if(_0x52e094[_0xfb98('0x27')]['includeAll']){_0x11e0bc[_0xfb98('0x48')]=[{'all':!![]}];}return db['CmHopper'][_0xfb98('0x49')](_0x11e0bc);})[_0xfb98('0x20')](function(_0x5f30b9){_0x416caf[_0xfb98('0x4a')]=_0x5f30b9;return _0x416caf;})[_0xfb98('0x20')](respondWithFilteredResult(_0x16b961,_0x11e0bc))[_0xfb98('0x4b')](handleError(_0x16b961,null));};exports['show']=function(_0xcfb1,_0x721006){var _0x199456={'raw':!![],'where':{'id':_0xcfb1[_0xfb98('0x4c')]['id']}},_0x17a5a6={};_0x17a5a6['model']=_[_0xfb98('0x28')](db['CmHopper'][_0xfb98('0x4d')]);_0x17a5a6['query']=_[_0xfb98('0x28')](_0xcfb1[_0xfb98('0x27')]);_0x17a5a6[_0xfb98('0x29')]=_[_0xfb98('0x2a')](_0x17a5a6[_0xfb98('0x3d')],_0x17a5a6[_0xfb98('0x27')]);_0x199456[_0xfb98('0x3c')]=_[_0xfb98('0x2a')](_0x17a5a6[_0xfb98('0x3d')],qs[_0xfb98('0x3e')](_0xcfb1[_0xfb98('0x27')][_0xfb98('0x3e')]));_0x199456[_0xfb98('0x3c')]=_0x199456[_0xfb98('0x3c')][_0xfb98('0x3f')]?_0x199456[_0xfb98('0x3c')]:_0x17a5a6[_0xfb98('0x3d')];if(_0xcfb1[_0xfb98('0x27')][_0xfb98('0x4e')]){_0x199456[_0xfb98('0x48')]=[{'all':!![]}];}_0x199456=_[_0xfb98('0x47')]({},_0x199456,_0xcfb1[_0xfb98('0x4f')]);return db[_0xfb98('0x26')][_0xfb98('0x50')](_0x199456)[_0xfb98('0x20')](handleEntityNotFound(_0x721006,null))[_0xfb98('0x20')](respondWithResult(_0x721006,null))['catch'](handleError(_0x721006,null));};exports['create']=function(_0x267b2e,_0x50063b){return db[_0xfb98('0x26')][_0xfb98('0x51')](_0x267b2e[_0xfb98('0x52')],{})['then'](respondWithResult(_0x50063b,0xc9))[_0xfb98('0x4b')](handleError(_0x50063b,null));};exports[_0xfb98('0x53')]=function(_0x2c5ab1,_0x1c5582){if(_0x2c5ab1[_0xfb98('0x52')]['id']){delete _0x2c5ab1[_0xfb98('0x52')]['id'];}return db[_0xfb98('0x26')][_0xfb98('0x50')]({'where':{'id':_0x2c5ab1['params']['id']}})[_0xfb98('0x20')](handleEntityNotFound(_0x1c5582,null))['then'](saveUpdates(_0x2c5ab1[_0xfb98('0x52')],null))[_0xfb98('0x20')](respondWithResult(_0x1c5582,null))[_0xfb98('0x4b')](handleError(_0x1c5582,null));};exports[_0xfb98('0x54')]=function(_0x583b61,_0x1609cb){return db[_0xfb98('0x26')][_0xfb98('0x54')]()[_0xfb98('0x20')](respondWithResult(_0x1609cb,null))['catch'](handleError(_0x1609cb,null));};exports[_0xfb98('0x21')]=function(_0x2f4ff9,_0x4e50ad){var _0x17f953;return db[_0xfb98('0x26')][_0xfb98('0x50')]({'where':{'id':_0x2f4ff9[_0xfb98('0x4c')]['id']}})[_0xfb98('0x20')](handleEntityNotFound(_0x4e50ad,null))[_0xfb98('0x20')](function(_0x2b481b){if(_0x2b481b){return _0x2b481b[_0xfb98('0x21')]()[_0xfb98('0x20')](function(_0x5d4db7){return _0x5d4db7;});}})[_0xfb98('0x20')](function(_0x2ce617){_0x17f953=_0x2ce617;if(_0x2ce617){if(_0x2ce617[_0xfb98('0x55')]||_0x2ce617[_0xfb98('0x56')]){return db[_0x2ce617['VoiceQueueId']?_0xfb98('0x57'):_0xfb98('0x58')][_0xfb98('0x50')]({'where':{'id':_0x2ce617['VoiceQueueId']?_0x2ce617[_0xfb98('0x55')]:_0x2ce617[_0xfb98('0x56')]},'attributes':['id','name'],'raw':!![]});}}})[_0xfb98('0x20')](function(_0x11803a){var _0x77fd80={};if(_0x11803a){_[_0xfb98('0x47')](_0x77fd80,_[_0xfb98('0x59')](_0x17f953[_0xfb98('0x5a')],[_0xfb98('0x5b'),_0xfb98('0x5c'),'id']));_0x77fd80['state']=0x15;_0x77fd80[_0xfb98('0x5d')]=_0xfb98('0x5e');_0x77fd80[_0xfb98('0x5f')]=_0x11803a[_0xfb98('0x23')];_0x77fd80[_0xfb98('0x60')]=_0x2f4ff9[_0xfb98('0x61')][_0xfb98('0x23')];_0x77fd80[_0xfb98('0x62')]=_0x2f4ff9[_0xfb98('0x61')]['id'];_0x77fd80[_0xfb98('0x5e')]=!![];_0x77fd80['deletedat']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x77fd80[_0xfb98('0x63')]=_0x17f953['phone'];_0x77fd80['campaigntype']=_0x17f953[_0xfb98('0x55')]?_0xfb98('0x64'):_0xfb98('0x65');return db[_0xfb98('0x66')][_0xfb98('0x50')]({'where':{'id':_0x77fd80['ContactId']},'attributes':[_0xfb98('0x67'),'lastName']})[_0xfb98('0x20')](function(_0x104dc4){if(!_['isNil'](_0x4e50ad)&&!_[_0xfb98('0x68')](_0x104dc4[_0xfb98('0x67')])){_0x77fd80['calleridname']=_0x104dc4[_0xfb98('0x67')];if(!_['isNil'](_0x104dc4[_0xfb98('0x69')])){_0x77fd80[_0xfb98('0x6a')]+='\x20'+_0x104dc4[_0xfb98('0x69')];}}})[_0xfb98('0x6b')](function(){return db[_0xfb98('0x6c')][_0xfb98('0x51')](_0x77fd80);});}})[_0xfb98('0x20')](function(){return _0x4e50ad[_0xfb98('0x15')](0xcc)[_0xfb98('0x16')]();})[_0xfb98('0x4b')](handleError(_0x4e50ad,null));};exports[_0xfb98('0x6d')]=function(_0x56f6cc,_0x220ba5,_0x56f263){var _0x4dc9bd=[];return db[_0xfb98('0x66')]['describe']()[_0xfb98('0x20')](function(_0x5e6da1){_0x4dc9bd=_['keys'](_0x5e6da1);return _0x56f6cc[_0xfb98('0x61')]['getVoiceQueues']({'where':{'type':_0xfb98('0x6e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xfb98('0x6f')],'raw':!![]});})[_0xfb98('0x20')](function(_0x17e866){if(_0x17e866&&_0x17e866[_0xfb98('0x3f')]){return db[_0xfb98('0x70')]['transaction'](function(_0x1cf398){var _0x186ad5={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfb98('0x71')](_0xfb98('0x72'))},'VoiceQueueId':{'$in':_['map'](_0x17e866,'id')},'$or':[{'UserId':null},{'UserId':_0x56f6cc[_0xfb98('0x61')]['id']}]};var _0x33d03e=[];if(_0x56f6cc[_0xfb98('0x52')][_0xfb98('0x73')]&&_0x56f6cc[_0xfb98('0x52')][_0xfb98('0x73')]===_0xfb98('0x74')){if(!_[_0xfb98('0x75')](_0x56f6cc['body'][_0xfb98('0x76')])){_0x186ad5['id']={'$in':_0x56f6cc['body'][_0xfb98('0x76')]};}_0x33d03e=[[_0xfb98('0x77'),_0xfb98('0x78')],[_0xfb98('0x79'),_0x17e866[0x0][_0xfb98('0x6f')]===_0xfb98('0x78')?_0xfb98('0x7a'):_0xfb98('0x78')],db['sequelize'][_0xfb98('0x7b')](_0xfb98('0x7c')),['id','DESC']];}else{if(!_[_0xfb98('0x75')](_0x56f6cc['body']['hopperIds'])){_0x186ad5['id']={'$notIn':_0x56f6cc[_0xfb98('0x52')][_0xfb98('0x76')]};}_0x33d03e=[['priority',_0xfb98('0x7a')],[_0xfb98('0x79'),_0x17e866[0x0][_0xfb98('0x6f')]],db[_0xfb98('0x70')]['literal'](_0xfb98('0x7d')),['id',_0xfb98('0x78')]];}return db[_0xfb98('0x26')][_0xfb98('0x7e')]({'attributes':['id',_0xfb98('0x7f')],'where':_0x186ad5,'order':_0x33d03e,'transaction':_0x1cf398,'lock':_0x1cf398['LOCK'][_0xfb98('0x80')],'include':[{'model':db[_0xfb98('0x66')],'as':'Contact','attributes':_0x4dc9bd,'include':[{'model':db['CmCompany'],'as':_0xfb98('0x81'),'attributes':['id',_0xfb98('0x23')]}]},{'model':db['CmList'],'as':'List','attributes':['id','name']},{'model':db[_0xfb98('0x57')],'as':_0xfb98('0x82'),'attributes':['id',_0xfb98('0x23'),_0xfb98('0x83')]}]})[_0xfb98('0x20')](function(_0x5a5feb){if(_0x5a5feb){return _0x5a5feb[_0xfb98('0x53')]({'UserId':_0x56f6cc[_0xfb98('0x61')]['id']},{'transaction':_0x1cf398});}});});}})[_0xfb98('0x20')](handleEntityNotFound(_0x220ba5,null))['then'](respondWithResult(_0x220ba5,null))[_0xfb98('0x4b')](handleError(_0x220ba5,null));};exports[_0xfb98('0x84')]=function(_0x40e70b,_0x7e71a8,_0x4f21c2){return _0x40e70b['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xfb98('0x85')},'attributes':['id'],'raw':!![]})[_0xfb98('0x20')](function(_0x31f6c6){if(_0x31f6c6&&_0x31f6c6[_0xfb98('0x3f')]){return db[_0xfb98('0x26')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfb98('0x71')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xfb98('0x25')](_0x31f6c6,'id')},'$or':[{'UserId':null},{'UserId':_0x40e70b['user']['id']}]}});}return 0x0;})[_0xfb98('0x20')](function(_0x1d0b1f){if(!_['isNil'](_0x1d0b1f)&&_['isNumber'](_0x1d0b1f)){return _0x7e71a8[_0xfb98('0x15')](0xc8)['json']({'contacts':_0x1d0b1f});}else{logger[_0xfb98('0x22')](_0xfb98('0x86'),_0xfb98('0x84'),0x194,'entity\x20not\x20found');_0x7e71a8[_0xfb98('0x14')](0x194);}})[_0xfb98('0x4b')](handleError(_0x7e71a8,null));}; \ No newline at end of file +var _0xd3a8=['isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','query','intersection','model','concat','$or','$gt','$lt','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','keys','find','create','body','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue','Campaign','createdAt','state','statedesc','campaign','UserId','user','deleted','deletedat','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','sequelize','transaction','format','YYYY-MM-DD\x20HH:mm:ss','direction','prev'];(function(_0x32c1d2,_0x3da391){var _0x25965c=function(_0x185c8f){while(--_0x185c8f){_0x32c1d2['push'](_0x32c1d2['shift']());}};_0x25965c(++_0x3da391);}(_0xd3a8,0x135));var _0x8d3a=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xd3a8[_0x465a0c];return _0x1e202e;};'use strict';var pdf=require(_0x8d3a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8d3a('0x1'));var zipdir=require(_0x8d3a('0x2'));var jsonpatch=require(_0x8d3a('0x3'));var rp=require(_0x8d3a('0x4'));var moment=require('moment');var BPromise=require(_0x8d3a('0x5'));var Mustache=require(_0x8d3a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8d3a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8d3a('0x8'));var crypto=require(_0x8d3a('0x9'));var jsforce=require(_0x8d3a('0xa'));var deskjs=require(_0x8d3a('0xb'));var toCsv=require(_0x8d3a('0x7'));var querystring=require(_0x8d3a('0xc'));var Papa=require(_0x8d3a('0xd'));var Redis=require(_0x8d3a('0xe'));var authService=require(_0x8d3a('0xf'));var qs=require(_0x8d3a('0x10'));var as=require(_0x8d3a('0x11'));var hardwareService=require(_0x8d3a('0x12'));var logger=require(_0x8d3a('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8d3a('0x14'));var db=require(_0x8d3a('0x15'))['db'];function respondWithStatusCode(_0xc834ec,_0x43b1ca){_0x43b1ca=_0x43b1ca||0xcc;return function(_0x4759cd){if(_0x4759cd){return _0xc834ec[_0x8d3a('0x16')](_0x43b1ca);}return _0xc834ec['status'](_0x43b1ca)[_0x8d3a('0x17')]();};}function respondWithResult(_0xb66692,_0x5c6ed1){_0x5c6ed1=_0x5c6ed1||0xc8;return function(_0x4c11b3){if(_0x4c11b3){return _0xb66692[_0x8d3a('0x18')](_0x5c6ed1)['json'](_0x4c11b3);}};}function respondWithFilteredResult(_0x14db8,_0x4225d9){return function(_0x10f582){if(_0x10f582){var _0x4c915d=_0x10f582['count'],_0x33eefb=_0x4225d9[_0x8d3a('0x19')],_0x483fea=_0x4225d9[_0x8d3a('0x19')]+_0x4225d9[_0x8d3a('0x1a')],_0x10d8af;if(_0x483fea>=_0x4c915d){_0x483fea=_0x4c915d;_0x10d8af=0xc8;}else{_0x10d8af=0xce;}_0x14db8['status'](_0x10d8af);return _0x14db8['set'](_0x8d3a('0x1b'),_0x33eefb+'-'+_0x483fea+'/'+_0x4c915d)[_0x8d3a('0x1c')](_0x10f582);}return null;};}function patchUpdates(_0x23a695){return function(_0x3478ee){try{jsonpatch[_0x8d3a('0x1d')](_0x3478ee,_0x23a695,!![]);}catch(_0x556f75){return BPromise[_0x8d3a('0x1e')](_0x556f75);}return _0x3478ee[_0x8d3a('0x1f')]();};}function saveUpdates(_0x3dc3c1,_0xd390c2){return function(_0x230971){if(_0x230971){return _0x230971[_0x8d3a('0x20')](_0x3dc3c1)['then'](function(_0x421879){return _0x421879;});}return null;};}function removeEntity(_0x3ca6a9,_0x46fcf1){return function(_0x412126){if(_0x412126){return _0x412126['destroy']()[_0x8d3a('0x21')](function(){_0x3ca6a9[_0x8d3a('0x18')](0xcc)[_0x8d3a('0x17')]();});}};}function handleEntityNotFound(_0x53916d,_0x10b997){return function(_0x477070){if(!_0x477070){_0x53916d[_0x8d3a('0x16')](0x194);}return _0x477070;};}function handleError(_0x327d9a,_0x4050d5){_0x4050d5=_0x4050d5||0x1f4;return function(_0xb9ba91){logger[_0x8d3a('0x22')](_0xb9ba91['stack']);if(_0xb9ba91[_0x8d3a('0x23')]){delete _0xb9ba91[_0x8d3a('0x23')];}_0x327d9a[_0x8d3a('0x18')](_0x4050d5)[_0x8d3a('0x24')](_0xb9ba91);};}exports[_0x8d3a('0x25')]=function(_0x273548,_0x57c129){var _0x4eb8d1={},_0x1fa201={},_0x107a16={'count':0x0,'rows':[]};var _0x1a1e4f=_[_0x8d3a('0x26')](db[_0x8d3a('0x27')][_0x8d3a('0x28')],function(_0x497328){return{'name':_0x497328[_0x8d3a('0x29')],'type':_0x497328[_0x8d3a('0x2a')][_0x8d3a('0x2b')]};});_0x1fa201['model']=_[_0x8d3a('0x26')](_0x1a1e4f,_0x8d3a('0x23'));_0x1fa201[_0x8d3a('0x2c')]=_['keys'](_0x273548[_0x8d3a('0x2c')]);_0x1fa201['filters']=_[_0x8d3a('0x2d')](_0x1fa201[_0x8d3a('0x2e')],_0x1fa201[_0x8d3a('0x2c')]);_0x1fa201['filters']=_[_0x8d3a('0x2f')](_0x1fa201['filters'],['$and',_0x8d3a('0x30'),_0x8d3a('0x31'),'$gte',_0x8d3a('0x32'),'$lte','$ne',_0x8d3a('0x33'),_0x8d3a('0x34'),'$between',_0x8d3a('0x35'),_0x8d3a('0x36'),_0x8d3a('0x37'),_0x8d3a('0x38'),_0x8d3a('0x39'),_0x8d3a('0x3a'),_0x8d3a('0x3b'),_0x8d3a('0x38'),_0x8d3a('0x3c'),_0x8d3a('0x3d'),'$contained',_0x8d3a('0x3e')]);_0x4eb8d1[_0x8d3a('0x3f')]=_['intersection'](_0x1fa201['model'],qs[_0x8d3a('0x40')](_0x273548[_0x8d3a('0x2c')][_0x8d3a('0x40')]));_0x4eb8d1['attributes']=_0x4eb8d1[_0x8d3a('0x3f')][_0x8d3a('0x41')]?_0x4eb8d1['attributes']:_0x1fa201[_0x8d3a('0x2e')];if(!_0x273548[_0x8d3a('0x2c')][_0x8d3a('0x42')](_0x8d3a('0x43'))){_0x4eb8d1[_0x8d3a('0x1a')]=qs[_0x8d3a('0x1a')](_0x273548['query'][_0x8d3a('0x1a')]);_0x4eb8d1[_0x8d3a('0x19')]=qs[_0x8d3a('0x19')](_0x273548[_0x8d3a('0x2c')][_0x8d3a('0x19')]);}_0x4eb8d1[_0x8d3a('0x44')]=qs[_0x8d3a('0x45')](_0x273548[_0x8d3a('0x2c')][_0x8d3a('0x45')]);_0x4eb8d1[_0x8d3a('0x46')]=qs['filters'](_['pick'](_0x273548[_0x8d3a('0x2c')],_0x1fa201[_0x8d3a('0x47')]),_0x1a1e4f);if(_0x273548[_0x8d3a('0x2c')][_0x8d3a('0x48')]){_0x4eb8d1[_0x8d3a('0x46')]=_[_0x8d3a('0x49')](_0x4eb8d1['where'],{'$or':_[_0x8d3a('0x26')](_0x1a1e4f,function(_0x320f47){if(_0x320f47[_0x8d3a('0x2a')]!==_0x8d3a('0x4a')){var _0x2b5255={};_0x2b5255[_0x320f47[_0x8d3a('0x23')]]={'$like':'%'+_0x273548[_0x8d3a('0x2c')][_0x8d3a('0x48')]+'%'};return _0x2b5255;}})});}_0x4eb8d1=_[_0x8d3a('0x49')]({},_0x4eb8d1,_0x273548[_0x8d3a('0x4b')]);var _0x99bc22={'where':_0x4eb8d1[_0x8d3a('0x46')]};return db['CmHopper'][_0x8d3a('0x4c')](_0x99bc22)[_0x8d3a('0x21')](function(_0x458cdf){_0x107a16['count']=_0x458cdf;if(_0x273548[_0x8d3a('0x2c')][_0x8d3a('0x4d')]){_0x4eb8d1[_0x8d3a('0x4e')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4eb8d1);})[_0x8d3a('0x21')](function(_0x3c1c98){_0x107a16[_0x8d3a('0x4f')]=_0x3c1c98;return _0x107a16;})[_0x8d3a('0x21')](respondWithFilteredResult(_0x57c129,_0x4eb8d1))[_0x8d3a('0x50')](handleError(_0x57c129,null));};exports['show']=function(_0x9ee50a,_0x3e5392){var _0x24928d={'raw':!![],'where':{'id':_0x9ee50a['params']['id']}},_0x14a14b={};_0x14a14b['model']=_['keys'](db[_0x8d3a('0x27')][_0x8d3a('0x28')]);_0x14a14b[_0x8d3a('0x2c')]=_[_0x8d3a('0x51')](_0x9ee50a[_0x8d3a('0x2c')]);_0x14a14b[_0x8d3a('0x47')]=_['intersection'](_0x14a14b[_0x8d3a('0x2e')],_0x14a14b[_0x8d3a('0x2c')]);_0x24928d['attributes']=_[_0x8d3a('0x2d')](_0x14a14b[_0x8d3a('0x2e')],qs[_0x8d3a('0x40')](_0x9ee50a[_0x8d3a('0x2c')]['fields']));_0x24928d[_0x8d3a('0x3f')]=_0x24928d[_0x8d3a('0x3f')][_0x8d3a('0x41')]?_0x24928d[_0x8d3a('0x3f')]:_0x14a14b[_0x8d3a('0x2e')];if(_0x9ee50a[_0x8d3a('0x2c')][_0x8d3a('0x4d')]){_0x24928d[_0x8d3a('0x4e')]=[{'all':!![]}];}_0x24928d=_[_0x8d3a('0x49')]({},_0x24928d,_0x9ee50a[_0x8d3a('0x4b')]);return db['CmHopper'][_0x8d3a('0x52')](_0x24928d)[_0x8d3a('0x21')](handleEntityNotFound(_0x3e5392,null))['then'](respondWithResult(_0x3e5392,null))[_0x8d3a('0x50')](handleError(_0x3e5392,null));};exports['create']=function(_0x22d6dd,_0x1551a0){return db[_0x8d3a('0x27')][_0x8d3a('0x53')](_0x22d6dd['body'],{})[_0x8d3a('0x21')](respondWithResult(_0x1551a0,0xc9))[_0x8d3a('0x50')](handleError(_0x1551a0,null));};exports[_0x8d3a('0x20')]=function(_0x2663ce,_0x1ed9b1){if(_0x2663ce[_0x8d3a('0x54')]['id']){delete _0x2663ce[_0x8d3a('0x54')]['id'];}return db[_0x8d3a('0x27')]['find']({'where':{'id':_0x2663ce['params']['id']}})[_0x8d3a('0x21')](handleEntityNotFound(_0x1ed9b1,null))[_0x8d3a('0x21')](saveUpdates(_0x2663ce[_0x8d3a('0x54')],null))['then'](respondWithResult(_0x1ed9b1,null))[_0x8d3a('0x50')](handleError(_0x1ed9b1,null));};exports[_0x8d3a('0x55')]=function(_0x5f46a6,_0x904f7a){return db[_0x8d3a('0x27')][_0x8d3a('0x55')]()[_0x8d3a('0x21')](respondWithResult(_0x904f7a,null))[_0x8d3a('0x50')](handleError(_0x904f7a,null));};exports[_0x8d3a('0x56')]=function(_0x5a6a41,_0x38c946){var _0x659a6e;return db[_0x8d3a('0x27')]['find']({'where':{'id':_0x5a6a41[_0x8d3a('0x57')]['id']}})[_0x8d3a('0x21')](handleEntityNotFound(_0x38c946,null))['then'](function(_0x53bf04){if(_0x53bf04){return _0x53bf04[_0x8d3a('0x56')]()[_0x8d3a('0x21')](function(_0x149bff){return _0x149bff;});}})['then'](function(_0x5e401a){_0x659a6e=_0x5e401a;if(_0x5e401a){if(_0x5e401a[_0x8d3a('0x58')]||_0x5e401a[_0x8d3a('0x59')]){return db[_0x5e401a[_0x8d3a('0x58')]?_0x8d3a('0x5a'):_0x8d3a('0x5b')][_0x8d3a('0x52')]({'where':{'id':_0x5e401a[_0x8d3a('0x58')]?_0x5e401a[_0x8d3a('0x58')]:_0x5e401a['CampaignId']},'attributes':['id',_0x8d3a('0x23')],'raw':!![]});}}})[_0x8d3a('0x21')](function(_0x3c42f9){var _0x389132={};if(_0x3c42f9){_['merge'](_0x389132,_['omit'](_0x659a6e['dataValues'],[_0x8d3a('0x5c'),'updatedAt','id']));_0x389132[_0x8d3a('0x5d')]=0x15;_0x389132[_0x8d3a('0x5e')]='deleted';_0x389132[_0x8d3a('0x5f')]=_0x3c42f9[_0x8d3a('0x23')];_0x389132['membername']=_0x5a6a41['user'][_0x8d3a('0x23')];_0x389132[_0x8d3a('0x60')]=_0x5a6a41[_0x8d3a('0x61')]['id'];_0x389132[_0x8d3a('0x62')]=!![];_0x389132[_0x8d3a('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x389132['calleridnum']=_0x659a6e[_0x8d3a('0x64')];_0x389132['campaigntype']=_0x659a6e[_0x8d3a('0x58')]?_0x8d3a('0x65'):_0x8d3a('0x66');return db[_0x8d3a('0x67')]['find']({'where':{'id':_0x389132[_0x8d3a('0x68')]},'attributes':[_0x8d3a('0x69'),_0x8d3a('0x6a')]})[_0x8d3a('0x21')](function(_0x5631ac){if(!_[_0x8d3a('0x6b')](_0x38c946)&&!_[_0x8d3a('0x6b')](_0x5631ac[_0x8d3a('0x69')])){_0x389132['calleridname']=_0x5631ac[_0x8d3a('0x69')];if(!_['isNil'](_0x5631ac[_0x8d3a('0x6a')])){_0x389132[_0x8d3a('0x6c')]+='\x20'+_0x5631ac[_0x8d3a('0x6a')];}}})['finally'](function(){return db[_0x8d3a('0x6d')][_0x8d3a('0x53')](_0x389132);});}})[_0x8d3a('0x21')](function(){return _0x38c946[_0x8d3a('0x18')](0xcc)[_0x8d3a('0x17')]();})[_0x8d3a('0x50')](handleError(_0x38c946,null));};exports[_0x8d3a('0x6e')]=function(_0x27ca33,_0x3ddb67,_0x1a5c3c){var _0x18830c=[];return db[_0x8d3a('0x67')][_0x8d3a('0x55')]()[_0x8d3a('0x21')](function(_0x4d0579){_0x18830c=_[_0x8d3a('0x51')](_0x4d0579);return _0x27ca33[_0x8d3a('0x61')][_0x8d3a('0x6f')]({'where':{'type':_0x8d3a('0x70'),'dialActive':!![],'dialMethod':_0x8d3a('0x71')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x279bcb){if(_0x279bcb&&_0x279bcb['length']){return db[_0x8d3a('0x72')][_0x8d3a('0x73')](function(_0x225576){var _0x2d321b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8d3a('0x74')](_0x8d3a('0x75'))},'VoiceQueueId':{'$in':_[_0x8d3a('0x26')](_0x279bcb,'id')},'$or':[{'UserId':null},{'UserId':_0x27ca33[_0x8d3a('0x61')]['id']}]};var _0x3a62bf=[];if(_0x27ca33['body'][_0x8d3a('0x76')]&&_0x27ca33[_0x8d3a('0x54')][_0x8d3a('0x76')]===_0x8d3a('0x77')){if(!_[_0x8d3a('0x78')](_0x27ca33['body'][_0x8d3a('0x79')])){_0x2d321b['id']={'$in':_0x27ca33[_0x8d3a('0x54')][_0x8d3a('0x79')]};}_0x3a62bf=[[_0x8d3a('0x7a'),_0x8d3a('0x7b')],['scheduledAt',_0x279bcb[0x0][_0x8d3a('0x7c')]===_0x8d3a('0x7b')?_0x8d3a('0x7d'):_0x8d3a('0x7b')],db[_0x8d3a('0x72')]['literal'](_0x8d3a('0x7e')),['id',_0x8d3a('0x7d')]];}else{if(!_[_0x8d3a('0x78')](_0x27ca33['body']['hopperIds'])){_0x2d321b['id']={'$notIn':_0x27ca33[_0x8d3a('0x54')]['hopperIds']};}_0x3a62bf=[[_0x8d3a('0x7a'),_0x8d3a('0x7d')],[_0x8d3a('0x7f'),_0x279bcb[0x0][_0x8d3a('0x7c')]],db['sequelize'][_0x8d3a('0x80')](_0x8d3a('0x81')),['id',_0x8d3a('0x7b')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x8d3a('0x82')],'where':_0x2d321b,'order':_0x3a62bf,'transaction':_0x225576,'lock':_0x225576[_0x8d3a('0x83')][_0x8d3a('0x84')],'include':[{'model':db[_0x8d3a('0x67')],'as':_0x8d3a('0x85'),'attributes':_0x18830c,'include':[{'model':db[_0x8d3a('0x86')],'as':_0x8d3a('0x87'),'attributes':['id',_0x8d3a('0x23')]}]},{'model':db[_0x8d3a('0x88')],'as':_0x8d3a('0x89'),'attributes':['id',_0x8d3a('0x23')]},{'model':db[_0x8d3a('0x5a')],'as':_0x8d3a('0x8a'),'attributes':['id',_0x8d3a('0x23'),_0x8d3a('0x8b')]}]})['then'](function(_0x5e145d){if(_0x5e145d){return _0x5e145d[_0x8d3a('0x20')]({'UserId':_0x27ca33[_0x8d3a('0x61')]['id']},{'transaction':_0x225576});}});});}})['then'](handleEntityNotFound(_0x3ddb67,null))[_0x8d3a('0x21')](respondWithResult(_0x3ddb67,null))[_0x8d3a('0x50')](handleError(_0x3ddb67,null));};exports[_0x8d3a('0x8c')]=function(_0x35f450,_0x109e3b,_0x833d34){return _0x35f450[_0x8d3a('0x61')][_0x8d3a('0x6f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x8d3a('0x21')](function(_0x5c943b){if(_0x5c943b&&_0x5c943b[_0x8d3a('0x41')]){return db[_0x8d3a('0x27')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8d3a('0x74')](_0x8d3a('0x75'))},'VoiceQueueId':{'$in':_['map'](_0x5c943b,'id')},'$or':[{'UserId':null},{'UserId':_0x35f450[_0x8d3a('0x61')]['id']}]}});}return 0x0;})[_0x8d3a('0x21')](function(_0x51c44b){if(!_[_0x8d3a('0x6b')](_0x51c44b)&&_[_0x8d3a('0x8d')](_0x51c44b)){return _0x109e3b['status'](0xc8)[_0x8d3a('0x1c')]({'contacts':_0x51c44b});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x8d3a('0x8e'));_0x109e3b[_0x8d3a('0x16')](0x194);}})['catch'](handleError(_0x109e3b,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index de1efbd..877a93f 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 _0x6693=['scheduledat','phone','priority','lodash','util','../../config/logger','moment','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper'];(function(_0x2f7a75,_0x456c9){var _0x7ccb0b=function(_0xef89a2){while(--_0xef89a2){_0x2f7a75['push'](_0x2f7a75['shift']());}};_0x7ccb0b(++_0x456c9);}(_0x6693,0xf3));var _0x3669=function(_0x66f74,_0x5d0688){_0x66f74=_0x66f74-0x0;var _0x2aa9fd=_0x6693[_0x66f74];return _0x2aa9fd;};'use strict';var _=require(_0x3669('0x0'));var util=require(_0x3669('0x1'));var logger=require(_0x3669('0x2'))('api');var moment=require(_0x3669('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(_0x3669('0x4'));var attributes=require(_0x3669('0x5'));module[_0x3669('0x6')]=function(_0x156155,_0x399c3d){return _0x156155[_0x3669('0x7')]('CmHopper',attributes,{'tableName':_0x3669('0x8'),'paranoid':![],'indexes':[{'name':_0x3669('0x9'),'fields':[_0x3669('0x9')]},{'name':_0x3669('0xa'),'fields':[_0x3669('0xa')]},{'name':_0x3669('0xb'),'fields':[_0x3669('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ecc=['CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x17983c,_0x310ae0){var _0x2f5be1=function(_0x159302){while(--_0x159302){_0x17983c['push'](_0x17983c['shift']());}};_0x2f5be1(++_0x310ae0);}(_0x6ecc,0x19a));var _0xc6ec=function(_0xca0e55,_0x49be6b){_0xca0e55=_0xca0e55-0x0;var _0x6d7b2a=_0x6ecc[_0xca0e55];return _0x6d7b2a;};'use strict';var _=require(_0xc6ec('0x0'));var util=require(_0xc6ec('0x1'));var logger=require(_0xc6ec('0x2'))(_0xc6ec('0x3'));var moment=require('moment');var BPromise=require(_0xc6ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6ec('0x5'));var rimraf=require(_0xc6ec('0x6'));var config=require('../../config/environment');var attributes=require(_0xc6ec('0x7'));module[_0xc6ec('0x8')]=function(_0x10f290,_0xd01584){return _0x10f290[_0xc6ec('0x9')](_0xc6ec('0xa'),attributes,{'tableName':_0xc6ec('0xb'),'paranoid':![],'indexes':[{'name':_0xc6ec('0xc'),'fields':[_0xc6ec('0xc')]},{'name':_0xc6ec('0xd'),'fields':[_0xc6ec('0xd')]},{'name':'priority','fields':[_0xc6ec('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 6d7dc6a..916fc48 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 _0xdcc6=['GetCmHopper','CmHopper','findAll','options','where','attributes','limit','model','include','map','catch','ShowCmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','order','Contact','keys','User','Agent','includes','push','UserId','all','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','transaction','LOCK','length','GetCmHopperPreview','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','CmHopper,\x20%s,\x20%s','message','result'];(function(_0x39c4aa,_0x4a3822){var _0x1e0f1b=function(_0x4108e4){while(--_0x4108e4){_0x39c4aa['push'](_0x39c4aa['shift']());}};_0x1e0f1b(++_0x4a3822);}(_0xdcc6,0x1d5));var _0x6dcc=function(_0x1708e0,_0x1cf4e2){_0x1708e0=_0x1708e0-0x0;var _0x5a4e51=_0xdcc6[_0x1708e0];return _0x5a4e51;};'use strict';var _=require(_0x6dcc('0x0'));var util=require(_0x6dcc('0x1'));var moment=require(_0x6dcc('0x2'));var BPromise=require('bluebird');var rs=require(_0x6dcc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dcc('0x4'))['db'];var utils=require(_0x6dcc('0x5'));var logger=require(_0x6dcc('0x6'))('rpc');var config=require(_0x6dcc('0x7'));var jayson=require(_0x6dcc('0x8'));var client=jayson[_0x6dcc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x483e76,_0x3a68b7,_0x18434d){return new BPromise(function(_0x4441d5,_0x271fbb){return client[_0x6dcc('0xa')](_0x483e76,_0x18434d)[_0x6dcc('0xb')](function(_0x23f5a8){logger[_0x6dcc('0xc')]('CmHopper,\x20%s,\x20%s',_0x3a68b7,_0x6dcc('0xd'));logger[_0x6dcc('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x3a68b7,_0x6dcc('0xd'),JSON[_0x6dcc('0xf')](_0x23f5a8));if(_0x23f5a8['error']){if(_0x23f5a8[_0x6dcc('0x10')][_0x6dcc('0x11')]===0x1f4){logger[_0x6dcc('0x10')](_0x6dcc('0x12'),_0x3a68b7,_0x23f5a8[_0x6dcc('0x10')][_0x6dcc('0x13')]);return _0x271fbb(_0x23f5a8[_0x6dcc('0x10')][_0x6dcc('0x13')]);}logger[_0x6dcc('0x10')](_0x6dcc('0x12'),_0x3a68b7,_0x23f5a8[_0x6dcc('0x10')][_0x6dcc('0x13')]);return _0x4441d5(_0x23f5a8['error'][_0x6dcc('0x13')]);}else{logger[_0x6dcc('0xc')](_0x6dcc('0x12'),_0x3a68b7,'request\x20sent');_0x4441d5(_0x23f5a8[_0x6dcc('0x14')]['message']);}})['catch'](function(_0x130c02){logger[_0x6dcc('0x10')](_0x6dcc('0x12'),_0x3a68b7,_0x130c02);_0x271fbb(_0x130c02);});});}exports[_0x6dcc('0x15')]=function(_0x2e9ea0){var _0x206597=this;return new Promise(function(_0x6010ea,_0x57eeec){return db[_0x6dcc('0x16')][_0x6dcc('0x17')]({'raw':_0x2e9ea0[_0x6dcc('0x18')]?_0x2e9ea0[_0x6dcc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2e9ea0[_0x6dcc('0x18')]?_0x2e9ea0[_0x6dcc('0x18')][_0x6dcc('0x19')]||null:null,'attributes':_0x2e9ea0[_0x6dcc('0x18')]?_0x2e9ea0[_0x6dcc('0x18')][_0x6dcc('0x1a')]||null:null,'limit':_0x2e9ea0[_0x6dcc('0x18')]?_0x2e9ea0[_0x6dcc('0x18')][_0x6dcc('0x1b')]||null:null,'include':_0x2e9ea0[_0x6dcc('0x18')]?_0x2e9ea0['options']['include']?_['map'](_0x2e9ea0[_0x6dcc('0x18')]['include'],function(_0x479535){return{'model':db[_0x479535[_0x6dcc('0x1c')]],'as':_0x479535['as'],'attributes':_0x479535[_0x6dcc('0x1a')],'include':_0x479535[_0x6dcc('0x1d')]?_[_0x6dcc('0x1e')](_0x479535[_0x6dcc('0x1d')],function(_0x54606c){return{'model':db[_0x54606c[_0x6dcc('0x1c')]],'as':_0x54606c['as'],'attributes':_0x54606c[_0x6dcc('0x1a')],'include':_0x54606c[_0x6dcc('0x1d')]?_[_0x6dcc('0x1e')](_0x54606c[_0x6dcc('0x1d')],function(_0x8ed55c){return{'model':db[_0x8ed55c[_0x6dcc('0x1c')]],'as':_0x8ed55c['as'],'attributes':_0x8ed55c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dcc('0xb')](function(_0x3e60be){logger[_0x6dcc('0xc')]('GetCmHopper',_0x2e9ea0);logger[_0x6dcc('0xe')]('GetCmHopper',_0x2e9ea0,JSON[_0x6dcc('0xf')](_0x3e60be));_0x6010ea(_0x3e60be);})[_0x6dcc('0x1f')](function(_0x25b218){logger[_0x6dcc('0x10')]('GetCmHopper',_0x25b218['message'],_0x2e9ea0);_0x57eeec(_0x206597['error'](0x1f4,_0x25b218[_0x6dcc('0x13')]));});});};exports[_0x6dcc('0x20')]=function(_0x25b7f2){var _0x4e79ef=this;return new Promise(function(_0xb6ca8c,_0x45c3c4){return db['CmHopper'][_0x6dcc('0x21')]({'raw':_0x25b7f2[_0x6dcc('0x18')]?_0x25b7f2[_0x6dcc('0x18')][_0x6dcc('0x22')]===undefined?!![]:![]:!![],'where':_0x25b7f2[_0x6dcc('0x18')]?_0x25b7f2[_0x6dcc('0x18')][_0x6dcc('0x19')]||null:null,'attributes':_0x25b7f2['options']?_0x25b7f2[_0x6dcc('0x18')][_0x6dcc('0x1a')]||null:null,'include':_0x25b7f2[_0x6dcc('0x18')]?_0x25b7f2['options']['include']?_[_0x6dcc('0x1e')](_0x25b7f2[_0x6dcc('0x18')][_0x6dcc('0x1d')],function(_0x474b03){return{'model':db[_0x474b03[_0x6dcc('0x1c')]],'as':_0x474b03['as'],'attributes':_0x474b03[_0x6dcc('0x1a')],'include':_0x474b03[_0x6dcc('0x1d')]?_[_0x6dcc('0x1e')](_0x474b03[_0x6dcc('0x1d')],function(_0x524bb4){return{'model':db[_0x524bb4[_0x6dcc('0x1c')]],'as':_0x524bb4['as'],'attributes':_0x524bb4[_0x6dcc('0x1a')],'include':_0x524bb4[_0x6dcc('0x1d')]?_['map'](_0x524bb4['include'],function(_0x19184e){return{'model':db[_0x19184e[_0x6dcc('0x1c')]],'as':_0x19184e['as'],'attributes':_0x19184e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6dcc('0xb')](function(_0x3a0010){logger[_0x6dcc('0xc')]('ShowCmHopper',_0x25b7f2);logger['debug']('ShowCmHopper',_0x25b7f2,JSON[_0x6dcc('0xf')](_0x3a0010));_0xb6ca8c(_0x3a0010);})['catch'](function(_0x3026d8){logger['error'](_0x6dcc('0x20'),_0x3026d8[_0x6dcc('0x13')],_0x25b7f2);_0x45c3c4(_0x4e79ef[_0x6dcc('0x10')](0x1f4,_0x3026d8[_0x6dcc('0x13')]));});});};exports[_0x6dcc('0x23')]=function(_0x1edee3){var _0x5465d7=this;return new Promise(function(_0x234695,_0xfd6a8a){return db[_0x6dcc('0x16')][_0x6dcc('0x24')](_0x1edee3[_0x6dcc('0x25')],{'raw':_0x1edee3[_0x6dcc('0x18')]?_0x1edee3['options'][_0x6dcc('0x22')]===undefined?!![]:![]:!![]})[_0x6dcc('0xb')](function(_0x4124a6){logger['info'](_0x6dcc('0x23'),_0x1edee3);logger[_0x6dcc('0xe')](_0x6dcc('0x23'),_0x1edee3,JSON[_0x6dcc('0xf')](_0x4124a6));_0x234695(_0x4124a6);})[_0x6dcc('0x1f')](function(_0x1968f9){logger[_0x6dcc('0x10')](_0x6dcc('0x23'),_0x1968f9['message'],_0x1edee3);_0xfd6a8a(_0x5465d7['error'](0x1f4,_0x1968f9[_0x6dcc('0x13')]));});});};exports[_0x6dcc('0x26')]=function(_0x421a4e){var _0x4abbba=this;return new Promise(function(_0x27622d,_0x151139){return db['CmHopper'][_0x6dcc('0x27')](_0x421a4e[_0x6dcc('0x25')],{'raw':_0x421a4e['options']?_0x421a4e[_0x6dcc('0x18')][_0x6dcc('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x421a4e['options']?_0x421a4e[_0x6dcc('0x18')][_0x6dcc('0x19')]||null:null,'attributes':_0x421a4e[_0x6dcc('0x18')]?_0x421a4e[_0x6dcc('0x18')][_0x6dcc('0x1a')]||null:null,'limit':_0x421a4e[_0x6dcc('0x18')]?_0x421a4e[_0x6dcc('0x18')]['limit']||null:null})[_0x6dcc('0xb')](function(_0x474ac4){logger['info'](_0x6dcc('0x26'),_0x421a4e);logger[_0x6dcc('0xe')]('UpdateCmHopper',_0x421a4e,JSON['stringify'](_0x474ac4));_0x27622d(_0x474ac4);})['catch'](function(_0x208c7b){logger[_0x6dcc('0x10')](_0x6dcc('0x26'),_0x208c7b[_0x6dcc('0x13')],_0x421a4e);_0x151139(_0x4abbba[_0x6dcc('0x10')](0x1f4,_0x208c7b['message']));});});};exports['DestroyCmHopper']=function(_0x300f71){var _0x577451=this;return new Promise(function(_0x537580,_0x259e22){return db[_0x6dcc('0x16')][_0x6dcc('0x28')]({'where':_0x300f71[_0x6dcc('0x18')]?_0x300f71[_0x6dcc('0x18')]['where']||null:null})[_0x6dcc('0xb')](function(_0x3f51dc){logger[_0x6dcc('0xc')]('DestroyCmHopper',_0x300f71);logger[_0x6dcc('0xe')](_0x6dcc('0x29'),_0x300f71,JSON[_0x6dcc('0xf')](_0x3f51dc));_0x537580(_0x3f51dc);})[_0x6dcc('0x1f')](function(_0x364fa0){logger[_0x6dcc('0x10')](_0x6dcc('0x29'),_0x364fa0['message'],_0x300f71);_0x259e22(_0x577451['error'](0x1f4,_0x364fa0[_0x6dcc('0x13')]));});});};exports[_0x6dcc('0x2a')]=function(_0x46ad54){var _0x4b8fc1=this;return new Promise(function(_0x25b9a6,_0x34e25b){return db[_0x6dcc('0x2b')][_0x6dcc('0x2c')]()[_0x6dcc('0xb')](function(_0x528c9e){return db[_0x6dcc('0x2d')]['transaction'](function(_0x288ce7){return db[_0x6dcc('0x16')][_0x6dcc('0x17')]({'where':_0x46ad54[_0x6dcc('0x18')]?_0x46ad54[_0x6dcc('0x18')][_0x6dcc('0x19')]||null:null,'attributes':_0x46ad54['options']?_0x46ad54['options'][_0x6dcc('0x1a')]||null:null,'limit':_0x46ad54[_0x6dcc('0x18')]?_0x46ad54[_0x6dcc('0x18')]['limit']||null:null,'order':_0x46ad54['options']?_0x46ad54[_0x6dcc('0x18')][_0x6dcc('0x2e')]||null:null,'transaction':_0x288ce7,'lock':_0x288ce7['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x6dcc('0x2f'),'attributes':_[_0x6dcc('0x30')](_0x528c9e)},{'model':db[_0x6dcc('0x31')],'as':_0x6dcc('0x32'),'attributes':['id','name','voicePause']}]})[_0x6dcc('0xb')](function(_0x54bce6){var _0x30692b=[];var _0x1238b1=[];for(var _0x19c967=0x0;_0x19c967<_0x54bce6['length'];_0x19c967+=0x1){if(!_0x1238b1[_0x6dcc('0x33')](_0x54bce6[_0x19c967]['UserId'])){_0x1238b1[_0x6dcc('0x34')](_0x54bce6[_0x19c967][_0x6dcc('0x35')]);_0x30692b[_0x6dcc('0x34')](_0x54bce6[_0x19c967][_0x6dcc('0x27')](_0x46ad54[_0x6dcc('0x25')],{'transaction':_0x288ce7}));}}return BPromise[_0x6dcc('0x36')](_0x30692b);});})[_0x6dcc('0xb')](function(_0xcb3203){logger[_0x6dcc('0xc')]('GetContactDialer',_0x46ad54);logger['debug'](_0x6dcc('0x2a'),_0x46ad54,JSON[_0x6dcc('0xf')](_0xcb3203));_0x25b9a6(_0xcb3203);})['catch'](function(_0x351097){logger[_0x6dcc('0x10')]('GetContactDialer',_0x351097[_0x6dcc('0x13')],_0x46ad54);_0x34e25b(_0x4b8fc1[_0x6dcc('0x10')](0x1f4,_0x351097[_0x6dcc('0x13')]));});});});};exports[_0x6dcc('0x37')]=function(_0x12a68c){var _0x5d0fc0=this;return new Promise(function(_0x46f6d1,_0xc31c9e){return db[_0x6dcc('0x2d')]['transaction'](function(_0x30e540){return db[_0x6dcc('0x38')]['create'](_0x12a68c['body'],{'raw':_0x12a68c['options']?_0x12a68c[_0x6dcc('0x18')][_0x6dcc('0x22')]===undefined?!![]:![]:!![],'transaction':_0x30e540})[_0x6dcc('0xb')](function(){return db[_0x6dcc('0x16')]['destroy']({'where':_0x12a68c[_0x6dcc('0x18')]?_0x12a68c['options']['where']||null:null,'transaction':_0x30e540});});})[_0x6dcc('0xb')](function(_0x444a8d){logger[_0x6dcc('0xc')]('MoveContactManagedDialer',_0x12a68c);logger['debug'](_0x6dcc('0x37'),_0x12a68c,JSON['stringify'](_0x444a8d));_0x46f6d1(_0x444a8d);})[_0x6dcc('0x1f')](function(_0x230be6){logger[_0x6dcc('0x10')](_0x6dcc('0x37'),_0x230be6[_0x6dcc('0x13')],_0x12a68c);_0xc31c9e(_0x5d0fc0['error'](0x1f4,_0x230be6[_0x6dcc('0x13')]));});});};exports[_0x6dcc('0x39')]=function(_0x5aadd8){var _0x34187a=this;return new Promise(function(_0x48c354,_0x15ed6e){return db[_0x6dcc('0x16')][_0x6dcc('0x17')]({'raw':_0x5aadd8['options']?_0x5aadd8[_0x6dcc('0x18')][_0x6dcc('0x22')]===undefined?!![]:![]:!![],'where':_0x5aadd8[_0x6dcc('0x18')]?_0x5aadd8[_0x6dcc('0x18')][_0x6dcc('0x19')]||null:null,'attributes':[[db[_0x6dcc('0x2d')]['fn'](_0x6dcc('0x3a'),db['sequelize']['fn']('IF',db[_0x6dcc('0x2d')][_0x6dcc('0x3b')](_0x6dcc('0x3c')+util[_0x6dcc('0x3d')](_0x6dcc('0x3e'),moment()[_0x6dcc('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x6dcc('0x3f')))),_0x6dcc('0x40')]]})[_0x6dcc('0xb')](function(_0x21544c){logger[_0x6dcc('0xc')](_0x6dcc('0x39'),_0x5aadd8);logger['debug']('CountReScheduled',_0x5aadd8,JSON[_0x6dcc('0xf')](_0x21544c));_0x48c354(_0x21544c);})[_0x6dcc('0x1f')](function(_0x155d19){logger[_0x6dcc('0x10')]('CountReScheduled',_0x155d19[_0x6dcc('0x13')],_0x5aadd8);_0x15ed6e(_0x34187a[_0x6dcc('0x10')](0x1f4,_0x155d19[_0x6dcc('0x13')]));});});};exports[_0x6dcc('0x41')]=function(_0x4d7a3f){var _0x298474=this;return new Promise(function(_0x192a3a,_0x133060){return db[_0x6dcc('0x2b')][_0x6dcc('0x2c')]()[_0x6dcc('0xb')](function(_0x23ff19){return db['sequelize'][_0x6dcc('0x42')](function(_0x21a956){return db[_0x6dcc('0x16')][_0x6dcc('0x17')]({'where':_0x4d7a3f[_0x6dcc('0x18')]?_0x4d7a3f[_0x6dcc('0x18')][_0x6dcc('0x19')]||null:null,'attributes':_0x4d7a3f[_0x6dcc('0x18')]?_0x4d7a3f[_0x6dcc('0x18')][_0x6dcc('0x1a')]||null:null,'limit':0x1,'order':_0x4d7a3f['options']?_0x4d7a3f['options'][_0x6dcc('0x2e')]||null:null,'group':db['CmHopper'][_0x6dcc('0x35')],'transaction':_0x21a956,'lock':_0x21a956[_0x6dcc('0x43')]['UPDATE'],'include':_0x4d7a3f[_0x6dcc('0x18')]?_0x4d7a3f[_0x6dcc('0x18')][_0x6dcc('0x1d')]?_['map'](_0x4d7a3f['options']['include'],function(_0x5128a2){return{'model':db[_0x5128a2[_0x6dcc('0x1c')]],'as':_0x5128a2['as'],'attributes':_0x5128a2[_0x6dcc('0x1a')],'include':_0x5128a2[_0x6dcc('0x1d')]?_[_0x6dcc('0x1e')](_0x5128a2['include'],function(_0xf2e5f0){return{'model':db[_0xf2e5f0[_0x6dcc('0x1c')]],'as':_0xf2e5f0['as'],'attributes':_0xf2e5f0[_0x6dcc('0x1a')],'include':_0xf2e5f0[_0x6dcc('0x1d')]?_[_0x6dcc('0x1e')](_0xf2e5f0[_0x6dcc('0x1d')],function(_0x121cf7){return{'model':db[_0x121cf7[_0x6dcc('0x1c')]],'as':_0x121cf7['as'],'attributes':_0x121cf7[_0x6dcc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6dcc('0xb')](function(_0x47d7e1){var _0x198b82=[];for(var _0x27370a=0x0;_0x27370a<_0x47d7e1[_0x6dcc('0x44')];_0x27370a+=0x1){_0x198b82['push'](_0x47d7e1[_0x27370a][_0x6dcc('0x27')](_0x4d7a3f[_0x6dcc('0x25')],{'transaction':_0x21a956}));}return BPromise[_0x6dcc('0x36')](_0x198b82);});})['then'](function(_0xd3a80d){logger[_0x6dcc('0xc')](_0x6dcc('0x41'),_0x4d7a3f);logger[_0x6dcc('0xe')](_0x6dcc('0x41'),_0x4d7a3f,JSON[_0x6dcc('0xf')](_0xd3a80d));_0x192a3a(_0xd3a80d);})[_0x6dcc('0x1f')](function(_0x14a933){logger[_0x6dcc('0x10')]('GetContactRecallMe',_0x14a933[_0x6dcc('0x13')],_0x4d7a3f);_0x133060(_0x298474['error'](0x1f4,_0x14a933[_0x6dcc('0x13')]));});});});};exports[_0x6dcc('0x45')]=function(_0x137026){var _0x1827f5=this;return new Promise(function(_0x58287f,_0x144834){db['CmContact'][_0x6dcc('0x2c')]()[_0x6dcc('0xb')](function(_0x58183d){return db[_0x6dcc('0x16')][_0x6dcc('0x17')]({'raw':_0x137026[_0x6dcc('0x18')]?_0x137026[_0x6dcc('0x18')][_0x6dcc('0x22')]===undefined?!![]:![]:!![],'where':_0x137026[_0x6dcc('0x18')]?_0x137026[_0x6dcc('0x18')][_0x6dcc('0x19')]||null:null,'attributes':_0x137026['options']?_0x137026[_0x6dcc('0x18')]['attributes']||null:null,'limit':_0x137026[_0x6dcc('0x18')]?_0x137026[_0x6dcc('0x18')][_0x6dcc('0x1b')]||null:null,'include':_0x137026[_0x6dcc('0x18')]?_0x137026['options'][_0x6dcc('0x1d')]?_['map'](_0x137026[_0x6dcc('0x18')][_0x6dcc('0x1d')],function(_0x4f0276){return{'model':db[_0x4f0276[_0x6dcc('0x1c')]],'as':_0x4f0276['as'],'attributes':_0x4f0276['as']===_0x6dcc('0x2f')?_[_0x6dcc('0x30')](_0x58183d):_0x4f0276[_0x6dcc('0x1a')],'include':_0x4f0276[_0x6dcc('0x1d')]?_[_0x6dcc('0x1e')](_0x4f0276[_0x6dcc('0x1d')],function(_0x4d94cb){return{'model':db[_0x4d94cb[_0x6dcc('0x1c')]],'as':_0x4d94cb['as'],'attributes':_0x4d94cb[_0x6dcc('0x1a')],'include':_0x4d94cb[_0x6dcc('0x1d')]?_[_0x6dcc('0x1e')](_0x4d94cb[_0x6dcc('0x1d')],function(_0x539fbe){return{'model':db[_0x539fbe[_0x6dcc('0x1c')]],'as':_0x539fbe['as'],'attributes':_0x539fbe[_0x6dcc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3546cb){logger['info'](_0x6dcc('0x15'),_0x137026);logger[_0x6dcc('0xe')](_0x6dcc('0x15'),_0x137026,JSON['stringify'](_0x3546cb));_0x58287f(_0x3546cb);})[_0x6dcc('0x1f')](function(_0x3f37f0){logger['error']('GetCmHopper',_0x3f37f0[_0x6dcc('0x13')],_0x137026);_0x144834(_0x1827f5['error'](0x1f4,_0x3f37f0[_0x6dcc('0x13')]));});});});}; \ No newline at end of file +var _0xaaf2=['model','GetCmHopper','stringify','find','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','sequelize','transaction','UPDATE','CmContact','Contact','keys','User','Agent','name','length','includes','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','create','CountReScheduled','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','describe','order','GetContactRecallMe','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopper','findAll','options','raw','where','attributes','limit','include','map'];(function(_0xc2d396,_0x577d9a){var _0x572d2d=function(_0x2c552c){while(--_0x2c552c){_0xc2d396['push'](_0xc2d396['shift']());}};_0x572d2d(++_0x577d9a);}(_0xaaf2,0xb4));var _0x2aaf=function(_0x281ba3,_0x35f75b){_0x281ba3=_0x281ba3-0x0;var _0x51cf9c=_0xaaf2[_0x281ba3];return _0x51cf9c;};'use strict';var _=require(_0x2aaf('0x0'));var util=require(_0x2aaf('0x1'));var moment=require(_0x2aaf('0x2'));var BPromise=require(_0x2aaf('0x3'));var rs=require(_0x2aaf('0x4'));var fs=require('fs');var Redis=require(_0x2aaf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaf('0x6'));var logger=require(_0x2aaf('0x7'))(_0x2aaf('0x8'));var config=require(_0x2aaf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2aaf('0xa')][_0x2aaf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3657f8,_0x4edf2e,_0x4b3310){return new BPromise(function(_0x3d0cf0,_0x3dc474){return client[_0x2aaf('0xc')](_0x3657f8,_0x4b3310)[_0x2aaf('0xd')](function(_0x5e50e4){logger[_0x2aaf('0xe')](_0x2aaf('0xf'),_0x4edf2e,_0x2aaf('0x10'));logger[_0x2aaf('0x11')](_0x2aaf('0x12'),_0x4edf2e,_0x2aaf('0x10'),JSON['stringify'](_0x5e50e4));if(_0x5e50e4[_0x2aaf('0x13')]){if(_0x5e50e4[_0x2aaf('0x13')][_0x2aaf('0x14')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x4edf2e,_0x5e50e4[_0x2aaf('0x13')][_0x2aaf('0x15')]);return _0x3dc474(_0x5e50e4[_0x2aaf('0x13')][_0x2aaf('0x15')]);}logger[_0x2aaf('0x13')](_0x2aaf('0xf'),_0x4edf2e,_0x5e50e4['error'][_0x2aaf('0x15')]);return _0x3d0cf0(_0x5e50e4[_0x2aaf('0x13')]['message']);}else{logger[_0x2aaf('0xe')]('CmHopper,\x20%s,\x20%s',_0x4edf2e,_0x2aaf('0x10'));_0x3d0cf0(_0x5e50e4[_0x2aaf('0x16')][_0x2aaf('0x15')]);}})[_0x2aaf('0x17')](function(_0x5607f7){logger[_0x2aaf('0x13')](_0x2aaf('0xf'),_0x4edf2e,_0x5607f7);_0x3dc474(_0x5607f7);});});}exports['GetCmHopper']=function(_0x3e4fbf){var _0x2ba671=this;return new Promise(function(_0x1498e3,_0x260a8b){return db[_0x2aaf('0x18')][_0x2aaf('0x19')]({'raw':_0x3e4fbf[_0x2aaf('0x1a')]?_0x3e4fbf['options'][_0x2aaf('0x1b')]===undefined?!![]:![]:!![],'where':_0x3e4fbf['options']?_0x3e4fbf[_0x2aaf('0x1a')][_0x2aaf('0x1c')]||null:null,'attributes':_0x3e4fbf[_0x2aaf('0x1a')]?_0x3e4fbf[_0x2aaf('0x1a')][_0x2aaf('0x1d')]||null:null,'limit':_0x3e4fbf[_0x2aaf('0x1a')]?_0x3e4fbf[_0x2aaf('0x1a')][_0x2aaf('0x1e')]||null:null,'include':_0x3e4fbf[_0x2aaf('0x1a')]?_0x3e4fbf[_0x2aaf('0x1a')][_0x2aaf('0x1f')]?_[_0x2aaf('0x20')](_0x3e4fbf['options'][_0x2aaf('0x1f')],function(_0x135d45){return{'model':db[_0x135d45[_0x2aaf('0x21')]],'as':_0x135d45['as'],'attributes':_0x135d45[_0x2aaf('0x1d')],'include':_0x135d45[_0x2aaf('0x1f')]?_[_0x2aaf('0x20')](_0x135d45[_0x2aaf('0x1f')],function(_0x3b1239){return{'model':db[_0x3b1239[_0x2aaf('0x21')]],'as':_0x3b1239['as'],'attributes':_0x3b1239[_0x2aaf('0x1d')],'include':_0x3b1239[_0x2aaf('0x1f')]?_['map'](_0x3b1239[_0x2aaf('0x1f')],function(_0x2e7012){return{'model':db[_0x2e7012[_0x2aaf('0x21')]],'as':_0x2e7012['as'],'attributes':_0x2e7012[_0x2aaf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2aaf('0xd')](function(_0x30d623){logger[_0x2aaf('0xe')](_0x2aaf('0x22'),_0x3e4fbf);logger[_0x2aaf('0x11')]('GetCmHopper',_0x3e4fbf,JSON[_0x2aaf('0x23')](_0x30d623));_0x1498e3(_0x30d623);})[_0x2aaf('0x17')](function(_0xa7af0){logger[_0x2aaf('0x13')]('GetCmHopper',_0xa7af0[_0x2aaf('0x15')],_0x3e4fbf);_0x260a8b(_0x2ba671[_0x2aaf('0x13')](0x1f4,_0xa7af0[_0x2aaf('0x15')]));});});};exports['ShowCmHopper']=function(_0x1c7289){var _0x171a57=this;return new Promise(function(_0x48a74a,_0x5018a5){return db[_0x2aaf('0x18')][_0x2aaf('0x24')]({'raw':_0x1c7289[_0x2aaf('0x1a')]?_0x1c7289[_0x2aaf('0x1a')][_0x2aaf('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c7289[_0x2aaf('0x1a')]?_0x1c7289[_0x2aaf('0x1a')][_0x2aaf('0x1c')]||null:null,'attributes':_0x1c7289[_0x2aaf('0x1a')]?_0x1c7289[_0x2aaf('0x1a')][_0x2aaf('0x1d')]||null:null,'include':_0x1c7289[_0x2aaf('0x1a')]?_0x1c7289[_0x2aaf('0x1a')][_0x2aaf('0x1f')]?_[_0x2aaf('0x20')](_0x1c7289[_0x2aaf('0x1a')][_0x2aaf('0x1f')],function(_0x590e75){return{'model':db[_0x590e75[_0x2aaf('0x21')]],'as':_0x590e75['as'],'attributes':_0x590e75['attributes'],'include':_0x590e75[_0x2aaf('0x1f')]?_[_0x2aaf('0x20')](_0x590e75[_0x2aaf('0x1f')],function(_0xdefc93){return{'model':db[_0xdefc93[_0x2aaf('0x21')]],'as':_0xdefc93['as'],'attributes':_0xdefc93[_0x2aaf('0x1d')],'include':_0xdefc93[_0x2aaf('0x1f')]?_[_0x2aaf('0x20')](_0xdefc93[_0x2aaf('0x1f')],function(_0x4763c5){return{'model':db[_0x4763c5[_0x2aaf('0x21')]],'as':_0x4763c5['as'],'attributes':_0x4763c5[_0x2aaf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2aaf('0xd')](function(_0x1c2fdc){logger[_0x2aaf('0xe')](_0x2aaf('0x25'),_0x1c7289);logger[_0x2aaf('0x11')](_0x2aaf('0x25'),_0x1c7289,JSON[_0x2aaf('0x23')](_0x1c2fdc));_0x48a74a(_0x1c2fdc);})['catch'](function(_0x2cf75f){logger['error'](_0x2aaf('0x25'),_0x2cf75f['message'],_0x1c7289);_0x5018a5(_0x171a57[_0x2aaf('0x13')](0x1f4,_0x2cf75f[_0x2aaf('0x15')]));});});};exports[_0x2aaf('0x26')]=function(_0x5d35e6){var _0x58bb00=this;return new Promise(function(_0x5b9d58,_0x1547f1){return db[_0x2aaf('0x18')]['create'](_0x5d35e6[_0x2aaf('0x27')],{'raw':_0x5d35e6[_0x2aaf('0x1a')]?_0x5d35e6[_0x2aaf('0x1a')][_0x2aaf('0x1b')]===undefined?!![]:![]:!![]})[_0x2aaf('0xd')](function(_0x5c6e3f){logger[_0x2aaf('0xe')](_0x2aaf('0x26'),_0x5d35e6);logger['debug'](_0x2aaf('0x26'),_0x5d35e6,JSON[_0x2aaf('0x23')](_0x5c6e3f));_0x5b9d58(_0x5c6e3f);})[_0x2aaf('0x17')](function(_0x15e0eb){logger[_0x2aaf('0x13')](_0x2aaf('0x26'),_0x15e0eb[_0x2aaf('0x15')],_0x5d35e6);_0x1547f1(_0x58bb00[_0x2aaf('0x13')](0x1f4,_0x15e0eb[_0x2aaf('0x15')]));});});};exports[_0x2aaf('0x28')]=function(_0x546a14){var _0x500cce=this;return new Promise(function(_0x13e6c8,_0x2e85f4){return db[_0x2aaf('0x18')][_0x2aaf('0x29')](_0x546a14[_0x2aaf('0x27')],{'raw':_0x546a14['options']?_0x546a14[_0x2aaf('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x546a14[_0x2aaf('0x1a')]?_0x546a14[_0x2aaf('0x1a')][_0x2aaf('0x1c')]||null:null,'attributes':_0x546a14[_0x2aaf('0x1a')]?_0x546a14[_0x2aaf('0x1a')]['attributes']||null:null,'limit':_0x546a14[_0x2aaf('0x1a')]?_0x546a14[_0x2aaf('0x1a')]['limit']||null:null})[_0x2aaf('0xd')](function(_0xc5c414){logger[_0x2aaf('0xe')](_0x2aaf('0x28'),_0x546a14);logger[_0x2aaf('0x11')](_0x2aaf('0x28'),_0x546a14,JSON[_0x2aaf('0x23')](_0xc5c414));_0x13e6c8(_0xc5c414);})[_0x2aaf('0x17')](function(_0x99ddbd){logger[_0x2aaf('0x13')](_0x2aaf('0x28'),_0x99ddbd['message'],_0x546a14);_0x2e85f4(_0x500cce[_0x2aaf('0x13')](0x1f4,_0x99ddbd[_0x2aaf('0x15')]));});});};exports[_0x2aaf('0x2a')]=function(_0x4e413a){var _0x3023b7=this;return new Promise(function(_0x12bcf6,_0xf1fa74){return db[_0x2aaf('0x18')][_0x2aaf('0x2b')]({'where':_0x4e413a[_0x2aaf('0x1a')]?_0x4e413a[_0x2aaf('0x1a')][_0x2aaf('0x1c')]||null:null})[_0x2aaf('0xd')](function(_0x57869b){logger[_0x2aaf('0xe')]('DestroyCmHopper',_0x4e413a);logger[_0x2aaf('0x11')]('DestroyCmHopper',_0x4e413a,JSON[_0x2aaf('0x23')](_0x57869b));_0x12bcf6(_0x57869b);})[_0x2aaf('0x17')](function(_0x4ef59a){logger[_0x2aaf('0x13')](_0x2aaf('0x2a'),_0x4ef59a[_0x2aaf('0x15')],_0x4e413a);_0xf1fa74(_0x3023b7['error'](0x1f4,_0x4ef59a[_0x2aaf('0x15')]));});});};exports[_0x2aaf('0x2c')]=function(_0x59fb2e){var _0x5dcfde=this;return new Promise(function(_0xed56d1,_0x8fc115){return db['CmContact']['describe']()[_0x2aaf('0xd')](function(_0x56bc4d){return db[_0x2aaf('0x2d')][_0x2aaf('0x2e')](function(_0x278780){return db[_0x2aaf('0x18')][_0x2aaf('0x19')]({'where':_0x59fb2e[_0x2aaf('0x1a')]?_0x59fb2e[_0x2aaf('0x1a')][_0x2aaf('0x1c')]||null:null,'attributes':_0x59fb2e['options']?_0x59fb2e[_0x2aaf('0x1a')]['attributes']||null:null,'limit':_0x59fb2e['options']?_0x59fb2e['options'][_0x2aaf('0x1e')]||null:null,'order':_0x59fb2e[_0x2aaf('0x1a')]?_0x59fb2e['options']['order']||null:null,'transaction':_0x278780,'lock':_0x278780['LOCK'][_0x2aaf('0x2f')],'include':[{'model':db[_0x2aaf('0x30')],'as':_0x2aaf('0x31'),'attributes':_[_0x2aaf('0x32')](_0x56bc4d)},{'model':db[_0x2aaf('0x33')],'as':_0x2aaf('0x34'),'attributes':['id',_0x2aaf('0x35'),'voicePause']}]})[_0x2aaf('0xd')](function(_0x193430){var _0xda644e=[];var _0x11847a=[];for(var _0x27b5a9=0x0;_0x27b5a9<_0x193430[_0x2aaf('0x36')];_0x27b5a9+=0x1){if(!_0x11847a[_0x2aaf('0x37')](_0x193430[_0x27b5a9][_0x2aaf('0x38')])){_0x11847a[_0x2aaf('0x39')](_0x193430[_0x27b5a9][_0x2aaf('0x38')]);_0xda644e[_0x2aaf('0x39')](_0x193430[_0x27b5a9][_0x2aaf('0x29')](_0x59fb2e[_0x2aaf('0x27')],{'transaction':_0x278780}));}}return BPromise[_0x2aaf('0x3a')](_0xda644e);});})['then'](function(_0xf14241){logger[_0x2aaf('0xe')]('GetContactDialer',_0x59fb2e);logger[_0x2aaf('0x11')]('GetContactDialer',_0x59fb2e,JSON[_0x2aaf('0x23')](_0xf14241));_0xed56d1(_0xf14241);})['catch'](function(_0x535de6){logger[_0x2aaf('0x13')]('GetContactDialer',_0x535de6[_0x2aaf('0x15')],_0x59fb2e);_0x8fc115(_0x5dcfde['error'](0x1f4,_0x535de6['message']));});});});};exports[_0x2aaf('0x3b')]=function(_0x33d795){var _0x38b2c9=this;return new Promise(function(_0x21c90b,_0xd467f){return db[_0x2aaf('0x2d')]['transaction'](function(_0x4659a5){return db[_0x2aaf('0x3c')][_0x2aaf('0x3d')](_0x33d795['body'],{'raw':_0x33d795[_0x2aaf('0x1a')]?_0x33d795['options'][_0x2aaf('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x4659a5})[_0x2aaf('0xd')](function(){return db[_0x2aaf('0x18')][_0x2aaf('0x2b')]({'where':_0x33d795[_0x2aaf('0x1a')]?_0x33d795[_0x2aaf('0x1a')]['where']||null:null,'transaction':_0x4659a5});});})[_0x2aaf('0xd')](function(_0x68696e){logger['info'](_0x2aaf('0x3b'),_0x33d795);logger['debug'](_0x2aaf('0x3b'),_0x33d795,JSON[_0x2aaf('0x23')](_0x68696e));_0x21c90b(_0x68696e);})[_0x2aaf('0x17')](function(_0x4b0692){logger[_0x2aaf('0x13')]('MoveContactManagedDialer',_0x4b0692[_0x2aaf('0x15')],_0x33d795);_0xd467f(_0x38b2c9['error'](0x1f4,_0x4b0692[_0x2aaf('0x15')]));});});};exports[_0x2aaf('0x3e')]=function(_0x30c287){var _0x2af30c=this;return new Promise(function(_0x557fa9,_0x5bc98f){return db[_0x2aaf('0x18')]['findAll']({'raw':_0x30c287['options']?_0x30c287[_0x2aaf('0x1a')][_0x2aaf('0x1b')]===undefined?!![]:![]:!![],'where':_0x30c287[_0x2aaf('0x1a')]?_0x30c287[_0x2aaf('0x1a')][_0x2aaf('0x1c')]||null:null,'attributes':[[db[_0x2aaf('0x2d')]['fn']('COUNT',db[_0x2aaf('0x2d')]['fn']('IF',db[_0x2aaf('0x2d')]['literal'](_0x2aaf('0x3f')+util[_0x2aaf('0x40')]('\x22%s\x22',moment()[_0x2aaf('0x40')](_0x2aaf('0x41')))+_0x2aaf('0x42')))),_0x2aaf('0x43')]]})['then'](function(_0x429309){logger['info'](_0x2aaf('0x3e'),_0x30c287);logger[_0x2aaf('0x11')](_0x2aaf('0x3e'),_0x30c287,JSON[_0x2aaf('0x23')](_0x429309));_0x557fa9(_0x429309);})[_0x2aaf('0x17')](function(_0x54351b){logger[_0x2aaf('0x13')]('CountReScheduled',_0x54351b[_0x2aaf('0x15')],_0x30c287);_0x5bc98f(_0x2af30c[_0x2aaf('0x13')](0x1f4,_0x54351b[_0x2aaf('0x15')]));});});};exports['GetContactRecallMe']=function(_0x31eab0){var _0x2481d8=this;return new Promise(function(_0x4344ca,_0x3c2347){return db[_0x2aaf('0x30')][_0x2aaf('0x44')]()[_0x2aaf('0xd')](function(_0x46ec59){return db[_0x2aaf('0x2d')]['transaction'](function(_0x187421){return db['CmHopper'][_0x2aaf('0x19')]({'where':_0x31eab0[_0x2aaf('0x1a')]?_0x31eab0[_0x2aaf('0x1a')]['where']||null:null,'attributes':_0x31eab0[_0x2aaf('0x1a')]?_0x31eab0['options'][_0x2aaf('0x1d')]||null:null,'limit':0x1,'order':_0x31eab0[_0x2aaf('0x1a')]?_0x31eab0[_0x2aaf('0x1a')][_0x2aaf('0x45')]||null:null,'group':db[_0x2aaf('0x18')][_0x2aaf('0x38')],'transaction':_0x187421,'lock':_0x187421['LOCK'][_0x2aaf('0x2f')],'include':_0x31eab0[_0x2aaf('0x1a')]?_0x31eab0[_0x2aaf('0x1a')][_0x2aaf('0x1f')]?_[_0x2aaf('0x20')](_0x31eab0['options'][_0x2aaf('0x1f')],function(_0x7640c3){return{'model':db[_0x7640c3['model']],'as':_0x7640c3['as'],'attributes':_0x7640c3[_0x2aaf('0x1d')],'include':_0x7640c3['include']?_['map'](_0x7640c3[_0x2aaf('0x1f')],function(_0x4411da){return{'model':db[_0x4411da[_0x2aaf('0x21')]],'as':_0x4411da['as'],'attributes':_0x4411da['attributes'],'include':_0x4411da[_0x2aaf('0x1f')]?_['map'](_0x4411da[_0x2aaf('0x1f')],function(_0x585a76){return{'model':db[_0x585a76['model']],'as':_0x585a76['as'],'attributes':_0x585a76[_0x2aaf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2aaf('0xd')](function(_0x5c21b8){var _0x36c010=[];for(var _0x46bf05=0x0;_0x46bf05<_0x5c21b8['length'];_0x46bf05+=0x1){_0x36c010[_0x2aaf('0x39')](_0x5c21b8[_0x46bf05]['update'](_0x31eab0[_0x2aaf('0x27')],{'transaction':_0x187421}));}return BPromise[_0x2aaf('0x3a')](_0x36c010);});})[_0x2aaf('0xd')](function(_0x5eb13c){logger[_0x2aaf('0xe')](_0x2aaf('0x46'),_0x31eab0);logger[_0x2aaf('0x11')](_0x2aaf('0x46'),_0x31eab0,JSON['stringify'](_0x5eb13c));_0x4344ca(_0x5eb13c);})['catch'](function(_0x1bba24){logger['error'](_0x2aaf('0x46'),_0x1bba24[_0x2aaf('0x15')],_0x31eab0);_0x3c2347(_0x2481d8[_0x2aaf('0x13')](0x1f4,_0x1bba24[_0x2aaf('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x16fe96){var _0x9b9a6b=this;return new Promise(function(_0x4f2ae3,_0x14cd9b){db[_0x2aaf('0x30')][_0x2aaf('0x44')]()['then'](function(_0x20dcde){return db['CmHopper'][_0x2aaf('0x19')]({'raw':_0x16fe96[_0x2aaf('0x1a')]?_0x16fe96[_0x2aaf('0x1a')][_0x2aaf('0x1b')]===undefined?!![]:![]:!![],'where':_0x16fe96[_0x2aaf('0x1a')]?_0x16fe96[_0x2aaf('0x1a')][_0x2aaf('0x1c')]||null:null,'attributes':_0x16fe96[_0x2aaf('0x1a')]?_0x16fe96['options'][_0x2aaf('0x1d')]||null:null,'limit':_0x16fe96[_0x2aaf('0x1a')]?_0x16fe96[_0x2aaf('0x1a')][_0x2aaf('0x1e')]||null:null,'include':_0x16fe96[_0x2aaf('0x1a')]?_0x16fe96[_0x2aaf('0x1a')][_0x2aaf('0x1f')]?_[_0x2aaf('0x20')](_0x16fe96[_0x2aaf('0x1a')]['include'],function(_0x43a493){return{'model':db[_0x43a493[_0x2aaf('0x21')]],'as':_0x43a493['as'],'attributes':_0x43a493['as']===_0x2aaf('0x31')?_[_0x2aaf('0x32')](_0x20dcde):_0x43a493[_0x2aaf('0x1d')],'include':_0x43a493['include']?_[_0x2aaf('0x20')](_0x43a493[_0x2aaf('0x1f')],function(_0x91fc4f){return{'model':db[_0x91fc4f[_0x2aaf('0x21')]],'as':_0x91fc4f['as'],'attributes':_0x91fc4f[_0x2aaf('0x1d')],'include':_0x91fc4f[_0x2aaf('0x1f')]?_[_0x2aaf('0x20')](_0x91fc4f[_0x2aaf('0x1f')],function(_0x4df2b0){return{'model':db[_0x4df2b0['model']],'as':_0x4df2b0['as'],'attributes':_0x4df2b0[_0x2aaf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2aaf('0xd')](function(_0x1db183){logger[_0x2aaf('0xe')](_0x2aaf('0x22'),_0x16fe96);logger[_0x2aaf('0x11')](_0x2aaf('0x22'),_0x16fe96,JSON[_0x2aaf('0x23')](_0x1db183));_0x4f2ae3(_0x1db183);})['catch'](function(_0x484d49){logger[_0x2aaf('0x13')](_0x2aaf('0x22'),_0x484d49[_0x2aaf('0x15')],_0x16fe96);_0x14cd9b(_0x9b9a6b[_0x2aaf('0x13')](0x1f4,_0x484d49[_0x2aaf('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 3c9fa2b..cb4dc6f 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 _0x8276=['/:id','show','post','/preview','update','delete','destroy','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts'];(function(_0x3cbbda,_0x3dcd88){var _0x533467=function(_0x12ba8e){while(--_0x12ba8e){_0x3cbbda['push'](_0x3cbbda['shift']());}};_0x533467(++_0x3dcd88);}(_0x8276,0xa7));var _0x6827=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8276[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x6827('0x0'));var util=require(_0x6827('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6827('0x2'));var router=express[_0x6827('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6827('0x4'));var config=require(_0x6827('0x5'));var controller=require('./cmHopper.controller');router[_0x6827('0x6')]('/',auth[_0x6827('0x7')](),controller[_0x6827('0x8')]);router[_0x6827('0x6')](_0x6827('0x9'),auth[_0x6827('0x7')](),controller[_0x6827('0xa')]);router[_0x6827('0x6')](_0x6827('0xb'),auth['isAuthenticated'](),controller[_0x6827('0xc')]);router[_0x6827('0x6')](_0x6827('0xd'),auth['isAuthenticated'](),controller[_0x6827('0xe')]);router[_0x6827('0xf')]('/',auth[_0x6827('0x7')](),controller['create']);router[_0x6827('0xf')](_0x6827('0x10'),auth[_0x6827('0x7')](),controller['getPreview']);router['put']('/:id',auth[_0x6827('0x7')](),controller[_0x6827('0x11')]);router[_0x6827('0x12')]('/:id',auth[_0x6827('0x7')](),controller[_0x6827('0x13')]);module['exports']=router; \ No newline at end of file +var _0x8357=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','getOpenContacts','/:id','show','post','create','/preview','put','update','delete','destroy','exports'];(function(_0x3d91dd,_0x33b1e2){var _0x3cd59a=function(_0x51d1d4){while(--_0x51d1d4){_0x3d91dd['push'](_0x3d91dd['shift']());}};_0x3cd59a(++_0x33b1e2);}(_0x8357,0x1e4));var _0x7835=function(_0x3fa6b9,_0xda4953){_0x3fa6b9=_0x3fa6b9-0x0;var _0x532cf3=_0x8357[_0x3fa6b9];return _0x532cf3;};'use strict';var multer=require(_0x7835('0x0'));var util=require(_0x7835('0x1'));var path=require(_0x7835('0x2'));var timeout=require('connect-timeout');var express=require(_0x7835('0x3'));var router=express[_0x7835('0x4')]();var auth=require(_0x7835('0x5'));var interaction=require(_0x7835('0x6'));var config=require(_0x7835('0x7'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0x7835('0x8')](),controller['index']);router[_0x7835('0x9')](_0x7835('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7835('0x9')]('/opencontacts',auth[_0x7835('0x8')](),controller[_0x7835('0xb')]);router[_0x7835('0x9')](_0x7835('0xc'),auth['isAuthenticated'](),controller[_0x7835('0xd')]);router[_0x7835('0xe')]('/',auth[_0x7835('0x8')](),controller[_0x7835('0xf')]);router[_0x7835('0xe')](_0x7835('0x10'),auth[_0x7835('0x8')](),controller['getPreview']);router[_0x7835('0x11')](_0x7835('0xc'),auth[_0x7835('0x8')](),controller[_0x7835('0x12')]);router[_0x7835('0x13')](_0x7835('0xc'),auth[_0x7835('0x8')](),controller[_0x7835('0x14')]);module[_0x7835('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 724cc50..e37dae3 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 _0xaa9e=['INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x19691f,_0x159737){var _0x5677b6=function(_0x41a9b2){while(--_0x41a9b2){_0x19691f['push'](_0x19691f['shift']());}};_0x5677b6(++_0x159737);}(_0xaa9e,0x160));var _0xeaa9=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0xaa9e[_0x4e8286];return _0x44a440;};'use strict';var moment=require(_0xeaa9('0x0'));var Sequelize=require(_0xeaa9('0x1'));module[_0xeaa9('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xeaa9('0x3')],'unique':_0xeaa9('0x4')},'ListId':{'type':Sequelize[_0xeaa9('0x3')],'unique':_0xeaa9('0x4')},'VoiceQueueId':{'type':Sequelize[_0xeaa9('0x3')],'unique':_0xeaa9('0x4')}}; \ No newline at end of file +var _0x72c2=['sequelize','INTEGER','contactListQueue'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x72c2,0x12f));var _0x272c=function(_0x44c1f9,_0x3df18a){_0x44c1f9=_0x44c1f9-0x0;var _0x1bf8ba=_0x72c2[_0x44c1f9];return _0x1bf8ba;};'use strict';var moment=require('moment');var Sequelize=require(_0x272c('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x272c('0x1')],'unique':_0x272c('0x2')},'ListId':{'type':Sequelize[_0x272c('0x1')],'unique':_0x272c('0x2')},'VoiceQueueId':{'type':Sequelize[_0x272c('0x1')],'unique':_0x272c('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a51415d..91c1974 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 _0x88fa=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','CmHopperBlack','includeAll','include','findAll','rows','catch','show','params','find','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','filters','query','attributes','intersection','fields','length'];(function(_0x481b4b,_0x538161){var _0x351858=function(_0x2f7f3a){while(--_0x2f7f3a){_0x481b4b['push'](_0x481b4b['shift']());}};_0x351858(++_0x538161);}(_0x88fa,0x193));var _0xa88f=function(_0x755c96,_0x3c3d43){_0x755c96=_0x755c96-0x0;var _0x1e5cea=_0x88fa[_0x755c96];return _0x1e5cea;};'use strict';var pdf=require(_0xa88f('0x0'));var emlformat=require(_0xa88f('0x1'));var rimraf=require(_0xa88f('0x2'));var zipdir=require(_0xa88f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa88f('0x4'));var moment=require('moment');var BPromise=require(_0xa88f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa88f('0x6'));var sox=require(_0xa88f('0x7'));var csv=require(_0xa88f('0x8'));var ejs=require(_0xa88f('0x9'));var fs=require('fs');var _=require(_0xa88f('0xa'));var squel=require(_0xa88f('0xb'));var crypto=require(_0xa88f('0xc'));var jsforce=require(_0xa88f('0xd'));var deskjs=require(_0xa88f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa88f('0xf'));var Redis=require('ioredis');var authService=require(_0xa88f('0x10'));var qs=require(_0xa88f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa88f('0x12'));var logger=require(_0xa88f('0x13'))('api');var utils=require(_0xa88f('0x14'));var config=require(_0xa88f('0x15'));var licenseUtil=require(_0xa88f('0x16'));var db=require(_0xa88f('0x17'))['db'];function respondWithStatusCode(_0x550504,_0x2a5219){_0x2a5219=_0x2a5219||0xcc;return function(_0x558a65){if(_0x558a65){return _0x550504[_0xa88f('0x18')](_0x2a5219);}return _0x550504[_0xa88f('0x19')](_0x2a5219)[_0xa88f('0x1a')]();};}function respondWithResult(_0x17e2b2,_0x505968){_0x505968=_0x505968||0xc8;return function(_0x52921b){if(_0x52921b){return _0x17e2b2[_0xa88f('0x19')](_0x505968)[_0xa88f('0x1b')](_0x52921b);}};}function respondWithFilteredResult(_0x34558d,_0x4a6a4d){return function(_0x228073){if(_0x228073){var _0x201631=_0x228073[_0xa88f('0x1c')],_0x1a6825=_0x4a6a4d[_0xa88f('0x1d')],_0x14e651=_0x4a6a4d[_0xa88f('0x1d')]+_0x4a6a4d['limit'],_0x21d020;if(_0x14e651>=_0x201631){_0x14e651=_0x201631;_0x21d020=0xc8;}else{_0x21d020=0xce;}_0x34558d[_0xa88f('0x19')](_0x21d020);return _0x34558d[_0xa88f('0x1e')](_0xa88f('0x1f'),_0x1a6825+'-'+_0x14e651+'/'+_0x201631)[_0xa88f('0x1b')](_0x228073);}return null;};}function patchUpdates(_0x2b1d1e){return function(_0x391268){try{jsonpatch[_0xa88f('0x20')](_0x391268,_0x2b1d1e,!![]);}catch(_0x518fb5){return BPromise[_0xa88f('0x21')](_0x518fb5);}return _0x391268[_0xa88f('0x22')]();};}function saveUpdates(_0xc3233f,_0x3773c3){return function(_0xcc8a6d){if(_0xcc8a6d){return _0xcc8a6d[_0xa88f('0x23')](_0xc3233f)[_0xa88f('0x24')](function(_0x265815){return _0x265815;});}return null;};}function removeEntity(_0x1a7a11,_0x3a2e71){return function(_0x10556c){if(_0x10556c){return _0x10556c['destroy']()[_0xa88f('0x24')](function(){_0x1a7a11['status'](0xcc)[_0xa88f('0x1a')]();});}};}function handleEntityNotFound(_0x202b8d,_0x594a5c){return function(_0x144b1e){if(!_0x144b1e){_0x202b8d[_0xa88f('0x18')](0x194);}return _0x144b1e;};}function handleError(_0xe09b29,_0x56f2fe){_0x56f2fe=_0x56f2fe||0x1f4;return function(_0x3f3aca){logger[_0xa88f('0x25')](_0x3f3aca[_0xa88f('0x26')]);if(_0x3f3aca[_0xa88f('0x27')]){delete _0x3f3aca['name'];}_0xe09b29[_0xa88f('0x19')](_0x56f2fe)[_0xa88f('0x28')](_0x3f3aca);};}exports['index']=function(_0xeddc13,_0x827e87){var _0x36df7a={},_0x5eaf30={},_0x3623f2={'count':0x0,'rows':[]};var _0x325fff=_[_0xa88f('0x29')](db['CmHopperBlack'][_0xa88f('0x2a')],function(_0x1796ca){return{'name':_0x1796ca[_0xa88f('0x2b')],'type':_0x1796ca['type'][_0xa88f('0x2c')]};});_0x5eaf30[_0xa88f('0x2d')]=_[_0xa88f('0x29')](_0x325fff,_0xa88f('0x27'));_0x5eaf30['query']=_[_0xa88f('0x2e')](_0xeddc13['query']);_0x5eaf30[_0xa88f('0x2f')]=_['intersection'](_0x5eaf30[_0xa88f('0x2d')],_0x5eaf30[_0xa88f('0x30')]);_0x36df7a[_0xa88f('0x31')]=_[_0xa88f('0x32')](_0x5eaf30[_0xa88f('0x2d')],qs[_0xa88f('0x33')](_0xeddc13[_0xa88f('0x30')][_0xa88f('0x33')]));_0x36df7a[_0xa88f('0x31')]=_0x36df7a[_0xa88f('0x31')][_0xa88f('0x34')]?_0x36df7a[_0xa88f('0x31')]:_0x5eaf30[_0xa88f('0x2d')];if(!_0xeddc13[_0xa88f('0x30')][_0xa88f('0x35')](_0xa88f('0x36'))){_0x36df7a[_0xa88f('0x37')]=qs[_0xa88f('0x37')](_0xeddc13[_0xa88f('0x30')][_0xa88f('0x37')]);_0x36df7a['offset']=qs[_0xa88f('0x1d')](_0xeddc13['query'][_0xa88f('0x1d')]);}_0x36df7a[_0xa88f('0x38')]=qs['sort'](_0xeddc13[_0xa88f('0x30')][_0xa88f('0x39')]);_0x36df7a[_0xa88f('0x3a')]=qs[_0xa88f('0x2f')](_[_0xa88f('0x3b')](_0xeddc13['query'],_0x5eaf30[_0xa88f('0x2f')]),_0x325fff);if(_0xeddc13[_0xa88f('0x30')][_0xa88f('0x3c')]){_0x36df7a[_0xa88f('0x3a')]=_[_0xa88f('0x3d')](_0x36df7a[_0xa88f('0x3a')],{'$or':_[_0xa88f('0x29')](_0x325fff,function(_0x4ca22e){if(_0x4ca22e[_0xa88f('0x3e')]!=='VIRTUAL'){var _0x2b8598={};_0x2b8598[_0x4ca22e[_0xa88f('0x27')]]={'$like':'%'+_0xeddc13[_0xa88f('0x30')][_0xa88f('0x3c')]+'%'};return _0x2b8598;}})});}_0x36df7a=_[_0xa88f('0x3d')]({},_0x36df7a,_0xeddc13[_0xa88f('0x3f')]);var _0x2192b2={'where':_0x36df7a[_0xa88f('0x3a')]};return db[_0xa88f('0x40')]['count'](_0x2192b2)[_0xa88f('0x24')](function(_0x47905e){_0x3623f2[_0xa88f('0x1c')]=_0x47905e;if(_0xeddc13['query'][_0xa88f('0x41')]){_0x36df7a[_0xa88f('0x42')]=[{'all':!![]}];}return db[_0xa88f('0x40')][_0xa88f('0x43')](_0x36df7a);})['then'](function(_0x16ca39){_0x3623f2[_0xa88f('0x44')]=_0x16ca39;return _0x3623f2;})['then'](respondWithFilteredResult(_0x827e87,_0x36df7a))[_0xa88f('0x45')](handleError(_0x827e87,null));};exports[_0xa88f('0x46')]=function(_0x2512d9,_0x5872d2){var _0x31211c={'raw':!![],'where':{'id':_0x2512d9[_0xa88f('0x47')]['id']}},_0x1edc84={};_0x1edc84[_0xa88f('0x2d')]=_['keys'](db['CmHopperBlack'][_0xa88f('0x2a')]);_0x1edc84[_0xa88f('0x30')]=_[_0xa88f('0x2e')](_0x2512d9[_0xa88f('0x30')]);_0x1edc84[_0xa88f('0x2f')]=_[_0xa88f('0x32')](_0x1edc84[_0xa88f('0x2d')],_0x1edc84[_0xa88f('0x30')]);_0x31211c[_0xa88f('0x31')]=_[_0xa88f('0x32')](_0x1edc84[_0xa88f('0x2d')],qs[_0xa88f('0x33')](_0x2512d9[_0xa88f('0x30')]['fields']));_0x31211c[_0xa88f('0x31')]=_0x31211c[_0xa88f('0x31')][_0xa88f('0x34')]?_0x31211c[_0xa88f('0x31')]:_0x1edc84[_0xa88f('0x2d')];if(_0x2512d9['query'][_0xa88f('0x41')]){_0x31211c[_0xa88f('0x42')]=[{'all':!![]}];}_0x31211c=_[_0xa88f('0x3d')]({},_0x31211c,_0x2512d9[_0xa88f('0x3f')]);return db[_0xa88f('0x40')][_0xa88f('0x48')](_0x31211c)['then'](handleEntityNotFound(_0x5872d2,null))[_0xa88f('0x24')](respondWithResult(_0x5872d2,null))[_0xa88f('0x45')](handleError(_0x5872d2,null));};exports['update']=function(_0x237fdf,_0x77f961){if(_0x237fdf[_0xa88f('0x49')]['id']){delete _0x237fdf[_0xa88f('0x49')]['id'];}return db[_0xa88f('0x40')][_0xa88f('0x48')]({'where':{'id':_0x237fdf['params']['id']}})[_0xa88f('0x24')](handleEntityNotFound(_0x77f961,null))[_0xa88f('0x24')](saveUpdates(_0x237fdf[_0xa88f('0x49')],null))[_0xa88f('0x24')](respondWithResult(_0x77f961,null))[_0xa88f('0x45')](handleError(_0x77f961,null));};exports[_0xa88f('0x4a')]=function(_0x463f23,_0x3600a8){return db[_0xa88f('0x40')][_0xa88f('0x48')]({'where':{'id':_0x463f23[_0xa88f('0x47')]['id']}})[_0xa88f('0x24')](handleEntityNotFound(_0x3600a8,null))['then'](removeEntity(_0x3600a8,null))[_0xa88f('0x45')](handleError(_0x3600a8,null));};exports[_0xa88f('0x4b')]=function(_0x329cfc,_0x463bb2){return db['CmHopperBlack'][_0xa88f('0x4b')]()[_0xa88f('0x24')](respondWithResult(_0x463bb2,null))['catch'](handleError(_0x463bb2,null));}; \ No newline at end of file +var _0xe9a2=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','then','includeAll','include','rows','params','keys','intersection','length','options','body','find','destroy','catch','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','apply','save','update','end','stack','name','CmHopperBlack','fieldName','type','key','model','map','query','filters','attributes','fields'];(function(_0x6866ff,_0x2abc68){var _0x383ed1=function(_0x552908){while(--_0x552908){_0x6866ff['push'](_0x6866ff['shift']());}};_0x383ed1(++_0x2abc68);}(_0xe9a2,0x9c));var _0x2e9a=function(_0x2b867c,_0x17aa2b){_0x2b867c=_0x2b867c-0x0;var _0x563686=_0xe9a2[_0x2b867c];return _0x563686;};'use strict';var pdf=require(_0x2e9a('0x0'));var emlformat=require(_0x2e9a('0x1'));var rimraf=require(_0x2e9a('0x2'));var zipdir=require(_0x2e9a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2e9a('0x4'));var BPromise=require(_0x2e9a('0x5'));var Mustache=require(_0x2e9a('0x6'));var util=require(_0x2e9a('0x7'));var path=require(_0x2e9a('0x8'));var sox=require(_0x2e9a('0x9'));var csv=require(_0x2e9a('0xa'));var ejs=require(_0x2e9a('0xb'));var fs=require('fs');var _=require(_0x2e9a('0xc'));var squel=require(_0x2e9a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2e9a('0xe'));var toCsv=require(_0x2e9a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2e9a('0xf'));var authService=require(_0x2e9a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2e9a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e9a('0x12'))(_0x2e9a('0x13'));var utils=require(_0x2e9a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2e9a('0x15'));var db=require(_0x2e9a('0x16'))['db'];function respondWithStatusCode(_0x46a4d9,_0x3cda54){_0x3cda54=_0x3cda54||0xcc;return function(_0x3d6b53){if(_0x3d6b53){return _0x46a4d9[_0x2e9a('0x17')](_0x3cda54);}return _0x46a4d9[_0x2e9a('0x18')](_0x3cda54)['end']();};}function respondWithResult(_0x52f7f4,_0x339922){_0x339922=_0x339922||0xc8;return function(_0xd04ead){if(_0xd04ead){return _0x52f7f4[_0x2e9a('0x18')](_0x339922)[_0x2e9a('0x19')](_0xd04ead);}};}function respondWithFilteredResult(_0x3a8cb0,_0x3dda7b){return function(_0x364085){if(_0x364085){var _0x251912=_0x364085['count'],_0x44a6d7=_0x3dda7b[_0x2e9a('0x1a')],_0x1000a7=_0x3dda7b[_0x2e9a('0x1a')]+_0x3dda7b[_0x2e9a('0x1b')],_0x147aad;if(_0x1000a7>=_0x251912){_0x1000a7=_0x251912;_0x147aad=0xc8;}else{_0x147aad=0xce;}_0x3a8cb0['status'](_0x147aad);return _0x3a8cb0[_0x2e9a('0x1c')]('Content-Range',_0x44a6d7+'-'+_0x1000a7+'/'+_0x251912)['json'](_0x364085);}return null;};}function patchUpdates(_0x8dc94){return function(_0x16241a){try{jsonpatch[_0x2e9a('0x1d')](_0x16241a,_0x8dc94,!![]);}catch(_0x4ec0ad){return BPromise['reject'](_0x4ec0ad);}return _0x16241a[_0x2e9a('0x1e')]();};}function saveUpdates(_0x1244c1,_0x2b0f0c){return function(_0x5ccff7){if(_0x5ccff7){return _0x5ccff7[_0x2e9a('0x1f')](_0x1244c1)['then'](function(_0x476071){return _0x476071;});}return null;};}function removeEntity(_0x4aa3c9,_0x5af951){return function(_0x3890c0){if(_0x3890c0){return _0x3890c0['destroy']()['then'](function(){_0x4aa3c9[_0x2e9a('0x18')](0xcc)[_0x2e9a('0x20')]();});}};}function handleEntityNotFound(_0x2a9d7c,_0x27f8c6){return function(_0x1518fb){if(!_0x1518fb){_0x2a9d7c[_0x2e9a('0x17')](0x194);}return _0x1518fb;};}function handleError(_0x1779f7,_0x58baf4){_0x58baf4=_0x58baf4||0x1f4;return function(_0x5358f1){logger['error'](_0x5358f1[_0x2e9a('0x21')]);if(_0x5358f1[_0x2e9a('0x22')]){delete _0x5358f1[_0x2e9a('0x22')];}_0x1779f7['status'](_0x58baf4)['send'](_0x5358f1);};}exports['index']=function(_0x205683,_0x14e705){var _0x28c2e4={},_0x339ab5={},_0x3a7fbf={'count':0x0,'rows':[]};var _0x26d3c4=_['map'](db[_0x2e9a('0x23')]['rawAttributes'],function(_0x1a5079){return{'name':_0x1a5079[_0x2e9a('0x24')],'type':_0x1a5079[_0x2e9a('0x25')][_0x2e9a('0x26')]};});_0x339ab5[_0x2e9a('0x27')]=_[_0x2e9a('0x28')](_0x26d3c4,_0x2e9a('0x22'));_0x339ab5['query']=_['keys'](_0x205683[_0x2e9a('0x29')]);_0x339ab5[_0x2e9a('0x2a')]=_['intersection'](_0x339ab5[_0x2e9a('0x27')],_0x339ab5[_0x2e9a('0x29')]);_0x28c2e4[_0x2e9a('0x2b')]=_['intersection'](_0x339ab5[_0x2e9a('0x27')],qs[_0x2e9a('0x2c')](_0x205683[_0x2e9a('0x29')][_0x2e9a('0x2c')]));_0x28c2e4[_0x2e9a('0x2b')]=_0x28c2e4[_0x2e9a('0x2b')]['length']?_0x28c2e4[_0x2e9a('0x2b')]:_0x339ab5[_0x2e9a('0x27')];if(!_0x205683['query'][_0x2e9a('0x2d')](_0x2e9a('0x2e'))){_0x28c2e4['limit']=qs[_0x2e9a('0x1b')](_0x205683[_0x2e9a('0x29')][_0x2e9a('0x1b')]);_0x28c2e4['offset']=qs[_0x2e9a('0x1a')](_0x205683[_0x2e9a('0x29')]['offset']);}_0x28c2e4[_0x2e9a('0x2f')]=qs[_0x2e9a('0x30')](_0x205683['query'][_0x2e9a('0x30')]);_0x28c2e4[_0x2e9a('0x31')]=qs[_0x2e9a('0x2a')](_['pick'](_0x205683['query'],_0x339ab5[_0x2e9a('0x2a')]),_0x26d3c4);if(_0x205683[_0x2e9a('0x29')][_0x2e9a('0x32')]){_0x28c2e4[_0x2e9a('0x31')]=_[_0x2e9a('0x33')](_0x28c2e4[_0x2e9a('0x31')],{'$or':_['map'](_0x26d3c4,function(_0x177151){if(_0x177151[_0x2e9a('0x25')]!==_0x2e9a('0x34')){var _0x991683={};_0x991683[_0x177151[_0x2e9a('0x22')]]={'$like':'%'+_0x205683[_0x2e9a('0x29')]['filter']+'%'};return _0x991683;}})});}_0x28c2e4=_[_0x2e9a('0x33')]({},_0x28c2e4,_0x205683['options']);var _0xe39834={'where':_0x28c2e4[_0x2e9a('0x31')]};return db[_0x2e9a('0x23')][_0x2e9a('0x35')](_0xe39834)[_0x2e9a('0x36')](function(_0xc797d6){_0x3a7fbf[_0x2e9a('0x35')]=_0xc797d6;if(_0x205683[_0x2e9a('0x29')][_0x2e9a('0x37')]){_0x28c2e4[_0x2e9a('0x38')]=[{'all':!![]}];}return db[_0x2e9a('0x23')]['findAll'](_0x28c2e4);})[_0x2e9a('0x36')](function(_0x22f4de){_0x3a7fbf[_0x2e9a('0x39')]=_0x22f4de;return _0x3a7fbf;})[_0x2e9a('0x36')](respondWithFilteredResult(_0x14e705,_0x28c2e4))['catch'](handleError(_0x14e705,null));};exports['show']=function(_0x4ac499,_0x47c5c2){var _0x1d157a={'raw':!![],'where':{'id':_0x4ac499[_0x2e9a('0x3a')]['id']}},_0x21e255={};_0x21e255[_0x2e9a('0x27')]=_[_0x2e9a('0x3b')](db[_0x2e9a('0x23')]['rawAttributes']);_0x21e255['query']=_[_0x2e9a('0x3b')](_0x4ac499[_0x2e9a('0x29')]);_0x21e255[_0x2e9a('0x2a')]=_[_0x2e9a('0x3c')](_0x21e255[_0x2e9a('0x27')],_0x21e255['query']);_0x1d157a['attributes']=_['intersection'](_0x21e255[_0x2e9a('0x27')],qs[_0x2e9a('0x2c')](_0x4ac499['query'][_0x2e9a('0x2c')]));_0x1d157a[_0x2e9a('0x2b')]=_0x1d157a[_0x2e9a('0x2b')][_0x2e9a('0x3d')]?_0x1d157a[_0x2e9a('0x2b')]:_0x21e255[_0x2e9a('0x27')];if(_0x4ac499[_0x2e9a('0x29')][_0x2e9a('0x37')]){_0x1d157a['include']=[{'all':!![]}];}_0x1d157a=_[_0x2e9a('0x33')]({},_0x1d157a,_0x4ac499[_0x2e9a('0x3e')]);return db[_0x2e9a('0x23')]['find'](_0x1d157a)['then'](handleEntityNotFound(_0x47c5c2,null))[_0x2e9a('0x36')](respondWithResult(_0x47c5c2,null))['catch'](handleError(_0x47c5c2,null));};exports[_0x2e9a('0x1f')]=function(_0x1a2742,_0x37974d){if(_0x1a2742[_0x2e9a('0x3f')]['id']){delete _0x1a2742['body']['id'];}return db[_0x2e9a('0x23')][_0x2e9a('0x40')]({'where':{'id':_0x1a2742['params']['id']}})[_0x2e9a('0x36')](handleEntityNotFound(_0x37974d,null))[_0x2e9a('0x36')](saveUpdates(_0x1a2742[_0x2e9a('0x3f')],null))[_0x2e9a('0x36')](respondWithResult(_0x37974d,null))['catch'](handleError(_0x37974d,null));};exports[_0x2e9a('0x41')]=function(_0x5e1b1d,_0x5efef0){return db[_0x2e9a('0x23')][_0x2e9a('0x40')]({'where':{'id':_0x5e1b1d[_0x2e9a('0x3a')]['id']}})[_0x2e9a('0x36')](handleEntityNotFound(_0x5efef0,null))[_0x2e9a('0x36')](removeEntity(_0x5efef0,null))[_0x2e9a('0x42')](handleError(_0x5efef0,null));};exports['describe']=function(_0x3dd6bb,_0x47d095){return db[_0x2e9a('0x23')]['describe']()[_0x2e9a('0x36')](respondWithResult(_0x47d095,null))[_0x2e9a('0x42')](handleError(_0x47d095,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 318b18c..16cc01d 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 _0xe2f0=['path','rimraf','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','request-promise'];(function(_0x274247,_0x32b42d){var _0x48accf=function(_0x51f4cb){while(--_0x51f4cb){_0x274247['push'](_0x274247['shift']());}};_0x48accf(++_0x32b42d);}(_0xe2f0,0x109));var _0x0e2f=function(_0x588791,_0x35a42e){_0x588791=_0x588791-0x0;var _0x28937a=_0xe2f0[_0x588791];return _0x28937a;};'use strict';var _=require(_0x0e2f('0x0'));var util=require(_0x0e2f('0x1'));var logger=require('../../config/logger')(_0x0e2f('0x2'));var moment=require(_0x0e2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e2f('0x4'));var fs=require('fs');var path=require(_0x0e2f('0x5'));var rimraf=require(_0x0e2f('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0x2c76d1,_0x3dc7fa){return _0x2c76d1[_0x0e2f('0x7')](_0x0e2f('0x8'),attributes,{'tableName':_0x0e2f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cde=['cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack'];(function(_0x235782,_0xab3d68){var _0x341ed2=function(_0x18765b){while(--_0x18765b){_0x235782['push'](_0x235782['shift']());}};_0x341ed2(++_0xab3d68);}(_0x0cde,0x83));var _0xe0cd=function(_0xa6ac61,_0x3db964){_0xa6ac61=_0xa6ac61-0x0;var _0x2808a1=_0x0cde[_0xa6ac61];return _0x2808a1;};'use strict';var _=require('lodash');var util=require(_0xe0cd('0x0'));var logger=require(_0xe0cd('0x1'))(_0xe0cd('0x2'));var moment=require(_0xe0cd('0x3'));var BPromise=require(_0xe0cd('0x4'));var rp=require(_0xe0cd('0x5'));var fs=require('fs');var path=require(_0xe0cd('0x6'));var rimraf=require('rimraf');var config=require(_0xe0cd('0x7'));var attributes=require(_0xe0cd('0x8'));module[_0xe0cd('0x9')]=function(_0x706d0f,_0x13ee59){return _0x706d0f[_0xe0cd('0xa')](_0xe0cd('0xb'),attributes,{'tableName':_0xe0cd('0xc'),'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 8a2b731..bd9027b 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 _0x8de9=['debug','stringify','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','attributes','limit','include','map','model','UpdateCmHopperBlack','body','where','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent'];(function(_0x1ed1c4,_0x13b887){var _0x42cad1=function(_0x452756){while(--_0x452756){_0x1ed1c4['push'](_0x1ed1c4['shift']());}};_0x42cad1(++_0x13b887);}(_0x8de9,0xe7));var _0x98de=function(_0x4c3705,_0x2a9135){_0x4c3705=_0x4c3705-0x0;var _0x5b61c7=_0x8de9[_0x4c3705];return _0x5b61c7;};'use strict';var _=require(_0x98de('0x0'));var util=require(_0x98de('0x1'));var moment=require(_0x98de('0x2'));var BPromise=require('bluebird');var rs=require(_0x98de('0x3'));var fs=require('fs');var Redis=require(_0x98de('0x4'));var db=require(_0x98de('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98de('0x6'));var config=require('../../config/environment');var jayson=require(_0x98de('0x7'));var client=jayson[_0x98de('0x8')][_0x98de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2912af,_0x143db6,_0x4e66c0){return new BPromise(function(_0x54b9b5,_0x410170){return client['request'](_0x2912af,_0x4e66c0)[_0x98de('0xa')](function(_0x14c335){logger[_0x98de('0xb')](_0x98de('0xc'),_0x143db6,_0x98de('0xd'));logger[_0x98de('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x143db6,_0x98de('0xd'),JSON[_0x98de('0xf')](_0x14c335));if(_0x14c335[_0x98de('0x10')]){if(_0x14c335['error'][_0x98de('0x11')]===0x1f4){logger[_0x98de('0x10')](_0x98de('0xc'),_0x143db6,_0x14c335[_0x98de('0x10')]['message']);return _0x410170(_0x14c335[_0x98de('0x10')]['message']);}logger[_0x98de('0x10')](_0x98de('0xc'),_0x143db6,_0x14c335[_0x98de('0x10')][_0x98de('0x12')]);return _0x54b9b5(_0x14c335[_0x98de('0x10')][_0x98de('0x12')]);}else{logger['info'](_0x98de('0xc'),_0x143db6,_0x98de('0xd'));_0x54b9b5(_0x14c335['result'][_0x98de('0x12')]);}})[_0x98de('0x13')](function(_0x50e4d4){logger[_0x98de('0x10')](_0x98de('0xc'),_0x143db6,_0x50e4d4);_0x410170(_0x50e4d4);});});}exports[_0x98de('0x14')]=function(_0x38e424){var _0xa5388c=this;return new Promise(function(_0x1e5149,_0x31c220){return db[_0x98de('0x15')][_0x98de('0x16')]({'raw':_0x38e424[_0x98de('0x17')]?_0x38e424[_0x98de('0x17')][_0x98de('0x18')]===undefined?!![]:![]:!![],'where':_0x38e424[_0x98de('0x17')]?_0x38e424[_0x98de('0x17')]['where']||null:null,'attributes':_0x38e424['options']?_0x38e424[_0x98de('0x17')][_0x98de('0x19')]||null:null,'limit':_0x38e424['options']?_0x38e424[_0x98de('0x17')][_0x98de('0x1a')]||null:null,'include':_0x38e424[_0x98de('0x17')]?_0x38e424['options'][_0x98de('0x1b')]?_[_0x98de('0x1c')](_0x38e424[_0x98de('0x17')][_0x98de('0x1b')],function(_0x14a020){return{'model':db[_0x14a020[_0x98de('0x1d')]],'as':_0x14a020['as'],'attributes':_0x14a020[_0x98de('0x19')],'include':_0x14a020[_0x98de('0x1b')]?_['map'](_0x14a020[_0x98de('0x1b')],function(_0x385e19){return{'model':db[_0x385e19[_0x98de('0x1d')]],'as':_0x385e19['as'],'attributes':_0x385e19[_0x98de('0x19')],'include':_0x385e19[_0x98de('0x1b')]?_[_0x98de('0x1c')](_0x385e19['include'],function(_0x2e4f79){return{'model':db[_0x2e4f79[_0x98de('0x1d')]],'as':_0x2e4f79['as'],'attributes':_0x2e4f79[_0x98de('0x19')]};}):[]};}):[]};}):[]:[]})[_0x98de('0xa')](function(_0x4667b6){logger['info'](_0x98de('0x14'),_0x38e424);logger[_0x98de('0xe')](_0x98de('0x14'),_0x38e424,JSON[_0x98de('0xf')](_0x4667b6));_0x1e5149(_0x4667b6);})[_0x98de('0x13')](function(_0x2d1421){logger[_0x98de('0x10')]('GetCmHopperBlack',_0x2d1421['message'],_0x38e424);_0x31c220(_0xa5388c[_0x98de('0x10')](0x1f4,_0x2d1421['message']));});});};exports[_0x98de('0x1e')]=function(_0x44db6b){var _0x3f6f74=this;return new Promise(function(_0x57f097,_0x37f686){return db[_0x98de('0x15')]['update'](_0x44db6b[_0x98de('0x1f')],{'raw':_0x44db6b[_0x98de('0x17')]?_0x44db6b['options'][_0x98de('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44db6b[_0x98de('0x17')]?_0x44db6b[_0x98de('0x17')][_0x98de('0x20')]||null:null,'attributes':_0x44db6b['options']?_0x44db6b[_0x98de('0x17')][_0x98de('0x19')]||null:null,'limit':_0x44db6b['options']?_0x44db6b[_0x98de('0x17')]['limit']||null:null})[_0x98de('0xa')](function(_0x3b8ed4){logger[_0x98de('0xb')](_0x98de('0x1e'),_0x44db6b);logger[_0x98de('0xe')](_0x98de('0x1e'),_0x44db6b,JSON[_0x98de('0xf')](_0x3b8ed4));_0x57f097(_0x3b8ed4);})[_0x98de('0x13')](function(_0x46c04a){logger[_0x98de('0x10')]('UpdateCmHopperBlack',_0x46c04a[_0x98de('0x12')],_0x44db6b);_0x37f686(_0x3f6f74[_0x98de('0x10')](0x1f4,_0x46c04a[_0x98de('0x12')]));});});};exports[_0x98de('0x21')]=function(_0x1f23f6){var _0x5da883=this;return new Promise(function(_0x2f80cf,_0x480594){return db['CmHopperBlack'][_0x98de('0x22')]({'where':_0x1f23f6[_0x98de('0x17')]?_0x1f23f6[_0x98de('0x17')]['where']||null:null})[_0x98de('0xa')](function(_0x366ba0){logger[_0x98de('0xb')](_0x98de('0x21'),_0x1f23f6);logger['debug']('DestroyCmHopperBlack',_0x1f23f6,JSON[_0x98de('0xf')](_0x366ba0));_0x2f80cf(_0x366ba0);})['catch'](function(_0x30b162){logger['error'](_0x98de('0x21'),_0x30b162[_0x98de('0x12')],_0x1f23f6);_0x480594(_0x5da883[_0x98de('0x10')](0x1f4,_0x30b162[_0x98de('0x12')]));});});}; \ No newline at end of file +var _0xecca=['model','info','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xecca,0x12d));var _0xaecc=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xecca[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xaecc('0x0'));var util=require(_0xaecc('0x1'));var moment=require(_0xaecc('0x2'));var BPromise=require('bluebird');var rs=require(_0xaecc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaecc('0x4'))['db'];var utils=require(_0xaecc('0x5'));var logger=require(_0xaecc('0x6'))(_0xaecc('0x7'));var config=require(_0xaecc('0x8'));var jayson=require(_0xaecc('0x9'));var client=jayson[_0xaecc('0xa')][_0xaecc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x144249,_0x155a6c,_0x50a57b){return new BPromise(function(_0x35a293,_0x20fb62){return client[_0xaecc('0xc')](_0x144249,_0x50a57b)[_0xaecc('0xd')](function(_0x16d5a1){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x155a6c,_0xaecc('0xe'));logger[_0xaecc('0xf')](_0xaecc('0x10'),_0x155a6c,_0xaecc('0xe'),JSON[_0xaecc('0x11')](_0x16d5a1));if(_0x16d5a1[_0xaecc('0x12')]){if(_0x16d5a1[_0xaecc('0x12')]['code']===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x155a6c,_0x16d5a1['error']['message']);return _0x20fb62(_0x16d5a1[_0xaecc('0x12')]['message']);}logger[_0xaecc('0x12')](_0xaecc('0x13'),_0x155a6c,_0x16d5a1[_0xaecc('0x12')][_0xaecc('0x14')]);return _0x35a293(_0x16d5a1[_0xaecc('0x12')][_0xaecc('0x14')]);}else{logger['info'](_0xaecc('0x13'),_0x155a6c,_0xaecc('0xe'));_0x35a293(_0x16d5a1[_0xaecc('0x15')]['message']);}})[_0xaecc('0x16')](function(_0xac1c5){logger[_0xaecc('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x155a6c,_0xac1c5);_0x20fb62(_0xac1c5);});});}exports[_0xaecc('0x17')]=function(_0x17e8f4){var _0x286e13=this;return new Promise(function(_0x584d1d,_0x5c72d7){return db[_0xaecc('0x18')]['findAll']({'raw':_0x17e8f4['options']?_0x17e8f4[_0xaecc('0x19')][_0xaecc('0x1a')]===undefined?!![]:![]:!![],'where':_0x17e8f4['options']?_0x17e8f4[_0xaecc('0x19')][_0xaecc('0x1b')]||null:null,'attributes':_0x17e8f4[_0xaecc('0x19')]?_0x17e8f4[_0xaecc('0x19')][_0xaecc('0x1c')]||null:null,'limit':_0x17e8f4[_0xaecc('0x19')]?_0x17e8f4[_0xaecc('0x19')][_0xaecc('0x1d')]||null:null,'include':_0x17e8f4[_0xaecc('0x19')]?_0x17e8f4['options'][_0xaecc('0x1e')]?_[_0xaecc('0x1f')](_0x17e8f4['options'][_0xaecc('0x1e')],function(_0x5dfa4d){return{'model':db[_0x5dfa4d[_0xaecc('0x20')]],'as':_0x5dfa4d['as'],'attributes':_0x5dfa4d[_0xaecc('0x1c')],'include':_0x5dfa4d['include']?_[_0xaecc('0x1f')](_0x5dfa4d[_0xaecc('0x1e')],function(_0x1c0940){return{'model':db[_0x1c0940[_0xaecc('0x20')]],'as':_0x1c0940['as'],'attributes':_0x1c0940[_0xaecc('0x1c')],'include':_0x1c0940[_0xaecc('0x1e')]?_[_0xaecc('0x1f')](_0x1c0940[_0xaecc('0x1e')],function(_0x16a97a){return{'model':db[_0x16a97a[_0xaecc('0x20')]],'as':_0x16a97a['as'],'attributes':_0x16a97a[_0xaecc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaecc('0xd')](function(_0x24a8e7){logger[_0xaecc('0x21')](_0xaecc('0x17'),_0x17e8f4);logger[_0xaecc('0xf')](_0xaecc('0x17'),_0x17e8f4,JSON[_0xaecc('0x11')](_0x24a8e7));_0x584d1d(_0x24a8e7);})[_0xaecc('0x16')](function(_0x224af4){logger[_0xaecc('0x12')](_0xaecc('0x17'),_0x224af4[_0xaecc('0x14')],_0x17e8f4);_0x5c72d7(_0x286e13[_0xaecc('0x12')](0x1f4,_0x224af4['message']));});});};exports['UpdateCmHopperBlack']=function(_0x15efc){var _0x99abcd=this;return new Promise(function(_0x680ed1,_0x2ee140){return db[_0xaecc('0x18')]['update'](_0x15efc['body'],{'raw':_0x15efc[_0xaecc('0x19')]?_0x15efc[_0xaecc('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15efc[_0xaecc('0x19')]?_0x15efc['options'][_0xaecc('0x1b')]||null:null,'attributes':_0x15efc[_0xaecc('0x19')]?_0x15efc[_0xaecc('0x19')][_0xaecc('0x1c')]||null:null,'limit':_0x15efc[_0xaecc('0x19')]?_0x15efc[_0xaecc('0x19')][_0xaecc('0x1d')]||null:null})[_0xaecc('0xd')](function(_0xac9914){logger[_0xaecc('0x21')](_0xaecc('0x22'),_0x15efc);logger[_0xaecc('0xf')](_0xaecc('0x22'),_0x15efc,JSON['stringify'](_0xac9914));_0x680ed1(_0xac9914);})[_0xaecc('0x16')](function(_0x488691){logger[_0xaecc('0x12')](_0xaecc('0x22'),_0x488691[_0xaecc('0x14')],_0x15efc);_0x2ee140(_0x99abcd[_0xaecc('0x12')](0x1f4,_0x488691[_0xaecc('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x1e8b36){var _0x23167e=this;return new Promise(function(_0x447875,_0x326a49){return db[_0xaecc('0x18')][_0xaecc('0x23')]({'where':_0x1e8b36[_0xaecc('0x19')]?_0x1e8b36['options'][_0xaecc('0x1b')]||null:null})[_0xaecc('0xd')](function(_0x3ff9ee){logger[_0xaecc('0x21')]('DestroyCmHopperBlack',_0x1e8b36);logger[_0xaecc('0xf')](_0xaecc('0x24'),_0x1e8b36,JSON[_0xaecc('0x11')](_0x3ff9ee));_0x447875(_0x3ff9ee);})[_0xaecc('0x16')](function(_0x48aaaa){logger[_0xaecc('0x12')](_0xaecc('0x24'),_0x48aaaa[_0xaecc('0x14')],_0x1e8b36);_0x326a49(_0x23167e[_0xaecc('0x12')](0x1f4,_0x48aaaa[_0xaecc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index e1e3592..f894311 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 _0xed1f=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x37894c,_0x5ce8b4){var _0x103afd=function(_0x2e2370){while(--_0x2e2370){_0x37894c['push'](_0x37894c['shift']());}};_0x103afd(++_0x5ce8b4);}(_0xed1f,0x6a));var _0xfed1=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xed1f[_0x3740fe];return _0x55492b;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var auth=require(_0xfed1('0x6'));var interaction=require(_0xfed1('0x7'));var config=require(_0xfed1('0x8'));var controller=require(_0xfed1('0x9'));router[_0xfed1('0xa')]('/',auth[_0xfed1('0xb')](),controller[_0xfed1('0xc')]);router[_0xfed1('0xa')](_0xfed1('0xd'),auth[_0xfed1('0xb')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xa')]('/:id',auth[_0xfed1('0xb')](),controller[_0xfed1('0xf')]);router['put'](_0xfed1('0x10'),auth[_0xfed1('0xb')](),controller['update']);router[_0xfed1('0x11')]('/:id',auth[_0xfed1('0xb')](),controller[_0xfed1('0x12')]);module['exports']=router; \ No newline at end of file +var _0x4b84=['./cmHopperBlack.controller','get','isAuthenticated','show','put','/:id','update','delete','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment'];(function(_0x278938,_0x23b217){var _0xf0a26b=function(_0x446656){while(--_0x446656){_0x278938['push'](_0x278938['shift']());}};_0xf0a26b(++_0x23b217);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3d2012,_0x3d02b9){_0x3d2012=_0x3d2012-0x0;var _0x53d542=_0x4b84[_0x3d2012];return _0x53d542;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/describe',auth[_0x44b8('0x7')](),controller['describe']);router[_0x44b8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router[_0x44b8('0x9')](_0x44b8('0xa'),auth['isAuthenticated'](),controller[_0x44b8('0xb')]);router[_0x44b8('0xc')](_0x44b8('0xa'),auth[_0x44b8('0x7')](),controller[_0x44b8('0xd')]);module[_0x44b8('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index cfaed41..2801778 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 _0xbf9d=['INTEGER','STRING','DATE','setDataValue','followuptime','dispositionat','BOOLEAN','sequelize','exports'];(function(_0x5d6b2e,_0x152255){var _0x5d93f9=function(_0xdc2200){while(--_0xdc2200){_0x5d6b2e['push'](_0x5d6b2e['shift']());}};_0x5d93f9(++_0x152255);}(_0xbf9d,0xf1));var _0xdbf9=function(_0x29c3dc,_0xbb2250){_0x29c3dc=_0x29c3dc-0x0;var _0x50f658=_0xbf9d[_0x29c3dc];return _0x50f658;};'use strict';var Sequelize=require(_0xdbf9('0x0'));var moment=require('moment');module[_0xdbf9('0x1')]={'state':{'type':Sequelize[_0xdbf9('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdbf9('0x3')]},'scheduledat':{'type':Sequelize[_0xdbf9('0x4')]},'countbusyretry':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xdbf9('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xdbf9('0x3')]},'calleridnum':{'type':Sequelize[_0xdbf9('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xdbf9('0x4')]},'responsetime':{'type':Sequelize[_0xdbf9('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xdbf9('0x4')]},'endtime':{'type':Sequelize[_0xdbf9('0x4')]},'ringtime':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xdbf9('0x3')]},'campaign':{'type':Sequelize[_0xdbf9('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xdbf9('0x3')]},'reason':{'type':Sequelize[_0xdbf9('0x3')]},'disposition':{'type':Sequelize[_0xdbf9('0x3')]},'secondDisposition':{'type':Sequelize[_0xdbf9('0x3')]},'thirdDisposition':{'type':Sequelize[_0xdbf9('0x3')]},'dispositionat':{'type':Sequelize[_0xdbf9('0x4')],'set':function(_0x3b6158){var _0x569c10=this['getDataValue']('endtime');if(_0x569c10&&_0x3b6158){this[_0xdbf9('0x5')](_0xdbf9('0x6'),moment(_0x3b6158)['diff'](moment(_0x569c10),'seconds'));}return this['setDataValue'](_0xdbf9('0x7'),_0x3b6158);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xdbf9('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xdbf9('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xdbf9('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xdbf9('0x4')]},'callback':{'type':Sequelize[_0xdbf9('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdbf9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdbf9('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xdbf9('0x4')]},'recallme':{'type':Sequelize[_0xdbf9('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xdbf9('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdbf9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5ca8=['STRING','DATE','endtime','followuptime','diff','seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER'];(function(_0xf3c843,_0x8ff24e){var _0x3191c6=function(_0x2f1ef7){while(--_0x2f1ef7){_0xf3c843['push'](_0xf3c843['shift']());}};_0x3191c6(++_0x8ff24e);}(_0x5ca8,0x71));var _0x85ca=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5ca8[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x85ca('0x0'));var moment=require(_0x85ca('0x1'));module[_0x85ca('0x2')]={'state':{'type':Sequelize[_0x85ca('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x85ca('0x4')]},'scheduledat':{'type':Sequelize[_0x85ca('0x5')]},'countbusyretry':{'type':Sequelize[_0x85ca('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x85ca('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x85ca('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x85ca('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x85ca('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x85ca('0x4')]},'starttime':{'type':Sequelize[_0x85ca('0x5')]},'responsetime':{'type':Sequelize[_0x85ca('0x5')]},'answertime':{'type':Sequelize[_0x85ca('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x85ca('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x85ca('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x85ca('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x85ca('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x85ca('0x4')]},'dispositionat':{'type':Sequelize[_0x85ca('0x5')],'set':function(_0x359aee){var _0x1444f8=this['getDataValue'](_0x85ca('0x6'));if(_0x1444f8&&_0x359aee){this['setDataValue'](_0x85ca('0x7'),moment(_0x359aee)[_0x85ca('0x8')](moment(_0x1444f8),_0x85ca('0x9')));}return this[_0x85ca('0xa')](_0x85ca('0xb'),_0x359aee);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x85ca('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x85ca('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x85ca('0x5')]},'callback':{'type':Sequelize[_0x85ca('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x85ca('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x85ca('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x85ca('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x85ca('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x85ca('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x85ca('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x85ca('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x85ca('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 3a03091..3461a63 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 _0x32ef=['../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','CmHopperFinal','includeAll','include','rows','catch','show','params','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','reCallContacts','answeringMachine','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','Campaign','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x225d64,_0x34440){var _0x47a1e2=function(_0x4a9c9e){while(--_0x4a9c9e){_0x225d64['push'](_0x225d64['shift']());}};_0x47a1e2(++_0x34440);}(_0x32ef,0xf9));var _0xf32e=function(_0x48c540,_0x4047ab){_0x48c540=_0x48c540-0x0;var _0x131204=_0x32ef[_0x48c540];return _0x131204;};'use strict';var pdf=require(_0xf32e('0x0'));var emlformat=require(_0xf32e('0x1'));var rimraf=require(_0xf32e('0x2'));var zipdir=require(_0xf32e('0x3'));var jsonpatch=require(_0xf32e('0x4'));var rp=require(_0xf32e('0x5'));var moment=require('moment');var BPromise=require(_0xf32e('0x6'));var Mustache=require(_0xf32e('0x7'));var util=require('util');var path=require(_0xf32e('0x8'));var sox=require(_0xf32e('0x9'));var csv=require(_0xf32e('0xa'));var ejs=require(_0xf32e('0xb'));var fs=require('fs');var _=require(_0xf32e('0xc'));var squel=require(_0xf32e('0xd'));var crypto=require('crypto');var jsforce=require(_0xf32e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf32e('0xa'));var querystring=require(_0xf32e('0xf'));var Papa=require(_0xf32e('0x10'));var Redis=require(_0xf32e('0x11'));var authService=require(_0xf32e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf32e('0x13'));var hardwareService=require(_0xf32e('0x14'));var logger=require(_0xf32e('0x15'))(_0xf32e('0x16'));var utils=require(_0xf32e('0x17'));var config=require(_0xf32e('0x18'));var licenseUtil=require(_0xf32e('0x19'));var db=require(_0xf32e('0x1a'))['db'];function respondWithStatusCode(_0x319616,_0x1c1f52){_0x1c1f52=_0x1c1f52||0xcc;return function(_0xf7dc32){if(_0xf7dc32){return _0x319616['sendStatus'](_0x1c1f52);}return _0x319616[_0xf32e('0x1b')](_0x1c1f52)[_0xf32e('0x1c')]();};}function respondWithResult(_0x543072,_0x336e26){_0x336e26=_0x336e26||0xc8;return function(_0x35988d){if(_0x35988d){return _0x543072[_0xf32e('0x1b')](_0x336e26)['json'](_0x35988d);}};}function respondWithFilteredResult(_0xe324ad,_0x299efa){return function(_0x1dd008){if(_0x1dd008){var _0x400d25=_0x1dd008[_0xf32e('0x1d')],_0x43eedf=_0x299efa[_0xf32e('0x1e')],_0x417def=_0x299efa['offset']+_0x299efa[_0xf32e('0x1f')],_0x6a0231;if(_0x417def>=_0x400d25){_0x417def=_0x400d25;_0x6a0231=0xc8;}else{_0x6a0231=0xce;}_0xe324ad[_0xf32e('0x1b')](_0x6a0231);return _0xe324ad[_0xf32e('0x20')](_0xf32e('0x21'),_0x43eedf+'-'+_0x417def+'/'+_0x400d25)[_0xf32e('0x22')](_0x1dd008);}return null;};}function patchUpdates(_0x1f7a5e){return function(_0x2f909b){try{jsonpatch[_0xf32e('0x23')](_0x2f909b,_0x1f7a5e,!![]);}catch(_0xdd701b){return BPromise[_0xf32e('0x24')](_0xdd701b);}return _0x2f909b[_0xf32e('0x25')]();};}function saveUpdates(_0x1b169e,_0x3202e1){return function(_0x3c0d43){if(_0x3c0d43){return _0x3c0d43[_0xf32e('0x26')](_0x1b169e)['then'](function(_0x23552d){return _0x23552d;});}return null;};}function removeEntity(_0x57a8cb,_0x27b92c){return function(_0x2aaabf){if(_0x2aaabf){return _0x2aaabf[_0xf32e('0x27')]()[_0xf32e('0x28')](function(){_0x57a8cb[_0xf32e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227405,_0x4407f8){return function(_0x13d87a){if(!_0x13d87a){_0x227405[_0xf32e('0x29')](0x194);}return _0x13d87a;};}function handleError(_0x5e62eb,_0x173b77){_0x173b77=_0x173b77||0x1f4;return function(_0x1eb413){logger[_0xf32e('0x2a')](_0x1eb413[_0xf32e('0x2b')]);if(_0x1eb413[_0xf32e('0x2c')]){delete _0x1eb413[_0xf32e('0x2c')];}_0x5e62eb[_0xf32e('0x1b')](_0x173b77)[_0xf32e('0x2d')](_0x1eb413);};}exports[_0xf32e('0x2e')]=function(_0x29be62,_0x488489){var _0x3e6e6f={},_0x88eaa5={},_0x3b906c={'count':0x0,'rows':[]};var _0x4a873c=_[_0xf32e('0x2f')](db['CmHopperFinal'][_0xf32e('0x30')],function(_0x5c8779){return{'name':_0x5c8779[_0xf32e('0x31')],'type':_0x5c8779[_0xf32e('0x32')][_0xf32e('0x33')]};});_0x88eaa5[_0xf32e('0x34')]=_[_0xf32e('0x2f')](_0x4a873c,'name');_0x88eaa5[_0xf32e('0x35')]=_[_0xf32e('0x36')](_0x29be62[_0xf32e('0x35')]);_0x88eaa5['filters']=_[_0xf32e('0x37')](_0x88eaa5[_0xf32e('0x34')],_0x88eaa5[_0xf32e('0x35')]);_0x3e6e6f[_0xf32e('0x38')]=_[_0xf32e('0x37')](_0x88eaa5[_0xf32e('0x34')],qs[_0xf32e('0x39')](_0x29be62[_0xf32e('0x35')][_0xf32e('0x39')]));_0x3e6e6f[_0xf32e('0x38')]=_0x3e6e6f[_0xf32e('0x38')][_0xf32e('0x3a')]?_0x3e6e6f[_0xf32e('0x38')]:_0x88eaa5['model'];if(!_0x29be62[_0xf32e('0x35')]['hasOwnProperty'](_0xf32e('0x3b'))){_0x3e6e6f['limit']=qs['limit'](_0x29be62[_0xf32e('0x35')][_0xf32e('0x1f')]);_0x3e6e6f[_0xf32e('0x1e')]=qs[_0xf32e('0x1e')](_0x29be62[_0xf32e('0x35')]['offset']);}_0x3e6e6f[_0xf32e('0x3c')]=qs[_0xf32e('0x3d')](_0x29be62[_0xf32e('0x35')][_0xf32e('0x3d')]);_0x3e6e6f['where']=qs[_0xf32e('0x3e')](_[_0xf32e('0x3f')](_0x29be62[_0xf32e('0x35')],_0x88eaa5[_0xf32e('0x3e')]),_0x4a873c);if(_0x29be62[_0xf32e('0x35')]['filter']){_0x3e6e6f[_0xf32e('0x40')]=_[_0xf32e('0x41')](_0x3e6e6f[_0xf32e('0x40')],{'$or':_['map'](_0x4a873c,function(_0x1723e8){if(_0x1723e8['type']!==_0xf32e('0x42')){var _0x113b11={};_0x113b11[_0x1723e8[_0xf32e('0x2c')]]={'$like':'%'+_0x29be62['query'][_0xf32e('0x43')]+'%'};return _0x113b11;}})});}_0x3e6e6f=_[_0xf32e('0x41')]({},_0x3e6e6f,_0x29be62[_0xf32e('0x44')]);var _0x4a623={'where':_0x3e6e6f[_0xf32e('0x40')]};return db[_0xf32e('0x45')]['count'](_0x4a623)[_0xf32e('0x28')](function(_0x26ef18){_0x3b906c[_0xf32e('0x1d')]=_0x26ef18;if(_0x29be62[_0xf32e('0x35')][_0xf32e('0x46')]){_0x3e6e6f[_0xf32e('0x47')]=[{'all':!![]}];}return db[_0xf32e('0x45')]['findAll'](_0x3e6e6f);})[_0xf32e('0x28')](function(_0x160a30){_0x3b906c[_0xf32e('0x48')]=_0x160a30;return _0x3b906c;})[_0xf32e('0x28')](respondWithFilteredResult(_0x488489,_0x3e6e6f))[_0xf32e('0x49')](handleError(_0x488489,null));};exports[_0xf32e('0x4a')]=function(_0xb9d562,_0x546b80){var _0x1b38d7={'raw':!![],'where':{'id':_0xb9d562[_0xf32e('0x4b')]['id']}},_0x43882c={};_0x43882c[_0xf32e('0x34')]=_[_0xf32e('0x36')](db[_0xf32e('0x45')][_0xf32e('0x30')]);_0x43882c[_0xf32e('0x35')]=_[_0xf32e('0x36')](_0xb9d562[_0xf32e('0x35')]);_0x43882c['filters']=_[_0xf32e('0x37')](_0x43882c[_0xf32e('0x34')],_0x43882c[_0xf32e('0x35')]);_0x1b38d7[_0xf32e('0x38')]=_[_0xf32e('0x37')](_0x43882c[_0xf32e('0x34')],qs['fields'](_0xb9d562[_0xf32e('0x35')][_0xf32e('0x39')]));_0x1b38d7[_0xf32e('0x38')]=_0x1b38d7[_0xf32e('0x38')][_0xf32e('0x3a')]?_0x1b38d7['attributes']:_0x43882c[_0xf32e('0x34')];if(_0xb9d562['query'][_0xf32e('0x46')]){_0x1b38d7[_0xf32e('0x47')]=[{'all':!![]}];}_0x1b38d7=_['merge']({},_0x1b38d7,_0xb9d562[_0xf32e('0x44')]);return db['CmHopperFinal']['find'](_0x1b38d7)['then'](handleEntityNotFound(_0x546b80,null))[_0xf32e('0x28')](respondWithResult(_0x546b80,null))[_0xf32e('0x49')](handleError(_0x546b80,null));};exports[_0xf32e('0x4c')]=function(_0x6d2b3b,_0x36b74d){return db[_0xf32e('0x45')][_0xf32e('0x4c')]()[_0xf32e('0x28')](respondWithResult(_0x36b74d,null))[_0xf32e('0x49')](handleError(_0x36b74d,null));};exports[_0xf32e('0x26')]=function(_0x40f168,_0x1e81c4){if(_0x40f168[_0xf32e('0x4d')][_0xf32e('0x4e')]){delete _0x40f168['body'][_0xf32e('0x4e')];}return db[_0xf32e('0x45')][_0xf32e('0x4f')]({'where':{'uniqueid':_0x40f168['params']['id']}})['then'](handleEntityNotFound(_0x1e81c4,null))['then'](saveUpdates(_0x40f168[_0xf32e('0x4d')],null))[_0xf32e('0x28')](respondWithResult(_0x1e81c4,null))['catch'](handleError(_0x1e81c4,null));};exports[_0xf32e('0x50')]=function(_0x16a69b,_0x50d492,_0x5b1841){return db[_0xf32e('0x45')][_0xf32e('0x51')]({'raw':![],'where':{'VoiceQueueId':_0x16a69b[_0xf32e('0x4b')]['id']},'attributes':[[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db['sequelize']['fn']('IF',db[_0xf32e('0x52')][_0xf32e('0x54')](_0xf32e('0x55')))),'noSuchContacts'],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db[_0xf32e('0x52')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xf32e('0x56')],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db[_0xf32e('0x52')]['fn']('IF',db['sequelize'][_0xf32e('0x54')](_0xf32e('0x57')))),_0xf32e('0x58')],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db['sequelize']['fn']('IF',db[_0xf32e('0x52')][_0xf32e('0x54')](_0xf32e('0x59')))),_0xf32e('0x5a')],[db['sequelize']['fn'](_0xf32e('0x53'),db['sequelize']['fn']('IF',db['sequelize'][_0xf32e('0x54')](_0xf32e('0x5b')))),_0xf32e('0x5c')],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db[_0xf32e('0x52')]['fn']('IF',db[_0xf32e('0x52')][_0xf32e('0x54')](_0xf32e('0x5d')))),_0xf32e('0x5e')],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db['sequelize']['fn']('IF',db[_0xf32e('0x52')]['literal'](_0xf32e('0x5f')))),'reCallContacts'],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db[_0xf32e('0x52')]['fn']('IF',db['sequelize'][_0xf32e('0x54')](_0xf32e('0x60')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x50d492,null))['then'](respondWithResult(_0x50d492,null))[_0xf32e('0x49')](handleError(_0x50d492,null));};exports[_0xf32e('0x61')]=function(_0x3bfacd,_0x2c66d4,_0xef37e5){return db[_0xf32e('0x45')]['findAll']({'raw':![],'where':{'CampaignId':_0x3bfacd[_0xf32e('0x4b')]['id']},'attributes':[[db['sequelize']['fn'](_0xf32e('0x53'),db[_0xf32e('0x52')]['fn']('IF',db[_0xf32e('0x52')][_0xf32e('0x54')]('`state`\x20=\x200,\x201,\x20null'))),_0xf32e('0x62')],[db[_0xf32e('0x52')]['fn']('COUNT',db[_0xf32e('0x52')]['fn']('IF',db['sequelize'][_0xf32e('0x54')](_0xf32e('0x63')))),_0xf32e('0x56')],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db['sequelize']['fn']('IF',db[_0xf32e('0x52')][_0xf32e('0x54')](_0xf32e('0x57')))),_0xf32e('0x58')],[db['sequelize']['fn'](_0xf32e('0x53'),db[_0xf32e('0x52')]['fn']('IF',db[_0xf32e('0x52')]['literal'](_0xf32e('0x59')))),'congestionContacts'],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db[_0xf32e('0x52')]['fn']('IF',db[_0xf32e('0x52')][_0xf32e('0x54')](_0xf32e('0x5b')))),_0xf32e('0x5c')],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db[_0xf32e('0x52')]['fn']('IF',db[_0xf32e('0x52')]['literal'](_0xf32e('0x5d')))),_0xf32e('0x5e')],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0xf32e('0x64')],[db[_0xf32e('0x52')]['fn'](_0xf32e('0x53'),db[_0xf32e('0x52')]['fn']('IF',db[_0xf32e('0x52')][_0xf32e('0x54')]('`state`\x20=\x2019,\x201,\x20null'))),_0xf32e('0x65')]]})[_0xf32e('0x28')](handleEntityNotFound(_0x2c66d4,null))[_0xf32e('0x28')](respondWithResult(_0x2c66d4,null))['catch'](handleError(_0x2c66d4,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x4998d5,_0x5f5173,_0x40fdfc){return db[_0xf32e('0x66')][_0xf32e('0x4f')]({'where':{'id':_0x4998d5[_0xf32e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5f5173,null))[_0xf32e('0x28')](function(_0x24ca20){var _0x30fbbd;if(_0x24ca20){_0x30fbbd=squel[_0xf32e('0x67')]()['into'](_0xf32e('0x68'))[_0xf32e('0x69')]([_0xf32e('0x6a'),_0xf32e('0x6b'),_0xf32e('0x6c'),_0xf32e('0x6d'),_0xf32e('0x6e'),'createdAt','updatedAt'],squel[_0xf32e('0x6f')]()[_0xf32e('0x70')](_0xf32e('0x71'),_0xf32e('0x6a'))[_0xf32e('0x70')](_0xf32e('0x72'),_0xf32e('0x6b'))['field'](_0xf32e('0x73'),_0xf32e('0x6c'))[_0xf32e('0x70')](_0xf32e('0x74'),'ListId')[_0xf32e('0x70')](_0xf32e('0x75'),_0xf32e('0x6e'))[_0xf32e('0x70')]('NOW()',_0xf32e('0x76'))[_0xf32e('0x70')](_0xf32e('0x72'),_0xf32e('0x77'))[_0xf32e('0x78')](_0xf32e('0x79'))[_0xf32e('0x40')]('VoiceQueueId\x20=\x20?',_0x4998d5[_0xf32e('0x4b')]['id'][_0xf32e('0x7a')]())[_0xf32e('0x40')](_0xf32e('0x7b'),_0x4998d5['body'][_0xf32e('0x7c')]['toString']())[_0xf32e('0x40')](_0xf32e('0x7d'))[_0xf32e('0x40')](_0xf32e('0x7e'),squel[_0xf32e('0x6f')]()[_0xf32e('0x70')](_0xf32e('0x6a'))['from'](_0xf32e('0x68'))['where'](_0xf32e('0x7f'),_0x4998d5[_0xf32e('0x4b')]['id'][_0xf32e('0x7a')]()))[_0xf32e('0x40')](_0xf32e('0x7e'),squel[_0xf32e('0x6f')]()[_0xf32e('0x70')](_0xf32e('0x80'))[_0xf32e('0x78')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x4998d5['params']['id'][_0xf32e('0x7a')]())[_0xf32e('0x40')](_0xf32e('0x81')))['group'](_0xf32e('0x6c')))[_0xf32e('0x7a')]();return db[_0xf32e('0x52')][_0xf32e('0x35')](_0x30fbbd);}return[];})[_0xf32e('0x28')](respondWithResult(_0x5f5173,null))['catch'](handleError(_0x5f5173,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x36acab,_0xee8286,_0x21455d){return db[_0xf32e('0x82')]['find']({'where':{'id':_0x36acab[_0xf32e('0x4b')]['id']}})['then'](handleEntityNotFound(_0xee8286,null))[_0xf32e('0x28')](function(_0x5eb773){var _0x38f77c;if(_0x5eb773){_0x38f77c=squel[_0xf32e('0x67')]()[_0xf32e('0x83')](_0xf32e('0x68'))[_0xf32e('0x69')]([_0xf32e('0x6a'),_0xf32e('0x6b'),'ContactId',_0xf32e('0x6d'),_0xf32e('0x84'),'createdAt',_0xf32e('0x77')],squel[_0xf32e('0x6f')]()[_0xf32e('0x70')](_0xf32e('0x71'),'phone')['field'](_0xf32e('0x72'),_0xf32e('0x6b'))[_0xf32e('0x70')](_0xf32e('0x73'),_0xf32e('0x6c'))[_0xf32e('0x70')](_0xf32e('0x74'),'ListId')[_0xf32e('0x70')](_0xf32e('0x85'),_0xf32e('0x84'))['field'](_0xf32e('0x72'),'createdAt')['field'](_0xf32e('0x72'),_0xf32e('0x77'))[_0xf32e('0x78')](_0xf32e('0x79'))[_0xf32e('0x40')](_0xf32e('0x86'),_0x36acab[_0xf32e('0x4b')]['id'][_0xf32e('0x7a')]())[_0xf32e('0x40')](_0xf32e('0x7b'),_0x36acab[_0xf32e('0x4d')][_0xf32e('0x7c')]['toString']())[_0xf32e('0x40')](_0xf32e('0x7d'))[_0xf32e('0x40')](_0xf32e('0x7e'),squel[_0xf32e('0x6f')]()[_0xf32e('0x70')](_0xf32e('0x6a'))[_0xf32e('0x78')]('cm_hopper')[_0xf32e('0x40')](_0xf32e('0x86'),_0x36acab[_0xf32e('0x4b')]['id'][_0xf32e('0x7a')]()))['where'](_0xf32e('0x7e'),squel[_0xf32e('0x6f')]()[_0xf32e('0x70')](_0xf32e('0x80'))['from']('cm_hopper_final')[_0xf32e('0x40')](_0xf32e('0x86'),_0x36acab[_0xf32e('0x4b')]['id'][_0xf32e('0x7a')]())['where']('state\x20=\x204'))[_0xf32e('0x87')]('ContactId'))[_0xf32e('0x7a')]();return db['sequelize']['query'](_0x38f77c);}return[];})[_0xf32e('0x28')](respondWithResult(_0xee8286,null))['catch'](handleError(_0xee8286,null));};exports['checkContactHopper']=function(_0x35b8f9,_0x52ad4e,_0x13e051){return db['CmHopper'][_0xf32e('0x88')]({'where':{'VoiceQueueId':_0x35b8f9['body'][_0xf32e('0x6e')],'CampaignId':_0x35b8f9[_0xf32e('0x4d')][_0xf32e('0x84')],'ContactId':_0x35b8f9[_0xf32e('0x4d')][_0xf32e('0x6c')]}})[_0xf32e('0x28')](handleEntityNotFound(_0x52ad4e,null))[_0xf32e('0x28')](function(_0x4e60e4){if(_0x4e60e4){return _0x4e60e4;}return null;})[_0xf32e('0x28')](respondWithResult(_0x52ad4e,null))[_0xf32e('0x49')](handleError(_0x52ad4e,null));}; \ No newline at end of file +var _0x6f0d=['save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','CmHopperFinal','includeAll','include','findAll','rows','catch','show','find','uniqueid','body','countContactsQueueCampaignHopperFinal','params','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x2019,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','state','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply'];(function(_0x219e9b,_0x295d91){var _0x332e80=function(_0x567792){while(--_0x567792){_0x219e9b['push'](_0x219e9b['shift']());}};_0x332e80(++_0x295d91);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x40d1bf,_0x2af693){_0x40d1bf=_0x40d1bf-0x0;var _0x2b627c=_0x6f0d[_0x40d1bf];return _0x2b627c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd6f0('0x0'));var rimraf=require(_0xd6f0('0x1'));var zipdir=require(_0xd6f0('0x2'));var jsonpatch=require(_0xd6f0('0x3'));var rp=require('request-promise');var moment=require(_0xd6f0('0x4'));var BPromise=require(_0xd6f0('0x5'));var Mustache=require(_0xd6f0('0x6'));var util=require(_0xd6f0('0x7'));var path=require(_0xd6f0('0x8'));var sox=require('sox');var csv=require(_0xd6f0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];function respondWithStatusCode(_0x306aad,_0x45973d){_0x45973d=_0x45973d||0xcc;return function(_0x109655){if(_0x109655){return _0x306aad[_0xd6f0('0x19')](_0x45973d);}return _0x306aad[_0xd6f0('0x1a')](_0x45973d)[_0xd6f0('0x1b')]();};}function respondWithResult(_0x246dad,_0x4ab979){_0x4ab979=_0x4ab979||0xc8;return function(_0x2b3f32){if(_0x2b3f32){return _0x246dad[_0xd6f0('0x1a')](_0x4ab979)['json'](_0x2b3f32);}};}function respondWithFilteredResult(_0x419b7e,_0x593abe){return function(_0x3f4851){if(_0x3f4851){var _0x154e3e=_0x3f4851[_0xd6f0('0x1c')],_0x41bd99=_0x593abe[_0xd6f0('0x1d')],_0x472156=_0x593abe[_0xd6f0('0x1d')]+_0x593abe[_0xd6f0('0x1e')],_0x64ff5f;if(_0x472156>=_0x154e3e){_0x472156=_0x154e3e;_0x64ff5f=0xc8;}else{_0x64ff5f=0xce;}_0x419b7e[_0xd6f0('0x1a')](_0x64ff5f);return _0x419b7e[_0xd6f0('0x1f')](_0xd6f0('0x20'),_0x41bd99+'-'+_0x472156+'/'+_0x154e3e)[_0xd6f0('0x21')](_0x3f4851);}return null;};}function patchUpdates(_0x9dcf25){return function(_0x1f43d7){try{jsonpatch[_0xd6f0('0x22')](_0x1f43d7,_0x9dcf25,!![]);}catch(_0x5cd367){return BPromise['reject'](_0x5cd367);}return _0x1f43d7[_0xd6f0('0x23')]();};}function saveUpdates(_0x264104,_0x1158dc){return function(_0x54300d){if(_0x54300d){return _0x54300d[_0xd6f0('0x24')](_0x264104)[_0xd6f0('0x25')](function(_0x557c9b){return _0x557c9b;});}return null;};}function removeEntity(_0x86dde0,_0x515687){return function(_0x1ee584){if(_0x1ee584){return _0x1ee584[_0xd6f0('0x26')]()['then'](function(){_0x86dde0[_0xd6f0('0x1a')](0xcc)[_0xd6f0('0x1b')]();});}};}function handleEntityNotFound(_0x5ea2dd,_0x3dbdc3){return function(_0x402070){if(!_0x402070){_0x5ea2dd[_0xd6f0('0x19')](0x194);}return _0x402070;};}function handleError(_0x5b1a62,_0x2ca8bb){_0x2ca8bb=_0x2ca8bb||0x1f4;return function(_0x3dc166){logger['error'](_0x3dc166[_0xd6f0('0x27')]);if(_0x3dc166['name']){delete _0x3dc166[_0xd6f0('0x28')];}_0x5b1a62[_0xd6f0('0x1a')](_0x2ca8bb)[_0xd6f0('0x29')](_0x3dc166);};}exports[_0xd6f0('0x2a')]=function(_0x4101bd,_0x715aab){var _0x12d6ec={},_0x26799c={},_0x48975d={'count':0x0,'rows':[]};var _0x1ea941=_[_0xd6f0('0x2b')](db['CmHopperFinal'][_0xd6f0('0x2c')],function(_0x385947){return{'name':_0x385947[_0xd6f0('0x2d')],'type':_0x385947[_0xd6f0('0x2e')][_0xd6f0('0x2f')]};});_0x26799c[_0xd6f0('0x30')]=_[_0xd6f0('0x2b')](_0x1ea941,_0xd6f0('0x28'));_0x26799c[_0xd6f0('0x31')]=_[_0xd6f0('0x32')](_0x4101bd[_0xd6f0('0x31')]);_0x26799c[_0xd6f0('0x33')]=_[_0xd6f0('0x34')](_0x26799c[_0xd6f0('0x30')],_0x26799c[_0xd6f0('0x31')]);_0x12d6ec[_0xd6f0('0x35')]=_[_0xd6f0('0x34')](_0x26799c[_0xd6f0('0x30')],qs[_0xd6f0('0x36')](_0x4101bd[_0xd6f0('0x31')][_0xd6f0('0x36')]));_0x12d6ec[_0xd6f0('0x35')]=_0x12d6ec['attributes'][_0xd6f0('0x37')]?_0x12d6ec['attributes']:_0x26799c['model'];if(!_0x4101bd[_0xd6f0('0x31')][_0xd6f0('0x38')](_0xd6f0('0x39'))){_0x12d6ec[_0xd6f0('0x1e')]=qs[_0xd6f0('0x1e')](_0x4101bd['query'][_0xd6f0('0x1e')]);_0x12d6ec['offset']=qs[_0xd6f0('0x1d')](_0x4101bd[_0xd6f0('0x31')][_0xd6f0('0x1d')]);}_0x12d6ec[_0xd6f0('0x3a')]=qs[_0xd6f0('0x3b')](_0x4101bd['query']['sort']);_0x12d6ec[_0xd6f0('0x3c')]=qs[_0xd6f0('0x33')](_['pick'](_0x4101bd[_0xd6f0('0x31')],_0x26799c['filters']),_0x1ea941);if(_0x4101bd[_0xd6f0('0x31')][_0xd6f0('0x3d')]){_0x12d6ec[_0xd6f0('0x3c')]=_[_0xd6f0('0x3e')](_0x12d6ec[_0xd6f0('0x3c')],{'$or':_[_0xd6f0('0x2b')](_0x1ea941,function(_0x6b44fa){if(_0x6b44fa['type']!=='VIRTUAL'){var _0x162537={};_0x162537[_0x6b44fa[_0xd6f0('0x28')]]={'$like':'%'+_0x4101bd[_0xd6f0('0x31')]['filter']+'%'};return _0x162537;}})});}_0x12d6ec=_['merge']({},_0x12d6ec,_0x4101bd[_0xd6f0('0x3f')]);var _0x2def01={'where':_0x12d6ec[_0xd6f0('0x3c')]};return db[_0xd6f0('0x40')][_0xd6f0('0x1c')](_0x2def01)[_0xd6f0('0x25')](function(_0x2e9043){_0x48975d[_0xd6f0('0x1c')]=_0x2e9043;if(_0x4101bd['query'][_0xd6f0('0x41')]){_0x12d6ec[_0xd6f0('0x42')]=[{'all':!![]}];}return db[_0xd6f0('0x40')][_0xd6f0('0x43')](_0x12d6ec);})['then'](function(_0x1981bd){_0x48975d[_0xd6f0('0x44')]=_0x1981bd;return _0x48975d;})[_0xd6f0('0x25')](respondWithFilteredResult(_0x715aab,_0x12d6ec))[_0xd6f0('0x45')](handleError(_0x715aab,null));};exports[_0xd6f0('0x46')]=function(_0x49181b,_0x332809){var _0x2c74dd={'raw':!![],'where':{'id':_0x49181b['params']['id']}},_0x412f55={};_0x412f55[_0xd6f0('0x30')]=_[_0xd6f0('0x32')](db['CmHopperFinal']['rawAttributes']);_0x412f55[_0xd6f0('0x31')]=_[_0xd6f0('0x32')](_0x49181b[_0xd6f0('0x31')]);_0x412f55['filters']=_[_0xd6f0('0x34')](_0x412f55[_0xd6f0('0x30')],_0x412f55['query']);_0x2c74dd[_0xd6f0('0x35')]=_[_0xd6f0('0x34')](_0x412f55[_0xd6f0('0x30')],qs[_0xd6f0('0x36')](_0x49181b['query'][_0xd6f0('0x36')]));_0x2c74dd[_0xd6f0('0x35')]=_0x2c74dd[_0xd6f0('0x35')][_0xd6f0('0x37')]?_0x2c74dd[_0xd6f0('0x35')]:_0x412f55[_0xd6f0('0x30')];if(_0x49181b[_0xd6f0('0x31')][_0xd6f0('0x41')]){_0x2c74dd['include']=[{'all':!![]}];}_0x2c74dd=_[_0xd6f0('0x3e')]({},_0x2c74dd,_0x49181b[_0xd6f0('0x3f')]);return db['CmHopperFinal'][_0xd6f0('0x47')](_0x2c74dd)[_0xd6f0('0x25')](handleEntityNotFound(_0x332809,null))[_0xd6f0('0x25')](respondWithResult(_0x332809,null))[_0xd6f0('0x45')](handleError(_0x332809,null));};exports['describe']=function(_0x237f51,_0xe5fd11){return db['CmHopperFinal']['describe']()[_0xd6f0('0x25')](respondWithResult(_0xe5fd11,null))['catch'](handleError(_0xe5fd11,null));};exports[_0xd6f0('0x24')]=function(_0x61b354,_0x259827){if(_0x61b354['body'][_0xd6f0('0x48')]){delete _0x61b354[_0xd6f0('0x49')][_0xd6f0('0x48')];}return db[_0xd6f0('0x40')][_0xd6f0('0x47')]({'where':{'uniqueid':_0x61b354['params']['id']}})[_0xd6f0('0x25')](handleEntityNotFound(_0x259827,null))['then'](saveUpdates(_0x61b354[_0xd6f0('0x49')],null))[_0xd6f0('0x25')](respondWithResult(_0x259827,null))[_0xd6f0('0x45')](handleError(_0x259827,null));};exports[_0xd6f0('0x4a')]=function(_0x554e37,_0x5ceb6b,_0xa3be02){return db[_0xd6f0('0x40')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x554e37[_0xd6f0('0x4b')]['id']},'attributes':[[db['sequelize']['fn'](_0xd6f0('0x4c'),db[_0xd6f0('0x4d')]['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')](_0xd6f0('0x4f')))),'noSuchContacts'],[db[_0xd6f0('0x4d')]['fn'](_0xd6f0('0x4c'),db[_0xd6f0('0x4d')]['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')](_0xd6f0('0x50')))),_0xd6f0('0x51')],[db[_0xd6f0('0x4d')]['fn']('COUNT',db[_0xd6f0('0x4d')]['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')](_0xd6f0('0x52')))),_0xd6f0('0x53')],[db[_0xd6f0('0x4d')]['fn'](_0xd6f0('0x4c'),db[_0xd6f0('0x4d')]['fn']('IF',db[_0xd6f0('0x4d')]['literal'](_0xd6f0('0x54')))),'congestionContacts'],[db['sequelize']['fn'](_0xd6f0('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0xd6f0('0x4e')](_0xd6f0('0x55')))),_0xd6f0('0x56')],[db['sequelize']['fn'](_0xd6f0('0x4c'),db[_0xd6f0('0x4d')]['fn']('IF',db[_0xd6f0('0x4d')]['literal'](_0xd6f0('0x57')))),_0xd6f0('0x58')],[db['sequelize']['fn'](_0xd6f0('0x4c'),db[_0xd6f0('0x4d')]['fn']('IF',db['sequelize'][_0xd6f0('0x4e')](_0xd6f0('0x59')))),_0xd6f0('0x5a')],[db[_0xd6f0('0x4d')]['fn'](_0xd6f0('0x4c'),db['sequelize']['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0xd6f0('0x5b')]]})[_0xd6f0('0x25')](handleEntityNotFound(_0x5ceb6b,null))[_0xd6f0('0x25')](respondWithResult(_0x5ceb6b,null))['catch'](handleError(_0x5ceb6b,null));};exports[_0xd6f0('0x5c')]=function(_0x5d75fa,_0x4f24b7,_0x4bdedd){return db['CmHopperFinal'][_0xd6f0('0x43')]({'raw':![],'where':{'CampaignId':_0x5d75fa[_0xd6f0('0x4b')]['id']},'attributes':[[db[_0xd6f0('0x4d')]['fn'](_0xd6f0('0x4c'),db['sequelize']['fn']('IF',db[_0xd6f0('0x4d')]['literal'](_0xd6f0('0x4f')))),_0xd6f0('0x5d')],[db[_0xd6f0('0x4d')]['fn']('COUNT',db[_0xd6f0('0x4d')]['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')](_0xd6f0('0x50')))),'noAnswerContacts'],[db[_0xd6f0('0x4d')]['fn'](_0xd6f0('0x4c'),db[_0xd6f0('0x4d')]['fn']('IF',db['sequelize'][_0xd6f0('0x4e')](_0xd6f0('0x52')))),_0xd6f0('0x53')],[db[_0xd6f0('0x4d')]['fn']('COUNT',db[_0xd6f0('0x4d')]['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')](_0xd6f0('0x54')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')](_0xd6f0('0x55')))),_0xd6f0('0x56')],[db[_0xd6f0('0x4d')]['fn'](_0xd6f0('0x4c'),db[_0xd6f0('0x4d')]['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0xd6f0('0x4d')]['fn']('COUNT',db[_0xd6f0('0x4d')]['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')](_0xd6f0('0x59')))),_0xd6f0('0x5a')],[db[_0xd6f0('0x4d')]['fn'](_0xd6f0('0x4c'),db['sequelize']['fn']('IF',db[_0xd6f0('0x4d')][_0xd6f0('0x4e')](_0xd6f0('0x5e')))),'answeringMachine']]})[_0xd6f0('0x25')](handleEntityNotFound(_0x4f24b7,null))[_0xd6f0('0x25')](respondWithResult(_0x4f24b7,null))['catch'](handleError(_0x4f24b7,null));};exports[_0xd6f0('0x5f')]=function(_0x80f21c,_0x1bf313,_0x3930f4){return db[_0xd6f0('0x60')][_0xd6f0('0x47')]({'where':{'id':_0x80f21c[_0xd6f0('0x4b')]['id']}})[_0xd6f0('0x25')](handleEntityNotFound(_0x1bf313,null))[_0xd6f0('0x25')](function(_0x573eb3){var _0x2e657b;if(_0x573eb3){_0x2e657b=squel[_0xd6f0('0x61')]()[_0xd6f0('0x62')](_0xd6f0('0x63'))['fromQuery']([_0xd6f0('0x64'),_0xd6f0('0x65'),_0xd6f0('0x66'),_0xd6f0('0x67'),_0xd6f0('0x68'),_0xd6f0('0x69'),_0xd6f0('0x6a')],squel[_0xd6f0('0x6b')]()[_0xd6f0('0x6c')](_0xd6f0('0x6d'),'phone')[_0xd6f0('0x6c')](_0xd6f0('0x6e'),_0xd6f0('0x65'))['field'](_0xd6f0('0x6f'),_0xd6f0('0x66'))[_0xd6f0('0x6c')](_0xd6f0('0x70'),_0xd6f0('0x67'))[_0xd6f0('0x6c')](_0xd6f0('0x71'),_0xd6f0('0x68'))[_0xd6f0('0x6c')](_0xd6f0('0x6e'),_0xd6f0('0x69'))['field']('NOW()',_0xd6f0('0x6a'))[_0xd6f0('0x72')](_0xd6f0('0x73'))[_0xd6f0('0x3c')](_0xd6f0('0x74'),_0x80f21c['params']['id'][_0xd6f0('0x75')]())[_0xd6f0('0x3c')]('state\x20=\x20?',_0x80f21c[_0xd6f0('0x49')]['state'][_0xd6f0('0x75')]())[_0xd6f0('0x3c')](_0xd6f0('0x76'))[_0xd6f0('0x3c')](_0xd6f0('0x77'),squel['select']()['field'](_0xd6f0('0x64'))[_0xd6f0('0x72')]('cm_hopper')[_0xd6f0('0x3c')]('VoiceQueueId\x20=\x20?',_0x80f21c['params']['id'][_0xd6f0('0x75')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xd6f0('0x78'))[_0xd6f0('0x72')](_0xd6f0('0x73'))[_0xd6f0('0x3c')](_0xd6f0('0x74'),_0x80f21c[_0xd6f0('0x4b')]['id'][_0xd6f0('0x75')]())[_0xd6f0('0x3c')](_0xd6f0('0x79')))['group'](_0xd6f0('0x66')))['toString']();return db['sequelize'][_0xd6f0('0x31')](_0x2e657b);}return[];})[_0xd6f0('0x25')](respondWithResult(_0x1bf313,null))[_0xd6f0('0x45')](handleError(_0x1bf313,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x12e166,_0x2d8fdc,_0xc0585c){return db[_0xd6f0('0x7a')][_0xd6f0('0x47')]({'where':{'id':_0x12e166[_0xd6f0('0x4b')]['id']}})[_0xd6f0('0x25')](handleEntityNotFound(_0x2d8fdc,null))[_0xd6f0('0x25')](function(_0x57a196){var _0x189edf;if(_0x57a196){_0x189edf=squel[_0xd6f0('0x61')]()['into'](_0xd6f0('0x63'))[_0xd6f0('0x7b')]([_0xd6f0('0x64'),_0xd6f0('0x65'),_0xd6f0('0x66'),_0xd6f0('0x67'),_0xd6f0('0x7c'),'createdAt',_0xd6f0('0x6a')],squel[_0xd6f0('0x6b')]()[_0xd6f0('0x6c')]('ANY_VALUE(calleridnum)','phone')['field'](_0xd6f0('0x6e'),_0xd6f0('0x65'))[_0xd6f0('0x6c')](_0xd6f0('0x6f'),_0xd6f0('0x66'))[_0xd6f0('0x6c')]('ANY_VALUE(ListId)',_0xd6f0('0x67'))[_0xd6f0('0x6c')](_0xd6f0('0x7d'),_0xd6f0('0x7c'))['field'](_0xd6f0('0x6e'),'createdAt')[_0xd6f0('0x6c')]('NOW()',_0xd6f0('0x6a'))[_0xd6f0('0x72')]('cm_hopper_final')[_0xd6f0('0x3c')](_0xd6f0('0x7e'),_0x12e166[_0xd6f0('0x4b')]['id'][_0xd6f0('0x75')]())[_0xd6f0('0x3c')](_0xd6f0('0x7f'),_0x12e166[_0xd6f0('0x49')][_0xd6f0('0x80')][_0xd6f0('0x75')]())[_0xd6f0('0x3c')](_0xd6f0('0x76'))[_0xd6f0('0x3c')](_0xd6f0('0x77'),squel[_0xd6f0('0x6b')]()['field'](_0xd6f0('0x64'))[_0xd6f0('0x72')](_0xd6f0('0x63'))[_0xd6f0('0x3c')](_0xd6f0('0x7e'),_0x12e166[_0xd6f0('0x4b')]['id'][_0xd6f0('0x75')]()))[_0xd6f0('0x3c')](_0xd6f0('0x77'),squel[_0xd6f0('0x6b')]()[_0xd6f0('0x6c')](_0xd6f0('0x78'))[_0xd6f0('0x72')](_0xd6f0('0x73'))['where']('CampaignId\x20=\x20?',_0x12e166[_0xd6f0('0x4b')]['id'][_0xd6f0('0x75')]())[_0xd6f0('0x3c')](_0xd6f0('0x79')))[_0xd6f0('0x81')]('ContactId'))[_0xd6f0('0x75')]();return db[_0xd6f0('0x4d')][_0xd6f0('0x31')](_0x189edf);}return[];})[_0xd6f0('0x25')](respondWithResult(_0x2d8fdc,null))['catch'](handleError(_0x2d8fdc,null));};exports[_0xd6f0('0x82')]=function(_0x16da7f,_0xdf9554,_0x68c45a){return db[_0xd6f0('0x83')][_0xd6f0('0x84')]({'where':{'VoiceQueueId':_0x16da7f['body']['VoiceQueueId'],'CampaignId':_0x16da7f[_0xd6f0('0x49')]['CampaignId'],'ContactId':_0x16da7f[_0xd6f0('0x49')]['ContactId']}})[_0xd6f0('0x25')](handleEntityNotFound(_0xdf9554,null))[_0xd6f0('0x25')](function(_0x49e68d){if(_0x49e68d){return _0x49e68d;}return null;})[_0xd6f0('0x25')](respondWithResult(_0xdf9554,null))['catch'](handleError(_0xdf9554,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 20b8a20..7d828ea 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 _0x58c4=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes'];(function(_0x46156b,_0x1a5677){var _0x7adaf2=function(_0x1b0085){while(--_0x1b0085){_0x46156b['push'](_0x46156b['shift']());}};_0x7adaf2(++_0x1a5677);}(_0x58c4,0x1a5));var _0x458c=function(_0x4a4450,_0x1b1f68){_0x4a4450=_0x4a4450-0x0;var _0x56355b=_0x58c4[_0x4a4450];return _0x56355b;};'use strict';var _=require('lodash');var util=require(_0x458c('0x0'));var logger=require(_0x458c('0x1'))('api');var moment=require(_0x458c('0x2'));var BPromise=require(_0x458c('0x3'));var rp=require(_0x458c('0x4'));var fs=require('fs');var path=require(_0x458c('0x5'));var rimraf=require('rimraf');var config=require(_0x458c('0x6'));var attributes=require(_0x458c('0x7'));module[_0x458c('0x8')]=function(_0x555655,_0x570dc6){return _0x555655['define'](_0x458c('0x9'),attributes,{'tableName':_0x458c('0xa'),'paranoid':![],'indexes':[{'name':_0x458c('0xb'),'fields':[_0x458c('0xb')]},{'name':_0x458c('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa43f=['moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger'];(function(_0x270318,_0x958092){var _0x2fa0b9=function(_0x18ef30){while(--_0x18ef30){_0x270318['push'](_0x270318['shift']());}};_0x2fa0b9(++_0x958092);}(_0xa43f,0x142));var _0xfa43=function(_0x5ec95f,_0x428c64){_0x5ec95f=_0x5ec95f-0x0;var _0x516720=_0xa43f[_0x5ec95f];return _0x516720;};'use strict';var _=require('lodash');var util=require(_0xfa43('0x0'));var logger=require(_0xfa43('0x1'))('api');var moment=require(_0xfa43('0x2'));var BPromise=require(_0xfa43('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa43('0x4'));var rimraf=require(_0xfa43('0x5'));var config=require(_0xfa43('0x6'));var attributes=require(_0xfa43('0x7'));module['exports']=function(_0x1b9652,_0x21328b){return _0x1b9652[_0xfa43('0x8')](_0xfa43('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xfa43('0xa'),'fields':[_0xfa43('0xa')]},{'name':_0xfa43('0xb'),'fields':[_0xfa43('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8b5730f..f8a30c1 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 _0x8807=['debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CmHopperFinal','body','options','raw','CreateCmHopperFinal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8807,0x1dd));var _0x7880=function(_0x272d90,_0x5e70ff){_0x272d90=_0x272d90-0x0;var _0x2bf4a2=_0x8807[_0x272d90];return _0x2bf4a2;};'use strict';var _=require(_0x7880('0x0'));var util=require(_0x7880('0x1'));var moment=require(_0x7880('0x2'));var BPromise=require('bluebird');var rs=require(_0x7880('0x3'));var fs=require('fs');var Redis=require(_0x7880('0x4'));var db=require(_0x7880('0x5'))['db'];var utils=require(_0x7880('0x6'));var logger=require(_0x7880('0x7'))(_0x7880('0x8'));var config=require(_0x7880('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7880('0xa')][_0x7880('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5303b4,_0x36f024,_0x359cce){return new BPromise(function(_0x500ecd,_0x13b9c4){return client[_0x7880('0xc')](_0x5303b4,_0x359cce)[_0x7880('0xd')](function(_0x4a29a5){logger[_0x7880('0xe')](_0x7880('0xf'),_0x36f024,_0x7880('0x10'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x36f024,_0x7880('0x10'),JSON[_0x7880('0x11')](_0x4a29a5));if(_0x4a29a5[_0x7880('0x12')]){if(_0x4a29a5[_0x7880('0x12')][_0x7880('0x13')]===0x1f4){logger[_0x7880('0x12')](_0x7880('0xf'),_0x36f024,_0x4a29a5['error'][_0x7880('0x14')]);return _0x13b9c4(_0x4a29a5[_0x7880('0x12')][_0x7880('0x14')]);}logger['error'](_0x7880('0xf'),_0x36f024,_0x4a29a5[_0x7880('0x12')][_0x7880('0x14')]);return _0x500ecd(_0x4a29a5['error'][_0x7880('0x14')]);}else{logger[_0x7880('0xe')](_0x7880('0xf'),_0x36f024,_0x7880('0x10'));_0x500ecd(_0x4a29a5['result'][_0x7880('0x14')]);}})[_0x7880('0x15')](function(_0x4701e8){logger[_0x7880('0x12')](_0x7880('0xf'),_0x36f024,_0x4701e8);_0x13b9c4(_0x4701e8);});});}exports['CreateCmHopperFinal']=function(_0x56f4f0){var _0x741c0d=this;return new Promise(function(_0xd21649,_0x3f7f07){return db[_0x7880('0x16')]['create'](_0x56f4f0[_0x7880('0x17')],{'raw':_0x56f4f0[_0x7880('0x18')]?_0x56f4f0[_0x7880('0x18')][_0x7880('0x19')]===undefined?!![]:![]:!![]})[_0x7880('0xd')](function(_0x4f6592){logger[_0x7880('0xe')](_0x7880('0x1a'),_0x56f4f0);logger[_0x7880('0x1b')]('CreateCmHopperFinal',_0x56f4f0,JSON[_0x7880('0x11')](_0x4f6592));_0xd21649(_0x4f6592);})[_0x7880('0x15')](function(_0x3784bf){logger[_0x7880('0x12')](_0x7880('0x1a'),_0x3784bf[_0x7880('0x14')],_0x56f4f0);_0x3f7f07(_0x741c0d['error'](0x1f4,_0x3784bf[_0x7880('0x14')]));});});}; \ No newline at end of file +var _0xe30d=['raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','error','code','message','CmHopperFinal,\x20%s,\x20%s','result','CreateCmHopperFinal','CmHopperFinal','body','options'];(function(_0x2b9a5e,_0x1cd354){var _0x251e6a=function(_0x403804){while(--_0x403804){_0x2b9a5e['push'](_0x2b9a5e['shift']());}};_0x251e6a(++_0x1cd354);}(_0xe30d,0xe2));var _0xde30=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe30d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde30('0x0'));var util=require(_0xde30('0x1'));var moment=require(_0xde30('0x2'));var BPromise=require('bluebird');var rs=require(_0xde30('0x3'));var fs=require('fs');var Redis=require(_0xde30('0x4'));var db=require(_0xde30('0x5'))['db'];var utils=require(_0xde30('0x6'));var logger=require(_0xde30('0x7'))(_0xde30('0x8'));var config=require(_0xde30('0x9'));var jayson=require(_0xde30('0xa'));var client=jayson[_0xde30('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x265883,_0x4dcfed,_0x28854e){return new BPromise(function(_0x3f49b0,_0x4d3e64){return client[_0xde30('0xc')](_0x265883,_0x28854e)[_0xde30('0xd')](function(_0xf78e94){logger[_0xde30('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x4dcfed,_0xde30('0xf'));logger[_0xde30('0x10')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x4dcfed,'request\x20sent',JSON['stringify'](_0xf78e94));if(_0xf78e94[_0xde30('0x11')]){if(_0xf78e94['error'][_0xde30('0x12')]===0x1f4){logger[_0xde30('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x4dcfed,_0xf78e94[_0xde30('0x11')][_0xde30('0x13')]);return _0x4d3e64(_0xf78e94[_0xde30('0x11')][_0xde30('0x13')]);}logger[_0xde30('0x11')](_0xde30('0x14'),_0x4dcfed,_0xf78e94[_0xde30('0x11')][_0xde30('0x13')]);return _0x3f49b0(_0xf78e94['error']['message']);}else{logger[_0xde30('0xe')](_0xde30('0x14'),_0x4dcfed,_0xde30('0xf'));_0x3f49b0(_0xf78e94[_0xde30('0x15')][_0xde30('0x13')]);}})['catch'](function(_0x31a434){logger[_0xde30('0x11')](_0xde30('0x14'),_0x4dcfed,_0x31a434);_0x4d3e64(_0x31a434);});});}exports[_0xde30('0x16')]=function(_0x3ced0c){var _0x36516f=this;return new Promise(function(_0xb2858a,_0x59c041){return db[_0xde30('0x17')]['create'](_0x3ced0c[_0xde30('0x18')],{'raw':_0x3ced0c['options']?_0x3ced0c[_0xde30('0x19')][_0xde30('0x1a')]===undefined?!![]:![]:!![]})[_0xde30('0xd')](function(_0x3f79e5){logger['info']('CreateCmHopperFinal',_0x3ced0c);logger[_0xde30('0x10')](_0xde30('0x16'),_0x3ced0c,JSON[_0xde30('0x1b')](_0x3f79e5));_0xb2858a(_0x3f79e5);})['catch'](function(_0x5f1241){logger[_0xde30('0x11')](_0xde30('0x16'),_0x5f1241[_0xde30('0x13')],_0x3ced0c);_0x59c041(_0x36516f[_0xde30('0x11')](0x1f4,_0x5f1241[_0xde30('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index ccbfbee..870bdec 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 _0xf1ae=['/checkContactHopper','/:id','update','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x1aed60,_0x3818f1){var _0x32e8b6=function(_0x46ff2b){while(--_0x46ff2b){_0x1aed60['push'](_0x1aed60['shift']());}};_0x32e8b6(++_0x3818f1);}(_0xf1ae,0x16c));var _0xef1a=function(_0x328232,_0x244561){_0x328232=_0x328232-0x0;var _0x15e230=_0xf1ae[_0x328232];return _0x15e230;};'use strict';var multer=require(_0xef1a('0x0'));var util=require('util');var path=require(_0xef1a('0x1'));var timeout=require(_0xef1a('0x2'));var express=require(_0xef1a('0x3'));var router=express['Router']();var auth=require(_0xef1a('0x4'));var interaction=require(_0xef1a('0x5'));var config=require('../../config/environment');var controller=require(_0xef1a('0x6'));router[_0xef1a('0x7')]('/',auth[_0xef1a('0x8')](),controller['index']);router[_0xef1a('0x7')]('/describe',auth[_0xef1a('0x8')](),controller[_0xef1a('0x9')]);router['get']('/:id',auth[_0xef1a('0x8')](),controller[_0xef1a('0xa')]);router[_0xef1a('0x7')](_0xef1a('0xb'),auth[_0xef1a('0x8')](),controller[_0xef1a('0xc')]);router[_0xef1a('0x7')](_0xef1a('0xd'),auth['isAuthenticated'](),controller[_0xef1a('0xe')]);router[_0xef1a('0xf')](_0xef1a('0x10'),auth[_0xef1a('0x8')](),controller[_0xef1a('0x11')]);router[_0xef1a('0xf')](_0xef1a('0x12'),auth[_0xef1a('0x8')](),controller[_0xef1a('0x13')]);router[_0xef1a('0xf')](_0xef1a('0x14'),auth[_0xef1a('0x8')](),controller['checkContactHopper']);router['put'](_0xef1a('0x15'),auth[_0xef1a('0x8')](),controller[_0xef1a('0x16')]);module[_0xef1a('0x17')]=router; \ No newline at end of file +var _0x224d=['/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','isAuthenticated','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','index','get','/describe','describe'];(function(_0x263a6e,_0x27bf23){var _0x11fa7d=function(_0x58987f){while(--_0x58987f){_0x263a6e['push'](_0x263a6e['shift']());}};_0x11fa7d(++_0x27bf23);}(_0x224d,0x17a));var _0xd224=function(_0x56a3ff,_0x7b6a4f){_0x56a3ff=_0x56a3ff-0x0;var _0x27fc14=_0x224d[_0x56a3ff];return _0x27fc14;};'use strict';var multer=require(_0xd224('0x0'));var util=require(_0xd224('0x1'));var path=require(_0xd224('0x2'));var timeout=require(_0xd224('0x3'));var express=require(_0xd224('0x4'));var router=express[_0xd224('0x5')]();var auth=require(_0xd224('0x6'));var interaction=require(_0xd224('0x7'));var config=require(_0xd224('0x8'));var controller=require(_0xd224('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xd224('0xa')]);router[_0xd224('0xb')](_0xd224('0xc'),auth['isAuthenticated'](),controller[_0xd224('0xd')]);router[_0xd224('0xb')](_0xd224('0xe'),auth['isAuthenticated'](),controller[_0xd224('0xf')]);router[_0xd224('0xb')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0xd224('0x10')]);router[_0xd224('0xb')](_0xd224('0x11'),auth['isAuthenticated'](),controller[_0xd224('0x12')]);router[_0xd224('0x13')](_0xd224('0x14'),auth[_0xd224('0x15')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd224('0x13')](_0xd224('0x16'),auth[_0xd224('0x15')](),controller[_0xd224('0x17')]);router[_0xd224('0x13')](_0xd224('0x18'),auth[_0xd224('0x15')](),controller[_0xd224('0x19')]);router[_0xd224('0x1a')](_0xd224('0xe'),auth[_0xd224('0x15')](),controller[_0xd224('0x1b')]);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 4ff147c..c3f6385 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 _0x0e4c=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x5f0305,_0x4bdfa8){var _0x344ecf=function(_0x4c5d5b){while(--_0x4c5d5b){_0x5f0305['push'](_0x5f0305['shift']());}};_0x344ecf(++_0x4bdfa8);}(_0x0e4c,0x14d));var _0xc0e4=function(_0x591fe3,_0x2b18ea){_0x591fe3=_0x591fe3-0x0;var _0x57c4c4=_0x0e4c[_0x591fe3];return _0x57c4c4;};'use strict';var Sequelize=require(_0xc0e4('0x0'));module[_0xc0e4('0x1')]={'state':{'type':Sequelize[_0xc0e4('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc0e4('0x3')]},'scheduledat':{'type':Sequelize[_0xc0e4('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc0e4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc0e4('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc0e4('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc0e4('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xc0e4('0x3')]},'originatecalleridname':{'type':Sequelize[_0xc0e4('0x3')]},'calleridnum':{'type':Sequelize[_0xc0e4('0x3')]},'calleridname':{'type':Sequelize[_0xc0e4('0x3')]},'starttime':{'type':Sequelize[_0xc0e4('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xc0e4('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xc0e4('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc0e4('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc0e4('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xc0e4('0x3')]},'campaigntype':{'type':Sequelize[_0xc0e4('0x3')]},'membername':{'type':Sequelize[_0xc0e4('0x3')]},'reason':{'type':Sequelize[_0xc0e4('0x3')]},'amd':{'type':Sequelize[_0xc0e4('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xc0e4('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc0e4('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc0e4('0x4')]},'recallme':{'type':Sequelize[_0xc0e4('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc0e4('0x4')]},'edited':{'type':Sequelize[_0xc0e4('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc0e4('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc0e4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8f9a=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0x5357a9,_0xca8d50){var _0x2e4792=function(_0x559cfc){while(--_0x559cfc){_0x5357a9['push'](_0x5357a9['shift']());}};_0x2e4792(++_0xca8d50);}(_0x8f9a,0x198));var _0xa8f9=function(_0x175214,_0x275490){_0x175214=_0x175214-0x0;var _0x33eaf3=_0x8f9a[_0x175214];return _0x33eaf3;};'use strict';var Sequelize=require('sequelize');module[_0xa8f9('0x0')]={'state':{'type':Sequelize[_0xa8f9('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xa8f9('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xa8f9('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa8f9('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa8f9('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa8f9('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xa8f9('0x2')]},'originatecalleridname':{'type':Sequelize[_0xa8f9('0x2')]},'calleridnum':{'type':Sequelize[_0xa8f9('0x2')]},'calleridname':{'type':Sequelize[_0xa8f9('0x2')]},'starttime':{'type':Sequelize[_0xa8f9('0x3')]},'responsetime':{'type':Sequelize[_0xa8f9('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xa8f9('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa8f9('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa8f9('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa8f9('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa8f9('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xa8f9('0x2')]},'campaign':{'type':Sequelize[_0xa8f9('0x2')]},'campaigntype':{'type':Sequelize[_0xa8f9('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xa8f9('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa8f9('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xa8f9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa8f9('0x3')]},'recallme':{'type':Sequelize[_0xa8f9('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xa8f9('0x3')]},'edited':{'type':Sequelize[_0xa8f9('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa8f9('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa8f9('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa8f9('0x1')],'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 917f522..f2a409a 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 _0xe155=['../../config/license/util','../../mysqldb','status','end','json','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','CmHopperHistory','fieldName','type','key','model','map','keys','intersection','query','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','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','../../config/logger','api','../../config/environment'];(function(_0x3a6542,_0x40ab75){var _0x18e552=function(_0x404da1){while(--_0x404da1){_0x3a6542['push'](_0x3a6542['shift']());}};_0x18e552(++_0x40ab75);}(_0xe155,0x85));var _0x5e15=function(_0x32e085,_0x5c855f){_0x32e085=_0x32e085-0x0;var _0xd86c0=_0xe155[_0x32e085];return _0xd86c0;};'use strict';var pdf=require(_0x5e15('0x0'));var emlformat=require(_0x5e15('0x1'));var rimraf=require(_0x5e15('0x2'));var zipdir=require(_0x5e15('0x3'));var jsonpatch=require(_0x5e15('0x4'));var rp=require(_0x5e15('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5e15('0x6'));var util=require(_0x5e15('0x7'));var path=require(_0x5e15('0x8'));var sox=require(_0x5e15('0x9'));var csv=require(_0x5e15('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5e15('0xb'));var crypto=require(_0x5e15('0xc'));var jsforce=require(_0x5e15('0xd'));var deskjs=require(_0x5e15('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5e15('0xf'));var Papa=require(_0x5e15('0x10'));var Redis=require(_0x5e15('0x11'));var authService=require(_0x5e15('0x12'));var qs=require(_0x5e15('0x13'));var as=require(_0x5e15('0x14'));var hardwareService=require(_0x5e15('0x15'));var logger=require(_0x5e15('0x16'))(_0x5e15('0x17'));var utils=require('../../config/utils');var config=require(_0x5e15('0x18'));var licenseUtil=require(_0x5e15('0x19'));var db=require(_0x5e15('0x1a'))['db'];function respondWithStatusCode(_0x18c64a,_0x68be2a){_0x68be2a=_0x68be2a||0xcc;return function(_0x7205ba){if(_0x7205ba){return _0x18c64a['sendStatus'](_0x68be2a);}return _0x18c64a[_0x5e15('0x1b')](_0x68be2a)[_0x5e15('0x1c')]();};}function respondWithResult(_0x4d8ee0,_0x47d041){_0x47d041=_0x47d041||0xc8;return function(_0x124557){if(_0x124557){return _0x4d8ee0[_0x5e15('0x1b')](_0x47d041)[_0x5e15('0x1d')](_0x124557);}};}function respondWithFilteredResult(_0x23c0ed,_0x596e1d){return function(_0x5db275){if(_0x5db275){var _0x337e85=_0x5db275[_0x5e15('0x1e')],_0x16f0a7=_0x596e1d['offset'],_0x1c3509=_0x596e1d['offset']+_0x596e1d[_0x5e15('0x1f')],_0xef1b59;if(_0x1c3509>=_0x337e85){_0x1c3509=_0x337e85;_0xef1b59=0xc8;}else{_0xef1b59=0xce;}_0x23c0ed['status'](_0xef1b59);return _0x23c0ed[_0x5e15('0x20')](_0x5e15('0x21'),_0x16f0a7+'-'+_0x1c3509+'/'+_0x337e85)[_0x5e15('0x1d')](_0x5db275);}return null;};}function patchUpdates(_0xb06620){return function(_0x4dbe91){try{jsonpatch['apply'](_0x4dbe91,_0xb06620,!![]);}catch(_0x13d1ab){return BPromise[_0x5e15('0x22')](_0x13d1ab);}return _0x4dbe91[_0x5e15('0x23')]();};}function saveUpdates(_0x12f625,_0x425eea){return function(_0x3ad931){if(_0x3ad931){return _0x3ad931[_0x5e15('0x24')](_0x12f625)[_0x5e15('0x25')](function(_0x1cb497){return _0x1cb497;});}return null;};}function removeEntity(_0xf6e520,_0x1b89b0){return function(_0x59c87d){if(_0x59c87d){return _0x59c87d[_0x5e15('0x26')]()[_0x5e15('0x25')](function(){_0xf6e520['status'](0xcc)[_0x5e15('0x1c')]();});}};}function handleEntityNotFound(_0x3a2478,_0xbab6a3){return function(_0x216a15){if(!_0x216a15){_0x3a2478[_0x5e15('0x27')](0x194);}return _0x216a15;};}function handleError(_0x56142e,_0x578d00){_0x578d00=_0x578d00||0x1f4;return function(_0x738aa8){logger[_0x5e15('0x28')](_0x738aa8[_0x5e15('0x29')]);if(_0x738aa8[_0x5e15('0x2a')]){delete _0x738aa8[_0x5e15('0x2a')];}_0x56142e[_0x5e15('0x1b')](_0x578d00)[_0x5e15('0x2b')](_0x738aa8);};}exports[_0x5e15('0x2c')]=function(_0x142455,_0x17b1eb){var _0x2be5c6={},_0x295b22={},_0xb1fdd7={'count':0x0,'rows':[]};var _0x1209d=_['map'](db[_0x5e15('0x2d')]['rawAttributes'],function(_0x158858){return{'name':_0x158858[_0x5e15('0x2e')],'type':_0x158858[_0x5e15('0x2f')][_0x5e15('0x30')]};});_0x295b22[_0x5e15('0x31')]=_[_0x5e15('0x32')](_0x1209d,_0x5e15('0x2a'));_0x295b22['query']=_[_0x5e15('0x33')](_0x142455['query']);_0x295b22['filters']=_[_0x5e15('0x34')](_0x295b22['model'],_0x295b22[_0x5e15('0x35')]);_0x2be5c6[_0x5e15('0x36')]=_['intersection'](_0x295b22['model'],qs['fields'](_0x142455[_0x5e15('0x35')]['fields']));_0x2be5c6[_0x5e15('0x36')]=_0x2be5c6[_0x5e15('0x36')]['length']?_0x2be5c6['attributes']:_0x295b22[_0x5e15('0x31')];if(!_0x142455['query'][_0x5e15('0x37')](_0x5e15('0x38'))){_0x2be5c6['limit']=qs[_0x5e15('0x1f')](_0x142455[_0x5e15('0x35')][_0x5e15('0x1f')]);_0x2be5c6[_0x5e15('0x39')]=qs[_0x5e15('0x39')](_0x142455[_0x5e15('0x35')]['offset']);}_0x2be5c6[_0x5e15('0x3a')]=qs[_0x5e15('0x3b')](_0x142455[_0x5e15('0x35')]['sort']);_0x2be5c6[_0x5e15('0x3c')]=qs[_0x5e15('0x3d')](_[_0x5e15('0x3e')](_0x142455['query'],_0x295b22[_0x5e15('0x3d')]),_0x1209d);if(_0x142455[_0x5e15('0x35')][_0x5e15('0x3f')]){_0x2be5c6['where']=_[_0x5e15('0x40')](_0x2be5c6[_0x5e15('0x3c')],{'$or':_[_0x5e15('0x32')](_0x1209d,function(_0x2ba478){if(_0x2ba478[_0x5e15('0x2f')]!=='VIRTUAL'){var _0x1e8d12={};_0x1e8d12[_0x2ba478['name']]={'$like':'%'+_0x142455[_0x5e15('0x35')][_0x5e15('0x3f')]+'%'};return _0x1e8d12;}})});}_0x2be5c6=_[_0x5e15('0x40')]({},_0x2be5c6,_0x142455[_0x5e15('0x41')]);var _0x5d1b5a={'where':_0x2be5c6[_0x5e15('0x3c')]};return db[_0x5e15('0x2d')][_0x5e15('0x1e')](_0x5d1b5a)['then'](function(_0xb2780){_0xb1fdd7[_0x5e15('0x1e')]=_0xb2780;if(_0x142455[_0x5e15('0x35')][_0x5e15('0x42')]){_0x2be5c6['include']=[{'all':!![]}];}return db[_0x5e15('0x2d')][_0x5e15('0x43')](_0x2be5c6);})['then'](function(_0x3df05c){_0xb1fdd7[_0x5e15('0x44')]=_0x3df05c;return _0xb1fdd7;})[_0x5e15('0x25')](respondWithFilteredResult(_0x17b1eb,_0x2be5c6))[_0x5e15('0x45')](handleError(_0x17b1eb,null));};exports[_0x5e15('0x46')]=function(_0x500625,_0x8bad60){var _0x364fc4={'raw':!![],'where':{'id':_0x500625[_0x5e15('0x47')]['id']}},_0x1d0db7={};_0x1d0db7['model']=_['keys'](db[_0x5e15('0x2d')][_0x5e15('0x48')]);_0x1d0db7[_0x5e15('0x35')]=_[_0x5e15('0x33')](_0x500625[_0x5e15('0x35')]);_0x1d0db7[_0x5e15('0x3d')]=_[_0x5e15('0x34')](_0x1d0db7[_0x5e15('0x31')],_0x1d0db7['query']);_0x364fc4[_0x5e15('0x36')]=_[_0x5e15('0x34')](_0x1d0db7['model'],qs['fields'](_0x500625['query']['fields']));_0x364fc4[_0x5e15('0x36')]=_0x364fc4['attributes'][_0x5e15('0x49')]?_0x364fc4[_0x5e15('0x36')]:_0x1d0db7[_0x5e15('0x31')];if(_0x500625['query']['includeAll']){_0x364fc4[_0x5e15('0x4a')]=[{'all':!![]}];}_0x364fc4=_[_0x5e15('0x40')]({},_0x364fc4,_0x500625['options']);return db[_0x5e15('0x2d')][_0x5e15('0x4b')](_0x364fc4)['then'](handleEntityNotFound(_0x8bad60,null))[_0x5e15('0x25')](respondWithResult(_0x8bad60,null))[_0x5e15('0x45')](handleError(_0x8bad60,null));};exports[_0x5e15('0x4c')]=function(_0x596158,_0x17c703){return db[_0x5e15('0x2d')][_0x5e15('0x4c')](_0x596158['body'],{})[_0x5e15('0x25')](respondWithResult(_0x17c703,0xc9))['catch'](handleError(_0x17c703,null));};exports['describe']=function(_0x510bd7,_0xe8f771){return db[_0x5e15('0x2d')]['describe']()[_0x5e15('0x25')](respondWithResult(_0xe8f771,null))[_0x5e15('0x45')](handleError(_0xe8f771,null));};exports['update']=function(_0x4ce4b0,_0x91e2e5){if(_0x4ce4b0[_0x5e15('0x4d')][_0x5e15('0x4e')]){delete _0x4ce4b0[_0x5e15('0x4d')][_0x5e15('0x4e')];}return db[_0x5e15('0x2d')][_0x5e15('0x4b')]({'where':{'uniqueid':_0x4ce4b0[_0x5e15('0x47')]['id']}})[_0x5e15('0x25')](handleEntityNotFound(_0x91e2e5,null))[_0x5e15('0x25')](saveUpdates(_0x4ce4b0[_0x5e15('0x4d')],null))['then'](respondWithResult(_0x91e2e5,null))['catch'](handleError(_0x91e2e5,null));}; \ No newline at end of file +var _0xb573=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','length','catch','create','body','describe','uniqueid','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','error','name','send','index','map','CmHopperHistory','rawAttributes','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xb573,0x18c));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x3b57('0x0'));var emlformat=require(_0x3b57('0x1'));var rimraf=require(_0x3b57('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b57('0x3'));var moment=require('moment');var BPromise=require(_0x3b57('0x4'));var Mustache=require(_0x3b57('0x5'));var util=require(_0x3b57('0x6'));var path=require('path');var sox=require(_0x3b57('0x7'));var csv=require(_0x3b57('0x8'));var ejs=require(_0x3b57('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b57('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3b57('0xb'));var toCsv=require(_0x3b57('0x8'));var querystring=require(_0x3b57('0xc'));var Papa=require('papaparse');var Redis=require(_0x3b57('0xd'));var authService=require(_0x3b57('0xe'));var qs=require(_0x3b57('0xf'));var as=require(_0x3b57('0x10'));var hardwareService=require(_0x3b57('0x11'));var logger=require(_0x3b57('0x12'))(_0x3b57('0x13'));var utils=require(_0x3b57('0x14'));var config=require(_0x3b57('0x15'));var licenseUtil=require(_0x3b57('0x16'));var db=require(_0x3b57('0x17'))['db'];function respondWithStatusCode(_0x31603c,_0x143cd7){_0x143cd7=_0x143cd7||0xcc;return function(_0x3c2f3d){if(_0x3c2f3d){return _0x31603c[_0x3b57('0x18')](_0x143cd7);}return _0x31603c[_0x3b57('0x19')](_0x143cd7)[_0x3b57('0x1a')]();};}function respondWithResult(_0x391797,_0x49fbeb){_0x49fbeb=_0x49fbeb||0xc8;return function(_0x3626a9){if(_0x3626a9){return _0x391797[_0x3b57('0x19')](_0x49fbeb)['json'](_0x3626a9);}};}function respondWithFilteredResult(_0x41ab2a,_0x50171){return function(_0x1af032){if(_0x1af032){var _0x3cad32=_0x1af032[_0x3b57('0x1b')],_0x2437fd=_0x50171[_0x3b57('0x1c')],_0x57820c=_0x50171['offset']+_0x50171[_0x3b57('0x1d')],_0x5328de;if(_0x57820c>=_0x3cad32){_0x57820c=_0x3cad32;_0x5328de=0xc8;}else{_0x5328de=0xce;}_0x41ab2a[_0x3b57('0x19')](_0x5328de);return _0x41ab2a[_0x3b57('0x1e')](_0x3b57('0x1f'),_0x2437fd+'-'+_0x57820c+'/'+_0x3cad32)[_0x3b57('0x20')](_0x1af032);}return null;};}function patchUpdates(_0x59442b){return function(_0x47dd7e){try{jsonpatch[_0x3b57('0x21')](_0x47dd7e,_0x59442b,!![]);}catch(_0x30bf77){return BPromise[_0x3b57('0x22')](_0x30bf77);}return _0x47dd7e[_0x3b57('0x23')]();};}function saveUpdates(_0x37879b,_0x246ed0){return function(_0x6944ab){if(_0x6944ab){return _0x6944ab[_0x3b57('0x24')](_0x37879b)['then'](function(_0x1f8831){return _0x1f8831;});}return null;};}function removeEntity(_0x5ae266,_0x359f5f){return function(_0x3612ee){if(_0x3612ee){return _0x3612ee[_0x3b57('0x25')]()[_0x3b57('0x26')](function(){_0x5ae266[_0x3b57('0x19')](0xcc)[_0x3b57('0x1a')]();});}};}function handleEntityNotFound(_0x13b620,_0x5e67f6){return function(_0x59a883){if(!_0x59a883){_0x13b620[_0x3b57('0x18')](0x194);}return _0x59a883;};}function handleError(_0x441bd5,_0x1f2601){_0x1f2601=_0x1f2601||0x1f4;return function(_0x1dfd7b){logger[_0x3b57('0x27')](_0x1dfd7b['stack']);if(_0x1dfd7b[_0x3b57('0x28')]){delete _0x1dfd7b[_0x3b57('0x28')];}_0x441bd5[_0x3b57('0x19')](_0x1f2601)[_0x3b57('0x29')](_0x1dfd7b);};}exports[_0x3b57('0x2a')]=function(_0x27a901,_0x30b6a8){var _0x6e135={},_0x57a213={},_0x47d790={'count':0x0,'rows':[]};var _0xf3ffda=_[_0x3b57('0x2b')](db[_0x3b57('0x2c')][_0x3b57('0x2d')],function(_0x5eb5ff){return{'name':_0x5eb5ff['fieldName'],'type':_0x5eb5ff[_0x3b57('0x2e')][_0x3b57('0x2f')]};});_0x57a213['model']=_[_0x3b57('0x2b')](_0xf3ffda,_0x3b57('0x28'));_0x57a213[_0x3b57('0x30')]=_[_0x3b57('0x31')](_0x27a901[_0x3b57('0x30')]);_0x57a213[_0x3b57('0x32')]=_['intersection'](_0x57a213[_0x3b57('0x33')],_0x57a213['query']);_0x6e135[_0x3b57('0x34')]=_['intersection'](_0x57a213[_0x3b57('0x33')],qs[_0x3b57('0x35')](_0x27a901[_0x3b57('0x30')]['fields']));_0x6e135['attributes']=_0x6e135[_0x3b57('0x34')]['length']?_0x6e135['attributes']:_0x57a213[_0x3b57('0x33')];if(!_0x27a901[_0x3b57('0x30')][_0x3b57('0x36')](_0x3b57('0x37'))){_0x6e135['limit']=qs[_0x3b57('0x1d')](_0x27a901[_0x3b57('0x30')]['limit']);_0x6e135[_0x3b57('0x1c')]=qs[_0x3b57('0x1c')](_0x27a901[_0x3b57('0x30')][_0x3b57('0x1c')]);}_0x6e135[_0x3b57('0x38')]=qs['sort'](_0x27a901[_0x3b57('0x30')]['sort']);_0x6e135[_0x3b57('0x39')]=qs[_0x3b57('0x32')](_[_0x3b57('0x3a')](_0x27a901['query'],_0x57a213[_0x3b57('0x32')]),_0xf3ffda);if(_0x27a901[_0x3b57('0x30')][_0x3b57('0x3b')]){_0x6e135['where']=_[_0x3b57('0x3c')](_0x6e135[_0x3b57('0x39')],{'$or':_[_0x3b57('0x2b')](_0xf3ffda,function(_0x5ccec0){if(_0x5ccec0[_0x3b57('0x2e')]!==_0x3b57('0x3d')){var _0x545806={};_0x545806[_0x5ccec0[_0x3b57('0x28')]]={'$like':'%'+_0x27a901[_0x3b57('0x30')][_0x3b57('0x3b')]+'%'};return _0x545806;}})});}_0x6e135=_[_0x3b57('0x3c')]({},_0x6e135,_0x27a901[_0x3b57('0x3e')]);var _0x24620a={'where':_0x6e135['where']};return db[_0x3b57('0x2c')]['count'](_0x24620a)[_0x3b57('0x26')](function(_0x3f6d29){_0x47d790[_0x3b57('0x1b')]=_0x3f6d29;if(_0x27a901[_0x3b57('0x30')][_0x3b57('0x3f')]){_0x6e135[_0x3b57('0x40')]=[{'all':!![]}];}return db[_0x3b57('0x2c')][_0x3b57('0x41')](_0x6e135);})[_0x3b57('0x26')](function(_0x228261){_0x47d790[_0x3b57('0x42')]=_0x228261;return _0x47d790;})['then'](respondWithFilteredResult(_0x30b6a8,_0x6e135))['catch'](handleError(_0x30b6a8,null));};exports[_0x3b57('0x43')]=function(_0x211d26,_0x197c85){var _0x4f4f50={'raw':!![],'where':{'id':_0x211d26['params']['id']}},_0x86dacb={};_0x86dacb[_0x3b57('0x33')]=_[_0x3b57('0x31')](db[_0x3b57('0x2c')][_0x3b57('0x2d')]);_0x86dacb[_0x3b57('0x30')]=_['keys'](_0x211d26['query']);_0x86dacb[_0x3b57('0x32')]=_[_0x3b57('0x44')](_0x86dacb[_0x3b57('0x33')],_0x86dacb[_0x3b57('0x30')]);_0x4f4f50[_0x3b57('0x34')]=_[_0x3b57('0x44')](_0x86dacb[_0x3b57('0x33')],qs[_0x3b57('0x35')](_0x211d26['query'][_0x3b57('0x35')]));_0x4f4f50[_0x3b57('0x34')]=_0x4f4f50['attributes'][_0x3b57('0x45')]?_0x4f4f50[_0x3b57('0x34')]:_0x86dacb[_0x3b57('0x33')];if(_0x211d26[_0x3b57('0x30')]['includeAll']){_0x4f4f50[_0x3b57('0x40')]=[{'all':!![]}];}_0x4f4f50=_[_0x3b57('0x3c')]({},_0x4f4f50,_0x211d26[_0x3b57('0x3e')]);return db['CmHopperHistory']['find'](_0x4f4f50)[_0x3b57('0x26')](handleEntityNotFound(_0x197c85,null))[_0x3b57('0x26')](respondWithResult(_0x197c85,null))[_0x3b57('0x46')](handleError(_0x197c85,null));};exports[_0x3b57('0x47')]=function(_0x4bff93,_0x4af4c1){return db['CmHopperHistory'][_0x3b57('0x47')](_0x4bff93[_0x3b57('0x48')],{})[_0x3b57('0x26')](respondWithResult(_0x4af4c1,0xc9))[_0x3b57('0x46')](handleError(_0x4af4c1,null));};exports[_0x3b57('0x49')]=function(_0x299858,_0x1b85e0){return db[_0x3b57('0x2c')][_0x3b57('0x49')]()[_0x3b57('0x26')](respondWithResult(_0x1b85e0,null))[_0x3b57('0x46')](handleError(_0x1b85e0,null));};exports[_0x3b57('0x24')]=function(_0x34a8c9,_0x4b6940){if(_0x34a8c9[_0x3b57('0x48')][_0x3b57('0x4a')]){delete _0x34a8c9[_0x3b57('0x48')][_0x3b57('0x4a')];}return db['CmHopperHistory'][_0x3b57('0x4b')]({'where':{'uniqueid':_0x34a8c9['params']['id']}})[_0x3b57('0x26')](handleEntityNotFound(_0x4b6940,null))[_0x3b57('0x26')](saveUpdates(_0x34a8c9[_0x3b57('0x48')],null))[_0x3b57('0x26')](respondWithResult(_0x4b6940,null))[_0x3b57('0x46')](handleError(_0x4b6940,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 83aa8a2..877c34b 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 _0x6637=['../../config/logger','api','path','rimraf','./cmHopperHistory.attributes','exports','define','cm_hopper_history','uniqueid','lodash'];(function(_0x478861,_0x5abe2f){var _0x1eacc7=function(_0x59dd7b){while(--_0x59dd7b){_0x478861['push'](_0x478861['shift']());}};_0x1eacc7(++_0x5abe2f);}(_0x6637,0x171));var _0x7663=function(_0x44d5d5,_0x141f31){_0x44d5d5=_0x44d5d5-0x0;var _0x3cfa49=_0x6637[_0x44d5d5];return _0x3cfa49;};'use strict';var _=require(_0x7663('0x0'));var util=require('util');var logger=require(_0x7663('0x1'))(_0x7663('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7663('0x3'));var rimraf=require(_0x7663('0x4'));var config=require('../../config/environment');var attributes=require(_0x7663('0x5'));module[_0x7663('0x6')]=function(_0x57992b,_0x4755f1){return _0x57992b[_0x7663('0x7')]('CmHopperHistory',attributes,{'tableName':_0x7663('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x7663('0x9'),'fields':[_0x7663('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe4b7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger'];(function(_0xda3f93,_0x4ee901){var _0x402dde=function(_0x2529c5){while(--_0x2529c5){_0xda3f93['push'](_0xda3f93['shift']());}};_0x402dde(++_0x4ee901);}(_0xe4b7,0x97));var _0x7e4b=function(_0x3d71a3,_0x3a33b7){_0x3d71a3=_0x3d71a3-0x0;var _0x5bb3ab=_0xe4b7[_0x3d71a3];return _0x5bb3ab;};'use strict';var _=require(_0x7e4b('0x0'));var util=require(_0x7e4b('0x1'));var logger=require(_0x7e4b('0x2'))(_0x7e4b('0x3'));var moment=require(_0x7e4b('0x4'));var BPromise=require(_0x7e4b('0x5'));var rp=require(_0x7e4b('0x6'));var fs=require('fs');var path=require(_0x7e4b('0x7'));var rimraf=require(_0x7e4b('0x8'));var config=require(_0x7e4b('0x9'));var attributes=require(_0x7e4b('0xa'));module['exports']=function(_0x2cd10d,_0x5a6a56){return _0x2cd10d['define']('CmHopperHistory',attributes,{'tableName':_0x7e4b('0xb'),'paranoid':![],'indexes':[{'name':_0x7e4b('0xc'),'fields':[_0x7e4b('0xc')]},{'name':'uniqueid','fields':[_0x7e4b('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 e462f79..f926d7d 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 _0xf539=['predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null'];(function(_0x1eb786,_0x1b5f72){var _0x460cad=function(_0x3ec7a6){while(--_0x3ec7a6){_0x1eb786['push'](_0x1eb786['shift']());}};_0x460cad(++_0x1b5f72);}(_0xf539,0xa7));var _0x9f53=function(_0x269bf5,_0x15aeea){_0x269bf5=_0x269bf5-0x0;var _0x2a4e29=_0xf539[_0x269bf5];return _0x2a4e29;};'use strict';var _=require(_0x9f53('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f53('0x1'));var fs=require('fs');var Redis=require(_0x9f53('0x2'));var db=require(_0x9f53('0x3'))['db'];var utils=require(_0x9f53('0x4'));var logger=require(_0x9f53('0x5'))('rpc');var config=require(_0x9f53('0x6'));var jayson=require(_0x9f53('0x7'));var client=jayson[_0x9f53('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x518e29,_0x28c2f2,_0x530e7e){return new BPromise(function(_0x419ab8,_0x24e5ca){return client[_0x9f53('0x9')](_0x518e29,_0x530e7e)[_0x9f53('0xa')](function(_0x13817b){logger['info'](_0x9f53('0xb'),_0x28c2f2,_0x9f53('0xc'));logger[_0x9f53('0xd')](_0x9f53('0xe'),_0x28c2f2,'request\x20sent',JSON[_0x9f53('0xf')](_0x13817b));if(_0x13817b[_0x9f53('0x10')]){if(_0x13817b[_0x9f53('0x10')][_0x9f53('0x11')]===0x1f4){logger[_0x9f53('0x10')](_0x9f53('0xb'),_0x28c2f2,_0x13817b['error'][_0x9f53('0x12')]);return _0x24e5ca(_0x13817b['error'][_0x9f53('0x12')]);}logger[_0x9f53('0x10')](_0x9f53('0xb'),_0x28c2f2,_0x13817b[_0x9f53('0x10')][_0x9f53('0x12')]);return _0x419ab8(_0x13817b[_0x9f53('0x10')]['message']);}else{logger[_0x9f53('0x13')](_0x9f53('0xb'),_0x28c2f2,'request\x20sent');_0x419ab8(_0x13817b[_0x9f53('0x14')][_0x9f53('0x12')]);}})[_0x9f53('0x15')](function(_0x2534de){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x28c2f2,_0x2534de);_0x24e5ca(_0x2534de);});});}exports[_0x9f53('0x16')]=function(_0x28144f){var _0x5ba5fd=this;return new Promise(function(_0x766ee9,_0x52ed55){return db[_0x9f53('0x17')][_0x9f53('0x18')](_0x28144f[_0x9f53('0x19')],{'raw':_0x28144f['options']?_0x28144f[_0x9f53('0x1a')][_0x9f53('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4fb77f){logger[_0x9f53('0x13')]('CreateCmHopperHistory',_0x28144f);logger[_0x9f53('0xd')](_0x9f53('0x16'),_0x28144f,JSON[_0x9f53('0xf')](_0x4fb77f));_0x766ee9(_0x4fb77f);})[_0x9f53('0x15')](function(_0x293643){logger[_0x9f53('0x10')](_0x9f53('0x16'),_0x293643[_0x9f53('0x12')],_0x28144f);_0x52ed55(_0x5ba5fd[_0x9f53('0x10')](0x1f4,_0x293643[_0x9f53('0x12')]));});});};exports[_0x9f53('0x1c')]=function(_0x4f026a){var _0x5ddb0c=this;return new Promise(function(_0x2d0cea,_0x5b4134){return db['CmHopperHistory'][_0x9f53('0x1d')]({'raw':_0x4f026a[_0x9f53('0x1a')]?_0x4f026a['options'][_0x9f53('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f026a[_0x9f53('0x1a')]?_0x4f026a[_0x9f53('0x1a')][_0x9f53('0x1e')]||null:null,'attributes':[[db[_0x9f53('0x1f')]['fn']('COUNT',db[_0x9f53('0x1f')][_0x9f53('0x20')]('id')),_0x9f53('0x21')],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')][_0x9f53('0x23')](_0x9f53('0x24')))),_0x9f53('0x25')],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')][_0x9f53('0x23')]('`state`\x20=\x2010,\x201,\x20null'))),_0x9f53('0x26')],[db[_0x9f53('0x1f')]['fn']('COUNT',db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')]['literal'](_0x9f53('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x28'),db['sequelize']['fn']('IF',db[_0x9f53('0x1f')]['literal'](_0x9f53('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x28'),db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')][_0x9f53('0x23')](_0x9f53('0x2a')))),_0x9f53('0x2b')]]})['then'](function(_0x3b037b){logger[_0x9f53('0x13')]('AvgHandleTime',_0x4f026a);logger[_0x9f53('0xd')](_0x9f53('0x1c'),_0x4f026a,JSON[_0x9f53('0xf')](_0x3b037b));_0x2d0cea(_0x3b037b);})['catch'](function(_0xc01f44){logger[_0x9f53('0x10')](_0x9f53('0x1c'),_0xc01f44[_0x9f53('0x12')],_0x4f026a);_0x5b4134(_0x5ddb0c[_0x9f53('0x10')](0x1f4,_0xc01f44[_0x9f53('0x12')]));});});};exports[_0x9f53('0x2c')]=function(_0x52a4ae){var _0x15bab4=this;return new Promise(function(_0x539bfc,_0x4b603a){return db[_0x9f53('0x17')][_0x9f53('0x1d')]({'raw':_0x52a4ae['options']?_0x52a4ae['options'][_0x9f53('0x1b')]===undefined?!![]:![]:!![],'where':_0x52a4ae[_0x9f53('0x1a')]?_0x52a4ae[_0x9f53('0x1a')][_0x9f53('0x1e')]||null:null,'attributes':[[_0x9f53('0x2d'),_0x9f53('0x2e')],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x9f53('0x2f')))),_0x9f53('0x30')],[db['sequelize']['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')][_0x9f53('0x23')](_0x9f53('0x31')))),_0x9f53('0x32')],[db['sequelize']['fn'](_0x9f53('0x22'),db['sequelize']['fn']('IF',db[_0x9f53('0x1f')][_0x9f53('0x23')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db['sequelize'][_0x9f53('0x23')](_0x9f53('0x33')))),'outboundBusyCallsDay'],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')]['literal'](_0x9f53('0x34')))),_0x9f53('0x35')],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')][_0x9f53('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')][_0x9f53('0x23')](_0x9f53('0x36')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn']('COUNT',db[_0x9f53('0x1f')]['fn']('IF',db['sequelize'][_0x9f53('0x23')](_0x9f53('0x37')))),'outboundUnknownCallsDay'],[db[_0x9f53('0x1f')]['fn']('COUNT',db[_0x9f53('0x1f')]['fn']('IF',db['sequelize'][_0x9f53('0x23')](_0x9f53('0x38')))),_0x9f53('0x39')],[db['sequelize']['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')]['literal'](_0x9f53('0x3a')))),_0x9f53('0x3b')],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')][_0x9f53('0x23')](_0x9f53('0x3c')))),_0x9f53('0x3d')],[db['sequelize']['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db['sequelize'][_0x9f53('0x23')](_0x9f53('0x3e')))),_0x9f53('0x3f')],[db['sequelize']['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')]['fn']('IF',db['sequelize'][_0x9f53('0x23')](_0x9f53('0x40')))),_0x9f53('0x3d')],[db[_0x9f53('0x1f')]['fn']('COUNT',db[_0x9f53('0x1f')]['fn']('IF',db[_0x9f53('0x1f')][_0x9f53('0x23')](_0x9f53('0x41')))),_0x9f53('0x42')]],'group':[_0x9f53('0x2d')]})[_0x9f53('0xa')](function(_0x5d072c){logger[_0x9f53('0x13')](_0x9f53('0x2c'),_0x52a4ae);logger[_0x9f53('0xd')](_0x9f53('0x2c'),_0x52a4ae,JSON[_0x9f53('0xf')](_0x5d072c));_0x539bfc(_0x5d072c);})[_0x9f53('0x15')](function(_0x16810e){logger[_0x9f53('0x10')](_0x9f53('0x2c'),_0x16810e[_0x9f53('0x12')],_0x52a4ae);_0x4b603a(_0x15bab4[_0x9f53('0x10')](0x1f4,_0x16810e['message']));});});};exports['GetCampaignHopperHistory']=function(_0x5cf68b){var _0x5e186c=this;return new Promise(function(_0xeae898,_0x1f350e){return db[_0x9f53('0x17')][_0x9f53('0x1d')]({'raw':_0x5cf68b[_0x9f53('0x1a')]?_0x5cf68b['options'][_0x9f53('0x1b')]===undefined?!![]:![]:!![],'where':_0x5cf68b[_0x9f53('0x1a')]?_0x5cf68b[_0x9f53('0x1a')][_0x9f53('0x1e')]||null:null,'attributes':[['campaign',_0x9f53('0x2e')],[db[_0x9f53('0x1f')]['fn'](_0x9f53('0x22'),db[_0x9f53('0x1f')][_0x9f53('0x20')]('id')),_0x9f53('0x43')],[db[_0x9f53('0x1f')]['fn']('COUNT',db[_0x9f53('0x1f')]['fn']('IF',db['sequelize'][_0x9f53('0x23')](_0x9f53('0x24')))),_0x9f53('0x44')]],'group':[_0x9f53('0x2d')]})[_0x9f53('0xa')](function(_0x4a2670){logger[_0x9f53('0x13')](_0x9f53('0x45'),_0x5cf68b);logger[_0x9f53('0xd')](_0x9f53('0x45'),_0x5cf68b,JSON['stringify'](_0x4a2670));_0xeae898(_0x4a2670);})[_0x9f53('0x15')](function(_0x55c696){logger[_0x9f53('0x10')](_0x9f53('0x45'),_0x55c696[_0x9f53('0x12')],_0x5cf68b);_0x1f350e(_0x5e186c['error'](0x1f4,_0x55c696[_0x9f53('0x12')]));});});}; \ No newline at end of file +var _0xf25a=['`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','debug','stringify','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','raw','campaign','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xf25a,0xa5));var _0xaf25=function(_0x546cda,_0x51f77d){_0x546cda=_0x546cda-0x0;var _0x14e67c=_0xf25a[_0x546cda];return _0x14e67c;};'use strict';var _=require(_0xaf25('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaf25('0x1'));var rs=require(_0xaf25('0x2'));var fs=require('fs');var Redis=require(_0xaf25('0x3'));var db=require(_0xaf25('0x4'))['db'];var utils=require(_0xaf25('0x5'));var logger=require(_0xaf25('0x6'))(_0xaf25('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf25('0x8'));var client=jayson[_0xaf25('0x9')][_0xaf25('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c8182,_0x13daaf,_0xf7f92a){return new BPromise(function(_0x282b58,_0x2fa4f7){return client[_0xaf25('0xb')](_0x4c8182,_0xf7f92a)[_0xaf25('0xc')](function(_0x3485d0){logger['info'](_0xaf25('0xd'),_0x13daaf,_0xaf25('0xe'));logger['debug'](_0xaf25('0xf'),_0x13daaf,_0xaf25('0xe'),JSON['stringify'](_0x3485d0));if(_0x3485d0[_0xaf25('0x10')]){if(_0x3485d0['error'][_0xaf25('0x11')]===0x1f4){logger['error'](_0xaf25('0xd'),_0x13daaf,_0x3485d0[_0xaf25('0x10')][_0xaf25('0x12')]);return _0x2fa4f7(_0x3485d0[_0xaf25('0x10')][_0xaf25('0x12')]);}logger[_0xaf25('0x10')](_0xaf25('0xd'),_0x13daaf,_0x3485d0[_0xaf25('0x10')][_0xaf25('0x12')]);return _0x282b58(_0x3485d0[_0xaf25('0x10')][_0xaf25('0x12')]);}else{logger[_0xaf25('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x13daaf,_0xaf25('0xe'));_0x282b58(_0x3485d0[_0xaf25('0x14')][_0xaf25('0x12')]);}})[_0xaf25('0x15')](function(_0x567caf){logger[_0xaf25('0x10')](_0xaf25('0xd'),_0x13daaf,_0x567caf);_0x2fa4f7(_0x567caf);});});}exports[_0xaf25('0x16')]=function(_0x228b10){var _0x2e86a9=this;return new Promise(function(_0x1d5393,_0x5d0fc8){return db[_0xaf25('0x17')][_0xaf25('0x18')](_0x228b10[_0xaf25('0x19')],{'raw':_0x228b10[_0xaf25('0x1a')]?_0x228b10['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x32981d){logger[_0xaf25('0x13')](_0xaf25('0x16'),_0x228b10);logger[_0xaf25('0x1b')](_0xaf25('0x16'),_0x228b10,JSON[_0xaf25('0x1c')](_0x32981d));_0x1d5393(_0x32981d);})['catch'](function(_0x38c121){logger['error']('CreateCmHopperHistory',_0x38c121[_0xaf25('0x12')],_0x228b10);_0x5d0fc8(_0x2e86a9[_0xaf25('0x10')](0x1f4,_0x38c121[_0xaf25('0x12')]));});});};exports['AvgHandleTime']=function(_0x376a19){var _0x49296c=this;return new Promise(function(_0x45ca89,_0xd5031d){return db[_0xaf25('0x17')][_0xaf25('0x1d')]({'raw':_0x376a19['options']?_0x376a19[_0xaf25('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x376a19[_0xaf25('0x1a')]?_0x376a19[_0xaf25('0x1a')][_0xaf25('0x1e')]||null:null,'attributes':[[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')][_0xaf25('0x21')]('id')),_0xaf25('0x22')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x24')))),_0xaf25('0x25')],[db['sequelize']['fn'](_0xaf25('0x20'),db['sequelize']['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')]('`state`\x20=\x2010,\x201,\x20null'))),_0xaf25('0x26')],[db[_0xaf25('0x1f')]['fn']('COUNT',db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x27')))),_0xaf25('0x28')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x29'),db[_0xaf25('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xaf25('0x2a')))),_0xaf25('0x2b')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x29'),db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x2c')))),'predictiveIntervalAvgTalktime']]})[_0xaf25('0xc')](function(_0x182c59){logger[_0xaf25('0x13')]('AvgHandleTime',_0x376a19);logger[_0xaf25('0x1b')](_0xaf25('0x2d'),_0x376a19,JSON['stringify'](_0x182c59));_0x45ca89(_0x182c59);})[_0xaf25('0x15')](function(_0x1aa9ec){logger[_0xaf25('0x10')](_0xaf25('0x2d'),_0x1aa9ec['message'],_0x376a19);_0xd5031d(_0x49296c[_0xaf25('0x10')](0x1f4,_0x1aa9ec[_0xaf25('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x122116){var _0x56b701=this;return new Promise(function(_0x32b855,_0x56ae22){return db[_0xaf25('0x17')][_0xaf25('0x1d')]({'raw':_0x122116[_0xaf25('0x1a')]?_0x122116[_0xaf25('0x1a')][_0xaf25('0x2e')]===undefined?!![]:![]:!![],'where':_0x122116[_0xaf25('0x1a')]?_0x122116[_0xaf25('0x1a')]['where']||null:null,'attributes':[[_0xaf25('0x2f'),'name'],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xaf25('0x30')],[db['sequelize']['fn'](_0xaf25('0x20'),db['sequelize']['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')]('`state`\x20=\x203,\x201,\x20null'))),_0xaf25('0x31')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db['sequelize']['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x24')))),_0xaf25('0x32')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x33')))),'outboundBusyCallsDay'],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x34')))),_0xaf25('0x35')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x36')))),'outboundDropCallsDayTimeout'],[db[_0xaf25('0x1f')]['fn']('COUNT',db[_0xaf25('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xaf25('0x37')))),_0xaf25('0x38')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db['sequelize']['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0xaf25('0x39')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')]['literal'](_0xaf25('0x3a')))),_0xaf25('0x3b')],[db['sequelize']['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')]['literal'](_0xaf25('0x3c')))),_0xaf25('0x3d')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x3e')))),_0xaf25('0x3f')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db['sequelize']['fn']('IF',db[_0xaf25('0x1f')]['literal'](_0xaf25('0x40')))),_0xaf25('0x41')],[db['sequelize']['fn'](_0xaf25('0x20'),db['sequelize']['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x42')))),_0xaf25('0x3f')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db[_0xaf25('0x1f')][_0xaf25('0x23')](_0xaf25('0x43')))),_0xaf25('0x44')]],'group':[_0xaf25('0x2f')]})[_0xaf25('0xc')](function(_0x2d6c4f){logger['info'](_0xaf25('0x45'),_0x122116);logger[_0xaf25('0x1b')]('GetVoiceQueueHopperHistory',_0x122116,JSON[_0xaf25('0x1c')](_0x2d6c4f));_0x32b855(_0x2d6c4f);})[_0xaf25('0x15')](function(_0xfdafcb){logger[_0xaf25('0x10')](_0xaf25('0x45'),_0xfdafcb[_0xaf25('0x12')],_0x122116);_0x56ae22(_0x56b701[_0xaf25('0x10')](0x1f4,_0xfdafcb[_0xaf25('0x12')]));});});};exports[_0xaf25('0x46')]=function(_0x469c76){var _0x3799b7=this;return new Promise(function(_0x1f0c3c,_0x1d3099){return db[_0xaf25('0x17')][_0xaf25('0x1d')]({'raw':_0x469c76[_0xaf25('0x1a')]?_0x469c76[_0xaf25('0x1a')][_0xaf25('0x2e')]===undefined?!![]:![]:!![],'where':_0x469c76['options']?_0x469c76[_0xaf25('0x1a')][_0xaf25('0x1e')]||null:null,'attributes':[['campaign',_0xaf25('0x47')],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')][_0xaf25('0x21')]('id')),'ivrTotalCallsDays'],[db[_0xaf25('0x1f')]['fn'](_0xaf25('0x20'),db[_0xaf25('0x1f')]['fn']('IF',db['sequelize'][_0xaf25('0x23')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xaf25('0x2f')]})[_0xaf25('0xc')](function(_0x828c5){logger[_0xaf25('0x13')](_0xaf25('0x46'),_0x469c76);logger['debug'](_0xaf25('0x46'),_0x469c76,JSON['stringify'](_0x828c5));_0x1f0c3c(_0x828c5);})[_0xaf25('0x15')](function(_0x17edee){logger['error'](_0xaf25('0x46'),_0x17edee['message'],_0x469c76);_0x1d3099(_0x3799b7[_0xaf25('0x10')](0x1f4,_0x17edee[_0xaf25('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index f03343b..80a3a6b 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 _0xfaf3=['describe','show','post','create','put','/:id','update','exports','connect-timeout','Router','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','/describe','isAuthenticated'];(function(_0x3e2c63,_0x2406f7){var _0xafa5bd=function(_0x155245){while(--_0x155245){_0x3e2c63['push'](_0x3e2c63['shift']());}};_0xafa5bd(++_0x2406f7);}(_0xfaf3,0x118));var _0x3faf=function(_0x918d9b,_0x1678f2){_0x918d9b=_0x918d9b-0x0;var _0x5431c1=_0xfaf3[_0x918d9b];return _0x5431c1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3faf('0x0'));var express=require('express');var router=express[_0x3faf('0x1')]();var auth=require(_0x3faf('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x3faf('0x3'));var controller=require(_0x3faf('0x4'));router[_0x3faf('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3faf('0x5')](_0x3faf('0x6'),auth[_0x3faf('0x7')](),controller[_0x3faf('0x8')]);router[_0x3faf('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x3faf('0x9')]);router[_0x3faf('0xa')]('/',auth[_0x3faf('0x7')](),controller[_0x3faf('0xb')]);router[_0x3faf('0xc')](_0x3faf('0xd'),auth[_0x3faf('0x7')](),controller[_0x3faf('0xe')]);module[_0x3faf('0xf')]=router; \ No newline at end of file +var _0x5334=['post','create','update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','/:id','isAuthenticated','show'];(function(_0x5b7218,_0x51cb1f){var _0x424010=function(_0x430cb9){while(--_0x430cb9){_0x5b7218['push'](_0x5b7218['shift']());}};_0x424010(++_0x51cb1f);}(_0x5334,0x84));var _0x4533=function(_0x10b793,_0x48a66d){_0x10b793=_0x10b793-0x0;var _0x1c50d1=_0x5334[_0x10b793];return _0x1c50d1;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var auth=require(_0x4533('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4533('0x6'));var controller=require(_0x4533('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4533('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4533('0x8')](_0x4533('0x9'),auth[_0x4533('0xa')](),controller[_0x4533('0xb')]);router[_0x4533('0xc')]('/',auth[_0x4533('0xa')](),controller[_0x4533('0xd')]);router['put'](_0x4533('0x9'),auth[_0x4533('0xa')](),controller[_0x4533('0xe')]);module[_0x4533('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index cc8f2d0..23e564e 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 _0xdab6=['STRING','name','exports'];(function(_0xdefbe2,_0x1cdc2f){var _0x4f5a42=function(_0x339329){while(--_0x339329){_0xdefbe2['push'](_0xdefbe2['shift']());}};_0x4f5a42(++_0x1cdc2f);}(_0xdab6,0x1b8));var _0x6dab=function(_0x213560,_0x26e9ba){_0x213560=_0x213560-0x0;var _0xb1e3bd=_0xdab6[_0x213560];return _0xb1e3bd;};'use strict';var Sequelize=require('sequelize');module[_0x6dab('0x0')]={'name':{'type':Sequelize[_0x6dab('0x1')],'unique':_0x6dab('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6dab('0x1')]},'dialPrefix':{'type':Sequelize[_0x6dab('0x1')]}}; \ No newline at end of file +var _0x724e=['sequelize','STRING'];(function(_0x1b999f,_0xada878){var _0x51d27a=function(_0x1ba354){while(--_0x1ba354){_0x1b999f['push'](_0x1b999f['shift']());}};_0x51d27a(++_0xada878);}(_0x724e,0xe4));var _0xe724=function(_0xd7bae9,_0x53ce66){_0xd7bae9=_0xd7bae9-0x0;var _0x3048fe=_0x724e[_0xd7bae9];return _0x3048fe;};'use strict';var Sequelize=require(_0xe724('0x0'));module['exports']={'name':{'type':Sequelize[_0xe724('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe724('0x1')]},'dialPrefix':{'type':Sequelize[_0xe724('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index eda7073..d692c6f 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 _0x77a5=['userCmList:remove','getAgents','User','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./cmList.socket','sendStatus','end','status','json','count','limit','set','save','destroy','then','get','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','CmList','include','findAll','rows','show','params','keys','includeAll','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Lists','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ListId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addContacts','CmContact','tags','join','isArray','ids','push','dataValues','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','transaction','Sequelize','TEXT','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','getCustomFields','addAgents','omit','spread','emit'];(function(_0x15def5,_0x1c75d5){var _0x569e33=function(_0x147ff7){while(--_0x147ff7){_0x15def5['push'](_0x15def5['shift']());}};_0x569e33(++_0x1c75d5);}(_0x77a5,0x1a4));var _0x577a=function(_0x4c245f,_0x2bb619){_0x4c245f=_0x4c245f-0x0;var _0x4a2b5a=_0x77a5[_0x4c245f];return _0x4a2b5a;};'use strict';var pdf=require(_0x577a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x577a('0x1'));var zipdir=require(_0x577a('0x2'));var jsonpatch=require(_0x577a('0x3'));var rp=require(_0x577a('0x4'));var moment=require(_0x577a('0x5'));var BPromise=require(_0x577a('0x6'));var Mustache=require(_0x577a('0x7'));var util=require(_0x577a('0x8'));var path=require(_0x577a('0x9'));var sox=require('sox');var csv=require(_0x577a('0xa'));var ejs=require(_0x577a('0xb'));var fs=require('fs');var _=require(_0x577a('0xc'));var squel=require(_0x577a('0xd'));var crypto=require(_0x577a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x577a('0xf'));var toCsv=require(_0x577a('0xa'));var querystring=require(_0x577a('0x10'));var Papa=require(_0x577a('0x11'));var Redis=require('ioredis');var authService=require(_0x577a('0x12'));var qs=require(_0x577a('0x13'));var as=require(_0x577a('0x14'));var hardwareService=require(_0x577a('0x15'));var logger=require(_0x577a('0x16'))(_0x577a('0x17'));var utils=require(_0x577a('0x18'));var config=require(_0x577a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x577a('0x1a')]=_[_0x577a('0x1b')](config[_0x577a('0x1a')],{'host':_0x577a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x577a('0x1d'))['register'](socket);function respondWithStatusCode(_0x3d97c6,_0x15e200){_0x15e200=_0x15e200||0xcc;return function(_0x211c59){if(_0x211c59){return _0x3d97c6[_0x577a('0x1e')](_0x15e200);}return _0x3d97c6['status'](_0x15e200)[_0x577a('0x1f')]();};}function respondWithResult(_0x39fcc4,_0x7789c1){_0x7789c1=_0x7789c1||0xc8;return function(_0x5cdd43){if(_0x5cdd43){return _0x39fcc4[_0x577a('0x20')](_0x7789c1)[_0x577a('0x21')](_0x5cdd43);}};}function respondWithFilteredResult(_0x34c233,_0xd9e2e5){return function(_0x4ced08){if(_0x4ced08){var _0x39a24f=_0x4ced08[_0x577a('0x22')],_0x18f1e5=_0xd9e2e5['offset'],_0x52bb33=_0xd9e2e5['offset']+_0xd9e2e5[_0x577a('0x23')],_0x2dbbea;if(_0x52bb33>=_0x39a24f){_0x52bb33=_0x39a24f;_0x2dbbea=0xc8;}else{_0x2dbbea=0xce;}_0x34c233['status'](_0x2dbbea);return _0x34c233[_0x577a('0x24')]('Content-Range',_0x18f1e5+'-'+_0x52bb33+'/'+_0x39a24f)['json'](_0x4ced08);}return null;};}function patchUpdates(_0x1fba30){return function(_0x2b9eb8){try{jsonpatch['apply'](_0x2b9eb8,_0x1fba30,!![]);}catch(_0x449968){return BPromise['reject'](_0x449968);}return _0x2b9eb8[_0x577a('0x25')]();};}function saveUpdates(_0x74f2ad,_0x60ee4f){return function(_0xac99fa){if(_0xac99fa){return _0xac99fa['update'](_0x74f2ad)['then'](function(_0x4824c7){return _0x4824c7;});}return null;};}function removeEntity(_0x3c8ae4,_0x258fe3){return function(_0x454633){if(_0x454633){return _0x454633[_0x577a('0x26')]()[_0x577a('0x27')](function(){var _0x17d287=_0x454633[_0x577a('0x28')]({'plain':!![]});var _0x37fe2c='Lists';return db[_0x577a('0x29')][_0x577a('0x26')]({'where':{'type':_0x37fe2c,'resourceId':_0x17d287['id']}})[_0x577a('0x27')](function(){return _0x454633;});})[_0x577a('0x27')](function(){_0x3c8ae4['status'](0xcc)[_0x577a('0x1f')]();});}};}function handleEntityNotFound(_0x310354,_0x8e2d1a){return function(_0x31c71e){if(!_0x31c71e){_0x310354[_0x577a('0x1e')](0x194);}return _0x31c71e;};}function handleError(_0x41f22d,_0x1f0465){_0x1f0465=_0x1f0465||0x1f4;return function(_0x855a31){logger[_0x577a('0x2a')](_0x855a31[_0x577a('0x2b')]);if(_0x855a31[_0x577a('0x2c')]){delete _0x855a31[_0x577a('0x2c')];}_0x41f22d[_0x577a('0x20')](_0x1f0465)['send'](_0x855a31);};}exports[_0x577a('0x2d')]=function(_0x20e5a1,_0x5a9267){var _0xb9301a={},_0x3432fb={},_0x42c078={'count':0x0,'rows':[]};var _0x13f42d=_[_0x577a('0x2e')](db['CmList'][_0x577a('0x2f')],function(_0x2d4331){return{'name':_0x2d4331[_0x577a('0x30')],'type':_0x2d4331[_0x577a('0x31')][_0x577a('0x32')]};});_0x3432fb[_0x577a('0x33')]=_[_0x577a('0x2e')](_0x13f42d,_0x577a('0x2c'));_0x3432fb[_0x577a('0x34')]=_['keys'](_0x20e5a1[_0x577a('0x34')]);_0x3432fb[_0x577a('0x35')]=_[_0x577a('0x36')](_0x3432fb[_0x577a('0x33')],_0x3432fb[_0x577a('0x34')]);_0xb9301a[_0x577a('0x37')]=_['intersection'](_0x3432fb[_0x577a('0x33')],qs['fields'](_0x20e5a1[_0x577a('0x34')][_0x577a('0x38')]));_0xb9301a[_0x577a('0x37')]=_0xb9301a[_0x577a('0x37')][_0x577a('0x39')]?_0xb9301a['attributes']:_0x3432fb[_0x577a('0x33')];if(!_0x20e5a1[_0x577a('0x34')]['hasOwnProperty'](_0x577a('0x3a'))){_0xb9301a[_0x577a('0x23')]=qs[_0x577a('0x23')](_0x20e5a1[_0x577a('0x34')][_0x577a('0x23')]);_0xb9301a[_0x577a('0x3b')]=qs['offset'](_0x20e5a1[_0x577a('0x34')][_0x577a('0x3b')]);}_0xb9301a[_0x577a('0x3c')]=qs[_0x577a('0x3d')](_0x20e5a1[_0x577a('0x34')][_0x577a('0x3d')]);_0xb9301a[_0x577a('0x3e')]=qs[_0x577a('0x35')](_[_0x577a('0x3f')](_0x20e5a1['query'],_0x3432fb[_0x577a('0x35')]),_0x13f42d);if(_0x20e5a1['query'][_0x577a('0x40')]){_0xb9301a[_0x577a('0x3e')]=_[_0x577a('0x41')](_0xb9301a[_0x577a('0x3e')],{'$or':_[_0x577a('0x2e')](_0x13f42d,function(_0x44b125){if(_0x44b125[_0x577a('0x31')]!==_0x577a('0x42')){var _0x386d66={};_0x386d66[_0x44b125[_0x577a('0x2c')]]={'$like':'%'+_0x20e5a1[_0x577a('0x34')][_0x577a('0x40')]+'%'};return _0x386d66;}})});}_0xb9301a=_[_0x577a('0x41')]({},_0xb9301a,_0x20e5a1[_0x577a('0x43')]);var _0x38df64={'where':_0xb9301a[_0x577a('0x3e')]};return db[_0x577a('0x44')][_0x577a('0x22')](_0x38df64)[_0x577a('0x27')](function(_0x572b2e){_0x42c078[_0x577a('0x22')]=_0x572b2e;if(_0x20e5a1[_0x577a('0x34')]['includeAll']){_0xb9301a[_0x577a('0x45')]=[{'all':!![]}];}return db[_0x577a('0x44')][_0x577a('0x46')](_0xb9301a);})['then'](function(_0x4b9e14){_0x42c078[_0x577a('0x47')]=_0x4b9e14;return _0x42c078;})[_0x577a('0x27')](respondWithFilteredResult(_0x5a9267,_0xb9301a))['catch'](handleError(_0x5a9267,null));};exports[_0x577a('0x48')]=function(_0x30757b,_0x21ff65){var _0x308a78={'raw':![],'where':{'id':_0x30757b[_0x577a('0x49')]['id']}},_0x174383={};_0x174383[_0x577a('0x33')]=_[_0x577a('0x4a')](db['CmList'][_0x577a('0x2f')]);_0x174383[_0x577a('0x34')]=_[_0x577a('0x4a')](_0x30757b[_0x577a('0x34')]);_0x174383[_0x577a('0x35')]=_['intersection'](_0x174383[_0x577a('0x33')],_0x174383[_0x577a('0x34')]);_0x308a78[_0x577a('0x37')]=_[_0x577a('0x36')](_0x174383[_0x577a('0x33')],qs[_0x577a('0x38')](_0x30757b[_0x577a('0x34')][_0x577a('0x38')]));_0x308a78['attributes']=_0x308a78['attributes'][_0x577a('0x39')]?_0x308a78[_0x577a('0x37')]:_0x174383[_0x577a('0x33')];if(_0x30757b[_0x577a('0x34')][_0x577a('0x4b')]){_0x308a78[_0x577a('0x45')]=[{'all':!![]}];}_0x308a78=_[_0x577a('0x41')]({},_0x308a78,_0x30757b[_0x577a('0x43')]);return db['CmList']['find'](_0x308a78)[_0x577a('0x27')](handleEntityNotFound(_0x21ff65,null))['then'](respondWithResult(_0x21ff65,null))[_0x577a('0x4c')](handleError(_0x21ff65,null));};exports[_0x577a('0x4d')]=function(_0x3207b8,_0x1ca47b){return db[_0x577a('0x44')][_0x577a('0x4d')](_0x3207b8[_0x577a('0x4e')],{})[_0x577a('0x27')](function(_0x24581e){var _0x4d8a7a=_0x3207b8['user'][_0x577a('0x28')]({'plain':!![]});if(!_0x4d8a7a)throw new Error(_0x577a('0x4f'));if(_0x4d8a7a['role']===_0x577a('0x50')){var _0x1386f0=_0x24581e['get']({'plain':!![]});var _0x12a8b9=_0x577a('0x51');return db['UserProfileSection'][_0x577a('0x52')]({'where':{'name':_0x12a8b9,'userProfileId':_0x4d8a7a[_0x577a('0x53')]},'raw':!![]})[_0x577a('0x27')](function(_0x3c98b6){if(_0x3c98b6&&_0x3c98b6[_0x577a('0x54')]===0x0){return db[_0x577a('0x29')]['create']({'name':_0x1386f0[_0x577a('0x2c')],'resourceId':_0x1386f0['id'],'type':_0x3c98b6[_0x577a('0x2c')],'sectionId':_0x3c98b6['id']},{})[_0x577a('0x27')](function(){return _0x24581e;});}else{return _0x24581e;}})[_0x577a('0x4c')](function(_0x252edc){logger[_0x577a('0x2a')](_0x577a('0x55'),_0x252edc);throw _0x252edc;});}return _0x24581e;})[_0x577a('0x27')](respondWithResult(_0x1ca47b,0xc9))[_0x577a('0x4c')](handleError(_0x1ca47b,null));};exports['update']=function(_0x466e32,_0x3acbce){if(_0x466e32[_0x577a('0x4e')]['id']){delete _0x466e32['body']['id'];}return db[_0x577a('0x44')]['find']({'where':{'id':_0x466e32['params']['id']}})[_0x577a('0x27')](handleEntityNotFound(_0x3acbce,null))[_0x577a('0x27')](saveUpdates(_0x466e32['body'],null))[_0x577a('0x27')](respondWithResult(_0x3acbce,null))[_0x577a('0x4c')](handleError(_0x3acbce,null));};exports[_0x577a('0x26')]=function(_0x3b6c07,_0x338ca5){return db[_0x577a('0x44')][_0x577a('0x52')]({'where':{'id':_0x3b6c07[_0x577a('0x49')]['id']}})[_0x577a('0x27')](handleEntityNotFound(_0x338ca5,null))[_0x577a('0x27')](removeEntity(_0x338ca5,null))['catch'](handleError(_0x338ca5,null));};exports[_0x577a('0x56')]=function(_0x57f384,_0x1c8f7d){return db[_0x577a('0x44')][_0x577a('0x56')]()[_0x577a('0x27')](respondWithResult(_0x1c8f7d,null))['catch'](handleError(_0x1c8f7d,null));};exports['addDisposition']=function(_0x2b4612,_0xa43a0e,_0x4339a0){if(_0x2b4612[_0x577a('0x4e')]['id']){delete _0x2b4612['body']['id'];}return db[_0x577a('0x44')]['find']({'where':{'id':_0x2b4612[_0x577a('0x49')]['id']}})[_0x577a('0x27')](handleEntityNotFound(_0xa43a0e,null))[_0x577a('0x27')](function(_0xb868d6){if(_0xb868d6){_0x2b4612['body'][_0x577a('0x57')]=_0xb868d6['id'];return db[_0x577a('0x58')][_0x577a('0x4d')](_0x2b4612[_0x577a('0x4e')]);}})[_0x577a('0x27')](respondWithResult(_0xa43a0e,null))[_0x577a('0x4c')](handleError(_0xa43a0e,null));};exports[_0x577a('0x59')]=function(_0x4b9bcb,_0x4f3b13,_0x19a1a5){var _0x38645f={'raw':![],'where':{}};var _0x498e5b={};var _0x1b87fd={'count':0x0,'rows':[]};return db[_0x577a('0x44')][_0x577a('0x5a')]({'where':{'id':_0x4b9bcb['params']['id']}})[_0x577a('0x27')](handleEntityNotFound(_0x4f3b13,null))[_0x577a('0x27')](function(_0xc6c468){if(_0xc6c468){_0x498e5b[_0x577a('0x33')]=_[_0x577a('0x4a')](db['Disposition'][_0x577a('0x2f')]);_0x498e5b[_0x577a('0x34')]=_[_0x577a('0x4a')](_0x4b9bcb[_0x577a('0x34')]);_0x498e5b['filters']=_[_0x577a('0x36')](_0x498e5b[_0x577a('0x33')],_0x498e5b['query']);_0x38645f[_0x577a('0x37')]=_[_0x577a('0x36')](_0x498e5b[_0x577a('0x33')],qs[_0x577a('0x38')](_0x4b9bcb['query'][_0x577a('0x38')]));_0x38645f['attributes']=_0x38645f[_0x577a('0x37')][_0x577a('0x39')]?_0x38645f[_0x577a('0x37')]:_0x498e5b[_0x577a('0x33')];if(!_0x4b9bcb[_0x577a('0x34')][_0x577a('0x5b')](_0x577a('0x3a'))){_0x38645f['limit']=qs['limit'](_0x4b9bcb[_0x577a('0x34')][_0x577a('0x23')]);_0x38645f[_0x577a('0x3b')]=qs[_0x577a('0x3b')](_0x4b9bcb['query'][_0x577a('0x3b')]);}_0x38645f[_0x577a('0x3c')]=qs[_0x577a('0x3d')](_0x4b9bcb['query'][_0x577a('0x3d')]);_0x38645f['where']=qs[_0x577a('0x35')](_['pick'](_0x4b9bcb['query'],_0x498e5b[_0x577a('0x35')]));_0x38645f['where'][_0x577a('0x57')]=_0xc6c468['id'];if(_0x4b9bcb['query'][_0x577a('0x40')]){_0x38645f[_0x577a('0x3e')]=_[_0x577a('0x41')](_0x38645f[_0x577a('0x3e')],{'$or':_[_0x577a('0x2e')](_0x38645f[_0x577a('0x37')],function(_0x12049c){var _0x4ddcc8={};_0x4ddcc8[_0x12049c]={'$like':'%'+_0x4b9bcb['query']['filter']+'%'};return _0x4ddcc8;})});}_0x38645f=_[_0x577a('0x41')]({},_0x38645f,_0x4b9bcb[_0x577a('0x43')]);return db[_0x577a('0x58')][_0x577a('0x22')]({'where':_0x38645f[_0x577a('0x3e')]})[_0x577a('0x27')](function(_0x5bd23d){_0x1b87fd[_0x577a('0x22')]=_0x5bd23d;if(_0x4b9bcb['query'][_0x577a('0x4b')]){_0x38645f[_0x577a('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x577a('0x46')](_0x38645f);})[_0x577a('0x27')](function(_0x270567){_0x1b87fd['rows']=_0x270567;return _0x1b87fd;});}})[_0x577a('0x27')](respondWithFilteredResult(_0x4f3b13,_0x38645f))['catch'](handleError(_0x4f3b13,null));};exports['removeDispositions']=function(_0x2c6b28,_0x2c2b21,_0x1958b4){return db[_0x577a('0x44')][_0x577a('0x52')]({'where':{'id':_0x2c6b28[_0x577a('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c2b21,null))['then'](function(_0x27d392){if(_0x27d392){return _0x27d392[_0x577a('0x5c')](_0x2c6b28['query']['ids']);}})[_0x577a('0x27')](respondWithStatusCode(_0x2c2b21,null))[_0x577a('0x4c')](handleError(_0x2c2b21,null));};exports[_0x577a('0x5d')]=function(_0x1e5888,_0x14327f,_0x510332){return db[_0x577a('0x44')]['find']({'where':{'id':_0x1e5888[_0x577a('0x49')]['id']}})[_0x577a('0x27')](handleEntityNotFound(_0x14327f,null))[_0x577a('0x27')](function(_0x19054e){if(_0x19054e){var _0x4e239c=[];var _0x4d6fa0={'success':[],'errors':[]};return db[_0x577a('0x5e')][_0x577a('0x56')]()[_0x577a('0x27')](function(_0x485c75){if(_0x1e5888['body']['tags']&&_['isArray'](_0x1e5888[_0x577a('0x4e')][_0x577a('0x5f')])){if(_0x1e5888['body']['tags'][_0x577a('0x39')]){_0x1e5888['body']['tags']=_0x1e5888[_0x577a('0x4e')]['tags'][_0x577a('0x60')](';')+';';}else{_0x1e5888['body']['tags']=null;}}else{_0x1e5888[_0x577a('0x4e')]['tags']=null;}if(_0x1e5888['body']&&_[_0x577a('0x61')](_0x1e5888[_0x577a('0x4e')])){for(var _0x45eb44=0x0;_0x45eb44<_0x1e5888[_0x577a('0x4e')][_0x577a('0x39')];_0x45eb44+=0x1){_0x1e5888[_0x577a('0x4e')][_0x45eb44][_0x577a('0x57')]=_0x1e5888['params']['id'];_0x4e239c['push'](_0x1e5888['body'][_0x45eb44]);}return BPromise['each'](_0x4e239c,function(_0x1533e0){return db[_0x577a('0x5e')][_0x577a('0x4d')](_['omit'](_0x1533e0,[_0x577a('0x62'),'id'])||{},{'fields':_[_0x577a('0x4a')](_0x485c75),'raw':!![]})['then'](function(_0x519021){_0x4d6fa0['success'][_0x577a('0x63')](_0x519021[_0x577a('0x64')]);})[_0x577a('0x4c')](function(_0x188177){_0x4d6fa0['errors'][_0x577a('0x63')]({'data':_0x1533e0,'error':_0x188177[_0x577a('0x65')]});});})[_0x577a('0x27')](function(_0x34a550){return _0x4d6fa0;})[_0x577a('0x4c')](function(_0x303921){return _0x303921;});}else{_0x14327f['status'](0x190)['json']({'message':_0x577a('0x66')});}});}})['then'](respondWithResult(_0x14327f,null))[_0x577a('0x4c')](handleError(_0x14327f,null));};exports[_0x577a('0x67')]=function(_0x33bfb0,_0x302668,_0x4c20a6){var _0x3a9618;return db[_0x577a('0x44')][_0x577a('0x52')]({'where':{'id':_0x33bfb0[_0x577a('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x577a('0x68')}]})['then'](handleEntityNotFound(_0x302668,null))[_0x577a('0x27')](function(_0x39e48a){if(_0x39e48a){_0x3a9618=_0x39e48a;return db[_0x577a('0x5e')]['rawAttributes'];}})[_0x577a('0x27')](function(_0x436d47){if(_0x436d47){var _0x3b31b0={};var _0x56f0ce={};_0x56f0ce[_0x577a('0x33')]=_[_0x577a('0x69')](_['keys'](_0x436d47),_[_0x577a('0x2e')](_0x3a9618[_0x577a('0x68')],function(_0x140c34){return util[_0x577a('0x6a')](_0x577a('0x6b'),_0x140c34['id']);}));_0x56f0ce[_0x577a('0x34')]=_[_0x577a('0x4a')](_0x33bfb0['query']);_0x56f0ce['filters']=_[_0x577a('0x36')](_0x56f0ce[_0x577a('0x33')],_0x56f0ce[_0x577a('0x34')]);_0x3b31b0[_0x577a('0x37')]=_[_0x577a('0x36')](_0x56f0ce[_0x577a('0x33')],qs[_0x577a('0x38')](_0x33bfb0[_0x577a('0x34')][_0x577a('0x38')]));_0x3b31b0[_0x577a('0x37')]=_0x3b31b0[_0x577a('0x37')][_0x577a('0x39')]?_0x3b31b0[_0x577a('0x37')]:_0x56f0ce[_0x577a('0x33')];if(!_0x33bfb0[_0x577a('0x34')]['hasOwnProperty'](_0x577a('0x3a'))){_0x3b31b0[_0x577a('0x23')]=qs['limit'](_0x33bfb0['query'][_0x577a('0x23')]);_0x3b31b0[_0x577a('0x3b')]=qs[_0x577a('0x3b')](_0x33bfb0[_0x577a('0x34')][_0x577a('0x3b')]);}_0x3b31b0['order']=qs[_0x577a('0x3d')](_0x33bfb0[_0x577a('0x34')][_0x577a('0x3d')]);_0x3b31b0['where']=qs[_0x577a('0x35')](_['pick'](_0x33bfb0[_0x577a('0x34')],_0x56f0ce['filters']));_0x3b31b0[_0x577a('0x6c')]=!![];if(_0x33bfb0[_0x577a('0x34')][_0x577a('0x40')]){_0x3b31b0[_0x577a('0x3e')]=_['merge'](_0x3b31b0[_0x577a('0x3e')],{'$or':_[_0x577a('0x2e')](_0x3b31b0[_0x577a('0x37')],function(_0x5f874a){var _0x55eb42={};_0x55eb42[_0x5f874a]={'$like':'%'+_0x33bfb0[_0x577a('0x34')][_0x577a('0x40')]+'%'};return _0x55eb42;})});}_0x3b31b0=_[_0x577a('0x41')]({},_0x3b31b0,_0x33bfb0[_0x577a('0x43')]);return _0x3a9618[_0x577a('0x67')](_0x3b31b0);}})[_0x577a('0x27')](respondWithResult(_0x302668,null))[_0x577a('0x4c')](handleError(_0x302668,null));};exports[_0x577a('0x6d')]=function(_0x2d7538,_0x5cb9cb,_0x518c72){var _0x5a9e39;return db['CmList'][_0x577a('0x52')]({'where':{'id':_0x2d7538['params']['id']},'include':[{'model':db[_0x577a('0x6e')],'as':_0x577a('0x68')}]})[_0x577a('0x27')](handleEntityNotFound(_0x5cb9cb,null))[_0x577a('0x27')](function(_0x5f1c24){if(_0x5f1c24){_0x5a9e39=_0x5f1c24;return db[_0x577a('0x5e')][_0x577a('0x2f')];}})[_0x577a('0x27')](function(_0x167697){if(_0x167697){var _0x22df77={};var _0x58ea7e={};_0x58ea7e[_0x577a('0x33')]=_[_0x577a('0x69')](_['keys'](_0x167697),_[_0x577a('0x2e')](_0x5a9e39[_0x577a('0x68')],function(_0x5c7543){return util['format'](_0x577a('0x6b'),_0x5c7543['id']);}));_0x58ea7e[_0x577a('0x34')]=_[_0x577a('0x4a')](_0x2d7538['query']);_0x58ea7e[_0x577a('0x35')]=_[_0x577a('0x36')](_0x58ea7e[_0x577a('0x33')],_0x58ea7e[_0x577a('0x34')]);_0x22df77['attributes']=_[_0x577a('0x36')](_0x58ea7e[_0x577a('0x33')],qs[_0x577a('0x38')](_0x2d7538[_0x577a('0x34')][_0x577a('0x38')]));_0x22df77[_0x577a('0x37')]=_0x22df77[_0x577a('0x37')][_0x577a('0x39')]?_0x22df77['attributes']:_0x58ea7e[_0x577a('0x33')];if(!_0x2d7538[_0x577a('0x34')][_0x577a('0x5b')]('nolimit')){_0x22df77['limit']=qs[_0x577a('0x23')](_0x2d7538[_0x577a('0x34')][_0x577a('0x23')]);_0x22df77[_0x577a('0x3b')]=qs[_0x577a('0x3b')](_0x2d7538[_0x577a('0x34')][_0x577a('0x3b')]);}_0x22df77[_0x577a('0x3c')]=qs['sort'](_0x2d7538[_0x577a('0x34')]['sort']);_0x22df77[_0x577a('0x3e')]=qs[_0x577a('0x35')](_[_0x577a('0x3f')](_0x2d7538['query'],_0x58ea7e[_0x577a('0x35')]));_0x22df77[_0x577a('0x6c')]=!![];if(_0x2d7538[_0x577a('0x34')][_0x577a('0x40')]){_0x22df77['where']=_['merge'](_0x22df77[_0x577a('0x3e')],{'$or':_[_0x577a('0x2e')](_0x22df77[_0x577a('0x37')],function(_0x2ce6db){var _0x16f04b={};_0x16f04b[_0x2ce6db]={'$like':'%'+_0x2d7538[_0x577a('0x34')]['filter']+'%'};return _0x16f04b;})});}_0x22df77=_[_0x577a('0x41')]({},_0x22df77,_0x2d7538[_0x577a('0x43')]);return _0x5a9e39[_0x577a('0x67')](_0x22df77);}})[_0x577a('0x27')](function(_0x7c5997){if(!_[_0x577a('0x6f')](_0x7c5997)){var _0x4d6483=toCsv(_0x7c5997);var _0x5c7f4b=Date[_0x577a('0x70')]();fs[_0x577a('0x71')](util[_0x577a('0x6a')]('/tmp/list_%d_%s.csv',_0x5a9e39['id'],_0x5c7f4b),_0x4d6483);_0x5cb9cb['setHeader'](_0x577a('0x72'),_0x577a('0x73')+util[_0x577a('0x6a')](_0x577a('0x74'),_0x5a9e39['id'],_0x5c7f4b));_0x5cb9cb[_0x577a('0x75')](_0x577a('0x76'),_0x577a('0x77'));return _0x5cb9cb[_0x577a('0x78')](util[_0x577a('0x6a')](_0x577a('0x79'),_0x5a9e39['id'],_0x5c7f4b));}else{return _0x5cb9cb[_0x577a('0x1e')](0xcc);}})[_0x577a('0x4c')](handleError(_0x5cb9cb,null));};exports[_0x577a('0x7a')]=function(_0x894df2,_0x380902,_0x1eaa4c){var _0x5014fe;delete _0x894df2['body']['id'];return db['CmList'][_0x577a('0x5a')]({'where':{'id':_0x894df2['params']['id']}})[_0x577a('0x27')](handleEntityNotFound(_0x380902,null))[_0x577a('0x27')](function(_0x477dfd){if(_0x477dfd){return db['sequelize'][_0x577a('0x7b')](function(_0x298810){return db['CmCustomField'][_0x577a('0x4d')](_0x894df2[_0x577a('0x4e')],{'transaction':_0x298810})[_0x577a('0x27')](function(_0x3b76a6){_0x5014fe=_0x3b76a6;return _0x477dfd['addCustomFields'](_0x3b76a6,{'transaction':_0x298810});})['then'](function(){var _0x1b70f1={'type':db[_0x577a('0x7c')][_0x577a('0x7d')],'transaction':_0x298810};switch(_0x894df2[_0x577a('0x4e')]['type']){case'text':_0x1b70f1[_0x577a('0x31')]=db[_0x577a('0x7c')]['TEXT'];break;case'number':_0x1b70f1[_0x577a('0x31')]=db[_0x577a('0x7c')][_0x577a('0x7e')];break;case'switch':_0x1b70f1[_0x577a('0x31')]=db[_0x577a('0x7c')][_0x577a('0x7f')];_0x1b70f1[_0x577a('0x80')]=![];break;default:}return db['sequelize'][_0x577a('0x81')]['addColumn'](_0x577a('0x82'),util['format']('cf_%s',_0x5014fe['id']),_0x1b70f1);})['then'](function(){return _0x5014fe;});});}})[_0x577a('0x27')](respondWithResult(_0x380902,null))[_0x577a('0x4c')](handleError(_0x380902,null));};exports[_0x577a('0x83')]=function(_0x3d32ca,_0x3bdbf3,_0x64d7d){var _0x1d9935={};var _0x1d37db={};var _0x5bf320;var _0x1b84fd;return db[_0x577a('0x44')][_0x577a('0x5a')]({'where':{'id':_0x3d32ca['params']['id']}})[_0x577a('0x27')](handleEntityNotFound(_0x3bdbf3,null))[_0x577a('0x27')](function(_0x42d448){if(_0x42d448){_0x5bf320=_0x42d448;_0x1d37db[_0x577a('0x33')]=_[_0x577a('0x4a')](db['CmCustomField'][_0x577a('0x2f')]);_0x1d37db[_0x577a('0x34')]=_['keys'](_0x3d32ca['query']);_0x1d37db[_0x577a('0x35')]=_[_0x577a('0x36')](_0x1d37db['model'],_0x1d37db['query']);_0x1d9935[_0x577a('0x37')]=_[_0x577a('0x36')](_0x1d37db[_0x577a('0x33')],qs[_0x577a('0x38')](_0x3d32ca['query'][_0x577a('0x38')]));_0x1d9935[_0x577a('0x37')]=_0x1d9935['attributes'][_0x577a('0x39')]?_0x1d9935[_0x577a('0x37')]:_0x1d37db['model'];_0x1d9935[_0x577a('0x3c')]=qs[_0x577a('0x3d')](_0x3d32ca[_0x577a('0x34')][_0x577a('0x3d')]);_0x1d9935['where']=qs[_0x577a('0x35')](_[_0x577a('0x3f')](_0x3d32ca[_0x577a('0x34')],_0x1d37db[_0x577a('0x35')]));_0x1d9935[_0x577a('0x3e')]=_['merge'](_0x1d9935[_0x577a('0x3e')],{'$or':[{'ListId':_0x42d448['id']},{'ListId':null}]});if(_0x3d32ca['query'][_0x577a('0x40')]){_0x1d9935['where']=_[_0x577a('0x41')](_0x1d9935[_0x577a('0x3e')],{'$or':_['map'](_0x1d9935[_0x577a('0x37')],function(_0x124ab5){var _0x1d1c67={};_0x1d1c67[_0x124ab5]={'$like':'%'+_0x3d32ca[_0x577a('0x34')][_0x577a('0x40')]+'%'};return _0x1d1c67;})});}_0x1d9935=_[_0x577a('0x41')]({},_0x1d9935,_0x3d32ca[_0x577a('0x43')]);return db['CmCustomField']['findAndCountAll'](_0x1d9935);}})[_0x577a('0x27')](respondWithResult(_0x3bdbf3,null))[_0x577a('0x4c')](handleError(_0x3bdbf3,null));};exports[_0x577a('0x84')]=function(_0x33d2fe,_0x49ae3d,_0x4cf04b){return db[_0x577a('0x44')][_0x577a('0x52')]({'where':{'id':_0x33d2fe[_0x577a('0x49')]['id']}})[_0x577a('0x27')](handleEntityNotFound(_0x49ae3d,null))['then'](function(_0x43076f){if(_0x43076f){return _0x43076f[_0x577a('0x84')](_0x33d2fe[_0x577a('0x4e')][_0x577a('0x62')],_[_0x577a('0x85')](_0x33d2fe[_0x577a('0x4e')],[_0x577a('0x62'),'id'])||{})[_0x577a('0x86')](function(_0x493411){for(var _0x290c3e=0x0;_0x290c3e<_0x33d2fe['body'][_0x577a('0x62')]['length'];_0x290c3e+=0x1){socket[_0x577a('0x87')]('userCmList:save',{'UserId':_0x33d2fe[_0x577a('0x4e')][_0x577a('0x62')][_0x290c3e],'CmListId':_0x33d2fe[_0x577a('0x49')]['id']});}return _0x493411;});}})[_0x577a('0x27')](respondWithResult(_0x49ae3d,null))[_0x577a('0x4c')](handleError(_0x49ae3d,null));};exports['removeAgents']=function(_0x56e580,_0x2171cd,_0x20b776){return db['CmList'][_0x577a('0x52')]({'where':{'id':_0x56e580[_0x577a('0x49')]['id']}})['then'](handleEntityNotFound(_0x2171cd,null))['then'](function(_0x4370f1){if(_0x4370f1){return _0x4370f1['removeAgents'](_0x56e580[_0x577a('0x34')][_0x577a('0x62')])[_0x577a('0x27')](function(){if(_[_0x577a('0x61')](_0x56e580[_0x577a('0x34')][_0x577a('0x62')])){for(var _0x5d872a=0x0;_0x5d872a<_0x56e580[_0x577a('0x34')]['ids'][_0x577a('0x39')];_0x5d872a+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x56e580[_0x577a('0x34')]['ids'][_0x5d872a]),'CmListId':Number(_0x56e580[_0x577a('0x49')]['id'])});}}else{socket[_0x577a('0x87')](_0x577a('0x88'),{'UserId':Number(_0x56e580[_0x577a('0x34')][_0x577a('0x62')]),'CmListId':Number(_0x56e580[_0x577a('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x2171cd,null))[_0x577a('0x4c')](handleError(_0x2171cd,null));};exports[_0x577a('0x89')]=function(_0x351230,_0x366b0c,_0x390404){var _0x351e71={};var _0x3a0918={};var _0x55a7d1;var _0x44e9c6;return db[_0x577a('0x44')][_0x577a('0x5a')]({'where':{'id':_0x351230[_0x577a('0x49')]['id']}})['then'](handleEntityNotFound(_0x366b0c,null))[_0x577a('0x27')](function(_0x461d67){if(_0x461d67){_0x55a7d1=_0x461d67;_0x3a0918['model']=_[_0x577a('0x4a')](db[_0x577a('0x8a')][_0x577a('0x2f')]);_0x3a0918[_0x577a('0x34')]=_[_0x577a('0x4a')](_0x351230[_0x577a('0x34')]);_0x3a0918[_0x577a('0x35')]=_[_0x577a('0x36')](_0x3a0918[_0x577a('0x33')],_0x3a0918[_0x577a('0x34')]);_0x351e71[_0x577a('0x37')]=_[_0x577a('0x36')](_0x3a0918[_0x577a('0x33')],qs[_0x577a('0x38')](_0x351230[_0x577a('0x34')][_0x577a('0x38')]));_0x351e71[_0x577a('0x37')]=_0x351e71[_0x577a('0x37')][_0x577a('0x39')]?_0x351e71[_0x577a('0x37')]:_0x3a0918['model'];_0x351e71[_0x577a('0x3c')]=qs['sort'](_0x351230['query'][_0x577a('0x3d')]);_0x351e71[_0x577a('0x3e')]=qs['filters'](_['pick'](_0x351230['query'],_0x3a0918[_0x577a('0x35')]));if(_0x351230[_0x577a('0x34')]['filter']){_0x351e71[_0x577a('0x3e')]=_[_0x577a('0x41')](_0x351e71[_0x577a('0x3e')],{'$or':_['map'](_0x351e71[_0x577a('0x37')],function(_0x3875c8){var _0x3421c4={};_0x3421c4[_0x3875c8]={'$like':'%'+_0x351230[_0x577a('0x34')][_0x577a('0x40')]+'%'};return _0x3421c4;})});}_0x351e71=_[_0x577a('0x41')]({},_0x351e71,_0x351230[_0x577a('0x43')]);return _0x55a7d1['getAgents'](_0x351e71);}})[_0x577a('0x27')](function(_0x18c0a7){if(_0x18c0a7){_0x44e9c6=_0x18c0a7[_0x577a('0x39')];if(!_0x351230[_0x577a('0x34')]['hasOwnProperty'](_0x577a('0x3a'))){_0x351e71[_0x577a('0x23')]=qs[_0x577a('0x23')](_0x351230[_0x577a('0x34')][_0x577a('0x23')]);_0x351e71[_0x577a('0x3b')]=qs['offset'](_0x351230['query'][_0x577a('0x3b')]);}return _0x55a7d1[_0x577a('0x89')](_0x351e71);}})[_0x577a('0x27')](function(_0x36f1c3){if(_0x36f1c3){return _0x36f1c3?{'count':_0x44e9c6,'rows':_0x36f1c3}:null;}})[_0x577a('0x27')](respondWithResult(_0x366b0c,null))[_0x577a('0x4c')](handleError(_0x366b0c,null));}; \ No newline at end of file +var _0x8a67=['isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','set','Content-Range','save','then','destroy','UserProfileResource','error','stack','name','send','map','CmList','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','rows','catch','show','params','includeAll','include','find','create','body','user','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','findOne','Disposition','findAll','removeDispositions','CmContact','tags','isArray','push','omit','ids','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','rawAttributes','concat','format','cf_%d','order','raw','CmCustomField'];(function(_0x156510,_0xdc8b52){var _0xdee5e7=function(_0x1eee23){while(--_0x1eee23){_0x156510['push'](_0x156510['shift']());}};_0xdee5e7(++_0xdc8b52);}(_0x8a67,0x1c5));var _0x78a6=function(_0x27c52f,_0x17c613){_0x27c52f=_0x27c52f-0x0;var _0x331364=_0x8a67[_0x27c52f];return _0x331364;};'use strict';var pdf=require(_0x78a6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x78a6('0x1'));var zipdir=require(_0x78a6('0x2'));var jsonpatch=require(_0x78a6('0x3'));var rp=require(_0x78a6('0x4'));var moment=require(_0x78a6('0x5'));var BPromise=require(_0x78a6('0x6'));var Mustache=require('mustache');var util=require(_0x78a6('0x7'));var path=require(_0x78a6('0x8'));var sox=require(_0x78a6('0x9'));var csv=require(_0x78a6('0xa'));var ejs=require(_0x78a6('0xb'));var fs=require('fs');var _=require(_0x78a6('0xc'));var squel=require(_0x78a6('0xd'));var crypto=require(_0x78a6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x78a6('0xf'));var toCsv=require(_0x78a6('0xa'));var querystring=require(_0x78a6('0x10'));var Papa=require('papaparse');var Redis=require(_0x78a6('0x11'));var authService=require(_0x78a6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x78a6('0x13'));var hardwareService=require(_0x78a6('0x14'));var logger=require(_0x78a6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x78a6('0x16'));var licenseUtil=require(_0x78a6('0x17'));var db=require('../../mysqldb')['db'];config[_0x78a6('0x18')]=_[_0x78a6('0x19')](config[_0x78a6('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x78a6('0x1a'))(new Redis(config[_0x78a6('0x18')]));require(_0x78a6('0x1b'))[_0x78a6('0x1c')](socket);function respondWithStatusCode(_0x460729,_0x407f02){_0x407f02=_0x407f02||0xcc;return function(_0x35b4ba){if(_0x35b4ba){return _0x460729[_0x78a6('0x1d')](_0x407f02);}return _0x460729[_0x78a6('0x1e')](_0x407f02)[_0x78a6('0x1f')]();};}function respondWithResult(_0x50c809,_0x2f7d36){_0x2f7d36=_0x2f7d36||0xc8;return function(_0x557ff8){if(_0x557ff8){return _0x50c809['status'](_0x2f7d36)[_0x78a6('0x20')](_0x557ff8);}};}function respondWithFilteredResult(_0x264d75,_0x2ca732){return function(_0x2c3cf4){if(_0x2c3cf4){var _0x1a7267=_0x2c3cf4['count'],_0x5040ba=_0x2ca732[_0x78a6('0x21')],_0x5a44c7=_0x2ca732[_0x78a6('0x21')]+_0x2ca732['limit'],_0x27adfa;if(_0x5a44c7>=_0x1a7267){_0x5a44c7=_0x1a7267;_0x27adfa=0xc8;}else{_0x27adfa=0xce;}_0x264d75['status'](_0x27adfa);return _0x264d75[_0x78a6('0x22')](_0x78a6('0x23'),_0x5040ba+'-'+_0x5a44c7+'/'+_0x1a7267)[_0x78a6('0x20')](_0x2c3cf4);}return null;};}function patchUpdates(_0x15f286){return function(_0x4570c2){try{jsonpatch['apply'](_0x4570c2,_0x15f286,!![]);}catch(_0x2556f8){return BPromise['reject'](_0x2556f8);}return _0x4570c2[_0x78a6('0x24')]();};}function saveUpdates(_0x344eb7,_0x1bcfcd){return function(_0x374962){if(_0x374962){return _0x374962['update'](_0x344eb7)[_0x78a6('0x25')](function(_0x46a797){return _0x46a797;});}return null;};}function removeEntity(_0x13abaa,_0x2048df){return function(_0x1170f2){if(_0x1170f2){return _0x1170f2[_0x78a6('0x26')]()[_0x78a6('0x25')](function(){var _0xff85e2=_0x1170f2['get']({'plain':!![]});var _0x7c7480='Lists';return db[_0x78a6('0x27')][_0x78a6('0x26')]({'where':{'type':_0x7c7480,'resourceId':_0xff85e2['id']}})[_0x78a6('0x25')](function(){return _0x1170f2;});})['then'](function(){_0x13abaa[_0x78a6('0x1e')](0xcc)[_0x78a6('0x1f')]();});}};}function handleEntityNotFound(_0x1e95ef,_0x3a1f6e){return function(_0x52dcc5){if(!_0x52dcc5){_0x1e95ef[_0x78a6('0x1d')](0x194);}return _0x52dcc5;};}function handleError(_0x397a4d,_0x3e7058){_0x3e7058=_0x3e7058||0x1f4;return function(_0x5e43ca){logger[_0x78a6('0x28')](_0x5e43ca[_0x78a6('0x29')]);if(_0x5e43ca[_0x78a6('0x2a')]){delete _0x5e43ca[_0x78a6('0x2a')];}_0x397a4d[_0x78a6('0x1e')](_0x3e7058)[_0x78a6('0x2b')](_0x5e43ca);};}exports['index']=function(_0x428a55,_0xe741a2){var _0x14372e={},_0x1595f3={},_0x2585e6={'count':0x0,'rows':[]};var _0x464c82=_[_0x78a6('0x2c')](db[_0x78a6('0x2d')]['rawAttributes'],function(_0x308869){return{'name':_0x308869['fieldName'],'type':_0x308869[_0x78a6('0x2e')][_0x78a6('0x2f')]};});_0x1595f3['model']=_[_0x78a6('0x2c')](_0x464c82,'name');_0x1595f3[_0x78a6('0x30')]=_[_0x78a6('0x31')](_0x428a55['query']);_0x1595f3[_0x78a6('0x32')]=_[_0x78a6('0x33')](_0x1595f3[_0x78a6('0x34')],_0x1595f3[_0x78a6('0x30')]);_0x14372e[_0x78a6('0x35')]=_[_0x78a6('0x33')](_0x1595f3[_0x78a6('0x34')],qs[_0x78a6('0x36')](_0x428a55[_0x78a6('0x30')][_0x78a6('0x36')]));_0x14372e['attributes']=_0x14372e['attributes'][_0x78a6('0x37')]?_0x14372e[_0x78a6('0x35')]:_0x1595f3[_0x78a6('0x34')];if(!_0x428a55[_0x78a6('0x30')][_0x78a6('0x38')](_0x78a6('0x39'))){_0x14372e[_0x78a6('0x3a')]=qs['limit'](_0x428a55['query'][_0x78a6('0x3a')]);_0x14372e[_0x78a6('0x21')]=qs['offset'](_0x428a55[_0x78a6('0x30')]['offset']);}_0x14372e['order']=qs[_0x78a6('0x3b')](_0x428a55[_0x78a6('0x30')]['sort']);_0x14372e[_0x78a6('0x3c')]=qs[_0x78a6('0x32')](_[_0x78a6('0x3d')](_0x428a55[_0x78a6('0x30')],_0x1595f3[_0x78a6('0x32')]),_0x464c82);if(_0x428a55['query'][_0x78a6('0x3e')]){_0x14372e[_0x78a6('0x3c')]=_[_0x78a6('0x3f')](_0x14372e['where'],{'$or':_[_0x78a6('0x2c')](_0x464c82,function(_0x82c012){if(_0x82c012[_0x78a6('0x2e')]!==_0x78a6('0x40')){var _0x3bb4de={};_0x3bb4de[_0x82c012['name']]={'$like':'%'+_0x428a55['query'][_0x78a6('0x3e')]+'%'};return _0x3bb4de;}})});}_0x14372e=_['merge']({},_0x14372e,_0x428a55[_0x78a6('0x41')]);var _0x2618d9={'where':_0x14372e['where']};return db['CmList']['count'](_0x2618d9)['then'](function(_0x51290e){_0x2585e6[_0x78a6('0x42')]=_0x51290e;if(_0x428a55['query']['includeAll']){_0x14372e['include']=[{'all':!![]}];}return db[_0x78a6('0x2d')]['findAll'](_0x14372e);})[_0x78a6('0x25')](function(_0xd7fe0c){_0x2585e6[_0x78a6('0x43')]=_0xd7fe0c;return _0x2585e6;})[_0x78a6('0x25')](respondWithFilteredResult(_0xe741a2,_0x14372e))[_0x78a6('0x44')](handleError(_0xe741a2,null));};exports[_0x78a6('0x45')]=function(_0x1897f9,_0x545f42){var _0x2041b6={'raw':![],'where':{'id':_0x1897f9[_0x78a6('0x46')]['id']}},_0x3b6954={};_0x3b6954[_0x78a6('0x34')]=_[_0x78a6('0x31')](db[_0x78a6('0x2d')]['rawAttributes']);_0x3b6954[_0x78a6('0x30')]=_[_0x78a6('0x31')](_0x1897f9[_0x78a6('0x30')]);_0x3b6954[_0x78a6('0x32')]=_[_0x78a6('0x33')](_0x3b6954[_0x78a6('0x34')],_0x3b6954['query']);_0x2041b6[_0x78a6('0x35')]=_[_0x78a6('0x33')](_0x3b6954[_0x78a6('0x34')],qs[_0x78a6('0x36')](_0x1897f9[_0x78a6('0x30')][_0x78a6('0x36')]));_0x2041b6[_0x78a6('0x35')]=_0x2041b6[_0x78a6('0x35')][_0x78a6('0x37')]?_0x2041b6['attributes']:_0x3b6954['model'];if(_0x1897f9['query'][_0x78a6('0x47')]){_0x2041b6[_0x78a6('0x48')]=[{'all':!![]}];}_0x2041b6=_[_0x78a6('0x3f')]({},_0x2041b6,_0x1897f9[_0x78a6('0x41')]);return db[_0x78a6('0x2d')][_0x78a6('0x49')](_0x2041b6)[_0x78a6('0x25')](handleEntityNotFound(_0x545f42,null))['then'](respondWithResult(_0x545f42,null))[_0x78a6('0x44')](handleError(_0x545f42,null));};exports[_0x78a6('0x4a')]=function(_0xa4691e,_0x2bdce8){return db[_0x78a6('0x2d')][_0x78a6('0x4a')](_0xa4691e[_0x78a6('0x4b')],{})[_0x78a6('0x25')](function(_0x29e65d){var _0x5de17a=_0xa4691e[_0x78a6('0x4c')][_0x78a6('0x4d')]({'plain':!![]});if(!_0x5de17a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5de17a['role']===_0x78a6('0x4c')){var _0x31a8d7=_0x29e65d[_0x78a6('0x4d')]({'plain':!![]});var _0x25797e='Lists';return db['UserProfileSection'][_0x78a6('0x49')]({'where':{'name':_0x25797e,'userProfileId':_0x5de17a['userProfileId']},'raw':!![]})['then'](function(_0x19f073){if(_0x19f073&&_0x19f073[_0x78a6('0x4e')]===0x0){return db[_0x78a6('0x27')]['create']({'name':_0x31a8d7[_0x78a6('0x2a')],'resourceId':_0x31a8d7['id'],'type':_0x19f073['name'],'sectionId':_0x19f073['id']},{})['then'](function(){return _0x29e65d;});}else{return _0x29e65d;}})[_0x78a6('0x44')](function(_0x9a1076){logger[_0x78a6('0x28')](_0x78a6('0x4f'),_0x9a1076);throw _0x9a1076;});}return _0x29e65d;})[_0x78a6('0x25')](respondWithResult(_0x2bdce8,0xc9))[_0x78a6('0x44')](handleError(_0x2bdce8,null));};exports[_0x78a6('0x50')]=function(_0x5debc6,_0x3802bb){if(_0x5debc6[_0x78a6('0x4b')]['id']){delete _0x5debc6[_0x78a6('0x4b')]['id'];}return db[_0x78a6('0x2d')]['find']({'where':{'id':_0x5debc6[_0x78a6('0x46')]['id']}})[_0x78a6('0x25')](handleEntityNotFound(_0x3802bb,null))[_0x78a6('0x25')](saveUpdates(_0x5debc6['body'],null))[_0x78a6('0x25')](respondWithResult(_0x3802bb,null))[_0x78a6('0x44')](handleError(_0x3802bb,null));};exports['destroy']=function(_0x41e101,_0x317b3e){return db[_0x78a6('0x2d')][_0x78a6('0x49')]({'where':{'id':_0x41e101[_0x78a6('0x46')]['id']}})[_0x78a6('0x25')](handleEntityNotFound(_0x317b3e,null))['then'](removeEntity(_0x317b3e,null))[_0x78a6('0x44')](handleError(_0x317b3e,null));};exports[_0x78a6('0x51')]=function(_0x4a5439,_0x535b17){return db[_0x78a6('0x2d')][_0x78a6('0x51')]()[_0x78a6('0x25')](respondWithResult(_0x535b17,null))[_0x78a6('0x44')](handleError(_0x535b17,null));};exports[_0x78a6('0x52')]=function(_0x16bf69,_0x188e3b,_0x39bf31){if(_0x16bf69['body']['id']){delete _0x16bf69['body']['id'];}return db[_0x78a6('0x2d')][_0x78a6('0x49')]({'where':{'id':_0x16bf69[_0x78a6('0x46')]['id']}})[_0x78a6('0x25')](handleEntityNotFound(_0x188e3b,null))['then'](function(_0x2148c0){if(_0x2148c0){_0x16bf69[_0x78a6('0x4b')][_0x78a6('0x53')]=_0x2148c0['id'];return db['Disposition'][_0x78a6('0x4a')](_0x16bf69[_0x78a6('0x4b')]);}})[_0x78a6('0x25')](respondWithResult(_0x188e3b,null))[_0x78a6('0x44')](handleError(_0x188e3b,null));};exports['getDispositions']=function(_0x412e84,_0x31e8d9,_0x46f56f){var _0x1961b8={'raw':![],'where':{}};var _0x1d3266={};var _0x5aed77={'count':0x0,'rows':[]};return db[_0x78a6('0x2d')][_0x78a6('0x54')]({'where':{'id':_0x412e84[_0x78a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x31e8d9,null))[_0x78a6('0x25')](function(_0x484b01){if(_0x484b01){_0x1d3266[_0x78a6('0x34')]=_['keys'](db[_0x78a6('0x55')]['rawAttributes']);_0x1d3266[_0x78a6('0x30')]=_['keys'](_0x412e84[_0x78a6('0x30')]);_0x1d3266[_0x78a6('0x32')]=_[_0x78a6('0x33')](_0x1d3266[_0x78a6('0x34')],_0x1d3266[_0x78a6('0x30')]);_0x1961b8[_0x78a6('0x35')]=_['intersection'](_0x1d3266[_0x78a6('0x34')],qs['fields'](_0x412e84['query'][_0x78a6('0x36')]));_0x1961b8[_0x78a6('0x35')]=_0x1961b8[_0x78a6('0x35')][_0x78a6('0x37')]?_0x1961b8[_0x78a6('0x35')]:_0x1d3266[_0x78a6('0x34')];if(!_0x412e84[_0x78a6('0x30')]['hasOwnProperty'](_0x78a6('0x39'))){_0x1961b8[_0x78a6('0x3a')]=qs[_0x78a6('0x3a')](_0x412e84[_0x78a6('0x30')][_0x78a6('0x3a')]);_0x1961b8['offset']=qs[_0x78a6('0x21')](_0x412e84[_0x78a6('0x30')][_0x78a6('0x21')]);}_0x1961b8['order']=qs['sort'](_0x412e84[_0x78a6('0x30')][_0x78a6('0x3b')]);_0x1961b8['where']=qs[_0x78a6('0x32')](_[_0x78a6('0x3d')](_0x412e84[_0x78a6('0x30')],_0x1d3266[_0x78a6('0x32')]));_0x1961b8['where'][_0x78a6('0x53')]=_0x484b01['id'];if(_0x412e84[_0x78a6('0x30')][_0x78a6('0x3e')]){_0x1961b8[_0x78a6('0x3c')]=_[_0x78a6('0x3f')](_0x1961b8['where'],{'$or':_[_0x78a6('0x2c')](_0x1961b8['attributes'],function(_0x5af176){var _0x43572b={};_0x43572b[_0x5af176]={'$like':'%'+_0x412e84[_0x78a6('0x30')]['filter']+'%'};return _0x43572b;})});}_0x1961b8=_[_0x78a6('0x3f')]({},_0x1961b8,_0x412e84[_0x78a6('0x41')]);return db[_0x78a6('0x55')][_0x78a6('0x42')]({'where':_0x1961b8['where']})[_0x78a6('0x25')](function(_0x38f931){_0x5aed77[_0x78a6('0x42')]=_0x38f931;if(_0x412e84[_0x78a6('0x30')][_0x78a6('0x47')]){_0x1961b8[_0x78a6('0x48')]=[{'all':!![]}];}return db[_0x78a6('0x55')][_0x78a6('0x56')](_0x1961b8);})['then'](function(_0x4609d8){_0x5aed77['rows']=_0x4609d8;return _0x5aed77;});}})[_0x78a6('0x25')](respondWithFilteredResult(_0x31e8d9,_0x1961b8))[_0x78a6('0x44')](handleError(_0x31e8d9,null));};exports[_0x78a6('0x57')]=function(_0x307bcd,_0x388f9a,_0x585307){return db[_0x78a6('0x2d')][_0x78a6('0x49')]({'where':{'id':_0x307bcd[_0x78a6('0x46')]['id']}})[_0x78a6('0x25')](handleEntityNotFound(_0x388f9a,null))[_0x78a6('0x25')](function(_0x2ce066){if(_0x2ce066){return _0x2ce066[_0x78a6('0x57')](_0x307bcd['query']['ids']);}})[_0x78a6('0x25')](respondWithStatusCode(_0x388f9a,null))[_0x78a6('0x44')](handleError(_0x388f9a,null));};exports['addContacts']=function(_0x57f54a,_0x2159c1,_0x4f2cac){return db[_0x78a6('0x2d')][_0x78a6('0x49')]({'where':{'id':_0x57f54a[_0x78a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x2159c1,null))[_0x78a6('0x25')](function(_0x35dadd){if(_0x35dadd){var _0x1b17b2=[];var _0x55a086={'success':[],'errors':[]};return db[_0x78a6('0x58')][_0x78a6('0x51')]()[_0x78a6('0x25')](function(_0x270bcf){if(_0x57f54a[_0x78a6('0x4b')][_0x78a6('0x59')]&&_[_0x78a6('0x5a')](_0x57f54a[_0x78a6('0x4b')][_0x78a6('0x59')])){if(_0x57f54a['body']['tags'][_0x78a6('0x37')]){_0x57f54a[_0x78a6('0x4b')][_0x78a6('0x59')]=_0x57f54a[_0x78a6('0x4b')]['tags']['join'](';')+';';}else{_0x57f54a[_0x78a6('0x4b')][_0x78a6('0x59')]=null;}}else{_0x57f54a[_0x78a6('0x4b')][_0x78a6('0x59')]=null;}if(_0x57f54a[_0x78a6('0x4b')]&&_[_0x78a6('0x5a')](_0x57f54a[_0x78a6('0x4b')])){for(var _0x3904cf=0x0;_0x3904cf<_0x57f54a['body'][_0x78a6('0x37')];_0x3904cf+=0x1){_0x57f54a['body'][_0x3904cf][_0x78a6('0x53')]=_0x57f54a[_0x78a6('0x46')]['id'];_0x1b17b2[_0x78a6('0x5b')](_0x57f54a[_0x78a6('0x4b')][_0x3904cf]);}return BPromise['each'](_0x1b17b2,function(_0x14c21f){return db[_0x78a6('0x58')]['create'](_[_0x78a6('0x5c')](_0x14c21f,[_0x78a6('0x5d'),'id'])||{},{'fields':_[_0x78a6('0x31')](_0x270bcf),'raw':!![]})[_0x78a6('0x25')](function(_0xbf4b23){_0x55a086['success']['push'](_0xbf4b23[_0x78a6('0x5e')]);})['catch'](function(_0x19fe84){_0x55a086[_0x78a6('0x5f')]['push']({'data':_0x14c21f,'error':_0x19fe84[_0x78a6('0x60')]});});})[_0x78a6('0x25')](function(_0x49cbed){return _0x55a086;})[_0x78a6('0x44')](function(_0x5b7566){return _0x5b7566;});}else{_0x2159c1[_0x78a6('0x1e')](0x190)[_0x78a6('0x20')]({'message':_0x78a6('0x61')});}});}})[_0x78a6('0x25')](respondWithResult(_0x2159c1,null))['catch'](handleError(_0x2159c1,null));};exports[_0x78a6('0x62')]=function(_0x50fbe2,_0x1305be,_0x2e223b){var _0x26b33e;return db[_0x78a6('0x2d')][_0x78a6('0x49')]({'where':{'id':_0x50fbe2[_0x78a6('0x46')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x78a6('0x63')}]})['then'](handleEntityNotFound(_0x1305be,null))[_0x78a6('0x25')](function(_0x7f4ba5){if(_0x7f4ba5){_0x26b33e=_0x7f4ba5;return db['CmContact'][_0x78a6('0x64')];}})[_0x78a6('0x25')](function(_0x504a3c){if(_0x504a3c){var _0x187167={};var _0x3d242a={};_0x3d242a[_0x78a6('0x34')]=_[_0x78a6('0x65')](_[_0x78a6('0x31')](_0x504a3c),_['map'](_0x26b33e[_0x78a6('0x63')],function(_0xcf4fa0){return util[_0x78a6('0x66')](_0x78a6('0x67'),_0xcf4fa0['id']);}));_0x3d242a[_0x78a6('0x30')]=_[_0x78a6('0x31')](_0x50fbe2['query']);_0x3d242a['filters']=_[_0x78a6('0x33')](_0x3d242a[_0x78a6('0x34')],_0x3d242a[_0x78a6('0x30')]);_0x187167[_0x78a6('0x35')]=_[_0x78a6('0x33')](_0x3d242a[_0x78a6('0x34')],qs[_0x78a6('0x36')](_0x50fbe2[_0x78a6('0x30')]['fields']));_0x187167[_0x78a6('0x35')]=_0x187167[_0x78a6('0x35')][_0x78a6('0x37')]?_0x187167[_0x78a6('0x35')]:_0x3d242a[_0x78a6('0x34')];if(!_0x50fbe2[_0x78a6('0x30')][_0x78a6('0x38')](_0x78a6('0x39'))){_0x187167['limit']=qs['limit'](_0x50fbe2[_0x78a6('0x30')]['limit']);_0x187167[_0x78a6('0x21')]=qs[_0x78a6('0x21')](_0x50fbe2['query']['offset']);}_0x187167[_0x78a6('0x68')]=qs[_0x78a6('0x3b')](_0x50fbe2[_0x78a6('0x30')]['sort']);_0x187167[_0x78a6('0x3c')]=qs[_0x78a6('0x32')](_['pick'](_0x50fbe2[_0x78a6('0x30')],_0x3d242a['filters']));_0x187167[_0x78a6('0x69')]=!![];if(_0x50fbe2['query'][_0x78a6('0x3e')]){_0x187167[_0x78a6('0x3c')]=_[_0x78a6('0x3f')](_0x187167[_0x78a6('0x3c')],{'$or':_[_0x78a6('0x2c')](_0x187167[_0x78a6('0x35')],function(_0x4ae534){var _0x56fa3d={};_0x56fa3d[_0x4ae534]={'$like':'%'+_0x50fbe2[_0x78a6('0x30')]['filter']+'%'};return _0x56fa3d;})});}_0x187167=_[_0x78a6('0x3f')]({},_0x187167,_0x50fbe2['options']);return _0x26b33e[_0x78a6('0x62')](_0x187167);}})[_0x78a6('0x25')](respondWithResult(_0x1305be,null))['catch'](handleError(_0x1305be,null));};exports['getContactsCsv']=function(_0x2d6cc5,_0x337931,_0x566012){var _0x3e4d7e;return db['CmList'][_0x78a6('0x49')]({'where':{'id':_0x2d6cc5[_0x78a6('0x46')]['id']},'include':[{'model':db[_0x78a6('0x6a')],'as':_0x78a6('0x63')}]})[_0x78a6('0x25')](handleEntityNotFound(_0x337931,null))[_0x78a6('0x25')](function(_0x3381fc){if(_0x3381fc){_0x3e4d7e=_0x3381fc;return db['CmContact'][_0x78a6('0x64')];}})[_0x78a6('0x25')](function(_0x3cafab){if(_0x3cafab){var _0x538176={};var _0x3676d6={};_0x3676d6[_0x78a6('0x34')]=_[_0x78a6('0x65')](_[_0x78a6('0x31')](_0x3cafab),_['map'](_0x3e4d7e[_0x78a6('0x63')],function(_0x5713dc){return util[_0x78a6('0x66')](_0x78a6('0x67'),_0x5713dc['id']);}));_0x3676d6[_0x78a6('0x30')]=_[_0x78a6('0x31')](_0x2d6cc5[_0x78a6('0x30')]);_0x3676d6[_0x78a6('0x32')]=_[_0x78a6('0x33')](_0x3676d6[_0x78a6('0x34')],_0x3676d6['query']);_0x538176[_0x78a6('0x35')]=_['intersection'](_0x3676d6[_0x78a6('0x34')],qs[_0x78a6('0x36')](_0x2d6cc5['query']['fields']));_0x538176[_0x78a6('0x35')]=_0x538176[_0x78a6('0x35')][_0x78a6('0x37')]?_0x538176[_0x78a6('0x35')]:_0x3676d6[_0x78a6('0x34')];if(!_0x2d6cc5['query'][_0x78a6('0x38')](_0x78a6('0x39'))){_0x538176[_0x78a6('0x3a')]=qs[_0x78a6('0x3a')](_0x2d6cc5['query'][_0x78a6('0x3a')]);_0x538176[_0x78a6('0x21')]=qs[_0x78a6('0x21')](_0x2d6cc5[_0x78a6('0x30')]['offset']);}_0x538176[_0x78a6('0x68')]=qs[_0x78a6('0x3b')](_0x2d6cc5[_0x78a6('0x30')]['sort']);_0x538176[_0x78a6('0x3c')]=qs['filters'](_[_0x78a6('0x3d')](_0x2d6cc5[_0x78a6('0x30')],_0x3676d6[_0x78a6('0x32')]));_0x538176[_0x78a6('0x69')]=!![];if(_0x2d6cc5[_0x78a6('0x30')][_0x78a6('0x3e')]){_0x538176[_0x78a6('0x3c')]=_['merge'](_0x538176[_0x78a6('0x3c')],{'$or':_[_0x78a6('0x2c')](_0x538176['attributes'],function(_0xfbce7b){var _0x589c6e={};_0x589c6e[_0xfbce7b]={'$like':'%'+_0x2d6cc5[_0x78a6('0x30')][_0x78a6('0x3e')]+'%'};return _0x589c6e;})});}_0x538176=_[_0x78a6('0x3f')]({},_0x538176,_0x2d6cc5['options']);return _0x3e4d7e['getContacts'](_0x538176);}})['then'](function(_0x4e7cb5){if(!_[_0x78a6('0x6b')](_0x4e7cb5)){var _0x3f950a=toCsv(_0x4e7cb5);var _0x1abf08=Date[_0x78a6('0x6c')]();fs['writeFileSync'](util[_0x78a6('0x66')](_0x78a6('0x6d'),_0x3e4d7e['id'],_0x1abf08),_0x3f950a);_0x337931[_0x78a6('0x6e')](_0x78a6('0x6f'),_0x78a6('0x70')+util[_0x78a6('0x66')](_0x78a6('0x71'),_0x3e4d7e['id'],_0x1abf08));_0x337931[_0x78a6('0x6e')](_0x78a6('0x72'),_0x78a6('0x73'));return _0x337931[_0x78a6('0x74')](util[_0x78a6('0x66')](_0x78a6('0x6d'),_0x3e4d7e['id'],_0x1abf08));}else{return _0x337931['sendStatus'](0xcc);}})[_0x78a6('0x44')](handleError(_0x337931,null));};exports[_0x78a6('0x75')]=function(_0x115676,_0x1bee4a,_0x401cc6){var _0x2acf7a;delete _0x115676[_0x78a6('0x4b')]['id'];return db[_0x78a6('0x2d')][_0x78a6('0x54')]({'where':{'id':_0x115676[_0x78a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x1bee4a,null))[_0x78a6('0x25')](function(_0x604aaf){if(_0x604aaf){return db[_0x78a6('0x76')][_0x78a6('0x77')](function(_0x491a97){return db[_0x78a6('0x6a')][_0x78a6('0x4a')](_0x115676[_0x78a6('0x4b')],{'transaction':_0x491a97})[_0x78a6('0x25')](function(_0x971b37){_0x2acf7a=_0x971b37;return _0x604aaf[_0x78a6('0x78')](_0x971b37,{'transaction':_0x491a97});})[_0x78a6('0x25')](function(){var _0x2f4a9c={'type':db[_0x78a6('0x79')]['TEXT'],'transaction':_0x491a97};switch(_0x115676[_0x78a6('0x4b')][_0x78a6('0x2e')]){case _0x78a6('0x7a'):_0x2f4a9c['type']=db[_0x78a6('0x79')][_0x78a6('0x7b')];break;case _0x78a6('0x7c'):_0x2f4a9c[_0x78a6('0x2e')]=db['Sequelize'][_0x78a6('0x7d')];break;case'switch':_0x2f4a9c['type']=db['Sequelize'][_0x78a6('0x7e')];_0x2f4a9c['defaultValue']=![];break;default:}return db[_0x78a6('0x76')][_0x78a6('0x7f')][_0x78a6('0x80')](_0x78a6('0x81'),util[_0x78a6('0x66')](_0x78a6('0x82'),_0x2acf7a['id']),_0x2f4a9c);})['then'](function(){return _0x2acf7a;});});}})[_0x78a6('0x25')](respondWithResult(_0x1bee4a,null))['catch'](handleError(_0x1bee4a,null));};exports[_0x78a6('0x83')]=function(_0x2bc9c2,_0x35a089,_0x599971){var _0x54f9ce={};var _0x310021={};var _0x56d8f9;var _0x190e87;return db[_0x78a6('0x2d')][_0x78a6('0x54')]({'where':{'id':_0x2bc9c2[_0x78a6('0x46')]['id']}})[_0x78a6('0x25')](handleEntityNotFound(_0x35a089,null))[_0x78a6('0x25')](function(_0x2600a5){if(_0x2600a5){_0x56d8f9=_0x2600a5;_0x310021['model']=_[_0x78a6('0x31')](db[_0x78a6('0x6a')]['rawAttributes']);_0x310021[_0x78a6('0x30')]=_[_0x78a6('0x31')](_0x2bc9c2[_0x78a6('0x30')]);_0x310021[_0x78a6('0x32')]=_['intersection'](_0x310021[_0x78a6('0x34')],_0x310021[_0x78a6('0x30')]);_0x54f9ce[_0x78a6('0x35')]=_['intersection'](_0x310021['model'],qs[_0x78a6('0x36')](_0x2bc9c2[_0x78a6('0x30')][_0x78a6('0x36')]));_0x54f9ce[_0x78a6('0x35')]=_0x54f9ce['attributes'][_0x78a6('0x37')]?_0x54f9ce['attributes']:_0x310021['model'];_0x54f9ce[_0x78a6('0x68')]=qs[_0x78a6('0x3b')](_0x2bc9c2[_0x78a6('0x30')][_0x78a6('0x3b')]);_0x54f9ce[_0x78a6('0x3c')]=qs['filters'](_[_0x78a6('0x3d')](_0x2bc9c2['query'],_0x310021['filters']));_0x54f9ce['where']=_['merge'](_0x54f9ce['where'],{'$or':[{'ListId':_0x2600a5['id']},{'ListId':null}]});if(_0x2bc9c2[_0x78a6('0x30')][_0x78a6('0x3e')]){_0x54f9ce[_0x78a6('0x3c')]=_[_0x78a6('0x3f')](_0x54f9ce[_0x78a6('0x3c')],{'$or':_[_0x78a6('0x2c')](_0x54f9ce[_0x78a6('0x35')],function(_0x20256d){var _0xdce20={};_0xdce20[_0x20256d]={'$like':'%'+_0x2bc9c2['query'][_0x78a6('0x3e')]+'%'};return _0xdce20;})});}_0x54f9ce=_[_0x78a6('0x3f')]({},_0x54f9ce,_0x2bc9c2[_0x78a6('0x41')]);return db['CmCustomField'][_0x78a6('0x84')](_0x54f9ce);}})[_0x78a6('0x25')](respondWithResult(_0x35a089,null))[_0x78a6('0x44')](handleError(_0x35a089,null));};exports['addAgents']=function(_0xbf274d,_0x268fc5,_0x42b2c0){return db['CmList']['find']({'where':{'id':_0xbf274d['params']['id']}})[_0x78a6('0x25')](handleEntityNotFound(_0x268fc5,null))[_0x78a6('0x25')](function(_0x485feb){if(_0x485feb){return _0x485feb['addAgents'](_0xbf274d[_0x78a6('0x4b')][_0x78a6('0x5d')],_[_0x78a6('0x5c')](_0xbf274d[_0x78a6('0x4b')],[_0x78a6('0x5d'),'id'])||{})[_0x78a6('0x85')](function(_0x470ed3){for(var _0x198256=0x0;_0x198256<_0xbf274d[_0x78a6('0x4b')][_0x78a6('0x5d')][_0x78a6('0x37')];_0x198256+=0x1){socket[_0x78a6('0x86')](_0x78a6('0x87'),{'UserId':_0xbf274d[_0x78a6('0x4b')][_0x78a6('0x5d')][_0x198256],'CmListId':_0xbf274d[_0x78a6('0x46')]['id']});}return _0x470ed3;});}})[_0x78a6('0x25')](respondWithResult(_0x268fc5,null))[_0x78a6('0x44')](handleError(_0x268fc5,null));};exports[_0x78a6('0x88')]=function(_0x3d9757,_0x59d754,_0x2a5a48){return db[_0x78a6('0x2d')][_0x78a6('0x49')]({'where':{'id':_0x3d9757[_0x78a6('0x46')]['id']}})[_0x78a6('0x25')](handleEntityNotFound(_0x59d754,null))['then'](function(_0xd20a3c){if(_0xd20a3c){return _0xd20a3c[_0x78a6('0x88')](_0x3d9757[_0x78a6('0x30')][_0x78a6('0x5d')])['then'](function(){if(_['isArray'](_0x3d9757[_0x78a6('0x30')][_0x78a6('0x5d')])){for(var _0x42d8b3=0x0;_0x42d8b3<_0x3d9757[_0x78a6('0x30')][_0x78a6('0x5d')]['length'];_0x42d8b3+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x3d9757['query'][_0x78a6('0x5d')][_0x42d8b3]),'CmListId':Number(_0x3d9757[_0x78a6('0x46')]['id'])});}}else{socket[_0x78a6('0x86')](_0x78a6('0x89'),{'UserId':Number(_0x3d9757['query'][_0x78a6('0x5d')]),'CmListId':Number(_0x3d9757[_0x78a6('0x46')]['id'])});}});}})[_0x78a6('0x25')](respondWithStatusCode(_0x59d754,null))[_0x78a6('0x44')](handleError(_0x59d754,null));};exports['getAgents']=function(_0xbe249d,_0x4f99f8,_0x2f0442){var _0x3bbf3f={};var _0x5ba5a2={};var _0x1cc3e6;var _0x1e0a93;return db[_0x78a6('0x2d')][_0x78a6('0x54')]({'where':{'id':_0xbe249d[_0x78a6('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f99f8,null))[_0x78a6('0x25')](function(_0x4afd98){if(_0x4afd98){_0x1cc3e6=_0x4afd98;_0x5ba5a2[_0x78a6('0x34')]=_[_0x78a6('0x31')](db[_0x78a6('0x8a')][_0x78a6('0x64')]);_0x5ba5a2[_0x78a6('0x30')]=_[_0x78a6('0x31')](_0xbe249d[_0x78a6('0x30')]);_0x5ba5a2[_0x78a6('0x32')]=_[_0x78a6('0x33')](_0x5ba5a2['model'],_0x5ba5a2['query']);_0x3bbf3f[_0x78a6('0x35')]=_[_0x78a6('0x33')](_0x5ba5a2[_0x78a6('0x34')],qs[_0x78a6('0x36')](_0xbe249d[_0x78a6('0x30')]['fields']));_0x3bbf3f[_0x78a6('0x35')]=_0x3bbf3f[_0x78a6('0x35')][_0x78a6('0x37')]?_0x3bbf3f['attributes']:_0x5ba5a2['model'];_0x3bbf3f[_0x78a6('0x68')]=qs[_0x78a6('0x3b')](_0xbe249d[_0x78a6('0x30')][_0x78a6('0x3b')]);_0x3bbf3f['where']=qs['filters'](_[_0x78a6('0x3d')](_0xbe249d[_0x78a6('0x30')],_0x5ba5a2[_0x78a6('0x32')]));if(_0xbe249d[_0x78a6('0x30')][_0x78a6('0x3e')]){_0x3bbf3f[_0x78a6('0x3c')]=_[_0x78a6('0x3f')](_0x3bbf3f[_0x78a6('0x3c')],{'$or':_['map'](_0x3bbf3f[_0x78a6('0x35')],function(_0x46e302){var _0x46fefa={};_0x46fefa[_0x46e302]={'$like':'%'+_0xbe249d[_0x78a6('0x30')][_0x78a6('0x3e')]+'%'};return _0x46fefa;})});}_0x3bbf3f=_[_0x78a6('0x3f')]({},_0x3bbf3f,_0xbe249d[_0x78a6('0x41')]);return _0x1cc3e6[_0x78a6('0x8b')](_0x3bbf3f);}})[_0x78a6('0x25')](function(_0x24d6dd){if(_0x24d6dd){_0x1e0a93=_0x24d6dd[_0x78a6('0x37')];if(!_0xbe249d[_0x78a6('0x30')][_0x78a6('0x38')]('nolimit')){_0x3bbf3f[_0x78a6('0x3a')]=qs['limit'](_0xbe249d[_0x78a6('0x30')][_0x78a6('0x3a')]);_0x3bbf3f[_0x78a6('0x21')]=qs['offset'](_0xbe249d[_0x78a6('0x30')][_0x78a6('0x21')]);}return _0x1cc3e6['getAgents'](_0x3bbf3f);}})[_0x78a6('0x25')](function(_0x59e38b){if(_0x59e38b){return _0x59e38b?{'count':_0x1e0a93,'rows':_0x59e38b}:null;}})[_0x78a6('0x25')](respondWithResult(_0x4f99f8,null))['catch'](handleError(_0x4f99f8,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index e6d4e5c..06bbb24 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 _0x41a2=['update','remove','emit','hook','exports','CmList','setMaxListeners','save'];(function(_0x5ff84f,_0x1012fa){var _0x2bb22b=function(_0x7dc759){while(--_0x7dc759){_0x5ff84f['push'](_0x5ff84f['shift']());}};_0x2bb22b(++_0x1012fa);}(_0x41a2,0x19d));var _0x241a=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x41a2[_0x5a26f5];return _0x2e9ef7;};'use strict';var EventEmitter=require('events');var CmList=require('../../mysqldb')['db'][_0x241a('0x0')];var CmListEvents=new EventEmitter();CmListEvents[_0x241a('0x1')](0x0);var events={'afterCreate':_0x241a('0x2'),'afterUpdate':_0x241a('0x3'),'afterDestroy':_0x241a('0x4')};function emitEvent(_0xe0c16d){return function(_0x1e029e,_0x43f304,_0x26d16b){CmListEvents[_0x241a('0x5')](_0xe0c16d+':'+_0x1e029e['id'],_0x1e029e);CmListEvents[_0x241a('0x5')](_0xe0c16d,_0x1e029e);_0x26d16b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x241a('0x6')](e,emitEvent(event));}}module[_0x241a('0x7')]=CmListEvents; \ No newline at end of file +var _0x06eb=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save','update','remove'];(function(_0x2c7259,_0x34903f){var _0x11754c=function(_0x382622){while(--_0x382622){_0x2c7259['push'](_0x2c7259['shift']());}};_0x11754c(++_0x34903f);}(_0x06eb,0x67));var _0xb06e=function(_0x11941a,_0x36e1ac){_0x11941a=_0x11941a-0x0;var _0xae78af=_0x06eb[_0x11941a];return _0xae78af;};'use strict';var EventEmitter=require(_0xb06e('0x0'));var CmList=require(_0xb06e('0x1'))['db'][_0xb06e('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb06e('0x3')](0x0);var events={'afterCreate':_0xb06e('0x4'),'afterUpdate':_0xb06e('0x5'),'afterDestroy':_0xb06e('0x6')};function emitEvent(_0x5fb3b2){return function(_0x42cef4,_0x24cfad,_0x1aa774){CmListEvents[_0xb06e('0x7')](_0x5fb3b2+':'+_0x42cef4['id'],_0x42cef4);CmListEvents[_0xb06e('0x7')](_0x5fb3b2,_0x42cef4);_0x1aa774(null);};}for(var e in events){if(events[_0xb06e('0x8')](e)){var event=events[e];CmList[_0xb06e('0x9')](e,emitEvent(event));}}module[_0xb06e('0xa')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f95eb70..3d5ad93 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 _0x0441=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./cmList.attributes','define','CmList','cm_lists'];(function(_0x2ac614,_0x509328){var _0x19c818=function(_0x14d3d4){while(--_0x14d3d4){_0x2ac614['push'](_0x2ac614['shift']());}};_0x19c818(++_0x509328);}(_0x0441,0x190));var _0x1044=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x0441[_0x5d7227];return _0x15ac55;};'use strict';var _=require(_0x1044('0x0'));var util=require('util');var logger=require(_0x1044('0x1'))('api');var moment=require(_0x1044('0x2'));var BPromise=require(_0x1044('0x3'));var rp=require(_0x1044('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1044('0x5'));var config=require('../../config/environment');var attributes=require(_0x1044('0x6'));module['exports']=function(_0x2b7eaf,_0x2850c9){return _0x2b7eaf[_0x1044('0x7')](_0x1044('0x8'),attributes,{'tableName':_0x1044('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30fd=['../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x1ae235,_0x32acd9){var _0x73c246=function(_0xba35fb){while(--_0xba35fb){_0x1ae235['push'](_0x1ae235['shift']());}};_0x73c246(++_0x32acd9);}(_0x30fd,0x69));var _0xd30f=function(_0x9c441e,_0x4196d0){_0x9c441e=_0x9c441e-0x0;var _0x43d3e3=_0x30fd[_0x9c441e];return _0x43d3e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd30f('0x0'))('api');var moment=require(_0xd30f('0x1'));var BPromise=require(_0xd30f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd30f('0x3'));var rimraf=require(_0xd30f('0x4'));var config=require(_0xd30f('0x5'));var attributes=require(_0xd30f('0x6'));module[_0xd30f('0x7')]=function(_0x53849d,_0x8d004c){return _0x53849d[_0xd30f('0x8')](_0xd30f('0x9'),attributes,{'tableName':_0xd30f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 525cdcf..ad4f825 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 _0x4130=['error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x2bf969,_0x4cc255){var _0x56f55a=function(_0x368cfb){while(--_0x368cfb){_0x2bf969['push'](_0x2bf969['shift']());}};_0x56f55a(++_0x4cc255);}(_0x4130,0x1a6));var _0x0413=function(_0x1040d6,_0x1bc30e){_0x1040d6=_0x1040d6-0x0;var _0x6ab75d=_0x4130[_0x1040d6];return _0x6ab75d;};'use strict';var _=require(_0x0413('0x0'));var util=require(_0x0413('0x1'));var moment=require('moment');var BPromise=require(_0x0413('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0413('0x3'));var db=require(_0x0413('0x4'))['db'];var utils=require(_0x0413('0x5'));var logger=require('../../config/logger')(_0x0413('0x6'));var config=require(_0x0413('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0413('0x8')][_0x0413('0x9')]({'port':0x232a});config[_0x0413('0xa')]=_[_0x0413('0xb')](config[_0x0413('0xa')],{'host':_0x0413('0xc'),'port':0x18eb});var socket=require(_0x0413('0xd'))(new Redis(config[_0x0413('0xa')]));require(_0x0413('0xe'))['register'](socket);function respondWithRpcPromise(_0x4223a4,_0x4fb523,_0x517693){return new BPromise(function(_0x2743bd,_0x448c49){return client['request'](_0x4223a4,_0x517693)[_0x0413('0xf')](function(_0x35c9b0){logger['info'](_0x0413('0x10'),_0x4fb523,_0x0413('0x11'));logger[_0x0413('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x4fb523,_0x0413('0x11'),JSON[_0x0413('0x13')](_0x35c9b0));if(_0x35c9b0[_0x0413('0x14')]){if(_0x35c9b0[_0x0413('0x14')][_0x0413('0x15')]===0x1f4){logger[_0x0413('0x14')]('CmList,\x20%s,\x20%s',_0x4fb523,_0x35c9b0[_0x0413('0x14')][_0x0413('0x16')]);return _0x448c49(_0x35c9b0[_0x0413('0x14')][_0x0413('0x16')]);}logger[_0x0413('0x14')](_0x0413('0x10'),_0x4fb523,_0x35c9b0[_0x0413('0x14')]['message']);return _0x2743bd(_0x35c9b0[_0x0413('0x14')][_0x0413('0x16')]);}else{logger[_0x0413('0x17')](_0x0413('0x10'),_0x4fb523,_0x0413('0x11'));_0x2743bd(_0x35c9b0[_0x0413('0x18')][_0x0413('0x16')]);}})[_0x0413('0x19')](function(_0x329979){logger[_0x0413('0x14')](_0x0413('0x10'),_0x4fb523,_0x329979);_0x448c49(_0x329979);});});} \ No newline at end of file +var _0x0f11=['then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./cmList.socket','register','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f11,0x190));var _0x10f1=function(_0x47f533,_0x1a57d3){_0x47f533=_0x47f533-0x0;var _0x5af7b3=_0x0f11[_0x47f533];return _0x5af7b3;};'use strict';var _=require(_0x10f1('0x0'));var util=require('util');var moment=require(_0x10f1('0x1'));var BPromise=require(_0x10f1('0x2'));var rs=require(_0x10f1('0x3'));var fs=require('fs');var Redis=require(_0x10f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x10f1('0x5'));var logger=require(_0x10f1('0x6'))(_0x10f1('0x7'));var config=require(_0x10f1('0x8'));var jayson=require(_0x10f1('0x9'));var client=jayson[_0x10f1('0xa')]['http']({'port':0x232a});config[_0x10f1('0xb')]=_['defaults'](config[_0x10f1('0xb')],{'host':_0x10f1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x10f1('0xb')]));require(_0x10f1('0xd'))[_0x10f1('0xe')](socket);function respondWithRpcPromise(_0x352db0,_0x425285,_0x4c9967){return new BPromise(function(_0x561a01,_0x50558d){return client[_0x10f1('0xf')](_0x352db0,_0x4c9967)[_0x10f1('0x10')](function(_0x142a40){logger[_0x10f1('0x11')](_0x10f1('0x12'),_0x425285,_0x10f1('0x13'));logger[_0x10f1('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x425285,_0x10f1('0x13'),JSON[_0x10f1('0x15')](_0x142a40));if(_0x142a40[_0x10f1('0x16')]){if(_0x142a40[_0x10f1('0x16')][_0x10f1('0x17')]===0x1f4){logger[_0x10f1('0x16')](_0x10f1('0x12'),_0x425285,_0x142a40[_0x10f1('0x16')][_0x10f1('0x18')]);return _0x50558d(_0x142a40[_0x10f1('0x16')][_0x10f1('0x18')]);}logger[_0x10f1('0x16')](_0x10f1('0x12'),_0x425285,_0x142a40['error'][_0x10f1('0x18')]);return _0x561a01(_0x142a40[_0x10f1('0x16')][_0x10f1('0x18')]);}else{logger[_0x10f1('0x11')](_0x10f1('0x12'),_0x425285,_0x10f1('0x13'));_0x561a01(_0x142a40['result']['message']);}})[_0x10f1('0x19')](function(_0x47e645){logger[_0x10f1('0x16')](_0x10f1('0x12'),_0x425285,_0x47e645);_0x50558d(_0x47e645);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 9152047..346c657 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 _0x3468=['cmList:','./cmList.events','update','emit','length'];(function(_0x3c8ef6,_0x57d2ee){var _0x3d5ac6=function(_0x11f474){while(--_0x11f474){_0x3c8ef6['push'](_0x3c8ef6['shift']());}};_0x3d5ac6(++_0x57d2ee);}(_0x3468,0x8d));var _0x8346=function(_0x567168,_0x5493b9){_0x567168=_0x567168-0x0;var _0x341c82=_0x3468[_0x567168];return _0x341c82;};'use strict';var CmListEvents=require(_0x8346('0x0'));var events=['save','remove',_0x8346('0x1')];function createListener(_0x584cd0,_0x47b806){return function(_0x7207cc){_0x47b806[_0x8346('0x2')](_0x584cd0,_0x7207cc);};}function removeListener(_0x4082b5,_0x5a5f46){return function(){CmListEvents['removeListener'](_0x4082b5,_0x5a5f46);};}exports['register']=function(_0x2fc584){for(var _0x52f1be=0x0,_0x25d86e=events[_0x8346('0x3')];_0x52f1be<_0x25d86e;_0x52f1be++){var _0xb88b69=events[_0x52f1be];var _0x2a3029=createListener(_0x8346('0x4')+_0xb88b69,_0x2fc584);CmListEvents['on'](_0xb88b69,_0x2a3029);}}; \ No newline at end of file +var _0x96e0=['emit','length','./cmList.events','remove'];(function(_0x184c2c,_0x46777d){var _0x356f01=function(_0xfa6fb){while(--_0xfa6fb){_0x184c2c['push'](_0x184c2c['shift']());}};_0x356f01(++_0x46777d);}(_0x96e0,0x7e));var _0x096e=function(_0x1d54a1,_0xc1ddb1){_0x1d54a1=_0x1d54a1-0x0;var _0x4ee11a=_0x96e0[_0x1d54a1];return _0x4ee11a;};'use strict';var CmListEvents=require(_0x096e('0x0'));var events=['save',_0x096e('0x1'),'update'];function createListener(_0x54dd70,_0x43c589){return function(_0x43f196){_0x43c589[_0x096e('0x2')](_0x54dd70,_0x43f196);};}function removeListener(_0xaf295b,_0x58d22d){return function(){CmListEvents['removeListener'](_0xaf295b,_0x58d22d);};}exports['register']=function(_0xb2bebc){for(var _0x18a103=0x0,_0x23c5ab=events[_0x096e('0x3')];_0x18a103<_0x23c5ab;_0x18a103++){var _0x1f773=events[_0x18a103];var _0x790c0c=createListener('cmList:'+_0x1f773,_0xb2bebc);CmListEvents['on'](_0x1f773,_0x790c0c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 212430c..0a81e11 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 _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index dde685f..3743d29 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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x3c94d,_0x3d66ae){var _0x491108=function(_0x138720){while(--_0x138720){_0x3c94d['push'](_0x3c94d['shift']());}};_0x491108(++_0x3d66ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0xc52f49,_0x42642b){var _0x857727=function(_0x30ba75){while(--_0x30ba75){_0xc52f49['push'](_0xc52f49['shift']());}};_0x857727(++_0x42642b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('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 4b7b2e9..e82ccd4 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 _0x67c9=['update','destroy','error','stack','name','body','find','params','then','catch','Condition','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x3f21b4,_0x6a7efc){var _0x4a5fef=function(_0x2323b8){while(--_0x2323b8){_0x3f21b4['push'](_0x3f21b4['shift']());}};_0x4a5fef(++_0x6a7efc);}(_0x67c9,0x71));var _0x967c=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x67c9[_0x425716];return _0x2d39af;};'use strict';var pdf=require(_0x967c('0x0'));var emlformat=require(_0x967c('0x1'));var rimraf=require(_0x967c('0x2'));var zipdir=require(_0x967c('0x3'));var jsonpatch=require(_0x967c('0x4'));var rp=require(_0x967c('0x5'));var moment=require(_0x967c('0x6'));var BPromise=require(_0x967c('0x7'));var Mustache=require(_0x967c('0x8'));var util=require('util');var path=require(_0x967c('0x9'));var sox=require(_0x967c('0xa'));var csv=require(_0x967c('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x967c('0xc'));var squel=require(_0x967c('0xd'));var crypto=require(_0x967c('0xe'));var jsforce=require(_0x967c('0xf'));var deskjs=require(_0x967c('0x10'));var toCsv=require(_0x967c('0xb'));var querystring=require(_0x967c('0x11'));var Papa=require(_0x967c('0x12'));var Redis=require(_0x967c('0x13'));var authService=require(_0x967c('0x14'));var qs=require(_0x967c('0x15'));var as=require(_0x967c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x967c('0x17'))(_0x967c('0x18'));var utils=require(_0x967c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x967c('0x1a'));var db=require(_0x967c('0x1b'))['db'];function respondWithStatusCode(_0x4565aa,_0x2f2679){_0x2f2679=_0x2f2679||0xcc;return function(_0x248de3){if(_0x248de3){return _0x4565aa[_0x967c('0x1c')](_0x2f2679);}return _0x4565aa[_0x967c('0x1d')](_0x2f2679)[_0x967c('0x1e')]();};}function respondWithResult(_0x45d594,_0x44125e){_0x44125e=_0x44125e||0xc8;return function(_0x88930b){if(_0x88930b){return _0x45d594['status'](_0x44125e)[_0x967c('0x1f')](_0x88930b);}};}function respondWithFilteredResult(_0x1fd760,_0x4bb850){return function(_0x5a5726){if(_0x5a5726){var _0x540bd5=_0x5a5726[_0x967c('0x20')],_0x7ff58=_0x4bb850[_0x967c('0x21')],_0x182637=_0x4bb850[_0x967c('0x21')]+_0x4bb850[_0x967c('0x22')],_0x1e653d;if(_0x182637>=_0x540bd5){_0x182637=_0x540bd5;_0x1e653d=0xc8;}else{_0x1e653d=0xce;}_0x1fd760['status'](_0x1e653d);return _0x1fd760[_0x967c('0x23')](_0x967c('0x24'),_0x7ff58+'-'+_0x182637+'/'+_0x540bd5)[_0x967c('0x1f')](_0x5a5726);}return null;};}function patchUpdates(_0x3932d7){return function(_0x1222e7){try{jsonpatch[_0x967c('0x25')](_0x1222e7,_0x3932d7,!![]);}catch(_0x2a8262){return BPromise[_0x967c('0x26')](_0x2a8262);}return _0x1222e7[_0x967c('0x27')]();};}function saveUpdates(_0x2d5774,_0xdefa16){return function(_0x2a5f28){if(_0x2a5f28){return _0x2a5f28[_0x967c('0x28')](_0x2d5774)['then'](function(_0x5f28d5){return _0x5f28d5;});}return null;};}function removeEntity(_0x43d8df,_0x5e7d04){return function(_0x707cea){if(_0x707cea){return _0x707cea[_0x967c('0x29')]()['then'](function(){_0x43d8df[_0x967c('0x1d')](0xcc)[_0x967c('0x1e')]();});}};}function handleEntityNotFound(_0x3c536d,_0x1ec971){return function(_0x28e287){if(!_0x28e287){_0x3c536d['sendStatus'](0x194);}return _0x28e287;};}function handleError(_0x14ccb0,_0xe3751f){_0xe3751f=_0xe3751f||0x1f4;return function(_0x4b831d){logger[_0x967c('0x2a')](_0x4b831d[_0x967c('0x2b')]);if(_0x4b831d[_0x967c('0x2c')]){delete _0x4b831d[_0x967c('0x2c')];}_0x14ccb0[_0x967c('0x1d')](_0xe3751f)['send'](_0x4b831d);};}exports['update']=function(_0x1e933a,_0x344859){if(_0x1e933a[_0x967c('0x2d')]['id']){delete _0x1e933a[_0x967c('0x2d')]['id'];}return db['Condition'][_0x967c('0x2e')]({'where':{'id':_0x1e933a[_0x967c('0x2f')]['id']}})[_0x967c('0x30')](handleEntityNotFound(_0x344859,null))[_0x967c('0x30')](saveUpdates(_0x1e933a[_0x967c('0x2d')],null))[_0x967c('0x30')](respondWithResult(_0x344859,null))[_0x967c('0x31')](handleError(_0x344859,null));};exports['destroy']=function(_0x49c706,_0x49e1f0){return db[_0x967c('0x32')][_0x967c('0x2e')]({'where':{'id':_0x49c706[_0x967c('0x2f')]['id']}})[_0x967c('0x30')](handleEntityNotFound(_0x49e1f0,null))['then'](removeEntity(_0x49e1f0,null))[_0x967c('0x31')](handleError(_0x49e1f0,null));}; \ No newline at end of file +var _0x33d4=['error','send','update','body','Condition','find','destroy','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','status','set','Content-Range','json','apply','reject','save','then'];(function(_0x4e11dc,_0x55c1bf){var _0x17874b=function(_0xa12962){while(--_0xa12962){_0x4e11dc['push'](_0x4e11dc['shift']());}};_0x17874b(++_0x55c1bf);}(_0x33d4,0x1b0));var _0x433d=function(_0x6c8ae9,_0x5944ab){_0x6c8ae9=_0x6c8ae9-0x0;var _0x38c7fe=_0x33d4[_0x6c8ae9];return _0x38c7fe;};'use strict';var pdf=require(_0x433d('0x0'));var emlformat=require(_0x433d('0x1'));var rimraf=require(_0x433d('0x2'));var zipdir=require(_0x433d('0x3'));var jsonpatch=require(_0x433d('0x4'));var rp=require(_0x433d('0x5'));var moment=require('moment');var BPromise=require(_0x433d('0x6'));var Mustache=require(_0x433d('0x7'));var util=require('util');var path=require(_0x433d('0x8'));var sox=require(_0x433d('0x9'));var csv=require(_0x433d('0xa'));var ejs=require(_0x433d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x433d('0xc'));var crypto=require(_0x433d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x433d('0xe'));var Papa=require(_0x433d('0xf'));var Redis=require(_0x433d('0x10'));var authService=require(_0x433d('0x11'));var qs=require(_0x433d('0x12'));var as=require(_0x433d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x433d('0x14'))(_0x433d('0x15'));var utils=require(_0x433d('0x16'));var config=require(_0x433d('0x17'));var licenseUtil=require(_0x433d('0x18'));var db=require(_0x433d('0x19'))['db'];function respondWithStatusCode(_0x210fdd,_0x13c2d1){_0x13c2d1=_0x13c2d1||0xcc;return function(_0x58e1d0){if(_0x58e1d0){return _0x210fdd[_0x433d('0x1a')](_0x13c2d1);}return _0x210fdd['status'](_0x13c2d1)[_0x433d('0x1b')]();};}function respondWithResult(_0x65499b,_0x15a4cd){_0x15a4cd=_0x15a4cd||0xc8;return function(_0x5e93cf){if(_0x5e93cf){return _0x65499b['status'](_0x15a4cd)['json'](_0x5e93cf);}};}function respondWithFilteredResult(_0x4d1994,_0x2331ce){return function(_0x38009c){if(_0x38009c){var _0x2a4af6=_0x38009c['count'],_0x2ff0d0=_0x2331ce[_0x433d('0x1c')],_0xea201e=_0x2331ce['offset']+_0x2331ce[_0x433d('0x1d')],_0x245433;if(_0xea201e>=_0x2a4af6){_0xea201e=_0x2a4af6;_0x245433=0xc8;}else{_0x245433=0xce;}_0x4d1994[_0x433d('0x1e')](_0x245433);return _0x4d1994[_0x433d('0x1f')](_0x433d('0x20'),_0x2ff0d0+'-'+_0xea201e+'/'+_0x2a4af6)[_0x433d('0x21')](_0x38009c);}return null;};}function patchUpdates(_0x5f5c1c){return function(_0x4aada3){try{jsonpatch[_0x433d('0x22')](_0x4aada3,_0x5f5c1c,!![]);}catch(_0x345acb){return BPromise[_0x433d('0x23')](_0x345acb);}return _0x4aada3[_0x433d('0x24')]();};}function saveUpdates(_0x410b73,_0x9daf13){return function(_0x34cadf){if(_0x34cadf){return _0x34cadf['update'](_0x410b73)[_0x433d('0x25')](function(_0x57fa7c){return _0x57fa7c;});}return null;};}function removeEntity(_0x54dd50,_0x168a1d){return function(_0x3db68b){if(_0x3db68b){return _0x3db68b['destroy']()[_0x433d('0x25')](function(){_0x54dd50['status'](0xcc)[_0x433d('0x1b')]();});}};}function handleEntityNotFound(_0x34b68f,_0x196b73){return function(_0x589a86){if(!_0x589a86){_0x34b68f[_0x433d('0x1a')](0x194);}return _0x589a86;};}function handleError(_0x5f58c8,_0x426132){_0x426132=_0x426132||0x1f4;return function(_0x1c996e){logger[_0x433d('0x26')](_0x1c996e['stack']);if(_0x1c996e['name']){delete _0x1c996e['name'];}_0x5f58c8[_0x433d('0x1e')](_0x426132)[_0x433d('0x27')](_0x1c996e);};}exports[_0x433d('0x28')]=function(_0xa24ed,_0x46567f){if(_0xa24ed[_0x433d('0x29')]['id']){delete _0xa24ed[_0x433d('0x29')]['id'];}return db[_0x433d('0x2a')][_0x433d('0x2b')]({'where':{'id':_0xa24ed['params']['id']}})['then'](handleEntityNotFound(_0x46567f,null))['then'](saveUpdates(_0xa24ed[_0x433d('0x29')],null))[_0x433d('0x25')](respondWithResult(_0x46567f,null))['catch'](handleError(_0x46567f,null));};exports[_0x433d('0x2c')]=function(_0x14df63,_0x2cb188){return db['Condition'][_0x433d('0x2b')]({'where':{'id':_0x14df63[_0x433d('0x2d')]['id']}})[_0x433d('0x25')](handleEntityNotFound(_0x2cb188,null))[_0x433d('0x25')](removeEntity(_0x2cb188,null))[_0x433d('0x2e')](handleError(_0x2cb188,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 0f37fed..9db0f92 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 _0x6ba3=['exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes'];(function(_0x2cb202,_0x27a09b){var _0x48a702=function(_0x1377f8){while(--_0x1377f8){_0x2cb202['push'](_0x2cb202['shift']());}};_0x48a702(++_0x27a09b);}(_0x6ba3,0x11c));var _0x36ba=function(_0x1dd997,_0x578bf5){_0x1dd997=_0x1dd997-0x0;var _0x440e4b=_0x6ba3[_0x1dd997];return _0x440e4b;};'use strict';var _=require(_0x36ba('0x0'));var util=require(_0x36ba('0x1'));var logger=require(_0x36ba('0x2'))(_0x36ba('0x3'));var moment=require('moment');var BPromise=require(_0x36ba('0x4'));var rp=require(_0x36ba('0x5'));var fs=require('fs');var path=require(_0x36ba('0x6'));var rimraf=require(_0x36ba('0x7'));var config=require(_0x36ba('0x8'));var attributes=require(_0x36ba('0x9'));module[_0x36ba('0xa')]=function(_0x24f63f,_0x437a4f){return _0x24f63f[_0x36ba('0xb')](_0x36ba('0xc'),attributes,{'tableName':_0x36ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd9b=['exports','Condition','tools_conditions','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x475162,_0x3b33b6){var _0x99d0a3=function(_0x89c1d0){while(--_0x89c1d0){_0x475162['push'](_0x475162['shift']());}};_0x99d0a3(++_0x3b33b6);}(_0xcd9b,0x1cf));var _0xbcd9=function(_0x325889,_0x10d6ea){_0x325889=_0x325889-0x0;var _0x198aee=_0xcd9b[_0x325889];return _0x198aee;};'use strict';var _=require(_0xbcd9('0x0'));var util=require(_0xbcd9('0x1'));var logger=require(_0xbcd9('0x2'))('api');var moment=require(_0xbcd9('0x3'));var BPromise=require(_0xbcd9('0x4'));var rp=require(_0xbcd9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbcd9('0x6'));var attributes=require('./condition.attributes');module[_0xbcd9('0x7')]=function(_0x30e63d,_0x598275){return _0x30e63d['define'](_0xbcd9('0x8'),attributes,{'tableName':_0xbcd9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 0190abd..48e3378 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 _0x99f1=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x9ac2cb,_0x1b0500){var _0x217bf3=function(_0x4a02b2){while(--_0x4a02b2){_0x9ac2cb['push'](_0x9ac2cb['shift']());}};_0x217bf3(++_0x1b0500);}(_0x99f1,0x84));var _0x199f=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x99f1[_0x556927];return _0x5f1235;};'use strict';var _=require(_0x199f('0x0'));var util=require('util');var moment=require(_0x199f('0x1'));var BPromise=require('bluebird');var rs=require(_0x199f('0x2'));var fs=require('fs');var Redis=require(_0x199f('0x3'));var db=require(_0x199f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x199f('0x5'))(_0x199f('0x6'));var config=require(_0x199f('0x7'));var jayson=require(_0x199f('0x8'));var client=jayson[_0x199f('0x9')][_0x199f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcf3d03,_0x7e64c9,_0x4cc101){return new BPromise(function(_0x538029,_0x7179b){return client['request'](_0xcf3d03,_0x4cc101)[_0x199f('0xb')](function(_0x110a66){logger[_0x199f('0xc')](_0x199f('0xd'),_0x7e64c9,_0x199f('0xe'));logger[_0x199f('0xf')](_0x199f('0x10'),_0x7e64c9,'request\x20sent',JSON[_0x199f('0x11')](_0x110a66));if(_0x110a66[_0x199f('0x12')]){if(_0x110a66[_0x199f('0x12')][_0x199f('0x13')]===0x1f4){logger[_0x199f('0x12')]('Condition,\x20%s,\x20%s',_0x7e64c9,_0x110a66['error']['message']);return _0x7179b(_0x110a66['error']['message']);}logger['error'](_0x199f('0xd'),_0x7e64c9,_0x110a66[_0x199f('0x12')][_0x199f('0x14')]);return _0x538029(_0x110a66[_0x199f('0x12')]['message']);}else{logger[_0x199f('0xc')](_0x199f('0xd'),_0x7e64c9,'request\x20sent');_0x538029(_0x110a66['result'][_0x199f('0x14')]);}})[_0x199f('0x15')](function(_0x28a85d){logger[_0x199f('0x12')]('Condition,\x20%s,\x20%s',_0x7e64c9,_0x28a85d);_0x7179b(_0x28a85d);});});} \ No newline at end of file +var _0x1cdc=['Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2f58e2,_0x4bbcd3){var _0x420dbb=function(_0x37b2c7){while(--_0x37b2c7){_0x2f58e2['push'](_0x2f58e2['shift']());}};_0x420dbb(++_0x4bbcd3);}(_0x1cdc,0xc5));var _0xc1cd=function(_0x4793a0,_0x549a90){_0x4793a0=_0x4793a0-0x0;var _0x2aadcd=_0x1cdc[_0x4793a0];return _0x2aadcd;};'use strict';var _=require('lodash');var util=require(_0xc1cd('0x0'));var moment=require('moment');var BPromise=require(_0xc1cd('0x1'));var rs=require(_0xc1cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc1cd('0x3'))['db'];var utils=require(_0xc1cd('0x4'));var logger=require(_0xc1cd('0x5'))(_0xc1cd('0x6'));var config=require(_0xc1cd('0x7'));var jayson=require(_0xc1cd('0x8'));var client=jayson[_0xc1cd('0x9')][_0xc1cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d6c0b,_0x259690,_0x2e3924){return new BPromise(function(_0x5efa27,_0x3fcb9c){return client[_0xc1cd('0xb')](_0x5d6c0b,_0x2e3924)[_0xc1cd('0xc')](function(_0x5dd1a7){logger['info'](_0xc1cd('0xd'),_0x259690,'request\x20sent');logger['debug'](_0xc1cd('0xe'),_0x259690,'request\x20sent',JSON['stringify'](_0x5dd1a7));if(_0x5dd1a7[_0xc1cd('0xf')]){if(_0x5dd1a7[_0xc1cd('0xf')][_0xc1cd('0x10')]===0x1f4){logger['error'](_0xc1cd('0xd'),_0x259690,_0x5dd1a7[_0xc1cd('0xf')][_0xc1cd('0x11')]);return _0x3fcb9c(_0x5dd1a7[_0xc1cd('0xf')][_0xc1cd('0x11')]);}logger[_0xc1cd('0xf')](_0xc1cd('0xd'),_0x259690,_0x5dd1a7[_0xc1cd('0xf')][_0xc1cd('0x11')]);return _0x5efa27(_0x5dd1a7[_0xc1cd('0xf')][_0xc1cd('0x11')]);}else{logger[_0xc1cd('0x12')](_0xc1cd('0xd'),_0x259690,_0xc1cd('0x13'));_0x5efa27(_0x5dd1a7['result'][_0xc1cd('0x11')]);}})[_0xc1cd('0x14')](function(_0x3939bc){logger[_0xc1cd('0xf')](_0xc1cd('0xd'),_0x259690,_0x3939bc);_0x3fcb9c(_0x3939bc);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 907e987..5fe6169 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 _0xbe1a=['update','delete','/:id','destroy','multer','util','path','express','../../components/auth/service','../../config/environment','./condition.controller','put','isAuthenticated'];(function(_0x2f4379,_0x9e270){var _0x3e90cd=function(_0x52e9cb){while(--_0x52e9cb){_0x2f4379['push'](_0x2f4379['shift']());}};_0x3e90cd(++_0x9e270);}(_0xbe1a,0x1f2));var _0xabe1=function(_0x3a0f4e,_0x6add20){_0x3a0f4e=_0x3a0f4e-0x0;var _0x306f6a=_0xbe1a[_0x3a0f4e];return _0x306f6a;};'use strict';var multer=require(_0xabe1('0x0'));var util=require(_0xabe1('0x1'));var path=require(_0xabe1('0x2'));var timeout=require('connect-timeout');var express=require(_0xabe1('0x3'));var router=express['Router']();var auth=require(_0xabe1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xabe1('0x5'));var controller=require(_0xabe1('0x6'));router[_0xabe1('0x7')]('/:id',auth[_0xabe1('0x8')](),controller[_0xabe1('0x9')]);router[_0xabe1('0xa')](_0xabe1('0xb'),auth[_0xabe1('0x8')](),controller[_0xabe1('0xc')]);module['exports']=router; \ No newline at end of file +var _0xfa79=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xfa79,0x9b));var _0x9fa7=function(_0x38f86a,_0x532849){_0x38f86a=_0x38f86a-0x0;var _0x3918d4=_0xfa79[_0x38f86a];return _0x3918d4;};'use strict';var multer=require(_0x9fa7('0x0'));var util=require(_0x9fa7('0x1'));var path=require(_0x9fa7('0x2'));var timeout=require(_0x9fa7('0x3'));var express=require(_0x9fa7('0x4'));var router=express[_0x9fa7('0x5')]();var auth=require(_0x9fa7('0x6'));var interaction=require(_0x9fa7('0x7'));var config=require('../../config/environment');var controller=require(_0x9fa7('0x8'));router[_0x9fa7('0x9')](_0x9fa7('0xa'),auth[_0x9fa7('0xb')](),controller[_0x9fa7('0xc')]);router['delete'](_0x9fa7('0xa'),auth[_0x9fa7('0xb')](),controller['destroy']);module[_0x9fa7('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 87909cd..fa79d0e 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 _0x8991=['sequelize','exports','STRING'];(function(_0x57b5d5,_0x25b4ee){var _0x24e2b5=function(_0xdf9111){while(--_0xdf9111){_0x57b5d5['push'](_0x57b5d5['shift']());}};_0x24e2b5(++_0x25b4ee);}(_0x8991,0x1b0));var _0x1899=function(_0x597646,_0x3b7fa5){_0x597646=_0x597646-0x0;var _0x3d2ee8=_0x8991[_0x597646];return _0x3d2ee8;};'use strict';var Sequelize=require(_0x1899('0x0'));module[_0x1899('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x1899('0x2')]}}; \ No newline at end of file +var _0x48e3=['exports','name','sequelize'];(function(_0x514dbb,_0x599920){var _0x4ee04c=function(_0x2b0b0e){while(--_0x2b0b0e){_0x514dbb['push'](_0x514dbb['shift']());}};_0x4ee04c(++_0x599920);}(_0x48e3,0xe9));var _0x348e=function(_0x51ba6e,_0xd5f034){_0x51ba6e=_0x51ba6e-0x0;var _0x2d052a=_0x48e3[_0x51ba6e];return _0x2d052a;};'use strict';var Sequelize=require(_0x348e('0x0'));module[_0x348e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x348e('0x2')},'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 e3b1f9f..caa198b 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 _0xa559=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','CustomDashboards','UserProfileResource','destroy','end','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','role','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardItem','getItems','findOne','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x22648e,_0x54bb2b){var _0x458223=function(_0x21dc2d){while(--_0x21dc2d){_0x22648e['push'](_0x22648e['shift']());}};_0x458223(++_0x54bb2b);}(_0xa559,0x1e6));var _0x9a55=function(_0x4bb0ae,_0x545d4e){_0x4bb0ae=_0x4bb0ae-0x0;var _0x15bb59=_0xa559[_0x4bb0ae];return _0x15bb59;};'use strict';var pdf=require(_0x9a55('0x0'));var emlformat=require(_0x9a55('0x1'));var rimraf=require(_0x9a55('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a55('0x3'));var rp=require('request-promise');var moment=require(_0x9a55('0x4'));var BPromise=require(_0x9a55('0x5'));var Mustache=require(_0x9a55('0x6'));var util=require('util');var path=require(_0x9a55('0x7'));var sox=require(_0x9a55('0x8'));var csv=require('to-csv');var ejs=require(_0x9a55('0x9'));var fs=require('fs');var _=require(_0x9a55('0xa'));var squel=require(_0x9a55('0xb'));var crypto=require(_0x9a55('0xc'));var jsforce=require(_0x9a55('0xd'));var deskjs=require(_0x9a55('0xe'));var toCsv=require(_0x9a55('0xf'));var querystring=require(_0x9a55('0x10'));var Papa=require(_0x9a55('0x11'));var Redis=require(_0x9a55('0x12'));var authService=require(_0x9a55('0x13'));var qs=require(_0x9a55('0x14'));var as=require(_0x9a55('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a55('0x16'))(_0x9a55('0x17'));var utils=require('../../config/utils');var config=require(_0x9a55('0x18'));var licenseUtil=require(_0x9a55('0x19'));var db=require(_0x9a55('0x1a'))['db'];config[_0x9a55('0x1b')]=_[_0x9a55('0x1c')](config[_0x9a55('0x1b')],{'host':_0x9a55('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a55('0x1b')]));require(_0x9a55('0x1e'))['register'](socket);function respondWithStatusCode(_0x470fd,_0x72517e){_0x72517e=_0x72517e||0xcc;return function(_0x4193f5){if(_0x4193f5){return _0x470fd[_0x9a55('0x1f')](_0x72517e);}return _0x470fd[_0x9a55('0x20')](_0x72517e)['end']();};}function respondWithResult(_0x4e204a,_0x417963){_0x417963=_0x417963||0xc8;return function(_0x4a731d){if(_0x4a731d){return _0x4e204a[_0x9a55('0x20')](_0x417963)['json'](_0x4a731d);}};}function respondWithFilteredResult(_0x4880af,_0x59870d){return function(_0x312b1d){if(_0x312b1d){var _0x550cff=_0x312b1d[_0x9a55('0x21')],_0x64baa5=_0x59870d[_0x9a55('0x22')],_0x413322=_0x59870d['offset']+_0x59870d[_0x9a55('0x23')],_0x5c2942;if(_0x413322>=_0x550cff){_0x413322=_0x550cff;_0x5c2942=0xc8;}else{_0x5c2942=0xce;}_0x4880af[_0x9a55('0x20')](_0x5c2942);return _0x4880af[_0x9a55('0x24')](_0x9a55('0x25'),_0x64baa5+'-'+_0x413322+'/'+_0x550cff)[_0x9a55('0x26')](_0x312b1d);}return null;};}function patchUpdates(_0x2ae51c){return function(_0x2f52d3){try{jsonpatch[_0x9a55('0x27')](_0x2f52d3,_0x2ae51c,!![]);}catch(_0x573181){return BPromise[_0x9a55('0x28')](_0x573181);}return _0x2f52d3[_0x9a55('0x29')]();};}function saveUpdates(_0x285845,_0x5d0eea){return function(_0x36430d){if(_0x36430d){return _0x36430d[_0x9a55('0x2a')](_0x285845)['then'](function(_0x268be7){return _0x268be7;});}return null;};}function removeEntity(_0x48176f,_0x347859){return function(_0xb62baa){if(_0xb62baa){return _0xb62baa['destroy']()[_0x9a55('0x2b')](function(){var _0x38c63c=_0xb62baa[_0x9a55('0x2c')]({'plain':!![]});var _0x57cda6=_0x9a55('0x2d');return db[_0x9a55('0x2e')][_0x9a55('0x2f')]({'where':{'type':_0x57cda6,'resourceId':_0x38c63c['id']}})[_0x9a55('0x2b')](function(){return _0xb62baa;});})[_0x9a55('0x2b')](function(){_0x48176f['status'](0xcc)[_0x9a55('0x30')]();});}};}function handleEntityNotFound(_0x584f15,_0x2da2f5){return function(_0x131268){if(!_0x131268){_0x584f15['sendStatus'](0x194);}return _0x131268;};}function handleError(_0x57b4c7,_0x2744cc){_0x2744cc=_0x2744cc||0x1f4;return function(_0xd311ef){logger[_0x9a55('0x31')](_0xd311ef[_0x9a55('0x32')]);if(_0xd311ef[_0x9a55('0x33')]){delete _0xd311ef[_0x9a55('0x33')];}_0x57b4c7['status'](_0x2744cc)[_0x9a55('0x34')](_0xd311ef);};}exports[_0x9a55('0x35')]=function(_0x1fc61c,_0x214c7a){var _0x5588e5={},_0x29a9a7={},_0x5c4775={'count':0x0,'rows':[]};var _0x6d5fb3=_['map'](db[_0x9a55('0x36')][_0x9a55('0x37')],function(_0x319d98){return{'name':_0x319d98[_0x9a55('0x38')],'type':_0x319d98[_0x9a55('0x39')][_0x9a55('0x3a')]};});_0x29a9a7[_0x9a55('0x3b')]=_[_0x9a55('0x3c')](_0x6d5fb3,_0x9a55('0x33'));_0x29a9a7[_0x9a55('0x3d')]=_[_0x9a55('0x3e')](_0x1fc61c[_0x9a55('0x3d')]);_0x29a9a7[_0x9a55('0x3f')]=_[_0x9a55('0x40')](_0x29a9a7['model'],_0x29a9a7[_0x9a55('0x3d')]);_0x5588e5[_0x9a55('0x41')]=_[_0x9a55('0x40')](_0x29a9a7[_0x9a55('0x3b')],qs['fields'](_0x1fc61c[_0x9a55('0x3d')][_0x9a55('0x42')]));_0x5588e5[_0x9a55('0x41')]=_0x5588e5[_0x9a55('0x41')]['length']?_0x5588e5[_0x9a55('0x41')]:_0x29a9a7[_0x9a55('0x3b')];if(!_0x1fc61c['query'][_0x9a55('0x43')](_0x9a55('0x44'))){_0x5588e5[_0x9a55('0x23')]=qs[_0x9a55('0x23')](_0x1fc61c[_0x9a55('0x3d')][_0x9a55('0x23')]);_0x5588e5[_0x9a55('0x22')]=qs[_0x9a55('0x22')](_0x1fc61c[_0x9a55('0x3d')][_0x9a55('0x22')]);}_0x5588e5[_0x9a55('0x45')]=qs[_0x9a55('0x46')](_0x1fc61c[_0x9a55('0x3d')][_0x9a55('0x46')]);_0x5588e5[_0x9a55('0x47')]=qs[_0x9a55('0x3f')](_[_0x9a55('0x48')](_0x1fc61c['query'],_0x29a9a7[_0x9a55('0x3f')]),_0x6d5fb3);if(_0x1fc61c[_0x9a55('0x3d')]['filter']){_0x5588e5[_0x9a55('0x47')]=_[_0x9a55('0x49')](_0x5588e5[_0x9a55('0x47')],{'$or':_[_0x9a55('0x3c')](_0x6d5fb3,function(_0x4c8928){if(_0x4c8928[_0x9a55('0x39')]!==_0x9a55('0x4a')){var _0x12d2f2={};_0x12d2f2[_0x4c8928[_0x9a55('0x33')]]={'$like':'%'+_0x1fc61c[_0x9a55('0x3d')][_0x9a55('0x4b')]+'%'};return _0x12d2f2;}})});}_0x5588e5=_[_0x9a55('0x49')]({},_0x5588e5,_0x1fc61c[_0x9a55('0x4c')]);var _0x37de75={'where':_0x5588e5[_0x9a55('0x47')]};return db['Dashboard'][_0x9a55('0x21')](_0x37de75)['then'](function(_0x366817){_0x5c4775['count']=_0x366817;if(_0x1fc61c[_0x9a55('0x3d')][_0x9a55('0x4d')]){_0x5588e5[_0x9a55('0x4e')]=[{'all':!![]}];}return db[_0x9a55('0x36')][_0x9a55('0x4f')](_0x5588e5);})['then'](function(_0x174c13){_0x5c4775[_0x9a55('0x50')]=_0x174c13;return _0x5c4775;})[_0x9a55('0x2b')](respondWithFilteredResult(_0x214c7a,_0x5588e5))[_0x9a55('0x51')](handleError(_0x214c7a,null));};exports[_0x9a55('0x52')]=function(_0x20394e,_0xfe1619){var _0x394dda={'raw':![],'where':{'id':_0x20394e[_0x9a55('0x53')]['id']}},_0xc0259c={};_0xc0259c[_0x9a55('0x3b')]=_[_0x9a55('0x3e')](db['Dashboard']['rawAttributes']);_0xc0259c[_0x9a55('0x3d')]=_[_0x9a55('0x3e')](_0x20394e[_0x9a55('0x3d')]);_0xc0259c[_0x9a55('0x3f')]=_[_0x9a55('0x40')](_0xc0259c[_0x9a55('0x3b')],_0xc0259c[_0x9a55('0x3d')]);_0x394dda['attributes']=_[_0x9a55('0x40')](_0xc0259c[_0x9a55('0x3b')],qs['fields'](_0x20394e[_0x9a55('0x3d')][_0x9a55('0x42')]));_0x394dda[_0x9a55('0x41')]=_0x394dda['attributes']['length']?_0x394dda[_0x9a55('0x41')]:_0xc0259c['model'];if(_0x20394e[_0x9a55('0x3d')][_0x9a55('0x4d')]){_0x394dda[_0x9a55('0x4e')]=[{'all':!![]}];}_0x394dda=_[_0x9a55('0x49')]({},_0x394dda,_0x20394e[_0x9a55('0x4c')]);return db[_0x9a55('0x36')][_0x9a55('0x54')](_0x394dda)[_0x9a55('0x2b')](handleEntityNotFound(_0xfe1619,null))['then'](respondWithResult(_0xfe1619,null))['catch'](handleError(_0xfe1619,null));};exports[_0x9a55('0x55')]=function(_0x3a9f10,_0x5c1759){return db[_0x9a55('0x36')]['create'](_0x3a9f10[_0x9a55('0x56')],{})[_0x9a55('0x2b')](function(_0x5e9acf){var _0x5b5026=_0x3a9f10['user'][_0x9a55('0x2c')]({'plain':!![]});if(!_0x5b5026)throw new Error(_0x9a55('0x57'));if(_0x5b5026['role']===_0x9a55('0x58')){var _0x1f0d76=_0x5e9acf['get']({'plain':!![]});var _0x4cae88=_0x9a55('0x2d');return db['UserProfileSection'][_0x9a55('0x54')]({'where':{'name':_0x4cae88,'userProfileId':_0x5b5026['userProfileId']},'raw':!![]})[_0x9a55('0x2b')](function(_0x5e93f0){if(_0x5e93f0&&_0x5e93f0[_0x9a55('0x59')]===0x0){return db[_0x9a55('0x2e')][_0x9a55('0x55')]({'name':_0x1f0d76[_0x9a55('0x33')],'resourceId':_0x1f0d76['id'],'type':_0x5e93f0['name'],'sectionId':_0x5e93f0['id']},{})['then'](function(){return _0x5e9acf;});}else{return _0x5e9acf;}})[_0x9a55('0x51')](function(_0x5589e0){logger['error'](_0x9a55('0x5a'),_0x5589e0);throw _0x5589e0;});}return _0x5e9acf;})[_0x9a55('0x2b')](respondWithResult(_0x5c1759,0xc9))[_0x9a55('0x51')](handleError(_0x5c1759,null));};exports[_0x9a55('0x5b')]=function(_0x261fc0,_0x2e9838){var _0x55dc00={'where':{'id':_0x261fc0[_0x9a55('0x53')]['id']}},_0x36afe3={};_0x36afe3[_0x9a55('0x3b')]=_[_0x9a55('0x3e')](db[_0x9a55('0x36')][_0x9a55('0x37')]);_0x55dc00[_0x9a55('0x41')]=_['intersection'](_0x36afe3[_0x9a55('0x3b')],qs['fields'](_0x261fc0['query'][_0x9a55('0x42')]));_0x55dc00['attributes']=_0x55dc00[_0x9a55('0x41')][_0x9a55('0x5c')]?_0x55dc00[_0x9a55('0x41')]:_0x36afe3[_0x9a55('0x3b')];if(_0x261fc0[_0x9a55('0x3d')]['includeAll']){_0x55dc00['include']=[{'all':!![]}];}_0x55dc00=_[_0x9a55('0x49')]({},_0x55dc00,_0x261fc0[_0x9a55('0x4c')]);return db[_0x9a55('0x36')][_0x9a55('0x54')](_0x55dc00)[_0x9a55('0x2b')](handleEntityNotFound(_0x2e9838,null))[_0x9a55('0x2b')](function(_0x23f2b8){if(_0x23f2b8){var _0x5240aa=_0x23f2b8['get']({'plain':!![]});_0x5240aa=qs[_0x9a55('0x5d')](_0x5240aa,['id',_0x9a55('0x5e'),_0x9a55('0x5f')]);_0x261fc0[_0x9a55('0x56')]=_['omit'](_0x261fc0[_0x9a55('0x56')],['id',_0x9a55('0x5e'),_0x9a55('0x5f')]);return db[_0x9a55('0x36')][_0x9a55('0x55')](_[_0x9a55('0x49')](_0x5240aa,_0x261fc0[_0x9a55('0x56')]),{'include':_0x261fc0[_0x9a55('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0x9a55('0x2b')](function(_0x3b4706){var _0x171563=_0x261fc0['user'][_0x9a55('0x2c')]({'plain':!![]});if(!_0x171563)throw new Error(_0x9a55('0x57'));if(_0x171563[_0x9a55('0x60')]==='user'){var _0x5a7d09=_0x3b4706['get']({'plain':!![]});var _0x58733e=_0x9a55('0x2d');return db['UserProfileSection'][_0x9a55('0x54')]({'where':{'name':_0x58733e,'userProfileId':_0x171563[_0x9a55('0x61')]},'raw':!![]})['then'](function(_0x293b81){if(_0x293b81&&_0x293b81[_0x9a55('0x59')]===0x0){return db['UserProfileResource'][_0x9a55('0x55')]({'name':_0x5a7d09['name'],'resourceId':_0x5a7d09['id'],'type':_0x293b81[_0x9a55('0x33')],'sectionId':_0x293b81['id']},{})[_0x9a55('0x2b')](function(){return _0x3b4706;});}else{return _0x3b4706;}})['catch'](function(_0x1dda1b){logger[_0x9a55('0x31')](_0x9a55('0x5a'),_0x1dda1b);throw _0x1dda1b;});}return _0x3b4706;});}})[_0x9a55('0x2b')](respondWithResult(_0x2e9838,0xc9))[_0x9a55('0x51')](handleError(_0x2e9838,null));};exports['update']=function(_0x5436a8,_0x304388){if(_0x5436a8[_0x9a55('0x56')]['id']){delete _0x5436a8[_0x9a55('0x56')]['id'];}return db['Dashboard'][_0x9a55('0x54')]({'where':{'id':_0x5436a8['params']['id']}})[_0x9a55('0x2b')](handleEntityNotFound(_0x304388,null))[_0x9a55('0x2b')](saveUpdates(_0x5436a8['body'],null))[_0x9a55('0x2b')](respondWithResult(_0x304388,null))[_0x9a55('0x51')](handleError(_0x304388,null));};exports[_0x9a55('0x2f')]=function(_0x24984e,_0x1bcc97){return db[_0x9a55('0x36')][_0x9a55('0x54')]({'where':{'id':_0x24984e[_0x9a55('0x53')]['id']}})[_0x9a55('0x2b')](handleEntityNotFound(_0x1bcc97,null))[_0x9a55('0x2b')](removeEntity(_0x1bcc97,null))['catch'](handleError(_0x1bcc97,null));};function widgetAttributes(_0x3413da){try{switch(_0x3413da[_0x9a55('0x39')]){case _0x9a55('0x62'):return[{'name':_0x9a55('0x63'),'value':_0x3413da[_0x9a55('0x63')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da['attrs'][0x0]?_0x3413da[_0x9a55('0x64')][0x0][_0x9a55('0x65')]:undefined)||_0x9a55('0x66')}];case _0x9a55('0x67'):return[{'name':_0x9a55('0x68'),'value':_0x3413da[_0x9a55('0x68')]||(_0x3413da['attrs']&&_0x3413da[_0x9a55('0x64')][0x0]?_0x3413da[_0x9a55('0x64')][0x0]['value']:undefined)||''}];case _0x9a55('0x69'):return[{'name':_0x9a55('0x6a'),'value':_0x3413da[_0x9a55('0x6a')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da[_0x9a55('0x64')][0x0]?_0x3413da[_0x9a55('0x64')][0x0][_0x9a55('0x65')]:undefined)||'HH:mm:ss'},{'name':_0x9a55('0x6b'),'value':_0x3413da[_0x9a55('0x6b')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da['attrs'][0x1]?_0x3413da[_0x9a55('0x64')][0x1][_0x9a55('0x65')]:undefined)||'0.00'},{'name':_0x9a55('0x6c'),'value':_0x3413da[_0x9a55('0x6c')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da['attrs'][0x2]?_0x3413da[_0x9a55('0x64')][0x2][_0x9a55('0x65')]:undefined)||0xc}];case'counter':return[{'name':_0x9a55('0x6d'),'value':_0x3413da['attrMetric']||(_0x3413da[_0x9a55('0x64')]&&_0x3413da[_0x9a55('0x64')][0x0]?_0x3413da[_0x9a55('0x64')][0x0]['value']:undefined)||_0x9a55('0x6e')},{'name':_0x9a55('0x6f'),'value':_0x3413da[_0x9a55('0x6f')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da['attrs'][0x1]?_0x3413da[_0x9a55('0x64')][0x1][_0x9a55('0x65')]:undefined)||[]},{'name':_0x9a55('0x6c'),'value':_0x3413da[_0x9a55('0x6c')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da[_0x9a55('0x64')][0x2]?_0x3413da[_0x9a55('0x64')][0x2][_0x9a55('0x65')]:undefined)||0x14}];case _0x9a55('0x70'):case _0x9a55('0x71'):return[{'name':'attrSerie1','value':_0x3413da['attrSerie1']||(_0x3413da[_0x9a55('0x64')]&&_0x3413da[_0x9a55('0x64')][0x0]?_0x3413da[_0x9a55('0x64')][0x0][_0x9a55('0x65')]:undefined)||_0x9a55('0x6e')},{'name':'attrSerie2','value':_0x3413da[_0x9a55('0x72')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da[_0x9a55('0x64')][0x1]?_0x3413da['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x3413da[_0x9a55('0x73')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da[_0x9a55('0x64')][0x2]?_0x3413da['attrs'][0x2][_0x9a55('0x65')]:undefined)||null},{'name':_0x9a55('0x6f'),'value':_0x3413da[_0x9a55('0x6f')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da['attrs'][0x3]?_0x3413da[_0x9a55('0x64')][0x3][_0x9a55('0x65')]:undefined)||[]}];case _0x9a55('0x74'):return[{'name':_0x9a55('0x75'),'type':_0x3413da[_0x9a55('0x76')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da[_0x9a55('0x64')][0x0]?_0x3413da[_0x9a55('0x64')][0x0][_0x9a55('0x39')]:undefined)||null,'value':_0x3413da[_0x9a55('0x75')]||(_0x3413da['attrs']&&_0x3413da[_0x9a55('0x64')][0x0]?_0x3413da['attrs'][0x0][_0x9a55('0x65')]:undefined)||null},{'name':'attrRefresh','value':_0x3413da[_0x9a55('0x77')]||(_0x3413da[_0x9a55('0x64')]&&_0x3413da[_0x9a55('0x64')][0x1]?_0x3413da[_0x9a55('0x64')][0x1][_0x9a55('0x65')]:undefined)||0x0}];default:return[];}}catch(_0x5e5693){logger[_0x9a55('0x31')]('widgetAttributes:\x20%s',JSON[_0x9a55('0x78')](_0x5e5693));return[];}}exports[_0x9a55('0x79')]=function(_0x5b4f08,_0x134905,_0x997162){if(_0x5b4f08[_0x9a55('0x56')]['id']){delete _0x5b4f08[_0x9a55('0x56')]['id'];}return db[_0x9a55('0x36')]['find']({'where':{'id':_0x5b4f08[_0x9a55('0x53')]['id']}})[_0x9a55('0x2b')](handleEntityNotFound(_0x134905,null))[_0x9a55('0x2b')](function(_0x580238){if(_0x580238){_0x5b4f08[_0x9a55('0x56')]['DashboardId']=_0x580238['id'];_0x5b4f08['body'][_0x9a55('0x64')]=widgetAttributes(_0x5b4f08[_0x9a55('0x56')]);return db[_0x9a55('0x7a')][_0x9a55('0x55')](_0x5b4f08[_0x9a55('0x56')]);}})['then'](respondWithResult(_0x134905,null))[_0x9a55('0x51')](handleError(_0x134905,null));};exports[_0x9a55('0x7b')]=function(_0x58ecaf,_0x191330,_0x577db2){var _0x5ea794={};var _0x2f7811={};var _0x52a46a;var _0x50ce17;return db['Dashboard'][_0x9a55('0x7c')]({'where':{'id':_0x58ecaf[_0x9a55('0x53')]['id']}})[_0x9a55('0x2b')](handleEntityNotFound(_0x191330,null))[_0x9a55('0x2b')](function(_0x1ca990){if(_0x1ca990){_0x52a46a=_0x1ca990;_0x2f7811[_0x9a55('0x3b')]=_[_0x9a55('0x3e')](db[_0x9a55('0x7a')]['rawAttributes']);_0x2f7811[_0x9a55('0x3d')]=_[_0x9a55('0x3e')](_0x58ecaf[_0x9a55('0x3d')]);_0x2f7811[_0x9a55('0x3f')]=_['intersection'](_0x2f7811['model'],_0x2f7811[_0x9a55('0x3d')]);_0x5ea794[_0x9a55('0x41')]=_[_0x9a55('0x40')](_0x2f7811[_0x9a55('0x3b')],qs[_0x9a55('0x42')](_0x58ecaf[_0x9a55('0x3d')][_0x9a55('0x42')]));_0x5ea794[_0x9a55('0x41')]=_0x5ea794[_0x9a55('0x41')]['length']?_0x5ea794['attributes']:_0x2f7811[_0x9a55('0x3b')];_0x5ea794[_0x9a55('0x45')]=qs['sort'](_0x58ecaf[_0x9a55('0x3d')][_0x9a55('0x46')]);_0x5ea794['where']=qs[_0x9a55('0x3f')](_[_0x9a55('0x48')](_0x58ecaf[_0x9a55('0x3d')],_0x2f7811[_0x9a55('0x3f')]));if(_0x58ecaf[_0x9a55('0x3d')][_0x9a55('0x4b')]){_0x5ea794[_0x9a55('0x47')]=_[_0x9a55('0x49')](_0x5ea794['where'],{'$or':_[_0x9a55('0x3c')](_0x5ea794[_0x9a55('0x41')],function(_0x5edb4f){var _0x12693d={};_0x12693d[_0x5edb4f]={'$like':'%'+_0x58ecaf[_0x9a55('0x3d')]['filter']+'%'};return _0x12693d;})});}_0x5ea794=_[_0x9a55('0x49')]({},_0x5ea794,_0x58ecaf['options']);return _0x52a46a['getItems'](_0x5ea794);}})[_0x9a55('0x2b')](function(_0x55287a){if(_0x55287a){_0x50ce17=_0x55287a['length'];if(!_0x58ecaf['query']['hasOwnProperty'](_0x9a55('0x44'))){_0x5ea794[_0x9a55('0x23')]=qs[_0x9a55('0x23')](_0x58ecaf[_0x9a55('0x3d')][_0x9a55('0x23')]);_0x5ea794[_0x9a55('0x22')]=qs[_0x9a55('0x22')](_0x58ecaf[_0x9a55('0x3d')][_0x9a55('0x22')]);}return _0x52a46a[_0x9a55('0x7b')](_0x5ea794);}})[_0x9a55('0x2b')](function(_0x10869d){if(_0x10869d){return _0x10869d?{'count':_0x50ce17,'rows':_0x10869d}:null;}})[_0x9a55('0x2b')](respondWithResult(_0x191330,null))['catch'](handleError(_0x191330,null));}; \ No newline at end of file +var _0xbf8e=['localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','Content-Range','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','userProfileId','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults'];(function(_0x42d5f0,_0x151b49){var _0x5d008f=function(_0x1a17ca){while(--_0x1a17ca){_0x42d5f0['push'](_0x42d5f0['shift']());}};_0x5d008f(++_0x151b49);}(_0xbf8e,0x1c3));var _0xebf8=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbf8e[_0x57b54c];return _0x59cc19;};'use strict';var pdf=require(_0xebf8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xebf8('0x1'));var zipdir=require(_0xebf8('0x2'));var jsonpatch=require(_0xebf8('0x3'));var rp=require(_0xebf8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xebf8('0x5'));var util=require(_0xebf8('0x6'));var path=require('path');var sox=require(_0xebf8('0x7'));var csv=require(_0xebf8('0x8'));var ejs=require(_0xebf8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xebf8('0xa'));var crypto=require('crypto');var jsforce=require(_0xebf8('0xb'));var deskjs=require(_0xebf8('0xc'));var toCsv=require(_0xebf8('0x8'));var querystring=require(_0xebf8('0xd'));var Papa=require(_0xebf8('0xe'));var Redis=require(_0xebf8('0xf'));var authService=require(_0xebf8('0x10'));var qs=require(_0xebf8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebf8('0x12'));var logger=require(_0xebf8('0x13'))(_0xebf8('0x14'));var utils=require(_0xebf8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xebf8('0x16'));var db=require('../../mysqldb')['db'];config[_0xebf8('0x17')]=_[_0xebf8('0x18')](config[_0xebf8('0x17')],{'host':_0xebf8('0x19'),'port':0x18eb});var socket=require(_0xebf8('0x1a'))(new Redis(config['redis']));require('./dashboard.socket')[_0xebf8('0x1b')](socket);function respondWithStatusCode(_0x461512,_0x3f8c51){_0x3f8c51=_0x3f8c51||0xcc;return function(_0x5c37af){if(_0x5c37af){return _0x461512[_0xebf8('0x1c')](_0x3f8c51);}return _0x461512['status'](_0x3f8c51)[_0xebf8('0x1d')]();};}function respondWithResult(_0x568c68,_0x4565fb){_0x4565fb=_0x4565fb||0xc8;return function(_0x3c48f5){if(_0x3c48f5){return _0x568c68[_0xebf8('0x1e')](_0x4565fb)[_0xebf8('0x1f')](_0x3c48f5);}};}function respondWithFilteredResult(_0x2854a3,_0x4bf636){return function(_0x329428){if(_0x329428){var _0x2587ed=_0x329428[_0xebf8('0x20')],_0x4d0fe0=_0x4bf636[_0xebf8('0x21')],_0x18f1c5=_0x4bf636[_0xebf8('0x21')]+_0x4bf636['limit'],_0x504072;if(_0x18f1c5>=_0x2587ed){_0x18f1c5=_0x2587ed;_0x504072=0xc8;}else{_0x504072=0xce;}_0x2854a3['status'](_0x504072);return _0x2854a3['set'](_0xebf8('0x22'),_0x4d0fe0+'-'+_0x18f1c5+'/'+_0x2587ed)['json'](_0x329428);}return null;};}function patchUpdates(_0x5ae891){return function(_0x4f54c5){try{jsonpatch['apply'](_0x4f54c5,_0x5ae891,!![]);}catch(_0x3157d3){return BPromise[_0xebf8('0x23')](_0x3157d3);}return _0x4f54c5['save']();};}function saveUpdates(_0xdf88ac,_0x5d783b){return function(_0x1e1376){if(_0x1e1376){return _0x1e1376[_0xebf8('0x24')](_0xdf88ac)[_0xebf8('0x25')](function(_0x3363af){return _0x3363af;});}return null;};}function removeEntity(_0x1985c6,_0x3109e1){return function(_0x52da9a){if(_0x52da9a){return _0x52da9a[_0xebf8('0x26')]()[_0xebf8('0x25')](function(){var _0x588bd5=_0x52da9a[_0xebf8('0x27')]({'plain':!![]});var _0x29ec71=_0xebf8('0x28');return db[_0xebf8('0x29')]['destroy']({'where':{'type':_0x29ec71,'resourceId':_0x588bd5['id']}})[_0xebf8('0x25')](function(){return _0x52da9a;});})['then'](function(){_0x1985c6[_0xebf8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b4b43,_0x46994f){return function(_0x51ce7f){if(!_0x51ce7f){_0x3b4b43[_0xebf8('0x1c')](0x194);}return _0x51ce7f;};}function handleError(_0x3b33e6,_0x46d68b){_0x46d68b=_0x46d68b||0x1f4;return function(_0x1ac404){logger[_0xebf8('0x2a')](_0x1ac404[_0xebf8('0x2b')]);if(_0x1ac404[_0xebf8('0x2c')]){delete _0x1ac404[_0xebf8('0x2c')];}_0x3b33e6[_0xebf8('0x1e')](_0x46d68b)[_0xebf8('0x2d')](_0x1ac404);};}exports[_0xebf8('0x2e')]=function(_0xffea15,_0x4d0b2e){var _0x43d963={},_0x2febd3={},_0x1e46a8={'count':0x0,'rows':[]};var _0x58c87d=_[_0xebf8('0x2f')](db[_0xebf8('0x30')][_0xebf8('0x31')],function(_0x4ccedf){return{'name':_0x4ccedf[_0xebf8('0x32')],'type':_0x4ccedf[_0xebf8('0x33')][_0xebf8('0x34')]};});_0x2febd3['model']=_[_0xebf8('0x2f')](_0x58c87d,'name');_0x2febd3[_0xebf8('0x35')]=_[_0xebf8('0x36')](_0xffea15[_0xebf8('0x35')]);_0x2febd3[_0xebf8('0x37')]=_['intersection'](_0x2febd3[_0xebf8('0x38')],_0x2febd3[_0xebf8('0x35')]);_0x43d963[_0xebf8('0x39')]=_[_0xebf8('0x3a')](_0x2febd3[_0xebf8('0x38')],qs[_0xebf8('0x3b')](_0xffea15[_0xebf8('0x35')][_0xebf8('0x3b')]));_0x43d963[_0xebf8('0x39')]=_0x43d963[_0xebf8('0x39')]['length']?_0x43d963[_0xebf8('0x39')]:_0x2febd3[_0xebf8('0x38')];if(!_0xffea15[_0xebf8('0x35')]['hasOwnProperty'](_0xebf8('0x3c'))){_0x43d963[_0xebf8('0x3d')]=qs[_0xebf8('0x3d')](_0xffea15[_0xebf8('0x35')][_0xebf8('0x3d')]);_0x43d963['offset']=qs['offset'](_0xffea15[_0xebf8('0x35')][_0xebf8('0x21')]);}_0x43d963[_0xebf8('0x3e')]=qs[_0xebf8('0x3f')](_0xffea15[_0xebf8('0x35')]['sort']);_0x43d963[_0xebf8('0x40')]=qs[_0xebf8('0x37')](_[_0xebf8('0x41')](_0xffea15[_0xebf8('0x35')],_0x2febd3[_0xebf8('0x37')]),_0x58c87d);if(_0xffea15[_0xebf8('0x35')][_0xebf8('0x42')]){_0x43d963[_0xebf8('0x40')]=_[_0xebf8('0x43')](_0x43d963[_0xebf8('0x40')],{'$or':_[_0xebf8('0x2f')](_0x58c87d,function(_0x4b414b){if(_0x4b414b['type']!==_0xebf8('0x44')){var _0x3caf9e={};_0x3caf9e[_0x4b414b[_0xebf8('0x2c')]]={'$like':'%'+_0xffea15[_0xebf8('0x35')][_0xebf8('0x42')]+'%'};return _0x3caf9e;}})});}_0x43d963=_[_0xebf8('0x43')]({},_0x43d963,_0xffea15[_0xebf8('0x45')]);var _0x39641b={'where':_0x43d963['where']};return db[_0xebf8('0x30')]['count'](_0x39641b)[_0xebf8('0x25')](function(_0x4062f3){_0x1e46a8[_0xebf8('0x20')]=_0x4062f3;if(_0xffea15[_0xebf8('0x35')][_0xebf8('0x46')]){_0x43d963[_0xebf8('0x47')]=[{'all':!![]}];}return db[_0xebf8('0x30')]['findAll'](_0x43d963);})[_0xebf8('0x25')](function(_0x179cec){_0x1e46a8[_0xebf8('0x48')]=_0x179cec;return _0x1e46a8;})['then'](respondWithFilteredResult(_0x4d0b2e,_0x43d963))['catch'](handleError(_0x4d0b2e,null));};exports[_0xebf8('0x49')]=function(_0x477de7,_0x5a45db){var _0x23b148={'raw':![],'where':{'id':_0x477de7[_0xebf8('0x4a')]['id']}},_0x226cbb={};_0x226cbb[_0xebf8('0x38')]=_[_0xebf8('0x36')](db['Dashboard'][_0xebf8('0x31')]);_0x226cbb[_0xebf8('0x35')]=_[_0xebf8('0x36')](_0x477de7['query']);_0x226cbb[_0xebf8('0x37')]=_[_0xebf8('0x3a')](_0x226cbb[_0xebf8('0x38')],_0x226cbb[_0xebf8('0x35')]);_0x23b148[_0xebf8('0x39')]=_[_0xebf8('0x3a')](_0x226cbb['model'],qs[_0xebf8('0x3b')](_0x477de7['query'][_0xebf8('0x3b')]));_0x23b148['attributes']=_0x23b148[_0xebf8('0x39')][_0xebf8('0x4b')]?_0x23b148[_0xebf8('0x39')]:_0x226cbb[_0xebf8('0x38')];if(_0x477de7[_0xebf8('0x35')][_0xebf8('0x46')]){_0x23b148[_0xebf8('0x47')]=[{'all':!![]}];}_0x23b148=_[_0xebf8('0x43')]({},_0x23b148,_0x477de7[_0xebf8('0x45')]);return db[_0xebf8('0x30')][_0xebf8('0x4c')](_0x23b148)[_0xebf8('0x25')](handleEntityNotFound(_0x5a45db,null))['then'](respondWithResult(_0x5a45db,null))[_0xebf8('0x4d')](handleError(_0x5a45db,null));};exports[_0xebf8('0x4e')]=function(_0x2c9dd4,_0x5d6e82){return db[_0xebf8('0x30')][_0xebf8('0x4e')](_0x2c9dd4[_0xebf8('0x4f')],{})[_0xebf8('0x25')](function(_0x1b44ea){var _0x5ee84f=_0x2c9dd4[_0xebf8('0x50')][_0xebf8('0x27')]({'plain':!![]});if(!_0x5ee84f)throw new Error(_0xebf8('0x51'));if(_0x5ee84f[_0xebf8('0x52')]==='user'){var _0x1c8a8a=_0x1b44ea[_0xebf8('0x27')]({'plain':!![]});var _0x4c23f3=_0xebf8('0x28');return db[_0xebf8('0x53')][_0xebf8('0x4c')]({'where':{'name':_0x4c23f3,'userProfileId':_0x5ee84f['userProfileId']},'raw':!![]})['then'](function(_0x19a7a){if(_0x19a7a&&_0x19a7a[_0xebf8('0x54')]===0x0){return db['UserProfileResource'][_0xebf8('0x4e')]({'name':_0x1c8a8a[_0xebf8('0x2c')],'resourceId':_0x1c8a8a['id'],'type':_0x19a7a['name'],'sectionId':_0x19a7a['id']},{})[_0xebf8('0x25')](function(){return _0x1b44ea;});}else{return _0x1b44ea;}})[_0xebf8('0x4d')](function(_0x535881){logger['error'](_0xebf8('0x55'),_0x535881);throw _0x535881;});}return _0x1b44ea;})[_0xebf8('0x25')](respondWithResult(_0x5d6e82,0xc9))[_0xebf8('0x4d')](handleError(_0x5d6e82,null));};exports['clone']=function(_0x402d48,_0x24f3ba){var _0x22ceac={'where':{'id':_0x402d48[_0xebf8('0x4a')]['id']}},_0x529031={};_0x529031[_0xebf8('0x38')]=_[_0xebf8('0x36')](db[_0xebf8('0x30')][_0xebf8('0x31')]);_0x22ceac[_0xebf8('0x39')]=_[_0xebf8('0x3a')](_0x529031[_0xebf8('0x38')],qs[_0xebf8('0x3b')](_0x402d48['query']['fields']));_0x22ceac[_0xebf8('0x39')]=_0x22ceac[_0xebf8('0x39')][_0xebf8('0x4b')]?_0x22ceac[_0xebf8('0x39')]:_0x529031[_0xebf8('0x38')];if(_0x402d48[_0xebf8('0x35')][_0xebf8('0x46')]){_0x22ceac[_0xebf8('0x47')]=[{'all':!![]}];}_0x22ceac=_[_0xebf8('0x43')]({},_0x22ceac,_0x402d48['options']);return db['Dashboard'][_0xebf8('0x4c')](_0x22ceac)['then'](handleEntityNotFound(_0x24f3ba,null))['then'](function(_0x2f0100){if(_0x2f0100){var _0x382e02=_0x2f0100[_0xebf8('0x27')]({'plain':!![]});_0x382e02=qs['omit'](_0x382e02,['id',_0xebf8('0x56'),_0xebf8('0x57')]);_0x402d48[_0xebf8('0x4f')]=_['omit'](_0x402d48['body'],['id','createdAt',_0xebf8('0x57')]);return db[_0xebf8('0x30')][_0xebf8('0x4e')](_[_0xebf8('0x43')](_0x382e02,_0x402d48['body']),{'include':_0x402d48[_0xebf8('0x35')][_0xebf8('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x3cd483){var _0x43aa=_0x402d48['user'][_0xebf8('0x27')]({'plain':!![]});if(!_0x43aa)throw new Error(_0xebf8('0x51'));if(_0x43aa[_0xebf8('0x52')]==='user'){var _0x4b8d74=_0x3cd483['get']({'plain':!![]});var _0x42802f='CustomDashboards';return db[_0xebf8('0x53')][_0xebf8('0x4c')]({'where':{'name':_0x42802f,'userProfileId':_0x43aa[_0xebf8('0x58')]},'raw':!![]})[_0xebf8('0x25')](function(_0x1b754b){if(_0x1b754b&&_0x1b754b[_0xebf8('0x54')]===0x0){return db[_0xebf8('0x29')][_0xebf8('0x4e')]({'name':_0x4b8d74[_0xebf8('0x2c')],'resourceId':_0x4b8d74['id'],'type':_0x1b754b[_0xebf8('0x2c')],'sectionId':_0x1b754b['id']},{})['then'](function(){return _0x3cd483;});}else{return _0x3cd483;}})[_0xebf8('0x4d')](function(_0x6f7a19){logger[_0xebf8('0x2a')](_0xebf8('0x55'),_0x6f7a19);throw _0x6f7a19;});}return _0x3cd483;});}})[_0xebf8('0x25')](respondWithResult(_0x24f3ba,0xc9))[_0xebf8('0x4d')](handleError(_0x24f3ba,null));};exports[_0xebf8('0x24')]=function(_0x1516ce,_0x37c628){if(_0x1516ce['body']['id']){delete _0x1516ce['body']['id'];}return db[_0xebf8('0x30')][_0xebf8('0x4c')]({'where':{'id':_0x1516ce[_0xebf8('0x4a')]['id']}})[_0xebf8('0x25')](handleEntityNotFound(_0x37c628,null))[_0xebf8('0x25')](saveUpdates(_0x1516ce['body'],null))[_0xebf8('0x25')](respondWithResult(_0x37c628,null))[_0xebf8('0x4d')](handleError(_0x37c628,null));};exports[_0xebf8('0x26')]=function(_0xe020b9,_0x5eadbf){return db[_0xebf8('0x30')][_0xebf8('0x4c')]({'where':{'id':_0xe020b9['params']['id']}})[_0xebf8('0x25')](handleEntityNotFound(_0x5eadbf,null))[_0xebf8('0x25')](removeEntity(_0x5eadbf,null))[_0xebf8('0x4d')](handleError(_0x5eadbf,null));};function widgetAttributes(_0x3ae588){try{switch(_0x3ae588[_0xebf8('0x33')]){case _0xebf8('0x59'):return[{'name':_0xebf8('0x5a'),'value':_0x3ae588[_0xebf8('0x5a')]||(_0x3ae588['attrs']&&_0x3ae588[_0xebf8('0x5b')][0x0]?_0x3ae588['attrs'][0x0][_0xebf8('0x5c')]:undefined)||_0xebf8('0x5d')}];case _0xebf8('0x5e'):return[{'name':_0xebf8('0x5f'),'value':_0x3ae588[_0xebf8('0x5f')]||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588[_0xebf8('0x5b')][0x0]?_0x3ae588['attrs'][0x0]['value']:undefined)||''}];case _0xebf8('0x60'):return[{'name':_0xebf8('0x61'),'value':_0x3ae588[_0xebf8('0x61')]||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588[_0xebf8('0x5b')][0x0]?_0x3ae588[_0xebf8('0x5b')][0x0][_0xebf8('0x5c')]:undefined)||_0xebf8('0x62')},{'name':_0xebf8('0x63'),'value':_0x3ae588[_0xebf8('0x63')]||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588[_0xebf8('0x5b')][0x1]?_0x3ae588[_0xebf8('0x5b')][0x1][_0xebf8('0x5c')]:undefined)||'0.00'},{'name':_0xebf8('0x64'),'value':_0x3ae588['attrFontSize']||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588[_0xebf8('0x5b')][0x2]?_0x3ae588['attrs'][0x2][_0xebf8('0x5c')]:undefined)||0xc}];case _0xebf8('0x65'):return[{'name':_0xebf8('0x66'),'value':_0x3ae588[_0xebf8('0x66')]||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588[_0xebf8('0x5b')][0x0]?_0x3ae588['attrs'][0x0][_0xebf8('0x5c')]:undefined)||_0xebf8('0x67')},{'name':_0xebf8('0x68'),'value':_0x3ae588[_0xebf8('0x68')]||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588['attrs'][0x1]?_0x3ae588[_0xebf8('0x5b')][0x1][_0xebf8('0x5c')]:undefined)||[]},{'name':_0xebf8('0x64'),'value':_0x3ae588[_0xebf8('0x64')]||(_0x3ae588['attrs']&&_0x3ae588[_0xebf8('0x5b')][0x2]?_0x3ae588[_0xebf8('0x5b')][0x2][_0xebf8('0x5c')]:undefined)||0x14}];case _0xebf8('0x69'):case'pie-chart':return[{'name':_0xebf8('0x6a'),'value':_0x3ae588[_0xebf8('0x6a')]||(_0x3ae588['attrs']&&_0x3ae588[_0xebf8('0x5b')][0x0]?_0x3ae588[_0xebf8('0x5b')][0x0][_0xebf8('0x5c')]:undefined)||_0xebf8('0x67')},{'name':_0xebf8('0x6b'),'value':_0x3ae588[_0xebf8('0x6b')]||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588['attrs'][0x1]?_0x3ae588[_0xebf8('0x5b')][0x1][_0xebf8('0x5c')]:undefined)||null},{'name':_0xebf8('0x6c'),'value':_0x3ae588[_0xebf8('0x6c')]||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588[_0xebf8('0x5b')][0x2]?_0x3ae588[_0xebf8('0x5b')][0x2]['value']:undefined)||null},{'name':_0xebf8('0x68'),'value':_0x3ae588[_0xebf8('0x68')]||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588['attrs'][0x3]?_0x3ae588[_0xebf8('0x5b')][0x3][_0xebf8('0x5c')]:undefined)||[]}];case _0xebf8('0x6d'):return[{'name':_0xebf8('0x6e'),'type':_0x3ae588[_0xebf8('0x6f')]||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588['attrs'][0x0]?_0x3ae588[_0xebf8('0x5b')][0x0][_0xebf8('0x33')]:undefined)||null,'value':_0x3ae588['attrReport']||(_0x3ae588[_0xebf8('0x5b')]&&_0x3ae588[_0xebf8('0x5b')][0x0]?_0x3ae588[_0xebf8('0x5b')][0x0]['value']:undefined)||null},{'name':_0xebf8('0x70'),'value':_0x3ae588[_0xebf8('0x70')]||(_0x3ae588['attrs']&&_0x3ae588[_0xebf8('0x5b')][0x1]?_0x3ae588[_0xebf8('0x5b')][0x1][_0xebf8('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x42be0d){logger[_0xebf8('0x2a')](_0xebf8('0x71'),JSON['stringify'](_0x42be0d));return[];}}exports[_0xebf8('0x72')]=function(_0x21ff6b,_0x47981d,_0x4d9774){if(_0x21ff6b[_0xebf8('0x4f')]['id']){delete _0x21ff6b[_0xebf8('0x4f')]['id'];}return db[_0xebf8('0x30')]['find']({'where':{'id':_0x21ff6b[_0xebf8('0x4a')]['id']}})[_0xebf8('0x25')](handleEntityNotFound(_0x47981d,null))['then'](function(_0x4420b9){if(_0x4420b9){_0x21ff6b['body'][_0xebf8('0x73')]=_0x4420b9['id'];_0x21ff6b[_0xebf8('0x4f')]['attrs']=widgetAttributes(_0x21ff6b[_0xebf8('0x4f')]);return db[_0xebf8('0x74')][_0xebf8('0x4e')](_0x21ff6b[_0xebf8('0x4f')]);}})[_0xebf8('0x25')](respondWithResult(_0x47981d,null))[_0xebf8('0x4d')](handleError(_0x47981d,null));};exports[_0xebf8('0x75')]=function(_0x82611,_0x3b8f44,_0x36c68b){var _0x50574e={};var _0x544726={};var _0x35c746;var _0x35482f;return db[_0xebf8('0x30')]['findOne']({'where':{'id':_0x82611['params']['id']}})[_0xebf8('0x25')](handleEntityNotFound(_0x3b8f44,null))[_0xebf8('0x25')](function(_0x2c69c0){if(_0x2c69c0){_0x35c746=_0x2c69c0;_0x544726['model']=_[_0xebf8('0x36')](db[_0xebf8('0x74')][_0xebf8('0x31')]);_0x544726[_0xebf8('0x35')]=_[_0xebf8('0x36')](_0x82611[_0xebf8('0x35')]);_0x544726[_0xebf8('0x37')]=_[_0xebf8('0x3a')](_0x544726[_0xebf8('0x38')],_0x544726[_0xebf8('0x35')]);_0x50574e[_0xebf8('0x39')]=_[_0xebf8('0x3a')](_0x544726[_0xebf8('0x38')],qs[_0xebf8('0x3b')](_0x82611[_0xebf8('0x35')]['fields']));_0x50574e[_0xebf8('0x39')]=_0x50574e[_0xebf8('0x39')][_0xebf8('0x4b')]?_0x50574e[_0xebf8('0x39')]:_0x544726[_0xebf8('0x38')];_0x50574e[_0xebf8('0x3e')]=qs[_0xebf8('0x3f')](_0x82611[_0xebf8('0x35')][_0xebf8('0x3f')]);_0x50574e[_0xebf8('0x40')]=qs['filters'](_[_0xebf8('0x41')](_0x82611[_0xebf8('0x35')],_0x544726['filters']));if(_0x82611[_0xebf8('0x35')][_0xebf8('0x42')]){_0x50574e[_0xebf8('0x40')]=_['merge'](_0x50574e[_0xebf8('0x40')],{'$or':_[_0xebf8('0x2f')](_0x50574e[_0xebf8('0x39')],function(_0x53f673){var _0x4acafb={};_0x4acafb[_0x53f673]={'$like':'%'+_0x82611[_0xebf8('0x35')][_0xebf8('0x42')]+'%'};return _0x4acafb;})});}_0x50574e=_['merge']({},_0x50574e,_0x82611['options']);return _0x35c746[_0xebf8('0x75')](_0x50574e);}})['then'](function(_0xe91655){if(_0xe91655){_0x35482f=_0xe91655[_0xebf8('0x4b')];if(!_0x82611[_0xebf8('0x35')][_0xebf8('0x76')]('nolimit')){_0x50574e[_0xebf8('0x3d')]=qs[_0xebf8('0x3d')](_0x82611[_0xebf8('0x35')][_0xebf8('0x3d')]);_0x50574e['offset']=qs['offset'](_0x82611[_0xebf8('0x35')][_0xebf8('0x21')]);}return _0x35c746[_0xebf8('0x75')](_0x50574e);}})[_0xebf8('0x25')](function(_0x27ae5a){if(_0x27ae5a){return _0x27ae5a?{'count':_0x35482f,'rows':_0x27ae5a}:null;}})[_0xebf8('0x25')](respondWithResult(_0x3b8f44,null))[_0xebf8('0x4d')](handleError(_0x3b8f44,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 87bec48..e524763 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 _0xff1f=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x329fe4,_0x1bfdc9){var _0x38e939=function(_0x40f24b){while(--_0x40f24b){_0x329fe4['push'](_0x329fe4['shift']());}};_0x38e939(++_0x1bfdc9);}(_0xff1f,0x13e));var _0xfff1=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0xff1f[_0x4db46b];return _0x565be8;};'use strict';var EventEmitter=require(_0xfff1('0x0'));var Dashboard=require(_0xfff1('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfff1('0x2'),'afterUpdate':_0xfff1('0x3'),'afterDestroy':_0xfff1('0x4')};function emitEvent(_0x425c77){return function(_0x20929d,_0x96c6ef,_0x28ff74){DashboardEvents[_0xfff1('0x5')](_0x425c77+':'+_0x20929d['id'],_0x20929d);DashboardEvents[_0xfff1('0x5')](_0x425c77,_0x20929d);_0x28ff74(null);};}for(var e in events){if(events[_0xfff1('0x6')](e)){var event=events[e];Dashboard[_0xfff1('0x7')](e,emitEvent(event));}}module[_0xfff1('0x8')]=DashboardEvents; \ No newline at end of file +var _0xb3d7=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb3d7,0xc0));var _0x7b3d=function(_0x3f4570,_0x13046c){_0x3f4570=_0x3f4570-0x0;var _0x4d4f01=_0xb3d7[_0x3f4570];return _0x4d4f01;};'use strict';var EventEmitter=require(_0x7b3d('0x0'));var Dashboard=require(_0x7b3d('0x1'))['db'][_0x7b3d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x7b3d('0x3')](0x0);var events={'afterCreate':_0x7b3d('0x4'),'afterUpdate':_0x7b3d('0x5'),'afterDestroy':_0x7b3d('0x6')};function emitEvent(_0x3a6d80){return function(_0x5ac16d,_0xff0b31,_0x286acf){DashboardEvents[_0x7b3d('0x7')](_0x3a6d80+':'+_0x5ac16d['id'],_0x5ac16d);DashboardEvents['emit'](_0x3a6d80,_0x5ac16d);_0x286acf(null);};}for(var e in events){if(events[_0x7b3d('0x8')](e)){var event=events[e];Dashboard[_0x7b3d('0x9')](e,emitEvent(event));}}module[_0x7b3d('0xa')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 3610862..03f1748 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 _0x5156=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Dashboard'];(function(_0x4d79a4,_0x31ad70){var _0x562c00=function(_0xf8ac77){while(--_0xf8ac77){_0x4d79a4['push'](_0x4d79a4['shift']());}};_0x562c00(++_0x31ad70);}(_0x5156,0x16b));var _0x6515=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x5156[_0x207811];return _0x170d56;};'use strict';var _=require(_0x6515('0x0'));var util=require(_0x6515('0x1'));var logger=require(_0x6515('0x2'))('api');var moment=require(_0x6515('0x3'));var BPromise=require(_0x6515('0x4'));var rp=require(_0x6515('0x5'));var fs=require('fs');var path=require(_0x6515('0x6'));var rimraf=require(_0x6515('0x7'));var config=require(_0x6515('0x8'));var attributes=require('./dashboard.attributes');module[_0x6515('0x9')]=function(_0x29e3d2,_0xca98a9){return _0x29e3d2['define'](_0x6515('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b44=['bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x33469a,_0x232212){var _0x1083ff=function(_0x525597){while(--_0x525597){_0x33469a['push'](_0x33469a['shift']());}};_0x1083ff(++_0x232212);}(_0x2b44,0x1c9));var _0x42b4=function(_0x4bed11,_0x29168b){_0x4bed11=_0x4bed11-0x0;var _0x2fb0e2=_0x2b44[_0x4bed11];return _0x2fb0e2;};'use strict';var _=require(_0x42b4('0x0'));var util=require(_0x42b4('0x1'));var logger=require(_0x42b4('0x2'))(_0x42b4('0x3'));var moment=require(_0x42b4('0x4'));var BPromise=require(_0x42b4('0x5'));var rp=require(_0x42b4('0x6'));var fs=require('fs');var path=require(_0x42b4('0x7'));var rimraf=require('rimraf');var config=require(_0x42b4('0x8'));var attributes=require(_0x42b4('0x9'));module[_0x42b4('0xa')]=function(_0x22ee36,_0x3eb562){return _0x22ee36[_0x42b4('0xb')](_0x42b4('0xc'),attributes,{'tableName':_0x42b4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 768d010..05f933c 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 _0x5be5=['message','Dashboard,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','info','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x5be5,0x100));var _0x55be=function(_0x8f448c,_0x5587a4){_0x8f448c=_0x8f448c-0x0;var _0x24b4e3=_0x5be5[_0x8f448c];return _0x24b4e3;};'use strict';var _=require(_0x55be('0x0'));var util=require(_0x55be('0x1'));var moment=require(_0x55be('0x2'));var BPromise=require(_0x55be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55be('0x4'));var db=require(_0x55be('0x5'))['db'];var utils=require(_0x55be('0x6'));var logger=require(_0x55be('0x7'))(_0x55be('0x8'));var config=require(_0x55be('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x55be('0xa')][_0x55be('0xb')]({'port':0x232a});config[_0x55be('0xc')]=_[_0x55be('0xd')](config[_0x55be('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x55be('0xe'))(new Redis(config[_0x55be('0xc')]));require(_0x55be('0xf'))[_0x55be('0x10')](socket);function respondWithRpcPromise(_0x460777,_0x1b33f2,_0x45bff5){return new BPromise(function(_0x8d9970,_0x55ce76){return client[_0x55be('0x11')](_0x460777,_0x45bff5)['then'](function(_0x139125){logger[_0x55be('0x12')]('Dashboard,\x20%s,\x20%s',_0x1b33f2,_0x55be('0x13'));logger['debug'](_0x55be('0x14'),_0x1b33f2,_0x55be('0x13'),JSON[_0x55be('0x15')](_0x139125));if(_0x139125[_0x55be('0x16')]){if(_0x139125['error'][_0x55be('0x17')]===0x1f4){logger[_0x55be('0x16')]('Dashboard,\x20%s,\x20%s',_0x1b33f2,_0x139125[_0x55be('0x16')][_0x55be('0x18')]);return _0x55ce76(_0x139125[_0x55be('0x16')]['message']);}logger[_0x55be('0x16')](_0x55be('0x19'),_0x1b33f2,_0x139125[_0x55be('0x16')]['message']);return _0x8d9970(_0x139125['error']['message']);}else{logger[_0x55be('0x12')](_0x55be('0x19'),_0x1b33f2,_0x55be('0x13'));_0x8d9970(_0x139125[_0x55be('0x1a')]['message']);}})[_0x55be('0x1b')](function(_0x12ccc6){logger['error'](_0x55be('0x19'),_0x1b33f2,_0x12ccc6);_0x55ce76(_0x12ccc6);});});} \ No newline at end of file +var _0x0238=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','Dashboard,\x20%s,\x20%s'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0x0238,0x1cf));var _0x8023=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x0238[_0x4fe19c];return _0x952ac7;};'use strict';var _=require(_0x8023('0x0'));var util=require(_0x8023('0x1'));var moment=require(_0x8023('0x2'));var BPromise=require(_0x8023('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8023('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8023('0x5'));var config=require(_0x8023('0x6'));var jayson=require(_0x8023('0x7'));var client=jayson['client'][_0x8023('0x8')]({'port':0x232a});config[_0x8023('0x9')]=_[_0x8023('0xa')](config['redis'],{'host':_0x8023('0xb'),'port':0x18eb});var socket=require(_0x8023('0xc'))(new Redis(config[_0x8023('0x9')]));require('./dashboard.socket')[_0x8023('0xd')](socket);function respondWithRpcPromise(_0x56fc61,_0x1d3a57,_0x5c194f){return new BPromise(function(_0x5f36b9,_0x1bac35){return client['request'](_0x56fc61,_0x5c194f)[_0x8023('0xe')](function(_0x37e064){logger[_0x8023('0xf')](_0x8023('0x10'),_0x1d3a57,'request\x20sent');logger[_0x8023('0x11')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x1d3a57,'request\x20sent',JSON[_0x8023('0x12')](_0x37e064));if(_0x37e064[_0x8023('0x13')]){if(_0x37e064['error'][_0x8023('0x14')]===0x1f4){logger[_0x8023('0x13')](_0x8023('0x10'),_0x1d3a57,_0x37e064[_0x8023('0x13')][_0x8023('0x15')]);return _0x1bac35(_0x37e064[_0x8023('0x13')][_0x8023('0x15')]);}logger[_0x8023('0x13')]('Dashboard,\x20%s,\x20%s',_0x1d3a57,_0x37e064[_0x8023('0x13')][_0x8023('0x15')]);return _0x5f36b9(_0x37e064[_0x8023('0x13')][_0x8023('0x15')]);}else{logger[_0x8023('0xf')]('Dashboard,\x20%s,\x20%s',_0x1d3a57,'request\x20sent');_0x5f36b9(_0x37e064[_0x8023('0x16')][_0x8023('0x15')]);}})[_0x8023('0x17')](function(_0x1f2001){logger['error']('Dashboard,\x20%s,\x20%s',_0x1d3a57,_0x1f2001);_0x1bac35(_0x1f2001);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 46045da..91a123d 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 _0x6ca1=['dashboard:','./dashboard.events','remove','update','removeListener','register'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x6ca1,0xfd));var _0x16ca=function(_0x32a9f3,_0x138f1e){_0x32a9f3=_0x32a9f3-0x0;var _0x2355eb=_0x6ca1[_0x32a9f3];return _0x2355eb;};'use strict';var DashboardEvents=require(_0x16ca('0x0'));var events=['save',_0x16ca('0x1'),_0x16ca('0x2')];function createListener(_0x3d70e1,_0x5c4031){return function(_0x39dd04){_0x5c4031['emit'](_0x3d70e1,_0x39dd04);};}function removeListener(_0x4038bb,_0x1eeb68){return function(){DashboardEvents[_0x16ca('0x3')](_0x4038bb,_0x1eeb68);};}exports[_0x16ca('0x4')]=function(_0x181e79){for(var _0x31d2e7=0x0,_0x1722c3=events['length'];_0x31d2e7<_0x1722c3;_0x31d2e7++){var _0x4e2d23=events[_0x31d2e7];var _0x5291a1=createListener(_0x16ca('0x5')+_0x4e2d23,_0x181e79);DashboardEvents['on'](_0x4e2d23,_0x5291a1);}}; \ No newline at end of file +var _0x1381=['length','dashboard:','./dashboard.events','remove','update','emit','removeListener','register'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x1381,0x102));var _0x1138=function(_0x271515,_0x32787e){_0x271515=_0x271515-0x0;var _0x2d933f=_0x1381[_0x271515];return _0x2d933f;};'use strict';var DashboardEvents=require(_0x1138('0x0'));var events=['save',_0x1138('0x1'),_0x1138('0x2')];function createListener(_0x2f4aa9,_0x195c23){return function(_0x242221){_0x195c23[_0x1138('0x3')](_0x2f4aa9,_0x242221);};}function removeListener(_0x4a4d2e,_0x5cc181){return function(){DashboardEvents[_0x1138('0x4')](_0x4a4d2e,_0x5cc181);};}exports[_0x1138('0x5')]=function(_0x2d978){for(var _0x4bccb5=0x0,_0x164f46=events[_0x1138('0x6')];_0x4bccb5<_0x164f46;_0x4bccb5++){var _0x2946ca=events[_0x4bccb5];var _0x133465=createListener(_0x1138('0x7')+_0x2946ca,_0x2d978);DashboardEvents['on'](_0x2946ca,_0x133465);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index a1db7b1..b1be00f 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 _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','destroy','exports','path','connect-timeout'];(function(_0x5655bc,_0x30c8fa){var _0x3a4f13=function(_0xa1482f){while(--_0xa1482f){_0x5655bc['push'](_0x5655bc['shift']());}};_0x3a4f13(++_0x30c8fa);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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 auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xe'),auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0xd')]('/:id/items',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','show','/:id/items','isAuthenticated','getItems','post','/:id/clone','clone','addItem','put','/:id','update','multer'];(function(_0x1d1f61,_0x484f1e){var _0x273f9d=function(_0x259059){while(--_0x259059){_0x1d1f61['push'](_0x1d1f61['shift']());}};_0x273f9d(++_0x484f1e);}(_0x70e0,0x17b));var _0x070e=function(_0x1baffe,_0x412a15){_0x1baffe=_0x1baffe-0x0;var _0xedcbbe=_0x70e0[_0x1baffe];return _0xedcbbe;};'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 auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./dashboard.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth[_0x070e('0xb')](),controller['create']);router['post'](_0x070e('0xe'),auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0xd')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0x12'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);router['delete']('/:id',auth[_0x070e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 115add5..af3e278 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 _0x2848=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','INTEGER','#2196f3','sequelize'];(function(_0x218c8f,_0x5e68dd){var _0x13a7d7=function(_0x36a74f){while(--_0x36a74f){_0x218c8f['push'](_0x218c8f['shift']());}};_0x13a7d7(++_0x5e68dd);}(_0x2848,0x144));var _0x8284=function(_0x39e8dd,_0x64e961){_0x39e8dd=_0x39e8dd-0x0;var _0x883eb0=_0x2848[_0x39e8dd];return _0x883eb0;};'use strict';var Sequelize=require(_0x8284('0x0'));var squel=require(_0x8284('0x1'));var _=require(_0x8284('0x2'));module[_0x8284('0x3')]={'title':{'type':Sequelize[_0x8284('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x8284('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8284('0x5')](_0x8284('0x6')),'get':function(){try{return JSON[_0x8284('0x7')](this[_0x8284('0x8')](_0x8284('0x9')));}catch(_0x5768a8){return[];}},'set':function(_0x5ed7d4){try{this['setDataValue'](_0x8284('0x9'),JSON['stringify'](_0x5ed7d4));}catch(_0x824ab2){this['setDataValue'](_0x8284('0x9'),JSON[_0x8284('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x8284('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x8284('0xb')]},'col':{'type':Sequelize[_0x8284('0xb')]},'background':{'type':Sequelize[_0x8284('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8284('0x4')],'allowNull':![],'defaultValue':_0x8284('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8284('0x4')]}}; \ No newline at end of file +var _0x77c9=['exports','STRING','TEXT','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0x77c9,0x12b));var _0x977c=function(_0x2022bd,_0x244d49){_0x2022bd=_0x2022bd-0x0;var _0x16520a=_0x77c9[_0x2022bd];return _0x16520a;};'use strict';var Sequelize=require(_0x977c('0x0'));var squel=require('squel');var _=require('lodash');module[_0x977c('0x1')]={'title':{'type':Sequelize[_0x977c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x977c('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x977c('0x3')](_0x977c('0x4')),'get':function(){try{return JSON[_0x977c('0x5')](this['getDataValue'](_0x977c('0x6')));}catch(_0x60cdfa){return[];}},'set':function(_0x35ec91){try{this[_0x977c('0x7')](_0x977c('0x6'),JSON[_0x977c('0x8')](_0x35ec91));}catch(_0x1ed0d8){this['setDataValue'](_0x977c('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x977c('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x977c('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x977c('0x2')],'allowNull':![],'defaultValue':_0x977c('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x977c('0x2')],'allowNull':![],'defaultValue':_0x977c('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x977c('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index cd5d4fe..66e4962 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 _0x2972=['custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','type','attrRefresh','widgetAttributes:\x20%s','create','body','html-pdf','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register','sendStatus','end','status','count','offset','limit','set','json','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','iframe','attrUrl','attrs','value','https://'];(function(_0x4070ca,_0x33f3a1){var _0x3f6bc3=function(_0x51cbe1){while(--_0x51cbe1){_0x4070ca['push'](_0x4070ca['shift']());}};_0x3f6bc3(++_0x33f3a1);}(_0x2972,0xcd));var _0x2297=function(_0x57e479,_0x3d009c){_0x57e479=_0x57e479-0x0;var _0x5751b1=_0x2972[_0x57e479];return _0x5751b1;};'use strict';var pdf=require(_0x2297('0x0'));var emlformat=require(_0x2297('0x1'));var rimraf=require(_0x2297('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2297('0x3'));var Mustache=require(_0x2297('0x4'));var util=require(_0x2297('0x5'));var path=require(_0x2297('0x6'));var sox=require(_0x2297('0x7'));var csv=require(_0x2297('0x8'));var ejs=require(_0x2297('0x9'));var fs=require('fs');var _=require(_0x2297('0xa'));var squel=require(_0x2297('0xb'));var crypto=require(_0x2297('0xc'));var jsforce=require(_0x2297('0xd'));var deskjs=require(_0x2297('0xe'));var toCsv=require(_0x2297('0x8'));var querystring=require(_0x2297('0xf'));var Papa=require(_0x2297('0x10'));var Redis=require(_0x2297('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2297('0x12'));var as=require(_0x2297('0x13'));var hardwareService=require(_0x2297('0x14'));var logger=require(_0x2297('0x15'))(_0x2297('0x16'));var utils=require(_0x2297('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2297('0x18'))['db'];config[_0x2297('0x19')]=_['defaults'](config[_0x2297('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2297('0x1a'))(new Redis(config['redis']));require(_0x2297('0x1b'))[_0x2297('0x1c')](socket);function respondWithStatusCode(_0x4a3439,_0x4b777e){_0x4b777e=_0x4b777e||0xcc;return function(_0x4cb718){if(_0x4cb718){return _0x4a3439[_0x2297('0x1d')](_0x4b777e);}return _0x4a3439['status'](_0x4b777e)[_0x2297('0x1e')]();};}function respondWithResult(_0x147618,_0x6f2044){_0x6f2044=_0x6f2044||0xc8;return function(_0x5a53b8){if(_0x5a53b8){return _0x147618[_0x2297('0x1f')](_0x6f2044)['json'](_0x5a53b8);}};}function respondWithFilteredResult(_0xaf6607,_0x33a623){return function(_0x1378a0){if(_0x1378a0){var _0x187dc2=_0x1378a0[_0x2297('0x20')],_0x121a68=_0x33a623[_0x2297('0x21')],_0x4a0fb1=_0x33a623['offset']+_0x33a623[_0x2297('0x22')],_0x10e7af;if(_0x4a0fb1>=_0x187dc2){_0x4a0fb1=_0x187dc2;_0x10e7af=0xc8;}else{_0x10e7af=0xce;}_0xaf6607[_0x2297('0x1f')](_0x10e7af);return _0xaf6607[_0x2297('0x23')]('Content-Range',_0x121a68+'-'+_0x4a0fb1+'/'+_0x187dc2)[_0x2297('0x24')](_0x1378a0);}return null;};}function patchUpdates(_0x3a2415){return function(_0x605b8e){try{jsonpatch['apply'](_0x605b8e,_0x3a2415,!![]);}catch(_0xbef1b3){return BPromise[_0x2297('0x25')](_0xbef1b3);}return _0x605b8e['save']();};}function saveUpdates(_0x2b7a18,_0x1045c7){return function(_0x2e8c5c){if(_0x2e8c5c){return _0x2e8c5c[_0x2297('0x26')](_0x2b7a18)[_0x2297('0x27')](function(_0x5c611e){return _0x5c611e;});}return null;};}function removeEntity(_0x411520,_0x3495cb){return function(_0xf0c7a2){if(_0xf0c7a2){return _0xf0c7a2[_0x2297('0x28')]()[_0x2297('0x27')](function(){_0x411520['status'](0xcc)[_0x2297('0x1e')]();});}};}function handleEntityNotFound(_0x4738bb,_0x369e70){return function(_0x184705){if(!_0x184705){_0x4738bb[_0x2297('0x1d')](0x194);}return _0x184705;};}function handleError(_0x45890a,_0x15d308){_0x15d308=_0x15d308||0x1f4;return function(_0x41267e){logger[_0x2297('0x29')](_0x41267e[_0x2297('0x2a')]);if(_0x41267e[_0x2297('0x2b')]){delete _0x41267e['name'];}_0x45890a[_0x2297('0x1f')](_0x15d308)[_0x2297('0x2c')](_0x41267e);};}exports[_0x2297('0x2d')]=function(_0x3bfa15,_0x2c772b){var _0x468def={'raw':![],'where':{'id':_0x3bfa15[_0x2297('0x2e')]['id']}},_0x2ec492={};_0x2ec492[_0x2297('0x2f')]=_[_0x2297('0x30')](db[_0x2297('0x31')][_0x2297('0x32')]);_0x2ec492[_0x2297('0x33')]=_[_0x2297('0x30')](_0x3bfa15[_0x2297('0x33')]);_0x2ec492[_0x2297('0x34')]=_[_0x2297('0x35')](_0x2ec492['model'],_0x2ec492[_0x2297('0x33')]);_0x468def[_0x2297('0x36')]=_[_0x2297('0x35')](_0x2ec492[_0x2297('0x2f')],qs[_0x2297('0x37')](_0x3bfa15[_0x2297('0x33')][_0x2297('0x37')]));_0x468def['attributes']=_0x468def['attributes'][_0x2297('0x38')]?_0x468def[_0x2297('0x36')]:_0x2ec492[_0x2297('0x2f')];if(_0x3bfa15['query'][_0x2297('0x39')]){_0x468def[_0x2297('0x3a')]=[{'all':!![]}];}_0x468def=_[_0x2297('0x3b')]({},_0x468def,_0x3bfa15[_0x2297('0x3c')]);return db[_0x2297('0x31')][_0x2297('0x3d')](_0x468def)[_0x2297('0x27')](handleEntityNotFound(_0x2c772b,null))[_0x2297('0x27')](respondWithResult(_0x2c772b,null))[_0x2297('0x3e')](handleError(_0x2c772b,null));};exports[_0x2297('0x28')]=function(_0x4dc470,_0x256862){return db['DashboardItem'][_0x2297('0x3d')]({'where':{'id':_0x4dc470[_0x2297('0x2e')]['id']}})[_0x2297('0x27')](handleEntityNotFound(_0x256862,null))[_0x2297('0x27')](removeEntity(_0x256862,null))['catch'](handleError(_0x256862,null));};function widgetAttributes(_0x58a7f7){try{switch(_0x58a7f7['type']){case _0x2297('0x3f'):return[{'name':_0x2297('0x40'),'value':_0x58a7f7[_0x2297('0x40')]||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7['attrs'][0x0]?_0x58a7f7[_0x2297('0x41')][0x0][_0x2297('0x42')]:undefined)||_0x2297('0x43')}];case _0x2297('0x44'):return[{'name':_0x2297('0x45'),'value':_0x58a7f7[_0x2297('0x45')]||(_0x58a7f7['attrs']&&_0x58a7f7['attrs'][0x0]?_0x58a7f7['attrs'][0x0][_0x2297('0x42')]:undefined)||''}];case _0x2297('0x46'):return[{'name':_0x2297('0x47'),'value':_0x58a7f7[_0x2297('0x47')]||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7['attrs'][0x0]?_0x58a7f7[_0x2297('0x41')][0x0]['value']:undefined)||_0x2297('0x48')},{'name':'attrTimezone','value':_0x58a7f7[_0x2297('0x49')]||(_0x58a7f7['attrs']&&_0x58a7f7[_0x2297('0x41')][0x1]?_0x58a7f7['attrs'][0x1]['value']:undefined)||_0x2297('0x4a')},{'name':_0x2297('0x4b'),'value':_0x58a7f7['attrFontSize']||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7[_0x2297('0x41')][0x2]?_0x58a7f7[_0x2297('0x41')][0x2][_0x2297('0x42')]:undefined)||0xc}];case _0x2297('0x4c'):return[{'name':_0x2297('0x4d'),'value':_0x58a7f7[_0x2297('0x4d')]||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7[_0x2297('0x41')][0x0]?_0x58a7f7[_0x2297('0x41')][0x0]['value']:undefined)||_0x2297('0x4e')},{'name':_0x2297('0x4f'),'value':_0x58a7f7['attrVoiceQueues']||(_0x58a7f7['attrs']&&_0x58a7f7[_0x2297('0x41')][0x1]?_0x58a7f7[_0x2297('0x41')][0x1][_0x2297('0x42')]:undefined)||[]},{'name':_0x2297('0x4b'),'value':_0x58a7f7['attrFontSize']||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7['attrs'][0x2]?_0x58a7f7[_0x2297('0x41')][0x2][_0x2297('0x42')]:undefined)||0x14}];case'multibar-chart':case _0x2297('0x50'):return[{'name':_0x2297('0x51'),'value':_0x58a7f7[_0x2297('0x51')]||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7[_0x2297('0x41')][0x0]?_0x58a7f7[_0x2297('0x41')][0x0]['value']:undefined)||_0x2297('0x4e')},{'name':_0x2297('0x52'),'value':_0x58a7f7[_0x2297('0x52')]||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7[_0x2297('0x41')][0x1]?_0x58a7f7[_0x2297('0x41')][0x1][_0x2297('0x42')]:undefined)||null},{'name':_0x2297('0x53'),'value':_0x58a7f7[_0x2297('0x53')]||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7[_0x2297('0x41')][0x2]?_0x58a7f7[_0x2297('0x41')][0x2][_0x2297('0x42')]:undefined)||null},{'name':_0x2297('0x4f'),'value':_0x58a7f7[_0x2297('0x4f')]||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7[_0x2297('0x41')][0x3]?_0x58a7f7[_0x2297('0x41')][0x3]['value']:undefined)||[]}];case _0x2297('0x54'):return[{'name':_0x2297('0x55'),'type':_0x58a7f7['reportType']||(_0x58a7f7['attrs']&&_0x58a7f7[_0x2297('0x41')][0x0]?_0x58a7f7[_0x2297('0x41')][0x0][_0x2297('0x56')]:undefined)||null,'value':_0x58a7f7[_0x2297('0x55')]||(_0x58a7f7[_0x2297('0x41')]&&_0x58a7f7['attrs'][0x0]?_0x58a7f7[_0x2297('0x41')][0x0][_0x2297('0x42')]:undefined)||null},{'name':_0x2297('0x57'),'value':_0x58a7f7['attrRefresh']||(_0x58a7f7['attrs']&&_0x58a7f7[_0x2297('0x41')][0x1]?_0x58a7f7['attrs'][0x1][_0x2297('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x593b7b){logger['error'](_0x2297('0x58'),JSON['stringify'](_0x593b7b));return[];}}exports[_0x2297('0x59')]=function(_0x2af965,_0x470464){if(_0x2af965[_0x2297('0x5a')]){_0x2af965[_0x2297('0x5a')][_0x2297('0x41')]=widgetAttributes(_0x2af965[_0x2297('0x5a')]);}return db[_0x2297('0x31')][_0x2297('0x59')](_0x2af965[_0x2297('0x5a')],{})['then'](respondWithResult(_0x470464,0xc9))[_0x2297('0x3e')](handleError(_0x470464,null));};exports[_0x2297('0x26')]=function(_0x560e1e,_0x551215){if(_0x560e1e[_0x2297('0x5a')]['id']){delete _0x560e1e[_0x2297('0x5a')]['id'];}_0x560e1e[_0x2297('0x5a')][_0x2297('0x41')]=widgetAttributes(_0x560e1e[_0x2297('0x5a')]);return db[_0x2297('0x31')][_0x2297('0x3d')]({'where':{'id':_0x560e1e[_0x2297('0x2e')]['id']}})[_0x2297('0x27')](handleEntityNotFound(_0x551215,null))[_0x2297('0x27')](saveUpdates(_0x560e1e[_0x2297('0x5a')],null))[_0x2297('0x27')](respondWithResult(_0x551215,null))[_0x2297('0x3e')](handleError(_0x551215,null));}; \ No newline at end of file +var _0x4017=['../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','error','stack','name','send','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','then','catch','destroy','find','params','type','iframe','attrUrl','attrs','value','attrPath','clock','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','body','create','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2501a4,_0x3b9f6b){var _0x222197=function(_0x20961d){while(--_0x20961d){_0x2501a4['push'](_0x2501a4['shift']());}};_0x222197(++_0x3b9f6b);}(_0x4017,0x1b5));var _0x7401=function(_0x397a44,_0x4145f6){_0x397a44=_0x397a44-0x0;var _0x333b00=_0x4017[_0x397a44];return _0x333b00;};'use strict';var pdf=require(_0x7401('0x0'));var emlformat=require(_0x7401('0x1'));var rimraf=require(_0x7401('0x2'));var zipdir=require(_0x7401('0x3'));var jsonpatch=require(_0x7401('0x4'));var rp=require(_0x7401('0x5'));var moment=require('moment');var BPromise=require(_0x7401('0x6'));var Mustache=require(_0x7401('0x7'));var util=require('util');var path=require(_0x7401('0x8'));var sox=require(_0x7401('0x9'));var csv=require(_0x7401('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7401('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7401('0xc'));var deskjs=require(_0x7401('0xd'));var toCsv=require(_0x7401('0xa'));var querystring=require(_0x7401('0xe'));var Papa=require('papaparse');var Redis=require(_0x7401('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7401('0x10'));var as=require(_0x7401('0x11'));var hardwareService=require(_0x7401('0x12'));var logger=require(_0x7401('0x13'))(_0x7401('0x14'));var utils=require(_0x7401('0x15'));var config=require(_0x7401('0x16'));var licenseUtil=require(_0x7401('0x17'));var db=require(_0x7401('0x18'))['db'];config[_0x7401('0x19')]=_['defaults'](config[_0x7401('0x19')],{'host':_0x7401('0x1a'),'port':0x18eb});var socket=require(_0x7401('0x1b'))(new Redis(config[_0x7401('0x19')]));require(_0x7401('0x1c'))[_0x7401('0x1d')](socket);function respondWithStatusCode(_0x21e4ce,_0x4db026){_0x4db026=_0x4db026||0xcc;return function(_0x19f099){if(_0x19f099){return _0x21e4ce[_0x7401('0x1e')](_0x4db026);}return _0x21e4ce[_0x7401('0x1f')](_0x4db026)[_0x7401('0x20')]();};}function respondWithResult(_0x5e9f09,_0x285b09){_0x285b09=_0x285b09||0xc8;return function(_0x49d73c){if(_0x49d73c){return _0x5e9f09[_0x7401('0x1f')](_0x285b09)[_0x7401('0x21')](_0x49d73c);}};}function respondWithFilteredResult(_0x38b61c,_0x4d0349){return function(_0x2f0198){if(_0x2f0198){var _0x5afc0a=_0x2f0198[_0x7401('0x22')],_0x33cd10=_0x4d0349['offset'],_0x31031c=_0x4d0349[_0x7401('0x23')]+_0x4d0349[_0x7401('0x24')],_0xc14be5;if(_0x31031c>=_0x5afc0a){_0x31031c=_0x5afc0a;_0xc14be5=0xc8;}else{_0xc14be5=0xce;}_0x38b61c[_0x7401('0x1f')](_0xc14be5);return _0x38b61c[_0x7401('0x25')](_0x7401('0x26'),_0x33cd10+'-'+_0x31031c+'/'+_0x5afc0a)[_0x7401('0x21')](_0x2f0198);}return null;};}function patchUpdates(_0x336be){return function(_0xce5ef2){try{jsonpatch[_0x7401('0x27')](_0xce5ef2,_0x336be,!![]);}catch(_0x237519){return BPromise[_0x7401('0x28')](_0x237519);}return _0xce5ef2['save']();};}function saveUpdates(_0x24f087,_0x2af26b){return function(_0x31ea60){if(_0x31ea60){return _0x31ea60[_0x7401('0x29')](_0x24f087)['then'](function(_0xafac19){return _0xafac19;});}return null;};}function removeEntity(_0x132cda,_0x2a8672){return function(_0x39a336){if(_0x39a336){return _0x39a336['destroy']()['then'](function(){_0x132cda[_0x7401('0x1f')](0xcc)[_0x7401('0x20')]();});}};}function handleEntityNotFound(_0xa3dc05,_0x1741ae){return function(_0x2b8d23){if(!_0x2b8d23){_0xa3dc05['sendStatus'](0x194);}return _0x2b8d23;};}function handleError(_0x26e7e9,_0x267be1){_0x267be1=_0x267be1||0x1f4;return function(_0x29bd95){logger[_0x7401('0x2a')](_0x29bd95[_0x7401('0x2b')]);if(_0x29bd95['name']){delete _0x29bd95[_0x7401('0x2c')];}_0x26e7e9[_0x7401('0x1f')](_0x267be1)[_0x7401('0x2d')](_0x29bd95);};}exports['show']=function(_0x3b9ed4,_0x313f0f){var _0xb4bcd8={'raw':![],'where':{'id':_0x3b9ed4['params']['id']}},_0x36d7bd={};_0x36d7bd[_0x7401('0x2e')]=_[_0x7401('0x2f')](db[_0x7401('0x30')][_0x7401('0x31')]);_0x36d7bd[_0x7401('0x32')]=_[_0x7401('0x2f')](_0x3b9ed4[_0x7401('0x32')]);_0x36d7bd[_0x7401('0x33')]=_[_0x7401('0x34')](_0x36d7bd['model'],_0x36d7bd[_0x7401('0x32')]);_0xb4bcd8[_0x7401('0x35')]=_[_0x7401('0x34')](_0x36d7bd[_0x7401('0x2e')],qs[_0x7401('0x36')](_0x3b9ed4[_0x7401('0x32')][_0x7401('0x36')]));_0xb4bcd8['attributes']=_0xb4bcd8[_0x7401('0x35')][_0x7401('0x37')]?_0xb4bcd8[_0x7401('0x35')]:_0x36d7bd[_0x7401('0x2e')];if(_0x3b9ed4[_0x7401('0x32')][_0x7401('0x38')]){_0xb4bcd8[_0x7401('0x39')]=[{'all':!![]}];}_0xb4bcd8=_[_0x7401('0x3a')]({},_0xb4bcd8,_0x3b9ed4['options']);return db[_0x7401('0x30')]['find'](_0xb4bcd8)[_0x7401('0x3b')](handleEntityNotFound(_0x313f0f,null))['then'](respondWithResult(_0x313f0f,null))[_0x7401('0x3c')](handleError(_0x313f0f,null));};exports[_0x7401('0x3d')]=function(_0x4a4a30,_0x321bf4){return db['DashboardItem'][_0x7401('0x3e')]({'where':{'id':_0x4a4a30[_0x7401('0x3f')]['id']}})[_0x7401('0x3b')](handleEntityNotFound(_0x321bf4,null))['then'](removeEntity(_0x321bf4,null))[_0x7401('0x3c')](handleError(_0x321bf4,null));};function widgetAttributes(_0x2edfab){try{switch(_0x2edfab[_0x7401('0x40')]){case _0x7401('0x41'):return[{'name':_0x7401('0x42'),'value':_0x2edfab[_0x7401('0x42')]||(_0x2edfab['attrs']&&_0x2edfab['attrs'][0x0]?_0x2edfab[_0x7401('0x43')][0x0][_0x7401('0x44')]:undefined)||'https://'}];case'custom':return[{'name':_0x7401('0x45'),'value':_0x2edfab[_0x7401('0x45')]||(_0x2edfab['attrs']&&_0x2edfab[_0x7401('0x43')][0x0]?_0x2edfab['attrs'][0x0][_0x7401('0x44')]:undefined)||''}];case _0x7401('0x46'):return[{'name':_0x7401('0x47'),'value':_0x2edfab['attrHourFormat']||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab['attrs'][0x0]?_0x2edfab[_0x7401('0x43')][0x0]['value']:undefined)||_0x7401('0x48')},{'name':_0x7401('0x49'),'value':_0x2edfab['attrTimezone']||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab[_0x7401('0x43')][0x1]?_0x2edfab[_0x7401('0x43')][0x1]['value']:undefined)||_0x7401('0x4a')},{'name':_0x7401('0x4b'),'value':_0x2edfab[_0x7401('0x4b')]||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab[_0x7401('0x43')][0x2]?_0x2edfab[_0x7401('0x43')][0x2][_0x7401('0x44')]:undefined)||0xc}];case _0x7401('0x4c'):return[{'name':'attrMetric','value':_0x2edfab['attrMetric']||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab[_0x7401('0x43')][0x0]?_0x2edfab[_0x7401('0x43')][0x0][_0x7401('0x44')]:undefined)||_0x7401('0x4d')},{'name':'attrVoiceQueues','value':_0x2edfab[_0x7401('0x4e')]||(_0x2edfab['attrs']&&_0x2edfab[_0x7401('0x43')][0x1]?_0x2edfab['attrs'][0x1][_0x7401('0x44')]:undefined)||[]},{'name':_0x7401('0x4b'),'value':_0x2edfab[_0x7401('0x4b')]||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab[_0x7401('0x43')][0x2]?_0x2edfab[_0x7401('0x43')][0x2]['value']:undefined)||0x14}];case _0x7401('0x4f'):case _0x7401('0x50'):return[{'name':_0x7401('0x51'),'value':_0x2edfab[_0x7401('0x51')]||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab[_0x7401('0x43')][0x0]?_0x2edfab['attrs'][0x0][_0x7401('0x44')]:undefined)||_0x7401('0x4d')},{'name':_0x7401('0x52'),'value':_0x2edfab[_0x7401('0x52')]||(_0x2edfab['attrs']&&_0x2edfab['attrs'][0x1]?_0x2edfab[_0x7401('0x43')][0x1][_0x7401('0x44')]:undefined)||null},{'name':_0x7401('0x53'),'value':_0x2edfab['attrSerie3']||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab['attrs'][0x2]?_0x2edfab['attrs'][0x2][_0x7401('0x44')]:undefined)||null},{'name':_0x7401('0x4e'),'value':_0x2edfab['attrVoiceQueues']||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab['attrs'][0x3]?_0x2edfab[_0x7401('0x43')][0x3][_0x7401('0x44')]:undefined)||[]}];case _0x7401('0x54'):return[{'name':_0x7401('0x55'),'type':_0x2edfab[_0x7401('0x56')]||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab[_0x7401('0x43')][0x0]?_0x2edfab[_0x7401('0x43')][0x0]['type']:undefined)||null,'value':_0x2edfab['attrReport']||(_0x2edfab[_0x7401('0x43')]&&_0x2edfab[_0x7401('0x43')][0x0]?_0x2edfab[_0x7401('0x43')][0x0][_0x7401('0x44')]:undefined)||null},{'name':_0x7401('0x57'),'value':_0x2edfab[_0x7401('0x57')]||(_0x2edfab['attrs']&&_0x2edfab['attrs'][0x1]?_0x2edfab[_0x7401('0x43')][0x1][_0x7401('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x26de99){logger[_0x7401('0x2a')](_0x7401('0x58'),JSON[_0x7401('0x59')](_0x26de99));return[];}}exports['create']=function(_0x4cd19d,_0x488380){if(_0x4cd19d[_0x7401('0x5a')]){_0x4cd19d[_0x7401('0x5a')]['attrs']=widgetAttributes(_0x4cd19d['body']);}return db[_0x7401('0x30')][_0x7401('0x5b')](_0x4cd19d['body'],{})[_0x7401('0x3b')](respondWithResult(_0x488380,0xc9))[_0x7401('0x3c')](handleError(_0x488380,null));};exports[_0x7401('0x29')]=function(_0x20e880,_0x5aefe1){if(_0x20e880['body']['id']){delete _0x20e880[_0x7401('0x5a')]['id'];}_0x20e880[_0x7401('0x5a')][_0x7401('0x43')]=widgetAttributes(_0x20e880[_0x7401('0x5a')]);return db[_0x7401('0x30')][_0x7401('0x3e')]({'where':{'id':_0x20e880[_0x7401('0x3f')]['id']}})[_0x7401('0x3b')](handleEntityNotFound(_0x5aefe1,null))[_0x7401('0x3b')](saveUpdates(_0x20e880[_0x7401('0x5a')],null))[_0x7401('0x3b')](respondWithResult(_0x5aefe1,null))[_0x7401('0x3c')](handleError(_0x5aefe1,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 0bca73a..04e1e4a 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 _0x5080=['remove','exports','../../mysqldb','setMaxListeners','update'];(function(_0x2469b5,_0xf1690){var _0x107a1e=function(_0xd8c0e6){while(--_0xd8c0e6){_0x2469b5['push'](_0x2469b5['shift']());}};_0x107a1e(++_0xf1690);}(_0x5080,0x66));var _0x0508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5080[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x0508('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0508('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0508('0x2'),'afterDestroy':_0x0508('0x3')};function emitEvent(_0x387152){return function(_0x58315b,_0x24c8c9,_0x59c321){DashboardItemEvents['emit'](_0x387152+':'+_0x58315b['id'],_0x58315b);DashboardItemEvents['emit'](_0x387152,_0x58315b);_0x59c321(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x0508('0x4')]=DashboardItemEvents; \ No newline at end of file +var _0xae61=['save','remove','emit','hasOwnProperty','hook','exports','events','DashboardItem'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xae61,0x86));var _0x1ae6=function(_0x39909a,_0x26b3b3){_0x39909a=_0x39909a-0x0;var _0x3af033=_0xae61[_0x39909a];return _0x3af033;};'use strict';var EventEmitter=require(_0x1ae6('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x1ae6('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ae6('0x2'),'afterUpdate':'update','afterDestroy':_0x1ae6('0x3')};function emitEvent(_0x4b6db8){return function(_0x1c2f44,_0x35de91,_0x3a3340){DashboardItemEvents[_0x1ae6('0x4')](_0x4b6db8+':'+_0x1c2f44['id'],_0x1c2f44);DashboardItemEvents[_0x1ae6('0x4')](_0x4b6db8,_0x1c2f44);_0x3a3340(null);};}for(var e in events){if(events[_0x1ae6('0x5')](e)){var event=events[e];DashboardItem[_0x1ae6('0x6')](e,emitEvent(event));}}module[_0x1ae6('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index e428fd8..1155017 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 _0xd670=['rimraf','../../config/environment','exports','DashboardItem','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4931c7,_0x14b5e3){var _0x1681f8=function(_0x5a10b6){while(--_0x5a10b6){_0x4931c7['push'](_0x4931c7['shift']());}};_0x1681f8(++_0x14b5e3);}(_0xd670,0x1d2));var _0x0d67=function(_0x278948,_0x85b993){_0x278948=_0x278948-0x0;var _0x59fecb=_0xd670[_0x278948];return _0x59fecb;};'use strict';var _=require(_0x0d67('0x0'));var util=require(_0x0d67('0x1'));var logger=require('../../config/logger')(_0x0d67('0x2'));var moment=require(_0x0d67('0x3'));var BPromise=require(_0x0d67('0x4'));var rp=require(_0x0d67('0x5'));var fs=require('fs');var path=require(_0x0d67('0x6'));var rimraf=require(_0x0d67('0x7'));var config=require(_0x0d67('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x0d67('0x9')]=function(_0x440b62,_0x53116b){return _0x440b62['define'](_0x0d67('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd586=['api','moment','bluebird','./dashboardItem.attributes','exports','define','DashboardItem','util','../../config/logger'];(function(_0x112d1e,_0x293934){var _0x510779=function(_0x2299e2){while(--_0x2299e2){_0x112d1e['push'](_0x112d1e['shift']());}};_0x510779(++_0x293934);}(_0xd586,0x11e));var _0x6d58=function(_0x2e8afc,_0x9a1941){_0x2e8afc=_0x2e8afc-0x0;var _0x2a5fc0=_0xd586[_0x2e8afc];return _0x2a5fc0;};'use strict';var _=require('lodash');var util=require(_0x6d58('0x0'));var logger=require(_0x6d58('0x1'))(_0x6d58('0x2'));var moment=require(_0x6d58('0x3'));var BPromise=require(_0x6d58('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(_0x6d58('0x5'));module[_0x6d58('0x6')]=function(_0x5a99dd,_0x1680f7){return _0x5a99dd[_0x6d58('0x7')](_0x6d58('0x8'),attributes,{'tableName':'dashboard_items','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 8db27ad..286c210 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 _0x9ac9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment'];(function(_0x243639,_0x38de77){var _0x2879dc=function(_0x1159a7){while(--_0x1159a7){_0x243639['push'](_0x243639['shift']());}};_0x2879dc(++_0x38de77);}(_0x9ac9,0x1da));var _0x99ac=function(_0x500aeb,_0x27061a){_0x500aeb=_0x500aeb-0x0;var _0x5daa14=_0x9ac9[_0x500aeb];return _0x5daa14;};'use strict';var _=require('lodash');var util=require(_0x99ac('0x0'));var moment=require(_0x99ac('0x1'));var BPromise=require(_0x99ac('0x2'));var rs=require(_0x99ac('0x3'));var fs=require('fs');var Redis=require(_0x99ac('0x4'));var db=require(_0x99ac('0x5'))['db'];var utils=require(_0x99ac('0x6'));var logger=require(_0x99ac('0x7'))('rpc');var config=require(_0x99ac('0x8'));var jayson=require(_0x99ac('0x9'));var client=jayson[_0x99ac('0xa')][_0x99ac('0xb')]({'port':0x232a});config[_0x99ac('0xc')]=_[_0x99ac('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x99ac('0xe'))(new Redis(config[_0x99ac('0xc')]));require('./dashboardItem.socket')[_0x99ac('0xf')](socket);function respondWithRpcPromise(_0x47f9ed,_0x477d8a,_0x5d7b27){return new BPromise(function(_0x1c2d39,_0x2358c2){return client[_0x99ac('0x10')](_0x47f9ed,_0x5d7b27)[_0x99ac('0x11')](function(_0x324a27){logger['info'](_0x99ac('0x12'),_0x477d8a,_0x99ac('0x13'));logger[_0x99ac('0x14')](_0x99ac('0x15'),_0x477d8a,_0x99ac('0x13'),JSON[_0x99ac('0x16')](_0x324a27));if(_0x324a27[_0x99ac('0x17')]){if(_0x324a27[_0x99ac('0x17')]['code']===0x1f4){logger['error'](_0x99ac('0x12'),_0x477d8a,_0x324a27[_0x99ac('0x17')][_0x99ac('0x18')]);return _0x2358c2(_0x324a27[_0x99ac('0x17')][_0x99ac('0x18')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x477d8a,_0x324a27[_0x99ac('0x17')]['message']);return _0x1c2d39(_0x324a27[_0x99ac('0x17')]['message']);}else{logger[_0x99ac('0x19')](_0x99ac('0x12'),_0x477d8a,_0x99ac('0x13'));_0x1c2d39(_0x324a27[_0x99ac('0x1a')][_0x99ac('0x18')]);}})[_0x99ac('0x1b')](function(_0x22361f){logger[_0x99ac('0x17')]('DashboardItem,\x20%s,\x20%s',_0x477d8a,_0x22361f);_0x2358c2(_0x22361f);});});} \ No newline at end of file +var _0x5df5=['then','info','DashboardItem,\x20%s,\x20%s','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request'];(function(_0x7c15af,_0x4bef38){var _0x98e988=function(_0x553ce0){while(--_0x553ce0){_0x7c15af['push'](_0x7c15af['shift']());}};_0x98e988(++_0x4bef38);}(_0x5df5,0x142));var _0x55df=function(_0x2ae254,_0x3d0994){_0x2ae254=_0x2ae254-0x0;var _0x270fee=_0x5df5[_0x2ae254];return _0x270fee;};'use strict';var _=require('lodash');var util=require(_0x55df('0x0'));var moment=require(_0x55df('0x1'));var BPromise=require(_0x55df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55df('0x3'));var db=require(_0x55df('0x4'))['db'];var utils=require(_0x55df('0x5'));var logger=require(_0x55df('0x6'))(_0x55df('0x7'));var config=require(_0x55df('0x8'));var jayson=require(_0x55df('0x9'));var client=jayson[_0x55df('0xa')][_0x55df('0xb')]({'port':0x232a});config[_0x55df('0xc')]=_[_0x55df('0xd')](config[_0x55df('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55df('0xc')]));require('./dashboardItem.socket')[_0x55df('0xe')](socket);function respondWithRpcPromise(_0x1c2c35,_0x4f476c,_0x398042){return new BPromise(function(_0x341db9,_0x432d2d){return client[_0x55df('0xf')](_0x1c2c35,_0x398042)[_0x55df('0x10')](function(_0x449270){logger[_0x55df('0x11')](_0x55df('0x12'),_0x4f476c,'request\x20sent');logger['debug'](_0x55df('0x13'),_0x4f476c,_0x55df('0x14'),JSON[_0x55df('0x15')](_0x449270));if(_0x449270[_0x55df('0x16')]){if(_0x449270[_0x55df('0x16')][_0x55df('0x17')]===0x1f4){logger[_0x55df('0x16')](_0x55df('0x12'),_0x4f476c,_0x449270[_0x55df('0x16')][_0x55df('0x18')]);return _0x432d2d(_0x449270[_0x55df('0x16')][_0x55df('0x18')]);}logger[_0x55df('0x16')](_0x55df('0x12'),_0x4f476c,_0x449270[_0x55df('0x16')][_0x55df('0x18')]);return _0x341db9(_0x449270['error'][_0x55df('0x18')]);}else{logger[_0x55df('0x11')](_0x55df('0x12'),_0x4f476c,_0x55df('0x14'));_0x341db9(_0x449270[_0x55df('0x19')][_0x55df('0x18')]);}})['catch'](function(_0x4eb645){logger[_0x55df('0x16')]('DashboardItem,\x20%s,\x20%s',_0x4f476c,_0x4eb645);_0x432d2d(_0x4eb645);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index fa7a816..02d9098 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 _0x2fae=['remove','emit','removeListener','register','dashboardItem:','save'];(function(_0x26e022,_0x326acd){var _0xd92f54=function(_0x2993ac){while(--_0x2993ac){_0x26e022['push'](_0x26e022['shift']());}};_0xd92f54(++_0x326acd);}(_0x2fae,0x1c1));var _0xe2fa=function(_0x5b5841,_0x5f33e8){_0x5b5841=_0x5b5841-0x0;var _0x25f559=_0x2fae[_0x5b5841];return _0x25f559;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xe2fa('0x0'),_0xe2fa('0x1'),'update'];function createListener(_0x19effd,_0x396302){return function(_0x447680){_0x396302[_0xe2fa('0x2')](_0x19effd,_0x447680);};}function removeListener(_0x53d2d8,_0xc65639){return function(){DashboardItemEvents[_0xe2fa('0x3')](_0x53d2d8,_0xc65639);};}exports[_0xe2fa('0x4')]=function(_0x452a37){for(var _0x44b0d3=0x0,_0x50448=events['length'];_0x44b0d3<_0x50448;_0x44b0d3++){var _0x5ac4b9=events[_0x44b0d3];var _0x28e996=createListener(_0xe2fa('0x5')+_0x5ac4b9,_0x452a37);DashboardItemEvents['on'](_0x5ac4b9,_0x28e996);}}; \ No newline at end of file +var _0x7582=['remove','removeListener','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x374a3c,_0x22c207){var _0xb0c4f8=function(_0x134140){while(--_0x134140){_0x374a3c['push'](_0x374a3c['shift']());}};_0xb0c4f8(++_0x22c207);}(_0x7582,0x1a8));var _0x2758=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0x7582[_0x49c057];return _0xd8f0e6;};'use strict';var DashboardItemEvents=require(_0x2758('0x0'));var events=[_0x2758('0x1'),_0x2758('0x2'),'update'];function createListener(_0x222ea9,_0x10b552){return function(_0x22e10c){_0x10b552['emit'](_0x222ea9,_0x22e10c);};}function removeListener(_0x211cb5,_0x52a521){return function(){DashboardItemEvents[_0x2758('0x3')](_0x211cb5,_0x52a521);};}exports['register']=function(_0x407778){for(var _0x10a00a=0x0,_0x4b172d=events[_0x2758('0x4')];_0x10a00a<_0x4b172d;_0x10a00a++){var _0x596892=events[_0x10a00a];var _0x1a21b2=createListener(_0x2758('0x5')+_0x596892,_0x407778);DashboardItemEvents['on'](_0x596892,_0x1a21b2);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 4f2b0a6..3d6021b 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 _0x7da7=['put','update','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post','create'];(function(_0x5e5add,_0xa3a44a){var _0x4e56b0=function(_0x5bd80a){while(--_0x5bd80a){_0x5e5add['push'](_0x5e5add['shift']());}};_0x4e56b0(++_0xa3a44a);}(_0x7da7,0x10d));var _0x77da=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x7da7[_0x2c7b86];return _0x256735;};'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 auth=require(_0x77da('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77da('0x5'));var controller=require(_0x77da('0x6'));router['get'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller['show']);router[_0x77da('0x9')]('/',auth['isAuthenticated'](),controller[_0x77da('0xa')]);router[_0x77da('0xb')](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xc')]);router['delete'](_0x77da('0x7'),auth[_0x77da('0x8')](),controller[_0x77da('0xd')]);module['exports']=router; \ No newline at end of file +var _0x1261=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','show','post','create','put','/:id','isAuthenticated','update','destroy'];(function(_0x4c7281,_0x4e11b8){var _0x3b47c5=function(_0xa9add8){while(--_0xa9add8){_0x4c7281['push'](_0x4c7281['shift']());}};_0x3b47c5(++_0x4e11b8);}(_0x1261,0x144));var _0x1126=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x1261[_0x2aee2f];return _0x19337f;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/',auth['isAuthenticated'](),controller[_0x1126('0xc')]);router[_0x1126('0xd')](_0x1126('0xe'),auth[_0x1126('0xf')](),controller[_0x1126('0x10')]);router['delete'](_0x1126('0xe'),auth[_0x1126('0xf')](),controller[_0x1126('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 98a62c2..8c8f92b 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 _0x360a=['STRING','sequelize','exports','ENUM','first','second','third'];(function(_0x2d63b3,_0x3e1a01){var _0x55ac08=function(_0x51a537){while(--_0x51a537){_0x2d63b3['push'](_0x2d63b3['shift']());}};_0x55ac08(++_0x3e1a01);}(_0x360a,0x14a));var _0xa360=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x360a[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xa360('0x0'));module[_0xa360('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xa360('0x2')](_0xa360('0x3'),_0xa360('0x4'),_0xa360('0x5')),'allowNull':![],'defaultValue':_0xa360('0x3')},'description':{'type':Sequelize[_0xa360('0x6')]}}; \ No newline at end of file +var _0x7b37=['first','second','third','sequelize','STRING'];(function(_0x3db122,_0x5e6bee){var _0x325b67=function(_0x5095af){while(--_0x5095af){_0x3db122['push'](_0x3db122['shift']());}};_0x325b67(++_0x5e6bee);}(_0x7b37,0x189));var _0x77b3=function(_0x3cc762,_0x2babfc){_0x3cc762=_0x3cc762-0x0;var _0x4dd5a1=_0x7b37[_0x3cc762];return _0x4dd5a1;};'use strict';var Sequelize=require(_0x77b3('0x0'));module['exports']={'name':{'type':Sequelize[_0x77b3('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x77b3('0x2'),_0x77b3('0x3'),_0x77b3('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x77b3('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 6268c83..457bdc4 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 _0x9fcd=['set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','Disposition','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','user','Dispositions','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9fcd,0x170));var _0xd9fc=function(_0x3fa3f0,_0x4da039){_0x3fa3f0=_0x3fa3f0-0x0;var _0x243892=_0x9fcd[_0x3fa3f0];return _0x243892;};'use strict';var pdf=require(_0xd9fc('0x0'));var emlformat=require(_0xd9fc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd9fc('0x2'));var rp=require('request-promise');var moment=require(_0xd9fc('0x3'));var BPromise=require(_0xd9fc('0x4'));var Mustache=require(_0xd9fc('0x5'));var util=require(_0xd9fc('0x6'));var path=require('path');var sox=require(_0xd9fc('0x7'));var csv=require(_0xd9fc('0x8'));var ejs=require(_0xd9fc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd9fc('0xa'));var crypto=require('crypto');var jsforce=require(_0xd9fc('0xb'));var deskjs=require(_0xd9fc('0xc'));var toCsv=require(_0xd9fc('0x8'));var querystring=require(_0xd9fc('0xd'));var Papa=require('papaparse');var Redis=require(_0xd9fc('0xe'));var authService=require(_0xd9fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd9fc('0x10'));var logger=require(_0xd9fc('0x11'))(_0xd9fc('0x12'));var utils=require(_0xd9fc('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd9fc('0x14'))['db'];function respondWithStatusCode(_0x33b59d,_0x171d0d){_0x171d0d=_0x171d0d||0xcc;return function(_0x4fd7ad){if(_0x4fd7ad){return _0x33b59d['sendStatus'](_0x171d0d);}return _0x33b59d[_0xd9fc('0x15')](_0x171d0d)[_0xd9fc('0x16')]();};}function respondWithResult(_0x309767,_0x6849bd){_0x6849bd=_0x6849bd||0xc8;return function(_0xd21b85){if(_0xd21b85){return _0x309767[_0xd9fc('0x15')](_0x6849bd)[_0xd9fc('0x17')](_0xd21b85);}};}function respondWithFilteredResult(_0x441b0e,_0x23904b){return function(_0x5dfbaf){if(_0x5dfbaf){var _0x88ba64=_0x5dfbaf[_0xd9fc('0x18')],_0x589aef=_0x23904b[_0xd9fc('0x19')],_0x3182dd=_0x23904b[_0xd9fc('0x19')]+_0x23904b[_0xd9fc('0x1a')],_0x403b3a;if(_0x3182dd>=_0x88ba64){_0x3182dd=_0x88ba64;_0x403b3a=0xc8;}else{_0x403b3a=0xce;}_0x441b0e[_0xd9fc('0x15')](_0x403b3a);return _0x441b0e[_0xd9fc('0x1b')](_0xd9fc('0x1c'),_0x589aef+'-'+_0x3182dd+'/'+_0x88ba64)['json'](_0x5dfbaf);}return null;};}function patchUpdates(_0x39c302){return function(_0xa0f0c9){try{jsonpatch[_0xd9fc('0x1d')](_0xa0f0c9,_0x39c302,!![]);}catch(_0x4d6679){return BPromise[_0xd9fc('0x1e')](_0x4d6679);}return _0xa0f0c9[_0xd9fc('0x1f')]();};}function saveUpdates(_0x135798,_0x2c9f10){return function(_0x5b527d){if(_0x5b527d){return _0x5b527d[_0xd9fc('0x20')](_0x135798)[_0xd9fc('0x21')](function(_0xd7dd02){return _0xd7dd02;});}return null;};}function removeEntity(_0x4ded86,_0x10b15a){return function(_0x818f5b){if(_0x818f5b){return _0x818f5b[_0xd9fc('0x22')]()[_0xd9fc('0x21')](function(){var _0xe6499f=_0x818f5b[_0xd9fc('0x23')]({'plain':!![]});var _0x9e296e='Dispositions';return db[_0xd9fc('0x24')][_0xd9fc('0x22')]({'where':{'type':_0x9e296e,'resourceId':_0xe6499f['id']}})[_0xd9fc('0x21')](function(){return _0x818f5b;});})[_0xd9fc('0x21')](function(){_0x4ded86[_0xd9fc('0x15')](0xcc)[_0xd9fc('0x16')]();});}};}function handleEntityNotFound(_0x97c5dc,_0x58faba){return function(_0x206d9f){if(!_0x206d9f){_0x97c5dc[_0xd9fc('0x25')](0x194);}return _0x206d9f;};}function handleError(_0x1ab831,_0x4d1aa5){_0x4d1aa5=_0x4d1aa5||0x1f4;return function(_0x314ede){logger[_0xd9fc('0x26')](_0x314ede[_0xd9fc('0x27')]);if(_0x314ede['name']){delete _0x314ede[_0xd9fc('0x28')];}_0x1ab831['status'](_0x4d1aa5)[_0xd9fc('0x29')](_0x314ede);};}exports[_0xd9fc('0x2a')]=function(_0x375cb4,_0x168a7b){var _0x3443d5={},_0x297f58={},_0x1b2b57={'count':0x0,'rows':[]};var _0x17b739=_['map'](db[_0xd9fc('0x2b')][_0xd9fc('0x2c')],function(_0x23a85f){return{'name':_0x23a85f['fieldName'],'type':_0x23a85f[_0xd9fc('0x2d')][_0xd9fc('0x2e')]};});_0x297f58[_0xd9fc('0x2f')]=_[_0xd9fc('0x30')](_0x17b739,_0xd9fc('0x28'));_0x297f58[_0xd9fc('0x31')]=_['keys'](_0x375cb4['query']);_0x297f58[_0xd9fc('0x32')]=_[_0xd9fc('0x33')](_0x297f58['model'],_0x297f58[_0xd9fc('0x31')]);_0x3443d5[_0xd9fc('0x34')]=_[_0xd9fc('0x33')](_0x297f58[_0xd9fc('0x2f')],qs[_0xd9fc('0x35')](_0x375cb4[_0xd9fc('0x31')]['fields']));_0x3443d5[_0xd9fc('0x34')]=_0x3443d5[_0xd9fc('0x34')][_0xd9fc('0x36')]?_0x3443d5[_0xd9fc('0x34')]:_0x297f58[_0xd9fc('0x2f')];if(!_0x375cb4[_0xd9fc('0x31')][_0xd9fc('0x37')]('nolimit')){_0x3443d5[_0xd9fc('0x1a')]=qs[_0xd9fc('0x1a')](_0x375cb4[_0xd9fc('0x31')][_0xd9fc('0x1a')]);_0x3443d5[_0xd9fc('0x19')]=qs['offset'](_0x375cb4[_0xd9fc('0x31')]['offset']);}_0x3443d5['order']=qs[_0xd9fc('0x38')](_0x375cb4['query'][_0xd9fc('0x38')]);_0x3443d5[_0xd9fc('0x39')]=qs[_0xd9fc('0x32')](_[_0xd9fc('0x3a')](_0x375cb4[_0xd9fc('0x31')],_0x297f58[_0xd9fc('0x32')]),_0x17b739);if(_0x375cb4[_0xd9fc('0x31')][_0xd9fc('0x3b')]){_0x3443d5[_0xd9fc('0x39')]=_['merge'](_0x3443d5['where'],{'$or':_[_0xd9fc('0x30')](_0x17b739,function(_0x41abdb){if(_0x41abdb[_0xd9fc('0x2d')]!=='VIRTUAL'){var _0x562237={};_0x562237[_0x41abdb['name']]={'$like':'%'+_0x375cb4[_0xd9fc('0x31')][_0xd9fc('0x3b')]+'%'};return _0x562237;}})});}_0x3443d5=_[_0xd9fc('0x3c')]({},_0x3443d5,_0x375cb4[_0xd9fc('0x3d')]);var _0x4784d6={'where':_0x3443d5['where']};return db[_0xd9fc('0x2b')][_0xd9fc('0x18')](_0x4784d6)[_0xd9fc('0x21')](function(_0xc21fab){_0x1b2b57[_0xd9fc('0x18')]=_0xc21fab;if(_0x375cb4[_0xd9fc('0x31')][_0xd9fc('0x3e')]){_0x3443d5['include']=[{'all':!![]}];}return db[_0xd9fc('0x2b')][_0xd9fc('0x3f')](_0x3443d5);})['then'](function(_0x3a2165){_0x1b2b57[_0xd9fc('0x40')]=_0x3a2165;return _0x1b2b57;})[_0xd9fc('0x21')](respondWithFilteredResult(_0x168a7b,_0x3443d5))[_0xd9fc('0x41')](handleError(_0x168a7b,null));};exports[_0xd9fc('0x42')]=function(_0x10ab19,_0x4a49a0){var _0x33ba83={'raw':!![],'where':{'id':_0x10ab19[_0xd9fc('0x43')]['id']}},_0x5a719e={};_0x5a719e[_0xd9fc('0x2f')]=_[_0xd9fc('0x44')](db['Disposition'][_0xd9fc('0x2c')]);_0x5a719e[_0xd9fc('0x31')]=_[_0xd9fc('0x44')](_0x10ab19['query']);_0x5a719e[_0xd9fc('0x32')]=_[_0xd9fc('0x33')](_0x5a719e[_0xd9fc('0x2f')],_0x5a719e['query']);_0x33ba83[_0xd9fc('0x34')]=_[_0xd9fc('0x33')](_0x5a719e[_0xd9fc('0x2f')],qs[_0xd9fc('0x35')](_0x10ab19[_0xd9fc('0x31')]['fields']));_0x33ba83[_0xd9fc('0x34')]=_0x33ba83[_0xd9fc('0x34')][_0xd9fc('0x36')]?_0x33ba83['attributes']:_0x5a719e[_0xd9fc('0x2f')];if(_0x10ab19[_0xd9fc('0x31')][_0xd9fc('0x3e')]){_0x33ba83[_0xd9fc('0x45')]=[{'all':!![]}];}_0x33ba83=_[_0xd9fc('0x3c')]({},_0x33ba83,_0x10ab19[_0xd9fc('0x3d')]);return db[_0xd9fc('0x2b')]['find'](_0x33ba83)[_0xd9fc('0x21')](handleEntityNotFound(_0x4a49a0,null))[_0xd9fc('0x21')](respondWithResult(_0x4a49a0,null))[_0xd9fc('0x41')](handleError(_0x4a49a0,null));};exports['create']=function(_0x6c9ae0,_0x5689a7){return db[_0xd9fc('0x2b')][_0xd9fc('0x46')](_0x6c9ae0['body'],{})[_0xd9fc('0x21')](function(_0x2e75de){var _0x4b91f3=_0x6c9ae0['user']['get']({'plain':!![]});if(!_0x4b91f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b91f3['role']===_0xd9fc('0x47')){var _0x14f5ee=_0x2e75de['get']({'plain':!![]});var _0x10fd1f=_0xd9fc('0x48');return db[_0xd9fc('0x49')][_0xd9fc('0x4a')]({'where':{'name':_0x10fd1f,'userProfileId':_0x4b91f3[_0xd9fc('0x4b')]},'raw':!![]})[_0xd9fc('0x21')](function(_0x1addf4){if(_0x1addf4&&_0x1addf4[_0xd9fc('0x4c')]===0x0){return db['UserProfileResource'][_0xd9fc('0x46')]({'name':_0x14f5ee[_0xd9fc('0x28')],'resourceId':_0x14f5ee['id'],'type':_0x1addf4['name'],'sectionId':_0x1addf4['id']},{})[_0xd9fc('0x21')](function(){return _0x2e75de;});}else{return _0x2e75de;}})['catch'](function(_0x276145){logger[_0xd9fc('0x26')](_0xd9fc('0x4d'),_0x276145);throw _0x276145;});}return _0x2e75de;})[_0xd9fc('0x21')](respondWithResult(_0x5689a7,0xc9))[_0xd9fc('0x41')](handleError(_0x5689a7,null));};exports[_0xd9fc('0x20')]=function(_0x383bfc,_0x4a2ab7){if(_0x383bfc[_0xd9fc('0x4e')]['id']){delete _0x383bfc['body']['id'];}return db[_0xd9fc('0x2b')]['find']({'where':{'id':_0x383bfc[_0xd9fc('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a2ab7,null))[_0xd9fc('0x21')](saveUpdates(_0x383bfc[_0xd9fc('0x4e')],null))[_0xd9fc('0x21')](respondWithResult(_0x4a2ab7,null))[_0xd9fc('0x41')](handleError(_0x4a2ab7,null));};exports[_0xd9fc('0x22')]=function(_0x6ebd00,_0x4b0420){return db[_0xd9fc('0x2b')][_0xd9fc('0x4a')]({'where':{'id':_0x6ebd00['params']['id']}})[_0xd9fc('0x21')](handleEntityNotFound(_0x4b0420,null))[_0xd9fc('0x21')](removeEntity(_0x4b0420,null))['catch'](handleError(_0x4b0420,null));}; \ No newline at end of file +var _0x6df4=['apply','reject','save','update','destroy','then','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range'];(function(_0x1e4e2a,_0x37da6c){var _0x52fe47=function(_0xd2649d){while(--_0xd2649d){_0x1e4e2a['push'](_0x1e4e2a['shift']());}};_0x52fe47(++_0x37da6c);}(_0x6df4,0xe5));var _0x46df=function(_0x131585,_0x1abd33){_0x131585=_0x131585-0x0;var _0x1fcca2=_0x6df4[_0x131585];return _0x1fcca2;};'use strict';var pdf=require(_0x46df('0x0'));var emlformat=require(_0x46df('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x46df('0x2'));var rp=require(_0x46df('0x3'));var moment=require(_0x46df('0x4'));var BPromise=require(_0x46df('0x5'));var Mustache=require(_0x46df('0x6'));var util=require(_0x46df('0x7'));var path=require(_0x46df('0x8'));var sox=require(_0x46df('0x9'));var csv=require(_0x46df('0xa'));var ejs=require(_0x46df('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x46df('0xc'));var jsforce=require(_0x46df('0xd'));var deskjs=require(_0x46df('0xe'));var toCsv=require('to-csv');var querystring=require(_0x46df('0xf'));var Papa=require(_0x46df('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x46df('0x11'));var as=require(_0x46df('0x12'));var hardwareService=require(_0x46df('0x13'));var logger=require(_0x46df('0x14'))(_0x46df('0x15'));var utils=require(_0x46df('0x16'));var config=require(_0x46df('0x17'));var licenseUtil=require(_0x46df('0x18'));var db=require(_0x46df('0x19'))['db'];function respondWithStatusCode(_0x567334,_0x150332){_0x150332=_0x150332||0xcc;return function(_0x6c7d4b){if(_0x6c7d4b){return _0x567334[_0x46df('0x1a')](_0x150332);}return _0x567334[_0x46df('0x1b')](_0x150332)[_0x46df('0x1c')]();};}function respondWithResult(_0x1e9833,_0x10e347){_0x10e347=_0x10e347||0xc8;return function(_0xfdb04f){if(_0xfdb04f){return _0x1e9833[_0x46df('0x1b')](_0x10e347)[_0x46df('0x1d')](_0xfdb04f);}};}function respondWithFilteredResult(_0x543f47,_0x5215a4){return function(_0x113aa6){if(_0x113aa6){var _0xafffdb=_0x113aa6[_0x46df('0x1e')],_0x15b825=_0x5215a4[_0x46df('0x1f')],_0x4dbff9=_0x5215a4['offset']+_0x5215a4[_0x46df('0x20')],_0x1bd8fb;if(_0x4dbff9>=_0xafffdb){_0x4dbff9=_0xafffdb;_0x1bd8fb=0xc8;}else{_0x1bd8fb=0xce;}_0x543f47[_0x46df('0x1b')](_0x1bd8fb);return _0x543f47[_0x46df('0x21')](_0x46df('0x22'),_0x15b825+'-'+_0x4dbff9+'/'+_0xafffdb)[_0x46df('0x1d')](_0x113aa6);}return null;};}function patchUpdates(_0x4d3841){return function(_0x4a0c03){try{jsonpatch[_0x46df('0x23')](_0x4a0c03,_0x4d3841,!![]);}catch(_0x583a1e){return BPromise[_0x46df('0x24')](_0x583a1e);}return _0x4a0c03[_0x46df('0x25')]();};}function saveUpdates(_0xccf79,_0x450d8a){return function(_0xada29d){if(_0xada29d){return _0xada29d[_0x46df('0x26')](_0xccf79)['then'](function(_0x2cc8f8){return _0x2cc8f8;});}return null;};}function removeEntity(_0x530afc,_0x4aa8ac){return function(_0x80ff3f){if(_0x80ff3f){return _0x80ff3f[_0x46df('0x27')]()[_0x46df('0x28')](function(){var _0x27ea7d=_0x80ff3f[_0x46df('0x29')]({'plain':!![]});var _0x285e7b=_0x46df('0x2a');return db[_0x46df('0x2b')][_0x46df('0x27')]({'where':{'type':_0x285e7b,'resourceId':_0x27ea7d['id']}})[_0x46df('0x28')](function(){return _0x80ff3f;});})[_0x46df('0x28')](function(){_0x530afc[_0x46df('0x1b')](0xcc)[_0x46df('0x1c')]();});}};}function handleEntityNotFound(_0x288374,_0x4d0e43){return function(_0x41c047){if(!_0x41c047){_0x288374['sendStatus'](0x194);}return _0x41c047;};}function handleError(_0x54d0ed,_0x49f4ae){_0x49f4ae=_0x49f4ae||0x1f4;return function(_0x2ae4b2){logger[_0x46df('0x2c')](_0x2ae4b2[_0x46df('0x2d')]);if(_0x2ae4b2[_0x46df('0x2e')]){delete _0x2ae4b2[_0x46df('0x2e')];}_0x54d0ed[_0x46df('0x1b')](_0x49f4ae)[_0x46df('0x2f')](_0x2ae4b2);};}exports[_0x46df('0x30')]=function(_0x359517,_0x2ba2c2){var _0x4ae1c4={},_0x3ba8de={},_0x59a81a={'count':0x0,'rows':[]};var _0x3b0451=_[_0x46df('0x31')](db[_0x46df('0x32')][_0x46df('0x33')],function(_0x27c2af){return{'name':_0x27c2af['fieldName'],'type':_0x27c2af[_0x46df('0x34')][_0x46df('0x35')]};});_0x3ba8de[_0x46df('0x36')]=_[_0x46df('0x31')](_0x3b0451,_0x46df('0x2e'));_0x3ba8de[_0x46df('0x37')]=_[_0x46df('0x38')](_0x359517[_0x46df('0x37')]);_0x3ba8de['filters']=_[_0x46df('0x39')](_0x3ba8de[_0x46df('0x36')],_0x3ba8de[_0x46df('0x37')]);_0x4ae1c4['attributes']=_[_0x46df('0x39')](_0x3ba8de[_0x46df('0x36')],qs['fields'](_0x359517[_0x46df('0x37')][_0x46df('0x3a')]));_0x4ae1c4['attributes']=_0x4ae1c4[_0x46df('0x3b')]['length']?_0x4ae1c4[_0x46df('0x3b')]:_0x3ba8de[_0x46df('0x36')];if(!_0x359517[_0x46df('0x37')][_0x46df('0x3c')](_0x46df('0x3d'))){_0x4ae1c4['limit']=qs[_0x46df('0x20')](_0x359517['query'][_0x46df('0x20')]);_0x4ae1c4['offset']=qs['offset'](_0x359517[_0x46df('0x37')][_0x46df('0x1f')]);}_0x4ae1c4[_0x46df('0x3e')]=qs[_0x46df('0x3f')](_0x359517[_0x46df('0x37')][_0x46df('0x3f')]);_0x4ae1c4[_0x46df('0x40')]=qs[_0x46df('0x41')](_[_0x46df('0x42')](_0x359517[_0x46df('0x37')],_0x3ba8de[_0x46df('0x41')]),_0x3b0451);if(_0x359517[_0x46df('0x37')][_0x46df('0x43')]){_0x4ae1c4[_0x46df('0x40')]=_[_0x46df('0x44')](_0x4ae1c4[_0x46df('0x40')],{'$or':_['map'](_0x3b0451,function(_0x91359a){if(_0x91359a[_0x46df('0x34')]!==_0x46df('0x45')){var _0x615e21={};_0x615e21[_0x91359a['name']]={'$like':'%'+_0x359517[_0x46df('0x37')][_0x46df('0x43')]+'%'};return _0x615e21;}})});}_0x4ae1c4=_['merge']({},_0x4ae1c4,_0x359517['options']);var _0x30ccca={'where':_0x4ae1c4['where']};return db[_0x46df('0x32')][_0x46df('0x1e')](_0x30ccca)[_0x46df('0x28')](function(_0x4a695b){_0x59a81a[_0x46df('0x1e')]=_0x4a695b;if(_0x359517[_0x46df('0x37')][_0x46df('0x46')]){_0x4ae1c4['include']=[{'all':!![]}];}return db[_0x46df('0x32')][_0x46df('0x47')](_0x4ae1c4);})[_0x46df('0x28')](function(_0x7538b){_0x59a81a[_0x46df('0x48')]=_0x7538b;return _0x59a81a;})[_0x46df('0x28')](respondWithFilteredResult(_0x2ba2c2,_0x4ae1c4))['catch'](handleError(_0x2ba2c2,null));};exports[_0x46df('0x49')]=function(_0xd697b0,_0x5d7ce9){var _0x409ab0={'raw':!![],'where':{'id':_0xd697b0[_0x46df('0x4a')]['id']}},_0x46060f={};_0x46060f[_0x46df('0x36')]=_[_0x46df('0x38')](db[_0x46df('0x32')]['rawAttributes']);_0x46060f[_0x46df('0x37')]=_['keys'](_0xd697b0[_0x46df('0x37')]);_0x46060f['filters']=_[_0x46df('0x39')](_0x46060f[_0x46df('0x36')],_0x46060f[_0x46df('0x37')]);_0x409ab0[_0x46df('0x3b')]=_['intersection'](_0x46060f[_0x46df('0x36')],qs[_0x46df('0x3a')](_0xd697b0[_0x46df('0x37')][_0x46df('0x3a')]));_0x409ab0[_0x46df('0x3b')]=_0x409ab0[_0x46df('0x3b')][_0x46df('0x4b')]?_0x409ab0['attributes']:_0x46060f[_0x46df('0x36')];if(_0xd697b0[_0x46df('0x37')]['includeAll']){_0x409ab0[_0x46df('0x4c')]=[{'all':!![]}];}_0x409ab0=_['merge']({},_0x409ab0,_0xd697b0[_0x46df('0x4d')]);return db[_0x46df('0x32')][_0x46df('0x4e')](_0x409ab0)[_0x46df('0x28')](handleEntityNotFound(_0x5d7ce9,null))['then'](respondWithResult(_0x5d7ce9,null))['catch'](handleError(_0x5d7ce9,null));};exports['create']=function(_0x426b8d,_0x501a5a){return db[_0x46df('0x32')][_0x46df('0x4f')](_0x426b8d[_0x46df('0x50')],{})['then'](function(_0x234ace){var _0x1b1694=_0x426b8d[_0x46df('0x51')][_0x46df('0x29')]({'plain':!![]});if(!_0x1b1694)throw new Error(_0x46df('0x52'));if(_0x1b1694['role']==='user'){var _0x50db27=_0x234ace[_0x46df('0x29')]({'plain':!![]});var _0x435857='Dispositions';return db[_0x46df('0x53')][_0x46df('0x4e')]({'where':{'name':_0x435857,'userProfileId':_0x1b1694[_0x46df('0x54')]},'raw':!![]})[_0x46df('0x28')](function(_0x5be09b){if(_0x5be09b&&_0x5be09b[_0x46df('0x55')]===0x0){return db[_0x46df('0x2b')][_0x46df('0x4f')]({'name':_0x50db27['name'],'resourceId':_0x50db27['id'],'type':_0x5be09b['name'],'sectionId':_0x5be09b['id']},{})['then'](function(){return _0x234ace;});}else{return _0x234ace;}})[_0x46df('0x56')](function(_0x26ebc6){logger['error'](_0x46df('0x57'),_0x26ebc6);throw _0x26ebc6;});}return _0x234ace;})[_0x46df('0x28')](respondWithResult(_0x501a5a,0xc9))[_0x46df('0x56')](handleError(_0x501a5a,null));};exports[_0x46df('0x26')]=function(_0xa95ab0,_0x455ca9){if(_0xa95ab0[_0x46df('0x50')]['id']){delete _0xa95ab0[_0x46df('0x50')]['id'];}return db[_0x46df('0x32')][_0x46df('0x4e')]({'where':{'id':_0xa95ab0[_0x46df('0x4a')]['id']}})[_0x46df('0x28')](handleEntityNotFound(_0x455ca9,null))[_0x46df('0x28')](saveUpdates(_0xa95ab0[_0x46df('0x50')],null))[_0x46df('0x28')](respondWithResult(_0x455ca9,null))[_0x46df('0x56')](handleError(_0x455ca9,null));};exports[_0x46df('0x27')]=function(_0x5cf5d0,_0x473955){return db[_0x46df('0x32')][_0x46df('0x4e')]({'where':{'id':_0x5cf5d0['params']['id']}})[_0x46df('0x28')](handleEntityNotFound(_0x473955,null))[_0x46df('0x28')](removeEntity(_0x473955,null))[_0x46df('0x56')](handleError(_0x473955,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index da48592..6ad1233 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 _0x6bb4=['name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_chat','name','name_mail','MailAccountId','SmsAccountId','FaxAccountId'];(function(_0x275099,_0xd89894){var _0x168f8a=function(_0x171ca2){while(--_0x171ca2){_0x275099['push'](_0x275099['shift']());}};_0x168f8a(++_0xd89894);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x42fbbc,_0x379028){_0x42fbbc=_0x42fbbc-0x0;var _0x2abf24=_0x6bb4[_0x42fbbc];return _0x2abf24;};'use strict';var _=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var logger=require(_0x46bb('0x2'))('api');var moment=require(_0x46bb('0x3'));var BPromise=require(_0x46bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x46bb('0x5'));var rimraf=require(_0x46bb('0x6'));var config=require(_0x46bb('0x7'));var attributes=require(_0x46bb('0x8'));module[_0x46bb('0x9')]=function(_0x2ae90f,_0x5dd7d6){return _0x2ae90f['define'](_0x46bb('0xa'),attributes,{'tableName':_0x46bb('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0x46bb('0xc'),'fields':[_0x46bb('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0x46bb('0xe'),'fields':[_0x46bb('0xd'),_0x46bb('0xf')]},{'unique':!![],'name':'name_sms','fields':[_0x46bb('0xd'),_0x46bb('0x10')]},{'unique':!![],'name':'name_fax','fields':[_0x46bb('0xd'),_0x46bb('0x11')]},{'unique':!![],'name':_0x46bb('0x12'),'fields':['name',_0x46bb('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x46bb('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4fd7=['name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','tools_dispositions'];(function(_0x5a99d3,_0x4eb12e){var _0xf76915=function(_0x2eac9b){while(--_0x2eac9b){_0x5a99d3['push'](_0x5a99d3['shift']());}};_0xf76915(++_0x4eb12e);}(_0x4fd7,0xe6));var _0x74fd=function(_0x49eb0d,_0x361529){_0x49eb0d=_0x49eb0d-0x0;var _0xdd23f3=_0x4fd7[_0x49eb0d];return _0xdd23f3;};'use strict';var _=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var logger=require(_0x74fd('0x2'))(_0x74fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74fd('0x4'));var fs=require('fs');var path=require(_0x74fd('0x5'));var rimraf=require('rimraf');var config=require(_0x74fd('0x6'));var attributes=require('./disposition.attributes');module[_0x74fd('0x7')]=function(_0x480ec2,_0x1959e1){return _0x480ec2[_0x74fd('0x8')]('Disposition',attributes,{'tableName':_0x74fd('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x74fd('0xa'),'fields':['name',_0x74fd('0xb')]},{'unique':!![],'name':_0x74fd('0xc'),'fields':[_0x74fd('0xd'),_0x74fd('0xe')]},{'unique':!![],'name':_0x74fd('0xf'),'fields':[_0x74fd('0xd'),_0x74fd('0x10')]},{'unique':!![],'name':_0x74fd('0x11'),'fields':[_0x74fd('0xd'),_0x74fd('0x12')]},{'unique':!![],'name':_0x74fd('0x13'),'fields':[_0x74fd('0xd'),_0x74fd('0x14')]},{'unique':!![],'name':_0x74fd('0x15'),'fields':[_0x74fd('0xd'),_0x74fd('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x74fd('0xd'),_0x74fd('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index fae1682..e795d17 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 _0x2cb1=['rpc','../../config/environment','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x338c4f,_0x171548){var _0x223a58=function(_0x66e089){while(--_0x66e089){_0x338c4f['push'](_0x338c4f['shift']());}};_0x223a58(++_0x171548);}(_0x2cb1,0x9a));var _0x12cb=function(_0x452ac9,_0x2fb033){_0x452ac9=_0x452ac9-0x0;var _0x388aa7=_0x2cb1[_0x452ac9];return _0x388aa7;};'use strict';var _=require(_0x12cb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x12cb('0x1'));var rs=require(_0x12cb('0x2'));var fs=require('fs');var Redis=require(_0x12cb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x12cb('0x4'));var logger=require(_0x12cb('0x5'))(_0x12cb('0x6'));var config=require(_0x12cb('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x12cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52bb90,_0x4a13ed,_0x52d18d){return new BPromise(function(_0x5e42df,_0x54e12f){return client[_0x12cb('0x9')](_0x52bb90,_0x52d18d)[_0x12cb('0xa')](function(_0x1ffbd1){logger[_0x12cb('0xb')](_0x12cb('0xc'),_0x4a13ed,_0x12cb('0xd'));logger[_0x12cb('0xe')](_0x12cb('0xf'),_0x4a13ed,_0x12cb('0xd'),JSON['stringify'](_0x1ffbd1));if(_0x1ffbd1['error']){if(_0x1ffbd1['error'][_0x12cb('0x10')]===0x1f4){logger[_0x12cb('0x11')](_0x12cb('0xc'),_0x4a13ed,_0x1ffbd1[_0x12cb('0x11')][_0x12cb('0x12')]);return _0x54e12f(_0x1ffbd1['error'][_0x12cb('0x12')]);}logger[_0x12cb('0x11')](_0x12cb('0xc'),_0x4a13ed,_0x1ffbd1[_0x12cb('0x11')][_0x12cb('0x12')]);return _0x5e42df(_0x1ffbd1[_0x12cb('0x11')]['message']);}else{logger['info'](_0x12cb('0xc'),_0x4a13ed,_0x12cb('0xd'));_0x5e42df(_0x1ffbd1['result'][_0x12cb('0x12')]);}})[_0x12cb('0x13')](function(_0x42ea3e){logger[_0x12cb('0x11')](_0x12cb('0xc'),_0x4a13ed,_0x42ea3e);_0x54e12f(_0x42ea3e);});});} \ No newline at end of file +var _0x2fd9=['then','info','Disposition,\x20%s,\x20%s','debug','Disposition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0x2fd9,0x9b));var _0x92fd=function(_0x158902,_0x4c45bc){_0x158902=_0x158902-0x0;var _0x2bec55=_0x2fd9[_0x158902];return _0x2bec55;};'use strict';var _=require(_0x92fd('0x0'));var util=require(_0x92fd('0x1'));var moment=require(_0x92fd('0x2'));var BPromise=require(_0x92fd('0x3'));var rs=require(_0x92fd('0x4'));var fs=require('fs');var Redis=require(_0x92fd('0x5'));var db=require(_0x92fd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x92fd('0x7'))(_0x92fd('0x8'));var config=require(_0x92fd('0x9'));var jayson=require(_0x92fd('0xa'));var client=jayson[_0x92fd('0xb')][_0x92fd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5ebdf3,_0x4c7703,_0x2a8d85){return new BPromise(function(_0x597008,_0x1f8347){return client['request'](_0x5ebdf3,_0x2a8d85)[_0x92fd('0xd')](function(_0x487b93){logger[_0x92fd('0xe')](_0x92fd('0xf'),_0x4c7703,'request\x20sent');logger[_0x92fd('0x10')](_0x92fd('0x11'),_0x4c7703,_0x92fd('0x12'),JSON[_0x92fd('0x13')](_0x487b93));if(_0x487b93[_0x92fd('0x14')]){if(_0x487b93[_0x92fd('0x14')][_0x92fd('0x15')]===0x1f4){logger[_0x92fd('0x14')](_0x92fd('0xf'),_0x4c7703,_0x487b93[_0x92fd('0x14')][_0x92fd('0x16')]);return _0x1f8347(_0x487b93[_0x92fd('0x14')][_0x92fd('0x16')]);}logger[_0x92fd('0x14')](_0x92fd('0xf'),_0x4c7703,_0x487b93['error'][_0x92fd('0x16')]);return _0x597008(_0x487b93[_0x92fd('0x14')][_0x92fd('0x16')]);}else{logger[_0x92fd('0xe')](_0x92fd('0xf'),_0x4c7703,_0x92fd('0x12'));_0x597008(_0x487b93['result'][_0x92fd('0x16')]);}})[_0x92fd('0x17')](function(_0x148da9){logger[_0x92fd('0x14')](_0x92fd('0xf'),_0x4c7703,_0x148da9);_0x1f8347(_0x148da9);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 3caf8a9..0cd1afa 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 _0x2961=['/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x2961,0x16f));var _0x1296=function(_0x520e13,_0x1a7084){_0x520e13=_0x520e13-0x0;var _0x5a3975=_0x2961[_0x520e13];return _0x5a3975;};'use strict';var multer=require(_0x1296('0x0'));var util=require(_0x1296('0x1'));var path=require(_0x1296('0x2'));var timeout=require(_0x1296('0x3'));var express=require(_0x1296('0x4'));var router=express[_0x1296('0x5')]();var auth=require(_0x1296('0x6'));var interaction=require(_0x1296('0x7'));var config=require(_0x1296('0x8'));var controller=require(_0x1296('0x9'));router[_0x1296('0xa')]('/',auth[_0x1296('0xb')](),controller[_0x1296('0xc')]);router[_0x1296('0xa')](_0x1296('0xd'),auth[_0x1296('0xb')](),controller[_0x1296('0xe')]);router[_0x1296('0xf')]('/',auth['isAuthenticated'](),controller[_0x1296('0x10')]);router[_0x1296('0x11')](_0x1296('0xd'),auth[_0x1296('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1296('0x12')]);module[_0x1296('0x13')]=router; \ No newline at end of file +var _0x9d40=['get','/:id','show','post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index'];(function(_0x485920,_0x1e4094){var _0x432773=function(_0x670fca){while(--_0x670fca){_0x485920['push'](_0x485920['shift']());}};_0x432773(++_0x1e4094);}(_0x9d40,0xeb));var _0x09d4=function(_0xaa7a7b,_0x313ea8){_0xaa7a7b=_0xaa7a7b-0x0;var _0x452dbf=_0x9d40[_0xaa7a7b];return _0x452dbf;};'use strict';var multer=require(_0x09d4('0x0'));var util=require(_0x09d4('0x1'));var path=require(_0x09d4('0x2'));var timeout=require(_0x09d4('0x3'));var express=require(_0x09d4('0x4'));var router=express[_0x09d4('0x5')]();var auth=require(_0x09d4('0x6'));var interaction=require(_0x09d4('0x7'));var config=require(_0x09d4('0x8'));var controller=require(_0x09d4('0x9'));router['get']('/',auth[_0x09d4('0xa')](),controller[_0x09d4('0xb')]);router[_0x09d4('0xc')](_0x09d4('0xd'),auth[_0x09d4('0xa')](),controller[_0x09d4('0xe')]);router[_0x09d4('0xf')]('/',auth[_0x09d4('0xa')](),controller['create']);router[_0x09d4('0x10')](_0x09d4('0xd'),auth[_0x09d4('0xa')](),controller['update']);router[_0x09d4('0x11')](_0x09d4('0xd'),auth[_0x09d4('0xa')](),controller['destroy']);module[_0x09d4('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 0669d02..7171fb6 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 _0x7b66=['STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM','2400','4800','7200','12000','14400','INTEGER','DADHI','KHOMP','SIP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x3de94f,_0x3bc1c0){var _0x4ec844=function(_0x326d80){while(--_0x326d80){_0x3de94f['push'](_0x3de94f['shift']());}};_0x4ec844(++_0x3bc1c0);}(_0x7b66,0x98));var _0x67b6=function(_0x49fb7f,_0xa2e3d7){_0x49fb7f=_0x49fb7f-0x0;var _0x313dbe=_0x7b66[_0x49fb7f];return _0x313dbe;};'use strict';var Sequelize=require(_0x67b6('0x0'));module[_0x67b6('0x1')]={'name':{'type':Sequelize[_0x67b6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x67b6('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x67b6('0x2')],'defaultValue':_0x67b6('0x4')},'localstationid':{'type':Sequelize[_0x67b6('0x2')],'unique':_0x67b6('0x5')},'minrate':{'type':Sequelize[_0x67b6('0x6')](_0x67b6('0x7'),_0x67b6('0x8'),_0x67b6('0x9'),'9600',_0x67b6('0xa'),_0x67b6('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x67b6('0x6')](_0x67b6('0x7'),_0x67b6('0x8'),_0x67b6('0x9'),'9600',_0x67b6('0xa'),_0x67b6('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x67b6('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x67b6('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x67b6('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x67b6('0x6')]('SIP','IAX',_0x67b6('0xd'),_0x67b6('0xe')),'defaultValue':_0x67b6('0xf')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x67b6('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x67b6('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x67b6('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x67b6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x67b6('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x67b6('0x12'),'set':function(_0x5979c4){if(!_0x5979c4)this[_0x67b6('0x13')](_0x67b6('0x14'),null);this[_0x67b6('0x13')](_0x67b6('0x15'),_0x5979c4);}}}; \ No newline at end of file +var _0xb304=['9600','12000','14400','INTEGER','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','localstationid','2400','4800','7200'];(function(_0x47ec93,_0x9d4af0){var _0x5babc0=function(_0x59f66b){while(--_0x59f66b){_0x47ec93['push'](_0x47ec93['shift']());}};_0x5babc0(++_0x9d4af0);}(_0xb304,0x133));var _0x4b30=function(_0x159e9f,_0x1385d7){_0x159e9f=_0x159e9f-0x0;var _0x5a3c09=_0xb304[_0x159e9f];return _0x5a3c09;};'use strict';var Sequelize=require('sequelize');module[_0x4b30('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4b30('0x1')]},'ecm':{'type':Sequelize[_0x4b30('0x2')](_0x4b30('0x3'),'no'),'defaultValue':_0x4b30('0x3')},'headerinfo':{'type':Sequelize[_0x4b30('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x4b30('0x1')],'unique':_0x4b30('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x4b30('0x5'),_0x4b30('0x6'),_0x4b30('0x7'),_0x4b30('0x8'),_0x4b30('0x9'),_0x4b30('0xa')),'defaultValue':_0x4b30('0x6')},'maxrate':{'type':Sequelize[_0x4b30('0x2')]('2400',_0x4b30('0x6'),_0x4b30('0x7'),'9600',_0x4b30('0x9'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x4b30('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x4b30('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4b30('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4b30('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4b30('0x2')](_0x4b30('0xc'),_0x4b30('0xd'),_0x4b30('0xe'),'KHOMP'),'defaultValue':_0x4b30('0xc')},'key':{'type':Sequelize[_0x4b30('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4b30('0xf')],'defaultValue':function(){return _0x4b30('0x10');}},'notificationSound':{'type':Sequelize[_0x4b30('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4b30('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4b30('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4b30('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4b30('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4b30('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4b30('0x11')],'defaultValue':![],'comment':_0x4b30('0x12'),'set':function(_0x4d0d4b){if(!_0x4d0d4b)this[_0x4b30('0x13')]('mandatoryDispositionPauseId',null);this[_0x4b30('0x13')](_0x4b30('0x14'),_0x4d0d4b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8364d9b..e0d1720 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 _0x94b1=['color','addApplications','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','from-voip-provider','app','description','Fax\x20Extension','push','Answer','Set','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','/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','bulkCreate','omit','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','Contacts','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','save','update','destroy','FaxAccounts','UserProfileResource','stack','index','Pause','mandatoryDispositionPause','map','FaxAccount','type','key','model','query','filters','intersection','length','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','include','rows','show','keys','attributes','fields','create','get','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','rawAttributes','hasOwnProperty','pick','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','internal','Tag','Tags'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x94b1,0x102));var _0x194b=function(_0x24b6d1,_0x21092d){_0x24b6d1=_0x24b6d1-0x0;var _0x2e305e=_0x94b1[_0x24b6d1];return _0x2e305e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x194b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x194b('0x1'));var jsonpatch=require(_0x194b('0x2'));var rp=require(_0x194b('0x3'));var moment=require('moment');var BPromise=require(_0x194b('0x4'));var Mustache=require(_0x194b('0x5'));var util=require(_0x194b('0x6'));var path=require(_0x194b('0x7'));var sox=require('sox');var csv=require(_0x194b('0x8'));var ejs=require(_0x194b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x194b('0xa'));var crypto=require(_0x194b('0xb'));var jsforce=require(_0x194b('0xc'));var deskjs=require(_0x194b('0xd'));var toCsv=require(_0x194b('0x8'));var querystring=require(_0x194b('0xe'));var Papa=require(_0x194b('0xf'));var Redis=require(_0x194b('0x10'));var authService=require(_0x194b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x194b('0x12'));var hardwareService=require(_0x194b('0x13'));var logger=require(_0x194b('0x14'))('api');var utils=require(_0x194b('0x15'));var config=require(_0x194b('0x16'));var licenseUtil=require(_0x194b('0x17'));var db=require(_0x194b('0x18'))['db'];config[_0x194b('0x19')]=_[_0x194b('0x1a')](config[_0x194b('0x19')],{'host':_0x194b('0x1b'),'port':0x18eb});var socket=require(_0x194b('0x1c'))(new Redis(config[_0x194b('0x19')]));require(_0x194b('0x1d'))[_0x194b('0x1e')](socket);var jayson=require(_0x194b('0x1f'));var client=jayson[_0x194b('0x20')][_0x194b('0x21')]({'port':0x232c});var client9002=jayson[_0x194b('0x20')][_0x194b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x15e7de,_0x383579,_0x439658,_0x21649e){return new BPromise(function(_0x4a115a,_0x487844){var _0x2c665a=_0x21649e||client;return _0x2c665a[_0x194b('0x22')](_0x15e7de,_0x439658)[_0x194b('0x23')](function(_0x4521e6){logger[_0x194b('0x24')](_0x194b('0x25'),_0x383579,_0x194b('0x26'));logger[_0x194b('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x383579,_0x194b('0x26'),JSON['stringify'](_0x4521e6));if(_0x4521e6[_0x194b('0x28')]){if(_0x4521e6[_0x194b('0x28')][_0x194b('0x29')]===0x1f4){logger[_0x194b('0x28')](_0x194b('0x25'),_0x383579,_0x4521e6[_0x194b('0x28')][_0x194b('0x2a')]);return _0x487844(_0x4521e6['error'][_0x194b('0x2a')]);}logger['error'](_0x194b('0x25'),_0x383579,_0x4521e6[_0x194b('0x28')][_0x194b('0x2a')]);return _0x4a115a(_0x4521e6[_0x194b('0x28')][_0x194b('0x2a')]);}else{logger[_0x194b('0x24')](_0x194b('0x25'),_0x383579,'request\x20sent');_0x4a115a(_0x4521e6[_0x194b('0x2b')][_0x194b('0x2a')]);}})[_0x194b('0x2c')](function(_0x1fa11d){logger[_0x194b('0x28')](_0x194b('0x25'),_0x383579,_0x1fa11d);_0x487844(_0x1fa11d);});});}function respondWithStatusCode(_0x9c08a7,_0x1f3d2c){_0x1f3d2c=_0x1f3d2c||0xcc;return function(_0x15a865){if(_0x15a865){return _0x9c08a7[_0x194b('0x2d')](_0x1f3d2c);}return _0x9c08a7[_0x194b('0x2e')](_0x1f3d2c)[_0x194b('0x2f')]();};}function respondWithResult(_0x3173e8,_0x21d397){_0x21d397=_0x21d397||0xc8;return function(_0x29ffd1){if(_0x29ffd1){return _0x3173e8[_0x194b('0x2e')](_0x21d397)[_0x194b('0x30')](_0x29ffd1);}};}function respondWithFilteredResult(_0x15da96,_0x26137a){return function(_0x8d6483){if(_0x8d6483){var _0x34f52d=_0x8d6483[_0x194b('0x31')],_0x59d2a8=_0x26137a['offset'],_0x44fffc=_0x26137a['offset']+_0x26137a[_0x194b('0x32')],_0x1182fd;if(_0x44fffc>=_0x34f52d){_0x44fffc=_0x34f52d;_0x1182fd=0xc8;}else{_0x1182fd=0xce;}_0x15da96[_0x194b('0x2e')](_0x1182fd);return _0x15da96[_0x194b('0x33')](_0x194b('0x34'),_0x59d2a8+'-'+_0x44fffc+'/'+_0x34f52d)['json'](_0x8d6483);}return null;};}function patchUpdates(_0x251058){return function(_0x342f93){try{jsonpatch[_0x194b('0x35')](_0x342f93,_0x251058,!![]);}catch(_0x4a5a0e){return BPromise['reject'](_0x4a5a0e);}return _0x342f93[_0x194b('0x36')]();};}function saveUpdates(_0x1fc9ed,_0x45bb82){return function(_0x472c36){if(_0x472c36){return _0x472c36[_0x194b('0x37')](_0x1fc9ed)[_0x194b('0x23')](function(_0x42e2f1){return _0x42e2f1;});}return null;};}function removeEntity(_0x29cd78,_0x21915b){return function(_0x3f3f62){if(_0x3f3f62){return _0x3f3f62[_0x194b('0x38')]()['then'](function(){var _0xf4c85b=_0x3f3f62['get']({'plain':!![]});var _0x161192=_0x194b('0x39');return db[_0x194b('0x3a')][_0x194b('0x38')]({'where':{'type':_0x161192,'resourceId':_0xf4c85b['id']}})['then'](function(){return _0x3f3f62;});})['then'](function(){_0x29cd78['status'](0xcc)[_0x194b('0x2f')]();});}};}function handleEntityNotFound(_0x20e629,_0x195a48){return function(_0x5cf69e){if(!_0x5cf69e){_0x20e629[_0x194b('0x2d')](0x194);}return _0x5cf69e;};}function handleError(_0x367c04,_0x4cef3d){_0x4cef3d=_0x4cef3d||0x1f4;return function(_0x4388ac){logger[_0x194b('0x28')](_0x4388ac[_0x194b('0x3b')]);if(_0x4388ac['name']){delete _0x4388ac['name'];}_0x367c04[_0x194b('0x2e')](_0x4cef3d)['send'](_0x4388ac);};}exports[_0x194b('0x3c')]=function(_0x176730,_0x432926){var _0x20ffbb={'include':[{'model':db[_0x194b('0x3d')],'as':_0x194b('0x3e')}]},_0x9608ea={},_0x1228c2={'count':0x0,'rows':[]};var _0x5f2844=_[_0x194b('0x3f')](db[_0x194b('0x40')]['rawAttributes'],function(_0x23e1a7){return{'name':_0x23e1a7['fieldName'],'type':_0x23e1a7[_0x194b('0x41')][_0x194b('0x42')]};});_0x9608ea[_0x194b('0x43')]=_[_0x194b('0x3f')](_0x5f2844,'name');_0x9608ea['query']=_['keys'](_0x176730[_0x194b('0x44')]);_0x9608ea[_0x194b('0x45')]=_[_0x194b('0x46')](_0x9608ea['model'],_0x9608ea[_0x194b('0x44')]);_0x20ffbb['attributes']=_['intersection'](_0x9608ea[_0x194b('0x43')],qs['fields'](_0x176730[_0x194b('0x44')]['fields']));_0x20ffbb['attributes']=_0x20ffbb['attributes'][_0x194b('0x47')]?_0x20ffbb['attributes']:_0x9608ea[_0x194b('0x43')];if(!_0x176730[_0x194b('0x44')]['hasOwnProperty'](_0x194b('0x48'))){_0x20ffbb[_0x194b('0x32')]=qs[_0x194b('0x32')](_0x176730[_0x194b('0x44')][_0x194b('0x32')]);_0x20ffbb[_0x194b('0x49')]=qs[_0x194b('0x49')](_0x176730['query'][_0x194b('0x49')]);}_0x20ffbb[_0x194b('0x4a')]=qs[_0x194b('0x4b')](_0x176730[_0x194b('0x44')][_0x194b('0x4b')]);_0x20ffbb[_0x194b('0x4c')]=qs['filters'](_['pick'](_0x176730[_0x194b('0x44')],_0x9608ea[_0x194b('0x45')]),_0x5f2844);if(_0x176730[_0x194b('0x44')][_0x194b('0x4d')]){_0x20ffbb[_0x194b('0x4c')]=_[_0x194b('0x4e')](_0x20ffbb[_0x194b('0x4c')],{'$or':_['map'](_0x5f2844,function(_0x117073){if(_0x117073[_0x194b('0x41')]!==_0x194b('0x4f')){var _0x4d7180={};_0x4d7180[_0x117073[_0x194b('0x50')]]={'$like':'%'+_0x176730[_0x194b('0x44')][_0x194b('0x4d')]+'%'};return _0x4d7180;}})});}_0x20ffbb=_['merge']({},_0x20ffbb,_0x176730[_0x194b('0x51')]);var _0x4a7c83={'where':_0x20ffbb['where']};return db['FaxAccount'][_0x194b('0x31')](_0x4a7c83)[_0x194b('0x23')](function(_0x126a39){_0x1228c2[_0x194b('0x31')]=_0x126a39;if(_0x176730['query'][_0x194b('0x52')]){_0x20ffbb[_0x194b('0x53')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x20ffbb);})[_0x194b('0x23')](function(_0x3a8349){_0x1228c2[_0x194b('0x54')]=_0x3a8349;return _0x1228c2;})[_0x194b('0x23')](respondWithFilteredResult(_0x432926,_0x20ffbb))[_0x194b('0x2c')](handleError(_0x432926,null));};exports[_0x194b('0x55')]=function(_0x23575c,_0x12b448){var _0x2d0cc3={'raw':![],'where':{'id':_0x23575c['params']['id']},'include':[{'model':db[_0x194b('0x3d')],'as':_0x194b('0x3e')}]},_0x32d30a={};_0x32d30a[_0x194b('0x43')]=_['keys'](db[_0x194b('0x40')]['rawAttributes']);_0x32d30a[_0x194b('0x44')]=_[_0x194b('0x56')](_0x23575c[_0x194b('0x44')]);_0x32d30a[_0x194b('0x45')]=_[_0x194b('0x46')](_0x32d30a['model'],_0x32d30a[_0x194b('0x44')]);_0x2d0cc3[_0x194b('0x57')]=_[_0x194b('0x46')](_0x32d30a[_0x194b('0x43')],qs[_0x194b('0x58')](_0x23575c[_0x194b('0x44')]['fields']));_0x2d0cc3[_0x194b('0x57')]=_0x2d0cc3['attributes']['length']?_0x2d0cc3[_0x194b('0x57')]:_0x32d30a[_0x194b('0x43')];if(_0x23575c[_0x194b('0x44')]['includeAll']){_0x2d0cc3['include']=[{'all':!![]}];}_0x2d0cc3=_['merge']({},_0x2d0cc3,_0x23575c[_0x194b('0x51')]);return db[_0x194b('0x40')]['find'](_0x2d0cc3)[_0x194b('0x23')](handleEntityNotFound(_0x12b448,null))[_0x194b('0x23')](respondWithResult(_0x12b448,null))[_0x194b('0x2c')](handleError(_0x12b448,null));};exports[_0x194b('0x59')]=function(_0x516da1,_0x22e962){return db[_0x194b('0x40')][_0x194b('0x59')](_0x516da1['body'],{})[_0x194b('0x23')](function(_0x585404){var _0x435c6a=_0x516da1['user'][_0x194b('0x5a')]({'plain':!![]});if(!_0x435c6a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x435c6a[_0x194b('0x5b')]===_0x194b('0x5c')){var _0x2a8935=_0x585404[_0x194b('0x5a')]({'plain':!![]});var _0x33d65d='FaxAccounts';return db[_0x194b('0x5d')]['find']({'where':{'name':_0x33d65d,'userProfileId':_0x435c6a[_0x194b('0x5e')]},'raw':!![]})[_0x194b('0x23')](function(_0x34a411){if(_0x34a411&&_0x34a411['autoAssociation']===0x0){return db[_0x194b('0x3a')][_0x194b('0x59')]({'name':_0x2a8935[_0x194b('0x50')],'resourceId':_0x2a8935['id'],'type':_0x34a411[_0x194b('0x50')],'sectionId':_0x34a411['id']},{})['then'](function(){return _0x585404;});}else{return _0x585404;}})[_0x194b('0x2c')](function(_0x532bf0){logger[_0x194b('0x28')](_0x194b('0x5f'),_0x532bf0);throw _0x532bf0;});}return _0x585404;})[_0x194b('0x23')](respondWithResult(_0x22e962,0xc9))[_0x194b('0x2c')](handleError(_0x22e962,null));};exports['update']=function(_0x4dc76d,_0x5314ec){if(_0x4dc76d[_0x194b('0x60')]['id']){delete _0x4dc76d[_0x194b('0x60')]['id'];}return db[_0x194b('0x40')][_0x194b('0x61')]({'where':{'id':_0x4dc76d[_0x194b('0x62')]['id']},'include':[{'model':db[_0x194b('0x3d')],'as':_0x194b('0x3e')}]})[_0x194b('0x23')](handleEntityNotFound(_0x5314ec,null))[_0x194b('0x23')](saveUpdates(_0x4dc76d[_0x194b('0x60')],null))[_0x194b('0x23')](respondWithResult(_0x5314ec,null))['catch'](handleError(_0x5314ec,null));};exports[_0x194b('0x38')]=function(_0x4c9733,_0x2781bb){return db[_0x194b('0x40')]['find']({'where':{'id':_0x4c9733[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x2781bb,null))[_0x194b('0x23')](removeEntity(_0x2781bb,null))[_0x194b('0x2c')](handleError(_0x2781bb,null));};exports[_0x194b('0x63')]=function(_0x2c3d29,_0x5c0b3e){return db[_0x194b('0x40')][_0x194b('0x63')]()[_0x194b('0x23')](respondWithResult(_0x5c0b3e,null))[_0x194b('0x2c')](handleError(_0x5c0b3e,null));};exports[_0x194b('0x64')]=function(_0x8180d,_0x58fee7,_0x72ab4f){if(_0x8180d['body']['id']){delete _0x8180d['body']['id'];}return db['FaxAccount'][_0x194b('0x61')]({'where':{'id':_0x8180d[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x58fee7,null))[_0x194b('0x23')](function(_0x50be7e){if(_0x50be7e){_0x8180d[_0x194b('0x60')][_0x194b('0x65')]=_0x50be7e['id'];return db[_0x194b('0x66')][_0x194b('0x59')](_0x8180d[_0x194b('0x60')]);}})['then'](respondWithResult(_0x58fee7,null))[_0x194b('0x2c')](handleError(_0x58fee7,null));};exports[_0x194b('0x67')]=function(_0x751c2,_0x6d004,_0x218940){var _0x1f3cc2={'raw':![],'where':{}};var _0x4cd288={};var _0x16ad56={'count':0x0,'rows':[]};return db['FaxAccount'][_0x194b('0x68')]({'where':{'id':_0x751c2[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x6d004,null))[_0x194b('0x23')](function(_0x1a3128){if(_0x1a3128){_0x4cd288[_0x194b('0x43')]=_['keys'](db[_0x194b('0x66')][_0x194b('0x69')]);_0x4cd288[_0x194b('0x44')]=_[_0x194b('0x56')](_0x751c2['query']);_0x4cd288[_0x194b('0x45')]=_[_0x194b('0x46')](_0x4cd288['model'],_0x4cd288[_0x194b('0x44')]);_0x1f3cc2[_0x194b('0x57')]=_[_0x194b('0x46')](_0x4cd288[_0x194b('0x43')],qs[_0x194b('0x58')](_0x751c2[_0x194b('0x44')][_0x194b('0x58')]));_0x1f3cc2['attributes']=_0x1f3cc2[_0x194b('0x57')][_0x194b('0x47')]?_0x1f3cc2['attributes']:_0x4cd288[_0x194b('0x43')];if(!_0x751c2[_0x194b('0x44')][_0x194b('0x6a')](_0x194b('0x48'))){_0x1f3cc2[_0x194b('0x32')]=qs['limit'](_0x751c2[_0x194b('0x44')][_0x194b('0x32')]);_0x1f3cc2[_0x194b('0x49')]=qs[_0x194b('0x49')](_0x751c2[_0x194b('0x44')]['offset']);}_0x1f3cc2['order']=qs[_0x194b('0x4b')](_0x751c2[_0x194b('0x44')]['sort']);_0x1f3cc2['where']=qs[_0x194b('0x45')](_[_0x194b('0x6b')](_0x751c2[_0x194b('0x44')],_0x4cd288['filters']));_0x1f3cc2[_0x194b('0x4c')][_0x194b('0x65')]=_0x1a3128['id'];if(_0x751c2[_0x194b('0x44')]['filter']){_0x1f3cc2['where']=_['merge'](_0x1f3cc2['where'],{'$or':_[_0x194b('0x3f')](_0x1f3cc2[_0x194b('0x57')],function(_0x5a4ee4){var _0x51002e={};_0x51002e[_0x5a4ee4]={'$like':'%'+_0x751c2[_0x194b('0x44')][_0x194b('0x4d')]+'%'};return _0x51002e;})});}_0x1f3cc2=_[_0x194b('0x4e')]({},_0x1f3cc2,_0x751c2[_0x194b('0x51')]);return db[_0x194b('0x66')][_0x194b('0x31')]({'where':_0x1f3cc2[_0x194b('0x4c')]})[_0x194b('0x23')](function(_0x261d40){_0x16ad56[_0x194b('0x31')]=_0x261d40;if(_0x751c2['query']['includeAll']){_0x1f3cc2[_0x194b('0x53')]=[{'all':!![]}];}return db[_0x194b('0x66')][_0x194b('0x6c')](_0x1f3cc2);})[_0x194b('0x23')](function(_0x1fc483){_0x16ad56[_0x194b('0x54')]=_0x1fc483;return _0x16ad56;});}})[_0x194b('0x23')](respondWithFilteredResult(_0x6d004,_0x1f3cc2))[_0x194b('0x2c')](handleError(_0x6d004,null));};exports[_0x194b('0x6d')]=function(_0x3157c2,_0x188a18,_0x97d9ea){return db[_0x194b('0x40')][_0x194b('0x61')]({'where':{'id':_0x3157c2['params']['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x188a18,null))['then'](function(_0x3aa213){if(_0x3aa213){return _0x3aa213[_0x194b('0x6d')](_0x3157c2['query'][_0x194b('0x6e')]);}})['then'](respondWithStatusCode(_0x188a18,null))[_0x194b('0x2c')](handleError(_0x188a18,null));};exports['addAnswer']=function(_0x1974be,_0x1ad66d,_0x2863ad){if(_0x1974be[_0x194b('0x60')]['id']){delete _0x1974be[_0x194b('0x60')]['id'];}return db[_0x194b('0x40')][_0x194b('0x61')]({'where':{'id':_0x1974be[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x1ad66d,null))[_0x194b('0x23')](function(_0x4c7ad6){if(_0x4c7ad6){_0x1974be[_0x194b('0x60')]['FaxAccountId']=_0x4c7ad6['id'];return db['CannedAnswer'][_0x194b('0x59')](_0x1974be['body']);}})['then'](respondWithResult(_0x1ad66d,null))[_0x194b('0x2c')](handleError(_0x1ad66d,null));};exports[_0x194b('0x6f')]=function(_0x447d45,_0x2f8271,_0x55e99f){var _0x49fc58={'raw':![],'where':{}};var _0x139c07={};var _0x3d96f0={'count':0x0,'rows':[]};return db[_0x194b('0x40')][_0x194b('0x68')]({'where':{'id':_0x447d45[_0x194b('0x62')]['id']}})['then'](handleEntityNotFound(_0x2f8271,null))[_0x194b('0x23')](function(_0x261abe){if(_0x261abe){_0x139c07[_0x194b('0x43')]=_[_0x194b('0x56')](db[_0x194b('0x70')]['rawAttributes']);_0x139c07[_0x194b('0x44')]=_[_0x194b('0x56')](_0x447d45[_0x194b('0x44')]);_0x139c07[_0x194b('0x45')]=_[_0x194b('0x46')](_0x139c07[_0x194b('0x43')],_0x139c07[_0x194b('0x44')]);_0x49fc58[_0x194b('0x57')]=_[_0x194b('0x46')](_0x139c07[_0x194b('0x43')],qs[_0x194b('0x58')](_0x447d45[_0x194b('0x44')][_0x194b('0x58')]));_0x49fc58[_0x194b('0x57')]=_0x49fc58['attributes']['length']?_0x49fc58[_0x194b('0x57')]:_0x139c07[_0x194b('0x43')];if(!_0x447d45[_0x194b('0x44')][_0x194b('0x6a')](_0x194b('0x48'))){_0x49fc58[_0x194b('0x32')]=qs['limit'](_0x447d45[_0x194b('0x44')][_0x194b('0x32')]);_0x49fc58[_0x194b('0x49')]=qs['offset'](_0x447d45[_0x194b('0x44')][_0x194b('0x49')]);}_0x49fc58[_0x194b('0x4a')]=qs[_0x194b('0x4b')](_0x447d45[_0x194b('0x44')][_0x194b('0x4b')]);_0x49fc58[_0x194b('0x4c')]=qs[_0x194b('0x45')](_[_0x194b('0x6b')](_0x447d45[_0x194b('0x44')],_0x139c07[_0x194b('0x45')]));_0x49fc58[_0x194b('0x4c')][_0x194b('0x65')]=_0x261abe['id'];if(_0x447d45[_0x194b('0x44')][_0x194b('0x4d')]){_0x49fc58[_0x194b('0x4c')]=_[_0x194b('0x4e')](_0x49fc58['where'],{'$or':_['map'](_0x49fc58[_0x194b('0x57')],function(_0x1407e2){var _0x5ebf2d={};_0x5ebf2d[_0x1407e2]={'$like':'%'+_0x447d45[_0x194b('0x44')][_0x194b('0x4d')]+'%'};return _0x5ebf2d;})});}_0x49fc58=_[_0x194b('0x4e')]({},_0x49fc58,_0x447d45[_0x194b('0x51')]);return db[_0x194b('0x70')][_0x194b('0x31')]({'where':_0x49fc58['where']})[_0x194b('0x23')](function(_0x3c73b1){_0x3d96f0[_0x194b('0x31')]=_0x3c73b1;if(_0x447d45[_0x194b('0x44')]['includeAll']){_0x49fc58[_0x194b('0x53')]=[{'all':!![]}];}return db[_0x194b('0x70')]['findAll'](_0x49fc58);})[_0x194b('0x23')](function(_0x5736c8){_0x3d96f0[_0x194b('0x54')]=_0x5736c8;return _0x3d96f0;});}})[_0x194b('0x23')](respondWithFilteredResult(_0x2f8271,_0x49fc58))[_0x194b('0x2c')](handleError(_0x2f8271,null));};exports[_0x194b('0x71')]=function(_0x21c7ae,_0x9ed846,_0x330064){return db[_0x194b('0x40')][_0x194b('0x61')]({'where':{'id':_0x21c7ae[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x9ed846,null))[_0x194b('0x23')](function(_0x1d1d49){if(_0x1d1d49){return _0x1d1d49[_0x194b('0x71')](_0x21c7ae[_0x194b('0x44')][_0x194b('0x6e')]);}})[_0x194b('0x23')](respondWithStatusCode(_0x9ed846,null))['catch'](handleError(_0x9ed846,null));};exports[_0x194b('0x72')]=function(_0x3255ed,_0x4a195c,_0x5f5100){return db[_0x194b('0x73')][_0x194b('0x61')]({'where':{'id':_0x3255ed['params']['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x4a195c,null))[_0x194b('0x23')](function(_0x3e3854){if(_0x3e3854){return _0x3e3854[_0x194b('0x72')](_0x3255ed[_0x194b('0x60')][_0x194b('0x6e')],_['omit'](_0x3255ed['body'],['ids','id'])||{});}})[_0x194b('0x23')](respondWithResult(_0x4a195c,null))['catch'](handleError(_0x4a195c,null));};exports[_0x194b('0x74')]=function(_0xc7a087,_0x4b63a9,_0x41bd23){var _0x2b52d4={'raw':![],'where':{}};var _0x161717={};var _0x1100ac={'count':0x0,'rows':[]};return db[_0x194b('0x40')]['findOne']({'where':{'id':_0xc7a087[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x4b63a9,null))[_0x194b('0x23')](function(_0x13bc1a){if(_0x13bc1a){_0x161717[_0x194b('0x43')]=_[_0x194b('0x56')](db[_0x194b('0x73')][_0x194b('0x69')]);_0x161717[_0x194b('0x44')]=_[_0x194b('0x56')](_0xc7a087[_0x194b('0x44')]);_0x161717['filters']=_['intersection'](_0x161717[_0x194b('0x43')],_0x161717[_0x194b('0x44')]);_0x2b52d4[_0x194b('0x57')]=_[_0x194b('0x46')](_0x161717[_0x194b('0x43')],qs[_0x194b('0x58')](_0xc7a087['query'][_0x194b('0x58')]));_0x2b52d4['attributes']=_0x2b52d4['attributes'][_0x194b('0x47')]?_0x2b52d4[_0x194b('0x57')]:_0x161717[_0x194b('0x43')];if(!_0xc7a087[_0x194b('0x44')][_0x194b('0x6a')](_0x194b('0x48'))){_0x2b52d4[_0x194b('0x32')]=qs['limit'](_0xc7a087[_0x194b('0x44')][_0x194b('0x32')]);_0x2b52d4[_0x194b('0x49')]=qs['offset'](_0xc7a087[_0x194b('0x44')][_0x194b('0x49')]);}_0x2b52d4[_0x194b('0x4a')]=qs[_0x194b('0x4b')](_0xc7a087[_0x194b('0x44')]['sort']);_0x2b52d4[_0x194b('0x4c')]=qs[_0x194b('0x45')](_['pick'](_0xc7a087[_0x194b('0x44')],_0x161717[_0x194b('0x45')]));_0x2b52d4[_0x194b('0x4c')][_0x194b('0x65')]=_0x13bc1a['id'];if(_0xc7a087[_0x194b('0x44')][_0x194b('0x4d')]){_0x2b52d4[_0x194b('0x4c')]=_[_0x194b('0x4e')](_0x2b52d4[_0x194b('0x4c')],{'$or':_[_0x194b('0x3f')](_0x2b52d4[_0x194b('0x57')],function(_0x4d5a5b){var _0x89ec55={};_0x89ec55[_0x4d5a5b]={'$like':'%'+_0xc7a087['query'][_0x194b('0x4d')]+'%'};return _0x89ec55;})});}_0x2b52d4=_['merge']({},_0x2b52d4,_0xc7a087[_0x194b('0x51')]);return db[_0x194b('0x73')][_0x194b('0x31')]({'where':_0x2b52d4[_0x194b('0x4c')]})[_0x194b('0x23')](function(_0x52a490){_0x1100ac['count']=_0x52a490;if(_0xc7a087[_0x194b('0x44')][_0x194b('0x52')]){_0x2b52d4[_0x194b('0x53')]=[{'model':db['CmContact'],'as':_0x194b('0x75'),'required':![]},{'model':db[_0x194b('0x76')],'as':'Owner','attributes':[_0x194b('0x50'),'fullname',_0x194b('0x77')],'required':![]},{'model':db[_0x194b('0x78')],'as':_0x194b('0x79'),'attributes':['id',_0x194b('0x50'),_0x194b('0x7a')],'where':_0xc7a087[_0x194b('0x44')]['tag']?{'id':_0xc7a087[_0x194b('0x44')]['tag']}:undefined,'required':_0xc7a087[_0x194b('0x44')]['tag']?!![]:![]}];}return db[_0x194b('0x73')][_0x194b('0x6c')](_0x2b52d4);})[_0x194b('0x23')](function(_0x327238){_0x1100ac[_0x194b('0x54')]=_0x327238;return _0x1100ac;});}})[_0x194b('0x23')](respondWithFilteredResult(_0x4b63a9,_0x2b52d4))['catch'](handleError(_0x4b63a9,null));};exports[_0x194b('0x7b')]=function(_0x53800e,_0x3bffa6,_0x576d7b){return db[_0x194b('0x40')][_0x194b('0x68')]({'where':{'id':_0x53800e['params']['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x3bffa6,null))[_0x194b('0x23')](function(_0x51fc5e){if(_0x51fc5e){return db[_0x194b('0x7c')][_0x194b('0x7d')](function(_0x4bcf88){return db['FaxApplication']['destroy']({'where':{'FaxAccountId':_0x53800e[_0x194b('0x62')]['id']},'transaction':_0x4bcf88})[_0x194b('0x23')](function(_0x3eaff1){var _0x1fe4c8=_[_0x194b('0x3f')](_0x53800e['body'],function(_0x156af3){_0x156af3[_0x194b('0x65')]=_0x53800e['params']['id'];return _0x156af3;});return db[_0x194b('0x7e')]['bulkCreate'](_0x1fe4c8,{'transaction':_0x4bcf88});});})['then'](function(){return db[_0x194b('0x7e')][_0x194b('0x7f')]({'where':{'FaxAccountId':_0x53800e['params']['id']},'order':_0x194b('0x80')});});}})[_0x194b('0x23')](respondWithResult(_0x3bffa6,null))[_0x194b('0x2c')](handleError(_0x3bffa6,null));};exports[_0x194b('0x81')]=function(_0x138d88,_0x860bc6,_0x429867){var _0x43509a={};var _0x454bf8={};var _0x598168;var _0xa6b164;return db[_0x194b('0x40')][_0x194b('0x68')]({'where':{'id':_0x138d88[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x860bc6,null))[_0x194b('0x23')](function(_0x37ce08){if(_0x37ce08){_0x598168=_0x37ce08;_0x454bf8[_0x194b('0x43')]=_['keys'](db[_0x194b('0x7e')][_0x194b('0x69')]);_0x454bf8['query']=_[_0x194b('0x56')](_0x138d88['query']);_0x454bf8[_0x194b('0x45')]=_[_0x194b('0x46')](_0x454bf8['model'],_0x454bf8[_0x194b('0x44')]);_0x43509a[_0x194b('0x57')]=_[_0x194b('0x46')](_0x454bf8[_0x194b('0x43')],qs['fields'](_0x138d88[_0x194b('0x44')]['fields']));_0x43509a[_0x194b('0x57')]=_0x43509a[_0x194b('0x57')][_0x194b('0x47')]?_0x43509a[_0x194b('0x57')]:_0x454bf8[_0x194b('0x43')];_0x43509a[_0x194b('0x4a')]=qs[_0x194b('0x4b')](_0x138d88[_0x194b('0x44')][_0x194b('0x4b')]);_0x43509a['where']=qs['filters'](_[_0x194b('0x6b')](_0x138d88[_0x194b('0x44')],_0x454bf8['filters']));if(_0x138d88[_0x194b('0x44')][_0x194b('0x4d')]){_0x43509a[_0x194b('0x4c')]=_[_0x194b('0x4e')](_0x43509a[_0x194b('0x4c')],{'$or':_[_0x194b('0x3f')](_0x43509a[_0x194b('0x57')],function(_0x54b8a7){var _0x1c857f={};_0x1c857f[_0x54b8a7]={'$like':'%'+_0x138d88[_0x194b('0x44')][_0x194b('0x4d')]+'%'};return _0x1c857f;})});}_0x43509a=_[_0x194b('0x4e')]({},_0x43509a,_0x138d88[_0x194b('0x51')]);return _0x598168['getApplications'](_0x43509a);}})[_0x194b('0x23')](function(_0x5f0282){if(_0x5f0282){_0xa6b164=_0x5f0282[_0x194b('0x47')];if(!_0x138d88['query'][_0x194b('0x6a')]('nolimit')){_0x43509a['limit']=qs[_0x194b('0x32')](_0x138d88[_0x194b('0x44')][_0x194b('0x32')]);_0x43509a[_0x194b('0x49')]=qs[_0x194b('0x49')](_0x138d88[_0x194b('0x44')]['offset']);}return _0x598168['getApplications'](_0x43509a);}})[_0x194b('0x23')](function(_0xbacd12){if(_0xbacd12){return _0xbacd12?{'count':_0xa6b164,'rows':_0xbacd12}:null;}})[_0x194b('0x23')](respondWithResult(_0x860bc6,null))[_0x194b('0x2c')](handleError(_0x860bc6,null));};function Extension(_0x6b3155,_0x55ca74,_0xf2456a,_0x2f278b){this['context']=_0x194b('0x82');this['exten']=_0x6b3155['localstationid'];this[_0x194b('0x83')]=_0x2f278b;this[_0x194b('0x41')]='system';this[_0x194b('0x84')]=_0x194b('0x85');this['FaxAccountId']=_0x6b3155['id'];this[_0x194b('0x80')]=_0x55ca74;this['appdata']=_0xf2456a;}function createExtensionsReciveFax(_0x78545e){var _0x2c2238=0x1;var _0x4402cc=[];_0x4402cc[_0x194b('0x86')](new Extension(_0x78545e,_0x2c2238,'',_0x194b('0x87')));_0x2c2238+=0x1;_0x4402cc[_0x194b('0x86')](new Extension(_0x78545e,_0x2c2238,'CDR(type)=inbound-fax',_0x194b('0x88')));_0x2c2238+=0x1;for(var _0x1c1746 in _0x78545e){if(_0x78545e[_0x194b('0x6a')](_0x1c1746)&&(_0x1c1746==='ecm'||_0x1c1746===_0x194b('0x89')||_0x1c1746===_0x194b('0x8a')||_0x1c1746===_0x194b('0x8b')||_0x1c1746===_0x194b('0x8c')||_0x1c1746===_0x194b('0x8d')||_0x1c1746===_0x194b('0x8e')||_0x1c1746==='modem'||_0x1c1746==='t38timeout')){_0x4402cc['push'](new Extension(_0x78545e,_0x2c2238,'FAXOPT('+_0x1c1746+')='+_0x78545e[_0x1c1746],_0x194b('0x88')));_0x2c2238+=0x1;}}_0x4402cc[_0x194b('0x86')](new Extension(_0x78545e,_0x2c2238,'6','Wait'));_0x2c2238+=0x1;_0x4402cc[_0x194b('0x86')](new Extension(_0x78545e,_0x2c2238,_0x194b('0x8f'),_0x194b('0x90')));_0x2c2238=0x0;return _0x4402cc;}exports['addAccountApplications']=function(_0x2de85b,_0x2163cd,_0x43db97){var _0x37c462;return db[_0x194b('0x7c')][_0x194b('0x7d')](function(_0x3b78c0){return db[_0x194b('0x40')][_0x194b('0x59')](_0x2de85b[_0x194b('0x60')],{'transaction':_0x3b78c0})['then'](function(_0x36b88b){_0x37c462=_0x36b88b[_0x194b('0x5a')]({'plain':!![]});return db[_0x194b('0x91')][_0x194b('0x92')](createExtensionsReciveFax(_0x37c462),{'transaction':_0x3b78c0});});})[_0x194b('0x23')](function(){return _0x37c462;})[_0x194b('0x23')](respondWithResult(_0x2163cd,null))[_0x194b('0x2c')](handleError(_0x2163cd,null));};exports['updateAccountApplications']=function(_0x4827e8,_0x196475,_0x97dd26){var _0x41ec20;return db['sequelize'][_0x194b('0x7d')](function(_0x515fdd){return db[_0x194b('0x40')][_0x194b('0x37')](_0x4827e8[_0x194b('0x60')],{'where':{'id':_0x4827e8[_0x194b('0x60')]['id']},'transaction':_0x515fdd})[_0x194b('0x23')](function(_0x508993){return db[_0x194b('0x91')]['destroy']({'where':{'FaxAccountId':_0x4827e8['body']['id']},'transaction':_0x515fdd})[_0x194b('0x23')](function(_0x1bd5a1){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x194b('0x93')](_0x4827e8['body'],['tech',_0x194b('0x42'),_0x194b('0x94'),_0x194b('0x95'),_0x194b('0x96'),_0x194b('0x97')])),{'transaction':_0x515fdd});});});})['then'](function(){return db[_0x194b('0x40')][_0x194b('0x98')](_0x4827e8[_0x194b('0x60')]['id']);})['then'](respondWithResult(_0x196475,null))[_0x194b('0x2c')](handleError(_0x196475,null));};exports['getMessages']=function(_0x4f4d21,_0x5fa72f,_0x1a10b5){var _0x4b22d3={'raw':!![],'where':{}};var _0x1b1ac1={};var _0x5083f5={'count':0x0,'rows':[]};return db[_0x194b('0x40')][_0x194b('0x68')]({'where':{'id':_0x4f4d21[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x5fa72f,null))['then'](function(_0x5c8cc7){if(_0x5c8cc7){_0x1b1ac1[_0x194b('0x43')]=_['keys'](db[_0x194b('0x99')][_0x194b('0x69')]);_0x1b1ac1['query']=_[_0x194b('0x56')](_0x4f4d21[_0x194b('0x44')]);_0x1b1ac1[_0x194b('0x45')]=_['intersection'](_0x1b1ac1[_0x194b('0x43')],_0x1b1ac1['query']);_0x4b22d3[_0x194b('0x57')]=_[_0x194b('0x46')](_0x1b1ac1[_0x194b('0x43')],qs[_0x194b('0x58')](_0x4f4d21[_0x194b('0x44')][_0x194b('0x58')]));_0x4b22d3['attributes']=_0x4b22d3['attributes'][_0x194b('0x47')]?_0x4b22d3[_0x194b('0x57')]:_0x1b1ac1['model'];if(!_0x4f4d21[_0x194b('0x44')][_0x194b('0x6a')](_0x194b('0x48'))){_0x4b22d3[_0x194b('0x32')]=qs[_0x194b('0x32')](_0x4f4d21[_0x194b('0x44')][_0x194b('0x32')]);_0x4b22d3[_0x194b('0x49')]=qs[_0x194b('0x49')](_0x4f4d21[_0x194b('0x44')][_0x194b('0x49')]);}_0x4b22d3['order']=qs['sort'](_0x4f4d21['query']['sort']);_0x4b22d3['where']=qs[_0x194b('0x45')](_[_0x194b('0x6b')](_0x4f4d21[_0x194b('0x44')],_0x1b1ac1[_0x194b('0x45')]));_0x4b22d3[_0x194b('0x4c')][_0x194b('0x65')]=_0x5c8cc7['id'];if(_0x4f4d21[_0x194b('0x44')][_0x194b('0x4d')]){_0x4b22d3[_0x194b('0x4c')]=_['merge'](_0x4b22d3[_0x194b('0x4c')],{'$or':_[_0x194b('0x3f')](_0x4b22d3[_0x194b('0x57')],function(_0xe3b51b){var _0x5ad963={};_0x5ad963[_0xe3b51b]={'$like':'%'+_0x4f4d21['query'][_0x194b('0x4d')]+'%'};return _0x5ad963;})});}if(_0x4f4d21[_0x194b('0x44')][_0x194b('0x9a')]){var _0x13e179=_0x4f4d21['query'][_0x194b('0x9a')][_0x194b('0x9b')](',');var _0x4730b4={};_0x4730b4[_0x13e179[0x0]]={'$gte':moment(_0x13e179[0x1])[_0x194b('0x9c')](_0x194b('0x9d'))};_0x4b22d3[_0x194b('0x4c')]=_[_0x194b('0x4e')](_0x4b22d3[_0x194b('0x4c')],_0x4730b4);}_0x4b22d3=_['merge']({},_0x4b22d3,_0x4f4d21[_0x194b('0x51')]);return db[_0x194b('0x99')][_0x194b('0x31')]({'where':_0x4b22d3[_0x194b('0x4c')]})[_0x194b('0x23')](function(_0x3b8eaf){_0x5083f5['count']=_0x3b8eaf;if(_0x4f4d21['query'][_0x194b('0x52')]){_0x4b22d3[_0x194b('0x53')]=[{'all':!![]}];}return db[_0x194b('0x99')][_0x194b('0x6c')](_0x4b22d3);})['then'](function(_0x52664b){_0x5083f5['rows']=_0x52664b;return _0x5083f5;});}})[_0x194b('0x23')](respondWithFilteredResult(_0x5fa72f,_0x4b22d3))['catch'](handleError(_0x5fa72f,null));};exports[_0x194b('0x9e')]=function(_0x1e339d,_0x5c5748,_0x2ec226){var _0x509857,_0x28f5be={},_0x4012d2;if(_0x1e339d[_0x194b('0x60')]['to']){_0x4012d2=_0x1e339d[_0x194b('0x60')]['to'][0x0];}return db['FaxAccount'][_0x194b('0x61')]({'where':{'id':_0x1e339d[_0x194b('0x62')]['id']},'include':[{'model':db[_0x194b('0x9f')],'as':_0x194b('0xa0'),'include':[{'model':db['CmContact'],'as':_0x194b('0xa1'),'where':{'fax':_0x4012d2},'limit':0x1,'order':[[_0x194b('0x95'),_0x194b('0xa2')]]}]}]})[_0x194b('0x23')](handleEntityNotFound(_0x5c5748,null))['then'](function(_0x548b0b){_0x509857=_0x548b0b;if(_0x1e339d[_0x194b('0x60')]['attachments']&&_0x1e339d[_0x194b('0x60')][_0x194b('0xa3')][_0x194b('0x47')]){for(var _0x517d59=0x0;_0x517d59<_0x1e339d[_0x194b('0x60')][_0x194b('0xa3')]['length'];_0x517d59+=0x1){_0x1e339d[_0x194b('0x60')]['attachments'][_0x517d59]={'filename':_0x1e339d[_0x194b('0x60')][_0x194b('0xa3')][_0x517d59]['name'],'id':_0x1e339d['body']['attachments'][_0x517d59]['id'],'path':path['join'](config[_0x194b('0xa4')],_0x194b('0xa5'),_0x1e339d[_0x194b('0x60')][_0x194b('0xa3')][_0x517d59]['basename'])};}}return respondWithRpcPromise(_0x194b('0xa6'),_0x194b('0xa6'),{'FaxAccountId':_[_0x194b('0xa7')](_0x1e339d[_0x194b('0x62')]['id'])?undefined:_0x1e339d[_0x194b('0x62')]['id'],'path':_[_0x194b('0xa7')](_0x1e339d['body'][_0x194b('0xa3')][0x0]['path'])?undefined:_0x1e339d['body']['attachments'][0x0][_0x194b('0x7')],'fax':_[_0x194b('0xa7')](_0x1e339d[_0x194b('0x60')]['to'][0x0])?undefined:_0x1e339d[_0x194b('0x60')]['to'][0x0]},client9002);})[_0x194b('0x23')](function(){if(_0x509857){if(_[_0x194b('0xa7')](_0x1e339d['body'][_0x194b('0xa8')])){_0x1e339d[_0x194b('0x60')][_0x194b('0xa8')]=util[_0x194b('0x9c')](_0x194b('0xa9'),_0x509857[_0x194b('0x50')],_0x509857[_0x194b('0xaa')]);}if(_0x509857[_0x194b('0xa0')]){if(_0x509857[_0x194b('0xa0')][_0x194b('0xa1')][_0x194b('0x47')]){return _0x509857[_0x194b('0xa0')][_0x194b('0xa1')][0x0];}else{return db[_0x194b('0xab')][_0x194b('0x59')](_[_0x194b('0x1a')](_0x1e339d[_0x194b('0x60')],{'firstName':_0x1e339d[_0x194b('0x60')]['to'][0x0],'phone':_0x1e339d[_0x194b('0x60')]['to'][0x0],'fax':_0x1e339d['body']['to'][0x0],'ListId':_0x509857[_0x194b('0x97')]}));}}else{throw new Error(_0x194b('0xac'));}}else{throw new Error(_0x194b('0xad'));}})['then'](function(_0x5bc39d){if(_0x5bc39d){return db[_0x194b('0x73')][_0x194b('0x61')]({'where':{'ContactId':_0x5bc39d['id'],'closed':![],'FaxAccountId':_0x509857['id']}})['then'](function(_0x2e777e){if(_0x2e777e){return[_0x2e777e,![]];}return db['FaxInteraction'][_0x194b('0x59')]({'UserId':_0x1e339d[_0x194b('0x5c')]['id'],'ContactId':_0x5bc39d['id'],'FaxAccountId':_0x509857['id'],'fax':_0x1e339d[_0x194b('0x60')]['to'][0x0],'firstMsgDirection':_0x194b('0xae'),'Messages':[_[_0x194b('0x4e')](_0x1e339d[_0x194b('0x60')],{'read':![],'body':_0x1e339d[_0x194b('0x60')]['attachments'][0x0][_0x194b('0xaf')],'FaxAccountId':_0x509857['id'],'UserId':_0x1e339d[_0x194b('0x5c')]['id'],'ContactId':_0x5bc39d['id'],'AttachmentId':_0x1e339d[_0x194b('0x60')][_0x194b('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0x194b('0x99')],'as':_0x194b('0xb0')}]})[_0x194b('0x23')](function(_0x1e7ba8){return[_0x1e7ba8,!![]];});});}else{throw new Error(_0x194b('0xb1'));}})['spread'](function(_0x111929,_0x2d4de8){if(_0x2d4de8){return _0x111929;}return db[_0x194b('0x99')][_0x194b('0x59')]({'direction':_0x194b('0xae'),'read':![],'body':_0x1e339d[_0x194b('0x60')][_0x194b('0xa3')][0x0]['filename'],'FaxAccountId':_0x509857['id'],'FaxInteractionId':_0x111929['id'],'UserId':_0x1e339d['user']['id'],'ContactId':_0x111929[_0x194b('0xb2')],'AttachmentId':_0x1e339d[_0x194b('0x60')][_0x194b('0xa3')][0x0]['id']})[_0x194b('0x23')](function(_0x2527ed){_0x111929['dataValues'][_0x194b('0xb0')]=[];_0x111929[_0x194b('0xb3')][_0x194b('0xb0')]['push'](_0x2527ed['dataValues']);return _0x111929;});})['then'](function(_0x4a9df3){respondWithRpcPromise(_0x194b('0xb4'),'SendFax',{'FaxAccountId':_[_0x194b('0xa7')](_0x1e339d[_0x194b('0x62')]['id'])?undefined:_0x1e339d['params']['id'],'path':_[_0x194b('0xa7')](_0x1e339d['body'][_0x194b('0xa3')][0x0][_0x194b('0x7')])?undefined:_0x1e339d[_0x194b('0x60')][_0x194b('0xa3')][0x0][_0x194b('0x7')],'fax':_[_0x194b('0xa7')](_0x1e339d[_0x194b('0x60')]['to'][0x0])?undefined:_0x1e339d[_0x194b('0x60')]['to'][0x0],'AttachmentId':_0x1e339d[_0x194b('0x60')][_0x194b('0xa3')][0x0]['id']},client9002)[_0x194b('0x23')](function(_0x5e0d1b){logger[_0x194b('0x24')](_0x194b('0xb5'),_0x5e0d1b);})[_0x194b('0x2c')](function(_0x194c58){logger['info'](_0x194b('0xb5'),_0x194c58);});return _0x4a9df3;})[_0x194b('0x23')](respondWithResult(_0x5c5748,null))['catch'](handleError(_0x5c5748,null));};exports[_0x194b('0xb6')]=function(_0x2c59c5,_0x1cd5aa,_0x389b5f){return db[_0x194b('0x40')][_0x194b('0x61')]({'where':{'id':_0x2c59c5[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x1cd5aa,null))['then'](function(_0x3d1ca6){if(_0x3d1ca6){return _0x3d1ca6[_0x194b('0xb6')](_0x2c59c5[_0x194b('0x60')][_0x194b('0x6e')],_[_0x194b('0x93')](_0x2c59c5['body'],[_0x194b('0x6e'),'id'])||{})[_0x194b('0xb7')](function(_0x33fcf5){for(var _0x4cedba=0x0;_0x4cedba<_0x2c59c5[_0x194b('0x60')][_0x194b('0x6e')][_0x194b('0x47')];_0x4cedba+=0x1){socket['emit'](_0x194b('0xb8'),{'UserId':_0x2c59c5['body'][_0x194b('0x6e')][_0x4cedba],'FaxAccountId':_0x2c59c5['params']['id']});}return _0x33fcf5;});}})[_0x194b('0x23')](respondWithResult(_0x1cd5aa,null))[_0x194b('0x2c')](handleError(_0x1cd5aa,null));};exports[_0x194b('0xb9')]=function(_0xe30d81,_0x2c73fd,_0x430b62){return db[_0x194b('0x40')][_0x194b('0x61')]({'where':{'id':_0xe30d81[_0x194b('0x62')]['id']}})[_0x194b('0x23')](handleEntityNotFound(_0x2c73fd,null))[_0x194b('0x23')](function(_0x5822a0){if(_0x5822a0){return _0x5822a0[_0x194b('0xb9')](_0xe30d81[_0x194b('0x44')][_0x194b('0x6e')])[_0x194b('0x23')](function(){if(_[_0x194b('0xba')](_0xe30d81[_0x194b('0x44')]['ids'])){for(var _0x3fec77=0x0;_0x3fec77<_0xe30d81[_0x194b('0x44')]['ids'][_0x194b('0x47')];_0x3fec77+=0x1){socket['emit'](_0x194b('0xbb'),{'UserId':Number(_0xe30d81[_0x194b('0x44')][_0x194b('0x6e')][_0x3fec77]),'FaxAccountId':Number(_0xe30d81['params']['id'])});}}else{socket[_0x194b('0xbc')]('userFaxAccount:remove',{'UserId':Number(_0xe30d81['query'][_0x194b('0x6e')]),'FaxAccountId':Number(_0xe30d81['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2c73fd,null))['catch'](handleError(_0x2c73fd,null));};exports[_0x194b('0xbd')]=function(_0xdde81e,_0xcfe536,_0x432dec){var _0x2ed267={};var _0xae1264={};var _0x233d0a;var _0x754280;return db[_0x194b('0x40')][_0x194b('0x68')]({'where':{'id':_0xdde81e['params']['id']}})['then'](handleEntityNotFound(_0xcfe536,null))[_0x194b('0x23')](function(_0xbe7103){if(_0xbe7103){_0x233d0a=_0xbe7103;_0xae1264[_0x194b('0x43')]=_[_0x194b('0x56')](db['User'][_0x194b('0x69')]);_0xae1264[_0x194b('0x44')]=_[_0x194b('0x56')](_0xdde81e[_0x194b('0x44')]);_0xae1264[_0x194b('0x45')]=_[_0x194b('0x46')](_0xae1264[_0x194b('0x43')],_0xae1264[_0x194b('0x44')]);_0x2ed267[_0x194b('0x57')]=_['intersection'](_0xae1264[_0x194b('0x43')],qs[_0x194b('0x58')](_0xdde81e[_0x194b('0x44')][_0x194b('0x58')]));_0x2ed267['attributes']=_0x2ed267[_0x194b('0x57')][_0x194b('0x47')]?_0x2ed267[_0x194b('0x57')]:_0xae1264[_0x194b('0x43')];_0x2ed267['order']=qs[_0x194b('0x4b')](_0xdde81e[_0x194b('0x44')][_0x194b('0x4b')]);_0x2ed267[_0x194b('0x4c')]=qs['filters'](_[_0x194b('0x6b')](_0xdde81e['query'],_0xae1264[_0x194b('0x45')]));if(_0xdde81e[_0x194b('0x44')][_0x194b('0x4d')]){_0x2ed267[_0x194b('0x4c')]=_['merge'](_0x2ed267['where'],{'$or':_[_0x194b('0x3f')](_0x2ed267['attributes'],function(_0x411dbd){var _0x25a765={};_0x25a765[_0x411dbd]={'$like':'%'+_0xdde81e[_0x194b('0x44')][_0x194b('0x4d')]+'%'};return _0x25a765;})});}_0x2ed267=_[_0x194b('0x4e')]({},_0x2ed267,_0xdde81e[_0x194b('0x51')]);return _0x233d0a[_0x194b('0xbd')](_0x2ed267);}})[_0x194b('0x23')](function(_0xc768a3){if(_0xc768a3){_0x754280=_0xc768a3['length'];if(!_0xdde81e[_0x194b('0x44')][_0x194b('0x6a')](_0x194b('0x48'))){_0x2ed267[_0x194b('0x32')]=qs[_0x194b('0x32')](_0xdde81e[_0x194b('0x44')][_0x194b('0x32')]);_0x2ed267['offset']=qs[_0x194b('0x49')](_0xdde81e[_0x194b('0x44')]['offset']);}return _0x233d0a[_0x194b('0xbd')](_0x2ed267);}})[_0x194b('0x23')](function(_0x1b1c9d){if(_0x1b1c9d){return _0x1b1c9d?{'count':_0x754280,'rows':_0x1b1c9d}:null;}})[_0x194b('0x23')](respondWithResult(_0xcfe536,null))[_0x194b('0x2c')](handleError(_0xcfe536,null));}; \ No newline at end of file +var _0x4a9c=['\x22%s\x22\x20<%s>','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','omit','emit','removeAgents','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','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','register','client','http','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','FaxAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','type','VIRTUAL','filter','include','rows','catch','show','params','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','rawAttributes','FaxAccountId','includeAll','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','addInteraction','getInteractions','findOne','CmContact','Contact','User','fullname','Tags','color','tag','sequelize','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','CDR(type)=inbound-fax','gateway','headerinfo','maxrate','minrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','transaction','get','VoiceExtension','updateAccountApplications','tech','createdAt','findById','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','basename','CheckAfterSend','isNil','path','from','format'];(function(_0x370ba7,_0x1b9d90){var _0x1b4d27=function(_0x35c0eb){while(--_0x35c0eb){_0x370ba7['push'](_0x370ba7['shift']());}};_0x1b4d27(++_0x1b9d90);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x3500a5,_0x3719af){_0x3500a5=_0x3500a5-0x0;var _0x3ff19c=_0x4a9c[_0x3500a5];return _0x3ff19c;};'use strict';var pdf=require(_0xc4a9('0x0'));var emlformat=require(_0xc4a9('0x1'));var rimraf=require(_0xc4a9('0x2'));var zipdir=require(_0xc4a9('0x3'));var jsonpatch=require(_0xc4a9('0x4'));var rp=require(_0xc4a9('0x5'));var moment=require('moment');var BPromise=require(_0xc4a9('0x6'));var Mustache=require(_0xc4a9('0x7'));var util=require(_0xc4a9('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc4a9('0x9'));var ejs=require(_0xc4a9('0xa'));var fs=require('fs');var _=require(_0xc4a9('0xb'));var squel=require(_0xc4a9('0xc'));var crypto=require('crypto');var jsforce=require(_0xc4a9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc4a9('0xe'));var Papa=require(_0xc4a9('0xf'));var Redis=require(_0xc4a9('0x10'));var authService=require(_0xc4a9('0x11'));var qs=require(_0xc4a9('0x12'));var as=require(_0xc4a9('0x13'));var hardwareService=require(_0xc4a9('0x14'));var logger=require(_0xc4a9('0x15'))(_0xc4a9('0x16'));var utils=require(_0xc4a9('0x17'));var config=require(_0xc4a9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4a9('0x19'))['db'];config[_0xc4a9('0x1a')]=_[_0xc4a9('0x1b')](config['redis'],{'host':_0xc4a9('0x1c'),'port':0x18eb});var socket=require(_0xc4a9('0x1d'))(new Redis(config['redis']));require('./faxAccount.socket')[_0xc4a9('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc4a9('0x1f')][_0xc4a9('0x20')]({'port':0x232c});var client9002=jayson[_0xc4a9('0x1f')][_0xc4a9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5b16d3,_0x51d842,_0xaaecf0,_0x585f41){return new BPromise(function(_0x5e83dc,_0x54d1e1){var _0x3a3d5c=_0x585f41||client;return _0x3a3d5c[_0xc4a9('0x21')](_0x5b16d3,_0xaaecf0)['then'](function(_0x15660f){logger['info'](_0xc4a9('0x22'),_0x51d842,_0xc4a9('0x23'));logger[_0xc4a9('0x24')](_0xc4a9('0x25'),_0x51d842,_0xc4a9('0x23'),JSON[_0xc4a9('0x26')](_0x15660f));if(_0x15660f[_0xc4a9('0x27')]){if(_0x15660f[_0xc4a9('0x27')][_0xc4a9('0x28')]===0x1f4){logger['error'](_0xc4a9('0x22'),_0x51d842,_0x15660f['error'][_0xc4a9('0x29')]);return _0x54d1e1(_0x15660f[_0xc4a9('0x27')][_0xc4a9('0x29')]);}logger[_0xc4a9('0x27')]('FaxAccount,\x20%s,\x20%s',_0x51d842,_0x15660f[_0xc4a9('0x27')][_0xc4a9('0x29')]);return _0x5e83dc(_0x15660f['error'][_0xc4a9('0x29')]);}else{logger[_0xc4a9('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x51d842,_0xc4a9('0x23'));_0x5e83dc(_0x15660f[_0xc4a9('0x2b')]['message']);}})['catch'](function(_0x10f05f){logger[_0xc4a9('0x27')](_0xc4a9('0x22'),_0x51d842,_0x10f05f);_0x54d1e1(_0x10f05f);});});}function respondWithStatusCode(_0x5337c7,_0x33d1b4){_0x33d1b4=_0x33d1b4||0xcc;return function(_0x959e2c){if(_0x959e2c){return _0x5337c7[_0xc4a9('0x2c')](_0x33d1b4);}return _0x5337c7[_0xc4a9('0x2d')](_0x33d1b4)['end']();};}function respondWithResult(_0x56cd22,_0x2fc199){_0x2fc199=_0x2fc199||0xc8;return function(_0xa31b6f){if(_0xa31b6f){return _0x56cd22['status'](_0x2fc199)[_0xc4a9('0x2e')](_0xa31b6f);}};}function respondWithFilteredResult(_0x36885c,_0x545b5e){return function(_0x4ec541){if(_0x4ec541){var _0x20990a=_0x4ec541[_0xc4a9('0x2f')],_0x23110b=_0x545b5e[_0xc4a9('0x30')],_0x2b3967=_0x545b5e['offset']+_0x545b5e[_0xc4a9('0x31')],_0x59d5a0;if(_0x2b3967>=_0x20990a){_0x2b3967=_0x20990a;_0x59d5a0=0xc8;}else{_0x59d5a0=0xce;}_0x36885c[_0xc4a9('0x2d')](_0x59d5a0);return _0x36885c[_0xc4a9('0x32')](_0xc4a9('0x33'),_0x23110b+'-'+_0x2b3967+'/'+_0x20990a)['json'](_0x4ec541);}return null;};}function patchUpdates(_0x4c28d9){return function(_0x43349f){try{jsonpatch['apply'](_0x43349f,_0x4c28d9,!![]);}catch(_0x58981a){return BPromise[_0xc4a9('0x34')](_0x58981a);}return _0x43349f[_0xc4a9('0x35')]();};}function saveUpdates(_0x59cf52,_0x3e52e0){return function(_0x1394fa){if(_0x1394fa){return _0x1394fa['update'](_0x59cf52)[_0xc4a9('0x36')](function(_0x42c84c){return _0x42c84c;});}return null;};}function removeEntity(_0x1e96e7,_0x3152a5){return function(_0x250735){if(_0x250735){return _0x250735['destroy']()[_0xc4a9('0x36')](function(){var _0x46de26=_0x250735['get']({'plain':!![]});var _0x5489b5=_0xc4a9('0x37');return db['UserProfileResource'][_0xc4a9('0x38')]({'where':{'type':_0x5489b5,'resourceId':_0x46de26['id']}})['then'](function(){return _0x250735;});})[_0xc4a9('0x36')](function(){_0x1e96e7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f953a,_0x8ec037){return function(_0x3a95fa){if(!_0x3a95fa){_0x3f953a[_0xc4a9('0x2c')](0x194);}return _0x3a95fa;};}function handleError(_0x4419af,_0x2116d3){_0x2116d3=_0x2116d3||0x1f4;return function(_0x4062a1){logger[_0xc4a9('0x27')](_0x4062a1[_0xc4a9('0x39')]);if(_0x4062a1[_0xc4a9('0x3a')]){delete _0x4062a1[_0xc4a9('0x3a')];}_0x4419af[_0xc4a9('0x2d')](_0x2116d3)[_0xc4a9('0x3b')](_0x4062a1);};}exports[_0xc4a9('0x3c')]=function(_0x5e5a11,_0x19ea58){var _0x135753={'include':[{'model':db[_0xc4a9('0x3d')],'as':_0xc4a9('0x3e')}]},_0x4a4639={},_0x1c5050={'count':0x0,'rows':[]};var _0x13d35c=_[_0xc4a9('0x3f')](db[_0xc4a9('0x40')]['rawAttributes'],function(_0x167707){return{'name':_0x167707[_0xc4a9('0x41')],'type':_0x167707['type'][_0xc4a9('0x42')]};});_0x4a4639['model']=_[_0xc4a9('0x3f')](_0x13d35c,_0xc4a9('0x3a'));_0x4a4639[_0xc4a9('0x43')]=_[_0xc4a9('0x44')](_0x5e5a11[_0xc4a9('0x43')]);_0x4a4639[_0xc4a9('0x45')]=_['intersection'](_0x4a4639[_0xc4a9('0x46')],_0x4a4639[_0xc4a9('0x43')]);_0x135753[_0xc4a9('0x47')]=_[_0xc4a9('0x48')](_0x4a4639[_0xc4a9('0x46')],qs['fields'](_0x5e5a11[_0xc4a9('0x43')][_0xc4a9('0x49')]));_0x135753['attributes']=_0x135753[_0xc4a9('0x47')]['length']?_0x135753[_0xc4a9('0x47')]:_0x4a4639[_0xc4a9('0x46')];if(!_0x5e5a11[_0xc4a9('0x43')][_0xc4a9('0x4a')](_0xc4a9('0x4b'))){_0x135753[_0xc4a9('0x31')]=qs[_0xc4a9('0x31')](_0x5e5a11[_0xc4a9('0x43')]['limit']);_0x135753['offset']=qs[_0xc4a9('0x30')](_0x5e5a11[_0xc4a9('0x43')][_0xc4a9('0x30')]);}_0x135753[_0xc4a9('0x4c')]=qs[_0xc4a9('0x4d')](_0x5e5a11[_0xc4a9('0x43')][_0xc4a9('0x4d')]);_0x135753['where']=qs[_0xc4a9('0x45')](_[_0xc4a9('0x4e')](_0x5e5a11[_0xc4a9('0x43')],_0x4a4639[_0xc4a9('0x45')]),_0x13d35c);if(_0x5e5a11[_0xc4a9('0x43')]['filter']){_0x135753['where']=_[_0xc4a9('0x4f')](_0x135753[_0xc4a9('0x50')],{'$or':_['map'](_0x13d35c,function(_0x1d3149){if(_0x1d3149[_0xc4a9('0x51')]!==_0xc4a9('0x52')){var _0x3a3daa={};_0x3a3daa[_0x1d3149[_0xc4a9('0x3a')]]={'$like':'%'+_0x5e5a11['query'][_0xc4a9('0x53')]+'%'};return _0x3a3daa;}})});}_0x135753=_[_0xc4a9('0x4f')]({},_0x135753,_0x5e5a11['options']);var _0x37b4be={'where':_0x135753[_0xc4a9('0x50')]};return db[_0xc4a9('0x40')]['count'](_0x37b4be)[_0xc4a9('0x36')](function(_0x46021e){_0x1c5050[_0xc4a9('0x2f')]=_0x46021e;if(_0x5e5a11[_0xc4a9('0x43')]['includeAll']){_0x135753[_0xc4a9('0x54')]=[{'all':!![]}];}return db[_0xc4a9('0x40')]['findAll'](_0x135753);})['then'](function(_0x26d616){_0x1c5050[_0xc4a9('0x55')]=_0x26d616;return _0x1c5050;})[_0xc4a9('0x36')](respondWithFilteredResult(_0x19ea58,_0x135753))[_0xc4a9('0x56')](handleError(_0x19ea58,null));};exports[_0xc4a9('0x57')]=function(_0x248340,_0x2cc1f4){var _0x577747={'raw':![],'where':{'id':_0x248340[_0xc4a9('0x58')]['id']},'include':[{'model':db[_0xc4a9('0x3d')],'as':_0xc4a9('0x3e')}]},_0x541e5d={};_0x541e5d[_0xc4a9('0x46')]=_[_0xc4a9('0x44')](db[_0xc4a9('0x40')]['rawAttributes']);_0x541e5d[_0xc4a9('0x43')]=_[_0xc4a9('0x44')](_0x248340['query']);_0x541e5d[_0xc4a9('0x45')]=_[_0xc4a9('0x48')](_0x541e5d['model'],_0x541e5d[_0xc4a9('0x43')]);_0x577747[_0xc4a9('0x47')]=_['intersection'](_0x541e5d[_0xc4a9('0x46')],qs[_0xc4a9('0x49')](_0x248340['query'][_0xc4a9('0x49')]));_0x577747[_0xc4a9('0x47')]=_0x577747[_0xc4a9('0x47')][_0xc4a9('0x59')]?_0x577747[_0xc4a9('0x47')]:_0x541e5d[_0xc4a9('0x46')];if(_0x248340[_0xc4a9('0x43')]['includeAll']){_0x577747[_0xc4a9('0x54')]=[{'all':!![]}];}_0x577747=_[_0xc4a9('0x4f')]({},_0x577747,_0x248340[_0xc4a9('0x5a')]);return db[_0xc4a9('0x40')][_0xc4a9('0x5b')](_0x577747)['then'](handleEntityNotFound(_0x2cc1f4,null))[_0xc4a9('0x36')](respondWithResult(_0x2cc1f4,null))[_0xc4a9('0x56')](handleError(_0x2cc1f4,null));};exports[_0xc4a9('0x5c')]=function(_0x3b78a5,_0x1e8ebe){return db[_0xc4a9('0x40')]['create'](_0x3b78a5[_0xc4a9('0x5d')],{})[_0xc4a9('0x36')](function(_0x5b0102){var _0x351672=_0x3b78a5['user']['get']({'plain':!![]});if(!_0x351672)throw new Error(_0xc4a9('0x5e'));if(_0x351672[_0xc4a9('0x5f')]===_0xc4a9('0x60')){var _0x5b5b39=_0x5b0102['get']({'plain':!![]});var _0x22a410='FaxAccounts';return db[_0xc4a9('0x61')]['find']({'where':{'name':_0x22a410,'userProfileId':_0x351672['userProfileId']},'raw':!![]})[_0xc4a9('0x36')](function(_0xb35bd4){if(_0xb35bd4&&_0xb35bd4['autoAssociation']===0x0){return db[_0xc4a9('0x62')][_0xc4a9('0x5c')]({'name':_0x5b5b39[_0xc4a9('0x3a')],'resourceId':_0x5b5b39['id'],'type':_0xb35bd4[_0xc4a9('0x3a')],'sectionId':_0xb35bd4['id']},{})[_0xc4a9('0x36')](function(){return _0x5b0102;});}else{return _0x5b0102;}})[_0xc4a9('0x56')](function(_0x51ec56){logger[_0xc4a9('0x27')](_0xc4a9('0x63'),_0x51ec56);throw _0x51ec56;});}return _0x5b0102;})['then'](respondWithResult(_0x1e8ebe,0xc9))[_0xc4a9('0x56')](handleError(_0x1e8ebe,null));};exports[_0xc4a9('0x64')]=function(_0x278265,_0x4181d5){if(_0x278265['body']['id']){delete _0x278265[_0xc4a9('0x5d')]['id'];}return db['FaxAccount'][_0xc4a9('0x5b')]({'where':{'id':_0x278265['params']['id']},'include':[{'model':db[_0xc4a9('0x3d')],'as':_0xc4a9('0x3e')}]})[_0xc4a9('0x36')](handleEntityNotFound(_0x4181d5,null))[_0xc4a9('0x36')](saveUpdates(_0x278265[_0xc4a9('0x5d')],null))[_0xc4a9('0x36')](respondWithResult(_0x4181d5,null))[_0xc4a9('0x56')](handleError(_0x4181d5,null));};exports['destroy']=function(_0x71e5e8,_0x35be78){return db[_0xc4a9('0x40')][_0xc4a9('0x5b')]({'where':{'id':_0x71e5e8[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0x35be78,null))['then'](removeEntity(_0x35be78,null))['catch'](handleError(_0x35be78,null));};exports[_0xc4a9('0x65')]=function(_0x506d2a,_0xe11853){return db[_0xc4a9('0x40')][_0xc4a9('0x65')]()[_0xc4a9('0x36')](respondWithResult(_0xe11853,null))[_0xc4a9('0x56')](handleError(_0xe11853,null));};exports[_0xc4a9('0x66')]=function(_0x16280b,_0x494b93,_0x4a85ab){if(_0x16280b[_0xc4a9('0x5d')]['id']){delete _0x16280b[_0xc4a9('0x5d')]['id'];}return db[_0xc4a9('0x40')][_0xc4a9('0x5b')]({'where':{'id':_0x16280b[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0x494b93,null))[_0xc4a9('0x36')](function(_0x2ed031){if(_0x2ed031){_0x16280b['body']['FaxAccountId']=_0x2ed031['id'];return db[_0xc4a9('0x67')][_0xc4a9('0x5c')](_0x16280b[_0xc4a9('0x5d')]);}})[_0xc4a9('0x36')](respondWithResult(_0x494b93,null))[_0xc4a9('0x56')](handleError(_0x494b93,null));};exports['getDispositions']=function(_0x592b1f,_0xf90e98,_0x258bd0){var _0x362a9f={'raw':![],'where':{}};var _0xa0c60e={};var _0x11e278={'count':0x0,'rows':[]};return db[_0xc4a9('0x40')]['findOne']({'where':{'id':_0x592b1f[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0xf90e98,null))[_0xc4a9('0x36')](function(_0x7705a3){if(_0x7705a3){_0xa0c60e['model']=_[_0xc4a9('0x44')](db[_0xc4a9('0x67')][_0xc4a9('0x68')]);_0xa0c60e[_0xc4a9('0x43')]=_[_0xc4a9('0x44')](_0x592b1f[_0xc4a9('0x43')]);_0xa0c60e[_0xc4a9('0x45')]=_[_0xc4a9('0x48')](_0xa0c60e[_0xc4a9('0x46')],_0xa0c60e['query']);_0x362a9f[_0xc4a9('0x47')]=_[_0xc4a9('0x48')](_0xa0c60e['model'],qs['fields'](_0x592b1f[_0xc4a9('0x43')][_0xc4a9('0x49')]));_0x362a9f[_0xc4a9('0x47')]=_0x362a9f[_0xc4a9('0x47')][_0xc4a9('0x59')]?_0x362a9f['attributes']:_0xa0c60e[_0xc4a9('0x46')];if(!_0x592b1f[_0xc4a9('0x43')][_0xc4a9('0x4a')](_0xc4a9('0x4b'))){_0x362a9f[_0xc4a9('0x31')]=qs['limit'](_0x592b1f[_0xc4a9('0x43')][_0xc4a9('0x31')]);_0x362a9f['offset']=qs[_0xc4a9('0x30')](_0x592b1f[_0xc4a9('0x43')][_0xc4a9('0x30')]);}_0x362a9f[_0xc4a9('0x4c')]=qs[_0xc4a9('0x4d')](_0x592b1f[_0xc4a9('0x43')]['sort']);_0x362a9f[_0xc4a9('0x50')]=qs[_0xc4a9('0x45')](_[_0xc4a9('0x4e')](_0x592b1f[_0xc4a9('0x43')],_0xa0c60e[_0xc4a9('0x45')]));_0x362a9f[_0xc4a9('0x50')][_0xc4a9('0x69')]=_0x7705a3['id'];if(_0x592b1f[_0xc4a9('0x43')][_0xc4a9('0x53')]){_0x362a9f[_0xc4a9('0x50')]=_['merge'](_0x362a9f[_0xc4a9('0x50')],{'$or':_[_0xc4a9('0x3f')](_0x362a9f[_0xc4a9('0x47')],function(_0x5e9e53){var _0x34792e={};_0x34792e[_0x5e9e53]={'$like':'%'+_0x592b1f['query']['filter']+'%'};return _0x34792e;})});}_0x362a9f=_[_0xc4a9('0x4f')]({},_0x362a9f,_0x592b1f[_0xc4a9('0x5a')]);return db[_0xc4a9('0x67')][_0xc4a9('0x2f')]({'where':_0x362a9f[_0xc4a9('0x50')]})[_0xc4a9('0x36')](function(_0x112779){_0x11e278[_0xc4a9('0x2f')]=_0x112779;if(_0x592b1f[_0xc4a9('0x43')][_0xc4a9('0x6a')]){_0x362a9f[_0xc4a9('0x54')]=[{'all':!![]}];}return db[_0xc4a9('0x67')][_0xc4a9('0x6b')](_0x362a9f);})[_0xc4a9('0x36')](function(_0x4367ce){_0x11e278[_0xc4a9('0x55')]=_0x4367ce;return _0x11e278;});}})[_0xc4a9('0x36')](respondWithFilteredResult(_0xf90e98,_0x362a9f))[_0xc4a9('0x56')](handleError(_0xf90e98,null));};exports[_0xc4a9('0x6c')]=function(_0x5763b4,_0xb42fe2,_0x52c7b0){return db[_0xc4a9('0x40')][_0xc4a9('0x5b')]({'where':{'id':_0x5763b4[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0xb42fe2,null))[_0xc4a9('0x36')](function(_0x18c581){if(_0x18c581){return _0x18c581[_0xc4a9('0x6c')](_0x5763b4['query']['ids']);}})[_0xc4a9('0x36')](respondWithStatusCode(_0xb42fe2,null))[_0xc4a9('0x56')](handleError(_0xb42fe2,null));};exports[_0xc4a9('0x6d')]=function(_0x19defa,_0x1bc57d,_0x27d3ae){if(_0x19defa[_0xc4a9('0x5d')]['id']){delete _0x19defa[_0xc4a9('0x5d')]['id'];}return db[_0xc4a9('0x40')][_0xc4a9('0x5b')]({'where':{'id':_0x19defa[_0xc4a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x1bc57d,null))[_0xc4a9('0x36')](function(_0x1766ae){if(_0x1766ae){_0x19defa[_0xc4a9('0x5d')][_0xc4a9('0x69')]=_0x1766ae['id'];return db[_0xc4a9('0x6e')][_0xc4a9('0x5c')](_0x19defa[_0xc4a9('0x5d')]);}})[_0xc4a9('0x36')](respondWithResult(_0x1bc57d,null))['catch'](handleError(_0x1bc57d,null));};exports[_0xc4a9('0x6f')]=function(_0x300224,_0x1b9618,_0x5984e2){var _0x13c90b={'raw':![],'where':{}};var _0xa30405={};var _0x52d325={'count':0x0,'rows':[]};return db[_0xc4a9('0x40')]['findOne']({'where':{'id':_0x300224[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0x1b9618,null))['then'](function(_0x1e56dc){if(_0x1e56dc){_0xa30405[_0xc4a9('0x46')]=_[_0xc4a9('0x44')](db[_0xc4a9('0x6e')]['rawAttributes']);_0xa30405[_0xc4a9('0x43')]=_[_0xc4a9('0x44')](_0x300224[_0xc4a9('0x43')]);_0xa30405[_0xc4a9('0x45')]=_[_0xc4a9('0x48')](_0xa30405[_0xc4a9('0x46')],_0xa30405['query']);_0x13c90b[_0xc4a9('0x47')]=_[_0xc4a9('0x48')](_0xa30405[_0xc4a9('0x46')],qs[_0xc4a9('0x49')](_0x300224['query'][_0xc4a9('0x49')]));_0x13c90b['attributes']=_0x13c90b['attributes'][_0xc4a9('0x59')]?_0x13c90b[_0xc4a9('0x47')]:_0xa30405[_0xc4a9('0x46')];if(!_0x300224[_0xc4a9('0x43')][_0xc4a9('0x4a')]('nolimit')){_0x13c90b[_0xc4a9('0x31')]=qs[_0xc4a9('0x31')](_0x300224[_0xc4a9('0x43')][_0xc4a9('0x31')]);_0x13c90b[_0xc4a9('0x30')]=qs['offset'](_0x300224[_0xc4a9('0x43')][_0xc4a9('0x30')]);}_0x13c90b['order']=qs[_0xc4a9('0x4d')](_0x300224[_0xc4a9('0x43')]['sort']);_0x13c90b[_0xc4a9('0x50')]=qs[_0xc4a9('0x45')](_[_0xc4a9('0x4e')](_0x300224[_0xc4a9('0x43')],_0xa30405['filters']));_0x13c90b['where'][_0xc4a9('0x69')]=_0x1e56dc['id'];if(_0x300224['query'][_0xc4a9('0x53')]){_0x13c90b['where']=_[_0xc4a9('0x4f')](_0x13c90b['where'],{'$or':_[_0xc4a9('0x3f')](_0x13c90b[_0xc4a9('0x47')],function(_0x2d4eb9){var _0x431368={};_0x431368[_0x2d4eb9]={'$like':'%'+_0x300224[_0xc4a9('0x43')][_0xc4a9('0x53')]+'%'};return _0x431368;})});}_0x13c90b=_[_0xc4a9('0x4f')]({},_0x13c90b,_0x300224[_0xc4a9('0x5a')]);return db[_0xc4a9('0x6e')][_0xc4a9('0x2f')]({'where':_0x13c90b['where']})['then'](function(_0x8ac082){_0x52d325[_0xc4a9('0x2f')]=_0x8ac082;if(_0x300224[_0xc4a9('0x43')][_0xc4a9('0x6a')]){_0x13c90b[_0xc4a9('0x54')]=[{'all':!![]}];}return db[_0xc4a9('0x6e')][_0xc4a9('0x6b')](_0x13c90b);})['then'](function(_0x375bf2){_0x52d325[_0xc4a9('0x55')]=_0x375bf2;return _0x52d325;});}})[_0xc4a9('0x36')](respondWithFilteredResult(_0x1b9618,_0x13c90b))[_0xc4a9('0x56')](handleError(_0x1b9618,null));};exports[_0xc4a9('0x70')]=function(_0x13b774,_0x25e937,_0x4fce94){return db[_0xc4a9('0x40')][_0xc4a9('0x5b')]({'where':{'id':_0x13b774[_0xc4a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x25e937,null))[_0xc4a9('0x36')](function(_0x1cd5c4){if(_0x1cd5c4){return _0x1cd5c4[_0xc4a9('0x70')](_0x13b774[_0xc4a9('0x43')][_0xc4a9('0x71')]);}})['then'](respondWithStatusCode(_0x25e937,null))[_0xc4a9('0x56')](handleError(_0x25e937,null));};exports['addInteraction']=function(_0x5ace80,_0x15e90d,_0x42c740){return db[_0xc4a9('0x72')]['find']({'where':{'id':_0x5ace80[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0x15e90d,null))[_0xc4a9('0x36')](function(_0x2e4ed2){if(_0x2e4ed2){return _0x2e4ed2[_0xc4a9('0x73')](_0x5ace80['body'][_0xc4a9('0x71')],_['omit'](_0x5ace80['body'],[_0xc4a9('0x71'),'id'])||{});}})[_0xc4a9('0x36')](respondWithResult(_0x15e90d,null))[_0xc4a9('0x56')](handleError(_0x15e90d,null));};exports[_0xc4a9('0x74')]=function(_0x14db8e,_0x4f4115,_0x5e525c){var _0x40b3a5={'raw':![],'where':{}};var _0x9f3c8d={};var _0x5636c2={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc4a9('0x75')]({'where':{'id':_0x14db8e['params']['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0x4f4115,null))[_0xc4a9('0x36')](function(_0x38fe38){if(_0x38fe38){_0x9f3c8d[_0xc4a9('0x46')]=_[_0xc4a9('0x44')](db[_0xc4a9('0x72')]['rawAttributes']);_0x9f3c8d[_0xc4a9('0x43')]=_['keys'](_0x14db8e[_0xc4a9('0x43')]);_0x9f3c8d[_0xc4a9('0x45')]=_['intersection'](_0x9f3c8d[_0xc4a9('0x46')],_0x9f3c8d[_0xc4a9('0x43')]);_0x40b3a5[_0xc4a9('0x47')]=_['intersection'](_0x9f3c8d['model'],qs[_0xc4a9('0x49')](_0x14db8e[_0xc4a9('0x43')]['fields']));_0x40b3a5[_0xc4a9('0x47')]=_0x40b3a5[_0xc4a9('0x47')][_0xc4a9('0x59')]?_0x40b3a5['attributes']:_0x9f3c8d[_0xc4a9('0x46')];if(!_0x14db8e[_0xc4a9('0x43')][_0xc4a9('0x4a')](_0xc4a9('0x4b'))){_0x40b3a5[_0xc4a9('0x31')]=qs[_0xc4a9('0x31')](_0x14db8e[_0xc4a9('0x43')]['limit']);_0x40b3a5['offset']=qs['offset'](_0x14db8e['query'][_0xc4a9('0x30')]);}_0x40b3a5[_0xc4a9('0x4c')]=qs['sort'](_0x14db8e[_0xc4a9('0x43')][_0xc4a9('0x4d')]);_0x40b3a5[_0xc4a9('0x50')]=qs[_0xc4a9('0x45')](_[_0xc4a9('0x4e')](_0x14db8e[_0xc4a9('0x43')],_0x9f3c8d[_0xc4a9('0x45')]));_0x40b3a5['where'][_0xc4a9('0x69')]=_0x38fe38['id'];if(_0x14db8e[_0xc4a9('0x43')][_0xc4a9('0x53')]){_0x40b3a5[_0xc4a9('0x50')]=_[_0xc4a9('0x4f')](_0x40b3a5['where'],{'$or':_[_0xc4a9('0x3f')](_0x40b3a5['attributes'],function(_0x321bff){var _0x16fc87={};_0x16fc87[_0x321bff]={'$like':'%'+_0x14db8e[_0xc4a9('0x43')][_0xc4a9('0x53')]+'%'};return _0x16fc87;})});}_0x40b3a5=_['merge']({},_0x40b3a5,_0x14db8e['options']);return db['FaxInteraction']['count']({'where':_0x40b3a5['where']})[_0xc4a9('0x36')](function(_0x47b2a5){_0x5636c2[_0xc4a9('0x2f')]=_0x47b2a5;if(_0x14db8e[_0xc4a9('0x43')][_0xc4a9('0x6a')]){_0x40b3a5['include']=[{'model':db[_0xc4a9('0x76')],'as':_0xc4a9('0x77'),'required':![]},{'model':db[_0xc4a9('0x78')],'as':'Owner','attributes':[_0xc4a9('0x3a'),_0xc4a9('0x79'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xc4a9('0x7a'),'attributes':['id','name',_0xc4a9('0x7b')],'where':_0x14db8e[_0xc4a9('0x43')][_0xc4a9('0x7c')]?{'id':_0x14db8e[_0xc4a9('0x43')][_0xc4a9('0x7c')]}:undefined,'required':_0x14db8e[_0xc4a9('0x43')][_0xc4a9('0x7c')]?!![]:![]}];}return db[_0xc4a9('0x72')][_0xc4a9('0x6b')](_0x40b3a5);})[_0xc4a9('0x36')](function(_0x334e55){_0x5636c2[_0xc4a9('0x55')]=_0x334e55;return _0x5636c2;});}})[_0xc4a9('0x36')](respondWithFilteredResult(_0x4f4115,_0x40b3a5))[_0xc4a9('0x56')](handleError(_0x4f4115,null));};exports['addApplications']=function(_0x16a7f9,_0x2c219c,_0x3703da){return db[_0xc4a9('0x40')][_0xc4a9('0x75')]({'where':{'id':_0x16a7f9[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0x2c219c,null))['then'](function(_0x12d87b){if(_0x12d87b){return db[_0xc4a9('0x7d')]['transaction'](function(_0xd3bee8){return db['FaxApplication'][_0xc4a9('0x38')]({'where':{'FaxAccountId':_0x16a7f9[_0xc4a9('0x58')]['id']},'transaction':_0xd3bee8})[_0xc4a9('0x36')](function(_0x4015cd){var _0x1f7eff=_[_0xc4a9('0x3f')](_0x16a7f9['body'],function(_0xcb902a){_0xcb902a[_0xc4a9('0x69')]=_0x16a7f9[_0xc4a9('0x58')]['id'];return _0xcb902a;});return db[_0xc4a9('0x7e')][_0xc4a9('0x7f')](_0x1f7eff,{'transaction':_0xd3bee8});});})[_0xc4a9('0x36')](function(){return db[_0xc4a9('0x7e')][_0xc4a9('0x80')]({'where':{'FaxAccountId':_0x16a7f9[_0xc4a9('0x58')]['id']},'order':_0xc4a9('0x81')});});}})[_0xc4a9('0x36')](respondWithResult(_0x2c219c,null))[_0xc4a9('0x56')](handleError(_0x2c219c,null));};exports[_0xc4a9('0x82')]=function(_0x250f8c,_0x45c418,_0x48ad86){var _0x23d749={};var _0x2d496a={};var _0x2709a9;var _0x13b57c;return db[_0xc4a9('0x40')][_0xc4a9('0x75')]({'where':{'id':_0x250f8c[_0xc4a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x45c418,null))[_0xc4a9('0x36')](function(_0x15502d){if(_0x15502d){_0x2709a9=_0x15502d;_0x2d496a[_0xc4a9('0x46')]=_[_0xc4a9('0x44')](db[_0xc4a9('0x7e')][_0xc4a9('0x68')]);_0x2d496a['query']=_[_0xc4a9('0x44')](_0x250f8c[_0xc4a9('0x43')]);_0x2d496a['filters']=_['intersection'](_0x2d496a[_0xc4a9('0x46')],_0x2d496a['query']);_0x23d749[_0xc4a9('0x47')]=_[_0xc4a9('0x48')](_0x2d496a[_0xc4a9('0x46')],qs[_0xc4a9('0x49')](_0x250f8c[_0xc4a9('0x43')][_0xc4a9('0x49')]));_0x23d749[_0xc4a9('0x47')]=_0x23d749[_0xc4a9('0x47')][_0xc4a9('0x59')]?_0x23d749[_0xc4a9('0x47')]:_0x2d496a[_0xc4a9('0x46')];_0x23d749[_0xc4a9('0x4c')]=qs[_0xc4a9('0x4d')](_0x250f8c['query'][_0xc4a9('0x4d')]);_0x23d749[_0xc4a9('0x50')]=qs[_0xc4a9('0x45')](_[_0xc4a9('0x4e')](_0x250f8c[_0xc4a9('0x43')],_0x2d496a['filters']));if(_0x250f8c[_0xc4a9('0x43')][_0xc4a9('0x53')]){_0x23d749['where']=_[_0xc4a9('0x4f')](_0x23d749[_0xc4a9('0x50')],{'$or':_[_0xc4a9('0x3f')](_0x23d749[_0xc4a9('0x47')],function(_0x447c4f){var _0xee4f61={};_0xee4f61[_0x447c4f]={'$like':'%'+_0x250f8c[_0xc4a9('0x43')][_0xc4a9('0x53')]+'%'};return _0xee4f61;})});}_0x23d749=_[_0xc4a9('0x4f')]({},_0x23d749,_0x250f8c[_0xc4a9('0x5a')]);return _0x2709a9[_0xc4a9('0x82')](_0x23d749);}})[_0xc4a9('0x36')](function(_0x332cbe){if(_0x332cbe){_0x13b57c=_0x332cbe[_0xc4a9('0x59')];if(!_0x250f8c['query'][_0xc4a9('0x4a')]('nolimit')){_0x23d749[_0xc4a9('0x31')]=qs[_0xc4a9('0x31')](_0x250f8c[_0xc4a9('0x43')][_0xc4a9('0x31')]);_0x23d749[_0xc4a9('0x30')]=qs['offset'](_0x250f8c[_0xc4a9('0x43')]['offset']);}return _0x2709a9[_0xc4a9('0x82')](_0x23d749);}})[_0xc4a9('0x36')](function(_0x3bc07c){if(_0x3bc07c){return _0x3bc07c?{'count':_0x13b57c,'rows':_0x3bc07c}:null;}})[_0xc4a9('0x36')](respondWithResult(_0x45c418,null))[_0xc4a9('0x56')](handleError(_0x45c418,null));};function Extension(_0x2874fa,_0x5a8935,_0x11430a,_0x52fbf7){this['context']=_0xc4a9('0x83');this[_0xc4a9('0x84')]=_0x2874fa[_0xc4a9('0x85')];this[_0xc4a9('0x86')]=_0x52fbf7;this[_0xc4a9('0x51')]=_0xc4a9('0x87');this[_0xc4a9('0x88')]=_0xc4a9('0x89');this[_0xc4a9('0x69')]=_0x2874fa['id'];this[_0xc4a9('0x81')]=_0x5a8935;this[_0xc4a9('0x8a')]=_0x11430a;}function createExtensionsReciveFax(_0x2dabc9){var _0x5949d3=0x1;var _0x4fa839=[];_0x4fa839['push'](new Extension(_0x2dabc9,_0x5949d3,'','Answer'));_0x5949d3+=0x1;_0x4fa839[_0xc4a9('0x8b')](new Extension(_0x2dabc9,_0x5949d3,_0xc4a9('0x8c'),'Set'));_0x5949d3+=0x1;for(var _0xdac9b7 in _0x2dabc9){if(_0x2dabc9[_0xc4a9('0x4a')](_0xdac9b7)&&(_0xdac9b7==='ecm'||_0xdac9b7===_0xc4a9('0x85')||_0xdac9b7===_0xc4a9('0x8d')||_0xdac9b7==='faxdetect'||_0xdac9b7===_0xc4a9('0x8e')||_0xdac9b7===_0xc4a9('0x8f')||_0xdac9b7===_0xc4a9('0x90')||_0xdac9b7===_0xc4a9('0x91')||_0xdac9b7==='t38timeout')){_0x4fa839[_0xc4a9('0x8b')](new Extension(_0x2dabc9,_0x5949d3,'FAXOPT('+_0xdac9b7+')='+_0x2dabc9[_0xdac9b7],'Set'));_0x5949d3+=0x1;}}_0x4fa839[_0xc4a9('0x8b')](new Extension(_0x2dabc9,_0x5949d3,'6',_0xc4a9('0x92')));_0x5949d3+=0x1;_0x4fa839[_0xc4a9('0x8b')](new Extension(_0x2dabc9,_0x5949d3,_0xc4a9('0x93'),'ReceiveFax'));_0x5949d3=0x0;return _0x4fa839;}exports[_0xc4a9('0x94')]=function(_0x39b347,_0x44afa2,_0x5cde05){var _0xe0a47b;return db[_0xc4a9('0x7d')][_0xc4a9('0x95')](function(_0x4b29e6){return db[_0xc4a9('0x40')][_0xc4a9('0x5c')](_0x39b347['body'],{'transaction':_0x4b29e6})['then'](function(_0x214a1a){_0xe0a47b=_0x214a1a[_0xc4a9('0x96')]({'plain':!![]});return db[_0xc4a9('0x97')][_0xc4a9('0x7f')](createExtensionsReciveFax(_0xe0a47b),{'transaction':_0x4b29e6});});})[_0xc4a9('0x36')](function(){return _0xe0a47b;})['then'](respondWithResult(_0x44afa2,null))[_0xc4a9('0x56')](handleError(_0x44afa2,null));};exports[_0xc4a9('0x98')]=function(_0x200701,_0x4d3384,_0x3ee140){var _0x58219b;return db[_0xc4a9('0x7d')][_0xc4a9('0x95')](function(_0x5d7dd5){return db['FaxAccount'][_0xc4a9('0x64')](_0x200701['body'],{'where':{'id':_0x200701[_0xc4a9('0x5d')]['id']},'transaction':_0x5d7dd5})['then'](function(_0x3239ac){return db[_0xc4a9('0x97')][_0xc4a9('0x38')]({'where':{'FaxAccountId':_0x200701[_0xc4a9('0x5d')]['id']},'transaction':_0x5d7dd5})[_0xc4a9('0x36')](function(_0x9f482e){return db[_0xc4a9('0x97')][_0xc4a9('0x7f')](createExtensionsReciveFax(_['omit'](_0x200701[_0xc4a9('0x5d')],[_0xc4a9('0x99'),'key',_0xc4a9('0x9a'),'updatedAt','TrunkId','ListId'])),{'transaction':_0x5d7dd5});});});})[_0xc4a9('0x36')](function(){return db[_0xc4a9('0x40')][_0xc4a9('0x9b')](_0x200701[_0xc4a9('0x5d')]['id']);})[_0xc4a9('0x36')](respondWithResult(_0x4d3384,null))[_0xc4a9('0x56')](handleError(_0x4d3384,null));};exports[_0xc4a9('0x9c')]=function(_0x3c706a,_0x568715,_0x40433e){var _0x56da72={'raw':!![],'where':{}};var _0xdf9e5={};var _0x4db125={'count':0x0,'rows':[]};return db[_0xc4a9('0x40')][_0xc4a9('0x75')]({'where':{'id':_0x3c706a[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0x568715,null))[_0xc4a9('0x36')](function(_0x5e0378){if(_0x5e0378){_0xdf9e5['model']=_[_0xc4a9('0x44')](db[_0xc4a9('0x9d')][_0xc4a9('0x68')]);_0xdf9e5[_0xc4a9('0x43')]=_[_0xc4a9('0x44')](_0x3c706a['query']);_0xdf9e5[_0xc4a9('0x45')]=_['intersection'](_0xdf9e5[_0xc4a9('0x46')],_0xdf9e5['query']);_0x56da72[_0xc4a9('0x47')]=_[_0xc4a9('0x48')](_0xdf9e5[_0xc4a9('0x46')],qs['fields'](_0x3c706a[_0xc4a9('0x43')]['fields']));_0x56da72[_0xc4a9('0x47')]=_0x56da72[_0xc4a9('0x47')]['length']?_0x56da72[_0xc4a9('0x47')]:_0xdf9e5['model'];if(!_0x3c706a[_0xc4a9('0x43')]['hasOwnProperty'](_0xc4a9('0x4b'))){_0x56da72[_0xc4a9('0x31')]=qs[_0xc4a9('0x31')](_0x3c706a[_0xc4a9('0x43')]['limit']);_0x56da72['offset']=qs[_0xc4a9('0x30')](_0x3c706a[_0xc4a9('0x43')][_0xc4a9('0x30')]);}_0x56da72[_0xc4a9('0x4c')]=qs[_0xc4a9('0x4d')](_0x3c706a[_0xc4a9('0x43')]['sort']);_0x56da72['where']=qs[_0xc4a9('0x45')](_[_0xc4a9('0x4e')](_0x3c706a[_0xc4a9('0x43')],_0xdf9e5['filters']));_0x56da72[_0xc4a9('0x50')][_0xc4a9('0x69')]=_0x5e0378['id'];if(_0x3c706a[_0xc4a9('0x43')][_0xc4a9('0x53')]){_0x56da72['where']=_[_0xc4a9('0x4f')](_0x56da72[_0xc4a9('0x50')],{'$or':_[_0xc4a9('0x3f')](_0x56da72['attributes'],function(_0x53f2da){var _0x4cc84e={};_0x4cc84e[_0x53f2da]={'$like':'%'+_0x3c706a[_0xc4a9('0x43')][_0xc4a9('0x53')]+'%'};return _0x4cc84e;})});}if(_0x3c706a[_0xc4a9('0x43')][_0xc4a9('0x9e')]){var _0xe9bbbf=_0x3c706a[_0xc4a9('0x43')]['$gte']['split'](',');var _0x5556fc={};_0x5556fc[_0xe9bbbf[0x0]]={'$gte':moment(_0xe9bbbf[0x1])['format'](_0xc4a9('0x9f'))};_0x56da72[_0xc4a9('0x50')]=_[_0xc4a9('0x4f')](_0x56da72[_0xc4a9('0x50')],_0x5556fc);}_0x56da72=_[_0xc4a9('0x4f')]({},_0x56da72,_0x3c706a['options']);return db[_0xc4a9('0x9d')][_0xc4a9('0x2f')]({'where':_0x56da72[_0xc4a9('0x50')]})['then'](function(_0x10cdf8){_0x4db125['count']=_0x10cdf8;if(_0x3c706a[_0xc4a9('0x43')]['includeAll']){_0x56da72['include']=[{'all':!![]}];}return db[_0xc4a9('0x9d')][_0xc4a9('0x6b')](_0x56da72);})[_0xc4a9('0x36')](function(_0x454429){_0x4db125[_0xc4a9('0x55')]=_0x454429;return _0x4db125;});}})['then'](respondWithFilteredResult(_0x568715,_0x56da72))[_0xc4a9('0x56')](handleError(_0x568715,null));};exports[_0xc4a9('0x3b')]=function(_0x2ebaa9,_0x343942,_0x35f2e5){var _0x29e52c,_0x23de29={},_0x3e713e;if(_0x2ebaa9[_0xc4a9('0x5d')]['to']){_0x3e713e=_0x2ebaa9[_0xc4a9('0x5d')]['to'][0x0];}return db[_0xc4a9('0x40')][_0xc4a9('0x5b')]({'where':{'id':_0x2ebaa9[_0xc4a9('0x58')]['id']},'include':[{'model':db[_0xc4a9('0xa0')],'as':_0xc4a9('0xa1'),'include':[{'model':db[_0xc4a9('0x76')],'as':_0xc4a9('0xa2'),'where':{'fax':_0x3e713e},'limit':0x1,'order':[[_0xc4a9('0xa3'),_0xc4a9('0xa4')]]}]}]})[_0xc4a9('0x36')](handleEntityNotFound(_0x343942,null))[_0xc4a9('0x36')](function(_0xfcdebf){_0x29e52c=_0xfcdebf;if(_0x2ebaa9[_0xc4a9('0x5d')]['attachments']&&_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][_0xc4a9('0x59')]){for(var _0x15684e=0x0;_0x15684e<_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')]['length'];_0x15684e+=0x1){_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][_0x15684e]={'filename':_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][_0x15684e][_0xc4a9('0x3a')],'id':_0x2ebaa9['body'][_0xc4a9('0xa5')][_0x15684e]['id'],'path':path[_0xc4a9('0xa6')](config[_0xc4a9('0xa7')],'server/files/attachments',_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][_0x15684e][_0xc4a9('0xa8')])};}}return respondWithRpcPromise(_0xc4a9('0xa9'),'CheckAfterSend',{'FaxAccountId':_[_0xc4a9('0xaa')](_0x2ebaa9[_0xc4a9('0x58')]['id'])?undefined:_0x2ebaa9[_0xc4a9('0x58')]['id'],'path':_[_0xc4a9('0xaa')](_0x2ebaa9['body'][_0xc4a9('0xa5')][0x0][_0xc4a9('0xab')])?undefined:_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][0x0][_0xc4a9('0xab')],'fax':_[_0xc4a9('0xaa')](_0x2ebaa9[_0xc4a9('0x5d')]['to'][0x0])?undefined:_0x2ebaa9[_0xc4a9('0x5d')]['to'][0x0]},client9002);})['then'](function(){if(_0x29e52c){if(_['isNil'](_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xac')])){_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xac')]=util[_0xc4a9('0xad')](_0xc4a9('0xae'),_0x29e52c['name'],_0x29e52c['fax']);}if(_0x29e52c['List']){if(_0x29e52c['List'][_0xc4a9('0xa2')][_0xc4a9('0x59')]){return _0x29e52c[_0xc4a9('0xa1')]['Contacts'][0x0];}else{return db[_0xc4a9('0x76')][_0xc4a9('0x5c')](_[_0xc4a9('0x1b')](_0x2ebaa9['body'],{'firstName':_0x2ebaa9['body']['to'][0x0],'phone':_0x2ebaa9['body']['to'][0x0],'fax':_0x2ebaa9[_0xc4a9('0x5d')]['to'][0x0],'ListId':_0x29e52c['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xc4a9('0xaf'));}})[_0xc4a9('0x36')](function(_0x330b71){if(_0x330b71){return db[_0xc4a9('0x72')][_0xc4a9('0x5b')]({'where':{'ContactId':_0x330b71['id'],'closed':![],'FaxAccountId':_0x29e52c['id']}})[_0xc4a9('0x36')](function(_0x36b0b3){if(_0x36b0b3){return[_0x36b0b3,![]];}return db[_0xc4a9('0x72')]['create']({'UserId':_0x2ebaa9[_0xc4a9('0x60')]['id'],'ContactId':_0x330b71['id'],'FaxAccountId':_0x29e52c['id'],'fax':_0x2ebaa9[_0xc4a9('0x5d')]['to'][0x0],'firstMsgDirection':_0xc4a9('0xb0'),'Messages':[_[_0xc4a9('0x4f')](_0x2ebaa9[_0xc4a9('0x5d')],{'read':![],'body':_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][0x0][_0xc4a9('0xb1')],'FaxAccountId':_0x29e52c['id'],'UserId':_0x2ebaa9[_0xc4a9('0x60')]['id'],'ContactId':_0x330b71['id'],'AttachmentId':_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][0x0]['id']})]},{'include':[{'model':db[_0xc4a9('0x9d')],'as':_0xc4a9('0xb2')}]})[_0xc4a9('0x36')](function(_0x40ec79){return[_0x40ec79,!![]];});});}else{throw new Error(_0xc4a9('0xb3'));}})[_0xc4a9('0xb4')](function(_0x638432,_0xab7877){if(_0xab7877){return _0x638432;}return db['FaxMessage']['create']({'direction':_0xc4a9('0xb0'),'read':![],'body':_0x2ebaa9[_0xc4a9('0x5d')]['attachments'][0x0]['filename'],'FaxAccountId':_0x29e52c['id'],'FaxInteractionId':_0x638432['id'],'UserId':_0x2ebaa9[_0xc4a9('0x60')]['id'],'ContactId':_0x638432[_0xc4a9('0xb5')],'AttachmentId':_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][0x0]['id']})[_0xc4a9('0x36')](function(_0x344e1e){_0x638432['dataValues']['Messages']=[];_0x638432[_0xc4a9('0xb6')]['Messages'][_0xc4a9('0x8b')](_0x344e1e[_0xc4a9('0xb6')]);return _0x638432;});})[_0xc4a9('0x36')](function(_0x85d5f3){respondWithRpcPromise(_0xc4a9('0xb7'),'SendFax',{'FaxAccountId':_[_0xc4a9('0xaa')](_0x2ebaa9[_0xc4a9('0x58')]['id'])?undefined:_0x2ebaa9[_0xc4a9('0x58')]['id'],'path':_[_0xc4a9('0xaa')](_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][0x0][_0xc4a9('0xab')])?undefined:_0x2ebaa9[_0xc4a9('0x5d')][_0xc4a9('0xa5')][0x0][_0xc4a9('0xab')],'fax':_['isNil'](_0x2ebaa9[_0xc4a9('0x5d')]['to'][0x0])?undefined:_0x2ebaa9[_0xc4a9('0x5d')]['to'][0x0],'AttachmentId':_0x2ebaa9['body']['attachments'][0x0]['id']},client9002)[_0xc4a9('0x36')](function(_0x63fe04){logger['info']('SendFaxRpc,\x20%s',_0x63fe04);})[_0xc4a9('0x56')](function(_0x2a2370){logger[_0xc4a9('0x2a')]('SendFaxRpc,\x20%s',_0x2a2370);});return _0x85d5f3;})['then'](respondWithResult(_0x343942,null))[_0xc4a9('0x56')](handleError(_0x343942,null));};exports['addAgents']=function(_0x282d4e,_0x3298ba,_0x5df466){return db['FaxAccount']['find']({'where':{'id':_0x282d4e[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0x3298ba,null))[_0xc4a9('0x36')](function(_0x5eddce){if(_0x5eddce){return _0x5eddce['addAgents'](_0x282d4e['body'][_0xc4a9('0x71')],_[_0xc4a9('0xb8')](_0x282d4e[_0xc4a9('0x5d')],[_0xc4a9('0x71'),'id'])||{})[_0xc4a9('0xb4')](function(_0x13a870){for(var _0x196cb6=0x0;_0x196cb6<_0x282d4e[_0xc4a9('0x5d')][_0xc4a9('0x71')]['length'];_0x196cb6+=0x1){socket[_0xc4a9('0xb9')]('userFaxAccount:save',{'UserId':_0x282d4e[_0xc4a9('0x5d')][_0xc4a9('0x71')][_0x196cb6],'FaxAccountId':_0x282d4e[_0xc4a9('0x58')]['id']});}return _0x13a870;});}})[_0xc4a9('0x36')](respondWithResult(_0x3298ba,null))[_0xc4a9('0x56')](handleError(_0x3298ba,null));};exports[_0xc4a9('0xba')]=function(_0x46669f,_0x52f7e9,_0x25415e){return db['FaxAccount']['find']({'where':{'id':_0x46669f[_0xc4a9('0x58')]['id']}})['then'](handleEntityNotFound(_0x52f7e9,null))['then'](function(_0x2d5567){if(_0x2d5567){return _0x2d5567['removeAgents'](_0x46669f['query'][_0xc4a9('0x71')])[_0xc4a9('0x36')](function(){if(_['isArray'](_0x46669f[_0xc4a9('0x43')][_0xc4a9('0x71')])){for(var _0xf2dab6=0x0;_0xf2dab6<_0x46669f[_0xc4a9('0x43')][_0xc4a9('0x71')]['length'];_0xf2dab6+=0x1){socket['emit'](_0xc4a9('0xbb'),{'UserId':Number(_0x46669f[_0xc4a9('0x43')][_0xc4a9('0x71')][_0xf2dab6]),'FaxAccountId':Number(_0x46669f[_0xc4a9('0x58')]['id'])});}}else{socket[_0xc4a9('0xb9')](_0xc4a9('0xbb'),{'UserId':Number(_0x46669f[_0xc4a9('0x43')][_0xc4a9('0x71')]),'FaxAccountId':Number(_0x46669f[_0xc4a9('0x58')]['id'])});}});}})[_0xc4a9('0x36')](respondWithStatusCode(_0x52f7e9,null))['catch'](handleError(_0x52f7e9,null));};exports[_0xc4a9('0xbc')]=function(_0x7c4321,_0x12a317,_0x302b0f){var _0x44146a={};var _0x321f1f={};var _0x971b58;var _0x5523cf;return db[_0xc4a9('0x40')]['findOne']({'where':{'id':_0x7c4321[_0xc4a9('0x58')]['id']}})[_0xc4a9('0x36')](handleEntityNotFound(_0x12a317,null))[_0xc4a9('0x36')](function(_0x1abd6b){if(_0x1abd6b){_0x971b58=_0x1abd6b;_0x321f1f[_0xc4a9('0x46')]=_['keys'](db[_0xc4a9('0x78')][_0xc4a9('0x68')]);_0x321f1f['query']=_['keys'](_0x7c4321['query']);_0x321f1f['filters']=_[_0xc4a9('0x48')](_0x321f1f[_0xc4a9('0x46')],_0x321f1f[_0xc4a9('0x43')]);_0x44146a[_0xc4a9('0x47')]=_[_0xc4a9('0x48')](_0x321f1f[_0xc4a9('0x46')],qs['fields'](_0x7c4321[_0xc4a9('0x43')][_0xc4a9('0x49')]));_0x44146a[_0xc4a9('0x47')]=_0x44146a['attributes'][_0xc4a9('0x59')]?_0x44146a['attributes']:_0x321f1f['model'];_0x44146a[_0xc4a9('0x4c')]=qs['sort'](_0x7c4321[_0xc4a9('0x43')][_0xc4a9('0x4d')]);_0x44146a['where']=qs['filters'](_[_0xc4a9('0x4e')](_0x7c4321[_0xc4a9('0x43')],_0x321f1f[_0xc4a9('0x45')]));if(_0x7c4321['query']['filter']){_0x44146a[_0xc4a9('0x50')]=_[_0xc4a9('0x4f')](_0x44146a[_0xc4a9('0x50')],{'$or':_[_0xc4a9('0x3f')](_0x44146a['attributes'],function(_0x1aa7c5){var _0x386886={};_0x386886[_0x1aa7c5]={'$like':'%'+_0x7c4321[_0xc4a9('0x43')][_0xc4a9('0x53')]+'%'};return _0x386886;})});}_0x44146a=_[_0xc4a9('0x4f')]({},_0x44146a,_0x7c4321[_0xc4a9('0x5a')]);return _0x971b58['getAgents'](_0x44146a);}})[_0xc4a9('0x36')](function(_0x23a14d){if(_0x23a14d){_0x5523cf=_0x23a14d[_0xc4a9('0x59')];if(!_0x7c4321[_0xc4a9('0x43')][_0xc4a9('0x4a')](_0xc4a9('0x4b'))){_0x44146a['limit']=qs['limit'](_0x7c4321[_0xc4a9('0x43')][_0xc4a9('0x31')]);_0x44146a['offset']=qs['offset'](_0x7c4321[_0xc4a9('0x43')]['offset']);}return _0x971b58[_0xc4a9('0xbc')](_0x44146a);}})[_0xc4a9('0x36')](function(_0x89383f){if(_0x89383f){return _0x89383f?{'count':_0x5523cf,'rows':_0x89383f}:null;}})[_0xc4a9('0x36')](respondWithResult(_0x12a317,null))[_0xc4a9('0x56')](handleError(_0x12a317,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index a0f1ef8..ac5aa10 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 _0xd8d4=['FaxAccount','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4cd93d,_0x3b3b7a){var _0x1ba54a=function(_0x562473){while(--_0x562473){_0x4cd93d['push'](_0x4cd93d['shift']());}};_0x1ba54a(++_0x3b3b7a);}(_0xd8d4,0x1ee));var _0x4d8d=function(_0xc025d,_0x4cef0a){_0xc025d=_0xc025d-0x0;var _0x4fac03=_0xd8d4[_0xc025d];return _0x4fac03;};'use strict';var EventEmitter=require(_0x4d8d('0x0'));var FaxAccount=require(_0x4d8d('0x1'))['db'][_0x4d8d('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d8d('0x3'),'afterUpdate':'update','afterDestroy':_0x4d8d('0x4')};function emitEvent(_0x54e857){return function(_0x1c41a4,_0x286374,_0x10c1b7){FaxAccountEvents[_0x4d8d('0x5')](_0x54e857+':'+_0x1c41a4['id'],_0x1c41a4);FaxAccountEvents[_0x4d8d('0x5')](_0x54e857,_0x1c41a4);_0x10c1b7(null);};}for(var e in events){if(events[_0x4d8d('0x6')](e)){var event=events[e];FaxAccount[_0x4d8d('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xf52e=['setMaxListeners','save','remove','emit','../../mysqldb','FaxAccount'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xf52e,0x6a));var _0xef52=function(_0x28208d,_0x461e43){_0x28208d=_0x28208d-0x0;var _0x1593a6=_0xf52e[_0x28208d];return _0x1593a6;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xef52('0x0'))['db'][_0xef52('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xef52('0x2')](0x0);var events={'afterCreate':_0xef52('0x3'),'afterUpdate':'update','afterDestroy':_0xef52('0x4')};function emitEvent(_0x4e27a9){return function(_0x1ab762,_0x10383,_0x269b1d){FaxAccountEvents['emit'](_0x4e27a9+':'+_0x1ab762['id'],_0x1ab762);FaxAccountEvents[_0xef52('0x5')](_0x4e27a9,_0x1ab762);_0x269b1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index acd14a6..adffc80 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 _0x514a=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5a037a,_0x44a3fc){var _0x28ff57=function(_0x13d49f){while(--_0x13d49f){_0x5a037a['push'](_0x5a037a['shift']());}};_0x28ff57(++_0x44a3fc);}(_0x514a,0x111));var _0xa514=function(_0x532c50,_0x357a68){_0x532c50=_0x532c50-0x0;var _0x5d248f=_0x514a[_0x532c50];return _0x5d248f;};'use strict';var _=require(_0xa514('0x0'));var util=require('util');var logger=require(_0xa514('0x1'))(_0xa514('0x2'));var moment=require(_0xa514('0x3'));var BPromise=require(_0xa514('0x4'));var rp=require(_0xa514('0x5'));var fs=require('fs');var path=require(_0xa514('0x6'));var rimraf=require(_0xa514('0x7'));var config=require(_0xa514('0x8'));var attributes=require(_0xa514('0x9'));module[_0xa514('0xa')]=function(_0x5b8c46,_0x51a4f5){return _0x5b8c46[_0xa514('0xb')](_0xa514('0xc'),attributes,{'tableName':_0xa514('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d4e=['FaxAccount','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','define'];(function(_0xcd243e,_0x1cb1b4){var _0xcb1035=function(_0x55e2e2){while(--_0x55e2e2){_0xcd243e['push'](_0xcd243e['shift']());}};_0xcb1035(++_0x1cb1b4);}(_0x5d4e,0x12d));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xe5d4('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe5d4('0x1'));var BPromise=require(_0xe5d4('0x2'));var rp=require(_0xe5d4('0x3'));var fs=require('fs');var path=require(_0xe5d4('0x4'));var rimraf=require(_0xe5d4('0x5'));var config=require(_0xe5d4('0x6'));var attributes=require(_0xe5d4('0x7'));module['exports']=function(_0x151b31,_0x59c215){return _0x151b31[_0xe5d4('0x8')](_0xe5d4('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 e876b40..348b971 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 _0xfeb3=['name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','CmList','Contacts','DESC','FaxApplication','Applications','List','get','account','applications','orderBy','priority','asc','length','ListId','contact','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','close','unmanaged','created','interaction','FaxMessage','ContactId','UserId','User','agent'];(function(_0x39fb09,_0x4f0fc6){var _0x31aa84=function(_0x45312a){while(--_0x45312a){_0x39fb09['push'](_0x39fb09['shift']());}};_0x31aa84(++_0x4f0fc6);}(_0xfeb3,0x11c));var _0x3feb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfeb3[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3feb('0x0'));var BPromise=require(_0x3feb('0x1'));var rs=require(_0x3feb('0x2'));var fs=require('fs');var Redis=require(_0x3feb('0x3'));var db=require(_0x3feb('0x4'))['db'];var utils=require(_0x3feb('0x5'));var logger=require(_0x3feb('0x6'))(_0x3feb('0x7'));var config=require(_0x3feb('0x8'));var jayson=require(_0x3feb('0x9'));var client=jayson['client']['http']({'port':0x232c});config[_0x3feb('0xa')]=_[_0x3feb('0xb')](config[_0x3feb('0xa')],{'host':_0x3feb('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3feb('0xa')]));require(_0x3feb('0xd'))[_0x3feb('0xe')](socket);function respondWithRpcPromise(_0x4466cf,_0x5e163f,_0xde42e9){return new BPromise(function(_0x56f765,_0x35efed){return client[_0x3feb('0xf')](_0x4466cf,_0xde42e9)[_0x3feb('0x10')](function(_0x14ac11){logger[_0x3feb('0x11')]('FaxAccount,\x20%s,\x20%s',_0x5e163f,'request\x20sent');logger[_0x3feb('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x5e163f,_0x3feb('0x13'),JSON[_0x3feb('0x14')](_0x14ac11));if(_0x14ac11['error']){if(_0x14ac11[_0x3feb('0x15')][_0x3feb('0x16')]===0x1f4){logger[_0x3feb('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5e163f,_0x14ac11[_0x3feb('0x15')]['message']);return _0x35efed(_0x14ac11[_0x3feb('0x15')][_0x3feb('0x17')]);}logger['error'](_0x3feb('0x18'),_0x5e163f,_0x14ac11['error']['message']);return _0x56f765(_0x14ac11[_0x3feb('0x15')][_0x3feb('0x17')]);}else{logger[_0x3feb('0x11')](_0x3feb('0x18'),_0x5e163f,'request\x20sent');_0x56f765(_0x14ac11[_0x3feb('0x19')][_0x3feb('0x17')]);}})[_0x3feb('0x1a')](function(_0x2f2134){logger['error'](_0x3feb('0x18'),_0x5e163f,_0x2f2134);_0x35efed(_0x2f2134);});});}exports['GetFaxAccount']=function(_0x27cd87){var _0x2c8703=this;return new Promise(function(_0x3bf7fc,_0x21be84){return db[_0x3feb('0x1b')][_0x3feb('0x1c')]({'raw':_0x27cd87[_0x3feb('0x1d')]?_0x27cd87[_0x3feb('0x1d')][_0x3feb('0x1e')]===undefined?!![]:![]:!![],'where':_0x27cd87[_0x3feb('0x1d')]?_0x27cd87[_0x3feb('0x1d')][_0x3feb('0x1f')]||null:null,'attributes':_0x27cd87[_0x3feb('0x1d')]?_0x27cd87[_0x3feb('0x1d')][_0x3feb('0x20')]||null:null,'limit':_0x27cd87[_0x3feb('0x1d')]?_0x27cd87['options'][_0x3feb('0x21')]||null:null,'include':_0x27cd87[_0x3feb('0x1d')]?_0x27cd87[_0x3feb('0x1d')][_0x3feb('0x22')]?_[_0x3feb('0x23')](_0x27cd87['options'][_0x3feb('0x22')],function(_0x5193b3){return{'model':db[_0x5193b3[_0x3feb('0x24')]],'as':_0x5193b3['as'],'attributes':_0x5193b3[_0x3feb('0x20')],'include':_0x5193b3[_0x3feb('0x22')]?_[_0x3feb('0x23')](_0x5193b3[_0x3feb('0x22')],function(_0x28d1b1){return{'model':db[_0x28d1b1['model']],'as':_0x28d1b1['as'],'attributes':_0x28d1b1[_0x3feb('0x20')],'include':_0x28d1b1[_0x3feb('0x22')]?_[_0x3feb('0x23')](_0x28d1b1['include'],function(_0x4f833a){return{'model':db[_0x4f833a[_0x3feb('0x24')]],'as':_0x4f833a['as'],'attributes':_0x4f833a[_0x3feb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eae68){logger[_0x3feb('0x11')](_0x3feb('0x25'),_0x27cd87);logger[_0x3feb('0x12')](_0x3feb('0x25'),_0x27cd87,JSON['stringify'](_0x2eae68));_0x3bf7fc(_0x2eae68);})[_0x3feb('0x1a')](function(_0x1b4ae1){logger[_0x3feb('0x15')](_0x3feb('0x25'),_0x1b4ae1[_0x3feb('0x17')],_0x27cd87);_0x21be84(_0x2c8703['error'](0x1f4,_0x1b4ae1[_0x3feb('0x17')]));});});};exports[_0x3feb('0x26')]=function(_0x54fcd8,_0x3f33d1,_0x3febbe){var _0x275cbd=this;return new Promise(function(_0x2861de,_0x181623){var _0x4d57b1={'body':_0x54fcd8[_0x3feb('0x27')],'channel':_0x3feb('0x28')};var _0x20ec65=[];var _0x35a851=[];var _0x4e97bd={};return db[_0x3feb('0x29')][_0x3feb('0x2a')]()[_0x3feb('0x10')](function(_0x142294){if(!_0x142294){throw new db['Sequelize'][(_0x3feb('0x2b'))](_0x3feb('0x2c'));}_0x20ec65=_[_0x3feb('0x2d')](_[_0x3feb('0x2e')](_0x142294),[_0x3feb('0x2f'),_0x3feb('0x30')]);_0x35a851=_[_0x3feb('0x2d')](_[_0x3feb('0x2e')](_0x142294),[_0x3feb('0x2f'),'updatedAt',_0x3feb('0x31'),'ListId']);if(_0x54fcd8[_0x3feb('0x27')]['id']){delete _0x54fcd8[_0x3feb('0x27')]['id'];}if(_[_0x3feb('0x32')](_0x54fcd8[_0x3feb('0x27')][_0x3feb('0x33')])){throw new db[(_0x3feb('0x34'))][(_0x3feb('0x2b'))]('from\x20is\x20mandatory');}if(_[_0x3feb('0x32')](_0x54fcd8[_0x3feb('0x27')]['body'])||_0x54fcd8[_0x3feb('0x27')]['body']===''){throw new db[(_0x3feb('0x34'))]['ValidationError'](_0x3feb('0x35'));}if(_[_0x3feb('0x32')](_0x54fcd8[_0x3feb('0x27')]['mapKey'])){throw new db[(_0x3feb('0x34'))][(_0x3feb('0x2b'))](_0x3feb('0x36')+_0x35a851);}if(!_[_0x3feb('0x37')](_0x35a851,_0x54fcd8['body']['mapKey'])){throw new db[(_0x3feb('0x34'))][(_0x3feb('0x2b'))](_0x3feb('0x38')+_0x35a851);}_0x4e97bd[_0x54fcd8['body'][_0x3feb('0x39')]]=_0x54fcd8['body'][_0x3feb('0x33')];})['then'](function(){return db[_0x3feb('0x1b')][_0x3feb('0x3a')]({'where':{'id':_0x54fcd8['account']['id']},'include':[{'model':db[_0x3feb('0x3b')],'as':'List','include':[{'model':db[_0x3feb('0x29')],'as':_0x3feb('0x3c'),'where':_0x4e97bd,'limit':0x1,'order':[['updatedAt',_0x3feb('0x3d')]]}]},{'model':db[_0x3feb('0x3e')],'as':_0x3feb('0x3f')}]});})['then'](function(_0x5ca108){if(_0x5ca108&&_0x5ca108[_0x3feb('0x40')]){var _0x1ef07f=_0x5ca108[_0x3feb('0x41')]({'plain':!![]});_0x4d57b1[_0x3feb('0x42')]=_0x1ef07f;_0x4d57b1[_0x3feb('0x43')]=_0x1ef07f['Applications'];_0x4d57b1['list']=_0x1ef07f[_0x3feb('0x40')];_0x4d57b1['applications']=_[_0x3feb('0x44')](_0x4d57b1[_0x3feb('0x43')],[_0x3feb('0x45')],[_0x3feb('0x46')]);if(_0x4d57b1[_0x3feb('0x42')][_0x3feb('0x3f')]){delete _0x4d57b1['account'][_0x3feb('0x3f')];}if(_0x4d57b1[_0x3feb('0x42')][_0x3feb('0x40')]&&_0x4d57b1[_0x3feb('0x42')][_0x3feb('0x40')]['Contacts'][_0x3feb('0x47')]){return _0x4d57b1[_0x3feb('0x42')][_0x3feb('0x40')][_0x3feb('0x3c')][0x0];}var _0x1c6d13=_['defaults'](_0x54fcd8[_0x3feb('0x27')],{'firstName':_0x54fcd8['body'][_0x3feb('0x33')],'ListId':_0x1ef07f[_0x3feb('0x48')]});_0x1c6d13[_0x54fcd8[_0x3feb('0x27')][_0x3feb('0x39')]]=_0x54fcd8['body']['from'];return db[_0x3feb('0x29')]['create'](_0x1c6d13,{'fields':_0x20ec65,'raw':!![]});}})['then'](function(_0x6af6e){_0x4d57b1[_0x3feb('0x49')]=_0x6af6e;if(_0x6af6e){var _0x2ff972={'ContactId':_0x6af6e['id'],'FaxAccountId':_0x54fcd8[_0x3feb('0x42')]['id'],'fax':_0x6af6e[_0x3feb('0x28')]};return db[_0x3feb('0x4a')][_0x3feb('0x3a')]({'where':{'ContactId':_0x6af6e['id'],'closed':![],'FaxAccountId':_0x54fcd8['account']['id']}})[_0x3feb('0x10')](function(_0x370457){if(_0x370457){return[_0x370457,![]];}return db[_0x3feb('0x4a')][_0x3feb('0x4b')](_0x2ff972)['then'](function(_0x2bb393){return[_0x2bb393,!![]];});});}else{throw new Error(_0x3feb('0x4c'));}})['spread'](function(_0x131641,_0x9bfdb7){var _0x597853=_0x131641[_0x3feb('0x41')]({'plain':!![]});if(_0x9bfdb7){if(_0x4d57b1[_0x3feb('0x42')][_0x3feb('0x4d')]){_0x4d57b1[_0x3feb('0x43')][_0x3feb('0x4e')]({'id':0x0,'priority':_0x4d57b1['applications']['length']+0x1,'app':_0x3feb('0x4f'),'appdata':_0x3feb('0x50'),'interval':'*,*,*,*'});}_0x597853[_0x3feb('0x51')]=!![];}else{_0x597853[_0x3feb('0x51')]=![];}_0x4d57b1[_0x3feb('0x52')]=_0x597853;return db[_0x3feb('0x53')]['create']({'body':_0x54fcd8[_0x3feb('0x27')][_0x3feb('0x27')],'FaxAccountId':_0x54fcd8['account']['id'],'FaxInteractionId':_0x131641['id'],'direction':'in','ContactId':_0x131641[_0x3feb('0x54')],'AttachmentId':_0x54fcd8[_0x3feb('0x27')]['AttachmentId']});})[_0x3feb('0x10')](function(_0x287d4f){_0x4d57b1[_0x3feb('0x17')]=_0x287d4f;if(_0x4d57b1[_0x3feb('0x52')][_0x3feb('0x55')]){return db[_0x3feb('0x56')][_0x3feb('0x3a')]({'attributes':['id','name'],'where':{'id':_0x4d57b1[_0x3feb('0x52')]['UserId']}})[_0x3feb('0x10')](function(_0x10814e){if(_0x10814e){_0x4d57b1[_0x3feb('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3feb('0x57'),'appdata':_0x10814e[_0x3feb('0x58')]+','+(_0x4d57b1[_0x3feb('0x42')][_0x3feb('0x59')]||0xa),'interval':_0x3feb('0x5a')});}return respondWithRpcPromise(_0x3feb('0x5b'),_0x3feb('0x5c'),_0x4d57b1);});}return respondWithRpcPromise(_0x3feb('0x5b'),_0x3feb('0x5c'),_0x4d57b1);})[_0x3feb('0x10')](function(_0x2917e1){_0x2861de(_0x2917e1);})[_0x3feb('0x1a')](function(_0x4dc7f9){_0x181623(_0x275cbd[_0x3feb('0x15')](0x1f4,_0x4dc7f9['message']));});});}; \ No newline at end of file +var _0x0e5c=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','where','attributes','limit','map','include','model','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','Contacts','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','contact','fax','FaxInteraction','create','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird'];(function(_0x450890,_0x46ef58){var _0x1d44ac=function(_0x17481c){while(--_0x17481c){_0x450890['push'](_0x450890['shift']());}};_0x1d44ac(++_0x46ef58);}(_0x0e5c,0x1d3));var _0xc0e5=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x0e5c[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require(_0xc0e5('0x0'));var util=require('util');var moment=require(_0xc0e5('0x1'));var BPromise=require(_0xc0e5('0x2'));var rs=require(_0xc0e5('0x3'));var fs=require('fs');var Redis=require(_0xc0e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0e5('0x5'));var logger=require(_0xc0e5('0x6'))(_0xc0e5('0x7'));var config=require(_0xc0e5('0x8'));var jayson=require(_0xc0e5('0x9'));var client=jayson['client'][_0xc0e5('0xa')]({'port':0x232c});config[_0xc0e5('0xb')]=_[_0xc0e5('0xc')](config['redis'],{'host':_0xc0e5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc0e5('0xe'))[_0xc0e5('0xf')](socket);function respondWithRpcPromise(_0x390306,_0x26b217,_0x4ab2bc){return new BPromise(function(_0x591b89,_0x3e62b1){return client[_0xc0e5('0x10')](_0x390306,_0x4ab2bc)[_0xc0e5('0x11')](function(_0x2306ee){logger[_0xc0e5('0x12')](_0xc0e5('0x13'),_0x26b217,_0xc0e5('0x14'));logger[_0xc0e5('0x15')](_0xc0e5('0x16'),_0x26b217,_0xc0e5('0x14'),JSON[_0xc0e5('0x17')](_0x2306ee));if(_0x2306ee[_0xc0e5('0x18')]){if(_0x2306ee[_0xc0e5('0x18')][_0xc0e5('0x19')]===0x1f4){logger[_0xc0e5('0x18')](_0xc0e5('0x13'),_0x26b217,_0x2306ee[_0xc0e5('0x18')][_0xc0e5('0x1a')]);return _0x3e62b1(_0x2306ee[_0xc0e5('0x18')][_0xc0e5('0x1a')]);}logger[_0xc0e5('0x18')](_0xc0e5('0x13'),_0x26b217,_0x2306ee[_0xc0e5('0x18')]['message']);return _0x591b89(_0x2306ee[_0xc0e5('0x18')]['message']);}else{logger[_0xc0e5('0x12')]('FaxAccount,\x20%s,\x20%s',_0x26b217,'request\x20sent');_0x591b89(_0x2306ee[_0xc0e5('0x1b')][_0xc0e5('0x1a')]);}})[_0xc0e5('0x1c')](function(_0x301e06){logger[_0xc0e5('0x18')](_0xc0e5('0x13'),_0x26b217,_0x301e06);_0x3e62b1(_0x301e06);});});}exports[_0xc0e5('0x1d')]=function(_0x555357){var _0x6a4696=this;return new Promise(function(_0xb41cf,_0x2e38f6){return db['FaxAccount'][_0xc0e5('0x1e')]({'raw':_0x555357[_0xc0e5('0x1f')]?_0x555357['options']['raw']===undefined?!![]:![]:!![],'where':_0x555357['options']?_0x555357['options'][_0xc0e5('0x20')]||null:null,'attributes':_0x555357['options']?_0x555357[_0xc0e5('0x1f')][_0xc0e5('0x21')]||null:null,'limit':_0x555357[_0xc0e5('0x1f')]?_0x555357[_0xc0e5('0x1f')][_0xc0e5('0x22')]||null:null,'include':_0x555357[_0xc0e5('0x1f')]?_0x555357[_0xc0e5('0x1f')]['include']?_[_0xc0e5('0x23')](_0x555357['options'][_0xc0e5('0x24')],function(_0x361951){return{'model':db[_0x361951[_0xc0e5('0x25')]],'as':_0x361951['as'],'attributes':_0x361951[_0xc0e5('0x21')],'include':_0x361951[_0xc0e5('0x24')]?_[_0xc0e5('0x23')](_0x361951[_0xc0e5('0x24')],function(_0x43d2c5){return{'model':db[_0x43d2c5[_0xc0e5('0x25')]],'as':_0x43d2c5['as'],'attributes':_0x43d2c5[_0xc0e5('0x21')],'include':_0x43d2c5['include']?_[_0xc0e5('0x23')](_0x43d2c5[_0xc0e5('0x24')],function(_0x4be149){return{'model':db[_0x4be149[_0xc0e5('0x25')]],'as':_0x4be149['as'],'attributes':_0x4be149[_0xc0e5('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc0e5('0x11')](function(_0x28f305){logger[_0xc0e5('0x12')](_0xc0e5('0x1d'),_0x555357);logger['debug'](_0xc0e5('0x1d'),_0x555357,JSON[_0xc0e5('0x17')](_0x28f305));_0xb41cf(_0x28f305);})[_0xc0e5('0x1c')](function(_0x2ec3d4){logger[_0xc0e5('0x18')](_0xc0e5('0x1d'),_0x2ec3d4[_0xc0e5('0x1a')],_0x555357);_0x2e38f6(_0x6a4696[_0xc0e5('0x18')](0x1f4,_0x2ec3d4['message']));});});};exports[_0xc0e5('0x26')]=function(_0x41a477,_0x3bae2a,_0x38bca5){var _0x308a5a=this;return new Promise(function(_0x3bae68,_0x41988b){var _0x558868={'body':_0x41a477[_0xc0e5('0x27')],'channel':'fax'};var _0x2ed2a2=[];var _0x45a171=[];var _0x48a1bc={};return db[_0xc0e5('0x28')][_0xc0e5('0x29')]()[_0xc0e5('0x11')](function(_0x5a4bad){if(!_0x5a4bad){throw new db[(_0xc0e5('0x2a'))][(_0xc0e5('0x2b'))](_0xc0e5('0x2c'));}_0x2ed2a2=_[_0xc0e5('0x2d')](_[_0xc0e5('0x2e')](_0x5a4bad),[_0xc0e5('0x2f'),_0xc0e5('0x30')]);_0x45a171=_[_0xc0e5('0x2d')](_['keys'](_0x5a4bad),[_0xc0e5('0x2f'),_0xc0e5('0x30'),'CompanyId',_0xc0e5('0x31')]);if(_0x41a477['body']['id']){delete _0x41a477['body']['id'];}if(_[_0xc0e5('0x32')](_0x41a477['body'][_0xc0e5('0x33')])){throw new db['Sequelize'][(_0xc0e5('0x2b'))](_0xc0e5('0x34'));}if(_[_0xc0e5('0x32')](_0x41a477['body']['body'])||_0x41a477[_0xc0e5('0x27')][_0xc0e5('0x27')]===''){throw new db[(_0xc0e5('0x2a'))][(_0xc0e5('0x2b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc0e5('0x32')](_0x41a477[_0xc0e5('0x27')]['mapKey'])){throw new db[(_0xc0e5('0x2a'))][(_0xc0e5('0x2b'))](_0xc0e5('0x35')+_0x45a171);}if(!_[_0xc0e5('0x36')](_0x45a171,_0x41a477[_0xc0e5('0x27')][_0xc0e5('0x37')])){throw new db[(_0xc0e5('0x2a'))][(_0xc0e5('0x2b'))](_0xc0e5('0x38')+_0x45a171);}_0x48a1bc[_0x41a477[_0xc0e5('0x27')]['mapKey']]=_0x41a477[_0xc0e5('0x27')][_0xc0e5('0x33')];})[_0xc0e5('0x11')](function(){return db[_0xc0e5('0x39')][_0xc0e5('0x3a')]({'where':{'id':_0x41a477[_0xc0e5('0x3b')]['id']},'include':[{'model':db[_0xc0e5('0x3c')],'as':_0xc0e5('0x3d'),'include':[{'model':db['CmContact'],'as':_0xc0e5('0x3e'),'where':_0x48a1bc,'limit':0x1,'order':[[_0xc0e5('0x30'),'DESC']]}]},{'model':db[_0xc0e5('0x3f')],'as':_0xc0e5('0x40')}]});})[_0xc0e5('0x11')](function(_0x2d8cef){if(_0x2d8cef&&_0x2d8cef[_0xc0e5('0x3d')]){var _0x5266e2=_0x2d8cef[_0xc0e5('0x41')]({'plain':!![]});_0x558868[_0xc0e5('0x3b')]=_0x5266e2;_0x558868[_0xc0e5('0x42')]=_0x5266e2[_0xc0e5('0x40')];_0x558868[_0xc0e5('0x43')]=_0x5266e2[_0xc0e5('0x3d')];_0x558868[_0xc0e5('0x42')]=_[_0xc0e5('0x44')](_0x558868[_0xc0e5('0x42')],[_0xc0e5('0x45')],[_0xc0e5('0x46')]);if(_0x558868[_0xc0e5('0x3b')][_0xc0e5('0x40')]){delete _0x558868[_0xc0e5('0x3b')]['Applications'];}if(_0x558868[_0xc0e5('0x3b')][_0xc0e5('0x3d')]&&_0x558868['account'][_0xc0e5('0x3d')][_0xc0e5('0x3e')][_0xc0e5('0x47')]){return _0x558868[_0xc0e5('0x3b')][_0xc0e5('0x3d')]['Contacts'][0x0];}var _0x13c617=_[_0xc0e5('0xc')](_0x41a477[_0xc0e5('0x27')],{'firstName':_0x41a477['body'][_0xc0e5('0x33')],'ListId':_0x5266e2['ListId']});_0x13c617[_0x41a477['body']['mapKey']]=_0x41a477[_0xc0e5('0x27')][_0xc0e5('0x33')];return db[_0xc0e5('0x28')]['create'](_0x13c617,{'fields':_0x2ed2a2,'raw':!![]});}})[_0xc0e5('0x11')](function(_0xda9f76){_0x558868[_0xc0e5('0x48')]=_0xda9f76;if(_0xda9f76){var _0x3e42f8={'ContactId':_0xda9f76['id'],'FaxAccountId':_0x41a477[_0xc0e5('0x3b')]['id'],'fax':_0xda9f76[_0xc0e5('0x49')]};return db['FaxInteraction'][_0xc0e5('0x3a')]({'where':{'ContactId':_0xda9f76['id'],'closed':![],'FaxAccountId':_0x41a477[_0xc0e5('0x3b')]['id']}})[_0xc0e5('0x11')](function(_0x212a73){if(_0x212a73){return[_0x212a73,![]];}return db[_0xc0e5('0x4a')][_0xc0e5('0x4b')](_0x3e42f8)['then'](function(_0x27217c){return[_0x27217c,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xc0e5('0x4c')](function(_0x20c282,_0x30a8cd){var _0x14a9f0=_0x20c282[_0xc0e5('0x41')]({'plain':!![]});if(_0x30a8cd){if(_0x558868[_0xc0e5('0x3b')][_0xc0e5('0x4d')]){_0x558868[_0xc0e5('0x42')][_0xc0e5('0x4e')]({'id':0x0,'priority':_0x558868[_0xc0e5('0x42')][_0xc0e5('0x47')]+0x1,'app':'close','appdata':_0xc0e5('0x4f'),'interval':_0xc0e5('0x50')});}_0x14a9f0[_0xc0e5('0x51')]=!![];}else{_0x14a9f0[_0xc0e5('0x51')]=![];}_0x558868[_0xc0e5('0x52')]=_0x14a9f0;return db[_0xc0e5('0x53')][_0xc0e5('0x4b')]({'body':_0x41a477['body'][_0xc0e5('0x27')],'FaxAccountId':_0x41a477[_0xc0e5('0x3b')]['id'],'FaxInteractionId':_0x20c282['id'],'direction':'in','ContactId':_0x20c282[_0xc0e5('0x54')],'AttachmentId':_0x41a477[_0xc0e5('0x27')][_0xc0e5('0x55')]});})['then'](function(_0x222d93){_0x558868[_0xc0e5('0x1a')]=_0x222d93;if(_0x558868[_0xc0e5('0x52')][_0xc0e5('0x56')]){return db[_0xc0e5('0x57')][_0xc0e5('0x3a')]({'attributes':['id','name'],'where':{'id':_0x558868[_0xc0e5('0x52')][_0xc0e5('0x56')]}})[_0xc0e5('0x11')](function(_0x2de7a5){if(_0x2de7a5){_0x558868[_0xc0e5('0x42')][_0xc0e5('0x58')]({'id':0x0,'priority':0x0,'app':_0xc0e5('0x59'),'appdata':_0x2de7a5[_0xc0e5('0x5a')]+','+(_0x558868[_0xc0e5('0x3b')][_0xc0e5('0x5b')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc0e5('0x5c'),_0xc0e5('0x5d'),_0x558868);});}return respondWithRpcPromise(_0xc0e5('0x5c'),_0xc0e5('0x5d'),_0x558868);})['then'](function(_0x4ee834){_0x3bae68(_0x4ee834);})['catch'](function(_0xa516cf){_0x41988b(_0x308a5a[_0xc0e5('0x18')](0x1f4,_0xa516cf['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0b8be25..44ad233 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 _0xbff5=['register','length','faxAccount:','./faxAccount.events','save','remove','update'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xbff5,0x1bc));var _0x5bff=function(_0x3cbd9d,_0x3a74c4){_0x3cbd9d=_0x3cbd9d-0x0;var _0x38abfb=_0xbff5[_0x3cbd9d];return _0x38abfb;};'use strict';var FaxAccountEvents=require(_0x5bff('0x0'));var events=[_0x5bff('0x1'),_0x5bff('0x2'),_0x5bff('0x3')];function createListener(_0x41c38b,_0x43a41b){return function(_0x3bd90c){_0x43a41b['emit'](_0x41c38b,_0x3bd90c);};}function removeListener(_0x3868ae,_0x486083){return function(){FaxAccountEvents['removeListener'](_0x3868ae,_0x486083);};}exports[_0x5bff('0x4')]=function(_0x1d8650){for(var _0x151add=0x0,_0xa54c57=events[_0x5bff('0x5')];_0x151add<_0xa54c57;_0x151add++){var _0xd4b9dc=events[_0x151add];var _0x1acb49=createListener(_0x5bff('0x6')+_0xd4b9dc,_0x1d8650);FaxAccountEvents['on'](_0xd4b9dc,_0x1acb49);}}; \ No newline at end of file +var _0x0adf=['emit','removeListener','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x5979b1,_0x496849){var _0x38c40c=function(_0x17a047){while(--_0x17a047){_0x5979b1['push'](_0x5979b1['shift']());}};_0x38c40c(++_0x496849);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x453527,_0x7bd731){_0x453527=_0x453527-0x0;var _0x279f31=_0x0adf[_0x453527];return _0x279f31;};'use strict';var FaxAccountEvents=require(_0xf0ad('0x0'));var events=[_0xf0ad('0x1'),_0xf0ad('0x2'),'update'];function createListener(_0x4a97fd,_0x10cf5b){return function(_0x5d1191){_0x10cf5b[_0xf0ad('0x3')](_0x4a97fd,_0x5d1191);};}function removeListener(_0x27d666,_0x459e70){return function(){FaxAccountEvents[_0xf0ad('0x4')](_0x27d666,_0x459e70);};}exports['register']=function(_0x3bbf85){for(var _0x53221f=0x0,_0x2eca0e=events[_0xf0ad('0x5')];_0x53221f<_0x2eca0e;_0x53221f++){var _0x170574=events[_0x53221f];var _0x41c99d=createListener(_0xf0ad('0x6')+_0x170574,_0x3bbf85);FaxAccountEvents['on'](_0x170574,_0x41c99d);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index a2bb916..262eaa2 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 _0x7b45=['/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','post','create','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','update','delete','destroy','removeDispositions','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x480455,_0x449bb4){var _0x9105e4=function(_0xd6fdcd){while(--_0xd6fdcd){_0x480455['push'](_0x480455['shift']());}};_0x9105e4(++_0x449bb4);}(_0x7b45,0xaa));var _0x57b4=function(_0x5811c9,_0x53aa8c){_0x5811c9=_0x5811c9-0x0;var _0x353260=_0x7b45[_0x5811c9];return _0x353260;};'use strict';var multer=require('multer');var util=require(_0x57b4('0x0'));var path=require(_0x57b4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x57b4('0x2')]();var auth=require(_0x57b4('0x3'));var interaction=require(_0x57b4('0x4'));var config=require(_0x57b4('0x5'));var controller=require('./faxAccount.controller');router[_0x57b4('0x6')]('/',auth[_0x57b4('0x7')](),controller[_0x57b4('0x8')]);router[_0x57b4('0x6')]('/describe',auth[_0x57b4('0x7')](),controller[_0x57b4('0x9')]);router[_0x57b4('0x6')](_0x57b4('0xa'),auth[_0x57b4('0x7')](),controller[_0x57b4('0xb')]);router[_0x57b4('0x6')](_0x57b4('0xc'),auth[_0x57b4('0x7')](),controller['getDispositions']);router[_0x57b4('0x6')](_0x57b4('0xd'),auth[_0x57b4('0x7')](),controller[_0x57b4('0xe')]);router[_0x57b4('0x6')](_0x57b4('0xf'),auth['isAuthenticated'](),controller[_0x57b4('0x10')]);router[_0x57b4('0x6')](_0x57b4('0x11'),auth[_0x57b4('0x7')](),controller[_0x57b4('0x12')]);router[_0x57b4('0x6')](_0x57b4('0x13'),auth[_0x57b4('0x7')](),controller[_0x57b4('0x14')]);router[_0x57b4('0x6')](_0x57b4('0x15'),auth['isAuthenticated'](),controller[_0x57b4('0x16')]);router[_0x57b4('0x17')]('/',auth[_0x57b4('0x7')](),controller[_0x57b4('0x18')]);router[_0x57b4('0x17')](_0x57b4('0xc'),auth[_0x57b4('0x7')](),controller['addDisposition']);router[_0x57b4('0x17')](_0x57b4('0xd'),auth[_0x57b4('0x7')](),controller['addAnswer']);router[_0x57b4('0x17')]('/:id/interactions',auth[_0x57b4('0x7')](),controller[_0x57b4('0x19')]);router[_0x57b4('0x17')]('/:id/applications',auth[_0x57b4('0x7')](),controller[_0x57b4('0x1a')]);router[_0x57b4('0x17')](_0x57b4('0x1b'),auth[_0x57b4('0x7')](),controller[_0x57b4('0x1c')]);router[_0x57b4('0x17')](_0x57b4('0x1d'),auth[_0x57b4('0x7')](),controller['updateAccountApplications']);router[_0x57b4('0x17')](_0x57b4('0x1e'),auth[_0x57b4('0x7')](),controller['send']);router['post'](_0x57b4('0x15'),auth[_0x57b4('0x7')](),controller['addAgents']);router['put'](_0x57b4('0xa'),auth[_0x57b4('0x7')](),controller[_0x57b4('0x1f')]);router[_0x57b4('0x20')](_0x57b4('0xa'),auth[_0x57b4('0x7')](),controller[_0x57b4('0x21')]);router[_0x57b4('0x20')](_0x57b4('0xc'),auth[_0x57b4('0x7')](),controller[_0x57b4('0x22')]);router[_0x57b4('0x20')](_0x57b4('0xd'),auth[_0x57b4('0x7')](),controller['removeAnswers']);router[_0x57b4('0x20')](_0x57b4('0x15'),auth[_0x57b4('0x7')](),controller['removeAgents']);module[_0x57b4('0x23')]=router; \ No newline at end of file +var _0x98e1=['addAgents','/:id','delete','destroy','removeDispositions','removeAnswers','multer','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','/describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications','/updateaccountapplications','/:id/send','send'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x98e1,0x6c));var _0x198e=function(_0x410e28,_0x3a3f9d){_0x410e28=_0x410e28-0x0;var _0x3edf22=_0x98e1[_0x410e28];return _0x3edf22;};'use strict';var multer=require(_0x198e('0x0'));var util=require(_0x198e('0x1'));var path=require('path');var timeout=require(_0x198e('0x2'));var express=require(_0x198e('0x3'));var router=express[_0x198e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x198e('0x5'));var controller=require('./faxAccount.controller');router[_0x198e('0x6')]('/',auth[_0x198e('0x7')](),controller['index']);router[_0x198e('0x6')](_0x198e('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x198e('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x198e('0x9')]);router[_0x198e('0x6')](_0x198e('0xa'),auth[_0x198e('0x7')](),controller[_0x198e('0xb')]);router[_0x198e('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x198e('0xc')]);router[_0x198e('0x6')](_0x198e('0xd'),auth[_0x198e('0x7')](),controller['getInteractions']);router[_0x198e('0x6')](_0x198e('0xe'),auth[_0x198e('0x7')](),controller[_0x198e('0xf')]);router[_0x198e('0x6')]('/:id/messages',auth[_0x198e('0x7')](),controller[_0x198e('0x10')]);router[_0x198e('0x6')](_0x198e('0x11'),auth[_0x198e('0x7')](),controller[_0x198e('0x12')]);router[_0x198e('0x13')]('/',auth[_0x198e('0x7')](),controller[_0x198e('0x14')]);router[_0x198e('0x13')](_0x198e('0xa'),auth[_0x198e('0x7')](),controller['addDisposition']);router[_0x198e('0x13')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x198e('0x15')]);router[_0x198e('0x13')](_0x198e('0xd'),auth[_0x198e('0x7')](),controller[_0x198e('0x16')]);router['post'](_0x198e('0xe'),auth['isAuthenticated'](),controller[_0x198e('0x17')]);router[_0x198e('0x13')](_0x198e('0x18'),auth['isAuthenticated'](),controller['addAccountApplications']);router[_0x198e('0x13')](_0x198e('0x19'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x198e('0x13')](_0x198e('0x1a'),auth[_0x198e('0x7')](),controller[_0x198e('0x1b')]);router[_0x198e('0x13')]('/:id/users',auth[_0x198e('0x7')](),controller[_0x198e('0x1c')]);router['put'](_0x198e('0x1d'),auth['isAuthenticated'](),controller['update']);router[_0x198e('0x1e')]('/:id',auth[_0x198e('0x7')](),controller[_0x198e('0x1f')]);router[_0x198e('0x1e')]('/:id/dispositions',auth[_0x198e('0x7')](),controller[_0x198e('0x20')]);router[_0x198e('0x1e')]('/:id/canned_answers',auth[_0x198e('0x7')](),controller[_0x198e('0x21')]);router[_0x198e('0x1e')](_0x198e('0x11'),auth[_0x198e('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index b8444c7..2450826 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 _0xd4ad=['exports','INTEGER','STRING','TEXT','sequelize'];(function(_0x2c96f6,_0x877207){var _0x6d4808=function(_0x567e0c){while(--_0x567e0c){_0x2c96f6['push'](_0x2c96f6['shift']());}};_0x6d4808(++_0x877207);}(_0xd4ad,0x158));var _0xdd4a=function(_0x1cab81,_0x4a7407){_0x1cab81=_0x1cab81-0x0;var _0x5a45d5=_0xd4ad[_0x1cab81];return _0x5a45d5;};'use strict';var Sequelize=require(_0xdd4a('0x0'));module[_0xdd4a('0x1')]={'priority':{'type':Sequelize[_0xdd4a('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdd4a('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xdd4a('0x4')]()},'description':{'type':Sequelize[_0xdd4a('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1ab1=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ab1,0x12c));var _0x11ab=function(_0x4cb618,_0x3226c8){_0x4cb618=_0x4cb618-0x0;var _0x49570a=_0x1ab1[_0x4cb618];return _0x49570a;};'use strict';var Sequelize=require(_0x11ab('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x11ab('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x11ab('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e1a613c..6d04748 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 _0x25d1=['fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','findAll','show','params','keys','catch','update','body','html-pdf','rimraf','zip-dir'];(function(_0x2b9cf5,_0x2a7804){var _0xd0cf15=function(_0x92a896){while(--_0x92a896){_0x2b9cf5['push'](_0x2b9cf5['shift']());}};_0xd0cf15(++_0x2a7804);}(_0x25d1,0x14c));var _0x125d=function(_0x4ee799,_0x22e2c2){_0x4ee799=_0x4ee799-0x0;var _0x26fe5b=_0x25d1[_0x4ee799];return _0x26fe5b;};'use strict';var pdf=require(_0x125d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x125d('0x1'));var zipdir=require(_0x125d('0x2'));var jsonpatch=require(_0x125d('0x3'));var rp=require('request-promise');var moment=require(_0x125d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x125d('0x5'));var util=require(_0x125d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x125d('0x7'));var ejs=require(_0x125d('0x8'));var fs=require('fs');var _=require(_0x125d('0x9'));var squel=require(_0x125d('0xa'));var crypto=require(_0x125d('0xb'));var jsforce=require(_0x125d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x125d('0x7'));var querystring=require('querystring');var Papa=require(_0x125d('0xd'));var Redis=require(_0x125d('0xe'));var authService=require(_0x125d('0xf'));var qs=require(_0x125d('0x10'));var as=require(_0x125d('0x11'));var hardwareService=require(_0x125d('0x12'));var logger=require(_0x125d('0x13'))('api');var utils=require(_0x125d('0x14'));var config=require(_0x125d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x125d('0x16'))['db'];function respondWithStatusCode(_0x1da835,_0x401397){_0x401397=_0x401397||0xcc;return function(_0x31bc4a){if(_0x31bc4a){return _0x1da835[_0x125d('0x17')](_0x401397);}return _0x1da835[_0x125d('0x18')](_0x401397)[_0x125d('0x19')]();};}function respondWithResult(_0x155cdf,_0x32d5e8){_0x32d5e8=_0x32d5e8||0xc8;return function(_0x39b501){if(_0x39b501){return _0x155cdf['status'](_0x32d5e8)['json'](_0x39b501);}};}function respondWithFilteredResult(_0x47700f,_0x3cb6ca){return function(_0x4f0efb){if(_0x4f0efb){var _0x1a4d8a=_0x4f0efb[_0x125d('0x1a')],_0x4ea90d=_0x3cb6ca[_0x125d('0x1b')],_0x190d95=_0x3cb6ca[_0x125d('0x1b')]+_0x3cb6ca[_0x125d('0x1c')],_0x1103a5;if(_0x190d95>=_0x1a4d8a){_0x190d95=_0x1a4d8a;_0x1103a5=0xc8;}else{_0x1103a5=0xce;}_0x47700f['status'](_0x1103a5);return _0x47700f[_0x125d('0x1d')](_0x125d('0x1e'),_0x4ea90d+'-'+_0x190d95+'/'+_0x1a4d8a)['json'](_0x4f0efb);}return null;};}function patchUpdates(_0x5b1482){return function(_0x1473b0){try{jsonpatch[_0x125d('0x1f')](_0x1473b0,_0x5b1482,!![]);}catch(_0xe4fdc5){return BPromise['reject'](_0xe4fdc5);}return _0x1473b0[_0x125d('0x20')]();};}function saveUpdates(_0x458870,_0x3c0b4e){return function(_0x130137){if(_0x130137){return _0x130137['update'](_0x458870)[_0x125d('0x21')](function(_0x30b7a2){return _0x30b7a2;});}return null;};}function removeEntity(_0x11c9ae,_0x41cba6){return function(_0x130e5e){if(_0x130e5e){return _0x130e5e[_0x125d('0x22')]()['then'](function(){_0x11c9ae['status'](0xcc)[_0x125d('0x19')]();});}};}function handleEntityNotFound(_0x4ec572,_0x598fef){return function(_0x4b2aa6){if(!_0x4b2aa6){_0x4ec572['sendStatus'](0x194);}return _0x4b2aa6;};}function handleError(_0x4ae2e4,_0x2273c3){_0x2273c3=_0x2273c3||0x1f4;return function(_0x1ed154){logger[_0x125d('0x23')](_0x1ed154[_0x125d('0x24')]);if(_0x1ed154[_0x125d('0x25')]){delete _0x1ed154[_0x125d('0x25')];}_0x4ae2e4[_0x125d('0x18')](_0x2273c3)[_0x125d('0x26')](_0x1ed154);};}exports[_0x125d('0x27')]=function(_0x17ae02,_0x25a915){var _0x3d2fd3={},_0x43c209={},_0x620a8={'count':0x0,'rows':[]};var _0x41872e=_[_0x125d('0x28')](db[_0x125d('0x29')][_0x125d('0x2a')],function(_0xaeedaa){return{'name':_0xaeedaa[_0x125d('0x2b')],'type':_0xaeedaa['type']['key']};});_0x43c209[_0x125d('0x2c')]=_[_0x125d('0x28')](_0x41872e,_0x125d('0x25'));_0x43c209[_0x125d('0x2d')]=_['keys'](_0x17ae02[_0x125d('0x2d')]);_0x43c209[_0x125d('0x2e')]=_[_0x125d('0x2f')](_0x43c209[_0x125d('0x2c')],_0x43c209[_0x125d('0x2d')]);_0x3d2fd3[_0x125d('0x30')]=_[_0x125d('0x2f')](_0x43c209[_0x125d('0x2c')],qs['fields'](_0x17ae02[_0x125d('0x2d')][_0x125d('0x31')]));_0x3d2fd3['attributes']=_0x3d2fd3[_0x125d('0x30')][_0x125d('0x32')]?_0x3d2fd3[_0x125d('0x30')]:_0x43c209[_0x125d('0x2c')];if(!_0x17ae02[_0x125d('0x2d')][_0x125d('0x33')](_0x125d('0x34'))){_0x3d2fd3['limit']=qs[_0x125d('0x1c')](_0x17ae02[_0x125d('0x2d')][_0x125d('0x1c')]);_0x3d2fd3[_0x125d('0x1b')]=qs[_0x125d('0x1b')](_0x17ae02[_0x125d('0x2d')][_0x125d('0x1b')]);}_0x3d2fd3[_0x125d('0x35')]=qs[_0x125d('0x36')](_0x17ae02[_0x125d('0x2d')][_0x125d('0x36')]);_0x3d2fd3[_0x125d('0x37')]=qs[_0x125d('0x2e')](_['pick'](_0x17ae02[_0x125d('0x2d')],_0x43c209[_0x125d('0x2e')]),_0x41872e);if(_0x17ae02[_0x125d('0x2d')][_0x125d('0x38')]){_0x3d2fd3[_0x125d('0x37')]=_[_0x125d('0x39')](_0x3d2fd3[_0x125d('0x37')],{'$or':_[_0x125d('0x28')](_0x41872e,function(_0x5c84e9){if(_0x5c84e9[_0x125d('0x3a')]!=='VIRTUAL'){var _0x32dc26={};_0x32dc26[_0x5c84e9[_0x125d('0x25')]]={'$like':'%'+_0x17ae02[_0x125d('0x2d')][_0x125d('0x38')]+'%'};return _0x32dc26;}})});}_0x3d2fd3=_[_0x125d('0x39')]({},_0x3d2fd3,_0x17ae02['options']);var _0x5203d8={'where':_0x3d2fd3[_0x125d('0x37')]};return db['FaxApplication'][_0x125d('0x1a')](_0x5203d8)[_0x125d('0x21')](function(_0xdb39f9){_0x620a8['count']=_0xdb39f9;if(_0x17ae02[_0x125d('0x2d')][_0x125d('0x3b')]){_0x3d2fd3['include']=[{'all':!![]}];}return db[_0x125d('0x29')][_0x125d('0x3c')](_0x3d2fd3);})['then'](function(_0x581a0c){_0x620a8['rows']=_0x581a0c;return _0x620a8;})[_0x125d('0x21')](respondWithFilteredResult(_0x25a915,_0x3d2fd3))['catch'](handleError(_0x25a915,null));};exports[_0x125d('0x3d')]=function(_0x47a756,_0x477dae){var _0x42b015={'raw':!![],'where':{'id':_0x47a756[_0x125d('0x3e')]['id']}},_0x1446e9={};_0x1446e9[_0x125d('0x2c')]=_[_0x125d('0x3f')](db[_0x125d('0x29')][_0x125d('0x2a')]);_0x1446e9[_0x125d('0x2d')]=_[_0x125d('0x3f')](_0x47a756['query']);_0x1446e9[_0x125d('0x2e')]=_[_0x125d('0x2f')](_0x1446e9[_0x125d('0x2c')],_0x1446e9[_0x125d('0x2d')]);_0x42b015['attributes']=_[_0x125d('0x2f')](_0x1446e9['model'],qs[_0x125d('0x31')](_0x47a756[_0x125d('0x2d')][_0x125d('0x31')]));_0x42b015['attributes']=_0x42b015[_0x125d('0x30')][_0x125d('0x32')]?_0x42b015[_0x125d('0x30')]:_0x1446e9['model'];if(_0x47a756[_0x125d('0x2d')]['includeAll']){_0x42b015['include']=[{'all':!![]}];}_0x42b015=_[_0x125d('0x39')]({},_0x42b015,_0x47a756['options']);return db[_0x125d('0x29')]['find'](_0x42b015)[_0x125d('0x21')](handleEntityNotFound(_0x477dae,null))[_0x125d('0x21')](respondWithResult(_0x477dae,null))['catch'](handleError(_0x477dae,null));};exports['create']=function(_0x5513d1,_0x169a4f){return db['FaxApplication']['create'](_0x5513d1['body'],{})[_0x125d('0x21')](respondWithResult(_0x169a4f,0xc9))[_0x125d('0x40')](handleError(_0x169a4f,null));};exports[_0x125d('0x41')]=function(_0x437379,_0x249aae){if(_0x437379[_0x125d('0x42')]['id']){delete _0x437379['body']['id'];}return db[_0x125d('0x29')]['find']({'where':{'id':_0x437379[_0x125d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x249aae,null))[_0x125d('0x21')](saveUpdates(_0x437379['body'],null))[_0x125d('0x21')](respondWithResult(_0x249aae,null))[_0x125d('0x40')](handleError(_0x249aae,null));};exports[_0x125d('0x22')]=function(_0x2127c0,_0x51ace7){return db[_0x125d('0x29')]['find']({'where':{'id':_0x2127c0['params']['id']}})[_0x125d('0x21')](handleEntityNotFound(_0x51ace7,null))[_0x125d('0x21')](removeEntity(_0x51ace7,null))[_0x125d('0x40')](handleError(_0x51ace7,null));}; \ No newline at end of file +var _0x2a95=['length','find','body','params','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','save','update','then','destroy','error','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys'];(function(_0x10c75c,_0x367181){var _0x3f9e6d=function(_0x4618a9){while(--_0x4618a9){_0x10c75c['push'](_0x10c75c['shift']());}};_0x3f9e6d(++_0x367181);}(_0x2a95,0x1c0));var _0x52a9=function(_0x2d967d,_0x31e8c6){_0x2d967d=_0x2d967d-0x0;var _0x2a0950=_0x2a95[_0x2d967d];return _0x2a0950;};'use strict';var pdf=require(_0x52a9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x52a9('0x1'));var zipdir=require(_0x52a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52a9('0x3'));var moment=require(_0x52a9('0x4'));var BPromise=require(_0x52a9('0x5'));var Mustache=require(_0x52a9('0x6'));var util=require('util');var path=require(_0x52a9('0x7'));var sox=require(_0x52a9('0x8'));var csv=require(_0x52a9('0x9'));var ejs=require(_0x52a9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x52a9('0xb'));var crypto=require(_0x52a9('0xc'));var jsforce=require(_0x52a9('0xd'));var deskjs=require(_0x52a9('0xe'));var toCsv=require(_0x52a9('0x9'));var querystring=require(_0x52a9('0xf'));var Papa=require(_0x52a9('0x10'));var Redis=require(_0x52a9('0x11'));var authService=require(_0x52a9('0x12'));var qs=require(_0x52a9('0x13'));var as=require(_0x52a9('0x14'));var hardwareService=require(_0x52a9('0x15'));var logger=require('../../config/logger')(_0x52a9('0x16'));var utils=require(_0x52a9('0x17'));var config=require(_0x52a9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x52a9('0x19'))['db'];function respondWithStatusCode(_0x1c4cf8,_0x1c588c){_0x1c588c=_0x1c588c||0xcc;return function(_0x17ab98){if(_0x17ab98){return _0x1c4cf8[_0x52a9('0x1a')](_0x1c588c);}return _0x1c4cf8['status'](_0x1c588c)[_0x52a9('0x1b')]();};}function respondWithResult(_0x3a5579,_0x2e7821){_0x2e7821=_0x2e7821||0xc8;return function(_0x2100f1){if(_0x2100f1){return _0x3a5579[_0x52a9('0x1c')](_0x2e7821)[_0x52a9('0x1d')](_0x2100f1);}};}function respondWithFilteredResult(_0x4da349,_0x4a2cfc){return function(_0x4f8ede){if(_0x4f8ede){var _0x3cf583=_0x4f8ede['count'],_0x35b307=_0x4a2cfc[_0x52a9('0x1e')],_0x2de1b4=_0x4a2cfc[_0x52a9('0x1e')]+_0x4a2cfc[_0x52a9('0x1f')],_0x1540f3;if(_0x2de1b4>=_0x3cf583){_0x2de1b4=_0x3cf583;_0x1540f3=0xc8;}else{_0x1540f3=0xce;}_0x4da349[_0x52a9('0x1c')](_0x1540f3);return _0x4da349[_0x52a9('0x20')](_0x52a9('0x21'),_0x35b307+'-'+_0x2de1b4+'/'+_0x3cf583)['json'](_0x4f8ede);}return null;};}function patchUpdates(_0x181c6a){return function(_0x3bc195){try{jsonpatch['apply'](_0x3bc195,_0x181c6a,!![]);}catch(_0x4a0fc0){return BPromise['reject'](_0x4a0fc0);}return _0x3bc195[_0x52a9('0x22')]();};}function saveUpdates(_0x58fda9,_0x9ac184){return function(_0x4805ef){if(_0x4805ef){return _0x4805ef[_0x52a9('0x23')](_0x58fda9)[_0x52a9('0x24')](function(_0x375b7f){return _0x375b7f;});}return null;};}function removeEntity(_0x402516,_0x5adf7f){return function(_0x293ce1){if(_0x293ce1){return _0x293ce1[_0x52a9('0x25')]()[_0x52a9('0x24')](function(){_0x402516[_0x52a9('0x1c')](0xcc)[_0x52a9('0x1b')]();});}};}function handleEntityNotFound(_0x11637b,_0x472085){return function(_0x4ad7d7){if(!_0x4ad7d7){_0x11637b[_0x52a9('0x1a')](0x194);}return _0x4ad7d7;};}function handleError(_0x469e2e,_0x20420e){_0x20420e=_0x20420e||0x1f4;return function(_0x53da59){logger[_0x52a9('0x26')](_0x53da59['stack']);if(_0x53da59[_0x52a9('0x27')]){delete _0x53da59['name'];}_0x469e2e[_0x52a9('0x1c')](_0x20420e)[_0x52a9('0x28')](_0x53da59);};}exports['index']=function(_0x48423f,_0x25d918){var _0x2cfd61={},_0x5d053a={},_0x2b73ba={'count':0x0,'rows':[]};var _0x4f53e2=_[_0x52a9('0x29')](db[_0x52a9('0x2a')][_0x52a9('0x2b')],function(_0xffc217){return{'name':_0xffc217[_0x52a9('0x2c')],'type':_0xffc217['type'][_0x52a9('0x2d')]};});_0x5d053a[_0x52a9('0x2e')]=_[_0x52a9('0x29')](_0x4f53e2,_0x52a9('0x27'));_0x5d053a[_0x52a9('0x2f')]=_['keys'](_0x48423f[_0x52a9('0x2f')]);_0x5d053a[_0x52a9('0x30')]=_[_0x52a9('0x31')](_0x5d053a['model'],_0x5d053a[_0x52a9('0x2f')]);_0x2cfd61[_0x52a9('0x32')]=_[_0x52a9('0x31')](_0x5d053a[_0x52a9('0x2e')],qs[_0x52a9('0x33')](_0x48423f[_0x52a9('0x2f')][_0x52a9('0x33')]));_0x2cfd61['attributes']=_0x2cfd61['attributes']['length']?_0x2cfd61[_0x52a9('0x32')]:_0x5d053a[_0x52a9('0x2e')];if(!_0x48423f[_0x52a9('0x2f')][_0x52a9('0x34')](_0x52a9('0x35'))){_0x2cfd61[_0x52a9('0x1f')]=qs[_0x52a9('0x1f')](_0x48423f[_0x52a9('0x2f')][_0x52a9('0x1f')]);_0x2cfd61[_0x52a9('0x1e')]=qs[_0x52a9('0x1e')](_0x48423f[_0x52a9('0x2f')]['offset']);}_0x2cfd61[_0x52a9('0x36')]=qs['sort'](_0x48423f[_0x52a9('0x2f')][_0x52a9('0x37')]);_0x2cfd61[_0x52a9('0x38')]=qs[_0x52a9('0x30')](_[_0x52a9('0x39')](_0x48423f[_0x52a9('0x2f')],_0x5d053a[_0x52a9('0x30')]),_0x4f53e2);if(_0x48423f[_0x52a9('0x2f')][_0x52a9('0x3a')]){_0x2cfd61[_0x52a9('0x38')]=_[_0x52a9('0x3b')](_0x2cfd61['where'],{'$or':_[_0x52a9('0x29')](_0x4f53e2,function(_0x5ece57){if(_0x5ece57[_0x52a9('0x3c')]!==_0x52a9('0x3d')){var _0x600608={};_0x600608[_0x5ece57[_0x52a9('0x27')]]={'$like':'%'+_0x48423f['query'][_0x52a9('0x3a')]+'%'};return _0x600608;}})});}_0x2cfd61=_[_0x52a9('0x3b')]({},_0x2cfd61,_0x48423f[_0x52a9('0x3e')]);var _0x561ac1={'where':_0x2cfd61[_0x52a9('0x38')]};return db['FaxApplication']['count'](_0x561ac1)[_0x52a9('0x24')](function(_0x297a59){_0x2b73ba['count']=_0x297a59;if(_0x48423f[_0x52a9('0x2f')][_0x52a9('0x3f')]){_0x2cfd61[_0x52a9('0x40')]=[{'all':!![]}];}return db[_0x52a9('0x2a')][_0x52a9('0x41')](_0x2cfd61);})[_0x52a9('0x24')](function(_0x540368){_0x2b73ba[_0x52a9('0x42')]=_0x540368;return _0x2b73ba;})['then'](respondWithFilteredResult(_0x25d918,_0x2cfd61))[_0x52a9('0x43')](handleError(_0x25d918,null));};exports[_0x52a9('0x44')]=function(_0x24e7d2,_0x200034){var _0x1d6c6={'raw':!![],'where':{'id':_0x24e7d2['params']['id']}},_0x29d11d={};_0x29d11d['model']=_[_0x52a9('0x45')](db[_0x52a9('0x2a')][_0x52a9('0x2b')]);_0x29d11d['query']=_[_0x52a9('0x45')](_0x24e7d2[_0x52a9('0x2f')]);_0x29d11d[_0x52a9('0x30')]=_[_0x52a9('0x31')](_0x29d11d[_0x52a9('0x2e')],_0x29d11d[_0x52a9('0x2f')]);_0x1d6c6[_0x52a9('0x32')]=_[_0x52a9('0x31')](_0x29d11d[_0x52a9('0x2e')],qs[_0x52a9('0x33')](_0x24e7d2[_0x52a9('0x2f')][_0x52a9('0x33')]));_0x1d6c6[_0x52a9('0x32')]=_0x1d6c6[_0x52a9('0x32')][_0x52a9('0x46')]?_0x1d6c6[_0x52a9('0x32')]:_0x29d11d[_0x52a9('0x2e')];if(_0x24e7d2[_0x52a9('0x2f')][_0x52a9('0x3f')]){_0x1d6c6[_0x52a9('0x40')]=[{'all':!![]}];}_0x1d6c6=_['merge']({},_0x1d6c6,_0x24e7d2[_0x52a9('0x3e')]);return db[_0x52a9('0x2a')][_0x52a9('0x47')](_0x1d6c6)[_0x52a9('0x24')](handleEntityNotFound(_0x200034,null))[_0x52a9('0x24')](respondWithResult(_0x200034,null))[_0x52a9('0x43')](handleError(_0x200034,null));};exports['create']=function(_0x515840,_0x40076c){return db[_0x52a9('0x2a')]['create'](_0x515840[_0x52a9('0x48')],{})[_0x52a9('0x24')](respondWithResult(_0x40076c,0xc9))[_0x52a9('0x43')](handleError(_0x40076c,null));};exports[_0x52a9('0x23')]=function(_0x5b64ba,_0xd4ea2f){if(_0x5b64ba[_0x52a9('0x48')]['id']){delete _0x5b64ba[_0x52a9('0x48')]['id'];}return db[_0x52a9('0x2a')][_0x52a9('0x47')]({'where':{'id':_0x5b64ba[_0x52a9('0x49')]['id']}})[_0x52a9('0x24')](handleEntityNotFound(_0xd4ea2f,null))['then'](saveUpdates(_0x5b64ba[_0x52a9('0x48')],null))[_0x52a9('0x24')](respondWithResult(_0xd4ea2f,null))['catch'](handleError(_0xd4ea2f,null));};exports[_0x52a9('0x25')]=function(_0x33b174,_0x37b353){return db['FaxApplication'][_0x52a9('0x47')]({'where':{'id':_0x33b174[_0x52a9('0x49')]['id']}})[_0x52a9('0x24')](handleEntityNotFound(_0x37b353,null))[_0x52a9('0x24')](removeEntity(_0x37b353,null))[_0x52a9('0x43')](handleError(_0x37b353,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 2d0e2d9..5a7fb90 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 _0x5041=['api','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','exports','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x5041,0x1b7));var _0x1504=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0x5041[_0x172660];return _0x83204f;};'use strict';var _=require(_0x1504('0x0'));var util=require(_0x1504('0x1'));var logger=require(_0x1504('0x2'))(_0x1504('0x3'));var moment=require('moment');var BPromise=require(_0x1504('0x4'));var rp=require(_0x1504('0x5'));var fs=require('fs');var path=require(_0x1504('0x6'));var rimraf=require('rimraf');var config=require(_0x1504('0x7'));var attributes=require(_0x1504('0x8'));module[_0x1504('0x9')]=function(_0x14654f,_0x1fbec4){return _0x14654f['define']('FaxApplication',attributes,{'tableName':_0x1504('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1504('0xb'),'collate':_0x1504('0xc')});}; \ No newline at end of file +var _0xe39f=['exports','define','FaxApplication','fax_applications','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe39f,0x101));var _0xfe39=function(_0x1de841,_0x278c7c){_0x1de841=_0x1de841-0x0;var _0x19bce4=_0xe39f[_0x1de841];return _0x19bce4;};'use strict';var _=require(_0xfe39('0x0'));var util=require(_0xfe39('0x1'));var logger=require('../../config/logger')(_0xfe39('0x2'));var moment=require(_0xfe39('0x3'));var BPromise=require(_0xfe39('0x4'));var rp=require(_0xfe39('0x5'));var fs=require('fs');var path=require(_0xfe39('0x6'));var rimraf=require(_0xfe39('0x7'));var config=require(_0xfe39('0x8'));var attributes=require('./faxApplication.attributes');module[_0xfe39('0x9')]=function(_0x42800c,_0x399dd3){return _0x42800c[_0xfe39('0xa')](_0xfe39('0xb'),attributes,{'tableName':_0xfe39('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfe39('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index bc48b7e..3535888 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 _0x83fb=['jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','UpdateFaxApplication','FaxApplication','body','options','where','attributes','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x83fb,0xf4));var _0xb83f=function(_0x3eef0d,_0x38a38b){_0x3eef0d=_0x3eef0d-0x0;var _0x2c78fc=_0x83fb[_0x3eef0d];return _0x2c78fc;};'use strict';var _=require(_0xb83f('0x0'));var util=require(_0xb83f('0x1'));var moment=require(_0xb83f('0x2'));var BPromise=require(_0xb83f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb83f('0x4'));var db=require(_0xb83f('0x5'))['db'];var utils=require(_0xb83f('0x6'));var logger=require('../../config/logger')(_0xb83f('0x7'));var config=require('../../config/environment');var jayson=require(_0xb83f('0x8'));var client=jayson[_0xb83f('0x9')][_0xb83f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x389958,_0x5b2ac6,_0x5d6263){return new BPromise(function(_0x495a67,_0x5cef51){return client[_0xb83f('0xb')](_0x389958,_0x5d6263)[_0xb83f('0xc')](function(_0xcb42cb){logger['info'](_0xb83f('0xd'),_0x5b2ac6,'request\x20sent');logger[_0xb83f('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x5b2ac6,_0xb83f('0xf'),JSON['stringify'](_0xcb42cb));if(_0xcb42cb[_0xb83f('0x10')]){if(_0xcb42cb[_0xb83f('0x10')][_0xb83f('0x11')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5b2ac6,_0xcb42cb[_0xb83f('0x10')]['message']);return _0x5cef51(_0xcb42cb[_0xb83f('0x10')][_0xb83f('0x12')]);}logger['error'](_0xb83f('0xd'),_0x5b2ac6,_0xcb42cb[_0xb83f('0x10')]['message']);return _0x495a67(_0xcb42cb[_0xb83f('0x10')]['message']);}else{logger[_0xb83f('0x13')]('FaxApplication,\x20%s,\x20%s',_0x5b2ac6,_0xb83f('0xf'));_0x495a67(_0xcb42cb['result']['message']);}})[_0xb83f('0x14')](function(_0x5eae5f){logger[_0xb83f('0x10')](_0xb83f('0xd'),_0x5b2ac6,_0x5eae5f);_0x5cef51(_0x5eae5f);});});}exports[_0xb83f('0x15')]=function(_0x1726f0){var _0x407963=this;return new Promise(function(_0x21e342,_0x18c5ce){return db[_0xb83f('0x16')]['update'](_0x1726f0[_0xb83f('0x17')],{'raw':_0x1726f0['options']?_0x1726f0[_0xb83f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1726f0[_0xb83f('0x18')]?_0x1726f0[_0xb83f('0x18')][_0xb83f('0x19')]||null:null,'attributes':_0x1726f0['options']?_0x1726f0['options'][_0xb83f('0x1a')]||null:null,'limit':_0x1726f0[_0xb83f('0x18')]?_0x1726f0[_0xb83f('0x18')]['limit']||null:null})[_0xb83f('0xc')](function(_0x1488ac){logger[_0xb83f('0x13')](_0xb83f('0x15'),_0x1726f0);logger['debug']('UpdateFaxApplication',_0x1726f0,JSON[_0xb83f('0x1b')](_0x1488ac));_0x21e342(_0x1488ac);})[_0xb83f('0x14')](function(_0x2d47b5){logger['error'](_0xb83f('0x15'),_0x2d47b5[_0xb83f('0x12')],_0x1726f0);_0x18c5ce(_0x407963[_0xb83f('0x10')](0x1f4,_0x2d47b5[_0xb83f('0x12')]));});});}; \ No newline at end of file +var _0xa378=['rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xa378,0x191));var _0x8a37=function(_0x4074d5,_0x1985cc){_0x4074d5=_0x4074d5-0x0;var _0x13c1f0=_0xa378[_0x4074d5];return _0x13c1f0;};'use strict';var _=require(_0x8a37('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8a37('0x1'));var rs=require(_0x8a37('0x2'));var fs=require('fs');var Redis=require(_0x8a37('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a37('0x4'));var logger=require('../../config/logger')(_0x8a37('0x5'));var config=require('../../config/environment');var jayson=require(_0x8a37('0x6'));var client=jayson[_0x8a37('0x7')][_0x8a37('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49d70c,_0x52c26e,_0x5c0659){return new BPromise(function(_0x3a2e89,_0x11d438){return client[_0x8a37('0x9')](_0x49d70c,_0x5c0659)[_0x8a37('0xa')](function(_0x30733e){logger[_0x8a37('0xb')]('FaxApplication,\x20%s,\x20%s',_0x52c26e,_0x8a37('0xc'));logger[_0x8a37('0xd')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x52c26e,_0x8a37('0xc'),JSON[_0x8a37('0xe')](_0x30733e));if(_0x30733e['error']){if(_0x30733e[_0x8a37('0xf')][_0x8a37('0x10')]===0x1f4){logger['error'](_0x8a37('0x11'),_0x52c26e,_0x30733e['error']['message']);return _0x11d438(_0x30733e[_0x8a37('0xf')][_0x8a37('0x12')]);}logger[_0x8a37('0xf')](_0x8a37('0x11'),_0x52c26e,_0x30733e[_0x8a37('0xf')][_0x8a37('0x12')]);return _0x3a2e89(_0x30733e[_0x8a37('0xf')]['message']);}else{logger[_0x8a37('0xb')](_0x8a37('0x11'),_0x52c26e,_0x8a37('0xc'));_0x3a2e89(_0x30733e[_0x8a37('0x13')][_0x8a37('0x12')]);}})[_0x8a37('0x14')](function(_0x4865ee){logger['error'](_0x8a37('0x11'),_0x52c26e,_0x4865ee);_0x11d438(_0x4865ee);});});}exports[_0x8a37('0x15')]=function(_0x462bc7){var _0x56bdc5=this;return new Promise(function(_0x5093ae,_0x12c663){return db[_0x8a37('0x16')][_0x8a37('0x17')](_0x462bc7['body'],{'raw':_0x462bc7['options']?_0x462bc7[_0x8a37('0x18')][_0x8a37('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x462bc7[_0x8a37('0x18')]?_0x462bc7[_0x8a37('0x18')][_0x8a37('0x1a')]||null:null,'attributes':_0x462bc7[_0x8a37('0x18')]?_0x462bc7['options'][_0x8a37('0x1b')]||null:null,'limit':_0x462bc7[_0x8a37('0x18')]?_0x462bc7[_0x8a37('0x18')][_0x8a37('0x1c')]||null:null})[_0x8a37('0xa')](function(_0x4c85e9){logger[_0x8a37('0xb')]('UpdateFaxApplication',_0x462bc7);logger[_0x8a37('0xd')](_0x8a37('0x15'),_0x462bc7,JSON[_0x8a37('0xe')](_0x4c85e9));_0x5093ae(_0x4c85e9);})['catch'](function(_0x3bedd2){logger[_0x8a37('0xf')]('UpdateFaxApplication',_0x3bedd2[_0x8a37('0x12')],_0x462bc7);_0x12c663(_0x56bdc5[_0x8a37('0xf')](0x1f4,_0x3bedd2[_0x8a37('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b233ac2..1a206c0 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 _0x326f=['show','post','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x326f,0xd1));var _0xf326=function(_0x3763fc,_0xc06f91){_0x3763fc=_0x3763fc-0x0;var _0x2e8829=_0x326f[_0x3763fc];return _0x2e8829;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')]('/',auth[_0xf326('0x9')](),controller[_0xf326('0xa')]);router['get'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf326('0xb'),auth[_0xf326('0x9')](),controller[_0xf326('0xe')]);router[_0xf326('0xf')](_0xf326('0xb'),auth['isAuthenticated'](),controller[_0xf326('0x10')]);module['exports']=router; \ No newline at end of file +var _0x33c5=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x18c69b,_0x2915d9){var _0x565b0c=function(_0x41a3a9){while(--_0x41a3a9){_0x18c69b['push'](_0x18c69b['shift']());}};_0x565b0c(++_0x2915d9);}(_0x33c5,0xe6));var _0x533c=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0x33c5[_0x411e71];return _0x226ae3;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var auth=require(_0x533c('0x4'));var interaction=require(_0x533c('0x5'));var config=require(_0x533c('0x6'));var controller=require('./faxApplication.controller');router[_0x533c('0x7')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x9')]);router[_0x533c('0x7')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0xd')]);router[_0x533c('0xe')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0xa'),auth['isAuthenticated'](),controller[_0x533c('0x11')]);module[_0x533c('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index e567ad6..1adc683 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 _0x723e=['BOOLEAN','DATE','STRING','ENUM','out','exports'];(function(_0xfe724e,_0x4f61cc){var _0x392cab=function(_0x5f2a6f){while(--_0x5f2a6f){_0xfe724e['push'](_0xfe724e['shift']());}};_0x392cab(++_0x4f61cc);}(_0x723e,0x179));var _0xe723=function(_0x41c358,_0xb928de){_0x41c358=_0x41c358-0x0;var _0x25a609=_0x723e[_0x41c358];return _0x25a609;};'use strict';var Sequelize=require('sequelize');module[_0xe723('0x0')]={'closed':{'type':Sequelize[_0xe723('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe723('0x2')]},'disposition':{'type':Sequelize[_0xe723('0x3')]},'secondDisposition':{'type':Sequelize[_0xe723('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe723('0x3')]},'note':{'type':Sequelize[_0xe723('0x3')]},'read1stAt':{'type':Sequelize[_0xe723('0x2')]},'fax':{'type':Sequelize[_0xe723('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xe723('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe723('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xe723('0x4')]('in',_0xe723('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xac9d=['DATE','STRING','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0x35d124,_0x35f879){var _0x234e54=function(_0x4b0560){while(--_0x4b0560){_0x35d124['push'](_0x35d124['shift']());}};_0x234e54(++_0x35f879);}(_0xac9d,0x14d));var _0xdac9=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xac9d[_0x318840];return _0x223da4;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'closed':{'type':Sequelize[_0xdac9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdac9('0x3')]},'disposition':{'type':Sequelize[_0xdac9('0x4')]},'secondDisposition':{'type':Sequelize[_0xdac9('0x4')]},'thirdDisposition':{'type':Sequelize[_0xdac9('0x4')]},'note':{'type':Sequelize[_0xdac9('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xdac9('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xdac9('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xdac9('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdac9('0x6')]('in',_0xdac9('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 5563297..a161051 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 _0xa74f=['tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','Contact','$substring','length','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?','find','ContactId','buildExpression','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','isEmpty','FaxAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','count','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','params','FaxInteraction','include','options','create','body','describe','addMessage','FaxMessage','ids','getMessages','findOne','rawAttributes','nolimit','pick','merge','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','omit','spread','findAll','faxInteractionTags:save','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Messages','get','mkdirSync','basename','existsSync','pipe','createWriteStream','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','Users','map','TagIds','Tags','forEach','push','then','index','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','select','field','color','from'];(function(_0x169863,_0x3118e5){var _0x1c7a83=function(_0x517883){while(--_0x517883){_0x169863['push'](_0x169863['shift']());}};_0x1c7a83(++_0x3118e5);}(_0xa74f,0x9a));var _0xfa74=function(_0x644ecd,_0x397f36){_0x644ecd=_0x644ecd-0x0;var _0x1c66ce=_0xa74f[_0x644ecd];return _0x1c66ce;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfa74('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa74('0x1'));var moment=require(_0xfa74('0x2'));var BPromise=require(_0xfa74('0x3'));var Mustache=require(_0xfa74('0x4'));var util=require('util');var path=require(_0xfa74('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfa74('0x6'));var fs=require('fs');var _=require(_0xfa74('0x7'));var squel=require(_0xfa74('0x8'));var crypto=require(_0xfa74('0x9'));var jsforce=require(_0xfa74('0xa'));var deskjs=require(_0xfa74('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa74('0xc'));var Papa=require(_0xfa74('0xd'));var Redis=require(_0xfa74('0xe'));var authService=require(_0xfa74('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfa74('0x10'));var hardwareService=require(_0xfa74('0x11'));var logger=require('../../config/logger')(_0xfa74('0x12'));var utils=require(_0xfa74('0x13'));var config=require(_0xfa74('0x14'));var licenseUtil=require(_0xfa74('0x15'));var db=require('../../mysqldb')['db'];config[_0xfa74('0x16')]=_[_0xfa74('0x17')](config[_0xfa74('0x16')],{'host':_0xfa74('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa74('0x16')]));require(_0xfa74('0x19'))[_0xfa74('0x1a')](socket);function respondWithStatusCode(_0x3947ca,_0xe3c97e){_0xe3c97e=_0xe3c97e||0xcc;return function(_0x47c8fb){if(_0x47c8fb){return _0x3947ca[_0xfa74('0x1b')](_0xe3c97e);}return _0x3947ca[_0xfa74('0x1c')](_0xe3c97e)[_0xfa74('0x1d')]();};}function respondWithResult(_0x1f1de0,_0x3867f8){_0x3867f8=_0x3867f8||0xc8;return function(_0x40af70){if(_0x40af70){return _0x1f1de0[_0xfa74('0x1c')](_0x3867f8)['json'](_0x40af70);}};}function respondWithFilteredResult(_0x58a67a,_0xe0e33d){return function(_0x51dda1){if(_0x51dda1){var _0x4928b6=_0x51dda1['count'],_0x31d3c1=_0xe0e33d[_0xfa74('0x1e')],_0x25a36b=_0xe0e33d[_0xfa74('0x1e')]+_0xe0e33d[_0xfa74('0x1f')],_0xb8fe6b;if(_0x25a36b>=_0x4928b6){_0x25a36b=_0x4928b6;_0xb8fe6b=0xc8;}else{_0xb8fe6b=0xce;}_0x58a67a['status'](_0xb8fe6b);return _0x58a67a[_0xfa74('0x20')](_0xfa74('0x21'),_0x31d3c1+'-'+_0x25a36b+'/'+_0x4928b6)[_0xfa74('0x22')](_0x51dda1);}return null;};}function patchUpdates(_0x4a5ee4){return function(_0x5466ca){try{jsonpatch[_0xfa74('0x23')](_0x5466ca,_0x4a5ee4,!![]);}catch(_0x2257a0){return BPromise[_0xfa74('0x24')](_0x2257a0);}return _0x5466ca[_0xfa74('0x25')]();};}function saveUpdates(_0x1a453d,_0x554e0e){return function(_0x4802a3){if(_0x4802a3){return _0x4802a3[_0xfa74('0x26')](_0x1a453d)['then'](function(_0x48cbd3){return _0x48cbd3;});}return null;};}function removeEntity(_0x529810,_0x42c439){return function(_0x286d6a){if(_0x286d6a){return _0x286d6a[_0xfa74('0x27')]()['then'](function(){_0x529810['status'](0xcc)[_0xfa74('0x1d')]();});}};}function handleEntityNotFound(_0xeb6c11,_0x5ed1c8){return function(_0x62e1be){if(!_0x62e1be){_0xeb6c11['sendStatus'](0x194);}return _0x62e1be;};}function handleError(_0x1a8cf7,_0x153b2a){_0x153b2a=_0x153b2a||0x1f4;return function(_0x55d8e4){logger[_0xfa74('0x28')](_0x55d8e4[_0xfa74('0x29')]);if(_0x55d8e4[_0xfa74('0x2a')]){delete _0x55d8e4[_0xfa74('0x2a')];}_0x1a8cf7['status'](_0x153b2a)[_0xfa74('0x2b')](_0x55d8e4);};}function getInteractionUsers(_0x2f7cd7,_0x204e01){return new BPromise(function(_0x57d90e,_0x4d4bed){try{if(_0x204e01[_0x2f7cd7['id']]){_0x2f7cd7[_0xfa74('0x2c')]=_[_0xfa74('0x2d')](_0x204e01[_0x2f7cd7['id']],function(_0x5df5cd){return{'id':_0x5df5cd['id'],'fullname':_0x5df5cd['fullname']};});}}catch(_0x343466){_0x4d4bed(_0x343466);}_0x57d90e(_0x2f7cd7);});}function getInteractionTags(_0x564060,_0x2238d4){return new BPromise(function(_0x4d6d0a,_0x363173){try{if(_0x564060[_0xfa74('0x2e')]){_0x564060[_0xfa74('0x2f')]=[];_0x564060[_0xfa74('0x2e')]['split'](',')[_0xfa74('0x30')](function(_0x102d47){_0x564060[_0xfa74('0x2f')][_0xfa74('0x31')](_0x2238d4[_0x102d47]);});}delete _0x564060[_0xfa74('0x2e')];}catch(_0xb878c7){_0x363173(_0xb878c7);}_0x4d6d0a(_0x564060);});}function updateFaxInteraction(_0xbf19a8,_0x556ab8,_0x20fc18){return new BPromise(function(_0x5a9f43,_0x74665c){return getInteractionUsers(_0xbf19a8,_0x20fc18)[_0xfa74('0x32')](function(_0xcc5e32){return getInteractionTags(_0xcc5e32,_0x556ab8);})[_0xfa74('0x32')](function(_0x562289){_0x5a9f43(_0x562289);})['catch'](function(_0x390ed4){_0x74665c(_0x390ed4);});});}exports[_0xfa74('0x33')]=function(_0x44b725,_0x25863f){var _0x4bbe4e={},_0x441eaa={},_0x231698={'count':0x0,'rows':[]};var _0x501a70=_['map'](db['FaxInteraction']['rawAttributes'],function(_0x5d20a7){return{'name':_0x5d20a7[_0xfa74('0x34')],'type':_0x5d20a7[_0xfa74('0x35')][_0xfa74('0x36')]};});_0x441eaa[_0xfa74('0x37')]=_[_0xfa74('0x2d')](_0x501a70,_0xfa74('0x2a'));_0x441eaa[_0xfa74('0x38')]=_[_0xfa74('0x39')](_0x44b725[_0xfa74('0x38')]);_0x441eaa['filters']=_[_0xfa74('0x3a')](_0x441eaa[_0xfa74('0x37')],_0x441eaa[_0xfa74('0x38')]);_0x4bbe4e[_0xfa74('0x3b')]=_[_0xfa74('0x3a')](_0x441eaa[_0xfa74('0x37')],qs['fields'](_0x44b725[_0xfa74('0x38')][_0xfa74('0x3c')]));_0x4bbe4e[_0xfa74('0x3b')]=_0x4bbe4e[_0xfa74('0x3b')]['length']?_0x4bbe4e[_0xfa74('0x3b')]:_0x441eaa[_0xfa74('0x37')];if(!_0x44b725[_0xfa74('0x38')][_0xfa74('0x3d')]('nolimit')){_0x4bbe4e[_0xfa74('0x1f')]=qs[_0xfa74('0x1f')](_0x44b725[_0xfa74('0x38')]['limit']);_0x4bbe4e['offset']=qs[_0xfa74('0x1e')](_0x44b725[_0xfa74('0x38')][_0xfa74('0x1e')]);}_0x4bbe4e[_0xfa74('0x3e')]=qs['sort'](_0x44b725[_0xfa74('0x38')][_0xfa74('0x3f')]);_0x4bbe4e['where']=qs['filters'](_['pick'](_0x44b725['query'],_0x441eaa[_0xfa74('0x40')]),_0x501a70);var _0x3098ca=[];var _0x3f92b2=squel[_0xfa74('0x41')]()[_0xfa74('0x42')]('id')[_0xfa74('0x42')](_0xfa74('0x2a'))['field'](_0xfa74('0x43'))[_0xfa74('0x44')](_0xfa74('0x45'));var _0x417379=squel[_0xfa74('0x41')]()['field'](_0xfa74('0x46'))[_0xfa74('0x42')](_0xfa74('0x47'))[_0xfa74('0x42')](_0xfa74('0x48'))[_0xfa74('0x44')](_0xfa74('0x49'),'ui')[_0xfa74('0x4a')](_0xfa74('0x4b'),'u',_0xfa74('0x4c'));var _0x53f213=squel[_0xfa74('0x41')]()['from'](_0xfa74('0x4d'),'i')[_0xfa74('0x4a')](_0xfa74('0x4e'),'c',_0xfa74('0x4f'))['left_join'](_0xfa74('0x4b'),'o',_0xfa74('0x50'))['left_join'](_0xfa74('0x51'),'a',_0xfa74('0x52'))['left_join'](_0xfa74('0x53'),'me',_0xfa74('0x54'))[_0xfa74('0x4a')](_0xfa74('0x55'),'it',_0xfa74('0x56'))['left_join']('tools_tags','t',_0xfa74('0x57'));var _0x91df44=squel['expr']();var _0x32e440=[];var _0x3e6527=squel[_0xfa74('0x58')]();var _0x4ca49e;if(_0x44b725['query'][_0xfa74('0x59')]){_0x4ca49e=as[_0xfa74('0x5a')](_0x44b725[_0xfa74('0x38')][_0xfa74('0x59')]);var _0x36508a=_0x4ca49e[_0xfa74('0x5b')];for(var _0x2d217d=0x0;_0x2d217d<_0x4ca49e[_0xfa74('0x5c')]['length'];_0x2d217d++){var _0x214994=_0x4ca49e[_0xfa74('0x5c')][_0x2d217d];var _0x26bb7e='i';var _0x2654b5=_['find'](_0x501a70,['name',_0x214994[_0xfa74('0x42')]]);if(!_0x2654b5){switch(_0x214994['field']){case _0xfa74('0x5d'):if(_0x214994[_0xfa74('0x5e')]==0x1){_0x53f213[_0xfa74('0x5f')]('`'+_0x214994[_0xfa74('0x42')]+_0xfa74('0x60'));}else{_0x53f213[_0xfa74('0x5f')]('`'+_0x214994[_0xfa74('0x42')]+'`\x20>\x200');}break;case _0xfa74('0x61'):if(_0x214994['operator']===_0xfa74('0x62')){if(_0x214994['value']['split']('\x20')[_0xfa74('0x63')]>0x1){_0x91df44[_0x36508a](_0xfa74('0x64'),qs['getFullTextValue'](_0x214994['value']),null);}else{var _0x6e588d='%'+_0x214994[_0xfa74('0x5e')]+'%';_0x91df44[_0x36508a](_0xfa74('0x65'),_0x6e588d,_0x6e588d,_0x6e588d);}}else{_0x2654b5=_[_0xfa74('0x66')](_0x501a70,[_0xfa74('0x2a'),_0xfa74('0x67')]);_0x214994[_0xfa74('0x42')]=_0xfa74('0x67');_0x1f355a=as[_0xfa74('0x68')](_0x26bb7e,_0x2654b5[_0xfa74('0x35')],_0x214994);_0x91df44[_0x36508a](_0x1f355a['text'],_0x1f355a[_0xfa74('0x5e')][_0xfa74('0x69')],_0x1f355a['value']['end']);}break;case _0xfa74('0x6a'):var _0x2e7262=_0x214994[_0xfa74('0x5e')][_0xfa74('0x6b')](',')[_0xfa74('0x2d')](function(_0x5475f1){return Number(_0x5475f1);});_0x2e7262[_0xfa74('0x30')](function(_0x4d6235){_0x3e6527['or'](_0xfa74('0x6c'),'%,'+_0x4d6235+',%');});_0x32e440=_[_0xfa74('0x6d')](_0x32e440,_0x2e7262);break;case _0xfa74('0x6e'):if(_0x214994['operator']==='$substring'){_0x91df44[_0x36508a](_0xfa74('0x6f'),'%'+_0x214994[_0xfa74('0x5e')]+'%',null);}else{_0x2654b5=_[_0xfa74('0x66')](_0x501a70,[_0xfa74('0x2a'),'UserId']);_0x214994[_0xfa74('0x42')]=_0xfa74('0x70');_0x1f355a=as['buildExpression'](_0x26bb7e,_0x2654b5[_0xfa74('0x35')],_0x214994);_0x91df44[_0x36508a](_0x1f355a[_0xfa74('0x71')],_0x1f355a[_0xfa74('0x5e')][_0xfa74('0x69')],_0x1f355a['value'][_0xfa74('0x1d')]);}break;case'body':_0x1f355a=as[_0xfa74('0x68')]('me',null,_0x214994);_0x91df44[_0x36508a](_0x1f355a[_0xfa74('0x71')],_0x1f355a[_0xfa74('0x5e')][_0xfa74('0x69')],_0x1f355a[_0xfa74('0x5e')][_0xfa74('0x1d')]);break;}}else{var _0x1f355a=as[_0xfa74('0x68')](_0x26bb7e,_0x2654b5[_0xfa74('0x35')],_0x214994);_0x91df44[_0x36508a](_0x1f355a[_0xfa74('0x71')],_0x1f355a[_0xfa74('0x5e')][_0xfa74('0x69')],_0x1f355a[_0xfa74('0x5e')][_0xfa74('0x1d')]);}}}else{var _0x235ad8=_(_0x44b725['query'])[_0xfa74('0x39')]()[_0xfa74('0x2d')](function(_0x5035dd){return _['some'](_0x501a70,[_0xfa74('0x2a'),_0x5035dd])?_0x5035dd:undefined;})['compact']()[_0xfa74('0x5e')]();if(!_[_0xfa74('0x72')](_0x235ad8)){_0x235ad8[_0xfa74('0x30')](function(_0x529921){if(_0x529921===_0xfa74('0x73')){_0x53f213['where']('i.FaxAccountId\x20IN\x20?',[][_0xfa74('0x74')](_0x44b725[_0xfa74('0x38')][_0x529921]));}else if(_0x529921===_0xfa74('0x75')){var _0x414e31=JSON[_0xfa74('0x76')](_0x44b725[_0xfa74('0x38')][_0x529921])[_0xfa74('0x77')];var _0x379882=JSON[_0xfa74('0x76')](_0x44b725[_0xfa74('0x38')][_0x529921])[_0xfa74('0x78')];_0x53f213['where'](_0xfa74('0x79'),_0x414e31,_0x379882);}else{if(_0x44b725['query'][_0x529921]===_0xfa74('0x7a')){_0x53f213[_0xfa74('0x7b')]('i.'+_0x529921+_0xfa74('0x7c'));}else{_0x53f213['where']('i.'+_0x529921+_0xfa74('0x7d'),_0x44b725[_0xfa74('0x38')][_0x529921]);}}});}if(_0x44b725[_0xfa74('0x38')]['read']){if(_0x44b725[_0xfa74('0x38')][_0xfa74('0x7e')]==0x1){_0x53f213[_0xfa74('0x5f')](_0xfa74('0x7f'));}else{_0x53f213[_0xfa74('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x44b725[_0xfa74('0x38')][_0xfa74('0x80')]){_0x32e440=_[_0xfa74('0x81')](_0x44b725[_0xfa74('0x38')][_0xfa74('0x80')])?_0x44b725[_0xfa74('0x38')][_0xfa74('0x80')]:new Array(_0x44b725[_0xfa74('0x38')][_0xfa74('0x80')]);_0x32e440[_0xfa74('0x30')](function(_0x1dccaa){_0x3e6527['or'](_0xfa74('0x6c'),'%,'+_0x1dccaa+',%');});}if(_0x44b725['query'][_0xfa74('0x82')]){var _0x415390=_0x44b725[_0xfa74('0x38')][_0xfa74('0x82')][_0xfa74('0x83')]('\x5c','\x5c\x5c')[_0xfa74('0x83')](/'/g,'\x27\x27');if(qs[_0xfa74('0x84')](_0x415390)){_0x91df44['or'](_0xfa74('0x85'),_0x415390+'%')['or']('i.fax\x20LIKE\x20?',_0x415390+'%');}_0x91df44['or'](_0xfa74('0x86'),_0x415390+'%');}}_0x53f213[_0xfa74('0x7b')](_0x91df44);_0x53f213[_0xfa74('0x87')](_0xfa74('0x88'));var _0x54cc2e={'type':db[_0xfa74('0x89')][_0xfa74('0x8a')][_0xfa74('0x8b')],'raw':!![]};var _0x833e2d=_0x53f213['clone']();_0x833e2d[_0xfa74('0x42')]('i.id');_0x833e2d['field'](_0xfa74('0x8c'),'unreadMessages');if(_0x4bbe4e[_0xfa74('0x3e')]){_0x4bbe4e[_0xfa74('0x3e')]['forEach'](function(_0x5121ff){var _0xb605a1=_0x5121ff[0x0]===_0xfa74('0x8d')?_0x5121ff[0x0]:'i.'+_0x5121ff[0x0];_0x53f213[_0xfa74('0x3e')](_0xb605a1,_0x5121ff[0x1]===_0xfa74('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x32e440)){_0x53f213['having'](_0x3e6527);_0x833e2d['where'](_0xfa74('0x8f'),_0x32e440);}BPromise[_0xfa74('0x90')]()[_0xfa74('0x32')](function(){if(!_0x4ca49e){if(_0x44b725[_0xfa74('0x38')][_0xfa74('0x73')]||_0x44b725['query'][_0xfa74('0x91')])return;_0x833e2d[_0xfa74('0x7b')](_0xfa74('0x92'));_0x53f213[_0xfa74('0x7b')](_0xfa74('0x92'));return;}if(_0x44b725[_0xfa74('0x93')][_0xfa74('0x94')]!==_0xfa74('0x95'))return;return _0x44b725[_0xfa74('0x93')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x592e6a){if(_[_0xfa74('0x72')](_0x592e6a)){_0x833e2d[_0xfa74('0x7b')](_0xfa74('0x96'));_0x53f213[_0xfa74('0x7b')](_0xfa74('0x96'));}else{_0x833e2d['where'](_0xfa74('0x97'),_[_0xfa74('0x2d')](_0x592e6a,'id'));_0x53f213['where'](_0xfa74('0x97'),_['map'](_0x592e6a,'id'));}});})[_0xfa74('0x32')](function(){if(_0x44b725[_0xfa74('0x93')][_0xfa74('0x94')]===_0xfa74('0x95')&&!_0x4ca49e&&!_0x44b725[_0xfa74('0x38')][_0xfa74('0x73')])return[];return db[_0xfa74('0x98')][_0xfa74('0x38')](_0x833e2d['toString'](),_0x54cc2e);})['then'](function(_0x56c49c){_0x231698[_0xfa74('0x99')]=_0x56c49c[_0xfa74('0x63')];if(_0x231698['count']===0x0)return[];return db[_0xfa74('0x98')][_0xfa74('0x38')](_0x3f92b2[_0xfa74('0x9a')](),_0x54cc2e)[_0xfa74('0x32')](function(_0x4a65dc){_0x3098ca=_[_0xfa74('0x9b')](_0x4a65dc,'id');_0x54cc2e=_['merge'](_0x54cc2e,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x44b725[_0xfa74('0x38')][_0xfa74('0x3c')]){_0x4bbe4e[_0xfa74('0x3b')]['forEach'](function(_0x45db47){_0x53f213[_0xfa74('0x42')]('i.'+_0x45db47);});}else{_0x53f213['field'](_0xfa74('0x8c'),'unreadMessages');_0x53f213['field']('a.key',_0xfa74('0x9c'));_0x53f213[_0xfa74('0x42')](_0xfa74('0x9d'),_0xfa74('0x9e'));_0x53f213[_0xfa74('0x42')]('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');_0x53f213[_0xfa74('0x42')]('i.*');_0x53f213[_0xfa74('0x42')](_0xfa74('0x9f'),_0xfa74('0xa0'));_0x53f213[_0xfa74('0x42')](_0xfa74('0xa1'),_0xfa74('0xa2'));_0x53f213[_0xfa74('0x42')](_0xfa74('0xa3'),_0xfa74('0xa4'));_0x53f213['field'](_0xfa74('0xa5'),_0xfa74('0xa6'));_0x53f213[_0xfa74('0x42')](_0xfa74('0xa7'),_0xfa74('0xa8'));_0x53f213[_0xfa74('0x42')](_0xfa74('0xa9'),_0xfa74('0xaa'));_0x53f213[_0xfa74('0x42')](_0xfa74('0xab'),_0xfa74('0xac'));_0x53f213['field']('o.internal',_0xfa74('0xad'));_0x53f213[_0xfa74('0x42')](_0xfa74('0xae'),'TagIds');}if(_0x4bbe4e['limit'])_0x53f213[_0xfa74('0x1f')](_0x4bbe4e[_0xfa74('0x1f')]);if(_0x4bbe4e[_0xfa74('0x1e')])_0x53f213[_0xfa74('0x1e')](_0x4bbe4e[_0xfa74('0x1e')]);return db[_0xfa74('0x98')][_0xfa74('0x38')](_0x53f213['toString'](),_0x54cc2e);})[_0xfa74('0x32')](function(_0x5ad3bd){_0x417379['where'](_0xfa74('0xaf'),_[_0xfa74('0x2d')](_0x5ad3bd,'id'));return db[_0xfa74('0x98')]['query'](_0x417379[_0xfa74('0x9a')](),_0x54cc2e)['then'](function(_0x56b6b2){var _0x4603c7=_[_0xfa74('0xb0')](_0x56b6b2,_0xfa74('0xb1'));var _0x2eb349=[];_0x5ad3bd[_0xfa74('0x30')](function(_0xe90fb8){_0x2eb349['push'](updateFaxInteraction(_0xe90fb8,_0x3098ca,_0x4603c7));});return BPromise[_0xfa74('0xb2')](_0x2eb349);});});})[_0xfa74('0x32')](function(_0x583e9b){_0x231698[_0xfa74('0xb3')]=_0x583e9b;return _0x231698;})[_0xfa74('0x32')](respondWithFilteredResult(_0x25863f,_0x4bbe4e))[_0xfa74('0xb4')](handleError(_0x25863f,null));};exports['show']=function(_0x205e5c,_0x28eb48){var _0x51b78a={'raw':![],'where':{'id':_0x205e5c[_0xfa74('0xb5')]['id']}},_0x26882e={};_0x26882e[_0xfa74('0x37')]=_['keys'](db[_0xfa74('0xb6')]['rawAttributes']);_0x26882e['query']=_[_0xfa74('0x39')](_0x205e5c['query']);_0x26882e[_0xfa74('0x40')]=_[_0xfa74('0x3a')](_0x26882e[_0xfa74('0x37')],_0x26882e[_0xfa74('0x38')]);_0x51b78a[_0xfa74('0x3b')]=_[_0xfa74('0x3a')](_0x26882e[_0xfa74('0x37')],qs[_0xfa74('0x3c')](_0x205e5c[_0xfa74('0x38')][_0xfa74('0x3c')]));_0x51b78a['attributes']=_0x51b78a['attributes']['length']?_0x51b78a['attributes']:_0x26882e[_0xfa74('0x37')];if(_0x205e5c[_0xfa74('0x38')]['includeAll']){_0x51b78a[_0xfa74('0xb7')]=[{'all':!![]}];}_0x51b78a=_['merge']({},_0x51b78a,_0x205e5c[_0xfa74('0xb8')]);return db[_0xfa74('0xb6')][_0xfa74('0x66')](_0x51b78a)[_0xfa74('0x32')](handleEntityNotFound(_0x28eb48,null))[_0xfa74('0x32')](respondWithResult(_0x28eb48,null))[_0xfa74('0xb4')](handleError(_0x28eb48,null));};exports[_0xfa74('0xb9')]=function(_0xaf023d,_0x37fd85){return db[_0xfa74('0xb6')][_0xfa74('0xb9')](_0xaf023d['body'],{})[_0xfa74('0x32')](respondWithResult(_0x37fd85,0xc9))['catch'](handleError(_0x37fd85,null));};exports[_0xfa74('0x26')]=function(_0x4901b2,_0xc539c2){if(_0x4901b2[_0xfa74('0xba')]['id']){delete _0x4901b2[_0xfa74('0xba')]['id'];}return db['FaxInteraction'][_0xfa74('0x66')]({'where':{'id':_0x4901b2[_0xfa74('0xb5')]['id']}})[_0xfa74('0x32')](handleEntityNotFound(_0xc539c2,null))[_0xfa74('0x32')](saveUpdates(_0x4901b2[_0xfa74('0xba')],null))['then'](respondWithResult(_0xc539c2,null))[_0xfa74('0xb4')](handleError(_0xc539c2,null));};exports[_0xfa74('0x27')]=function(_0x3a45f4,_0x5d7121){return db[_0xfa74('0xb6')][_0xfa74('0x66')]({'where':{'id':_0x3a45f4['params']['id']}})[_0xfa74('0x32')](handleEntityNotFound(_0x5d7121,null))[_0xfa74('0x32')](removeEntity(_0x5d7121,null))[_0xfa74('0xb4')](handleError(_0x5d7121,null));};exports[_0xfa74('0xbb')]=function(_0x2cadfc,_0x3587dd){return db['FaxInteraction'][_0xfa74('0xbb')]()[_0xfa74('0x32')](respondWithResult(_0x3587dd,null))[_0xfa74('0xb4')](handleError(_0x3587dd,null));};exports[_0xfa74('0xbc')]=function(_0x24e64d,_0x13b538,_0xf359df){return db[_0xfa74('0xbd')]['find']({'where':{'id':_0x24e64d[_0xfa74('0xb5')]['id']}})['then'](handleEntityNotFound(_0x13b538,null))[_0xfa74('0x32')](function(_0x4bfec0){if(_0x4bfec0){return _0x4bfec0[_0xfa74('0xbc')](_0x24e64d[_0xfa74('0xba')][_0xfa74('0xbe')],_['omit'](_0x24e64d[_0xfa74('0xba')],['ids','id'])||{});}})[_0xfa74('0x32')](respondWithResult(_0x13b538,null))[_0xfa74('0xb4')](handleError(_0x13b538,null));};exports[_0xfa74('0xbf')]=function(_0x207677,_0x58ff9b,_0x211ff3){var _0x1e33de={'raw':![],'where':{}};var _0x243da5={};var _0x338c86={'count':0x0,'rows':[]};return db[_0xfa74('0xb6')][_0xfa74('0xc0')]({'where':{'id':_0x207677[_0xfa74('0xb5')]['id']}})[_0xfa74('0x32')](handleEntityNotFound(_0x58ff9b,null))[_0xfa74('0x32')](function(_0x1dddb3){if(_0x1dddb3){_0x243da5[_0xfa74('0x37')]=_['keys'](db[_0xfa74('0xbd')][_0xfa74('0xc1')]);_0x243da5[_0xfa74('0x38')]=_['keys'](_0x207677[_0xfa74('0x38')]);_0x243da5[_0xfa74('0x40')]=_['intersection'](_0x243da5[_0xfa74('0x37')],_0x243da5[_0xfa74('0x38')]);_0x1e33de[_0xfa74('0x3b')]=_['intersection'](_0x243da5['model'],qs[_0xfa74('0x3c')](_0x207677[_0xfa74('0x38')][_0xfa74('0x3c')]));_0x1e33de['attributes']=_0x1e33de[_0xfa74('0x3b')]['length']?_0x1e33de[_0xfa74('0x3b')]:_0x243da5[_0xfa74('0x37')];if(!_0x207677[_0xfa74('0x38')][_0xfa74('0x3d')](_0xfa74('0xc2'))){_0x1e33de['limit']=qs[_0xfa74('0x1f')](_0x207677[_0xfa74('0x38')][_0xfa74('0x1f')]);_0x1e33de[_0xfa74('0x1e')]=qs['offset'](_0x207677[_0xfa74('0x38')][_0xfa74('0x1e')]);}_0x1e33de['order']=qs[_0xfa74('0x3f')](_0x207677[_0xfa74('0x38')][_0xfa74('0x3f')]);_0x1e33de[_0xfa74('0x7b')]=qs[_0xfa74('0x40')](_[_0xfa74('0xc3')](_0x207677[_0xfa74('0x38')],_0x243da5[_0xfa74('0x40')]));_0x1e33de[_0xfa74('0x7b')][_0xfa74('0xb1')]=_0x1dddb3['id'];if(_0x207677[_0xfa74('0x38')][_0xfa74('0x82')]){_0x1e33de[_0xfa74('0x7b')]=_[_0xfa74('0xc4')](_0x1e33de['where'],{'$or':_[_0xfa74('0x2d')](_0x1e33de[_0xfa74('0x3b')],function(_0x140420){var _0x590da2={};_0x590da2[_0x140420]={'$like':'%'+_0x207677[_0xfa74('0x38')]['filter']+'%'};return _0x590da2;})});}if(_0x207677[_0xfa74('0x38')][_0xfa74('0x77')]){var _0x3c2f4e=_0x207677[_0xfa74('0x38')][_0xfa74('0x77')]['split'](',');var _0x4adbc9={};_0x4adbc9[_0x3c2f4e[0x0]]={'$gte':moment(_0x3c2f4e[0x1])[_0xfa74('0xc5')](_0xfa74('0xc6'))};_0x1e33de[_0xfa74('0x7b')]=_[_0xfa74('0xc4')](_0x1e33de[_0xfa74('0x7b')],_0x4adbc9);}_0x1e33de=_[_0xfa74('0xc4')]({},_0x1e33de,_0x207677[_0xfa74('0xb8')]);return db[_0xfa74('0xbd')][_0xfa74('0x99')]({'where':_0x1e33de['where']})['then'](function(_0x3f9377){_0x338c86[_0xfa74('0x99')]=_0x3f9377;if(_0x207677[_0xfa74('0x38')][_0xfa74('0xc7')]){_0x1e33de[_0xfa74('0xb7')]=[{'all':!![]}];}return db[_0xfa74('0xbd')]['findAll'](_0x1e33de);})[_0xfa74('0x32')](function(_0x2a5d02){_0x338c86['rows']=_0x2a5d02;return _0x338c86;});}})[_0xfa74('0x32')](respondWithFilteredResult(_0x58ff9b,_0x1e33de))[_0xfa74('0xb4')](handleError(_0x58ff9b,null));};exports[_0xfa74('0xc8')]=function(_0x1889fc,_0x55a8e0,_0xaceeec){return db[_0xfa74('0xb6')][_0xfa74('0x66')]({'where':{'id':_0x1889fc['params']['id']}})[_0xfa74('0x32')](handleEntityNotFound(_0x55a8e0,null))[_0xfa74('0x32')](function(_0x20d7d0){if(_0x20d7d0){return _0x20d7d0['setTags'](_0x1889fc[_0xfa74('0xba')]['ids'],_[_0xfa74('0xc9')](_0x1889fc['body'],[_0xfa74('0xbe'),'id'])||{})[_0xfa74('0xca')](function(){return db[_0xfa74('0x6a')][_0xfa74('0xcb')]({'attributes':['id',_0xfa74('0x2a'),_0xfa74('0x43')],'where':{'id':_0x1889fc[_0xfa74('0xba')][_0xfa74('0xbe')]}});})[_0xfa74('0x32')](function(_0x6710e2){socket['emit'](_0xfa74('0xcc'),{'id':Number(_0x1889fc[_0xfa74('0xb5')]['id']),'tags':_0x6710e2||[]});return{'id':Number(_0x1889fc[_0xfa74('0xb5')]['id']),'tags':_0x6710e2||[]};});}})[_0xfa74('0x32')](respondWithResult(_0x55a8e0,null))[_0xfa74('0xb4')](handleError(_0x55a8e0,null));};exports['removeTags']=function(_0xe32ec7,_0x543b39,_0x4f728c){return db[_0xfa74('0xb6')][_0xfa74('0x66')]({'where':{'id':_0xe32ec7['params']['id']}})[_0xfa74('0x32')](handleEntityNotFound(_0x543b39,null))[_0xfa74('0x32')](function(_0x534810){if(_0x534810){return _0x534810['removeTags'](_0xe32ec7[_0xfa74('0x38')][_0xfa74('0xbe')]);}})[_0xfa74('0x32')](respondWithStatusCode(_0x543b39,null))['catch'](handleError(_0x543b39,null));};exports[_0xfa74('0xcd')]=function(_0x541c6a,_0x3f266d){var _0x4f60de=moment()[_0xfa74('0xce')]()[_0xfa74('0x9a')]();var _0x404e58=path[_0xfa74('0xcf')](config[_0xfa74('0xd0')],'server',_0xfa74('0xd1'),_0xfa74('0xd2'));var _0x28c80d=path['join'](config[_0xfa74('0xd0')],_0xfa74('0xd3'),_0xfa74('0xd1'),_0xfa74('0xd4'));var _0x3067c0=path[_0xfa74('0xcf')](_0x404e58,_0x4f60de);var _0x4869f6=util[_0xfa74('0xc5')](_0xfa74('0xd5'),_0x541c6a[_0xfa74('0xb5')]['id'],_0x4f60de);var _0x4d0654=path[_0xfa74('0xcf')](_0x404e58,_0x4869f6);var _0x3568cc=[];_0x3568cc[_0xfa74('0x31')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x546a80=[{'model':db[_0xfa74('0xbd')],'as':'Messages','attributes':['id',_0xfa74('0xba'),_0xfa74('0x75')],'include':_0x3568cc}];return db['FaxInteraction'][_0xfa74('0x66')]({'where':{'id':_0x541c6a[_0xfa74('0xb5')]['id']},'include':_0x546a80})[_0xfa74('0x32')](handleEntityNotFound(_0x3f266d,null))[_0xfa74('0x32')](function(_0x360efb){if(_0x360efb&&_0x360efb[_0xfa74('0xd6')]){var _0x49f335=_0x360efb[_0xfa74('0xd7')]({'plain':!![]});fs[_0xfa74('0xd8')](_0x3067c0);for(var _0x51485b=0x0;_0x51485b<_0x49f335[_0xfa74('0xd6')]['length'];_0x51485b++){var _0x3c60d8=_0x49f335[_0xfa74('0xd6')][_0x51485b]['Attachment'];if(_0x3c60d8){var _0x379650=path[_0xfa74('0xcf')](_0x28c80d,_0x3c60d8[_0xfa74('0xd9')]);if(fs[_0xfa74('0xda')](_0x379650)){fs['createReadStream'](_0x379650)[_0xfa74('0xdb')](fs[_0xfa74('0xdc')](path['join'](_0x3067c0,_0x3c60d8[_0xfa74('0xd9')])));}}}return BPromise[_0xfa74('0x90')]()[_0xfa74('0x32')](function(){return new BPromise(function(_0x465f3d,_0x50b739){zipdir(_0x3067c0,{'saveTo':_0x4d0654},function(_0x50c61f,_0xdc86bd){if(_0x50c61f)return _0x50b739(_0x50c61f);return _0x465f3d(_0xdc86bd);});})['then'](function(){return new BPromise(function(_0x118314,_0x5ddb82){rimraf(_0x3067c0,function(_0x3a676b){if(_0x3a676b)_0x5ddb82(_0x3a676b);return _0x118314();});});})[_0xfa74('0x32')](function(){return _0x3f266d[_0xfa74('0xcd')](_0x4d0654,_0x4869f6,function(_0x31313c){if(_0x31313c){console['log'](_0xfa74('0xdd'),_0x31313c);}else{fs[_0xfa74('0xde')](_0x4d0654);}});});});}else{return _0x3f266d[_0xfa74('0x1b')](0xc8);}})[_0xfa74('0xb4')](handleError(_0x3f266d,null));}; \ No newline at end of file +var _0x91a7=['join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxInteraction.socket','sendStatus','end','json','offset','limit','status','Content-Range','reject','save','update','then','destroy','stack','name','send','Users','map','TagIds','Tags','split','push','catch','index','FaxInteraction','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','select','field','color','tools_tags','u.id','u.fullname','ui.FaxInteractionId','from','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','fax_accounts','a.id\x20=\x20i.FaxAccountId','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','`\x20>\x200','$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','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','count','sequelize','keyBy','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','include','options','create','describe','addMessage','FaxMessage','ids','getMessages','pick','FaxInteractionId','merge','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','findAll','faxInteractionTags:save','removeTags','download'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x91a7,0xe7));var _0x791a=function(_0x194e97,_0x498b33){_0x194e97=_0x194e97-0x0;var _0xc8d70a=_0x91a7[_0x194e97];return _0xc8d70a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var licenseUtil=require(_0x791a('0x15'));var db=require(_0x791a('0x16'))['db'];config['redis']=_['defaults'](config[_0x791a('0x17')],{'host':_0x791a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x791a('0x17')]));require(_0x791a('0x19'))['register'](socket);function respondWithStatusCode(_0x2887f0,_0x31b86d){_0x31b86d=_0x31b86d||0xcc;return function(_0x2ef5c5){if(_0x2ef5c5){return _0x2887f0[_0x791a('0x1a')](_0x31b86d);}return _0x2887f0['status'](_0x31b86d)[_0x791a('0x1b')]();};}function respondWithResult(_0x575d11,_0x43dea6){_0x43dea6=_0x43dea6||0xc8;return function(_0x355155){if(_0x355155){return _0x575d11['status'](_0x43dea6)[_0x791a('0x1c')](_0x355155);}};}function respondWithFilteredResult(_0x5bea2e,_0x35fe48){return function(_0x52941d){if(_0x52941d){var _0x4a84ee=_0x52941d['count'],_0x588d00=_0x35fe48[_0x791a('0x1d')],_0x40f0d3=_0x35fe48[_0x791a('0x1d')]+_0x35fe48[_0x791a('0x1e')],_0x52fa43;if(_0x40f0d3>=_0x4a84ee){_0x40f0d3=_0x4a84ee;_0x52fa43=0xc8;}else{_0x52fa43=0xce;}_0x5bea2e[_0x791a('0x1f')](_0x52fa43);return _0x5bea2e['set'](_0x791a('0x20'),_0x588d00+'-'+_0x40f0d3+'/'+_0x4a84ee)[_0x791a('0x1c')](_0x52941d);}return null;};}function patchUpdates(_0x234514){return function(_0x280f1e){try{jsonpatch['apply'](_0x280f1e,_0x234514,!![]);}catch(_0x448085){return BPromise[_0x791a('0x21')](_0x448085);}return _0x280f1e[_0x791a('0x22')]();};}function saveUpdates(_0x9e17b5,_0x3200dd){return function(_0x1091af){if(_0x1091af){return _0x1091af[_0x791a('0x23')](_0x9e17b5)[_0x791a('0x24')](function(_0x323c6a){return _0x323c6a;});}return null;};}function removeEntity(_0xe8e452,_0x137992){return function(_0x5e03a3){if(_0x5e03a3){return _0x5e03a3[_0x791a('0x25')]()[_0x791a('0x24')](function(){_0xe8e452[_0x791a('0x1f')](0xcc)[_0x791a('0x1b')]();});}};}function handleEntityNotFound(_0x4d748a,_0x456480){return function(_0x2db3f7){if(!_0x2db3f7){_0x4d748a['sendStatus'](0x194);}return _0x2db3f7;};}function handleError(_0xdfa84f,_0x1785f5){_0x1785f5=_0x1785f5||0x1f4;return function(_0x16dbaf){logger['error'](_0x16dbaf[_0x791a('0x26')]);if(_0x16dbaf[_0x791a('0x27')]){delete _0x16dbaf[_0x791a('0x27')];}_0xdfa84f[_0x791a('0x1f')](_0x1785f5)[_0x791a('0x28')](_0x16dbaf);};}function getInteractionUsers(_0x1a9c6b,_0x628816){return new BPromise(function(_0x889534,_0x58bbc0){try{if(_0x628816[_0x1a9c6b['id']]){_0x1a9c6b[_0x791a('0x29')]=_[_0x791a('0x2a')](_0x628816[_0x1a9c6b['id']],function(_0x1b10a7){return{'id':_0x1b10a7['id'],'fullname':_0x1b10a7['fullname']};});}}catch(_0x1cdda9){_0x58bbc0(_0x1cdda9);}_0x889534(_0x1a9c6b);});}function getInteractionTags(_0x5df656,_0xc59f5e){return new BPromise(function(_0x2e4ec8,_0xcde862){try{if(_0x5df656[_0x791a('0x2b')]){_0x5df656[_0x791a('0x2c')]=[];_0x5df656[_0x791a('0x2b')][_0x791a('0x2d')](',')['forEach'](function(_0x3662c6){_0x5df656[_0x791a('0x2c')][_0x791a('0x2e')](_0xc59f5e[_0x3662c6]);});}delete _0x5df656[_0x791a('0x2b')];}catch(_0x7d5dd0){_0xcde862(_0x7d5dd0);}_0x2e4ec8(_0x5df656);});}function updateFaxInteraction(_0x53c5b4,_0x42d650,_0x8e7002){return new BPromise(function(_0x423a1e,_0x2adf35){return getInteractionUsers(_0x53c5b4,_0x8e7002)[_0x791a('0x24')](function(_0x4ef825){return getInteractionTags(_0x4ef825,_0x42d650);})[_0x791a('0x24')](function(_0x1f28af){_0x423a1e(_0x1f28af);})[_0x791a('0x2f')](function(_0x2dbdc0){_0x2adf35(_0x2dbdc0);});});}exports[_0x791a('0x30')]=function(_0x52104d,_0xd5609){var _0x5d7435={},_0x1cf048={},_0x4cd047={'count':0x0,'rows':[]};var _0x5edb88=_[_0x791a('0x2a')](db[_0x791a('0x31')][_0x791a('0x32')],function(_0xff5b3c){return{'name':_0xff5b3c[_0x791a('0x33')],'type':_0xff5b3c[_0x791a('0x34')][_0x791a('0x35')]};});_0x1cf048['model']=_[_0x791a('0x2a')](_0x5edb88,'name');_0x1cf048[_0x791a('0x36')]=_['keys'](_0x52104d[_0x791a('0x36')]);_0x1cf048[_0x791a('0x37')]=_['intersection'](_0x1cf048[_0x791a('0x38')],_0x1cf048[_0x791a('0x36')]);_0x5d7435['attributes']=_[_0x791a('0x39')](_0x1cf048[_0x791a('0x38')],qs[_0x791a('0x3a')](_0x52104d[_0x791a('0x36')][_0x791a('0x3a')]));_0x5d7435[_0x791a('0x3b')]=_0x5d7435[_0x791a('0x3b')][_0x791a('0x3c')]?_0x5d7435[_0x791a('0x3b')]:_0x1cf048[_0x791a('0x38')];if(!_0x52104d['query'][_0x791a('0x3d')](_0x791a('0x3e'))){_0x5d7435[_0x791a('0x1e')]=qs['limit'](_0x52104d[_0x791a('0x36')]['limit']);_0x5d7435['offset']=qs['offset'](_0x52104d[_0x791a('0x36')][_0x791a('0x1d')]);}_0x5d7435['order']=qs[_0x791a('0x3f')](_0x52104d[_0x791a('0x36')][_0x791a('0x3f')]);_0x5d7435[_0x791a('0x40')]=qs['filters'](_['pick'](_0x52104d['query'],_0x1cf048[_0x791a('0x37')]),_0x5edb88);var _0x216dd3=[];var _0x4e0191=squel[_0x791a('0x41')]()[_0x791a('0x42')]('id')[_0x791a('0x42')](_0x791a('0x27'))['field'](_0x791a('0x43'))['from'](_0x791a('0x44'));var _0x31e5d3=squel[_0x791a('0x41')]()[_0x791a('0x42')](_0x791a('0x45'))['field'](_0x791a('0x46'))[_0x791a('0x42')](_0x791a('0x47'))[_0x791a('0x48')](_0x791a('0x49'),'ui')['left_join'](_0x791a('0x4a'),'u',_0x791a('0x4b'));var _0x4e379e=squel['select']()[_0x791a('0x48')](_0x791a('0x4c'),'i')[_0x791a('0x4d')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x791a('0x4d')](_0x791a('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x791a('0x4d')](_0x791a('0x4e'),'a',_0x791a('0x4f'))['left_join']('fax_messages','me',_0x791a('0x50'))[_0x791a('0x4d')](_0x791a('0x51'),'it',_0x791a('0x52'))['left_join'](_0x791a('0x44'),'t',_0x791a('0x53'));var _0x4e6d0d=squel[_0x791a('0x54')]();var _0x5570c7=[];var _0x8f3cbb=squel[_0x791a('0x54')]();var _0xe0696b;if(_0x52104d[_0x791a('0x36')][_0x791a('0x55')]){_0xe0696b=as[_0x791a('0x56')](_0x52104d[_0x791a('0x36')]['search']);var _0xdcb1b=_0xe0696b[_0x791a('0x57')];for(var _0x4bffa6=0x0;_0x4bffa6<_0xe0696b[_0x791a('0x58')][_0x791a('0x3c')];_0x4bffa6++){var _0x5dff77=_0xe0696b[_0x791a('0x58')][_0x4bffa6];var _0x365b62='i';var _0x12178e=_[_0x791a('0x59')](_0x5edb88,[_0x791a('0x27'),_0x5dff77['field']]);if(!_0x12178e){switch(_0x5dff77['field']){case'unreadMessages':if(_0x5dff77[_0x791a('0x5a')]==0x1){_0x4e379e['having']('`'+_0x5dff77['field']+_0x791a('0x5b'));}else{_0x4e379e['having']('`'+_0x5dff77[_0x791a('0x42')]+_0x791a('0x5c'));}break;case'Contact':if(_0x5dff77['operator']===_0x791a('0x5d')){if(_0x5dff77['value'][_0x791a('0x2d')]('\x20')[_0x791a('0x3c')]>0x1){_0x4e6d0d[_0xdcb1b](_0x791a('0x5e'),qs['getFullTextValue'](_0x5dff77[_0x791a('0x5a')]),null);}else{var _0x204614='%'+_0x5dff77['value']+'%';_0x4e6d0d[_0xdcb1b](_0x791a('0x5f'),_0x204614,_0x204614,_0x204614);}}else{_0x12178e=_[_0x791a('0x59')](_0x5edb88,[_0x791a('0x27'),_0x791a('0x60')]);_0x5dff77[_0x791a('0x42')]=_0x791a('0x60');_0x2abfe3=as['buildExpression'](_0x365b62,_0x12178e['type'],_0x5dff77);_0x4e6d0d[_0xdcb1b](_0x2abfe3[_0x791a('0x61')],_0x2abfe3['value'][_0x791a('0x62')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x1b')]);}break;case _0x791a('0x63'):var _0x3b760c=_0x5dff77[_0x791a('0x5a')][_0x791a('0x2d')](',')['map'](function(_0x1ac6e1){return Number(_0x1ac6e1);});_0x3b760c[_0x791a('0x64')](function(_0xc34c5b){_0x8f3cbb['or'](_0x791a('0x65'),'%,'+_0xc34c5b+',%');});_0x5570c7=_[_0x791a('0x66')](_0x5570c7,_0x3b760c);break;case _0x791a('0x67'):if(_0x5dff77[_0x791a('0x68')]==='$substring'){_0x4e6d0d[_0xdcb1b](_0x791a('0x69'),'%'+_0x5dff77['value']+'%',null);}else{_0x12178e=_['find'](_0x5edb88,[_0x791a('0x27'),_0x791a('0x6a')]);_0x5dff77[_0x791a('0x42')]=_0x791a('0x6a');_0x2abfe3=as[_0x791a('0x6b')](_0x365b62,_0x12178e[_0x791a('0x34')],_0x5dff77);_0x4e6d0d[_0xdcb1b](_0x2abfe3[_0x791a('0x61')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x62')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x1b')]);}break;case _0x791a('0x6c'):_0x2abfe3=as[_0x791a('0x6b')]('me',null,_0x5dff77);_0x4e6d0d[_0xdcb1b](_0x2abfe3[_0x791a('0x61')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x62')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x1b')]);break;}}else{var _0x2abfe3=as[_0x791a('0x6b')](_0x365b62,_0x12178e['type'],_0x5dff77);_0x4e6d0d[_0xdcb1b](_0x2abfe3[_0x791a('0x61')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x62')],_0x2abfe3[_0x791a('0x5a')][_0x791a('0x1b')]);}}}else{var _0x5ad4e0=_(_0x52104d[_0x791a('0x36')])[_0x791a('0x6d')]()[_0x791a('0x2a')](function(_0x120122){return _['some'](_0x5edb88,[_0x791a('0x27'),_0x120122])?_0x120122:undefined;})['compact']()['value']();if(!_['isEmpty'](_0x5ad4e0)){_0x5ad4e0['forEach'](function(_0x22aaf2){if(_0x22aaf2===_0x791a('0x6e')){_0x4e379e[_0x791a('0x40')](_0x791a('0x6f'),[][_0x791a('0x70')](_0x52104d[_0x791a('0x36')][_0x22aaf2]));}else if(_0x22aaf2===_0x791a('0x71')){var _0x5dca78=JSON['parse'](_0x52104d[_0x791a('0x36')][_0x22aaf2])[_0x791a('0x72')];var _0x535816=JSON['parse'](_0x52104d[_0x791a('0x36')][_0x22aaf2])[_0x791a('0x73')];_0x4e379e['where'](_0x791a('0x74'),_0x5dca78,_0x535816);}else{if(_0x52104d[_0x791a('0x36')][_0x22aaf2]===_0x791a('0x75')){_0x4e379e[_0x791a('0x40')]('i.'+_0x22aaf2+'\x20IS\x20NULL');}else{_0x4e379e['where']('i.'+_0x22aaf2+_0x791a('0x76'),_0x52104d[_0x791a('0x36')][_0x22aaf2]);}}});}if(_0x52104d['query'][_0x791a('0x77')]){if(_0x52104d[_0x791a('0x36')][_0x791a('0x77')]==0x1){_0x4e379e[_0x791a('0x78')]('`unreadMessages`\x20=\x200');}else{_0x4e379e[_0x791a('0x78')](_0x791a('0x79'));}}if(_0x52104d[_0x791a('0x36')][_0x791a('0x7a')]){_0x5570c7=_[_0x791a('0x7b')](_0x52104d[_0x791a('0x36')][_0x791a('0x7a')])?_0x52104d[_0x791a('0x36')]['tag']:new Array(_0x52104d['query']['tag']);_0x5570c7[_0x791a('0x64')](function(_0x306630){_0x8f3cbb['or'](_0x791a('0x65'),'%,'+_0x306630+',%');});}if(_0x52104d[_0x791a('0x36')][_0x791a('0x7c')]){var _0x1026be=_0x52104d[_0x791a('0x36')][_0x791a('0x7c')][_0x791a('0x7d')]('\x5c','\x5c\x5c')[_0x791a('0x7d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1026be)){_0x4e6d0d['or'](_0x791a('0x7e'),_0x1026be+'%')['or'](_0x791a('0x7f'),_0x1026be+'%');}_0x4e6d0d['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1026be+'%');}}_0x4e379e[_0x791a('0x40')](_0x4e6d0d);_0x4e379e[_0x791a('0x80')]('i.id');var _0x488176={'type':db[_0x791a('0x81')][_0x791a('0x82')]['SELECT'],'raw':!![]};var _0x4c121e=_0x4e379e[_0x791a('0x83')]();_0x4c121e[_0x791a('0x42')](_0x791a('0x84'));_0x4c121e['field'](_0x791a('0x85'),'unreadMessages');if(_0x5d7435[_0x791a('0x86')]){_0x5d7435[_0x791a('0x86')][_0x791a('0x64')](function(_0x4072d0){var _0x1de053=_0x4072d0[0x0]===_0x791a('0x87')?_0x4072d0[0x0]:'i.'+_0x4072d0[0x0];_0x4e379e['order'](_0x1de053,_0x4072d0[0x1]===_0x791a('0x88')?![]:!![]);});}if(!_[_0x791a('0x89')](_0x5570c7)){_0x4e379e[_0x791a('0x78')](_0x8f3cbb);_0x4c121e[_0x791a('0x40')](_0x791a('0x8a'),_0x5570c7);}BPromise[_0x791a('0x8b')]()[_0x791a('0x24')](function(){if(!_0xe0696b){if(_0x52104d[_0x791a('0x36')][_0x791a('0x6e')]||_0x52104d[_0x791a('0x36')][_0x791a('0x8c')])return;_0x4c121e[_0x791a('0x40')](_0x791a('0x8d'));_0x4e379e[_0x791a('0x40')](_0x791a('0x8d'));return;}if(_0x52104d[_0x791a('0x8e')][_0x791a('0x8f')]!==_0x791a('0x90'))return;return _0x52104d['user'][_0x791a('0x91')]({'attributes':['id'],'raw':!![]})[_0x791a('0x24')](function(_0x3126f1){if(_[_0x791a('0x89')](_0x3126f1)){_0x4c121e[_0x791a('0x40')]('i.FaxAccountId\x20IS\x20NULL');_0x4e379e[_0x791a('0x40')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4c121e[_0x791a('0x40')]('i.FaxAccountId\x20IN\x20?',_[_0x791a('0x2a')](_0x3126f1,'id'));_0x4e379e[_0x791a('0x40')]('i.FaxAccountId\x20IN\x20?',_[_0x791a('0x2a')](_0x3126f1,'id'));}});})[_0x791a('0x24')](function(){if(_0x52104d[_0x791a('0x8e')]['role']===_0x791a('0x90')&&!_0xe0696b&&!_0x52104d['query'][_0x791a('0x6e')])return[];return db['sequelize']['query'](_0x4c121e['toString'](),_0x488176);})[_0x791a('0x24')](function(_0x1b95ce){_0x4cd047[_0x791a('0x92')]=_0x1b95ce[_0x791a('0x3c')];if(_0x4cd047['count']===0x0)return[];return db[_0x791a('0x93')][_0x791a('0x36')](_0x4e0191['toString'](),_0x488176)[_0x791a('0x24')](function(_0x2a63bf){_0x216dd3=_[_0x791a('0x94')](_0x2a63bf,'id');_0x488176=_['merge'](_0x488176,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x52104d[_0x791a('0x36')][_0x791a('0x3a')]){_0x5d7435[_0x791a('0x3b')][_0x791a('0x64')](function(_0x700308){_0x4e379e[_0x791a('0x42')]('i.'+_0x700308);});}else{_0x4e379e[_0x791a('0x42')](_0x791a('0x85'),'unreadMessages');_0x4e379e[_0x791a('0x42')](_0x791a('0x95'),_0x791a('0x96'));_0x4e379e[_0x791a('0x42')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x4e379e[_0x791a('0x42')](_0x791a('0x97'),_0x791a('0x87'));_0x4e379e[_0x791a('0x42')](_0x791a('0x98'));_0x4e379e[_0x791a('0x42')](_0x791a('0x99'),_0x791a('0x9a'));_0x4e379e[_0x791a('0x42')](_0x791a('0x9b'),_0x791a('0x9c'));_0x4e379e[_0x791a('0x42')](_0x791a('0x9d'),'Contact.email');_0x4e379e[_0x791a('0x42')](_0x791a('0x9e'),_0x791a('0x9f'));_0x4e379e[_0x791a('0x42')](_0x791a('0xa0'),_0x791a('0xa1'));_0x4e379e[_0x791a('0x42')](_0x791a('0xa2'),_0x791a('0xa3'));_0x4e379e[_0x791a('0x42')]('o.fullname',_0x791a('0xa4'));_0x4e379e[_0x791a('0x42')]('o.internal',_0x791a('0xa5'));_0x4e379e[_0x791a('0x42')](_0x791a('0xa6'),_0x791a('0x2b'));}if(_0x5d7435[_0x791a('0x1e')])_0x4e379e['limit'](_0x5d7435['limit']);if(_0x5d7435[_0x791a('0x1d')])_0x4e379e[_0x791a('0x1d')](_0x5d7435['offset']);return db['sequelize'][_0x791a('0x36')](_0x4e379e[_0x791a('0xa7')](),_0x488176);})[_0x791a('0x24')](function(_0x391682){_0x31e5d3[_0x791a('0x40')](_0x791a('0xa8'),_[_0x791a('0x2a')](_0x391682,'id'));return db[_0x791a('0x93')]['query'](_0x31e5d3['toString'](),_0x488176)['then'](function(_0x2adcb5){var _0x205a00=_[_0x791a('0xa9')](_0x2adcb5,'FaxInteractionId');var _0x480ad9=[];_0x391682[_0x791a('0x64')](function(_0x387f7d){_0x480ad9[_0x791a('0x2e')](updateFaxInteraction(_0x387f7d,_0x216dd3,_0x205a00));});return BPromise[_0x791a('0xaa')](_0x480ad9);});});})['then'](function(_0x23c505){_0x4cd047[_0x791a('0xab')]=_0x23c505;return _0x4cd047;})[_0x791a('0x24')](respondWithFilteredResult(_0xd5609,_0x5d7435))[_0x791a('0x2f')](handleError(_0xd5609,null));};exports[_0x791a('0xac')]=function(_0x236042,_0x3dee35){var _0x25be53={'raw':![],'where':{'id':_0x236042[_0x791a('0xad')]['id']}},_0x3c0bf5={};_0x3c0bf5[_0x791a('0x38')]=_['keys'](db[_0x791a('0x31')][_0x791a('0x32')]);_0x3c0bf5[_0x791a('0x36')]=_['keys'](_0x236042['query']);_0x3c0bf5['filters']=_[_0x791a('0x39')](_0x3c0bf5[_0x791a('0x38')],_0x3c0bf5[_0x791a('0x36')]);_0x25be53[_0x791a('0x3b')]=_[_0x791a('0x39')](_0x3c0bf5[_0x791a('0x38')],qs['fields'](_0x236042[_0x791a('0x36')][_0x791a('0x3a')]));_0x25be53[_0x791a('0x3b')]=_0x25be53['attributes'][_0x791a('0x3c')]?_0x25be53[_0x791a('0x3b')]:_0x3c0bf5['model'];if(_0x236042[_0x791a('0x36')]['includeAll']){_0x25be53[_0x791a('0xae')]=[{'all':!![]}];}_0x25be53=_['merge']({},_0x25be53,_0x236042[_0x791a('0xaf')]);return db['FaxInteraction']['find'](_0x25be53)['then'](handleEntityNotFound(_0x3dee35,null))['then'](respondWithResult(_0x3dee35,null))[_0x791a('0x2f')](handleError(_0x3dee35,null));};exports[_0x791a('0xb0')]=function(_0x7772a7,_0x5555eb){return db[_0x791a('0x31')][_0x791a('0xb0')](_0x7772a7[_0x791a('0x6c')],{})[_0x791a('0x24')](respondWithResult(_0x5555eb,0xc9))[_0x791a('0x2f')](handleError(_0x5555eb,null));};exports['update']=function(_0x4c5bde,_0x47759b){if(_0x4c5bde[_0x791a('0x6c')]['id']){delete _0x4c5bde[_0x791a('0x6c')]['id'];}return db['FaxInteraction'][_0x791a('0x59')]({'where':{'id':_0x4c5bde['params']['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x47759b,null))[_0x791a('0x24')](saveUpdates(_0x4c5bde[_0x791a('0x6c')],null))['then'](respondWithResult(_0x47759b,null))[_0x791a('0x2f')](handleError(_0x47759b,null));};exports[_0x791a('0x25')]=function(_0x117462,_0x480688){return db['FaxInteraction'][_0x791a('0x59')]({'where':{'id':_0x117462[_0x791a('0xad')]['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x480688,null))[_0x791a('0x24')](removeEntity(_0x480688,null))[_0x791a('0x2f')](handleError(_0x480688,null));};exports['describe']=function(_0x5c24a7,_0x5c6632){return db['FaxInteraction'][_0x791a('0xb1')]()['then'](respondWithResult(_0x5c6632,null))[_0x791a('0x2f')](handleError(_0x5c6632,null));};exports[_0x791a('0xb2')]=function(_0x3f113c,_0x3411b9,_0x2abd26){return db[_0x791a('0xb3')][_0x791a('0x59')]({'where':{'id':_0x3f113c[_0x791a('0xad')]['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x3411b9,null))[_0x791a('0x24')](function(_0x26b324){if(_0x26b324){return _0x26b324['addMessage'](_0x3f113c[_0x791a('0x6c')][_0x791a('0xb4')],_['omit'](_0x3f113c[_0x791a('0x6c')],[_0x791a('0xb4'),'id'])||{});}})[_0x791a('0x24')](respondWithResult(_0x3411b9,null))['catch'](handleError(_0x3411b9,null));};exports[_0x791a('0xb5')]=function(_0x2524c5,_0x235b39,_0x511922){var _0x45fb66={'raw':![],'where':{}};var _0x346c15={};var _0x10eade={'count':0x0,'rows':[]};return db[_0x791a('0x31')]['findOne']({'where':{'id':_0x2524c5['params']['id']}})['then'](handleEntityNotFound(_0x235b39,null))['then'](function(_0x3fb481){if(_0x3fb481){_0x346c15[_0x791a('0x38')]=_['keys'](db[_0x791a('0xb3')][_0x791a('0x32')]);_0x346c15[_0x791a('0x36')]=_[_0x791a('0x6d')](_0x2524c5[_0x791a('0x36')]);_0x346c15[_0x791a('0x37')]=_[_0x791a('0x39')](_0x346c15['model'],_0x346c15[_0x791a('0x36')]);_0x45fb66[_0x791a('0x3b')]=_['intersection'](_0x346c15[_0x791a('0x38')],qs['fields'](_0x2524c5[_0x791a('0x36')][_0x791a('0x3a')]));_0x45fb66[_0x791a('0x3b')]=_0x45fb66['attributes'][_0x791a('0x3c')]?_0x45fb66[_0x791a('0x3b')]:_0x346c15[_0x791a('0x38')];if(!_0x2524c5[_0x791a('0x36')][_0x791a('0x3d')](_0x791a('0x3e'))){_0x45fb66[_0x791a('0x1e')]=qs[_0x791a('0x1e')](_0x2524c5[_0x791a('0x36')][_0x791a('0x1e')]);_0x45fb66['offset']=qs['offset'](_0x2524c5[_0x791a('0x36')][_0x791a('0x1d')]);}_0x45fb66[_0x791a('0x86')]=qs[_0x791a('0x3f')](_0x2524c5[_0x791a('0x36')]['sort']);_0x45fb66['where']=qs[_0x791a('0x37')](_[_0x791a('0xb6')](_0x2524c5[_0x791a('0x36')],_0x346c15[_0x791a('0x37')]));_0x45fb66[_0x791a('0x40')][_0x791a('0xb7')]=_0x3fb481['id'];if(_0x2524c5['query'][_0x791a('0x7c')]){_0x45fb66['where']=_[_0x791a('0xb8')](_0x45fb66['where'],{'$or':_[_0x791a('0x2a')](_0x45fb66['attributes'],function(_0x4c6b20){var _0x1611cc={};_0x1611cc[_0x4c6b20]={'$like':'%'+_0x2524c5[_0x791a('0x36')][_0x791a('0x7c')]+'%'};return _0x1611cc;})});}if(_0x2524c5[_0x791a('0x36')][_0x791a('0x72')]){var _0x1bce38=_0x2524c5[_0x791a('0x36')]['$gte'][_0x791a('0x2d')](',');var _0x4504c6={};_0x4504c6[_0x1bce38[0x0]]={'$gte':moment(_0x1bce38[0x1])[_0x791a('0xb9')](_0x791a('0xba'))};_0x45fb66[_0x791a('0x40')]=_[_0x791a('0xb8')](_0x45fb66['where'],_0x4504c6);}_0x45fb66=_[_0x791a('0xb8')]({},_0x45fb66,_0x2524c5['options']);return db['FaxMessage'][_0x791a('0x92')]({'where':_0x45fb66['where']})[_0x791a('0x24')](function(_0x54f02d){_0x10eade[_0x791a('0x92')]=_0x54f02d;if(_0x2524c5['query']['includeAll']){_0x45fb66[_0x791a('0xae')]=[{'all':!![]}];}return db[_0x791a('0xb3')]['findAll'](_0x45fb66);})['then'](function(_0x4a72f2){_0x10eade[_0x791a('0xab')]=_0x4a72f2;return _0x10eade;});}})[_0x791a('0x24')](respondWithFilteredResult(_0x235b39,_0x45fb66))[_0x791a('0x2f')](handleError(_0x235b39,null));};exports[_0x791a('0xbb')]=function(_0x2b529a,_0x516b4a,_0x5b2c76){return db[_0x791a('0x31')][_0x791a('0x59')]({'where':{'id':_0x2b529a['params']['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x516b4a,null))['then'](function(_0x84e0b9){if(_0x84e0b9){return _0x84e0b9[_0x791a('0xbc')](_0x2b529a['body'][_0x791a('0xb4')],_[_0x791a('0xbd')](_0x2b529a[_0x791a('0x6c')],[_0x791a('0xb4'),'id'])||{})[_0x791a('0xbe')](function(){return db[_0x791a('0x63')][_0x791a('0xbf')]({'attributes':['id','name',_0x791a('0x43')],'where':{'id':_0x2b529a[_0x791a('0x6c')][_0x791a('0xb4')]}});})['then'](function(_0x50f1f8){socket['emit'](_0x791a('0xc0'),{'id':Number(_0x2b529a[_0x791a('0xad')]['id']),'tags':_0x50f1f8||[]});return{'id':Number(_0x2b529a[_0x791a('0xad')]['id']),'tags':_0x50f1f8||[]};});}})[_0x791a('0x24')](respondWithResult(_0x516b4a,null))['catch'](handleError(_0x516b4a,null));};exports['removeTags']=function(_0x4fa04a,_0x27040a,_0x31f836){return db[_0x791a('0x31')]['find']({'where':{'id':_0x4fa04a[_0x791a('0xad')]['id']}})[_0x791a('0x24')](handleEntityNotFound(_0x27040a,null))[_0x791a('0x24')](function(_0x566cd7){if(_0x566cd7){return _0x566cd7[_0x791a('0xc1')](_0x4fa04a[_0x791a('0x36')][_0x791a('0xb4')]);}})[_0x791a('0x24')](respondWithStatusCode(_0x27040a,null))[_0x791a('0x2f')](handleError(_0x27040a,null));};exports[_0x791a('0xc2')]=function(_0x3b8837,_0x3753bf){var _0x263d4c=moment()['unix']()[_0x791a('0xa7')]();var _0x308094=path[_0x791a('0xc3')](config[_0x791a('0xc4')],_0x791a('0xc5'),'files',_0x791a('0xc6'));var _0x329124=path['join'](config[_0x791a('0xc4')],_0x791a('0xc5'),_0x791a('0xc7'),_0x791a('0xc8'));var _0x4732c0=path[_0x791a('0xc3')](_0x308094,_0x263d4c);var _0x5109f6=util[_0x791a('0xb9')](_0x791a('0xc9'),_0x3b8837[_0x791a('0xad')]['id'],_0x263d4c);var _0x34bccf=path[_0x791a('0xc3')](_0x308094,_0x5109f6);var _0x397eb9=[];_0x397eb9['push']({'model':db[_0x791a('0xca')],'as':_0x791a('0xca'),'raw':!![]});var _0x370a11=[{'model':db[_0x791a('0xb3')],'as':_0x791a('0xcb'),'attributes':['id',_0x791a('0x6c'),'createdAt'],'include':_0x397eb9}];return db[_0x791a('0x31')][_0x791a('0x59')]({'where':{'id':_0x3b8837[_0x791a('0xad')]['id']},'include':_0x370a11})[_0x791a('0x24')](handleEntityNotFound(_0x3753bf,null))[_0x791a('0x24')](function(_0x41cc4d){if(_0x41cc4d&&_0x41cc4d[_0x791a('0xcb')]){var _0x18c311=_0x41cc4d[_0x791a('0xcc')]({'plain':!![]});fs[_0x791a('0xcd')](_0x4732c0);for(var _0x4abd8c=0x0;_0x4abd8c<_0x18c311[_0x791a('0xcb')][_0x791a('0x3c')];_0x4abd8c++){var _0x61c2f7=_0x18c311['Messages'][_0x4abd8c][_0x791a('0xca')];if(_0x61c2f7){var _0x1f5232=path[_0x791a('0xc3')](_0x329124,_0x61c2f7['basename']);if(fs['existsSync'](_0x1f5232)){fs[_0x791a('0xce')](_0x1f5232)[_0x791a('0xcf')](fs[_0x791a('0xd0')](path[_0x791a('0xc3')](_0x4732c0,_0x61c2f7[_0x791a('0xd1')])));}}}return BPromise[_0x791a('0x8b')]()[_0x791a('0x24')](function(){return new BPromise(function(_0xebcb2e,_0x248e75){zipdir(_0x4732c0,{'saveTo':_0x34bccf},function(_0x1f29e4,_0x158768){if(_0x1f29e4)return _0x248e75(_0x1f29e4);return _0xebcb2e(_0x158768);});})['then'](function(){return new BPromise(function(_0x50ddb,_0x117560){rimraf(_0x4732c0,function(_0xc6e004){if(_0xc6e004)_0x117560(_0xc6e004);return _0x50ddb();});});})[_0x791a('0x24')](function(){return _0x3753bf[_0x791a('0xc2')](_0x34bccf,_0x5109f6,function(_0x37adb2){if(_0x37adb2){console[_0x791a('0xd2')](_0x791a('0xd3'),_0x37adb2);}else{fs[_0x791a('0xd4')](_0x34bccf);}});});});}else{return _0x3753bf[_0x791a('0x1a')](0xc8);}})[_0x791a('0x2f')](handleError(_0x3753bf,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index cd3f256..4448177 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 _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x157cfe,_0x40829d){var _0x4c4da2=function(_0x559db2){while(--_0x559db2){_0x157cfe['push'](_0x157cfe['shift']());}};_0x4c4da2(++_0x40829d);}(_0x326f,0xd1));var _0xf326=function(_0x40501f,_0x13b15d){_0x40501f=_0x40501f-0x0;var _0x29e27d=_0x326f[_0x40501f];return _0x29e27d;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2ef3,0xba));var _0x32ef=function(_0x2071c1,_0x541c0d){_0x2071c1=_0x2071c1-0x0;var _0x444ee9=_0x2ef3[_0x2071c1];return _0x444ee9;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 75e1d25..a9b9783 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 _0xe345=['define','FaxInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x46076e,_0x298c8b){var _0x3a695a=function(_0x446ef4){while(--_0x446ef4){_0x46076e['push'](_0x46076e['shift']());}};_0x3a695a(++_0x298c8b);}(_0xe345,0x17c));var _0x5e34=function(_0xa83955,_0x842b87){_0xa83955=_0xa83955-0x0;var _0x39d283=_0xe345[_0xa83955];return _0x39d283;};'use strict';var _=require(_0x5e34('0x0'));var util=require(_0x5e34('0x1'));var logger=require(_0x5e34('0x2'))(_0x5e34('0x3'));var moment=require(_0x5e34('0x4'));var BPromise=require(_0x5e34('0x5'));var rp=require(_0x5e34('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e34('0x7'));var config=require(_0x5e34('0x8'));var attributes=require(_0x5e34('0x9'));module[_0x5e34('0xa')]=function(_0x293145,_0xacf670){return _0x293145[_0x5e34('0xb')](_0x5e34('0xc'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d7f0e,_0x5f09c3,_0x523514){if(_0x3d7f0e[_0x5e34('0xd')]('closed')){_0x3d7f0e[_0x5e34('0xe')]=moment()[_0x5e34('0xf')](_0x5e34('0x10'));}_0x523514(null,_0x3d7f0e);}}});}; \ No newline at end of file +var _0x2b65=['define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x2b65,0xaf));var _0x52b6=function(_0x237aab,_0x523604){_0x237aab=_0x237aab-0x0;var _0x55b525=_0x2b65[_0x237aab];return _0x55b525;};'use strict';var _=require('lodash');var util=require(_0x52b6('0x0'));var logger=require(_0x52b6('0x1'))('api');var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52b6('0x4'));var rimraf=require(_0x52b6('0x5'));var config=require(_0x52b6('0x6'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x163dc8,_0x4def41){return _0x163dc8[_0x52b6('0x7')](_0x52b6('0x8'),attributes,{'tableName':_0x52b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x554c16,_0x1b5612,_0x101da0){if(_0x554c16[_0x52b6('0xa')](_0x52b6('0xb'))){_0x554c16['closedAt']=moment()[_0x52b6('0xc')](_0x52b6('0xd'));}_0x101da0(null,_0x554c16);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 37d9cdf..8d3ab94 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 _0x3a0d=['code','message','result','FaxInteraction','options','raw','limit','debug','UpdateFaxInteraction','AddTagsToFaxInteraction','body','omit','ids','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','./faxInteraction.socket','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1865cf,_0x532353){var _0x4e3f5a=function(_0x56b393){while(--_0x56b393){_0x1865cf['push'](_0x1865cf['shift']());}};_0x4e3f5a(++_0x532353);}(_0x3a0d,0x1cc));var _0xd3a0=function(_0x37e02d,_0x2d9da3){_0x37e02d=_0x37e02d-0x0;var _0x11f44f=_0x3a0d[_0x37e02d];return _0x11f44f;};'use strict';var _=require(_0xd3a0('0x0'));var util=require(_0xd3a0('0x1'));var moment=require(_0xd3a0('0x2'));var BPromise=require(_0xd3a0('0x3'));var rs=require(_0xd3a0('0x4'));var fs=require('fs');var Redis=require(_0xd3a0('0x5'));var db=require(_0xd3a0('0x6'))['db'];var utils=require(_0xd3a0('0x7'));var logger=require(_0xd3a0('0x8'))('rpc');var config=require(_0xd3a0('0x9'));var jayson=require(_0xd3a0('0xa'));var client=jayson[_0xd3a0('0xb')]['http']({'port':0x232a});config[_0xd3a0('0xc')]=_['defaults'](config[_0xd3a0('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd3a0('0xc')]));require(_0xd3a0('0xd'))['register'](socket);function respondWithRpcPromise(_0x201f73,_0x4c4ff9,_0x13c0b8){return new BPromise(function(_0x218612,_0x34f17c){return client['request'](_0x201f73,_0x13c0b8)[_0xd3a0('0xe')](function(_0x314743){logger[_0xd3a0('0xf')](_0xd3a0('0x10'),_0x4c4ff9,_0xd3a0('0x11'));logger['debug'](_0xd3a0('0x12'),_0x4c4ff9,_0xd3a0('0x11'),JSON[_0xd3a0('0x13')](_0x314743));if(_0x314743[_0xd3a0('0x14')]){if(_0x314743[_0xd3a0('0x14')][_0xd3a0('0x15')]===0x1f4){logger['error'](_0xd3a0('0x10'),_0x4c4ff9,_0x314743[_0xd3a0('0x14')][_0xd3a0('0x16')]);return _0x34f17c(_0x314743['error'][_0xd3a0('0x16')]);}logger[_0xd3a0('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x4c4ff9,_0x314743[_0xd3a0('0x14')][_0xd3a0('0x16')]);return _0x218612(_0x314743[_0xd3a0('0x14')][_0xd3a0('0x16')]);}else{logger[_0xd3a0('0xf')](_0xd3a0('0x10'),_0x4c4ff9,_0xd3a0('0x11'));_0x218612(_0x314743[_0xd3a0('0x17')][_0xd3a0('0x16')]);}})['catch'](function(_0x1e7fa2){logger['error'](_0xd3a0('0x10'),_0x4c4ff9,_0x1e7fa2);_0x34f17c(_0x1e7fa2);});});}exports['UpdateFaxInteraction']=function(_0x55bced){var _0x1471b3=this;return new Promise(function(_0x3c08a5,_0x18c658){return db[_0xd3a0('0x18')]['update'](_0x55bced['body'],{'raw':_0x55bced[_0xd3a0('0x19')]?_0x55bced[_0xd3a0('0x19')][_0xd3a0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55bced[_0xd3a0('0x19')]?_0x55bced[_0xd3a0('0x19')]['where']||null:null,'attributes':_0x55bced[_0xd3a0('0x19')]?_0x55bced[_0xd3a0('0x19')]['attributes']||null:null,'limit':_0x55bced['options']?_0x55bced[_0xd3a0('0x19')][_0xd3a0('0x1b')]||null:null})['then'](function(_0x67ace8){logger[_0xd3a0('0xf')]('UpdateFaxInteraction',_0x55bced);logger[_0xd3a0('0x1c')](_0xd3a0('0x1d'),_0x55bced,JSON[_0xd3a0('0x13')](_0x67ace8));_0x3c08a5(_0x67ace8);})['catch'](function(_0x5145da){logger[_0xd3a0('0x14')](_0xd3a0('0x1d'),_0x5145da[_0xd3a0('0x16')],_0x55bced);_0x18c658(_0x1471b3['error'](0x1f4,_0x5145da[_0xd3a0('0x16')]));});});};exports[_0xd3a0('0x1e')]=function(_0x12e5b0){return new Promise(function(_0x2bd6d5,_0x25188b){return db[_0xd3a0('0x18')]['find']({'where':_0x12e5b0[_0xd3a0('0x19')]?_0x12e5b0[_0xd3a0('0x19')]['where']||null:null})[_0xd3a0('0xe')](function(_0x1442ac){if(_0x1442ac){return _0x1442ac['addTags'](_0x12e5b0[_0xd3a0('0x1f')]['ids'],_[_0xd3a0('0x20')](_0x12e5b0['body'],[_0xd3a0('0x21'),'id'])||{});}})[_0xd3a0('0x22')](function(_0xe740b9){logger[_0xd3a0('0xf')](_0xd3a0('0x23'),_0x12e5b0);logger[_0xd3a0('0x1c')](_0xd3a0('0x23'),_0x12e5b0,JSON[_0xd3a0('0x13')](_0xe740b9));_0x2bd6d5(_0xe740b9);})[_0xd3a0('0x24')](function(_0x2e8a66){logger[_0xd3a0('0x14')](_0xd3a0('0x23'),_0x2e8a66[_0xd3a0('0x16')],_0x12e5b0);_0x25188b(_this[_0xd3a0('0x14')](0x1f4,_0x2e8a66['message']));});});}; \ No newline at end of file +var _0xe4ee=['addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','limit','stringify','find'];(function(_0x1866bd,_0x3c1128){var _0x174e7d=function(_0x5c7f97){while(--_0x5c7f97){_0x1866bd['push'](_0x1866bd['shift']());}};_0x174e7d(++_0x3c1128);}(_0xe4ee,0x18c));var _0xee4e=function(_0x29f99b,_0x3bf940){_0x29f99b=_0x29f99b-0x0;var _0xe5f8c2=_0xe4ee[_0x29f99b];return _0xe5f8c2;};'use strict';var _=require(_0xee4e('0x0'));var util=require(_0xee4e('0x1'));var moment=require('moment');var BPromise=require(_0xee4e('0x2'));var rs=require(_0xee4e('0x3'));var fs=require('fs');var Redis=require(_0xee4e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xee4e('0x5'));var logger=require('../../config/logger')(_0xee4e('0x6'));var config=require(_0xee4e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xee4e('0x8')]['http']({'port':0x232a});config['redis']=_[_0xee4e('0x9')](config[_0xee4e('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xee4e('0xb'))(new Redis(config[_0xee4e('0xa')]));require(_0xee4e('0xc'))[_0xee4e('0xd')](socket);function respondWithRpcPromise(_0x576c12,_0x3c7632,_0x405251){return new BPromise(function(_0x5164cf,_0x34d315){return client[_0xee4e('0xe')](_0x576c12,_0x405251)[_0xee4e('0xf')](function(_0x108339){logger[_0xee4e('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x3c7632,'request\x20sent');logger[_0xee4e('0x11')](_0xee4e('0x12'),_0x3c7632,'request\x20sent',JSON['stringify'](_0x108339));if(_0x108339[_0xee4e('0x13')]){if(_0x108339[_0xee4e('0x13')][_0xee4e('0x14')]===0x1f4){logger[_0xee4e('0x13')](_0xee4e('0x15'),_0x3c7632,_0x108339[_0xee4e('0x13')][_0xee4e('0x16')]);return _0x34d315(_0x108339[_0xee4e('0x13')][_0xee4e('0x16')]);}logger[_0xee4e('0x13')](_0xee4e('0x15'),_0x3c7632,_0x108339[_0xee4e('0x13')]['message']);return _0x5164cf(_0x108339[_0xee4e('0x13')]['message']);}else{logger[_0xee4e('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x3c7632,'request\x20sent');_0x5164cf(_0x108339['result'][_0xee4e('0x16')]);}})[_0xee4e('0x17')](function(_0x37d8cf){logger[_0xee4e('0x13')](_0xee4e('0x15'),_0x3c7632,_0x37d8cf);_0x34d315(_0x37d8cf);});});}exports[_0xee4e('0x18')]=function(_0x2ca1df){var _0x11da00=this;return new Promise(function(_0x3df188,_0x1c50b2){return db[_0xee4e('0x19')][_0xee4e('0x1a')](_0x2ca1df['body'],{'raw':_0x2ca1df[_0xee4e('0x1b')]?_0x2ca1df[_0xee4e('0x1b')][_0xee4e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ca1df[_0xee4e('0x1b')]?_0x2ca1df['options'][_0xee4e('0x1d')]||null:null,'attributes':_0x2ca1df[_0xee4e('0x1b')]?_0x2ca1df[_0xee4e('0x1b')]['attributes']||null:null,'limit':_0x2ca1df['options']?_0x2ca1df[_0xee4e('0x1b')][_0xee4e('0x1e')]||null:null})[_0xee4e('0xf')](function(_0x531648){logger['info'](_0xee4e('0x18'),_0x2ca1df);logger[_0xee4e('0x11')](_0xee4e('0x18'),_0x2ca1df,JSON[_0xee4e('0x1f')](_0x531648));_0x3df188(_0x531648);})[_0xee4e('0x17')](function(_0x138d31){logger['error'](_0xee4e('0x18'),_0x138d31['message'],_0x2ca1df);_0x1c50b2(_0x11da00[_0xee4e('0x13')](0x1f4,_0x138d31[_0xee4e('0x16')]));});});};exports['AddTagsToFaxInteraction']=function(_0x283497){return new Promise(function(_0xcdf877,_0x41f1a7){return db['FaxInteraction'][_0xee4e('0x20')]({'where':_0x283497['options']?_0x283497['options'][_0xee4e('0x1d')]||null:null})[_0xee4e('0xf')](function(_0x503466){if(_0x503466){return _0x503466[_0xee4e('0x21')](_0x283497[_0xee4e('0x22')][_0xee4e('0x23')],_[_0xee4e('0x24')](_0x283497[_0xee4e('0x22')],['ids','id'])||{});}})[_0xee4e('0x25')](function(_0x5d08d1){logger[_0xee4e('0x10')]('AddTags',_0x283497);logger['debug'](_0xee4e('0x26'),_0x283497,JSON['stringify'](_0x5d08d1));_0xcdf877(_0x5d08d1);})[_0xee4e('0x17')](function(_0x2ac105){logger[_0xee4e('0x13')]('AddTags',_0x2ac105['message'],_0x283497);_0x41f1a7(_this['error'](0x1f4,_0x2ac105[_0xee4e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 51d4662..b2b5255 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 _0x3ba1=['./faxInteraction.events','save','remove','emit','removeListener','register','length','faxInteraction:'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x3ba1,0x190));var _0x13ba=function(_0x399f71,_0x2a0b89){_0x399f71=_0x399f71-0x0;var _0x881197=_0x3ba1[_0x399f71];return _0x881197;};'use strict';var FaxInteractionEvents=require(_0x13ba('0x0'));var events=[_0x13ba('0x1'),_0x13ba('0x2'),'update'];function createListener(_0x4da739,_0x13cdf4){return function(_0x43a976){_0x13cdf4[_0x13ba('0x3')](_0x4da739,_0x43a976);};}function removeListener(_0x30b771,_0x555e5e){return function(){FaxInteractionEvents[_0x13ba('0x4')](_0x30b771,_0x555e5e);};}exports[_0x13ba('0x5')]=function(_0x5a3d24){for(var _0x4d5efb=0x0,_0x4fe55b=events[_0x13ba('0x6')];_0x4d5efb<_0x4fe55b;_0x4d5efb++){var _0x2c57a7=events[_0x4d5efb];var _0x20fbff=createListener(_0x13ba('0x7')+_0x2c57a7,_0x5a3d24);FaxInteractionEvents['on'](_0x2c57a7,_0x20fbff);}}; \ No newline at end of file +var _0x04d2=['emit','register','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x04d2,0x1e4));var _0x204d=function(_0xeb4ebe,_0x38267c){_0xeb4ebe=_0xeb4ebe-0x0;var _0x1c0515=_0x04d2[_0xeb4ebe];return _0x1c0515;};'use strict';var FaxInteractionEvents=require(_0x204d('0x0'));var events=[_0x204d('0x1'),_0x204d('0x2'),_0x204d('0x3')];function createListener(_0x13e062,_0x568935){return function(_0x1cbc47){_0x568935[_0x204d('0x4')](_0x13e062,_0x1cbc47);};}function removeListener(_0xde8420,_0x1c311d){return function(){FaxInteractionEvents['removeListener'](_0xde8420,_0x1c311d);};}exports[_0x204d('0x5')]=function(_0x136a08){for(var _0x68034=0x0,_0x85f3b5=events[_0x204d('0x6')];_0x68034<_0x85f3b5;_0x68034++){var _0x4a8c2c=events[_0x68034];var _0x2457cf=createListener(_0x204d('0x7')+_0x4a8c2c,_0x136a08);FaxInteractionEvents['on'](_0x4a8c2c,_0x2457cf);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index da118a8..675393e 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 _0xbdb7=['post','addMessage','tracked','put','fax','faxinteraction:update','update','delete','faxinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','/:id','/:id/messages','isAuthenticated','getMessages','/:id/download','download'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xb13d17,_0x1cd499){_0xb13d17=_0xb13d17-0x0;var _0x23c99e=_0xbdb7[_0xb13d17];return _0x23c99e;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./faxInteraction.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x7bdb('0x9')](_0x7bdb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0x9')](_0x7bdb('0xc'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0xe')]);router[_0x7bdb('0x9')](_0x7bdb('0xf'),auth[_0x7bdb('0xd')](),controller[_0x7bdb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x7bdb('0x11')](_0x7bdb('0xc'),auth['isAuthenticated'](),controller[_0x7bdb('0x12')]);router['post']('/:id/tags',auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x7bdb('0x14')](_0x7bdb('0xb'),auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')](_0x7bdb('0x15'),_0x7bdb('0x16')),controller[_0x7bdb('0x17')]);router[_0x7bdb('0x18')]('/:id',auth[_0x7bdb('0xd')](),interaction[_0x7bdb('0x13')](_0x7bdb('0x15'),_0x7bdb('0x19')),controller['destroy']);router[_0x7bdb('0x18')](_0x7bdb('0x1a'),auth['isAuthenticated'](),controller[_0x7bdb('0x1b')]);module[_0x7bdb('0x1c')]=router; \ No newline at end of file +var _0x4024=['addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./faxInteraction.controller','index','get','/describe','describe','isAuthenticated','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4024,0x89));var _0x4402=function(_0x50bbc6,_0x3cd6c6){_0x50bbc6=_0x50bbc6-0x0;var _0x42eadc=_0x4024[_0x50bbc6];return _0x42eadc;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4402('0x7')]);router[_0x4402('0x8')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0xa')]);router['get']('/:id',auth[_0x4402('0xb')](),controller['show']);router['get'](_0x4402('0xc'),auth['isAuthenticated'](),controller[_0x4402('0xd')]);router['get'](_0x4402('0xe'),auth['isAuthenticated'](),controller[_0x4402('0xf')]);router[_0x4402('0x10')]('/',auth['isAuthenticated'](),controller[_0x4402('0x11')]);router[_0x4402('0x10')](_0x4402('0xc'),auth['isAuthenticated'](),controller[_0x4402('0x12')]);router[_0x4402('0x10')](_0x4402('0x13'),auth[_0x4402('0xb')](),interaction[_0x4402('0x14')](_0x4402('0x15'),_0x4402('0x16')),controller[_0x4402('0x17')]);router[_0x4402('0x18')](_0x4402('0x19'),auth[_0x4402('0xb')](),interaction[_0x4402('0x14')](_0x4402('0x15'),_0x4402('0x1a')),controller[_0x4402('0x1b')]);router[_0x4402('0x1c')](_0x4402('0x19'),auth[_0x4402('0xb')](),interaction[_0x4402('0x14')](_0x4402('0x15'),'faxinteraction:destroy'),controller['destroy']);router[_0x4402('0x1c')](_0x4402('0x13'),auth['isAuthenticated'](),controller[_0x4402('0x1d')]);module[_0x4402('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 55206d0..344bbe3 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 _0x9475=['medium','ENUM','out','TEXT','sequelize','exports'];(function(_0x432c44,_0x4d8e1a){var _0x4386fe=function(_0x510b8){while(--_0x510b8){_0x432c44['push'](_0x432c44['shift']());}};_0x4386fe(++_0x4d8e1a);}(_0x9475,0x7c));var _0x5947=function(_0x3f70c6,_0x5c68f2){_0x3f70c6=_0x3f70c6-0x0;var _0x3606b4=_0x9475[_0x3f70c6];return _0x3606b4;};'use strict';var Sequelize=require(_0x5947('0x0'));module[_0x5947('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5947('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5947('0x3')]('in',_0x5947('0x4')),'defaultValue':_0x5947('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5947('0x5')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x9bfc=['medium','ENUM','out','DATE','exports','TEXT'];(function(_0x5bfeb8,_0x2bafc3){var _0x354e00=function(_0x5a6fd3){while(--_0x5a6fd3){_0x5bfeb8['push'](_0x5bfeb8['shift']());}};_0x354e00(++_0x2bafc3);}(_0x9bfc,0x118));var _0xc9bf=function(_0xcf20d2,_0x31dda8){_0xcf20d2=_0xcf20d2-0x0;var _0x43fabb=_0x9bfc[_0xcf20d2];return _0x43fabb;};'use strict';var Sequelize=require('sequelize');module[_0xc9bf('0x0')]={'body':{'type':Sequelize[_0xc9bf('0x1')](_0xc9bf('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc9bf('0x3')]('in',_0xc9bf('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xc9bf('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc9bf('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b364efd..7d34e50 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 _0xe6ba=['request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','findAll','show','params','includeAll','include','find','body','describe','fax-interactions','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','update','isNil','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','FaxInteractionId','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','create','findOne','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','files','attachments','Attachment','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x3b753e,_0x2295bd){var _0x20c0b9=function(_0x4e0593){while(--_0x4e0593){_0x3b753e['push'](_0x3b753e['shift']());}};_0x20c0b9(++_0x2295bd);}(_0xe6ba,0x1d5));var _0xae6b=function(_0x10d7c9,_0x47c30f){_0x10d7c9=_0x10d7c9-0x0;var _0x144fe1=_0xe6ba[_0x10d7c9];return _0x144fe1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xae6b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae6b('0x2'));var moment=require(_0xae6b('0x3'));var BPromise=require(_0xae6b('0x4'));var Mustache=require(_0xae6b('0x5'));var util=require(_0xae6b('0x6'));var path=require('path');var sox=require(_0xae6b('0x7'));var csv=require(_0xae6b('0x8'));var ejs=require(_0xae6b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xae6b('0xa'));var crypto=require(_0xae6b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xae6b('0xc'));var toCsv=require(_0xae6b('0x8'));var querystring=require(_0xae6b('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xae6b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xae6b('0xf'))(_0xae6b('0x10'));var utils=require('../../config/utils');var config=require(_0xae6b('0x11'));var licenseUtil=require(_0xae6b('0x12'));var db=require(_0xae6b('0x13'))['db'];config[_0xae6b('0x14')]=_[_0xae6b('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xae6b('0x16'))[_0xae6b('0x17')](socket);var jayson=require(_0xae6b('0x18'));var client=jayson[_0xae6b('0x19')]['http']({'port':0x232c});var client9002=jayson['client'][_0xae6b('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x271da4,_0x2e9d41,_0x5eb266,_0x1c5f69){return new BPromise(function(_0x48c3d6,_0x11ca0e){var _0xa36c60=_0x1c5f69||client;return _0xa36c60[_0xae6b('0x1b')](_0x271da4,_0x5eb266)[_0xae6b('0x1c')](function(_0x4c032d){logger[_0xae6b('0x1d')](_0xae6b('0x1e'),_0x2e9d41,_0xae6b('0x1f'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2e9d41,_0xae6b('0x1f'),JSON[_0xae6b('0x20')](_0x4c032d));if(_0x4c032d[_0xae6b('0x21')]){if(_0x4c032d['error'][_0xae6b('0x22')]===0x1f4){logger[_0xae6b('0x21')](_0xae6b('0x1e'),_0x2e9d41,_0x4c032d[_0xae6b('0x21')]['message']);return _0x11ca0e(_0x4c032d[_0xae6b('0x21')][_0xae6b('0x23')]);}logger[_0xae6b('0x21')](_0xae6b('0x1e'),_0x2e9d41,_0x4c032d['error']['message']);return _0x48c3d6(_0x4c032d[_0xae6b('0x21')][_0xae6b('0x23')]);}else{logger[_0xae6b('0x1d')](_0xae6b('0x1e'),_0x2e9d41,_0xae6b('0x1f'));_0x48c3d6(_0x4c032d[_0xae6b('0x24')]['message']);}})[_0xae6b('0x25')](function(_0x3c7dbb){logger[_0xae6b('0x21')]('FaxMessage,\x20%s,\x20%s',_0x2e9d41,_0x3c7dbb);_0x11ca0e(_0x3c7dbb);});});}function respondWithStatusCode(_0x3d462c,_0x58b9a3){_0x58b9a3=_0x58b9a3||0xcc;return function(_0x59ee22){if(_0x59ee22){return _0x3d462c[_0xae6b('0x26')](_0x58b9a3);}return _0x3d462c[_0xae6b('0x27')](_0x58b9a3)[_0xae6b('0x28')]();};}function respondWithResult(_0x133d5f,_0x72a0fe){_0x72a0fe=_0x72a0fe||0xc8;return function(_0x4df5d4){if(_0x4df5d4){return _0x133d5f['status'](_0x72a0fe)[_0xae6b('0x29')](_0x4df5d4);}};}function respondWithFilteredResult(_0x453808,_0x11de12){return function(_0xc9e8e8){if(_0xc9e8e8){var _0x345f5e=_0xc9e8e8['count'],_0x4da727=_0x11de12[_0xae6b('0x2a')],_0x30ad0c=_0x11de12[_0xae6b('0x2a')]+_0x11de12[_0xae6b('0x2b')],_0x353691;if(_0x30ad0c>=_0x345f5e){_0x30ad0c=_0x345f5e;_0x353691=0xc8;}else{_0x353691=0xce;}_0x453808[_0xae6b('0x27')](_0x353691);return _0x453808[_0xae6b('0x2c')](_0xae6b('0x2d'),_0x4da727+'-'+_0x30ad0c+'/'+_0x345f5e)[_0xae6b('0x29')](_0xc9e8e8);}return null;};}function patchUpdates(_0x42772c){return function(_0xa509f6){try{jsonpatch['apply'](_0xa509f6,_0x42772c,!![]);}catch(_0x1f54a2){return BPromise[_0xae6b('0x2e')](_0x1f54a2);}return _0xa509f6[_0xae6b('0x2f')]();};}function saveUpdates(_0x17406b,_0x2f4d86){return function(_0x1ff92c){if(_0x1ff92c){return _0x1ff92c['update'](_0x17406b)[_0xae6b('0x1c')](function(_0x3290e4){return _0x3290e4;});}return null;};}function removeEntity(_0x306e82,_0x11420c){return function(_0x174e73){if(_0x174e73){return _0x174e73[_0xae6b('0x30')]()[_0xae6b('0x1c')](function(){_0x306e82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x332d20,_0xed173d){return function(_0x1b91ad){if(!_0x1b91ad){_0x332d20[_0xae6b('0x26')](0x194);}return _0x1b91ad;};}function handleError(_0x44a869,_0x43bc5e){_0x43bc5e=_0x43bc5e||0x1f4;return function(_0x3ec096){logger['error'](_0x3ec096[_0xae6b('0x31')]);if(_0x3ec096[_0xae6b('0x32')]){delete _0x3ec096[_0xae6b('0x32')];}_0x44a869['status'](_0x43bc5e)['send'](_0x3ec096);};}exports[_0xae6b('0x33')]=function(_0x559779,_0x1ba0cf){var _0x362b93={},_0x1f24f7={},_0xd4bdad={'count':0x0,'rows':[]};var _0x12b69d=_[_0xae6b('0x34')](db[_0xae6b('0x35')][_0xae6b('0x36')],function(_0xbe4863){return{'name':_0xbe4863[_0xae6b('0x37')],'type':_0xbe4863[_0xae6b('0x38')][_0xae6b('0x39')]};});_0x1f24f7[_0xae6b('0x3a')]=_[_0xae6b('0x34')](_0x12b69d,_0xae6b('0x32'));_0x1f24f7[_0xae6b('0x3b')]=_['keys'](_0x559779[_0xae6b('0x3b')]);_0x1f24f7['filters']=_[_0xae6b('0x3c')](_0x1f24f7[_0xae6b('0x3a')],_0x1f24f7[_0xae6b('0x3b')]);_0x362b93[_0xae6b('0x3d')]=_[_0xae6b('0x3c')](_0x1f24f7['model'],qs[_0xae6b('0x3e')](_0x559779[_0xae6b('0x3b')][_0xae6b('0x3e')]));_0x362b93[_0xae6b('0x3d')]=_0x362b93[_0xae6b('0x3d')][_0xae6b('0x3f')]?_0x362b93[_0xae6b('0x3d')]:_0x1f24f7[_0xae6b('0x3a')];if(!_0x559779[_0xae6b('0x3b')][_0xae6b('0x40')](_0xae6b('0x41'))){_0x362b93['limit']=qs[_0xae6b('0x2b')](_0x559779[_0xae6b('0x3b')][_0xae6b('0x2b')]);_0x362b93[_0xae6b('0x2a')]=qs['offset'](_0x559779['query']['offset']);}_0x362b93['order']=qs['sort'](_0x559779['query'][_0xae6b('0x42')]);_0x362b93[_0xae6b('0x43')]=qs[_0xae6b('0x44')](_[_0xae6b('0x45')](_0x559779['query'],_0x1f24f7[_0xae6b('0x44')]),_0x12b69d);if(_0x559779['query'][_0xae6b('0x46')]){_0x362b93[_0xae6b('0x43')]=_[_0xae6b('0x47')](_0x362b93['where'],{'$or':_['map'](_0x12b69d,function(_0x4403bf){if(_0x4403bf[_0xae6b('0x38')]!==_0xae6b('0x48')){var _0x13ae21={};_0x13ae21[_0x4403bf[_0xae6b('0x32')]]={'$like':'%'+_0x559779[_0xae6b('0x3b')]['filter']+'%'};return _0x13ae21;}})});}_0x362b93=_['merge']({},_0x362b93,_0x559779[_0xae6b('0x49')]);var _0x5ee901={'where':_0x362b93['where']};return db[_0xae6b('0x35')][_0xae6b('0x4a')](_0x5ee901)[_0xae6b('0x1c')](function(_0x8c548a){_0xd4bdad[_0xae6b('0x4a')]=_0x8c548a;if(_0x559779['query']['includeAll']){_0x362b93['include']=[{'all':!![]}];}return db[_0xae6b('0x35')][_0xae6b('0x4b')](_0x362b93);})[_0xae6b('0x1c')](function(_0x5db258){_0xd4bdad['rows']=_0x5db258;return _0xd4bdad;})[_0xae6b('0x1c')](respondWithFilteredResult(_0x1ba0cf,_0x362b93))[_0xae6b('0x25')](handleError(_0x1ba0cf,null));};exports[_0xae6b('0x4c')]=function(_0x82ffe5,_0x253410){var _0x168260={'raw':!![],'where':{'id':_0x82ffe5[_0xae6b('0x4d')]['id']}},_0x414efa={};_0x414efa['model']=_['keys'](db[_0xae6b('0x35')]['rawAttributes']);_0x414efa[_0xae6b('0x3b')]=_['keys'](_0x82ffe5[_0xae6b('0x3b')]);_0x414efa[_0xae6b('0x44')]=_['intersection'](_0x414efa['model'],_0x414efa[_0xae6b('0x3b')]);_0x168260[_0xae6b('0x3d')]=_[_0xae6b('0x3c')](_0x414efa[_0xae6b('0x3a')],qs[_0xae6b('0x3e')](_0x82ffe5[_0xae6b('0x3b')][_0xae6b('0x3e')]));_0x168260[_0xae6b('0x3d')]=_0x168260['attributes'][_0xae6b('0x3f')]?_0x168260[_0xae6b('0x3d')]:_0x414efa[_0xae6b('0x3a')];if(_0x82ffe5['query'][_0xae6b('0x4e')]){_0x168260[_0xae6b('0x4f')]=[{'all':!![]}];}_0x168260=_[_0xae6b('0x47')]({},_0x168260,_0x82ffe5['options']);return db[_0xae6b('0x35')][_0xae6b('0x50')](_0x168260)['then'](handleEntityNotFound(_0x253410,null))[_0xae6b('0x1c')](respondWithResult(_0x253410,null))[_0xae6b('0x25')](handleError(_0x253410,null));};exports['update']=function(_0xd52ffb,_0x23aa2f){if(_0xd52ffb['body']['id']){delete _0xd52ffb[_0xae6b('0x51')]['id'];}return db[_0xae6b('0x35')][_0xae6b('0x50')]({'where':{'id':_0xd52ffb[_0xae6b('0x4d')]['id']}})[_0xae6b('0x1c')](handleEntityNotFound(_0x23aa2f,null))['then'](saveUpdates(_0xd52ffb[_0xae6b('0x51')],null))[_0xae6b('0x1c')](respondWithResult(_0x23aa2f,null))[_0xae6b('0x25')](handleError(_0x23aa2f,null));};exports[_0xae6b('0x30')]=function(_0x45f6f5,_0x4679b1){return db[_0xae6b('0x35')][_0xae6b('0x50')]({'where':{'id':_0x45f6f5['params']['id']}})[_0xae6b('0x1c')](handleEntityNotFound(_0x4679b1,null))[_0xae6b('0x1c')](removeEntity(_0x4679b1,null))[_0xae6b('0x25')](handleError(_0x4679b1,null));};exports['describe']=function(_0x537d70,_0xb9430){return db[_0xae6b('0x35')][_0xae6b('0x52')]()['then'](respondWithResult(_0xb9430,null))['catch'](handleError(_0xb9430,null));};var interaction_log=require(_0xae6b('0xf'))(_0xae6b('0x53'));exports['accept']=function(_0x47254d,_0xe40671,_0x1f3de7){var _0x5d2644={'channel':_0xae6b('0x54')};if(_0x47254d[_0xae6b('0x51')]['id']){delete _0x47254d[_0xae6b('0x51')]['id'];}_0x47254d['body']['read']=!![];_0x47254d[_0xae6b('0x51')][_0xae6b('0x55')]=moment()[_0xae6b('0x56')](_0xae6b('0x57'));_0x47254d[_0xae6b('0x51')][_0xae6b('0x58')]=_0x47254d['body'][_0xae6b('0x58')]||_0x47254d[_0xae6b('0x59')]['id'];return db[_0xae6b('0x35')][_0xae6b('0x50')]({'where':{'id':_0x47254d[_0xae6b('0x4d')]['id'],'UserId':null},'include':[{'model':db[_0xae6b('0x5a')],'as':_0xae6b('0x5b')}]})[_0xae6b('0x1c')](handleEntityNotFound(_0xe40671,null))[_0xae6b('0x1c')](saveUpdates(_0x47254d[_0xae6b('0x51')],null))[_0xae6b('0x1c')](function(_0x49dc0f){if(_0x49dc0f){_0x5d2644['message']=_0x49dc0f[_0xae6b('0x5c')]({'plain':!![]});return db[_0xae6b('0x5d')][_0xae6b('0x50')]({'where':{'id':_0x49dc0f['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xe40671,null))[_0xae6b('0x1c')](function(_0x2cdb3f){if(_0x2cdb3f){return _0x2cdb3f[_0xae6b('0x5e')]({'UserId':_0x47254d[_0xae6b('0x51')][_0xae6b('0x58')],'read1stAt':_[_0xae6b('0x5f')](_0x2cdb3f[_0xae6b('0x60')])?moment()[_0xae6b('0x56')](_0xae6b('0x57')):undefined});}return null;})['then'](function(_0x4a3921){if(_0x4a3921){_0x5d2644['interaction']=_0x4a3921[_0xae6b('0x5c')]({'plain':!![]});interaction_log[_0xae6b('0x1d')](_0xae6b('0x61'),_0x47254d['user']['id'],_0x47254d[_0xae6b('0x59')][_0xae6b('0x32')],_0x47254d['user'][_0xae6b('0x62')],_0x5d2644['interaction']['id'],_0x47254d[_0xae6b('0x51')]?JSON[_0xae6b('0x20')](_0x47254d[_0xae6b('0x51')]):_0xae6b('0x63'));return respondWithRpcPromise('AcceptMessage',_0xae6b('0x64'),_0x5d2644);}return null;})['then'](function(_0x121478){if(_0x121478){if(_0x47254d[_0xae6b('0x51')][_0xae6b('0x65')]){_0x5d2644['message'][_0xae6b('0x66')]=util[_0xae6b('0x56')](_0xae6b('0x67'),_0x47254d[_0xae6b('0x59')]['name']);_0x5d2644[_0xae6b('0x23')][_0xae6b('0x68')]=_0x5d2644['channel'];_0x5d2644['message']['event']=_0xae6b('0x69');return respondWithRpcPromise('EventManager',_0xae6b('0x6a'),{'event':_0xae6b('0x6b'),'message':_0x5d2644[_0xae6b('0x23')]},client9002)['then'](function(){return _0x5d2644;});}return _0x5d2644;}return null;})['then'](respondWithResult(_0xe40671,null))['catch'](handleError(_0xe40671,null));};var interaction_log=require('../../config/logger')(_0xae6b('0x53'));exports[_0xae6b('0x2e')]=function(_0x2adee4,_0x201edf,_0x52316e){var _0x232765={'agent':{},'channel':_0xae6b('0x54')};if(_0x2adee4['body']['id']){delete _0x2adee4['body']['id'];}_0x2adee4[_0xae6b('0x51')][_0xae6b('0x58')]=_0x2adee4[_0xae6b('0x51')][_0xae6b('0x58')]||_0x2adee4[_0xae6b('0x59')]['id'];_0x232765['agent']['id']=_0x2adee4[_0xae6b('0x51')][_0xae6b('0x58')];return db[_0xae6b('0x35')][_0xae6b('0x50')]({'where':{'id':_0x2adee4[_0xae6b('0x4d')]['id'],'UserId':null}})[_0xae6b('0x1c')](handleEntityNotFound(_0x201edf,null))[_0xae6b('0x1c')](function(_0x4ace0a){if(_0x4ace0a){_0x232765[_0xae6b('0x23')]=_0x4ace0a[_0xae6b('0x5c')]({'plain':!![]});return db[_0xae6b('0x5d')][_0xae6b('0x50')]({'where':{'id':_0x4ace0a[_0xae6b('0x6c')]}});}return null;})[_0xae6b('0x1c')](handleEntityNotFound(_0x201edf,null))['then'](function(_0x2ead76){if(_0x2ead76){_0x232765[_0xae6b('0x6d')]=_0x2ead76[_0xae6b('0x5c')]({'plain':!![]});interaction_log[_0xae6b('0x1d')](_0xae6b('0x6e'),_0x2adee4[_0xae6b('0x59')]['id'],_0x2adee4[_0xae6b('0x59')][_0xae6b('0x32')],_0x2adee4['user'][_0xae6b('0x62')],_0x232765['interaction']['id'],_0x2adee4['body']?JSON['stringify'](_0x2adee4[_0xae6b('0x51')]):_0xae6b('0x63'));return respondWithRpcPromise(_0xae6b('0x6f'),_0xae6b('0x70'),_0x232765);}return null;})['then'](function(_0x3ce773){if(_0x3ce773){_0x3ce773['message'][_0xae6b('0x66')]=util[_0xae6b('0x56')](_0xae6b('0x67'),_0x2adee4[_0xae6b('0x59')][_0xae6b('0x32')]);_0x3ce773[_0xae6b('0x23')][_0xae6b('0x68')]=_0x232765[_0xae6b('0x68')];_0x3ce773['message'][_0xae6b('0x71')]=_0xae6b('0x2e');respondWithRpcPromise(_0xae6b('0x6a'),'EventManager',{'event':'rejectmessage','message':_0x3ce773['message']},client9002);return _0x232765;}return null;})[_0xae6b('0x1c')](respondWithResult(_0x201edf,null))[_0xae6b('0x25')](handleError(_0x201edf,null));};exports['create']=function(_0xfcbbe2,_0x32b7c5){var _0x5d4403;return db[_0xae6b('0x35')][_0xae6b('0x72')](_0xfcbbe2[_0xae6b('0x51')],{})['then'](function(_0xf29936){_0x5d4403=_0xf29936;return db[_0xae6b('0x5a')][_0xae6b('0x73')]({'where':{'id':_0x5d4403['ContactId']}});})[_0xae6b('0x1c')](function(_0x50888a){if(_[_0xae6b('0x5f')](_0x50888a)){return;}else{_0x5d4403[_0xae6b('0x54')]=_0x50888a[_0xae6b('0x54')];return db['Attachment']['findOne']({'where':{'id':_0x5d4403['AttachmentId']}});}})[_0xae6b('0x1c')](function(_0x5aa1cc){return respondWithRpcPromise(_0xae6b('0x74'),'SendFax',{'FaxAccountId':_[_0xae6b('0x5f')](_0xfcbbe2[_0xae6b('0x51')])?undefined:_0xfcbbe2['body'][_0xae6b('0x75')],'path':_[_0xae6b('0x5f')](_0x5aa1cc)?undefined:util['format'](_0xae6b('0x76'),_0x5aa1cc[_0xae6b('0x77')]),'fax':_['isNil'](_0x5d4403[_0xae6b('0x54')])?undefined:_0x5d4403[_0xae6b('0x54')],'AttachmentId':_0x5d4403[_0xae6b('0x78')]},client9002);})[_0xae6b('0x1c')](respondWithResult(_0x32b7c5,0xc9))[_0xae6b('0x25')](handleError(_0x32b7c5,null));};exports[_0xae6b('0x79')]=function(_0x3c94c1,_0x19298c){var _0x136197=path['join'](config['root'],'server',_0xae6b('0x7a'),_0xae6b('0x7b'));return db[_0xae6b('0x35')][_0xae6b('0x50')]({'where':{'id':_0x3c94c1[_0xae6b('0x4d')]['id']},'include':[{'model':db[_0xae6b('0x7c')],'as':_0xae6b('0x7c')}]})[_0xae6b('0x1c')](handleEntityNotFound(_0x19298c,null))[_0xae6b('0x1c')](function(_0x40a4a9){if(_0x40a4a9){return _0x19298c[_0xae6b('0x79')](path['join'](_0x136197,_0x40a4a9[_0xae6b('0x7c')][_0xae6b('0x77')]));}})[_0xae6b('0x25')](handleError(_0x19298c,null));}; \ No newline at end of file +var _0x10d8=['api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','destroy','stack','index','map','FaxMessage','rawAttributes','fieldName','key','model','name','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','show','params','intersection','options','update','body','find','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','interface','channel','event','EventManager','acceptmessage','reject','agent','FaxInteraction','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','rejectmessage','create','findOne','SendFax','FaxAccountId','basename','root','server','files','attachments','Attachment','join','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x283284,_0x5cf98d){var _0xe6cd06=function(_0x5da4ac){while(--_0x5da4ac){_0x283284['push'](_0x283284['shift']());}};_0xe6cd06(++_0x5cf98d);}(_0x10d8,0xee));var _0x810d=function(_0x2af28f,_0x2357b8){_0x2af28f=_0x2af28f-0x0;var _0x175020=_0x10d8[_0x2af28f];return _0x175020;};'use strict';var pdf=require(_0x810d('0x0'));var emlformat=require(_0x810d('0x1'));var rimraf=require(_0x810d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x810d('0x3'));var rp=require(_0x810d('0x4'));var moment=require(_0x810d('0x5'));var BPromise=require(_0x810d('0x6'));var Mustache=require(_0x810d('0x7'));var util=require('util');var path=require('path');var sox=require(_0x810d('0x8'));var csv=require(_0x810d('0x9'));var ejs=require(_0x810d('0xa'));var fs=require('fs');var _=require(_0x810d('0xb'));var squel=require(_0x810d('0xc'));var crypto=require(_0x810d('0xd'));var jsforce=require(_0x810d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x810d('0xf'));var authService=require(_0x810d('0x10'));var qs=require(_0x810d('0x11'));var as=require(_0x810d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x810d('0x13'))(_0x810d('0x14'));var utils=require(_0x810d('0x15'));var config=require(_0x810d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x810d('0x17'))['db'];config['redis']=_['defaults'](config[_0x810d('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x810d('0x19'))(new Redis(config[_0x810d('0x18')]));require('./faxMessage.socket')[_0x810d('0x1a')](socket);var jayson=require(_0x810d('0x1b'));var client=jayson[_0x810d('0x1c')][_0x810d('0x1d')]({'port':0x232c});var client9002=jayson[_0x810d('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x522d6d,_0x13b6b8,_0x5e8328,_0x2a4907){return new BPromise(function(_0x290563,_0x31b3e6){var _0x181d0a=_0x2a4907||client;return _0x181d0a[_0x810d('0x1e')](_0x522d6d,_0x5e8328)[_0x810d('0x1f')](function(_0x576238){logger[_0x810d('0x20')](_0x810d('0x21'),_0x13b6b8,_0x810d('0x22'));logger[_0x810d('0x23')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x13b6b8,_0x810d('0x22'),JSON[_0x810d('0x24')](_0x576238));if(_0x576238[_0x810d('0x25')]){if(_0x576238[_0x810d('0x25')]['code']===0x1f4){logger[_0x810d('0x25')](_0x810d('0x21'),_0x13b6b8,_0x576238[_0x810d('0x25')][_0x810d('0x26')]);return _0x31b3e6(_0x576238[_0x810d('0x25')][_0x810d('0x26')]);}logger[_0x810d('0x25')](_0x810d('0x21'),_0x13b6b8,_0x576238['error'][_0x810d('0x26')]);return _0x290563(_0x576238[_0x810d('0x25')][_0x810d('0x26')]);}else{logger[_0x810d('0x20')](_0x810d('0x21'),_0x13b6b8,_0x810d('0x22'));_0x290563(_0x576238[_0x810d('0x27')]['message']);}})[_0x810d('0x28')](function(_0x314652){logger['error']('FaxMessage,\x20%s,\x20%s',_0x13b6b8,_0x314652);_0x31b3e6(_0x314652);});});}function respondWithStatusCode(_0xb7ecbc,_0x38638a){_0x38638a=_0x38638a||0xcc;return function(_0x5a6409){if(_0x5a6409){return _0xb7ecbc[_0x810d('0x29')](_0x38638a);}return _0xb7ecbc[_0x810d('0x2a')](_0x38638a)[_0x810d('0x2b')]();};}function respondWithResult(_0x5135eb,_0x263bfb){_0x263bfb=_0x263bfb||0xc8;return function(_0x47f4aa){if(_0x47f4aa){return _0x5135eb[_0x810d('0x2a')](_0x263bfb)[_0x810d('0x2c')](_0x47f4aa);}};}function respondWithFilteredResult(_0x58c2fa,_0x1aa205){return function(_0x53f5f9){if(_0x53f5f9){var _0x12a6d8=_0x53f5f9[_0x810d('0x2d')],_0x5c9108=_0x1aa205[_0x810d('0x2e')],_0x3464f0=_0x1aa205['offset']+_0x1aa205['limit'],_0x1d789a;if(_0x3464f0>=_0x12a6d8){_0x3464f0=_0x12a6d8;_0x1d789a=0xc8;}else{_0x1d789a=0xce;}_0x58c2fa[_0x810d('0x2a')](_0x1d789a);return _0x58c2fa[_0x810d('0x2f')]('Content-Range',_0x5c9108+'-'+_0x3464f0+'/'+_0x12a6d8)[_0x810d('0x2c')](_0x53f5f9);}return null;};}function patchUpdates(_0xb939ed){return function(_0x3a5f81){try{jsonpatch[_0x810d('0x30')](_0x3a5f81,_0xb939ed,!![]);}catch(_0x1824a0){return BPromise['reject'](_0x1824a0);}return _0x3a5f81['save']();};}function saveUpdates(_0x1a50f3,_0x3dd99e){return function(_0x3db84d){if(_0x3db84d){return _0x3db84d['update'](_0x1a50f3)[_0x810d('0x1f')](function(_0x4b60de){return _0x4b60de;});}return null;};}function removeEntity(_0xae91fc,_0x26c715){return function(_0x10044d){if(_0x10044d){return _0x10044d[_0x810d('0x31')]()[_0x810d('0x1f')](function(){_0xae91fc[_0x810d('0x2a')](0xcc)[_0x810d('0x2b')]();});}};}function handleEntityNotFound(_0x27f622,_0x204479){return function(_0x2fa9fd){if(!_0x2fa9fd){_0x27f622['sendStatus'](0x194);}return _0x2fa9fd;};}function handleError(_0xcca3d1,_0x56662b){_0x56662b=_0x56662b||0x1f4;return function(_0x2889c0){logger[_0x810d('0x25')](_0x2889c0[_0x810d('0x32')]);if(_0x2889c0['name']){delete _0x2889c0['name'];}_0xcca3d1[_0x810d('0x2a')](_0x56662b)['send'](_0x2889c0);};}exports[_0x810d('0x33')]=function(_0x543b2d,_0x1809ff){var _0x676699={},_0x27f133={},_0x50d8c6={'count':0x0,'rows':[]};var _0x28650a=_[_0x810d('0x34')](db[_0x810d('0x35')][_0x810d('0x36')],function(_0x39fa0b){return{'name':_0x39fa0b[_0x810d('0x37')],'type':_0x39fa0b['type'][_0x810d('0x38')]};});_0x27f133[_0x810d('0x39')]=_[_0x810d('0x34')](_0x28650a,_0x810d('0x3a'));_0x27f133['query']=_[_0x810d('0x3b')](_0x543b2d[_0x810d('0x3c')]);_0x27f133[_0x810d('0x3d')]=_['intersection'](_0x27f133[_0x810d('0x39')],_0x27f133[_0x810d('0x3c')]);_0x676699[_0x810d('0x3e')]=_['intersection'](_0x27f133['model'],qs[_0x810d('0x3f')](_0x543b2d[_0x810d('0x3c')]['fields']));_0x676699[_0x810d('0x3e')]=_0x676699[_0x810d('0x3e')]['length']?_0x676699['attributes']:_0x27f133[_0x810d('0x39')];if(!_0x543b2d[_0x810d('0x3c')][_0x810d('0x40')](_0x810d('0x41'))){_0x676699[_0x810d('0x42')]=qs[_0x810d('0x42')](_0x543b2d[_0x810d('0x3c')]['limit']);_0x676699['offset']=qs[_0x810d('0x2e')](_0x543b2d[_0x810d('0x3c')][_0x810d('0x2e')]);}_0x676699[_0x810d('0x43')]=qs['sort'](_0x543b2d[_0x810d('0x3c')][_0x810d('0x44')]);_0x676699[_0x810d('0x45')]=qs[_0x810d('0x3d')](_[_0x810d('0x46')](_0x543b2d[_0x810d('0x3c')],_0x27f133['filters']),_0x28650a);if(_0x543b2d[_0x810d('0x3c')][_0x810d('0x47')]){_0x676699[_0x810d('0x45')]=_[_0x810d('0x48')](_0x676699[_0x810d('0x45')],{'$or':_[_0x810d('0x34')](_0x28650a,function(_0x3eaa86){if(_0x3eaa86[_0x810d('0x49')]!=='VIRTUAL'){var _0x2e3781={};_0x2e3781[_0x3eaa86[_0x810d('0x3a')]]={'$like':'%'+_0x543b2d['query'][_0x810d('0x47')]+'%'};return _0x2e3781;}})});}_0x676699=_[_0x810d('0x48')]({},_0x676699,_0x543b2d['options']);var _0x5136ad={'where':_0x676699['where']};return db[_0x810d('0x35')][_0x810d('0x2d')](_0x5136ad)['then'](function(_0x2f3f50){_0x50d8c6[_0x810d('0x2d')]=_0x2f3f50;if(_0x543b2d[_0x810d('0x3c')][_0x810d('0x4a')]){_0x676699[_0x810d('0x4b')]=[{'all':!![]}];}return db[_0x810d('0x35')][_0x810d('0x4c')](_0x676699);})['then'](function(_0x3d2938){_0x50d8c6[_0x810d('0x4d')]=_0x3d2938;return _0x50d8c6;})['then'](respondWithFilteredResult(_0x1809ff,_0x676699))['catch'](handleError(_0x1809ff,null));};exports[_0x810d('0x4e')]=function(_0x1e64e8,_0x4de899){var _0x2b4b80={'raw':!![],'where':{'id':_0x1e64e8[_0x810d('0x4f')]['id']}},_0x1cbede={};_0x1cbede[_0x810d('0x39')]=_['keys'](db[_0x810d('0x35')][_0x810d('0x36')]);_0x1cbede['query']=_[_0x810d('0x3b')](_0x1e64e8[_0x810d('0x3c')]);_0x1cbede[_0x810d('0x3d')]=_[_0x810d('0x50')](_0x1cbede[_0x810d('0x39')],_0x1cbede['query']);_0x2b4b80['attributes']=_[_0x810d('0x50')](_0x1cbede[_0x810d('0x39')],qs[_0x810d('0x3f')](_0x1e64e8[_0x810d('0x3c')][_0x810d('0x3f')]));_0x2b4b80['attributes']=_0x2b4b80[_0x810d('0x3e')]['length']?_0x2b4b80[_0x810d('0x3e')]:_0x1cbede['model'];if(_0x1e64e8['query']['includeAll']){_0x2b4b80[_0x810d('0x4b')]=[{'all':!![]}];}_0x2b4b80=_[_0x810d('0x48')]({},_0x2b4b80,_0x1e64e8[_0x810d('0x51')]);return db['FaxMessage']['find'](_0x2b4b80)[_0x810d('0x1f')](handleEntityNotFound(_0x4de899,null))[_0x810d('0x1f')](respondWithResult(_0x4de899,null))[_0x810d('0x28')](handleError(_0x4de899,null));};exports[_0x810d('0x52')]=function(_0x2087dc,_0x45e4dc){if(_0x2087dc[_0x810d('0x53')]['id']){delete _0x2087dc[_0x810d('0x53')]['id'];}return db[_0x810d('0x35')][_0x810d('0x54')]({'where':{'id':_0x2087dc[_0x810d('0x4f')]['id']}})[_0x810d('0x1f')](handleEntityNotFound(_0x45e4dc,null))[_0x810d('0x1f')](saveUpdates(_0x2087dc[_0x810d('0x53')],null))[_0x810d('0x1f')](respondWithResult(_0x45e4dc,null))[_0x810d('0x28')](handleError(_0x45e4dc,null));};exports[_0x810d('0x31')]=function(_0x218d1d,_0x2b8b3f){return db['FaxMessage'][_0x810d('0x54')]({'where':{'id':_0x218d1d['params']['id']}})[_0x810d('0x1f')](handleEntityNotFound(_0x2b8b3f,null))['then'](removeEntity(_0x2b8b3f,null))[_0x810d('0x28')](handleError(_0x2b8b3f,null));};exports[_0x810d('0x55')]=function(_0x249468,_0x70bd68){return db[_0x810d('0x35')][_0x810d('0x55')]()[_0x810d('0x1f')](respondWithResult(_0x70bd68,null))[_0x810d('0x28')](handleError(_0x70bd68,null));};var interaction_log=require(_0x810d('0x13'))(_0x810d('0x56'));exports[_0x810d('0x57')]=function(_0x2b5eb9,_0x11468b,_0x25482d){var _0x292bc7={'channel':_0x810d('0x58')};if(_0x2b5eb9['body']['id']){delete _0x2b5eb9[_0x810d('0x53')]['id'];}_0x2b5eb9[_0x810d('0x53')][_0x810d('0x59')]=!![];_0x2b5eb9[_0x810d('0x53')][_0x810d('0x5a')]=moment()[_0x810d('0x5b')](_0x810d('0x5c'));_0x2b5eb9[_0x810d('0x53')][_0x810d('0x5d')]=_0x2b5eb9[_0x810d('0x53')]['UserId']||_0x2b5eb9[_0x810d('0x5e')]['id'];return db['FaxMessage'][_0x810d('0x54')]({'where':{'id':_0x2b5eb9[_0x810d('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x810d('0x5f')],'as':'Contact'}]})[_0x810d('0x1f')](handleEntityNotFound(_0x11468b,null))[_0x810d('0x1f')](saveUpdates(_0x2b5eb9[_0x810d('0x53')],null))[_0x810d('0x1f')](function(_0xbe48a6){if(_0xbe48a6){_0x292bc7[_0x810d('0x26')]=_0xbe48a6[_0x810d('0x60')]({'plain':!![]});return db['FaxInteraction'][_0x810d('0x54')]({'where':{'id':_0xbe48a6['FaxInteractionId']}});}return null;})[_0x810d('0x1f')](handleEntityNotFound(_0x11468b,null))['then'](function(_0x3f46a0){if(_0x3f46a0){return _0x3f46a0[_0x810d('0x52')]({'UserId':_0x2b5eb9[_0x810d('0x53')][_0x810d('0x5d')],'read1stAt':_[_0x810d('0x61')](_0x3f46a0[_0x810d('0x62')])?moment()[_0x810d('0x5b')](_0x810d('0x5c')):undefined});}return null;})['then'](function(_0x550551){if(_0x550551){_0x292bc7[_0x810d('0x63')]=_0x550551[_0x810d('0x60')]({'plain':!![]});interaction_log['info'](_0x810d('0x64'),_0x2b5eb9[_0x810d('0x5e')]['id'],_0x2b5eb9[_0x810d('0x5e')][_0x810d('0x3a')],_0x2b5eb9[_0x810d('0x5e')][_0x810d('0x65')],_0x292bc7['interaction']['id'],_0x2b5eb9[_0x810d('0x53')]?JSON[_0x810d('0x24')](_0x2b5eb9[_0x810d('0x53')]):_0x810d('0x66'));return respondWithRpcPromise('AcceptMessage',_0x810d('0x67'),_0x292bc7);}return null;})[_0x810d('0x1f')](function(_0x11a765){if(_0x11a765){if(_0x2b5eb9[_0x810d('0x53')]['manual']){_0x292bc7['message'][_0x810d('0x68')]=util['format']('SIP/%s',_0x2b5eb9[_0x810d('0x5e')]['name']);_0x292bc7[_0x810d('0x26')][_0x810d('0x69')]=_0x292bc7['channel'];_0x292bc7['message'][_0x810d('0x6a')]='accept';return respondWithRpcPromise(_0x810d('0x6b'),_0x810d('0x6b'),{'event':_0x810d('0x6c'),'message':_0x292bc7['message']},client9002)['then'](function(){return _0x292bc7;});}return _0x292bc7;}return null;})[_0x810d('0x1f')](respondWithResult(_0x11468b,null))[_0x810d('0x28')](handleError(_0x11468b,null));};var interaction_log=require(_0x810d('0x13'))(_0x810d('0x56'));exports[_0x810d('0x6d')]=function(_0x904f8d,_0x186ebc,_0x2d108f){var _0x43fddd={'agent':{},'channel':'fax'};if(_0x904f8d[_0x810d('0x53')]['id']){delete _0x904f8d[_0x810d('0x53')]['id'];}_0x904f8d[_0x810d('0x53')][_0x810d('0x5d')]=_0x904f8d['body']['UserId']||_0x904f8d[_0x810d('0x5e')]['id'];_0x43fddd[_0x810d('0x6e')]['id']=_0x904f8d[_0x810d('0x53')][_0x810d('0x5d')];return db['FaxMessage'][_0x810d('0x54')]({'where':{'id':_0x904f8d[_0x810d('0x4f')]['id'],'UserId':null}})[_0x810d('0x1f')](handleEntityNotFound(_0x186ebc,null))['then'](function(_0x2f41ae){if(_0x2f41ae){_0x43fddd[_0x810d('0x26')]=_0x2f41ae[_0x810d('0x60')]({'plain':!![]});return db[_0x810d('0x6f')][_0x810d('0x54')]({'where':{'id':_0x2f41ae[_0x810d('0x70')]}});}return null;})['then'](handleEntityNotFound(_0x186ebc,null))['then'](function(_0x3ba140){if(_0x3ba140){_0x43fddd[_0x810d('0x63')]=_0x3ba140[_0x810d('0x60')]({'plain':!![]});interaction_log[_0x810d('0x20')](_0x810d('0x71'),_0x904f8d[_0x810d('0x5e')]['id'],_0x904f8d[_0x810d('0x5e')][_0x810d('0x3a')],_0x904f8d[_0x810d('0x5e')][_0x810d('0x65')],_0x43fddd[_0x810d('0x63')]['id'],_0x904f8d['body']?JSON[_0x810d('0x24')](_0x904f8d[_0x810d('0x53')]):_0x810d('0x66'));return respondWithRpcPromise(_0x810d('0x72'),_0x810d('0x73'),_0x43fddd);}return null;})[_0x810d('0x1f')](function(_0x5d0be0){if(_0x5d0be0){_0x5d0be0['message'][_0x810d('0x68')]=util['format'](_0x810d('0x74'),_0x904f8d[_0x810d('0x5e')][_0x810d('0x3a')]);_0x5d0be0[_0x810d('0x26')][_0x810d('0x69')]=_0x43fddd[_0x810d('0x69')];_0x5d0be0[_0x810d('0x26')][_0x810d('0x6a')]=_0x810d('0x6d');respondWithRpcPromise('EventManager',_0x810d('0x6b'),{'event':_0x810d('0x75'),'message':_0x5d0be0[_0x810d('0x26')]},client9002);return _0x43fddd;}return null;})[_0x810d('0x1f')](respondWithResult(_0x186ebc,null))[_0x810d('0x28')](handleError(_0x186ebc,null));};exports[_0x810d('0x76')]=function(_0x23d1e9,_0x2f6bb7){var _0x2d452a;return db['FaxMessage'][_0x810d('0x76')](_0x23d1e9[_0x810d('0x53')],{})[_0x810d('0x1f')](function(_0x3b5bc6){_0x2d452a=_0x3b5bc6;return db[_0x810d('0x5f')][_0x810d('0x77')]({'where':{'id':_0x2d452a['ContactId']}});})['then'](function(_0x3189be){if(_[_0x810d('0x61')](_0x3189be)){return;}else{_0x2d452a[_0x810d('0x58')]=_0x3189be[_0x810d('0x58')];return db['Attachment']['findOne']({'where':{'id':_0x2d452a['AttachmentId']}});}})[_0x810d('0x1f')](function(_0x31dc54){return respondWithRpcPromise(_0x810d('0x78'),_0x810d('0x78'),{'FaxAccountId':_[_0x810d('0x61')](_0x23d1e9[_0x810d('0x53')])?undefined:_0x23d1e9['body'][_0x810d('0x79')],'path':_['isNil'](_0x31dc54)?undefined:util[_0x810d('0x5b')]('/var/opt/motion2/server/files/attachments/%s',_0x31dc54[_0x810d('0x7a')]),'fax':_['isNil'](_0x2d452a[_0x810d('0x58')])?undefined:_0x2d452a[_0x810d('0x58')],'AttachmentId':_0x2d452a['AttachmentId']},client9002);})[_0x810d('0x1f')](respondWithResult(_0x2f6bb7,0xc9))[_0x810d('0x28')](handleError(_0x2f6bb7,null));};exports['download']=function(_0x461ba2,_0x449e7c){var _0x262cf2=path['join'](config[_0x810d('0x7b')],_0x810d('0x7c'),_0x810d('0x7d'),_0x810d('0x7e'));return db['FaxMessage'][_0x810d('0x54')]({'where':{'id':_0x461ba2[_0x810d('0x4f')]['id']},'include':[{'model':db['Attachment'],'as':_0x810d('0x7f')}]})[_0x810d('0x1f')](handleEntityNotFound(_0x449e7c,null))['then'](function(_0x47bd53){if(_0x47bd53){return _0x449e7c['download'](path[_0x810d('0x80')](_0x262cf2,_0x47bd53[_0x810d('0x7f')][_0x810d('0x7a')]));}})['catch'](handleError(_0x449e7c,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 74a54c6..eeda105 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x3a971a,_0x5cbf43){var _0x1e1282=function(_0xeb758b){while(--_0xeb758b){_0x3a971a['push'](_0x3a971a['shift']());}};_0x1e1282(++_0x5cbf43);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update','remove'];(function(_0x3b7a06,_0x41f79e){var _0x363e31=function(_0x51e3f5){while(--_0x51e3f5){_0x3b7a06['push'](_0x3b7a06['shift']());}};_0x363e31(++_0x41f79e);}(_0x7217,0x19e));var _0x7721=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7217[_0x25bea7];return _0x175952;};'use strict';var EventEmitter=require(_0x7721('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x7721('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){FaxMessageEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);FaxMessageEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];FaxMessage[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 002253b..6da84ae 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 _0x32d9=['path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','catch','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x14cb23,_0x1f39c2){var _0x3fc126=function(_0x5ea6b8){while(--_0x5ea6b8){_0x14cb23['push'](_0x14cb23['shift']());}};_0x3fc126(++_0x1f39c2);}(_0x32d9,0x16e));var _0x932d=function(_0x357bc4,_0x53cb33){_0x357bc4=_0x357bc4-0x0;var _0x23c58b=_0x32d9[_0x357bc4];return _0x23c58b;};'use strict';var _=require(_0x932d('0x0'));var util=require(_0x932d('0x1'));var logger=require('../../config/logger')(_0x932d('0x2'));var moment=require(_0x932d('0x3'));var BPromise=require(_0x932d('0x4'));var rp=require(_0x932d('0x5'));var fs=require('fs');var path=require(_0x932d('0x6'));var rimraf=require('rimraf');var config=require(_0x932d('0x7'));var attributes=require(_0x932d('0x8'));module[_0x932d('0x9')]=function(_0x422b1c,_0x5edcf5){return _0x422b1c[_0x932d('0xa')](_0x932d('0xb'),attributes,{'tableName':_0x932d('0xc'),'paranoid':![],'indexes':[{'name':_0x932d('0xd'),'fields':[_0x932d('0xe')],'type':_0x932d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x516d0a,_0x10725c,_0x2b4a80){var _0x417222=_0x422b1c[_0x932d('0x10')];var _0x2d3925=_0x516d0a[_0x932d('0x11')]({'plain':!![]});if(_0x2d3925[_0x932d('0x12')][_0x932d('0x13')]()==='in'||_0x2d3925[_0x932d('0x12')][_0x932d('0x13')]()===_0x932d('0x14')&&!_0x2d3925[_0x932d('0x15')]&&!_[_0x932d('0x16')](_0x2d3925[_0x932d('0x17')])){_0x417222[_0x932d('0x18')][_0x932d('0x19')]({'where':{'id':_0x2d3925[_0x932d('0x1a')]}})['then'](function(_0x3a9f7e){if(_0x3a9f7e){_0x3a9f7e[_0x932d('0x1b')]({'lastMsgAt':_0x2d3925['createdAt'],'lastMsgDirection':_0x2d3925['direction']['toLowerCase']()});}})[_0x932d('0x1c')](function(_0x20edee){console[_0x932d('0x1d')](_0x20edee);});}_0x2b4a80();}},'charset':'utf8mb4','collate':_0x932d('0x1e')});}; \ No newline at end of file +var _0x74d6=['error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','FaxInteraction','findOne','FaxInteractionId','then','update','catch'];(function(_0x322702,_0x150ebb){var _0x401a86=function(_0x3eb2ad){while(--_0x3eb2ad){_0x322702['push'](_0x322702['shift']());}};_0x401a86(++_0x150ebb);}(_0x74d6,0xd5));var _0x674d=function(_0x4ef7bc,_0x1e8207){_0x4ef7bc=_0x4ef7bc-0x0;var _0x30a74f=_0x74d6[_0x4ef7bc];return _0x30a74f;};'use strict';var _=require(_0x674d('0x0'));var util=require('util');var logger=require(_0x674d('0x1'))(_0x674d('0x2'));var moment=require(_0x674d('0x3'));var BPromise=require(_0x674d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x674d('0x5'));var rimraf=require(_0x674d('0x6'));var config=require(_0x674d('0x7'));var attributes=require(_0x674d('0x8'));module[_0x674d('0x9')]=function(_0x12f5bb,_0x5d698c){return _0x12f5bb[_0x674d('0xa')](_0x674d('0xb'),attributes,{'tableName':_0x674d('0xc'),'paranoid':![],'indexes':[{'name':_0x674d('0xd'),'fields':[_0x674d('0xe')],'type':_0x674d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1ddab9,_0x28f50a,_0x356a71){var _0x2e5a37=_0x12f5bb[_0x674d('0x10')];var _0x503822=_0x1ddab9[_0x674d('0x11')]({'plain':!![]});if(_0x503822[_0x674d('0x12')][_0x674d('0x13')]()==='in'||_0x503822[_0x674d('0x12')][_0x674d('0x13')]()===_0x674d('0x14')&&!_0x503822['secret']&&!_['isNil'](_0x503822['UserId'])){_0x2e5a37[_0x674d('0x15')][_0x674d('0x16')]({'where':{'id':_0x503822[_0x674d('0x17')]}})[_0x674d('0x18')](function(_0x262fbd){if(_0x262fbd){_0x262fbd[_0x674d('0x19')]({'lastMsgAt':_0x503822['createdAt'],'lastMsgDirection':_0x503822['direction']['toLowerCase']()});}})[_0x674d('0x1a')](function(_0x56dc18){console[_0x674d('0x1b')](_0x56dc18);});}_0x356a71();}},'charset':_0x674d('0x1c'),'collate':_0x674d('0x1d')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 00e83a3..cd2c008 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 _0x181c=['update','raw','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./faxMessage.socket','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','then','CreateFaxMessage','UpdateFaxMessage','FaxMessage'];(function(_0x580a65,_0x1df611){var _0x2efd8f=function(_0x467461){while(--_0x467461){_0x580a65['push'](_0x580a65['shift']());}};_0x2efd8f(++_0x1df611);}(_0x181c,0x17f));var _0xc181=function(_0x1fd675,_0x165dfe){_0x1fd675=_0x1fd675-0x0;var _0x16b554=_0x181c[_0x1fd675];return _0x16b554;};'use strict';var _=require(_0xc181('0x0'));var util=require(_0xc181('0x1'));var moment=require(_0xc181('0x2'));var BPromise=require('bluebird');var rs=require(_0xc181('0x3'));var fs=require('fs');var Redis=require(_0xc181('0x4'));var db=require(_0xc181('0x5'))['db'];var utils=require(_0xc181('0x6'));var logger=require(_0xc181('0x7'))(_0xc181('0x8'));var config=require(_0xc181('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc181('0xa')][_0xc181('0xb')]({'port':0x232a});config['redis']=_[_0xc181('0xc')](config['redis'],{'host':_0xc181('0xd'),'port':0x18eb});var socket=require(_0xc181('0xe'))(new Redis(config[_0xc181('0xf')]));require(_0xc181('0x10'))['register'](socket);function respondWithRpcPromise(_0x1ace60,_0x1e2302,_0x4a742d){return new BPromise(function(_0xdb4be4,_0x322620){return client['request'](_0x1ace60,_0x4a742d)['then'](function(_0x25817e){logger[_0xc181('0x11')](_0xc181('0x12'),_0x1e2302,_0xc181('0x13'));logger[_0xc181('0x14')](_0xc181('0x15'),_0x1e2302,_0xc181('0x13'),JSON[_0xc181('0x16')](_0x25817e));if(_0x25817e['error']){if(_0x25817e[_0xc181('0x17')][_0xc181('0x18')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1e2302,_0x25817e[_0xc181('0x17')][_0xc181('0x19')]);return _0x322620(_0x25817e[_0xc181('0x17')][_0xc181('0x19')]);}logger[_0xc181('0x17')](_0xc181('0x12'),_0x1e2302,_0x25817e[_0xc181('0x17')][_0xc181('0x19')]);return _0xdb4be4(_0x25817e['error'][_0xc181('0x19')]);}else{logger[_0xc181('0x11')](_0xc181('0x12'),_0x1e2302,_0xc181('0x13'));_0xdb4be4(_0x25817e[_0xc181('0x1a')]['message']);}})[_0xc181('0x1b')](function(_0x2954c5){logger[_0xc181('0x17')](_0xc181('0x12'),_0x1e2302,_0x2954c5);_0x322620(_0x2954c5);});});}exports['CreateFaxMessage']=function(_0x2c4279){var _0x39fc42=this;return new Promise(function(_0x3b9b70,_0xd9e66e){return db['FaxMessage'][_0xc181('0x1c')](_0x2c4279[_0xc181('0x1d')],{'raw':_0x2c4279['options']?_0x2c4279[_0xc181('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xc181('0x1f')](function(_0x52a26f){logger[_0xc181('0x11')](_0xc181('0x20'),_0x2c4279);logger[_0xc181('0x14')]('CreateFaxMessage',_0x2c4279,JSON[_0xc181('0x16')](_0x52a26f));_0x3b9b70(_0x52a26f);})['catch'](function(_0x19d47f){logger[_0xc181('0x17')]('CreateFaxMessage',_0x19d47f[_0xc181('0x19')],_0x2c4279);_0xd9e66e(_0x39fc42[_0xc181('0x17')](0x1f4,_0x19d47f['message']));});});};exports[_0xc181('0x21')]=function(_0x1c2ae9){var _0x58f283=this;return new Promise(function(_0x262808,_0x49aed9){return db[_0xc181('0x22')][_0xc181('0x23')](_0x1c2ae9[_0xc181('0x1d')],{'raw':_0x1c2ae9[_0xc181('0x1e')]?_0x1c2ae9['options'][_0xc181('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c2ae9[_0xc181('0x1e')]?_0x1c2ae9['options'][_0xc181('0x25')]||null:null,'attributes':_0x1c2ae9[_0xc181('0x1e')]?_0x1c2ae9[_0xc181('0x1e')]['attributes']||null:null,'limit':_0x1c2ae9[_0xc181('0x1e')]?_0x1c2ae9['options']['limit']||null:null})[_0xc181('0x1f')](function(_0x6be502){logger['info'](_0xc181('0x21'),_0x1c2ae9);logger[_0xc181('0x14')](_0xc181('0x21'),_0x1c2ae9,JSON['stringify'](_0x6be502));_0x262808(_0x6be502);})[_0xc181('0x1b')](function(_0x396592){logger[_0xc181('0x17')](_0xc181('0x21'),_0x396592['message'],_0x1c2ae9);_0x49aed9(_0x58f283[_0xc181('0x17')](0x1f4,_0x396592[_0xc181('0x19')]));});});}; \ No newline at end of file +var _0x57a2=['./faxMessage.socket','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxMessage,\x20%s,\x20%s','catch','CreateFaxMessage','FaxMessage','options','raw','UpdateFaxMessage','update','attributes','limit','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2bc6b0,_0x8d2203){var _0x217cfe=function(_0x403564){while(--_0x403564){_0x2bc6b0['push'](_0x2bc6b0['shift']());}};_0x217cfe(++_0x8d2203);}(_0x57a2,0x154));var _0x257a=function(_0x50ac3e,_0x2d093b){_0x50ac3e=_0x50ac3e-0x0;var _0x53154d=_0x57a2[_0x50ac3e];return _0x53154d;};'use strict';var _=require('lodash');var util=require(_0x257a('0x0'));var moment=require('moment');var BPromise=require(_0x257a('0x1'));var rs=require(_0x257a('0x2'));var fs=require('fs');var Redis=require(_0x257a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x257a('0x4'));var config=require(_0x257a('0x5'));var jayson=require(_0x257a('0x6'));var client=jayson[_0x257a('0x7')][_0x257a('0x8')]({'port':0x232a});config[_0x257a('0x9')]=_[_0x257a('0xa')](config[_0x257a('0x9')],{'host':_0x257a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x257a('0x9')]));require(_0x257a('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b1f11,_0x52ed05,_0x304bf3){return new BPromise(function(_0x2fb492,_0x39921b){return client[_0x257a('0xd')](_0x5b1f11,_0x304bf3)[_0x257a('0xe')](function(_0x2562a5){logger[_0x257a('0xf')]('FaxMessage,\x20%s,\x20%s',_0x52ed05,_0x257a('0x10'));logger[_0x257a('0x11')](_0x257a('0x12'),_0x52ed05,'request\x20sent',JSON[_0x257a('0x13')](_0x2562a5));if(_0x2562a5[_0x257a('0x14')]){if(_0x2562a5[_0x257a('0x14')]['code']===0x1f4){logger[_0x257a('0x14')]('FaxMessage,\x20%s,\x20%s',_0x52ed05,_0x2562a5['error'][_0x257a('0x15')]);return _0x39921b(_0x2562a5[_0x257a('0x14')][_0x257a('0x15')]);}logger[_0x257a('0x14')](_0x257a('0x16'),_0x52ed05,_0x2562a5[_0x257a('0x14')][_0x257a('0x15')]);return _0x2fb492(_0x2562a5[_0x257a('0x14')][_0x257a('0x15')]);}else{logger[_0x257a('0xf')](_0x257a('0x16'),_0x52ed05,'request\x20sent');_0x2fb492(_0x2562a5['result'][_0x257a('0x15')]);}})[_0x257a('0x17')](function(_0x58a502){logger[_0x257a('0x14')](_0x257a('0x16'),_0x52ed05,_0x58a502);_0x39921b(_0x58a502);});});}exports[_0x257a('0x18')]=function(_0x130d44){var _0x11f9a3=this;return new Promise(function(_0x234758,_0x1da482){return db[_0x257a('0x19')]['create'](_0x130d44['body'],{'raw':_0x130d44[_0x257a('0x1a')]?_0x130d44[_0x257a('0x1a')][_0x257a('0x1b')]===undefined?!![]:![]:!![]})[_0x257a('0xe')](function(_0x52bc5d){logger['info']('CreateFaxMessage',_0x130d44);logger[_0x257a('0x11')](_0x257a('0x18'),_0x130d44,JSON['stringify'](_0x52bc5d));_0x234758(_0x52bc5d);})['catch'](function(_0x370ddf){logger['error'](_0x257a('0x18'),_0x370ddf[_0x257a('0x15')],_0x130d44);_0x1da482(_0x11f9a3[_0x257a('0x14')](0x1f4,_0x370ddf[_0x257a('0x15')]));});});};exports[_0x257a('0x1c')]=function(_0x5001c4){var _0x11629c=this;return new Promise(function(_0xe3e3bf,_0x42a4aa){return db[_0x257a('0x19')][_0x257a('0x1d')](_0x5001c4['body'],{'raw':_0x5001c4['options']?_0x5001c4['options'][_0x257a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5001c4[_0x257a('0x1a')]?_0x5001c4[_0x257a('0x1a')]['where']||null:null,'attributes':_0x5001c4[_0x257a('0x1a')]?_0x5001c4[_0x257a('0x1a')][_0x257a('0x1e')]||null:null,'limit':_0x5001c4[_0x257a('0x1a')]?_0x5001c4[_0x257a('0x1a')][_0x257a('0x1f')]||null:null})[_0x257a('0xe')](function(_0x15ef61){logger['info'](_0x257a('0x1c'),_0x5001c4);logger[_0x257a('0x11')](_0x257a('0x1c'),_0x5001c4,JSON[_0x257a('0x13')](_0x15ef61));_0xe3e3bf(_0x15ef61);})['catch'](function(_0x4bce3d){logger[_0x257a('0x14')](_0x257a('0x1c'),_0x4bce3d[_0x257a('0x15')],_0x5001c4);_0x42a4aa(_0x11629c[_0x257a('0x14')](0x1f4,_0x4bce3d[_0x257a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d79afe6..30881a9 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 _0xa9e0=['register','length','faxMessage:','./faxMessage.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(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var FaxMessageEvents=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(){FaxMessageEvents[_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);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3413624..92e93a1 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 _0xb866=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','download','post','tracked','fax','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer'];(function(_0x2b9884,_0x393e88){var _0x1c9a8f=function(_0x29be81){while(--_0x29be81){_0x2b9884['push'](_0x2b9884['shift']());}};_0x1c9a8f(++_0x393e88);}(_0xb866,0x103));var _0x6b86=function(_0x339b4e,_0x1312a8){_0x339b4e=_0x339b4e-0x0;var _0x490690=_0xb866[_0x339b4e];return _0x490690;};'use strict';var multer=require(_0x6b86('0x0'));var util=require('util');var path=require(_0x6b86('0x1'));var timeout=require('connect-timeout');var express=require(_0x6b86('0x2'));var router=express[_0x6b86('0x3')]();var auth=require(_0x6b86('0x4'));var interaction=require(_0x6b86('0x5'));var config=require(_0x6b86('0x6'));var controller=require(_0x6b86('0x7'));router[_0x6b86('0x8')]('/',auth[_0x6b86('0x9')](),controller[_0x6b86('0xa')]);router['get'](_0x6b86('0xb'),auth[_0x6b86('0x9')](),controller['describe']);router['get'](_0x6b86('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6b86('0x8')]('/:id/download',auth[_0x6b86('0x9')](),controller[_0x6b86('0xd')]);router[_0x6b86('0xe')]('/',auth[_0x6b86('0x9')](),interaction[_0x6b86('0xf')](_0x6b86('0x10'),'faxmessage:create'),controller[_0x6b86('0x11')]);router[_0x6b86('0x12')](_0x6b86('0xc'),auth[_0x6b86('0x9')](),controller[_0x6b86('0x13')]);router['put'](_0x6b86('0x14'),auth[_0x6b86('0x9')](),controller[_0x6b86('0x15')]);router[_0x6b86('0x12')](_0x6b86('0x16'),auth[_0x6b86('0x9')](),controller[_0x6b86('0x17')]);router[_0x6b86('0x18')](_0x6b86('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x6b86('0x19')]=router; \ No newline at end of file +var _0xcf66=['update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','describe','/:id','show','download','tracked','fax','faxmessage:create'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xcf66,0x71));var _0x6cf6=function(_0x1a3303,_0x228921){_0x1a3303=_0x1a3303-0x0;var _0x561dd7=_0xcf66[_0x1a3303];return _0x561dd7;};'use strict';var multer=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var path=require(_0x6cf6('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cf6('0x3'));var router=express[_0x6cf6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6cf6('0x5'));var controller=require(_0x6cf6('0x6'));router['get']('/',auth[_0x6cf6('0x7')](),controller[_0x6cf6('0x8')]);router[_0x6cf6('0x9')]('/describe',auth[_0x6cf6('0x7')](),controller[_0x6cf6('0xa')]);router[_0x6cf6('0x9')](_0x6cf6('0xb'),auth[_0x6cf6('0x7')](),controller[_0x6cf6('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x6cf6('0xd')]);router['post']('/',auth[_0x6cf6('0x7')](),interaction[_0x6cf6('0xe')](_0x6cf6('0xf'),_0x6cf6('0x10')),controller['create']);router['put']('/:id',auth[_0x6cf6('0x7')](),controller[_0x6cf6('0x11')]);router[_0x6cf6('0x12')](_0x6cf6('0x13'),auth[_0x6cf6('0x7')](),controller[_0x6cf6('0x14')]);router['put'](_0x6cf6('0x15'),auth['isAuthenticated'](),controller[_0x6cf6('0x16')]);router[_0x6cf6('0x17')]('/:id',auth[_0x6cf6('0x7')](),controller[_0x6cf6('0x18')]);module[_0x6cf6('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 5f31e03..2b49301 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 _0xb922=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x543eac,_0x3a39a1){var _0x16c036=function(_0x446e5d){while(--_0x446e5d){_0x543eac['push'](_0x543eac['shift']());}};_0x16c036(++_0x3a39a1);}(_0xb922,0x12d));var _0x2b92=function(_0x49aab7,_0x1d6397){_0x49aab7=_0x49aab7-0x0;var _0x587b6f=_0xb922[_0x49aab7];return _0x587b6f;};'use strict';var Sequelize=require(_0x2b92('0x0'));module[_0x2b92('0x1')]={'name':{'type':Sequelize[_0x2b92('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2b92('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2b92('0x4')](_0x2b92('0x5'),'beepall',_0x2b92('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x2b92('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x15f9=['sequelize','exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x15f9,0x150));var _0x915f=function(_0x489ad6,_0x280bc1){_0x489ad6=_0x489ad6-0x0;var _0x2418a0=_0x15f9[_0x489ad6];return _0x2418a0;};'use strict';var Sequelize=require(_0x915f('0x0'));module[_0x915f('0x1')]={'name':{'type':Sequelize[_0x915f('0x2')],'unique':_0x915f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x915f('0x2')]},'timeout':{'type':Sequelize[_0x915f('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x915f('0x5'),_0x915f('0x6'),_0x915f('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index cd25828..48d94c3 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 _0x3f10=['FaxQueues','UserProfileResource','then','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','pick','FaxQueueId','User','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','length','addTeams','ids','Agents','flatMap','sequelize','transaction','each','emit','userFaxQueue:save','removeTeams','select','field','from','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','destroy','get'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x3f10,0xe9));var _0x03f1=function(_0x21e9ed,_0x4ab24b){_0x21e9ed=_0x21e9ed-0x0;var _0x4db455=_0x3f10[_0x21e9ed];return _0x4db455;};'use strict';var pdf=require(_0x03f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x03f1('0x1'));var zipdir=require(_0x03f1('0x2'));var jsonpatch=require(_0x03f1('0x3'));var rp=require('request-promise');var moment=require(_0x03f1('0x4'));var BPromise=require(_0x03f1('0x5'));var Mustache=require(_0x03f1('0x6'));var util=require(_0x03f1('0x7'));var path=require(_0x03f1('0x8'));var sox=require(_0x03f1('0x9'));var csv=require(_0x03f1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x03f1('0xb'));var crypto=require('crypto');var jsforce=require(_0x03f1('0xc'));var deskjs=require(_0x03f1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x03f1('0xe'));var Redis=require(_0x03f1('0xf'));var authService=require(_0x03f1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x03f1('0x11'));var hardwareService=require(_0x03f1('0x12'));var logger=require(_0x03f1('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x03f1('0x14'));var licenseUtil=require(_0x03f1('0x15'));var db=require(_0x03f1('0x16'))['db'];config['redis']=_[_0x03f1('0x17')](config['redis'],{'host':_0x03f1('0x18'),'port':0x18eb});var socket=require(_0x03f1('0x19'))(new Redis(config[_0x03f1('0x1a')]));require(_0x03f1('0x1b'))[_0x03f1('0x1c')](socket);function respondWithStatusCode(_0x5d9f06,_0xecef6c){_0xecef6c=_0xecef6c||0xcc;return function(_0x547743){if(_0x547743){return _0x5d9f06[_0x03f1('0x1d')](_0xecef6c);}return _0x5d9f06[_0x03f1('0x1e')](_0xecef6c)[_0x03f1('0x1f')]();};}function respondWithResult(_0x533656,_0x34e5ff){_0x34e5ff=_0x34e5ff||0xc8;return function(_0xd10941){if(_0xd10941){return _0x533656[_0x03f1('0x1e')](_0x34e5ff)[_0x03f1('0x20')](_0xd10941);}};}function respondWithFilteredResult(_0x2452ca,_0x45516f){return function(_0x4cb10b){if(_0x4cb10b){var _0x32bfcb=_0x4cb10b[_0x03f1('0x21')],_0x3b1148=_0x45516f['offset'],_0x5a5516=_0x45516f[_0x03f1('0x22')]+_0x45516f[_0x03f1('0x23')],_0xbe9f1b;if(_0x5a5516>=_0x32bfcb){_0x5a5516=_0x32bfcb;_0xbe9f1b=0xc8;}else{_0xbe9f1b=0xce;}_0x2452ca['status'](_0xbe9f1b);return _0x2452ca['set']('Content-Range',_0x3b1148+'-'+_0x5a5516+'/'+_0x32bfcb)[_0x03f1('0x20')](_0x4cb10b);}return null;};}function patchUpdates(_0xe7c7d7){return function(_0x342d55){try{jsonpatch[_0x03f1('0x24')](_0x342d55,_0xe7c7d7,!![]);}catch(_0x45f0f6){return BPromise[_0x03f1('0x25')](_0x45f0f6);}return _0x342d55[_0x03f1('0x26')]();};}function saveUpdates(_0x1090d4,_0x285c81){return function(_0x38828a){if(_0x38828a){return _0x38828a['update'](_0x1090d4)['then'](function(_0xfcaaef){return _0xfcaaef;});}return null;};}function removeEntity(_0x38558e,_0x36a5bb){return function(_0x54b149){if(_0x54b149){return _0x54b149[_0x03f1('0x27')]()['then'](function(){var _0x3d48c5=_0x54b149[_0x03f1('0x28')]({'plain':!![]});var _0xa32312=_0x03f1('0x29');return db[_0x03f1('0x2a')][_0x03f1('0x27')]({'where':{'type':_0xa32312,'resourceId':_0x3d48c5['id']}})['then'](function(){return _0x54b149;});})[_0x03f1('0x2b')](function(){_0x38558e[_0x03f1('0x1e')](0xcc)[_0x03f1('0x1f')]();});}};}function handleEntityNotFound(_0x13b415,_0x59452e){return function(_0x257932){if(!_0x257932){_0x13b415['sendStatus'](0x194);}return _0x257932;};}function handleError(_0x3e3bd1,_0x10847e){_0x10847e=_0x10847e||0x1f4;return function(_0x4475bc){logger[_0x03f1('0x2c')](_0x4475bc[_0x03f1('0x2d')]);if(_0x4475bc[_0x03f1('0x2e')]){delete _0x4475bc[_0x03f1('0x2e')];}_0x3e3bd1[_0x03f1('0x1e')](_0x10847e)[_0x03f1('0x2f')](_0x4475bc);};}exports[_0x03f1('0x30')]=function(_0xea325b,_0x4545a7){var _0x3e0df6={},_0x16c5bb={},_0x4873e8={'count':0x0,'rows':[]};var _0x1998b3=_['map'](db[_0x03f1('0x31')][_0x03f1('0x32')],function(_0x552d8f){return{'name':_0x552d8f[_0x03f1('0x33')],'type':_0x552d8f[_0x03f1('0x34')]['key']};});_0x16c5bb[_0x03f1('0x35')]=_[_0x03f1('0x36')](_0x1998b3,_0x03f1('0x2e'));_0x16c5bb[_0x03f1('0x37')]=_[_0x03f1('0x38')](_0xea325b['query']);_0x16c5bb[_0x03f1('0x39')]=_[_0x03f1('0x3a')](_0x16c5bb[_0x03f1('0x35')],_0x16c5bb['query']);_0x3e0df6[_0x03f1('0x3b')]=_[_0x03f1('0x3a')](_0x16c5bb[_0x03f1('0x35')],qs[_0x03f1('0x3c')](_0xea325b[_0x03f1('0x37')]['fields']));_0x3e0df6[_0x03f1('0x3b')]=_0x3e0df6[_0x03f1('0x3b')]['length']?_0x3e0df6[_0x03f1('0x3b')]:_0x16c5bb['model'];if(!_0xea325b['query'][_0x03f1('0x3d')](_0x03f1('0x3e'))){_0x3e0df6['limit']=qs[_0x03f1('0x23')](_0xea325b[_0x03f1('0x37')]['limit']);_0x3e0df6[_0x03f1('0x22')]=qs['offset'](_0xea325b['query'][_0x03f1('0x22')]);}_0x3e0df6[_0x03f1('0x3f')]=qs[_0x03f1('0x40')](_0xea325b[_0x03f1('0x37')]['sort']);_0x3e0df6[_0x03f1('0x41')]=qs[_0x03f1('0x39')](_['pick'](_0xea325b[_0x03f1('0x37')],_0x16c5bb[_0x03f1('0x39')]),_0x1998b3);if(_0xea325b['query'][_0x03f1('0x42')]){_0x3e0df6[_0x03f1('0x41')]=_[_0x03f1('0x43')](_0x3e0df6[_0x03f1('0x41')],{'$or':_[_0x03f1('0x36')](_0x1998b3,function(_0x7cf1de){if(_0x7cf1de[_0x03f1('0x34')]!=='VIRTUAL'){var _0x2d8b54={};_0x2d8b54[_0x7cf1de['name']]={'$like':'%'+_0xea325b[_0x03f1('0x37')][_0x03f1('0x42')]+'%'};return _0x2d8b54;}})});}_0x3e0df6=_['merge']({},_0x3e0df6,_0xea325b['options']);var _0x20b8cd={'where':_0x3e0df6[_0x03f1('0x41')]};return db[_0x03f1('0x31')][_0x03f1('0x21')](_0x20b8cd)[_0x03f1('0x2b')](function(_0x26226c){_0x4873e8[_0x03f1('0x21')]=_0x26226c;if(_0xea325b[_0x03f1('0x37')][_0x03f1('0x44')]){_0x3e0df6[_0x03f1('0x45')]=[{'all':!![]}];}return db[_0x03f1('0x31')][_0x03f1('0x46')](_0x3e0df6);})[_0x03f1('0x2b')](function(_0xd6edd8){_0x4873e8[_0x03f1('0x47')]=_0xd6edd8;return _0x4873e8;})[_0x03f1('0x2b')](respondWithFilteredResult(_0x4545a7,_0x3e0df6))[_0x03f1('0x48')](handleError(_0x4545a7,null));};exports[_0x03f1('0x49')]=function(_0x172cb4,_0x151282){var _0x840fd1={'raw':!![],'where':{'id':_0x172cb4[_0x03f1('0x4a')]['id']}},_0x3b4858={};_0x3b4858[_0x03f1('0x35')]=_[_0x03f1('0x38')](db[_0x03f1('0x31')][_0x03f1('0x32')]);_0x3b4858[_0x03f1('0x37')]=_['keys'](_0x172cb4[_0x03f1('0x37')]);_0x3b4858[_0x03f1('0x39')]=_[_0x03f1('0x3a')](_0x3b4858[_0x03f1('0x35')],_0x3b4858[_0x03f1('0x37')]);_0x840fd1['attributes']=_[_0x03f1('0x3a')](_0x3b4858['model'],qs[_0x03f1('0x3c')](_0x172cb4[_0x03f1('0x37')][_0x03f1('0x3c')]));_0x840fd1[_0x03f1('0x3b')]=_0x840fd1[_0x03f1('0x3b')]['length']?_0x840fd1[_0x03f1('0x3b')]:_0x3b4858[_0x03f1('0x35')];if(_0x172cb4['query'][_0x03f1('0x44')]){_0x840fd1[_0x03f1('0x45')]=[{'all':!![]}];}_0x840fd1=_[_0x03f1('0x43')]({},_0x840fd1,_0x172cb4[_0x03f1('0x4b')]);return db['FaxQueue']['find'](_0x840fd1)[_0x03f1('0x2b')](handleEntityNotFound(_0x151282,null))['then'](respondWithResult(_0x151282,null))[_0x03f1('0x48')](handleError(_0x151282,null));};exports[_0x03f1('0x4c')]=function(_0x31101f,_0x15a775){return db[_0x03f1('0x31')][_0x03f1('0x4c')](_0x31101f[_0x03f1('0x4d')],{})[_0x03f1('0x2b')](function(_0x41955a){var _0x47b293=_0x31101f[_0x03f1('0x4e')]['get']({'plain':!![]});if(!_0x47b293)throw new Error(_0x03f1('0x4f'));if(_0x47b293[_0x03f1('0x50')]===_0x03f1('0x4e')){var _0x2541d9=_0x41955a[_0x03f1('0x28')]({'plain':!![]});var _0x465411=_0x03f1('0x29');return db[_0x03f1('0x51')][_0x03f1('0x52')]({'where':{'name':_0x465411,'userProfileId':_0x47b293[_0x03f1('0x53')]},'raw':!![]})[_0x03f1('0x2b')](function(_0x1801e5){if(_0x1801e5&&_0x1801e5[_0x03f1('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x2541d9[_0x03f1('0x2e')],'resourceId':_0x2541d9['id'],'type':_0x1801e5['name'],'sectionId':_0x1801e5['id']},{})[_0x03f1('0x2b')](function(){return _0x41955a;});}else{return _0x41955a;}})[_0x03f1('0x48')](function(_0x15a6a7){logger['error'](_0x03f1('0x55'),_0x15a6a7);throw _0x15a6a7;});}return _0x41955a;})[_0x03f1('0x2b')](respondWithResult(_0x15a775,0xc9))[_0x03f1('0x48')](handleError(_0x15a775,null));};exports[_0x03f1('0x56')]=function(_0x43ece0,_0x4275bf){if(_0x43ece0[_0x03f1('0x4d')]['id']){delete _0x43ece0[_0x03f1('0x4d')]['id'];}return db[_0x03f1('0x31')][_0x03f1('0x52')]({'where':{'id':_0x43ece0[_0x03f1('0x4a')]['id']}})[_0x03f1('0x2b')](handleEntityNotFound(_0x4275bf,null))['then'](saveUpdates(_0x43ece0[_0x03f1('0x4d')],null))[_0x03f1('0x2b')](respondWithResult(_0x4275bf,null))['catch'](handleError(_0x4275bf,null));};exports[_0x03f1('0x27')]=function(_0x2d861c,_0x555946){return db[_0x03f1('0x31')]['find']({'where':{'id':_0x2d861c[_0x03f1('0x4a')]['id']}})[_0x03f1('0x2b')](handleEntityNotFound(_0x555946,null))[_0x03f1('0x2b')](removeEntity(_0x555946,null))[_0x03f1('0x48')](handleError(_0x555946,null));};exports[_0x03f1('0x57')]=function(_0x593ade,_0x5ec193){return db['FaxQueue'][_0x03f1('0x57')]()[_0x03f1('0x2b')](respondWithResult(_0x5ec193,null))[_0x03f1('0x48')](handleError(_0x5ec193,null));};exports[_0x03f1('0x58')]=function(_0x3dc957,_0xcb1048,_0x4e616d){var _0x449f79={'raw':!![],'where':{}},_0x3ac692={},_0x1e323e;return db['FaxQueue'][_0x03f1('0x59')]({'where':{'id':_0x3dc957[_0x03f1('0x4a')]['id']}})['then'](handleEntityNotFound(_0xcb1048,null))[_0x03f1('0x2b')](function(_0x1894d7){if(_0x1894d7){_0x1e323e=_0x1894d7[_0x03f1('0x28')]({'plain':!![]});_0x3ac692[_0x03f1('0x35')]=_[_0x03f1('0x38')](db[_0x03f1('0x5a')][_0x03f1('0x32')]);_0x3ac692[_0x03f1('0x37')]=_[_0x03f1('0x38')](_0x3dc957['query']);_0x3ac692[_0x03f1('0x39')]=_[_0x03f1('0x3a')](_0x3ac692[_0x03f1('0x35')],_0x3ac692['query']);_0x449f79['attributes']=_[_0x03f1('0x3a')](_0x3ac692[_0x03f1('0x35')],qs[_0x03f1('0x3c')](_0x3dc957[_0x03f1('0x37')]['fields']));_0x449f79['attributes']=_0x449f79[_0x03f1('0x3b')]['length']?_0x449f79[_0x03f1('0x3b')]:_0x3ac692[_0x03f1('0x35')];if(!_0x3dc957[_0x03f1('0x37')][_0x03f1('0x3d')](_0x03f1('0x3e'))){_0x449f79[_0x03f1('0x23')]=qs[_0x03f1('0x23')](_0x3dc957[_0x03f1('0x37')][_0x03f1('0x23')]);_0x449f79[_0x03f1('0x22')]=qs[_0x03f1('0x22')](_0x3dc957[_0x03f1('0x37')][_0x03f1('0x22')]);}_0x449f79[_0x03f1('0x3f')]=qs[_0x03f1('0x40')](_0x3dc957[_0x03f1('0x37')][_0x03f1('0x40')]);_0x449f79['where']=qs[_0x03f1('0x39')](_[_0x03f1('0x5b')](_0x3dc957[_0x03f1('0x37')],_0x3ac692[_0x03f1('0x39')]));_0x449f79['where'][_0x03f1('0x5c')]=_0x1894d7['id'];if(_0x3dc957[_0x03f1('0x37')][_0x03f1('0x42')]){_0x449f79[_0x03f1('0x41')]=_[_0x03f1('0x43')](_0x449f79[_0x03f1('0x41')],{'$or':_['map'](_0x449f79[_0x03f1('0x3b')],function(_0x20ddd1){var _0x5593f6={};_0x5593f6[_0x20ddd1]={'$like':'%'+_0x3dc957[_0x03f1('0x37')][_0x03f1('0x42')]+'%'};return _0x5593f6;})});}_0x449f79=_['merge']({},_0x449f79,_0x3dc957[_0x03f1('0x4b')]);return db['UserFaxQueue'][_0x03f1('0x46')](_0x449f79);}})[_0x03f1('0x2b')](function(_0x4ea796){if(_0x4ea796){return db[_0x03f1('0x5d')]['findAndCountAll']({'where':{'id':_[_0x03f1('0x36')](_0x4ea796,_0x03f1('0x5e')),'role':_0x03f1('0x5f')},'attributes':['id',_0x03f1('0x2e'),_0x03f1('0x60'),'updatedAt',_0x03f1('0x61')]});}})[_0x03f1('0x2b')](function(_0x40d51a){if(_0x40d51a){return{'count':_0x40d51a[_0x03f1('0x21')],'rows':_['map'](_0x40d51a[_0x03f1('0x47')],function(_0xd2470e){return{'membername':_0xd2470e[_0x03f1('0x2e')],'UserId':_0xd2470e['id'],'queue_name':_0x1e323e[_0x03f1('0x2e')],'FaxQueueId':_0x1e323e['id'],'interface':util[_0x03f1('0x62')](_0x03f1('0x63'),_0x03f1('0x64'),_0xd2470e[_0x03f1('0x2e')]),'penalty':0x0,'paused':_0xd2470e[_0x03f1('0x60')],'createdAt':_0xd2470e[_0x03f1('0x61')],'updatedAt':_0xd2470e[_0x03f1('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x03f1('0x2b')](respondWithFilteredResult(_0xcb1048,_0x449f79))[_0x03f1('0x48')](handleError(_0xcb1048,null));};exports[_0x03f1('0x66')]=function(_0x4af697,_0x478015,_0x2f4457){var _0x36218a={};var _0x42a98c={};var _0x4728e6;var _0x1b4da2;return db[_0x03f1('0x31')][_0x03f1('0x59')]({'where':{'id':_0x4af697['params']['id']}})['then'](handleEntityNotFound(_0x478015,null))[_0x03f1('0x2b')](function(_0x511c85){if(_0x511c85){_0x4728e6=_0x511c85;_0x42a98c[_0x03f1('0x35')]=_['keys'](db[_0x03f1('0x67')]['rawAttributes']);_0x42a98c[_0x03f1('0x37')]=_['keys'](_0x4af697[_0x03f1('0x37')]);_0x42a98c[_0x03f1('0x39')]=_[_0x03f1('0x3a')](_0x42a98c['model'],_0x42a98c['query']);_0x36218a[_0x03f1('0x3b')]=_[_0x03f1('0x3a')](_0x42a98c[_0x03f1('0x35')],qs[_0x03f1('0x3c')](_0x4af697[_0x03f1('0x37')][_0x03f1('0x3c')]));_0x36218a[_0x03f1('0x3b')]=_0x36218a['attributes'][_0x03f1('0x68')]?_0x36218a['attributes']:_0x42a98c[_0x03f1('0x35')];_0x36218a['order']=qs[_0x03f1('0x40')](_0x4af697[_0x03f1('0x37')][_0x03f1('0x40')]);_0x36218a[_0x03f1('0x41')]=qs[_0x03f1('0x39')](_[_0x03f1('0x5b')](_0x4af697[_0x03f1('0x37')],_0x42a98c[_0x03f1('0x39')]));if(_0x4af697[_0x03f1('0x37')][_0x03f1('0x42')]){_0x36218a['where']=_[_0x03f1('0x43')](_0x36218a[_0x03f1('0x41')],{'$or':_[_0x03f1('0x36')](_0x36218a[_0x03f1('0x3b')],function(_0x5c639f){var _0xb18273={};_0xb18273[_0x5c639f]={'$like':'%'+_0x4af697['query']['filter']+'%'};return _0xb18273;})});}_0x36218a=_['merge']({},_0x36218a,_0x4af697[_0x03f1('0x4b')]);return _0x4728e6[_0x03f1('0x66')](_0x36218a);}})['then'](function(_0x1538a5){if(_0x1538a5){_0x1b4da2=_0x1538a5[_0x03f1('0x68')];if(!_0x4af697['query'][_0x03f1('0x3d')](_0x03f1('0x3e'))){_0x36218a[_0x03f1('0x23')]=qs['limit'](_0x4af697[_0x03f1('0x37')][_0x03f1('0x23')]);_0x36218a['offset']=qs[_0x03f1('0x22')](_0x4af697[_0x03f1('0x37')]['offset']);}return _0x4728e6[_0x03f1('0x66')](_0x36218a);}})['then'](function(_0x414b92){if(_0x414b92){return _0x414b92?{'count':_0x1b4da2,'rows':_0x414b92}:null;}})[_0x03f1('0x2b')](respondWithResult(_0x478015,null))[_0x03f1('0x48')](handleError(_0x478015,null));};exports[_0x03f1('0x69')]=function(_0x2ecd80,_0x5a91a1,_0x57336f){var _0x21237a=_0x2ecd80[_0x03f1('0x4d')][_0x03f1('0x6a')];return db['Team'][_0x03f1('0x46')]({'where':{'id':_0x21237a},'attributes':['id'],'include':[{'model':db[_0x03f1('0x5d')],'as':_0x03f1('0x6b'),'attributes':['id',_0x03f1('0x2e'),'online','voicePause','interface'],'raw':!![]}]})[_0x03f1('0x2b')](function(_0x5bd29c){if(_0x5bd29c){var _0x179822=_[_0x03f1('0x6c')](_0x5bd29c,function(_0x4a249a){var _0x3bcb3c=_0x4a249a[_0x03f1('0x28')]({'plain':!![]});return _0x3bcb3c[_0x03f1('0x6b')];});return db[_0x03f1('0x31')][_0x03f1('0x52')]({'where':{'id':_0x2ecd80[_0x03f1('0x4a')]['id']}})[_0x03f1('0x2b')](function(_0x3a50b2){return db[_0x03f1('0x6d')][_0x03f1('0x6e')](function(_0x503061){return _0x3a50b2[_0x03f1('0x69')](_0x21237a,{'transaction':_0x503061})['then'](function(){return BPromise[_0x03f1('0x6f')](_0x179822,function(_0x21c41f){return db[_0x03f1('0x5a')]['findOrCreate']({'where':{'UserId':_0x21c41f['id'],'FaxQueueId':_0x2ecd80[_0x03f1('0x4a')]['id']},'transaction':_0x503061});});})[_0x03f1('0x2b')](function(){_0x179822['forEach'](function(_0xaa00d7){socket[_0x03f1('0x70')](_0x03f1('0x71'),{'UserId':_0xaa00d7['id'],'FaxQueueId':_0x3a50b2['id']});});});});});}})[_0x03f1('0x2b')](respondWithStatusCode(_0x5a91a1,null))[_0x03f1('0x48')](handleError(_0x5a91a1,null));};exports[_0x03f1('0x72')]=function(_0x454941,_0x2007a4,_0x48a45b){return db[_0x03f1('0x67')][_0x03f1('0x46')]({'where':{'id':_0x454941[_0x03f1('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0x03f1('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2007a4,null))[_0x03f1('0x2b')](function(_0x1d43de){var _0x2f99b9=_['map'](_0x1d43de,'id');var _0x37e346=[];var _0x5d527a=[];var _0x3ff495=squel[_0x03f1('0x73')]();_0x3ff495[_0x03f1('0x74')]('tq.TeamId')[_0x03f1('0x75')]('team_has_fax_queues','tq')['join'](_0x03f1('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x03f1('0x41')]('FaxQueueId\x20=\x20?',_0x454941[_0x03f1('0x4a')]['id']);for(var _0x5d86c8=0x0;_0x5d86c8<_0x1d43de[_0x03f1('0x68')];_0x5d86c8+=0x1){let _0x27eef3=_0x1d43de[_0x5d86c8];for(var _0x9485b1=0x0;_0x9485b1<_0x27eef3[_0x03f1('0x6b')][_0x03f1('0x68')];_0x9485b1+=0x1){let _0x174e80=_0x27eef3[_0x03f1('0x6b')][_0x9485b1];var _0x2bcba7=_0x3ff495['clone']();_0x2bcba7[_0x03f1('0x41')](_0x03f1('0x77'),_0x174e80['id']);_0x5d527a[_0x03f1('0x78')](db[_0x03f1('0x6d')][_0x03f1('0x37')](_0x2bcba7[_0x03f1('0x79')](),{'type':db[_0x03f1('0x6d')][_0x03f1('0x7a')][_0x03f1('0x7b')]})['then'](function(_0x528907){if(_0x528907[_0x03f1('0x68')]===0x1){return _0x174e80['id'];}else{var _0x4ff46b=_['every'](_[_0x03f1('0x36')](_0x528907,_0x03f1('0x7c')),function(_0x20ef34){return _[_0x03f1('0x7d')](_0x2f99b9,_0x20ef34);});if(_0x4ff46b){return _0x174e80['id'];}}}));}}return BPromise['all'](_0x5d527a)[_0x03f1('0x2b')](function(_0x41bab4){_0x37e346=_(_0x37e346)[_0x03f1('0x7e')](_0x41bab4)[_0x03f1('0x7f')]()[_0x03f1('0x80')]();return db[_0x03f1('0x31')][_0x03f1('0x52')]({'where':{'id':_0x454941['params']['id']}})[_0x03f1('0x2b')](function(_0x3f3607){return db[_0x03f1('0x6d')]['transaction'](function(_0x275068){return _0x3f3607['removeTeams'](_0x454941[_0x03f1('0x37')][_0x03f1('0x6a')],{'transaction':_0x275068})[_0x03f1('0x2b')](function(){if(!_['isEmpty'](_0x37e346)){return _0x3f3607[_0x03f1('0x81')](_0x37e346,{'transaction':_0x275068});}})['then'](function(){_0x37e346[_0x03f1('0x82')](function(_0x107346){socket[_0x03f1('0x70')](_0x03f1('0x83'),{'UserId':_0x107346,'FaxQueueId':_0x3f3607['id']});});});});});});})['then'](respondWithStatusCode(_0x2007a4,null))['catch'](handleError(_0x2007a4,null));};exports['addAgents']=function(_0x312046,_0x4e2363,_0x4feecf){return db['FaxQueue'][_0x03f1('0x52')]({'where':{'id':_0x312046['params']['id']}})[_0x03f1('0x2b')](handleEntityNotFound(_0x4e2363,null))[_0x03f1('0x2b')](function(_0x531ffe){if(_0x531ffe){return _0x531ffe[_0x03f1('0x84')](_0x312046[_0x03f1('0x4d')][_0x03f1('0x6a')],_[_0x03f1('0x85')](_0x312046[_0x03f1('0x4d')],['ids','id'])||{})[_0x03f1('0x86')](function(_0x2c619b){for(var _0x331867=0x0;_0x331867<_0x312046[_0x03f1('0x4d')][_0x03f1('0x6a')][_0x03f1('0x68')];_0x331867+=0x1){socket[_0x03f1('0x70')](_0x03f1('0x71'),{'UserId':_0x312046[_0x03f1('0x4d')][_0x03f1('0x6a')][_0x331867],'FaxQueueId':_0x312046[_0x03f1('0x4a')]['id']});}return _0x2c619b;});}})['then'](respondWithResult(_0x4e2363,null))[_0x03f1('0x48')](handleError(_0x4e2363,null));};exports[_0x03f1('0x81')]=function(_0x54ec2d,_0x1e14a5,_0x45d219){return db[_0x03f1('0x31')][_0x03f1('0x52')]({'where':{'id':_0x54ec2d[_0x03f1('0x4a')]['id']}})[_0x03f1('0x2b')](handleEntityNotFound(_0x1e14a5,null))[_0x03f1('0x2b')](function(_0x351ea3){if(_0x351ea3){return _0x351ea3[_0x03f1('0x81')](_0x54ec2d[_0x03f1('0x37')][_0x03f1('0x6a')])[_0x03f1('0x2b')](function(){if(_[_0x03f1('0x87')](_0x54ec2d['query'][_0x03f1('0x6a')])){for(var _0x28732e=0x0;_0x28732e<_0x54ec2d[_0x03f1('0x37')]['ids'][_0x03f1('0x68')];_0x28732e+=0x1){socket['emit'](_0x03f1('0x83'),{'UserId':Number(_0x54ec2d[_0x03f1('0x37')][_0x03f1('0x6a')][_0x28732e]),'FaxQueueId':Number(_0x54ec2d[_0x03f1('0x4a')]['id'])});}}else{socket[_0x03f1('0x70')](_0x03f1('0x83'),{'UserId':Number(_0x54ec2d[_0x03f1('0x37')][_0x03f1('0x6a')]),'FaxQueueId':Number(_0x54ec2d[_0x03f1('0x4a')]['id'])});}});}})[_0x03f1('0x2b')](respondWithStatusCode(_0x1e14a5,null))[_0x03f1('0x48')](handleError(_0x1e14a5,null));};exports['getAgents']=function(_0x287ea8,_0x2d1b16,_0x23c54c){var _0x4b9467={};var _0x18f902={};var _0x314c22;var _0x4d13fd;return db[_0x03f1('0x31')]['findOne']({'where':{'id':_0x287ea8['params']['id']}})[_0x03f1('0x2b')](handleEntityNotFound(_0x2d1b16,null))[_0x03f1('0x2b')](function(_0x416610){if(_0x416610){_0x314c22=_0x416610;_0x18f902['model']=_[_0x03f1('0x38')](db[_0x03f1('0x5d')]['rawAttributes']);_0x18f902[_0x03f1('0x37')]=_[_0x03f1('0x38')](_0x287ea8[_0x03f1('0x37')]);_0x18f902['filters']=_[_0x03f1('0x3a')](_0x18f902[_0x03f1('0x35')],_0x18f902[_0x03f1('0x37')]);_0x4b9467['attributes']=_[_0x03f1('0x3a')](_0x18f902[_0x03f1('0x35')],qs['fields'](_0x287ea8[_0x03f1('0x37')]['fields']));_0x4b9467[_0x03f1('0x3b')]=_0x4b9467[_0x03f1('0x3b')][_0x03f1('0x68')]?_0x4b9467['attributes']:_0x18f902['model'];_0x4b9467[_0x03f1('0x3f')]=qs[_0x03f1('0x40')](_0x287ea8[_0x03f1('0x37')][_0x03f1('0x40')]);_0x4b9467[_0x03f1('0x41')]=qs['filters'](_[_0x03f1('0x5b')](_0x287ea8[_0x03f1('0x37')],_0x18f902[_0x03f1('0x39')]));if(_0x287ea8['query']['filter']){_0x4b9467[_0x03f1('0x41')]=_[_0x03f1('0x43')](_0x4b9467[_0x03f1('0x41')],{'$or':_[_0x03f1('0x36')](_0x4b9467['attributes'],function(_0x1c3d93){var _0x45bed2={};_0x45bed2[_0x1c3d93]={'$like':'%'+_0x287ea8['query'][_0x03f1('0x42')]+'%'};return _0x45bed2;})});}_0x4b9467=_[_0x03f1('0x43')]({},_0x4b9467,_0x287ea8[_0x03f1('0x4b')]);return _0x314c22[_0x03f1('0x88')](_0x4b9467);}})[_0x03f1('0x2b')](function(_0x3fa405){if(_0x3fa405){_0x4d13fd=_0x3fa405[_0x03f1('0x68')];if(!_0x287ea8[_0x03f1('0x37')][_0x03f1('0x3d')](_0x03f1('0x3e'))){_0x4b9467['limit']=qs[_0x03f1('0x23')](_0x287ea8['query'][_0x03f1('0x23')]);_0x4b9467[_0x03f1('0x22')]=qs[_0x03f1('0x22')](_0x287ea8[_0x03f1('0x37')]['offset']);}return _0x314c22['getAgents'](_0x4b9467);}})[_0x03f1('0x2b')](function(_0xc98a51){if(_0xc98a51){return _0xc98a51?{'count':_0x4d13fd,'rows':_0xc98a51}:null;}})[_0x03f1('0x2b')](respondWithResult(_0x2d1b16,null))[_0x03f1('0x48')](handleError(_0x2d1b16,null));}; \ No newline at end of file +var _0x04c7=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','./faxQueue.socket','register','end','json','count','offset','limit','status','set','apply','reject','save','update','then','destroy','get','FaxQueues','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserFaxQueue','filter','User','findAndCountAll','agent','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','findOne','pick','addTeams','ids','Team','Agents','online','interface','flatMap','sequelize','transaction','each','select','field','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','emit','userFaxQueue:save','isArray','getAgents','html-pdf'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x04c7,0x8b));var _0x704c=function(_0x400b6c,_0x4a6139){_0x400b6c=_0x400b6c-0x0;var _0x4c4e3e=_0x04c7[_0x400b6c];return _0x4c4e3e;};'use strict';var pdf=require(_0x704c('0x0'));var emlformat=require(_0x704c('0x1'));var rimraf=require(_0x704c('0x2'));var zipdir=require(_0x704c('0x3'));var jsonpatch=require(_0x704c('0x4'));var rp=require(_0x704c('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x704c('0x6'));var path=require(_0x704c('0x7'));var sox=require(_0x704c('0x8'));var csv=require(_0x704c('0x9'));var ejs=require(_0x704c('0xa'));var fs=require('fs');var _=require(_0x704c('0xb'));var squel=require(_0x704c('0xc'));var crypto=require(_0x704c('0xd'));var jsforce=require(_0x704c('0xe'));var deskjs=require(_0x704c('0xf'));var toCsv=require(_0x704c('0x9'));var querystring=require(_0x704c('0x10'));var Papa=require('papaparse');var Redis=require(_0x704c('0x11'));var authService=require(_0x704c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x704c('0x13'));var hardwareService=require(_0x704c('0x14'));var logger=require(_0x704c('0x15'))('api');var utils=require(_0x704c('0x16'));var config=require(_0x704c('0x17'));var licenseUtil=require(_0x704c('0x18'));var db=require(_0x704c('0x19'))['db'];config['redis']=_[_0x704c('0x1a')](config['redis'],{'host':_0x704c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x704c('0x1c'))[_0x704c('0x1d')](socket);function respondWithStatusCode(_0x5c6157,_0x52815b){_0x52815b=_0x52815b||0xcc;return function(_0x506948){if(_0x506948){return _0x5c6157['sendStatus'](_0x52815b);}return _0x5c6157['status'](_0x52815b)[_0x704c('0x1e')]();};}function respondWithResult(_0xd21861,_0x367d9c){_0x367d9c=_0x367d9c||0xc8;return function(_0x228717){if(_0x228717){return _0xd21861['status'](_0x367d9c)[_0x704c('0x1f')](_0x228717);}};}function respondWithFilteredResult(_0xf002b,_0xe1f6c1){return function(_0x53b737){if(_0x53b737){var _0x11ff15=_0x53b737[_0x704c('0x20')],_0x573ffe=_0xe1f6c1[_0x704c('0x21')],_0x2451c3=_0xe1f6c1['offset']+_0xe1f6c1[_0x704c('0x22')],_0x1041c4;if(_0x2451c3>=_0x11ff15){_0x2451c3=_0x11ff15;_0x1041c4=0xc8;}else{_0x1041c4=0xce;}_0xf002b[_0x704c('0x23')](_0x1041c4);return _0xf002b[_0x704c('0x24')]('Content-Range',_0x573ffe+'-'+_0x2451c3+'/'+_0x11ff15)['json'](_0x53b737);}return null;};}function patchUpdates(_0x5eef5c){return function(_0x2be879){try{jsonpatch[_0x704c('0x25')](_0x2be879,_0x5eef5c,!![]);}catch(_0x128823){return BPromise[_0x704c('0x26')](_0x128823);}return _0x2be879[_0x704c('0x27')]();};}function saveUpdates(_0x5a8181,_0x1e90e8){return function(_0x312b91){if(_0x312b91){return _0x312b91[_0x704c('0x28')](_0x5a8181)[_0x704c('0x29')](function(_0x22c13b){return _0x22c13b;});}return null;};}function removeEntity(_0x3ae027,_0x4c45ff){return function(_0xa9a9fc){if(_0xa9a9fc){return _0xa9a9fc[_0x704c('0x2a')]()['then'](function(){var _0x7cbdcd=_0xa9a9fc[_0x704c('0x2b')]({'plain':!![]});var _0x234586=_0x704c('0x2c');return db['UserProfileResource'][_0x704c('0x2a')]({'where':{'type':_0x234586,'resourceId':_0x7cbdcd['id']}})[_0x704c('0x29')](function(){return _0xa9a9fc;});})[_0x704c('0x29')](function(){_0x3ae027[_0x704c('0x23')](0xcc)[_0x704c('0x1e')]();});}};}function handleEntityNotFound(_0x31f363,_0x1018c8){return function(_0x428c5c){if(!_0x428c5c){_0x31f363['sendStatus'](0x194);}return _0x428c5c;};}function handleError(_0xd7a0c2,_0x4eee79){_0x4eee79=_0x4eee79||0x1f4;return function(_0x5a779a){logger[_0x704c('0x2d')](_0x5a779a[_0x704c('0x2e')]);if(_0x5a779a['name']){delete _0x5a779a[_0x704c('0x2f')];}_0xd7a0c2[_0x704c('0x23')](_0x4eee79)[_0x704c('0x30')](_0x5a779a);};}exports[_0x704c('0x31')]=function(_0x44c7ab,_0x3d4ead){var _0x2b9673={},_0x42de48={},_0x18cb33={'count':0x0,'rows':[]};var _0x4db536=_['map'](db[_0x704c('0x32')][_0x704c('0x33')],function(_0x55675e){return{'name':_0x55675e[_0x704c('0x34')],'type':_0x55675e[_0x704c('0x35')][_0x704c('0x36')]};});_0x42de48[_0x704c('0x37')]=_['map'](_0x4db536,'name');_0x42de48['query']=_[_0x704c('0x38')](_0x44c7ab[_0x704c('0x39')]);_0x42de48[_0x704c('0x3a')]=_['intersection'](_0x42de48[_0x704c('0x37')],_0x42de48[_0x704c('0x39')]);_0x2b9673[_0x704c('0x3b')]=_[_0x704c('0x3c')](_0x42de48[_0x704c('0x37')],qs[_0x704c('0x3d')](_0x44c7ab[_0x704c('0x39')][_0x704c('0x3d')]));_0x2b9673[_0x704c('0x3b')]=_0x2b9673[_0x704c('0x3b')]['length']?_0x2b9673[_0x704c('0x3b')]:_0x42de48[_0x704c('0x37')];if(!_0x44c7ab[_0x704c('0x39')][_0x704c('0x3e')](_0x704c('0x3f'))){_0x2b9673[_0x704c('0x22')]=qs[_0x704c('0x22')](_0x44c7ab['query'][_0x704c('0x22')]);_0x2b9673[_0x704c('0x21')]=qs[_0x704c('0x21')](_0x44c7ab['query'][_0x704c('0x21')]);}_0x2b9673[_0x704c('0x40')]=qs[_0x704c('0x41')](_0x44c7ab[_0x704c('0x39')][_0x704c('0x41')]);_0x2b9673[_0x704c('0x42')]=qs[_0x704c('0x3a')](_['pick'](_0x44c7ab[_0x704c('0x39')],_0x42de48[_0x704c('0x3a')]),_0x4db536);if(_0x44c7ab['query']['filter']){_0x2b9673['where']=_[_0x704c('0x43')](_0x2b9673['where'],{'$or':_[_0x704c('0x44')](_0x4db536,function(_0xf2e64c){if(_0xf2e64c[_0x704c('0x35')]!==_0x704c('0x45')){var _0x3a51db={};_0x3a51db[_0xf2e64c['name']]={'$like':'%'+_0x44c7ab[_0x704c('0x39')]['filter']+'%'};return _0x3a51db;}})});}_0x2b9673=_['merge']({},_0x2b9673,_0x44c7ab['options']);var _0x287faa={'where':_0x2b9673[_0x704c('0x42')]};return db[_0x704c('0x32')][_0x704c('0x20')](_0x287faa)['then'](function(_0x34e046){_0x18cb33[_0x704c('0x20')]=_0x34e046;if(_0x44c7ab[_0x704c('0x39')][_0x704c('0x46')]){_0x2b9673[_0x704c('0x47')]=[{'all':!![]}];}return db[_0x704c('0x32')][_0x704c('0x48')](_0x2b9673);})[_0x704c('0x29')](function(_0x3e9443){_0x18cb33[_0x704c('0x49')]=_0x3e9443;return _0x18cb33;})[_0x704c('0x29')](respondWithFilteredResult(_0x3d4ead,_0x2b9673))[_0x704c('0x4a')](handleError(_0x3d4ead,null));};exports['show']=function(_0x157b14,_0xa544f2){var _0x18ac73={'raw':!![],'where':{'id':_0x157b14[_0x704c('0x4b')]['id']}},_0x1bd516={};_0x1bd516[_0x704c('0x37')]=_[_0x704c('0x38')](db['FaxQueue'][_0x704c('0x33')]);_0x1bd516[_0x704c('0x39')]=_[_0x704c('0x38')](_0x157b14[_0x704c('0x39')]);_0x1bd516[_0x704c('0x3a')]=_[_0x704c('0x3c')](_0x1bd516['model'],_0x1bd516[_0x704c('0x39')]);_0x18ac73['attributes']=_[_0x704c('0x3c')](_0x1bd516[_0x704c('0x37')],qs[_0x704c('0x3d')](_0x157b14[_0x704c('0x39')][_0x704c('0x3d')]));_0x18ac73[_0x704c('0x3b')]=_0x18ac73[_0x704c('0x3b')][_0x704c('0x4c')]?_0x18ac73['attributes']:_0x1bd516[_0x704c('0x37')];if(_0x157b14[_0x704c('0x39')][_0x704c('0x46')]){_0x18ac73[_0x704c('0x47')]=[{'all':!![]}];}_0x18ac73=_[_0x704c('0x43')]({},_0x18ac73,_0x157b14[_0x704c('0x4d')]);return db['FaxQueue'][_0x704c('0x4e')](_0x18ac73)['then'](handleEntityNotFound(_0xa544f2,null))[_0x704c('0x29')](respondWithResult(_0xa544f2,null))[_0x704c('0x4a')](handleError(_0xa544f2,null));};exports[_0x704c('0x4f')]=function(_0x5b03c1,_0x39c15b){return db[_0x704c('0x32')][_0x704c('0x4f')](_0x5b03c1[_0x704c('0x50')],{})[_0x704c('0x29')](function(_0x25f5d1){var _0x5eb881=_0x5b03c1[_0x704c('0x51')]['get']({'plain':!![]});if(!_0x5eb881)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5eb881[_0x704c('0x52')]==='user'){var _0x1c1055=_0x25f5d1[_0x704c('0x2b')]({'plain':!![]});var _0x32fb7f=_0x704c('0x2c');return db[_0x704c('0x53')][_0x704c('0x4e')]({'where':{'name':_0x32fb7f,'userProfileId':_0x5eb881[_0x704c('0x54')]},'raw':!![]})['then'](function(_0x9c0452){if(_0x9c0452&&_0x9c0452[_0x704c('0x55')]===0x0){return db['UserProfileResource'][_0x704c('0x4f')]({'name':_0x1c1055[_0x704c('0x2f')],'resourceId':_0x1c1055['id'],'type':_0x9c0452[_0x704c('0x2f')],'sectionId':_0x9c0452['id']},{})[_0x704c('0x29')](function(){return _0x25f5d1;});}else{return _0x25f5d1;}})[_0x704c('0x4a')](function(_0x3dcc18){logger[_0x704c('0x2d')](_0x704c('0x56'),_0x3dcc18);throw _0x3dcc18;});}return _0x25f5d1;})[_0x704c('0x29')](respondWithResult(_0x39c15b,0xc9))[_0x704c('0x4a')](handleError(_0x39c15b,null));};exports['update']=function(_0x3ad891,_0x4229a9){if(_0x3ad891['body']['id']){delete _0x3ad891[_0x704c('0x50')]['id'];}return db[_0x704c('0x32')][_0x704c('0x4e')]({'where':{'id':_0x3ad891[_0x704c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4229a9,null))[_0x704c('0x29')](saveUpdates(_0x3ad891[_0x704c('0x50')],null))[_0x704c('0x29')](respondWithResult(_0x4229a9,null))[_0x704c('0x4a')](handleError(_0x4229a9,null));};exports[_0x704c('0x2a')]=function(_0x4a8448,_0x36e52d){return db['FaxQueue'][_0x704c('0x4e')]({'where':{'id':_0x4a8448[_0x704c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36e52d,null))[_0x704c('0x29')](removeEntity(_0x36e52d,null))['catch'](handleError(_0x36e52d,null));};exports['describe']=function(_0x55a450,_0x144c35){return db['FaxQueue'][_0x704c('0x57')]()[_0x704c('0x29')](respondWithResult(_0x144c35,null))[_0x704c('0x4a')](handleError(_0x144c35,null));};exports[_0x704c('0x58')]=function(_0x463027,_0x3c5263,_0x374676){var _0x2ae6bf={'raw':!![],'where':{}},_0x3d893b={},_0x48d16e;return db[_0x704c('0x32')]['findOne']({'where':{'id':_0x463027['params']['id']}})[_0x704c('0x29')](handleEntityNotFound(_0x3c5263,null))[_0x704c('0x29')](function(_0x358888){if(_0x358888){_0x48d16e=_0x358888[_0x704c('0x2b')]({'plain':!![]});_0x3d893b[_0x704c('0x37')]=_[_0x704c('0x38')](db[_0x704c('0x59')]['rawAttributes']);_0x3d893b[_0x704c('0x39')]=_[_0x704c('0x38')](_0x463027[_0x704c('0x39')]);_0x3d893b[_0x704c('0x3a')]=_[_0x704c('0x3c')](_0x3d893b[_0x704c('0x37')],_0x3d893b['query']);_0x2ae6bf[_0x704c('0x3b')]=_[_0x704c('0x3c')](_0x3d893b[_0x704c('0x37')],qs[_0x704c('0x3d')](_0x463027[_0x704c('0x39')]['fields']));_0x2ae6bf['attributes']=_0x2ae6bf[_0x704c('0x3b')][_0x704c('0x4c')]?_0x2ae6bf[_0x704c('0x3b')]:_0x3d893b[_0x704c('0x37')];if(!_0x463027[_0x704c('0x39')]['hasOwnProperty']('nolimit')){_0x2ae6bf[_0x704c('0x22')]=qs['limit'](_0x463027[_0x704c('0x39')][_0x704c('0x22')]);_0x2ae6bf[_0x704c('0x21')]=qs[_0x704c('0x21')](_0x463027[_0x704c('0x39')][_0x704c('0x21')]);}_0x2ae6bf[_0x704c('0x40')]=qs[_0x704c('0x41')](_0x463027[_0x704c('0x39')][_0x704c('0x41')]);_0x2ae6bf[_0x704c('0x42')]=qs[_0x704c('0x3a')](_['pick'](_0x463027[_0x704c('0x39')],_0x3d893b[_0x704c('0x3a')]));_0x2ae6bf[_0x704c('0x42')]['FaxQueueId']=_0x358888['id'];if(_0x463027[_0x704c('0x39')]['filter']){_0x2ae6bf['where']=_['merge'](_0x2ae6bf[_0x704c('0x42')],{'$or':_['map'](_0x2ae6bf[_0x704c('0x3b')],function(_0x32759a){var _0x3b9dcd={};_0x3b9dcd[_0x32759a]={'$like':'%'+_0x463027['query'][_0x704c('0x5a')]+'%'};return _0x3b9dcd;})});}_0x2ae6bf=_[_0x704c('0x43')]({},_0x2ae6bf,_0x463027[_0x704c('0x4d')]);return db['UserFaxQueue'][_0x704c('0x48')](_0x2ae6bf);}})[_0x704c('0x29')](function(_0x56bc46){if(_0x56bc46){return db[_0x704c('0x5b')][_0x704c('0x5c')]({'where':{'id':_[_0x704c('0x44')](_0x56bc46,'UserId'),'role':_0x704c('0x5d')},'attributes':['id',_0x704c('0x2f'),_0x704c('0x5e'),_0x704c('0x5f'),'createdAt']});}})['then'](function(_0xc209fe){if(_0xc209fe){return{'count':_0xc209fe[_0x704c('0x20')],'rows':_[_0x704c('0x44')](_0xc209fe[_0x704c('0x49')],function(_0xaf8d44){return{'membername':_0xaf8d44['name'],'UserId':_0xaf8d44['id'],'queue_name':_0x48d16e[_0x704c('0x2f')],'FaxQueueId':_0x48d16e['id'],'interface':util[_0x704c('0x60')](_0x704c('0x61'),_0x704c('0x62'),_0xaf8d44['name']),'penalty':0x0,'paused':_0xaf8d44[_0x704c('0x5e')],'createdAt':_0xaf8d44[_0x704c('0x63')],'updatedAt':_0xaf8d44['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3c5263,_0x2ae6bf))[_0x704c('0x4a')](handleError(_0x3c5263,null));};exports[_0x704c('0x64')]=function(_0x1f5778,_0x5a5a77,_0x38a2fb){var _0x1280d4={};var _0x4aac89={};var _0x3950d4;var _0x4e88d9;return db[_0x704c('0x32')][_0x704c('0x65')]({'where':{'id':_0x1f5778[_0x704c('0x4b')]['id']}})[_0x704c('0x29')](handleEntityNotFound(_0x5a5a77,null))['then'](function(_0x5901c9){if(_0x5901c9){_0x3950d4=_0x5901c9;_0x4aac89['model']=_[_0x704c('0x38')](db['Team'][_0x704c('0x33')]);_0x4aac89[_0x704c('0x39')]=_['keys'](_0x1f5778['query']);_0x4aac89['filters']=_['intersection'](_0x4aac89['model'],_0x4aac89[_0x704c('0x39')]);_0x1280d4[_0x704c('0x3b')]=_[_0x704c('0x3c')](_0x4aac89[_0x704c('0x37')],qs['fields'](_0x1f5778[_0x704c('0x39')][_0x704c('0x3d')]));_0x1280d4[_0x704c('0x3b')]=_0x1280d4[_0x704c('0x3b')][_0x704c('0x4c')]?_0x1280d4[_0x704c('0x3b')]:_0x4aac89[_0x704c('0x37')];_0x1280d4[_0x704c('0x40')]=qs[_0x704c('0x41')](_0x1f5778[_0x704c('0x39')][_0x704c('0x41')]);_0x1280d4[_0x704c('0x42')]=qs[_0x704c('0x3a')](_[_0x704c('0x66')](_0x1f5778[_0x704c('0x39')],_0x4aac89['filters']));if(_0x1f5778[_0x704c('0x39')]['filter']){_0x1280d4[_0x704c('0x42')]=_[_0x704c('0x43')](_0x1280d4[_0x704c('0x42')],{'$or':_[_0x704c('0x44')](_0x1280d4['attributes'],function(_0x542145){var _0x251ac3={};_0x251ac3[_0x542145]={'$like':'%'+_0x1f5778[_0x704c('0x39')][_0x704c('0x5a')]+'%'};return _0x251ac3;})});}_0x1280d4=_[_0x704c('0x43')]({},_0x1280d4,_0x1f5778[_0x704c('0x4d')]);return _0x3950d4[_0x704c('0x64')](_0x1280d4);}})[_0x704c('0x29')](function(_0x5000d1){if(_0x5000d1){_0x4e88d9=_0x5000d1[_0x704c('0x4c')];if(!_0x1f5778[_0x704c('0x39')][_0x704c('0x3e')]('nolimit')){_0x1280d4[_0x704c('0x22')]=qs[_0x704c('0x22')](_0x1f5778[_0x704c('0x39')][_0x704c('0x22')]);_0x1280d4[_0x704c('0x21')]=qs[_0x704c('0x21')](_0x1f5778[_0x704c('0x39')][_0x704c('0x21')]);}return _0x3950d4[_0x704c('0x64')](_0x1280d4);}})['then'](function(_0xda5651){if(_0xda5651){return _0xda5651?{'count':_0x4e88d9,'rows':_0xda5651}:null;}})['then'](respondWithResult(_0x5a5a77,null))[_0x704c('0x4a')](handleError(_0x5a5a77,null));};exports[_0x704c('0x67')]=function(_0x3dab1f,_0x6574a0,_0x779eec){var _0x20d127=_0x3dab1f[_0x704c('0x50')][_0x704c('0x68')];return db[_0x704c('0x69')][_0x704c('0x48')]({'where':{'id':_0x20d127},'attributes':['id'],'include':[{'model':db['User'],'as':_0x704c('0x6a'),'attributes':['id','name',_0x704c('0x6b'),'voicePause',_0x704c('0x6c')],'raw':!![]}]})[_0x704c('0x29')](function(_0x2f8d15){if(_0x2f8d15){var _0x1cab04=_[_0x704c('0x6d')](_0x2f8d15,function(_0x59eab3){var _0x3796d8=_0x59eab3[_0x704c('0x2b')]({'plain':!![]});return _0x3796d8[_0x704c('0x6a')];});return db[_0x704c('0x32')]['find']({'where':{'id':_0x3dab1f[_0x704c('0x4b')]['id']}})[_0x704c('0x29')](function(_0x44f5d1){return db[_0x704c('0x6e')][_0x704c('0x6f')](function(_0x38fb08){return _0x44f5d1['addTeams'](_0x20d127,{'transaction':_0x38fb08})[_0x704c('0x29')](function(){return BPromise[_0x704c('0x70')](_0x1cab04,function(_0x2062a0){return db[_0x704c('0x59')]['findOrCreate']({'where':{'UserId':_0x2062a0['id'],'FaxQueueId':_0x3dab1f[_0x704c('0x4b')]['id']},'transaction':_0x38fb08});});})[_0x704c('0x29')](function(){_0x1cab04['forEach'](function(_0x20ab09){socket['emit']('userFaxQueue:save',{'UserId':_0x20ab09['id'],'FaxQueueId':_0x44f5d1['id']});});});});});}})[_0x704c('0x29')](respondWithStatusCode(_0x6574a0,null))[_0x704c('0x4a')](handleError(_0x6574a0,null));};exports['removeTeams']=function(_0x38ed79,_0x4360c2,_0x3d4f63){return db[_0x704c('0x69')][_0x704c('0x48')]({'where':{'id':_0x38ed79['query'][_0x704c('0x68')]},'attributes':['id'],'include':[{'model':db[_0x704c('0x5b')],'as':_0x704c('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x704c('0x29')](handleEntityNotFound(_0x4360c2,null))['then'](function(_0x9cde7b){var _0x1b7de1=_[_0x704c('0x44')](_0x9cde7b,'id');var _0x49f6e8=[];var _0xca7edc=[];var _0x5ed385=squel[_0x704c('0x71')]();_0x5ed385[_0x704c('0x72')]('tq.TeamId')['from']('team_has_fax_queues','tq')['join'](_0x704c('0x73'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x704c('0x42')](_0x704c('0x74'),_0x38ed79[_0x704c('0x4b')]['id']);for(var _0x422e8a=0x0;_0x422e8a<_0x9cde7b[_0x704c('0x4c')];_0x422e8a+=0x1){let _0x42f5f0=_0x9cde7b[_0x422e8a];for(var _0x16326b=0x0;_0x16326b<_0x42f5f0[_0x704c('0x6a')][_0x704c('0x4c')];_0x16326b+=0x1){let _0x5f25d8=_0x42f5f0['Agents'][_0x16326b];var _0x17a398=_0x5ed385['clone']();_0x17a398[_0x704c('0x42')](_0x704c('0x75'),_0x5f25d8['id']);_0xca7edc[_0x704c('0x76')](db['sequelize'][_0x704c('0x39')](_0x17a398[_0x704c('0x77')](),{'type':db[_0x704c('0x6e')][_0x704c('0x78')][_0x704c('0x79')]})[_0x704c('0x29')](function(_0x3d2584){if(_0x3d2584[_0x704c('0x4c')]===0x1){return _0x5f25d8['id'];}else{var _0xbe470e=_[_0x704c('0x7a')](_[_0x704c('0x44')](_0x3d2584,_0x704c('0x7b')),function(_0x52aead){return _[_0x704c('0x7c')](_0x1b7de1,_0x52aead);});if(_0xbe470e){return _0x5f25d8['id'];}}}));}}return BPromise[_0x704c('0x7d')](_0xca7edc)[_0x704c('0x29')](function(_0x4a65f0){_0x49f6e8=_(_0x49f6e8)[_0x704c('0x7e')](_0x4a65f0)[_0x704c('0x7f')]()[_0x704c('0x80')]();return db[_0x704c('0x32')][_0x704c('0x4e')]({'where':{'id':_0x38ed79['params']['id']}})[_0x704c('0x29')](function(_0x42d56b){return db[_0x704c('0x6e')][_0x704c('0x6f')](function(_0x430001){return _0x42d56b['removeTeams'](_0x38ed79[_0x704c('0x39')][_0x704c('0x68')],{'transaction':_0x430001})[_0x704c('0x29')](function(){if(!_[_0x704c('0x81')](_0x49f6e8)){return _0x42d56b[_0x704c('0x82')](_0x49f6e8,{'transaction':_0x430001});}})[_0x704c('0x29')](function(){_0x49f6e8[_0x704c('0x83')](function(_0x5390dd){socket['emit'](_0x704c('0x84'),{'UserId':_0x5390dd,'FaxQueueId':_0x42d56b['id']});});});});});});})[_0x704c('0x29')](respondWithStatusCode(_0x4360c2,null))[_0x704c('0x4a')](handleError(_0x4360c2,null));};exports[_0x704c('0x85')]=function(_0x4711de,_0x1c44fe,_0x25ee90){return db[_0x704c('0x32')][_0x704c('0x4e')]({'where':{'id':_0x4711de[_0x704c('0x4b')]['id']}})[_0x704c('0x29')](handleEntityNotFound(_0x1c44fe,null))[_0x704c('0x29')](function(_0x532ef8){if(_0x532ef8){return _0x532ef8[_0x704c('0x85')](_0x4711de[_0x704c('0x50')]['ids'],_[_0x704c('0x86')](_0x4711de[_0x704c('0x50')],[_0x704c('0x68'),'id'])||{})[_0x704c('0x87')](function(_0x45d8cf){for(var _0x279793=0x0;_0x279793<_0x4711de[_0x704c('0x50')]['ids'][_0x704c('0x4c')];_0x279793+=0x1){socket[_0x704c('0x88')](_0x704c('0x89'),{'UserId':_0x4711de['body'][_0x704c('0x68')][_0x279793],'FaxQueueId':_0x4711de[_0x704c('0x4b')]['id']});}return _0x45d8cf;});}})[_0x704c('0x29')](respondWithResult(_0x1c44fe,null))['catch'](handleError(_0x1c44fe,null));};exports['removeAgents']=function(_0x22cef7,_0x311cbb,_0x3c4fed){return db[_0x704c('0x32')]['find']({'where':{'id':_0x22cef7[_0x704c('0x4b')]['id']}})[_0x704c('0x29')](handleEntityNotFound(_0x311cbb,null))[_0x704c('0x29')](function(_0x283021){if(_0x283021){return _0x283021['removeAgents'](_0x22cef7[_0x704c('0x39')]['ids'])['then'](function(){if(_[_0x704c('0x8a')](_0x22cef7[_0x704c('0x39')][_0x704c('0x68')])){for(var _0x26b3c3=0x0;_0x26b3c3<_0x22cef7['query'][_0x704c('0x68')]['length'];_0x26b3c3+=0x1){socket[_0x704c('0x88')](_0x704c('0x84'),{'UserId':Number(_0x22cef7[_0x704c('0x39')]['ids'][_0x26b3c3]),'FaxQueueId':Number(_0x22cef7['params']['id'])});}}else{socket[_0x704c('0x88')](_0x704c('0x84'),{'UserId':Number(_0x22cef7[_0x704c('0x39')][_0x704c('0x68')]),'FaxQueueId':Number(_0x22cef7[_0x704c('0x4b')]['id'])});}});}})[_0x704c('0x29')](respondWithStatusCode(_0x311cbb,null))[_0x704c('0x4a')](handleError(_0x311cbb,null));};exports[_0x704c('0x8b')]=function(_0x10a566,_0x105e4f,_0x2e7b56){var _0x197cb6={};var _0x333397={};var _0xd4df16;var _0x41cb78;return db[_0x704c('0x32')][_0x704c('0x65')]({'where':{'id':_0x10a566['params']['id']}})[_0x704c('0x29')](handleEntityNotFound(_0x105e4f,null))['then'](function(_0x17ee06){if(_0x17ee06){_0xd4df16=_0x17ee06;_0x333397['model']=_[_0x704c('0x38')](db[_0x704c('0x5b')][_0x704c('0x33')]);_0x333397[_0x704c('0x39')]=_['keys'](_0x10a566[_0x704c('0x39')]);_0x333397['filters']=_[_0x704c('0x3c')](_0x333397['model'],_0x333397[_0x704c('0x39')]);_0x197cb6[_0x704c('0x3b')]=_[_0x704c('0x3c')](_0x333397[_0x704c('0x37')],qs[_0x704c('0x3d')](_0x10a566[_0x704c('0x39')]['fields']));_0x197cb6[_0x704c('0x3b')]=_0x197cb6[_0x704c('0x3b')][_0x704c('0x4c')]?_0x197cb6[_0x704c('0x3b')]:_0x333397[_0x704c('0x37')];_0x197cb6[_0x704c('0x40')]=qs[_0x704c('0x41')](_0x10a566['query'][_0x704c('0x41')]);_0x197cb6['where']=qs['filters'](_[_0x704c('0x66')](_0x10a566[_0x704c('0x39')],_0x333397['filters']));if(_0x10a566['query'][_0x704c('0x5a')]){_0x197cb6[_0x704c('0x42')]=_[_0x704c('0x43')](_0x197cb6[_0x704c('0x42')],{'$or':_[_0x704c('0x44')](_0x197cb6['attributes'],function(_0x84d441){var _0x2ac0e6={};_0x2ac0e6[_0x84d441]={'$like':'%'+_0x10a566['query'][_0x704c('0x5a')]+'%'};return _0x2ac0e6;})});}_0x197cb6=_[_0x704c('0x43')]({},_0x197cb6,_0x10a566['options']);return _0xd4df16['getAgents'](_0x197cb6);}})[_0x704c('0x29')](function(_0x19e20c){if(_0x19e20c){_0x41cb78=_0x19e20c[_0x704c('0x4c')];if(!_0x10a566['query'][_0x704c('0x3e')](_0x704c('0x3f'))){_0x197cb6[_0x704c('0x22')]=qs['limit'](_0x10a566[_0x704c('0x39')][_0x704c('0x22')]);_0x197cb6[_0x704c('0x21')]=qs['offset'](_0x10a566['query'][_0x704c('0x21')]);}return _0xd4df16[_0x704c('0x8b')](_0x197cb6);}})[_0x704c('0x29')](function(_0x31044a){if(_0x31044a){return _0x31044a?{'count':_0x41cb78,'rows':_0x31044a}:null;}})[_0x704c('0x29')](respondWithResult(_0x105e4f,null))[_0x704c('0x4a')](handleError(_0x105e4f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index fc53381..a0ad503 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 _0xc3d8=['events','FaxQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports'];(function(_0x29025c,_0x173622){var _0x356940=function(_0x39f671){while(--_0x39f671){_0x29025c['push'](_0x29025c['shift']());}};_0x356940(++_0x173622);}(_0xc3d8,0xe8));var _0x8c3d=function(_0x3f48ec,_0x10c70e){_0x3f48ec=_0x3f48ec-0x0;var _0x106952=_0xc3d8[_0x3f48ec];return _0x106952;};'use strict';var EventEmitter=require(_0x8c3d('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x8c3d('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8c3d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8c3d('0x3')};function emitEvent(_0x3c5396){return function(_0x506965,_0x27635a,_0x3245fc){FaxQueueEvents[_0x8c3d('0x4')](_0x3c5396+':'+_0x506965['id'],_0x506965);FaxQueueEvents[_0x8c3d('0x4')](_0x3c5396,_0x506965);_0x3245fc(null);};}for(var e in events){if(events[_0x8c3d('0x5')](e)){var event=events[e];FaxQueue[_0x8c3d('0x6')](e,emitEvent(event));}}module[_0x8c3d('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x1218=['../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','exports'];(function(_0x17d4e5,_0x311e0b){var _0x333578=function(_0x7608e4){while(--_0x7608e4){_0x17d4e5['push'](_0x17d4e5['shift']());}};_0x333578(++_0x311e0b);}(_0x1218,0xc4));var _0x8121=function(_0x4785ec,_0x2b0162){_0x4785ec=_0x4785ec-0x0;var _0x17ddb6=_0x1218[_0x4785ec];return _0x17ddb6;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x8121('0x0'))['db'][_0x8121('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8121('0x2')](0x0);var events={'afterCreate':_0x8121('0x3'),'afterUpdate':_0x8121('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2de103){return function(_0x4e811b,_0x1b19f1,_0x489d13){FaxQueueEvents[_0x8121('0x5')](_0x2de103+':'+_0x4e811b['id'],_0x4e811b);FaxQueueEvents['emit'](_0x2de103,_0x4e811b);_0x489d13(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x8121('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index c0a5c05..7cc3f45 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 _0x5294=['../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5294,0xa1));var _0x4529=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x5294[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var logger=require(_0x4529('0x2'))(_0x4529('0x3'));var moment=require('moment');var BPromise=require(_0x4529('0x4'));var rp=require(_0x4529('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4529('0x6'));var config=require(_0x4529('0x7'));var attributes=require(_0x4529('0x8'));module['exports']=function(_0x3ae779,_0x50155f){return _0x3ae779[_0x4529('0x9')](_0x4529('0xa'),attributes,{'tableName':_0x4529('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdf7=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','fax_queues','lodash'];(function(_0x401555,_0x10e496){var _0x36f3e0=function(_0xbddb00){while(--_0xbddb00){_0x401555['push'](_0x401555['shift']());}};_0x36f3e0(++_0x10e496);}(_0xfdf7,0x1cd));var _0x7fdf=function(_0x823a0b,_0x5824ff){_0x823a0b=_0x823a0b-0x0;var _0x162120=_0xfdf7[_0x823a0b];return _0x162120;};'use strict';var _=require(_0x7fdf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7fdf('0x1'));var moment=require(_0x7fdf('0x2'));var BPromise=require(_0x7fdf('0x3'));var rp=require(_0x7fdf('0x4'));var fs=require('fs');var path=require(_0x7fdf('0x5'));var rimraf=require(_0x7fdf('0x6'));var config=require(_0x7fdf('0x7'));var attributes=require(_0x7fdf('0x8'));module[_0x7fdf('0x9')]=function(_0x2c601f,_0x8a7c8c){return _0x2c601f['define']('FaxQueue',attributes,{'tableName':_0x7fdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ad4923a..01f4ec5 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 _0x8fb4=['request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','catch','ShowFaxQueue','where','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','redis','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x8fb4,0xd2));var _0x48fb=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8fb4[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x48fb('0x0'));var util=require(_0x48fb('0x1'));var moment=require(_0x48fb('0x2'));var BPromise=require(_0x48fb('0x3'));var rs=require(_0x48fb('0x4'));var fs=require('fs');var Redis=require(_0x48fb('0x5'));var db=require(_0x48fb('0x6'))['db'];var utils=require(_0x48fb('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x48fb('0x8'));var client=jayson['client'][_0x48fb('0x9')]({'port':0x232a});config[_0x48fb('0xa')]=_['defaults'](config[_0x48fb('0xa')],{'host':_0x48fb('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x48fb('0xc'))[_0x48fb('0xd')](socket);function respondWithRpcPromise(_0x96b9d1,_0xd13a02,_0x5b6c11){return new BPromise(function(_0x1e410a,_0x8f98e2){return client[_0x48fb('0xe')](_0x96b9d1,_0x5b6c11)[_0x48fb('0xf')](function(_0x15d373){logger[_0x48fb('0x10')](_0x48fb('0x11'),_0xd13a02,_0x48fb('0x12'));logger['debug'](_0x48fb('0x13'),_0xd13a02,_0x48fb('0x12'),JSON[_0x48fb('0x14')](_0x15d373));if(_0x15d373[_0x48fb('0x15')]){if(_0x15d373[_0x48fb('0x15')]['code']===0x1f4){logger[_0x48fb('0x15')](_0x48fb('0x11'),_0xd13a02,_0x15d373[_0x48fb('0x15')]['message']);return _0x8f98e2(_0x15d373[_0x48fb('0x15')][_0x48fb('0x16')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0xd13a02,_0x15d373['error'][_0x48fb('0x16')]);return _0x1e410a(_0x15d373[_0x48fb('0x15')]['message']);}else{logger[_0x48fb('0x10')]('FaxQueue,\x20%s,\x20%s',_0xd13a02,_0x48fb('0x12'));_0x1e410a(_0x15d373[_0x48fb('0x17')]['message']);}})['catch'](function(_0x4ea37e){logger['error'](_0x48fb('0x11'),_0xd13a02,_0x4ea37e);_0x8f98e2(_0x4ea37e);});});}exports[_0x48fb('0x18')]=function(_0x53a02c){var _0x1a7cc4=this;return new Promise(function(_0x190aa1,_0xf57b69){return db[_0x48fb('0x19')][_0x48fb('0x1a')]({'raw':_0x53a02c[_0x48fb('0x1b')]?_0x53a02c[_0x48fb('0x1b')][_0x48fb('0x1c')]===undefined?!![]:![]:!![],'where':_0x53a02c[_0x48fb('0x1b')]?_0x53a02c[_0x48fb('0x1b')]['where']||null:null,'attributes':_0x53a02c['options']?_0x53a02c[_0x48fb('0x1b')][_0x48fb('0x1d')]||null:null,'limit':_0x53a02c[_0x48fb('0x1b')]?_0x53a02c[_0x48fb('0x1b')][_0x48fb('0x1e')]||null:null,'include':_0x53a02c[_0x48fb('0x1b')]?_0x53a02c[_0x48fb('0x1b')][_0x48fb('0x1f')]?_[_0x48fb('0x20')](_0x53a02c['options'][_0x48fb('0x1f')],function(_0x3c0349){return{'model':db[_0x3c0349[_0x48fb('0x21')]],'as':_0x3c0349['as'],'attributes':_0x3c0349[_0x48fb('0x1d')],'include':_0x3c0349['include']?_[_0x48fb('0x20')](_0x3c0349[_0x48fb('0x1f')],function(_0x452c4b){return{'model':db[_0x452c4b[_0x48fb('0x21')]],'as':_0x452c4b['as'],'attributes':_0x452c4b[_0x48fb('0x1d')],'include':_0x452c4b[_0x48fb('0x1f')]?_[_0x48fb('0x20')](_0x452c4b['include'],function(_0x2a626c){return{'model':db[_0x2a626c[_0x48fb('0x21')]],'as':_0x2a626c['as'],'attributes':_0x2a626c[_0x48fb('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bc9b8){logger[_0x48fb('0x10')](_0x48fb('0x18'),_0x53a02c);logger['debug'](_0x48fb('0x18'),_0x53a02c,JSON[_0x48fb('0x14')](_0x1bc9b8));_0x190aa1(_0x1bc9b8);})[_0x48fb('0x22')](function(_0x13a00d){logger[_0x48fb('0x15')](_0x48fb('0x18'),_0x13a00d[_0x48fb('0x16')],_0x53a02c);_0xf57b69(_0x1a7cc4[_0x48fb('0x15')](0x1f4,_0x13a00d[_0x48fb('0x16')]));});});};exports[_0x48fb('0x23')]=function(_0x3c3781){var _0x30c497=this;return new Promise(function(_0x5c26e3,_0x3691b4){return db[_0x48fb('0x19')]['find']({'raw':_0x3c3781[_0x48fb('0x1b')]?_0x3c3781[_0x48fb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3c3781[_0x48fb('0x1b')]?_0x3c3781[_0x48fb('0x1b')][_0x48fb('0x24')]||null:null,'attributes':_0x3c3781[_0x48fb('0x1b')]?_0x3c3781[_0x48fb('0x1b')][_0x48fb('0x1d')]||null:null,'include':_0x3c3781[_0x48fb('0x1b')]?_0x3c3781[_0x48fb('0x1b')][_0x48fb('0x1f')]?_[_0x48fb('0x20')](_0x3c3781[_0x48fb('0x1b')][_0x48fb('0x1f')],function(_0xad19f9){return{'model':db[_0xad19f9[_0x48fb('0x21')]],'as':_0xad19f9['as'],'attributes':_0xad19f9[_0x48fb('0x1d')],'include':_0xad19f9[_0x48fb('0x1f')]?_[_0x48fb('0x20')](_0xad19f9[_0x48fb('0x1f')],function(_0x57606b){return{'model':db[_0x57606b[_0x48fb('0x21')]],'as':_0x57606b['as'],'attributes':_0x57606b[_0x48fb('0x1d')],'include':_0x57606b[_0x48fb('0x1f')]?_[_0x48fb('0x20')](_0x57606b[_0x48fb('0x1f')],function(_0x2e7ee5){return{'model':db[_0x2e7ee5['model']],'as':_0x2e7ee5['as'],'attributes':_0x2e7ee5[_0x48fb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x48fb('0xf')](function(_0x4936dc){logger[_0x48fb('0x10')](_0x48fb('0x23'),_0x3c3781);logger[_0x48fb('0x25')](_0x48fb('0x23'),_0x3c3781,JSON['stringify'](_0x4936dc));_0x5c26e3(_0x4936dc);})['catch'](function(_0x23aace){logger[_0x48fb('0x15')]('ShowFaxQueue',_0x23aace[_0x48fb('0x16')],_0x3c3781);_0x3691b4(_0x30c497['error'](0x1f4,_0x23aace[_0x48fb('0x16')]));});});}; \ No newline at end of file +var _0x52bc=['include','model','then','ShowFaxQueue','find','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','redis','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x52bc,0x177));var _0xc52b=function(_0x281564,_0x5e8675){_0x281564=_0x281564-0x0;var _0x4e556d=_0x52bc[_0x281564];return _0x4e556d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc52b('0x0'));var BPromise=require(_0xc52b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc52b('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xc52b('0x3'))(_0xc52b('0x4'));var config=require(_0xc52b('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc52b('0x6')][_0xc52b('0x7')]({'port':0x232a});config['redis']=_[_0xc52b('0x8')](config['redis'],{'host':_0xc52b('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc52b('0xa')]));require('./faxQueue.socket')[_0xc52b('0xb')](socket);function respondWithRpcPromise(_0xc4db5a,_0x349e7e,_0x2921bd){return new BPromise(function(_0x11eaef,_0x5ba9d9){return client[_0xc52b('0xc')](_0xc4db5a,_0x2921bd)['then'](function(_0x7de81){logger[_0xc52b('0xd')](_0xc52b('0xe'),_0x349e7e,_0xc52b('0xf'));logger[_0xc52b('0x10')](_0xc52b('0x11'),_0x349e7e,_0xc52b('0xf'),JSON[_0xc52b('0x12')](_0x7de81));if(_0x7de81['error']){if(_0x7de81[_0xc52b('0x13')]['code']===0x1f4){logger[_0xc52b('0x13')]('FaxQueue,\x20%s,\x20%s',_0x349e7e,_0x7de81[_0xc52b('0x13')][_0xc52b('0x14')]);return _0x5ba9d9(_0x7de81['error']['message']);}logger[_0xc52b('0x13')](_0xc52b('0xe'),_0x349e7e,_0x7de81[_0xc52b('0x13')][_0xc52b('0x14')]);return _0x11eaef(_0x7de81['error']['message']);}else{logger[_0xc52b('0xd')](_0xc52b('0xe'),_0x349e7e,_0xc52b('0xf'));_0x11eaef(_0x7de81[_0xc52b('0x15')][_0xc52b('0x14')]);}})[_0xc52b('0x16')](function(_0x55e606){logger[_0xc52b('0x13')](_0xc52b('0xe'),_0x349e7e,_0x55e606);_0x5ba9d9(_0x55e606);});});}exports[_0xc52b('0x17')]=function(_0x12d6f3){var _0x4671bd=this;return new Promise(function(_0x55cb90,_0x3364e9){return db[_0xc52b('0x18')][_0xc52b('0x19')]({'raw':_0x12d6f3[_0xc52b('0x1a')]?_0x12d6f3['options'][_0xc52b('0x1b')]===undefined?!![]:![]:!![],'where':_0x12d6f3[_0xc52b('0x1a')]?_0x12d6f3[_0xc52b('0x1a')][_0xc52b('0x1c')]||null:null,'attributes':_0x12d6f3[_0xc52b('0x1a')]?_0x12d6f3[_0xc52b('0x1a')][_0xc52b('0x1d')]||null:null,'limit':_0x12d6f3['options']?_0x12d6f3[_0xc52b('0x1a')][_0xc52b('0x1e')]||null:null,'include':_0x12d6f3[_0xc52b('0x1a')]?_0x12d6f3['options']['include']?_[_0xc52b('0x1f')](_0x12d6f3[_0xc52b('0x1a')][_0xc52b('0x20')],function(_0x31d4eb){return{'model':db[_0x31d4eb[_0xc52b('0x21')]],'as':_0x31d4eb['as'],'attributes':_0x31d4eb['attributes'],'include':_0x31d4eb[_0xc52b('0x20')]?_[_0xc52b('0x1f')](_0x31d4eb['include'],function(_0x1d392e){return{'model':db[_0x1d392e[_0xc52b('0x21')]],'as':_0x1d392e['as'],'attributes':_0x1d392e[_0xc52b('0x1d')],'include':_0x1d392e[_0xc52b('0x20')]?_[_0xc52b('0x1f')](_0x1d392e[_0xc52b('0x20')],function(_0x4e44ef){return{'model':db[_0x4e44ef[_0xc52b('0x21')]],'as':_0x4e44ef['as'],'attributes':_0x4e44ef[_0xc52b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc52b('0x22')](function(_0x21ef92){logger[_0xc52b('0xd')](_0xc52b('0x17'),_0x12d6f3);logger[_0xc52b('0x10')](_0xc52b('0x17'),_0x12d6f3,JSON[_0xc52b('0x12')](_0x21ef92));_0x55cb90(_0x21ef92);})[_0xc52b('0x16')](function(_0x25d141){logger[_0xc52b('0x13')](_0xc52b('0x17'),_0x25d141['message'],_0x12d6f3);_0x3364e9(_0x4671bd[_0xc52b('0x13')](0x1f4,_0x25d141['message']));});});};exports[_0xc52b('0x23')]=function(_0x367e75){var _0x49e7bc=this;return new Promise(function(_0x5bedfa,_0x3825e8){return db[_0xc52b('0x18')][_0xc52b('0x24')]({'raw':_0x367e75['options']?_0x367e75[_0xc52b('0x1a')][_0xc52b('0x1b')]===undefined?!![]:![]:!![],'where':_0x367e75[_0xc52b('0x1a')]?_0x367e75[_0xc52b('0x1a')][_0xc52b('0x1c')]||null:null,'attributes':_0x367e75[_0xc52b('0x1a')]?_0x367e75[_0xc52b('0x1a')][_0xc52b('0x1d')]||null:null,'include':_0x367e75[_0xc52b('0x1a')]?_0x367e75[_0xc52b('0x1a')][_0xc52b('0x20')]?_['map'](_0x367e75['options'][_0xc52b('0x20')],function(_0x2515e5){return{'model':db[_0x2515e5['model']],'as':_0x2515e5['as'],'attributes':_0x2515e5['attributes'],'include':_0x2515e5[_0xc52b('0x20')]?_['map'](_0x2515e5[_0xc52b('0x20')],function(_0x3365f1){return{'model':db[_0x3365f1[_0xc52b('0x21')]],'as':_0x3365f1['as'],'attributes':_0x3365f1[_0xc52b('0x1d')],'include':_0x3365f1['include']?_[_0xc52b('0x1f')](_0x3365f1[_0xc52b('0x20')],function(_0x56e8c3){return{'model':db[_0x56e8c3[_0xc52b('0x21')]],'as':_0x56e8c3['as'],'attributes':_0x56e8c3[_0xc52b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc52b('0x22')](function(_0xf554b7){logger['info'](_0xc52b('0x23'),_0x367e75);logger[_0xc52b('0x10')](_0xc52b('0x23'),_0x367e75,JSON[_0xc52b('0x12')](_0xf554b7));_0x5bedfa(_0xf554b7);})[_0xc52b('0x16')](function(_0x48825c){logger[_0xc52b('0x13')](_0xc52b('0x23'),_0x48825c[_0xc52b('0x14')],_0x367e75);_0x3825e8(_0x49e7bc[_0xc52b('0x13')](0x1f4,_0x48825c[_0xc52b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0dab33d..a5e5262 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 _0x8812=['./faxQueue.events','save','remove','update','length'];(function(_0x1057a3,_0x28d9b7){var _0x131cdb=function(_0x47a386){while(--_0x47a386){_0x1057a3['push'](_0x1057a3['shift']());}};_0x131cdb(++_0x28d9b7);}(_0x8812,0xcd));var _0x2881=function(_0x2c5a22,_0x625ea8){_0x2c5a22=_0x2c5a22-0x0;var _0x44a32a=_0x8812[_0x2c5a22];return _0x44a32a;};'use strict';var FaxQueueEvents=require(_0x2881('0x0'));var events=[_0x2881('0x1'),_0x2881('0x2'),_0x2881('0x3')];function createListener(_0x129698,_0x49a5f3){return function(_0x45d284){_0x49a5f3['emit'](_0x129698,_0x45d284);};}function removeListener(_0x4c7b00,_0x1a5e90){return function(){FaxQueueEvents['removeListener'](_0x4c7b00,_0x1a5e90);};}exports['register']=function(_0x374be8){for(var _0x14337e=0x0,_0x465941=events[_0x2881('0x4')];_0x14337e<_0x465941;_0x14337e++){var _0x1fe782=events[_0x14337e];var _0x10adf1=createListener('faxQueue:'+_0x1fe782,_0x374be8);FaxQueueEvents['on'](_0x1fe782,_0x10adf1);}}; \ No newline at end of file +var _0x6b5f=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','emit'];(function(_0x19c633,_0x2def8b){var _0x5a7d78=function(_0x2b7433){while(--_0x2b7433){_0x19c633['push'](_0x19c633['shift']());}};_0x5a7d78(++_0x2def8b);}(_0x6b5f,0x154));var _0xf6b5=function(_0x4ade6c,_0x18819b){_0x4ade6c=_0x4ade6c-0x0;var _0x5abf3f=_0x6b5f[_0x4ade6c];return _0x5abf3f;};'use strict';var FaxQueueEvents=require(_0xf6b5('0x0'));var events=[_0xf6b5('0x1'),_0xf6b5('0x2'),'update'];function createListener(_0x3d0b04,_0x742b0a){return function(_0x4cf654){_0x742b0a[_0xf6b5('0x3')](_0x3d0b04,_0x4cf654);};}function removeListener(_0x1c697d,_0x26b257){return function(){FaxQueueEvents[_0xf6b5('0x4')](_0x1c697d,_0x26b257);};}exports[_0xf6b5('0x5')]=function(_0x35b3ac){for(var _0x2e9880=0x0,_0x2257f2=events[_0xf6b5('0x6')];_0x2e9880<_0x2257f2;_0x2e9880++){var _0x51e5d8=events[_0x2e9880];var _0x15c00a=createListener(_0xf6b5('0x7')+_0x51e5d8,_0x35b3ac);FaxQueueEvents['on'](_0x51e5d8,_0x15c00a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ba6d202..f705419 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 _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x59ed12,_0xf96ab6){_0x59ed12=_0x59ed12-0x0;var _0x3b6f60=_0xb10b[_0x59ed12];return _0x3b6f60;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0xb10b[_0x1ebe90];return _0x447c82;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 6bd5331..dc5a855 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 _0x3f9b=['DATE','moment','sequelize','exports','STRING'];(function(_0x32e6bf,_0x25bc88){var _0x2f03f9=function(_0x3c3f01){while(--_0x3c3f01){_0x32e6bf['push'](_0x32e6bf['shift']());}};_0x2f03f9(++_0x25bc88);}(_0x3f9b,0xd3));var _0xb3f9=function(_0xe852d5,_0xfdea14){_0xe852d5=_0xe852d5-0x0;var _0xb7886=_0x3f9b[_0xe852d5];return _0xb7886;};'use strict';var moment=require(_0xb3f9('0x0'));var Sequelize=require(_0xb3f9('0x1'));module[_0xb3f9('0x2')]={'uniqueid':{'type':Sequelize[_0xb3f9('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb3f9('0x4')]},'leaveAt':{'type':Sequelize[_0xb3f9('0x4')]},'acceptAt':{'type':Sequelize[_0xb3f9('0x4')]},'exitAt':{'type':Sequelize[_0xb3f9('0x4')]},'reason':{'type':Sequelize[_0xb3f9('0x3')]}}; \ No newline at end of file +var _0x2305=['sequelize','exports','STRING','DATE','moment'];(function(_0x1da1b0,_0x4f76ec){var _0x4ffdee=function(_0x568fa3){while(--_0x568fa3){_0x1da1b0['push'](_0x1da1b0['shift']());}};_0x4ffdee(++_0x4f76ec);}(_0x2305,0x1f3));var _0x5230=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x2305[_0x34aec4];return _0x51e1a7;};'use strict';var moment=require(_0x5230('0x0'));var Sequelize=require(_0x5230('0x1'));module[_0x5230('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5230('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5230('0x4')]},'acceptAt':{'type':Sequelize[_0x5230('0x4')]},'exitAt':{'type':Sequelize[_0x5230('0x4')]},'reason':{'type':Sequelize[_0x5230('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b18e61a..9678c07 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 _0x9cbb=['merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x4b0830,_0x2e3b0a){var _0x1f53a7=function(_0x4b5503){while(--_0x4b5503){_0x4b0830['push'](_0x4b0830['shift']());}};_0x1f53a7(++_0x2e3b0a);}(_0x9cbb,0xe9));var _0xb9cb=function(_0x44334a,_0x181bce){_0x44334a=_0x44334a-0x0;var _0x20a140=_0x9cbb[_0x44334a];return _0x20a140;};'use strict';var pdf=require(_0xb9cb('0x0'));var emlformat=require(_0xb9cb('0x1'));var rimraf=require(_0xb9cb('0x2'));var zipdir=require(_0xb9cb('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9cb('0x4'));var moment=require('moment');var BPromise=require(_0xb9cb('0x5'));var Mustache=require(_0xb9cb('0x6'));var util=require('util');var path=require(_0xb9cb('0x7'));var sox=require(_0xb9cb('0x8'));var csv=require(_0xb9cb('0x9'));var ejs=require(_0xb9cb('0xa'));var fs=require('fs');var _=require(_0xb9cb('0xb'));var squel=require(_0xb9cb('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb9cb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb9cb('0xe'));var qs=require(_0xb9cb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9cb('0x10'));var logger=require(_0xb9cb('0x11'))(_0xb9cb('0x12'));var utils=require(_0xb9cb('0x13'));var config=require(_0xb9cb('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb9cb('0x15'))['db'];function respondWithStatusCode(_0x5e4d28,_0x3491d9){_0x3491d9=_0x3491d9||0xcc;return function(_0x439cef){if(_0x439cef){return _0x5e4d28['sendStatus'](_0x3491d9);}return _0x5e4d28[_0xb9cb('0x16')](_0x3491d9)[_0xb9cb('0x17')]();};}function respondWithResult(_0xc216e6,_0xd09135){_0xd09135=_0xd09135||0xc8;return function(_0x527817){if(_0x527817){return _0xc216e6[_0xb9cb('0x16')](_0xd09135)[_0xb9cb('0x18')](_0x527817);}};}function respondWithFilteredResult(_0x18c9b9,_0xb6dbb1){return function(_0x22664c){if(_0x22664c){var _0x1c1712=_0x22664c[_0xb9cb('0x19')],_0x11bd13=_0xb6dbb1[_0xb9cb('0x1a')],_0x38d7f6=_0xb6dbb1[_0xb9cb('0x1a')]+_0xb6dbb1[_0xb9cb('0x1b')],_0x1c155e;if(_0x38d7f6>=_0x1c1712){_0x38d7f6=_0x1c1712;_0x1c155e=0xc8;}else{_0x1c155e=0xce;}_0x18c9b9[_0xb9cb('0x16')](_0x1c155e);return _0x18c9b9['set'](_0xb9cb('0x1c'),_0x11bd13+'-'+_0x38d7f6+'/'+_0x1c1712)[_0xb9cb('0x18')](_0x22664c);}return null;};}function patchUpdates(_0x2fd9c2){return function(_0x497404){try{jsonpatch[_0xb9cb('0x1d')](_0x497404,_0x2fd9c2,!![]);}catch(_0x34e79c){return BPromise[_0xb9cb('0x1e')](_0x34e79c);}return _0x497404[_0xb9cb('0x1f')]();};}function saveUpdates(_0x5a6d69,_0x43e85a){return function(_0xdff8fe){if(_0xdff8fe){return _0xdff8fe['update'](_0x5a6d69)[_0xb9cb('0x20')](function(_0x28b5fa){return _0x28b5fa;});}return null;};}function removeEntity(_0x371ad5,_0x363814){return function(_0x4d2236){if(_0x4d2236){return _0x4d2236[_0xb9cb('0x21')]()[_0xb9cb('0x20')](function(){_0x371ad5[_0xb9cb('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf893fb,_0x5df294){return function(_0x230e7d){if(!_0x230e7d){_0xf893fb[_0xb9cb('0x22')](0x194);}return _0x230e7d;};}function handleError(_0x318836,_0x559122){_0x559122=_0x559122||0x1f4;return function(_0x24f9ac){logger[_0xb9cb('0x23')](_0x24f9ac[_0xb9cb('0x24')]);if(_0x24f9ac['name']){delete _0x24f9ac[_0xb9cb('0x25')];}_0x318836[_0xb9cb('0x16')](_0x559122)[_0xb9cb('0x26')](_0x24f9ac);};}exports['index']=function(_0x1acdd6,_0x4a7e12){var _0x3ee30b={},_0x3c224c={},_0x5cc9aa={'count':0x0,'rows':[]};var _0x5261e1=_[_0xb9cb('0x27')](db[_0xb9cb('0x28')][_0xb9cb('0x29')],function(_0x51fd47){return{'name':_0x51fd47[_0xb9cb('0x2a')],'type':_0x51fd47[_0xb9cb('0x2b')]['key']};});_0x3c224c['model']=_[_0xb9cb('0x27')](_0x5261e1,'name');_0x3c224c[_0xb9cb('0x2c')]=_[_0xb9cb('0x2d')](_0x1acdd6[_0xb9cb('0x2c')]);_0x3c224c[_0xb9cb('0x2e')]=_['intersection'](_0x3c224c[_0xb9cb('0x2f')],_0x3c224c[_0xb9cb('0x2c')]);_0x3ee30b[_0xb9cb('0x30')]=_[_0xb9cb('0x31')](_0x3c224c['model'],qs[_0xb9cb('0x32')](_0x1acdd6[_0xb9cb('0x2c')][_0xb9cb('0x32')]));_0x3ee30b[_0xb9cb('0x30')]=_0x3ee30b['attributes'][_0xb9cb('0x33')]?_0x3ee30b[_0xb9cb('0x30')]:_0x3c224c[_0xb9cb('0x2f')];if(!_0x1acdd6[_0xb9cb('0x2c')][_0xb9cb('0x34')](_0xb9cb('0x35'))){_0x3ee30b[_0xb9cb('0x1b')]=qs[_0xb9cb('0x1b')](_0x1acdd6[_0xb9cb('0x2c')][_0xb9cb('0x1b')]);_0x3ee30b['offset']=qs[_0xb9cb('0x1a')](_0x1acdd6['query'][_0xb9cb('0x1a')]);}_0x3ee30b[_0xb9cb('0x36')]=qs[_0xb9cb('0x37')](_0x1acdd6[_0xb9cb('0x2c')][_0xb9cb('0x37')]);_0x3ee30b['where']=qs[_0xb9cb('0x2e')](_[_0xb9cb('0x38')](_0x1acdd6[_0xb9cb('0x2c')],_0x3c224c['filters']),_0x5261e1);if(_0x1acdd6['query'][_0xb9cb('0x39')]){_0x3ee30b[_0xb9cb('0x3a')]=_[_0xb9cb('0x3b')](_0x3ee30b[_0xb9cb('0x3a')],{'$or':_[_0xb9cb('0x27')](_0x5261e1,function(_0x5c472c){if(_0x5c472c['type']!==_0xb9cb('0x3c')){var _0x51c674={};_0x51c674[_0x5c472c['name']]={'$like':'%'+_0x1acdd6['query'][_0xb9cb('0x39')]+'%'};return _0x51c674;}})});}_0x3ee30b=_[_0xb9cb('0x3b')]({},_0x3ee30b,_0x1acdd6[_0xb9cb('0x3d')]);var _0x3c6d94={'where':_0x3ee30b[_0xb9cb('0x3a')]};return db['FaxQueueReport'][_0xb9cb('0x19')](_0x3c6d94)[_0xb9cb('0x20')](function(_0x502076){_0x5cc9aa['count']=_0x502076;if(_0x1acdd6[_0xb9cb('0x2c')][_0xb9cb('0x3e')]){_0x3ee30b[_0xb9cb('0x3f')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x3ee30b);})[_0xb9cb('0x20')](function(_0x282036){_0x5cc9aa[_0xb9cb('0x40')]=_0x282036;return _0x5cc9aa;})[_0xb9cb('0x20')](respondWithFilteredResult(_0x4a7e12,_0x3ee30b))[_0xb9cb('0x41')](handleError(_0x4a7e12,null));};exports[_0xb9cb('0x42')]=function(_0x40cbaa,_0x363e29){var _0xa0902c={'raw':!![],'where':{'id':_0x40cbaa[_0xb9cb('0x43')]['id']}},_0x2b8d2b={};_0x2b8d2b['model']=_[_0xb9cb('0x2d')](db['FaxQueueReport']['rawAttributes']);_0x2b8d2b[_0xb9cb('0x2c')]=_['keys'](_0x40cbaa[_0xb9cb('0x2c')]);_0x2b8d2b[_0xb9cb('0x2e')]=_[_0xb9cb('0x31')](_0x2b8d2b['model'],_0x2b8d2b['query']);_0xa0902c[_0xb9cb('0x30')]=_['intersection'](_0x2b8d2b[_0xb9cb('0x2f')],qs[_0xb9cb('0x32')](_0x40cbaa['query'][_0xb9cb('0x32')]));_0xa0902c[_0xb9cb('0x30')]=_0xa0902c[_0xb9cb('0x30')]['length']?_0xa0902c[_0xb9cb('0x30')]:_0x2b8d2b['model'];if(_0x40cbaa['query'][_0xb9cb('0x3e')]){_0xa0902c['include']=[{'all':!![]}];}_0xa0902c=_['merge']({},_0xa0902c,_0x40cbaa['options']);return db['FaxQueueReport'][_0xb9cb('0x44')](_0xa0902c)['then'](handleEntityNotFound(_0x363e29,null))[_0xb9cb('0x20')](respondWithResult(_0x363e29,null))[_0xb9cb('0x41')](handleError(_0x363e29,null));};exports['create']=function(_0x4b2bbf,_0x2eb04a){return db[_0xb9cb('0x28')][_0xb9cb('0x45')](_0x4b2bbf[_0xb9cb('0x46')],{})['then'](respondWithResult(_0x2eb04a,0xc9))[_0xb9cb('0x41')](handleError(_0x2eb04a,null));};exports[_0xb9cb('0x47')]=function(_0x345751,_0x3e359d){if(_0x345751[_0xb9cb('0x46')]['id']){delete _0x345751['body']['id'];}return db[_0xb9cb('0x28')]['find']({'where':{'id':_0x345751[_0xb9cb('0x43')]['id']}})[_0xb9cb('0x20')](handleEntityNotFound(_0x3e359d,null))[_0xb9cb('0x20')](saveUpdates(_0x345751[_0xb9cb('0x46')],null))[_0xb9cb('0x20')](respondWithResult(_0x3e359d,null))['catch'](handleError(_0x3e359d,null));};exports[_0xb9cb('0x21')]=function(_0x5a4a29,_0x59cdf2){return db['FaxQueueReport'][_0xb9cb('0x44')]({'where':{'id':_0x5a4a29[_0xb9cb('0x43')]['id']}})[_0xb9cb('0x20')](handleEntityNotFound(_0x59cdf2,null))[_0xb9cb('0x20')](removeEntity(_0x59cdf2,null))['catch'](handleError(_0x59cdf2,null));};exports[_0xb9cb('0x48')]=function(_0x25ee2f,_0x57b6ef){return db['FaxQueueReport'][_0xb9cb('0x48')]()[_0xb9cb('0x20')](respondWithResult(_0x57b6ef,null))[_0xb9cb('0x41')](handleError(_0x57b6ef,null));}; \ No newline at end of file +var _0x3b0e=['mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','merge','VIRTUAL','options','then','includeAll','include','FaxQueueReport','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0x135b26,_0x55cf7e){var _0x2170f7=function(_0x12b4a3){while(--_0x12b4a3){_0x135b26['push'](_0x135b26['shift']());}};_0x2170f7(++_0x55cf7e);}(_0x3b0e,0x1c1));var _0xe3b0=function(_0x4cae95,_0x3ac4c9){_0x4cae95=_0x4cae95-0x0;var _0x7cc414=_0x3b0e[_0x4cae95];return _0x7cc414;};'use strict';var pdf=require(_0xe3b0('0x0'));var emlformat=require(_0xe3b0('0x1'));var rimraf=require(_0xe3b0('0x2'));var zipdir=require(_0xe3b0('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3b0('0x4'));var moment=require(_0xe3b0('0x5'));var BPromise=require(_0xe3b0('0x6'));var Mustache=require(_0xe3b0('0x7'));var util=require(_0xe3b0('0x8'));var path=require('path');var sox=require(_0xe3b0('0x9'));var csv=require(_0xe3b0('0xa'));var ejs=require(_0xe3b0('0xb'));var fs=require('fs');var _=require(_0xe3b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe3b0('0xd'));var deskjs=require(_0xe3b0('0xe'));var toCsv=require(_0xe3b0('0xa'));var querystring=require(_0xe3b0('0xf'));var Papa=require(_0xe3b0('0x10'));var Redis=require(_0xe3b0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe3b0('0x12'));var as=require(_0xe3b0('0x13'));var hardwareService=require(_0xe3b0('0x14'));var logger=require(_0xe3b0('0x15'))(_0xe3b0('0x16'));var utils=require(_0xe3b0('0x17'));var config=require(_0xe3b0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3b0('0x19'))['db'];function respondWithStatusCode(_0x144f58,_0x5e955a){_0x5e955a=_0x5e955a||0xcc;return function(_0x4abbea){if(_0x4abbea){return _0x144f58['sendStatus'](_0x5e955a);}return _0x144f58[_0xe3b0('0x1a')](_0x5e955a)[_0xe3b0('0x1b')]();};}function respondWithResult(_0x588457,_0x5adff9){_0x5adff9=_0x5adff9||0xc8;return function(_0x404e53){if(_0x404e53){return _0x588457[_0xe3b0('0x1a')](_0x5adff9)[_0xe3b0('0x1c')](_0x404e53);}};}function respondWithFilteredResult(_0x1a964d,_0x406683){return function(_0x410c43){if(_0x410c43){var _0x305d53=_0x410c43[_0xe3b0('0x1d')],_0x104ffb=_0x406683[_0xe3b0('0x1e')],_0x479a92=_0x406683[_0xe3b0('0x1e')]+_0x406683[_0xe3b0('0x1f')],_0x5deba9;if(_0x479a92>=_0x305d53){_0x479a92=_0x305d53;_0x5deba9=0xc8;}else{_0x5deba9=0xce;}_0x1a964d['status'](_0x5deba9);return _0x1a964d[_0xe3b0('0x20')](_0xe3b0('0x21'),_0x104ffb+'-'+_0x479a92+'/'+_0x305d53)[_0xe3b0('0x1c')](_0x410c43);}return null;};}function patchUpdates(_0x37b914){return function(_0x587556){try{jsonpatch[_0xe3b0('0x22')](_0x587556,_0x37b914,!![]);}catch(_0x2921e8){return BPromise[_0xe3b0('0x23')](_0x2921e8);}return _0x587556[_0xe3b0('0x24')]();};}function saveUpdates(_0x462e5e,_0x517849){return function(_0x5023b1){if(_0x5023b1){return _0x5023b1[_0xe3b0('0x25')](_0x462e5e)['then'](function(_0x26a03b){return _0x26a03b;});}return null;};}function removeEntity(_0x4d493b,_0x44263f){return function(_0x223db2){if(_0x223db2){return _0x223db2[_0xe3b0('0x26')]()['then'](function(){_0x4d493b[_0xe3b0('0x1a')](0xcc)[_0xe3b0('0x1b')]();});}};}function handleEntityNotFound(_0xdc8e6f,_0x40680d){return function(_0x2b04b3){if(!_0x2b04b3){_0xdc8e6f[_0xe3b0('0x27')](0x194);}return _0x2b04b3;};}function handleError(_0x2c3707,_0x57ce28){_0x57ce28=_0x57ce28||0x1f4;return function(_0x9e482d){logger['error'](_0x9e482d['stack']);if(_0x9e482d[_0xe3b0('0x28')]){delete _0x9e482d[_0xe3b0('0x28')];}_0x2c3707[_0xe3b0('0x1a')](_0x57ce28)[_0xe3b0('0x29')](_0x9e482d);};}exports[_0xe3b0('0x2a')]=function(_0x1f350c,_0x192be8){var _0xadd869={},_0x1ff71d={},_0x423e7c={'count':0x0,'rows':[]};var _0x1ff5e1=_[_0xe3b0('0x2b')](db['FaxQueueReport'][_0xe3b0('0x2c')],function(_0x2141aa){return{'name':_0x2141aa[_0xe3b0('0x2d')],'type':_0x2141aa[_0xe3b0('0x2e')][_0xe3b0('0x2f')]};});_0x1ff71d[_0xe3b0('0x30')]=_[_0xe3b0('0x2b')](_0x1ff5e1,'name');_0x1ff71d[_0xe3b0('0x31')]=_[_0xe3b0('0x32')](_0x1f350c['query']);_0x1ff71d[_0xe3b0('0x33')]=_['intersection'](_0x1ff71d['model'],_0x1ff71d[_0xe3b0('0x31')]);_0xadd869[_0xe3b0('0x34')]=_[_0xe3b0('0x35')](_0x1ff71d['model'],qs[_0xe3b0('0x36')](_0x1f350c['query'][_0xe3b0('0x36')]));_0xadd869[_0xe3b0('0x34')]=_0xadd869[_0xe3b0('0x34')][_0xe3b0('0x37')]?_0xadd869[_0xe3b0('0x34')]:_0x1ff71d['model'];if(!_0x1f350c[_0xe3b0('0x31')]['hasOwnProperty'](_0xe3b0('0x38'))){_0xadd869['limit']=qs['limit'](_0x1f350c['query'][_0xe3b0('0x1f')]);_0xadd869[_0xe3b0('0x1e')]=qs[_0xe3b0('0x1e')](_0x1f350c['query'][_0xe3b0('0x1e')]);}_0xadd869[_0xe3b0('0x39')]=qs['sort'](_0x1f350c[_0xe3b0('0x31')]['sort']);_0xadd869[_0xe3b0('0x3a')]=qs[_0xe3b0('0x33')](_[_0xe3b0('0x3b')](_0x1f350c[_0xe3b0('0x31')],_0x1ff71d[_0xe3b0('0x33')]),_0x1ff5e1);if(_0x1f350c[_0xe3b0('0x31')]['filter']){_0xadd869[_0xe3b0('0x3a')]=_[_0xe3b0('0x3c')](_0xadd869['where'],{'$or':_[_0xe3b0('0x2b')](_0x1ff5e1,function(_0x1cfe06){if(_0x1cfe06['type']!==_0xe3b0('0x3d')){var _0x44ddd1={};_0x44ddd1[_0x1cfe06[_0xe3b0('0x28')]]={'$like':'%'+_0x1f350c[_0xe3b0('0x31')]['filter']+'%'};return _0x44ddd1;}})});}_0xadd869=_[_0xe3b0('0x3c')]({},_0xadd869,_0x1f350c[_0xe3b0('0x3e')]);var _0x2a3533={'where':_0xadd869[_0xe3b0('0x3a')]};return db['FaxQueueReport'][_0xe3b0('0x1d')](_0x2a3533)[_0xe3b0('0x3f')](function(_0x666339){_0x423e7c[_0xe3b0('0x1d')]=_0x666339;if(_0x1f350c[_0xe3b0('0x31')][_0xe3b0('0x40')]){_0xadd869[_0xe3b0('0x41')]=[{'all':!![]}];}return db[_0xe3b0('0x42')][_0xe3b0('0x43')](_0xadd869);})['then'](function(_0x54df14){_0x423e7c[_0xe3b0('0x44')]=_0x54df14;return _0x423e7c;})[_0xe3b0('0x3f')](respondWithFilteredResult(_0x192be8,_0xadd869))['catch'](handleError(_0x192be8,null));};exports[_0xe3b0('0x45')]=function(_0x2397c4,_0x34594c){var _0xf136d4={'raw':!![],'where':{'id':_0x2397c4['params']['id']}},_0x147f11={};_0x147f11[_0xe3b0('0x30')]=_[_0xe3b0('0x32')](db[_0xe3b0('0x42')]['rawAttributes']);_0x147f11[_0xe3b0('0x31')]=_[_0xe3b0('0x32')](_0x2397c4[_0xe3b0('0x31')]);_0x147f11[_0xe3b0('0x33')]=_[_0xe3b0('0x35')](_0x147f11[_0xe3b0('0x30')],_0x147f11['query']);_0xf136d4[_0xe3b0('0x34')]=_[_0xe3b0('0x35')](_0x147f11[_0xe3b0('0x30')],qs[_0xe3b0('0x36')](_0x2397c4[_0xe3b0('0x31')][_0xe3b0('0x36')]));_0xf136d4[_0xe3b0('0x34')]=_0xf136d4[_0xe3b0('0x34')][_0xe3b0('0x37')]?_0xf136d4[_0xe3b0('0x34')]:_0x147f11[_0xe3b0('0x30')];if(_0x2397c4[_0xe3b0('0x31')][_0xe3b0('0x40')]){_0xf136d4[_0xe3b0('0x41')]=[{'all':!![]}];}_0xf136d4=_['merge']({},_0xf136d4,_0x2397c4[_0xe3b0('0x3e')]);return db[_0xe3b0('0x42')][_0xe3b0('0x46')](_0xf136d4)[_0xe3b0('0x3f')](handleEntityNotFound(_0x34594c,null))[_0xe3b0('0x3f')](respondWithResult(_0x34594c,null))[_0xe3b0('0x47')](handleError(_0x34594c,null));};exports[_0xe3b0('0x48')]=function(_0x425ed8,_0x5de90f){return db[_0xe3b0('0x42')]['create'](_0x425ed8[_0xe3b0('0x49')],{})[_0xe3b0('0x3f')](respondWithResult(_0x5de90f,0xc9))[_0xe3b0('0x47')](handleError(_0x5de90f,null));};exports[_0xe3b0('0x25')]=function(_0x1f46d9,_0x1dee0c){if(_0x1f46d9[_0xe3b0('0x49')]['id']){delete _0x1f46d9[_0xe3b0('0x49')]['id'];}return db['FaxQueueReport'][_0xe3b0('0x46')]({'where':{'id':_0x1f46d9[_0xe3b0('0x4a')]['id']}})[_0xe3b0('0x3f')](handleEntityNotFound(_0x1dee0c,null))[_0xe3b0('0x3f')](saveUpdates(_0x1f46d9[_0xe3b0('0x49')],null))[_0xe3b0('0x3f')](respondWithResult(_0x1dee0c,null))[_0xe3b0('0x47')](handleError(_0x1dee0c,null));};exports['destroy']=function(_0x343d5a,_0xad9ca8){return db[_0xe3b0('0x42')][_0xe3b0('0x46')]({'where':{'id':_0x343d5a['params']['id']}})[_0xe3b0('0x3f')](handleEntityNotFound(_0xad9ca8,null))[_0xe3b0('0x3f')](removeEntity(_0xad9ca8,null))[_0xe3b0('0x47')](handleError(_0xad9ca8,null));};exports[_0xe3b0('0x4b')]=function(_0x214954,_0x14f380){return db[_0xe3b0('0x42')][_0xe3b0('0x4b')]()['then'](respondWithResult(_0x14f380,null))[_0xe3b0('0x47')](handleError(_0x14f380,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 6b2b9c6..72c093c 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 _0xdc6e=['bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','util','api'];(function(_0x4b7444,_0x69fb65){var _0x397c04=function(_0x568d70){while(--_0x568d70){_0x4b7444['push'](_0x4b7444['shift']());}};_0x397c04(++_0x69fb65);}(_0xdc6e,0x166));var _0xedc6=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xdc6e[_0x4fe19c];return _0x952ac7;};'use strict';var _=require('lodash');var util=require(_0xedc6('0x0'));var logger=require('../../config/logger')(_0xedc6('0x1'));var moment=require('moment');var BPromise=require(_0xedc6('0x2'));var rp=require(_0xedc6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xedc6('0x4'));var attributes=require(_0xedc6('0x5'));module[_0xedc6('0x6')]=function(_0x41529b,_0xc1582a){return _0x41529b['define'](_0xedc6('0x7'),attributes,{'tableName':_0xedc6('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xedc6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ebb=['define','FaxQueueReport','report_fax_queue','uniqueid','lodash','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0xf2b54c,_0x90b51a){var _0x1f8bad=function(_0x5d1bfb){while(--_0x5d1bfb){_0xf2b54c['push'](_0xf2b54c['shift']());}};_0x1f8bad(++_0x90b51a);}(_0x6ebb,0xc4));var _0xb6eb=function(_0x44741b,_0xb0e278){_0x44741b=_0x44741b-0x0;var _0x1f3166=_0x6ebb[_0x44741b];return _0x1f3166;};'use strict';var _=require(_0xb6eb('0x0'));var util=require(_0xb6eb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb6eb('0x2'));var BPromise=require(_0xb6eb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6eb('0x4'));var rimraf=require(_0xb6eb('0x5'));var config=require(_0xb6eb('0x6'));var attributes=require('./faxQueueReport.attributes');module[_0xb6eb('0x7')]=function(_0x25330c,_0x55ca15){return _0x25330c[_0xb6eb('0x8')](_0xb6eb('0x9'),attributes,{'tableName':_0xb6eb('0xa'),'paranoid':![],'indexes':[{'name':_0xb6eb('0xb'),'fields':[_0xb6eb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index e37ed04..0e2daf3 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 _0x2b49=['jayson/promise','client','http','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x59c4b8,_0x222a43){var _0x42389d=function(_0x1a9661){while(--_0x1a9661){_0x59c4b8['push'](_0x59c4b8['shift']());}};_0x42389d(++_0x222a43);}(_0x2b49,0x1d3));var _0x92b4=function(_0x1ba5e3,_0xe2464a){_0x1ba5e3=_0x1ba5e3-0x0;var _0x407e38=_0x2b49[_0x1ba5e3];return _0x407e38;};'use strict';var _=require(_0x92b4('0x0'));var util=require(_0x92b4('0x1'));var moment=require(_0x92b4('0x2'));var BPromise=require(_0x92b4('0x3'));var rs=require(_0x92b4('0x4'));var fs=require('fs');var Redis=require(_0x92b4('0x5'));var db=require(_0x92b4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x92b4('0x7'))('rpc');var config=require(_0x92b4('0x8'));var jayson=require(_0x92b4('0x9'));var client=jayson[_0x92b4('0xa')][_0x92b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa02782,_0x4c0c09,_0x52fed1){return new BPromise(function(_0x31da58,_0x1bb980){return client['request'](_0xa02782,_0x52fed1)[_0x92b4('0xc')](function(_0x4ecdc9){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x4c0c09,_0x92b4('0xd'));logger[_0x92b4('0xe')](_0x92b4('0xf'),_0x4c0c09,_0x92b4('0xd'),JSON[_0x92b4('0x10')](_0x4ecdc9));if(_0x4ecdc9[_0x92b4('0x11')]){if(_0x4ecdc9[_0x92b4('0x11')][_0x92b4('0x12')]===0x1f4){logger[_0x92b4('0x11')](_0x92b4('0x13'),_0x4c0c09,_0x4ecdc9[_0x92b4('0x11')]['message']);return _0x1bb980(_0x4ecdc9[_0x92b4('0x11')][_0x92b4('0x14')]);}logger[_0x92b4('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4c0c09,_0x4ecdc9[_0x92b4('0x11')][_0x92b4('0x14')]);return _0x31da58(_0x4ecdc9['error'][_0x92b4('0x14')]);}else{logger[_0x92b4('0x15')](_0x92b4('0x13'),_0x4c0c09,'request\x20sent');_0x31da58(_0x4ecdc9[_0x92b4('0x16')][_0x92b4('0x14')]);}})[_0x92b4('0x17')](function(_0x24a6b8){logger[_0x92b4('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x4c0c09,_0x24a6b8);_0x1bb980(_0x24a6b8);});});}exports[_0x92b4('0x18')]=function(_0xebea9f){var _0x4bf13c=this;return new Promise(function(_0x592949,_0x52ed36){return db[_0x92b4('0x19')][_0x92b4('0x1a')](_0xebea9f[_0x92b4('0x1b')],{'raw':_0xebea9f[_0x92b4('0x1c')]?_0xebea9f[_0x92b4('0x1c')][_0x92b4('0x1d')]===undefined?!![]:![]:!![]})[_0x92b4('0xc')](function(_0x43b684){logger['info']('CreateFaxQueueReport',_0xebea9f);logger[_0x92b4('0xe')](_0x92b4('0x18'),_0xebea9f,JSON[_0x92b4('0x10')](_0x43b684));_0x592949(_0x43b684);})['catch'](function(_0x1f17f8){logger[_0x92b4('0x11')](_0x92b4('0x18'),_0x1f17f8[_0x92b4('0x14')],_0xebea9f);_0x52ed36(_0x4bf13c[_0x92b4('0x11')](0x1f4,_0x1f17f8['message']));});});};exports[_0x92b4('0x1e')]=function(_0x2b48c1){var _0x81bf43=this;return new Promise(function(_0x5f526b,_0x640a73){return db[_0x92b4('0x19')][_0x92b4('0x1f')](_0x2b48c1[_0x92b4('0x1b')],{'raw':_0x2b48c1[_0x92b4('0x1c')]?_0x2b48c1[_0x92b4('0x1c')][_0x92b4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b48c1[_0x92b4('0x1c')]?_0x2b48c1[_0x92b4('0x1c')]['where']||null:null,'attributes':_0x2b48c1[_0x92b4('0x1c')]?_0x2b48c1[_0x92b4('0x1c')][_0x92b4('0x20')]||null:null,'limit':_0x2b48c1[_0x92b4('0x1c')]?_0x2b48c1['options'][_0x92b4('0x21')]||null:null})[_0x92b4('0xc')](function(_0x580e20){logger[_0x92b4('0x15')](_0x92b4('0x1e'),_0x2b48c1);logger[_0x92b4('0xe')](_0x92b4('0x1e'),_0x2b48c1,JSON[_0x92b4('0x10')](_0x580e20));_0x5f526b(_0x580e20);})[_0x92b4('0x17')](function(_0x1fb7da){logger[_0x92b4('0x11')](_0x92b4('0x1e'),_0x1fb7da[_0x92b4('0x14')],_0x2b48c1);_0x640a73(_0x81bf43[_0x92b4('0x11')](0x1f4,_0x1fb7da[_0x92b4('0x14')]));});});}; \ No newline at end of file +var _0xcc0c=['update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','then','UpdateFaxQueueReport'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xcc0c,0x1f3));var _0xccc0=function(_0x303986,_0x5c751c){_0x303986=_0x303986-0x0;var _0x4c4431=_0xcc0c[_0x303986];return _0x4c4431;};'use strict';var _=require(_0xccc0('0x0'));var util=require(_0xccc0('0x1'));var moment=require(_0xccc0('0x2'));var BPromise=require(_0xccc0('0x3'));var rs=require(_0xccc0('0x4'));var fs=require('fs');var Redis=require(_0xccc0('0x5'));var db=require(_0xccc0('0x6'))['db'];var utils=require(_0xccc0('0x7'));var logger=require(_0xccc0('0x8'))(_0xccc0('0x9'));var config=require(_0xccc0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xccc0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e295c,_0x1d4d41,_0x2cb89a){return new BPromise(function(_0x44e06b,_0x1188c5){return client['request'](_0x1e295c,_0x2cb89a)['then'](function(_0x23f43b){logger[_0xccc0('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x1d4d41,'request\x20sent');logger[_0xccc0('0xd')](_0xccc0('0xe'),_0x1d4d41,_0xccc0('0xf'),JSON[_0xccc0('0x10')](_0x23f43b));if(_0x23f43b['error']){if(_0x23f43b[_0xccc0('0x11')][_0xccc0('0x12')]===0x1f4){logger[_0xccc0('0x11')](_0xccc0('0x13'),_0x1d4d41,_0x23f43b[_0xccc0('0x11')][_0xccc0('0x14')]);return _0x1188c5(_0x23f43b[_0xccc0('0x11')][_0xccc0('0x14')]);}logger[_0xccc0('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x1d4d41,_0x23f43b[_0xccc0('0x11')][_0xccc0('0x14')]);return _0x44e06b(_0x23f43b[_0xccc0('0x11')][_0xccc0('0x14')]);}else{logger[_0xccc0('0xc')](_0xccc0('0x13'),_0x1d4d41,_0xccc0('0xf'));_0x44e06b(_0x23f43b['result'][_0xccc0('0x14')]);}})[_0xccc0('0x15')](function(_0x47ecbc){logger['error'](_0xccc0('0x13'),_0x1d4d41,_0x47ecbc);_0x1188c5(_0x47ecbc);});});}exports[_0xccc0('0x16')]=function(_0x1086b1){var _0x494843=this;return new Promise(function(_0x26a406,_0x3e1811){return db[_0xccc0('0x17')][_0xccc0('0x18')](_0x1086b1[_0xccc0('0x19')],{'raw':_0x1086b1[_0xccc0('0x1a')]?_0x1086b1[_0xccc0('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xccc0('0x1b')](function(_0x5ea2fe){logger['info'](_0xccc0('0x16'),_0x1086b1);logger['debug'](_0xccc0('0x16'),_0x1086b1,JSON[_0xccc0('0x10')](_0x5ea2fe));_0x26a406(_0x5ea2fe);})['catch'](function(_0x26bf29){logger['error'](_0xccc0('0x16'),_0x26bf29[_0xccc0('0x14')],_0x1086b1);_0x3e1811(_0x494843[_0xccc0('0x11')](0x1f4,_0x26bf29[_0xccc0('0x14')]));});});};exports[_0xccc0('0x1c')]=function(_0xcabeb){var _0xff954e=this;return new Promise(function(_0x3e46e7,_0x7b8a23){return db[_0xccc0('0x17')][_0xccc0('0x1d')](_0xcabeb[_0xccc0('0x19')],{'raw':_0xcabeb[_0xccc0('0x1a')]?_0xcabeb['options'][_0xccc0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcabeb[_0xccc0('0x1a')]?_0xcabeb[_0xccc0('0x1a')][_0xccc0('0x1f')]||null:null,'attributes':_0xcabeb[_0xccc0('0x1a')]?_0xcabeb[_0xccc0('0x1a')][_0xccc0('0x20')]||null:null,'limit':_0xcabeb['options']?_0xcabeb[_0xccc0('0x1a')]['limit']||null:null})[_0xccc0('0x1b')](function(_0x474dea){logger[_0xccc0('0xc')](_0xccc0('0x1c'),_0xcabeb);logger[_0xccc0('0xd')](_0xccc0('0x1c'),_0xcabeb,JSON[_0xccc0('0x10')](_0x474dea));_0x3e46e7(_0x474dea);})[_0xccc0('0x15')](function(_0x1747b4){logger['error']('UpdateFaxQueueReport',_0x1747b4[_0xccc0('0x14')],_0xcabeb);_0x7b8a23(_0xff954e[_0xccc0('0x11')](0x1f4,_0x1747b4[_0xccc0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index f0fe668..76e997b 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 _0x86f7=['index','/describe','describe','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x1cee4e,_0x2c30bb){var _0x22fdda=function(_0x24f0e1){while(--_0x24f0e1){_0x1cee4e['push'](_0x1cee4e['shift']());}};_0x22fdda(++_0x2c30bb);}(_0x86f7,0x14d));var _0x786f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x86f7[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x786f('0x0'));var util=require('util');var path=require(_0x786f('0x1'));var timeout=require(_0x786f('0x2'));var express=require('express');var router=express[_0x786f('0x3')]();var auth=require(_0x786f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x786f('0x5'));var controller=require(_0x786f('0x6'));router[_0x786f('0x7')]('/',auth[_0x786f('0x8')](),controller[_0x786f('0x9')]);router['get'](_0x786f('0xa'),auth[_0x786f('0x8')](),controller[_0x786f('0xb')]);router[_0x786f('0x7')]('/:id',auth[_0x786f('0x8')](),controller['show']);router[_0x786f('0xc')]('/',auth[_0x786f('0x8')](),controller['create']);router[_0x786f('0xd')](_0x786f('0xe'),auth[_0x786f('0x8')](),controller[_0x786f('0xf')]);router[_0x786f('0x10')](_0x786f('0xe'),auth[_0x786f('0x8')](),controller[_0x786f('0x11')]);module[_0x786f('0x12')]=router; \ No newline at end of file +var _0x3217=['index','describe','/:id','show','post','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x3217,0x1dc));var _0x7321=function(_0x45059a,_0x4e003a){_0x45059a=_0x45059a-0x0;var _0x37838e=_0x3217[_0x45059a];return _0x37838e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7321('0x0'));var timeout=require(_0x7321('0x1'));var express=require(_0x7321('0x2'));var router=express[_0x7321('0x3')]();var auth=require(_0x7321('0x4'));var interaction=require(_0x7321('0x5'));var config=require(_0x7321('0x6'));var controller=require(_0x7321('0x7'));router[_0x7321('0x8')]('/',auth[_0x7321('0x9')](),controller[_0x7321('0xa')]);router[_0x7321('0x8')]('/describe',auth[_0x7321('0x9')](),controller[_0x7321('0xb')]);router[_0x7321('0x8')](_0x7321('0xc'),auth['isAuthenticated'](),controller[_0x7321('0xd')]);router[_0x7321('0xe')]('/',auth[_0x7321('0x9')](),controller['create']);router['put']('/:id',auth[_0x7321('0x9')](),controller[_0x7321('0xf')]);router[_0x7321('0x10')](_0x7321('0xc'),auth[_0x7321('0x9')](),controller[_0x7321('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index b228261..3cbfb92 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 _0x28ce=['queue','DATE','moment','sequelize','STRING','ENUM','account','agent'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x28ce,0x18a));var _0xe28c=function(_0x4be1e7,_0x978e9a){_0x4be1e7=_0x4be1e7-0x0;var _0x19d19b=_0x28ce[_0x4be1e7];return _0x19d19b;};'use strict';var moment=require(_0xe28c('0x0'));var Sequelize=require(_0xe28c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xe28c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe28c('0x3')](_0xe28c('0x4'),_0xe28c('0x5'),_0xe28c('0x6')),'allowNull':![],'defaultValue':_0xe28c('0x6')},'transferredAt':{'type':Sequelize[_0xe28c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xb1bb=['account','agent','queue','DATE','NOW','exports'];(function(_0x38b50e,_0x4acc8b){var _0x151e61=function(_0xe41374){while(--_0xe41374){_0x38b50e['push'](_0x38b50e['shift']());}};_0x151e61(++_0x4acc8b);}(_0xb1bb,0x19d));var _0xbb1b=function(_0x5807e8,_0x5d1910){_0x5807e8=_0x5807e8-0x0;var _0x2f7f36=_0xb1bb[_0x5807e8];return _0x2f7f36;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xbb1b('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbb1b('0x1'),_0xbb1b('0x2'),_0xbb1b('0x3')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbb1b('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xbb1b('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index f387ab1..a304c2e 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 _0x9ab0=['index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','show','params','length','create','body','catch','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','send'];(function(_0xa72345,_0x1fd304){var _0xbc82fb=function(_0xb1594f){while(--_0xb1594f){_0xa72345['push'](_0xa72345['shift']());}};_0xbc82fb(++_0x1fd304);}(_0x9ab0,0x195));var _0x09ab=function(_0x5035ca,_0x36566c){_0x5035ca=_0x5035ca-0x0;var _0x6c591c=_0x9ab0[_0x5035ca];return _0x6c591c;};'use strict';var pdf=require(_0x09ab('0x0'));var emlformat=require(_0x09ab('0x1'));var rimraf=require(_0x09ab('0x2'));var zipdir=require(_0x09ab('0x3'));var jsonpatch=require(_0x09ab('0x4'));var rp=require(_0x09ab('0x5'));var moment=require(_0x09ab('0x6'));var BPromise=require(_0x09ab('0x7'));var Mustache=require(_0x09ab('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x09ab('0x9'));var ejs=require(_0x09ab('0xa'));var fs=require('fs');var _=require(_0x09ab('0xb'));var squel=require(_0x09ab('0xc'));var crypto=require(_0x09ab('0xd'));var jsforce=require(_0x09ab('0xe'));var deskjs=require(_0x09ab('0xf'));var toCsv=require(_0x09ab('0x9'));var querystring=require(_0x09ab('0x10'));var Papa=require('papaparse');var Redis=require(_0x09ab('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x09ab('0x12'));var as=require(_0x09ab('0x13'));var hardwareService=require(_0x09ab('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x09ab('0x15'));var config=require(_0x09ab('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cd3d7,_0x1a667a){_0x1a667a=_0x1a667a||0xcc;return function(_0x367bc4){if(_0x367bc4){return _0x3cd3d7[_0x09ab('0x17')](_0x1a667a);}return _0x3cd3d7[_0x09ab('0x18')](_0x1a667a)[_0x09ab('0x19')]();};}function respondWithResult(_0x18ecda,_0x25bb6b){_0x25bb6b=_0x25bb6b||0xc8;return function(_0x10971){if(_0x10971){return _0x18ecda[_0x09ab('0x18')](_0x25bb6b)[_0x09ab('0x1a')](_0x10971);}};}function respondWithFilteredResult(_0x27cf42,_0x5ac9da){return function(_0x24db01){if(_0x24db01){var _0x3ff3b2=_0x24db01[_0x09ab('0x1b')],_0x3aa4f6=_0x5ac9da[_0x09ab('0x1c')],_0x4a165b=_0x5ac9da['offset']+_0x5ac9da[_0x09ab('0x1d')],_0x21db00;if(_0x4a165b>=_0x3ff3b2){_0x4a165b=_0x3ff3b2;_0x21db00=0xc8;}else{_0x21db00=0xce;}_0x27cf42[_0x09ab('0x18')](_0x21db00);return _0x27cf42[_0x09ab('0x1e')](_0x09ab('0x1f'),_0x3aa4f6+'-'+_0x4a165b+'/'+_0x3ff3b2)[_0x09ab('0x1a')](_0x24db01);}return null;};}function patchUpdates(_0x348cef){return function(_0x5c053b){try{jsonpatch[_0x09ab('0x20')](_0x5c053b,_0x348cef,!![]);}catch(_0x437ffc){return BPromise['reject'](_0x437ffc);}return _0x5c053b[_0x09ab('0x21')]();};}function saveUpdates(_0x6a3b15,_0x1be6af){return function(_0x35b6b0){if(_0x35b6b0){return _0x35b6b0[_0x09ab('0x22')](_0x6a3b15)[_0x09ab('0x23')](function(_0x37b525){return _0x37b525;});}return null;};}function removeEntity(_0x1bde95,_0x48d46c){return function(_0x30304f){if(_0x30304f){return _0x30304f[_0x09ab('0x24')]()[_0x09ab('0x23')](function(){_0x1bde95[_0x09ab('0x18')](0xcc)[_0x09ab('0x19')]();});}};}function handleEntityNotFound(_0x35ea70,_0x597beb){return function(_0x414277){if(!_0x414277){_0x35ea70[_0x09ab('0x17')](0x194);}return _0x414277;};}function handleError(_0x2122d1,_0x33cc49){_0x33cc49=_0x33cc49||0x1f4;return function(_0x293e54){logger['error'](_0x293e54['stack']);if(_0x293e54[_0x09ab('0x25')]){delete _0x293e54[_0x09ab('0x25')];}_0x2122d1['status'](_0x33cc49)[_0x09ab('0x26')](_0x293e54);};}exports[_0x09ab('0x27')]=function(_0x22d3dd,_0x1e6303){var _0x381719={},_0x923b78={},_0x1c90ff={'count':0x0,'rows':[]};var _0xe1e83d=_['map'](db[_0x09ab('0x28')][_0x09ab('0x29')],function(_0x300e2a){return{'name':_0x300e2a[_0x09ab('0x2a')],'type':_0x300e2a[_0x09ab('0x2b')][_0x09ab('0x2c')]};});_0x923b78[_0x09ab('0x2d')]=_[_0x09ab('0x2e')](_0xe1e83d,_0x09ab('0x25'));_0x923b78[_0x09ab('0x2f')]=_[_0x09ab('0x30')](_0x22d3dd[_0x09ab('0x2f')]);_0x923b78[_0x09ab('0x31')]=_['intersection'](_0x923b78[_0x09ab('0x2d')],_0x923b78[_0x09ab('0x2f')]);_0x381719[_0x09ab('0x32')]=_[_0x09ab('0x33')](_0x923b78[_0x09ab('0x2d')],qs[_0x09ab('0x34')](_0x22d3dd[_0x09ab('0x2f')][_0x09ab('0x34')]));_0x381719[_0x09ab('0x32')]=_0x381719['attributes']['length']?_0x381719[_0x09ab('0x32')]:_0x923b78[_0x09ab('0x2d')];if(!_0x22d3dd['query'][_0x09ab('0x35')](_0x09ab('0x36'))){_0x381719[_0x09ab('0x1d')]=qs['limit'](_0x22d3dd[_0x09ab('0x2f')][_0x09ab('0x1d')]);_0x381719[_0x09ab('0x1c')]=qs['offset'](_0x22d3dd['query'][_0x09ab('0x1c')]);}_0x381719[_0x09ab('0x37')]=qs[_0x09ab('0x38')](_0x22d3dd[_0x09ab('0x2f')][_0x09ab('0x38')]);_0x381719['where']=qs[_0x09ab('0x31')](_[_0x09ab('0x39')](_0x22d3dd['query'],_0x923b78[_0x09ab('0x31')]),_0xe1e83d);if(_0x22d3dd[_0x09ab('0x2f')]['filter']){_0x381719['where']=_['merge'](_0x381719['where'],{'$or':_[_0x09ab('0x2e')](_0xe1e83d,function(_0x365415){if(_0x365415['type']!==_0x09ab('0x3a')){var _0x13120f={};_0x13120f[_0x365415[_0x09ab('0x25')]]={'$like':'%'+_0x22d3dd[_0x09ab('0x2f')]['filter']+'%'};return _0x13120f;}})});}_0x381719=_[_0x09ab('0x3b')]({},_0x381719,_0x22d3dd[_0x09ab('0x3c')]);var _0x3f8011={'where':_0x381719[_0x09ab('0x3d')]};return db[_0x09ab('0x28')][_0x09ab('0x1b')](_0x3f8011)[_0x09ab('0x23')](function(_0x30f9b2){_0x1c90ff[_0x09ab('0x1b')]=_0x30f9b2;if(_0x22d3dd[_0x09ab('0x2f')][_0x09ab('0x3e')]){_0x381719[_0x09ab('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x09ab('0x40')](_0x381719);})[_0x09ab('0x23')](function(_0x3091c9){_0x1c90ff[_0x09ab('0x41')]=_0x3091c9;return _0x1c90ff;})[_0x09ab('0x23')](respondWithFilteredResult(_0x1e6303,_0x381719))['catch'](handleError(_0x1e6303,null));};exports[_0x09ab('0x42')]=function(_0x50ff2e,_0x12f859){var _0x317dcf={'raw':!![],'where':{'id':_0x50ff2e[_0x09ab('0x43')]['id']}},_0x25d7c2={};_0x25d7c2[_0x09ab('0x2d')]=_['keys'](db[_0x09ab('0x28')][_0x09ab('0x29')]);_0x25d7c2[_0x09ab('0x2f')]=_[_0x09ab('0x30')](_0x50ff2e[_0x09ab('0x2f')]);_0x25d7c2[_0x09ab('0x31')]=_[_0x09ab('0x33')](_0x25d7c2[_0x09ab('0x2d')],_0x25d7c2[_0x09ab('0x2f')]);_0x317dcf[_0x09ab('0x32')]=_[_0x09ab('0x33')](_0x25d7c2[_0x09ab('0x2d')],qs[_0x09ab('0x34')](_0x50ff2e[_0x09ab('0x2f')][_0x09ab('0x34')]));_0x317dcf[_0x09ab('0x32')]=_0x317dcf[_0x09ab('0x32')][_0x09ab('0x44')]?_0x317dcf[_0x09ab('0x32')]:_0x25d7c2['model'];if(_0x50ff2e['query'][_0x09ab('0x3e')]){_0x317dcf[_0x09ab('0x3f')]=[{'all':!![]}];}_0x317dcf=_['merge']({},_0x317dcf,_0x50ff2e[_0x09ab('0x3c')]);return db[_0x09ab('0x28')]['find'](_0x317dcf)[_0x09ab('0x23')](handleEntityNotFound(_0x12f859,null))[_0x09ab('0x23')](respondWithResult(_0x12f859,null))['catch'](handleError(_0x12f859,null));};exports[_0x09ab('0x45')]=function(_0x29d62a,_0xe010d2){return db[_0x09ab('0x28')][_0x09ab('0x45')](_0x29d62a[_0x09ab('0x46')],{})[_0x09ab('0x23')](respondWithResult(_0xe010d2,0xc9))[_0x09ab('0x47')](handleError(_0xe010d2,null));};exports['update']=function(_0xe40c00,_0x276cf7){if(_0xe40c00[_0x09ab('0x46')]['id']){delete _0xe40c00['body']['id'];}return db[_0x09ab('0x28')][_0x09ab('0x48')]({'where':{'id':_0xe40c00[_0x09ab('0x43')]['id']}})[_0x09ab('0x23')](handleEntityNotFound(_0x276cf7,null))['then'](saveUpdates(_0xe40c00['body'],null))['then'](respondWithResult(_0x276cf7,null))['catch'](handleError(_0x276cf7,null));};exports[_0x09ab('0x24')]=function(_0x3d0fe1,_0x2fea52){return db['FaxTransferReport'][_0x09ab('0x48')]({'where':{'id':_0x3d0fe1[_0x09ab('0x43')]['id']}})['then'](handleEntityNotFound(_0x2fea52,null))[_0x09ab('0x23')](removeEntity(_0x2fea52,null))[_0x09ab('0x47')](handleError(_0x2fea52,null));};exports[_0x09ab('0x49')]=function(_0x3eb8ab,_0x594903){return db[_0x09ab('0x28')][_0x09ab('0x49')]()[_0x09ab('0x23')](respondWithResult(_0x594903,null))[_0x09ab('0x47')](handleError(_0x594903,null));}; \ No newline at end of file +var _0x4986=['update','then','stack','name','send','index','map','rawAttributes','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x1304d8,_0x39d7ca){var _0xe9e132=function(_0xad4d12){while(--_0xad4d12){_0x1304d8['push'](_0x1304d8['shift']());}};_0xe9e132(++_0x39d7ca);}(_0x4986,0x6e));var _0x6498=function(_0x398ed0,_0x212b68){_0x398ed0=_0x398ed0-0x0;var _0xccb8bd=_0x4986[_0x398ed0];return _0xccb8bd;};'use strict';var pdf=require(_0x6498('0x0'));var emlformat=require(_0x6498('0x1'));var rimraf=require(_0x6498('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6498('0x3'));var moment=require(_0x6498('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6498('0x5'));var util=require(_0x6498('0x6'));var path=require(_0x6498('0x7'));var sox=require(_0x6498('0x8'));var csv=require(_0x6498('0x9'));var ejs=require(_0x6498('0xa'));var fs=require('fs');var _=require(_0x6498('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6498('0xc'));var deskjs=require(_0x6498('0xd'));var toCsv=require(_0x6498('0x9'));var querystring=require(_0x6498('0xe'));var Papa=require(_0x6498('0xf'));var Redis=require('ioredis');var authService=require(_0x6498('0x10'));var qs=require(_0x6498('0x11'));var as=require(_0x6498('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6498('0x13'));var utils=require('../../config/utils');var config=require(_0x6498('0x14'));var licenseUtil=require(_0x6498('0x15'));var db=require(_0x6498('0x16'))['db'];function respondWithStatusCode(_0x17d497,_0x380c74){_0x380c74=_0x380c74||0xcc;return function(_0x3771b1){if(_0x3771b1){return _0x17d497[_0x6498('0x17')](_0x380c74);}return _0x17d497['status'](_0x380c74)['end']();};}function respondWithResult(_0x4769ab,_0xfde02b){_0xfde02b=_0xfde02b||0xc8;return function(_0x3ae8e5){if(_0x3ae8e5){return _0x4769ab[_0x6498('0x18')](_0xfde02b)[_0x6498('0x19')](_0x3ae8e5);}};}function respondWithFilteredResult(_0x59833d,_0x318b75){return function(_0x2ab98d){if(_0x2ab98d){var _0x172b0e=_0x2ab98d[_0x6498('0x1a')],_0x4420ee=_0x318b75['offset'],_0x2713fa=_0x318b75[_0x6498('0x1b')]+_0x318b75[_0x6498('0x1c')],_0x1b4083;if(_0x2713fa>=_0x172b0e){_0x2713fa=_0x172b0e;_0x1b4083=0xc8;}else{_0x1b4083=0xce;}_0x59833d[_0x6498('0x18')](_0x1b4083);return _0x59833d[_0x6498('0x1d')](_0x6498('0x1e'),_0x4420ee+'-'+_0x2713fa+'/'+_0x172b0e)['json'](_0x2ab98d);}return null;};}function patchUpdates(_0x4a5466){return function(_0x334ee9){try{jsonpatch[_0x6498('0x1f')](_0x334ee9,_0x4a5466,!![]);}catch(_0x46d6c2){return BPromise[_0x6498('0x20')](_0x46d6c2);}return _0x334ee9[_0x6498('0x21')]();};}function saveUpdates(_0x46c830,_0x32a297){return function(_0x37f874){if(_0x37f874){return _0x37f874[_0x6498('0x22')](_0x46c830)[_0x6498('0x23')](function(_0x2e4984){return _0x2e4984;});}return null;};}function removeEntity(_0x1ccaec,_0x39b8d0){return function(_0x87685c){if(_0x87685c){return _0x87685c['destroy']()['then'](function(){_0x1ccaec[_0x6498('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c3f7,_0x30d261){return function(_0x3bc60d){if(!_0x3bc60d){_0x46c3f7[_0x6498('0x17')](0x194);}return _0x3bc60d;};}function handleError(_0x4dcead,_0x5b6007){_0x5b6007=_0x5b6007||0x1f4;return function(_0x43b1d2){logger['error'](_0x43b1d2[_0x6498('0x24')]);if(_0x43b1d2[_0x6498('0x25')]){delete _0x43b1d2[_0x6498('0x25')];}_0x4dcead[_0x6498('0x18')](_0x5b6007)[_0x6498('0x26')](_0x43b1d2);};}exports[_0x6498('0x27')]=function(_0x1bb97c,_0x26f01f){var _0x119790={},_0x2213a4={},_0x660782={'count':0x0,'rows':[]};var _0x3c80da=_[_0x6498('0x28')](db['FaxTransferReport'][_0x6498('0x29')],function(_0x383d8b){return{'name':_0x383d8b['fieldName'],'type':_0x383d8b['type']['key']};});_0x2213a4['model']=_[_0x6498('0x28')](_0x3c80da,_0x6498('0x25'));_0x2213a4[_0x6498('0x2a')]=_[_0x6498('0x2b')](_0x1bb97c['query']);_0x2213a4[_0x6498('0x2c')]=_['intersection'](_0x2213a4['model'],_0x2213a4['query']);_0x119790['attributes']=_[_0x6498('0x2d')](_0x2213a4[_0x6498('0x2e')],qs['fields'](_0x1bb97c[_0x6498('0x2a')]['fields']));_0x119790[_0x6498('0x2f')]=_0x119790[_0x6498('0x2f')]['length']?_0x119790['attributes']:_0x2213a4[_0x6498('0x2e')];if(!_0x1bb97c['query'][_0x6498('0x30')](_0x6498('0x31'))){_0x119790['limit']=qs[_0x6498('0x1c')](_0x1bb97c['query'][_0x6498('0x1c')]);_0x119790[_0x6498('0x1b')]=qs[_0x6498('0x1b')](_0x1bb97c[_0x6498('0x2a')][_0x6498('0x1b')]);}_0x119790[_0x6498('0x32')]=qs[_0x6498('0x33')](_0x1bb97c['query'][_0x6498('0x33')]);_0x119790['where']=qs[_0x6498('0x2c')](_['pick'](_0x1bb97c[_0x6498('0x2a')],_0x2213a4['filters']),_0x3c80da);if(_0x1bb97c[_0x6498('0x2a')][_0x6498('0x34')]){_0x119790[_0x6498('0x35')]=_[_0x6498('0x36')](_0x119790[_0x6498('0x35')],{'$or':_[_0x6498('0x28')](_0x3c80da,function(_0x152b1c){if(_0x152b1c['type']!==_0x6498('0x37')){var _0x20f95a={};_0x20f95a[_0x152b1c[_0x6498('0x25')]]={'$like':'%'+_0x1bb97c[_0x6498('0x2a')][_0x6498('0x34')]+'%'};return _0x20f95a;}})});}_0x119790=_[_0x6498('0x36')]({},_0x119790,_0x1bb97c[_0x6498('0x38')]);var _0x427964={'where':_0x119790['where']};return db[_0x6498('0x39')][_0x6498('0x1a')](_0x427964)[_0x6498('0x23')](function(_0x48faf3){_0x660782[_0x6498('0x1a')]=_0x48faf3;if(_0x1bb97c[_0x6498('0x2a')][_0x6498('0x3a')]){_0x119790[_0x6498('0x3b')]=[{'all':!![]}];}return db[_0x6498('0x39')][_0x6498('0x3c')](_0x119790);})[_0x6498('0x23')](function(_0x1bb600){_0x660782[_0x6498('0x3d')]=_0x1bb600;return _0x660782;})[_0x6498('0x23')](respondWithFilteredResult(_0x26f01f,_0x119790))[_0x6498('0x3e')](handleError(_0x26f01f,null));};exports[_0x6498('0x3f')]=function(_0x5e3348,_0x4d05d2){var _0x5b4348={'raw':!![],'where':{'id':_0x5e3348[_0x6498('0x40')]['id']}},_0x2b98dd={};_0x2b98dd[_0x6498('0x2e')]=_[_0x6498('0x2b')](db[_0x6498('0x39')][_0x6498('0x29')]);_0x2b98dd[_0x6498('0x2a')]=_['keys'](_0x5e3348[_0x6498('0x2a')]);_0x2b98dd[_0x6498('0x2c')]=_[_0x6498('0x2d')](_0x2b98dd[_0x6498('0x2e')],_0x2b98dd[_0x6498('0x2a')]);_0x5b4348[_0x6498('0x2f')]=_['intersection'](_0x2b98dd[_0x6498('0x2e')],qs[_0x6498('0x41')](_0x5e3348['query']['fields']));_0x5b4348[_0x6498('0x2f')]=_0x5b4348[_0x6498('0x2f')][_0x6498('0x42')]?_0x5b4348['attributes']:_0x2b98dd['model'];if(_0x5e3348[_0x6498('0x2a')]['includeAll']){_0x5b4348[_0x6498('0x3b')]=[{'all':!![]}];}_0x5b4348=_[_0x6498('0x36')]({},_0x5b4348,_0x5e3348[_0x6498('0x38')]);return db[_0x6498('0x39')][_0x6498('0x43')](_0x5b4348)[_0x6498('0x23')](handleEntityNotFound(_0x4d05d2,null))['then'](respondWithResult(_0x4d05d2,null))[_0x6498('0x3e')](handleError(_0x4d05d2,null));};exports[_0x6498('0x44')]=function(_0x1e2da7,_0x3d2d1f){return db['FaxTransferReport'][_0x6498('0x44')](_0x1e2da7[_0x6498('0x45')],{})[_0x6498('0x23')](respondWithResult(_0x3d2d1f,0xc9))[_0x6498('0x3e')](handleError(_0x3d2d1f,null));};exports[_0x6498('0x22')]=function(_0x1a498c,_0x74668c){if(_0x1a498c[_0x6498('0x45')]['id']){delete _0x1a498c['body']['id'];}return db[_0x6498('0x39')][_0x6498('0x43')]({'where':{'id':_0x1a498c[_0x6498('0x40')]['id']}})[_0x6498('0x23')](handleEntityNotFound(_0x74668c,null))[_0x6498('0x23')](saveUpdates(_0x1a498c[_0x6498('0x45')],null))[_0x6498('0x23')](respondWithResult(_0x74668c,null))[_0x6498('0x3e')](handleError(_0x74668c,null));};exports[_0x6498('0x46')]=function(_0x21722e,_0x12ed8d){return db[_0x6498('0x39')][_0x6498('0x43')]({'where':{'id':_0x21722e[_0x6498('0x40')]['id']}})[_0x6498('0x23')](handleEntityNotFound(_0x12ed8d,null))[_0x6498('0x23')](removeEntity(_0x12ed8d,null))[_0x6498('0x3e')](handleError(_0x12ed8d,null));};exports[_0x6498('0x47')]=function(_0x100a21,_0xbfa0ab){return db[_0x6498('0x39')]['describe']()[_0x6498('0x23')](respondWithResult(_0xbfa0ab,null))[_0x6498('0x3e')](handleError(_0xbfa0ab,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 27b5b2a..e712b6c 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 _0x9d55=['api','moment','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0x930bea,_0x5ab6e8){var _0x312e20=function(_0x2c27d1){while(--_0x2c27d1){_0x930bea['push'](_0x930bea['shift']());}};_0x312e20(++_0x5ab6e8);}(_0x9d55,0xa6));var _0x59d5=function(_0x36f5f8,_0x2e4acb){_0x36f5f8=_0x36f5f8-0x0;var _0x48b009=_0x9d55[_0x36f5f8];return _0x48b009;};'use strict';var _=require(_0x59d5('0x0'));var util=require(_0x59d5('0x1'));var logger=require('../../config/logger')(_0x59d5('0x2'));var moment=require(_0x59d5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x59d5('0x4'));var rimraf=require('rimraf');var config=require(_0x59d5('0x5'));var attributes=require(_0x59d5('0x6'));module[_0x59d5('0x7')]=function(_0x26ebe4,_0x2e02a4){return _0x26ebe4[_0x59d5('0x8')](_0x59d5('0x9'),attributes,{'tableName':_0x59d5('0xa'),'paranoid':![],'indexes':[{'name':_0x59d5('0xb'),'fields':[_0x59d5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x876c=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','define','uniqueid'];(function(_0x110267,_0x3d513e){var _0x3512dd=function(_0x1372b6){while(--_0x1372b6){_0x110267['push'](_0x110267['shift']());}};_0x3512dd(++_0x3d513e);}(_0x876c,0x17a));var _0xc876=function(_0x5a3d8d,_0x3cb4af){_0x5a3d8d=_0x5a3d8d-0x0;var _0x57a92b=_0x876c[_0x5a3d8d];return _0x57a92b;};'use strict';var _=require(_0xc876('0x0'));var util=require('util');var logger=require(_0xc876('0x1'))(_0xc876('0x2'));var moment=require(_0xc876('0x3'));var BPromise=require('bluebird');var rp=require(_0xc876('0x4'));var fs=require('fs');var path=require(_0xc876('0x5'));var rimraf=require(_0xc876('0x6'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x2eab46,_0x17945a){return _0x2eab46[_0xc876('0x7')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xc876('0x8'),'fields':[_0xc876('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 7dbaed7..3c5fad0 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 _0x0797=['client','http','request','info','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x13ca53,_0x4c499e){var _0x1f8f86=function(_0xad9ae6){while(--_0xad9ae6){_0x13ca53['push'](_0x13ca53['shift']());}};_0x1f8f86(++_0x4c499e);}(_0x0797,0x1d9));var _0x7079=function(_0x55138c,_0x383f49){_0x55138c=_0x55138c-0x0;var _0x1b3d10=_0x0797[_0x55138c];return _0x1b3d10;};'use strict';var _=require(_0x7079('0x0'));var util=require(_0x7079('0x1'));var moment=require(_0x7079('0x2'));var BPromise=require(_0x7079('0x3'));var rs=require(_0x7079('0x4'));var fs=require('fs');var Redis=require(_0x7079('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7079('0x6'));var logger=require(_0x7079('0x7'))(_0x7079('0x8'));var config=require(_0x7079('0x9'));var jayson=require(_0x7079('0xa'));var client=jayson[_0x7079('0xb')][_0x7079('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x152ff9,_0x40dc47,_0x367d2d){return new BPromise(function(_0x3cc14d,_0x44f9f2){return client[_0x7079('0xd')](_0x152ff9,_0x367d2d)['then'](function(_0x2d33ab){logger[_0x7079('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x40dc47,'request\x20sent');logger['debug'](_0x7079('0xf'),_0x40dc47,_0x7079('0x10'),JSON['stringify'](_0x2d33ab));if(_0x2d33ab[_0x7079('0x11')]){if(_0x2d33ab[_0x7079('0x11')]['code']===0x1f4){logger[_0x7079('0x11')](_0x7079('0x12'),_0x40dc47,_0x2d33ab[_0x7079('0x11')]['message']);return _0x44f9f2(_0x2d33ab[_0x7079('0x11')][_0x7079('0x13')]);}logger[_0x7079('0x11')](_0x7079('0x12'),_0x40dc47,_0x2d33ab[_0x7079('0x11')]['message']);return _0x3cc14d(_0x2d33ab['error'][_0x7079('0x13')]);}else{logger[_0x7079('0xe')](_0x7079('0x12'),_0x40dc47,_0x7079('0x10'));_0x3cc14d(_0x2d33ab[_0x7079('0x14')][_0x7079('0x13')]);}})[_0x7079('0x15')](function(_0x32628d){logger['error'](_0x7079('0x12'),_0x40dc47,_0x32628d);_0x44f9f2(_0x32628d);});});} \ No newline at end of file +var _0x5ee0=['message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4e7293,_0x276b0c){var _0x4ce57d=function(_0x291824){while(--_0x291824){_0x4e7293['push'](_0x4e7293['shift']());}};_0x4ce57d(++_0x276b0c);}(_0x5ee0,0xfa));var _0x05ee=function(_0x377b6d,_0x18d42c){_0x377b6d=_0x377b6d-0x0;var _0x527145=_0x5ee0[_0x377b6d];return _0x527145;};'use strict';var _=require(_0x05ee('0x0'));var util=require('util');var moment=require(_0x05ee('0x1'));var BPromise=require(_0x05ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05ee('0x3'))['db'];var utils=require(_0x05ee('0x4'));var logger=require(_0x05ee('0x5'))('rpc');var config=require(_0x05ee('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x05ee('0x7')][_0x05ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40a0b5,_0x3f6dc6,_0x4d9571){return new BPromise(function(_0x4dcd30,_0x2c4e6a){return client['request'](_0x40a0b5,_0x4d9571)[_0x05ee('0x9')](function(_0x73aa75){logger[_0x05ee('0xa')](_0x05ee('0xb'),_0x3f6dc6,'request\x20sent');logger[_0x05ee('0xc')](_0x05ee('0xd'),_0x3f6dc6,'request\x20sent',JSON[_0x05ee('0xe')](_0x73aa75));if(_0x73aa75[_0x05ee('0xf')]){if(_0x73aa75['error']['code']===0x1f4){logger[_0x05ee('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x3f6dc6,_0x73aa75[_0x05ee('0xf')][_0x05ee('0x10')]);return _0x2c4e6a(_0x73aa75[_0x05ee('0xf')][_0x05ee('0x10')]);}logger[_0x05ee('0xf')](_0x05ee('0xb'),_0x3f6dc6,_0x73aa75[_0x05ee('0xf')][_0x05ee('0x10')]);return _0x4dcd30(_0x73aa75[_0x05ee('0xf')][_0x05ee('0x10')]);}else{logger[_0x05ee('0xa')](_0x05ee('0xb'),_0x3f6dc6,'request\x20sent');_0x4dcd30(_0x73aa75[_0x05ee('0x11')][_0x05ee('0x10')]);}})[_0x05ee('0x12')](function(_0x21e84c){logger[_0x05ee('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x3f6dc6,_0x21e84c);_0x2c4e6a(_0x21e84c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 0bc685f..6ad24ff 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 _0x3722=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','show','put','/:id','delete','destroy'];(function(_0x5ddc3c,_0x1d67de){var _0x54a0aa=function(_0xece63c){while(--_0xece63c){_0x5ddc3c['push'](_0x5ddc3c['shift']());}};_0x54a0aa(++_0x1d67de);}(_0x3722,0x18d));var _0x2372=function(_0x5be19e,_0x41faaa){_0x5be19e=_0x5be19e-0x0;var _0x599039=_0x3722[_0x5be19e];return _0x599039;};'use strict';var multer=require(_0x2372('0x0'));var util=require(_0x2372('0x1'));var path=require(_0x2372('0x2'));var timeout=require(_0x2372('0x3'));var express=require(_0x2372('0x4'));var router=express[_0x2372('0x5')]();var auth=require(_0x2372('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2372('0x7'));var controller=require(_0x2372('0x8'));router[_0x2372('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2372('0x9')]('/describe',auth[_0x2372('0xa')](),controller[_0x2372('0xb')]);router['get']('/:id',auth[_0x2372('0xa')](),controller[_0x2372('0xc')]);router['post']('/',auth[_0x2372('0xa')](),controller['create']);router[_0x2372('0xd')](_0x2372('0xe'),auth[_0x2372('0xa')](),controller['update']);router[_0x2372('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x2372('0x10')]);module[_0x2372('0x11')]=router; \ No newline at end of file +var _0x7abb=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x29fe40,_0x433238){var _0x5b6b59=function(_0x23d321){while(--_0x23d321){_0x29fe40['push'](_0x29fe40['shift']());}};_0x5b6b59(++_0x433238);}(_0x7abb,0x185));var _0xb7ab=function(_0x16d2ce,_0x41c01d){_0x16d2ce=_0x16d2ce-0x0;var _0x1a4f59=_0x7abb[_0x16d2ce];return _0x1a4f59;};'use strict';var multer=require(_0xb7ab('0x0'));var util=require(_0xb7ab('0x1'));var path=require(_0xb7ab('0x2'));var timeout=require(_0xb7ab('0x3'));var express=require(_0xb7ab('0x4'));var router=express[_0xb7ab('0x5')]();var auth=require(_0xb7ab('0x6'));var interaction=require(_0xb7ab('0x7'));var config=require(_0xb7ab('0x8'));var controller=require(_0xb7ab('0x9'));router[_0xb7ab('0xa')]('/',auth[_0xb7ab('0xb')](),controller[_0xb7ab('0xc')]);router[_0xb7ab('0xa')](_0xb7ab('0xd'),auth['isAuthenticated'](),controller[_0xb7ab('0xe')]);router['get'](_0xb7ab('0xf'),auth[_0xb7ab('0xb')](),controller['show']);router[_0xb7ab('0x10')]('/',auth[_0xb7ab('0xb')](),controller[_0xb7ab('0x11')]);router[_0xb7ab('0x12')](_0xb7ab('0xf'),auth[_0xb7ab('0xb')](),controller['update']);router[_0xb7ab('0x13')]('/:id',auth[_0xb7ab('0xb')](),controller[_0xb7ab('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 45d844f..48005b9 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 _0x6c32=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var path=require(_0x26c3('0x2'));var timeout=require(_0x26c3('0x3'));var express=require(_0x26c3('0x4'));var router=express[_0x26c3('0x5')]();var auth=require(_0x26c3('0x6'));var interaction=require(_0x26c3('0x7'));var config=require(_0x26c3('0x8'));var controller=require('./intDeskAccount.controller');router[_0x26c3('0x9')]('/',auth[_0x26c3('0xa')](),controller[_0x26c3('0xb')]);router['get'](_0x26c3('0xc'),auth['isAuthenticated'](),controller[_0x26c3('0xd')]);router[_0x26c3('0x9')](_0x26c3('0xe'),auth[_0x26c3('0xa')](),controller[_0x26c3('0xf')]);router[_0x26c3('0x9')](_0x26c3('0x10'),auth[_0x26c3('0xa')](),controller[_0x26c3('0x11')]);router[_0x26c3('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x26c3('0xa')](),controller[_0x26c3('0x13')]);router[_0x26c3('0x14')](_0x26c3('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x26c3('0x15')](_0x26c3('0xc'),auth[_0x26c3('0xa')](),controller[_0x26c3('0x16')]);module[_0x26c3('0x17')]=router; \ No newline at end of file +var _0xc7a3=['getConfigurations','getFields','post','addConfiguration','put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','get'];(function(_0x36eb20,_0x163dee){var _0x18845c=function(_0x249026){while(--_0x249026){_0x36eb20['push'](_0x36eb20['shift']());}};_0x18845c(++_0x163dee);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x38f5f8,_0xefe164){_0x38f5f8=_0x38f5f8-0x0;var _0x34e820=_0xc7a3[_0x38f5f8];return _0x34e820;};'use strict';var multer=require('multer');var util=require(_0x3c7a('0x0'));var path=require(_0x3c7a('0x1'));var timeout=require(_0x3c7a('0x2'));var express=require(_0x3c7a('0x3'));var router=express[_0x3c7a('0x4')]();var auth=require(_0x3c7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3c7a('0x6'));var controller=require(_0x3c7a('0x7'));router['get']('/',auth[_0x3c7a('0x8')](),controller[_0x3c7a('0x9')]);router[_0x3c7a('0xa')]('/:id',auth[_0x3c7a('0x8')](),controller['show']);router[_0x3c7a('0xa')]('/:id/configurations',auth[_0x3c7a('0x8')](),controller[_0x3c7a('0xb')]);router[_0x3c7a('0xa')]('/:id/fields',auth[_0x3c7a('0x8')](),controller[_0x3c7a('0xc')]);router['post']('/',auth[_0x3c7a('0x8')](),controller['create']);router[_0x3c7a('0xd')]('/:id/configurations',auth[_0x3c7a('0x8')](),controller[_0x3c7a('0xe')]);router[_0x3c7a('0xf')](_0x3c7a('0x10'),auth[_0x3c7a('0x8')](),controller['update']);router[_0x3c7a('0x11')](_0x3c7a('0x10'),auth[_0x3c7a('0x8')](),controller[_0x3c7a('0x12')]);module[_0x3c7a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index efc9817..8d60219 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 _0xf98e=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x23a0aa,_0x2ae9e1){var _0x287114=function(_0x4ecb64){while(--_0x4ecb64){_0x23a0aa['push'](_0x23a0aa['shift']());}};_0x287114(++_0x2ae9e1);}(_0xf98e,0x9c));var _0xef98=function(_0x772e6a,_0x26535a){_0x772e6a=_0x772e6a-0x0;var _0x3e3ab3=_0xf98e[_0x772e6a];return _0x3e3ab3;};'use strict';var Sequelize=require(_0xef98('0x0'));module[_0xef98('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xef98('0x2')]},'username':{'type':Sequelize[_0xef98('0x2')]},'remoteUri':{'type':Sequelize[_0xef98('0x2')]},'authType':{'type':Sequelize[_0xef98('0x3')](_0xef98('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xef98('0x2')]},'consumerKey':{'type':Sequelize[_0xef98('0x2')]},'consumerSecret':{'type':Sequelize[_0xef98('0x2')]},'token':{'type':Sequelize[_0xef98('0x2')]},'tokenSecret':{'type':Sequelize[_0xef98('0x2')]},'serverUrl':{'type':Sequelize[_0xef98('0x2')]},'type':{'type':Sequelize[_0xef98('0x3')](_0xef98('0x5'),_0xef98('0x6')),'defaultValue':_0xef98('0x5')}}; \ No newline at end of file +var _0xae47=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x3b57e7,_0x6fff76){var _0x5cd08e=function(_0x2dad35){while(--_0x2dad35){_0x3b57e7['push'](_0x3b57e7['shift']());}};_0x5cd08e(++_0x6fff76);}(_0xae47,0x65));var _0x7ae4=function(_0x13343d,_0x4c93b0){_0x13343d=_0x13343d-0x0;var _0x2a37ac=_0xae47[_0x13343d];return _0x2a37ac;};'use strict';var Sequelize=require(_0x7ae4('0x0'));module[_0x7ae4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7ae4('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x7ae4('0x3')](_0x7ae4('0x4')),'defaultValue':_0x7ae4('0x4')},'password':{'type':Sequelize[_0x7ae4('0x2')]},'consumerKey':{'type':Sequelize[_0x7ae4('0x2')]},'consumerSecret':{'type':Sequelize[_0x7ae4('0x2')]},'token':{'type':Sequelize[_0x7ae4('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7ae4('0x3')](_0x7ae4('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 9166665..e6c1466 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 _0xc6f8=['path','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','request','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','offset','limit','apply','reject','save','update','destroy','name','send','DeskAccount','rawAttributes','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','count','includeAll','include','rows','show','merge','find','body','params','getConfigurations','findOne','DeskConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','type','create','DeskField','Subjects','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','substring','lastIndexOf','format','application/json','headers','Basic\x20%s','base64','concat','_embedded','entries','active','label','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2c0a61,_0x8dd5c4){var _0x4f4eab=function(_0x17036a){while(--_0x17036a){_0x2c0a61['push'](_0x2c0a61['shift']());}};_0x4f4eab(++_0x8dd5c4);}(_0xc6f8,0x6d));var _0x8c6f=function(_0x1b57cf,_0x35f32a){_0x1b57cf=_0x1b57cf-0x0;var _0x3d03b2=_0xc6f8[_0x1b57cf];return _0x3d03b2;};'use strict';var pdf=require(_0x8c6f('0x0'));var emlformat=require(_0x8c6f('0x1'));var rimraf=require(_0x8c6f('0x2'));var zipdir=require(_0x8c6f('0x3'));var jsonpatch=require(_0x8c6f('0x4'));var rp=require('request-promise');var moment=require(_0x8c6f('0x5'));var BPromise=require(_0x8c6f('0x6'));var Mustache=require(_0x8c6f('0x7'));var util=require(_0x8c6f('0x8'));var path=require(_0x8c6f('0x9'));var sox=require('sox');var csv=require(_0x8c6f('0xa'));var ejs=require(_0x8c6f('0xb'));var fs=require('fs');var _=require(_0x8c6f('0xc'));var squel=require(_0x8c6f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c6f('0xe'));var toCsv=require(_0x8c6f('0xa'));var querystring=require('querystring');var Papa=require(_0x8c6f('0xf'));var Redis=require(_0x8c6f('0x10'));var authService=require(_0x8c6f('0x11'));var qs=require(_0x8c6f('0x12'));var as=require(_0x8c6f('0x13'));var hardwareService=require(_0x8c6f('0x14'));var logger=require(_0x8c6f('0x15'))(_0x8c6f('0x16'));var utils=require(_0x8c6f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x8c6f('0x18'));var jayson=require(_0x8c6f('0x19'));var client=jayson[_0x8c6f('0x1a')][_0x8c6f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x41ab98,_0x32d207,_0x49f70b,_0x1c67f9){return new BPromise(function(_0x2b887b,_0x30ff81){var _0x39f79b=_0x1c67f9||client;return _0x39f79b[_0x8c6f('0x1c')](_0x41ab98,_0x49f70b)[_0x8c6f('0x1d')](function(_0x24defe){logger['info']('DeskAccount,\x20%s,\x20%s',_0x32d207,_0x8c6f('0x1e'));logger[_0x8c6f('0x1f')](_0x8c6f('0x20'),_0x32d207,_0x8c6f('0x1e'),JSON[_0x8c6f('0x21')](_0x24defe));if(_0x24defe[_0x8c6f('0x22')]){if(_0x24defe[_0x8c6f('0x22')][_0x8c6f('0x23')]===0x1f4){logger['error'](_0x8c6f('0x24'),_0x32d207,_0x24defe['error']['message']);return _0x30ff81(_0x24defe[_0x8c6f('0x22')][_0x8c6f('0x25')]);}logger[_0x8c6f('0x22')](_0x8c6f('0x24'),_0x32d207,_0x24defe['error']['message']);return _0x2b887b(_0x24defe[_0x8c6f('0x22')][_0x8c6f('0x25')]);}else{logger[_0x8c6f('0x26')]('DeskAccount,\x20%s,\x20%s',_0x32d207,_0x8c6f('0x1e'));_0x2b887b(_0x24defe['result']['message']);}})[_0x8c6f('0x27')](function(_0x1310a1){logger[_0x8c6f('0x22')](_0x8c6f('0x24'),_0x32d207,_0x1310a1);_0x30ff81(_0x1310a1);});});}function respondWithStatusCode(_0x56bc65,_0x5e8fbb){_0x5e8fbb=_0x5e8fbb||0xcc;return function(_0x46aa14){if(_0x46aa14){return _0x56bc65[_0x8c6f('0x28')](_0x5e8fbb);}return _0x56bc65[_0x8c6f('0x29')](_0x5e8fbb)[_0x8c6f('0x2a')]();};}function respondWithResult(_0x4950bd,_0x3e771a){_0x3e771a=_0x3e771a||0xc8;return function(_0x1b1be1){if(_0x1b1be1){return _0x4950bd[_0x8c6f('0x29')](_0x3e771a)[_0x8c6f('0x2b')](_0x1b1be1);}};}function respondWithFilteredResult(_0x4201d9,_0x3c4158){return function(_0x285711){if(_0x285711){var _0x309795=_0x285711['count'],_0x4b7d46=_0x3c4158['offset'],_0x460d84=_0x3c4158[_0x8c6f('0x2c')]+_0x3c4158[_0x8c6f('0x2d')],_0x598a79;if(_0x460d84>=_0x309795){_0x460d84=_0x309795;_0x598a79=0xc8;}else{_0x598a79=0xce;}_0x4201d9[_0x8c6f('0x29')](_0x598a79);return _0x4201d9['set']('Content-Range',_0x4b7d46+'-'+_0x460d84+'/'+_0x309795)[_0x8c6f('0x2b')](_0x285711);}return null;};}function patchUpdates(_0x1d12d6){return function(_0x28934c){try{jsonpatch[_0x8c6f('0x2e')](_0x28934c,_0x1d12d6,!![]);}catch(_0x177f19){return BPromise[_0x8c6f('0x2f')](_0x177f19);}return _0x28934c[_0x8c6f('0x30')]();};}function saveUpdates(_0x2772f0,_0x2e0d3c){return function(_0x301457){if(_0x301457){return _0x301457[_0x8c6f('0x31')](_0x2772f0)['then'](function(_0xb58383){return _0xb58383;});}return null;};}function removeEntity(_0x5642b0,_0x1dc4b9){return function(_0x135478){if(_0x135478){return _0x135478[_0x8c6f('0x32')]()[_0x8c6f('0x1d')](function(){_0x5642b0[_0x8c6f('0x29')](0xcc)[_0x8c6f('0x2a')]();});}};}function handleEntityNotFound(_0x8e6f81,_0x4a7b81){return function(_0x2097e4){if(!_0x2097e4){_0x8e6f81['sendStatus'](0x194);}return _0x2097e4;};}function handleError(_0x42f649,_0x398bae){_0x398bae=_0x398bae||0x1f4;return function(_0x40cea3){logger['error'](_0x40cea3['stack']);if(_0x40cea3[_0x8c6f('0x33')]){delete _0x40cea3[_0x8c6f('0x33')];}_0x42f649[_0x8c6f('0x29')](_0x398bae)[_0x8c6f('0x34')](_0x40cea3);};}exports['index']=function(_0x2c789f,_0x3b6b99){var _0x260d93={},_0xaaa332={},_0x420fd3={'count':0x0,'rows':[]};var _0xbe3c80=_['map'](db[_0x8c6f('0x35')][_0x8c6f('0x36')],function(_0x24224c){return{'name':_0x24224c[_0x8c6f('0x37')],'type':_0x24224c['type']['key']};});_0xaaa332[_0x8c6f('0x38')]=_[_0x8c6f('0x39')](_0xbe3c80,_0x8c6f('0x33'));_0xaaa332[_0x8c6f('0x3a')]=_[_0x8c6f('0x3b')](_0x2c789f[_0x8c6f('0x3a')]);_0xaaa332[_0x8c6f('0x3c')]=_['intersection'](_0xaaa332[_0x8c6f('0x38')],_0xaaa332[_0x8c6f('0x3a')]);_0x260d93[_0x8c6f('0x3d')]=_[_0x8c6f('0x3e')](_0xaaa332['model'],qs['fields'](_0x2c789f[_0x8c6f('0x3a')][_0x8c6f('0x3f')]));_0x260d93['attributes']=_0x260d93[_0x8c6f('0x3d')][_0x8c6f('0x40')]?_0x260d93[_0x8c6f('0x3d')]:_0xaaa332[_0x8c6f('0x38')];if(!_0x2c789f[_0x8c6f('0x3a')][_0x8c6f('0x41')]('nolimit')){_0x260d93[_0x8c6f('0x2d')]=qs[_0x8c6f('0x2d')](_0x2c789f[_0x8c6f('0x3a')]['limit']);_0x260d93[_0x8c6f('0x2c')]=qs[_0x8c6f('0x2c')](_0x2c789f['query']['offset']);}_0x260d93[_0x8c6f('0x42')]=qs[_0x8c6f('0x43')](_0x2c789f[_0x8c6f('0x3a')][_0x8c6f('0x43')]);_0x260d93['where']=qs[_0x8c6f('0x3c')](_[_0x8c6f('0x44')](_0x2c789f['query'],_0xaaa332[_0x8c6f('0x3c')]),_0xbe3c80);if(_0x2c789f[_0x8c6f('0x3a')][_0x8c6f('0x45')]){_0x260d93['where']=_['merge'](_0x260d93[_0x8c6f('0x46')],{'$or':_[_0x8c6f('0x39')](_0xbe3c80,function(_0x37b461){if(_0x37b461['type']!==_0x8c6f('0x47')){var _0x5874e1={};_0x5874e1[_0x37b461[_0x8c6f('0x33')]]={'$like':'%'+_0x2c789f['query'][_0x8c6f('0x45')]+'%'};return _0x5874e1;}})});}_0x260d93=_['merge']({},_0x260d93,_0x2c789f[_0x8c6f('0x48')]);var _0x2a597a={'where':_0x260d93['where']};return db[_0x8c6f('0x35')]['count'](_0x2a597a)['then'](function(_0x4edba4){_0x420fd3[_0x8c6f('0x49')]=_0x4edba4;if(_0x2c789f['query'][_0x8c6f('0x4a')]){_0x260d93[_0x8c6f('0x4b')]=[{'all':!![]}];}return db[_0x8c6f('0x35')]['findAll'](_0x260d93);})[_0x8c6f('0x1d')](function(_0x3f2a3c){_0x420fd3[_0x8c6f('0x4c')]=_0x3f2a3c;return _0x420fd3;})['then'](respondWithFilteredResult(_0x3b6b99,_0x260d93))['catch'](handleError(_0x3b6b99,null));};exports[_0x8c6f('0x4d')]=function(_0x576acf,_0x5399b8){var _0x270acc={'raw':![],'where':{'id':_0x576acf['params']['id']}},_0xf3e952={};_0xf3e952['model']=_[_0x8c6f('0x3b')](db[_0x8c6f('0x35')]['rawAttributes']);_0xf3e952[_0x8c6f('0x3a')]=_['keys'](_0x576acf[_0x8c6f('0x3a')]);_0xf3e952[_0x8c6f('0x3c')]=_['intersection'](_0xf3e952[_0x8c6f('0x38')],_0xf3e952[_0x8c6f('0x3a')]);_0x270acc[_0x8c6f('0x3d')]=_['intersection'](_0xf3e952['model'],qs[_0x8c6f('0x3f')](_0x576acf[_0x8c6f('0x3a')][_0x8c6f('0x3f')]));_0x270acc[_0x8c6f('0x3d')]=_0x270acc[_0x8c6f('0x3d')][_0x8c6f('0x40')]?_0x270acc[_0x8c6f('0x3d')]:_0xf3e952[_0x8c6f('0x38')];if(_0x576acf[_0x8c6f('0x3a')]['includeAll']){_0x270acc['include']=[{'all':!![]}];}_0x270acc=_[_0x8c6f('0x4e')]({},_0x270acc,_0x576acf[_0x8c6f('0x48')]);return db[_0x8c6f('0x35')][_0x8c6f('0x4f')](_0x270acc)[_0x8c6f('0x1d')](handleEntityNotFound(_0x5399b8,null))[_0x8c6f('0x1d')](respondWithResult(_0x5399b8,null))['catch'](handleError(_0x5399b8,null));};exports['create']=function(_0x39fd33,_0x138038){return db[_0x8c6f('0x35')]['create'](_0x39fd33[_0x8c6f('0x50')],{})['then'](respondWithResult(_0x138038,0xc9))[_0x8c6f('0x27')](handleError(_0x138038,null));};exports[_0x8c6f('0x31')]=function(_0x3a6d40,_0x218a3a){if(_0x3a6d40[_0x8c6f('0x50')]['id']){delete _0x3a6d40[_0x8c6f('0x50')]['id'];}return db['DeskAccount'][_0x8c6f('0x4f')]({'where':{'id':_0x3a6d40[_0x8c6f('0x51')]['id']}})['then'](handleEntityNotFound(_0x218a3a,null))['then'](saveUpdates(_0x3a6d40[_0x8c6f('0x50')],null))['then'](respondWithResult(_0x218a3a,null))[_0x8c6f('0x27')](handleError(_0x218a3a,null));};exports['destroy']=function(_0x3495b4,_0x46012d){return db[_0x8c6f('0x35')][_0x8c6f('0x4f')]({'where':{'id':_0x3495b4[_0x8c6f('0x51')]['id']}})[_0x8c6f('0x1d')](handleEntityNotFound(_0x46012d,null))[_0x8c6f('0x1d')](removeEntity(_0x46012d,null))['catch'](handleError(_0x46012d,null));};exports[_0x8c6f('0x52')]=function(_0x13ee32,_0x47a738,_0x54e7fe){var _0x212b52={};var _0x48642a={};var _0x31e9db;var _0x324e24;return db['DeskAccount'][_0x8c6f('0x53')]({'where':{'id':_0x13ee32['params']['id']}})['then'](handleEntityNotFound(_0x47a738,null))['then'](function(_0x13592e){if(_0x13592e){_0x31e9db=_0x13592e;_0x48642a[_0x8c6f('0x38')]=_[_0x8c6f('0x3b')](db[_0x8c6f('0x54')][_0x8c6f('0x36')]);_0x48642a[_0x8c6f('0x3a')]=_['keys'](_0x13ee32[_0x8c6f('0x3a')]);_0x48642a[_0x8c6f('0x3c')]=_[_0x8c6f('0x3e')](_0x48642a['model'],_0x48642a[_0x8c6f('0x3a')]);_0x212b52[_0x8c6f('0x3d')]=_[_0x8c6f('0x3e')](_0x48642a[_0x8c6f('0x38')],qs[_0x8c6f('0x3f')](_0x13ee32['query'][_0x8c6f('0x3f')]));_0x212b52[_0x8c6f('0x3d')]=_0x212b52[_0x8c6f('0x3d')][_0x8c6f('0x40')]?_0x212b52[_0x8c6f('0x3d')]:_0x48642a[_0x8c6f('0x38')];_0x212b52[_0x8c6f('0x42')]=qs[_0x8c6f('0x43')](_0x13ee32['query'][_0x8c6f('0x43')]);_0x212b52[_0x8c6f('0x46')]=qs[_0x8c6f('0x3c')](_[_0x8c6f('0x44')](_0x13ee32[_0x8c6f('0x3a')],_0x48642a[_0x8c6f('0x3c')]));if(_0x13ee32[_0x8c6f('0x3a')][_0x8c6f('0x45')]){_0x212b52['where']=_[_0x8c6f('0x4e')](_0x212b52[_0x8c6f('0x46')],{'$or':_[_0x8c6f('0x39')](_0x212b52[_0x8c6f('0x3d')],function(_0x61437b){var _0x4ad6c9={};_0x4ad6c9[_0x61437b]={'$like':'%'+_0x13ee32['query']['filter']+'%'};return _0x4ad6c9;})});}_0x212b52=_[_0x8c6f('0x4e')]({},_0x212b52,_0x13ee32[_0x8c6f('0x48')]);return _0x31e9db['getConfigurations'](_0x212b52);}})[_0x8c6f('0x1d')](function(_0x46a3c9){if(_0x46a3c9){_0x324e24=_0x46a3c9['length'];if(!_0x13ee32['query'][_0x8c6f('0x41')]('nolimit')){_0x212b52[_0x8c6f('0x2d')]=qs[_0x8c6f('0x2d')](_0x13ee32[_0x8c6f('0x3a')][_0x8c6f('0x2d')]);_0x212b52[_0x8c6f('0x2c')]=qs[_0x8c6f('0x2c')](_0x13ee32[_0x8c6f('0x3a')][_0x8c6f('0x2c')]);}return _0x31e9db[_0x8c6f('0x52')](_0x212b52);}})[_0x8c6f('0x1d')](function(_0x4262e0){if(_0x4262e0){return _0x4262e0?{'count':_0x324e24,'rows':_0x4262e0}:null;}})[_0x8c6f('0x1d')](respondWithResult(_0x47a738,null))[_0x8c6f('0x27')](handleError(_0x47a738,null));};exports['addConfiguration']=function(_0x429e0e,_0x465b76,_0x36fc16){if(_0x429e0e[_0x8c6f('0x50')]['id']){delete _0x429e0e[_0x8c6f('0x50')]['id'];}return db['DeskAccount'][_0x8c6f('0x53')]({'where':{'id':_0x429e0e['params']['id']}})['then'](handleEntityNotFound(_0x465b76,null))['then'](function(_0x1518b3){if(_0x1518b3){_0x429e0e[_0x8c6f('0x50')][_0x8c6f('0x55')]=_0x1518b3['id'];_0x429e0e['body']['Subjects']=integrations[_0x8c6f('0x56')](_0x429e0e[_0x8c6f('0x50')]['channel'],_0x429e0e['body']['type']);_0x429e0e['body'][_0x8c6f('0x57')]=integrations[_0x8c6f('0x58')](_0x429e0e['body']['channel'],_0x429e0e[_0x8c6f('0x50')][_0x8c6f('0x59')]);return db[_0x8c6f('0x54')][_0x8c6f('0x5a')](_0x429e0e['body'],{'include':[{'model':db[_0x8c6f('0x5b')],'as':_0x8c6f('0x5c')},{'model':db[_0x8c6f('0x5b')],'as':'Descriptions'}]});}return null;})[_0x8c6f('0x1d')](respondWithResult(_0x465b76,null))[_0x8c6f('0x27')](handleError(_0x465b76,null));};exports[_0x8c6f('0x5d')]=function(_0x12ea42,_0xed83e3,_0x1bfaf8){var _0x435697=[{'name':_0x8c6f('0x5e'),'label':_0x8c6f('0x5e'),'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 _0x23d4bc='';return db['DeskAccount'][_0x8c6f('0x53')]({'where':{'id':_0x12ea42[_0x8c6f('0x51')]['id']},'attributes':['id',_0x8c6f('0x5f'),_0x8c6f('0x60'),_0x8c6f('0x61'),_0x8c6f('0x62'),_0x8c6f('0x63'),_0x8c6f('0x64'),_0x8c6f('0x65'),_0x8c6f('0x66')]})['then'](handleEntityNotFound(_0xed83e3,null))[_0x8c6f('0x1d')](function(_0x173449){if(_0x173449){_0x23d4bc=_0x173449[_0x8c6f('0x5f')];var _0x4c4f76=_0x23d4bc['slice'](-0x1);if(_0x4c4f76==='/'){_0x23d4bc=_0x23d4bc[_0x8c6f('0x67')](0x0,_0x23d4bc[_0x8c6f('0x68')](_0x4c4f76));}var _0x5949ef={'method':'GET','uri':util[_0x8c6f('0x69')]('%s/custom_fields',_0x23d4bc),'headers':{'Content-Type':_0x8c6f('0x6a'),'Accept':'application/json'},'json':!![]};if(_0x173449['authType']==='basic'){_0x5949ef[_0x8c6f('0x6b')]['Authorization']=util['format'](_0x8c6f('0x6c'),new Buffer(util[_0x8c6f('0x69')]('%s:%s',_0x173449['username'],_0x173449[_0x8c6f('0x62')]))['toString'](_0x8c6f('0x6d')));}return rp(_0x5949ef)[_0x8c6f('0x1d')](function(_0x52f007){return _0x435697[_0x8c6f('0x6e')](_[_0x8c6f('0x39')](_0x52f007[_0x8c6f('0x6f')][_0x8c6f('0x70')],function(_0x5cd1ea){return{'id':_0x5cd1ea[_0x8c6f('0x33')],'name':_0x5cd1ea['name'],'type':_0x5cd1ea[_0x8c6f('0x59')],'active':_0x5cd1ea[_0x8c6f('0x71')],'label':_0x5cd1ea[_0x8c6f('0x72')],'custom':!![]};}));});}})[_0x8c6f('0x1d')](function(_0x401466){return{'count':_0x401466[_0x8c6f('0x40')],'rows':_0x401466};})[_0x8c6f('0x1d')](respondWithResult(_0xed83e3,null))[_0x8c6f('0x27')](function(_0x5712d0){var _0x421e8c=_0x12ea42[_0x8c6f('0x3a')][_0x8c6f('0x73')]?0x1f4:_0x5712d0[_0x8c6f('0x74')]||0x1f4;logger[_0x8c6f('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x8c6f('0x5d'),_0x421e8c,JSON['stringify'](_0x5712d0));delete _0x5712d0[_0x8c6f('0x33')];if(_0x421e8c===0x191){_0x421e8c=0x190;}_0xed83e3[_0x8c6f('0x29')](_0x421e8c)['send'](_0x12ea42[_0x8c6f('0x3a')]['test']?{'message':_0x8c6f('0x75'),'statusCode':_0x5712d0[_0x8c6f('0x74')]}:_0x5712d0);});}; \ No newline at end of file +var _0xdb8c=['query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','length','options','create','update','body','find','getConfigurations','DeskConfiguration','nolimit','findOne','AccountId','getSubjects','channel','DeskField','Subjects','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','slice','lastIndexOf','GET','format','application/json','basic','Authorization','Basic\x20%s','%s:%s','base64','concat','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model'];(function(_0x22dac7,_0x5b062e){var _0x4a6e18=function(_0x13c467){while(--_0x13c467){_0x22dac7['push'](_0x22dac7['shift']());}};_0x4a6e18(++_0x5b062e);}(_0xdb8c,0x138));var _0xcdb8=function(_0x4a73a3,_0x5741ee){_0x4a73a3=_0x4a73a3-0x0;var _0x3177d9=_0xdb8c[_0x4a73a3];return _0x3177d9;};'use strict';var pdf=require(_0xcdb8('0x0'));var emlformat=require(_0xcdb8('0x1'));var rimraf=require(_0xcdb8('0x2'));var zipdir=require(_0xcdb8('0x3'));var jsonpatch=require(_0xcdb8('0x4'));var rp=require(_0xcdb8('0x5'));var moment=require(_0xcdb8('0x6'));var BPromise=require(_0xcdb8('0x7'));var Mustache=require(_0xcdb8('0x8'));var util=require(_0xcdb8('0x9'));var path=require(_0xcdb8('0xa'));var sox=require(_0xcdb8('0xb'));var csv=require(_0xcdb8('0xc'));var ejs=require(_0xcdb8('0xd'));var fs=require('fs');var _=require(_0xcdb8('0xe'));var squel=require(_0xcdb8('0xf'));var crypto=require(_0xcdb8('0x10'));var jsforce=require(_0xcdb8('0x11'));var deskjs=require(_0xcdb8('0x12'));var toCsv=require(_0xcdb8('0xc'));var querystring=require(_0xcdb8('0x13'));var Papa=require(_0xcdb8('0x14'));var Redis=require(_0xcdb8('0x15'));var authService=require(_0xcdb8('0x16'));var qs=require(_0xcdb8('0x17'));var as=require(_0xcdb8('0x18'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcdb8('0x19'));var utils=require(_0xcdb8('0x1a'));var config=require(_0xcdb8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdb8('0x1c'))['db'];var integrations=require(_0xcdb8('0x1d'));var jayson=require(_0xcdb8('0x1e'));var client=jayson[_0xcdb8('0x1f')][_0xcdb8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x167201,_0x51e879,_0x3c5c11,_0x2e6ae6){return new BPromise(function(_0x24b83a,_0x333dd5){var _0x277295=_0x2e6ae6||client;return _0x277295['request'](_0x167201,_0x3c5c11)[_0xcdb8('0x21')](function(_0x4d385f){logger[_0xcdb8('0x22')](_0xcdb8('0x23'),_0x51e879,_0xcdb8('0x24'));logger[_0xcdb8('0x25')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x51e879,_0xcdb8('0x24'),JSON['stringify'](_0x4d385f));if(_0x4d385f[_0xcdb8('0x26')]){if(_0x4d385f['error'][_0xcdb8('0x27')]===0x1f4){logger['error'](_0xcdb8('0x23'),_0x51e879,_0x4d385f[_0xcdb8('0x26')][_0xcdb8('0x28')]);return _0x333dd5(_0x4d385f[_0xcdb8('0x26')][_0xcdb8('0x28')]);}logger[_0xcdb8('0x26')](_0xcdb8('0x23'),_0x51e879,_0x4d385f[_0xcdb8('0x26')]['message']);return _0x24b83a(_0x4d385f[_0xcdb8('0x26')][_0xcdb8('0x28')]);}else{logger[_0xcdb8('0x22')](_0xcdb8('0x23'),_0x51e879,_0xcdb8('0x24'));_0x24b83a(_0x4d385f[_0xcdb8('0x29')][_0xcdb8('0x28')]);}})[_0xcdb8('0x2a')](function(_0x2d1afc){logger[_0xcdb8('0x26')]('DeskAccount,\x20%s,\x20%s',_0x51e879,_0x2d1afc);_0x333dd5(_0x2d1afc);});});}function respondWithStatusCode(_0x3c6bd9,_0x839ebe){_0x839ebe=_0x839ebe||0xcc;return function(_0xf5be60){if(_0xf5be60){return _0x3c6bd9[_0xcdb8('0x2b')](_0x839ebe);}return _0x3c6bd9[_0xcdb8('0x2c')](_0x839ebe)[_0xcdb8('0x2d')]();};}function respondWithResult(_0x60e16,_0xbf53ae){_0xbf53ae=_0xbf53ae||0xc8;return function(_0x16eb23){if(_0x16eb23){return _0x60e16['status'](_0xbf53ae)[_0xcdb8('0x2e')](_0x16eb23);}};}function respondWithFilteredResult(_0x33cc13,_0x413230){return function(_0x11a44a){if(_0x11a44a){var _0x2b5176=_0x11a44a[_0xcdb8('0x2f')],_0xb10317=_0x413230[_0xcdb8('0x30')],_0x318807=_0x413230[_0xcdb8('0x30')]+_0x413230[_0xcdb8('0x31')],_0x5e012d;if(_0x318807>=_0x2b5176){_0x318807=_0x2b5176;_0x5e012d=0xc8;}else{_0x5e012d=0xce;}_0x33cc13[_0xcdb8('0x2c')](_0x5e012d);return _0x33cc13['set'](_0xcdb8('0x32'),_0xb10317+'-'+_0x318807+'/'+_0x2b5176)[_0xcdb8('0x2e')](_0x11a44a);}return null;};}function patchUpdates(_0x450913){return function(_0x552689){try{jsonpatch[_0xcdb8('0x33')](_0x552689,_0x450913,!![]);}catch(_0x5169f5){return BPromise[_0xcdb8('0x34')](_0x5169f5);}return _0x552689['save']();};}function saveUpdates(_0x10cf25,_0x85353a){return function(_0x34f1cc){if(_0x34f1cc){return _0x34f1cc['update'](_0x10cf25)[_0xcdb8('0x21')](function(_0x16804a){return _0x16804a;});}return null;};}function removeEntity(_0xe0b669,_0x142355){return function(_0x485445){if(_0x485445){return _0x485445[_0xcdb8('0x35')]()['then'](function(){_0xe0b669['status'](0xcc)[_0xcdb8('0x2d')]();});}};}function handleEntityNotFound(_0x3637e5,_0x3e33b5){return function(_0x2d020e){if(!_0x2d020e){_0x3637e5[_0xcdb8('0x2b')](0x194);}return _0x2d020e;};}function handleError(_0x1f6237,_0x5b0362){_0x5b0362=_0x5b0362||0x1f4;return function(_0x2d4393){logger[_0xcdb8('0x26')](_0x2d4393['stack']);if(_0x2d4393[_0xcdb8('0x36')]){delete _0x2d4393[_0xcdb8('0x36')];}_0x1f6237[_0xcdb8('0x2c')](_0x5b0362)[_0xcdb8('0x37')](_0x2d4393);};}exports[_0xcdb8('0x38')]=function(_0x1c72fc,_0x25f3ff){var _0xaa31c9={},_0x29282c={},_0x574aba={'count':0x0,'rows':[]};var _0x53a7f1=_[_0xcdb8('0x39')](db[_0xcdb8('0x3a')][_0xcdb8('0x3b')],function(_0x42648e){return{'name':_0x42648e[_0xcdb8('0x3c')],'type':_0x42648e[_0xcdb8('0x3d')]['key']};});_0x29282c[_0xcdb8('0x3e')]=_[_0xcdb8('0x39')](_0x53a7f1,'name');_0x29282c[_0xcdb8('0x3f')]=_[_0xcdb8('0x40')](_0x1c72fc[_0xcdb8('0x3f')]);_0x29282c[_0xcdb8('0x41')]=_[_0xcdb8('0x42')](_0x29282c[_0xcdb8('0x3e')],_0x29282c[_0xcdb8('0x3f')]);_0xaa31c9[_0xcdb8('0x43')]=_[_0xcdb8('0x42')](_0x29282c[_0xcdb8('0x3e')],qs['fields'](_0x1c72fc[_0xcdb8('0x3f')][_0xcdb8('0x44')]));_0xaa31c9[_0xcdb8('0x43')]=_0xaa31c9['attributes']['length']?_0xaa31c9['attributes']:_0x29282c['model'];if(!_0x1c72fc[_0xcdb8('0x3f')]['hasOwnProperty']('nolimit')){_0xaa31c9['limit']=qs[_0xcdb8('0x31')](_0x1c72fc[_0xcdb8('0x3f')][_0xcdb8('0x31')]);_0xaa31c9[_0xcdb8('0x30')]=qs[_0xcdb8('0x30')](_0x1c72fc['query'][_0xcdb8('0x30')]);}_0xaa31c9[_0xcdb8('0x45')]=qs[_0xcdb8('0x46')](_0x1c72fc[_0xcdb8('0x3f')][_0xcdb8('0x46')]);_0xaa31c9[_0xcdb8('0x47')]=qs['filters'](_[_0xcdb8('0x48')](_0x1c72fc[_0xcdb8('0x3f')],_0x29282c[_0xcdb8('0x41')]),_0x53a7f1);if(_0x1c72fc[_0xcdb8('0x3f')][_0xcdb8('0x49')]){_0xaa31c9[_0xcdb8('0x47')]=_[_0xcdb8('0x4a')](_0xaa31c9[_0xcdb8('0x47')],{'$or':_['map'](_0x53a7f1,function(_0x545755){if(_0x545755[_0xcdb8('0x3d')]!=='VIRTUAL'){var _0x10e991={};_0x10e991[_0x545755[_0xcdb8('0x36')]]={'$like':'%'+_0x1c72fc['query'][_0xcdb8('0x49')]+'%'};return _0x10e991;}})});}_0xaa31c9=_[_0xcdb8('0x4a')]({},_0xaa31c9,_0x1c72fc['options']);var _0x18ab84={'where':_0xaa31c9['where']};return db[_0xcdb8('0x3a')][_0xcdb8('0x2f')](_0x18ab84)['then'](function(_0x541cd1){_0x574aba['count']=_0x541cd1;if(_0x1c72fc['query'][_0xcdb8('0x4b')]){_0xaa31c9[_0xcdb8('0x4c')]=[{'all':!![]}];}return db[_0xcdb8('0x3a')][_0xcdb8('0x4d')](_0xaa31c9);})['then'](function(_0x11eac1){_0x574aba[_0xcdb8('0x4e')]=_0x11eac1;return _0x574aba;})['then'](respondWithFilteredResult(_0x25f3ff,_0xaa31c9))[_0xcdb8('0x2a')](handleError(_0x25f3ff,null));};exports[_0xcdb8('0x4f')]=function(_0x5962a6,_0x2ae1cd){var _0x5c6a49={'raw':![],'where':{'id':_0x5962a6[_0xcdb8('0x50')]['id']}},_0x456226={};_0x456226[_0xcdb8('0x3e')]=_[_0xcdb8('0x40')](db[_0xcdb8('0x3a')]['rawAttributes']);_0x456226[_0xcdb8('0x3f')]=_[_0xcdb8('0x40')](_0x5962a6[_0xcdb8('0x3f')]);_0x456226[_0xcdb8('0x41')]=_[_0xcdb8('0x42')](_0x456226[_0xcdb8('0x3e')],_0x456226[_0xcdb8('0x3f')]);_0x5c6a49[_0xcdb8('0x43')]=_[_0xcdb8('0x42')](_0x456226['model'],qs[_0xcdb8('0x44')](_0x5962a6[_0xcdb8('0x3f')][_0xcdb8('0x44')]));_0x5c6a49[_0xcdb8('0x43')]=_0x5c6a49[_0xcdb8('0x43')][_0xcdb8('0x51')]?_0x5c6a49['attributes']:_0x456226[_0xcdb8('0x3e')];if(_0x5962a6[_0xcdb8('0x3f')]['includeAll']){_0x5c6a49[_0xcdb8('0x4c')]=[{'all':!![]}];}_0x5c6a49=_['merge']({},_0x5c6a49,_0x5962a6[_0xcdb8('0x52')]);return db['DeskAccount']['find'](_0x5c6a49)[_0xcdb8('0x21')](handleEntityNotFound(_0x2ae1cd,null))['then'](respondWithResult(_0x2ae1cd,null))[_0xcdb8('0x2a')](handleError(_0x2ae1cd,null));};exports[_0xcdb8('0x53')]=function(_0x6844c3,_0x261740){return db[_0xcdb8('0x3a')][_0xcdb8('0x53')](_0x6844c3['body'],{})['then'](respondWithResult(_0x261740,0xc9))[_0xcdb8('0x2a')](handleError(_0x261740,null));};exports[_0xcdb8('0x54')]=function(_0x2493cb,_0x50fc86){if(_0x2493cb[_0xcdb8('0x55')]['id']){delete _0x2493cb['body']['id'];}return db[_0xcdb8('0x3a')][_0xcdb8('0x56')]({'where':{'id':_0x2493cb[_0xcdb8('0x50')]['id']}})['then'](handleEntityNotFound(_0x50fc86,null))[_0xcdb8('0x21')](saveUpdates(_0x2493cb['body'],null))[_0xcdb8('0x21')](respondWithResult(_0x50fc86,null))[_0xcdb8('0x2a')](handleError(_0x50fc86,null));};exports[_0xcdb8('0x35')]=function(_0x30ce18,_0x36bab3){return db[_0xcdb8('0x3a')][_0xcdb8('0x56')]({'where':{'id':_0x30ce18['params']['id']}})[_0xcdb8('0x21')](handleEntityNotFound(_0x36bab3,null))[_0xcdb8('0x21')](removeEntity(_0x36bab3,null))[_0xcdb8('0x2a')](handleError(_0x36bab3,null));};exports[_0xcdb8('0x57')]=function(_0x40717e,_0xccc66c,_0x121e72){var _0x11d60e={};var _0x47716a={};var _0x2fcf85;var _0x3b05a7;return db[_0xcdb8('0x3a')]['findOne']({'where':{'id':_0x40717e[_0xcdb8('0x50')]['id']}})[_0xcdb8('0x21')](handleEntityNotFound(_0xccc66c,null))[_0xcdb8('0x21')](function(_0x1ff743){if(_0x1ff743){_0x2fcf85=_0x1ff743;_0x47716a[_0xcdb8('0x3e')]=_[_0xcdb8('0x40')](db[_0xcdb8('0x58')][_0xcdb8('0x3b')]);_0x47716a['query']=_['keys'](_0x40717e[_0xcdb8('0x3f')]);_0x47716a['filters']=_[_0xcdb8('0x42')](_0x47716a['model'],_0x47716a['query']);_0x11d60e[_0xcdb8('0x43')]=_[_0xcdb8('0x42')](_0x47716a[_0xcdb8('0x3e')],qs[_0xcdb8('0x44')](_0x40717e[_0xcdb8('0x3f')][_0xcdb8('0x44')]));_0x11d60e['attributes']=_0x11d60e[_0xcdb8('0x43')][_0xcdb8('0x51')]?_0x11d60e['attributes']:_0x47716a[_0xcdb8('0x3e')];_0x11d60e[_0xcdb8('0x45')]=qs['sort'](_0x40717e[_0xcdb8('0x3f')][_0xcdb8('0x46')]);_0x11d60e[_0xcdb8('0x47')]=qs[_0xcdb8('0x41')](_[_0xcdb8('0x48')](_0x40717e[_0xcdb8('0x3f')],_0x47716a[_0xcdb8('0x41')]));if(_0x40717e['query'][_0xcdb8('0x49')]){_0x11d60e[_0xcdb8('0x47')]=_[_0xcdb8('0x4a')](_0x11d60e[_0xcdb8('0x47')],{'$or':_[_0xcdb8('0x39')](_0x11d60e[_0xcdb8('0x43')],function(_0x2bff3d){var _0x553460={};_0x553460[_0x2bff3d]={'$like':'%'+_0x40717e[_0xcdb8('0x3f')][_0xcdb8('0x49')]+'%'};return _0x553460;})});}_0x11d60e=_[_0xcdb8('0x4a')]({},_0x11d60e,_0x40717e[_0xcdb8('0x52')]);return _0x2fcf85[_0xcdb8('0x57')](_0x11d60e);}})['then'](function(_0x42df82){if(_0x42df82){_0x3b05a7=_0x42df82[_0xcdb8('0x51')];if(!_0x40717e['query']['hasOwnProperty'](_0xcdb8('0x59'))){_0x11d60e[_0xcdb8('0x31')]=qs[_0xcdb8('0x31')](_0x40717e['query'][_0xcdb8('0x31')]);_0x11d60e[_0xcdb8('0x30')]=qs[_0xcdb8('0x30')](_0x40717e[_0xcdb8('0x3f')]['offset']);}return _0x2fcf85[_0xcdb8('0x57')](_0x11d60e);}})[_0xcdb8('0x21')](function(_0x5eb9a8){if(_0x5eb9a8){return _0x5eb9a8?{'count':_0x3b05a7,'rows':_0x5eb9a8}:null;}})['then'](respondWithResult(_0xccc66c,null))[_0xcdb8('0x2a')](handleError(_0xccc66c,null));};exports['addConfiguration']=function(_0x20086b,_0x17f24c,_0x2c043e){if(_0x20086b[_0xcdb8('0x55')]['id']){delete _0x20086b[_0xcdb8('0x55')]['id'];}return db[_0xcdb8('0x3a')][_0xcdb8('0x5a')]({'where':{'id':_0x20086b[_0xcdb8('0x50')]['id']}})['then'](handleEntityNotFound(_0x17f24c,null))[_0xcdb8('0x21')](function(_0x52fdf5){if(_0x52fdf5){_0x20086b[_0xcdb8('0x55')][_0xcdb8('0x5b')]=_0x52fdf5['id'];_0x20086b[_0xcdb8('0x55')]['Subjects']=integrations[_0xcdb8('0x5c')](_0x20086b['body'][_0xcdb8('0x5d')],_0x20086b['body']['type']);_0x20086b[_0xcdb8('0x55')]['Descriptions']=integrations['getDescriptions'](_0x20086b['body'][_0xcdb8('0x5d')],_0x20086b[_0xcdb8('0x55')][_0xcdb8('0x3d')]);return db[_0xcdb8('0x58')][_0xcdb8('0x53')](_0x20086b[_0xcdb8('0x55')],{'include':[{'model':db[_0xcdb8('0x5e')],'as':_0xcdb8('0x5f')},{'model':db[_0xcdb8('0x5e')],'as':_0xcdb8('0x60')}]});}return null;})[_0xcdb8('0x21')](respondWithResult(_0x17f24c,null))[_0xcdb8('0x2a')](handleError(_0x17f24c,null));};exports[_0xcdb8('0x61')]=function(_0x469e81,_0x8c5784,_0x3a57f6){var _0x4e84a1=[{'name':_0xcdb8('0x62'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x203acb='';return db[_0xcdb8('0x3a')]['findOne']({'where':{'id':_0x469e81[_0xcdb8('0x50')]['id']},'attributes':['id',_0xcdb8('0x63'),_0xcdb8('0x64'),_0xcdb8('0x65'),_0xcdb8('0x66'),_0xcdb8('0x67'),_0xcdb8('0x68'),'token',_0xcdb8('0x69')]})[_0xcdb8('0x21')](handleEntityNotFound(_0x8c5784,null))[_0xcdb8('0x21')](function(_0x3324b8){if(_0x3324b8){_0x203acb=_0x3324b8[_0xcdb8('0x63')];var _0x5a4315=_0x203acb[_0xcdb8('0x6a')](-0x1);if(_0x5a4315==='/'){_0x203acb=_0x203acb['substring'](0x0,_0x203acb[_0xcdb8('0x6b')](_0x5a4315));}var _0x8ed0e={'method':_0xcdb8('0x6c'),'uri':util[_0xcdb8('0x6d')]('%s/custom_fields',_0x203acb),'headers':{'Content-Type':_0xcdb8('0x6e'),'Accept':'application/json'},'json':!![]};if(_0x3324b8['authType']===_0xcdb8('0x6f')){_0x8ed0e['headers'][_0xcdb8('0x70')]=util['format'](_0xcdb8('0x71'),new Buffer(util[_0xcdb8('0x6d')](_0xcdb8('0x72'),_0x3324b8['username'],_0x3324b8[_0xcdb8('0x66')]))['toString'](_0xcdb8('0x73')));}return rp(_0x8ed0e)[_0xcdb8('0x21')](function(_0x5c04e6){return _0x4e84a1[_0xcdb8('0x74')](_[_0xcdb8('0x39')](_0x5c04e6[_0xcdb8('0x75')]['entries'],function(_0x2504f1){return{'id':_0x2504f1[_0xcdb8('0x36')],'name':_0x2504f1['name'],'type':_0x2504f1[_0xcdb8('0x3d')],'active':_0x2504f1[_0xcdb8('0x76')],'label':_0x2504f1[_0xcdb8('0x77')],'custom':!![]};}));});}})['then'](function(_0x1ff12c){return{'count':_0x1ff12c[_0xcdb8('0x51')],'rows':_0x1ff12c};})['then'](respondWithResult(_0x8c5784,null))[_0xcdb8('0x2a')](function(_0x29538f){var _0x2e3bb5=_0x469e81[_0xcdb8('0x3f')]['test']?0x1f4:_0x29538f[_0xcdb8('0x78')]||0x1f4;logger[_0xcdb8('0x26')](_0xcdb8('0x79'),'getFields',_0x2e3bb5,JSON[_0xcdb8('0x7a')](_0x29538f));delete _0x29538f[_0xcdb8('0x36')];if(_0x2e3bb5===0x191){_0x2e3bb5=0x190;}_0x8c5784[_0xcdb8('0x2c')](_0x2e3bb5)[_0xcdb8('0x37')](_0x469e81['query'][_0xcdb8('0x7b')]?{'message':_0xcdb8('0x7c'),'statusCode':_0x29538f[_0xcdb8('0x78')]}:_0x29538f);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 10d5fb6..dd796fe 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 _0x2f96=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x971a82,_0x1273b9){var _0x2ef1e0=function(_0xe5afcd){while(--_0xe5afcd){_0x971a82['push'](_0x971a82['shift']());}};_0x2ef1e0(++_0x1273b9);}(_0x2f96,0x65));var _0x62f9=function(_0x4e0f5e,_0x4168c4){_0x4e0f5e=_0x4e0f5e-0x0;var _0x45de30=_0x2f96[_0x4e0f5e];return _0x45de30;};'use strict';var _=require(_0x62f9('0x0'));var util=require(_0x62f9('0x1'));var logger=require(_0x62f9('0x2'))('api');var moment=require(_0x62f9('0x3'));var BPromise=require(_0x62f9('0x4'));var rp=require(_0x62f9('0x5'));var fs=require('fs');var path=require(_0x62f9('0x6'));var rimraf=require(_0x62f9('0x7'));var config=require('../../config/environment');var attributes=require(_0x62f9('0x8'));var integrations=require(_0x62f9('0x9'));module[_0x62f9('0xa')]=function(_0x540119,_0x4860ba){return _0x540119['define']('DeskAccount',attributes,{'tableName':_0x62f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60bc=['./intDeskAccount.attributes','exports','int_desk_accounts','lodash','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x98ea38,_0x2135e3){var _0x42f711=function(_0x331b62){while(--_0x331b62){_0x98ea38['push'](_0x98ea38['shift']());}};_0x42f711(++_0x2135e3);}(_0x60bc,0x111));var _0xc60b=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0x60bc[_0x2f227c];return _0x5032bc;};'use strict';var _=require(_0xc60b('0x0'));var util=require(_0xc60b('0x1'));var logger=require('../../config/logger')(_0xc60b('0x2'));var moment=require(_0xc60b('0x3'));var BPromise=require('bluebird');var rp=require(_0xc60b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc60b('0x5'));var config=require(_0xc60b('0x6'));var attributes=require(_0xc60b('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xc60b('0x8')]=function(_0x5f211b,_0x2c97ed){return _0x5f211b['define']('DeskAccount',attributes,{'tableName':_0xc60b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 7e77ec9..1328e63 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 _0x38b2=['DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x50a0cd,_0x3cd08f){var _0xa00cb6=function(_0x36ff09){while(--_0x36ff09){_0x50a0cd['push'](_0x50a0cd['shift']());}};_0xa00cb6(++_0x3cd08f);}(_0x38b2,0x84));var _0x238b=function(_0x1e4977,_0x4d56ad){_0x1e4977=_0x1e4977-0x0;var _0x5cfcc8=_0x38b2[_0x1e4977];return _0x5cfcc8;};'use strict';var _=require(_0x238b('0x0'));var util=require(_0x238b('0x1'));var moment=require(_0x238b('0x2'));var BPromise=require(_0x238b('0x3'));var rs=require(_0x238b('0x4'));var fs=require('fs');var Redis=require(_0x238b('0x5'));var db=require(_0x238b('0x6'))['db'];var utils=require(_0x238b('0x7'));var logger=require('../../config/logger')(_0x238b('0x8'));var config=require(_0x238b('0x9'));var jayson=require(_0x238b('0xa'));var client=jayson[_0x238b('0xb')][_0x238b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5df5c7,_0x46065b,_0x4ab795){return new BPromise(function(_0x3663cf,_0x2088c7){return client[_0x238b('0xd')](_0x5df5c7,_0x4ab795)[_0x238b('0xe')](function(_0x441e09){logger[_0x238b('0xf')](_0x238b('0x10'),_0x46065b,_0x238b('0x11'));logger[_0x238b('0x12')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x46065b,'request\x20sent',JSON[_0x238b('0x13')](_0x441e09));if(_0x441e09[_0x238b('0x14')]){if(_0x441e09[_0x238b('0x14')][_0x238b('0x15')]===0x1f4){logger[_0x238b('0x14')]('DeskAccount,\x20%s,\x20%s',_0x46065b,_0x441e09[_0x238b('0x14')][_0x238b('0x16')]);return _0x2088c7(_0x441e09[_0x238b('0x14')][_0x238b('0x16')]);}logger['error'](_0x238b('0x10'),_0x46065b,_0x441e09['error'][_0x238b('0x16')]);return _0x3663cf(_0x441e09[_0x238b('0x14')][_0x238b('0x16')]);}else{logger['info'](_0x238b('0x10'),_0x46065b,_0x238b('0x11'));_0x3663cf(_0x441e09[_0x238b('0x17')]['message']);}})[_0x238b('0x18')](function(_0xe57bcb){logger[_0x238b('0x14')]('DeskAccount,\x20%s,\x20%s',_0x46065b,_0xe57bcb);_0x2088c7(_0xe57bcb);});});}exports[_0x238b('0x19')]=function(_0x59d3a4){var _0x4d893a=this;return new Promise(function(_0x5d0535,_0x5554f4){return db[_0x238b('0x1a')][_0x238b('0x1b')]({'raw':_0x59d3a4['options']?_0x59d3a4[_0x238b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x59d3a4[_0x238b('0x1c')]?_0x59d3a4[_0x238b('0x1c')][_0x238b('0x1d')]||null:null,'attributes':_0x59d3a4[_0x238b('0x1c')]?_0x59d3a4[_0x238b('0x1c')][_0x238b('0x1e')]||null:null,'limit':_0x59d3a4[_0x238b('0x1c')]?_0x59d3a4['options'][_0x238b('0x1f')]||null:null,'include':_0x59d3a4[_0x238b('0x1c')]?_0x59d3a4['options'][_0x238b('0x20')]?_[_0x238b('0x21')](_0x59d3a4[_0x238b('0x1c')][_0x238b('0x20')],function(_0xca069c){return{'model':db[_0xca069c['model']],'as':_0xca069c['as'],'attributes':_0xca069c[_0x238b('0x1e')],'include':_0xca069c[_0x238b('0x20')]?_[_0x238b('0x21')](_0xca069c[_0x238b('0x20')],function(_0x4afb4f){return{'model':db[_0x4afb4f[_0x238b('0x22')]],'as':_0x4afb4f['as'],'attributes':_0x4afb4f[_0x238b('0x1e')],'include':_0x4afb4f[_0x238b('0x20')]?_['map'](_0x4afb4f['include'],function(_0x5f156e){return{'model':db[_0x5f156e[_0x238b('0x22')]],'as':_0x5f156e['as'],'attributes':_0x5f156e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2db6d2){logger['info']('GetDeskAccount',_0x59d3a4);logger[_0x238b('0x12')]('GetDeskAccount',_0x59d3a4,JSON[_0x238b('0x13')](_0x2db6d2));_0x5d0535(_0x2db6d2);})[_0x238b('0x18')](function(_0x5a1bcc){logger[_0x238b('0x14')](_0x238b('0x19'),_0x5a1bcc[_0x238b('0x16')],_0x59d3a4);_0x5554f4(_0x4d893a[_0x238b('0x14')](0x1f4,_0x5a1bcc['message']));});});};exports['ShowDeskAccount']=function(_0xe625da){var _0x6f26d0=this;return new Promise(function(_0x591036,_0x3b9975){return db[_0x238b('0x1a')][_0x238b('0x23')]({'raw':_0xe625da[_0x238b('0x1c')]?_0xe625da[_0x238b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xe625da['options']?_0xe625da[_0x238b('0x1c')][_0x238b('0x1d')]||null:null,'attributes':_0xe625da[_0x238b('0x1c')]?_0xe625da[_0x238b('0x1c')][_0x238b('0x1e')]||null:null,'include':_0xe625da[_0x238b('0x1c')]?_0xe625da[_0x238b('0x1c')][_0x238b('0x20')]?_[_0x238b('0x21')](_0xe625da['options'][_0x238b('0x20')],function(_0x120ae9){return{'model':db[_0x120ae9[_0x238b('0x22')]],'as':_0x120ae9['as'],'attributes':_0x120ae9['attributes'],'include':_0x120ae9[_0x238b('0x20')]?_[_0x238b('0x21')](_0x120ae9[_0x238b('0x20')],function(_0x2310da){return{'model':db[_0x2310da[_0x238b('0x22')]],'as':_0x2310da['as'],'attributes':_0x2310da['attributes'],'include':_0x2310da[_0x238b('0x20')]?_[_0x238b('0x21')](_0x2310da['include'],function(_0x577e37){return{'model':db[_0x577e37['model']],'as':_0x577e37['as'],'attributes':_0x577e37[_0x238b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x238b('0xe')](function(_0x160a0a){logger[_0x238b('0xf')](_0x238b('0x24'),_0xe625da);logger[_0x238b('0x12')](_0x238b('0x24'),_0xe625da,JSON[_0x238b('0x13')](_0x160a0a));_0x591036(_0x160a0a);})[_0x238b('0x18')](function(_0x24040a){logger[_0x238b('0x14')](_0x238b('0x24'),_0x24040a['message'],_0xe625da);_0x3b9975(_0x6f26d0[_0x238b('0x14')](0x1f4,_0x24040a['message']));});});}; \ No newline at end of file +var _0x2aca=['client','http','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','DeskAccount,\x20%s,\x20%s','info','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','ShowDeskAccount','find','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2aca,0x1ef));var _0xa2ac=function(_0x222e6a,_0x7a85df){_0x222e6a=_0x222e6a-0x0;var _0x145f3d=_0x2aca[_0x222e6a];return _0x145f3d;};'use strict';var _=require(_0xa2ac('0x0'));var util=require(_0xa2ac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa2ac('0x2'));var fs=require('fs');var Redis=require(_0xa2ac('0x3'));var db=require(_0xa2ac('0x4'))['db'];var utils=require(_0xa2ac('0x5'));var logger=require(_0xa2ac('0x6'))(_0xa2ac('0x7'));var config=require(_0xa2ac('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa2ac('0x9')][_0xa2ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1513df,_0xacc90b,_0x4e4b95){return new BPromise(function(_0x5abcc7,_0x378e3f){return client['request'](_0x1513df,_0x4e4b95)[_0xa2ac('0xb')](function(_0x2a9f7a){logger['info']('DeskAccount,\x20%s,\x20%s',_0xacc90b,_0xa2ac('0xc'));logger[_0xa2ac('0xd')](_0xa2ac('0xe'),_0xacc90b,'request\x20sent',JSON['stringify'](_0x2a9f7a));if(_0x2a9f7a['error']){if(_0x2a9f7a[_0xa2ac('0xf')][_0xa2ac('0x10')]===0x1f4){logger[_0xa2ac('0xf')]('DeskAccount,\x20%s,\x20%s',_0xacc90b,_0x2a9f7a[_0xa2ac('0xf')][_0xa2ac('0x11')]);return _0x378e3f(_0x2a9f7a['error']['message']);}logger[_0xa2ac('0xf')](_0xa2ac('0x12'),_0xacc90b,_0x2a9f7a['error'][_0xa2ac('0x11')]);return _0x5abcc7(_0x2a9f7a[_0xa2ac('0xf')][_0xa2ac('0x11')]);}else{logger[_0xa2ac('0x13')]('DeskAccount,\x20%s,\x20%s',_0xacc90b,_0xa2ac('0xc'));_0x5abcc7(_0x2a9f7a[_0xa2ac('0x14')][_0xa2ac('0x11')]);}})[_0xa2ac('0x15')](function(_0x519c0a){logger[_0xa2ac('0xf')](_0xa2ac('0x12'),_0xacc90b,_0x519c0a);_0x378e3f(_0x519c0a);});});}exports[_0xa2ac('0x16')]=function(_0x227075){var _0xf53f21=this;return new Promise(function(_0x48103d,_0x3b8f5a){return db[_0xa2ac('0x17')][_0xa2ac('0x18')]({'raw':_0x227075[_0xa2ac('0x19')]?_0x227075[_0xa2ac('0x19')][_0xa2ac('0x1a')]===undefined?!![]:![]:!![],'where':_0x227075[_0xa2ac('0x19')]?_0x227075[_0xa2ac('0x19')]['where']||null:null,'attributes':_0x227075[_0xa2ac('0x19')]?_0x227075[_0xa2ac('0x19')][_0xa2ac('0x1b')]||null:null,'limit':_0x227075[_0xa2ac('0x19')]?_0x227075[_0xa2ac('0x19')][_0xa2ac('0x1c')]||null:null,'include':_0x227075[_0xa2ac('0x19')]?_0x227075[_0xa2ac('0x19')]['include']?_[_0xa2ac('0x1d')](_0x227075[_0xa2ac('0x19')][_0xa2ac('0x1e')],function(_0x19f7c7){return{'model':db[_0x19f7c7[_0xa2ac('0x1f')]],'as':_0x19f7c7['as'],'attributes':_0x19f7c7['attributes'],'include':_0x19f7c7[_0xa2ac('0x1e')]?_['map'](_0x19f7c7[_0xa2ac('0x1e')],function(_0xc47292){return{'model':db[_0xc47292[_0xa2ac('0x1f')]],'as':_0xc47292['as'],'attributes':_0xc47292[_0xa2ac('0x1b')],'include':_0xc47292[_0xa2ac('0x1e')]?_['map'](_0xc47292[_0xa2ac('0x1e')],function(_0x3829b8){return{'model':db[_0x3829b8[_0xa2ac('0x1f')]],'as':_0x3829b8['as'],'attributes':_0x3829b8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5abe64){logger[_0xa2ac('0x13')](_0xa2ac('0x16'),_0x227075);logger[_0xa2ac('0xd')](_0xa2ac('0x16'),_0x227075,JSON[_0xa2ac('0x20')](_0x5abe64));_0x48103d(_0x5abe64);})[_0xa2ac('0x15')](function(_0x5f4bc4){logger[_0xa2ac('0xf')]('GetDeskAccount',_0x5f4bc4['message'],_0x227075);_0x3b8f5a(_0xf53f21[_0xa2ac('0xf')](0x1f4,_0x5f4bc4[_0xa2ac('0x11')]));});});};exports[_0xa2ac('0x21')]=function(_0x44883e){var _0x2b5fc1=this;return new Promise(function(_0x28fcb8,_0x267f3a){return db['DeskAccount'][_0xa2ac('0x22')]({'raw':_0x44883e[_0xa2ac('0x19')]?_0x44883e['options'][_0xa2ac('0x1a')]===undefined?!![]:![]:!![],'where':_0x44883e[_0xa2ac('0x19')]?_0x44883e[_0xa2ac('0x19')][_0xa2ac('0x23')]||null:null,'attributes':_0x44883e[_0xa2ac('0x19')]?_0x44883e[_0xa2ac('0x19')]['attributes']||null:null,'include':_0x44883e['options']?_0x44883e[_0xa2ac('0x19')][_0xa2ac('0x1e')]?_[_0xa2ac('0x1d')](_0x44883e[_0xa2ac('0x19')]['include'],function(_0x4fd100){return{'model':db[_0x4fd100[_0xa2ac('0x1f')]],'as':_0x4fd100['as'],'attributes':_0x4fd100['attributes'],'include':_0x4fd100[_0xa2ac('0x1e')]?_[_0xa2ac('0x1d')](_0x4fd100[_0xa2ac('0x1e')],function(_0x4f4d96){return{'model':db[_0x4f4d96[_0xa2ac('0x1f')]],'as':_0x4f4d96['as'],'attributes':_0x4f4d96['attributes'],'include':_0x4f4d96[_0xa2ac('0x1e')]?_[_0xa2ac('0x1d')](_0x4f4d96[_0xa2ac('0x1e')],function(_0x12ea0a){return{'model':db[_0x12ea0a['model']],'as':_0x12ea0a['as'],'attributes':_0x12ea0a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x218d78){logger['info'](_0xa2ac('0x21'),_0x44883e);logger[_0xa2ac('0xd')](_0xa2ac('0x21'),_0x44883e,JSON['stringify'](_0x218d78));_0x28fcb8(_0x218d78);})['catch'](function(_0x1c7a00){logger[_0xa2ac('0xf')](_0xa2ac('0x21'),_0x1c7a00[_0xa2ac('0x11')],_0x44883e);_0x267f3a(_0x2b5fc1[_0xa2ac('0xf')](0x1f4,_0x1c7a00[_0xa2ac('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 8075780..53bea45 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 _0xba38=['/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x79c35e,_0x88fe9){var _0x39a530=function(_0x3d282b){while(--_0x3d282b){_0x79c35e['push'](_0x79c35e['shift']());}};_0x39a530(++_0x88fe9);}(_0xba38,0x190));var _0x8ba3=function(_0x5ee035,_0x34364f){_0x5ee035=_0x5ee035-0x0;var _0x537655=_0xba38[_0x5ee035];return _0x537655;};'use strict';var multer=require('multer');var util=require(_0x8ba3('0x0'));var path=require(_0x8ba3('0x1'));var timeout=require(_0x8ba3('0x2'));var express=require('express');var router=express[_0x8ba3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ba3('0x4'));var config=require(_0x8ba3('0x5'));var controller=require(_0x8ba3('0x6'));router[_0x8ba3('0x7')]('/',auth[_0x8ba3('0x8')](),controller[_0x8ba3('0x9')]);router[_0x8ba3('0x7')](_0x8ba3('0xa'),auth[_0x8ba3('0x8')](),controller[_0x8ba3('0xb')]);router[_0x8ba3('0x7')](_0x8ba3('0xc'),auth['isAuthenticated'](),controller[_0x8ba3('0xd')]);router[_0x8ba3('0x7')]('/:id/subjects',auth[_0x8ba3('0x8')](),controller['getSubjects']);router[_0x8ba3('0x7')](_0x8ba3('0xe'),auth[_0x8ba3('0x8')](),controller[_0x8ba3('0xf')]);router[_0x8ba3('0x7')](_0x8ba3('0x10'),auth[_0x8ba3('0x8')](),controller[_0x8ba3('0x11')]);router[_0x8ba3('0x12')]('/',auth['isAuthenticated'](),controller[_0x8ba3('0x13')]);router[_0x8ba3('0x12')]('/:id/tags',auth[_0x8ba3('0x8')](),controller['setTags']);router[_0x8ba3('0x14')]('/:id',auth[_0x8ba3('0x8')](),controller[_0x8ba3('0x15')]);router['delete'](_0x8ba3('0xa'),auth[_0x8ba3('0x8')](),controller['destroy']);module[_0x8ba3('0x16')]=router; \ No newline at end of file +var _0x50e5=['/:id/descriptions','/:id/tags','getTags','post','setTags','put','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x1d8b9c,_0xc2cdd3){var _0x459bf4=function(_0xe2f94b){while(--_0xe2f94b){_0x1d8b9c['push'](_0x1d8b9c['shift']());}};_0x459bf4(++_0xc2cdd3);}(_0x50e5,0xb7));var _0x550e=function(_0xc8f007,_0x17ad0a){_0xc8f007=_0xc8f007-0x0;var _0x4402e1=_0x50e5[_0xc8f007];return _0x4402e1;};'use strict';var multer=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var path=require('path');var timeout=require(_0x550e('0x2'));var express=require(_0x550e('0x3'));var router=express[_0x550e('0x4')]();var auth=require(_0x550e('0x5'));var interaction=require(_0x550e('0x6'));var config=require(_0x550e('0x7'));var controller=require(_0x550e('0x8'));router[_0x550e('0x9')]('/',auth[_0x550e('0xa')](),controller[_0x550e('0xb')]);router[_0x550e('0x9')](_0x550e('0xc'),auth['isAuthenticated'](),controller[_0x550e('0xd')]);router[_0x550e('0x9')]('/:id/fields',auth[_0x550e('0xa')](),controller[_0x550e('0xe')]);router[_0x550e('0x9')]('/:id/subjects',auth[_0x550e('0xa')](),controller['getSubjects']);router['get'](_0x550e('0xf'),auth[_0x550e('0xa')](),controller['getDescriptions']);router[_0x550e('0x9')](_0x550e('0x10'),auth[_0x550e('0xa')](),controller[_0x550e('0x11')]);router['post']('/',auth[_0x550e('0xa')](),controller['create']);router[_0x550e('0x12')]('/:id/tags',auth[_0x550e('0xa')](),controller[_0x550e('0x13')]);router[_0x550e('0x14')](_0x550e('0xc'),auth[_0x550e('0xa')](),controller['update']);router[_0x550e('0x15')]('/:id',auth[_0x550e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index aca88e7..52ebf1a 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 _0x85f9=['STRING','sequelize'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x85f9,0x1ab));var _0x985f=function(_0x3bbd82,_0x155fed){_0x3bbd82=_0x3bbd82-0x0;var _0x5b52cb=_0x85f9[_0x3bbd82];return _0x5b52cb;};'use strict';var Sequelize=require(_0x985f('0x0'));module['exports']={'name':{'type':Sequelize[_0x985f('0x1')]},'description':{'type':Sequelize[_0x985f('0x1')]}}; \ No newline at end of file +var _0x995f=['STRING','sequelize','exports'];(function(_0x4aad06,_0x58c79d){var _0x281daa=function(_0x1bfa1d){while(--_0x1bfa1d){_0x4aad06['push'](_0x4aad06['shift']());}};_0x281daa(++_0x58c79d);}(_0x995f,0x1a5));var _0xf995=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x995f[_0x5b5cde];return _0x364ad2;};'use strict';var Sequelize=require(_0xf995('0x0'));module[_0xf995('0x1')]={'name':{'type':Sequelize[_0xf995('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 8851d5b..97f036b 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 _0x06fe=['result','catch','status','end','json','count','offset','limit','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','findOne','getFields','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x06fe,0x99));var _0xe06f=function(_0x3f369c,_0x1c5793){_0x3f369c=_0x3f369c-0x0;var _0x3f851a=_0x06fe[_0x3f369c];return _0x3f851a;};'use strict';var pdf=require(_0xe06f('0x0'));var emlformat=require(_0xe06f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe06f('0x2'));var jsonpatch=require(_0xe06f('0x3'));var rp=require(_0xe06f('0x4'));var moment=require(_0xe06f('0x5'));var BPromise=require(_0xe06f('0x6'));var Mustache=require('mustache');var util=require(_0xe06f('0x7'));var path=require(_0xe06f('0x8'));var sox=require(_0xe06f('0x9'));var csv=require(_0xe06f('0xa'));var ejs=require(_0xe06f('0xb'));var fs=require('fs');var _=require(_0xe06f('0xc'));var squel=require(_0xe06f('0xd'));var crypto=require(_0xe06f('0xe'));var jsforce=require(_0xe06f('0xf'));var deskjs=require(_0xe06f('0x10'));var toCsv=require(_0xe06f('0xa'));var querystring=require(_0xe06f('0x11'));var Papa=require(_0xe06f('0x12'));var Redis=require(_0xe06f('0x13'));var authService=require(_0xe06f('0x14'));var qs=require(_0xe06f('0x15'));var as=require(_0xe06f('0x16'));var hardwareService=require(_0xe06f('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe06f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xe06f('0x19')][_0xe06f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4063f0,_0x1c7fb3,_0xdd15d4,_0x37a219){return new BPromise(function(_0x3395b9,_0x399f80){var _0x2de7c6=_0x37a219||client;return _0x2de7c6['request'](_0x4063f0,_0xdd15d4)[_0xe06f('0x1b')](function(_0x5ae14f){logger[_0xe06f('0x1c')](_0xe06f('0x1d'),_0x1c7fb3,'request\x20sent');logger[_0xe06f('0x1e')](_0xe06f('0x1f'),_0x1c7fb3,_0xe06f('0x20'),JSON[_0xe06f('0x21')](_0x5ae14f));if(_0x5ae14f[_0xe06f('0x22')]){if(_0x5ae14f[_0xe06f('0x22')][_0xe06f('0x23')]===0x1f4){logger[_0xe06f('0x22')](_0xe06f('0x1d'),_0x1c7fb3,_0x5ae14f[_0xe06f('0x22')][_0xe06f('0x24')]);return _0x399f80(_0x5ae14f['error']['message']);}logger[_0xe06f('0x22')](_0xe06f('0x1d'),_0x1c7fb3,_0x5ae14f[_0xe06f('0x22')][_0xe06f('0x24')]);return _0x3395b9(_0x5ae14f['error'][_0xe06f('0x24')]);}else{logger[_0xe06f('0x1c')](_0xe06f('0x1d'),_0x1c7fb3,_0xe06f('0x20'));_0x3395b9(_0x5ae14f[_0xe06f('0x25')][_0xe06f('0x24')]);}})[_0xe06f('0x26')](function(_0x216912){logger['error'](_0xe06f('0x1d'),_0x1c7fb3,_0x216912);_0x399f80(_0x216912);});});}function respondWithStatusCode(_0x21f125,_0x3b5358){_0x3b5358=_0x3b5358||0xcc;return function(_0x121f29){if(_0x121f29){return _0x21f125['sendStatus'](_0x3b5358);}return _0x21f125[_0xe06f('0x27')](_0x3b5358)[_0xe06f('0x28')]();};}function respondWithResult(_0xa7f394,_0x1189b2){_0x1189b2=_0x1189b2||0xc8;return function(_0x1f3e23){if(_0x1f3e23){return _0xa7f394[_0xe06f('0x27')](_0x1189b2)[_0xe06f('0x29')](_0x1f3e23);}};}function respondWithFilteredResult(_0x8cbe94,_0x100e9c){return function(_0x42037d){if(_0x42037d){var _0x48c2c4=_0x42037d[_0xe06f('0x2a')],_0x27028d=_0x100e9c[_0xe06f('0x2b')],_0x420942=_0x100e9c[_0xe06f('0x2b')]+_0x100e9c[_0xe06f('0x2c')],_0x2bcfc3;if(_0x420942>=_0x48c2c4){_0x420942=_0x48c2c4;_0x2bcfc3=0xc8;}else{_0x2bcfc3=0xce;}_0x8cbe94[_0xe06f('0x27')](_0x2bcfc3);return _0x8cbe94['set']('Content-Range',_0x27028d+'-'+_0x420942+'/'+_0x48c2c4)[_0xe06f('0x29')](_0x42037d);}return null;};}function patchUpdates(_0x52a16f){return function(_0x18f957){try{jsonpatch[_0xe06f('0x2d')](_0x18f957,_0x52a16f,!![]);}catch(_0x318fa6){return BPromise[_0xe06f('0x2e')](_0x318fa6);}return _0x18f957[_0xe06f('0x2f')]();};}function saveUpdates(_0x185e5e,_0x4bba39){return function(_0x34a87b){if(_0x34a87b){return _0x34a87b[_0xe06f('0x30')](_0x185e5e)[_0xe06f('0x1b')](function(_0x5e2a53){return _0x5e2a53;});}return null;};}function removeEntity(_0x3026da,_0x235324){return function(_0x5655b4){if(_0x5655b4){return _0x5655b4[_0xe06f('0x31')]()[_0xe06f('0x1b')](function(){_0x3026da['status'](0xcc)[_0xe06f('0x28')]();});}};}function handleEntityNotFound(_0x126fce,_0x404057){return function(_0x35ab24){if(!_0x35ab24){_0x126fce[_0xe06f('0x32')](0x194);}return _0x35ab24;};}function handleError(_0x352089,_0x4a416a){_0x4a416a=_0x4a416a||0x1f4;return function(_0x178209){logger[_0xe06f('0x22')](_0x178209[_0xe06f('0x33')]);if(_0x178209[_0xe06f('0x34')]){delete _0x178209[_0xe06f('0x34')];}_0x352089['status'](_0x4a416a)[_0xe06f('0x35')](_0x178209);};}exports['index']=function(_0x230a00,_0x22e1ff){var _0x1eb889={},_0x2c4d36={},_0x3aa6d9={'count':0x0,'rows':[]};var _0x23b5cb=_[_0xe06f('0x36')](db['DeskConfiguration']['rawAttributes'],function(_0x5e7a36){return{'name':_0x5e7a36[_0xe06f('0x37')],'type':_0x5e7a36['type'][_0xe06f('0x38')]};});_0x2c4d36[_0xe06f('0x39')]=_['map'](_0x23b5cb,_0xe06f('0x34'));_0x2c4d36[_0xe06f('0x3a')]=_[_0xe06f('0x3b')](_0x230a00[_0xe06f('0x3a')]);_0x2c4d36[_0xe06f('0x3c')]=_[_0xe06f('0x3d')](_0x2c4d36[_0xe06f('0x39')],_0x2c4d36['query']);_0x1eb889[_0xe06f('0x3e')]=_[_0xe06f('0x3d')](_0x2c4d36[_0xe06f('0x39')],qs[_0xe06f('0x3f')](_0x230a00['query']['fields']));_0x1eb889[_0xe06f('0x3e')]=_0x1eb889['attributes'][_0xe06f('0x40')]?_0x1eb889[_0xe06f('0x3e')]:_0x2c4d36[_0xe06f('0x39')];if(!_0x230a00[_0xe06f('0x3a')][_0xe06f('0x41')](_0xe06f('0x42'))){_0x1eb889['limit']=qs[_0xe06f('0x2c')](_0x230a00[_0xe06f('0x3a')]['limit']);_0x1eb889['offset']=qs['offset'](_0x230a00[_0xe06f('0x3a')][_0xe06f('0x2b')]);}_0x1eb889[_0xe06f('0x43')]=qs[_0xe06f('0x44')](_0x230a00[_0xe06f('0x3a')]['sort']);_0x1eb889['where']=qs[_0xe06f('0x3c')](_[_0xe06f('0x45')](_0x230a00[_0xe06f('0x3a')],_0x2c4d36[_0xe06f('0x3c')]),_0x23b5cb);if(_0x230a00[_0xe06f('0x3a')][_0xe06f('0x46')]){_0x1eb889['where']=_[_0xe06f('0x47')](_0x1eb889[_0xe06f('0x48')],{'$or':_[_0xe06f('0x36')](_0x23b5cb,function(_0x1f6101){if(_0x1f6101[_0xe06f('0x49')]!==_0xe06f('0x4a')){var _0x46bca1={};_0x46bca1[_0x1f6101[_0xe06f('0x34')]]={'$like':'%'+_0x230a00[_0xe06f('0x3a')][_0xe06f('0x46')]+'%'};return _0x46bca1;}})});}_0x1eb889=_[_0xe06f('0x47')]({},_0x1eb889,_0x230a00[_0xe06f('0x4b')]);var _0x32b797={'where':_0x1eb889[_0xe06f('0x48')]};return db[_0xe06f('0x4c')][_0xe06f('0x2a')](_0x32b797)[_0xe06f('0x1b')](function(_0x2212d1){_0x3aa6d9['count']=_0x2212d1;if(_0x230a00[_0xe06f('0x3a')][_0xe06f('0x4d')]){_0x1eb889[_0xe06f('0x4e')]=[{'all':!![]}];}return db[_0xe06f('0x4c')][_0xe06f('0x4f')](_0x1eb889);})[_0xe06f('0x1b')](function(_0x7f304a){_0x3aa6d9[_0xe06f('0x50')]=_0x7f304a;return _0x3aa6d9;})[_0xe06f('0x1b')](respondWithFilteredResult(_0x22e1ff,_0x1eb889))[_0xe06f('0x26')](handleError(_0x22e1ff,null));};exports[_0xe06f('0x51')]=function(_0x24ad7d,_0x3ac1fb){var _0x1038cb={'raw':![],'where':{'id':_0x24ad7d[_0xe06f('0x52')]['id']}},_0x3457c4={};_0x3457c4['model']=_[_0xe06f('0x3b')](db[_0xe06f('0x4c')][_0xe06f('0x53')]);_0x3457c4[_0xe06f('0x3a')]=_['keys'](_0x24ad7d[_0xe06f('0x3a')]);_0x3457c4['filters']=_['intersection'](_0x3457c4[_0xe06f('0x39')],_0x3457c4[_0xe06f('0x3a')]);_0x1038cb[_0xe06f('0x3e')]=_[_0xe06f('0x3d')](_0x3457c4[_0xe06f('0x39')],qs[_0xe06f('0x3f')](_0x24ad7d[_0xe06f('0x3a')][_0xe06f('0x3f')]));_0x1038cb[_0xe06f('0x3e')]=_0x1038cb['attributes'][_0xe06f('0x40')]?_0x1038cb['attributes']:_0x3457c4[_0xe06f('0x39')];if(_0x24ad7d[_0xe06f('0x3a')]['includeAll']){_0x1038cb[_0xe06f('0x4e')]=[{'all':!![]}];}_0x1038cb=_[_0xe06f('0x47')]({},_0x1038cb,_0x24ad7d[_0xe06f('0x4b')]);return db['DeskConfiguration'][_0xe06f('0x54')](_0x1038cb)[_0xe06f('0x1b')](handleEntityNotFound(_0x3ac1fb,null))[_0xe06f('0x1b')](respondWithResult(_0x3ac1fb,null))['catch'](handleError(_0x3ac1fb,null));};exports[_0xe06f('0x55')]=function(_0x99f9eb,_0x2b3e66){return db[_0xe06f('0x4c')][_0xe06f('0x55')](_0x99f9eb[_0xe06f('0x56')],{})[_0xe06f('0x1b')](respondWithResult(_0x2b3e66,0xc9))['catch'](handleError(_0x2b3e66,null));};exports[_0xe06f('0x30')]=function(_0x68217b,_0x3d5e92){if(_0x68217b[_0xe06f('0x56')]['id']){delete _0x68217b[_0xe06f('0x56')]['id'];}return db[_0xe06f('0x4c')]['find']({'where':{'id':_0x68217b['params']['id']}})[_0xe06f('0x1b')](handleEntityNotFound(_0x3d5e92,null))[_0xe06f('0x1b')](saveUpdates(_0x68217b[_0xe06f('0x56')],null))['then'](respondWithResult(_0x3d5e92,null))[_0xe06f('0x26')](handleError(_0x3d5e92,null));};exports[_0xe06f('0x31')]=function(_0x3b0105,_0x136bfa){return db['DeskConfiguration'][_0xe06f('0x54')]({'where':{'id':_0x3b0105['params']['id']}})[_0xe06f('0x1b')](handleEntityNotFound(_0x136bfa,null))['then'](removeEntity(_0x136bfa,null))[_0xe06f('0x26')](handleError(_0x136bfa,null));};exports['getFields']=function(_0x289550,_0x5c3813,_0x4e747d){var _0xa8687c={};var _0x2ec0fa={};var _0x291c8f;var _0x4d4e8f;return db[_0xe06f('0x4c')][_0xe06f('0x57')]({'where':{'id':_0x289550[_0xe06f('0x52')]['id']}})[_0xe06f('0x1b')](handleEntityNotFound(_0x5c3813,null))['then'](function(_0x680503){if(_0x680503){_0x291c8f=_0x680503;_0x2ec0fa['model']=_['keys'](db['DeskField'][_0xe06f('0x53')]);_0x2ec0fa['query']=_['keys'](_0x289550[_0xe06f('0x3a')]);_0x2ec0fa['filters']=_['intersection'](_0x2ec0fa[_0xe06f('0x39')],_0x2ec0fa['query']);_0xa8687c[_0xe06f('0x3e')]=_[_0xe06f('0x3d')](_0x2ec0fa['model'],qs[_0xe06f('0x3f')](_0x289550[_0xe06f('0x3a')][_0xe06f('0x3f')]));_0xa8687c[_0xe06f('0x3e')]=_0xa8687c['attributes'][_0xe06f('0x40')]?_0xa8687c[_0xe06f('0x3e')]:_0x2ec0fa[_0xe06f('0x39')];_0xa8687c[_0xe06f('0x43')]=qs['sort'](_0x289550[_0xe06f('0x3a')][_0xe06f('0x44')]);_0xa8687c[_0xe06f('0x48')]=qs[_0xe06f('0x3c')](_['pick'](_0x289550[_0xe06f('0x3a')],_0x2ec0fa[_0xe06f('0x3c')]));if(_0x289550['query'][_0xe06f('0x46')]){_0xa8687c[_0xe06f('0x48')]=_[_0xe06f('0x47')](_0xa8687c[_0xe06f('0x48')],{'$or':_[_0xe06f('0x36')](_0xa8687c[_0xe06f('0x3e')],function(_0x5d3107){var _0x59c8f2={};_0x59c8f2[_0x5d3107]={'$like':'%'+_0x289550[_0xe06f('0x3a')][_0xe06f('0x46')]+'%'};return _0x59c8f2;})});}_0xa8687c=_[_0xe06f('0x47')]({},_0xa8687c,_0x289550[_0xe06f('0x4b')]);return _0x291c8f[_0xe06f('0x58')](_0xa8687c);}})[_0xe06f('0x1b')](function(_0x59e76){if(_0x59e76){_0x4d4e8f=_0x59e76[_0xe06f('0x40')];if(!_0x289550['query'][_0xe06f('0x41')](_0xe06f('0x42'))){_0xa8687c[_0xe06f('0x2c')]=qs[_0xe06f('0x2c')](_0x289550[_0xe06f('0x3a')][_0xe06f('0x2c')]);_0xa8687c['offset']=qs[_0xe06f('0x2b')](_0x289550[_0xe06f('0x3a')][_0xe06f('0x2b')]);}return _0x291c8f[_0xe06f('0x58')](_0xa8687c);}})[_0xe06f('0x1b')](function(_0x5687a9){if(_0x5687a9){return _0x5687a9?{'count':_0x4d4e8f,'rows':_0x5687a9}:null;}})[_0xe06f('0x1b')](respondWithResult(_0x5c3813,null))[_0xe06f('0x26')](handleError(_0x5c3813,null));};exports['getSubjects']=function(_0x1e5ce0,_0x367c21,_0x45df4b){var _0x4423ea={};var _0x49d34f={};var _0x2acde6;var _0x102e9;return db[_0xe06f('0x4c')][_0xe06f('0x57')]({'where':{'id':_0x1e5ce0[_0xe06f('0x52')]['id']}})[_0xe06f('0x1b')](handleEntityNotFound(_0x367c21,null))[_0xe06f('0x1b')](function(_0x1024dc){if(_0x1024dc){_0x2acde6=_0x1024dc;_0x49d34f[_0xe06f('0x39')]=_[_0xe06f('0x3b')](db[_0xe06f('0x59')][_0xe06f('0x53')]);_0x49d34f[_0xe06f('0x3a')]=_['keys'](_0x1e5ce0[_0xe06f('0x3a')]);_0x49d34f['filters']=_[_0xe06f('0x3d')](_0x49d34f[_0xe06f('0x39')],_0x49d34f[_0xe06f('0x3a')]);_0x4423ea[_0xe06f('0x3e')]=_[_0xe06f('0x3d')](_0x49d34f[_0xe06f('0x39')],qs[_0xe06f('0x3f')](_0x1e5ce0[_0xe06f('0x3a')][_0xe06f('0x3f')]));_0x4423ea[_0xe06f('0x3e')]=_0x4423ea[_0xe06f('0x3e')][_0xe06f('0x40')]?_0x4423ea['attributes']:_0x49d34f[_0xe06f('0x39')];_0x4423ea[_0xe06f('0x43')]=qs[_0xe06f('0x44')](_0x1e5ce0[_0xe06f('0x3a')][_0xe06f('0x44')]);_0x4423ea[_0xe06f('0x48')]=qs['filters'](_[_0xe06f('0x45')](_0x1e5ce0[_0xe06f('0x3a')],_0x49d34f['filters']));if(_0x1e5ce0[_0xe06f('0x3a')][_0xe06f('0x46')]){_0x4423ea['where']=_['merge'](_0x4423ea[_0xe06f('0x48')],{'$or':_[_0xe06f('0x36')](_0x4423ea[_0xe06f('0x3e')],function(_0x13b8e9){var _0x24b84b={};_0x24b84b[_0x13b8e9]={'$like':'%'+_0x1e5ce0[_0xe06f('0x3a')][_0xe06f('0x46')]+'%'};return _0x24b84b;})});}_0x4423ea=_['merge']({},_0x4423ea,_0x1e5ce0[_0xe06f('0x4b')]);return _0x2acde6[_0xe06f('0x5a')](_0x4423ea);}})[_0xe06f('0x1b')](function(_0x212cdc){if(_0x212cdc){_0x102e9=_0x212cdc[_0xe06f('0x40')];if(!_0x1e5ce0[_0xe06f('0x3a')]['hasOwnProperty'](_0xe06f('0x42'))){_0x4423ea[_0xe06f('0x2c')]=qs[_0xe06f('0x2c')](_0x1e5ce0[_0xe06f('0x3a')][_0xe06f('0x2c')]);_0x4423ea['offset']=qs['offset'](_0x1e5ce0['query']['offset']);}return _0x2acde6[_0xe06f('0x5a')](_0x4423ea);}})[_0xe06f('0x1b')](function(_0x34f11a){if(_0x34f11a){return _0x34f11a?{'count':_0x102e9,'rows':_0x34f11a}:null;}})[_0xe06f('0x1b')](respondWithResult(_0x367c21,null))[_0xe06f('0x26')](handleError(_0x367c21,null));};exports['getDescriptions']=function(_0x3038aa,_0x599b8b,_0x1a0aba){var _0x5951c3={};var _0xcea439={};var _0x1d6660;var _0x4d0b18;return db[_0xe06f('0x4c')][_0xe06f('0x57')]({'where':{'id':_0x3038aa['params']['id']}})[_0xe06f('0x1b')](handleEntityNotFound(_0x599b8b,null))[_0xe06f('0x1b')](function(_0x37c2b2){if(_0x37c2b2){_0x1d6660=_0x37c2b2;_0xcea439['model']=_['keys'](db['DeskField'][_0xe06f('0x53')]);_0xcea439['query']=_[_0xe06f('0x3b')](_0x3038aa['query']);_0xcea439[_0xe06f('0x3c')]=_['intersection'](_0xcea439[_0xe06f('0x39')],_0xcea439[_0xe06f('0x3a')]);_0x5951c3[_0xe06f('0x3e')]=_[_0xe06f('0x3d')](_0xcea439['model'],qs[_0xe06f('0x3f')](_0x3038aa[_0xe06f('0x3a')][_0xe06f('0x3f')]));_0x5951c3[_0xe06f('0x3e')]=_0x5951c3[_0xe06f('0x3e')][_0xe06f('0x40')]?_0x5951c3[_0xe06f('0x3e')]:_0xcea439[_0xe06f('0x39')];_0x5951c3[_0xe06f('0x43')]=qs[_0xe06f('0x44')](_0x3038aa['query'][_0xe06f('0x44')]);_0x5951c3['where']=qs[_0xe06f('0x3c')](_['pick'](_0x3038aa['query'],_0xcea439[_0xe06f('0x3c')]));if(_0x3038aa[_0xe06f('0x3a')][_0xe06f('0x46')]){_0x5951c3[_0xe06f('0x48')]=_['merge'](_0x5951c3[_0xe06f('0x48')],{'$or':_[_0xe06f('0x36')](_0x5951c3[_0xe06f('0x3e')],function(_0x3334df){var _0x2efe4e={};_0x2efe4e[_0x3334df]={'$like':'%'+_0x3038aa[_0xe06f('0x3a')][_0xe06f('0x46')]+'%'};return _0x2efe4e;})});}_0x5951c3=_[_0xe06f('0x47')]({},_0x5951c3,_0x3038aa[_0xe06f('0x4b')]);return _0x1d6660[_0xe06f('0x5b')](_0x5951c3);}})[_0xe06f('0x1b')](function(_0xe86dca){if(_0xe86dca){_0x4d0b18=_0xe86dca[_0xe06f('0x40')];if(!_0x3038aa[_0xe06f('0x3a')][_0xe06f('0x41')](_0xe06f('0x42'))){_0x5951c3['limit']=qs[_0xe06f('0x2c')](_0x3038aa[_0xe06f('0x3a')][_0xe06f('0x2c')]);_0x5951c3[_0xe06f('0x2b')]=qs['offset'](_0x3038aa[_0xe06f('0x3a')]['offset']);}return _0x1d6660[_0xe06f('0x5b')](_0x5951c3);}})[_0xe06f('0x1b')](function(_0x254f0d){if(_0x254f0d){return _0x254f0d?{'count':_0x4d0b18,'rows':_0x254f0d}:null;}})[_0xe06f('0x1b')](respondWithResult(_0x599b8b,null))[_0xe06f('0x26')](handleError(_0x599b8b,null));};exports['getTags']=function(_0x4b5674,_0x18b007,_0x1947f6){var _0x2d96c4={};var _0x595f25={};var _0x297dcb;var _0x286d33;return db[_0xe06f('0x4c')][_0xe06f('0x57')]({'where':{'id':_0x4b5674[_0xe06f('0x52')]['id']}})[_0xe06f('0x1b')](handleEntityNotFound(_0x18b007,null))[_0xe06f('0x1b')](function(_0xe05e8b){if(_0xe05e8b){_0x297dcb=_0xe05e8b;_0x595f25[_0xe06f('0x39')]=_[_0xe06f('0x3b')](db[_0xe06f('0x5c')]['rawAttributes']);_0x595f25['query']=_[_0xe06f('0x3b')](_0x4b5674[_0xe06f('0x3a')]);_0x595f25[_0xe06f('0x3c')]=_[_0xe06f('0x3d')](_0x595f25[_0xe06f('0x39')],_0x595f25[_0xe06f('0x3a')]);_0x2d96c4[_0xe06f('0x3e')]=_['intersection'](_0x595f25[_0xe06f('0x39')],qs[_0xe06f('0x3f')](_0x4b5674[_0xe06f('0x3a')][_0xe06f('0x3f')]));_0x2d96c4[_0xe06f('0x3e')]=_0x2d96c4[_0xe06f('0x3e')][_0xe06f('0x40')]?_0x2d96c4[_0xe06f('0x3e')]:_0x595f25[_0xe06f('0x39')];_0x2d96c4[_0xe06f('0x43')]=qs[_0xe06f('0x44')](_0x4b5674[_0xe06f('0x3a')][_0xe06f('0x44')]);_0x2d96c4[_0xe06f('0x48')]=qs[_0xe06f('0x3c')](_[_0xe06f('0x45')](_0x4b5674[_0xe06f('0x3a')],_0x595f25['filters']));if(_0x4b5674[_0xe06f('0x3a')][_0xe06f('0x46')]){_0x2d96c4[_0xe06f('0x48')]=_[_0xe06f('0x47')](_0x2d96c4[_0xe06f('0x48')],{'$or':_['map'](_0x2d96c4['attributes'],function(_0x168e5b){var _0x55f17b={};_0x55f17b[_0x168e5b]={'$like':'%'+_0x4b5674[_0xe06f('0x3a')][_0xe06f('0x46')]+'%'};return _0x55f17b;})});}_0x2d96c4=_[_0xe06f('0x47')]({},_0x2d96c4,_0x4b5674[_0xe06f('0x4b')]);return _0x297dcb[_0xe06f('0x5d')](_0x2d96c4);}})['then'](function(_0x4796b1){if(_0x4796b1){_0x286d33=_0x4796b1[_0xe06f('0x40')];if(!_0x4b5674['query'][_0xe06f('0x41')](_0xe06f('0x42'))){_0x2d96c4[_0xe06f('0x2c')]=qs[_0xe06f('0x2c')](_0x4b5674['query'][_0xe06f('0x2c')]);_0x2d96c4[_0xe06f('0x2b')]=qs['offset'](_0x4b5674[_0xe06f('0x3a')][_0xe06f('0x2b')]);}return _0x297dcb[_0xe06f('0x5d')](_0x2d96c4);}})[_0xe06f('0x1b')](function(_0x2470a7){if(_0x2470a7){return _0x2470a7?{'count':_0x286d33,'rows':_0x2470a7}:null;}})[_0xe06f('0x1b')](respondWithResult(_0x18b007,null))[_0xe06f('0x26')](handleError(_0x18b007,null));};exports[_0xe06f('0x5e')]=function(_0x40856d,_0x3d8c89,_0x1b1b33){if(_0x40856d[_0xe06f('0x56')]['id']){delete _0x40856d[_0xe06f('0x56')]['id'];}return db[_0xe06f('0x4c')][_0xe06f('0x57')]({'where':{'id':_0x40856d[_0xe06f('0x52')]['id']}})[_0xe06f('0x1b')](handleEntityNotFound(_0x3d8c89,null))[_0xe06f('0x1b')](function(_0x3bf27f){if(_0x3bf27f){return _0x3bf27f[_0xe06f('0x5e')](_0x40856d[_0xe06f('0x56')]['ids']||[]);}return null;})[_0xe06f('0x1b')](respondWithResult(_0x3d8c89,null))[_0xe06f('0x26')](handleError(_0x3d8c89,null));}; \ No newline at end of file +var _0x0e74=['query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','merge','type','VIRTUAL','include','findAll','show','params','options','find','create','body','order','pick','filter','getFields','hasOwnProperty','findOne','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','key','model'];(function(_0x454ca5,_0x1c983a){var _0x19b12f=function(_0x388c01){while(--_0x388c01){_0x454ca5['push'](_0x454ca5['shift']());}};_0x19b12f(++_0x1c983a);}(_0x0e74,0xdd));var _0x40e7=function(_0x29a096,_0x2235f7){_0x29a096=_0x29a096-0x0;var _0x30cc18=_0x0e74[_0x29a096];return _0x30cc18;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x40e7('0x0'));var zipdir=require(_0x40e7('0x1'));var jsonpatch=require(_0x40e7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40e7('0x3'));var Mustache=require(_0x40e7('0x4'));var util=require(_0x40e7('0x5'));var path=require(_0x40e7('0x6'));var sox=require(_0x40e7('0x7'));var csv=require('to-csv');var ejs=require(_0x40e7('0x8'));var fs=require('fs');var _=require(_0x40e7('0x9'));var squel=require(_0x40e7('0xa'));var crypto=require(_0x40e7('0xb'));var jsforce=require(_0x40e7('0xc'));var deskjs=require(_0x40e7('0xd'));var toCsv=require(_0x40e7('0xe'));var querystring=require(_0x40e7('0xf'));var Papa=require(_0x40e7('0x10'));var Redis=require(_0x40e7('0x11'));var authService=require(_0x40e7('0x12'));var qs=require(_0x40e7('0x13'));var as=require(_0x40e7('0x14'));var hardwareService=require(_0x40e7('0x15'));var logger=require('../../config/logger')(_0x40e7('0x16'));var utils=require(_0x40e7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x40e7('0x18'));var db=require(_0x40e7('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x38d091,_0x1179bb,_0x38ec87,_0x1bd2db){return new BPromise(function(_0x3e10a5,_0x2b74a2){var _0x394dde=_0x1bd2db||client;return _0x394dde[_0x40e7('0x1a')](_0x38d091,_0x38ec87)[_0x40e7('0x1b')](function(_0x43f7d7){logger[_0x40e7('0x1c')](_0x40e7('0x1d'),_0x1179bb,_0x40e7('0x1e'));logger[_0x40e7('0x1f')](_0x40e7('0x20'),_0x1179bb,'request\x20sent',JSON[_0x40e7('0x21')](_0x43f7d7));if(_0x43f7d7['error']){if(_0x43f7d7[_0x40e7('0x22')]['code']===0x1f4){logger[_0x40e7('0x22')](_0x40e7('0x1d'),_0x1179bb,_0x43f7d7['error'][_0x40e7('0x23')]);return _0x2b74a2(_0x43f7d7[_0x40e7('0x22')][_0x40e7('0x23')]);}logger[_0x40e7('0x22')](_0x40e7('0x1d'),_0x1179bb,_0x43f7d7['error'][_0x40e7('0x23')]);return _0x3e10a5(_0x43f7d7[_0x40e7('0x22')][_0x40e7('0x23')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x1179bb,'request\x20sent');_0x3e10a5(_0x43f7d7['result'][_0x40e7('0x23')]);}})[_0x40e7('0x24')](function(_0x4042a0){logger['error'](_0x40e7('0x1d'),_0x1179bb,_0x4042a0);_0x2b74a2(_0x4042a0);});});}function respondWithStatusCode(_0x42a4ea,_0x3de383){_0x3de383=_0x3de383||0xcc;return function(_0x5de309){if(_0x5de309){return _0x42a4ea[_0x40e7('0x25')](_0x3de383);}return _0x42a4ea[_0x40e7('0x26')](_0x3de383)[_0x40e7('0x27')]();};}function respondWithResult(_0xf27fe5,_0x24f2c8){_0x24f2c8=_0x24f2c8||0xc8;return function(_0x77902f){if(_0x77902f){return _0xf27fe5[_0x40e7('0x26')](_0x24f2c8)['json'](_0x77902f);}};}function respondWithFilteredResult(_0x20ec9c,_0xde64df){return function(_0x284f83){if(_0x284f83){var _0x58b88e=_0x284f83['count'],_0x54a8fb=_0xde64df['offset'],_0x5e3677=_0xde64df[_0x40e7('0x28')]+_0xde64df['limit'],_0x23d549;if(_0x5e3677>=_0x58b88e){_0x5e3677=_0x58b88e;_0x23d549=0xc8;}else{_0x23d549=0xce;}_0x20ec9c[_0x40e7('0x26')](_0x23d549);return _0x20ec9c[_0x40e7('0x29')](_0x40e7('0x2a'),_0x54a8fb+'-'+_0x5e3677+'/'+_0x58b88e)[_0x40e7('0x2b')](_0x284f83);}return null;};}function patchUpdates(_0x2b15d1){return function(_0x2f1956){try{jsonpatch[_0x40e7('0x2c')](_0x2f1956,_0x2b15d1,!![]);}catch(_0x246b71){return BPromise[_0x40e7('0x2d')](_0x246b71);}return _0x2f1956[_0x40e7('0x2e')]();};}function saveUpdates(_0x16305e,_0x186dd7){return function(_0x5bbadc){if(_0x5bbadc){return _0x5bbadc[_0x40e7('0x2f')](_0x16305e)['then'](function(_0x31fea2){return _0x31fea2;});}return null;};}function removeEntity(_0x91a229,_0x2be98f){return function(_0x4b01fa){if(_0x4b01fa){return _0x4b01fa[_0x40e7('0x30')]()[_0x40e7('0x1b')](function(){_0x91a229[_0x40e7('0x26')](0xcc)[_0x40e7('0x27')]();});}};}function handleEntityNotFound(_0x18ca06,_0x744961){return function(_0x18f7ce){if(!_0x18f7ce){_0x18ca06[_0x40e7('0x25')](0x194);}return _0x18f7ce;};}function handleError(_0x25c1c3,_0x45e02f){_0x45e02f=_0x45e02f||0x1f4;return function(_0xe80465){logger[_0x40e7('0x22')](_0xe80465[_0x40e7('0x31')]);if(_0xe80465[_0x40e7('0x32')]){delete _0xe80465[_0x40e7('0x32')];}_0x25c1c3['status'](_0x45e02f)[_0x40e7('0x33')](_0xe80465);};}exports[_0x40e7('0x34')]=function(_0x13f4bf,_0x55a333){var _0x522782={},_0x5854c6={},_0x267b8e={'count':0x0,'rows':[]};var _0x2875c4=_[_0x40e7('0x35')](db[_0x40e7('0x36')][_0x40e7('0x37')],function(_0x34593c){return{'name':_0x34593c['fieldName'],'type':_0x34593c['type'][_0x40e7('0x38')]};});_0x5854c6[_0x40e7('0x39')]=_[_0x40e7('0x35')](_0x2875c4,_0x40e7('0x32'));_0x5854c6[_0x40e7('0x3a')]=_[_0x40e7('0x3b')](_0x13f4bf[_0x40e7('0x3a')]);_0x5854c6[_0x40e7('0x3c')]=_[_0x40e7('0x3d')](_0x5854c6['model'],_0x5854c6[_0x40e7('0x3a')]);_0x522782[_0x40e7('0x3e')]=_[_0x40e7('0x3d')](_0x5854c6['model'],qs['fields'](_0x13f4bf[_0x40e7('0x3a')][_0x40e7('0x3f')]));_0x522782[_0x40e7('0x3e')]=_0x522782[_0x40e7('0x3e')][_0x40e7('0x40')]?_0x522782['attributes']:_0x5854c6['model'];if(!_0x13f4bf[_0x40e7('0x3a')]['hasOwnProperty'](_0x40e7('0x41'))){_0x522782['limit']=qs['limit'](_0x13f4bf[_0x40e7('0x3a')][_0x40e7('0x42')]);_0x522782['offset']=qs['offset'](_0x13f4bf['query']['offset']);}_0x522782['order']=qs[_0x40e7('0x43')](_0x13f4bf[_0x40e7('0x3a')][_0x40e7('0x43')]);_0x522782[_0x40e7('0x44')]=qs['filters'](_['pick'](_0x13f4bf[_0x40e7('0x3a')],_0x5854c6[_0x40e7('0x3c')]),_0x2875c4);if(_0x13f4bf[_0x40e7('0x3a')]['filter']){_0x522782[_0x40e7('0x44')]=_[_0x40e7('0x45')](_0x522782['where'],{'$or':_['map'](_0x2875c4,function(_0x4cc438){if(_0x4cc438[_0x40e7('0x46')]!==_0x40e7('0x47')){var _0x31cf73={};_0x31cf73[_0x4cc438[_0x40e7('0x32')]]={'$like':'%'+_0x13f4bf['query']['filter']+'%'};return _0x31cf73;}})});}_0x522782=_[_0x40e7('0x45')]({},_0x522782,_0x13f4bf['options']);var _0x349d10={'where':_0x522782['where']};return db[_0x40e7('0x36')]['count'](_0x349d10)[_0x40e7('0x1b')](function(_0x287381){_0x267b8e['count']=_0x287381;if(_0x13f4bf[_0x40e7('0x3a')]['includeAll']){_0x522782[_0x40e7('0x48')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x40e7('0x49')](_0x522782);})[_0x40e7('0x1b')](function(_0x396021){_0x267b8e['rows']=_0x396021;return _0x267b8e;})[_0x40e7('0x1b')](respondWithFilteredResult(_0x55a333,_0x522782))[_0x40e7('0x24')](handleError(_0x55a333,null));};exports[_0x40e7('0x4a')]=function(_0x5bfcf9,_0x50c2d4){var _0x4ab65a={'raw':![],'where':{'id':_0x5bfcf9[_0x40e7('0x4b')]['id']}},_0x3db65f={};_0x3db65f[_0x40e7('0x39')]=_[_0x40e7('0x3b')](db[_0x40e7('0x36')]['rawAttributes']);_0x3db65f[_0x40e7('0x3a')]=_[_0x40e7('0x3b')](_0x5bfcf9['query']);_0x3db65f[_0x40e7('0x3c')]=_[_0x40e7('0x3d')](_0x3db65f[_0x40e7('0x39')],_0x3db65f[_0x40e7('0x3a')]);_0x4ab65a[_0x40e7('0x3e')]=_[_0x40e7('0x3d')](_0x3db65f[_0x40e7('0x39')],qs['fields'](_0x5bfcf9[_0x40e7('0x3a')][_0x40e7('0x3f')]));_0x4ab65a['attributes']=_0x4ab65a['attributes'][_0x40e7('0x40')]?_0x4ab65a[_0x40e7('0x3e')]:_0x3db65f[_0x40e7('0x39')];if(_0x5bfcf9[_0x40e7('0x3a')]['includeAll']){_0x4ab65a[_0x40e7('0x48')]=[{'all':!![]}];}_0x4ab65a=_[_0x40e7('0x45')]({},_0x4ab65a,_0x5bfcf9[_0x40e7('0x4c')]);return db[_0x40e7('0x36')][_0x40e7('0x4d')](_0x4ab65a)[_0x40e7('0x1b')](handleEntityNotFound(_0x50c2d4,null))[_0x40e7('0x1b')](respondWithResult(_0x50c2d4,null))[_0x40e7('0x24')](handleError(_0x50c2d4,null));};exports[_0x40e7('0x4e')]=function(_0x4b71d8,_0x1e1d8e){return db[_0x40e7('0x36')]['create'](_0x4b71d8[_0x40e7('0x4f')],{})['then'](respondWithResult(_0x1e1d8e,0xc9))[_0x40e7('0x24')](handleError(_0x1e1d8e,null));};exports[_0x40e7('0x2f')]=function(_0x4593dd,_0x726b8a){if(_0x4593dd['body']['id']){delete _0x4593dd[_0x40e7('0x4f')]['id'];}return db[_0x40e7('0x36')][_0x40e7('0x4d')]({'where':{'id':_0x4593dd[_0x40e7('0x4b')]['id']}})[_0x40e7('0x1b')](handleEntityNotFound(_0x726b8a,null))[_0x40e7('0x1b')](saveUpdates(_0x4593dd[_0x40e7('0x4f')],null))[_0x40e7('0x1b')](respondWithResult(_0x726b8a,null))[_0x40e7('0x24')](handleError(_0x726b8a,null));};exports[_0x40e7('0x30')]=function(_0x1e5fa9,_0x57c68b){return db[_0x40e7('0x36')][_0x40e7('0x4d')]({'where':{'id':_0x1e5fa9[_0x40e7('0x4b')]['id']}})[_0x40e7('0x1b')](handleEntityNotFound(_0x57c68b,null))['then'](removeEntity(_0x57c68b,null))['catch'](handleError(_0x57c68b,null));};exports['getFields']=function(_0x29b5eb,_0x16a7c9,_0x5effcd){var _0x4d3bc5={};var _0x34c41a={};var _0xdf03b5;var _0x2defe3;return db[_0x40e7('0x36')]['findOne']({'where':{'id':_0x29b5eb[_0x40e7('0x4b')]['id']}})[_0x40e7('0x1b')](handleEntityNotFound(_0x16a7c9,null))[_0x40e7('0x1b')](function(_0x591c22){if(_0x591c22){_0xdf03b5=_0x591c22;_0x34c41a[_0x40e7('0x39')]=_[_0x40e7('0x3b')](db['DeskField'][_0x40e7('0x37')]);_0x34c41a[_0x40e7('0x3a')]=_[_0x40e7('0x3b')](_0x29b5eb[_0x40e7('0x3a')]);_0x34c41a[_0x40e7('0x3c')]=_['intersection'](_0x34c41a[_0x40e7('0x39')],_0x34c41a['query']);_0x4d3bc5[_0x40e7('0x3e')]=_[_0x40e7('0x3d')](_0x34c41a[_0x40e7('0x39')],qs[_0x40e7('0x3f')](_0x29b5eb[_0x40e7('0x3a')][_0x40e7('0x3f')]));_0x4d3bc5[_0x40e7('0x3e')]=_0x4d3bc5[_0x40e7('0x3e')][_0x40e7('0x40')]?_0x4d3bc5[_0x40e7('0x3e')]:_0x34c41a['model'];_0x4d3bc5[_0x40e7('0x50')]=qs[_0x40e7('0x43')](_0x29b5eb[_0x40e7('0x3a')][_0x40e7('0x43')]);_0x4d3bc5[_0x40e7('0x44')]=qs[_0x40e7('0x3c')](_[_0x40e7('0x51')](_0x29b5eb[_0x40e7('0x3a')],_0x34c41a[_0x40e7('0x3c')]));if(_0x29b5eb[_0x40e7('0x3a')][_0x40e7('0x52')]){_0x4d3bc5['where']=_['merge'](_0x4d3bc5['where'],{'$or':_[_0x40e7('0x35')](_0x4d3bc5[_0x40e7('0x3e')],function(_0x506c88){var _0x3a6e1b={};_0x3a6e1b[_0x506c88]={'$like':'%'+_0x29b5eb[_0x40e7('0x3a')]['filter']+'%'};return _0x3a6e1b;})});}_0x4d3bc5=_[_0x40e7('0x45')]({},_0x4d3bc5,_0x29b5eb[_0x40e7('0x4c')]);return _0xdf03b5[_0x40e7('0x53')](_0x4d3bc5);}})[_0x40e7('0x1b')](function(_0x437672){if(_0x437672){_0x2defe3=_0x437672[_0x40e7('0x40')];if(!_0x29b5eb[_0x40e7('0x3a')][_0x40e7('0x54')]('nolimit')){_0x4d3bc5[_0x40e7('0x42')]=qs[_0x40e7('0x42')](_0x29b5eb[_0x40e7('0x3a')][_0x40e7('0x42')]);_0x4d3bc5[_0x40e7('0x28')]=qs['offset'](_0x29b5eb[_0x40e7('0x3a')][_0x40e7('0x28')]);}return _0xdf03b5[_0x40e7('0x53')](_0x4d3bc5);}})[_0x40e7('0x1b')](function(_0x299847){if(_0x299847){return _0x299847?{'count':_0x2defe3,'rows':_0x299847}:null;}})['then'](respondWithResult(_0x16a7c9,null))[_0x40e7('0x24')](handleError(_0x16a7c9,null));};exports['getSubjects']=function(_0x4b4d83,_0x3f68dc,_0x86f027){var _0x19d3d5={};var _0x22100a={};var _0x5e6d81;var _0x2559f6;return db[_0x40e7('0x36')][_0x40e7('0x55')]({'where':{'id':_0x4b4d83[_0x40e7('0x4b')]['id']}})[_0x40e7('0x1b')](handleEntityNotFound(_0x3f68dc,null))[_0x40e7('0x1b')](function(_0x31218f){if(_0x31218f){_0x5e6d81=_0x31218f;_0x22100a['model']=_['keys'](db['DeskField'][_0x40e7('0x37')]);_0x22100a['query']=_['keys'](_0x4b4d83['query']);_0x22100a[_0x40e7('0x3c')]=_[_0x40e7('0x3d')](_0x22100a['model'],_0x22100a[_0x40e7('0x3a')]);_0x19d3d5['attributes']=_[_0x40e7('0x3d')](_0x22100a['model'],qs[_0x40e7('0x3f')](_0x4b4d83['query'][_0x40e7('0x3f')]));_0x19d3d5[_0x40e7('0x3e')]=_0x19d3d5['attributes'][_0x40e7('0x40')]?_0x19d3d5[_0x40e7('0x3e')]:_0x22100a[_0x40e7('0x39')];_0x19d3d5[_0x40e7('0x50')]=qs[_0x40e7('0x43')](_0x4b4d83[_0x40e7('0x3a')]['sort']);_0x19d3d5[_0x40e7('0x44')]=qs[_0x40e7('0x3c')](_['pick'](_0x4b4d83[_0x40e7('0x3a')],_0x22100a['filters']));if(_0x4b4d83[_0x40e7('0x3a')][_0x40e7('0x52')]){_0x19d3d5[_0x40e7('0x44')]=_[_0x40e7('0x45')](_0x19d3d5[_0x40e7('0x44')],{'$or':_[_0x40e7('0x35')](_0x19d3d5[_0x40e7('0x3e')],function(_0x23fc5f){var _0x2f7dcc={};_0x2f7dcc[_0x23fc5f]={'$like':'%'+_0x4b4d83[_0x40e7('0x3a')][_0x40e7('0x52')]+'%'};return _0x2f7dcc;})});}_0x19d3d5=_['merge']({},_0x19d3d5,_0x4b4d83[_0x40e7('0x4c')]);return _0x5e6d81[_0x40e7('0x56')](_0x19d3d5);}})[_0x40e7('0x1b')](function(_0x41b77b){if(_0x41b77b){_0x2559f6=_0x41b77b[_0x40e7('0x40')];if(!_0x4b4d83[_0x40e7('0x3a')][_0x40e7('0x54')](_0x40e7('0x41'))){_0x19d3d5[_0x40e7('0x42')]=qs['limit'](_0x4b4d83[_0x40e7('0x3a')][_0x40e7('0x42')]);_0x19d3d5[_0x40e7('0x28')]=qs['offset'](_0x4b4d83[_0x40e7('0x3a')]['offset']);}return _0x5e6d81['getSubjects'](_0x19d3d5);}})[_0x40e7('0x1b')](function(_0x370d2d){if(_0x370d2d){return _0x370d2d?{'count':_0x2559f6,'rows':_0x370d2d}:null;}})[_0x40e7('0x1b')](respondWithResult(_0x3f68dc,null))['catch'](handleError(_0x3f68dc,null));};exports[_0x40e7('0x57')]=function(_0x178455,_0x204a82,_0x2b8a11){var _0x41adc1={};var _0x5e845f={};var _0x9a4c4e;var _0x5e7be7;return db[_0x40e7('0x36')]['findOne']({'where':{'id':_0x178455['params']['id']}})[_0x40e7('0x1b')](handleEntityNotFound(_0x204a82,null))[_0x40e7('0x1b')](function(_0x251ea2){if(_0x251ea2){_0x9a4c4e=_0x251ea2;_0x5e845f['model']=_[_0x40e7('0x3b')](db[_0x40e7('0x58')]['rawAttributes']);_0x5e845f[_0x40e7('0x3a')]=_[_0x40e7('0x3b')](_0x178455[_0x40e7('0x3a')]);_0x5e845f[_0x40e7('0x3c')]=_['intersection'](_0x5e845f[_0x40e7('0x39')],_0x5e845f[_0x40e7('0x3a')]);_0x41adc1[_0x40e7('0x3e')]=_['intersection'](_0x5e845f['model'],qs['fields'](_0x178455['query'][_0x40e7('0x3f')]));_0x41adc1[_0x40e7('0x3e')]=_0x41adc1[_0x40e7('0x3e')][_0x40e7('0x40')]?_0x41adc1[_0x40e7('0x3e')]:_0x5e845f[_0x40e7('0x39')];_0x41adc1[_0x40e7('0x50')]=qs[_0x40e7('0x43')](_0x178455[_0x40e7('0x3a')][_0x40e7('0x43')]);_0x41adc1[_0x40e7('0x44')]=qs['filters'](_[_0x40e7('0x51')](_0x178455[_0x40e7('0x3a')],_0x5e845f[_0x40e7('0x3c')]));if(_0x178455['query'][_0x40e7('0x52')]){_0x41adc1[_0x40e7('0x44')]=_[_0x40e7('0x45')](_0x41adc1[_0x40e7('0x44')],{'$or':_[_0x40e7('0x35')](_0x41adc1[_0x40e7('0x3e')],function(_0x970523){var _0x26ef90={};_0x26ef90[_0x970523]={'$like':'%'+_0x178455['query']['filter']+'%'};return _0x26ef90;})});}_0x41adc1=_[_0x40e7('0x45')]({},_0x41adc1,_0x178455['options']);return _0x9a4c4e[_0x40e7('0x57')](_0x41adc1);}})[_0x40e7('0x1b')](function(_0x2d876d){if(_0x2d876d){_0x5e7be7=_0x2d876d[_0x40e7('0x40')];if(!_0x178455[_0x40e7('0x3a')][_0x40e7('0x54')](_0x40e7('0x41'))){_0x41adc1['limit']=qs[_0x40e7('0x42')](_0x178455[_0x40e7('0x3a')][_0x40e7('0x42')]);_0x41adc1['offset']=qs[_0x40e7('0x28')](_0x178455[_0x40e7('0x3a')][_0x40e7('0x28')]);}return _0x9a4c4e[_0x40e7('0x57')](_0x41adc1);}})[_0x40e7('0x1b')](function(_0x5d6b8a){if(_0x5d6b8a){return _0x5d6b8a?{'count':_0x5e7be7,'rows':_0x5d6b8a}:null;}})[_0x40e7('0x1b')](respondWithResult(_0x204a82,null))[_0x40e7('0x24')](handleError(_0x204a82,null));};exports[_0x40e7('0x59')]=function(_0x57efb6,_0x119c5b,_0x29e0f6){var _0x490370={};var _0x3f2295={};var _0x57721a;var _0x3c6846;return db[_0x40e7('0x36')][_0x40e7('0x55')]({'where':{'id':_0x57efb6[_0x40e7('0x4b')]['id']}})[_0x40e7('0x1b')](handleEntityNotFound(_0x119c5b,null))[_0x40e7('0x1b')](function(_0x257cc8){if(_0x257cc8){_0x57721a=_0x257cc8;_0x3f2295[_0x40e7('0x39')]=_[_0x40e7('0x3b')](db[_0x40e7('0x5a')][_0x40e7('0x37')]);_0x3f2295[_0x40e7('0x3a')]=_[_0x40e7('0x3b')](_0x57efb6[_0x40e7('0x3a')]);_0x3f2295[_0x40e7('0x3c')]=_[_0x40e7('0x3d')](_0x3f2295[_0x40e7('0x39')],_0x3f2295[_0x40e7('0x3a')]);_0x490370[_0x40e7('0x3e')]=_['intersection'](_0x3f2295['model'],qs[_0x40e7('0x3f')](_0x57efb6[_0x40e7('0x3a')][_0x40e7('0x3f')]));_0x490370[_0x40e7('0x3e')]=_0x490370[_0x40e7('0x3e')]['length']?_0x490370[_0x40e7('0x3e')]:_0x3f2295[_0x40e7('0x39')];_0x490370[_0x40e7('0x50')]=qs['sort'](_0x57efb6[_0x40e7('0x3a')][_0x40e7('0x43')]);_0x490370[_0x40e7('0x44')]=qs[_0x40e7('0x3c')](_[_0x40e7('0x51')](_0x57efb6['query'],_0x3f2295[_0x40e7('0x3c')]));if(_0x57efb6[_0x40e7('0x3a')][_0x40e7('0x52')]){_0x490370[_0x40e7('0x44')]=_[_0x40e7('0x45')](_0x490370[_0x40e7('0x44')],{'$or':_[_0x40e7('0x35')](_0x490370[_0x40e7('0x3e')],function(_0x47125f){var _0x4baaea={};_0x4baaea[_0x47125f]={'$like':'%'+_0x57efb6['query']['filter']+'%'};return _0x4baaea;})});}_0x490370=_[_0x40e7('0x45')]({},_0x490370,_0x57efb6[_0x40e7('0x4c')]);return _0x57721a[_0x40e7('0x59')](_0x490370);}})[_0x40e7('0x1b')](function(_0x3167dc){if(_0x3167dc){_0x3c6846=_0x3167dc['length'];if(!_0x57efb6[_0x40e7('0x3a')]['hasOwnProperty'](_0x40e7('0x41'))){_0x490370['limit']=qs[_0x40e7('0x42')](_0x57efb6[_0x40e7('0x3a')]['limit']);_0x490370[_0x40e7('0x28')]=qs[_0x40e7('0x28')](_0x57efb6[_0x40e7('0x3a')][_0x40e7('0x28')]);}return _0x57721a[_0x40e7('0x59')](_0x490370);}})['then'](function(_0x181aa7){if(_0x181aa7){return _0x181aa7?{'count':_0x3c6846,'rows':_0x181aa7}:null;}})[_0x40e7('0x1b')](respondWithResult(_0x119c5b,null))[_0x40e7('0x24')](handleError(_0x119c5b,null));};exports[_0x40e7('0x5b')]=function(_0x4a5794,_0x48ad36,_0x3a3bb5){if(_0x4a5794[_0x40e7('0x4f')]['id']){delete _0x4a5794['body']['id'];}return db['DeskConfiguration'][_0x40e7('0x55')]({'where':{'id':_0x4a5794[_0x40e7('0x4b')]['id']}})[_0x40e7('0x1b')](handleEntityNotFound(_0x48ad36,null))['then'](function(_0x9667c5){if(_0x9667c5){return _0x9667c5[_0x40e7('0x5b')](_0x4a5794[_0x40e7('0x4f')][_0x40e7('0x5c')]||[]);}return null;})[_0x40e7('0x1b')](respondWithResult(_0x48ad36,null))['catch'](handleError(_0x48ad36,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0102dc6..507639b 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 _0x8d8d=['define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x4159c6,_0x44a6be){var _0x20b31e=function(_0x2dc0df){while(--_0x2dc0df){_0x4159c6['push'](_0x4159c6['shift']());}};_0x20b31e(++_0x44a6be);}(_0x8d8d,0x6c));var _0xd8d8=function(_0x4eec01,_0x342e8a){_0x4eec01=_0x4eec01-0x0;var _0xaf374d=_0x8d8d[_0x4eec01];return _0xaf374d;};'use strict';var _=require(_0xd8d8('0x0'));var util=require(_0xd8d8('0x1'));var logger=require(_0xd8d8('0x2'))(_0xd8d8('0x3'));var moment=require(_0xd8d8('0x4'));var BPromise=require(_0xd8d8('0x5'));var rp=require(_0xd8d8('0x6'));var fs=require('fs');var path=require(_0xd8d8('0x7'));var rimraf=require(_0xd8d8('0x8'));var config=require(_0xd8d8('0x9'));var attributes=require(_0xd8d8('0xa'));module[_0xd8d8('0xb')]=function(_0x24cc1d,_0x134df5){return _0x24cc1d[_0xd8d8('0xc')](_0xd8d8('0xd'),attributes,{'tableName':_0xd8d8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb25c=['path','rimraf','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x350258,_0x4e0a50){var _0x3714b3=function(_0x8918f7){while(--_0x8918f7){_0x350258['push'](_0x350258['shift']());}};_0x3714b3(++_0x4e0a50);}(_0xb25c,0x145));var _0xcb25=function(_0x4c5e89,_0x4f60eb){_0x4c5e89=_0x4c5e89-0x0;var _0x20d8e0=_0xb25c[_0x4c5e89];return _0x20d8e0;};'use strict';var _=require(_0xcb25('0x0'));var util=require('util');var logger=require(_0xcb25('0x1'))(_0xcb25('0x2'));var moment=require('moment');var BPromise=require(_0xcb25('0x3'));var rp=require(_0xcb25('0x4'));var fs=require('fs');var path=require(_0xcb25('0x5'));var rimraf=require(_0xcb25('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0xcb25('0x7')]=function(_0x320e36,_0xc8941c){return _0x320e36[_0xcb25('0x8')](_0xcb25('0x9'),attributes,{'tableName':_0xcb25('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index f7df038..58a9f16 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 _0x9099=['../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x42d1c8,_0xc13c44){var _0x22f990=function(_0x3ce85f){while(--_0x3ce85f){_0x42d1c8['push'](_0x42d1c8['shift']());}};_0x22f990(++_0xc13c44);}(_0x9099,0x1ac));var _0x9909=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x9099[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x9909('0x0'));var util=require('util');var moment=require(_0x9909('0x1'));var BPromise=require(_0x9909('0x2'));var rs=require(_0x9909('0x3'));var fs=require('fs');var Redis=require(_0x9909('0x4'));var db=require(_0x9909('0x5'))['db'];var utils=require(_0x9909('0x6'));var logger=require(_0x9909('0x7'))(_0x9909('0x8'));var config=require(_0x9909('0x9'));var jayson=require(_0x9909('0xa'));var client=jayson[_0x9909('0xb')][_0x9909('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b7391,_0x3dc2dd,_0x54011f){return new BPromise(function(_0x6d755a,_0x5dcd39){return client['request'](_0x3b7391,_0x54011f)['then'](function(_0x5023b7){logger[_0x9909('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x3dc2dd,_0x9909('0xe'));logger[_0x9909('0xf')](_0x9909('0x10'),_0x3dc2dd,'request\x20sent',JSON[_0x9909('0x11')](_0x5023b7));if(_0x5023b7['error']){if(_0x5023b7[_0x9909('0x12')][_0x9909('0x13')]===0x1f4){logger[_0x9909('0x12')](_0x9909('0x14'),_0x3dc2dd,_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);return _0x5dcd39(_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);}logger[_0x9909('0x12')](_0x9909('0x14'),_0x3dc2dd,_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);return _0x6d755a(_0x5023b7[_0x9909('0x12')]['message']);}else{logger[_0x9909('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x3dc2dd,_0x9909('0xe'));_0x6d755a(_0x5023b7['result'][_0x9909('0x15')]);}})[_0x9909('0x16')](function(_0x245f0d){logger['error'](_0x9909('0x14'),_0x3dc2dd,_0x245f0d);_0x5dcd39(_0x245f0d);});});} \ No newline at end of file +var _0x6b61=['DeskConfiguration,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x1a1479,_0x5f4fcf){var _0x32f171=function(_0x23e72e){while(--_0x23e72e){_0x1a1479['push'](_0x1a1479['shift']());}};_0x32f171(++_0x5f4fcf);}(_0x6b61,0x16a));var _0x16b6=function(_0x2f2360,_0x151089){_0x2f2360=_0x2f2360-0x0;var _0x1cc8d3=_0x6b61[_0x2f2360];return _0x1cc8d3;};'use strict';var _=require(_0x16b6('0x0'));var util=require('util');var moment=require(_0x16b6('0x1'));var BPromise=require(_0x16b6('0x2'));var rs=require(_0x16b6('0x3'));var fs=require('fs');var Redis=require(_0x16b6('0x4'));var db=require(_0x16b6('0x5'))['db'];var utils=require(_0x16b6('0x6'));var logger=require(_0x16b6('0x7'))(_0x16b6('0x8'));var config=require('../../config/environment');var jayson=require(_0x16b6('0x9'));var client=jayson[_0x16b6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d06d6,_0x268d89,_0x59552d){return new BPromise(function(_0x460269,_0x3cd025){return client['request'](_0x3d06d6,_0x59552d)['then'](function(_0x5713bc){logger[_0x16b6('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x268d89,_0x16b6('0xc'));logger[_0x16b6('0xd')](_0x16b6('0xe'),_0x268d89,_0x16b6('0xc'),JSON[_0x16b6('0xf')](_0x5713bc));if(_0x5713bc[_0x16b6('0x10')]){if(_0x5713bc[_0x16b6('0x10')]['code']===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x268d89,_0x5713bc[_0x16b6('0x10')][_0x16b6('0x11')]);return _0x3cd025(_0x5713bc[_0x16b6('0x10')][_0x16b6('0x11')]);}logger[_0x16b6('0x10')](_0x16b6('0x12'),_0x268d89,_0x5713bc[_0x16b6('0x10')]['message']);return _0x460269(_0x5713bc[_0x16b6('0x10')]['message']);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x268d89,'request\x20sent');_0x460269(_0x5713bc['result']['message']);}})[_0x16b6('0x13')](function(_0x537eba){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x268d89,_0x537eba);_0x3cd025(_0x537eba);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 0d2e264..fdb70b6 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 _0x8f75=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x16558a,_0x2c448e){var _0x295a62=function(_0x40ef89){while(--_0x40ef89){_0x16558a['push'](_0x16558a['shift']());}};_0x295a62(++_0x2c448e);}(_0x8f75,0x1b8));var _0x58f7=function(_0x57cc2d,_0x6eb32d){_0x57cc2d=_0x57cc2d-0x0;var _0xef80b1=_0x8f75[_0x57cc2d];return _0xef80b1;};'use strict';var multer=require(_0x58f7('0x0'));var util=require('util');var path=require(_0x58f7('0x1'));var timeout=require(_0x58f7('0x2'));var express=require(_0x58f7('0x3'));var router=express[_0x58f7('0x4')]();var auth=require(_0x58f7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x58f7('0x6'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0x58f7('0x7')](),controller['index']);router[_0x58f7('0x8')](_0x58f7('0x9'),auth[_0x58f7('0x7')](),controller[_0x58f7('0xa')]);router['post']('/',auth[_0x58f7('0x7')](),controller[_0x58f7('0xb')]);router[_0x58f7('0xc')](_0x58f7('0x9'),auth[_0x58f7('0x7')](),controller[_0x58f7('0xd')]);router[_0x58f7('0xe')]('/:id',auth[_0x58f7('0x7')](),controller[_0x58f7('0xf')]);module[_0x58f7('0x10')]=router; \ No newline at end of file +var _0x57e4=['util','path','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x3696e3,_0x599d05){var _0x286959=function(_0x252d89){while(--_0x252d89){_0x3696e3['push'](_0x3696e3['shift']());}};_0x286959(++_0x599d05);}(_0x57e4,0xe0));var _0x457e=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x57e4[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x457e('0x0'));var util=require(_0x457e('0x1'));var path=require(_0x457e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x457e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x457e('0x4'));var config=require(_0x457e('0x5'));var controller=require('./intDeskField.controller');router[_0x457e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x457e('0x6')]('/:id',auth[_0x457e('0x7')](),controller['show']);router[_0x457e('0x8')]('/',auth[_0x457e('0x7')](),controller[_0x457e('0x9')]);router[_0x457e('0xa')](_0x457e('0xb'),auth[_0x457e('0x7')](),controller['update']);router[_0x457e('0xc')](_0x457e('0xb'),auth[_0x457e('0x7')](),controller[_0x457e('0xd')]);module[_0x457e('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index d9ccd2e..b6d9729 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 _0x45b6=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','STRING','variable'];(function(_0x7a12bd,_0x131bf3){var _0x48a902=function(_0x38b640){while(--_0x38b640){_0x7a12bd['push'](_0x7a12bd['shift']());}};_0x48a902(++_0x131bf3);}(_0x45b6,0x1ba));var _0x645b=function(_0x316263,_0x12f550){_0x316263=_0x316263-0x0;var _0xd45914=_0x45b6[_0x316263];return _0xd45914;};'use strict';var Sequelize=require(_0x645b('0x0'));module[_0x645b('0x1')]={'type':{'type':Sequelize[_0x645b('0x2')](_0x645b('0x3'),'variable',_0x645b('0x4'),_0x645b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x645b('0x6')]},'key':{'type':Sequelize[_0x645b('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x645b('0x7'),_0x645b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x645b('0x6')]},'nameField':{'type':Sequelize[_0x645b('0x6')]},'customField':{'type':Sequelize[_0x645b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x645b('0x6')]}}; \ No newline at end of file +var _0x2d43=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','STRING'];(function(_0x1f3972,_0x11e719){var _0x53bc7c=function(_0x4bcf61){while(--_0x4bcf61){_0x1f3972['push'](_0x1f3972['shift']());}};_0x53bc7c(++_0x11e719);}(_0x2d43,0x1a5));var _0x32d4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2d43[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x32d4('0x0'));module[_0x32d4('0x1')]={'type':{'type':Sequelize[_0x32d4('0x2')](_0x32d4('0x3'),'variable',_0x32d4('0x4'),'keyValue'),'defaultValue':_0x32d4('0x3')},'content':{'type':Sequelize[_0x32d4('0x5')]},'key':{'type':Sequelize[_0x32d4('0x5')]},'keyType':{'type':Sequelize[_0x32d4('0x2')](_0x32d4('0x3'),'variable',_0x32d4('0x4'))},'keyContent':{'type':Sequelize[_0x32d4('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x32d4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x32d4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5f483da..24f2276 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 _0x9c90=['where','options','count','then','catch','show','params','includeAll','include','merge','create','body','find','destroy','eml-format','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','status','set','Content-Range','apply','reject','save','update','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter'];(function(_0x469078,_0x1bf084){var _0x4349f8=function(_0x38982f){while(--_0x38982f){_0x469078['push'](_0x469078['shift']());}};_0x4349f8(++_0x1bf084);}(_0x9c90,0x12a));var _0x09c9=function(_0x5c468f,_0x2e5c25){_0x5c468f=_0x5c468f-0x0;var _0x2136b0=_0x9c90[_0x5c468f];return _0x2136b0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x09c9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c9('0x1'));var moment=require(_0x09c9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x09c9('0x3'));var util=require('util');var path=require(_0x09c9('0x4'));var sox=require(_0x09c9('0x5'));var csv=require(_0x09c9('0x6'));var ejs=require(_0x09c9('0x7'));var fs=require('fs');var _=require(_0x09c9('0x8'));var squel=require(_0x09c9('0x9'));var crypto=require(_0x09c9('0xa'));var jsforce=require(_0x09c9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x09c9('0x6'));var querystring=require('querystring');var Papa=require(_0x09c9('0xc'));var Redis=require('ioredis');var authService=require(_0x09c9('0xd'));var qs=require(_0x09c9('0xe'));var as=require(_0x09c9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09c9('0x10'))(_0x09c9('0x11'));var utils=require(_0x09c9('0x12'));var config=require(_0x09c9('0x13'));var licenseUtil=require(_0x09c9('0x14'));var db=require(_0x09c9('0x15'))['db'];function respondWithStatusCode(_0x413ea1,_0x4afb5e){_0x4afb5e=_0x4afb5e||0xcc;return function(_0xd75207){if(_0xd75207){return _0x413ea1[_0x09c9('0x16')](_0x4afb5e);}return _0x413ea1['status'](_0x4afb5e)[_0x09c9('0x17')]();};}function respondWithResult(_0x46bd22,_0x47c5e4){_0x47c5e4=_0x47c5e4||0xc8;return function(_0x55e1b6){if(_0x55e1b6){return _0x46bd22['status'](_0x47c5e4)['json'](_0x55e1b6);}};}function respondWithFilteredResult(_0x13fd88,_0x40f1b8){return function(_0x7d6989){if(_0x7d6989){var _0x23a1c0=_0x7d6989['count'],_0x310fac=_0x40f1b8[_0x09c9('0x18')],_0x25cbb2=_0x40f1b8[_0x09c9('0x18')]+_0x40f1b8[_0x09c9('0x19')],_0x3dbcb3;if(_0x25cbb2>=_0x23a1c0){_0x25cbb2=_0x23a1c0;_0x3dbcb3=0xc8;}else{_0x3dbcb3=0xce;}_0x13fd88[_0x09c9('0x1a')](_0x3dbcb3);return _0x13fd88[_0x09c9('0x1b')](_0x09c9('0x1c'),_0x310fac+'-'+_0x25cbb2+'/'+_0x23a1c0)['json'](_0x7d6989);}return null;};}function patchUpdates(_0x232948){return function(_0x4f82f0){try{jsonpatch[_0x09c9('0x1d')](_0x4f82f0,_0x232948,!![]);}catch(_0x4f8946){return BPromise[_0x09c9('0x1e')](_0x4f8946);}return _0x4f82f0[_0x09c9('0x1f')]();};}function saveUpdates(_0x5ca326,_0xf52500){return function(_0x1ad83c){if(_0x1ad83c){return _0x1ad83c[_0x09c9('0x20')](_0x5ca326)['then'](function(_0x86c3da){return _0x86c3da;});}return null;};}function removeEntity(_0x273723,_0x3f00a1){return function(_0x6bd850){if(_0x6bd850){return _0x6bd850['destroy']()['then'](function(){_0x273723[_0x09c9('0x1a')](0xcc)[_0x09c9('0x17')]();});}};}function handleEntityNotFound(_0x560f7c,_0x447c7f){return function(_0x4afd42){if(!_0x4afd42){_0x560f7c[_0x09c9('0x16')](0x194);}return _0x4afd42;};}function handleError(_0x487277,_0x3eb381){_0x3eb381=_0x3eb381||0x1f4;return function(_0x1e7677){logger[_0x09c9('0x21')](_0x1e7677[_0x09c9('0x22')]);if(_0x1e7677[_0x09c9('0x23')]){delete _0x1e7677['name'];}_0x487277[_0x09c9('0x1a')](_0x3eb381)[_0x09c9('0x24')](_0x1e7677);};}exports[_0x09c9('0x25')]=function(_0x300673,_0x20e667){var _0x4186e0={},_0x48c772={},_0x3ea1b3={'count':0x0,'rows':[]};var _0x16d3fc=_[_0x09c9('0x26')](db[_0x09c9('0x27')][_0x09c9('0x28')],function(_0x5d17b7){return{'name':_0x5d17b7[_0x09c9('0x29')],'type':_0x5d17b7[_0x09c9('0x2a')][_0x09c9('0x2b')]};});_0x48c772[_0x09c9('0x2c')]=_[_0x09c9('0x26')](_0x16d3fc,_0x09c9('0x23'));_0x48c772[_0x09c9('0x2d')]=_[_0x09c9('0x2e')](_0x300673[_0x09c9('0x2d')]);_0x48c772[_0x09c9('0x2f')]=_[_0x09c9('0x30')](_0x48c772[_0x09c9('0x2c')],_0x48c772[_0x09c9('0x2d')]);_0x4186e0[_0x09c9('0x31')]=_['intersection'](_0x48c772[_0x09c9('0x2c')],qs[_0x09c9('0x32')](_0x300673[_0x09c9('0x2d')]['fields']));_0x4186e0[_0x09c9('0x31')]=_0x4186e0[_0x09c9('0x31')][_0x09c9('0x33')]?_0x4186e0[_0x09c9('0x31')]:_0x48c772[_0x09c9('0x2c')];if(!_0x300673[_0x09c9('0x2d')][_0x09c9('0x34')](_0x09c9('0x35'))){_0x4186e0['limit']=qs[_0x09c9('0x19')](_0x300673[_0x09c9('0x2d')][_0x09c9('0x19')]);_0x4186e0[_0x09c9('0x18')]=qs['offset'](_0x300673['query']['offset']);}_0x4186e0[_0x09c9('0x36')]=qs['sort'](_0x300673[_0x09c9('0x2d')][_0x09c9('0x37')]);_0x4186e0['where']=qs['filters'](_['pick'](_0x300673[_0x09c9('0x2d')],_0x48c772['filters']),_0x16d3fc);if(_0x300673[_0x09c9('0x2d')][_0x09c9('0x38')]){_0x4186e0[_0x09c9('0x39')]=_['merge'](_0x4186e0[_0x09c9('0x39')],{'$or':_[_0x09c9('0x26')](_0x16d3fc,function(_0x4ea54b){if(_0x4ea54b[_0x09c9('0x2a')]!=='VIRTUAL'){var _0x1beef5={};_0x1beef5[_0x4ea54b[_0x09c9('0x23')]]={'$like':'%'+_0x300673['query'][_0x09c9('0x38')]+'%'};return _0x1beef5;}})});}_0x4186e0=_['merge']({},_0x4186e0,_0x300673[_0x09c9('0x3a')]);var _0x50ea0e={'where':_0x4186e0['where']};return db['DeskField'][_0x09c9('0x3b')](_0x50ea0e)[_0x09c9('0x3c')](function(_0x18fb43){_0x3ea1b3[_0x09c9('0x3b')]=_0x18fb43;if(_0x300673[_0x09c9('0x2d')]['includeAll']){_0x4186e0['include']=[{'all':!![]}];}return db[_0x09c9('0x27')]['findAll'](_0x4186e0);})['then'](function(_0x5ad002){_0x3ea1b3['rows']=_0x5ad002;return _0x3ea1b3;})[_0x09c9('0x3c')](respondWithFilteredResult(_0x20e667,_0x4186e0))[_0x09c9('0x3d')](handleError(_0x20e667,null));};exports[_0x09c9('0x3e')]=function(_0x2406e5,_0x5357cd){var _0x284976={'raw':!![],'where':{'id':_0x2406e5[_0x09c9('0x3f')]['id']}},_0x2ad5e1={};_0x2ad5e1[_0x09c9('0x2c')]=_[_0x09c9('0x2e')](db[_0x09c9('0x27')][_0x09c9('0x28')]);_0x2ad5e1[_0x09c9('0x2d')]=_[_0x09c9('0x2e')](_0x2406e5['query']);_0x2ad5e1[_0x09c9('0x2f')]=_[_0x09c9('0x30')](_0x2ad5e1[_0x09c9('0x2c')],_0x2ad5e1[_0x09c9('0x2d')]);_0x284976[_0x09c9('0x31')]=_[_0x09c9('0x30')](_0x2ad5e1[_0x09c9('0x2c')],qs[_0x09c9('0x32')](_0x2406e5[_0x09c9('0x2d')][_0x09c9('0x32')]));_0x284976['attributes']=_0x284976[_0x09c9('0x31')][_0x09c9('0x33')]?_0x284976[_0x09c9('0x31')]:_0x2ad5e1['model'];if(_0x2406e5['query'][_0x09c9('0x40')]){_0x284976[_0x09c9('0x41')]=[{'all':!![]}];}_0x284976=_[_0x09c9('0x42')]({},_0x284976,_0x2406e5[_0x09c9('0x3a')]);return db[_0x09c9('0x27')]['find'](_0x284976)[_0x09c9('0x3c')](handleEntityNotFound(_0x5357cd,null))[_0x09c9('0x3c')](respondWithResult(_0x5357cd,null))[_0x09c9('0x3d')](handleError(_0x5357cd,null));};exports[_0x09c9('0x43')]=function(_0x353cf2,_0x2260d8){return db[_0x09c9('0x27')][_0x09c9('0x43')](_0x353cf2[_0x09c9('0x44')],{})[_0x09c9('0x3c')](respondWithResult(_0x2260d8,0xc9))['catch'](handleError(_0x2260d8,null));};exports[_0x09c9('0x20')]=function(_0x48b03b,_0x329422){if(_0x48b03b['body']['id']){delete _0x48b03b[_0x09c9('0x44')]['id'];}return db[_0x09c9('0x27')][_0x09c9('0x45')]({'where':{'id':_0x48b03b[_0x09c9('0x3f')]['id']}})[_0x09c9('0x3c')](handleEntityNotFound(_0x329422,null))[_0x09c9('0x3c')](saveUpdates(_0x48b03b['body'],null))[_0x09c9('0x3c')](respondWithResult(_0x329422,null))['catch'](handleError(_0x329422,null));};exports[_0x09c9('0x46')]=function(_0x283dd2,_0x1ad28b){return db[_0x09c9('0x27')][_0x09c9('0x45')]({'where':{'id':_0x283dd2[_0x09c9('0x3f')]['id']}})[_0x09c9('0x3c')](handleEntityNotFound(_0x1ad28b,null))[_0x09c9('0x3c')](removeEntity(_0x1ad28b,null))[_0x09c9('0x3d')](handleError(_0x1ad28b,null));}; \ No newline at end of file +var _0x127f=['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','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','find','create','body','update','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x127f,0xd7));var _0xf127=function(_0x4e64b7,_0x12f8fa){_0x4e64b7=_0x4e64b7-0x0;var _0x3e9500=_0x127f[_0x4e64b7];return _0x3e9500;};'use strict';var pdf=require(_0xf127('0x0'));var emlformat=require(_0xf127('0x1'));var rimraf=require(_0xf127('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf127('0x3'));var moment=require(_0xf127('0x4'));var BPromise=require(_0xf127('0x5'));var Mustache=require(_0xf127('0x6'));var util=require(_0xf127('0x7'));var path=require('path');var sox=require(_0xf127('0x8'));var csv=require(_0xf127('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf127('0xa'));var squel=require(_0xf127('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf127('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf127('0xd'));var Papa=require(_0xf127('0xe'));var Redis=require(_0xf127('0xf'));var authService=require(_0xf127('0x10'));var qs=require(_0xf127('0x11'));var as=require(_0xf127('0x12'));var hardwareService=require(_0xf127('0x13'));var logger=require(_0xf127('0x14'))(_0xf127('0x15'));var utils=require(_0xf127('0x16'));var config=require(_0xf127('0x17'));var licenseUtil=require(_0xf127('0x18'));var db=require(_0xf127('0x19'))['db'];function respondWithStatusCode(_0x18d948,_0x2944d8){_0x2944d8=_0x2944d8||0xcc;return function(_0x3c4829){if(_0x3c4829){return _0x18d948[_0xf127('0x1a')](_0x2944d8);}return _0x18d948[_0xf127('0x1b')](_0x2944d8)[_0xf127('0x1c')]();};}function respondWithResult(_0x311419,_0x3c2ae3){_0x3c2ae3=_0x3c2ae3||0xc8;return function(_0xce36d3){if(_0xce36d3){return _0x311419[_0xf127('0x1b')](_0x3c2ae3)[_0xf127('0x1d')](_0xce36d3);}};}function respondWithFilteredResult(_0x3622d3,_0x38517a){return function(_0x51d154){if(_0x51d154){var _0x5ee098=_0x51d154[_0xf127('0x1e')],_0x1e5272=_0x38517a[_0xf127('0x1f')],_0x29c968=_0x38517a[_0xf127('0x1f')]+_0x38517a[_0xf127('0x20')],_0xfb2a22;if(_0x29c968>=_0x5ee098){_0x29c968=_0x5ee098;_0xfb2a22=0xc8;}else{_0xfb2a22=0xce;}_0x3622d3[_0xf127('0x1b')](_0xfb2a22);return _0x3622d3[_0xf127('0x21')](_0xf127('0x22'),_0x1e5272+'-'+_0x29c968+'/'+_0x5ee098)['json'](_0x51d154);}return null;};}function patchUpdates(_0x4961c0){return function(_0x1ffa22){try{jsonpatch[_0xf127('0x23')](_0x1ffa22,_0x4961c0,!![]);}catch(_0x5666fd){return BPromise[_0xf127('0x24')](_0x5666fd);}return _0x1ffa22[_0xf127('0x25')]();};}function saveUpdates(_0x45ec07,_0x1ffee0){return function(_0x3cdb46){if(_0x3cdb46){return _0x3cdb46['update'](_0x45ec07)['then'](function(_0x306405){return _0x306405;});}return null;};}function removeEntity(_0x3dd5cb,_0x3ee059){return function(_0x5ecf7e){if(_0x5ecf7e){return _0x5ecf7e[_0xf127('0x26')]()['then'](function(){_0x3dd5cb[_0xf127('0x1b')](0xcc)[_0xf127('0x1c')]();});}};}function handleEntityNotFound(_0x345d82,_0x5d1f8d){return function(_0x5ea553){if(!_0x5ea553){_0x345d82[_0xf127('0x1a')](0x194);}return _0x5ea553;};}function handleError(_0x34c7dd,_0x3dddfa){_0x3dddfa=_0x3dddfa||0x1f4;return function(_0x2b1437){logger[_0xf127('0x27')](_0x2b1437[_0xf127('0x28')]);if(_0x2b1437[_0xf127('0x29')]){delete _0x2b1437['name'];}_0x34c7dd[_0xf127('0x1b')](_0x3dddfa)['send'](_0x2b1437);};}exports[_0xf127('0x2a')]=function(_0x3f70d5,_0x1b1b24){var _0x56c100={},_0x41668c={},_0x380540={'count':0x0,'rows':[]};var _0xb488a=_[_0xf127('0x2b')](db[_0xf127('0x2c')][_0xf127('0x2d')],function(_0x3c2967){return{'name':_0x3c2967[_0xf127('0x2e')],'type':_0x3c2967[_0xf127('0x2f')][_0xf127('0x30')]};});_0x41668c[_0xf127('0x31')]=_[_0xf127('0x2b')](_0xb488a,'name');_0x41668c[_0xf127('0x32')]=_[_0xf127('0x33')](_0x3f70d5['query']);_0x41668c[_0xf127('0x34')]=_[_0xf127('0x35')](_0x41668c[_0xf127('0x31')],_0x41668c[_0xf127('0x32')]);_0x56c100[_0xf127('0x36')]=_['intersection'](_0x41668c['model'],qs[_0xf127('0x37')](_0x3f70d5['query'][_0xf127('0x37')]));_0x56c100[_0xf127('0x36')]=_0x56c100[_0xf127('0x36')][_0xf127('0x38')]?_0x56c100['attributes']:_0x41668c[_0xf127('0x31')];if(!_0x3f70d5[_0xf127('0x32')][_0xf127('0x39')](_0xf127('0x3a'))){_0x56c100[_0xf127('0x20')]=qs['limit'](_0x3f70d5[_0xf127('0x32')]['limit']);_0x56c100['offset']=qs[_0xf127('0x1f')](_0x3f70d5[_0xf127('0x32')]['offset']);}_0x56c100['order']=qs['sort'](_0x3f70d5[_0xf127('0x32')][_0xf127('0x3b')]);_0x56c100[_0xf127('0x3c')]=qs[_0xf127('0x34')](_['pick'](_0x3f70d5[_0xf127('0x32')],_0x41668c[_0xf127('0x34')]),_0xb488a);if(_0x3f70d5[_0xf127('0x32')][_0xf127('0x3d')]){_0x56c100[_0xf127('0x3c')]=_[_0xf127('0x3e')](_0x56c100[_0xf127('0x3c')],{'$or':_[_0xf127('0x2b')](_0xb488a,function(_0x56cecc){if(_0x56cecc[_0xf127('0x2f')]!==_0xf127('0x3f')){var _0x5d5fc0={};_0x5d5fc0[_0x56cecc['name']]={'$like':'%'+_0x3f70d5[_0xf127('0x32')]['filter']+'%'};return _0x5d5fc0;}})});}_0x56c100=_['merge']({},_0x56c100,_0x3f70d5[_0xf127('0x40')]);var _0x1ed17a={'where':_0x56c100['where']};return db[_0xf127('0x2c')][_0xf127('0x1e')](_0x1ed17a)[_0xf127('0x41')](function(_0x96628c){_0x380540[_0xf127('0x1e')]=_0x96628c;if(_0x3f70d5['query'][_0xf127('0x42')]){_0x56c100[_0xf127('0x43')]=[{'all':!![]}];}return db[_0xf127('0x2c')][_0xf127('0x44')](_0x56c100);})['then'](function(_0x5e5386){_0x380540[_0xf127('0x45')]=_0x5e5386;return _0x380540;})['then'](respondWithFilteredResult(_0x1b1b24,_0x56c100))[_0xf127('0x46')](handleError(_0x1b1b24,null));};exports[_0xf127('0x47')]=function(_0xe8195a,_0xf08190){var _0x26c7fe={'raw':!![],'where':{'id':_0xe8195a['params']['id']}},_0x35bc21={};_0x35bc21[_0xf127('0x31')]=_[_0xf127('0x33')](db[_0xf127('0x2c')][_0xf127('0x2d')]);_0x35bc21['query']=_[_0xf127('0x33')](_0xe8195a[_0xf127('0x32')]);_0x35bc21['filters']=_['intersection'](_0x35bc21[_0xf127('0x31')],_0x35bc21[_0xf127('0x32')]);_0x26c7fe[_0xf127('0x36')]=_[_0xf127('0x35')](_0x35bc21['model'],qs[_0xf127('0x37')](_0xe8195a[_0xf127('0x32')][_0xf127('0x37')]));_0x26c7fe[_0xf127('0x36')]=_0x26c7fe[_0xf127('0x36')][_0xf127('0x38')]?_0x26c7fe['attributes']:_0x35bc21[_0xf127('0x31')];if(_0xe8195a[_0xf127('0x32')]['includeAll']){_0x26c7fe[_0xf127('0x43')]=[{'all':!![]}];}_0x26c7fe=_[_0xf127('0x3e')]({},_0x26c7fe,_0xe8195a[_0xf127('0x40')]);return db[_0xf127('0x2c')][_0xf127('0x48')](_0x26c7fe)['then'](handleEntityNotFound(_0xf08190,null))[_0xf127('0x41')](respondWithResult(_0xf08190,null))[_0xf127('0x46')](handleError(_0xf08190,null));};exports[_0xf127('0x49')]=function(_0x1f8901,_0xc08a09){return db[_0xf127('0x2c')][_0xf127('0x49')](_0x1f8901[_0xf127('0x4a')],{})[_0xf127('0x41')](respondWithResult(_0xc08a09,0xc9))[_0xf127('0x46')](handleError(_0xc08a09,null));};exports[_0xf127('0x4b')]=function(_0xecabac,_0x35acba){if(_0xecabac[_0xf127('0x4a')]['id']){delete _0xecabac[_0xf127('0x4a')]['id'];}return db[_0xf127('0x2c')][_0xf127('0x48')]({'where':{'id':_0xecabac['params']['id']}})[_0xf127('0x41')](handleEntityNotFound(_0x35acba,null))[_0xf127('0x41')](saveUpdates(_0xecabac[_0xf127('0x4a')],null))['then'](respondWithResult(_0x35acba,null))[_0xf127('0x46')](handleError(_0x35acba,null));};exports[_0xf127('0x26')]=function(_0x3c168d,_0xc2739c){return db[_0xf127('0x2c')]['find']({'where':{'id':_0x3c168d['params']['id']}})[_0xf127('0x41')](handleEntityNotFound(_0xc2739c,null))[_0xf127('0x41')](removeEntity(_0xc2739c,null))['catch'](handleError(_0xc2739c,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ec7e61e..e4f960e 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 _0x8554=['util','../../config/logger','api','moment','request-promise','path','rimraf','exports','DeskField','int_desk_fields','desk_unique_index','FieldId','lodash'];(function(_0x5b8394,_0x25ea3d){var _0x2ea3de=function(_0x36bbbd){while(--_0x36bbbd){_0x5b8394['push'](_0x5b8394['shift']());}};_0x2ea3de(++_0x25ea3d);}(_0x8554,0x74));var _0x4855=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8554[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4855('0x0'));var util=require(_0x4855('0x1'));var logger=require(_0x4855('0x2'))(_0x4855('0x3'));var moment=require(_0x4855('0x4'));var BPromise=require('bluebird');var rp=require(_0x4855('0x5'));var fs=require('fs');var path=require(_0x4855('0x6'));var rimraf=require(_0x4855('0x7'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0x4855('0x8')]=function(_0x306a8b,_0x13ba8b){return _0x306a8b['define'](_0x4855('0x9'),attributes,{'tableName':_0x4855('0xa'),'paranoid':![],'indexes':[{'name':_0x4855('0xb'),'fields':['idField',_0x4855('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa29c=['DeskField','int_desk_fields','idField','FieldId','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x358b71,_0xd4ee77){var _0x2725d3=function(_0x1df4fd){while(--_0x1df4fd){_0x358b71['push'](_0x358b71['shift']());}};_0x2725d3(++_0xd4ee77);}(_0xa29c,0x122));var _0xca29=function(_0x1b363a,_0x48f07b){_0x1b363a=_0x1b363a-0x0;var _0x364c22=_0xa29c[_0x1b363a];return _0x364c22;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xca29('0x0'));var moment=require(_0xca29('0x1'));var BPromise=require(_0xca29('0x2'));var rp=require(_0xca29('0x3'));var fs=require('fs');var path=require(_0xca29('0x4'));var rimraf=require(_0xca29('0x5'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xca29('0x6')]=function(_0x58915f,_0x484718){return _0x58915f['define'](_0xca29('0x7'),attributes,{'tableName':_0xca29('0x8'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xca29('0x9'),_0xca29('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 407c9f7..dce121d 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 _0x9aca=['client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x9aca,0x147));var _0xa9ac=function(_0x25d7a5,_0x1ebe42){_0x25d7a5=_0x25d7a5-0x0;var _0x5d9303=_0x9aca[_0x25d7a5];return _0x5d9303;};'use strict';var _=require(_0xa9ac('0x0'));var util=require(_0xa9ac('0x1'));var moment=require(_0xa9ac('0x2'));var BPromise=require('bluebird');var rs=require(_0xa9ac('0x3'));var fs=require('fs');var Redis=require(_0xa9ac('0x4'));var db=require(_0xa9ac('0x5'))['db'];var utils=require(_0xa9ac('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa9ac('0x7'));var jayson=require(_0xa9ac('0x8'));var client=jayson[_0xa9ac('0x9')][_0xa9ac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3144eb,_0x134e6e,_0x7c3847){return new BPromise(function(_0x23e9e9,_0x1b99eb){return client[_0xa9ac('0xb')](_0x3144eb,_0x7c3847)['then'](function(_0x5817b0){logger[_0xa9ac('0xc')](_0xa9ac('0xd'),_0x134e6e,_0xa9ac('0xe'));logger[_0xa9ac('0xf')](_0xa9ac('0x10'),_0x134e6e,'request\x20sent',JSON['stringify'](_0x5817b0));if(_0x5817b0[_0xa9ac('0x11')]){if(_0x5817b0[_0xa9ac('0x11')][_0xa9ac('0x12')]===0x1f4){logger['error'](_0xa9ac('0xd'),_0x134e6e,_0x5817b0['error'][_0xa9ac('0x13')]);return _0x1b99eb(_0x5817b0[_0xa9ac('0x11')]['message']);}logger['error'](_0xa9ac('0xd'),_0x134e6e,_0x5817b0[_0xa9ac('0x11')][_0xa9ac('0x13')]);return _0x23e9e9(_0x5817b0['error'][_0xa9ac('0x13')]);}else{logger[_0xa9ac('0xc')](_0xa9ac('0xd'),_0x134e6e,'request\x20sent');_0x23e9e9(_0x5817b0['result']['message']);}})[_0xa9ac('0x14')](function(_0x4ee567){logger['error'](_0xa9ac('0xd'),_0x134e6e,_0x4ee567);_0x1b99eb(_0x4ee567);});});} \ No newline at end of file +var _0xfbf9=['request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','DeskField,\x20%s,\x20%s'];(function(_0x50a081,_0x5cdeac){var _0xd3be01=function(_0x240c75){while(--_0x240c75){_0x50a081['push'](_0x50a081['shift']());}};_0xd3be01(++_0x5cdeac);}(_0xfbf9,0x16d));var _0x9fbf=function(_0x4dcb47,_0x50ef92){_0x4dcb47=_0x4dcb47-0x0;var _0x352b40=_0xfbf9[_0x4dcb47];return _0x352b40;};'use strict';var _=require(_0x9fbf('0x0'));var util=require(_0x9fbf('0x1'));var moment=require('moment');var BPromise=require(_0x9fbf('0x2'));var rs=require(_0x9fbf('0x3'));var fs=require('fs');var Redis=require(_0x9fbf('0x4'));var db=require(_0x9fbf('0x5'))['db'];var utils=require(_0x9fbf('0x6'));var logger=require('../../config/logger')(_0x9fbf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9fbf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17715f,_0x461e58,_0x3a7f33){return new BPromise(function(_0xb8426d,_0x24eff4){return client[_0x9fbf('0x9')](_0x17715f,_0x3a7f33)[_0x9fbf('0xa')](function(_0x4c1010){logger[_0x9fbf('0xb')](_0x9fbf('0xc'),_0x461e58,_0x9fbf('0xd'));logger[_0x9fbf('0xe')](_0x9fbf('0xf'),_0x461e58,_0x9fbf('0xd'),JSON['stringify'](_0x4c1010));if(_0x4c1010[_0x9fbf('0x10')]){if(_0x4c1010[_0x9fbf('0x10')][_0x9fbf('0x11')]===0x1f4){logger[_0x9fbf('0x10')](_0x9fbf('0xc'),_0x461e58,_0x4c1010[_0x9fbf('0x10')][_0x9fbf('0x12')]);return _0x24eff4(_0x4c1010[_0x9fbf('0x10')][_0x9fbf('0x12')]);}logger[_0x9fbf('0x10')]('DeskField,\x20%s,\x20%s',_0x461e58,_0x4c1010[_0x9fbf('0x10')][_0x9fbf('0x12')]);return _0xb8426d(_0x4c1010[_0x9fbf('0x10')][_0x9fbf('0x12')]);}else{logger[_0x9fbf('0xb')](_0x9fbf('0xc'),_0x461e58,_0x9fbf('0xd'));_0xb8426d(_0x4c1010[_0x9fbf('0x13')][_0x9fbf('0x12')]);}})[_0x9fbf('0x14')](function(_0x570ccb){logger[_0x9fbf('0x10')](_0x9fbf('0xc'),_0x461e58,_0x570ccb);_0x24eff4(_0x570ccb);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index fa5f02a..2690e65 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 _0xaa50=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0xaa50,0xc0));var _0x0aa5=function(_0x15dd25,_0x480651){_0x15dd25=_0x15dd25-0x0;var _0x23696f=_0xaa50[_0x15dd25];return _0x23696f;};'use strict';var multer=require(_0x0aa5('0x0'));var util=require(_0x0aa5('0x1'));var path=require(_0x0aa5('0x2'));var timeout=require(_0x0aa5('0x3'));var express=require(_0x0aa5('0x4'));var router=express['Router']();var auth=require(_0x0aa5('0x5'));var interaction=require(_0x0aa5('0x6'));var config=require(_0x0aa5('0x7'));var controller=require(_0x0aa5('0x8'));router[_0x0aa5('0x9')]('/',auth[_0x0aa5('0xa')](),controller[_0x0aa5('0xb')]);router[_0x0aa5('0x9')](_0x0aa5('0xc'),auth[_0x0aa5('0xa')](),controller[_0x0aa5('0xd')]);router[_0x0aa5('0x9')](_0x0aa5('0xe'),auth[_0x0aa5('0xa')](),controller['getConfigurations']);router[_0x0aa5('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x0aa5('0xf')]);router[_0x0aa5('0x10')]('/',auth[_0x0aa5('0xa')](),controller[_0x0aa5('0x11')]);router['post']('/:id/configurations',auth[_0x0aa5('0xa')](),controller[_0x0aa5('0x12')]);router[_0x0aa5('0x13')](_0x0aa5('0xc'),auth[_0x0aa5('0xa')](),controller[_0x0aa5('0x14')]);router[_0x0aa5('0x15')](_0x0aa5('0xc'),auth['isAuthenticated'](),controller[_0x0aa5('0x16')]);module[_0x0aa5('0x17')]=router; \ No newline at end of file +var _0x3f0d=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getFields','post','/:id/configurations','addConfiguration','put','update','destroy','exports','multer'];(function(_0x39ab2b,_0x454e7d){var _0x3d8178=function(_0x34dc12){while(--_0x34dc12){_0x39ab2b['push'](_0x39ab2b['shift']());}};_0x3d8178(++_0x454e7d);}(_0x3f0d,0x68));var _0xd3f0=function(_0x3fe214,_0x23909c){_0x3fe214=_0x3fe214-0x0;var _0x1790d1=_0x3f0d[_0x3fe214];return _0x1790d1;};'use strict';var multer=require(_0xd3f0('0x0'));var util=require('util');var path=require(_0xd3f0('0x1'));var timeout=require('connect-timeout');var express=require(_0xd3f0('0x2'));var router=express[_0xd3f0('0x3')]();var auth=require(_0xd3f0('0x4'));var interaction=require(_0xd3f0('0x5'));var config=require(_0xd3f0('0x6'));var controller=require(_0xd3f0('0x7'));router[_0xd3f0('0x8')]('/',auth[_0xd3f0('0x9')](),controller[_0xd3f0('0xa')]);router[_0xd3f0('0x8')](_0xd3f0('0xb'),auth[_0xd3f0('0x9')](),controller[_0xd3f0('0xc')]);router[_0xd3f0('0x8')]('/:id/configurations',auth[_0xd3f0('0x9')](),controller['getConfigurations']);router[_0xd3f0('0x8')]('/:id/fields',auth[_0xd3f0('0x9')](),controller[_0xd3f0('0xd')]);router[_0xd3f0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd3f0('0xe')](_0xd3f0('0xf'),auth[_0xd3f0('0x9')](),controller[_0xd3f0('0x10')]);router[_0xd3f0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd3f0('0x12')]);router['delete']('/:id',auth[_0xd3f0('0x9')](),controller[_0xd3f0('0x13')]);module[_0xd3f0('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 92198d8..9c80e0e 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 _0x00d1=['exports','STRING','sequelize'];(function(_0x4bf0bc,_0x2c6490){var _0x223837=function(_0x4edeb6){while(--_0x4edeb6){_0x4bf0bc['push'](_0x4bf0bc['shift']());}};_0x223837(++_0x2c6490);}(_0x00d1,0x86));var _0x100d=function(_0xabb8a1,_0x5ed479){_0xabb8a1=_0xabb8a1-0x0;var _0x9a4673=_0x00d1[_0xabb8a1];return _0x9a4673;};'use strict';var Sequelize=require(_0x100d('0x0'));module[_0x100d('0x1')]={'name':{'type':Sequelize[_0x100d('0x2')]},'username':{'type':Sequelize[_0x100d('0x2')]},'password':{'type':Sequelize[_0x100d('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x100d('0x2')]},'clientId':{'type':Sequelize[_0x100d('0x2')]},'clientSecret':{'type':Sequelize[_0x100d('0x2')]},'serverUrl':{'type':Sequelize[_0x100d('0x2')]},'description':{'type':Sequelize[_0x100d('0x2')]}}; \ No newline at end of file +var _0x432a=['exports','STRING','sequelize'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x432a,0xf8));var _0xa432=function(_0x245728,_0x1e8ca4){_0x245728=_0x245728-0x0;var _0x1be470=_0x432a[_0x245728];return _0x1be470;};'use strict';var Sequelize=require(_0xa432('0x0'));module[_0xa432('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa432('0x2')]},'remoteUri':{'type':Sequelize[_0xa432('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa432('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xa432('0x2')]},'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 b5ee84c..f9612f8 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 _0xc4aa=['statusCode','send','Wrong\x20credentials','EntityDefinitions(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','DisplayName','Label',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','reject','save','destroy','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Dynamics365Account','include','findAll','rows','includeAll','find','create','update','body','params','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId','channel','getDescriptions','Dynamics365Field','ticketType','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','masteridname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret','remoteUri','slice','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','GET','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test'];(function(_0x41a1f5,_0x11b2b0){var _0x3c088c=function(_0x3741f1){while(--_0x3741f1){_0x41a1f5['push'](_0x41a1f5['shift']());}};_0x3c088c(++_0x11b2b0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');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('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];var integrations=require(_0xac4a('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xac4a('0x18')][_0xac4a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x247b78,_0x6e00d4,_0x1b4313,_0x3b71c0){return new BPromise(function(_0x34bc01,_0x33c287){var _0x190418=_0x3b71c0||client;return _0x190418[_0xac4a('0x1a')](_0x247b78,_0x1b4313)[_0xac4a('0x1b')](function(_0x26dbb8){logger['info'](_0xac4a('0x1c'),_0x6e00d4,_0xac4a('0x1d'));logger[_0xac4a('0x1e')](_0xac4a('0x1f'),_0x6e00d4,_0xac4a('0x1d'),JSON[_0xac4a('0x20')](_0x26dbb8));if(_0x26dbb8[_0xac4a('0x21')]){if(_0x26dbb8[_0xac4a('0x21')]['code']===0x1f4){logger['error'](_0xac4a('0x1c'),_0x6e00d4,_0x26dbb8[_0xac4a('0x21')][_0xac4a('0x22')]);return _0x33c287(_0x26dbb8['error'][_0xac4a('0x22')]);}logger[_0xac4a('0x21')](_0xac4a('0x1c'),_0x6e00d4,_0x26dbb8[_0xac4a('0x21')][_0xac4a('0x22')]);return _0x34bc01(_0x26dbb8[_0xac4a('0x21')][_0xac4a('0x22')]);}else{logger[_0xac4a('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x6e00d4,_0xac4a('0x1d'));_0x34bc01(_0x26dbb8[_0xac4a('0x24')]['message']);}})[_0xac4a('0x25')](function(_0x4169c0){logger[_0xac4a('0x21')](_0xac4a('0x1c'),_0x6e00d4,_0x4169c0);_0x33c287(_0x4169c0);});});}function respondWithStatusCode(_0x4d2d6c,_0x1b7998){_0x1b7998=_0x1b7998||0xcc;return function(_0x2503d8){if(_0x2503d8){return _0x4d2d6c[_0xac4a('0x26')](_0x1b7998);}return _0x4d2d6c[_0xac4a('0x27')](_0x1b7998)[_0xac4a('0x28')]();};}function respondWithResult(_0x2b0dc2,_0x222507){_0x222507=_0x222507||0xc8;return function(_0x36054a){if(_0x36054a){return _0x2b0dc2[_0xac4a('0x27')](_0x222507)[_0xac4a('0x29')](_0x36054a);}};}function respondWithFilteredResult(_0x1d0539,_0x215a31){return function(_0x14832b){if(_0x14832b){var _0x472c57=_0x14832b[_0xac4a('0x2a')],_0x1c13dc=_0x215a31[_0xac4a('0x2b')],_0x20202c=_0x215a31[_0xac4a('0x2b')]+_0x215a31[_0xac4a('0x2c')],_0x4e17ce;if(_0x20202c>=_0x472c57){_0x20202c=_0x472c57;_0x4e17ce=0xc8;}else{_0x4e17ce=0xce;}_0x1d0539[_0xac4a('0x27')](_0x4e17ce);return _0x1d0539['set']('Content-Range',_0x1c13dc+'-'+_0x20202c+'/'+_0x472c57)[_0xac4a('0x29')](_0x14832b);}return null;};}function patchUpdates(_0x7a948b){return function(_0x1f12d5){try{jsonpatch['apply'](_0x1f12d5,_0x7a948b,!![]);}catch(_0x4bda1f){return BPromise[_0xac4a('0x2d')](_0x4bda1f);}return _0x1f12d5[_0xac4a('0x2e')]();};}function saveUpdates(_0x228629,_0x432066){return function(_0x17118e){if(_0x17118e){return _0x17118e['update'](_0x228629)[_0xac4a('0x1b')](function(_0x482afc){return _0x482afc;});}return null;};}function removeEntity(_0x30364b,_0x57adcf){return function(_0x17e6de){if(_0x17e6de){return _0x17e6de[_0xac4a('0x2f')]()[_0xac4a('0x1b')](function(){_0x30364b[_0xac4a('0x27')](0xcc)[_0xac4a('0x28')]();});}};}function handleEntityNotFound(_0x61e552,_0xbd4591){return function(_0x1f13f3){if(!_0x1f13f3){_0x61e552[_0xac4a('0x26')](0x194);}return _0x1f13f3;};}function handleError(_0xfd7c16,_0x36ab49){_0x36ab49=_0x36ab49||0x1f4;return function(_0x1634df){logger[_0xac4a('0x21')](_0x1634df[_0xac4a('0x30')]);if(_0x1634df['name']){delete _0x1634df[_0xac4a('0x31')];}_0xfd7c16[_0xac4a('0x27')](_0x36ab49)['send'](_0x1634df);};}exports[_0xac4a('0x32')]=function(_0x1af1c1,_0x565164){var _0x58804b={},_0x11f0be={},_0x1ba096={'count':0x0,'rows':[]};var _0x1b42b6=_[_0xac4a('0x33')](db['Dynamics365Account'][_0xac4a('0x34')],function(_0x2e56c6){return{'name':_0x2e56c6['fieldName'],'type':_0x2e56c6[_0xac4a('0x35')][_0xac4a('0x36')]};});_0x11f0be[_0xac4a('0x37')]=_['map'](_0x1b42b6,_0xac4a('0x31'));_0x11f0be[_0xac4a('0x38')]=_[_0xac4a('0x39')](_0x1af1c1['query']);_0x11f0be[_0xac4a('0x3a')]=_[_0xac4a('0x3b')](_0x11f0be['model'],_0x11f0be['query']);_0x58804b[_0xac4a('0x3c')]=_['intersection'](_0x11f0be['model'],qs['fields'](_0x1af1c1['query'][_0xac4a('0x3d')]));_0x58804b[_0xac4a('0x3c')]=_0x58804b[_0xac4a('0x3c')][_0xac4a('0x3e')]?_0x58804b[_0xac4a('0x3c')]:_0x11f0be[_0xac4a('0x37')];if(!_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x3f')](_0xac4a('0x40'))){_0x58804b[_0xac4a('0x2c')]=qs[_0xac4a('0x2c')](_0x1af1c1[_0xac4a('0x38')]['limit']);_0x58804b['offset']=qs['offset'](_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x2b')]);}_0x58804b[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x42')]);_0x58804b[_0xac4a('0x43')]=qs[_0xac4a('0x3a')](_[_0xac4a('0x44')](_0x1af1c1[_0xac4a('0x38')],_0x11f0be['filters']),_0x1b42b6);if(_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x45')]){_0x58804b[_0xac4a('0x43')]=_[_0xac4a('0x46')](_0x58804b[_0xac4a('0x43')],{'$or':_['map'](_0x1b42b6,function(_0x8700b4){if(_0x8700b4[_0xac4a('0x35')]!=='VIRTUAL'){var _0x3c912d={};_0x3c912d[_0x8700b4['name']]={'$like':'%'+_0x1af1c1[_0xac4a('0x38')][_0xac4a('0x45')]+'%'};return _0x3c912d;}})});}_0x58804b=_[_0xac4a('0x46')]({},_0x58804b,_0x1af1c1[_0xac4a('0x47')]);var _0x520e4a={'where':_0x58804b[_0xac4a('0x43')]};return db[_0xac4a('0x48')][_0xac4a('0x2a')](_0x520e4a)[_0xac4a('0x1b')](function(_0xcb002b){_0x1ba096[_0xac4a('0x2a')]=_0xcb002b;if(_0x1af1c1[_0xac4a('0x38')]['includeAll']){_0x58804b[_0xac4a('0x49')]=[{'all':!![]}];}return db[_0xac4a('0x48')][_0xac4a('0x4a')](_0x58804b);})['then'](function(_0x1764bf){_0x1ba096[_0xac4a('0x4b')]=_0x1764bf;return _0x1ba096;})['then'](respondWithFilteredResult(_0x565164,_0x58804b))[_0xac4a('0x25')](handleError(_0x565164,null));};exports['show']=function(_0x244950,_0xe620f6){var _0x136a65={'raw':![],'where':{'id':_0x244950['params']['id']}},_0x5e3581={};_0x5e3581[_0xac4a('0x37')]=_['keys'](db[_0xac4a('0x48')]['rawAttributes']);_0x5e3581[_0xac4a('0x38')]=_['keys'](_0x244950[_0xac4a('0x38')]);_0x5e3581[_0xac4a('0x3a')]=_[_0xac4a('0x3b')](_0x5e3581[_0xac4a('0x37')],_0x5e3581['query']);_0x136a65[_0xac4a('0x3c')]=_[_0xac4a('0x3b')](_0x5e3581[_0xac4a('0x37')],qs[_0xac4a('0x3d')](_0x244950[_0xac4a('0x38')][_0xac4a('0x3d')]));_0x136a65[_0xac4a('0x3c')]=_0x136a65['attributes'][_0xac4a('0x3e')]?_0x136a65[_0xac4a('0x3c')]:_0x5e3581['model'];if(_0x244950[_0xac4a('0x38')][_0xac4a('0x4c')]){_0x136a65[_0xac4a('0x49')]=[{'all':!![]}];}_0x136a65=_[_0xac4a('0x46')]({},_0x136a65,_0x244950['options']);return db[_0xac4a('0x48')][_0xac4a('0x4d')](_0x136a65)[_0xac4a('0x1b')](handleEntityNotFound(_0xe620f6,null))[_0xac4a('0x1b')](respondWithResult(_0xe620f6,null))[_0xac4a('0x25')](handleError(_0xe620f6,null));};exports['create']=function(_0x179373,_0x564b10){return db[_0xac4a('0x48')][_0xac4a('0x4e')](_0x179373['body'],{})['then'](respondWithResult(_0x564b10,0xc9))[_0xac4a('0x25')](handleError(_0x564b10,null));};exports[_0xac4a('0x4f')]=function(_0x4d448f,_0x18d29c){if(_0x4d448f[_0xac4a('0x50')]['id']){delete _0x4d448f[_0xac4a('0x50')]['id'];}return db[_0xac4a('0x48')]['find']({'where':{'id':_0x4d448f[_0xac4a('0x51')]['id']}})[_0xac4a('0x1b')](handleEntityNotFound(_0x18d29c,null))[_0xac4a('0x1b')](saveUpdates(_0x4d448f[_0xac4a('0x50')],null))[_0xac4a('0x1b')](respondWithResult(_0x18d29c,null))[_0xac4a('0x25')](handleError(_0x18d29c,null));};exports[_0xac4a('0x2f')]=function(_0x487a44,_0x39123d){return db[_0xac4a('0x48')][_0xac4a('0x4d')]({'where':{'id':_0x487a44[_0xac4a('0x51')]['id']}})[_0xac4a('0x1b')](handleEntityNotFound(_0x39123d,null))[_0xac4a('0x1b')](removeEntity(_0x39123d,null))[_0xac4a('0x25')](handleError(_0x39123d,null));};exports[_0xac4a('0x52')]=function(_0x159e43,_0x786d9,_0x3b175a){var _0x38dd4f={};var _0x400ac4={};var _0x2fe7df;var _0x5222f3;return db[_0xac4a('0x48')]['findOne']({'where':{'id':_0x159e43[_0xac4a('0x51')]['id']}})['then'](handleEntityNotFound(_0x786d9,null))[_0xac4a('0x1b')](function(_0x4b7f79){if(_0x4b7f79){_0x2fe7df=_0x4b7f79;_0x400ac4[_0xac4a('0x37')]=_['keys'](db[_0xac4a('0x53')]['rawAttributes']);_0x400ac4['query']=_[_0xac4a('0x39')](_0x159e43[_0xac4a('0x38')]);_0x400ac4[_0xac4a('0x3a')]=_[_0xac4a('0x3b')](_0x400ac4[_0xac4a('0x37')],_0x400ac4[_0xac4a('0x38')]);_0x38dd4f['attributes']=_[_0xac4a('0x3b')](_0x400ac4['model'],qs[_0xac4a('0x3d')](_0x159e43['query'][_0xac4a('0x3d')]));_0x38dd4f[_0xac4a('0x3c')]=_0x38dd4f[_0xac4a('0x3c')][_0xac4a('0x3e')]?_0x38dd4f[_0xac4a('0x3c')]:_0x400ac4[_0xac4a('0x37')];_0x38dd4f[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_0x159e43[_0xac4a('0x38')][_0xac4a('0x42')]);_0x38dd4f[_0xac4a('0x43')]=qs[_0xac4a('0x3a')](_[_0xac4a('0x44')](_0x159e43[_0xac4a('0x38')],_0x400ac4[_0xac4a('0x3a')]));if(_0x159e43[_0xac4a('0x38')][_0xac4a('0x45')]){_0x38dd4f['where']=_[_0xac4a('0x46')](_0x38dd4f[_0xac4a('0x43')],{'$or':_['map'](_0x38dd4f[_0xac4a('0x3c')],function(_0x34bd1c){var _0x2d24c7={};_0x2d24c7[_0x34bd1c]={'$like':'%'+_0x159e43[_0xac4a('0x38')][_0xac4a('0x45')]+'%'};return _0x2d24c7;})});}_0x38dd4f=_['merge']({},_0x38dd4f,_0x159e43['options']);return _0x2fe7df[_0xac4a('0x52')](_0x38dd4f);}})[_0xac4a('0x1b')](function(_0x158223){if(_0x158223){_0x5222f3=_0x158223[_0xac4a('0x3e')];if(!_0x159e43[_0xac4a('0x38')][_0xac4a('0x3f')](_0xac4a('0x40'))){_0x38dd4f[_0xac4a('0x2c')]=qs[_0xac4a('0x2c')](_0x159e43[_0xac4a('0x38')][_0xac4a('0x2c')]);_0x38dd4f['offset']=qs['offset'](_0x159e43[_0xac4a('0x38')][_0xac4a('0x2b')]);}return _0x2fe7df[_0xac4a('0x52')](_0x38dd4f);}})[_0xac4a('0x1b')](function(_0x663a97){if(_0x663a97){return _0x663a97?{'count':_0x5222f3,'rows':_0x663a97}:null;}})[_0xac4a('0x1b')](respondWithResult(_0x786d9,null))[_0xac4a('0x25')](handleError(_0x786d9,null));};exports[_0xac4a('0x54')]=function(_0x453d62,_0x2a5acc,_0xb09b89){if(_0x453d62[_0xac4a('0x50')]['id']){delete _0x453d62['body']['id'];}return db[_0xac4a('0x48')][_0xac4a('0x55')]({'where':{'id':_0x453d62[_0xac4a('0x51')]['id']}})[_0xac4a('0x1b')](handleEntityNotFound(_0x2a5acc,null))['then'](function(_0xc61e94){if(_0xc61e94){_0x453d62['body'][_0xac4a('0x56')]=_0xc61e94['id'];_0x453d62[_0xac4a('0x50')]['Subjects']=integrations['getSubjects'](_0x453d62[_0xac4a('0x50')][_0xac4a('0x57')],_0x453d62[_0xac4a('0x50')]['type']);_0x453d62[_0xac4a('0x50')]['Descriptions']=integrations[_0xac4a('0x58')](_0x453d62['body']['channel'],_0x453d62[_0xac4a('0x50')]['type']);return db[_0xac4a('0x53')]['create'](_0x453d62[_0xac4a('0x50')],{'include':[{'model':db[_0xac4a('0x59')],'as':'Subjects'},{'model':db[_0xac4a('0x59')],'as':'Descriptions'}]});}return null;})[_0xac4a('0x1b')](respondWithResult(_0x2a5acc,null))[_0xac4a('0x25')](handleError(_0x2a5acc,null));};exports['getFields']=function(_0x12f1b2,_0x4b66b4,_0x5a9111){var _0x9f5b43=_0x12f1b2['query'][_0xac4a('0x5a')];var _0x558c43=_0x9f5b43==='incident'?_0xac4a('0x5b'):_0xac4a('0x5c');var _0x3bec8a='';var _0x54c063='';var _0x504256='';var _0x1327ea='';var _0x9c0fa1='';var _0x5ac8cc='';var _0x4e93f5='';var _0x3824a2='';var _0x178def=[_0xac4a('0x5d'),_0xac4a('0x5e'),_0xac4a('0x5f'),_0xac4a('0x60'),_0xac4a('0x61'),_0xac4a('0x62'),_0xac4a('0x63'),'regardingobjectid',_0xac4a('0x64'),_0xac4a('0x65')];var _0x3ba61e=['accountidname',_0xac4a('0x66'),_0xac4a('0x67'),_0xac4a('0x68'),_0xac4a('0x69'),_0xac4a('0x6a'),'contractdetailidname',_0xac4a('0x6b'),_0xac4a('0x6c'),_0xac4a('0x6d'),_0xac4a('0x6e'),_0xac4a('0x6f'),_0xac4a('0x70'),_0xac4a('0x71'),'createdonbehalfbyyominame',_0xac4a('0x72'),_0xac4a('0x73'),_0xac4a('0x74'),_0xac4a('0x75'),_0xac4a('0x76'),_0xac4a('0x77'),'entityimage_url',_0xac4a('0x78'),_0xac4a('0x79'),_0xac4a('0x7a'),_0xac4a('0x7b'),'importsequencenumber',_0xac4a('0x7c'),'kbarticleidname',_0xac4a('0x7d'),_0xac4a('0x7e'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0xac4a('0x7f'),_0xac4a('0x80'),_0xac4a('0x81'),'modifiedonbehalfbyname',_0xac4a('0x82'),'msdyn_incidenttypename',_0xac4a('0x83'),_0xac4a('0x84'),_0xac4a('0x85'),_0xac4a('0x86'),_0xac4a('0x87'),'owneridtype','owneridyominame',_0xac4a('0x88'),_0xac4a('0x89'),_0xac4a('0x8a'),_0xac4a('0x8b'),_0xac4a('0x8c'),_0xac4a('0x8d'),_0xac4a('0x8e'),_0xac4a('0x8f'),'responseby','responsiblecontactidname',_0xac4a('0x90'),_0xac4a('0x91'),_0xac4a('0x92'),_0xac4a('0x93'),_0xac4a('0x94'),_0xac4a('0x95'),_0xac4a('0x96'),_0xac4a('0x97'),'ticketnumber','timezoneruleversionnumber',_0xac4a('0x98'),_0xac4a('0x99'),_0xac4a('0x9a'),_0xac4a('0x9b')];var _0x3030cf=_0x178def[_0xac4a('0x9c')](_0x3ba61e);return db[_0xac4a('0x48')]['findOne']({'where':{'id':_0x12f1b2[_0xac4a('0x51')]['id']},'attributes':['id',_0xac4a('0x9d'),_0xac4a('0x9e'),'remoteUri',_0xac4a('0x9f'),_0xac4a('0xa0'),_0xac4a('0xa1')]})[_0xac4a('0x1b')](handleEntityNotFound(_0x4b66b4,null))[_0xac4a('0x1b')](function(_0x27d023){if(_0x27d023){_0x3824a2=_0x27d023[_0xac4a('0xa2')];var _0x2ef42a=_0x3824a2[_0xac4a('0xa3')](-0x1);if(_0x2ef42a==='/'){_0x3824a2=_0x3824a2['substring'](0x0,_0x3824a2[_0xac4a('0xa4')](_0x2ef42a));}_0x4e93f5=util['format'](_0xac4a('0xa5'),_0x3824a2);var _0x1199f6={'method':_0xac4a('0xa6'),'uri':_0xac4a('0xa7')+_0x27d023[_0xac4a('0x9f')]+_0xac4a('0xa8'),'form':{'client_id':_0x27d023[_0xac4a('0xa0')],'resource':_0x3824a2,'username':_0x27d023['username'],'password':_0x27d023[_0xac4a('0x9e')],'grant_type':_0xac4a('0x9e'),'client_secret':_0x27d023[_0xac4a('0xa1')]},'json':!![]};return rp(_0x1199f6);}})[_0xac4a('0x1b')](function(_0x15f706){_0x5ac8cc=_0x15f706['access_token'];var _0x1b37d9={'method':_0xac4a('0xa9'),'uri':encodeURI(_0x4e93f5+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x558c43+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x5ac8cc,'If-None-Match':null,'OData-Version':_0xac4a('0xaa')},'json':!![]};return rp(_0x1b37d9);})[_0xac4a('0x1b')](function(_0x59afa0){var _0x24d36d=_0x59afa0[_0xac4a('0xab')][0x0];var _0x6afaba=_0x24d36d[_0xac4a('0xac')];var _0x31df2d={'method':_0xac4a('0xa9'),'uri':_0x4e93f5+'EntityDefinitions('+_0x6afaba+_0xac4a('0xad'),'headers':{'Authorization':_0xac4a('0xae')+_0x5ac8cc,'If-None-Match':null,'OData-Version':_0xac4a('0xaa')},'json':!![]};return rp(_0x31df2d);})['then'](function(_0x2c90c9){_0x3bec8a=_0x2c90c9;_0x54c063=_0x3bec8a[_0xac4a('0xaf')];_0x54c063=_[_0xac4a('0xb0')](_0x54c063,function(_0x17f20f){return!_0x3030cf[_0xac4a('0xb1')](_0x17f20f[_0xac4a('0xb2')]);});var _0x5d6ef3=[];var _0xe84bf7=[];_0x54c063[_0xac4a('0xb3')](function(_0x5ab83b){if(_0x5ab83b[_0xac4a('0xb4')]){var _0x55054a=_0x5ab83b[_0xac4a('0xb4')][_0xac4a('0xb5')](_0x5ab83b['@odata.type'][_0xac4a('0xa4')]('.')+0x1);if(_0x55054a==='PicklistAttributeMetadata'){_0x5d6ef3[_0xac4a('0xb6')](getSelectList(_0x4e93f5,_0x9f5b43,_0xe84bf7,_0x3bec8a['MetadataId'],_0x5ab83b[_0xac4a('0xac')],_0x5ac8cc));}}});return Promise[_0xac4a('0xb7')](_0x5d6ef3);})[_0xac4a('0x1b')](function(_0xfe8977){_0x504256=_0xfe8977[0x0];var _0xc38492=[];var _0x36d8ff=[];_0x54c063[_0xac4a('0xb3')](function(_0x2a508c){if(!_[_0xac4a('0xb8')](_0x2a508c[_0xac4a('0xb4')])){var _0x3a0163=_0x2a508c[_0xac4a('0xb4')][_0xac4a('0xb5')](_0x2a508c[_0xac4a('0xb4')]['lastIndexOf']('.')+0x1);if(_0x3a0163===_0xac4a('0xb9')){_0xc38492[_0xac4a('0xb6')](getBooleanList(_0x4e93f5,_0x9f5b43,_0x36d8ff,_0x3bec8a['MetadataId'],_0x2a508c[_0xac4a('0xac')],_0x5ac8cc));}}});return Promise[_0xac4a('0xb7')](_0xc38492);})[_0xac4a('0x1b')](function(_0x3d0543){_0x1327ea=_0x3d0543[0x0];var _0x3fea6e=[];var _0x5d5bb3=[];_0x54c063[_0xac4a('0xb3')](function(_0x4b11ba){if(_0x4b11ba[_0xac4a('0xb4')]){var _0x28ae76=_0x4b11ba[_0xac4a('0xb4')][_0xac4a('0xb5')](_0x4b11ba['@odata.type'][_0xac4a('0xa4')]('.')+0x1);if(_0x28ae76==='StringAttributeMetadata'||_0x28ae76===_0xac4a('0xba')||_0x28ae76===_0xac4a('0xbb')||_0x28ae76===_0xac4a('0xbc')||_0x28ae76==='MemoAttributeMetadata'||_0x28ae76===_0xac4a('0xbd')||_0x28ae76===_0xac4a('0xbe')||_0x28ae76===_0xac4a('0xbf')||_0x28ae76==='StateAttributeMetadata'||_0x28ae76===_0xac4a('0xc0')){_0x3fea6e[_0xac4a('0xb6')](getInputList(_0x4e93f5,_0x9f5b43,_0x28ae76,_0x5d5bb3,_0x3bec8a[_0xac4a('0xac')],_0x4b11ba[_0xac4a('0xac')],_0x5ac8cc));}}});return Promise[_0xac4a('0xb7')](_0x3fea6e);})[_0xac4a('0x1b')](function(_0x3b4183){_0x9c0fa1=_0x3b4183[0x0];var _0xd0da1f=_0x504256['concat'](_0x1327ea)[_0xac4a('0x9c')](_0x9c0fa1);var _0x59d416={'count':_0xd0da1f['length'],'rows':_0xd0da1f};return _0x59d416;})['then'](respondWithResult(_0x4b66b4,null))['catch'](function(_0x502275){var _0x261e4c=_0x12f1b2[_0xac4a('0x38')][_0xac4a('0xc1')]?0x1f4:_0x502275[_0xac4a('0xc2')]||0x1f4;logger[_0xac4a('0x21')](_0x502275['stack']);delete _0x502275[_0xac4a('0x31')];if(_0x261e4c===0x191){_0x261e4c=0x190;}_0x4b66b4[_0xac4a('0x27')](_0x261e4c)[_0xac4a('0xc3')](_0x12f1b2[_0xac4a('0x38')][_0xac4a('0xc1')]?{'message':_0xac4a('0xc4'),'statusCode':_0x502275[_0xac4a('0xc2')]}:_0x502275);});};function getSelectList(_0x2f05e5,_0x5b394f,_0x2cb596,_0x871c77,_0x2df41d,_0x25331f){var _0x303d5d={'method':_0xac4a('0xa9'),'uri':_0x2f05e5+_0xac4a('0xc5')+_0x871c77+')/Attributes('+_0x2df41d+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xac4a('0xc6'),'headers':{'Authorization':_0xac4a('0xae')+_0x25331f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x303d5d)[_0xac4a('0x1b')](function(_0x366f5a){var _0x503880=[];var _0x5bd013=_0x366f5a[_0xac4a('0xc7')][_0xac4a('0xc8')];_0x5bd013[_0xac4a('0xb3')](function(_0x8b988c){_0x503880[_0xac4a('0xb6')]({'name':_0x8b988c['Label'][_0xac4a('0xc9')]['Label'],'value':String(_0x8b988c['Value'])});});var _0x538cfd={'id':_0x5b394f+'_'+_0x366f5a[_0xac4a('0xb2')],'name':_0x366f5a[_0xac4a('0xca')][_0xac4a('0xc9')][_0xac4a('0xcb')],'custom':![],'options':_0x503880};_0x2cb596[_0xac4a('0xb6')](_0x538cfd);return _0x2cb596;});}function getBooleanList(_0x24cb52,_0xcad25d,_0x43f82b,_0x5250e9,_0x5e1662,_0x53bcbc){var _0x3305a5={'method':_0xac4a('0xa9'),'uri':_0x24cb52+_0xac4a('0xc5')+_0x5250e9+_0xac4a('0xcc')+_0x5e1662+_0xac4a('0xcd'),'headers':{'Authorization':_0xac4a('0xae')+_0x53bcbc,'If-None-Match':null,'OData-Version':_0xac4a('0xaa')},'json':!![]};return rp(_0x3305a5)[_0xac4a('0x1b')](function(_0x45b3d3){var _0x131bc6=[];_0x131bc6[_0xac4a('0xb6')]({'name':_0x45b3d3[_0xac4a('0xc7')][_0xac4a('0xce')][_0xac4a('0xcb')][_0xac4a('0xc9')][_0xac4a('0xcb')],'value':_0xac4a('0xcf')},{'name':_0x45b3d3[_0xac4a('0xc7')][_0xac4a('0xd0')][_0xac4a('0xcb')][_0xac4a('0xc9')][_0xac4a('0xcb')],'value':_0xac4a('0xd1')});var _0x4cc581={'id':_0xcad25d+'_'+_0x45b3d3[_0xac4a('0xb2')],'name':_0x45b3d3[_0xac4a('0xca')][_0xac4a('0xc9')][_0xac4a('0xcb')],'custom':![],'options':_0x131bc6};_0x43f82b[_0xac4a('0xb6')](_0x4cc581);return _0x43f82b;});}function getInputList(_0x31afd2,_0x2652f5,_0x2f108d,_0x58b69f,_0x5127ea,_0x113f80,_0x1a2ff2){var _0x571f76={'method':'GET','uri':_0x31afd2+'EntityDefinitions('+_0x5127ea+')/Attributes('+_0x113f80+_0xac4a('0xd2')+_0x2f108d+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xac4a('0xae')+_0x1a2ff2,'If-None-Match':null,'OData-Version':_0xac4a('0xaa')},'json':!![]};return rp(_0x571f76)['then'](function(_0x30490f){var _0x596068={'id':_0x2652f5+'_'+_0x30490f[_0xac4a('0xb2')],'name':_0x30490f[_0xac4a('0xca')][_0xac4a('0xc9')]?_0x30490f[_0xac4a('0xca')][_0xac4a('0xc9')][_0xac4a('0xcb')]:_0x30490f['LogicalName'],'custom':![],'options':[]};_0x58b69f[_0xac4a('0xb6')](_0x596068);return _0x58b69f;});} \ No newline at end of file +var _0xacf4=['isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','statusCode','send','test',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','sendStatus','stack','name','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','create','update','body','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','ticketType','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidyominame','actualserviceunits','contractdetailidname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata'];(function(_0x1fd7ed,_0x517082){var _0x562a9b=function(_0x2fc8d5){while(--_0x2fc8d5){_0x1fd7ed['push'](_0x1fd7ed['shift']());}};_0x562a9b(++_0x517082);}(_0xacf4,0xe7));var _0x4acf=function(_0x1cf3cb,_0xcd24a9){_0x1cf3cb=_0x1cf3cb-0x0;var _0x30fa5b=_0xacf4[_0x1cf3cb];return _0x30fa5b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4acf('0x0'));var zipdir=require(_0x4acf('0x1'));var jsonpatch=require(_0x4acf('0x2'));var rp=require(_0x4acf('0x3'));var moment=require(_0x4acf('0x4'));var BPromise=require(_0x4acf('0x5'));var Mustache=require(_0x4acf('0x6'));var util=require('util');var path=require(_0x4acf('0x7'));var sox=require(_0x4acf('0x8'));var csv=require('to-csv');var ejs=require(_0x4acf('0x9'));var fs=require('fs');var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4acf('0x15'));var jayson=require(_0x4acf('0x16'));var client=jayson[_0x4acf('0x17')][_0x4acf('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x18629e,_0x1a9949,_0x7ab3ea,_0x15386a){return new BPromise(function(_0x2025ca,_0x312bb5){var _0x2741d3=_0x15386a||client;return _0x2741d3['request'](_0x18629e,_0x7ab3ea)[_0x4acf('0x19')](function(_0x57d8e0){logger[_0x4acf('0x1a')](_0x4acf('0x1b'),_0x1a9949,_0x4acf('0x1c'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1a9949,_0x4acf('0x1c'),JSON[_0x4acf('0x1d')](_0x57d8e0));if(_0x57d8e0[_0x4acf('0x1e')]){if(_0x57d8e0['error'][_0x4acf('0x1f')]===0x1f4){logger[_0x4acf('0x1e')](_0x4acf('0x1b'),_0x1a9949,_0x57d8e0[_0x4acf('0x1e')][_0x4acf('0x20')]);return _0x312bb5(_0x57d8e0[_0x4acf('0x1e')][_0x4acf('0x20')]);}logger[_0x4acf('0x1e')](_0x4acf('0x1b'),_0x1a9949,_0x57d8e0[_0x4acf('0x1e')][_0x4acf('0x20')]);return _0x2025ca(_0x57d8e0['error'][_0x4acf('0x20')]);}else{logger[_0x4acf('0x1a')]('Dynamics365Account,\x20%s,\x20%s',_0x1a9949,_0x4acf('0x1c'));_0x2025ca(_0x57d8e0[_0x4acf('0x21')]['message']);}})[_0x4acf('0x22')](function(_0x34d154){logger[_0x4acf('0x1e')](_0x4acf('0x1b'),_0x1a9949,_0x34d154);_0x312bb5(_0x34d154);});});}function respondWithStatusCode(_0x53885f,_0x1a2286){_0x1a2286=_0x1a2286||0xcc;return function(_0x12e717){if(_0x12e717){return _0x53885f['sendStatus'](_0x1a2286);}return _0x53885f[_0x4acf('0x23')](_0x1a2286)[_0x4acf('0x24')]();};}function respondWithResult(_0x52a84a,_0x126522){_0x126522=_0x126522||0xc8;return function(_0x7ebb){if(_0x7ebb){return _0x52a84a[_0x4acf('0x23')](_0x126522)[_0x4acf('0x25')](_0x7ebb);}};}function respondWithFilteredResult(_0x571a30,_0x50236d){return function(_0x17a756){if(_0x17a756){var _0x3f548a=_0x17a756[_0x4acf('0x26')],_0x355799=_0x50236d[_0x4acf('0x27')],_0x42c90c=_0x50236d[_0x4acf('0x27')]+_0x50236d[_0x4acf('0x28')],_0x14086c;if(_0x42c90c>=_0x3f548a){_0x42c90c=_0x3f548a;_0x14086c=0xc8;}else{_0x14086c=0xce;}_0x571a30[_0x4acf('0x23')](_0x14086c);return _0x571a30['set'](_0x4acf('0x29'),_0x355799+'-'+_0x42c90c+'/'+_0x3f548a)[_0x4acf('0x25')](_0x17a756);}return null;};}function patchUpdates(_0xd027c7){return function(_0x2a5db3){try{jsonpatch[_0x4acf('0x2a')](_0x2a5db3,_0xd027c7,!![]);}catch(_0x28570f){return BPromise[_0x4acf('0x2b')](_0x28570f);}return _0x2a5db3['save']();};}function saveUpdates(_0x337b3c,_0x1d221b){return function(_0x16a74e){if(_0x16a74e){return _0x16a74e['update'](_0x337b3c)[_0x4acf('0x19')](function(_0x18d0bf){return _0x18d0bf;});}return null;};}function removeEntity(_0x1fc815,_0x28ce8a){return function(_0x53a4f3){if(_0x53a4f3){return _0x53a4f3[_0x4acf('0x2c')]()[_0x4acf('0x19')](function(){_0x1fc815[_0x4acf('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fbce,_0x34e2ee){return function(_0x4084fe){if(!_0x4084fe){_0x31fbce[_0x4acf('0x2d')](0x194);}return _0x4084fe;};}function handleError(_0xd221b7,_0x152d1c){_0x152d1c=_0x152d1c||0x1f4;return function(_0x490880){logger[_0x4acf('0x1e')](_0x490880[_0x4acf('0x2e')]);if(_0x490880['name']){delete _0x490880[_0x4acf('0x2f')];}_0xd221b7['status'](_0x152d1c)['send'](_0x490880);};}exports['index']=function(_0x4bd85c,_0x4ce916){var _0x562fdc={},_0x4a8b5a={},_0x3364dd={'count':0x0,'rows':[]};var _0x1b45f6=_['map'](db[_0x4acf('0x30')][_0x4acf('0x31')],function(_0x39e56b){return{'name':_0x39e56b[_0x4acf('0x32')],'type':_0x39e56b[_0x4acf('0x33')][_0x4acf('0x34')]};});_0x4a8b5a[_0x4acf('0x35')]=_[_0x4acf('0x36')](_0x1b45f6,_0x4acf('0x2f'));_0x4a8b5a[_0x4acf('0x37')]=_['keys'](_0x4bd85c['query']);_0x4a8b5a[_0x4acf('0x38')]=_[_0x4acf('0x39')](_0x4a8b5a['model'],_0x4a8b5a[_0x4acf('0x37')]);_0x562fdc[_0x4acf('0x3a')]=_[_0x4acf('0x39')](_0x4a8b5a[_0x4acf('0x35')],qs['fields'](_0x4bd85c['query'][_0x4acf('0x3b')]));_0x562fdc[_0x4acf('0x3a')]=_0x562fdc[_0x4acf('0x3a')][_0x4acf('0x3c')]?_0x562fdc['attributes']:_0x4a8b5a[_0x4acf('0x35')];if(!_0x4bd85c[_0x4acf('0x37')]['hasOwnProperty']('nolimit')){_0x562fdc['limit']=qs['limit'](_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x28')]);_0x562fdc[_0x4acf('0x27')]=qs['offset'](_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x27')]);}_0x562fdc[_0x4acf('0x3d')]=qs[_0x4acf('0x3e')](_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x3e')]);_0x562fdc[_0x4acf('0x3f')]=qs[_0x4acf('0x38')](_[_0x4acf('0x40')](_0x4bd85c[_0x4acf('0x37')],_0x4a8b5a[_0x4acf('0x38')]),_0x1b45f6);if(_0x4bd85c['query'][_0x4acf('0x41')]){_0x562fdc[_0x4acf('0x3f')]=_[_0x4acf('0x42')](_0x562fdc[_0x4acf('0x3f')],{'$or':_[_0x4acf('0x36')](_0x1b45f6,function(_0x58bc5d){if(_0x58bc5d['type']!==_0x4acf('0x43')){var _0x2fc411={};_0x2fc411[_0x58bc5d[_0x4acf('0x2f')]]={'$like':'%'+_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x41')]+'%'};return _0x2fc411;}})});}_0x562fdc=_[_0x4acf('0x42')]({},_0x562fdc,_0x4bd85c['options']);var _0x2e7128={'where':_0x562fdc['where']};return db[_0x4acf('0x30')][_0x4acf('0x26')](_0x2e7128)['then'](function(_0x53ec11){_0x3364dd[_0x4acf('0x26')]=_0x53ec11;if(_0x4bd85c[_0x4acf('0x37')][_0x4acf('0x44')]){_0x562fdc[_0x4acf('0x45')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x4acf('0x46')](_0x562fdc);})[_0x4acf('0x19')](function(_0x2378c6){_0x3364dd[_0x4acf('0x47')]=_0x2378c6;return _0x3364dd;})[_0x4acf('0x19')](respondWithFilteredResult(_0x4ce916,_0x562fdc))[_0x4acf('0x22')](handleError(_0x4ce916,null));};exports[_0x4acf('0x48')]=function(_0x2d946c,_0x51e931){var _0x519817={'raw':![],'where':{'id':_0x2d946c[_0x4acf('0x49')]['id']}},_0x1f5c5f={};_0x1f5c5f[_0x4acf('0x35')]=_[_0x4acf('0x4a')](db[_0x4acf('0x30')][_0x4acf('0x31')]);_0x1f5c5f[_0x4acf('0x37')]=_[_0x4acf('0x4a')](_0x2d946c[_0x4acf('0x37')]);_0x1f5c5f[_0x4acf('0x38')]=_[_0x4acf('0x39')](_0x1f5c5f[_0x4acf('0x35')],_0x1f5c5f['query']);_0x519817[_0x4acf('0x3a')]=_[_0x4acf('0x39')](_0x1f5c5f[_0x4acf('0x35')],qs[_0x4acf('0x3b')](_0x2d946c[_0x4acf('0x37')][_0x4acf('0x3b')]));_0x519817[_0x4acf('0x3a')]=_0x519817[_0x4acf('0x3a')][_0x4acf('0x3c')]?_0x519817[_0x4acf('0x3a')]:_0x1f5c5f[_0x4acf('0x35')];if(_0x2d946c[_0x4acf('0x37')][_0x4acf('0x44')]){_0x519817[_0x4acf('0x45')]=[{'all':!![]}];}_0x519817=_[_0x4acf('0x42')]({},_0x519817,_0x2d946c[_0x4acf('0x4b')]);return db['Dynamics365Account'][_0x4acf('0x4c')](_0x519817)[_0x4acf('0x19')](handleEntityNotFound(_0x51e931,null))[_0x4acf('0x19')](respondWithResult(_0x51e931,null))['catch'](handleError(_0x51e931,null));};exports[_0x4acf('0x4d')]=function(_0x3e8953,_0xd87769){return db[_0x4acf('0x30')]['create'](_0x3e8953['body'],{})['then'](respondWithResult(_0xd87769,0xc9))[_0x4acf('0x22')](handleError(_0xd87769,null));};exports[_0x4acf('0x4e')]=function(_0x449b7a,_0x4fa993){if(_0x449b7a[_0x4acf('0x4f')]['id']){delete _0x449b7a[_0x4acf('0x4f')]['id'];}return db['Dynamics365Account'][_0x4acf('0x4c')]({'where':{'id':_0x449b7a[_0x4acf('0x49')]['id']}})[_0x4acf('0x19')](handleEntityNotFound(_0x4fa993,null))[_0x4acf('0x19')](saveUpdates(_0x449b7a['body'],null))[_0x4acf('0x19')](respondWithResult(_0x4fa993,null))[_0x4acf('0x22')](handleError(_0x4fa993,null));};exports[_0x4acf('0x2c')]=function(_0xa2c430,_0x4d48f3){return db[_0x4acf('0x30')]['find']({'where':{'id':_0xa2c430[_0x4acf('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d48f3,null))[_0x4acf('0x19')](removeEntity(_0x4d48f3,null))[_0x4acf('0x22')](handleError(_0x4d48f3,null));};exports[_0x4acf('0x50')]=function(_0x42aa65,_0x547128,_0x4df6a2){var _0x4cb554={};var _0x14b634={};var _0x5a2ac6;var _0x4c8d4b;return db[_0x4acf('0x30')][_0x4acf('0x51')]({'where':{'id':_0x42aa65['params']['id']}})[_0x4acf('0x19')](handleEntityNotFound(_0x547128,null))[_0x4acf('0x19')](function(_0x4bebb2){if(_0x4bebb2){_0x5a2ac6=_0x4bebb2;_0x14b634[_0x4acf('0x35')]=_[_0x4acf('0x4a')](db[_0x4acf('0x52')]['rawAttributes']);_0x14b634[_0x4acf('0x37')]=_[_0x4acf('0x4a')](_0x42aa65[_0x4acf('0x37')]);_0x14b634[_0x4acf('0x38')]=_['intersection'](_0x14b634[_0x4acf('0x35')],_0x14b634[_0x4acf('0x37')]);_0x4cb554[_0x4acf('0x3a')]=_['intersection'](_0x14b634[_0x4acf('0x35')],qs[_0x4acf('0x3b')](_0x42aa65[_0x4acf('0x37')][_0x4acf('0x3b')]));_0x4cb554[_0x4acf('0x3a')]=_0x4cb554[_0x4acf('0x3a')][_0x4acf('0x3c')]?_0x4cb554[_0x4acf('0x3a')]:_0x14b634[_0x4acf('0x35')];_0x4cb554[_0x4acf('0x3d')]=qs[_0x4acf('0x3e')](_0x42aa65[_0x4acf('0x37')][_0x4acf('0x3e')]);_0x4cb554[_0x4acf('0x3f')]=qs[_0x4acf('0x38')](_['pick'](_0x42aa65[_0x4acf('0x37')],_0x14b634[_0x4acf('0x38')]));if(_0x42aa65[_0x4acf('0x37')][_0x4acf('0x41')]){_0x4cb554[_0x4acf('0x3f')]=_[_0x4acf('0x42')](_0x4cb554[_0x4acf('0x3f')],{'$or':_[_0x4acf('0x36')](_0x4cb554['attributes'],function(_0x540dd5){var _0x8977ad={};_0x8977ad[_0x540dd5]={'$like':'%'+_0x42aa65['query'][_0x4acf('0x41')]+'%'};return _0x8977ad;})});}_0x4cb554=_['merge']({},_0x4cb554,_0x42aa65['options']);return _0x5a2ac6['getConfigurations'](_0x4cb554);}})[_0x4acf('0x19')](function(_0x3aff2e){if(_0x3aff2e){_0x4c8d4b=_0x3aff2e[_0x4acf('0x3c')];if(!_0x42aa65[_0x4acf('0x37')][_0x4acf('0x53')](_0x4acf('0x54'))){_0x4cb554['limit']=qs['limit'](_0x42aa65['query'][_0x4acf('0x28')]);_0x4cb554[_0x4acf('0x27')]=qs[_0x4acf('0x27')](_0x42aa65['query'][_0x4acf('0x27')]);}return _0x5a2ac6[_0x4acf('0x50')](_0x4cb554);}})[_0x4acf('0x19')](function(_0x114198){if(_0x114198){return _0x114198?{'count':_0x4c8d4b,'rows':_0x114198}:null;}})[_0x4acf('0x19')](respondWithResult(_0x547128,null))[_0x4acf('0x22')](handleError(_0x547128,null));};exports['addConfiguration']=function(_0x278b96,_0x52e6d2,_0x166d31){if(_0x278b96[_0x4acf('0x4f')]['id']){delete _0x278b96[_0x4acf('0x4f')]['id'];}return db[_0x4acf('0x30')][_0x4acf('0x51')]({'where':{'id':_0x278b96[_0x4acf('0x49')]['id']}})[_0x4acf('0x19')](handleEntityNotFound(_0x52e6d2,null))[_0x4acf('0x19')](function(_0x1dfe70){if(_0x1dfe70){_0x278b96[_0x4acf('0x4f')][_0x4acf('0x55')]=_0x1dfe70['id'];_0x278b96[_0x4acf('0x4f')]['Subjects']=integrations[_0x4acf('0x56')](_0x278b96[_0x4acf('0x4f')][_0x4acf('0x57')],_0x278b96[_0x4acf('0x4f')][_0x4acf('0x33')]);_0x278b96[_0x4acf('0x4f')][_0x4acf('0x58')]=integrations[_0x4acf('0x59')](_0x278b96[_0x4acf('0x4f')][_0x4acf('0x57')],_0x278b96['body'][_0x4acf('0x33')]);return db[_0x4acf('0x52')]['create'](_0x278b96[_0x4acf('0x4f')],{'include':[{'model':db[_0x4acf('0x5a')],'as':'Subjects'},{'model':db[_0x4acf('0x5a')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x52e6d2,null))[_0x4acf('0x22')](handleError(_0x52e6d2,null));};exports['getFields']=function(_0x22729c,_0xe57598,_0x13f042){var _0x2034e4=_0x22729c['query'][_0x4acf('0x5b')];var _0x15fb66=_0x2034e4==='incident'?'Incident':'PhoneCall';var _0x1dd32a='';var _0x5e33ce='';var _0x3adb06='';var _0x34ad58='';var _0x4f3cf1='';var _0x4d7c9d='';var _0x249d40='';var _0x30dfed='';var _0x591d0b=[_0x4acf('0x5c'),_0x4acf('0x5d'),'customerid',_0x4acf('0x5e'),_0x4acf('0x5f'),_0x4acf('0x60'),_0x4acf('0x61'),_0x4acf('0x62'),_0x4acf('0x63'),'phonecall_activity_parties'];var _0x208157=['accountidname',_0x4acf('0x64'),_0x4acf('0x65'),'billedserviceunits','contactidname','contactidyominame',_0x4acf('0x66'),'contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame',_0x4acf('0x67'),'createdbyyominame',_0x4acf('0x68'),_0x4acf('0x69'),_0x4acf('0x6a'),_0x4acf('0x6b'),_0x4acf('0x6c'),'customeridyominame','emailaddress',_0x4acf('0x6d'),_0x4acf('0x6e'),_0x4acf('0x6f'),_0x4acf('0x70'),_0x4acf('0x71'),'firstresponsebykpiidname',_0x4acf('0x72'),_0x4acf('0x73'),_0x4acf('0x74'),_0x4acf('0x75'),_0x4acf('0x76'),_0x4acf('0x77'),_0x4acf('0x78'),'modifiedbyexternalpartyyominame',_0x4acf('0x79'),'modifiedbyyominame',_0x4acf('0x7a'),_0x4acf('0x7b'),_0x4acf('0x7c'),_0x4acf('0x7d'),_0x4acf('0x7e'),'numberofchildincidents',_0x4acf('0x7f'),'overriddencreatedon',_0x4acf('0x80'),_0x4acf('0x81'),'owneridyominame',_0x4acf('0x82'),_0x4acf('0x83'),_0x4acf('0x84'),_0x4acf('0x85'),_0x4acf('0x86'),'productserialnumber',_0x4acf('0x87'),'resolvebykpiidname','responseby',_0x4acf('0x88'),_0x4acf('0x89'),_0x4acf('0x8a'),_0x4acf('0x8b'),'slaname','socialprofileidname',_0x4acf('0x8c'),_0x4acf('0x8d'),_0x4acf('0x8e'),_0x4acf('0x8f'),_0x4acf('0x90'),_0x4acf('0x91'),_0x4acf('0x92'),_0x4acf('0x93'),'versionnumber'];var _0x5a968c=_0x591d0b[_0x4acf('0x94')](_0x208157);return db[_0x4acf('0x30')][_0x4acf('0x51')]({'where':{'id':_0x22729c[_0x4acf('0x49')]['id']},'attributes':['id',_0x4acf('0x95'),_0x4acf('0x96'),_0x4acf('0x97'),_0x4acf('0x98'),_0x4acf('0x99'),'clientSecret']})[_0x4acf('0x19')](handleEntityNotFound(_0xe57598,null))[_0x4acf('0x19')](function(_0x179935){if(_0x179935){_0x30dfed=_0x179935[_0x4acf('0x97')];var _0x37ecd2=_0x30dfed[_0x4acf('0x9a')](-0x1);if(_0x37ecd2==='/'){_0x30dfed=_0x30dfed[_0x4acf('0x9b')](0x0,_0x30dfed[_0x4acf('0x9c')](_0x37ecd2));}_0x249d40=util[_0x4acf('0x9d')](_0x4acf('0x9e'),_0x30dfed);var _0x21448c={'method':_0x4acf('0x9f'),'uri':_0x4acf('0xa0')+_0x179935['tenantId']+_0x4acf('0xa1'),'form':{'client_id':_0x179935['clientId'],'resource':_0x30dfed,'username':_0x179935[_0x4acf('0x95')],'password':_0x179935[_0x4acf('0x96')],'grant_type':'password','client_secret':_0x179935[_0x4acf('0xa2')]},'json':!![]};return rp(_0x21448c);}})[_0x4acf('0x19')](function(_0x577f98){_0x4d7c9d=_0x577f98['access_token'];var _0x175c91={'method':_0x4acf('0xa3'),'uri':encodeURI(_0x249d40+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x15fb66+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x4d7c9d,'If-None-Match':null,'OData-Version':_0x4acf('0xa4')},'json':!![]};return rp(_0x175c91);})[_0x4acf('0x19')](function(_0x26fed7){var _0x201bc9=_0x26fed7['value'][0x0];var _0x1774ac=_0x201bc9[_0x4acf('0xa5')];var _0x366696={'method':_0x4acf('0xa3'),'uri':_0x249d40+_0x4acf('0xa6')+_0x1774ac+_0x4acf('0xa7'),'headers':{'Authorization':_0x4acf('0xa8')+_0x4d7c9d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x366696);})[_0x4acf('0x19')](function(_0x176b0d){_0x1dd32a=_0x176b0d;_0x5e33ce=_0x1dd32a[_0x4acf('0xa9')];_0x5e33ce=_['remove'](_0x5e33ce,function(_0x40cccb){return!_0x5a968c[_0x4acf('0xaa')](_0x40cccb[_0x4acf('0xab')]);});var _0x1ab81f=[];var _0x37ffab=[];_0x5e33ce[_0x4acf('0xac')](function(_0x470712){if(_0x470712[_0x4acf('0xad')]){var _0x4a3238=_0x470712['@odata.type']['substring'](_0x470712['@odata.type']['lastIndexOf']('.')+0x1);if(_0x4a3238===_0x4acf('0xae')){_0x1ab81f['push'](getSelectList(_0x249d40,_0x2034e4,_0x37ffab,_0x1dd32a[_0x4acf('0xa5')],_0x470712[_0x4acf('0xa5')],_0x4d7c9d));}}});return Promise['all'](_0x1ab81f);})[_0x4acf('0x19')](function(_0x14ef45){_0x3adb06=_0x14ef45[0x0];var _0x1e08cf=[];var _0x35ddbc=[];_0x5e33ce[_0x4acf('0xac')](function(_0x140713){if(!_[_0x4acf('0xaf')](_0x140713[_0x4acf('0xad')])){var _0x422b8e=_0x140713[_0x4acf('0xad')][_0x4acf('0x9b')](_0x140713[_0x4acf('0xad')][_0x4acf('0x9c')]('.')+0x1);if(_0x422b8e===_0x4acf('0xb0')){_0x1e08cf[_0x4acf('0xb1')](getBooleanList(_0x249d40,_0x2034e4,_0x35ddbc,_0x1dd32a[_0x4acf('0xa5')],_0x140713[_0x4acf('0xa5')],_0x4d7c9d));}}});return Promise['all'](_0x1e08cf);})['then'](function(_0x16ac70){_0x34ad58=_0x16ac70[0x0];var _0x1a7a89=[];var _0x37fc90=[];_0x5e33ce[_0x4acf('0xac')](function(_0x43f2d4){if(_0x43f2d4[_0x4acf('0xad')]){var _0x412b95=_0x43f2d4[_0x4acf('0xad')][_0x4acf('0x9b')](_0x43f2d4[_0x4acf('0xad')][_0x4acf('0x9c')]('.')+0x1);if(_0x412b95===_0x4acf('0xb2')||_0x412b95==='DoubleAttributeMetadata'||_0x412b95==='BigIntAttributeMetadata'||_0x412b95===_0x4acf('0xb3')||_0x412b95===_0x4acf('0xb4')||_0x412b95===_0x4acf('0xb5')||_0x412b95===_0x4acf('0xb6')||_0x412b95===_0x4acf('0xb7')||_0x412b95===_0x4acf('0xb8')||_0x412b95==='DecimalAttributeMetadata'){_0x1a7a89[_0x4acf('0xb1')](getInputList(_0x249d40,_0x2034e4,_0x412b95,_0x37fc90,_0x1dd32a[_0x4acf('0xa5')],_0x43f2d4[_0x4acf('0xa5')],_0x4d7c9d));}}});return Promise['all'](_0x1a7a89);})[_0x4acf('0x19')](function(_0x459bf1){_0x4f3cf1=_0x459bf1[0x0];var _0x40b518=_0x3adb06[_0x4acf('0x94')](_0x34ad58)[_0x4acf('0x94')](_0x4f3cf1);var _0x20cdb4={'count':_0x40b518[_0x4acf('0x3c')],'rows':_0x40b518};return _0x20cdb4;})[_0x4acf('0x19')](respondWithResult(_0xe57598,null))[_0x4acf('0x22')](function(_0x4eb713){var _0x371ab5=_0x22729c['query']['test']?0x1f4:_0x4eb713[_0x4acf('0xb9')]||0x1f4;logger[_0x4acf('0x1e')](_0x4eb713[_0x4acf('0x2e')]);delete _0x4eb713[_0x4acf('0x2f')];if(_0x371ab5===0x191){_0x371ab5=0x190;}_0xe57598[_0x4acf('0x23')](_0x371ab5)[_0x4acf('0xba')](_0x22729c[_0x4acf('0x37')][_0x4acf('0xbb')]?{'message':'Wrong\x20credentials','statusCode':_0x4eb713[_0x4acf('0xb9')]}:_0x4eb713);});};function getSelectList(_0x4458bb,_0x6ae77b,_0x27edd9,_0x2b7d90,_0x7c4c82,_0x499214){var _0x474653={'method':_0x4acf('0xa3'),'uri':_0x4458bb+_0x4acf('0xa6')+_0x2b7d90+_0x4acf('0xbc')+_0x7c4c82+_0x4acf('0xbd')+_0x4acf('0xbe'),'headers':{'Authorization':_0x4acf('0xa8')+_0x499214,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x474653)[_0x4acf('0x19')](function(_0x38ef48){var _0x49848a=[];var _0x38b796=_0x38ef48[_0x4acf('0xbf')][_0x4acf('0xc0')];_0x38b796[_0x4acf('0xac')](function(_0x547039){_0x49848a[_0x4acf('0xb1')]({'name':_0x547039[_0x4acf('0xc1')][_0x4acf('0xc2')][_0x4acf('0xc1')],'value':String(_0x547039[_0x4acf('0xc3')])});});var _0x22613d={'id':_0x6ae77b+'_'+_0x38ef48[_0x4acf('0xab')],'name':_0x38ef48[_0x4acf('0xc4')][_0x4acf('0xc2')][_0x4acf('0xc1')],'custom':![],'options':_0x49848a};_0x27edd9[_0x4acf('0xb1')](_0x22613d);return _0x27edd9;});}function getBooleanList(_0xc0c770,_0x279cc0,_0x229f40,_0x25ce78,_0xc8436,_0x4ad66d){var _0x1ebdd6={'method':_0x4acf('0xa3'),'uri':_0xc0c770+_0x4acf('0xa6')+_0x25ce78+_0x4acf('0xbc')+_0xc8436+_0x4acf('0xc5'),'headers':{'Authorization':_0x4acf('0xa8')+_0x4ad66d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1ebdd6)[_0x4acf('0x19')](function(_0x5e1be6){var _0x5ea884=[];_0x5ea884[_0x4acf('0xb1')]({'name':_0x5e1be6[_0x4acf('0xbf')][_0x4acf('0xc6')][_0x4acf('0xc1')][_0x4acf('0xc2')][_0x4acf('0xc1')],'value':_0x4acf('0xc7')},{'name':_0x5e1be6[_0x4acf('0xbf')][_0x4acf('0xc8')]['Label'][_0x4acf('0xc2')][_0x4acf('0xc1')],'value':_0x4acf('0xc9')});var _0x2aea00={'id':_0x279cc0+'_'+_0x5e1be6[_0x4acf('0xab')],'name':_0x5e1be6[_0x4acf('0xc4')][_0x4acf('0xc2')][_0x4acf('0xc1')],'custom':![],'options':_0x5ea884};_0x229f40[_0x4acf('0xb1')](_0x2aea00);return _0x229f40;});}function getInputList(_0x18c345,_0x35a108,_0x57cbf1,_0xbb57af,_0x29249d,_0x4fc33a,_0x2e2933){var _0xe2dfac={'method':_0x4acf('0xa3'),'uri':_0x18c345+_0x4acf('0xa6')+_0x29249d+_0x4acf('0xbc')+_0x4fc33a+_0x4acf('0xca')+_0x57cbf1+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x4acf('0xa8')+_0x2e2933,'If-None-Match':null,'OData-Version':_0x4acf('0xa4')},'json':!![]};return rp(_0xe2dfac)['then'](function(_0x4c7835){var _0x26d915={'id':_0x35a108+'_'+_0x4c7835[_0x4acf('0xab')],'name':_0x4c7835['DisplayName'][_0x4acf('0xc2')]?_0x4c7835['DisplayName'][_0x4acf('0xc2')][_0x4acf('0xc1')]:_0x4c7835[_0x4acf('0xab')],'custom':![],'options':[]};_0xbb57af[_0x4acf('0xb1')](_0x26d915);return _0xbb57af;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 2962f8a..988ed41 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 _0x5077=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','lodash'];(function(_0x1c5950,_0x49e128){var _0x2b720a=function(_0x4454f1){while(--_0x4454f1){_0x1c5950['push'](_0x1c5950['shift']());}};_0x2b720a(++_0x49e128);}(_0x5077,0x107));var _0x7507=function(_0x35ec76,_0x245c3b){_0x35ec76=_0x35ec76-0x0;var _0x35a2ca=_0x5077[_0x35ec76];return _0x35a2ca;};'use strict';var _=require(_0x7507('0x0'));var util=require(_0x7507('0x1'));var logger=require(_0x7507('0x2'))(_0x7507('0x3'));var moment=require('moment');var BPromise=require(_0x7507('0x4'));var rp=require(_0x7507('0x5'));var fs=require('fs');var path=require(_0x7507('0x6'));var rimraf=require('rimraf');var config=require(_0x7507('0x7'));var attributes=require(_0x7507('0x8'));var integrations=require(_0x7507('0x9'));module[_0x7507('0xa')]=function(_0x43b909,_0x231dee){return _0x43b909[_0x7507('0xb')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb488=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5578da,_0x47f790){var _0x5b599f=function(_0x30abae){while(--_0x30abae){_0x5578da['push'](_0x5578da['shift']());}};_0x5b599f(++_0x47f790);}(_0xb488,0xca));var _0x8b48=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb488[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8b48('0x0'))(_0x8b48('0x1'));var moment=require(_0x8b48('0x2'));var BPromise=require(_0x8b48('0x3'));var rp=require(_0x8b48('0x4'));var fs=require('fs');var path=require(_0x8b48('0x5'));var rimraf=require(_0x8b48('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b48('0x7'));var integrations=require(_0x8b48('0x8'));module[_0x8b48('0x9')]=function(_0x51a2f6,_0x202174){return _0x51a2f6[_0x8b48('0xa')](_0x8b48('0xb'),attributes,{'tableName':_0x8b48('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 34a58e1..d6c1f90 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 _0x7a3e=['moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map','attributes','model','ShowDynamics365Account','find','lodash','util'];(function(_0x29b1dc,_0x13ed39){var _0x13a7a1=function(_0x50cf08){while(--_0x50cf08){_0x29b1dc['push'](_0x29b1dc['shift']());}};_0x13a7a1(++_0x13ed39);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x54049d,_0x35b864){_0x54049d=_0x54049d-0x0;var _0x390f80=_0x7a3e[_0x54049d];return _0x390f80;};'use strict';var _=require(_0xe7a3('0x0'));var util=require(_0xe7a3('0x1'));var moment=require(_0xe7a3('0x2'));var BPromise=require('bluebird');var rs=require(_0xe7a3('0x3'));var fs=require('fs');var Redis=require(_0xe7a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe7a3('0x5'))(_0xe7a3('0x6'));var config=require(_0xe7a3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe7a3('0x8')][_0xe7a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46ecf7,_0x1b6226,_0x1a7627){return new BPromise(function(_0x5524ad,_0x43c1a3){return client[_0xe7a3('0xa')](_0x46ecf7,_0x1a7627)[_0xe7a3('0xb')](function(_0x28b72f){logger['info'](_0xe7a3('0xc'),_0x1b6226,_0xe7a3('0xd'));logger[_0xe7a3('0xe')](_0xe7a3('0xf'),_0x1b6226,_0xe7a3('0xd'),JSON[_0xe7a3('0x10')](_0x28b72f));if(_0x28b72f[_0xe7a3('0x11')]){if(_0x28b72f[_0xe7a3('0x11')][_0xe7a3('0x12')]===0x1f4){logger[_0xe7a3('0x11')](_0xe7a3('0xc'),_0x1b6226,_0x28b72f[_0xe7a3('0x11')]['message']);return _0x43c1a3(_0x28b72f[_0xe7a3('0x11')][_0xe7a3('0x13')]);}logger[_0xe7a3('0x11')](_0xe7a3('0xc'),_0x1b6226,_0x28b72f['error']['message']);return _0x5524ad(_0x28b72f[_0xe7a3('0x11')][_0xe7a3('0x13')]);}else{logger[_0xe7a3('0x14')](_0xe7a3('0xc'),_0x1b6226,_0xe7a3('0xd'));_0x5524ad(_0x28b72f[_0xe7a3('0x15')][_0xe7a3('0x13')]);}})[_0xe7a3('0x16')](function(_0x4b3bd3){logger[_0xe7a3('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x1b6226,_0x4b3bd3);_0x43c1a3(_0x4b3bd3);});});}exports[_0xe7a3('0x17')]=function(_0x55b6e2){var _0x568a6c=this;return new Promise(function(_0xd74816,_0x535f0c){return db[_0xe7a3('0x18')][_0xe7a3('0x19')]({'raw':_0x55b6e2['options']?_0x55b6e2[_0xe7a3('0x1a')][_0xe7a3('0x1b')]===undefined?!![]:![]:!![],'where':_0x55b6e2[_0xe7a3('0x1a')]?_0x55b6e2['options'][_0xe7a3('0x1c')]||null:null,'attributes':_0x55b6e2[_0xe7a3('0x1a')]?_0x55b6e2[_0xe7a3('0x1a')]['attributes']||null:null,'limit':_0x55b6e2[_0xe7a3('0x1a')]?_0x55b6e2['options'][_0xe7a3('0x1d')]||null:null,'include':_0x55b6e2[_0xe7a3('0x1a')]?_0x55b6e2[_0xe7a3('0x1a')][_0xe7a3('0x1e')]?_[_0xe7a3('0x1f')](_0x55b6e2[_0xe7a3('0x1a')][_0xe7a3('0x1e')],function(_0x3b0b69){return{'model':db[_0x3b0b69['model']],'as':_0x3b0b69['as'],'attributes':_0x3b0b69[_0xe7a3('0x20')],'include':_0x3b0b69[_0xe7a3('0x1e')]?_[_0xe7a3('0x1f')](_0x3b0b69['include'],function(_0x1afeaf){return{'model':db[_0x1afeaf[_0xe7a3('0x21')]],'as':_0x1afeaf['as'],'attributes':_0x1afeaf[_0xe7a3('0x20')],'include':_0x1afeaf[_0xe7a3('0x1e')]?_[_0xe7a3('0x1f')](_0x1afeaf['include'],function(_0x27a96e){return{'model':db[_0x27a96e[_0xe7a3('0x21')]],'as':_0x27a96e['as'],'attributes':_0x27a96e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe7a3('0xb')](function(_0x59ab12){logger[_0xe7a3('0x14')](_0xe7a3('0x17'),_0x55b6e2);logger[_0xe7a3('0xe')](_0xe7a3('0x17'),_0x55b6e2,JSON['stringify'](_0x59ab12));_0xd74816(_0x59ab12);})[_0xe7a3('0x16')](function(_0x36fa2e){logger[_0xe7a3('0x11')](_0xe7a3('0x17'),_0x36fa2e[_0xe7a3('0x13')],_0x55b6e2);_0x535f0c(_0x568a6c[_0xe7a3('0x11')](0x1f4,_0x36fa2e[_0xe7a3('0x13')]));});});};exports[_0xe7a3('0x22')]=function(_0x3fe1c2){var _0x109e81=this;return new Promise(function(_0x37f51d,_0x1d0d50){return db['Dynamics365Account'][_0xe7a3('0x23')]({'raw':_0x3fe1c2[_0xe7a3('0x1a')]?_0x3fe1c2['options'][_0xe7a3('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fe1c2['options']?_0x3fe1c2['options']['where']||null:null,'attributes':_0x3fe1c2[_0xe7a3('0x1a')]?_0x3fe1c2[_0xe7a3('0x1a')][_0xe7a3('0x20')]||null:null,'include':_0x3fe1c2[_0xe7a3('0x1a')]?_0x3fe1c2['options'][_0xe7a3('0x1e')]?_[_0xe7a3('0x1f')](_0x3fe1c2[_0xe7a3('0x1a')][_0xe7a3('0x1e')],function(_0x5f4e23){return{'model':db[_0x5f4e23[_0xe7a3('0x21')]],'as':_0x5f4e23['as'],'attributes':_0x5f4e23[_0xe7a3('0x20')],'include':_0x5f4e23[_0xe7a3('0x1e')]?_[_0xe7a3('0x1f')](_0x5f4e23['include'],function(_0x11f4f0){return{'model':db[_0x11f4f0[_0xe7a3('0x21')]],'as':_0x11f4f0['as'],'attributes':_0x11f4f0['attributes'],'include':_0x11f4f0[_0xe7a3('0x1e')]?_[_0xe7a3('0x1f')](_0x11f4f0[_0xe7a3('0x1e')],function(_0x306e3a){return{'model':db[_0x306e3a[_0xe7a3('0x21')]],'as':_0x306e3a['as'],'attributes':_0x306e3a[_0xe7a3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe7a3('0xb')](function(_0x2b4182){logger[_0xe7a3('0x14')]('ShowDynamics365Account',_0x3fe1c2);logger[_0xe7a3('0xe')](_0xe7a3('0x22'),_0x3fe1c2,JSON[_0xe7a3('0x10')](_0x2b4182));_0x37f51d(_0x2b4182);})[_0xe7a3('0x16')](function(_0x5b89c0){logger[_0xe7a3('0x11')](_0xe7a3('0x22'),_0x5b89c0[_0xe7a3('0x13')],_0x3fe1c2);_0x1d0d50(_0x109e81['error'](0x1f4,_0x5b89c0['message']));});});}; \ No newline at end of file +var _0xdcd5=['catch','GetDynamics365Account','Dynamics365Account','options','raw','where','limit','include','map','attributes','model','ShowDynamics365Account','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdcd5,0x110));var _0x5dcd=function(_0x96f74c,_0xfc30a4){_0x96f74c=_0x96f74c-0x0;var _0x379222=_0xdcd5[_0x96f74c];return _0x379222;};'use strict';var _=require(_0x5dcd('0x0'));var util=require(_0x5dcd('0x1'));var moment=require(_0x5dcd('0x2'));var BPromise=require(_0x5dcd('0x3'));var rs=require(_0x5dcd('0x4'));var fs=require('fs');var Redis=require(_0x5dcd('0x5'));var db=require(_0x5dcd('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5dcd('0x7'))(_0x5dcd('0x8'));var config=require(_0x5dcd('0x9'));var jayson=require(_0x5dcd('0xa'));var client=jayson[_0x5dcd('0xb')][_0x5dcd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c7e52,_0x3273c5,_0x5b70b8){return new BPromise(function(_0x593f16,_0x1680f9){return client[_0x5dcd('0xd')](_0x3c7e52,_0x5b70b8)[_0x5dcd('0xe')](function(_0x55037e){logger[_0x5dcd('0xf')](_0x5dcd('0x10'),_0x3273c5,_0x5dcd('0x11'));logger[_0x5dcd('0x12')](_0x5dcd('0x13'),_0x3273c5,_0x5dcd('0x11'),JSON[_0x5dcd('0x14')](_0x55037e));if(_0x55037e['error']){if(_0x55037e['error'][_0x5dcd('0x15')]===0x1f4){logger[_0x5dcd('0x16')]('Dynamics365Account,\x20%s,\x20%s',_0x3273c5,_0x55037e[_0x5dcd('0x16')][_0x5dcd('0x17')]);return _0x1680f9(_0x55037e[_0x5dcd('0x16')][_0x5dcd('0x17')]);}logger[_0x5dcd('0x16')](_0x5dcd('0x10'),_0x3273c5,_0x55037e[_0x5dcd('0x16')][_0x5dcd('0x17')]);return _0x593f16(_0x55037e['error'][_0x5dcd('0x17')]);}else{logger[_0x5dcd('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x3273c5,_0x5dcd('0x11'));_0x593f16(_0x55037e['result'][_0x5dcd('0x17')]);}})[_0x5dcd('0x18')](function(_0x1fd337){logger['error'](_0x5dcd('0x10'),_0x3273c5,_0x1fd337);_0x1680f9(_0x1fd337);});});}exports[_0x5dcd('0x19')]=function(_0xc7d7d7){var _0x5074b2=this;return new Promise(function(_0x3e23fa,_0x186e84){return db[_0x5dcd('0x1a')]['findAll']({'raw':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7[_0x5dcd('0x1b')][_0x5dcd('0x1c')]===undefined?!![]:![]:!![],'where':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7['options'][_0x5dcd('0x1d')]||null:null,'attributes':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7['options']['attributes']||null:null,'limit':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7[_0x5dcd('0x1b')][_0x5dcd('0x1e')]||null:null,'include':_0xc7d7d7[_0x5dcd('0x1b')]?_0xc7d7d7[_0x5dcd('0x1b')][_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0xc7d7d7[_0x5dcd('0x1b')][_0x5dcd('0x1f')],function(_0x270390){return{'model':db[_0x270390['model']],'as':_0x270390['as'],'attributes':_0x270390[_0x5dcd('0x21')],'include':_0x270390[_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0x270390['include'],function(_0x30fe1f){return{'model':db[_0x30fe1f[_0x5dcd('0x22')]],'as':_0x30fe1f['as'],'attributes':_0x30fe1f[_0x5dcd('0x21')],'include':_0x30fe1f[_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0x30fe1f['include'],function(_0xf30ac6){return{'model':db[_0xf30ac6[_0x5dcd('0x22')]],'as':_0xf30ac6['as'],'attributes':_0xf30ac6[_0x5dcd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5dcd('0xe')](function(_0x379f3c){logger['info'](_0x5dcd('0x19'),_0xc7d7d7);logger[_0x5dcd('0x12')](_0x5dcd('0x19'),_0xc7d7d7,JSON[_0x5dcd('0x14')](_0x379f3c));_0x3e23fa(_0x379f3c);})[_0x5dcd('0x18')](function(_0x1ba4cf){logger[_0x5dcd('0x16')](_0x5dcd('0x19'),_0x1ba4cf[_0x5dcd('0x17')],_0xc7d7d7);_0x186e84(_0x5074b2[_0x5dcd('0x16')](0x1f4,_0x1ba4cf['message']));});});};exports[_0x5dcd('0x23')]=function(_0x510e49){var _0x4f65bf=this;return new Promise(function(_0x376ec6,_0x204e3a){return db['Dynamics365Account'][_0x5dcd('0x24')]({'raw':_0x510e49[_0x5dcd('0x1b')]?_0x510e49['options'][_0x5dcd('0x1c')]===undefined?!![]:![]:!![],'where':_0x510e49[_0x5dcd('0x1b')]?_0x510e49[_0x5dcd('0x1b')][_0x5dcd('0x1d')]||null:null,'attributes':_0x510e49['options']?_0x510e49['options'][_0x5dcd('0x21')]||null:null,'include':_0x510e49[_0x5dcd('0x1b')]?_0x510e49['options']['include']?_[_0x5dcd('0x20')](_0x510e49['options'][_0x5dcd('0x1f')],function(_0x517d00){return{'model':db[_0x517d00['model']],'as':_0x517d00['as'],'attributes':_0x517d00[_0x5dcd('0x21')],'include':_0x517d00[_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0x517d00[_0x5dcd('0x1f')],function(_0x1f0f5d){return{'model':db[_0x1f0f5d[_0x5dcd('0x22')]],'as':_0x1f0f5d['as'],'attributes':_0x1f0f5d[_0x5dcd('0x21')],'include':_0x1f0f5d[_0x5dcd('0x1f')]?_[_0x5dcd('0x20')](_0x1f0f5d[_0x5dcd('0x1f')],function(_0xd71429){return{'model':db[_0xd71429[_0x5dcd('0x22')]],'as':_0xd71429['as'],'attributes':_0xd71429[_0x5dcd('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5dcd('0xe')](function(_0xd60d64){logger[_0x5dcd('0xf')](_0x5dcd('0x23'),_0x510e49);logger[_0x5dcd('0x12')](_0x5dcd('0x23'),_0x510e49,JSON['stringify'](_0xd60d64));_0x376ec6(_0xd60d64);})[_0x5dcd('0x18')](function(_0x154a83){logger['error'](_0x5dcd('0x23'),_0x154a83[_0x5dcd('0x17')],_0x510e49);_0x204e3a(_0x4f65bf[_0x5dcd('0x16')](0x1f4,_0x154a83[_0x5dcd('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 8205bb6..1d3fadc 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 _0x903d=['put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x4de003,_0x1677e9){var _0x2875b9=function(_0x686fda){while(--_0x686fda){_0x4de003['push'](_0x4de003['shift']());}};_0x2875b9(++_0x1677e9);}(_0x903d,0xb3));var _0xd903=function(_0x3264b9,_0x37f24f){_0x3264b9=_0x3264b9-0x0;var _0x371025=_0x903d[_0x3264b9];return _0x371025;};'use strict';var multer=require(_0xd903('0x0'));var util=require(_0xd903('0x1'));var path=require(_0xd903('0x2'));var timeout=require(_0xd903('0x3'));var express=require(_0xd903('0x4'));var router=express[_0xd903('0x5')]();var auth=require(_0xd903('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd903('0x7'));var controller=require(_0xd903('0x8'));router[_0xd903('0x9')]('/',auth[_0xd903('0xa')](),controller['index']);router['get'](_0xd903('0xb'),auth[_0xd903('0xa')](),controller['show']);router[_0xd903('0x9')](_0xd903('0xc'),auth[_0xd903('0xa')](),controller[_0xd903('0xd')]);router[_0xd903('0x9')]('/:id/subjects',auth[_0xd903('0xa')](),controller[_0xd903('0xe')]);router[_0xd903('0x9')](_0xd903('0xf'),auth[_0xd903('0xa')](),controller[_0xd903('0x10')]);router[_0xd903('0x11')]('/',auth[_0xd903('0xa')](),controller[_0xd903('0x12')]);router[_0xd903('0x13')]('/:id',auth[_0xd903('0xa')](),controller['update']);router[_0xd903('0x14')](_0xd903('0xb'),auth[_0xd903('0xa')](),controller['destroy']);module[_0xd903('0x15')]=router; \ No newline at end of file +var _0xc2be=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','/:id','isAuthenticated','show','get'];(function(_0x3b850b,_0x146f79){var _0x4a17b5=function(_0x5883f4){while(--_0x5883f4){_0x3b850b['push'](_0x3b850b['shift']());}};_0x4a17b5(++_0x146f79);}(_0xc2be,0x15d));var _0xec2b=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0xc2be[_0x39872b];return _0x55fa18;};'use strict';var multer=require(_0xec2b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec2b('0x1'));var express=require(_0xec2b('0x2'));var router=express['Router']();var auth=require(_0xec2b('0x3'));var interaction=require(_0xec2b('0x4'));var config=require(_0xec2b('0x5'));var controller=require(_0xec2b('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xec2b('0x7'),auth[_0xec2b('0x8')](),controller[_0xec2b('0x9')]);router[_0xec2b('0xa')](_0xec2b('0xb'),auth[_0xec2b('0x8')](),controller[_0xec2b('0xc')]);router[_0xec2b('0xa')](_0xec2b('0xd'),auth[_0xec2b('0x8')](),controller[_0xec2b('0xe')]);router[_0xec2b('0xa')](_0xec2b('0xf'),auth[_0xec2b('0x8')](),controller[_0xec2b('0x10')]);router[_0xec2b('0x11')]('/',auth[_0xec2b('0x8')](),controller['create']);router[_0xec2b('0x12')](_0xec2b('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xec2b('0x13')](_0xec2b('0x7'),auth['isAuthenticated'](),controller['destroy']);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 4401543..72c07f4 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 _0x3f37=['sequelize','STRING','incident'];(function(_0xb5e20b,_0x20e0ad){var _0x31577a=function(_0x5ac510){while(--_0x5ac510){_0xb5e20b['push'](_0xb5e20b['shift']());}};_0x31577a(++_0x20e0ad);}(_0x3f37,0x16e));var _0x73f3=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x3f37[_0x5a5395];return _0x4da43d;};'use strict';var Sequelize=require(_0x73f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x73f3('0x1')]},'description':{'type':Sequelize[_0x73f3('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x73f3('0x2'),'phonecall'),'defaultValue':'incident'}}; \ No newline at end of file +var _0x6b08=['phonecall','sequelize','exports','STRING','incident'];(function(_0xd26938,_0x166c39){var _0x547bf0=function(_0x2f945e){while(--_0x2f945e){_0xd26938['push'](_0xd26938['shift']());}};_0x547bf0(++_0x166c39);}(_0x6b08,0x74));var _0x86b0=function(_0x4acddf,_0x4f85e0){_0x4acddf=_0x4acddf-0x0;var _0x526f53=_0x6b08[_0x4acddf];return _0x526f53;};'use strict';var Sequelize=require(_0x86b0('0x0'));module[_0x86b0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x86b0('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x86b0('0x3'),_0x86b0('0x4')),'defaultValue':_0x86b0('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 9fa3bb6..6a51afa 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 _0x414f=['fast-json-patch','request-promise','moment','util','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','create','body','find','destroy','getFields','Dynamics365Field','order','where','getSubjects','findOne','pick','nolimit','getDescriptions','eml-format','rimraf'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x414f,0xa8));var _0xf414=function(_0x4266b4,_0x4859ad){_0x4266b4=_0x4266b4-0x0;var _0x1442aa=_0x414f[_0x4266b4];return _0x1442aa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf414('0x0'));var rimraf=require(_0xf414('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf414('0x2'));var rp=require(_0xf414('0x3'));var moment=require(_0xf414('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf414('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf414('0x6'));var ejs=require(_0xf414('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf414('0x8'));var jsforce=require(_0xf414('0x9'));var deskjs=require(_0xf414('0xa'));var toCsv=require(_0xf414('0x6'));var querystring=require(_0xf414('0xb'));var Papa=require('papaparse');var Redis=require(_0xf414('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf414('0xd'));var hardwareService=require(_0xf414('0xe'));var logger=require(_0xf414('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xf414('0x10'));var licenseUtil=require(_0xf414('0x11'));var db=require(_0xf414('0x12'))['db'];var jayson=require(_0xf414('0x13'));var client=jayson[_0xf414('0x14')][_0xf414('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x22216b,_0x125e0b,_0xc84db5,_0x2be316){return new BPromise(function(_0x215198,_0x21e8bd){var _0x51b54d=_0x2be316||client;return _0x51b54d[_0xf414('0x16')](_0x22216b,_0xc84db5)[_0xf414('0x17')](function(_0x2122a7){logger['info'](_0xf414('0x18'),_0x125e0b,_0xf414('0x19'));logger[_0xf414('0x1a')](_0xf414('0x1b'),_0x125e0b,_0xf414('0x19'),JSON[_0xf414('0x1c')](_0x2122a7));if(_0x2122a7[_0xf414('0x1d')]){if(_0x2122a7[_0xf414('0x1d')]['code']===0x1f4){logger[_0xf414('0x1d')](_0xf414('0x18'),_0x125e0b,_0x2122a7[_0xf414('0x1d')]['message']);return _0x21e8bd(_0x2122a7[_0xf414('0x1d')]['message']);}logger[_0xf414('0x1d')](_0xf414('0x18'),_0x125e0b,_0x2122a7[_0xf414('0x1d')][_0xf414('0x1e')]);return _0x215198(_0x2122a7[_0xf414('0x1d')][_0xf414('0x1e')]);}else{logger[_0xf414('0x1f')](_0xf414('0x18'),_0x125e0b,_0xf414('0x19'));_0x215198(_0x2122a7[_0xf414('0x20')][_0xf414('0x1e')]);}})['catch'](function(_0x3822e4){logger[_0xf414('0x1d')](_0xf414('0x18'),_0x125e0b,_0x3822e4);_0x21e8bd(_0x3822e4);});});}function respondWithStatusCode(_0x22ce82,_0x35f719){_0x35f719=_0x35f719||0xcc;return function(_0x45971c){if(_0x45971c){return _0x22ce82[_0xf414('0x21')](_0x35f719);}return _0x22ce82[_0xf414('0x22')](_0x35f719)[_0xf414('0x23')]();};}function respondWithResult(_0x50c738,_0xcb45fa){_0xcb45fa=_0xcb45fa||0xc8;return function(_0x16597a){if(_0x16597a){return _0x50c738[_0xf414('0x22')](_0xcb45fa)[_0xf414('0x24')](_0x16597a);}};}function respondWithFilteredResult(_0x1f6682,_0x3f9170){return function(_0x713ab8){if(_0x713ab8){var _0x5d9419=_0x713ab8[_0xf414('0x25')],_0x2a9243=_0x3f9170[_0xf414('0x26')],_0x39918e=_0x3f9170['offset']+_0x3f9170[_0xf414('0x27')],_0x5363a7;if(_0x39918e>=_0x5d9419){_0x39918e=_0x5d9419;_0x5363a7=0xc8;}else{_0x5363a7=0xce;}_0x1f6682[_0xf414('0x22')](_0x5363a7);return _0x1f6682[_0xf414('0x28')](_0xf414('0x29'),_0x2a9243+'-'+_0x39918e+'/'+_0x5d9419)[_0xf414('0x24')](_0x713ab8);}return null;};}function patchUpdates(_0x30d78b){return function(_0x48cd1c){try{jsonpatch['apply'](_0x48cd1c,_0x30d78b,!![]);}catch(_0x249833){return BPromise['reject'](_0x249833);}return _0x48cd1c[_0xf414('0x2a')]();};}function saveUpdates(_0x8c0e4f,_0x344e4){return function(_0x5c116e){if(_0x5c116e){return _0x5c116e[_0xf414('0x2b')](_0x8c0e4f)[_0xf414('0x17')](function(_0x21ab64){return _0x21ab64;});}return null;};}function removeEntity(_0x58aeaa,_0x5a2e17){return function(_0x54f44c){if(_0x54f44c){return _0x54f44c['destroy']()['then'](function(){_0x58aeaa[_0xf414('0x22')](0xcc)[_0xf414('0x23')]();});}};}function handleEntityNotFound(_0x452745,_0x18468b){return function(_0xe3c85e){if(!_0xe3c85e){_0x452745[_0xf414('0x21')](0x194);}return _0xe3c85e;};}function handleError(_0x52dc05,_0x30c0c6){_0x30c0c6=_0x30c0c6||0x1f4;return function(_0x16d1c6){logger[_0xf414('0x1d')](_0x16d1c6['stack']);if(_0x16d1c6[_0xf414('0x2c')]){delete _0x16d1c6[_0xf414('0x2c')];}_0x52dc05[_0xf414('0x22')](_0x30c0c6)[_0xf414('0x2d')](_0x16d1c6);};}exports['index']=function(_0x37a10d,_0x3df1fe){var _0x55fa6b={},_0x4f3150={},_0x2dea2c={'count':0x0,'rows':[]};var _0xdeb9e8=_[_0xf414('0x2e')](db[_0xf414('0x2f')][_0xf414('0x30')],function(_0x1e0c6e){return{'name':_0x1e0c6e[_0xf414('0x31')],'type':_0x1e0c6e['type']['key']};});_0x4f3150['model']=_[_0xf414('0x2e')](_0xdeb9e8,_0xf414('0x2c'));_0x4f3150['query']=_[_0xf414('0x32')](_0x37a10d[_0xf414('0x33')]);_0x4f3150[_0xf414('0x34')]=_[_0xf414('0x35')](_0x4f3150[_0xf414('0x36')],_0x4f3150[_0xf414('0x33')]);_0x55fa6b[_0xf414('0x37')]=_[_0xf414('0x35')](_0x4f3150[_0xf414('0x36')],qs[_0xf414('0x38')](_0x37a10d['query']['fields']));_0x55fa6b[_0xf414('0x37')]=_0x55fa6b[_0xf414('0x37')][_0xf414('0x39')]?_0x55fa6b[_0xf414('0x37')]:_0x4f3150[_0xf414('0x36')];if(!_0x37a10d['query'][_0xf414('0x3a')]('nolimit')){_0x55fa6b[_0xf414('0x27')]=qs[_0xf414('0x27')](_0x37a10d['query'][_0xf414('0x27')]);_0x55fa6b['offset']=qs[_0xf414('0x26')](_0x37a10d[_0xf414('0x33')]['offset']);}_0x55fa6b['order']=qs[_0xf414('0x3b')](_0x37a10d[_0xf414('0x33')][_0xf414('0x3b')]);_0x55fa6b['where']=qs[_0xf414('0x34')](_['pick'](_0x37a10d['query'],_0x4f3150[_0xf414('0x34')]),_0xdeb9e8);if(_0x37a10d[_0xf414('0x33')]['filter']){_0x55fa6b['where']=_[_0xf414('0x3c')](_0x55fa6b['where'],{'$or':_[_0xf414('0x2e')](_0xdeb9e8,function(_0x3ab2be){if(_0x3ab2be[_0xf414('0x3d')]!==_0xf414('0x3e')){var _0x18b340={};_0x18b340[_0x3ab2be[_0xf414('0x2c')]]={'$like':'%'+_0x37a10d[_0xf414('0x33')][_0xf414('0x3f')]+'%'};return _0x18b340;}})});}_0x55fa6b=_[_0xf414('0x3c')]({},_0x55fa6b,_0x37a10d[_0xf414('0x40')]);var _0x120345={'where':_0x55fa6b['where']};return db[_0xf414('0x2f')][_0xf414('0x25')](_0x120345)['then'](function(_0x4a6985){_0x2dea2c[_0xf414('0x25')]=_0x4a6985;if(_0x37a10d[_0xf414('0x33')]['includeAll']){_0x55fa6b['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xf414('0x41')](_0x55fa6b);})['then'](function(_0xf075bb){_0x2dea2c[_0xf414('0x42')]=_0xf075bb;return _0x2dea2c;})[_0xf414('0x17')](respondWithFilteredResult(_0x3df1fe,_0x55fa6b))[_0xf414('0x43')](handleError(_0x3df1fe,null));};exports[_0xf414('0x44')]=function(_0x325411,_0x313ee3){var _0x2f2c0d={'raw':![],'where':{'id':_0x325411[_0xf414('0x45')]['id']}},_0x453b3a={};_0x453b3a['model']=_[_0xf414('0x32')](db[_0xf414('0x2f')][_0xf414('0x30')]);_0x453b3a[_0xf414('0x33')]=_[_0xf414('0x32')](_0x325411[_0xf414('0x33')]);_0x453b3a[_0xf414('0x34')]=_[_0xf414('0x35')](_0x453b3a['model'],_0x453b3a[_0xf414('0x33')]);_0x2f2c0d[_0xf414('0x37')]=_[_0xf414('0x35')](_0x453b3a[_0xf414('0x36')],qs['fields'](_0x325411[_0xf414('0x33')][_0xf414('0x38')]));_0x2f2c0d[_0xf414('0x37')]=_0x2f2c0d[_0xf414('0x37')][_0xf414('0x39')]?_0x2f2c0d[_0xf414('0x37')]:_0x453b3a[_0xf414('0x36')];if(_0x325411[_0xf414('0x33')][_0xf414('0x46')]){_0x2f2c0d[_0xf414('0x47')]=[{'all':!![]}];}_0x2f2c0d=_[_0xf414('0x3c')]({},_0x2f2c0d,_0x325411[_0xf414('0x40')]);return db[_0xf414('0x2f')]['find'](_0x2f2c0d)[_0xf414('0x17')](handleEntityNotFound(_0x313ee3,null))[_0xf414('0x17')](respondWithResult(_0x313ee3,null))[_0xf414('0x43')](handleError(_0x313ee3,null));};exports[_0xf414('0x48')]=function(_0x251560,_0x5c478c){return db[_0xf414('0x2f')][_0xf414('0x48')](_0x251560['body'],{})[_0xf414('0x17')](respondWithResult(_0x5c478c,0xc9))[_0xf414('0x43')](handleError(_0x5c478c,null));};exports[_0xf414('0x2b')]=function(_0x1060b2,_0x5840e7){if(_0x1060b2[_0xf414('0x49')]['id']){delete _0x1060b2[_0xf414('0x49')]['id'];}return db[_0xf414('0x2f')][_0xf414('0x4a')]({'where':{'id':_0x1060b2['params']['id']}})['then'](handleEntityNotFound(_0x5840e7,null))['then'](saveUpdates(_0x1060b2[_0xf414('0x49')],null))['then'](respondWithResult(_0x5840e7,null))['catch'](handleError(_0x5840e7,null));};exports[_0xf414('0x4b')]=function(_0x47e7b6,_0x3971ac){return db['Dynamics365Configuration'][_0xf414('0x4a')]({'where':{'id':_0x47e7b6[_0xf414('0x45')]['id']}})['then'](handleEntityNotFound(_0x3971ac,null))[_0xf414('0x17')](removeEntity(_0x3971ac,null))[_0xf414('0x43')](handleError(_0x3971ac,null));};exports[_0xf414('0x4c')]=function(_0x1c39c7,_0x57a837,_0x5c8496){var _0x1e40a7={};var _0x2287bd={};var _0x1eeb04;var _0x21199e;return db[_0xf414('0x2f')]['findOne']({'where':{'id':_0x1c39c7[_0xf414('0x45')]['id']}})[_0xf414('0x17')](handleEntityNotFound(_0x57a837,null))[_0xf414('0x17')](function(_0xd76f9b){if(_0xd76f9b){_0x1eeb04=_0xd76f9b;_0x2287bd[_0xf414('0x36')]=_[_0xf414('0x32')](db[_0xf414('0x4d')][_0xf414('0x30')]);_0x2287bd[_0xf414('0x33')]=_[_0xf414('0x32')](_0x1c39c7['query']);_0x2287bd['filters']=_['intersection'](_0x2287bd[_0xf414('0x36')],_0x2287bd[_0xf414('0x33')]);_0x1e40a7[_0xf414('0x37')]=_[_0xf414('0x35')](_0x2287bd['model'],qs[_0xf414('0x38')](_0x1c39c7['query'][_0xf414('0x38')]));_0x1e40a7[_0xf414('0x37')]=_0x1e40a7['attributes'][_0xf414('0x39')]?_0x1e40a7[_0xf414('0x37')]:_0x2287bd[_0xf414('0x36')];_0x1e40a7[_0xf414('0x4e')]=qs['sort'](_0x1c39c7[_0xf414('0x33')]['sort']);_0x1e40a7[_0xf414('0x4f')]=qs[_0xf414('0x34')](_['pick'](_0x1c39c7['query'],_0x2287bd[_0xf414('0x34')]));if(_0x1c39c7[_0xf414('0x33')][_0xf414('0x3f')]){_0x1e40a7['where']=_[_0xf414('0x3c')](_0x1e40a7[_0xf414('0x4f')],{'$or':_[_0xf414('0x2e')](_0x1e40a7[_0xf414('0x37')],function(_0x584673){var _0xa0b5f7={};_0xa0b5f7[_0x584673]={'$like':'%'+_0x1c39c7[_0xf414('0x33')][_0xf414('0x3f')]+'%'};return _0xa0b5f7;})});}_0x1e40a7=_['merge']({},_0x1e40a7,_0x1c39c7[_0xf414('0x40')]);return _0x1eeb04[_0xf414('0x4c')](_0x1e40a7);}})[_0xf414('0x17')](function(_0x8c56cc){if(_0x8c56cc){_0x21199e=_0x8c56cc[_0xf414('0x39')];if(!_0x1c39c7[_0xf414('0x33')][_0xf414('0x3a')]('nolimit')){_0x1e40a7[_0xf414('0x27')]=qs[_0xf414('0x27')](_0x1c39c7[_0xf414('0x33')][_0xf414('0x27')]);_0x1e40a7[_0xf414('0x26')]=qs['offset'](_0x1c39c7['query'][_0xf414('0x26')]);}return _0x1eeb04[_0xf414('0x4c')](_0x1e40a7);}})[_0xf414('0x17')](function(_0x4ac6fd){if(_0x4ac6fd){return _0x4ac6fd?{'count':_0x21199e,'rows':_0x4ac6fd}:null;}})[_0xf414('0x17')](respondWithResult(_0x57a837,null))['catch'](handleError(_0x57a837,null));};exports[_0xf414('0x50')]=function(_0x3e779a,_0x56e661,_0x4169e9){var _0x12d547={};var _0x1f73fb={};var _0x3dc99d;var _0x5a3035;return db[_0xf414('0x2f')][_0xf414('0x51')]({'where':{'id':_0x3e779a[_0xf414('0x45')]['id']}})['then'](handleEntityNotFound(_0x56e661,null))[_0xf414('0x17')](function(_0x2d066f){if(_0x2d066f){_0x3dc99d=_0x2d066f;_0x1f73fb[_0xf414('0x36')]=_[_0xf414('0x32')](db[_0xf414('0x4d')][_0xf414('0x30')]);_0x1f73fb[_0xf414('0x33')]=_[_0xf414('0x32')](_0x3e779a[_0xf414('0x33')]);_0x1f73fb['filters']=_[_0xf414('0x35')](_0x1f73fb['model'],_0x1f73fb[_0xf414('0x33')]);_0x12d547['attributes']=_[_0xf414('0x35')](_0x1f73fb[_0xf414('0x36')],qs[_0xf414('0x38')](_0x3e779a[_0xf414('0x33')][_0xf414('0x38')]));_0x12d547[_0xf414('0x37')]=_0x12d547[_0xf414('0x37')][_0xf414('0x39')]?_0x12d547[_0xf414('0x37')]:_0x1f73fb[_0xf414('0x36')];_0x12d547[_0xf414('0x4e')]=qs[_0xf414('0x3b')](_0x3e779a['query'][_0xf414('0x3b')]);_0x12d547[_0xf414('0x4f')]=qs[_0xf414('0x34')](_[_0xf414('0x52')](_0x3e779a[_0xf414('0x33')],_0x1f73fb[_0xf414('0x34')]));if(_0x3e779a['query'][_0xf414('0x3f')]){_0x12d547[_0xf414('0x4f')]=_['merge'](_0x12d547[_0xf414('0x4f')],{'$or':_[_0xf414('0x2e')](_0x12d547['attributes'],function(_0x1b8daf){var _0x20b3fd={};_0x20b3fd[_0x1b8daf]={'$like':'%'+_0x3e779a[_0xf414('0x33')][_0xf414('0x3f')]+'%'};return _0x20b3fd;})});}_0x12d547=_['merge']({},_0x12d547,_0x3e779a[_0xf414('0x40')]);return _0x3dc99d[_0xf414('0x50')](_0x12d547);}})['then'](function(_0x3dd8a){if(_0x3dd8a){_0x5a3035=_0x3dd8a['length'];if(!_0x3e779a[_0xf414('0x33')][_0xf414('0x3a')](_0xf414('0x53'))){_0x12d547['limit']=qs['limit'](_0x3e779a[_0xf414('0x33')][_0xf414('0x27')]);_0x12d547[_0xf414('0x26')]=qs[_0xf414('0x26')](_0x3e779a[_0xf414('0x33')][_0xf414('0x26')]);}return _0x3dc99d[_0xf414('0x50')](_0x12d547);}})[_0xf414('0x17')](function(_0x175293){if(_0x175293){return _0x175293?{'count':_0x5a3035,'rows':_0x175293}:null;}})['then'](respondWithResult(_0x56e661,null))[_0xf414('0x43')](handleError(_0x56e661,null));};exports[_0xf414('0x54')]=function(_0x215650,_0x500241,_0x3968a6){var _0x2699c9={};var _0x5749fc={};var _0x1f38d3;var _0xb6ff8f;return db[_0xf414('0x2f')][_0xf414('0x51')]({'where':{'id':_0x215650[_0xf414('0x45')]['id']}})['then'](handleEntityNotFound(_0x500241,null))[_0xf414('0x17')](function(_0x540ac9){if(_0x540ac9){_0x1f38d3=_0x540ac9;_0x5749fc[_0xf414('0x36')]=_[_0xf414('0x32')](db[_0xf414('0x4d')][_0xf414('0x30')]);_0x5749fc['query']=_['keys'](_0x215650[_0xf414('0x33')]);_0x5749fc[_0xf414('0x34')]=_[_0xf414('0x35')](_0x5749fc[_0xf414('0x36')],_0x5749fc[_0xf414('0x33')]);_0x2699c9[_0xf414('0x37')]=_['intersection'](_0x5749fc['model'],qs[_0xf414('0x38')](_0x215650['query'][_0xf414('0x38')]));_0x2699c9[_0xf414('0x37')]=_0x2699c9[_0xf414('0x37')]['length']?_0x2699c9[_0xf414('0x37')]:_0x5749fc['model'];_0x2699c9[_0xf414('0x4e')]=qs['sort'](_0x215650[_0xf414('0x33')][_0xf414('0x3b')]);_0x2699c9[_0xf414('0x4f')]=qs[_0xf414('0x34')](_[_0xf414('0x52')](_0x215650[_0xf414('0x33')],_0x5749fc[_0xf414('0x34')]));if(_0x215650['query']['filter']){_0x2699c9[_0xf414('0x4f')]=_['merge'](_0x2699c9[_0xf414('0x4f')],{'$or':_[_0xf414('0x2e')](_0x2699c9[_0xf414('0x37')],function(_0x16b5c7){var _0x5acac3={};_0x5acac3[_0x16b5c7]={'$like':'%'+_0x215650[_0xf414('0x33')][_0xf414('0x3f')]+'%'};return _0x5acac3;})});}_0x2699c9=_[_0xf414('0x3c')]({},_0x2699c9,_0x215650[_0xf414('0x40')]);return _0x1f38d3[_0xf414('0x54')](_0x2699c9);}})[_0xf414('0x17')](function(_0x1088bd){if(_0x1088bd){_0xb6ff8f=_0x1088bd[_0xf414('0x39')];if(!_0x215650[_0xf414('0x33')][_0xf414('0x3a')](_0xf414('0x53'))){_0x2699c9[_0xf414('0x27')]=qs[_0xf414('0x27')](_0x215650[_0xf414('0x33')][_0xf414('0x27')]);_0x2699c9[_0xf414('0x26')]=qs[_0xf414('0x26')](_0x215650[_0xf414('0x33')][_0xf414('0x26')]);}return _0x1f38d3[_0xf414('0x54')](_0x2699c9);}})['then'](function(_0x3c16d2){if(_0x3c16d2){return _0x3c16d2?{'count':_0xb6ff8f,'rows':_0x3c16d2}:null;}})[_0xf414('0x17')](respondWithResult(_0x500241,null))[_0xf414('0x43')](handleError(_0x500241,null));}; \ No newline at end of file +var _0xea0f=['hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','destroy','findOne','Dynamics365Field','order','pick','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','name','send','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length'];(function(_0x44ae0b,_0x3e9865){var _0x69232a=function(_0x5ae588){while(--_0x5ae588){_0x44ae0b['push'](_0x44ae0b['shift']());}};_0x69232a(++_0x3e9865);}(_0xea0f,0x73));var _0xfea0=function(_0x27a1c7,_0x2698a4){_0x27a1c7=_0x27a1c7-0x0;var _0x597db7=_0xea0f[_0x27a1c7];return _0x597db7;};'use strict';var pdf=require(_0xfea0('0x0'));var emlformat=require(_0xfea0('0x1'));var rimraf=require(_0xfea0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfea0('0x3'));var moment=require(_0xfea0('0x4'));var BPromise=require(_0xfea0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfea0('0x6'));var sox=require(_0xfea0('0x7'));var csv=require(_0xfea0('0x8'));var ejs=require(_0xfea0('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfea0('0xa'));var crypto=require('crypto');var jsforce=require(_0xfea0('0xb'));var deskjs=require(_0xfea0('0xc'));var toCsv=require(_0xfea0('0x8'));var querystring=require(_0xfea0('0xd'));var Papa=require(_0xfea0('0xe'));var Redis=require(_0xfea0('0xf'));var authService=require(_0xfea0('0x10'));var qs=require(_0xfea0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfea0('0x12'))(_0xfea0('0x13'));var utils=require(_0xfea0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfea0('0x15'));var db=require(_0xfea0('0x16'))['db'];var jayson=require(_0xfea0('0x17'));var client=jayson[_0xfea0('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c5260,_0x46d04d,_0xf16c6d,_0x9399e9){return new BPromise(function(_0x2f27e4,_0x5878ae){var _0x534109=_0x9399e9||client;return _0x534109[_0xfea0('0x19')](_0x1c5260,_0xf16c6d)[_0xfea0('0x1a')](function(_0x44fe3b){logger[_0xfea0('0x1b')](_0xfea0('0x1c'),_0x46d04d,_0xfea0('0x1d'));logger[_0xfea0('0x1e')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x46d04d,'request\x20sent',JSON[_0xfea0('0x1f')](_0x44fe3b));if(_0x44fe3b[_0xfea0('0x20')]){if(_0x44fe3b[_0xfea0('0x20')][_0xfea0('0x21')]===0x1f4){logger['error'](_0xfea0('0x1c'),_0x46d04d,_0x44fe3b[_0xfea0('0x20')][_0xfea0('0x22')]);return _0x5878ae(_0x44fe3b[_0xfea0('0x20')]['message']);}logger[_0xfea0('0x20')]('Dynamics365Configuration,\x20%s,\x20%s',_0x46d04d,_0x44fe3b['error'][_0xfea0('0x22')]);return _0x2f27e4(_0x44fe3b['error'][_0xfea0('0x22')]);}else{logger[_0xfea0('0x1b')](_0xfea0('0x1c'),_0x46d04d,_0xfea0('0x1d'));_0x2f27e4(_0x44fe3b[_0xfea0('0x23')][_0xfea0('0x22')]);}})[_0xfea0('0x24')](function(_0x54b430){logger['error'](_0xfea0('0x1c'),_0x46d04d,_0x54b430);_0x5878ae(_0x54b430);});});}function respondWithStatusCode(_0x3e5d12,_0x3869fb){_0x3869fb=_0x3869fb||0xcc;return function(_0x3e5912){if(_0x3e5912){return _0x3e5d12[_0xfea0('0x25')](_0x3869fb);}return _0x3e5d12[_0xfea0('0x26')](_0x3869fb)[_0xfea0('0x27')]();};}function respondWithResult(_0x2123ef,_0x252e69){_0x252e69=_0x252e69||0xc8;return function(_0x4aa224){if(_0x4aa224){return _0x2123ef[_0xfea0('0x26')](_0x252e69)[_0xfea0('0x28')](_0x4aa224);}};}function respondWithFilteredResult(_0x3a31c8,_0x5c84c4){return function(_0x2a371b){if(_0x2a371b){var _0x19a0b0=_0x2a371b[_0xfea0('0x29')],_0x5b4864=_0x5c84c4[_0xfea0('0x2a')],_0x35bd83=_0x5c84c4[_0xfea0('0x2a')]+_0x5c84c4[_0xfea0('0x2b')],_0x1fa324;if(_0x35bd83>=_0x19a0b0){_0x35bd83=_0x19a0b0;_0x1fa324=0xc8;}else{_0x1fa324=0xce;}_0x3a31c8['status'](_0x1fa324);return _0x3a31c8[_0xfea0('0x2c')](_0xfea0('0x2d'),_0x5b4864+'-'+_0x35bd83+'/'+_0x19a0b0)['json'](_0x2a371b);}return null;};}function patchUpdates(_0x568e1f){return function(_0xdcb083){try{jsonpatch['apply'](_0xdcb083,_0x568e1f,!![]);}catch(_0x55abf7){return BPromise[_0xfea0('0x2e')](_0x55abf7);}return _0xdcb083['save']();};}function saveUpdates(_0x176e02,_0x124782){return function(_0x2b984a){if(_0x2b984a){return _0x2b984a[_0xfea0('0x2f')](_0x176e02)[_0xfea0('0x1a')](function(_0x5df347){return _0x5df347;});}return null;};}function removeEntity(_0x321a4c,_0x1fc6e8){return function(_0x5eb59e){if(_0x5eb59e){return _0x5eb59e['destroy']()[_0xfea0('0x1a')](function(){_0x321a4c[_0xfea0('0x26')](0xcc)[_0xfea0('0x27')]();});}};}function handleEntityNotFound(_0x5d6067,_0x1b8ca2){return function(_0x331ca7){if(!_0x331ca7){_0x5d6067[_0xfea0('0x25')](0x194);}return _0x331ca7;};}function handleError(_0x273626,_0x2f7e84){_0x2f7e84=_0x2f7e84||0x1f4;return function(_0x2778d4){logger['error'](_0x2778d4['stack']);if(_0x2778d4[_0xfea0('0x30')]){delete _0x2778d4['name'];}_0x273626[_0xfea0('0x26')](_0x2f7e84)[_0xfea0('0x31')](_0x2778d4);};}exports['index']=function(_0x487040,_0x24b826){var _0x4dc26f={},_0x2953c1={},_0x2af050={'count':0x0,'rows':[]};var _0x3a132f=_[_0xfea0('0x32')](db[_0xfea0('0x33')][_0xfea0('0x34')],function(_0x1d9f63){return{'name':_0x1d9f63[_0xfea0('0x35')],'type':_0x1d9f63[_0xfea0('0x36')][_0xfea0('0x37')]};});_0x2953c1[_0xfea0('0x38')]=_['map'](_0x3a132f,_0xfea0('0x30'));_0x2953c1[_0xfea0('0x39')]=_[_0xfea0('0x3a')](_0x487040[_0xfea0('0x39')]);_0x2953c1['filters']=_['intersection'](_0x2953c1[_0xfea0('0x38')],_0x2953c1['query']);_0x4dc26f[_0xfea0('0x3b')]=_[_0xfea0('0x3c')](_0x2953c1[_0xfea0('0x38')],qs[_0xfea0('0x3d')](_0x487040[_0xfea0('0x39')][_0xfea0('0x3d')]));_0x4dc26f['attributes']=_0x4dc26f[_0xfea0('0x3b')][_0xfea0('0x3e')]?_0x4dc26f['attributes']:_0x2953c1['model'];if(!_0x487040[_0xfea0('0x39')][_0xfea0('0x3f')](_0xfea0('0x40'))){_0x4dc26f[_0xfea0('0x2b')]=qs[_0xfea0('0x2b')](_0x487040[_0xfea0('0x39')][_0xfea0('0x2b')]);_0x4dc26f['offset']=qs[_0xfea0('0x2a')](_0x487040[_0xfea0('0x39')]['offset']);}_0x4dc26f['order']=qs[_0xfea0('0x41')](_0x487040[_0xfea0('0x39')][_0xfea0('0x41')]);_0x4dc26f[_0xfea0('0x42')]=qs[_0xfea0('0x43')](_['pick'](_0x487040[_0xfea0('0x39')],_0x2953c1[_0xfea0('0x43')]),_0x3a132f);if(_0x487040['query'][_0xfea0('0x44')]){_0x4dc26f[_0xfea0('0x42')]=_[_0xfea0('0x45')](_0x4dc26f['where'],{'$or':_[_0xfea0('0x32')](_0x3a132f,function(_0x389502){if(_0x389502[_0xfea0('0x36')]!==_0xfea0('0x46')){var _0x1801f8={};_0x1801f8[_0x389502[_0xfea0('0x30')]]={'$like':'%'+_0x487040[_0xfea0('0x39')]['filter']+'%'};return _0x1801f8;}})});}_0x4dc26f=_[_0xfea0('0x45')]({},_0x4dc26f,_0x487040['options']);var _0x50f780={'where':_0x4dc26f['where']};return db['Dynamics365Configuration'][_0xfea0('0x29')](_0x50f780)[_0xfea0('0x1a')](function(_0x56a6fb){_0x2af050[_0xfea0('0x29')]=_0x56a6fb;if(_0x487040[_0xfea0('0x39')][_0xfea0('0x47')]){_0x4dc26f[_0xfea0('0x48')]=[{'all':!![]}];}return db[_0xfea0('0x33')][_0xfea0('0x49')](_0x4dc26f);})['then'](function(_0x1a564e){_0x2af050[_0xfea0('0x4a')]=_0x1a564e;return _0x2af050;})['then'](respondWithFilteredResult(_0x24b826,_0x4dc26f))['catch'](handleError(_0x24b826,null));};exports[_0xfea0('0x4b')]=function(_0x39d154,_0x256083){var _0x2226b5={'raw':![],'where':{'id':_0x39d154[_0xfea0('0x4c')]['id']}},_0x547500={};_0x547500[_0xfea0('0x38')]=_['keys'](db['Dynamics365Configuration'][_0xfea0('0x34')]);_0x547500[_0xfea0('0x39')]=_['keys'](_0x39d154[_0xfea0('0x39')]);_0x547500[_0xfea0('0x43')]=_[_0xfea0('0x3c')](_0x547500[_0xfea0('0x38')],_0x547500['query']);_0x2226b5[_0xfea0('0x3b')]=_[_0xfea0('0x3c')](_0x547500[_0xfea0('0x38')],qs[_0xfea0('0x3d')](_0x39d154[_0xfea0('0x39')]['fields']));_0x2226b5['attributes']=_0x2226b5[_0xfea0('0x3b')][_0xfea0('0x3e')]?_0x2226b5[_0xfea0('0x3b')]:_0x547500[_0xfea0('0x38')];if(_0x39d154[_0xfea0('0x39')][_0xfea0('0x47')]){_0x2226b5[_0xfea0('0x48')]=[{'all':!![]}];}_0x2226b5=_[_0xfea0('0x45')]({},_0x2226b5,_0x39d154[_0xfea0('0x4d')]);return db[_0xfea0('0x33')][_0xfea0('0x4e')](_0x2226b5)[_0xfea0('0x1a')](handleEntityNotFound(_0x256083,null))[_0xfea0('0x1a')](respondWithResult(_0x256083,null))['catch'](handleError(_0x256083,null));};exports[_0xfea0('0x4f')]=function(_0x2dd581,_0x2ae5b5){return db['Dynamics365Configuration']['create'](_0x2dd581[_0xfea0('0x50')],{})[_0xfea0('0x1a')](respondWithResult(_0x2ae5b5,0xc9))[_0xfea0('0x24')](handleError(_0x2ae5b5,null));};exports[_0xfea0('0x2f')]=function(_0x250a8b,_0x1f9d8a){if(_0x250a8b[_0xfea0('0x50')]['id']){delete _0x250a8b['body']['id'];}return db[_0xfea0('0x33')][_0xfea0('0x4e')]({'where':{'id':_0x250a8b['params']['id']}})[_0xfea0('0x1a')](handleEntityNotFound(_0x1f9d8a,null))[_0xfea0('0x1a')](saveUpdates(_0x250a8b[_0xfea0('0x50')],null))[_0xfea0('0x1a')](respondWithResult(_0x1f9d8a,null))[_0xfea0('0x24')](handleError(_0x1f9d8a,null));};exports[_0xfea0('0x51')]=function(_0x3d5c74,_0xa830cc){return db['Dynamics365Configuration']['find']({'where':{'id':_0x3d5c74[_0xfea0('0x4c')]['id']}})[_0xfea0('0x1a')](handleEntityNotFound(_0xa830cc,null))['then'](removeEntity(_0xa830cc,null))[_0xfea0('0x24')](handleError(_0xa830cc,null));};exports['getFields']=function(_0x28647a,_0x5bd663,_0x1e91f3){var _0x5214e1={};var _0x21b7c7={};var _0x25ab2b;var _0x22800c;return db['Dynamics365Configuration'][_0xfea0('0x52')]({'where':{'id':_0x28647a[_0xfea0('0x4c')]['id']}})[_0xfea0('0x1a')](handleEntityNotFound(_0x5bd663,null))[_0xfea0('0x1a')](function(_0x31ed23){if(_0x31ed23){_0x25ab2b=_0x31ed23;_0x21b7c7[_0xfea0('0x38')]=_[_0xfea0('0x3a')](db[_0xfea0('0x53')]['rawAttributes']);_0x21b7c7['query']=_[_0xfea0('0x3a')](_0x28647a[_0xfea0('0x39')]);_0x21b7c7[_0xfea0('0x43')]=_[_0xfea0('0x3c')](_0x21b7c7['model'],_0x21b7c7[_0xfea0('0x39')]);_0x5214e1[_0xfea0('0x3b')]=_[_0xfea0('0x3c')](_0x21b7c7[_0xfea0('0x38')],qs['fields'](_0x28647a[_0xfea0('0x39')][_0xfea0('0x3d')]));_0x5214e1['attributes']=_0x5214e1['attributes'][_0xfea0('0x3e')]?_0x5214e1[_0xfea0('0x3b')]:_0x21b7c7[_0xfea0('0x38')];_0x5214e1[_0xfea0('0x54')]=qs['sort'](_0x28647a[_0xfea0('0x39')][_0xfea0('0x41')]);_0x5214e1['where']=qs[_0xfea0('0x43')](_[_0xfea0('0x55')](_0x28647a[_0xfea0('0x39')],_0x21b7c7['filters']));if(_0x28647a[_0xfea0('0x39')][_0xfea0('0x44')]){_0x5214e1[_0xfea0('0x42')]=_[_0xfea0('0x45')](_0x5214e1[_0xfea0('0x42')],{'$or':_[_0xfea0('0x32')](_0x5214e1[_0xfea0('0x3b')],function(_0x29d975){var _0x1d7c3a={};_0x1d7c3a[_0x29d975]={'$like':'%'+_0x28647a['query']['filter']+'%'};return _0x1d7c3a;})});}_0x5214e1=_['merge']({},_0x5214e1,_0x28647a['options']);return _0x25ab2b[_0xfea0('0x56')](_0x5214e1);}})[_0xfea0('0x1a')](function(_0x6d5078){if(_0x6d5078){_0x22800c=_0x6d5078['length'];if(!_0x28647a[_0xfea0('0x39')][_0xfea0('0x3f')](_0xfea0('0x40'))){_0x5214e1[_0xfea0('0x2b')]=qs['limit'](_0x28647a[_0xfea0('0x39')][_0xfea0('0x2b')]);_0x5214e1['offset']=qs[_0xfea0('0x2a')](_0x28647a['query']['offset']);}return _0x25ab2b[_0xfea0('0x56')](_0x5214e1);}})[_0xfea0('0x1a')](function(_0x2f503f){if(_0x2f503f){return _0x2f503f?{'count':_0x22800c,'rows':_0x2f503f}:null;}})[_0xfea0('0x1a')](respondWithResult(_0x5bd663,null))[_0xfea0('0x24')](handleError(_0x5bd663,null));};exports[_0xfea0('0x57')]=function(_0x8bc803,_0x3cdbc6,_0x346e4c){var _0x19fd05={};var _0x163386={};var _0x23e380;var _0x47e32a;return db[_0xfea0('0x33')][_0xfea0('0x52')]({'where':{'id':_0x8bc803[_0xfea0('0x4c')]['id']}})[_0xfea0('0x1a')](handleEntityNotFound(_0x3cdbc6,null))[_0xfea0('0x1a')](function(_0x32e906){if(_0x32e906){_0x23e380=_0x32e906;_0x163386[_0xfea0('0x38')]=_[_0xfea0('0x3a')](db[_0xfea0('0x53')][_0xfea0('0x34')]);_0x163386[_0xfea0('0x39')]=_[_0xfea0('0x3a')](_0x8bc803[_0xfea0('0x39')]);_0x163386[_0xfea0('0x43')]=_[_0xfea0('0x3c')](_0x163386[_0xfea0('0x38')],_0x163386[_0xfea0('0x39')]);_0x19fd05['attributes']=_[_0xfea0('0x3c')](_0x163386[_0xfea0('0x38')],qs['fields'](_0x8bc803[_0xfea0('0x39')][_0xfea0('0x3d')]));_0x19fd05[_0xfea0('0x3b')]=_0x19fd05[_0xfea0('0x3b')][_0xfea0('0x3e')]?_0x19fd05['attributes']:_0x163386[_0xfea0('0x38')];_0x19fd05[_0xfea0('0x54')]=qs[_0xfea0('0x41')](_0x8bc803[_0xfea0('0x39')][_0xfea0('0x41')]);_0x19fd05['where']=qs[_0xfea0('0x43')](_[_0xfea0('0x55')](_0x8bc803['query'],_0x163386[_0xfea0('0x43')]));if(_0x8bc803['query'][_0xfea0('0x44')]){_0x19fd05[_0xfea0('0x42')]=_[_0xfea0('0x45')](_0x19fd05[_0xfea0('0x42')],{'$or':_['map'](_0x19fd05[_0xfea0('0x3b')],function(_0x272445){var _0x461b20={};_0x461b20[_0x272445]={'$like':'%'+_0x8bc803[_0xfea0('0x39')][_0xfea0('0x44')]+'%'};return _0x461b20;})});}_0x19fd05=_[_0xfea0('0x45')]({},_0x19fd05,_0x8bc803['options']);return _0x23e380[_0xfea0('0x57')](_0x19fd05);}})[_0xfea0('0x1a')](function(_0x586d01){if(_0x586d01){_0x47e32a=_0x586d01[_0xfea0('0x3e')];if(!_0x8bc803['query']['hasOwnProperty'](_0xfea0('0x40'))){_0x19fd05[_0xfea0('0x2b')]=qs[_0xfea0('0x2b')](_0x8bc803[_0xfea0('0x39')][_0xfea0('0x2b')]);_0x19fd05['offset']=qs[_0xfea0('0x2a')](_0x8bc803[_0xfea0('0x39')][_0xfea0('0x2a')]);}return _0x23e380['getSubjects'](_0x19fd05);}})[_0xfea0('0x1a')](function(_0x5adfa3){if(_0x5adfa3){return _0x5adfa3?{'count':_0x47e32a,'rows':_0x5adfa3}:null;}})[_0xfea0('0x1a')](respondWithResult(_0x3cdbc6,null))[_0xfea0('0x24')](handleError(_0x3cdbc6,null));};exports['getDescriptions']=function(_0x38ff73,_0x166fb7,_0x1dc076){var _0xe32bfa={};var _0x3cd41b={};var _0x1a04cb;var _0x3c4809;return db[_0xfea0('0x33')][_0xfea0('0x52')]({'where':{'id':_0x38ff73['params']['id']}})[_0xfea0('0x1a')](handleEntityNotFound(_0x166fb7,null))[_0xfea0('0x1a')](function(_0xc46852){if(_0xc46852){_0x1a04cb=_0xc46852;_0x3cd41b['model']=_[_0xfea0('0x3a')](db[_0xfea0('0x53')][_0xfea0('0x34')]);_0x3cd41b[_0xfea0('0x39')]=_[_0xfea0('0x3a')](_0x38ff73[_0xfea0('0x39')]);_0x3cd41b[_0xfea0('0x43')]=_['intersection'](_0x3cd41b[_0xfea0('0x38')],_0x3cd41b[_0xfea0('0x39')]);_0xe32bfa[_0xfea0('0x3b')]=_['intersection'](_0x3cd41b['model'],qs[_0xfea0('0x3d')](_0x38ff73[_0xfea0('0x39')][_0xfea0('0x3d')]));_0xe32bfa[_0xfea0('0x3b')]=_0xe32bfa[_0xfea0('0x3b')][_0xfea0('0x3e')]?_0xe32bfa['attributes']:_0x3cd41b[_0xfea0('0x38')];_0xe32bfa[_0xfea0('0x54')]=qs[_0xfea0('0x41')](_0x38ff73[_0xfea0('0x39')][_0xfea0('0x41')]);_0xe32bfa[_0xfea0('0x42')]=qs[_0xfea0('0x43')](_[_0xfea0('0x55')](_0x38ff73[_0xfea0('0x39')],_0x3cd41b['filters']));if(_0x38ff73['query'][_0xfea0('0x44')]){_0xe32bfa[_0xfea0('0x42')]=_['merge'](_0xe32bfa[_0xfea0('0x42')],{'$or':_[_0xfea0('0x32')](_0xe32bfa[_0xfea0('0x3b')],function(_0x372c86){var _0x20f75c={};_0x20f75c[_0x372c86]={'$like':'%'+_0x38ff73[_0xfea0('0x39')]['filter']+'%'};return _0x20f75c;})});}_0xe32bfa=_[_0xfea0('0x45')]({},_0xe32bfa,_0x38ff73[_0xfea0('0x4d')]);return _0x1a04cb[_0xfea0('0x58')](_0xe32bfa);}})[_0xfea0('0x1a')](function(_0x554df0){if(_0x554df0){_0x3c4809=_0x554df0[_0xfea0('0x3e')];if(!_0x38ff73[_0xfea0('0x39')][_0xfea0('0x3f')]('nolimit')){_0xe32bfa[_0xfea0('0x2b')]=qs[_0xfea0('0x2b')](_0x38ff73[_0xfea0('0x39')][_0xfea0('0x2b')]);_0xe32bfa[_0xfea0('0x2a')]=qs[_0xfea0('0x2a')](_0x38ff73[_0xfea0('0x39')][_0xfea0('0x2a')]);}return _0x1a04cb[_0xfea0('0x58')](_0xe32bfa);}})[_0xfea0('0x1a')](function(_0x1accf8){if(_0x1accf8){return _0x1accf8?{'count':_0x3c4809,'rows':_0x1accf8}:null;}})[_0xfea0('0x1a')](respondWithResult(_0x166fb7,null))['catch'](handleError(_0x166fb7,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index c3488de..0a9962f 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 _0x1e6a=['api','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger'];(function(_0x31313c,_0x4fe8d2){var _0x2645ed=function(_0x18bae4){while(--_0x18bae4){_0x31313c['push'](_0x31313c['shift']());}};_0x2645ed(++_0x4fe8d2);}(_0x1e6a,0x8d));var _0xa1e6=function(_0x4f52f6,_0xbe68fc){_0x4f52f6=_0x4f52f6-0x0;var _0x4cbb9d=_0x1e6a[_0x4f52f6];return _0x4cbb9d;};'use strict';var _=require(_0xa1e6('0x0'));var util=require(_0xa1e6('0x1'));var logger=require(_0xa1e6('0x2'))(_0xa1e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa1e6('0x4'));var fs=require('fs');var path=require(_0xa1e6('0x5'));var rimraf=require(_0xa1e6('0x6'));var config=require(_0xa1e6('0x7'));var attributes=require(_0xa1e6('0x8'));module[_0xa1e6('0x9')]=function(_0xd7fb16,_0x51ab4f){return _0xd7fb16['define'](_0xa1e6('0xa'),attributes,{'tableName':_0xa1e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36d2=['int_dynamics365_configurations','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration'];(function(_0x5a4138,_0x1b3cc5){var _0x3117be=function(_0x2077fa){while(--_0x2077fa){_0x5a4138['push'](_0x5a4138['shift']());}};_0x3117be(++_0x1b3cc5);}(_0x36d2,0x79));var _0x236d=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0x36d2[_0x514260];return _0x4ac81b;};'use strict';var _=require(_0x236d('0x0'));var util=require(_0x236d('0x1'));var logger=require(_0x236d('0x2'))(_0x236d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x236d('0x4'));var fs=require('fs');var path=require(_0x236d('0x5'));var rimraf=require(_0x236d('0x6'));var config=require(_0x236d('0x7'));var attributes=require(_0x236d('0x8'));module[_0x236d('0x9')]=function(_0x48ad2a,_0x17d303){return _0x48ad2a['define'](_0x236d('0xa'),attributes,{'tableName':_0x236d('0xb'),'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 86a2335..3493f57 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 _0x6a12=['then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request'];(function(_0x5a5d57,_0x10e511){var _0x57b549=function(_0x32db19){while(--_0x32db19){_0x5a5d57['push'](_0x5a5d57['shift']());}};_0x57b549(++_0x10e511);}(_0x6a12,0xbb));var _0x26a1=function(_0x24a754,_0x24f5bf){_0x24a754=_0x24a754-0x0;var _0x233dca=_0x6a12[_0x24a754];return _0x233dca;};'use strict';var _=require(_0x26a1('0x0'));var util=require(_0x26a1('0x1'));var moment=require(_0x26a1('0x2'));var BPromise=require(_0x26a1('0x3'));var rs=require(_0x26a1('0x4'));var fs=require('fs');var Redis=require(_0x26a1('0x5'));var db=require(_0x26a1('0x6'))['db'];var utils=require(_0x26a1('0x7'));var logger=require(_0x26a1('0x8'))(_0x26a1('0x9'));var config=require('../../config/environment');var jayson=require(_0x26a1('0xa'));var client=jayson['client'][_0x26a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bfdd9,_0x4acd5f,_0x10e823){return new BPromise(function(_0x43e917,_0x2b9c2d){return client[_0x26a1('0xc')](_0x5bfdd9,_0x10e823)[_0x26a1('0xd')](function(_0x4df91a){logger[_0x26a1('0xe')](_0x26a1('0xf'),_0x4acd5f,_0x26a1('0x10'));logger[_0x26a1('0x11')](_0x26a1('0x12'),_0x4acd5f,'request\x20sent',JSON[_0x26a1('0x13')](_0x4df91a));if(_0x4df91a['error']){if(_0x4df91a['error'][_0x26a1('0x14')]===0x1f4){logger[_0x26a1('0x15')](_0x26a1('0xf'),_0x4acd5f,_0x4df91a[_0x26a1('0x15')][_0x26a1('0x16')]);return _0x2b9c2d(_0x4df91a[_0x26a1('0x15')][_0x26a1('0x16')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x4acd5f,_0x4df91a[_0x26a1('0x15')][_0x26a1('0x16')]);return _0x43e917(_0x4df91a[_0x26a1('0x15')][_0x26a1('0x16')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x4acd5f,'request\x20sent');_0x43e917(_0x4df91a[_0x26a1('0x17')][_0x26a1('0x16')]);}})[_0x26a1('0x18')](function(_0x9bdfe5){logger[_0x26a1('0x15')](_0x26a1('0xf'),_0x4acd5f,_0x9bdfe5);_0x2b9c2d(_0x9bdfe5);});});} \ No newline at end of file +var _0xad43=['../../mysqldb','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5490ce,_0x2add99){var _0x3e8a50=function(_0x222923){while(--_0x222923){_0x5490ce['push'](_0x5490ce['shift']());}};_0x3e8a50(++_0x2add99);}(_0xad43,0x1dd));var _0x3ad4=function(_0x1fdb57,_0xfdac8f){_0x1fdb57=_0x1fdb57-0x0;var _0x51bb03=_0xad43[_0x1fdb57];return _0x51bb03;};'use strict';var _=require(_0x3ad4('0x0'));var util=require(_0x3ad4('0x1'));var moment=require(_0x3ad4('0x2'));var BPromise=require(_0x3ad4('0x3'));var rs=require(_0x3ad4('0x4'));var fs=require('fs');var Redis=require(_0x3ad4('0x5'));var db=require(_0x3ad4('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3ad4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2cafcb,_0x152c07,_0x22a9e5){return new BPromise(function(_0x2a57ce,_0x5ebabb){return client[_0x3ad4('0x8')](_0x2cafcb,_0x22a9e5)[_0x3ad4('0x9')](function(_0x49e7ac){logger[_0x3ad4('0xa')](_0x3ad4('0xb'),_0x152c07,_0x3ad4('0xc'));logger[_0x3ad4('0xd')](_0x3ad4('0xe'),_0x152c07,_0x3ad4('0xc'),JSON[_0x3ad4('0xf')](_0x49e7ac));if(_0x49e7ac['error']){if(_0x49e7ac['error'][_0x3ad4('0x10')]===0x1f4){logger['error'](_0x3ad4('0xb'),_0x152c07,_0x49e7ac[_0x3ad4('0x11')][_0x3ad4('0x12')]);return _0x5ebabb(_0x49e7ac[_0x3ad4('0x11')]['message']);}logger['error'](_0x3ad4('0xb'),_0x152c07,_0x49e7ac[_0x3ad4('0x11')]['message']);return _0x2a57ce(_0x49e7ac[_0x3ad4('0x11')][_0x3ad4('0x12')]);}else{logger[_0x3ad4('0xa')](_0x3ad4('0xb'),_0x152c07,'request\x20sent');_0x2a57ce(_0x49e7ac[_0x3ad4('0x13')]['message']);}})[_0x3ad4('0x14')](function(_0x5074f5){logger[_0x3ad4('0x11')](_0x3ad4('0xb'),_0x152c07,_0x5074f5);_0x5ebabb(_0x5074f5);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 9b61fb8..3c89890 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 _0x3c81=['destroy','exports','multer','util','connect-timeout','express','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x140ee1,_0x1426c4){var _0x2c659f=function(_0x55c111){while(--_0x55c111){_0x140ee1['push'](_0x140ee1['shift']());}};_0x2c659f(++_0x1426c4);}(_0x3c81,0x102));var _0x13c8=function(_0x2dc1e3,_0x402802){_0x2dc1e3=_0x2dc1e3-0x0;var _0xbdfa85=_0x3c81[_0x2dc1e3];return _0xbdfa85;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x13c8('0x4'));router[_0x13c8('0x5')]('/',auth[_0x13c8('0x6')](),controller[_0x13c8('0x7')]);router[_0x13c8('0x5')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller['show']);router[_0x13c8('0x9')]('/',auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router[_0x13c8('0xb')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller[_0x13c8('0xc')]);router[_0x13c8('0xd')](_0x13c8('0x8'),auth[_0x13c8('0x6')](),controller[_0x13c8('0xe')]);module[_0x13c8('0xf')]=router; \ No newline at end of file +var _0x9e0d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','/:id','isAuthenticated','show','post','put','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x1dd8ae,_0x3a1660){var _0x56bd3b=function(_0x586890){while(--_0x586890){_0x1dd8ae['push'](_0x1dd8ae['shift']());}};_0x56bd3b(++_0x3a1660);}(_0x9e0d,0xf7));var _0xd9e0=function(_0x3d8455,_0x35008f){_0x3d8455=_0x3d8455-0x0;var _0x39c94e=_0x9e0d[_0x3d8455];return _0x39c94e;};'use strict';var multer=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var path=require(_0xd9e0('0x2'));var timeout=require(_0xd9e0('0x3'));var express=require('express');var router=express[_0xd9e0('0x4')]();var auth=require(_0xd9e0('0x5'));var interaction=require(_0xd9e0('0x6'));var config=require(_0xd9e0('0x7'));var controller=require(_0xd9e0('0x8'));router[_0xd9e0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd9e0('0x9')](_0xd9e0('0xa'),auth[_0xd9e0('0xb')](),controller[_0xd9e0('0xc')]);router[_0xd9e0('0xd')]('/',auth[_0xd9e0('0xb')](),controller['create']);router[_0xd9e0('0xe')](_0xd9e0('0xa'),auth[_0xd9e0('0xb')](),controller[_0xd9e0('0xf')]);router[_0xd9e0('0x10')](_0xd9e0('0xa'),auth[_0xd9e0('0xb')](),controller['destroy']);module[_0xd9e0('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 a4166dc..7d58be0 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 _0x12c0=['BOOLEAN','ENUM','string','variable','keyValue','STRING','customVariable'];(function(_0xf6f69f,_0x363332){var _0xd36a2f=function(_0xd2d612){while(--_0xd2d612){_0xf6f69f['push'](_0xf6f69f['shift']());}};_0xd36a2f(++_0x363332);}(_0x12c0,0x197));var _0x012c=function(_0x293654,_0x14ce67){_0x293654=_0x293654-0x0;var _0x53f62d=_0x12c0[_0x293654];return _0x53f62d;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x012c('0x0')](_0x012c('0x1'),_0x012c('0x2'),'customVariable',_0x012c('0x3')),'defaultValue':_0x012c('0x1')},'content':{'type':Sequelize[_0x012c('0x4')]},'key':{'type':Sequelize[_0x012c('0x4')]},'keyType':{'type':Sequelize[_0x012c('0x0')](_0x012c('0x1'),'variable',_0x012c('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x012c('0x4')]},'nameField':{'type':Sequelize[_0x012c('0x4')]},'customField':{'type':Sequelize[_0x012c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x012c('0x4')]}}; \ No newline at end of file +var _0xed55=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xed55,0xcb));var _0x5ed5=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xed55[_0x5e6cb8];return _0x3faeb3;};'use strict';var Sequelize=require('sequelize');module[_0x5ed5('0x0')]={'type':{'type':Sequelize[_0x5ed5('0x1')](_0x5ed5('0x2'),_0x5ed5('0x3'),_0x5ed5('0x4'),'keyValue'),'defaultValue':_0x5ed5('0x2')},'content':{'type':Sequelize[_0x5ed5('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5ed5('0x1')]('string','variable',_0x5ed5('0x4'))},'keyContent':{'type':Sequelize[_0x5ed5('0x5')]},'idField':{'type':Sequelize[_0x5ed5('0x5')]},'nameField':{'type':Sequelize[_0x5ed5('0x5')]},'customField':{'type':Sequelize[_0x5ed5('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ed5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 146cb83..40793e6 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 _0x9ab5=['html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','set','Content-Range','json','apply','save','then','destroy','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','update'];(function(_0x5e5b6c,_0x3cef7b){var _0x21ac4f=function(_0x3520e7){while(--_0x3520e7){_0x5e5b6c['push'](_0x5e5b6c['shift']());}};_0x21ac4f(++_0x3cef7b);}(_0x9ab5,0xe1));var _0x59ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9ab5[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x59ab('0x0'));var emlformat=require(_0x59ab('0x1'));var rimraf=require(_0x59ab('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59ab('0x3'));var rp=require(_0x59ab('0x4'));var moment=require(_0x59ab('0x5'));var BPromise=require(_0x59ab('0x6'));var Mustache=require(_0x59ab('0x7'));var util=require(_0x59ab('0x8'));var path=require('path');var sox=require(_0x59ab('0x9'));var csv=require(_0x59ab('0xa'));var ejs=require(_0x59ab('0xb'));var fs=require('fs');var _=require(_0x59ab('0xc'));var squel=require(_0x59ab('0xd'));var crypto=require(_0x59ab('0xe'));var jsforce=require(_0x59ab('0xf'));var deskjs=require(_0x59ab('0x10'));var toCsv=require(_0x59ab('0xa'));var querystring=require(_0x59ab('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x59ab('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x59ab('0x13'));var hardwareService=require(_0x59ab('0x14'));var logger=require(_0x59ab('0x15'))(_0x59ab('0x16'));var utils=require(_0x59ab('0x17'));var config=require(_0x59ab('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x59ab('0x19'))['db'];function respondWithStatusCode(_0x15e464,_0x17c5f0){_0x17c5f0=_0x17c5f0||0xcc;return function(_0x1159af){if(_0x1159af){return _0x15e464[_0x59ab('0x1a')](_0x17c5f0);}return _0x15e464['status'](_0x17c5f0)[_0x59ab('0x1b')]();};}function respondWithResult(_0x983962,_0x3d8a23){_0x3d8a23=_0x3d8a23||0xc8;return function(_0x2210c1){if(_0x2210c1){return _0x983962[_0x59ab('0x1c')](_0x3d8a23)['json'](_0x2210c1);}};}function respondWithFilteredResult(_0x2be8d3,_0x5ad812){return function(_0x540efc){if(_0x540efc){var _0x1f13bf=_0x540efc['count'],_0x29ef81=_0x5ad812[_0x59ab('0x1d')],_0x53046d=_0x5ad812['offset']+_0x5ad812['limit'],_0x1a31d9;if(_0x53046d>=_0x1f13bf){_0x53046d=_0x1f13bf;_0x1a31d9=0xc8;}else{_0x1a31d9=0xce;}_0x2be8d3[_0x59ab('0x1c')](_0x1a31d9);return _0x2be8d3[_0x59ab('0x1e')](_0x59ab('0x1f'),_0x29ef81+'-'+_0x53046d+'/'+_0x1f13bf)[_0x59ab('0x20')](_0x540efc);}return null;};}function patchUpdates(_0x57a585){return function(_0x4d73c2){try{jsonpatch[_0x59ab('0x21')](_0x4d73c2,_0x57a585,!![]);}catch(_0x14556f){return BPromise['reject'](_0x14556f);}return _0x4d73c2[_0x59ab('0x22')]();};}function saveUpdates(_0x1515ca,_0x221f2f){return function(_0x268e45){if(_0x268e45){return _0x268e45['update'](_0x1515ca)[_0x59ab('0x23')](function(_0x4d4ef3){return _0x4d4ef3;});}return null;};}function removeEntity(_0x2dfce2,_0x2edfd5){return function(_0x2ad552){if(_0x2ad552){return _0x2ad552[_0x59ab('0x24')]()[_0x59ab('0x23')](function(){_0x2dfce2['status'](0xcc)[_0x59ab('0x1b')]();});}};}function handleEntityNotFound(_0xa1bf82,_0x1290f7){return function(_0x53c3a1){if(!_0x53c3a1){_0xa1bf82[_0x59ab('0x1a')](0x194);}return _0x53c3a1;};}function handleError(_0x37708e,_0x272bae){_0x272bae=_0x272bae||0x1f4;return function(_0x387209){logger['error'](_0x387209[_0x59ab('0x25')]);if(_0x387209[_0x59ab('0x26')]){delete _0x387209[_0x59ab('0x26')];}_0x37708e[_0x59ab('0x1c')](_0x272bae)[_0x59ab('0x27')](_0x387209);};}exports[_0x59ab('0x28')]=function(_0x13d91f,_0x353d23){var _0x1c9087={},_0x5f53a5={},_0x298237={'count':0x0,'rows':[]};var _0x401a72=_['map'](db[_0x59ab('0x29')][_0x59ab('0x2a')],function(_0x16f23f){return{'name':_0x16f23f[_0x59ab('0x2b')],'type':_0x16f23f[_0x59ab('0x2c')][_0x59ab('0x2d')]};});_0x5f53a5[_0x59ab('0x2e')]=_[_0x59ab('0x2f')](_0x401a72,_0x59ab('0x26'));_0x5f53a5[_0x59ab('0x30')]=_[_0x59ab('0x31')](_0x13d91f[_0x59ab('0x30')]);_0x5f53a5[_0x59ab('0x32')]=_[_0x59ab('0x33')](_0x5f53a5[_0x59ab('0x2e')],_0x5f53a5[_0x59ab('0x30')]);_0x1c9087[_0x59ab('0x34')]=_[_0x59ab('0x33')](_0x5f53a5[_0x59ab('0x2e')],qs[_0x59ab('0x35')](_0x13d91f[_0x59ab('0x30')][_0x59ab('0x35')]));_0x1c9087[_0x59ab('0x34')]=_0x1c9087[_0x59ab('0x34')][_0x59ab('0x36')]?_0x1c9087['attributes']:_0x5f53a5['model'];if(!_0x13d91f['query'][_0x59ab('0x37')](_0x59ab('0x38'))){_0x1c9087[_0x59ab('0x39')]=qs[_0x59ab('0x39')](_0x13d91f[_0x59ab('0x30')][_0x59ab('0x39')]);_0x1c9087[_0x59ab('0x1d')]=qs[_0x59ab('0x1d')](_0x13d91f[_0x59ab('0x30')]['offset']);}_0x1c9087[_0x59ab('0x3a')]=qs[_0x59ab('0x3b')](_0x13d91f[_0x59ab('0x30')]['sort']);_0x1c9087['where']=qs[_0x59ab('0x32')](_[_0x59ab('0x3c')](_0x13d91f[_0x59ab('0x30')],_0x5f53a5[_0x59ab('0x32')]),_0x401a72);if(_0x13d91f['query'][_0x59ab('0x3d')]){_0x1c9087[_0x59ab('0x3e')]=_[_0x59ab('0x3f')](_0x1c9087[_0x59ab('0x3e')],{'$or':_[_0x59ab('0x2f')](_0x401a72,function(_0x126c26){if(_0x126c26[_0x59ab('0x2c')]!=='VIRTUAL'){var _0x1de3c0={};_0x1de3c0[_0x126c26[_0x59ab('0x26')]]={'$like':'%'+_0x13d91f[_0x59ab('0x30')]['filter']+'%'};return _0x1de3c0;}})});}_0x1c9087=_[_0x59ab('0x3f')]({},_0x1c9087,_0x13d91f[_0x59ab('0x40')]);var _0x412782={'where':_0x1c9087[_0x59ab('0x3e')]};return db['Dynamics365Field']['count'](_0x412782)['then'](function(_0x5ba65c){_0x298237['count']=_0x5ba65c;if(_0x13d91f[_0x59ab('0x30')][_0x59ab('0x41')]){_0x1c9087['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x59ab('0x42')](_0x1c9087);})['then'](function(_0x2a373d){_0x298237[_0x59ab('0x43')]=_0x2a373d;return _0x298237;})[_0x59ab('0x23')](respondWithFilteredResult(_0x353d23,_0x1c9087))[_0x59ab('0x44')](handleError(_0x353d23,null));};exports[_0x59ab('0x45')]=function(_0x1396b2,_0x55829c){var _0x11ad62={'raw':!![],'where':{'id':_0x1396b2[_0x59ab('0x46')]['id']}},_0x88d7af={};_0x88d7af['model']=_[_0x59ab('0x31')](db[_0x59ab('0x29')][_0x59ab('0x2a')]);_0x88d7af['query']=_['keys'](_0x1396b2[_0x59ab('0x30')]);_0x88d7af[_0x59ab('0x32')]=_[_0x59ab('0x33')](_0x88d7af[_0x59ab('0x2e')],_0x88d7af[_0x59ab('0x30')]);_0x11ad62['attributes']=_[_0x59ab('0x33')](_0x88d7af[_0x59ab('0x2e')],qs[_0x59ab('0x35')](_0x1396b2[_0x59ab('0x30')][_0x59ab('0x35')]));_0x11ad62[_0x59ab('0x34')]=_0x11ad62[_0x59ab('0x34')][_0x59ab('0x36')]?_0x11ad62['attributes']:_0x88d7af[_0x59ab('0x2e')];if(_0x1396b2[_0x59ab('0x30')][_0x59ab('0x41')]){_0x11ad62['include']=[{'all':!![]}];}_0x11ad62=_[_0x59ab('0x3f')]({},_0x11ad62,_0x1396b2[_0x59ab('0x40')]);return db[_0x59ab('0x29')][_0x59ab('0x47')](_0x11ad62)[_0x59ab('0x23')](handleEntityNotFound(_0x55829c,null))['then'](respondWithResult(_0x55829c,null))[_0x59ab('0x44')](handleError(_0x55829c,null));};exports[_0x59ab('0x48')]=function(_0x4592f9,_0x5c3ccf){return db['Dynamics365Field'][_0x59ab('0x48')](_0x4592f9[_0x59ab('0x49')],{})[_0x59ab('0x23')](respondWithResult(_0x5c3ccf,0xc9))['catch'](handleError(_0x5c3ccf,null));};exports[_0x59ab('0x4a')]=function(_0xfbfa1a,_0x549694){if(_0xfbfa1a[_0x59ab('0x49')]['id']){delete _0xfbfa1a['body']['id'];}return db['Dynamics365Field'][_0x59ab('0x47')]({'where':{'id':_0xfbfa1a[_0x59ab('0x46')]['id']}})['then'](handleEntityNotFound(_0x549694,null))[_0x59ab('0x23')](saveUpdates(_0xfbfa1a[_0x59ab('0x49')],null))[_0x59ab('0x23')](respondWithResult(_0x549694,null))[_0x59ab('0x44')](handleError(_0x549694,null));};exports['destroy']=function(_0x3800fe,_0x1a3f5a){return db[_0x59ab('0x29')][_0x59ab('0x47')]({'where':{'id':_0x3800fe['params']['id']}})[_0x59ab('0x23')](handleEntityNotFound(_0x1a3f5a,null))[_0x59ab('0x23')](removeEntity(_0x1a3f5a,null))[_0x59ab('0x44')](handleError(_0x1a3f5a,null));}; \ No newline at end of file +var _0xb2f4=['model','query','keys','filters','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','Dynamics365Field','count','includeAll','include','findAll','rows','intersection','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb2f4,0x14f));var _0x4b2f=function(_0x15f455,_0x1ec373){_0x15f455=_0x15f455-0x0;var _0x45f542=_0xb2f4[_0x15f455];return _0x45f542;};'use strict';var pdf=require(_0x4b2f('0x0'));var emlformat=require(_0x4b2f('0x1'));var rimraf=require(_0x4b2f('0x2'));var zipdir=require(_0x4b2f('0x3'));var jsonpatch=require(_0x4b2f('0x4'));var rp=require(_0x4b2f('0x5'));var moment=require(_0x4b2f('0x6'));var BPromise=require(_0x4b2f('0x7'));var Mustache=require(_0x4b2f('0x8'));var util=require(_0x4b2f('0x9'));var path=require(_0x4b2f('0xa'));var sox=require(_0x4b2f('0xb'));var csv=require(_0x4b2f('0xc'));var ejs=require(_0x4b2f('0xd'));var fs=require('fs');var _=require(_0x4b2f('0xe'));var squel=require('squel');var crypto=require(_0x4b2f('0xf'));var jsforce=require(_0x4b2f('0x10'));var deskjs=require(_0x4b2f('0x11'));var toCsv=require(_0x4b2f('0xc'));var querystring=require(_0x4b2f('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4b2f('0x13'));var as=require(_0x4b2f('0x14'));var hardwareService=require(_0x4b2f('0x15'));var logger=require(_0x4b2f('0x16'))(_0x4b2f('0x17'));var utils=require(_0x4b2f('0x18'));var config=require(_0x4b2f('0x19'));var licenseUtil=require(_0x4b2f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5612d7,_0x5f050c){_0x5f050c=_0x5f050c||0xcc;return function(_0x36cc6c){if(_0x36cc6c){return _0x5612d7['sendStatus'](_0x5f050c);}return _0x5612d7[_0x4b2f('0x1b')](_0x5f050c)[_0x4b2f('0x1c')]();};}function respondWithResult(_0x39a542,_0x3ead98){_0x3ead98=_0x3ead98||0xc8;return function(_0x3a7c87){if(_0x3a7c87){return _0x39a542['status'](_0x3ead98)[_0x4b2f('0x1d')](_0x3a7c87);}};}function respondWithFilteredResult(_0x24cfd0,_0x58c05e){return function(_0x138131){if(_0x138131){var _0x551a8b=_0x138131['count'],_0xf18a48=_0x58c05e[_0x4b2f('0x1e')],_0x547b7d=_0x58c05e[_0x4b2f('0x1e')]+_0x58c05e[_0x4b2f('0x1f')],_0x2c1e9f;if(_0x547b7d>=_0x551a8b){_0x547b7d=_0x551a8b;_0x2c1e9f=0xc8;}else{_0x2c1e9f=0xce;}_0x24cfd0[_0x4b2f('0x1b')](_0x2c1e9f);return _0x24cfd0[_0x4b2f('0x20')](_0x4b2f('0x21'),_0xf18a48+'-'+_0x547b7d+'/'+_0x551a8b)[_0x4b2f('0x1d')](_0x138131);}return null;};}function patchUpdates(_0x2e9981){return function(_0x372bc5){try{jsonpatch[_0x4b2f('0x22')](_0x372bc5,_0x2e9981,!![]);}catch(_0xb2eea5){return BPromise[_0x4b2f('0x23')](_0xb2eea5);}return _0x372bc5[_0x4b2f('0x24')]();};}function saveUpdates(_0x4b158e,_0x11b6c5){return function(_0x85caba){if(_0x85caba){return _0x85caba[_0x4b2f('0x25')](_0x4b158e)[_0x4b2f('0x26')](function(_0x170661){return _0x170661;});}return null;};}function removeEntity(_0x5e172f,_0x13c42f){return function(_0x155d0b){if(_0x155d0b){return _0x155d0b[_0x4b2f('0x27')]()['then'](function(){_0x5e172f[_0x4b2f('0x1b')](0xcc)[_0x4b2f('0x1c')]();});}};}function handleEntityNotFound(_0x188465,_0x18b9a4){return function(_0x2b5ffc){if(!_0x2b5ffc){_0x188465['sendStatus'](0x194);}return _0x2b5ffc;};}function handleError(_0x31250d,_0x48ae92){_0x48ae92=_0x48ae92||0x1f4;return function(_0x3d69f8){logger[_0x4b2f('0x28')](_0x3d69f8[_0x4b2f('0x29')]);if(_0x3d69f8[_0x4b2f('0x2a')]){delete _0x3d69f8['name'];}_0x31250d[_0x4b2f('0x1b')](_0x48ae92)[_0x4b2f('0x2b')](_0x3d69f8);};}exports[_0x4b2f('0x2c')]=function(_0x3da5ea,_0x329150){var _0xa31ba5={},_0x10039e={},_0x40228={'count':0x0,'rows':[]};var _0xc7e38=_[_0x4b2f('0x2d')](db['Dynamics365Field'][_0x4b2f('0x2e')],function(_0x11a33e){return{'name':_0x11a33e[_0x4b2f('0x2f')],'type':_0x11a33e[_0x4b2f('0x30')][_0x4b2f('0x31')]};});_0x10039e[_0x4b2f('0x32')]=_[_0x4b2f('0x2d')](_0xc7e38,_0x4b2f('0x2a'));_0x10039e[_0x4b2f('0x33')]=_[_0x4b2f('0x34')](_0x3da5ea[_0x4b2f('0x33')]);_0x10039e[_0x4b2f('0x35')]=_['intersection'](_0x10039e['model'],_0x10039e[_0x4b2f('0x33')]);_0xa31ba5[_0x4b2f('0x36')]=_['intersection'](_0x10039e[_0x4b2f('0x32')],qs[_0x4b2f('0x37')](_0x3da5ea[_0x4b2f('0x33')][_0x4b2f('0x37')]));_0xa31ba5['attributes']=_0xa31ba5[_0x4b2f('0x36')][_0x4b2f('0x38')]?_0xa31ba5['attributes']:_0x10039e[_0x4b2f('0x32')];if(!_0x3da5ea[_0x4b2f('0x33')]['hasOwnProperty']('nolimit')){_0xa31ba5[_0x4b2f('0x1f')]=qs[_0x4b2f('0x1f')](_0x3da5ea[_0x4b2f('0x33')][_0x4b2f('0x1f')]);_0xa31ba5['offset']=qs['offset'](_0x3da5ea[_0x4b2f('0x33')][_0x4b2f('0x1e')]);}_0xa31ba5[_0x4b2f('0x39')]=qs[_0x4b2f('0x3a')](_0x3da5ea[_0x4b2f('0x33')][_0x4b2f('0x3a')]);_0xa31ba5[_0x4b2f('0x3b')]=qs[_0x4b2f('0x35')](_[_0x4b2f('0x3c')](_0x3da5ea[_0x4b2f('0x33')],_0x10039e[_0x4b2f('0x35')]),_0xc7e38);if(_0x3da5ea[_0x4b2f('0x33')][_0x4b2f('0x3d')]){_0xa31ba5[_0x4b2f('0x3b')]=_['merge'](_0xa31ba5[_0x4b2f('0x3b')],{'$or':_[_0x4b2f('0x2d')](_0xc7e38,function(_0x301137){if(_0x301137[_0x4b2f('0x30')]!==_0x4b2f('0x3e')){var _0x278ba7={};_0x278ba7[_0x301137['name']]={'$like':'%'+_0x3da5ea['query']['filter']+'%'};return _0x278ba7;}})});}_0xa31ba5=_[_0x4b2f('0x3f')]({},_0xa31ba5,_0x3da5ea[_0x4b2f('0x40')]);var _0x185205={'where':_0xa31ba5[_0x4b2f('0x3b')]};return db[_0x4b2f('0x41')][_0x4b2f('0x42')](_0x185205)[_0x4b2f('0x26')](function(_0x1987b5){_0x40228[_0x4b2f('0x42')]=_0x1987b5;if(_0x3da5ea['query'][_0x4b2f('0x43')]){_0xa31ba5[_0x4b2f('0x44')]=[{'all':!![]}];}return db[_0x4b2f('0x41')][_0x4b2f('0x45')](_0xa31ba5);})['then'](function(_0x2737fa){_0x40228[_0x4b2f('0x46')]=_0x2737fa;return _0x40228;})['then'](respondWithFilteredResult(_0x329150,_0xa31ba5))['catch'](handleError(_0x329150,null));};exports['show']=function(_0x4af64f,_0x235aa3){var _0x80ad0b={'raw':!![],'where':{'id':_0x4af64f['params']['id']}},_0x3903fc={};_0x3903fc['model']=_[_0x4b2f('0x34')](db[_0x4b2f('0x41')][_0x4b2f('0x2e')]);_0x3903fc[_0x4b2f('0x33')]=_[_0x4b2f('0x34')](_0x4af64f['query']);_0x3903fc[_0x4b2f('0x35')]=_[_0x4b2f('0x47')](_0x3903fc['model'],_0x3903fc['query']);_0x80ad0b[_0x4b2f('0x36')]=_['intersection'](_0x3903fc[_0x4b2f('0x32')],qs['fields'](_0x4af64f[_0x4b2f('0x33')][_0x4b2f('0x37')]));_0x80ad0b['attributes']=_0x80ad0b[_0x4b2f('0x36')][_0x4b2f('0x38')]?_0x80ad0b['attributes']:_0x3903fc['model'];if(_0x4af64f[_0x4b2f('0x33')]['includeAll']){_0x80ad0b[_0x4b2f('0x44')]=[{'all':!![]}];}_0x80ad0b=_[_0x4b2f('0x3f')]({},_0x80ad0b,_0x4af64f['options']);return db[_0x4b2f('0x41')][_0x4b2f('0x48')](_0x80ad0b)['then'](handleEntityNotFound(_0x235aa3,null))[_0x4b2f('0x26')](respondWithResult(_0x235aa3,null))[_0x4b2f('0x49')](handleError(_0x235aa3,null));};exports[_0x4b2f('0x4a')]=function(_0x4bea16,_0x26552d){return db['Dynamics365Field'][_0x4b2f('0x4a')](_0x4bea16[_0x4b2f('0x4b')],{})['then'](respondWithResult(_0x26552d,0xc9))[_0x4b2f('0x49')](handleError(_0x26552d,null));};exports[_0x4b2f('0x25')]=function(_0x2abf07,_0x2b167f){if(_0x2abf07[_0x4b2f('0x4b')]['id']){delete _0x2abf07['body']['id'];}return db[_0x4b2f('0x41')][_0x4b2f('0x48')]({'where':{'id':_0x2abf07[_0x4b2f('0x4c')]['id']}})[_0x4b2f('0x26')](handleEntityNotFound(_0x2b167f,null))[_0x4b2f('0x26')](saveUpdates(_0x2abf07['body'],null))['then'](respondWithResult(_0x2b167f,null))[_0x4b2f('0x49')](handleError(_0x2b167f,null));};exports[_0x4b2f('0x27')]=function(_0x253396,_0x39781b){return db['Dynamics365Field'][_0x4b2f('0x48')]({'where':{'id':_0x253396[_0x4b2f('0x4c')]['id']}})[_0x4b2f('0x26')](handleEntityNotFound(_0x39781b,null))[_0x4b2f('0x26')](removeEntity(_0x39781b,null))[_0x4b2f('0x49')](handleError(_0x39781b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index e93b1d2..c11fe03 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 _0xead6=['dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields'];(function(_0x1b02a2,_0x28fcd3){var _0x25f243=function(_0x552b53){while(--_0x552b53){_0x1b02a2['push'](_0x1b02a2['shift']());}};_0x25f243(++_0x28fcd3);}(_0xead6,0x153));var _0x6ead=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xead6[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x6ead('0x0'));var util=require('util');var logger=require(_0x6ead('0x1'))(_0x6ead('0x2'));var moment=require(_0x6ead('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6ead('0x4'));var config=require(_0x6ead('0x5'));var attributes=require(_0x6ead('0x6'));module[_0x6ead('0x7')]=function(_0x57cd49,_0x11f732){return _0x57cd49['define']('Dynamics365Field',attributes,{'tableName':_0x6ead('0x8'),'paranoid':![],'indexes':[{'name':_0x6ead('0x9'),'fields':[_0x6ead('0xa'),_0x6ead('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5cb5=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','api','moment','bluebird','rimraf','../../config/environment','exports'];(function(_0x2a3f46,_0x3a136d){var _0x7bf1c0=function(_0x1bdcb7){while(--_0x1bdcb7){_0x2a3f46['push'](_0x2a3f46['shift']());}};_0x7bf1c0(++_0x3a136d);}(_0x5cb5,0x1da));var _0x55cb=function(_0x14f5bb,_0x49669d){_0x14f5bb=_0x14f5bb-0x0;var _0x5865dc=_0x5cb5[_0x14f5bb];return _0x5865dc;};'use strict';var _=require(_0x55cb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x55cb('0x1'));var moment=require(_0x55cb('0x2'));var BPromise=require(_0x55cb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x55cb('0x4'));var config=require(_0x55cb('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0x55cb('0x6')]=function(_0x32fe96,_0xa01452){return _0x32fe96[_0x55cb('0x7')](_0x55cb('0x8'),attributes,{'tableName':_0x55cb('0x9'),'paranoid':![],'indexes':[{'name':_0x55cb('0xa'),'fields':[_0x55cb('0xb'),_0x55cb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index f761153..2f7654c 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 _0xef4d=['Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Field,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xef4d,0x165));var _0xdef4=function(_0x1e3c16,_0x372caa){_0x1e3c16=_0x1e3c16-0x0;var _0x47a0c9=_0xef4d[_0x1e3c16];return _0x47a0c9;};'use strict';var _=require(_0xdef4('0x0'));var util=require(_0xdef4('0x1'));var moment=require(_0xdef4('0x2'));var BPromise=require(_0xdef4('0x3'));var rs=require(_0xdef4('0x4'));var fs=require('fs');var Redis=require(_0xdef4('0x5'));var db=require(_0xdef4('0x6'))['db'];var utils=require(_0xdef4('0x7'));var logger=require(_0xdef4('0x8'))(_0xdef4('0x9'));var config=require(_0xdef4('0xa'));var jayson=require(_0xdef4('0xb'));var client=jayson[_0xdef4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x468dcd,_0x3b875f,_0x2cebfd){return new BPromise(function(_0x1dc5c9,_0x525707){return client[_0xdef4('0xd')](_0x468dcd,_0x2cebfd)[_0xdef4('0xe')](function(_0x87d8a3){logger[_0xdef4('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3b875f,_0xdef4('0x10'));logger[_0xdef4('0x11')](_0xdef4('0x12'),_0x3b875f,_0xdef4('0x10'),JSON[_0xdef4('0x13')](_0x87d8a3));if(_0x87d8a3[_0xdef4('0x14')]){if(_0x87d8a3[_0xdef4('0x14')]['code']===0x1f4){logger[_0xdef4('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x3b875f,_0x87d8a3['error'][_0xdef4('0x15')]);return _0x525707(_0x87d8a3['error'][_0xdef4('0x15')]);}logger['error'](_0xdef4('0x16'),_0x3b875f,_0x87d8a3[_0xdef4('0x14')][_0xdef4('0x15')]);return _0x1dc5c9(_0x87d8a3[_0xdef4('0x14')]['message']);}else{logger[_0xdef4('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3b875f,_0xdef4('0x10'));_0x1dc5c9(_0x87d8a3[_0xdef4('0x17')]['message']);}})[_0xdef4('0x18')](function(_0x27463d){logger[_0xdef4('0x14')](_0xdef4('0x16'),_0x3b875f,_0x27463d);_0x525707(_0x27463d);});});} \ No newline at end of file +var _0xef66=['jayson/promise','client','http','request','then','info','request\x20sent','error','code','message','Dynamics365Field,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5b578e,_0x113d79){var _0x5baf06=function(_0x179475){while(--_0x179475){_0x5b578e['push'](_0x5b578e['shift']());}};_0x5baf06(++_0x113d79);}(_0xef66,0x1db));var _0x6ef6=function(_0x515d4d,_0x4a4444){_0x515d4d=_0x515d4d-0x0;var _0x2b64d7=_0xef66[_0x515d4d];return _0x2b64d7;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ef6('0x5'));var logger=require(_0x6ef6('0x6'))(_0x6ef6('0x7'));var config=require(_0x6ef6('0x8'));var jayson=require(_0x6ef6('0x9'));var client=jayson[_0x6ef6('0xa')][_0x6ef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1830aa,_0x3755b5,_0x4f06b9){return new BPromise(function(_0x5a7c74,_0xc0d555){return client[_0x6ef6('0xc')](_0x1830aa,_0x4f06b9)[_0x6ef6('0xd')](function(_0x391e0e){logger[_0x6ef6('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'),JSON['stringify'](_0x391e0e));if(_0x391e0e[_0x6ef6('0x10')]){if(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x11')]===0x1f4){logger[_0x6ef6('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x3755b5,_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0xc0d555(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);}logger['error'](_0x6ef6('0x13'),_0x3755b5,_0x391e0e['error'][_0x6ef6('0x12')]);return _0x5a7c74(_0x391e0e[_0x6ef6('0x10')]['message']);}else{logger[_0x6ef6('0xe')](_0x6ef6('0x13'),_0x3755b5,_0x6ef6('0xf'));_0x5a7c74(_0x391e0e[_0x6ef6('0x14')][_0x6ef6('0x12')]);}})[_0x6ef6('0x15')](function(_0x4ea222){logger[_0x6ef6('0x10')](_0x6ef6('0x13'),_0x3755b5,_0x4ea222);_0xc0d555(_0x4ea222);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2872b96..84237ff 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 _0x43f4=['../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','delete','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x8cb419,_0x307ca8){var _0x18b31e=function(_0x2af47d){while(--_0x2af47d){_0x8cb419['push'](_0x8cb419['shift']());}};_0x18b31e(++_0x307ca8);}(_0x43f4,0x119));var _0x443f=function(_0x561983,_0x52f9ec){_0x561983=_0x561983-0x0;var _0xe10517=_0x43f4[_0x561983];return _0xe10517;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x443f('0x0'));var timeout=require(_0x443f('0x1'));var express=require('express');var router=express[_0x443f('0x2')]();var auth=require(_0x443f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x443f('0x4'));var controller=require('./intFreshdeskAccount.controller');router[_0x443f('0x5')]('/',auth['isAuthenticated'](),controller[_0x443f('0x6')]);router[_0x443f('0x5')](_0x443f('0x7'),auth[_0x443f('0x8')](),controller[_0x443f('0x9')]);router[_0x443f('0x5')]('/:id/configurations',auth[_0x443f('0x8')](),controller['getConfigurations']);router[_0x443f('0x5')](_0x443f('0xa'),auth['isAuthenticated'](),controller[_0x443f('0xb')]);router['post']('/',auth[_0x443f('0x8')](),controller[_0x443f('0xc')]);router[_0x443f('0xd')](_0x443f('0xe'),auth[_0x443f('0x8')](),controller[_0x443f('0xf')]);router[_0x443f('0x10')](_0x443f('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x443f('0x11')](_0x443f('0x7'),auth[_0x443f('0x8')](),controller['destroy']);module[_0x443f('0x12')]=router; \ No newline at end of file +var _0xd590=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xd590,0x1b3));var _0x0d59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd590[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0d59('0x0'));var util=require(_0x0d59('0x1'));var path=require(_0x0d59('0x2'));var timeout=require(_0x0d59('0x3'));var express=require(_0x0d59('0x4'));var router=express[_0x0d59('0x5')]();var auth=require(_0x0d59('0x6'));var interaction=require(_0x0d59('0x7'));var config=require(_0x0d59('0x8'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0x0d59('0x9')](),controller[_0x0d59('0xa')]);router[_0x0d59('0xb')](_0x0d59('0xc'),auth[_0x0d59('0x9')](),controller[_0x0d59('0xd')]);router[_0x0d59('0xb')](_0x0d59('0xe'),auth['isAuthenticated'](),controller[_0x0d59('0xf')]);router[_0x0d59('0xb')]('/:id/fields',auth[_0x0d59('0x9')](),controller[_0x0d59('0x10')]);router[_0x0d59('0x11')]('/',auth[_0x0d59('0x9')](),controller['create']);router[_0x0d59('0x11')](_0x0d59('0xe'),auth[_0x0d59('0x9')](),controller[_0x0d59('0x12')]);router[_0x0d59('0x13')](_0x0d59('0xc'),auth['isAuthenticated'](),controller[_0x0d59('0x14')]);router['delete'](_0x0d59('0xc'),auth[_0x0d59('0x9')](),controller[_0x0d59('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 365fdfe..cd17165 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 _0x57ca=['exports','STRING','username','remoteUri'];(function(_0x1b9358,_0x31f348){var _0x208219=function(_0x41fe7d){while(--_0x41fe7d){_0x1b9358['push'](_0x1b9358['shift']());}};_0x208219(++_0x31f348);}(_0x57ca,0x108));var _0xa57c=function(_0x5e5853,_0x5b5eb7){_0x5e5853=_0x5e5853-0x0;var _0x1421b0=_0x57ca[_0x5e5853];return _0x1421b0;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'name':{'type':Sequelize[_0xa57c('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x2')},'apiKey':{'type':Sequelize[_0xa57c('0x1')]},'remoteUri':{'type':Sequelize[_0xa57c('0x1')],'unique':_0xa57c('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf846=['STRING','username','remoteUri','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf846,0x85));var _0x6f84=function(_0x3f49b9,_0x5cf497){_0x3f49b9=_0x3f49b9-0x0;var _0x4a0f1d=_0xf846[_0x3f49b9];return _0x4a0f1d;};'use strict';var Sequelize=require(_0x6f84('0x0'));module[_0x6f84('0x1')]={'name':{'type':Sequelize[_0x6f84('0x2')]},'description':{'type':Sequelize[_0x6f84('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6f84('0x3')},'apiKey':{'type':Sequelize[_0x6f84('0x2')]},'remoteUri':{'type':Sequelize[_0x6f84('0x2')],'unique':_0x6f84('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d6857c1..1859282 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 _0x4b55=['body','getConfigurations','findOne','FreshdeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','subject','agent','description','group','source','includes','default','label','choices','capitalize','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create'];(function(_0x16ee2b,_0x3ecf1b){var _0x260c85=function(_0x474dfd){while(--_0x474dfd){_0x16ee2b['push'](_0x16ee2b['shift']());}};_0x260c85(++_0x3ecf1b);}(_0x4b55,0x127));var _0x54b5=function(_0x368992,_0x6a87e2){_0x368992=_0x368992-0x0;var _0x208c6e=_0x4b55[_0x368992];return _0x208c6e;};'use strict';var pdf=require(_0x54b5('0x0'));var emlformat=require(_0x54b5('0x1'));var rimraf=require(_0x54b5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x54b5('0x3'));var moment=require(_0x54b5('0x4'));var BPromise=require(_0x54b5('0x5'));var Mustache=require(_0x54b5('0x6'));var util=require(_0x54b5('0x7'));var path=require('path');var sox=require(_0x54b5('0x8'));var csv=require(_0x54b5('0x9'));var ejs=require(_0x54b5('0xa'));var fs=require('fs');var _=require(_0x54b5('0xb'));var squel=require(_0x54b5('0xc'));var crypto=require(_0x54b5('0xd'));var jsforce=require(_0x54b5('0xe'));var deskjs=require(_0x54b5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x54b5('0x10'));var Papa=require(_0x54b5('0x11'));var Redis=require(_0x54b5('0x12'));var authService=require(_0x54b5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x54b5('0x14'));var hardwareService=require(_0x54b5('0x15'));var logger=require('../../config/logger')(_0x54b5('0x16'));var utils=require(_0x54b5('0x17'));var config=require(_0x54b5('0x18'));var licenseUtil=require(_0x54b5('0x19'));var db=require(_0x54b5('0x1a'))['db'];var integrations=require(_0x54b5('0x1b'));var jayson=require(_0x54b5('0x1c'));var client=jayson[_0x54b5('0x1d')][_0x54b5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xf4c43e,_0x2d7265,_0x2e81b7,_0x372127){return new BPromise(function(_0x593ed4,_0x33e97a){var _0x5e8c87=_0x372127||client;return _0x5e8c87[_0x54b5('0x1f')](_0xf4c43e,_0x2e81b7)[_0x54b5('0x20')](function(_0x1c9dff){logger[_0x54b5('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x2d7265,'request\x20sent');logger[_0x54b5('0x22')](_0x54b5('0x23'),_0x2d7265,_0x54b5('0x24'),JSON[_0x54b5('0x25')](_0x1c9dff));if(_0x1c9dff['error']){if(_0x1c9dff['error']['code']===0x1f4){logger[_0x54b5('0x26')](_0x54b5('0x27'),_0x2d7265,_0x1c9dff[_0x54b5('0x26')][_0x54b5('0x28')]);return _0x33e97a(_0x1c9dff[_0x54b5('0x26')][_0x54b5('0x28')]);}logger['error'](_0x54b5('0x27'),_0x2d7265,_0x1c9dff[_0x54b5('0x26')][_0x54b5('0x28')]);return _0x593ed4(_0x1c9dff['error'][_0x54b5('0x28')]);}else{logger[_0x54b5('0x21')](_0x54b5('0x27'),_0x2d7265,_0x54b5('0x24'));_0x593ed4(_0x1c9dff[_0x54b5('0x29')][_0x54b5('0x28')]);}})[_0x54b5('0x2a')](function(_0x153242){logger['error'](_0x54b5('0x27'),_0x2d7265,_0x153242);_0x33e97a(_0x153242);});});}function respondWithStatusCode(_0x5c3511,_0x501b7a){_0x501b7a=_0x501b7a||0xcc;return function(_0x11d09f){if(_0x11d09f){return _0x5c3511[_0x54b5('0x2b')](_0x501b7a);}return _0x5c3511[_0x54b5('0x2c')](_0x501b7a)['end']();};}function respondWithResult(_0x1e90fd,_0x382231){_0x382231=_0x382231||0xc8;return function(_0x103115){if(_0x103115){return _0x1e90fd['status'](_0x382231)[_0x54b5('0x2d')](_0x103115);}};}function respondWithFilteredResult(_0x4c29b9,_0x528df0){return function(_0x1057a4){if(_0x1057a4){var _0x47b626=_0x1057a4[_0x54b5('0x2e')],_0x4dff25=_0x528df0[_0x54b5('0x2f')],_0x509ea7=_0x528df0[_0x54b5('0x2f')]+_0x528df0[_0x54b5('0x30')],_0x312f52;if(_0x509ea7>=_0x47b626){_0x509ea7=_0x47b626;_0x312f52=0xc8;}else{_0x312f52=0xce;}_0x4c29b9[_0x54b5('0x2c')](_0x312f52);return _0x4c29b9['set'](_0x54b5('0x31'),_0x4dff25+'-'+_0x509ea7+'/'+_0x47b626)[_0x54b5('0x2d')](_0x1057a4);}return null;};}function patchUpdates(_0x304add){return function(_0x77b150){try{jsonpatch[_0x54b5('0x32')](_0x77b150,_0x304add,!![]);}catch(_0x1d92b1){return BPromise[_0x54b5('0x33')](_0x1d92b1);}return _0x77b150[_0x54b5('0x34')]();};}function saveUpdates(_0x2e4437,_0x104941){return function(_0x5677c2){if(_0x5677c2){return _0x5677c2[_0x54b5('0x35')](_0x2e4437)[_0x54b5('0x20')](function(_0x3be556){return _0x3be556;});}return null;};}function removeEntity(_0x36b118,_0x5d61fa){return function(_0x2b21c7){if(_0x2b21c7){return _0x2b21c7[_0x54b5('0x36')]()[_0x54b5('0x20')](function(){_0x36b118[_0x54b5('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e98e,_0x45f272){return function(_0x55807a){if(!_0x55807a){_0x59e98e[_0x54b5('0x2b')](0x194);}return _0x55807a;};}function handleError(_0x19b7cd,_0x36b547){_0x36b547=_0x36b547||0x1f4;return function(_0x4fc328){logger['error'](_0x4fc328[_0x54b5('0x37')]);if(_0x4fc328['name']){delete _0x4fc328[_0x54b5('0x38')];}_0x19b7cd[_0x54b5('0x2c')](_0x36b547)[_0x54b5('0x39')](_0x4fc328);};}exports[_0x54b5('0x3a')]=function(_0x3689bd,_0x5b90eb){var _0x458d4c={},_0x1b5ce2={},_0x21ee7c={'count':0x0,'rows':[]};var _0x211ab1=_[_0x54b5('0x3b')](db[_0x54b5('0x3c')]['rawAttributes'],function(_0x34b667){return{'name':_0x34b667[_0x54b5('0x3d')],'type':_0x34b667[_0x54b5('0x3e')][_0x54b5('0x3f')]};});_0x1b5ce2[_0x54b5('0x40')]=_[_0x54b5('0x3b')](_0x211ab1,'name');_0x1b5ce2[_0x54b5('0x41')]=_['keys'](_0x3689bd[_0x54b5('0x41')]);_0x1b5ce2['filters']=_['intersection'](_0x1b5ce2[_0x54b5('0x40')],_0x1b5ce2[_0x54b5('0x41')]);_0x458d4c[_0x54b5('0x42')]=_[_0x54b5('0x43')](_0x1b5ce2['model'],qs[_0x54b5('0x44')](_0x3689bd[_0x54b5('0x41')][_0x54b5('0x44')]));_0x458d4c[_0x54b5('0x42')]=_0x458d4c[_0x54b5('0x42')][_0x54b5('0x45')]?_0x458d4c['attributes']:_0x1b5ce2['model'];if(!_0x3689bd[_0x54b5('0x41')]['hasOwnProperty'](_0x54b5('0x46'))){_0x458d4c[_0x54b5('0x30')]=qs['limit'](_0x3689bd[_0x54b5('0x41')][_0x54b5('0x30')]);_0x458d4c[_0x54b5('0x2f')]=qs['offset'](_0x3689bd[_0x54b5('0x41')][_0x54b5('0x2f')]);}_0x458d4c['order']=qs['sort'](_0x3689bd[_0x54b5('0x41')][_0x54b5('0x47')]);_0x458d4c[_0x54b5('0x48')]=qs['filters'](_[_0x54b5('0x49')](_0x3689bd[_0x54b5('0x41')],_0x1b5ce2[_0x54b5('0x4a')]),_0x211ab1);if(_0x3689bd[_0x54b5('0x41')][_0x54b5('0x4b')]){_0x458d4c[_0x54b5('0x48')]=_[_0x54b5('0x4c')](_0x458d4c[_0x54b5('0x48')],{'$or':_[_0x54b5('0x3b')](_0x211ab1,function(_0x3e0923){if(_0x3e0923[_0x54b5('0x3e')]!==_0x54b5('0x4d')){var _0x39565a={};_0x39565a[_0x3e0923[_0x54b5('0x38')]]={'$like':'%'+_0x3689bd[_0x54b5('0x41')]['filter']+'%'};return _0x39565a;}})});}_0x458d4c=_['merge']({},_0x458d4c,_0x3689bd[_0x54b5('0x4e')]);var _0xf1397e={'where':_0x458d4c['where']};return db[_0x54b5('0x3c')][_0x54b5('0x2e')](_0xf1397e)['then'](function(_0x44b82b){_0x21ee7c['count']=_0x44b82b;if(_0x3689bd[_0x54b5('0x41')][_0x54b5('0x4f')]){_0x458d4c[_0x54b5('0x50')]=[{'all':!![]}];}return db[_0x54b5('0x3c')][_0x54b5('0x51')](_0x458d4c);})[_0x54b5('0x20')](function(_0x369087){_0x21ee7c[_0x54b5('0x52')]=_0x369087;return _0x21ee7c;})['then'](respondWithFilteredResult(_0x5b90eb,_0x458d4c))[_0x54b5('0x2a')](handleError(_0x5b90eb,null));};exports[_0x54b5('0x53')]=function(_0x22ef16,_0x8a8bfb){var _0x57602f={'raw':![],'where':{'id':_0x22ef16[_0x54b5('0x54')]['id']}},_0x8b1940={};_0x8b1940[_0x54b5('0x40')]=_[_0x54b5('0x55')](db[_0x54b5('0x3c')][_0x54b5('0x56')]);_0x8b1940[_0x54b5('0x41')]=_[_0x54b5('0x55')](_0x22ef16[_0x54b5('0x41')]);_0x8b1940[_0x54b5('0x4a')]=_[_0x54b5('0x43')](_0x8b1940[_0x54b5('0x40')],_0x8b1940[_0x54b5('0x41')]);_0x57602f['attributes']=_[_0x54b5('0x43')](_0x8b1940[_0x54b5('0x40')],qs[_0x54b5('0x44')](_0x22ef16['query'][_0x54b5('0x44')]));_0x57602f['attributes']=_0x57602f[_0x54b5('0x42')]['length']?_0x57602f[_0x54b5('0x42')]:_0x8b1940[_0x54b5('0x40')];if(_0x22ef16[_0x54b5('0x41')]['includeAll']){_0x57602f['include']=[{'all':!![]}];}_0x57602f=_[_0x54b5('0x4c')]({},_0x57602f,_0x22ef16[_0x54b5('0x4e')]);return db[_0x54b5('0x3c')][_0x54b5('0x57')](_0x57602f)[_0x54b5('0x20')](handleEntityNotFound(_0x8a8bfb,null))[_0x54b5('0x20')](respondWithResult(_0x8a8bfb,null))['catch'](handleError(_0x8a8bfb,null));};exports[_0x54b5('0x58')]=function(_0x3ff31c,_0x1ce97f){return db['FreshdeskAccount']['create'](_0x3ff31c[_0x54b5('0x59')],{})[_0x54b5('0x20')](respondWithResult(_0x1ce97f,0xc9))['catch'](handleError(_0x1ce97f,null));};exports[_0x54b5('0x35')]=function(_0x2a3db9,_0x437d5c){if(_0x2a3db9['body']['id']){delete _0x2a3db9[_0x54b5('0x59')]['id'];}return db[_0x54b5('0x3c')][_0x54b5('0x57')]({'where':{'id':_0x2a3db9[_0x54b5('0x54')]['id']}})[_0x54b5('0x20')](handleEntityNotFound(_0x437d5c,null))[_0x54b5('0x20')](saveUpdates(_0x2a3db9[_0x54b5('0x59')],null))['then'](respondWithResult(_0x437d5c,null))[_0x54b5('0x2a')](handleError(_0x437d5c,null));};exports[_0x54b5('0x36')]=function(_0x1564d7,_0x407b78){return db[_0x54b5('0x3c')][_0x54b5('0x57')]({'where':{'id':_0x1564d7[_0x54b5('0x54')]['id']}})[_0x54b5('0x20')](handleEntityNotFound(_0x407b78,null))[_0x54b5('0x20')](removeEntity(_0x407b78,null))[_0x54b5('0x2a')](handleError(_0x407b78,null));};exports[_0x54b5('0x5a')]=function(_0x6107b4,_0x225531,_0x368ead){var _0x14850b={};var _0x301016={};var _0x216610;var _0x1c5090;return db[_0x54b5('0x3c')][_0x54b5('0x5b')]({'where':{'id':_0x6107b4['params']['id']}})['then'](handleEntityNotFound(_0x225531,null))['then'](function(_0x2aa8c0){if(_0x2aa8c0){_0x216610=_0x2aa8c0;_0x301016['model']=_[_0x54b5('0x55')](db[_0x54b5('0x5c')][_0x54b5('0x56')]);_0x301016[_0x54b5('0x41')]=_[_0x54b5('0x55')](_0x6107b4['query']);_0x301016['filters']=_[_0x54b5('0x43')](_0x301016[_0x54b5('0x40')],_0x301016[_0x54b5('0x41')]);_0x14850b['attributes']=_['intersection'](_0x301016[_0x54b5('0x40')],qs[_0x54b5('0x44')](_0x6107b4[_0x54b5('0x41')][_0x54b5('0x44')]));_0x14850b[_0x54b5('0x42')]=_0x14850b[_0x54b5('0x42')]['length']?_0x14850b[_0x54b5('0x42')]:_0x301016[_0x54b5('0x40')];_0x14850b[_0x54b5('0x5d')]=qs[_0x54b5('0x47')](_0x6107b4[_0x54b5('0x41')][_0x54b5('0x47')]);_0x14850b[_0x54b5('0x48')]=qs[_0x54b5('0x4a')](_[_0x54b5('0x49')](_0x6107b4[_0x54b5('0x41')],_0x301016[_0x54b5('0x4a')]));if(_0x6107b4['query'][_0x54b5('0x4b')]){_0x14850b[_0x54b5('0x48')]=_[_0x54b5('0x4c')](_0x14850b['where'],{'$or':_[_0x54b5('0x3b')](_0x14850b[_0x54b5('0x42')],function(_0x528bc7){var _0xe0d89c={};_0xe0d89c[_0x528bc7]={'$like':'%'+_0x6107b4[_0x54b5('0x41')]['filter']+'%'};return _0xe0d89c;})});}_0x14850b=_['merge']({},_0x14850b,_0x6107b4[_0x54b5('0x4e')]);return _0x216610['getConfigurations'](_0x14850b);}})[_0x54b5('0x20')](function(_0x2206c3){if(_0x2206c3){_0x1c5090=_0x2206c3[_0x54b5('0x45')];if(!_0x6107b4['query'][_0x54b5('0x5e')]('nolimit')){_0x14850b[_0x54b5('0x30')]=qs[_0x54b5('0x30')](_0x6107b4['query'][_0x54b5('0x30')]);_0x14850b[_0x54b5('0x2f')]=qs[_0x54b5('0x2f')](_0x6107b4[_0x54b5('0x41')]['offset']);}return _0x216610[_0x54b5('0x5a')](_0x14850b);}})[_0x54b5('0x20')](function(_0x5b7238){if(_0x5b7238){return _0x5b7238?{'count':_0x1c5090,'rows':_0x5b7238}:null;}})['then'](respondWithResult(_0x225531,null))[_0x54b5('0x2a')](handleError(_0x225531,null));};exports[_0x54b5('0x5f')]=function(_0x39690c,_0x15424b,_0x54dfd4){if(_0x39690c[_0x54b5('0x59')]['id']){delete _0x39690c[_0x54b5('0x59')]['id'];}return db[_0x54b5('0x3c')]['findOne']({'where':{'id':_0x39690c[_0x54b5('0x54')]['id']}})['then'](handleEntityNotFound(_0x15424b,null))[_0x54b5('0x20')](function(_0x194caf){if(_0x194caf){_0x39690c[_0x54b5('0x59')][_0x54b5('0x60')]=_0x194caf['id'];_0x39690c[_0x54b5('0x59')][_0x54b5('0x61')]=integrations[_0x54b5('0x62')](_0x39690c[_0x54b5('0x59')]['channel'],_0x39690c[_0x54b5('0x59')]['type']);_0x39690c[_0x54b5('0x59')][_0x54b5('0x63')]=integrations['getDescriptions'](_0x39690c['body'][_0x54b5('0x64')],_0x39690c[_0x54b5('0x59')][_0x54b5('0x3e')]);return db[_0x54b5('0x5c')][_0x54b5('0x58')](_0x39690c[_0x54b5('0x59')],{'include':[{'model':db['FreshdeskField'],'as':_0x54b5('0x61')},{'model':db[_0x54b5('0x65')],'as':'Descriptions'}]});}return null;})[_0x54b5('0x20')](respondWithResult(_0x15424b,null))[_0x54b5('0x2a')](handleError(_0x15424b,null));};exports[_0x54b5('0x66')]=function(_0x3bef27,_0x229d89,_0x1f873a){var _0x1e9b04='';return db[_0x54b5('0x3c')][_0x54b5('0x5b')]({'where':{'id':_0x3bef27[_0x54b5('0x54')]['id']},'attributes':['id',_0x54b5('0x67'),_0x54b5('0x68')]})[_0x54b5('0x20')](handleEntityNotFound(_0x229d89,null))['then'](function(_0x4bc05d){if(_0x4bc05d){_0x1e9b04=_0x4bc05d[_0x54b5('0x67')];var _0x4e62d7=_0x1e9b04[_0x54b5('0x69')](-0x1);if(_0x4e62d7==='/'){_0x1e9b04=_0x1e9b04[_0x54b5('0x6a')](0x0,_0x1e9b04['lastIndexOf'](_0x4e62d7));}return rp({'method':_0x54b5('0x6b'),'uri':util['format'](_0x54b5('0x6c'),_0x1e9b04,_0x54b5('0x6d')),'headers':{'Authorization':util[_0x54b5('0x6e')](_0x54b5('0x6f'),new Buffer(util[_0x54b5('0x6e')](_0x54b5('0x70'),_0x4bc05d[_0x54b5('0x68')]))[_0x54b5('0x71')]('base64'))},'json':!![]});}})[_0x54b5('0x20')](function(_0x3256e9){if(_0x3256e9){var _0x3df282=[_0x54b5('0x72'),_0x54b5('0x73'),_0x54b5('0x74'),_0x54b5('0x75'),_0x54b5('0x2c'),'priority',_0x54b5('0x76'),_0x54b5('0x77'),'ticket_type',_0x54b5('0x76'),'company'];_['remove'](_0x3256e9,function(_0x26a637){return _0x3df282[_0x54b5('0x78')](_0x26a637[_0x54b5('0x38')])||!_0x26a637[_0x54b5('0x79')]&&_0x26a637['type']!=='custom_text'&&_0x26a637[_0x54b5('0x3e')]!=='custom_dropdown';});return{'count':_0x3256e9['length'],'rows':_['map'](_0x3256e9,function(_0x4aadd7){return{'id':_0x4aadd7[_0x54b5('0x38')],'name':_0x4aadd7[_0x54b5('0x7a')],'custom':!_0x4aadd7[_0x54b5('0x79')],'options':_0x4aadd7['choices']?_[_0x54b5('0x3b')](_0x4aadd7[_0x54b5('0x7b')],function(_0xcfc87f){return{'name':_[_0x54b5('0x7c')](_0xcfc87f),'value':_0xcfc87f};}):[]};})};}})[_0x54b5('0x20')](respondWithResult(_0x229d89,null))[_0x54b5('0x2a')](function(_0x403842){var _0x49f1f6=_0x3bef27['query'][_0x54b5('0x7d')]?0x1f4:_0x403842[_0x54b5('0x7e')]||0x1f4;logger[_0x54b5('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x54b5('0x66'),_0x49f1f6,JSON[_0x54b5('0x25')](_0x403842));delete _0x403842[_0x54b5('0x38')];if(_0x49f1f6===0x191){_0x49f1f6=0x190;}_0x229d89['status'](_0x49f1f6)[_0x54b5('0x39')](_0x3bef27['query'][_0x54b5('0x7d')]?{'message':_0x54b5('0x7f'),'statusCode':_0x403842[_0x54b5('0x7e')]}:_0x403842);});}; \ No newline at end of file +var _0x6744=['sort','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','create','body','params','findOne','FreshdeskConfiguration','rawAttributes','getConfigurations','addConfiguration','AccountId','Subjects','getDescriptions','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','stack','name','index','map','FreshdeskAccount','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x6744,0x1be));var _0x4674=function(_0x25c985,_0x1fd521){_0x25c985=_0x25c985-0x0;var _0x91e97b=_0x6744[_0x25c985];return _0x91e97b;};'use strict';var pdf=require(_0x4674('0x0'));var emlformat=require(_0x4674('0x1'));var rimraf=require(_0x4674('0x2'));var zipdir=require(_0x4674('0x3'));var jsonpatch=require(_0x4674('0x4'));var rp=require(_0x4674('0x5'));var moment=require(_0x4674('0x6'));var BPromise=require(_0x4674('0x7'));var Mustache=require(_0x4674('0x8'));var util=require('util');var path=require(_0x4674('0x9'));var sox=require(_0x4674('0xa'));var csv=require(_0x4674('0xb'));var ejs=require(_0x4674('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4674('0xd'));var deskjs=require(_0x4674('0xe'));var toCsv=require(_0x4674('0xb'));var querystring=require(_0x4674('0xf'));var Papa=require(_0x4674('0x10'));var Redis=require(_0x4674('0x11'));var authService=require(_0x4674('0x12'));var qs=require(_0x4674('0x13'));var as=require(_0x4674('0x14'));var hardwareService=require(_0x4674('0x15'));var logger=require(_0x4674('0x16'))(_0x4674('0x17'));var utils=require(_0x4674('0x18'));var config=require(_0x4674('0x19'));var licenseUtil=require(_0x4674('0x1a'));var db=require(_0x4674('0x1b'))['db'];var integrations=require(_0x4674('0x1c'));var jayson=require(_0x4674('0x1d'));var client=jayson[_0x4674('0x1e')][_0x4674('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x59d098,_0x41805c,_0x54b78d,_0x540267){return new BPromise(function(_0xc8366e,_0x13d20c){var _0x2f2b91=_0x540267||client;return _0x2f2b91[_0x4674('0x20')](_0x59d098,_0x54b78d)['then'](function(_0xd1ab7){logger[_0x4674('0x21')](_0x4674('0x22'),_0x41805c,_0x4674('0x23'));logger[_0x4674('0x24')](_0x4674('0x25'),_0x41805c,'request\x20sent',JSON[_0x4674('0x26')](_0xd1ab7));if(_0xd1ab7[_0x4674('0x27')]){if(_0xd1ab7[_0x4674('0x27')]['code']===0x1f4){logger['error'](_0x4674('0x22'),_0x41805c,_0xd1ab7[_0x4674('0x27')][_0x4674('0x28')]);return _0x13d20c(_0xd1ab7[_0x4674('0x27')][_0x4674('0x28')]);}logger[_0x4674('0x27')](_0x4674('0x22'),_0x41805c,_0xd1ab7[_0x4674('0x27')][_0x4674('0x28')]);return _0xc8366e(_0xd1ab7[_0x4674('0x27')]['message']);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x41805c,_0x4674('0x23'));_0xc8366e(_0xd1ab7[_0x4674('0x29')][_0x4674('0x28')]);}})[_0x4674('0x2a')](function(_0x12d4a4){logger[_0x4674('0x27')](_0x4674('0x22'),_0x41805c,_0x12d4a4);_0x13d20c(_0x12d4a4);});});}function respondWithStatusCode(_0x39809f,_0x34cd52){_0x34cd52=_0x34cd52||0xcc;return function(_0x169f59){if(_0x169f59){return _0x39809f[_0x4674('0x2b')](_0x34cd52);}return _0x39809f[_0x4674('0x2c')](_0x34cd52)[_0x4674('0x2d')]();};}function respondWithResult(_0x48829b,_0x343066){_0x343066=_0x343066||0xc8;return function(_0x5e91c2){if(_0x5e91c2){return _0x48829b['status'](_0x343066)[_0x4674('0x2e')](_0x5e91c2);}};}function respondWithFilteredResult(_0x23959e,_0x42767c){return function(_0x504062){if(_0x504062){var _0x2f6d07=_0x504062[_0x4674('0x2f')],_0x3997b5=_0x42767c[_0x4674('0x30')],_0x4208e5=_0x42767c[_0x4674('0x30')]+_0x42767c[_0x4674('0x31')],_0x254b40;if(_0x4208e5>=_0x2f6d07){_0x4208e5=_0x2f6d07;_0x254b40=0xc8;}else{_0x254b40=0xce;}_0x23959e[_0x4674('0x2c')](_0x254b40);return _0x23959e[_0x4674('0x32')]('Content-Range',_0x3997b5+'-'+_0x4208e5+'/'+_0x2f6d07)[_0x4674('0x2e')](_0x504062);}return null;};}function patchUpdates(_0xba468d){return function(_0x58d719){try{jsonpatch[_0x4674('0x33')](_0x58d719,_0xba468d,!![]);}catch(_0x2a7123){return BPromise['reject'](_0x2a7123);}return _0x58d719[_0x4674('0x34')]();};}function saveUpdates(_0x67a627,_0x1be912){return function(_0x1afd55){if(_0x1afd55){return _0x1afd55[_0x4674('0x35')](_0x67a627)[_0x4674('0x36')](function(_0x1186aa){return _0x1186aa;});}return null;};}function removeEntity(_0x221249,_0x28b4d3){return function(_0x27f1e3){if(_0x27f1e3){return _0x27f1e3[_0x4674('0x37')]()[_0x4674('0x36')](function(){_0x221249[_0x4674('0x2c')](0xcc)[_0x4674('0x2d')]();});}};}function handleEntityNotFound(_0x597bc6,_0x3d5aff){return function(_0x4b1f0f){if(!_0x4b1f0f){_0x597bc6['sendStatus'](0x194);}return _0x4b1f0f;};}function handleError(_0x229291,_0x4ecfa4){_0x4ecfa4=_0x4ecfa4||0x1f4;return function(_0x3a5d8b){logger['error'](_0x3a5d8b[_0x4674('0x38')]);if(_0x3a5d8b[_0x4674('0x39')]){delete _0x3a5d8b[_0x4674('0x39')];}_0x229291[_0x4674('0x2c')](_0x4ecfa4)['send'](_0x3a5d8b);};}exports[_0x4674('0x3a')]=function(_0x3e3f04,_0x47e20e){var _0x156e76={},_0x5a35ae={},_0xd7f158={'count':0x0,'rows':[]};var _0x28993d=_[_0x4674('0x3b')](db[_0x4674('0x3c')]['rawAttributes'],function(_0x3ae84f){return{'name':_0x3ae84f['fieldName'],'type':_0x3ae84f[_0x4674('0x3d')][_0x4674('0x3e')]};});_0x5a35ae[_0x4674('0x3f')]=_[_0x4674('0x3b')](_0x28993d,_0x4674('0x39'));_0x5a35ae['query']=_[_0x4674('0x40')](_0x3e3f04[_0x4674('0x41')]);_0x5a35ae[_0x4674('0x42')]=_[_0x4674('0x43')](_0x5a35ae[_0x4674('0x3f')],_0x5a35ae[_0x4674('0x41')]);_0x156e76['attributes']=_[_0x4674('0x43')](_0x5a35ae['model'],qs['fields'](_0x3e3f04[_0x4674('0x41')][_0x4674('0x44')]));_0x156e76[_0x4674('0x45')]=_0x156e76[_0x4674('0x45')][_0x4674('0x46')]?_0x156e76[_0x4674('0x45')]:_0x5a35ae[_0x4674('0x3f')];if(!_0x3e3f04[_0x4674('0x41')][_0x4674('0x47')](_0x4674('0x48'))){_0x156e76['limit']=qs[_0x4674('0x31')](_0x3e3f04[_0x4674('0x41')][_0x4674('0x31')]);_0x156e76[_0x4674('0x30')]=qs[_0x4674('0x30')](_0x3e3f04[_0x4674('0x41')][_0x4674('0x30')]);}_0x156e76[_0x4674('0x49')]=qs[_0x4674('0x4a')](_0x3e3f04[_0x4674('0x41')][_0x4674('0x4a')]);_0x156e76['where']=qs['filters'](_['pick'](_0x3e3f04['query'],_0x5a35ae['filters']),_0x28993d);if(_0x3e3f04[_0x4674('0x41')]['filter']){_0x156e76['where']=_[_0x4674('0x4b')](_0x156e76[_0x4674('0x4c')],{'$or':_[_0x4674('0x3b')](_0x28993d,function(_0x2260c5){if(_0x2260c5[_0x4674('0x3d')]!==_0x4674('0x4d')){var _0x11c2b0={};_0x11c2b0[_0x2260c5[_0x4674('0x39')]]={'$like':'%'+_0x3e3f04['query'][_0x4674('0x4e')]+'%'};return _0x11c2b0;}})});}_0x156e76=_[_0x4674('0x4b')]({},_0x156e76,_0x3e3f04[_0x4674('0x4f')]);var _0x517141={'where':_0x156e76[_0x4674('0x4c')]};return db['FreshdeskAccount'][_0x4674('0x2f')](_0x517141)[_0x4674('0x36')](function(_0x325302){_0xd7f158[_0x4674('0x2f')]=_0x325302;if(_0x3e3f04[_0x4674('0x41')][_0x4674('0x50')]){_0x156e76[_0x4674('0x51')]=[{'all':!![]}];}return db[_0x4674('0x3c')][_0x4674('0x52')](_0x156e76);})[_0x4674('0x36')](function(_0x227ec3){_0xd7f158[_0x4674('0x53')]=_0x227ec3;return _0xd7f158;})['then'](respondWithFilteredResult(_0x47e20e,_0x156e76))[_0x4674('0x2a')](handleError(_0x47e20e,null));};exports[_0x4674('0x54')]=function(_0xe084d6,_0x2733f7){var _0x4802b4={'raw':![],'where':{'id':_0xe084d6['params']['id']}},_0x3c6323={};_0x3c6323[_0x4674('0x3f')]=_['keys'](db[_0x4674('0x3c')]['rawAttributes']);_0x3c6323[_0x4674('0x41')]=_[_0x4674('0x40')](_0xe084d6[_0x4674('0x41')]);_0x3c6323[_0x4674('0x42')]=_[_0x4674('0x43')](_0x3c6323['model'],_0x3c6323[_0x4674('0x41')]);_0x4802b4['attributes']=_[_0x4674('0x43')](_0x3c6323['model'],qs[_0x4674('0x44')](_0xe084d6[_0x4674('0x41')][_0x4674('0x44')]));_0x4802b4[_0x4674('0x45')]=_0x4802b4[_0x4674('0x45')][_0x4674('0x46')]?_0x4802b4[_0x4674('0x45')]:_0x3c6323['model'];if(_0xe084d6['query'][_0x4674('0x50')]){_0x4802b4[_0x4674('0x51')]=[{'all':!![]}];}_0x4802b4=_['merge']({},_0x4802b4,_0xe084d6[_0x4674('0x4f')]);return db[_0x4674('0x3c')][_0x4674('0x55')](_0x4802b4)['then'](handleEntityNotFound(_0x2733f7,null))[_0x4674('0x36')](respondWithResult(_0x2733f7,null))[_0x4674('0x2a')](handleError(_0x2733f7,null));};exports['create']=function(_0x341ce3,_0xac6f85){return db['FreshdeskAccount'][_0x4674('0x56')](_0x341ce3[_0x4674('0x57')],{})[_0x4674('0x36')](respondWithResult(_0xac6f85,0xc9))[_0x4674('0x2a')](handleError(_0xac6f85,null));};exports[_0x4674('0x35')]=function(_0x3760b7,_0x411e31){if(_0x3760b7[_0x4674('0x57')]['id']){delete _0x3760b7['body']['id'];}return db[_0x4674('0x3c')]['find']({'where':{'id':_0x3760b7[_0x4674('0x58')]['id']}})[_0x4674('0x36')](handleEntityNotFound(_0x411e31,null))[_0x4674('0x36')](saveUpdates(_0x3760b7[_0x4674('0x57')],null))[_0x4674('0x36')](respondWithResult(_0x411e31,null))[_0x4674('0x2a')](handleError(_0x411e31,null));};exports[_0x4674('0x37')]=function(_0x3ea4f2,_0x1482c2){return db['FreshdeskAccount'][_0x4674('0x55')]({'where':{'id':_0x3ea4f2[_0x4674('0x58')]['id']}})[_0x4674('0x36')](handleEntityNotFound(_0x1482c2,null))[_0x4674('0x36')](removeEntity(_0x1482c2,null))['catch'](handleError(_0x1482c2,null));};exports['getConfigurations']=function(_0x2a7cdc,_0x3541c2,_0x3b0431){var _0x6f92c1={};var _0x9a6c0d={};var _0x372854;var _0x29c986;return db[_0x4674('0x3c')][_0x4674('0x59')]({'where':{'id':_0x2a7cdc[_0x4674('0x58')]['id']}})['then'](handleEntityNotFound(_0x3541c2,null))[_0x4674('0x36')](function(_0x5b6af4){if(_0x5b6af4){_0x372854=_0x5b6af4;_0x9a6c0d[_0x4674('0x3f')]=_[_0x4674('0x40')](db[_0x4674('0x5a')][_0x4674('0x5b')]);_0x9a6c0d[_0x4674('0x41')]=_[_0x4674('0x40')](_0x2a7cdc['query']);_0x9a6c0d['filters']=_['intersection'](_0x9a6c0d[_0x4674('0x3f')],_0x9a6c0d[_0x4674('0x41')]);_0x6f92c1[_0x4674('0x45')]=_[_0x4674('0x43')](_0x9a6c0d[_0x4674('0x3f')],qs[_0x4674('0x44')](_0x2a7cdc[_0x4674('0x41')][_0x4674('0x44')]));_0x6f92c1['attributes']=_0x6f92c1['attributes']['length']?_0x6f92c1[_0x4674('0x45')]:_0x9a6c0d[_0x4674('0x3f')];_0x6f92c1[_0x4674('0x49')]=qs[_0x4674('0x4a')](_0x2a7cdc[_0x4674('0x41')]['sort']);_0x6f92c1[_0x4674('0x4c')]=qs['filters'](_['pick'](_0x2a7cdc['query'],_0x9a6c0d[_0x4674('0x42')]));if(_0x2a7cdc['query'][_0x4674('0x4e')]){_0x6f92c1['where']=_[_0x4674('0x4b')](_0x6f92c1['where'],{'$or':_[_0x4674('0x3b')](_0x6f92c1['attributes'],function(_0x53219d){var _0x2473d3={};_0x2473d3[_0x53219d]={'$like':'%'+_0x2a7cdc['query']['filter']+'%'};return _0x2473d3;})});}_0x6f92c1=_[_0x4674('0x4b')]({},_0x6f92c1,_0x2a7cdc['options']);return _0x372854[_0x4674('0x5c')](_0x6f92c1);}})[_0x4674('0x36')](function(_0x27d39e){if(_0x27d39e){_0x29c986=_0x27d39e['length'];if(!_0x2a7cdc[_0x4674('0x41')][_0x4674('0x47')](_0x4674('0x48'))){_0x6f92c1[_0x4674('0x31')]=qs[_0x4674('0x31')](_0x2a7cdc[_0x4674('0x41')][_0x4674('0x31')]);_0x6f92c1[_0x4674('0x30')]=qs[_0x4674('0x30')](_0x2a7cdc[_0x4674('0x41')][_0x4674('0x30')]);}return _0x372854[_0x4674('0x5c')](_0x6f92c1);}})[_0x4674('0x36')](function(_0x276ca5){if(_0x276ca5){return _0x276ca5?{'count':_0x29c986,'rows':_0x276ca5}:null;}})[_0x4674('0x36')](respondWithResult(_0x3541c2,null))[_0x4674('0x2a')](handleError(_0x3541c2,null));};exports[_0x4674('0x5d')]=function(_0x4d6b8b,_0x4f7443,_0xc9043a){if(_0x4d6b8b[_0x4674('0x57')]['id']){delete _0x4d6b8b[_0x4674('0x57')]['id'];}return db[_0x4674('0x3c')][_0x4674('0x59')]({'where':{'id':_0x4d6b8b[_0x4674('0x58')]['id']}})[_0x4674('0x36')](handleEntityNotFound(_0x4f7443,null))[_0x4674('0x36')](function(_0x4343a0){if(_0x4343a0){_0x4d6b8b[_0x4674('0x57')][_0x4674('0x5e')]=_0x4343a0['id'];_0x4d6b8b[_0x4674('0x57')][_0x4674('0x5f')]=integrations['getSubjects'](_0x4d6b8b[_0x4674('0x57')]['channel'],_0x4d6b8b[_0x4674('0x57')][_0x4674('0x3d')]);_0x4d6b8b['body']['Descriptions']=integrations[_0x4674('0x60')](_0x4d6b8b['body'][_0x4674('0x61')],_0x4d6b8b[_0x4674('0x57')][_0x4674('0x3d')]);return db[_0x4674('0x5a')][_0x4674('0x56')](_0x4d6b8b['body'],{'include':[{'model':db[_0x4674('0x62')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x4674('0x63')}]});}return null;})[_0x4674('0x36')](respondWithResult(_0x4f7443,null))[_0x4674('0x2a')](handleError(_0x4f7443,null));};exports[_0x4674('0x64')]=function(_0x28baef,_0x28b137,_0x5bb81b){var _0x2debb3='';return db['FreshdeskAccount'][_0x4674('0x59')]({'where':{'id':_0x28baef[_0x4674('0x58')]['id']},'attributes':['id',_0x4674('0x65'),_0x4674('0x66')]})['then'](handleEntityNotFound(_0x28b137,null))['then'](function(_0x2ac904){if(_0x2ac904){_0x2debb3=_0x2ac904[_0x4674('0x65')];var _0x44fe97=_0x2debb3[_0x4674('0x67')](-0x1);if(_0x44fe97==='/'){_0x2debb3=_0x2debb3[_0x4674('0x68')](0x0,_0x2debb3[_0x4674('0x69')](_0x44fe97));}return rp({'method':_0x4674('0x6a'),'uri':util['format']('%s/%s',_0x2debb3,_0x4674('0x6b')),'headers':{'Authorization':util[_0x4674('0x6c')](_0x4674('0x6d'),new Buffer(util[_0x4674('0x6c')]('%s:X',_0x2ac904[_0x4674('0x66')]))[_0x4674('0x6e')](_0x4674('0x6f')))},'json':!![]});}})[_0x4674('0x36')](function(_0x13bdf4){if(_0x13bdf4){var _0x3841e6=[_0x4674('0x70'),_0x4674('0x71'),'agent',_0x4674('0x72'),_0x4674('0x2c'),_0x4674('0x73'),_0x4674('0x74'),_0x4674('0x75'),_0x4674('0x76'),_0x4674('0x74'),_0x4674('0x77')];_[_0x4674('0x78')](_0x13bdf4,function(_0x4af4ec){return _0x3841e6[_0x4674('0x79')](_0x4af4ec[_0x4674('0x39')])||!_0x4af4ec[_0x4674('0x7a')]&&_0x4af4ec[_0x4674('0x3d')]!=='custom_text'&&_0x4af4ec[_0x4674('0x3d')]!==_0x4674('0x7b');});return{'count':_0x13bdf4[_0x4674('0x46')],'rows':_['map'](_0x13bdf4,function(_0x347ec5){return{'id':_0x347ec5[_0x4674('0x39')],'name':_0x347ec5[_0x4674('0x7c')],'custom':!_0x347ec5[_0x4674('0x7a')],'options':_0x347ec5[_0x4674('0x7d')]?_[_0x4674('0x3b')](_0x347ec5['choices'],function(_0x2c719e){return{'name':_[_0x4674('0x7e')](_0x2c719e),'value':_0x2c719e};}):[]};})};}})[_0x4674('0x36')](respondWithResult(_0x28b137,null))[_0x4674('0x2a')](function(_0x9cc9c1){var _0x440e9a=_0x28baef[_0x4674('0x41')][_0x4674('0x7f')]?0x1f4:_0x9cc9c1[_0x4674('0x80')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4674('0x64'),_0x440e9a,JSON[_0x4674('0x26')](_0x9cc9c1));delete _0x9cc9c1['name'];if(_0x440e9a===0x191){_0x440e9a=0x190;}_0x28b137[_0x4674('0x2c')](_0x440e9a)['send'](_0x28baef[_0x4674('0x41')][_0x4674('0x7f')]?{'message':_0x4674('0x81'),'statusCode':_0x9cc9c1[_0x4674('0x80')]}:_0x9cc9c1);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e97b115..72d2db7 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 _0x0c8a=['FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshdeskAccount.attributes','exports','define'];(function(_0x22471d,_0x481f3f){var _0x5b436e=function(_0x49a2fc){while(--_0x49a2fc){_0x22471d['push'](_0x22471d['shift']());}};_0x5b436e(++_0x481f3f);}(_0x0c8a,0x85));var _0xa0c8=function(_0x37a28b,_0x5dfc09){_0x37a28b=_0x37a28b-0x0;var _0x49624d=_0x0c8a[_0x37a28b];return _0x49624d;};'use strict';var _=require(_0xa0c8('0x0'));var util=require(_0xa0c8('0x1'));var logger=require(_0xa0c8('0x2'))(_0xa0c8('0x3'));var moment=require(_0xa0c8('0x4'));var BPromise=require(_0xa0c8('0x5'));var rp=require(_0xa0c8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0c8('0x7'));var config=require('../../config/environment');var attributes=require(_0xa0c8('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xa0c8('0x9')]=function(_0x43f1bb,_0x3cbc22){return _0x43f1bb[_0xa0c8('0xa')](_0xa0c8('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6c7=['../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x102402,_0x4eaaf8){var _0x321b44=function(_0x198c94){while(--_0x198c94){_0x102402['push'](_0x102402['shift']());}};_0x321b44(++_0x4eaaf8);}(_0xa6c7,0x14f));var _0x7a6c=function(_0x24e6c7,_0x387584){_0x24e6c7=_0x24e6c7-0x0;var _0x621a1c=_0xa6c7[_0x24e6c7];return _0x621a1c;};'use strict';var _=require(_0x7a6c('0x0'));var util=require(_0x7a6c('0x1'));var logger=require(_0x7a6c('0x2'))(_0x7a6c('0x3'));var moment=require(_0x7a6c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a6c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7a6c('0x6'));var attributes=require(_0x7a6c('0x7'));var integrations=require(_0x7a6c('0x8'));module[_0x7a6c('0x9')]=function(_0x3f58e4,_0x4ebb48){return _0x3f58e4[_0x7a6c('0xa')]('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index f31df41..1ae2ef8 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 _0x2e82=['debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshdeskAccount','options','raw','where','attributes','limit','map','include','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5b29e7,_0x41cb04){var _0x32ee3f=function(_0x4c7288){while(--_0x4c7288){_0x5b29e7['push'](_0x5b29e7['shift']());}};_0x32ee3f(++_0x41cb04);}(_0x2e82,0x1b7));var _0x22e8=function(_0x4de215,_0x20b26c){_0x4de215=_0x4de215-0x0;var _0x524dae=_0x2e82[_0x4de215];return _0x524dae;};'use strict';var _=require(_0x22e8('0x0'));var util=require(_0x22e8('0x1'));var moment=require(_0x22e8('0x2'));var BPromise=require('bluebird');var rs=require(_0x22e8('0x3'));var fs=require('fs');var Redis=require(_0x22e8('0x4'));var db=require(_0x22e8('0x5'))['db'];var utils=require(_0x22e8('0x6'));var logger=require(_0x22e8('0x7'))(_0x22e8('0x8'));var config=require('../../config/environment');var jayson=require(_0x22e8('0x9'));var client=jayson[_0x22e8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x563e62,_0x30778b,_0x5a0436){return new BPromise(function(_0x44ea90,_0x1b8c6d){return client[_0x22e8('0xb')](_0x563e62,_0x5a0436)[_0x22e8('0xc')](function(_0x1c8755){logger[_0x22e8('0xd')](_0x22e8('0xe'),_0x30778b,_0x22e8('0xf'));logger[_0x22e8('0x10')](_0x22e8('0x11'),_0x30778b,_0x22e8('0xf'),JSON[_0x22e8('0x12')](_0x1c8755));if(_0x1c8755['error']){if(_0x1c8755['error']['code']===0x1f4){logger[_0x22e8('0x13')](_0x22e8('0xe'),_0x30778b,_0x1c8755[_0x22e8('0x13')]['message']);return _0x1b8c6d(_0x1c8755['error'][_0x22e8('0x14')]);}logger['error'](_0x22e8('0xe'),_0x30778b,_0x1c8755[_0x22e8('0x13')][_0x22e8('0x14')]);return _0x44ea90(_0x1c8755[_0x22e8('0x13')]['message']);}else{logger[_0x22e8('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x30778b,_0x22e8('0xf'));_0x44ea90(_0x1c8755[_0x22e8('0x15')]['message']);}})[_0x22e8('0x16')](function(_0x1026c6){logger[_0x22e8('0x13')](_0x22e8('0xe'),_0x30778b,_0x1026c6);_0x1b8c6d(_0x1026c6);});});}exports['GetFreshdeskAccount']=function(_0x81158d){var _0x5ba57a=this;return new Promise(function(_0x4729e5,_0x4ccf9d){return db[_0x22e8('0x17')]['findAll']({'raw':_0x81158d[_0x22e8('0x18')]?_0x81158d[_0x22e8('0x18')][_0x22e8('0x19')]===undefined?!![]:![]:!![],'where':_0x81158d[_0x22e8('0x18')]?_0x81158d[_0x22e8('0x18')][_0x22e8('0x1a')]||null:null,'attributes':_0x81158d[_0x22e8('0x18')]?_0x81158d['options'][_0x22e8('0x1b')]||null:null,'limit':_0x81158d[_0x22e8('0x18')]?_0x81158d['options'][_0x22e8('0x1c')]||null:null,'include':_0x81158d[_0x22e8('0x18')]?_0x81158d[_0x22e8('0x18')]['include']?_[_0x22e8('0x1d')](_0x81158d['options'][_0x22e8('0x1e')],function(_0x428795){return{'model':db[_0x428795[_0x22e8('0x1f')]],'as':_0x428795['as'],'attributes':_0x428795[_0x22e8('0x1b')],'include':_0x428795[_0x22e8('0x1e')]?_['map'](_0x428795['include'],function(_0x4fbf70){return{'model':db[_0x4fbf70[_0x22e8('0x1f')]],'as':_0x4fbf70['as'],'attributes':_0x4fbf70[_0x22e8('0x1b')],'include':_0x4fbf70[_0x22e8('0x1e')]?_[_0x22e8('0x1d')](_0x4fbf70[_0x22e8('0x1e')],function(_0x47efa5){return{'model':db[_0x47efa5[_0x22e8('0x1f')]],'as':_0x47efa5['as'],'attributes':_0x47efa5['attributes']};}):[]};}):[]};}):[]:[]})[_0x22e8('0xc')](function(_0x4e29ea){logger[_0x22e8('0xd')](_0x22e8('0x20'),_0x81158d);logger[_0x22e8('0x10')](_0x22e8('0x20'),_0x81158d,JSON[_0x22e8('0x12')](_0x4e29ea));_0x4729e5(_0x4e29ea);})[_0x22e8('0x16')](function(_0x5d17c8){logger[_0x22e8('0x13')]('GetFreshdeskAccount',_0x5d17c8['message'],_0x81158d);_0x4ccf9d(_0x5ba57a['error'](0x1f4,_0x5d17c8[_0x22e8('0x14')]));});});};exports[_0x22e8('0x21')]=function(_0x1ddcbc){var _0x16502e=this;return new Promise(function(_0x678d81,_0x37f009){return db[_0x22e8('0x17')][_0x22e8('0x22')]({'raw':_0x1ddcbc['options']?_0x1ddcbc['options'][_0x22e8('0x19')]===undefined?!![]:![]:!![],'where':_0x1ddcbc[_0x22e8('0x18')]?_0x1ddcbc[_0x22e8('0x18')][_0x22e8('0x1a')]||null:null,'attributes':_0x1ddcbc['options']?_0x1ddcbc[_0x22e8('0x18')][_0x22e8('0x1b')]||null:null,'include':_0x1ddcbc[_0x22e8('0x18')]?_0x1ddcbc[_0x22e8('0x18')][_0x22e8('0x1e')]?_[_0x22e8('0x1d')](_0x1ddcbc['options'][_0x22e8('0x1e')],function(_0x39b322){return{'model':db[_0x39b322['model']],'as':_0x39b322['as'],'attributes':_0x39b322[_0x22e8('0x1b')],'include':_0x39b322[_0x22e8('0x1e')]?_[_0x22e8('0x1d')](_0x39b322[_0x22e8('0x1e')],function(_0x251791){return{'model':db[_0x251791[_0x22e8('0x1f')]],'as':_0x251791['as'],'attributes':_0x251791[_0x22e8('0x1b')],'include':_0x251791[_0x22e8('0x1e')]?_[_0x22e8('0x1d')](_0x251791[_0x22e8('0x1e')],function(_0x27283b){return{'model':db[_0x27283b[_0x22e8('0x1f')]],'as':_0x27283b['as'],'attributes':_0x27283b[_0x22e8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x22e8('0xc')](function(_0x49eaa6){logger[_0x22e8('0xd')](_0x22e8('0x21'),_0x1ddcbc);logger[_0x22e8('0x10')](_0x22e8('0x21'),_0x1ddcbc,JSON[_0x22e8('0x12')](_0x49eaa6));_0x678d81(_0x49eaa6);})[_0x22e8('0x16')](function(_0x5eba1f){logger[_0x22e8('0x13')](_0x22e8('0x21'),_0x5eba1f[_0x22e8('0x14')],_0x1ddcbc);_0x37f009(_0x16502e[_0x22e8('0x13')](0x1f4,_0x5eba1f[_0x22e8('0x14')]));});});}; \ No newline at end of file +var _0xb3d0=['info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FreshdeskAccount,\x20%s,\x20%s','message','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','then','stringify','catch','find','model','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request'];(function(_0x1b2763,_0x49e0b5){var _0x5a02a5=function(_0x4d13a9){while(--_0x4d13a9){_0x1b2763['push'](_0x1b2763['shift']());}};_0x5a02a5(++_0x49e0b5);}(_0xb3d0,0x18e));var _0x0b3d=function(_0x9272bd,_0xe1c15){_0x9272bd=_0x9272bd-0x0;var _0x3e8351=_0xb3d0[_0x9272bd];return _0x3e8351;};'use strict';var _=require(_0x0b3d('0x0'));var util=require('util');var moment=require(_0x0b3d('0x1'));var BPromise=require(_0x0b3d('0x2'));var rs=require(_0x0b3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b3d('0x4'))['db'];var utils=require(_0x0b3d('0x5'));var logger=require(_0x0b3d('0x6'))(_0x0b3d('0x7'));var config=require('../../config/environment');var jayson=require(_0x0b3d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5d1b09,_0x44e875,_0xa6c1a0){return new BPromise(function(_0x3c04b0,_0x15b1c3){return client[_0x0b3d('0x9')](_0x5d1b09,_0xa6c1a0)['then'](function(_0x41bf38){logger[_0x0b3d('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x44e875,'request\x20sent');logger[_0x0b3d('0xb')](_0x0b3d('0xc'),_0x44e875,_0x0b3d('0xd'),JSON['stringify'](_0x41bf38));if(_0x41bf38[_0x0b3d('0xe')]){if(_0x41bf38[_0x0b3d('0xe')][_0x0b3d('0xf')]===0x1f4){logger[_0x0b3d('0xe')](_0x0b3d('0x10'),_0x44e875,_0x41bf38[_0x0b3d('0xe')]['message']);return _0x15b1c3(_0x41bf38[_0x0b3d('0xe')][_0x0b3d('0x11')]);}logger[_0x0b3d('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x44e875,_0x41bf38['error'][_0x0b3d('0x11')]);return _0x3c04b0(_0x41bf38['error'][_0x0b3d('0x11')]);}else{logger[_0x0b3d('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x44e875,'request\x20sent');_0x3c04b0(_0x41bf38['result'][_0x0b3d('0x11')]);}})['catch'](function(_0x563d7b){logger[_0x0b3d('0xe')](_0x0b3d('0x10'),_0x44e875,_0x563d7b);_0x15b1c3(_0x563d7b);});});}exports[_0x0b3d('0x12')]=function(_0x394e23){var _0x163d14=this;return new Promise(function(_0x4f3544,_0xb09cc5){return db[_0x0b3d('0x13')][_0x0b3d('0x14')]({'raw':_0x394e23[_0x0b3d('0x15')]?_0x394e23[_0x0b3d('0x15')][_0x0b3d('0x16')]===undefined?!![]:![]:!![],'where':_0x394e23[_0x0b3d('0x15')]?_0x394e23['options'][_0x0b3d('0x17')]||null:null,'attributes':_0x394e23[_0x0b3d('0x15')]?_0x394e23[_0x0b3d('0x15')][_0x0b3d('0x18')]||null:null,'limit':_0x394e23[_0x0b3d('0x15')]?_0x394e23['options'][_0x0b3d('0x19')]||null:null,'include':_0x394e23[_0x0b3d('0x15')]?_0x394e23[_0x0b3d('0x15')][_0x0b3d('0x1a')]?_['map'](_0x394e23[_0x0b3d('0x15')][_0x0b3d('0x1a')],function(_0x18a5a8){return{'model':db[_0x18a5a8['model']],'as':_0x18a5a8['as'],'attributes':_0x18a5a8[_0x0b3d('0x18')],'include':_0x18a5a8['include']?_['map'](_0x18a5a8[_0x0b3d('0x1a')],function(_0x1e53f8){return{'model':db[_0x1e53f8['model']],'as':_0x1e53f8['as'],'attributes':_0x1e53f8[_0x0b3d('0x18')],'include':_0x1e53f8[_0x0b3d('0x1a')]?_[_0x0b3d('0x1b')](_0x1e53f8[_0x0b3d('0x1a')],function(_0x37ceea){return{'model':db[_0x37ceea['model']],'as':_0x37ceea['as'],'attributes':_0x37ceea[_0x0b3d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0b3d('0x1c')](function(_0x95b7a5){logger[_0x0b3d('0xa')](_0x0b3d('0x12'),_0x394e23);logger['debug'](_0x0b3d('0x12'),_0x394e23,JSON[_0x0b3d('0x1d')](_0x95b7a5));_0x4f3544(_0x95b7a5);})[_0x0b3d('0x1e')](function(_0x294088){logger['error']('GetFreshdeskAccount',_0x294088[_0x0b3d('0x11')],_0x394e23);_0xb09cc5(_0x163d14[_0x0b3d('0xe')](0x1f4,_0x294088[_0x0b3d('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x612933){var _0x9de2f5=this;return new Promise(function(_0x2bb28e,_0x4ec20f){return db[_0x0b3d('0x13')][_0x0b3d('0x1f')]({'raw':_0x612933[_0x0b3d('0x15')]?_0x612933[_0x0b3d('0x15')][_0x0b3d('0x16')]===undefined?!![]:![]:!![],'where':_0x612933[_0x0b3d('0x15')]?_0x612933['options'][_0x0b3d('0x17')]||null:null,'attributes':_0x612933['options']?_0x612933['options'][_0x0b3d('0x18')]||null:null,'include':_0x612933[_0x0b3d('0x15')]?_0x612933['options'][_0x0b3d('0x1a')]?_[_0x0b3d('0x1b')](_0x612933[_0x0b3d('0x15')]['include'],function(_0x874045){return{'model':db[_0x874045[_0x0b3d('0x20')]],'as':_0x874045['as'],'attributes':_0x874045['attributes'],'include':_0x874045[_0x0b3d('0x1a')]?_[_0x0b3d('0x1b')](_0x874045[_0x0b3d('0x1a')],function(_0x58ae95){return{'model':db[_0x58ae95[_0x0b3d('0x20')]],'as':_0x58ae95['as'],'attributes':_0x58ae95['attributes'],'include':_0x58ae95['include']?_[_0x0b3d('0x1b')](_0x58ae95[_0x0b3d('0x1a')],function(_0x18eb04){return{'model':db[_0x18eb04[_0x0b3d('0x20')]],'as':_0x18eb04['as'],'attributes':_0x18eb04[_0x0b3d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0b3d('0x1c')](function(_0x1f306c){logger[_0x0b3d('0xa')](_0x0b3d('0x21'),_0x612933);logger[_0x0b3d('0xb')](_0x0b3d('0x21'),_0x612933,JSON[_0x0b3d('0x1d')](_0x1f306c));_0x2bb28e(_0x1f306c);})[_0x0b3d('0x1e')](function(_0x4eb691){logger[_0x0b3d('0xe')](_0x0b3d('0x21'),_0x4eb691[_0x0b3d('0x11')],_0x612933);_0x4ec20f(_0x9de2f5[_0x0b3d('0xe')](0x1f4,_0x4eb691[_0x0b3d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ca3e6bc..f5704b6 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 _0x51d5=['create','post','setTags','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1d1151,_0x541258){var _0x331e71=function(_0x4b20c4){while(--_0x4b20c4){_0x1d1151['push'](_0x1d1151['shift']());}};_0x331e71(++_0x541258);}(_0x51d5,0xec));var _0x551d=function(_0x13e9a8,_0x567ba8){_0x13e9a8=_0x13e9a8-0x0;var _0x3ee308=_0x51d5[_0x13e9a8];return _0x3ee308;};'use strict';var multer=require(_0x551d('0x0'));var util=require(_0x551d('0x1'));var path=require('path');var timeout=require(_0x551d('0x2'));var express=require(_0x551d('0x3'));var router=express['Router']();var auth=require(_0x551d('0x4'));var interaction=require(_0x551d('0x5'));var config=require(_0x551d('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x551d('0x7')]('/',auth['isAuthenticated'](),controller[_0x551d('0x8')]);router[_0x551d('0x7')](_0x551d('0x9'),auth[_0x551d('0xa')](),controller[_0x551d('0xb')]);router[_0x551d('0x7')]('/:id/fields',auth[_0x551d('0xa')](),controller[_0x551d('0xc')]);router[_0x551d('0x7')](_0x551d('0xd'),auth[_0x551d('0xa')](),controller[_0x551d('0xe')]);router[_0x551d('0x7')](_0x551d('0xf'),auth[_0x551d('0xa')](),controller['getDescriptions']);router[_0x551d('0x7')](_0x551d('0x10'),auth[_0x551d('0xa')](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x551d('0x11')]);router[_0x551d('0x12')](_0x551d('0x10'),auth[_0x551d('0xa')](),controller[_0x551d('0x13')]);router['put']('/:id',auth[_0x551d('0xa')](),controller[_0x551d('0x14')]);router[_0x551d('0x15')](_0x551d('0x9'),auth[_0x551d('0xa')](),controller[_0x551d('0x16')]);module['exports']=router; \ No newline at end of file +var _0xcc9e=['get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/tags','getTags','create','put','update','delete','destroy','exports','multer','path','express','Router','./intFreshdeskConfiguration.controller'];(function(_0x168436,_0x32e236){var _0x372af3=function(_0x5b8709){while(--_0x5b8709){_0x168436['push'](_0x168436['shift']());}};_0x372af3(++_0x32e236);}(_0xcc9e,0xf7));var _0xecc9=function(_0xfbe68b,_0x254200){_0xfbe68b=_0xfbe68b-0x0;var _0x216153=_0xcc9e[_0xfbe68b];return _0x216153;};'use strict';var multer=require(_0xecc9('0x0'));var util=require('util');var path=require(_0xecc9('0x1'));var timeout=require('connect-timeout');var express=require(_0xecc9('0x2'));var router=express[_0xecc9('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xecc9('0x4'));router[_0xecc9('0x5')]('/',auth[_0xecc9('0x6')](),controller['index']);router['get'](_0xecc9('0x7'),auth[_0xecc9('0x6')](),controller[_0xecc9('0x8')]);router[_0xecc9('0x5')](_0xecc9('0x9'),auth['isAuthenticated'](),controller[_0xecc9('0xa')]);router[_0xecc9('0x5')](_0xecc9('0xb'),auth[_0xecc9('0x6')](),controller[_0xecc9('0xc')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0xecc9('0x5')](_0xecc9('0xd'),auth[_0xecc9('0x6')](),controller[_0xecc9('0xe')]);router['post']('/',auth[_0xecc9('0x6')](),controller[_0xecc9('0xf')]);router['post'](_0xecc9('0xd'),auth[_0xecc9('0x6')](),controller['setTags']);router[_0xecc9('0x10')](_0xecc9('0x7'),auth[_0xecc9('0x6')](),controller[_0xecc9('0x11')]);router[_0xecc9('0x12')](_0xecc9('0x7'),auth[_0xecc9('0x6')](),controller[_0xecc9('0x13')]);module[_0xecc9('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 23e89d6..d605927 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 _0xd78c=['STRING','sequelize'];(function(_0x412945,_0xc93eeb){var _0x3b4f8c=function(_0x216b48){while(--_0x216b48){_0x412945['push'](_0x412945['shift']());}};_0x3b4f8c(++_0xc93eeb);}(_0xd78c,0x75));var _0xcd78=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd78c[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xcd78('0x0'));module['exports']={'name':{'type':Sequelize[_0xcd78('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6a77=['exports','STRING','sequelize'];(function(_0x1056e6,_0x3d4074){var _0x4a3d8d=function(_0x40224d){while(--_0x40224d){_0x1056e6['push'](_0x1056e6['shift']());}};_0x4a3d8d(++_0x3d4074);}(_0x6a77,0x1b8));var _0x76a7=function(_0x4e0e79,_0x4c8dab){_0x4e0e79=_0x4e0e79-0x0;var _0x189d01=_0x6a77[_0x4e0e79];return _0x189d01;};'use strict';var Sequelize=require(_0x76a7('0x0'));module[_0x76a7('0x1')]={'name':{'type':Sequelize[_0x76a7('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index f9291dd..30759f7 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 _0x5205=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','count','offset','limit','set','json','apply','reject','update','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','create','body','destroy','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x55ebdf,_0x348fea){var _0x5db8e8=function(_0x104d44){while(--_0x104d44){_0x55ebdf['push'](_0x55ebdf['shift']());}};_0x5db8e8(++_0x348fea);}(_0x5205,0x165));var _0x5520=function(_0x46f620,_0x1ee8e5){_0x46f620=_0x46f620-0x0;var _0x206a57=_0x5205[_0x46f620];return _0x206a57;};'use strict';var pdf=require(_0x5520('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5520('0x1'));var zipdir=require(_0x5520('0x2'));var jsonpatch=require(_0x5520('0x3'));var rp=require(_0x5520('0x4'));var moment=require('moment');var BPromise=require(_0x5520('0x5'));var Mustache=require(_0x5520('0x6'));var util=require(_0x5520('0x7'));var path=require(_0x5520('0x8'));var sox=require(_0x5520('0x9'));var csv=require(_0x5520('0xa'));var ejs=require(_0x5520('0xb'));var fs=require('fs');var _=require(_0x5520('0xc'));var squel=require(_0x5520('0xd'));var crypto=require(_0x5520('0xe'));var jsforce=require(_0x5520('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5520('0xa'));var querystring=require(_0x5520('0x10'));var Papa=require(_0x5520('0x11'));var Redis=require(_0x5520('0x12'));var authService=require(_0x5520('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5520('0x14'));var hardwareService=require(_0x5520('0x15'));var logger=require('../../config/logger')(_0x5520('0x16'));var utils=require(_0x5520('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5520('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5520('0x19')][_0x5520('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2dd88a,_0x218a8a,_0x4b01a9,_0xe42d87){return new BPromise(function(_0x2019d4,_0x1d7bca){var _0x5d7734=_0xe42d87||client;return _0x5d7734[_0x5520('0x1b')](_0x2dd88a,_0x4b01a9)[_0x5520('0x1c')](function(_0x5444ba){logger[_0x5520('0x1d')](_0x5520('0x1e'),_0x218a8a,'request\x20sent');logger['debug'](_0x5520('0x1f'),_0x218a8a,'request\x20sent',JSON[_0x5520('0x20')](_0x5444ba));if(_0x5444ba[_0x5520('0x21')]){if(_0x5444ba[_0x5520('0x21')][_0x5520('0x22')]===0x1f4){logger[_0x5520('0x21')](_0x5520('0x1e'),_0x218a8a,_0x5444ba[_0x5520('0x21')]['message']);return _0x1d7bca(_0x5444ba[_0x5520('0x21')][_0x5520('0x23')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x218a8a,_0x5444ba[_0x5520('0x21')][_0x5520('0x23')]);return _0x2019d4(_0x5444ba[_0x5520('0x21')][_0x5520('0x23')]);}else{logger[_0x5520('0x1d')](_0x5520('0x1e'),_0x218a8a,_0x5520('0x24'));_0x2019d4(_0x5444ba['result']['message']);}})[_0x5520('0x25')](function(_0x5e63ce){logger[_0x5520('0x21')](_0x5520('0x1e'),_0x218a8a,_0x5e63ce);_0x1d7bca(_0x5e63ce);});});}function respondWithStatusCode(_0x183659,_0x97237f){_0x97237f=_0x97237f||0xcc;return function(_0x464f1a){if(_0x464f1a){return _0x183659[_0x5520('0x26')](_0x97237f);}return _0x183659['status'](_0x97237f)['end']();};}function respondWithResult(_0x30bf66,_0x5b8ce0){_0x5b8ce0=_0x5b8ce0||0xc8;return function(_0x2bce30){if(_0x2bce30){return _0x30bf66[_0x5520('0x27')](_0x5b8ce0)['json'](_0x2bce30);}};}function respondWithFilteredResult(_0x17f68c,_0x3ad2d8){return function(_0xc8db09){if(_0xc8db09){var _0xe9becb=_0xc8db09[_0x5520('0x28')],_0x4b411c=_0x3ad2d8[_0x5520('0x29')],_0x5db565=_0x3ad2d8['offset']+_0x3ad2d8[_0x5520('0x2a')],_0x5002d3;if(_0x5db565>=_0xe9becb){_0x5db565=_0xe9becb;_0x5002d3=0xc8;}else{_0x5002d3=0xce;}_0x17f68c[_0x5520('0x27')](_0x5002d3);return _0x17f68c[_0x5520('0x2b')]('Content-Range',_0x4b411c+'-'+_0x5db565+'/'+_0xe9becb)[_0x5520('0x2c')](_0xc8db09);}return null;};}function patchUpdates(_0x42d141){return function(_0x27f3d0){try{jsonpatch[_0x5520('0x2d')](_0x27f3d0,_0x42d141,!![]);}catch(_0x3e9725){return BPromise[_0x5520('0x2e')](_0x3e9725);}return _0x27f3d0['save']();};}function saveUpdates(_0x273273,_0x9ad91a){return function(_0x2140ea){if(_0x2140ea){return _0x2140ea[_0x5520('0x2f')](_0x273273)['then'](function(_0x20b524){return _0x20b524;});}return null;};}function removeEntity(_0x376eb0,_0x78b7b6){return function(_0x397db7){if(_0x397db7){return _0x397db7['destroy']()['then'](function(){_0x376eb0[_0x5520('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f47c3,_0x1ced40){return function(_0x5a17cf){if(!_0x5a17cf){_0x4f47c3[_0x5520('0x26')](0x194);}return _0x5a17cf;};}function handleError(_0xdc11c6,_0x13d53f){_0x13d53f=_0x13d53f||0x1f4;return function(_0x3db7f9){logger[_0x5520('0x21')](_0x3db7f9['stack']);if(_0x3db7f9['name']){delete _0x3db7f9[_0x5520('0x30')];}_0xdc11c6['status'](_0x13d53f)[_0x5520('0x31')](_0x3db7f9);};}exports[_0x5520('0x32')]=function(_0x5ae508,_0x4f1d0c){var _0x4aabe3={},_0x17160c={},_0x2fac01={'count':0x0,'rows':[]};var _0x55215d=_[_0x5520('0x33')](db[_0x5520('0x34')][_0x5520('0x35')],function(_0x46ade8){return{'name':_0x46ade8[_0x5520('0x36')],'type':_0x46ade8[_0x5520('0x37')][_0x5520('0x38')]};});_0x17160c[_0x5520('0x39')]=_['map'](_0x55215d,_0x5520('0x30'));_0x17160c[_0x5520('0x3a')]=_[_0x5520('0x3b')](_0x5ae508[_0x5520('0x3a')]);_0x17160c[_0x5520('0x3c')]=_[_0x5520('0x3d')](_0x17160c[_0x5520('0x39')],_0x17160c[_0x5520('0x3a')]);_0x4aabe3[_0x5520('0x3e')]=_[_0x5520('0x3d')](_0x17160c[_0x5520('0x39')],qs[_0x5520('0x3f')](_0x5ae508[_0x5520('0x3a')]['fields']));_0x4aabe3[_0x5520('0x3e')]=_0x4aabe3['attributes']['length']?_0x4aabe3[_0x5520('0x3e')]:_0x17160c[_0x5520('0x39')];if(!_0x5ae508[_0x5520('0x3a')][_0x5520('0x40')](_0x5520('0x41'))){_0x4aabe3[_0x5520('0x2a')]=qs['limit'](_0x5ae508[_0x5520('0x3a')][_0x5520('0x2a')]);_0x4aabe3['offset']=qs['offset'](_0x5ae508['query'][_0x5520('0x29')]);}_0x4aabe3['order']=qs[_0x5520('0x42')](_0x5ae508[_0x5520('0x3a')][_0x5520('0x42')]);_0x4aabe3['where']=qs[_0x5520('0x3c')](_[_0x5520('0x43')](_0x5ae508[_0x5520('0x3a')],_0x17160c[_0x5520('0x3c')]),_0x55215d);if(_0x5ae508[_0x5520('0x3a')]['filter']){_0x4aabe3[_0x5520('0x44')]=_[_0x5520('0x45')](_0x4aabe3[_0x5520('0x44')],{'$or':_[_0x5520('0x33')](_0x55215d,function(_0x2edd11){if(_0x2edd11[_0x5520('0x37')]!==_0x5520('0x46')){var _0x41e0ad={};_0x41e0ad[_0x2edd11['name']]={'$like':'%'+_0x5ae508[_0x5520('0x3a')][_0x5520('0x47')]+'%'};return _0x41e0ad;}})});}_0x4aabe3=_[_0x5520('0x45')]({},_0x4aabe3,_0x5ae508[_0x5520('0x48')]);var _0xdf180c={'where':_0x4aabe3['where']};return db['FreshdeskConfiguration'][_0x5520('0x28')](_0xdf180c)[_0x5520('0x1c')](function(_0x20451c){_0x2fac01[_0x5520('0x28')]=_0x20451c;if(_0x5ae508[_0x5520('0x3a')][_0x5520('0x49')]){_0x4aabe3[_0x5520('0x4a')]=[{'all':!![]}];}return db[_0x5520('0x34')][_0x5520('0x4b')](_0x4aabe3);})[_0x5520('0x1c')](function(_0x751609){_0x2fac01[_0x5520('0x4c')]=_0x751609;return _0x2fac01;})[_0x5520('0x1c')](respondWithFilteredResult(_0x4f1d0c,_0x4aabe3))[_0x5520('0x25')](handleError(_0x4f1d0c,null));};exports[_0x5520('0x4d')]=function(_0x5be72a,_0x1a2ba7){var _0x3020e5={'raw':![],'where':{'id':_0x5be72a[_0x5520('0x4e')]['id']}},_0x124eaf={};_0x124eaf['model']=_[_0x5520('0x3b')](db[_0x5520('0x34')][_0x5520('0x35')]);_0x124eaf[_0x5520('0x3a')]=_[_0x5520('0x3b')](_0x5be72a['query']);_0x124eaf[_0x5520('0x3c')]=_['intersection'](_0x124eaf['model'],_0x124eaf[_0x5520('0x3a')]);_0x3020e5['attributes']=_[_0x5520('0x3d')](_0x124eaf[_0x5520('0x39')],qs[_0x5520('0x3f')](_0x5be72a[_0x5520('0x3a')][_0x5520('0x3f')]));_0x3020e5[_0x5520('0x3e')]=_0x3020e5[_0x5520('0x3e')][_0x5520('0x4f')]?_0x3020e5[_0x5520('0x3e')]:_0x124eaf[_0x5520('0x39')];if(_0x5be72a[_0x5520('0x3a')][_0x5520('0x49')]){_0x3020e5[_0x5520('0x4a')]=[{'all':!![]}];}_0x3020e5=_['merge']({},_0x3020e5,_0x5be72a['options']);return db[_0x5520('0x34')][_0x5520('0x50')](_0x3020e5)[_0x5520('0x1c')](handleEntityNotFound(_0x1a2ba7,null))['then'](respondWithResult(_0x1a2ba7,null))[_0x5520('0x25')](handleError(_0x1a2ba7,null));};exports[_0x5520('0x51')]=function(_0x2fcb74,_0x92f71e){return db['FreshdeskConfiguration'][_0x5520('0x51')](_0x2fcb74[_0x5520('0x52')],{})[_0x5520('0x1c')](respondWithResult(_0x92f71e,0xc9))[_0x5520('0x25')](handleError(_0x92f71e,null));};exports[_0x5520('0x2f')]=function(_0x16c3b3,_0x487a13){if(_0x16c3b3['body']['id']){delete _0x16c3b3[_0x5520('0x52')]['id'];}return db[_0x5520('0x34')][_0x5520('0x50')]({'where':{'id':_0x16c3b3['params']['id']}})[_0x5520('0x1c')](handleEntityNotFound(_0x487a13,null))[_0x5520('0x1c')](saveUpdates(_0x16c3b3['body'],null))[_0x5520('0x1c')](respondWithResult(_0x487a13,null))[_0x5520('0x25')](handleError(_0x487a13,null));};exports[_0x5520('0x53')]=function(_0x40d6b6,_0x376651){return db[_0x5520('0x34')][_0x5520('0x50')]({'where':{'id':_0x40d6b6[_0x5520('0x4e')]['id']}})[_0x5520('0x1c')](handleEntityNotFound(_0x376651,null))[_0x5520('0x1c')](removeEntity(_0x376651,null))[_0x5520('0x25')](handleError(_0x376651,null));};exports[_0x5520('0x54')]=function(_0x24e74d,_0x627fe,_0x5d8f72){var _0xfdb512={};var _0x21dac3={};var _0x979e4c;var _0x440b38;return db['FreshdeskConfiguration'][_0x5520('0x55')]({'where':{'id':_0x24e74d[_0x5520('0x4e')]['id']}})['then'](handleEntityNotFound(_0x627fe,null))[_0x5520('0x1c')](function(_0xc642c5){if(_0xc642c5){_0x979e4c=_0xc642c5;_0x21dac3[_0x5520('0x39')]=_[_0x5520('0x3b')](db[_0x5520('0x56')][_0x5520('0x35')]);_0x21dac3[_0x5520('0x3a')]=_[_0x5520('0x3b')](_0x24e74d[_0x5520('0x3a')]);_0x21dac3[_0x5520('0x3c')]=_[_0x5520('0x3d')](_0x21dac3[_0x5520('0x39')],_0x21dac3[_0x5520('0x3a')]);_0xfdb512[_0x5520('0x3e')]=_['intersection'](_0x21dac3['model'],qs[_0x5520('0x3f')](_0x24e74d[_0x5520('0x3a')][_0x5520('0x3f')]));_0xfdb512[_0x5520('0x3e')]=_0xfdb512['attributes'][_0x5520('0x4f')]?_0xfdb512[_0x5520('0x3e')]:_0x21dac3['model'];_0xfdb512[_0x5520('0x57')]=qs[_0x5520('0x42')](_0x24e74d[_0x5520('0x3a')][_0x5520('0x42')]);_0xfdb512[_0x5520('0x44')]=qs['filters'](_[_0x5520('0x43')](_0x24e74d['query'],_0x21dac3[_0x5520('0x3c')]));if(_0x24e74d['query'][_0x5520('0x47')]){_0xfdb512[_0x5520('0x44')]=_[_0x5520('0x45')](_0xfdb512[_0x5520('0x44')],{'$or':_['map'](_0xfdb512[_0x5520('0x3e')],function(_0x2dde1f){var _0x29dbc5={};_0x29dbc5[_0x2dde1f]={'$like':'%'+_0x24e74d['query'][_0x5520('0x47')]+'%'};return _0x29dbc5;})});}_0xfdb512=_[_0x5520('0x45')]({},_0xfdb512,_0x24e74d[_0x5520('0x48')]);return _0x979e4c[_0x5520('0x54')](_0xfdb512);}})[_0x5520('0x1c')](function(_0x33e4d1){if(_0x33e4d1){_0x440b38=_0x33e4d1[_0x5520('0x4f')];if(!_0x24e74d[_0x5520('0x3a')][_0x5520('0x40')]('nolimit')){_0xfdb512[_0x5520('0x2a')]=qs[_0x5520('0x2a')](_0x24e74d['query'][_0x5520('0x2a')]);_0xfdb512[_0x5520('0x29')]=qs[_0x5520('0x29')](_0x24e74d[_0x5520('0x3a')][_0x5520('0x29')]);}return _0x979e4c['getFields'](_0xfdb512);}})['then'](function(_0x550c96){if(_0x550c96){return _0x550c96?{'count':_0x440b38,'rows':_0x550c96}:null;}})[_0x5520('0x1c')](respondWithResult(_0x627fe,null))[_0x5520('0x25')](handleError(_0x627fe,null));};exports['getSubjects']=function(_0x3c4232,_0x57900b,_0x321bc9){var _0x54fda8={};var _0x42fee7={};var _0x2be370;var _0x28934d;return db[_0x5520('0x34')][_0x5520('0x55')]({'where':{'id':_0x3c4232[_0x5520('0x4e')]['id']}})[_0x5520('0x1c')](handleEntityNotFound(_0x57900b,null))[_0x5520('0x1c')](function(_0x5dca0a){if(_0x5dca0a){_0x2be370=_0x5dca0a;_0x42fee7[_0x5520('0x39')]=_[_0x5520('0x3b')](db[_0x5520('0x56')][_0x5520('0x35')]);_0x42fee7['query']=_[_0x5520('0x3b')](_0x3c4232[_0x5520('0x3a')]);_0x42fee7[_0x5520('0x3c')]=_[_0x5520('0x3d')](_0x42fee7[_0x5520('0x39')],_0x42fee7[_0x5520('0x3a')]);_0x54fda8[_0x5520('0x3e')]=_[_0x5520('0x3d')](_0x42fee7[_0x5520('0x39')],qs[_0x5520('0x3f')](_0x3c4232['query'][_0x5520('0x3f')]));_0x54fda8[_0x5520('0x3e')]=_0x54fda8[_0x5520('0x3e')]['length']?_0x54fda8[_0x5520('0x3e')]:_0x42fee7[_0x5520('0x39')];_0x54fda8[_0x5520('0x57')]=qs[_0x5520('0x42')](_0x3c4232['query'][_0x5520('0x42')]);_0x54fda8['where']=qs[_0x5520('0x3c')](_[_0x5520('0x43')](_0x3c4232[_0x5520('0x3a')],_0x42fee7[_0x5520('0x3c')]));if(_0x3c4232[_0x5520('0x3a')][_0x5520('0x47')]){_0x54fda8[_0x5520('0x44')]=_[_0x5520('0x45')](_0x54fda8[_0x5520('0x44')],{'$or':_['map'](_0x54fda8[_0x5520('0x3e')],function(_0x2da139){var _0x2829d5={};_0x2829d5[_0x2da139]={'$like':'%'+_0x3c4232[_0x5520('0x3a')][_0x5520('0x47')]+'%'};return _0x2829d5;})});}_0x54fda8=_[_0x5520('0x45')]({},_0x54fda8,_0x3c4232['options']);return _0x2be370[_0x5520('0x58')](_0x54fda8);}})[_0x5520('0x1c')](function(_0x566728){if(_0x566728){_0x28934d=_0x566728[_0x5520('0x4f')];if(!_0x3c4232[_0x5520('0x3a')]['hasOwnProperty'](_0x5520('0x41'))){_0x54fda8[_0x5520('0x2a')]=qs[_0x5520('0x2a')](_0x3c4232['query'][_0x5520('0x2a')]);_0x54fda8[_0x5520('0x29')]=qs[_0x5520('0x29')](_0x3c4232[_0x5520('0x3a')][_0x5520('0x29')]);}return _0x2be370[_0x5520('0x58')](_0x54fda8);}})[_0x5520('0x1c')](function(_0x538e88){if(_0x538e88){return _0x538e88?{'count':_0x28934d,'rows':_0x538e88}:null;}})[_0x5520('0x1c')](respondWithResult(_0x57900b,null))[_0x5520('0x25')](handleError(_0x57900b,null));};exports[_0x5520('0x59')]=function(_0x520b32,_0x4c1226,_0xbe992){var _0x6151a8={};var _0x34822d={};var _0x590cf8;var _0x8c9da8;return db[_0x5520('0x34')]['findOne']({'where':{'id':_0x520b32[_0x5520('0x4e')]['id']}})[_0x5520('0x1c')](handleEntityNotFound(_0x4c1226,null))['then'](function(_0x453016){if(_0x453016){_0x590cf8=_0x453016;_0x34822d[_0x5520('0x39')]=_['keys'](db[_0x5520('0x56')][_0x5520('0x35')]);_0x34822d[_0x5520('0x3a')]=_[_0x5520('0x3b')](_0x520b32[_0x5520('0x3a')]);_0x34822d[_0x5520('0x3c')]=_[_0x5520('0x3d')](_0x34822d[_0x5520('0x39')],_0x34822d[_0x5520('0x3a')]);_0x6151a8[_0x5520('0x3e')]=_['intersection'](_0x34822d[_0x5520('0x39')],qs[_0x5520('0x3f')](_0x520b32['query'][_0x5520('0x3f')]));_0x6151a8[_0x5520('0x3e')]=_0x6151a8[_0x5520('0x3e')]['length']?_0x6151a8['attributes']:_0x34822d[_0x5520('0x39')];_0x6151a8[_0x5520('0x57')]=qs['sort'](_0x520b32[_0x5520('0x3a')]['sort']);_0x6151a8[_0x5520('0x44')]=qs[_0x5520('0x3c')](_[_0x5520('0x43')](_0x520b32[_0x5520('0x3a')],_0x34822d['filters']));if(_0x520b32[_0x5520('0x3a')][_0x5520('0x47')]){_0x6151a8[_0x5520('0x44')]=_[_0x5520('0x45')](_0x6151a8[_0x5520('0x44')],{'$or':_[_0x5520('0x33')](_0x6151a8[_0x5520('0x3e')],function(_0x2f92c1){var _0x5c3238={};_0x5c3238[_0x2f92c1]={'$like':'%'+_0x520b32[_0x5520('0x3a')][_0x5520('0x47')]+'%'};return _0x5c3238;})});}_0x6151a8=_['merge']({},_0x6151a8,_0x520b32['options']);return _0x590cf8[_0x5520('0x59')](_0x6151a8);}})['then'](function(_0x1b37a0){if(_0x1b37a0){_0x8c9da8=_0x1b37a0[_0x5520('0x4f')];if(!_0x520b32['query'][_0x5520('0x40')]('nolimit')){_0x6151a8[_0x5520('0x2a')]=qs[_0x5520('0x2a')](_0x520b32[_0x5520('0x3a')][_0x5520('0x2a')]);_0x6151a8[_0x5520('0x29')]=qs[_0x5520('0x29')](_0x520b32[_0x5520('0x3a')][_0x5520('0x29')]);}return _0x590cf8[_0x5520('0x59')](_0x6151a8);}})[_0x5520('0x1c')](function(_0x558d3a){if(_0x558d3a){return _0x558d3a?{'count':_0x8c9da8,'rows':_0x558d3a}:null;}})[_0x5520('0x1c')](respondWithResult(_0x4c1226,null))[_0x5520('0x25')](handleError(_0x4c1226,null));};exports[_0x5520('0x5a')]=function(_0x2b5282,_0x432e43,_0x22451e){var _0x2989e0={};var _0x1f7c1a={};var _0x5261d7;var _0x43c057;return db[_0x5520('0x34')]['findOne']({'where':{'id':_0x2b5282[_0x5520('0x4e')]['id']}})['then'](handleEntityNotFound(_0x432e43,null))[_0x5520('0x1c')](function(_0x29c7a2){if(_0x29c7a2){_0x5261d7=_0x29c7a2;_0x1f7c1a[_0x5520('0x39')]=_[_0x5520('0x3b')](db['Tag']['rawAttributes']);_0x1f7c1a[_0x5520('0x3a')]=_[_0x5520('0x3b')](_0x2b5282[_0x5520('0x3a')]);_0x1f7c1a[_0x5520('0x3c')]=_['intersection'](_0x1f7c1a[_0x5520('0x39')],_0x1f7c1a[_0x5520('0x3a')]);_0x2989e0[_0x5520('0x3e')]=_[_0x5520('0x3d')](_0x1f7c1a[_0x5520('0x39')],qs['fields'](_0x2b5282[_0x5520('0x3a')][_0x5520('0x3f')]));_0x2989e0[_0x5520('0x3e')]=_0x2989e0['attributes']['length']?_0x2989e0[_0x5520('0x3e')]:_0x1f7c1a[_0x5520('0x39')];_0x2989e0['order']=qs['sort'](_0x2b5282[_0x5520('0x3a')][_0x5520('0x42')]);_0x2989e0[_0x5520('0x44')]=qs[_0x5520('0x3c')](_['pick'](_0x2b5282[_0x5520('0x3a')],_0x1f7c1a[_0x5520('0x3c')]));if(_0x2b5282[_0x5520('0x3a')][_0x5520('0x47')]){_0x2989e0[_0x5520('0x44')]=_[_0x5520('0x45')](_0x2989e0['where'],{'$or':_[_0x5520('0x33')](_0x2989e0[_0x5520('0x3e')],function(_0x705b35){var _0x14ed13={};_0x14ed13[_0x705b35]={'$like':'%'+_0x2b5282[_0x5520('0x3a')][_0x5520('0x47')]+'%'};return _0x14ed13;})});}_0x2989e0=_['merge']({},_0x2989e0,_0x2b5282[_0x5520('0x48')]);return _0x5261d7['getTags'](_0x2989e0);}})[_0x5520('0x1c')](function(_0xfb327f){if(_0xfb327f){_0x43c057=_0xfb327f['length'];if(!_0x2b5282[_0x5520('0x3a')][_0x5520('0x40')](_0x5520('0x41'))){_0x2989e0[_0x5520('0x2a')]=qs[_0x5520('0x2a')](_0x2b5282[_0x5520('0x3a')][_0x5520('0x2a')]);_0x2989e0[_0x5520('0x29')]=qs[_0x5520('0x29')](_0x2b5282[_0x5520('0x3a')][_0x5520('0x29')]);}return _0x5261d7[_0x5520('0x5a')](_0x2989e0);}})[_0x5520('0x1c')](function(_0x3b6c8e){if(_0x3b6c8e){return _0x3b6c8e?{'count':_0x43c057,'rows':_0x3b6c8e}:null;}})['then'](respondWithResult(_0x432e43,null))[_0x5520('0x25')](handleError(_0x432e43,null));};exports[_0x5520('0x5b')]=function(_0x27c652,_0x3f252c,_0x3e87ad){if(_0x27c652[_0x5520('0x52')]['id']){delete _0x27c652[_0x5520('0x52')]['id'];}return db[_0x5520('0x34')]['findOne']({'where':{'id':_0x27c652[_0x5520('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f252c,null))[_0x5520('0x1c')](function(_0x47fd9e){if(_0x47fd9e){return _0x47fd9e['setTags'](_0x27c652[_0x5520('0x52')][_0x5520('0x5c')]||[]);}return null;})[_0x5520('0x1c')](respondWithResult(_0x3f252c,null))[_0x5520('0x25')](handleError(_0x3f252c,null));}; \ No newline at end of file +var _0x2411=['getTags','findOne','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','where','FreshdeskConfiguration','findAll','rows','show','params','length','find','create','body','getFields','FreshdeskField','getSubjects','getDescriptions'];(function(_0x42fb6f,_0x525e04){var _0x5998d0=function(_0x683119){while(--_0x683119){_0x42fb6f['push'](_0x42fb6f['shift']());}};_0x5998d0(++_0x525e04);}(_0x2411,0x65));var _0x1241=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x2411[_0xe73080];return _0x12cbc4;};'use strict';var pdf=require(_0x1241('0x0'));var emlformat=require(_0x1241('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1241('0x2'));var jsonpatch=require(_0x1241('0x3'));var rp=require(_0x1241('0x4'));var moment=require(_0x1241('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1241('0x6'));var util=require(_0x1241('0x7'));var path=require('path');var sox=require(_0x1241('0x8'));var csv=require('to-csv');var ejs=require(_0x1241('0x9'));var fs=require('fs');var _=require(_0x1241('0xa'));var squel=require(_0x1241('0xb'));var crypto=require('crypto');var jsforce=require(_0x1241('0xc'));var deskjs=require(_0x1241('0xd'));var toCsv=require(_0x1241('0xe'));var querystring=require('querystring');var Papa=require(_0x1241('0xf'));var Redis=require(_0x1241('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1241('0x11'));var hardwareService=require(_0x1241('0x12'));var logger=require('../../config/logger')(_0x1241('0x13'));var utils=require(_0x1241('0x14'));var config=require(_0x1241('0x15'));var licenseUtil=require(_0x1241('0x16'));var db=require(_0x1241('0x17'))['db'];var jayson=require(_0x1241('0x18'));var client=jayson[_0x1241('0x19')][_0x1241('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xa07ce7,_0x504277,_0x116213,_0x5388e4){return new BPromise(function(_0xc7b989,_0xfaf2e6){var _0x2dc541=_0x5388e4||client;return _0x2dc541['request'](_0xa07ce7,_0x116213)[_0x1241('0x1b')](function(_0xce0628){logger[_0x1241('0x1c')](_0x1241('0x1d'),_0x504277,'request\x20sent');logger[_0x1241('0x1e')](_0x1241('0x1f'),_0x504277,_0x1241('0x20'),JSON[_0x1241('0x21')](_0xce0628));if(_0xce0628[_0x1241('0x22')]){if(_0xce0628[_0x1241('0x22')][_0x1241('0x23')]===0x1f4){logger[_0x1241('0x22')](_0x1241('0x1d'),_0x504277,_0xce0628[_0x1241('0x22')]['message']);return _0xfaf2e6(_0xce0628[_0x1241('0x22')][_0x1241('0x24')]);}logger['error'](_0x1241('0x1d'),_0x504277,_0xce0628[_0x1241('0x22')]['message']);return _0xc7b989(_0xce0628[_0x1241('0x22')]['message']);}else{logger['info'](_0x1241('0x1d'),_0x504277,_0x1241('0x20'));_0xc7b989(_0xce0628[_0x1241('0x25')][_0x1241('0x24')]);}})[_0x1241('0x26')](function(_0x414e07){logger[_0x1241('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x504277,_0x414e07);_0xfaf2e6(_0x414e07);});});}function respondWithStatusCode(_0x5b61f3,_0x4c2251){_0x4c2251=_0x4c2251||0xcc;return function(_0x3ac352){if(_0x3ac352){return _0x5b61f3['sendStatus'](_0x4c2251);}return _0x5b61f3[_0x1241('0x27')](_0x4c2251)[_0x1241('0x28')]();};}function respondWithResult(_0x23d20f,_0x7149d0){_0x7149d0=_0x7149d0||0xc8;return function(_0x390e42){if(_0x390e42){return _0x23d20f[_0x1241('0x27')](_0x7149d0)[_0x1241('0x29')](_0x390e42);}};}function respondWithFilteredResult(_0xdeec7a,_0x24a7c1){return function(_0x1fce4f){if(_0x1fce4f){var _0x1dd98=_0x1fce4f[_0x1241('0x2a')],_0xf34cbe=_0x24a7c1[_0x1241('0x2b')],_0x268b35=_0x24a7c1[_0x1241('0x2b')]+_0x24a7c1[_0x1241('0x2c')],_0x9dd2bd;if(_0x268b35>=_0x1dd98){_0x268b35=_0x1dd98;_0x9dd2bd=0xc8;}else{_0x9dd2bd=0xce;}_0xdeec7a['status'](_0x9dd2bd);return _0xdeec7a[_0x1241('0x2d')](_0x1241('0x2e'),_0xf34cbe+'-'+_0x268b35+'/'+_0x1dd98)[_0x1241('0x29')](_0x1fce4f);}return null;};}function patchUpdates(_0x103bd2){return function(_0x28ccef){try{jsonpatch[_0x1241('0x2f')](_0x28ccef,_0x103bd2,!![]);}catch(_0x6c1b54){return BPromise[_0x1241('0x30')](_0x6c1b54);}return _0x28ccef[_0x1241('0x31')]();};}function saveUpdates(_0x4fa020,_0x5c6165){return function(_0x14a279){if(_0x14a279){return _0x14a279[_0x1241('0x32')](_0x4fa020)['then'](function(_0x4f64b6){return _0x4f64b6;});}return null;};}function removeEntity(_0x2b0dee,_0x51ac55){return function(_0x52bcab){if(_0x52bcab){return _0x52bcab[_0x1241('0x33')]()['then'](function(){_0x2b0dee['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x579fc8,_0x540243){return function(_0x388d33){if(!_0x388d33){_0x579fc8[_0x1241('0x34')](0x194);}return _0x388d33;};}function handleError(_0x2fe8ae,_0x45c7b5){_0x45c7b5=_0x45c7b5||0x1f4;return function(_0x3f935b){logger[_0x1241('0x22')](_0x3f935b[_0x1241('0x35')]);if(_0x3f935b[_0x1241('0x36')]){delete _0x3f935b['name'];}_0x2fe8ae['status'](_0x45c7b5)[_0x1241('0x37')](_0x3f935b);};}exports[_0x1241('0x38')]=function(_0x433ecd,_0x4bd08e){var _0x4b5565={},_0x826890={},_0x590fbc={'count':0x0,'rows':[]};var _0x139ef8=_[_0x1241('0x39')](db['FreshdeskConfiguration'][_0x1241('0x3a')],function(_0x23696d){return{'name':_0x23696d[_0x1241('0x3b')],'type':_0x23696d[_0x1241('0x3c')][_0x1241('0x3d')]};});_0x826890[_0x1241('0x3e')]=_[_0x1241('0x39')](_0x139ef8,_0x1241('0x36'));_0x826890['query']=_[_0x1241('0x3f')](_0x433ecd['query']);_0x826890[_0x1241('0x40')]=_[_0x1241('0x41')](_0x826890[_0x1241('0x3e')],_0x826890[_0x1241('0x42')]);_0x4b5565[_0x1241('0x43')]=_[_0x1241('0x41')](_0x826890['model'],qs[_0x1241('0x44')](_0x433ecd[_0x1241('0x42')][_0x1241('0x44')]));_0x4b5565['attributes']=_0x4b5565[_0x1241('0x43')]['length']?_0x4b5565[_0x1241('0x43')]:_0x826890[_0x1241('0x3e')];if(!_0x433ecd[_0x1241('0x42')][_0x1241('0x45')](_0x1241('0x46'))){_0x4b5565['limit']=qs[_0x1241('0x2c')](_0x433ecd[_0x1241('0x42')][_0x1241('0x2c')]);_0x4b5565[_0x1241('0x2b')]=qs[_0x1241('0x2b')](_0x433ecd[_0x1241('0x42')][_0x1241('0x2b')]);}_0x4b5565[_0x1241('0x47')]=qs['sort'](_0x433ecd['query'][_0x1241('0x48')]);_0x4b5565['where']=qs[_0x1241('0x40')](_[_0x1241('0x49')](_0x433ecd[_0x1241('0x42')],_0x826890[_0x1241('0x40')]),_0x139ef8);if(_0x433ecd['query'][_0x1241('0x4a')]){_0x4b5565['where']=_[_0x1241('0x4b')](_0x4b5565['where'],{'$or':_[_0x1241('0x39')](_0x139ef8,function(_0x25c75b){if(_0x25c75b[_0x1241('0x3c')]!=='VIRTUAL'){var _0x1cee32={};_0x1cee32[_0x25c75b[_0x1241('0x36')]]={'$like':'%'+_0x433ecd[_0x1241('0x42')][_0x1241('0x4a')]+'%'};return _0x1cee32;}})});}_0x4b5565=_['merge']({},_0x4b5565,_0x433ecd[_0x1241('0x4c')]);var _0x1a22aa={'where':_0x4b5565[_0x1241('0x4d')]};return db[_0x1241('0x4e')][_0x1241('0x2a')](_0x1a22aa)['then'](function(_0xc2a852){_0x590fbc[_0x1241('0x2a')]=_0xc2a852;if(_0x433ecd['query']['includeAll']){_0x4b5565['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x1241('0x4f')](_0x4b5565);})['then'](function(_0x54a738){_0x590fbc[_0x1241('0x50')]=_0x54a738;return _0x590fbc;})[_0x1241('0x1b')](respondWithFilteredResult(_0x4bd08e,_0x4b5565))['catch'](handleError(_0x4bd08e,null));};exports[_0x1241('0x51')]=function(_0x198404,_0x2ad762){var _0x50ab55={'raw':![],'where':{'id':_0x198404[_0x1241('0x52')]['id']}},_0x379fe5={};_0x379fe5[_0x1241('0x3e')]=_[_0x1241('0x3f')](db[_0x1241('0x4e')][_0x1241('0x3a')]);_0x379fe5[_0x1241('0x42')]=_['keys'](_0x198404['query']);_0x379fe5[_0x1241('0x40')]=_[_0x1241('0x41')](_0x379fe5[_0x1241('0x3e')],_0x379fe5[_0x1241('0x42')]);_0x50ab55[_0x1241('0x43')]=_[_0x1241('0x41')](_0x379fe5['model'],qs[_0x1241('0x44')](_0x198404['query'][_0x1241('0x44')]));_0x50ab55['attributes']=_0x50ab55[_0x1241('0x43')][_0x1241('0x53')]?_0x50ab55[_0x1241('0x43')]:_0x379fe5[_0x1241('0x3e')];if(_0x198404[_0x1241('0x42')]['includeAll']){_0x50ab55['include']=[{'all':!![]}];}_0x50ab55=_['merge']({},_0x50ab55,_0x198404['options']);return db['FreshdeskConfiguration'][_0x1241('0x54')](_0x50ab55)[_0x1241('0x1b')](handleEntityNotFound(_0x2ad762,null))['then'](respondWithResult(_0x2ad762,null))[_0x1241('0x26')](handleError(_0x2ad762,null));};exports[_0x1241('0x55')]=function(_0x15253e,_0x41cc5b){return db[_0x1241('0x4e')][_0x1241('0x55')](_0x15253e['body'],{})[_0x1241('0x1b')](respondWithResult(_0x41cc5b,0xc9))['catch'](handleError(_0x41cc5b,null));};exports[_0x1241('0x32')]=function(_0x29f3f9,_0x519eff){if(_0x29f3f9['body']['id']){delete _0x29f3f9[_0x1241('0x56')]['id'];}return db[_0x1241('0x4e')][_0x1241('0x54')]({'where':{'id':_0x29f3f9['params']['id']}})[_0x1241('0x1b')](handleEntityNotFound(_0x519eff,null))[_0x1241('0x1b')](saveUpdates(_0x29f3f9[_0x1241('0x56')],null))['then'](respondWithResult(_0x519eff,null))[_0x1241('0x26')](handleError(_0x519eff,null));};exports[_0x1241('0x33')]=function(_0x50c891,_0x2105ca){return db[_0x1241('0x4e')][_0x1241('0x54')]({'where':{'id':_0x50c891[_0x1241('0x52')]['id']}})[_0x1241('0x1b')](handleEntityNotFound(_0x2105ca,null))[_0x1241('0x1b')](removeEntity(_0x2105ca,null))[_0x1241('0x26')](handleError(_0x2105ca,null));};exports[_0x1241('0x57')]=function(_0x14bb8c,_0x25d499,_0x1b28eb){var _0x2e2eb5={};var _0xd171a0={};var _0x5272c8;var _0x238681;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x14bb8c[_0x1241('0x52')]['id']}})[_0x1241('0x1b')](handleEntityNotFound(_0x25d499,null))[_0x1241('0x1b')](function(_0x422ac7){if(_0x422ac7){_0x5272c8=_0x422ac7;_0xd171a0[_0x1241('0x3e')]=_['keys'](db[_0x1241('0x58')][_0x1241('0x3a')]);_0xd171a0[_0x1241('0x42')]=_[_0x1241('0x3f')](_0x14bb8c[_0x1241('0x42')]);_0xd171a0[_0x1241('0x40')]=_[_0x1241('0x41')](_0xd171a0[_0x1241('0x3e')],_0xd171a0[_0x1241('0x42')]);_0x2e2eb5[_0x1241('0x43')]=_[_0x1241('0x41')](_0xd171a0[_0x1241('0x3e')],qs[_0x1241('0x44')](_0x14bb8c[_0x1241('0x42')][_0x1241('0x44')]));_0x2e2eb5[_0x1241('0x43')]=_0x2e2eb5[_0x1241('0x43')]['length']?_0x2e2eb5['attributes']:_0xd171a0[_0x1241('0x3e')];_0x2e2eb5['order']=qs[_0x1241('0x48')](_0x14bb8c[_0x1241('0x42')][_0x1241('0x48')]);_0x2e2eb5['where']=qs[_0x1241('0x40')](_[_0x1241('0x49')](_0x14bb8c[_0x1241('0x42')],_0xd171a0[_0x1241('0x40')]));if(_0x14bb8c[_0x1241('0x42')][_0x1241('0x4a')]){_0x2e2eb5[_0x1241('0x4d')]=_[_0x1241('0x4b')](_0x2e2eb5[_0x1241('0x4d')],{'$or':_[_0x1241('0x39')](_0x2e2eb5[_0x1241('0x43')],function(_0x4761be){var _0x36deea={};_0x36deea[_0x4761be]={'$like':'%'+_0x14bb8c[_0x1241('0x42')][_0x1241('0x4a')]+'%'};return _0x36deea;})});}_0x2e2eb5=_[_0x1241('0x4b')]({},_0x2e2eb5,_0x14bb8c[_0x1241('0x4c')]);return _0x5272c8['getFields'](_0x2e2eb5);}})[_0x1241('0x1b')](function(_0x1e1daa){if(_0x1e1daa){_0x238681=_0x1e1daa['length'];if(!_0x14bb8c['query'][_0x1241('0x45')](_0x1241('0x46'))){_0x2e2eb5['limit']=qs[_0x1241('0x2c')](_0x14bb8c[_0x1241('0x42')][_0x1241('0x2c')]);_0x2e2eb5[_0x1241('0x2b')]=qs['offset'](_0x14bb8c[_0x1241('0x42')][_0x1241('0x2b')]);}return _0x5272c8[_0x1241('0x57')](_0x2e2eb5);}})[_0x1241('0x1b')](function(_0x49a803){if(_0x49a803){return _0x49a803?{'count':_0x238681,'rows':_0x49a803}:null;}})['then'](respondWithResult(_0x25d499,null))['catch'](handleError(_0x25d499,null));};exports['getSubjects']=function(_0x141453,_0x1e7415,_0x226c8e){var _0xd9ffa0={};var _0x4a7a60={};var _0x580cfc;var _0x4aca55;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x141453[_0x1241('0x52')]['id']}})[_0x1241('0x1b')](handleEntityNotFound(_0x1e7415,null))[_0x1241('0x1b')](function(_0x230846){if(_0x230846){_0x580cfc=_0x230846;_0x4a7a60[_0x1241('0x3e')]=_[_0x1241('0x3f')](db[_0x1241('0x58')][_0x1241('0x3a')]);_0x4a7a60[_0x1241('0x42')]=_[_0x1241('0x3f')](_0x141453['query']);_0x4a7a60[_0x1241('0x40')]=_[_0x1241('0x41')](_0x4a7a60[_0x1241('0x3e')],_0x4a7a60['query']);_0xd9ffa0[_0x1241('0x43')]=_['intersection'](_0x4a7a60[_0x1241('0x3e')],qs[_0x1241('0x44')](_0x141453[_0x1241('0x42')][_0x1241('0x44')]));_0xd9ffa0[_0x1241('0x43')]=_0xd9ffa0[_0x1241('0x43')]['length']?_0xd9ffa0[_0x1241('0x43')]:_0x4a7a60[_0x1241('0x3e')];_0xd9ffa0[_0x1241('0x47')]=qs[_0x1241('0x48')](_0x141453['query'][_0x1241('0x48')]);_0xd9ffa0[_0x1241('0x4d')]=qs[_0x1241('0x40')](_[_0x1241('0x49')](_0x141453['query'],_0x4a7a60['filters']));if(_0x141453[_0x1241('0x42')][_0x1241('0x4a')]){_0xd9ffa0[_0x1241('0x4d')]=_[_0x1241('0x4b')](_0xd9ffa0[_0x1241('0x4d')],{'$or':_['map'](_0xd9ffa0['attributes'],function(_0x276cb4){var _0x27482b={};_0x27482b[_0x276cb4]={'$like':'%'+_0x141453['query'][_0x1241('0x4a')]+'%'};return _0x27482b;})});}_0xd9ffa0=_[_0x1241('0x4b')]({},_0xd9ffa0,_0x141453[_0x1241('0x4c')]);return _0x580cfc[_0x1241('0x59')](_0xd9ffa0);}})['then'](function(_0x19863c){if(_0x19863c){_0x4aca55=_0x19863c[_0x1241('0x53')];if(!_0x141453[_0x1241('0x42')][_0x1241('0x45')](_0x1241('0x46'))){_0xd9ffa0[_0x1241('0x2c')]=qs[_0x1241('0x2c')](_0x141453[_0x1241('0x42')][_0x1241('0x2c')]);_0xd9ffa0['offset']=qs[_0x1241('0x2b')](_0x141453[_0x1241('0x42')][_0x1241('0x2b')]);}return _0x580cfc[_0x1241('0x59')](_0xd9ffa0);}})['then'](function(_0x5aa0ed){if(_0x5aa0ed){return _0x5aa0ed?{'count':_0x4aca55,'rows':_0x5aa0ed}:null;}})[_0x1241('0x1b')](respondWithResult(_0x1e7415,null))[_0x1241('0x26')](handleError(_0x1e7415,null));};exports[_0x1241('0x5a')]=function(_0x5bea6a,_0x2a7b67,_0x52361f){var _0x51e703={};var _0x2ab013={};var _0x26c175;var _0x33c2a3;return db[_0x1241('0x4e')]['findOne']({'where':{'id':_0x5bea6a['params']['id']}})[_0x1241('0x1b')](handleEntityNotFound(_0x2a7b67,null))['then'](function(_0x2a65f0){if(_0x2a65f0){_0x26c175=_0x2a65f0;_0x2ab013[_0x1241('0x3e')]=_[_0x1241('0x3f')](db['FreshdeskField'][_0x1241('0x3a')]);_0x2ab013['query']=_[_0x1241('0x3f')](_0x5bea6a['query']);_0x2ab013[_0x1241('0x40')]=_[_0x1241('0x41')](_0x2ab013[_0x1241('0x3e')],_0x2ab013['query']);_0x51e703[_0x1241('0x43')]=_[_0x1241('0x41')](_0x2ab013[_0x1241('0x3e')],qs[_0x1241('0x44')](_0x5bea6a[_0x1241('0x42')][_0x1241('0x44')]));_0x51e703[_0x1241('0x43')]=_0x51e703['attributes'][_0x1241('0x53')]?_0x51e703['attributes']:_0x2ab013[_0x1241('0x3e')];_0x51e703[_0x1241('0x47')]=qs['sort'](_0x5bea6a[_0x1241('0x42')][_0x1241('0x48')]);_0x51e703[_0x1241('0x4d')]=qs[_0x1241('0x40')](_['pick'](_0x5bea6a['query'],_0x2ab013[_0x1241('0x40')]));if(_0x5bea6a[_0x1241('0x42')][_0x1241('0x4a')]){_0x51e703['where']=_[_0x1241('0x4b')](_0x51e703[_0x1241('0x4d')],{'$or':_['map'](_0x51e703[_0x1241('0x43')],function(_0x27e585){var _0x2f8724={};_0x2f8724[_0x27e585]={'$like':'%'+_0x5bea6a[_0x1241('0x42')]['filter']+'%'};return _0x2f8724;})});}_0x51e703=_[_0x1241('0x4b')]({},_0x51e703,_0x5bea6a[_0x1241('0x4c')]);return _0x26c175[_0x1241('0x5a')](_0x51e703);}})[_0x1241('0x1b')](function(_0x5d7f5f){if(_0x5d7f5f){_0x33c2a3=_0x5d7f5f['length'];if(!_0x5bea6a['query'][_0x1241('0x45')](_0x1241('0x46'))){_0x51e703[_0x1241('0x2c')]=qs[_0x1241('0x2c')](_0x5bea6a[_0x1241('0x42')][_0x1241('0x2c')]);_0x51e703[_0x1241('0x2b')]=qs[_0x1241('0x2b')](_0x5bea6a[_0x1241('0x42')]['offset']);}return _0x26c175['getDescriptions'](_0x51e703);}})[_0x1241('0x1b')](function(_0x199c13){if(_0x199c13){return _0x199c13?{'count':_0x33c2a3,'rows':_0x199c13}:null;}})['then'](respondWithResult(_0x2a7b67,null))[_0x1241('0x26')](handleError(_0x2a7b67,null));};exports[_0x1241('0x5b')]=function(_0x3706aa,_0x3c2459,_0x135801){var _0x33fd36={};var _0x242ebc={};var _0x2ed5d8;var _0x305800;return db[_0x1241('0x4e')][_0x1241('0x5c')]({'where':{'id':_0x3706aa['params']['id']}})['then'](handleEntityNotFound(_0x3c2459,null))[_0x1241('0x1b')](function(_0x746808){if(_0x746808){_0x2ed5d8=_0x746808;_0x242ebc[_0x1241('0x3e')]=_['keys'](db[_0x1241('0x5d')]['rawAttributes']);_0x242ebc[_0x1241('0x42')]=_[_0x1241('0x3f')](_0x3706aa[_0x1241('0x42')]);_0x242ebc[_0x1241('0x40')]=_[_0x1241('0x41')](_0x242ebc[_0x1241('0x3e')],_0x242ebc[_0x1241('0x42')]);_0x33fd36[_0x1241('0x43')]=_[_0x1241('0x41')](_0x242ebc['model'],qs[_0x1241('0x44')](_0x3706aa[_0x1241('0x42')][_0x1241('0x44')]));_0x33fd36['attributes']=_0x33fd36[_0x1241('0x43')][_0x1241('0x53')]?_0x33fd36['attributes']:_0x242ebc[_0x1241('0x3e')];_0x33fd36['order']=qs[_0x1241('0x48')](_0x3706aa[_0x1241('0x42')][_0x1241('0x48')]);_0x33fd36[_0x1241('0x4d')]=qs[_0x1241('0x40')](_[_0x1241('0x49')](_0x3706aa[_0x1241('0x42')],_0x242ebc[_0x1241('0x40')]));if(_0x3706aa['query']['filter']){_0x33fd36[_0x1241('0x4d')]=_[_0x1241('0x4b')](_0x33fd36[_0x1241('0x4d')],{'$or':_[_0x1241('0x39')](_0x33fd36[_0x1241('0x43')],function(_0x20db08){var _0x4a4e88={};_0x4a4e88[_0x20db08]={'$like':'%'+_0x3706aa[_0x1241('0x42')]['filter']+'%'};return _0x4a4e88;})});}_0x33fd36=_['merge']({},_0x33fd36,_0x3706aa[_0x1241('0x4c')]);return _0x2ed5d8[_0x1241('0x5b')](_0x33fd36);}})[_0x1241('0x1b')](function(_0x2c2b7a){if(_0x2c2b7a){_0x305800=_0x2c2b7a[_0x1241('0x53')];if(!_0x3706aa['query'][_0x1241('0x45')]('nolimit')){_0x33fd36[_0x1241('0x2c')]=qs['limit'](_0x3706aa[_0x1241('0x42')]['limit']);_0x33fd36[_0x1241('0x2b')]=qs['offset'](_0x3706aa[_0x1241('0x42')][_0x1241('0x2b')]);}return _0x2ed5d8['getTags'](_0x33fd36);}})['then'](function(_0x524a92){if(_0x524a92){return _0x524a92?{'count':_0x305800,'rows':_0x524a92}:null;}})[_0x1241('0x1b')](respondWithResult(_0x3c2459,null))[_0x1241('0x26')](handleError(_0x3c2459,null));};exports[_0x1241('0x5e')]=function(_0x187e73,_0x3c3016,_0x5d9791){if(_0x187e73['body']['id']){delete _0x187e73[_0x1241('0x56')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x187e73['params']['id']}})[_0x1241('0x1b')](handleEntityNotFound(_0x3c3016,null))['then'](function(_0x4ca99b){if(_0x4ca99b){return _0x4ca99b[_0x1241('0x5e')](_0x187e73[_0x1241('0x56')][_0x1241('0x5f')]||[]);}return null;})['then'](respondWithResult(_0x3c3016,null))['catch'](handleError(_0x3c3016,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index d1df745..7254027 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 _0x4e6e=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x23e26c,_0x501919){var _0x5deb1b=function(_0x1f5298){while(--_0x1f5298){_0x23e26c['push'](_0x23e26c['shift']());}};_0x5deb1b(++_0x501919);}(_0x4e6e,0xd0));var _0xe4e6=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x4e6e[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0xe4e6('0x0'));var util=require(_0xe4e6('0x1'));var logger=require(_0xe4e6('0x2'))(_0xe4e6('0x3'));var moment=require(_0xe4e6('0x4'));var BPromise=require('bluebird');var rp=require(_0xe4e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4e6('0x6'));var config=require(_0xe4e6('0x7'));var attributes=require(_0xe4e6('0x8'));module[_0xe4e6('0x9')]=function(_0x509d76,_0x545bc5){return _0x509d76[_0xe4e6('0xa')](_0xe4e6('0xb'),attributes,{'tableName':_0xe4e6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc011=['path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util','moment','bluebird','request-promise'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0xc011,0x150));var _0x1c01=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0xc011[_0x43e4b3];return _0x10c655;};'use strict';var _=require(_0x1c01('0x0'));var util=require(_0x1c01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1c01('0x2'));var BPromise=require(_0x1c01('0x3'));var rp=require(_0x1c01('0x4'));var fs=require('fs');var path=require(_0x1c01('0x5'));var rimraf=require(_0x1c01('0x6'));var config=require('../../config/environment');var attributes=require(_0x1c01('0x7'));module[_0x1c01('0x8')]=function(_0x3806a9,_0x242ad5){return _0x3806a9[_0x1c01('0x9')](_0x1c01('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index e65de21..40b5256 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 _0xe1e8=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x3b1fe3,_0x43d8b1){var _0x424e07=function(_0x3d2d58){while(--_0x3d2d58){_0x3b1fe3['push'](_0x3b1fe3['shift']());}};_0x424e07(++_0x43d8b1);}(_0xe1e8,0x17a));var _0x8e1e=function(_0x2c92ec,_0x1c22c1){_0x2c92ec=_0x2c92ec-0x0;var _0x266eb0=_0xe1e8[_0x2c92ec];return _0x266eb0;};'use strict';var _=require(_0x8e1e('0x0'));var util=require(_0x8e1e('0x1'));var moment=require(_0x8e1e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e1e('0x3'));var fs=require('fs');var Redis=require(_0x8e1e('0x4'));var db=require(_0x8e1e('0x5'))['db'];var utils=require(_0x8e1e('0x6'));var logger=require(_0x8e1e('0x7'))(_0x8e1e('0x8'));var config=require(_0x8e1e('0x9'));var jayson=require(_0x8e1e('0xa'));var client=jayson[_0x8e1e('0xb')][_0x8e1e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x471cd5,_0x15f937,_0x530570){return new BPromise(function(_0x280250,_0x5792df){return client[_0x8e1e('0xd')](_0x471cd5,_0x530570)[_0x8e1e('0xe')](function(_0xc0ecf){logger[_0x8e1e('0xf')](_0x8e1e('0x10'),_0x15f937,_0x8e1e('0x11'));logger[_0x8e1e('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x15f937,_0x8e1e('0x11'),JSON[_0x8e1e('0x13')](_0xc0ecf));if(_0xc0ecf[_0x8e1e('0x14')]){if(_0xc0ecf[_0x8e1e('0x14')][_0x8e1e('0x15')]===0x1f4){logger[_0x8e1e('0x14')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x15f937,_0xc0ecf[_0x8e1e('0x14')][_0x8e1e('0x16')]);return _0x5792df(_0xc0ecf['error']['message']);}logger['error'](_0x8e1e('0x10'),_0x15f937,_0xc0ecf[_0x8e1e('0x14')][_0x8e1e('0x16')]);return _0x280250(_0xc0ecf['error']['message']);}else{logger[_0x8e1e('0xf')](_0x8e1e('0x10'),_0x15f937,_0x8e1e('0x11'));_0x280250(_0xc0ecf[_0x8e1e('0x17')][_0x8e1e('0x16')]);}})[_0x8e1e('0x18')](function(_0x1b7d96){logger[_0x8e1e('0x14')](_0x8e1e('0x10'),_0x15f937,_0x1b7d96);_0x5792df(_0x1b7d96);});});} \ No newline at end of file +var _0x7a67=['client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x196aed,_0x13a06a){var _0x433140=function(_0x4a8c8d){while(--_0x4a8c8d){_0x196aed['push'](_0x196aed['shift']());}};_0x433140(++_0x13a06a);}(_0x7a67,0xde));var _0x77a6=function(_0x4e8b9c,_0x4b1f43){_0x4e8b9c=_0x4e8b9c-0x0;var _0x576ffe=_0x7a67[_0x4e8b9c];return _0x576ffe;};'use strict';var _=require(_0x77a6('0x0'));var util=require(_0x77a6('0x1'));var moment=require(_0x77a6('0x2'));var BPromise=require(_0x77a6('0x3'));var rs=require(_0x77a6('0x4'));var fs=require('fs');var Redis=require(_0x77a6('0x5'));var db=require(_0x77a6('0x6'))['db'];var utils=require(_0x77a6('0x7'));var logger=require(_0x77a6('0x8'))(_0x77a6('0x9'));var config=require(_0x77a6('0xa'));var jayson=require(_0x77a6('0xb'));var client=jayson[_0x77a6('0xc')][_0x77a6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x20c981,_0x1b7bbe,_0x57a98){return new BPromise(function(_0x48e44c,_0xd0b4f2){return client[_0x77a6('0xe')](_0x20c981,_0x57a98)[_0x77a6('0xf')](function(_0x2b3ca5){logger[_0x77a6('0x10')](_0x77a6('0x11'),_0x1b7bbe,_0x77a6('0x12'));logger[_0x77a6('0x13')](_0x77a6('0x14'),_0x1b7bbe,_0x77a6('0x12'),JSON[_0x77a6('0x15')](_0x2b3ca5));if(_0x2b3ca5['error']){if(_0x2b3ca5[_0x77a6('0x16')]['code']===0x1f4){logger[_0x77a6('0x16')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1b7bbe,_0x2b3ca5[_0x77a6('0x16')]['message']);return _0xd0b4f2(_0x2b3ca5['error'][_0x77a6('0x17')]);}logger['error'](_0x77a6('0x11'),_0x1b7bbe,_0x2b3ca5['error'][_0x77a6('0x17')]);return _0x48e44c(_0x2b3ca5[_0x77a6('0x16')][_0x77a6('0x17')]);}else{logger[_0x77a6('0x10')](_0x77a6('0x11'),_0x1b7bbe,_0x77a6('0x12'));_0x48e44c(_0x2b3ca5[_0x77a6('0x18')][_0x77a6('0x17')]);}})[_0x77a6('0x19')](function(_0x47c46d){logger[_0x77a6('0x16')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1b7bbe,_0x47c46d);_0xd0b4f2(_0x47c46d);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7570a93..eabe2f0 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 _0x3e74=['connect-timeout','express','../../components/interaction/service','./intFreshdeskField.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','multer','path'];(function(_0x2bfb31,_0xdd9aae){var _0x2b00ce=function(_0x3ddbfa){while(--_0x3ddbfa){_0x2bfb31['push'](_0x2bfb31['shift']());}};_0x2b00ce(++_0xdd9aae);}(_0x3e74,0x175));var _0x43e7=function(_0x393fab,_0x53149e){_0x393fab=_0x393fab-0x0;var _0x1a7b99=_0x3e74[_0x393fab];return _0x1a7b99;};'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 auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0xa')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0xb')]);router['put'](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0xd')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xe')]);module['exports']=router; \ No newline at end of file +var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x56395a,_0x429014){var _0xc3fea9=function(_0x13af8c){while(--_0x13af8c){_0x56395a['push'](_0x56395a['shift']());}};_0xc3fea9(++_0x429014);}(_0x008c,0x188));var _0xc008=function(_0x581dd6,_0x23847f){_0x581dd6=_0x581dd6-0x0;var _0x4faeb3=_0x008c[_0x581dd6];return _0x4faeb3;};'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 auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 151947f..d0df7a1 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 _0xb43b=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x515d51,_0x247954){var _0x45ebed=function(_0x13fb8a){while(--_0x13fb8a){_0x515d51['push'](_0x515d51['shift']());}};_0x45ebed(++_0x247954);}(_0xb43b,0xbf));var _0xbb43=function(_0xb1a7d,_0x53da71){_0xb1a7d=_0xb1a7d-0x0;var _0x4286a9=_0xb43b[_0xb1a7d];return _0x4286a9;};'use strict';var Sequelize=require(_0xbb43('0x0'));module['exports']={'type':{'type':Sequelize[_0xbb43('0x1')](_0xbb43('0x2'),_0xbb43('0x3'),_0xbb43('0x4'),_0xbb43('0x5')),'defaultValue':_0xbb43('0x2')},'content':{'type':Sequelize[_0xbb43('0x6')]},'key':{'type':Sequelize[_0xbb43('0x6')]},'keyType':{'type':Sequelize[_0xbb43('0x1')](_0xbb43('0x2'),_0xbb43('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xbb43('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbb43('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb43('0x6')]}}; \ No newline at end of file +var _0x0f16=['STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x584323,_0x30fe07){var _0x31f794=function(_0x374c50){while(--_0x374c50){_0x584323['push'](_0x584323['shift']());}};_0x31f794(++_0x30fe07);}(_0x0f16,0x192));var _0x60f1=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0f16[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x60f1('0x0'));module[_0x60f1('0x1')]={'type':{'type':Sequelize['ENUM'](_0x60f1('0x2'),_0x60f1('0x3'),_0x60f1('0x4'),_0x60f1('0x5')),'defaultValue':_0x60f1('0x2')},'content':{'type':Sequelize[_0x60f1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x60f1('0x7')](_0x60f1('0x2'),_0x60f1('0x3'),_0x60f1('0x4'))},'keyContent':{'type':Sequelize[_0x60f1('0x6')]},'idField':{'type':Sequelize[_0x60f1('0x6')]},'nameField':{'type':Sequelize[_0x60f1('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x60f1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 47a1d62..dbe233e 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 _0x79e3=['../../config/environment','sendStatus','end','status','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','FreshdeskField','count','includeAll','include','rows','show','params','fields','length','find','catch','create','body','destroy','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x56fdb6,_0x5028db){var _0xdf8147=function(_0x76fe0){while(--_0x76fe0){_0x56fdb6['push'](_0x56fdb6['shift']());}};_0xdf8147(++_0x5028db);}(_0x79e3,0x77));var _0x379e=function(_0x370418,_0x48f388){_0x370418=_0x370418-0x0;var _0x2ff973=_0x79e3[_0x370418];return _0x2ff973;};'use strict';var pdf=require(_0x379e('0x0'));var emlformat=require(_0x379e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x379e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x379e('0x3'));var moment=require(_0x379e('0x4'));var BPromise=require(_0x379e('0x5'));var Mustache=require(_0x379e('0x6'));var util=require(_0x379e('0x7'));var path=require('path');var sox=require(_0x379e('0x8'));var csv=require(_0x379e('0x9'));var ejs=require(_0x379e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x379e('0xb'));var jsforce=require(_0x379e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x379e('0x9'));var querystring=require(_0x379e('0xd'));var Papa=require(_0x379e('0xe'));var Redis=require('ioredis');var authService=require(_0x379e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x379e('0x10'));var hardwareService=require(_0x379e('0x11'));var logger=require(_0x379e('0x12'))(_0x379e('0x13'));var utils=require(_0x379e('0x14'));var config=require(_0x379e('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a69bd,_0x30e572){_0x30e572=_0x30e572||0xcc;return function(_0x30f921){if(_0x30f921){return _0x5a69bd[_0x379e('0x16')](_0x30e572);}return _0x5a69bd['status'](_0x30e572)[_0x379e('0x17')]();};}function respondWithResult(_0x488c12,_0x5efa8c){_0x5efa8c=_0x5efa8c||0xc8;return function(_0x4bd45f){if(_0x4bd45f){return _0x488c12[_0x379e('0x18')](_0x5efa8c)['json'](_0x4bd45f);}};}function respondWithFilteredResult(_0x2e0e9a,_0x24b7f6){return function(_0x11b34f){if(_0x11b34f){var _0x2a7d53=_0x11b34f['count'],_0x457825=_0x24b7f6[_0x379e('0x19')],_0x531dab=_0x24b7f6[_0x379e('0x19')]+_0x24b7f6[_0x379e('0x1a')],_0x486b5d;if(_0x531dab>=_0x2a7d53){_0x531dab=_0x2a7d53;_0x486b5d=0xc8;}else{_0x486b5d=0xce;}_0x2e0e9a[_0x379e('0x18')](_0x486b5d);return _0x2e0e9a['set'](_0x379e('0x1b'),_0x457825+'-'+_0x531dab+'/'+_0x2a7d53)['json'](_0x11b34f);}return null;};}function patchUpdates(_0x49e339){return function(_0x3332a7){try{jsonpatch[_0x379e('0x1c')](_0x3332a7,_0x49e339,!![]);}catch(_0x3328ee){return BPromise[_0x379e('0x1d')](_0x3328ee);}return _0x3332a7[_0x379e('0x1e')]();};}function saveUpdates(_0x460c8a,_0x2852b6){return function(_0xb69298){if(_0xb69298){return _0xb69298[_0x379e('0x1f')](_0x460c8a)[_0x379e('0x20')](function(_0x1e04ca){return _0x1e04ca;});}return null;};}function removeEntity(_0x1b7b06,_0x5eebed){return function(_0x187ad1){if(_0x187ad1){return _0x187ad1['destroy']()[_0x379e('0x20')](function(){_0x1b7b06[_0x379e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd6204a,_0x7dbb4a){return function(_0x12cd4b){if(!_0x12cd4b){_0xd6204a[_0x379e('0x16')](0x194);}return _0x12cd4b;};}function handleError(_0x3a5a13,_0x34411d){_0x34411d=_0x34411d||0x1f4;return function(_0x489dc2){logger[_0x379e('0x21')](_0x489dc2['stack']);if(_0x489dc2[_0x379e('0x22')]){delete _0x489dc2[_0x379e('0x22')];}_0x3a5a13[_0x379e('0x18')](_0x34411d)[_0x379e('0x23')](_0x489dc2);};}exports[_0x379e('0x24')]=function(_0x1383e4,_0x450ebe){var _0x5a90f3={},_0x4894a0={},_0x3b6be1={'count':0x0,'rows':[]};var _0x46bd61=_[_0x379e('0x25')](db['FreshdeskField'][_0x379e('0x26')],function(_0x533c4b){return{'name':_0x533c4b[_0x379e('0x27')],'type':_0x533c4b[_0x379e('0x28')][_0x379e('0x29')]};});_0x4894a0[_0x379e('0x2a')]=_[_0x379e('0x25')](_0x46bd61,_0x379e('0x22'));_0x4894a0[_0x379e('0x2b')]=_[_0x379e('0x2c')](_0x1383e4[_0x379e('0x2b')]);_0x4894a0[_0x379e('0x2d')]=_[_0x379e('0x2e')](_0x4894a0[_0x379e('0x2a')],_0x4894a0[_0x379e('0x2b')]);_0x5a90f3[_0x379e('0x2f')]=_[_0x379e('0x2e')](_0x4894a0[_0x379e('0x2a')],qs['fields'](_0x1383e4[_0x379e('0x2b')]['fields']));_0x5a90f3[_0x379e('0x2f')]=_0x5a90f3[_0x379e('0x2f')]['length']?_0x5a90f3['attributes']:_0x4894a0[_0x379e('0x2a')];if(!_0x1383e4['query'][_0x379e('0x30')]('nolimit')){_0x5a90f3[_0x379e('0x1a')]=qs[_0x379e('0x1a')](_0x1383e4[_0x379e('0x2b')][_0x379e('0x1a')]);_0x5a90f3[_0x379e('0x19')]=qs[_0x379e('0x19')](_0x1383e4[_0x379e('0x2b')][_0x379e('0x19')]);}_0x5a90f3[_0x379e('0x31')]=qs['sort'](_0x1383e4['query'][_0x379e('0x32')]);_0x5a90f3[_0x379e('0x33')]=qs['filters'](_['pick'](_0x1383e4[_0x379e('0x2b')],_0x4894a0[_0x379e('0x2d')]),_0x46bd61);if(_0x1383e4['query'][_0x379e('0x34')]){_0x5a90f3[_0x379e('0x33')]=_[_0x379e('0x35')](_0x5a90f3[_0x379e('0x33')],{'$or':_[_0x379e('0x25')](_0x46bd61,function(_0x3e746a){if(_0x3e746a['type']!==_0x379e('0x36')){var _0x20c6ff={};_0x20c6ff[_0x3e746a[_0x379e('0x22')]]={'$like':'%'+_0x1383e4[_0x379e('0x2b')][_0x379e('0x34')]+'%'};return _0x20c6ff;}})});}_0x5a90f3=_['merge']({},_0x5a90f3,_0x1383e4[_0x379e('0x37')]);var _0x370bd4={'where':_0x5a90f3[_0x379e('0x33')]};return db[_0x379e('0x38')]['count'](_0x370bd4)[_0x379e('0x20')](function(_0x3b8c72){_0x3b6be1[_0x379e('0x39')]=_0x3b8c72;if(_0x1383e4[_0x379e('0x2b')][_0x379e('0x3a')]){_0x5a90f3[_0x379e('0x3b')]=[{'all':!![]}];}return db[_0x379e('0x38')]['findAll'](_0x5a90f3);})['then'](function(_0x515466){_0x3b6be1[_0x379e('0x3c')]=_0x515466;return _0x3b6be1;})[_0x379e('0x20')](respondWithFilteredResult(_0x450ebe,_0x5a90f3))['catch'](handleError(_0x450ebe,null));};exports[_0x379e('0x3d')]=function(_0x5f2b9c,_0x5ce85f){var _0x29b3e9={'raw':!![],'where':{'id':_0x5f2b9c[_0x379e('0x3e')]['id']}},_0x161fcf={};_0x161fcf[_0x379e('0x2a')]=_[_0x379e('0x2c')](db[_0x379e('0x38')][_0x379e('0x26')]);_0x161fcf[_0x379e('0x2b')]=_[_0x379e('0x2c')](_0x5f2b9c[_0x379e('0x2b')]);_0x161fcf['filters']=_[_0x379e('0x2e')](_0x161fcf[_0x379e('0x2a')],_0x161fcf[_0x379e('0x2b')]);_0x29b3e9[_0x379e('0x2f')]=_[_0x379e('0x2e')](_0x161fcf['model'],qs[_0x379e('0x3f')](_0x5f2b9c['query'][_0x379e('0x3f')]));_0x29b3e9[_0x379e('0x2f')]=_0x29b3e9[_0x379e('0x2f')][_0x379e('0x40')]?_0x29b3e9[_0x379e('0x2f')]:_0x161fcf[_0x379e('0x2a')];if(_0x5f2b9c[_0x379e('0x2b')]['includeAll']){_0x29b3e9['include']=[{'all':!![]}];}_0x29b3e9=_[_0x379e('0x35')]({},_0x29b3e9,_0x5f2b9c[_0x379e('0x37')]);return db[_0x379e('0x38')][_0x379e('0x41')](_0x29b3e9)[_0x379e('0x20')](handleEntityNotFound(_0x5ce85f,null))[_0x379e('0x20')](respondWithResult(_0x5ce85f,null))[_0x379e('0x42')](handleError(_0x5ce85f,null));};exports[_0x379e('0x43')]=function(_0x431ad0,_0x35f8e0){return db[_0x379e('0x38')]['create'](_0x431ad0[_0x379e('0x44')],{})['then'](respondWithResult(_0x35f8e0,0xc9))['catch'](handleError(_0x35f8e0,null));};exports[_0x379e('0x1f')]=function(_0x4e7e5c,_0x5e3333){if(_0x4e7e5c['body']['id']){delete _0x4e7e5c[_0x379e('0x44')]['id'];}return db[_0x379e('0x38')][_0x379e('0x41')]({'where':{'id':_0x4e7e5c[_0x379e('0x3e')]['id']}})[_0x379e('0x20')](handleEntityNotFound(_0x5e3333,null))[_0x379e('0x20')](saveUpdates(_0x4e7e5c[_0x379e('0x44')],null))[_0x379e('0x20')](respondWithResult(_0x5e3333,null))[_0x379e('0x42')](handleError(_0x5e3333,null));};exports[_0x379e('0x45')]=function(_0x5e4ba2,_0x24872b){return db['FreshdeskField'][_0x379e('0x41')]({'where':{'id':_0x5e4ba2['params']['id']}})[_0x379e('0x20')](handleEntityNotFound(_0x24872b,null))[_0x379e('0x20')](removeEntity(_0x24872b,null))['catch'](handleError(_0x24872b,null));}; \ No newline at end of file +var _0xb654=['json','count','offset','limit','set','Content-Range','reject','save','update','destroy','error','stack','send','FreshdeskField','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','then','rows','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x569407,_0x115d0f){var _0x51d1e3=function(_0x191efb){while(--_0x191efb){_0x569407['push'](_0x569407['shift']());}};_0x51d1e3(++_0x115d0f);}(_0xb654,0xc3));var _0x4b65=function(_0x57d83b,_0x1b1fa9){_0x57d83b=_0x57d83b-0x0;var _0x584460=_0xb654[_0x57d83b];return _0x584460;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4b65('0x0'));var rimraf=require(_0x4b65('0x1'));var zipdir=require(_0x4b65('0x2'));var jsonpatch=require(_0x4b65('0x3'));var rp=require('request-promise');var moment=require(_0x4b65('0x4'));var BPromise=require(_0x4b65('0x5'));var Mustache=require(_0x4b65('0x6'));var util=require('util');var path=require(_0x4b65('0x7'));var sox=require('sox');var csv=require(_0x4b65('0x8'));var ejs=require(_0x4b65('0x9'));var fs=require('fs');var _=require(_0x4b65('0xa'));var squel=require(_0x4b65('0xb'));var crypto=require(_0x4b65('0xc'));var jsforce=require(_0x4b65('0xd'));var deskjs=require(_0x4b65('0xe'));var toCsv=require(_0x4b65('0x8'));var querystring=require(_0x4b65('0xf'));var Papa=require(_0x4b65('0x10'));var Redis=require(_0x4b65('0x11'));var authService=require(_0x4b65('0x12'));var qs=require(_0x4b65('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b65('0x14'));var utils=require(_0x4b65('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4b65('0x16'));var db=require(_0x4b65('0x17'))['db'];function respondWithStatusCode(_0xe5879e,_0xb28760){_0xb28760=_0xb28760||0xcc;return function(_0x16978a){if(_0x16978a){return _0xe5879e[_0x4b65('0x18')](_0xb28760);}return _0xe5879e[_0x4b65('0x19')](_0xb28760)[_0x4b65('0x1a')]();};}function respondWithResult(_0x40a6d7,_0x51c5e6){_0x51c5e6=_0x51c5e6||0xc8;return function(_0x1c4fff){if(_0x1c4fff){return _0x40a6d7['status'](_0x51c5e6)[_0x4b65('0x1b')](_0x1c4fff);}};}function respondWithFilteredResult(_0x4e5f6e,_0x560d6b){return function(_0x5c8e6e){if(_0x5c8e6e){var _0x50b5a1=_0x5c8e6e[_0x4b65('0x1c')],_0x59b1ae=_0x560d6b[_0x4b65('0x1d')],_0x347a14=_0x560d6b['offset']+_0x560d6b[_0x4b65('0x1e')],_0x62c13e;if(_0x347a14>=_0x50b5a1){_0x347a14=_0x50b5a1;_0x62c13e=0xc8;}else{_0x62c13e=0xce;}_0x4e5f6e[_0x4b65('0x19')](_0x62c13e);return _0x4e5f6e[_0x4b65('0x1f')](_0x4b65('0x20'),_0x59b1ae+'-'+_0x347a14+'/'+_0x50b5a1)[_0x4b65('0x1b')](_0x5c8e6e);}return null;};}function patchUpdates(_0x558f61){return function(_0x2aab4b){try{jsonpatch['apply'](_0x2aab4b,_0x558f61,!![]);}catch(_0x5989cf){return BPromise[_0x4b65('0x21')](_0x5989cf);}return _0x2aab4b[_0x4b65('0x22')]();};}function saveUpdates(_0x3f0ebd,_0x1ed573){return function(_0x4f85e9){if(_0x4f85e9){return _0x4f85e9[_0x4b65('0x23')](_0x3f0ebd)['then'](function(_0x4c8e4d){return _0x4c8e4d;});}return null;};}function removeEntity(_0xcda742,_0x3362e0){return function(_0x50a8e8){if(_0x50a8e8){return _0x50a8e8[_0x4b65('0x24')]()['then'](function(){_0xcda742['status'](0xcc)[_0x4b65('0x1a')]();});}};}function handleEntityNotFound(_0x23f318,_0x50bdf4){return function(_0x37197d){if(!_0x37197d){_0x23f318['sendStatus'](0x194);}return _0x37197d;};}function handleError(_0xfa42a7,_0x359067){_0x359067=_0x359067||0x1f4;return function(_0x7e6c5){logger[_0x4b65('0x25')](_0x7e6c5[_0x4b65('0x26')]);if(_0x7e6c5['name']){delete _0x7e6c5['name'];}_0xfa42a7[_0x4b65('0x19')](_0x359067)[_0x4b65('0x27')](_0x7e6c5);};}exports['index']=function(_0x34416d,_0x36fb06){var _0x1c668c={},_0x2d07b2={},_0x2d9822={'count':0x0,'rows':[]};var _0x37fb05=_['map'](db[_0x4b65('0x28')][_0x4b65('0x29')],function(_0x18b1ce){return{'name':_0x18b1ce[_0x4b65('0x2a')],'type':_0x18b1ce[_0x4b65('0x2b')][_0x4b65('0x2c')]};});_0x2d07b2[_0x4b65('0x2d')]=_[_0x4b65('0x2e')](_0x37fb05,_0x4b65('0x2f'));_0x2d07b2[_0x4b65('0x30')]=_[_0x4b65('0x31')](_0x34416d[_0x4b65('0x30')]);_0x2d07b2[_0x4b65('0x32')]=_[_0x4b65('0x33')](_0x2d07b2[_0x4b65('0x2d')],_0x2d07b2['query']);_0x1c668c[_0x4b65('0x34')]=_['intersection'](_0x2d07b2['model'],qs[_0x4b65('0x35')](_0x34416d[_0x4b65('0x30')][_0x4b65('0x35')]));_0x1c668c[_0x4b65('0x34')]=_0x1c668c['attributes']['length']?_0x1c668c[_0x4b65('0x34')]:_0x2d07b2[_0x4b65('0x2d')];if(!_0x34416d[_0x4b65('0x30')][_0x4b65('0x36')]('nolimit')){_0x1c668c[_0x4b65('0x1e')]=qs[_0x4b65('0x1e')](_0x34416d['query'][_0x4b65('0x1e')]);_0x1c668c[_0x4b65('0x1d')]=qs[_0x4b65('0x1d')](_0x34416d[_0x4b65('0x30')]['offset']);}_0x1c668c[_0x4b65('0x37')]=qs[_0x4b65('0x38')](_0x34416d['query'][_0x4b65('0x38')]);_0x1c668c[_0x4b65('0x39')]=qs[_0x4b65('0x32')](_[_0x4b65('0x3a')](_0x34416d[_0x4b65('0x30')],_0x2d07b2[_0x4b65('0x32')]),_0x37fb05);if(_0x34416d[_0x4b65('0x30')][_0x4b65('0x3b')]){_0x1c668c[_0x4b65('0x39')]=_[_0x4b65('0x3c')](_0x1c668c[_0x4b65('0x39')],{'$or':_[_0x4b65('0x2e')](_0x37fb05,function(_0x57e1fe){if(_0x57e1fe[_0x4b65('0x2b')]!==_0x4b65('0x3d')){var _0x2672ee={};_0x2672ee[_0x57e1fe[_0x4b65('0x2f')]]={'$like':'%'+_0x34416d[_0x4b65('0x30')][_0x4b65('0x3b')]+'%'};return _0x2672ee;}})});}_0x1c668c=_[_0x4b65('0x3c')]({},_0x1c668c,_0x34416d['options']);var _0x3e3e80={'where':_0x1c668c['where']};return db[_0x4b65('0x28')][_0x4b65('0x1c')](_0x3e3e80)['then'](function(_0x2abc57){_0x2d9822['count']=_0x2abc57;if(_0x34416d[_0x4b65('0x30')][_0x4b65('0x3e')]){_0x1c668c[_0x4b65('0x3f')]=[{'all':!![]}];}return db[_0x4b65('0x28')][_0x4b65('0x40')](_0x1c668c);})[_0x4b65('0x41')](function(_0x26d235){_0x2d9822[_0x4b65('0x42')]=_0x26d235;return _0x2d9822;})['then'](respondWithFilteredResult(_0x36fb06,_0x1c668c))[_0x4b65('0x43')](handleError(_0x36fb06,null));};exports[_0x4b65('0x44')]=function(_0x323df0,_0x35a4dc){var _0x535c18={'raw':!![],'where':{'id':_0x323df0['params']['id']}},_0x315eb8={};_0x315eb8['model']=_['keys'](db['FreshdeskField'][_0x4b65('0x29')]);_0x315eb8[_0x4b65('0x30')]=_['keys'](_0x323df0['query']);_0x315eb8['filters']=_[_0x4b65('0x33')](_0x315eb8[_0x4b65('0x2d')],_0x315eb8['query']);_0x535c18[_0x4b65('0x34')]=_[_0x4b65('0x33')](_0x315eb8[_0x4b65('0x2d')],qs[_0x4b65('0x35')](_0x323df0[_0x4b65('0x30')][_0x4b65('0x35')]));_0x535c18[_0x4b65('0x34')]=_0x535c18[_0x4b65('0x34')]['length']?_0x535c18['attributes']:_0x315eb8[_0x4b65('0x2d')];if(_0x323df0[_0x4b65('0x30')][_0x4b65('0x3e')]){_0x535c18[_0x4b65('0x3f')]=[{'all':!![]}];}_0x535c18=_[_0x4b65('0x3c')]({},_0x535c18,_0x323df0[_0x4b65('0x45')]);return db[_0x4b65('0x28')][_0x4b65('0x46')](_0x535c18)['then'](handleEntityNotFound(_0x35a4dc,null))[_0x4b65('0x41')](respondWithResult(_0x35a4dc,null))['catch'](handleError(_0x35a4dc,null));};exports[_0x4b65('0x47')]=function(_0xd0859f,_0x506b2a){return db[_0x4b65('0x28')]['create'](_0xd0859f[_0x4b65('0x48')],{})[_0x4b65('0x41')](respondWithResult(_0x506b2a,0xc9))['catch'](handleError(_0x506b2a,null));};exports[_0x4b65('0x23')]=function(_0x2332ce,_0x34bd9f){if(_0x2332ce['body']['id']){delete _0x2332ce['body']['id'];}return db[_0x4b65('0x28')][_0x4b65('0x46')]({'where':{'id':_0x2332ce[_0x4b65('0x49')]['id']}})['then'](handleEntityNotFound(_0x34bd9f,null))[_0x4b65('0x41')](saveUpdates(_0x2332ce[_0x4b65('0x48')],null))[_0x4b65('0x41')](respondWithResult(_0x34bd9f,null))['catch'](handleError(_0x34bd9f,null));};exports['destroy']=function(_0x2075ed,_0x1b24a5){return db['FreshdeskField']['find']({'where':{'id':_0x2075ed[_0x4b65('0x49')]['id']}})[_0x4b65('0x41')](handleEntityNotFound(_0x1b24a5,null))[_0x4b65('0x41')](removeEntity(_0x1b24a5,null))[_0x4b65('0x43')](handleError(_0x1b24a5,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 7a8173d..a025790 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 _0xf4eb=['path','rimraf','../../config/environment','exports','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','bluebird','request-promise'];(function(_0x1cc1fd,_0x33f9f1){var _0x5e3d41=function(_0x356881){while(--_0x356881){_0x1cc1fd['push'](_0x1cc1fd['shift']());}};_0x5e3d41(++_0x33f9f1);}(_0xf4eb,0x188));var _0xbf4e=function(_0x544d30,_0x127188){_0x544d30=_0x544d30-0x0;var _0x281a76=_0xf4eb[_0x544d30];return _0x281a76;};'use strict';var _=require(_0xbf4e('0x0'));var util=require(_0xbf4e('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x2'));var rp=require(_0xbf4e('0x3'));var fs=require('fs');var path=require(_0xbf4e('0x4'));var rimraf=require(_0xbf4e('0x5'));var config=require(_0xbf4e('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0xbf4e('0x7')]=function(_0x343fc2,_0x1f8a32){return _0x343fc2['define']('FreshdeskField',attributes,{'tableName':_0xbf4e('0x8'),'paranoid':![],'indexes':[{'name':_0xbf4e('0x9'),'fields':[_0xbf4e('0xa'),_0xbf4e('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2dec=['rimraf','./intFreshdeskField.attributes','exports','define','int_freshdesk_fields','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x35c287,_0x32da43){var _0x91b030=function(_0x1e2e36){while(--_0x1e2e36){_0x35c287['push'](_0x35c287['shift']());}};_0x91b030(++_0x32da43);}(_0x2dec,0x13a));var _0xc2de=function(_0x50ce0c,_0x541b68){_0x50ce0c=_0x50ce0c-0x0;var _0x3c988c=_0x2dec[_0x50ce0c];return _0x3c988c;};'use strict';var _=require(_0xc2de('0x0'));var util=require(_0xc2de('0x1'));var logger=require(_0xc2de('0x2'))(_0xc2de('0x3'));var moment=require(_0xc2de('0x4'));var BPromise=require(_0xc2de('0x5'));var rp=require(_0xc2de('0x6'));var fs=require('fs');var path=require(_0xc2de('0x7'));var rimraf=require(_0xc2de('0x8'));var config=require('../../config/environment');var attributes=require(_0xc2de('0x9'));module[_0xc2de('0xa')]=function(_0xb4d49a,_0x3b9690){return _0xb4d49a[_0xc2de('0xb')]('FreshdeskField',attributes,{'tableName':_0xc2de('0xc'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0xc2de('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 675699c..9a0de39 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 _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x51ad6f,_0x5385c2){_0x51ad6f=_0x51ad6f-0x0;var _0x32e68b=_0x7a54[_0x51ad6f];return _0x32e68b;};'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')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','FreshdeskField,\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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x117b6c,_0x32e403){_0x117b6c=_0x117b6c-0x0;var _0x3709b7=_0x7a54[_0x117b6c];return _0x3709b7;};'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')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a569ca6..6f16914 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 _0x9f84=['put','update','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration'];(function(_0x54b705,_0x3d8513){var _0x1bbe6a=function(_0x508c81){while(--_0x508c81){_0x54b705['push'](_0x54b705['shift']());}};_0x1bbe6a(++_0x3d8513);}(_0x9f84,0x17f));var _0x49f8=function(_0xb11807,_0x3ad4d8){_0xb11807=_0xb11807-0x0;var _0x4e0025=_0x9f84[_0xb11807];return _0x4e0025;};'use strict';var multer=require('multer');var util=require(_0x49f8('0x0'));var path=require(_0x49f8('0x1'));var timeout=require(_0x49f8('0x2'));var express=require('express');var router=express[_0x49f8('0x3')]();var auth=require(_0x49f8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x49f8('0x5'));var controller=require(_0x49f8('0x6'));router[_0x49f8('0x7')]('/',auth[_0x49f8('0x8')](),controller[_0x49f8('0x9')]);router[_0x49f8('0x7')](_0x49f8('0xa'),auth[_0x49f8('0x8')](),controller['show']);router[_0x49f8('0x7')](_0x49f8('0xb'),auth[_0x49f8('0x8')](),controller['getConfigurations']);router['get'](_0x49f8('0xc'),auth['isAuthenticated'](),controller[_0x49f8('0xd')]);router['post']('/',auth[_0x49f8('0x8')](),controller[_0x49f8('0xe')]);router[_0x49f8('0xf')]('/:id/configurations',auth[_0x49f8('0x8')](),controller[_0x49f8('0x10')]);router[_0x49f8('0x11')](_0x49f8('0xa'),auth['isAuthenticated'](),controller[_0x49f8('0x12')]);router['delete'](_0x49f8('0xa'),auth[_0x49f8('0x8')](),controller[_0x49f8('0x13')]);module['exports']=router; \ No newline at end of file +var _0x411e=['put','update','delete','destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x4a1353,_0x2fbe86){var _0x3805cc=function(_0x39a7ee){while(--_0x39a7ee){_0x4a1353['push'](_0x4a1353['shift']());}};_0x3805cc(++_0x2fbe86);}(_0x411e,0x130));var _0xe411=function(_0x30b159,_0x3fbb50){_0x30b159=_0x30b159-0x0;var _0x23c3f9=_0x411e[_0x30b159];return _0x23c3f9;};'use strict';var multer=require(_0xe411('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe411('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xe411('0x2'));var interaction=require(_0xe411('0x3'));var config=require(_0xe411('0x4'));var controller=require(_0xe411('0x5'));router[_0xe411('0x6')]('/',auth[_0xe411('0x7')](),controller[_0xe411('0x8')]);router['get'](_0xe411('0x9'),auth[_0xe411('0x7')](),controller[_0xe411('0xa')]);router[_0xe411('0x6')](_0xe411('0xb'),auth[_0xe411('0x7')](),controller[_0xe411('0xc')]);router[_0xe411('0x6')](_0xe411('0xd'),auth[_0xe411('0x7')](),controller[_0xe411('0xe')]);router[_0xe411('0xf')]('/',auth['isAuthenticated'](),controller[_0xe411('0x10')]);router[_0xe411('0xf')](_0xe411('0xb'),auth[_0xe411('0x7')](),controller[_0xe411('0x11')]);router[_0xe411('0x12')](_0xe411('0x9'),auth['isAuthenticated'](),controller[_0xe411('0x13')]);router[_0xe411('0x14')](_0xe411('0x9'),auth[_0xe411('0x7')](),controller[_0xe411('0x15')]);module[_0xe411('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 09f35b2..7b0a847 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 _0x3d2f=['exports','STRING','username','remoteUri','sequelize'];(function(_0x14aee9,_0x596a94){var _0x6de2f7=function(_0x4561e3){while(--_0x4561e3){_0x14aee9['push'](_0x14aee9['shift']());}};_0x6de2f7(++_0x596a94);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x5a10b2,_0x22d5e9){_0x5a10b2=_0x5a10b2-0x0;var _0x329a7c=_0x3d2f[_0x5a10b2];return _0x329a7c;};'use strict';var Sequelize=require(_0xf3d2('0x0'));module[_0xf3d2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf3d2('0x2')]},'username':{'type':Sequelize[_0xf3d2('0x2')],'unique':_0xf3d2('0x3')},'apiKey':{'type':Sequelize[_0xf3d2('0x2')]},'remoteUri':{'type':Sequelize[_0xf3d2('0x2')],'unique':_0xf3d2('0x4')},'serverUrl':{'type':Sequelize[_0xf3d2('0x2')]}}; \ No newline at end of file +var _0x4f08=['sequelize','exports','STRING','remoteUri'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x4f08,0x194));var _0x84f0=function(_0xb1d9de,_0x42b971){_0xb1d9de=_0xb1d9de-0x0;var _0x1a6c32=_0x4f08[_0xb1d9de];return _0x1a6c32;};'use strict';var Sequelize=require(_0x84f0('0x0'));module[_0x84f0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x84f0('0x2')]},'username':{'type':Sequelize[_0x84f0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x84f0('0x2')]},'remoteUri':{'type':Sequelize[_0x84f0('0x2')],'unique':_0x84f0('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 6f830ab..fe694dc 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 _0xb49a=['AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','Subjects','getFields','username','remoteUri','slice','substring','GET','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','status','end','count','offset','Content-Range','apply','reject','save','update','stack','name','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration'];(function(_0x9c7890,_0x3cea85){var _0xec5d2b=function(_0x34d746){while(--_0x34d746){_0x9c7890['push'](_0x9c7890['shift']());}};_0xec5d2b(++_0x3cea85);}(_0xb49a,0xfb));var _0xab49=function(_0x2340e2,_0x1627f9){_0x2340e2=_0x2340e2-0x0;var _0x5ced10=_0xb49a[_0x2340e2];return _0x5ced10;};'use strict';var pdf=require(_0xab49('0x0'));var emlformat=require(_0xab49('0x1'));var rimraf=require(_0xab49('0x2'));var zipdir=require(_0xab49('0x3'));var jsonpatch=require(_0xab49('0x4'));var rp=require('request-promise');var moment=require(_0xab49('0x5'));var BPromise=require(_0xab49('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab49('0x7'));var sox=require(_0xab49('0x8'));var csv=require(_0xab49('0x9'));var ejs=require(_0xab49('0xa'));var fs=require('fs');var _=require(_0xab49('0xb'));var squel=require(_0xab49('0xc'));var crypto=require(_0xab49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab49('0xe'));var toCsv=require(_0xab49('0x9'));var querystring=require(_0xab49('0xf'));var Papa=require(_0xab49('0x10'));var Redis=require(_0xab49('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab49('0x12'));var hardwareService=require(_0xab49('0x13'));var logger=require(_0xab49('0x14'))(_0xab49('0x15'));var utils=require(_0xab49('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xab49('0x17'));var db=require(_0xab49('0x18'))['db'];var integrations=require(_0xab49('0x19'));var jayson=require(_0xab49('0x1a'));var client=jayson[_0xab49('0x1b')][_0xab49('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x11d285,_0x136f5f,_0x24b4ad,_0x389ebb){return new BPromise(function(_0x40f465,_0x5ea744){var _0xcd137f=_0x389ebb||client;return _0xcd137f[_0xab49('0x1d')](_0x11d285,_0x24b4ad)[_0xab49('0x1e')](function(_0x9c59e1){logger[_0xab49('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x136f5f,_0xab49('0x20'));logger[_0xab49('0x21')](_0xab49('0x22'),_0x136f5f,_0xab49('0x20'),JSON[_0xab49('0x23')](_0x9c59e1));if(_0x9c59e1['error']){if(_0x9c59e1[_0xab49('0x24')][_0xab49('0x25')]===0x1f4){logger[_0xab49('0x24')]('FreshsalesAccount,\x20%s,\x20%s',_0x136f5f,_0x9c59e1['error'][_0xab49('0x26')]);return _0x5ea744(_0x9c59e1[_0xab49('0x24')]['message']);}logger[_0xab49('0x24')](_0xab49('0x27'),_0x136f5f,_0x9c59e1['error'][_0xab49('0x26')]);return _0x40f465(_0x9c59e1['error'][_0xab49('0x26')]);}else{logger[_0xab49('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x136f5f,'request\x20sent');_0x40f465(_0x9c59e1[_0xab49('0x28')]['message']);}})[_0xab49('0x29')](function(_0x532788){logger[_0xab49('0x24')](_0xab49('0x27'),_0x136f5f,_0x532788);_0x5ea744(_0x532788);});});}function respondWithStatusCode(_0x2ba18a,_0x579039){_0x579039=_0x579039||0xcc;return function(_0x2bf8e0){if(_0x2bf8e0){return _0x2ba18a['sendStatus'](_0x579039);}return _0x2ba18a[_0xab49('0x2a')](_0x579039)[_0xab49('0x2b')]();};}function respondWithResult(_0x5c3d71,_0x29096f){_0x29096f=_0x29096f||0xc8;return function(_0x18e65a){if(_0x18e65a){return _0x5c3d71['status'](_0x29096f)['json'](_0x18e65a);}};}function respondWithFilteredResult(_0x11446b,_0x2e0e37){return function(_0x1b70e1){if(_0x1b70e1){var _0x5b7c22=_0x1b70e1[_0xab49('0x2c')],_0x1b1fed=_0x2e0e37[_0xab49('0x2d')],_0x237273=_0x2e0e37[_0xab49('0x2d')]+_0x2e0e37['limit'],_0x4bf0cf;if(_0x237273>=_0x5b7c22){_0x237273=_0x5b7c22;_0x4bf0cf=0xc8;}else{_0x4bf0cf=0xce;}_0x11446b[_0xab49('0x2a')](_0x4bf0cf);return _0x11446b['set'](_0xab49('0x2e'),_0x1b1fed+'-'+_0x237273+'/'+_0x5b7c22)['json'](_0x1b70e1);}return null;};}function patchUpdates(_0x19f094){return function(_0x54942c){try{jsonpatch[_0xab49('0x2f')](_0x54942c,_0x19f094,!![]);}catch(_0x24bd0f){return BPromise[_0xab49('0x30')](_0x24bd0f);}return _0x54942c[_0xab49('0x31')]();};}function saveUpdates(_0x49f122,_0x6e83f6){return function(_0x1ea20e){if(_0x1ea20e){return _0x1ea20e[_0xab49('0x32')](_0x49f122)['then'](function(_0x2b18b9){return _0x2b18b9;});}return null;};}function removeEntity(_0x569569,_0x246dee){return function(_0x4f6352){if(_0x4f6352){return _0x4f6352['destroy']()['then'](function(){_0x569569[_0xab49('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17260e,_0x2e013f){return function(_0x15c7f1){if(!_0x15c7f1){_0x17260e['sendStatus'](0x194);}return _0x15c7f1;};}function handleError(_0x114cc0,_0x1292f6){_0x1292f6=_0x1292f6||0x1f4;return function(_0x3cc88b){logger[_0xab49('0x24')](_0x3cc88b[_0xab49('0x33')]);if(_0x3cc88b['name']){delete _0x3cc88b[_0xab49('0x34')];}_0x114cc0[_0xab49('0x2a')](_0x1292f6)['send'](_0x3cc88b);};}exports['index']=function(_0x2b97e5,_0x29c6cf){var _0x30ee5e={},_0x224b7f={},_0x325ad9={'count':0x0,'rows':[]};var _0x26daf3=_[_0xab49('0x35')](db[_0xab49('0x36')][_0xab49('0x37')],function(_0x43027f){return{'name':_0x43027f[_0xab49('0x38')],'type':_0x43027f[_0xab49('0x39')][_0xab49('0x3a')]};});_0x224b7f['model']=_[_0xab49('0x35')](_0x26daf3,_0xab49('0x34'));_0x224b7f[_0xab49('0x3b')]=_[_0xab49('0x3c')](_0x2b97e5[_0xab49('0x3b')]);_0x224b7f['filters']=_[_0xab49('0x3d')](_0x224b7f['model'],_0x224b7f['query']);_0x30ee5e[_0xab49('0x3e')]=_[_0xab49('0x3d')](_0x224b7f[_0xab49('0x3f')],qs[_0xab49('0x40')](_0x2b97e5[_0xab49('0x3b')]['fields']));_0x30ee5e[_0xab49('0x3e')]=_0x30ee5e[_0xab49('0x3e')][_0xab49('0x41')]?_0x30ee5e[_0xab49('0x3e')]:_0x224b7f[_0xab49('0x3f')];if(!_0x2b97e5['query']['hasOwnProperty'](_0xab49('0x42'))){_0x30ee5e[_0xab49('0x43')]=qs[_0xab49('0x43')](_0x2b97e5['query'][_0xab49('0x43')]);_0x30ee5e['offset']=qs['offset'](_0x2b97e5['query']['offset']);}_0x30ee5e[_0xab49('0x44')]=qs[_0xab49('0x45')](_0x2b97e5[_0xab49('0x3b')][_0xab49('0x45')]);_0x30ee5e[_0xab49('0x46')]=qs[_0xab49('0x47')](_[_0xab49('0x48')](_0x2b97e5[_0xab49('0x3b')],_0x224b7f[_0xab49('0x47')]),_0x26daf3);if(_0x2b97e5[_0xab49('0x3b')]['filter']){_0x30ee5e[_0xab49('0x46')]=_[_0xab49('0x49')](_0x30ee5e['where'],{'$or':_[_0xab49('0x35')](_0x26daf3,function(_0x204ff3){if(_0x204ff3[_0xab49('0x39')]!==_0xab49('0x4a')){var _0x393959={};_0x393959[_0x204ff3[_0xab49('0x34')]]={'$like':'%'+_0x2b97e5[_0xab49('0x3b')][_0xab49('0x4b')]+'%'};return _0x393959;}})});}_0x30ee5e=_['merge']({},_0x30ee5e,_0x2b97e5[_0xab49('0x4c')]);var _0x1a0b03={'where':_0x30ee5e[_0xab49('0x46')]};return db['FreshsalesAccount'][_0xab49('0x2c')](_0x1a0b03)[_0xab49('0x1e')](function(_0x1bfd4e){_0x325ad9[_0xab49('0x2c')]=_0x1bfd4e;if(_0x2b97e5[_0xab49('0x3b')][_0xab49('0x4d')]){_0x30ee5e['include']=[{'all':!![]}];}return db[_0xab49('0x36')][_0xab49('0x4e')](_0x30ee5e);})[_0xab49('0x1e')](function(_0x33b568){_0x325ad9[_0xab49('0x4f')]=_0x33b568;return _0x325ad9;})[_0xab49('0x1e')](respondWithFilteredResult(_0x29c6cf,_0x30ee5e))['catch'](handleError(_0x29c6cf,null));};exports[_0xab49('0x50')]=function(_0x186fcf,_0x20631b){var _0xca56ce={'raw':![],'where':{'id':_0x186fcf[_0xab49('0x51')]['id']}},_0xeea2c8={};_0xeea2c8[_0xab49('0x3f')]=_[_0xab49('0x3c')](db[_0xab49('0x36')][_0xab49('0x37')]);_0xeea2c8[_0xab49('0x3b')]=_[_0xab49('0x3c')](_0x186fcf['query']);_0xeea2c8[_0xab49('0x47')]=_[_0xab49('0x3d')](_0xeea2c8[_0xab49('0x3f')],_0xeea2c8[_0xab49('0x3b')]);_0xca56ce[_0xab49('0x3e')]=_[_0xab49('0x3d')](_0xeea2c8[_0xab49('0x3f')],qs['fields'](_0x186fcf[_0xab49('0x3b')]['fields']));_0xca56ce[_0xab49('0x3e')]=_0xca56ce['attributes'][_0xab49('0x41')]?_0xca56ce[_0xab49('0x3e')]:_0xeea2c8['model'];if(_0x186fcf[_0xab49('0x3b')][_0xab49('0x4d')]){_0xca56ce[_0xab49('0x52')]=[{'all':!![]}];}_0xca56ce=_[_0xab49('0x49')]({},_0xca56ce,_0x186fcf[_0xab49('0x4c')]);return db[_0xab49('0x36')][_0xab49('0x53')](_0xca56ce)[_0xab49('0x1e')](handleEntityNotFound(_0x20631b,null))[_0xab49('0x1e')](respondWithResult(_0x20631b,null))[_0xab49('0x29')](handleError(_0x20631b,null));};exports[_0xab49('0x54')]=function(_0x360b11,_0x31955b){return db[_0xab49('0x36')][_0xab49('0x54')](_0x360b11[_0xab49('0x55')],{})[_0xab49('0x1e')](respondWithResult(_0x31955b,0xc9))['catch'](handleError(_0x31955b,null));};exports[_0xab49('0x32')]=function(_0x2a609e,_0x1dfaaa){if(_0x2a609e[_0xab49('0x55')]['id']){delete _0x2a609e[_0xab49('0x55')]['id'];}return db['FreshsalesAccount'][_0xab49('0x53')]({'where':{'id':_0x2a609e[_0xab49('0x51')]['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x1dfaaa,null))[_0xab49('0x1e')](saveUpdates(_0x2a609e[_0xab49('0x55')],null))[_0xab49('0x1e')](respondWithResult(_0x1dfaaa,null))['catch'](handleError(_0x1dfaaa,null));};exports[_0xab49('0x56')]=function(_0x1d6bd3,_0x100c5a){return db[_0xab49('0x36')]['find']({'where':{'id':_0x1d6bd3['params']['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x100c5a,null))['then'](removeEntity(_0x100c5a,null))[_0xab49('0x29')](handleError(_0x100c5a,null));};exports[_0xab49('0x57')]=function(_0xa49709,_0x2cfce0,_0xbad48e){var _0x22294f={};var _0x1ba368={};var _0x10da44;var _0x4de03d;return db[_0xab49('0x36')][_0xab49('0x58')]({'where':{'id':_0xa49709[_0xab49('0x51')]['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0x2cfce0,null))[_0xab49('0x1e')](function(_0x5205e0){if(_0x5205e0){_0x10da44=_0x5205e0;_0x1ba368[_0xab49('0x3f')]=_[_0xab49('0x3c')](db[_0xab49('0x59')][_0xab49('0x37')]);_0x1ba368[_0xab49('0x3b')]=_[_0xab49('0x3c')](_0xa49709[_0xab49('0x3b')]);_0x1ba368[_0xab49('0x47')]=_[_0xab49('0x3d')](_0x1ba368[_0xab49('0x3f')],_0x1ba368[_0xab49('0x3b')]);_0x22294f[_0xab49('0x3e')]=_[_0xab49('0x3d')](_0x1ba368['model'],qs[_0xab49('0x40')](_0xa49709[_0xab49('0x3b')][_0xab49('0x40')]));_0x22294f[_0xab49('0x3e')]=_0x22294f[_0xab49('0x3e')][_0xab49('0x41')]?_0x22294f[_0xab49('0x3e')]:_0x1ba368[_0xab49('0x3f')];_0x22294f[_0xab49('0x44')]=qs[_0xab49('0x45')](_0xa49709['query'][_0xab49('0x45')]);_0x22294f[_0xab49('0x46')]=qs['filters'](_[_0xab49('0x48')](_0xa49709[_0xab49('0x3b')],_0x1ba368[_0xab49('0x47')]));if(_0xa49709['query'][_0xab49('0x4b')]){_0x22294f[_0xab49('0x46')]=_['merge'](_0x22294f['where'],{'$or':_[_0xab49('0x35')](_0x22294f[_0xab49('0x3e')],function(_0x2acd68){var _0x48fb06={};_0x48fb06[_0x2acd68]={'$like':'%'+_0xa49709['query'][_0xab49('0x4b')]+'%'};return _0x48fb06;})});}_0x22294f=_[_0xab49('0x49')]({},_0x22294f,_0xa49709[_0xab49('0x4c')]);return _0x10da44[_0xab49('0x57')](_0x22294f);}})[_0xab49('0x1e')](function(_0x5f1325){if(_0x5f1325){_0x4de03d=_0x5f1325[_0xab49('0x41')];if(!_0xa49709[_0xab49('0x3b')]['hasOwnProperty']('nolimit')){_0x22294f[_0xab49('0x43')]=qs[_0xab49('0x43')](_0xa49709[_0xab49('0x3b')][_0xab49('0x43')]);_0x22294f[_0xab49('0x2d')]=qs[_0xab49('0x2d')](_0xa49709[_0xab49('0x3b')][_0xab49('0x2d')]);}return _0x10da44[_0xab49('0x57')](_0x22294f);}})[_0xab49('0x1e')](function(_0x47d36d){if(_0x47d36d){return _0x47d36d?{'count':_0x4de03d,'rows':_0x47d36d}:null;}})[_0xab49('0x1e')](respondWithResult(_0x2cfce0,null))[_0xab49('0x29')](handleError(_0x2cfce0,null));};exports[_0xab49('0x5a')]=function(_0x685962,_0xc80b1e,_0x219a2f){if(_0x685962[_0xab49('0x55')]['id']){delete _0x685962[_0xab49('0x55')]['id'];}return db['FreshsalesAccount'][_0xab49('0x58')]({'where':{'id':_0x685962['params']['id']}})[_0xab49('0x1e')](handleEntityNotFound(_0xc80b1e,null))[_0xab49('0x1e')](function(_0x14f179){if(_0x14f179){_0x685962['body'][_0xab49('0x5b')]=_0x14f179['id'];_0x685962[_0xab49('0x55')]['Subjects']=integrations[_0xab49('0x5c')](_0x685962[_0xab49('0x55')][_0xab49('0x5d')],_0x685962[_0xab49('0x55')][_0xab49('0x39')]);_0x685962[_0xab49('0x55')][_0xab49('0x5e')]=integrations[_0xab49('0x5f')](_0x685962[_0xab49('0x55')][_0xab49('0x5d')],_0x685962[_0xab49('0x55')][_0xab49('0x39')]);return db[_0xab49('0x59')]['create'](_0x685962[_0xab49('0x55')],{'include':[{'model':db[_0xab49('0x60')],'as':_0xab49('0x61')},{'model':db['FreshsalesField'],'as':_0xab49('0x5e')}]});}return null;})[_0xab49('0x1e')](respondWithResult(_0xc80b1e,null))['catch'](handleError(_0xc80b1e,null));};exports[_0xab49('0x62')]=function(_0x388409,_0x5c57f5,_0x18fd16){var _0x372947='';var _0x239236='';return db[_0xab49('0x36')][_0xab49('0x58')]({'where':{'id':_0x388409[_0xab49('0x51')]['id']},'attributes':['id',_0xab49('0x63'),_0xab49('0x64'),'apiKey']})['then'](handleEntityNotFound(_0x5c57f5,null))[_0xab49('0x1e')](function(_0x284158){if(_0x284158){_0x239236=_0x284158[_0xab49('0x63')];_0x372947=_0x284158[_0xab49('0x64')];var _0x20a245=_0x284158[_0xab49('0x64')][_0xab49('0x65')](-0x1);if(_0x20a245==='/'){_0x372947=_0x372947[_0xab49('0x66')](0x0,_0x372947['lastIndexOf'](_0x20a245));}return rp({'method':_0xab49('0x67'),'uri':util['format'](_0xab49('0x68'),_0x372947,_0xab49('0x69')),'headers':{'Authorization':_0xab49('0x6a')+_0x284158[_0xab49('0x6b')]},'json':!![]});}})[_0xab49('0x1e')](function(_0x2533ba){if(_0x2533ba){var _0x10ae41=_0x2533ba[_0xab49('0x6c')];var _0x1d9018=![];var _0x40e622=null;for(_0x40e622=0x0;_0x40e622<_0x10ae41[_0xab49('0x41')];_0x40e622++){if(_0x10ae41[_0x40e622][_0xab49('0x6d')]===_0x239236){_0x1d9018=!![];}}if(_0x1d9018){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xab49('0x6e')});}}})[_0xab49('0x1e')](respondWithResult(_0x5c57f5,null))[_0xab49('0x29')](function(_0x4732b5){var _0x5034f5=_0x388409['query'][_0xab49('0x6f')]?0x1f4:_0x4732b5[_0xab49('0x70')]||0x1f4;logger[_0xab49('0x24')](_0xab49('0x71'),_0xab49('0x62'),_0x5034f5,JSON[_0xab49('0x23')](_0x4732b5));delete _0x4732b5['name'];if(_0x5034f5===0x191){_0x5034f5=0x190;}_0x5c57f5[_0xab49('0x2a')](_0x5034f5)['send'](_0x388409['query'][_0xab49('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x4732b5[_0xab49('0x70')]}:_0x4732b5);});}; \ No newline at end of file +var _0xe5b5=['limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','type','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','order','sort','where','pick','merge','options','findAll','rows','show','include','find','create','body','update','params','getConfigurations','findOne','FreshsalesConfiguration','filter','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','FreshsalesField','username','apiKey','remoteUri','slice','substring','lastIndexOf','format','%s%s','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','count','offset'];(function(_0x474f47,_0x2303b7){var _0x21bfe6=function(_0x1121d1){while(--_0x1121d1){_0x474f47['push'](_0x474f47['shift']());}};_0x21bfe6(++_0x2303b7);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xe5b5[_0xd1d19a];return _0x52a79d;};'use strict';var pdf=require(_0x5e5b('0x0'));var emlformat=require(_0x5e5b('0x1'));var rimraf=require(_0x5e5b('0x2'));var zipdir=require(_0x5e5b('0x3'));var jsonpatch=require(_0x5e5b('0x4'));var rp=require(_0x5e5b('0x5'));var moment=require(_0x5e5b('0x6'));var BPromise=require(_0x5e5b('0x7'));var Mustache=require(_0x5e5b('0x8'));var util=require(_0x5e5b('0x9'));var path=require(_0x5e5b('0xa'));var sox=require(_0x5e5b('0xb'));var csv=require(_0x5e5b('0xc'));var ejs=require(_0x5e5b('0xd'));var fs=require('fs');var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xc'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x5e5b('0x1b'));var jayson=require(_0x5e5b('0x1c'));var client=jayson[_0x5e5b('0x1d')][_0x5e5b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x13a01e,_0x1e3483,_0x2e331d,_0x49edd0){return new BPromise(function(_0x2b37fa,_0x2e92c3){var _0x4ff37b=_0x49edd0||client;return _0x4ff37b[_0x5e5b('0x1f')](_0x13a01e,_0x2e331d)['then'](function(_0x4e9509){logger[_0x5e5b('0x20')](_0x5e5b('0x21'),_0x1e3483,_0x5e5b('0x22'));logger['debug'](_0x5e5b('0x23'),_0x1e3483,'request\x20sent',JSON[_0x5e5b('0x24')](_0x4e9509));if(_0x4e9509[_0x5e5b('0x25')]){if(_0x4e9509['error'][_0x5e5b('0x26')]===0x1f4){logger[_0x5e5b('0x25')](_0x5e5b('0x21'),_0x1e3483,_0x4e9509['error'][_0x5e5b('0x27')]);return _0x2e92c3(_0x4e9509[_0x5e5b('0x25')]['message']);}logger[_0x5e5b('0x25')](_0x5e5b('0x21'),_0x1e3483,_0x4e9509[_0x5e5b('0x25')][_0x5e5b('0x27')]);return _0x2b37fa(_0x4e9509[_0x5e5b('0x25')][_0x5e5b('0x27')]);}else{logger[_0x5e5b('0x20')](_0x5e5b('0x21'),_0x1e3483,'request\x20sent');_0x2b37fa(_0x4e9509['result'][_0x5e5b('0x27')]);}})[_0x5e5b('0x28')](function(_0x14bfaf){logger[_0x5e5b('0x25')](_0x5e5b('0x21'),_0x1e3483,_0x14bfaf);_0x2e92c3(_0x14bfaf);});});}function respondWithStatusCode(_0x28cd95,_0x135c6c){_0x135c6c=_0x135c6c||0xcc;return function(_0x18903e){if(_0x18903e){return _0x28cd95[_0x5e5b('0x29')](_0x135c6c);}return _0x28cd95[_0x5e5b('0x2a')](_0x135c6c)[_0x5e5b('0x2b')]();};}function respondWithResult(_0x4da321,_0x1ebb11){_0x1ebb11=_0x1ebb11||0xc8;return function(_0x75800d){if(_0x75800d){return _0x4da321[_0x5e5b('0x2a')](_0x1ebb11)['json'](_0x75800d);}};}function respondWithFilteredResult(_0x988e5d,_0xdb2863){return function(_0x5ee866){if(_0x5ee866){var _0x13ff91=_0x5ee866[_0x5e5b('0x2c')],_0x21c74b=_0xdb2863[_0x5e5b('0x2d')],_0x39ce16=_0xdb2863[_0x5e5b('0x2d')]+_0xdb2863[_0x5e5b('0x2e')],_0x36b595;if(_0x39ce16>=_0x13ff91){_0x39ce16=_0x13ff91;_0x36b595=0xc8;}else{_0x36b595=0xce;}_0x988e5d[_0x5e5b('0x2a')](_0x36b595);return _0x988e5d[_0x5e5b('0x2f')](_0x5e5b('0x30'),_0x21c74b+'-'+_0x39ce16+'/'+_0x13ff91)[_0x5e5b('0x31')](_0x5ee866);}return null;};}function patchUpdates(_0x4ed688){return function(_0x579c39){try{jsonpatch[_0x5e5b('0x32')](_0x579c39,_0x4ed688,!![]);}catch(_0x289f54){return BPromise[_0x5e5b('0x33')](_0x289f54);}return _0x579c39[_0x5e5b('0x34')]();};}function saveUpdates(_0x12f1ee,_0x4b9be8){return function(_0x105b82){if(_0x105b82){return _0x105b82['update'](_0x12f1ee)[_0x5e5b('0x35')](function(_0x384d8f){return _0x384d8f;});}return null;};}function removeEntity(_0x11fa95,_0xc2bc09){return function(_0x4b9801){if(_0x4b9801){return _0x4b9801[_0x5e5b('0x36')]()[_0x5e5b('0x35')](function(){_0x11fa95['status'](0xcc)[_0x5e5b('0x2b')]();});}};}function handleEntityNotFound(_0x3ce0dc,_0x34debb){return function(_0x356db0){if(!_0x356db0){_0x3ce0dc[_0x5e5b('0x29')](0x194);}return _0x356db0;};}function handleError(_0x2296dd,_0x6b7977){_0x6b7977=_0x6b7977||0x1f4;return function(_0x317451){logger['error'](_0x317451[_0x5e5b('0x37')]);if(_0x317451[_0x5e5b('0x38')]){delete _0x317451[_0x5e5b('0x38')];}_0x2296dd[_0x5e5b('0x2a')](_0x6b7977)[_0x5e5b('0x39')](_0x317451);};}exports[_0x5e5b('0x3a')]=function(_0x4fec9e,_0x5b2ba5){var _0x1d6686={},_0x322b41={},_0x8ec651={'count':0x0,'rows':[]};var _0x5b0d32=_[_0x5e5b('0x3b')](db[_0x5e5b('0x3c')][_0x5e5b('0x3d')],function(_0x470b45){return{'name':_0x470b45['fieldName'],'type':_0x470b45[_0x5e5b('0x3e')][_0x5e5b('0x3f')]};});_0x322b41['model']=_['map'](_0x5b0d32,_0x5e5b('0x38'));_0x322b41[_0x5e5b('0x40')]=_[_0x5e5b('0x41')](_0x4fec9e['query']);_0x322b41[_0x5e5b('0x42')]=_['intersection'](_0x322b41['model'],_0x322b41[_0x5e5b('0x40')]);_0x1d6686[_0x5e5b('0x43')]=_[_0x5e5b('0x44')](_0x322b41[_0x5e5b('0x45')],qs[_0x5e5b('0x46')](_0x4fec9e[_0x5e5b('0x40')][_0x5e5b('0x46')]));_0x1d6686[_0x5e5b('0x43')]=_0x1d6686[_0x5e5b('0x43')]['length']?_0x1d6686[_0x5e5b('0x43')]:_0x322b41[_0x5e5b('0x45')];if(!_0x4fec9e['query'][_0x5e5b('0x47')]('nolimit')){_0x1d6686[_0x5e5b('0x2e')]=qs[_0x5e5b('0x2e')](_0x4fec9e[_0x5e5b('0x40')][_0x5e5b('0x2e')]);_0x1d6686[_0x5e5b('0x2d')]=qs[_0x5e5b('0x2d')](_0x4fec9e[_0x5e5b('0x40')][_0x5e5b('0x2d')]);}_0x1d6686[_0x5e5b('0x48')]=qs[_0x5e5b('0x49')](_0x4fec9e[_0x5e5b('0x40')]['sort']);_0x1d6686[_0x5e5b('0x4a')]=qs[_0x5e5b('0x42')](_[_0x5e5b('0x4b')](_0x4fec9e['query'],_0x322b41[_0x5e5b('0x42')]),_0x5b0d32);if(_0x4fec9e[_0x5e5b('0x40')]['filter']){_0x1d6686[_0x5e5b('0x4a')]=_[_0x5e5b('0x4c')](_0x1d6686['where'],{'$or':_[_0x5e5b('0x3b')](_0x5b0d32,function(_0x5e32fd){if(_0x5e32fd['type']!=='VIRTUAL'){var _0x362604={};_0x362604[_0x5e32fd['name']]={'$like':'%'+_0x4fec9e[_0x5e5b('0x40')]['filter']+'%'};return _0x362604;}})});}_0x1d6686=_[_0x5e5b('0x4c')]({},_0x1d6686,_0x4fec9e[_0x5e5b('0x4d')]);var _0x2bc089={'where':_0x1d6686[_0x5e5b('0x4a')]};return db[_0x5e5b('0x3c')][_0x5e5b('0x2c')](_0x2bc089)[_0x5e5b('0x35')](function(_0x4e4d03){_0x8ec651['count']=_0x4e4d03;if(_0x4fec9e[_0x5e5b('0x40')]['includeAll']){_0x1d6686['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x5e5b('0x4e')](_0x1d6686);})['then'](function(_0x42f42d){_0x8ec651[_0x5e5b('0x4f')]=_0x42f42d;return _0x8ec651;})[_0x5e5b('0x35')](respondWithFilteredResult(_0x5b2ba5,_0x1d6686))[_0x5e5b('0x28')](handleError(_0x5b2ba5,null));};exports[_0x5e5b('0x50')]=function(_0x192445,_0x4fd265){var _0x26a0ff={'raw':![],'where':{'id':_0x192445['params']['id']}},_0x3ae495={};_0x3ae495[_0x5e5b('0x45')]=_['keys'](db[_0x5e5b('0x3c')][_0x5e5b('0x3d')]);_0x3ae495[_0x5e5b('0x40')]=_[_0x5e5b('0x41')](_0x192445['query']);_0x3ae495[_0x5e5b('0x42')]=_[_0x5e5b('0x44')](_0x3ae495['model'],_0x3ae495[_0x5e5b('0x40')]);_0x26a0ff[_0x5e5b('0x43')]=_[_0x5e5b('0x44')](_0x3ae495[_0x5e5b('0x45')],qs[_0x5e5b('0x46')](_0x192445[_0x5e5b('0x40')]['fields']));_0x26a0ff[_0x5e5b('0x43')]=_0x26a0ff[_0x5e5b('0x43')]['length']?_0x26a0ff[_0x5e5b('0x43')]:_0x3ae495[_0x5e5b('0x45')];if(_0x192445[_0x5e5b('0x40')]['includeAll']){_0x26a0ff[_0x5e5b('0x51')]=[{'all':!![]}];}_0x26a0ff=_[_0x5e5b('0x4c')]({},_0x26a0ff,_0x192445[_0x5e5b('0x4d')]);return db['FreshsalesAccount'][_0x5e5b('0x52')](_0x26a0ff)[_0x5e5b('0x35')](handleEntityNotFound(_0x4fd265,null))[_0x5e5b('0x35')](respondWithResult(_0x4fd265,null))['catch'](handleError(_0x4fd265,null));};exports['create']=function(_0x3da13f,_0x545991){return db['FreshsalesAccount'][_0x5e5b('0x53')](_0x3da13f[_0x5e5b('0x54')],{})[_0x5e5b('0x35')](respondWithResult(_0x545991,0xc9))['catch'](handleError(_0x545991,null));};exports[_0x5e5b('0x55')]=function(_0x28ac8b,_0x148032){if(_0x28ac8b[_0x5e5b('0x54')]['id']){delete _0x28ac8b[_0x5e5b('0x54')]['id'];}return db[_0x5e5b('0x3c')]['find']({'where':{'id':_0x28ac8b['params']['id']}})[_0x5e5b('0x35')](handleEntityNotFound(_0x148032,null))[_0x5e5b('0x35')](saveUpdates(_0x28ac8b[_0x5e5b('0x54')],null))[_0x5e5b('0x35')](respondWithResult(_0x148032,null))['catch'](handleError(_0x148032,null));};exports[_0x5e5b('0x36')]=function(_0x4a86b7,_0x325f87){return db[_0x5e5b('0x3c')][_0x5e5b('0x52')]({'where':{'id':_0x4a86b7[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x35')](handleEntityNotFound(_0x325f87,null))[_0x5e5b('0x35')](removeEntity(_0x325f87,null))[_0x5e5b('0x28')](handleError(_0x325f87,null));};exports[_0x5e5b('0x57')]=function(_0x549489,_0x3963eb,_0x21b1d5){var _0x42f294={};var _0x1aea38={};var _0x129026;var _0x5543eb;return db[_0x5e5b('0x3c')][_0x5e5b('0x58')]({'where':{'id':_0x549489[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x35')](handleEntityNotFound(_0x3963eb,null))[_0x5e5b('0x35')](function(_0x5207e0){if(_0x5207e0){_0x129026=_0x5207e0;_0x1aea38[_0x5e5b('0x45')]=_['keys'](db[_0x5e5b('0x59')]['rawAttributes']);_0x1aea38[_0x5e5b('0x40')]=_[_0x5e5b('0x41')](_0x549489[_0x5e5b('0x40')]);_0x1aea38[_0x5e5b('0x42')]=_[_0x5e5b('0x44')](_0x1aea38[_0x5e5b('0x45')],_0x1aea38['query']);_0x42f294[_0x5e5b('0x43')]=_[_0x5e5b('0x44')](_0x1aea38[_0x5e5b('0x45')],qs[_0x5e5b('0x46')](_0x549489['query']['fields']));_0x42f294[_0x5e5b('0x43')]=_0x42f294[_0x5e5b('0x43')]['length']?_0x42f294[_0x5e5b('0x43')]:_0x1aea38[_0x5e5b('0x45')];_0x42f294[_0x5e5b('0x48')]=qs[_0x5e5b('0x49')](_0x549489[_0x5e5b('0x40')]['sort']);_0x42f294[_0x5e5b('0x4a')]=qs[_0x5e5b('0x42')](_['pick'](_0x549489['query'],_0x1aea38['filters']));if(_0x549489[_0x5e5b('0x40')][_0x5e5b('0x5a')]){_0x42f294[_0x5e5b('0x4a')]=_[_0x5e5b('0x4c')](_0x42f294[_0x5e5b('0x4a')],{'$or':_['map'](_0x42f294[_0x5e5b('0x43')],function(_0x454095){var _0x4eedb8={};_0x4eedb8[_0x454095]={'$like':'%'+_0x549489[_0x5e5b('0x40')]['filter']+'%'};return _0x4eedb8;})});}_0x42f294=_['merge']({},_0x42f294,_0x549489[_0x5e5b('0x4d')]);return _0x129026[_0x5e5b('0x57')](_0x42f294);}})[_0x5e5b('0x35')](function(_0x15b801){if(_0x15b801){_0x5543eb=_0x15b801[_0x5e5b('0x5b')];if(!_0x549489[_0x5e5b('0x40')][_0x5e5b('0x47')]('nolimit')){_0x42f294[_0x5e5b('0x2e')]=qs[_0x5e5b('0x2e')](_0x549489[_0x5e5b('0x40')][_0x5e5b('0x2e')]);_0x42f294[_0x5e5b('0x2d')]=qs[_0x5e5b('0x2d')](_0x549489[_0x5e5b('0x40')][_0x5e5b('0x2d')]);}return _0x129026[_0x5e5b('0x57')](_0x42f294);}})[_0x5e5b('0x35')](function(_0x26a17f){if(_0x26a17f){return _0x26a17f?{'count':_0x5543eb,'rows':_0x26a17f}:null;}})['then'](respondWithResult(_0x3963eb,null))[_0x5e5b('0x28')](handleError(_0x3963eb,null));};exports[_0x5e5b('0x5c')]=function(_0x3c57ad,_0x271af6,_0xc7171a){if(_0x3c57ad['body']['id']){delete _0x3c57ad[_0x5e5b('0x54')]['id'];}return db[_0x5e5b('0x3c')][_0x5e5b('0x58')]({'where':{'id':_0x3c57ad[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x35')](handleEntityNotFound(_0x271af6,null))[_0x5e5b('0x35')](function(_0x4d2218){if(_0x4d2218){_0x3c57ad[_0x5e5b('0x54')][_0x5e5b('0x5d')]=_0x4d2218['id'];_0x3c57ad[_0x5e5b('0x54')]['Subjects']=integrations[_0x5e5b('0x5e')](_0x3c57ad[_0x5e5b('0x54')][_0x5e5b('0x5f')],_0x3c57ad[_0x5e5b('0x54')][_0x5e5b('0x3e')]);_0x3c57ad[_0x5e5b('0x54')][_0x5e5b('0x60')]=integrations[_0x5e5b('0x61')](_0x3c57ad[_0x5e5b('0x54')]['channel'],_0x3c57ad[_0x5e5b('0x54')]['type']);return db[_0x5e5b('0x59')][_0x5e5b('0x53')](_0x3c57ad['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x5e5b('0x62')},{'model':db[_0x5e5b('0x63')],'as':'Descriptions'}]});}return null;})[_0x5e5b('0x35')](respondWithResult(_0x271af6,null))['catch'](handleError(_0x271af6,null));};exports['getFields']=function(_0x383de8,_0x5cb712,_0x3e3835){var _0x44eee0='';var _0x10aa6a='';return db['FreshsalesAccount'][_0x5e5b('0x58')]({'where':{'id':_0x383de8[_0x5e5b('0x56')]['id']},'attributes':['id',_0x5e5b('0x64'),'remoteUri',_0x5e5b('0x65')]})[_0x5e5b('0x35')](handleEntityNotFound(_0x5cb712,null))['then'](function(_0x388dbe){if(_0x388dbe){_0x10aa6a=_0x388dbe['username'];_0x44eee0=_0x388dbe['remoteUri'];var _0x1e6f7c=_0x388dbe[_0x5e5b('0x66')][_0x5e5b('0x67')](-0x1);if(_0x1e6f7c==='/'){_0x44eee0=_0x44eee0[_0x5e5b('0x68')](0x0,_0x44eee0[_0x5e5b('0x69')](_0x1e6f7c));}return rp({'method':'GET','uri':util[_0x5e5b('0x6a')](_0x5e5b('0x6b'),_0x44eee0,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x388dbe[_0x5e5b('0x65')]},'json':!![]});}})[_0x5e5b('0x35')](function(_0x313e13){if(_0x313e13){var _0x10fa87=_0x313e13[_0x5e5b('0x6c')];var _0x1ad8a9=![];var _0x55878b=null;for(_0x55878b=0x0;_0x55878b<_0x10fa87[_0x5e5b('0x5b')];_0x55878b++){if(_0x10fa87[_0x55878b][_0x5e5b('0x6d')]===_0x10aa6a){_0x1ad8a9=!![];}}if(_0x1ad8a9){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5e5b('0x6e')});}}})['then'](respondWithResult(_0x5cb712,null))['catch'](function(_0x24bcc9){var _0x1eb8cd=_0x383de8[_0x5e5b('0x40')]['test']?0x1f4:_0x24bcc9[_0x5e5b('0x6f')]||0x1f4;logger[_0x5e5b('0x25')](_0x5e5b('0x70'),'getFields',_0x1eb8cd,JSON[_0x5e5b('0x24')](_0x24bcc9));delete _0x24bcc9[_0x5e5b('0x38')];if(_0x1eb8cd===0x191){_0x1eb8cd=0x190;}_0x5cb712[_0x5e5b('0x2a')](_0x1eb8cd)['send'](_0x383de8[_0x5e5b('0x40')][_0x5e5b('0x71')]?{'message':_0x5e5b('0x72'),'statusCode':_0x24bcc9[_0x5e5b('0x6f')]}:_0x24bcc9);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 7b1fa86..102fcec 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 _0x582a=['api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshsalesAccount','lodash','util','../../config/logger'];(function(_0x4e8d9a,_0x54c82f){var _0x30ac58=function(_0x4fb319){while(--_0x4fb319){_0x4e8d9a['push'](_0x4e8d9a['shift']());}};_0x30ac58(++_0x54c82f);}(_0x582a,0x135));var _0xa582=function(_0x12aba8,_0x40a036){_0x12aba8=_0x12aba8-0x0;var _0x2aac66=_0x582a[_0x12aba8];return _0x2aac66;};'use strict';var _=require(_0xa582('0x0'));var util=require(_0xa582('0x1'));var logger=require(_0xa582('0x2'))(_0xa582('0x3'));var moment=require(_0xa582('0x4'));var BPromise=require(_0xa582('0x5'));var rp=require(_0xa582('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa582('0x7'));var config=require(_0xa582('0x8'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0xa582('0x9'));module[_0xa582('0xa')]=function(_0x510bdc,_0x3fc6ba){return _0x510bdc['define'](_0xa582('0xb'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68f5=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','lodash'];(function(_0x4887be,_0x25e10d){var _0xd751ea=function(_0x4b831f){while(--_0x4b831f){_0x4887be['push'](_0x4887be['shift']());}};_0xd751ea(++_0x25e10d);}(_0x68f5,0x107));var _0x568f=function(_0x94c113,_0x68f426){_0x94c113=_0x94c113-0x0;var _0x16c312=_0x68f5[_0x94c113];return _0x16c312;};'use strict';var _=require(_0x568f('0x0'));var util=require(_0x568f('0x1'));var logger=require(_0x568f('0x2'))(_0x568f('0x3'));var moment=require(_0x568f('0x4'));var BPromise=require(_0x568f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x568f('0x6'));var rimraf=require(_0x568f('0x7'));var config=require('../../config/environment');var attributes=require(_0x568f('0x8'));var integrations=require(_0x568f('0x9'));module[_0x568f('0xa')]=function(_0x3e7488,_0x2c79ba){return _0x3e7488['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','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 f372c41..975cf46 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 _0x58c9=['FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','debug','GetFreshsalesAccount','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3d6762,_0xf5ced0){var _0x25fcae=function(_0x213fd0){while(--_0x213fd0){_0x3d6762['push'](_0x3d6762['shift']());}};_0x25fcae(++_0xf5ced0);}(_0x58c9,0x1bc));var _0x958c=function(_0x586ef9,_0x7b8e44){_0x586ef9=_0x586ef9-0x0;var _0x32a179=_0x58c9[_0x586ef9];return _0x32a179;};'use strict';var _=require(_0x958c('0x0'));var util=require(_0x958c('0x1'));var moment=require(_0x958c('0x2'));var BPromise=require(_0x958c('0x3'));var rs=require(_0x958c('0x4'));var fs=require('fs');var Redis=require(_0x958c('0x5'));var db=require(_0x958c('0x6'))['db'];var utils=require(_0x958c('0x7'));var logger=require(_0x958c('0x8'))(_0x958c('0x9'));var config=require(_0x958c('0xa'));var jayson=require(_0x958c('0xb'));var client=jayson[_0x958c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x158388,_0xa44c9,_0xf10ad3){return new BPromise(function(_0x2e37a6,_0x31e668){return client[_0x958c('0xd')](_0x158388,_0xf10ad3)[_0x958c('0xe')](function(_0x128ef6){logger[_0x958c('0xf')](_0x958c('0x10'),_0xa44c9,_0x958c('0x11'));logger['debug'](_0x958c('0x12'),_0xa44c9,_0x958c('0x11'),JSON[_0x958c('0x13')](_0x128ef6));if(_0x128ef6[_0x958c('0x14')]){if(_0x128ef6[_0x958c('0x14')][_0x958c('0x15')]===0x1f4){logger[_0x958c('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0xa44c9,_0x128ef6[_0x958c('0x14')][_0x958c('0x16')]);return _0x31e668(_0x128ef6['error'][_0x958c('0x16')]);}logger[_0x958c('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0xa44c9,_0x128ef6[_0x958c('0x14')][_0x958c('0x16')]);return _0x2e37a6(_0x128ef6['error']['message']);}else{logger[_0x958c('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0xa44c9,'request\x20sent');_0x2e37a6(_0x128ef6['result'][_0x958c('0x16')]);}})[_0x958c('0x17')](function(_0x26c739){logger[_0x958c('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0xa44c9,_0x26c739);_0x31e668(_0x26c739);});});}exports['GetFreshsalesAccount']=function(_0x59f83f){var _0x537310=this;return new Promise(function(_0x4d3eed,_0x459f72){return db[_0x958c('0x18')][_0x958c('0x19')]({'raw':_0x59f83f[_0x958c('0x1a')]?_0x59f83f['options'][_0x958c('0x1b')]===undefined?!![]:![]:!![],'where':_0x59f83f[_0x958c('0x1a')]?_0x59f83f['options'][_0x958c('0x1c')]||null:null,'attributes':_0x59f83f['options']?_0x59f83f[_0x958c('0x1a')][_0x958c('0x1d')]||null:null,'limit':_0x59f83f[_0x958c('0x1a')]?_0x59f83f[_0x958c('0x1a')]['limit']||null:null,'include':_0x59f83f['options']?_0x59f83f['options'][_0x958c('0x1e')]?_[_0x958c('0x1f')](_0x59f83f[_0x958c('0x1a')]['include'],function(_0x2ff4ce){return{'model':db[_0x2ff4ce[_0x958c('0x20')]],'as':_0x2ff4ce['as'],'attributes':_0x2ff4ce[_0x958c('0x1d')],'include':_0x2ff4ce[_0x958c('0x1e')]?_[_0x958c('0x1f')](_0x2ff4ce[_0x958c('0x1e')],function(_0xe8b7f3){return{'model':db[_0xe8b7f3['model']],'as':_0xe8b7f3['as'],'attributes':_0xe8b7f3[_0x958c('0x1d')],'include':_0xe8b7f3[_0x958c('0x1e')]?_[_0x958c('0x1f')](_0xe8b7f3['include'],function(_0x595e8b){return{'model':db[_0x595e8b[_0x958c('0x20')]],'as':_0x595e8b['as'],'attributes':_0x595e8b[_0x958c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x958c('0xe')](function(_0x23e48b){logger[_0x958c('0xf')]('GetFreshsalesAccount',_0x59f83f);logger[_0x958c('0x21')](_0x958c('0x22'),_0x59f83f,JSON[_0x958c('0x13')](_0x23e48b));_0x4d3eed(_0x23e48b);})[_0x958c('0x17')](function(_0xbdb048){logger['error']('GetFreshsalesAccount',_0xbdb048[_0x958c('0x16')],_0x59f83f);_0x459f72(_0x537310[_0x958c('0x14')](0x1f4,_0xbdb048['message']));});});};exports[_0x958c('0x23')]=function(_0x4d7edb){var _0xf4f4=this;return new Promise(function(_0x4a22bd,_0x37b62f){return db['FreshsalesAccount']['find']({'raw':_0x4d7edb[_0x958c('0x1a')]?_0x4d7edb[_0x958c('0x1a')][_0x958c('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d7edb[_0x958c('0x1a')]?_0x4d7edb['options'][_0x958c('0x1c')]||null:null,'attributes':_0x4d7edb[_0x958c('0x1a')]?_0x4d7edb[_0x958c('0x1a')][_0x958c('0x1d')]||null:null,'include':_0x4d7edb[_0x958c('0x1a')]?_0x4d7edb[_0x958c('0x1a')][_0x958c('0x1e')]?_[_0x958c('0x1f')](_0x4d7edb[_0x958c('0x1a')][_0x958c('0x1e')],function(_0x2823cd){return{'model':db[_0x2823cd['model']],'as':_0x2823cd['as'],'attributes':_0x2823cd[_0x958c('0x1d')],'include':_0x2823cd[_0x958c('0x1e')]?_[_0x958c('0x1f')](_0x2823cd[_0x958c('0x1e')],function(_0x12ad51){return{'model':db[_0x12ad51[_0x958c('0x20')]],'as':_0x12ad51['as'],'attributes':_0x12ad51[_0x958c('0x1d')],'include':_0x12ad51['include']?_[_0x958c('0x1f')](_0x12ad51['include'],function(_0x20c1c3){return{'model':db[_0x20c1c3[_0x958c('0x20')]],'as':_0x20c1c3['as'],'attributes':_0x20c1c3[_0x958c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x122190){logger['info'](_0x958c('0x23'),_0x4d7edb);logger['debug'](_0x958c('0x23'),_0x4d7edb,JSON[_0x958c('0x13')](_0x122190));_0x4a22bd(_0x122190);})[_0x958c('0x17')](function(_0x4a27e2){logger[_0x958c('0x14')](_0x958c('0x23'),_0x4a27e2[_0x958c('0x16')],_0x4d7edb);_0x37b62f(_0xf4f4['error'](0x1f4,_0x4a27e2[_0x958c('0x16')]));});});}; \ No newline at end of file +var _0x1122=['limit','include','map','model','GetFreshsalesAccount','find','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','raw','attributes'];(function(_0x19ea20,_0x499329){var _0x2c724c=function(_0x4a7b39){while(--_0x4a7b39){_0x19ea20['push'](_0x19ea20['shift']());}};_0x2c724c(++_0x499329);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2112('0x0'));var util=require('util');var moment=require(_0x2112('0x1'));var BPromise=require(_0x2112('0x2'));var rs=require(_0x2112('0x3'));var fs=require('fs');var Redis=require(_0x2112('0x4'));var db=require(_0x2112('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2112('0x6'));var config=require('../../config/environment');var jayson=require(_0x2112('0x7'));var client=jayson[_0x2112('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcca285,_0x2ad731,_0x3f0a81){return new BPromise(function(_0x272bdb,_0x4190c7){return client[_0x2112('0x9')](_0xcca285,_0x3f0a81)[_0x2112('0xa')](function(_0x2f7142){logger[_0x2112('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x2ad731,_0x2112('0xc'));logger[_0x2112('0xd')](_0x2112('0xe'),_0x2ad731,_0x2112('0xc'),JSON['stringify'](_0x2f7142));if(_0x2f7142[_0x2112('0xf')]){if(_0x2f7142[_0x2112('0xf')][_0x2112('0x10')]===0x1f4){logger[_0x2112('0xf')](_0x2112('0x11'),_0x2ad731,_0x2f7142[_0x2112('0xf')][_0x2112('0x12')]);return _0x4190c7(_0x2f7142['error'][_0x2112('0x12')]);}logger['error'](_0x2112('0x11'),_0x2ad731,_0x2f7142[_0x2112('0xf')]['message']);return _0x272bdb(_0x2f7142[_0x2112('0xf')]['message']);}else{logger[_0x2112('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0x2ad731,_0x2112('0xc'));_0x272bdb(_0x2f7142[_0x2112('0x13')]['message']);}})[_0x2112('0x14')](function(_0x4db5c3){logger[_0x2112('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x2ad731,_0x4db5c3);_0x4190c7(_0x4db5c3);});});}exports['GetFreshsalesAccount']=function(_0x454981){var _0x492d96=this;return new Promise(function(_0x4dee3c,_0x222539){return db[_0x2112('0x15')][_0x2112('0x16')]({'raw':_0x454981[_0x2112('0x17')]?_0x454981[_0x2112('0x17')][_0x2112('0x18')]===undefined?!![]:![]:!![],'where':_0x454981[_0x2112('0x17')]?_0x454981['options']['where']||null:null,'attributes':_0x454981[_0x2112('0x17')]?_0x454981[_0x2112('0x17')][_0x2112('0x19')]||null:null,'limit':_0x454981['options']?_0x454981[_0x2112('0x17')][_0x2112('0x1a')]||null:null,'include':_0x454981[_0x2112('0x17')]?_0x454981[_0x2112('0x17')][_0x2112('0x1b')]?_[_0x2112('0x1c')](_0x454981[_0x2112('0x17')][_0x2112('0x1b')],function(_0x89db6d){return{'model':db[_0x89db6d['model']],'as':_0x89db6d['as'],'attributes':_0x89db6d[_0x2112('0x19')],'include':_0x89db6d[_0x2112('0x1b')]?_[_0x2112('0x1c')](_0x89db6d[_0x2112('0x1b')],function(_0x3002a6){return{'model':db[_0x3002a6[_0x2112('0x1d')]],'as':_0x3002a6['as'],'attributes':_0x3002a6[_0x2112('0x19')],'include':_0x3002a6[_0x2112('0x1b')]?_[_0x2112('0x1c')](_0x3002a6['include'],function(_0x7a072c){return{'model':db[_0x7a072c[_0x2112('0x1d')]],'as':_0x7a072c['as'],'attributes':_0x7a072c[_0x2112('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2112('0xa')](function(_0x358dd9){logger['info'](_0x2112('0x1e'),_0x454981);logger[_0x2112('0xd')](_0x2112('0x1e'),_0x454981,JSON['stringify'](_0x358dd9));_0x4dee3c(_0x358dd9);})[_0x2112('0x14')](function(_0x1db82b){logger[_0x2112('0xf')]('GetFreshsalesAccount',_0x1db82b['message'],_0x454981);_0x222539(_0x492d96['error'](0x1f4,_0x1db82b[_0x2112('0x12')]));});});};exports['ShowFreshsalesAccount']=function(_0x154eff){var _0x2dade3=this;return new Promise(function(_0x1443d0,_0x1bf954){return db[_0x2112('0x15')][_0x2112('0x1f')]({'raw':_0x154eff['options']?_0x154eff['options'][_0x2112('0x18')]===undefined?!![]:![]:!![],'where':_0x154eff[_0x2112('0x17')]?_0x154eff[_0x2112('0x17')]['where']||null:null,'attributes':_0x154eff[_0x2112('0x17')]?_0x154eff[_0x2112('0x17')][_0x2112('0x19')]||null:null,'include':_0x154eff[_0x2112('0x17')]?_0x154eff['options']['include']?_['map'](_0x154eff[_0x2112('0x17')]['include'],function(_0x234409){return{'model':db[_0x234409[_0x2112('0x1d')]],'as':_0x234409['as'],'attributes':_0x234409['attributes'],'include':_0x234409[_0x2112('0x1b')]?_['map'](_0x234409[_0x2112('0x1b')],function(_0x487b49){return{'model':db[_0x487b49['model']],'as':_0x487b49['as'],'attributes':_0x487b49[_0x2112('0x19')],'include':_0x487b49[_0x2112('0x1b')]?_[_0x2112('0x1c')](_0x487b49['include'],function(_0x3ba609){return{'model':db[_0x3ba609[_0x2112('0x1d')]],'as':_0x3ba609['as'],'attributes':_0x3ba609['attributes']};}):[]};}):[]};}):[]:[]})[_0x2112('0xa')](function(_0x42db8b){logger[_0x2112('0xb')](_0x2112('0x20'),_0x154eff);logger[_0x2112('0xd')](_0x2112('0x20'),_0x154eff,JSON['stringify'](_0x42db8b));_0x1443d0(_0x42db8b);})['catch'](function(_0x55cafe){logger[_0x2112('0xf')](_0x2112('0x20'),_0x55cafe[_0x2112('0x12')],_0x154eff);_0x1bf954(_0x2dade3[_0x2112('0xf')](0x1f4,_0x55cafe[_0x2112('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 53b1464..87f17c6 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 _0x6380=['/:id/descriptions','getDescriptions','getFields','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6380,0x159));var _0x0638=function(_0x8c9b8,_0x18c2c1){_0x8c9b8=_0x8c9b8-0x0;var _0x536a08=_0x6380[_0x8c9b8];return _0x536a08;};'use strict';var multer=require('multer');var util=require(_0x0638('0x0'));var path=require(_0x0638('0x1'));var timeout=require(_0x0638('0x2'));var express=require(_0x0638('0x3'));var router=express[_0x0638('0x4')]();var auth=require(_0x0638('0x5'));var interaction=require(_0x0638('0x6'));var config=require('../../config/environment');var controller=require(_0x0638('0x7'));router[_0x0638('0x8')]('/',auth[_0x0638('0x9')](),controller[_0x0638('0xa')]);router[_0x0638('0x8')](_0x0638('0xb'),auth[_0x0638('0x9')](),controller[_0x0638('0xc')]);router[_0x0638('0x8')](_0x0638('0xd'),auth['isAuthenticated'](),controller[_0x0638('0xe')]);router['get'](_0x0638('0xf'),auth[_0x0638('0x9')](),controller[_0x0638('0x10')]);router['get']('/:id/fields',auth[_0x0638('0x9')](),controller[_0x0638('0x11')]);router[_0x0638('0x12')]('/',auth[_0x0638('0x9')](),controller[_0x0638('0x13')]);router[_0x0638('0x14')]('/:id',auth[_0x0638('0x9')](),controller[_0x0638('0x15')]);router[_0x0638('0x16')]('/:id',auth[_0x0638('0x9')](),controller[_0x0638('0x17')]);module['exports']=router; \ No newline at end of file +var _0x8082=['/:id/subjects','/:id/descriptions','isAuthenticated','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id'];(function(_0x298317,_0x49f83f){var _0x444794=function(_0x5b0618){while(--_0x5b0618){_0x298317['push'](_0x298317['shift']());}};_0x444794(++_0x49f83f);}(_0x8082,0x123));var _0x2808=function(_0x3a5740,_0x13292c){_0x3a5740=_0x3a5740-0x0;var _0x369e1d=_0x8082[_0x3a5740];return _0x369e1d;};'use strict';var multer=require('multer');var util=require(_0x2808('0x0'));var path=require(_0x2808('0x1'));var timeout=require(_0x2808('0x2'));var express=require('express');var router=express[_0x2808('0x3')]();var auth=require(_0x2808('0x4'));var interaction=require(_0x2808('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0x2808('0x6')]('/',auth['isAuthenticated'](),controller[_0x2808('0x7')]);router['get'](_0x2808('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x2808('0x6')](_0x2808('0x9'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2808('0x6')](_0x2808('0xa'),auth[_0x2808('0xb')](),controller[_0x2808('0xc')]);router[_0x2808('0x6')]('/:id/fields',auth[_0x2808('0xb')](),controller['getFields']);router[_0x2808('0xd')]('/',auth['isAuthenticated'](),controller[_0x2808('0xe')]);router[_0x2808('0xf')](_0x2808('0x8'),auth[_0x2808('0xb')](),controller[_0x2808('0x10')]);router[_0x2808('0x11')]('/:id',auth[_0x2808('0xb')](),controller[_0x2808('0x12')]);module[_0x2808('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 96faa8b..025a87d 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 _0x0fe0=['sequelize','exports','STRING'];(function(_0x176756,_0x3247c5){var _0x4cf179=function(_0x5ba889){while(--_0x5ba889){_0x176756['push'](_0x176756['shift']());}};_0x4cf179(++_0x3247c5);}(_0x0fe0,0x78));var _0x00fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0fe0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x00fe('0x0'));module[_0x00fe('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x00fe('0x2')]}}; \ No newline at end of file +var _0x1893=['STRING'];(function(_0x32f650,_0x1f7cef){var _0x5efe2c=function(_0x3abc64){while(--_0x3abc64){_0x32f650['push'](_0x32f650['shift']());}};_0x5efe2c(++_0x1f7cef);}(_0x1893,0x86));var _0x3189=function(_0x15cae3,_0x458cb9){_0x15cae3=_0x15cae3-0x0;var _0x20596f=_0x1893[_0x15cae3];return _0x20596f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3189('0x0')]},'description':{'type':Sequelize[_0x3189('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index bc6e517..9cae608 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 _0x4975=['limit','Content-Range','reject','save','then','stack','name','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','rows','show','params','includeAll','find','create','update','body','destroy','FreshsalesConfiguration','getSubjects','findOne','FreshsalesField','order','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json'];(function(_0x41bc84,_0x1f1753){var _0x6e5cdd=function(_0x23a6c3){while(--_0x23a6c3){_0x41bc84['push'](_0x41bc84['shift']());}};_0x6e5cdd(++_0x1f1753);}(_0x4975,0x86));var _0x5497=function(_0x56a114,_0x113573){_0x56a114=_0x56a114-0x0;var _0x4dc8d2=_0x4975[_0x56a114];return _0x4dc8d2;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x18'))['db'];var jayson=require(_0x5497('0x19'));var client=jayson[_0x5497('0x1a')][_0x5497('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x747dc7,_0x365144,_0x1f7169,_0xaca97d){return new BPromise(function(_0x363a5b,_0x1a4c74){var _0x55f590=_0xaca97d||client;return _0x55f590[_0x5497('0x1c')](_0x747dc7,_0x1f7169)['then'](function(_0x4237a9){logger[_0x5497('0x1d')](_0x5497('0x1e'),_0x365144,_0x5497('0x1f'));logger[_0x5497('0x20')](_0x5497('0x21'),_0x365144,_0x5497('0x1f'),JSON['stringify'](_0x4237a9));if(_0x4237a9['error']){if(_0x4237a9[_0x5497('0x22')][_0x5497('0x23')]===0x1f4){logger[_0x5497('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x1a4c74(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);return _0x363a5b(_0x4237a9[_0x5497('0x22')][_0x5497('0x24')]);}else{logger[_0x5497('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x365144,_0x5497('0x1f'));_0x363a5b(_0x4237a9['result'][_0x5497('0x24')]);}})[_0x5497('0x25')](function(_0x44265c){logger[_0x5497('0x22')](_0x5497('0x1e'),_0x365144,_0x44265c);_0x1a4c74(_0x44265c);});});}function respondWithStatusCode(_0x3b2fbc,_0x5018fa){_0x5018fa=_0x5018fa||0xcc;return function(_0x54043a){if(_0x54043a){return _0x3b2fbc[_0x5497('0x26')](_0x5018fa);}return _0x3b2fbc[_0x5497('0x27')](_0x5018fa)[_0x5497('0x28')]();};}function respondWithResult(_0x281155,_0x5223b5){_0x5223b5=_0x5223b5||0xc8;return function(_0x13b7a4){if(_0x13b7a4){return _0x281155['status'](_0x5223b5)[_0x5497('0x29')](_0x13b7a4);}};}function respondWithFilteredResult(_0x16a2b4,_0x429d36){return function(_0x34a1a5){if(_0x34a1a5){var _0x163a30=_0x34a1a5['count'],_0x31cd01=_0x429d36['offset'],_0x48b835=_0x429d36['offset']+_0x429d36[_0x5497('0x2a')],_0x4af5f4;if(_0x48b835>=_0x163a30){_0x48b835=_0x163a30;_0x4af5f4=0xc8;}else{_0x4af5f4=0xce;}_0x16a2b4['status'](_0x4af5f4);return _0x16a2b4['set'](_0x5497('0x2b'),_0x31cd01+'-'+_0x48b835+'/'+_0x163a30)[_0x5497('0x29')](_0x34a1a5);}return null;};}function patchUpdates(_0x1cf908){return function(_0x4c442a){try{jsonpatch['apply'](_0x4c442a,_0x1cf908,!![]);}catch(_0x58230b){return BPromise[_0x5497('0x2c')](_0x58230b);}return _0x4c442a[_0x5497('0x2d')]();};}function saveUpdates(_0xf4c117,_0x5b8f79){return function(_0x489f71){if(_0x489f71){return _0x489f71['update'](_0xf4c117)[_0x5497('0x2e')](function(_0x572460){return _0x572460;});}return null;};}function removeEntity(_0x438ee4,_0x258c2d){return function(_0x77c575){if(_0x77c575){return _0x77c575['destroy']()[_0x5497('0x2e')](function(){_0x438ee4[_0x5497('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce7cb2,_0xce2e81){return function(_0x331dfc){if(!_0x331dfc){_0xce7cb2['sendStatus'](0x194);}return _0x331dfc;};}function handleError(_0x3395f6,_0x2fe1f2){_0x2fe1f2=_0x2fe1f2||0x1f4;return function(_0x125d51){logger[_0x5497('0x22')](_0x125d51[_0x5497('0x2f')]);if(_0x125d51['name']){delete _0x125d51[_0x5497('0x30')];}_0x3395f6[_0x5497('0x27')](_0x2fe1f2)['send'](_0x125d51);};}exports[_0x5497('0x31')]=function(_0x44299b,_0xc7730){var _0x1b9cd8={},_0x1656c7={},_0x37011c={'count':0x0,'rows':[]};var _0x580e86=_[_0x5497('0x32')](db['FreshsalesConfiguration'][_0x5497('0x33')],function(_0x212199){return{'name':_0x212199[_0x5497('0x34')],'type':_0x212199['type']['key']};});_0x1656c7[_0x5497('0x35')]=_[_0x5497('0x32')](_0x580e86,_0x5497('0x30'));_0x1656c7[_0x5497('0x36')]=_[_0x5497('0x37')](_0x44299b[_0x5497('0x36')]);_0x1656c7['filters']=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],_0x1656c7[_0x5497('0x36')]);_0x1b9cd8[_0x5497('0x39')]=_[_0x5497('0x38')](_0x1656c7[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x44299b[_0x5497('0x36')][_0x5497('0x3a')]));_0x1b9cd8['attributes']=_0x1b9cd8[_0x5497('0x39')][_0x5497('0x3b')]?_0x1b9cd8[_0x5497('0x39')]:_0x1656c7[_0x5497('0x35')];if(!_0x44299b[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1b9cd8['limit']=qs[_0x5497('0x2a')](_0x44299b[_0x5497('0x36')][_0x5497('0x2a')]);_0x1b9cd8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x44299b[_0x5497('0x36')][_0x5497('0x3e')]);}_0x1b9cd8['order']=qs[_0x5497('0x3f')](_0x44299b[_0x5497('0x36')][_0x5497('0x3f')]);_0x1b9cd8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x44299b[_0x5497('0x36')],_0x1656c7[_0x5497('0x41')]),_0x580e86);if(_0x44299b[_0x5497('0x36')][_0x5497('0x43')]){_0x1b9cd8['where']=_[_0x5497('0x44')](_0x1b9cd8['where'],{'$or':_[_0x5497('0x32')](_0x580e86,function(_0x9fc24){if(_0x9fc24[_0x5497('0x45')]!==_0x5497('0x46')){var _0x133746={};_0x133746[_0x9fc24['name']]={'$like':'%'+_0x44299b[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x133746;}})});}_0x1b9cd8=_['merge']({},_0x1b9cd8,_0x44299b[_0x5497('0x47')]);var _0x553279={'where':_0x1b9cd8[_0x5497('0x40')]};return db['FreshsalesConfiguration'][_0x5497('0x48')](_0x553279)[_0x5497('0x2e')](function(_0x2e8c6a){_0x37011c[_0x5497('0x48')]=_0x2e8c6a;if(_0x44299b[_0x5497('0x36')]['includeAll']){_0x1b9cd8['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x1b9cd8);})[_0x5497('0x2e')](function(_0x43c430){_0x37011c[_0x5497('0x49')]=_0x43c430;return _0x37011c;})[_0x5497('0x2e')](respondWithFilteredResult(_0xc7730,_0x1b9cd8))[_0x5497('0x25')](handleError(_0xc7730,null));};exports[_0x5497('0x4a')]=function(_0xc78abe,_0x466287){var _0x2626bf={'raw':![],'where':{'id':_0xc78abe[_0x5497('0x4b')]['id']}},_0x57350a={};_0x57350a[_0x5497('0x35')]=_[_0x5497('0x37')](db['FreshsalesConfiguration'][_0x5497('0x33')]);_0x57350a['query']=_[_0x5497('0x37')](_0xc78abe[_0x5497('0x36')]);_0x57350a[_0x5497('0x41')]=_['intersection'](_0x57350a[_0x5497('0x35')],_0x57350a[_0x5497('0x36')]);_0x2626bf['attributes']=_[_0x5497('0x38')](_0x57350a['model'],qs[_0x5497('0x3a')](_0xc78abe['query'][_0x5497('0x3a')]));_0x2626bf[_0x5497('0x39')]=_0x2626bf[_0x5497('0x39')][_0x5497('0x3b')]?_0x2626bf[_0x5497('0x39')]:_0x57350a[_0x5497('0x35')];if(_0xc78abe[_0x5497('0x36')][_0x5497('0x4c')]){_0x2626bf['include']=[{'all':!![]}];}_0x2626bf=_[_0x5497('0x44')]({},_0x2626bf,_0xc78abe['options']);return db['FreshsalesConfiguration'][_0x5497('0x4d')](_0x2626bf)[_0x5497('0x2e')](handleEntityNotFound(_0x466287,null))['then'](respondWithResult(_0x466287,null))[_0x5497('0x25')](handleError(_0x466287,null));};exports[_0x5497('0x4e')]=function(_0x436a83,_0x3094c7){return db['FreshsalesConfiguration'][_0x5497('0x4e')](_0x436a83['body'],{})['then'](respondWithResult(_0x3094c7,0xc9))[_0x5497('0x25')](handleError(_0x3094c7,null));};exports[_0x5497('0x4f')]=function(_0x2f7ec8,_0x49c85a){if(_0x2f7ec8['body']['id']){delete _0x2f7ec8[_0x5497('0x50')]['id'];}return db['FreshsalesConfiguration'][_0x5497('0x4d')]({'where':{'id':_0x2f7ec8['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x49c85a,null))['then'](saveUpdates(_0x2f7ec8[_0x5497('0x50')],null))[_0x5497('0x2e')](respondWithResult(_0x49c85a,null))['catch'](handleError(_0x49c85a,null));};exports[_0x5497('0x51')]=function(_0x5dccfb,_0x506d69){return db[_0x5497('0x52')][_0x5497('0x4d')]({'where':{'id':_0x5dccfb['params']['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x506d69,null))[_0x5497('0x2e')](removeEntity(_0x506d69,null))[_0x5497('0x25')](handleError(_0x506d69,null));};exports[_0x5497('0x53')]=function(_0x3fca40,_0x25c75e,_0x590be7){var _0x215ea8={};var _0x4916cd={};var _0x4e0d4c;var _0x480582;return db[_0x5497('0x52')][_0x5497('0x54')]({'where':{'id':_0x3fca40[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25c75e,null))[_0x5497('0x2e')](function(_0x528fb4){if(_0x528fb4){_0x4e0d4c=_0x528fb4;_0x4916cd['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x4916cd[_0x5497('0x36')]=_[_0x5497('0x37')](_0x3fca40[_0x5497('0x36')]);_0x4916cd['filters']=_[_0x5497('0x38')](_0x4916cd[_0x5497('0x35')],_0x4916cd[_0x5497('0x36')]);_0x215ea8[_0x5497('0x39')]=_['intersection'](_0x4916cd[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x3fca40[_0x5497('0x36')][_0x5497('0x3a')]));_0x215ea8['attributes']=_0x215ea8[_0x5497('0x39')][_0x5497('0x3b')]?_0x215ea8[_0x5497('0x39')]:_0x4916cd['model'];_0x215ea8[_0x5497('0x56')]=qs['sort'](_0x3fca40['query']['sort']);_0x215ea8[_0x5497('0x40')]=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x3fca40['query'],_0x4916cd[_0x5497('0x41')]));if(_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]){_0x215ea8[_0x5497('0x40')]=_['merge'](_0x215ea8[_0x5497('0x40')],{'$or':_[_0x5497('0x32')](_0x215ea8[_0x5497('0x39')],function(_0x49617c){var _0x164de1={};_0x164de1[_0x49617c]={'$like':'%'+_0x3fca40[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x164de1;})});}_0x215ea8=_[_0x5497('0x44')]({},_0x215ea8,_0x3fca40[_0x5497('0x47')]);return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x4b4cfe){if(_0x4b4cfe){_0x480582=_0x4b4cfe[_0x5497('0x3b')];if(!_0x3fca40[_0x5497('0x36')][_0x5497('0x3c')](_0x5497('0x3d'))){_0x215ea8['limit']=qs['limit'](_0x3fca40['query'][_0x5497('0x2a')]);_0x215ea8[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x3fca40['query'][_0x5497('0x3e')]);}return _0x4e0d4c[_0x5497('0x53')](_0x215ea8);}})[_0x5497('0x2e')](function(_0x464df3){if(_0x464df3){return _0x464df3?{'count':_0x480582,'rows':_0x464df3}:null;}})[_0x5497('0x2e')](respondWithResult(_0x25c75e,null))[_0x5497('0x25')](handleError(_0x25c75e,null));};exports[_0x5497('0x57')]=function(_0x23bd32,_0x21da3d,_0x940188){var _0x1fc6ad={};var _0x5a8b3a={};var _0x15d5a4;var _0x2940ec;return db[_0x5497('0x52')]['findOne']({'where':{'id':_0x23bd32[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21da3d,null))[_0x5497('0x2e')](function(_0x469e97){if(_0x469e97){_0x15d5a4=_0x469e97;_0x5a8b3a['model']=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x5a8b3a[_0x5497('0x36')]=_['keys'](_0x23bd32[_0x5497('0x36')]);_0x5a8b3a[_0x5497('0x41')]=_[_0x5497('0x38')](_0x5a8b3a['model'],_0x5a8b3a[_0x5497('0x36')]);_0x1fc6ad[_0x5497('0x39')]=_['intersection'](_0x5a8b3a[_0x5497('0x35')],qs[_0x5497('0x3a')](_0x23bd32[_0x5497('0x36')]['fields']));_0x1fc6ad['attributes']=_0x1fc6ad[_0x5497('0x39')][_0x5497('0x3b')]?_0x1fc6ad[_0x5497('0x39')]:_0x5a8b3a[_0x5497('0x35')];_0x1fc6ad[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x23bd32[_0x5497('0x36')]['sort']);_0x1fc6ad['where']=qs[_0x5497('0x41')](_[_0x5497('0x42')](_0x23bd32['query'],_0x5a8b3a[_0x5497('0x41')]));if(_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]){_0x1fc6ad['where']=_[_0x5497('0x44')](_0x1fc6ad[_0x5497('0x40')],{'$or':_['map'](_0x1fc6ad[_0x5497('0x39')],function(_0x16e2cf){var _0x9458d7={};_0x9458d7[_0x16e2cf]={'$like':'%'+_0x23bd32[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x9458d7;})});}_0x1fc6ad=_['merge']({},_0x1fc6ad,_0x23bd32[_0x5497('0x47')]);return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x23e259){if(_0x23e259){_0x2940ec=_0x23e259[_0x5497('0x3b')];if(!_0x23bd32['query'][_0x5497('0x3c')](_0x5497('0x3d'))){_0x1fc6ad[_0x5497('0x2a')]=qs[_0x5497('0x2a')](_0x23bd32['query'][_0x5497('0x2a')]);_0x1fc6ad[_0x5497('0x3e')]=qs['offset'](_0x23bd32[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x15d5a4[_0x5497('0x57')](_0x1fc6ad);}})[_0x5497('0x2e')](function(_0x53b1b7){if(_0x53b1b7){return _0x53b1b7?{'count':_0x2940ec,'rows':_0x53b1b7}:null;}})['then'](respondWithResult(_0x21da3d,null))['catch'](handleError(_0x21da3d,null));};exports['getFields']=function(_0x594761,_0x2d5543,_0x2375cc){var _0x15d0da={};var _0x1f02d3={};var _0x41f347;var _0x4b7c43;return db['FreshsalesConfiguration'][_0x5497('0x54')]({'where':{'id':_0x594761[_0x5497('0x4b')]['id']}})[_0x5497('0x2e')](handleEntityNotFound(_0x2d5543,null))[_0x5497('0x2e')](function(_0x307dc5){if(_0x307dc5){_0x41f347=_0x307dc5;_0x1f02d3[_0x5497('0x35')]=_[_0x5497('0x37')](db[_0x5497('0x55')][_0x5497('0x33')]);_0x1f02d3[_0x5497('0x36')]=_['keys'](_0x594761[_0x5497('0x36')]);_0x1f02d3[_0x5497('0x41')]=_[_0x5497('0x38')](_0x1f02d3[_0x5497('0x35')],_0x1f02d3[_0x5497('0x36')]);_0x15d0da[_0x5497('0x39')]=_['intersection'](_0x1f02d3[_0x5497('0x35')],qs['fields'](_0x594761[_0x5497('0x36')][_0x5497('0x3a')]));_0x15d0da[_0x5497('0x39')]=_0x15d0da['attributes']['length']?_0x15d0da[_0x5497('0x39')]:_0x1f02d3[_0x5497('0x35')];_0x15d0da[_0x5497('0x56')]=qs[_0x5497('0x3f')](_0x594761[_0x5497('0x36')][_0x5497('0x3f')]);_0x15d0da[_0x5497('0x40')]=qs[_0x5497('0x41')](_['pick'](_0x594761['query'],_0x1f02d3['filters']));if(_0x594761[_0x5497('0x36')][_0x5497('0x43')]){_0x15d0da[_0x5497('0x40')]=_[_0x5497('0x44')](_0x15d0da['where'],{'$or':_['map'](_0x15d0da[_0x5497('0x39')],function(_0xf38193){var _0x5dd9bc={};_0x5dd9bc[_0xf38193]={'$like':'%'+_0x594761[_0x5497('0x36')][_0x5497('0x43')]+'%'};return _0x5dd9bc;})});}_0x15d0da=_[_0x5497('0x44')]({},_0x15d0da,_0x594761[_0x5497('0x47')]);return _0x41f347['getFields'](_0x15d0da);}})['then'](function(_0x55e597){if(_0x55e597){_0x4b7c43=_0x55e597['length'];if(!_0x594761['query'][_0x5497('0x3c')]('nolimit')){_0x15d0da[_0x5497('0x2a')]=qs['limit'](_0x594761[_0x5497('0x36')][_0x5497('0x2a')]);_0x15d0da[_0x5497('0x3e')]=qs[_0x5497('0x3e')](_0x594761[_0x5497('0x36')][_0x5497('0x3e')]);}return _0x41f347['getFields'](_0x15d0da);}})[_0x5497('0x2e')](function(_0x513479){if(_0x513479){return _0x513479?{'count':_0x4b7c43,'rows':_0x513479}:null;}})[_0x5497('0x2e')](respondWithResult(_0x2d5543,null))[_0x5497('0x25')](handleError(_0x2d5543,null));}; \ No newline at end of file +var _0xabce=['../../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','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','status','json','offset','set','Content-Range','apply','reject','update','end','sendStatus','name','index','map','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','length','limit','order','pick','filters','where','VIRTUAL','merge','options','FreshsalesConfiguration','count','include','findAll','rows','show','params','fields','includeAll','find','create','body','getSubjects','findOne','sort','filter','getDescriptions','FreshsalesField','hasOwnProperty','nolimit','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xabce,0x103));var _0xeabc=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xabce[_0x3de8a4];return _0x4635cf;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var jayson=require(_0xeabc('0x1a'));var client=jayson[_0xeabc('0x1b')][_0xeabc('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x53df9c,_0x235c2d,_0x1319f3,_0x3251c6){return new BPromise(function(_0x55f0de,_0x5f4ee8){var _0x3170ea=_0x3251c6||client;return _0x3170ea[_0xeabc('0x1d')](_0x53df9c,_0x1319f3)[_0xeabc('0x1e')](function(_0x53d5cb){logger[_0xeabc('0x1f')](_0xeabc('0x20'),_0x235c2d,'request\x20sent');logger['debug'](_0xeabc('0x21'),_0x235c2d,'request\x20sent',JSON[_0xeabc('0x22')](_0x53d5cb));if(_0x53d5cb[_0xeabc('0x23')]){if(_0x53d5cb[_0xeabc('0x23')][_0xeabc('0x24')]===0x1f4){logger[_0xeabc('0x23')](_0xeabc('0x20'),_0x235c2d,_0x53d5cb[_0xeabc('0x23')][_0xeabc('0x25')]);return _0x5f4ee8(_0x53d5cb['error'][_0xeabc('0x25')]);}logger['error'](_0xeabc('0x20'),_0x235c2d,_0x53d5cb[_0xeabc('0x23')]['message']);return _0x55f0de(_0x53d5cb[_0xeabc('0x23')][_0xeabc('0x25')]);}else{logger[_0xeabc('0x1f')](_0xeabc('0x20'),_0x235c2d,_0xeabc('0x26'));_0x55f0de(_0x53d5cb['result'][_0xeabc('0x25')]);}})[_0xeabc('0x27')](function(_0x91ab00){logger['error'](_0xeabc('0x20'),_0x235c2d,_0x91ab00);_0x5f4ee8(_0x91ab00);});});}function respondWithStatusCode(_0x3854d2,_0x214953){_0x214953=_0x214953||0xcc;return function(_0x319119){if(_0x319119){return _0x3854d2['sendStatus'](_0x214953);}return _0x3854d2[_0xeabc('0x28')](_0x214953)['end']();};}function respondWithResult(_0x27dbaf,_0x4d4e29){_0x4d4e29=_0x4d4e29||0xc8;return function(_0x811f0d){if(_0x811f0d){return _0x27dbaf[_0xeabc('0x28')](_0x4d4e29)[_0xeabc('0x29')](_0x811f0d);}};}function respondWithFilteredResult(_0x3f194e,_0x3a1a04){return function(_0x137293){if(_0x137293){var _0x131722=_0x137293['count'],_0x4c2693=_0x3a1a04[_0xeabc('0x2a')],_0x5b2934=_0x3a1a04[_0xeabc('0x2a')]+_0x3a1a04['limit'],_0x459c8a;if(_0x5b2934>=_0x131722){_0x5b2934=_0x131722;_0x459c8a=0xc8;}else{_0x459c8a=0xce;}_0x3f194e[_0xeabc('0x28')](_0x459c8a);return _0x3f194e[_0xeabc('0x2b')](_0xeabc('0x2c'),_0x4c2693+'-'+_0x5b2934+'/'+_0x131722)[_0xeabc('0x29')](_0x137293);}return null;};}function patchUpdates(_0x149170){return function(_0x481ee1){try{jsonpatch[_0xeabc('0x2d')](_0x481ee1,_0x149170,!![]);}catch(_0x38dc0a){return BPromise[_0xeabc('0x2e')](_0x38dc0a);}return _0x481ee1['save']();};}function saveUpdates(_0x5b34dd,_0x5bb1f1){return function(_0x2f03e8){if(_0x2f03e8){return _0x2f03e8[_0xeabc('0x2f')](_0x5b34dd)[_0xeabc('0x1e')](function(_0x3c606a){return _0x3c606a;});}return null;};}function removeEntity(_0x73c8d4,_0x368b8a){return function(_0x61c0af){if(_0x61c0af){return _0x61c0af['destroy']()[_0xeabc('0x1e')](function(){_0x73c8d4[_0xeabc('0x28')](0xcc)[_0xeabc('0x30')]();});}};}function handleEntityNotFound(_0x4918e2,_0x1e74ca){return function(_0x3777c1){if(!_0x3777c1){_0x4918e2[_0xeabc('0x31')](0x194);}return _0x3777c1;};}function handleError(_0x4e9e17,_0xc0a5b0){_0xc0a5b0=_0xc0a5b0||0x1f4;return function(_0x36cc2f){logger[_0xeabc('0x23')](_0x36cc2f['stack']);if(_0x36cc2f[_0xeabc('0x32')]){delete _0x36cc2f[_0xeabc('0x32')];}_0x4e9e17['status'](_0xc0a5b0)['send'](_0x36cc2f);};}exports[_0xeabc('0x33')]=function(_0x3829a9,_0x4fc60c){var _0x43df50={},_0x81976d={},_0x3edee7={'count':0x0,'rows':[]};var _0x10434e=_[_0xeabc('0x34')](db['FreshsalesConfiguration'][_0xeabc('0x35')],function(_0x5b61fa){return{'name':_0x5b61fa[_0xeabc('0x36')],'type':_0x5b61fa[_0xeabc('0x37')][_0xeabc('0x38')]};});_0x81976d['model']=_['map'](_0x10434e,_0xeabc('0x32'));_0x81976d['query']=_[_0xeabc('0x39')](_0x3829a9['query']);_0x81976d['filters']=_['intersection'](_0x81976d['model'],_0x81976d[_0xeabc('0x3a')]);_0x43df50['attributes']=_[_0xeabc('0x3b')](_0x81976d[_0xeabc('0x3c')],qs['fields'](_0x3829a9[_0xeabc('0x3a')]['fields']));_0x43df50[_0xeabc('0x3d')]=_0x43df50['attributes'][_0xeabc('0x3e')]?_0x43df50[_0xeabc('0x3d')]:_0x81976d[_0xeabc('0x3c')];if(!_0x3829a9['query']['hasOwnProperty']('nolimit')){_0x43df50[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x3829a9[_0xeabc('0x3a')]['limit']);_0x43df50['offset']=qs[_0xeabc('0x2a')](_0x3829a9[_0xeabc('0x3a')]['offset']);}_0x43df50[_0xeabc('0x40')]=qs['sort'](_0x3829a9[_0xeabc('0x3a')]['sort']);_0x43df50['where']=qs['filters'](_[_0xeabc('0x41')](_0x3829a9[_0xeabc('0x3a')],_0x81976d[_0xeabc('0x42')]),_0x10434e);if(_0x3829a9[_0xeabc('0x3a')]['filter']){_0x43df50[_0xeabc('0x43')]=_['merge'](_0x43df50[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x10434e,function(_0x3a7807){if(_0x3a7807[_0xeabc('0x37')]!==_0xeabc('0x44')){var _0x48b988={};_0x48b988[_0x3a7807['name']]={'$like':'%'+_0x3829a9[_0xeabc('0x3a')]['filter']+'%'};return _0x48b988;}})});}_0x43df50=_[_0xeabc('0x45')]({},_0x43df50,_0x3829a9[_0xeabc('0x46')]);var _0x4d92b2={'where':_0x43df50[_0xeabc('0x43')]};return db[_0xeabc('0x47')][_0xeabc('0x48')](_0x4d92b2)[_0xeabc('0x1e')](function(_0x4360d7){_0x3edee7[_0xeabc('0x48')]=_0x4360d7;if(_0x3829a9[_0xeabc('0x3a')]['includeAll']){_0x43df50[_0xeabc('0x49')]=[{'all':!![]}];}return db[_0xeabc('0x47')][_0xeabc('0x4a')](_0x43df50);})[_0xeabc('0x1e')](function(_0x271f8c){_0x3edee7[_0xeabc('0x4b')]=_0x271f8c;return _0x3edee7;})[_0xeabc('0x1e')](respondWithFilteredResult(_0x4fc60c,_0x43df50))[_0xeabc('0x27')](handleError(_0x4fc60c,null));};exports[_0xeabc('0x4c')]=function(_0x44e714,_0x5689fc){var _0x38356c={'raw':![],'where':{'id':_0x44e714[_0xeabc('0x4d')]['id']}},_0x2e6efb={};_0x2e6efb[_0xeabc('0x3c')]=_[_0xeabc('0x39')](db[_0xeabc('0x47')][_0xeabc('0x35')]);_0x2e6efb['query']=_[_0xeabc('0x39')](_0x44e714[_0xeabc('0x3a')]);_0x2e6efb[_0xeabc('0x42')]=_[_0xeabc('0x3b')](_0x2e6efb[_0xeabc('0x3c')],_0x2e6efb['query']);_0x38356c[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](_0x2e6efb[_0xeabc('0x3c')],qs[_0xeabc('0x4e')](_0x44e714['query'][_0xeabc('0x4e')]));_0x38356c[_0xeabc('0x3d')]=_0x38356c['attributes'][_0xeabc('0x3e')]?_0x38356c['attributes']:_0x2e6efb[_0xeabc('0x3c')];if(_0x44e714['query'][_0xeabc('0x4f')]){_0x38356c[_0xeabc('0x49')]=[{'all':!![]}];}_0x38356c=_[_0xeabc('0x45')]({},_0x38356c,_0x44e714[_0xeabc('0x46')]);return db[_0xeabc('0x47')][_0xeabc('0x50')](_0x38356c)[_0xeabc('0x1e')](handleEntityNotFound(_0x5689fc,null))[_0xeabc('0x1e')](respondWithResult(_0x5689fc,null))[_0xeabc('0x27')](handleError(_0x5689fc,null));};exports[_0xeabc('0x51')]=function(_0x48a13f,_0x180a14){return db[_0xeabc('0x47')][_0xeabc('0x51')](_0x48a13f[_0xeabc('0x52')],{})['then'](respondWithResult(_0x180a14,0xc9))[_0xeabc('0x27')](handleError(_0x180a14,null));};exports[_0xeabc('0x2f')]=function(_0x10d56f,_0x21f972){if(_0x10d56f['body']['id']){delete _0x10d56f[_0xeabc('0x52')]['id'];}return db[_0xeabc('0x47')][_0xeabc('0x50')]({'where':{'id':_0x10d56f[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x21f972,null))[_0xeabc('0x1e')](saveUpdates(_0x10d56f[_0xeabc('0x52')],null))[_0xeabc('0x1e')](respondWithResult(_0x21f972,null))[_0xeabc('0x27')](handleError(_0x21f972,null));};exports['destroy']=function(_0x4546c4,_0x4cdb05){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x4546c4[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x4cdb05,null))[_0xeabc('0x1e')](removeEntity(_0x4cdb05,null))[_0xeabc('0x27')](handleError(_0x4cdb05,null));};exports[_0xeabc('0x53')]=function(_0x2f78f3,_0x4a2ad6,_0x4358d7){var _0x25fd83={};var _0x19f61e={};var _0x104c1e;var _0x2ddc53;return db[_0xeabc('0x47')][_0xeabc('0x54')]({'where':{'id':_0x2f78f3[_0xeabc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x4a2ad6,null))['then'](function(_0x180e62){if(_0x180e62){_0x104c1e=_0x180e62;_0x19f61e[_0xeabc('0x3c')]=_[_0xeabc('0x39')](db['FreshsalesField'][_0xeabc('0x35')]);_0x19f61e['query']=_['keys'](_0x2f78f3[_0xeabc('0x3a')]);_0x19f61e[_0xeabc('0x42')]=_[_0xeabc('0x3b')](_0x19f61e[_0xeabc('0x3c')],_0x19f61e[_0xeabc('0x3a')]);_0x25fd83[_0xeabc('0x3d')]=_['intersection'](_0x19f61e[_0xeabc('0x3c')],qs[_0xeabc('0x4e')](_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x4e')]));_0x25fd83[_0xeabc('0x3d')]=_0x25fd83[_0xeabc('0x3d')]['length']?_0x25fd83[_0xeabc('0x3d')]:_0x19f61e[_0xeabc('0x3c')];_0x25fd83[_0xeabc('0x40')]=qs[_0xeabc('0x55')](_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x55')]);_0x25fd83[_0xeabc('0x43')]=qs[_0xeabc('0x42')](_[_0xeabc('0x41')](_0x2f78f3['query'],_0x19f61e[_0xeabc('0x42')]));if(_0x2f78f3['query'][_0xeabc('0x56')]){_0x25fd83[_0xeabc('0x43')]=_[_0xeabc('0x45')](_0x25fd83[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x25fd83[_0xeabc('0x3d')],function(_0xf48062){var _0xb59a2a={};_0xb59a2a[_0xf48062]={'$like':'%'+_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x56')]+'%'};return _0xb59a2a;})});}_0x25fd83=_['merge']({},_0x25fd83,_0x2f78f3[_0xeabc('0x46')]);return _0x104c1e[_0xeabc('0x53')](_0x25fd83);}})[_0xeabc('0x1e')](function(_0x41cad5){if(_0x41cad5){_0x2ddc53=_0x41cad5['length'];if(!_0x2f78f3[_0xeabc('0x3a')]['hasOwnProperty']('nolimit')){_0x25fd83[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x2f78f3[_0xeabc('0x3a')][_0xeabc('0x3f')]);_0x25fd83['offset']=qs['offset'](_0x2f78f3[_0xeabc('0x3a')]['offset']);}return _0x104c1e['getSubjects'](_0x25fd83);}})[_0xeabc('0x1e')](function(_0x4f1a4f){if(_0x4f1a4f){return _0x4f1a4f?{'count':_0x2ddc53,'rows':_0x4f1a4f}:null;}})['then'](respondWithResult(_0x4a2ad6,null))[_0xeabc('0x27')](handleError(_0x4a2ad6,null));};exports[_0xeabc('0x57')]=function(_0x5613ef,_0x48cccc,_0xd866c0){var _0x5d183a={};var _0x238e2d={};var _0x15ca17;var _0x4c84a9;return db['FreshsalesConfiguration'][_0xeabc('0x54')]({'where':{'id':_0x5613ef[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x48cccc,null))[_0xeabc('0x1e')](function(_0x1debaa){if(_0x1debaa){_0x15ca17=_0x1debaa;_0x238e2d['model']=_['keys'](db[_0xeabc('0x58')]['rawAttributes']);_0x238e2d[_0xeabc('0x3a')]=_['keys'](_0x5613ef[_0xeabc('0x3a')]);_0x238e2d['filters']=_[_0xeabc('0x3b')](_0x238e2d['model'],_0x238e2d[_0xeabc('0x3a')]);_0x5d183a[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](_0x238e2d[_0xeabc('0x3c')],qs['fields'](_0x5613ef[_0xeabc('0x3a')]['fields']));_0x5d183a[_0xeabc('0x3d')]=_0x5d183a[_0xeabc('0x3d')][_0xeabc('0x3e')]?_0x5d183a[_0xeabc('0x3d')]:_0x238e2d[_0xeabc('0x3c')];_0x5d183a['order']=qs[_0xeabc('0x55')](_0x5613ef[_0xeabc('0x3a')][_0xeabc('0x55')]);_0x5d183a[_0xeabc('0x43')]=qs['filters'](_[_0xeabc('0x41')](_0x5613ef[_0xeabc('0x3a')],_0x238e2d[_0xeabc('0x42')]));if(_0x5613ef[_0xeabc('0x3a')]['filter']){_0x5d183a[_0xeabc('0x43')]=_[_0xeabc('0x45')](_0x5d183a[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x5d183a['attributes'],function(_0x56b7d0){var _0x30e9eb={};_0x30e9eb[_0x56b7d0]={'$like':'%'+_0x5613ef['query']['filter']+'%'};return _0x30e9eb;})});}_0x5d183a=_[_0xeabc('0x45')]({},_0x5d183a,_0x5613ef[_0xeabc('0x46')]);return _0x15ca17[_0xeabc('0x57')](_0x5d183a);}})['then'](function(_0x1baf30){if(_0x1baf30){_0x4c84a9=_0x1baf30[_0xeabc('0x3e')];if(!_0x5613ef['query'][_0xeabc('0x59')](_0xeabc('0x5a'))){_0x5d183a[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x5613ef[_0xeabc('0x3a')]['limit']);_0x5d183a[_0xeabc('0x2a')]=qs['offset'](_0x5613ef['query']['offset']);}return _0x15ca17[_0xeabc('0x57')](_0x5d183a);}})[_0xeabc('0x1e')](function(_0x1b6e9e){if(_0x1b6e9e){return _0x1b6e9e?{'count':_0x4c84a9,'rows':_0x1b6e9e}:null;}})[_0xeabc('0x1e')](respondWithResult(_0x48cccc,null))[_0xeabc('0x27')](handleError(_0x48cccc,null));};exports['getFields']=function(_0x39f961,_0x47fd82,_0x1795fe){var _0x2f95c7={};var _0x4dac49={};var _0x11dda7;var _0x4d7821;return db['FreshsalesConfiguration'][_0xeabc('0x54')]({'where':{'id':_0x39f961[_0xeabc('0x4d')]['id']}})[_0xeabc('0x1e')](handleEntityNotFound(_0x47fd82,null))[_0xeabc('0x1e')](function(_0x3c6a49){if(_0x3c6a49){_0x11dda7=_0x3c6a49;_0x4dac49['model']=_[_0xeabc('0x39')](db[_0xeabc('0x58')][_0xeabc('0x35')]);_0x4dac49[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x39f961[_0xeabc('0x3a')]);_0x4dac49[_0xeabc('0x42')]=_[_0xeabc('0x3b')](_0x4dac49[_0xeabc('0x3c')],_0x4dac49[_0xeabc('0x3a')]);_0x2f95c7['attributes']=_[_0xeabc('0x3b')](_0x4dac49[_0xeabc('0x3c')],qs[_0xeabc('0x4e')](_0x39f961['query']['fields']));_0x2f95c7[_0xeabc('0x3d')]=_0x2f95c7[_0xeabc('0x3d')][_0xeabc('0x3e')]?_0x2f95c7[_0xeabc('0x3d')]:_0x4dac49[_0xeabc('0x3c')];_0x2f95c7['order']=qs[_0xeabc('0x55')](_0x39f961['query']['sort']);_0x2f95c7[_0xeabc('0x43')]=qs[_0xeabc('0x42')](_['pick'](_0x39f961[_0xeabc('0x3a')],_0x4dac49[_0xeabc('0x42')]));if(_0x39f961[_0xeabc('0x3a')][_0xeabc('0x56')]){_0x2f95c7[_0xeabc('0x43')]=_[_0xeabc('0x45')](_0x2f95c7[_0xeabc('0x43')],{'$or':_[_0xeabc('0x34')](_0x2f95c7[_0xeabc('0x3d')],function(_0x1b0995){var _0x1f8197={};_0x1f8197[_0x1b0995]={'$like':'%'+_0x39f961['query'][_0xeabc('0x56')]+'%'};return _0x1f8197;})});}_0x2f95c7=_['merge']({},_0x2f95c7,_0x39f961[_0xeabc('0x46')]);return _0x11dda7[_0xeabc('0x5b')](_0x2f95c7);}})[_0xeabc('0x1e')](function(_0x2d1441){if(_0x2d1441){_0x4d7821=_0x2d1441[_0xeabc('0x3e')];if(!_0x39f961[_0xeabc('0x3a')][_0xeabc('0x59')](_0xeabc('0x5a'))){_0x2f95c7[_0xeabc('0x3f')]=qs[_0xeabc('0x3f')](_0x39f961[_0xeabc('0x3a')]['limit']);_0x2f95c7[_0xeabc('0x2a')]=qs[_0xeabc('0x2a')](_0x39f961[_0xeabc('0x3a')][_0xeabc('0x2a')]);}return _0x11dda7['getFields'](_0x2f95c7);}})[_0xeabc('0x1e')](function(_0x180f99){if(_0x180f99){return _0x180f99?{'count':_0x4d7821,'rows':_0x180f99}:null;}})['then'](respondWithResult(_0x47fd82,null))[_0xeabc('0x27')](handleError(_0x47fd82,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 2705ee3..7a052e5 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 _0x3526=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util'];(function(_0x239bc7,_0x20ba11){var _0x257cc3=function(_0xc97c77){while(--_0xc97c77){_0x239bc7['push'](_0x239bc7['shift']());}};_0x257cc3(++_0x20ba11);}(_0x3526,0x1db));var _0x6352=function(_0x5e2a46,_0x4e21f9){_0x5e2a46=_0x5e2a46-0x0;var _0x3e1947=_0x3526[_0x5e2a46];return _0x3e1947;};'use strict';var _=require('lodash');var util=require(_0x6352('0x0'));var logger=require(_0x6352('0x1'))(_0x6352('0x2'));var moment=require(_0x6352('0x3'));var BPromise=require(_0x6352('0x4'));var rp=require(_0x6352('0x5'));var fs=require('fs');var path=require(_0x6352('0x6'));var rimraf=require(_0x6352('0x7'));var config=require(_0x6352('0x8'));var attributes=require(_0x6352('0x9'));module[_0x6352('0xa')]=function(_0x11a73f,_0x3d5035){return _0x11a73f[_0x6352('0xb')](_0x6352('0xc'),attributes,{'tableName':_0x6352('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf96=['exports','FreshsalesConfiguration','lodash','util','api','moment','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes'];(function(_0x187499,_0x5e416a){var _0x2965fe=function(_0xc6645e){while(--_0xc6645e){_0x187499['push'](_0x187499['shift']());}};_0x2965fe(++_0x5e416a);}(_0xdf96,0xfc));var _0x6df9=function(_0x28bb8a,_0x3abbcb){_0x28bb8a=_0x28bb8a-0x0;var _0x300f69=_0xdf96[_0x28bb8a];return _0x300f69;};'use strict';var _=require(_0x6df9('0x0'));var util=require(_0x6df9('0x1'));var logger=require('../../config/logger')(_0x6df9('0x2'));var moment=require(_0x6df9('0x3'));var BPromise=require('bluebird');var rp=require(_0x6df9('0x4'));var fs=require('fs');var path=require(_0x6df9('0x5'));var rimraf=require(_0x6df9('0x6'));var config=require('../../config/environment');var attributes=require(_0x6df9('0x7'));module[_0x6df9('0x8')]=function(_0x428cf5,_0x2a380d){return _0x428cf5['define'](_0x6df9('0x9'),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 e71ad3a..6a9f8d5 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 _0x2504=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x35a3e1,_0x4d8f93){var _0x43e8ab=function(_0x5d79cf){while(--_0x5d79cf){_0x35a3e1['push'](_0x35a3e1['shift']());}};_0x43e8ab(++_0x4d8f93);}(_0x2504,0xee));var _0x4250=function(_0x4f89ca,_0x41dc1f){_0x4f89ca=_0x4f89ca-0x0;var _0x4c8a44=_0x2504[_0x4f89ca];return _0x4c8a44;};'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')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5a5286,_0x4250('0x10'));logger[_0x4250('0x11')]('FreshsalesConfiguration,\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 _0xc900=['request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc900,0xb3));var _0x0c90=function(_0x112d25,_0x475919){_0x112d25=_0x112d25-0x0;var _0x4d4e87=_0xc900[_0x112d25];return _0x4d4e87;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302ab1,_0x5b1a5c,_0x24e5be){return new BPromise(function(_0x1c1996,_0x23daed){return client[_0x0c90('0xa')](_0x302ab1,_0x24e5be)[_0x0c90('0xb')](function(_0x3d0f49){logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,_0x0c90('0xe'));logger[_0x0c90('0xf')](_0x0c90('0x10'),_0x5b1a5c,_0x0c90('0xe'),JSON[_0x0c90('0x11')](_0x3d0f49));if(_0x3d0f49['error']){if(_0x3d0f49[_0x0c90('0x12')]['code']===0x1f4){logger[_0x0c90('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x23daed(_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);}logger[_0x0c90('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5b1a5c,_0x3d0f49[_0x0c90('0x12')][_0x0c90('0x13')]);return _0x1c1996(_0x3d0f49['error'][_0x0c90('0x13')]);}else{logger[_0x0c90('0xc')](_0x0c90('0xd'),_0x5b1a5c,'request\x20sent');_0x1c1996(_0x3d0f49['result'][_0x0c90('0x13')]);}})[_0x0c90('0x14')](function(_0x2b8135){logger[_0x0c90('0x12')](_0x0c90('0xd'),_0x5b1a5c,_0x2b8135);_0x23daed(_0x2b8135);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3eea8e8..fe29e5b 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 _0x8438=['update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x2ba650,_0x2f2c61){var _0x2d7600=function(_0x31080f){while(--_0x31080f){_0x2ba650['push'](_0x2ba650['shift']());}};_0x2d7600(++_0x2f2c61);}(_0x8438,0x19b));var _0x8843=function(_0x313282,_0x4583d6){_0x313282=_0x313282-0x0;var _0x3c4704=_0x8438[_0x313282];return _0x3c4704;};'use strict';var multer=require(_0x8843('0x0'));var util=require(_0x8843('0x1'));var path=require(_0x8843('0x2'));var timeout=require(_0x8843('0x3'));var express=require('express');var router=express[_0x8843('0x4')]();var auth=require(_0x8843('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router[_0x8843('0x6')]('/',auth['isAuthenticated'](),controller[_0x8843('0x7')]);router[_0x8843('0x6')](_0x8843('0x8'),auth[_0x8843('0x9')](),controller[_0x8843('0xa')]);router[_0x8843('0xb')]('/',auth[_0x8843('0x9')](),controller[_0x8843('0xc')]);router[_0x8843('0xd')](_0x8843('0x8'),auth[_0x8843('0x9')](),controller[_0x8843('0xe')]);router['delete'](_0x8843('0x8'),auth['isAuthenticated'](),controller[_0x8843('0xf')]);module[_0x8843('0x10')]=router; \ No newline at end of file +var _0xe4fc=['update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x1be8e3,_0x2db235){var _0x3bdc7=function(_0x441170){while(--_0x441170){_0x1be8e3['push'](_0x1be8e3['shift']());}};_0x3bdc7(++_0x2db235);}(_0xe4fc,0x1bc));var _0xce4f=function(_0x465be6,_0x2668de){_0x465be6=_0x465be6-0x0;var _0x45f7b1=_0xe4fc[_0x465be6];return _0x45f7b1;};'use strict';var multer=require(_0xce4f('0x0'));var util=require(_0xce4f('0x1'));var path=require(_0xce4f('0x2'));var timeout=require('connect-timeout');var express=require(_0xce4f('0x3'));var router=express['Router']();var auth=require(_0xce4f('0x4'));var interaction=require(_0xce4f('0x5'));var config=require(_0xce4f('0x6'));var controller=require(_0xce4f('0x7'));router[_0xce4f('0x8')]('/',auth[_0xce4f('0x9')](),controller[_0xce4f('0xa')]);router[_0xce4f('0x8')](_0xce4f('0xb'),auth['isAuthenticated'](),controller[_0xce4f('0xc')]);router[_0xce4f('0xd')]('/',auth[_0xce4f('0x9')](),controller[_0xce4f('0xe')]);router[_0xce4f('0xf')](_0xce4f('0xb'),auth[_0xce4f('0x9')](),controller[_0xce4f('0x10')]);router[_0xce4f('0x11')](_0xce4f('0xb'),auth[_0xce4f('0x9')](),controller[_0xce4f('0x12')]);module[_0xce4f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 3254816..766b19d 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 _0x1c2a=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x542a4e,_0x23f7ef){var _0x11d75d=function(_0x12c1c7){while(--_0x12c1c7){_0x542a4e['push'](_0x542a4e['shift']());}};_0x11d75d(++_0x23f7ef);}(_0x1c2a,0xb6));var _0xa1c2=function(_0x33cc16,_0x33fea2){_0x33cc16=_0x33cc16-0x0;var _0x2f2957=_0x1c2a[_0x33cc16];return _0x2f2957;};'use strict';var Sequelize=require(_0xa1c2('0x0'));module[_0xa1c2('0x1')]={'type':{'type':Sequelize[_0xa1c2('0x2')](_0xa1c2('0x3'),_0xa1c2('0x4'),_0xa1c2('0x5'),_0xa1c2('0x6')),'defaultValue':_0xa1c2('0x3')},'content':{'type':Sequelize[_0xa1c2('0x7')]},'key':{'type':Sequelize[_0xa1c2('0x7')]},'keyType':{'type':Sequelize[_0xa1c2('0x2')](_0xa1c2('0x3'),_0xa1c2('0x4'),_0xa1c2('0x5'))},'keyContent':{'type':Sequelize[_0xa1c2('0x7')]},'idField':{'type':Sequelize[_0xa1c2('0x7')]},'nameField':{'type':Sequelize[_0xa1c2('0x7')]},'customField':{'type':Sequelize[_0xa1c2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1799=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0xa7a530,_0x7b0627){var _0x2077ad=function(_0x12ad7c){while(--_0x12ad7c){_0xa7a530['push'](_0xa7a530['shift']());}};_0x2077ad(++_0x7b0627);}(_0x1799,0x19d));var _0x9179=function(_0x584a66,_0x218a5e){_0x584a66=_0x584a66-0x0;var _0x2b5fd3=_0x1799[_0x584a66];return _0x2b5fd3;};'use strict';var Sequelize=require(_0x9179('0x0'));module['exports']={'type':{'type':Sequelize[_0x9179('0x1')](_0x9179('0x2'),_0x9179('0x3'),_0x9179('0x4'),_0x9179('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9179('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9179('0x1')](_0x9179('0x2'),'variable',_0x9179('0x4'))},'keyContent':{'type':Sequelize[_0x9179('0x6')]},'idField':{'type':Sequelize[_0x9179('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9179('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9179('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d24a7cc..872d529 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 _0x9e88=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','save','update','destroy','then','error','stack','name','index','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','rows','catch','params','includeAll','options','find','create','body','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0xcf5f30,_0x3d08c6){var _0x1e174f=function(_0x3a056e){while(--_0x3a056e){_0xcf5f30['push'](_0xcf5f30['shift']());}};_0x1e174f(++_0x3d08c6);}(_0x9e88,0x1ce));var _0x89e8=function(_0x27bbaa,_0x11f6ef){_0x27bbaa=_0x27bbaa-0x0;var _0x1fcf65=_0x9e88[_0x27bbaa];return _0x1fcf65;};'use strict';var pdf=require(_0x89e8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x89e8('0x1'));var zipdir=require(_0x89e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x89e8('0x3'));var moment=require('moment');var BPromise=require(_0x89e8('0x4'));var Mustache=require(_0x89e8('0x5'));var util=require('util');var path=require('path');var sox=require(_0x89e8('0x6'));var csv=require('to-csv');var ejs=require(_0x89e8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x89e8('0x8'));var crypto=require(_0x89e8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x89e8('0xa'));var toCsv=require(_0x89e8('0xb'));var querystring=require(_0x89e8('0xc'));var Papa=require(_0x89e8('0xd'));var Redis=require(_0x89e8('0xe'));var authService=require(_0x89e8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x89e8('0x10'));var hardwareService=require(_0x89e8('0x11'));var logger=require(_0x89e8('0x12'))('api');var utils=require(_0x89e8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x89e8('0x14'));var db=require(_0x89e8('0x15'))['db'];function respondWithStatusCode(_0xdcd558,_0x19af40){_0x19af40=_0x19af40||0xcc;return function(_0x41ae99){if(_0x41ae99){return _0xdcd558[_0x89e8('0x16')](_0x19af40);}return _0xdcd558['status'](_0x19af40)[_0x89e8('0x17')]();};}function respondWithResult(_0x4d8ffb,_0x22c7ca){_0x22c7ca=_0x22c7ca||0xc8;return function(_0x1d0983){if(_0x1d0983){return _0x4d8ffb['status'](_0x22c7ca)[_0x89e8('0x18')](_0x1d0983);}};}function respondWithFilteredResult(_0x48294b,_0x16f2d4){return function(_0x42adac){if(_0x42adac){var _0xc69884=_0x42adac[_0x89e8('0x19')],_0xe8598b=_0x16f2d4[_0x89e8('0x1a')],_0x66d4fc=_0x16f2d4[_0x89e8('0x1a')]+_0x16f2d4[_0x89e8('0x1b')],_0x252279;if(_0x66d4fc>=_0xc69884){_0x66d4fc=_0xc69884;_0x252279=0xc8;}else{_0x252279=0xce;}_0x48294b[_0x89e8('0x1c')](_0x252279);return _0x48294b[_0x89e8('0x1d')](_0x89e8('0x1e'),_0xe8598b+'-'+_0x66d4fc+'/'+_0xc69884)[_0x89e8('0x18')](_0x42adac);}return null;};}function patchUpdates(_0x2f6491){return function(_0x4ba417){try{jsonpatch['apply'](_0x4ba417,_0x2f6491,!![]);}catch(_0x5dbe1f){return BPromise['reject'](_0x5dbe1f);}return _0x4ba417[_0x89e8('0x1f')]();};}function saveUpdates(_0x4120c8,_0x3f16ba){return function(_0x19c0b1){if(_0x19c0b1){return _0x19c0b1[_0x89e8('0x20')](_0x4120c8)['then'](function(_0x33f1d5){return _0x33f1d5;});}return null;};}function removeEntity(_0x3f0d9e,_0x2caefc){return function(_0x243db3){if(_0x243db3){return _0x243db3[_0x89e8('0x21')]()[_0x89e8('0x22')](function(){_0x3f0d9e[_0x89e8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20c1c1,_0x5c18a8){return function(_0x4eae32){if(!_0x4eae32){_0x20c1c1['sendStatus'](0x194);}return _0x4eae32;};}function handleError(_0x11d2c9,_0x5a8505){_0x5a8505=_0x5a8505||0x1f4;return function(_0x3e5f0b){logger[_0x89e8('0x23')](_0x3e5f0b[_0x89e8('0x24')]);if(_0x3e5f0b[_0x89e8('0x25')]){delete _0x3e5f0b[_0x89e8('0x25')];}_0x11d2c9['status'](_0x5a8505)['send'](_0x3e5f0b);};}exports[_0x89e8('0x26')]=function(_0x2501e1,_0x5c7ccc){var _0x343ba7={},_0x59ce73={},_0x362445={'count':0x0,'rows':[]};var _0xa4b595=_['map'](db[_0x89e8('0x27')][_0x89e8('0x28')],function(_0x7c1d64){return{'name':_0x7c1d64[_0x89e8('0x29')],'type':_0x7c1d64[_0x89e8('0x2a')][_0x89e8('0x2b')]};});_0x59ce73[_0x89e8('0x2c')]=_[_0x89e8('0x2d')](_0xa4b595,_0x89e8('0x25'));_0x59ce73[_0x89e8('0x2e')]=_[_0x89e8('0x2f')](_0x2501e1['query']);_0x59ce73[_0x89e8('0x30')]=_[_0x89e8('0x31')](_0x59ce73['model'],_0x59ce73[_0x89e8('0x2e')]);_0x343ba7[_0x89e8('0x32')]=_[_0x89e8('0x31')](_0x59ce73[_0x89e8('0x2c')],qs['fields'](_0x2501e1[_0x89e8('0x2e')][_0x89e8('0x33')]));_0x343ba7[_0x89e8('0x32')]=_0x343ba7['attributes'][_0x89e8('0x34')]?_0x343ba7[_0x89e8('0x32')]:_0x59ce73[_0x89e8('0x2c')];if(!_0x2501e1[_0x89e8('0x2e')]['hasOwnProperty'](_0x89e8('0x35'))){_0x343ba7[_0x89e8('0x1b')]=qs[_0x89e8('0x1b')](_0x2501e1[_0x89e8('0x2e')][_0x89e8('0x1b')]);_0x343ba7['offset']=qs[_0x89e8('0x1a')](_0x2501e1['query'][_0x89e8('0x1a')]);}_0x343ba7[_0x89e8('0x36')]=qs[_0x89e8('0x37')](_0x2501e1['query'][_0x89e8('0x37')]);_0x343ba7[_0x89e8('0x38')]=qs['filters'](_[_0x89e8('0x39')](_0x2501e1[_0x89e8('0x2e')],_0x59ce73[_0x89e8('0x30')]),_0xa4b595);if(_0x2501e1[_0x89e8('0x2e')][_0x89e8('0x3a')]){_0x343ba7[_0x89e8('0x38')]=_[_0x89e8('0x3b')](_0x343ba7[_0x89e8('0x38')],{'$or':_[_0x89e8('0x2d')](_0xa4b595,function(_0x13a384){if(_0x13a384['type']!=='VIRTUAL'){var _0xf61acc={};_0xf61acc[_0x13a384[_0x89e8('0x25')]]={'$like':'%'+_0x2501e1[_0x89e8('0x2e')][_0x89e8('0x3a')]+'%'};return _0xf61acc;}})});}_0x343ba7=_[_0x89e8('0x3b')]({},_0x343ba7,_0x2501e1['options']);var _0x62d71d={'where':_0x343ba7[_0x89e8('0x38')]};return db[_0x89e8('0x27')][_0x89e8('0x19')](_0x62d71d)[_0x89e8('0x22')](function(_0x313c8d){_0x362445[_0x89e8('0x19')]=_0x313c8d;if(_0x2501e1[_0x89e8('0x2e')]['includeAll']){_0x343ba7['include']=[{'all':!![]}];}return db[_0x89e8('0x27')]['findAll'](_0x343ba7);})['then'](function(_0x457801){_0x362445[_0x89e8('0x3c')]=_0x457801;return _0x362445;})['then'](respondWithFilteredResult(_0x5c7ccc,_0x343ba7))[_0x89e8('0x3d')](handleError(_0x5c7ccc,null));};exports['show']=function(_0x12b54a,_0x4be4f6){var _0x403ae5={'raw':!![],'where':{'id':_0x12b54a[_0x89e8('0x3e')]['id']}},_0x221f47={};_0x221f47[_0x89e8('0x2c')]=_[_0x89e8('0x2f')](db[_0x89e8('0x27')][_0x89e8('0x28')]);_0x221f47[_0x89e8('0x2e')]=_[_0x89e8('0x2f')](_0x12b54a[_0x89e8('0x2e')]);_0x221f47[_0x89e8('0x30')]=_['intersection'](_0x221f47[_0x89e8('0x2c')],_0x221f47[_0x89e8('0x2e')]);_0x403ae5[_0x89e8('0x32')]=_[_0x89e8('0x31')](_0x221f47[_0x89e8('0x2c')],qs['fields'](_0x12b54a[_0x89e8('0x2e')]['fields']));_0x403ae5[_0x89e8('0x32')]=_0x403ae5[_0x89e8('0x32')]['length']?_0x403ae5[_0x89e8('0x32')]:_0x221f47[_0x89e8('0x2c')];if(_0x12b54a['query'][_0x89e8('0x3f')]){_0x403ae5['include']=[{'all':!![]}];}_0x403ae5=_[_0x89e8('0x3b')]({},_0x403ae5,_0x12b54a[_0x89e8('0x40')]);return db[_0x89e8('0x27')][_0x89e8('0x41')](_0x403ae5)[_0x89e8('0x22')](handleEntityNotFound(_0x4be4f6,null))[_0x89e8('0x22')](respondWithResult(_0x4be4f6,null))['catch'](handleError(_0x4be4f6,null));};exports['create']=function(_0x1ef511,_0x5a203a){return db[_0x89e8('0x27')][_0x89e8('0x42')](_0x1ef511[_0x89e8('0x43')],{})[_0x89e8('0x22')](respondWithResult(_0x5a203a,0xc9))[_0x89e8('0x3d')](handleError(_0x5a203a,null));};exports[_0x89e8('0x20')]=function(_0xa39944,_0x3967b3){if(_0xa39944[_0x89e8('0x43')]['id']){delete _0xa39944[_0x89e8('0x43')]['id'];}return db[_0x89e8('0x27')][_0x89e8('0x41')]({'where':{'id':_0xa39944['params']['id']}})[_0x89e8('0x22')](handleEntityNotFound(_0x3967b3,null))[_0x89e8('0x22')](saveUpdates(_0xa39944[_0x89e8('0x43')],null))[_0x89e8('0x22')](respondWithResult(_0x3967b3,null))[_0x89e8('0x3d')](handleError(_0x3967b3,null));};exports['destroy']=function(_0x454758,_0x1b64e1){return db[_0x89e8('0x27')][_0x89e8('0x41')]({'where':{'id':_0x454758[_0x89e8('0x3e')]['id']}})[_0x89e8('0x22')](handleEntityNotFound(_0x1b64e1,null))[_0x89e8('0x22')](removeEntity(_0x1b64e1,null))[_0x89e8('0x3d')](handleError(_0x1b64e1,null));}; \ No newline at end of file +var _0x6015=['sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x16cfe1,_0x5e7ada){var _0x1b0635=function(_0x1da8ea){while(--_0x1da8ea){_0x16cfe1['push'](_0x16cfe1['shift']());}};_0x1b0635(++_0x5e7ada);}(_0x6015,0x184));var _0x5601=function(_0x508af4,_0x2fda41){_0x508af4=_0x508af4-0x0;var _0xa21277=_0x6015[_0x508af4];return _0xa21277;};'use strict';var pdf=require(_0x5601('0x0'));var emlformat=require(_0x5601('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5601('0x2'));var rp=require(_0x5601('0x3'));var moment=require(_0x5601('0x4'));var BPromise=require(_0x5601('0x5'));var Mustache=require(_0x5601('0x6'));var util=require(_0x5601('0x7'));var path=require('path');var sox=require(_0x5601('0x8'));var csv=require(_0x5601('0x9'));var ejs=require(_0x5601('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5601('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5601('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5601('0xd'));var Papa=require(_0x5601('0xe'));var Redis=require(_0x5601('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5601('0x10'));var logger=require(_0x5601('0x11'))(_0x5601('0x12'));var utils=require(_0x5601('0x13'));var config=require(_0x5601('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x327760,_0x196d91){_0x196d91=_0x196d91||0xcc;return function(_0x383405){if(_0x383405){return _0x327760['sendStatus'](_0x196d91);}return _0x327760[_0x5601('0x15')](_0x196d91)[_0x5601('0x16')]();};}function respondWithResult(_0x48c4d4,_0x58d698){_0x58d698=_0x58d698||0xc8;return function(_0x367b17){if(_0x367b17){return _0x48c4d4[_0x5601('0x15')](_0x58d698)[_0x5601('0x17')](_0x367b17);}};}function respondWithFilteredResult(_0x4eeec2,_0x52a33a){return function(_0x1f6f98){if(_0x1f6f98){var _0x7d418=_0x1f6f98['count'],_0x313315=_0x52a33a[_0x5601('0x18')],_0x187493=_0x52a33a['offset']+_0x52a33a[_0x5601('0x19')],_0x44784e;if(_0x187493>=_0x7d418){_0x187493=_0x7d418;_0x44784e=0xc8;}else{_0x44784e=0xce;}_0x4eeec2[_0x5601('0x15')](_0x44784e);return _0x4eeec2['set'](_0x5601('0x1a'),_0x313315+'-'+_0x187493+'/'+_0x7d418)['json'](_0x1f6f98);}return null;};}function patchUpdates(_0x1259ac){return function(_0x468812){try{jsonpatch[_0x5601('0x1b')](_0x468812,_0x1259ac,!![]);}catch(_0x11af40){return BPromise[_0x5601('0x1c')](_0x11af40);}return _0x468812['save']();};}function saveUpdates(_0x3df25f,_0x3f10e7){return function(_0x543526){if(_0x543526){return _0x543526['update'](_0x3df25f)['then'](function(_0x225bac){return _0x225bac;});}return null;};}function removeEntity(_0x27ad33,_0x4930b4){return function(_0x22b6a9){if(_0x22b6a9){return _0x22b6a9[_0x5601('0x1d')]()[_0x5601('0x1e')](function(){_0x27ad33[_0x5601('0x15')](0xcc)[_0x5601('0x16')]();});}};}function handleEntityNotFound(_0x5efe19,_0x5d770a){return function(_0x43c8a5){if(!_0x43c8a5){_0x5efe19['sendStatus'](0x194);}return _0x43c8a5;};}function handleError(_0x2cbad0,_0x5edf54){_0x5edf54=_0x5edf54||0x1f4;return function(_0x494a73){logger[_0x5601('0x1f')](_0x494a73[_0x5601('0x20')]);if(_0x494a73[_0x5601('0x21')]){delete _0x494a73[_0x5601('0x21')];}_0x2cbad0[_0x5601('0x15')](_0x5edf54)[_0x5601('0x22')](_0x494a73);};}exports[_0x5601('0x23')]=function(_0x9dce9b,_0x413520){var _0x496412={},_0x34f5ae={},_0x5c6b07={'count':0x0,'rows':[]};var _0x4725e1=_[_0x5601('0x24')](db[_0x5601('0x25')][_0x5601('0x26')],function(_0x461ed8){return{'name':_0x461ed8[_0x5601('0x27')],'type':_0x461ed8['type']['key']};});_0x34f5ae[_0x5601('0x28')]=_[_0x5601('0x24')](_0x4725e1,_0x5601('0x21'));_0x34f5ae['query']=_['keys'](_0x9dce9b[_0x5601('0x29')]);_0x34f5ae['filters']=_[_0x5601('0x2a')](_0x34f5ae[_0x5601('0x28')],_0x34f5ae[_0x5601('0x29')]);_0x496412[_0x5601('0x2b')]=_['intersection'](_0x34f5ae['model'],qs[_0x5601('0x2c')](_0x9dce9b[_0x5601('0x29')]['fields']));_0x496412[_0x5601('0x2b')]=_0x496412[_0x5601('0x2b')][_0x5601('0x2d')]?_0x496412['attributes']:_0x34f5ae[_0x5601('0x28')];if(!_0x9dce9b[_0x5601('0x29')]['hasOwnProperty']('nolimit')){_0x496412[_0x5601('0x19')]=qs[_0x5601('0x19')](_0x9dce9b[_0x5601('0x29')][_0x5601('0x19')]);_0x496412[_0x5601('0x18')]=qs['offset'](_0x9dce9b['query'][_0x5601('0x18')]);}_0x496412[_0x5601('0x2e')]=qs['sort'](_0x9dce9b[_0x5601('0x29')][_0x5601('0x2f')]);_0x496412[_0x5601('0x30')]=qs[_0x5601('0x31')](_[_0x5601('0x32')](_0x9dce9b['query'],_0x34f5ae[_0x5601('0x31')]),_0x4725e1);if(_0x9dce9b['query'][_0x5601('0x33')]){_0x496412[_0x5601('0x30')]=_[_0x5601('0x34')](_0x496412[_0x5601('0x30')],{'$or':_[_0x5601('0x24')](_0x4725e1,function(_0x216328){if(_0x216328[_0x5601('0x35')]!==_0x5601('0x36')){var _0x3570f2={};_0x3570f2[_0x216328[_0x5601('0x21')]]={'$like':'%'+_0x9dce9b['query'][_0x5601('0x33')]+'%'};return _0x3570f2;}})});}_0x496412=_[_0x5601('0x34')]({},_0x496412,_0x9dce9b[_0x5601('0x37')]);var _0x36b5ce={'where':_0x496412[_0x5601('0x30')]};return db[_0x5601('0x25')]['count'](_0x36b5ce)[_0x5601('0x1e')](function(_0x35ccb9){_0x5c6b07['count']=_0x35ccb9;if(_0x9dce9b[_0x5601('0x29')][_0x5601('0x38')]){_0x496412[_0x5601('0x39')]=[{'all':!![]}];}return db[_0x5601('0x25')][_0x5601('0x3a')](_0x496412);})[_0x5601('0x1e')](function(_0x3c5fe3){_0x5c6b07[_0x5601('0x3b')]=_0x3c5fe3;return _0x5c6b07;})['then'](respondWithFilteredResult(_0x413520,_0x496412))[_0x5601('0x3c')](handleError(_0x413520,null));};exports[_0x5601('0x3d')]=function(_0x3ef59c,_0x55171d){var _0x29ae0f={'raw':!![],'where':{'id':_0x3ef59c['params']['id']}},_0x3afc14={};_0x3afc14[_0x5601('0x28')]=_['keys'](db[_0x5601('0x25')][_0x5601('0x26')]);_0x3afc14[_0x5601('0x29')]=_['keys'](_0x3ef59c[_0x5601('0x29')]);_0x3afc14[_0x5601('0x31')]=_[_0x5601('0x2a')](_0x3afc14[_0x5601('0x28')],_0x3afc14[_0x5601('0x29')]);_0x29ae0f['attributes']=_[_0x5601('0x2a')](_0x3afc14[_0x5601('0x28')],qs[_0x5601('0x2c')](_0x3ef59c['query'][_0x5601('0x2c')]));_0x29ae0f[_0x5601('0x2b')]=_0x29ae0f['attributes'][_0x5601('0x2d')]?_0x29ae0f[_0x5601('0x2b')]:_0x3afc14[_0x5601('0x28')];if(_0x3ef59c[_0x5601('0x29')][_0x5601('0x38')]){_0x29ae0f[_0x5601('0x39')]=[{'all':!![]}];}_0x29ae0f=_[_0x5601('0x34')]({},_0x29ae0f,_0x3ef59c[_0x5601('0x37')]);return db[_0x5601('0x25')]['find'](_0x29ae0f)[_0x5601('0x1e')](handleEntityNotFound(_0x55171d,null))['then'](respondWithResult(_0x55171d,null))[_0x5601('0x3c')](handleError(_0x55171d,null));};exports[_0x5601('0x3e')]=function(_0x31a213,_0x3d14ce){return db['FreshsalesField'][_0x5601('0x3e')](_0x31a213[_0x5601('0x3f')],{})['then'](respondWithResult(_0x3d14ce,0xc9))[_0x5601('0x3c')](handleError(_0x3d14ce,null));};exports['update']=function(_0x25e1a7,_0x58ddbf){if(_0x25e1a7[_0x5601('0x3f')]['id']){delete _0x25e1a7['body']['id'];}return db[_0x5601('0x25')][_0x5601('0x40')]({'where':{'id':_0x25e1a7[_0x5601('0x41')]['id']}})[_0x5601('0x1e')](handleEntityNotFound(_0x58ddbf,null))['then'](saveUpdates(_0x25e1a7['body'],null))['then'](respondWithResult(_0x58ddbf,null))[_0x5601('0x3c')](handleError(_0x58ddbf,null));};exports[_0x5601('0x1d')]=function(_0x7af75c,_0x3bee5b){return db['FreshsalesField'][_0x5601('0x40')]({'where':{'id':_0x7af75c[_0x5601('0x41')]['id']}})[_0x5601('0x1e')](handleEntityNotFound(_0x3bee5b,null))[_0x5601('0x1e')](removeEntity(_0x3bee5b,null))[_0x5601('0x3c')](handleError(_0x3bee5b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 42befe7..0b78bf8 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 _0x8d5c=['moment','bluebird','path','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x2c3fb3,_0x2ed960){var _0x336b5f=function(_0x2734cb){while(--_0x2734cb){_0x2c3fb3['push'](_0x2c3fb3['shift']());}};_0x336b5f(++_0x2ed960);}(_0x8d5c,0x1cb));var _0xc8d5=function(_0x143cc6,_0xf94536){_0x143cc6=_0x143cc6-0x0;var _0x2cedba=_0x8d5c[_0x143cc6];return _0x2cedba;};'use strict';var _=require(_0xc8d5('0x0'));var util=require('util');var logger=require(_0xc8d5('0x1'))(_0xc8d5('0x2'));var moment=require(_0xc8d5('0x3'));var BPromise=require(_0xc8d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8d5('0x5'));var rimraf=require('rimraf');var config=require(_0xc8d5('0x6'));var attributes=require(_0xc8d5('0x7'));module[_0xc8d5('0x8')]=function(_0x35524c,_0x31cb1e){return _0x35524c['define'](_0xc8d5('0x9'),attributes,{'tableName':_0xc8d5('0xa'),'paranoid':![],'indexes':[{'name':_0xc8d5('0xb'),'fields':[_0xc8d5('0xc'),_0xc8d5('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x83a9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x29c4fc,_0x203b70){var _0x24b405=function(_0x484363){while(--_0x484363){_0x29c4fc['push'](_0x29c4fc['shift']());}};_0x24b405(++_0x203b70);}(_0x83a9,0xc3));var _0x983a=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0x83a9[_0xc87d08];return _0x30a714;};'use strict';var _=require(_0x983a('0x0'));var util=require(_0x983a('0x1'));var logger=require(_0x983a('0x2'))(_0x983a('0x3'));var moment=require(_0x983a('0x4'));var BPromise=require(_0x983a('0x5'));var rp=require(_0x983a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x983a('0x7'));var config=require(_0x983a('0x8'));var attributes=require(_0x983a('0x9'));module[_0x983a('0xa')]=function(_0x3e246b,_0x463635){return _0x3e246b['define'](_0x983a('0xb'),attributes,{'tableName':_0x983a('0xc'),'paranoid':![],'indexes':[{'name':_0x983a('0xd'),'fields':[_0x983a('0xe'),'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 e3247c7..21605f3 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 _0x8683=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','ioredis'];(function(_0x32fe5b,_0x464e33){var _0x2440e5=function(_0x43522f){while(--_0x43522f){_0x32fe5b['push'](_0x32fe5b['shift']());}};_0x2440e5(++_0x464e33);}(_0x8683,0xec));var _0x3868=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x8683[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x3868('0x0'));var moment=require(_0x3868('0x1'));var BPromise=require(_0x3868('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3868('0x3'));var db=require(_0x3868('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3868('0x5'))(_0x3868('0x6'));var config=require(_0x3868('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3868('0x8')][_0x3868('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46c6c1,_0x4f87ad,_0x4f73f2){return new BPromise(function(_0x5d4607,_0x451d23){return client['request'](_0x46c6c1,_0x4f73f2)[_0x3868('0xa')](function(_0x2af2f5){logger[_0x3868('0xb')](_0x3868('0xc'),_0x4f87ad,_0x3868('0xd'));logger[_0x3868('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4f87ad,_0x3868('0xd'),JSON[_0x3868('0xf')](_0x2af2f5));if(_0x2af2f5[_0x3868('0x10')]){if(_0x2af2f5['error'][_0x3868('0x11')]===0x1f4){logger[_0x3868('0x10')](_0x3868('0xc'),_0x4f87ad,_0x2af2f5['error'][_0x3868('0x12')]);return _0x451d23(_0x2af2f5[_0x3868('0x10')][_0x3868('0x12')]);}logger[_0x3868('0x10')](_0x3868('0xc'),_0x4f87ad,_0x2af2f5[_0x3868('0x10')][_0x3868('0x12')]);return _0x5d4607(_0x2af2f5['error'][_0x3868('0x12')]);}else{logger[_0x3868('0xb')](_0x3868('0xc'),_0x4f87ad,'request\x20sent');_0x5d4607(_0x2af2f5['result'][_0x3868('0x12')]);}})[_0x3868('0x13')](function(_0xf1e117){logger[_0x3868('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4f87ad,_0xf1e117);_0x451d23(_0xf1e117);});});} \ No newline at end of file +var _0xc4b2=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x1d5025,_0x4e8f97){var _0x2a3c16=function(_0xcbd95a){while(--_0xcbd95a){_0x1d5025['push'](_0x1d5025['shift']());}};_0x2a3c16(++_0x4e8f97);}(_0xc4b2,0x113));var _0x2c4b=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xc4b2[_0x349367];return _0x14179b;};'use strict';var _=require(_0x2c4b('0x0'));var util=require(_0x2c4b('0x1'));var moment=require(_0x2c4b('0x2'));var BPromise=require(_0x2c4b('0x3'));var rs=require(_0x2c4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c4b('0x5'));var config=require(_0x2c4b('0x6'));var jayson=require(_0x2c4b('0x7'));var client=jayson['client'][_0x2c4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa3872a,_0x212312,_0x38fa57){return new BPromise(function(_0x5ad03c,_0x1d5d1c){return client[_0x2c4b('0x9')](_0xa3872a,_0x38fa57)['then'](function(_0x5836a4){logger[_0x2c4b('0xa')](_0x2c4b('0xb'),_0x212312,_0x2c4b('0xc'));logger[_0x2c4b('0xd')](_0x2c4b('0xe'),_0x212312,'request\x20sent',JSON['stringify'](_0x5836a4));if(_0x5836a4['error']){if(_0x5836a4[_0x2c4b('0xf')][_0x2c4b('0x10')]===0x1f4){logger['error'](_0x2c4b('0xb'),_0x212312,_0x5836a4[_0x2c4b('0xf')]['message']);return _0x1d5d1c(_0x5836a4[_0x2c4b('0xf')]['message']);}logger[_0x2c4b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x212312,_0x5836a4[_0x2c4b('0xf')][_0x2c4b('0x11')]);return _0x5ad03c(_0x5836a4[_0x2c4b('0xf')]['message']);}else{logger[_0x2c4b('0xa')](_0x2c4b('0xb'),_0x212312,'request\x20sent');_0x5ad03c(_0x5836a4['result'][_0x2c4b('0x11')]);}})[_0x2c4b('0x12')](function(_0x40067e){logger['error'](_0x2c4b('0xb'),_0x212312,_0x40067e);_0x1d5d1c(_0x40067e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index d030dd5..4964721 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 _0xa8d1=['index','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','isAuthenticated'];(function(_0x3d7d14,_0x2c0123){var _0x18a429=function(_0x58e51d){while(--_0x58e51d){_0x3d7d14['push'](_0x3d7d14['shift']());}};_0x18a429(++_0x2c0123);}(_0xa8d1,0x98));var _0x1a8d=function(_0x14e1cb,_0xd3465e){_0x14e1cb=_0x14e1cb-0x0;var _0x18a337=_0xa8d1[_0x14e1cb];return _0x18a337;};'use strict';var multer=require(_0x1a8d('0x0'));var util=require(_0x1a8d('0x1'));var path=require('path');var timeout=require(_0x1a8d('0x2'));var express=require(_0x1a8d('0x3'));var router=express[_0x1a8d('0x4')]();var auth=require(_0x1a8d('0x5'));var interaction=require(_0x1a8d('0x6'));var config=require('../../config/environment');var controller=require(_0x1a8d('0x7'));router['get']('/',auth[_0x1a8d('0x8')](),controller[_0x1a8d('0x9')]);router[_0x1a8d('0xa')](_0x1a8d('0xb'),auth[_0x1a8d('0x8')](),controller[_0x1a8d('0xc')]);router[_0x1a8d('0xa')](_0x1a8d('0xd'),auth[_0x1a8d('0x8')](),controller[_0x1a8d('0xe')]);router[_0x1a8d('0xa')]('/:id/fields',auth[_0x1a8d('0x8')](),controller[_0x1a8d('0xf')]);router[_0x1a8d('0x10')]('/',auth[_0x1a8d('0x8')](),controller[_0x1a8d('0x11')]);router[_0x1a8d('0x10')]('/:id/configurations',auth[_0x1a8d('0x8')](),controller['addConfiguration']);router[_0x1a8d('0x12')](_0x1a8d('0xb'),auth['isAuthenticated'](),controller[_0x1a8d('0x13')]);router[_0x1a8d('0x14')](_0x1a8d('0xb'),auth['isAuthenticated'](),controller[_0x1a8d('0x15')]);module[_0x1a8d('0x16')]=router; \ No newline at end of file +var _0x0fcf=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','delete','destroy','exports','path'];(function(_0x58f65e,_0x467d61){var _0x35684b=function(_0x17cafe){while(--_0x17cafe){_0x58f65e['push'](_0x58f65e['shift']());}};_0x35684b(++_0x467d61);}(_0x0fcf,0xdb));var _0xf0fc=function(_0x2dc05d,_0x3a1e91){_0x2dc05d=_0x2dc05d-0x0;var _0x257e1f=_0x0fcf[_0x2dc05d];return _0x257e1f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf0fc('0x0'));var timeout=require(_0xf0fc('0x1'));var express=require(_0xf0fc('0x2'));var router=express[_0xf0fc('0x3')]();var auth=require(_0xf0fc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf0fc('0x5'));var controller=require(_0xf0fc('0x6'));router[_0xf0fc('0x7')]('/',auth['isAuthenticated'](),controller[_0xf0fc('0x8')]);router[_0xf0fc('0x7')](_0xf0fc('0x9'),auth[_0xf0fc('0xa')](),controller[_0xf0fc('0xb')]);router['get'](_0xf0fc('0xc'),auth[_0xf0fc('0xa')](),controller[_0xf0fc('0xd')]);router[_0xf0fc('0x7')](_0xf0fc('0xe'),auth[_0xf0fc('0xa')](),controller['getFields']);router[_0xf0fc('0xf')]('/',auth['isAuthenticated'](),controller[_0xf0fc('0x10')]);router[_0xf0fc('0xf')](_0xf0fc('0xc'),auth['isAuthenticated'](),controller[_0xf0fc('0x11')]);router[_0xf0fc('0x12')](_0xf0fc('0x9'),auth[_0xf0fc('0xa')](),controller['update']);router[_0xf0fc('0x13')](_0xf0fc('0x9'),auth[_0xf0fc('0xa')](),controller[_0xf0fc('0x14')]);module[_0xf0fc('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 9c49aa2..df0f94e 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 _0x5fab=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x140ad6,_0x2831a7){var _0x4bd827=function(_0x1713eb){while(--_0x1713eb){_0x140ad6['push'](_0x140ad6['shift']());}};_0x4bd827(++_0x2831a7);}(_0x5fab,0x177));var _0xb5fa=function(_0x2f39cf,_0x3c59ec){_0x2f39cf=_0x2f39cf-0x0;var _0xd0ece8=_0x5fab[_0x2f39cf];return _0xd0ece8;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5fa('0x2')]},'username':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x3')},'remoteUri':{'type':Sequelize[_0xb5fa('0x2')]},'password':{'type':Sequelize[_0xb5fa('0x2')]},'clientId':{'type':Sequelize[_0xb5fa('0x2')]},'clientSecret':{'type':Sequelize[_0xb5fa('0x2')]},'securityToken':{'type':Sequelize[_0xb5fa('0x2')]},'serverUrl':{'type':Sequelize[_0xb5fa('0x2')]},'type':{'type':Sequelize[_0xb5fa('0x4')]('integrationTab','newTab'),'defaultValue':_0xb5fa('0x5')}}; \ No newline at end of file +var _0xc4aa=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xac4a('0x2')]},'securityToken':{'type':Sequelize[_0xac4a('0x2')]},'serverUrl':{'type':Sequelize[_0xac4a('0x2')]},'type':{'type':Sequelize[_0xac4a('0x4')](_0xac4a('0x5'),_0xac4a('0x6')),'defaultValue':_0xac4a('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 26d5986..a8e4092 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 _0x8f59=['username','password','securityToken','substring','lastIndexOf','isNil','describe','CallDurationInSeconds','Priority','Status','Type','ticketType','Case','Reason','IsEscalated','SuppliedCompany','remove','custom','includes','picklistValues','label','value','True','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','update','findOne','SalesforceConfiguration','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','Task','remoteUri','clientId','clientSecret'];(function(_0x5b19c5,_0x3665ff){var _0x50ec0a=function(_0x6687d2){while(--_0x6687d2){_0x5b19c5['push'](_0x5b19c5['shift']());}};_0x50ec0a(++_0x3665ff);}(_0x8f59,0x11d));var _0x98f5=function(_0x1434cf,_0x5f59bc){_0x1434cf=_0x1434cf-0x0;var _0x409877=_0x8f59[_0x1434cf];return _0x409877;};'use strict';var pdf=require(_0x98f5('0x0'));var emlformat=require(_0x98f5('0x1'));var rimraf=require(_0x98f5('0x2'));var zipdir=require(_0x98f5('0x3'));var jsonpatch=require(_0x98f5('0x4'));var rp=require(_0x98f5('0x5'));var moment=require('moment');var BPromise=require(_0x98f5('0x6'));var Mustache=require(_0x98f5('0x7'));var util=require(_0x98f5('0x8'));var path=require(_0x98f5('0x9'));var sox=require('sox');var csv=require(_0x98f5('0xa'));var ejs=require(_0x98f5('0xb'));var fs=require('fs');var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xa'));var querystring=require('querystring');var Papa=require(_0x98f5('0xf'));var Redis=require(_0x98f5('0x10'));var authService=require(_0x98f5('0x11'));var qs=require(_0x98f5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x14'));var config=require(_0x98f5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x16'))['db'];var integrations=require(_0x98f5('0x17'));var jayson=require(_0x98f5('0x18'));var client=jayson[_0x98f5('0x19')][_0x98f5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x105333,_0x5dcb5e,_0x24a7a9,_0xbade31){return new BPromise(function(_0x5b8bab,_0x9df84){var _0x3d6b5c=_0xbade31||client;return _0x3d6b5c[_0x98f5('0x1b')](_0x105333,_0x24a7a9)['then'](function(_0x2437e7){logger[_0x98f5('0x1c')](_0x98f5('0x1d'),_0x5dcb5e,'request\x20sent');logger[_0x98f5('0x1e')](_0x98f5('0x1f'),_0x5dcb5e,'request\x20sent',JSON[_0x98f5('0x20')](_0x2437e7));if(_0x2437e7['error']){if(_0x2437e7[_0x98f5('0x21')][_0x98f5('0x22')]===0x1f4){logger[_0x98f5('0x21')](_0x98f5('0x1d'),_0x5dcb5e,_0x2437e7[_0x98f5('0x21')][_0x98f5('0x23')]);return _0x9df84(_0x2437e7['error'][_0x98f5('0x23')]);}logger['error'](_0x98f5('0x1d'),_0x5dcb5e,_0x2437e7[_0x98f5('0x21')]['message']);return _0x5b8bab(_0x2437e7[_0x98f5('0x21')][_0x98f5('0x23')]);}else{logger[_0x98f5('0x1c')](_0x98f5('0x1d'),_0x5dcb5e,_0x98f5('0x24'));_0x5b8bab(_0x2437e7[_0x98f5('0x25')][_0x98f5('0x23')]);}})['catch'](function(_0xb687c7){logger['error'](_0x98f5('0x1d'),_0x5dcb5e,_0xb687c7);_0x9df84(_0xb687c7);});});}function respondWithStatusCode(_0x495889,_0x44bfbb){_0x44bfbb=_0x44bfbb||0xcc;return function(_0x40c69b){if(_0x40c69b){return _0x495889[_0x98f5('0x26')](_0x44bfbb);}return _0x495889[_0x98f5('0x27')](_0x44bfbb)[_0x98f5('0x28')]();};}function respondWithResult(_0x18052d,_0x46dbd4){_0x46dbd4=_0x46dbd4||0xc8;return function(_0x58d506){if(_0x58d506){return _0x18052d[_0x98f5('0x27')](_0x46dbd4)[_0x98f5('0x29')](_0x58d506);}};}function respondWithFilteredResult(_0x5d7423,_0x1a1c55){return function(_0x18b0af){if(_0x18b0af){var _0x5b08c2=_0x18b0af[_0x98f5('0x2a')],_0x214130=_0x1a1c55[_0x98f5('0x2b')],_0x230d1b=_0x1a1c55['offset']+_0x1a1c55['limit'],_0xe5a019;if(_0x230d1b>=_0x5b08c2){_0x230d1b=_0x5b08c2;_0xe5a019=0xc8;}else{_0xe5a019=0xce;}_0x5d7423[_0x98f5('0x27')](_0xe5a019);return _0x5d7423[_0x98f5('0x2c')](_0x98f5('0x2d'),_0x214130+'-'+_0x230d1b+'/'+_0x5b08c2)[_0x98f5('0x29')](_0x18b0af);}return null;};}function patchUpdates(_0x15bf92){return function(_0x1ae531){try{jsonpatch['apply'](_0x1ae531,_0x15bf92,!![]);}catch(_0x29e1f5){return BPromise[_0x98f5('0x2e')](_0x29e1f5);}return _0x1ae531[_0x98f5('0x2f')]();};}function saveUpdates(_0xd20823,_0x1e7138){return function(_0xcaba37){if(_0xcaba37){return _0xcaba37['update'](_0xd20823)[_0x98f5('0x30')](function(_0x4d4b5c){return _0x4d4b5c;});}return null;};}function removeEntity(_0x229495,_0x1e193c){return function(_0x492771){if(_0x492771){return _0x492771[_0x98f5('0x31')]()[_0x98f5('0x30')](function(){_0x229495[_0x98f5('0x27')](0xcc)[_0x98f5('0x28')]();});}};}function handleEntityNotFound(_0x45e55c,_0x341003){return function(_0xc18b23){if(!_0xc18b23){_0x45e55c[_0x98f5('0x26')](0x194);}return _0xc18b23;};}function handleError(_0x1d0427,_0xc89a77){_0xc89a77=_0xc89a77||0x1f4;return function(_0x12d874){logger[_0x98f5('0x21')](_0x12d874[_0x98f5('0x32')]);if(_0x12d874[_0x98f5('0x33')]){delete _0x12d874[_0x98f5('0x33')];}_0x1d0427[_0x98f5('0x27')](_0xc89a77)[_0x98f5('0x34')](_0x12d874);};}exports[_0x98f5('0x35')]=function(_0x3187bd,_0x39d935){var _0x4c93b9={},_0x27cfd5={},_0x4aba7a={'count':0x0,'rows':[]};var _0x5d7580=_[_0x98f5('0x36')](db[_0x98f5('0x37')][_0x98f5('0x38')],function(_0x32d722){return{'name':_0x32d722['fieldName'],'type':_0x32d722[_0x98f5('0x39')][_0x98f5('0x3a')]};});_0x27cfd5[_0x98f5('0x3b')]=_['map'](_0x5d7580,_0x98f5('0x33'));_0x27cfd5[_0x98f5('0x3c')]=_['keys'](_0x3187bd[_0x98f5('0x3c')]);_0x27cfd5[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x27cfd5['model'],_0x27cfd5[_0x98f5('0x3c')]);_0x4c93b9[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x27cfd5[_0x98f5('0x3b')],qs[_0x98f5('0x40')](_0x3187bd['query']['fields']));_0x4c93b9[_0x98f5('0x3f')]=_0x4c93b9[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x4c93b9[_0x98f5('0x3f')]:_0x27cfd5[_0x98f5('0x3b')];if(!_0x3187bd[_0x98f5('0x3c')]['hasOwnProperty']('nolimit')){_0x4c93b9[_0x98f5('0x42')]=qs[_0x98f5('0x42')](_0x3187bd[_0x98f5('0x3c')][_0x98f5('0x42')]);_0x4c93b9['offset']=qs['offset'](_0x3187bd[_0x98f5('0x3c')][_0x98f5('0x2b')]);}_0x4c93b9[_0x98f5('0x43')]=qs[_0x98f5('0x44')](_0x3187bd['query']['sort']);_0x4c93b9[_0x98f5('0x45')]=qs[_0x98f5('0x3d')](_[_0x98f5('0x46')](_0x3187bd['query'],_0x27cfd5[_0x98f5('0x3d')]),_0x5d7580);if(_0x3187bd['query'][_0x98f5('0x47')]){_0x4c93b9['where']=_[_0x98f5('0x48')](_0x4c93b9[_0x98f5('0x45')],{'$or':_[_0x98f5('0x36')](_0x5d7580,function(_0x5407ad){if(_0x5407ad[_0x98f5('0x39')]!==_0x98f5('0x49')){var _0x54628d={};_0x54628d[_0x5407ad[_0x98f5('0x33')]]={'$like':'%'+_0x3187bd[_0x98f5('0x3c')]['filter']+'%'};return _0x54628d;}})});}_0x4c93b9=_[_0x98f5('0x48')]({},_0x4c93b9,_0x3187bd['options']);var _0x27bf7c={'where':_0x4c93b9[_0x98f5('0x45')]};return db['SalesforceAccount']['count'](_0x27bf7c)['then'](function(_0x53a18a){_0x4aba7a[_0x98f5('0x2a')]=_0x53a18a;if(_0x3187bd['query'][_0x98f5('0x4a')]){_0x4c93b9[_0x98f5('0x4b')]=[{'all':!![]}];}return db[_0x98f5('0x37')][_0x98f5('0x4c')](_0x4c93b9);})[_0x98f5('0x30')](function(_0x3ecae9){_0x4aba7a['rows']=_0x3ecae9;return _0x4aba7a;})[_0x98f5('0x30')](respondWithFilteredResult(_0x39d935,_0x4c93b9))[_0x98f5('0x4d')](handleError(_0x39d935,null));};exports[_0x98f5('0x4e')]=function(_0x2c3cef,_0x178867){var _0x459649={'raw':![],'where':{'id':_0x2c3cef[_0x98f5('0x4f')]['id']}},_0x48c8ab={};_0x48c8ab[_0x98f5('0x3b')]=_[_0x98f5('0x50')](db[_0x98f5('0x37')]['rawAttributes']);_0x48c8ab[_0x98f5('0x3c')]=_[_0x98f5('0x50')](_0x2c3cef[_0x98f5('0x3c')]);_0x48c8ab[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x48c8ab['model'],_0x48c8ab[_0x98f5('0x3c')]);_0x459649[_0x98f5('0x3f')]=_['intersection'](_0x48c8ab[_0x98f5('0x3b')],qs['fields'](_0x2c3cef[_0x98f5('0x3c')]['fields']));_0x459649[_0x98f5('0x3f')]=_0x459649[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x459649['attributes']:_0x48c8ab[_0x98f5('0x3b')];if(_0x2c3cef[_0x98f5('0x3c')][_0x98f5('0x4a')]){_0x459649[_0x98f5('0x4b')]=[{'all':!![]}];}_0x459649=_[_0x98f5('0x48')]({},_0x459649,_0x2c3cef[_0x98f5('0x51')]);return db[_0x98f5('0x37')][_0x98f5('0x52')](_0x459649)[_0x98f5('0x30')](handleEntityNotFound(_0x178867,null))[_0x98f5('0x30')](respondWithResult(_0x178867,null))[_0x98f5('0x4d')](handleError(_0x178867,null));};exports[_0x98f5('0x53')]=function(_0x2592a9,_0x20a891){return db[_0x98f5('0x37')][_0x98f5('0x53')](_0x2592a9[_0x98f5('0x54')],{})['then'](respondWithResult(_0x20a891,0xc9))[_0x98f5('0x4d')](handleError(_0x20a891,null));};exports[_0x98f5('0x55')]=function(_0x272bad,_0x4663f2){if(_0x272bad[_0x98f5('0x54')]['id']){delete _0x272bad[_0x98f5('0x54')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x272bad['params']['id']}})[_0x98f5('0x30')](handleEntityNotFound(_0x4663f2,null))[_0x98f5('0x30')](saveUpdates(_0x272bad[_0x98f5('0x54')],null))[_0x98f5('0x30')](respondWithResult(_0x4663f2,null))['catch'](handleError(_0x4663f2,null));};exports[_0x98f5('0x31')]=function(_0x4a42c3,_0x31c413){return db['SalesforceAccount']['find']({'where':{'id':_0x4a42c3[_0x98f5('0x4f')]['id']}})[_0x98f5('0x30')](handleEntityNotFound(_0x31c413,null))[_0x98f5('0x30')](removeEntity(_0x31c413,null))['catch'](handleError(_0x31c413,null));};exports['getConfigurations']=function(_0x1043ab,_0x139ca3,_0x54233b){var _0x1e4e50={};var _0x20315d={};var _0x588e71;var _0x400f32;return db[_0x98f5('0x37')][_0x98f5('0x56')]({'where':{'id':_0x1043ab['params']['id']}})[_0x98f5('0x30')](handleEntityNotFound(_0x139ca3,null))[_0x98f5('0x30')](function(_0x1aaa07){if(_0x1aaa07){_0x588e71=_0x1aaa07;_0x20315d[_0x98f5('0x3b')]=_[_0x98f5('0x50')](db[_0x98f5('0x57')][_0x98f5('0x38')]);_0x20315d['query']=_[_0x98f5('0x50')](_0x1043ab[_0x98f5('0x3c')]);_0x20315d[_0x98f5('0x3d')]=_['intersection'](_0x20315d['model'],_0x20315d[_0x98f5('0x3c')]);_0x1e4e50[_0x98f5('0x3f')]=_['intersection'](_0x20315d['model'],qs['fields'](_0x1043ab['query'][_0x98f5('0x40')]));_0x1e4e50['attributes']=_0x1e4e50[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x1e4e50[_0x98f5('0x3f')]:_0x20315d[_0x98f5('0x3b')];_0x1e4e50[_0x98f5('0x43')]=qs[_0x98f5('0x44')](_0x1043ab[_0x98f5('0x3c')][_0x98f5('0x44')]);_0x1e4e50['where']=qs['filters'](_[_0x98f5('0x46')](_0x1043ab['query'],_0x20315d[_0x98f5('0x3d')]));if(_0x1043ab[_0x98f5('0x3c')][_0x98f5('0x47')]){_0x1e4e50['where']=_[_0x98f5('0x48')](_0x1e4e50['where'],{'$or':_['map'](_0x1e4e50['attributes'],function(_0x2d9cd8){var _0x527d7a={};_0x527d7a[_0x2d9cd8]={'$like':'%'+_0x1043ab[_0x98f5('0x3c')][_0x98f5('0x47')]+'%'};return _0x527d7a;})});}_0x1e4e50=_[_0x98f5('0x48')]({},_0x1e4e50,_0x1043ab['options']);return _0x588e71['getConfigurations'](_0x1e4e50);}})['then'](function(_0x18e895){if(_0x18e895){_0x400f32=_0x18e895[_0x98f5('0x41')];if(!_0x1043ab['query']['hasOwnProperty'](_0x98f5('0x58'))){_0x1e4e50[_0x98f5('0x42')]=qs[_0x98f5('0x42')](_0x1043ab[_0x98f5('0x3c')][_0x98f5('0x42')]);_0x1e4e50[_0x98f5('0x2b')]=qs[_0x98f5('0x2b')](_0x1043ab[_0x98f5('0x3c')][_0x98f5('0x2b')]);}return _0x588e71['getConfigurations'](_0x1e4e50);}})[_0x98f5('0x30')](function(_0xc652ab){if(_0xc652ab){return _0xc652ab?{'count':_0x400f32,'rows':_0xc652ab}:null;}})[_0x98f5('0x30')](respondWithResult(_0x139ca3,null))[_0x98f5('0x4d')](handleError(_0x139ca3,null));};exports['addConfiguration']=function(_0x3e00bf,_0x48b175,_0x42c7a6){if(_0x3e00bf['body']['id']){delete _0x3e00bf[_0x98f5('0x54')]['id'];}return db[_0x98f5('0x37')]['findOne']({'where':{'id':_0x3e00bf[_0x98f5('0x4f')]['id']}})[_0x98f5('0x30')](handleEntityNotFound(_0x48b175,null))[_0x98f5('0x30')](function(_0x57eb30){if(_0x57eb30){_0x3e00bf[_0x98f5('0x54')][_0x98f5('0x59')]=_0x57eb30['id'];_0x3e00bf[_0x98f5('0x54')][_0x98f5('0x5a')]=integrations[_0x98f5('0x5b')](_0x3e00bf[_0x98f5('0x54')][_0x98f5('0x5c')],_0x3e00bf[_0x98f5('0x54')][_0x98f5('0x39')]);_0x3e00bf['body'][_0x98f5('0x5d')]=integrations['getDescriptions'](_0x3e00bf[_0x98f5('0x54')][_0x98f5('0x5c')],_0x3e00bf[_0x98f5('0x54')][_0x98f5('0x39')]);return db['SalesforceConfiguration'][_0x98f5('0x53')](_0x3e00bf[_0x98f5('0x54')],{'include':[{'model':db['SalesforceField'],'as':_0x98f5('0x5a')},{'model':db['SalesforceField'],'as':_0x98f5('0x5d')}]});}return null;})[_0x98f5('0x30')](respondWithResult(_0x48b175,null))[_0x98f5('0x4d')](handleError(_0x48b175,null));};exports[_0x98f5('0x5e')]=function(_0x5427a3,_0x4ca610,_0x235cc2){var _0x43b0b1;var _0x5b0f8e='';var _0x198094=_0x98f5('0x5f');return db[_0x98f5('0x37')][_0x98f5('0x56')]({'where':{'id':_0x5427a3[_0x98f5('0x4f')]['id']},'attributes':['id',_0x98f5('0x60'),_0x98f5('0x61'),_0x98f5('0x62'),_0x98f5('0x63'),_0x98f5('0x64'),_0x98f5('0x65')]})['then'](handleEntityNotFound(_0x4ca610,null))['then'](function(_0x3d1b6d){if(_0x3d1b6d){_0x5b0f8e=_0x3d1b6d[_0x98f5('0x60')];var _0x10cd2d=_0x5b0f8e['slice'](-0x1);if(_0x10cd2d==='/'){_0x5b0f8e=_0x5b0f8e[_0x98f5('0x66')](0x0,_0x5b0f8e[_0x98f5('0x67')](_0x10cd2d));}_0x43b0b1=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5b0f8e,'clientId':_0x3d1b6d[_0x98f5('0x61')],'clientSecret':_0x3d1b6d[_0x98f5('0x62')]}});return _0x43b0b1['login'](_0x3d1b6d['username'],_0x3d1b6d['password']['concat'](_0x3d1b6d[_0x98f5('0x65')]));}})[_0x98f5('0x30')](function(_0x529f8a){if(_0x529f8a){if(!_[_0x98f5('0x68')](_0x5427a3[_0x98f5('0x3c')]['ticketType'])){_0x198094=_0x5427a3[_0x98f5('0x3c')]['ticketType'];}return _0x43b0b1['sobject'](_0x198094)[_0x98f5('0x69')]();}})[_0x98f5('0x30')](function(_0x30784e){var _0x20190d=['CallDisposition',_0x98f5('0x6a'),'CallObject','CallType','IsArchived',_0x98f5('0x6b'),_0x98f5('0x6c'),_0x98f5('0x6d')];if(!_[_0x98f5('0x68')](_0x5427a3[_0x98f5('0x3c')][_0x98f5('0x6e')])&&_0x5427a3[_0x98f5('0x3c')][_0x98f5('0x6e')]===_0x98f5('0x6f')){_0x20190d=[_0x98f5('0x6d'),'Origin',_0x98f5('0x70'),_0x98f5('0x6c'),_0x98f5('0x6b'),_0x98f5('0x71'),'SuppliedName',_0x98f5('0x72')];}if(_0x30784e){_[_0x98f5('0x73')](_0x30784e['fields'],function(_0x243c5e){return _0x243c5e[_0x98f5('0x74')]===![]&&!_0x20190d[_0x98f5('0x75')](_0x243c5e['name']);});return{'count':_0x30784e[_0x98f5('0x40')][_0x98f5('0x41')],'rows':_[_0x98f5('0x36')](_0x30784e[_0x98f5('0x40')],function(_0x225e4e){return{'id':_0x225e4e[_0x98f5('0x33')],'name':_0x225e4e['label'],'custom':_0x225e4e['custom'],'options':_0x225e4e[_0x98f5('0x76')][_0x98f5('0x41')]>0x0?_[_0x98f5('0x36')](_0x225e4e[_0x98f5('0x76')],function(_0x531a7f){return{'name':_0x531a7f[_0x98f5('0x77')],'value':_0x531a7f[_0x98f5('0x78')]};}):_0x225e4e['type']=='boolean'?[{'name':_0x98f5('0x79'),'value':'true'},{'name':_0x98f5('0x7a'),'value':_0x98f5('0x7b')}]:[]};})};}})[_0x98f5('0x30')](respondWithResult(_0x4ca610,null))['catch'](function(_0x2d378e){var _0x1b81b3=_0x5427a3['query'][_0x98f5('0x7c')]?0x1f4:_0x2d378e[_0x98f5('0x7d')]||0x1f4;logger[_0x98f5('0x21')](_0x98f5('0x7e'),'getFields',_0x1b81b3,JSON['stringify'](_0x2d378e));delete _0x2d378e[_0x98f5('0x33')];if(_0x1b81b3===0x191){_0x1b81b3=0x190;}_0x4ca610[_0x98f5('0x27')](_0x1b81b3)[_0x98f5('0x34')](_0x5427a3[_0x98f5('0x3c')][_0x98f5('0x7c')]?{'message':_0x98f5('0x7f'),'statusCode':_0x2d378e['statusCode']}:_0x2d378e);});}; \ No newline at end of file +var _0xb10b=['Task','remoteUri','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','concat','isNil','ticketType','describe','CallObject','CallType','IsArchived','Priority','Type','Origin','Reason','IsEscalated','remove','includes','label','picklistValues','value','boolean','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','index','SalesforceAccount','rawAttributes','fieldName','type','key','map','filters','intersection','model','attributes','query','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','include','rows','show','params','keys','length','includeAll','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','pick','AccountId','channel','Descriptions','SalesforceField','getFields'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb10b,0x12a));var _0xbb10=function(_0x356107,_0x3bb13c){_0x356107=_0x356107-0x0;var _0x2f9d2b=_0xb10b[_0x356107];return _0x2f9d2b;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');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('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x18'))['db'];var integrations=require(_0xbb10('0x19'));var jayson=require(_0xbb10('0x1a'));var client=jayson[_0xbb10('0x1b')][_0xbb10('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x147230,_0x58a612,_0x26e021,_0x42d7e4){return new BPromise(function(_0x45b9d6,_0x17fd46){var _0x3df17b=_0x42d7e4||client;return _0x3df17b[_0xbb10('0x1d')](_0x147230,_0x26e021)[_0xbb10('0x1e')](function(_0x36b5e8){logger[_0xbb10('0x1f')](_0xbb10('0x20'),_0x58a612,'request\x20sent');logger[_0xbb10('0x21')](_0xbb10('0x22'),_0x58a612,_0xbb10('0x23'),JSON[_0xbb10('0x24')](_0x36b5e8));if(_0x36b5e8[_0xbb10('0x25')]){if(_0x36b5e8[_0xbb10('0x25')][_0xbb10('0x26')]===0x1f4){logger[_0xbb10('0x25')](_0xbb10('0x20'),_0x58a612,_0x36b5e8[_0xbb10('0x25')]['message']);return _0x17fd46(_0x36b5e8[_0xbb10('0x25')][_0xbb10('0x27')]);}logger[_0xbb10('0x25')](_0xbb10('0x20'),_0x58a612,_0x36b5e8[_0xbb10('0x25')][_0xbb10('0x27')]);return _0x45b9d6(_0x36b5e8['error'][_0xbb10('0x27')]);}else{logger[_0xbb10('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x58a612,'request\x20sent');_0x45b9d6(_0x36b5e8[_0xbb10('0x28')][_0xbb10('0x27')]);}})[_0xbb10('0x29')](function(_0x317da4){logger[_0xbb10('0x25')](_0xbb10('0x20'),_0x58a612,_0x317da4);_0x17fd46(_0x317da4);});});}function respondWithStatusCode(_0x407cb4,_0x436104){_0x436104=_0x436104||0xcc;return function(_0x7f2377){if(_0x7f2377){return _0x407cb4[_0xbb10('0x2a')](_0x436104);}return _0x407cb4[_0xbb10('0x2b')](_0x436104)[_0xbb10('0x2c')]();};}function respondWithResult(_0x537898,_0x4fedac){_0x4fedac=_0x4fedac||0xc8;return function(_0x4fb5e0){if(_0x4fb5e0){return _0x537898[_0xbb10('0x2b')](_0x4fedac)[_0xbb10('0x2d')](_0x4fb5e0);}};}function respondWithFilteredResult(_0x2c89b9,_0x4e25ff){return function(_0x2fdde9){if(_0x2fdde9){var _0x24d586=_0x2fdde9[_0xbb10('0x2e')],_0x6ed43b=_0x4e25ff[_0xbb10('0x2f')],_0x1d5e95=_0x4e25ff['offset']+_0x4e25ff[_0xbb10('0x30')],_0x1acce9;if(_0x1d5e95>=_0x24d586){_0x1d5e95=_0x24d586;_0x1acce9=0xc8;}else{_0x1acce9=0xce;}_0x2c89b9[_0xbb10('0x2b')](_0x1acce9);return _0x2c89b9[_0xbb10('0x31')](_0xbb10('0x32'),_0x6ed43b+'-'+_0x1d5e95+'/'+_0x24d586)[_0xbb10('0x2d')](_0x2fdde9);}return null;};}function patchUpdates(_0x2ff4c1){return function(_0x5d5c80){try{jsonpatch[_0xbb10('0x33')](_0x5d5c80,_0x2ff4c1,!![]);}catch(_0x4ee02e){return BPromise[_0xbb10('0x34')](_0x4ee02e);}return _0x5d5c80['save']();};}function saveUpdates(_0x16ad2a,_0x1dcc9c){return function(_0x1b59f9){if(_0x1b59f9){return _0x1b59f9['update'](_0x16ad2a)['then'](function(_0x4c3744){return _0x4c3744;});}return null;};}function removeEntity(_0x34f65e,_0x4f590d){return function(_0x359ad4){if(_0x359ad4){return _0x359ad4[_0xbb10('0x35')]()[_0xbb10('0x1e')](function(){_0x34f65e[_0xbb10('0x2b')](0xcc)[_0xbb10('0x2c')]();});}};}function handleEntityNotFound(_0x138bc6,_0xf85197){return function(_0x4975f5){if(!_0x4975f5){_0x138bc6[_0xbb10('0x2a')](0x194);}return _0x4975f5;};}function handleError(_0x1da9c9,_0x441d15){_0x441d15=_0x441d15||0x1f4;return function(_0x8c1ce6){logger[_0xbb10('0x25')](_0x8c1ce6[_0xbb10('0x36')]);if(_0x8c1ce6[_0xbb10('0x37')]){delete _0x8c1ce6[_0xbb10('0x37')];}_0x1da9c9[_0xbb10('0x2b')](_0x441d15)['send'](_0x8c1ce6);};}exports[_0xbb10('0x38')]=function(_0x150107,_0x1ddd9e){var _0x3c3c45={},_0x570f5a={},_0x111762={'count':0x0,'rows':[]};var _0x5de37b=_['map'](db[_0xbb10('0x39')][_0xbb10('0x3a')],function(_0x26e76a){return{'name':_0x26e76a[_0xbb10('0x3b')],'type':_0x26e76a[_0xbb10('0x3c')][_0xbb10('0x3d')]};});_0x570f5a['model']=_[_0xbb10('0x3e')](_0x5de37b,_0xbb10('0x37'));_0x570f5a['query']=_['keys'](_0x150107['query']);_0x570f5a[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x570f5a[_0xbb10('0x41')],_0x570f5a['query']);_0x3c3c45[_0xbb10('0x42')]=_[_0xbb10('0x40')](_0x570f5a[_0xbb10('0x41')],qs['fields'](_0x150107[_0xbb10('0x43')][_0xbb10('0x44')]));_0x3c3c45[_0xbb10('0x42')]=_0x3c3c45[_0xbb10('0x42')]['length']?_0x3c3c45[_0xbb10('0x42')]:_0x570f5a[_0xbb10('0x41')];if(!_0x150107['query'][_0xbb10('0x45')](_0xbb10('0x46'))){_0x3c3c45[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x150107[_0xbb10('0x43')][_0xbb10('0x30')]);_0x3c3c45['offset']=qs[_0xbb10('0x2f')](_0x150107[_0xbb10('0x43')][_0xbb10('0x2f')]);}_0x3c3c45[_0xbb10('0x47')]=qs['sort'](_0x150107[_0xbb10('0x43')][_0xbb10('0x48')]);_0x3c3c45[_0xbb10('0x49')]=qs[_0xbb10('0x3f')](_['pick'](_0x150107[_0xbb10('0x43')],_0x570f5a[_0xbb10('0x3f')]),_0x5de37b);if(_0x150107['query']['filter']){_0x3c3c45[_0xbb10('0x49')]=_['merge'](_0x3c3c45[_0xbb10('0x49')],{'$or':_[_0xbb10('0x3e')](_0x5de37b,function(_0x4c66d8){if(_0x4c66d8[_0xbb10('0x3c')]!==_0xbb10('0x4a')){var _0x474e99={};_0x474e99[_0x4c66d8['name']]={'$like':'%'+_0x150107[_0xbb10('0x43')][_0xbb10('0x4b')]+'%'};return _0x474e99;}})});}_0x3c3c45=_[_0xbb10('0x4c')]({},_0x3c3c45,_0x150107[_0xbb10('0x4d')]);var _0x36e1fa={'where':_0x3c3c45[_0xbb10('0x49')]};return db[_0xbb10('0x39')][_0xbb10('0x2e')](_0x36e1fa)[_0xbb10('0x1e')](function(_0x43b948){_0x111762[_0xbb10('0x2e')]=_0x43b948;if(_0x150107[_0xbb10('0x43')]['includeAll']){_0x3c3c45[_0xbb10('0x4e')]=[{'all':!![]}];}return db[_0xbb10('0x39')]['findAll'](_0x3c3c45);})[_0xbb10('0x1e')](function(_0x2f5027){_0x111762[_0xbb10('0x4f')]=_0x2f5027;return _0x111762;})[_0xbb10('0x1e')](respondWithFilteredResult(_0x1ddd9e,_0x3c3c45))[_0xbb10('0x29')](handleError(_0x1ddd9e,null));};exports[_0xbb10('0x50')]=function(_0x3e06b0,_0x5be85e){var _0x4a9793={'raw':![],'where':{'id':_0x3e06b0[_0xbb10('0x51')]['id']}},_0xcb3354={};_0xcb3354[_0xbb10('0x41')]=_['keys'](db['SalesforceAccount'][_0xbb10('0x3a')]);_0xcb3354[_0xbb10('0x43')]=_[_0xbb10('0x52')](_0x3e06b0[_0xbb10('0x43')]);_0xcb3354[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0xcb3354[_0xbb10('0x41')],_0xcb3354[_0xbb10('0x43')]);_0x4a9793[_0xbb10('0x42')]=_[_0xbb10('0x40')](_0xcb3354['model'],qs['fields'](_0x3e06b0[_0xbb10('0x43')][_0xbb10('0x44')]));_0x4a9793[_0xbb10('0x42')]=_0x4a9793[_0xbb10('0x42')][_0xbb10('0x53')]?_0x4a9793[_0xbb10('0x42')]:_0xcb3354[_0xbb10('0x41')];if(_0x3e06b0[_0xbb10('0x43')][_0xbb10('0x54')]){_0x4a9793[_0xbb10('0x4e')]=[{'all':!![]}];}_0x4a9793=_[_0xbb10('0x4c')]({},_0x4a9793,_0x3e06b0[_0xbb10('0x4d')]);return db[_0xbb10('0x39')][_0xbb10('0x55')](_0x4a9793)[_0xbb10('0x1e')](handleEntityNotFound(_0x5be85e,null))['then'](respondWithResult(_0x5be85e,null))[_0xbb10('0x29')](handleError(_0x5be85e,null));};exports['create']=function(_0x33d60a,_0x2e21a0){return db[_0xbb10('0x39')][_0xbb10('0x56')](_0x33d60a[_0xbb10('0x57')],{})[_0xbb10('0x1e')](respondWithResult(_0x2e21a0,0xc9))[_0xbb10('0x29')](handleError(_0x2e21a0,null));};exports[_0xbb10('0x58')]=function(_0x180400,_0x3d71e){if(_0x180400[_0xbb10('0x57')]['id']){delete _0x180400[_0xbb10('0x57')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x55')]({'where':{'id':_0x180400[_0xbb10('0x51')]['id']}})['then'](handleEntityNotFound(_0x3d71e,null))[_0xbb10('0x1e')](saveUpdates(_0x180400[_0xbb10('0x57')],null))[_0xbb10('0x1e')](respondWithResult(_0x3d71e,null))[_0xbb10('0x29')](handleError(_0x3d71e,null));};exports[_0xbb10('0x35')]=function(_0x379d8c,_0x4bedd0){return db[_0xbb10('0x39')][_0xbb10('0x55')]({'where':{'id':_0x379d8c[_0xbb10('0x51')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x4bedd0,null))[_0xbb10('0x1e')](removeEntity(_0x4bedd0,null))[_0xbb10('0x29')](handleError(_0x4bedd0,null));};exports[_0xbb10('0x59')]=function(_0x12ec18,_0x205e01,_0x40c4fb){var _0x2eb05a={};var _0x2a1ce1={};var _0x16932f;var _0x4e7fac;return db['SalesforceAccount'][_0xbb10('0x5a')]({'where':{'id':_0x12ec18[_0xbb10('0x51')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x205e01,null))[_0xbb10('0x1e')](function(_0x5573bb){if(_0x5573bb){_0x16932f=_0x5573bb;_0x2a1ce1['model']=_[_0xbb10('0x52')](db[_0xbb10('0x5b')][_0xbb10('0x3a')]);_0x2a1ce1[_0xbb10('0x43')]=_[_0xbb10('0x52')](_0x12ec18[_0xbb10('0x43')]);_0x2a1ce1[_0xbb10('0x3f')]=_['intersection'](_0x2a1ce1[_0xbb10('0x41')],_0x2a1ce1[_0xbb10('0x43')]);_0x2eb05a['attributes']=_['intersection'](_0x2a1ce1['model'],qs[_0xbb10('0x44')](_0x12ec18[_0xbb10('0x43')][_0xbb10('0x44')]));_0x2eb05a['attributes']=_0x2eb05a['attributes']['length']?_0x2eb05a[_0xbb10('0x42')]:_0x2a1ce1[_0xbb10('0x41')];_0x2eb05a[_0xbb10('0x47')]=qs['sort'](_0x12ec18[_0xbb10('0x43')][_0xbb10('0x48')]);_0x2eb05a['where']=qs['filters'](_[_0xbb10('0x5c')](_0x12ec18[_0xbb10('0x43')],_0x2a1ce1[_0xbb10('0x3f')]));if(_0x12ec18[_0xbb10('0x43')]['filter']){_0x2eb05a[_0xbb10('0x49')]=_[_0xbb10('0x4c')](_0x2eb05a[_0xbb10('0x49')],{'$or':_['map'](_0x2eb05a[_0xbb10('0x42')],function(_0x2f05bc){var _0x3e3617={};_0x3e3617[_0x2f05bc]={'$like':'%'+_0x12ec18['query'][_0xbb10('0x4b')]+'%'};return _0x3e3617;})});}_0x2eb05a=_[_0xbb10('0x4c')]({},_0x2eb05a,_0x12ec18[_0xbb10('0x4d')]);return _0x16932f[_0xbb10('0x59')](_0x2eb05a);}})['then'](function(_0x251417){if(_0x251417){_0x4e7fac=_0x251417[_0xbb10('0x53')];if(!_0x12ec18[_0xbb10('0x43')][_0xbb10('0x45')]('nolimit')){_0x2eb05a[_0xbb10('0x30')]=qs[_0xbb10('0x30')](_0x12ec18[_0xbb10('0x43')][_0xbb10('0x30')]);_0x2eb05a[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x12ec18[_0xbb10('0x43')]['offset']);}return _0x16932f['getConfigurations'](_0x2eb05a);}})['then'](function(_0xdfbc0b){if(_0xdfbc0b){return _0xdfbc0b?{'count':_0x4e7fac,'rows':_0xdfbc0b}:null;}})[_0xbb10('0x1e')](respondWithResult(_0x205e01,null))[_0xbb10('0x29')](handleError(_0x205e01,null));};exports['addConfiguration']=function(_0x5cd089,_0x46f462,_0x1b11c0){if(_0x5cd089[_0xbb10('0x57')]['id']){delete _0x5cd089[_0xbb10('0x57')]['id'];}return db[_0xbb10('0x39')][_0xbb10('0x5a')]({'where':{'id':_0x5cd089['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x46f462,null))[_0xbb10('0x1e')](function(_0x270fdb){if(_0x270fdb){_0x5cd089[_0xbb10('0x57')][_0xbb10('0x5d')]=_0x270fdb['id'];_0x5cd089['body']['Subjects']=integrations['getSubjects'](_0x5cd089[_0xbb10('0x57')][_0xbb10('0x5e')],_0x5cd089[_0xbb10('0x57')][_0xbb10('0x3c')]);_0x5cd089[_0xbb10('0x57')][_0xbb10('0x5f')]=integrations['getDescriptions'](_0x5cd089[_0xbb10('0x57')]['channel'],_0x5cd089['body']['type']);return db[_0xbb10('0x5b')][_0xbb10('0x56')](_0x5cd089[_0xbb10('0x57')],{'include':[{'model':db[_0xbb10('0x60')],'as':'Subjects'},{'model':db[_0xbb10('0x60')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x46f462,null))[_0xbb10('0x29')](handleError(_0x46f462,null));};exports[_0xbb10('0x61')]=function(_0x29529c,_0x2bd2ab,_0xfa3c7c){var _0x4fccc5;var _0x2d52ea='';var _0x19fcec=_0xbb10('0x62');return db[_0xbb10('0x39')][_0xbb10('0x5a')]({'where':{'id':_0x29529c[_0xbb10('0x51')]['id']},'attributes':['id',_0xbb10('0x63'),'clientId',_0xbb10('0x64'),_0xbb10('0x65'),_0xbb10('0x66'),_0xbb10('0x67')]})[_0xbb10('0x1e')](handleEntityNotFound(_0x2bd2ab,null))[_0xbb10('0x1e')](function(_0xa3b23){if(_0xa3b23){_0x2d52ea=_0xa3b23[_0xbb10('0x63')];var _0x5a4429=_0x2d52ea[_0xbb10('0x68')](-0x1);if(_0x5a4429==='/'){_0x2d52ea=_0x2d52ea[_0xbb10('0x69')](0x0,_0x2d52ea[_0xbb10('0x6a')](_0x5a4429));}_0x4fccc5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2d52ea,'clientId':_0xa3b23['clientId'],'clientSecret':_0xa3b23['clientSecret']}});return _0x4fccc5[_0xbb10('0x6b')](_0xa3b23['username'],_0xa3b23['password'][_0xbb10('0x6c')](_0xa3b23[_0xbb10('0x67')]));}})[_0xbb10('0x1e')](function(_0x12ed63){if(_0x12ed63){if(!_[_0xbb10('0x6d')](_0x29529c[_0xbb10('0x43')][_0xbb10('0x6e')])){_0x19fcec=_0x29529c[_0xbb10('0x43')][_0xbb10('0x6e')];}return _0x4fccc5['sobject'](_0x19fcec)[_0xbb10('0x6f')]();}})[_0xbb10('0x1e')](function(_0x46b6d2){var _0x35b811=['CallDisposition','CallDurationInSeconds',_0xbb10('0x70'),_0xbb10('0x71'),_0xbb10('0x72'),_0xbb10('0x73'),'Status',_0xbb10('0x74')];if(!_[_0xbb10('0x6d')](_0x29529c[_0xbb10('0x43')][_0xbb10('0x6e')])&&_0x29529c[_0xbb10('0x43')]['ticketType']==='Case'){_0x35b811=[_0xbb10('0x74'),_0xbb10('0x75'),_0xbb10('0x76'),'Status',_0xbb10('0x73'),_0xbb10('0x77'),'SuppliedName','SuppliedCompany'];}if(_0x46b6d2){_[_0xbb10('0x78')](_0x46b6d2[_0xbb10('0x44')],function(_0x177f77){return _0x177f77['custom']===![]&&!_0x35b811[_0xbb10('0x79')](_0x177f77[_0xbb10('0x37')]);});return{'count':_0x46b6d2[_0xbb10('0x44')][_0xbb10('0x53')],'rows':_[_0xbb10('0x3e')](_0x46b6d2[_0xbb10('0x44')],function(_0x45bd4e){return{'id':_0x45bd4e[_0xbb10('0x37')],'name':_0x45bd4e[_0xbb10('0x7a')],'custom':_0x45bd4e['custom'],'options':_0x45bd4e[_0xbb10('0x7b')][_0xbb10('0x53')]>0x0?_[_0xbb10('0x3e')](_0x45bd4e[_0xbb10('0x7b')],function(_0x3e3083){return{'name':_0x3e3083[_0xbb10('0x7a')],'value':_0x3e3083[_0xbb10('0x7c')]};}):_0x45bd4e[_0xbb10('0x3c')]==_0xbb10('0x7d')?[{'name':_0xbb10('0x7e'),'value':_0xbb10('0x7f')},{'name':_0xbb10('0x80'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x2bd2ab,null))[_0xbb10('0x29')](function(_0x3fa344){var _0x458615=_0x29529c[_0xbb10('0x43')][_0xbb10('0x81')]?0x1f4:_0x3fa344['statusCode']||0x1f4;logger[_0xbb10('0x25')](_0xbb10('0x82'),_0xbb10('0x61'),_0x458615,JSON[_0xbb10('0x24')](_0x3fa344));delete _0x3fa344[_0xbb10('0x37')];if(_0x458615===0x191){_0x458615=0x190;}_0x2bd2ab[_0xbb10('0x2b')](_0x458615)['send'](_0x29529c[_0xbb10('0x43')][_0xbb10('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x3fa344[_0xbb10('0x83')]}:_0x3fa344);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 88a2a2c..47b8f51 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 _0x1880=['../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0x1880,0x116));var _0x0188=function(_0x53a34c,_0x25cffd){_0x53a34c=_0x53a34c-0x0;var _0x3dda74=_0x1880[_0x53a34c];return _0x3dda74;};'use strict';var _=require('lodash');var util=require(_0x0188('0x0'));var logger=require(_0x0188('0x1'))(_0x0188('0x2'));var moment=require(_0x0188('0x3'));var BPromise=require(_0x0188('0x4'));var rp=require(_0x0188('0x5'));var fs=require('fs');var path=require(_0x0188('0x6'));var rimraf=require(_0x0188('0x7'));var config=require(_0x0188('0x8'));var attributes=require(_0x0188('0x9'));var integrations=require(_0x0188('0xa'));module['exports']=function(_0x4d903b,_0x24134c){return _0x4d903b['define'](_0x0188('0xb'),attributes,{'tableName':_0x0188('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb35=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x2ae8f9,_0x1e700a){var _0x1931ad=function(_0x337366){while(--_0x337366){_0x2ae8f9['push'](_0x2ae8f9['shift']());}};_0x1931ad(++_0x1e700a);}(_0xbb35,0x179));var _0x5bb3=function(_0x30b28c,_0x3b8daf){_0x30b28c=_0x30b28c-0x0;var _0x3be364=_0xbb35[_0x30b28c];return _0x3be364;};'use strict';var _=require(_0x5bb3('0x0'));var util=require(_0x5bb3('0x1'));var logger=require(_0x5bb3('0x2'))(_0x5bb3('0x3'));var moment=require('moment');var BPromise=require(_0x5bb3('0x4'));var rp=require(_0x5bb3('0x5'));var fs=require('fs');var path=require(_0x5bb3('0x6'));var rimraf=require('rimraf');var config=require(_0x5bb3('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x5bb3('0x8'));module[_0x5bb3('0x9')]=function(_0x501d43,_0x316087){return _0x501d43[_0x5bb3('0xa')](_0x5bb3('0xb'),attributes,{'tableName':_0x5bb3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index cfbdf41..458a0c3 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 _0xa8a8=['../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','catch','SalesforceAccount','findAll','where','options','attributes','limit','include','map','model','ShowSalesforceAccount','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xcff8d1,_0x36bb26){var _0x201167=function(_0x551f42){while(--_0x551f42){_0xcff8d1['push'](_0xcff8d1['shift']());}};_0x201167(++_0x36bb26);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3f1053,_0x358d76){_0x3f1053=_0x3f1053-0x0;var _0x1ce34f=_0xa8a8[_0x3f1053];return _0x1ce34f;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});}exports['GetSalesforceAccount']=function(_0x9d55f9){var _0x3d165c=this;return new Promise(function(_0x262ca9,_0x2bce13){return db[_0x8a8a('0x17')][_0x8a8a('0x18')]({'raw':_0x9d55f9['options']?_0x9d55f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x9d55f9['options']?_0x9d55f9['options'][_0x8a8a('0x19')]||null:null,'attributes':_0x9d55f9[_0x8a8a('0x1a')]?_0x9d55f9[_0x8a8a('0x1a')][_0x8a8a('0x1b')]||null:null,'limit':_0x9d55f9[_0x8a8a('0x1a')]?_0x9d55f9[_0x8a8a('0x1a')][_0x8a8a('0x1c')]||null:null,'include':_0x9d55f9[_0x8a8a('0x1a')]?_0x9d55f9[_0x8a8a('0x1a')][_0x8a8a('0x1d')]?_[_0x8a8a('0x1e')](_0x9d55f9[_0x8a8a('0x1a')][_0x8a8a('0x1d')],function(_0x625c1b){return{'model':db[_0x625c1b[_0x8a8a('0x1f')]],'as':_0x625c1b['as'],'attributes':_0x625c1b['attributes'],'include':_0x625c1b[_0x8a8a('0x1d')]?_[_0x8a8a('0x1e')](_0x625c1b[_0x8a8a('0x1d')],function(_0x7662e){return{'model':db[_0x7662e[_0x8a8a('0x1f')]],'as':_0x7662e['as'],'attributes':_0x7662e[_0x8a8a('0x1b')],'include':_0x7662e[_0x8a8a('0x1d')]?_['map'](_0x7662e[_0x8a8a('0x1d')],function(_0x38c1e0){return{'model':db[_0x38c1e0[_0x8a8a('0x1f')]],'as':_0x38c1e0['as'],'attributes':_0x38c1e0['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dafcd){logger[_0x8a8a('0xe')]('GetSalesforceAccount',_0x9d55f9);logger['debug']('GetSalesforceAccount',_0x9d55f9,JSON[_0x8a8a('0x11')](_0x2dafcd));_0x262ca9(_0x2dafcd);})['catch'](function(_0x10b916){logger[_0x8a8a('0x12')]('GetSalesforceAccount',_0x10b916[_0x8a8a('0x15')],_0x9d55f9);_0x2bce13(_0x3d165c[_0x8a8a('0x12')](0x1f4,_0x10b916[_0x8a8a('0x15')]));});});};exports[_0x8a8a('0x20')]=function(_0x41802e){var _0x3d6594=this;return new Promise(function(_0x3e73b1,_0x2a2917){return db['SalesforceAccount']['find']({'raw':_0x41802e['options']?_0x41802e[_0x8a8a('0x1a')][_0x8a8a('0x21')]===undefined?!![]:![]:!![],'where':_0x41802e['options']?_0x41802e[_0x8a8a('0x1a')][_0x8a8a('0x19')]||null:null,'attributes':_0x41802e['options']?_0x41802e[_0x8a8a('0x1a')][_0x8a8a('0x1b')]||null:null,'include':_0x41802e[_0x8a8a('0x1a')]?_0x41802e['options']['include']?_[_0x8a8a('0x1e')](_0x41802e['options'][_0x8a8a('0x1d')],function(_0x3a4aa6){return{'model':db[_0x3a4aa6[_0x8a8a('0x1f')]],'as':_0x3a4aa6['as'],'attributes':_0x3a4aa6[_0x8a8a('0x1b')],'include':_0x3a4aa6[_0x8a8a('0x1d')]?_[_0x8a8a('0x1e')](_0x3a4aa6[_0x8a8a('0x1d')],function(_0x389ad1){return{'model':db[_0x389ad1[_0x8a8a('0x1f')]],'as':_0x389ad1['as'],'attributes':_0x389ad1[_0x8a8a('0x1b')],'include':_0x389ad1[_0x8a8a('0x1d')]?_[_0x8a8a('0x1e')](_0x389ad1[_0x8a8a('0x1d')],function(_0x37e644){return{'model':db[_0x37e644[_0x8a8a('0x1f')]],'as':_0x37e644['as'],'attributes':_0x37e644[_0x8a8a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8a8a('0x22')](function(_0x29d187){logger['info']('ShowSalesforceAccount',_0x41802e);logger['debug'](_0x8a8a('0x20'),_0x41802e,JSON[_0x8a8a('0x11')](_0x29d187));_0x3e73b1(_0x29d187);})[_0x8a8a('0x16')](function(_0x117a5c){logger[_0x8a8a('0x12')]('ShowSalesforceAccount',_0x117a5c['message'],_0x41802e);_0x2a2917(_0x3d6594[_0x8a8a('0x12')](0x1f4,_0x117a5c['message']));});});}; \ No newline at end of file +var _0x91a7=['SalesforceAccount,\x20%s,\x20%s','catch','GetSalesforceAccount','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','SalesforceAccount','find','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message'];(function(_0xe11a29,_0x3a996f){var _0x478c43=function(_0x51b32b){while(--_0x51b32b){_0xe11a29['push'](_0xe11a29['shift']());}};_0x478c43(++_0x3a996f);}(_0x91a7,0xe7));var _0x791a=function(_0x56fa56,_0x5a0c7d){_0x56fa56=_0x56fa56-0x0;var _0x35d445=_0x91a7[_0x56fa56];return _0x35d445;};'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')]('SalesforceAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));logger[_0x791a('0xc')]('SalesforceAccount,\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')]('SalesforceAccount,\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')]('SalesforceAccount,\x20%s,\x20%s',_0x33baac,_0x791a('0xb'));_0x5aa10a(_0x80ff65['result'][_0x791a('0x10')]);}})[_0x791a('0x12')](function(_0x49ae3e){logger[_0x791a('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x33baac,_0x49ae3e);_0x1a32b4(_0x49ae3e);});});}exports[_0x791a('0x13')]=function(_0x52941d){var _0x4a84ee=this;return new Promise(function(_0x588d00,_0x40f0d3){return db['SalesforceAccount']['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')]('ShowSalesforceAccount',_0x5df656);logger[_0x791a('0xc')]('ShowSalesforceAccount',_0x5df656,JSON[_0x791a('0xd')](_0x3f46be));_0x2e4ec8(_0x3f46be);})['catch'](function(_0x25e8cc){logger[_0x791a('0xe')]('ShowSalesforceAccount',_0x25e8cc[_0x791a('0x10')],_0x5df656);_0xcde862(_0xc59f5e[_0x791a('0xe')](0x1f4,_0x25e8cc['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 14f240e..ab32a4c 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 _0x4624=['/:id/descriptions','getDescriptions','post','put','/:id','update','delete','multer','util','path','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id/fields','getSubjects'];(function(_0x1f58b0,_0x40c724){var _0x2bf7f1=function(_0x6f1fbb){while(--_0x6f1fbb){_0x1f58b0['push'](_0x1f58b0['shift']());}};_0x2bf7f1(++_0x40c724);}(_0x4624,0x17d));var _0x4462=function(_0x53829f,_0x12f252){_0x53829f=_0x53829f-0x0;var _0x3fbf7b=_0x4624[_0x53829f];return _0x3fbf7b;};'use strict';var multer=require(_0x4462('0x0'));var util=require(_0x4462('0x1'));var path=require(_0x4462('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4462('0x3'));var config=require(_0x4462('0x4'));var controller=require(_0x4462('0x5'));router[_0x4462('0x6')]('/',auth[_0x4462('0x7')](),controller['index']);router[_0x4462('0x6')]('/:id',auth[_0x4462('0x7')](),controller['show']);router[_0x4462('0x6')](_0x4462('0x8'),auth[_0x4462('0x7')](),controller['getFields']);router[_0x4462('0x6')]('/:id/subjects',auth[_0x4462('0x7')](),controller[_0x4462('0x9')]);router['get'](_0x4462('0xa'),auth[_0x4462('0x7')](),controller[_0x4462('0xb')]);router[_0x4462('0xc')]('/',auth[_0x4462('0x7')](),controller['create']);router[_0x4462('0xd')](_0x4462('0xe'),auth[_0x4462('0x7')](),controller[_0x4462('0xf')]);router[_0x4462('0x10')](_0x4462('0xe'),auth[_0x4462('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2b55=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','exports'];(function(_0x47c2e5,_0xcdd966){var _0x7b3bd7=function(_0x13101e){while(--_0x13101e){_0x47c2e5['push'](_0x47c2e5['shift']());}};_0x7b3bd7(++_0xcdd966);}(_0x2b55,0x73));var _0x52b5=function(_0x5d1102,_0x35353b){_0x5d1102=_0x5d1102-0x0;var _0x4455ef=_0x2b55[_0x5d1102];return _0x4455ef;};'use strict';var multer=require(_0x52b5('0x0'));var util=require(_0x52b5('0x1'));var path=require(_0x52b5('0x2'));var timeout=require(_0x52b5('0x3'));var express=require(_0x52b5('0x4'));var router=express[_0x52b5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x52b5('0x6'));var config=require(_0x52b5('0x7'));var controller=require(_0x52b5('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x52b5('0x9')](_0x52b5('0xa'),auth[_0x52b5('0xb')](),controller[_0x52b5('0xc')]);router[_0x52b5('0x9')]('/:id/fields',auth[_0x52b5('0xb')](),controller[_0x52b5('0xd')]);router[_0x52b5('0x9')](_0x52b5('0xe'),auth[_0x52b5('0xb')](),controller[_0x52b5('0xf')]);router[_0x52b5('0x9')](_0x52b5('0x10'),auth['isAuthenticated'](),controller[_0x52b5('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x52b5('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x52b5('0x13')]);router[_0x52b5('0x14')](_0x52b5('0xa'),auth[_0x52b5('0xb')](),controller[_0x52b5('0x15')]);module[_0x52b5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1413690..3a071bb 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 _0x8614=['ENUM','Task','Case','contact_lead','contact','lead','nothing','sequelize','exports','STRING'];(function(_0x108de5,_0x216490){var _0x4dcba0=function(_0x283461){while(--_0x283461){_0x108de5['push'](_0x108de5['shift']());}};_0x4dcba0(++_0x216490);}(_0x8614,0x1dd));var _0x4861=function(_0x453640,_0x418827){_0x453640=_0x453640-0x0;var _0x26db22=_0x8614[_0x453640];return _0x26db22;};'use strict';var Sequelize=require(_0x4861('0x0'));module[_0x4861('0x1')]={'name':{'type':Sequelize[_0x4861('0x2')]},'description':{'type':Sequelize[_0x4861('0x2')]},'ticketType':{'type':Sequelize[_0x4861('0x3')](_0x4861('0x4'),_0x4861('0x5')),'defaultValue':_0x4861('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x4861('0x6'),_0x4861('0x7'),_0x4861('0x8')),'defaultValue':_0x4861('0x6')},'moduleCreate':{'type':Sequelize[_0x4861('0x3')](_0x4861('0x9'),'contact',_0x4861('0x8')),'defaultValue':_0x4861('0x8')}}; \ No newline at end of file +var _0x2fc2=['sequelize','STRING','ENUM','Task','Case','contact_lead','lead','contact'];(function(_0x35d3f1,_0x4ba868){var _0x5cb23f=function(_0x100a99){while(--_0x100a99){_0x35d3f1['push'](_0x35d3f1['shift']());}};_0x5cb23f(++_0x4ba868);}(_0x2fc2,0x1a8));var _0x22fc=function(_0x5eb47c,_0x5d981d){_0x5eb47c=_0x5eb47c-0x0;var _0x5dd6a5=_0x2fc2[_0x5eb47c];return _0x5dd6a5;};'use strict';var Sequelize=require(_0x22fc('0x0'));module['exports']={'name':{'type':Sequelize[_0x22fc('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x22fc('0x2')](_0x22fc('0x3'),_0x22fc('0x4')),'defaultValue':_0x22fc('0x3')},'moduleSearch':{'type':Sequelize[_0x22fc('0x2')](_0x22fc('0x5'),'contact',_0x22fc('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x22fc('0x2')]('nothing',_0x22fc('0x7'),_0x22fc('0x6')),'defaultValue':_0x22fc('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0729397..1af1603 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 _0xaed4=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','end','status','json','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SalesforceConfiguration','count','includeAll','include','findAll','length','find','create','body','params','getFields','findOne','SalesforceField','offset','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4cb272,_0x52c0e9){var _0x57b4aa=function(_0x1efefb){while(--_0x1efefb){_0x4cb272['push'](_0x4cb272['shift']());}};_0x57b4aa(++_0x52c0e9);}(_0xaed4,0x1ae));var _0x4aed=function(_0x5f5282,_0x225bfe){_0x5f5282=_0x5f5282-0x0;var _0xd5e782=_0xaed4[_0x5f5282];return _0xd5e782;};'use strict';var pdf=require(_0x4aed('0x0'));var emlformat=require(_0x4aed('0x1'));var rimraf=require(_0x4aed('0x2'));var zipdir=require(_0x4aed('0x3'));var jsonpatch=require(_0x4aed('0x4'));var rp=require('request-promise');var moment=require(_0x4aed('0x5'));var BPromise=require(_0x4aed('0x6'));var Mustache=require(_0x4aed('0x7'));var util=require(_0x4aed('0x8'));var path=require(_0x4aed('0x9'));var sox=require(_0x4aed('0xa'));var csv=require(_0x4aed('0xb'));var ejs=require(_0x4aed('0xc'));var fs=require('fs');var _=require(_0x4aed('0xd'));var squel=require(_0x4aed('0xe'));var crypto=require('crypto');var jsforce=require(_0x4aed('0xf'));var deskjs=require(_0x4aed('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4aed('0x11'));var Redis=require('ioredis');var authService=require(_0x4aed('0x12'));var qs=require(_0x4aed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4aed('0x14'))(_0x4aed('0x15'));var utils=require(_0x4aed('0x16'));var config=require(_0x4aed('0x17'));var licenseUtil=require(_0x4aed('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4aed('0x19'));var client=jayson[_0x4aed('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42b122,_0xc5eed0,_0x29d72c,_0x19d0ad){return new BPromise(function(_0x57dc8e,_0x595ee2){var _0x449a0a=_0x19d0ad||client;return _0x449a0a['request'](_0x42b122,_0x29d72c)['then'](function(_0x2e3e5b){logger[_0x4aed('0x1b')](_0x4aed('0x1c'),_0xc5eed0,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xc5eed0,_0x4aed('0x1d'),JSON['stringify'](_0x2e3e5b));if(_0x2e3e5b[_0x4aed('0x1e')]){if(_0x2e3e5b[_0x4aed('0x1e')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0xc5eed0,_0x2e3e5b['error'][_0x4aed('0x1f')]);return _0x595ee2(_0x2e3e5b[_0x4aed('0x1e')][_0x4aed('0x1f')]);}logger[_0x4aed('0x1e')](_0x4aed('0x1c'),_0xc5eed0,_0x2e3e5b[_0x4aed('0x1e')]['message']);return _0x57dc8e(_0x2e3e5b['error'][_0x4aed('0x1f')]);}else{logger[_0x4aed('0x1b')](_0x4aed('0x1c'),_0xc5eed0,_0x4aed('0x1d'));_0x57dc8e(_0x2e3e5b[_0x4aed('0x20')][_0x4aed('0x1f')]);}})[_0x4aed('0x21')](function(_0xf45161){logger['error'](_0x4aed('0x1c'),_0xc5eed0,_0xf45161);_0x595ee2(_0xf45161);});});}function respondWithStatusCode(_0x39db08,_0x5e12c9){_0x5e12c9=_0x5e12c9||0xcc;return function(_0x2be85c){if(_0x2be85c){return _0x39db08[_0x4aed('0x22')](_0x5e12c9);}return _0x39db08['status'](_0x5e12c9)[_0x4aed('0x23')]();};}function respondWithResult(_0x25ccb4,_0x466b75){_0x466b75=_0x466b75||0xc8;return function(_0x28b851){if(_0x28b851){return _0x25ccb4[_0x4aed('0x24')](_0x466b75)[_0x4aed('0x25')](_0x28b851);}};}function respondWithFilteredResult(_0x3eb078,_0x4ff1cf){return function(_0x157e40){if(_0x157e40){var _0x44a2e4=_0x157e40['count'],_0x1e7d47=_0x4ff1cf['offset'],_0x1880a=_0x4ff1cf['offset']+_0x4ff1cf[_0x4aed('0x26')],_0x8a47fc;if(_0x1880a>=_0x44a2e4){_0x1880a=_0x44a2e4;_0x8a47fc=0xc8;}else{_0x8a47fc=0xce;}_0x3eb078[_0x4aed('0x24')](_0x8a47fc);return _0x3eb078[_0x4aed('0x27')](_0x4aed('0x28'),_0x1e7d47+'-'+_0x1880a+'/'+_0x44a2e4)[_0x4aed('0x25')](_0x157e40);}return null;};}function patchUpdates(_0x38926a){return function(_0x4a5f04){try{jsonpatch[_0x4aed('0x29')](_0x4a5f04,_0x38926a,!![]);}catch(_0x1d2894){return BPromise[_0x4aed('0x2a')](_0x1d2894);}return _0x4a5f04[_0x4aed('0x2b')]();};}function saveUpdates(_0x24c0e4,_0x4555c2){return function(_0x2f6a92){if(_0x2f6a92){return _0x2f6a92[_0x4aed('0x2c')](_0x24c0e4)[_0x4aed('0x2d')](function(_0x3812d5){return _0x3812d5;});}return null;};}function removeEntity(_0x56bf3f,_0x113f7b){return function(_0x5a764c){if(_0x5a764c){return _0x5a764c[_0x4aed('0x2e')]()[_0x4aed('0x2d')](function(){_0x56bf3f[_0x4aed('0x24')](0xcc)[_0x4aed('0x23')]();});}};}function handleEntityNotFound(_0x41f2ae,_0xa979db){return function(_0x34d41c){if(!_0x34d41c){_0x41f2ae[_0x4aed('0x22')](0x194);}return _0x34d41c;};}function handleError(_0x940560,_0x1cb29f){_0x1cb29f=_0x1cb29f||0x1f4;return function(_0x257e35){logger[_0x4aed('0x1e')](_0x257e35[_0x4aed('0x2f')]);if(_0x257e35['name']){delete _0x257e35[_0x4aed('0x30')];}_0x940560[_0x4aed('0x24')](_0x1cb29f)['send'](_0x257e35);};}exports['index']=function(_0x849ea,_0x3cbec5){var _0x30b68a={},_0x96be2a={},_0x16ee2a={'count':0x0,'rows':[]};var _0x384353=_[_0x4aed('0x31')](db['SalesforceConfiguration'][_0x4aed('0x32')],function(_0x8707fd){return{'name':_0x8707fd[_0x4aed('0x33')],'type':_0x8707fd[_0x4aed('0x34')][_0x4aed('0x35')]};});_0x96be2a[_0x4aed('0x36')]=_[_0x4aed('0x31')](_0x384353,_0x4aed('0x30'));_0x96be2a['query']=_[_0x4aed('0x37')](_0x849ea['query']);_0x96be2a[_0x4aed('0x38')]=_[_0x4aed('0x39')](_0x96be2a[_0x4aed('0x36')],_0x96be2a[_0x4aed('0x3a')]);_0x30b68a[_0x4aed('0x3b')]=_[_0x4aed('0x39')](_0x96be2a[_0x4aed('0x36')],qs[_0x4aed('0x3c')](_0x849ea['query'][_0x4aed('0x3c')]));_0x30b68a['attributes']=_0x30b68a[_0x4aed('0x3b')]['length']?_0x30b68a['attributes']:_0x96be2a['model'];if(!_0x849ea[_0x4aed('0x3a')][_0x4aed('0x3d')](_0x4aed('0x3e'))){_0x30b68a[_0x4aed('0x26')]=qs[_0x4aed('0x26')](_0x849ea['query'][_0x4aed('0x26')]);_0x30b68a['offset']=qs['offset'](_0x849ea[_0x4aed('0x3a')]['offset']);}_0x30b68a[_0x4aed('0x3f')]=qs[_0x4aed('0x40')](_0x849ea['query'][_0x4aed('0x40')]);_0x30b68a[_0x4aed('0x41')]=qs[_0x4aed('0x38')](_[_0x4aed('0x42')](_0x849ea[_0x4aed('0x3a')],_0x96be2a[_0x4aed('0x38')]),_0x384353);if(_0x849ea[_0x4aed('0x3a')][_0x4aed('0x43')]){_0x30b68a['where']=_[_0x4aed('0x44')](_0x30b68a[_0x4aed('0x41')],{'$or':_[_0x4aed('0x31')](_0x384353,function(_0x9de210){if(_0x9de210['type']!==_0x4aed('0x45')){var _0x454b21={};_0x454b21[_0x9de210[_0x4aed('0x30')]]={'$like':'%'+_0x849ea[_0x4aed('0x3a')][_0x4aed('0x43')]+'%'};return _0x454b21;}})});}_0x30b68a=_[_0x4aed('0x44')]({},_0x30b68a,_0x849ea[_0x4aed('0x46')]);var _0x2e90bc={'where':_0x30b68a[_0x4aed('0x41')]};return db[_0x4aed('0x47')][_0x4aed('0x48')](_0x2e90bc)['then'](function(_0x2077ff){_0x16ee2a[_0x4aed('0x48')]=_0x2077ff;if(_0x849ea[_0x4aed('0x3a')][_0x4aed('0x49')]){_0x30b68a[_0x4aed('0x4a')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x4aed('0x4b')](_0x30b68a);})[_0x4aed('0x2d')](function(_0x1235b2){_0x16ee2a['rows']=_0x1235b2;return _0x16ee2a;})[_0x4aed('0x2d')](respondWithFilteredResult(_0x3cbec5,_0x30b68a))[_0x4aed('0x21')](handleError(_0x3cbec5,null));};exports['show']=function(_0x20b529,_0x45d3fd){var _0x323892={'raw':![],'where':{'id':_0x20b529['params']['id']}},_0x5d0d53={};_0x5d0d53['model']=_[_0x4aed('0x37')](db[_0x4aed('0x47')][_0x4aed('0x32')]);_0x5d0d53[_0x4aed('0x3a')]=_[_0x4aed('0x37')](_0x20b529[_0x4aed('0x3a')]);_0x5d0d53[_0x4aed('0x38')]=_[_0x4aed('0x39')](_0x5d0d53[_0x4aed('0x36')],_0x5d0d53[_0x4aed('0x3a')]);_0x323892[_0x4aed('0x3b')]=_[_0x4aed('0x39')](_0x5d0d53['model'],qs['fields'](_0x20b529['query'][_0x4aed('0x3c')]));_0x323892[_0x4aed('0x3b')]=_0x323892[_0x4aed('0x3b')][_0x4aed('0x4c')]?_0x323892[_0x4aed('0x3b')]:_0x5d0d53[_0x4aed('0x36')];if(_0x20b529['query']['includeAll']){_0x323892[_0x4aed('0x4a')]=[{'all':!![]}];}_0x323892=_[_0x4aed('0x44')]({},_0x323892,_0x20b529['options']);return db[_0x4aed('0x47')][_0x4aed('0x4d')](_0x323892)[_0x4aed('0x2d')](handleEntityNotFound(_0x45d3fd,null))['then'](respondWithResult(_0x45d3fd,null))[_0x4aed('0x21')](handleError(_0x45d3fd,null));};exports['create']=function(_0x30e3ce,_0x51a23a){return db['SalesforceConfiguration'][_0x4aed('0x4e')](_0x30e3ce[_0x4aed('0x4f')],{})['then'](respondWithResult(_0x51a23a,0xc9))[_0x4aed('0x21')](handleError(_0x51a23a,null));};exports[_0x4aed('0x2c')]=function(_0x42e1bc,_0x25fa68){if(_0x42e1bc[_0x4aed('0x4f')]['id']){delete _0x42e1bc[_0x4aed('0x4f')]['id'];}return db[_0x4aed('0x47')][_0x4aed('0x4d')]({'where':{'id':_0x42e1bc[_0x4aed('0x50')]['id']}})[_0x4aed('0x2d')](handleEntityNotFound(_0x25fa68,null))[_0x4aed('0x2d')](saveUpdates(_0x42e1bc['body'],null))['then'](respondWithResult(_0x25fa68,null))[_0x4aed('0x21')](handleError(_0x25fa68,null));};exports['destroy']=function(_0x5f498a,_0x2f7381){return db[_0x4aed('0x47')][_0x4aed('0x4d')]({'where':{'id':_0x5f498a[_0x4aed('0x50')]['id']}})[_0x4aed('0x2d')](handleEntityNotFound(_0x2f7381,null))[_0x4aed('0x2d')](removeEntity(_0x2f7381,null))['catch'](handleError(_0x2f7381,null));};exports[_0x4aed('0x51')]=function(_0x3dc34e,_0x4eab92,_0x17439b){var _0x4fab2f={};var _0x5a5b5f={};var _0x1b1e7a;var _0x2549c7;return db[_0x4aed('0x47')][_0x4aed('0x52')]({'where':{'id':_0x3dc34e[_0x4aed('0x50')]['id']}})[_0x4aed('0x2d')](handleEntityNotFound(_0x4eab92,null))[_0x4aed('0x2d')](function(_0x3e31e2){if(_0x3e31e2){_0x1b1e7a=_0x3e31e2;_0x5a5b5f[_0x4aed('0x36')]=_[_0x4aed('0x37')](db[_0x4aed('0x53')]['rawAttributes']);_0x5a5b5f[_0x4aed('0x3a')]=_[_0x4aed('0x37')](_0x3dc34e[_0x4aed('0x3a')]);_0x5a5b5f['filters']=_[_0x4aed('0x39')](_0x5a5b5f[_0x4aed('0x36')],_0x5a5b5f[_0x4aed('0x3a')]);_0x4fab2f[_0x4aed('0x3b')]=_[_0x4aed('0x39')](_0x5a5b5f[_0x4aed('0x36')],qs[_0x4aed('0x3c')](_0x3dc34e['query'][_0x4aed('0x3c')]));_0x4fab2f[_0x4aed('0x3b')]=_0x4fab2f['attributes']['length']?_0x4fab2f[_0x4aed('0x3b')]:_0x5a5b5f[_0x4aed('0x36')];_0x4fab2f['order']=qs[_0x4aed('0x40')](_0x3dc34e[_0x4aed('0x3a')]['sort']);_0x4fab2f[_0x4aed('0x41')]=qs['filters'](_['pick'](_0x3dc34e[_0x4aed('0x3a')],_0x5a5b5f[_0x4aed('0x38')]));if(_0x3dc34e[_0x4aed('0x3a')]['filter']){_0x4fab2f[_0x4aed('0x41')]=_['merge'](_0x4fab2f[_0x4aed('0x41')],{'$or':_[_0x4aed('0x31')](_0x4fab2f[_0x4aed('0x3b')],function(_0x5c388f){var _0x39a2f8={};_0x39a2f8[_0x5c388f]={'$like':'%'+_0x3dc34e[_0x4aed('0x3a')][_0x4aed('0x43')]+'%'};return _0x39a2f8;})});}_0x4fab2f=_[_0x4aed('0x44')]({},_0x4fab2f,_0x3dc34e[_0x4aed('0x46')]);return _0x1b1e7a[_0x4aed('0x51')](_0x4fab2f);}})[_0x4aed('0x2d')](function(_0x7b5e27){if(_0x7b5e27){_0x2549c7=_0x7b5e27[_0x4aed('0x4c')];if(!_0x3dc34e[_0x4aed('0x3a')]['hasOwnProperty'](_0x4aed('0x3e'))){_0x4fab2f[_0x4aed('0x26')]=qs['limit'](_0x3dc34e[_0x4aed('0x3a')][_0x4aed('0x26')]);_0x4fab2f[_0x4aed('0x54')]=qs[_0x4aed('0x54')](_0x3dc34e['query']['offset']);}return _0x1b1e7a[_0x4aed('0x51')](_0x4fab2f);}})[_0x4aed('0x2d')](function(_0x2480c8){if(_0x2480c8){return _0x2480c8?{'count':_0x2549c7,'rows':_0x2480c8}:null;}})[_0x4aed('0x2d')](respondWithResult(_0x4eab92,null))[_0x4aed('0x21')](handleError(_0x4eab92,null));};exports[_0x4aed('0x55')]=function(_0x2f8b1e,_0xd164a,_0x2891e5){var _0x4e2139={};var _0x4119a2={};var _0xdc8c71;var _0x4f16a5;return db[_0x4aed('0x47')][_0x4aed('0x52')]({'where':{'id':_0x2f8b1e['params']['id']}})[_0x4aed('0x2d')](handleEntityNotFound(_0xd164a,null))[_0x4aed('0x2d')](function(_0x1678e4){if(_0x1678e4){_0xdc8c71=_0x1678e4;_0x4119a2[_0x4aed('0x36')]=_['keys'](db[_0x4aed('0x53')][_0x4aed('0x32')]);_0x4119a2[_0x4aed('0x3a')]=_[_0x4aed('0x37')](_0x2f8b1e[_0x4aed('0x3a')]);_0x4119a2[_0x4aed('0x38')]=_[_0x4aed('0x39')](_0x4119a2[_0x4aed('0x36')],_0x4119a2[_0x4aed('0x3a')]);_0x4e2139[_0x4aed('0x3b')]=_['intersection'](_0x4119a2[_0x4aed('0x36')],qs['fields'](_0x2f8b1e['query'][_0x4aed('0x3c')]));_0x4e2139[_0x4aed('0x3b')]=_0x4e2139[_0x4aed('0x3b')][_0x4aed('0x4c')]?_0x4e2139['attributes']:_0x4119a2[_0x4aed('0x36')];_0x4e2139['order']=qs[_0x4aed('0x40')](_0x2f8b1e['query'][_0x4aed('0x40')]);_0x4e2139[_0x4aed('0x41')]=qs[_0x4aed('0x38')](_[_0x4aed('0x42')](_0x2f8b1e[_0x4aed('0x3a')],_0x4119a2[_0x4aed('0x38')]));if(_0x2f8b1e[_0x4aed('0x3a')][_0x4aed('0x43')]){_0x4e2139[_0x4aed('0x41')]=_[_0x4aed('0x44')](_0x4e2139[_0x4aed('0x41')],{'$or':_['map'](_0x4e2139[_0x4aed('0x3b')],function(_0x3894eb){var _0x34628c={};_0x34628c[_0x3894eb]={'$like':'%'+_0x2f8b1e['query']['filter']+'%'};return _0x34628c;})});}_0x4e2139=_[_0x4aed('0x44')]({},_0x4e2139,_0x2f8b1e[_0x4aed('0x46')]);return _0xdc8c71[_0x4aed('0x55')](_0x4e2139);}})[_0x4aed('0x2d')](function(_0x13effa){if(_0x13effa){_0x4f16a5=_0x13effa[_0x4aed('0x4c')];if(!_0x2f8b1e[_0x4aed('0x3a')][_0x4aed('0x3d')](_0x4aed('0x3e'))){_0x4e2139[_0x4aed('0x26')]=qs['limit'](_0x2f8b1e[_0x4aed('0x3a')]['limit']);_0x4e2139[_0x4aed('0x54')]=qs[_0x4aed('0x54')](_0x2f8b1e[_0x4aed('0x3a')][_0x4aed('0x54')]);}return _0xdc8c71[_0x4aed('0x55')](_0x4e2139);}})['then'](function(_0x18873e){if(_0x18873e){return _0x18873e?{'count':_0x4f16a5,'rows':_0x18873e}:null;}})['then'](respondWithResult(_0xd164a,null))[_0x4aed('0x21')](handleError(_0xd164a,null));};exports[_0x4aed('0x56')]=function(_0xc7e88,_0x3ccb08,_0x42f8f9){var _0x2cfca4={};var _0x1e5fdd={};var _0x3eca68;var _0x2d1ae9;return db[_0x4aed('0x47')][_0x4aed('0x52')]({'where':{'id':_0xc7e88[_0x4aed('0x50')]['id']}})[_0x4aed('0x2d')](handleEntityNotFound(_0x3ccb08,null))[_0x4aed('0x2d')](function(_0x4379b5){if(_0x4379b5){_0x3eca68=_0x4379b5;_0x1e5fdd[_0x4aed('0x36')]=_['keys'](db[_0x4aed('0x53')]['rawAttributes']);_0x1e5fdd[_0x4aed('0x3a')]=_['keys'](_0xc7e88[_0x4aed('0x3a')]);_0x1e5fdd[_0x4aed('0x38')]=_[_0x4aed('0x39')](_0x1e5fdd[_0x4aed('0x36')],_0x1e5fdd[_0x4aed('0x3a')]);_0x2cfca4[_0x4aed('0x3b')]=_['intersection'](_0x1e5fdd[_0x4aed('0x36')],qs['fields'](_0xc7e88[_0x4aed('0x3a')]['fields']));_0x2cfca4[_0x4aed('0x3b')]=_0x2cfca4[_0x4aed('0x3b')][_0x4aed('0x4c')]?_0x2cfca4[_0x4aed('0x3b')]:_0x1e5fdd[_0x4aed('0x36')];_0x2cfca4[_0x4aed('0x3f')]=qs[_0x4aed('0x40')](_0xc7e88['query']['sort']);_0x2cfca4[_0x4aed('0x41')]=qs[_0x4aed('0x38')](_[_0x4aed('0x42')](_0xc7e88[_0x4aed('0x3a')],_0x1e5fdd['filters']));if(_0xc7e88['query'][_0x4aed('0x43')]){_0x2cfca4[_0x4aed('0x41')]=_[_0x4aed('0x44')](_0x2cfca4[_0x4aed('0x41')],{'$or':_[_0x4aed('0x31')](_0x2cfca4[_0x4aed('0x3b')],function(_0x3d0dd3){var _0xeee381={};_0xeee381[_0x3d0dd3]={'$like':'%'+_0xc7e88[_0x4aed('0x3a')][_0x4aed('0x43')]+'%'};return _0xeee381;})});}_0x2cfca4=_[_0x4aed('0x44')]({},_0x2cfca4,_0xc7e88['options']);return _0x3eca68[_0x4aed('0x56')](_0x2cfca4);}})['then'](function(_0x412771){if(_0x412771){_0x2d1ae9=_0x412771[_0x4aed('0x4c')];if(!_0xc7e88[_0x4aed('0x3a')][_0x4aed('0x3d')](_0x4aed('0x3e'))){_0x2cfca4['limit']=qs[_0x4aed('0x26')](_0xc7e88[_0x4aed('0x3a')][_0x4aed('0x26')]);_0x2cfca4[_0x4aed('0x54')]=qs[_0x4aed('0x54')](_0xc7e88[_0x4aed('0x3a')][_0x4aed('0x54')]);}return _0x3eca68[_0x4aed('0x56')](_0x2cfca4);}})[_0x4aed('0x2d')](function(_0x37206c){if(_0x37206c){return _0x37206c?{'count':_0x2d1ae9,'rows':_0x37206c}:null;}})[_0x4aed('0x2d')](respondWithResult(_0x3ccb08,null))[_0x4aed('0x21')](handleError(_0x3ccb08,null));}; \ No newline at end of file +var _0x28f3=['http','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','merge','where','type','VIRTUAL','options','SalesforceConfiguration','rows','show','params','keys','includeAll','include','find','create','body','findOne','SalesforceField','pick','getFields','getSubjects','hasOwnProperty','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x28f3,0x9f));var _0x328f=function(_0x36e619,_0x171fb0){_0x36e619=_0x36e619-0x0;var _0x147e58=_0x28f3[_0x36e619];return _0x147e58;};'use strict';var pdf=require(_0x328f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x328f('0x1'));var zipdir=require(_0x328f('0x2'));var jsonpatch=require(_0x328f('0x3'));var rp=require(_0x328f('0x4'));var moment=require(_0x328f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x328f('0x6'));var util=require('util');var path=require(_0x328f('0x7'));var sox=require('sox');var csv=require(_0x328f('0x8'));var ejs=require(_0x328f('0x9'));var fs=require('fs');var _=require(_0x328f('0xa'));var squel=require(_0x328f('0xb'));var crypto=require(_0x328f('0xc'));var jsforce=require(_0x328f('0xd'));var deskjs=require(_0x328f('0xe'));var toCsv=require(_0x328f('0x8'));var querystring=require(_0x328f('0xf'));var Papa=require(_0x328f('0x10'));var Redis=require(_0x328f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x328f('0x12'));var as=require(_0x328f('0x13'));var hardwareService=require(_0x328f('0x14'));var logger=require(_0x328f('0x15'))(_0x328f('0x16'));var utils=require(_0x328f('0x17'));var config=require(_0x328f('0x18'));var licenseUtil=require(_0x328f('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x328f('0x1a')][_0x328f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x481cd4,_0x24d14d,_0x17053e,_0x30e007){return new BPromise(function(_0x1c2e21,_0xd4ab51){var _0x549744=_0x30e007||client;return _0x549744[_0x328f('0x1c')](_0x481cd4,_0x17053e)['then'](function(_0x4e1f32){logger[_0x328f('0x1d')](_0x328f('0x1e'),_0x24d14d,'request\x20sent');logger[_0x328f('0x1f')](_0x328f('0x20'),_0x24d14d,_0x328f('0x21'),JSON[_0x328f('0x22')](_0x4e1f32));if(_0x4e1f32['error']){if(_0x4e1f32[_0x328f('0x23')][_0x328f('0x24')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x24d14d,_0x4e1f32['error'][_0x328f('0x25')]);return _0xd4ab51(_0x4e1f32['error']['message']);}logger['error'](_0x328f('0x1e'),_0x24d14d,_0x4e1f32[_0x328f('0x23')][_0x328f('0x25')]);return _0x1c2e21(_0x4e1f32[_0x328f('0x23')]['message']);}else{logger['info'](_0x328f('0x1e'),_0x24d14d,'request\x20sent');_0x1c2e21(_0x4e1f32[_0x328f('0x26')][_0x328f('0x25')]);}})[_0x328f('0x27')](function(_0x4532c0){logger[_0x328f('0x23')](_0x328f('0x1e'),_0x24d14d,_0x4532c0);_0xd4ab51(_0x4532c0);});});}function respondWithStatusCode(_0x1d4ba8,_0x498428){_0x498428=_0x498428||0xcc;return function(_0x100a01){if(_0x100a01){return _0x1d4ba8[_0x328f('0x28')](_0x498428);}return _0x1d4ba8['status'](_0x498428)[_0x328f('0x29')]();};}function respondWithResult(_0x97ae18,_0x2af685){_0x2af685=_0x2af685||0xc8;return function(_0x51011a){if(_0x51011a){return _0x97ae18['status'](_0x2af685)[_0x328f('0x2a')](_0x51011a);}};}function respondWithFilteredResult(_0x225634,_0x24d760){return function(_0x4d554a){if(_0x4d554a){var _0x80aa90=_0x4d554a[_0x328f('0x2b')],_0x1c2e1e=_0x24d760[_0x328f('0x2c')],_0x521468=_0x24d760[_0x328f('0x2c')]+_0x24d760[_0x328f('0x2d')],_0x1126d1;if(_0x521468>=_0x80aa90){_0x521468=_0x80aa90;_0x1126d1=0xc8;}else{_0x1126d1=0xce;}_0x225634[_0x328f('0x2e')](_0x1126d1);return _0x225634[_0x328f('0x2f')](_0x328f('0x30'),_0x1c2e1e+'-'+_0x521468+'/'+_0x80aa90)[_0x328f('0x2a')](_0x4d554a);}return null;};}function patchUpdates(_0x34d557){return function(_0x55e8f6){try{jsonpatch[_0x328f('0x31')](_0x55e8f6,_0x34d557,!![]);}catch(_0x34b72e){return BPromise['reject'](_0x34b72e);}return _0x55e8f6[_0x328f('0x32')]();};}function saveUpdates(_0x29deae,_0x36a1ec){return function(_0x36d0e0){if(_0x36d0e0){return _0x36d0e0[_0x328f('0x33')](_0x29deae)[_0x328f('0x34')](function(_0x7a62ad){return _0x7a62ad;});}return null;};}function removeEntity(_0xb4edcc,_0x398ed5){return function(_0x1102e2){if(_0x1102e2){return _0x1102e2[_0x328f('0x35')]()['then'](function(){_0xb4edcc[_0x328f('0x2e')](0xcc)[_0x328f('0x29')]();});}};}function handleEntityNotFound(_0x4c2a44,_0x1b1e0b){return function(_0x37e021){if(!_0x37e021){_0x4c2a44['sendStatus'](0x194);}return _0x37e021;};}function handleError(_0x49ed2f,_0x401ede){_0x401ede=_0x401ede||0x1f4;return function(_0x58a44e){logger[_0x328f('0x23')](_0x58a44e[_0x328f('0x36')]);if(_0x58a44e[_0x328f('0x37')]){delete _0x58a44e[_0x328f('0x37')];}_0x49ed2f['status'](_0x401ede)[_0x328f('0x38')](_0x58a44e);};}exports[_0x328f('0x39')]=function(_0x57f477,_0x2662eb){var _0x2d5a5d={},_0x47a598={},_0x1b31ab={'count':0x0,'rows':[]};var _0x3e955c=_[_0x328f('0x3a')](db['SalesforceConfiguration'][_0x328f('0x3b')],function(_0x28af30){return{'name':_0x28af30['fieldName'],'type':_0x28af30['type']['key']};});_0x47a598[_0x328f('0x3c')]=_[_0x328f('0x3a')](_0x3e955c,_0x328f('0x37'));_0x47a598[_0x328f('0x3d')]=_['keys'](_0x57f477[_0x328f('0x3d')]);_0x47a598['filters']=_[_0x328f('0x3e')](_0x47a598[_0x328f('0x3c')],_0x47a598['query']);_0x2d5a5d[_0x328f('0x3f')]=_[_0x328f('0x3e')](_0x47a598[_0x328f('0x3c')],qs['fields'](_0x57f477[_0x328f('0x3d')][_0x328f('0x40')]));_0x2d5a5d['attributes']=_0x2d5a5d[_0x328f('0x3f')][_0x328f('0x41')]?_0x2d5a5d[_0x328f('0x3f')]:_0x47a598[_0x328f('0x3c')];if(!_0x57f477[_0x328f('0x3d')]['hasOwnProperty'](_0x328f('0x42'))){_0x2d5a5d[_0x328f('0x2d')]=qs['limit'](_0x57f477[_0x328f('0x3d')]['limit']);_0x2d5a5d[_0x328f('0x2c')]=qs[_0x328f('0x2c')](_0x57f477['query'][_0x328f('0x2c')]);}_0x2d5a5d[_0x328f('0x43')]=qs[_0x328f('0x44')](_0x57f477[_0x328f('0x3d')][_0x328f('0x44')]);_0x2d5a5d['where']=qs['filters'](_['pick'](_0x57f477[_0x328f('0x3d')],_0x47a598[_0x328f('0x45')]),_0x3e955c);if(_0x57f477['query'][_0x328f('0x46')]){_0x2d5a5d['where']=_[_0x328f('0x47')](_0x2d5a5d[_0x328f('0x48')],{'$or':_[_0x328f('0x3a')](_0x3e955c,function(_0x34a517){if(_0x34a517[_0x328f('0x49')]!==_0x328f('0x4a')){var _0x38101a={};_0x38101a[_0x34a517[_0x328f('0x37')]]={'$like':'%'+_0x57f477['query'][_0x328f('0x46')]+'%'};return _0x38101a;}})});}_0x2d5a5d=_[_0x328f('0x47')]({},_0x2d5a5d,_0x57f477[_0x328f('0x4b')]);var _0x528a8a={'where':_0x2d5a5d[_0x328f('0x48')]};return db[_0x328f('0x4c')][_0x328f('0x2b')](_0x528a8a)[_0x328f('0x34')](function(_0x46b27f){_0x1b31ab[_0x328f('0x2b')]=_0x46b27f;if(_0x57f477[_0x328f('0x3d')]['includeAll']){_0x2d5a5d['include']=[{'all':!![]}];}return db[_0x328f('0x4c')]['findAll'](_0x2d5a5d);})[_0x328f('0x34')](function(_0x48f134){_0x1b31ab[_0x328f('0x4d')]=_0x48f134;return _0x1b31ab;})[_0x328f('0x34')](respondWithFilteredResult(_0x2662eb,_0x2d5a5d))[_0x328f('0x27')](handleError(_0x2662eb,null));};exports[_0x328f('0x4e')]=function(_0x56aecb,_0x33a067){var _0x51e2c0={'raw':![],'where':{'id':_0x56aecb[_0x328f('0x4f')]['id']}},_0x5a7169={};_0x5a7169[_0x328f('0x3c')]=_[_0x328f('0x50')](db[_0x328f('0x4c')]['rawAttributes']);_0x5a7169[_0x328f('0x3d')]=_[_0x328f('0x50')](_0x56aecb[_0x328f('0x3d')]);_0x5a7169[_0x328f('0x45')]=_[_0x328f('0x3e')](_0x5a7169[_0x328f('0x3c')],_0x5a7169[_0x328f('0x3d')]);_0x51e2c0['attributes']=_['intersection'](_0x5a7169[_0x328f('0x3c')],qs['fields'](_0x56aecb['query']['fields']));_0x51e2c0['attributes']=_0x51e2c0[_0x328f('0x3f')][_0x328f('0x41')]?_0x51e2c0[_0x328f('0x3f')]:_0x5a7169[_0x328f('0x3c')];if(_0x56aecb['query'][_0x328f('0x51')]){_0x51e2c0[_0x328f('0x52')]=[{'all':!![]}];}_0x51e2c0=_[_0x328f('0x47')]({},_0x51e2c0,_0x56aecb['options']);return db['SalesforceConfiguration'][_0x328f('0x53')](_0x51e2c0)['then'](handleEntityNotFound(_0x33a067,null))[_0x328f('0x34')](respondWithResult(_0x33a067,null))[_0x328f('0x27')](handleError(_0x33a067,null));};exports[_0x328f('0x54')]=function(_0x2c8669,_0x2a8bf3){return db[_0x328f('0x4c')][_0x328f('0x54')](_0x2c8669['body'],{})[_0x328f('0x34')](respondWithResult(_0x2a8bf3,0xc9))[_0x328f('0x27')](handleError(_0x2a8bf3,null));};exports[_0x328f('0x33')]=function(_0x3087bd,_0x2526e8){if(_0x3087bd[_0x328f('0x55')]['id']){delete _0x3087bd[_0x328f('0x55')]['id'];}return db[_0x328f('0x4c')]['find']({'where':{'id':_0x3087bd[_0x328f('0x4f')]['id']}})[_0x328f('0x34')](handleEntityNotFound(_0x2526e8,null))['then'](saveUpdates(_0x3087bd[_0x328f('0x55')],null))['then'](respondWithResult(_0x2526e8,null))[_0x328f('0x27')](handleError(_0x2526e8,null));};exports['destroy']=function(_0xe7ce0c,_0x3e9ff9){return db[_0x328f('0x4c')][_0x328f('0x53')]({'where':{'id':_0xe7ce0c[_0x328f('0x4f')]['id']}})[_0x328f('0x34')](handleEntityNotFound(_0x3e9ff9,null))[_0x328f('0x34')](removeEntity(_0x3e9ff9,null))[_0x328f('0x27')](handleError(_0x3e9ff9,null));};exports['getFields']=function(_0x522809,_0x443d94,_0x2ad7bd){var _0x288c6c={};var _0x5bf06={};var _0x1eb23e;var _0x4bf68d;return db[_0x328f('0x4c')][_0x328f('0x56')]({'where':{'id':_0x522809[_0x328f('0x4f')]['id']}})[_0x328f('0x34')](handleEntityNotFound(_0x443d94,null))[_0x328f('0x34')](function(_0x19d454){if(_0x19d454){_0x1eb23e=_0x19d454;_0x5bf06[_0x328f('0x3c')]=_[_0x328f('0x50')](db[_0x328f('0x57')][_0x328f('0x3b')]);_0x5bf06[_0x328f('0x3d')]=_[_0x328f('0x50')](_0x522809[_0x328f('0x3d')]);_0x5bf06[_0x328f('0x45')]=_[_0x328f('0x3e')](_0x5bf06[_0x328f('0x3c')],_0x5bf06[_0x328f('0x3d')]);_0x288c6c[_0x328f('0x3f')]=_['intersection'](_0x5bf06['model'],qs[_0x328f('0x40')](_0x522809[_0x328f('0x3d')][_0x328f('0x40')]));_0x288c6c[_0x328f('0x3f')]=_0x288c6c[_0x328f('0x3f')][_0x328f('0x41')]?_0x288c6c[_0x328f('0x3f')]:_0x5bf06[_0x328f('0x3c')];_0x288c6c['order']=qs[_0x328f('0x44')](_0x522809[_0x328f('0x3d')][_0x328f('0x44')]);_0x288c6c[_0x328f('0x48')]=qs[_0x328f('0x45')](_[_0x328f('0x58')](_0x522809[_0x328f('0x3d')],_0x5bf06[_0x328f('0x45')]));if(_0x522809[_0x328f('0x3d')][_0x328f('0x46')]){_0x288c6c['where']=_['merge'](_0x288c6c[_0x328f('0x48')],{'$or':_[_0x328f('0x3a')](_0x288c6c[_0x328f('0x3f')],function(_0x5a8e86){var _0x13debc={};_0x13debc[_0x5a8e86]={'$like':'%'+_0x522809[_0x328f('0x3d')][_0x328f('0x46')]+'%'};return _0x13debc;})});}_0x288c6c=_[_0x328f('0x47')]({},_0x288c6c,_0x522809[_0x328f('0x4b')]);return _0x1eb23e[_0x328f('0x59')](_0x288c6c);}})[_0x328f('0x34')](function(_0x43ddf5){if(_0x43ddf5){_0x4bf68d=_0x43ddf5[_0x328f('0x41')];if(!_0x522809['query']['hasOwnProperty'](_0x328f('0x42'))){_0x288c6c[_0x328f('0x2d')]=qs[_0x328f('0x2d')](_0x522809[_0x328f('0x3d')][_0x328f('0x2d')]);_0x288c6c[_0x328f('0x2c')]=qs['offset'](_0x522809['query']['offset']);}return _0x1eb23e[_0x328f('0x59')](_0x288c6c);}})['then'](function(_0x247b38){if(_0x247b38){return _0x247b38?{'count':_0x4bf68d,'rows':_0x247b38}:null;}})[_0x328f('0x34')](respondWithResult(_0x443d94,null))['catch'](handleError(_0x443d94,null));};exports[_0x328f('0x5a')]=function(_0x396513,_0xb5785f,_0x1f142d){var _0x23f00f={};var _0x3fbe34={};var _0x360e34;var _0x55f5b3;return db[_0x328f('0x4c')][_0x328f('0x56')]({'where':{'id':_0x396513['params']['id']}})[_0x328f('0x34')](handleEntityNotFound(_0xb5785f,null))[_0x328f('0x34')](function(_0x3ac5c8){if(_0x3ac5c8){_0x360e34=_0x3ac5c8;_0x3fbe34['model']=_[_0x328f('0x50')](db[_0x328f('0x57')][_0x328f('0x3b')]);_0x3fbe34[_0x328f('0x3d')]=_[_0x328f('0x50')](_0x396513[_0x328f('0x3d')]);_0x3fbe34[_0x328f('0x45')]=_[_0x328f('0x3e')](_0x3fbe34['model'],_0x3fbe34[_0x328f('0x3d')]);_0x23f00f['attributes']=_[_0x328f('0x3e')](_0x3fbe34[_0x328f('0x3c')],qs[_0x328f('0x40')](_0x396513[_0x328f('0x3d')][_0x328f('0x40')]));_0x23f00f['attributes']=_0x23f00f['attributes'][_0x328f('0x41')]?_0x23f00f[_0x328f('0x3f')]:_0x3fbe34[_0x328f('0x3c')];_0x23f00f[_0x328f('0x43')]=qs[_0x328f('0x44')](_0x396513[_0x328f('0x3d')]['sort']);_0x23f00f[_0x328f('0x48')]=qs['filters'](_[_0x328f('0x58')](_0x396513['query'],_0x3fbe34[_0x328f('0x45')]));if(_0x396513['query'][_0x328f('0x46')]){_0x23f00f[_0x328f('0x48')]=_[_0x328f('0x47')](_0x23f00f['where'],{'$or':_[_0x328f('0x3a')](_0x23f00f[_0x328f('0x3f')],function(_0x33d4bd){var _0x52e6a6={};_0x52e6a6[_0x33d4bd]={'$like':'%'+_0x396513['query'][_0x328f('0x46')]+'%'};return _0x52e6a6;})});}_0x23f00f=_['merge']({},_0x23f00f,_0x396513[_0x328f('0x4b')]);return _0x360e34[_0x328f('0x5a')](_0x23f00f);}})[_0x328f('0x34')](function(_0x5c0c21){if(_0x5c0c21){_0x55f5b3=_0x5c0c21['length'];if(!_0x396513['query'][_0x328f('0x5b')](_0x328f('0x42'))){_0x23f00f[_0x328f('0x2d')]=qs[_0x328f('0x2d')](_0x396513[_0x328f('0x3d')]['limit']);_0x23f00f[_0x328f('0x2c')]=qs[_0x328f('0x2c')](_0x396513[_0x328f('0x3d')]['offset']);}return _0x360e34['getSubjects'](_0x23f00f);}})['then'](function(_0x25d43d){if(_0x25d43d){return _0x25d43d?{'count':_0x55f5b3,'rows':_0x25d43d}:null;}})[_0x328f('0x34')](respondWithResult(_0xb5785f,null))[_0x328f('0x27')](handleError(_0xb5785f,null));};exports[_0x328f('0x5c')]=function(_0x389613,_0x4d8ac3,_0x46506d){var _0x45c074={};var _0x5ad67c={};var _0x49e0b5;var _0x4fb4a5;return db[_0x328f('0x4c')]['findOne']({'where':{'id':_0x389613[_0x328f('0x4f')]['id']}})[_0x328f('0x34')](handleEntityNotFound(_0x4d8ac3,null))['then'](function(_0x4a79ab){if(_0x4a79ab){_0x49e0b5=_0x4a79ab;_0x5ad67c['model']=_[_0x328f('0x50')](db[_0x328f('0x57')][_0x328f('0x3b')]);_0x5ad67c[_0x328f('0x3d')]=_[_0x328f('0x50')](_0x389613[_0x328f('0x3d')]);_0x5ad67c['filters']=_[_0x328f('0x3e')](_0x5ad67c[_0x328f('0x3c')],_0x5ad67c['query']);_0x45c074[_0x328f('0x3f')]=_[_0x328f('0x3e')](_0x5ad67c[_0x328f('0x3c')],qs['fields'](_0x389613[_0x328f('0x3d')][_0x328f('0x40')]));_0x45c074[_0x328f('0x3f')]=_0x45c074[_0x328f('0x3f')][_0x328f('0x41')]?_0x45c074[_0x328f('0x3f')]:_0x5ad67c[_0x328f('0x3c')];_0x45c074['order']=qs[_0x328f('0x44')](_0x389613[_0x328f('0x3d')][_0x328f('0x44')]);_0x45c074[_0x328f('0x48')]=qs[_0x328f('0x45')](_[_0x328f('0x58')](_0x389613[_0x328f('0x3d')],_0x5ad67c[_0x328f('0x45')]));if(_0x389613[_0x328f('0x3d')][_0x328f('0x46')]){_0x45c074[_0x328f('0x48')]=_[_0x328f('0x47')](_0x45c074['where'],{'$or':_[_0x328f('0x3a')](_0x45c074[_0x328f('0x3f')],function(_0x14de95){var _0x3b7982={};_0x3b7982[_0x14de95]={'$like':'%'+_0x389613['query'][_0x328f('0x46')]+'%'};return _0x3b7982;})});}_0x45c074=_[_0x328f('0x47')]({},_0x45c074,_0x389613['options']);return _0x49e0b5['getDescriptions'](_0x45c074);}})[_0x328f('0x34')](function(_0x154dcf){if(_0x154dcf){_0x4fb4a5=_0x154dcf[_0x328f('0x41')];if(!_0x389613[_0x328f('0x3d')]['hasOwnProperty'](_0x328f('0x42'))){_0x45c074[_0x328f('0x2d')]=qs[_0x328f('0x2d')](_0x389613[_0x328f('0x3d')][_0x328f('0x2d')]);_0x45c074['offset']=qs['offset'](_0x389613[_0x328f('0x3d')]['offset']);}return _0x49e0b5['getDescriptions'](_0x45c074);}})['then'](function(_0x30ce3e){if(_0x30ce3e){return _0x30ce3e?{'count':_0x4fb4a5,'rows':_0x30ce3e}:null;}})[_0x328f('0x34')](respondWithResult(_0x4d8ac3,null))[_0x328f('0x27')](handleError(_0x4d8ac3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 1d0eeea..ee4f647 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 _0x9ad6=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9ad6,0xeb));var _0x69ad=function(_0x5a33f4,_0x8901f3){_0x5a33f4=_0x5a33f4-0x0;var _0x40c80a=_0x9ad6[_0x5a33f4];return _0x40c80a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x69ad('0x0'))('api');var moment=require(_0x69ad('0x1'));var BPromise=require(_0x69ad('0x2'));var rp=require(_0x69ad('0x3'));var fs=require('fs');var path=require(_0x69ad('0x4'));var rimraf=require(_0x69ad('0x5'));var config=require(_0x69ad('0x6'));var attributes=require(_0x69ad('0x7'));module[_0x69ad('0x8')]=function(_0x3296dc,_0x5854aa){return _0x3296dc[_0x69ad('0x9')](_0x69ad('0xa'),attributes,{'tableName':_0x69ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc376=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceConfiguration.attributes','int_salesforce_configurations'];(function(_0x199575,_0x2a864c){var _0x450415=function(_0x2c40c6){while(--_0x2c40c6){_0x199575['push'](_0x199575['shift']());}};_0x450415(++_0x2a864c);}(_0xc376,0x13b));var _0x6c37=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0xc376[_0x35d4e9];return _0x5c2770;};'use strict';var _=require('lodash');var util=require(_0x6c37('0x0'));var logger=require(_0x6c37('0x1'))(_0x6c37('0x2'));var moment=require(_0x6c37('0x3'));var BPromise=require(_0x6c37('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c37('0x5'));var rimraf=require(_0x6c37('0x6'));var config=require('../../config/environment');var attributes=require(_0x6c37('0x7'));module['exports']=function(_0x1beccf,_0x5ae46f){return _0x1beccf['define']('SalesforceConfiguration',attributes,{'tableName':_0x6c37('0x8'),'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 e09a7d9..ee02c1e 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 _0x78cf=['rpc','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0x78cf,0x133));var _0xf78c=function(_0x31cabf,_0x4fe9a2){_0x31cabf=_0x31cabf-0x0;var _0x276b7f=_0x78cf[_0x31cabf];return _0x276b7f;};'use strict';var _=require(_0xf78c('0x0'));var util=require(_0xf78c('0x1'));var moment=require(_0xf78c('0x2'));var BPromise=require(_0xf78c('0x3'));var rs=require(_0xf78c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf78c('0x5'))['db'];var utils=require(_0xf78c('0x6'));var logger=require(_0xf78c('0x7'))(_0xf78c('0x8'));var config=require('../../config/environment');var jayson=require(_0xf78c('0x9'));var client=jayson[_0xf78c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d9895,_0x4c9292,_0x498692){return new BPromise(function(_0x3d6540,_0x1065f5){return client[_0xf78c('0xb')](_0x9d9895,_0x498692)[_0xf78c('0xc')](function(_0x794f61){logger[_0xf78c('0xd')](_0xf78c('0xe'),_0x4c9292,_0xf78c('0xf'));logger[_0xf78c('0x10')](_0xf78c('0x11'),_0x4c9292,_0xf78c('0xf'),JSON[_0xf78c('0x12')](_0x794f61));if(_0x794f61['error']){if(_0x794f61[_0xf78c('0x13')]['code']===0x1f4){logger[_0xf78c('0x13')](_0xf78c('0xe'),_0x4c9292,_0x794f61[_0xf78c('0x13')][_0xf78c('0x14')]);return _0x1065f5(_0x794f61['error'][_0xf78c('0x14')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4c9292,_0x794f61[_0xf78c('0x13')]['message']);return _0x3d6540(_0x794f61['error'][_0xf78c('0x14')]);}else{logger[_0xf78c('0xd')](_0xf78c('0xe'),_0x4c9292,'request\x20sent');_0x3d6540(_0x794f61['result'][_0xf78c('0x14')]);}})['catch'](function(_0x367ab1){logger[_0xf78c('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4c9292,_0x367ab1);_0x1065f5(_0x367ab1);});});} \ No newline at end of file +var _0x448c=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x56a3ee,_0x436f7d){var _0x35cb2e=function(_0x5a7213){while(--_0x5a7213){_0x56a3ee['push'](_0x56a3ee['shift']());}};_0x35cb2e(++_0x436f7d);}(_0x448c,0xba));var _0xc448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x448c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc448('0x0'));var util=require(_0xc448('0x1'));var moment=require(_0xc448('0x2'));var BPromise=require('bluebird');var rs=require(_0xc448('0x3'));var fs=require('fs');var Redis=require(_0xc448('0x4'));var db=require(_0xc448('0x5'))['db'];var utils=require(_0xc448('0x6'));var logger=require(_0xc448('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc448('0x8'));var client=jayson[_0xc448('0x9')][_0xc448('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c5756,_0x3f7a9b,_0x4ba298){return new BPromise(function(_0x500888,_0x246b64){return client[_0xc448('0xb')](_0x1c5756,_0x4ba298)[_0xc448('0xc')](function(_0x55ee20){logger[_0xc448('0xd')](_0xc448('0xe'),_0x3f7a9b,'request\x20sent');logger[_0xc448('0xf')](_0xc448('0x10'),_0x3f7a9b,_0xc448('0x11'),JSON[_0xc448('0x12')](_0x55ee20));if(_0x55ee20['error']){if(_0x55ee20[_0xc448('0x13')]['code']===0x1f4){logger[_0xc448('0x13')](_0xc448('0xe'),_0x3f7a9b,_0x55ee20[_0xc448('0x13')][_0xc448('0x14')]);return _0x246b64(_0x55ee20[_0xc448('0x13')][_0xc448('0x14')]);}logger[_0xc448('0x13')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3f7a9b,_0x55ee20[_0xc448('0x13')][_0xc448('0x14')]);return _0x500888(_0x55ee20[_0xc448('0x13')][_0xc448('0x14')]);}else{logger[_0xc448('0xd')](_0xc448('0xe'),_0x3f7a9b,_0xc448('0x11'));_0x500888(_0x55ee20[_0xc448('0x15')][_0xc448('0x14')]);}})[_0xc448('0x16')](function(_0x5092a6){logger[_0xc448('0x13')](_0xc448('0xe'),_0x3f7a9b,_0x5092a6);_0x246b64(_0x5092a6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 9542c47..80db4df 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 _0x4fb4=['update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x467146,_0xaac92e){var _0xf344e7=function(_0x4af1b5){while(--_0x4af1b5){_0x467146['push'](_0x467146['shift']());}};_0xf344e7(++_0xaac92e);}(_0x4fb4,0x190));var _0x44fb=function(_0x1892fa,_0x5abd92){_0x1892fa=_0x1892fa-0x0;var _0x353d90=_0x4fb4[_0x1892fa];return _0x353d90;};'use strict';var multer=require('multer');var util=require(_0x44fb('0x0'));var path=require(_0x44fb('0x1'));var timeout=require(_0x44fb('0x2'));var express=require(_0x44fb('0x3'));var router=express[_0x44fb('0x4')]();var auth=require(_0x44fb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x44fb('0x6'));var controller=require(_0x44fb('0x7'));router[_0x44fb('0x8')]('/',auth[_0x44fb('0x9')](),controller[_0x44fb('0xa')]);router[_0x44fb('0x8')](_0x44fb('0xb'),auth[_0x44fb('0x9')](),controller['show']);router[_0x44fb('0xc')]('/',auth[_0x44fb('0x9')](),controller['create']);router[_0x44fb('0xd')](_0x44fb('0xb'),auth[_0x44fb('0x9')](),controller[_0x44fb('0xe')]);router[_0x44fb('0xf')](_0x44fb('0xb'),auth[_0x44fb('0x9')](),controller[_0x44fb('0x10')]);module[_0x44fb('0x11')]=router; \ No newline at end of file +var _0xc6ac=['show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x32156e,_0x3eac0f){_0x32156e=_0x32156e-0x0;var _0x313781=_0xc6ac[_0x32156e];return _0x313781;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')]('/',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xc')]);router[_0xcc6a('0xa')]('/:id',auth[_0xcc6a('0xb')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')]('/',auth['isAuthenticated'](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x12')]);router['delete'](_0xcc6a('0x11'),auth[_0xcc6a('0xb')](),controller[_0xcc6a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index d6d97c2..041476f 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 _0xf08a=['keyValue','STRING','sequelize','ENUM','string','variable','customVariable'];(function(_0x2f227c,_0x360c3a){var _0x5032bc=function(_0x824bb){while(--_0x824bb){_0x2f227c['push'](_0x2f227c['shift']());}};_0x5032bc(++_0x360c3a);}(_0xf08a,0x1e5));var _0xaf08=function(_0x22f1c3,_0x58d77c){_0x22f1c3=_0x22f1c3-0x0;var _0xd14b71=_0xf08a[_0x22f1c3];return _0xd14b71;};'use strict';var Sequelize=require(_0xaf08('0x0'));module['exports']={'type':{'type':Sequelize[_0xaf08('0x1')](_0xaf08('0x2'),_0xaf08('0x3'),_0xaf08('0x4'),_0xaf08('0x5')),'defaultValue':_0xaf08('0x2')},'content':{'type':Sequelize[_0xaf08('0x6')]},'key':{'type':Sequelize[_0xaf08('0x6')]},'keyType':{'type':Sequelize[_0xaf08('0x1')](_0xaf08('0x2'),'variable',_0xaf08('0x4'))},'keyContent':{'type':Sequelize[_0xaf08('0x6')]},'idField':{'type':Sequelize[_0xaf08('0x6')]},'variableName':{'type':Sequelize[_0xaf08('0x6')]}}; \ No newline at end of file +var _0x6d53=['sequelize','exports','ENUM','variable','keyValue','string','customVariable','STRING'];(function(_0x36eea2,_0x463488){var _0x187729=function(_0x558db7){while(--_0x558db7){_0x36eea2['push'](_0x36eea2['shift']());}};_0x187729(++_0x463488);}(_0x6d53,0x1e0));var _0x36d5=function(_0x3bcf75,_0x2280ce){_0x3bcf75=_0x3bcf75-0x0;var _0x41556b=_0x6d53[_0x3bcf75];return _0x41556b;};'use strict';var Sequelize=require(_0x36d5('0x0'));module[_0x36d5('0x1')]={'type':{'type':Sequelize[_0x36d5('0x2')]('string',_0x36d5('0x3'),'customVariable',_0x36d5('0x4')),'defaultValue':_0x36d5('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x36d5('0x2')](_0x36d5('0x5'),'variable',_0x36d5('0x6'))},'keyContent':{'type':Sequelize[_0x36d5('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index d06f11e..f76889c 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 _0x29fd=['create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','map','SalesforceField','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find'];(function(_0x3bff77,_0x386745){var _0x1874a6=function(_0x2c58c8){while(--_0x2c58c8){_0x3bff77['push'](_0x3bff77['shift']());}};_0x1874a6(++_0x386745);}(_0x29fd,0x1ca));var _0xd29f=function(_0x51f0d0,_0x379f7c){_0x51f0d0=_0x51f0d0-0x0;var _0x47f60e=_0x29fd[_0x51f0d0];return _0x47f60e;};'use strict';var pdf=require(_0xd29f('0x0'));var emlformat=require(_0xd29f('0x1'));var rimraf=require(_0xd29f('0x2'));var zipdir=require(_0xd29f('0x3'));var jsonpatch=require(_0xd29f('0x4'));var rp=require(_0xd29f('0x5'));var moment=require('moment');var BPromise=require(_0xd29f('0x6'));var Mustache=require('mustache');var util=require(_0xd29f('0x7'));var path=require(_0xd29f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd29f('0x9'));var fs=require('fs');var _=require(_0xd29f('0xa'));var squel=require(_0xd29f('0xb'));var crypto=require(_0xd29f('0xc'));var jsforce=require(_0xd29f('0xd'));var deskjs=require(_0xd29f('0xe'));var toCsv=require(_0xd29f('0xf'));var querystring=require(_0xd29f('0x10'));var Papa=require(_0xd29f('0x11'));var Redis=require(_0xd29f('0x12'));var authService=require(_0xd29f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd29f('0x14'));var hardwareService=require(_0xd29f('0x15'));var logger=require(_0xd29f('0x16'))(_0xd29f('0x17'));var utils=require(_0xd29f('0x18'));var config=require(_0xd29f('0x19'));var licenseUtil=require(_0xd29f('0x1a'));var db=require(_0xd29f('0x1b'))['db'];function respondWithStatusCode(_0x3a8d25,_0x237c32){_0x237c32=_0x237c32||0xcc;return function(_0x1b61ae){if(_0x1b61ae){return _0x3a8d25[_0xd29f('0x1c')](_0x237c32);}return _0x3a8d25[_0xd29f('0x1d')](_0x237c32)[_0xd29f('0x1e')]();};}function respondWithResult(_0x111a2c,_0x1cd886){_0x1cd886=_0x1cd886||0xc8;return function(_0x5d7434){if(_0x5d7434){return _0x111a2c[_0xd29f('0x1d')](_0x1cd886)[_0xd29f('0x1f')](_0x5d7434);}};}function respondWithFilteredResult(_0xa1e532,_0x39178a){return function(_0x15c245){if(_0x15c245){var _0x53dbf8=_0x15c245[_0xd29f('0x20')],_0x5c6134=_0x39178a[_0xd29f('0x21')],_0x29052b=_0x39178a[_0xd29f('0x21')]+_0x39178a[_0xd29f('0x22')],_0x5571f5;if(_0x29052b>=_0x53dbf8){_0x29052b=_0x53dbf8;_0x5571f5=0xc8;}else{_0x5571f5=0xce;}_0xa1e532[_0xd29f('0x1d')](_0x5571f5);return _0xa1e532[_0xd29f('0x23')]('Content-Range',_0x5c6134+'-'+_0x29052b+'/'+_0x53dbf8)[_0xd29f('0x1f')](_0x15c245);}return null;};}function patchUpdates(_0xc5c29d){return function(_0x2e72f1){try{jsonpatch[_0xd29f('0x24')](_0x2e72f1,_0xc5c29d,!![]);}catch(_0x2f2ba4){return BPromise[_0xd29f('0x25')](_0x2f2ba4);}return _0x2e72f1[_0xd29f('0x26')]();};}function saveUpdates(_0x50ce9c,_0xe49d62){return function(_0x5ea33a){if(_0x5ea33a){return _0x5ea33a[_0xd29f('0x27')](_0x50ce9c)[_0xd29f('0x28')](function(_0x30d9f9){return _0x30d9f9;});}return null;};}function removeEntity(_0x1f4131,_0x1c8a1e){return function(_0x3df97f){if(_0x3df97f){return _0x3df97f[_0xd29f('0x29')]()['then'](function(){_0x1f4131[_0xd29f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5308fa,_0x271f85){return function(_0x4352f5){if(!_0x4352f5){_0x5308fa[_0xd29f('0x1c')](0x194);}return _0x4352f5;};}function handleError(_0xaa10c6,_0x56b5b8){_0x56b5b8=_0x56b5b8||0x1f4;return function(_0x5bfa12){logger['error'](_0x5bfa12[_0xd29f('0x2a')]);if(_0x5bfa12[_0xd29f('0x2b')]){delete _0x5bfa12[_0xd29f('0x2b')];}_0xaa10c6[_0xd29f('0x1d')](_0x56b5b8)[_0xd29f('0x2c')](_0x5bfa12);};}exports['index']=function(_0x3ba6a7,_0x2b3dba){var _0x122cf5={},_0x10b5ed={},_0x354db4={'count':0x0,'rows':[]};var _0x5a3e1e=_[_0xd29f('0x2d')](db[_0xd29f('0x2e')]['rawAttributes'],function(_0x16a48d){return{'name':_0x16a48d[_0xd29f('0x2f')],'type':_0x16a48d[_0xd29f('0x30')][_0xd29f('0x31')]};});_0x10b5ed[_0xd29f('0x32')]=_[_0xd29f('0x2d')](_0x5a3e1e,_0xd29f('0x2b'));_0x10b5ed[_0xd29f('0x33')]=_['keys'](_0x3ba6a7[_0xd29f('0x33')]);_0x10b5ed[_0xd29f('0x34')]=_[_0xd29f('0x35')](_0x10b5ed['model'],_0x10b5ed[_0xd29f('0x33')]);_0x122cf5[_0xd29f('0x36')]=_[_0xd29f('0x35')](_0x10b5ed[_0xd29f('0x32')],qs[_0xd29f('0x37')](_0x3ba6a7['query'][_0xd29f('0x37')]));_0x122cf5['attributes']=_0x122cf5[_0xd29f('0x36')][_0xd29f('0x38')]?_0x122cf5[_0xd29f('0x36')]:_0x10b5ed[_0xd29f('0x32')];if(!_0x3ba6a7[_0xd29f('0x33')][_0xd29f('0x39')](_0xd29f('0x3a'))){_0x122cf5[_0xd29f('0x22')]=qs[_0xd29f('0x22')](_0x3ba6a7[_0xd29f('0x33')][_0xd29f('0x22')]);_0x122cf5[_0xd29f('0x21')]=qs[_0xd29f('0x21')](_0x3ba6a7[_0xd29f('0x33')][_0xd29f('0x21')]);}_0x122cf5['order']=qs['sort'](_0x3ba6a7[_0xd29f('0x33')][_0xd29f('0x3b')]);_0x122cf5['where']=qs['filters'](_['pick'](_0x3ba6a7[_0xd29f('0x33')],_0x10b5ed[_0xd29f('0x34')]),_0x5a3e1e);if(_0x3ba6a7[_0xd29f('0x33')][_0xd29f('0x3c')]){_0x122cf5[_0xd29f('0x3d')]=_[_0xd29f('0x3e')](_0x122cf5['where'],{'$or':_[_0xd29f('0x2d')](_0x5a3e1e,function(_0x2da41b){if(_0x2da41b[_0xd29f('0x30')]!=='VIRTUAL'){var _0x3f481f={};_0x3f481f[_0x2da41b['name']]={'$like':'%'+_0x3ba6a7[_0xd29f('0x33')]['filter']+'%'};return _0x3f481f;}})});}_0x122cf5=_[_0xd29f('0x3e')]({},_0x122cf5,_0x3ba6a7[_0xd29f('0x3f')]);var _0x58f2bc={'where':_0x122cf5['where']};return db[_0xd29f('0x2e')]['count'](_0x58f2bc)['then'](function(_0x47baf6){_0x354db4[_0xd29f('0x20')]=_0x47baf6;if(_0x3ba6a7[_0xd29f('0x33')][_0xd29f('0x40')]){_0x122cf5[_0xd29f('0x41')]=[{'all':!![]}];}return db[_0xd29f('0x2e')][_0xd29f('0x42')](_0x122cf5);})[_0xd29f('0x28')](function(_0x397c8d){_0x354db4[_0xd29f('0x43')]=_0x397c8d;return _0x354db4;})[_0xd29f('0x28')](respondWithFilteredResult(_0x2b3dba,_0x122cf5))[_0xd29f('0x44')](handleError(_0x2b3dba,null));};exports[_0xd29f('0x45')]=function(_0x2f065f,_0x1847f2){var _0x638a77={'raw':!![],'where':{'id':_0x2f065f[_0xd29f('0x46')]['id']}},_0x55633a={};_0x55633a[_0xd29f('0x32')]=_[_0xd29f('0x47')](db[_0xd29f('0x2e')][_0xd29f('0x48')]);_0x55633a[_0xd29f('0x33')]=_[_0xd29f('0x47')](_0x2f065f['query']);_0x55633a[_0xd29f('0x34')]=_[_0xd29f('0x35')](_0x55633a[_0xd29f('0x32')],_0x55633a[_0xd29f('0x33')]);_0x638a77[_0xd29f('0x36')]=_[_0xd29f('0x35')](_0x55633a[_0xd29f('0x32')],qs[_0xd29f('0x37')](_0x2f065f[_0xd29f('0x33')]['fields']));_0x638a77[_0xd29f('0x36')]=_0x638a77[_0xd29f('0x36')][_0xd29f('0x38')]?_0x638a77[_0xd29f('0x36')]:_0x55633a['model'];if(_0x2f065f[_0xd29f('0x33')][_0xd29f('0x40')]){_0x638a77[_0xd29f('0x41')]=[{'all':!![]}];}_0x638a77=_[_0xd29f('0x3e')]({},_0x638a77,_0x2f065f[_0xd29f('0x3f')]);return db[_0xd29f('0x2e')][_0xd29f('0x49')](_0x638a77)[_0xd29f('0x28')](handleEntityNotFound(_0x1847f2,null))[_0xd29f('0x28')](respondWithResult(_0x1847f2,null))['catch'](handleError(_0x1847f2,null));};exports[_0xd29f('0x4a')]=function(_0x44b1f1,_0x1df81d){return db['SalesforceField'][_0xd29f('0x4a')](_0x44b1f1[_0xd29f('0x4b')],{})['then'](respondWithResult(_0x1df81d,0xc9))[_0xd29f('0x44')](handleError(_0x1df81d,null));};exports[_0xd29f('0x27')]=function(_0x379942,_0x1ec786){if(_0x379942[_0xd29f('0x4b')]['id']){delete _0x379942[_0xd29f('0x4b')]['id'];}return db[_0xd29f('0x2e')]['find']({'where':{'id':_0x379942[_0xd29f('0x46')]['id']}})[_0xd29f('0x28')](handleEntityNotFound(_0x1ec786,null))['then'](saveUpdates(_0x379942[_0xd29f('0x4b')],null))[_0xd29f('0x28')](respondWithResult(_0x1ec786,null))[_0xd29f('0x44')](handleError(_0x1ec786,null));};exports[_0xd29f('0x29')]=function(_0x22f635,_0x4834c1){return db[_0xd29f('0x2e')][_0xd29f('0x49')]({'where':{'id':_0x22f635[_0xd29f('0x46')]['id']}})[_0xd29f('0x28')](handleEntityNotFound(_0x4834c1,null))[_0xd29f('0x28')](removeEntity(_0x4834c1,null))['catch'](handleError(_0x4834c1,null));}; \ No newline at end of file +var _0x0aec=['show','params','intersection','find','create','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','error','stack','name','index','map','SalesforceField','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','then','catch'];(function(_0xb45f7c,_0x572595){var _0x49bb5f=function(_0x545ce1){while(--_0x545ce1){_0xb45f7c['push'](_0xb45f7c['shift']());}};_0x49bb5f(++_0x572595);}(_0x0aec,0xdc));var _0xc0ae=function(_0x4ba8c3,_0x33c457){_0x4ba8c3=_0x4ba8c3-0x0;var _0xf65364=_0x0aec[_0x4ba8c3];return _0xf65364;};'use strict';var pdf=require(_0xc0ae('0x0'));var emlformat=require(_0xc0ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc0ae('0x2'));var jsonpatch=require(_0xc0ae('0x3'));var rp=require(_0xc0ae('0x4'));var moment=require(_0xc0ae('0x5'));var BPromise=require(_0xc0ae('0x6'));var Mustache=require(_0xc0ae('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc0ae('0x8'));var ejs=require(_0xc0ae('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc0ae('0xa'));var crypto=require('crypto');var jsforce=require(_0xc0ae('0xb'));var deskjs=require(_0xc0ae('0xc'));var toCsv=require(_0xc0ae('0x8'));var querystring=require(_0xc0ae('0xd'));var Papa=require(_0xc0ae('0xe'));var Redis=require(_0xc0ae('0xf'));var authService=require(_0xc0ae('0x10'));var qs=require(_0xc0ae('0x11'));var as=require(_0xc0ae('0x12'));var hardwareService=require(_0xc0ae('0x13'));var logger=require(_0xc0ae('0x14'))('api');var utils=require(_0xc0ae('0x15'));var config=require(_0xc0ae('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0ae('0x17'))['db'];function respondWithStatusCode(_0x127879,_0x33ae87){_0x33ae87=_0x33ae87||0xcc;return function(_0x397f89){if(_0x397f89){return _0x127879[_0xc0ae('0x18')](_0x33ae87);}return _0x127879['status'](_0x33ae87)['end']();};}function respondWithResult(_0xfd25a0,_0x55fa31){_0x55fa31=_0x55fa31||0xc8;return function(_0x13063b){if(_0x13063b){return _0xfd25a0['status'](_0x55fa31)[_0xc0ae('0x19')](_0x13063b);}};}function respondWithFilteredResult(_0x7f6124,_0x1fb04d){return function(_0x46152d){if(_0x46152d){var _0xa72b7c=_0x46152d[_0xc0ae('0x1a')],_0x48ed46=_0x1fb04d[_0xc0ae('0x1b')],_0x40b941=_0x1fb04d[_0xc0ae('0x1b')]+_0x1fb04d[_0xc0ae('0x1c')],_0x5b2261;if(_0x40b941>=_0xa72b7c){_0x40b941=_0xa72b7c;_0x5b2261=0xc8;}else{_0x5b2261=0xce;}_0x7f6124[_0xc0ae('0x1d')](_0x5b2261);return _0x7f6124[_0xc0ae('0x1e')](_0xc0ae('0x1f'),_0x48ed46+'-'+_0x40b941+'/'+_0xa72b7c)[_0xc0ae('0x19')](_0x46152d);}return null;};}function patchUpdates(_0x311bbc){return function(_0x115859){try{jsonpatch[_0xc0ae('0x20')](_0x115859,_0x311bbc,!![]);}catch(_0x2c46a6){return BPromise[_0xc0ae('0x21')](_0x2c46a6);}return _0x115859[_0xc0ae('0x22')]();};}function saveUpdates(_0x3e5ac0,_0x2fd4bf){return function(_0x309f9e){if(_0x309f9e){return _0x309f9e[_0xc0ae('0x23')](_0x3e5ac0)['then'](function(_0x3d563a){return _0x3d563a;});}return null;};}function removeEntity(_0x478c82,_0x1bbba5){return function(_0x25c940){if(_0x25c940){return _0x25c940['destroy']()['then'](function(){_0x478c82[_0xc0ae('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b0e7,_0x440e7f){return function(_0x21ed24){if(!_0x21ed24){_0x25b0e7[_0xc0ae('0x18')](0x194);}return _0x21ed24;};}function handleError(_0xd2a941,_0x3170dd){_0x3170dd=_0x3170dd||0x1f4;return function(_0x1e8c58){logger[_0xc0ae('0x24')](_0x1e8c58[_0xc0ae('0x25')]);if(_0x1e8c58[_0xc0ae('0x26')]){delete _0x1e8c58[_0xc0ae('0x26')];}_0xd2a941[_0xc0ae('0x1d')](_0x3170dd)['send'](_0x1e8c58);};}exports[_0xc0ae('0x27')]=function(_0x3b31ea,_0x26e750){var _0x30cf82={},_0x4f91ec={},_0xe23279={'count':0x0,'rows':[]};var _0x5e5080=_[_0xc0ae('0x28')](db[_0xc0ae('0x29')][_0xc0ae('0x2a')],function(_0x11447f){return{'name':_0x11447f['fieldName'],'type':_0x11447f[_0xc0ae('0x2b')][_0xc0ae('0x2c')]};});_0x4f91ec[_0xc0ae('0x2d')]=_['map'](_0x5e5080,_0xc0ae('0x26'));_0x4f91ec[_0xc0ae('0x2e')]=_[_0xc0ae('0x2f')](_0x3b31ea[_0xc0ae('0x2e')]);_0x4f91ec[_0xc0ae('0x30')]=_['intersection'](_0x4f91ec[_0xc0ae('0x2d')],_0x4f91ec['query']);_0x30cf82[_0xc0ae('0x31')]=_['intersection'](_0x4f91ec[_0xc0ae('0x2d')],qs[_0xc0ae('0x32')](_0x3b31ea[_0xc0ae('0x2e')][_0xc0ae('0x32')]));_0x30cf82['attributes']=_0x30cf82[_0xc0ae('0x31')][_0xc0ae('0x33')]?_0x30cf82[_0xc0ae('0x31')]:_0x4f91ec[_0xc0ae('0x2d')];if(!_0x3b31ea[_0xc0ae('0x2e')][_0xc0ae('0x34')]('nolimit')){_0x30cf82['limit']=qs[_0xc0ae('0x1c')](_0x3b31ea[_0xc0ae('0x2e')][_0xc0ae('0x1c')]);_0x30cf82[_0xc0ae('0x1b')]=qs[_0xc0ae('0x1b')](_0x3b31ea['query'][_0xc0ae('0x1b')]);}_0x30cf82[_0xc0ae('0x35')]=qs[_0xc0ae('0x36')](_0x3b31ea[_0xc0ae('0x2e')][_0xc0ae('0x36')]);_0x30cf82['where']=qs[_0xc0ae('0x30')](_[_0xc0ae('0x37')](_0x3b31ea['query'],_0x4f91ec[_0xc0ae('0x30')]),_0x5e5080);if(_0x3b31ea[_0xc0ae('0x2e')][_0xc0ae('0x38')]){_0x30cf82[_0xc0ae('0x39')]=_[_0xc0ae('0x3a')](_0x30cf82['where'],{'$or':_[_0xc0ae('0x28')](_0x5e5080,function(_0x149b9b){if(_0x149b9b['type']!=='VIRTUAL'){var _0x435c39={};_0x435c39[_0x149b9b[_0xc0ae('0x26')]]={'$like':'%'+_0x3b31ea['query'][_0xc0ae('0x38')]+'%'};return _0x435c39;}})});}_0x30cf82=_[_0xc0ae('0x3a')]({},_0x30cf82,_0x3b31ea[_0xc0ae('0x3b')]);var _0x480be0={'where':_0x30cf82[_0xc0ae('0x39')]};return db[_0xc0ae('0x29')][_0xc0ae('0x1a')](_0x480be0)['then'](function(_0x24bc64){_0xe23279[_0xc0ae('0x1a')]=_0x24bc64;if(_0x3b31ea[_0xc0ae('0x2e')][_0xc0ae('0x3c')]){_0x30cf82[_0xc0ae('0x3d')]=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x30cf82);})['then'](function(_0x1eb1c9){_0xe23279['rows']=_0x1eb1c9;return _0xe23279;})[_0xc0ae('0x3e')](respondWithFilteredResult(_0x26e750,_0x30cf82))[_0xc0ae('0x3f')](handleError(_0x26e750,null));};exports[_0xc0ae('0x40')]=function(_0x436f54,_0x231eb9){var _0x207154={'raw':!![],'where':{'id':_0x436f54[_0xc0ae('0x41')]['id']}},_0x41f840={};_0x41f840[_0xc0ae('0x2d')]=_[_0xc0ae('0x2f')](db['SalesforceField'][_0xc0ae('0x2a')]);_0x41f840[_0xc0ae('0x2e')]=_[_0xc0ae('0x2f')](_0x436f54[_0xc0ae('0x2e')]);_0x41f840[_0xc0ae('0x30')]=_[_0xc0ae('0x42')](_0x41f840[_0xc0ae('0x2d')],_0x41f840['query']);_0x207154[_0xc0ae('0x31')]=_[_0xc0ae('0x42')](_0x41f840[_0xc0ae('0x2d')],qs['fields'](_0x436f54['query'][_0xc0ae('0x32')]));_0x207154[_0xc0ae('0x31')]=_0x207154[_0xc0ae('0x31')]['length']?_0x207154[_0xc0ae('0x31')]:_0x41f840[_0xc0ae('0x2d')];if(_0x436f54[_0xc0ae('0x2e')][_0xc0ae('0x3c')]){_0x207154[_0xc0ae('0x3d')]=[{'all':!![]}];}_0x207154=_[_0xc0ae('0x3a')]({},_0x207154,_0x436f54[_0xc0ae('0x3b')]);return db[_0xc0ae('0x29')][_0xc0ae('0x43')](_0x207154)[_0xc0ae('0x3e')](handleEntityNotFound(_0x231eb9,null))[_0xc0ae('0x3e')](respondWithResult(_0x231eb9,null))[_0xc0ae('0x3f')](handleError(_0x231eb9,null));};exports[_0xc0ae('0x44')]=function(_0x4edbb8,_0x1ed658){return db[_0xc0ae('0x29')][_0xc0ae('0x44')](_0x4edbb8['body'],{})[_0xc0ae('0x3e')](respondWithResult(_0x1ed658,0xc9))['catch'](handleError(_0x1ed658,null));};exports[_0xc0ae('0x23')]=function(_0x3bb406,_0x305880){if(_0x3bb406[_0xc0ae('0x45')]['id']){delete _0x3bb406[_0xc0ae('0x45')]['id'];}return db[_0xc0ae('0x29')]['find']({'where':{'id':_0x3bb406[_0xc0ae('0x41')]['id']}})[_0xc0ae('0x3e')](handleEntityNotFound(_0x305880,null))['then'](saveUpdates(_0x3bb406[_0xc0ae('0x45')],null))[_0xc0ae('0x3e')](respondWithResult(_0x305880,null))[_0xc0ae('0x3f')](handleError(_0x305880,null));};exports[_0xc0ae('0x46')]=function(_0x3830e4,_0x169321){return db['SalesforceField'][_0xc0ae('0x43')]({'where':{'id':_0x3830e4[_0xc0ae('0x41')]['id']}})[_0xc0ae('0x3e')](handleEntityNotFound(_0x169321,null))['then'](removeEntity(_0x169321,null))[_0xc0ae('0x3f')](handleError(_0x169321,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 866cc41..552a535 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 _0x4bfd=['int_salesforce_fields','idField','FieldId','lodash','../../config/logger','bluebird','path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField'];(function(_0x5e9393,_0x1abf8d){var _0xf04484=function(_0x5e0a41){while(--_0x5e0a41){_0x5e9393['push'](_0x5e9393['shift']());}};_0xf04484(++_0x1abf8d);}(_0x4bfd,0x153));var _0xd4bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4bfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd4bf('0x0'));var util=require('util');var logger=require(_0xd4bf('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd4bf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4bf('0x3'));var rimraf=require(_0xd4bf('0x4'));var config=require('../../config/environment');var attributes=require(_0xd4bf('0x5'));module[_0xd4bf('0x6')]=function(_0xb6c994,_0x3a77df){return _0xb6c994[_0xd4bf('0x7')](_0xd4bf('0x8'),attributes,{'tableName':_0xd4bf('0x9'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xd4bf('0xa'),_0xd4bf('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x858e=['moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','api'];(function(_0x18b000,_0x513c1b){var _0xfb7686=function(_0x1f2bb9){while(--_0x1f2bb9){_0x18b000['push'](_0x18b000['shift']());}};_0xfb7686(++_0x513c1b);}(_0x858e,0x178));var _0xe858=function(_0x35f4f9,_0x4521fc){_0x35f4f9=_0x35f4f9-0x0;var _0x3d398a=_0x858e[_0x35f4f9];return _0x3d398a;};'use strict';var _=require(_0xe858('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe858('0x1'));var moment=require(_0xe858('0x2'));var BPromise=require(_0xe858('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe858('0x4'));var rimraf=require(_0xe858('0x5'));var config=require(_0xe858('0x6'));var attributes=require(_0xe858('0x7'));module[_0xe858('0x8')]=function(_0x556914,_0x3c507f){return _0x556914[_0xe858('0x9')]('SalesforceField',attributes,{'tableName':_0xe858('0xa'),'paranoid':![],'indexes':[{'name':_0xe858('0xb'),'fields':[_0xe858('0xc'),_0xe858('0xd')],'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 25dd97f..770885e 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 _0x750a=['error','code','SalesforceField,\x20%s,\x20%s','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify'];(function(_0x42fa1f,_0x1abc4b){var _0x1d70e6=function(_0x900ed9){while(--_0x900ed9){_0x42fa1f['push'](_0x42fa1f['shift']());}};_0x1d70e6(++_0x1abc4b);}(_0x750a,0x140));var _0xa750=function(_0x4586fc,_0x5f567e){_0x4586fc=_0x4586fc-0x0;var _0x1b7280=_0x750a[_0x4586fc];return _0x1b7280;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa750('0x1'));var fs=require('fs');var Redis=require(_0xa750('0x2'));var db=require(_0xa750('0x3'))['db'];var utils=require(_0xa750('0x4'));var logger=require(_0xa750('0x5'))(_0xa750('0x6'));var config=require(_0xa750('0x7'));var jayson=require(_0xa750('0x8'));var client=jayson[_0xa750('0x9')][_0xa750('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x197299,_0x1ae455,_0x3d7c43){return new BPromise(function(_0x47a4dd,_0x53f2cb){return client[_0xa750('0xb')](_0x197299,_0x3d7c43)['then'](function(_0x4458b1){logger[_0xa750('0xc')]('SalesforceField,\x20%s,\x20%s',_0x1ae455,_0xa750('0xd'));logger[_0xa750('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1ae455,'request\x20sent',JSON[_0xa750('0xf')](_0x4458b1));if(_0x4458b1['error']){if(_0x4458b1[_0xa750('0x10')][_0xa750('0x11')]===0x1f4){logger['error'](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x53f2cb(_0x4458b1['error'][_0xa750('0x13')]);}logger[_0xa750('0x10')](_0xa750('0x12'),_0x1ae455,_0x4458b1[_0xa750('0x10')][_0xa750('0x13')]);return _0x47a4dd(_0x4458b1[_0xa750('0x10')]['message']);}else{logger[_0xa750('0xc')](_0xa750('0x12'),_0x1ae455,_0xa750('0xd'));_0x47a4dd(_0x4458b1['result'][_0xa750('0x13')]);}})[_0xa750('0x14')](function(_0x58639b){logger['error'](_0xa750('0x12'),_0x1ae455,_0x58639b);_0x53f2cb(_0x58639b);});});} \ No newline at end of file +var _0x5c00=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x5c00,0x17e));var _0x05c0=function(_0x54613d,_0x4b8872){_0x54613d=_0x54613d-0x0;var _0x11c35b=_0x5c00[_0x54613d];return _0x11c35b;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var moment=require(_0x05c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x05c0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05c0('0x4'))['db'];var utils=require(_0x05c0('0x5'));var logger=require(_0x05c0('0x6'))(_0x05c0('0x7'));var config=require('../../config/environment');var jayson=require(_0x05c0('0x8'));var client=jayson[_0x05c0('0x9')][_0x05c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27dc10,_0x5b9f09,_0x3a3b1b){return new BPromise(function(_0x34eb5f,_0x3ad5b7){return client['request'](_0x27dc10,_0x3a3b1b)[_0x05c0('0xb')](function(_0x32cdfa){logger[_0x05c0('0xc')](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));logger[_0x05c0('0xf')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x5b9f09,'request\x20sent',JSON[_0x05c0('0x10')](_0x32cdfa));if(_0x32cdfa['error']){if(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x12')]===0x1f4){logger[_0x05c0('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5b9f09,_0x32cdfa[_0x05c0('0x11')]['message']);return _0x3ad5b7(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);return _0x34eb5f(_0x32cdfa[_0x05c0('0x11')][_0x05c0('0x13')]);}else{logger['info'](_0x05c0('0xd'),_0x5b9f09,_0x05c0('0xe'));_0x34eb5f(_0x32cdfa[_0x05c0('0x14')][_0x05c0('0x13')]);}})[_0x05c0('0x15')](function(_0x40153e){logger[_0x05c0('0x11')](_0x05c0('0xd'),_0x5b9f09,_0x40153e);_0x3ad5b7(_0x40153e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3ea4540..877751d 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 _0xf698=['../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x399c09,_0x367884){var _0x2b4826=function(_0x1712ff){while(--_0x1712ff){_0x399c09['push'](_0x399c09['shift']());}};_0x2b4826(++_0x367884);}(_0xf698,0x1de));var _0x8f69=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0xf698[_0x65d12e];return _0x4274e0;};'use strict';var multer=require(_0x8f69('0x0'));var util=require(_0x8f69('0x1'));var path=require('path');var timeout=require(_0x8f69('0x2'));var express=require(_0x8f69('0x3'));var router=express['Router']();var auth=require(_0x8f69('0x4'));var interaction=require(_0x8f69('0x5'));var config=require(_0x8f69('0x6'));var controller=require(_0x8f69('0x7'));router['get']('/',auth[_0x8f69('0x8')](),controller['index']);router['get']('/:id',auth[_0x8f69('0x8')](),controller[_0x8f69('0x9')]);router[_0x8f69('0xa')](_0x8f69('0xb'),auth[_0x8f69('0x8')](),controller[_0x8f69('0xc')]);router[_0x8f69('0xa')](_0x8f69('0xd'),auth[_0x8f69('0x8')](),controller[_0x8f69('0xe')]);router[_0x8f69('0xf')]('/',auth[_0x8f69('0x8')](),controller['create']);router[_0x8f69('0xf')]('/:id/configurations',auth[_0x8f69('0x8')](),controller['addConfiguration']);router[_0x8f69('0x10')]('/:id',auth[_0x8f69('0x8')](),controller[_0x8f69('0x11')]);router[_0x8f69('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8f69('0x13')]);module[_0x8f69('0x14')]=router; \ No newline at end of file +var _0x782e=['../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x6f56b8,_0x27e6af){var _0x2c7c48=function(_0x418cd5){while(--_0x418cd5){_0x6f56b8['push'](_0x6f56b8['shift']());}};_0x2c7c48(++_0x27e6af);}(_0x782e,0xb9));var _0xe782=function(_0x2e31c9,_0x4a28e3){_0x2e31c9=_0x2e31c9-0x0;var _0x219e6f=_0x782e[_0x2e31c9];return _0x219e6f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe782('0x0'));var timeout=require(_0xe782('0x1'));var express=require('express');var router=express[_0xe782('0x2')]();var auth=require(_0xe782('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe782('0x4'));var controller=require(_0xe782('0x5'));router[_0xe782('0x6')]('/',auth[_0xe782('0x7')](),controller['index']);router[_0xe782('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xe782('0x8')]);router['get'](_0xe782('0x9'),auth[_0xe782('0x7')](),controller[_0xe782('0xa')]);router[_0xe782('0x6')](_0xe782('0xb'),auth[_0xe782('0x7')](),controller[_0xe782('0xc')]);router[_0xe782('0xd')]('/',auth[_0xe782('0x7')](),controller[_0xe782('0xe')]);router[_0xe782('0xd')](_0xe782('0x9'),auth[_0xe782('0x7')](),controller[_0xe782('0xf')]);router['put'](_0xe782('0x10'),auth['isAuthenticated'](),controller[_0xe782('0x11')]);router[_0xe782('0x12')](_0xe782('0x10'),auth[_0xe782('0x7')](),controller[_0xe782('0x13')]);module[_0xe782('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 3351dcd..a86e24b 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 _0x4a4c=['remoteUri','sequelize','STRING'];(function(_0x22f3bc,_0x54340e){var _0x325c4e=function(_0x2e4fb1){while(--_0x2e4fb1){_0x22f3bc['push'](_0x22f3bc['shift']());}};_0x325c4e(++_0x54340e);}(_0x4a4c,0x1a8));var _0xc4a4=function(_0x525752,_0x4860f0){_0x525752=_0x525752-0x0;var _0x3dea39=_0x4a4c[_0x525752];return _0x3dea39;};'use strict';var Sequelize=require(_0xc4a4('0x0'));module['exports']={'name':{'type':Sequelize[_0xc4a4('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc4a4('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xc4a4('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xc4a4('0x1')],'unique':_0xc4a4('0x2')},'serverUrl':{'type':Sequelize[_0xc4a4('0x1')]}}; \ No newline at end of file +var _0x5070=['sequelize','exports','STRING','username','remoteUri'];(function(_0x36949f,_0xac8926){var _0x225ac9=function(_0x234feb){while(--_0x234feb){_0x36949f['push'](_0x36949f['shift']());}};_0x225ac9(++_0xac8926);}(_0x5070,0xd2));var _0x0507=function(_0x69928,_0x3f2884){_0x69928=_0x69928-0x0;var _0x3c9c24=_0x5070[_0x69928];return _0x3c9c24;};'use strict';var Sequelize=require(_0x0507('0x0'));module[_0x0507('0x1')]={'name':{'type':Sequelize[_0x0507('0x2')]},'description':{'type':Sequelize[_0x0507('0x2')]},'username':{'type':Sequelize[_0x0507('0x2')],'unique':_0x0507('0x3')},'password':{'type':Sequelize[_0x0507('0x2')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0507('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 241714e..483dbeb 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 _0x6d27=['sys_created_by','calendar_stc','closed_at','active','business_service','priority','time_worked','expected_start','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','remove','includes','forEach','internalType','label','push','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','boolean','True','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','html-pdf','rimraf','zip-dir','request-promise','mustache','path','sox','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','params','fields','include','find','create','body','destroy','getConfigurations','findOne','order','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','Subjects','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state'];(function(_0x39cdb8,_0x15ee98){var _0x44bbc9=function(_0x395338){while(--_0x395338){_0x39cdb8['push'](_0x39cdb8['shift']());}};_0x44bbc9(++_0x15ee98);}(_0x6d27,0x1cd));var _0x76d2=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x6d27[_0x5416db];return _0x243e35;};'use strict';var pdf=require(_0x76d2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x76d2('0x1'));var zipdir=require(_0x76d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76d2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x76d2('0x4'));var util=require('util');var path=require(_0x76d2('0x5'));var sox=require(_0x76d2('0x6'));var csv=require('to-csv');var ejs=require(_0x76d2('0x7'));var fs=require('fs');var _=require(_0x76d2('0x8'));var squel=require('squel');var crypto=require(_0x76d2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x76d2('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x76d2('0xb'));var Redis=require(_0x76d2('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x76d2('0xd'));var as=require(_0x76d2('0xe'));var hardwareService=require(_0x76d2('0xf'));var logger=require('../../config/logger')(_0x76d2('0x10'));var utils=require(_0x76d2('0x11'));var config=require(_0x76d2('0x12'));var licenseUtil=require(_0x76d2('0x13'));var db=require(_0x76d2('0x14'))['db'];var integrations=require(_0x76d2('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x76d2('0x16')][_0x76d2('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x55369c,_0x5d867e,_0x39371b,_0x2867f7){return new BPromise(function(_0xd6e5f,_0x472dcb){var _0x24a064=_0x2867f7||client;return _0x24a064[_0x76d2('0x18')](_0x55369c,_0x39371b)[_0x76d2('0x19')](function(_0x204b41){logger[_0x76d2('0x1a')](_0x76d2('0x1b'),_0x5d867e,_0x76d2('0x1c'));logger[_0x76d2('0x1d')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x5d867e,_0x76d2('0x1c'),JSON[_0x76d2('0x1e')](_0x204b41));if(_0x204b41[_0x76d2('0x1f')]){if(_0x204b41['error'][_0x76d2('0x20')]===0x1f4){logger[_0x76d2('0x1f')](_0x76d2('0x1b'),_0x5d867e,_0x204b41[_0x76d2('0x1f')][_0x76d2('0x21')]);return _0x472dcb(_0x204b41['error'][_0x76d2('0x21')]);}logger[_0x76d2('0x1f')](_0x76d2('0x1b'),_0x5d867e,_0x204b41[_0x76d2('0x1f')][_0x76d2('0x21')]);return _0xd6e5f(_0x204b41[_0x76d2('0x1f')][_0x76d2('0x21')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x5d867e,_0x76d2('0x1c'));_0xd6e5f(_0x204b41['result'][_0x76d2('0x21')]);}})[_0x76d2('0x22')](function(_0x144b6b){logger[_0x76d2('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x5d867e,_0x144b6b);_0x472dcb(_0x144b6b);});});}function respondWithStatusCode(_0x277ed9,_0x1c8548){_0x1c8548=_0x1c8548||0xcc;return function(_0x1bd6c3){if(_0x1bd6c3){return _0x277ed9[_0x76d2('0x23')](_0x1c8548);}return _0x277ed9[_0x76d2('0x24')](_0x1c8548)[_0x76d2('0x25')]();};}function respondWithResult(_0x2c0c9b,_0x5f1b96){_0x5f1b96=_0x5f1b96||0xc8;return function(_0x5a4d25){if(_0x5a4d25){return _0x2c0c9b[_0x76d2('0x24')](_0x5f1b96)[_0x76d2('0x26')](_0x5a4d25);}};}function respondWithFilteredResult(_0x2c229a,_0x3c6f74){return function(_0x50e120){if(_0x50e120){var _0x3424b4=_0x50e120[_0x76d2('0x27')],_0x52d4cf=_0x3c6f74[_0x76d2('0x28')],_0x5357a1=_0x3c6f74[_0x76d2('0x28')]+_0x3c6f74[_0x76d2('0x29')],_0x48dff1;if(_0x5357a1>=_0x3424b4){_0x5357a1=_0x3424b4;_0x48dff1=0xc8;}else{_0x48dff1=0xce;}_0x2c229a['status'](_0x48dff1);return _0x2c229a[_0x76d2('0x2a')](_0x76d2('0x2b'),_0x52d4cf+'-'+_0x5357a1+'/'+_0x3424b4)[_0x76d2('0x26')](_0x50e120);}return null;};}function patchUpdates(_0x3eee43){return function(_0x34f6d2){try{jsonpatch[_0x76d2('0x2c')](_0x34f6d2,_0x3eee43,!![]);}catch(_0x12c976){return BPromise[_0x76d2('0x2d')](_0x12c976);}return _0x34f6d2['save']();};}function saveUpdates(_0x3e2b58,_0x5bac57){return function(_0x1a6610){if(_0x1a6610){return _0x1a6610[_0x76d2('0x2e')](_0x3e2b58)[_0x76d2('0x19')](function(_0x326b2e){return _0x326b2e;});}return null;};}function removeEntity(_0x35773b,_0x522e1a){return function(_0x11b2e5){if(_0x11b2e5){return _0x11b2e5['destroy']()[_0x76d2('0x19')](function(){_0x35773b[_0x76d2('0x24')](0xcc)[_0x76d2('0x25')]();});}};}function handleEntityNotFound(_0x5b2f48,_0x197508){return function(_0x44d5d0){if(!_0x44d5d0){_0x5b2f48[_0x76d2('0x23')](0x194);}return _0x44d5d0;};}function handleError(_0x5e7c6d,_0x499f92){_0x499f92=_0x499f92||0x1f4;return function(_0xb98d85){logger['error'](_0xb98d85[_0x76d2('0x2f')]);if(_0xb98d85[_0x76d2('0x30')]){delete _0xb98d85[_0x76d2('0x30')];}_0x5e7c6d[_0x76d2('0x24')](_0x499f92)[_0x76d2('0x31')](_0xb98d85);};}exports[_0x76d2('0x32')]=function(_0x271a56,_0x42aae2){var _0x6b06={},_0x198040={},_0x525844={'count':0x0,'rows':[]};var _0x3feae0=_[_0x76d2('0x33')](db[_0x76d2('0x34')][_0x76d2('0x35')],function(_0x1d5830){return{'name':_0x1d5830[_0x76d2('0x36')],'type':_0x1d5830['type'][_0x76d2('0x37')]};});_0x198040[_0x76d2('0x38')]=_['map'](_0x3feae0,_0x76d2('0x30'));_0x198040[_0x76d2('0x39')]=_[_0x76d2('0x3a')](_0x271a56[_0x76d2('0x39')]);_0x198040[_0x76d2('0x3b')]=_[_0x76d2('0x3c')](_0x198040[_0x76d2('0x38')],_0x198040[_0x76d2('0x39')]);_0x6b06[_0x76d2('0x3d')]=_[_0x76d2('0x3c')](_0x198040[_0x76d2('0x38')],qs['fields'](_0x271a56[_0x76d2('0x39')]['fields']));_0x6b06[_0x76d2('0x3d')]=_0x6b06[_0x76d2('0x3d')][_0x76d2('0x3e')]?_0x6b06[_0x76d2('0x3d')]:_0x198040[_0x76d2('0x38')];if(!_0x271a56['query'][_0x76d2('0x3f')](_0x76d2('0x40'))){_0x6b06['limit']=qs['limit'](_0x271a56[_0x76d2('0x39')][_0x76d2('0x29')]);_0x6b06['offset']=qs[_0x76d2('0x28')](_0x271a56['query'][_0x76d2('0x28')]);}_0x6b06['order']=qs[_0x76d2('0x41')](_0x271a56[_0x76d2('0x39')][_0x76d2('0x41')]);_0x6b06[_0x76d2('0x42')]=qs[_0x76d2('0x3b')](_[_0x76d2('0x43')](_0x271a56[_0x76d2('0x39')],_0x198040[_0x76d2('0x3b')]),_0x3feae0);if(_0x271a56[_0x76d2('0x39')][_0x76d2('0x44')]){_0x6b06['where']=_[_0x76d2('0x45')](_0x6b06[_0x76d2('0x42')],{'$or':_[_0x76d2('0x33')](_0x3feae0,function(_0x3e4be2){if(_0x3e4be2[_0x76d2('0x46')]!=='VIRTUAL'){var _0x21e3a4={};_0x21e3a4[_0x3e4be2[_0x76d2('0x30')]]={'$like':'%'+_0x271a56['query'][_0x76d2('0x44')]+'%'};return _0x21e3a4;}})});}_0x6b06=_[_0x76d2('0x45')]({},_0x6b06,_0x271a56[_0x76d2('0x47')]);var _0x2b19f7={'where':_0x6b06[_0x76d2('0x42')]};return db[_0x76d2('0x34')][_0x76d2('0x27')](_0x2b19f7)[_0x76d2('0x19')](function(_0x47cce0){_0x525844[_0x76d2('0x27')]=_0x47cce0;if(_0x271a56[_0x76d2('0x39')][_0x76d2('0x48')]){_0x6b06['include']=[{'all':!![]}];}return db[_0x76d2('0x34')][_0x76d2('0x49')](_0x6b06);})[_0x76d2('0x19')](function(_0x9d5718){_0x525844[_0x76d2('0x4a')]=_0x9d5718;return _0x525844;})['then'](respondWithFilteredResult(_0x42aae2,_0x6b06))['catch'](handleError(_0x42aae2,null));};exports[_0x76d2('0x4b')]=function(_0x3b7137,_0x2d5154){var _0x3c5a5e={'raw':![],'where':{'id':_0x3b7137[_0x76d2('0x4c')]['id']}},_0x1ddd9b={};_0x1ddd9b[_0x76d2('0x38')]=_[_0x76d2('0x3a')](db[_0x76d2('0x34')]['rawAttributes']);_0x1ddd9b['query']=_['keys'](_0x3b7137[_0x76d2('0x39')]);_0x1ddd9b[_0x76d2('0x3b')]=_['intersection'](_0x1ddd9b[_0x76d2('0x38')],_0x1ddd9b[_0x76d2('0x39')]);_0x3c5a5e[_0x76d2('0x3d')]=_['intersection'](_0x1ddd9b[_0x76d2('0x38')],qs[_0x76d2('0x4d')](_0x3b7137[_0x76d2('0x39')][_0x76d2('0x4d')]));_0x3c5a5e[_0x76d2('0x3d')]=_0x3c5a5e[_0x76d2('0x3d')]['length']?_0x3c5a5e['attributes']:_0x1ddd9b['model'];if(_0x3b7137['query']['includeAll']){_0x3c5a5e[_0x76d2('0x4e')]=[{'all':!![]}];}_0x3c5a5e=_[_0x76d2('0x45')]({},_0x3c5a5e,_0x3b7137[_0x76d2('0x47')]);return db[_0x76d2('0x34')][_0x76d2('0x4f')](_0x3c5a5e)[_0x76d2('0x19')](handleEntityNotFound(_0x2d5154,null))['then'](respondWithResult(_0x2d5154,null))['catch'](handleError(_0x2d5154,null));};exports[_0x76d2('0x50')]=function(_0x157c74,_0x25dd87){return db[_0x76d2('0x34')]['create'](_0x157c74[_0x76d2('0x51')],{})['then'](respondWithResult(_0x25dd87,0xc9))['catch'](handleError(_0x25dd87,null));};exports[_0x76d2('0x2e')]=function(_0x353145,_0x57403d){if(_0x353145[_0x76d2('0x51')]['id']){delete _0x353145[_0x76d2('0x51')]['id'];}return db['ServicenowAccount'][_0x76d2('0x4f')]({'where':{'id':_0x353145[_0x76d2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x57403d,null))[_0x76d2('0x19')](saveUpdates(_0x353145[_0x76d2('0x51')],null))['then'](respondWithResult(_0x57403d,null))['catch'](handleError(_0x57403d,null));};exports[_0x76d2('0x52')]=function(_0x221679,_0x123081){return db[_0x76d2('0x34')][_0x76d2('0x4f')]({'where':{'id':_0x221679[_0x76d2('0x4c')]['id']}})[_0x76d2('0x19')](handleEntityNotFound(_0x123081,null))[_0x76d2('0x19')](removeEntity(_0x123081,null))[_0x76d2('0x22')](handleError(_0x123081,null));};exports[_0x76d2('0x53')]=function(_0x50ac9c,_0xd3433e,_0x4a4f32){var _0x4c7f31={};var _0x3effbf={};var _0x1708cc;var _0x42f4ee;return db['ServicenowAccount'][_0x76d2('0x54')]({'where':{'id':_0x50ac9c[_0x76d2('0x4c')]['id']}})[_0x76d2('0x19')](handleEntityNotFound(_0xd3433e,null))[_0x76d2('0x19')](function(_0x5613f9){if(_0x5613f9){_0x1708cc=_0x5613f9;_0x3effbf[_0x76d2('0x38')]=_[_0x76d2('0x3a')](db['ServicenowConfiguration'][_0x76d2('0x35')]);_0x3effbf['query']=_['keys'](_0x50ac9c[_0x76d2('0x39')]);_0x3effbf[_0x76d2('0x3b')]=_['intersection'](_0x3effbf['model'],_0x3effbf[_0x76d2('0x39')]);_0x4c7f31[_0x76d2('0x3d')]=_[_0x76d2('0x3c')](_0x3effbf['model'],qs['fields'](_0x50ac9c[_0x76d2('0x39')]['fields']));_0x4c7f31[_0x76d2('0x3d')]=_0x4c7f31[_0x76d2('0x3d')][_0x76d2('0x3e')]?_0x4c7f31[_0x76d2('0x3d')]:_0x3effbf[_0x76d2('0x38')];_0x4c7f31[_0x76d2('0x55')]=qs[_0x76d2('0x41')](_0x50ac9c['query'][_0x76d2('0x41')]);_0x4c7f31[_0x76d2('0x42')]=qs[_0x76d2('0x3b')](_['pick'](_0x50ac9c[_0x76d2('0x39')],_0x3effbf[_0x76d2('0x3b')]));if(_0x50ac9c[_0x76d2('0x39')][_0x76d2('0x44')]){_0x4c7f31[_0x76d2('0x42')]=_[_0x76d2('0x45')](_0x4c7f31[_0x76d2('0x42')],{'$or':_[_0x76d2('0x33')](_0x4c7f31['attributes'],function(_0x4ac6a3){var _0x40aa98={};_0x40aa98[_0x4ac6a3]={'$like':'%'+_0x50ac9c[_0x76d2('0x39')][_0x76d2('0x44')]+'%'};return _0x40aa98;})});}_0x4c7f31=_[_0x76d2('0x45')]({},_0x4c7f31,_0x50ac9c[_0x76d2('0x47')]);return _0x1708cc[_0x76d2('0x53')](_0x4c7f31);}})[_0x76d2('0x19')](function(_0x554798){if(_0x554798){_0x42f4ee=_0x554798[_0x76d2('0x3e')];if(!_0x50ac9c[_0x76d2('0x39')][_0x76d2('0x3f')](_0x76d2('0x40'))){_0x4c7f31[_0x76d2('0x29')]=qs[_0x76d2('0x29')](_0x50ac9c[_0x76d2('0x39')][_0x76d2('0x29')]);_0x4c7f31[_0x76d2('0x28')]=qs[_0x76d2('0x28')](_0x50ac9c['query'][_0x76d2('0x28')]);}return _0x1708cc[_0x76d2('0x53')](_0x4c7f31);}})[_0x76d2('0x19')](function(_0x4e062d){if(_0x4e062d){return _0x4e062d?{'count':_0x42f4ee,'rows':_0x4e062d}:null;}})['then'](respondWithResult(_0xd3433e,null))['catch'](handleError(_0xd3433e,null));};exports[_0x76d2('0x56')]=function(_0x21054f,_0x3282f9,_0x30cea1){if(_0x21054f[_0x76d2('0x51')]['id']){delete _0x21054f[_0x76d2('0x51')]['id'];}return db[_0x76d2('0x34')][_0x76d2('0x54')]({'where':{'id':_0x21054f[_0x76d2('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3282f9,null))[_0x76d2('0x19')](function(_0x59c0ed){if(_0x59c0ed){_0x21054f[_0x76d2('0x51')][_0x76d2('0x57')]=_0x59c0ed['id'];_0x21054f[_0x76d2('0x51')]['Subjects']=integrations[_0x76d2('0x58')](_0x21054f[_0x76d2('0x51')][_0x76d2('0x59')],_0x21054f[_0x76d2('0x51')][_0x76d2('0x46')]);_0x21054f[_0x76d2('0x51')][_0x76d2('0x5a')]=integrations[_0x76d2('0x5b')](_0x21054f[_0x76d2('0x51')][_0x76d2('0x59')],_0x21054f[_0x76d2('0x51')][_0x76d2('0x46')]);return db[_0x76d2('0x5c')][_0x76d2('0x50')](_0x21054f[_0x76d2('0x51')],{'include':[{'model':db[_0x76d2('0x5d')],'as':_0x76d2('0x5e')},{'model':db[_0x76d2('0x5d')],'as':_0x76d2('0x5a')}]});}return null;})[_0x76d2('0x19')](respondWithResult(_0x3282f9,null))['catch'](handleError(_0x3282f9,null));};exports[_0x76d2('0x5f')]=function(_0x4d7812,_0x336126,_0x56f244){var _0x37c689=[_0x76d2('0x60'),'hold_reason',_0x76d2('0x61'),_0x76d2('0x62'),_0x76d2('0x63'),_0x76d2('0x64'),_0x76d2('0x65'),'severity',_0x76d2('0x66')];var _0xc66cc7=[_0x76d2('0x67'),_0x76d2('0x60'),_0x76d2('0x68'),_0x76d2('0x69'),_0x76d2('0x6a'),_0x76d2('0x6b'),_0x76d2('0x6c'),_0x76d2('0x6d'),_0x76d2('0x6e'),'number',_0x76d2('0x6f'),_0x76d2('0x70'),_0x76d2('0x71'),_0x76d2('0x72'),_0x76d2('0x73'),_0x76d2('0x74'),_0x76d2('0x75'),_0x76d2('0x76'),_0x76d2('0x61'),_0x76d2('0x55'),_0x76d2('0x77'),_0x76d2('0x78'),'cmdb_ci','delivery_plan','impact',_0x76d2('0x79'),'work_notes_list',_0x76d2('0x7a'),_0x76d2('0x7b'),'sys_domain_path','rfc',_0x76d2('0x7c'),_0x76d2('0x7d'),'opened_at','business_duration',_0x76d2('0x7e'),_0x76d2('0x7f'),_0x76d2('0x80'),_0x76d2('0x81'),'caller_id',_0x76d2('0x82'),_0x76d2('0x62'),_0x76d2('0x83'),_0x76d2('0x84'),_0x76d2('0x63'),'correlation_display',_0x76d2('0x85'),_0x76d2('0x86'),_0x76d2('0x87'),_0x76d2('0x88'),_0x76d2('0x89'),_0x76d2('0x8a'),_0x76d2('0x8b'),_0x76d2('0x64'),_0x76d2('0x8c'),_0x76d2('0x8d'),_0x76d2('0x8e'),_0x76d2('0x8f'),'parent_incident','sys_id','contact_type','reopened_by',_0x76d2('0x65'),_0x76d2('0x90'),_0x76d2('0x91'),'company',_0x76d2('0x92'),_0x76d2('0x93'),_0x76d2('0x94'),'severity',_0x76d2('0x95'),_0x76d2('0x96'),_0x76d2('0x97'),_0x76d2('0x98'),_0x76d2('0x99'),_0x76d2('0x9a'),_0x76d2('0x9b'),_0x76d2('0x9c'),_0x76d2('0x9d'),_0x76d2('0x9e'),'correlation_id',_0x76d2('0x9f'),_0x76d2('0x66')];var _0x5b021d='';var _0x3a688a='';var _0x39b159=[];var _0x39c74d='';var _0xef1e2e='';var _0x18f4c7=[];var _0x204f33='';var _0x2ff54f='';var _0x563320={};var _0x2b8d30='';return db[_0x76d2('0x34')][_0x76d2('0x54')]({'where':{'id':_0x4d7812[_0x76d2('0x4c')]['id']},'attributes':['id',_0x76d2('0xa0'),_0x76d2('0xa1'),_0x76d2('0xa2'),_0x76d2('0xa3'),_0x76d2('0xa4')]})[_0x76d2('0x19')](handleEntityNotFound(_0x336126,null))[_0x76d2('0x19')](function(_0xbd6682){if(_0xbd6682){_0x2b8d30=_0xbd6682[_0x76d2('0xa3')];var _0x29674d=_0x2b8d30[_0x76d2('0xa5')](-0x1);if(_0x29674d==='/'){_0x2b8d30=_0x2b8d30['substring'](0x0,_0x2b8d30[_0x76d2('0xa6')](_0x29674d));}_0x2ff54f=util[_0x76d2('0xa7')](_0x76d2('0xa8'),_0x2b8d30);_0x204f33=util[_0x76d2('0xa7')](_0x76d2('0xa9'),_0x2b8d30);_0x563320={'user':_0xbd6682[_0x76d2('0xa0')],'pass':_0xbd6682[_0x76d2('0xa1')]};var _0xc1d2a7={'method':_0x76d2('0xaa'),'uri':_0x2ff54f+'incident?sysparm_display_value=all','auth':_0x563320,'json':!![]};return rp(_0xc1d2a7);}})['then'](function(_0x1fe4de){if(_0x1fe4de['result'][_0x76d2('0x3e')]>0x0){_0x5b021d=_0x1fe4de[_0x76d2('0xab')];}console[_0x76d2('0xac')](_0x76d2('0xad'),_0x5b021d);_0x18f4c7=[];_0x3a688a=Object['assign']([],_0x5b021d);_[_0x76d2('0xae')](_0x3a688a,function(_0xb359ed){return!_0x37c689[_0x76d2('0xaf')](_0xb359ed[_0x76d2('0x30')]);});_0x3a688a[_0x76d2('0xb0')](function(_0xc50276){var _0x5bf857=createFieldObject(_0x204f33,_0x563320,_0xc50276[_0x76d2('0xb1')],_0xc50276[_0x76d2('0x30')],_0xc50276[_0x76d2('0xb2')],![]);_0x18f4c7[_0x76d2('0xb3')](_0x5bf857);});return Promise['all'](_0x18f4c7);})[_0x76d2('0x19')](function(_0x1376d0){_0x39b159=_0x1376d0;_0x39c74d=Object[_0x76d2('0xb4')]([],_0x5b021d);console[_0x76d2('0xac')](_0x76d2('0xb5'),_0x5b021d);_['remove'](_0x39c74d,function(_0x58f6f5){return _0xc66cc7[_0x76d2('0xaf')](_0x58f6f5[_0x76d2('0x30')]);});console[_0x76d2('0xac')](_0x76d2('0xb6'),_0x39c74d);_0x18f4c7=[];_0x39c74d[_0x76d2('0xb0')](function(_0x34b00f){var _0x1cd583=createFieldObject(_0x204f33,_0x563320,_0x34b00f[_0x76d2('0xb1')],_0x34b00f[_0x76d2('0x30')],_0x34b00f['label'],!![]);_0x18f4c7[_0x76d2('0xb3')](_0x1cd583);});return Promise['all'](_0x18f4c7);})[_0x76d2('0x19')](function(_0x5cf4ae){_0xef1e2e=_0x5cf4ae;var _0x4d3515=_0x39b159[_0x76d2('0xb7')](_0xef1e2e);return{'count':_0x4d3515['length'],'rows':_0x4d3515};})['then'](respondWithResult(_0x336126,null))[_0x76d2('0x22')](function(_0x39f7a2){console[_0x76d2('0xac')](_0x76d2('0xb8')+_0x39f7a2);var _0x5c1356=_0x4d7812[_0x76d2('0x39')]['test']?0x1f4:_0x39f7a2['statusCode']||0x1f4;logger[_0x76d2('0x1f')](_0x39f7a2['stack']);delete _0x39f7a2[_0x76d2('0x30')];if(_0x5c1356===0x191){_0x5c1356=0x190;}_0x336126['status'](_0x5c1356)['send'](_0x4d7812[_0x76d2('0x39')][_0x76d2('0xb9')]?{'message':'Wrong\x20credentials','statusCode':_0x39f7a2['statusCode']}:_0x39f7a2);});};function createFieldObject(_0x33fe93,_0x41cfbd,_0x48b431,_0x1c302f,_0x50782e,_0x45de69){return new Promise(function(_0x70d0ce,_0x521fc1){var _0x3d3f76={'id':_0x1c302f,'name':_0x50782e,'custom':_0x45de69};if(_0x48b431===_0x76d2('0xba')){_0x3d3f76['options']=[{'name':_0x76d2('0xbb'),'value':'true'},{'name':_0x76d2('0xbc'),'value':'false'}];_0x70d0ce(_0x3d3f76);}else{var _0x339e12={'method':_0x76d2('0xaa'),'uri':_0x33fe93+_0x76d2('0xbd')+_0x1c302f,'auth':_0x41cfbd,'json':!![]};return rp(_0x339e12)['then'](function(_0x37ab1d){var _0x171a6e=[];if(_0x37ab1d['result']['length']>0x0){_0x37ab1d[_0x76d2('0xab')][_0x76d2('0xb0')](function(_0xe450e5){if(_0xe450e5[_0x76d2('0xbe')]===_0x76d2('0xbf')){var _0x516d66={'name':_0xe450e5[_0x76d2('0xb2')],'value':_0xe450e5[_0x76d2('0xc0')]};_0x171a6e['push'](_0x516d66);}});}_0x3d3f76['options']=_0x171a6e;if(_0x3d3f76['options']['length']>0x0){_0x70d0ce(_0x3d3f76);}else{if(_0x45de69==![]){_0x70d0ce();}else{_0x70d0ce(_0x3d3f76);}}});}});} \ No newline at end of file +var _0xa832=['sys_domain','state','calendar_stc','cmdb_ci','impact','work_notes_list','priority','sys_domain_path','rfc','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','work_start','assignment_group','business_stc','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','escalation','correlation_id','location','password','email','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','includes','forEach','internalType','label','push','all','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','test','statusCode','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','count','offset','limit','set','Content-Range','apply','reject','destroy','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','includeAll','findAll','show','params','include','find','create','body','update','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on'];(function(_0x306523,_0x37d635){var _0x1c695e=function(_0x4a3688){while(--_0x4a3688){_0x306523['push'](_0x306523['shift']());}};_0x1c695e(++_0x37d635);}(_0xa832,0x1bb));var _0x2a83=function(_0x39bb0f,_0x47a7d3){_0x39bb0f=_0x39bb0f-0x0;var _0x5d4734=_0xa832[_0x39bb0f];return _0x5d4734;};'use strict';var pdf=require(_0x2a83('0x0'));var emlformat=require(_0x2a83('0x1'));var rimraf=require(_0x2a83('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a83('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2a83('0x4'));var util=require(_0x2a83('0x5'));var path=require(_0x2a83('0x6'));var sox=require('sox');var csv=require(_0x2a83('0x7'));var ejs=require(_0x2a83('0x8'));var fs=require('fs');var _=require(_0x2a83('0x9'));var squel=require(_0x2a83('0xa'));var crypto=require(_0x2a83('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a83('0x7'));var querystring=require('querystring');var Papa=require(_0x2a83('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2a83('0xd'));var as=require(_0x2a83('0xe'));var hardwareService=require(_0x2a83('0xf'));var logger=require(_0x2a83('0x10'))(_0x2a83('0x11'));var utils=require(_0x2a83('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x2a83('0x13'));var db=require(_0x2a83('0x14'))['db'];var integrations=require(_0x2a83('0x15'));var jayson=require(_0x2a83('0x16'));var client=jayson[_0x2a83('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ae86a,_0x49f44f,_0x454514,_0x1a5089){return new BPromise(function(_0x5c71b4,_0x2e3d07){var _0x336c8c=_0x1a5089||client;return _0x336c8c[_0x2a83('0x18')](_0x4ae86a,_0x454514)[_0x2a83('0x19')](function(_0x397c9e){logger[_0x2a83('0x1a')](_0x2a83('0x1b'),_0x49f44f,_0x2a83('0x1c'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x49f44f,_0x2a83('0x1c'),JSON[_0x2a83('0x1d')](_0x397c9e));if(_0x397c9e['error']){if(_0x397c9e[_0x2a83('0x1e')][_0x2a83('0x1f')]===0x1f4){logger[_0x2a83('0x1e')](_0x2a83('0x1b'),_0x49f44f,_0x397c9e[_0x2a83('0x1e')][_0x2a83('0x20')]);return _0x2e3d07(_0x397c9e[_0x2a83('0x1e')][_0x2a83('0x20')]);}logger[_0x2a83('0x1e')](_0x2a83('0x1b'),_0x49f44f,_0x397c9e['error'][_0x2a83('0x20')]);return _0x5c71b4(_0x397c9e['error'][_0x2a83('0x20')]);}else{logger[_0x2a83('0x1a')](_0x2a83('0x1b'),_0x49f44f,_0x2a83('0x1c'));_0x5c71b4(_0x397c9e[_0x2a83('0x21')][_0x2a83('0x20')]);}})[_0x2a83('0x22')](function(_0xd73c88){logger[_0x2a83('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x49f44f,_0xd73c88);_0x2e3d07(_0xd73c88);});});}function respondWithStatusCode(_0x55a1cc,_0x43ee6f){_0x43ee6f=_0x43ee6f||0xcc;return function(_0x1369ec){if(_0x1369ec){return _0x55a1cc['sendStatus'](_0x43ee6f);}return _0x55a1cc[_0x2a83('0x23')](_0x43ee6f)[_0x2a83('0x24')]();};}function respondWithResult(_0x37cf2c,_0xef2d1a){_0xef2d1a=_0xef2d1a||0xc8;return function(_0x189d1c){if(_0x189d1c){return _0x37cf2c[_0x2a83('0x23')](_0xef2d1a)['json'](_0x189d1c);}};}function respondWithFilteredResult(_0x50cab6,_0x11f52a){return function(_0x5d56e2){if(_0x5d56e2){var _0x182c49=_0x5d56e2[_0x2a83('0x25')],_0x5342ea=_0x11f52a['offset'],_0xd6aa16=_0x11f52a[_0x2a83('0x26')]+_0x11f52a[_0x2a83('0x27')],_0x566d9e;if(_0xd6aa16>=_0x182c49){_0xd6aa16=_0x182c49;_0x566d9e=0xc8;}else{_0x566d9e=0xce;}_0x50cab6[_0x2a83('0x23')](_0x566d9e);return _0x50cab6[_0x2a83('0x28')](_0x2a83('0x29'),_0x5342ea+'-'+_0xd6aa16+'/'+_0x182c49)['json'](_0x5d56e2);}return null;};}function patchUpdates(_0x19e983){return function(_0x59d3e3){try{jsonpatch[_0x2a83('0x2a')](_0x59d3e3,_0x19e983,!![]);}catch(_0x469204){return BPromise[_0x2a83('0x2b')](_0x469204);}return _0x59d3e3['save']();};}function saveUpdates(_0x5e0a5d,_0x50e28b){return function(_0x25cdbb){if(_0x25cdbb){return _0x25cdbb['update'](_0x5e0a5d)[_0x2a83('0x19')](function(_0x1526ca){return _0x1526ca;});}return null;};}function removeEntity(_0x4d2b1b,_0x2c7979){return function(_0x28fb37){if(_0x28fb37){return _0x28fb37[_0x2a83('0x2c')]()[_0x2a83('0x19')](function(){_0x4d2b1b[_0x2a83('0x23')](0xcc)[_0x2a83('0x24')]();});}};}function handleEntityNotFound(_0x299499,_0x5e165c){return function(_0x22fcb9){if(!_0x22fcb9){_0x299499[_0x2a83('0x2d')](0x194);}return _0x22fcb9;};}function handleError(_0x1653ee,_0x15cde3){_0x15cde3=_0x15cde3||0x1f4;return function(_0x2ab050){logger[_0x2a83('0x1e')](_0x2ab050[_0x2a83('0x2e')]);if(_0x2ab050[_0x2a83('0x2f')]){delete _0x2ab050[_0x2a83('0x2f')];}_0x1653ee[_0x2a83('0x23')](_0x15cde3)[_0x2a83('0x30')](_0x2ab050);};}exports['index']=function(_0x58819e,_0xac7216){var _0x75aa4={},_0x1900ec={},_0x1997da={'count':0x0,'rows':[]};var _0x2af152=_['map'](db['ServicenowAccount'][_0x2a83('0x31')],function(_0x24d763){return{'name':_0x24d763[_0x2a83('0x32')],'type':_0x24d763[_0x2a83('0x33')][_0x2a83('0x34')]};});_0x1900ec[_0x2a83('0x35')]=_[_0x2a83('0x36')](_0x2af152,_0x2a83('0x2f'));_0x1900ec['query']=_[_0x2a83('0x37')](_0x58819e[_0x2a83('0x38')]);_0x1900ec[_0x2a83('0x39')]=_[_0x2a83('0x3a')](_0x1900ec['model'],_0x1900ec[_0x2a83('0x38')]);_0x75aa4[_0x2a83('0x3b')]=_['intersection'](_0x1900ec[_0x2a83('0x35')],qs[_0x2a83('0x3c')](_0x58819e[_0x2a83('0x38')][_0x2a83('0x3c')]));_0x75aa4[_0x2a83('0x3b')]=_0x75aa4[_0x2a83('0x3b')][_0x2a83('0x3d')]?_0x75aa4['attributes']:_0x1900ec[_0x2a83('0x35')];if(!_0x58819e[_0x2a83('0x38')][_0x2a83('0x3e')](_0x2a83('0x3f'))){_0x75aa4[_0x2a83('0x27')]=qs[_0x2a83('0x27')](_0x58819e[_0x2a83('0x38')][_0x2a83('0x27')]);_0x75aa4[_0x2a83('0x26')]=qs[_0x2a83('0x26')](_0x58819e['query']['offset']);}_0x75aa4[_0x2a83('0x40')]=qs[_0x2a83('0x41')](_0x58819e[_0x2a83('0x38')][_0x2a83('0x41')]);_0x75aa4[_0x2a83('0x42')]=qs[_0x2a83('0x39')](_[_0x2a83('0x43')](_0x58819e[_0x2a83('0x38')],_0x1900ec[_0x2a83('0x39')]),_0x2af152);if(_0x58819e['query'][_0x2a83('0x44')]){_0x75aa4[_0x2a83('0x42')]=_[_0x2a83('0x45')](_0x75aa4[_0x2a83('0x42')],{'$or':_[_0x2a83('0x36')](_0x2af152,function(_0x1b8170){if(_0x1b8170[_0x2a83('0x33')]!==_0x2a83('0x46')){var _0x1472f0={};_0x1472f0[_0x1b8170['name']]={'$like':'%'+_0x58819e[_0x2a83('0x38')][_0x2a83('0x44')]+'%'};return _0x1472f0;}})});}_0x75aa4=_[_0x2a83('0x45')]({},_0x75aa4,_0x58819e[_0x2a83('0x47')]);var _0x3d9820={'where':_0x75aa4[_0x2a83('0x42')]};return db[_0x2a83('0x48')][_0x2a83('0x25')](_0x3d9820)[_0x2a83('0x19')](function(_0x355fa4){_0x1997da[_0x2a83('0x25')]=_0x355fa4;if(_0x58819e[_0x2a83('0x38')][_0x2a83('0x49')]){_0x75aa4['include']=[{'all':!![]}];}return db[_0x2a83('0x48')][_0x2a83('0x4a')](_0x75aa4);})[_0x2a83('0x19')](function(_0x44e6b3){_0x1997da['rows']=_0x44e6b3;return _0x1997da;})['then'](respondWithFilteredResult(_0xac7216,_0x75aa4))[_0x2a83('0x22')](handleError(_0xac7216,null));};exports[_0x2a83('0x4b')]=function(_0x52239d,_0x29f1df){var _0x3d4f46={'raw':![],'where':{'id':_0x52239d[_0x2a83('0x4c')]['id']}},_0x1d40a8={};_0x1d40a8[_0x2a83('0x35')]=_[_0x2a83('0x37')](db[_0x2a83('0x48')][_0x2a83('0x31')]);_0x1d40a8[_0x2a83('0x38')]=_[_0x2a83('0x37')](_0x52239d[_0x2a83('0x38')]);_0x1d40a8['filters']=_[_0x2a83('0x3a')](_0x1d40a8['model'],_0x1d40a8[_0x2a83('0x38')]);_0x3d4f46['attributes']=_['intersection'](_0x1d40a8[_0x2a83('0x35')],qs['fields'](_0x52239d[_0x2a83('0x38')]['fields']));_0x3d4f46[_0x2a83('0x3b')]=_0x3d4f46[_0x2a83('0x3b')][_0x2a83('0x3d')]?_0x3d4f46['attributes']:_0x1d40a8[_0x2a83('0x35')];if(_0x52239d[_0x2a83('0x38')]['includeAll']){_0x3d4f46[_0x2a83('0x4d')]=[{'all':!![]}];}_0x3d4f46=_[_0x2a83('0x45')]({},_0x3d4f46,_0x52239d[_0x2a83('0x47')]);return db[_0x2a83('0x48')][_0x2a83('0x4e')](_0x3d4f46)[_0x2a83('0x19')](handleEntityNotFound(_0x29f1df,null))[_0x2a83('0x19')](respondWithResult(_0x29f1df,null))[_0x2a83('0x22')](handleError(_0x29f1df,null));};exports['create']=function(_0x5e254e,_0x3412ee){return db[_0x2a83('0x48')][_0x2a83('0x4f')](_0x5e254e[_0x2a83('0x50')],{})[_0x2a83('0x19')](respondWithResult(_0x3412ee,0xc9))[_0x2a83('0x22')](handleError(_0x3412ee,null));};exports[_0x2a83('0x51')]=function(_0x7890d7,_0x24902a){if(_0x7890d7[_0x2a83('0x50')]['id']){delete _0x7890d7[_0x2a83('0x50')]['id'];}return db[_0x2a83('0x48')]['find']({'where':{'id':_0x7890d7[_0x2a83('0x4c')]['id']}})[_0x2a83('0x19')](handleEntityNotFound(_0x24902a,null))[_0x2a83('0x19')](saveUpdates(_0x7890d7[_0x2a83('0x50')],null))['then'](respondWithResult(_0x24902a,null))[_0x2a83('0x22')](handleError(_0x24902a,null));};exports[_0x2a83('0x2c')]=function(_0x43d5cf,_0x1cb5ee){return db[_0x2a83('0x48')][_0x2a83('0x4e')]({'where':{'id':_0x43d5cf['params']['id']}})[_0x2a83('0x19')](handleEntityNotFound(_0x1cb5ee,null))[_0x2a83('0x19')](removeEntity(_0x1cb5ee,null))[_0x2a83('0x22')](handleError(_0x1cb5ee,null));};exports[_0x2a83('0x52')]=function(_0x3c7e25,_0xf1c89a,_0x13d944){var _0x2e56c2={};var _0x2e53d1={};var _0xcbf3ba;var _0x3600b8;return db[_0x2a83('0x48')][_0x2a83('0x53')]({'where':{'id':_0x3c7e25[_0x2a83('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf1c89a,null))[_0x2a83('0x19')](function(_0x3be20b){if(_0x3be20b){_0xcbf3ba=_0x3be20b;_0x2e53d1[_0x2a83('0x35')]=_[_0x2a83('0x37')](db['ServicenowConfiguration'][_0x2a83('0x31')]);_0x2e53d1['query']=_[_0x2a83('0x37')](_0x3c7e25['query']);_0x2e53d1[_0x2a83('0x39')]=_[_0x2a83('0x3a')](_0x2e53d1[_0x2a83('0x35')],_0x2e53d1[_0x2a83('0x38')]);_0x2e56c2[_0x2a83('0x3b')]=_['intersection'](_0x2e53d1['model'],qs[_0x2a83('0x3c')](_0x3c7e25[_0x2a83('0x38')][_0x2a83('0x3c')]));_0x2e56c2[_0x2a83('0x3b')]=_0x2e56c2[_0x2a83('0x3b')][_0x2a83('0x3d')]?_0x2e56c2[_0x2a83('0x3b')]:_0x2e53d1[_0x2a83('0x35')];_0x2e56c2[_0x2a83('0x40')]=qs['sort'](_0x3c7e25['query'][_0x2a83('0x41')]);_0x2e56c2[_0x2a83('0x42')]=qs[_0x2a83('0x39')](_['pick'](_0x3c7e25[_0x2a83('0x38')],_0x2e53d1['filters']));if(_0x3c7e25[_0x2a83('0x38')][_0x2a83('0x44')]){_0x2e56c2[_0x2a83('0x42')]=_[_0x2a83('0x45')](_0x2e56c2[_0x2a83('0x42')],{'$or':_[_0x2a83('0x36')](_0x2e56c2[_0x2a83('0x3b')],function(_0x14c139){var _0x5f3a20={};_0x5f3a20[_0x14c139]={'$like':'%'+_0x3c7e25[_0x2a83('0x38')][_0x2a83('0x44')]+'%'};return _0x5f3a20;})});}_0x2e56c2=_['merge']({},_0x2e56c2,_0x3c7e25[_0x2a83('0x47')]);return _0xcbf3ba[_0x2a83('0x52')](_0x2e56c2);}})[_0x2a83('0x19')](function(_0x1116b9){if(_0x1116b9){_0x3600b8=_0x1116b9[_0x2a83('0x3d')];if(!_0x3c7e25[_0x2a83('0x38')][_0x2a83('0x3e')](_0x2a83('0x3f'))){_0x2e56c2[_0x2a83('0x27')]=qs[_0x2a83('0x27')](_0x3c7e25[_0x2a83('0x38')]['limit']);_0x2e56c2['offset']=qs['offset'](_0x3c7e25['query'][_0x2a83('0x26')]);}return _0xcbf3ba[_0x2a83('0x52')](_0x2e56c2);}})[_0x2a83('0x19')](function(_0x304bb0){if(_0x304bb0){return _0x304bb0?{'count':_0x3600b8,'rows':_0x304bb0}:null;}})[_0x2a83('0x19')](respondWithResult(_0xf1c89a,null))[_0x2a83('0x22')](handleError(_0xf1c89a,null));};exports[_0x2a83('0x54')]=function(_0x21c3a5,_0x430adf,_0x2877d8){if(_0x21c3a5[_0x2a83('0x50')]['id']){delete _0x21c3a5[_0x2a83('0x50')]['id'];}return db[_0x2a83('0x48')][_0x2a83('0x53')]({'where':{'id':_0x21c3a5[_0x2a83('0x4c')]['id']}})[_0x2a83('0x19')](handleEntityNotFound(_0x430adf,null))[_0x2a83('0x19')](function(_0x3acd6a){if(_0x3acd6a){_0x21c3a5['body'][_0x2a83('0x55')]=_0x3acd6a['id'];_0x21c3a5[_0x2a83('0x50')][_0x2a83('0x56')]=integrations[_0x2a83('0x57')](_0x21c3a5[_0x2a83('0x50')]['channel'],_0x21c3a5['body'][_0x2a83('0x33')]);_0x21c3a5[_0x2a83('0x50')][_0x2a83('0x58')]=integrations[_0x2a83('0x59')](_0x21c3a5[_0x2a83('0x50')][_0x2a83('0x5a')],_0x21c3a5[_0x2a83('0x50')]['type']);return db['ServicenowConfiguration'][_0x2a83('0x4f')](_0x21c3a5[_0x2a83('0x50')],{'include':[{'model':db[_0x2a83('0x5b')],'as':'Subjects'},{'model':db[_0x2a83('0x5b')],'as':'Descriptions'}]});}return null;})[_0x2a83('0x19')](respondWithResult(_0x430adf,null))[_0x2a83('0x22')](handleError(_0x430adf,null));};exports[_0x2a83('0x5c')]=function(_0xf32e9c,_0x84f9a5,_0x1230ff){var _0xfd081a=[_0x2a83('0x5d'),_0x2a83('0x5e'),_0x2a83('0x5f'),_0x2a83('0x60'),_0x2a83('0x61'),_0x2a83('0x62'),_0x2a83('0x63'),_0x2a83('0x64'),_0x2a83('0x65')];var _0x350eb8=[_0x2a83('0x66'),_0x2a83('0x5d'),'caused_by','watch_list',_0x2a83('0x67'),_0x2a83('0x68'),_0x2a83('0x69'),'hold_reason','approval_history',_0x2a83('0x6a'),_0x2a83('0x6b'),_0x2a83('0x6c'),_0x2a83('0x6d'),_0x2a83('0x6e'),_0x2a83('0x6f'),_0x2a83('0x70'),_0x2a83('0x71'),'sys_created_by',_0x2a83('0x5f'),'order',_0x2a83('0x72'),'closed_at',_0x2a83('0x73'),'delivery_plan',_0x2a83('0x74'),'active',_0x2a83('0x75'),'business_service',_0x2a83('0x76'),_0x2a83('0x77'),_0x2a83('0x78'),'time_worked',_0x2a83('0x79'),'opened_at',_0x2a83('0x7a'),_0x2a83('0x7b'),_0x2a83('0x7c'),_0x2a83('0x7d'),_0x2a83('0x7e'),_0x2a83('0x7f'),_0x2a83('0x80'),'subcategory',_0x2a83('0x81'),_0x2a83('0x82'),_0x2a83('0x61'),'correlation_display','delivery_task',_0x2a83('0x83'),_0x2a83('0x84'),_0x2a83('0x85'),'additional_assignee_list','description',_0x2a83('0x86'),_0x2a83('0x62'),_0x2a83('0x87'),_0x2a83('0x88'),_0x2a83('0x89'),_0x2a83('0x8a'),'parent_incident',_0x2a83('0x8b'),_0x2a83('0x8c'),_0x2a83('0x8d'),_0x2a83('0x63'),'urgency',_0x2a83('0x8e'),_0x2a83('0x8f'),_0x2a83('0x90'),_0x2a83('0x91'),'assigned_to','severity',_0x2a83('0x92'),_0x2a83('0x93'),_0x2a83('0x94'),_0x2a83('0x95'),'due_date',_0x2a83('0x96'),_0x2a83('0x97'),'sys_tags',_0x2a83('0x98'),'upon_approval',_0x2a83('0x99'),_0x2a83('0x9a'),_0x2a83('0x65')];var _0xef265f='';var _0x543a93='';var _0x3c98cf=[];var _0x44afcd='';var _0x252d37='';var _0x41c5ea=[];var _0xc8598f='';var _0x1a00f8='';var _0x5e6dba={};var _0x491922='';return db[_0x2a83('0x48')]['findOne']({'where':{'id':_0xf32e9c[_0x2a83('0x4c')]['id']},'attributes':['id','username',_0x2a83('0x9b'),_0x2a83('0x9c'),_0x2a83('0x9d'),'serverUrl']})['then'](handleEntityNotFound(_0x84f9a5,null))[_0x2a83('0x19')](function(_0x5e6fb9){if(_0x5e6fb9){_0x491922=_0x5e6fb9[_0x2a83('0x9d')];var _0x3ba92a=_0x491922[_0x2a83('0x9e')](-0x1);if(_0x3ba92a==='/'){_0x491922=_0x491922[_0x2a83('0x9f')](0x0,_0x491922[_0x2a83('0xa0')](_0x3ba92a));}_0x1a00f8=util['format'](_0x2a83('0xa1'),_0x491922);_0xc8598f=util[_0x2a83('0xa2')](_0x2a83('0xa3'),_0x491922);_0x5e6dba={'user':_0x5e6fb9['username'],'pass':_0x5e6fb9[_0x2a83('0x9b')]};var _0x101664={'method':_0x2a83('0xa4'),'uri':_0x1a00f8+_0x2a83('0xa5'),'auth':_0x5e6dba,'json':!![]};return rp(_0x101664);}})[_0x2a83('0x19')](function(_0x26df73){if(_0x26df73[_0x2a83('0x21')]['length']>0x0){_0xef265f=_0x26df73[_0x2a83('0x21')];}console[_0x2a83('0xa6')](_0x2a83('0xa7'),_0xef265f);_0x41c5ea=[];_0x543a93=Object[_0x2a83('0xa8')]([],_0xef265f);_['remove'](_0x543a93,function(_0x89fcb2){return!_0xfd081a[_0x2a83('0xa9')](_0x89fcb2[_0x2a83('0x2f')]);});_0x543a93[_0x2a83('0xaa')](function(_0x5d5145){var _0x5dae51=createFieldObject(_0xc8598f,_0x5e6dba,_0x5d5145[_0x2a83('0xab')],_0x5d5145[_0x2a83('0x2f')],_0x5d5145[_0x2a83('0xac')],![]);_0x41c5ea[_0x2a83('0xad')](_0x5dae51);});return Promise[_0x2a83('0xae')](_0x41c5ea);})['then'](function(_0x375c10){_0x3c98cf=_0x375c10;_0x44afcd=Object[_0x2a83('0xa8')]([],_0xef265f);console['log']('TCL:\x20_object',_0xef265f);_[_0x2a83('0xaf')](_0x44afcd,function(_0xca0782){return _0x350eb8[_0x2a83('0xa9')](_0xca0782[_0x2a83('0x2f')]);});console[_0x2a83('0xa6')](_0x2a83('0xb0'),_0x44afcd);_0x41c5ea=[];_0x44afcd[_0x2a83('0xaa')](function(_0x4762d5){var _0x25d3f0=createFieldObject(_0xc8598f,_0x5e6dba,_0x4762d5[_0x2a83('0xab')],_0x4762d5[_0x2a83('0x2f')],_0x4762d5['label'],!![]);_0x41c5ea[_0x2a83('0xad')](_0x25d3f0);});return Promise[_0x2a83('0xae')](_0x41c5ea);})['then'](function(_0x49898b){_0x252d37=_0x49898b;var _0x31a8bb=_0x3c98cf['concat'](_0x252d37);return{'count':_0x31a8bb['length'],'rows':_0x31a8bb};})['then'](respondWithResult(_0x84f9a5,null))['catch'](function(_0x366083){console['log']('ServiceNow\x20error:\x20'+_0x366083);var _0x1a92f2=_0xf32e9c[_0x2a83('0x38')]['test']?0x1f4:_0x366083['statusCode']||0x1f4;logger[_0x2a83('0x1e')](_0x366083[_0x2a83('0x2e')]);delete _0x366083[_0x2a83('0x2f')];if(_0x1a92f2===0x191){_0x1a92f2=0x190;}_0x84f9a5[_0x2a83('0x23')](_0x1a92f2)['send'](_0xf32e9c[_0x2a83('0x38')][_0x2a83('0xb1')]?{'message':'Wrong\x20credentials','statusCode':_0x366083[_0x2a83('0xb2')]}:_0x366083);});};function createFieldObject(_0x115da6,_0x3c307e,_0x1b8496,_0x23b112,_0x36f40b,_0x17fbf5){return new Promise(function(_0xe26692,_0x2ee328){var _0x439483={'id':_0x23b112,'name':_0x36f40b,'custom':_0x17fbf5};if(_0x1b8496===_0x2a83('0xb3')){_0x439483[_0x2a83('0x47')]=[{'name':_0x2a83('0xb4'),'value':'true'},{'name':_0x2a83('0xb5'),'value':_0x2a83('0xb6')}];_0xe26692(_0x439483);}else{var _0x36d139={'method':_0x2a83('0xa4'),'uri':_0x115da6+_0x2a83('0xb7')+_0x23b112,'auth':_0x3c307e,'json':!![]};return rp(_0x36d139)[_0x2a83('0x19')](function(_0x972824){var _0x4e0ad3=[];if(_0x972824[_0x2a83('0x21')][_0x2a83('0x3d')]>0x0){_0x972824[_0x2a83('0x21')]['forEach'](function(_0x27c539){if(_0x27c539['inactive']===_0x2a83('0xb6')){var _0x1541da={'name':_0x27c539['label'],'value':_0x27c539[_0x2a83('0xb8')]};_0x4e0ad3[_0x2a83('0xad')](_0x1541da);}});}_0x439483[_0x2a83('0x47')]=_0x4e0ad3;if(_0x439483[_0x2a83('0x47')][_0x2a83('0x3d')]>0x0){_0xe26692(_0x439483);}else{if(_0x17fbf5==![]){_0xe26692();}else{_0xe26692(_0x439483);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 6f5a690..0398b57 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 _0xe0ae=['ServicenowAccount','../../config/logger','api','bluebird','path','rimraf','./intServicenowAccount.attributes','define'];(function(_0x5999bb,_0x40b8e2){var _0x1f0b8f=function(_0x2414e6){while(--_0x2414e6){_0x5999bb['push'](_0x5999bb['shift']());}};_0x1f0b8f(++_0x40b8e2);}(_0xe0ae,0xa1));var _0xee0a=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xe0ae[_0xd0a847];return _0x2536ec;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee0a('0x0'))(_0xee0a('0x1'));var moment=require('moment');var BPromise=require(_0xee0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee0a('0x3'));var rimraf=require(_0xee0a('0x4'));var config=require('../../config/environment');var attributes=require(_0xee0a('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x39a302,_0x1c5071){return _0x39a302[_0xee0a('0x6')](_0xee0a('0x7'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98a8=['ServicenowAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x371b93,_0xef6ac8){var _0x259b8d=function(_0x3d0c86){while(--_0x3d0c86){_0x371b93['push'](_0x371b93['shift']());}};_0x259b8d(++_0xef6ac8);}(_0x98a8,0x12c));var _0x898a=function(_0x4dfaa1,_0x43745c){_0x4dfaa1=_0x4dfaa1-0x0;var _0x2ef826=_0x98a8[_0x4dfaa1];return _0x2ef826;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var attributes=require(_0x898a('0x9'));var integrations=require(_0x898a('0xa'));module[_0x898a('0xb')]=function(_0x5d7e59,_0x3aadc2){return _0x5d7e59['define'](_0x898a('0xc'),attributes,{'tableName':'int_servicenow_accounts','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 761c163..0be5032 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 _0x860c=['ShowServicenowAccount','where','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','code','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','ServicenowAccount','findAll','options','raw','attributes','limit','include','model','map','GetServicenowAccount','stringify'];(function(_0x12b7b7,_0x2196c3){var _0x261741=function(_0x447f1d){while(--_0x447f1d){_0x12b7b7['push'](_0x12b7b7['shift']());}};_0x261741(++_0x2196c3);}(_0x860c,0xc8));var _0xc860=function(_0x274dc1,_0x26527b){_0x274dc1=_0x274dc1-0x0;var _0x489bda=_0x860c[_0x274dc1];return _0x489bda;};'use strict';var _=require('lodash');var util=require(_0xc860('0x0'));var moment=require('moment');var BPromise=require(_0xc860('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc860('0x2'))['db'];var utils=require(_0xc860('0x3'));var logger=require('../../config/logger')(_0xc860('0x4'));var config=require(_0xc860('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xc860('0x6')][_0xc860('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a000a,_0x2d7f29,_0x147181){return new BPromise(function(_0x5f075f,_0x47a62a){return client[_0xc860('0x8')](_0x5a000a,_0x147181)[_0xc860('0x9')](function(_0x541fe9){logger[_0xc860('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x2d7f29,_0xc860('0xb'));logger[_0xc860('0xc')](_0xc860('0xd'),_0x2d7f29,_0xc860('0xb'),JSON['stringify'](_0x541fe9));if(_0x541fe9['error']){if(_0x541fe9['error'][_0xc860('0xe')]===0x1f4){logger[_0xc860('0xf')](_0xc860('0x10'),_0x2d7f29,_0x541fe9['error'][_0xc860('0x11')]);return _0x47a62a(_0x541fe9[_0xc860('0xf')]['message']);}logger['error'](_0xc860('0x10'),_0x2d7f29,_0x541fe9[_0xc860('0xf')][_0xc860('0x11')]);return _0x5f075f(_0x541fe9[_0xc860('0xf')][_0xc860('0x11')]);}else{logger['info'](_0xc860('0x10'),_0x2d7f29,_0xc860('0xb'));_0x5f075f(_0x541fe9[_0xc860('0x12')][_0xc860('0x11')]);}})[_0xc860('0x13')](function(_0x515a77){logger[_0xc860('0xf')](_0xc860('0x10'),_0x2d7f29,_0x515a77);_0x47a62a(_0x515a77);});});}exports['GetServicenowAccount']=function(_0xd9b57c){var _0x4db2f3=this;return new Promise(function(_0x3fedb6,_0x371d71){return db[_0xc860('0x14')][_0xc860('0x15')]({'raw':_0xd9b57c[_0xc860('0x16')]?_0xd9b57c[_0xc860('0x16')][_0xc860('0x17')]===undefined?!![]:![]:!![],'where':_0xd9b57c[_0xc860('0x16')]?_0xd9b57c[_0xc860('0x16')]['where']||null:null,'attributes':_0xd9b57c[_0xc860('0x16')]?_0xd9b57c[_0xc860('0x16')][_0xc860('0x18')]||null:null,'limit':_0xd9b57c[_0xc860('0x16')]?_0xd9b57c['options'][_0xc860('0x19')]||null:null,'include':_0xd9b57c[_0xc860('0x16')]?_0xd9b57c[_0xc860('0x16')][_0xc860('0x1a')]?_['map'](_0xd9b57c[_0xc860('0x16')][_0xc860('0x1a')],function(_0x31d823){return{'model':db[_0x31d823[_0xc860('0x1b')]],'as':_0x31d823['as'],'attributes':_0x31d823[_0xc860('0x18')],'include':_0x31d823['include']?_[_0xc860('0x1c')](_0x31d823['include'],function(_0x2e4d6a){return{'model':db[_0x2e4d6a[_0xc860('0x1b')]],'as':_0x2e4d6a['as'],'attributes':_0x2e4d6a[_0xc860('0x18')],'include':_0x2e4d6a[_0xc860('0x1a')]?_[_0xc860('0x1c')](_0x2e4d6a[_0xc860('0x1a')],function(_0x1ace60){return{'model':db[_0x1ace60['model']],'as':_0x1ace60['as'],'attributes':_0x1ace60['attributes']};}):[]};}):[]};}):[]:[]})[_0xc860('0x9')](function(_0x4f9a28){logger[_0xc860('0xa')](_0xc860('0x1d'),_0xd9b57c);logger[_0xc860('0xc')]('GetServicenowAccount',_0xd9b57c,JSON[_0xc860('0x1e')](_0x4f9a28));_0x3fedb6(_0x4f9a28);})[_0xc860('0x13')](function(_0x2ca9b8){logger['error']('GetServicenowAccount',_0x2ca9b8[_0xc860('0x11')],_0xd9b57c);_0x371d71(_0x4db2f3['error'](0x1f4,_0x2ca9b8['message']));});});};exports[_0xc860('0x1f')]=function(_0xa59f11){var _0x160316=this;return new Promise(function(_0x205333,_0x3fd6dd){return db[_0xc860('0x14')]['find']({'raw':_0xa59f11[_0xc860('0x16')]?_0xa59f11['options'][_0xc860('0x17')]===undefined?!![]:![]:!![],'where':_0xa59f11[_0xc860('0x16')]?_0xa59f11['options'][_0xc860('0x20')]||null:null,'attributes':_0xa59f11[_0xc860('0x16')]?_0xa59f11['options'][_0xc860('0x18')]||null:null,'include':_0xa59f11[_0xc860('0x16')]?_0xa59f11[_0xc860('0x16')][_0xc860('0x1a')]?_[_0xc860('0x1c')](_0xa59f11['options'][_0xc860('0x1a')],function(_0x250c40){return{'model':db[_0x250c40[_0xc860('0x1b')]],'as':_0x250c40['as'],'attributes':_0x250c40[_0xc860('0x18')],'include':_0x250c40[_0xc860('0x1a')]?_[_0xc860('0x1c')](_0x250c40[_0xc860('0x1a')],function(_0x45abc4){return{'model':db[_0x45abc4[_0xc860('0x1b')]],'as':_0x45abc4['as'],'attributes':_0x45abc4[_0xc860('0x18')],'include':_0x45abc4[_0xc860('0x1a')]?_[_0xc860('0x1c')](_0x45abc4[_0xc860('0x1a')],function(_0x4f61df){return{'model':db[_0x4f61df['model']],'as':_0x4f61df['as'],'attributes':_0x4f61df[_0xc860('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2da75e){logger['info'](_0xc860('0x1f'),_0xa59f11);logger[_0xc860('0xc')](_0xc860('0x1f'),_0xa59f11,JSON[_0xc860('0x1e')](_0x2da75e));_0x205333(_0x2da75e);})[_0xc860('0x13')](function(_0x11fb26){logger[_0xc860('0xf')](_0xc860('0x1f'),_0x11fb26['message'],_0xa59f11);_0x3fd6dd(_0x160316[_0xc860('0xf')](0x1f4,_0x11fb26[_0xc860('0x11')]));});});}; \ No newline at end of file +var _0x44b3=['message','result','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','map','model','include','ShowServicenowAccount','ServicenowAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c3cd2,_0x3477e0){var _0x48bc3e=function(_0x234356){while(--_0x234356){_0x4c3cd2['push'](_0x4c3cd2['shift']());}};_0x48bc3e(++_0x3477e0);}(_0x44b3,0x178));var _0x344b=function(_0x23e52c,_0x3b86c6){_0x23e52c=_0x23e52c-0x0;var _0x21f869=_0x44b3[_0x23e52c];return _0x21f869;};'use strict';var _=require(_0x344b('0x0'));var util=require(_0x344b('0x1'));var moment=require('moment');var BPromise=require(_0x344b('0x2'));var rs=require(_0x344b('0x3'));var fs=require('fs');var Redis=require(_0x344b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x344b('0x5'));var logger=require(_0x344b('0x6'))('rpc');var config=require(_0x344b('0x7'));var jayson=require(_0x344b('0x8'));var client=jayson[_0x344b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b1118,_0x161083,_0x136830){return new BPromise(function(_0x5c3a0d,_0x43e754){return client[_0x344b('0xa')](_0x1b1118,_0x136830)[_0x344b('0xb')](function(_0x19d974){logger[_0x344b('0xc')](_0x344b('0xd'),_0x161083,_0x344b('0xe'));logger[_0x344b('0xf')](_0x344b('0x10'),_0x161083,_0x344b('0xe'),JSON[_0x344b('0x11')](_0x19d974));if(_0x19d974[_0x344b('0x12')]){if(_0x19d974[_0x344b('0x12')][_0x344b('0x13')]===0x1f4){logger[_0x344b('0x12')](_0x344b('0xd'),_0x161083,_0x19d974[_0x344b('0x12')][_0x344b('0x14')]);return _0x43e754(_0x19d974['error'][_0x344b('0x14')]);}logger['error'](_0x344b('0xd'),_0x161083,_0x19d974['error']['message']);return _0x5c3a0d(_0x19d974['error'][_0x344b('0x14')]);}else{logger['info'](_0x344b('0xd'),_0x161083,_0x344b('0xe'));_0x5c3a0d(_0x19d974[_0x344b('0x15')][_0x344b('0x14')]);}})[_0x344b('0x16')](function(_0x2e20f9){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x161083,_0x2e20f9);_0x43e754(_0x2e20f9);});});}exports[_0x344b('0x17')]=function(_0x5c0599){var _0x288941=this;return new Promise(function(_0x33942a,_0x24b704){return db['ServicenowAccount'][_0x344b('0x18')]({'raw':_0x5c0599[_0x344b('0x19')]?_0x5c0599[_0x344b('0x19')][_0x344b('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c0599[_0x344b('0x19')]?_0x5c0599[_0x344b('0x19')][_0x344b('0x1b')]||null:null,'attributes':_0x5c0599['options']?_0x5c0599[_0x344b('0x19')][_0x344b('0x1c')]||null:null,'limit':_0x5c0599[_0x344b('0x19')]?_0x5c0599[_0x344b('0x19')][_0x344b('0x1d')]||null:null,'include':_0x5c0599[_0x344b('0x19')]?_0x5c0599[_0x344b('0x19')]['include']?_[_0x344b('0x1e')](_0x5c0599[_0x344b('0x19')]['include'],function(_0x34ff34){return{'model':db[_0x34ff34[_0x344b('0x1f')]],'as':_0x34ff34['as'],'attributes':_0x34ff34[_0x344b('0x1c')],'include':_0x34ff34[_0x344b('0x20')]?_['map'](_0x34ff34[_0x344b('0x20')],function(_0x1bebbf){return{'model':db[_0x1bebbf[_0x344b('0x1f')]],'as':_0x1bebbf['as'],'attributes':_0x1bebbf[_0x344b('0x1c')],'include':_0x1bebbf['include']?_[_0x344b('0x1e')](_0x1bebbf[_0x344b('0x20')],function(_0x190531){return{'model':db[_0x190531[_0x344b('0x1f')]],'as':_0x190531['as'],'attributes':_0x190531[_0x344b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x344b('0xb')](function(_0x20e74b){logger['info'](_0x344b('0x17'),_0x5c0599);logger[_0x344b('0xf')](_0x344b('0x17'),_0x5c0599,JSON[_0x344b('0x11')](_0x20e74b));_0x33942a(_0x20e74b);})[_0x344b('0x16')](function(_0x367878){logger[_0x344b('0x12')](_0x344b('0x17'),_0x367878[_0x344b('0x14')],_0x5c0599);_0x24b704(_0x288941[_0x344b('0x12')](0x1f4,_0x367878['message']));});});};exports[_0x344b('0x21')]=function(_0x1efe47){var _0x97ee48=this;return new Promise(function(_0x1f538d,_0x82dc4b){return db[_0x344b('0x22')][_0x344b('0x23')]({'raw':_0x1efe47[_0x344b('0x19')]?_0x1efe47['options']['raw']===undefined?!![]:![]:!![],'where':_0x1efe47[_0x344b('0x19')]?_0x1efe47['options'][_0x344b('0x1b')]||null:null,'attributes':_0x1efe47[_0x344b('0x19')]?_0x1efe47[_0x344b('0x19')][_0x344b('0x1c')]||null:null,'include':_0x1efe47[_0x344b('0x19')]?_0x1efe47[_0x344b('0x19')]['include']?_[_0x344b('0x1e')](_0x1efe47[_0x344b('0x19')][_0x344b('0x20')],function(_0x1e6034){return{'model':db[_0x1e6034[_0x344b('0x1f')]],'as':_0x1e6034['as'],'attributes':_0x1e6034[_0x344b('0x1c')],'include':_0x1e6034[_0x344b('0x20')]?_['map'](_0x1e6034[_0x344b('0x20')],function(_0x1f9c57){return{'model':db[_0x1f9c57[_0x344b('0x1f')]],'as':_0x1f9c57['as'],'attributes':_0x1f9c57[_0x344b('0x1c')],'include':_0x1f9c57[_0x344b('0x20')]?_[_0x344b('0x1e')](_0x1f9c57['include'],function(_0x554854){return{'model':db[_0x554854[_0x344b('0x1f')]],'as':_0x554854['as'],'attributes':_0x554854[_0x344b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bc116){logger[_0x344b('0xc')](_0x344b('0x21'),_0x1efe47);logger[_0x344b('0xf')](_0x344b('0x21'),_0x1efe47,JSON[_0x344b('0x11')](_0x5bc116));_0x1f538d(_0x5bc116);})[_0x344b('0x16')](function(_0x5946f7){logger[_0x344b('0x12')](_0x344b('0x21'),_0x5946f7['message'],_0x1efe47);_0x82dc4b(_0x97ee48[_0x344b('0x12')](0x1f4,_0x5946f7['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 041965f..c4d1d6c 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 _0xdf6d=['put','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x1715af,_0x30a87f){var _0x33dc26=function(_0x434846){while(--_0x434846){_0x1715af['push'](_0x1715af['shift']());}};_0x33dc26(++_0x30a87f);}(_0xdf6d,0x1d3));var _0xddf6=function(_0x1955f8,_0x48cd83){_0x1955f8=_0x1955f8-0x0;var _0x6fefc8=_0xdf6d[_0x1955f8];return _0x6fefc8;};'use strict';var multer=require(_0xddf6('0x0'));var util=require(_0xddf6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xddf6('0x2'));var router=express['Router']();var auth=require(_0xddf6('0x3'));var interaction=require(_0xddf6('0x4'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router[_0xddf6('0x5')]('/',auth[_0xddf6('0x6')](),controller['index']);router['get'](_0xddf6('0x7'),auth[_0xddf6('0x6')](),controller[_0xddf6('0x8')]);router['get'](_0xddf6('0x9'),auth[_0xddf6('0x6')](),controller[_0xddf6('0xa')]);router[_0xddf6('0x5')](_0xddf6('0xb'),auth[_0xddf6('0x6')](),controller[_0xddf6('0xc')]);router[_0xddf6('0x5')](_0xddf6('0xd'),auth[_0xddf6('0x6')](),controller[_0xddf6('0xe')]);router[_0xddf6('0xf')]('/',auth['isAuthenticated'](),controller[_0xddf6('0x10')]);router[_0xddf6('0x11')](_0xddf6('0x7'),auth['isAuthenticated'](),controller[_0xddf6('0x12')]);router[_0xddf6('0x13')]('/:id',auth[_0xddf6('0x6')](),controller[_0xddf6('0x14')]);module[_0xddf6('0x15')]=router; \ No newline at end of file +var _0xe6b5=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer'];(function(_0x21d37c,_0x403463){var _0x2c3a8b=function(_0x3bbea2){while(--_0x3bbea2){_0x21d37c['push'](_0x21d37c['shift']());}};_0x2c3a8b(++_0x403463);}(_0xe6b5,0x167));var _0x5e6b=function(_0x13c9f2,_0x2f202c){_0x13c9f2=_0x13c9f2-0x0;var _0xf57d2f=_0xe6b5[_0x13c9f2];return _0xf57d2f;};'use strict';var multer=require(_0x5e6b('0x0'));var util=require(_0x5e6b('0x1'));var path=require(_0x5e6b('0x2'));var timeout=require(_0x5e6b('0x3'));var express=require(_0x5e6b('0x4'));var router=express[_0x5e6b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5e6b('0x6'));var config=require(_0x5e6b('0x7'));var controller=require(_0x5e6b('0x8'));router[_0x5e6b('0x9')]('/',auth[_0x5e6b('0xa')](),controller[_0x5e6b('0xb')]);router[_0x5e6b('0x9')](_0x5e6b('0xc'),auth[_0x5e6b('0xa')](),controller['show']);router[_0x5e6b('0x9')](_0x5e6b('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x5e6b('0x9')](_0x5e6b('0xe'),auth['isAuthenticated'](),controller[_0x5e6b('0xf')]);router[_0x5e6b('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5e6b('0x10')]);router[_0x5e6b('0x11')]('/',auth[_0x5e6b('0xa')](),controller[_0x5e6b('0x12')]);router[_0x5e6b('0x13')](_0x5e6b('0xc'),auth['isAuthenticated'](),controller[_0x5e6b('0x14')]);router[_0x5e6b('0x15')](_0x5e6b('0xc'),auth[_0x5e6b('0xa')](),controller[_0x5e6b('0x16')]);module[_0x5e6b('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 955b09d..bcc95dd 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 _0x1a7f=['sequelize','STRING'];(function(_0x5db6bc,_0x317023){var _0xc1c9a5=function(_0x34b350){while(--_0x34b350){_0x5db6bc['push'](_0x5db6bc['shift']());}};_0xc1c9a5(++_0x317023);}(_0x1a7f,0x172));var _0xf1a7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1a7f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xf1a7('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf1a7('0x1')]}}; \ No newline at end of file +var _0x44f9=['exports'];(function(_0x53758c,_0x5664af){var _0x425eff=function(_0x3d0c89){while(--_0x3d0c89){_0x53758c['push'](_0x53758c['shift']());}};_0x425eff(++_0x5664af);}(_0x44f9,0x7e));var _0x944f=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x44f9[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require('sequelize');module[_0x944f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index f123ffc..9b0fc8c 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 _0x2e69=['ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getFields','findOne','ServicenowField','order','pick','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','stack','name','send','index'];(function(_0x25f3d6,_0x3b5950){var _0x91c9fc=function(_0x574859){while(--_0x574859){_0x25f3d6['push'](_0x25f3d6['shift']());}};_0x91c9fc(++_0x3b5950);}(_0x2e69,0x141));var _0x92e6=function(_0x50d239,_0x1de8d7){_0x50d239=_0x50d239-0x0;var _0x583b61=_0x2e69[_0x50d239];return _0x583b61;};'use strict';var pdf=require(_0x92e6('0x0'));var emlformat=require(_0x92e6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x92e6('0x2'));var rp=require(_0x92e6('0x3'));var moment=require(_0x92e6('0x4'));var BPromise=require(_0x92e6('0x5'));var Mustache=require(_0x92e6('0x6'));var util=require(_0x92e6('0x7'));var path=require(_0x92e6('0x8'));var sox=require(_0x92e6('0x9'));var csv=require(_0x92e6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x92e6('0xb'));var squel=require(_0x92e6('0xc'));var crypto=require(_0x92e6('0xd'));var jsforce=require(_0x92e6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x92e6('0xa'));var querystring=require(_0x92e6('0xf'));var Papa=require(_0x92e6('0x10'));var Redis=require(_0x92e6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x92e6('0x12'));var as=require(_0x92e6('0x13'));var hardwareService=require(_0x92e6('0x14'));var logger=require('../../config/logger')(_0x92e6('0x15'));var utils=require(_0x92e6('0x16'));var config=require(_0x92e6('0x17'));var licenseUtil=require(_0x92e6('0x18'));var db=require(_0x92e6('0x19'))['db'];var jayson=require(_0x92e6('0x1a'));var client=jayson[_0x92e6('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x323b3b,_0x4e8cc0,_0x127063,_0x3c7cdb){return new BPromise(function(_0x4fa79d,_0x1a4b7e){var _0x421218=_0x3c7cdb||client;return _0x421218[_0x92e6('0x1c')](_0x323b3b,_0x127063)[_0x92e6('0x1d')](function(_0x527a84){logger[_0x92e6('0x1e')](_0x92e6('0x1f'),_0x4e8cc0,_0x92e6('0x20'));logger['debug'](_0x92e6('0x21'),_0x4e8cc0,'request\x20sent',JSON['stringify'](_0x527a84));if(_0x527a84[_0x92e6('0x22')]){if(_0x527a84[_0x92e6('0x22')][_0x92e6('0x23')]===0x1f4){logger[_0x92e6('0x22')](_0x92e6('0x1f'),_0x4e8cc0,_0x527a84[_0x92e6('0x22')][_0x92e6('0x24')]);return _0x1a4b7e(_0x527a84[_0x92e6('0x22')]['message']);}logger[_0x92e6('0x22')](_0x92e6('0x1f'),_0x4e8cc0,_0x527a84[_0x92e6('0x22')]['message']);return _0x4fa79d(_0x527a84[_0x92e6('0x22')]['message']);}else{logger[_0x92e6('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4e8cc0,_0x92e6('0x20'));_0x4fa79d(_0x527a84[_0x92e6('0x25')][_0x92e6('0x24')]);}})[_0x92e6('0x26')](function(_0x19a857){logger['error'](_0x92e6('0x1f'),_0x4e8cc0,_0x19a857);_0x1a4b7e(_0x19a857);});});}function respondWithStatusCode(_0x1773f5,_0x30ed6d){_0x30ed6d=_0x30ed6d||0xcc;return function(_0x263a11){if(_0x263a11){return _0x1773f5[_0x92e6('0x27')](_0x30ed6d);}return _0x1773f5[_0x92e6('0x28')](_0x30ed6d)[_0x92e6('0x29')]();};}function respondWithResult(_0x4c2125,_0x546923){_0x546923=_0x546923||0xc8;return function(_0x997a70){if(_0x997a70){return _0x4c2125[_0x92e6('0x28')](_0x546923)[_0x92e6('0x2a')](_0x997a70);}};}function respondWithFilteredResult(_0x54fd8,_0x219ec2){return function(_0x2af5d0){if(_0x2af5d0){var _0x40b915=_0x2af5d0[_0x92e6('0x2b')],_0x2bbd64=_0x219ec2[_0x92e6('0x2c')],_0x27bc59=_0x219ec2[_0x92e6('0x2c')]+_0x219ec2[_0x92e6('0x2d')],_0x4f268e;if(_0x27bc59>=_0x40b915){_0x27bc59=_0x40b915;_0x4f268e=0xc8;}else{_0x4f268e=0xce;}_0x54fd8[_0x92e6('0x28')](_0x4f268e);return _0x54fd8[_0x92e6('0x2e')](_0x92e6('0x2f'),_0x2bbd64+'-'+_0x27bc59+'/'+_0x40b915)[_0x92e6('0x2a')](_0x2af5d0);}return null;};}function patchUpdates(_0x37559f){return function(_0x3be770){try{jsonpatch['apply'](_0x3be770,_0x37559f,!![]);}catch(_0xbc9675){return BPromise[_0x92e6('0x30')](_0xbc9675);}return _0x3be770[_0x92e6('0x31')]();};}function saveUpdates(_0x3656e9,_0x2fa634){return function(_0x31f4c2){if(_0x31f4c2){return _0x31f4c2[_0x92e6('0x32')](_0x3656e9)[_0x92e6('0x1d')](function(_0x2b9e1d){return _0x2b9e1d;});}return null;};}function removeEntity(_0x4c96ab,_0x1573bf){return function(_0x4abed1){if(_0x4abed1){return _0x4abed1['destroy']()[_0x92e6('0x1d')](function(){_0x4c96ab[_0x92e6('0x28')](0xcc)[_0x92e6('0x29')]();});}};}function handleEntityNotFound(_0x1d1d8d,_0x30fcdc){return function(_0x24648b){if(!_0x24648b){_0x1d1d8d[_0x92e6('0x27')](0x194);}return _0x24648b;};}function handleError(_0x8a7e59,_0x5e008f){_0x5e008f=_0x5e008f||0x1f4;return function(_0xa98ef1){logger[_0x92e6('0x22')](_0xa98ef1[_0x92e6('0x33')]);if(_0xa98ef1[_0x92e6('0x34')]){delete _0xa98ef1[_0x92e6('0x34')];}_0x8a7e59[_0x92e6('0x28')](_0x5e008f)[_0x92e6('0x35')](_0xa98ef1);};}exports[_0x92e6('0x36')]=function(_0x4e49fd,_0x187376){var _0x3ce5cf={},_0x5c9df8={},_0x431d59={'count':0x0,'rows':[]};var _0x29cdef=_['map'](db[_0x92e6('0x37')][_0x92e6('0x38')],function(_0x5825d9){return{'name':_0x5825d9[_0x92e6('0x39')],'type':_0x5825d9[_0x92e6('0x3a')][_0x92e6('0x3b')]};});_0x5c9df8[_0x92e6('0x3c')]=_[_0x92e6('0x3d')](_0x29cdef,_0x92e6('0x34'));_0x5c9df8[_0x92e6('0x3e')]=_[_0x92e6('0x3f')](_0x4e49fd['query']);_0x5c9df8[_0x92e6('0x40')]=_[_0x92e6('0x41')](_0x5c9df8[_0x92e6('0x3c')],_0x5c9df8[_0x92e6('0x3e')]);_0x3ce5cf[_0x92e6('0x42')]=_[_0x92e6('0x41')](_0x5c9df8[_0x92e6('0x3c')],qs[_0x92e6('0x43')](_0x4e49fd['query']['fields']));_0x3ce5cf[_0x92e6('0x42')]=_0x3ce5cf[_0x92e6('0x42')][_0x92e6('0x44')]?_0x3ce5cf[_0x92e6('0x42')]:_0x5c9df8[_0x92e6('0x3c')];if(!_0x4e49fd[_0x92e6('0x3e')]['hasOwnProperty'](_0x92e6('0x45'))){_0x3ce5cf['limit']=qs[_0x92e6('0x2d')](_0x4e49fd[_0x92e6('0x3e')]['limit']);_0x3ce5cf[_0x92e6('0x2c')]=qs[_0x92e6('0x2c')](_0x4e49fd[_0x92e6('0x3e')]['offset']);}_0x3ce5cf['order']=qs[_0x92e6('0x46')](_0x4e49fd['query'][_0x92e6('0x46')]);_0x3ce5cf['where']=qs[_0x92e6('0x40')](_['pick'](_0x4e49fd['query'],_0x5c9df8[_0x92e6('0x40')]),_0x29cdef);if(_0x4e49fd[_0x92e6('0x3e')][_0x92e6('0x47')]){_0x3ce5cf['where']=_[_0x92e6('0x48')](_0x3ce5cf[_0x92e6('0x49')],{'$or':_[_0x92e6('0x3d')](_0x29cdef,function(_0x134351){if(_0x134351[_0x92e6('0x3a')]!==_0x92e6('0x4a')){var _0x57d0e4={};_0x57d0e4[_0x134351[_0x92e6('0x34')]]={'$like':'%'+_0x4e49fd[_0x92e6('0x3e')]['filter']+'%'};return _0x57d0e4;}})});}_0x3ce5cf=_[_0x92e6('0x48')]({},_0x3ce5cf,_0x4e49fd[_0x92e6('0x4b')]);var _0x38ce73={'where':_0x3ce5cf['where']};return db[_0x92e6('0x37')][_0x92e6('0x2b')](_0x38ce73)[_0x92e6('0x1d')](function(_0x109e5a){_0x431d59[_0x92e6('0x2b')]=_0x109e5a;if(_0x4e49fd['query'][_0x92e6('0x4c')]){_0x3ce5cf[_0x92e6('0x4d')]=[{'all':!![]}];}return db[_0x92e6('0x37')][_0x92e6('0x4e')](_0x3ce5cf);})[_0x92e6('0x1d')](function(_0x495b40){_0x431d59[_0x92e6('0x4f')]=_0x495b40;return _0x431d59;})[_0x92e6('0x1d')](respondWithFilteredResult(_0x187376,_0x3ce5cf))['catch'](handleError(_0x187376,null));};exports[_0x92e6('0x50')]=function(_0x464859,_0x4f4078){var _0x1370a7={'raw':![],'where':{'id':_0x464859[_0x92e6('0x51')]['id']}},_0x1c146d={};_0x1c146d[_0x92e6('0x3c')]=_[_0x92e6('0x3f')](db[_0x92e6('0x37')][_0x92e6('0x38')]);_0x1c146d[_0x92e6('0x3e')]=_[_0x92e6('0x3f')](_0x464859[_0x92e6('0x3e')]);_0x1c146d[_0x92e6('0x40')]=_['intersection'](_0x1c146d[_0x92e6('0x3c')],_0x1c146d[_0x92e6('0x3e')]);_0x1370a7[_0x92e6('0x42')]=_[_0x92e6('0x41')](_0x1c146d[_0x92e6('0x3c')],qs['fields'](_0x464859['query'][_0x92e6('0x43')]));_0x1370a7[_0x92e6('0x42')]=_0x1370a7[_0x92e6('0x42')]['length']?_0x1370a7['attributes']:_0x1c146d[_0x92e6('0x3c')];if(_0x464859['query'][_0x92e6('0x4c')]){_0x1370a7[_0x92e6('0x4d')]=[{'all':!![]}];}_0x1370a7=_[_0x92e6('0x48')]({},_0x1370a7,_0x464859[_0x92e6('0x4b')]);return db[_0x92e6('0x37')][_0x92e6('0x52')](_0x1370a7)[_0x92e6('0x1d')](handleEntityNotFound(_0x4f4078,null))[_0x92e6('0x1d')](respondWithResult(_0x4f4078,null))[_0x92e6('0x26')](handleError(_0x4f4078,null));};exports['create']=function(_0xf0f75a,_0x380571){return db[_0x92e6('0x37')][_0x92e6('0x53')](_0xf0f75a['body'],{})[_0x92e6('0x1d')](respondWithResult(_0x380571,0xc9))[_0x92e6('0x26')](handleError(_0x380571,null));};exports[_0x92e6('0x32')]=function(_0x25f311,_0x47eaac){if(_0x25f311[_0x92e6('0x54')]['id']){delete _0x25f311[_0x92e6('0x54')]['id'];}return db['ServicenowConfiguration'][_0x92e6('0x52')]({'where':{'id':_0x25f311[_0x92e6('0x51')]['id']}})[_0x92e6('0x1d')](handleEntityNotFound(_0x47eaac,null))[_0x92e6('0x1d')](saveUpdates(_0x25f311[_0x92e6('0x54')],null))['then'](respondWithResult(_0x47eaac,null))[_0x92e6('0x26')](handleError(_0x47eaac,null));};exports[_0x92e6('0x55')]=function(_0x404f4a,_0x4b7880){return db[_0x92e6('0x37')][_0x92e6('0x52')]({'where':{'id':_0x404f4a[_0x92e6('0x51')]['id']}})['then'](handleEntityNotFound(_0x4b7880,null))[_0x92e6('0x1d')](removeEntity(_0x4b7880,null))['catch'](handleError(_0x4b7880,null));};exports[_0x92e6('0x56')]=function(_0x434daa,_0x4d7c5f,_0xc2fbca){var _0x8bc8db={};var _0x363527={};var _0x1974a1;var _0x5e3025;return db[_0x92e6('0x37')][_0x92e6('0x57')]({'where':{'id':_0x434daa[_0x92e6('0x51')]['id']}})[_0x92e6('0x1d')](handleEntityNotFound(_0x4d7c5f,null))['then'](function(_0x181dd9){if(_0x181dd9){_0x1974a1=_0x181dd9;_0x363527[_0x92e6('0x3c')]=_[_0x92e6('0x3f')](db[_0x92e6('0x58')]['rawAttributes']);_0x363527[_0x92e6('0x3e')]=_[_0x92e6('0x3f')](_0x434daa['query']);_0x363527[_0x92e6('0x40')]=_[_0x92e6('0x41')](_0x363527['model'],_0x363527[_0x92e6('0x3e')]);_0x8bc8db['attributes']=_[_0x92e6('0x41')](_0x363527['model'],qs[_0x92e6('0x43')](_0x434daa[_0x92e6('0x3e')][_0x92e6('0x43')]));_0x8bc8db[_0x92e6('0x42')]=_0x8bc8db[_0x92e6('0x42')][_0x92e6('0x44')]?_0x8bc8db[_0x92e6('0x42')]:_0x363527[_0x92e6('0x3c')];_0x8bc8db[_0x92e6('0x59')]=qs[_0x92e6('0x46')](_0x434daa['query'][_0x92e6('0x46')]);_0x8bc8db[_0x92e6('0x49')]=qs['filters'](_[_0x92e6('0x5a')](_0x434daa['query'],_0x363527[_0x92e6('0x40')]));if(_0x434daa[_0x92e6('0x3e')]['filter']){_0x8bc8db[_0x92e6('0x49')]=_[_0x92e6('0x48')](_0x8bc8db['where'],{'$or':_[_0x92e6('0x3d')](_0x8bc8db[_0x92e6('0x42')],function(_0x2ece0c){var _0x425857={};_0x425857[_0x2ece0c]={'$like':'%'+_0x434daa[_0x92e6('0x3e')][_0x92e6('0x47')]+'%'};return _0x425857;})});}_0x8bc8db=_[_0x92e6('0x48')]({},_0x8bc8db,_0x434daa['options']);return _0x1974a1['getFields'](_0x8bc8db);}})[_0x92e6('0x1d')](function(_0x4cf172){if(_0x4cf172){_0x5e3025=_0x4cf172['length'];if(!_0x434daa[_0x92e6('0x3e')][_0x92e6('0x5b')](_0x92e6('0x45'))){_0x8bc8db[_0x92e6('0x2d')]=qs[_0x92e6('0x2d')](_0x434daa[_0x92e6('0x3e')][_0x92e6('0x2d')]);_0x8bc8db[_0x92e6('0x2c')]=qs[_0x92e6('0x2c')](_0x434daa[_0x92e6('0x3e')]['offset']);}return _0x1974a1[_0x92e6('0x56')](_0x8bc8db);}})[_0x92e6('0x1d')](function(_0x228d85){if(_0x228d85){return _0x228d85?{'count':_0x5e3025,'rows':_0x228d85}:null;}})[_0x92e6('0x1d')](respondWithResult(_0x4d7c5f,null))[_0x92e6('0x26')](handleError(_0x4d7c5f,null));};exports[_0x92e6('0x5c')]=function(_0x1106cc,_0x36dacd,_0x19a0f5){var _0x5829a0={};var _0x9d01c8={};var _0x1ffcdf;var _0x40ef85;return db['ServicenowConfiguration'][_0x92e6('0x57')]({'where':{'id':_0x1106cc['params']['id']}})[_0x92e6('0x1d')](handleEntityNotFound(_0x36dacd,null))[_0x92e6('0x1d')](function(_0x9471b8){if(_0x9471b8){_0x1ffcdf=_0x9471b8;_0x9d01c8[_0x92e6('0x3c')]=_[_0x92e6('0x3f')](db['ServicenowField'][_0x92e6('0x38')]);_0x9d01c8[_0x92e6('0x3e')]=_[_0x92e6('0x3f')](_0x1106cc[_0x92e6('0x3e')]);_0x9d01c8[_0x92e6('0x40')]=_['intersection'](_0x9d01c8[_0x92e6('0x3c')],_0x9d01c8[_0x92e6('0x3e')]);_0x5829a0[_0x92e6('0x42')]=_['intersection'](_0x9d01c8[_0x92e6('0x3c')],qs[_0x92e6('0x43')](_0x1106cc[_0x92e6('0x3e')][_0x92e6('0x43')]));_0x5829a0[_0x92e6('0x42')]=_0x5829a0['attributes'][_0x92e6('0x44')]?_0x5829a0[_0x92e6('0x42')]:_0x9d01c8[_0x92e6('0x3c')];_0x5829a0[_0x92e6('0x59')]=qs[_0x92e6('0x46')](_0x1106cc['query'][_0x92e6('0x46')]);_0x5829a0['where']=qs[_0x92e6('0x40')](_[_0x92e6('0x5a')](_0x1106cc[_0x92e6('0x3e')],_0x9d01c8['filters']));if(_0x1106cc[_0x92e6('0x3e')][_0x92e6('0x47')]){_0x5829a0[_0x92e6('0x49')]=_['merge'](_0x5829a0[_0x92e6('0x49')],{'$or':_[_0x92e6('0x3d')](_0x5829a0['attributes'],function(_0x141f28){var _0x169dac={};_0x169dac[_0x141f28]={'$like':'%'+_0x1106cc[_0x92e6('0x3e')][_0x92e6('0x47')]+'%'};return _0x169dac;})});}_0x5829a0=_[_0x92e6('0x48')]({},_0x5829a0,_0x1106cc[_0x92e6('0x4b')]);return _0x1ffcdf[_0x92e6('0x5c')](_0x5829a0);}})['then'](function(_0x4e2c80){if(_0x4e2c80){_0x40ef85=_0x4e2c80['length'];if(!_0x1106cc['query'][_0x92e6('0x5b')](_0x92e6('0x45'))){_0x5829a0[_0x92e6('0x2d')]=qs['limit'](_0x1106cc[_0x92e6('0x3e')]['limit']);_0x5829a0['offset']=qs[_0x92e6('0x2c')](_0x1106cc['query'][_0x92e6('0x2c')]);}return _0x1ffcdf[_0x92e6('0x5c')](_0x5829a0);}})[_0x92e6('0x1d')](function(_0x299512){if(_0x299512){return _0x299512?{'count':_0x40ef85,'rows':_0x299512}:null;}})['then'](respondWithResult(_0x36dacd,null))[_0x92e6('0x26')](handleError(_0x36dacd,null));};exports[_0x92e6('0x5d')]=function(_0x3bab21,_0x497ac5,_0x3fadb1){var _0xb66c1d={};var _0xeceef6={};var _0x33161d;var _0x1b332f;return db[_0x92e6('0x37')][_0x92e6('0x57')]({'where':{'id':_0x3bab21['params']['id']}})[_0x92e6('0x1d')](handleEntityNotFound(_0x497ac5,null))['then'](function(_0xdde063){if(_0xdde063){_0x33161d=_0xdde063;_0xeceef6['model']=_[_0x92e6('0x3f')](db['ServicenowField'][_0x92e6('0x38')]);_0xeceef6[_0x92e6('0x3e')]=_[_0x92e6('0x3f')](_0x3bab21[_0x92e6('0x3e')]);_0xeceef6[_0x92e6('0x40')]=_[_0x92e6('0x41')](_0xeceef6['model'],_0xeceef6[_0x92e6('0x3e')]);_0xb66c1d['attributes']=_[_0x92e6('0x41')](_0xeceef6['model'],qs['fields'](_0x3bab21[_0x92e6('0x3e')]['fields']));_0xb66c1d['attributes']=_0xb66c1d['attributes'][_0x92e6('0x44')]?_0xb66c1d[_0x92e6('0x42')]:_0xeceef6[_0x92e6('0x3c')];_0xb66c1d[_0x92e6('0x59')]=qs[_0x92e6('0x46')](_0x3bab21[_0x92e6('0x3e')]['sort']);_0xb66c1d[_0x92e6('0x49')]=qs[_0x92e6('0x40')](_[_0x92e6('0x5a')](_0x3bab21[_0x92e6('0x3e')],_0xeceef6[_0x92e6('0x40')]));if(_0x3bab21[_0x92e6('0x3e')][_0x92e6('0x47')]){_0xb66c1d['where']=_[_0x92e6('0x48')](_0xb66c1d[_0x92e6('0x49')],{'$or':_['map'](_0xb66c1d['attributes'],function(_0xd33600){var _0x56c223={};_0x56c223[_0xd33600]={'$like':'%'+_0x3bab21['query'][_0x92e6('0x47')]+'%'};return _0x56c223;})});}_0xb66c1d=_[_0x92e6('0x48')]({},_0xb66c1d,_0x3bab21['options']);return _0x33161d['getDescriptions'](_0xb66c1d);}})[_0x92e6('0x1d')](function(_0x572610){if(_0x572610){_0x1b332f=_0x572610[_0x92e6('0x44')];if(!_0x3bab21['query']['hasOwnProperty']('nolimit')){_0xb66c1d['limit']=qs[_0x92e6('0x2d')](_0x3bab21[_0x92e6('0x3e')][_0x92e6('0x2d')]);_0xb66c1d[_0x92e6('0x2c')]=qs[_0x92e6('0x2c')](_0x3bab21[_0x92e6('0x3e')][_0x92e6('0x2c')]);}return _0x33161d[_0x92e6('0x5d')](_0xb66c1d);}})['then'](function(_0x5e3979){if(_0x5e3979){return _0x5e3979?{'count':_0x1b332f,'rows':_0x5e3979}:null;}})[_0x92e6('0x1d')](respondWithResult(_0x497ac5,null))['catch'](handleError(_0x497ac5,null));}; \ No newline at end of file +var _0x7a6c=['save','update','destroy','stack','name','send','index','map','ServicenowConfiguration','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','rawAttributes','includeAll','find','body','getFields','findOne','order','nolimit','ServicenowField','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x4b7d35,_0x24edf8){var _0x561490=function(_0x7d9c26){while(--_0x7d9c26){_0x4b7d35['push'](_0x4b7d35['shift']());}};_0x561490(++_0x24edf8);}(_0x7a6c,0x18f));var _0xc7a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a6c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc7a6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc7a6('0x1'));var zipdir=require(_0xc7a6('0x2'));var jsonpatch=require(_0xc7a6('0x3'));var rp=require('request-promise');var moment=require(_0xc7a6('0x4'));var BPromise=require(_0xc7a6('0x5'));var Mustache=require(_0xc7a6('0x6'));var util=require(_0xc7a6('0x7'));var path=require(_0xc7a6('0x8'));var sox=require(_0xc7a6('0x9'));var csv=require(_0xc7a6('0xa'));var ejs=require(_0xc7a6('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc7a6('0xc'));var crypto=require(_0xc7a6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc7a6('0xe'));var Redis=require(_0xc7a6('0xf'));var authService=require(_0xc7a6('0x10'));var qs=require(_0xc7a6('0x11'));var as=require(_0xc7a6('0x12'));var hardwareService=require(_0xc7a6('0x13'));var logger=require(_0xc7a6('0x14'))('api');var utils=require(_0xc7a6('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xc7a6('0x16')][_0xc7a6('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2e23e5,_0xceaa97,_0x2ca9dd,_0x2bf30b){return new BPromise(function(_0x4ad5f1,_0x5c5ccb){var _0x30b36a=_0x2bf30b||client;return _0x30b36a[_0xc7a6('0x18')](_0x2e23e5,_0x2ca9dd)[_0xc7a6('0x19')](function(_0x45e038){logger[_0xc7a6('0x1a')]('ServicenowConfiguration,\x20%s,\x20%s',_0xceaa97,_0xc7a6('0x1b'));logger[_0xc7a6('0x1c')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0xceaa97,_0xc7a6('0x1b'),JSON[_0xc7a6('0x1d')](_0x45e038));if(_0x45e038[_0xc7a6('0x1e')]){if(_0x45e038['error'][_0xc7a6('0x1f')]===0x1f4){logger[_0xc7a6('0x1e')](_0xc7a6('0x20'),_0xceaa97,_0x45e038[_0xc7a6('0x1e')][_0xc7a6('0x21')]);return _0x5c5ccb(_0x45e038[_0xc7a6('0x1e')][_0xc7a6('0x21')]);}logger[_0xc7a6('0x1e')](_0xc7a6('0x20'),_0xceaa97,_0x45e038[_0xc7a6('0x1e')][_0xc7a6('0x21')]);return _0x4ad5f1(_0x45e038[_0xc7a6('0x1e')][_0xc7a6('0x21')]);}else{logger['info'](_0xc7a6('0x20'),_0xceaa97,_0xc7a6('0x1b'));_0x4ad5f1(_0x45e038[_0xc7a6('0x22')]['message']);}})[_0xc7a6('0x23')](function(_0x1ba192){logger[_0xc7a6('0x1e')](_0xc7a6('0x20'),_0xceaa97,_0x1ba192);_0x5c5ccb(_0x1ba192);});});}function respondWithStatusCode(_0x1182da,_0x5f5b76){_0x5f5b76=_0x5f5b76||0xcc;return function(_0x52ad0b){if(_0x52ad0b){return _0x1182da[_0xc7a6('0x24')](_0x5f5b76);}return _0x1182da[_0xc7a6('0x25')](_0x5f5b76)[_0xc7a6('0x26')]();};}function respondWithResult(_0x5b60e4,_0x5143a0){_0x5143a0=_0x5143a0||0xc8;return function(_0x4df78f){if(_0x4df78f){return _0x5b60e4[_0xc7a6('0x25')](_0x5143a0)['json'](_0x4df78f);}};}function respondWithFilteredResult(_0x3f0f4a,_0x42ac40){return function(_0x218627){if(_0x218627){var _0x477936=_0x218627[_0xc7a6('0x27')],_0x30bad1=_0x42ac40['offset'],_0x1f36ca=_0x42ac40[_0xc7a6('0x28')]+_0x42ac40[_0xc7a6('0x29')],_0x18b7a6;if(_0x1f36ca>=_0x477936){_0x1f36ca=_0x477936;_0x18b7a6=0xc8;}else{_0x18b7a6=0xce;}_0x3f0f4a['status'](_0x18b7a6);return _0x3f0f4a[_0xc7a6('0x2a')](_0xc7a6('0x2b'),_0x30bad1+'-'+_0x1f36ca+'/'+_0x477936)['json'](_0x218627);}return null;};}function patchUpdates(_0x4e6e4a){return function(_0x24fcad){try{jsonpatch[_0xc7a6('0x2c')](_0x24fcad,_0x4e6e4a,!![]);}catch(_0x4dd30d){return BPromise[_0xc7a6('0x2d')](_0x4dd30d);}return _0x24fcad[_0xc7a6('0x2e')]();};}function saveUpdates(_0x3579e5,_0x3f225e){return function(_0x23012b){if(_0x23012b){return _0x23012b[_0xc7a6('0x2f')](_0x3579e5)[_0xc7a6('0x19')](function(_0x5d495a){return _0x5d495a;});}return null;};}function removeEntity(_0x1c60e6,_0x3cede1){return function(_0x2c1398){if(_0x2c1398){return _0x2c1398[_0xc7a6('0x30')]()[_0xc7a6('0x19')](function(){_0x1c60e6[_0xc7a6('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3afafc,_0x57e2fc){return function(_0x1433b4){if(!_0x1433b4){_0x3afafc[_0xc7a6('0x24')](0x194);}return _0x1433b4;};}function handleError(_0x26e404,_0x81324b){_0x81324b=_0x81324b||0x1f4;return function(_0x30b39b){logger[_0xc7a6('0x1e')](_0x30b39b[_0xc7a6('0x31')]);if(_0x30b39b['name']){delete _0x30b39b[_0xc7a6('0x32')];}_0x26e404[_0xc7a6('0x25')](_0x81324b)[_0xc7a6('0x33')](_0x30b39b);};}exports[_0xc7a6('0x34')]=function(_0x50b359,_0x285d43){var _0x54ba0e={},_0x4aa370={},_0x2bfbe0={'count':0x0,'rows':[]};var _0x46b59e=_[_0xc7a6('0x35')](db[_0xc7a6('0x36')]['rawAttributes'],function(_0x23f910){return{'name':_0x23f910[_0xc7a6('0x37')],'type':_0x23f910[_0xc7a6('0x38')][_0xc7a6('0x39')]};});_0x4aa370['model']=_[_0xc7a6('0x35')](_0x46b59e,_0xc7a6('0x32'));_0x4aa370['query']=_[_0xc7a6('0x3a')](_0x50b359[_0xc7a6('0x3b')]);_0x4aa370['filters']=_[_0xc7a6('0x3c')](_0x4aa370['model'],_0x4aa370[_0xc7a6('0x3b')]);_0x54ba0e['attributes']=_[_0xc7a6('0x3c')](_0x4aa370[_0xc7a6('0x3d')],qs['fields'](_0x50b359[_0xc7a6('0x3b')][_0xc7a6('0x3e')]));_0x54ba0e[_0xc7a6('0x3f')]=_0x54ba0e[_0xc7a6('0x3f')][_0xc7a6('0x40')]?_0x54ba0e['attributes']:_0x4aa370[_0xc7a6('0x3d')];if(!_0x50b359[_0xc7a6('0x3b')][_0xc7a6('0x41')]('nolimit')){_0x54ba0e[_0xc7a6('0x29')]=qs[_0xc7a6('0x29')](_0x50b359[_0xc7a6('0x3b')][_0xc7a6('0x29')]);_0x54ba0e[_0xc7a6('0x28')]=qs[_0xc7a6('0x28')](_0x50b359[_0xc7a6('0x3b')][_0xc7a6('0x28')]);}_0x54ba0e['order']=qs[_0xc7a6('0x42')](_0x50b359[_0xc7a6('0x3b')]['sort']);_0x54ba0e[_0xc7a6('0x43')]=qs[_0xc7a6('0x44')](_[_0xc7a6('0x45')](_0x50b359[_0xc7a6('0x3b')],_0x4aa370[_0xc7a6('0x44')]),_0x46b59e);if(_0x50b359[_0xc7a6('0x3b')][_0xc7a6('0x46')]){_0x54ba0e['where']=_[_0xc7a6('0x47')](_0x54ba0e[_0xc7a6('0x43')],{'$or':_[_0xc7a6('0x35')](_0x46b59e,function(_0xad667e){if(_0xad667e[_0xc7a6('0x38')]!==_0xc7a6('0x48')){var _0x2b026c={};_0x2b026c[_0xad667e[_0xc7a6('0x32')]]={'$like':'%'+_0x50b359[_0xc7a6('0x3b')][_0xc7a6('0x46')]+'%'};return _0x2b026c;}})});}_0x54ba0e=_['merge']({},_0x54ba0e,_0x50b359[_0xc7a6('0x49')]);var _0x1d2f64={'where':_0x54ba0e['where']};return db['ServicenowConfiguration'][_0xc7a6('0x27')](_0x1d2f64)[_0xc7a6('0x19')](function(_0x5241b3){_0x2bfbe0[_0xc7a6('0x27')]=_0x5241b3;if(_0x50b359['query']['includeAll']){_0x54ba0e[_0xc7a6('0x4a')]=[{'all':!![]}];}return db[_0xc7a6('0x36')][_0xc7a6('0x4b')](_0x54ba0e);})['then'](function(_0x469b26){_0x2bfbe0['rows']=_0x469b26;return _0x2bfbe0;})['then'](respondWithFilteredResult(_0x285d43,_0x54ba0e))[_0xc7a6('0x23')](handleError(_0x285d43,null));};exports[_0xc7a6('0x4c')]=function(_0x55e2a1,_0x202601){var _0x59c975={'raw':![],'where':{'id':_0x55e2a1[_0xc7a6('0x4d')]['id']}},_0x5c75e5={};_0x5c75e5[_0xc7a6('0x3d')]=_[_0xc7a6('0x3a')](db[_0xc7a6('0x36')][_0xc7a6('0x4e')]);_0x5c75e5[_0xc7a6('0x3b')]=_[_0xc7a6('0x3a')](_0x55e2a1['query']);_0x5c75e5[_0xc7a6('0x44')]=_[_0xc7a6('0x3c')](_0x5c75e5[_0xc7a6('0x3d')],_0x5c75e5[_0xc7a6('0x3b')]);_0x59c975[_0xc7a6('0x3f')]=_['intersection'](_0x5c75e5['model'],qs['fields'](_0x55e2a1['query'][_0xc7a6('0x3e')]));_0x59c975[_0xc7a6('0x3f')]=_0x59c975[_0xc7a6('0x3f')][_0xc7a6('0x40')]?_0x59c975[_0xc7a6('0x3f')]:_0x5c75e5[_0xc7a6('0x3d')];if(_0x55e2a1[_0xc7a6('0x3b')][_0xc7a6('0x4f')]){_0x59c975[_0xc7a6('0x4a')]=[{'all':!![]}];}_0x59c975=_['merge']({},_0x59c975,_0x55e2a1[_0xc7a6('0x49')]);return db['ServicenowConfiguration'][_0xc7a6('0x50')](_0x59c975)[_0xc7a6('0x19')](handleEntityNotFound(_0x202601,null))[_0xc7a6('0x19')](respondWithResult(_0x202601,null))['catch'](handleError(_0x202601,null));};exports['create']=function(_0xeaf0c4,_0xac333f){return db['ServicenowConfiguration']['create'](_0xeaf0c4[_0xc7a6('0x51')],{})[_0xc7a6('0x19')](respondWithResult(_0xac333f,0xc9))[_0xc7a6('0x23')](handleError(_0xac333f,null));};exports['update']=function(_0x42ee02,_0x2488c6){if(_0x42ee02['body']['id']){delete _0x42ee02[_0xc7a6('0x51')]['id'];}return db[_0xc7a6('0x36')]['find']({'where':{'id':_0x42ee02[_0xc7a6('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2488c6,null))[_0xc7a6('0x19')](saveUpdates(_0x42ee02['body'],null))['then'](respondWithResult(_0x2488c6,null))['catch'](handleError(_0x2488c6,null));};exports[_0xc7a6('0x30')]=function(_0x3e8fb9,_0x24f28a){return db[_0xc7a6('0x36')][_0xc7a6('0x50')]({'where':{'id':_0x3e8fb9[_0xc7a6('0x4d')]['id']}})[_0xc7a6('0x19')](handleEntityNotFound(_0x24f28a,null))[_0xc7a6('0x19')](removeEntity(_0x24f28a,null))[_0xc7a6('0x23')](handleError(_0x24f28a,null));};exports[_0xc7a6('0x52')]=function(_0x10c9bb,_0x15503e,_0x29eaef){var _0x31fd46={};var _0x8877bd={};var _0x43a630;var _0x478c9;return db[_0xc7a6('0x36')][_0xc7a6('0x53')]({'where':{'id':_0x10c9bb['params']['id']}})[_0xc7a6('0x19')](handleEntityNotFound(_0x15503e,null))[_0xc7a6('0x19')](function(_0x310cce){if(_0x310cce){_0x43a630=_0x310cce;_0x8877bd[_0xc7a6('0x3d')]=_[_0xc7a6('0x3a')](db['ServicenowField'][_0xc7a6('0x4e')]);_0x8877bd[_0xc7a6('0x3b')]=_['keys'](_0x10c9bb[_0xc7a6('0x3b')]);_0x8877bd[_0xc7a6('0x44')]=_[_0xc7a6('0x3c')](_0x8877bd['model'],_0x8877bd['query']);_0x31fd46[_0xc7a6('0x3f')]=_[_0xc7a6('0x3c')](_0x8877bd['model'],qs[_0xc7a6('0x3e')](_0x10c9bb[_0xc7a6('0x3b')]['fields']));_0x31fd46[_0xc7a6('0x3f')]=_0x31fd46[_0xc7a6('0x3f')][_0xc7a6('0x40')]?_0x31fd46[_0xc7a6('0x3f')]:_0x8877bd[_0xc7a6('0x3d')];_0x31fd46[_0xc7a6('0x54')]=qs['sort'](_0x10c9bb[_0xc7a6('0x3b')]['sort']);_0x31fd46[_0xc7a6('0x43')]=qs[_0xc7a6('0x44')](_[_0xc7a6('0x45')](_0x10c9bb['query'],_0x8877bd['filters']));if(_0x10c9bb[_0xc7a6('0x3b')]['filter']){_0x31fd46['where']=_[_0xc7a6('0x47')](_0x31fd46[_0xc7a6('0x43')],{'$or':_[_0xc7a6('0x35')](_0x31fd46['attributes'],function(_0x310e0e){var _0x337510={};_0x337510[_0x310e0e]={'$like':'%'+_0x10c9bb['query'][_0xc7a6('0x46')]+'%'};return _0x337510;})});}_0x31fd46=_['merge']({},_0x31fd46,_0x10c9bb[_0xc7a6('0x49')]);return _0x43a630[_0xc7a6('0x52')](_0x31fd46);}})['then'](function(_0x2674da){if(_0x2674da){_0x478c9=_0x2674da[_0xc7a6('0x40')];if(!_0x10c9bb[_0xc7a6('0x3b')][_0xc7a6('0x41')](_0xc7a6('0x55'))){_0x31fd46[_0xc7a6('0x29')]=qs[_0xc7a6('0x29')](_0x10c9bb[_0xc7a6('0x3b')][_0xc7a6('0x29')]);_0x31fd46[_0xc7a6('0x28')]=qs[_0xc7a6('0x28')](_0x10c9bb[_0xc7a6('0x3b')][_0xc7a6('0x28')]);}return _0x43a630[_0xc7a6('0x52')](_0x31fd46);}})['then'](function(_0x48e587){if(_0x48e587){return _0x48e587?{'count':_0x478c9,'rows':_0x48e587}:null;}})[_0xc7a6('0x19')](respondWithResult(_0x15503e,null))[_0xc7a6('0x23')](handleError(_0x15503e,null));};exports['getSubjects']=function(_0x333b90,_0x59b4dc,_0x26ca55){var _0x3d7462={};var _0x580871={};var _0x3f5ecf;var _0x3fb342;return db['ServicenowConfiguration'][_0xc7a6('0x53')]({'where':{'id':_0x333b90[_0xc7a6('0x4d')]['id']}})[_0xc7a6('0x19')](handleEntityNotFound(_0x59b4dc,null))[_0xc7a6('0x19')](function(_0x3f1a4e){if(_0x3f1a4e){_0x3f5ecf=_0x3f1a4e;_0x580871[_0xc7a6('0x3d')]=_[_0xc7a6('0x3a')](db[_0xc7a6('0x56')][_0xc7a6('0x4e')]);_0x580871[_0xc7a6('0x3b')]=_[_0xc7a6('0x3a')](_0x333b90[_0xc7a6('0x3b')]);_0x580871['filters']=_['intersection'](_0x580871['model'],_0x580871[_0xc7a6('0x3b')]);_0x3d7462[_0xc7a6('0x3f')]=_[_0xc7a6('0x3c')](_0x580871['model'],qs[_0xc7a6('0x3e')](_0x333b90['query'][_0xc7a6('0x3e')]));_0x3d7462['attributes']=_0x3d7462[_0xc7a6('0x3f')][_0xc7a6('0x40')]?_0x3d7462[_0xc7a6('0x3f')]:_0x580871['model'];_0x3d7462['order']=qs[_0xc7a6('0x42')](_0x333b90[_0xc7a6('0x3b')][_0xc7a6('0x42')]);_0x3d7462[_0xc7a6('0x43')]=qs[_0xc7a6('0x44')](_[_0xc7a6('0x45')](_0x333b90['query'],_0x580871[_0xc7a6('0x44')]));if(_0x333b90['query']['filter']){_0x3d7462['where']=_[_0xc7a6('0x47')](_0x3d7462[_0xc7a6('0x43')],{'$or':_['map'](_0x3d7462['attributes'],function(_0x1bdfd1){var _0x44e46c={};_0x44e46c[_0x1bdfd1]={'$like':'%'+_0x333b90['query'][_0xc7a6('0x46')]+'%'};return _0x44e46c;})});}_0x3d7462=_[_0xc7a6('0x47')]({},_0x3d7462,_0x333b90[_0xc7a6('0x49')]);return _0x3f5ecf['getSubjects'](_0x3d7462);}})[_0xc7a6('0x19')](function(_0x1a5784){if(_0x1a5784){_0x3fb342=_0x1a5784[_0xc7a6('0x40')];if(!_0x333b90[_0xc7a6('0x3b')][_0xc7a6('0x41')]('nolimit')){_0x3d7462[_0xc7a6('0x29')]=qs[_0xc7a6('0x29')](_0x333b90[_0xc7a6('0x3b')][_0xc7a6('0x29')]);_0x3d7462[_0xc7a6('0x28')]=qs[_0xc7a6('0x28')](_0x333b90[_0xc7a6('0x3b')][_0xc7a6('0x28')]);}return _0x3f5ecf[_0xc7a6('0x57')](_0x3d7462);}})[_0xc7a6('0x19')](function(_0x43c66a){if(_0x43c66a){return _0x43c66a?{'count':_0x3fb342,'rows':_0x43c66a}:null;}})[_0xc7a6('0x19')](respondWithResult(_0x59b4dc,null))[_0xc7a6('0x23')](handleError(_0x59b4dc,null));};exports['getDescriptions']=function(_0x1e9efc,_0x37b8d8,_0x2272f2){var _0x6cf3e3={};var _0x2129f2={};var _0x2bb6ce;var _0x5414d3;return db[_0xc7a6('0x36')][_0xc7a6('0x53')]({'where':{'id':_0x1e9efc[_0xc7a6('0x4d')]['id']}})[_0xc7a6('0x19')](handleEntityNotFound(_0x37b8d8,null))['then'](function(_0x434e11){if(_0x434e11){_0x2bb6ce=_0x434e11;_0x2129f2[_0xc7a6('0x3d')]=_[_0xc7a6('0x3a')](db[_0xc7a6('0x56')][_0xc7a6('0x4e')]);_0x2129f2[_0xc7a6('0x3b')]=_['keys'](_0x1e9efc['query']);_0x2129f2[_0xc7a6('0x44')]=_[_0xc7a6('0x3c')](_0x2129f2[_0xc7a6('0x3d')],_0x2129f2[_0xc7a6('0x3b')]);_0x6cf3e3[_0xc7a6('0x3f')]=_[_0xc7a6('0x3c')](_0x2129f2[_0xc7a6('0x3d')],qs[_0xc7a6('0x3e')](_0x1e9efc[_0xc7a6('0x3b')]['fields']));_0x6cf3e3[_0xc7a6('0x3f')]=_0x6cf3e3[_0xc7a6('0x3f')][_0xc7a6('0x40')]?_0x6cf3e3[_0xc7a6('0x3f')]:_0x2129f2[_0xc7a6('0x3d')];_0x6cf3e3[_0xc7a6('0x54')]=qs[_0xc7a6('0x42')](_0x1e9efc['query']['sort']);_0x6cf3e3['where']=qs[_0xc7a6('0x44')](_['pick'](_0x1e9efc[_0xc7a6('0x3b')],_0x2129f2[_0xc7a6('0x44')]));if(_0x1e9efc[_0xc7a6('0x3b')][_0xc7a6('0x46')]){_0x6cf3e3[_0xc7a6('0x43')]=_['merge'](_0x6cf3e3['where'],{'$or':_['map'](_0x6cf3e3[_0xc7a6('0x3f')],function(_0x55c68f){var _0x2cc8f6={};_0x2cc8f6[_0x55c68f]={'$like':'%'+_0x1e9efc[_0xc7a6('0x3b')][_0xc7a6('0x46')]+'%'};return _0x2cc8f6;})});}_0x6cf3e3=_['merge']({},_0x6cf3e3,_0x1e9efc[_0xc7a6('0x49')]);return _0x2bb6ce[_0xc7a6('0x58')](_0x6cf3e3);}})[_0xc7a6('0x19')](function(_0x3c2d7f){if(_0x3c2d7f){_0x5414d3=_0x3c2d7f[_0xc7a6('0x40')];if(!_0x1e9efc[_0xc7a6('0x3b')][_0xc7a6('0x41')](_0xc7a6('0x55'))){_0x6cf3e3[_0xc7a6('0x29')]=qs['limit'](_0x1e9efc[_0xc7a6('0x3b')][_0xc7a6('0x29')]);_0x6cf3e3['offset']=qs[_0xc7a6('0x28')](_0x1e9efc[_0xc7a6('0x3b')][_0xc7a6('0x28')]);}return _0x2bb6ce[_0xc7a6('0x58')](_0x6cf3e3);}})[_0xc7a6('0x19')](function(_0x2a1aab){if(_0x2a1aab){return _0x2a1aab?{'count':_0x5414d3,'rows':_0x2a1aab}:null;}})[_0xc7a6('0x19')](respondWithResult(_0x37b8d8,null))[_0xc7a6('0x23')](handleError(_0x37b8d8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 696a34f..7ee1c13 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 _0xe780=['bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','../../config/logger','moment'];(function(_0x5c9113,_0x217c53){var _0x5e2921=function(_0x10bb73){while(--_0x10bb73){_0x5c9113['push'](_0x5c9113['shift']());}};_0x5e2921(++_0x217c53);}(_0xe780,0x189));var _0x0e78=function(_0x1ecf71,_0x53a979){_0x1ecf71=_0x1ecf71-0x0;var _0x2af7ed=_0xe780[_0x1ecf71];return _0x2af7ed;};'use strict';var _=require('lodash');var util=require(_0x0e78('0x0'));var logger=require(_0x0e78('0x1'))('api');var moment=require(_0x0e78('0x2'));var BPromise=require(_0x0e78('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e78('0x4'));var rimraf=require(_0x0e78('0x5'));var config=require(_0x0e78('0x6'));var attributes=require(_0x0e78('0x7'));module[_0x0e78('0x8')]=function(_0x1856c8,_0x2819dc){return _0x1856c8[_0x0e78('0x9')]('ServicenowConfiguration',attributes,{'tableName':_0x0e78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9017=['rimraf','../../config/environment','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0x9017,0x123));var _0x7901=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9017[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7901('0x0'));var util=require('util');var logger=require(_0x7901('0x1'))(_0x7901('0x2'));var moment=require('moment');var BPromise=require(_0x7901('0x3'));var rp=require(_0x7901('0x4'));var fs=require('fs');var path=require(_0x7901('0x5'));var rimraf=require(_0x7901('0x6'));var config=require(_0x7901('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x13a205,_0x2d19e2){return _0x13a205[_0x7901('0x8')](_0x7901('0x9'),attributes,{'tableName':_0x7901('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index a0a2c03..c62fda3 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 _0x6bdb=['../../config/utils','rpc','../../config/environment','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x5f1b29,_0x513d20){var _0x2a1c30=function(_0x27d463){while(--_0x27d463){_0x5f1b29['push'](_0x5f1b29['shift']());}};_0x2a1c30(++_0x513d20);}(_0x6bdb,0x150));var _0xb6bd=function(_0x232ecd,_0x26bfed){_0x232ecd=_0x232ecd-0x0;var _0x200c10=_0x6bdb[_0x232ecd];return _0x200c10;};'use strict';var _=require(_0xb6bd('0x0'));var util=require(_0xb6bd('0x1'));var moment=require('moment');var BPromise=require(_0xb6bd('0x2'));var rs=require(_0xb6bd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb6bd('0x4'));var logger=require('../../config/logger')(_0xb6bd('0x5'));var config=require(_0xb6bd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb6bd('0x7')][_0xb6bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x482ff5,_0x2357ff,_0x3accfb){return new BPromise(function(_0x356f06,_0x24f4e7){return client[_0xb6bd('0x9')](_0x482ff5,_0x3accfb)[_0xb6bd('0xa')](function(_0x5de6a3){logger[_0xb6bd('0xb')](_0xb6bd('0xc'),_0x2357ff,'request\x20sent');logger['debug'](_0xb6bd('0xd'),_0x2357ff,_0xb6bd('0xe'),JSON[_0xb6bd('0xf')](_0x5de6a3));if(_0x5de6a3[_0xb6bd('0x10')]){if(_0x5de6a3['error'][_0xb6bd('0x11')]===0x1f4){logger[_0xb6bd('0x10')](_0xb6bd('0xc'),_0x2357ff,_0x5de6a3[_0xb6bd('0x10')][_0xb6bd('0x12')]);return _0x24f4e7(_0x5de6a3[_0xb6bd('0x10')]['message']);}logger[_0xb6bd('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2357ff,_0x5de6a3['error'][_0xb6bd('0x12')]);return _0x356f06(_0x5de6a3['error'][_0xb6bd('0x12')]);}else{logger[_0xb6bd('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2357ff,_0xb6bd('0xe'));_0x356f06(_0x5de6a3['result'][_0xb6bd('0x12')]);}})[_0xb6bd('0x13')](function(_0x54b4fe){logger[_0xb6bd('0x10')](_0xb6bd('0xc'),_0x2357ff,_0x54b4fe);_0x24f4e7(_0x54b4fe);});});} \ No newline at end of file +var _0x83ee=['ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info'];(function(_0xc00108,_0x3e54ee){var _0x46cae9=function(_0x33cd5a){while(--_0x33cd5a){_0xc00108['push'](_0xc00108['shift']());}};_0x46cae9(++_0x3e54ee);}(_0x83ee,0x1d5));var _0xe83e=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x83ee[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0xe83e('0x0'));var util=require(_0xe83e('0x1'));var moment=require(_0xe83e('0x2'));var BPromise=require(_0xe83e('0x3'));var rs=require(_0xe83e('0x4'));var fs=require('fs');var Redis=require(_0xe83e('0x5'));var db=require(_0xe83e('0x6'))['db'];var utils=require(_0xe83e('0x7'));var logger=require(_0xe83e('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe83e('0x9'));var client=jayson[_0xe83e('0xa')][_0xe83e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d172d,_0x496bc8,_0xe6db83){return new BPromise(function(_0xdf1d5f,_0x22a93d){return client['request'](_0x5d172d,_0xe6db83)[_0xe83e('0xc')](function(_0x2575f6){logger[_0xe83e('0xd')](_0xe83e('0xe'),_0x496bc8,_0xe83e('0xf'));logger[_0xe83e('0x10')](_0xe83e('0x11'),_0x496bc8,_0xe83e('0xf'),JSON[_0xe83e('0x12')](_0x2575f6));if(_0x2575f6[_0xe83e('0x13')]){if(_0x2575f6[_0xe83e('0x13')][_0xe83e('0x14')]===0x1f4){logger[_0xe83e('0x13')](_0xe83e('0xe'),_0x496bc8,_0x2575f6[_0xe83e('0x13')][_0xe83e('0x15')]);return _0x22a93d(_0x2575f6['error'][_0xe83e('0x15')]);}logger[_0xe83e('0x13')](_0xe83e('0xe'),_0x496bc8,_0x2575f6[_0xe83e('0x13')][_0xe83e('0x15')]);return _0xdf1d5f(_0x2575f6[_0xe83e('0x13')][_0xe83e('0x15')]);}else{logger[_0xe83e('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x496bc8,_0xe83e('0xf'));_0xdf1d5f(_0x2575f6[_0xe83e('0x16')]['message']);}})['catch'](function(_0xaf9d28){logger['error'](_0xe83e('0xe'),_0x496bc8,_0xaf9d28);_0x22a93d(_0xaf9d28);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 57e6898..1183cd1 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 _0x8ede=['isAuthenticated','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','/:id'];(function(_0x1e497d,_0x457dad){var _0x3afff3=function(_0x9c62fa){while(--_0x9c62fa){_0x1e497d['push'](_0x1e497d['shift']());}};_0x3afff3(++_0x457dad);}(_0x8ede,0x1b8));var _0xe8ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ede[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xe8ed('0x0'));var path=require(_0xe8ed('0x1'));var timeout=require(_0xe8ed('0x2'));var express=require(_0xe8ed('0x3'));var router=express[_0xe8ed('0x4')]();var auth=require(_0xe8ed('0x5'));var interaction=require(_0xe8ed('0x6'));var config=require('../../config/environment');var controller=require(_0xe8ed('0x7'));router[_0xe8ed('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe8ed('0x8')](_0xe8ed('0x9'),auth[_0xe8ed('0xa')](),controller[_0xe8ed('0xb')]);router[_0xe8ed('0xc')]('/',auth['isAuthenticated'](),controller[_0xe8ed('0xd')]);router[_0xe8ed('0xe')]('/:id',auth[_0xe8ed('0xa')](),controller['update']);router[_0xe8ed('0xf')](_0xe8ed('0x9'),auth['isAuthenticated'](),controller[_0xe8ed('0x10')]);module[_0xe8ed('0x11')]=router; \ No newline at end of file +var _0x15b9=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','/:id','show','isAuthenticated','create','delete','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4c567d,_0x524490){var _0x8e4c38=function(_0x910b2e){while(--_0x910b2e){_0x4c567d['push'](_0x4c567d['shift']());}};_0x8e4c38(++_0x524490);}(_0x15b9,0x190));var _0x915b=function(_0x257b0e,_0x563d7e){_0x257b0e=_0x257b0e-0x0;var _0x27ac2a=_0x15b9[_0x257b0e];return _0x27ac2a;};'use strict';var multer=require(_0x915b('0x0'));var util=require(_0x915b('0x1'));var path=require(_0x915b('0x2'));var timeout=require(_0x915b('0x3'));var express=require(_0x915b('0x4'));var router=express['Router']();var auth=require(_0x915b('0x5'));var interaction=require(_0x915b('0x6'));var config=require(_0x915b('0x7'));var controller=require(_0x915b('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x915b('0x9'),auth['isAuthenticated'](),controller[_0x915b('0xa')]);router['post']('/',auth[_0x915b('0xb')](),controller[_0x915b('0xc')]);router['put'](_0x915b('0x9'),auth[_0x915b('0xb')](),controller['update']);router[_0x915b('0xd')](_0x915b('0x9'),auth[_0x915b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c51a48b..cc6f583 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 _0x36f1=['sequelize','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x544bb8,_0x329713){var _0x919355=function(_0x49f73d){while(--_0x49f73d){_0x544bb8['push'](_0x544bb8['shift']());}};_0x919355(++_0x329713);}(_0x36f1,0xb0));var _0x136f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x36f1[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x136f('0x0'));module['exports']={'type':{'type':Sequelize[_0x136f('0x1')]('string',_0x136f('0x2'),_0x136f('0x3'),_0x136f('0x4')),'defaultValue':_0x136f('0x5')},'content':{'type':Sequelize[_0x136f('0x6')]},'key':{'type':Sequelize[_0x136f('0x6')]},'keyType':{'type':Sequelize[_0x136f('0x1')](_0x136f('0x5'),_0x136f('0x2'),_0x136f('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x136f('0x6')]},'nameField':{'type':Sequelize[_0x136f('0x6')]},'customField':{'type':Sequelize[_0x136f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa07e=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','STRING'];(function(_0x47e3b0,_0x217418){var _0x442c29=function(_0x50628c){while(--_0x50628c){_0x47e3b0['push'](_0x47e3b0['shift']());}};_0x442c29(++_0x217418);}(_0xa07e,0xda));var _0xea07=function(_0x336530,_0x2dd2c7){_0x336530=_0x336530-0x0;var _0x36fd72=_0xa07e[_0x336530];return _0x36fd72;};'use strict';var Sequelize=require(_0xea07('0x0'));module[_0xea07('0x1')]={'type':{'type':Sequelize[_0xea07('0x2')](_0xea07('0x3'),'variable',_0xea07('0x4'),'keyValue'),'defaultValue':_0xea07('0x3')},'content':{'type':Sequelize[_0xea07('0x5')]},'key':{'type':Sequelize[_0xea07('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xea07('0x3'),_0xea07('0x6'),_0xea07('0x4'))},'keyContent':{'type':Sequelize[_0xea07('0x5')]},'idField':{'type':Sequelize[_0xea07('0x5')]},'nameField':{'type':Sequelize[_0xea07('0x5')]},'customField':{'type':Sequelize[_0xea07('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xea07('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 41bee0b..1099abd 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 _0x9ab9=['end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x9ab9,0x19d));var _0x99ab=function(_0x3c6de9,_0x56eb84){_0x3c6de9=_0x3c6de9-0x0;var _0x247a9c=_0x9ab9[_0x3c6de9];return _0x247a9c;};'use strict';var pdf=require(_0x99ab('0x0'));var emlformat=require(_0x99ab('0x1'));var rimraf=require(_0x99ab('0x2'));var zipdir=require(_0x99ab('0x3'));var jsonpatch=require(_0x99ab('0x4'));var rp=require('request-promise');var moment=require(_0x99ab('0x5'));var BPromise=require(_0x99ab('0x6'));var Mustache=require('mustache');var util=require(_0x99ab('0x7'));var path=require('path');var sox=require(_0x99ab('0x8'));var csv=require(_0x99ab('0x9'));var ejs=require(_0x99ab('0xa'));var fs=require('fs');var _=require(_0x99ab('0xb'));var squel=require(_0x99ab('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99ab('0xd'));var toCsv=require(_0x99ab('0x9'));var querystring=require('querystring');var Papa=require(_0x99ab('0xe'));var Redis=require(_0x99ab('0xf'));var authService=require(_0x99ab('0x10'));var qs=require(_0x99ab('0x11'));var as=require(_0x99ab('0x12'));var hardwareService=require(_0x99ab('0x13'));var logger=require('../../config/logger')(_0x99ab('0x14'));var utils=require(_0x99ab('0x15'));var config=require(_0x99ab('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xed2100,_0x24229c){_0x24229c=_0x24229c||0xcc;return function(_0x3739fb){if(_0x3739fb){return _0xed2100[_0x99ab('0x17')](_0x24229c);}return _0xed2100[_0x99ab('0x18')](_0x24229c)[_0x99ab('0x19')]();};}function respondWithResult(_0x584744,_0x97639f){_0x97639f=_0x97639f||0xc8;return function(_0x5bf382){if(_0x5bf382){return _0x584744['status'](_0x97639f)[_0x99ab('0x1a')](_0x5bf382);}};}function respondWithFilteredResult(_0x36d89e,_0xa60b53){return function(_0x4b11f1){if(_0x4b11f1){var _0x4299ae=_0x4b11f1[_0x99ab('0x1b')],_0x13b9aa=_0xa60b53[_0x99ab('0x1c')],_0x1c52a6=_0xa60b53[_0x99ab('0x1c')]+_0xa60b53[_0x99ab('0x1d')],_0x31b340;if(_0x1c52a6>=_0x4299ae){_0x1c52a6=_0x4299ae;_0x31b340=0xc8;}else{_0x31b340=0xce;}_0x36d89e['status'](_0x31b340);return _0x36d89e[_0x99ab('0x1e')](_0x99ab('0x1f'),_0x13b9aa+'-'+_0x1c52a6+'/'+_0x4299ae)[_0x99ab('0x1a')](_0x4b11f1);}return null;};}function patchUpdates(_0x1cdd6d){return function(_0x34e694){try{jsonpatch[_0x99ab('0x20')](_0x34e694,_0x1cdd6d,!![]);}catch(_0x2abddd){return BPromise[_0x99ab('0x21')](_0x2abddd);}return _0x34e694[_0x99ab('0x22')]();};}function saveUpdates(_0x51ded6,_0x5ab547){return function(_0x1fdcdf){if(_0x1fdcdf){return _0x1fdcdf[_0x99ab('0x23')](_0x51ded6)[_0x99ab('0x24')](function(_0x4e7647){return _0x4e7647;});}return null;};}function removeEntity(_0x2e0464,_0x3a0897){return function(_0xa3cf1e){if(_0xa3cf1e){return _0xa3cf1e[_0x99ab('0x25')]()[_0x99ab('0x24')](function(){_0x2e0464[_0x99ab('0x18')](0xcc)[_0x99ab('0x19')]();});}};}function handleEntityNotFound(_0x5411a6,_0x5de675){return function(_0x4cd112){if(!_0x4cd112){_0x5411a6[_0x99ab('0x17')](0x194);}return _0x4cd112;};}function handleError(_0x56bdb7,_0x4e52db){_0x4e52db=_0x4e52db||0x1f4;return function(_0x2d3281){logger[_0x99ab('0x26')](_0x2d3281[_0x99ab('0x27')]);if(_0x2d3281['name']){delete _0x2d3281[_0x99ab('0x28')];}_0x56bdb7[_0x99ab('0x18')](_0x4e52db)[_0x99ab('0x29')](_0x2d3281);};}exports[_0x99ab('0x2a')]=function(_0x36414c,_0x45d50e){var _0x970ce7={},_0x2efec3={},_0xe3945b={'count':0x0,'rows':[]};var _0x4ce5ce=_[_0x99ab('0x2b')](db[_0x99ab('0x2c')]['rawAttributes'],function(_0x35d09e){return{'name':_0x35d09e[_0x99ab('0x2d')],'type':_0x35d09e[_0x99ab('0x2e')]['key']};});_0x2efec3['model']=_[_0x99ab('0x2b')](_0x4ce5ce,_0x99ab('0x28'));_0x2efec3[_0x99ab('0x2f')]=_[_0x99ab('0x30')](_0x36414c[_0x99ab('0x2f')]);_0x2efec3[_0x99ab('0x31')]=_[_0x99ab('0x32')](_0x2efec3[_0x99ab('0x33')],_0x2efec3['query']);_0x970ce7[_0x99ab('0x34')]=_[_0x99ab('0x32')](_0x2efec3['model'],qs[_0x99ab('0x35')](_0x36414c[_0x99ab('0x2f')]['fields']));_0x970ce7['attributes']=_0x970ce7[_0x99ab('0x34')][_0x99ab('0x36')]?_0x970ce7[_0x99ab('0x34')]:_0x2efec3['model'];if(!_0x36414c['query']['hasOwnProperty']('nolimit')){_0x970ce7['limit']=qs['limit'](_0x36414c[_0x99ab('0x2f')][_0x99ab('0x1d')]);_0x970ce7[_0x99ab('0x1c')]=qs['offset'](_0x36414c[_0x99ab('0x2f')][_0x99ab('0x1c')]);}_0x970ce7[_0x99ab('0x37')]=qs['sort'](_0x36414c[_0x99ab('0x2f')][_0x99ab('0x38')]);_0x970ce7[_0x99ab('0x39')]=qs[_0x99ab('0x31')](_[_0x99ab('0x3a')](_0x36414c[_0x99ab('0x2f')],_0x2efec3[_0x99ab('0x31')]),_0x4ce5ce);if(_0x36414c['query']['filter']){_0x970ce7[_0x99ab('0x39')]=_[_0x99ab('0x3b')](_0x970ce7['where'],{'$or':_[_0x99ab('0x2b')](_0x4ce5ce,function(_0x41a54d){if(_0x41a54d[_0x99ab('0x2e')]!=='VIRTUAL'){var _0x285a0d={};_0x285a0d[_0x41a54d[_0x99ab('0x28')]]={'$like':'%'+_0x36414c[_0x99ab('0x2f')][_0x99ab('0x3c')]+'%'};return _0x285a0d;}})});}_0x970ce7=_[_0x99ab('0x3b')]({},_0x970ce7,_0x36414c['options']);var _0xcfba5a={'where':_0x970ce7[_0x99ab('0x39')]};return db['ServicenowField'][_0x99ab('0x1b')](_0xcfba5a)['then'](function(_0xb62fd6){_0xe3945b[_0x99ab('0x1b')]=_0xb62fd6;if(_0x36414c[_0x99ab('0x2f')][_0x99ab('0x3d')]){_0x970ce7[_0x99ab('0x3e')]=[{'all':!![]}];}return db[_0x99ab('0x2c')][_0x99ab('0x3f')](_0x970ce7);})[_0x99ab('0x24')](function(_0x7c7ac8){_0xe3945b[_0x99ab('0x40')]=_0x7c7ac8;return _0xe3945b;})['then'](respondWithFilteredResult(_0x45d50e,_0x970ce7))[_0x99ab('0x41')](handleError(_0x45d50e,null));};exports[_0x99ab('0x42')]=function(_0x4e6a11,_0x13c94f){var _0x5c6f5f={'raw':!![],'where':{'id':_0x4e6a11['params']['id']}},_0x165411={};_0x165411[_0x99ab('0x33')]=_[_0x99ab('0x30')](db[_0x99ab('0x2c')][_0x99ab('0x43')]);_0x165411['query']=_[_0x99ab('0x30')](_0x4e6a11[_0x99ab('0x2f')]);_0x165411[_0x99ab('0x31')]=_[_0x99ab('0x32')](_0x165411[_0x99ab('0x33')],_0x165411[_0x99ab('0x2f')]);_0x5c6f5f[_0x99ab('0x34')]=_[_0x99ab('0x32')](_0x165411[_0x99ab('0x33')],qs[_0x99ab('0x35')](_0x4e6a11[_0x99ab('0x2f')][_0x99ab('0x35')]));_0x5c6f5f[_0x99ab('0x34')]=_0x5c6f5f[_0x99ab('0x34')][_0x99ab('0x36')]?_0x5c6f5f['attributes']:_0x165411[_0x99ab('0x33')];if(_0x4e6a11[_0x99ab('0x2f')]['includeAll']){_0x5c6f5f[_0x99ab('0x3e')]=[{'all':!![]}];}_0x5c6f5f=_[_0x99ab('0x3b')]({},_0x5c6f5f,_0x4e6a11[_0x99ab('0x44')]);return db[_0x99ab('0x2c')][_0x99ab('0x45')](_0x5c6f5f)[_0x99ab('0x24')](handleEntityNotFound(_0x13c94f,null))[_0x99ab('0x24')](respondWithResult(_0x13c94f,null))[_0x99ab('0x41')](handleError(_0x13c94f,null));};exports[_0x99ab('0x46')]=function(_0x104657,_0x1c4442){return db['ServicenowField'][_0x99ab('0x46')](_0x104657[_0x99ab('0x47')],{})[_0x99ab('0x24')](respondWithResult(_0x1c4442,0xc9))[_0x99ab('0x41')](handleError(_0x1c4442,null));};exports['update']=function(_0x520420,_0x162867){if(_0x520420['body']['id']){delete _0x520420[_0x99ab('0x47')]['id'];}return db[_0x99ab('0x2c')][_0x99ab('0x45')]({'where':{'id':_0x520420[_0x99ab('0x48')]['id']}})[_0x99ab('0x24')](handleEntityNotFound(_0x162867,null))[_0x99ab('0x24')](saveUpdates(_0x520420[_0x99ab('0x47')],null))['then'](respondWithResult(_0x162867,null))[_0x99ab('0x41')](handleError(_0x162867,null));};exports[_0x99ab('0x25')]=function(_0x78eb5e,_0x436f84){return db[_0x99ab('0x2c')][_0x99ab('0x45')]({'where':{'id':_0x78eb5e[_0x99ab('0x48')]['id']}})[_0x99ab('0x24')](handleEntityNotFound(_0x436f84,null))[_0x99ab('0x24')](removeEntity(_0x436f84,null))[_0x99ab('0x41')](handleError(_0x436f84,null));}; \ No newline at end of file +var _0xba37=['end','json','count','offset','limit','Content-Range','reject','save','then','destroy','error','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','name','keys','filters','attributes','intersection','query','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','fields','create','body','catch','find','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x3db771,_0x4561ab){var _0x1415c5=function(_0x1c7117){while(--_0x1c7117){_0x3db771['push'](_0x3db771['shift']());}};_0x1415c5(++_0x4561ab);}(_0xba37,0xb6));var _0x7ba3=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xba37[_0x25e7cb];return _0x375d92;};'use strict';var pdf=require(_0x7ba3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7ba3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7ba3('0x2'));var rp=require('request-promise');var moment=require(_0x7ba3('0x3'));var BPromise=require(_0x7ba3('0x4'));var Mustache=require(_0x7ba3('0x5'));var util=require(_0x7ba3('0x6'));var path=require(_0x7ba3('0x7'));var sox=require('sox');var csv=require(_0x7ba3('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x7ba3('0x9'));var crypto=require(_0x7ba3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7ba3('0xb'));var toCsv=require(_0x7ba3('0x8'));var querystring=require(_0x7ba3('0xc'));var Papa=require(_0x7ba3('0xd'));var Redis=require(_0x7ba3('0xe'));var authService=require(_0x7ba3('0xf'));var qs=require(_0x7ba3('0x10'));var as=require(_0x7ba3('0x11'));var hardwareService=require(_0x7ba3('0x12'));var logger=require('../../config/logger')(_0x7ba3('0x13'));var utils=require(_0x7ba3('0x14'));var config=require(_0x7ba3('0x15'));var licenseUtil=require(_0x7ba3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21bdf2,_0x44025a){_0x44025a=_0x44025a||0xcc;return function(_0x714d1){if(_0x714d1){return _0x21bdf2[_0x7ba3('0x17')](_0x44025a);}return _0x21bdf2[_0x7ba3('0x18')](_0x44025a)[_0x7ba3('0x19')]();};}function respondWithResult(_0x45c733,_0x5c1fb4){_0x5c1fb4=_0x5c1fb4||0xc8;return function(_0x43b45e){if(_0x43b45e){return _0x45c733[_0x7ba3('0x18')](_0x5c1fb4)[_0x7ba3('0x1a')](_0x43b45e);}};}function respondWithFilteredResult(_0x3346fd,_0x3fbe42){return function(_0x3dc7fb){if(_0x3dc7fb){var _0x1b678f=_0x3dc7fb[_0x7ba3('0x1b')],_0x10afdd=_0x3fbe42[_0x7ba3('0x1c')],_0x5c493a=_0x3fbe42[_0x7ba3('0x1c')]+_0x3fbe42[_0x7ba3('0x1d')],_0x5e5e72;if(_0x5c493a>=_0x1b678f){_0x5c493a=_0x1b678f;_0x5e5e72=0xc8;}else{_0x5e5e72=0xce;}_0x3346fd[_0x7ba3('0x18')](_0x5e5e72);return _0x3346fd['set'](_0x7ba3('0x1e'),_0x10afdd+'-'+_0x5c493a+'/'+_0x1b678f)[_0x7ba3('0x1a')](_0x3dc7fb);}return null;};}function patchUpdates(_0x53c137){return function(_0x10e965){try{jsonpatch['apply'](_0x10e965,_0x53c137,!![]);}catch(_0x27495e){return BPromise[_0x7ba3('0x1f')](_0x27495e);}return _0x10e965[_0x7ba3('0x20')]();};}function saveUpdates(_0x549016,_0x5ced6f){return function(_0x224b9c){if(_0x224b9c){return _0x224b9c['update'](_0x549016)[_0x7ba3('0x21')](function(_0x4ee30c){return _0x4ee30c;});}return null;};}function removeEntity(_0x7d35cb,_0x52c67f){return function(_0x2cacbd){if(_0x2cacbd){return _0x2cacbd[_0x7ba3('0x22')]()[_0x7ba3('0x21')](function(){_0x7d35cb[_0x7ba3('0x18')](0xcc)[_0x7ba3('0x19')]();});}};}function handleEntityNotFound(_0x949e6b,_0xae1494){return function(_0x282e66){if(!_0x282e66){_0x949e6b['sendStatus'](0x194);}return _0x282e66;};}function handleError(_0x4571cb,_0x2d4a8f){_0x2d4a8f=_0x2d4a8f||0x1f4;return function(_0x285951){logger[_0x7ba3('0x23')](_0x285951['stack']);if(_0x285951['name']){delete _0x285951['name'];}_0x4571cb['status'](_0x2d4a8f)['send'](_0x285951);};}exports[_0x7ba3('0x24')]=function(_0x39bee3,_0x5866ff){var _0x50bed9={},_0x3ff713={},_0x5019dc={'count':0x0,'rows':[]};var _0x4f43db=_[_0x7ba3('0x25')](db[_0x7ba3('0x26')][_0x7ba3('0x27')],function(_0x2ba832){return{'name':_0x2ba832[_0x7ba3('0x28')],'type':_0x2ba832[_0x7ba3('0x29')][_0x7ba3('0x2a')]};});_0x3ff713[_0x7ba3('0x2b')]=_[_0x7ba3('0x25')](_0x4f43db,_0x7ba3('0x2c'));_0x3ff713['query']=_[_0x7ba3('0x2d')](_0x39bee3['query']);_0x3ff713[_0x7ba3('0x2e')]=_['intersection'](_0x3ff713['model'],_0x3ff713['query']);_0x50bed9[_0x7ba3('0x2f')]=_[_0x7ba3('0x30')](_0x3ff713['model'],qs['fields'](_0x39bee3[_0x7ba3('0x31')]['fields']));_0x50bed9[_0x7ba3('0x2f')]=_0x50bed9['attributes'][_0x7ba3('0x32')]?_0x50bed9[_0x7ba3('0x2f')]:_0x3ff713[_0x7ba3('0x2b')];if(!_0x39bee3[_0x7ba3('0x31')][_0x7ba3('0x33')](_0x7ba3('0x34'))){_0x50bed9[_0x7ba3('0x1d')]=qs[_0x7ba3('0x1d')](_0x39bee3[_0x7ba3('0x31')][_0x7ba3('0x1d')]);_0x50bed9['offset']=qs['offset'](_0x39bee3[_0x7ba3('0x31')]['offset']);}_0x50bed9['order']=qs[_0x7ba3('0x35')](_0x39bee3[_0x7ba3('0x31')][_0x7ba3('0x35')]);_0x50bed9[_0x7ba3('0x36')]=qs[_0x7ba3('0x2e')](_['pick'](_0x39bee3[_0x7ba3('0x31')],_0x3ff713['filters']),_0x4f43db);if(_0x39bee3[_0x7ba3('0x31')][_0x7ba3('0x37')]){_0x50bed9[_0x7ba3('0x36')]=_[_0x7ba3('0x38')](_0x50bed9[_0x7ba3('0x36')],{'$or':_[_0x7ba3('0x25')](_0x4f43db,function(_0x5b9f34){if(_0x5b9f34[_0x7ba3('0x29')]!==_0x7ba3('0x39')){var _0x27c996={};_0x27c996[_0x5b9f34[_0x7ba3('0x2c')]]={'$like':'%'+_0x39bee3[_0x7ba3('0x31')][_0x7ba3('0x37')]+'%'};return _0x27c996;}})});}_0x50bed9=_[_0x7ba3('0x38')]({},_0x50bed9,_0x39bee3[_0x7ba3('0x3a')]);var _0x3c9349={'where':_0x50bed9[_0x7ba3('0x36')]};return db['ServicenowField'][_0x7ba3('0x1b')](_0x3c9349)[_0x7ba3('0x21')](function(_0x50213a){_0x5019dc['count']=_0x50213a;if(_0x39bee3[_0x7ba3('0x31')][_0x7ba3('0x3b')]){_0x50bed9['include']=[{'all':!![]}];}return db[_0x7ba3('0x26')][_0x7ba3('0x3c')](_0x50bed9);})[_0x7ba3('0x21')](function(_0x50262a){_0x5019dc[_0x7ba3('0x3d')]=_0x50262a;return _0x5019dc;})[_0x7ba3('0x21')](respondWithFilteredResult(_0x5866ff,_0x50bed9))['catch'](handleError(_0x5866ff,null));};exports[_0x7ba3('0x3e')]=function(_0x20de74,_0x581620){var _0x4990d9={'raw':!![],'where':{'id':_0x20de74[_0x7ba3('0x3f')]['id']}},_0x572fac={};_0x572fac[_0x7ba3('0x2b')]=_[_0x7ba3('0x2d')](db[_0x7ba3('0x26')][_0x7ba3('0x27')]);_0x572fac[_0x7ba3('0x31')]=_['keys'](_0x20de74[_0x7ba3('0x31')]);_0x572fac['filters']=_[_0x7ba3('0x30')](_0x572fac[_0x7ba3('0x2b')],_0x572fac['query']);_0x4990d9['attributes']=_[_0x7ba3('0x30')](_0x572fac[_0x7ba3('0x2b')],qs[_0x7ba3('0x40')](_0x20de74[_0x7ba3('0x31')][_0x7ba3('0x40')]));_0x4990d9['attributes']=_0x4990d9[_0x7ba3('0x2f')][_0x7ba3('0x32')]?_0x4990d9[_0x7ba3('0x2f')]:_0x572fac['model'];if(_0x20de74[_0x7ba3('0x31')][_0x7ba3('0x3b')]){_0x4990d9['include']=[{'all':!![]}];}_0x4990d9=_[_0x7ba3('0x38')]({},_0x4990d9,_0x20de74[_0x7ba3('0x3a')]);return db[_0x7ba3('0x26')]['find'](_0x4990d9)[_0x7ba3('0x21')](handleEntityNotFound(_0x581620,null))[_0x7ba3('0x21')](respondWithResult(_0x581620,null))['catch'](handleError(_0x581620,null));};exports[_0x7ba3('0x41')]=function(_0x1ef43e,_0x6630){return db[_0x7ba3('0x26')][_0x7ba3('0x41')](_0x1ef43e[_0x7ba3('0x42')],{})['then'](respondWithResult(_0x6630,0xc9))[_0x7ba3('0x43')](handleError(_0x6630,null));};exports['update']=function(_0x2cf1f8,_0x32e92e){if(_0x2cf1f8[_0x7ba3('0x42')]['id']){delete _0x2cf1f8['body']['id'];}return db[_0x7ba3('0x26')][_0x7ba3('0x44')]({'where':{'id':_0x2cf1f8['params']['id']}})[_0x7ba3('0x21')](handleEntityNotFound(_0x32e92e,null))[_0x7ba3('0x21')](saveUpdates(_0x2cf1f8[_0x7ba3('0x42')],null))[_0x7ba3('0x21')](respondWithResult(_0x32e92e,null))[_0x7ba3('0x43')](handleError(_0x32e92e,null));};exports[_0x7ba3('0x22')]=function(_0x328e22,_0x37c19a){return db[_0x7ba3('0x26')][_0x7ba3('0x44')]({'where':{'id':_0x328e22[_0x7ba3('0x3f')]['id']}})[_0x7ba3('0x21')](handleEntityNotFound(_0x37c19a,null))['then'](removeEntity(_0x37c19a,null))['catch'](handleError(_0x37c19a,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 23eef46..24f10d1 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 _0xa994=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0x125aa4,_0x195520){var _0x485b95=function(_0x1d0ee9){while(--_0x1d0ee9){_0x125aa4['push'](_0x125aa4['shift']());}};_0x485b95(++_0x195520);}(_0xa994,0x1c9));var _0x4a99=function(_0x483316,_0x256d9f){_0x483316=_0x483316-0x0;var _0x10e0cb=_0xa994[_0x483316];return _0x10e0cb;};'use strict';var _=require(_0x4a99('0x0'));var util=require(_0x4a99('0x1'));var logger=require(_0x4a99('0x2'))(_0x4a99('0x3'));var moment=require(_0x4a99('0x4'));var BPromise=require(_0x4a99('0x5'));var rp=require(_0x4a99('0x6'));var fs=require('fs');var path=require(_0x4a99('0x7'));var rimraf=require(_0x4a99('0x8'));var config=require(_0x4a99('0x9'));var attributes=require(_0x4a99('0xa'));module[_0x4a99('0xb')]=function(_0x5602b4,_0x5bb116){return _0x5602b4[_0x4a99('0xc')](_0x4a99('0xd'),attributes,{'tableName':_0x4a99('0xe'),'paranoid':![],'indexes':[{'name':_0x4a99('0xf'),'fields':[_0x4a99('0x10'),_0x4a99('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ed6=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x41e10f,_0x31e4ae){var _0xaf4b96=function(_0x145be4){while(--_0x145be4){_0x41e10f['push'](_0x41e10f['shift']());}};_0xaf4b96(++_0x31e4ae);}(_0x4ed6,0x19c));var _0x64ed=function(_0x3b941e,_0x449422){_0x3b941e=_0x3b941e-0x0;var _0x1f62b8=_0x4ed6[_0x3b941e];return _0x1f62b8;};'use strict';var _=require(_0x64ed('0x0'));var util=require(_0x64ed('0x1'));var logger=require(_0x64ed('0x2'))('api');var moment=require(_0x64ed('0x3'));var BPromise=require(_0x64ed('0x4'));var rp=require(_0x64ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x64ed('0x6'));var config=require(_0x64ed('0x7'));var attributes=require(_0x64ed('0x8'));module[_0x64ed('0x9')]=function(_0xf5c470,_0x223c3c){return _0xf5c470[_0x64ed('0xa')](_0x64ed('0xb'),attributes,{'tableName':_0x64ed('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x64ed('0xd'),_0x64ed('0xe')],'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 ad6c3e7..bda0bcc 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 _0xb70e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','message','ServicenowField,\x20%s,\x20%s','result','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb70e,0xbb));var _0xeb70=function(_0x1bba5c,_0x4671b2){_0x1bba5c=_0x1bba5c-0x0;var _0x14f278=_0xb70e[_0x1bba5c];return _0x14f278;};'use strict';var _=require(_0xeb70('0x0'));var util=require(_0xeb70('0x1'));var moment=require(_0xeb70('0x2'));var BPromise=require(_0xeb70('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb70('0x4'));var db=require(_0xeb70('0x5'))['db'];var utils=require(_0xeb70('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xeb70('0x7'));var jayson=require(_0xeb70('0x8'));var client=jayson[_0xeb70('0x9')][_0xeb70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27c64e,_0x27c929,_0x3a7df2){return new BPromise(function(_0xa29d2c,_0x4a5063){return client[_0xeb70('0xb')](_0x27c64e,_0x3a7df2)[_0xeb70('0xc')](function(_0x4fb46a){logger[_0xeb70('0xd')]('ServicenowField,\x20%s,\x20%s',_0x27c929,'request\x20sent');logger[_0xeb70('0xe')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x27c929,_0xeb70('0xf'),JSON[_0xeb70('0x10')](_0x4fb46a));if(_0x4fb46a[_0xeb70('0x11')]){if(_0x4fb46a[_0xeb70('0x11')]['code']===0x1f4){logger[_0xeb70('0x11')]('ServicenowField,\x20%s,\x20%s',_0x27c929,_0x4fb46a[_0xeb70('0x11')][_0xeb70('0x12')]);return _0x4a5063(_0x4fb46a['error'][_0xeb70('0x12')]);}logger[_0xeb70('0x11')](_0xeb70('0x13'),_0x27c929,_0x4fb46a[_0xeb70('0x11')][_0xeb70('0x12')]);return _0xa29d2c(_0x4fb46a['error']['message']);}else{logger[_0xeb70('0xd')](_0xeb70('0x13'),_0x27c929,_0xeb70('0xf'));_0xa29d2c(_0x4fb46a[_0xeb70('0x14')][_0xeb70('0x12')]);}})['catch'](function(_0x5b0631){logger[_0xeb70('0x11')]('ServicenowField,\x20%s,\x20%s',_0x27c929,_0x5b0631);_0x4a5063(_0x5b0631);});});} \ No newline at end of file +var _0xf33e=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x485a5d,_0x4f346b){var _0xd13bf5=function(_0x94aa4a){while(--_0x94aa4a){_0x485a5d['push'](_0x485a5d['shift']());}};_0xd13bf5(++_0x4f346b);}(_0xf33e,0x1b1));var _0xef33=function(_0x729158,_0x4fc83f){_0x729158=_0x729158-0x0;var _0x3a230e=_0xf33e[_0x729158];return _0x3a230e;};'use strict';var _=require(_0xef33('0x0'));var util=require(_0xef33('0x1'));var moment=require(_0xef33('0x2'));var BPromise=require(_0xef33('0x3'));var rs=require(_0xef33('0x4'));var fs=require('fs');var Redis=require(_0xef33('0x5'));var db=require(_0xef33('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xef33('0x7'))('rpc');var config=require(_0xef33('0x8'));var jayson=require(_0xef33('0x9'));var client=jayson['client'][_0xef33('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c495c,_0xd62eaf,_0x407c34){return new BPromise(function(_0x3f27d6,_0xf6681f){return client['request'](_0x3c495c,_0x407c34)[_0xef33('0xb')](function(_0x27984a){logger[_0xef33('0xc')](_0xef33('0xd'),_0xd62eaf,_0xef33('0xe'));logger[_0xef33('0xf')](_0xef33('0x10'),_0xd62eaf,_0xef33('0xe'),JSON[_0xef33('0x11')](_0x27984a));if(_0x27984a[_0xef33('0x12')]){if(_0x27984a['error'][_0xef33('0x13')]===0x1f4){logger[_0xef33('0x12')]('ServicenowField,\x20%s,\x20%s',_0xd62eaf,_0x27984a[_0xef33('0x12')]['message']);return _0xf6681f(_0x27984a[_0xef33('0x12')]['message']);}logger[_0xef33('0x12')](_0xef33('0xd'),_0xd62eaf,_0x27984a['error'][_0xef33('0x14')]);return _0x3f27d6(_0x27984a[_0xef33('0x12')][_0xef33('0x14')]);}else{logger[_0xef33('0xc')](_0xef33('0xd'),_0xd62eaf,_0xef33('0xe'));_0x3f27d6(_0x27984a[_0xef33('0x15')]['message']);}})[_0xef33('0x16')](function(_0x2715fc){logger[_0xef33('0x12')](_0xef33('0xd'),_0xd62eaf,_0x2715fc);_0xf6681f(_0x2715fc);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index b376e90..04ec404 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 _0x00d0=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','/:id','exports','multer','util','connect-timeout'];(function(_0x3614fd,_0x173bb1){var _0x1271ed=function(_0x2537a2){while(--_0x2537a2){_0x3614fd['push'](_0x3614fd['shift']());}};_0x1271ed(++_0x173bb1);}(_0x00d0,0x19f));var _0x000d=function(_0x571c4f,_0x26a3eb){_0x571c4f=_0x571c4f-0x0;var _0x41c9e9=_0x00d0[_0x571c4f];return _0x41c9e9;};'use strict';var multer=require(_0x000d('0x0'));var util=require(_0x000d('0x1'));var path=require('path');var timeout=require(_0x000d('0x2'));var express=require(_0x000d('0x3'));var router=express['Router']();var auth=require(_0x000d('0x4'));var interaction=require(_0x000d('0x5'));var config=require(_0x000d('0x6'));var controller=require(_0x000d('0x7'));router['get']('/',auth[_0x000d('0x8')](),controller['index']);router['get']('/:id',auth[_0x000d('0x8')](),controller[_0x000d('0x9')]);router[_0x000d('0xa')](_0x000d('0xb'),auth['isAuthenticated'](),controller[_0x000d('0xc')]);router[_0x000d('0xa')](_0x000d('0xd'),auth['isAuthenticated'](),controller[_0x000d('0xe')]);router[_0x000d('0xf')]('/',auth[_0x000d('0x8')](),controller[_0x000d('0x10')]);router['post']('/:id/configurations',auth[_0x000d('0x8')](),controller[_0x000d('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x000d('0x12')]);router[_0x000d('0x13')](_0x000d('0x14'),auth[_0x000d('0x8')](),controller['destroy']);module[_0x000d('0x15')]=router; \ No newline at end of file +var _0xc3f8=['../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x48a335,_0x359b33){var _0xd83ca8=function(_0x187ab9){while(--_0x187ab9){_0x48a335['push'](_0x48a335['shift']());}};_0xd83ca8(++_0x359b33);}(_0xc3f8,0x89));var _0x8c3f=function(_0x20fada,_0xd0a02a){_0x20fada=_0x20fada-0x0;var _0x3bdb74=_0xc3f8[_0x20fada];return _0x3bdb74;};'use strict';var multer=require(_0x8c3f('0x0'));var util=require(_0x8c3f('0x1'));var path=require(_0x8c3f('0x2'));var timeout=require(_0x8c3f('0x3'));var express=require(_0x8c3f('0x4'));var router=express[_0x8c3f('0x5')]();var auth=require(_0x8c3f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8c3f('0x7'));var controller=require(_0x8c3f('0x8'));router[_0x8c3f('0x9')]('/',auth[_0x8c3f('0xa')](),controller[_0x8c3f('0xb')]);router[_0x8c3f('0x9')](_0x8c3f('0xc'),auth[_0x8c3f('0xa')](),controller[_0x8c3f('0xd')]);router[_0x8c3f('0x9')](_0x8c3f('0xe'),auth[_0x8c3f('0xa')](),controller['getConfigurations']);router[_0x8c3f('0x9')](_0x8c3f('0xf'),auth['isAuthenticated'](),controller[_0x8c3f('0x10')]);router[_0x8c3f('0x11')]('/',auth[_0x8c3f('0xa')](),controller[_0x8c3f('0x12')]);router['post'](_0x8c3f('0xe'),auth[_0x8c3f('0xa')](),controller[_0x8c3f('0x13')]);router[_0x8c3f('0x14')](_0x8c3f('0xc'),auth['isAuthenticated'](),controller[_0x8c3f('0x15')]);router[_0x8c3f('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8c3f('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 8f0c944..d3ff0f3 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 _0xe9f3=['username','remoteUri','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe9f3,0x116));var _0x3e9f=function(_0x46dbe4,_0x1130c4){_0x46dbe4=_0x46dbe4-0x0;var _0xb04157=_0xe9f3[_0x46dbe4];return _0xb04157;};'use strict';var Sequelize=require('sequelize');module[_0x3e9f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3e9f('0x1')]},'username':{'type':Sequelize[_0x3e9f('0x1')],'unique':_0x3e9f('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3e9f('0x1')],'unique':_0x3e9f('0x3')},'serverUrl':{'type':Sequelize[_0x3e9f('0x1')]}}; \ No newline at end of file +var _0x7628=['remoteUri','sequelize','exports','STRING','username'];(function(_0x52fa33,_0xa5624e){var _0x5b1b2f=function(_0x3fe505){while(--_0x3fe505){_0x52fa33['push'](_0x52fa33['shift']());}};_0x5b1b2f(++_0xa5624e);}(_0x7628,0xf1));var _0x8762=function(_0x1151e3,_0x4f8633){_0x1151e3=_0x1151e3-0x0;var _0x38b679=_0x7628[_0x1151e3];return _0x38b679;};'use strict';var Sequelize=require(_0x8762('0x0'));module[_0x8762('0x1')]={'name':{'type':Sequelize[_0x8762('0x2')]},'description':{'type':Sequelize[_0x8762('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8762('0x3')},'password':{'type':Sequelize[_0x8762('0x2')]},'remoteUri':{'type':Sequelize[_0x8762('0x2')],'unique':_0x8762('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index d20e1dd..39fa483 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 _0xc123=['then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','end','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filter','merge','type','options','SugarcrmAccount','includeAll','include','findAll','rows','params','keys','length','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','sort','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','assigned_user_id','created_by','description','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','Calls','values','module_fields','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request'];(function(_0x42c132,_0x4fb45e){var _0x189fea=function(_0x7e5386){while(--_0x7e5386){_0x42c132['push'](_0x42c132['shift']());}};_0x189fea(++_0x4fb45e);}(_0xc123,0x67));var _0x3c12=function(_0x2beac6,_0x266360){_0x2beac6=_0x2beac6-0x0;var _0x5c2f65=_0xc123[_0x2beac6];return _0x5c2f65;};'use strict';var pdf=require(_0x3c12('0x0'));var emlformat=require(_0x3c12('0x1'));var rimraf=require(_0x3c12('0x2'));var zipdir=require(_0x3c12('0x3'));var jsonpatch=require(_0x3c12('0x4'));var rp=require(_0x3c12('0x5'));var moment=require('moment');var BPromise=require(_0x3c12('0x6'));var Mustache=require(_0x3c12('0x7'));var util=require(_0x3c12('0x8'));var path=require('path');var sox=require(_0x3c12('0x9'));var csv=require('to-csv');var ejs=require(_0x3c12('0xa'));var fs=require('fs');var _=require(_0x3c12('0xb'));var squel=require(_0x3c12('0xc'));var crypto=require(_0x3c12('0xd'));var jsforce=require(_0x3c12('0xe'));var deskjs=require(_0x3c12('0xf'));var toCsv=require(_0x3c12('0x10'));var querystring=require('querystring');var Papa=require(_0x3c12('0x11'));var Redis=require(_0x3c12('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3c12('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c12('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3c12('0x15'));var licenseUtil=require(_0x3c12('0x16'));var db=require(_0x3c12('0x17'))['db'];var integrations=require(_0x3c12('0x18'));var jayson=require(_0x3c12('0x19'));var client=jayson[_0x3c12('0x1a')][_0x3c12('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x54942f,_0x37337f,_0x3345b7,_0x1e584f){return new BPromise(function(_0x1f0557,_0xf46306){var _0x418d74=_0x1e584f||client;return _0x418d74[_0x3c12('0x1c')](_0x54942f,_0x3345b7)[_0x3c12('0x1d')](function(_0xa0b10f){logger[_0x3c12('0x1e')](_0x3c12('0x1f'),_0x37337f,_0x3c12('0x20'));logger[_0x3c12('0x21')](_0x3c12('0x22'),_0x37337f,_0x3c12('0x20'),JSON['stringify'](_0xa0b10f));if(_0xa0b10f[_0x3c12('0x23')]){if(_0xa0b10f[_0x3c12('0x23')][_0x3c12('0x24')]===0x1f4){logger[_0x3c12('0x23')](_0x3c12('0x1f'),_0x37337f,_0xa0b10f['error'][_0x3c12('0x25')]);return _0xf46306(_0xa0b10f['error'][_0x3c12('0x25')]);}logger[_0x3c12('0x23')](_0x3c12('0x1f'),_0x37337f,_0xa0b10f[_0x3c12('0x23')][_0x3c12('0x25')]);return _0x1f0557(_0xa0b10f[_0x3c12('0x23')][_0x3c12('0x25')]);}else{logger[_0x3c12('0x1e')](_0x3c12('0x1f'),_0x37337f,_0x3c12('0x20'));_0x1f0557(_0xa0b10f[_0x3c12('0x26')][_0x3c12('0x25')]);}})[_0x3c12('0x27')](function(_0x217afb){logger[_0x3c12('0x23')](_0x3c12('0x1f'),_0x37337f,_0x217afb);_0xf46306(_0x217afb);});});}function respondWithStatusCode(_0x923437,_0x2f3560){_0x2f3560=_0x2f3560||0xcc;return function(_0x9cf9ce){if(_0x9cf9ce){return _0x923437[_0x3c12('0x28')](_0x2f3560);}return _0x923437[_0x3c12('0x29')](_0x2f3560)['end']();};}function respondWithResult(_0xedd24c,_0x1ae7fe){_0x1ae7fe=_0x1ae7fe||0xc8;return function(_0x56980b){if(_0x56980b){return _0xedd24c['status'](_0x1ae7fe)[_0x3c12('0x2a')](_0x56980b);}};}function respondWithFilteredResult(_0x2d4580,_0xa15ce8){return function(_0x39e012){if(_0x39e012){var _0x2f1a94=_0x39e012[_0x3c12('0x2b')],_0x3833a0=_0xa15ce8[_0x3c12('0x2c')],_0x22303b=_0xa15ce8[_0x3c12('0x2c')]+_0xa15ce8[_0x3c12('0x2d')],_0x58cf79;if(_0x22303b>=_0x2f1a94){_0x22303b=_0x2f1a94;_0x58cf79=0xc8;}else{_0x58cf79=0xce;}_0x2d4580[_0x3c12('0x29')](_0x58cf79);return _0x2d4580[_0x3c12('0x2e')](_0x3c12('0x2f'),_0x3833a0+'-'+_0x22303b+'/'+_0x2f1a94)[_0x3c12('0x2a')](_0x39e012);}return null;};}function patchUpdates(_0x31c6a6){return function(_0x256f7c){try{jsonpatch[_0x3c12('0x30')](_0x256f7c,_0x31c6a6,!![]);}catch(_0x460b8b){return BPromise['reject'](_0x460b8b);}return _0x256f7c[_0x3c12('0x31')]();};}function saveUpdates(_0x3e3287,_0x47fc79){return function(_0x3a26c3){if(_0x3a26c3){return _0x3a26c3[_0x3c12('0x32')](_0x3e3287)['then'](function(_0x4e8df0){return _0x4e8df0;});}return null;};}function removeEntity(_0x3cf749,_0x34cb50){return function(_0x57cce3){if(_0x57cce3){return _0x57cce3['destroy']()[_0x3c12('0x1d')](function(){_0x3cf749[_0x3c12('0x29')](0xcc)[_0x3c12('0x33')]();});}};}function handleEntityNotFound(_0x3aba3f,_0x3922f2){return function(_0x5b0ca8){if(!_0x5b0ca8){_0x3aba3f[_0x3c12('0x28')](0x194);}return _0x5b0ca8;};}function handleError(_0x295a0e,_0x58d787){_0x58d787=_0x58d787||0x1f4;return function(_0xc743ad){logger[_0x3c12('0x23')](_0xc743ad['stack']);if(_0xc743ad[_0x3c12('0x34')]){delete _0xc743ad[_0x3c12('0x34')];}_0x295a0e[_0x3c12('0x29')](_0x58d787)[_0x3c12('0x35')](_0xc743ad);};}exports[_0x3c12('0x36')]=function(_0x4c3789,_0x23e161){var _0x5c2d11={},_0x22dc34={},_0x5e725b={'count':0x0,'rows':[]};var _0x496633=_[_0x3c12('0x37')](db['SugarcrmAccount'][_0x3c12('0x38')],function(_0x4cc232){return{'name':_0x4cc232[_0x3c12('0x39')],'type':_0x4cc232['type'][_0x3c12('0x3a')]};});_0x22dc34[_0x3c12('0x3b')]=_[_0x3c12('0x37')](_0x496633,'name');_0x22dc34['query']=_['keys'](_0x4c3789[_0x3c12('0x3c')]);_0x22dc34[_0x3c12('0x3d')]=_['intersection'](_0x22dc34[_0x3c12('0x3b')],_0x22dc34['query']);_0x5c2d11[_0x3c12('0x3e')]=_[_0x3c12('0x3f')](_0x22dc34['model'],qs[_0x3c12('0x40')](_0x4c3789['query'][_0x3c12('0x40')]));_0x5c2d11[_0x3c12('0x3e')]=_0x5c2d11['attributes']['length']?_0x5c2d11['attributes']:_0x22dc34[_0x3c12('0x3b')];if(!_0x4c3789['query'][_0x3c12('0x41')](_0x3c12('0x42'))){_0x5c2d11[_0x3c12('0x2d')]=qs[_0x3c12('0x2d')](_0x4c3789[_0x3c12('0x3c')][_0x3c12('0x2d')]);_0x5c2d11[_0x3c12('0x2c')]=qs[_0x3c12('0x2c')](_0x4c3789[_0x3c12('0x3c')]['offset']);}_0x5c2d11[_0x3c12('0x43')]=qs['sort'](_0x4c3789[_0x3c12('0x3c')]['sort']);_0x5c2d11[_0x3c12('0x44')]=qs['filters'](_['pick'](_0x4c3789[_0x3c12('0x3c')],_0x22dc34[_0x3c12('0x3d')]),_0x496633);if(_0x4c3789[_0x3c12('0x3c')][_0x3c12('0x45')]){_0x5c2d11[_0x3c12('0x44')]=_[_0x3c12('0x46')](_0x5c2d11[_0x3c12('0x44')],{'$or':_[_0x3c12('0x37')](_0x496633,function(_0x254925){if(_0x254925[_0x3c12('0x47')]!=='VIRTUAL'){var _0x3cdfdf={};_0x3cdfdf[_0x254925['name']]={'$like':'%'+_0x4c3789[_0x3c12('0x3c')][_0x3c12('0x45')]+'%'};return _0x3cdfdf;}})});}_0x5c2d11=_['merge']({},_0x5c2d11,_0x4c3789[_0x3c12('0x48')]);var _0x14def5={'where':_0x5c2d11[_0x3c12('0x44')]};return db[_0x3c12('0x49')][_0x3c12('0x2b')](_0x14def5)[_0x3c12('0x1d')](function(_0x4bc54b){_0x5e725b[_0x3c12('0x2b')]=_0x4bc54b;if(_0x4c3789[_0x3c12('0x3c')][_0x3c12('0x4a')]){_0x5c2d11[_0x3c12('0x4b')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x3c12('0x4c')](_0x5c2d11);})[_0x3c12('0x1d')](function(_0x514073){_0x5e725b[_0x3c12('0x4d')]=_0x514073;return _0x5e725b;})[_0x3c12('0x1d')](respondWithFilteredResult(_0x23e161,_0x5c2d11))[_0x3c12('0x27')](handleError(_0x23e161,null));};exports['show']=function(_0x4f7d5f,_0x3b0240){var _0x2f6ac6={'raw':![],'where':{'id':_0x4f7d5f[_0x3c12('0x4e')]['id']}},_0x35f072={};_0x35f072['model']=_['keys'](db['SugarcrmAccount'][_0x3c12('0x38')]);_0x35f072['query']=_[_0x3c12('0x4f')](_0x4f7d5f['query']);_0x35f072[_0x3c12('0x3d')]=_[_0x3c12('0x3f')](_0x35f072[_0x3c12('0x3b')],_0x35f072[_0x3c12('0x3c')]);_0x2f6ac6[_0x3c12('0x3e')]=_[_0x3c12('0x3f')](_0x35f072[_0x3c12('0x3b')],qs[_0x3c12('0x40')](_0x4f7d5f[_0x3c12('0x3c')]['fields']));_0x2f6ac6[_0x3c12('0x3e')]=_0x2f6ac6[_0x3c12('0x3e')][_0x3c12('0x50')]?_0x2f6ac6[_0x3c12('0x3e')]:_0x35f072[_0x3c12('0x3b')];if(_0x4f7d5f[_0x3c12('0x3c')][_0x3c12('0x4a')]){_0x2f6ac6[_0x3c12('0x4b')]=[{'all':!![]}];}_0x2f6ac6=_[_0x3c12('0x46')]({},_0x2f6ac6,_0x4f7d5f[_0x3c12('0x48')]);return db[_0x3c12('0x49')][_0x3c12('0x51')](_0x2f6ac6)[_0x3c12('0x1d')](handleEntityNotFound(_0x3b0240,null))[_0x3c12('0x1d')](respondWithResult(_0x3b0240,null))[_0x3c12('0x27')](handleError(_0x3b0240,null));};exports['create']=function(_0x51a2a0,_0x50cbaa){return db[_0x3c12('0x49')][_0x3c12('0x52')](_0x51a2a0[_0x3c12('0x53')],{})[_0x3c12('0x1d')](respondWithResult(_0x50cbaa,0xc9))[_0x3c12('0x27')](handleError(_0x50cbaa,null));};exports[_0x3c12('0x32')]=function(_0xa05370,_0x511352){if(_0xa05370[_0x3c12('0x53')]['id']){delete _0xa05370[_0x3c12('0x53')]['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0xa05370['params']['id']}})[_0x3c12('0x1d')](handleEntityNotFound(_0x511352,null))[_0x3c12('0x1d')](saveUpdates(_0xa05370[_0x3c12('0x53')],null))[_0x3c12('0x1d')](respondWithResult(_0x511352,null))[_0x3c12('0x27')](handleError(_0x511352,null));};exports[_0x3c12('0x54')]=function(_0x2657f0,_0x4379cb){return db[_0x3c12('0x49')][_0x3c12('0x51')]({'where':{'id':_0x2657f0[_0x3c12('0x4e')]['id']}})[_0x3c12('0x1d')](handleEntityNotFound(_0x4379cb,null))[_0x3c12('0x1d')](removeEntity(_0x4379cb,null))[_0x3c12('0x27')](handleError(_0x4379cb,null));};exports[_0x3c12('0x55')]=function(_0x2b0ab1,_0x2a20a0,_0x1ab037){var _0x497c72={};var _0x5f26a2={};var _0x2f1445;var _0xde38dc;return db['SugarcrmAccount'][_0x3c12('0x56')]({'where':{'id':_0x2b0ab1[_0x3c12('0x4e')]['id']}})[_0x3c12('0x1d')](handleEntityNotFound(_0x2a20a0,null))[_0x3c12('0x1d')](function(_0x3bc997){if(_0x3bc997){_0x2f1445=_0x3bc997;_0x5f26a2[_0x3c12('0x3b')]=_[_0x3c12('0x4f')](db[_0x3c12('0x57')][_0x3c12('0x38')]);_0x5f26a2['query']=_['keys'](_0x2b0ab1[_0x3c12('0x3c')]);_0x5f26a2[_0x3c12('0x3d')]=_[_0x3c12('0x3f')](_0x5f26a2[_0x3c12('0x3b')],_0x5f26a2[_0x3c12('0x3c')]);_0x497c72[_0x3c12('0x3e')]=_[_0x3c12('0x3f')](_0x5f26a2[_0x3c12('0x3b')],qs['fields'](_0x2b0ab1[_0x3c12('0x3c')][_0x3c12('0x40')]));_0x497c72['attributes']=_0x497c72[_0x3c12('0x3e')]['length']?_0x497c72['attributes']:_0x5f26a2[_0x3c12('0x3b')];_0x497c72[_0x3c12('0x43')]=qs['sort'](_0x2b0ab1[_0x3c12('0x3c')][_0x3c12('0x58')]);_0x497c72[_0x3c12('0x44')]=qs['filters'](_['pick'](_0x2b0ab1[_0x3c12('0x3c')],_0x5f26a2[_0x3c12('0x3d')]));if(_0x2b0ab1[_0x3c12('0x3c')][_0x3c12('0x45')]){_0x497c72[_0x3c12('0x44')]=_[_0x3c12('0x46')](_0x497c72[_0x3c12('0x44')],{'$or':_[_0x3c12('0x37')](_0x497c72[_0x3c12('0x3e')],function(_0x1e046c){var _0x327693={};_0x327693[_0x1e046c]={'$like':'%'+_0x2b0ab1[_0x3c12('0x3c')][_0x3c12('0x45')]+'%'};return _0x327693;})});}_0x497c72=_[_0x3c12('0x46')]({},_0x497c72,_0x2b0ab1['options']);return _0x2f1445[_0x3c12('0x55')](_0x497c72);}})['then'](function(_0x178693){if(_0x178693){_0xde38dc=_0x178693[_0x3c12('0x50')];if(!_0x2b0ab1['query'][_0x3c12('0x41')](_0x3c12('0x42'))){_0x497c72['limit']=qs['limit'](_0x2b0ab1[_0x3c12('0x3c')]['limit']);_0x497c72[_0x3c12('0x2c')]=qs[_0x3c12('0x2c')](_0x2b0ab1[_0x3c12('0x3c')][_0x3c12('0x2c')]);}return _0x2f1445[_0x3c12('0x55')](_0x497c72);}})[_0x3c12('0x1d')](function(_0x350e3b){if(_0x350e3b){return _0x350e3b?{'count':_0xde38dc,'rows':_0x350e3b}:null;}})[_0x3c12('0x1d')](respondWithResult(_0x2a20a0,null))[_0x3c12('0x27')](handleError(_0x2a20a0,null));};exports['addConfiguration']=function(_0x469d92,_0x39bbbd,_0x376d10){if(_0x469d92[_0x3c12('0x53')]['id']){delete _0x469d92['body']['id'];}return db['SugarcrmAccount'][_0x3c12('0x56')]({'where':{'id':_0x469d92['params']['id']}})[_0x3c12('0x1d')](handleEntityNotFound(_0x39bbbd,null))[_0x3c12('0x1d')](function(_0x1e8659){if(_0x1e8659){_0x469d92[_0x3c12('0x53')][_0x3c12('0x59')]=_0x1e8659['id'];_0x469d92[_0x3c12('0x53')][_0x3c12('0x5a')]=integrations['getSubjects'](_0x469d92[_0x3c12('0x53')][_0x3c12('0x5b')],_0x469d92[_0x3c12('0x53')]['type']);_0x469d92[_0x3c12('0x53')][_0x3c12('0x5c')]=integrations[_0x3c12('0x5d')](_0x469d92[_0x3c12('0x53')]['channel'],_0x469d92[_0x3c12('0x53')]['type']);return db['SugarcrmConfiguration']['create'](_0x469d92[_0x3c12('0x53')],{'include':[{'model':db[_0x3c12('0x5e')],'as':'Subjects'},{'model':db[_0x3c12('0x5e')],'as':'Descriptions'}]});}return null;})[_0x3c12('0x1d')](respondWithResult(_0x39bbbd,null))['catch'](handleError(_0x39bbbd,null));};exports['getFields']=function(_0x4f21a3,_0x4c461b,_0x4dee70){var _0x751033='';var _0x4863e2=['id',_0x3c12('0x34'),_0x3c12('0x5f'),_0x3c12('0x60'),_0x3c12('0x61'),'date_start','duration_hours',_0x3c12('0x62'),_0x3c12('0x63'),_0x3c12('0x64'),_0x3c12('0x65'),_0x3c12('0x66')];return db[_0x3c12('0x49')][_0x3c12('0x56')]({'where':{'id':_0x4f21a3[_0x3c12('0x4e')]['id']},'attributes':['id',_0x3c12('0x67'),'password',_0x3c12('0x68')]})[_0x3c12('0x1d')](handleEntityNotFound(_0x4c461b,null))[_0x3c12('0x1d')](function(_0xb145d5){if(_0xb145d5){_0x751033=_0xb145d5[_0x3c12('0x68')];var _0x2e67e1=_0x751033[_0x3c12('0x69')](-0x1);if(_0x2e67e1==='/'){_0x751033=_0x751033[_0x3c12('0x6a')](0x0,_0x751033[_0x3c12('0x6b')](_0x2e67e1));}return rp({'method':_0x3c12('0x6c'),'uri':util['format'](_0x3c12('0x6d'),_0x751033,_0x3c12('0x6e')),'json':!![],'form':{'method':_0x3c12('0x6f'),'input_type':_0x3c12('0x70'),'response_type':_0x3c12('0x70'),'rest_data':JSON[_0x3c12('0x71')]({'user_auth':{'user_name':_0xb145d5[_0x3c12('0x67')],'password':_0xb145d5[_0x3c12('0x72')],'encryption':_0x3c12('0x73')},'application':_0x3c12('0x74')})}});}})[_0x3c12('0x1d')](function(_0x361744){if(_0x361744&&_0x361744[_0x3c12('0x34')]!==_0x3c12('0x75')&&_0x361744[_0x3c12('0x34')]!==_0x3c12('0x76')){return rp({'method':_0x3c12('0x6c'),'uri':util[_0x3c12('0x77')](_0x3c12('0x6d'),_0x751033,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x3c12('0x78'),'input_type':_0x3c12('0x70'),'response_type':_0x3c12('0x70'),'rest_data':JSON['stringify']({'session':_0x361744['id'],'module_name':_0x3c12('0x79')})}})[_0x3c12('0x1d')](function(_0x35b8cf){if(_0x35b8cf){var _0x2a0a24=_[_0x3c12('0x7a')](_0x35b8cf[_0x3c12('0x7b')]);_['remove'](_0x2a0a24,function(_0x3d8193){return _0x4863e2['includes'](_0x3d8193['name']);});return{'count':_0x2a0a24[_0x3c12('0x50')],'rows':_[_0x3c12('0x37')](_0x2a0a24,function(_0x38f8fd){return{'id':_0x38f8fd[_0x3c12('0x34')],'name':_0x38f8fd[_0x3c12('0x7c')],'custom':_[_0x3c12('0x7d')](_0x38f8fd[_0x3c12('0x34')],'_c')?!![]:![],'options':_0x38f8fd[_0x3c12('0x48')]?_[_0x3c12('0x37')](_[_0x3c12('0x7a')](_0x38f8fd['options']),function(_0x1f19fe){return{'name':_0x1f19fe[_0x3c12('0x7e')],'value':_0x1f19fe[_0x3c12('0x34')]};}):[]};})};}})['then'](respondWithResult(_0x4c461b,null))[_0x3c12('0x27')](function(_0x1746a0){var _0x1998f2=_0x4f21a3[_0x3c12('0x3c')][_0x3c12('0x7f')]?0x1f4:_0x1746a0[_0x3c12('0x80')]||0x1f4;logger[_0x3c12('0x23')](_0x3c12('0x81'),_0x3c12('0x82'),_0x1998f2,JSON[_0x3c12('0x71')](_0x1746a0));delete _0x1746a0['name'];if(_0x1998f2===0x191){_0x1998f2=0x190;}_0x4c461b[_0x3c12('0x29')](_0x1998f2)['send'](_0x4f21a3[_0x3c12('0x3c')][_0x3c12('0x7f')]?{'message':_0x3c12('0x83'),'statusCode':_0x1746a0[_0x3c12('0x80')]}:_0x1746a0);});}else{var _0x445ea7=0x1f4;_0x4c461b['status'](_0x445ea7)[_0x3c12('0x35')]({'message':_0x3c12('0x83'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x214c=['nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_minutes','parent_type','parent_name','direction','username','password','substring','lastIndexOf','POST','format','login','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','JSON','values','module_fields','includes','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','pick','filter','where','VIRTUAL','SugarcrmAccount','includeAll','rows','catch','show','keys','include','merge','options','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','sort'];(function(_0x44300f,_0x231ff2){var _0x59f053=function(_0x3f7244){while(--_0x3f7244){_0x44300f['push'](_0x44300f['shift']());}};_0x59f053(++_0x231ff2);}(_0x214c,0x18f));var _0xc214=function(_0x447ae5,_0x28dc83){_0x447ae5=_0x447ae5-0x0;var _0x54c1e7=_0x214c[_0x447ae5];return _0x54c1e7;};'use strict';var pdf=require(_0xc214('0x0'));var emlformat=require(_0xc214('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc214('0x2'));var jsonpatch=require(_0xc214('0x3'));var rp=require(_0xc214('0x4'));var moment=require('moment');var BPromise=require(_0xc214('0x5'));var Mustache=require(_0xc214('0x6'));var util=require('util');var path=require('path');var sox=require(_0xc214('0x7'));var csv=require(_0xc214('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc214('0x9'));var squel=require(_0xc214('0xa'));var crypto=require(_0xc214('0xb'));var jsforce=require(_0xc214('0xc'));var deskjs=require(_0xc214('0xd'));var toCsv=require(_0xc214('0x8'));var querystring=require(_0xc214('0xe'));var Papa=require('papaparse');var Redis=require(_0xc214('0xf'));var authService=require(_0xc214('0x10'));var qs=require(_0xc214('0x11'));var as=require(_0xc214('0x12'));var hardwareService=require(_0xc214('0x13'));var logger=require(_0xc214('0x14'))('api');var utils=require(_0xc214('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc214('0x16'))['db'];var integrations=require(_0xc214('0x17'));var jayson=require(_0xc214('0x18'));var client=jayson[_0xc214('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbe4fcd,_0x29aabd,_0x3e367c,_0x548963){return new BPromise(function(_0x25ab1f,_0x35b25d){var _0x238566=_0x548963||client;return _0x238566[_0xc214('0x1a')](_0xbe4fcd,_0x3e367c)[_0xc214('0x1b')](function(_0x4376a6){logger[_0xc214('0x1c')](_0xc214('0x1d'),_0x29aabd,'request\x20sent');logger[_0xc214('0x1e')](_0xc214('0x1f'),_0x29aabd,_0xc214('0x20'),JSON['stringify'](_0x4376a6));if(_0x4376a6[_0xc214('0x21')]){if(_0x4376a6['error'][_0xc214('0x22')]===0x1f4){logger[_0xc214('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x29aabd,_0x4376a6[_0xc214('0x21')][_0xc214('0x23')]);return _0x35b25d(_0x4376a6['error'][_0xc214('0x23')]);}logger[_0xc214('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x29aabd,_0x4376a6[_0xc214('0x21')][_0xc214('0x23')]);return _0x25ab1f(_0x4376a6[_0xc214('0x21')][_0xc214('0x23')]);}else{logger['info'](_0xc214('0x1d'),_0x29aabd,_0xc214('0x20'));_0x25ab1f(_0x4376a6['result'][_0xc214('0x23')]);}})['catch'](function(_0x285f17){logger[_0xc214('0x21')](_0xc214('0x1d'),_0x29aabd,_0x285f17);_0x35b25d(_0x285f17);});});}function respondWithStatusCode(_0x397c0e,_0xaaf4e0){_0xaaf4e0=_0xaaf4e0||0xcc;return function(_0x3bcb0d){if(_0x3bcb0d){return _0x397c0e['sendStatus'](_0xaaf4e0);}return _0x397c0e[_0xc214('0x24')](_0xaaf4e0)[_0xc214('0x25')]();};}function respondWithResult(_0xd86f03,_0x56c07f){_0x56c07f=_0x56c07f||0xc8;return function(_0x459a05){if(_0x459a05){return _0xd86f03[_0xc214('0x24')](_0x56c07f)[_0xc214('0x26')](_0x459a05);}};}function respondWithFilteredResult(_0x2f2404,_0x227ac9){return function(_0x37b6ec){if(_0x37b6ec){var _0x1809b4=_0x37b6ec[_0xc214('0x27')],_0x15968a=_0x227ac9[_0xc214('0x28')],_0x58bd5b=_0x227ac9[_0xc214('0x28')]+_0x227ac9[_0xc214('0x29')],_0x383bbf;if(_0x58bd5b>=_0x1809b4){_0x58bd5b=_0x1809b4;_0x383bbf=0xc8;}else{_0x383bbf=0xce;}_0x2f2404[_0xc214('0x24')](_0x383bbf);return _0x2f2404['set'](_0xc214('0x2a'),_0x15968a+'-'+_0x58bd5b+'/'+_0x1809b4)[_0xc214('0x26')](_0x37b6ec);}return null;};}function patchUpdates(_0x21a89f){return function(_0x40ad72){try{jsonpatch[_0xc214('0x2b')](_0x40ad72,_0x21a89f,!![]);}catch(_0x6c38e7){return BPromise[_0xc214('0x2c')](_0x6c38e7);}return _0x40ad72['save']();};}function saveUpdates(_0x1a2762,_0x2877b9){return function(_0x5614a2){if(_0x5614a2){return _0x5614a2[_0xc214('0x2d')](_0x1a2762)['then'](function(_0x51000d){return _0x51000d;});}return null;};}function removeEntity(_0x46df92,_0x4d125d){return function(_0x4888b7){if(_0x4888b7){return _0x4888b7[_0xc214('0x2e')]()[_0xc214('0x1b')](function(){_0x46df92['status'](0xcc)[_0xc214('0x25')]();});}};}function handleEntityNotFound(_0x233e6f,_0x5dce23){return function(_0x253b1c){if(!_0x253b1c){_0x233e6f['sendStatus'](0x194);}return _0x253b1c;};}function handleError(_0x3f1b60,_0x5d869a){_0x5d869a=_0x5d869a||0x1f4;return function(_0x2ab4b2){logger[_0xc214('0x21')](_0x2ab4b2[_0xc214('0x2f')]);if(_0x2ab4b2[_0xc214('0x30')]){delete _0x2ab4b2[_0xc214('0x30')];}_0x3f1b60[_0xc214('0x24')](_0x5d869a)[_0xc214('0x31')](_0x2ab4b2);};}exports['index']=function(_0x5ea4c7,_0x28a054){var _0x22e376={},_0x51ceb8={},_0x1ba7be={'count':0x0,'rows':[]};var _0x7a5dc2=_[_0xc214('0x32')](db['SugarcrmAccount'][_0xc214('0x33')],function(_0x4eabd4){return{'name':_0x4eabd4[_0xc214('0x34')],'type':_0x4eabd4[_0xc214('0x35')][_0xc214('0x36')]};});_0x51ceb8[_0xc214('0x37')]=_[_0xc214('0x32')](_0x7a5dc2,_0xc214('0x30'));_0x51ceb8[_0xc214('0x38')]=_['keys'](_0x5ea4c7[_0xc214('0x38')]);_0x51ceb8[_0xc214('0x39')]=_['intersection'](_0x51ceb8[_0xc214('0x37')],_0x51ceb8[_0xc214('0x38')]);_0x22e376[_0xc214('0x3a')]=_[_0xc214('0x3b')](_0x51ceb8[_0xc214('0x37')],qs[_0xc214('0x3c')](_0x5ea4c7[_0xc214('0x38')][_0xc214('0x3c')]));_0x22e376[_0xc214('0x3a')]=_0x22e376[_0xc214('0x3a')][_0xc214('0x3d')]?_0x22e376[_0xc214('0x3a')]:_0x51ceb8[_0xc214('0x37')];if(!_0x5ea4c7['query'][_0xc214('0x3e')]('nolimit')){_0x22e376[_0xc214('0x29')]=qs[_0xc214('0x29')](_0x5ea4c7['query'][_0xc214('0x29')]);_0x22e376[_0xc214('0x28')]=qs['offset'](_0x5ea4c7[_0xc214('0x38')]['offset']);}_0x22e376[_0xc214('0x3f')]=qs['sort'](_0x5ea4c7['query']['sort']);_0x22e376['where']=qs[_0xc214('0x39')](_[_0xc214('0x40')](_0x5ea4c7[_0xc214('0x38')],_0x51ceb8[_0xc214('0x39')]),_0x7a5dc2);if(_0x5ea4c7[_0xc214('0x38')][_0xc214('0x41')]){_0x22e376['where']=_['merge'](_0x22e376[_0xc214('0x42')],{'$or':_[_0xc214('0x32')](_0x7a5dc2,function(_0x467c19){if(_0x467c19['type']!==_0xc214('0x43')){var _0x4f6ff6={};_0x4f6ff6[_0x467c19[_0xc214('0x30')]]={'$like':'%'+_0x5ea4c7[_0xc214('0x38')]['filter']+'%'};return _0x4f6ff6;}})});}_0x22e376=_['merge']({},_0x22e376,_0x5ea4c7['options']);var _0x23dc26={'where':_0x22e376['where']};return db[_0xc214('0x44')]['count'](_0x23dc26)[_0xc214('0x1b')](function(_0x4c31b1){_0x1ba7be['count']=_0x4c31b1;if(_0x5ea4c7[_0xc214('0x38')][_0xc214('0x45')]){_0x22e376['include']=[{'all':!![]}];}return db[_0xc214('0x44')]['findAll'](_0x22e376);})['then'](function(_0x1bb47e){_0x1ba7be[_0xc214('0x46')]=_0x1bb47e;return _0x1ba7be;})[_0xc214('0x1b')](respondWithFilteredResult(_0x28a054,_0x22e376))[_0xc214('0x47')](handleError(_0x28a054,null));};exports[_0xc214('0x48')]=function(_0x375563,_0x54c5e0){var _0xda8f62={'raw':![],'where':{'id':_0x375563['params']['id']}},_0x224f2f={};_0x224f2f[_0xc214('0x37')]=_[_0xc214('0x49')](db[_0xc214('0x44')][_0xc214('0x33')]);_0x224f2f[_0xc214('0x38')]=_[_0xc214('0x49')](_0x375563[_0xc214('0x38')]);_0x224f2f['filters']=_['intersection'](_0x224f2f[_0xc214('0x37')],_0x224f2f[_0xc214('0x38')]);_0xda8f62[_0xc214('0x3a')]=_['intersection'](_0x224f2f[_0xc214('0x37')],qs[_0xc214('0x3c')](_0x375563[_0xc214('0x38')][_0xc214('0x3c')]));_0xda8f62['attributes']=_0xda8f62[_0xc214('0x3a')][_0xc214('0x3d')]?_0xda8f62[_0xc214('0x3a')]:_0x224f2f[_0xc214('0x37')];if(_0x375563['query'][_0xc214('0x45')]){_0xda8f62[_0xc214('0x4a')]=[{'all':!![]}];}_0xda8f62=_[_0xc214('0x4b')]({},_0xda8f62,_0x375563[_0xc214('0x4c')]);return db[_0xc214('0x44')][_0xc214('0x4d')](_0xda8f62)[_0xc214('0x1b')](handleEntityNotFound(_0x54c5e0,null))[_0xc214('0x1b')](respondWithResult(_0x54c5e0,null))[_0xc214('0x47')](handleError(_0x54c5e0,null));};exports[_0xc214('0x4e')]=function(_0x5ec7b4,_0x1924c7){return db[_0xc214('0x44')]['create'](_0x5ec7b4[_0xc214('0x4f')],{})[_0xc214('0x1b')](respondWithResult(_0x1924c7,0xc9))[_0xc214('0x47')](handleError(_0x1924c7,null));};exports[_0xc214('0x2d')]=function(_0x2a4c90,_0x20da26){if(_0x2a4c90['body']['id']){delete _0x2a4c90['body']['id'];}return db[_0xc214('0x44')][_0xc214('0x4d')]({'where':{'id':_0x2a4c90[_0xc214('0x50')]['id']}})[_0xc214('0x1b')](handleEntityNotFound(_0x20da26,null))['then'](saveUpdates(_0x2a4c90[_0xc214('0x4f')],null))[_0xc214('0x1b')](respondWithResult(_0x20da26,null))[_0xc214('0x47')](handleError(_0x20da26,null));};exports[_0xc214('0x2e')]=function(_0x30345d,_0xa6a8fe){return db[_0xc214('0x44')][_0xc214('0x4d')]({'where':{'id':_0x30345d[_0xc214('0x50')]['id']}})[_0xc214('0x1b')](handleEntityNotFound(_0xa6a8fe,null))['then'](removeEntity(_0xa6a8fe,null))[_0xc214('0x47')](handleError(_0xa6a8fe,null));};exports[_0xc214('0x51')]=function(_0x41f9cf,_0x36dc20,_0x30117b){var _0x4fb0cc={};var _0x2e9765={};var _0x1aa8cc;var _0x46dc48;return db['SugarcrmAccount'][_0xc214('0x52')]({'where':{'id':_0x41f9cf[_0xc214('0x50')]['id']}})[_0xc214('0x1b')](handleEntityNotFound(_0x36dc20,null))['then'](function(_0x413c0e){if(_0x413c0e){_0x1aa8cc=_0x413c0e;_0x2e9765[_0xc214('0x37')]=_[_0xc214('0x49')](db[_0xc214('0x53')][_0xc214('0x33')]);_0x2e9765[_0xc214('0x38')]=_['keys'](_0x41f9cf[_0xc214('0x38')]);_0x2e9765[_0xc214('0x39')]=_[_0xc214('0x3b')](_0x2e9765[_0xc214('0x37')],_0x2e9765[_0xc214('0x38')]);_0x4fb0cc['attributes']=_['intersection'](_0x2e9765[_0xc214('0x37')],qs[_0xc214('0x3c')](_0x41f9cf['query']['fields']));_0x4fb0cc[_0xc214('0x3a')]=_0x4fb0cc[_0xc214('0x3a')][_0xc214('0x3d')]?_0x4fb0cc[_0xc214('0x3a')]:_0x2e9765['model'];_0x4fb0cc[_0xc214('0x3f')]=qs[_0xc214('0x54')](_0x41f9cf['query'][_0xc214('0x54')]);_0x4fb0cc[_0xc214('0x42')]=qs[_0xc214('0x39')](_['pick'](_0x41f9cf[_0xc214('0x38')],_0x2e9765[_0xc214('0x39')]));if(_0x41f9cf['query'][_0xc214('0x41')]){_0x4fb0cc[_0xc214('0x42')]=_['merge'](_0x4fb0cc['where'],{'$or':_[_0xc214('0x32')](_0x4fb0cc[_0xc214('0x3a')],function(_0x5cc37b){var _0x4eac95={};_0x4eac95[_0x5cc37b]={'$like':'%'+_0x41f9cf[_0xc214('0x38')][_0xc214('0x41')]+'%'};return _0x4eac95;})});}_0x4fb0cc=_['merge']({},_0x4fb0cc,_0x41f9cf[_0xc214('0x4c')]);return _0x1aa8cc['getConfigurations'](_0x4fb0cc);}})[_0xc214('0x1b')](function(_0x1451b9){if(_0x1451b9){_0x46dc48=_0x1451b9['length'];if(!_0x41f9cf[_0xc214('0x38')]['hasOwnProperty'](_0xc214('0x55'))){_0x4fb0cc['limit']=qs[_0xc214('0x29')](_0x41f9cf[_0xc214('0x38')]['limit']);_0x4fb0cc['offset']=qs['offset'](_0x41f9cf[_0xc214('0x38')][_0xc214('0x28')]);}return _0x1aa8cc['getConfigurations'](_0x4fb0cc);}})[_0xc214('0x1b')](function(_0x174fc9){if(_0x174fc9){return _0x174fc9?{'count':_0x46dc48,'rows':_0x174fc9}:null;}})[_0xc214('0x1b')](respondWithResult(_0x36dc20,null))['catch'](handleError(_0x36dc20,null));};exports[_0xc214('0x56')]=function(_0x3fa82a,_0x4e8753,_0x594b4e){if(_0x3fa82a['body']['id']){delete _0x3fa82a['body']['id'];}return db[_0xc214('0x44')][_0xc214('0x52')]({'where':{'id':_0x3fa82a['params']['id']}})[_0xc214('0x1b')](handleEntityNotFound(_0x4e8753,null))[_0xc214('0x1b')](function(_0x3e3f35){if(_0x3e3f35){_0x3fa82a[_0xc214('0x4f')][_0xc214('0x57')]=_0x3e3f35['id'];_0x3fa82a[_0xc214('0x4f')][_0xc214('0x58')]=integrations['getSubjects'](_0x3fa82a[_0xc214('0x4f')]['channel'],_0x3fa82a[_0xc214('0x4f')]['type']);_0x3fa82a['body'][_0xc214('0x59')]=integrations[_0xc214('0x5a')](_0x3fa82a[_0xc214('0x4f')]['channel'],_0x3fa82a[_0xc214('0x4f')][_0xc214('0x35')]);return db[_0xc214('0x53')]['create'](_0x3fa82a[_0xc214('0x4f')],{'include':[{'model':db[_0xc214('0x5b')],'as':_0xc214('0x58')},{'model':db[_0xc214('0x5b')],'as':_0xc214('0x59')}]});}return null;})[_0xc214('0x1b')](respondWithResult(_0x4e8753,null))[_0xc214('0x47')](handleError(_0x4e8753,null));};exports[_0xc214('0x5c')]=function(_0x4c1cd1,_0x1116db,_0x403359){var _0x1f51e6='';var _0xbe9dcf=['id',_0xc214('0x30'),_0xc214('0x5d'),_0xc214('0x5e'),'description',_0xc214('0x5f'),'duration_hours',_0xc214('0x60'),'parent_id',_0xc214('0x61'),_0xc214('0x62'),_0xc214('0x63')];return db['SugarcrmAccount'][_0xc214('0x52')]({'where':{'id':_0x4c1cd1['params']['id']},'attributes':['id',_0xc214('0x64'),_0xc214('0x65'),'remoteUri']})[_0xc214('0x1b')](handleEntityNotFound(_0x1116db,null))[_0xc214('0x1b')](function(_0x344cf8){if(_0x344cf8){_0x1f51e6=_0x344cf8['remoteUri'];var _0x4ce73a=_0x1f51e6['slice'](-0x1);if(_0x4ce73a==='/'){_0x1f51e6=_0x1f51e6[_0xc214('0x66')](0x0,_0x1f51e6[_0xc214('0x67')](_0x4ce73a));}return rp({'method':_0xc214('0x68'),'uri':util[_0xc214('0x69')]('%s%s',_0x1f51e6,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xc214('0x6a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xc214('0x6b')]({'user_auth':{'user_name':_0x344cf8[_0xc214('0x64')],'password':_0x344cf8['password'],'encryption':_0xc214('0x6c')},'application':_0xc214('0x6d')})}});}})['then'](function(_0x1efd95){if(_0x1efd95&&_0x1efd95['name']!=='Invalid\x20Login'&&_0x1efd95[_0xc214('0x30')]!==_0xc214('0x6e')){return rp({'method':'POST','uri':util['format']('%s%s',_0x1f51e6,_0xc214('0x6f')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xc214('0x70'),'response_type':_0xc214('0x70'),'rest_data':JSON['stringify']({'session':_0x1efd95['id'],'module_name':'Calls'})}})['then'](function(_0x541120){if(_0x541120){var _0x215b3e=_[_0xc214('0x71')](_0x541120[_0xc214('0x72')]);_['remove'](_0x215b3e,function(_0x5a2541){return _0xbe9dcf[_0xc214('0x73')](_0x5a2541[_0xc214('0x30')]);});return{'count':_0x215b3e[_0xc214('0x3d')],'rows':_[_0xc214('0x32')](_0x215b3e,function(_0x2c8dd3){return{'id':_0x2c8dd3[_0xc214('0x30')],'name':_0x2c8dd3[_0xc214('0x74')],'custom':_['endsWith'](_0x2c8dd3[_0xc214('0x30')],'_c')?!![]:![],'options':_0x2c8dd3['options']?_['map'](_['values'](_0x2c8dd3[_0xc214('0x4c')]),function(_0x119e77){return{'name':_0x119e77['value'],'value':_0x119e77['name']};}):[]};})};}})['then'](respondWithResult(_0x1116db,null))['catch'](function(_0x79b18f){var _0x398a11=_0x4c1cd1['query'][_0xc214('0x75')]?0x1f4:_0x79b18f[_0xc214('0x76')]||0x1f4;logger[_0xc214('0x21')](_0xc214('0x77'),'getFields',_0x398a11,JSON[_0xc214('0x6b')](_0x79b18f));delete _0x79b18f[_0xc214('0x30')];if(_0x398a11===0x191){_0x398a11=0x190;}_0x1116db[_0xc214('0x24')](_0x398a11)['send'](_0x4c1cd1[_0xc214('0x38')]['test']?{'message':_0xc214('0x78'),'statusCode':_0x79b18f[_0xc214('0x76')]}:_0x79b18f);});}else{var _0x70254b=0x1f4;_0x1116db['status'](_0x70254b)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 1d786ca..4388adb 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 _0x6fba=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','lodash','util','api','bluebird','request-promise'];(function(_0x36456f,_0xcfa3a7){var _0x20193b=function(_0x4f909d){while(--_0x4f909d){_0x36456f['push'](_0x36456f['shift']());}};_0x20193b(++_0xcfa3a7);}(_0x6fba,0x17c));var _0xa6fb=function(_0x57dbd4,_0x100b72){_0x57dbd4=_0x57dbd4-0x0;var _0x584bbe=_0x6fba[_0x57dbd4];return _0x584bbe;};'use strict';var _=require(_0xa6fb('0x0'));var util=require(_0xa6fb('0x1'));var logger=require('../../config/logger')(_0xa6fb('0x2'));var moment=require('moment');var BPromise=require(_0xa6fb('0x3'));var rp=require(_0xa6fb('0x4'));var fs=require('fs');var path=require(_0xa6fb('0x5'));var rimraf=require(_0xa6fb('0x6'));var config=require(_0xa6fb('0x7'));var attributes=require(_0xa6fb('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xa6fb('0x9')]=function(_0x5de949,_0x48f886){return _0x5de949['define'](_0xa6fb('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50d7=['SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x4eb082,_0x5ee5de){var _0x2f17e0=function(_0x189b86){while(--_0x189b86){_0x4eb082['push'](_0x4eb082['shift']());}};_0x2f17e0(++_0x5ee5de);}(_0x50d7,0x116));var _0x750d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x50d7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x750d('0x0'));var util=require(_0x750d('0x1'));var logger=require(_0x750d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x750d('0x3'));var rp=require(_0x750d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x750d('0x5'));var attributes=require(_0x750d('0x6'));var integrations=require(_0x750d('0x7'));module[_0x750d('0x8')]=function(_0x2f0794,_0x308b94){return _0x2f0794[_0x750d('0x9')](_0x750d('0xa'),attributes,{'tableName':_0x750d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index ef82af5..f1d94e3 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 _0x4153=['stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','map','include','model','debug','ShowSugarcrmAccount','find','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x4153,0xa4));var _0x3415=function(_0x5b9359,_0x500c59){_0x5b9359=_0x5b9359-0x0;var _0x10df79=_0x4153[_0x5b9359];return _0x10df79;};'use strict';var _=require(_0x3415('0x0'));var util=require(_0x3415('0x1'));var moment=require('moment');var BPromise=require(_0x3415('0x2'));var rs=require(_0x3415('0x3'));var fs=require('fs');var Redis=require(_0x3415('0x4'));var db=require(_0x3415('0x5'))['db'];var utils=require(_0x3415('0x6'));var logger=require(_0x3415('0x7'))(_0x3415('0x8'));var config=require('../../config/environment');var jayson=require(_0x3415('0x9'));var client=jayson[_0x3415('0xa')][_0x3415('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x255251,_0x4860df,_0x31e0cf){return new BPromise(function(_0x467fdb,_0x28a413){return client['request'](_0x255251,_0x31e0cf)[_0x3415('0xc')](function(_0x4197e0){logger[_0x3415('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x4860df,_0x3415('0xe'));logger['debug'](_0x3415('0xf'),_0x4860df,_0x3415('0xe'),JSON[_0x3415('0x10')](_0x4197e0));if(_0x4197e0[_0x3415('0x11')]){if(_0x4197e0[_0x3415('0x11')][_0x3415('0x12')]===0x1f4){logger[_0x3415('0x11')](_0x3415('0x13'),_0x4860df,_0x4197e0[_0x3415('0x11')]['message']);return _0x28a413(_0x4197e0['error']['message']);}logger[_0x3415('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x4860df,_0x4197e0[_0x3415('0x11')][_0x3415('0x14')]);return _0x467fdb(_0x4197e0[_0x3415('0x11')][_0x3415('0x14')]);}else{logger[_0x3415('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x4860df,_0x3415('0xe'));_0x467fdb(_0x4197e0[_0x3415('0x15')][_0x3415('0x14')]);}})[_0x3415('0x16')](function(_0x3e42e4){logger[_0x3415('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x4860df,_0x3e42e4);_0x28a413(_0x3e42e4);});});}exports[_0x3415('0x17')]=function(_0x5553dd){var _0x257f70=this;return new Promise(function(_0x14e94f,_0x1e18ee){return db[_0x3415('0x18')][_0x3415('0x19')]({'raw':_0x5553dd[_0x3415('0x1a')]?_0x5553dd[_0x3415('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5553dd['options']?_0x5553dd[_0x3415('0x1a')][_0x3415('0x1b')]||null:null,'attributes':_0x5553dd[_0x3415('0x1a')]?_0x5553dd[_0x3415('0x1a')][_0x3415('0x1c')]||null:null,'limit':_0x5553dd[_0x3415('0x1a')]?_0x5553dd[_0x3415('0x1a')]['limit']||null:null,'include':_0x5553dd[_0x3415('0x1a')]?_0x5553dd[_0x3415('0x1a')]['include']?_[_0x3415('0x1d')](_0x5553dd[_0x3415('0x1a')][_0x3415('0x1e')],function(_0x420c01){return{'model':db[_0x420c01['model']],'as':_0x420c01['as'],'attributes':_0x420c01[_0x3415('0x1c')],'include':_0x420c01[_0x3415('0x1e')]?_['map'](_0x420c01[_0x3415('0x1e')],function(_0xc8677e){return{'model':db[_0xc8677e['model']],'as':_0xc8677e['as'],'attributes':_0xc8677e[_0x3415('0x1c')],'include':_0xc8677e[_0x3415('0x1e')]?_[_0x3415('0x1d')](_0xc8677e[_0x3415('0x1e')],function(_0x12f25c){return{'model':db[_0x12f25c[_0x3415('0x1f')]],'as':_0x12f25c['as'],'attributes':_0x12f25c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3415('0xc')](function(_0x2a25f1){logger[_0x3415('0xd')](_0x3415('0x17'),_0x5553dd);logger[_0x3415('0x20')](_0x3415('0x17'),_0x5553dd,JSON['stringify'](_0x2a25f1));_0x14e94f(_0x2a25f1);})[_0x3415('0x16')](function(_0x3f6201){logger[_0x3415('0x11')](_0x3415('0x17'),_0x3f6201[_0x3415('0x14')],_0x5553dd);_0x1e18ee(_0x257f70['error'](0x1f4,_0x3f6201[_0x3415('0x14')]));});});};exports[_0x3415('0x21')]=function(_0x72de95){var _0x15e2d6=this;return new Promise(function(_0x3177d7,_0x5b6e01){return db[_0x3415('0x18')][_0x3415('0x22')]({'raw':_0x72de95[_0x3415('0x1a')]?_0x72de95['options'][_0x3415('0x23')]===undefined?!![]:![]:!![],'where':_0x72de95[_0x3415('0x1a')]?_0x72de95[_0x3415('0x1a')][_0x3415('0x1b')]||null:null,'attributes':_0x72de95[_0x3415('0x1a')]?_0x72de95[_0x3415('0x1a')][_0x3415('0x1c')]||null:null,'include':_0x72de95['options']?_0x72de95['options'][_0x3415('0x1e')]?_['map'](_0x72de95[_0x3415('0x1a')]['include'],function(_0x2846a3){return{'model':db[_0x2846a3[_0x3415('0x1f')]],'as':_0x2846a3['as'],'attributes':_0x2846a3[_0x3415('0x1c')],'include':_0x2846a3[_0x3415('0x1e')]?_[_0x3415('0x1d')](_0x2846a3['include'],function(_0x278919){return{'model':db[_0x278919[_0x3415('0x1f')]],'as':_0x278919['as'],'attributes':_0x278919['attributes'],'include':_0x278919['include']?_['map'](_0x278919[_0x3415('0x1e')],function(_0x2817d0){return{'model':db[_0x2817d0[_0x3415('0x1f')]],'as':_0x2817d0['as'],'attributes':_0x2817d0['attributes']};}):[]};}):[]};}):[]:[]})[_0x3415('0xc')](function(_0x41de08){logger[_0x3415('0xd')](_0x3415('0x21'),_0x72de95);logger[_0x3415('0x20')](_0x3415('0x21'),_0x72de95,JSON[_0x3415('0x10')](_0x41de08));_0x3177d7(_0x41de08);})['catch'](function(_0x1ec307){logger['error'](_0x3415('0x21'),_0x1ec307[_0x3415('0x14')],_0x72de95);_0x5b6e01(_0x15e2d6[_0x3415('0x11')](0x1f4,_0x1ec307[_0x3415('0x14')]));});});}; \ No newline at end of file +var _0xb955=['findAll','raw','options','where','attributes','include','map','model','ShowSugarcrmAccount','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x6afd9e,_0x1a5b63){var _0x53eadc=function(_0x155d23){while(--_0x155d23){_0x6afd9e['push'](_0x6afd9e['shift']());}};_0x53eadc(++_0x1a5b63);}(_0xb955,0x132));var _0x5b95=function(_0x518901,_0x49016f){_0x518901=_0x518901-0x0;var _0xc33a2c=_0xb955[_0x518901];return _0xc33a2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5b95('0x0'));var BPromise=require(_0x5b95('0x1'));var rs=require(_0x5b95('0x2'));var fs=require('fs');var Redis=require(_0x5b95('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b95('0x4'));var logger=require(_0x5b95('0x5'))(_0x5b95('0x6'));var config=require(_0x5b95('0x7'));var jayson=require(_0x5b95('0x8'));var client=jayson[_0x5b95('0x9')][_0x5b95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ef940,_0x53d51b,_0x32bf3c){return new BPromise(function(_0x396fc9,_0x4a3ecd){return client['request'](_0x2ef940,_0x32bf3c)['then'](function(_0x4a30ac){logger[_0x5b95('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0x53d51b,_0x5b95('0xc'));logger[_0x5b95('0xd')](_0x5b95('0xe'),_0x53d51b,'request\x20sent',JSON[_0x5b95('0xf')](_0x4a30ac));if(_0x4a30ac['error']){if(_0x4a30ac[_0x5b95('0x10')][_0x5b95('0x11')]===0x1f4){logger[_0x5b95('0x10')](_0x5b95('0x12'),_0x53d51b,_0x4a30ac[_0x5b95('0x10')][_0x5b95('0x13')]);return _0x4a3ecd(_0x4a30ac[_0x5b95('0x10')][_0x5b95('0x13')]);}logger['error'](_0x5b95('0x12'),_0x53d51b,_0x4a30ac[_0x5b95('0x10')][_0x5b95('0x13')]);return _0x396fc9(_0x4a30ac['error']['message']);}else{logger[_0x5b95('0xb')](_0x5b95('0x12'),_0x53d51b,_0x5b95('0xc'));_0x396fc9(_0x4a30ac[_0x5b95('0x14')][_0x5b95('0x13')]);}})[_0x5b95('0x15')](function(_0xb1ffb4){logger[_0x5b95('0x10')](_0x5b95('0x12'),_0x53d51b,_0xb1ffb4);_0x4a3ecd(_0xb1ffb4);});});}exports[_0x5b95('0x16')]=function(_0x1fab32){var _0x134018=this;return new Promise(function(_0x10de40,_0x1ffe9d){return db[_0x5b95('0x17')][_0x5b95('0x18')]({'raw':_0x1fab32['options']?_0x1fab32['options'][_0x5b95('0x19')]===undefined?!![]:![]:!![],'where':_0x1fab32[_0x5b95('0x1a')]?_0x1fab32[_0x5b95('0x1a')][_0x5b95('0x1b')]||null:null,'attributes':_0x1fab32[_0x5b95('0x1a')]?_0x1fab32[_0x5b95('0x1a')][_0x5b95('0x1c')]||null:null,'limit':_0x1fab32[_0x5b95('0x1a')]?_0x1fab32[_0x5b95('0x1a')]['limit']||null:null,'include':_0x1fab32[_0x5b95('0x1a')]?_0x1fab32[_0x5b95('0x1a')][_0x5b95('0x1d')]?_[_0x5b95('0x1e')](_0x1fab32[_0x5b95('0x1a')][_0x5b95('0x1d')],function(_0x27b1e2){return{'model':db[_0x27b1e2[_0x5b95('0x1f')]],'as':_0x27b1e2['as'],'attributes':_0x27b1e2[_0x5b95('0x1c')],'include':_0x27b1e2[_0x5b95('0x1d')]?_[_0x5b95('0x1e')](_0x27b1e2[_0x5b95('0x1d')],function(_0x112876){return{'model':db[_0x112876['model']],'as':_0x112876['as'],'attributes':_0x112876[_0x5b95('0x1c')],'include':_0x112876['include']?_[_0x5b95('0x1e')](_0x112876[_0x5b95('0x1d')],function(_0x381a90){return{'model':db[_0x381a90['model']],'as':_0x381a90['as'],'attributes':_0x381a90['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x63b5e7){logger['info']('GetSugarcrmAccount',_0x1fab32);logger[_0x5b95('0xd')](_0x5b95('0x16'),_0x1fab32,JSON[_0x5b95('0xf')](_0x63b5e7));_0x10de40(_0x63b5e7);})[_0x5b95('0x15')](function(_0x25a035){logger[_0x5b95('0x10')](_0x5b95('0x16'),_0x25a035[_0x5b95('0x13')],_0x1fab32);_0x1ffe9d(_0x134018[_0x5b95('0x10')](0x1f4,_0x25a035['message']));});});};exports[_0x5b95('0x20')]=function(_0x2ab6c2){var _0x3d4220=this;return new Promise(function(_0x1b484a,_0x36bf15){return db[_0x5b95('0x17')]['find']({'raw':_0x2ab6c2[_0x5b95('0x1a')]?_0x2ab6c2['options'][_0x5b95('0x19')]===undefined?!![]:![]:!![],'where':_0x2ab6c2[_0x5b95('0x1a')]?_0x2ab6c2[_0x5b95('0x1a')][_0x5b95('0x1b')]||null:null,'attributes':_0x2ab6c2[_0x5b95('0x1a')]?_0x2ab6c2['options'][_0x5b95('0x1c')]||null:null,'include':_0x2ab6c2[_0x5b95('0x1a')]?_0x2ab6c2[_0x5b95('0x1a')][_0x5b95('0x1d')]?_[_0x5b95('0x1e')](_0x2ab6c2[_0x5b95('0x1a')][_0x5b95('0x1d')],function(_0x374473){return{'model':db[_0x374473[_0x5b95('0x1f')]],'as':_0x374473['as'],'attributes':_0x374473[_0x5b95('0x1c')],'include':_0x374473[_0x5b95('0x1d')]?_['map'](_0x374473['include'],function(_0x4a2015){return{'model':db[_0x4a2015['model']],'as':_0x4a2015['as'],'attributes':_0x4a2015[_0x5b95('0x1c')],'include':_0x4a2015['include']?_['map'](_0x4a2015[_0x5b95('0x1d')],function(_0x371cbf){return{'model':db[_0x371cbf[_0x5b95('0x1f')]],'as':_0x371cbf['as'],'attributes':_0x371cbf[_0x5b95('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c899b){logger[_0x5b95('0xb')](_0x5b95('0x20'),_0x2ab6c2);logger[_0x5b95('0xd')](_0x5b95('0x20'),_0x2ab6c2,JSON[_0x5b95('0xf')](_0x4c899b));_0x1b484a(_0x4c899b);})['catch'](function(_0x401905){logger[_0x5b95('0x10')]('ShowSugarcrmAccount',_0x401905[_0x5b95('0x13')],_0x2ab6c2);_0x36bf15(_0x3d4220[_0x5b95('0x10')](0x1f4,_0x401905['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 5b181cb..5e976f0 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 _0xd2df=['delete','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0xd2df,0xf9));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfd2d('0x0'));var timeout=require(_0xfd2d('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xfd2d('0x2'));var interaction=require(_0xfd2d('0x3'));var config=require('../../config/environment');var controller=require(_0xfd2d('0x4'));router[_0xfd2d('0x5')]('/',auth[_0xfd2d('0x6')](),controller[_0xfd2d('0x7')]);router[_0xfd2d('0x5')](_0xfd2d('0x8'),auth[_0xfd2d('0x6')](),controller['show']);router['get'](_0xfd2d('0x9'),auth[_0xfd2d('0x6')](),controller[_0xfd2d('0xa')]);router[_0xfd2d('0x5')]('/:id/subjects',auth[_0xfd2d('0x6')](),controller[_0xfd2d('0xb')]);router[_0xfd2d('0x5')](_0xfd2d('0xc'),auth[_0xfd2d('0x6')](),controller[_0xfd2d('0xd')]);router[_0xfd2d('0xe')]('/',auth[_0xfd2d('0x6')](),controller[_0xfd2d('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfd2d('0x10')]);router[_0xfd2d('0x11')](_0xfd2d('0x8'),auth[_0xfd2d('0x6')](),controller['destroy']);module[_0xfd2d('0x12')]=router; \ No newline at end of file +var _0x3150=['get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller'];(function(_0x53a4a5,_0x5c91d8){var _0x4dae0c=function(_0x576732){while(--_0x576732){_0x53a4a5['push'](_0x53a4a5['shift']());}};_0x4dae0c(++_0x5c91d8);}(_0x3150,0x1a7));var _0x0315=function(_0x33e114,_0x77cc5a){_0x33e114=_0x33e114-0x0;var _0x17e9b6=_0x3150[_0x33e114];return _0x17e9b6;};'use strict';var multer=require('multer');var util=require(_0x0315('0x0'));var path=require(_0x0315('0x1'));var timeout=require(_0x0315('0x2'));var express=require(_0x0315('0x3'));var router=express[_0x0315('0x4')]();var auth=require(_0x0315('0x5'));var interaction=require(_0x0315('0x6'));var config=require(_0x0315('0x7'));var controller=require(_0x0315('0x8'));router[_0x0315('0x9')]('/',auth[_0x0315('0xa')](),controller[_0x0315('0xb')]);router[_0x0315('0x9')](_0x0315('0xc'),auth[_0x0315('0xa')](),controller[_0x0315('0xd')]);router[_0x0315('0x9')]('/:id/fields',auth[_0x0315('0xa')](),controller[_0x0315('0xe')]);router[_0x0315('0x9')](_0x0315('0xf'),auth['isAuthenticated'](),controller[_0x0315('0x10')]);router['get'](_0x0315('0x11'),auth[_0x0315('0xa')](),controller[_0x0315('0x12')]);router[_0x0315('0x13')]('/',auth[_0x0315('0xa')](),controller['create']);router['put'](_0x0315('0xc'),auth[_0x0315('0xa')](),controller[_0x0315('0x14')]);router[_0x0315('0x15')](_0x0315('0xc'),auth['isAuthenticated'](),controller[_0x0315('0x16')]);module[_0x0315('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 62624aa..3397486 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 _0x583d=['sequelize','exports','STRING'];(function(_0x5ae350,_0x24edc7){var _0x4e3073=function(_0x22cfed){while(--_0x22cfed){_0x5ae350['push'](_0x5ae350['shift']());}};_0x4e3073(++_0x24edc7);}(_0x583d,0x69));var _0xd583=function(_0xe4c934,_0x57a4cb){_0xe4c934=_0xe4c934-0x0;var _0x134514=_0x583d[_0xe4c934];return _0x134514;};'use strict';var Sequelize=require(_0xd583('0x0'));module[_0xd583('0x1')]={'name':{'type':Sequelize[_0xd583('0x2')]},'description':{'type':Sequelize[_0xd583('0x2')]}}; \ No newline at end of file +var _0xeb00=['STRING'];(function(_0xe568c5,_0x46d101){var _0x4eb1ae=function(_0x2eb74b){while(--_0x2eb74b){_0xe568c5['push'](_0xe568c5['shift']());}};_0x4eb1ae(++_0x46d101);}(_0xeb00,0x148));var _0x0eb0=function(_0x13dc56,_0x5496e5){_0x13dc56=_0x13dc56-0x0;var _0x2ac0f0=_0xeb00[_0x13dc56];return _0x2ac0f0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0eb0('0x0')]},'description':{'type':Sequelize[_0x0eb0('0x0')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 8d1ecec..4b36362 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 _0x30d6=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','name','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','SugarcrmConfiguration','includeAll','findAll','show','keys','include','find','create','body','params','destroy','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','eml-format','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto'];(function(_0xc838b8,_0x2f4309){var _0x18c0be=function(_0x2d81cd){while(--_0x2d81cd){_0xc838b8['push'](_0xc838b8['shift']());}};_0x18c0be(++_0x2f4309);}(_0x30d6,0xa8));var _0x630d=function(_0x3422bf,_0x21b1da){_0x3422bf=_0x3422bf-0x0;var _0x4de668=_0x30d6[_0x3422bf];return _0x4de668;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x630d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x630d('0x1'));var moment=require(_0x630d('0x2'));var BPromise=require(_0x630d('0x3'));var Mustache=require(_0x630d('0x4'));var util=require('util');var path=require(_0x630d('0x5'));var sox=require(_0x630d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x630d('0x7'));var squel=require(_0x630d('0x8'));var crypto=require(_0x630d('0x9'));var jsforce=require(_0x630d('0xa'));var deskjs=require(_0x630d('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x630d('0xc'));var Redis=require(_0x630d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x630d('0xe'));var as=require(_0x630d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x630d('0x10'))(_0x630d('0x11'));var utils=require(_0x630d('0x12'));var config=require(_0x630d('0x13'));var licenseUtil=require(_0x630d('0x14'));var db=require(_0x630d('0x15'))['db'];var jayson=require(_0x630d('0x16'));var client=jayson[_0x630d('0x17')][_0x630d('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1fe577,_0x57237e,_0x53151d,_0x290269){return new BPromise(function(_0x4f3605,_0x4098c8){var _0x5953fc=_0x290269||client;return _0x5953fc[_0x630d('0x19')](_0x1fe577,_0x53151d)[_0x630d('0x1a')](function(_0x43ab72){logger['info'](_0x630d('0x1b'),_0x57237e,_0x630d('0x1c'));logger[_0x630d('0x1d')](_0x630d('0x1e'),_0x57237e,_0x630d('0x1c'),JSON[_0x630d('0x1f')](_0x43ab72));if(_0x43ab72[_0x630d('0x20')]){if(_0x43ab72['error'][_0x630d('0x21')]===0x1f4){logger[_0x630d('0x20')](_0x630d('0x1b'),_0x57237e,_0x43ab72[_0x630d('0x20')][_0x630d('0x22')]);return _0x4098c8(_0x43ab72['error'][_0x630d('0x22')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x57237e,_0x43ab72['error'][_0x630d('0x22')]);return _0x4f3605(_0x43ab72[_0x630d('0x20')]['message']);}else{logger['info'](_0x630d('0x1b'),_0x57237e,_0x630d('0x1c'));_0x4f3605(_0x43ab72[_0x630d('0x23')][_0x630d('0x22')]);}})[_0x630d('0x24')](function(_0x522a6e){logger[_0x630d('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x57237e,_0x522a6e);_0x4098c8(_0x522a6e);});});}function respondWithStatusCode(_0x1fa718,_0x1688de){_0x1688de=_0x1688de||0xcc;return function(_0x252b45){if(_0x252b45){return _0x1fa718[_0x630d('0x25')](_0x1688de);}return _0x1fa718[_0x630d('0x26')](_0x1688de)[_0x630d('0x27')]();};}function respondWithResult(_0x1fb745,_0x48db16){_0x48db16=_0x48db16||0xc8;return function(_0x5830ed){if(_0x5830ed){return _0x1fb745[_0x630d('0x26')](_0x48db16)['json'](_0x5830ed);}};}function respondWithFilteredResult(_0x13337,_0x2758c9){return function(_0x58ab9b){if(_0x58ab9b){var _0x2425cd=_0x58ab9b[_0x630d('0x28')],_0x5f023c=_0x2758c9[_0x630d('0x29')],_0x5bd996=_0x2758c9[_0x630d('0x29')]+_0x2758c9[_0x630d('0x2a')],_0xfbd99c;if(_0x5bd996>=_0x2425cd){_0x5bd996=_0x2425cd;_0xfbd99c=0xc8;}else{_0xfbd99c=0xce;}_0x13337['status'](_0xfbd99c);return _0x13337[_0x630d('0x2b')]('Content-Range',_0x5f023c+'-'+_0x5bd996+'/'+_0x2425cd)[_0x630d('0x2c')](_0x58ab9b);}return null;};}function patchUpdates(_0x1399c6){return function(_0x3edce){try{jsonpatch[_0x630d('0x2d')](_0x3edce,_0x1399c6,!![]);}catch(_0x283c08){return BPromise[_0x630d('0x2e')](_0x283c08);}return _0x3edce[_0x630d('0x2f')]();};}function saveUpdates(_0x34ac61,_0x5433ed){return function(_0x276351){if(_0x276351){return _0x276351[_0x630d('0x30')](_0x34ac61)['then'](function(_0x239948){return _0x239948;});}return null;};}function removeEntity(_0xf6c1d8,_0x5f420b){return function(_0x4d5f98){if(_0x4d5f98){return _0x4d5f98['destroy']()[_0x630d('0x1a')](function(){_0xf6c1d8[_0x630d('0x26')](0xcc)[_0x630d('0x27')]();});}};}function handleEntityNotFound(_0x3729e4,_0x4dfee4){return function(_0x13d118){if(!_0x13d118){_0x3729e4[_0x630d('0x25')](0x194);}return _0x13d118;};}function handleError(_0x49be9d,_0x368ba1){_0x368ba1=_0x368ba1||0x1f4;return function(_0x29ad3a){logger[_0x630d('0x20')](_0x29ad3a['stack']);if(_0x29ad3a['name']){delete _0x29ad3a[_0x630d('0x31')];}_0x49be9d[_0x630d('0x26')](_0x368ba1)['send'](_0x29ad3a);};}exports[_0x630d('0x32')]=function(_0x5a0111,_0x4de4a0){var _0x149588={},_0x297a92={},_0x1e628d={'count':0x0,'rows':[]};var _0x20d7a6=_[_0x630d('0x33')](db['SugarcrmConfiguration'][_0x630d('0x34')],function(_0x40a217){return{'name':_0x40a217[_0x630d('0x35')],'type':_0x40a217['type'][_0x630d('0x36')]};});_0x297a92['model']=_['map'](_0x20d7a6,_0x630d('0x31'));_0x297a92[_0x630d('0x37')]=_['keys'](_0x5a0111['query']);_0x297a92[_0x630d('0x38')]=_[_0x630d('0x39')](_0x297a92[_0x630d('0x3a')],_0x297a92[_0x630d('0x37')]);_0x149588[_0x630d('0x3b')]=_[_0x630d('0x39')](_0x297a92[_0x630d('0x3a')],qs[_0x630d('0x3c')](_0x5a0111[_0x630d('0x37')]['fields']));_0x149588[_0x630d('0x3b')]=_0x149588[_0x630d('0x3b')][_0x630d('0x3d')]?_0x149588[_0x630d('0x3b')]:_0x297a92[_0x630d('0x3a')];if(!_0x5a0111[_0x630d('0x37')][_0x630d('0x3e')](_0x630d('0x3f'))){_0x149588[_0x630d('0x2a')]=qs[_0x630d('0x2a')](_0x5a0111['query'][_0x630d('0x2a')]);_0x149588[_0x630d('0x29')]=qs[_0x630d('0x29')](_0x5a0111['query'][_0x630d('0x29')]);}_0x149588[_0x630d('0x40')]=qs[_0x630d('0x41')](_0x5a0111[_0x630d('0x37')][_0x630d('0x41')]);_0x149588[_0x630d('0x42')]=qs['filters'](_['pick'](_0x5a0111[_0x630d('0x37')],_0x297a92[_0x630d('0x38')]),_0x20d7a6);if(_0x5a0111[_0x630d('0x37')][_0x630d('0x43')]){_0x149588[_0x630d('0x42')]=_[_0x630d('0x44')](_0x149588['where'],{'$or':_[_0x630d('0x33')](_0x20d7a6,function(_0x1c7fa0){if(_0x1c7fa0[_0x630d('0x45')]!==_0x630d('0x46')){var _0x22ce42={};_0x22ce42[_0x1c7fa0[_0x630d('0x31')]]={'$like':'%'+_0x5a0111[_0x630d('0x37')]['filter']+'%'};return _0x22ce42;}})});}_0x149588=_['merge']({},_0x149588,_0x5a0111[_0x630d('0x47')]);var _0x308b3c={'where':_0x149588['where']};return db[_0x630d('0x48')][_0x630d('0x28')](_0x308b3c)[_0x630d('0x1a')](function(_0x2e7e37){_0x1e628d[_0x630d('0x28')]=_0x2e7e37;if(_0x5a0111[_0x630d('0x37')][_0x630d('0x49')]){_0x149588['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x630d('0x4a')](_0x149588);})[_0x630d('0x1a')](function(_0x383769){_0x1e628d['rows']=_0x383769;return _0x1e628d;})[_0x630d('0x1a')](respondWithFilteredResult(_0x4de4a0,_0x149588))[_0x630d('0x24')](handleError(_0x4de4a0,null));};exports[_0x630d('0x4b')]=function(_0x48fea7,_0xe1485){var _0x9c1468={'raw':![],'where':{'id':_0x48fea7['params']['id']}},_0x51f94c={};_0x51f94c['model']=_[_0x630d('0x4c')](db[_0x630d('0x48')][_0x630d('0x34')]);_0x51f94c[_0x630d('0x37')]=_[_0x630d('0x4c')](_0x48fea7[_0x630d('0x37')]);_0x51f94c[_0x630d('0x38')]=_[_0x630d('0x39')](_0x51f94c[_0x630d('0x3a')],_0x51f94c[_0x630d('0x37')]);_0x9c1468['attributes']=_[_0x630d('0x39')](_0x51f94c[_0x630d('0x3a')],qs['fields'](_0x48fea7[_0x630d('0x37')]['fields']));_0x9c1468[_0x630d('0x3b')]=_0x9c1468['attributes'][_0x630d('0x3d')]?_0x9c1468['attributes']:_0x51f94c['model'];if(_0x48fea7[_0x630d('0x37')]['includeAll']){_0x9c1468[_0x630d('0x4d')]=[{'all':!![]}];}_0x9c1468=_[_0x630d('0x44')]({},_0x9c1468,_0x48fea7[_0x630d('0x47')]);return db[_0x630d('0x48')][_0x630d('0x4e')](_0x9c1468)['then'](handleEntityNotFound(_0xe1485,null))[_0x630d('0x1a')](respondWithResult(_0xe1485,null))[_0x630d('0x24')](handleError(_0xe1485,null));};exports[_0x630d('0x4f')]=function(_0x1b242d,_0x13265e){return db[_0x630d('0x48')]['create'](_0x1b242d[_0x630d('0x50')],{})['then'](respondWithResult(_0x13265e,0xc9))[_0x630d('0x24')](handleError(_0x13265e,null));};exports[_0x630d('0x30')]=function(_0x420590,_0x4581c5){if(_0x420590[_0x630d('0x50')]['id']){delete _0x420590['body']['id'];}return db[_0x630d('0x48')][_0x630d('0x4e')]({'where':{'id':_0x420590[_0x630d('0x51')]['id']}})['then'](handleEntityNotFound(_0x4581c5,null))[_0x630d('0x1a')](saveUpdates(_0x420590[_0x630d('0x50')],null))['then'](respondWithResult(_0x4581c5,null))[_0x630d('0x24')](handleError(_0x4581c5,null));};exports[_0x630d('0x52')]=function(_0x2802e6,_0x43952c){return db[_0x630d('0x48')][_0x630d('0x4e')]({'where':{'id':_0x2802e6[_0x630d('0x51')]['id']}})[_0x630d('0x1a')](handleEntityNotFound(_0x43952c,null))[_0x630d('0x1a')](removeEntity(_0x43952c,null))[_0x630d('0x24')](handleError(_0x43952c,null));};exports[_0x630d('0x53')]=function(_0x8ccc9a,_0x4a648b,_0x42f6b7){var _0x160e6f={};var _0x43aada={};var _0x3e311e;var _0x26e0f7;return db[_0x630d('0x48')][_0x630d('0x54')]({'where':{'id':_0x8ccc9a[_0x630d('0x51')]['id']}})[_0x630d('0x1a')](handleEntityNotFound(_0x4a648b,null))[_0x630d('0x1a')](function(_0xee2a75){if(_0xee2a75){_0x3e311e=_0xee2a75;_0x43aada[_0x630d('0x3a')]=_[_0x630d('0x4c')](db[_0x630d('0x55')][_0x630d('0x34')]);_0x43aada[_0x630d('0x37')]=_['keys'](_0x8ccc9a['query']);_0x43aada[_0x630d('0x38')]=_[_0x630d('0x39')](_0x43aada['model'],_0x43aada[_0x630d('0x37')]);_0x160e6f[_0x630d('0x3b')]=_[_0x630d('0x39')](_0x43aada[_0x630d('0x3a')],qs[_0x630d('0x3c')](_0x8ccc9a['query'][_0x630d('0x3c')]));_0x160e6f[_0x630d('0x3b')]=_0x160e6f[_0x630d('0x3b')]['length']?_0x160e6f[_0x630d('0x3b')]:_0x43aada[_0x630d('0x3a')];_0x160e6f[_0x630d('0x40')]=qs[_0x630d('0x41')](_0x8ccc9a[_0x630d('0x37')][_0x630d('0x41')]);_0x160e6f[_0x630d('0x42')]=qs[_0x630d('0x38')](_[_0x630d('0x56')](_0x8ccc9a['query'],_0x43aada[_0x630d('0x38')]));if(_0x8ccc9a[_0x630d('0x37')][_0x630d('0x43')]){_0x160e6f[_0x630d('0x42')]=_[_0x630d('0x44')](_0x160e6f[_0x630d('0x42')],{'$or':_[_0x630d('0x33')](_0x160e6f[_0x630d('0x3b')],function(_0xeecd0c){var _0xc856d9={};_0xc856d9[_0xeecd0c]={'$like':'%'+_0x8ccc9a[_0x630d('0x37')][_0x630d('0x43')]+'%'};return _0xc856d9;})});}_0x160e6f=_['merge']({},_0x160e6f,_0x8ccc9a['options']);return _0x3e311e[_0x630d('0x53')](_0x160e6f);}})['then'](function(_0x3571ac){if(_0x3571ac){_0x26e0f7=_0x3571ac['length'];if(!_0x8ccc9a[_0x630d('0x37')]['hasOwnProperty']('nolimit')){_0x160e6f['limit']=qs['limit'](_0x8ccc9a[_0x630d('0x37')][_0x630d('0x2a')]);_0x160e6f['offset']=qs[_0x630d('0x29')](_0x8ccc9a[_0x630d('0x37')][_0x630d('0x29')]);}return _0x3e311e[_0x630d('0x53')](_0x160e6f);}})[_0x630d('0x1a')](function(_0x207bc3){if(_0x207bc3){return _0x207bc3?{'count':_0x26e0f7,'rows':_0x207bc3}:null;}})['then'](respondWithResult(_0x4a648b,null))[_0x630d('0x24')](handleError(_0x4a648b,null));};exports[_0x630d('0x57')]=function(_0x2ed8d6,_0x40c619,_0x4a03a3){var _0x454b70={};var _0x303768={};var _0x22d700;var _0x342164;return db[_0x630d('0x48')][_0x630d('0x54')]({'where':{'id':_0x2ed8d6[_0x630d('0x51')]['id']}})[_0x630d('0x1a')](handleEntityNotFound(_0x40c619,null))['then'](function(_0x21b1d6){if(_0x21b1d6){_0x22d700=_0x21b1d6;_0x303768['model']=_[_0x630d('0x4c')](db[_0x630d('0x55')]['rawAttributes']);_0x303768['query']=_[_0x630d('0x4c')](_0x2ed8d6[_0x630d('0x37')]);_0x303768[_0x630d('0x38')]=_['intersection'](_0x303768[_0x630d('0x3a')],_0x303768[_0x630d('0x37')]);_0x454b70[_0x630d('0x3b')]=_[_0x630d('0x39')](_0x303768[_0x630d('0x3a')],qs['fields'](_0x2ed8d6[_0x630d('0x37')][_0x630d('0x3c')]));_0x454b70[_0x630d('0x3b')]=_0x454b70[_0x630d('0x3b')][_0x630d('0x3d')]?_0x454b70[_0x630d('0x3b')]:_0x303768['model'];_0x454b70[_0x630d('0x40')]=qs[_0x630d('0x41')](_0x2ed8d6[_0x630d('0x37')]['sort']);_0x454b70[_0x630d('0x42')]=qs[_0x630d('0x38')](_['pick'](_0x2ed8d6['query'],_0x303768[_0x630d('0x38')]));if(_0x2ed8d6['query'][_0x630d('0x43')]){_0x454b70[_0x630d('0x42')]=_[_0x630d('0x44')](_0x454b70['where'],{'$or':_[_0x630d('0x33')](_0x454b70[_0x630d('0x3b')],function(_0x598cdd){var _0x3778ff={};_0x3778ff[_0x598cdd]={'$like':'%'+_0x2ed8d6[_0x630d('0x37')][_0x630d('0x43')]+'%'};return _0x3778ff;})});}_0x454b70=_[_0x630d('0x44')]({},_0x454b70,_0x2ed8d6[_0x630d('0x47')]);return _0x22d700[_0x630d('0x57')](_0x454b70);}})['then'](function(_0x2c7a04){if(_0x2c7a04){_0x342164=_0x2c7a04[_0x630d('0x3d')];if(!_0x2ed8d6[_0x630d('0x37')][_0x630d('0x3e')](_0x630d('0x3f'))){_0x454b70[_0x630d('0x2a')]=qs[_0x630d('0x2a')](_0x2ed8d6[_0x630d('0x37')][_0x630d('0x2a')]);_0x454b70['offset']=qs[_0x630d('0x29')](_0x2ed8d6[_0x630d('0x37')][_0x630d('0x29')]);}return _0x22d700[_0x630d('0x57')](_0x454b70);}})[_0x630d('0x1a')](function(_0xfc924f){if(_0xfc924f){return _0xfc924f?{'count':_0x342164,'rows':_0xfc924f}:null;}})['then'](respondWithResult(_0x40c619,null))[_0x630d('0x24')](handleError(_0x40c619,null));};exports[_0x630d('0x58')]=function(_0x1261a5,_0x5ad2e2,_0x43d9f4){var _0x4742d5={};var _0x27c666={};var _0x4975ae;var _0x288570;return db[_0x630d('0x48')][_0x630d('0x54')]({'where':{'id':_0x1261a5[_0x630d('0x51')]['id']}})[_0x630d('0x1a')](handleEntityNotFound(_0x5ad2e2,null))['then'](function(_0x440024){if(_0x440024){_0x4975ae=_0x440024;_0x27c666[_0x630d('0x3a')]=_[_0x630d('0x4c')](db[_0x630d('0x55')][_0x630d('0x34')]);_0x27c666[_0x630d('0x37')]=_[_0x630d('0x4c')](_0x1261a5[_0x630d('0x37')]);_0x27c666[_0x630d('0x38')]=_['intersection'](_0x27c666['model'],_0x27c666[_0x630d('0x37')]);_0x4742d5[_0x630d('0x3b')]=_[_0x630d('0x39')](_0x27c666[_0x630d('0x3a')],qs[_0x630d('0x3c')](_0x1261a5[_0x630d('0x37')][_0x630d('0x3c')]));_0x4742d5[_0x630d('0x3b')]=_0x4742d5['attributes'][_0x630d('0x3d')]?_0x4742d5[_0x630d('0x3b')]:_0x27c666[_0x630d('0x3a')];_0x4742d5[_0x630d('0x40')]=qs[_0x630d('0x41')](_0x1261a5[_0x630d('0x37')][_0x630d('0x41')]);_0x4742d5[_0x630d('0x42')]=qs[_0x630d('0x38')](_[_0x630d('0x56')](_0x1261a5['query'],_0x27c666[_0x630d('0x38')]));if(_0x1261a5[_0x630d('0x37')][_0x630d('0x43')]){_0x4742d5[_0x630d('0x42')]=_[_0x630d('0x44')](_0x4742d5[_0x630d('0x42')],{'$or':_[_0x630d('0x33')](_0x4742d5[_0x630d('0x3b')],function(_0x596f08){var _0x240521={};_0x240521[_0x596f08]={'$like':'%'+_0x1261a5[_0x630d('0x37')]['filter']+'%'};return _0x240521;})});}_0x4742d5=_[_0x630d('0x44')]({},_0x4742d5,_0x1261a5[_0x630d('0x47')]);return _0x4975ae[_0x630d('0x58')](_0x4742d5);}})[_0x630d('0x1a')](function(_0x11b596){if(_0x11b596){_0x288570=_0x11b596[_0x630d('0x3d')];if(!_0x1261a5[_0x630d('0x37')][_0x630d('0x3e')](_0x630d('0x3f'))){_0x4742d5['limit']=qs[_0x630d('0x2a')](_0x1261a5[_0x630d('0x37')][_0x630d('0x2a')]);_0x4742d5[_0x630d('0x29')]=qs[_0x630d('0x29')](_0x1261a5[_0x630d('0x37')][_0x630d('0x29')]);}return _0x4975ae[_0x630d('0x58')](_0x4742d5);}})[_0x630d('0x1a')](function(_0x213be3){if(_0x213be3){return _0x213be3?{'count':_0x288570,'rows':_0x213be3}:null;}})[_0x630d('0x1a')](respondWithResult(_0x5ad2e2,null))[_0x630d('0x24')](handleError(_0x5ad2e2,null));}; \ No newline at end of file +var _0xbde4=['create','body','getFields','SugarcrmField','sort','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','order','where','pick','filter','VIRTUAL','merge','options','SugarcrmConfiguration','includeAll','include','findAll','rows','params','length','find'];(function(_0x4ff4b2,_0x342ad9){var _0xfac9d4=function(_0x3f8b40){while(--_0x3f8b40){_0x4ff4b2['push'](_0x4ff4b2['shift']());}};_0xfac9d4(++_0x342ad9);}(_0xbde4,0x115));var _0x4bde=function(_0x70521f,_0xd5125){_0x70521f=_0x70521f-0x0;var _0x302702=_0xbde4[_0x70521f];return _0x302702;};'use strict';var pdf=require(_0x4bde('0x0'));var emlformat=require(_0x4bde('0x1'));var rimraf=require(_0x4bde('0x2'));var zipdir=require(_0x4bde('0x3'));var jsonpatch=require(_0x4bde('0x4'));var rp=require(_0x4bde('0x5'));var moment=require(_0x4bde('0x6'));var BPromise=require(_0x4bde('0x7'));var Mustache=require(_0x4bde('0x8'));var util=require(_0x4bde('0x9'));var path=require(_0x4bde('0xa'));var sox=require(_0x4bde('0xb'));var csv=require(_0x4bde('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4bde('0xd'));var crypto=require(_0x4bde('0xe'));var jsforce=require(_0x4bde('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4bde('0xc'));var querystring=require(_0x4bde('0x10'));var Papa=require(_0x4bde('0x11'));var Redis=require('ioredis');var authService=require(_0x4bde('0x12'));var qs=require(_0x4bde('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bde('0x14'));var logger=require('../../config/logger')(_0x4bde('0x15'));var utils=require(_0x4bde('0x16'));var config=require(_0x4bde('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4bde('0x18'))['db'];var jayson=require(_0x4bde('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59ca2b,_0x2aa875,_0x5e888f,_0x17acfe){return new BPromise(function(_0x47fe15,_0x6ecd9d){var _0x523a6f=_0x17acfe||client;return _0x523a6f[_0x4bde('0x1a')](_0x59ca2b,_0x5e888f)['then'](function(_0x587711){logger[_0x4bde('0x1b')](_0x4bde('0x1c'),_0x2aa875,_0x4bde('0x1d'));logger[_0x4bde('0x1e')](_0x4bde('0x1f'),_0x2aa875,_0x4bde('0x1d'),JSON[_0x4bde('0x20')](_0x587711));if(_0x587711[_0x4bde('0x21')]){if(_0x587711[_0x4bde('0x21')][_0x4bde('0x22')]===0x1f4){logger[_0x4bde('0x21')](_0x4bde('0x1c'),_0x2aa875,_0x587711[_0x4bde('0x21')][_0x4bde('0x23')]);return _0x6ecd9d(_0x587711[_0x4bde('0x21')][_0x4bde('0x23')]);}logger[_0x4bde('0x21')](_0x4bde('0x1c'),_0x2aa875,_0x587711[_0x4bde('0x21')][_0x4bde('0x23')]);return _0x47fe15(_0x587711[_0x4bde('0x21')][_0x4bde('0x23')]);}else{logger[_0x4bde('0x1b')](_0x4bde('0x1c'),_0x2aa875,_0x4bde('0x1d'));_0x47fe15(_0x587711[_0x4bde('0x24')][_0x4bde('0x23')]);}})[_0x4bde('0x25')](function(_0x23c26c){logger[_0x4bde('0x21')](_0x4bde('0x1c'),_0x2aa875,_0x23c26c);_0x6ecd9d(_0x23c26c);});});}function respondWithStatusCode(_0x194533,_0x36c0cb){_0x36c0cb=_0x36c0cb||0xcc;return function(_0x3307d7){if(_0x3307d7){return _0x194533['sendStatus'](_0x36c0cb);}return _0x194533['status'](_0x36c0cb)[_0x4bde('0x26')]();};}function respondWithResult(_0x4ea482,_0x309d29){_0x309d29=_0x309d29||0xc8;return function(_0x2b21b4){if(_0x2b21b4){return _0x4ea482[_0x4bde('0x27')](_0x309d29)['json'](_0x2b21b4);}};}function respondWithFilteredResult(_0x3e1318,_0xb27da8){return function(_0x4e9f7e){if(_0x4e9f7e){var _0x3365ae=_0x4e9f7e[_0x4bde('0x28')],_0x5eab30=_0xb27da8['offset'],_0x25b987=_0xb27da8[_0x4bde('0x29')]+_0xb27da8[_0x4bde('0x2a')],_0x585488;if(_0x25b987>=_0x3365ae){_0x25b987=_0x3365ae;_0x585488=0xc8;}else{_0x585488=0xce;}_0x3e1318[_0x4bde('0x27')](_0x585488);return _0x3e1318[_0x4bde('0x2b')](_0x4bde('0x2c'),_0x5eab30+'-'+_0x25b987+'/'+_0x3365ae)[_0x4bde('0x2d')](_0x4e9f7e);}return null;};}function patchUpdates(_0x3c882b){return function(_0x49690e){try{jsonpatch[_0x4bde('0x2e')](_0x49690e,_0x3c882b,!![]);}catch(_0x46862a){return BPromise['reject'](_0x46862a);}return _0x49690e[_0x4bde('0x2f')]();};}function saveUpdates(_0x26f38f,_0x2cb6db){return function(_0x245fb1){if(_0x245fb1){return _0x245fb1[_0x4bde('0x30')](_0x26f38f)[_0x4bde('0x31')](function(_0x3a010c){return _0x3a010c;});}return null;};}function removeEntity(_0x549788,_0x216246){return function(_0x808ad6){if(_0x808ad6){return _0x808ad6[_0x4bde('0x32')]()[_0x4bde('0x31')](function(){_0x549788[_0x4bde('0x27')](0xcc)[_0x4bde('0x26')]();});}};}function handleEntityNotFound(_0x1b5f51,_0x108891){return function(_0x332755){if(!_0x332755){_0x1b5f51['sendStatus'](0x194);}return _0x332755;};}function handleError(_0x48cbbe,_0x1ae57c){_0x1ae57c=_0x1ae57c||0x1f4;return function(_0x369006){logger[_0x4bde('0x21')](_0x369006[_0x4bde('0x33')]);if(_0x369006[_0x4bde('0x34')]){delete _0x369006['name'];}_0x48cbbe[_0x4bde('0x27')](_0x1ae57c)['send'](_0x369006);};}exports[_0x4bde('0x35')]=function(_0x5cb47c,_0x3b0419){var _0x2ba4d4={},_0x49e3ea={},_0x4bfa8c={'count':0x0,'rows':[]};var _0x33a682=_[_0x4bde('0x36')](db['SugarcrmConfiguration'][_0x4bde('0x37')],function(_0x3c4b36){return{'name':_0x3c4b36['fieldName'],'type':_0x3c4b36[_0x4bde('0x38')]['key']};});_0x49e3ea[_0x4bde('0x39')]=_[_0x4bde('0x36')](_0x33a682,'name');_0x49e3ea[_0x4bde('0x3a')]=_[_0x4bde('0x3b')](_0x5cb47c[_0x4bde('0x3a')]);_0x49e3ea[_0x4bde('0x3c')]=_[_0x4bde('0x3d')](_0x49e3ea[_0x4bde('0x39')],_0x49e3ea[_0x4bde('0x3a')]);_0x2ba4d4['attributes']=_[_0x4bde('0x3d')](_0x49e3ea['model'],qs[_0x4bde('0x3e')](_0x5cb47c[_0x4bde('0x3a')][_0x4bde('0x3e')]));_0x2ba4d4[_0x4bde('0x3f')]=_0x2ba4d4[_0x4bde('0x3f')]['length']?_0x2ba4d4[_0x4bde('0x3f')]:_0x49e3ea[_0x4bde('0x39')];if(!_0x5cb47c[_0x4bde('0x3a')]['hasOwnProperty']('nolimit')){_0x2ba4d4[_0x4bde('0x2a')]=qs[_0x4bde('0x2a')](_0x5cb47c[_0x4bde('0x3a')][_0x4bde('0x2a')]);_0x2ba4d4[_0x4bde('0x29')]=qs['offset'](_0x5cb47c['query']['offset']);}_0x2ba4d4[_0x4bde('0x40')]=qs['sort'](_0x5cb47c[_0x4bde('0x3a')]['sort']);_0x2ba4d4[_0x4bde('0x41')]=qs[_0x4bde('0x3c')](_[_0x4bde('0x42')](_0x5cb47c[_0x4bde('0x3a')],_0x49e3ea[_0x4bde('0x3c')]),_0x33a682);if(_0x5cb47c[_0x4bde('0x3a')][_0x4bde('0x43')]){_0x2ba4d4[_0x4bde('0x41')]=_['merge'](_0x2ba4d4[_0x4bde('0x41')],{'$or':_[_0x4bde('0x36')](_0x33a682,function(_0x1f17f5){if(_0x1f17f5[_0x4bde('0x38')]!==_0x4bde('0x44')){var _0x235c2={};_0x235c2[_0x1f17f5[_0x4bde('0x34')]]={'$like':'%'+_0x5cb47c[_0x4bde('0x3a')][_0x4bde('0x43')]+'%'};return _0x235c2;}})});}_0x2ba4d4=_[_0x4bde('0x45')]({},_0x2ba4d4,_0x5cb47c[_0x4bde('0x46')]);var _0x4af7d7={'where':_0x2ba4d4[_0x4bde('0x41')]};return db[_0x4bde('0x47')]['count'](_0x4af7d7)[_0x4bde('0x31')](function(_0x1add8b){_0x4bfa8c['count']=_0x1add8b;if(_0x5cb47c[_0x4bde('0x3a')][_0x4bde('0x48')]){_0x2ba4d4[_0x4bde('0x49')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x4bde('0x4a')](_0x2ba4d4);})['then'](function(_0x16623e){_0x4bfa8c[_0x4bde('0x4b')]=_0x16623e;return _0x4bfa8c;})[_0x4bde('0x31')](respondWithFilteredResult(_0x3b0419,_0x2ba4d4))[_0x4bde('0x25')](handleError(_0x3b0419,null));};exports['show']=function(_0x250b38,_0x56dafd){var _0x43621={'raw':![],'where':{'id':_0x250b38[_0x4bde('0x4c')]['id']}},_0x33c1da={};_0x33c1da[_0x4bde('0x39')]=_[_0x4bde('0x3b')](db[_0x4bde('0x47')][_0x4bde('0x37')]);_0x33c1da[_0x4bde('0x3a')]=_[_0x4bde('0x3b')](_0x250b38[_0x4bde('0x3a')]);_0x33c1da[_0x4bde('0x3c')]=_[_0x4bde('0x3d')](_0x33c1da[_0x4bde('0x39')],_0x33c1da[_0x4bde('0x3a')]);_0x43621[_0x4bde('0x3f')]=_[_0x4bde('0x3d')](_0x33c1da[_0x4bde('0x39')],qs[_0x4bde('0x3e')](_0x250b38[_0x4bde('0x3a')]['fields']));_0x43621['attributes']=_0x43621['attributes'][_0x4bde('0x4d')]?_0x43621[_0x4bde('0x3f')]:_0x33c1da[_0x4bde('0x39')];if(_0x250b38['query'][_0x4bde('0x48')]){_0x43621[_0x4bde('0x49')]=[{'all':!![]}];}_0x43621=_[_0x4bde('0x45')]({},_0x43621,_0x250b38[_0x4bde('0x46')]);return db['SugarcrmConfiguration'][_0x4bde('0x4e')](_0x43621)[_0x4bde('0x31')](handleEntityNotFound(_0x56dafd,null))[_0x4bde('0x31')](respondWithResult(_0x56dafd,null))[_0x4bde('0x25')](handleError(_0x56dafd,null));};exports[_0x4bde('0x4f')]=function(_0x518c21,_0x4c3240){return db[_0x4bde('0x47')][_0x4bde('0x4f')](_0x518c21[_0x4bde('0x50')],{})[_0x4bde('0x31')](respondWithResult(_0x4c3240,0xc9))['catch'](handleError(_0x4c3240,null));};exports['update']=function(_0x44ba9f,_0xfc9f4d){if(_0x44ba9f[_0x4bde('0x50')]['id']){delete _0x44ba9f[_0x4bde('0x50')]['id'];}return db['SugarcrmConfiguration'][_0x4bde('0x4e')]({'where':{'id':_0x44ba9f[_0x4bde('0x4c')]['id']}})[_0x4bde('0x31')](handleEntityNotFound(_0xfc9f4d,null))[_0x4bde('0x31')](saveUpdates(_0x44ba9f[_0x4bde('0x50')],null))[_0x4bde('0x31')](respondWithResult(_0xfc9f4d,null))['catch'](handleError(_0xfc9f4d,null));};exports['destroy']=function(_0x33c8f3,_0x4b3770){return db[_0x4bde('0x47')][_0x4bde('0x4e')]({'where':{'id':_0x33c8f3[_0x4bde('0x4c')]['id']}})[_0x4bde('0x31')](handleEntityNotFound(_0x4b3770,null))['then'](removeEntity(_0x4b3770,null))[_0x4bde('0x25')](handleError(_0x4b3770,null));};exports[_0x4bde('0x51')]=function(_0x22ea06,_0x388771,_0x1750c3){var _0x439983={};var _0x2d8312={};var _0x5cca75;var _0x387dc9;return db[_0x4bde('0x47')]['findOne']({'where':{'id':_0x22ea06[_0x4bde('0x4c')]['id']}})[_0x4bde('0x31')](handleEntityNotFound(_0x388771,null))['then'](function(_0xa18614){if(_0xa18614){_0x5cca75=_0xa18614;_0x2d8312[_0x4bde('0x39')]=_[_0x4bde('0x3b')](db[_0x4bde('0x52')][_0x4bde('0x37')]);_0x2d8312[_0x4bde('0x3a')]=_['keys'](_0x22ea06[_0x4bde('0x3a')]);_0x2d8312['filters']=_['intersection'](_0x2d8312[_0x4bde('0x39')],_0x2d8312[_0x4bde('0x3a')]);_0x439983[_0x4bde('0x3f')]=_[_0x4bde('0x3d')](_0x2d8312[_0x4bde('0x39')],qs['fields'](_0x22ea06['query']['fields']));_0x439983[_0x4bde('0x3f')]=_0x439983[_0x4bde('0x3f')][_0x4bde('0x4d')]?_0x439983[_0x4bde('0x3f')]:_0x2d8312['model'];_0x439983[_0x4bde('0x40')]=qs[_0x4bde('0x53')](_0x22ea06[_0x4bde('0x3a')][_0x4bde('0x53')]);_0x439983[_0x4bde('0x41')]=qs['filters'](_[_0x4bde('0x42')](_0x22ea06['query'],_0x2d8312[_0x4bde('0x3c')]));if(_0x22ea06[_0x4bde('0x3a')][_0x4bde('0x43')]){_0x439983[_0x4bde('0x41')]=_[_0x4bde('0x45')](_0x439983[_0x4bde('0x41')],{'$or':_[_0x4bde('0x36')](_0x439983['attributes'],function(_0xb669ac){var _0x5d246d={};_0x5d246d[_0xb669ac]={'$like':'%'+_0x22ea06[_0x4bde('0x3a')][_0x4bde('0x43')]+'%'};return _0x5d246d;})});}_0x439983=_[_0x4bde('0x45')]({},_0x439983,_0x22ea06['options']);return _0x5cca75[_0x4bde('0x51')](_0x439983);}})[_0x4bde('0x31')](function(_0x4669f7){if(_0x4669f7){_0x387dc9=_0x4669f7[_0x4bde('0x4d')];if(!_0x22ea06[_0x4bde('0x3a')][_0x4bde('0x54')](_0x4bde('0x55'))){_0x439983[_0x4bde('0x2a')]=qs[_0x4bde('0x2a')](_0x22ea06[_0x4bde('0x3a')]['limit']);_0x439983['offset']=qs['offset'](_0x22ea06[_0x4bde('0x3a')]['offset']);}return _0x5cca75[_0x4bde('0x51')](_0x439983);}})['then'](function(_0x386585){if(_0x386585){return _0x386585?{'count':_0x387dc9,'rows':_0x386585}:null;}})[_0x4bde('0x31')](respondWithResult(_0x388771,null))[_0x4bde('0x25')](handleError(_0x388771,null));};exports[_0x4bde('0x56')]=function(_0x35f2a8,_0x446413,_0x2d8eaa){var _0xb059f5={};var _0x1ee1a1={};var _0x225aa1;var _0x438d55;return db[_0x4bde('0x47')][_0x4bde('0x57')]({'where':{'id':_0x35f2a8[_0x4bde('0x4c')]['id']}})[_0x4bde('0x31')](handleEntityNotFound(_0x446413,null))[_0x4bde('0x31')](function(_0x559cb7){if(_0x559cb7){_0x225aa1=_0x559cb7;_0x1ee1a1[_0x4bde('0x39')]=_[_0x4bde('0x3b')](db[_0x4bde('0x52')]['rawAttributes']);_0x1ee1a1[_0x4bde('0x3a')]=_[_0x4bde('0x3b')](_0x35f2a8[_0x4bde('0x3a')]);_0x1ee1a1['filters']=_[_0x4bde('0x3d')](_0x1ee1a1[_0x4bde('0x39')],_0x1ee1a1[_0x4bde('0x3a')]);_0xb059f5['attributes']=_[_0x4bde('0x3d')](_0x1ee1a1['model'],qs['fields'](_0x35f2a8[_0x4bde('0x3a')][_0x4bde('0x3e')]));_0xb059f5[_0x4bde('0x3f')]=_0xb059f5[_0x4bde('0x3f')]['length']?_0xb059f5['attributes']:_0x1ee1a1[_0x4bde('0x39')];_0xb059f5[_0x4bde('0x40')]=qs[_0x4bde('0x53')](_0x35f2a8[_0x4bde('0x3a')]['sort']);_0xb059f5[_0x4bde('0x41')]=qs[_0x4bde('0x3c')](_['pick'](_0x35f2a8[_0x4bde('0x3a')],_0x1ee1a1['filters']));if(_0x35f2a8[_0x4bde('0x3a')]['filter']){_0xb059f5['where']=_[_0x4bde('0x45')](_0xb059f5[_0x4bde('0x41')],{'$or':_[_0x4bde('0x36')](_0xb059f5[_0x4bde('0x3f')],function(_0x291588){var _0x2a85b0={};_0x2a85b0[_0x291588]={'$like':'%'+_0x35f2a8['query'][_0x4bde('0x43')]+'%'};return _0x2a85b0;})});}_0xb059f5=_['merge']({},_0xb059f5,_0x35f2a8['options']);return _0x225aa1[_0x4bde('0x56')](_0xb059f5);}})[_0x4bde('0x31')](function(_0x468804){if(_0x468804){_0x438d55=_0x468804[_0x4bde('0x4d')];if(!_0x35f2a8[_0x4bde('0x3a')][_0x4bde('0x54')]('nolimit')){_0xb059f5['limit']=qs['limit'](_0x35f2a8['query'][_0x4bde('0x2a')]);_0xb059f5[_0x4bde('0x29')]=qs[_0x4bde('0x29')](_0x35f2a8[_0x4bde('0x3a')][_0x4bde('0x29')]);}return _0x225aa1[_0x4bde('0x56')](_0xb059f5);}})[_0x4bde('0x31')](function(_0x46c15f){if(_0x46c15f){return _0x46c15f?{'count':_0x438d55,'rows':_0x46c15f}:null;}})['then'](respondWithResult(_0x446413,null))[_0x4bde('0x25')](handleError(_0x446413,null));};exports[_0x4bde('0x58')]=function(_0x2cdb8d,_0x571f8f,_0x53c4ce){var _0x5e986b={};var _0x586028={};var _0x440bd5;var _0x124cda;return db[_0x4bde('0x47')][_0x4bde('0x57')]({'where':{'id':_0x2cdb8d['params']['id']}})['then'](handleEntityNotFound(_0x571f8f,null))['then'](function(_0x19ce0e){if(_0x19ce0e){_0x440bd5=_0x19ce0e;_0x586028[_0x4bde('0x39')]=_[_0x4bde('0x3b')](db['SugarcrmField'][_0x4bde('0x37')]);_0x586028[_0x4bde('0x3a')]=_[_0x4bde('0x3b')](_0x2cdb8d[_0x4bde('0x3a')]);_0x586028[_0x4bde('0x3c')]=_[_0x4bde('0x3d')](_0x586028[_0x4bde('0x39')],_0x586028[_0x4bde('0x3a')]);_0x5e986b['attributes']=_[_0x4bde('0x3d')](_0x586028[_0x4bde('0x39')],qs['fields'](_0x2cdb8d[_0x4bde('0x3a')][_0x4bde('0x3e')]));_0x5e986b[_0x4bde('0x3f')]=_0x5e986b[_0x4bde('0x3f')][_0x4bde('0x4d')]?_0x5e986b[_0x4bde('0x3f')]:_0x586028[_0x4bde('0x39')];_0x5e986b[_0x4bde('0x40')]=qs['sort'](_0x2cdb8d[_0x4bde('0x3a')][_0x4bde('0x53')]);_0x5e986b[_0x4bde('0x41')]=qs[_0x4bde('0x3c')](_[_0x4bde('0x42')](_0x2cdb8d[_0x4bde('0x3a')],_0x586028[_0x4bde('0x3c')]));if(_0x2cdb8d[_0x4bde('0x3a')][_0x4bde('0x43')]){_0x5e986b[_0x4bde('0x41')]=_[_0x4bde('0x45')](_0x5e986b[_0x4bde('0x41')],{'$or':_['map'](_0x5e986b[_0x4bde('0x3f')],function(_0x403c0e){var _0x1fdf13={};_0x1fdf13[_0x403c0e]={'$like':'%'+_0x2cdb8d[_0x4bde('0x3a')][_0x4bde('0x43')]+'%'};return _0x1fdf13;})});}_0x5e986b=_[_0x4bde('0x45')]({},_0x5e986b,_0x2cdb8d['options']);return _0x440bd5['getDescriptions'](_0x5e986b);}})[_0x4bde('0x31')](function(_0x5b72f4){if(_0x5b72f4){_0x124cda=_0x5b72f4[_0x4bde('0x4d')];if(!_0x2cdb8d[_0x4bde('0x3a')][_0x4bde('0x54')]('nolimit')){_0x5e986b[_0x4bde('0x2a')]=qs[_0x4bde('0x2a')](_0x2cdb8d[_0x4bde('0x3a')][_0x4bde('0x2a')]);_0x5e986b['offset']=qs['offset'](_0x2cdb8d['query'][_0x4bde('0x29')]);}return _0x440bd5['getDescriptions'](_0x5e986b);}})['then'](function(_0x5f1612){if(_0x5f1612){return _0x5f1612?{'count':_0x124cda,'rows':_0x5f1612}:null;}})[_0x4bde('0x31')](respondWithResult(_0x571f8f,null))[_0x4bde('0x25')](handleError(_0x571f8f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9d5e1dd..cdbb536 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 _0x04f6=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x589c3a,_0x5ee805){var _0x3790eb=function(_0x3a8569){while(--_0x3a8569){_0x589c3a['push'](_0x589c3a['shift']());}};_0x3790eb(++_0x5ee805);}(_0x04f6,0xaf));var _0x604f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x04f6[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x604f('0x0'))(_0x604f('0x1'));var moment=require(_0x604f('0x2'));var BPromise=require(_0x604f('0x3'));var rp=require(_0x604f('0x4'));var fs=require('fs');var path=require(_0x604f('0x5'));var rimraf=require(_0x604f('0x6'));var config=require(_0x604f('0x7'));var attributes=require(_0x604f('0x8'));module[_0x604f('0x9')]=function(_0x3c7898,_0x36ef2c){return _0x3c7898[_0x604f('0xa')](_0x604f('0xb'),attributes,{'tableName':_0x604f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe68f=['moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','util','../../config/logger','api'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0xe68f,0x152));var _0xfe68=function(_0x4116fe,_0x2c5354){_0x4116fe=_0x4116fe-0x0;var _0x3a00bc=_0xe68f[_0x4116fe];return _0x3a00bc;};'use strict';var _=require('lodash');var util=require(_0xfe68('0x0'));var logger=require(_0xfe68('0x1'))(_0xfe68('0x2'));var moment=require(_0xfe68('0x3'));var BPromise=require(_0xfe68('0x4'));var rp=require(_0xfe68('0x5'));var fs=require('fs');var path=require(_0xfe68('0x6'));var rimraf=require(_0xfe68('0x7'));var config=require('../../config/environment');var attributes=require(_0xfe68('0x8'));module[_0xfe68('0x9')]=function(_0x1c96df,_0x4d17ad){return _0x1c96df['define'](_0xfe68('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index dd1e3da..527e5c2 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 _0xa994=['rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4518e2,_0xdfa81a){var _0x565409=function(_0x1d8f8c){while(--_0x1d8f8c){_0x4518e2['push'](_0x4518e2['shift']());}};_0x565409(++_0xdfa81a);}(_0xa994,0x112));var _0x4a99=function(_0x1f6ef6,_0x17dca9){_0x1f6ef6=_0x1f6ef6-0x0;var _0x2549ef=_0xa994[_0x1f6ef6];return _0x2549ef;};'use strict';var _=require(_0x4a99('0x0'));var util=require('util');var moment=require(_0x4a99('0x1'));var BPromise=require(_0x4a99('0x2'));var rs=require(_0x4a99('0x3'));var fs=require('fs');var Redis=require(_0x4a99('0x4'));var db=require(_0x4a99('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a99('0x6'));var config=require(_0x4a99('0x7'));var jayson=require(_0x4a99('0x8'));var client=jayson['client'][_0x4a99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49cecc,_0x154fee,_0x3583ae){return new BPromise(function(_0x384322,_0x452ae0){return client[_0x4a99('0xa')](_0x49cecc,_0x3583ae)[_0x4a99('0xb')](function(_0x1748b0){logger[_0x4a99('0xc')](_0x4a99('0xd'),_0x154fee,_0x4a99('0xe'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x154fee,_0x4a99('0xe'),JSON[_0x4a99('0xf')](_0x1748b0));if(_0x1748b0[_0x4a99('0x10')]){if(_0x1748b0[_0x4a99('0x10')][_0x4a99('0x11')]===0x1f4){logger['error'](_0x4a99('0xd'),_0x154fee,_0x1748b0[_0x4a99('0x10')]['message']);return _0x452ae0(_0x1748b0['error'][_0x4a99('0x12')]);}logger[_0x4a99('0x10')](_0x4a99('0xd'),_0x154fee,_0x1748b0[_0x4a99('0x10')]['message']);return _0x384322(_0x1748b0['error']['message']);}else{logger[_0x4a99('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x154fee,_0x4a99('0xe'));_0x384322(_0x1748b0['result']['message']);}})[_0x4a99('0x13')](function(_0x23196a){logger[_0x4a99('0x10')](_0x4a99('0xd'),_0x154fee,_0x23196a);_0x452ae0(_0x23196a);});});} \ No newline at end of file +var _0x4af5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x1e3c0a,_0x5616ef){var _0x4b27fe=function(_0x2f4060){while(--_0x2f4060){_0x1e3c0a['push'](_0x1e3c0a['shift']());}};_0x4b27fe(++_0x5616ef);}(_0x4af5,0xce));var _0x54af=function(_0x2e08fb,_0x21adfb){_0x2e08fb=_0x2e08fb-0x0;var _0x4d651f=_0x4af5[_0x2e08fb];return _0x4d651f;};'use strict';var _=require(_0x54af('0x0'));var util=require('util');var moment=require(_0x54af('0x1'));var BPromise=require(_0x54af('0x2'));var rs=require(_0x54af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54af('0x4'))['db'];var utils=require(_0x54af('0x5'));var logger=require(_0x54af('0x6'))(_0x54af('0x7'));var config=require(_0x54af('0x8'));var jayson=require(_0x54af('0x9'));var client=jayson[_0x54af('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40325a,_0x3d6e78,_0x37de68){return new BPromise(function(_0x57c7c7,_0x580755){return client['request'](_0x40325a,_0x37de68)[_0x54af('0xb')](function(_0x2a5d2e){logger['info'](_0x54af('0xc'),_0x3d6e78,_0x54af('0xd'));logger[_0x54af('0xe')](_0x54af('0xf'),_0x3d6e78,_0x54af('0xd'),JSON['stringify'](_0x2a5d2e));if(_0x2a5d2e[_0x54af('0x10')]){if(_0x2a5d2e['error']['code']===0x1f4){logger[_0x54af('0x10')](_0x54af('0xc'),_0x3d6e78,_0x2a5d2e['error']['message']);return _0x580755(_0x2a5d2e['error'][_0x54af('0x11')]);}logger[_0x54af('0x10')](_0x54af('0xc'),_0x3d6e78,_0x2a5d2e['error'][_0x54af('0x11')]);return _0x57c7c7(_0x2a5d2e[_0x54af('0x10')][_0x54af('0x11')]);}else{logger[_0x54af('0x12')](_0x54af('0xc'),_0x3d6e78,_0x54af('0xd'));_0x57c7c7(_0x2a5d2e[_0x54af('0x13')][_0x54af('0x11')]);}})[_0x54af('0x14')](function(_0x3c5d19){logger[_0x54af('0x10')](_0x54af('0xc'),_0x3d6e78,_0x3c5d19);_0x580755(_0x3c5d19);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 183129e..ea8d6bc 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 _0xbbf1=['create','put','/:id','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','post'];(function(_0x134e54,_0x34935e){var _0x42debd=function(_0x35a1e4){while(--_0x35a1e4){_0x134e54['push'](_0x134e54['shift']());}};_0x42debd(++_0x34935e);}(_0xbbf1,0x15c));var _0x1bbf=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xbbf1[_0x2faddb];return _0x273c05;};'use strict';var multer=require('multer');var util=require(_0x1bbf('0x0'));var path=require(_0x1bbf('0x1'));var timeout=require('connect-timeout');var express=require(_0x1bbf('0x2'));var router=express[_0x1bbf('0x3')]();var auth=require(_0x1bbf('0x4'));var interaction=require(_0x1bbf('0x5'));var config=require(_0x1bbf('0x6'));var controller=require(_0x1bbf('0x7'));router[_0x1bbf('0x8')]('/',auth[_0x1bbf('0x9')](),controller[_0x1bbf('0xa')]);router['get']('/:id',auth[_0x1bbf('0x9')](),controller[_0x1bbf('0xb')]);router[_0x1bbf('0xc')]('/',auth['isAuthenticated'](),controller[_0x1bbf('0xd')]);router[_0x1bbf('0xe')](_0x1bbf('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x1bbf('0x10')](_0x1bbf('0xf'),auth[_0x1bbf('0x9')](),controller[_0x1bbf('0x11')]);module[_0x1bbf('0x12')]=router; \ No newline at end of file +var _0x7418=['post','create','put','/:id','update','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7418,0x1c0));var _0x8741=function(_0x301fdf,_0x37c9ee){_0x301fdf=_0x301fdf-0x0;var _0x371747=_0x7418[_0x301fdf];return _0x371747;};'use strict';var multer=require(_0x8741('0x0'));var util=require('util');var path=require(_0x8741('0x1'));var timeout=require('connect-timeout');var express=require(_0x8741('0x2'));var router=express[_0x8741('0x3')]();var auth=require(_0x8741('0x4'));var interaction=require(_0x8741('0x5'));var config=require(_0x8741('0x6'));var controller=require('./intSugarcrmField.controller');router[_0x8741('0x7')]('/',auth[_0x8741('0x8')](),controller[_0x8741('0x9')]);router[_0x8741('0x7')]('/:id',auth[_0x8741('0x8')](),controller[_0x8741('0xa')]);router[_0x8741('0xb')]('/',auth['isAuthenticated'](),controller[_0x8741('0xc')]);router[_0x8741('0xd')](_0x8741('0xe'),auth[_0x8741('0x8')](),controller[_0x8741('0xf')]);router['delete'](_0x8741('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x8741('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index d48b403..4613f23 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 _0x6bdc=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x4b4b2d,_0x17e7b6){var _0x46b736=function(_0x5d4d11){while(--_0x5d4d11){_0x4b4b2d['push'](_0x4b4b2d['shift']());}};_0x46b736(++_0x17e7b6);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x2c7a29,_0x3d80ca){_0x2c7a29=_0x2c7a29-0x0;var _0x30aa53=_0x6bdc[_0x2c7a29];return _0x30aa53;};'use strict';var Sequelize=require(_0xc6bd('0x0'));module[_0xc6bd('0x1')]={'type':{'type':Sequelize[_0xc6bd('0x2')](_0xc6bd('0x3'),_0xc6bd('0x4'),_0xc6bd('0x5'),_0xc6bd('0x6')),'defaultValue':_0xc6bd('0x3')},'content':{'type':Sequelize[_0xc6bd('0x7')]},'key':{'type':Sequelize[_0xc6bd('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc6bd('0x3'),_0xc6bd('0x4'),_0xc6bd('0x5'))},'keyContent':{'type':Sequelize[_0xc6bd('0x7')]},'idField':{'type':Sequelize[_0xc6bd('0x7')]},'nameField':{'type':Sequelize[_0xc6bd('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6bd('0x7')]}}; \ No newline at end of file +var _0xda7f=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xda7f,0xc6));var _0xfda7=function(_0xd11b35,_0x5562e0){_0xd11b35=_0xd11b35-0x0;var _0x1014f4=_0xda7f[_0xd11b35];return _0x1014f4;};'use strict';var Sequelize=require(_0xfda7('0x0'));module['exports']={'type':{'type':Sequelize[_0xfda7('0x1')](_0xfda7('0x2'),_0xfda7('0x3'),_0xfda7('0x4'),_0xfda7('0x5')),'defaultValue':_0xfda7('0x2')},'content':{'type':Sequelize[_0xfda7('0x6')]},'key':{'type':Sequelize[_0xfda7('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xfda7('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xfda7('0x6')]},'idField':{'type':Sequelize[_0xfda7('0x6')]},'nameField':{'type':Sequelize[_0xfda7('0x6')]},'customField':{'type':Sequelize[_0xfda7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfda7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 7be2df0..ed1bb16 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 _0x207c=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','SugarcrmField','findAll','rows','catch','show','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x4ceed6,_0x546eb4){var _0x3c74fe=function(_0x7cfabb){while(--_0x7cfabb){_0x4ceed6['push'](_0x4ceed6['shift']());}};_0x3c74fe(++_0x546eb4);}(_0x207c,0x1e8));var _0xc207=function(_0x3b1e04,_0x1b7b69){_0x3b1e04=_0x3b1e04-0x0;var _0x4b6fa0=_0x207c[_0x3b1e04];return _0x4b6fa0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc207('0x0'));var rimraf=require(_0xc207('0x1'));var zipdir=require(_0xc207('0x2'));var jsonpatch=require(_0xc207('0x3'));var rp=require(_0xc207('0x4'));var moment=require(_0xc207('0x5'));var BPromise=require(_0xc207('0x6'));var Mustache=require('mustache');var util=require(_0xc207('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc207('0x8'));var fs=require('fs');var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=_0x564cef[_0xc207('0x1a')],_0x1cebfa=_0x4ef6c4['offset'],_0x6e793d=_0x4ef6c4[_0xc207('0x1b')]+_0x4ef6c4[_0xc207('0x1c')],_0x3d9c7b;if(_0x6e793d>=_0x554e5c){_0x6e793d=_0x554e5c;_0x3d9c7b=0xc8;}else{_0x3d9c7b=0xce;}_0x4031ad[_0xc207('0x17')](_0x3d9c7b);return _0x4031ad['set'](_0xc207('0x1d'),_0x1cebfa+'-'+_0x6e793d+'/'+_0x554e5c)['json'](_0x564cef);}return null;};}function patchUpdates(_0x42c8ba){return function(_0x33ddb1){try{jsonpatch[_0xc207('0x1e')](_0x33ddb1,_0x42c8ba,!![]);}catch(_0x461f6a){return BPromise[_0xc207('0x1f')](_0x461f6a);}return _0x33ddb1[_0xc207('0x20')]();};}function saveUpdates(_0x35c0b0,_0x464dea){return function(_0x212005){if(_0x212005){return _0x212005[_0xc207('0x21')](_0x35c0b0)[_0xc207('0x22')](function(_0xe227a){return _0xe227a;});}return null;};}function removeEntity(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['destroy']()[_0xc207('0x22')](function(){_0x40de25[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x83253f,_0x3539f4){return function(_0xd209ac){if(!_0xd209ac){_0x83253f[_0xc207('0x16')](0x194);}return _0xd209ac;};}function handleError(_0x1493fb,_0xa52138){_0xa52138=_0xa52138||0x1f4;return function(_0x2385f7){logger[_0xc207('0x23')](_0x2385f7[_0xc207('0x24')]);if(_0x2385f7[_0xc207('0x25')]){delete _0x2385f7[_0xc207('0x25')];}_0x1493fb[_0xc207('0x17')](_0xa52138)['send'](_0x2385f7);};}exports[_0xc207('0x26')]=function(_0x5e0bd1,_0x4cb3af){var _0x18ef72={},_0x3a05f3={},_0x2e41b1={'count':0x0,'rows':[]};var _0x2057ff=_[_0xc207('0x27')](db['SugarcrmField'][_0xc207('0x28')],function(_0x463ac8){return{'name':_0x463ac8[_0xc207('0x29')],'type':_0x463ac8[_0xc207('0x2a')][_0xc207('0x2b')]};});_0x3a05f3[_0xc207('0x2c')]=_[_0xc207('0x27')](_0x2057ff,_0xc207('0x25'));_0x3a05f3[_0xc207('0x2d')]=_[_0xc207('0x2e')](_0x5e0bd1[_0xc207('0x2d')]);_0x3a05f3[_0xc207('0x2f')]=_[_0xc207('0x30')](_0x3a05f3['model'],_0x3a05f3[_0xc207('0x2d')]);_0x18ef72[_0xc207('0x31')]=_[_0xc207('0x30')](_0x3a05f3[_0xc207('0x2c')],qs[_0xc207('0x32')](_0x5e0bd1[_0xc207('0x2d')]['fields']));_0x18ef72[_0xc207('0x31')]=_0x18ef72[_0xc207('0x31')][_0xc207('0x33')]?_0x18ef72[_0xc207('0x31')]:_0x3a05f3['model'];if(!_0x5e0bd1[_0xc207('0x2d')][_0xc207('0x34')](_0xc207('0x35'))){_0x18ef72[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x5e0bd1[_0xc207('0x2d')][_0xc207('0x1c')]);_0x18ef72[_0xc207('0x1b')]=qs[_0xc207('0x1b')](_0x5e0bd1['query']['offset']);}_0x18ef72[_0xc207('0x36')]=qs[_0xc207('0x37')](_0x5e0bd1[_0xc207('0x2d')][_0xc207('0x37')]);_0x18ef72['where']=qs[_0xc207('0x2f')](_[_0xc207('0x38')](_0x5e0bd1[_0xc207('0x2d')],_0x3a05f3[_0xc207('0x2f')]),_0x2057ff);if(_0x5e0bd1[_0xc207('0x2d')]['filter']){_0x18ef72[_0xc207('0x39')]=_[_0xc207('0x3a')](_0x18ef72['where'],{'$or':_[_0xc207('0x27')](_0x2057ff,function(_0x49bada){if(_0x49bada[_0xc207('0x2a')]!==_0xc207('0x3b')){var _0x48b4de={};_0x48b4de[_0x49bada[_0xc207('0x25')]]={'$like':'%'+_0x5e0bd1[_0xc207('0x2d')][_0xc207('0x3c')]+'%'};return _0x48b4de;}})});}_0x18ef72=_['merge']({},_0x18ef72,_0x5e0bd1['options']);var _0x37cc19={'where':_0x18ef72[_0xc207('0x39')]};return db[_0xc207('0x3d')][_0xc207('0x1a')](_0x37cc19)['then'](function(_0x3a6f45){_0x2e41b1['count']=_0x3a6f45;if(_0x5e0bd1['query']['includeAll']){_0x18ef72['include']=[{'all':!![]}];}return db[_0xc207('0x3d')][_0xc207('0x3e')](_0x18ef72);})[_0xc207('0x22')](function(_0x487f98){_0x2e41b1[_0xc207('0x3f')]=_0x487f98;return _0x2e41b1;})[_0xc207('0x22')](respondWithFilteredResult(_0x4cb3af,_0x18ef72))[_0xc207('0x40')](handleError(_0x4cb3af,null));};exports[_0xc207('0x41')]=function(_0x48efac,_0x47d43a){var _0x223349={'raw':!![],'where':{'id':_0x48efac[_0xc207('0x42')]['id']}},_0x123a46={};_0x123a46[_0xc207('0x2c')]=_['keys'](db[_0xc207('0x3d')][_0xc207('0x28')]);_0x123a46[_0xc207('0x2d')]=_[_0xc207('0x2e')](_0x48efac[_0xc207('0x2d')]);_0x123a46[_0xc207('0x2f')]=_[_0xc207('0x30')](_0x123a46[_0xc207('0x2c')],_0x123a46[_0xc207('0x2d')]);_0x223349['attributes']=_[_0xc207('0x30')](_0x123a46[_0xc207('0x2c')],qs['fields'](_0x48efac[_0xc207('0x2d')][_0xc207('0x32')]));_0x223349[_0xc207('0x31')]=_0x223349[_0xc207('0x31')][_0xc207('0x33')]?_0x223349['attributes']:_0x123a46[_0xc207('0x2c')];if(_0x48efac[_0xc207('0x2d')][_0xc207('0x43')]){_0x223349['include']=[{'all':!![]}];}_0x223349=_[_0xc207('0x3a')]({},_0x223349,_0x48efac[_0xc207('0x44')]);return db[_0xc207('0x3d')][_0xc207('0x45')](_0x223349)['then'](handleEntityNotFound(_0x47d43a,null))['then'](respondWithResult(_0x47d43a,null))[_0xc207('0x40')](handleError(_0x47d43a,null));};exports[_0xc207('0x46')]=function(_0x45fa1d,_0x4dc267){return db[_0xc207('0x3d')][_0xc207('0x46')](_0x45fa1d[_0xc207('0x47')],{})[_0xc207('0x22')](respondWithResult(_0x4dc267,0xc9))[_0xc207('0x40')](handleError(_0x4dc267,null));};exports[_0xc207('0x21')]=function(_0x2afcd1,_0x2fda4f){if(_0x2afcd1['body']['id']){delete _0x2afcd1['body']['id'];}return db[_0xc207('0x3d')][_0xc207('0x45')]({'where':{'id':_0x2afcd1[_0xc207('0x42')]['id']}})['then'](handleEntityNotFound(_0x2fda4f,null))[_0xc207('0x22')](saveUpdates(_0x2afcd1[_0xc207('0x47')],null))[_0xc207('0x22')](respondWithResult(_0x2fda4f,null))[_0xc207('0x40')](handleError(_0x2fda4f,null));};exports['destroy']=function(_0x26cb97,_0x50bdf1){return db[_0xc207('0x3d')]['find']({'where':{'id':_0x26cb97['params']['id']}})[_0xc207('0x22')](handleEntityNotFound(_0x50bdf1,null))[_0xc207('0x22')](removeEntity(_0x50bdf1,null))['catch'](handleError(_0x50bdf1,null));}; \ No newline at end of file +var _0xac9d=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','SugarcrmField','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/environment','../../config/license/util','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','index','map','fieldName','type','key'];(function(_0x711855,_0x4a5977){var _0x5f0bb7=function(_0x465862){while(--_0x465862){_0x711855['push'](_0x711855['shift']());}};_0x5f0bb7(++_0x4a5977);}(_0xac9d,0x14d));var _0xdac9=function(_0x420282,_0x1f941f){_0x420282=_0x420282-0x0;var _0x535480=_0xac9d[_0x420282];return _0x535480;};'use strict';var pdf=require(_0xdac9('0x0'));var emlformat=require(_0xdac9('0x1'));var rimraf=require(_0xdac9('0x2'));var zipdir=require(_0xdac9('0x3'));var jsonpatch=require(_0xdac9('0x4'));var rp=require(_0xdac9('0x5'));var moment=require(_0xdac9('0x6'));var BPromise=require(_0xdac9('0x7'));var Mustache=require('mustache');var util=require(_0xdac9('0x8'));var path=require('path');var sox=require(_0xdac9('0x9'));var csv=require(_0xdac9('0xa'));var ejs=require(_0xdac9('0xb'));var fs=require('fs');var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xcc;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['sendStatus'](_0xeddbc1);}return _0x3d8e97[_0xdac9('0x1b')](_0xeddbc1)[_0xdac9('0x1c')]();};}function respondWithResult(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0xc8;return function(_0x5dd536){if(_0x5dd536){return _0x9e1bf6[_0xdac9('0x1b')](_0x5f0bbd)[_0xdac9('0x1d')](_0x5dd536);}};}function respondWithFilteredResult(_0x50f9fe,_0x76af7a){return function(_0x36cbe4){if(_0x36cbe4){var _0x152ea5=_0x36cbe4[_0xdac9('0x1e')],_0x5b2f1b=_0x76af7a[_0xdac9('0x1f')],_0x2221f8=_0x76af7a['offset']+_0x76af7a[_0xdac9('0x20')],_0x393acc;if(_0x2221f8>=_0x152ea5){_0x2221f8=_0x152ea5;_0x393acc=0xc8;}else{_0x393acc=0xce;}_0x50f9fe[_0xdac9('0x1b')](_0x393acc);return _0x50f9fe['set'](_0xdac9('0x21'),_0x5b2f1b+'-'+_0x2221f8+'/'+_0x152ea5)[_0xdac9('0x1d')](_0x36cbe4);}return null;};}function patchUpdates(_0x171df1){return function(_0x181d11){try{jsonpatch['apply'](_0x181d11,_0x171df1,!![]);}catch(_0x520369){return BPromise[_0xdac9('0x22')](_0x520369);}return _0x181d11[_0xdac9('0x23')]();};}function saveUpdates(_0x2b9d91,_0x395ec7){return function(_0x52fb18){if(_0x52fb18){return _0x52fb18[_0xdac9('0x24')](_0x2b9d91)[_0xdac9('0x25')](function(_0x27f473){return _0x27f473;});}return null;};}function removeEntity(_0xae680a,_0xe7bd10){return function(_0x42317c){if(_0x42317c){return _0x42317c[_0xdac9('0x26')]()[_0xdac9('0x25')](function(){_0xae680a[_0xdac9('0x1b')](0xcc)[_0xdac9('0x1c')]();});}};}function handleEntityNotFound(_0x5a0fa2,_0x2943f5){return function(_0x11f4fd){if(!_0x11f4fd){_0x5a0fa2[_0xdac9('0x27')](0x194);}return _0x11f4fd;};}function handleError(_0x34a255,_0x5ca076){_0x5ca076=_0x5ca076||0x1f4;return function(_0x1e631a){logger['error'](_0x1e631a[_0xdac9('0x28')]);if(_0x1e631a[_0xdac9('0x29')]){delete _0x1e631a['name'];}_0x34a255[_0xdac9('0x1b')](_0x5ca076)['send'](_0x1e631a);};}exports[_0xdac9('0x2a')]=function(_0x3743f7,_0xeff4b2){var _0xfe4468={},_0x57d76a={},_0x4b87bc={'count':0x0,'rows':[]};var _0x13e9de=_[_0xdac9('0x2b')](db['SugarcrmField']['rawAttributes'],function(_0x3eed7a){return{'name':_0x3eed7a[_0xdac9('0x2c')],'type':_0x3eed7a[_0xdac9('0x2d')][_0xdac9('0x2e')]};});_0x57d76a[_0xdac9('0x2f')]=_[_0xdac9('0x2b')](_0x13e9de,_0xdac9('0x29'));_0x57d76a[_0xdac9('0x30')]=_[_0xdac9('0x31')](_0x3743f7[_0xdac9('0x30')]);_0x57d76a[_0xdac9('0x32')]=_[_0xdac9('0x33')](_0x57d76a[_0xdac9('0x2f')],_0x57d76a[_0xdac9('0x30')]);_0xfe4468[_0xdac9('0x34')]=_[_0xdac9('0x33')](_0x57d76a[_0xdac9('0x2f')],qs[_0xdac9('0x35')](_0x3743f7[_0xdac9('0x30')][_0xdac9('0x35')]));_0xfe4468[_0xdac9('0x34')]=_0xfe4468['attributes']['length']?_0xfe4468[_0xdac9('0x34')]:_0x57d76a[_0xdac9('0x2f')];if(!_0x3743f7[_0xdac9('0x30')][_0xdac9('0x36')](_0xdac9('0x37'))){_0xfe4468['limit']=qs[_0xdac9('0x20')](_0x3743f7['query'][_0xdac9('0x20')]);_0xfe4468[_0xdac9('0x1f')]=qs['offset'](_0x3743f7[_0xdac9('0x30')]['offset']);}_0xfe4468['order']=qs[_0xdac9('0x38')](_0x3743f7[_0xdac9('0x30')][_0xdac9('0x38')]);_0xfe4468[_0xdac9('0x39')]=qs[_0xdac9('0x32')](_[_0xdac9('0x3a')](_0x3743f7['query'],_0x57d76a[_0xdac9('0x32')]),_0x13e9de);if(_0x3743f7[_0xdac9('0x30')]['filter']){_0xfe4468[_0xdac9('0x39')]=_[_0xdac9('0x3b')](_0xfe4468[_0xdac9('0x39')],{'$or':_[_0xdac9('0x2b')](_0x13e9de,function(_0x35aa58){if(_0x35aa58[_0xdac9('0x2d')]!==_0xdac9('0x3c')){var _0x561fc7={};_0x561fc7[_0x35aa58[_0xdac9('0x29')]]={'$like':'%'+_0x3743f7[_0xdac9('0x30')][_0xdac9('0x3d')]+'%'};return _0x561fc7;}})});}_0xfe4468=_['merge']({},_0xfe4468,_0x3743f7[_0xdac9('0x3e')]);var _0x338e4a={'where':_0xfe4468[_0xdac9('0x39')]};return db[_0xdac9('0x3f')]['count'](_0x338e4a)['then'](function(_0x1d0243){_0x4b87bc[_0xdac9('0x1e')]=_0x1d0243;if(_0x3743f7[_0xdac9('0x30')][_0xdac9('0x40')]){_0xfe4468[_0xdac9('0x41')]=[{'all':!![]}];}return db['SugarcrmField'][_0xdac9('0x42')](_0xfe4468);})['then'](function(_0xd74baf){_0x4b87bc[_0xdac9('0x43')]=_0xd74baf;return _0x4b87bc;})[_0xdac9('0x25')](respondWithFilteredResult(_0xeff4b2,_0xfe4468))[_0xdac9('0x44')](handleError(_0xeff4b2,null));};exports[_0xdac9('0x45')]=function(_0x386b74,_0x413fb1){var _0xb176e0={'raw':!![],'where':{'id':_0x386b74[_0xdac9('0x46')]['id']}},_0x11362d={};_0x11362d[_0xdac9('0x2f')]=_[_0xdac9('0x31')](db[_0xdac9('0x3f')][_0xdac9('0x47')]);_0x11362d['query']=_[_0xdac9('0x31')](_0x386b74[_0xdac9('0x30')]);_0x11362d['filters']=_[_0xdac9('0x33')](_0x11362d[_0xdac9('0x2f')],_0x11362d[_0xdac9('0x30')]);_0xb176e0[_0xdac9('0x34')]=_[_0xdac9('0x33')](_0x11362d[_0xdac9('0x2f')],qs['fields'](_0x386b74[_0xdac9('0x30')]['fields']));_0xb176e0[_0xdac9('0x34')]=_0xb176e0[_0xdac9('0x34')][_0xdac9('0x48')]?_0xb176e0[_0xdac9('0x34')]:_0x11362d['model'];if(_0x386b74['query']['includeAll']){_0xb176e0[_0xdac9('0x41')]=[{'all':!![]}];}_0xb176e0=_['merge']({},_0xb176e0,_0x386b74['options']);return db[_0xdac9('0x3f')][_0xdac9('0x49')](_0xb176e0)['then'](handleEntityNotFound(_0x413fb1,null))['then'](respondWithResult(_0x413fb1,null))[_0xdac9('0x44')](handleError(_0x413fb1,null));};exports[_0xdac9('0x4a')]=function(_0x2a31e8,_0x470137){return db[_0xdac9('0x3f')][_0xdac9('0x4a')](_0x2a31e8[_0xdac9('0x4b')],{})[_0xdac9('0x25')](respondWithResult(_0x470137,0xc9))['catch'](handleError(_0x470137,null));};exports[_0xdac9('0x24')]=function(_0x3bd946,_0xfa104f){if(_0x3bd946[_0xdac9('0x4b')]['id']){delete _0x3bd946[_0xdac9('0x4b')]['id'];}return db[_0xdac9('0x3f')][_0xdac9('0x49')]({'where':{'id':_0x3bd946[_0xdac9('0x46')]['id']}})[_0xdac9('0x25')](handleEntityNotFound(_0xfa104f,null))[_0xdac9('0x25')](saveUpdates(_0x3bd946[_0xdac9('0x4b')],null))[_0xdac9('0x25')](respondWithResult(_0xfa104f,null))[_0xdac9('0x44')](handleError(_0xfa104f,null));};exports[_0xdac9('0x26')]=function(_0x53b349,_0x5112eb){return db['SugarcrmField'][_0xdac9('0x49')]({'where':{'id':_0x53b349[_0xdac9('0x46')]['id']}})['then'](handleEntityNotFound(_0x5112eb,null))[_0xdac9('0x25')](removeEntity(_0x5112eb,null))[_0xdac9('0x44')](handleError(_0x5112eb,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 9ef52a6..29275b8 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 _0x6a04=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','FieldId','lodash','../../config/logger'];(function(_0x306315,_0x46fdfc){var _0x141d2a=function(_0x1a906a){while(--_0x1a906a){_0x306315['push'](_0x306315['shift']());}};_0x141d2a(++_0x46fdfc);}(_0x6a04,0x12a));var _0x46a0=function(_0x4ce6eb,_0x5f19e3){_0x4ce6eb=_0x4ce6eb-0x0;var _0x3f4a51=_0x6a04[_0x4ce6eb];return _0x3f4a51;};'use strict';var _=require(_0x46a0('0x0'));var util=require('util');var logger=require(_0x46a0('0x1'))(_0x46a0('0x2'));var moment=require(_0x46a0('0x3'));var BPromise=require(_0x46a0('0x4'));var rp=require(_0x46a0('0x5'));var fs=require('fs');var path=require(_0x46a0('0x6'));var rimraf=require(_0x46a0('0x7'));var config=require(_0x46a0('0x8'));var attributes=require(_0x46a0('0x9'));module[_0x46a0('0xa')]=function(_0x4b952e,_0x37fac9){return _0x4b952e[_0x46a0('0xb')](_0x46a0('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x46a0('0xd'),'fields':['idField',_0x46a0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf24e=['define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf24e,0xae));var _0xef24=function(_0x2e819c,_0x3f99a5){_0x2e819c=_0x2e819c-0x0;var _0x24e271=_0xf24e[_0x2e819c];return _0x24e271;};'use strict';var _=require(_0xef24('0x0'));var util=require(_0xef24('0x1'));var logger=require(_0xef24('0x2'))(_0xef24('0x3'));var moment=require(_0xef24('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xef24('0x5'));var config=require(_0xef24('0x6'));var attributes=require(_0xef24('0x7'));module['exports']=function(_0x735014,_0x30867f){return _0x735014[_0xef24('0x8')](_0xef24('0x9'),attributes,{'tableName':_0xef24('0xa'),'paranoid':![],'indexes':[{'name':_0xef24('0xb'),'fields':[_0xef24('0xc'),_0xef24('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index f6dfddd..16da25a 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x87d67b,_0x35a31b){var _0x581ded=function(_0x45a116){while(--_0x45a116){_0x87d67b['push'](_0x87d67b['shift']());}};_0x581ded(++_0x35a31b);}(_0x2032,0xd9));var _0x2203=function(_0x239591,_0x4170fc){_0x239591=_0x239591-0x0;var _0x3b6341=_0x2032[_0x239591];return _0x3b6341;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ No newline at end of file +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x27842c,_0x324fcb){var _0x493de8=function(_0x1f6c85){while(--_0x1f6c85){_0x27842c['push'](_0x27842c['shift']());}};_0x493de8(++_0x324fcb);}(_0x14a0,0x8e));var _0x014a=function(_0x5e72d6,_0x2b442c){_0x5e72d6=_0x5e72d6-0x0;var _0x485c63=_0x14a0[_0x5e72d6];return _0x485c63;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4456a07..2997ea0 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 _0x9f65=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','index','isAuthenticated','show','get','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','/:id','destroy','exports','multer','path'];(function(_0x241099,_0x2997a9){var _0x164e96=function(_0x2975e4){while(--_0x2975e4){_0x241099['push'](_0x241099['shift']());}};_0x164e96(++_0x2997a9);}(_0x9f65,0x1a0));var _0x59f6=function(_0x189e27,_0x207e49){_0x189e27=_0x189e27-0x0;var _0x879fb4=_0x9f65[_0x189e27];return _0x879fb4;};'use strict';var multer=require(_0x59f6('0x0'));var util=require('util');var path=require(_0x59f6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x59f6('0x2')]();var auth=require(_0x59f6('0x3'));var interaction=require(_0x59f6('0x4'));var config=require(_0x59f6('0x5'));var controller=require(_0x59f6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x59f6('0x7')]);router['get']('/:id',auth[_0x59f6('0x8')](),controller[_0x59f6('0x9')]);router[_0x59f6('0xa')]('/:id/configurations',auth[_0x59f6('0x8')](),controller[_0x59f6('0xb')]);router[_0x59f6('0xa')](_0x59f6('0xc'),auth[_0x59f6('0x8')](),controller[_0x59f6('0xd')]);router[_0x59f6('0xe')]('/',auth[_0x59f6('0x8')](),controller[_0x59f6('0xf')]);router[_0x59f6('0xe')]('/:id/configurations',auth[_0x59f6('0x8')](),controller['addConfiguration']);router[_0x59f6('0x10')]('/:id',auth[_0x59f6('0x8')](),controller[_0x59f6('0x11')]);router[_0x59f6('0x12')](_0x59f6('0x13'),auth[_0x59f6('0x8')](),controller[_0x59f6('0x14')]);module[_0x59f6('0x15')]=router; \ No newline at end of file +var _0xa379=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','util'];(function(_0x32805f,_0x3c28a4){var _0x424b2c=function(_0x1cbc1f){while(--_0x1cbc1f){_0x32805f['push'](_0x32805f['shift']());}};_0x424b2c(++_0x3c28a4);}(_0xa379,0x16f));var _0x9a37=function(_0x22513a,_0x468238){_0x22513a=_0x22513a-0x0;var _0x4e187c=_0xa379[_0x22513a];return _0x4e187c;};'use strict';var multer=require('multer');var util=require(_0x9a37('0x0'));var path=require(_0x9a37('0x1'));var timeout=require(_0x9a37('0x2'));var express=require(_0x9a37('0x3'));var router=express[_0x9a37('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9a37('0x5'));var config=require(_0x9a37('0x6'));var controller=require(_0x9a37('0x7'));router[_0x9a37('0x8')]('/',auth[_0x9a37('0x9')](),controller[_0x9a37('0xa')]);router[_0x9a37('0x8')](_0x9a37('0xb'),auth[_0x9a37('0x9')](),controller[_0x9a37('0xc')]);router[_0x9a37('0x8')](_0x9a37('0xd'),auth[_0x9a37('0x9')](),controller[_0x9a37('0xe')]);router[_0x9a37('0x8')](_0x9a37('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x9a37('0x10')]('/',auth[_0x9a37('0x9')](),controller[_0x9a37('0x11')]);router[_0x9a37('0x10')](_0x9a37('0xd'),auth[_0x9a37('0x9')](),controller[_0x9a37('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9a37('0x13')]);router[_0x9a37('0x14')](_0x9a37('0xb'),auth[_0x9a37('0x9')](),controller[_0x9a37('0x15')]);module[_0x9a37('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 0b399d6..9ae641e 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 _0xaf64=['sequelize','STRING','HelpDesk'];(function(_0x357c7e,_0x21ddb9){var _0x4bcb63=function(_0x2cd651){while(--_0x2cd651){_0x357c7e['push'](_0x357c7e['shift']());}};_0x4bcb63(++_0x21ddb9);}(_0xaf64,0x123));var _0x4af6=function(_0x20d08e,_0x4cc575){_0x20d08e=_0x20d08e-0x0;var _0x2cbd12=_0xaf64[_0x20d08e];return _0x2cbd12;};'use strict';var Sequelize=require(_0x4af6('0x0'));module['exports']={'name':{'type':Sequelize[_0x4af6('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4af6('0x1')],'allowNull':![],'defaultValue':_0x4af6('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0x4af6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf4ab=['HelpDesk','sequelize','exports','STRING'];(function(_0x3f6a06,_0x5031c2){var _0x4cca12=function(_0x4d3a24){while(--_0x4d3a24){_0x3f6a06['push'](_0x3f6a06['shift']());}};_0x4cca12(++_0x5031c2);}(_0xf4ab,0x125));var _0xbf4a=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0xf4ab[_0xcda377];return _0x1c024f;};'use strict';var Sequelize=require(_0xbf4a('0x0'));module[_0xbf4a('0x1')]={'name':{'type':Sequelize[_0xbf4a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xbf4a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xbf4a('0x2')],'allowNull':![],'defaultValue':_0xbf4a('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0xbf4a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f9de256..b52e641 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 _0x448a=['rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','stack','name','send','map','VtigerAccount','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','rows','params','length','find','create','body','destroy','getConfigurations','VtigerConfiguration','pick','filter','nolimit','addConfiguration','findOne','AccountId','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','format','%s/webservice.php','GET','getchallenge','success','POST','token','sessionName','reference','owner','includes','remove','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format'];(function(_0x53f122,_0x2cdeca){var _0x59a134=function(_0x41468d){while(--_0x41468d){_0x53f122['push'](_0x53f122['shift']());}};_0x59a134(++_0x2cdeca);}(_0x448a,0x1ef));var _0xa448=function(_0x282e25,_0x5abf6b){_0x282e25=_0x282e25-0x0;var _0x444374=_0x448a[_0x282e25];return _0x444374;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa448('0x0'));var rimraf=require(_0xa448('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa448('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa448('0x3'));var Mustache=require(_0xa448('0x4'));var util=require('util');var path=require(_0xa448('0x5'));var sox=require(_0xa448('0x6'));var csv=require(_0xa448('0x7'));var ejs=require(_0xa448('0x8'));var fs=require('fs');var _=require(_0xa448('0x9'));var squel=require(_0xa448('0xa'));var crypto=require(_0xa448('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa448('0x7'));var querystring=require(_0xa448('0xc'));var Papa=require(_0xa448('0xd'));var Redis=require(_0xa448('0xe'));var authService=require(_0xa448('0xf'));var qs=require(_0xa448('0x10'));var as=require(_0xa448('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa448('0x12'));var utils=require(_0xa448('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa448('0x14'));var db=require(_0xa448('0x15'))['db'];var integrations=require(_0xa448('0x16'));var jayson=require(_0xa448('0x17'));var client=jayson[_0xa448('0x18')][_0xa448('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2babde,_0x357202,_0x2d41b6,_0x5da954){return new BPromise(function(_0x5d90aa,_0xf0e2f4){var _0x19f31f=_0x5da954||client;return _0x19f31f[_0xa448('0x1a')](_0x2babde,_0x2d41b6)[_0xa448('0x1b')](function(_0x335a28){logger[_0xa448('0x1c')]('VtigerAccount,\x20%s,\x20%s',_0x357202,'request\x20sent');logger['debug']('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x357202,_0xa448('0x1d'),JSON[_0xa448('0x1e')](_0x335a28));if(_0x335a28['error']){if(_0x335a28[_0xa448('0x1f')][_0xa448('0x20')]===0x1f4){logger[_0xa448('0x1f')](_0xa448('0x21'),_0x357202,_0x335a28[_0xa448('0x1f')]['message']);return _0xf0e2f4(_0x335a28[_0xa448('0x1f')][_0xa448('0x22')]);}logger[_0xa448('0x1f')](_0xa448('0x21'),_0x357202,_0x335a28[_0xa448('0x1f')]['message']);return _0x5d90aa(_0x335a28[_0xa448('0x1f')][_0xa448('0x22')]);}else{logger[_0xa448('0x1c')](_0xa448('0x21'),_0x357202,_0xa448('0x1d'));_0x5d90aa(_0x335a28[_0xa448('0x23')][_0xa448('0x22')]);}})[_0xa448('0x24')](function(_0x3552ae){logger[_0xa448('0x1f')](_0xa448('0x21'),_0x357202,_0x3552ae);_0xf0e2f4(_0x3552ae);});});}function respondWithStatusCode(_0x4aee1e,_0x347f87){_0x347f87=_0x347f87||0xcc;return function(_0x453d88){if(_0x453d88){return _0x4aee1e[_0xa448('0x25')](_0x347f87);}return _0x4aee1e[_0xa448('0x26')](_0x347f87)['end']();};}function respondWithResult(_0x2ccc29,_0xba8d8f){_0xba8d8f=_0xba8d8f||0xc8;return function(_0xc1af15){if(_0xc1af15){return _0x2ccc29[_0xa448('0x26')](_0xba8d8f)['json'](_0xc1af15);}};}function respondWithFilteredResult(_0x46bcb3,_0x4daa90){return function(_0x25a42d){if(_0x25a42d){var _0x3e6679=_0x25a42d['count'],_0x2aee99=_0x4daa90[_0xa448('0x27')],_0x1f045c=_0x4daa90[_0xa448('0x27')]+_0x4daa90[_0xa448('0x28')],_0xc05fb6;if(_0x1f045c>=_0x3e6679){_0x1f045c=_0x3e6679;_0xc05fb6=0xc8;}else{_0xc05fb6=0xce;}_0x46bcb3[_0xa448('0x26')](_0xc05fb6);return _0x46bcb3[_0xa448('0x29')](_0xa448('0x2a'),_0x2aee99+'-'+_0x1f045c+'/'+_0x3e6679)[_0xa448('0x2b')](_0x25a42d);}return null;};}function patchUpdates(_0x30f30a){return function(_0x445c10){try{jsonpatch[_0xa448('0x2c')](_0x445c10,_0x30f30a,!![]);}catch(_0x32bfa4){return BPromise[_0xa448('0x2d')](_0x32bfa4);}return _0x445c10[_0xa448('0x2e')]();};}function saveUpdates(_0x7a2715,_0x597a99){return function(_0x1f8938){if(_0x1f8938){return _0x1f8938[_0xa448('0x2f')](_0x7a2715)[_0xa448('0x1b')](function(_0x2136b5){return _0x2136b5;});}return null;};}function removeEntity(_0x440e3e,_0x1af0d8){return function(_0xe44a6){if(_0xe44a6){return _0xe44a6['destroy']()[_0xa448('0x1b')](function(){_0x440e3e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ccdbc,_0x3b7d4d){return function(_0x12eed9){if(!_0x12eed9){_0x2ccdbc[_0xa448('0x25')](0x194);}return _0x12eed9;};}function handleError(_0x3503d6,_0x5b06a8){_0x5b06a8=_0x5b06a8||0x1f4;return function(_0x4d545e){logger[_0xa448('0x1f')](_0x4d545e[_0xa448('0x30')]);if(_0x4d545e[_0xa448('0x31')]){delete _0x4d545e['name'];}_0x3503d6[_0xa448('0x26')](_0x5b06a8)[_0xa448('0x32')](_0x4d545e);};}exports['index']=function(_0xdc765d,_0x194f9e){var _0x1db1c8={},_0x68875a={},_0x43c452={'count':0x0,'rows':[]};var _0x5a58cd=_[_0xa448('0x33')](db[_0xa448('0x34')][_0xa448('0x35')],function(_0x15e207){return{'name':_0x15e207['fieldName'],'type':_0x15e207[_0xa448('0x36')][_0xa448('0x37')]};});_0x68875a[_0xa448('0x38')]=_[_0xa448('0x33')](_0x5a58cd,_0xa448('0x31'));_0x68875a['query']=_[_0xa448('0x39')](_0xdc765d[_0xa448('0x3a')]);_0x68875a[_0xa448('0x3b')]=_[_0xa448('0x3c')](_0x68875a[_0xa448('0x38')],_0x68875a[_0xa448('0x3a')]);_0x1db1c8[_0xa448('0x3d')]=_['intersection'](_0x68875a[_0xa448('0x38')],qs['fields'](_0xdc765d['query'][_0xa448('0x3e')]));_0x1db1c8[_0xa448('0x3d')]=_0x1db1c8[_0xa448('0x3d')]['length']?_0x1db1c8[_0xa448('0x3d')]:_0x68875a[_0xa448('0x38')];if(!_0xdc765d[_0xa448('0x3a')][_0xa448('0x3f')]('nolimit')){_0x1db1c8['limit']=qs[_0xa448('0x28')](_0xdc765d['query'][_0xa448('0x28')]);_0x1db1c8[_0xa448('0x27')]=qs[_0xa448('0x27')](_0xdc765d['query'][_0xa448('0x27')]);}_0x1db1c8[_0xa448('0x40')]=qs[_0xa448('0x41')](_0xdc765d[_0xa448('0x3a')][_0xa448('0x41')]);_0x1db1c8[_0xa448('0x42')]=qs[_0xa448('0x3b')](_['pick'](_0xdc765d['query'],_0x68875a[_0xa448('0x3b')]),_0x5a58cd);if(_0xdc765d[_0xa448('0x3a')]['filter']){_0x1db1c8[_0xa448('0x42')]=_[_0xa448('0x43')](_0x1db1c8[_0xa448('0x42')],{'$or':_[_0xa448('0x33')](_0x5a58cd,function(_0x210842){if(_0x210842[_0xa448('0x36')]!==_0xa448('0x44')){var _0x97e8af={};_0x97e8af[_0x210842[_0xa448('0x31')]]={'$like':'%'+_0xdc765d['query']['filter']+'%'};return _0x97e8af;}})});}_0x1db1c8=_['merge']({},_0x1db1c8,_0xdc765d[_0xa448('0x45')]);var _0xd78321={'where':_0x1db1c8[_0xa448('0x42')]};return db[_0xa448('0x34')]['count'](_0xd78321)[_0xa448('0x1b')](function(_0x488b3a){_0x43c452['count']=_0x488b3a;if(_0xdc765d[_0xa448('0x3a')][_0xa448('0x46')]){_0x1db1c8['include']=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x1db1c8);})['then'](function(_0x55d89e){_0x43c452[_0xa448('0x47')]=_0x55d89e;return _0x43c452;})[_0xa448('0x1b')](respondWithFilteredResult(_0x194f9e,_0x1db1c8))[_0xa448('0x24')](handleError(_0x194f9e,null));};exports['show']=function(_0x4585c9,_0x5e18aa){var _0xc41cb0={'raw':![],'where':{'id':_0x4585c9[_0xa448('0x48')]['id']}},_0x3dd84d={};_0x3dd84d['model']=_[_0xa448('0x39')](db[_0xa448('0x34')]['rawAttributes']);_0x3dd84d['query']=_[_0xa448('0x39')](_0x4585c9[_0xa448('0x3a')]);_0x3dd84d[_0xa448('0x3b')]=_[_0xa448('0x3c')](_0x3dd84d['model'],_0x3dd84d[_0xa448('0x3a')]);_0xc41cb0[_0xa448('0x3d')]=_[_0xa448('0x3c')](_0x3dd84d[_0xa448('0x38')],qs['fields'](_0x4585c9[_0xa448('0x3a')][_0xa448('0x3e')]));_0xc41cb0[_0xa448('0x3d')]=_0xc41cb0[_0xa448('0x3d')][_0xa448('0x49')]?_0xc41cb0['attributes']:_0x3dd84d[_0xa448('0x38')];if(_0x4585c9[_0xa448('0x3a')]['includeAll']){_0xc41cb0['include']=[{'all':!![]}];}_0xc41cb0=_[_0xa448('0x43')]({},_0xc41cb0,_0x4585c9[_0xa448('0x45')]);return db[_0xa448('0x34')][_0xa448('0x4a')](_0xc41cb0)[_0xa448('0x1b')](handleEntityNotFound(_0x5e18aa,null))[_0xa448('0x1b')](respondWithResult(_0x5e18aa,null))['catch'](handleError(_0x5e18aa,null));};exports[_0xa448('0x4b')]=function(_0x6a5c9f,_0x3f1e53){return db[_0xa448('0x34')][_0xa448('0x4b')](_0x6a5c9f['body'],{})[_0xa448('0x1b')](respondWithResult(_0x3f1e53,0xc9))[_0xa448('0x24')](handleError(_0x3f1e53,null));};exports['update']=function(_0x5359b1,_0x4bc0c5){if(_0x5359b1[_0xa448('0x4c')]['id']){delete _0x5359b1[_0xa448('0x4c')]['id'];}return db[_0xa448('0x34')][_0xa448('0x4a')]({'where':{'id':_0x5359b1[_0xa448('0x48')]['id']}})['then'](handleEntityNotFound(_0x4bc0c5,null))['then'](saveUpdates(_0x5359b1[_0xa448('0x4c')],null))[_0xa448('0x1b')](respondWithResult(_0x4bc0c5,null))['catch'](handleError(_0x4bc0c5,null));};exports[_0xa448('0x4d')]=function(_0x1ad904,_0xdeb841){return db[_0xa448('0x34')][_0xa448('0x4a')]({'where':{'id':_0x1ad904[_0xa448('0x48')]['id']}})[_0xa448('0x1b')](handleEntityNotFound(_0xdeb841,null))[_0xa448('0x1b')](removeEntity(_0xdeb841,null))[_0xa448('0x24')](handleError(_0xdeb841,null));};exports[_0xa448('0x4e')]=function(_0x476e8b,_0x173609,_0x1f74bb){var _0x2fc03e={};var _0x343efc={};var _0x112de8;var _0xf98b2;return db[_0xa448('0x34')]['findOne']({'where':{'id':_0x476e8b[_0xa448('0x48')]['id']}})[_0xa448('0x1b')](handleEntityNotFound(_0x173609,null))['then'](function(_0x4bd302){if(_0x4bd302){_0x112de8=_0x4bd302;_0x343efc[_0xa448('0x38')]=_[_0xa448('0x39')](db[_0xa448('0x4f')][_0xa448('0x35')]);_0x343efc['query']=_[_0xa448('0x39')](_0x476e8b[_0xa448('0x3a')]);_0x343efc['filters']=_[_0xa448('0x3c')](_0x343efc[_0xa448('0x38')],_0x343efc[_0xa448('0x3a')]);_0x2fc03e[_0xa448('0x3d')]=_[_0xa448('0x3c')](_0x343efc[_0xa448('0x38')],qs['fields'](_0x476e8b[_0xa448('0x3a')]['fields']));_0x2fc03e[_0xa448('0x3d')]=_0x2fc03e[_0xa448('0x3d')][_0xa448('0x49')]?_0x2fc03e[_0xa448('0x3d')]:_0x343efc[_0xa448('0x38')];_0x2fc03e[_0xa448('0x40')]=qs[_0xa448('0x41')](_0x476e8b[_0xa448('0x3a')][_0xa448('0x41')]);_0x2fc03e[_0xa448('0x42')]=qs[_0xa448('0x3b')](_[_0xa448('0x50')](_0x476e8b[_0xa448('0x3a')],_0x343efc[_0xa448('0x3b')]));if(_0x476e8b[_0xa448('0x3a')][_0xa448('0x51')]){_0x2fc03e[_0xa448('0x42')]=_[_0xa448('0x43')](_0x2fc03e['where'],{'$or':_[_0xa448('0x33')](_0x2fc03e[_0xa448('0x3d')],function(_0x298dae){var _0x234519={};_0x234519[_0x298dae]={'$like':'%'+_0x476e8b['query'][_0xa448('0x51')]+'%'};return _0x234519;})});}_0x2fc03e=_[_0xa448('0x43')]({},_0x2fc03e,_0x476e8b[_0xa448('0x45')]);return _0x112de8[_0xa448('0x4e')](_0x2fc03e);}})[_0xa448('0x1b')](function(_0x1d6c44){if(_0x1d6c44){_0xf98b2=_0x1d6c44[_0xa448('0x49')];if(!_0x476e8b[_0xa448('0x3a')][_0xa448('0x3f')](_0xa448('0x52'))){_0x2fc03e[_0xa448('0x28')]=qs['limit'](_0x476e8b[_0xa448('0x3a')][_0xa448('0x28')]);_0x2fc03e[_0xa448('0x27')]=qs[_0xa448('0x27')](_0x476e8b[_0xa448('0x3a')][_0xa448('0x27')]);}return _0x112de8[_0xa448('0x4e')](_0x2fc03e);}})['then'](function(_0x21bc41){if(_0x21bc41){return _0x21bc41?{'count':_0xf98b2,'rows':_0x21bc41}:null;}})[_0xa448('0x1b')](respondWithResult(_0x173609,null))[_0xa448('0x24')](handleError(_0x173609,null));};exports[_0xa448('0x53')]=function(_0x2195be,_0x1d5e03,_0x3bdfd0){if(_0x2195be[_0xa448('0x4c')]['id']){delete _0x2195be[_0xa448('0x4c')]['id'];}return db[_0xa448('0x34')][_0xa448('0x54')]({'where':{'id':_0x2195be[_0xa448('0x48')]['id']}})['then'](handleEntityNotFound(_0x1d5e03,null))[_0xa448('0x1b')](function(_0x57a6ab){if(_0x57a6ab){_0x2195be['body'][_0xa448('0x55')]=_0x57a6ab['id'];_0x2195be['body']['Subjects']=integrations['getSubjects'](_0x2195be['body'][_0xa448('0x56')],_0x2195be[_0xa448('0x4c')][_0xa448('0x36')]);_0x2195be[_0xa448('0x4c')][_0xa448('0x57')]=integrations[_0xa448('0x58')](_0x2195be['body'][_0xa448('0x56')],_0x2195be[_0xa448('0x4c')][_0xa448('0x36')]);return db[_0xa448('0x4f')][_0xa448('0x4b')](_0x2195be[_0xa448('0x4c')],{'include':[{'model':db[_0xa448('0x59')],'as':'Subjects'},{'model':db[_0xa448('0x59')],'as':_0xa448('0x57')}]});}return null;})[_0xa448('0x1b')](respondWithResult(_0x1d5e03,null))[_0xa448('0x24')](handleError(_0x1d5e03,null));};var md5=require(_0xa448('0x5a'));exports[_0xa448('0x5b')]=function(_0x358867,_0x5f5868,_0x560145){var _0x2ac14e=null;var _0xadfdb5=null;var _0x49d6e9=null;var _0x2b2753=null;var _0x20bbff='';return db[_0xa448('0x34')][_0xa448('0x54')]({'where':{'id':_0x358867[_0xa448('0x48')]['id']},'attributes':['id',_0xa448('0x31'),_0xa448('0x5c'),_0xa448('0x5d'),_0xa448('0x5e'),_0xa448('0x5f'),_0xa448('0x60'),_0xa448('0x61')]})['then'](handleEntityNotFound(_0x5f5868,null))['then'](function(_0x40bf16){if(_0x40bf16){_0x2ac14e=_0x40bf16[_0xa448('0x5c')];_0xadfdb5=_0x40bf16['accessKey'];_0x49d6e9=_0x40bf16[_0xa448('0x5e')];_0x20bbff=_0x40bf16[_0xa448('0x5f')];var _0x46e38f=_0x20bbff[_0xa448('0x62')](-0x1);if(_0x46e38f==='/'){_0x20bbff=_0x20bbff[_0xa448('0x63')](0x0,_0x20bbff['lastIndexOf'](_0x46e38f));}_0x2b2753=util[_0xa448('0x64')](_0xa448('0x65'),_0x20bbff);var _0x50be6e={'method':_0xa448('0x66'),'uri':_0x2b2753,'qs':{'operation':_0xa448('0x67'),'username':_0x40bf16[_0xa448('0x5c')]},'json':!![]};return rp(_0x50be6e);}})[_0xa448('0x1b')](function(_0x13e689){if(_0x13e689[_0xa448('0x68')]){var _0x7eeba9={'method':_0xa448('0x69'),'uri':_0x2b2753,'form':{'operation':'login','username':_0x2ac14e,'accessKey':md5(_0x13e689['result'][_0xa448('0x6a')]+_0xadfdb5)},'json':!![]};return rp(_0x7eeba9);}})[_0xa448('0x1b')](function(_0x4ffd56){if(_0x4ffd56[_0xa448('0x68')]){var _0x50ff85={'method':'GET','uri':_0x2b2753,'qs':{'operation':'describe','username':_0x2ac14e,'sessionName':_0x4ffd56['result'][_0xa448('0x6b')],'elementType':_0x49d6e9},'json':!![]};return rp(_0x50ff85);}})[_0xa448('0x1b')](function(_0x66c5f2){if(_0x66c5f2[_0xa448('0x68')]){var _0x176084=['autogenerated',_0xa448('0x6c'),_0xa448('0x6d')];_['remove'](_0x66c5f2[_0xa448('0x23')][_0xa448('0x3e')],function(_0x976b6d){return _0x176084[_0xa448('0x6e')](_0x976b6d[_0xa448('0x36')][_0xa448('0x31')]);});_[_0xa448('0x6f')](_0x66c5f2['result'][_0xa448('0x3e')],function(_0x18fe39){return _0x18fe39['editable']===_0xa448('0x70');});return{'count':_0x66c5f2[_0xa448('0x23')][_0xa448('0x3e')][_0xa448('0x49')],'rows':_['map'](_0x66c5f2[_0xa448('0x23')][_0xa448('0x3e')],function(_0x4658e8){return{'id':_0x4658e8[_0xa448('0x31')],'name':_0x4658e8[_0xa448('0x71')],'custom':_[_0xa448('0x72')](_0x4658e8[_0xa448('0x31')],_0xa448('0x73'))?!![]:![],'options':_0x4658e8[_0xa448('0x36')][_0xa448('0x31')]===_0xa448('0x74')&&_0x4658e8[_0xa448('0x36')][_0xa448('0x75')][_0xa448('0x49')]>0x0?_[_0xa448('0x33')](_0x4658e8['type'][_0xa448('0x75')],function(_0x2a16d7){return{'name':_0x2a16d7['label'],'value':_0x2a16d7[_0xa448('0x76')]};}):[]};})};}})[_0xa448('0x1b')](respondWithResult(_0x5f5868,null))['catch'](function(_0x3b9515){console[_0xa448('0x77')]('vTiger\x20error:\x20'+_0x3b9515);var _0x39980a=_0x358867['query'][_0xa448('0x78')]?0x1f4:_0x3b9515['statusCode']||0x1f4;logger['error'](_0xa448('0x79'),_0xa448('0x5b'),_0x39980a,JSON['stringify'](_0x3b9515));delete _0x3b9515['name'];if(_0x39980a===0x191){_0x39980a=0x190;}_0x5f5868[_0xa448('0x26')](_0x39980a)[_0xa448('0x32')](_0x358867[_0xa448('0x3a')][_0xa448('0x78')]?{'message':_0xa448('0x7a'),'statusCode':_0x3b9515[_0xa448('0x7b')]}:_0x3b9515);});}; \ No newline at end of file +var _0xb138=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','create','body','getConfigurations','findOne','VtigerConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','login','result','token','sessionName','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','json','count','offset','limit','set','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','VtigerAccount','fieldName','type','key','model','map','keys','filters','query'];(function(_0x599f22,_0x5a9d15){var _0x17fefc=function(_0x4fc769){while(--_0x4fc769){_0x599f22['push'](_0x599f22['shift']());}};_0x17fefc(++_0x5a9d15);}(_0xb138,0x1dd));var _0x8b13=function(_0x324d4b,_0x1668e3){_0x324d4b=_0x324d4b-0x0;var _0x18decc=_0xb138[_0x324d4b];return _0x18decc;};'use strict';var pdf=require(_0x8b13('0x0'));var emlformat=require(_0x8b13('0x1'));var rimraf=require(_0x8b13('0x2'));var zipdir=require(_0x8b13('0x3'));var jsonpatch=require(_0x8b13('0x4'));var rp=require(_0x8b13('0x5'));var moment=require(_0x8b13('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8b13('0x7'));var util=require(_0x8b13('0x8'));var path=require(_0x8b13('0x9'));var sox=require('sox');var csv=require(_0x8b13('0xa'));var ejs=require(_0x8b13('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b13('0xc'));var crypto=require(_0x8b13('0xd'));var jsforce=require(_0x8b13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8b13('0xa'));var querystring=require(_0x8b13('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b13('0x10'));var qs=require(_0x8b13('0x11'));var as=require(_0x8b13('0x12'));var hardwareService=require(_0x8b13('0x13'));var logger=require(_0x8b13('0x14'))('api');var utils=require(_0x8b13('0x15'));var config=require(_0x8b13('0x16'));var licenseUtil=require(_0x8b13('0x17'));var db=require(_0x8b13('0x18'))['db'];var integrations=require(_0x8b13('0x19'));var jayson=require(_0x8b13('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dcde6,_0x130a6f,_0x5f12b5,_0x51a935){return new BPromise(function(_0x479773,_0x272cb0){var _0x407ef4=_0x51a935||client;return _0x407ef4[_0x8b13('0x1b')](_0x3dcde6,_0x5f12b5)[_0x8b13('0x1c')](function(_0x13f956){logger['info'](_0x8b13('0x1d'),_0x130a6f,_0x8b13('0x1e'));logger[_0x8b13('0x1f')](_0x8b13('0x20'),_0x130a6f,_0x8b13('0x1e'),JSON[_0x8b13('0x21')](_0x13f956));if(_0x13f956[_0x8b13('0x22')]){if(_0x13f956[_0x8b13('0x22')]['code']===0x1f4){logger['error'](_0x8b13('0x1d'),_0x130a6f,_0x13f956[_0x8b13('0x22')][_0x8b13('0x23')]);return _0x272cb0(_0x13f956[_0x8b13('0x22')][_0x8b13('0x23')]);}logger[_0x8b13('0x22')]('VtigerAccount,\x20%s,\x20%s',_0x130a6f,_0x13f956[_0x8b13('0x22')][_0x8b13('0x23')]);return _0x479773(_0x13f956[_0x8b13('0x22')]['message']);}else{logger['info'](_0x8b13('0x1d'),_0x130a6f,_0x8b13('0x1e'));_0x479773(_0x13f956['result'][_0x8b13('0x23')]);}})[_0x8b13('0x24')](function(_0x37ca5f){logger[_0x8b13('0x22')](_0x8b13('0x1d'),_0x130a6f,_0x37ca5f);_0x272cb0(_0x37ca5f);});});}function respondWithStatusCode(_0x583639,_0x339271){_0x339271=_0x339271||0xcc;return function(_0x73614){if(_0x73614){return _0x583639['sendStatus'](_0x339271);}return _0x583639[_0x8b13('0x25')](_0x339271)['end']();};}function respondWithResult(_0x420772,_0x325d68){_0x325d68=_0x325d68||0xc8;return function(_0x54786a){if(_0x54786a){return _0x420772[_0x8b13('0x25')](_0x325d68)[_0x8b13('0x26')](_0x54786a);}};}function respondWithFilteredResult(_0x4f8e58,_0x134c5e){return function(_0x14a739){if(_0x14a739){var _0x410122=_0x14a739[_0x8b13('0x27')],_0x4048e4=_0x134c5e[_0x8b13('0x28')],_0x27fef3=_0x134c5e[_0x8b13('0x28')]+_0x134c5e[_0x8b13('0x29')],_0x54cdfc;if(_0x27fef3>=_0x410122){_0x27fef3=_0x410122;_0x54cdfc=0xc8;}else{_0x54cdfc=0xce;}_0x4f8e58[_0x8b13('0x25')](_0x54cdfc);return _0x4f8e58[_0x8b13('0x2a')]('Content-Range',_0x4048e4+'-'+_0x27fef3+'/'+_0x410122)[_0x8b13('0x26')](_0x14a739);}return null;};}function patchUpdates(_0xfec033){return function(_0x109f0e){try{jsonpatch[_0x8b13('0x2b')](_0x109f0e,_0xfec033,!![]);}catch(_0x23fde7){return BPromise[_0x8b13('0x2c')](_0x23fde7);}return _0x109f0e[_0x8b13('0x2d')]();};}function saveUpdates(_0x44bce2,_0x36f732){return function(_0x5751db){if(_0x5751db){return _0x5751db[_0x8b13('0x2e')](_0x44bce2)[_0x8b13('0x1c')](function(_0x288ff7){return _0x288ff7;});}return null;};}function removeEntity(_0x2878a6,_0x51a334){return function(_0x4f7d91){if(_0x4f7d91){return _0x4f7d91[_0x8b13('0x2f')]()['then'](function(){_0x2878a6['status'](0xcc)[_0x8b13('0x30')]();});}};}function handleEntityNotFound(_0x535521,_0x2ec1ab){return function(_0x408626){if(!_0x408626){_0x535521[_0x8b13('0x31')](0x194);}return _0x408626;};}function handleError(_0x39a3d2,_0x11657e){_0x11657e=_0x11657e||0x1f4;return function(_0x669416){logger[_0x8b13('0x22')](_0x669416[_0x8b13('0x32')]);if(_0x669416[_0x8b13('0x33')]){delete _0x669416[_0x8b13('0x33')];}_0x39a3d2['status'](_0x11657e)[_0x8b13('0x34')](_0x669416);};}exports[_0x8b13('0x35')]=function(_0x19b21c,_0x4141db){var _0x1ff25c={},_0x24179a={},_0x6b4645={'count':0x0,'rows':[]};var _0x241687=_['map'](db[_0x8b13('0x36')]['rawAttributes'],function(_0x3826a5){return{'name':_0x3826a5[_0x8b13('0x37')],'type':_0x3826a5[_0x8b13('0x38')][_0x8b13('0x39')]};});_0x24179a[_0x8b13('0x3a')]=_[_0x8b13('0x3b')](_0x241687,'name');_0x24179a['query']=_[_0x8b13('0x3c')](_0x19b21c['query']);_0x24179a[_0x8b13('0x3d')]=_['intersection'](_0x24179a[_0x8b13('0x3a')],_0x24179a[_0x8b13('0x3e')]);_0x1ff25c[_0x8b13('0x3f')]=_[_0x8b13('0x40')](_0x24179a[_0x8b13('0x3a')],qs['fields'](_0x19b21c['query'][_0x8b13('0x41')]));_0x1ff25c['attributes']=_0x1ff25c[_0x8b13('0x3f')][_0x8b13('0x42')]?_0x1ff25c['attributes']:_0x24179a[_0x8b13('0x3a')];if(!_0x19b21c[_0x8b13('0x3e')][_0x8b13('0x43')](_0x8b13('0x44'))){_0x1ff25c[_0x8b13('0x29')]=qs[_0x8b13('0x29')](_0x19b21c[_0x8b13('0x3e')]['limit']);_0x1ff25c['offset']=qs['offset'](_0x19b21c[_0x8b13('0x3e')][_0x8b13('0x28')]);}_0x1ff25c[_0x8b13('0x45')]=qs[_0x8b13('0x46')](_0x19b21c[_0x8b13('0x3e')][_0x8b13('0x46')]);_0x1ff25c['where']=qs[_0x8b13('0x3d')](_['pick'](_0x19b21c[_0x8b13('0x3e')],_0x24179a['filters']),_0x241687);if(_0x19b21c[_0x8b13('0x3e')][_0x8b13('0x47')]){_0x1ff25c[_0x8b13('0x48')]=_[_0x8b13('0x49')](_0x1ff25c[_0x8b13('0x48')],{'$or':_[_0x8b13('0x3b')](_0x241687,function(_0x2009a1){if(_0x2009a1['type']!=='VIRTUAL'){var _0x4ea104={};_0x4ea104[_0x2009a1[_0x8b13('0x33')]]={'$like':'%'+_0x19b21c[_0x8b13('0x3e')][_0x8b13('0x47')]+'%'};return _0x4ea104;}})});}_0x1ff25c=_[_0x8b13('0x49')]({},_0x1ff25c,_0x19b21c['options']);var _0x5e9d93={'where':_0x1ff25c[_0x8b13('0x48')]};return db['VtigerAccount'][_0x8b13('0x27')](_0x5e9d93)[_0x8b13('0x1c')](function(_0x20c363){_0x6b4645[_0x8b13('0x27')]=_0x20c363;if(_0x19b21c[_0x8b13('0x3e')]['includeAll']){_0x1ff25c[_0x8b13('0x4a')]=[{'all':!![]}];}return db[_0x8b13('0x36')][_0x8b13('0x4b')](_0x1ff25c);})[_0x8b13('0x1c')](function(_0x2c2c28){_0x6b4645[_0x8b13('0x4c')]=_0x2c2c28;return _0x6b4645;})[_0x8b13('0x1c')](respondWithFilteredResult(_0x4141db,_0x1ff25c))[_0x8b13('0x24')](handleError(_0x4141db,null));};exports[_0x8b13('0x4d')]=function(_0x518298,_0x46d096){var _0x59d863={'raw':![],'where':{'id':_0x518298[_0x8b13('0x4e')]['id']}},_0xb279fc={};_0xb279fc[_0x8b13('0x3a')]=_['keys'](db[_0x8b13('0x36')][_0x8b13('0x4f')]);_0xb279fc[_0x8b13('0x3e')]=_[_0x8b13('0x3c')](_0x518298[_0x8b13('0x3e')]);_0xb279fc[_0x8b13('0x3d')]=_[_0x8b13('0x40')](_0xb279fc['model'],_0xb279fc[_0x8b13('0x3e')]);_0x59d863['attributes']=_[_0x8b13('0x40')](_0xb279fc[_0x8b13('0x3a')],qs[_0x8b13('0x41')](_0x518298[_0x8b13('0x3e')][_0x8b13('0x41')]));_0x59d863[_0x8b13('0x3f')]=_0x59d863[_0x8b13('0x3f')][_0x8b13('0x42')]?_0x59d863[_0x8b13('0x3f')]:_0xb279fc[_0x8b13('0x3a')];if(_0x518298[_0x8b13('0x3e')][_0x8b13('0x50')]){_0x59d863[_0x8b13('0x4a')]=[{'all':!![]}];}_0x59d863=_[_0x8b13('0x49')]({},_0x59d863,_0x518298[_0x8b13('0x51')]);return db[_0x8b13('0x36')][_0x8b13('0x52')](_0x59d863)['then'](handleEntityNotFound(_0x46d096,null))[_0x8b13('0x1c')](respondWithResult(_0x46d096,null))[_0x8b13('0x24')](handleError(_0x46d096,null));};exports['create']=function(_0x342fff,_0x328373){return db[_0x8b13('0x36')][_0x8b13('0x53')](_0x342fff[_0x8b13('0x54')],{})[_0x8b13('0x1c')](respondWithResult(_0x328373,0xc9))[_0x8b13('0x24')](handleError(_0x328373,null));};exports[_0x8b13('0x2e')]=function(_0xe125c2,_0x1ff311){if(_0xe125c2[_0x8b13('0x54')]['id']){delete _0xe125c2[_0x8b13('0x54')]['id'];}return db[_0x8b13('0x36')][_0x8b13('0x52')]({'where':{'id':_0xe125c2[_0x8b13('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1ff311,null))[_0x8b13('0x1c')](saveUpdates(_0xe125c2[_0x8b13('0x54')],null))['then'](respondWithResult(_0x1ff311,null))[_0x8b13('0x24')](handleError(_0x1ff311,null));};exports[_0x8b13('0x2f')]=function(_0x237e45,_0x46c595){return db[_0x8b13('0x36')]['find']({'where':{'id':_0x237e45[_0x8b13('0x4e')]['id']}})[_0x8b13('0x1c')](handleEntityNotFound(_0x46c595,null))[_0x8b13('0x1c')](removeEntity(_0x46c595,null))['catch'](handleError(_0x46c595,null));};exports[_0x8b13('0x55')]=function(_0x17ab12,_0x585392,_0x1a026f){var _0x348c11={};var _0x475c8d={};var _0xd29067;var _0x49e5cd;return db[_0x8b13('0x36')][_0x8b13('0x56')]({'where':{'id':_0x17ab12['params']['id']}})[_0x8b13('0x1c')](handleEntityNotFound(_0x585392,null))[_0x8b13('0x1c')](function(_0x311a5e){if(_0x311a5e){_0xd29067=_0x311a5e;_0x475c8d[_0x8b13('0x3a')]=_['keys'](db[_0x8b13('0x57')][_0x8b13('0x4f')]);_0x475c8d[_0x8b13('0x3e')]=_[_0x8b13('0x3c')](_0x17ab12[_0x8b13('0x3e')]);_0x475c8d[_0x8b13('0x3d')]=_['intersection'](_0x475c8d[_0x8b13('0x3a')],_0x475c8d[_0x8b13('0x3e')]);_0x348c11[_0x8b13('0x3f')]=_['intersection'](_0x475c8d[_0x8b13('0x3a')],qs[_0x8b13('0x41')](_0x17ab12[_0x8b13('0x3e')][_0x8b13('0x41')]));_0x348c11['attributes']=_0x348c11['attributes']['length']?_0x348c11['attributes']:_0x475c8d['model'];_0x348c11[_0x8b13('0x45')]=qs[_0x8b13('0x46')](_0x17ab12['query'][_0x8b13('0x46')]);_0x348c11['where']=qs[_0x8b13('0x3d')](_[_0x8b13('0x58')](_0x17ab12[_0x8b13('0x3e')],_0x475c8d[_0x8b13('0x3d')]));if(_0x17ab12[_0x8b13('0x3e')][_0x8b13('0x47')]){_0x348c11[_0x8b13('0x48')]=_['merge'](_0x348c11[_0x8b13('0x48')],{'$or':_['map'](_0x348c11[_0x8b13('0x3f')],function(_0x2ce908){var _0x207a54={};_0x207a54[_0x2ce908]={'$like':'%'+_0x17ab12[_0x8b13('0x3e')][_0x8b13('0x47')]+'%'};return _0x207a54;})});}_0x348c11=_[_0x8b13('0x49')]({},_0x348c11,_0x17ab12[_0x8b13('0x51')]);return _0xd29067['getConfigurations'](_0x348c11);}})[_0x8b13('0x1c')](function(_0x5d1174){if(_0x5d1174){_0x49e5cd=_0x5d1174[_0x8b13('0x42')];if(!_0x17ab12[_0x8b13('0x3e')][_0x8b13('0x43')](_0x8b13('0x44'))){_0x348c11[_0x8b13('0x29')]=qs['limit'](_0x17ab12['query'][_0x8b13('0x29')]);_0x348c11[_0x8b13('0x28')]=qs['offset'](_0x17ab12[_0x8b13('0x3e')][_0x8b13('0x28')]);}return _0xd29067[_0x8b13('0x55')](_0x348c11);}})['then'](function(_0x51eb7e){if(_0x51eb7e){return _0x51eb7e?{'count':_0x49e5cd,'rows':_0x51eb7e}:null;}})[_0x8b13('0x1c')](respondWithResult(_0x585392,null))[_0x8b13('0x24')](handleError(_0x585392,null));};exports[_0x8b13('0x59')]=function(_0x52850c,_0x2a6c62,_0xd7002a){if(_0x52850c['body']['id']){delete _0x52850c[_0x8b13('0x54')]['id'];}return db[_0x8b13('0x36')][_0x8b13('0x56')]({'where':{'id':_0x52850c[_0x8b13('0x4e')]['id']}})[_0x8b13('0x1c')](handleEntityNotFound(_0x2a6c62,null))[_0x8b13('0x1c')](function(_0x4334c1){if(_0x4334c1){_0x52850c[_0x8b13('0x54')][_0x8b13('0x5a')]=_0x4334c1['id'];_0x52850c[_0x8b13('0x54')][_0x8b13('0x5b')]=integrations[_0x8b13('0x5c')](_0x52850c[_0x8b13('0x54')][_0x8b13('0x5d')],_0x52850c['body'][_0x8b13('0x38')]);_0x52850c['body'][_0x8b13('0x5e')]=integrations[_0x8b13('0x5f')](_0x52850c[_0x8b13('0x54')][_0x8b13('0x5d')],_0x52850c['body']['type']);return db[_0x8b13('0x57')][_0x8b13('0x53')](_0x52850c['body'],{'include':[{'model':db[_0x8b13('0x60')],'as':_0x8b13('0x5b')},{'model':db[_0x8b13('0x60')],'as':_0x8b13('0x5e')}]});}return null;})[_0x8b13('0x1c')](respondWithResult(_0x2a6c62,null))[_0x8b13('0x24')](handleError(_0x2a6c62,null));};var md5=require(_0x8b13('0x61'));exports[_0x8b13('0x62')]=function(_0xddd6f9,_0x24211c,_0x48fd36){var _0x2a1fd3=null;var _0x2e7477=null;var _0x5ac2c4=null;var _0x19e4c4=null;var _0x432979='';return db['VtigerAccount'][_0x8b13('0x56')]({'where':{'id':_0xddd6f9[_0x8b13('0x4e')]['id']},'attributes':['id',_0x8b13('0x33'),_0x8b13('0x63'),_0x8b13('0x64'),_0x8b13('0x65'),_0x8b13('0x66'),_0x8b13('0x67'),'accessKey']})[_0x8b13('0x1c')](handleEntityNotFound(_0x24211c,null))[_0x8b13('0x1c')](function(_0x282bf9){if(_0x282bf9){_0x2a1fd3=_0x282bf9['username'];_0x2e7477=_0x282bf9[_0x8b13('0x68')];_0x5ac2c4=_0x282bf9['moduleName'];_0x432979=_0x282bf9[_0x8b13('0x66')];var _0x383d56=_0x432979[_0x8b13('0x69')](-0x1);if(_0x383d56==='/'){_0x432979=_0x432979[_0x8b13('0x6a')](0x0,_0x432979[_0x8b13('0x6b')](_0x383d56));}_0x19e4c4=util[_0x8b13('0x6c')](_0x8b13('0x6d'),_0x432979);var _0x418eb4={'method':_0x8b13('0x6e'),'uri':_0x19e4c4,'qs':{'operation':_0x8b13('0x6f'),'username':_0x282bf9['username']},'json':!![]};return rp(_0x418eb4);}})[_0x8b13('0x1c')](function(_0x111a4f){if(_0x111a4f[_0x8b13('0x70')]){var _0xc76c8b={'method':_0x8b13('0x71'),'uri':_0x19e4c4,'form':{'operation':_0x8b13('0x72'),'username':_0x2a1fd3,'accessKey':md5(_0x111a4f[_0x8b13('0x73')][_0x8b13('0x74')]+_0x2e7477)},'json':!![]};return rp(_0xc76c8b);}})[_0x8b13('0x1c')](function(_0x188cc5){if(_0x188cc5[_0x8b13('0x70')]){var _0x1819fb={'method':_0x8b13('0x6e'),'uri':_0x19e4c4,'qs':{'operation':'describe','username':_0x2a1fd3,'sessionName':_0x188cc5['result'][_0x8b13('0x75')],'elementType':_0x5ac2c4},'json':!![]};return rp(_0x1819fb);}})['then'](function(_0x22e10a){if(_0x22e10a[_0x8b13('0x70')]){var _0x57c9af=['autogenerated',_0x8b13('0x76'),_0x8b13('0x77')];_[_0x8b13('0x78')](_0x22e10a[_0x8b13('0x73')][_0x8b13('0x41')],function(_0x5b8abf){return _0x57c9af[_0x8b13('0x79')](_0x5b8abf['type'][_0x8b13('0x33')]);});_[_0x8b13('0x78')](_0x22e10a['result'][_0x8b13('0x41')],function(_0x240cd4){return _0x240cd4[_0x8b13('0x7a')]===_0x8b13('0x7b');});return{'count':_0x22e10a[_0x8b13('0x73')]['fields'][_0x8b13('0x42')],'rows':_[_0x8b13('0x3b')](_0x22e10a[_0x8b13('0x73')]['fields'],function(_0x54e7cb){return{'id':_0x54e7cb['name'],'name':_0x54e7cb[_0x8b13('0x7c')],'custom':_[_0x8b13('0x7d')](_0x54e7cb[_0x8b13('0x33')],_0x8b13('0x7e'))?!![]:![],'options':_0x54e7cb[_0x8b13('0x38')][_0x8b13('0x33')]===_0x8b13('0x7f')&&_0x54e7cb[_0x8b13('0x38')][_0x8b13('0x80')][_0x8b13('0x42')]>0x0?_['map'](_0x54e7cb[_0x8b13('0x38')][_0x8b13('0x80')],function(_0x179c84){return{'name':_0x179c84[_0x8b13('0x7c')],'value':_0x179c84[_0x8b13('0x81')]};}):[]};})};}})['then'](respondWithResult(_0x24211c,null))[_0x8b13('0x24')](function(_0x45dc31){console[_0x8b13('0x82')](_0x8b13('0x83')+_0x45dc31);var _0x4f601d=_0xddd6f9[_0x8b13('0x3e')]['test']?0x1f4:_0x45dc31[_0x8b13('0x84')]||0x1f4;logger[_0x8b13('0x22')]('getFields,\x20%s,\x20%s,\x20%s',_0x8b13('0x62'),_0x4f601d,JSON['stringify'](_0x45dc31));delete _0x45dc31[_0x8b13('0x33')];if(_0x4f601d===0x191){_0x4f601d=0x190;}_0x24211c['status'](_0x4f601d)[_0x8b13('0x34')](_0xddd6f9[_0x8b13('0x3e')][_0x8b13('0x85')]?{'message':_0x8b13('0x86'),'statusCode':_0x45dc31[_0x8b13('0x84')]}:_0x45dc31);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index e37e1b9..d656864 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 _0x2610=['../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2610,0x1e1));var _0x0261=function(_0x2008ee,_0xe5f904){_0x2008ee=_0x2008ee-0x0;var _0x25dede=_0x2610[_0x2008ee];return _0x25dede;};'use strict';var _=require(_0x0261('0x0'));var util=require(_0x0261('0x1'));var logger=require(_0x0261('0x2'))(_0x0261('0x3'));var moment=require(_0x0261('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0261('0x5'));var rimraf=require(_0x0261('0x6'));var config=require(_0x0261('0x7'));var attributes=require(_0x0261('0x8'));var integrations=require(_0x0261('0x9'));module[_0x0261('0xa')]=function(_0x502e65,_0x38d916){return _0x502e65[_0x0261('0xb')](_0x0261('0xc'),attributes,{'tableName':_0x0261('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x994e=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api'];(function(_0x25044b,_0x536424){var _0x232519=function(_0x54255a){while(--_0x54255a){_0x25044b['push'](_0x25044b['shift']());}};_0x232519(++_0x536424);}(_0x994e,0x1cd));var _0xe994=function(_0x4aae38,_0x2c1940){_0x4aae38=_0x4aae38-0x0;var _0x98a092=_0x994e[_0x4aae38];return _0x98a092;};'use strict';var _=require(_0xe994('0x0'));var util=require(_0xe994('0x1'));var logger=require(_0xe994('0x2'))(_0xe994('0x3'));var moment=require('moment');var BPromise=require(_0xe994('0x4'));var rp=require(_0xe994('0x5'));var fs=require('fs');var path=require(_0xe994('0x6'));var rimraf=require(_0xe994('0x7'));var config=require(_0xe994('0x8'));var attributes=require(_0xe994('0x9'));var integrations=require(_0xe994('0xa'));module[_0xe994('0xb')]=function(_0x1caa4c,_0xe72dab){return _0x1caa4c[_0xe994('0xc')](_0xe994('0xd'),attributes,{'tableName':_0xe994('0xe'),'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 e133140..f02bd7a 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 _0x44b5=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowVtigerAccount','find','stringify','util'];(function(_0x7b484,_0x195ad4){var _0x2ae1cf=function(_0x2e6247){while(--_0x2e6247){_0x7b484['push'](_0x7b484['shift']());}};_0x2ae1cf(++_0x195ad4);}(_0x44b5,0x65));var _0x544b=function(_0x18ae3d,_0x53d077){_0x18ae3d=_0x18ae3d-0x0;var _0x32d927=_0x44b5[_0x18ae3d];return _0x32d927;};'use strict';var _=require('lodash');var util=require(_0x544b('0x0'));var moment=require(_0x544b('0x1'));var BPromise=require(_0x544b('0x2'));var rs=require(_0x544b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x544b('0x4'));var logger=require('../../config/logger')(_0x544b('0x5'));var config=require(_0x544b('0x6'));var jayson=require(_0x544b('0x7'));var client=jayson['client'][_0x544b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x384cb7,_0x3143df,_0x38a2c9){return new BPromise(function(_0x5425dc,_0x558d88){return client[_0x544b('0x9')](_0x384cb7,_0x38a2c9)[_0x544b('0xa')](function(_0x2f4c6d){logger[_0x544b('0xb')](_0x544b('0xc'),_0x3143df,_0x544b('0xd'));logger[_0x544b('0xe')](_0x544b('0xf'),_0x3143df,_0x544b('0xd'),JSON['stringify'](_0x2f4c6d));if(_0x2f4c6d[_0x544b('0x10')]){if(_0x2f4c6d['error'][_0x544b('0x11')]===0x1f4){logger[_0x544b('0x10')](_0x544b('0xc'),_0x3143df,_0x2f4c6d['error'][_0x544b('0x12')]);return _0x558d88(_0x2f4c6d[_0x544b('0x10')]['message']);}logger[_0x544b('0x10')](_0x544b('0xc'),_0x3143df,_0x2f4c6d[_0x544b('0x10')][_0x544b('0x12')]);return _0x5425dc(_0x2f4c6d[_0x544b('0x10')][_0x544b('0x12')]);}else{logger[_0x544b('0xb')](_0x544b('0xc'),_0x3143df,_0x544b('0xd'));_0x5425dc(_0x2f4c6d[_0x544b('0x13')][_0x544b('0x12')]);}})[_0x544b('0x14')](function(_0x3920b2){logger[_0x544b('0x10')](_0x544b('0xc'),_0x3143df,_0x3920b2);_0x558d88(_0x3920b2);});});}exports[_0x544b('0x15')]=function(_0x74eb00){var _0x2bca9a=this;return new Promise(function(_0x13a6c6,_0x575f3e){return db['VtigerAccount'][_0x544b('0x16')]({'raw':_0x74eb00[_0x544b('0x17')]?_0x74eb00[_0x544b('0x17')][_0x544b('0x18')]===undefined?!![]:![]:!![],'where':_0x74eb00['options']?_0x74eb00[_0x544b('0x17')][_0x544b('0x19')]||null:null,'attributes':_0x74eb00[_0x544b('0x17')]?_0x74eb00[_0x544b('0x17')][_0x544b('0x1a')]||null:null,'limit':_0x74eb00[_0x544b('0x17')]?_0x74eb00[_0x544b('0x17')][_0x544b('0x1b')]||null:null,'include':_0x74eb00[_0x544b('0x17')]?_0x74eb00[_0x544b('0x17')][_0x544b('0x1c')]?_[_0x544b('0x1d')](_0x74eb00[_0x544b('0x17')]['include'],function(_0x39a275){return{'model':db[_0x39a275[_0x544b('0x1e')]],'as':_0x39a275['as'],'attributes':_0x39a275[_0x544b('0x1a')],'include':_0x39a275['include']?_[_0x544b('0x1d')](_0x39a275[_0x544b('0x1c')],function(_0x337ce0){return{'model':db[_0x337ce0['model']],'as':_0x337ce0['as'],'attributes':_0x337ce0['attributes'],'include':_0x337ce0[_0x544b('0x1c')]?_['map'](_0x337ce0[_0x544b('0x1c')],function(_0x2354c5){return{'model':db[_0x2354c5[_0x544b('0x1e')]],'as':_0x2354c5['as'],'attributes':_0x2354c5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e2a56){logger[_0x544b('0xb')]('GetVtigerAccount',_0x74eb00);logger[_0x544b('0xe')](_0x544b('0x15'),_0x74eb00,JSON['stringify'](_0x3e2a56));_0x13a6c6(_0x3e2a56);})[_0x544b('0x14')](function(_0x1ae3d8){logger[_0x544b('0x10')](_0x544b('0x15'),_0x1ae3d8[_0x544b('0x12')],_0x74eb00);_0x575f3e(_0x2bca9a[_0x544b('0x10')](0x1f4,_0x1ae3d8[_0x544b('0x12')]));});});};exports[_0x544b('0x1f')]=function(_0x8dd2c7){var _0x3a0b6e=this;return new Promise(function(_0x171206,_0x114d01){return db['VtigerAccount'][_0x544b('0x20')]({'raw':_0x8dd2c7[_0x544b('0x17')]?_0x8dd2c7[_0x544b('0x17')][_0x544b('0x18')]===undefined?!![]:![]:!![],'where':_0x8dd2c7['options']?_0x8dd2c7[_0x544b('0x17')][_0x544b('0x19')]||null:null,'attributes':_0x8dd2c7['options']?_0x8dd2c7['options'][_0x544b('0x1a')]||null:null,'include':_0x8dd2c7[_0x544b('0x17')]?_0x8dd2c7[_0x544b('0x17')]['include']?_[_0x544b('0x1d')](_0x8dd2c7[_0x544b('0x17')][_0x544b('0x1c')],function(_0x34f490){return{'model':db[_0x34f490['model']],'as':_0x34f490['as'],'attributes':_0x34f490[_0x544b('0x1a')],'include':_0x34f490[_0x544b('0x1c')]?_['map'](_0x34f490[_0x544b('0x1c')],function(_0x42dfa2){return{'model':db[_0x42dfa2[_0x544b('0x1e')]],'as':_0x42dfa2['as'],'attributes':_0x42dfa2[_0x544b('0x1a')],'include':_0x42dfa2[_0x544b('0x1c')]?_[_0x544b('0x1d')](_0x42dfa2[_0x544b('0x1c')],function(_0x4e8204){return{'model':db[_0x4e8204['model']],'as':_0x4e8204['as'],'attributes':_0x4e8204[_0x544b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c8b19){logger[_0x544b('0xb')](_0x544b('0x1f'),_0x8dd2c7);logger[_0x544b('0xe')](_0x544b('0x1f'),_0x8dd2c7,JSON[_0x544b('0x21')](_0x3c8b19));_0x171206(_0x3c8b19);})[_0x544b('0x14')](function(_0x658169){logger[_0x544b('0x10')](_0x544b('0x1f'),_0x658169['message'],_0x8dd2c7);_0x114d01(_0x3a0b6e[_0x544b('0x10')](0x1f4,_0x658169[_0x544b('0x12')]));});});}; \ No newline at end of file +var _0x588c=['stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','find','ShowVtigerAccount','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x4ed491,_0x1a33f0){var _0x1958d6=function(_0x517157){while(--_0x517157){_0x4ed491['push'](_0x4ed491['shift']());}};_0x1958d6(++_0x1a33f0);}(_0x588c,0x12b));var _0xc588=function(_0x2e3e06,_0x1c5c9d){_0x2e3e06=_0x2e3e06-0x0;var _0x364142=_0x588c[_0x2e3e06];return _0x364142;};'use strict';var _=require(_0xc588('0x0'));var util=require(_0xc588('0x1'));var moment=require('moment');var BPromise=require(_0xc588('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc588('0x3'));var db=require(_0xc588('0x4'))['db'];var utils=require(_0xc588('0x5'));var logger=require(_0xc588('0x6'))(_0xc588('0x7'));var config=require(_0xc588('0x8'));var jayson=require(_0xc588('0x9'));var client=jayson[_0xc588('0xa')][_0xc588('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ceaab,_0x176fc4,_0x62d3be){return new BPromise(function(_0x59b92e,_0x19a2e7){return client['request'](_0x4ceaab,_0x62d3be)['then'](function(_0x20cff4){logger[_0xc588('0xc')](_0xc588('0xd'),_0x176fc4,_0xc588('0xe'));logger['debug'](_0xc588('0xf'),_0x176fc4,_0xc588('0xe'),JSON[_0xc588('0x10')](_0x20cff4));if(_0x20cff4[_0xc588('0x11')]){if(_0x20cff4[_0xc588('0x11')]['code']===0x1f4){logger[_0xc588('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x176fc4,_0x20cff4[_0xc588('0x11')][_0xc588('0x12')]);return _0x19a2e7(_0x20cff4['error'][_0xc588('0x12')]);}logger[_0xc588('0x11')](_0xc588('0xd'),_0x176fc4,_0x20cff4[_0xc588('0x11')][_0xc588('0x12')]);return _0x59b92e(_0x20cff4[_0xc588('0x11')][_0xc588('0x12')]);}else{logger[_0xc588('0xc')](_0xc588('0xd'),_0x176fc4,_0xc588('0xe'));_0x59b92e(_0x20cff4[_0xc588('0x13')][_0xc588('0x12')]);}})[_0xc588('0x14')](function(_0x6c9a1d){logger[_0xc588('0x11')](_0xc588('0xd'),_0x176fc4,_0x6c9a1d);_0x19a2e7(_0x6c9a1d);});});}exports[_0xc588('0x15')]=function(_0x4c7825){var _0x2f6cde=this;return new Promise(function(_0x5f579c,_0x6449ba){return db[_0xc588('0x16')][_0xc588('0x17')]({'raw':_0x4c7825[_0xc588('0x18')]?_0x4c7825['options'][_0xc588('0x19')]===undefined?!![]:![]:!![],'where':_0x4c7825[_0xc588('0x18')]?_0x4c7825[_0xc588('0x18')][_0xc588('0x1a')]||null:null,'attributes':_0x4c7825[_0xc588('0x18')]?_0x4c7825[_0xc588('0x18')][_0xc588('0x1b')]||null:null,'limit':_0x4c7825[_0xc588('0x18')]?_0x4c7825[_0xc588('0x18')][_0xc588('0x1c')]||null:null,'include':_0x4c7825['options']?_0x4c7825[_0xc588('0x18')]['include']?_[_0xc588('0x1d')](_0x4c7825[_0xc588('0x18')][_0xc588('0x1e')],function(_0x2d1060){return{'model':db[_0x2d1060[_0xc588('0x1f')]],'as':_0x2d1060['as'],'attributes':_0x2d1060[_0xc588('0x1b')],'include':_0x2d1060[_0xc588('0x1e')]?_[_0xc588('0x1d')](_0x2d1060[_0xc588('0x1e')],function(_0x53e55a){return{'model':db[_0x53e55a[_0xc588('0x1f')]],'as':_0x53e55a['as'],'attributes':_0x53e55a[_0xc588('0x1b')],'include':_0x53e55a[_0xc588('0x1e')]?_[_0xc588('0x1d')](_0x53e55a['include'],function(_0x4b02d2){return{'model':db[_0x4b02d2[_0xc588('0x1f')]],'as':_0x4b02d2['as'],'attributes':_0x4b02d2[_0xc588('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f1406){logger[_0xc588('0xc')]('GetVtigerAccount',_0x4c7825);logger[_0xc588('0x20')](_0xc588('0x15'),_0x4c7825,JSON[_0xc588('0x10')](_0x2f1406));_0x5f579c(_0x2f1406);})[_0xc588('0x14')](function(_0x33e7ae){logger[_0xc588('0x11')]('GetVtigerAccount',_0x33e7ae[_0xc588('0x12')],_0x4c7825);_0x6449ba(_0x2f6cde[_0xc588('0x11')](0x1f4,_0x33e7ae[_0xc588('0x12')]));});});};exports['ShowVtigerAccount']=function(_0xf6f1ad){var _0x5c791c=this;return new Promise(function(_0x41a253,_0xcf011a){return db[_0xc588('0x16')][_0xc588('0x21')]({'raw':_0xf6f1ad[_0xc588('0x18')]?_0xf6f1ad['options']['raw']===undefined?!![]:![]:!![],'where':_0xf6f1ad['options']?_0xf6f1ad[_0xc588('0x18')][_0xc588('0x1a')]||null:null,'attributes':_0xf6f1ad[_0xc588('0x18')]?_0xf6f1ad[_0xc588('0x18')][_0xc588('0x1b')]||null:null,'include':_0xf6f1ad['options']?_0xf6f1ad[_0xc588('0x18')][_0xc588('0x1e')]?_[_0xc588('0x1d')](_0xf6f1ad[_0xc588('0x18')][_0xc588('0x1e')],function(_0x4a159b){return{'model':db[_0x4a159b[_0xc588('0x1f')]],'as':_0x4a159b['as'],'attributes':_0x4a159b[_0xc588('0x1b')],'include':_0x4a159b[_0xc588('0x1e')]?_[_0xc588('0x1d')](_0x4a159b['include'],function(_0x1a6234){return{'model':db[_0x1a6234[_0xc588('0x1f')]],'as':_0x1a6234['as'],'attributes':_0x1a6234[_0xc588('0x1b')],'include':_0x1a6234[_0xc588('0x1e')]?_[_0xc588('0x1d')](_0x1a6234[_0xc588('0x1e')],function(_0x35a5cb){return{'model':db[_0x35a5cb[_0xc588('0x1f')]],'as':_0x35a5cb['as'],'attributes':_0x35a5cb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x52d2df){logger[_0xc588('0xc')]('ShowVtigerAccount',_0xf6f1ad);logger[_0xc588('0x20')]('ShowVtigerAccount',_0xf6f1ad,JSON[_0xc588('0x10')](_0x52d2df));_0x41a253(_0x52d2df);})[_0xc588('0x14')](function(_0x4d398e){logger['error'](_0xc588('0x22'),_0x4d398e[_0xc588('0x12')],_0xf6f1ad);_0xcf011a(_0x5c791c[_0xc588('0x11')](0x1f4,_0x4d398e[_0xc588('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 580548d..80938fe 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 _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x441ed5,_0x1b0b1b){var _0x3bde1f=function(_0x1b4072){while(--_0x1b4072){_0x441ed5['push'](_0x441ed5['shift']());}};_0x3bde1f(++_0x1b0b1b);}(_0xb10b,0x12a));var _0xbb10=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xb10b[_0x264545];return _0x114d10;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x2b48d7,_0x539cca){var _0x5471ec=function(_0x6bbab6){while(--_0x6bbab6){_0x2b48d7['push'](_0x2b48d7['shift']());}};_0x5471ec(++_0x539cca);}(_0xb10b,0x12a));var _0xbb10=function(_0x6978c0,_0x1f6765){_0x6978c0=_0x6978c0-0x0;var _0x361377=_0xb10b[_0x6978c0];return _0x361377;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index e69e835..a397a51 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 _0x99b7=['STRING','sequelize','exports'];(function(_0x1110b1,_0x5995fc){var _0x75e1fc=function(_0x2d177c){while(--_0x2d177c){_0x1110b1['push'](_0x1110b1['shift']());}};_0x75e1fc(++_0x5995fc);}(_0x99b7,0x1ba));var _0x799b=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x99b7[_0x19b3f9];return _0x18c3f6;};'use strict';var Sequelize=require(_0x799b('0x0'));module[_0x799b('0x1')]={'name':{'type':Sequelize[_0x799b('0x2')]},'description':{'type':Sequelize[_0x799b('0x2')]}}; \ No newline at end of file +var _0xaf3f=['sequelize','exports','STRING'];(function(_0x25410c,_0x57f2ea){var _0x31ed4=function(_0x193376){while(--_0x193376){_0x25410c['push'](_0x25410c['shift']());}};_0x31ed4(++_0x57f2ea);}(_0xaf3f,0x72));var _0xfaf3=function(_0x135e12,_0x5a0594){_0x135e12=_0x135e12-0x0;var _0x311156=_0xaf3f[_0x135e12];return _0x311156;};'use strict';var Sequelize=require(_0xfaf3('0x0'));module[_0xfaf3('0x1')]={'name':{'type':Sequelize[_0xfaf3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3bb7e47..c3021bc 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 _0x8dfc=['reject','save','update','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','keys','find','create','body','params','getFields','VtigerField','hasOwnProperty','getSubjects','findOne','pick','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','client','http','request','then','info','request\x20sent','debug','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','set'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x8dfc,0xdf));var _0xc8df=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x8dfc[_0x383356];return _0x32ee5a;};'use strict';var pdf=require(_0xc8df('0x0'));var emlformat=require(_0xc8df('0x1'));var rimraf=require(_0xc8df('0x2'));var zipdir=require(_0xc8df('0x3'));var jsonpatch=require(_0xc8df('0x4'));var rp=require(_0xc8df('0x5'));var moment=require(_0xc8df('0x6'));var BPromise=require(_0xc8df('0x7'));var Mustache=require(_0xc8df('0x8'));var util=require('util');var path=require(_0xc8df('0x9'));var sox=require(_0xc8df('0xa'));var csv=require('to-csv');var ejs=require(_0xc8df('0xb'));var fs=require('fs');var _=require(_0xc8df('0xc'));var squel=require(_0xc8df('0xd'));var crypto=require(_0xc8df('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc8df('0xf'));var toCsv=require(_0xc8df('0x10'));var querystring=require(_0xc8df('0x11'));var Papa=require(_0xc8df('0x12'));var Redis=require(_0xc8df('0x13'));var authService=require(_0xc8df('0x14'));var qs=require(_0xc8df('0x15'));var as=require(_0xc8df('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc8df('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc8df('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xc8df('0x19')][_0xc8df('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4d4480,_0x523b79,_0x383613,_0x52a088){return new BPromise(function(_0x1dc853,_0x11668b){var _0x3e1b84=_0x52a088||client;return _0x3e1b84[_0xc8df('0x1b')](_0x4d4480,_0x383613)[_0xc8df('0x1c')](function(_0x29e02d){logger[_0xc8df('0x1d')]('VtigerConfiguration,\x20%s,\x20%s',_0x523b79,_0xc8df('0x1e'));logger[_0xc8df('0x1f')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x523b79,_0xc8df('0x1e'),JSON[_0xc8df('0x20')](_0x29e02d));if(_0x29e02d[_0xc8df('0x21')]){if(_0x29e02d['error']['code']===0x1f4){logger['error'](_0xc8df('0x22'),_0x523b79,_0x29e02d['error'][_0xc8df('0x23')]);return _0x11668b(_0x29e02d[_0xc8df('0x21')][_0xc8df('0x23')]);}logger['error'](_0xc8df('0x22'),_0x523b79,_0x29e02d[_0xc8df('0x21')][_0xc8df('0x23')]);return _0x1dc853(_0x29e02d['error'][_0xc8df('0x23')]);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x523b79,_0xc8df('0x1e'));_0x1dc853(_0x29e02d['result'][_0xc8df('0x23')]);}})[_0xc8df('0x24')](function(_0x284782){logger[_0xc8df('0x21')](_0xc8df('0x22'),_0x523b79,_0x284782);_0x11668b(_0x284782);});});}function respondWithStatusCode(_0xdb4816,_0x3336af){_0x3336af=_0x3336af||0xcc;return function(_0x603c89){if(_0x603c89){return _0xdb4816[_0xc8df('0x25')](_0x3336af);}return _0xdb4816[_0xc8df('0x26')](_0x3336af)[_0xc8df('0x27')]();};}function respondWithResult(_0x49b479,_0x23a657){_0x23a657=_0x23a657||0xc8;return function(_0x52ada9){if(_0x52ada9){return _0x49b479[_0xc8df('0x26')](_0x23a657)[_0xc8df('0x28')](_0x52ada9);}};}function respondWithFilteredResult(_0x996315,_0x4896b7){return function(_0x4d693b){if(_0x4d693b){var _0x6ba712=_0x4d693b['count'],_0x22f1b6=_0x4896b7[_0xc8df('0x29')],_0x1ccd00=_0x4896b7[_0xc8df('0x29')]+_0x4896b7[_0xc8df('0x2a')],_0x4492fd;if(_0x1ccd00>=_0x6ba712){_0x1ccd00=_0x6ba712;_0x4492fd=0xc8;}else{_0x4492fd=0xce;}_0x996315['status'](_0x4492fd);return _0x996315[_0xc8df('0x2b')]('Content-Range',_0x22f1b6+'-'+_0x1ccd00+'/'+_0x6ba712)['json'](_0x4d693b);}return null;};}function patchUpdates(_0x50449e){return function(_0x2d5cc7){try{jsonpatch['apply'](_0x2d5cc7,_0x50449e,!![]);}catch(_0x28ba5a){return BPromise[_0xc8df('0x2c')](_0x28ba5a);}return _0x2d5cc7[_0xc8df('0x2d')]();};}function saveUpdates(_0x43eb55,_0x1e5438){return function(_0x57d1df){if(_0x57d1df){return _0x57d1df[_0xc8df('0x2e')](_0x43eb55)['then'](function(_0x5f1a87){return _0x5f1a87;});}return null;};}function removeEntity(_0x599ee5,_0x2e71e5){return function(_0x50ac2d){if(_0x50ac2d){return _0x50ac2d[_0xc8df('0x2f')]()[_0xc8df('0x1c')](function(){_0x599ee5[_0xc8df('0x26')](0xcc)[_0xc8df('0x27')]();});}};}function handleEntityNotFound(_0x2a43b1,_0x3e6698){return function(_0x18ec7f){if(!_0x18ec7f){_0x2a43b1[_0xc8df('0x25')](0x194);}return _0x18ec7f;};}function handleError(_0x493c1d,_0x324aa6){_0x324aa6=_0x324aa6||0x1f4;return function(_0x3ca7ba){logger[_0xc8df('0x21')](_0x3ca7ba[_0xc8df('0x30')]);if(_0x3ca7ba[_0xc8df('0x31')]){delete _0x3ca7ba[_0xc8df('0x31')];}_0x493c1d[_0xc8df('0x26')](_0x324aa6)[_0xc8df('0x32')](_0x3ca7ba);};}exports[_0xc8df('0x33')]=function(_0xb437cf,_0x3ff483){var _0x4fe14f={},_0x554f18={},_0x59f84b={'count':0x0,'rows':[]};var _0x53c7c0=_[_0xc8df('0x34')](db[_0xc8df('0x35')][_0xc8df('0x36')],function(_0x48cf5b){return{'name':_0x48cf5b[_0xc8df('0x37')],'type':_0x48cf5b[_0xc8df('0x38')]['key']};});_0x554f18['model']=_[_0xc8df('0x34')](_0x53c7c0,'name');_0x554f18['query']=_['keys'](_0xb437cf[_0xc8df('0x39')]);_0x554f18[_0xc8df('0x3a')]=_[_0xc8df('0x3b')](_0x554f18[_0xc8df('0x3c')],_0x554f18[_0xc8df('0x39')]);_0x4fe14f[_0xc8df('0x3d')]=_['intersection'](_0x554f18[_0xc8df('0x3c')],qs[_0xc8df('0x3e')](_0xb437cf[_0xc8df('0x39')][_0xc8df('0x3e')]));_0x4fe14f[_0xc8df('0x3d')]=_0x4fe14f[_0xc8df('0x3d')][_0xc8df('0x3f')]?_0x4fe14f[_0xc8df('0x3d')]:_0x554f18[_0xc8df('0x3c')];if(!_0xb437cf['query']['hasOwnProperty'](_0xc8df('0x40'))){_0x4fe14f[_0xc8df('0x2a')]=qs[_0xc8df('0x2a')](_0xb437cf[_0xc8df('0x39')][_0xc8df('0x2a')]);_0x4fe14f[_0xc8df('0x29')]=qs[_0xc8df('0x29')](_0xb437cf['query'][_0xc8df('0x29')]);}_0x4fe14f[_0xc8df('0x41')]=qs[_0xc8df('0x42')](_0xb437cf['query'][_0xc8df('0x42')]);_0x4fe14f[_0xc8df('0x43')]=qs[_0xc8df('0x3a')](_['pick'](_0xb437cf[_0xc8df('0x39')],_0x554f18['filters']),_0x53c7c0);if(_0xb437cf['query'][_0xc8df('0x44')]){_0x4fe14f[_0xc8df('0x43')]=_['merge'](_0x4fe14f[_0xc8df('0x43')],{'$or':_[_0xc8df('0x34')](_0x53c7c0,function(_0x37819d){if(_0x37819d['type']!==_0xc8df('0x45')){var _0x3206de={};_0x3206de[_0x37819d['name']]={'$like':'%'+_0xb437cf[_0xc8df('0x39')][_0xc8df('0x44')]+'%'};return _0x3206de;}})});}_0x4fe14f=_[_0xc8df('0x46')]({},_0x4fe14f,_0xb437cf[_0xc8df('0x47')]);var _0x19d3e2={'where':_0x4fe14f[_0xc8df('0x43')]};return db[_0xc8df('0x35')][_0xc8df('0x48')](_0x19d3e2)['then'](function(_0x559aec){_0x59f84b['count']=_0x559aec;if(_0xb437cf[_0xc8df('0x39')][_0xc8df('0x49')]){_0x4fe14f[_0xc8df('0x4a')]=[{'all':!![]}];}return db[_0xc8df('0x35')][_0xc8df('0x4b')](_0x4fe14f);})['then'](function(_0x1a140c){_0x59f84b[_0xc8df('0x4c')]=_0x1a140c;return _0x59f84b;})[_0xc8df('0x1c')](respondWithFilteredResult(_0x3ff483,_0x4fe14f))[_0xc8df('0x24')](handleError(_0x3ff483,null));};exports['show']=function(_0x54ce21,_0x4024e7){var _0x44accc={'raw':![],'where':{'id':_0x54ce21['params']['id']}},_0x12640f={};_0x12640f[_0xc8df('0x3c')]=_[_0xc8df('0x4d')](db[_0xc8df('0x35')]['rawAttributes']);_0x12640f[_0xc8df('0x39')]=_['keys'](_0x54ce21[_0xc8df('0x39')]);_0x12640f[_0xc8df('0x3a')]=_[_0xc8df('0x3b')](_0x12640f['model'],_0x12640f[_0xc8df('0x39')]);_0x44accc['attributes']=_['intersection'](_0x12640f[_0xc8df('0x3c')],qs['fields'](_0x54ce21['query'][_0xc8df('0x3e')]));_0x44accc[_0xc8df('0x3d')]=_0x44accc[_0xc8df('0x3d')][_0xc8df('0x3f')]?_0x44accc[_0xc8df('0x3d')]:_0x12640f[_0xc8df('0x3c')];if(_0x54ce21['query']['includeAll']){_0x44accc[_0xc8df('0x4a')]=[{'all':!![]}];}_0x44accc=_[_0xc8df('0x46')]({},_0x44accc,_0x54ce21[_0xc8df('0x47')]);return db[_0xc8df('0x35')][_0xc8df('0x4e')](_0x44accc)[_0xc8df('0x1c')](handleEntityNotFound(_0x4024e7,null))[_0xc8df('0x1c')](respondWithResult(_0x4024e7,null))[_0xc8df('0x24')](handleError(_0x4024e7,null));};exports['create']=function(_0x498a6d,_0x21b532){return db[_0xc8df('0x35')][_0xc8df('0x4f')](_0x498a6d[_0xc8df('0x50')],{})[_0xc8df('0x1c')](respondWithResult(_0x21b532,0xc9))[_0xc8df('0x24')](handleError(_0x21b532,null));};exports[_0xc8df('0x2e')]=function(_0x58dabc,_0x251f8b){if(_0x58dabc['body']['id']){delete _0x58dabc[_0xc8df('0x50')]['id'];}return db[_0xc8df('0x35')]['find']({'where':{'id':_0x58dabc[_0xc8df('0x51')]['id']}})[_0xc8df('0x1c')](handleEntityNotFound(_0x251f8b,null))[_0xc8df('0x1c')](saveUpdates(_0x58dabc['body'],null))[_0xc8df('0x1c')](respondWithResult(_0x251f8b,null))[_0xc8df('0x24')](handleError(_0x251f8b,null));};exports[_0xc8df('0x2f')]=function(_0x3bec11,_0x9db249){return db['VtigerConfiguration'][_0xc8df('0x4e')]({'where':{'id':_0x3bec11['params']['id']}})[_0xc8df('0x1c')](handleEntityNotFound(_0x9db249,null))[_0xc8df('0x1c')](removeEntity(_0x9db249,null))[_0xc8df('0x24')](handleError(_0x9db249,null));};exports[_0xc8df('0x52')]=function(_0xa22921,_0x99598c,_0x1086d0){var _0x5dda32={};var _0x1fcac4={};var _0x551652;var _0x103ea0;return db[_0xc8df('0x35')]['findOne']({'where':{'id':_0xa22921[_0xc8df('0x51')]['id']}})[_0xc8df('0x1c')](handleEntityNotFound(_0x99598c,null))[_0xc8df('0x1c')](function(_0x53627a){if(_0x53627a){_0x551652=_0x53627a;_0x1fcac4[_0xc8df('0x3c')]=_[_0xc8df('0x4d')](db[_0xc8df('0x53')][_0xc8df('0x36')]);_0x1fcac4['query']=_[_0xc8df('0x4d')](_0xa22921['query']);_0x1fcac4[_0xc8df('0x3a')]=_['intersection'](_0x1fcac4[_0xc8df('0x3c')],_0x1fcac4['query']);_0x5dda32[_0xc8df('0x3d')]=_[_0xc8df('0x3b')](_0x1fcac4[_0xc8df('0x3c')],qs[_0xc8df('0x3e')](_0xa22921['query'][_0xc8df('0x3e')]));_0x5dda32[_0xc8df('0x3d')]=_0x5dda32['attributes']['length']?_0x5dda32[_0xc8df('0x3d')]:_0x1fcac4['model'];_0x5dda32[_0xc8df('0x41')]=qs['sort'](_0xa22921['query'][_0xc8df('0x42')]);_0x5dda32[_0xc8df('0x43')]=qs[_0xc8df('0x3a')](_['pick'](_0xa22921[_0xc8df('0x39')],_0x1fcac4[_0xc8df('0x3a')]));if(_0xa22921[_0xc8df('0x39')]['filter']){_0x5dda32['where']=_['merge'](_0x5dda32[_0xc8df('0x43')],{'$or':_['map'](_0x5dda32['attributes'],function(_0x4e6974){var _0x5cadcb={};_0x5cadcb[_0x4e6974]={'$like':'%'+_0xa22921[_0xc8df('0x39')]['filter']+'%'};return _0x5cadcb;})});}_0x5dda32=_[_0xc8df('0x46')]({},_0x5dda32,_0xa22921[_0xc8df('0x47')]);return _0x551652[_0xc8df('0x52')](_0x5dda32);}})[_0xc8df('0x1c')](function(_0xd7fc2e){if(_0xd7fc2e){_0x103ea0=_0xd7fc2e[_0xc8df('0x3f')];if(!_0xa22921['query'][_0xc8df('0x54')](_0xc8df('0x40'))){_0x5dda32['limit']=qs['limit'](_0xa22921[_0xc8df('0x39')][_0xc8df('0x2a')]);_0x5dda32[_0xc8df('0x29')]=qs['offset'](_0xa22921[_0xc8df('0x39')]['offset']);}return _0x551652[_0xc8df('0x52')](_0x5dda32);}})[_0xc8df('0x1c')](function(_0x10808d){if(_0x10808d){return _0x10808d?{'count':_0x103ea0,'rows':_0x10808d}:null;}})['then'](respondWithResult(_0x99598c,null))[_0xc8df('0x24')](handleError(_0x99598c,null));};exports[_0xc8df('0x55')]=function(_0x3b020c,_0x346f26,_0x532471){var _0x172e99={};var _0x11cbd5={};var _0x24da66;var _0x17b394;return db[_0xc8df('0x35')][_0xc8df('0x56')]({'where':{'id':_0x3b020c[_0xc8df('0x51')]['id']}})['then'](handleEntityNotFound(_0x346f26,null))[_0xc8df('0x1c')](function(_0x1b1994){if(_0x1b1994){_0x24da66=_0x1b1994;_0x11cbd5['model']=_[_0xc8df('0x4d')](db[_0xc8df('0x53')]['rawAttributes']);_0x11cbd5[_0xc8df('0x39')]=_['keys'](_0x3b020c[_0xc8df('0x39')]);_0x11cbd5[_0xc8df('0x3a')]=_[_0xc8df('0x3b')](_0x11cbd5['model'],_0x11cbd5[_0xc8df('0x39')]);_0x172e99['attributes']=_[_0xc8df('0x3b')](_0x11cbd5[_0xc8df('0x3c')],qs['fields'](_0x3b020c[_0xc8df('0x39')][_0xc8df('0x3e')]));_0x172e99['attributes']=_0x172e99[_0xc8df('0x3d')]['length']?_0x172e99['attributes']:_0x11cbd5['model'];_0x172e99['order']=qs[_0xc8df('0x42')](_0x3b020c[_0xc8df('0x39')]['sort']);_0x172e99[_0xc8df('0x43')]=qs[_0xc8df('0x3a')](_[_0xc8df('0x57')](_0x3b020c['query'],_0x11cbd5[_0xc8df('0x3a')]));if(_0x3b020c[_0xc8df('0x39')][_0xc8df('0x44')]){_0x172e99[_0xc8df('0x43')]=_[_0xc8df('0x46')](_0x172e99[_0xc8df('0x43')],{'$or':_['map'](_0x172e99[_0xc8df('0x3d')],function(_0x2e9502){var _0x141b80={};_0x141b80[_0x2e9502]={'$like':'%'+_0x3b020c['query'][_0xc8df('0x44')]+'%'};return _0x141b80;})});}_0x172e99=_[_0xc8df('0x46')]({},_0x172e99,_0x3b020c['options']);return _0x24da66['getSubjects'](_0x172e99);}})[_0xc8df('0x1c')](function(_0xf2a208){if(_0xf2a208){_0x17b394=_0xf2a208[_0xc8df('0x3f')];if(!_0x3b020c[_0xc8df('0x39')]['hasOwnProperty'](_0xc8df('0x40'))){_0x172e99['limit']=qs[_0xc8df('0x2a')](_0x3b020c[_0xc8df('0x39')][_0xc8df('0x2a')]);_0x172e99[_0xc8df('0x29')]=qs[_0xc8df('0x29')](_0x3b020c[_0xc8df('0x39')][_0xc8df('0x29')]);}return _0x24da66[_0xc8df('0x55')](_0x172e99);}})[_0xc8df('0x1c')](function(_0x4f11b0){if(_0x4f11b0){return _0x4f11b0?{'count':_0x17b394,'rows':_0x4f11b0}:null;}})[_0xc8df('0x1c')](respondWithResult(_0x346f26,null))['catch'](handleError(_0x346f26,null));};exports[_0xc8df('0x58')]=function(_0x2609ab,_0x471a2f,_0x149cdc){var _0x1f03c1={};var _0x1e6ab7={};var _0x5672d0;var _0x28dfa2;return db[_0xc8df('0x35')]['findOne']({'where':{'id':_0x2609ab[_0xc8df('0x51')]['id']}})[_0xc8df('0x1c')](handleEntityNotFound(_0x471a2f,null))[_0xc8df('0x1c')](function(_0x8e001d){if(_0x8e001d){_0x5672d0=_0x8e001d;_0x1e6ab7['model']=_[_0xc8df('0x4d')](db[_0xc8df('0x53')][_0xc8df('0x36')]);_0x1e6ab7[_0xc8df('0x39')]=_[_0xc8df('0x4d')](_0x2609ab[_0xc8df('0x39')]);_0x1e6ab7[_0xc8df('0x3a')]=_['intersection'](_0x1e6ab7['model'],_0x1e6ab7['query']);_0x1f03c1[_0xc8df('0x3d')]=_['intersection'](_0x1e6ab7[_0xc8df('0x3c')],qs[_0xc8df('0x3e')](_0x2609ab[_0xc8df('0x39')][_0xc8df('0x3e')]));_0x1f03c1[_0xc8df('0x3d')]=_0x1f03c1[_0xc8df('0x3d')][_0xc8df('0x3f')]?_0x1f03c1['attributes']:_0x1e6ab7[_0xc8df('0x3c')];_0x1f03c1[_0xc8df('0x41')]=qs[_0xc8df('0x42')](_0x2609ab[_0xc8df('0x39')][_0xc8df('0x42')]);_0x1f03c1[_0xc8df('0x43')]=qs[_0xc8df('0x3a')](_[_0xc8df('0x57')](_0x2609ab[_0xc8df('0x39')],_0x1e6ab7['filters']));if(_0x2609ab[_0xc8df('0x39')]['filter']){_0x1f03c1[_0xc8df('0x43')]=_['merge'](_0x1f03c1[_0xc8df('0x43')],{'$or':_['map'](_0x1f03c1['attributes'],function(_0x467c3b){var _0x4ac382={};_0x4ac382[_0x467c3b]={'$like':'%'+_0x2609ab['query'][_0xc8df('0x44')]+'%'};return _0x4ac382;})});}_0x1f03c1=_[_0xc8df('0x46')]({},_0x1f03c1,_0x2609ab[_0xc8df('0x47')]);return _0x5672d0[_0xc8df('0x58')](_0x1f03c1);}})[_0xc8df('0x1c')](function(_0x13ffe4){if(_0x13ffe4){_0x28dfa2=_0x13ffe4[_0xc8df('0x3f')];if(!_0x2609ab[_0xc8df('0x39')]['hasOwnProperty'](_0xc8df('0x40'))){_0x1f03c1['limit']=qs['limit'](_0x2609ab[_0xc8df('0x39')][_0xc8df('0x2a')]);_0x1f03c1[_0xc8df('0x29')]=qs[_0xc8df('0x29')](_0x2609ab['query'][_0xc8df('0x29')]);}return _0x5672d0['getDescriptions'](_0x1f03c1);}})[_0xc8df('0x1c')](function(_0x5e5889){if(_0x5e5889){return _0x5e5889?{'count':_0x28dfa2,'rows':_0x5e5889}:null;}})[_0xc8df('0x1c')](respondWithResult(_0x471a2f,null))[_0xc8df('0x24')](handleError(_0x471a2f,null));}; \ No newline at end of file +var _0xcafb=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','type','include','findAll','rows','params','includeAll','find','create','body','getFields','VtigerField','options','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x35a44b,_0x384502){var _0x25eb96=function(_0x4f8bc7){while(--_0x4f8bc7){_0x35a44b['push'](_0x35a44b['shift']());}};_0x25eb96(++_0x384502);}(_0xcafb,0x16c));var _0xbcaf=function(_0x179aa1,_0x5afc8b){_0x179aa1=_0x179aa1-0x0;var _0x2f3fd5=_0xcafb[_0x179aa1];return _0x2f3fd5;};'use strict';var pdf=require(_0xbcaf('0x0'));var emlformat=require(_0xbcaf('0x1'));var rimraf=require(_0xbcaf('0x2'));var zipdir=require(_0xbcaf('0x3'));var jsonpatch=require(_0xbcaf('0x4'));var rp=require(_0xbcaf('0x5'));var moment=require(_0xbcaf('0x6'));var BPromise=require(_0xbcaf('0x7'));var Mustache=require(_0xbcaf('0x8'));var util=require(_0xbcaf('0x9'));var path=require(_0xbcaf('0xa'));var sox=require(_0xbcaf('0xb'));var csv=require(_0xbcaf('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbcaf('0xd'));var crypto=require(_0xbcaf('0xe'));var jsforce=require(_0xbcaf('0xf'));var deskjs=require(_0xbcaf('0x10'));var toCsv=require(_0xbcaf('0xc'));var querystring=require(_0xbcaf('0x11'));var Papa=require(_0xbcaf('0x12'));var Redis=require(_0xbcaf('0x13'));var authService=require(_0xbcaf('0x14'));var qs=require(_0xbcaf('0x15'));var as=require(_0xbcaf('0x16'));var hardwareService=require(_0xbcaf('0x17'));var logger=require(_0xbcaf('0x18'))('api');var utils=require(_0xbcaf('0x19'));var config=require(_0xbcaf('0x1a'));var licenseUtil=require(_0xbcaf('0x1b'));var db=require(_0xbcaf('0x1c'))['db'];var jayson=require(_0xbcaf('0x1d'));var client=jayson[_0xbcaf('0x1e')][_0xbcaf('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x46e06f,_0x220bd5,_0xc93394,_0x5dd83c){return new BPromise(function(_0x14503a,_0x2df318){var _0x33d36f=_0x5dd83c||client;return _0x33d36f[_0xbcaf('0x20')](_0x46e06f,_0xc93394)[_0xbcaf('0x21')](function(_0x3a8ee8){logger['info'](_0xbcaf('0x22'),_0x220bd5,'request\x20sent');logger['debug'](_0xbcaf('0x23'),_0x220bd5,_0xbcaf('0x24'),JSON[_0xbcaf('0x25')](_0x3a8ee8));if(_0x3a8ee8[_0xbcaf('0x26')]){if(_0x3a8ee8[_0xbcaf('0x26')][_0xbcaf('0x27')]===0x1f4){logger[_0xbcaf('0x26')](_0xbcaf('0x22'),_0x220bd5,_0x3a8ee8[_0xbcaf('0x26')][_0xbcaf('0x28')]);return _0x2df318(_0x3a8ee8[_0xbcaf('0x26')][_0xbcaf('0x28')]);}logger['error'](_0xbcaf('0x22'),_0x220bd5,_0x3a8ee8[_0xbcaf('0x26')][_0xbcaf('0x28')]);return _0x14503a(_0x3a8ee8['error'][_0xbcaf('0x28')]);}else{logger[_0xbcaf('0x29')]('VtigerConfiguration,\x20%s,\x20%s',_0x220bd5,_0xbcaf('0x24'));_0x14503a(_0x3a8ee8[_0xbcaf('0x2a')]['message']);}})[_0xbcaf('0x2b')](function(_0x243d91){logger['error'](_0xbcaf('0x22'),_0x220bd5,_0x243d91);_0x2df318(_0x243d91);});});}function respondWithStatusCode(_0x4ec4f1,_0x1c6cbf){_0x1c6cbf=_0x1c6cbf||0xcc;return function(_0x4b550f){if(_0x4b550f){return _0x4ec4f1[_0xbcaf('0x2c')](_0x1c6cbf);}return _0x4ec4f1[_0xbcaf('0x2d')](_0x1c6cbf)['end']();};}function respondWithResult(_0x53b849,_0x56cd60){_0x56cd60=_0x56cd60||0xc8;return function(_0x5c784c){if(_0x5c784c){return _0x53b849[_0xbcaf('0x2d')](_0x56cd60)['json'](_0x5c784c);}};}function respondWithFilteredResult(_0x20fdcc,_0x13f72b){return function(_0x5bd0ce){if(_0x5bd0ce){var _0x1270df=_0x5bd0ce[_0xbcaf('0x2e')],_0x376c57=_0x13f72b['offset'],_0xb7e5a8=_0x13f72b['offset']+_0x13f72b[_0xbcaf('0x2f')],_0x5ad79b;if(_0xb7e5a8>=_0x1270df){_0xb7e5a8=_0x1270df;_0x5ad79b=0xc8;}else{_0x5ad79b=0xce;}_0x20fdcc['status'](_0x5ad79b);return _0x20fdcc[_0xbcaf('0x30')](_0xbcaf('0x31'),_0x376c57+'-'+_0xb7e5a8+'/'+_0x1270df)['json'](_0x5bd0ce);}return null;};}function patchUpdates(_0x363c9f){return function(_0x347f7b){try{jsonpatch[_0xbcaf('0x32')](_0x347f7b,_0x363c9f,!![]);}catch(_0x2b7599){return BPromise[_0xbcaf('0x33')](_0x2b7599);}return _0x347f7b[_0xbcaf('0x34')]();};}function saveUpdates(_0x54f972,_0x44c430){return function(_0x33fea5){if(_0x33fea5){return _0x33fea5[_0xbcaf('0x35')](_0x54f972)[_0xbcaf('0x21')](function(_0x246493){return _0x246493;});}return null;};}function removeEntity(_0x589e5f,_0x393f27){return function(_0x31aa5d){if(_0x31aa5d){return _0x31aa5d[_0xbcaf('0x36')]()[_0xbcaf('0x21')](function(){_0x589e5f[_0xbcaf('0x2d')](0xcc)[_0xbcaf('0x37')]();});}};}function handleEntityNotFound(_0x1a2c1b,_0x2ba0ec){return function(_0x2be527){if(!_0x2be527){_0x1a2c1b[_0xbcaf('0x2c')](0x194);}return _0x2be527;};}function handleError(_0x2905c3,_0x7f5eb9){_0x7f5eb9=_0x7f5eb9||0x1f4;return function(_0x11db82){logger['error'](_0x11db82[_0xbcaf('0x38')]);if(_0x11db82[_0xbcaf('0x39')]){delete _0x11db82['name'];}_0x2905c3['status'](_0x7f5eb9)[_0xbcaf('0x3a')](_0x11db82);};}exports['index']=function(_0x225a30,_0x561f61){var _0x318a17={},_0x320c09={},_0x55681d={'count':0x0,'rows':[]};var _0x138c11=_['map'](db[_0xbcaf('0x3b')][_0xbcaf('0x3c')],function(_0x1d9c8d){return{'name':_0x1d9c8d[_0xbcaf('0x3d')],'type':_0x1d9c8d['type'][_0xbcaf('0x3e')]};});_0x320c09[_0xbcaf('0x3f')]=_[_0xbcaf('0x40')](_0x138c11,'name');_0x320c09['query']=_[_0xbcaf('0x41')](_0x225a30[_0xbcaf('0x42')]);_0x320c09[_0xbcaf('0x43')]=_[_0xbcaf('0x44')](_0x320c09['model'],_0x320c09[_0xbcaf('0x42')]);_0x318a17[_0xbcaf('0x45')]=_['intersection'](_0x320c09[_0xbcaf('0x3f')],qs[_0xbcaf('0x46')](_0x225a30['query'][_0xbcaf('0x46')]));_0x318a17[_0xbcaf('0x45')]=_0x318a17['attributes'][_0xbcaf('0x47')]?_0x318a17[_0xbcaf('0x45')]:_0x320c09[_0xbcaf('0x3f')];if(!_0x225a30[_0xbcaf('0x42')][_0xbcaf('0x48')](_0xbcaf('0x49'))){_0x318a17[_0xbcaf('0x2f')]=qs[_0xbcaf('0x2f')](_0x225a30[_0xbcaf('0x42')][_0xbcaf('0x2f')]);_0x318a17[_0xbcaf('0x4a')]=qs[_0xbcaf('0x4a')](_0x225a30[_0xbcaf('0x42')][_0xbcaf('0x4a')]);}_0x318a17[_0xbcaf('0x4b')]=qs[_0xbcaf('0x4c')](_0x225a30[_0xbcaf('0x42')]['sort']);_0x318a17['where']=qs[_0xbcaf('0x43')](_[_0xbcaf('0x4d')](_0x225a30[_0xbcaf('0x42')],_0x320c09[_0xbcaf('0x43')]),_0x138c11);if(_0x225a30[_0xbcaf('0x42')][_0xbcaf('0x4e')]){_0x318a17[_0xbcaf('0x4f')]=_[_0xbcaf('0x50')](_0x318a17['where'],{'$or':_[_0xbcaf('0x40')](_0x138c11,function(_0x2d13ef){if(_0x2d13ef[_0xbcaf('0x51')]!=='VIRTUAL'){var _0x582faa={};_0x582faa[_0x2d13ef[_0xbcaf('0x39')]]={'$like':'%'+_0x225a30[_0xbcaf('0x42')]['filter']+'%'};return _0x582faa;}})});}_0x318a17=_[_0xbcaf('0x50')]({},_0x318a17,_0x225a30['options']);var _0x569d66={'where':_0x318a17[_0xbcaf('0x4f')]};return db['VtigerConfiguration'][_0xbcaf('0x2e')](_0x569d66)[_0xbcaf('0x21')](function(_0x18cc1b){_0x55681d[_0xbcaf('0x2e')]=_0x18cc1b;if(_0x225a30[_0xbcaf('0x42')]['includeAll']){_0x318a17[_0xbcaf('0x52')]=[{'all':!![]}];}return db[_0xbcaf('0x3b')][_0xbcaf('0x53')](_0x318a17);})[_0xbcaf('0x21')](function(_0x8fc01d){_0x55681d[_0xbcaf('0x54')]=_0x8fc01d;return _0x55681d;})[_0xbcaf('0x21')](respondWithFilteredResult(_0x561f61,_0x318a17))[_0xbcaf('0x2b')](handleError(_0x561f61,null));};exports['show']=function(_0x1f9987,_0x2def07){var _0x2387dd={'raw':![],'where':{'id':_0x1f9987[_0xbcaf('0x55')]['id']}},_0x4252a9={};_0x4252a9[_0xbcaf('0x3f')]=_[_0xbcaf('0x41')](db[_0xbcaf('0x3b')][_0xbcaf('0x3c')]);_0x4252a9[_0xbcaf('0x42')]=_[_0xbcaf('0x41')](_0x1f9987[_0xbcaf('0x42')]);_0x4252a9[_0xbcaf('0x43')]=_[_0xbcaf('0x44')](_0x4252a9['model'],_0x4252a9['query']);_0x2387dd[_0xbcaf('0x45')]=_[_0xbcaf('0x44')](_0x4252a9[_0xbcaf('0x3f')],qs[_0xbcaf('0x46')](_0x1f9987['query'][_0xbcaf('0x46')]));_0x2387dd[_0xbcaf('0x45')]=_0x2387dd[_0xbcaf('0x45')][_0xbcaf('0x47')]?_0x2387dd['attributes']:_0x4252a9[_0xbcaf('0x3f')];if(_0x1f9987[_0xbcaf('0x42')][_0xbcaf('0x56')]){_0x2387dd[_0xbcaf('0x52')]=[{'all':!![]}];}_0x2387dd=_[_0xbcaf('0x50')]({},_0x2387dd,_0x1f9987['options']);return db[_0xbcaf('0x3b')][_0xbcaf('0x57')](_0x2387dd)[_0xbcaf('0x21')](handleEntityNotFound(_0x2def07,null))[_0xbcaf('0x21')](respondWithResult(_0x2def07,null))[_0xbcaf('0x2b')](handleError(_0x2def07,null));};exports[_0xbcaf('0x58')]=function(_0x1242a6,_0x3b3515){return db['VtigerConfiguration'][_0xbcaf('0x58')](_0x1242a6[_0xbcaf('0x59')],{})[_0xbcaf('0x21')](respondWithResult(_0x3b3515,0xc9))[_0xbcaf('0x2b')](handleError(_0x3b3515,null));};exports[_0xbcaf('0x35')]=function(_0x1c9433,_0x4d3d21){if(_0x1c9433[_0xbcaf('0x59')]['id']){delete _0x1c9433[_0xbcaf('0x59')]['id'];}return db[_0xbcaf('0x3b')]['find']({'where':{'id':_0x1c9433[_0xbcaf('0x55')]['id']}})[_0xbcaf('0x21')](handleEntityNotFound(_0x4d3d21,null))['then'](saveUpdates(_0x1c9433[_0xbcaf('0x59')],null))[_0xbcaf('0x21')](respondWithResult(_0x4d3d21,null))[_0xbcaf('0x2b')](handleError(_0x4d3d21,null));};exports[_0xbcaf('0x36')]=function(_0xeff552,_0x1d2e85){return db[_0xbcaf('0x3b')][_0xbcaf('0x57')]({'where':{'id':_0xeff552['params']['id']}})[_0xbcaf('0x21')](handleEntityNotFound(_0x1d2e85,null))[_0xbcaf('0x21')](removeEntity(_0x1d2e85,null))[_0xbcaf('0x2b')](handleError(_0x1d2e85,null));};exports[_0xbcaf('0x5a')]=function(_0x52ff4e,_0x52a92c,_0x576c7b){var _0x437642={};var _0x5861db={};var _0x3798c0;var _0xe4e413;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x52ff4e['params']['id']}})[_0xbcaf('0x21')](handleEntityNotFound(_0x52a92c,null))[_0xbcaf('0x21')](function(_0x4262b9){if(_0x4262b9){_0x3798c0=_0x4262b9;_0x5861db[_0xbcaf('0x3f')]=_[_0xbcaf('0x41')](db[_0xbcaf('0x5b')][_0xbcaf('0x3c')]);_0x5861db[_0xbcaf('0x42')]=_[_0xbcaf('0x41')](_0x52ff4e[_0xbcaf('0x42')]);_0x5861db[_0xbcaf('0x43')]=_[_0xbcaf('0x44')](_0x5861db[_0xbcaf('0x3f')],_0x5861db['query']);_0x437642['attributes']=_['intersection'](_0x5861db['model'],qs[_0xbcaf('0x46')](_0x52ff4e[_0xbcaf('0x42')][_0xbcaf('0x46')]));_0x437642[_0xbcaf('0x45')]=_0x437642['attributes'][_0xbcaf('0x47')]?_0x437642[_0xbcaf('0x45')]:_0x5861db['model'];_0x437642['order']=qs[_0xbcaf('0x4c')](_0x52ff4e[_0xbcaf('0x42')][_0xbcaf('0x4c')]);_0x437642[_0xbcaf('0x4f')]=qs[_0xbcaf('0x43')](_[_0xbcaf('0x4d')](_0x52ff4e['query'],_0x5861db[_0xbcaf('0x43')]));if(_0x52ff4e[_0xbcaf('0x42')][_0xbcaf('0x4e')]){_0x437642[_0xbcaf('0x4f')]=_[_0xbcaf('0x50')](_0x437642[_0xbcaf('0x4f')],{'$or':_[_0xbcaf('0x40')](_0x437642[_0xbcaf('0x45')],function(_0x86d595){var _0x520dbc={};_0x520dbc[_0x86d595]={'$like':'%'+_0x52ff4e[_0xbcaf('0x42')][_0xbcaf('0x4e')]+'%'};return _0x520dbc;})});}_0x437642=_['merge']({},_0x437642,_0x52ff4e[_0xbcaf('0x5c')]);return _0x3798c0[_0xbcaf('0x5a')](_0x437642);}})[_0xbcaf('0x21')](function(_0x222a93){if(_0x222a93){_0xe4e413=_0x222a93[_0xbcaf('0x47')];if(!_0x52ff4e[_0xbcaf('0x42')][_0xbcaf('0x48')]('nolimit')){_0x437642[_0xbcaf('0x2f')]=qs[_0xbcaf('0x2f')](_0x52ff4e[_0xbcaf('0x42')]['limit']);_0x437642[_0xbcaf('0x4a')]=qs[_0xbcaf('0x4a')](_0x52ff4e[_0xbcaf('0x42')]['offset']);}return _0x3798c0[_0xbcaf('0x5a')](_0x437642);}})[_0xbcaf('0x21')](function(_0x482a0c){if(_0x482a0c){return _0x482a0c?{'count':_0xe4e413,'rows':_0x482a0c}:null;}})[_0xbcaf('0x21')](respondWithResult(_0x52a92c,null))[_0xbcaf('0x2b')](handleError(_0x52a92c,null));};exports[_0xbcaf('0x5d')]=function(_0x1e02c6,_0x3b2e08,_0x275c18){var _0x46cb6a={};var _0x393747={};var _0x1758e2;var _0x35e1f6;return db['VtigerConfiguration'][_0xbcaf('0x5e')]({'where':{'id':_0x1e02c6[_0xbcaf('0x55')]['id']}})['then'](handleEntityNotFound(_0x3b2e08,null))[_0xbcaf('0x21')](function(_0x503d51){if(_0x503d51){_0x1758e2=_0x503d51;_0x393747[_0xbcaf('0x3f')]=_[_0xbcaf('0x41')](db['VtigerField'][_0xbcaf('0x3c')]);_0x393747[_0xbcaf('0x42')]=_[_0xbcaf('0x41')](_0x1e02c6[_0xbcaf('0x42')]);_0x393747[_0xbcaf('0x43')]=_[_0xbcaf('0x44')](_0x393747[_0xbcaf('0x3f')],_0x393747[_0xbcaf('0x42')]);_0x46cb6a['attributes']=_['intersection'](_0x393747[_0xbcaf('0x3f')],qs[_0xbcaf('0x46')](_0x1e02c6['query'][_0xbcaf('0x46')]));_0x46cb6a['attributes']=_0x46cb6a[_0xbcaf('0x45')][_0xbcaf('0x47')]?_0x46cb6a[_0xbcaf('0x45')]:_0x393747[_0xbcaf('0x3f')];_0x46cb6a[_0xbcaf('0x4b')]=qs[_0xbcaf('0x4c')](_0x1e02c6[_0xbcaf('0x42')][_0xbcaf('0x4c')]);_0x46cb6a[_0xbcaf('0x4f')]=qs[_0xbcaf('0x43')](_[_0xbcaf('0x4d')](_0x1e02c6[_0xbcaf('0x42')],_0x393747[_0xbcaf('0x43')]));if(_0x1e02c6[_0xbcaf('0x42')][_0xbcaf('0x4e')]){_0x46cb6a[_0xbcaf('0x4f')]=_[_0xbcaf('0x50')](_0x46cb6a[_0xbcaf('0x4f')],{'$or':_['map'](_0x46cb6a['attributes'],function(_0x46c461){var _0x2aa072={};_0x2aa072[_0x46c461]={'$like':'%'+_0x1e02c6['query'][_0xbcaf('0x4e')]+'%'};return _0x2aa072;})});}_0x46cb6a=_[_0xbcaf('0x50')]({},_0x46cb6a,_0x1e02c6[_0xbcaf('0x5c')]);return _0x1758e2[_0xbcaf('0x5d')](_0x46cb6a);}})[_0xbcaf('0x21')](function(_0x56b581){if(_0x56b581){_0x35e1f6=_0x56b581[_0xbcaf('0x47')];if(!_0x1e02c6[_0xbcaf('0x42')][_0xbcaf('0x48')]('nolimit')){_0x46cb6a[_0xbcaf('0x2f')]=qs[_0xbcaf('0x2f')](_0x1e02c6[_0xbcaf('0x42')][_0xbcaf('0x2f')]);_0x46cb6a[_0xbcaf('0x4a')]=qs['offset'](_0x1e02c6[_0xbcaf('0x42')][_0xbcaf('0x4a')]);}return _0x1758e2[_0xbcaf('0x5d')](_0x46cb6a);}})[_0xbcaf('0x21')](function(_0x1d3efd){if(_0x1d3efd){return _0x1d3efd?{'count':_0x35e1f6,'rows':_0x1d3efd}:null;}})['then'](respondWithResult(_0x3b2e08,null))[_0xbcaf('0x2b')](handleError(_0x3b2e08,null));};exports[_0xbcaf('0x5f')]=function(_0x2ed712,_0x225a27,_0x510367){var _0x354602={};var _0x20fd94={};var _0x39ba12;var _0x563929;return db[_0xbcaf('0x3b')][_0xbcaf('0x5e')]({'where':{'id':_0x2ed712[_0xbcaf('0x55')]['id']}})[_0xbcaf('0x21')](handleEntityNotFound(_0x225a27,null))[_0xbcaf('0x21')](function(_0x125677){if(_0x125677){_0x39ba12=_0x125677;_0x20fd94[_0xbcaf('0x3f')]=_[_0xbcaf('0x41')](db['VtigerField'][_0xbcaf('0x3c')]);_0x20fd94['query']=_[_0xbcaf('0x41')](_0x2ed712[_0xbcaf('0x42')]);_0x20fd94['filters']=_[_0xbcaf('0x44')](_0x20fd94['model'],_0x20fd94[_0xbcaf('0x42')]);_0x354602[_0xbcaf('0x45')]=_['intersection'](_0x20fd94[_0xbcaf('0x3f')],qs[_0xbcaf('0x46')](_0x2ed712[_0xbcaf('0x42')][_0xbcaf('0x46')]));_0x354602[_0xbcaf('0x45')]=_0x354602[_0xbcaf('0x45')][_0xbcaf('0x47')]?_0x354602[_0xbcaf('0x45')]:_0x20fd94['model'];_0x354602[_0xbcaf('0x4b')]=qs[_0xbcaf('0x4c')](_0x2ed712[_0xbcaf('0x42')][_0xbcaf('0x4c')]);_0x354602[_0xbcaf('0x4f')]=qs[_0xbcaf('0x43')](_[_0xbcaf('0x4d')](_0x2ed712[_0xbcaf('0x42')],_0x20fd94[_0xbcaf('0x43')]));if(_0x2ed712['query'][_0xbcaf('0x4e')]){_0x354602[_0xbcaf('0x4f')]=_[_0xbcaf('0x50')](_0x354602[_0xbcaf('0x4f')],{'$or':_[_0xbcaf('0x40')](_0x354602[_0xbcaf('0x45')],function(_0x247244){var _0x5f27fe={};_0x5f27fe[_0x247244]={'$like':'%'+_0x2ed712[_0xbcaf('0x42')][_0xbcaf('0x4e')]+'%'};return _0x5f27fe;})});}_0x354602=_['merge']({},_0x354602,_0x2ed712[_0xbcaf('0x5c')]);return _0x39ba12[_0xbcaf('0x5f')](_0x354602);}})[_0xbcaf('0x21')](function(_0xecdfc1){if(_0xecdfc1){_0x563929=_0xecdfc1[_0xbcaf('0x47')];if(!_0x2ed712[_0xbcaf('0x42')][_0xbcaf('0x48')](_0xbcaf('0x49'))){_0x354602[_0xbcaf('0x2f')]=qs[_0xbcaf('0x2f')](_0x2ed712[_0xbcaf('0x42')]['limit']);_0x354602[_0xbcaf('0x4a')]=qs[_0xbcaf('0x4a')](_0x2ed712[_0xbcaf('0x42')][_0xbcaf('0x4a')]);}return _0x39ba12[_0xbcaf('0x5f')](_0x354602);}})[_0xbcaf('0x21')](function(_0x46abb0){if(_0x46abb0){return _0x46abb0?{'count':_0x563929,'rows':_0x46abb0}:null;}})[_0xbcaf('0x21')](respondWithResult(_0x225a27,null))[_0xbcaf('0x2b')](handleError(_0x225a27,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 145c3d4..dac2746 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 _0x08b9=['rimraf','../../config/environment','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3a314d,_0x3b3f0b){var _0x23f8ae=function(_0x13d990){while(--_0x13d990){_0x3a314d['push'](_0x3a314d['shift']());}};_0x23f8ae(++_0x3b3f0b);}(_0x08b9,0x1d9));var _0x908b=function(_0x20a005,_0x3267c4){_0x20a005=_0x20a005-0x0;var _0x318723=_0x08b9[_0x20a005];return _0x318723;};'use strict';var _=require(_0x908b('0x0'));var util=require(_0x908b('0x1'));var logger=require(_0x908b('0x2'))(_0x908b('0x3'));var moment=require(_0x908b('0x4'));var BPromise=require(_0x908b('0x5'));var rp=require(_0x908b('0x6'));var fs=require('fs');var path=require(_0x908b('0x7'));var rimraf=require(_0x908b('0x8'));var config=require(_0x908b('0x9'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x908b('0xa')]=function(_0x5e65c4,_0x396fc8){return _0x5e65c4[_0x908b('0xb')]('VtigerConfiguration',attributes,{'tableName':_0x908b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc54=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','exports','int_vtiger_configurations'];(function(_0x17762c,_0x380749){var _0x164118=function(_0x39bfb1){while(--_0x39bfb1){_0x17762c['push'](_0x17762c['shift']());}};_0x164118(++_0x380749);}(_0xbc54,0x144));var _0x4bc5=function(_0x43c03e,_0x5ac1e0){_0x43c03e=_0x43c03e-0x0;var _0x210285=_0xbc54[_0x43c03e];return _0x210285;};'use strict';var _=require(_0x4bc5('0x0'));var util=require(_0x4bc5('0x1'));var logger=require(_0x4bc5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4bc5('0x3'));var fs=require('fs');var path=require(_0x4bc5('0x4'));var rimraf=require(_0x4bc5('0x5'));var config=require(_0x4bc5('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x4bc5('0x7')]=function(_0x3c39bc,_0x142dfd){return _0x3c39bc['define']('VtigerConfiguration',attributes,{'tableName':_0x4bc5('0x8'),'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 000ccbc..5b200f1 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 _0x12f5=['code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0xbcb4bf,_0x5296ed){var _0x3932b3=function(_0x3df0f2){while(--_0x3df0f2){_0xbcb4bf['push'](_0xbcb4bf['shift']());}};_0x3932b3(++_0x5296ed);}(_0x12f5,0x16d));var _0x512f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x12f5[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x512f('0x0'));var util=require(_0x512f('0x1'));var moment=require(_0x512f('0x2'));var BPromise=require(_0x512f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x512f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x512f('0x5'));var logger=require(_0x512f('0x6'))('rpc');var config=require(_0x512f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x512f('0x8')][_0x512f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23670c,_0x22737e,_0x17e0ad){return new BPromise(function(_0x5740ce,_0x460251){return client['request'](_0x23670c,_0x17e0ad)[_0x512f('0xa')](function(_0x4e1079){logger['info'](_0x512f('0xb'),_0x22737e,'request\x20sent');logger[_0x512f('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x22737e,_0x512f('0xd'),JSON['stringify'](_0x4e1079));if(_0x4e1079[_0x512f('0xe')]){if(_0x4e1079[_0x512f('0xe')][_0x512f('0xf')]===0x1f4){logger['error'](_0x512f('0xb'),_0x22737e,_0x4e1079[_0x512f('0xe')][_0x512f('0x10')]);return _0x460251(_0x4e1079[_0x512f('0xe')][_0x512f('0x10')]);}logger[_0x512f('0xe')](_0x512f('0xb'),_0x22737e,_0x4e1079['error']['message']);return _0x5740ce(_0x4e1079[_0x512f('0xe')]['message']);}else{logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x22737e,_0x512f('0xd'));_0x5740ce(_0x4e1079[_0x512f('0x11')][_0x512f('0x10')]);}})[_0x512f('0x12')](function(_0x2d6cfb){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x22737e,_0x2d6cfb);_0x460251(_0x2d6cfb);});});} \ No newline at end of file +var _0x08ba=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','VtigerConfiguration,\x20%s,\x20%s','message','error','catch','moment'];(function(_0x4e4875,_0x213f8f){var _0x30b914=function(_0xb837ac){while(--_0xb837ac){_0x4e4875['push'](_0x4e4875['shift']());}};_0x30b914(++_0x213f8f);}(_0x08ba,0x155));var _0xa08b=function(_0x9f83b9,_0x214ceb){_0x9f83b9=_0x9f83b9-0x0;var _0x3f19da=_0x08ba[_0x9f83b9];return _0x3f19da;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa08b('0x0'));var BPromise=require('bluebird');var rs=require(_0xa08b('0x1'));var fs=require('fs');var Redis=require(_0xa08b('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa08b('0x3'))(_0xa08b('0x4'));var config=require(_0xa08b('0x5'));var jayson=require(_0xa08b('0x6'));var client=jayson[_0xa08b('0x7')][_0xa08b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582b0c,_0x5dc21b,_0x4de01c){return new BPromise(function(_0x2ed62a,_0x4bd9f1){return client['request'](_0x582b0c,_0x4de01c)[_0xa08b('0x9')](function(_0x10377f){logger[_0xa08b('0xa')]('VtigerConfiguration,\x20%s,\x20%s',_0x5dc21b,_0xa08b('0xb'));logger[_0xa08b('0xc')](_0xa08b('0xd'),_0x5dc21b,_0xa08b('0xb'),JSON[_0xa08b('0xe')](_0x10377f));if(_0x10377f['error']){if(_0x10377f['error']['code']===0x1f4){logger['error'](_0xa08b('0xf'),_0x5dc21b,_0x10377f['error']['message']);return _0x4bd9f1(_0x10377f['error'][_0xa08b('0x10')]);}logger[_0xa08b('0x11')](_0xa08b('0xf'),_0x5dc21b,_0x10377f[_0xa08b('0x11')][_0xa08b('0x10')]);return _0x2ed62a(_0x10377f[_0xa08b('0x11')][_0xa08b('0x10')]);}else{logger[_0xa08b('0xa')](_0xa08b('0xf'),_0x5dc21b,'request\x20sent');_0x2ed62a(_0x10377f['result'][_0xa08b('0x10')]);}})[_0xa08b('0x12')](function(_0x5b24d2){logger[_0xa08b('0x11')](_0xa08b('0xf'),_0x5dc21b,_0x5b24d2);_0x4bd9f1(_0x5b24d2);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 81ff8e2..2a558ce 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 _0x9885=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete','destroy','multer'];(function(_0x136b39,_0x317488){var _0x295b9e=function(_0x226f46){while(--_0x226f46){_0x136b39['push'](_0x136b39['shift']());}};_0x295b9e(++_0x317488);}(_0x9885,0xd7));var _0x5988=function(_0x266840,_0x453927){_0x266840=_0x266840-0x0;var _0x5917fd=_0x9885[_0x266840];return _0x5917fd;};'use strict';var multer=require(_0x5988('0x0'));var util=require(_0x5988('0x1'));var path=require(_0x5988('0x2'));var timeout=require(_0x5988('0x3'));var express=require('express');var router=express[_0x5988('0x4')]();var auth=require(_0x5988('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5988('0x6'));var controller=require(_0x5988('0x7'));router['get']('/',auth[_0x5988('0x8')](),controller[_0x5988('0x9')]);router[_0x5988('0xa')]('/:id',auth[_0x5988('0x8')](),controller[_0x5988('0xb')]);router['post']('/',auth[_0x5988('0x8')](),controller[_0x5988('0xc')]);router[_0x5988('0xd')](_0x5988('0xe'),auth[_0x5988('0x8')](),controller[_0x5988('0xf')]);router[_0x5988('0x10')](_0x5988('0xe'),auth[_0x5988('0x8')](),controller[_0x5988('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1f85=['show','post','isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index'];(function(_0x143629,_0x56c3e3){var _0x14c8aa=function(_0x23f077){while(--_0x23f077){_0x143629['push'](_0x143629['shift']());}};_0x14c8aa(++_0x56c3e3);}(_0x1f85,0xf8));var _0x51f8=function(_0x53624f,_0x2bb5ee){_0x53624f=_0x53624f-0x0;var _0x10987f=_0x1f85[_0x53624f];return _0x10987f;};'use strict';var multer=require(_0x51f8('0x0'));var util=require(_0x51f8('0x1'));var path=require(_0x51f8('0x2'));var timeout=require(_0x51f8('0x3'));var express=require(_0x51f8('0x4'));var router=express[_0x51f8('0x5')]();var auth=require(_0x51f8('0x6'));var interaction=require(_0x51f8('0x7'));var config=require(_0x51f8('0x8'));var controller=require(_0x51f8('0x9'));router[_0x51f8('0xa')]('/',auth['isAuthenticated'](),controller[_0x51f8('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x51f8('0xc')]);router[_0x51f8('0xd')]('/',auth[_0x51f8('0xe')](),controller[_0x51f8('0xf')]);router[_0x51f8('0x10')](_0x51f8('0x11'),auth[_0x51f8('0xe')](),controller['update']);router['delete']('/:id',auth[_0x51f8('0xe')](),controller[_0x51f8('0x12')]);module[_0x51f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 691a324..3c94e85 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 _0xf3ff=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x4e5862,_0x324860){var _0x3d9c38=function(_0x11abc9){while(--_0x11abc9){_0x4e5862['push'](_0x4e5862['shift']());}};_0x3d9c38(++_0x324860);}(_0xf3ff,0xae));var _0xff3f=function(_0x2892f3,_0x1e1551){_0x2892f3=_0x2892f3-0x0;var _0x29396a=_0xf3ff[_0x2892f3];return _0x29396a;};'use strict';var Sequelize=require(_0xff3f('0x0'));module['exports']={'type':{'type':Sequelize[_0xff3f('0x1')](_0xff3f('0x2'),_0xff3f('0x3'),_0xff3f('0x4'),_0xff3f('0x5')),'defaultValue':_0xff3f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xff3f('0x6')]},'keyType':{'type':Sequelize[_0xff3f('0x1')](_0xff3f('0x2'),'variable',_0xff3f('0x4'))},'keyContent':{'type':Sequelize[_0xff3f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xff3f('0x6')]},'customField':{'type':Sequelize[_0xff3f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x94b1=['string','variable','customVariable','STRING','ENUM','BOOLEAN','exports'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x94b1,0x102));var _0x194b=function(_0x150cf5,_0x3ca4e){_0x150cf5=_0x150cf5-0x0;var _0x28f9e8=_0x94b1[_0x150cf5];return _0x28f9e8;};'use strict';var Sequelize=require('sequelize');module[_0x194b('0x0')]={'type':{'type':Sequelize['ENUM'](_0x194b('0x1'),_0x194b('0x2'),_0x194b('0x3'),'keyValue'),'defaultValue':_0x194b('0x1')},'content':{'type':Sequelize[_0x194b('0x4')]},'key':{'type':Sequelize[_0x194b('0x4')]},'keyType':{'type':Sequelize[_0x194b('0x5')]('string',_0x194b('0x2'),_0x194b('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x194b('0x4')]},'nameField':{'type':Sequelize[_0x194b('0x4')]},'customField':{'type':Sequelize[_0x194b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x194b('0x4')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 913d6ee..f713088 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 _0xc949=['fields','include','options','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','VtigerField','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params'];(function(_0x28d51d,_0x139bfd){var _0x199c48=function(_0x5084c3){while(--_0x5084c3){_0x28d51d['push'](_0x28d51d['shift']());}};_0x199c48(++_0x139bfd);}(_0xc949,0x181));var _0x9c94=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xc949[_0x38a7ac];return _0x53061a;};'use strict';var pdf=require(_0x9c94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9c94('0x1'));var zipdir=require(_0x9c94('0x2'));var jsonpatch=require(_0x9c94('0x3'));var rp=require(_0x9c94('0x4'));var moment=require('moment');var BPromise=require(_0x9c94('0x5'));var Mustache=require(_0x9c94('0x6'));var util=require('util');var path=require(_0x9c94('0x7'));var sox=require(_0x9c94('0x8'));var csv=require(_0x9c94('0x9'));var ejs=require(_0x9c94('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9c94('0xb'));var crypto=require(_0x9c94('0xc'));var jsforce=require(_0x9c94('0xd'));var deskjs=require(_0x9c94('0xe'));var toCsv=require(_0x9c94('0x9'));var querystring=require(_0x9c94('0xf'));var Papa=require(_0x9c94('0x10'));var Redis=require(_0x9c94('0x11'));var authService=require(_0x9c94('0x12'));var qs=require(_0x9c94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c94('0x14'));var logger=require(_0x9c94('0x15'))(_0x9c94('0x16'));var utils=require(_0x9c94('0x17'));var config=require(_0x9c94('0x18'));var licenseUtil=require(_0x9c94('0x19'));var db=require(_0x9c94('0x1a'))['db'];function respondWithStatusCode(_0x423adb,_0x30f64e){_0x30f64e=_0x30f64e||0xcc;return function(_0x1e326f){if(_0x1e326f){return _0x423adb[_0x9c94('0x1b')](_0x30f64e);}return _0x423adb[_0x9c94('0x1c')](_0x30f64e)[_0x9c94('0x1d')]();};}function respondWithResult(_0x15c51c,_0x54d956){_0x54d956=_0x54d956||0xc8;return function(_0x9789bc){if(_0x9789bc){return _0x15c51c['status'](_0x54d956)[_0x9c94('0x1e')](_0x9789bc);}};}function respondWithFilteredResult(_0x26e629,_0x4f0013){return function(_0xe52641){if(_0xe52641){var _0x4d6308=_0xe52641[_0x9c94('0x1f')],_0x56e4e1=_0x4f0013[_0x9c94('0x20')],_0xf4054e=_0x4f0013['offset']+_0x4f0013[_0x9c94('0x21')],_0x48d121;if(_0xf4054e>=_0x4d6308){_0xf4054e=_0x4d6308;_0x48d121=0xc8;}else{_0x48d121=0xce;}_0x26e629[_0x9c94('0x1c')](_0x48d121);return _0x26e629[_0x9c94('0x22')](_0x9c94('0x23'),_0x56e4e1+'-'+_0xf4054e+'/'+_0x4d6308)[_0x9c94('0x1e')](_0xe52641);}return null;};}function patchUpdates(_0xfbcc7c){return function(_0x3e361c){try{jsonpatch['apply'](_0x3e361c,_0xfbcc7c,!![]);}catch(_0x2c9736){return BPromise[_0x9c94('0x24')](_0x2c9736);}return _0x3e361c['save']();};}function saveUpdates(_0x141801,_0x845304){return function(_0x3caab0){if(_0x3caab0){return _0x3caab0[_0x9c94('0x25')](_0x141801)[_0x9c94('0x26')](function(_0x3b1481){return _0x3b1481;});}return null;};}function removeEntity(_0xadab16,_0x23cdf5){return function(_0x8fe4fb){if(_0x8fe4fb){return _0x8fe4fb[_0x9c94('0x27')]()[_0x9c94('0x26')](function(){_0xadab16[_0x9c94('0x1c')](0xcc)[_0x9c94('0x1d')]();});}};}function handleEntityNotFound(_0x8c0b7f,_0x5b1020){return function(_0x1f3b14){if(!_0x1f3b14){_0x8c0b7f[_0x9c94('0x1b')](0x194);}return _0x1f3b14;};}function handleError(_0x5c2647,_0x102130){_0x102130=_0x102130||0x1f4;return function(_0x2c3d25){logger[_0x9c94('0x28')](_0x2c3d25[_0x9c94('0x29')]);if(_0x2c3d25[_0x9c94('0x2a')]){delete _0x2c3d25['name'];}_0x5c2647[_0x9c94('0x1c')](_0x102130)[_0x9c94('0x2b')](_0x2c3d25);};}exports['index']=function(_0x248280,_0x4cfb9c){var _0xa5df6f={},_0x14d41b={},_0x330bd4={'count':0x0,'rows':[]};var _0x4008e8=_[_0x9c94('0x2c')](db[_0x9c94('0x2d')][_0x9c94('0x2e')],function(_0x561fdc){return{'name':_0x561fdc['fieldName'],'type':_0x561fdc[_0x9c94('0x2f')][_0x9c94('0x30')]};});_0x14d41b[_0x9c94('0x31')]=_['map'](_0x4008e8,_0x9c94('0x2a'));_0x14d41b['query']=_[_0x9c94('0x32')](_0x248280[_0x9c94('0x33')]);_0x14d41b[_0x9c94('0x34')]=_['intersection'](_0x14d41b['model'],_0x14d41b[_0x9c94('0x33')]);_0xa5df6f[_0x9c94('0x35')]=_[_0x9c94('0x36')](_0x14d41b['model'],qs['fields'](_0x248280['query']['fields']));_0xa5df6f[_0x9c94('0x35')]=_0xa5df6f['attributes'][_0x9c94('0x37')]?_0xa5df6f[_0x9c94('0x35')]:_0x14d41b['model'];if(!_0x248280['query'][_0x9c94('0x38')](_0x9c94('0x39'))){_0xa5df6f[_0x9c94('0x21')]=qs[_0x9c94('0x21')](_0x248280[_0x9c94('0x33')][_0x9c94('0x21')]);_0xa5df6f[_0x9c94('0x20')]=qs[_0x9c94('0x20')](_0x248280[_0x9c94('0x33')][_0x9c94('0x20')]);}_0xa5df6f[_0x9c94('0x3a')]=qs[_0x9c94('0x3b')](_0x248280[_0x9c94('0x33')][_0x9c94('0x3b')]);_0xa5df6f[_0x9c94('0x3c')]=qs[_0x9c94('0x34')](_[_0x9c94('0x3d')](_0x248280[_0x9c94('0x33')],_0x14d41b['filters']),_0x4008e8);if(_0x248280[_0x9c94('0x33')][_0x9c94('0x3e')]){_0xa5df6f[_0x9c94('0x3c')]=_[_0x9c94('0x3f')](_0xa5df6f[_0x9c94('0x3c')],{'$or':_[_0x9c94('0x2c')](_0x4008e8,function(_0x13f94c){if(_0x13f94c['type']!==_0x9c94('0x40')){var _0x591011={};_0x591011[_0x13f94c[_0x9c94('0x2a')]]={'$like':'%'+_0x248280[_0x9c94('0x33')][_0x9c94('0x3e')]+'%'};return _0x591011;}})});}_0xa5df6f=_[_0x9c94('0x3f')]({},_0xa5df6f,_0x248280['options']);var _0x245278={'where':_0xa5df6f['where']};return db[_0x9c94('0x2d')][_0x9c94('0x1f')](_0x245278)[_0x9c94('0x26')](function(_0x5e3119){_0x330bd4[_0x9c94('0x1f')]=_0x5e3119;if(_0x248280['query'][_0x9c94('0x41')]){_0xa5df6f['include']=[{'all':!![]}];}return db['VtigerField'][_0x9c94('0x42')](_0xa5df6f);})[_0x9c94('0x26')](function(_0x11c1c0){_0x330bd4[_0x9c94('0x43')]=_0x11c1c0;return _0x330bd4;})['then'](respondWithFilteredResult(_0x4cfb9c,_0xa5df6f))[_0x9c94('0x44')](handleError(_0x4cfb9c,null));};exports[_0x9c94('0x45')]=function(_0x425778,_0x360960){var _0x57ab57={'raw':!![],'where':{'id':_0x425778[_0x9c94('0x46')]['id']}},_0x1039e8={};_0x1039e8['model']=_[_0x9c94('0x32')](db[_0x9c94('0x2d')][_0x9c94('0x2e')]);_0x1039e8['query']=_['keys'](_0x425778[_0x9c94('0x33')]);_0x1039e8[_0x9c94('0x34')]=_[_0x9c94('0x36')](_0x1039e8[_0x9c94('0x31')],_0x1039e8[_0x9c94('0x33')]);_0x57ab57[_0x9c94('0x35')]=_[_0x9c94('0x36')](_0x1039e8[_0x9c94('0x31')],qs[_0x9c94('0x47')](_0x425778[_0x9c94('0x33')][_0x9c94('0x47')]));_0x57ab57['attributes']=_0x57ab57[_0x9c94('0x35')]['length']?_0x57ab57[_0x9c94('0x35')]:_0x1039e8[_0x9c94('0x31')];if(_0x425778[_0x9c94('0x33')][_0x9c94('0x41')]){_0x57ab57[_0x9c94('0x48')]=[{'all':!![]}];}_0x57ab57=_[_0x9c94('0x3f')]({},_0x57ab57,_0x425778[_0x9c94('0x49')]);return db['VtigerField']['find'](_0x57ab57)[_0x9c94('0x26')](handleEntityNotFound(_0x360960,null))[_0x9c94('0x26')](respondWithResult(_0x360960,null))[_0x9c94('0x44')](handleError(_0x360960,null));};exports['create']=function(_0x3c507f,_0x3966fa){return db['VtigerField']['create'](_0x3c507f['body'],{})['then'](respondWithResult(_0x3966fa,0xc9))[_0x9c94('0x44')](handleError(_0x3966fa,null));};exports['update']=function(_0x5ccc46,_0x157df2){if(_0x5ccc46['body']['id']){delete _0x5ccc46[_0x9c94('0x4a')]['id'];}return db[_0x9c94('0x2d')][_0x9c94('0x4b')]({'where':{'id':_0x5ccc46[_0x9c94('0x46')]['id']}})[_0x9c94('0x26')](handleEntityNotFound(_0x157df2,null))['then'](saveUpdates(_0x5ccc46[_0x9c94('0x4a')],null))[_0x9c94('0x26')](respondWithResult(_0x157df2,null))[_0x9c94('0x44')](handleError(_0x157df2,null));};exports[_0x9c94('0x27')]=function(_0x41226a,_0x1c6634){return db['VtigerField'][_0x9c94('0x4b')]({'where':{'id':_0x41226a['params']['id']}})[_0x9c94('0x26')](handleEntityNotFound(_0x1c6634,null))[_0x9c94('0x26')](removeEntity(_0x1c6634,null))[_0x9c94('0x44')](handleError(_0x1c6634,null));}; \ No newline at end of file +var _0x0adf=['type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','status','json','count','offset','set','apply','save','update','then','destroy','end','error','name','send','index','map','VtigerField','rawAttributes','fieldName'];(function(_0x255e5e,_0x47e53f){var _0x32d9bf=function(_0x4307b2){while(--_0x4307b2){_0x255e5e['push'](_0x255e5e['shift']());}};_0x32d9bf(++_0x47e53f);}(_0x0adf,0x1d2));var _0xf0ad=function(_0xbe16fd,_0x203410){_0xbe16fd=_0xbe16fd-0x0;var _0xf21ab6=_0x0adf[_0xbe16fd];return _0xf21ab6;};'use strict';var pdf=require(_0xf0ad('0x0'));var emlformat=require(_0xf0ad('0x1'));var rimraf=require(_0xf0ad('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0ad('0x3'));var rp=require(_0xf0ad('0x4'));var moment=require(_0xf0ad('0x5'));var BPromise=require(_0xf0ad('0x6'));var Mustache=require(_0xf0ad('0x7'));var util=require(_0xf0ad('0x8'));var path=require(_0xf0ad('0x9'));var sox=require('sox');var csv=require(_0xf0ad('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf0ad('0xb'));var squel=require(_0xf0ad('0xc'));var crypto=require(_0xf0ad('0xd'));var jsforce=require(_0xf0ad('0xe'));var deskjs=require(_0xf0ad('0xf'));var toCsv=require(_0xf0ad('0xa'));var querystring=require(_0xf0ad('0x10'));var Papa=require('papaparse');var Redis=require(_0xf0ad('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf0ad('0x12'));var as=require(_0xf0ad('0x13'));var hardwareService=require(_0xf0ad('0x14'));var logger=require(_0xf0ad('0x15'))(_0xf0ad('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf0ad('0x17'));var db=require(_0xf0ad('0x18'))['db'];function respondWithStatusCode(_0x3646a2,_0x238c3b){_0x238c3b=_0x238c3b||0xcc;return function(_0x597c40){if(_0x597c40){return _0x3646a2[_0xf0ad('0x19')](_0x238c3b);}return _0x3646a2[_0xf0ad('0x1a')](_0x238c3b)['end']();};}function respondWithResult(_0x49df92,_0x5332e9){_0x5332e9=_0x5332e9||0xc8;return function(_0x221d7b){if(_0x221d7b){return _0x49df92['status'](_0x5332e9)[_0xf0ad('0x1b')](_0x221d7b);}};}function respondWithFilteredResult(_0x313ad6,_0xfa544c){return function(_0xfa829e){if(_0xfa829e){var _0x237dd9=_0xfa829e[_0xf0ad('0x1c')],_0x5c23ff=_0xfa544c[_0xf0ad('0x1d')],_0x1ad9e0=_0xfa544c['offset']+_0xfa544c['limit'],_0x285ab0;if(_0x1ad9e0>=_0x237dd9){_0x1ad9e0=_0x237dd9;_0x285ab0=0xc8;}else{_0x285ab0=0xce;}_0x313ad6[_0xf0ad('0x1a')](_0x285ab0);return _0x313ad6[_0xf0ad('0x1e')]('Content-Range',_0x5c23ff+'-'+_0x1ad9e0+'/'+_0x237dd9)[_0xf0ad('0x1b')](_0xfa829e);}return null;};}function patchUpdates(_0x1e88e1){return function(_0x9a95bf){try{jsonpatch[_0xf0ad('0x1f')](_0x9a95bf,_0x1e88e1,!![]);}catch(_0x4cc08a){return BPromise['reject'](_0x4cc08a);}return _0x9a95bf[_0xf0ad('0x20')]();};}function saveUpdates(_0x2da425,_0x37b968){return function(_0x20c5f3){if(_0x20c5f3){return _0x20c5f3[_0xf0ad('0x21')](_0x2da425)[_0xf0ad('0x22')](function(_0x4e874a){return _0x4e874a;});}return null;};}function removeEntity(_0x33c95d,_0x16e62a){return function(_0x31635b){if(_0x31635b){return _0x31635b[_0xf0ad('0x23')]()[_0xf0ad('0x22')](function(){_0x33c95d[_0xf0ad('0x1a')](0xcc)[_0xf0ad('0x24')]();});}};}function handleEntityNotFound(_0x276322,_0x3fc97e){return function(_0x112f20){if(!_0x112f20){_0x276322[_0xf0ad('0x19')](0x194);}return _0x112f20;};}function handleError(_0x2f634f,_0xeae85c){_0xeae85c=_0xeae85c||0x1f4;return function(_0x456f81){logger[_0xf0ad('0x25')](_0x456f81['stack']);if(_0x456f81[_0xf0ad('0x26')]){delete _0x456f81[_0xf0ad('0x26')];}_0x2f634f[_0xf0ad('0x1a')](_0xeae85c)[_0xf0ad('0x27')](_0x456f81);};}exports[_0xf0ad('0x28')]=function(_0x30f8ee,_0x560417){var _0x2cbe00={},_0x19a32a={},_0x2b62={'count':0x0,'rows':[]};var _0x1e60b1=_[_0xf0ad('0x29')](db[_0xf0ad('0x2a')][_0xf0ad('0x2b')],function(_0x1bee71){return{'name':_0x1bee71[_0xf0ad('0x2c')],'type':_0x1bee71[_0xf0ad('0x2d')][_0xf0ad('0x2e')]};});_0x19a32a['model']=_[_0xf0ad('0x29')](_0x1e60b1,'name');_0x19a32a[_0xf0ad('0x2f')]=_['keys'](_0x30f8ee[_0xf0ad('0x2f')]);_0x19a32a[_0xf0ad('0x30')]=_[_0xf0ad('0x31')](_0x19a32a[_0xf0ad('0x32')],_0x19a32a[_0xf0ad('0x2f')]);_0x2cbe00[_0xf0ad('0x33')]=_[_0xf0ad('0x31')](_0x19a32a[_0xf0ad('0x32')],qs['fields'](_0x30f8ee['query'][_0xf0ad('0x34')]));_0x2cbe00[_0xf0ad('0x33')]=_0x2cbe00[_0xf0ad('0x33')][_0xf0ad('0x35')]?_0x2cbe00['attributes']:_0x19a32a[_0xf0ad('0x32')];if(!_0x30f8ee['query'][_0xf0ad('0x36')]('nolimit')){_0x2cbe00[_0xf0ad('0x37')]=qs['limit'](_0x30f8ee[_0xf0ad('0x2f')][_0xf0ad('0x37')]);_0x2cbe00[_0xf0ad('0x1d')]=qs[_0xf0ad('0x1d')](_0x30f8ee[_0xf0ad('0x2f')][_0xf0ad('0x1d')]);}_0x2cbe00[_0xf0ad('0x38')]=qs[_0xf0ad('0x39')](_0x30f8ee['query'][_0xf0ad('0x39')]);_0x2cbe00['where']=qs[_0xf0ad('0x30')](_['pick'](_0x30f8ee[_0xf0ad('0x2f')],_0x19a32a[_0xf0ad('0x30')]),_0x1e60b1);if(_0x30f8ee[_0xf0ad('0x2f')][_0xf0ad('0x3a')]){_0x2cbe00[_0xf0ad('0x3b')]=_['merge'](_0x2cbe00[_0xf0ad('0x3b')],{'$or':_[_0xf0ad('0x29')](_0x1e60b1,function(_0x1d57d1){if(_0x1d57d1[_0xf0ad('0x2d')]!==_0xf0ad('0x3c')){var _0x18558f={};_0x18558f[_0x1d57d1[_0xf0ad('0x26')]]={'$like':'%'+_0x30f8ee['query'][_0xf0ad('0x3a')]+'%'};return _0x18558f;}})});}_0x2cbe00=_[_0xf0ad('0x3d')]({},_0x2cbe00,_0x30f8ee[_0xf0ad('0x3e')]);var _0x189f67={'where':_0x2cbe00[_0xf0ad('0x3b')]};return db[_0xf0ad('0x2a')][_0xf0ad('0x1c')](_0x189f67)[_0xf0ad('0x22')](function(_0x17b9c7){_0x2b62['count']=_0x17b9c7;if(_0x30f8ee[_0xf0ad('0x2f')][_0xf0ad('0x3f')]){_0x2cbe00[_0xf0ad('0x40')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x2cbe00);})['then'](function(_0xdfdead){_0x2b62[_0xf0ad('0x41')]=_0xdfdead;return _0x2b62;})[_0xf0ad('0x22')](respondWithFilteredResult(_0x560417,_0x2cbe00))[_0xf0ad('0x42')](handleError(_0x560417,null));};exports[_0xf0ad('0x43')]=function(_0x3e3988,_0x39083d){var _0x1dcbd0={'raw':!![],'where':{'id':_0x3e3988[_0xf0ad('0x44')]['id']}},_0x3dfedd={};_0x3dfedd[_0xf0ad('0x32')]=_['keys'](db['VtigerField']['rawAttributes']);_0x3dfedd[_0xf0ad('0x2f')]=_[_0xf0ad('0x45')](_0x3e3988['query']);_0x3dfedd[_0xf0ad('0x30')]=_[_0xf0ad('0x31')](_0x3dfedd['model'],_0x3dfedd[_0xf0ad('0x2f')]);_0x1dcbd0[_0xf0ad('0x33')]=_[_0xf0ad('0x31')](_0x3dfedd[_0xf0ad('0x32')],qs['fields'](_0x3e3988[_0xf0ad('0x2f')][_0xf0ad('0x34')]));_0x1dcbd0[_0xf0ad('0x33')]=_0x1dcbd0[_0xf0ad('0x33')][_0xf0ad('0x35')]?_0x1dcbd0[_0xf0ad('0x33')]:_0x3dfedd[_0xf0ad('0x32')];if(_0x3e3988[_0xf0ad('0x2f')][_0xf0ad('0x3f')]){_0x1dcbd0[_0xf0ad('0x40')]=[{'all':!![]}];}_0x1dcbd0=_[_0xf0ad('0x3d')]({},_0x1dcbd0,_0x3e3988['options']);return db[_0xf0ad('0x2a')][_0xf0ad('0x46')](_0x1dcbd0)[_0xf0ad('0x22')](handleEntityNotFound(_0x39083d,null))['then'](respondWithResult(_0x39083d,null))['catch'](handleError(_0x39083d,null));};exports[_0xf0ad('0x47')]=function(_0x6b41e8,_0x12b76f){return db[_0xf0ad('0x2a')][_0xf0ad('0x47')](_0x6b41e8[_0xf0ad('0x48')],{})[_0xf0ad('0x22')](respondWithResult(_0x12b76f,0xc9))['catch'](handleError(_0x12b76f,null));};exports[_0xf0ad('0x21')]=function(_0x587f07,_0x2843a2){if(_0x587f07[_0xf0ad('0x48')]['id']){delete _0x587f07[_0xf0ad('0x48')]['id'];}return db[_0xf0ad('0x2a')][_0xf0ad('0x46')]({'where':{'id':_0x587f07['params']['id']}})['then'](handleEntityNotFound(_0x2843a2,null))[_0xf0ad('0x22')](saveUpdates(_0x587f07[_0xf0ad('0x48')],null))[_0xf0ad('0x22')](respondWithResult(_0x2843a2,null))[_0xf0ad('0x42')](handleError(_0x2843a2,null));};exports[_0xf0ad('0x23')]=function(_0x4152b0,_0x4733e0){return db['VtigerField'][_0xf0ad('0x46')]({'where':{'id':_0x4152b0[_0xf0ad('0x44')]['id']}})[_0xf0ad('0x22')](handleEntityNotFound(_0x4733e0,null))[_0xf0ad('0x22')](removeEntity(_0x4733e0,null))[_0xf0ad('0x42')](handleError(_0x4733e0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index c2177b2..41b8730 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 _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x541ac3,_0x54ad6e){var _0xa13b9a=function(_0x1465a5){while(--_0x1465a5){_0x541ac3['push'](_0x541ac3['shift']());}};_0xa13b9a(++_0x54ad6e);}(_0x7a54,0x106));var _0x47a5=function(_0x5536a2,_0x3a23f2){_0x5536a2=_0x5536a2-0x0;var _0x28c845=_0x7a54[_0x5536a2];return _0x28c845;};'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':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x23d0fc,_0x20b841){var _0x41f208=function(_0x2d3aa2){while(--_0x2d3aa2){_0x23d0fc['push'](_0x23d0fc['shift']());}};_0x41f208(++_0x20b841);}(_0x7a54,0x106));var _0x47a5=function(_0x3ebb8a,_0x358722){_0x3ebb8a=_0x3ebb8a-0x0;var _0x5bba5f=_0x7a54[_0x3ebb8a];return _0x5bba5f;};'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':'vtiger_unique_index','fields':[_0x47a5('0xc'),'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 3f629a5..4bb6be0 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 _0x0c6b=['error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x211936,_0x499910){var _0x149913=function(_0x4f6077){while(--_0x4f6077){_0x211936['push'](_0x211936['shift']());}};_0x149913(++_0x499910);}(_0x0c6b,0x1bc));var _0xb0c6=function(_0x5ca836,_0x56af5c){_0x5ca836=_0x5ca836-0x0;var _0x5f29c2=_0x0c6b[_0x5ca836];return _0x5f29c2;};'use strict';var _=require(_0xb0c6('0x0'));var util=require('util');var moment=require(_0xb0c6('0x1'));var BPromise=require(_0xb0c6('0x2'));var rs=require(_0xb0c6('0x3'));var fs=require('fs');var Redis=require(_0xb0c6('0x4'));var db=require(_0xb0c6('0x5'))['db'];var utils=require(_0xb0c6('0x6'));var logger=require(_0xb0c6('0x7'))(_0xb0c6('0x8'));var config=require(_0xb0c6('0x9'));var jayson=require(_0xb0c6('0xa'));var client=jayson[_0xb0c6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x590ef9,_0x5ec174,_0x4e1245){return new BPromise(function(_0x3f18bd,_0x1be8bd){return client['request'](_0x590ef9,_0x4e1245)['then'](function(_0x2beb18){logger[_0xb0c6('0xc')](_0xb0c6('0xd'),_0x5ec174,_0xb0c6('0xe'));logger[_0xb0c6('0xf')](_0xb0c6('0x10'),_0x5ec174,_0xb0c6('0xe'),JSON[_0xb0c6('0x11')](_0x2beb18));if(_0x2beb18['error']){if(_0x2beb18[_0xb0c6('0x12')]['code']===0x1f4){logger[_0xb0c6('0x12')](_0xb0c6('0xd'),_0x5ec174,_0x2beb18[_0xb0c6('0x12')]['message']);return _0x1be8bd(_0x2beb18[_0xb0c6('0x12')][_0xb0c6('0x13')]);}logger[_0xb0c6('0x12')](_0xb0c6('0xd'),_0x5ec174,_0x2beb18[_0xb0c6('0x12')][_0xb0c6('0x13')]);return _0x3f18bd(_0x2beb18[_0xb0c6('0x12')][_0xb0c6('0x13')]);}else{logger['info'](_0xb0c6('0xd'),_0x5ec174,_0xb0c6('0xe'));_0x3f18bd(_0x2beb18[_0xb0c6('0x14')][_0xb0c6('0x13')]);}})['catch'](function(_0x19a09e){logger[_0xb0c6('0x12')](_0xb0c6('0xd'),_0x5ec174,_0x19a09e);_0x1be8bd(_0x19a09e);});});} \ No newline at end of file +var _0x4dd2=['../../config/environment','jayson/promise','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0x40cebf,_0xf50576){var _0x39047d=function(_0x10d8e5){while(--_0x10d8e5){_0x40cebf['push'](_0x40cebf['shift']());}};_0x39047d(++_0xf50576);}(_0x4dd2,0xf1));var _0x24dd=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0x4dd2[_0x1265fa];return _0x1fe35e;};'use strict';var _=require('lodash');var util=require(_0x24dd('0x0'));var moment=require(_0x24dd('0x1'));var BPromise=require(_0x24dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x24dd('0x4'));var logger=require('../../config/logger')(_0x24dd('0x5'));var config=require(_0x24dd('0x6'));var jayson=require(_0x24dd('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21b5b4,_0x390472,_0x1dd44c){return new BPromise(function(_0x424e48,_0x312f04){return client['request'](_0x21b5b4,_0x1dd44c)[_0x24dd('0x8')](function(_0x107a09){logger[_0x24dd('0x9')](_0x24dd('0xa'),_0x390472,_0x24dd('0xb'));logger['debug'](_0x24dd('0xc'),_0x390472,_0x24dd('0xb'),JSON[_0x24dd('0xd')](_0x107a09));if(_0x107a09[_0x24dd('0xe')]){if(_0x107a09[_0x24dd('0xe')][_0x24dd('0xf')]===0x1f4){logger[_0x24dd('0xe')](_0x24dd('0xa'),_0x390472,_0x107a09['error'][_0x24dd('0x10')]);return _0x312f04(_0x107a09['error'][_0x24dd('0x10')]);}logger[_0x24dd('0xe')]('VtigerField,\x20%s,\x20%s',_0x390472,_0x107a09['error'][_0x24dd('0x10')]);return _0x424e48(_0x107a09[_0x24dd('0xe')][_0x24dd('0x10')]);}else{logger['info'](_0x24dd('0xa'),_0x390472,'request\x20sent');_0x424e48(_0x107a09[_0x24dd('0x11')][_0x24dd('0x10')]);}})[_0x24dd('0x12')](function(_0x25bdf4){logger['error'](_0x24dd('0xa'),_0x390472,_0x25bdf4);_0x312f04(_0x25bdf4);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9d70621..48dfde5 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 _0xdcce=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','getConfigurations','getFields','post','/:id/configurations','delete','/:id'];(function(_0xb0b922,_0x183826){var _0x5dc41e=function(_0x461183){while(--_0x461183){_0xb0b922['push'](_0xb0b922['shift']());}};_0x5dc41e(++_0x183826);}(_0xdcce,0x18d));var _0xedcc=function(_0x5730a4,_0x17a132){_0x5730a4=_0x5730a4-0x0;var _0x18ca26=_0xdcce[_0x5730a4];return _0x18ca26;};'use strict';var multer=require(_0xedcc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xedcc('0x1'));var express=require(_0xedcc('0x2'));var router=express[_0xedcc('0x3')]();var auth=require(_0xedcc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xedcc('0x5'));var controller=require(_0xedcc('0x6'));router[_0xedcc('0x7')]('/',auth[_0xedcc('0x8')](),controller[_0xedcc('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xedcc('0xa')]);router[_0xedcc('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xedcc('0xb')]);router[_0xedcc('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0xedcc('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xedcc('0xd')](_0xedcc('0xe'),auth[_0xedcc('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0xedcc('0x8')](),controller['update']);router[_0xedcc('0xf')](_0xedcc('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xedcc('0x11')]=router; \ No newline at end of file +var _0xfc34=['/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index'];(function(_0x149354,_0x3f2be1){var _0x1b381d=function(_0x3f70e8){while(--_0x3f70e8){_0x149354['push'](_0x149354['shift']());}};_0x1b381d(++_0x3f2be1);}(_0xfc34,0x193));var _0x4fc3=function(_0x54d486,_0x193223){_0x54d486=_0x54d486-0x0;var _0x3a639e=_0xfc34[_0x54d486];return _0x3a639e;};'use strict';var multer=require(_0x4fc3('0x0'));var util=require(_0x4fc3('0x1'));var path=require('path');var timeout=require(_0x4fc3('0x2'));var express=require(_0x4fc3('0x3'));var router=express[_0x4fc3('0x4')]();var auth=require(_0x4fc3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4fc3('0x6'));var controller=require(_0x4fc3('0x7'));router[_0x4fc3('0x8')]('/',auth[_0x4fc3('0x9')](),controller[_0x4fc3('0xa')]);router[_0x4fc3('0x8')](_0x4fc3('0xb'),auth['isAuthenticated'](),controller[_0x4fc3('0xc')]);router[_0x4fc3('0x8')](_0x4fc3('0xd'),auth[_0x4fc3('0x9')](),controller[_0x4fc3('0xe')]);router[_0x4fc3('0x8')]('/:id/fields',auth[_0x4fc3('0x9')](),controller[_0x4fc3('0xf')]);router[_0x4fc3('0x10')]('/',auth[_0x4fc3('0x9')](),controller[_0x4fc3('0x11')]);router['post']('/:id/configurations',auth[_0x4fc3('0x9')](),controller[_0x4fc3('0x12')]);router['put']('/:id',auth[_0x4fc3('0x9')](),controller[_0x4fc3('0x13')]);router[_0x4fc3('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x4fc3('0x15')]);module[_0x4fc3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e5ad0c6..c2154b9 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 _0xe181=['password','token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x2d639e,_0x31a9eb){var _0x2dc736=function(_0x56ccbd){while(--_0x56ccbd){_0x2d639e['push'](_0x2d639e['shift']());}};_0x2dc736(++_0x31a9eb);}(_0xe181,0x16c));var _0x1e18=function(_0x31ca37,_0x2b814f){_0x31ca37=_0x31ca37-0x0;var _0x4300cd=_0xe181[_0x31ca37];return _0x4300cd;};'use strict';var Sequelize=require(_0x1e18('0x0'));module[_0x1e18('0x1')]={'name':{'type':Sequelize[_0x1e18('0x2')]},'description':{'type':Sequelize[_0x1e18('0x2')]},'username':{'type':Sequelize[_0x1e18('0x2')],'unique':_0x1e18('0x3')},'password':{'type':Sequelize[_0x1e18('0x2')]},'token':{'type':Sequelize[_0x1e18('0x2')]},'remoteUri':{'type':Sequelize[_0x1e18('0x2')],'unique':_0x1e18('0x4')},'authType':{'type':Sequelize[_0x1e18('0x5')](_0x1e18('0x6'),_0x1e18('0x7')),'defaultValue':_0x1e18('0x6')},'serverUrl':{'type':Sequelize[_0x1e18('0x2')]},'type':{'type':Sequelize['ENUM'](_0x1e18('0x8'),_0x1e18('0x9')),'defaultValue':_0x1e18('0x8')}}; \ No newline at end of file +var _0x4633=['remoteUri','password','token','integrationTab','sequelize','exports','STRING'];(function(_0x186f6d,_0x1fbe58){var _0x510fa0=function(_0x109677){while(--_0x109677){_0x186f6d['push'](_0x186f6d['shift']());}};_0x510fa0(++_0x1fbe58);}(_0x4633,0x169));var _0x3463=function(_0x4a5d22,_0x27829e){_0x4a5d22=_0x4a5d22-0x0;var _0x3dbb86=_0x4633[_0x4a5d22];return _0x3dbb86;};'use strict';var Sequelize=require(_0x3463('0x0'));module[_0x3463('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3463('0x2')]},'username':{'type':Sequelize[_0x3463('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3463('0x3')},'authType':{'type':Sequelize['ENUM'](_0x3463('0x4'),_0x3463('0x5')),'defaultValue':_0x3463('0x4')},'serverUrl':{'type':Sequelize[_0x3463('0x2')]},'type':{'type':Sequelize['ENUM'](_0x3463('0x6'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a983ef8..792853f 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 _0x2a41=['AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','password','token','remoteUri','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','%s:%s','username','toString','%s/token:%s','base64','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','limit','set','Content-Range','save','update','destroy','end','name','send','index','map','ZendeskAccount','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','findOne','ZendeskConfiguration','order','getConfigurations','addConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a41,0x126));var _0x12a4=function(_0xec0590,_0xd27f54){_0xec0590=_0xec0590-0x0;var _0x58158f=_0x2a41[_0xec0590];return _0x58158f;};'use strict';var pdf=require(_0x12a4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x12a4('0x1'));var zipdir=require(_0x12a4('0x2'));var jsonpatch=require(_0x12a4('0x3'));var rp=require(_0x12a4('0x4'));var moment=require(_0x12a4('0x5'));var BPromise=require(_0x12a4('0x6'));var Mustache=require(_0x12a4('0x7'));var util=require(_0x12a4('0x8'));var path=require(_0x12a4('0x9'));var sox=require('sox');var csv=require(_0x12a4('0xa'));var ejs=require(_0x12a4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x12a4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x12a4('0xd'));var toCsv=require(_0x12a4('0xa'));var querystring=require(_0x12a4('0xe'));var Papa=require(_0x12a4('0xf'));var Redis=require(_0x12a4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x12a4('0x11'));var as=require(_0x12a4('0x12'));var hardwareService=require(_0x12a4('0x13'));var logger=require(_0x12a4('0x14'))(_0x12a4('0x15'));var utils=require(_0x12a4('0x16'));var config=require(_0x12a4('0x17'));var licenseUtil=require(_0x12a4('0x18'));var db=require(_0x12a4('0x19'))['db'];var integrations=require(_0x12a4('0x1a'));var jayson=require(_0x12a4('0x1b'));var client=jayson[_0x12a4('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd9a5c9,_0x28d194,_0x1af5f8,_0x22cfde){return new BPromise(function(_0x2b6e72,_0x558377){var _0x4b86ae=_0x22cfde||client;return _0x4b86ae[_0x12a4('0x1d')](_0xd9a5c9,_0x1af5f8)[_0x12a4('0x1e')](function(_0x2428ba){logger[_0x12a4('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x28d194,_0x12a4('0x20'));logger[_0x12a4('0x21')](_0x12a4('0x22'),_0x28d194,_0x12a4('0x20'),JSON[_0x12a4('0x23')](_0x2428ba));if(_0x2428ba[_0x12a4('0x24')]){if(_0x2428ba['error'][_0x12a4('0x25')]===0x1f4){logger[_0x12a4('0x24')](_0x12a4('0x26'),_0x28d194,_0x2428ba['error']['message']);return _0x558377(_0x2428ba[_0x12a4('0x24')][_0x12a4('0x27')]);}logger[_0x12a4('0x24')](_0x12a4('0x26'),_0x28d194,_0x2428ba[_0x12a4('0x24')]['message']);return _0x2b6e72(_0x2428ba[_0x12a4('0x24')]['message']);}else{logger[_0x12a4('0x1f')](_0x12a4('0x26'),_0x28d194,_0x12a4('0x20'));_0x2b6e72(_0x2428ba[_0x12a4('0x28')][_0x12a4('0x27')]);}})['catch'](function(_0x1f366e){logger[_0x12a4('0x24')](_0x12a4('0x26'),_0x28d194,_0x1f366e);_0x558377(_0x1f366e);});});}function respondWithStatusCode(_0x1c4255,_0x499b22){_0x499b22=_0x499b22||0xcc;return function(_0x38deed){if(_0x38deed){return _0x1c4255[_0x12a4('0x29')](_0x499b22);}return _0x1c4255[_0x12a4('0x2a')](_0x499b22)['end']();};}function respondWithResult(_0x395749,_0x2f3cae){_0x2f3cae=_0x2f3cae||0xc8;return function(_0x5950fe){if(_0x5950fe){return _0x395749[_0x12a4('0x2a')](_0x2f3cae)[_0x12a4('0x2b')](_0x5950fe);}};}function respondWithFilteredResult(_0x4f1c77,_0x5e952f){return function(_0x5e4616){if(_0x5e4616){var _0x41e832=_0x5e4616['count'],_0x6ac80c=_0x5e952f[_0x12a4('0x2c')],_0x3314da=_0x5e952f['offset']+_0x5e952f[_0x12a4('0x2d')],_0x1c34df;if(_0x3314da>=_0x41e832){_0x3314da=_0x41e832;_0x1c34df=0xc8;}else{_0x1c34df=0xce;}_0x4f1c77[_0x12a4('0x2a')](_0x1c34df);return _0x4f1c77[_0x12a4('0x2e')](_0x12a4('0x2f'),_0x6ac80c+'-'+_0x3314da+'/'+_0x41e832)['json'](_0x5e4616);}return null;};}function patchUpdates(_0x2d612c){return function(_0x35f941){try{jsonpatch['apply'](_0x35f941,_0x2d612c,!![]);}catch(_0x283668){return BPromise['reject'](_0x283668);}return _0x35f941[_0x12a4('0x30')]();};}function saveUpdates(_0x2de4d5,_0x534ab5){return function(_0x138fd6){if(_0x138fd6){return _0x138fd6[_0x12a4('0x31')](_0x2de4d5)[_0x12a4('0x1e')](function(_0x5ce983){return _0x5ce983;});}return null;};}function removeEntity(_0x2bd2db,_0x547a94){return function(_0x1fd988){if(_0x1fd988){return _0x1fd988[_0x12a4('0x32')]()[_0x12a4('0x1e')](function(){_0x2bd2db[_0x12a4('0x2a')](0xcc)[_0x12a4('0x33')]();});}};}function handleEntityNotFound(_0x38f86d,_0x509dde){return function(_0x2ca582){if(!_0x2ca582){_0x38f86d[_0x12a4('0x29')](0x194);}return _0x2ca582;};}function handleError(_0x3080e3,_0x5ebeb1){_0x5ebeb1=_0x5ebeb1||0x1f4;return function(_0x4c6704){logger[_0x12a4('0x24')](_0x4c6704['stack']);if(_0x4c6704[_0x12a4('0x34')]){delete _0x4c6704[_0x12a4('0x34')];}_0x3080e3['status'](_0x5ebeb1)[_0x12a4('0x35')](_0x4c6704);};}exports[_0x12a4('0x36')]=function(_0xd5574d,_0x168a7a){var _0x57850b={},_0x728b01={},_0xf4b016={'count':0x0,'rows':[]};var _0x392978=_[_0x12a4('0x37')](db[_0x12a4('0x38')]['rawAttributes'],function(_0x570ef0){return{'name':_0x570ef0[_0x12a4('0x39')],'type':_0x570ef0['type'][_0x12a4('0x3a')]};});_0x728b01[_0x12a4('0x3b')]=_[_0x12a4('0x37')](_0x392978,_0x12a4('0x34'));_0x728b01[_0x12a4('0x3c')]=_[_0x12a4('0x3d')](_0xd5574d[_0x12a4('0x3c')]);_0x728b01[_0x12a4('0x3e')]=_[_0x12a4('0x3f')](_0x728b01[_0x12a4('0x3b')],_0x728b01['query']);_0x57850b['attributes']=_['intersection'](_0x728b01[_0x12a4('0x3b')],qs[_0x12a4('0x40')](_0xd5574d['query'][_0x12a4('0x40')]));_0x57850b[_0x12a4('0x41')]=_0x57850b[_0x12a4('0x41')][_0x12a4('0x42')]?_0x57850b[_0x12a4('0x41')]:_0x728b01[_0x12a4('0x3b')];if(!_0xd5574d[_0x12a4('0x3c')][_0x12a4('0x43')](_0x12a4('0x44'))){_0x57850b['limit']=qs[_0x12a4('0x2d')](_0xd5574d['query'][_0x12a4('0x2d')]);_0x57850b[_0x12a4('0x2c')]=qs[_0x12a4('0x2c')](_0xd5574d[_0x12a4('0x3c')][_0x12a4('0x2c')]);}_0x57850b['order']=qs[_0x12a4('0x45')](_0xd5574d[_0x12a4('0x3c')][_0x12a4('0x45')]);_0x57850b[_0x12a4('0x46')]=qs[_0x12a4('0x3e')](_[_0x12a4('0x47')](_0xd5574d[_0x12a4('0x3c')],_0x728b01['filters']),_0x392978);if(_0xd5574d[_0x12a4('0x3c')][_0x12a4('0x48')]){_0x57850b[_0x12a4('0x46')]=_[_0x12a4('0x49')](_0x57850b[_0x12a4('0x46')],{'$or':_[_0x12a4('0x37')](_0x392978,function(_0xfec460){if(_0xfec460[_0x12a4('0x4a')]!==_0x12a4('0x4b')){var _0x45351e={};_0x45351e[_0xfec460[_0x12a4('0x34')]]={'$like':'%'+_0xd5574d['query'][_0x12a4('0x48')]+'%'};return _0x45351e;}})});}_0x57850b=_[_0x12a4('0x49')]({},_0x57850b,_0xd5574d[_0x12a4('0x4c')]);var _0x51de12={'where':_0x57850b['where']};return db[_0x12a4('0x38')][_0x12a4('0x4d')](_0x51de12)[_0x12a4('0x1e')](function(_0x55d4ca){_0xf4b016[_0x12a4('0x4d')]=_0x55d4ca;if(_0xd5574d[_0x12a4('0x3c')][_0x12a4('0x4e')]){_0x57850b[_0x12a4('0x4f')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x57850b);})['then'](function(_0x5b62f8){_0xf4b016[_0x12a4('0x50')]=_0x5b62f8;return _0xf4b016;})[_0x12a4('0x1e')](respondWithFilteredResult(_0x168a7a,_0x57850b))[_0x12a4('0x51')](handleError(_0x168a7a,null));};exports[_0x12a4('0x52')]=function(_0x4348ba,_0x511428){var _0x336230={'raw':![],'where':{'id':_0x4348ba[_0x12a4('0x53')]['id']}},_0x2342d6={};_0x2342d6['model']=_['keys'](db[_0x12a4('0x38')][_0x12a4('0x54')]);_0x2342d6['query']=_['keys'](_0x4348ba['query']);_0x2342d6[_0x12a4('0x3e')]=_[_0x12a4('0x3f')](_0x2342d6[_0x12a4('0x3b')],_0x2342d6['query']);_0x336230[_0x12a4('0x41')]=_[_0x12a4('0x3f')](_0x2342d6['model'],qs[_0x12a4('0x40')](_0x4348ba[_0x12a4('0x3c')][_0x12a4('0x40')]));_0x336230[_0x12a4('0x41')]=_0x336230[_0x12a4('0x41')][_0x12a4('0x42')]?_0x336230['attributes']:_0x2342d6[_0x12a4('0x3b')];if(_0x4348ba['query'][_0x12a4('0x4e')]){_0x336230[_0x12a4('0x4f')]=[{'all':!![]}];}_0x336230=_[_0x12a4('0x49')]({},_0x336230,_0x4348ba[_0x12a4('0x4c')]);return db[_0x12a4('0x38')][_0x12a4('0x55')](_0x336230)[_0x12a4('0x1e')](handleEntityNotFound(_0x511428,null))['then'](respondWithResult(_0x511428,null))[_0x12a4('0x51')](handleError(_0x511428,null));};exports[_0x12a4('0x56')]=function(_0x191d26,_0xdfefdd){return db[_0x12a4('0x38')][_0x12a4('0x56')](_0x191d26[_0x12a4('0x57')],{})[_0x12a4('0x1e')](respondWithResult(_0xdfefdd,0xc9))[_0x12a4('0x51')](handleError(_0xdfefdd,null));};exports[_0x12a4('0x31')]=function(_0x2165fe,_0x2644ef){if(_0x2165fe[_0x12a4('0x57')]['id']){delete _0x2165fe['body']['id'];}return db[_0x12a4('0x38')][_0x12a4('0x55')]({'where':{'id':_0x2165fe[_0x12a4('0x53')]['id']}})[_0x12a4('0x1e')](handleEntityNotFound(_0x2644ef,null))['then'](saveUpdates(_0x2165fe[_0x12a4('0x57')],null))['then'](respondWithResult(_0x2644ef,null))[_0x12a4('0x51')](handleError(_0x2644ef,null));};exports[_0x12a4('0x32')]=function(_0x1a28b8,_0x10f5b4){return db[_0x12a4('0x38')][_0x12a4('0x55')]({'where':{'id':_0x1a28b8[_0x12a4('0x53')]['id']}})[_0x12a4('0x1e')](handleEntityNotFound(_0x10f5b4,null))['then'](removeEntity(_0x10f5b4,null))[_0x12a4('0x51')](handleError(_0x10f5b4,null));};exports['getConfigurations']=function(_0x327069,_0x1c5e82,_0x27d9eb){var _0x1e76d1={};var _0x25e34b={};var _0x30ef8b;var _0x10f1ac;return db['ZendeskAccount'][_0x12a4('0x58')]({'where':{'id':_0x327069[_0x12a4('0x53')]['id']}})[_0x12a4('0x1e')](handleEntityNotFound(_0x1c5e82,null))[_0x12a4('0x1e')](function(_0x4f7f8d){if(_0x4f7f8d){_0x30ef8b=_0x4f7f8d;_0x25e34b[_0x12a4('0x3b')]=_['keys'](db[_0x12a4('0x59')]['rawAttributes']);_0x25e34b['query']=_[_0x12a4('0x3d')](_0x327069[_0x12a4('0x3c')]);_0x25e34b[_0x12a4('0x3e')]=_[_0x12a4('0x3f')](_0x25e34b['model'],_0x25e34b[_0x12a4('0x3c')]);_0x1e76d1[_0x12a4('0x41')]=_['intersection'](_0x25e34b[_0x12a4('0x3b')],qs[_0x12a4('0x40')](_0x327069['query']['fields']));_0x1e76d1[_0x12a4('0x41')]=_0x1e76d1['attributes'][_0x12a4('0x42')]?_0x1e76d1[_0x12a4('0x41')]:_0x25e34b['model'];_0x1e76d1[_0x12a4('0x5a')]=qs['sort'](_0x327069[_0x12a4('0x3c')]['sort']);_0x1e76d1[_0x12a4('0x46')]=qs[_0x12a4('0x3e')](_[_0x12a4('0x47')](_0x327069['query'],_0x25e34b[_0x12a4('0x3e')]));if(_0x327069['query'][_0x12a4('0x48')]){_0x1e76d1['where']=_[_0x12a4('0x49')](_0x1e76d1['where'],{'$or':_[_0x12a4('0x37')](_0x1e76d1['attributes'],function(_0x80de73){var _0x43e2c0={};_0x43e2c0[_0x80de73]={'$like':'%'+_0x327069[_0x12a4('0x3c')][_0x12a4('0x48')]+'%'};return _0x43e2c0;})});}_0x1e76d1=_[_0x12a4('0x49')]({},_0x1e76d1,_0x327069['options']);return _0x30ef8b[_0x12a4('0x5b')](_0x1e76d1);}})[_0x12a4('0x1e')](function(_0x3f538f){if(_0x3f538f){_0x10f1ac=_0x3f538f[_0x12a4('0x42')];if(!_0x327069[_0x12a4('0x3c')]['hasOwnProperty'](_0x12a4('0x44'))){_0x1e76d1[_0x12a4('0x2d')]=qs['limit'](_0x327069[_0x12a4('0x3c')][_0x12a4('0x2d')]);_0x1e76d1[_0x12a4('0x2c')]=qs[_0x12a4('0x2c')](_0x327069[_0x12a4('0x3c')][_0x12a4('0x2c')]);}return _0x30ef8b['getConfigurations'](_0x1e76d1);}})[_0x12a4('0x1e')](function(_0x128e71){if(_0x128e71){return _0x128e71?{'count':_0x10f1ac,'rows':_0x128e71}:null;}})[_0x12a4('0x1e')](respondWithResult(_0x1c5e82,null))[_0x12a4('0x51')](handleError(_0x1c5e82,null));};exports[_0x12a4('0x5c')]=function(_0x5b5167,_0xb6147f,_0x5c38fc){if(_0x5b5167[_0x12a4('0x57')]['id']){delete _0x5b5167[_0x12a4('0x57')]['id'];}return db[_0x12a4('0x38')][_0x12a4('0x58')]({'where':{'id':_0x5b5167['params']['id']}})[_0x12a4('0x1e')](handleEntityNotFound(_0xb6147f,null))[_0x12a4('0x1e')](function(_0x45a8ab){if(_0x45a8ab){_0x5b5167[_0x12a4('0x57')][_0x12a4('0x5d')]=_0x45a8ab['id'];_0x5b5167[_0x12a4('0x57')][_0x12a4('0x5e')]=integrations['getSubjects'](_0x5b5167[_0x12a4('0x57')][_0x12a4('0x5f')],_0x5b5167[_0x12a4('0x57')][_0x12a4('0x4a')]);_0x5b5167[_0x12a4('0x57')][_0x12a4('0x60')]=integrations[_0x12a4('0x61')](_0x5b5167[_0x12a4('0x57')][_0x12a4('0x5f')],_0x5b5167[_0x12a4('0x57')][_0x12a4('0x4a')]);return db[_0x12a4('0x59')][_0x12a4('0x56')](_0x5b5167[_0x12a4('0x57')],{'include':[{'model':db['ZendeskField'],'as':_0x12a4('0x5e')},{'model':db[_0x12a4('0x62')],'as':_0x12a4('0x60')}]});}return null;})[_0x12a4('0x1e')](respondWithResult(_0xb6147f,null))['catch'](handleError(_0xb6147f,null));};exports['getFields']=function(_0x5ce731,_0x5cc631,_0x195dc8){var _0x552786='';return db[_0x12a4('0x38')][_0x12a4('0x58')]({'where':{'id':_0x5ce731['params']['id']},'attributes':['id','username',_0x12a4('0x63'),_0x12a4('0x64'),'authType',_0x12a4('0x65')]})['then'](handleEntityNotFound(_0x5cc631,null))[_0x12a4('0x1e')](function(_0x15ac6e){if(_0x15ac6e){_0x552786=_0x15ac6e[_0x12a4('0x65')];var _0x2971f4=_0x552786['slice'](-0x1);if(_0x2971f4==='/'){_0x552786=_0x552786['substring'](0x0,_0x552786[_0x12a4('0x66')](_0x2971f4));}var _0x4927ea={'method':_0x12a4('0x67'),'uri':util[_0x12a4('0x68')](_0x12a4('0x69'),_0x552786,_0x12a4('0x6a')),'json':!![]};switch(_0x15ac6e[_0x12a4('0x6b')]){case _0x12a4('0x63'):_0x4927ea[_0x12a4('0x6c')]={'Authorization':util[_0x12a4('0x68')](_0x12a4('0x6d'),new Buffer(util[_0x12a4('0x68')](_0x12a4('0x6e'),_0x15ac6e[_0x12a4('0x6f')],_0x15ac6e[_0x12a4('0x63')]))[_0x12a4('0x70')]('base64'))};break;case _0x12a4('0x64'):_0x4927ea[_0x12a4('0x6c')]={'Authorization':util[_0x12a4('0x68')](_0x12a4('0x6d'),new Buffer(util[_0x12a4('0x68')](_0x12a4('0x71'),_0x15ac6e[_0x12a4('0x6f')],_0x15ac6e[_0x12a4('0x64')]))[_0x12a4('0x70')](_0x12a4('0x72')))};break;default:throw new db[(_0x12a4('0x73'))]['ValidationError'](_0x12a4('0x74'));}return rp(_0x4927ea);}})[_0x12a4('0x1e')](function(_0x3e1d3e){if(_0x3e1d3e){var _0x74df49=[_0x12a4('0x75'),_0x12a4('0x76'),'group',_0x12a4('0x77')];_[_0x12a4('0x78')](_0x3e1d3e[_0x12a4('0x6a')],function(_0x54c1a9){return _0x74df49['includes'](_0x54c1a9['type']);});return{'count':_0x3e1d3e['ticket_fields']['length'],'rows':_['map'](_0x3e1d3e[_0x12a4('0x6a')],function(_0xa2e1fc){return{'id':_0xa2e1fc['id'],'name':_0xa2e1fc[_0x12a4('0x79')]>0x7?_0xa2e1fc[_0x12a4('0x7a')]:_0xa2e1fc[_0x12a4('0x4a')],'custom':_0xa2e1fc[_0x12a4('0x79')]>0x7?!![]:![],'options':_0xa2e1fc[_0x12a4('0x7b')]?_0xa2e1fc[_0x12a4('0x7b')]:_0xa2e1fc[_0x12a4('0x7c')]?_0xa2e1fc[_0x12a4('0x7c')]:[]};})};}})[_0x12a4('0x1e')](respondWithResult(_0x5cc631,null))[_0x12a4('0x51')](function(_0x125e8c){var _0x3d76a4=_0x5ce731[_0x12a4('0x3c')][_0x12a4('0x7d')]?0x1f4:_0x125e8c[_0x12a4('0x7e')]||0x1f4;logger[_0x12a4('0x24')](_0x12a4('0x7f'),'getFields',_0x3d76a4,JSON[_0x12a4('0x23')](_0x125e8c));delete _0x125e8c[_0x12a4('0x34')];if(_0x3d76a4===0x191){_0x3d76a4=0x190;}_0x5cc631[_0x12a4('0x2a')](_0x3d76a4)[_0x12a4('0x35')](_0x5ce731[_0x12a4('0x3c')][_0x12a4('0x7d')]?{'message':_0x12a4('0x80'),'statusCode':_0x125e8c[_0x12a4('0x7e')]}:_0x125e8c);});}; \ No newline at end of file +var _0xe1aa=['title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','end','name','send','ZendeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','map','includeAll','include','findAll','show','params','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','Subjects','channel','ZendeskField','Descriptions','getFields','username','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','authType','password','headers','Basic\x20%s','toString','base64','%s/token:%s','Sequelize','ValidationError','subject','description','group','assignee','remove','includes','ticket_fields','position'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xe1aa,0xfc));var _0xae1a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe1aa[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0xae1a('0x0'));var emlformat=require(_0xae1a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xae1a('0x2'));var rp=require(_0xae1a('0x3'));var moment=require(_0xae1a('0x4'));var BPromise=require(_0xae1a('0x5'));var Mustache=require(_0xae1a('0x6'));var util=require('util');var path=require(_0xae1a('0x7'));var sox=require('sox');var csv=require(_0xae1a('0x8'));var ejs=require(_0xae1a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xae1a('0xa'));var jsforce=require(_0xae1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xae1a('0x8'));var querystring=require(_0xae1a('0xc'));var Papa=require('papaparse');var Redis=require(_0xae1a('0xd'));var authService=require(_0xae1a('0xe'));var qs=require(_0xae1a('0xf'));var as=require(_0xae1a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae1a('0x11'))(_0xae1a('0x12'));var utils=require('../../config/utils');var config=require(_0xae1a('0x13'));var licenseUtil=require(_0xae1a('0x14'));var db=require(_0xae1a('0x15'))['db'];var integrations=require(_0xae1a('0x16'));var jayson=require(_0xae1a('0x17'));var client=jayson[_0xae1a('0x18')][_0xae1a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x178163,_0x7f222f,_0x2f9390,_0x47ce8e){return new BPromise(function(_0x53dc19,_0x580f1c){var _0x52ea8a=_0x47ce8e||client;return _0x52ea8a[_0xae1a('0x1a')](_0x178163,_0x2f9390)[_0xae1a('0x1b')](function(_0x2eb725){logger[_0xae1a('0x1c')](_0xae1a('0x1d'),_0x7f222f,'request\x20sent');logger[_0xae1a('0x1e')](_0xae1a('0x1f'),_0x7f222f,'request\x20sent',JSON[_0xae1a('0x20')](_0x2eb725));if(_0x2eb725[_0xae1a('0x21')]){if(_0x2eb725[_0xae1a('0x21')][_0xae1a('0x22')]===0x1f4){logger[_0xae1a('0x21')](_0xae1a('0x1d'),_0x7f222f,_0x2eb725[_0xae1a('0x21')][_0xae1a('0x23')]);return _0x580f1c(_0x2eb725[_0xae1a('0x21')][_0xae1a('0x23')]);}logger['error'](_0xae1a('0x1d'),_0x7f222f,_0x2eb725[_0xae1a('0x21')][_0xae1a('0x23')]);return _0x53dc19(_0x2eb725[_0xae1a('0x21')][_0xae1a('0x23')]);}else{logger['info'](_0xae1a('0x1d'),_0x7f222f,_0xae1a('0x24'));_0x53dc19(_0x2eb725[_0xae1a('0x25')]['message']);}})[_0xae1a('0x26')](function(_0x146964){logger[_0xae1a('0x21')](_0xae1a('0x1d'),_0x7f222f,_0x146964);_0x580f1c(_0x146964);});});}function respondWithStatusCode(_0xb3e00d,_0x29a121){_0x29a121=_0x29a121||0xcc;return function(_0x5c5b60){if(_0x5c5b60){return _0xb3e00d[_0xae1a('0x27')](_0x29a121);}return _0xb3e00d['status'](_0x29a121)['end']();};}function respondWithResult(_0x112838,_0x2f13dc){_0x2f13dc=_0x2f13dc||0xc8;return function(_0x3907c6){if(_0x3907c6){return _0x112838[_0xae1a('0x28')](_0x2f13dc)[_0xae1a('0x29')](_0x3907c6);}};}function respondWithFilteredResult(_0x4ecb5b,_0x270e66){return function(_0x454142){if(_0x454142){var _0x29ed55=_0x454142[_0xae1a('0x2a')],_0x5e472d=_0x270e66[_0xae1a('0x2b')],_0x55e53b=_0x270e66['offset']+_0x270e66['limit'],_0x5e66da;if(_0x55e53b>=_0x29ed55){_0x55e53b=_0x29ed55;_0x5e66da=0xc8;}else{_0x5e66da=0xce;}_0x4ecb5b[_0xae1a('0x28')](_0x5e66da);return _0x4ecb5b[_0xae1a('0x2c')](_0xae1a('0x2d'),_0x5e472d+'-'+_0x55e53b+'/'+_0x29ed55)[_0xae1a('0x29')](_0x454142);}return null;};}function patchUpdates(_0x29fef2){return function(_0x6cec0e){try{jsonpatch[_0xae1a('0x2e')](_0x6cec0e,_0x29fef2,!![]);}catch(_0x564fca){return BPromise['reject'](_0x564fca);}return _0x6cec0e[_0xae1a('0x2f')]();};}function saveUpdates(_0x2e2d5e,_0x6eac43){return function(_0x4be759){if(_0x4be759){return _0x4be759[_0xae1a('0x30')](_0x2e2d5e)[_0xae1a('0x1b')](function(_0x1f6c4c){return _0x1f6c4c;});}return null;};}function removeEntity(_0x59ad9e,_0x2dcf41){return function(_0x10d50b){if(_0x10d50b){return _0x10d50b['destroy']()[_0xae1a('0x1b')](function(){_0x59ad9e[_0xae1a('0x28')](0xcc)[_0xae1a('0x31')]();});}};}function handleEntityNotFound(_0x112ee2,_0x5756ed){return function(_0x5c24ff){if(!_0x5c24ff){_0x112ee2['sendStatus'](0x194);}return _0x5c24ff;};}function handleError(_0x4e95d7,_0x18e8b6){_0x18e8b6=_0x18e8b6||0x1f4;return function(_0x4c3416){logger[_0xae1a('0x21')](_0x4c3416['stack']);if(_0x4c3416['name']){delete _0x4c3416[_0xae1a('0x32')];}_0x4e95d7[_0xae1a('0x28')](_0x18e8b6)[_0xae1a('0x33')](_0x4c3416);};}exports['index']=function(_0x412791,_0xffc156){var _0x14428a={},_0xcc01a7={},_0x511531={'count':0x0,'rows':[]};var _0x4b807f=_['map'](db[_0xae1a('0x34')][_0xae1a('0x35')],function(_0x5effca){return{'name':_0x5effca[_0xae1a('0x36')],'type':_0x5effca[_0xae1a('0x37')][_0xae1a('0x38')]};});_0xcc01a7[_0xae1a('0x39')]=_['map'](_0x4b807f,_0xae1a('0x32'));_0xcc01a7['query']=_[_0xae1a('0x3a')](_0x412791[_0xae1a('0x3b')]);_0xcc01a7[_0xae1a('0x3c')]=_[_0xae1a('0x3d')](_0xcc01a7[_0xae1a('0x39')],_0xcc01a7[_0xae1a('0x3b')]);_0x14428a[_0xae1a('0x3e')]=_['intersection'](_0xcc01a7[_0xae1a('0x39')],qs[_0xae1a('0x3f')](_0x412791[_0xae1a('0x3b')][_0xae1a('0x3f')]));_0x14428a[_0xae1a('0x3e')]=_0x14428a[_0xae1a('0x3e')][_0xae1a('0x40')]?_0x14428a['attributes']:_0xcc01a7['model'];if(!_0x412791[_0xae1a('0x3b')]['hasOwnProperty'](_0xae1a('0x41'))){_0x14428a[_0xae1a('0x42')]=qs[_0xae1a('0x42')](_0x412791[_0xae1a('0x3b')][_0xae1a('0x42')]);_0x14428a['offset']=qs['offset'](_0x412791[_0xae1a('0x3b')]['offset']);}_0x14428a[_0xae1a('0x43')]=qs[_0xae1a('0x44')](_0x412791['query'][_0xae1a('0x44')]);_0x14428a['where']=qs['filters'](_[_0xae1a('0x45')](_0x412791['query'],_0xcc01a7[_0xae1a('0x3c')]),_0x4b807f);if(_0x412791['query'][_0xae1a('0x46')]){_0x14428a[_0xae1a('0x47')]=_[_0xae1a('0x48')](_0x14428a[_0xae1a('0x47')],{'$or':_[_0xae1a('0x49')](_0x4b807f,function(_0x48cd32){if(_0x48cd32['type']!=='VIRTUAL'){var _0x583be5={};_0x583be5[_0x48cd32['name']]={'$like':'%'+_0x412791[_0xae1a('0x3b')][_0xae1a('0x46')]+'%'};return _0x583be5;}})});}_0x14428a=_['merge']({},_0x14428a,_0x412791['options']);var _0x4ef335={'where':_0x14428a[_0xae1a('0x47')]};return db[_0xae1a('0x34')][_0xae1a('0x2a')](_0x4ef335)[_0xae1a('0x1b')](function(_0x41fd75){_0x511531[_0xae1a('0x2a')]=_0x41fd75;if(_0x412791[_0xae1a('0x3b')][_0xae1a('0x4a')]){_0x14428a[_0xae1a('0x4b')]=[{'all':!![]}];}return db[_0xae1a('0x34')][_0xae1a('0x4c')](_0x14428a);})['then'](function(_0xa04f3b){_0x511531['rows']=_0xa04f3b;return _0x511531;})[_0xae1a('0x1b')](respondWithFilteredResult(_0xffc156,_0x14428a))[_0xae1a('0x26')](handleError(_0xffc156,null));};exports[_0xae1a('0x4d')]=function(_0x24017b,_0x1884b){var _0x4dfd5d={'raw':![],'where':{'id':_0x24017b[_0xae1a('0x4e')]['id']}},_0x44e53b={};_0x44e53b[_0xae1a('0x39')]=_['keys'](db['ZendeskAccount']['rawAttributes']);_0x44e53b[_0xae1a('0x3b')]=_[_0xae1a('0x3a')](_0x24017b['query']);_0x44e53b[_0xae1a('0x3c')]=_[_0xae1a('0x3d')](_0x44e53b['model'],_0x44e53b[_0xae1a('0x3b')]);_0x4dfd5d[_0xae1a('0x3e')]=_[_0xae1a('0x3d')](_0x44e53b['model'],qs[_0xae1a('0x3f')](_0x24017b['query']['fields']));_0x4dfd5d[_0xae1a('0x3e')]=_0x4dfd5d[_0xae1a('0x3e')][_0xae1a('0x40')]?_0x4dfd5d[_0xae1a('0x3e')]:_0x44e53b[_0xae1a('0x39')];if(_0x24017b[_0xae1a('0x3b')]['includeAll']){_0x4dfd5d[_0xae1a('0x4b')]=[{'all':!![]}];}_0x4dfd5d=_[_0xae1a('0x48')]({},_0x4dfd5d,_0x24017b[_0xae1a('0x4f')]);return db[_0xae1a('0x34')][_0xae1a('0x50')](_0x4dfd5d)[_0xae1a('0x1b')](handleEntityNotFound(_0x1884b,null))[_0xae1a('0x1b')](respondWithResult(_0x1884b,null))[_0xae1a('0x26')](handleError(_0x1884b,null));};exports[_0xae1a('0x51')]=function(_0x1c7974,_0x39ea9b){return db[_0xae1a('0x34')][_0xae1a('0x51')](_0x1c7974['body'],{})[_0xae1a('0x1b')](respondWithResult(_0x39ea9b,0xc9))[_0xae1a('0x26')](handleError(_0x39ea9b,null));};exports[_0xae1a('0x30')]=function(_0x5e9d35,_0x42e38d){if(_0x5e9d35[_0xae1a('0x52')]['id']){delete _0x5e9d35[_0xae1a('0x52')]['id'];}return db[_0xae1a('0x34')][_0xae1a('0x50')]({'where':{'id':_0x5e9d35[_0xae1a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x42e38d,null))[_0xae1a('0x1b')](saveUpdates(_0x5e9d35[_0xae1a('0x52')],null))['then'](respondWithResult(_0x42e38d,null))[_0xae1a('0x26')](handleError(_0x42e38d,null));};exports['destroy']=function(_0x1bb56b,_0x35bb5b){return db[_0xae1a('0x34')][_0xae1a('0x50')]({'where':{'id':_0x1bb56b[_0xae1a('0x4e')]['id']}})[_0xae1a('0x1b')](handleEntityNotFound(_0x35bb5b,null))['then'](removeEntity(_0x35bb5b,null))[_0xae1a('0x26')](handleError(_0x35bb5b,null));};exports[_0xae1a('0x53')]=function(_0x23d681,_0x47e645,_0xb4bf58){var _0x1abe8d={};var _0xf1b785={};var _0xaf494b;var _0x30eb01;return db[_0xae1a('0x34')][_0xae1a('0x54')]({'where':{'id':_0x23d681[_0xae1a('0x4e')]['id']}})[_0xae1a('0x1b')](handleEntityNotFound(_0x47e645,null))[_0xae1a('0x1b')](function(_0x57e5f7){if(_0x57e5f7){_0xaf494b=_0x57e5f7;_0xf1b785[_0xae1a('0x39')]=_[_0xae1a('0x3a')](db[_0xae1a('0x55')][_0xae1a('0x35')]);_0xf1b785[_0xae1a('0x3b')]=_[_0xae1a('0x3a')](_0x23d681[_0xae1a('0x3b')]);_0xf1b785[_0xae1a('0x3c')]=_[_0xae1a('0x3d')](_0xf1b785[_0xae1a('0x39')],_0xf1b785[_0xae1a('0x3b')]);_0x1abe8d[_0xae1a('0x3e')]=_[_0xae1a('0x3d')](_0xf1b785[_0xae1a('0x39')],qs[_0xae1a('0x3f')](_0x23d681[_0xae1a('0x3b')][_0xae1a('0x3f')]));_0x1abe8d[_0xae1a('0x3e')]=_0x1abe8d[_0xae1a('0x3e')]['length']?_0x1abe8d[_0xae1a('0x3e')]:_0xf1b785[_0xae1a('0x39')];_0x1abe8d[_0xae1a('0x43')]=qs['sort'](_0x23d681[_0xae1a('0x3b')]['sort']);_0x1abe8d[_0xae1a('0x47')]=qs[_0xae1a('0x3c')](_[_0xae1a('0x45')](_0x23d681[_0xae1a('0x3b')],_0xf1b785[_0xae1a('0x3c')]));if(_0x23d681[_0xae1a('0x3b')]['filter']){_0x1abe8d['where']=_[_0xae1a('0x48')](_0x1abe8d[_0xae1a('0x47')],{'$or':_[_0xae1a('0x49')](_0x1abe8d[_0xae1a('0x3e')],function(_0x5e2972){var _0x347b38={};_0x347b38[_0x5e2972]={'$like':'%'+_0x23d681[_0xae1a('0x3b')][_0xae1a('0x46')]+'%'};return _0x347b38;})});}_0x1abe8d=_[_0xae1a('0x48')]({},_0x1abe8d,_0x23d681[_0xae1a('0x4f')]);return _0xaf494b[_0xae1a('0x53')](_0x1abe8d);}})[_0xae1a('0x1b')](function(_0x42197d){if(_0x42197d){_0x30eb01=_0x42197d['length'];if(!_0x23d681[_0xae1a('0x3b')]['hasOwnProperty']('nolimit')){_0x1abe8d[_0xae1a('0x42')]=qs[_0xae1a('0x42')](_0x23d681[_0xae1a('0x3b')][_0xae1a('0x42')]);_0x1abe8d['offset']=qs['offset'](_0x23d681[_0xae1a('0x3b')][_0xae1a('0x2b')]);}return _0xaf494b[_0xae1a('0x53')](_0x1abe8d);}})[_0xae1a('0x1b')](function(_0x59ec71){if(_0x59ec71){return _0x59ec71?{'count':_0x30eb01,'rows':_0x59ec71}:null;}})[_0xae1a('0x1b')](respondWithResult(_0x47e645,null))[_0xae1a('0x26')](handleError(_0x47e645,null));};exports['addConfiguration']=function(_0x12aadf,_0x22198a,_0x4352d5){if(_0x12aadf[_0xae1a('0x52')]['id']){delete _0x12aadf[_0xae1a('0x52')]['id'];}return db[_0xae1a('0x34')][_0xae1a('0x54')]({'where':{'id':_0x12aadf[_0xae1a('0x4e')]['id']}})[_0xae1a('0x1b')](handleEntityNotFound(_0x22198a,null))[_0xae1a('0x1b')](function(_0x52b438){if(_0x52b438){_0x12aadf[_0xae1a('0x52')]['AccountId']=_0x52b438['id'];_0x12aadf[_0xae1a('0x52')][_0xae1a('0x56')]=integrations['getSubjects'](_0x12aadf['body'][_0xae1a('0x57')],_0x12aadf['body']['type']);_0x12aadf[_0xae1a('0x52')]['Descriptions']=integrations['getDescriptions'](_0x12aadf[_0xae1a('0x52')][_0xae1a('0x57')],_0x12aadf[_0xae1a('0x52')][_0xae1a('0x37')]);return db[_0xae1a('0x55')][_0xae1a('0x51')](_0x12aadf[_0xae1a('0x52')],{'include':[{'model':db[_0xae1a('0x58')],'as':_0xae1a('0x56')},{'model':db[_0xae1a('0x58')],'as':_0xae1a('0x59')}]});}return null;})[_0xae1a('0x1b')](respondWithResult(_0x22198a,null))['catch'](handleError(_0x22198a,null));};exports[_0xae1a('0x5a')]=function(_0xcac5c0,_0x43b980,_0x1f216a){var _0x1a3210='';return db[_0xae1a('0x34')][_0xae1a('0x54')]({'where':{'id':_0xcac5c0[_0xae1a('0x4e')]['id']},'attributes':['id',_0xae1a('0x5b'),'password',_0xae1a('0x5c'),'authType',_0xae1a('0x5d')]})[_0xae1a('0x1b')](handleEntityNotFound(_0x43b980,null))[_0xae1a('0x1b')](function(_0x40f978){if(_0x40f978){_0x1a3210=_0x40f978[_0xae1a('0x5d')];var _0x5c6727=_0x1a3210[_0xae1a('0x5e')](-0x1);if(_0x5c6727==='/'){_0x1a3210=_0x1a3210[_0xae1a('0x5f')](0x0,_0x1a3210[_0xae1a('0x60')](_0x5c6727));}var _0x277e08={'method':_0xae1a('0x61'),'uri':util[_0xae1a('0x62')](_0xae1a('0x63'),_0x1a3210,'ticket_fields'),'json':!![]};switch(_0x40f978[_0xae1a('0x64')]){case _0xae1a('0x65'):_0x277e08[_0xae1a('0x66')]={'Authorization':util[_0xae1a('0x62')](_0xae1a('0x67'),new Buffer(util['format']('%s:%s',_0x40f978[_0xae1a('0x5b')],_0x40f978[_0xae1a('0x65')]))[_0xae1a('0x68')](_0xae1a('0x69')))};break;case'token':_0x277e08[_0xae1a('0x66')]={'Authorization':util['format'](_0xae1a('0x67'),new Buffer(util['format'](_0xae1a('0x6a'),_0x40f978[_0xae1a('0x5b')],_0x40f978[_0xae1a('0x5c')]))['toString'](_0xae1a('0x69')))};break;default:throw new db[(_0xae1a('0x6b'))][(_0xae1a('0x6c'))]('Unknown\x20authentication\x20type');}return rp(_0x277e08);}})[_0xae1a('0x1b')](function(_0x56dc33){if(_0x56dc33){var _0x37e90b=[_0xae1a('0x6d'),_0xae1a('0x6e'),_0xae1a('0x6f'),_0xae1a('0x70')];_[_0xae1a('0x71')](_0x56dc33['ticket_fields'],function(_0x189db9){return _0x37e90b[_0xae1a('0x72')](_0x189db9[_0xae1a('0x37')]);});return{'count':_0x56dc33[_0xae1a('0x73')]['length'],'rows':_[_0xae1a('0x49')](_0x56dc33['ticket_fields'],function(_0x1ce796){return{'id':_0x1ce796['id'],'name':_0x1ce796[_0xae1a('0x74')]>0x7?_0x1ce796[_0xae1a('0x75')]:_0x1ce796[_0xae1a('0x37')],'custom':_0x1ce796[_0xae1a('0x74')]>0x7?!![]:![],'options':_0x1ce796[_0xae1a('0x76')]?_0x1ce796['system_field_options']:_0x1ce796[_0xae1a('0x77')]?_0x1ce796[_0xae1a('0x77')]:[]};})};}})['then'](respondWithResult(_0x43b980,null))[_0xae1a('0x26')](function(_0x5c2f16){var _0x49d32f=_0xcac5c0['query']['test']?0x1f4:_0x5c2f16[_0xae1a('0x78')]||0x1f4;logger['error'](_0xae1a('0x79'),_0xae1a('0x5a'),_0x49d32f,JSON[_0xae1a('0x20')](_0x5c2f16));delete _0x5c2f16['name'];if(_0x49d32f===0x191){_0x49d32f=0x190;}_0x43b980[_0xae1a('0x28')](_0x49d32f)[_0xae1a('0x33')](_0xcac5c0[_0xae1a('0x3b')]['test']?{'message':_0xae1a('0x7a'),'statusCode':_0x5c2f16[_0xae1a('0x78')]}:_0x5c2f16);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 5bdc3f5..7280df1 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 _0x0dea=['./intZendeskAccount.attributes','exports','define','int_zendesk_accounts','lodash','../../config/logger','request-promise','path','rimraf'];(function(_0x4b0830,_0x2e3b0a){var _0x1f53a7=function(_0x4b5503){while(--_0x4b5503){_0x4b0830['push'](_0x4b0830['shift']());}};_0x1f53a7(++_0x2e3b0a);}(_0x0dea,0x15a));var _0xa0de=function(_0x946e1b,_0x4f9f57){_0x946e1b=_0x946e1b-0x0;var _0x4db99b=_0x0dea[_0x946e1b];return _0x4db99b;};'use strict';var _=require(_0xa0de('0x0'));var util=require('util');var logger=require(_0xa0de('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa0de('0x2'));var fs=require('fs');var path=require(_0xa0de('0x3'));var rimraf=require(_0xa0de('0x4'));var config=require('../../config/environment');var attributes=require(_0xa0de('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xa0de('0x6')]=function(_0x5d38e0,_0x445311){return _0x5d38e0[_0xa0de('0x7')]('ZendeskAccount',attributes,{'tableName':_0xa0de('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5a6=['exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x54f6e5,_0x110d77){var _0x5e3f9d=function(_0x8eb4c9){while(--_0x8eb4c9){_0x54f6e5['push'](_0x54f6e5['shift']());}};_0x5e3f9d(++_0x110d77);}(_0xe5a6,0x74));var _0x6e5a=function(_0x57d3d9,_0x2d605b){_0x57d3d9=_0x57d3d9-0x0;var _0x46730c=_0xe5a6[_0x57d3d9];return _0x46730c;};'use strict';var _=require(_0x6e5a('0x0'));var util=require(_0x6e5a('0x1'));var logger=require(_0x6e5a('0x2'))(_0x6e5a('0x3'));var moment=require(_0x6e5a('0x4'));var BPromise=require(_0x6e5a('0x5'));var rp=require(_0x6e5a('0x6'));var fs=require('fs');var path=require(_0x6e5a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e5a('0x8'));var integrations=require(_0x6e5a('0x9'));module[_0x6e5a('0xa')]=function(_0x328739,_0x5d981b){return _0x328739[_0x6e5a('0xb')](_0x6e5a('0xc'),attributes,{'tableName':_0x6e5a('0xd'),'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 cb12f37..7a752c3 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 _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0xfb39a3,_0x456e01){var _0xc0115e=function(_0x4c95bb){while(--_0x4c95bb){_0xfb39a3['push'](_0xfb39a3['shift']());}};_0xc0115e(++_0x456e01);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file +var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x102bdb,_0x4736a7){var _0x3ab211=function(_0x31a4af){while(--_0x31a4af){_0x102bdb['push'](_0x102bdb['shift']());}};_0x3ab211(++_0x4736a7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 93ec5cd..9afa557 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 _0xb66d=['index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated'];(function(_0x28470a,_0xb93ef8){var _0x53e44d=function(_0x23d579){while(--_0x23d579){_0x28470a['push'](_0x28470a['shift']());}};_0x53e44d(++_0xb93ef8);}(_0xb66d,0x199));var _0xdb66=function(_0x1ec65c,_0x354923){_0x1ec65c=_0x1ec65c-0x0;var _0x5249c2=_0xb66d[_0x1ec65c];return _0x5249c2;};'use strict';var multer=require(_0xdb66('0x0'));var util=require(_0xdb66('0x1'));var path=require(_0xdb66('0x2'));var timeout=require(_0xdb66('0x3'));var express=require('express');var router=express[_0xdb66('0x4')]();var auth=require(_0xdb66('0x5'));var interaction=require(_0xdb66('0x6'));var config=require(_0xdb66('0x7'));var controller=require(_0xdb66('0x8'));router[_0xdb66('0x9')]('/',auth[_0xdb66('0xa')](),controller[_0xdb66('0xb')]);router[_0xdb66('0x9')](_0xdb66('0xc'),auth[_0xdb66('0xa')](),controller[_0xdb66('0xd')]);router[_0xdb66('0x9')](_0xdb66('0xe'),auth[_0xdb66('0xa')](),controller['getFields']);router[_0xdb66('0x9')](_0xdb66('0xf'),auth[_0xdb66('0xa')](),controller[_0xdb66('0x10')]);router[_0xdb66('0x9')](_0xdb66('0x11'),auth[_0xdb66('0xa')](),controller[_0xdb66('0x12')]);router[_0xdb66('0x9')](_0xdb66('0x13'),auth['isAuthenticated'](),controller[_0xdb66('0x14')]);router[_0xdb66('0x15')]('/',auth[_0xdb66('0xa')](),controller[_0xdb66('0x16')]);router[_0xdb66('0x15')](_0xdb66('0x13'),auth['isAuthenticated'](),controller[_0xdb66('0x17')]);router[_0xdb66('0x18')](_0xdb66('0xc'),auth[_0xdb66('0xa')](),controller[_0xdb66('0x19')]);router[_0xdb66('0x1a')](_0xdb66('0xc'),auth[_0xdb66('0xa')](),controller[_0xdb66('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xa811=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getSubjects','/:id/tags','post','create','setTags','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x596284,_0x1cd02b){var _0x5313c6=function(_0x77db49){while(--_0x77db49){_0x596284['push'](_0x596284['shift']());}};_0x5313c6(++_0x1cd02b);}(_0xa811,0x1de));var _0x1a81=function(_0x4d198c,_0x1a4fe2){_0x4d198c=_0x4d198c-0x0;var _0x4f5901=_0xa811[_0x4d198c];return _0x4f5901;};'use strict';var multer=require(_0x1a81('0x0'));var util=require(_0x1a81('0x1'));var path=require(_0x1a81('0x2'));var timeout=require(_0x1a81('0x3'));var express=require(_0x1a81('0x4'));var router=express[_0x1a81('0x5')]();var auth=require(_0x1a81('0x6'));var interaction=require(_0x1a81('0x7'));var config=require(_0x1a81('0x8'));var controller=require(_0x1a81('0x9'));router[_0x1a81('0xa')]('/',auth[_0x1a81('0xb')](),controller['index']);router['get'](_0x1a81('0xc'),auth['isAuthenticated'](),controller[_0x1a81('0xd')]);router[_0x1a81('0xa')]('/:id/fields',auth[_0x1a81('0xb')](),controller[_0x1a81('0xe')]);router[_0x1a81('0xa')]('/:id/subjects',auth[_0x1a81('0xb')](),controller[_0x1a81('0xf')]);router[_0x1a81('0xa')]('/:id/descriptions',auth[_0x1a81('0xb')](),controller['getDescriptions']);router[_0x1a81('0xa')](_0x1a81('0x10'),auth[_0x1a81('0xb')](),controller['getTags']);router[_0x1a81('0x11')]('/',auth[_0x1a81('0xb')](),controller[_0x1a81('0x12')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0x1a81('0x13')]);router['put'](_0x1a81('0xc'),auth[_0x1a81('0xb')](),controller['update']);router[_0x1a81('0x14')](_0x1a81('0xc'),auth[_0x1a81('0xb')](),controller[_0x1a81('0x15')]);module[_0x1a81('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d08fe07..979fb41 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 _0x4eb8=['STRING','exports'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x4eb8,0x163));var _0x84eb=function(_0x227427,_0x39a41d){_0x227427=_0x227427-0x0;var _0x2f3aef=_0x4eb8[_0x227427];return _0x2f3aef;};'use strict';var Sequelize=require('sequelize');module[_0x84eb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x84eb('0x1')]}}; \ No newline at end of file +var _0xf353=['sequelize','exports','STRING'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0xf353,0x17a));var _0x3f35=function(_0x8326f6,_0x2e6213){_0x8326f6=_0x8326f6-0x0;var _0x59fae6=_0xf353[_0x8326f6];return _0x59fae6;};'use strict';var Sequelize=require(_0x3f35('0x0'));module[_0x3f35('0x1')]={'name':{'type':Sequelize[_0x3f35('0x2')]},'description':{'type':Sequelize[_0x3f35('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 146924f..1409b07 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 _0x1bae=['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','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','stack','name','index','ZendeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','count','includeAll','include','rows','params','attributes','length','find','create','update','body','findOne','ZendeskField','options','getFields','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x16727b,_0x3d7f6a){var _0x560ece=function(_0x3a6e6a){while(--_0x3a6e6a){_0x16727b['push'](_0x16727b['shift']());}};_0x560ece(++_0x3d7f6a);}(_0x1bae,0xb3));var _0xe1ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bae[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xe1ba('0x0'));var emlformat=require(_0xe1ba('0x1'));var rimraf=require(_0xe1ba('0x2'));var zipdir=require(_0xe1ba('0x3'));var jsonpatch=require(_0xe1ba('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe1ba('0x5'));var util=require(_0xe1ba('0x6'));var path=require('path');var sox=require(_0xe1ba('0x7'));var csv=require(_0xe1ba('0x8'));var ejs=require(_0xe1ba('0x9'));var fs=require('fs');var _=require(_0xe1ba('0xa'));var squel=require(_0xe1ba('0xb'));var crypto=require(_0xe1ba('0xc'));var jsforce=require(_0xe1ba('0xd'));var deskjs=require(_0xe1ba('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe1ba('0xf'));var Redis=require(_0xe1ba('0x10'));var authService=require(_0xe1ba('0x11'));var qs=require(_0xe1ba('0x12'));var as=require(_0xe1ba('0x13'));var hardwareService=require(_0xe1ba('0x14'));var logger=require(_0xe1ba('0x15'))(_0xe1ba('0x16'));var utils=require(_0xe1ba('0x17'));var config=require(_0xe1ba('0x18'));var licenseUtil=require(_0xe1ba('0x19'));var db=require(_0xe1ba('0x1a'))['db'];var jayson=require(_0xe1ba('0x1b'));var client=jayson[_0xe1ba('0x1c')][_0xe1ba('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x130021,_0x27303e,_0x59b382,_0x36d951){return new BPromise(function(_0x19a591,_0x586410){var _0x3c315a=_0x36d951||client;return _0x3c315a[_0xe1ba('0x1e')](_0x130021,_0x59b382)[_0xe1ba('0x1f')](function(_0x3502b1){logger['info'](_0xe1ba('0x20'),_0x27303e,'request\x20sent');logger[_0xe1ba('0x21')](_0xe1ba('0x22'),_0x27303e,_0xe1ba('0x23'),JSON[_0xe1ba('0x24')](_0x3502b1));if(_0x3502b1['error']){if(_0x3502b1[_0xe1ba('0x25')][_0xe1ba('0x26')]===0x1f4){logger[_0xe1ba('0x25')](_0xe1ba('0x20'),_0x27303e,_0x3502b1[_0xe1ba('0x25')][_0xe1ba('0x27')]);return _0x586410(_0x3502b1[_0xe1ba('0x25')]['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x27303e,_0x3502b1['error']['message']);return _0x19a591(_0x3502b1[_0xe1ba('0x25')][_0xe1ba('0x27')]);}else{logger[_0xe1ba('0x28')](_0xe1ba('0x20'),_0x27303e,_0xe1ba('0x23'));_0x19a591(_0x3502b1[_0xe1ba('0x29')][_0xe1ba('0x27')]);}})[_0xe1ba('0x2a')](function(_0x14d38b){logger['error'](_0xe1ba('0x20'),_0x27303e,_0x14d38b);_0x586410(_0x14d38b);});});}function respondWithStatusCode(_0x51bb4e,_0x21bd1c){_0x21bd1c=_0x21bd1c||0xcc;return function(_0x5d0e2e){if(_0x5d0e2e){return _0x51bb4e[_0xe1ba('0x2b')](_0x21bd1c);}return _0x51bb4e[_0xe1ba('0x2c')](_0x21bd1c)[_0xe1ba('0x2d')]();};}function respondWithResult(_0x2bd894,_0x3be623){_0x3be623=_0x3be623||0xc8;return function(_0x49fa57){if(_0x49fa57){return _0x2bd894['status'](_0x3be623)[_0xe1ba('0x2e')](_0x49fa57);}};}function respondWithFilteredResult(_0x37c767,_0x271813){return function(_0x40ed9e){if(_0x40ed9e){var _0x82fe3d=_0x40ed9e['count'],_0x39593e=_0x271813[_0xe1ba('0x2f')],_0x2e8dad=_0x271813[_0xe1ba('0x2f')]+_0x271813[_0xe1ba('0x30')],_0x51dfce;if(_0x2e8dad>=_0x82fe3d){_0x2e8dad=_0x82fe3d;_0x51dfce=0xc8;}else{_0x51dfce=0xce;}_0x37c767[_0xe1ba('0x2c')](_0x51dfce);return _0x37c767[_0xe1ba('0x31')](_0xe1ba('0x32'),_0x39593e+'-'+_0x2e8dad+'/'+_0x82fe3d)['json'](_0x40ed9e);}return null;};}function patchUpdates(_0x3c7622){return function(_0x1361dc){try{jsonpatch['apply'](_0x1361dc,_0x3c7622,!![]);}catch(_0x3b4eb3){return BPromise[_0xe1ba('0x33')](_0x3b4eb3);}return _0x1361dc['save']();};}function saveUpdates(_0x2dd5bc,_0x2a6814){return function(_0x24fef7){if(_0x24fef7){return _0x24fef7['update'](_0x2dd5bc)[_0xe1ba('0x1f')](function(_0x3e350f){return _0x3e350f;});}return null;};}function removeEntity(_0x5c7e8a,_0x1d3d2e){return function(_0x477afc){if(_0x477afc){return _0x477afc['destroy']()[_0xe1ba('0x1f')](function(){_0x5c7e8a[_0xe1ba('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x461bde,_0x594c53){return function(_0xbf5d45){if(!_0xbf5d45){_0x461bde[_0xe1ba('0x2b')](0x194);}return _0xbf5d45;};}function handleError(_0x217ca6,_0xfa817b){_0xfa817b=_0xfa817b||0x1f4;return function(_0x24dbe4){logger[_0xe1ba('0x25')](_0x24dbe4[_0xe1ba('0x34')]);if(_0x24dbe4[_0xe1ba('0x35')]){delete _0x24dbe4[_0xe1ba('0x35')];}_0x217ca6[_0xe1ba('0x2c')](_0xfa817b)['send'](_0x24dbe4);};}exports[_0xe1ba('0x36')]=function(_0x15cbfb,_0x1f9acc){var _0x3e9391={},_0x43d2c8={},_0x188afa={'count':0x0,'rows':[]};var _0x4541e8=_['map'](db[_0xe1ba('0x37')][_0xe1ba('0x38')],function(_0xe8ba30){return{'name':_0xe8ba30[_0xe1ba('0x39')],'type':_0xe8ba30[_0xe1ba('0x3a')]['key']};});_0x43d2c8['model']=_['map'](_0x4541e8,_0xe1ba('0x35'));_0x43d2c8[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x15cbfb[_0xe1ba('0x3b')]);_0x43d2c8[_0xe1ba('0x3d')]=_[_0xe1ba('0x3e')](_0x43d2c8[_0xe1ba('0x3f')],_0x43d2c8[_0xe1ba('0x3b')]);_0x3e9391['attributes']=_[_0xe1ba('0x3e')](_0x43d2c8[_0xe1ba('0x3f')],qs['fields'](_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x3e9391['attributes']=_0x3e9391['attributes']['length']?_0x3e9391['attributes']:_0x43d2c8[_0xe1ba('0x3f')];if(!_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x41')]('nolimit')){_0x3e9391['limit']=qs[_0xe1ba('0x30')](_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x30')]);_0x3e9391[_0xe1ba('0x2f')]=qs[_0xe1ba('0x2f')](_0x15cbfb['query'][_0xe1ba('0x2f')]);}_0x3e9391[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x15cbfb[_0xe1ba('0x3b')]['sort']);_0x3e9391[_0xe1ba('0x44')]=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x15cbfb['query'],_0x43d2c8[_0xe1ba('0x3d')]),_0x4541e8);if(_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x46')]){_0x3e9391[_0xe1ba('0x44')]=_[_0xe1ba('0x47')](_0x3e9391[_0xe1ba('0x44')],{'$or':_[_0xe1ba('0x48')](_0x4541e8,function(_0x39ba71){if(_0x39ba71[_0xe1ba('0x3a')]!==_0xe1ba('0x49')){var _0xa567d1={};_0xa567d1[_0x39ba71['name']]={'$like':'%'+_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0xa567d1;}})});}_0x3e9391=_[_0xe1ba('0x47')]({},_0x3e9391,_0x15cbfb['options']);var _0x5f4b6e={'where':_0x3e9391[_0xe1ba('0x44')]};return db[_0xe1ba('0x37')][_0xe1ba('0x4a')](_0x5f4b6e)[_0xe1ba('0x1f')](function(_0x190e48){_0x188afa[_0xe1ba('0x4a')]=_0x190e48;if(_0x15cbfb[_0xe1ba('0x3b')][_0xe1ba('0x4b')]){_0x3e9391[_0xe1ba('0x4c')]=[{'all':!![]}];}return db[_0xe1ba('0x37')]['findAll'](_0x3e9391);})[_0xe1ba('0x1f')](function(_0x5343e0){_0x188afa[_0xe1ba('0x4d')]=_0x5343e0;return _0x188afa;})[_0xe1ba('0x1f')](respondWithFilteredResult(_0x1f9acc,_0x3e9391))[_0xe1ba('0x2a')](handleError(_0x1f9acc,null));};exports['show']=function(_0x15812c,_0x4c11ee){var _0x9f589={'raw':![],'where':{'id':_0x15812c[_0xe1ba('0x4e')]['id']}},_0xeb85b1={};_0xeb85b1['model']=_['keys'](db['ZendeskConfiguration'][_0xe1ba('0x38')]);_0xeb85b1[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x15812c[_0xe1ba('0x3b')]);_0xeb85b1[_0xe1ba('0x3d')]=_[_0xe1ba('0x3e')](_0xeb85b1[_0xe1ba('0x3f')],_0xeb85b1[_0xe1ba('0x3b')]);_0x9f589[_0xe1ba('0x4f')]=_[_0xe1ba('0x3e')](_0xeb85b1[_0xe1ba('0x3f')],qs[_0xe1ba('0x40')](_0x15812c[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x9f589['attributes']=_0x9f589[_0xe1ba('0x4f')][_0xe1ba('0x50')]?_0x9f589['attributes']:_0xeb85b1[_0xe1ba('0x3f')];if(_0x15812c[_0xe1ba('0x3b')][_0xe1ba('0x4b')]){_0x9f589['include']=[{'all':!![]}];}_0x9f589=_[_0xe1ba('0x47')]({},_0x9f589,_0x15812c['options']);return db[_0xe1ba('0x37')][_0xe1ba('0x51')](_0x9f589)[_0xe1ba('0x1f')](handleEntityNotFound(_0x4c11ee,null))[_0xe1ba('0x1f')](respondWithResult(_0x4c11ee,null))[_0xe1ba('0x2a')](handleError(_0x4c11ee,null));};exports[_0xe1ba('0x52')]=function(_0x211241,_0x10585b){return db[_0xe1ba('0x37')][_0xe1ba('0x52')](_0x211241['body'],{})['then'](respondWithResult(_0x10585b,0xc9))[_0xe1ba('0x2a')](handleError(_0x10585b,null));};exports[_0xe1ba('0x53')]=function(_0x22b540,_0x74f8b1){if(_0x22b540[_0xe1ba('0x54')]['id']){delete _0x22b540[_0xe1ba('0x54')]['id'];}return db[_0xe1ba('0x37')]['find']({'where':{'id':_0x22b540[_0xe1ba('0x4e')]['id']}})['then'](handleEntityNotFound(_0x74f8b1,null))['then'](saveUpdates(_0x22b540['body'],null))['then'](respondWithResult(_0x74f8b1,null))['catch'](handleError(_0x74f8b1,null));};exports['destroy']=function(_0x2996f3,_0x91bd11){return db[_0xe1ba('0x37')][_0xe1ba('0x51')]({'where':{'id':_0x2996f3[_0xe1ba('0x4e')]['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x91bd11,null))[_0xe1ba('0x1f')](removeEntity(_0x91bd11,null))[_0xe1ba('0x2a')](handleError(_0x91bd11,null));};exports['getFields']=function(_0x3a8ded,_0x257760,_0x12ea6f){var _0x244e8e={};var _0x59546e={};var _0x21c82e;var _0x11fba1;return db['ZendeskConfiguration'][_0xe1ba('0x55')]({'where':{'id':_0x3a8ded['params']['id']}})['then'](handleEntityNotFound(_0x257760,null))[_0xe1ba('0x1f')](function(_0x6a3f8f){if(_0x6a3f8f){_0x21c82e=_0x6a3f8f;_0x59546e[_0xe1ba('0x3f')]=_[_0xe1ba('0x3c')](db[_0xe1ba('0x56')]['rawAttributes']);_0x59546e['query']=_[_0xe1ba('0x3c')](_0x3a8ded[_0xe1ba('0x3b')]);_0x59546e[_0xe1ba('0x3d')]=_['intersection'](_0x59546e[_0xe1ba('0x3f')],_0x59546e[_0xe1ba('0x3b')]);_0x244e8e['attributes']=_[_0xe1ba('0x3e')](_0x59546e[_0xe1ba('0x3f')],qs['fields'](_0x3a8ded[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x244e8e[_0xe1ba('0x4f')]=_0x244e8e[_0xe1ba('0x4f')][_0xe1ba('0x50')]?_0x244e8e[_0xe1ba('0x4f')]:_0x59546e[_0xe1ba('0x3f')];_0x244e8e[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x3a8ded[_0xe1ba('0x3b')][_0xe1ba('0x43')]);_0x244e8e['where']=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x3a8ded['query'],_0x59546e[_0xe1ba('0x3d')]));if(_0x3a8ded[_0xe1ba('0x3b')]['filter']){_0x244e8e[_0xe1ba('0x44')]=_[_0xe1ba('0x47')](_0x244e8e[_0xe1ba('0x44')],{'$or':_[_0xe1ba('0x48')](_0x244e8e['attributes'],function(_0x732fa4){var _0x3f6b6d={};_0x3f6b6d[_0x732fa4]={'$like':'%'+_0x3a8ded[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x3f6b6d;})});}_0x244e8e=_[_0xe1ba('0x47')]({},_0x244e8e,_0x3a8ded[_0xe1ba('0x57')]);return _0x21c82e[_0xe1ba('0x58')](_0x244e8e);}})[_0xe1ba('0x1f')](function(_0x26be7f){if(_0x26be7f){_0x11fba1=_0x26be7f[_0xe1ba('0x50')];if(!_0x3a8ded[_0xe1ba('0x3b')][_0xe1ba('0x41')](_0xe1ba('0x59'))){_0x244e8e[_0xe1ba('0x30')]=qs[_0xe1ba('0x30')](_0x3a8ded['query'][_0xe1ba('0x30')]);_0x244e8e[_0xe1ba('0x2f')]=qs[_0xe1ba('0x2f')](_0x3a8ded['query']['offset']);}return _0x21c82e[_0xe1ba('0x58')](_0x244e8e);}})[_0xe1ba('0x1f')](function(_0x58d4d7){if(_0x58d4d7){return _0x58d4d7?{'count':_0x11fba1,'rows':_0x58d4d7}:null;}})[_0xe1ba('0x1f')](respondWithResult(_0x257760,null))[_0xe1ba('0x2a')](handleError(_0x257760,null));};exports[_0xe1ba('0x5a')]=function(_0x3f487b,_0x4727fa,_0x35c477){var _0x1252df={};var _0x202ec1={};var _0x1bfd97;var _0x19d8d7;return db[_0xe1ba('0x37')]['findOne']({'where':{'id':_0x3f487b['params']['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x4727fa,null))[_0xe1ba('0x1f')](function(_0x30f5a1){if(_0x30f5a1){_0x1bfd97=_0x30f5a1;_0x202ec1['model']=_[_0xe1ba('0x3c')](db['ZendeskField'][_0xe1ba('0x38')]);_0x202ec1['query']=_[_0xe1ba('0x3c')](_0x3f487b[_0xe1ba('0x3b')]);_0x202ec1[_0xe1ba('0x3d')]=_['intersection'](_0x202ec1[_0xe1ba('0x3f')],_0x202ec1[_0xe1ba('0x3b')]);_0x1252df['attributes']=_['intersection'](_0x202ec1[_0xe1ba('0x3f')],qs['fields'](_0x3f487b['query'][_0xe1ba('0x40')]));_0x1252df['attributes']=_0x1252df[_0xe1ba('0x4f')][_0xe1ba('0x50')]?_0x1252df[_0xe1ba('0x4f')]:_0x202ec1[_0xe1ba('0x3f')];_0x1252df[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x3f487b['query']['sort']);_0x1252df[_0xe1ba('0x44')]=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x3f487b['query'],_0x202ec1[_0xe1ba('0x3d')]));if(_0x3f487b['query']['filter']){_0x1252df[_0xe1ba('0x44')]=_[_0xe1ba('0x47')](_0x1252df['where'],{'$or':_['map'](_0x1252df[_0xe1ba('0x4f')],function(_0x533da8){var _0x1b3768={};_0x1b3768[_0x533da8]={'$like':'%'+_0x3f487b[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x1b3768;})});}_0x1252df=_['merge']({},_0x1252df,_0x3f487b[_0xe1ba('0x57')]);return _0x1bfd97[_0xe1ba('0x5a')](_0x1252df);}})[_0xe1ba('0x1f')](function(_0x440f53){if(_0x440f53){_0x19d8d7=_0x440f53['length'];if(!_0x3f487b[_0xe1ba('0x3b')][_0xe1ba('0x41')](_0xe1ba('0x59'))){_0x1252df[_0xe1ba('0x30')]=qs['limit'](_0x3f487b[_0xe1ba('0x3b')][_0xe1ba('0x30')]);_0x1252df[_0xe1ba('0x2f')]=qs[_0xe1ba('0x2f')](_0x3f487b[_0xe1ba('0x3b')][_0xe1ba('0x2f')]);}return _0x1bfd97[_0xe1ba('0x5a')](_0x1252df);}})[_0xe1ba('0x1f')](function(_0x24849b){if(_0x24849b){return _0x24849b?{'count':_0x19d8d7,'rows':_0x24849b}:null;}})[_0xe1ba('0x1f')](respondWithResult(_0x4727fa,null))[_0xe1ba('0x2a')](handleError(_0x4727fa,null));};exports[_0xe1ba('0x5b')]=function(_0x277a69,_0x4ebfcb,_0x673aa9){var _0x1a6092={};var _0x4ae0a6={};var _0x14b119;var _0x50d849;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x277a69[_0xe1ba('0x4e')]['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x4ebfcb,null))['then'](function(_0x41ffc7){if(_0x41ffc7){_0x14b119=_0x41ffc7;_0x4ae0a6[_0xe1ba('0x3f')]=_['keys'](db[_0xe1ba('0x56')][_0xe1ba('0x38')]);_0x4ae0a6[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x277a69[_0xe1ba('0x3b')]);_0x4ae0a6[_0xe1ba('0x3d')]=_[_0xe1ba('0x3e')](_0x4ae0a6[_0xe1ba('0x3f')],_0x4ae0a6['query']);_0x1a6092[_0xe1ba('0x4f')]=_[_0xe1ba('0x3e')](_0x4ae0a6[_0xe1ba('0x3f')],qs['fields'](_0x277a69[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x1a6092[_0xe1ba('0x4f')]=_0x1a6092[_0xe1ba('0x4f')][_0xe1ba('0x50')]?_0x1a6092[_0xe1ba('0x4f')]:_0x4ae0a6[_0xe1ba('0x3f')];_0x1a6092[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x277a69[_0xe1ba('0x3b')]['sort']);_0x1a6092[_0xe1ba('0x44')]=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x277a69['query'],_0x4ae0a6['filters']));if(_0x277a69['query'][_0xe1ba('0x46')]){_0x1a6092[_0xe1ba('0x44')]=_[_0xe1ba('0x47')](_0x1a6092[_0xe1ba('0x44')],{'$or':_['map'](_0x1a6092[_0xe1ba('0x4f')],function(_0x4fae13){var _0x46d476={};_0x46d476[_0x4fae13]={'$like':'%'+_0x277a69[_0xe1ba('0x3b')][_0xe1ba('0x46')]+'%'};return _0x46d476;})});}_0x1a6092=_[_0xe1ba('0x47')]({},_0x1a6092,_0x277a69[_0xe1ba('0x57')]);return _0x14b119[_0xe1ba('0x5b')](_0x1a6092);}})[_0xe1ba('0x1f')](function(_0x1493a1){if(_0x1493a1){_0x50d849=_0x1493a1[_0xe1ba('0x50')];if(!_0x277a69['query'][_0xe1ba('0x41')](_0xe1ba('0x59'))){_0x1a6092[_0xe1ba('0x30')]=qs[_0xe1ba('0x30')](_0x277a69[_0xe1ba('0x3b')][_0xe1ba('0x30')]);_0x1a6092[_0xe1ba('0x2f')]=qs[_0xe1ba('0x2f')](_0x277a69['query'][_0xe1ba('0x2f')]);}return _0x14b119[_0xe1ba('0x5b')](_0x1a6092);}})['then'](function(_0x3ab59d){if(_0x3ab59d){return _0x3ab59d?{'count':_0x50d849,'rows':_0x3ab59d}:null;}})[_0xe1ba('0x1f')](respondWithResult(_0x4ebfcb,null))['catch'](handleError(_0x4ebfcb,null));};exports[_0xe1ba('0x5c')]=function(_0x322d51,_0x8b3a01,_0x345a54){var _0x31d96b={};var _0x28ce4c={};var _0x1b99fe;var _0x17ba72;return db[_0xe1ba('0x37')][_0xe1ba('0x55')]({'where':{'id':_0x322d51[_0xe1ba('0x4e')]['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x8b3a01,null))[_0xe1ba('0x1f')](function(_0x3bf3c0){if(_0x3bf3c0){_0x1b99fe=_0x3bf3c0;_0x28ce4c[_0xe1ba('0x3f')]=_[_0xe1ba('0x3c')](db[_0xe1ba('0x5d')]['rawAttributes']);_0x28ce4c[_0xe1ba('0x3b')]=_[_0xe1ba('0x3c')](_0x322d51[_0xe1ba('0x3b')]);_0x28ce4c[_0xe1ba('0x3d')]=_['intersection'](_0x28ce4c[_0xe1ba('0x3f')],_0x28ce4c[_0xe1ba('0x3b')]);_0x31d96b[_0xe1ba('0x4f')]=_[_0xe1ba('0x3e')](_0x28ce4c['model'],qs[_0xe1ba('0x40')](_0x322d51[_0xe1ba('0x3b')][_0xe1ba('0x40')]));_0x31d96b[_0xe1ba('0x4f')]=_0x31d96b['attributes'][_0xe1ba('0x50')]?_0x31d96b['attributes']:_0x28ce4c[_0xe1ba('0x3f')];_0x31d96b[_0xe1ba('0x42')]=qs[_0xe1ba('0x43')](_0x322d51[_0xe1ba('0x3b')][_0xe1ba('0x43')]);_0x31d96b[_0xe1ba('0x44')]=qs[_0xe1ba('0x3d')](_[_0xe1ba('0x45')](_0x322d51[_0xe1ba('0x3b')],_0x28ce4c[_0xe1ba('0x3d')]));if(_0x322d51[_0xe1ba('0x3b')][_0xe1ba('0x46')]){_0x31d96b['where']=_[_0xe1ba('0x47')](_0x31d96b['where'],{'$or':_[_0xe1ba('0x48')](_0x31d96b[_0xe1ba('0x4f')],function(_0x1b4c49){var _0x45c7c5={};_0x45c7c5[_0x1b4c49]={'$like':'%'+_0x322d51['query'][_0xe1ba('0x46')]+'%'};return _0x45c7c5;})});}_0x31d96b=_[_0xe1ba('0x47')]({},_0x31d96b,_0x322d51[_0xe1ba('0x57')]);return _0x1b99fe['getTags'](_0x31d96b);}})['then'](function(_0xdce5be){if(_0xdce5be){_0x17ba72=_0xdce5be[_0xe1ba('0x50')];if(!_0x322d51[_0xe1ba('0x3b')]['hasOwnProperty'](_0xe1ba('0x59'))){_0x31d96b[_0xe1ba('0x30')]=qs['limit'](_0x322d51[_0xe1ba('0x3b')][_0xe1ba('0x30')]);_0x31d96b['offset']=qs['offset'](_0x322d51['query']['offset']);}return _0x1b99fe[_0xe1ba('0x5c')](_0x31d96b);}})[_0xe1ba('0x1f')](function(_0xe25a23){if(_0xe25a23){return _0xe25a23?{'count':_0x17ba72,'rows':_0xe25a23}:null;}})['then'](respondWithResult(_0x8b3a01,null))[_0xe1ba('0x2a')](handleError(_0x8b3a01,null));};exports[_0xe1ba('0x5e')]=function(_0xa9df10,_0x48fbc9,_0x4ad228){if(_0xa9df10[_0xe1ba('0x54')]['id']){delete _0xa9df10[_0xe1ba('0x54')]['id'];}return db[_0xe1ba('0x37')][_0xe1ba('0x55')]({'where':{'id':_0xa9df10[_0xe1ba('0x4e')]['id']}})[_0xe1ba('0x1f')](handleEntityNotFound(_0x48fbc9,null))[_0xe1ba('0x1f')](function(_0x248adf){if(_0x248adf){return _0x248adf[_0xe1ba('0x5e')](_0xa9df10[_0xe1ba('0x54')][_0xe1ba('0x5f')]||[]);}return null;})[_0xe1ba('0x1f')](respondWithResult(_0x48fbc9,null))[_0xe1ba('0x2a')](handleError(_0x48fbc9,null));}; \ No newline at end of file +var _0xbcdc=['code','message','result','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','keys','model','intersection','fields','query','attributes','length','hasOwnProperty','limit','sort','where','filters','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','ZendeskField','order','pick','filter','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x55f3f8,_0x4354c3){var _0x28bbc9=function(_0x1fcfe6){while(--_0x1fcfe6){_0x55f3f8['push'](_0x55f3f8['shift']());}};_0x28bbc9(++_0x4354c3);}(_0xbcdc,0x1c3));var _0xcbcd=function(_0x2f5dd9,_0x46778c){_0x2f5dd9=_0x2f5dd9-0x0;var _0x42e01c=_0xbcdc[_0x2f5dd9];return _0x42e01c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xcbcd('0x0'));var zipdir=require(_0xcbcd('0x1'));var jsonpatch=require(_0xcbcd('0x2'));var rp=require('request-promise');var moment=require(_0xcbcd('0x3'));var BPromise=require(_0xcbcd('0x4'));var Mustache=require(_0xcbcd('0x5'));var util=require('util');var path=require(_0xcbcd('0x6'));var sox=require('sox');var csv=require(_0xcbcd('0x7'));var ejs=require(_0xcbcd('0x8'));var fs=require('fs');var _=require(_0xcbcd('0x9'));var squel=require(_0xcbcd('0xa'));var crypto=require(_0xcbcd('0xb'));var jsforce=require(_0xcbcd('0xc'));var deskjs=require(_0xcbcd('0xd'));var toCsv=require(_0xcbcd('0x7'));var querystring=require(_0xcbcd('0xe'));var Papa=require('papaparse');var Redis=require(_0xcbcd('0xf'));var authService=require(_0xcbcd('0x10'));var qs=require(_0xcbcd('0x11'));var as=require(_0xcbcd('0x12'));var hardwareService=require(_0xcbcd('0x13'));var logger=require(_0xcbcd('0x14'))(_0xcbcd('0x15'));var utils=require(_0xcbcd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcbcd('0x17'));var db=require(_0xcbcd('0x18'))['db'];var jayson=require(_0xcbcd('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a06c,_0x5dbac8,_0x43129c,_0x985272){return new BPromise(function(_0x5d814a,_0x11eb6d){var _0x252f08=_0x985272||client;return _0x252f08[_0xcbcd('0x1a')](_0x19a06c,_0x43129c)['then'](function(_0x331745){logger[_0xcbcd('0x1b')](_0xcbcd('0x1c'),_0x5dbac8,_0xcbcd('0x1d'));logger[_0xcbcd('0x1e')](_0xcbcd('0x1f'),_0x5dbac8,_0xcbcd('0x1d'),JSON[_0xcbcd('0x20')](_0x331745));if(_0x331745[_0xcbcd('0x21')]){if(_0x331745[_0xcbcd('0x21')][_0xcbcd('0x22')]===0x1f4){logger[_0xcbcd('0x21')](_0xcbcd('0x1c'),_0x5dbac8,_0x331745[_0xcbcd('0x21')][_0xcbcd('0x23')]);return _0x11eb6d(_0x331745[_0xcbcd('0x21')][_0xcbcd('0x23')]);}logger[_0xcbcd('0x21')](_0xcbcd('0x1c'),_0x5dbac8,_0x331745[_0xcbcd('0x21')][_0xcbcd('0x23')]);return _0x5d814a(_0x331745[_0xcbcd('0x21')][_0xcbcd('0x23')]);}else{logger[_0xcbcd('0x1b')](_0xcbcd('0x1c'),_0x5dbac8,'request\x20sent');_0x5d814a(_0x331745[_0xcbcd('0x24')][_0xcbcd('0x23')]);}})['catch'](function(_0x50cd5b){logger['error'](_0xcbcd('0x1c'),_0x5dbac8,_0x50cd5b);_0x11eb6d(_0x50cd5b);});});}function respondWithStatusCode(_0x2a702e,_0x217953){_0x217953=_0x217953||0xcc;return function(_0x336b0e){if(_0x336b0e){return _0x2a702e[_0xcbcd('0x25')](_0x217953);}return _0x2a702e[_0xcbcd('0x26')](_0x217953)['end']();};}function respondWithResult(_0x5e057d,_0xef950d){_0xef950d=_0xef950d||0xc8;return function(_0x4a0369){if(_0x4a0369){return _0x5e057d[_0xcbcd('0x26')](_0xef950d)[_0xcbcd('0x27')](_0x4a0369);}};}function respondWithFilteredResult(_0x3473f4,_0x5bc6ac){return function(_0x2b3ebf){if(_0x2b3ebf){var _0x62bb9f=_0x2b3ebf[_0xcbcd('0x28')],_0xd01aa7=_0x5bc6ac[_0xcbcd('0x29')],_0x3ccd2d=_0x5bc6ac[_0xcbcd('0x29')]+_0x5bc6ac['limit'],_0x4aa073;if(_0x3ccd2d>=_0x62bb9f){_0x3ccd2d=_0x62bb9f;_0x4aa073=0xc8;}else{_0x4aa073=0xce;}_0x3473f4['status'](_0x4aa073);return _0x3473f4['set'](_0xcbcd('0x2a'),_0xd01aa7+'-'+_0x3ccd2d+'/'+_0x62bb9f)[_0xcbcd('0x27')](_0x2b3ebf);}return null;};}function patchUpdates(_0x166d85){return function(_0x80d019){try{jsonpatch[_0xcbcd('0x2b')](_0x80d019,_0x166d85,!![]);}catch(_0x2a90f6){return BPromise[_0xcbcd('0x2c')](_0x2a90f6);}return _0x80d019[_0xcbcd('0x2d')]();};}function saveUpdates(_0x55392f,_0x107a2f){return function(_0x2a794a){if(_0x2a794a){return _0x2a794a[_0xcbcd('0x2e')](_0x55392f)[_0xcbcd('0x2f')](function(_0xcc90c9){return _0xcc90c9;});}return null;};}function removeEntity(_0x53e4f7,_0x131685){return function(_0x2edbd3){if(_0x2edbd3){return _0x2edbd3[_0xcbcd('0x30')]()[_0xcbcd('0x2f')](function(){_0x53e4f7[_0xcbcd('0x26')](0xcc)[_0xcbcd('0x31')]();});}};}function handleEntityNotFound(_0x55c117,_0x14e9e7){return function(_0x460bf0){if(!_0x460bf0){_0x55c117[_0xcbcd('0x25')](0x194);}return _0x460bf0;};}function handleError(_0x373e7e,_0x23c404){_0x23c404=_0x23c404||0x1f4;return function(_0x4ce899){logger[_0xcbcd('0x21')](_0x4ce899['stack']);if(_0x4ce899[_0xcbcd('0x32')]){delete _0x4ce899['name'];}_0x373e7e[_0xcbcd('0x26')](_0x23c404)[_0xcbcd('0x33')](_0x4ce899);};}exports[_0xcbcd('0x34')]=function(_0xfae521,_0x1edaf0){var _0x50bdd6={},_0x2f3db4={},_0x38aa34={'count':0x0,'rows':[]};var _0x1f65d6=_[_0xcbcd('0x35')](db[_0xcbcd('0x36')][_0xcbcd('0x37')],function(_0x31d5){return{'name':_0x31d5[_0xcbcd('0x38')],'type':_0x31d5[_0xcbcd('0x39')][_0xcbcd('0x3a')]};});_0x2f3db4['model']=_[_0xcbcd('0x35')](_0x1f65d6,_0xcbcd('0x32'));_0x2f3db4['query']=_[_0xcbcd('0x3b')](_0xfae521['query']);_0x2f3db4['filters']=_['intersection'](_0x2f3db4[_0xcbcd('0x3c')],_0x2f3db4['query']);_0x50bdd6['attributes']=_[_0xcbcd('0x3d')](_0x2f3db4[_0xcbcd('0x3c')],qs[_0xcbcd('0x3e')](_0xfae521[_0xcbcd('0x3f')]['fields']));_0x50bdd6[_0xcbcd('0x40')]=_0x50bdd6[_0xcbcd('0x40')][_0xcbcd('0x41')]?_0x50bdd6[_0xcbcd('0x40')]:_0x2f3db4[_0xcbcd('0x3c')];if(!_0xfae521[_0xcbcd('0x3f')][_0xcbcd('0x42')]('nolimit')){_0x50bdd6[_0xcbcd('0x43')]=qs[_0xcbcd('0x43')](_0xfae521[_0xcbcd('0x3f')]['limit']);_0x50bdd6[_0xcbcd('0x29')]=qs[_0xcbcd('0x29')](_0xfae521['query']['offset']);}_0x50bdd6['order']=qs[_0xcbcd('0x44')](_0xfae521['query'][_0xcbcd('0x44')]);_0x50bdd6[_0xcbcd('0x45')]=qs[_0xcbcd('0x46')](_['pick'](_0xfae521['query'],_0x2f3db4[_0xcbcd('0x46')]),_0x1f65d6);if(_0xfae521[_0xcbcd('0x3f')]['filter']){_0x50bdd6[_0xcbcd('0x45')]=_['merge'](_0x50bdd6[_0xcbcd('0x45')],{'$or':_['map'](_0x1f65d6,function(_0x41e713){if(_0x41e713[_0xcbcd('0x39')]!==_0xcbcd('0x47')){var _0x5f27ea={};_0x5f27ea[_0x41e713[_0xcbcd('0x32')]]={'$like':'%'+_0xfae521[_0xcbcd('0x3f')]['filter']+'%'};return _0x5f27ea;}})});}_0x50bdd6=_[_0xcbcd('0x48')]({},_0x50bdd6,_0xfae521[_0xcbcd('0x49')]);var _0x50b891={'where':_0x50bdd6[_0xcbcd('0x45')]};return db[_0xcbcd('0x36')][_0xcbcd('0x28')](_0x50b891)[_0xcbcd('0x2f')](function(_0x1c9cb3){_0x38aa34['count']=_0x1c9cb3;if(_0xfae521[_0xcbcd('0x3f')][_0xcbcd('0x4a')]){_0x50bdd6[_0xcbcd('0x4b')]=[{'all':!![]}];}return db[_0xcbcd('0x36')][_0xcbcd('0x4c')](_0x50bdd6);})['then'](function(_0x3febc3){_0x38aa34[_0xcbcd('0x4d')]=_0x3febc3;return _0x38aa34;})[_0xcbcd('0x2f')](respondWithFilteredResult(_0x1edaf0,_0x50bdd6))[_0xcbcd('0x4e')](handleError(_0x1edaf0,null));};exports[_0xcbcd('0x4f')]=function(_0x2393bd,_0x2c1ab2){var _0x247b35={'raw':![],'where':{'id':_0x2393bd[_0xcbcd('0x50')]['id']}},_0x1af87d={};_0x1af87d['model']=_[_0xcbcd('0x3b')](db[_0xcbcd('0x36')][_0xcbcd('0x37')]);_0x1af87d[_0xcbcd('0x3f')]=_[_0xcbcd('0x3b')](_0x2393bd[_0xcbcd('0x3f')]);_0x1af87d['filters']=_[_0xcbcd('0x3d')](_0x1af87d[_0xcbcd('0x3c')],_0x1af87d[_0xcbcd('0x3f')]);_0x247b35[_0xcbcd('0x40')]=_[_0xcbcd('0x3d')](_0x1af87d[_0xcbcd('0x3c')],qs[_0xcbcd('0x3e')](_0x2393bd[_0xcbcd('0x3f')][_0xcbcd('0x3e')]));_0x247b35[_0xcbcd('0x40')]=_0x247b35[_0xcbcd('0x40')][_0xcbcd('0x41')]?_0x247b35[_0xcbcd('0x40')]:_0x1af87d['model'];if(_0x2393bd['query'][_0xcbcd('0x4a')]){_0x247b35[_0xcbcd('0x4b')]=[{'all':!![]}];}_0x247b35=_['merge']({},_0x247b35,_0x2393bd['options']);return db[_0xcbcd('0x36')][_0xcbcd('0x51')](_0x247b35)['then'](handleEntityNotFound(_0x2c1ab2,null))['then'](respondWithResult(_0x2c1ab2,null))[_0xcbcd('0x4e')](handleError(_0x2c1ab2,null));};exports[_0xcbcd('0x52')]=function(_0x1ce5a7,_0x1cf30d){return db[_0xcbcd('0x36')]['create'](_0x1ce5a7[_0xcbcd('0x53')],{})[_0xcbcd('0x2f')](respondWithResult(_0x1cf30d,0xc9))[_0xcbcd('0x4e')](handleError(_0x1cf30d,null));};exports[_0xcbcd('0x2e')]=function(_0x5ad42e,_0x3540e2){if(_0x5ad42e[_0xcbcd('0x53')]['id']){delete _0x5ad42e[_0xcbcd('0x53')]['id'];}return db['ZendeskConfiguration'][_0xcbcd('0x51')]({'where':{'id':_0x5ad42e['params']['id']}})[_0xcbcd('0x2f')](handleEntityNotFound(_0x3540e2,null))[_0xcbcd('0x2f')](saveUpdates(_0x5ad42e['body'],null))['then'](respondWithResult(_0x3540e2,null))['catch'](handleError(_0x3540e2,null));};exports[_0xcbcd('0x30')]=function(_0x367c56,_0x4ee588){return db[_0xcbcd('0x36')][_0xcbcd('0x51')]({'where':{'id':_0x367c56[_0xcbcd('0x50')]['id']}})[_0xcbcd('0x2f')](handleEntityNotFound(_0x4ee588,null))[_0xcbcd('0x2f')](removeEntity(_0x4ee588,null))['catch'](handleError(_0x4ee588,null));};exports[_0xcbcd('0x54')]=function(_0x29ca37,_0x3bf380,_0x557431){var _0x27f493={};var _0x3c78f3={};var _0x285fab;var _0x4e2b9c;return db[_0xcbcd('0x36')][_0xcbcd('0x55')]({'where':{'id':_0x29ca37[_0xcbcd('0x50')]['id']}})[_0xcbcd('0x2f')](handleEntityNotFound(_0x3bf380,null))['then'](function(_0x488aa1){if(_0x488aa1){_0x285fab=_0x488aa1;_0x3c78f3[_0xcbcd('0x3c')]=_[_0xcbcd('0x3b')](db[_0xcbcd('0x56')]['rawAttributes']);_0x3c78f3[_0xcbcd('0x3f')]=_['keys'](_0x29ca37[_0xcbcd('0x3f')]);_0x3c78f3[_0xcbcd('0x46')]=_['intersection'](_0x3c78f3['model'],_0x3c78f3[_0xcbcd('0x3f')]);_0x27f493['attributes']=_[_0xcbcd('0x3d')](_0x3c78f3[_0xcbcd('0x3c')],qs[_0xcbcd('0x3e')](_0x29ca37[_0xcbcd('0x3f')][_0xcbcd('0x3e')]));_0x27f493[_0xcbcd('0x40')]=_0x27f493[_0xcbcd('0x40')][_0xcbcd('0x41')]?_0x27f493['attributes']:_0x3c78f3[_0xcbcd('0x3c')];_0x27f493[_0xcbcd('0x57')]=qs['sort'](_0x29ca37[_0xcbcd('0x3f')]['sort']);_0x27f493[_0xcbcd('0x45')]=qs[_0xcbcd('0x46')](_[_0xcbcd('0x58')](_0x29ca37[_0xcbcd('0x3f')],_0x3c78f3['filters']));if(_0x29ca37['query']['filter']){_0x27f493['where']=_[_0xcbcd('0x48')](_0x27f493['where'],{'$or':_[_0xcbcd('0x35')](_0x27f493['attributes'],function(_0x14f82e){var _0x5566c4={};_0x5566c4[_0x14f82e]={'$like':'%'+_0x29ca37['query'][_0xcbcd('0x59')]+'%'};return _0x5566c4;})});}_0x27f493=_['merge']({},_0x27f493,_0x29ca37['options']);return _0x285fab[_0xcbcd('0x54')](_0x27f493);}})[_0xcbcd('0x2f')](function(_0x394a5f){if(_0x394a5f){_0x4e2b9c=_0x394a5f[_0xcbcd('0x41')];if(!_0x29ca37[_0xcbcd('0x3f')][_0xcbcd('0x42')](_0xcbcd('0x5a'))){_0x27f493[_0xcbcd('0x43')]=qs[_0xcbcd('0x43')](_0x29ca37['query'][_0xcbcd('0x43')]);_0x27f493[_0xcbcd('0x29')]=qs['offset'](_0x29ca37[_0xcbcd('0x3f')][_0xcbcd('0x29')]);}return _0x285fab['getFields'](_0x27f493);}})['then'](function(_0x2d74fb){if(_0x2d74fb){return _0x2d74fb?{'count':_0x4e2b9c,'rows':_0x2d74fb}:null;}})[_0xcbcd('0x2f')](respondWithResult(_0x3bf380,null))[_0xcbcd('0x4e')](handleError(_0x3bf380,null));};exports[_0xcbcd('0x5b')]=function(_0x24617b,_0x278106,_0x617ad6){var _0x2a8023={};var _0x2bc04b={};var _0x22177b;var _0x31b2bd;return db[_0xcbcd('0x36')]['findOne']({'where':{'id':_0x24617b[_0xcbcd('0x50')]['id']}})['then'](handleEntityNotFound(_0x278106,null))[_0xcbcd('0x2f')](function(_0x5383af){if(_0x5383af){_0x22177b=_0x5383af;_0x2bc04b[_0xcbcd('0x3c')]=_['keys'](db[_0xcbcd('0x56')][_0xcbcd('0x37')]);_0x2bc04b[_0xcbcd('0x3f')]=_[_0xcbcd('0x3b')](_0x24617b['query']);_0x2bc04b[_0xcbcd('0x46')]=_['intersection'](_0x2bc04b[_0xcbcd('0x3c')],_0x2bc04b[_0xcbcd('0x3f')]);_0x2a8023['attributes']=_['intersection'](_0x2bc04b['model'],qs[_0xcbcd('0x3e')](_0x24617b['query'][_0xcbcd('0x3e')]));_0x2a8023[_0xcbcd('0x40')]=_0x2a8023[_0xcbcd('0x40')][_0xcbcd('0x41')]?_0x2a8023[_0xcbcd('0x40')]:_0x2bc04b[_0xcbcd('0x3c')];_0x2a8023[_0xcbcd('0x57')]=qs['sort'](_0x24617b[_0xcbcd('0x3f')][_0xcbcd('0x44')]);_0x2a8023['where']=qs[_0xcbcd('0x46')](_[_0xcbcd('0x58')](_0x24617b[_0xcbcd('0x3f')],_0x2bc04b[_0xcbcd('0x46')]));if(_0x24617b[_0xcbcd('0x3f')][_0xcbcd('0x59')]){_0x2a8023[_0xcbcd('0x45')]=_[_0xcbcd('0x48')](_0x2a8023['where'],{'$or':_[_0xcbcd('0x35')](_0x2a8023['attributes'],function(_0x4e90ab){var _0x36376b={};_0x36376b[_0x4e90ab]={'$like':'%'+_0x24617b[_0xcbcd('0x3f')][_0xcbcd('0x59')]+'%'};return _0x36376b;})});}_0x2a8023=_[_0xcbcd('0x48')]({},_0x2a8023,_0x24617b['options']);return _0x22177b['getSubjects'](_0x2a8023);}})[_0xcbcd('0x2f')](function(_0x4142b7){if(_0x4142b7){_0x31b2bd=_0x4142b7[_0xcbcd('0x41')];if(!_0x24617b[_0xcbcd('0x3f')]['hasOwnProperty'](_0xcbcd('0x5a'))){_0x2a8023[_0xcbcd('0x43')]=qs[_0xcbcd('0x43')](_0x24617b[_0xcbcd('0x3f')]['limit']);_0x2a8023[_0xcbcd('0x29')]=qs['offset'](_0x24617b[_0xcbcd('0x3f')]['offset']);}return _0x22177b['getSubjects'](_0x2a8023);}})[_0xcbcd('0x2f')](function(_0x437bb4){if(_0x437bb4){return _0x437bb4?{'count':_0x31b2bd,'rows':_0x437bb4}:null;}})['then'](respondWithResult(_0x278106,null))['catch'](handleError(_0x278106,null));};exports[_0xcbcd('0x5c')]=function(_0x50afab,_0x28fe9d,_0x424ad9){var _0x62e0a4={};var _0x248d65={};var _0x3f0965;var _0x14a4bb;return db[_0xcbcd('0x36')][_0xcbcd('0x55')]({'where':{'id':_0x50afab[_0xcbcd('0x50')]['id']}})[_0xcbcd('0x2f')](handleEntityNotFound(_0x28fe9d,null))[_0xcbcd('0x2f')](function(_0x42b988){if(_0x42b988){_0x3f0965=_0x42b988;_0x248d65[_0xcbcd('0x3c')]=_[_0xcbcd('0x3b')](db[_0xcbcd('0x56')][_0xcbcd('0x37')]);_0x248d65['query']=_[_0xcbcd('0x3b')](_0x50afab['query']);_0x248d65['filters']=_[_0xcbcd('0x3d')](_0x248d65[_0xcbcd('0x3c')],_0x248d65[_0xcbcd('0x3f')]);_0x62e0a4[_0xcbcd('0x40')]=_[_0xcbcd('0x3d')](_0x248d65['model'],qs[_0xcbcd('0x3e')](_0x50afab[_0xcbcd('0x3f')][_0xcbcd('0x3e')]));_0x62e0a4[_0xcbcd('0x40')]=_0x62e0a4[_0xcbcd('0x40')][_0xcbcd('0x41')]?_0x62e0a4['attributes']:_0x248d65[_0xcbcd('0x3c')];_0x62e0a4[_0xcbcd('0x57')]=qs[_0xcbcd('0x44')](_0x50afab[_0xcbcd('0x3f')][_0xcbcd('0x44')]);_0x62e0a4[_0xcbcd('0x45')]=qs[_0xcbcd('0x46')](_[_0xcbcd('0x58')](_0x50afab[_0xcbcd('0x3f')],_0x248d65[_0xcbcd('0x46')]));if(_0x50afab['query'][_0xcbcd('0x59')]){_0x62e0a4['where']=_['merge'](_0x62e0a4[_0xcbcd('0x45')],{'$or':_[_0xcbcd('0x35')](_0x62e0a4[_0xcbcd('0x40')],function(_0x5018d3){var _0x434f12={};_0x434f12[_0x5018d3]={'$like':'%'+_0x50afab['query'][_0xcbcd('0x59')]+'%'};return _0x434f12;})});}_0x62e0a4=_[_0xcbcd('0x48')]({},_0x62e0a4,_0x50afab[_0xcbcd('0x49')]);return _0x3f0965['getDescriptions'](_0x62e0a4);}})['then'](function(_0x26008d){if(_0x26008d){_0x14a4bb=_0x26008d[_0xcbcd('0x41')];if(!_0x50afab[_0xcbcd('0x3f')][_0xcbcd('0x42')]('nolimit')){_0x62e0a4['limit']=qs[_0xcbcd('0x43')](_0x50afab[_0xcbcd('0x3f')][_0xcbcd('0x43')]);_0x62e0a4[_0xcbcd('0x29')]=qs[_0xcbcd('0x29')](_0x50afab[_0xcbcd('0x3f')][_0xcbcd('0x29')]);}return _0x3f0965['getDescriptions'](_0x62e0a4);}})[_0xcbcd('0x2f')](function(_0x59c03a){if(_0x59c03a){return _0x59c03a?{'count':_0x14a4bb,'rows':_0x59c03a}:null;}})['then'](respondWithResult(_0x28fe9d,null))['catch'](handleError(_0x28fe9d,null));};exports[_0xcbcd('0x5d')]=function(_0x5e9c9d,_0x592b3d,_0x5ed1b7){var _0x45d9a7={};var _0x5252da={};var _0x1f407f;var _0x291584;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5e9c9d['params']['id']}})[_0xcbcd('0x2f')](handleEntityNotFound(_0x592b3d,null))[_0xcbcd('0x2f')](function(_0x3791fd){if(_0x3791fd){_0x1f407f=_0x3791fd;_0x5252da['model']=_[_0xcbcd('0x3b')](db[_0xcbcd('0x5e')]['rawAttributes']);_0x5252da[_0xcbcd('0x3f')]=_[_0xcbcd('0x3b')](_0x5e9c9d['query']);_0x5252da[_0xcbcd('0x46')]=_['intersection'](_0x5252da[_0xcbcd('0x3c')],_0x5252da[_0xcbcd('0x3f')]);_0x45d9a7['attributes']=_[_0xcbcd('0x3d')](_0x5252da[_0xcbcd('0x3c')],qs[_0xcbcd('0x3e')](_0x5e9c9d['query'][_0xcbcd('0x3e')]));_0x45d9a7['attributes']=_0x45d9a7[_0xcbcd('0x40')][_0xcbcd('0x41')]?_0x45d9a7[_0xcbcd('0x40')]:_0x5252da[_0xcbcd('0x3c')];_0x45d9a7[_0xcbcd('0x57')]=qs[_0xcbcd('0x44')](_0x5e9c9d[_0xcbcd('0x3f')][_0xcbcd('0x44')]);_0x45d9a7[_0xcbcd('0x45')]=qs[_0xcbcd('0x46')](_[_0xcbcd('0x58')](_0x5e9c9d[_0xcbcd('0x3f')],_0x5252da[_0xcbcd('0x46')]));if(_0x5e9c9d[_0xcbcd('0x3f')][_0xcbcd('0x59')]){_0x45d9a7[_0xcbcd('0x45')]=_[_0xcbcd('0x48')](_0x45d9a7['where'],{'$or':_[_0xcbcd('0x35')](_0x45d9a7['attributes'],function(_0x5c7811){var _0x419975={};_0x419975[_0x5c7811]={'$like':'%'+_0x5e9c9d[_0xcbcd('0x3f')]['filter']+'%'};return _0x419975;})});}_0x45d9a7=_[_0xcbcd('0x48')]({},_0x45d9a7,_0x5e9c9d[_0xcbcd('0x49')]);return _0x1f407f[_0xcbcd('0x5d')](_0x45d9a7);}})[_0xcbcd('0x2f')](function(_0x41bc13){if(_0x41bc13){_0x291584=_0x41bc13['length'];if(!_0x5e9c9d[_0xcbcd('0x3f')]['hasOwnProperty']('nolimit')){_0x45d9a7['limit']=qs[_0xcbcd('0x43')](_0x5e9c9d[_0xcbcd('0x3f')][_0xcbcd('0x43')]);_0x45d9a7[_0xcbcd('0x29')]=qs[_0xcbcd('0x29')](_0x5e9c9d['query'][_0xcbcd('0x29')]);}return _0x1f407f[_0xcbcd('0x5d')](_0x45d9a7);}})[_0xcbcd('0x2f')](function(_0x479b68){if(_0x479b68){return _0x479b68?{'count':_0x291584,'rows':_0x479b68}:null;}})[_0xcbcd('0x2f')](respondWithResult(_0x592b3d,null))[_0xcbcd('0x4e')](handleError(_0x592b3d,null));};exports[_0xcbcd('0x5f')]=function(_0x4d149a,_0x5ca145,_0x51b254){if(_0x4d149a[_0xcbcd('0x53')]['id']){delete _0x4d149a[_0xcbcd('0x53')]['id'];}return db['ZendeskConfiguration'][_0xcbcd('0x55')]({'where':{'id':_0x4d149a[_0xcbcd('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ca145,null))['then'](function(_0x200337){if(_0x200337){return _0x200337[_0xcbcd('0x5f')](_0x4d149a['body'][_0xcbcd('0x60')]||[]);}return null;})[_0xcbcd('0x2f')](respondWithResult(_0x5ca145,null))[_0xcbcd('0x4e')](handleError(_0x5ca145,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 5cc7555..f3134d1 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 _0x0bc2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x36216f,_0x2b1724){var _0x190859=function(_0x30df2c){while(--_0x30df2c){_0x36216f['push'](_0x36216f['shift']());}};_0x190859(++_0x2b1724);}(_0x0bc2,0xb4));var _0x20bc=function(_0x41e613,_0x274de4){_0x41e613=_0x41e613-0x0;var _0x3260ec=_0x0bc2[_0x41e613];return _0x3260ec;};'use strict';var _=require(_0x20bc('0x0'));var util=require('util');var logger=require(_0x20bc('0x1'))(_0x20bc('0x2'));var moment=require(_0x20bc('0x3'));var BPromise=require(_0x20bc('0x4'));var rp=require(_0x20bc('0x5'));var fs=require('fs');var path=require(_0x20bc('0x6'));var rimraf=require(_0x20bc('0x7'));var config=require(_0x20bc('0x8'));var attributes=require(_0x20bc('0x9'));module[_0x20bc('0xa')]=function(_0x24311e,_0x18755d){return _0x24311e['define'](_0x20bc('0xb'),attributes,{'tableName':_0x20bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94db=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util'];(function(_0xdb8b06,_0x94a0cd){var _0x2bcac6=function(_0x18b644){while(--_0x18b644){_0xdb8b06['push'](_0xdb8b06['shift']());}};_0x2bcac6(++_0x94a0cd);}(_0x94db,0x1ba));var _0xb94d=function(_0x16c4b3,_0x225259){_0x16c4b3=_0x16c4b3-0x0;var _0xfb453e=_0x94db[_0x16c4b3];return _0xfb453e;};'use strict';var _=require(_0xb94d('0x0'));var util=require(_0xb94d('0x1'));var logger=require(_0xb94d('0x2'))(_0xb94d('0x3'));var moment=require(_0xb94d('0x4'));var BPromise=require(_0xb94d('0x5'));var rp=require(_0xb94d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb94d('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xb94d('0x8')]=function(_0x30ddaf,_0x9c5a4b){return _0x30ddaf[_0xb94d('0x9')](_0xb94d('0xa'),attributes,{'tableName':_0xb94d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index e5c0842..f9ba6c9 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 _0xafe6=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0x5e9aca,_0x1bfeeb){var _0x22b7c2=function(_0x3dfdbc){while(--_0x3dfdbc){_0x5e9aca['push'](_0x5e9aca['shift']());}};_0x22b7c2(++_0x1bfeeb);}(_0xafe6,0x181));var _0x6afe=function(_0x4dad7b,_0x4a17b0){_0x4dad7b=_0x4dad7b-0x0;var _0xc04d92=_0xafe6[_0x4dad7b];return _0xc04d92;};'use strict';var _=require('lodash');var util=require(_0x6afe('0x0'));var moment=require(_0x6afe('0x1'));var BPromise=require(_0x6afe('0x2'));var rs=require(_0x6afe('0x3'));var fs=require('fs');var Redis=require(_0x6afe('0x4'));var db=require(_0x6afe('0x5'))['db'];var utils=require(_0x6afe('0x6'));var logger=require(_0x6afe('0x7'))('rpc');var config=require(_0x6afe('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6afe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1547,_0x13e443,_0x1cd94c){return new BPromise(function(_0x3296bc,_0x1a4bdd){return client[_0x6afe('0xa')](_0x3a1547,_0x1cd94c)[_0x6afe('0xb')](function(_0x199005){logger[_0x6afe('0xc')](_0x6afe('0xd'),_0x13e443,_0x6afe('0xe'));logger[_0x6afe('0xf')](_0x6afe('0x10'),_0x13e443,_0x6afe('0xe'),JSON['stringify'](_0x199005));if(_0x199005['error']){if(_0x199005[_0x6afe('0x11')][_0x6afe('0x12')]===0x1f4){logger[_0x6afe('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x13e443,_0x199005['error'][_0x6afe('0x13')]);return _0x1a4bdd(_0x199005[_0x6afe('0x11')][_0x6afe('0x13')]);}logger[_0x6afe('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x13e443,_0x199005[_0x6afe('0x11')][_0x6afe('0x13')]);return _0x3296bc(_0x199005[_0x6afe('0x11')][_0x6afe('0x13')]);}else{logger[_0x6afe('0xc')](_0x6afe('0xd'),_0x13e443,_0x6afe('0xe'));_0x3296bc(_0x199005[_0x6afe('0x14')][_0x6afe('0x13')]);}})[_0x6afe('0x15')](function(_0xb2744f){logger[_0x6afe('0x11')](_0x6afe('0xd'),_0x13e443,_0xb2744f);_0x1a4bdd(_0xb2744f);});});} \ No newline at end of file +var _0x23e6=['../../config/logger','rpc','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x23e6,0xa2));var _0x623e=function(_0x59e703,_0x62b160){_0x59e703=_0x59e703-0x0;var _0x5e46c3=_0x23e6[_0x59e703];return _0x5e46c3;};'use strict';var _=require('lodash');var util=require(_0x623e('0x0'));var moment=require('moment');var BPromise=require(_0x623e('0x1'));var rs=require(_0x623e('0x2'));var fs=require('fs');var Redis=require(_0x623e('0x3'));var db=require(_0x623e('0x4'))['db'];var utils=require(_0x623e('0x5'));var logger=require(_0x623e('0x6'))(_0x623e('0x7'));var config=require('../../config/environment');var jayson=require(_0x623e('0x8'));var client=jayson['client'][_0x623e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3261ae,_0x51c47c,_0x2752a2){return new BPromise(function(_0x471b1d,_0x15c38b){return client[_0x623e('0xa')](_0x3261ae,_0x2752a2)['then'](function(_0x278526){logger[_0x623e('0xb')](_0x623e('0xc'),_0x51c47c,_0x623e('0xd'));logger['debug'](_0x623e('0xe'),_0x51c47c,'request\x20sent',JSON[_0x623e('0xf')](_0x278526));if(_0x278526[_0x623e('0x10')]){if(_0x278526[_0x623e('0x10')][_0x623e('0x11')]===0x1f4){logger[_0x623e('0x10')](_0x623e('0xc'),_0x51c47c,_0x278526[_0x623e('0x10')][_0x623e('0x12')]);return _0x15c38b(_0x278526['error'][_0x623e('0x12')]);}logger[_0x623e('0x10')](_0x623e('0xc'),_0x51c47c,_0x278526[_0x623e('0x10')]['message']);return _0x471b1d(_0x278526[_0x623e('0x10')][_0x623e('0x12')]);}else{logger['info'](_0x623e('0xc'),_0x51c47c,_0x623e('0xd'));_0x471b1d(_0x278526[_0x623e('0x13')][_0x623e('0x12')]);}})[_0x623e('0x14')](function(_0x1f24bf){logger['error'](_0x623e('0xc'),_0x51c47c,_0x1f24bf);_0x15c38b(_0x1f24bf);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 4eed982..9ed4b88 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 _0x8dcd=['path','connect-timeout','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x460658,_0x1e7386){var _0x2a35ab=function(_0x46c09f){while(--_0x46c09f){_0x460658['push'](_0x460658['shift']());}};_0x2a35ab(++_0x1e7386);}(_0x8dcd,0xce));var _0xd8dc=function(_0x2a877d,_0x5a15d5){_0x2a877d=_0x2a877d-0x0;var _0xc3fe9e=_0x8dcd[_0x2a877d];return _0xc3fe9e;};'use strict';var multer=require(_0xd8dc('0x0'));var util=require(_0xd8dc('0x1'));var path=require(_0xd8dc('0x2'));var timeout=require(_0xd8dc('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8dc('0x4'));var controller=require(_0xd8dc('0x5'));router[_0xd8dc('0x6')]('/',auth[_0xd8dc('0x7')](),controller['index']);router['get'](_0xd8dc('0x8'),auth[_0xd8dc('0x7')](),controller[_0xd8dc('0x9')]);router['post']('/',auth[_0xd8dc('0x7')](),controller[_0xd8dc('0xa')]);router[_0xd8dc('0xb')](_0xd8dc('0x8'),auth[_0xd8dc('0x7')](),controller[_0xd8dc('0xc')]);router[_0xd8dc('0xd')](_0xd8dc('0x8'),auth['isAuthenticated'](),controller[_0xd8dc('0xe')]);module[_0xd8dc('0xf')]=router; \ No newline at end of file +var _0x9ee6=['post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','index','/:id','isAuthenticated','show'];(function(_0x1978cd,_0x42dbdf){var _0x3b9f87=function(_0xaa16b7){while(--_0xaa16b7){_0x1978cd['push'](_0x1978cd['shift']());}};_0x3b9f87(++_0x42dbdf);}(_0x9ee6,0x125));var _0x69ee=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x9ee6[_0x54eab6];return _0x1e7435;};'use strict';var multer=require(_0x69ee('0x0'));var util=require(_0x69ee('0x1'));var path=require(_0x69ee('0x2'));var timeout=require(_0x69ee('0x3'));var express=require('express');var router=express[_0x69ee('0x4')]();var auth=require(_0x69ee('0x5'));var interaction=require(_0x69ee('0x6'));var config=require('../../config/environment');var controller=require(_0x69ee('0x7'));router[_0x69ee('0x8')]('/',auth['isAuthenticated'](),controller[_0x69ee('0x9')]);router['get'](_0x69ee('0xa'),auth[_0x69ee('0xb')](),controller[_0x69ee('0xc')]);router[_0x69ee('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x69ee('0xe')]('/:id',auth[_0x69ee('0xb')](),controller[_0x69ee('0xf')]);router['delete'](_0x69ee('0xa'),auth[_0x69ee('0xb')](),controller[_0x69ee('0x10')]);module[_0x69ee('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 011c141..2a1a1ab 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 _0xf50a=['exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN'];(function(_0x306ab6,_0x55a56a){var _0x5be155=function(_0x356339){while(--_0x356339){_0x306ab6['push'](_0x306ab6['shift']());}};_0x5be155(++_0x55a56a);}(_0xf50a,0x1b8));var _0xaf50=function(_0x2bbb3d,_0x400061){_0x2bbb3d=_0x2bbb3d-0x0;var _0x5739f0=_0xf50a[_0x2bbb3d];return _0x5739f0;};'use strict';var Sequelize=require('sequelize');module[_0xaf50('0x0')]={'type':{'type':Sequelize['ENUM'](_0xaf50('0x1'),'variable',_0xaf50('0x2'),_0xaf50('0x3')),'defaultValue':_0xaf50('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xaf50('0x4')]},'keyType':{'type':Sequelize[_0xaf50('0x5')]('string',_0xaf50('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0xaf50('0x4')]},'idField':{'type':Sequelize[_0xaf50('0x4')]},'nameField':{'type':Sequelize[_0xaf50('0x4')]},'customField':{'type':Sequelize[_0xaf50('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f19=['exports','string','customVariable','keyValue','STRING','ENUM','variable'];(function(_0x113f65,_0x2d813b){var _0x60d809=function(_0x3a18b8){while(--_0x3a18b8){_0x113f65['push'](_0x113f65['shift']());}};_0x60d809(++_0x2d813b);}(_0x3f19,0x1f1));var _0x93f1=function(_0xa46b86,_0x5c1465){_0xa46b86=_0xa46b86-0x0;var _0x417360=_0x3f19[_0xa46b86];return _0x417360;};'use strict';var Sequelize=require('sequelize');module[_0x93f1('0x0')]={'type':{'type':Sequelize['ENUM'](_0x93f1('0x1'),'variable',_0x93f1('0x2'),_0x93f1('0x3')),'defaultValue':_0x93f1('0x1')},'content':{'type':Sequelize[_0x93f1('0x4')]},'key':{'type':Sequelize[_0x93f1('0x4')]},'keyType':{'type':Sequelize[_0x93f1('0x5')](_0x93f1('0x1'),_0x93f1('0x6'),_0x93f1('0x2'))},'keyContent':{'type':Sequelize[_0x93f1('0x4')]},'idField':{'type':Sequelize[_0x93f1('0x4')]},'nameField':{'type':Sequelize[_0x93f1('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x93f1('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 1d98926..b0fde63 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 _0x8952=['limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','ZendeskField','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x275256,_0x299ac3){var _0x1a4481=function(_0x2c5785){while(--_0x2c5785){_0x275256['push'](_0x275256['shift']());}};_0x1a4481(++_0x299ac3);}(_0x8952,0x17e));var _0x2895=function(_0x3eeebf,_0x540907){_0x3eeebf=_0x3eeebf-0x0;var _0x3db3fd=_0x8952[_0x3eeebf];return _0x3db3fd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2895('0x0'));var rimraf=require(_0x2895('0x1'));var zipdir=require(_0x2895('0x2'));var jsonpatch=require(_0x2895('0x3'));var rp=require(_0x2895('0x4'));var moment=require('moment');var BPromise=require(_0x2895('0x5'));var Mustache=require(_0x2895('0x6'));var util=require(_0x2895('0x7'));var path=require('path');var sox=require(_0x2895('0x8'));var csv=require(_0x2895('0x9'));var ejs=require(_0x2895('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x9'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=_0x1d3659[_0x2895('0x18')],_0x6a5c7e=_0x1ae013[_0x2895('0x19')],_0x31bb7f=_0x1ae013[_0x2895('0x19')]+_0x1ae013[_0x2895('0x1a')],_0x3e96d7;if(_0x31bb7f>=_0x2627e6){_0x31bb7f=_0x2627e6;_0x3e96d7=0xc8;}else{_0x3e96d7=0xce;}_0x27b50e[_0x2895('0x16')](_0x3e96d7);return _0x27b50e[_0x2895('0x1b')](_0x2895('0x1c'),_0x6a5c7e+'-'+_0x31bb7f+'/'+_0x2627e6)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x1e8d47){return function(_0x5a8eab){try{jsonpatch['apply'](_0x5a8eab,_0x1e8d47,!![]);}catch(_0x493851){return BPromise[_0x2895('0x1d')](_0x493851);}return _0x5a8eab[_0x2895('0x1e')]();};}function saveUpdates(_0x3ec4da,_0x593e47){return function(_0x2813a3){if(_0x2813a3){return _0x2813a3[_0x2895('0x1f')](_0x3ec4da)[_0x2895('0x20')](function(_0x19228e){return _0x19228e;});}return null;};}function removeEntity(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x21')]()['then'](function(){_0x8b75e0[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x6f8ad4,_0x511286){return function(_0x4e884f){if(!_0x4e884f){_0x6f8ad4[_0x2895('0x15')](0x194);}return _0x4e884f;};}function handleError(_0x4569b5,_0x23b0eb){_0x23b0eb=_0x23b0eb||0x1f4;return function(_0x4a21cf){logger[_0x2895('0x23')](_0x4a21cf[_0x2895('0x24')]);if(_0x4a21cf['name']){delete _0x4a21cf[_0x2895('0x25')];}_0x4569b5[_0x2895('0x16')](_0x23b0eb)[_0x2895('0x26')](_0x4a21cf);};}exports['index']=function(_0x320661,_0x30f491){var _0x5eedfc={},_0x21f549={},_0x501898={'count':0x0,'rows':[]};var _0x5d70f5=_[_0x2895('0x27')](db['ZendeskField'][_0x2895('0x28')],function(_0x381538){return{'name':_0x381538['fieldName'],'type':_0x381538['type'][_0x2895('0x29')]};});_0x21f549[_0x2895('0x2a')]=_[_0x2895('0x27')](_0x5d70f5,_0x2895('0x25'));_0x21f549[_0x2895('0x2b')]=_[_0x2895('0x2c')](_0x320661[_0x2895('0x2b')]);_0x21f549['filters']=_[_0x2895('0x2d')](_0x21f549[_0x2895('0x2a')],_0x21f549[_0x2895('0x2b')]);_0x5eedfc['attributes']=_[_0x2895('0x2d')](_0x21f549[_0x2895('0x2a')],qs[_0x2895('0x2e')](_0x320661[_0x2895('0x2b')]['fields']));_0x5eedfc[_0x2895('0x2f')]=_0x5eedfc[_0x2895('0x2f')][_0x2895('0x30')]?_0x5eedfc[_0x2895('0x2f')]:_0x21f549[_0x2895('0x2a')];if(!_0x320661['query']['hasOwnProperty'](_0x2895('0x31'))){_0x5eedfc[_0x2895('0x1a')]=qs['limit'](_0x320661[_0x2895('0x2b')]['limit']);_0x5eedfc[_0x2895('0x19')]=qs[_0x2895('0x19')](_0x320661['query'][_0x2895('0x19')]);}_0x5eedfc['order']=qs[_0x2895('0x32')](_0x320661['query']['sort']);_0x5eedfc[_0x2895('0x33')]=qs[_0x2895('0x34')](_[_0x2895('0x35')](_0x320661['query'],_0x21f549[_0x2895('0x34')]),_0x5d70f5);if(_0x320661[_0x2895('0x2b')][_0x2895('0x36')]){_0x5eedfc[_0x2895('0x33')]=_[_0x2895('0x37')](_0x5eedfc[_0x2895('0x33')],{'$or':_[_0x2895('0x27')](_0x5d70f5,function(_0x240230){if(_0x240230[_0x2895('0x38')]!==_0x2895('0x39')){var _0x59b0e6={};_0x59b0e6[_0x240230[_0x2895('0x25')]]={'$like':'%'+_0x320661[_0x2895('0x2b')][_0x2895('0x36')]+'%'};return _0x59b0e6;}})});}_0x5eedfc=_[_0x2895('0x37')]({},_0x5eedfc,_0x320661[_0x2895('0x3a')]);var _0x12d7d8={'where':_0x5eedfc[_0x2895('0x33')]};return db['ZendeskField']['count'](_0x12d7d8)[_0x2895('0x20')](function(_0x29dc63){_0x501898[_0x2895('0x18')]=_0x29dc63;if(_0x320661[_0x2895('0x2b')][_0x2895('0x3b')]){_0x5eedfc[_0x2895('0x3c')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x5eedfc);})[_0x2895('0x20')](function(_0x20208f){_0x501898['rows']=_0x20208f;return _0x501898;})['then'](respondWithFilteredResult(_0x30f491,_0x5eedfc))[_0x2895('0x3d')](handleError(_0x30f491,null));};exports[_0x2895('0x3e')]=function(_0x3cc827,_0x28967f){var _0x2bac35={'raw':!![],'where':{'id':_0x3cc827['params']['id']}},_0x3e1d16={};_0x3e1d16[_0x2895('0x2a')]=_[_0x2895('0x2c')](db[_0x2895('0x3f')][_0x2895('0x28')]);_0x3e1d16['query']=_[_0x2895('0x2c')](_0x3cc827[_0x2895('0x2b')]);_0x3e1d16[_0x2895('0x34')]=_[_0x2895('0x2d')](_0x3e1d16['model'],_0x3e1d16['query']);_0x2bac35[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x3e1d16[_0x2895('0x2a')],qs[_0x2895('0x2e')](_0x3cc827[_0x2895('0x2b')]['fields']));_0x2bac35['attributes']=_0x2bac35[_0x2895('0x2f')][_0x2895('0x30')]?_0x2bac35[_0x2895('0x2f')]:_0x3e1d16[_0x2895('0x2a')];if(_0x3cc827[_0x2895('0x2b')][_0x2895('0x3b')]){_0x2bac35[_0x2895('0x3c')]=[{'all':!![]}];}_0x2bac35=_['merge']({},_0x2bac35,_0x3cc827[_0x2895('0x3a')]);return db[_0x2895('0x3f')][_0x2895('0x40')](_0x2bac35)[_0x2895('0x20')](handleEntityNotFound(_0x28967f,null))[_0x2895('0x20')](respondWithResult(_0x28967f,null))[_0x2895('0x3d')](handleError(_0x28967f,null));};exports[_0x2895('0x41')]=function(_0x299d71,_0x549059){return db[_0x2895('0x3f')][_0x2895('0x41')](_0x299d71[_0x2895('0x42')],{})['then'](respondWithResult(_0x549059,0xc9))[_0x2895('0x3d')](handleError(_0x549059,null));};exports[_0x2895('0x1f')]=function(_0x5e4f70,_0xbb09a6){if(_0x5e4f70[_0x2895('0x42')]['id']){delete _0x5e4f70[_0x2895('0x42')]['id'];}return db[_0x2895('0x3f')][_0x2895('0x40')]({'where':{'id':_0x5e4f70[_0x2895('0x43')]['id']}})[_0x2895('0x20')](handleEntityNotFound(_0xbb09a6,null))['then'](saveUpdates(_0x5e4f70[_0x2895('0x42')],null))[_0x2895('0x20')](respondWithResult(_0xbb09a6,null))['catch'](handleError(_0xbb09a6,null));};exports['destroy']=function(_0x574839,_0x212a1f){return db[_0x2895('0x3f')][_0x2895('0x40')]({'where':{'id':_0x574839[_0x2895('0x43')]['id']}})[_0x2895('0x20')](handleEntityNotFound(_0x212a1f,null))[_0x2895('0x20')](removeEntity(_0x212a1f,null))[_0x2895('0x3d')](handleError(_0x212a1f,null));}; \ No newline at end of file +var _0x32b6=['end','json','count','offset','limit','Content-Range','reject','update','destroy','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ZendeskField','includeAll','rows','include','find','catch','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x1976f9,_0x14bab7){var _0xb6715a=function(_0x3086a4){while(--_0x3086a4){_0x1976f9['push'](_0x1976f9['shift']());}};_0xb6715a(++_0x14bab7);}(_0x32b6,0x1d1));var _0x632b=function(_0x2dbaa4,_0x10a7f8){_0x2dbaa4=_0x2dbaa4-0x0;var _0x1935ce=_0x32b6[_0x2dbaa4];return _0x1935ce;};'use strict';var pdf=require(_0x632b('0x0'));var emlformat=require(_0x632b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x632b('0x2'));var jsonpatch=require(_0x632b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x632b('0x4'));var Mustache=require(_0x632b('0x5'));var util=require(_0x632b('0x6'));var path=require(_0x632b('0x7'));var sox=require(_0x632b('0x8'));var csv=require(_0x632b('0x9'));var ejs=require(_0x632b('0xa'));var fs=require('fs');var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x9'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];function respondWithStatusCode(_0xe81378,_0x3d8bed){_0x3d8bed=_0x3d8bed||0xcc;return function(_0x22c182){if(_0x22c182){return _0xe81378['sendStatus'](_0x3d8bed);}return _0xe81378[_0x632b('0x18')](_0x3d8bed)[_0x632b('0x19')]();};}function respondWithResult(_0x9246a6,_0x5a97da){_0x5a97da=_0x5a97da||0xc8;return function(_0x721883){if(_0x721883){return _0x9246a6[_0x632b('0x18')](_0x5a97da)[_0x632b('0x1a')](_0x721883);}};}function respondWithFilteredResult(_0x17ff9b,_0x40d410){return function(_0x21cdd3){if(_0x21cdd3){var _0x4efe39=_0x21cdd3[_0x632b('0x1b')],_0x17ddc5=_0x40d410['offset'],_0x52f353=_0x40d410[_0x632b('0x1c')]+_0x40d410[_0x632b('0x1d')],_0x4fdef2;if(_0x52f353>=_0x4efe39){_0x52f353=_0x4efe39;_0x4fdef2=0xc8;}else{_0x4fdef2=0xce;}_0x17ff9b[_0x632b('0x18')](_0x4fdef2);return _0x17ff9b['set'](_0x632b('0x1e'),_0x17ddc5+'-'+_0x52f353+'/'+_0x4efe39)[_0x632b('0x1a')](_0x21cdd3);}return null;};}function patchUpdates(_0x366028){return function(_0x3683e4){try{jsonpatch['apply'](_0x3683e4,_0x366028,!![]);}catch(_0x472e34){return BPromise[_0x632b('0x1f')](_0x472e34);}return _0x3683e4['save']();};}function saveUpdates(_0x116f62,_0x50b930){return function(_0x4b5618){if(_0x4b5618){return _0x4b5618[_0x632b('0x20')](_0x116f62)['then'](function(_0xc9d237){return _0xc9d237;});}return null;};}function removeEntity(_0x1c4530,_0x2a6833){return function(_0x540bfb){if(_0x540bfb){return _0x540bfb[_0x632b('0x21')]()[_0x632b('0x22')](function(){_0x1c4530['status'](0xcc)[_0x632b('0x19')]();});}};}function handleEntityNotFound(_0x379dc2,_0x30ffb9){return function(_0x1e448c){if(!_0x1e448c){_0x379dc2[_0x632b('0x23')](0x194);}return _0x1e448c;};}function handleError(_0x183c5c,_0x5ec5ea){_0x5ec5ea=_0x5ec5ea||0x1f4;return function(_0x5e7b20){logger[_0x632b('0x24')](_0x5e7b20['stack']);if(_0x5e7b20[_0x632b('0x25')]){delete _0x5e7b20[_0x632b('0x25')];}_0x183c5c['status'](_0x5ec5ea)[_0x632b('0x26')](_0x5e7b20);};}exports[_0x632b('0x27')]=function(_0x29d9aa,_0x18dc8c){var _0x4728a8={},_0x515d74={},_0xe9d530={'count':0x0,'rows':[]};var _0x1975ac=_[_0x632b('0x28')](db['ZendeskField'][_0x632b('0x29')],function(_0x35348e){return{'name':_0x35348e[_0x632b('0x2a')],'type':_0x35348e[_0x632b('0x2b')][_0x632b('0x2c')]};});_0x515d74[_0x632b('0x2d')]=_[_0x632b('0x28')](_0x1975ac,_0x632b('0x25'));_0x515d74[_0x632b('0x2e')]=_[_0x632b('0x2f')](_0x29d9aa[_0x632b('0x2e')]);_0x515d74[_0x632b('0x30')]=_[_0x632b('0x31')](_0x515d74[_0x632b('0x2d')],_0x515d74[_0x632b('0x2e')]);_0x4728a8[_0x632b('0x32')]=_[_0x632b('0x31')](_0x515d74[_0x632b('0x2d')],qs[_0x632b('0x33')](_0x29d9aa[_0x632b('0x2e')]['fields']));_0x4728a8[_0x632b('0x32')]=_0x4728a8[_0x632b('0x32')][_0x632b('0x34')]?_0x4728a8[_0x632b('0x32')]:_0x515d74['model'];if(!_0x29d9aa[_0x632b('0x2e')]['hasOwnProperty'](_0x632b('0x35'))){_0x4728a8[_0x632b('0x1d')]=qs['limit'](_0x29d9aa[_0x632b('0x2e')][_0x632b('0x1d')]);_0x4728a8[_0x632b('0x1c')]=qs[_0x632b('0x1c')](_0x29d9aa[_0x632b('0x2e')][_0x632b('0x1c')]);}_0x4728a8[_0x632b('0x36')]=qs[_0x632b('0x37')](_0x29d9aa['query']['sort']);_0x4728a8[_0x632b('0x38')]=qs[_0x632b('0x30')](_[_0x632b('0x39')](_0x29d9aa[_0x632b('0x2e')],_0x515d74[_0x632b('0x30')]),_0x1975ac);if(_0x29d9aa[_0x632b('0x2e')][_0x632b('0x3a')]){_0x4728a8[_0x632b('0x38')]=_['merge'](_0x4728a8['where'],{'$or':_[_0x632b('0x28')](_0x1975ac,function(_0x581b92){if(_0x581b92[_0x632b('0x2b')]!==_0x632b('0x3b')){var _0x3d6199={};_0x3d6199[_0x581b92[_0x632b('0x25')]]={'$like':'%'+_0x29d9aa[_0x632b('0x2e')][_0x632b('0x3a')]+'%'};return _0x3d6199;}})});}_0x4728a8=_[_0x632b('0x3c')]({},_0x4728a8,_0x29d9aa[_0x632b('0x3d')]);var _0x2730c2={'where':_0x4728a8[_0x632b('0x38')]};return db[_0x632b('0x3e')][_0x632b('0x1b')](_0x2730c2)[_0x632b('0x22')](function(_0x1c348e){_0xe9d530[_0x632b('0x1b')]=_0x1c348e;if(_0x29d9aa[_0x632b('0x2e')][_0x632b('0x3f')]){_0x4728a8['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x4728a8);})['then'](function(_0x57f099){_0xe9d530[_0x632b('0x40')]=_0x57f099;return _0xe9d530;})['then'](respondWithFilteredResult(_0x18dc8c,_0x4728a8))['catch'](handleError(_0x18dc8c,null));};exports['show']=function(_0x472a4f,_0x4490d4){var _0x417a30={'raw':!![],'where':{'id':_0x472a4f['params']['id']}},_0x223457={};_0x223457[_0x632b('0x2d')]=_[_0x632b('0x2f')](db[_0x632b('0x3e')]['rawAttributes']);_0x223457[_0x632b('0x2e')]=_[_0x632b('0x2f')](_0x472a4f[_0x632b('0x2e')]);_0x223457[_0x632b('0x30')]=_[_0x632b('0x31')](_0x223457[_0x632b('0x2d')],_0x223457['query']);_0x417a30[_0x632b('0x32')]=_[_0x632b('0x31')](_0x223457[_0x632b('0x2d')],qs[_0x632b('0x33')](_0x472a4f['query']['fields']));_0x417a30[_0x632b('0x32')]=_0x417a30[_0x632b('0x32')][_0x632b('0x34')]?_0x417a30[_0x632b('0x32')]:_0x223457[_0x632b('0x2d')];if(_0x472a4f[_0x632b('0x2e')]['includeAll']){_0x417a30[_0x632b('0x41')]=[{'all':!![]}];}_0x417a30=_[_0x632b('0x3c')]({},_0x417a30,_0x472a4f[_0x632b('0x3d')]);return db[_0x632b('0x3e')][_0x632b('0x42')](_0x417a30)[_0x632b('0x22')](handleEntityNotFound(_0x4490d4,null))[_0x632b('0x22')](respondWithResult(_0x4490d4,null))[_0x632b('0x43')](handleError(_0x4490d4,null));};exports['create']=function(_0x876a33,_0x56f254){return db[_0x632b('0x3e')]['create'](_0x876a33[_0x632b('0x44')],{})[_0x632b('0x22')](respondWithResult(_0x56f254,0xc9))[_0x632b('0x43')](handleError(_0x56f254,null));};exports[_0x632b('0x20')]=function(_0x3924db,_0x57a580){if(_0x3924db[_0x632b('0x44')]['id']){delete _0x3924db[_0x632b('0x44')]['id'];}return db[_0x632b('0x3e')]['find']({'where':{'id':_0x3924db[_0x632b('0x45')]['id']}})[_0x632b('0x22')](handleEntityNotFound(_0x57a580,null))[_0x632b('0x22')](saveUpdates(_0x3924db[_0x632b('0x44')],null))[_0x632b('0x22')](respondWithResult(_0x57a580,null))['catch'](handleError(_0x57a580,null));};exports[_0x632b('0x21')]=function(_0x50adc4,_0x33da2b){return db[_0x632b('0x3e')][_0x632b('0x42')]({'where':{'id':_0x50adc4[_0x632b('0x45')]['id']}})[_0x632b('0x22')](handleEntityNotFound(_0x33da2b,null))['then'](removeEntity(_0x33da2b,null))['catch'](handleError(_0x33da2b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 466e31b..6cfdb55 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 _0xfa2f=['define','zendesk_unique_index','idField','FieldId','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskField.attributes','exports'];(function(_0x550033,_0x7472ba){var _0x4ef16b=function(_0x1483fa){while(--_0x1483fa){_0x550033['push'](_0x550033['shift']());}};_0x4ef16b(++_0x7472ba);}(_0xfa2f,0xe8));var _0xffa2=function(_0x392013,_0x3c80a6){_0x392013=_0x392013-0x0;var _0x1d5fe2=_0xfa2f[_0x392013];return _0x1d5fe2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xffa2('0x0'))('api');var moment=require(_0xffa2('0x1'));var BPromise=require(_0xffa2('0x2'));var rp=require(_0xffa2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffa2('0x4'));var config=require(_0xffa2('0x5'));var attributes=require(_0xffa2('0x6'));module[_0xffa2('0x7')]=function(_0x25fd81,_0x2c7708){return _0x25fd81[_0xffa2('0x8')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xffa2('0x9'),'fields':[_0xffa2('0xa'),_0xffa2('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ec6=['rimraf','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','moment','request-promise'];(function(_0x479266,_0x320fc6){var _0x1afe8e=function(_0x478916){while(--_0x478916){_0x479266['push'](_0x479266['shift']());}};_0x1afe8e(++_0x320fc6);}(_0x5ec6,0x7f));var _0x65ec=function(_0x730a22,_0x291d0d){_0x730a22=_0x730a22-0x0;var _0x79d2c3=_0x5ec6[_0x730a22];return _0x79d2c3;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var logger=require(_0x65ec('0x2'))('api');var moment=require(_0x65ec('0x3'));var BPromise=require('bluebird');var rp=require(_0x65ec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65ec('0x5'));var config=require('../../config/environment');var attributes=require(_0x65ec('0x6'));module['exports']=function(_0x2fc973,_0xbb2e56){return _0x2fc973['define'](_0x65ec('0x7'),attributes,{'tableName':_0x65ec('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x65ec('0x9'),_0x65ec('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 5b24f8a..b662d6c 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 _0xe0a4=['then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2dbe07,_0xc4787a){var _0x367926=function(_0x1e5add){while(--_0x1e5add){_0x2dbe07['push'](_0x2dbe07['shift']());}};_0x367926(++_0xc4787a);}(_0xe0a4,0x1d6));var _0x4e0a=function(_0x36ff96,_0x4b128d){_0x36ff96=_0x36ff96-0x0;var _0x40f282=_0xe0a4[_0x36ff96];return _0x40f282;};'use strict';var _=require(_0x4e0a('0x0'));var util=require(_0x4e0a('0x1'));var moment=require(_0x4e0a('0x2'));var BPromise=require(_0x4e0a('0x3'));var rs=require(_0x4e0a('0x4'));var fs=require('fs');var Redis=require(_0x4e0a('0x5'));var db=require(_0x4e0a('0x6'))['db'];var utils=require(_0x4e0a('0x7'));var logger=require(_0x4e0a('0x8'))(_0x4e0a('0x9'));var config=require(_0x4e0a('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4e0a('0xb')][_0x4e0a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46fcfb,_0x37c4aa,_0x2be20a){return new BPromise(function(_0x436c16,_0x5da22f){return client['request'](_0x46fcfb,_0x2be20a)[_0x4e0a('0xd')](function(_0x15f41e){logger[_0x4e0a('0xe')](_0x4e0a('0xf'),_0x37c4aa,_0x4e0a('0x10'));logger['debug'](_0x4e0a('0x11'),_0x37c4aa,'request\x20sent',JSON[_0x4e0a('0x12')](_0x15f41e));if(_0x15f41e[_0x4e0a('0x13')]){if(_0x15f41e[_0x4e0a('0x13')]['code']===0x1f4){logger[_0x4e0a('0x13')](_0x4e0a('0xf'),_0x37c4aa,_0x15f41e[_0x4e0a('0x13')]['message']);return _0x5da22f(_0x15f41e['error'][_0x4e0a('0x14')]);}logger[_0x4e0a('0x13')]('ZendeskField,\x20%s,\x20%s',_0x37c4aa,_0x15f41e[_0x4e0a('0x13')]['message']);return _0x436c16(_0x15f41e[_0x4e0a('0x13')][_0x4e0a('0x14')]);}else{logger[_0x4e0a('0xe')](_0x4e0a('0xf'),_0x37c4aa,_0x4e0a('0x10'));_0x436c16(_0x15f41e[_0x4e0a('0x15')][_0x4e0a('0x14')]);}})[_0x4e0a('0x16')](function(_0x1c1449){logger[_0x4e0a('0x13')](_0x4e0a('0xf'),_0x37c4aa,_0x1c1449);_0x5da22f(_0x1c1449);});});} \ No newline at end of file +var _0xfccd=['code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3a6405,_0x295e55){var _0x46eabb=function(_0x148893){while(--_0x148893){_0x3a6405['push'](_0x3a6405['shift']());}};_0x46eabb(++_0x295e55);}(_0xfccd,0x114));var _0xdfcc=function(_0x43379c,_0x271d36){_0x43379c=_0x43379c-0x0;var _0x495648=_0xfccd[_0x43379c];return _0x495648;};'use strict';var _=require(_0xdfcc('0x0'));var util=require('util');var moment=require(_0xdfcc('0x1'));var BPromise=require('bluebird');var rs=require(_0xdfcc('0x2'));var fs=require('fs');var Redis=require(_0xdfcc('0x3'));var db=require(_0xdfcc('0x4'))['db'];var utils=require(_0xdfcc('0x5'));var logger=require(_0xdfcc('0x6'))(_0xdfcc('0x7'));var config=require('../../config/environment');var jayson=require(_0xdfcc('0x8'));var client=jayson[_0xdfcc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12b58a,_0x30830b,_0x528e03){return new BPromise(function(_0x380841,_0x12526f){return client[_0xdfcc('0xa')](_0x12b58a,_0x528e03)[_0xdfcc('0xb')](function(_0x1ffedb){logger[_0xdfcc('0xc')](_0xdfcc('0xd'),_0x30830b,_0xdfcc('0xe'));logger[_0xdfcc('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x30830b,_0xdfcc('0xe'),JSON[_0xdfcc('0x10')](_0x1ffedb));if(_0x1ffedb[_0xdfcc('0x11')]){if(_0x1ffedb[_0xdfcc('0x11')][_0xdfcc('0x12')]===0x1f4){logger[_0xdfcc('0x11')](_0xdfcc('0xd'),_0x30830b,_0x1ffedb[_0xdfcc('0x11')][_0xdfcc('0x13')]);return _0x12526f(_0x1ffedb[_0xdfcc('0x11')][_0xdfcc('0x13')]);}logger[_0xdfcc('0x11')](_0xdfcc('0xd'),_0x30830b,_0x1ffedb['error'][_0xdfcc('0x13')]);return _0x380841(_0x1ffedb['error']['message']);}else{logger[_0xdfcc('0xc')]('ZendeskField,\x20%s,\x20%s',_0x30830b,_0xdfcc('0xe'));_0x380841(_0x1ffedb[_0xdfcc('0x14')][_0xdfcc('0x13')]);}})['catch'](function(_0x145f8c){logger[_0xdfcc('0x11')](_0xdfcc('0xd'),_0x30830b,_0x145f8c);_0x12526f(_0x145f8c);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4b2937d..522c07e 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 _0x524f=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','addConfiguration','update'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0x524f,0x172));var _0xf524=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x524f[_0x34aec4];return _0x51e1a7;};'use strict';var multer=require(_0xf524('0x0'));var util=require(_0xf524('0x1'));var path=require(_0xf524('0x2'));var timeout=require(_0xf524('0x3'));var express=require(_0xf524('0x4'));var router=express[_0xf524('0x5')]();var auth=require(_0xf524('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf524('0x7'));var controller=require(_0xf524('0x8'));router[_0xf524('0x9')]('/',auth['isAuthenticated'](),controller[_0xf524('0xa')]);router[_0xf524('0x9')](_0xf524('0xb'),auth['isAuthenticated'](),controller[_0xf524('0xc')]);router[_0xf524('0x9')](_0xf524('0xd'),auth[_0xf524('0xe')](),controller[_0xf524('0xf')]);router[_0xf524('0x9')]('/:id/fields',auth[_0xf524('0xe')](),controller[_0xf524('0x10')]);router[_0xf524('0x11')]('/',auth[_0xf524('0xe')](),controller[_0xf524('0x12')]);router[_0xf524('0x11')](_0xf524('0xd'),auth[_0xf524('0xe')](),controller[_0xf524('0x13')]);router['put']('/:id',auth[_0xf524('0xe')](),controller[_0xf524('0x14')]);router[_0xf524('0x15')](_0xf524('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf524('0x16')]=router; \ No newline at end of file +var _0xe2c1=['getFields','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','express','../../components/auth/service','./intZohoAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x568c68,_0x2717f9){var _0x3483bf=function(_0x2a9c62){while(--_0x2a9c62){_0x568c68['push'](_0x568c68['shift']());}};_0x3483bf(++_0x2717f9);}(_0xe2c1,0x12f));var _0x1e2c=function(_0x562faa,_0x23adc7){_0x562faa=_0x562faa-0x0;var _0xc70f59=_0xe2c1[_0x562faa];return _0xc70f59;};'use strict';var multer=require(_0x1e2c('0x0'));var util=require('util');var path=require(_0x1e2c('0x1'));var timeout=require('connect-timeout');var express=require(_0x1e2c('0x2'));var router=express['Router']();var auth=require(_0x1e2c('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1e2c('0x4'));router['get']('/',auth[_0x1e2c('0x5')](),controller[_0x1e2c('0x6')]);router[_0x1e2c('0x7')]('/:id',auth[_0x1e2c('0x5')](),controller[_0x1e2c('0x8')]);router[_0x1e2c('0x7')](_0x1e2c('0x9'),auth['isAuthenticated'](),controller[_0x1e2c('0xa')]);router[_0x1e2c('0x7')](_0x1e2c('0xb'),auth[_0x1e2c('0x5')](),controller[_0x1e2c('0xc')]);router[_0x1e2c('0xd')]('/',auth[_0x1e2c('0x5')](),controller['create']);router['post'](_0x1e2c('0x9'),auth[_0x1e2c('0x5')](),controller[_0x1e2c('0xe')]);router[_0x1e2c('0xf')](_0x1e2c('0x10'),auth[_0x1e2c('0x5')](),controller[_0x1e2c('0x11')]);router[_0x1e2c('0x12')]('/:id',auth[_0x1e2c('0x5')](),controller[_0x1e2c('0x13')]);module[_0x1e2c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 283df06..be9ee9c 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 _0xdd83=['exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd83,0x6a));var _0x3dd8=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xdd83[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require('sequelize');module[_0x3dd8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3dd8('0x1')]},'host':{'type':Sequelize[_0x3dd8('0x1')]},'zone':{'type':Sequelize[_0x3dd8('0x1')]},'clientId':{'type':Sequelize[_0x3dd8('0x1')]},'clientSecret':{'type':Sequelize[_0x3dd8('0x1')]},'serverUrl':{'type':Sequelize[_0x3dd8('0x1')]},'code':{'type':Sequelize[_0x3dd8('0x1')]},'refreshToken':{'type':Sequelize[_0x3dd8('0x1')]}}; \ No newline at end of file +var _0x4481=['exports','STRING','sequelize'];(function(_0x18e550,_0x49c16b){var _0x1b65c0=function(_0x2269e9){while(--_0x2269e9){_0x18e550['push'](_0x18e550['shift']());}};_0x1b65c0(++_0x49c16b);}(_0x4481,0x1c4));var _0x1448=function(_0x5bd724,_0x3ec189){_0x5bd724=_0x5bd724-0x0;var _0x34d520=_0x4481[_0x5bd724];return _0x34d520;};'use strict';var Sequelize=require(_0x1448('0x0'));module[_0x1448('0x1')]={'name':{'type':Sequelize[_0x1448('0x2')]},'description':{'type':Sequelize[_0x1448('0x2')]},'host':{'type':Sequelize[_0x1448('0x2')]},'zone':{'type':Sequelize[_0x1448('0x2')]},'clientId':{'type':Sequelize[_0x1448('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x1448('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 17d1b4c..2774f88 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 _0x5eef=['serverUrl','code','zoho.eu','slice','lastIndexOf','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','sendStatus','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','Subjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','host','zone','clientId'];(function(_0x5ff00c,_0x22541e){var _0x20e16c=function(_0x1a4971){while(--_0x1a4971){_0x5ff00c['push'](_0x5ff00c['shift']());}};_0x20e16c(++_0x22541e);}(_0x5eef,0x9c));var _0xf5ee=function(_0x1b9416,_0x10aa31){_0x1b9416=_0x1b9416-0x0;var _0x33a79b=_0x5eef[_0x1b9416];return _0x33a79b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xf5ee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5ee('0x1'));var rp=require('request-promise');var moment=require(_0xf5ee('0x2'));var BPromise=require(_0xf5ee('0x3'));var Mustache=require(_0xf5ee('0x4'));var util=require(_0xf5ee('0x5'));var path=require(_0xf5ee('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf5ee('0x7'));var squel=require(_0xf5ee('0x8'));var crypto=require('crypto');var jsforce=require(_0xf5ee('0x9'));var deskjs=require(_0xf5ee('0xa'));var toCsv=require(_0xf5ee('0xb'));var querystring=require(_0xf5ee('0xc'));var Papa=require(_0xf5ee('0xd'));var Redis=require(_0xf5ee('0xe'));var authService=require(_0xf5ee('0xf'));var qs=require(_0xf5ee('0x10'));var as=require(_0xf5ee('0x11'));var hardwareService=require(_0xf5ee('0x12'));var logger=require('../../config/logger')(_0xf5ee('0x13'));var utils=require('../../config/utils');var config=require(_0xf5ee('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf5ee('0x15'))['db'];var integrations=require(_0xf5ee('0x16'));var jayson=require(_0xf5ee('0x17'));var client=jayson[_0xf5ee('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x665948,_0x22b21e,_0x204afe,_0x22d22c){return new BPromise(function(_0x51c2e8,_0x5f527d){var _0x8a5106=_0x22d22c||client;return _0x8a5106[_0xf5ee('0x19')](_0x665948,_0x204afe)[_0xf5ee('0x1a')](function(_0x43f6ce){logger[_0xf5ee('0x1b')]('ZohoAccount,\x20%s,\x20%s',_0x22b21e,_0xf5ee('0x1c'));logger[_0xf5ee('0x1d')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x22b21e,_0xf5ee('0x1c'),JSON[_0xf5ee('0x1e')](_0x43f6ce));if(_0x43f6ce[_0xf5ee('0x1f')]){if(_0x43f6ce[_0xf5ee('0x1f')]['code']===0x1f4){logger[_0xf5ee('0x1f')](_0xf5ee('0x20'),_0x22b21e,_0x43f6ce[_0xf5ee('0x1f')]['message']);return _0x5f527d(_0x43f6ce[_0xf5ee('0x1f')][_0xf5ee('0x21')]);}logger[_0xf5ee('0x1f')](_0xf5ee('0x20'),_0x22b21e,_0x43f6ce[_0xf5ee('0x1f')][_0xf5ee('0x21')]);return _0x51c2e8(_0x43f6ce['error']['message']);}else{logger[_0xf5ee('0x1b')](_0xf5ee('0x20'),_0x22b21e,_0xf5ee('0x1c'));_0x51c2e8(_0x43f6ce[_0xf5ee('0x22')]['message']);}})[_0xf5ee('0x23')](function(_0x4dc65e){logger[_0xf5ee('0x1f')](_0xf5ee('0x20'),_0x22b21e,_0x4dc65e);_0x5f527d(_0x4dc65e);});});}function respondWithStatusCode(_0x2e2f35,_0x1c53bd){_0x1c53bd=_0x1c53bd||0xcc;return function(_0x931cd6){if(_0x931cd6){return _0x2e2f35['sendStatus'](_0x1c53bd);}return _0x2e2f35[_0xf5ee('0x24')](_0x1c53bd)[_0xf5ee('0x25')]();};}function respondWithResult(_0x5b7744,_0x262f9a){_0x262f9a=_0x262f9a||0xc8;return function(_0x196722){if(_0x196722){return _0x5b7744[_0xf5ee('0x24')](_0x262f9a)[_0xf5ee('0x26')](_0x196722);}};}function respondWithFilteredResult(_0xe647a5,_0x3db008){return function(_0x16f075){if(_0x16f075){var _0x18f9f5=_0x16f075[_0xf5ee('0x27')],_0x1ac16b=_0x3db008[_0xf5ee('0x28')],_0x576d16=_0x3db008[_0xf5ee('0x28')]+_0x3db008[_0xf5ee('0x29')],_0x4b1c0c;if(_0x576d16>=_0x18f9f5){_0x576d16=_0x18f9f5;_0x4b1c0c=0xc8;}else{_0x4b1c0c=0xce;}_0xe647a5[_0xf5ee('0x24')](_0x4b1c0c);return _0xe647a5[_0xf5ee('0x2a')](_0xf5ee('0x2b'),_0x1ac16b+'-'+_0x576d16+'/'+_0x18f9f5)[_0xf5ee('0x26')](_0x16f075);}return null;};}function patchUpdates(_0x54ae8e){return function(_0x560554){try{jsonpatch[_0xf5ee('0x2c')](_0x560554,_0x54ae8e,!![]);}catch(_0x50c583){return BPromise[_0xf5ee('0x2d')](_0x50c583);}return _0x560554['save']();};}function saveUpdates(_0x36c069,_0x5589d1){return function(_0x150a19){if(_0x150a19){return _0x150a19[_0xf5ee('0x2e')](_0x36c069)[_0xf5ee('0x1a')](function(_0x280ef2){return _0x280ef2;});}return null;};}function removeEntity(_0x38535d,_0x17ba96){return function(_0x10d9b4){if(_0x10d9b4){return _0x10d9b4['destroy']()['then'](function(){_0x38535d[_0xf5ee('0x24')](0xcc)[_0xf5ee('0x25')]();});}};}function handleEntityNotFound(_0x374ab1,_0x375682){return function(_0x3b8a08){if(!_0x3b8a08){_0x374ab1[_0xf5ee('0x2f')](0x194);}return _0x3b8a08;};}function handleError(_0x4b9e21,_0x3a01e2){_0x3a01e2=_0x3a01e2||0x1f4;return function(_0x3afa1e){logger[_0xf5ee('0x1f')](_0x3afa1e[_0xf5ee('0x30')]);if(_0x3afa1e[_0xf5ee('0x31')]){delete _0x3afa1e['name'];}_0x4b9e21['status'](_0x3a01e2)[_0xf5ee('0x32')](_0x3afa1e);};}exports[_0xf5ee('0x33')]=function(_0x15317f,_0x4fabc5){var _0x5e67b1={},_0x34674a={},_0xa4712f={'count':0x0,'rows':[]};var _0x7da14f=_[_0xf5ee('0x34')](db[_0xf5ee('0x35')][_0xf5ee('0x36')],function(_0x356eaa){return{'name':_0x356eaa[_0xf5ee('0x37')],'type':_0x356eaa[_0xf5ee('0x38')][_0xf5ee('0x39')]};});_0x34674a[_0xf5ee('0x3a')]=_[_0xf5ee('0x34')](_0x7da14f,_0xf5ee('0x31'));_0x34674a[_0xf5ee('0x3b')]=_[_0xf5ee('0x3c')](_0x15317f[_0xf5ee('0x3b')]);_0x34674a[_0xf5ee('0x3d')]=_[_0xf5ee('0x3e')](_0x34674a[_0xf5ee('0x3a')],_0x34674a['query']);_0x5e67b1['attributes']=_[_0xf5ee('0x3e')](_0x34674a[_0xf5ee('0x3a')],qs[_0xf5ee('0x3f')](_0x15317f[_0xf5ee('0x3b')][_0xf5ee('0x3f')]));_0x5e67b1['attributes']=_0x5e67b1[_0xf5ee('0x40')][_0xf5ee('0x41')]?_0x5e67b1[_0xf5ee('0x40')]:_0x34674a[_0xf5ee('0x3a')];if(!_0x15317f[_0xf5ee('0x3b')]['hasOwnProperty'](_0xf5ee('0x42'))){_0x5e67b1[_0xf5ee('0x29')]=qs[_0xf5ee('0x29')](_0x15317f[_0xf5ee('0x3b')][_0xf5ee('0x29')]);_0x5e67b1[_0xf5ee('0x28')]=qs[_0xf5ee('0x28')](_0x15317f['query'][_0xf5ee('0x28')]);}_0x5e67b1[_0xf5ee('0x43')]=qs[_0xf5ee('0x44')](_0x15317f[_0xf5ee('0x3b')][_0xf5ee('0x44')]);_0x5e67b1[_0xf5ee('0x45')]=qs[_0xf5ee('0x3d')](_[_0xf5ee('0x46')](_0x15317f[_0xf5ee('0x3b')],_0x34674a[_0xf5ee('0x3d')]),_0x7da14f);if(_0x15317f['query'][_0xf5ee('0x47')]){_0x5e67b1[_0xf5ee('0x45')]=_[_0xf5ee('0x48')](_0x5e67b1['where'],{'$or':_[_0xf5ee('0x34')](_0x7da14f,function(_0x47787a){if(_0x47787a[_0xf5ee('0x38')]!=='VIRTUAL'){var _0x35914b={};_0x35914b[_0x47787a[_0xf5ee('0x31')]]={'$like':'%'+_0x15317f[_0xf5ee('0x3b')][_0xf5ee('0x47')]+'%'};return _0x35914b;}})});}_0x5e67b1=_[_0xf5ee('0x48')]({},_0x5e67b1,_0x15317f[_0xf5ee('0x49')]);var _0x38ad1a={'where':_0x5e67b1['where']};return db[_0xf5ee('0x35')][_0xf5ee('0x27')](_0x38ad1a)['then'](function(_0x516e6d){_0xa4712f[_0xf5ee('0x27')]=_0x516e6d;if(_0x15317f[_0xf5ee('0x3b')][_0xf5ee('0x4a')]){_0x5e67b1[_0xf5ee('0x4b')]=[{'all':!![]}];}return db[_0xf5ee('0x35')][_0xf5ee('0x4c')](_0x5e67b1);})[_0xf5ee('0x1a')](function(_0xf52917){_0xa4712f[_0xf5ee('0x4d')]=_0xf52917;return _0xa4712f;})[_0xf5ee('0x1a')](respondWithFilteredResult(_0x4fabc5,_0x5e67b1))[_0xf5ee('0x23')](handleError(_0x4fabc5,null));};exports[_0xf5ee('0x4e')]=function(_0x124557,_0x2e7139){var _0x47701c={'raw':![],'where':{'id':_0x124557[_0xf5ee('0x4f')]['id']}},_0x33e6b4={};_0x33e6b4['model']=_[_0xf5ee('0x3c')](db[_0xf5ee('0x35')][_0xf5ee('0x36')]);_0x33e6b4[_0xf5ee('0x3b')]=_[_0xf5ee('0x3c')](_0x124557[_0xf5ee('0x3b')]);_0x33e6b4[_0xf5ee('0x3d')]=_[_0xf5ee('0x3e')](_0x33e6b4[_0xf5ee('0x3a')],_0x33e6b4['query']);_0x47701c[_0xf5ee('0x40')]=_[_0xf5ee('0x3e')](_0x33e6b4[_0xf5ee('0x3a')],qs[_0xf5ee('0x3f')](_0x124557['query'][_0xf5ee('0x3f')]));_0x47701c[_0xf5ee('0x40')]=_0x47701c['attributes'][_0xf5ee('0x41')]?_0x47701c[_0xf5ee('0x40')]:_0x33e6b4[_0xf5ee('0x3a')];if(_0x124557[_0xf5ee('0x3b')][_0xf5ee('0x4a')]){_0x47701c['include']=[{'all':!![]}];}_0x47701c=_[_0xf5ee('0x48')]({},_0x47701c,_0x124557[_0xf5ee('0x49')]);return db[_0xf5ee('0x35')][_0xf5ee('0x50')](_0x47701c)['then'](handleEntityNotFound(_0x2e7139,null))[_0xf5ee('0x1a')](respondWithResult(_0x2e7139,null))['catch'](handleError(_0x2e7139,null));};exports[_0xf5ee('0x51')]=function(_0x5910b2,_0x18fef9){return db['ZohoAccount'][_0xf5ee('0x51')](_0x5910b2[_0xf5ee('0x52')],{})[_0xf5ee('0x1a')](respondWithResult(_0x18fef9,0xc9))[_0xf5ee('0x23')](handleError(_0x18fef9,null));};exports[_0xf5ee('0x2e')]=function(_0x1ae7bc,_0x3b9d2e){if(_0x1ae7bc[_0xf5ee('0x52')]['id']){delete _0x1ae7bc[_0xf5ee('0x52')]['id'];}return db['ZohoAccount'][_0xf5ee('0x50')]({'where':{'id':_0x1ae7bc[_0xf5ee('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3b9d2e,null))['then'](saveUpdates(_0x1ae7bc[_0xf5ee('0x52')],null))[_0xf5ee('0x1a')](respondWithResult(_0x3b9d2e,null))[_0xf5ee('0x23')](handleError(_0x3b9d2e,null));};exports['destroy']=function(_0x30ecce,_0x51490c){return db[_0xf5ee('0x35')][_0xf5ee('0x50')]({'where':{'id':_0x30ecce['params']['id']}})[_0xf5ee('0x1a')](handleEntityNotFound(_0x51490c,null))['then'](removeEntity(_0x51490c,null))['catch'](handleError(_0x51490c,null));};exports[_0xf5ee('0x53')]=function(_0x2f485d,_0x16e7e7,_0x14336a){var _0x3f43bc={};var _0x18b0d7={};var _0x5ca260;var _0x468e1f;return db[_0xf5ee('0x35')][_0xf5ee('0x54')]({'where':{'id':_0x2f485d['params']['id']}})[_0xf5ee('0x1a')](handleEntityNotFound(_0x16e7e7,null))[_0xf5ee('0x1a')](function(_0x10204b){if(_0x10204b){_0x5ca260=_0x10204b;_0x18b0d7[_0xf5ee('0x3a')]=_[_0xf5ee('0x3c')](db[_0xf5ee('0x55')]['rawAttributes']);_0x18b0d7[_0xf5ee('0x3b')]=_[_0xf5ee('0x3c')](_0x2f485d['query']);_0x18b0d7[_0xf5ee('0x3d')]=_[_0xf5ee('0x3e')](_0x18b0d7[_0xf5ee('0x3a')],_0x18b0d7[_0xf5ee('0x3b')]);_0x3f43bc[_0xf5ee('0x40')]=_[_0xf5ee('0x3e')](_0x18b0d7[_0xf5ee('0x3a')],qs[_0xf5ee('0x3f')](_0x2f485d[_0xf5ee('0x3b')][_0xf5ee('0x3f')]));_0x3f43bc[_0xf5ee('0x40')]=_0x3f43bc[_0xf5ee('0x40')][_0xf5ee('0x41')]?_0x3f43bc[_0xf5ee('0x40')]:_0x18b0d7[_0xf5ee('0x3a')];_0x3f43bc[_0xf5ee('0x43')]=qs[_0xf5ee('0x44')](_0x2f485d[_0xf5ee('0x3b')]['sort']);_0x3f43bc[_0xf5ee('0x45')]=qs[_0xf5ee('0x3d')](_[_0xf5ee('0x46')](_0x2f485d[_0xf5ee('0x3b')],_0x18b0d7[_0xf5ee('0x3d')]));if(_0x2f485d[_0xf5ee('0x3b')][_0xf5ee('0x47')]){_0x3f43bc[_0xf5ee('0x45')]=_['merge'](_0x3f43bc[_0xf5ee('0x45')],{'$or':_['map'](_0x3f43bc['attributes'],function(_0x58f637){var _0x4161de={};_0x4161de[_0x58f637]={'$like':'%'+_0x2f485d[_0xf5ee('0x3b')][_0xf5ee('0x47')]+'%'};return _0x4161de;})});}_0x3f43bc=_[_0xf5ee('0x48')]({},_0x3f43bc,_0x2f485d[_0xf5ee('0x49')]);return _0x5ca260['getConfigurations'](_0x3f43bc);}})['then'](function(_0xd3768c){if(_0xd3768c){_0x468e1f=_0xd3768c[_0xf5ee('0x41')];if(!_0x2f485d['query'][_0xf5ee('0x56')]('nolimit')){_0x3f43bc[_0xf5ee('0x29')]=qs[_0xf5ee('0x29')](_0x2f485d[_0xf5ee('0x3b')]['limit']);_0x3f43bc[_0xf5ee('0x28')]=qs[_0xf5ee('0x28')](_0x2f485d[_0xf5ee('0x3b')]['offset']);}return _0x5ca260[_0xf5ee('0x53')](_0x3f43bc);}})[_0xf5ee('0x1a')](function(_0x557f57){if(_0x557f57){return _0x557f57?{'count':_0x468e1f,'rows':_0x557f57}:null;}})[_0xf5ee('0x1a')](respondWithResult(_0x16e7e7,null))[_0xf5ee('0x23')](handleError(_0x16e7e7,null));};exports['addConfiguration']=function(_0x4f7272,_0x22d266,_0x5f192d){if(_0x4f7272[_0xf5ee('0x52')]['id']){delete _0x4f7272['body']['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x4f7272[_0xf5ee('0x4f')]['id']}})[_0xf5ee('0x1a')](handleEntityNotFound(_0x22d266,null))['then'](function(_0x331e6b){if(_0x331e6b){_0x4f7272['body']['AccountId']=_0x331e6b['id'];_0x4f7272[_0xf5ee('0x52')][_0xf5ee('0x57')]=integrations['getSubjects'](_0x4f7272[_0xf5ee('0x52')][_0xf5ee('0x58')],_0x4f7272[_0xf5ee('0x52')][_0xf5ee('0x38')]);_0x4f7272['body'][_0xf5ee('0x59')]=integrations[_0xf5ee('0x5a')](_0x4f7272[_0xf5ee('0x52')][_0xf5ee('0x58')],_0x4f7272[_0xf5ee('0x52')][_0xf5ee('0x38')]);return db['ZohoConfiguration']['create'](_0x4f7272['body'],{'include':[{'model':db[_0xf5ee('0x5b')],'as':_0xf5ee('0x57')},{'model':db[_0xf5ee('0x5b')],'as':'Descriptions'}]});}return null;})[_0xf5ee('0x1a')](respondWithResult(_0x22d266,null))[_0xf5ee('0x23')](handleError(_0x22d266,null));};function getAccessToken(_0x3313e7){return new Promise(function(_0x4c8f87,_0x5b833b){var _0x399e68;switch(_0x3313e7['zone']){case'US':_0x399e68='https://accounts.zoho.com';break;case'AU':_0x399e68=_0xf5ee('0x5c');break;case'EU':_0x399e68='https://accounts.zoho.eu';break;case'IN':_0x399e68=_0xf5ee('0x5d');break;case'CN':_0x399e68='https://accounts.zoho.com.cn';break;default:_0x399e68=_0xf5ee('0x5e');break;}var _0x8ea972={'method':_0xf5ee('0x5f'),'uri':_0x399e68+_0xf5ee('0x60'),'qs':{'refresh_token':_0x3313e7[_0xf5ee('0x61')],'client_id':_0x3313e7['clientId'],'client_secret':_0x3313e7[_0xf5ee('0x62')],'grant_type':_0xf5ee('0x63')},'json':!![]};return rp(_0x8ea972)[_0xf5ee('0x1a')](function(_0x3e040d){if(_0x3e040d[_0xf5ee('0x64')]){_0x4c8f87(_0x3e040d[_0xf5ee('0x64')]);}else{_0x5b833b('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xf5ee('0x23')](function(_0x22329b){_0x5b833b(_0x22329b);});});}exports['getFields']=function(_0x5b781f,_0x36bdc2,_0x1928f7){var _0x5280cb,_0xdd57a,_0x520d3a,_0x55b02b,_0x2a259e;return db['ZohoAccount']['findOne']({'where':{'id':_0x5b781f[_0xf5ee('0x4f')]['id']},'attributes':['id',_0xf5ee('0x65'),_0xf5ee('0x66'),_0xf5ee('0x67'),'clientSecret',_0xf5ee('0x68'),_0xf5ee('0x69'),_0xf5ee('0x61')]})[_0xf5ee('0x1a')](handleEntityNotFound(_0x36bdc2,null))['then'](function(_0x49d077){_0x2a259e=_0x49d077;_0x5280cb=_0x2a259e[_0xf5ee('0x65')];_0xdd57a=_0x5280cb===_0xf5ee('0x6a')?'eu':'com';_0x520d3a=_0x2a259e[_0xf5ee('0x68')];var _0x5b5cd7=_0x520d3a[_0xf5ee('0x6b')](-0x1);if(_0x5b5cd7==='/'||_0x5b5cd7==='\x5c'||_0x5b5cd7===':'){_0x520d3a=_0x520d3a['substring'](0x0,_0x520d3a[_0xf5ee('0x6c')](_0x5b5cd7));}if(!_0x2a259e['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x2a259e);})[_0xf5ee('0x1a')](function(_0x59f315){if(_0x59f315){return rp({'method':'GET','uri':util['format'](_0xf5ee('0x6d'),_0xdd57a),'qs':{'module':_0xf5ee('0x6e')},'headers':{'Authorization':_0xf5ee('0x6f')+_0x59f315},'json':!![]});}})['then'](function(_0x43e0ad){if(_0x43e0ad){if(_0x43e0ad[_0xf5ee('0x70')]&&_0x43e0ad[_0xf5ee('0x70')][_0xf5ee('0x1f')]){throw new Error(_0x43e0ad[_0xf5ee('0x70')][_0xf5ee('0x1f')]['message']);}var _0x3f8915=[];var _0x424ecf=[];var _0x2d4135=[_0xf5ee('0x71'),_0xf5ee('0x72'),'Description',_0xf5ee('0x73'),_0xf5ee('0x74'),'Call_Result',_0xf5ee('0x75'),_0xf5ee('0x76')];_0x424ecf=_['remove'](_0x43e0ad[_0xf5ee('0x3f')],function(_0x1200ee){return _0x2d4135[_0xf5ee('0x77')](_0x1200ee[_0xf5ee('0x78')]);});for(var _0x372de4=0x0;_0x372de4<_0x424ecf[_0xf5ee('0x41')];_0x372de4++){if(_0x424ecf[_0x372de4][_0xf5ee('0x79')]===![]){_0x3f8915[_0xf5ee('0x7a')]({'id':_0x424ecf[_0x372de4]['id'],'name':_0x424ecf[_0x372de4][_0xf5ee('0x7b')],'custom':_0x424ecf[_0x372de4][_0xf5ee('0x7c')],'options':_0x424ecf[_0x372de4][_0xf5ee('0x7d')]==='picklist'&&_0x424ecf[_0x372de4][_0xf5ee('0x7e')][_0xf5ee('0x41')]>-0x1?_['map'](_0x424ecf[_0x372de4]['pick_list_values'],function(_0x48bf11){return{'name':_0x48bf11,'value':_0x48bf11};}):[]});}}return{'count':_0x3f8915[_0xf5ee('0x41')],'rows':_0x3f8915};}else{return{'count':0x0,'rows':[]};}})[_0xf5ee('0x1a')](respondWithResult(_0x36bdc2,null))[_0xf5ee('0x23')](function(_0x3eee6c){var _0x38d778=_0x5b781f['query'][_0xf5ee('0x7f')]?0x1f4:_0x3eee6c[_0xf5ee('0x80')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xf5ee('0x81'),_0x38d778,JSON[_0xf5ee('0x1e')](_0x3eee6c));delete _0x3eee6c['name'];if(_0x38d778===0x191){_0x38d778=0x190;}_0x36bdc2[_0xf5ee('0x24')](_0x38d778)[_0xf5ee('0x32')](_0x5b781f[_0xf5ee('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3eee6c[_0xf5ee('0x80')]}:_0x3eee6c);});}; \ No newline at end of file +var _0xd48e=['api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','apply','reject','update','destroy','stack','name','send','map','ZohoAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','params','includeAll','include','find','create','body','ZohoConfiguration','getConfigurations','hasOwnProperty','addConfiguration','channel','Descriptions','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','findOne','refreshToken','host','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes'];(function(_0x328827,_0x33c1f9){var _0x5b3785=function(_0x2fdb2a){while(--_0x2fdb2a){_0x328827['push'](_0x328827['shift']());}};_0x5b3785(++_0x33c1f9);}(_0xd48e,0x93));var _0xed48=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xd48e[_0x5a3cf0];return _0x5a64ee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xed48('0x0'));var rimraf=require(_0xed48('0x1'));var zipdir=require(_0xed48('0x2'));var jsonpatch=require(_0xed48('0x3'));var rp=require(_0xed48('0x4'));var moment=require('moment');var BPromise=require(_0xed48('0x5'));var Mustache=require(_0xed48('0x6'));var util=require(_0xed48('0x7'));var path=require('path');var sox=require(_0xed48('0x8'));var csv=require(_0xed48('0x9'));var ejs=require(_0xed48('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xed48('0xb'));var crypto=require(_0xed48('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed48('0xd'));var Papa=require(_0xed48('0xe'));var Redis=require(_0xed48('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xed48('0x10'));var hardwareService=require(_0xed48('0x11'));var logger=require(_0xed48('0x12'))('api');var utils=require(_0xed48('0x13'));var config=require(_0xed48('0x14'));var licenseUtil=require(_0xed48('0x15'));var db=require(_0xed48('0x16'))['db'];var integrations=require(_0xed48('0x17'));var jayson=require(_0xed48('0x18'));var client=jayson[_0xed48('0x19')][_0xed48('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x3166ca,_0x2eea4d,_0x408ce8,_0x24e67c){return new BPromise(function(_0x429024,_0x5cb1e7){var _0x2ca898=_0x24e67c||client;return _0x2ca898['request'](_0x3166ca,_0x408ce8)[_0xed48('0x1b')](function(_0x4d23d9){logger['info'](_0xed48('0x1c'),_0x2eea4d,_0xed48('0x1d'));logger[_0xed48('0x1e')](_0xed48('0x1f'),_0x2eea4d,_0xed48('0x1d'),JSON['stringify'](_0x4d23d9));if(_0x4d23d9[_0xed48('0x20')]){if(_0x4d23d9['error'][_0xed48('0x21')]===0x1f4){logger['error'](_0xed48('0x1c'),_0x2eea4d,_0x4d23d9[_0xed48('0x20')][_0xed48('0x22')]);return _0x5cb1e7(_0x4d23d9['error']['message']);}logger[_0xed48('0x20')](_0xed48('0x1c'),_0x2eea4d,_0x4d23d9[_0xed48('0x20')]['message']);return _0x429024(_0x4d23d9[_0xed48('0x20')][_0xed48('0x22')]);}else{logger[_0xed48('0x23')]('ZohoAccount,\x20%s,\x20%s',_0x2eea4d,_0xed48('0x1d'));_0x429024(_0x4d23d9[_0xed48('0x24')][_0xed48('0x22')]);}})[_0xed48('0x25')](function(_0x2931e1){logger[_0xed48('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x2eea4d,_0x2931e1);_0x5cb1e7(_0x2931e1);});});}function respondWithStatusCode(_0x2683e4,_0x4b829b){_0x4b829b=_0x4b829b||0xcc;return function(_0x17f799){if(_0x17f799){return _0x2683e4[_0xed48('0x26')](_0x4b829b);}return _0x2683e4[_0xed48('0x27')](_0x4b829b)['end']();};}function respondWithResult(_0x4b460f,_0x51f67f){_0x51f67f=_0x51f67f||0xc8;return function(_0x350c3c){if(_0x350c3c){return _0x4b460f[_0xed48('0x27')](_0x51f67f)[_0xed48('0x28')](_0x350c3c);}};}function respondWithFilteredResult(_0x26bff5,_0x28dbf6){return function(_0x37ef54){if(_0x37ef54){var _0x5a83bf=_0x37ef54['count'],_0x289060=_0x28dbf6[_0xed48('0x29')],_0x3ce573=_0x28dbf6[_0xed48('0x29')]+_0x28dbf6['limit'],_0x2d4ee2;if(_0x3ce573>=_0x5a83bf){_0x3ce573=_0x5a83bf;_0x2d4ee2=0xc8;}else{_0x2d4ee2=0xce;}_0x26bff5[_0xed48('0x27')](_0x2d4ee2);return _0x26bff5['set']('Content-Range',_0x289060+'-'+_0x3ce573+'/'+_0x5a83bf)[_0xed48('0x28')](_0x37ef54);}return null;};}function patchUpdates(_0x4a23ae){return function(_0x5aad16){try{jsonpatch[_0xed48('0x2a')](_0x5aad16,_0x4a23ae,!![]);}catch(_0x982fdd){return BPromise[_0xed48('0x2b')](_0x982fdd);}return _0x5aad16['save']();};}function saveUpdates(_0x1ca723,_0x7c59){return function(_0x236544){if(_0x236544){return _0x236544[_0xed48('0x2c')](_0x1ca723)['then'](function(_0x52e99f){return _0x52e99f;});}return null;};}function removeEntity(_0x15e9b,_0x51d44f){return function(_0x41d964){if(_0x41d964){return _0x41d964[_0xed48('0x2d')]()[_0xed48('0x1b')](function(){_0x15e9b[_0xed48('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5595fa,_0x68613b){return function(_0x1c85b7){if(!_0x1c85b7){_0x5595fa[_0xed48('0x26')](0x194);}return _0x1c85b7;};}function handleError(_0x2b1887,_0x6a62d5){_0x6a62d5=_0x6a62d5||0x1f4;return function(_0x32d3a8){logger[_0xed48('0x20')](_0x32d3a8[_0xed48('0x2e')]);if(_0x32d3a8[_0xed48('0x2f')]){delete _0x32d3a8[_0xed48('0x2f')];}_0x2b1887[_0xed48('0x27')](_0x6a62d5)[_0xed48('0x30')](_0x32d3a8);};}exports['index']=function(_0xdd9e08,_0x1f7b8e){var _0x3adc6f={},_0x5a52fb={},_0x8f2fe={'count':0x0,'rows':[]};var _0x2ca990=_[_0xed48('0x31')](db[_0xed48('0x32')][_0xed48('0x33')],function(_0x38c30a){return{'name':_0x38c30a['fieldName'],'type':_0x38c30a[_0xed48('0x34')][_0xed48('0x35')]};});_0x5a52fb[_0xed48('0x36')]=_[_0xed48('0x31')](_0x2ca990,'name');_0x5a52fb[_0xed48('0x37')]=_[_0xed48('0x38')](_0xdd9e08['query']);_0x5a52fb[_0xed48('0x39')]=_[_0xed48('0x3a')](_0x5a52fb[_0xed48('0x36')],_0x5a52fb['query']);_0x3adc6f['attributes']=_[_0xed48('0x3a')](_0x5a52fb['model'],qs[_0xed48('0x3b')](_0xdd9e08[_0xed48('0x37')][_0xed48('0x3b')]));_0x3adc6f[_0xed48('0x3c')]=_0x3adc6f[_0xed48('0x3c')][_0xed48('0x3d')]?_0x3adc6f[_0xed48('0x3c')]:_0x5a52fb[_0xed48('0x36')];if(!_0xdd9e08[_0xed48('0x37')]['hasOwnProperty'](_0xed48('0x3e'))){_0x3adc6f[_0xed48('0x3f')]=qs[_0xed48('0x3f')](_0xdd9e08[_0xed48('0x37')][_0xed48('0x3f')]);_0x3adc6f['offset']=qs[_0xed48('0x29')](_0xdd9e08[_0xed48('0x37')][_0xed48('0x29')]);}_0x3adc6f[_0xed48('0x40')]=qs[_0xed48('0x41')](_0xdd9e08[_0xed48('0x37')][_0xed48('0x41')]);_0x3adc6f[_0xed48('0x42')]=qs[_0xed48('0x39')](_[_0xed48('0x43')](_0xdd9e08[_0xed48('0x37')],_0x5a52fb[_0xed48('0x39')]),_0x2ca990);if(_0xdd9e08[_0xed48('0x37')][_0xed48('0x44')]){_0x3adc6f[_0xed48('0x42')]=_[_0xed48('0x45')](_0x3adc6f[_0xed48('0x42')],{'$or':_[_0xed48('0x31')](_0x2ca990,function(_0x5a4d58){if(_0x5a4d58[_0xed48('0x34')]!==_0xed48('0x46')){var _0x3df8fb={};_0x3df8fb[_0x5a4d58[_0xed48('0x2f')]]={'$like':'%'+_0xdd9e08[_0xed48('0x37')][_0xed48('0x44')]+'%'};return _0x3df8fb;}})});}_0x3adc6f=_['merge']({},_0x3adc6f,_0xdd9e08[_0xed48('0x47')]);var _0x4f2c03={'where':_0x3adc6f[_0xed48('0x42')]};return db[_0xed48('0x32')]['count'](_0x4f2c03)['then'](function(_0x26da97){_0x8f2fe['count']=_0x26da97;if(_0xdd9e08[_0xed48('0x37')]['includeAll']){_0x3adc6f['include']=[{'all':!![]}];}return db['ZohoAccount'][_0xed48('0x48')](_0x3adc6f);})[_0xed48('0x1b')](function(_0x3e2b5a){_0x8f2fe[_0xed48('0x49')]=_0x3e2b5a;return _0x8f2fe;})[_0xed48('0x1b')](respondWithFilteredResult(_0x1f7b8e,_0x3adc6f))[_0xed48('0x25')](handleError(_0x1f7b8e,null));};exports['show']=function(_0x51d9d6,_0x1369c9){var _0x2f1de8={'raw':![],'where':{'id':_0x51d9d6[_0xed48('0x4a')]['id']}},_0xbab9c6={};_0xbab9c6[_0xed48('0x36')]=_[_0xed48('0x38')](db['ZohoAccount'][_0xed48('0x33')]);_0xbab9c6['query']=_['keys'](_0x51d9d6['query']);_0xbab9c6[_0xed48('0x39')]=_[_0xed48('0x3a')](_0xbab9c6[_0xed48('0x36')],_0xbab9c6[_0xed48('0x37')]);_0x2f1de8[_0xed48('0x3c')]=_[_0xed48('0x3a')](_0xbab9c6[_0xed48('0x36')],qs[_0xed48('0x3b')](_0x51d9d6[_0xed48('0x37')][_0xed48('0x3b')]));_0x2f1de8[_0xed48('0x3c')]=_0x2f1de8[_0xed48('0x3c')]['length']?_0x2f1de8[_0xed48('0x3c')]:_0xbab9c6[_0xed48('0x36')];if(_0x51d9d6[_0xed48('0x37')][_0xed48('0x4b')]){_0x2f1de8[_0xed48('0x4c')]=[{'all':!![]}];}_0x2f1de8=_[_0xed48('0x45')]({},_0x2f1de8,_0x51d9d6[_0xed48('0x47')]);return db[_0xed48('0x32')][_0xed48('0x4d')](_0x2f1de8)[_0xed48('0x1b')](handleEntityNotFound(_0x1369c9,null))[_0xed48('0x1b')](respondWithResult(_0x1369c9,null))[_0xed48('0x25')](handleError(_0x1369c9,null));};exports[_0xed48('0x4e')]=function(_0x35d2c9,_0x53cf93){return db['ZohoAccount']['create'](_0x35d2c9[_0xed48('0x4f')],{})[_0xed48('0x1b')](respondWithResult(_0x53cf93,0xc9))[_0xed48('0x25')](handleError(_0x53cf93,null));};exports[_0xed48('0x2c')]=function(_0x3250ee,_0x50ec1e){if(_0x3250ee['body']['id']){delete _0x3250ee[_0xed48('0x4f')]['id'];}return db[_0xed48('0x32')][_0xed48('0x4d')]({'where':{'id':_0x3250ee['params']['id']}})[_0xed48('0x1b')](handleEntityNotFound(_0x50ec1e,null))[_0xed48('0x1b')](saveUpdates(_0x3250ee[_0xed48('0x4f')],null))[_0xed48('0x1b')](respondWithResult(_0x50ec1e,null))[_0xed48('0x25')](handleError(_0x50ec1e,null));};exports['destroy']=function(_0x3a4f2e,_0x4cac98){return db[_0xed48('0x32')][_0xed48('0x4d')]({'where':{'id':_0x3a4f2e[_0xed48('0x4a')]['id']}})[_0xed48('0x1b')](handleEntityNotFound(_0x4cac98,null))[_0xed48('0x1b')](removeEntity(_0x4cac98,null))[_0xed48('0x25')](handleError(_0x4cac98,null));};exports['getConfigurations']=function(_0xac2f45,_0x518d88,_0x405aca){var _0xd7c46={};var _0x27746e={};var _0x47ab8b;var _0xd554dc;return db[_0xed48('0x32')]['findOne']({'where':{'id':_0xac2f45[_0xed48('0x4a')]['id']}})['then'](handleEntityNotFound(_0x518d88,null))[_0xed48('0x1b')](function(_0x50b0ad){if(_0x50b0ad){_0x47ab8b=_0x50b0ad;_0x27746e[_0xed48('0x36')]=_[_0xed48('0x38')](db[_0xed48('0x50')][_0xed48('0x33')]);_0x27746e['query']=_[_0xed48('0x38')](_0xac2f45['query']);_0x27746e[_0xed48('0x39')]=_[_0xed48('0x3a')](_0x27746e[_0xed48('0x36')],_0x27746e[_0xed48('0x37')]);_0xd7c46[_0xed48('0x3c')]=_[_0xed48('0x3a')](_0x27746e[_0xed48('0x36')],qs[_0xed48('0x3b')](_0xac2f45['query'][_0xed48('0x3b')]));_0xd7c46['attributes']=_0xd7c46[_0xed48('0x3c')]['length']?_0xd7c46[_0xed48('0x3c')]:_0x27746e[_0xed48('0x36')];_0xd7c46[_0xed48('0x40')]=qs[_0xed48('0x41')](_0xac2f45[_0xed48('0x37')][_0xed48('0x41')]);_0xd7c46['where']=qs['filters'](_['pick'](_0xac2f45[_0xed48('0x37')],_0x27746e['filters']));if(_0xac2f45['query'][_0xed48('0x44')]){_0xd7c46['where']=_[_0xed48('0x45')](_0xd7c46[_0xed48('0x42')],{'$or':_[_0xed48('0x31')](_0xd7c46[_0xed48('0x3c')],function(_0x497bf9){var _0x4e57b6={};_0x4e57b6[_0x497bf9]={'$like':'%'+_0xac2f45[_0xed48('0x37')]['filter']+'%'};return _0x4e57b6;})});}_0xd7c46=_[_0xed48('0x45')]({},_0xd7c46,_0xac2f45['options']);return _0x47ab8b[_0xed48('0x51')](_0xd7c46);}})[_0xed48('0x1b')](function(_0x591e9a){if(_0x591e9a){_0xd554dc=_0x591e9a[_0xed48('0x3d')];if(!_0xac2f45['query'][_0xed48('0x52')](_0xed48('0x3e'))){_0xd7c46[_0xed48('0x3f')]=qs[_0xed48('0x3f')](_0xac2f45[_0xed48('0x37')][_0xed48('0x3f')]);_0xd7c46[_0xed48('0x29')]=qs[_0xed48('0x29')](_0xac2f45['query']['offset']);}return _0x47ab8b[_0xed48('0x51')](_0xd7c46);}})[_0xed48('0x1b')](function(_0x146bbe){if(_0x146bbe){return _0x146bbe?{'count':_0xd554dc,'rows':_0x146bbe}:null;}})[_0xed48('0x1b')](respondWithResult(_0x518d88,null))['catch'](handleError(_0x518d88,null));};exports[_0xed48('0x53')]=function(_0x6e753f,_0x210edb,_0x5e1a25){if(_0x6e753f[_0xed48('0x4f')]['id']){delete _0x6e753f[_0xed48('0x4f')]['id'];}return db[_0xed48('0x32')]['findOne']({'where':{'id':_0x6e753f['params']['id']}})[_0xed48('0x1b')](handleEntityNotFound(_0x210edb,null))[_0xed48('0x1b')](function(_0x5c5d14){if(_0x5c5d14){_0x6e753f[_0xed48('0x4f')]['AccountId']=_0x5c5d14['id'];_0x6e753f['body']['Subjects']=integrations['getSubjects'](_0x6e753f[_0xed48('0x4f')][_0xed48('0x54')],_0x6e753f[_0xed48('0x4f')][_0xed48('0x34')]);_0x6e753f['body'][_0xed48('0x55')]=integrations['getDescriptions'](_0x6e753f['body'][_0xed48('0x54')],_0x6e753f[_0xed48('0x4f')]['type']);return db['ZohoConfiguration'][_0xed48('0x4e')](_0x6e753f[_0xed48('0x4f')],{'include':[{'model':db[_0xed48('0x56')],'as':'Subjects'},{'model':db[_0xed48('0x56')],'as':'Descriptions'}]});}return null;})[_0xed48('0x1b')](respondWithResult(_0x210edb,null))[_0xed48('0x25')](handleError(_0x210edb,null));};function getAccessToken(_0x147e19){return new Promise(function(_0x473cd6,_0x138d9c){var _0x333162;switch(_0x147e19['zone']){case'US':_0x333162=_0xed48('0x57');break;case'AU':_0x333162=_0xed48('0x58');break;case'EU':_0x333162=_0xed48('0x59');break;case'IN':_0x333162=_0xed48('0x5a');break;case'CN':_0x333162=_0xed48('0x5b');break;default:_0x333162='https://accounts.zoho.eu';break;}var _0x20e17b={'method':_0xed48('0x5c'),'uri':_0x333162+'/oauth/v2/token','qs':{'refresh_token':_0x147e19['refreshToken'],'client_id':_0x147e19[_0xed48('0x5d')],'client_secret':_0x147e19[_0xed48('0x5e')],'grant_type':_0xed48('0x5f')},'json':!![]};return rp(_0x20e17b)[_0xed48('0x1b')](function(_0x1d507f){if(_0x1d507f[_0xed48('0x60')]){_0x473cd6(_0x1d507f['access_token']);}else{_0x138d9c(_0xed48('0x61'));}})[_0xed48('0x25')](function(_0x338374){_0x138d9c(_0x338374);});});}exports['getFields']=function(_0x510700,_0x5ebe8d,_0x99693d){var _0x5d545d,_0x98f23,_0x52098c,_0x278d87,_0x292793;return db[_0xed48('0x32')][_0xed48('0x62')]({'where':{'id':_0x510700[_0xed48('0x4a')]['id']},'attributes':['id','host','zone','clientId','clientSecret','serverUrl','code',_0xed48('0x63')]})['then'](handleEntityNotFound(_0x5ebe8d,null))[_0xed48('0x1b')](function(_0x46cf14){_0x292793=_0x46cf14;_0x5d545d=_0x292793[_0xed48('0x64')];_0x98f23=_0x5d545d===_0xed48('0x65')?'eu':_0xed48('0x66');_0x52098c=_0x292793[_0xed48('0x67')];var _0x4a5ba6=_0x52098c[_0xed48('0x68')](-0x1);if(_0x4a5ba6==='/'||_0x4a5ba6==='\x5c'||_0x4a5ba6===':'){_0x52098c=_0x52098c[_0xed48('0x69')](0x0,_0x52098c[_0xed48('0x6a')](_0x4a5ba6));}if(!_0x292793['refreshToken']){throw new Error(_0xed48('0x6b'));}return getAccessToken(_0x292793);})[_0xed48('0x1b')](function(_0x308510){if(_0x308510){return rp({'method':_0xed48('0x6c'),'uri':util[_0xed48('0x6d')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x98f23),'qs':{'module':_0xed48('0x6e')},'headers':{'Authorization':_0xed48('0x6f')+_0x308510},'json':!![]});}})[_0xed48('0x1b')](function(_0x590e85){if(_0x590e85){if(_0x590e85[_0xed48('0x70')]&&_0x590e85[_0xed48('0x70')][_0xed48('0x20')]){throw new Error(_0x590e85['response']['error'][_0xed48('0x22')]);}var _0x5f4c2e=[];var _0x5c121c=[];var _0x4cc9ee=[_0xed48('0x71'),_0xed48('0x72'),'Description',_0xed48('0x73'),_0xed48('0x74'),_0xed48('0x75'),_0xed48('0x76'),_0xed48('0x77')];_0x5c121c=_['remove'](_0x590e85[_0xed48('0x3b')],function(_0x1d115d){return _0x4cc9ee[_0xed48('0x78')](_0x1d115d[_0xed48('0x79')]);});for(var _0xbceb4=0x0;_0xbceb4<_0x5c121c[_0xed48('0x3d')];_0xbceb4++){if(_0x5c121c[_0xbceb4][_0xed48('0x7a')]===![]){_0x5f4c2e[_0xed48('0x7b')]({'id':_0x5c121c[_0xbceb4]['id'],'name':_0x5c121c[_0xbceb4][_0xed48('0x7c')],'custom':_0x5c121c[_0xbceb4][_0xed48('0x7d')],'options':_0x5c121c[_0xbceb4][_0xed48('0x7e')]===_0xed48('0x7f')&&_0x5c121c[_0xbceb4]['pick_list_values'][_0xed48('0x3d')]>-0x1?_['map'](_0x5c121c[_0xbceb4][_0xed48('0x80')],function(_0x39c71e){return{'name':_0x39c71e,'value':_0x39c71e};}):[]});}}return{'count':_0x5f4c2e[_0xed48('0x3d')],'rows':_0x5f4c2e};}else{return{'count':0x0,'rows':[]};}})[_0xed48('0x1b')](respondWithResult(_0x5ebe8d,null))['catch'](function(_0x251e3e){var _0x4219e7=_0x510700[_0xed48('0x37')][_0xed48('0x81')]?0x1f4:_0x251e3e[_0xed48('0x82')]||0x1f4;logger['error'](_0xed48('0x83'),_0xed48('0x84'),_0x4219e7,JSON[_0xed48('0x85')](_0x251e3e));delete _0x251e3e[_0xed48('0x2f')];if(_0x4219e7===0x191){_0x4219e7=0x190;}_0x5ebe8d[_0xed48('0x27')](_0x4219e7)[_0xed48('0x30')](_0x510700['query'][_0xed48('0x81')]?{'message':'Wrong\x20credentials','statusCode':_0x251e3e[_0xed48('0x82')]}:_0x251e3e);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 645ecdd..6bfa699 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 _0x5453=['ZohoAccount','int_zoho_accounts','changed','code','host','serverUrl','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','clientId','clientSecret','then','parse','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','catch','https://accounts.zoho.in','authorization_code','application/x-www-form-urlencoded','refreshToken','info','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x9fb863,_0x212d7e){var _0x34070b=function(_0x252852){while(--_0x252852){_0x9fb863['push'](_0x9fb863['shift']());}};_0x34070b(++_0x212d7e);}(_0x5453,0x1a2));var _0x3545=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5453[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x3545('0x0'));var util=require(_0x3545('0x1'));var logger=require('../../config/logger')(_0x3545('0x2'));var moment=require(_0x3545('0x3'));var BPromise=require(_0x3545('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3545('0x5'));var rimraf=require(_0x3545('0x6'));var config=require(_0x3545('0x7'));var attributes=require(_0x3545('0x8'));var integrations=require(_0x3545('0x9'));module[_0x3545('0xa')]=function(_0x5410c8,_0x3026ba){return _0x5410c8[_0x3545('0xb')](_0x3545('0xc'),attributes,{'tableName':_0x3545('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x37c465,_0xe97f8a,_0x54a933){if(_0x37c465[_0x3545('0xe')]('zone')||_0x37c465[_0x3545('0xe')]('serverUrl')||_0x37c465[_0x3545('0xe')]('clientId')||_0x37c465['changed']('clientSecret')||_0x37c465[_0x3545('0xe')](_0x3545('0xf'))||_0x37c465[_0x3545('0xe')](_0x3545('0x10'))){var _0x113a71,_0x161d8e;_0x113a71=_0x37c465[_0x3545('0x11')];var _0x4e0c4c=_0x113a71[_0x3545('0x12')](-0x1);if(_0x4e0c4c==='/'||_0x4e0c4c==='\x5c'||_0x4e0c4c===':'){_0x113a71=_0x113a71[_0x3545('0x13')](0x0,_0x113a71[_0x3545('0x14')](_0x4e0c4c));}switch(_0x37c465[_0x3545('0x15')]){case'US':_0x161d8e=_0x3545('0x16');break;case'AU':_0x161d8e=_0x3545('0x17');break;case'IN':_0x161d8e='https://accounts.zoho.in';break;case'CN':_0x161d8e='https://accounts.zoho.com.cn';break;default:_0x161d8e=_0x3545('0x18');break;}var _0x5e1620={'method':_0x3545('0x19'),'uri':_0x161d8e+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x37c465[_0x3545('0x1a')],'client_secret':_0x37c465[_0x3545('0x1b')],'redirect_uri':_0x37c465[_0x3545('0x11')],'code':_0x37c465[_0x3545('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5e1620)[_0x3545('0x1c')](function(_0x424912){var _0x44ed01=JSON[_0x3545('0x1d')](_0x424912);if(_0x44ed01[_0x3545('0x1e')]){_0x37c465['refreshToken']=_0x44ed01[_0x3545('0x1e')];logger['info'](util[_0x3545('0x1f')](_0x3545('0x20'),_0x37c465[_0x3545('0x21')],_0x37c465['id']));}else{logger[_0x3545('0x22')](util[_0x3545('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x37c465['name'],_0x37c465['id']),util[_0x3545('0x23')](_0x44ed01,{'showHidden':![],'depth':null}));}return _0x54a933(null,_0xe97f8a);})[_0x3545('0x24')](function(_0x1c690f){logger['error'](util[_0x3545('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x37c465[_0x3545('0x21')],_0x37c465['id']),util[_0x3545('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x54a933(_0x1c690f);});}else{return _0x54a933(null,_0xe97f8a);}},'beforeUpdate':function(_0x2289cf,_0x4c6170,_0x3de5e2){if(_0x2289cf[_0x3545('0xe')]('zone')||_0x2289cf[_0x3545('0xe')](_0x3545('0x11'))||_0x2289cf[_0x3545('0xe')](_0x3545('0x1a'))||_0x2289cf['changed'](_0x3545('0x1b'))||_0x2289cf['changed'](_0x3545('0xf'))||_0x2289cf['changed'](_0x3545('0x10'))){var _0x3a88e7,_0x535d34;_0x3a88e7=_0x2289cf[_0x3545('0x11')];var _0x2a7d2d=_0x3a88e7['slice'](-0x1);if(_0x2a7d2d==='/'||_0x2a7d2d==='\x5c'||_0x2a7d2d===':'){_0x3a88e7=_0x3a88e7[_0x3545('0x13')](0x0,_0x3a88e7[_0x3545('0x14')](_0x2a7d2d));}switch(_0x2289cf['zone']){case'US':_0x535d34=_0x3545('0x16');break;case'AU':_0x535d34=_0x3545('0x17');break;case'IN':_0x535d34=_0x3545('0x25');break;case'CN':_0x535d34='https://accounts.zoho.com.cn';break;default:_0x535d34=_0x3545('0x18');break;}var _0x236895={'method':'POST','uri':_0x535d34+'/oauth/v2/token','form':{'grant_type':_0x3545('0x26'),'client_id':_0x2289cf[_0x3545('0x1a')],'client_secret':_0x2289cf[_0x3545('0x1b')],'redirect_uri':_0x2289cf[_0x3545('0x11')],'code':_0x2289cf['code']},'headers':{'Content-Type':_0x3545('0x27')}};return rp(_0x236895)[_0x3545('0x1c')](function(_0x192d8a){var _0x4b6126=JSON[_0x3545('0x1d')](_0x192d8a);if(_0x4b6126['refresh_token']){_0x2289cf[_0x3545('0x28')]=_0x4b6126[_0x3545('0x1e')];logger[_0x3545('0x29')](util[_0x3545('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2289cf['name'],_0x2289cf['id']));}else{logger[_0x3545('0x22')](util[_0x3545('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2289cf[_0x3545('0x21')],_0x2289cf['id']),util['inspect'](_0x4b6126,{'showHidden':![],'depth':null}));}return _0x3de5e2(null,_0x4c6170);})['catch'](function(_0x26033c){logger[_0x3545('0x22')](util['format'](_0x3545('0x2a'),_0x2289cf[_0x3545('0x21')],_0x2289cf['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3de5e2(_0x26033c);});}else{return _0x3de5e2(null,_0x4c6170);}}}});}; \ No newline at end of file +var _0x28c7=['then','parse','refresh_token','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','/oauth/v2/token','refreshToken','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./intZohoAccount.attributes','exports','define','ZohoAccount','changed','zone','serverUrl','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientId','application/x-www-form-urlencoded'];(function(_0x2e477e,_0x51e163){var _0x13f742=function(_0x1f4df6){while(--_0x1f4df6){_0x2e477e['push'](_0x2e477e['shift']());}};_0x13f742(++_0x51e163);}(_0x28c7,0x1a8));var _0x728c=function(_0x16560e,_0x1f4374){_0x16560e=_0x16560e-0x0;var _0x189027=_0x28c7[_0x16560e];return _0x189027;};'use strict';var _=require(_0x728c('0x0'));var util=require(_0x728c('0x1'));var logger=require(_0x728c('0x2'))('api');var moment=require(_0x728c('0x3'));var BPromise=require(_0x728c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x728c('0x5'));var rimraf=require(_0x728c('0x6'));var config=require('../../config/environment');var attributes=require(_0x728c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x728c('0x8')]=function(_0x2f40e5,_0x3754ac){return _0x2f40e5[_0x728c('0x9')](_0x728c('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1378dc,_0x40b9ca,_0x4bd3e2){if(_0x1378dc[_0x728c('0xb')](_0x728c('0xc'))||_0x1378dc[_0x728c('0xb')](_0x728c('0xd'))||_0x1378dc[_0x728c('0xb')]('clientId')||_0x1378dc[_0x728c('0xb')](_0x728c('0xe'))||_0x1378dc[_0x728c('0xb')](_0x728c('0xf'))||_0x1378dc[_0x728c('0xb')]('host')){var _0x2f7f50,_0x1d488b;_0x2f7f50=_0x1378dc[_0x728c('0xd')];var _0x2c23e6=_0x2f7f50[_0x728c('0x10')](-0x1);if(_0x2c23e6==='/'||_0x2c23e6==='\x5c'||_0x2c23e6===':'){_0x2f7f50=_0x2f7f50[_0x728c('0x11')](0x0,_0x2f7f50[_0x728c('0x12')](_0x2c23e6));}switch(_0x1378dc[_0x728c('0xc')]){case'US':_0x1d488b=_0x728c('0x13');break;case'AU':_0x1d488b=_0x728c('0x14');break;case'IN':_0x1d488b=_0x728c('0x15');break;case'CN':_0x1d488b=_0x728c('0x16');break;default:_0x1d488b=_0x728c('0x17');break;}var _0x2f9927={'method':_0x728c('0x18'),'uri':_0x1d488b+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x1378dc[_0x728c('0x19')],'client_secret':_0x1378dc[_0x728c('0xe')],'redirect_uri':_0x1378dc[_0x728c('0xd')],'code':_0x1378dc[_0x728c('0xf')]},'headers':{'Content-Type':_0x728c('0x1a')}};return rp(_0x2f9927)[_0x728c('0x1b')](function(_0x5af62b){var _0x2f4fb2=JSON[_0x728c('0x1c')](_0x5af62b);if(_0x2f4fb2['refresh_token']){_0x1378dc['refreshToken']=_0x2f4fb2[_0x728c('0x1d')];logger[_0x728c('0x1e')](util['format'](_0x728c('0x1f'),_0x1378dc[_0x728c('0x20')],_0x1378dc['id']));}else{logger[_0x728c('0x21')](util[_0x728c('0x22')](_0x728c('0x23'),_0x1378dc[_0x728c('0x20')],_0x1378dc['id']),util[_0x728c('0x24')](_0x2f4fb2,{'showHidden':![],'depth':null}));}return _0x4bd3e2(null,_0x40b9ca);})[_0x728c('0x25')](function(_0x1b9f8a){logger['error'](util[_0x728c('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1378dc['name'],_0x1378dc['id']),util[_0x728c('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x4bd3e2(_0x1b9f8a);});}else{return _0x4bd3e2(null,_0x40b9ca);}},'beforeUpdate':function(_0x572b59,_0x14b91a,_0x15cae7){if(_0x572b59[_0x728c('0xb')](_0x728c('0xc'))||_0x572b59[_0x728c('0xb')](_0x728c('0xd'))||_0x572b59[_0x728c('0xb')](_0x728c('0x19'))||_0x572b59[_0x728c('0xb')](_0x728c('0xe'))||_0x572b59[_0x728c('0xb')](_0x728c('0xf'))||_0x572b59['changed'](_0x728c('0x26'))){var _0x2e8d34,_0x4b4c79;_0x2e8d34=_0x572b59[_0x728c('0xd')];var _0x2d9c93=_0x2e8d34[_0x728c('0x10')](-0x1);if(_0x2d9c93==='/'||_0x2d9c93==='\x5c'||_0x2d9c93===':'){_0x2e8d34=_0x2e8d34[_0x728c('0x11')](0x0,_0x2e8d34['lastIndexOf'](_0x2d9c93));}switch(_0x572b59['zone']){case'US':_0x4b4c79=_0x728c('0x13');break;case'AU':_0x4b4c79='https://accounts.zoho.com.au';break;case'IN':_0x4b4c79=_0x728c('0x15');break;case'CN':_0x4b4c79=_0x728c('0x16');break;default:_0x4b4c79=_0x728c('0x17');break;}var _0x2b16f0={'method':_0x728c('0x18'),'uri':_0x4b4c79+_0x728c('0x27'),'form':{'grant_type':'authorization_code','client_id':_0x572b59['clientId'],'client_secret':_0x572b59[_0x728c('0xe')],'redirect_uri':_0x572b59['serverUrl'],'code':_0x572b59[_0x728c('0xf')]},'headers':{'Content-Type':_0x728c('0x1a')}};return rp(_0x2b16f0)[_0x728c('0x1b')](function(_0x57330f){var _0x29ee16=JSON[_0x728c('0x1c')](_0x57330f);if(_0x29ee16['refresh_token']){_0x572b59[_0x728c('0x28')]=_0x29ee16['refresh_token'];logger[_0x728c('0x1e')](util['format'](_0x728c('0x1f'),_0x572b59[_0x728c('0x20')],_0x572b59['id']));}else{logger[_0x728c('0x21')](util[_0x728c('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x572b59[_0x728c('0x20')],_0x572b59['id']),util['inspect'](_0x29ee16,{'showHidden':![],'depth':null}));}return _0x15cae7(null,_0x14b91a);})[_0x728c('0x25')](function(_0x2a6946){logger['error'](util[_0x728c('0x22')](_0x728c('0x23'),_0x572b59['name'],_0x572b59['id']),util[_0x728c('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x15cae7(_0x2a6946);});}else{return _0x15cae7(null,_0x14b91a);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index b7c310a..2a89d3c 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 _0x34a7=['raw','where','attributes','limit','include','map','model','info','GetZohoAccount','debug','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','ZohoAccount','findAll','options'];(function(_0x5c2a2b,_0x22c94e){var _0x19921f=function(_0x3fb937){while(--_0x3fb937){_0x5c2a2b['push'](_0x5c2a2b['shift']());}};_0x19921f(++_0x22c94e);}(_0x34a7,0x7b));var _0x734a=function(_0x1af8e7,_0x5a6c20){_0x1af8e7=_0x1af8e7-0x0;var _0x121fe0=_0x34a7[_0x1af8e7];return _0x121fe0;};'use strict';var _=require(_0x734a('0x0'));var util=require(_0x734a('0x1'));var moment=require(_0x734a('0x2'));var BPromise=require(_0x734a('0x3'));var rs=require(_0x734a('0x4'));var fs=require('fs');var Redis=require(_0x734a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x734a('0x6'));var logger=require(_0x734a('0x7'))(_0x734a('0x8'));var config=require(_0x734a('0x9'));var jayson=require(_0x734a('0xa'));var client=jayson['client'][_0x734a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cc2e1,_0x470996,_0x51f88a){return new BPromise(function(_0x51eb64,_0x4e3a8e){return client[_0x734a('0xc')](_0x4cc2e1,_0x51f88a)[_0x734a('0xd')](function(_0x230cd5){logger['info'](_0x734a('0xe'),_0x470996,'request\x20sent');logger['debug'](_0x734a('0xf'),_0x470996,'request\x20sent',JSON[_0x734a('0x10')](_0x230cd5));if(_0x230cd5[_0x734a('0x11')]){if(_0x230cd5[_0x734a('0x11')]['code']===0x1f4){logger[_0x734a('0x11')](_0x734a('0xe'),_0x470996,_0x230cd5[_0x734a('0x11')]['message']);return _0x4e3a8e(_0x230cd5[_0x734a('0x11')][_0x734a('0x12')]);}logger[_0x734a('0x11')](_0x734a('0xe'),_0x470996,_0x230cd5['error'][_0x734a('0x12')]);return _0x51eb64(_0x230cd5[_0x734a('0x11')][_0x734a('0x12')]);}else{logger['info'](_0x734a('0xe'),_0x470996,_0x734a('0x13'));_0x51eb64(_0x230cd5[_0x734a('0x14')][_0x734a('0x12')]);}})[_0x734a('0x15')](function(_0x47465c){logger[_0x734a('0x11')](_0x734a('0xe'),_0x470996,_0x47465c);_0x4e3a8e(_0x47465c);});});}exports['GetZohoAccount']=function(_0x5c1832){var _0x32391d=this;return new Promise(function(_0x134809,_0x351e39){return db[_0x734a('0x16')][_0x734a('0x17')]({'raw':_0x5c1832['options']?_0x5c1832[_0x734a('0x18')][_0x734a('0x19')]===undefined?!![]:![]:!![],'where':_0x5c1832['options']?_0x5c1832[_0x734a('0x18')][_0x734a('0x1a')]||null:null,'attributes':_0x5c1832['options']?_0x5c1832[_0x734a('0x18')][_0x734a('0x1b')]||null:null,'limit':_0x5c1832[_0x734a('0x18')]?_0x5c1832[_0x734a('0x18')][_0x734a('0x1c')]||null:null,'include':_0x5c1832[_0x734a('0x18')]?_0x5c1832[_0x734a('0x18')][_0x734a('0x1d')]?_[_0x734a('0x1e')](_0x5c1832[_0x734a('0x18')][_0x734a('0x1d')],function(_0x1ca101){return{'model':db[_0x1ca101[_0x734a('0x1f')]],'as':_0x1ca101['as'],'attributes':_0x1ca101['attributes'],'include':_0x1ca101[_0x734a('0x1d')]?_[_0x734a('0x1e')](_0x1ca101['include'],function(_0x1c3c9d){return{'model':db[_0x1c3c9d[_0x734a('0x1f')]],'as':_0x1c3c9d['as'],'attributes':_0x1c3c9d[_0x734a('0x1b')],'include':_0x1c3c9d[_0x734a('0x1d')]?_[_0x734a('0x1e')](_0x1c3c9d[_0x734a('0x1d')],function(_0x2ac607){return{'model':db[_0x2ac607[_0x734a('0x1f')]],'as':_0x2ac607['as'],'attributes':_0x2ac607[_0x734a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x769913){logger[_0x734a('0x20')](_0x734a('0x21'),_0x5c1832);logger[_0x734a('0x22')](_0x734a('0x21'),_0x5c1832,JSON[_0x734a('0x10')](_0x769913));_0x134809(_0x769913);})['catch'](function(_0x471bae){logger[_0x734a('0x11')]('GetZohoAccount',_0x471bae['message'],_0x5c1832);_0x351e39(_0x32391d['error'](0x1f4,_0x471bae['message']));});});};exports[_0x734a('0x23')]=function(_0x359276){var _0x259af2=this;return new Promise(function(_0x5217ae,_0xdf173){return db['ZohoAccount'][_0x734a('0x24')]({'raw':_0x359276[_0x734a('0x18')]?_0x359276[_0x734a('0x18')][_0x734a('0x19')]===undefined?!![]:![]:!![],'where':_0x359276[_0x734a('0x18')]?_0x359276['options'][_0x734a('0x1a')]||null:null,'attributes':_0x359276['options']?_0x359276['options']['attributes']||null:null,'include':_0x359276['options']?_0x359276[_0x734a('0x18')][_0x734a('0x1d')]?_[_0x734a('0x1e')](_0x359276[_0x734a('0x18')]['include'],function(_0x42f1f9){return{'model':db[_0x42f1f9['model']],'as':_0x42f1f9['as'],'attributes':_0x42f1f9['attributes'],'include':_0x42f1f9[_0x734a('0x1d')]?_[_0x734a('0x1e')](_0x42f1f9[_0x734a('0x1d')],function(_0x23b27e){return{'model':db[_0x23b27e[_0x734a('0x1f')]],'as':_0x23b27e['as'],'attributes':_0x23b27e[_0x734a('0x1b')],'include':_0x23b27e[_0x734a('0x1d')]?_['map'](_0x23b27e['include'],function(_0x3f8e3d){return{'model':db[_0x3f8e3d[_0x734a('0x1f')]],'as':_0x3f8e3d['as'],'attributes':_0x3f8e3d[_0x734a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x734a('0xd')](function(_0x5aa3bd){logger['info'](_0x734a('0x23'),_0x359276);logger[_0x734a('0x22')](_0x734a('0x23'),_0x359276,JSON['stringify'](_0x5aa3bd));_0x5217ae(_0x5aa3bd);})['catch'](function(_0x2e0095){logger[_0x734a('0x11')](_0x734a('0x23'),_0x2e0095[_0x734a('0x12')],_0x359276);_0xdf173(_0x259af2[_0x734a('0x11')](0x1f4,_0x2e0095['message']));});});}; \ No newline at end of file +var _0xde05=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetZohoAccount','options','raw','where','limit','include','map','model','attributes','catch','ShowZohoAccount','ZohoAccount','find','then','util','moment','bluebird','randomstring','ioredis'];(function(_0x539bde,_0x14b7db){var _0x1718d4=function(_0x1d35e0){while(--_0x1d35e0){_0x539bde['push'](_0x539bde['shift']());}};_0x1718d4(++_0x14b7db);}(_0xde05,0x87));var _0x5de0=function(_0x38be31,_0x3e75c7){_0x38be31=_0x38be31-0x0;var _0x147c44=_0xde05[_0x38be31];return _0x147c44;};'use strict';var _=require('lodash');var util=require(_0x5de0('0x0'));var moment=require(_0x5de0('0x1'));var BPromise=require(_0x5de0('0x2'));var rs=require(_0x5de0('0x3'));var fs=require('fs');var Redis=require(_0x5de0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5de0('0x5'))(_0x5de0('0x6'));var config=require(_0x5de0('0x7'));var jayson=require(_0x5de0('0x8'));var client=jayson[_0x5de0('0x9')][_0x5de0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x361463,_0x338b84,_0x5b162f){return new BPromise(function(_0x24c56a,_0x3275d6){return client[_0x5de0('0xb')](_0x361463,_0x5b162f)['then'](function(_0x5821cb){logger[_0x5de0('0xc')](_0x5de0('0xd'),_0x338b84,_0x5de0('0xe'));logger[_0x5de0('0xf')](_0x5de0('0x10'),_0x338b84,'request\x20sent',JSON[_0x5de0('0x11')](_0x5821cb));if(_0x5821cb[_0x5de0('0x12')]){if(_0x5821cb[_0x5de0('0x12')][_0x5de0('0x13')]===0x1f4){logger[_0x5de0('0x12')](_0x5de0('0xd'),_0x338b84,_0x5821cb['error'][_0x5de0('0x14')]);return _0x3275d6(_0x5821cb[_0x5de0('0x12')]['message']);}logger[_0x5de0('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x338b84,_0x5821cb[_0x5de0('0x12')]['message']);return _0x24c56a(_0x5821cb[_0x5de0('0x12')][_0x5de0('0x14')]);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x338b84,'request\x20sent');_0x24c56a(_0x5821cb['result']['message']);}})['catch'](function(_0x2acc99){logger[_0x5de0('0x12')](_0x5de0('0xd'),_0x338b84,_0x2acc99);_0x3275d6(_0x2acc99);});});}exports[_0x5de0('0x15')]=function(_0x5e8964){var _0x317bc4=this;return new Promise(function(_0x245ed2,_0x2480fc){return db['ZohoAccount']['findAll']({'raw':_0x5e8964['options']?_0x5e8964[_0x5de0('0x16')][_0x5de0('0x17')]===undefined?!![]:![]:!![],'where':_0x5e8964[_0x5de0('0x16')]?_0x5e8964['options'][_0x5de0('0x18')]||null:null,'attributes':_0x5e8964[_0x5de0('0x16')]?_0x5e8964[_0x5de0('0x16')]['attributes']||null:null,'limit':_0x5e8964[_0x5de0('0x16')]?_0x5e8964[_0x5de0('0x16')][_0x5de0('0x19')]||null:null,'include':_0x5e8964[_0x5de0('0x16')]?_0x5e8964['options'][_0x5de0('0x1a')]?_[_0x5de0('0x1b')](_0x5e8964['options'][_0x5de0('0x1a')],function(_0x4befc7){return{'model':db[_0x4befc7[_0x5de0('0x1c')]],'as':_0x4befc7['as'],'attributes':_0x4befc7['attributes'],'include':_0x4befc7[_0x5de0('0x1a')]?_[_0x5de0('0x1b')](_0x4befc7['include'],function(_0x36e05a){return{'model':db[_0x36e05a[_0x5de0('0x1c')]],'as':_0x36e05a['as'],'attributes':_0x36e05a[_0x5de0('0x1d')],'include':_0x36e05a[_0x5de0('0x1a')]?_[_0x5de0('0x1b')](_0x36e05a[_0x5de0('0x1a')],function(_0x1ccdbc){return{'model':db[_0x1ccdbc[_0x5de0('0x1c')]],'as':_0x1ccdbc['as'],'attributes':_0x1ccdbc[_0x5de0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x464e60){logger['info'](_0x5de0('0x15'),_0x5e8964);logger['debug'](_0x5de0('0x15'),_0x5e8964,JSON[_0x5de0('0x11')](_0x464e60));_0x245ed2(_0x464e60);})[_0x5de0('0x1e')](function(_0x3cc3fb){logger['error'](_0x5de0('0x15'),_0x3cc3fb[_0x5de0('0x14')],_0x5e8964);_0x2480fc(_0x317bc4[_0x5de0('0x12')](0x1f4,_0x3cc3fb['message']));});});};exports[_0x5de0('0x1f')]=function(_0x463ded){var _0x4ece45=this;return new Promise(function(_0x46cd95,_0x459671){return db[_0x5de0('0x20')][_0x5de0('0x21')]({'raw':_0x463ded[_0x5de0('0x16')]?_0x463ded[_0x5de0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x463ded[_0x5de0('0x16')]?_0x463ded[_0x5de0('0x16')][_0x5de0('0x18')]||null:null,'attributes':_0x463ded[_0x5de0('0x16')]?_0x463ded[_0x5de0('0x16')]['attributes']||null:null,'include':_0x463ded[_0x5de0('0x16')]?_0x463ded['options'][_0x5de0('0x1a')]?_['map'](_0x463ded[_0x5de0('0x16')][_0x5de0('0x1a')],function(_0x38a716){return{'model':db[_0x38a716[_0x5de0('0x1c')]],'as':_0x38a716['as'],'attributes':_0x38a716['attributes'],'include':_0x38a716[_0x5de0('0x1a')]?_[_0x5de0('0x1b')](_0x38a716['include'],function(_0x3831a1){return{'model':db[_0x3831a1['model']],'as':_0x3831a1['as'],'attributes':_0x3831a1[_0x5de0('0x1d')],'include':_0x3831a1[_0x5de0('0x1a')]?_[_0x5de0('0x1b')](_0x3831a1[_0x5de0('0x1a')],function(_0x47d091){return{'model':db[_0x47d091[_0x5de0('0x1c')]],'as':_0x47d091['as'],'attributes':_0x47d091[_0x5de0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5de0('0x22')](function(_0x2c0bf6){logger[_0x5de0('0xc')](_0x5de0('0x1f'),_0x463ded);logger['debug'](_0x5de0('0x1f'),_0x463ded,JSON['stringify'](_0x2c0bf6));_0x46cd95(_0x2c0bf6);})['catch'](function(_0x4af464){logger[_0x5de0('0x12')](_0x5de0('0x1f'),_0x4af464[_0x5de0('0x14')],_0x463ded);_0x459671(_0x4ece45[_0x5de0('0x12')](0x1f4,_0x4af464['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 29d79e7..81c1888 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 _0x0db9=['/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','express','Router','../../components/interaction/service','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects'];(function(_0x2ecee4,_0x10a7d5){var _0x22eee7=function(_0x463203){while(--_0x463203){_0x2ecee4['push'](_0x2ecee4['shift']());}};_0x22eee7(++_0x10a7d5);}(_0x0db9,0xa3));var _0x90db=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x0db9[_0x5eb22e];return _0x27fed5;};'use strict';var multer=require(_0x90db('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x90db('0x1'));var router=express[_0x90db('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x90db('0x3'));var config=require('../../config/environment');var controller=require(_0x90db('0x4'));router[_0x90db('0x5')]('/',auth['isAuthenticated'](),controller[_0x90db('0x6')]);router[_0x90db('0x5')](_0x90db('0x7'),auth[_0x90db('0x8')](),controller[_0x90db('0x9')]);router[_0x90db('0x5')]('/:id/fields',auth[_0x90db('0x8')](),controller[_0x90db('0xa')]);router[_0x90db('0x5')](_0x90db('0xb'),auth[_0x90db('0x8')](),controller[_0x90db('0xc')]);router[_0x90db('0x5')](_0x90db('0xd'),auth[_0x90db('0x8')](),controller[_0x90db('0xe')]);router[_0x90db('0xf')]('/',auth['isAuthenticated'](),controller[_0x90db('0x10')]);router[_0x90db('0x11')](_0x90db('0x7'),auth[_0x90db('0x8')](),controller[_0x90db('0x12')]);router[_0x90db('0x13')](_0x90db('0x7'),auth[_0x90db('0x8')](),controller[_0x90db('0x14')]);module[_0x90db('0x15')]=router; \ No newline at end of file +var _0x45c8=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x45c8,0xef));var _0x845c=function(_0x12332d,_0x11f879){_0x12332d=_0x12332d-0x0;var _0x57f40f=_0x45c8[_0x12332d];return _0x57f40f;};'use strict';var multer=require(_0x845c('0x0'));var util=require('util');var path=require(_0x845c('0x1'));var timeout=require(_0x845c('0x2'));var express=require(_0x845c('0x3'));var router=express[_0x845c('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x845c('0x5')]('/',auth[_0x845c('0x6')](),controller[_0x845c('0x7')]);router['get'](_0x845c('0x8'),auth['isAuthenticated'](),controller[_0x845c('0x9')]);router[_0x845c('0x5')](_0x845c('0xa'),auth[_0x845c('0x6')](),controller[_0x845c('0xb')]);router[_0x845c('0x5')](_0x845c('0xc'),auth[_0x845c('0x6')](),controller[_0x845c('0xd')]);router[_0x845c('0x5')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x845c('0xe')]);router[_0x845c('0xf')]('/',auth['isAuthenticated'](),controller[_0x845c('0x10')]);router[_0x845c('0x11')](_0x845c('0x8'),auth[_0x845c('0x6')](),controller[_0x845c('0x12')]);router[_0x845c('0x13')]('/:id',auth[_0x845c('0x6')](),controller[_0x845c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 5781b6c..c4e6486 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 _0x6b69=['contact','nothing','contact_lead','exports','ENUM','lead'];(function(_0x22dabe,_0x237415){var _0x501ec0=function(_0x1d1d82){while(--_0x1d1d82){_0x22dabe['push'](_0x22dabe['shift']());}};_0x501ec0(++_0x237415);}(_0x6b69,0xbd));var _0x96b6=function(_0x37d7b4,_0xa4cf75){_0x37d7b4=_0x37d7b4-0x0;var _0x5ea2c0=_0x6b69[_0x37d7b4];return _0x5ea2c0;};'use strict';var Sequelize=require('sequelize');module[_0x96b6('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x96b6('0x1')](_0x96b6('0x2'),_0x96b6('0x3'),_0x96b6('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x96b6('0x1')](_0x96b6('0x5'),'contact',_0x96b6('0x2')),'defaultValue':'contact_lead'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbb8f=['exports','STRING','ENUM','lead','contact','nothing','contact_lead','sequelize'];(function(_0x157e1f,_0x50169c){var _0x4f0677=function(_0x212124){while(--_0x212124){_0x157e1f['push'](_0x157e1f['shift']());}};_0x4f0677(++_0x50169c);}(_0xbb8f,0x117));var _0xfbb8=function(_0x263f1c,_0x37ddf2){_0x263f1c=_0x263f1c-0x0;var _0x32fe16=_0xbb8f[_0x263f1c];return _0x32fe16;};'use strict';var Sequelize=require(_0xfbb8('0x0'));module[_0xfbb8('0x1')]={'name':{'type':Sequelize[_0xfbb8('0x2')]},'moduleCreate':{'type':Sequelize[_0xfbb8('0x3')](_0xfbb8('0x4'),_0xfbb8('0x5'),_0xfbb8('0x6')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xfbb8('0x3')](_0xfbb8('0x7'),'contact',_0xfbb8('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xfbb8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 14cabb3..efc00e5 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 _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 93c2585..db35497 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 _0xe288=['exports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x33f65d,_0x468bba){var _0x2be3d2=function(_0x5d86d4){while(--_0x5d86d4){_0x33f65d['push'](_0x33f65d['shift']());}};_0x2be3d2(++_0x468bba);}(_0xe288,0xdd));var _0x8e28=function(_0x567793,_0x270c72){_0x567793=_0x567793-0x0;var _0x1d7cc9=_0xe288[_0x567793];return _0x1d7cc9;};'use strict';var _=require('lodash');var util=require(_0x8e28('0x0'));var logger=require(_0x8e28('0x1'))(_0x8e28('0x2'));var moment=require(_0x8e28('0x3'));var BPromise=require(_0x8e28('0x4'));var rp=require(_0x8e28('0x5'));var fs=require('fs');var path=require(_0x8e28('0x6'));var rimraf=require(_0x8e28('0x7'));var config=require(_0x8e28('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x8e28('0x9')]=function(_0x568dac,_0x27ea86){return _0x568dac['define']('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54fb=['./intZohoConfiguration.attributes','exports','int_zoho_configurations','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x11a1b6,_0x1d8c7e){var _0x1e9a0c=function(_0x356ade){while(--_0x356ade){_0x11a1b6['push'](_0x11a1b6['shift']());}};_0x1e9a0c(++_0x1d8c7e);}(_0x54fb,0xdb));var _0xb54f=function(_0x7cbc59,_0x32caf9){_0x7cbc59=_0x7cbc59-0x0;var _0x3ed670=_0x54fb[_0x7cbc59];return _0x3ed670;};'use strict';var _=require('lodash');var util=require(_0xb54f('0x0'));var logger=require(_0xb54f('0x1'))('api');var moment=require(_0xb54f('0x2'));var BPromise=require(_0xb54f('0x3'));var rp=require(_0xb54f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb54f('0x5'));var attributes=require(_0xb54f('0x6'));module[_0xb54f('0x7')]=function(_0x1238de,_0x869905){return _0x1238de['define']('ZohoConfiguration',attributes,{'tableName':_0xb54f('0x8'),'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 26b0c54..b171d6e 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 _0x5f77=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZohoConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','util'];(function(_0xa0c96e,_0x2fbfed){var _0x49ac6a=function(_0x4935d5){while(--_0x4935d5){_0xa0c96e['push'](_0xa0c96e['shift']());}};_0x49ac6a(++_0x2fbfed);}(_0x5f77,0xaf));var _0x75f7=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x5f77[_0x525c7b];return _0x27b33e;};'use strict';var _=require('lodash');var util=require(_0x75f7('0x0'));var moment=require('moment');var BPromise=require(_0x75f7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75f7('0x2'));var db=require(_0x75f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x75f7('0x4'))(_0x75f7('0x5'));var config=require(_0x75f7('0x6'));var jayson=require(_0x75f7('0x7'));var client=jayson[_0x75f7('0x8')][_0x75f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28ec20,_0x25fe33,_0x274922){return new BPromise(function(_0x3022a0,_0xb21963){return client[_0x75f7('0xa')](_0x28ec20,_0x274922)[_0x75f7('0xb')](function(_0x3bace5){logger[_0x75f7('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x25fe33,'request\x20sent');logger[_0x75f7('0xd')](_0x75f7('0xe'),_0x25fe33,'request\x20sent',JSON['stringify'](_0x3bace5));if(_0x3bace5[_0x75f7('0xf')]){if(_0x3bace5[_0x75f7('0xf')][_0x75f7('0x10')]===0x1f4){logger['error'](_0x75f7('0x11'),_0x25fe33,_0x3bace5['error'][_0x75f7('0x12')]);return _0xb21963(_0x3bace5[_0x75f7('0xf')][_0x75f7('0x12')]);}logger[_0x75f7('0xf')](_0x75f7('0x11'),_0x25fe33,_0x3bace5[_0x75f7('0xf')][_0x75f7('0x12')]);return _0x3022a0(_0x3bace5[_0x75f7('0xf')][_0x75f7('0x12')]);}else{logger['info'](_0x75f7('0x11'),_0x25fe33,_0x75f7('0x13'));_0x3022a0(_0x3bace5[_0x75f7('0x14')]['message']);}})[_0x75f7('0x15')](function(_0x481537){logger[_0x75f7('0xf')](_0x75f7('0x11'),_0x25fe33,_0x481537);_0xb21963(_0x481537);});});} \ No newline at end of file +var _0xc5f2=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird'];(function(_0x480843,_0x8121e6){var _0x1d5cd9=function(_0x54ca2a){while(--_0x54ca2a){_0x480843['push'](_0x480843['shift']());}};_0x1d5cd9(++_0x8121e6);}(_0xc5f2,0x11a));var _0x2c5f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc5f2[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x2c5f('0x0'));var util=require(_0x2c5f('0x1'));var moment=require(_0x2c5f('0x2'));var BPromise=require(_0x2c5f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c5f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c5f('0x5'));var logger=require(_0x2c5f('0x6'))(_0x2c5f('0x7'));var config=require(_0x2c5f('0x8'));var jayson=require(_0x2c5f('0x9'));var client=jayson[_0x2c5f('0xa')][_0x2c5f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40605c,_0x426573,_0xffd76){return new BPromise(function(_0x167397,_0x19ae35){return client[_0x2c5f('0xc')](_0x40605c,_0xffd76)[_0x2c5f('0xd')](function(_0x11d9e7){logger['info'](_0x2c5f('0xe'),_0x426573,_0x2c5f('0xf'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x426573,_0x2c5f('0xf'),JSON[_0x2c5f('0x10')](_0x11d9e7));if(_0x11d9e7['error']){if(_0x11d9e7[_0x2c5f('0x11')][_0x2c5f('0x12')]===0x1f4){logger[_0x2c5f('0x11')](_0x2c5f('0xe'),_0x426573,_0x11d9e7['error'][_0x2c5f('0x13')]);return _0x19ae35(_0x11d9e7[_0x2c5f('0x11')][_0x2c5f('0x13')]);}logger[_0x2c5f('0x11')](_0x2c5f('0xe'),_0x426573,_0x11d9e7[_0x2c5f('0x11')][_0x2c5f('0x13')]);return _0x167397(_0x11d9e7[_0x2c5f('0x11')][_0x2c5f('0x13')]);}else{logger[_0x2c5f('0x14')](_0x2c5f('0xe'),_0x426573,_0x2c5f('0xf'));_0x167397(_0x11d9e7[_0x2c5f('0x15')][_0x2c5f('0x13')]);}})['catch'](function(_0x265b0b){logger[_0x2c5f('0x11')](_0x2c5f('0xe'),_0x426573,_0x265b0b);_0x19ae35(_0x265b0b);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 2d31bd3..979d650 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 _0xb03e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','util','path','connect-timeout'];(function(_0x3bfb65,_0x1e094a){var _0x539247=function(_0x50ce68){while(--_0x50ce68){_0x3bfb65['push'](_0x3bfb65['shift']());}};_0x539247(++_0x1e094a);}(_0xb03e,0x1eb));var _0xeb03=function(_0x5c0042,_0x40a76a){_0x5c0042=_0x5c0042-0x0;var _0x2aa93d=_0xb03e[_0x5c0042];return _0x2aa93d;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var auth=require(_0xeb03('0x5'));var interaction=require(_0xeb03('0x6'));var config=require(_0xeb03('0x7'));var controller=require(_0xeb03('0x8'));router[_0xeb03('0x9')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0xb')]);router['get'](_0xeb03('0xc'),auth[_0xeb03('0xa')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xe')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0xf')]);router['put'](_0xeb03('0xc'),auth[_0xeb03('0xa')](),controller[_0xeb03('0x10')]);router['delete'](_0xeb03('0xc'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);module[_0xeb03('0x12')]=router; \ No newline at end of file +var _0x1a37=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','get','/:id','show','update','delete','destroy','exports'];(function(_0x55b63f,_0x3e9993){var _0x2f3017=function(_0x1f0702){while(--_0x1f0702){_0x55b63f['push'](_0x55b63f['shift']());}};_0x2f3017(++_0x3e9993);}(_0x1a37,0xb4));var _0x71a3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1a37[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var auth=require(_0x71a3('0x6'));var interaction=require(_0x71a3('0x7'));var config=require(_0x71a3('0x8'));var controller=require(_0x71a3('0x9'));router['get']('/',auth[_0x71a3('0xa')](),controller['index']);router[_0x71a3('0xb')](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0xe')]);router[_0x71a3('0xf')](_0x71a3('0xc'),auth[_0x71a3('0xa')](),controller[_0x71a3('0x10')]);module[_0x71a3('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 30f0a5d..0004547 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 _0x308a=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','STRING'];(function(_0x329ff1,_0x271451){var _0x3d86f7=function(_0x3f3fd9){while(--_0x3f3fd9){_0x329ff1['push'](_0x329ff1['shift']());}};_0x3d86f7(++_0x271451);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xa308('0x0'));module['exports']={'type':{'type':Sequelize[_0xa308('0x1')](_0xa308('0x2'),_0xa308('0x3'),_0xa308('0x4'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa308('0x5')]},'key':{'type':Sequelize[_0xa308('0x5')]},'keyType':{'type':Sequelize[_0xa308('0x1')](_0xa308('0x2'),_0xa308('0x3'),_0xa308('0x4'))},'keyContent':{'type':Sequelize[_0xa308('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa308('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa308('0x5')]}}; \ No newline at end of file +var _0x28a2=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x228a('0x0'));module[_0x228a('0x1')]={'type':{'type':Sequelize[_0x228a('0x2')](_0x228a('0x3'),_0x228a('0x4'),_0x228a('0x5'),_0x228a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x228a('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x228a('0x2')](_0x228a('0x3'),_0x228a('0x4'),_0x228a('0x5'))},'keyContent':{'type':Sequelize[_0x228a('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x228a('0x7')]},'customField':{'type':Sequelize[_0x228a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x228a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6cb1f5e..d738981 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 _0xe4f0=['catch','show','keys','includeAll','find','create','body','params','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','count','include'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0xe4f0,0xe4));var _0x0e4f=function(_0x3fc59a,_0x5c0c1d){_0x3fc59a=_0x3fc59a-0x0;var _0x2af724=_0xe4f0[_0x3fc59a];return _0x2af724;};'use strict';var pdf=require(_0x0e4f('0x0'));var emlformat=require(_0x0e4f('0x1'));var rimraf=require(_0x0e4f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e4f('0x3'));var rp=require(_0x0e4f('0x4'));var moment=require(_0x0e4f('0x5'));var BPromise=require(_0x0e4f('0x6'));var Mustache=require(_0x0e4f('0x7'));var util=require(_0x0e4f('0x8'));var path=require(_0x0e4f('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e4f('0xa'));var fs=require('fs');var _=require(_0x0e4f('0xb'));var squel=require(_0x0e4f('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0e4f('0xd'));var toCsv=require(_0x0e4f('0xe'));var querystring=require(_0x0e4f('0xf'));var Papa=require(_0x0e4f('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e4f('0x11'));var as=require(_0x0e4f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e4f('0x13'))(_0x0e4f('0x14'));var utils=require('../../config/utils');var config=require(_0x0e4f('0x15'));var licenseUtil=require(_0x0e4f('0x16'));var db=require(_0x0e4f('0x17'))['db'];function respondWithStatusCode(_0x3f9dd5,_0x3225dd){_0x3225dd=_0x3225dd||0xcc;return function(_0x4eb36b){if(_0x4eb36b){return _0x3f9dd5[_0x0e4f('0x18')](_0x3225dd);}return _0x3f9dd5['status'](_0x3225dd)[_0x0e4f('0x19')]();};}function respondWithResult(_0x331230,_0x417632){_0x417632=_0x417632||0xc8;return function(_0x1b7a88){if(_0x1b7a88){return _0x331230[_0x0e4f('0x1a')](_0x417632)['json'](_0x1b7a88);}};}function respondWithFilteredResult(_0x3c9956,_0x49639d){return function(_0x1f71cb){if(_0x1f71cb){var _0x2cc09d=_0x1f71cb['count'],_0x30047c=_0x49639d[_0x0e4f('0x1b')],_0x50d68d=_0x49639d[_0x0e4f('0x1b')]+_0x49639d['limit'],_0x3c8cfe;if(_0x50d68d>=_0x2cc09d){_0x50d68d=_0x2cc09d;_0x3c8cfe=0xc8;}else{_0x3c8cfe=0xce;}_0x3c9956[_0x0e4f('0x1a')](_0x3c8cfe);return _0x3c9956[_0x0e4f('0x1c')](_0x0e4f('0x1d'),_0x30047c+'-'+_0x50d68d+'/'+_0x2cc09d)[_0x0e4f('0x1e')](_0x1f71cb);}return null;};}function patchUpdates(_0x45c82c){return function(_0x79ff40){try{jsonpatch[_0x0e4f('0x1f')](_0x79ff40,_0x45c82c,!![]);}catch(_0x400cb0){return BPromise[_0x0e4f('0x20')](_0x400cb0);}return _0x79ff40[_0x0e4f('0x21')]();};}function saveUpdates(_0x322f2c,_0x49c428){return function(_0x1240a0){if(_0x1240a0){return _0x1240a0[_0x0e4f('0x22')](_0x322f2c)[_0x0e4f('0x23')](function(_0x434f94){return _0x434f94;});}return null;};}function removeEntity(_0x2b8e40,_0x2f1ba6){return function(_0x24d4f2){if(_0x24d4f2){return _0x24d4f2['destroy']()['then'](function(){_0x2b8e40['status'](0xcc)[_0x0e4f('0x19')]();});}};}function handleEntityNotFound(_0x1542a9,_0x1a7c14){return function(_0x99644c){if(!_0x99644c){_0x1542a9[_0x0e4f('0x18')](0x194);}return _0x99644c;};}function handleError(_0x3cd7e5,_0xd5c0a3){_0xd5c0a3=_0xd5c0a3||0x1f4;return function(_0x200429){logger[_0x0e4f('0x24')](_0x200429[_0x0e4f('0x25')]);if(_0x200429[_0x0e4f('0x26')]){delete _0x200429[_0x0e4f('0x26')];}_0x3cd7e5[_0x0e4f('0x1a')](_0xd5c0a3)['send'](_0x200429);};}exports[_0x0e4f('0x27')]=function(_0x27c96c,_0xc0c262){var _0x4683e5={},_0x27ae3b={},_0xc7643a={'count':0x0,'rows':[]};var _0x572d4c=_[_0x0e4f('0x28')](db[_0x0e4f('0x29')][_0x0e4f('0x2a')],function(_0x2e7cf7){return{'name':_0x2e7cf7[_0x0e4f('0x2b')],'type':_0x2e7cf7[_0x0e4f('0x2c')][_0x0e4f('0x2d')]};});_0x27ae3b[_0x0e4f('0x2e')]=_[_0x0e4f('0x28')](_0x572d4c,_0x0e4f('0x26'));_0x27ae3b['query']=_['keys'](_0x27c96c[_0x0e4f('0x2f')]);_0x27ae3b[_0x0e4f('0x30')]=_[_0x0e4f('0x31')](_0x27ae3b[_0x0e4f('0x2e')],_0x27ae3b[_0x0e4f('0x2f')]);_0x4683e5[_0x0e4f('0x32')]=_['intersection'](_0x27ae3b['model'],qs[_0x0e4f('0x33')](_0x27c96c[_0x0e4f('0x2f')][_0x0e4f('0x33')]));_0x4683e5['attributes']=_0x4683e5[_0x0e4f('0x32')][_0x0e4f('0x34')]?_0x4683e5['attributes']:_0x27ae3b[_0x0e4f('0x2e')];if(!_0x27c96c[_0x0e4f('0x2f')]['hasOwnProperty'](_0x0e4f('0x35'))){_0x4683e5[_0x0e4f('0x36')]=qs[_0x0e4f('0x36')](_0x27c96c[_0x0e4f('0x2f')]['limit']);_0x4683e5[_0x0e4f('0x1b')]=qs[_0x0e4f('0x1b')](_0x27c96c[_0x0e4f('0x2f')][_0x0e4f('0x1b')]);}_0x4683e5[_0x0e4f('0x37')]=qs[_0x0e4f('0x38')](_0x27c96c[_0x0e4f('0x2f')]['sort']);_0x4683e5[_0x0e4f('0x39')]=qs['filters'](_[_0x0e4f('0x3a')](_0x27c96c['query'],_0x27ae3b[_0x0e4f('0x30')]),_0x572d4c);if(_0x27c96c[_0x0e4f('0x2f')][_0x0e4f('0x3b')]){_0x4683e5[_0x0e4f('0x39')]=_[_0x0e4f('0x3c')](_0x4683e5[_0x0e4f('0x39')],{'$or':_['map'](_0x572d4c,function(_0x42d300){if(_0x42d300[_0x0e4f('0x2c')]!=='VIRTUAL'){var _0x5d032c={};_0x5d032c[_0x42d300[_0x0e4f('0x26')]]={'$like':'%'+_0x27c96c[_0x0e4f('0x2f')][_0x0e4f('0x3b')]+'%'};return _0x5d032c;}})});}_0x4683e5=_[_0x0e4f('0x3c')]({},_0x4683e5,_0x27c96c[_0x0e4f('0x3d')]);var _0x3ab59f={'where':_0x4683e5[_0x0e4f('0x39')]};return db['ZohoField'][_0x0e4f('0x3e')](_0x3ab59f)[_0x0e4f('0x23')](function(_0xaf667e){_0xc7643a[_0x0e4f('0x3e')]=_0xaf667e;if(_0x27c96c[_0x0e4f('0x2f')]['includeAll']){_0x4683e5[_0x0e4f('0x3f')]=[{'all':!![]}];}return db[_0x0e4f('0x29')]['findAll'](_0x4683e5);})[_0x0e4f('0x23')](function(_0x1f3231){_0xc7643a['rows']=_0x1f3231;return _0xc7643a;})['then'](respondWithFilteredResult(_0xc0c262,_0x4683e5))[_0x0e4f('0x40')](handleError(_0xc0c262,null));};exports[_0x0e4f('0x41')]=function(_0xad8459,_0x34275c){var _0x55869a={'raw':!![],'where':{'id':_0xad8459['params']['id']}},_0x5aae27={};_0x5aae27[_0x0e4f('0x2e')]=_[_0x0e4f('0x42')](db[_0x0e4f('0x29')][_0x0e4f('0x2a')]);_0x5aae27[_0x0e4f('0x2f')]=_[_0x0e4f('0x42')](_0xad8459[_0x0e4f('0x2f')]);_0x5aae27[_0x0e4f('0x30')]=_[_0x0e4f('0x31')](_0x5aae27[_0x0e4f('0x2e')],_0x5aae27[_0x0e4f('0x2f')]);_0x55869a['attributes']=_[_0x0e4f('0x31')](_0x5aae27['model'],qs[_0x0e4f('0x33')](_0xad8459[_0x0e4f('0x2f')][_0x0e4f('0x33')]));_0x55869a[_0x0e4f('0x32')]=_0x55869a[_0x0e4f('0x32')][_0x0e4f('0x34')]?_0x55869a['attributes']:_0x5aae27[_0x0e4f('0x2e')];if(_0xad8459[_0x0e4f('0x2f')][_0x0e4f('0x43')]){_0x55869a['include']=[{'all':!![]}];}_0x55869a=_[_0x0e4f('0x3c')]({},_0x55869a,_0xad8459[_0x0e4f('0x3d')]);return db[_0x0e4f('0x29')][_0x0e4f('0x44')](_0x55869a)['then'](handleEntityNotFound(_0x34275c,null))['then'](respondWithResult(_0x34275c,null))[_0x0e4f('0x40')](handleError(_0x34275c,null));};exports[_0x0e4f('0x45')]=function(_0x37dde5,_0x44a53b){return db['ZohoField']['create'](_0x37dde5[_0x0e4f('0x46')],{})[_0x0e4f('0x23')](respondWithResult(_0x44a53b,0xc9))[_0x0e4f('0x40')](handleError(_0x44a53b,null));};exports[_0x0e4f('0x22')]=function(_0x5c4b15,_0x5c7fd3){if(_0x5c4b15[_0x0e4f('0x46')]['id']){delete _0x5c4b15[_0x0e4f('0x46')]['id'];}return db[_0x0e4f('0x29')]['find']({'where':{'id':_0x5c4b15[_0x0e4f('0x47')]['id']}})[_0x0e4f('0x23')](handleEntityNotFound(_0x5c7fd3,null))[_0x0e4f('0x23')](saveUpdates(_0x5c4b15['body'],null))[_0x0e4f('0x23')](respondWithResult(_0x5c7fd3,null))[_0x0e4f('0x40')](handleError(_0x5c7fd3,null));};exports[_0x0e4f('0x48')]=function(_0x22e8c5,_0xeeef34){return db[_0x0e4f('0x29')][_0x0e4f('0x44')]({'where':{'id':_0x22e8c5[_0x0e4f('0x47')]['id']}})[_0x0e4f('0x23')](handleEntityNotFound(_0xeeef34,null))[_0x0e4f('0x23')](removeEntity(_0xeeef34,null))[_0x0e4f('0x40')](handleError(_0xeeef34,null));}; \ No newline at end of file +var _0x7fc5=['params','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','save','destroy','error','stack','name','index','ZohoField','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','where','count','includeAll','include','rows','catch','show','find','then','create','body','update'];(function(_0x3af70f,_0x3ca312){var _0x5bd6c1=function(_0x5cec2d){while(--_0x5cec2d){_0x3af70f['push'](_0x3af70f['shift']());}};_0x5bd6c1(++_0x3ca312);}(_0x7fc5,0x16e));var _0x57fc=function(_0x44993b,_0x38d988){_0x44993b=_0x44993b-0x0;var _0x41e26a=_0x7fc5[_0x44993b];return _0x41e26a;};'use strict';var pdf=require(_0x57fc('0x0'));var emlformat=require(_0x57fc('0x1'));var rimraf=require(_0x57fc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x57fc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x57fc('0x4'));var util=require(_0x57fc('0x5'));var path=require(_0x57fc('0x6'));var sox=require(_0x57fc('0x7'));var csv=require('to-csv');var ejs=require(_0x57fc('0x8'));var fs=require('fs');var _=require(_0x57fc('0x9'));var squel=require(_0x57fc('0xa'));var crypto=require('crypto');var jsforce=require(_0x57fc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x57fc('0xc'));var querystring=require(_0x57fc('0xd'));var Papa=require(_0x57fc('0xe'));var Redis=require(_0x57fc('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x57fc('0x10'));var as=require(_0x57fc('0x11'));var hardwareService=require(_0x57fc('0x12'));var logger=require(_0x57fc('0x13'))(_0x57fc('0x14'));var utils=require(_0x57fc('0x15'));var config=require(_0x57fc('0x16'));var licenseUtil=require(_0x57fc('0x17'));var db=require(_0x57fc('0x18'))['db'];function respondWithStatusCode(_0x56b503,_0x35906a){_0x35906a=_0x35906a||0xcc;return function(_0x4cdb32){if(_0x4cdb32){return _0x56b503[_0x57fc('0x19')](_0x35906a);}return _0x56b503[_0x57fc('0x1a')](_0x35906a)[_0x57fc('0x1b')]();};}function respondWithResult(_0x584008,_0x181860){_0x181860=_0x181860||0xc8;return function(_0x34eaea){if(_0x34eaea){return _0x584008[_0x57fc('0x1a')](_0x181860)[_0x57fc('0x1c')](_0x34eaea);}};}function respondWithFilteredResult(_0x44478f,_0x93f348){return function(_0x1f2c53){if(_0x1f2c53){var _0x464141=_0x1f2c53['count'],_0x12a0ad=_0x93f348[_0x57fc('0x1d')],_0x32b388=_0x93f348['offset']+_0x93f348[_0x57fc('0x1e')],_0x27f9f3;if(_0x32b388>=_0x464141){_0x32b388=_0x464141;_0x27f9f3=0xc8;}else{_0x27f9f3=0xce;}_0x44478f[_0x57fc('0x1a')](_0x27f9f3);return _0x44478f[_0x57fc('0x1f')]('Content-Range',_0x12a0ad+'-'+_0x32b388+'/'+_0x464141)[_0x57fc('0x1c')](_0x1f2c53);}return null;};}function patchUpdates(_0x4d6b8d){return function(_0x10ae32){try{jsonpatch[_0x57fc('0x20')](_0x10ae32,_0x4d6b8d,!![]);}catch(_0x261d4c){return BPromise['reject'](_0x261d4c);}return _0x10ae32[_0x57fc('0x21')]();};}function saveUpdates(_0x5ef6fa,_0x4eda42){return function(_0x597677){if(_0x597677){return _0x597677['update'](_0x5ef6fa)['then'](function(_0x366bad){return _0x366bad;});}return null;};}function removeEntity(_0x16b00e,_0x4bbfaf){return function(_0x3abbd2){if(_0x3abbd2){return _0x3abbd2[_0x57fc('0x22')]()['then'](function(){_0x16b00e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cb11,_0x27af86){return function(_0x2f1434){if(!_0x2f1434){_0x39cb11[_0x57fc('0x19')](0x194);}return _0x2f1434;};}function handleError(_0x447e3d,_0x6d763d){_0x6d763d=_0x6d763d||0x1f4;return function(_0x75630c){logger[_0x57fc('0x23')](_0x75630c[_0x57fc('0x24')]);if(_0x75630c[_0x57fc('0x25')]){delete _0x75630c[_0x57fc('0x25')];}_0x447e3d['status'](_0x6d763d)['send'](_0x75630c);};}exports[_0x57fc('0x26')]=function(_0x421c1a,_0x2feebc){var _0x374ae4={},_0x176fdb={},_0x1269a8={'count':0x0,'rows':[]};var _0x62ea99=_['map'](db[_0x57fc('0x27')][_0x57fc('0x28')],function(_0x13138c){return{'name':_0x13138c[_0x57fc('0x29')],'type':_0x13138c['type']['key']};});_0x176fdb[_0x57fc('0x2a')]=_[_0x57fc('0x2b')](_0x62ea99,'name');_0x176fdb[_0x57fc('0x2c')]=_[_0x57fc('0x2d')](_0x421c1a[_0x57fc('0x2c')]);_0x176fdb[_0x57fc('0x2e')]=_[_0x57fc('0x2f')](_0x176fdb['model'],_0x176fdb[_0x57fc('0x2c')]);_0x374ae4[_0x57fc('0x30')]=_[_0x57fc('0x2f')](_0x176fdb['model'],qs[_0x57fc('0x31')](_0x421c1a[_0x57fc('0x2c')][_0x57fc('0x31')]));_0x374ae4[_0x57fc('0x30')]=_0x374ae4['attributes'][_0x57fc('0x32')]?_0x374ae4['attributes']:_0x176fdb[_0x57fc('0x2a')];if(!_0x421c1a[_0x57fc('0x2c')][_0x57fc('0x33')](_0x57fc('0x34'))){_0x374ae4[_0x57fc('0x1e')]=qs[_0x57fc('0x1e')](_0x421c1a[_0x57fc('0x2c')]['limit']);_0x374ae4[_0x57fc('0x1d')]=qs[_0x57fc('0x1d')](_0x421c1a[_0x57fc('0x2c')]['offset']);}_0x374ae4['order']=qs[_0x57fc('0x35')](_0x421c1a[_0x57fc('0x2c')][_0x57fc('0x35')]);_0x374ae4['where']=qs[_0x57fc('0x2e')](_[_0x57fc('0x36')](_0x421c1a[_0x57fc('0x2c')],_0x176fdb[_0x57fc('0x2e')]),_0x62ea99);if(_0x421c1a[_0x57fc('0x2c')][_0x57fc('0x37')]){_0x374ae4['where']=_[_0x57fc('0x38')](_0x374ae4['where'],{'$or':_[_0x57fc('0x2b')](_0x62ea99,function(_0x26d01f){if(_0x26d01f[_0x57fc('0x39')]!==_0x57fc('0x3a')){var _0x768df9={};_0x768df9[_0x26d01f[_0x57fc('0x25')]]={'$like':'%'+_0x421c1a['query'][_0x57fc('0x37')]+'%'};return _0x768df9;}})});}_0x374ae4=_[_0x57fc('0x38')]({},_0x374ae4,_0x421c1a[_0x57fc('0x3b')]);var _0x2a86c7={'where':_0x374ae4[_0x57fc('0x3c')]};return db[_0x57fc('0x27')][_0x57fc('0x3d')](_0x2a86c7)['then'](function(_0x49c3b1){_0x1269a8[_0x57fc('0x3d')]=_0x49c3b1;if(_0x421c1a[_0x57fc('0x2c')][_0x57fc('0x3e')]){_0x374ae4[_0x57fc('0x3f')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x374ae4);})['then'](function(_0x52f570){_0x1269a8[_0x57fc('0x40')]=_0x52f570;return _0x1269a8;})['then'](respondWithFilteredResult(_0x2feebc,_0x374ae4))[_0x57fc('0x41')](handleError(_0x2feebc,null));};exports[_0x57fc('0x42')]=function(_0x19f338,_0x3f7674){var _0x152a99={'raw':!![],'where':{'id':_0x19f338['params']['id']}},_0x56af89={};_0x56af89[_0x57fc('0x2a')]=_[_0x57fc('0x2d')](db[_0x57fc('0x27')][_0x57fc('0x28')]);_0x56af89[_0x57fc('0x2c')]=_[_0x57fc('0x2d')](_0x19f338[_0x57fc('0x2c')]);_0x56af89['filters']=_[_0x57fc('0x2f')](_0x56af89[_0x57fc('0x2a')],_0x56af89[_0x57fc('0x2c')]);_0x152a99[_0x57fc('0x30')]=_[_0x57fc('0x2f')](_0x56af89[_0x57fc('0x2a')],qs[_0x57fc('0x31')](_0x19f338[_0x57fc('0x2c')][_0x57fc('0x31')]));_0x152a99[_0x57fc('0x30')]=_0x152a99[_0x57fc('0x30')][_0x57fc('0x32')]?_0x152a99[_0x57fc('0x30')]:_0x56af89['model'];if(_0x19f338[_0x57fc('0x2c')]['includeAll']){_0x152a99['include']=[{'all':!![]}];}_0x152a99=_[_0x57fc('0x38')]({},_0x152a99,_0x19f338[_0x57fc('0x3b')]);return db[_0x57fc('0x27')][_0x57fc('0x43')](_0x152a99)[_0x57fc('0x44')](handleEntityNotFound(_0x3f7674,null))[_0x57fc('0x44')](respondWithResult(_0x3f7674,null))[_0x57fc('0x41')](handleError(_0x3f7674,null));};exports[_0x57fc('0x45')]=function(_0x23d64d,_0x31144f){return db[_0x57fc('0x27')][_0x57fc('0x45')](_0x23d64d[_0x57fc('0x46')],{})[_0x57fc('0x44')](respondWithResult(_0x31144f,0xc9))[_0x57fc('0x41')](handleError(_0x31144f,null));};exports[_0x57fc('0x47')]=function(_0x5bb3a5,_0x4daf79){if(_0x5bb3a5[_0x57fc('0x46')]['id']){delete _0x5bb3a5[_0x57fc('0x46')]['id'];}return db['ZohoField'][_0x57fc('0x43')]({'where':{'id':_0x5bb3a5[_0x57fc('0x48')]['id']}})[_0x57fc('0x44')](handleEntityNotFound(_0x4daf79,null))[_0x57fc('0x44')](saveUpdates(_0x5bb3a5[_0x57fc('0x46')],null))[_0x57fc('0x44')](respondWithResult(_0x4daf79,null))[_0x57fc('0x41')](handleError(_0x4daf79,null));};exports[_0x57fc('0x22')]=function(_0x108dcf,_0x4f7202){return db['ZohoField'][_0x57fc('0x43')]({'where':{'id':_0x108dcf[_0x57fc('0x48')]['id']}})[_0x57fc('0x44')](handleEntityNotFound(_0x4f7202,null))['then'](removeEntity(_0x4f7202,null))[_0x57fc('0x41')](handleError(_0x4f7202,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 74aa15d..2712e8a 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 _0x926f=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x926f,0x1c0));var _0xf926=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x926f[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xf926('0x0'));var util=require('util');var logger=require(_0xf926('0x1'))(_0xf926('0x2'));var moment=require(_0xf926('0x3'));var BPromise=require(_0xf926('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf926('0x5'));var rimraf=require(_0xf926('0x6'));var config=require(_0xf926('0x7'));var attributes=require(_0xf926('0x8'));module[_0xf926('0x9')]=function(_0x1353f3,_0x1e0b12){return _0x1353f3[_0xf926('0xa')](_0xf926('0xb'),attributes,{'tableName':_0xf926('0xc'),'paranoid':![],'indexes':[{'name':_0xf926('0xd'),'fields':[_0xf926('0xe'),_0xf926('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d5d=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_0x492700,_0x3a0e74){var _0x1a33d5=function(_0x1111d2){while(--_0x1111d2){_0x492700['push'](_0x492700['shift']());}};_0x1a33d5(++_0x3a0e74);}(_0x8d5d,0x1ad));var _0xd8d5=function(_0x4c780e,_0x374951){_0x4c780e=_0x4c780e-0x0;var _0x56398a=_0x8d5d[_0x4c780e];return _0x56398a;};'use strict';var _=require(_0xd8d5('0x0'));var util=require('util');var logger=require(_0xd8d5('0x1'))('api');var moment=require(_0xd8d5('0x2'));var BPromise=require(_0xd8d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8d5('0x4'));var rimraf=require(_0xd8d5('0x5'));var config=require(_0xd8d5('0x6'));var attributes=require('./intZohoField.attributes');module[_0xd8d5('0x7')]=function(_0x23a432,_0x3f1e31){return _0x23a432[_0xd8d5('0x8')](_0xd8d5('0x9'),attributes,{'tableName':_0xd8d5('0xa'),'paranoid':![],'indexes':[{'name':_0xd8d5('0xb'),'fields':[_0xd8d5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 022e987..ef3abda 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 _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xb458,0x103));var _0x8b45=function(_0x1895ce,_0x81e9b2){_0x1895ce=_0x1895ce-0x0;var _0x4c3c7f=_0xb458[_0x1895ce];return _0x4c3c7f;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ 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','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result'];(function(_0x444e22,_0x57c00b){var _0x5103d7=function(_0x736b9a){while(--_0x736b9a){_0x444e22['push'](_0x444e22['shift']());}};_0x5103d7(++_0x57c00b);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0xf3cd[_0x2a238a];return _0xeef802;};'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')]('ZohoField,\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')]('ZohoField,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 587f281..5d1d28c 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 _0xb540=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x2d9359,_0x52473b){var _0x3fe0ef=function(_0x4560ab){while(--_0x4560ab){_0x2d9359['push'](_0x2d9359['shift']());}};_0x3fe0ef(++_0x52473b);}(_0xb540,0x179));var _0x0b54=function(_0x59c196,_0x3efb99){_0x59c196=_0x59c196-0x0;var _0x1f8c37=_0xb540[_0x59c196];return _0x1f8c37;};'use strict';var multer=require(_0x0b54('0x0'));var util=require(_0x0b54('0x1'));var path=require(_0x0b54('0x2'));var timeout=require(_0x0b54('0x3'));var express=require(_0x0b54('0x4'));var router=express[_0x0b54('0x5')]();var auth=require(_0x0b54('0x6'));var interaction=require(_0x0b54('0x7'));var config=require(_0x0b54('0x8'));module[_0x0b54('0x9')]=router; \ No newline at end of file +var _0xd49b=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd49b,0xf3));var _0xbd49=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0xd49b[_0x144b30];return _0x1bb7bc;};'use strict';var multer=require(_0xbd49('0x0'));var util=require(_0xbd49('0x1'));var path=require(_0xbd49('0x2'));var timeout=require(_0xbd49('0x3'));var express=require(_0xbd49('0x4'));var router=express[_0xbd49('0x5')]();var auth=require(_0xbd49('0x6'));var interaction=require(_0xbd49('0x7'));var config=require(_0xbd49('0x8'));module[_0xbd49('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 167fb83..9ea86ad 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 _0x7538=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7538,0x1bf));var _0x8753=function(_0x114820,_0x4b68a0){_0x114820=_0x114820-0x0;var _0x5103af=_0x7538[_0x114820];return _0x5103af;};'use strict';var Sequelize=require('sequelize');module[_0x8753('0x0')]={'name':{'type':Sequelize[_0x8753('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8753('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x8753('0x3')},'filename':{'type':Sequelize[_0x8753('0x1')]},'path':{'type':Sequelize[_0x8753('0x1')]},'type':{'type':Sequelize[_0x8753('0x1')]},'size':{'type':Sequelize[_0x8753('0x4')]},'active':{'type':Sequelize[_0x8753('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x8753('0x1')]},'state':{'type':Sequelize[_0x8753('0x1')],'unique':_0x8753('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x8753('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x8753('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x20b0=['app.js','INTEGER','BOOLEAN','state','STRING','unique_name_and_version'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x20b0,0x142));var _0x020b=function(_0x487a1b,_0x435afd){_0x487a1b=_0x487a1b-0x0;var _0x3bf0c9=_0x20b0[_0x487a1b];return _0x3bf0c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x020b('0x0')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x020b('0x0')],'allowNull':![],'unique':_0x020b('0x1')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x020b('0x2')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x020b('0x0')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x020b('0x3')]},'active':{'type':Sequelize[_0x020b('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x020b('0x0')],'unique':_0x020b('0x5')},'description':{'type':Sequelize[_0x020b('0x0')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x020b('0x0')]},'link':{'type':Sequelize[_0x020b('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 aa33a18..50f613e 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 _0x663a=['body','html-pdf','eml-format','rimraf','zip-dir','moment','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','Integration','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','VIRTUAL','count','includeAll','rows','catch','show','params','include','merge','options','find','create'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x663a,0x119));var _0xa663=function(_0x2a5bce,_0x1db27b){_0x2a5bce=_0x2a5bce-0x0;var _0x49d364=_0x663a[_0x2a5bce];return _0x49d364;};'use strict';var pdf=require(_0xa663('0x0'));var emlformat=require(_0xa663('0x1'));var rimraf=require(_0xa663('0x2'));var zipdir=require(_0xa663('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa663('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa663('0x5'));var csv=require('to-csv');var ejs=require(_0xa663('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa663('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xa663('0x8'));var toCsv=require(_0xa663('0x9'));var querystring=require(_0xa663('0xa'));var Papa=require(_0xa663('0xb'));var Redis=require(_0xa663('0xc'));var authService=require(_0xa663('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa663('0xe'));var hardwareService=require(_0xa663('0xf'));var logger=require('../../config/logger')(_0xa663('0x10'));var utils=require(_0xa663('0x11'));var config=require(_0xa663('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa663('0x13'))['db'];function respondWithStatusCode(_0x51dc92,_0x2af54f){_0x2af54f=_0x2af54f||0xcc;return function(_0x1d9513){if(_0x1d9513){return _0x51dc92[_0xa663('0x14')](_0x2af54f);}return _0x51dc92[_0xa663('0x15')](_0x2af54f)[_0xa663('0x16')]();};}function respondWithResult(_0x463eef,_0x4f22b1){_0x4f22b1=_0x4f22b1||0xc8;return function(_0x1f528d){if(_0x1f528d){return _0x463eef[_0xa663('0x15')](_0x4f22b1)[_0xa663('0x17')](_0x1f528d);}};}function respondWithFilteredResult(_0x2c9cb3,_0x2736f6){return function(_0x532c12){if(_0x532c12){var _0x8e45d7=_0x532c12['count'],_0x32fac7=_0x2736f6[_0xa663('0x18')],_0x16b531=_0x2736f6[_0xa663('0x18')]+_0x2736f6['limit'],_0x25d390;if(_0x16b531>=_0x8e45d7){_0x16b531=_0x8e45d7;_0x25d390=0xc8;}else{_0x25d390=0xce;}_0x2c9cb3[_0xa663('0x15')](_0x25d390);return _0x2c9cb3[_0xa663('0x19')](_0xa663('0x1a'),_0x32fac7+'-'+_0x16b531+'/'+_0x8e45d7)[_0xa663('0x17')](_0x532c12);}return null;};}function patchUpdates(_0x12b154){return function(_0x3ec8cf){try{jsonpatch['apply'](_0x3ec8cf,_0x12b154,!![]);}catch(_0xdf01d0){return BPromise[_0xa663('0x1b')](_0xdf01d0);}return _0x3ec8cf[_0xa663('0x1c')]();};}function saveUpdates(_0x5e7116,_0x1d9ea3){return function(_0x5d17e6){if(_0x5d17e6){return _0x5d17e6[_0xa663('0x1d')](_0x5e7116)[_0xa663('0x1e')](function(_0x2aeddd){return _0x2aeddd;});}return null;};}function removeEntity(_0x34d63c,_0x1abd78){return function(_0x4800d5){if(_0x4800d5){return _0x4800d5['destroy']()[_0xa663('0x1e')](function(){_0x34d63c['status'](0xcc)[_0xa663('0x16')]();});}};}function handleEntityNotFound(_0x532a63,_0x3d080c){return function(_0x63a259){if(!_0x63a259){_0x532a63['sendStatus'](0x194);}return _0x63a259;};}function handleError(_0x1f467b,_0x5cea24){_0x5cea24=_0x5cea24||0x1f4;return function(_0x5528c9){logger[_0xa663('0x1f')](_0x5528c9[_0xa663('0x20')]);if(_0x5528c9[_0xa663('0x21')]){delete _0x5528c9[_0xa663('0x21')];}_0x1f467b[_0xa663('0x15')](_0x5cea24)[_0xa663('0x22')](_0x5528c9);};}exports[_0xa663('0x23')]=function(_0x38e7da,_0x3136d7){var _0x5a7c6d={},_0x2d66b8={},_0x360f26={'count':0x0,'rows':[]};var _0x23f7ff=_[_0xa663('0x24')](db[_0xa663('0x25')]['rawAttributes'],function(_0x500ab2){return{'name':_0x500ab2[_0xa663('0x26')],'type':_0x500ab2[_0xa663('0x27')][_0xa663('0x28')]};});_0x2d66b8[_0xa663('0x29')]=_[_0xa663('0x24')](_0x23f7ff,_0xa663('0x21'));_0x2d66b8[_0xa663('0x2a')]=_[_0xa663('0x2b')](_0x38e7da[_0xa663('0x2a')]);_0x2d66b8['filters']=_[_0xa663('0x2c')](_0x2d66b8[_0xa663('0x29')],_0x2d66b8[_0xa663('0x2a')]);_0x5a7c6d['attributes']=_[_0xa663('0x2c')](_0x2d66b8[_0xa663('0x29')],qs['fields'](_0x38e7da[_0xa663('0x2a')][_0xa663('0x2d')]));_0x5a7c6d[_0xa663('0x2e')]=_0x5a7c6d[_0xa663('0x2e')][_0xa663('0x2f')]?_0x5a7c6d['attributes']:_0x2d66b8[_0xa663('0x29')];if(!_0x38e7da[_0xa663('0x2a')][_0xa663('0x30')](_0xa663('0x31'))){_0x5a7c6d[_0xa663('0x32')]=qs['limit'](_0x38e7da[_0xa663('0x2a')]['limit']);_0x5a7c6d[_0xa663('0x18')]=qs[_0xa663('0x18')](_0x38e7da['query'][_0xa663('0x18')]);}_0x5a7c6d[_0xa663('0x33')]=qs['sort'](_0x38e7da[_0xa663('0x2a')][_0xa663('0x34')]);_0x5a7c6d['where']=qs[_0xa663('0x35')](_[_0xa663('0x36')](_0x38e7da['query'],_0x2d66b8[_0xa663('0x35')]),_0x23f7ff);if(_0x38e7da[_0xa663('0x2a')][_0xa663('0x37')]){_0x5a7c6d['where']=_['merge'](_0x5a7c6d[_0xa663('0x38')],{'$or':_[_0xa663('0x24')](_0x23f7ff,function(_0x8d8bf9){if(_0x8d8bf9[_0xa663('0x27')]!==_0xa663('0x39')){var _0x430a38={};_0x430a38[_0x8d8bf9[_0xa663('0x21')]]={'$like':'%'+_0x38e7da[_0xa663('0x2a')]['filter']+'%'};return _0x430a38;}})});}_0x5a7c6d=_['merge']({},_0x5a7c6d,_0x38e7da['options']);var _0x376940={'where':_0x5a7c6d[_0xa663('0x38')]};return db[_0xa663('0x25')]['count'](_0x376940)['then'](function(_0x5684ee){_0x360f26[_0xa663('0x3a')]=_0x5684ee;if(_0x38e7da[_0xa663('0x2a')][_0xa663('0x3b')]){_0x5a7c6d['include']=[{'all':!![]}];}return db[_0xa663('0x25')]['findAll'](_0x5a7c6d);})[_0xa663('0x1e')](function(_0x100335){_0x360f26[_0xa663('0x3c')]=_0x100335;return _0x360f26;})[_0xa663('0x1e')](respondWithFilteredResult(_0x3136d7,_0x5a7c6d))[_0xa663('0x3d')](handleError(_0x3136d7,null));};exports[_0xa663('0x3e')]=function(_0x5bf447,_0x328cf8){var _0x167da0={'raw':![],'where':{'id':_0x5bf447[_0xa663('0x3f')]['id']}},_0x46cab2={};_0x46cab2[_0xa663('0x29')]=_[_0xa663('0x2b')](db[_0xa663('0x25')]['rawAttributes']);_0x46cab2[_0xa663('0x2a')]=_[_0xa663('0x2b')](_0x5bf447[_0xa663('0x2a')]);_0x46cab2[_0xa663('0x35')]=_['intersection'](_0x46cab2[_0xa663('0x29')],_0x46cab2[_0xa663('0x2a')]);_0x167da0['attributes']=_[_0xa663('0x2c')](_0x46cab2[_0xa663('0x29')],qs[_0xa663('0x2d')](_0x5bf447[_0xa663('0x2a')]['fields']));_0x167da0[_0xa663('0x2e')]=_0x167da0['attributes'][_0xa663('0x2f')]?_0x167da0[_0xa663('0x2e')]:_0x46cab2['model'];if(_0x5bf447['query'][_0xa663('0x3b')]){_0x167da0[_0xa663('0x40')]=[{'all':!![]}];}_0x167da0=_[_0xa663('0x41')]({},_0x167da0,_0x5bf447[_0xa663('0x42')]);return db[_0xa663('0x25')][_0xa663('0x43')](_0x167da0)['then'](handleEntityNotFound(_0x328cf8,null))[_0xa663('0x1e')](respondWithResult(_0x328cf8,null))[_0xa663('0x3d')](handleError(_0x328cf8,null));};exports[_0xa663('0x44')]=function(_0x42f4e1,_0xf1163a){return db[_0xa663('0x25')][_0xa663('0x44')](_0x42f4e1[_0xa663('0x45')],{})[_0xa663('0x1e')](respondWithResult(_0xf1163a,0xc9))[_0xa663('0x3d')](handleError(_0xf1163a,null));};exports[_0xa663('0x1d')]=function(_0x554728,_0x2b6c73){if(_0x554728[_0xa663('0x45')]['id']){delete _0x554728[_0xa663('0x45')]['id'];}return db[_0xa663('0x25')][_0xa663('0x43')]({'where':{'id':_0x554728['params']['id']}})[_0xa663('0x1e')](handleEntityNotFound(_0x2b6c73,null))[_0xa663('0x1e')](saveUpdates(_0x554728[_0xa663('0x45')],null))[_0xa663('0x1e')](respondWithResult(_0x2b6c73,null))[_0xa663('0x3d')](handleError(_0x2b6c73,null));};exports['destroy']=function(_0x577ea4,_0x479a70){return db['Integration']['find']({'where':{'id':_0x577ea4[_0xa663('0x3f')]['id']}})[_0xa663('0x1e')](handleEntityNotFound(_0x479a70,null))[_0xa663('0x1e')](removeEntity(_0x479a70,null))[_0xa663('0x3d')](handleError(_0x479a70,null));}; \ No newline at end of file +var _0x8a83=['bluebird','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','update','destroy','then','error','name','send','index','map','Integration','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','keys','length','create','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3d7a3f,_0x19e9ca){var _0x4daddf=function(_0x331208){while(--_0x331208){_0x3d7a3f['push'](_0x3d7a3f['shift']());}};_0x4daddf(++_0x19e9ca);}(_0x8a83,0x10a));var _0x38a8=function(_0x437d7f,_0x1feb46){_0x437d7f=_0x437d7f-0x0;var _0x31058c=_0x8a83[_0x437d7f];return _0x31058c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x38a8('0x0'));var rimraf=require(_0x38a8('0x1'));var zipdir=require(_0x38a8('0x2'));var jsonpatch=require(_0x38a8('0x3'));var rp=require(_0x38a8('0x4'));var moment=require(_0x38a8('0x5'));var BPromise=require(_0x38a8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38a8('0x7'));var sox=require('sox');var csv=require(_0x38a8('0x8'));var ejs=require(_0x38a8('0x9'));var fs=require('fs');var _=require(_0x38a8('0xa'));var squel=require(_0x38a8('0xb'));var crypto=require('crypto');var jsforce=require(_0x38a8('0xc'));var deskjs=require(_0x38a8('0xd'));var toCsv=require(_0x38a8('0x8'));var querystring=require(_0x38a8('0xe'));var Papa=require('papaparse');var Redis=require(_0x38a8('0xf'));var authService=require(_0x38a8('0x10'));var qs=require(_0x38a8('0x11'));var as=require(_0x38a8('0x12'));var hardwareService=require(_0x38a8('0x13'));var logger=require(_0x38a8('0x14'))(_0x38a8('0x15'));var utils=require('../../config/utils');var config=require(_0x38a8('0x16'));var licenseUtil=require(_0x38a8('0x17'));var db=require(_0x38a8('0x18'))['db'];function respondWithStatusCode(_0x2d9838,_0x3c9b39){_0x3c9b39=_0x3c9b39||0xcc;return function(_0x4f2857){if(_0x4f2857){return _0x2d9838[_0x38a8('0x19')](_0x3c9b39);}return _0x2d9838[_0x38a8('0x1a')](_0x3c9b39)[_0x38a8('0x1b')]();};}function respondWithResult(_0x924c2c,_0x26e6ec){_0x26e6ec=_0x26e6ec||0xc8;return function(_0x3d91bc){if(_0x3d91bc){return _0x924c2c[_0x38a8('0x1a')](_0x26e6ec)[_0x38a8('0x1c')](_0x3d91bc);}};}function respondWithFilteredResult(_0x183a0c,_0x4ac165){return function(_0x57a885){if(_0x57a885){var _0x28c7b0=_0x57a885[_0x38a8('0x1d')],_0x55744a=_0x4ac165[_0x38a8('0x1e')],_0x4f6d61=_0x4ac165[_0x38a8('0x1e')]+_0x4ac165['limit'],_0x1e53cb;if(_0x4f6d61>=_0x28c7b0){_0x4f6d61=_0x28c7b0;_0x1e53cb=0xc8;}else{_0x1e53cb=0xce;}_0x183a0c[_0x38a8('0x1a')](_0x1e53cb);return _0x183a0c['set']('Content-Range',_0x55744a+'-'+_0x4f6d61+'/'+_0x28c7b0)[_0x38a8('0x1c')](_0x57a885);}return null;};}function patchUpdates(_0xc4b782){return function(_0x5e67cd){try{jsonpatch[_0x38a8('0x1f')](_0x5e67cd,_0xc4b782,!![]);}catch(_0x12a2ea){return BPromise[_0x38a8('0x20')](_0x12a2ea);}return _0x5e67cd['save']();};}function saveUpdates(_0x142d56,_0x2fccb5){return function(_0x1b15d5){if(_0x1b15d5){return _0x1b15d5[_0x38a8('0x21')](_0x142d56)['then'](function(_0x29b0ea){return _0x29b0ea;});}return null;};}function removeEntity(_0x1f15a1,_0x3a14b3){return function(_0x50eaac){if(_0x50eaac){return _0x50eaac[_0x38a8('0x22')]()[_0x38a8('0x23')](function(){_0x1f15a1[_0x38a8('0x1a')](0xcc)[_0x38a8('0x1b')]();});}};}function handleEntityNotFound(_0x4c773b,_0x2b7c42){return function(_0x3a04de){if(!_0x3a04de){_0x4c773b[_0x38a8('0x19')](0x194);}return _0x3a04de;};}function handleError(_0x2815cb,_0x4d13ae){_0x4d13ae=_0x4d13ae||0x1f4;return function(_0xd4dd07){logger[_0x38a8('0x24')](_0xd4dd07['stack']);if(_0xd4dd07[_0x38a8('0x25')]){delete _0xd4dd07['name'];}_0x2815cb[_0x38a8('0x1a')](_0x4d13ae)[_0x38a8('0x26')](_0xd4dd07);};}exports[_0x38a8('0x27')]=function(_0x26f91c,_0x2f3a30){var _0x26f881={},_0x1baf05={},_0x264344={'count':0x0,'rows':[]};var _0x417017=_[_0x38a8('0x28')](db[_0x38a8('0x29')][_0x38a8('0x2a')],function(_0x3d1544){return{'name':_0x3d1544['fieldName'],'type':_0x3d1544[_0x38a8('0x2b')][_0x38a8('0x2c')]};});_0x1baf05[_0x38a8('0x2d')]=_[_0x38a8('0x28')](_0x417017,_0x38a8('0x25'));_0x1baf05[_0x38a8('0x2e')]=_['keys'](_0x26f91c['query']);_0x1baf05[_0x38a8('0x2f')]=_[_0x38a8('0x30')](_0x1baf05['model'],_0x1baf05['query']);_0x26f881[_0x38a8('0x31')]=_['intersection'](_0x1baf05[_0x38a8('0x2d')],qs[_0x38a8('0x32')](_0x26f91c[_0x38a8('0x2e')][_0x38a8('0x32')]));_0x26f881['attributes']=_0x26f881[_0x38a8('0x31')]['length']?_0x26f881[_0x38a8('0x31')]:_0x1baf05['model'];if(!_0x26f91c[_0x38a8('0x2e')][_0x38a8('0x33')]('nolimit')){_0x26f881['limit']=qs['limit'](_0x26f91c['query']['limit']);_0x26f881[_0x38a8('0x1e')]=qs[_0x38a8('0x1e')](_0x26f91c['query']['offset']);}_0x26f881['order']=qs[_0x38a8('0x34')](_0x26f91c[_0x38a8('0x2e')][_0x38a8('0x34')]);_0x26f881[_0x38a8('0x35')]=qs[_0x38a8('0x2f')](_['pick'](_0x26f91c[_0x38a8('0x2e')],_0x1baf05[_0x38a8('0x2f')]),_0x417017);if(_0x26f91c[_0x38a8('0x2e')][_0x38a8('0x36')]){_0x26f881[_0x38a8('0x35')]=_[_0x38a8('0x37')](_0x26f881[_0x38a8('0x35')],{'$or':_[_0x38a8('0x28')](_0x417017,function(_0x2aed6f){if(_0x2aed6f[_0x38a8('0x2b')]!==_0x38a8('0x38')){var _0xf37bd6={};_0xf37bd6[_0x2aed6f[_0x38a8('0x25')]]={'$like':'%'+_0x26f91c[_0x38a8('0x2e')]['filter']+'%'};return _0xf37bd6;}})});}_0x26f881=_['merge']({},_0x26f881,_0x26f91c[_0x38a8('0x39')]);var _0x492895={'where':_0x26f881['where']};return db[_0x38a8('0x29')][_0x38a8('0x1d')](_0x492895)[_0x38a8('0x23')](function(_0x4febe5){_0x264344[_0x38a8('0x1d')]=_0x4febe5;if(_0x26f91c[_0x38a8('0x2e')][_0x38a8('0x3a')]){_0x26f881[_0x38a8('0x3b')]=[{'all':!![]}];}return db['Integration'][_0x38a8('0x3c')](_0x26f881);})['then'](function(_0x325698){_0x264344['rows']=_0x325698;return _0x264344;})[_0x38a8('0x23')](respondWithFilteredResult(_0x2f3a30,_0x26f881))['catch'](handleError(_0x2f3a30,null));};exports['show']=function(_0x5db9f2,_0x902377){var _0x4371e3={'raw':![],'where':{'id':_0x5db9f2[_0x38a8('0x3d')]['id']}},_0x49a262={};_0x49a262[_0x38a8('0x2d')]=_[_0x38a8('0x3e')](db['Integration'][_0x38a8('0x2a')]);_0x49a262['query']=_['keys'](_0x5db9f2[_0x38a8('0x2e')]);_0x49a262['filters']=_['intersection'](_0x49a262[_0x38a8('0x2d')],_0x49a262[_0x38a8('0x2e')]);_0x4371e3[_0x38a8('0x31')]=_[_0x38a8('0x30')](_0x49a262[_0x38a8('0x2d')],qs[_0x38a8('0x32')](_0x5db9f2[_0x38a8('0x2e')][_0x38a8('0x32')]));_0x4371e3[_0x38a8('0x31')]=_0x4371e3[_0x38a8('0x31')][_0x38a8('0x3f')]?_0x4371e3[_0x38a8('0x31')]:_0x49a262[_0x38a8('0x2d')];if(_0x5db9f2['query'][_0x38a8('0x3a')]){_0x4371e3['include']=[{'all':!![]}];}_0x4371e3=_[_0x38a8('0x37')]({},_0x4371e3,_0x5db9f2['options']);return db[_0x38a8('0x29')]['find'](_0x4371e3)[_0x38a8('0x23')](handleEntityNotFound(_0x902377,null))[_0x38a8('0x23')](respondWithResult(_0x902377,null))['catch'](handleError(_0x902377,null));};exports[_0x38a8('0x40')]=function(_0x2005d2,_0xdfb671){return db['Integration'][_0x38a8('0x40')](_0x2005d2[_0x38a8('0x41')],{})[_0x38a8('0x23')](respondWithResult(_0xdfb671,0xc9))['catch'](handleError(_0xdfb671,null));};exports[_0x38a8('0x21')]=function(_0x325603,_0x363b97){if(_0x325603['body']['id']){delete _0x325603['body']['id'];}return db[_0x38a8('0x29')][_0x38a8('0x42')]({'where':{'id':_0x325603['params']['id']}})['then'](handleEntityNotFound(_0x363b97,null))[_0x38a8('0x23')](saveUpdates(_0x325603[_0x38a8('0x41')],null))[_0x38a8('0x23')](respondWithResult(_0x363b97,null))[_0x38a8('0x43')](handleError(_0x363b97,null));};exports['destroy']=function(_0x380cfc,_0x376ca0){return db[_0x38a8('0x29')][_0x38a8('0x42')]({'where':{'id':_0x380cfc[_0x38a8('0x3d')]['id']}})[_0x38a8('0x23')](handleEntityNotFound(_0x376ca0,null))['then'](removeEntity(_0x376ca0,null))[_0x38a8('0x43')](handleError(_0x376ca0,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index cd06870..ee166db 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 _0xf739=['Integration','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xf739,0xdd));var _0x9f73=function(_0x1946f7,_0x344f58){_0x1946f7=_0x1946f7-0x0;var _0x2f8b34=_0xf739[_0x1946f7];return _0x2f8b34;};'use strict';var _=require(_0x9f73('0x0'));var util=require(_0x9f73('0x1'));var logger=require('../../config/logger')(_0x9f73('0x2'));var moment=require(_0x9f73('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f73('0x4'));var fs=require('fs');var path=require(_0x9f73('0x5'));var rimraf=require(_0x9f73('0x6'));var config=require(_0x9f73('0x7'));var attributes=require('./integration.attributes');module[_0x9f73('0x8')]=function(_0x3c261e,_0x22bb5e){return _0x3c261e[_0x9f73('0x9')](_0x9f73('0xa'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d96=['api','moment','bluebird','rimraf','../../config/environment','exports','define','Integration','integrations','../../config/logger'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0x2d96,0x1c1));var _0x62d9=function(_0x579388,_0x191c12){_0x579388=_0x579388-0x0;var _0x155c8d=_0x2d96[_0x579388];return _0x155c8d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x62d9('0x0'))(_0x62d9('0x1'));var moment=require(_0x62d9('0x2'));var BPromise=require(_0x62d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x62d9('0x4'));var config=require(_0x62d9('0x5'));var attributes=require('./integration.attributes');module[_0x62d9('0x6')]=function(_0x13e164,_0x386521){return _0x13e164[_0x62d9('0x7')](_0x62d9('0x8'),attributes,{'tableName':_0x62d9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 9854f31..5c21daa 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 _0x649b=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','Integration,\x20%s,\x20%s','message','catch','moment','bluebird'];(function(_0x6b5c51,_0x1ba06e){var _0xd0b75b=function(_0x3c2859){while(--_0x3c2859){_0x6b5c51['push'](_0x6b5c51['shift']());}};_0xd0b75b(++_0x1ba06e);}(_0x649b,0x166));var _0xb649=function(_0x20d6b8,_0x16c21f){_0x20d6b8=_0x20d6b8-0x0;var _0x5abd12=_0x649b[_0x20d6b8];return _0x5abd12;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb649('0x0'));var BPromise=require(_0xb649('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb649('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xb649('0x3'))(_0xb649('0x4'));var config=require(_0xb649('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb649('0x6')][_0xb649('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x407bdb,_0x5c0b1c,_0x539d84){return new BPromise(function(_0x4227a6,_0x4c5c97){return client[_0xb649('0x8')](_0x407bdb,_0x539d84)[_0xb649('0x9')](function(_0x2d4886){logger[_0xb649('0xa')]('Integration,\x20%s,\x20%s',_0x5c0b1c,_0xb649('0xb'));logger[_0xb649('0xc')](_0xb649('0xd'),_0x5c0b1c,_0xb649('0xb'),JSON['stringify'](_0x2d4886));if(_0x2d4886[_0xb649('0xe')]){if(_0x2d4886['error']['code']===0x1f4){logger['error'](_0xb649('0xf'),_0x5c0b1c,_0x2d4886[_0xb649('0xe')][_0xb649('0x10')]);return _0x4c5c97(_0x2d4886[_0xb649('0xe')]['message']);}logger[_0xb649('0xe')](_0xb649('0xf'),_0x5c0b1c,_0x2d4886[_0xb649('0xe')]['message']);return _0x4227a6(_0x2d4886[_0xb649('0xe')][_0xb649('0x10')]);}else{logger[_0xb649('0xa')](_0xb649('0xf'),_0x5c0b1c,_0xb649('0xb'));_0x4227a6(_0x2d4886['result'][_0xb649('0x10')]);}})[_0xb649('0x11')](function(_0x11e3c9){logger['error'](_0xb649('0xf'),_0x5c0b1c,_0x11e3c9);_0x4c5c97(_0x11e3c9);});});} \ No newline at end of file +var _0x776f=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x776f,0x68));var _0xf776=function(_0x1d77c8,_0x474bcf){_0x1d77c8=_0x1d77c8-0x0;var _0x3efd70=_0x776f[_0x1d77c8];return _0x3efd70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf776('0x0'));var BPromise=require(_0xf776('0x1'));var rs=require(_0xf776('0x2'));var fs=require('fs');var Redis=require(_0xf776('0x3'));var db=require(_0xf776('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf776('0x5'))('rpc');var config=require(_0xf776('0x6'));var jayson=require(_0xf776('0x7'));var client=jayson['client'][_0xf776('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c3877,_0x55d8e6,_0x2d7515){return new BPromise(function(_0x21ac6c,_0x52a0fc){return client[_0xf776('0x9')](_0x1c3877,_0x2d7515)[_0xf776('0xa')](function(_0x4b0f41){logger[_0xf776('0xb')]('Integration,\x20%s,\x20%s',_0x55d8e6,_0xf776('0xc'));logger[_0xf776('0xd')](_0xf776('0xe'),_0x55d8e6,_0xf776('0xc'),JSON[_0xf776('0xf')](_0x4b0f41));if(_0x4b0f41[_0xf776('0x10')]){if(_0x4b0f41['error'][_0xf776('0x11')]===0x1f4){logger['error'](_0xf776('0x12'),_0x55d8e6,_0x4b0f41[_0xf776('0x10')][_0xf776('0x13')]);return _0x52a0fc(_0x4b0f41['error'][_0xf776('0x13')]);}logger['error'](_0xf776('0x12'),_0x55d8e6,_0x4b0f41[_0xf776('0x10')][_0xf776('0x13')]);return _0x21ac6c(_0x4b0f41['error']['message']);}else{logger[_0xf776('0xb')](_0xf776('0x12'),_0x55d8e6,'request\x20sent');_0x21ac6c(_0x4b0f41[_0xf776('0x14')][_0xf776('0x13')]);}})[_0xf776('0x15')](function(_0xd5f3c2){logger[_0xf776('0x10')](_0xf776('0x12'),_0x55d8e6,_0xd5f3c2);_0x52a0fc(_0xd5f3c2);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index c253353..fd82d4f 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 _0x1c9e=['destroy','exports','util','path','express','Router','../../components/auth/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x322ac7,_0x4957a8){var _0x1d53d7=function(_0xde76d1){while(--_0xde76d1){_0x322ac7['push'](_0x322ac7['shift']());}};_0x1d53d7(++_0x4957a8);}(_0x1c9e,0xf2));var _0xe1c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c9e[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xe1c9('0x0'));var path=require(_0xe1c9('0x1'));var timeout=require('connect-timeout');var express=require(_0xe1c9('0x2'));var router=express[_0xe1c9('0x3')]();var auth=require(_0xe1c9('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe1c9('0x5'));router[_0xe1c9('0x6')]('/',auth[_0xe1c9('0x7')](),controller[_0xe1c9('0x8')]);router['get'](_0xe1c9('0x9'),auth[_0xe1c9('0x7')](),controller[_0xe1c9('0xa')]);router[_0xe1c9('0x6')](_0xe1c9('0xb'),auth[_0xe1c9('0x7')](),controller[_0xe1c9('0xc')]);router[_0xe1c9('0xd')]('/',auth['isAuthenticated'](),controller[_0xe1c9('0xe')]);router[_0xe1c9('0xf')](_0xe1c9('0xb'),auth[_0xe1c9('0x7')](),controller[_0xe1c9('0x10')]);router[_0xe1c9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe1c9('0x12')]);module[_0xe1c9('0x13')]=router; \ No newline at end of file +var _0x0b41=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','multer','path'];(function(_0x4663ac,_0x2e190b){var _0x101ee6=function(_0x1dfd01){while(--_0x1dfd01){_0x4663ac['push'](_0x4663ac['shift']());}};_0x101ee6(++_0x2e190b);}(_0x0b41,0x6a));var _0x10b4=function(_0x4cf2ee,_0x574c84){_0x4cf2ee=_0x4cf2ee-0x0;var _0x23957e=_0x0b41[_0x4cf2ee];return _0x23957e;};'use strict';var multer=require(_0x10b4('0x0'));var util=require('util');var path=require(_0x10b4('0x1'));var timeout=require(_0x10b4('0x2'));var express=require('express');var router=express[_0x10b4('0x3')]();var auth=require(_0x10b4('0x4'));var interaction=require(_0x10b4('0x5'));var config=require('../../config/environment');var controller=require(_0x10b4('0x6'));router[_0x10b4('0x7')]('/',auth[_0x10b4('0x8')](),controller[_0x10b4('0x9')]);router[_0x10b4('0x7')](_0x10b4('0xa'),auth[_0x10b4('0x8')](),controller[_0x10b4('0xb')]);router[_0x10b4('0x7')](_0x10b4('0xc'),auth[_0x10b4('0x8')](),controller[_0x10b4('0xd')]);router[_0x10b4('0xe')]('/',auth[_0x10b4('0x8')](),controller[_0x10b4('0xf')]);router[_0x10b4('0x10')](_0x10b4('0xc'),auth[_0x10b4('0x8')](),controller['update']);router['delete'](_0x10b4('0xc'),auth['isAuthenticated'](),controller[_0x10b4('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 9d9778b..36c8130 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 _0xf74f=['TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0xa3c058,_0x1d299c){var _0x151365=function(_0x2f6eb7){while(--_0x2f6eb7){_0xa3c058['push'](_0xa3c058['shift']());}};_0x151365(++_0x1d299c);}(_0xf74f,0x17b));var _0xff74=function(_0x68209d,_0x5c17d0){_0x68209d=_0x68209d-0x0;var _0x5023e9=_0xf74f[_0x68209d];return _0x5023e9;};'use strict';var Sequelize=require(_0xff74('0x0'));module[_0xff74('0x1')]={'integration':{'type':Sequelize[_0xff74('0x2')]},'eventChannel':{'type':Sequelize[_0xff74('0x2')]},'exitStatus':{'type':Sequelize[_0xff74('0x2')]},'ticketId':{'type':Sequelize[_0xff74('0x2')]},'integrationId':{'type':Sequelize[_0xff74('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xff74('0x2')]},'calleridname':{'type':Sequelize[_0xff74('0x2')]},'queue':{'type':Sequelize[_0xff74('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xff74('0x4')]},'agentconnectAt':{'type':Sequelize[_0xff74('0x4')]},'holdtime':{'type':Sequelize[_0xff74('0x3')]},'agentcomplete':{'type':Sequelize[_0xff74('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xff74('0x4')]},'talktime':{'type':Sequelize[_0xff74('0x3')]},'agentacw':{'type':Sequelize[_0xff74('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xff74('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xff74('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xff74('0x2')]},'channel':{'type':Sequelize[_0xff74('0x2')]},'channelstate':{'type':Sequelize[_0xff74('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xff74('0x2')]},'connectedlinename':{'type':Sequelize[_0xff74('0x2')]},'language':{'type':Sequelize[_0xff74('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xff74('0x2')]},'priority':{'type':Sequelize[_0xff74('0x2')]},'destchannel':{'type':Sequelize[_0xff74('0x2')]},'destchannelstate':{'type':Sequelize[_0xff74('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xff74('0x2')]},'destcalleridnum':{'type':Sequelize[_0xff74('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xff74('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xff74('0x2')]},'destlanguage':{'type':Sequelize[_0xff74('0x2')]},'destaccountcode':{'type':Sequelize[_0xff74('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xff74('0x2')]},'destpriority':{'type':Sequelize[_0xff74('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xff74('0x2')]},'inReplyTo':{'type':Sequelize[_0xff74('0x2')]},'subject':{'type':Sequelize[_0xff74('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xff74('0x2')]},'cc':{'type':Sequelize[_0xff74('0x2')]},'attachment':{'type':Sequelize[_0xff74('0x6')]},'html':{'type':Sequelize[_0xff74('0x6')]},'text':{'type':Sequelize[_0xff74('0x6')]},'status':{'type':Sequelize[_0xff74('0x7')]('SENT',_0xff74('0x8'),_0xff74('0x9'),_0xff74('0xa'))},'url':{'type':Sequelize[_0xff74('0x2')]},'app':{'type':Sequelize[_0xff74('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xff74('0x3')]}}; \ No newline at end of file +var _0xd34a=['ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0xd34a,0x176));var _0xad34=function(_0x420f7a,_0x252f00){_0x420f7a=_0x420f7a-0x0;var _0x3a89dc=_0xd34a[_0x420f7a];return _0x3a89dc;};'use strict';var Sequelize=require(_0xad34('0x0'));module[_0xad34('0x1')]={'integration':{'type':Sequelize[_0xad34('0x2')]},'eventChannel':{'type':Sequelize[_0xad34('0x2')]},'exitStatus':{'type':Sequelize[_0xad34('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xad34('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xad34('0x2')]},'calleridname':{'type':Sequelize[_0xad34('0x2')]},'queue':{'type':Sequelize[_0xad34('0x2')]},'interface':{'type':Sequelize[_0xad34('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xad34('0x4')]},'agentconnectAt':{'type':Sequelize[_0xad34('0x4')]},'holdtime':{'type':Sequelize[_0xad34('0x3')]},'agentcomplete':{'type':Sequelize[_0xad34('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xad34('0x4')]},'talktime':{'type':Sequelize[_0xad34('0x3')]},'agentacw':{'type':Sequelize[_0xad34('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xad34('0x3')]},'reason':{'type':Sequelize[_0xad34('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xad34('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xad34('0x4')]},'agentdump':{'type':Sequelize[_0xad34('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xad34('0x4')]},'lastevent':{'type':Sequelize[_0xad34('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xad34('0x2')]},'connectedlinename':{'type':Sequelize[_0xad34('0x2')]},'language':{'type':Sequelize[_0xad34('0x2')]},'accountcode':{'type':Sequelize[_0xad34('0x2')]},'context':{'type':Sequelize[_0xad34('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xad34('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xad34('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xad34('0x2')]},'destcalleridnum':{'type':Sequelize[_0xad34('0x2')]},'destcalleridname':{'type':Sequelize[_0xad34('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xad34('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xad34('0x2')]},'destaccountcode':{'type':Sequelize[_0xad34('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xad34('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xad34('0x2')]},'inReplyTo':{'type':Sequelize[_0xad34('0x2')]},'subject':{'type':Sequelize[_0xad34('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xad34('0x2')]},'cc':{'type':Sequelize[_0xad34('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xad34('0x6')](_0xad34('0x7'),_0xad34('0x8'),'RECEIVED',_0xad34('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xad34('0x2')]},'appdata':{'type':Sequelize[_0xad34('0x2')]},'projectId':{'type':Sequelize[_0xad34('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 24cf8cc..4dca288 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 _0x848e=['end','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','IntegrationReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x848e,0x1ec));var _0xe848=function(_0x331639,_0x3ceeaa){_0x331639=_0x331639-0x0;var _0x5420ea=_0x848e[_0x331639];return _0x5420ea;};'use strict';var pdf=require(_0xe848('0x0'));var emlformat=require(_0xe848('0x1'));var rimraf=require(_0xe848('0x2'));var zipdir=require(_0xe848('0x3'));var jsonpatch=require(_0xe848('0x4'));var rp=require(_0xe848('0x5'));var moment=require(_0xe848('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe848('0x7'));var util=require(_0xe848('0x8'));var path=require(_0xe848('0x9'));var sox=require('sox');var csv=require(_0xe848('0xa'));var ejs=require(_0xe848('0xb'));var fs=require('fs');var _=require(_0xe848('0xc'));var squel=require(_0xe848('0xd'));var crypto=require(_0xe848('0xe'));var jsforce=require(_0xe848('0xf'));var deskjs=require(_0xe848('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe848('0x11'));var Papa=require(_0xe848('0x12'));var Redis=require('ioredis');var authService=require(_0xe848('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe848('0x14'));var hardwareService=require(_0xe848('0x15'));var logger=require(_0xe848('0x16'))(_0xe848('0x17'));var utils=require(_0xe848('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338974,_0x1200a6){_0x1200a6=_0x1200a6||0xcc;return function(_0x9e880c){if(_0x9e880c){return _0x338974[_0xe848('0x19')](_0x1200a6);}return _0x338974['status'](_0x1200a6)[_0xe848('0x1a')]();};}function respondWithResult(_0x77cf24,_0x40352f){_0x40352f=_0x40352f||0xc8;return function(_0x1dbc03){if(_0x1dbc03){return _0x77cf24[_0xe848('0x1b')](_0x40352f)[_0xe848('0x1c')](_0x1dbc03);}};}function respondWithFilteredResult(_0x5bcc68,_0x2e5d5e){return function(_0x43413c){if(_0x43413c){var _0x57a540=_0x43413c['count'],_0x36d946=_0x2e5d5e['offset'],_0x196d9d=_0x2e5d5e[_0xe848('0x1d')]+_0x2e5d5e[_0xe848('0x1e')],_0x26a84e;if(_0x196d9d>=_0x57a540){_0x196d9d=_0x57a540;_0x26a84e=0xc8;}else{_0x26a84e=0xce;}_0x5bcc68[_0xe848('0x1b')](_0x26a84e);return _0x5bcc68['set'](_0xe848('0x1f'),_0x36d946+'-'+_0x196d9d+'/'+_0x57a540)['json'](_0x43413c);}return null;};}function patchUpdates(_0x1d653d){return function(_0x1b6973){try{jsonpatch[_0xe848('0x20')](_0x1b6973,_0x1d653d,!![]);}catch(_0x32688b){return BPromise['reject'](_0x32688b);}return _0x1b6973[_0xe848('0x21')]();};}function saveUpdates(_0x29e53a,_0x3308f6){return function(_0x6d9e61){if(_0x6d9e61){return _0x6d9e61[_0xe848('0x22')](_0x29e53a)[_0xe848('0x23')](function(_0x57ee8b){return _0x57ee8b;});}return null;};}function removeEntity(_0xa6d3e5,_0xdba95a){return function(_0xfaf7ef){if(_0xfaf7ef){return _0xfaf7ef[_0xe848('0x24')]()[_0xe848('0x23')](function(){_0xa6d3e5[_0xe848('0x1b')](0xcc)[_0xe848('0x1a')]();});}};}function handleEntityNotFound(_0x5da4ca,_0x478725){return function(_0x3e4b19){if(!_0x3e4b19){_0x5da4ca[_0xe848('0x19')](0x194);}return _0x3e4b19;};}function handleError(_0x12e7b0,_0x28bbc4){_0x28bbc4=_0x28bbc4||0x1f4;return function(_0x5c7867){logger[_0xe848('0x25')](_0x5c7867['stack']);if(_0x5c7867['name']){delete _0x5c7867[_0xe848('0x26')];}_0x12e7b0['status'](_0x28bbc4)[_0xe848('0x27')](_0x5c7867);};}exports[_0xe848('0x28')]=function(_0x1d99b4,_0x142531){var _0x3f7b60={},_0x476314={},_0x5b7700={'count':0x0,'rows':[]};var _0x58bf1e=_[_0xe848('0x29')](db[_0xe848('0x2a')]['rawAttributes'],function(_0x2ed37f){return{'name':_0x2ed37f[_0xe848('0x2b')],'type':_0x2ed37f[_0xe848('0x2c')][_0xe848('0x2d')]};});_0x476314[_0xe848('0x2e')]=_['map'](_0x58bf1e,_0xe848('0x26'));_0x476314[_0xe848('0x2f')]=_['keys'](_0x1d99b4[_0xe848('0x2f')]);_0x476314[_0xe848('0x30')]=_[_0xe848('0x31')](_0x476314[_0xe848('0x2e')],_0x476314[_0xe848('0x2f')]);_0x3f7b60[_0xe848('0x32')]=_[_0xe848('0x31')](_0x476314['model'],qs[_0xe848('0x33')](_0x1d99b4[_0xe848('0x2f')][_0xe848('0x33')]));_0x3f7b60['attributes']=_0x3f7b60[_0xe848('0x32')]['length']?_0x3f7b60[_0xe848('0x32')]:_0x476314['model'];if(!_0x1d99b4['query'][_0xe848('0x34')](_0xe848('0x35'))){_0x3f7b60['limit']=qs[_0xe848('0x1e')](_0x1d99b4[_0xe848('0x2f')][_0xe848('0x1e')]);_0x3f7b60[_0xe848('0x1d')]=qs['offset'](_0x1d99b4['query'][_0xe848('0x1d')]);}_0x3f7b60[_0xe848('0x36')]=qs['sort'](_0x1d99b4[_0xe848('0x2f')]['sort']);_0x3f7b60[_0xe848('0x37')]=qs[_0xe848('0x30')](_[_0xe848('0x38')](_0x1d99b4['query'],_0x476314[_0xe848('0x30')]),_0x58bf1e);if(_0x1d99b4[_0xe848('0x2f')][_0xe848('0x39')]){_0x3f7b60['where']=_[_0xe848('0x3a')](_0x3f7b60[_0xe848('0x37')],{'$or':_[_0xe848('0x29')](_0x58bf1e,function(_0x13c122){if(_0x13c122[_0xe848('0x2c')]!==_0xe848('0x3b')){var _0x3e950d={};_0x3e950d[_0x13c122[_0xe848('0x26')]]={'$like':'%'+_0x1d99b4[_0xe848('0x2f')]['filter']+'%'};return _0x3e950d;}})});}_0x3f7b60=_[_0xe848('0x3a')]({},_0x3f7b60,_0x1d99b4[_0xe848('0x3c')]);var _0x6c2e67={'where':_0x3f7b60[_0xe848('0x37')]};return db['IntegrationReport'][_0xe848('0x3d')](_0x6c2e67)[_0xe848('0x23')](function(_0x4f6922){_0x5b7700[_0xe848('0x3d')]=_0x4f6922;if(_0x1d99b4['query'][_0xe848('0x3e')]){_0x3f7b60[_0xe848('0x3f')]=[{'all':!![]}];}return db[_0xe848('0x2a')][_0xe848('0x40')](_0x3f7b60);})[_0xe848('0x23')](function(_0x53e2d8){_0x5b7700['rows']=_0x53e2d8;return _0x5b7700;})[_0xe848('0x23')](respondWithFilteredResult(_0x142531,_0x3f7b60))[_0xe848('0x41')](handleError(_0x142531,null));};exports[_0xe848('0x42')]=function(_0xd4180e,_0x3d5fd1){var _0x234682={'raw':![],'where':{'id':_0xd4180e[_0xe848('0x43')]['id']}},_0x3bbc07={};_0x3bbc07[_0xe848('0x2e')]=_['keys'](db['IntegrationReport'][_0xe848('0x44')]);_0x3bbc07[_0xe848('0x2f')]=_[_0xe848('0x45')](_0xd4180e[_0xe848('0x2f')]);_0x3bbc07[_0xe848('0x30')]=_[_0xe848('0x31')](_0x3bbc07['model'],_0x3bbc07[_0xe848('0x2f')]);_0x234682['attributes']=_[_0xe848('0x31')](_0x3bbc07['model'],qs[_0xe848('0x33')](_0xd4180e[_0xe848('0x2f')][_0xe848('0x33')]));_0x234682[_0xe848('0x32')]=_0x234682['attributes']['length']?_0x234682[_0xe848('0x32')]:_0x3bbc07[_0xe848('0x2e')];if(_0xd4180e[_0xe848('0x2f')][_0xe848('0x3e')]){_0x234682['include']=[{'all':!![]}];}_0x234682=_['merge']({},_0x234682,_0xd4180e[_0xe848('0x3c')]);return db[_0xe848('0x2a')][_0xe848('0x46')](_0x234682)[_0xe848('0x23')](handleEntityNotFound(_0x3d5fd1,null))[_0xe848('0x23')](respondWithResult(_0x3d5fd1,null))['catch'](handleError(_0x3d5fd1,null));};exports[_0xe848('0x47')]=function(_0x3a8ca2,_0x2a687e){return db[_0xe848('0x2a')][_0xe848('0x47')](_0x3a8ca2['body'],{})[_0xe848('0x23')](respondWithResult(_0x2a687e,0xc9))['catch'](handleError(_0x2a687e,null));};exports[_0xe848('0x22')]=function(_0x4a4129,_0x398f7d){if(_0x4a4129[_0xe848('0x48')]['id']){delete _0x4a4129[_0xe848('0x48')]['id'];}return db[_0xe848('0x2a')][_0xe848('0x46')]({'where':{'id':_0x4a4129[_0xe848('0x43')]['id']}})[_0xe848('0x23')](handleEntityNotFound(_0x398f7d,null))[_0xe848('0x23')](saveUpdates(_0x4a4129[_0xe848('0x48')],null))[_0xe848('0x23')](respondWithResult(_0x398f7d,null))[_0xe848('0x41')](handleError(_0x398f7d,null));};exports['destroy']=function(_0x2e3f06,_0x1ae623){return db[_0xe848('0x2a')][_0xe848('0x46')]({'where':{'id':_0x2e3f06[_0xe848('0x43')]['id']}})[_0xe848('0x23')](handleEntityNotFound(_0x1ae623,null))[_0xe848('0x23')](removeEntity(_0x1ae623,null))[_0xe848('0x41')](handleError(_0x1ae623,null));};exports[_0xe848('0x49')]=function(_0x9f00ac,_0x1e8c8f){return db[_0xe848('0x2a')][_0xe848('0x49')]()[_0xe848('0x23')](respondWithResult(_0x1e8c8f,null))['catch'](handleError(_0x1e8c8f,null));}; \ No newline at end of file +var _0xb928=['destroy','stack','name','send','map','IntegrationReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','then','include','findAll','rows','catch','show','params','rawAttributes','fields','length','includeAll','find','body','update','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x53c9aa,_0x4cca69){var _0x438826=function(_0x2357d1){while(--_0x2357d1){_0x53c9aa['push'](_0x53c9aa['shift']());}};_0x438826(++_0x4cca69);}(_0xb928,0xb0));var _0x8b92=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xb928[_0x4551f6];return _0x581dc2;};'use strict';var pdf=require(_0x8b92('0x0'));var emlformat=require(_0x8b92('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b92('0x2'));var rp=require(_0x8b92('0x3'));var moment=require(_0x8b92('0x4'));var BPromise=require(_0x8b92('0x5'));var Mustache=require('mustache');var util=require(_0x8b92('0x6'));var path=require(_0x8b92('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x8b92('0x8'));var squel=require(_0x8b92('0x9'));var crypto=require(_0x8b92('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8b92('0xb'));var Redis=require('ioredis');var authService=require(_0x8b92('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x8b92('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8b92('0xe'));var utils=require(_0x8b92('0xf'));var config=require(_0x8b92('0x10'));var licenseUtil=require(_0x8b92('0x11'));var db=require(_0x8b92('0x12'))['db'];function respondWithStatusCode(_0x1b2111,_0x3cf8ae){_0x3cf8ae=_0x3cf8ae||0xcc;return function(_0x37fb6a){if(_0x37fb6a){return _0x1b2111[_0x8b92('0x13')](_0x3cf8ae);}return _0x1b2111[_0x8b92('0x14')](_0x3cf8ae)[_0x8b92('0x15')]();};}function respondWithResult(_0x465d94,_0x46a0e5){_0x46a0e5=_0x46a0e5||0xc8;return function(_0x257f3d){if(_0x257f3d){return _0x465d94[_0x8b92('0x14')](_0x46a0e5)[_0x8b92('0x16')](_0x257f3d);}};}function respondWithFilteredResult(_0x21457f,_0x1d88c5){return function(_0xf915ca){if(_0xf915ca){var _0xfece68=_0xf915ca[_0x8b92('0x17')],_0x10b23f=_0x1d88c5[_0x8b92('0x18')],_0x3647af=_0x1d88c5[_0x8b92('0x18')]+_0x1d88c5[_0x8b92('0x19')],_0x27e17d;if(_0x3647af>=_0xfece68){_0x3647af=_0xfece68;_0x27e17d=0xc8;}else{_0x27e17d=0xce;}_0x21457f['status'](_0x27e17d);return _0x21457f[_0x8b92('0x1a')](_0x8b92('0x1b'),_0x10b23f+'-'+_0x3647af+'/'+_0xfece68)[_0x8b92('0x16')](_0xf915ca);}return null;};}function patchUpdates(_0x351928){return function(_0x7b63fd){try{jsonpatch[_0x8b92('0x1c')](_0x7b63fd,_0x351928,!![]);}catch(_0x520b0f){return BPromise[_0x8b92('0x1d')](_0x520b0f);}return _0x7b63fd[_0x8b92('0x1e')]();};}function saveUpdates(_0x26603a,_0x5f1df3){return function(_0x13dcdb){if(_0x13dcdb){return _0x13dcdb['update'](_0x26603a)['then'](function(_0x38511e){return _0x38511e;});}return null;};}function removeEntity(_0x5d3c18,_0x34c4a4){return function(_0x3f7986){if(_0x3f7986){return _0x3f7986[_0x8b92('0x1f')]()['then'](function(){_0x5d3c18[_0x8b92('0x14')](0xcc)[_0x8b92('0x15')]();});}};}function handleEntityNotFound(_0x33e83c,_0x5db2e4){return function(_0x12b069){if(!_0x12b069){_0x33e83c['sendStatus'](0x194);}return _0x12b069;};}function handleError(_0x478428,_0x507b97){_0x507b97=_0x507b97||0x1f4;return function(_0x3d0f95){logger['error'](_0x3d0f95[_0x8b92('0x20')]);if(_0x3d0f95[_0x8b92('0x21')]){delete _0x3d0f95['name'];}_0x478428[_0x8b92('0x14')](_0x507b97)[_0x8b92('0x22')](_0x3d0f95);};}exports['index']=function(_0x30aeba,_0xb73fbe){var _0x25dd68={},_0x614882={},_0xc06c43={'count':0x0,'rows':[]};var _0x568781=_[_0x8b92('0x23')](db[_0x8b92('0x24')]['rawAttributes'],function(_0x48e4a1){return{'name':_0x48e4a1[_0x8b92('0x25')],'type':_0x48e4a1[_0x8b92('0x26')][_0x8b92('0x27')]};});_0x614882[_0x8b92('0x28')]=_['map'](_0x568781,_0x8b92('0x21'));_0x614882[_0x8b92('0x29')]=_[_0x8b92('0x2a')](_0x30aeba[_0x8b92('0x29')]);_0x614882[_0x8b92('0x2b')]=_[_0x8b92('0x2c')](_0x614882['model'],_0x614882['query']);_0x25dd68['attributes']=_['intersection'](_0x614882[_0x8b92('0x28')],qs['fields'](_0x30aeba[_0x8b92('0x29')]['fields']));_0x25dd68[_0x8b92('0x2d')]=_0x25dd68[_0x8b92('0x2d')]['length']?_0x25dd68[_0x8b92('0x2d')]:_0x614882[_0x8b92('0x28')];if(!_0x30aeba[_0x8b92('0x29')][_0x8b92('0x2e')](_0x8b92('0x2f'))){_0x25dd68[_0x8b92('0x19')]=qs[_0x8b92('0x19')](_0x30aeba[_0x8b92('0x29')][_0x8b92('0x19')]);_0x25dd68[_0x8b92('0x18')]=qs[_0x8b92('0x18')](_0x30aeba['query'][_0x8b92('0x18')]);}_0x25dd68[_0x8b92('0x30')]=qs[_0x8b92('0x31')](_0x30aeba[_0x8b92('0x29')][_0x8b92('0x31')]);_0x25dd68[_0x8b92('0x32')]=qs[_0x8b92('0x2b')](_[_0x8b92('0x33')](_0x30aeba[_0x8b92('0x29')],_0x614882[_0x8b92('0x2b')]),_0x568781);if(_0x30aeba[_0x8b92('0x29')]['filter']){_0x25dd68[_0x8b92('0x32')]=_[_0x8b92('0x34')](_0x25dd68['where'],{'$or':_[_0x8b92('0x23')](_0x568781,function(_0x344174){if(_0x344174[_0x8b92('0x26')]!==_0x8b92('0x35')){var _0x3f5842={};_0x3f5842[_0x344174[_0x8b92('0x21')]]={'$like':'%'+_0x30aeba[_0x8b92('0x29')]['filter']+'%'};return _0x3f5842;}})});}_0x25dd68=_['merge']({},_0x25dd68,_0x30aeba['options']);var _0x1b3ff5={'where':_0x25dd68[_0x8b92('0x32')]};return db[_0x8b92('0x24')]['count'](_0x1b3ff5)[_0x8b92('0x36')](function(_0x2953b7){_0xc06c43[_0x8b92('0x17')]=_0x2953b7;if(_0x30aeba[_0x8b92('0x29')]['includeAll']){_0x25dd68[_0x8b92('0x37')]=[{'all':!![]}];}return db[_0x8b92('0x24')][_0x8b92('0x38')](_0x25dd68);})['then'](function(_0xc13cd1){_0xc06c43[_0x8b92('0x39')]=_0xc13cd1;return _0xc06c43;})[_0x8b92('0x36')](respondWithFilteredResult(_0xb73fbe,_0x25dd68))[_0x8b92('0x3a')](handleError(_0xb73fbe,null));};exports[_0x8b92('0x3b')]=function(_0x2c929f,_0x1be39f){var _0x3b8877={'raw':![],'where':{'id':_0x2c929f[_0x8b92('0x3c')]['id']}},_0x1433f3={};_0x1433f3[_0x8b92('0x28')]=_[_0x8b92('0x2a')](db['IntegrationReport'][_0x8b92('0x3d')]);_0x1433f3[_0x8b92('0x29')]=_[_0x8b92('0x2a')](_0x2c929f['query']);_0x1433f3[_0x8b92('0x2b')]=_[_0x8b92('0x2c')](_0x1433f3[_0x8b92('0x28')],_0x1433f3[_0x8b92('0x29')]);_0x3b8877[_0x8b92('0x2d')]=_[_0x8b92('0x2c')](_0x1433f3['model'],qs[_0x8b92('0x3e')](_0x2c929f[_0x8b92('0x29')][_0x8b92('0x3e')]));_0x3b8877[_0x8b92('0x2d')]=_0x3b8877[_0x8b92('0x2d')][_0x8b92('0x3f')]?_0x3b8877[_0x8b92('0x2d')]:_0x1433f3[_0x8b92('0x28')];if(_0x2c929f[_0x8b92('0x29')][_0x8b92('0x40')]){_0x3b8877[_0x8b92('0x37')]=[{'all':!![]}];}_0x3b8877=_[_0x8b92('0x34')]({},_0x3b8877,_0x2c929f['options']);return db[_0x8b92('0x24')][_0x8b92('0x41')](_0x3b8877)[_0x8b92('0x36')](handleEntityNotFound(_0x1be39f,null))[_0x8b92('0x36')](respondWithResult(_0x1be39f,null))['catch'](handleError(_0x1be39f,null));};exports['create']=function(_0x48aac8,_0x2aa8b4){return db[_0x8b92('0x24')]['create'](_0x48aac8[_0x8b92('0x42')],{})[_0x8b92('0x36')](respondWithResult(_0x2aa8b4,0xc9))['catch'](handleError(_0x2aa8b4,null));};exports[_0x8b92('0x43')]=function(_0x597610,_0x59e5aa){if(_0x597610[_0x8b92('0x42')]['id']){delete _0x597610['body']['id'];}return db[_0x8b92('0x24')][_0x8b92('0x41')]({'where':{'id':_0x597610[_0x8b92('0x3c')]['id']}})[_0x8b92('0x36')](handleEntityNotFound(_0x59e5aa,null))['then'](saveUpdates(_0x597610[_0x8b92('0x42')],null))[_0x8b92('0x36')](respondWithResult(_0x59e5aa,null))[_0x8b92('0x3a')](handleError(_0x59e5aa,null));};exports[_0x8b92('0x1f')]=function(_0x2ecee4,_0x46ea44){return db[_0x8b92('0x24')]['find']({'where':{'id':_0x2ecee4['params']['id']}})[_0x8b92('0x36')](handleEntityNotFound(_0x46ea44,null))[_0x8b92('0x36')](removeEntity(_0x46ea44,null))[_0x8b92('0x3a')](handleError(_0x46ea44,null));};exports[_0x8b92('0x44')]=function(_0x164a98,_0x1a5b49){return db['IntegrationReport'][_0x8b92('0x44')]()['then'](respondWithResult(_0x1a5b49,null))[_0x8b92('0x3a')](handleError(_0x1a5b49,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 183bc68..d18aec6 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 _0x270f=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration'];(function(_0x5dcaa0,_0x3b0a9e){var _0x4ef5c4=function(_0x3bb704){while(--_0x3bb704){_0x5dcaa0['push'](_0x5dcaa0['shift']());}};_0x4ef5c4(++_0x3b0a9e);}(_0x270f,0x1a4));var _0xf270=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x270f[_0x411017];return _0x2adeea;};'use strict';var _=require(_0xf270('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf270('0x1'));var moment=require(_0xf270('0x2'));var BPromise=require(_0xf270('0x3'));var rp=require(_0xf270('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf270('0x5'));var config=require(_0xf270('0x6'));var attributes=require(_0xf270('0x7'));module[_0xf270('0x8')]=function(_0xf6bade,_0x5603b3){return _0xf6bade[_0xf270('0x9')](_0xf270('0xa'),attributes,{'tableName':_0xf270('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x509c=['rimraf','../../config/environment','exports','report_integration','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x509c,0xc1));var _0xc509=function(_0x423bf9,_0x212a98){_0x423bf9=_0x423bf9-0x0;var _0x5ca985=_0x509c[_0x423bf9];return _0x5ca985;};'use strict';var _=require(_0xc509('0x0'));var util=require('util');var logger=require(_0xc509('0x1'))('api');var moment=require(_0xc509('0x2'));var BPromise=require(_0xc509('0x3'));var rp=require(_0xc509('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc509('0x5'));var config=require(_0xc509('0x6'));var attributes=require('./integrationReport.attributes');module[_0xc509('0x7')]=function(_0x19341c,_0x1e3c3b){return _0x19341c['define']('IntegrationReport',attributes,{'tableName':_0xc509('0x8'),'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 cbff2ea..5d845ea 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 _0x9ffd=['IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x32c350,_0x4c4a63){var _0xea3733=function(_0xd5167b){while(--_0xd5167b){_0x32c350['push'](_0x32c350['shift']());}};_0xea3733(++_0x4c4a63);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3b5e60,_0x3f5b68){_0x3b5e60=_0x3b5e60-0x0;var _0x41a070=_0x9ffd[_0x3b5e60];return _0x41a070;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('IntegrationReport,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('IntegrationReport,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0x0b0e=['IntegrationReport,\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','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x0b0e,0x187));var _0xe0b0=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x0b0e[_0x340380];return _0x49ce1c;};'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')]('IntegrationReport,\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 diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 57e58c2..a6eda4d 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 _0x3e74=['isAuthenticated','index','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./interval.controller','get'];(function(_0x14cc29,_0x4b1488){var _0x52dea5=function(_0x12b7de){while(--_0x12b7de){_0x14cc29['push'](_0x14cc29['shift']());}};_0x52dea5(++_0x4b1488);}(_0x3e74,0x175));var _0x43e7=function(_0x422a89,_0x21b8ee){_0x422a89=_0x422a89-0x0;var _0x393fd3=_0x3e74[_0x422a89];return _0x393fd3;};'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 auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['getIntervals']);router[_0x43e7('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x43e7('0xb')](_0x43e7('0xa'),auth['isAuthenticated'](),controller[_0x43e7('0xc')]);router['post'](_0x43e7('0xd'),auth[_0x43e7('0x7')](),controller['addIntervals']);router[_0x43e7('0xe')](_0x43e7('0xf'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file +var _0xedd9=['getIntervals','post','addInterval','addIntervals','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/sub_intervals'];(function(_0x46c70a,_0x5510eb){var _0x1f79c4=function(_0x11de1b){while(--_0x11de1b){_0x46c70a['push'](_0x46c70a['shift']());}};_0x1f79c4(++_0x5510eb);}(_0xedd9,0xfc));var _0x9edd=function(_0x104bec,_0x4b869e){_0x104bec=_0x104bec-0x0;var _0x2c5ca2=_0xedd9[_0x104bec];return _0x2c5ca2;};'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 auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./interval.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['post']('/',auth[_0x9edd('0x9')](),controller['create']);router[_0x9edd('0xd')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xd')]('/:id/sub_intervals/create_many',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);router[_0x9edd('0x10')](_0x9edd('0x11'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0x11'),auth['isAuthenticated'](),controller[_0x9edd('0x14')]);module[_0x9edd('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b18928d..d716a6f 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 _0x692d=['STRING','sequelize','exports'];(function(_0xc782b3,_0x441533){var _0x67d928=function(_0x584dd0){while(--_0x584dd0){_0xc782b3['push'](_0xc782b3['shift']());}};_0x67d928(++_0x441533);}(_0x692d,0xa9));var _0xd692=function(_0x3bd387,_0x5eebed){_0x3bd387=_0x3bd387-0x0;var _0x2e29f=_0x692d[_0x3bd387];return _0x2e29f;};'use strict';var Sequelize=require(_0xd692('0x0'));module[_0xd692('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd692('0x2')]},'interval':{'type':Sequelize[_0xd692('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x6027=['exports','STRING','sequelize'];(function(_0x2da3fe,_0x55ad2d){var _0x564b34=function(_0x1c0510){while(--_0x1c0510){_0x2da3fe['push'](_0x2da3fe['shift']());}};_0x564b34(++_0x55ad2d);}(_0x6027,0xc5));var _0x7602=function(_0x40d078,_0x210a77){_0x40d078=_0x40d078-0x0;var _0x46fc81=_0x6027[_0x40d078];return _0x46fc81;};'use strict';var Sequelize=require(_0x7602('0x0'));module[_0x7602('0x1')]={'name':{'type':Sequelize[_0x7602('0x2')]},'description':{'type':Sequelize[_0x7602('0x2')]},'interval':{'type':Sequelize[_0x7602('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 39bcff2..5ff5234 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 _0xb009=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','get','Intervals','name','map','Interval','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','findOne','order','getIntervals','addIntervals','sequelize','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse'];(function(_0xdd7a33,_0x5c13be){var _0x572b77=function(_0x3bc8fc){while(--_0x3bc8fc){_0xdd7a33['push'](_0xdd7a33['shift']());}};_0x572b77(++_0x5c13be);}(_0xb009,0x196));var _0x9b00=function(_0x5f0864,_0x413e01){_0x5f0864=_0x5f0864-0x0;var _0x5700dc=_0xb009[_0x5f0864];return _0x5700dc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9b00('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b00('0x1'));var rp=require(_0x9b00('0x2'));var moment=require('moment');var BPromise=require(_0x9b00('0x3'));var Mustache=require(_0x9b00('0x4'));var util=require(_0x9b00('0x5'));var path=require('path');var sox=require(_0x9b00('0x6'));var csv=require(_0x9b00('0x7'));var ejs=require(_0x9b00('0x8'));var fs=require('fs');var _=require(_0x9b00('0x9'));var squel=require(_0x9b00('0xa'));var crypto=require(_0x9b00('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9b00('0xc'));var toCsv=require(_0x9b00('0x7'));var querystring=require('querystring');var Papa=require(_0x9b00('0xd'));var Redis=require(_0x9b00('0xe'));var authService=require(_0x9b00('0xf'));var qs=require(_0x9b00('0x10'));var as=require(_0x9b00('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b00('0x12'))(_0x9b00('0x13'));var utils=require(_0x9b00('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9b00('0x15'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x425870,_0x3eb01e){_0x3eb01e=_0x3eb01e||0xcc;return function(_0x207abe){if(_0x207abe){return _0x425870[_0x9b00('0x16')](_0x3eb01e);}return _0x425870[_0x9b00('0x17')](_0x3eb01e)[_0x9b00('0x18')]();};}function respondWithResult(_0xe5580c,_0x2bfc50){_0x2bfc50=_0x2bfc50||0xc8;return function(_0x3e1e21){if(_0x3e1e21){return _0xe5580c['status'](_0x2bfc50)[_0x9b00('0x19')](_0x3e1e21);}};}function respondWithFilteredResult(_0x30d192,_0x1e9274){return function(_0x5da3e6){if(_0x5da3e6){var _0x4dc731=_0x5da3e6[_0x9b00('0x1a')],_0x4b1d1d=_0x1e9274['offset'],_0x1a14a0=_0x1e9274[_0x9b00('0x1b')]+_0x1e9274[_0x9b00('0x1c')],_0x103023;if(_0x1a14a0>=_0x4dc731){_0x1a14a0=_0x4dc731;_0x103023=0xc8;}else{_0x103023=0xce;}_0x30d192[_0x9b00('0x17')](_0x103023);return _0x30d192[_0x9b00('0x1d')](_0x9b00('0x1e'),_0x4b1d1d+'-'+_0x1a14a0+'/'+_0x4dc731)[_0x9b00('0x19')](_0x5da3e6);}return null;};}function patchUpdates(_0x32570f){return function(_0x267f4c){try{jsonpatch[_0x9b00('0x1f')](_0x267f4c,_0x32570f,!![]);}catch(_0xb4030e){return BPromise[_0x9b00('0x20')](_0xb4030e);}return _0x267f4c['save']();};}function saveUpdates(_0x174d03,_0x481cc6){return function(_0x24d721){if(_0x24d721){return _0x24d721[_0x9b00('0x21')](_0x174d03)['then'](function(_0x36ad1c){return _0x36ad1c;});}return null;};}function removeEntity(_0x193509,_0x337ef7){return function(_0x3734b0){if(_0x3734b0){return _0x3734b0[_0x9b00('0x22')]()[_0x9b00('0x23')](function(){var _0x357895=_0x3734b0[_0x9b00('0x24')]({'plain':!![]});var _0xd5c05c=_0x9b00('0x25');return db['UserProfileResource'][_0x9b00('0x22')]({'where':{'type':_0xd5c05c,'resourceId':_0x357895['id']}})[_0x9b00('0x23')](function(){return _0x3734b0;});})[_0x9b00('0x23')](function(){_0x193509['status'](0xcc)[_0x9b00('0x18')]();});}};}function handleEntityNotFound(_0x423b57,_0x1bab11){return function(_0x442648){if(!_0x442648){_0x423b57[_0x9b00('0x16')](0x194);}return _0x442648;};}function handleError(_0x1812bb,_0x3835c2){_0x3835c2=_0x3835c2||0x1f4;return function(_0x4295f0){logger['error'](_0x4295f0['stack']);if(_0x4295f0[_0x9b00('0x26')]){delete _0x4295f0[_0x9b00('0x26')];}_0x1812bb[_0x9b00('0x17')](_0x3835c2)['send'](_0x4295f0);};}exports['index']=function(_0x1a6e4c,_0x3b2f89){var _0x20a7e0={},_0x25695c={},_0x4f5b8c={'count':0x0,'rows':[]};var _0x2fcaea=_[_0x9b00('0x27')](db[_0x9b00('0x28')][_0x9b00('0x29')],function(_0x16ae40){return{'name':_0x16ae40[_0x9b00('0x2a')],'type':_0x16ae40['type']['key']};});_0x25695c[_0x9b00('0x2b')]=_[_0x9b00('0x27')](_0x2fcaea,_0x9b00('0x26'));_0x25695c['query']=_[_0x9b00('0x2c')](_0x1a6e4c[_0x9b00('0x2d')]);_0x25695c[_0x9b00('0x2e')]=_[_0x9b00('0x2f')](_0x25695c['model'],_0x25695c[_0x9b00('0x2d')]);_0x20a7e0['attributes']=_[_0x9b00('0x2f')](_0x25695c[_0x9b00('0x2b')],qs['fields'](_0x1a6e4c['query']['fields']));_0x20a7e0[_0x9b00('0x30')]=_0x20a7e0[_0x9b00('0x30')][_0x9b00('0x31')]?_0x20a7e0[_0x9b00('0x30')]:_0x25695c[_0x9b00('0x2b')];if(!_0x1a6e4c['query'][_0x9b00('0x32')](_0x9b00('0x33'))){_0x20a7e0[_0x9b00('0x1c')]=qs[_0x9b00('0x1c')](_0x1a6e4c['query']['limit']);_0x20a7e0['offset']=qs[_0x9b00('0x1b')](_0x1a6e4c[_0x9b00('0x2d')][_0x9b00('0x1b')]);}_0x20a7e0['order']=qs[_0x9b00('0x34')](_0x1a6e4c[_0x9b00('0x2d')]['sort']);_0x20a7e0[_0x9b00('0x35')]=qs[_0x9b00('0x2e')](_[_0x9b00('0x36')](_0x1a6e4c[_0x9b00('0x2d')],_0x25695c[_0x9b00('0x2e')]),_0x2fcaea);if(_0x1a6e4c[_0x9b00('0x2d')]['filter']){_0x20a7e0[_0x9b00('0x35')]=_[_0x9b00('0x37')](_0x20a7e0[_0x9b00('0x35')],{'$or':_[_0x9b00('0x27')](_0x2fcaea,function(_0x33620a){if(_0x33620a['type']!==_0x9b00('0x38')){var _0x3a5d18={};_0x3a5d18[_0x33620a[_0x9b00('0x26')]]={'$like':'%'+_0x1a6e4c[_0x9b00('0x2d')][_0x9b00('0x39')]+'%'};return _0x3a5d18;}})});}_0x20a7e0=_['merge']({},_0x20a7e0,_0x1a6e4c[_0x9b00('0x3a')]);var _0x542bca={'where':_0x20a7e0[_0x9b00('0x35')]};return db[_0x9b00('0x28')][_0x9b00('0x1a')](_0x542bca)['then'](function(_0xd81858){_0x4f5b8c[_0x9b00('0x1a')]=_0xd81858;if(_0x1a6e4c[_0x9b00('0x2d')][_0x9b00('0x3b')]){_0x20a7e0[_0x9b00('0x3c')]=[{'all':!![]}];}return db['Interval'][_0x9b00('0x3d')](_0x20a7e0);})[_0x9b00('0x23')](function(_0xfa9834){_0x4f5b8c[_0x9b00('0x3e')]=_0xfa9834;return _0x4f5b8c;})[_0x9b00('0x23')](respondWithFilteredResult(_0x3b2f89,_0x20a7e0))['catch'](handleError(_0x3b2f89,null));};exports['show']=function(_0x620f89,_0xc39d15){var _0x15b11c={'raw':!![],'where':{'id':_0x620f89['params']['id']}},_0xd659d1={};_0xd659d1[_0x9b00('0x2b')]=_[_0x9b00('0x2c')](db[_0x9b00('0x28')][_0x9b00('0x29')]);_0xd659d1['query']=_[_0x9b00('0x2c')](_0x620f89[_0x9b00('0x2d')]);_0xd659d1[_0x9b00('0x2e')]=_[_0x9b00('0x2f')](_0xd659d1[_0x9b00('0x2b')],_0xd659d1[_0x9b00('0x2d')]);_0x15b11c[_0x9b00('0x30')]=_[_0x9b00('0x2f')](_0xd659d1[_0x9b00('0x2b')],qs[_0x9b00('0x3f')](_0x620f89[_0x9b00('0x2d')][_0x9b00('0x3f')]));_0x15b11c[_0x9b00('0x30')]=_0x15b11c['attributes'][_0x9b00('0x31')]?_0x15b11c['attributes']:_0xd659d1[_0x9b00('0x2b')];if(_0x620f89[_0x9b00('0x2d')][_0x9b00('0x3b')]){_0x15b11c[_0x9b00('0x3c')]=[{'all':!![]}];}_0x15b11c=_[_0x9b00('0x37')]({},_0x15b11c,_0x620f89[_0x9b00('0x3a')]);return db['Interval'][_0x9b00('0x40')](_0x15b11c)['then'](handleEntityNotFound(_0xc39d15,null))[_0x9b00('0x23')](respondWithResult(_0xc39d15,null))['catch'](handleError(_0xc39d15,null));};exports[_0x9b00('0x41')]=function(_0x4bae5f,_0x26850f){return db[_0x9b00('0x28')][_0x9b00('0x41')](_0x4bae5f[_0x9b00('0x42')],{})['then'](function(_0xe38522){var _0x34436e=_0x4bae5f[_0x9b00('0x43')][_0x9b00('0x24')]({'plain':!![]});if(!_0x34436e)throw new Error(_0x9b00('0x44'));if(_0x34436e[_0x9b00('0x45')]==='user'){var _0x303b58=_0xe38522[_0x9b00('0x24')]({'plain':!![]});var _0x3a2703=_0x9b00('0x25');return db[_0x9b00('0x46')]['find']({'where':{'name':_0x3a2703,'userProfileId':_0x34436e['userProfileId']},'raw':!![]})[_0x9b00('0x23')](function(_0x4af277){if(_0x4af277&&_0x4af277[_0x9b00('0x47')]===0x0){return db[_0x9b00('0x48')][_0x9b00('0x41')]({'name':_0x303b58[_0x9b00('0x26')],'resourceId':_0x303b58['id'],'type':_0x4af277[_0x9b00('0x26')],'sectionId':_0x4af277['id']},{})[_0x9b00('0x23')](function(){return _0xe38522;});}else{return _0xe38522;}})[_0x9b00('0x49')](function(_0x41e468){logger[_0x9b00('0x4a')](_0x9b00('0x4b'),_0x41e468);throw _0x41e468;});}return _0xe38522;})[_0x9b00('0x23')](respondWithResult(_0x26850f,0xc9))[_0x9b00('0x49')](handleError(_0x26850f,null));};exports[_0x9b00('0x21')]=function(_0x57e3fa,_0x46089d){if(_0x57e3fa['body']['id']){delete _0x57e3fa[_0x9b00('0x42')]['id'];}return db[_0x9b00('0x28')][_0x9b00('0x40')]({'where':{'id':_0x57e3fa[_0x9b00('0x4c')]['id']}})['then'](handleEntityNotFound(_0x46089d,null))[_0x9b00('0x23')](saveUpdates(_0x57e3fa[_0x9b00('0x42')],null))[_0x9b00('0x23')](respondWithResult(_0x46089d,null))[_0x9b00('0x49')](handleError(_0x46089d,null));};exports[_0x9b00('0x22')]=function(_0x520db7,_0x4ee796){return db[_0x9b00('0x28')][_0x9b00('0x40')]({'where':{'id':_0x520db7[_0x9b00('0x4c')]['id']}})[_0x9b00('0x23')](handleEntityNotFound(_0x4ee796,null))[_0x9b00('0x23')](removeEntity(_0x4ee796,null))[_0x9b00('0x49')](handleError(_0x4ee796,null));};exports[_0x9b00('0x4d')]=function(_0x1b718f,_0xefdf01,_0x5e3f88){if(_0x1b718f['body']['id']){delete _0x1b718f[_0x9b00('0x42')]['id'];}return db[_0x9b00('0x28')][_0x9b00('0x40')]({'where':{'id':_0x1b718f[_0x9b00('0x4c')]['id']}})[_0x9b00('0x23')](handleEntityNotFound(_0xefdf01,null))[_0x9b00('0x23')](function(_0x941a0e){if(_0x941a0e){_0x1b718f['body'][_0x9b00('0x4e')]=_0x941a0e['id'];return db[_0x9b00('0x28')][_0x9b00('0x41')](_0x1b718f[_0x9b00('0x42')]);}})[_0x9b00('0x23')](respondWithResult(_0xefdf01,null))[_0x9b00('0x49')](handleError(_0xefdf01,null));};exports['getIntervals']=function(_0x1d34ea,_0x4ccae4,_0x3380d8){var _0xe87728={};var _0xe27779={};var _0x46eb5;var _0x273fcf;return db[_0x9b00('0x28')][_0x9b00('0x4f')]({'where':{'id':_0x1d34ea['params']['id']}})[_0x9b00('0x23')](handleEntityNotFound(_0x4ccae4,null))[_0x9b00('0x23')](function(_0xbde986){if(_0xbde986){_0x46eb5=_0xbde986;_0xe27779[_0x9b00('0x2b')]=_['keys'](db[_0x9b00('0x28')][_0x9b00('0x29')]);_0xe27779[_0x9b00('0x2d')]=_[_0x9b00('0x2c')](_0x1d34ea[_0x9b00('0x2d')]);_0xe27779[_0x9b00('0x2e')]=_[_0x9b00('0x2f')](_0xe27779[_0x9b00('0x2b')],_0xe27779[_0x9b00('0x2d')]);_0xe87728[_0x9b00('0x30')]=_[_0x9b00('0x2f')](_0xe27779[_0x9b00('0x2b')],qs[_0x9b00('0x3f')](_0x1d34ea[_0x9b00('0x2d')][_0x9b00('0x3f')]));_0xe87728[_0x9b00('0x30')]=_0xe87728[_0x9b00('0x30')][_0x9b00('0x31')]?_0xe87728[_0x9b00('0x30')]:_0xe27779[_0x9b00('0x2b')];_0xe87728[_0x9b00('0x50')]=qs[_0x9b00('0x34')](_0x1d34ea[_0x9b00('0x2d')][_0x9b00('0x34')]);_0xe87728[_0x9b00('0x35')]=qs[_0x9b00('0x2e')](_[_0x9b00('0x36')](_0x1d34ea[_0x9b00('0x2d')],_0xe27779[_0x9b00('0x2e')]));if(_0x1d34ea[_0x9b00('0x2d')][_0x9b00('0x39')]){_0xe87728[_0x9b00('0x35')]=_[_0x9b00('0x37')](_0xe87728[_0x9b00('0x35')],{'$or':_[_0x9b00('0x27')](_0xe87728[_0x9b00('0x30')],function(_0x30f6f5){var _0x2a4821={};_0x2a4821[_0x30f6f5]={'$like':'%'+_0x1d34ea[_0x9b00('0x2d')]['filter']+'%'};return _0x2a4821;})});}_0xe87728=_[_0x9b00('0x37')]({},_0xe87728,_0x1d34ea[_0x9b00('0x3a')]);return _0x46eb5['getIntervals'](_0xe87728);}})[_0x9b00('0x23')](function(_0x9683ac){if(_0x9683ac){_0x273fcf=_0x9683ac['length'];if(!_0x1d34ea[_0x9b00('0x2d')]['hasOwnProperty'](_0x9b00('0x33'))){_0xe87728['limit']=qs[_0x9b00('0x1c')](_0x1d34ea[_0x9b00('0x2d')][_0x9b00('0x1c')]);_0xe87728[_0x9b00('0x1b')]=qs[_0x9b00('0x1b')](_0x1d34ea['query'][_0x9b00('0x1b')]);}return _0x46eb5[_0x9b00('0x51')](_0xe87728);}})[_0x9b00('0x23')](function(_0xf5fa7d){if(_0xf5fa7d){return _0xf5fa7d?{'count':_0x273fcf,'rows':_0xf5fa7d}:null;}})[_0x9b00('0x23')](respondWithResult(_0x4ccae4,null))[_0x9b00('0x49')](handleError(_0x4ccae4,null));};exports[_0x9b00('0x52')]=function(_0x26adaf,_0x13a782,_0x5cff09){return db[_0x9b00('0x28')][_0x9b00('0x4f')]({'where':{'id':_0x26adaf[_0x9b00('0x4c')]['id']}})['then'](handleEntityNotFound(_0x13a782,null))[_0x9b00('0x23')](function(_0x379a72){if(_0x379a72){return db[_0x9b00('0x53')]['transaction'](function(_0x4b3766){return db[_0x9b00('0x28')]['destroy']({'where':{'IntervalId':_0x26adaf['params']['id']},'transaction':_0x4b3766})[_0x9b00('0x23')](function(_0x3434d7){var _0x47b408=_[_0x9b00('0x27')](_0x26adaf['body'],function(_0x238c7b){delete _0x238c7b['id'];_0x238c7b['IntervalId']=_0x26adaf[_0x9b00('0x4c')]['id'];return _0x238c7b;});return db[_0x9b00('0x28')]['bulkCreate'](_0x47b408,{'transaction':_0x4b3766});});})[_0x9b00('0x23')](function(){return db['Interval'][_0x9b00('0x3d')]({'where':{'IntervalId':_0x26adaf[_0x9b00('0x4c')]['id']}});});}})[_0x9b00('0x23')](respondWithResult(_0x13a782,null))['catch'](handleError(_0x13a782,null));}; \ No newline at end of file +var _0xe70e=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','json','offset','limit','set','Content-Range','save','update','then','destroy','Intervals','UserProfileResource','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','merge','options','Interval','count','includeAll','findAll','rows','show','params','include','find','catch','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','IntervalId','getIntervals','findOne','pick','filter','nolimit','addIntervals','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xe70e,0xab));var _0xee70=function(_0x1d6eb4,_0x2a20d7){_0x1d6eb4=_0x1d6eb4-0x0;var _0x1277f0=_0xe70e[_0x1d6eb4];return _0x1277f0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xee70('0x0'));var zipdir=require(_0xee70('0x1'));var jsonpatch=require(_0xee70('0x2'));var rp=require(_0xee70('0x3'));var moment=require(_0xee70('0x4'));var BPromise=require(_0xee70('0x5'));var Mustache=require(_0xee70('0x6'));var util=require(_0xee70('0x7'));var path=require(_0xee70('0x8'));var sox=require(_0xee70('0x9'));var csv=require(_0xee70('0xa'));var ejs=require(_0xee70('0xb'));var fs=require('fs');var _=require(_0xee70('0xc'));var squel=require(_0xee70('0xd'));var crypto=require(_0xee70('0xe'));var jsforce=require(_0xee70('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xee70('0x10'));var Papa=require(_0xee70('0x11'));var Redis=require('ioredis');var authService=require(_0xee70('0x12'));var qs=require(_0xee70('0x13'));var as=require(_0xee70('0x14'));var hardwareService=require(_0xee70('0x15'));var logger=require(_0xee70('0x16'))(_0xee70('0x17'));var utils=require(_0xee70('0x18'));var config=require(_0xee70('0x19'));var licenseUtil=require(_0xee70('0x1a'));var db=require('../../mysqldb')['db'];var extensions=require(_0xee70('0x1b'));function respondWithStatusCode(_0x20fe35,_0x2689de){_0x2689de=_0x2689de||0xcc;return function(_0x1dac19){if(_0x1dac19){return _0x20fe35['sendStatus'](_0x2689de);}return _0x20fe35['status'](_0x2689de)['end']();};}function respondWithResult(_0x44f932,_0x4a31aa){_0x4a31aa=_0x4a31aa||0xc8;return function(_0x205960){if(_0x205960){return _0x44f932[_0xee70('0x1c')](_0x4a31aa)[_0xee70('0x1d')](_0x205960);}};}function respondWithFilteredResult(_0x3bc559,_0x3c35b9){return function(_0x41d9ef){if(_0x41d9ef){var _0x5c681e=_0x41d9ef['count'],_0x3e4a2c=_0x3c35b9[_0xee70('0x1e')],_0x119949=_0x3c35b9[_0xee70('0x1e')]+_0x3c35b9[_0xee70('0x1f')],_0xb485fc;if(_0x119949>=_0x5c681e){_0x119949=_0x5c681e;_0xb485fc=0xc8;}else{_0xb485fc=0xce;}_0x3bc559[_0xee70('0x1c')](_0xb485fc);return _0x3bc559[_0xee70('0x20')](_0xee70('0x21'),_0x3e4a2c+'-'+_0x119949+'/'+_0x5c681e)[_0xee70('0x1d')](_0x41d9ef);}return null;};}function patchUpdates(_0x50b8dc){return function(_0x3501dd){try{jsonpatch['apply'](_0x3501dd,_0x50b8dc,!![]);}catch(_0x54db0e){return BPromise['reject'](_0x54db0e);}return _0x3501dd[_0xee70('0x22')]();};}function saveUpdates(_0x5d14ca,_0x5b4758){return function(_0x5d0411){if(_0x5d0411){return _0x5d0411[_0xee70('0x23')](_0x5d14ca)[_0xee70('0x24')](function(_0x3da91e){return _0x3da91e;});}return null;};}function removeEntity(_0x1908bd,_0x36b610){return function(_0x3ac1e4){if(_0x3ac1e4){return _0x3ac1e4[_0xee70('0x25')]()['then'](function(){var _0x4d3d97=_0x3ac1e4['get']({'plain':!![]});var _0x126aec=_0xee70('0x26');return db[_0xee70('0x27')][_0xee70('0x25')]({'where':{'type':_0x126aec,'resourceId':_0x4d3d97['id']}})['then'](function(){return _0x3ac1e4;});})[_0xee70('0x24')](function(){_0x1908bd[_0xee70('0x1c')](0xcc)[_0xee70('0x28')]();});}};}function handleEntityNotFound(_0x4290cd,_0x3f6a34){return function(_0x1ffc30){if(!_0x1ffc30){_0x4290cd[_0xee70('0x29')](0x194);}return _0x1ffc30;};}function handleError(_0x12388b,_0x542485){_0x542485=_0x542485||0x1f4;return function(_0x3a4f7c){logger[_0xee70('0x2a')](_0x3a4f7c[_0xee70('0x2b')]);if(_0x3a4f7c[_0xee70('0x2c')]){delete _0x3a4f7c[_0xee70('0x2c')];}_0x12388b[_0xee70('0x1c')](_0x542485)['send'](_0x3a4f7c);};}exports[_0xee70('0x2d')]=function(_0x561e24,_0x392fcb){var _0x3cf226={},_0x20c6e3={},_0xa5990c={'count':0x0,'rows':[]};var _0x1b2411=_[_0xee70('0x2e')](db['Interval'][_0xee70('0x2f')],function(_0x55eed1){return{'name':_0x55eed1[_0xee70('0x30')],'type':_0x55eed1[_0xee70('0x31')][_0xee70('0x32')]};});_0x20c6e3[_0xee70('0x33')]=_[_0xee70('0x2e')](_0x1b2411,'name');_0x20c6e3['query']=_[_0xee70('0x34')](_0x561e24[_0xee70('0x35')]);_0x20c6e3['filters']=_['intersection'](_0x20c6e3['model'],_0x20c6e3['query']);_0x3cf226[_0xee70('0x36')]=_[_0xee70('0x37')](_0x20c6e3[_0xee70('0x33')],qs[_0xee70('0x38')](_0x561e24[_0xee70('0x35')]['fields']));_0x3cf226[_0xee70('0x36')]=_0x3cf226[_0xee70('0x36')][_0xee70('0x39')]?_0x3cf226['attributes']:_0x20c6e3[_0xee70('0x33')];if(!_0x561e24['query'][_0xee70('0x3a')]('nolimit')){_0x3cf226[_0xee70('0x1f')]=qs[_0xee70('0x1f')](_0x561e24[_0xee70('0x35')]['limit']);_0x3cf226[_0xee70('0x1e')]=qs[_0xee70('0x1e')](_0x561e24[_0xee70('0x35')][_0xee70('0x1e')]);}_0x3cf226[_0xee70('0x3b')]=qs[_0xee70('0x3c')](_0x561e24[_0xee70('0x35')]['sort']);_0x3cf226[_0xee70('0x3d')]=qs[_0xee70('0x3e')](_['pick'](_0x561e24[_0xee70('0x35')],_0x20c6e3[_0xee70('0x3e')]),_0x1b2411);if(_0x561e24[_0xee70('0x35')]['filter']){_0x3cf226[_0xee70('0x3d')]=_['merge'](_0x3cf226['where'],{'$or':_[_0xee70('0x2e')](_0x1b2411,function(_0x351dd1){if(_0x351dd1[_0xee70('0x31')]!=='VIRTUAL'){var _0x3c1f40={};_0x3c1f40[_0x351dd1['name']]={'$like':'%'+_0x561e24[_0xee70('0x35')]['filter']+'%'};return _0x3c1f40;}})});}_0x3cf226=_[_0xee70('0x3f')]({},_0x3cf226,_0x561e24[_0xee70('0x40')]);var _0x5c9b83={'where':_0x3cf226[_0xee70('0x3d')]};return db[_0xee70('0x41')][_0xee70('0x42')](_0x5c9b83)[_0xee70('0x24')](function(_0x2731a2){_0xa5990c[_0xee70('0x42')]=_0x2731a2;if(_0x561e24[_0xee70('0x35')][_0xee70('0x43')]){_0x3cf226['include']=[{'all':!![]}];}return db[_0xee70('0x41')][_0xee70('0x44')](_0x3cf226);})[_0xee70('0x24')](function(_0x333f7d){_0xa5990c[_0xee70('0x45')]=_0x333f7d;return _0xa5990c;})[_0xee70('0x24')](respondWithFilteredResult(_0x392fcb,_0x3cf226))['catch'](handleError(_0x392fcb,null));};exports[_0xee70('0x46')]=function(_0x200c3d,_0x21ffbf){var _0x1902f4={'raw':!![],'where':{'id':_0x200c3d[_0xee70('0x47')]['id']}},_0x3fa70e={};_0x3fa70e['model']=_['keys'](db['Interval']['rawAttributes']);_0x3fa70e[_0xee70('0x35')]=_[_0xee70('0x34')](_0x200c3d[_0xee70('0x35')]);_0x3fa70e[_0xee70('0x3e')]=_['intersection'](_0x3fa70e[_0xee70('0x33')],_0x3fa70e['query']);_0x1902f4[_0xee70('0x36')]=_['intersection'](_0x3fa70e[_0xee70('0x33')],qs[_0xee70('0x38')](_0x200c3d[_0xee70('0x35')][_0xee70('0x38')]));_0x1902f4['attributes']=_0x1902f4['attributes'][_0xee70('0x39')]?_0x1902f4['attributes']:_0x3fa70e[_0xee70('0x33')];if(_0x200c3d['query']['includeAll']){_0x1902f4[_0xee70('0x48')]=[{'all':!![]}];}_0x1902f4=_[_0xee70('0x3f')]({},_0x1902f4,_0x200c3d['options']);return db[_0xee70('0x41')][_0xee70('0x49')](_0x1902f4)[_0xee70('0x24')](handleEntityNotFound(_0x21ffbf,null))[_0xee70('0x24')](respondWithResult(_0x21ffbf,null))[_0xee70('0x4a')](handleError(_0x21ffbf,null));};exports[_0xee70('0x4b')]=function(_0x4a7b44,_0x558b71){return db['Interval'][_0xee70('0x4b')](_0x4a7b44[_0xee70('0x4c')],{})[_0xee70('0x24')](function(_0x2fecfa){var _0x159138=_0x4a7b44[_0xee70('0x4d')][_0xee70('0x4e')]({'plain':!![]});if(!_0x159138)throw new Error(_0xee70('0x4f'));if(_0x159138[_0xee70('0x50')]===_0xee70('0x4d')){var _0x13cf00=_0x2fecfa['get']({'plain':!![]});var _0x45eab5=_0xee70('0x26');return db[_0xee70('0x51')]['find']({'where':{'name':_0x45eab5,'userProfileId':_0x159138[_0xee70('0x52')]},'raw':!![]})['then'](function(_0x4882f6){if(_0x4882f6&&_0x4882f6[_0xee70('0x53')]===0x0){return db['UserProfileResource'][_0xee70('0x4b')]({'name':_0x13cf00[_0xee70('0x2c')],'resourceId':_0x13cf00['id'],'type':_0x4882f6[_0xee70('0x2c')],'sectionId':_0x4882f6['id']},{})[_0xee70('0x24')](function(){return _0x2fecfa;});}else{return _0x2fecfa;}})[_0xee70('0x4a')](function(_0x4817dd){logger[_0xee70('0x2a')](_0xee70('0x54'),_0x4817dd);throw _0x4817dd;});}return _0x2fecfa;})[_0xee70('0x24')](respondWithResult(_0x558b71,0xc9))[_0xee70('0x4a')](handleError(_0x558b71,null));};exports[_0xee70('0x23')]=function(_0x18de4e,_0x50384f){if(_0x18de4e['body']['id']){delete _0x18de4e[_0xee70('0x4c')]['id'];}return db[_0xee70('0x41')][_0xee70('0x49')]({'where':{'id':_0x18de4e[_0xee70('0x47')]['id']}})[_0xee70('0x24')](handleEntityNotFound(_0x50384f,null))[_0xee70('0x24')](saveUpdates(_0x18de4e[_0xee70('0x4c')],null))[_0xee70('0x24')](respondWithResult(_0x50384f,null))[_0xee70('0x4a')](handleError(_0x50384f,null));};exports[_0xee70('0x25')]=function(_0x2cc396,_0x4f9a65){return db[_0xee70('0x41')]['find']({'where':{'id':_0x2cc396[_0xee70('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f9a65,null))['then'](removeEntity(_0x4f9a65,null))[_0xee70('0x4a')](handleError(_0x4f9a65,null));};exports['addInterval']=function(_0x476582,_0x38af93,_0xe6e611){if(_0x476582[_0xee70('0x4c')]['id']){delete _0x476582[_0xee70('0x4c')]['id'];}return db['Interval'][_0xee70('0x49')]({'where':{'id':_0x476582[_0xee70('0x47')]['id']}})[_0xee70('0x24')](handleEntityNotFound(_0x38af93,null))[_0xee70('0x24')](function(_0x5ea22f){if(_0x5ea22f){_0x476582['body'][_0xee70('0x55')]=_0x5ea22f['id'];return db['Interval'][_0xee70('0x4b')](_0x476582[_0xee70('0x4c')]);}})[_0xee70('0x24')](respondWithResult(_0x38af93,null))['catch'](handleError(_0x38af93,null));};exports[_0xee70('0x56')]=function(_0x49ace1,_0x3f4433,_0xc04916){var _0x4831d7={};var _0x59071c={};var _0x491320;var _0xe749f2;return db[_0xee70('0x41')][_0xee70('0x57')]({'where':{'id':_0x49ace1[_0xee70('0x47')]['id']}})[_0xee70('0x24')](handleEntityNotFound(_0x3f4433,null))['then'](function(_0x172cfb){if(_0x172cfb){_0x491320=_0x172cfb;_0x59071c[_0xee70('0x33')]=_['keys'](db[_0xee70('0x41')]['rawAttributes']);_0x59071c[_0xee70('0x35')]=_['keys'](_0x49ace1[_0xee70('0x35')]);_0x59071c[_0xee70('0x3e')]=_[_0xee70('0x37')](_0x59071c['model'],_0x59071c[_0xee70('0x35')]);_0x4831d7[_0xee70('0x36')]=_[_0xee70('0x37')](_0x59071c[_0xee70('0x33')],qs['fields'](_0x49ace1[_0xee70('0x35')][_0xee70('0x38')]));_0x4831d7['attributes']=_0x4831d7[_0xee70('0x36')]['length']?_0x4831d7[_0xee70('0x36')]:_0x59071c[_0xee70('0x33')];_0x4831d7[_0xee70('0x3b')]=qs[_0xee70('0x3c')](_0x49ace1[_0xee70('0x35')][_0xee70('0x3c')]);_0x4831d7[_0xee70('0x3d')]=qs[_0xee70('0x3e')](_[_0xee70('0x58')](_0x49ace1[_0xee70('0x35')],_0x59071c[_0xee70('0x3e')]));if(_0x49ace1['query'][_0xee70('0x59')]){_0x4831d7[_0xee70('0x3d')]=_[_0xee70('0x3f')](_0x4831d7[_0xee70('0x3d')],{'$or':_[_0xee70('0x2e')](_0x4831d7[_0xee70('0x36')],function(_0x33caa6){var _0x13c848={};_0x13c848[_0x33caa6]={'$like':'%'+_0x49ace1[_0xee70('0x35')][_0xee70('0x59')]+'%'};return _0x13c848;})});}_0x4831d7=_[_0xee70('0x3f')]({},_0x4831d7,_0x49ace1[_0xee70('0x40')]);return _0x491320[_0xee70('0x56')](_0x4831d7);}})[_0xee70('0x24')](function(_0x43bfa4){if(_0x43bfa4){_0xe749f2=_0x43bfa4['length'];if(!_0x49ace1['query'][_0xee70('0x3a')](_0xee70('0x5a'))){_0x4831d7['limit']=qs[_0xee70('0x1f')](_0x49ace1[_0xee70('0x35')][_0xee70('0x1f')]);_0x4831d7[_0xee70('0x1e')]=qs[_0xee70('0x1e')](_0x49ace1[_0xee70('0x35')][_0xee70('0x1e')]);}return _0x491320['getIntervals'](_0x4831d7);}})[_0xee70('0x24')](function(_0x541d0f){if(_0x541d0f){return _0x541d0f?{'count':_0xe749f2,'rows':_0x541d0f}:null;}})['then'](respondWithResult(_0x3f4433,null))[_0xee70('0x4a')](handleError(_0x3f4433,null));};exports[_0xee70('0x5b')]=function(_0x2baa5b,_0x41be3a,_0x510044){return db[_0xee70('0x41')][_0xee70('0x57')]({'where':{'id':_0x2baa5b[_0xee70('0x47')]['id']}})['then'](handleEntityNotFound(_0x41be3a,null))[_0xee70('0x24')](function(_0x4563c8){if(_0x4563c8){return db['sequelize']['transaction'](function(_0x45f202){return db[_0xee70('0x41')][_0xee70('0x25')]({'where':{'IntervalId':_0x2baa5b[_0xee70('0x47')]['id']},'transaction':_0x45f202})[_0xee70('0x24')](function(_0x1e8c2d){var _0x200932=_['map'](_0x2baa5b['body'],function(_0x3e6ee7){delete _0x3e6ee7['id'];_0x3e6ee7['IntervalId']=_0x2baa5b[_0xee70('0x47')]['id'];return _0x3e6ee7;});return db['Interval'][_0xee70('0x5c')](_0x200932,{'transaction':_0x45f202});});})[_0xee70('0x24')](function(){return db[_0xee70('0x41')][_0xee70('0x44')]({'where':{'IntervalId':_0x2baa5b[_0xee70('0x47')]['id']}});});}})[_0xee70('0x24')](respondWithResult(_0x41be3a,null))[_0xee70('0x4a')](handleError(_0x41be3a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4762c2d..c53ce1b 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 _0x5c9c=['api','moment','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','Interval','rewrite','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5c9c,0x1d1));var _0xc5c9=function(_0x1c0302,_0x15a84b){_0x1c0302=_0x1c0302-0x0;var _0x3a1221=_0x5c9c[_0x1c0302];return _0x3a1221;};'use strict';var _=require(_0xc5c9('0x0'));var util=require(_0xc5c9('0x1'));var logger=require(_0xc5c9('0x2'))(_0xc5c9('0x3'));var moment=require(_0xc5c9('0x4'));var BPromise=require('bluebird');var rp=require(_0xc5c9('0x5'));var fs=require('fs');var path=require(_0xc5c9('0x6'));var rimraf=require(_0xc5c9('0x7'));var config=require(_0xc5c9('0x8'));var attributes=require(_0xc5c9('0x9'));var extensions=require(_0xc5c9('0xa'));module['exports']=function(_0x3d7538,_0xcdf0af){return _0x3d7538['define'](_0xc5c9('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x534b7f,_0x545df7){extensions[_0xc5c9('0xc')](_0x3d7538,_0x534b7f);},'afterBulkCreate':function(_0x5ca530,_0xba5951,_0x117335){_0x117335();extensions[_0xc5c9('0xc')](_0x3d7538,_0x5ca530[0x0]);},'afterUpdate':function(_0x12213a,_0x3dc295){extensions[_0xc5c9('0xc')](_0x3d7538,_0x12213a);},'afterDestroy':function(_0x349d36,_0x134550){extensions[_0xc5c9('0xc')](_0x3d7538,_0x349d36);}}});}; \ No newline at end of file +var _0x159b=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals'];(function(_0x180c35,_0x16bc0a){var _0x425cf8=function(_0x9ed6c0){while(--_0x9ed6c0){_0x180c35['push'](_0x180c35['shift']());}};_0x425cf8(++_0x16bc0a);}(_0x159b,0x181));var _0xb159=function(_0x11e404,_0x47e1af){_0x11e404=_0x11e404-0x0;var _0x27b0ea=_0x159b[_0x11e404];return _0x27b0ea;};'use strict';var _=require(_0xb159('0x0'));var util=require(_0xb159('0x1'));var logger=require(_0xb159('0x2'))(_0xb159('0x3'));var moment=require(_0xb159('0x4'));var BPromise=require(_0xb159('0x5'));var rp=require(_0xb159('0x6'));var fs=require('fs');var path=require(_0xb159('0x7'));var rimraf=require('rimraf');var config=require(_0xb159('0x8'));var attributes=require(_0xb159('0x9'));var extensions=require(_0xb159('0xa'));module[_0xb159('0xb')]=function(_0x4a6e2e,_0x42f080){return _0x4a6e2e[_0xb159('0xc')](_0xb159('0xd'),attributes,{'tableName':_0xb159('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x11afdc,_0x7f9727){extensions[_0xb159('0xf')](_0x4a6e2e,_0x11afdc);},'afterBulkCreate':function(_0x27238a,_0x2df975,_0x130e72){_0x130e72();extensions[_0xb159('0xf')](_0x4a6e2e,_0x27238a[0x0]);},'afterUpdate':function(_0x45a7c9,_0x424e93){extensions['rewrite'](_0x4a6e2e,_0x45a7c9);},'afterDestroy':function(_0x4b3df1,_0x36386e){extensions[_0xb159('0xf')](_0x4a6e2e,_0x4b3df1);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 0fec753..6fd0ec8 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 _0x0067=['request','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','Interval,\x20%s,\x20%s','message','GetInterval','Interval','options','raw','where','include','map','model','attributes','catch','ShowInterval','find','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0x0067,0x1e5));var _0x7006=function(_0x699200,_0x39c101){_0x699200=_0x699200-0x0;var _0x266fd1=_0x0067[_0x699200];return _0x266fd1;};'use strict';var _=require(_0x7006('0x0'));var util=require(_0x7006('0x1'));var moment=require(_0x7006('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7006('0x3'))['db'];var utils=require(_0x7006('0x4'));var logger=require(_0x7006('0x5'))(_0x7006('0x6'));var config=require('../../config/environment');var jayson=require(_0x7006('0x7'));var client=jayson[_0x7006('0x8')][_0x7006('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b955c,_0x431f9a,_0xc0f266){return new BPromise(function(_0x1f5319,_0x48648b){return client[_0x7006('0xa')](_0x1b955c,_0xc0f266)[_0x7006('0xb')](function(_0x7c8d6a){logger[_0x7006('0xc')]('Interval,\x20%s,\x20%s',_0x431f9a,_0x7006('0xd'));logger[_0x7006('0xe')](_0x7006('0xf'),_0x431f9a,_0x7006('0xd'),JSON[_0x7006('0x10')](_0x7c8d6a));if(_0x7c8d6a[_0x7006('0x11')]){if(_0x7c8d6a[_0x7006('0x11')][_0x7006('0x12')]===0x1f4){logger['error'](_0x7006('0x13'),_0x431f9a,_0x7c8d6a[_0x7006('0x11')]['message']);return _0x48648b(_0x7c8d6a[_0x7006('0x11')][_0x7006('0x14')]);}logger['error']('Interval,\x20%s,\x20%s',_0x431f9a,_0x7c8d6a[_0x7006('0x11')]['message']);return _0x1f5319(_0x7c8d6a[_0x7006('0x11')]['message']);}else{logger[_0x7006('0xc')](_0x7006('0x13'),_0x431f9a,_0x7006('0xd'));_0x1f5319(_0x7c8d6a['result'][_0x7006('0x14')]);}})['catch'](function(_0x9842fb){logger['error'](_0x7006('0x13'),_0x431f9a,_0x9842fb);_0x48648b(_0x9842fb);});});}exports[_0x7006('0x15')]=function(_0x542815){var _0x2b5d78=this;return new Promise(function(_0x5e8bfe,_0x52fe5a){return db[_0x7006('0x16')]['findAll']({'raw':_0x542815[_0x7006('0x17')]?_0x542815[_0x7006('0x17')][_0x7006('0x18')]===undefined?!![]:![]:!![],'where':_0x542815[_0x7006('0x17')]?_0x542815[_0x7006('0x17')][_0x7006('0x19')]||null:null,'attributes':_0x542815['options']?_0x542815[_0x7006('0x17')]['attributes']||null:null,'limit':_0x542815[_0x7006('0x17')]?_0x542815[_0x7006('0x17')]['limit']||null:null,'include':_0x542815[_0x7006('0x17')]?_0x542815['options'][_0x7006('0x1a')]?_[_0x7006('0x1b')](_0x542815[_0x7006('0x17')][_0x7006('0x1a')],function(_0x116c5a){return{'model':db[_0x116c5a[_0x7006('0x1c')]],'as':_0x116c5a['as'],'attributes':_0x116c5a[_0x7006('0x1d')],'include':_0x116c5a[_0x7006('0x1a')]?_['map'](_0x116c5a['include'],function(_0x49e9d5){return{'model':db[_0x49e9d5['model']],'as':_0x49e9d5['as'],'attributes':_0x49e9d5[_0x7006('0x1d')],'include':_0x49e9d5[_0x7006('0x1a')]?_[_0x7006('0x1b')](_0x49e9d5[_0x7006('0x1a')],function(_0x439973){return{'model':db[_0x439973[_0x7006('0x1c')]],'as':_0x439973['as'],'attributes':_0x439973[_0x7006('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7006('0xb')](function(_0xc6fc31){logger[_0x7006('0xc')]('GetInterval',_0x542815);logger[_0x7006('0xe')]('GetInterval',_0x542815,JSON['stringify'](_0xc6fc31));_0x5e8bfe(_0xc6fc31);})[_0x7006('0x1e')](function(_0x50c67e){logger[_0x7006('0x11')](_0x7006('0x15'),_0x50c67e[_0x7006('0x14')],_0x542815);_0x52fe5a(_0x2b5d78[_0x7006('0x11')](0x1f4,_0x50c67e[_0x7006('0x14')]));});});};exports[_0x7006('0x1f')]=function(_0x21e5b1){var _0x5714ce=this;return new Promise(function(_0x42725c,_0x823e35){return db['Interval'][_0x7006('0x20')]({'raw':_0x21e5b1[_0x7006('0x17')]?_0x21e5b1[_0x7006('0x17')][_0x7006('0x18')]===undefined?!![]:![]:!![],'where':_0x21e5b1[_0x7006('0x17')]?_0x21e5b1[_0x7006('0x17')][_0x7006('0x19')]||null:null,'attributes':_0x21e5b1[_0x7006('0x17')]?_0x21e5b1['options']['attributes']||null:null,'include':_0x21e5b1[_0x7006('0x17')]?_0x21e5b1['options'][_0x7006('0x1a')]?_[_0x7006('0x1b')](_0x21e5b1['options'][_0x7006('0x1a')],function(_0x84a2f5){return{'model':db[_0x84a2f5[_0x7006('0x1c')]],'as':_0x84a2f5['as'],'attributes':_0x84a2f5[_0x7006('0x1d')],'include':_0x84a2f5[_0x7006('0x1a')]?_[_0x7006('0x1b')](_0x84a2f5['include'],function(_0x1f324a){return{'model':db[_0x1f324a['model']],'as':_0x1f324a['as'],'attributes':_0x1f324a[_0x7006('0x1d')],'include':_0x1f324a['include']?_[_0x7006('0x1b')](_0x1f324a[_0x7006('0x1a')],function(_0x9a1949){return{'model':db[_0x9a1949[_0x7006('0x1c')]],'as':_0x9a1949['as'],'attributes':_0x9a1949['attributes']};}):[]};}):[]};}):[]:[]})[_0x7006('0xb')](function(_0x46a273){logger[_0x7006('0xc')](_0x7006('0x1f'),_0x21e5b1);logger['debug'](_0x7006('0x1f'),_0x21e5b1,JSON[_0x7006('0x10')](_0x46a273));_0x42725c(_0x46a273);})['catch'](function(_0x34dce1){logger['error'](_0x7006('0x1f'),_0x34dce1[_0x7006('0x14')],_0x21e5b1);_0x823e35(_0x5714ce['error'](0x1f4,_0x34dce1[_0x7006('0x14')]));});});}; \ No newline at end of file +var _0x9a79=['raw','attributes','limit','include','map','debug','ShowInterval','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options'];(function(_0x47b096,_0x35375c){var _0x544b91=function(_0x48009f){while(--_0x48009f){_0x47b096['push'](_0x47b096['shift']());}};_0x544b91(++_0x35375c);}(_0x9a79,0x77));var _0x99a7=function(_0x53efa4,_0x1e673b){_0x53efa4=_0x53efa4-0x0;var _0x276274=_0x9a79[_0x53efa4];return _0x276274;};'use strict';var _=require(_0x99a7('0x0'));var util=require(_0x99a7('0x1'));var moment=require(_0x99a7('0x2'));var BPromise=require(_0x99a7('0x3'));var rs=require(_0x99a7('0x4'));var fs=require('fs');var Redis=require(_0x99a7('0x5'));var db=require(_0x99a7('0x6'))['db'];var utils=require(_0x99a7('0x7'));var logger=require(_0x99a7('0x8'))(_0x99a7('0x9'));var config=require(_0x99a7('0xa'));var jayson=require(_0x99a7('0xb'));var client=jayson[_0x99a7('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587131,_0xfbcfbd,_0x253fb8){return new BPromise(function(_0x2de490,_0x10a2be){return client[_0x99a7('0xd')](_0x587131,_0x253fb8)[_0x99a7('0xe')](function(_0x31f5ae){logger[_0x99a7('0xf')](_0x99a7('0x10'),_0xfbcfbd,_0x99a7('0x11'));logger['debug'](_0x99a7('0x12'),_0xfbcfbd,_0x99a7('0x11'),JSON[_0x99a7('0x13')](_0x31f5ae));if(_0x31f5ae[_0x99a7('0x14')]){if(_0x31f5ae[_0x99a7('0x14')][_0x99a7('0x15')]===0x1f4){logger[_0x99a7('0x14')](_0x99a7('0x10'),_0xfbcfbd,_0x31f5ae['error'][_0x99a7('0x16')]);return _0x10a2be(_0x31f5ae[_0x99a7('0x14')]['message']);}logger[_0x99a7('0x14')](_0x99a7('0x10'),_0xfbcfbd,_0x31f5ae[_0x99a7('0x14')][_0x99a7('0x16')]);return _0x2de490(_0x31f5ae['error'][_0x99a7('0x16')]);}else{logger[_0x99a7('0xf')](_0x99a7('0x10'),_0xfbcfbd,_0x99a7('0x11'));_0x2de490(_0x31f5ae[_0x99a7('0x17')][_0x99a7('0x16')]);}})[_0x99a7('0x18')](function(_0x449498){logger[_0x99a7('0x14')](_0x99a7('0x10'),_0xfbcfbd,_0x449498);_0x10a2be(_0x449498);});});}exports[_0x99a7('0x19')]=function(_0x1fd24f){var _0x540dda=this;return new Promise(function(_0x273adf,_0x48eb18){return db[_0x99a7('0x1a')][_0x99a7('0x1b')]({'raw':_0x1fd24f[_0x99a7('0x1c')]?_0x1fd24f['options'][_0x99a7('0x1d')]===undefined?!![]:![]:!![],'where':_0x1fd24f[_0x99a7('0x1c')]?_0x1fd24f['options']['where']||null:null,'attributes':_0x1fd24f[_0x99a7('0x1c')]?_0x1fd24f[_0x99a7('0x1c')][_0x99a7('0x1e')]||null:null,'limit':_0x1fd24f['options']?_0x1fd24f[_0x99a7('0x1c')][_0x99a7('0x1f')]||null:null,'include':_0x1fd24f[_0x99a7('0x1c')]?_0x1fd24f[_0x99a7('0x1c')][_0x99a7('0x20')]?_[_0x99a7('0x21')](_0x1fd24f[_0x99a7('0x1c')][_0x99a7('0x20')],function(_0x22ef9d){return{'model':db[_0x22ef9d['model']],'as':_0x22ef9d['as'],'attributes':_0x22ef9d[_0x99a7('0x1e')],'include':_0x22ef9d[_0x99a7('0x20')]?_['map'](_0x22ef9d[_0x99a7('0x20')],function(_0x456eb6){return{'model':db[_0x456eb6['model']],'as':_0x456eb6['as'],'attributes':_0x456eb6[_0x99a7('0x1e')],'include':_0x456eb6[_0x99a7('0x20')]?_[_0x99a7('0x21')](_0x456eb6[_0x99a7('0x20')],function(_0x439e42){return{'model':db[_0x439e42['model']],'as':_0x439e42['as'],'attributes':_0x439e42[_0x99a7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x99a7('0xe')](function(_0x5f5362){logger[_0x99a7('0xf')](_0x99a7('0x19'),_0x1fd24f);logger[_0x99a7('0x22')]('GetInterval',_0x1fd24f,JSON[_0x99a7('0x13')](_0x5f5362));_0x273adf(_0x5f5362);})['catch'](function(_0x2d5859){logger[_0x99a7('0x14')](_0x99a7('0x19'),_0x2d5859[_0x99a7('0x16')],_0x1fd24f);_0x48eb18(_0x540dda[_0x99a7('0x14')](0x1f4,_0x2d5859[_0x99a7('0x16')]));});});};exports[_0x99a7('0x23')]=function(_0x46f7b0){var _0x11db94=this;return new Promise(function(_0x452c58,_0x4d0e71){return db[_0x99a7('0x1a')]['find']({'raw':_0x46f7b0[_0x99a7('0x1c')]?_0x46f7b0[_0x99a7('0x1c')][_0x99a7('0x1d')]===undefined?!![]:![]:!![],'where':_0x46f7b0['options']?_0x46f7b0[_0x99a7('0x1c')][_0x99a7('0x24')]||null:null,'attributes':_0x46f7b0[_0x99a7('0x1c')]?_0x46f7b0[_0x99a7('0x1c')][_0x99a7('0x1e')]||null:null,'include':_0x46f7b0[_0x99a7('0x1c')]?_0x46f7b0[_0x99a7('0x1c')][_0x99a7('0x20')]?_[_0x99a7('0x21')](_0x46f7b0[_0x99a7('0x1c')][_0x99a7('0x20')],function(_0x115949){return{'model':db[_0x115949['model']],'as':_0x115949['as'],'attributes':_0x115949[_0x99a7('0x1e')],'include':_0x115949[_0x99a7('0x20')]?_[_0x99a7('0x21')](_0x115949[_0x99a7('0x20')],function(_0x214d15){return{'model':db[_0x214d15['model']],'as':_0x214d15['as'],'attributes':_0x214d15['attributes'],'include':_0x214d15['include']?_[_0x99a7('0x21')](_0x214d15[_0x99a7('0x20')],function(_0x3eaf48){return{'model':db[_0x3eaf48['model']],'as':_0x3eaf48['as'],'attributes':_0x3eaf48[_0x99a7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x99a7('0xe')](function(_0x13fef7){logger[_0x99a7('0xf')](_0x99a7('0x23'),_0x46f7b0);logger[_0x99a7('0x22')](_0x99a7('0x23'),_0x46f7b0,JSON['stringify'](_0x13fef7));_0x452c58(_0x13fef7);})[_0x99a7('0x18')](function(_0x585b1e){logger['error']('ShowInterval',_0x585b1e[_0x99a7('0x16')],_0x46f7b0);_0x4d0e71(_0x11db94[_0x99a7('0x14')](0x1f4,_0x585b1e[_0x99a7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 183de40..ed6bc5e 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 _0x692a=['post','isAuthenticated','exports','express','Router','./jira.controller'];(function(_0xcde410,_0x524851){var _0xdc4133=function(_0x4648f4){while(--_0x4648f4){_0xcde410['push'](_0xcde410['shift']());}};_0xdc4133(++_0x524851);}(_0x692a,0x171));var _0xa692=function(_0x3cefec,_0x9f9588){_0x3cefec=_0x3cefec-0x0;var _0x27bad1=_0x692a[_0x3cefec];return _0x27bad1;};'use strict';var express=require(_0xa692('0x0'));var router=express[_0xa692('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xa692('0x2'));router[_0xa692('0x3')]('/',auth[_0xa692('0x4')](),controller['send']);module[_0xa692('0x5')]=router; \ No newline at end of file +var _0x57b3=['post','isAuthenticated','exports','Router','../../components/auth/service','./jira.controller'];(function(_0x28835a,_0x3734bd){var _0x276a93=function(_0x5ac745){while(--_0x5ac745){_0x28835a['push'](_0x28835a['shift']());}};_0x276a93(++_0x3734bd);}(_0x57b3,0x1ad));var _0x357b=function(_0x38f210,_0xbf6168){_0x38f210=_0x38f210-0x0;var _0x3d606c=_0x57b3[_0x38f210];return _0x3d606c;};'use strict';var express=require('express');var router=express[_0x357b('0x0')]();var auth=require(_0x357b('0x1'));var controller=require(_0x357b('0x2'));router[_0x357b('0x3')]('/',auth[_0x357b('0x4')](),controller['send']);module[_0x357b('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 38dbc9c..2d746ed 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 _0xfc62=['connection','remoteAddress','socket','bluebird','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','Bug','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','request','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for'];(function(_0x59f30a,_0x2ed731){var _0x19141e=function(_0xc2c503){while(--_0xc2c503){_0x59f30a['push'](_0x59f30a['shift']());}};_0x19141e(++_0x2ed731);}(_0xfc62,0x10b));var _0x2fc6=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xfc62[_0x4b369d];return _0x571a98;};'use strict';var BPromise=require(_0x2fc6('0x0'));var https=require('https');var logger=require(_0x2fc6('0x1'))(_0x2fc6('0x2'));var USERNAME=_0x2fc6('0x3');var PASSWORD=_0x2fc6('0x4');function openIssue(_0x2bcf34,_0x3e2548){var _0x6597d1={'fields':{'project':{'key':_0x2bcf34[_0x2fc6('0x5')]||_0x2fc6('0x6')},'summary':(_0x2bcf34[_0x2fc6('0x7')]||_0x2fc6('0x8'))+_0x2fc6('0x9')+_0x2bcf34['ip'],'description':_0x2bcf34[_0x2fc6('0xa')]||JSON['stringify'](_0x2bcf34),'issuetype':{'name':_0x2bcf34['issuetype']||_0x2fc6('0xb')}}};_0x6597d1[_0x2fc6('0xc')][_0x2fc6('0xd')]=_0x2bcf34['email'];_0x6597d1[_0x2fc6('0xc')][_0x2fc6('0xe')]=_0x2bcf34[_0x2fc6('0xf')];_0x6597d1[_0x2fc6('0xc')][_0x2fc6('0x10')]=_0x2bcf34[_0x2fc6('0x11')];_0x6597d1['fields'][_0x2fc6('0x12')]=_0x2bcf34[_0x2fc6('0x13')];_0x6597d1[_0x2fc6('0xc')][_0x2fc6('0x14')]=_0x2bcf34[_0x2fc6('0x15')];_0x6597d1[_0x2fc6('0xc')][_0x2fc6('0x16')]=_0x2bcf34['ip'];var _0x13e326={'host':_0x2fc6('0x17'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x2fc6('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x2fc6('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x2fc6('0x1a')]('base64')}};var _0x6bb0e8=JSON['stringify'](_0x6597d1);var _0x400d99=https[_0x2fc6('0x1b')](_0x13e326,function(_0x588792){_0x588792['setEncoding']('utf8');var _0x398173='';_0x588792['on']('data',function(_0x45e2c4){_0x398173+=_0x45e2c4;});_0x588792['on'](_0x2fc6('0x1c'),function(){if(_0x3e2548){return _0x3e2548[_0x2fc6('0x1d')](_0x588792[_0x2fc6('0x1e')])[_0x2fc6('0x1f')](JSON[_0x2fc6('0x20')](_0x398173));}});});_0x400d99['on'](_0x2fc6('0x21'),function(_0x4fcc05){if(_0x3e2548){return _0x3e2548[_0x2fc6('0x1d')](0x1f4)[_0x2fc6('0x1f')]({'errors':[{'message':_0x2fc6('0x22'),'type':_0x2fc6('0x23')}]});}});_0x400d99['write'](_0x6bb0e8);_0x400d99['end']();}exports[_0x2fc6('0x24')]=openIssue;exports[_0x2fc6('0x25')]=function(_0x28f17d,_0x3b9821){_0x28f17d[_0x2fc6('0x26')]['ip']=_0x28f17d[_0x2fc6('0x27')][_0x2fc6('0x28')]||_0x28f17d[_0x2fc6('0x29')][_0x2fc6('0x2a')]||_0x28f17d[_0x2fc6('0x2b')]['remoteAddress']||_0x28f17d[_0x2fc6('0x29')][_0x2fc6('0x2b')][_0x2fc6('0x2a')];return openIssue(_0x28f17d['body'],_0x3b9821);}; \ No newline at end of file +var _0xd4a6=['remoteAddress','socket','https','../../config/logger','api','support','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','customfield_11500','fields','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','request','setEncoding','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xd4a6,0x8f));var _0x6d4a=function(_0x5e8573,_0x401ee1){_0x5e8573=_0x5e8573-0x0;var _0x3a744a=_0xd4a6[_0x5e8573];return _0x3a744a;};'use strict';var BPromise=require('bluebird');var https=require(_0x6d4a('0x0'));var logger=require(_0x6d4a('0x1'))(_0x6d4a('0x2'));var USERNAME=_0x6d4a('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x2fbb45,_0x3990bb){var _0x3b9fff={'fields':{'project':{'key':_0x2fbb45['key']||_0x6d4a('0x4')},'summary':(_0x2fbb45[_0x6d4a('0x5')]||_0x6d4a('0x6'))+_0x6d4a('0x7')+_0x2fbb45['ip'],'description':_0x2fbb45[_0x6d4a('0x8')]||JSON[_0x6d4a('0x9')](_0x2fbb45),'issuetype':{'name':_0x2fbb45[_0x6d4a('0xa')]||_0x6d4a('0xb')}}};_0x3b9fff['fields'][_0x6d4a('0xc')]=_0x2fbb45['email'];_0x3b9fff[_0x6d4a('0xd')][_0x6d4a('0xe')]=_0x2fbb45[_0x6d4a('0xf')];_0x3b9fff[_0x6d4a('0xd')]['customfield_11502']=_0x2fbb45[_0x6d4a('0x10')];_0x3b9fff[_0x6d4a('0xd')][_0x6d4a('0x11')]=_0x2fbb45[_0x6d4a('0x12')];_0x3b9fff[_0x6d4a('0xd')][_0x6d4a('0x13')]=_0x2fbb45[_0x6d4a('0x14')];_0x3b9fff[_0x6d4a('0xd')][_0x6d4a('0x15')]=_0x2fbb45['ip'];var _0x28b678={'host':_0x6d4a('0x16'),'port':0x1bb,'path':_0x6d4a('0x17'),'method':_0x6d4a('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x6d4a('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x6d4a('0x1a')](_0x6d4a('0x1b'))}};var _0x562c22=JSON[_0x6d4a('0x9')](_0x3b9fff);var _0x52627c=https[_0x6d4a('0x1c')](_0x28b678,function(_0x4c4e86){_0x4c4e86[_0x6d4a('0x1d')]('utf8');var _0x22c57a='';_0x4c4e86['on']('data',function(_0x3a3c29){_0x22c57a+=_0x3a3c29;});_0x4c4e86['on'](_0x6d4a('0x1e'),function(){if(_0x3990bb){return _0x3990bb[_0x6d4a('0x1f')](_0x4c4e86[_0x6d4a('0x20')])[_0x6d4a('0x21')](JSON[_0x6d4a('0x22')](_0x22c57a));}});});_0x52627c['on'](_0x6d4a('0x23'),function(_0x52d416){if(_0x3990bb){return _0x3990bb[_0x6d4a('0x1f')](0x1f4)[_0x6d4a('0x21')]({'errors':[{'message':_0x6d4a('0x24'),'type':_0x6d4a('0x25')}]});}});_0x52627c[_0x6d4a('0x26')](_0x562c22);_0x52627c[_0x6d4a('0x1e')]();}exports[_0x6d4a('0x27')]=openIssue;exports[_0x6d4a('0x28')]=function(_0x4a19c8,_0x4aa6fa){_0x4a19c8[_0x6d4a('0x29')]['ip']=_0x4a19c8[_0x6d4a('0x2a')][_0x6d4a('0x2b')]||_0x4a19c8[_0x6d4a('0x2c')][_0x6d4a('0x2d')]||_0x4a19c8[_0x6d4a('0x2e')]['remoteAddress']||_0x4a19c8[_0x6d4a('0x2c')][_0x6d4a('0x2e')][_0x6d4a('0x2d')];return openIssue(_0x4a19c8[_0x6d4a('0x29')],_0x4aa6fa);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 435e0d7..c228c78 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 _0x6290=['put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create'];(function(_0x2f6a10,_0x32b9f3){var _0x5e32e1=function(_0x11be3b){while(--_0x11be3b){_0x2f6a10['push'](_0x2f6a10['shift']());}};_0x5e32e1(++_0x32b9f3);}(_0x6290,0x122));var _0x0629=function(_0x3305f2,_0x421435){_0x3305f2=_0x3305f2-0x0;var _0xe2b665=_0x6290[_0x3305f2];return _0xe2b665;};'use strict';var multer=require('multer');var util=require(_0x0629('0x0'));var path=require(_0x0629('0x1'));var timeout=require(_0x0629('0x2'));var express=require(_0x0629('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0629('0x4'));var config=require(_0x0629('0x5'));var controller=require(_0x0629('0x6'));router['get']('/',auth[_0x0629('0x7')](),controller['index']);router[_0x0629('0x8')](_0x0629('0x9'),auth['isAuthenticated'](),controller[_0x0629('0xa')]);router[_0x0629('0x8')](_0x0629('0xb'),auth[_0x0629('0x7')](),controller[_0x0629('0xc')]);router['post']('/',auth[_0x0629('0x7')](),controller[_0x0629('0xd')]);router[_0x0629('0xe')](_0x0629('0xb'),auth[_0x0629('0x7')](),controller[_0x0629('0xf')]);router[_0x0629('0x10')](_0x0629('0xb'),auth['isAuthenticated'](),controller[_0x0629('0x11')]);module[_0x0629('0x12')]=router; \ No newline at end of file +var _0x4ae0=['express','Router','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','/describe','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout'];(function(_0x833d9b,_0x19a5d6){var _0x2cc2a4=function(_0x206446){while(--_0x206446){_0x833d9b['push'](_0x833d9b['shift']());}};_0x2cc2a4(++_0x19a5d6);}(_0x4ae0,0x1a6));var _0x04ae=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4ae0[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x04ae('0x0'));var util=require(_0x04ae('0x1'));var path=require('path');var timeout=require(_0x04ae('0x2'));var express=require(_0x04ae('0x3'));var router=express[_0x04ae('0x4')]();var auth=require(_0x04ae('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x04ae('0x6'));var controller=require(_0x04ae('0x7'));router[_0x04ae('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x04ae('0x8')](_0x04ae('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x04ae('0x8')](_0x04ae('0xa'),auth['isAuthenticated'](),controller[_0x04ae('0xb')]);router[_0x04ae('0xc')]('/',auth['isAuthenticated'](),controller[_0x04ae('0xd')]);router['put'](_0x04ae('0xa'),auth['isAuthenticated'](),controller[_0x04ae('0xe')]);router[_0x04ae('0xf')](_0x04ae('0xa'),auth['isAuthenticated'](),controller[_0x04ae('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index edc523e..780977d 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 _0x8f9a=['TEXT','long','exports','STRING'];(function(_0x1de86c,_0x289056){var _0x3cb807=function(_0x51b9fa){while(--_0x51b9fa){_0x1de86c['push'](_0x1de86c['shift']());}};_0x3cb807(++_0x289056);}(_0x8f9a,0x66));var _0xa8f9=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0x8f9a[_0x4d6ac0];return _0x5296c4;};'use strict';var Sequelize=require('sequelize');module[_0xa8f9('0x0')]={'question':{'type':Sequelize[_0xa8f9('0x1')]},'answer':{'type':Sequelize[_0xa8f9('0x2')](_0xa8f9('0x3'))},'membername':{'type':Sequelize[_0xa8f9('0x1')]},'projectname':{'type':Sequelize[_0xa8f9('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xa8f9('0x1')]},'calleridname':{'type':Sequelize[_0xa8f9('0x1')]},'calleridnum':{'type':Sequelize[_0xa8f9('0x1')]},'questionId':{'type':Sequelize[_0xa8f9('0x1')]}}; \ No newline at end of file +var _0x3f31=['STRING','TEXT','long','sequelize','exports'];(function(_0x586e64,_0x4e6f01){var _0x3e237c=function(_0x2f0ece){while(--_0x2f0ece){_0x586e64['push'](_0x586e64['shift']());}};_0x3e237c(++_0x4e6f01);}(_0x3f31,0xb7));var _0x13f3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3f31[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x13f3('0x0'));module[_0x13f3('0x1')]={'question':{'type':Sequelize[_0x13f3('0x2')]},'answer':{'type':Sequelize[_0x13f3('0x3')](_0x13f3('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x13f3('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x13f3('0x2')]},'calleridnum':{'type':Sequelize[_0x13f3('0x2')]},'questionId':{'type':Sequelize[_0x13f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index d54f1dc..355dfa8 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 _0x5c51=['../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','intersection','attributes','length','hasOwnProperty','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','JscriptyAnswerReport','findAll','rows','catch','show','params','keys','fields','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0xb624c8,_0x4517d5){var _0x5f4743=function(_0x3881cb){while(--_0x3881cb){_0xb624c8['push'](_0xb624c8['shift']());}};_0x5f4743(++_0x4517d5);}(_0x5c51,0x108));var _0x15c5=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0x5c51[_0xe30e17];return _0x2342c9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x15c5('0x0'));var rimraf=require(_0x15c5('0x1'));var zipdir=require(_0x15c5('0x2'));var jsonpatch=require(_0x15c5('0x3'));var rp=require('request-promise');var moment=require(_0x15c5('0x4'));var BPromise=require(_0x15c5('0x5'));var Mustache=require('mustache');var util=require(_0x15c5('0x6'));var path=require(_0x15c5('0x7'));var sox=require(_0x15c5('0x8'));var csv=require(_0x15c5('0x9'));var ejs=require(_0x15c5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x15c5('0xb'));var crypto=require('crypto');var jsforce=require(_0x15c5('0xc'));var deskjs=require(_0x15c5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x15c5('0xe'));var Papa=require(_0x15c5('0xf'));var Redis=require(_0x15c5('0x10'));var authService=require(_0x15c5('0x11'));var qs=require(_0x15c5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15c5('0x13'));var logger=require(_0x15c5('0x14'))(_0x15c5('0x15'));var utils=require('../../config/utils');var config=require(_0x15c5('0x16'));var licenseUtil=require(_0x15c5('0x17'));var db=require(_0x15c5('0x18'))['db'];function respondWithStatusCode(_0x41c53b,_0x24f214){_0x24f214=_0x24f214||0xcc;return function(_0x4870f0){if(_0x4870f0){return _0x41c53b[_0x15c5('0x19')](_0x24f214);}return _0x41c53b[_0x15c5('0x1a')](_0x24f214)[_0x15c5('0x1b')]();};}function respondWithResult(_0x491227,_0xf10a73){_0xf10a73=_0xf10a73||0xc8;return function(_0x4b2b96){if(_0x4b2b96){return _0x491227[_0x15c5('0x1a')](_0xf10a73)['json'](_0x4b2b96);}};}function respondWithFilteredResult(_0x283f11,_0x146fad){return function(_0x514600){if(_0x514600){var _0x95633a=_0x514600[_0x15c5('0x1c')],_0x4f64b0=_0x146fad[_0x15c5('0x1d')],_0x1ee862=_0x146fad[_0x15c5('0x1d')]+_0x146fad[_0x15c5('0x1e')],_0x4a1c51;if(_0x1ee862>=_0x95633a){_0x1ee862=_0x95633a;_0x4a1c51=0xc8;}else{_0x4a1c51=0xce;}_0x283f11[_0x15c5('0x1a')](_0x4a1c51);return _0x283f11[_0x15c5('0x1f')](_0x15c5('0x20'),_0x4f64b0+'-'+_0x1ee862+'/'+_0x95633a)['json'](_0x514600);}return null;};}function patchUpdates(_0xb8ca74){return function(_0x4b4d11){try{jsonpatch['apply'](_0x4b4d11,_0xb8ca74,!![]);}catch(_0x96cecf){return BPromise['reject'](_0x96cecf);}return _0x4b4d11[_0x15c5('0x21')]();};}function saveUpdates(_0x57c0f5,_0x16fbaf){return function(_0x3fbb5e){if(_0x3fbb5e){return _0x3fbb5e[_0x15c5('0x22')](_0x57c0f5)[_0x15c5('0x23')](function(_0x2e514c){return _0x2e514c;});}return null;};}function removeEntity(_0x3d62a5,_0x50623e){return function(_0x5e4e21){if(_0x5e4e21){return _0x5e4e21[_0x15c5('0x24')]()['then'](function(){_0x3d62a5[_0x15c5('0x1a')](0xcc)[_0x15c5('0x1b')]();});}};}function handleEntityNotFound(_0x30ed09,_0x34b7df){return function(_0x4bb87e){if(!_0x4bb87e){_0x30ed09[_0x15c5('0x19')](0x194);}return _0x4bb87e;};}function handleError(_0x5ad52b,_0x15fc3b){_0x15fc3b=_0x15fc3b||0x1f4;return function(_0x21dac1){logger[_0x15c5('0x25')](_0x21dac1[_0x15c5('0x26')]);if(_0x21dac1[_0x15c5('0x27')]){delete _0x21dac1[_0x15c5('0x27')];}_0x5ad52b[_0x15c5('0x1a')](_0x15fc3b)['send'](_0x21dac1);};}exports[_0x15c5('0x28')]=function(_0x7cdb4e,_0x18078e){var _0x1d3560={},_0x750c2b={},_0x3b560c={'count':0x0,'rows':[]};var _0x5f0aa9=_['map'](db['JscriptyAnswerReport'][_0x15c5('0x29')],function(_0x4a3e67){return{'name':_0x4a3e67[_0x15c5('0x2a')],'type':_0x4a3e67[_0x15c5('0x2b')]['key']};});_0x750c2b[_0x15c5('0x2c')]=_[_0x15c5('0x2d')](_0x5f0aa9,_0x15c5('0x27'));_0x750c2b[_0x15c5('0x2e')]=_['keys'](_0x7cdb4e[_0x15c5('0x2e')]);_0x750c2b['filters']=_[_0x15c5('0x2f')](_0x750c2b[_0x15c5('0x2c')],_0x750c2b[_0x15c5('0x2e')]);_0x1d3560[_0x15c5('0x30')]=_['intersection'](_0x750c2b[_0x15c5('0x2c')],qs['fields'](_0x7cdb4e[_0x15c5('0x2e')]['fields']));_0x1d3560[_0x15c5('0x30')]=_0x1d3560[_0x15c5('0x30')][_0x15c5('0x31')]?_0x1d3560[_0x15c5('0x30')]:_0x750c2b[_0x15c5('0x2c')];if(!_0x7cdb4e[_0x15c5('0x2e')][_0x15c5('0x32')]('nolimit')){_0x1d3560[_0x15c5('0x1e')]=qs[_0x15c5('0x1e')](_0x7cdb4e['query'][_0x15c5('0x1e')]);_0x1d3560[_0x15c5('0x1d')]=qs[_0x15c5('0x1d')](_0x7cdb4e[_0x15c5('0x2e')][_0x15c5('0x1d')]);}_0x1d3560['order']=qs['sort'](_0x7cdb4e[_0x15c5('0x2e')][_0x15c5('0x33')]);_0x1d3560['where']=qs[_0x15c5('0x34')](_[_0x15c5('0x35')](_0x7cdb4e[_0x15c5('0x2e')],_0x750c2b[_0x15c5('0x34')]),_0x5f0aa9);if(_0x7cdb4e['query']['filter']){_0x1d3560[_0x15c5('0x36')]=_[_0x15c5('0x37')](_0x1d3560['where'],{'$or':_[_0x15c5('0x2d')](_0x5f0aa9,function(_0x4aaebf){if(_0x4aaebf[_0x15c5('0x2b')]!==_0x15c5('0x38')){var _0x3cfd44={};_0x3cfd44[_0x4aaebf[_0x15c5('0x27')]]={'$like':'%'+_0x7cdb4e[_0x15c5('0x2e')]['filter']+'%'};return _0x3cfd44;}})});}_0x1d3560=_[_0x15c5('0x37')]({},_0x1d3560,_0x7cdb4e[_0x15c5('0x39')]);var _0x1f27d4={'where':_0x1d3560[_0x15c5('0x36')]};return db['JscriptyAnswerReport'][_0x15c5('0x1c')](_0x1f27d4)[_0x15c5('0x23')](function(_0x49a98a){_0x3b560c[_0x15c5('0x1c')]=_0x49a98a;if(_0x7cdb4e[_0x15c5('0x2e')][_0x15c5('0x3a')]){_0x1d3560['include']=[{'all':!![]}];}return db[_0x15c5('0x3b')][_0x15c5('0x3c')](_0x1d3560);})[_0x15c5('0x23')](function(_0x558b4a){_0x3b560c[_0x15c5('0x3d')]=_0x558b4a;return _0x3b560c;})[_0x15c5('0x23')](respondWithFilteredResult(_0x18078e,_0x1d3560))[_0x15c5('0x3e')](handleError(_0x18078e,null));};exports[_0x15c5('0x3f')]=function(_0x65f054,_0x29e9f5){var _0x45026f={'raw':!![],'where':{'id':_0x65f054[_0x15c5('0x40')]['id']}},_0x1bf855={};_0x1bf855['model']=_[_0x15c5('0x41')](db[_0x15c5('0x3b')][_0x15c5('0x29')]);_0x1bf855[_0x15c5('0x2e')]=_['keys'](_0x65f054[_0x15c5('0x2e')]);_0x1bf855[_0x15c5('0x34')]=_[_0x15c5('0x2f')](_0x1bf855[_0x15c5('0x2c')],_0x1bf855['query']);_0x45026f['attributes']=_[_0x15c5('0x2f')](_0x1bf855[_0x15c5('0x2c')],qs[_0x15c5('0x42')](_0x65f054['query'][_0x15c5('0x42')]));_0x45026f[_0x15c5('0x30')]=_0x45026f[_0x15c5('0x30')][_0x15c5('0x31')]?_0x45026f['attributes']:_0x1bf855[_0x15c5('0x2c')];if(_0x65f054[_0x15c5('0x2e')][_0x15c5('0x3a')]){_0x45026f[_0x15c5('0x43')]=[{'all':!![]}];}_0x45026f=_[_0x15c5('0x37')]({},_0x45026f,_0x65f054[_0x15c5('0x39')]);return db[_0x15c5('0x3b')][_0x15c5('0x44')](_0x45026f)['then'](handleEntityNotFound(_0x29e9f5,null))[_0x15c5('0x23')](respondWithResult(_0x29e9f5,null))['catch'](handleError(_0x29e9f5,null));};exports[_0x15c5('0x45')]=function(_0xff3a88,_0x36455a){return db[_0x15c5('0x3b')][_0x15c5('0x45')](_0xff3a88['body'],{})[_0x15c5('0x23')](respondWithResult(_0x36455a,0xc9))[_0x15c5('0x3e')](handleError(_0x36455a,null));};exports[_0x15c5('0x22')]=function(_0x4014b4,_0x5d83ff){if(_0x4014b4[_0x15c5('0x46')]['id']){delete _0x4014b4[_0x15c5('0x46')]['id'];}return db[_0x15c5('0x3b')]['find']({'where':{'id':_0x4014b4[_0x15c5('0x40')]['id']}})[_0x15c5('0x23')](handleEntityNotFound(_0x5d83ff,null))[_0x15c5('0x23')](saveUpdates(_0x4014b4[_0x15c5('0x46')],null))['then'](respondWithResult(_0x5d83ff,null))['catch'](handleError(_0x5d83ff,null));};exports['destroy']=function(_0x51f225,_0xb9b55f){return db['JscriptyAnswerReport'][_0x15c5('0x44')]({'where':{'id':_0x51f225['params']['id']}})['then'](handleEntityNotFound(_0xb9b55f,null))[_0x15c5('0x23')](removeEntity(_0xb9b55f,null))['catch'](handleError(_0xb9b55f,null));};exports[_0x15c5('0x47')]=function(_0xdbfdd0,_0x169d76){return db[_0x15c5('0x3b')][_0x15c5('0x47')]()[_0x15c5('0x23')](respondWithResult(_0x169d76,null))[_0x15c5('0x3e')](handleError(_0x169d76,null));}; \ No newline at end of file +var _0xeaa5=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','error','name','send','map','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0xeaa5,0x8c));var _0x5eaa=function(_0x5965f6,_0x2f5e6b){_0x5965f6=_0x5965f6-0x0;var _0x3528a9=_0xeaa5[_0x5965f6];return _0x3528a9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5eaa('0x0'));var rimraf=require(_0x5eaa('0x1'));var zipdir=require(_0x5eaa('0x2'));var jsonpatch=require(_0x5eaa('0x3'));var rp=require(_0x5eaa('0x4'));var moment=require(_0x5eaa('0x5'));var BPromise=require(_0x5eaa('0x6'));var Mustache=require(_0x5eaa('0x7'));var util=require(_0x5eaa('0x8'));var path=require(_0x5eaa('0x9'));var sox=require(_0x5eaa('0xa'));var csv=require(_0x5eaa('0xb'));var ejs=require(_0x5eaa('0xc'));var fs=require('fs');var _=require(_0x5eaa('0xd'));var squel=require(_0x5eaa('0xe'));var crypto=require(_0x5eaa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5eaa('0x10'));var toCsv=require(_0x5eaa('0xb'));var querystring=require(_0x5eaa('0x11'));var Papa=require(_0x5eaa('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5eaa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5eaa('0x14'));var utils=require(_0x5eaa('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5eaa('0x16'));var db=require(_0x5eaa('0x17'))['db'];function respondWithStatusCode(_0x39a5a9,_0x54fb0a){_0x54fb0a=_0x54fb0a||0xcc;return function(_0x417e4b){if(_0x417e4b){return _0x39a5a9[_0x5eaa('0x18')](_0x54fb0a);}return _0x39a5a9['status'](_0x54fb0a)[_0x5eaa('0x19')]();};}function respondWithResult(_0x3e9c84,_0x35367b){_0x35367b=_0x35367b||0xc8;return function(_0x453352){if(_0x453352){return _0x3e9c84[_0x5eaa('0x1a')](_0x35367b)[_0x5eaa('0x1b')](_0x453352);}};}function respondWithFilteredResult(_0x5ad536,_0x3fa346){return function(_0x22b7c1){if(_0x22b7c1){var _0x515cc0=_0x22b7c1[_0x5eaa('0x1c')],_0x146334=_0x3fa346['offset'],_0x3e15a9=_0x3fa346[_0x5eaa('0x1d')]+_0x3fa346[_0x5eaa('0x1e')],_0xcd1f2a;if(_0x3e15a9>=_0x515cc0){_0x3e15a9=_0x515cc0;_0xcd1f2a=0xc8;}else{_0xcd1f2a=0xce;}_0x5ad536[_0x5eaa('0x1a')](_0xcd1f2a);return _0x5ad536['set'](_0x5eaa('0x1f'),_0x146334+'-'+_0x3e15a9+'/'+_0x515cc0)[_0x5eaa('0x1b')](_0x22b7c1);}return null;};}function patchUpdates(_0x1c6c8b){return function(_0xa8b9d7){try{jsonpatch[_0x5eaa('0x20')](_0xa8b9d7,_0x1c6c8b,!![]);}catch(_0x59a100){return BPromise['reject'](_0x59a100);}return _0xa8b9d7[_0x5eaa('0x21')]();};}function saveUpdates(_0xc8444d,_0x28fc42){return function(_0x4b5447){if(_0x4b5447){return _0x4b5447[_0x5eaa('0x22')](_0xc8444d)[_0x5eaa('0x23')](function(_0x2c500e){return _0x2c500e;});}return null;};}function removeEntity(_0x1ad8d5,_0xe4cb44){return function(_0x173e8a){if(_0x173e8a){return _0x173e8a[_0x5eaa('0x24')]()[_0x5eaa('0x23')](function(){_0x1ad8d5[_0x5eaa('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x263031,_0x47a7ac){return function(_0x12b9bf){if(!_0x12b9bf){_0x263031[_0x5eaa('0x18')](0x194);}return _0x12b9bf;};}function handleError(_0x25b0db,_0x27834d){_0x27834d=_0x27834d||0x1f4;return function(_0x5930f7){logger[_0x5eaa('0x25')](_0x5930f7['stack']);if(_0x5930f7[_0x5eaa('0x26')]){delete _0x5930f7['name'];}_0x25b0db[_0x5eaa('0x1a')](_0x27834d)[_0x5eaa('0x27')](_0x5930f7);};}exports['index']=function(_0x2a7ffd,_0x27f1bb){var _0x331ff0={},_0x165bb0={},_0x1cfec7={'count':0x0,'rows':[]};var _0x5a1881=_[_0x5eaa('0x28')](db[_0x5eaa('0x29')][_0x5eaa('0x2a')],function(_0x4ff696){return{'name':_0x4ff696['fieldName'],'type':_0x4ff696[_0x5eaa('0x2b')][_0x5eaa('0x2c')]};});_0x165bb0[_0x5eaa('0x2d')]=_[_0x5eaa('0x28')](_0x5a1881,_0x5eaa('0x26'));_0x165bb0[_0x5eaa('0x2e')]=_[_0x5eaa('0x2f')](_0x2a7ffd[_0x5eaa('0x2e')]);_0x165bb0[_0x5eaa('0x30')]=_[_0x5eaa('0x31')](_0x165bb0[_0x5eaa('0x2d')],_0x165bb0[_0x5eaa('0x2e')]);_0x331ff0[_0x5eaa('0x32')]=_[_0x5eaa('0x31')](_0x165bb0['model'],qs[_0x5eaa('0x33')](_0x2a7ffd[_0x5eaa('0x2e')][_0x5eaa('0x33')]));_0x331ff0[_0x5eaa('0x32')]=_0x331ff0['attributes'][_0x5eaa('0x34')]?_0x331ff0[_0x5eaa('0x32')]:_0x165bb0[_0x5eaa('0x2d')];if(!_0x2a7ffd['query'][_0x5eaa('0x35')](_0x5eaa('0x36'))){_0x331ff0['limit']=qs[_0x5eaa('0x1e')](_0x2a7ffd[_0x5eaa('0x2e')]['limit']);_0x331ff0[_0x5eaa('0x1d')]=qs[_0x5eaa('0x1d')](_0x2a7ffd[_0x5eaa('0x2e')][_0x5eaa('0x1d')]);}_0x331ff0[_0x5eaa('0x37')]=qs['sort'](_0x2a7ffd['query'][_0x5eaa('0x38')]);_0x331ff0[_0x5eaa('0x39')]=qs[_0x5eaa('0x30')](_[_0x5eaa('0x3a')](_0x2a7ffd['query'],_0x165bb0['filters']),_0x5a1881);if(_0x2a7ffd[_0x5eaa('0x2e')][_0x5eaa('0x3b')]){_0x331ff0[_0x5eaa('0x39')]=_['merge'](_0x331ff0[_0x5eaa('0x39')],{'$or':_[_0x5eaa('0x28')](_0x5a1881,function(_0x2ae9cf){if(_0x2ae9cf[_0x5eaa('0x2b')]!==_0x5eaa('0x3c')){var _0x2717a8={};_0x2717a8[_0x2ae9cf['name']]={'$like':'%'+_0x2a7ffd['query'][_0x5eaa('0x3b')]+'%'};return _0x2717a8;}})});}_0x331ff0=_['merge']({},_0x331ff0,_0x2a7ffd[_0x5eaa('0x3d')]);var _0x5ecd27={'where':_0x331ff0[_0x5eaa('0x39')]};return db[_0x5eaa('0x29')]['count'](_0x5ecd27)['then'](function(_0x5dfa89){_0x1cfec7['count']=_0x5dfa89;if(_0x2a7ffd[_0x5eaa('0x2e')][_0x5eaa('0x3e')]){_0x331ff0[_0x5eaa('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x331ff0);})[_0x5eaa('0x23')](function(_0x40167c){_0x1cfec7[_0x5eaa('0x40')]=_0x40167c;return _0x1cfec7;})['then'](respondWithFilteredResult(_0x27f1bb,_0x331ff0))[_0x5eaa('0x41')](handleError(_0x27f1bb,null));};exports[_0x5eaa('0x42')]=function(_0x1b9d95,_0x59c84c){var _0x496e67={'raw':!![],'where':{'id':_0x1b9d95[_0x5eaa('0x43')]['id']}},_0x5e014c={};_0x5e014c['model']=_[_0x5eaa('0x2f')](db['JscriptyAnswerReport'][_0x5eaa('0x2a')]);_0x5e014c['query']=_[_0x5eaa('0x2f')](_0x1b9d95[_0x5eaa('0x2e')]);_0x5e014c['filters']=_[_0x5eaa('0x31')](_0x5e014c[_0x5eaa('0x2d')],_0x5e014c[_0x5eaa('0x2e')]);_0x496e67[_0x5eaa('0x32')]=_[_0x5eaa('0x31')](_0x5e014c[_0x5eaa('0x2d')],qs[_0x5eaa('0x33')](_0x1b9d95[_0x5eaa('0x2e')][_0x5eaa('0x33')]));_0x496e67[_0x5eaa('0x32')]=_0x496e67[_0x5eaa('0x32')][_0x5eaa('0x34')]?_0x496e67[_0x5eaa('0x32')]:_0x5e014c[_0x5eaa('0x2d')];if(_0x1b9d95[_0x5eaa('0x2e')][_0x5eaa('0x3e')]){_0x496e67[_0x5eaa('0x3f')]=[{'all':!![]}];}_0x496e67=_[_0x5eaa('0x44')]({},_0x496e67,_0x1b9d95[_0x5eaa('0x3d')]);return db[_0x5eaa('0x29')]['find'](_0x496e67)[_0x5eaa('0x23')](handleEntityNotFound(_0x59c84c,null))[_0x5eaa('0x23')](respondWithResult(_0x59c84c,null))[_0x5eaa('0x41')](handleError(_0x59c84c,null));};exports[_0x5eaa('0x45')]=function(_0x304c9e,_0x2ab63c){return db['JscriptyAnswerReport']['create'](_0x304c9e[_0x5eaa('0x46')],{})[_0x5eaa('0x23')](respondWithResult(_0x2ab63c,0xc9))[_0x5eaa('0x41')](handleError(_0x2ab63c,null));};exports[_0x5eaa('0x22')]=function(_0xb7ea1a,_0x18f9ce){if(_0xb7ea1a[_0x5eaa('0x46')]['id']){delete _0xb7ea1a[_0x5eaa('0x46')]['id'];}return db['JscriptyAnswerReport'][_0x5eaa('0x47')]({'where':{'id':_0xb7ea1a[_0x5eaa('0x43')]['id']}})[_0x5eaa('0x23')](handleEntityNotFound(_0x18f9ce,null))[_0x5eaa('0x23')](saveUpdates(_0xb7ea1a[_0x5eaa('0x46')],null))[_0x5eaa('0x23')](respondWithResult(_0x18f9ce,null))['catch'](handleError(_0x18f9ce,null));};exports['destroy']=function(_0x343cbc,_0x1245ee){return db[_0x5eaa('0x29')][_0x5eaa('0x47')]({'where':{'id':_0x343cbc[_0x5eaa('0x43')]['id']}})['then'](handleEntityNotFound(_0x1245ee,null))[_0x5eaa('0x23')](removeEntity(_0x1245ee,null))[_0x5eaa('0x41')](handleError(_0x1245ee,null));};exports[_0x5eaa('0x48')]=function(_0x1c621f,_0x23d78f){return db[_0x5eaa('0x29')]['describe']()[_0x5eaa('0x23')](respondWithResult(_0x23d78f,null))[_0x5eaa('0x41')](handleError(_0x23d78f,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9eb7fe5..04df5d8 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 _0x4e7b=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','report_jscripty_answers'];(function(_0x4a0763,_0x56c9f3){var _0x1475c9=function(_0x225f37){while(--_0x225f37){_0x4a0763['push'](_0x4a0763['shift']());}};_0x1475c9(++_0x56c9f3);}(_0x4e7b,0xe7));var _0xb4e7=function(_0x55bc85,_0x279f6d){_0x55bc85=_0x55bc85-0x0;var _0x41e2ae=_0x4e7b[_0x55bc85];return _0x41e2ae;};'use strict';var _=require(_0xb4e7('0x0'));var util=require(_0xb4e7('0x1'));var logger=require(_0xb4e7('0x2'))(_0xb4e7('0x3'));var moment=require('moment');var BPromise=require(_0xb4e7('0x4'));var rp=require(_0xb4e7('0x5'));var fs=require('fs');var path=require(_0xb4e7('0x6'));var rimraf=require(_0xb4e7('0x7'));var config=require(_0xb4e7('0x8'));var attributes=require(_0xb4e7('0x9'));module['exports']=function(_0x149a0a,_0x56d877){return _0x149a0a['define']('JscriptyAnswerReport',attributes,{'tableName':_0xb4e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa169=['moment','bluebird','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util'];(function(_0x209431,_0x4e42e9){var _0xb8c2a1=function(_0x16411e){while(--_0x16411e){_0x209431['push'](_0x209431['shift']());}};_0xb8c2a1(++_0x4e42e9);}(_0xa169,0x1ed));var _0x9a16=function(_0x5ce94b,_0x4e19aa){_0x5ce94b=_0x5ce94b-0x0;var _0x242cf5=_0xa169[_0x5ce94b];return _0x242cf5;};'use strict';var _=require(_0x9a16('0x0'));var util=require(_0x9a16('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9a16('0x2'));var BPromise=require(_0x9a16('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9a16('0x4'));var attributes=require(_0x9a16('0x5'));module['exports']=function(_0x3c775f,_0x515526){return _0x3c775f[_0x9a16('0x6')](_0x9a16('0x7'),attributes,{'tableName':_0x9a16('0x8'),'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 221815d..07daa14 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 _0x0f1a=['request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x50890a,_0x3f4250){var _0x4579b6=function(_0x2538da){while(--_0x2538da){_0x50890a['push'](_0x50890a['shift']());}};_0x4579b6(++_0x3f4250);}(_0x0f1a,0x171));var _0xa0f1=function(_0x42c175,_0x4011b7){_0x42c175=_0x42c175-0x0;var _0x45e1c5=_0x0f1a[_0x42c175];return _0x45e1c5;};'use strict';var _=require(_0xa0f1('0x0'));var util=require(_0xa0f1('0x1'));var moment=require(_0xa0f1('0x2'));var BPromise=require(_0xa0f1('0x3'));var rs=require(_0xa0f1('0x4'));var fs=require('fs');var Redis=require(_0xa0f1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa0f1('0x6'));var logger=require(_0xa0f1('0x7'))(_0xa0f1('0x8'));var config=require(_0xa0f1('0x9'));var jayson=require(_0xa0f1('0xa'));var client=jayson[_0xa0f1('0xb')][_0xa0f1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1aaa5a,_0x4f2588,_0x447eda){return new BPromise(function(_0x30bff4,_0x1fbeb5){return client[_0xa0f1('0xd')](_0x1aaa5a,_0x447eda)['then'](function(_0x52bb89){logger[_0xa0f1('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f2588,_0xa0f1('0xf'));logger['debug'](_0xa0f1('0x10'),_0x4f2588,_0xa0f1('0xf'),JSON[_0xa0f1('0x11')](_0x52bb89));if(_0x52bb89[_0xa0f1('0x12')]){if(_0x52bb89[_0xa0f1('0x12')][_0xa0f1('0x13')]===0x1f4){logger[_0xa0f1('0x12')](_0xa0f1('0x14'),_0x4f2588,_0x52bb89[_0xa0f1('0x12')]['message']);return _0x1fbeb5(_0x52bb89[_0xa0f1('0x12')][_0xa0f1('0x15')]);}logger[_0xa0f1('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f2588,_0x52bb89[_0xa0f1('0x12')]['message']);return _0x30bff4(_0x52bb89['error'][_0xa0f1('0x15')]);}else{logger[_0xa0f1('0xe')](_0xa0f1('0x14'),_0x4f2588,_0xa0f1('0xf'));_0x30bff4(_0x52bb89[_0xa0f1('0x16')][_0xa0f1('0x15')]);}})[_0xa0f1('0x17')](function(_0x2cddd7){logger['error'](_0xa0f1('0x14'),_0x4f2588,_0x2cddd7);_0x1fbeb5(_0x2cddd7);});});} \ No newline at end of file +var _0x548a=['rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x548a,0x1dd));var _0xa548=function(_0x39bc56,_0x2979cd){_0x39bc56=_0x39bc56-0x0;var _0x2eb196=_0x548a[_0x39bc56];return _0x2eb196;};'use strict';var _=require('lodash');var util=require(_0xa548('0x0'));var moment=require('moment');var BPromise=require(_0xa548('0x1'));var rs=require(_0xa548('0x2'));var fs=require('fs');var Redis=require(_0xa548('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa548('0x4'));var logger=require(_0xa548('0x5'))(_0xa548('0x6'));var config=require(_0xa548('0x7'));var jayson=require(_0xa548('0x8'));var client=jayson[_0xa548('0x9')][_0xa548('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5783c0,_0x766b26,_0x259bd3){return new BPromise(function(_0x5a0799,_0x30546d){return client[_0xa548('0xb')](_0x5783c0,_0x259bd3)[_0xa548('0xc')](function(_0x25793f){logger['info'](_0xa548('0xd'),_0x766b26,'request\x20sent');logger[_0xa548('0xe')](_0xa548('0xf'),_0x766b26,_0xa548('0x10'),JSON[_0xa548('0x11')](_0x25793f));if(_0x25793f[_0xa548('0x12')]){if(_0x25793f[_0xa548('0x12')]['code']===0x1f4){logger[_0xa548('0x12')](_0xa548('0xd'),_0x766b26,_0x25793f[_0xa548('0x12')][_0xa548('0x13')]);return _0x30546d(_0x25793f[_0xa548('0x12')][_0xa548('0x13')]);}logger['error'](_0xa548('0xd'),_0x766b26,_0x25793f['error'][_0xa548('0x13')]);return _0x5a0799(_0x25793f[_0xa548('0x12')]['message']);}else{logger[_0xa548('0x14')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x766b26,_0xa548('0x10'));_0x5a0799(_0x25793f[_0xa548('0x15')][_0xa548('0x13')]);}})[_0xa548('0x16')](function(_0x57b14f){logger[_0xa548('0x12')](_0xa548('0xd'),_0x766b26,_0x57b14f);_0x30546d(_0x57b14f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index d977f84..c1d8393 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 _0x9af0=['isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','create','post','/:id/clone','clone','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9af0,0xd9));var _0x09af=function(_0x43a672,_0x1efe75){_0x43a672=_0x43a672-0x0;var _0x3e96e9=_0x9af0[_0x43a672];return _0x3e96e9;};'use strict';var multer=require(_0x09af('0x0'));var util=require(_0x09af('0x1'));var path=require(_0x09af('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x09af('0x3')]();var auth=require(_0x09af('0x4'));var interaction=require(_0x09af('0x5'));var config=require('../../config/environment');var controller=require(_0x09af('0x6'));router[_0x09af('0x7')]('/',auth[_0x09af('0x8')](),controller['index']);router['get'](_0x09af('0x9'),auth[_0x09af('0x8')](),controller[_0x09af('0xa')]);router['get'](_0x09af('0xb'),auth[_0x09af('0x8')](),controller[_0x09af('0xc')]);router[_0x09af('0x7')](_0x09af('0xd'),auth[_0x09af('0x8')](),controller[_0x09af('0xe')]);router[_0x09af('0x7')](_0x09af('0xf'),auth[_0x09af('0x8')](),timeout('30s'),controller[_0x09af('0x10')]);router['post']('/',auth[_0x09af('0x8')](),controller[_0x09af('0x11')]);router[_0x09af('0x12')](_0x09af('0x13'),auth[_0x09af('0x8')](),controller[_0x09af('0x14')]);router['put'](_0x09af('0x9'),auth['isAuthenticated'](),controller[_0x09af('0x15')]);router[_0x09af('0x16')](_0x09af('0x9'),auth['isAuthenticated'](),controller[_0x09af('0x17')]);module[_0x09af('0x18')]=router; \ No newline at end of file +var _0x3e5a=['delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/sessions','getSessions','30s','getSummary','create','/:id/clone','clone','/:id'];(function(_0x4d8467,_0x3ef8cf){var _0x20da5e=function(_0x250276){while(--_0x250276){_0x4d8467['push'](_0x4d8467['shift']());}};_0x20da5e(++_0x3ef8cf);}(_0x3e5a,0x12e));var _0xa3e5=function(_0x59a71d,_0x54ad0e){_0x59a71d=_0x59a71d-0x0;var _0x1031ad=_0x3e5a[_0x59a71d];return _0x1031ad;};'use strict';var multer=require(_0xa3e5('0x0'));var util=require('util');var path=require(_0xa3e5('0x1'));var timeout=require(_0xa3e5('0x2'));var express=require(_0xa3e5('0x3'));var router=express[_0xa3e5('0x4')]();var auth=require(_0xa3e5('0x5'));var interaction=require(_0xa3e5('0x6'));var config=require(_0xa3e5('0x7'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0xa3e5('0x8')](),controller[_0xa3e5('0x9')]);router[_0xa3e5('0xa')]('/:id',auth[_0xa3e5('0x8')](),controller[_0xa3e5('0xb')]);router[_0xa3e5('0xa')](_0xa3e5('0xc'),auth[_0xa3e5('0x8')](),controller[_0xa3e5('0xd')]);router[_0xa3e5('0xa')]('/:id/answers',auth[_0xa3e5('0x8')](),controller['getAnswers']);router['get']('/:id/summary',auth[_0xa3e5('0x8')](),timeout(_0xa3e5('0xe')),controller[_0xa3e5('0xf')]);router['post']('/',auth[_0xa3e5('0x8')](),controller[_0xa3e5('0x10')]);router['post'](_0xa3e5('0x11'),auth['isAuthenticated'](),controller[_0xa3e5('0x12')]);router['put'](_0xa3e5('0x13'),auth[_0xa3e5('0x8')](),controller['update']);router[_0xa3e5('0x14')](_0xa3e5('0x13'),auth[_0xa3e5('0x8')](),controller[_0xa3e5('0x15')]);module[_0xa3e5('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 5c37764..60cd727 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 _0xf548=['isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','isObjectLike','setDataValue','formData','stringify'];(function(_0x50e0b4,_0x1057f7){var _0x2fa8b0=function(_0x3766bc){while(--_0x3766bc){_0x50e0b4['push'](_0x50e0b4['shift']());}};_0x2fa8b0(++_0x1057f7);}(_0xf548,0x17d));var _0x8f54=function(_0x119280,_0x439c3e){_0x119280=_0x119280-0x0;var _0x481797=_0xf548[_0x119280];return _0x481797;};'use strict';var Sequelize=require(_0x8f54('0x0'));var _=require(_0x8f54('0x1'));var util=require(_0x8f54('0x2'));module['exports']={'name':{'type':Sequelize[_0x8f54('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x8f54('0x3')]},'formData':{'type':Sequelize[_0x8f54('0x4')]('long'),'set':function(_0x386d70){if(_[_0x8f54('0x5')](_0x386d70)){this[_0x8f54('0x6')](_0x8f54('0x7'),JSON[_0x8f54('0x8')](_0x386d70));}else if(_[_0x8f54('0x9')](_0x386d70)){this['setDataValue']('formData',_0x386d70);}else{this['setDataValue']('formData',util['format'](_0x8f54('0xa'),this[_0x8f54('0xb')](_0x8f54('0xc'))||'',this[_0x8f54('0xb')](_0x8f54('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8f54('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0xfadf=['setDataValue','formData','stringify','isString','format','getDataValue','BOOLEAN','util','exports','STRING','name','long','isObjectLike'];(function(_0x562071,_0x57a342){var _0x45db81=function(_0x3be628){while(--_0x3be628){_0x562071['push'](_0x562071['shift']());}};_0x45db81(++_0x57a342);}(_0xfadf,0x89));var _0xffad=function(_0x267ce2,_0x16d394){_0x267ce2=_0x267ce2-0x0;var _0xcefe7=_0xfadf[_0x267ce2];return _0xcefe7;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0xffad('0x0'));module[_0xffad('0x1')]={'name':{'type':Sequelize[_0xffad('0x2')],'unique':_0xffad('0x3')},'description':{'type':Sequelize[_0xffad('0x2')]},'formData':{'type':Sequelize['TEXT'](_0xffad('0x4')),'set':function(_0x2dd05b){if(_[_0xffad('0x5')](_0x2dd05b)){this[_0xffad('0x6')](_0xffad('0x7'),JSON[_0xffad('0x8')](_0x2dd05b));}else if(_[_0xffad('0x9')](_0x2dd05b)){this[_0xffad('0x6')](_0xffad('0x7'),_0x2dd05b);}else{this['setDataValue'](_0xffad('0x7'),util[_0xffad('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xffad('0xb')]('name')||'',this[_0xffad('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xffad('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index d3db8b3..2c7d56c 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 _0x239b=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','reject','update','destroy','then','Projects','UserProfileResource','end','error','name','send','index','JscriptyProject','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','createdAt','updatedAt','omit','get','autoAssociation','getSessions','JscriptySessionReport','order','ProjectId','getAnswers','JscriptyAnswerReport','apply','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xcb1edb,_0x8f174d){var _0x189403=function(_0x31439d){while(--_0x31439d){_0xcb1edb['push'](_0xcb1edb['shift']());}};_0x189403(++_0x8f174d);}(_0x239b,0xd2));var _0xb239=function(_0x361fb0,_0x54f042){_0x361fb0=_0x361fb0-0x0;var _0x5183e9=_0x239b[_0x361fb0];return _0x5183e9;};'use strict';var pdf=require(_0xb239('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb239('0x1'));var zipdir=require(_0xb239('0x2'));var jsonpatch=require(_0xb239('0x3'));var rp=require(_0xb239('0x4'));var moment=require(_0xb239('0x5'));var BPromise=require(_0xb239('0x6'));var Mustache=require(_0xb239('0x7'));var util=require(_0xb239('0x8'));var path=require(_0xb239('0x9'));var sox=require(_0xb239('0xa'));var csv=require(_0xb239('0xb'));var ejs=require(_0xb239('0xc'));var fs=require('fs');var _=require(_0xb239('0xd'));var squel=require(_0xb239('0xe'));var crypto=require(_0xb239('0xf'));var jsforce=require(_0xb239('0x10'));var deskjs=require(_0xb239('0x11'));var toCsv=require(_0xb239('0xb'));var querystring=require(_0xb239('0x12'));var Papa=require(_0xb239('0x13'));var Redis=require(_0xb239('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb239('0x15'));var hardwareService=require(_0xb239('0x16'));var logger=require(_0xb239('0x17'))(_0xb239('0x18'));var utils=require(_0xb239('0x19'));var config=require(_0xb239('0x1a'));var licenseUtil=require(_0xb239('0x1b'));var db=require(_0xb239('0x1c'))['db'];function respondWithStatusCode(_0x2436c,_0x24a7f7){_0x24a7f7=_0x24a7f7||0xcc;return function(_0x1c2b1a){if(_0x1c2b1a){return _0x2436c[_0xb239('0x1d')](_0x24a7f7);}return _0x2436c[_0xb239('0x1e')](_0x24a7f7)['end']();};}function respondWithResult(_0x5e2863,_0x589242){_0x589242=_0x589242||0xc8;return function(_0xeae13f){if(_0xeae13f){return _0x5e2863[_0xb239('0x1e')](_0x589242)['json'](_0xeae13f);}};}function respondWithFilteredResult(_0x24ce5f,_0x5831a0){return function(_0x550b12){if(_0x550b12){var _0x323849=_0x550b12[_0xb239('0x1f')],_0x1d32e1=_0x5831a0[_0xb239('0x20')],_0x10696=_0x5831a0['offset']+_0x5831a0['limit'],_0x99dc0b;if(_0x10696>=_0x323849){_0x10696=_0x323849;_0x99dc0b=0xc8;}else{_0x99dc0b=0xce;}_0x24ce5f[_0xb239('0x1e')](_0x99dc0b);return _0x24ce5f[_0xb239('0x21')](_0xb239('0x22'),_0x1d32e1+'-'+_0x10696+'/'+_0x323849)[_0xb239('0x23')](_0x550b12);}return null;};}function patchUpdates(_0x159759){return function(_0x46181b){try{jsonpatch['apply'](_0x46181b,_0x159759,!![]);}catch(_0x1fe981){return BPromise[_0xb239('0x24')](_0x1fe981);}return _0x46181b['save']();};}function saveUpdates(_0xda3f53,_0x41ea5d){return function(_0x2e5516){if(_0x2e5516){return _0x2e5516[_0xb239('0x25')](_0xda3f53)['then'](function(_0x5edb07){return _0x5edb07;});}return null;};}function removeEntity(_0x2c1bd3,_0x52fa3b){return function(_0x9a1281){if(_0x9a1281){return _0x9a1281[_0xb239('0x26')]()[_0xb239('0x27')](function(){var _0x4daef9=_0x9a1281['get']({'plain':!![]});var _0x57ea5=_0xb239('0x28');return db[_0xb239('0x29')][_0xb239('0x26')]({'where':{'type':_0x57ea5,'resourceId':_0x4daef9['id']}})['then'](function(){return _0x9a1281;});})[_0xb239('0x27')](function(){_0x2c1bd3[_0xb239('0x1e')](0xcc)[_0xb239('0x2a')]();});}};}function handleEntityNotFound(_0x3fcba1,_0xa1d056){return function(_0x12ad70){if(!_0x12ad70){_0x3fcba1[_0xb239('0x1d')](0x194);}return _0x12ad70;};}function handleError(_0x59f3fc,_0x5284da){_0x5284da=_0x5284da||0x1f4;return function(_0x45b66c){logger[_0xb239('0x2b')](_0x45b66c['stack']);if(_0x45b66c[_0xb239('0x2c')]){delete _0x45b66c[_0xb239('0x2c')];}_0x59f3fc[_0xb239('0x1e')](_0x5284da)[_0xb239('0x2d')](_0x45b66c);};}exports[_0xb239('0x2e')]=function(_0x3af890,_0x143729){var _0x2b8bc4={},_0x230e9f={},_0x45d8fe={'count':0x0,'rows':[]};var _0x287ad3=_['map'](db[_0xb239('0x2f')][_0xb239('0x30')],function(_0x4d8eae){return{'name':_0x4d8eae[_0xb239('0x31')],'type':_0x4d8eae[_0xb239('0x32')][_0xb239('0x33')]};});_0x230e9f[_0xb239('0x34')]=_[_0xb239('0x35')](_0x287ad3,_0xb239('0x2c'));_0x230e9f['query']=_[_0xb239('0x36')](_0x3af890[_0xb239('0x37')]);_0x230e9f[_0xb239('0x38')]=_['intersection'](_0x230e9f[_0xb239('0x34')],_0x230e9f[_0xb239('0x37')]);_0x2b8bc4[_0xb239('0x39')]=_[_0xb239('0x3a')](_0x230e9f['model'],qs[_0xb239('0x3b')](_0x3af890[_0xb239('0x37')][_0xb239('0x3b')]));_0x2b8bc4['attributes']=_0x2b8bc4[_0xb239('0x39')]['length']?_0x2b8bc4['attributes']:_0x230e9f[_0xb239('0x34')];if(!_0x3af890[_0xb239('0x37')][_0xb239('0x3c')](_0xb239('0x3d'))){_0x2b8bc4[_0xb239('0x3e')]=qs[_0xb239('0x3e')](_0x3af890['query']['limit']);_0x2b8bc4[_0xb239('0x20')]=qs[_0xb239('0x20')](_0x3af890[_0xb239('0x37')][_0xb239('0x20')]);}_0x2b8bc4['order']=qs[_0xb239('0x3f')](_0x3af890[_0xb239('0x37')]['sort']);_0x2b8bc4['where']=qs['filters'](_[_0xb239('0x40')](_0x3af890[_0xb239('0x37')],_0x230e9f[_0xb239('0x38')]),_0x287ad3);if(_0x3af890['query'][_0xb239('0x41')]){_0x2b8bc4[_0xb239('0x42')]=_[_0xb239('0x43')](_0x2b8bc4[_0xb239('0x42')],{'$or':_[_0xb239('0x35')](_0x287ad3,function(_0x4c7cb4){if(_0x4c7cb4['type']!==_0xb239('0x44')){var _0x3dc883={};_0x3dc883[_0x4c7cb4[_0xb239('0x2c')]]={'$like':'%'+_0x3af890[_0xb239('0x37')][_0xb239('0x41')]+'%'};return _0x3dc883;}})});}_0x2b8bc4=_[_0xb239('0x43')]({},_0x2b8bc4,_0x3af890[_0xb239('0x45')]);var _0x565b16={'where':_0x2b8bc4[_0xb239('0x42')]};return db['JscriptyProject']['count'](_0x565b16)['then'](function(_0x20d1d5){_0x45d8fe['count']=_0x20d1d5;if(_0x3af890['query'][_0xb239('0x46')]){_0x2b8bc4[_0xb239('0x47')]=[{'all':!![]}];}return db[_0xb239('0x2f')][_0xb239('0x48')](_0x2b8bc4);})[_0xb239('0x27')](function(_0x8bcb74){_0x45d8fe[_0xb239('0x49')]=_0x8bcb74;return _0x45d8fe;})[_0xb239('0x27')](respondWithFilteredResult(_0x143729,_0x2b8bc4))[_0xb239('0x4a')](handleError(_0x143729,null));};exports['show']=function(_0x1444f9,_0x2eee9e){var _0x35e355={'raw':![],'where':{'id':_0x1444f9[_0xb239('0x4b')]['id']}},_0x3dc0b6={};_0x3dc0b6[_0xb239('0x34')]=_[_0xb239('0x36')](db['JscriptyProject']['rawAttributes']);_0x3dc0b6['query']=_[_0xb239('0x36')](_0x1444f9[_0xb239('0x37')]);_0x3dc0b6['filters']=_['intersection'](_0x3dc0b6[_0xb239('0x34')],_0x3dc0b6[_0xb239('0x37')]);_0x35e355[_0xb239('0x39')]=_[_0xb239('0x3a')](_0x3dc0b6[_0xb239('0x34')],qs[_0xb239('0x3b')](_0x1444f9[_0xb239('0x37')][_0xb239('0x3b')]));_0x35e355[_0xb239('0x39')]=_0x35e355[_0xb239('0x39')]['length']?_0x35e355['attributes']:_0x3dc0b6[_0xb239('0x34')];if(_0x1444f9[_0xb239('0x37')][_0xb239('0x46')]){_0x35e355[_0xb239('0x47')]=[{'all':!![]}];}_0x35e355=_[_0xb239('0x43')]({},_0x35e355,_0x1444f9[_0xb239('0x45')]);return db[_0xb239('0x2f')][_0xb239('0x4c')](_0x35e355)[_0xb239('0x27')](handleEntityNotFound(_0x2eee9e,null))[_0xb239('0x27')](respondWithResult(_0x2eee9e,null))[_0xb239('0x4a')](handleError(_0x2eee9e,null));};exports[_0xb239('0x4d')]=function(_0x39cb6b,_0x53d018){return db[_0xb239('0x2f')][_0xb239('0x4d')](_0x39cb6b[_0xb239('0x4e')],{})['then'](function(_0x583fec){var _0x2c38fc=_0x39cb6b[_0xb239('0x4f')]['get']({'plain':!![]});if(!_0x2c38fc)throw new Error(_0xb239('0x50'));if(_0x2c38fc[_0xb239('0x51')]===_0xb239('0x4f')){var _0x3c8cdd=_0x583fec['get']({'plain':!![]});var _0x1b1c1f=_0xb239('0x28');return db[_0xb239('0x52')]['find']({'where':{'name':_0x1b1c1f,'userProfileId':_0x2c38fc[_0xb239('0x53')]},'raw':!![]})['then'](function(_0xcd4b96){if(_0xcd4b96&&_0xcd4b96['autoAssociation']===0x0){return db[_0xb239('0x29')][_0xb239('0x4d')]({'name':_0x3c8cdd[_0xb239('0x2c')],'resourceId':_0x3c8cdd['id'],'type':_0xcd4b96[_0xb239('0x2c')],'sectionId':_0xcd4b96['id']},{})[_0xb239('0x27')](function(){return _0x583fec;});}else{return _0x583fec;}})[_0xb239('0x4a')](function(_0x3174e3){logger['error'](_0xb239('0x54'),_0x3174e3);throw _0x3174e3;});}return _0x583fec;})['then'](respondWithResult(_0x53d018,0xc9))['catch'](handleError(_0x53d018,null));};exports[_0xb239('0x55')]=function(_0x50a700,_0x329076){var _0x5bc7a7={'where':{'id':_0x50a700[_0xb239('0x4b')]['id']}},_0xc3ef5a={};_0xc3ef5a[_0xb239('0x34')]=_[_0xb239('0x36')](db[_0xb239('0x2f')][_0xb239('0x30')]);_0x5bc7a7['attributes']=_[_0xb239('0x3a')](_0xc3ef5a['model'],qs['fields'](_0x50a700[_0xb239('0x37')][_0xb239('0x3b')]));_0x5bc7a7[_0xb239('0x39')]=_0x5bc7a7[_0xb239('0x39')][_0xb239('0x56')]?_0x5bc7a7[_0xb239('0x39')]:_0xc3ef5a['model'];if(_0x50a700['query'][_0xb239('0x46')]){_0x5bc7a7[_0xb239('0x47')]=[{'all':!![]}];}_0x5bc7a7=_[_0xb239('0x43')]({},_0x5bc7a7,_0x50a700[_0xb239('0x45')]);return db[_0xb239('0x2f')][_0xb239('0x4c')](_0x5bc7a7)[_0xb239('0x27')](handleEntityNotFound(_0x329076,null))[_0xb239('0x27')](function(_0x3b2620){if(_0x3b2620){var _0xe33ff7=_0x3b2620['get']({'plain':!![]});_0xe33ff7=qs['omit'](_0xe33ff7,['id',_0xb239('0x57'),_0xb239('0x58')]);_0x50a700[_0xb239('0x4e')]=_[_0xb239('0x59')](_0x50a700[_0xb239('0x4e')],['id',_0xb239('0x57'),'updatedAt']);return db[_0xb239('0x2f')]['create'](_[_0xb239('0x43')](_0xe33ff7,_0x50a700[_0xb239('0x4e')]),{'include':_0x50a700[_0xb239('0x37')][_0xb239('0x46')]?[{'all':!![]}]:undefined})[_0xb239('0x27')](function(_0x150696){var _0x2a665b=_0x50a700[_0xb239('0x4f')][_0xb239('0x5a')]({'plain':!![]});if(!_0x2a665b)throw new Error(_0xb239('0x50'));if(_0x2a665b['role']===_0xb239('0x4f')){var _0x108fca=_0x150696[_0xb239('0x5a')]({'plain':!![]});var _0x242edc=_0xb239('0x28');return db[_0xb239('0x52')][_0xb239('0x4c')]({'where':{'name':_0x242edc,'userProfileId':_0x2a665b[_0xb239('0x53')]},'raw':!![]})[_0xb239('0x27')](function(_0x26cecb){if(_0x26cecb&&_0x26cecb[_0xb239('0x5b')]===0x0){return db[_0xb239('0x29')][_0xb239('0x4d')]({'name':_0x108fca[_0xb239('0x2c')],'resourceId':_0x108fca['id'],'type':_0x26cecb[_0xb239('0x2c')],'sectionId':_0x26cecb['id']},{})[_0xb239('0x27')](function(){return _0x150696;});}else{return _0x150696;}})[_0xb239('0x4a')](function(_0x3f06cd){logger[_0xb239('0x2b')](_0xb239('0x54'),_0x3f06cd);throw _0x3f06cd;});}return _0x150696;});}})['then'](respondWithResult(_0x329076,0xc9))[_0xb239('0x4a')](handleError(_0x329076,null));};exports[_0xb239('0x25')]=function(_0x307343,_0x306ba9){if(_0x307343[_0xb239('0x4e')]['id']){delete _0x307343[_0xb239('0x4e')]['id'];}return db[_0xb239('0x2f')]['find']({'where':{'id':_0x307343[_0xb239('0x4b')]['id']}})[_0xb239('0x27')](handleEntityNotFound(_0x306ba9,null))['then'](saveUpdates(_0x307343['body'],null))[_0xb239('0x27')](respondWithResult(_0x306ba9,null))[_0xb239('0x4a')](handleError(_0x306ba9,null));};exports[_0xb239('0x26')]=function(_0x326ad3,_0x4ed61c){return db[_0xb239('0x2f')]['find']({'where':{'id':_0x326ad3['params']['id']}})['then'](handleEntityNotFound(_0x4ed61c,null))[_0xb239('0x27')](removeEntity(_0x4ed61c,null))[_0xb239('0x4a')](handleError(_0x4ed61c,null));};exports[_0xb239('0x5c')]=function(_0xcaed80,_0x2ba6a6,_0x3453bb){var _0xf8e3ec={'raw':!![],'where':{}};var _0x8f0dc1={};var _0x5c82e8={'count':0x0,'rows':[]};return db[_0xb239('0x2f')]['findOne']({'where':{'id':_0xcaed80[_0xb239('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2ba6a6,null))['then'](function(_0x4a41ed){if(_0x4a41ed){_0x8f0dc1[_0xb239('0x34')]=_['keys'](db[_0xb239('0x5d')][_0xb239('0x30')]);_0x8f0dc1['query']=_[_0xb239('0x36')](_0xcaed80[_0xb239('0x37')]);_0x8f0dc1['filters']=_[_0xb239('0x3a')](_0x8f0dc1[_0xb239('0x34')],_0x8f0dc1[_0xb239('0x37')]);_0xf8e3ec[_0xb239('0x39')]=_['intersection'](_0x8f0dc1[_0xb239('0x34')],qs[_0xb239('0x3b')](_0xcaed80[_0xb239('0x37')]['fields']));_0xf8e3ec[_0xb239('0x39')]=_0xf8e3ec['attributes'][_0xb239('0x56')]?_0xf8e3ec[_0xb239('0x39')]:_0x8f0dc1['model'];if(!_0xcaed80['query'][_0xb239('0x3c')]('nolimit')){_0xf8e3ec[_0xb239('0x3e')]=qs[_0xb239('0x3e')](_0xcaed80[_0xb239('0x37')][_0xb239('0x3e')]);_0xf8e3ec[_0xb239('0x20')]=qs[_0xb239('0x20')](_0xcaed80[_0xb239('0x37')][_0xb239('0x20')]);}_0xf8e3ec[_0xb239('0x5e')]=qs[_0xb239('0x3f')](_0xcaed80[_0xb239('0x37')][_0xb239('0x3f')]);_0xf8e3ec[_0xb239('0x42')]=qs[_0xb239('0x38')](_[_0xb239('0x40')](_0xcaed80[_0xb239('0x37')],_0x8f0dc1[_0xb239('0x38')]));_0xf8e3ec['where'][_0xb239('0x5f')]=_0x4a41ed['id'];if(_0xcaed80['query'][_0xb239('0x41')]){_0xf8e3ec[_0xb239('0x42')]=_['merge'](_0xf8e3ec[_0xb239('0x42')],{'$or':_[_0xb239('0x35')](_0xf8e3ec[_0xb239('0x39')],function(_0x264574){var _0x3033e0={};_0x3033e0[_0x264574]={'$like':'%'+_0xcaed80[_0xb239('0x37')][_0xb239('0x41')]+'%'};return _0x3033e0;})});}_0xf8e3ec=_['merge']({},_0xf8e3ec,_0xcaed80['options']);return db[_0xb239('0x5d')]['count']({'where':_0xf8e3ec[_0xb239('0x42')]})[_0xb239('0x27')](function(_0x153b6b){_0x5c82e8['count']=_0x153b6b;if(_0xcaed80[_0xb239('0x37')][_0xb239('0x46')]){_0xf8e3ec[_0xb239('0x47')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xb239('0x48')](_0xf8e3ec);})[_0xb239('0x27')](function(_0x4429f2){_0x5c82e8['rows']=_0x4429f2;return _0x5c82e8;});}})[_0xb239('0x27')](respondWithFilteredResult(_0x2ba6a6,_0xf8e3ec))['catch'](handleError(_0x2ba6a6,null));};exports[_0xb239('0x60')]=function(_0x564536,_0x466b34,_0x382888){var _0x18916e={'raw':!![],'where':{}};var _0x381ba2={};var _0x464793={'count':0x0,'rows':[]};return db[_0xb239('0x2f')]['findOne']({'where':{'id':_0x564536[_0xb239('0x4b')]['id']}})[_0xb239('0x27')](handleEntityNotFound(_0x466b34,null))['then'](function(_0x279892){if(_0x279892){_0x381ba2[_0xb239('0x34')]=_[_0xb239('0x36')](db[_0xb239('0x61')]['rawAttributes']);_0x381ba2['query']=_['keys'](_0x564536['query']);_0x381ba2[_0xb239('0x38')]=_[_0xb239('0x3a')](_0x381ba2[_0xb239('0x34')],_0x381ba2[_0xb239('0x37')]);_0x18916e[_0xb239('0x39')]=_['intersection'](_0x381ba2[_0xb239('0x34')],qs[_0xb239('0x3b')](_0x564536['query']['fields']));_0x18916e[_0xb239('0x39')]=_0x18916e['attributes'][_0xb239('0x56')]?_0x18916e[_0xb239('0x39')]:_0x381ba2['model'];if(!_0x564536[_0xb239('0x37')][_0xb239('0x3c')](_0xb239('0x3d'))){_0x18916e['limit']=qs[_0xb239('0x3e')](_0x564536['query'][_0xb239('0x3e')]);_0x18916e[_0xb239('0x20')]=qs['offset'](_0x564536[_0xb239('0x37')]['offset']);}_0x18916e['order']=qs[_0xb239('0x3f')](_0x564536[_0xb239('0x37')]['sort']);_0x18916e[_0xb239('0x42')]=qs[_0xb239('0x38')](_[_0xb239('0x40')](_0x564536[_0xb239('0x37')],_0x381ba2[_0xb239('0x38')]));_0x18916e[_0xb239('0x42')]['ProjectId']=_0x279892['id'];if(_0x564536['query'][_0xb239('0x41')]){_0x18916e['where']=_[_0xb239('0x43')](_0x18916e['where'],{'$or':_['map'](_0x18916e[_0xb239('0x39')],function(_0x38ae98){var _0x4bb2ad={};_0x4bb2ad[_0x38ae98]={'$like':'%'+_0x564536['query'][_0xb239('0x41')]+'%'};return _0x4bb2ad;})});}_0x18916e=_['merge']({},_0x18916e,_0x564536['options']);return db['JscriptyAnswerReport'][_0xb239('0x1f')]({'where':_0x18916e[_0xb239('0x42')]})['then'](function(_0x3ae002){_0x464793[_0xb239('0x1f')]=_0x3ae002;if(_0x564536[_0xb239('0x37')][_0xb239('0x46')]){_0x18916e[_0xb239('0x47')]=[{'all':!![]}];}return db[_0xb239('0x61')]['findAll'](_0x18916e);})[_0xb239('0x27')](function(_0x27d5e7){_0x464793[_0xb239('0x49')]=_0x27d5e7;return _0x464793;});}})[_0xb239('0x27')](respondWithFilteredResult(_0x466b34,_0x18916e))[_0xb239('0x4a')](handleError(_0x466b34,null));};function char(_0x506347){return'number'===typeof _0x506347?String['fromCharCode'][_0xb239('0x62')](null,arguments):_0x506347;}function needsEncapsulation(_0x36b395){return!!_0x36b395&&(_0x36b395[_0xb239('0x63')]()['indexOf'](char(0xd))>=0x0||_0x36b395['toString']()['indexOf'](char(0xa))>=0x0||_0x36b395['toString']()[_0xb239('0x64')](char(0x2c))>=0x0||_0x36b395['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x5826f1){var _0xfafe39=char(0x22),_0x28ae34='\x5c'+char(0x22),_0x14fe0d=_0x5826f1['toString']()[_0xb239('0x65')](new RegExp(_0xfafe39,'g'),_0x28ae34);return _0xfafe39+_0x14fe0d+_0xfafe39;}exports[_0xb239('0x66')]=function(_0x3ff20a,_0x4495ae,_0x2b5f6b){var _0x37b18a,_0x565157;var _0x4e35fb={'where':{'ProjectId':_0x3ff20a['params']['id']}};if(_0x3ff20a[_0xb239('0x37')][_0xb239('0x67')]){_0x4e35fb[_0xb239('0x42')][_0xb239('0x68')]=JSON[_0xb239('0x69')](_0x3ff20a[_0xb239('0x37')][_0xb239('0x67')]);}return db[_0xb239('0x5d')][_0xb239('0x48')](_0x4e35fb)[_0xb239('0x27')](handleEntityNotFound(_0x4495ae,null))[_0xb239('0x27')](function(_0x24f1ca){if(_0x24f1ca){_0x37b18a=_0x24f1ca;return db[_0xb239('0x6a')][_0xb239('0x48')]({'where':{'SessionId':{'$in':_[_0xb239('0x35')](_0x37b18a,'id')},'ProjectId':_0x3ff20a[_0xb239('0x4b')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x4495ae,null))[_0xb239('0x27')](function(_0x107f8c){if(_0x107f8c){_0x565157=_0x107f8c;var _0x1160c2={};for(var _0x123e46=0x0,_0x5e048d=_0x565157[_0xb239('0x56')];_0x123e46<_0x5e048d;_0x123e46++){if(!_0x1160c2[_0xb239('0x3c')](_0x565157[_0x123e46][_0xb239('0x6b')])){_0x1160c2[_0x565157[_0x123e46][_0xb239('0x6b')]]=needsEncapsulation(_0x565157[_0x123e46][_0xb239('0x6c')])?encapsulate(_0x565157[_0x123e46]['question']):_0x565157[_0x123e46]['question'];}}var _0x31c19a=[],_0x1eb907={};for(var _0x50e332=0x0,_0x147c1f=_0x37b18a[_0xb239('0x56')];_0x50e332<_0x147c1f;_0x50e332++){_0x1eb907={'ProjectId':_0x3ff20a[_0xb239('0x4b')]['id'],'SessionId':_0x37b18a[_0x50e332]['id'],'StartTime':moment(_0x37b18a[_0x50e332][_0xb239('0x68')])['format'](_0xb239('0x6d'))};for(var _0x1d7b21=0x0,_0x5884b5=_0x565157['length'];_0x1d7b21<_0x5884b5;_0x1d7b21++){if(_0x565157[_0x1d7b21][_0xb239('0x6e')]==_0x37b18a[_0x50e332]['id']&&_0x1160c2[_0xb239('0x3c')](_0x565157[_0x1d7b21]['questionId'])){_0x1eb907[_0x1160c2[_0x565157[_0x1d7b21][_0xb239('0x6b')]]]=_0x565157[_0x1d7b21]['answer'];}}for(var _0x5b9139 in _0x1160c2){if(!_0x1eb907[_0xb239('0x3c')](_0x1160c2[_0x5b9139])){_0x1eb907[_0x1160c2[_0x5b9139]]=null;}}_0x31c19a[_0xb239('0x6f')](_0x1eb907);}return _0x31c19a;}})[_0xb239('0x27')](function(_0x36763c){if(!_[_0xb239('0x70')](_0x36763c)){var _0x4c9dfa=toCsv(_0x36763c);var _0x166c95=Date['now']();fs[_0xb239('0x71')](util[_0xb239('0x72')](_0xb239('0x73'),_0x3ff20a['params']['id'],_0x166c95),_0x4c9dfa);_0x4495ae[_0xb239('0x74')](_0xb239('0x75'),'attachment;\x20filename='+util[_0xb239('0x72')]('Jscripty_Project_%d_Summary_%s.csv',_0x3ff20a['params']['id'],_0x166c95));_0x4495ae['setHeader']('Content-type','text/csv');return _0x4495ae['download'](util[_0xb239('0x72')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3ff20a[_0xb239('0x4b')]['id'],_0x166c95));}else{return _0x4495ae[_0xb239('0x1d')](0xcc);}})[_0xb239('0x4a')](handleError(_0x4495ae,null));}; \ No newline at end of file +var _0x4c11=['UserProfileResource','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','role','getSessions','findOne','hasOwnProperty','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','length','fromCharCode','indexOf','toString','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','setHeader','Content-disposition','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Projects'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x4c11,0xc6));var _0x14c1=function(_0x527acd,_0x32b758){_0x527acd=_0x527acd-0x0;var _0x2c990f=_0x4c11[_0x527acd];return _0x2c990f;};'use strict';var pdf=require(_0x14c1('0x0'));var emlformat=require(_0x14c1('0x1'));var rimraf=require(_0x14c1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14c1('0x3'));var rp=require(_0x14c1('0x4'));var moment=require(_0x14c1('0x5'));var BPromise=require(_0x14c1('0x6'));var Mustache=require('mustache');var util=require(_0x14c1('0x7'));var path=require('path');var sox=require(_0x14c1('0x8'));var csv=require(_0x14c1('0x9'));var ejs=require(_0x14c1('0xa'));var fs=require('fs');var _=require(_0x14c1('0xb'));var squel=require(_0x14c1('0xc'));var crypto=require(_0x14c1('0xd'));var jsforce=require(_0x14c1('0xe'));var deskjs=require(_0x14c1('0xf'));var toCsv=require(_0x14c1('0x9'));var querystring=require('querystring');var Papa=require(_0x14c1('0x10'));var Redis=require('ioredis');var authService=require(_0x14c1('0x11'));var qs=require(_0x14c1('0x12'));var as=require(_0x14c1('0x13'));var hardwareService=require(_0x14c1('0x14'));var logger=require(_0x14c1('0x15'))(_0x14c1('0x16'));var utils=require(_0x14c1('0x17'));var config=require(_0x14c1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x14c1('0x19'))['db'];function respondWithStatusCode(_0x144bce,_0x3f696e){_0x3f696e=_0x3f696e||0xcc;return function(_0x3db911){if(_0x3db911){return _0x144bce[_0x14c1('0x1a')](_0x3f696e);}return _0x144bce[_0x14c1('0x1b')](_0x3f696e)[_0x14c1('0x1c')]();};}function respondWithResult(_0x332327,_0x74c58f){_0x74c58f=_0x74c58f||0xc8;return function(_0x5b9f59){if(_0x5b9f59){return _0x332327[_0x14c1('0x1b')](_0x74c58f)[_0x14c1('0x1d')](_0x5b9f59);}};}function respondWithFilteredResult(_0x4d84b3,_0x19c34a){return function(_0x2b0dc2){if(_0x2b0dc2){var _0x493563=_0x2b0dc2[_0x14c1('0x1e')],_0x5c8536=_0x19c34a[_0x14c1('0x1f')],_0x72b484=_0x19c34a[_0x14c1('0x1f')]+_0x19c34a[_0x14c1('0x20')],_0x183157;if(_0x72b484>=_0x493563){_0x72b484=_0x493563;_0x183157=0xc8;}else{_0x183157=0xce;}_0x4d84b3['status'](_0x183157);return _0x4d84b3['set'](_0x14c1('0x21'),_0x5c8536+'-'+_0x72b484+'/'+_0x493563)['json'](_0x2b0dc2);}return null;};}function patchUpdates(_0xf40f94){return function(_0x236e15){try{jsonpatch[_0x14c1('0x22')](_0x236e15,_0xf40f94,!![]);}catch(_0x2d6ad2){return BPromise[_0x14c1('0x23')](_0x2d6ad2);}return _0x236e15[_0x14c1('0x24')]();};}function saveUpdates(_0x5a8cab,_0x4e7637){return function(_0x58f368){if(_0x58f368){return _0x58f368[_0x14c1('0x25')](_0x5a8cab)['then'](function(_0x2e6276){return _0x2e6276;});}return null;};}function removeEntity(_0x218520,_0xab976e){return function(_0x4355eb){if(_0x4355eb){return _0x4355eb[_0x14c1('0x26')]()[_0x14c1('0x27')](function(){var _0x4bfd21=_0x4355eb[_0x14c1('0x28')]({'plain':!![]});var _0x50dbd6=_0x14c1('0x29');return db[_0x14c1('0x2a')]['destroy']({'where':{'type':_0x50dbd6,'resourceId':_0x4bfd21['id']}})[_0x14c1('0x27')](function(){return _0x4355eb;});})[_0x14c1('0x27')](function(){_0x218520[_0x14c1('0x1b')](0xcc)[_0x14c1('0x1c')]();});}};}function handleEntityNotFound(_0x10960e,_0x498505){return function(_0x5d918c){if(!_0x5d918c){_0x10960e[_0x14c1('0x1a')](0x194);}return _0x5d918c;};}function handleError(_0x5099ae,_0x2edeaa){_0x2edeaa=_0x2edeaa||0x1f4;return function(_0x81075d){logger[_0x14c1('0x2b')](_0x81075d[_0x14c1('0x2c')]);if(_0x81075d[_0x14c1('0x2d')]){delete _0x81075d[_0x14c1('0x2d')];}_0x5099ae[_0x14c1('0x1b')](_0x2edeaa)[_0x14c1('0x2e')](_0x81075d);};}exports[_0x14c1('0x2f')]=function(_0x16db50,_0x8ffcdf){var _0x14d00d={},_0x3f57d7={},_0x41b142={'count':0x0,'rows':[]};var _0x4f10d0=_[_0x14c1('0x30')](db[_0x14c1('0x31')][_0x14c1('0x32')],function(_0x4df734){return{'name':_0x4df734['fieldName'],'type':_0x4df734[_0x14c1('0x33')][_0x14c1('0x34')]};});_0x3f57d7[_0x14c1('0x35')]=_[_0x14c1('0x30')](_0x4f10d0,_0x14c1('0x2d'));_0x3f57d7[_0x14c1('0x36')]=_[_0x14c1('0x37')](_0x16db50['query']);_0x3f57d7['filters']=_[_0x14c1('0x38')](_0x3f57d7[_0x14c1('0x35')],_0x3f57d7[_0x14c1('0x36')]);_0x14d00d['attributes']=_['intersection'](_0x3f57d7['model'],qs[_0x14c1('0x39')](_0x16db50['query'][_0x14c1('0x39')]));_0x14d00d[_0x14c1('0x3a')]=_0x14d00d[_0x14c1('0x3a')]['length']?_0x14d00d[_0x14c1('0x3a')]:_0x3f57d7[_0x14c1('0x35')];if(!_0x16db50[_0x14c1('0x36')]['hasOwnProperty'](_0x14c1('0x3b'))){_0x14d00d[_0x14c1('0x20')]=qs['limit'](_0x16db50[_0x14c1('0x36')]['limit']);_0x14d00d[_0x14c1('0x1f')]=qs[_0x14c1('0x1f')](_0x16db50['query']['offset']);}_0x14d00d[_0x14c1('0x3c')]=qs['sort'](_0x16db50[_0x14c1('0x36')][_0x14c1('0x3d')]);_0x14d00d[_0x14c1('0x3e')]=qs[_0x14c1('0x3f')](_[_0x14c1('0x40')](_0x16db50[_0x14c1('0x36')],_0x3f57d7[_0x14c1('0x3f')]),_0x4f10d0);if(_0x16db50[_0x14c1('0x36')]['filter']){_0x14d00d[_0x14c1('0x3e')]=_[_0x14c1('0x41')](_0x14d00d['where'],{'$or':_['map'](_0x4f10d0,function(_0x5f14da){if(_0x5f14da[_0x14c1('0x33')]!==_0x14c1('0x42')){var _0x2ea871={};_0x2ea871[_0x5f14da[_0x14c1('0x2d')]]={'$like':'%'+_0x16db50[_0x14c1('0x36')][_0x14c1('0x43')]+'%'};return _0x2ea871;}})});}_0x14d00d=_[_0x14c1('0x41')]({},_0x14d00d,_0x16db50[_0x14c1('0x44')]);var _0x376ce9={'where':_0x14d00d[_0x14c1('0x3e')]};return db[_0x14c1('0x31')][_0x14c1('0x1e')](_0x376ce9)[_0x14c1('0x27')](function(_0x22d938){_0x41b142['count']=_0x22d938;if(_0x16db50[_0x14c1('0x36')][_0x14c1('0x45')]){_0x14d00d[_0x14c1('0x46')]=[{'all':!![]}];}return db[_0x14c1('0x31')][_0x14c1('0x47')](_0x14d00d);})['then'](function(_0xc39d26){_0x41b142[_0x14c1('0x48')]=_0xc39d26;return _0x41b142;})['then'](respondWithFilteredResult(_0x8ffcdf,_0x14d00d))[_0x14c1('0x49')](handleError(_0x8ffcdf,null));};exports[_0x14c1('0x4a')]=function(_0x44a6ba,_0x56bd19){var _0x2a4fbf={'raw':![],'where':{'id':_0x44a6ba[_0x14c1('0x4b')]['id']}},_0x10f3e4={};_0x10f3e4['model']=_[_0x14c1('0x37')](db[_0x14c1('0x31')][_0x14c1('0x32')]);_0x10f3e4['query']=_[_0x14c1('0x37')](_0x44a6ba[_0x14c1('0x36')]);_0x10f3e4['filters']=_[_0x14c1('0x38')](_0x10f3e4[_0x14c1('0x35')],_0x10f3e4[_0x14c1('0x36')]);_0x2a4fbf['attributes']=_[_0x14c1('0x38')](_0x10f3e4[_0x14c1('0x35')],qs[_0x14c1('0x39')](_0x44a6ba['query']['fields']));_0x2a4fbf[_0x14c1('0x3a')]=_0x2a4fbf[_0x14c1('0x3a')]['length']?_0x2a4fbf[_0x14c1('0x3a')]:_0x10f3e4[_0x14c1('0x35')];if(_0x44a6ba[_0x14c1('0x36')]['includeAll']){_0x2a4fbf[_0x14c1('0x46')]=[{'all':!![]}];}_0x2a4fbf=_[_0x14c1('0x41')]({},_0x2a4fbf,_0x44a6ba[_0x14c1('0x44')]);return db[_0x14c1('0x31')]['find'](_0x2a4fbf)[_0x14c1('0x27')](handleEntityNotFound(_0x56bd19,null))['then'](respondWithResult(_0x56bd19,null))['catch'](handleError(_0x56bd19,null));};exports[_0x14c1('0x4c')]=function(_0x53db21,_0x530b2d){return db['JscriptyProject'][_0x14c1('0x4c')](_0x53db21['body'],{})[_0x14c1('0x27')](function(_0x29df28){var _0xb179c4=_0x53db21[_0x14c1('0x4d')][_0x14c1('0x28')]({'plain':!![]});if(!_0xb179c4)throw new Error(_0x14c1('0x4e'));if(_0xb179c4['role']===_0x14c1('0x4d')){var _0x5b0751=_0x29df28['get']({'plain':!![]});var _0x35343a=_0x14c1('0x29');return db[_0x14c1('0x4f')][_0x14c1('0x50')]({'where':{'name':_0x35343a,'userProfileId':_0xb179c4['userProfileId']},'raw':!![]})[_0x14c1('0x27')](function(_0x270965){if(_0x270965&&_0x270965[_0x14c1('0x51')]===0x0){return db[_0x14c1('0x2a')]['create']({'name':_0x5b0751[_0x14c1('0x2d')],'resourceId':_0x5b0751['id'],'type':_0x270965[_0x14c1('0x2d')],'sectionId':_0x270965['id']},{})['then'](function(){return _0x29df28;});}else{return _0x29df28;}})['catch'](function(_0xc3f212){logger[_0x14c1('0x2b')](_0x14c1('0x52'),_0xc3f212);throw _0xc3f212;});}return _0x29df28;})[_0x14c1('0x27')](respondWithResult(_0x530b2d,0xc9))[_0x14c1('0x49')](handleError(_0x530b2d,null));};exports[_0x14c1('0x53')]=function(_0x5ac6cc,_0x31b223){var _0x8f99ce={'where':{'id':_0x5ac6cc['params']['id']}},_0x37f87c={};_0x37f87c[_0x14c1('0x35')]=_[_0x14c1('0x37')](db[_0x14c1('0x31')][_0x14c1('0x32')]);_0x8f99ce[_0x14c1('0x3a')]=_[_0x14c1('0x38')](_0x37f87c[_0x14c1('0x35')],qs[_0x14c1('0x39')](_0x5ac6cc['query'][_0x14c1('0x39')]));_0x8f99ce[_0x14c1('0x3a')]=_0x8f99ce[_0x14c1('0x3a')]['length']?_0x8f99ce[_0x14c1('0x3a')]:_0x37f87c['model'];if(_0x5ac6cc[_0x14c1('0x36')][_0x14c1('0x45')]){_0x8f99ce[_0x14c1('0x46')]=[{'all':!![]}];}_0x8f99ce=_[_0x14c1('0x41')]({},_0x8f99ce,_0x5ac6cc[_0x14c1('0x44')]);return db[_0x14c1('0x31')][_0x14c1('0x50')](_0x8f99ce)[_0x14c1('0x27')](handleEntityNotFound(_0x31b223,null))['then'](function(_0x7d12d4){if(_0x7d12d4){var _0x22b3e6=_0x7d12d4[_0x14c1('0x28')]({'plain':!![]});_0x22b3e6=qs[_0x14c1('0x54')](_0x22b3e6,['id',_0x14c1('0x55'),'updatedAt']);_0x5ac6cc[_0x14c1('0x56')]=_[_0x14c1('0x54')](_0x5ac6cc[_0x14c1('0x56')],['id',_0x14c1('0x55'),_0x14c1('0x57')]);return db['JscriptyProject'][_0x14c1('0x4c')](_[_0x14c1('0x41')](_0x22b3e6,_0x5ac6cc[_0x14c1('0x56')]),{'include':_0x5ac6cc[_0x14c1('0x36')][_0x14c1('0x45')]?[{'all':!![]}]:undefined})[_0x14c1('0x27')](function(_0x6d7fe6){var _0x693142=_0x5ac6cc['user'][_0x14c1('0x28')]({'plain':!![]});if(!_0x693142)throw new Error(_0x14c1('0x4e'));if(_0x693142[_0x14c1('0x58')]===_0x14c1('0x4d')){var _0x87f5c7=_0x6d7fe6[_0x14c1('0x28')]({'plain':!![]});var _0x46d5ed=_0x14c1('0x29');return db[_0x14c1('0x4f')][_0x14c1('0x50')]({'where':{'name':_0x46d5ed,'userProfileId':_0x693142['userProfileId']},'raw':!![]})['then'](function(_0x2d0c24){if(_0x2d0c24&&_0x2d0c24[_0x14c1('0x51')]===0x0){return db['UserProfileResource'][_0x14c1('0x4c')]({'name':_0x87f5c7['name'],'resourceId':_0x87f5c7['id'],'type':_0x2d0c24['name'],'sectionId':_0x2d0c24['id']},{})['then'](function(){return _0x6d7fe6;});}else{return _0x6d7fe6;}})['catch'](function(_0x51a16d){logger[_0x14c1('0x2b')](_0x14c1('0x52'),_0x51a16d);throw _0x51a16d;});}return _0x6d7fe6;});}})[_0x14c1('0x27')](respondWithResult(_0x31b223,0xc9))[_0x14c1('0x49')](handleError(_0x31b223,null));};exports[_0x14c1('0x25')]=function(_0x9cd7f6,_0x3a9f56){if(_0x9cd7f6[_0x14c1('0x56')]['id']){delete _0x9cd7f6[_0x14c1('0x56')]['id'];}return db[_0x14c1('0x31')][_0x14c1('0x50')]({'where':{'id':_0x9cd7f6[_0x14c1('0x4b')]['id']}})[_0x14c1('0x27')](handleEntityNotFound(_0x3a9f56,null))[_0x14c1('0x27')](saveUpdates(_0x9cd7f6[_0x14c1('0x56')],null))[_0x14c1('0x27')](respondWithResult(_0x3a9f56,null))[_0x14c1('0x49')](handleError(_0x3a9f56,null));};exports[_0x14c1('0x26')]=function(_0x432be0,_0xe2318a){return db[_0x14c1('0x31')]['find']({'where':{'id':_0x432be0[_0x14c1('0x4b')]['id']}})[_0x14c1('0x27')](handleEntityNotFound(_0xe2318a,null))[_0x14c1('0x27')](removeEntity(_0xe2318a,null))[_0x14c1('0x49')](handleError(_0xe2318a,null));};exports[_0x14c1('0x59')]=function(_0x27c99f,_0xb124e5,_0x29a0da){var _0x9ebf75={'raw':!![],'where':{}};var _0x34d84f={};var _0x1a7ed0={'count':0x0,'rows':[]};return db[_0x14c1('0x31')][_0x14c1('0x5a')]({'where':{'id':_0x27c99f[_0x14c1('0x4b')]['id']}})[_0x14c1('0x27')](handleEntityNotFound(_0xb124e5,null))[_0x14c1('0x27')](function(_0x369d2b){if(_0x369d2b){_0x34d84f[_0x14c1('0x35')]=_[_0x14c1('0x37')](db['JscriptySessionReport'][_0x14c1('0x32')]);_0x34d84f['query']=_[_0x14c1('0x37')](_0x27c99f[_0x14c1('0x36')]);_0x34d84f[_0x14c1('0x3f')]=_['intersection'](_0x34d84f[_0x14c1('0x35')],_0x34d84f[_0x14c1('0x36')]);_0x9ebf75[_0x14c1('0x3a')]=_[_0x14c1('0x38')](_0x34d84f[_0x14c1('0x35')],qs[_0x14c1('0x39')](_0x27c99f[_0x14c1('0x36')]['fields']));_0x9ebf75['attributes']=_0x9ebf75[_0x14c1('0x3a')]['length']?_0x9ebf75['attributes']:_0x34d84f[_0x14c1('0x35')];if(!_0x27c99f[_0x14c1('0x36')][_0x14c1('0x5b')](_0x14c1('0x3b'))){_0x9ebf75['limit']=qs[_0x14c1('0x20')](_0x27c99f[_0x14c1('0x36')][_0x14c1('0x20')]);_0x9ebf75[_0x14c1('0x1f')]=qs[_0x14c1('0x1f')](_0x27c99f[_0x14c1('0x36')][_0x14c1('0x1f')]);}_0x9ebf75[_0x14c1('0x3c')]=qs['sort'](_0x27c99f['query']['sort']);_0x9ebf75[_0x14c1('0x3e')]=qs[_0x14c1('0x3f')](_[_0x14c1('0x40')](_0x27c99f[_0x14c1('0x36')],_0x34d84f['filters']));_0x9ebf75[_0x14c1('0x3e')][_0x14c1('0x5c')]=_0x369d2b['id'];if(_0x27c99f[_0x14c1('0x36')][_0x14c1('0x43')]){_0x9ebf75[_0x14c1('0x3e')]=_['merge'](_0x9ebf75[_0x14c1('0x3e')],{'$or':_[_0x14c1('0x30')](_0x9ebf75[_0x14c1('0x3a')],function(_0x374e9b){var _0xedecb={};_0xedecb[_0x374e9b]={'$like':'%'+_0x27c99f[_0x14c1('0x36')][_0x14c1('0x43')]+'%'};return _0xedecb;})});}_0x9ebf75=_[_0x14c1('0x41')]({},_0x9ebf75,_0x27c99f[_0x14c1('0x44')]);return db[_0x14c1('0x5d')][_0x14c1('0x1e')]({'where':_0x9ebf75['where']})[_0x14c1('0x27')](function(_0x3baa44){_0x1a7ed0[_0x14c1('0x1e')]=_0x3baa44;if(_0x27c99f[_0x14c1('0x36')]['includeAll']){_0x9ebf75['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x14c1('0x47')](_0x9ebf75);})[_0x14c1('0x27')](function(_0x32c67a){_0x1a7ed0['rows']=_0x32c67a;return _0x1a7ed0;});}})[_0x14c1('0x27')](respondWithFilteredResult(_0xb124e5,_0x9ebf75))[_0x14c1('0x49')](handleError(_0xb124e5,null));};exports[_0x14c1('0x5e')]=function(_0x289932,_0x398253,_0x3de067){var _0x35ddb1={'raw':!![],'where':{}};var _0x3479dc={};var _0x397862={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x289932[_0x14c1('0x4b')]['id']}})[_0x14c1('0x27')](handleEntityNotFound(_0x398253,null))[_0x14c1('0x27')](function(_0x4e5afa){if(_0x4e5afa){_0x3479dc[_0x14c1('0x35')]=_[_0x14c1('0x37')](db[_0x14c1('0x5f')][_0x14c1('0x32')]);_0x3479dc['query']=_[_0x14c1('0x37')](_0x289932[_0x14c1('0x36')]);_0x3479dc[_0x14c1('0x3f')]=_[_0x14c1('0x38')](_0x3479dc[_0x14c1('0x35')],_0x3479dc['query']);_0x35ddb1[_0x14c1('0x3a')]=_['intersection'](_0x3479dc['model'],qs[_0x14c1('0x39')](_0x289932['query'][_0x14c1('0x39')]));_0x35ddb1[_0x14c1('0x3a')]=_0x35ddb1[_0x14c1('0x3a')][_0x14c1('0x60')]?_0x35ddb1[_0x14c1('0x3a')]:_0x3479dc[_0x14c1('0x35')];if(!_0x289932[_0x14c1('0x36')]['hasOwnProperty'](_0x14c1('0x3b'))){_0x35ddb1[_0x14c1('0x20')]=qs[_0x14c1('0x20')](_0x289932[_0x14c1('0x36')][_0x14c1('0x20')]);_0x35ddb1[_0x14c1('0x1f')]=qs[_0x14c1('0x1f')](_0x289932[_0x14c1('0x36')][_0x14c1('0x1f')]);}_0x35ddb1[_0x14c1('0x3c')]=qs[_0x14c1('0x3d')](_0x289932[_0x14c1('0x36')]['sort']);_0x35ddb1['where']=qs[_0x14c1('0x3f')](_[_0x14c1('0x40')](_0x289932[_0x14c1('0x36')],_0x3479dc['filters']));_0x35ddb1[_0x14c1('0x3e')][_0x14c1('0x5c')]=_0x4e5afa['id'];if(_0x289932[_0x14c1('0x36')][_0x14c1('0x43')]){_0x35ddb1[_0x14c1('0x3e')]=_[_0x14c1('0x41')](_0x35ddb1[_0x14c1('0x3e')],{'$or':_[_0x14c1('0x30')](_0x35ddb1['attributes'],function(_0x46ae00){var _0xe4556e={};_0xe4556e[_0x46ae00]={'$like':'%'+_0x289932['query'][_0x14c1('0x43')]+'%'};return _0xe4556e;})});}_0x35ddb1=_[_0x14c1('0x41')]({},_0x35ddb1,_0x289932[_0x14c1('0x44')]);return db[_0x14c1('0x5f')][_0x14c1('0x1e')]({'where':_0x35ddb1['where']})[_0x14c1('0x27')](function(_0x475f82){_0x397862[_0x14c1('0x1e')]=_0x475f82;if(_0x289932[_0x14c1('0x36')]['includeAll']){_0x35ddb1[_0x14c1('0x46')]=[{'all':!![]}];}return db[_0x14c1('0x5f')]['findAll'](_0x35ddb1);})['then'](function(_0x13453d){_0x397862[_0x14c1('0x48')]=_0x13453d;return _0x397862;});}})['then'](respondWithFilteredResult(_0x398253,_0x35ddb1))[_0x14c1('0x49')](handleError(_0x398253,null));};function char(_0x21a5b0){return'number'===typeof _0x21a5b0?String[_0x14c1('0x61')][_0x14c1('0x22')](null,arguments):_0x21a5b0;}function needsEncapsulation(_0x424f16){return!!_0x424f16&&(_0x424f16['toString']()[_0x14c1('0x62')](char(0xd))>=0x0||_0x424f16[_0x14c1('0x63')]()[_0x14c1('0x62')](char(0xa))>=0x0||_0x424f16[_0x14c1('0x63')]()[_0x14c1('0x62')](char(0x2c))>=0x0||_0x424f16[_0x14c1('0x63')]()[_0x14c1('0x62')](char(0x22))>=0x0);}function encapsulate(_0x44b035){var _0x2cbe50=char(0x22),_0x2d22b7='\x5c'+char(0x22),_0x4676f5=_0x44b035[_0x14c1('0x63')]()[_0x14c1('0x64')](new RegExp(_0x2cbe50,'g'),_0x2d22b7);return _0x2cbe50+_0x4676f5+_0x2cbe50;}exports[_0x14c1('0x65')]=function(_0x136d8d,_0x38a85d,_0xfc4204){var _0x507683,_0x498d67;var _0x424045={'where':{'ProjectId':_0x136d8d[_0x14c1('0x4b')]['id']}};if(_0x136d8d[_0x14c1('0x36')][_0x14c1('0x66')]){_0x424045['where'][_0x14c1('0x67')]=JSON[_0x14c1('0x68')](_0x136d8d['query'][_0x14c1('0x66')]);}return db[_0x14c1('0x5d')]['findAll'](_0x424045)[_0x14c1('0x27')](handleEntityNotFound(_0x38a85d,null))[_0x14c1('0x27')](function(_0x4df9cb){if(_0x4df9cb){_0x507683=_0x4df9cb;return db[_0x14c1('0x69')]['findAll']({'where':{'SessionId':{'$in':_[_0x14c1('0x30')](_0x507683,'id')},'ProjectId':_0x136d8d[_0x14c1('0x4b')]['id']},'order':'-createdAt'});}})[_0x14c1('0x27')](handleEntityNotFound(_0x38a85d,null))[_0x14c1('0x27')](function(_0x4ba815){if(_0x4ba815){_0x498d67=_0x4ba815;var _0x1cc4ee={};for(var _0x5082ec=0x0,_0x2cb9d1=_0x498d67[_0x14c1('0x60')];_0x5082ec<_0x2cb9d1;_0x5082ec++){if(!_0x1cc4ee[_0x14c1('0x5b')](_0x498d67[_0x5082ec][_0x14c1('0x6a')])){_0x1cc4ee[_0x498d67[_0x5082ec][_0x14c1('0x6a')]]=needsEncapsulation(_0x498d67[_0x5082ec][_0x14c1('0x6b')])?encapsulate(_0x498d67[_0x5082ec][_0x14c1('0x6b')]):_0x498d67[_0x5082ec]['question'];}}var _0x3511f4=[],_0x465744={};for(var _0x377d49=0x0,_0x15fe08=_0x507683[_0x14c1('0x60')];_0x377d49<_0x15fe08;_0x377d49++){_0x465744={'ProjectId':_0x136d8d[_0x14c1('0x4b')]['id'],'SessionId':_0x507683[_0x377d49]['id'],'StartTime':moment(_0x507683[_0x377d49][_0x14c1('0x67')])[_0x14c1('0x6c')](_0x14c1('0x6d'))};for(var _0x473899=0x0,_0x8469bd=_0x498d67[_0x14c1('0x60')];_0x473899<_0x8469bd;_0x473899++){if(_0x498d67[_0x473899][_0x14c1('0x6e')]==_0x507683[_0x377d49]['id']&&_0x1cc4ee[_0x14c1('0x5b')](_0x498d67[_0x473899][_0x14c1('0x6a')])){_0x465744[_0x1cc4ee[_0x498d67[_0x473899][_0x14c1('0x6a')]]]=_0x498d67[_0x473899][_0x14c1('0x6f')];}}for(var _0x83ace9 in _0x1cc4ee){if(!_0x465744[_0x14c1('0x5b')](_0x1cc4ee[_0x83ace9])){_0x465744[_0x1cc4ee[_0x83ace9]]=null;}}_0x3511f4[_0x14c1('0x70')](_0x465744);}return _0x3511f4;}})[_0x14c1('0x27')](function(_0x2e7099){if(!_[_0x14c1('0x71')](_0x2e7099)){var _0x38129a=toCsv(_0x2e7099);var _0x36898a=Date[_0x14c1('0x72')]();fs['writeFileSync'](util[_0x14c1('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x136d8d[_0x14c1('0x4b')]['id'],_0x36898a),_0x38129a);_0x38a85d[_0x14c1('0x73')](_0x14c1('0x74'),'attachment;\x20filename='+util[_0x14c1('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x136d8d[_0x14c1('0x4b')]['id'],_0x36898a));_0x38a85d['setHeader']('Content-type',_0x14c1('0x75'));return _0x38a85d[_0x14c1('0x76')](util['format'](_0x14c1('0x77'),_0x136d8d[_0x14c1('0x4b')]['id'],_0x36898a));}else{return _0x38a85d['sendStatus'](0xcc);}})[_0x14c1('0x49')](handleError(_0x38a85d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index c276177..8adf12b 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 _0xcff2=['path','../../config/environment','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3496d3,_0x4467a2){var _0x509096=function(_0xcc66bc){while(--_0xcc66bc){_0x3496d3['push'](_0x3496d3['shift']());}};_0x509096(++_0x4467a2);}(_0xcff2,0x131));var _0x2cff=function(_0xd21fe7,_0x225a39){_0xd21fe7=_0xd21fe7-0x0;var _0x14d570=_0xcff2[_0xd21fe7];return _0x14d570;};'use strict';var _=require(_0x2cff('0x0'));var util=require(_0x2cff('0x1'));var logger=require(_0x2cff('0x2'))(_0x2cff('0x3'));var moment=require(_0x2cff('0x4'));var BPromise=require(_0x2cff('0x5'));var rp=require(_0x2cff('0x6'));var fs=require('fs');var path=require(_0x2cff('0x7'));var rimraf=require('rimraf');var config=require(_0x2cff('0x8'));var attributes=require('./jscriptyProject.attributes');module[_0x2cff('0x9')]=function(_0x2145c7,_0x4f5410){return _0x2145c7[_0x2cff('0xa')](_0x2cff('0xb'),attributes,{'tableName':_0x2cff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8080=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x398e5b,_0x22090e){var _0x967c7=function(_0x3388ba){while(--_0x3388ba){_0x398e5b['push'](_0x398e5b['shift']());}};_0x967c7(++_0x22090e);}(_0x8080,0xf4));var _0x0808=function(_0x59403a,_0x54305f){_0x59403a=_0x59403a-0x0;var _0x2bfba2=_0x8080[_0x59403a];return _0x2bfba2;};'use strict';var _=require(_0x0808('0x0'));var util=require(_0x0808('0x1'));var logger=require(_0x0808('0x2'))(_0x0808('0x3'));var moment=require(_0x0808('0x4'));var BPromise=require(_0x0808('0x5'));var rp=require(_0x0808('0x6'));var fs=require('fs');var path=require(_0x0808('0x7'));var rimraf=require(_0x0808('0x8'));var config=require(_0x0808('0x9'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x137f30,_0x26013d){return _0x137f30[_0x0808('0xa')](_0x0808('0xb'),attributes,{'tableName':_0x0808('0xc'),'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 c14c91b..07c9c74 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 _0xb6eb=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','request','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyProject,\x20%s,\x20%s','message','info','request\x20sent','catch','lodash','moment','randomstring'];(function(_0x2d9a09,_0x112ef7){var _0x4c52fd=function(_0x561ffc){while(--_0x561ffc){_0x2d9a09['push'](_0x2d9a09['shift']());}};_0x4c52fd(++_0x112ef7);}(_0xb6eb,0x18c));var _0xbb6e=function(_0x316db7,_0x409739){_0x316db7=_0x316db7-0x0;var _0x47c299=_0xb6eb[_0x316db7];return _0x47c299;};'use strict';var _=require(_0xbb6e('0x0'));var util=require('util');var moment=require(_0xbb6e('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb6e('0x2'));var fs=require('fs');var Redis=require(_0xbb6e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb6e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbb6e('0x5'));var jayson=require(_0xbb6e('0x6'));var client=jayson[_0xbb6e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x452687,_0x26437f,_0x1e99b7){return new BPromise(function(_0x348e61,_0x15304c){return client[_0xbb6e('0x8')](_0x452687,_0x1e99b7)['then'](function(_0x57958d){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x26437f,'request\x20sent');logger[_0xbb6e('0x9')](_0xbb6e('0xa'),_0x26437f,'request\x20sent',JSON[_0xbb6e('0xb')](_0x57958d));if(_0x57958d[_0xbb6e('0xc')]){if(_0x57958d['error'][_0xbb6e('0xd')]===0x1f4){logger['error'](_0xbb6e('0xe'),_0x26437f,_0x57958d[_0xbb6e('0xc')][_0xbb6e('0xf')]);return _0x15304c(_0x57958d[_0xbb6e('0xc')]['message']);}logger[_0xbb6e('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x26437f,_0x57958d[_0xbb6e('0xc')][_0xbb6e('0xf')]);return _0x348e61(_0x57958d[_0xbb6e('0xc')]['message']);}else{logger[_0xbb6e('0x10')](_0xbb6e('0xe'),_0x26437f,_0xbb6e('0x11'));_0x348e61(_0x57958d['result'][_0xbb6e('0xf')]);}})[_0xbb6e('0x12')](function(_0x395c47){logger[_0xbb6e('0xc')](_0xbb6e('0xe'),_0x26437f,_0x395c47);_0x15304c(_0x395c47);});});} \ No newline at end of file +var _0x7915=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','JscriptyProject,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x32fc6d,_0xa1cfe9){var _0x45eb18=function(_0xc5588d){while(--_0xc5588d){_0x32fc6d['push'](_0x32fc6d['shift']());}};_0x45eb18(++_0xa1cfe9);}(_0x7915,0x1c8));var _0x5791=function(_0x46d3f8,_0x59908f){_0x46d3f8=_0x46d3f8-0x0;var _0x31a208=_0x7915[_0x46d3f8];return _0x31a208;};'use strict';var _=require(_0x5791('0x0'));var util=require(_0x5791('0x1'));var moment=require('moment');var BPromise=require(_0x5791('0x2'));var rs=require(_0x5791('0x3'));var fs=require('fs');var Redis=require(_0x5791('0x4'));var db=require(_0x5791('0x5'))['db'];var utils=require(_0x5791('0x6'));var logger=require('../../config/logger')(_0x5791('0x7'));var config=require(_0x5791('0x8'));var jayson=require(_0x5791('0x9'));var client=jayson[_0x5791('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6232,_0x39fc9c,_0x324b61){return new BPromise(function(_0x2d6e9a,_0x49e23f){return client[_0x5791('0xb')](_0x3f6232,_0x324b61)[_0x5791('0xc')](function(_0xe41225){logger['info'](_0x5791('0xd'),_0x39fc9c,_0x5791('0xe'));logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x39fc9c,_0x5791('0xe'),JSON['stringify'](_0xe41225));if(_0xe41225[_0x5791('0xf')]){if(_0xe41225[_0x5791('0xf')][_0x5791('0x10')]===0x1f4){logger[_0x5791('0xf')](_0x5791('0xd'),_0x39fc9c,_0xe41225[_0x5791('0xf')]['message']);return _0x49e23f(_0xe41225[_0x5791('0xf')][_0x5791('0x11')]);}logger[_0x5791('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x39fc9c,_0xe41225[_0x5791('0xf')][_0x5791('0x11')]);return _0x2d6e9a(_0xe41225['error']['message']);}else{logger[_0x5791('0x12')](_0x5791('0xd'),_0x39fc9c,_0x5791('0xe'));_0x2d6e9a(_0xe41225[_0x5791('0x13')]['message']);}})[_0x5791('0x14')](function(_0x3e09b4){logger[_0x5791('0xf')](_0x5791('0xd'),_0x39fc9c,_0x3e09b4);_0x49e23f(_0x3e09b4);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 24c496a..180d382 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 _0x5296=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x4bbde6,_0x5cc57a){var _0x3d8423=function(_0x278080){while(--_0x278080){_0x4bbde6['push'](_0x4bbde6['shift']());}};_0x3d8423(++_0x5cc57a);}(_0x5296,0x137));var _0x6529=function(_0x5e43ba,_0x168d05){_0x5e43ba=_0x5e43ba-0x0;var _0x2bb4f4=_0x5296[_0x5e43ba];return _0x2bb4f4;};'use strict';var multer=require(_0x6529('0x0'));var util=require(_0x6529('0x1'));var path=require(_0x6529('0x2'));var timeout=require('connect-timeout');var express=require(_0x6529('0x3'));var router=express[_0x6529('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6529('0x5'));var config=require(_0x6529('0x6'));var controller=require(_0x6529('0x7'));router[_0x6529('0x8')]('/',auth[_0x6529('0x9')](),controller[_0x6529('0xa')]);router[_0x6529('0x8')](_0x6529('0xb'),auth[_0x6529('0x9')](),controller['describe']);router['get']('/:id',auth[_0x6529('0x9')](),controller[_0x6529('0xc')]);router['post']('/',auth[_0x6529('0x9')](),controller[_0x6529('0xd')]);router[_0x6529('0xe')](_0x6529('0xf'),auth[_0x6529('0x9')](),controller[_0x6529('0x10')]);router[_0x6529('0x11')]('/:id',auth[_0x6529('0x9')](),controller[_0x6529('0x12')]);module[_0x6529('0x13')]=router; \ No newline at end of file +var _0xb358=['post','put','update','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x17bdab,_0x199650){var _0x4e2989=function(_0x360c15){while(--_0x360c15){_0x17bdab['push'](_0x17bdab['shift']());}};_0x4e2989(++_0x199650);}(_0xb358,0x181));var _0x8b35=function(_0x213560,_0x26e9ba){_0x213560=_0x213560-0x0;var _0xb1e3bd=_0xb358[_0x213560];return _0xb1e3bd;};'use strict';var multer=require('multer');var util=require(_0x8b35('0x0'));var path=require(_0x8b35('0x1'));var timeout=require(_0x8b35('0x2'));var express=require(_0x8b35('0x3'));var router=express['Router']();var auth=require(_0x8b35('0x4'));var interaction=require(_0x8b35('0x5'));var config=require(_0x8b35('0x6'));var controller=require('./jscriptyQuestionReport.controller');router[_0x8b35('0x7')]('/',auth[_0x8b35('0x8')](),controller[_0x8b35('0x9')]);router[_0x8b35('0x7')](_0x8b35('0xa'),auth[_0x8b35('0x8')](),controller[_0x8b35('0xb')]);router[_0x8b35('0x7')](_0x8b35('0xc'),auth[_0x8b35('0x8')](),controller[_0x8b35('0xd')]);router[_0x8b35('0xe')]('/',auth[_0x8b35('0x8')](),controller['create']);router[_0x8b35('0xf')](_0x8b35('0xc'),auth[_0x8b35('0x8')](),controller[_0x8b35('0x10')]);router[_0x8b35('0x11')](_0x8b35('0xc'),auth['isAuthenticated'](),controller[_0x8b35('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index f657818..c27251b 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 _0x1971=['long','STRING'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1971,0xed));var _0x1197=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x1971[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x1197('0x0')]},'answer':{'type':Sequelize['TEXT'](_0x1197('0x1'))},'membername':{'type':Sequelize[_0x1197('0x0')]},'projectname':{'type':Sequelize[_0x1197('0x0')]},'queue':{'type':Sequelize[_0x1197('0x0')]},'uniqueid':{'type':Sequelize[_0x1197('0x0')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x1197('0x0')]}}; \ No newline at end of file +var _0x3bdd=['STRING','exports','long'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x3bdd,0xac));var _0xd3bd=function(_0x26218d,_0x1870b1){_0x26218d=_0x26218d-0x0;var _0x339f3b=_0x3bdd[_0x26218d];return _0x339f3b;};'use strict';var Sequelize=require('sequelize');module[_0xd3bd('0x0')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0xd3bd('0x1'))},'membername':{'type':Sequelize[_0xd3bd('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd3bd('0x2')]},'uniqueid':{'type':Sequelize[_0xd3bd('0x2')]},'calleridname':{'type':Sequelize[_0xd3bd('0x2')]},'calleridnum':{'type':Sequelize[_0xd3bd('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index abf5419..914c563 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 _0x14af=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','JscriptyQuestionReport','includeAll','include','findAll','rows','show','fields','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x535fe2,_0x1386c1){var _0x3dbe45=function(_0x3003b7){while(--_0x3003b7){_0x535fe2['push'](_0x535fe2['shift']());}};_0x3dbe45(++_0x1386c1);}(_0x14af,0x90));var _0xf14a=function(_0x4ee21a,_0x3d84c7){_0x4ee21a=_0x4ee21a-0x0;var _0x42608d=_0x14af[_0x4ee21a];return _0x42608d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf14a('0x0'));var rimraf=require(_0xf14a('0x1'));var zipdir=require(_0xf14a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf14a('0x3'));var moment=require(_0xf14a('0x4'));var BPromise=require(_0xf14a('0x5'));var Mustache=require('mustache');var util=require(_0xf14a('0x6'));var path=require(_0xf14a('0x7'));var sox=require(_0xf14a('0x8'));var csv=require(_0xf14a('0x9'));var ejs=require(_0xf14a('0xa'));var fs=require('fs');var _=require(_0xf14a('0xb'));var squel=require(_0xf14a('0xc'));var crypto=require(_0xf14a('0xd'));var jsforce=require(_0xf14a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf14a('0x9'));var querystring=require(_0xf14a('0xf'));var Papa=require(_0xf14a('0x10'));var Redis=require(_0xf14a('0x11'));var authService=require(_0xf14a('0x12'));var qs=require(_0xf14a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf14a('0x14'));var logger=require('../../config/logger')(_0xf14a('0x15'));var utils=require(_0xf14a('0x16'));var config=require(_0xf14a('0x17'));var licenseUtil=require(_0xf14a('0x18'));var db=require(_0xf14a('0x19'))['db'];function respondWithStatusCode(_0x1bb191,_0x390f1f){_0x390f1f=_0x390f1f||0xcc;return function(_0x16186b){if(_0x16186b){return _0x1bb191[_0xf14a('0x1a')](_0x390f1f);}return _0x1bb191['status'](_0x390f1f)[_0xf14a('0x1b')]();};}function respondWithResult(_0x2d3cfc,_0x59ba8b){_0x59ba8b=_0x59ba8b||0xc8;return function(_0x171fbf){if(_0x171fbf){return _0x2d3cfc[_0xf14a('0x1c')](_0x59ba8b)['json'](_0x171fbf);}};}function respondWithFilteredResult(_0x6437a6,_0x5d3ef0){return function(_0x5dc25a){if(_0x5dc25a){var _0x4ef451=_0x5dc25a[_0xf14a('0x1d')],_0x114353=_0x5d3ef0['offset'],_0x5ca7f3=_0x5d3ef0[_0xf14a('0x1e')]+_0x5d3ef0[_0xf14a('0x1f')],_0x16305f;if(_0x5ca7f3>=_0x4ef451){_0x5ca7f3=_0x4ef451;_0x16305f=0xc8;}else{_0x16305f=0xce;}_0x6437a6[_0xf14a('0x1c')](_0x16305f);return _0x6437a6[_0xf14a('0x20')](_0xf14a('0x21'),_0x114353+'-'+_0x5ca7f3+'/'+_0x4ef451)[_0xf14a('0x22')](_0x5dc25a);}return null;};}function patchUpdates(_0x2c7c84){return function(_0x42634c){try{jsonpatch['apply'](_0x42634c,_0x2c7c84,!![]);}catch(_0x236f2c){return BPromise[_0xf14a('0x23')](_0x236f2c);}return _0x42634c[_0xf14a('0x24')]();};}function saveUpdates(_0x4c5b61,_0x584ee8){return function(_0x30edae){if(_0x30edae){return _0x30edae[_0xf14a('0x25')](_0x4c5b61)[_0xf14a('0x26')](function(_0x3d64f7){return _0x3d64f7;});}return null;};}function removeEntity(_0x145f66,_0x1dc552){return function(_0x44e241){if(_0x44e241){return _0x44e241[_0xf14a('0x27')]()['then'](function(){_0x145f66[_0xf14a('0x1c')](0xcc)[_0xf14a('0x1b')]();});}};}function handleEntityNotFound(_0x565f8e,_0x3366e3){return function(_0x5e64b6){if(!_0x5e64b6){_0x565f8e[_0xf14a('0x1a')](0x194);}return _0x5e64b6;};}function handleError(_0x2746ef,_0x2ff2d2){_0x2ff2d2=_0x2ff2d2||0x1f4;return function(_0x37f278){logger[_0xf14a('0x28')](_0x37f278[_0xf14a('0x29')]);if(_0x37f278[_0xf14a('0x2a')]){delete _0x37f278['name'];}_0x2746ef[_0xf14a('0x1c')](_0x2ff2d2)[_0xf14a('0x2b')](_0x37f278);};}exports[_0xf14a('0x2c')]=function(_0x1ded64,_0x12f858){var _0x41bc55={},_0x57c452={},_0x4b247e={'count':0x0,'rows':[]};var _0x33b7b3=_[_0xf14a('0x2d')](db['JscriptyQuestionReport'][_0xf14a('0x2e')],function(_0x1880fc){return{'name':_0x1880fc[_0xf14a('0x2f')],'type':_0x1880fc[_0xf14a('0x30')][_0xf14a('0x31')]};});_0x57c452[_0xf14a('0x32')]=_['map'](_0x33b7b3,_0xf14a('0x2a'));_0x57c452[_0xf14a('0x33')]=_[_0xf14a('0x34')](_0x1ded64[_0xf14a('0x33')]);_0x57c452[_0xf14a('0x35')]=_[_0xf14a('0x36')](_0x57c452[_0xf14a('0x32')],_0x57c452[_0xf14a('0x33')]);_0x41bc55[_0xf14a('0x37')]=_['intersection'](_0x57c452[_0xf14a('0x32')],qs['fields'](_0x1ded64[_0xf14a('0x33')]['fields']));_0x41bc55[_0xf14a('0x37')]=_0x41bc55['attributes'][_0xf14a('0x38')]?_0x41bc55['attributes']:_0x57c452[_0xf14a('0x32')];if(!_0x1ded64[_0xf14a('0x33')][_0xf14a('0x39')](_0xf14a('0x3a'))){_0x41bc55[_0xf14a('0x1f')]=qs['limit'](_0x1ded64[_0xf14a('0x33')]['limit']);_0x41bc55['offset']=qs[_0xf14a('0x1e')](_0x1ded64[_0xf14a('0x33')][_0xf14a('0x1e')]);}_0x41bc55[_0xf14a('0x3b')]=qs[_0xf14a('0x3c')](_0x1ded64[_0xf14a('0x33')]['sort']);_0x41bc55[_0xf14a('0x3d')]=qs[_0xf14a('0x35')](_[_0xf14a('0x3e')](_0x1ded64[_0xf14a('0x33')],_0x57c452['filters']),_0x33b7b3);if(_0x1ded64[_0xf14a('0x33')][_0xf14a('0x3f')]){_0x41bc55[_0xf14a('0x3d')]=_[_0xf14a('0x40')](_0x41bc55['where'],{'$or':_[_0xf14a('0x2d')](_0x33b7b3,function(_0x16a1de){if(_0x16a1de[_0xf14a('0x30')]!=='VIRTUAL'){var _0xfd2e6f={};_0xfd2e6f[_0x16a1de[_0xf14a('0x2a')]]={'$like':'%'+_0x1ded64[_0xf14a('0x33')][_0xf14a('0x3f')]+'%'};return _0xfd2e6f;}})});}_0x41bc55=_[_0xf14a('0x40')]({},_0x41bc55,_0x1ded64[_0xf14a('0x41')]);var _0x4b7387={'where':_0x41bc55['where']};return db[_0xf14a('0x42')][_0xf14a('0x1d')](_0x4b7387)[_0xf14a('0x26')](function(_0x2fdf8c){_0x4b247e[_0xf14a('0x1d')]=_0x2fdf8c;if(_0x1ded64['query'][_0xf14a('0x43')]){_0x41bc55[_0xf14a('0x44')]=[{'all':!![]}];}return db[_0xf14a('0x42')][_0xf14a('0x45')](_0x41bc55);})['then'](function(_0x1d0539){_0x4b247e[_0xf14a('0x46')]=_0x1d0539;return _0x4b247e;})[_0xf14a('0x26')](respondWithFilteredResult(_0x12f858,_0x41bc55))['catch'](handleError(_0x12f858,null));};exports[_0xf14a('0x47')]=function(_0x33777e,_0x2f878b){var _0x2cfa0f={'raw':!![],'where':{'id':_0x33777e['params']['id']}},_0x2cc272={};_0x2cc272[_0xf14a('0x32')]=_[_0xf14a('0x34')](db[_0xf14a('0x42')]['rawAttributes']);_0x2cc272[_0xf14a('0x33')]=_[_0xf14a('0x34')](_0x33777e[_0xf14a('0x33')]);_0x2cc272[_0xf14a('0x35')]=_[_0xf14a('0x36')](_0x2cc272['model'],_0x2cc272[_0xf14a('0x33')]);_0x2cfa0f[_0xf14a('0x37')]=_[_0xf14a('0x36')](_0x2cc272['model'],qs[_0xf14a('0x48')](_0x33777e[_0xf14a('0x33')][_0xf14a('0x48')]));_0x2cfa0f[_0xf14a('0x37')]=_0x2cfa0f[_0xf14a('0x37')][_0xf14a('0x38')]?_0x2cfa0f['attributes']:_0x2cc272[_0xf14a('0x32')];if(_0x33777e[_0xf14a('0x33')][_0xf14a('0x43')]){_0x2cfa0f['include']=[{'all':!![]}];}_0x2cfa0f=_[_0xf14a('0x40')]({},_0x2cfa0f,_0x33777e[_0xf14a('0x41')]);return db[_0xf14a('0x42')][_0xf14a('0x49')](_0x2cfa0f)['then'](handleEntityNotFound(_0x2f878b,null))[_0xf14a('0x26')](respondWithResult(_0x2f878b,null))[_0xf14a('0x4a')](handleError(_0x2f878b,null));};exports[_0xf14a('0x4b')]=function(_0x7736c,_0x5e5719){return db[_0xf14a('0x42')][_0xf14a('0x4b')](_0x7736c[_0xf14a('0x4c')],{})[_0xf14a('0x26')](respondWithResult(_0x5e5719,0xc9))['catch'](handleError(_0x5e5719,null));};exports['update']=function(_0x44d44d,_0x3209b5){if(_0x44d44d[_0xf14a('0x4c')]['id']){delete _0x44d44d['body']['id'];}return db['JscriptyQuestionReport'][_0xf14a('0x49')]({'where':{'id':_0x44d44d[_0xf14a('0x4d')]['id']}})[_0xf14a('0x26')](handleEntityNotFound(_0x3209b5,null))[_0xf14a('0x26')](saveUpdates(_0x44d44d[_0xf14a('0x4c')],null))[_0xf14a('0x26')](respondWithResult(_0x3209b5,null))['catch'](handleError(_0x3209b5,null));};exports[_0xf14a('0x27')]=function(_0x580a34,_0x3c4b1c){return db[_0xf14a('0x42')]['find']({'where':{'id':_0x580a34[_0xf14a('0x4d')]['id']}})[_0xf14a('0x26')](handleEntityNotFound(_0x3c4b1c,null))['then'](removeEntity(_0x3c4b1c,null))[_0xf14a('0x4a')](handleError(_0x3c4b1c,null));};exports[_0xf14a('0x4e')]=function(_0x1816f3,_0x2d6641){return db[_0xf14a('0x42')]['describe']()['then'](respondWithResult(_0x2d6641,null))['catch'](handleError(_0x2d6641,null));}; \ No newline at end of file +var _0xa26a=['update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','JscriptyQuestionReport','findAll','catch','keys','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa26a,0x72));var _0xaa26=function(_0x2bee2a,_0x3218e8){_0x2bee2a=_0x2bee2a-0x0;var _0x4407ce=_0xa26a[_0x2bee2a];return _0x4407ce;};'use strict';var pdf=require(_0xaa26('0x0'));var emlformat=require(_0xaa26('0x1'));var rimraf=require(_0xaa26('0x2'));var zipdir=require(_0xaa26('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa26('0x4'));var moment=require(_0xaa26('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaa26('0x6'));var util=require(_0xaa26('0x7'));var path=require(_0xaa26('0x8'));var sox=require('sox');var csv=require(_0xaa26('0x9'));var ejs=require(_0xaa26('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa26('0xb'));var jsforce=require(_0xaa26('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa26('0xd'));var Papa=require(_0xaa26('0xe'));var Redis=require(_0xaa26('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xaa26('0x10'));var as=require(_0xaa26('0x11'));var hardwareService=require(_0xaa26('0x12'));var logger=require(_0xaa26('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaa26('0x14'));var db=require(_0xaa26('0x15'))['db'];function respondWithStatusCode(_0x2eb4f2,_0x13fcd3){_0x13fcd3=_0x13fcd3||0xcc;return function(_0x1b72fc){if(_0x1b72fc){return _0x2eb4f2[_0xaa26('0x16')](_0x13fcd3);}return _0x2eb4f2[_0xaa26('0x17')](_0x13fcd3)[_0xaa26('0x18')]();};}function respondWithResult(_0x2dc724,_0x4d9bf6){_0x4d9bf6=_0x4d9bf6||0xc8;return function(_0x5dfc2c){if(_0x5dfc2c){return _0x2dc724[_0xaa26('0x17')](_0x4d9bf6)[_0xaa26('0x19')](_0x5dfc2c);}};}function respondWithFilteredResult(_0x3849bc,_0x1098c4){return function(_0x1c0dba){if(_0x1c0dba){var _0x3edd50=_0x1c0dba[_0xaa26('0x1a')],_0x4202cf=_0x1098c4['offset'],_0x271e0d=_0x1098c4[_0xaa26('0x1b')]+_0x1098c4[_0xaa26('0x1c')],_0x14e7cb;if(_0x271e0d>=_0x3edd50){_0x271e0d=_0x3edd50;_0x14e7cb=0xc8;}else{_0x14e7cb=0xce;}_0x3849bc[_0xaa26('0x17')](_0x14e7cb);return _0x3849bc['set'](_0xaa26('0x1d'),_0x4202cf+'-'+_0x271e0d+'/'+_0x3edd50)[_0xaa26('0x19')](_0x1c0dba);}return null;};}function patchUpdates(_0x24f86a){return function(_0x514ee0){try{jsonpatch['apply'](_0x514ee0,_0x24f86a,!![]);}catch(_0x10436d){return BPromise[_0xaa26('0x1e')](_0x10436d);}return _0x514ee0[_0xaa26('0x1f')]();};}function saveUpdates(_0x33c75a,_0x36cc87){return function(_0x473f66){if(_0x473f66){return _0x473f66[_0xaa26('0x20')](_0x33c75a)[_0xaa26('0x21')](function(_0xdaac88){return _0xdaac88;});}return null;};}function removeEntity(_0x2222a1,_0x2e40d9){return function(_0x12bdab){if(_0x12bdab){return _0x12bdab[_0xaa26('0x22')]()[_0xaa26('0x21')](function(){_0x2222a1[_0xaa26('0x17')](0xcc)[_0xaa26('0x18')]();});}};}function handleEntityNotFound(_0x3ade96,_0x5520e4){return function(_0x4e045c){if(!_0x4e045c){_0x3ade96[_0xaa26('0x16')](0x194);}return _0x4e045c;};}function handleError(_0x597191,_0x1342be){_0x1342be=_0x1342be||0x1f4;return function(_0x2be137){logger[_0xaa26('0x23')](_0x2be137[_0xaa26('0x24')]);if(_0x2be137[_0xaa26('0x25')]){delete _0x2be137['name'];}_0x597191[_0xaa26('0x17')](_0x1342be)[_0xaa26('0x26')](_0x2be137);};}exports[_0xaa26('0x27')]=function(_0x24042d,_0x5d8e59){var _0x2c850a={},_0x17b476={},_0xd3664b={'count':0x0,'rows':[]};var _0x455d3e=_[_0xaa26('0x28')](db['JscriptyQuestionReport'][_0xaa26('0x29')],function(_0x5f5049){return{'name':_0x5f5049[_0xaa26('0x2a')],'type':_0x5f5049[_0xaa26('0x2b')][_0xaa26('0x2c')]};});_0x17b476[_0xaa26('0x2d')]=_[_0xaa26('0x28')](_0x455d3e,'name');_0x17b476['query']=_['keys'](_0x24042d[_0xaa26('0x2e')]);_0x17b476['filters']=_[_0xaa26('0x2f')](_0x17b476['model'],_0x17b476[_0xaa26('0x2e')]);_0x2c850a[_0xaa26('0x30')]=_['intersection'](_0x17b476[_0xaa26('0x2d')],qs[_0xaa26('0x31')](_0x24042d[_0xaa26('0x2e')][_0xaa26('0x31')]));_0x2c850a[_0xaa26('0x30')]=_0x2c850a[_0xaa26('0x30')][_0xaa26('0x32')]?_0x2c850a[_0xaa26('0x30')]:_0x17b476[_0xaa26('0x2d')];if(!_0x24042d[_0xaa26('0x2e')][_0xaa26('0x33')](_0xaa26('0x34'))){_0x2c850a[_0xaa26('0x1c')]=qs[_0xaa26('0x1c')](_0x24042d[_0xaa26('0x2e')][_0xaa26('0x1c')]);_0x2c850a['offset']=qs[_0xaa26('0x1b')](_0x24042d[_0xaa26('0x2e')]['offset']);}_0x2c850a[_0xaa26('0x35')]=qs[_0xaa26('0x36')](_0x24042d[_0xaa26('0x2e')]['sort']);_0x2c850a[_0xaa26('0x37')]=qs[_0xaa26('0x38')](_[_0xaa26('0x39')](_0x24042d[_0xaa26('0x2e')],_0x17b476['filters']),_0x455d3e);if(_0x24042d['query']['filter']){_0x2c850a[_0xaa26('0x37')]=_[_0xaa26('0x3a')](_0x2c850a[_0xaa26('0x37')],{'$or':_['map'](_0x455d3e,function(_0x57f832){if(_0x57f832[_0xaa26('0x2b')]!==_0xaa26('0x3b')){var _0x334c91={};_0x334c91[_0x57f832[_0xaa26('0x25')]]={'$like':'%'+_0x24042d[_0xaa26('0x2e')][_0xaa26('0x3c')]+'%'};return _0x334c91;}})});}_0x2c850a=_[_0xaa26('0x3a')]({},_0x2c850a,_0x24042d[_0xaa26('0x3d')]);var _0x1495e1={'where':_0x2c850a[_0xaa26('0x37')]};return db['JscriptyQuestionReport'][_0xaa26('0x1a')](_0x1495e1)[_0xaa26('0x21')](function(_0x2ce07f){_0xd3664b['count']=_0x2ce07f;if(_0x24042d[_0xaa26('0x2e')][_0xaa26('0x3e')]){_0x2c850a[_0xaa26('0x3f')]=[{'all':!![]}];}return db[_0xaa26('0x40')][_0xaa26('0x41')](_0x2c850a);})[_0xaa26('0x21')](function(_0x36b11c){_0xd3664b['rows']=_0x36b11c;return _0xd3664b;})[_0xaa26('0x21')](respondWithFilteredResult(_0x5d8e59,_0x2c850a))[_0xaa26('0x42')](handleError(_0x5d8e59,null));};exports['show']=function(_0x394c7a,_0x5693c9){var _0x4e2293={'raw':!![],'where':{'id':_0x394c7a['params']['id']}},_0x1369df={};_0x1369df[_0xaa26('0x2d')]=_[_0xaa26('0x43')](db[_0xaa26('0x40')][_0xaa26('0x29')]);_0x1369df[_0xaa26('0x2e')]=_[_0xaa26('0x43')](_0x394c7a['query']);_0x1369df[_0xaa26('0x38')]=_['intersection'](_0x1369df['model'],_0x1369df[_0xaa26('0x2e')]);_0x4e2293[_0xaa26('0x30')]=_['intersection'](_0x1369df[_0xaa26('0x2d')],qs[_0xaa26('0x31')](_0x394c7a[_0xaa26('0x2e')]['fields']));_0x4e2293['attributes']=_0x4e2293[_0xaa26('0x30')][_0xaa26('0x32')]?_0x4e2293['attributes']:_0x1369df['model'];if(_0x394c7a[_0xaa26('0x2e')][_0xaa26('0x3e')]){_0x4e2293[_0xaa26('0x3f')]=[{'all':!![]}];}_0x4e2293=_['merge']({},_0x4e2293,_0x394c7a[_0xaa26('0x3d')]);return db[_0xaa26('0x40')]['find'](_0x4e2293)[_0xaa26('0x21')](handleEntityNotFound(_0x5693c9,null))[_0xaa26('0x21')](respondWithResult(_0x5693c9,null))['catch'](handleError(_0x5693c9,null));};exports[_0xaa26('0x44')]=function(_0x13c99a,_0x2a56d8){return db[_0xaa26('0x40')][_0xaa26('0x44')](_0x13c99a['body'],{})['then'](respondWithResult(_0x2a56d8,0xc9))[_0xaa26('0x42')](handleError(_0x2a56d8,null));};exports['update']=function(_0x15ae79,_0x10f01d){if(_0x15ae79[_0xaa26('0x45')]['id']){delete _0x15ae79[_0xaa26('0x45')]['id'];}return db['JscriptyQuestionReport'][_0xaa26('0x46')]({'where':{'id':_0x15ae79['params']['id']}})[_0xaa26('0x21')](handleEntityNotFound(_0x10f01d,null))[_0xaa26('0x21')](saveUpdates(_0x15ae79[_0xaa26('0x45')],null))[_0xaa26('0x21')](respondWithResult(_0x10f01d,null))[_0xaa26('0x42')](handleError(_0x10f01d,null));};exports[_0xaa26('0x22')]=function(_0x429b92,_0x1212d4){return db[_0xaa26('0x40')][_0xaa26('0x46')]({'where':{'id':_0x429b92[_0xaa26('0x47')]['id']}})[_0xaa26('0x21')](handleEntityNotFound(_0x1212d4,null))['then'](removeEntity(_0x1212d4,null))['catch'](handleError(_0x1212d4,null));};exports[_0xaa26('0x48')]=function(_0x32b9d0,_0x43b006){return db['JscriptyQuestionReport'][_0xaa26('0x48')]()[_0xaa26('0x21')](respondWithResult(_0x43b006,null))[_0xaa26('0x42')](handleError(_0x43b006,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index c2531a4..5017c55 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 _0x4637=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','define','report_jscripty_questions'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x4637,0x1d4));var _0x7463=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x4637[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x7463('0x0'));var logger=require(_0x7463('0x1'))('api');var moment=require(_0x7463('0x2'));var BPromise=require(_0x7463('0x3'));var rp=require(_0x7463('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7463('0x5'));var config=require(_0x7463('0x6'));var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x2de091,_0x2b30c9){return _0x2de091[_0x7463('0x7')]('JscriptyQuestionReport',attributes,{'tableName':_0x7463('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x084b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util'];(function(_0x4c9dd8,_0x43c615){var _0x581000=function(_0x16f1d6){while(--_0x16f1d6){_0x4c9dd8['push'](_0x4c9dd8['shift']());}};_0x581000(++_0x43c615);}(_0x084b,0x16a));var _0xb084=function(_0x4322c6,_0x28f126){_0x4322c6=_0x4322c6-0x0;var _0x4e7537=_0x084b[_0x4322c6];return _0x4e7537;};'use strict';var _=require(_0xb084('0x0'));var util=require(_0xb084('0x1'));var logger=require('../../config/logger')(_0xb084('0x2'));var moment=require(_0xb084('0x3'));var BPromise=require(_0xb084('0x4'));var rp=require(_0xb084('0x5'));var fs=require('fs');var path=require(_0xb084('0x6'));var rimraf=require(_0xb084('0x7'));var config=require(_0xb084('0x8'));var attributes=require(_0xb084('0x9'));module[_0xb084('0xa')]=function(_0x3c18b0,_0x3a1a0c){return _0x3c18b0[_0xb084('0xb')](_0xb084('0xc'),attributes,{'tableName':_0xb084('0xd'),'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 d9706f0..a563c23 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 _0xbf01=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2bbad9,_0x1f3892){var _0x1683cb=function(_0x262672){while(--_0x262672){_0x2bbad9['push'](_0x2bbad9['shift']());}};_0x1683cb(++_0x1f3892);}(_0xbf01,0xfa));var _0x1bf0=function(_0x378b4,_0x5ca7fa){_0x378b4=_0x378b4-0x0;var _0x11d07b=_0xbf01[_0x378b4];return _0x11d07b;};'use strict';var _=require(_0x1bf0('0x0'));var util=require(_0x1bf0('0x1'));var moment=require(_0x1bf0('0x2'));var BPromise=require(_0x1bf0('0x3'));var rs=require(_0x1bf0('0x4'));var fs=require('fs');var Redis=require(_0x1bf0('0x5'));var db=require(_0x1bf0('0x6'))['db'];var utils=require(_0x1bf0('0x7'));var logger=require(_0x1bf0('0x8'))('rpc');var config=require(_0x1bf0('0x9'));var jayson=require(_0x1bf0('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x529d33,_0x75c4e1,_0x50dd9d){return new BPromise(function(_0x4b541d,_0x39aaf6){return client[_0x1bf0('0xb')](_0x529d33,_0x50dd9d)[_0x1bf0('0xc')](function(_0x52235f){logger[_0x1bf0('0xd')](_0x1bf0('0xe'),_0x75c4e1,_0x1bf0('0xf'));logger[_0x1bf0('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x75c4e1,_0x1bf0('0xf'),JSON[_0x1bf0('0x11')](_0x52235f));if(_0x52235f[_0x1bf0('0x12')]){if(_0x52235f[_0x1bf0('0x12')][_0x1bf0('0x13')]===0x1f4){logger[_0x1bf0('0x12')](_0x1bf0('0xe'),_0x75c4e1,_0x52235f[_0x1bf0('0x12')][_0x1bf0('0x14')]);return _0x39aaf6(_0x52235f[_0x1bf0('0x12')]['message']);}logger[_0x1bf0('0x12')](_0x1bf0('0xe'),_0x75c4e1,_0x52235f[_0x1bf0('0x12')]['message']);return _0x4b541d(_0x52235f['error']['message']);}else{logger[_0x1bf0('0xd')](_0x1bf0('0xe'),_0x75c4e1,_0x1bf0('0xf'));_0x4b541d(_0x52235f[_0x1bf0('0x15')][_0x1bf0('0x14')]);}})[_0x1bf0('0x16')](function(_0x40ddb2){logger[_0x1bf0('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x75c4e1,_0x40ddb2);_0x39aaf6(_0x40ddb2);});});} \ No newline at end of file +var _0xd144=['message','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x42183d,_0x18a849){var _0x3a7ae0=function(_0x12dee1){while(--_0x12dee1){_0x42183d['push'](_0x42183d['shift']());}};_0x3a7ae0(++_0x18a849);}(_0xd144,0x99));var _0x4d14=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd144[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4d14('0x0'));var BPromise=require(_0x4d14('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d14('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4d14('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x4d14('0x4'));var jayson=require(_0x4d14('0x5'));var client=jayson[_0x4d14('0x6')][_0x4d14('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4291e6,_0x15c7ab,_0x5ad629){return new BPromise(function(_0x51b4ae,_0x333ed9){return client[_0x4d14('0x8')](_0x4291e6,_0x5ad629)[_0x4d14('0x9')](function(_0x189c70){logger[_0x4d14('0xa')](_0x4d14('0xb'),_0x15c7ab,_0x4d14('0xc'));logger[_0x4d14('0xd')](_0x4d14('0xe'),_0x15c7ab,'request\x20sent',JSON[_0x4d14('0xf')](_0x189c70));if(_0x189c70[_0x4d14('0x10')]){if(_0x189c70[_0x4d14('0x10')][_0x4d14('0x11')]===0x1f4){logger[_0x4d14('0x10')](_0x4d14('0xb'),_0x15c7ab,_0x189c70['error']['message']);return _0x333ed9(_0x189c70[_0x4d14('0x10')][_0x4d14('0x12')]);}logger[_0x4d14('0x10')](_0x4d14('0xb'),_0x15c7ab,_0x189c70['error'][_0x4d14('0x12')]);return _0x51b4ae(_0x189c70[_0x4d14('0x10')][_0x4d14('0x12')]);}else{logger[_0x4d14('0xa')](_0x4d14('0xb'),_0x15c7ab,_0x4d14('0xc'));_0x51b4ae(_0x189c70['result'][_0x4d14('0x12')]);}})['catch'](function(_0x5040f4){logger[_0x4d14('0x10')](_0x4d14('0xb'),_0x15c7ab,_0x5040f4);_0x333ed9(_0x5040f4);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8722db5..f9b0794 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 _0x6658=['../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x6658,0x198));var _0x8665=function(_0x4452ff,_0x16f7b1){_0x4452ff=_0x4452ff-0x0;var _0x392314=_0x6658[_0x4452ff];return _0x392314;};'use strict';var multer=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var path=require(_0x8665('0x2'));var timeout=require(_0x8665('0x3'));var express=require(_0x8665('0x4'));var router=express[_0x8665('0x5')]();var auth=require(_0x8665('0x6'));var interaction=require(_0x8665('0x7'));var config=require('../../config/environment');var controller=require(_0x8665('0x8'));router[_0x8665('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8665('0x9')](_0x8665('0xa'),auth[_0x8665('0xb')](),controller[_0x8665('0xc')]);router[_0x8665('0x9')](_0x8665('0xd'),auth[_0x8665('0xb')](),controller[_0x8665('0xe')]);router['get'](_0x8665('0xf'),auth[_0x8665('0xb')](),controller[_0x8665('0x10')]);router[_0x8665('0x11')]('/',auth[_0x8665('0xb')](),controller[_0x8665('0x12')]);router[_0x8665('0x13')](_0x8665('0xd'),auth[_0x8665('0xb')](),controller[_0x8665('0x14')]);router[_0x8665('0x15')](_0x8665('0xd'),auth[_0x8665('0xb')](),controller[_0x8665('0x16')]);module['exports']=router; \ No newline at end of file +var _0x5455=['getQuestions','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','/:id/questions'];(function(_0x81910,_0x1d5373){var _0x10ee67=function(_0x42a8f9){while(--_0x42a8f9){_0x81910['push'](_0x81910['shift']());}};_0x10ee67(++_0x1d5373);}(_0x5455,0x197));var _0x5545=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x5455[_0x199572];return _0x13cfa3;};'use strict';var multer=require('multer');var util=require(_0x5545('0x0'));var path=require(_0x5545('0x1'));var timeout=require(_0x5545('0x2'));var express=require(_0x5545('0x3'));var router=express[_0x5545('0x4')]();var auth=require(_0x5545('0x5'));var interaction=require(_0x5545('0x6'));var config=require('../../config/environment');var controller=require('./jscriptySessionReport.controller');router[_0x5545('0x7')]('/',auth[_0x5545('0x8')](),controller['index']);router['get'](_0x5545('0x9'),auth[_0x5545('0x8')](),controller['describe']);router[_0x5545('0x7')](_0x5545('0xa'),auth['isAuthenticated'](),controller[_0x5545('0xb')]);router[_0x5545('0x7')](_0x5545('0xc'),auth[_0x5545('0x8')](),controller[_0x5545('0xd')]);router[_0x5545('0xe')]('/',auth[_0x5545('0x8')](),controller[_0x5545('0xf')]);router[_0x5545('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5545('0x11')]);router[_0x5545('0x12')](_0x5545('0xa'),auth[_0x5545('0x8')](),controller['destroy']);module[_0x5545('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 4c7ceb0..e46abdc 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 _0x396c=['BOOLEAN','sequelize','DATE','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x396c,0x112));var _0xc396=function(_0x25868b,_0x461a39){_0x25868b=_0x25868b-0x0;var _0x2b579c=_0x396c[_0x25868b];return _0x2b579c;};'use strict';var moment=require('moment');var Sequelize=require(_0xc396('0x0'));module['exports']={'starttime':{'type':Sequelize[_0xc396('0x1')],'set':function(_0x17eed9){this['setDataValue']('starttime',_0x17eed9);this['setDataValue'](_0xc396('0x2'),moment()[_0xc396('0x3')](_0xc396('0x4')));}},'endtime':{'type':Sequelize[_0xc396('0x1')]},'membername':{'type':Sequelize[_0xc396('0x5')]},'projectname':{'type':Sequelize[_0xc396('0x5')]},'queue':{'type':Sequelize[_0xc396('0x5')]},'uniqueid':{'type':Sequelize[_0xc396('0x5')]},'calleridname':{'type':Sequelize[_0xc396('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xc396('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xac3c=['STRING','sequelize','exports','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4ed6c5,_0x382f08){var _0x43754b=function(_0x3d93b4){while(--_0x3d93b4){_0x4ed6c5['push'](_0x4ed6c5['shift']());}};_0x43754b(++_0x382f08);}(_0xac3c,0x1eb));var _0xcac3=function(_0x2e6251,_0x361899){_0x2e6251=_0x2e6251-0x0;var _0x4b4261=_0xac3c[_0x2e6251];return _0x4b4261;};'use strict';var moment=require('moment');var Sequelize=require(_0xcac3('0x0'));module[_0xcac3('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0xc06ea3){this['setDataValue']('starttime',_0xc06ea3);this[_0xcac3('0x2')](_0xcac3('0x3'),moment()[_0xcac3('0x4')](_0xcac3('0x5')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0xcac3('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xcac3('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcac3('0x6')]},'calleridnum':{'type':Sequelize[_0xcac3('0x6')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 5d6d087..86373f3 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 _0x0713=['send','map','JscriptySessionReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','rows','catch','show','length','includeAll','create','body','find','params','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','options','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x56841a,_0x3791ab){var _0x5c0b88=function(_0x27339e){while(--_0x27339e){_0x56841a['push'](_0x56841a['shift']());}};_0x5c0b88(++_0x3791ab);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=_0x1caa5d[_0x3071('0x1e')],_0x157a47=_0x1f14e1['offset'],_0x11bdc9=_0x1f14e1[_0x3071('0x1f')]+_0x1f14e1[_0x3071('0x20')],_0x21aad3;if(_0x11bdc9>=_0x2a6a4b){_0x11bdc9=_0x2a6a4b;_0x21aad3=0xc8;}else{_0x21aad3=0xce;}_0x1271d0[_0x3071('0x1b')](_0x21aad3);return _0x1271d0[_0x3071('0x21')](_0x3071('0x22'),_0x157a47+'-'+_0x11bdc9+'/'+_0x2a6a4b)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x105bbb){return function(_0x26f113){try{jsonpatch['apply'](_0x26f113,_0x105bbb,!![]);}catch(_0x359e66){return BPromise[_0x3071('0x23')](_0x359e66);}return _0x26f113[_0x3071('0x24')]();};}function saveUpdates(_0x56c267,_0xb8f4e3){return function(_0x5cd80d){if(_0x5cd80d){return _0x5cd80d[_0x3071('0x25')](_0x56c267)[_0x3071('0x26')](function(_0x3762d8){return _0x3762d8;});}return null;};}function removeEntity(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x457b57['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce48a,_0xb05b1d){return function(_0x412652){if(!_0x412652){_0x2ce48a[_0x3071('0x28')](0x194);}return _0x412652;};}function handleError(_0x2793ef,_0x44b45f){_0x44b45f=_0x44b45f||0x1f4;return function(_0x7a4cb4){logger[_0x3071('0x29')](_0x7a4cb4[_0x3071('0x2a')]);if(_0x7a4cb4['name']){delete _0x7a4cb4[_0x3071('0x2b')];}_0x2793ef[_0x3071('0x1b')](_0x44b45f)[_0x3071('0x2c')](_0x7a4cb4);};}exports['index']=function(_0x4fb1ca,_0x28792d){var _0x163604={},_0x950fde={},_0x3fa3b8={'count':0x0,'rows':[]};var _0x25b96b=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x292205){return{'name':_0x292205[_0x3071('0x30')],'type':_0x292205['type']['key']};});_0x950fde[_0x3071('0x31')]=_[_0x3071('0x2d')](_0x25b96b,_0x3071('0x2b'));_0x950fde[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4fb1ca[_0x3071('0x32')]);_0x950fde[_0x3071('0x34')]=_[_0x3071('0x35')](_0x950fde['model'],_0x950fde['query']);_0x163604['attributes']=_[_0x3071('0x35')](_0x950fde[_0x3071('0x31')],qs['fields'](_0x4fb1ca[_0x3071('0x32')][_0x3071('0x36')]));_0x163604[_0x3071('0x37')]=_0x163604[_0x3071('0x37')]['length']?_0x163604[_0x3071('0x37')]:_0x950fde[_0x3071('0x31')];if(!_0x4fb1ca[_0x3071('0x32')][_0x3071('0x38')](_0x3071('0x39'))){_0x163604[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x4fb1ca[_0x3071('0x32')]['limit']);_0x163604[_0x3071('0x1f')]=qs['offset'](_0x4fb1ca['query'][_0x3071('0x1f')]);}_0x163604[_0x3071('0x3a')]=qs['sort'](_0x4fb1ca[_0x3071('0x32')][_0x3071('0x3b')]);_0x163604[_0x3071('0x3c')]=qs[_0x3071('0x34')](_[_0x3071('0x3d')](_0x4fb1ca[_0x3071('0x32')],_0x950fde['filters']),_0x25b96b);if(_0x4fb1ca[_0x3071('0x32')][_0x3071('0x3e')]){_0x163604['where']=_[_0x3071('0x3f')](_0x163604['where'],{'$or':_[_0x3071('0x2d')](_0x25b96b,function(_0x43133a){if(_0x43133a['type']!=='VIRTUAL'){var _0x283074={};_0x283074[_0x43133a[_0x3071('0x2b')]]={'$like':'%'+_0x4fb1ca[_0x3071('0x32')]['filter']+'%'};return _0x283074;}})});}_0x163604=_[_0x3071('0x3f')]({},_0x163604,_0x4fb1ca['options']);var _0x1ac90a={'where':_0x163604['where']};return db[_0x3071('0x2e')][_0x3071('0x1e')](_0x1ac90a)[_0x3071('0x26')](function(_0x3113ef){_0x3fa3b8[_0x3071('0x1e')]=_0x3113ef;if(_0x4fb1ca['query']['includeAll']){_0x163604[_0x3071('0x40')]=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x41')](_0x163604);})[_0x3071('0x26')](function(_0x525389){_0x3fa3b8[_0x3071('0x42')]=_0x525389;return _0x3fa3b8;})[_0x3071('0x26')](respondWithFilteredResult(_0x28792d,_0x163604))[_0x3071('0x43')](handleError(_0x28792d,null));};exports[_0x3071('0x44')]=function(_0x277104,_0xb9a4b8){var _0x56a9d8={'raw':!![],'where':{'id':_0x277104['params']['id']}},_0x35a50d={};_0x35a50d['model']=_['keys'](db['JscriptySessionReport'][_0x3071('0x2f')]);_0x35a50d[_0x3071('0x32')]=_[_0x3071('0x33')](_0x277104[_0x3071('0x32')]);_0x35a50d[_0x3071('0x34')]=_[_0x3071('0x35')](_0x35a50d[_0x3071('0x31')],_0x35a50d[_0x3071('0x32')]);_0x56a9d8['attributes']=_[_0x3071('0x35')](_0x35a50d[_0x3071('0x31')],qs[_0x3071('0x36')](_0x277104[_0x3071('0x32')][_0x3071('0x36')]));_0x56a9d8['attributes']=_0x56a9d8['attributes'][_0x3071('0x45')]?_0x56a9d8[_0x3071('0x37')]:_0x35a50d[_0x3071('0x31')];if(_0x277104[_0x3071('0x32')][_0x3071('0x46')]){_0x56a9d8['include']=[{'all':!![]}];}_0x56a9d8=_[_0x3071('0x3f')]({},_0x56a9d8,_0x277104['options']);return db[_0x3071('0x2e')]['find'](_0x56a9d8)['then'](handleEntityNotFound(_0xb9a4b8,null))[_0x3071('0x26')](respondWithResult(_0xb9a4b8,null))['catch'](handleError(_0xb9a4b8,null));};exports[_0x3071('0x47')]=function(_0x5a0a69,_0x717c43){return db[_0x3071('0x2e')][_0x3071('0x47')](_0x5a0a69[_0x3071('0x48')],{})['then'](respondWithResult(_0x717c43,0xc9))[_0x3071('0x43')](handleError(_0x717c43,null));};exports['update']=function(_0xd273ec,_0x4b6bbb){if(_0xd273ec[_0x3071('0x48')]['id']){delete _0xd273ec[_0x3071('0x48')]['id'];}return db['JscriptySessionReport'][_0x3071('0x49')]({'where':{'id':_0xd273ec[_0x3071('0x4a')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x4b6bbb,null))[_0x3071('0x26')](saveUpdates(_0xd273ec[_0x3071('0x48')],null))[_0x3071('0x26')](respondWithResult(_0x4b6bbb,null))[_0x3071('0x43')](handleError(_0x4b6bbb,null));};exports['destroy']=function(_0x2c6e4c,_0x486b7a){return db[_0x3071('0x2e')][_0x3071('0x49')]({'where':{'id':_0x2c6e4c['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x486b7a,null))[_0x3071('0x26')](removeEntity(_0x486b7a,null))[_0x3071('0x43')](handleError(_0x486b7a,null));};exports[_0x3071('0x4b')]=function(_0x22aade,_0x26c8e4){return db[_0x3071('0x2e')][_0x3071('0x4b')]()[_0x3071('0x26')](respondWithResult(_0x26c8e4,null))[_0x3071('0x43')](handleError(_0x26c8e4,null));};exports[_0x3071('0x4c')]=function(_0x111115,_0x24977b,_0x114f1f){var _0x1656de={'raw':!![],'where':{}};var _0x12be97={};var _0x596cdd={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x3071('0x4d')]({'where':{'id':_0x111115['params']['id']}})[_0x3071('0x26')](handleEntityNotFound(_0x24977b,null))[_0x3071('0x26')](function(_0x15c6f8){if(_0x15c6f8){_0x12be97['model']=_[_0x3071('0x33')](db[_0x3071('0x4e')]['rawAttributes']);_0x12be97['query']=_[_0x3071('0x33')](_0x111115[_0x3071('0x32')]);_0x12be97[_0x3071('0x34')]=_[_0x3071('0x35')](_0x12be97['model'],_0x12be97[_0x3071('0x32')]);_0x1656de[_0x3071('0x37')]=_[_0x3071('0x35')](_0x12be97[_0x3071('0x31')],qs[_0x3071('0x36')](_0x111115['query'][_0x3071('0x36')]));_0x1656de[_0x3071('0x37')]=_0x1656de[_0x3071('0x37')][_0x3071('0x45')]?_0x1656de[_0x3071('0x37')]:_0x12be97[_0x3071('0x31')];if(!_0x111115[_0x3071('0x32')]['hasOwnProperty']('nolimit')){_0x1656de[_0x3071('0x20')]=qs['limit'](_0x111115[_0x3071('0x32')][_0x3071('0x20')]);_0x1656de['offset']=qs[_0x3071('0x1f')](_0x111115[_0x3071('0x32')]['offset']);}_0x1656de[_0x3071('0x3a')]=qs[_0x3071('0x3b')](_0x111115[_0x3071('0x32')][_0x3071('0x3b')]);_0x1656de[_0x3071('0x3c')]=qs['filters'](_[_0x3071('0x3d')](_0x111115[_0x3071('0x32')],_0x12be97[_0x3071('0x34')]));_0x1656de['where'][_0x3071('0x4f')]=_0x15c6f8['id'];if(_0x111115[_0x3071('0x32')][_0x3071('0x3e')]){_0x1656de[_0x3071('0x3c')]=_[_0x3071('0x3f')](_0x1656de[_0x3071('0x3c')],{'$or':_[_0x3071('0x2d')](_0x1656de[_0x3071('0x37')],function(_0x3b47e8){var _0x5cb3b3={};_0x5cb3b3[_0x3b47e8]={'$like':'%'+_0x111115[_0x3071('0x32')][_0x3071('0x3e')]+'%'};return _0x5cb3b3;})});}_0x1656de=_[_0x3071('0x3f')]({},_0x1656de,_0x111115[_0x3071('0x50')]);return db[_0x3071('0x4e')][_0x3071('0x1e')]({'where':_0x1656de[_0x3071('0x3c')]})[_0x3071('0x26')](function(_0xd4a41a){_0x596cdd[_0x3071('0x1e')]=_0xd4a41a;if(_0x111115[_0x3071('0x32')]['includeAll']){_0x1656de[_0x3071('0x40')]=[{'all':!![]}];}return db[_0x3071('0x4e')][_0x3071('0x41')](_0x1656de);})[_0x3071('0x26')](function(_0x429a03){_0x596cdd[_0x3071('0x42')]=_0x429a03;return _0x596cdd;});}})[_0x3071('0x26')](respondWithFilteredResult(_0x24977b,_0x1656de))[_0x3071('0x43')](handleError(_0x24977b,null));}; \ No newline at end of file +var _0xcb91=['stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','fields','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','intersection','SessionId','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error'];(function(_0x1381b8,_0x150b4b){var _0x28dddb=function(_0x3bdf4a){while(--_0x3bdf4a){_0x1381b8['push'](_0x1381b8['shift']());}};_0x28dddb(++_0x150b4b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xcb91[_0x125ff8];return _0x2d9ef;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var licenseUtil=require(_0x1cb9('0x15'));var db=require(_0x1cb9('0x16'))['db'];function respondWithStatusCode(_0x5445e1,_0x5e3c19){_0x5e3c19=_0x5e3c19||0xcc;return function(_0x59dec3){if(_0x59dec3){return _0x5445e1[_0x1cb9('0x17')](_0x5e3c19);}return _0x5445e1[_0x1cb9('0x18')](_0x5e3c19)[_0x1cb9('0x19')]();};}function respondWithResult(_0x1c714f,_0x56884d){_0x56884d=_0x56884d||0xc8;return function(_0x397727){if(_0x397727){return _0x1c714f[_0x1cb9('0x18')](_0x56884d)[_0x1cb9('0x1a')](_0x397727);}};}function respondWithFilteredResult(_0x8dfa55,_0x3e2d11){return function(_0x5806d8){if(_0x5806d8){var _0x5572cb=_0x5806d8[_0x1cb9('0x1b')],_0xd446a3=_0x3e2d11[_0x1cb9('0x1c')],_0x3cc765=_0x3e2d11[_0x1cb9('0x1c')]+_0x3e2d11[_0x1cb9('0x1d')],_0x3904b7;if(_0x3cc765>=_0x5572cb){_0x3cc765=_0x5572cb;_0x3904b7=0xc8;}else{_0x3904b7=0xce;}_0x8dfa55['status'](_0x3904b7);return _0x8dfa55['set'](_0x1cb9('0x1e'),_0xd446a3+'-'+_0x3cc765+'/'+_0x5572cb)[_0x1cb9('0x1a')](_0x5806d8);}return null;};}function patchUpdates(_0x2b2669){return function(_0x31481a){try{jsonpatch[_0x1cb9('0x1f')](_0x31481a,_0x2b2669,!![]);}catch(_0x4014de){return BPromise[_0x1cb9('0x20')](_0x4014de);}return _0x31481a['save']();};}function saveUpdates(_0x559bcc,_0x1a5a72){return function(_0x5dbfae){if(_0x5dbfae){return _0x5dbfae[_0x1cb9('0x21')](_0x559bcc)[_0x1cb9('0x22')](function(_0x523b26){return _0x523b26;});}return null;};}function removeEntity(_0x599275,_0x2e3854){return function(_0x325637){if(_0x325637){return _0x325637[_0x1cb9('0x23')]()[_0x1cb9('0x22')](function(){_0x599275[_0x1cb9('0x18')](0xcc)[_0x1cb9('0x19')]();});}};}function handleEntityNotFound(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(!_0x6c6f61){_0x59ebea['sendStatus'](0x194);}return _0x6c6f61;};}function handleError(_0x10a419,_0x2b1275){_0x2b1275=_0x2b1275||0x1f4;return function(_0x69b4c8){logger[_0x1cb9('0x24')](_0x69b4c8[_0x1cb9('0x25')]);if(_0x69b4c8['name']){delete _0x69b4c8[_0x1cb9('0x26')];}_0x10a419[_0x1cb9('0x18')](_0x2b1275)['send'](_0x69b4c8);};}exports[_0x1cb9('0x27')]=function(_0x21effa,_0x41a9a0){var _0x1804fd={},_0x406821={},_0x21d6f5={'count':0x0,'rows':[]};var _0x2e28fe=_[_0x1cb9('0x28')](db[_0x1cb9('0x29')][_0x1cb9('0x2a')],function(_0x48888d){return{'name':_0x48888d[_0x1cb9('0x2b')],'type':_0x48888d['type'][_0x1cb9('0x2c')]};});_0x406821['model']=_[_0x1cb9('0x28')](_0x2e28fe,_0x1cb9('0x26'));_0x406821[_0x1cb9('0x2d')]=_[_0x1cb9('0x2e')](_0x21effa['query']);_0x406821[_0x1cb9('0x2f')]=_['intersection'](_0x406821[_0x1cb9('0x30')],_0x406821[_0x1cb9('0x2d')]);_0x1804fd[_0x1cb9('0x31')]=_['intersection'](_0x406821[_0x1cb9('0x30')],qs['fields'](_0x21effa[_0x1cb9('0x2d')]['fields']));_0x1804fd[_0x1cb9('0x31')]=_0x1804fd[_0x1cb9('0x31')][_0x1cb9('0x32')]?_0x1804fd[_0x1cb9('0x31')]:_0x406821['model'];if(!_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x33')](_0x1cb9('0x34'))){_0x1804fd[_0x1cb9('0x1d')]=qs[_0x1cb9('0x1d')](_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x1d')]);_0x1804fd[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x1c')]);}_0x1804fd[_0x1cb9('0x35')]=qs[_0x1cb9('0x36')](_0x21effa['query']['sort']);_0x1804fd[_0x1cb9('0x37')]=qs[_0x1cb9('0x2f')](_[_0x1cb9('0x38')](_0x21effa[_0x1cb9('0x2d')],_0x406821[_0x1cb9('0x2f')]),_0x2e28fe);if(_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x39')]){_0x1804fd[_0x1cb9('0x37')]=_['merge'](_0x1804fd[_0x1cb9('0x37')],{'$or':_[_0x1cb9('0x28')](_0x2e28fe,function(_0xefe136){if(_0xefe136['type']!==_0x1cb9('0x3a')){var _0x5c7cd0={};_0x5c7cd0[_0xefe136[_0x1cb9('0x26')]]={'$like':'%'+_0x21effa['query'][_0x1cb9('0x39')]+'%'};return _0x5c7cd0;}})});}_0x1804fd=_[_0x1cb9('0x3b')]({},_0x1804fd,_0x21effa[_0x1cb9('0x3c')]);var _0x2bcacd={'where':_0x1804fd[_0x1cb9('0x37')]};return db[_0x1cb9('0x29')][_0x1cb9('0x1b')](_0x2bcacd)['then'](function(_0x4ca19e){_0x21d6f5[_0x1cb9('0x1b')]=_0x4ca19e;if(_0x21effa[_0x1cb9('0x2d')][_0x1cb9('0x3d')]){_0x1804fd[_0x1cb9('0x3e')]=[{'all':!![]}];}return db[_0x1cb9('0x29')][_0x1cb9('0x3f')](_0x1804fd);})[_0x1cb9('0x22')](function(_0x4a670c){_0x21d6f5[_0x1cb9('0x40')]=_0x4a670c;return _0x21d6f5;})['then'](respondWithFilteredResult(_0x41a9a0,_0x1804fd))['catch'](handleError(_0x41a9a0,null));};exports['show']=function(_0x409c62,_0x397ff9){var _0x1bf51c={'raw':!![],'where':{'id':_0x409c62[_0x1cb9('0x41')]['id']}},_0x2e3cf3={};_0x2e3cf3['model']=_[_0x1cb9('0x2e')](db['JscriptySessionReport'][_0x1cb9('0x2a')]);_0x2e3cf3[_0x1cb9('0x2d')]=_[_0x1cb9('0x2e')](_0x409c62['query']);_0x2e3cf3[_0x1cb9('0x2f')]=_['intersection'](_0x2e3cf3[_0x1cb9('0x30')],_0x2e3cf3[_0x1cb9('0x2d')]);_0x1bf51c['attributes']=_['intersection'](_0x2e3cf3[_0x1cb9('0x30')],qs[_0x1cb9('0x42')](_0x409c62[_0x1cb9('0x2d')][_0x1cb9('0x42')]));_0x1bf51c[_0x1cb9('0x31')]=_0x1bf51c['attributes'][_0x1cb9('0x32')]?_0x1bf51c['attributes']:_0x2e3cf3['model'];if(_0x409c62['query'][_0x1cb9('0x3d')]){_0x1bf51c[_0x1cb9('0x3e')]=[{'all':!![]}];}_0x1bf51c=_[_0x1cb9('0x3b')]({},_0x1bf51c,_0x409c62[_0x1cb9('0x3c')]);return db[_0x1cb9('0x29')][_0x1cb9('0x43')](_0x1bf51c)[_0x1cb9('0x22')](handleEntityNotFound(_0x397ff9,null))[_0x1cb9('0x22')](respondWithResult(_0x397ff9,null))[_0x1cb9('0x44')](handleError(_0x397ff9,null));};exports[_0x1cb9('0x45')]=function(_0x3ea88c,_0x4ce899){return db[_0x1cb9('0x29')][_0x1cb9('0x45')](_0x3ea88c[_0x1cb9('0x46')],{})['then'](respondWithResult(_0x4ce899,0xc9))[_0x1cb9('0x44')](handleError(_0x4ce899,null));};exports[_0x1cb9('0x21')]=function(_0x3c6044,_0x2efdbb){if(_0x3c6044[_0x1cb9('0x46')]['id']){delete _0x3c6044['body']['id'];}return db[_0x1cb9('0x29')]['find']({'where':{'id':_0x3c6044[_0x1cb9('0x41')]['id']}})['then'](handleEntityNotFound(_0x2efdbb,null))[_0x1cb9('0x22')](saveUpdates(_0x3c6044[_0x1cb9('0x46')],null))[_0x1cb9('0x22')](respondWithResult(_0x2efdbb,null))[_0x1cb9('0x44')](handleError(_0x2efdbb,null));};exports['destroy']=function(_0x298475,_0x1149b9){return db[_0x1cb9('0x29')][_0x1cb9('0x43')]({'where':{'id':_0x298475[_0x1cb9('0x41')]['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x1149b9,null))[_0x1cb9('0x22')](removeEntity(_0x1149b9,null))[_0x1cb9('0x44')](handleError(_0x1149b9,null));};exports[_0x1cb9('0x47')]=function(_0x17f10e,_0x48dd4a){return db['JscriptySessionReport'][_0x1cb9('0x47')]()[_0x1cb9('0x22')](respondWithResult(_0x48dd4a,null))[_0x1cb9('0x44')](handleError(_0x48dd4a,null));};exports[_0x1cb9('0x48')]=function(_0x20b253,_0x2d076b,_0x367dd7){var _0x1c4ff6={'raw':!![],'where':{}};var _0x36c53a={};var _0x166ca2={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x1cb9('0x49')]({'where':{'id':_0x20b253['params']['id']}})[_0x1cb9('0x22')](handleEntityNotFound(_0x2d076b,null))['then'](function(_0x135795){if(_0x135795){_0x36c53a['model']=_['keys'](db[_0x1cb9('0x4a')][_0x1cb9('0x2a')]);_0x36c53a[_0x1cb9('0x2d')]=_['keys'](_0x20b253[_0x1cb9('0x2d')]);_0x36c53a[_0x1cb9('0x2f')]=_['intersection'](_0x36c53a['model'],_0x36c53a[_0x1cb9('0x2d')]);_0x1c4ff6[_0x1cb9('0x31')]=_[_0x1cb9('0x4b')](_0x36c53a[_0x1cb9('0x30')],qs[_0x1cb9('0x42')](_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x42')]));_0x1c4ff6['attributes']=_0x1c4ff6[_0x1cb9('0x31')][_0x1cb9('0x32')]?_0x1c4ff6[_0x1cb9('0x31')]:_0x36c53a['model'];if(!_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x33')](_0x1cb9('0x34'))){_0x1c4ff6[_0x1cb9('0x1d')]=qs[_0x1cb9('0x1d')](_0x20b253[_0x1cb9('0x2d')]['limit']);_0x1c4ff6[_0x1cb9('0x1c')]=qs[_0x1cb9('0x1c')](_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x1c')]);}_0x1c4ff6[_0x1cb9('0x35')]=qs[_0x1cb9('0x36')](_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x36')]);_0x1c4ff6[_0x1cb9('0x37')]=qs[_0x1cb9('0x2f')](_[_0x1cb9('0x38')](_0x20b253['query'],_0x36c53a[_0x1cb9('0x2f')]));_0x1c4ff6[_0x1cb9('0x37')][_0x1cb9('0x4c')]=_0x135795['id'];if(_0x20b253[_0x1cb9('0x2d')]['filter']){_0x1c4ff6['where']=_[_0x1cb9('0x3b')](_0x1c4ff6[_0x1cb9('0x37')],{'$or':_[_0x1cb9('0x28')](_0x1c4ff6[_0x1cb9('0x31')],function(_0x3c2f9c){var _0x75c734={};_0x75c734[_0x3c2f9c]={'$like':'%'+_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x39')]+'%'};return _0x75c734;})});}_0x1c4ff6=_['merge']({},_0x1c4ff6,_0x20b253['options']);return db[_0x1cb9('0x4a')]['count']({'where':_0x1c4ff6['where']})['then'](function(_0x580369){_0x166ca2['count']=_0x580369;if(_0x20b253[_0x1cb9('0x2d')][_0x1cb9('0x3d')]){_0x1c4ff6[_0x1cb9('0x3e')]=[{'all':!![]}];}return db[_0x1cb9('0x4a')][_0x1cb9('0x3f')](_0x1c4ff6);})[_0x1cb9('0x22')](function(_0x54f008){_0x166ca2[_0x1cb9('0x40')]=_0x54f008;return _0x166ca2;});}})[_0x1cb9('0x22')](respondWithFilteredResult(_0x2d076b,_0x1c4ff6))['catch'](handleError(_0x2d076b,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 66dac9b..3560ddf 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 _0xdb8b=['rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2e5821,_0x2acd95){var _0x3efbca=function(_0x77b667){while(--_0x77b667){_0x2e5821['push'](_0x2e5821['shift']());}};_0x3efbca(++_0x2acd95);}(_0xdb8b,0x96));var _0xbdb8=function(_0x1646f8,_0x511de9){_0x1646f8=_0x1646f8-0x0;var _0x30bb7b=_0xdb8b[_0x1646f8];return _0x30bb7b;};'use strict';var _=require(_0xbdb8('0x0'));var util=require(_0xbdb8('0x1'));var logger=require(_0xbdb8('0x2'))(_0xbdb8('0x3'));var moment=require(_0xbdb8('0x4'));var BPromise=require(_0xbdb8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbdb8('0x6'));var config=require(_0xbdb8('0x7'));var attributes=require(_0xbdb8('0x8'));module[_0xbdb8('0x9')]=function(_0x26b4be,_0x8d2654){return _0x26b4be[_0xbdb8('0xa')]('JscriptySessionReport',attributes,{'tableName':_0xbdb8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe6c7=['path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x435666,_0x2b89a4){var _0x22b742=function(_0x161501){while(--_0x161501){_0x435666['push'](_0x435666['shift']());}};_0x22b742(++_0x2b89a4);}(_0xe6c7,0x7e));var _0x7e6c=function(_0x223461,_0x2bca70){_0x223461=_0x223461-0x0;var _0x4dbe0a=_0xe6c7[_0x223461];return _0x4dbe0a;};'use strict';var _=require(_0x7e6c('0x0'));var util=require(_0x7e6c('0x1'));var logger=require(_0x7e6c('0x2'))(_0x7e6c('0x3'));var moment=require('moment');var BPromise=require(_0x7e6c('0x4'));var rp=require(_0x7e6c('0x5'));var fs=require('fs');var path=require(_0x7e6c('0x6'));var rimraf=require(_0x7e6c('0x7'));var config=require(_0x7e6c('0x8'));var attributes=require(_0x7e6c('0x9'));module[_0x7e6c('0xa')]=function(_0x1ffc20,_0x244727){return _0x1ffc20[_0x7e6c('0xb')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','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 566e23a..774ee71 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 _0xaa02=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','catch'];(function(_0x211a55,_0x517293){var _0x422d55=function(_0x1bb3eb){while(--_0x1bb3eb){_0x211a55['push'](_0x211a55['shift']());}};_0x422d55(++_0x517293);}(_0xaa02,0x11e));var _0x2aa0=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xaa02[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0x2aa0('0x0'));var util=require(_0x2aa0('0x1'));var moment=require(_0x2aa0('0x2'));var BPromise=require('bluebird');var rs=require(_0x2aa0('0x3'));var fs=require('fs');var Redis=require(_0x2aa0('0x4'));var db=require(_0x2aa0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2aa0('0x6'))(_0x2aa0('0x7'));var config=require('../../config/environment');var jayson=require(_0x2aa0('0x8'));var client=jayson[_0x2aa0('0x9')][_0x2aa0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe6ca42,_0x15d0bb,_0x2a60e9){return new BPromise(function(_0x56fe35,_0x1d239d){return client[_0x2aa0('0xb')](_0xe6ca42,_0x2a60e9)[_0x2aa0('0xc')](function(_0x353ddc){logger[_0x2aa0('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x15d0bb,_0x2aa0('0xe'));logger[_0x2aa0('0xf')](_0x2aa0('0x10'),_0x15d0bb,_0x2aa0('0xe'),JSON[_0x2aa0('0x11')](_0x353ddc));if(_0x353ddc[_0x2aa0('0x12')]){if(_0x353ddc[_0x2aa0('0x12')]['code']===0x1f4){logger[_0x2aa0('0x12')](_0x2aa0('0x13'),_0x15d0bb,_0x353ddc[_0x2aa0('0x12')][_0x2aa0('0x14')]);return _0x1d239d(_0x353ddc[_0x2aa0('0x12')][_0x2aa0('0x14')]);}logger[_0x2aa0('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x15d0bb,_0x353ddc[_0x2aa0('0x12')][_0x2aa0('0x14')]);return _0x56fe35(_0x353ddc[_0x2aa0('0x12')][_0x2aa0('0x14')]);}else{logger[_0x2aa0('0xd')](_0x2aa0('0x13'),_0x15d0bb,_0x2aa0('0xe'));_0x56fe35(_0x353ddc['result'][_0x2aa0('0x14')]);}})[_0x2aa0('0x15')](function(_0x1d6f5a){logger[_0x2aa0('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x15d0bb,_0x1d6f5a);_0x1d239d(_0x1d6f5a);});});} \ No newline at end of file +var _0xded5=['JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info'];(function(_0x3f018b,_0x915bb9){var _0x4d5ef3=function(_0x4725e6){while(--_0x4725e6){_0x3f018b['push'](_0x3f018b['shift']());}};_0x4d5ef3(++_0x915bb9);}(_0xded5,0xba));var _0x5ded=function(_0x447761,_0x224d03){_0x447761=_0x447761-0x0;var _0x54a03c=_0xded5[_0x447761];return _0x54a03c;};'use strict';var _=require(_0x5ded('0x0'));var util=require('util');var moment=require(_0x5ded('0x1'));var BPromise=require(_0x5ded('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ded('0x3'));var db=require(_0x5ded('0x4'))['db'];var utils=require(_0x5ded('0x5'));var logger=require('../../config/logger')(_0x5ded('0x6'));var config=require(_0x5ded('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ded('0x8')][_0x5ded('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26b217,_0x19e889,_0x3ac88b){return new BPromise(function(_0x4c003f,_0x1617d9){return client['request'](_0x26b217,_0x3ac88b)[_0x5ded('0xa')](function(_0x3e00f0){logger[_0x5ded('0xb')](_0x5ded('0xc'),_0x19e889,_0x5ded('0xd'));logger[_0x5ded('0xe')](_0x5ded('0xf'),_0x19e889,_0x5ded('0xd'),JSON[_0x5ded('0x10')](_0x3e00f0));if(_0x3e00f0[_0x5ded('0x11')]){if(_0x3e00f0['error'][_0x5ded('0x12')]===0x1f4){logger[_0x5ded('0x11')](_0x5ded('0xc'),_0x19e889,_0x3e00f0[_0x5ded('0x11')]['message']);return _0x1617d9(_0x3e00f0[_0x5ded('0x11')][_0x5ded('0x13')]);}logger[_0x5ded('0x11')](_0x5ded('0xc'),_0x19e889,_0x3e00f0['error'][_0x5ded('0x13')]);return _0x4c003f(_0x3e00f0[_0x5ded('0x11')][_0x5ded('0x13')]);}else{logger[_0x5ded('0xb')](_0x5ded('0xc'),_0x19e889,_0x5ded('0xd'));_0x4c003f(_0x3e00f0[_0x5ded('0x14')][_0x5ded('0x13')]);}})[_0x5ded('0x15')](function(_0x49e9dd){logger[_0x5ded('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x19e889,_0x49e9dd);_0x1617d9(_0x49e9dd);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 11be3c3..0087d77 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 _0x6474=['util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','exports','multer'];(function(_0x3e57a5,_0x1223d2){var _0x506e78=function(_0x3230b1){while(--_0x3230b1){_0x3e57a5['push'](_0x3e57a5['shift']());}};_0x506e78(++_0x1223d2);}(_0x6474,0x11d));var _0x4647=function(_0x308444,_0xc9c9c2){_0x308444=_0x308444-0x0;var _0x237703=_0x6474[_0x308444];return _0x237703;};'use strict';var multer=require(_0x4647('0x0'));var util=require(_0x4647('0x1'));var path=require('path');var timeout=require(_0x4647('0x2'));var express=require('express');var router=express[_0x4647('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4647('0x4'));var config=require(_0x4647('0x5'));var controller=require(_0x4647('0x6'));router[_0x4647('0x7')]('/',controller['index']);router[_0x4647('0x8')](_0x4647('0x9'),auth[_0x4647('0xa')](),controller[_0x4647('0xb')]);module[_0x4647('0xc')]=router; \ No newline at end of file +var _0x7b53=['get','index','put','/:id','update','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x7b53,0x124));var _0x37b5=function(_0x53d1a0,_0x2cf270){_0x53d1a0=_0x53d1a0-0x0;var _0x54cc78=_0x7b53[_0x53d1a0];return _0x54cc78;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x37b5('0x0'));var timeout=require('connect-timeout');var express=require(_0x37b5('0x1'));var router=express[_0x37b5('0x2')]();var auth=require(_0x37b5('0x3'));var interaction=require(_0x37b5('0x4'));var config=require(_0x37b5('0x5'));var controller=require(_0x37b5('0x6'));router[_0x37b5('0x7')]('/',controller[_0x37b5('0x8')]);router[_0x37b5('0x9')](_0x37b5('0xa'),auth['isAuthenticated'](),controller[_0x37b5('0xb')]);module[_0x37b5('0xc')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index cbe88a4..3a7e368 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 _0x187d=['TEXT','STRING','INTEGER','sequelize'];(function(_0x51986c,_0x568814){var _0x11d2a3=function(_0x3f55dd){while(--_0x3f55dd){_0x51986c['push'](_0x51986c['shift']());}};_0x11d2a3(++_0x568814);}(_0x187d,0x93));var _0xd187=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x187d[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0xd187('0x0'));module['exports']={'license':{'type':Sequelize[_0xd187('0x1')]},'data1':{'type':Sequelize[_0xd187('0x2')]},'data2':{'type':Sequelize[_0xd187('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd187('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x46ed,0x168));var _0xd46e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x46ed[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd46e('0x2')]},'data2':{'type':Sequelize[_0xd46e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 932c807..beda498 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 _0xf483=['getLicense','catch','body','License','params','demo','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options'];(function(_0x13b194,_0x332de0){var _0xa2d34d=function(_0x52d89b){while(--_0x52d89b){_0x13b194['push'](_0x13b194['shift']());}};_0xa2d34d(++_0x332de0);}(_0xf483,0xf2));var _0x3f48=function(_0xad30ba,_0x3f7e67){_0xad30ba=_0xad30ba-0x0;var _0x233532=_0xf483[_0xad30ba];return _0x233532;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f48('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f48('0x1'));var jsonpatch=require(_0x3f48('0x2'));var rp=require(_0x3f48('0x3'));var moment=require(_0x3f48('0x4'));var BPromise=require(_0x3f48('0x5'));var Mustache=require(_0x3f48('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3f48('0x7'));var ejs=require(_0x3f48('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3f48('0x9'));var crypto=require(_0x3f48('0xa'));var jsforce=require(_0x3f48('0xb'));var deskjs=require(_0x3f48('0xc'));var toCsv=require(_0x3f48('0x7'));var querystring=require(_0x3f48('0xd'));var Papa=require(_0x3f48('0xe'));var Redis=require('ioredis');var authService=require(_0x3f48('0xf'));var qs=require(_0x3f48('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f48('0x11'));var logger=require('../../config/logger')(_0x3f48('0x12'));var utils=require(_0x3f48('0x13'));var config=require(_0x3f48('0x14'));var licenseUtil=require(_0x3f48('0x15'));var db=require(_0x3f48('0x16'))['db'];function respondWithStatusCode(_0x1e9563,_0x38502b){_0x38502b=_0x38502b||0xcc;return function(_0x5867db){if(_0x5867db){return _0x1e9563[_0x3f48('0x17')](_0x38502b);}return _0x1e9563[_0x3f48('0x18')](_0x38502b)['end']();};}function respondWithResult(_0x27ca72,_0x4e1f66){_0x4e1f66=_0x4e1f66||0xc8;return function(_0x101139){if(_0x101139){return _0x27ca72['status'](_0x4e1f66)[_0x3f48('0x19')](_0x101139);}};}function respondWithFilteredResult(_0x57c489,_0x2a2083){return function(_0x2013b9){if(_0x2013b9){var _0x364032=_0x2013b9[_0x3f48('0x1a')],_0x572ba5=_0x2a2083[_0x3f48('0x1b')],_0xd42f1e=_0x2a2083['offset']+_0x2a2083[_0x3f48('0x1c')],_0x319aa5;if(_0xd42f1e>=_0x364032){_0xd42f1e=_0x364032;_0x319aa5=0xc8;}else{_0x319aa5=0xce;}_0x57c489[_0x3f48('0x18')](_0x319aa5);return _0x57c489[_0x3f48('0x1d')](_0x3f48('0x1e'),_0x572ba5+'-'+_0xd42f1e+'/'+_0x364032)[_0x3f48('0x19')](_0x2013b9);}return null;};}function patchUpdates(_0x3d6cf3){return function(_0x7a962f){try{jsonpatch[_0x3f48('0x1f')](_0x7a962f,_0x3d6cf3,!![]);}catch(_0x349caf){return BPromise[_0x3f48('0x20')](_0x349caf);}return _0x7a962f[_0x3f48('0x21')]();};}function saveUpdates(_0x353a23,_0x108c6e){return function(_0x9be106){if(_0x9be106){return _0x9be106[_0x3f48('0x22')](_0x353a23)[_0x3f48('0x23')](function(_0x3e4946){return _0x3e4946;});}return null;};}function removeEntity(_0x285462,_0x12fcde){return function(_0x12ef86){if(_0x12ef86){return _0x12ef86['destroy']()['then'](function(){_0x285462[_0x3f48('0x18')](0xcc)[_0x3f48('0x24')]();});}};}function handleEntityNotFound(_0x2e569d,_0x56ad7b){return function(_0x48c473){if(!_0x48c473){_0x2e569d[_0x3f48('0x17')](0x194);}return _0x48c473;};}function handleError(_0x1f0191,_0x494b0f){_0x494b0f=_0x494b0f||0x1f4;return function(_0x30a5f1){logger[_0x3f48('0x25')](_0x30a5f1[_0x3f48('0x26')]);if(_0x30a5f1[_0x3f48('0x27')]){delete _0x30a5f1[_0x3f48('0x27')];}_0x1f0191[_0x3f48('0x18')](_0x494b0f)[_0x3f48('0x28')](_0x30a5f1);};}var utilLicense=require('../../config/license/util');exports[_0x3f48('0x29')]=function(_0x3340d5,_0x320f91){var _0x1d9420={'raw':!![],'where':{'id':0x1}},_0x568701={};_0x568701[_0x3f48('0x2a')]=_[_0x3f48('0x2b')](db['License'][_0x3f48('0x2c')]);_0x568701[_0x3f48('0x2d')]=_[_0x3f48('0x2b')](_0x3340d5['query']);_0x568701[_0x3f48('0x2e')]=_[_0x3f48('0x2f')](_0x568701['model'],_0x568701[_0x3f48('0x2d')]);_0x1d9420[_0x3f48('0x30')]=_[_0x3f48('0x2f')](_0x568701['model'],qs['fields'](_0x3340d5['query'][_0x3f48('0x31')]));_0x1d9420[_0x3f48('0x30')]=_0x1d9420[_0x3f48('0x30')][_0x3f48('0x32')]?_0x1d9420[_0x3f48('0x30')]:_0x568701[_0x3f48('0x2a')];_0x1d9420=_[_0x3f48('0x33')]({},_0x1d9420,_0x3340d5[_0x3f48('0x34')]);return utilLicense[_0x3f48('0x35')](_0x1d9420)[_0x3f48('0x23')](respondWithResult(_0x320f91,null))[_0x3f48('0x36')](handleError(_0x320f91,null));};exports[_0x3f48('0x22')]=function(_0x25a6b4,_0x2aa9ed){if(_0x25a6b4['body']['id']){delete _0x25a6b4[_0x3f48('0x37')]['id'];}return db[_0x3f48('0x38')]['find']({'where':{'id':_0x25a6b4[_0x3f48('0x39')]['id']}})['then'](handleEntityNotFound(_0x2aa9ed,null))['then'](function(_0x530f1b){var _0x50c1fc=_0x530f1b['get']({'plain':!![]});return utilLicense['checkLicense'](_0x50c1fc,_0x25a6b4[_0x3f48('0x37')]['key']);})['then'](function(_0x7f9d37){if(!_0x7f9d37[_0x3f48('0x3a')]){return saveUpdates(_0x25a6b4[_0x3f48('0x37')],null);}return _0x7f9d37;})[_0x3f48('0x23')](respondWithResult(_0x2aa9ed,null))['catch'](handleError(_0x2aa9ed,null));}; \ No newline at end of file +var _0xb91a=['html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','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','count','limit','set','Content-Range','json','update','then','destroy','stack','name','index','keys','License','rawAttributes','query','filters','intersection','attributes','model','fields','length','merge','options','getLicense','catch','body','find','params','checkLicense','key','demo'];(function(_0x52e1f8,_0x1d2aa1){var _0x15150c=function(_0x41af44){while(--_0x41af44){_0x52e1f8['push'](_0x52e1f8['shift']());}};_0x15150c(++_0x1d2aa1);}(_0xb91a,0xf4));var _0xab91=function(_0x55260e,_0xb7f86f){_0x55260e=_0x55260e-0x0;var _0x259f76=_0xb91a[_0x55260e];return _0x259f76;};'use strict';var pdf=require(_0xab91('0x0'));var emlformat=require(_0xab91('0x1'));var rimraf=require(_0xab91('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xab91('0x3'));var moment=require(_0xab91('0x4'));var BPromise=require(_0xab91('0x5'));var Mustache=require(_0xab91('0x6'));var util=require(_0xab91('0x7'));var path=require(_0xab91('0x8'));var sox=require(_0xab91('0x9'));var csv=require(_0xab91('0xa'));var ejs=require(_0xab91('0xb'));var fs=require('fs');var _=require(_0xab91('0xc'));var squel=require('squel');var crypto=require(_0xab91('0xd'));var jsforce=require(_0xab91('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xab91('0xf'));var Redis=require(_0xab91('0x10'));var authService=require(_0xab91('0x11'));var qs=require(_0xab91('0x12'));var as=require(_0xab91('0x13'));var hardwareService=require(_0xab91('0x14'));var logger=require(_0xab91('0x15'))(_0xab91('0x16'));var utils=require(_0xab91('0x17'));var config=require(_0xab91('0x18'));var licenseUtil=require(_0xab91('0x19'));var db=require(_0xab91('0x1a'))['db'];function respondWithStatusCode(_0x283c91,_0x542d3f){_0x542d3f=_0x542d3f||0xcc;return function(_0x4f2af6){if(_0x4f2af6){return _0x283c91[_0xab91('0x1b')](_0x542d3f);}return _0x283c91[_0xab91('0x1c')](_0x542d3f)[_0xab91('0x1d')]();};}function respondWithResult(_0x14bded,_0x14b304){_0x14b304=_0x14b304||0xc8;return function(_0xaa6e77){if(_0xaa6e77){return _0x14bded['status'](_0x14b304)['json'](_0xaa6e77);}};}function respondWithFilteredResult(_0x3c102a,_0x3565c0){return function(_0x1b0d61){if(_0x1b0d61){var _0x2d2699=_0x1b0d61[_0xab91('0x1e')],_0x1f4252=_0x3565c0['offset'],_0x2f4137=_0x3565c0['offset']+_0x3565c0[_0xab91('0x1f')],_0x27b7d1;if(_0x2f4137>=_0x2d2699){_0x2f4137=_0x2d2699;_0x27b7d1=0xc8;}else{_0x27b7d1=0xce;}_0x3c102a['status'](_0x27b7d1);return _0x3c102a[_0xab91('0x20')](_0xab91('0x21'),_0x1f4252+'-'+_0x2f4137+'/'+_0x2d2699)[_0xab91('0x22')](_0x1b0d61);}return null;};}function patchUpdates(_0x4a9cad){return function(_0xe80258){try{jsonpatch['apply'](_0xe80258,_0x4a9cad,!![]);}catch(_0x198536){return BPromise['reject'](_0x198536);}return _0xe80258['save']();};}function saveUpdates(_0x13f065,_0x4c5595){return function(_0x441aff){if(_0x441aff){return _0x441aff[_0xab91('0x23')](_0x13f065)[_0xab91('0x24')](function(_0x5958dd){return _0x5958dd;});}return null;};}function removeEntity(_0x49f4d5,_0x40d29a){return function(_0xdedffe){if(_0xdedffe){return _0xdedffe[_0xab91('0x25')]()[_0xab91('0x24')](function(){_0x49f4d5[_0xab91('0x1c')](0xcc)[_0xab91('0x1d')]();});}};}function handleEntityNotFound(_0x57a7e9,_0x5eca53){return function(_0x18445a){if(!_0x18445a){_0x57a7e9['sendStatus'](0x194);}return _0x18445a;};}function handleError(_0x4af04e,_0x3167ae){_0x3167ae=_0x3167ae||0x1f4;return function(_0x1a0bc2){logger['error'](_0x1a0bc2[_0xab91('0x26')]);if(_0x1a0bc2['name']){delete _0x1a0bc2[_0xab91('0x27')];}_0x4af04e[_0xab91('0x1c')](_0x3167ae)['send'](_0x1a0bc2);};}var utilLicense=require(_0xab91('0x19'));exports[_0xab91('0x28')]=function(_0xcbaaf,_0x36f3ac){var _0x35a319={'raw':!![],'where':{'id':0x1}},_0x42a28b={};_0x42a28b['model']=_[_0xab91('0x29')](db[_0xab91('0x2a')][_0xab91('0x2b')]);_0x42a28b[_0xab91('0x2c')]=_[_0xab91('0x29')](_0xcbaaf[_0xab91('0x2c')]);_0x42a28b[_0xab91('0x2d')]=_[_0xab91('0x2e')](_0x42a28b['model'],_0x42a28b[_0xab91('0x2c')]);_0x35a319[_0xab91('0x2f')]=_[_0xab91('0x2e')](_0x42a28b[_0xab91('0x30')],qs[_0xab91('0x31')](_0xcbaaf[_0xab91('0x2c')]['fields']));_0x35a319[_0xab91('0x2f')]=_0x35a319[_0xab91('0x2f')][_0xab91('0x32')]?_0x35a319[_0xab91('0x2f')]:_0x42a28b['model'];_0x35a319=_[_0xab91('0x33')]({},_0x35a319,_0xcbaaf[_0xab91('0x34')]);return utilLicense[_0xab91('0x35')](_0x35a319)['then'](respondWithResult(_0x36f3ac,null))[_0xab91('0x36')](handleError(_0x36f3ac,null));};exports['update']=function(_0x1b1201,_0x28696b){if(_0x1b1201['body']['id']){delete _0x1b1201[_0xab91('0x37')]['id'];}return db[_0xab91('0x2a')][_0xab91('0x38')]({'where':{'id':_0x1b1201[_0xab91('0x39')]['id']}})[_0xab91('0x24')](handleEntityNotFound(_0x28696b,null))[_0xab91('0x24')](function(_0x15d2dd){var _0x576bbc=_0x15d2dd['get']({'plain':!![]});return utilLicense[_0xab91('0x3a')](_0x576bbc,_0x1b1201[_0xab91('0x37')][_0xab91('0x3b')]);})[_0xab91('0x24')](function(_0x275d6f){if(!_0x275d6f[_0xab91('0x3c')]){return saveUpdates(_0x1b1201[_0xab91('0x37')],null);}return _0x275d6f;})[_0xab91('0x24')](respondWithResult(_0x28696b,null))['catch'](handleError(_0x28696b,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 9db313c..9d35316 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 _0x07a4=['license','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License'];(function(_0x37ad2c,_0x312818){var _0x46fffe=function(_0x31fedb){while(--_0x31fedb){_0x37ad2c['push'](_0x37ad2c['shift']());}};_0x46fffe(++_0x312818);}(_0x07a4,0x1ef));var _0x407a=function(_0x4f995d,_0x5089c6){_0x4f995d=_0x4f995d-0x0;var _0x62fca=_0x07a4[_0x4f995d];return _0x62fca;};'use strict';var _=require('lodash');var util=require(_0x407a('0x0'));var logger=require(_0x407a('0x1'))(_0x407a('0x2'));var moment=require('moment');var BPromise=require(_0x407a('0x3'));var rp=require(_0x407a('0x4'));var fs=require('fs');var path=require(_0x407a('0x5'));var rimraf=require(_0x407a('0x6'));var config=require(_0x407a('0x7'));var attributes=require(_0x407a('0x8'));module[_0x407a('0x9')]=function(_0x44cc95,_0x1551f2){return _0x44cc95[_0x407a('0xa')](_0x407a('0xb'),attributes,{'tableName':_0x407a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x048c=['api','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','lodash'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0x048c,0xdb));var _0xc048=function(_0x205912,_0x5412f1){_0x205912=_0x205912-0x0;var _0x1e3598=_0x048c[_0x205912];return _0x1e3598;};'use strict';var _=require(_0xc048('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc048('0x1'));var moment=require('moment');var BPromise=require(_0xc048('0x2'));var rp=require(_0xc048('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc048('0x4'));var config=require(_0xc048('0x5'));var attributes=require(_0xc048('0x6'));module[_0xc048('0x7')]=function(_0x3f7ead,_0x29b907){return _0x3f7ead[_0xc048('0x8')](_0xc048('0x9'),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 9d41ee7..d736620 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 _0x1cf3=['request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s'];(function(_0x148879,_0x5b4c11){var _0x4f7027=function(_0xad056b){while(--_0xad056b){_0x148879['push'](_0x148879['shift']());}};_0x4f7027(++_0x5b4c11);}(_0x1cf3,0x1be));var _0x31cf=function(_0x2d4a6c,_0xed414d){_0x2d4a6c=_0x2d4a6c-0x0;var _0xfe662e=_0x1cf3[_0x2d4a6c];return _0xfe662e;};'use strict';var _=require(_0x31cf('0x0'));var util=require(_0x31cf('0x1'));var moment=require(_0x31cf('0x2'));var BPromise=require(_0x31cf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31cf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x31cf('0x5'));var logger=require(_0x31cf('0x6'))(_0x31cf('0x7'));var config=require(_0x31cf('0x8'));var jayson=require(_0x31cf('0x9'));var client=jayson[_0x31cf('0xa')][_0x31cf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1830b4,_0x2581c4,_0x6be80){return new BPromise(function(_0x3f7b2e,_0x3fa83e){return client[_0x31cf('0xc')](_0x1830b4,_0x6be80)[_0x31cf('0xd')](function(_0x56e8f6){logger[_0x31cf('0xe')](_0x31cf('0xf'),_0x2581c4,_0x31cf('0x10'));logger['debug'](_0x31cf('0x11'),_0x2581c4,_0x31cf('0x10'),JSON[_0x31cf('0x12')](_0x56e8f6));if(_0x56e8f6[_0x31cf('0x13')]){if(_0x56e8f6[_0x31cf('0x13')]['code']===0x1f4){logger['error'](_0x31cf('0xf'),_0x2581c4,_0x56e8f6[_0x31cf('0x13')][_0x31cf('0x14')]);return _0x3fa83e(_0x56e8f6[_0x31cf('0x13')]['message']);}logger[_0x31cf('0x13')](_0x31cf('0xf'),_0x2581c4,_0x56e8f6[_0x31cf('0x13')]['message']);return _0x3f7b2e(_0x56e8f6[_0x31cf('0x13')][_0x31cf('0x14')]);}else{logger[_0x31cf('0xe')](_0x31cf('0xf'),_0x2581c4,'request\x20sent');_0x3f7b2e(_0x56e8f6['result'][_0x31cf('0x14')]);}})[_0x31cf('0x15')](function(_0x2d5532){logger['error'](_0x31cf('0xf'),_0x2581c4,_0x2d5532);_0x3fa83e(_0x2d5532);});});} \ No newline at end of file +var _0x9c02=['stringify','error','code','message','License,\x20%s,\x20%s','result','catch','lodash','util','moment','../../config/utils','rpc','jayson/promise','http','request','then','info','debug','request\x20sent'];(function(_0x45bda0,_0x4b7880){var _0x57746a=function(_0x1e5acf){while(--_0x1e5acf){_0x45bda0['push'](_0x45bda0['shift']());}};_0x57746a(++_0x4b7880);}(_0x9c02,0x196));var _0x29c0=function(_0x566b41,_0x3b7500){_0x566b41=_0x566b41-0x0;var _0x5e5d73=_0x9c02[_0x566b41];return _0x5e5d73;};'use strict';var _=require(_0x29c0('0x0'));var util=require(_0x29c0('0x1'));var moment=require(_0x29c0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x29c0('0x3'));var logger=require('../../config/logger')(_0x29c0('0x4'));var config=require('../../config/environment');var jayson=require(_0x29c0('0x5'));var client=jayson['client'][_0x29c0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x308869,_0x1ac647,_0x5beeb6){return new BPromise(function(_0x58fa3e,_0x18c44c){return client[_0x29c0('0x7')](_0x308869,_0x5beeb6)[_0x29c0('0x8')](function(_0x2e83cb){logger[_0x29c0('0x9')]('License,\x20%s,\x20%s',_0x1ac647,'request\x20sent');logger[_0x29c0('0xa')]('License,\x20%s,\x20%s,\x20%s',_0x1ac647,_0x29c0('0xb'),JSON[_0x29c0('0xc')](_0x2e83cb));if(_0x2e83cb[_0x29c0('0xd')]){if(_0x2e83cb[_0x29c0('0xd')][_0x29c0('0xe')]===0x1f4){logger[_0x29c0('0xd')]('License,\x20%s,\x20%s',_0x1ac647,_0x2e83cb[_0x29c0('0xd')][_0x29c0('0xf')]);return _0x18c44c(_0x2e83cb[_0x29c0('0xd')][_0x29c0('0xf')]);}logger[_0x29c0('0xd')](_0x29c0('0x10'),_0x1ac647,_0x2e83cb[_0x29c0('0xd')][_0x29c0('0xf')]);return _0x58fa3e(_0x2e83cb[_0x29c0('0xd')][_0x29c0('0xf')]);}else{logger[_0x29c0('0x9')](_0x29c0('0x10'),_0x1ac647,_0x29c0('0xb'));_0x58fa3e(_0x2e83cb[_0x29c0('0x11')][_0x29c0('0xf')]);}})[_0x29c0('0x12')](function(_0x6a0177){logger[_0x29c0('0xd')](_0x29c0('0x10'),_0x1ac647,_0x6a0177);_0x18c44c(_0x6a0177);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6e44f08..25a055b 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 _0xe740=['send','addAgents','/:id','update','delete','removeDispositions','removeImap','destroy','exports','multer','path','connect-timeout','Router','../../components/interaction/service','./mailAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send'];(function(_0x1dbb97,_0xc2e02f){var _0x57612f=function(_0x5e9ffc){while(--_0x5e9ffc){_0x1dbb97['push'](_0x1dbb97['shift']());}};_0x57612f(++_0xc2e02f);}(_0xe740,0x14b));var _0x0e74=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xe740[_0xbeb808];return _0x5d6909;};'use strict';var multer=require(_0x0e74('0x0'));var util=require('util');var path=require(_0x0e74('0x1'));var timeout=require(_0x0e74('0x2'));var express=require('express');var router=express[_0x0e74('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0e74('0x4'));var config=require('../../config/environment');var controller=require(_0x0e74('0x5'));router[_0x0e74('0x6')]('/',auth['isAuthenticated'](),controller[_0x0e74('0x7')]);router['get'](_0x0e74('0x8'),auth[_0x0e74('0x9')](),controller[_0x0e74('0xa')]);router[_0x0e74('0x6')]('/:id',auth[_0x0e74('0x9')](),controller[_0x0e74('0xb')]);router[_0x0e74('0x6')](_0x0e74('0xc'),auth['isAuthenticated'](),controller[_0x0e74('0xd')]);router['get'](_0x0e74('0xe'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x0e74('0x6')](_0x0e74('0xf'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x10')]);router['get'](_0x0e74('0x11'),auth['isAuthenticated'](),controller[_0x0e74('0x12')]);router[_0x0e74('0x6')](_0x0e74('0x13'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x14')]);router[_0x0e74('0x6')](_0x0e74('0x15'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x16')]);router[_0x0e74('0x6')](_0x0e74('0x17'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x18')]);router['get']('/:id/verify',auth[_0x0e74('0x9')](),controller[_0x0e74('0x19')]);router[_0x0e74('0x6')](_0x0e74('0x1a'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x1b')]);router[_0x0e74('0x1c')](_0x0e74('0xc'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x1d')]);router[_0x0e74('0x1c')]('/:id/canned_answers',auth[_0x0e74('0x9')](),controller[_0x0e74('0x1e')]);router[_0x0e74('0x1c')]('/',auth[_0x0e74('0x9')](),controller[_0x0e74('0x1f')]);router[_0x0e74('0x1c')]('/:id/in_servers',auth[_0x0e74('0x9')](),controller[_0x0e74('0x20')]);router[_0x0e74('0x1c')](_0x0e74('0x11'),auth['isAuthenticated'](),controller[_0x0e74('0x21')]);router[_0x0e74('0x1c')](_0x0e74('0x13'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x22')]);router[_0x0e74('0x1c')](_0x0e74('0x15'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x23')]);router[_0x0e74('0x1c')](_0x0e74('0x24'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x25')]);router['post'](_0x0e74('0x1a'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x26')]);router['put'](_0x0e74('0x27'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x28')]);router[_0x0e74('0x29')](_0x0e74('0xc'),auth['isAuthenticated'](),controller[_0x0e74('0x2a')]);router[_0x0e74('0x29')](_0x0e74('0xe'),auth[_0x0e74('0x9')](),controller['removeAnswers']);router[_0x0e74('0x29')](_0x0e74('0xf'),auth['isAuthenticated'](),controller[_0x0e74('0x2b')]);router['delete'](_0x0e74('0x11'),auth[_0x0e74('0x9')](),controller['removeSmtp']);router[_0x0e74('0x29')](_0x0e74('0x27'),auth[_0x0e74('0x9')](),controller[_0x0e74('0x2c')]);router[_0x0e74('0x29')](_0x0e74('0x1a'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x0e74('0x2d')]=router; \ No newline at end of file +var _0xbd9e=['addSmtp','addApplications','send','/:id/users','addAgents','update','delete','removeAnswers','removeImap','removeSmtp','/:id','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/dispositions','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','/:id/canned_answers','create','addImap','/:id/out_servers'];(function(_0x21b706,_0x1022f4){var _0x13b94a=function(_0x3116da){while(--_0x3116da){_0x21b706['push'](_0x21b706['shift']());}};_0x13b94a(++_0x1022f4);}(_0xbd9e,0x108));var _0xebd9=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xbd9e[_0xd0b415];return _0x2bdf2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebd9('0x0'));var timeout=require('connect-timeout');var express=require(_0xebd9('0x1'));var router=express[_0xebd9('0x2')]();var auth=require(_0xebd9('0x3'));var interaction=require(_0xebd9('0x4'));var config=require(_0xebd9('0x5'));var controller=require('./mailAccount.controller');router[_0xebd9('0x6')]('/',auth['isAuthenticated'](),controller[_0xebd9('0x7')]);router[_0xebd9('0x6')](_0xebd9('0x8'),auth[_0xebd9('0x9')](),controller[_0xebd9('0xa')]);router[_0xebd9('0x6')]('/:id',auth[_0xebd9('0x9')](),controller[_0xebd9('0xb')]);router[_0xebd9('0x6')](_0xebd9('0xc'),auth[_0xebd9('0x9')](),controller['getDispositions']);router[_0xebd9('0x6')]('/:id/canned_answers',auth[_0xebd9('0x9')](),controller['getAnswers']);router[_0xebd9('0x6')](_0xebd9('0xd'),auth['isAuthenticated'](),controller[_0xebd9('0xe')]);router[_0xebd9('0x6')]('/:id/out_servers',auth[_0xebd9('0x9')](),controller[_0xebd9('0xf')]);router[_0xebd9('0x6')](_0xebd9('0x10'),auth['isAuthenticated'](),controller[_0xebd9('0x11')]);router[_0xebd9('0x6')](_0xebd9('0x12'),auth[_0xebd9('0x9')](),controller[_0xebd9('0x13')]);router[_0xebd9('0x6')](_0xebd9('0x14'),auth[_0xebd9('0x9')](),controller[_0xebd9('0x15')]);router[_0xebd9('0x6')](_0xebd9('0x16'),auth[_0xebd9('0x9')](),controller[_0xebd9('0x17')]);router[_0xebd9('0x6')]('/:id/users',auth[_0xebd9('0x9')](),controller[_0xebd9('0x18')]);router[_0xebd9('0x19')]('/:id/dispositions',auth[_0xebd9('0x9')](),controller['addDisposition']);router[_0xebd9('0x19')](_0xebd9('0x1a'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth[_0xebd9('0x9')](),controller[_0xebd9('0x1b')]);router[_0xebd9('0x19')]('/:id/in_servers',auth[_0xebd9('0x9')](),controller[_0xebd9('0x1c')]);router[_0xebd9('0x19')](_0xebd9('0x1d'),auth[_0xebd9('0x9')](),controller[_0xebd9('0x1e')]);router['post'](_0xebd9('0x10'),auth[_0xebd9('0x9')](),controller['addInteraction']);router['post'](_0xebd9('0x12'),auth[_0xebd9('0x9')](),controller[_0xebd9('0x1f')]);router[_0xebd9('0x19')]('/:id/send',auth[_0xebd9('0x9')](),controller[_0xebd9('0x20')]);router[_0xebd9('0x19')](_0xebd9('0x21'),auth['isAuthenticated'](),controller[_0xebd9('0x22')]);router['put']('/:id',auth[_0xebd9('0x9')](),controller[_0xebd9('0x23')]);router[_0xebd9('0x24')](_0xebd9('0xc'),auth[_0xebd9('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xebd9('0x9')](),controller[_0xebd9('0x25')]);router[_0xebd9('0x24')](_0xebd9('0xd'),auth[_0xebd9('0x9')](),controller[_0xebd9('0x26')]);router[_0xebd9('0x24')](_0xebd9('0x1d'),auth[_0xebd9('0x9')](),controller[_0xebd9('0x27')]);router[_0xebd9('0x24')](_0xebd9('0x28'),auth['isAuthenticated'](),controller[_0xebd9('0x29')]);router['delete'](_0xebd9('0x21'),auth[_0xebd9('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index cf83291..4c91f8f 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 _0x41a5=['exports','STRING','BOOLEAN','TEXT','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x2079e7,_0xdc5145){var _0x5a26c9=function(_0x29422d){while(--_0x29422d){_0x2079e7['push'](_0x2079e7['shift']());}};_0x5a26c9(++_0xdc5145);}(_0x41a5,0x83));var _0x541a=function(_0x1b2be7,_0x149432){_0x1b2be7=_0x1b2be7-0x0;var _0x11553c=_0x41a5[_0x1b2be7];return _0x11553c;};'use strict';var Sequelize=require(_0x541a('0x0'));module[_0x541a('0x1')]={'description':{'type':Sequelize[_0x541a('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x541a('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x541a('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x541a('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x541a('0x4')]},'markAsUnread':{'type':Sequelize[_0x541a('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x541a('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x541a('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x541a('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x541a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x541a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x541a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x541a('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x541a('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x9f383b){if(!_0x9f383b)this[_0x541a('0x9')](_0x541a('0xa'),null);this['setDataValue'](_0x541a('0xb'),_0x9f383b);}}}; \ No newline at end of file +var _0xc139=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0xe38764,_0x28ce79){var _0x5979cf=function(_0x1fedef){while(--_0x1fedef){_0xe38764['push'](_0xe38764['shift']());}};_0x5979cf(++_0x28ce79);}(_0xc139,0xf5));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9c13('0x0'));module[_0x9c13('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9c13('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x9c13('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9c13('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9c13('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9c13('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x9c13('0x4')]},'markAsUnread':{'type':Sequelize[_0x9c13('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9c13('0x5')},'fontSize':{'type':Sequelize[_0x9c13('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9c13('0x4')],'defaultValue':function(){return _0x9c13('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9c13('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c13('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9c13('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9c13('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9c13('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9c13('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x9c13('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9c13('0x3')],'defaultValue':![],'comment':_0x9c13('0x9'),'set':function(_0x48d3c6){if(!_0x48d3c6)this[_0x9c13('0xa')](_0x9c13('0xb'),null);this[_0x9c13('0xa')](_0x9c13('0xc'),_0x48d3c6);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index f0d948b..e6f3c5a 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 _0xf204=['service','MailServerOut','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','findOne','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','DESC','from','attachments','join','root','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','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','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','status','offset','limit','set','Content-Range','json','apply','reject','save','destroy','get','MailAccounts','UserProfileResource','stack','send','index','MailServerIn','Imap','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','params','mandatoryDispositionPause','update','body','find','describe','addDisposition','MailAccountId','Disposition','create','nolimit','findAll','rows','ids','CannedAnswer','removeAnswers','ListId','active','description','isNil','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0xf204,0x108));var _0x4f20=function(_0x4c2087,_0x37ce01){_0x4c2087=_0x4c2087-0x0;var _0x5eae39=_0xf204[_0x4c2087];return _0x5eae39;};'use strict';var pdf=require(_0x4f20('0x0'));var emlformat=require(_0x4f20('0x1'));var rimraf=require(_0x4f20('0x2'));var zipdir=require(_0x4f20('0x3'));var jsonpatch=require(_0x4f20('0x4'));var rp=require(_0x4f20('0x5'));var moment=require('moment');var BPromise=require(_0x4f20('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4f20('0x7'));var sox=require(_0x4f20('0x8'));var csv=require(_0x4f20('0x9'));var ejs=require(_0x4f20('0xa'));var fs=require('fs');var _=require(_0x4f20('0xb'));var squel=require(_0x4f20('0xc'));var crypto=require(_0x4f20('0xd'));var jsforce=require(_0x4f20('0xe'));var deskjs=require(_0x4f20('0xf'));var toCsv=require(_0x4f20('0x9'));var querystring=require(_0x4f20('0x10'));var Papa=require(_0x4f20('0x11'));var Redis=require(_0x4f20('0x12'));var authService=require(_0x4f20('0x13'));var qs=require(_0x4f20('0x14'));var as=require(_0x4f20('0x15'));var hardwareService=require(_0x4f20('0x16'));var logger=require('../../config/logger')(_0x4f20('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f20('0x18'));var db=require(_0x4f20('0x19'))['db'];config[_0x4f20('0x1a')]=_[_0x4f20('0x1b')](config[_0x4f20('0x1a')],{'host':_0x4f20('0x1c'),'port':0x18eb});var socket=require(_0x4f20('0x1d'))(new Redis(config[_0x4f20('0x1a')]));require(_0x4f20('0x1e'))['register'](socket);var jayson=require(_0x4f20('0x1f'));var client=jayson[_0x4f20('0x20')][_0x4f20('0x21')]({'port':0x232b});function respondWithRpcPromise(_0xbde24f,_0x5486d0,_0x2b2cb7,_0x3dcb21){return new BPromise(function(_0x8c274f,_0x57497b){var _0x126bf3=_0x3dcb21||client;return _0x126bf3[_0x4f20('0x22')](_0xbde24f,_0x2b2cb7)[_0x4f20('0x23')](function(_0x3a90cd){logger['info'](_0x4f20('0x24'),_0x5486d0,'request\x20sent');logger[_0x4f20('0x25')](_0x4f20('0x26'),_0x5486d0,'request\x20sent',JSON[_0x4f20('0x27')](_0x3a90cd));if(_0x3a90cd['error']){if(_0x3a90cd[_0x4f20('0x28')][_0x4f20('0x29')]===0x1f4){logger[_0x4f20('0x28')](_0x4f20('0x24'),_0x5486d0,_0x3a90cd[_0x4f20('0x28')]['message']);return _0x57497b(_0x3a90cd['error'][_0x4f20('0x2a')]);}logger['error'](_0x4f20('0x24'),_0x5486d0,_0x3a90cd[_0x4f20('0x28')]['message']);return _0x8c274f(_0x3a90cd[_0x4f20('0x28')]['message']);}else{logger[_0x4f20('0x2b')](_0x4f20('0x24'),_0x5486d0,_0x4f20('0x2c'));_0x8c274f(_0x3a90cd[_0x4f20('0x2d')][_0x4f20('0x2a')]);}})[_0x4f20('0x2e')](function(_0xc10d3f){logger[_0x4f20('0x28')](_0x4f20('0x24'),_0x5486d0,_0xc10d3f);_0x57497b(_0xc10d3f);});});}function respondWithStatusCode(_0x541198,_0x71333){_0x71333=_0x71333||0xcc;return function(_0x2259e7){if(_0x2259e7){return _0x541198['sendStatus'](_0x71333);}return _0x541198['status'](_0x71333)['end']();};}function respondWithResult(_0x304ef6,_0x5c8f53){_0x5c8f53=_0x5c8f53||0xc8;return function(_0x128ec8){if(_0x128ec8){return _0x304ef6[_0x4f20('0x2f')](_0x5c8f53)['json'](_0x128ec8);}};}function respondWithFilteredResult(_0x4358aa,_0x2d992c){return function(_0x2fac23){if(_0x2fac23){var _0x1515e4=_0x2fac23['count'],_0x162ebc=_0x2d992c[_0x4f20('0x30')],_0x39f48e=_0x2d992c[_0x4f20('0x30')]+_0x2d992c[_0x4f20('0x31')],_0xde451f;if(_0x39f48e>=_0x1515e4){_0x39f48e=_0x1515e4;_0xde451f=0xc8;}else{_0xde451f=0xce;}_0x4358aa['status'](_0xde451f);return _0x4358aa[_0x4f20('0x32')](_0x4f20('0x33'),_0x162ebc+'-'+_0x39f48e+'/'+_0x1515e4)[_0x4f20('0x34')](_0x2fac23);}return null;};}function patchUpdates(_0x191f60){return function(_0x1d1caa){try{jsonpatch[_0x4f20('0x35')](_0x1d1caa,_0x191f60,!![]);}catch(_0x33df47){return BPromise[_0x4f20('0x36')](_0x33df47);}return _0x1d1caa[_0x4f20('0x37')]();};}function saveUpdates(_0x54b066,_0x3c116c){return function(_0x55a452){if(_0x55a452){return _0x55a452['update'](_0x54b066)[_0x4f20('0x23')](function(_0x1e7669){return _0x1e7669;});}return null;};}function removeEntity(_0x3216ff,_0xc968eb){return function(_0x483714){if(_0x483714){return _0x483714[_0x4f20('0x38')]()[_0x4f20('0x23')](function(){var _0x1aec36=_0x483714[_0x4f20('0x39')]({'plain':!![]});var _0x1941d6=_0x4f20('0x3a');return db[_0x4f20('0x3b')][_0x4f20('0x38')]({'where':{'type':_0x1941d6,'resourceId':_0x1aec36['id']}})[_0x4f20('0x23')](function(){return _0x483714;});})['then'](function(){_0x3216ff[_0x4f20('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e6e52,_0x9e5303){return function(_0x336ae8){if(!_0x336ae8){_0x2e6e52['sendStatus'](0x194);}return _0x336ae8;};}function handleError(_0x5c1053,_0x1ce1dd){_0x1ce1dd=_0x1ce1dd||0x1f4;return function(_0x1aeefd){logger[_0x4f20('0x28')](_0x1aeefd[_0x4f20('0x3c')]);if(_0x1aeefd['name']){delete _0x1aeefd['name'];}_0x5c1053[_0x4f20('0x2f')](_0x1ce1dd)[_0x4f20('0x3d')](_0x1aeefd);};}exports[_0x4f20('0x3e')]=function(_0x5220fa,_0x1f6169){var _0xf7d2f4={'include':[{'model':db[_0x4f20('0x3f')],'as':_0x4f20('0x40')},{'model':db['MailServerOut'],'as':_0x4f20('0x41')},{'model':db[_0x4f20('0x42')],'as':'mandatoryDispositionPause'}]},_0x423d44={},_0x6ab29e={'count':0x0,'rows':[]};var _0x5964f7=_[_0x4f20('0x43')](db[_0x4f20('0x44')][_0x4f20('0x45')],function(_0x3ba9f4){return{'name':_0x3ba9f4[_0x4f20('0x46')],'type':_0x3ba9f4[_0x4f20('0x47')][_0x4f20('0x48')]};});_0x423d44[_0x4f20('0x49')]=_[_0x4f20('0x43')](_0x5964f7,_0x4f20('0x4a'));_0x423d44[_0x4f20('0x4b')]=_[_0x4f20('0x4c')](_0x5220fa[_0x4f20('0x4b')]);_0x423d44['filters']=_[_0x4f20('0x4d')](_0x423d44[_0x4f20('0x49')],_0x423d44[_0x4f20('0x4b')]);_0xf7d2f4[_0x4f20('0x4e')]=_[_0x4f20('0x4d')](_0x423d44[_0x4f20('0x49')],qs[_0x4f20('0x4f')](_0x5220fa[_0x4f20('0x4b')][_0x4f20('0x4f')]));_0xf7d2f4['attributes']=_0xf7d2f4[_0x4f20('0x4e')][_0x4f20('0x50')]?_0xf7d2f4[_0x4f20('0x4e')]:_0x423d44[_0x4f20('0x49')];if(!_0x5220fa[_0x4f20('0x4b')][_0x4f20('0x51')]('nolimit')){_0xf7d2f4[_0x4f20('0x31')]=qs['limit'](_0x5220fa['query'][_0x4f20('0x31')]);_0xf7d2f4[_0x4f20('0x30')]=qs[_0x4f20('0x30')](_0x5220fa[_0x4f20('0x4b')][_0x4f20('0x30')]);}_0xf7d2f4[_0x4f20('0x52')]=qs[_0x4f20('0x53')](_0x5220fa['query']['sort']);_0xf7d2f4['where']=qs[_0x4f20('0x54')](_[_0x4f20('0x55')](_0x5220fa['query'],_0x423d44['filters']),_0x5964f7);if(_0x5220fa[_0x4f20('0x4b')]['filter']){_0xf7d2f4[_0x4f20('0x56')]=_[_0x4f20('0x57')](_0xf7d2f4[_0x4f20('0x56')],{'$or':_[_0x4f20('0x43')](_0x5964f7,function(_0x42b463){if(_0x42b463['type']!==_0x4f20('0x58')){var _0x183a90={};_0x183a90[_0x42b463[_0x4f20('0x4a')]]={'$like':'%'+_0x5220fa[_0x4f20('0x4b')][_0x4f20('0x59')]+'%'};return _0x183a90;}})});}_0xf7d2f4=_['merge']({},_0xf7d2f4,_0x5220fa[_0x4f20('0x5a')]);var _0x4e24dd={'where':_0xf7d2f4['where']};return db[_0x4f20('0x44')][_0x4f20('0x5b')](_0x4e24dd)[_0x4f20('0x23')](function(_0x4c336d){_0x6ab29e[_0x4f20('0x5b')]=_0x4c336d;if(_0x5220fa[_0x4f20('0x4b')][_0x4f20('0x5c')]){_0xf7d2f4[_0x4f20('0x5d')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0xf7d2f4);})[_0x4f20('0x23')](function(_0x3d1fa9){_0x6ab29e['rows']=_0x3d1fa9;return _0x6ab29e;})['then'](respondWithFilteredResult(_0x1f6169,_0xf7d2f4))[_0x4f20('0x2e')](handleError(_0x1f6169,null));};exports['show']=function(_0x4b554e,_0x2f7426){var _0x259613={'raw':![],'where':{'id':_0x4b554e[_0x4f20('0x5e')]['id']},'include':[{'model':db[_0x4f20('0x3f')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x4f20('0x41')},{'model':db[_0x4f20('0x42')],'as':_0x4f20('0x5f')}]},_0x412b30={};_0x412b30[_0x4f20('0x49')]=_[_0x4f20('0x4c')](db['MailAccount'][_0x4f20('0x45')]);_0x412b30[_0x4f20('0x4b')]=_[_0x4f20('0x4c')](_0x4b554e[_0x4f20('0x4b')]);_0x412b30[_0x4f20('0x54')]=_['intersection'](_0x412b30[_0x4f20('0x49')],_0x412b30['query']);_0x259613[_0x4f20('0x4e')]=_[_0x4f20('0x4d')](_0x412b30[_0x4f20('0x49')],qs[_0x4f20('0x4f')](_0x4b554e[_0x4f20('0x4b')][_0x4f20('0x4f')]));_0x259613['attributes']=_0x259613[_0x4f20('0x4e')][_0x4f20('0x50')]?_0x259613[_0x4f20('0x4e')]:_0x412b30['model'];if(_0x4b554e[_0x4f20('0x4b')]['includeAll']){_0x259613[_0x4f20('0x5d')]=[{'all':!![]}];}_0x259613=_[_0x4f20('0x57')]({},_0x259613,_0x4b554e[_0x4f20('0x5a')]);return db[_0x4f20('0x44')]['find'](_0x259613)[_0x4f20('0x23')](handleEntityNotFound(_0x2f7426,null))[_0x4f20('0x23')](respondWithResult(_0x2f7426,null))[_0x4f20('0x2e')](handleError(_0x2f7426,null));};exports[_0x4f20('0x60')]=function(_0xda5b90,_0x571037){if(_0xda5b90[_0x4f20('0x61')]['id']){delete _0xda5b90[_0x4f20('0x61')]['id'];}return db[_0x4f20('0x44')][_0x4f20('0x62')]({'where':{'id':_0xda5b90['params']['id']},'include':[{'model':db[_0x4f20('0x3f')],'as':_0x4f20('0x40')},{'model':db['MailServerOut'],'as':_0x4f20('0x41')},{'model':db[_0x4f20('0x42')],'as':'mandatoryDispositionPause'}]})[_0x4f20('0x23')](handleEntityNotFound(_0x571037,null))[_0x4f20('0x23')](saveUpdates(_0xda5b90[_0x4f20('0x61')],null))[_0x4f20('0x23')](function(_0x425c07){if(_0x425c07&&_0xda5b90[_0x4f20('0x61')]['Imap']){return db[_0x4f20('0x3f')]['update'](_0xda5b90[_0x4f20('0x61')][_0x4f20('0x40')],{'where':{'MailAccountId':_0x425c07['id']}})[_0x4f20('0x23')](function(){return _0x425c07;});}return _0x425c07;})[_0x4f20('0x23')](function(_0x1fbbd2){if(_0x1fbbd2&&_0xda5b90[_0x4f20('0x61')][_0x4f20('0x41')]){return db['MailServerOut']['update'](_0xda5b90['body'][_0x4f20('0x41')],{'where':{'MailAccountId':_0x1fbbd2['id']}})['then'](function(){return _0x1fbbd2;});}return _0x1fbbd2;})[_0x4f20('0x23')](respondWithResult(_0x571037,null))[_0x4f20('0x2e')](handleError(_0x571037,null));};exports[_0x4f20('0x63')]=function(_0x50239a,_0x270974){return db[_0x4f20('0x44')][_0x4f20('0x63')]()[_0x4f20('0x23')](respondWithResult(_0x270974,null))[_0x4f20('0x2e')](handleError(_0x270974,null));};exports[_0x4f20('0x64')]=function(_0x25feb5,_0x195977,_0x1fe9b0){if(_0x25feb5[_0x4f20('0x61')]['id']){delete _0x25feb5[_0x4f20('0x61')]['id'];}return db[_0x4f20('0x44')][_0x4f20('0x62')]({'where':{'id':_0x25feb5[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x195977,null))[_0x4f20('0x23')](function(_0x32db5f){if(_0x32db5f){_0x25feb5[_0x4f20('0x61')][_0x4f20('0x65')]=_0x32db5f['id'];return db[_0x4f20('0x66')][_0x4f20('0x67')](_0x25feb5['body']);}})[_0x4f20('0x23')](respondWithResult(_0x195977,null))['catch'](handleError(_0x195977,null));};exports['getDispositions']=function(_0x34c71d,_0x51acf5,_0x82615b){var _0x29a7e2={'raw':![],'where':{}};var _0x4e0d58={};var _0x310ce3={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x34c71d[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x51acf5,null))[_0x4f20('0x23')](function(_0x25c9ef){if(_0x25c9ef){_0x4e0d58[_0x4f20('0x49')]=_[_0x4f20('0x4c')](db[_0x4f20('0x66')][_0x4f20('0x45')]);_0x4e0d58[_0x4f20('0x4b')]=_[_0x4f20('0x4c')](_0x34c71d[_0x4f20('0x4b')]);_0x4e0d58[_0x4f20('0x54')]=_[_0x4f20('0x4d')](_0x4e0d58[_0x4f20('0x49')],_0x4e0d58[_0x4f20('0x4b')]);_0x29a7e2[_0x4f20('0x4e')]=_[_0x4f20('0x4d')](_0x4e0d58['model'],qs['fields'](_0x34c71d['query']['fields']));_0x29a7e2[_0x4f20('0x4e')]=_0x29a7e2[_0x4f20('0x4e')][_0x4f20('0x50')]?_0x29a7e2[_0x4f20('0x4e')]:_0x4e0d58[_0x4f20('0x49')];if(!_0x34c71d['query'][_0x4f20('0x51')](_0x4f20('0x68'))){_0x29a7e2[_0x4f20('0x31')]=qs[_0x4f20('0x31')](_0x34c71d[_0x4f20('0x4b')][_0x4f20('0x31')]);_0x29a7e2[_0x4f20('0x30')]=qs[_0x4f20('0x30')](_0x34c71d['query'][_0x4f20('0x30')]);}_0x29a7e2['order']=qs[_0x4f20('0x53')](_0x34c71d[_0x4f20('0x4b')][_0x4f20('0x53')]);_0x29a7e2['where']=qs['filters'](_['pick'](_0x34c71d[_0x4f20('0x4b')],_0x4e0d58['filters']));_0x29a7e2[_0x4f20('0x56')][_0x4f20('0x65')]=_0x25c9ef['id'];if(_0x34c71d[_0x4f20('0x4b')]['filter']){_0x29a7e2[_0x4f20('0x56')]=_[_0x4f20('0x57')](_0x29a7e2[_0x4f20('0x56')],{'$or':_[_0x4f20('0x43')](_0x29a7e2[_0x4f20('0x4e')],function(_0x52e8ba){var _0x2d3309={};_0x2d3309[_0x52e8ba]={'$like':'%'+_0x34c71d[_0x4f20('0x4b')][_0x4f20('0x59')]+'%'};return _0x2d3309;})});}_0x29a7e2=_[_0x4f20('0x57')]({},_0x29a7e2,_0x34c71d[_0x4f20('0x5a')]);return db[_0x4f20('0x66')][_0x4f20('0x5b')]({'where':_0x29a7e2[_0x4f20('0x56')]})['then'](function(_0x209b11){_0x310ce3['count']=_0x209b11;if(_0x34c71d[_0x4f20('0x4b')][_0x4f20('0x5c')]){_0x29a7e2['include']=[{'all':!![]}];}return db[_0x4f20('0x66')][_0x4f20('0x69')](_0x29a7e2);})[_0x4f20('0x23')](function(_0x42a952){_0x310ce3[_0x4f20('0x6a')]=_0x42a952;return _0x310ce3;});}})[_0x4f20('0x23')](respondWithFilteredResult(_0x51acf5,_0x29a7e2))[_0x4f20('0x2e')](handleError(_0x51acf5,null));};exports['removeDispositions']=function(_0x735df9,_0x134c9d,_0x590393){return db[_0x4f20('0x44')][_0x4f20('0x62')]({'where':{'id':_0x735df9[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x134c9d,null))[_0x4f20('0x23')](function(_0x4c5e91){if(_0x4c5e91){return _0x4c5e91['removeDispositions'](_0x735df9['query'][_0x4f20('0x6b')]);}})[_0x4f20('0x23')](respondWithStatusCode(_0x134c9d,null))[_0x4f20('0x2e')](handleError(_0x134c9d,null));};exports['addAnswer']=function(_0x397028,_0x5dabeb,_0x1c6312){if(_0x397028[_0x4f20('0x61')]['id']){delete _0x397028[_0x4f20('0x61')]['id'];}return db[_0x4f20('0x44')][_0x4f20('0x62')]({'where':{'id':_0x397028['params']['id']}})['then'](handleEntityNotFound(_0x5dabeb,null))[_0x4f20('0x23')](function(_0x45a135){if(_0x45a135){_0x397028['body'][_0x4f20('0x65')]=_0x45a135['id'];return db[_0x4f20('0x6c')][_0x4f20('0x67')](_0x397028[_0x4f20('0x61')]);}})[_0x4f20('0x23')](respondWithResult(_0x5dabeb,null))[_0x4f20('0x2e')](handleError(_0x5dabeb,null));};exports['getAnswers']=function(_0x3ce0ad,_0x35d213,_0x296509){var _0x5cb72b={'raw':![],'where':{}};var _0x1f9fcb={};var _0x421bdc={'count':0x0,'rows':[]};return db[_0x4f20('0x44')]['findOne']({'where':{'id':_0x3ce0ad['params']['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x35d213,null))['then'](function(_0x314102){if(_0x314102){_0x1f9fcb['model']=_['keys'](db['CannedAnswer'][_0x4f20('0x45')]);_0x1f9fcb[_0x4f20('0x4b')]=_[_0x4f20('0x4c')](_0x3ce0ad['query']);_0x1f9fcb[_0x4f20('0x54')]=_[_0x4f20('0x4d')](_0x1f9fcb[_0x4f20('0x49')],_0x1f9fcb[_0x4f20('0x4b')]);_0x5cb72b[_0x4f20('0x4e')]=_[_0x4f20('0x4d')](_0x1f9fcb['model'],qs['fields'](_0x3ce0ad[_0x4f20('0x4b')][_0x4f20('0x4f')]));_0x5cb72b[_0x4f20('0x4e')]=_0x5cb72b[_0x4f20('0x4e')][_0x4f20('0x50')]?_0x5cb72b[_0x4f20('0x4e')]:_0x1f9fcb[_0x4f20('0x49')];if(!_0x3ce0ad['query'][_0x4f20('0x51')]('nolimit')){_0x5cb72b[_0x4f20('0x31')]=qs['limit'](_0x3ce0ad[_0x4f20('0x4b')][_0x4f20('0x31')]);_0x5cb72b[_0x4f20('0x30')]=qs[_0x4f20('0x30')](_0x3ce0ad[_0x4f20('0x4b')][_0x4f20('0x30')]);}_0x5cb72b['order']=qs[_0x4f20('0x53')](_0x3ce0ad['query'][_0x4f20('0x53')]);_0x5cb72b[_0x4f20('0x56')]=qs[_0x4f20('0x54')](_[_0x4f20('0x55')](_0x3ce0ad[_0x4f20('0x4b')],_0x1f9fcb[_0x4f20('0x54')]));_0x5cb72b['where'][_0x4f20('0x65')]=_0x314102['id'];if(_0x3ce0ad['query'][_0x4f20('0x59')]){_0x5cb72b[_0x4f20('0x56')]=_[_0x4f20('0x57')](_0x5cb72b['where'],{'$or':_['map'](_0x5cb72b[_0x4f20('0x4e')],function(_0x17b9d7){var _0x20bb42={};_0x20bb42[_0x17b9d7]={'$like':'%'+_0x3ce0ad[_0x4f20('0x4b')][_0x4f20('0x59')]+'%'};return _0x20bb42;})});}_0x5cb72b=_[_0x4f20('0x57')]({},_0x5cb72b,_0x3ce0ad['options']);return db[_0x4f20('0x6c')]['count']({'where':_0x5cb72b[_0x4f20('0x56')]})[_0x4f20('0x23')](function(_0x57ea0c){_0x421bdc[_0x4f20('0x5b')]=_0x57ea0c;if(_0x3ce0ad[_0x4f20('0x4b')][_0x4f20('0x5c')]){_0x5cb72b[_0x4f20('0x5d')]=[{'all':!![]}];}return db[_0x4f20('0x6c')][_0x4f20('0x69')](_0x5cb72b);})[_0x4f20('0x23')](function(_0x3a7642){_0x421bdc['rows']=_0x3a7642;return _0x421bdc;});}})[_0x4f20('0x23')](respondWithFilteredResult(_0x35d213,_0x5cb72b))['catch'](handleError(_0x35d213,null));};exports[_0x4f20('0x6d')]=function(_0x430b00,_0x589515,_0x439995){return db[_0x4f20('0x44')]['find']({'where':{'id':_0x430b00[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x589515,null))['then'](function(_0x72945e){if(_0x72945e){return _0x72945e[_0x4f20('0x6d')](_0x430b00[_0x4f20('0x4b')][_0x4f20('0x6b')]);}})[_0x4f20('0x23')](respondWithStatusCode(_0x589515,null))[_0x4f20('0x2e')](handleError(_0x589515,null));};exports[_0x4f20('0x67')]=function(_0x31befc,_0x357289){var _0x12026b={'name':_0x31befc[_0x4f20('0x61')]['name'],'key':_0x31befc['body']['key'],'email':_0x31befc['body']['email'],'ListId':_0x31befc['body'][_0x4f20('0x6e')],'active':!_['isNil'](_0x31befc['body'][_0x4f20('0x6f')])?_0x31befc[_0x4f20('0x61')]['active']:!![],'description':_0x31befc[_0x4f20('0x61')][_0x4f20('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x4f20('0x71')](_0x31befc['body'][_0x4f20('0x72')])){if(_0x31befc['body'][_0x4f20('0x73')]){_0x12026b[_0x4f20('0x40')][_0x4f20('0x74')]=_0x12026b[_0x4f20('0x41')][_0x4f20('0x74')]=_0x31befc[_0x4f20('0x61')][_0x4f20('0x75')];_0x12026b[_0x4f20('0x40')][_0x4f20('0x76')]=_0x12026b[_0x4f20('0x41')][_0x4f20('0x77')]=_0x31befc[_0x4f20('0x61')][_0x4f20('0x78')];}else{_0x12026b[_0x4f20('0x40')]['authentication']=_0x12026b[_0x4f20('0x41')][_0x4f20('0x79')]=![];}_0x12026b['Imap'][_0x4f20('0x7a')]=_0x31befc[_0x4f20('0x61')][_0x4f20('0x40')][_0x4f20('0x7a')];_0x12026b[_0x4f20('0x40')][_0x4f20('0x7b')]=_0x31befc[_0x4f20('0x61')][_0x4f20('0x40')][_0x4f20('0x7b')];_0x12026b[_0x4f20('0x41')][_0x4f20('0x7a')]=_0x31befc[_0x4f20('0x61')][_0x4f20('0x41')][_0x4f20('0x7a')];_0x12026b['Smtp'][_0x4f20('0x7b')]=_0x31befc['body'][_0x4f20('0x41')][_0x4f20('0x7b')];}else{_0x12026b['Imap']['service']=_0x12026b[_0x4f20('0x41')][_0x4f20('0x7c')]=_0x31befc['body'][_0x4f20('0x72')];_0x12026b['Imap'][_0x4f20('0x74')]=_0x12026b[_0x4f20('0x41')][_0x4f20('0x74')]=_0x31befc[_0x4f20('0x61')][_0x4f20('0x75')];_0x12026b[_0x4f20('0x40')][_0x4f20('0x76')]=_0x12026b['Smtp'][_0x4f20('0x77')]=_0x31befc[_0x4f20('0x61')][_0x4f20('0x78')];}return db['MailAccount'][_0x4f20('0x67')](_0x12026b,{'include':[{'model':db[_0x4f20('0x7d')],'as':_0x4f20('0x41')},{'model':db[_0x4f20('0x3f')],'as':_0x4f20('0x40')}]})[_0x4f20('0x23')](function(_0x33b338){var _0x186918=_0x31befc[_0x4f20('0x74')]['get']({'plain':!![]});if(!_0x186918)throw new Error(_0x4f20('0x7e'));if(_0x186918['role']==='user'){var _0x530699=_0x33b338[_0x4f20('0x39')]({'plain':!![]});return db[_0x4f20('0x7f')][_0x4f20('0x62')]({'where':{'name':_0x4f20('0x3a'),'userProfileId':_0x186918['userProfileId']},'raw':!![]})[_0x4f20('0x23')](function(_0x2b9789){if(_0x2b9789&&_0x2b9789[_0x4f20('0x80')]===0x0){return db[_0x4f20('0x3b')][_0x4f20('0x67')]({'name':_0x530699['name'],'resourceId':_0x530699['id'],'type':_0x2b9789[_0x4f20('0x4a')],'sectionId':_0x2b9789['id']},{})['then'](function(){return _0x33b338;});}else{return _0x33b338;}})[_0x4f20('0x2e')](function(_0x3676c7){logger[_0x4f20('0x28')](_0x4f20('0x81'),_0x3676c7);throw _0x3676c7;});}return _0x33b338;})['then'](respondWithResult(_0x357289,0xc9))['catch'](handleError(_0x357289,null));};exports['getImap']=function(_0x3e9a94,_0x574bce,_0x136284){return db['MailAccount']['findOne']({'where':{'id':_0x3e9a94[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x574bce,null))[_0x4f20('0x23')](function(_0x4a4fe8){if(_0x4a4fe8){return _0x4a4fe8[_0x4f20('0x82')]();}return null;})[_0x4f20('0x23')](respondWithResult(_0x574bce,null))['catch'](handleError(_0x574bce,null));};exports['addImap']=function(_0x3ed3b8,_0x570cca,_0x2868cb){if(_0x3ed3b8['body']['id']){delete _0x3ed3b8[_0x4f20('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3ed3b8['params']['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x570cca,null))[_0x4f20('0x23')](function(_0x3fd2ea){if(_0x3fd2ea){_0x3ed3b8[_0x4f20('0x61')][_0x4f20('0x65')]=_0x3fd2ea['id'];return db['MailServerIn'][_0x4f20('0x67')](_0x3ed3b8[_0x4f20('0x61')]);}})[_0x4f20('0x23')](respondWithResult(_0x570cca,null))[_0x4f20('0x2e')](handleError(_0x570cca,null));};exports[_0x4f20('0x83')]=function(_0xf5326e,_0x5af577,_0x47ff62){return db[_0x4f20('0x44')][_0x4f20('0x84')]({'where':{'id':_0xf5326e[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x5af577,null))['then'](function(_0x31b6b1){if(_0x31b6b1){return _0x31b6b1[_0x4f20('0x85')](null);}return null;})['then'](respondWithStatusCode(_0x5af577,null))[_0x4f20('0x2e')](handleError(_0x5af577,null));};exports[_0x4f20('0x86')]=function(_0x2fd452,_0x43b377,_0x175854){return db[_0x4f20('0x44')][_0x4f20('0x84')]({'where':{'id':_0x2fd452[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x43b377,null))['then'](function(_0x28f082){if(_0x28f082){return _0x28f082[_0x4f20('0x86')]();}return null;})[_0x4f20('0x23')](respondWithResult(_0x43b377,null))[_0x4f20('0x2e')](handleError(_0x43b377,null));};exports[_0x4f20('0x87')]=function(_0x36281c,_0x75a79d,_0x5cf3c2){if(_0x36281c[_0x4f20('0x61')]['id']){delete _0x36281c[_0x4f20('0x61')]['id'];}return db[_0x4f20('0x44')][_0x4f20('0x62')]({'where':{'id':_0x36281c['params']['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x75a79d,null))[_0x4f20('0x23')](function(_0x3cbd2a){if(_0x3cbd2a){_0x36281c[_0x4f20('0x61')][_0x4f20('0x65')]=_0x3cbd2a['id'];return db['MailServerOut'][_0x4f20('0x67')](_0x36281c[_0x4f20('0x61')]);}})[_0x4f20('0x23')](respondWithResult(_0x75a79d,null))[_0x4f20('0x2e')](handleError(_0x75a79d,null));};exports['removeSmtp']=function(_0x54756d,_0x4830d1,_0x1646d9){return db[_0x4f20('0x44')][_0x4f20('0x84')]({'where':{'id':_0x54756d[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x4830d1,null))[_0x4f20('0x23')](function(_0x414b6e){if(_0x414b6e){return _0x414b6e[_0x4f20('0x88')](null);}return null;})[_0x4f20('0x23')](respondWithStatusCode(_0x4830d1,null))['catch'](handleError(_0x4830d1,null));};exports[_0x4f20('0x89')]=function(_0x5b3bc3,_0x1dd55f,_0x4380b1){return db[_0x4f20('0x8a')][_0x4f20('0x62')]({'where':{'id':_0x5b3bc3['params']['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x1dd55f,null))['then'](function(_0x115f50){if(_0x115f50){return _0x115f50[_0x4f20('0x89')](_0x5b3bc3[_0x4f20('0x61')][_0x4f20('0x6b')],_[_0x4f20('0x8b')](_0x5b3bc3['body'],[_0x4f20('0x6b'),'id'])||{});}})[_0x4f20('0x23')](respondWithResult(_0x1dd55f,null))[_0x4f20('0x2e')](handleError(_0x1dd55f,null));};exports[_0x4f20('0x8c')]=function(_0x2633b2,_0x3397e2,_0x1c5d2a){var _0x10b69f={'raw':![],'where':{}};var _0xab88fa={};var _0x16c58d={'count':0x0,'rows':[]};return db[_0x4f20('0x44')]['findOne']({'where':{'id':_0x2633b2[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x3397e2,null))['then'](function(_0x2c90ec){if(_0x2c90ec){_0xab88fa[_0x4f20('0x49')]=_[_0x4f20('0x4c')](db[_0x4f20('0x8a')][_0x4f20('0x45')]);_0xab88fa[_0x4f20('0x4b')]=_['keys'](_0x2633b2[_0x4f20('0x4b')]);_0xab88fa['filters']=_[_0x4f20('0x4d')](_0xab88fa[_0x4f20('0x49')],_0xab88fa[_0x4f20('0x4b')]);_0x10b69f[_0x4f20('0x4e')]=_[_0x4f20('0x4d')](_0xab88fa[_0x4f20('0x49')],qs[_0x4f20('0x4f')](_0x2633b2[_0x4f20('0x4b')][_0x4f20('0x4f')]));_0x10b69f[_0x4f20('0x4e')]=_0x10b69f[_0x4f20('0x4e')]['length']?_0x10b69f[_0x4f20('0x4e')]:_0xab88fa[_0x4f20('0x49')];if(!_0x2633b2[_0x4f20('0x4b')][_0x4f20('0x51')](_0x4f20('0x68'))){_0x10b69f['limit']=qs[_0x4f20('0x31')](_0x2633b2['query'][_0x4f20('0x31')]);_0x10b69f['offset']=qs[_0x4f20('0x30')](_0x2633b2['query']['offset']);}_0x10b69f[_0x4f20('0x52')]=qs['sort'](_0x2633b2[_0x4f20('0x4b')]['sort']);_0x10b69f[_0x4f20('0x56')]=qs[_0x4f20('0x54')](_[_0x4f20('0x55')](_0x2633b2[_0x4f20('0x4b')],_0xab88fa[_0x4f20('0x54')]));_0x10b69f['where'][_0x4f20('0x65')]=_0x2c90ec['id'];if(_0x2633b2[_0x4f20('0x4b')][_0x4f20('0x59')]){_0x10b69f['where']=_[_0x4f20('0x57')](_0x10b69f['where'],{'$or':_[_0x4f20('0x43')](_0x10b69f[_0x4f20('0x4e')],function(_0x1dc39b){var _0x1c3b16={};_0x1c3b16[_0x1dc39b]={'$like':'%'+_0x2633b2[_0x4f20('0x4b')][_0x4f20('0x59')]+'%'};return _0x1c3b16;})});}_0x10b69f=_[_0x4f20('0x57')]({},_0x10b69f,_0x2633b2[_0x4f20('0x5a')]);return db[_0x4f20('0x8a')][_0x4f20('0x5b')]({'where':_0x10b69f[_0x4f20('0x56')]})[_0x4f20('0x23')](function(_0xe001f6){_0x16c58d[_0x4f20('0x5b')]=_0xe001f6;if(_0x2633b2[_0x4f20('0x4b')]['includeAll']){_0x10b69f[_0x4f20('0x5d')]=[{'model':db[_0x4f20('0x8d')],'as':_0x4f20('0x8e'),'required':![]},{'model':db['User'],'as':_0x4f20('0x8f'),'attributes':['name',_0x4f20('0x90'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x4f20('0x91'),'attributes':['id',_0x4f20('0x4a'),_0x4f20('0x92')],'where':_0x2633b2[_0x4f20('0x4b')][_0x4f20('0x93')]?{'id':_0x2633b2[_0x4f20('0x4b')]['tag']}:undefined,'required':_0x2633b2[_0x4f20('0x4b')][_0x4f20('0x93')]?!![]:![]}];}return db['MailInteraction'][_0x4f20('0x69')](_0x10b69f);})[_0x4f20('0x23')](function(_0x1a3f7a){_0x16c58d['rows']=_0x1a3f7a;return _0x16c58d;});}})[_0x4f20('0x23')](respondWithFilteredResult(_0x3397e2,_0x10b69f))['catch'](handleError(_0x3397e2,null));};exports[_0x4f20('0x94')]=function(_0x1b2408,_0xe8ad48,_0x13baf2){return db[_0x4f20('0x44')]['findOne']({'where':{'id':_0x1b2408[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0xe8ad48,null))[_0x4f20('0x23')](function(_0xea3c18){if(_0xea3c18){return db[_0x4f20('0x95')][_0x4f20('0x96')](function(_0x2a3531){return db[_0x4f20('0x97')][_0x4f20('0x38')]({'where':{'MailAccountId':_0x1b2408[_0x4f20('0x5e')]['id']},'transaction':_0x2a3531})[_0x4f20('0x23')](function(_0x56eba6){var _0x4c19e7=_[_0x4f20('0x43')](_0x1b2408[_0x4f20('0x61')],function(_0x5952c2){_0x5952c2[_0x4f20('0x65')]=_0x1b2408['params']['id'];return _0x5952c2;});return db[_0x4f20('0x97')][_0x4f20('0x98')](_0x4c19e7,{'transaction':_0x2a3531});});})[_0x4f20('0x23')](function(){return db[_0x4f20('0x97')]['findAndCountAll']({'where':{'MailAccountId':_0x1b2408['params']['id']},'order':_0x4f20('0x99')});});}})['then'](respondWithResult(_0xe8ad48,null))[_0x4f20('0x2e')](handleError(_0xe8ad48,null));};exports[_0x4f20('0x9a')]=function(_0x3d3109,_0x57dd94,_0x2950fc){var _0x57ed79={};var _0x58cada={};var _0x427a31;var _0x206f78;return db[_0x4f20('0x44')][_0x4f20('0x84')]({'where':{'id':_0x3d3109[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x57dd94,null))[_0x4f20('0x23')](function(_0x3bc0da){if(_0x3bc0da){_0x427a31=_0x3bc0da;_0x58cada['model']=_['keys'](db[_0x4f20('0x97')][_0x4f20('0x45')]);_0x58cada[_0x4f20('0x4b')]=_['keys'](_0x3d3109[_0x4f20('0x4b')]);_0x58cada[_0x4f20('0x54')]=_['intersection'](_0x58cada[_0x4f20('0x49')],_0x58cada['query']);_0x57ed79['attributes']=_[_0x4f20('0x4d')](_0x58cada['model'],qs[_0x4f20('0x4f')](_0x3d3109['query'][_0x4f20('0x4f')]));_0x57ed79[_0x4f20('0x4e')]=_0x57ed79['attributes'][_0x4f20('0x50')]?_0x57ed79[_0x4f20('0x4e')]:_0x58cada[_0x4f20('0x49')];_0x57ed79[_0x4f20('0x52')]=qs[_0x4f20('0x53')](_0x3d3109[_0x4f20('0x4b')][_0x4f20('0x53')]);_0x57ed79[_0x4f20('0x56')]=qs['filters'](_[_0x4f20('0x55')](_0x3d3109[_0x4f20('0x4b')],_0x58cada[_0x4f20('0x54')]));if(_0x3d3109[_0x4f20('0x4b')][_0x4f20('0x59')]){_0x57ed79[_0x4f20('0x56')]=_[_0x4f20('0x57')](_0x57ed79['where'],{'$or':_[_0x4f20('0x43')](_0x57ed79[_0x4f20('0x4e')],function(_0x2ac3e6){var _0x159384={};_0x159384[_0x2ac3e6]={'$like':'%'+_0x3d3109[_0x4f20('0x4b')][_0x4f20('0x59')]+'%'};return _0x159384;})});}_0x57ed79=_[_0x4f20('0x57')]({},_0x57ed79,_0x3d3109[_0x4f20('0x5a')]);return _0x427a31['getApplications'](_0x57ed79);}})[_0x4f20('0x23')](function(_0x281235){if(_0x281235){_0x206f78=_0x281235[_0x4f20('0x50')];if(!_0x3d3109[_0x4f20('0x4b')][_0x4f20('0x51')](_0x4f20('0x68'))){_0x57ed79[_0x4f20('0x31')]=qs['limit'](_0x3d3109['query'][_0x4f20('0x31')]);_0x57ed79[_0x4f20('0x30')]=qs[_0x4f20('0x30')](_0x3d3109['query']['offset']);}return _0x427a31[_0x4f20('0x9a')](_0x57ed79);}})['then'](function(_0x4cca13){if(_0x4cca13){return _0x4cca13?{'count':_0x206f78,'rows':_0x4cca13}:null;}})[_0x4f20('0x23')](respondWithResult(_0x57dd94,null))['catch'](handleError(_0x57dd94,null));};exports[_0x4f20('0x9b')]=function(_0x32f24c,_0x5e2905,_0x11b1a6){var _0xdfc87={'raw':!![],'where':{}};var _0x16f1d1={};var _0x3fb419={'count':0x0,'rows':[]};return db['MailAccount'][_0x4f20('0x84')]({'where':{'id':_0x32f24c[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x5e2905,null))[_0x4f20('0x23')](function(_0x299ada){if(_0x299ada){_0x16f1d1[_0x4f20('0x49')]=_[_0x4f20('0x4c')](db[_0x4f20('0x9c')][_0x4f20('0x45')]);_0x16f1d1[_0x4f20('0x4b')]=_['keys'](_0x32f24c[_0x4f20('0x4b')]);_0x16f1d1[_0x4f20('0x54')]=_[_0x4f20('0x4d')](_0x16f1d1[_0x4f20('0x49')],_0x16f1d1[_0x4f20('0x4b')]);_0xdfc87['attributes']=_[_0x4f20('0x4d')](_0x16f1d1[_0x4f20('0x49')],qs['fields'](_0x32f24c[_0x4f20('0x4b')][_0x4f20('0x4f')]));_0xdfc87[_0x4f20('0x4e')]=_0xdfc87['attributes']['length']?_0xdfc87[_0x4f20('0x4e')]:_0x16f1d1['model'];if(!_0x32f24c['query'][_0x4f20('0x51')](_0x4f20('0x68'))){_0xdfc87[_0x4f20('0x31')]=qs[_0x4f20('0x31')](_0x32f24c[_0x4f20('0x4b')][_0x4f20('0x31')]);_0xdfc87['offset']=qs[_0x4f20('0x30')](_0x32f24c[_0x4f20('0x4b')][_0x4f20('0x30')]);}_0xdfc87[_0x4f20('0x52')]=qs[_0x4f20('0x53')](_0x32f24c['query']['sort']);_0xdfc87['where']=qs[_0x4f20('0x54')](_[_0x4f20('0x55')](_0x32f24c['query'],_0x16f1d1[_0x4f20('0x54')]));_0xdfc87[_0x4f20('0x56')][_0x4f20('0x65')]=_0x299ada['id'];if(_0x32f24c['query'][_0x4f20('0x59')]){_0xdfc87[_0x4f20('0x56')]=_['merge'](_0xdfc87[_0x4f20('0x56')],{'$or':_[_0x4f20('0x43')](_0xdfc87[_0x4f20('0x4e')],function(_0x44dd89){var _0x559176={};_0x559176[_0x44dd89]={'$like':'%'+_0x32f24c[_0x4f20('0x4b')][_0x4f20('0x59')]+'%'};return _0x559176;})});}if(_0x32f24c['query']['$gte']){var _0x741340=_0x32f24c[_0x4f20('0x4b')][_0x4f20('0x9d')][_0x4f20('0x9e')](',');var _0x573142={};_0x573142[_0x741340[0x0]]={'$gte':moment(_0x741340[0x1])[_0x4f20('0x9f')](_0x4f20('0xa0'))};_0xdfc87[_0x4f20('0x56')]=_[_0x4f20('0x57')](_0xdfc87[_0x4f20('0x56')],_0x573142);}_0xdfc87=_['merge']({},_0xdfc87,_0x32f24c[_0x4f20('0x5a')]);return db['MailMessage'][_0x4f20('0x5b')]({'where':_0xdfc87[_0x4f20('0x56')]})[_0x4f20('0x23')](function(_0x4a3bc5){_0x3fb419[_0x4f20('0x5b')]=_0x4a3bc5;if(_0x32f24c['query'][_0x4f20('0x5c')]){_0xdfc87[_0x4f20('0x5d')]=[{'all':!![]}];}return db['MailMessage'][_0x4f20('0x69')](_0xdfc87);})[_0x4f20('0x23')](function(_0x4a979d){_0x3fb419[_0x4f20('0x6a')]=_0x4a979d;return _0x3fb419;});}})[_0x4f20('0x23')](respondWithFilteredResult(_0x5e2905,_0xdfc87))['catch'](handleError(_0x5e2905,null));};exports[_0x4f20('0x3d')]=function(_0x4105c5,_0x39e1cb,_0x1e5715){var _0x42bc59,_0x36f905={},_0x47009a;if(_0x4105c5[_0x4f20('0x61')]['to']){_0x47009a=_0x4105c5[_0x4f20('0x61')]['to']['split'](',')[0x0];}return db[_0x4f20('0x44')][_0x4f20('0x62')]({'where':{'id':_0x4105c5['params']['id']},'include':[{'model':db[_0x4f20('0xa1')],'as':_0x4f20('0xa2'),'include':[{'model':db[_0x4f20('0x8d')],'as':_0x4f20('0xa3'),'where':{'email':_0x47009a},'limit':0x1,'order':[[_0x4f20('0xa4'),_0x4f20('0xa5')]]}]},{'model':db[_0x4f20('0x7d')],'as':_0x4f20('0x41'),'raw':!![]}]})[_0x4f20('0x23')](handleEntityNotFound(_0x39e1cb,null))[_0x4f20('0x23')](function(_0x2b2fb2){if(_0x2b2fb2){_0x42bc59=_0x2b2fb2;if(_0x2b2fb2[_0x4f20('0x41')]){if(_[_0x4f20('0x71')](_0x4105c5[_0x4f20('0x61')][_0x4f20('0xa6')])){_0x4105c5['body'][_0x4f20('0xa6')]=util[_0x4f20('0x9f')]('%s\x20<%s>',_0x2b2fb2[_0x4f20('0x4a')],_0x2b2fb2['email']||_0x2b2fb2[_0x4f20('0x41')][_0x4f20('0x74')]);}if(_0x4105c5[_0x4f20('0x61')][_0x4f20('0xa7')]&&_0x4105c5[_0x4f20('0x61')][_0x4f20('0xa7')][_0x4f20('0x50')]){for(var _0x467465=0x0;_0x467465<_0x4105c5[_0x4f20('0x61')][_0x4f20('0xa7')]['length'];_0x467465+=0x1){_0x4105c5[_0x4f20('0x61')][_0x4f20('0xa7')][_0x467465]={'filename':_0x4105c5['body']['attachments'][_0x467465]['name'],'path':path[_0x4f20('0xa8')](config[_0x4f20('0xa9')],'server/files/attachments',_0x4105c5[_0x4f20('0x61')]['attachments'][_0x467465]['basename'])};}}var _0x3e08e0={'tls':{'rejectUnauthorized':![]}};if(_[_0x4f20('0x71')](_0x2b2fb2['Smtp'][_0x4f20('0x7c')])){if(_0x2b2fb2[_0x4f20('0x41')]['authentication']){_0x3e08e0[_0x4f20('0xaa')]={'user':_0x2b2fb2['Smtp'][_0x4f20('0x74')],'pass':_0x2b2fb2['Smtp'][_0x4f20('0x77')]};}_0x3e08e0[_0x4f20('0x7a')]=_0x2b2fb2[_0x4f20('0x41')][_0x4f20('0x7a')];_0x3e08e0['port']=_0x2b2fb2[_0x4f20('0x41')]['port'];_0x3e08e0[_0x4f20('0xab')]=_0x2b2fb2[_0x4f20('0x41')][_0x4f20('0xab')];}else{_0x3e08e0[_0x4f20('0x7c')]=_0x2b2fb2['Smtp'][_0x4f20('0x7c')];_0x3e08e0[_0x4f20('0xaa')]={'user':_0x2b2fb2['Smtp'][_0x4f20('0x74')],'pass':_0x2b2fb2['Smtp'][_0x4f20('0x77')]};}return respondWithRpcPromise(_0x4f20('0xac'),_0x4f20('0xad'),{'account':_0x3e08e0,'message':_0x4105c5['body']});}else{throw new Error(_0x4f20('0xae'));}}})[_0x4f20('0x23')](function(_0x4cda98){if(_0x4cda98){_0x36f905=_0x4cda98;if(_0x42bc59['List']){if(_0x42bc59[_0x4f20('0xa2')][_0x4f20('0xa3')][_0x4f20('0x50')]){return _0x42bc59['List'][_0x4f20('0xa3')][0x0];}else{return db['CmContact'][_0x4f20('0x67')](_[_0x4f20('0x1b')](_0x4105c5[_0x4f20('0x61')],{'firstName':_0x4105c5[_0x4f20('0x61')]['to'],'email':_0x4105c5[_0x4f20('0x61')]['to'],'phone':_0x4105c5[_0x4f20('0x61')]['to'],'ListId':_0x42bc59[_0x4f20('0x6e')]}));}}else{throw new Error(_0x4f20('0xae'));}}})['then'](function(_0x2a3642){if(_0x2a3642){var _0xa890e4={'UserId':_0x4105c5['user']['id'],'ContactId':_0x2a3642['id'],'MailAccountId':_0x42bc59['id'],'inReplyTo':_0x36f905[_0x4f20('0xaf')],'to':_0x4105c5['body'][_0x4f20('0xa6')],'cc':_0x4105c5[_0x4f20('0x61')]['cc'],'subject':_0x4105c5[_0x4f20('0x61')][_0x4f20('0xb0')],'attach':_0x4105c5[_0x4f20('0x61')]['attach'],'firstMsgDirection':_0x4f20('0xb1'),'lastMsgAt':moment()[_0x4f20('0x9f')](_0x4f20('0xa0')),'lastMsgDirection':'out','lastMsgBody':_0x4105c5[_0x4f20('0x61')][_0x4f20('0x61')],'Messages':[_[_0x4f20('0x57')](_0x4105c5[_0x4f20('0x61')],{'messageId':_0x36f905[_0x4f20('0xaf')],'sentAt':moment()[_0x4f20('0x9f')](_0x4f20('0xa0')),'read':!![],'MailAccountId':_0x42bc59['id'],'UserId':_0x4105c5[_0x4f20('0x74')]['id'],'ContactId':_0x2a3642['id']})]};if(_0x4105c5['body'][_0x4f20('0xb2')]){_0xa890e4=_[_0x4f20('0x57')](_0xa890e4,_0x4105c5[_0x4f20('0x61')][_0x4f20('0xb2')]);}return db[_0x4f20('0x8a')][_0x4f20('0x67')](_0xa890e4,{'include':[{'model':db[_0x4f20('0x9c')],'as':_0x4f20('0xb3')}]});}})[_0x4f20('0x23')](respondWithResult(_0x39e1cb,null))[_0x4f20('0x2e')](handleError(_0x39e1cb,null));};exports[_0x4f20('0xb4')]=function(_0xcfe8da,_0x1f6ef4,_0x27d878){return db[_0x4f20('0x44')]['find']({'where':{'id':_0xcfe8da['params']['id']},'include':[{'model':db[_0x4f20('0x7d')],'as':_0x4f20('0x41'),'raw':!![]}]})[_0x4f20('0x23')](handleEntityNotFound(_0x1f6ef4,null))[_0x4f20('0x23')](function(_0x4a113a){if(_0x4a113a&&_0x4a113a[_0x4f20('0x41')]){var _0xd67f5c={'id':_0x4a113a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a113a[_0x4f20('0x41')][_0x4f20('0x7c')]){_0xd67f5c[_0x4f20('0x7c')]=_0x4a113a[_0x4f20('0x41')][_0x4f20('0x7c')];}else{_0xd67f5c[_0x4f20('0x7a')]=_0x4a113a[_0x4f20('0x41')][_0x4f20('0x7a')];_0xd67f5c[_0x4f20('0x7b')]=_0x4a113a[_0x4f20('0x41')][_0x4f20('0x7b')];_0xd67f5c[_0x4f20('0xab')]=_0x4a113a[_0x4f20('0x41')][_0x4f20('0xab')];}if(_0x4a113a[_0x4f20('0x41')]['authentication']){_0xd67f5c[_0x4f20('0xaa')]={'user':_0x4a113a[_0x4f20('0x41')][_0x4f20('0x74')],'pass':_0x4a113a[_0x4f20('0x41')][_0x4f20('0x77')]};}return respondWithRpcPromise(_0x4f20('0xb5'),_0x4f20('0xb4'),{'account':_0xd67f5c});}})[_0x4f20('0x23')](respondWithResult(_0x1f6ef4,null))['catch'](handleError(_0x1f6ef4,null));};exports[_0x4f20('0x38')]=function(_0x469d2d,_0x4d5969){return db['MailAccount'][_0x4f20('0x62')]({'where':{'id':_0x469d2d[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x4d5969,null))[_0x4f20('0x23')](function(_0x2e7bd2){if(_0x2e7bd2&&_0x2e7bd2[_0x4f20('0x7c')]){throw new db[(_0x4f20('0xb6'))][(_0x4f20('0xb7'))](_0x4f20('0xb8'));}return _0x2e7bd2;})['then'](removeEntity(_0x4d5969,null))['catch'](handleError(_0x4d5969,null));};exports[_0x4f20('0xb9')]=function(_0x6948ef,_0x251fda,_0x5ea28b){return db[_0x4f20('0x44')][_0x4f20('0x62')]({'where':{'id':_0x6948ef[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x251fda,null))['then'](function(_0xcb5b96){if(_0xcb5b96){return _0xcb5b96[_0x4f20('0xb9')](_0x6948ef[_0x4f20('0x61')][_0x4f20('0x6b')],_[_0x4f20('0x8b')](_0x6948ef[_0x4f20('0x61')],[_0x4f20('0x6b'),'id'])||{})[_0x4f20('0xba')](function(_0x392ac6){for(var _0x4b3007=0x0;_0x4b3007<_0x6948ef[_0x4f20('0x61')][_0x4f20('0x6b')][_0x4f20('0x50')];_0x4b3007+=0x1){socket[_0x4f20('0xbb')](_0x4f20('0xbc'),{'UserId':_0x6948ef['body'][_0x4f20('0x6b')][_0x4b3007],'MailAccountId':_0x6948ef[_0x4f20('0x5e')]['id']});}return _0x392ac6;});}})[_0x4f20('0x23')](respondWithResult(_0x251fda,null))[_0x4f20('0x2e')](handleError(_0x251fda,null));};exports[_0x4f20('0xbd')]=function(_0x5ef8f2,_0x484596,_0x4d85de){return db[_0x4f20('0x44')]['find']({'where':{'id':_0x5ef8f2[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x484596,null))['then'](function(_0x97f4c){if(_0x97f4c){return _0x97f4c[_0x4f20('0xbd')](_0x5ef8f2[_0x4f20('0x4b')][_0x4f20('0x6b')])[_0x4f20('0x23')](function(){if(_[_0x4f20('0xbe')](_0x5ef8f2[_0x4f20('0x4b')]['ids'])){for(var _0x4ab5a2=0x0;_0x4ab5a2<_0x5ef8f2['query']['ids'][_0x4f20('0x50')];_0x4ab5a2+=0x1){socket[_0x4f20('0xbb')](_0x4f20('0xbf'),{'UserId':Number(_0x5ef8f2[_0x4f20('0x4b')][_0x4f20('0x6b')][_0x4ab5a2]),'MailAccountId':Number(_0x5ef8f2[_0x4f20('0x5e')]['id'])});}}else{socket[_0x4f20('0xbb')](_0x4f20('0xbf'),{'UserId':Number(_0x5ef8f2['query'][_0x4f20('0x6b')]),'MailAccountId':Number(_0x5ef8f2[_0x4f20('0x5e')]['id'])});}});}})[_0x4f20('0x23')](respondWithStatusCode(_0x484596,null))[_0x4f20('0x2e')](handleError(_0x484596,null));};exports[_0x4f20('0xc0')]=function(_0x2cbba3,_0x2fec04,_0x3d0f91){var _0x5c1ca8={};var _0x10a356={};var _0x3272c6;var _0x5a75a6;return db[_0x4f20('0x44')]['findOne']({'where':{'id':_0x2cbba3[_0x4f20('0x5e')]['id']}})[_0x4f20('0x23')](handleEntityNotFound(_0x2fec04,null))[_0x4f20('0x23')](function(_0x3cc4d2){if(_0x3cc4d2){_0x3272c6=_0x3cc4d2;_0x10a356['model']=_[_0x4f20('0x4c')](db[_0x4f20('0xc1')]['rawAttributes']);_0x10a356['query']=_[_0x4f20('0x4c')](_0x2cbba3[_0x4f20('0x4b')]);_0x10a356[_0x4f20('0x54')]=_[_0x4f20('0x4d')](_0x10a356[_0x4f20('0x49')],_0x10a356['query']);_0x5c1ca8['attributes']=_['intersection'](_0x10a356[_0x4f20('0x49')],qs[_0x4f20('0x4f')](_0x2cbba3['query']['fields']));_0x5c1ca8[_0x4f20('0x4e')]=_0x5c1ca8['attributes'][_0x4f20('0x50')]?_0x5c1ca8['attributes']:_0x10a356['model'];_0x5c1ca8[_0x4f20('0x52')]=qs['sort'](_0x2cbba3[_0x4f20('0x4b')][_0x4f20('0x53')]);_0x5c1ca8[_0x4f20('0x56')]=qs[_0x4f20('0x54')](_[_0x4f20('0x55')](_0x2cbba3[_0x4f20('0x4b')],_0x10a356['filters']));if(_0x2cbba3['query'][_0x4f20('0x59')]){_0x5c1ca8[_0x4f20('0x56')]=_[_0x4f20('0x57')](_0x5c1ca8[_0x4f20('0x56')],{'$or':_['map'](_0x5c1ca8[_0x4f20('0x4e')],function(_0x3776e9){var _0x5ba732={};_0x5ba732[_0x3776e9]={'$like':'%'+_0x2cbba3[_0x4f20('0x4b')][_0x4f20('0x59')]+'%'};return _0x5ba732;})});}_0x5c1ca8=_[_0x4f20('0x57')]({},_0x5c1ca8,_0x2cbba3[_0x4f20('0x5a')]);return _0x3272c6['getAgents'](_0x5c1ca8);}})[_0x4f20('0x23')](function(_0x21c4a1){if(_0x21c4a1){_0x5a75a6=_0x21c4a1['length'];if(!_0x2cbba3[_0x4f20('0x4b')][_0x4f20('0x51')](_0x4f20('0x68'))){_0x5c1ca8[_0x4f20('0x31')]=qs[_0x4f20('0x31')](_0x2cbba3[_0x4f20('0x4b')]['limit']);_0x5c1ca8['offset']=qs[_0x4f20('0x30')](_0x2cbba3[_0x4f20('0x4b')][_0x4f20('0x30')]);}return _0x3272c6[_0x4f20('0xc0')](_0x5c1ca8);}})[_0x4f20('0x23')](function(_0x4700f7){if(_0x4700f7){return _0x4700f7?{'count':_0x5a75a6,'rows':_0x4700f7}:null;}})[_0x4f20('0x23')](respondWithResult(_0x2fec04,null))[_0x4f20('0x2e')](handleError(_0x2fec04,null));}; \ No newline at end of file +var _0x579e=['result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update','destroy','then','MailAccounts','UserProfileResource','stack','name','send','MailServerIn','Imap','MailServerOut','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','offset','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','mandatoryDispositionPause','keys','length','find','body','params','describe','addDisposition','MailAccountId','Disposition','create','findOne','nolimit','sort','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','host','port','service','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','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','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x29931d,_0x466d60){var _0x13e7d7=function(_0x2d2fa6){while(--_0x2d2fa6){_0x29931d['push'](_0x29931d['shift']());}};_0x13e7d7(++_0x466d60);}(_0x579e,0x16b));var _0xe579=function(_0x27332d,_0xb59aef){_0x27332d=_0x27332d-0x0;var _0x48e659=_0x579e[_0x27332d];return _0x48e659;};'use strict';var pdf=require(_0xe579('0x0'));var emlformat=require(_0xe579('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe579('0x2'));var jsonpatch=require(_0xe579('0x3'));var rp=require(_0xe579('0x4'));var moment=require(_0xe579('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe579('0x6'));var path=require(_0xe579('0x7'));var sox=require(_0xe579('0x8'));var csv=require('to-csv');var ejs=require(_0xe579('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe579('0xa'));var crypto=require(_0xe579('0xb'));var jsforce=require(_0xe579('0xc'));var deskjs=require(_0xe579('0xd'));var toCsv=require(_0xe579('0xe'));var querystring=require(_0xe579('0xf'));var Papa=require(_0xe579('0x10'));var Redis=require('ioredis');var authService=require(_0xe579('0x11'));var qs=require(_0xe579('0x12'));var as=require(_0xe579('0x13'));var hardwareService=require(_0xe579('0x14'));var logger=require(_0xe579('0x15'))('api');var utils=require(_0xe579('0x16'));var config=require(_0xe579('0x17'));var licenseUtil=require(_0xe579('0x18'));var db=require(_0xe579('0x19'))['db'];config[_0xe579('0x1a')]=_[_0xe579('0x1b')](config[_0xe579('0x1a')],{'host':_0xe579('0x1c'),'port':0x18eb});var socket=require(_0xe579('0x1d'))(new Redis(config['redis']));require(_0xe579('0x1e'))[_0xe579('0x1f')](socket);var jayson=require(_0xe579('0x20'));var client=jayson[_0xe579('0x21')][_0xe579('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x31e509,_0x5897d4,_0x350911,_0x55f029){return new BPromise(function(_0x5951b5,_0x48bd8d){var _0x3e11aa=_0x55f029||client;return _0x3e11aa[_0xe579('0x23')](_0x31e509,_0x350911)['then'](function(_0x18a5c3){logger[_0xe579('0x24')](_0xe579('0x25'),_0x5897d4,_0xe579('0x26'));logger[_0xe579('0x27')](_0xe579('0x28'),_0x5897d4,_0xe579('0x26'),JSON[_0xe579('0x29')](_0x18a5c3));if(_0x18a5c3[_0xe579('0x2a')]){if(_0x18a5c3[_0xe579('0x2a')][_0xe579('0x2b')]===0x1f4){logger[_0xe579('0x2a')](_0xe579('0x25'),_0x5897d4,_0x18a5c3[_0xe579('0x2a')][_0xe579('0x2c')]);return _0x48bd8d(_0x18a5c3[_0xe579('0x2a')][_0xe579('0x2c')]);}logger['error'](_0xe579('0x25'),_0x5897d4,_0x18a5c3[_0xe579('0x2a')][_0xe579('0x2c')]);return _0x5951b5(_0x18a5c3['error'][_0xe579('0x2c')]);}else{logger[_0xe579('0x24')](_0xe579('0x25'),_0x5897d4,_0xe579('0x26'));_0x5951b5(_0x18a5c3[_0xe579('0x2d')][_0xe579('0x2c')]);}})[_0xe579('0x2e')](function(_0xd79f21){logger[_0xe579('0x2a')](_0xe579('0x25'),_0x5897d4,_0xd79f21);_0x48bd8d(_0xd79f21);});});}function respondWithStatusCode(_0x5d897a,_0x560b34){_0x560b34=_0x560b34||0xcc;return function(_0x1892d4){if(_0x1892d4){return _0x5d897a[_0xe579('0x2f')](_0x560b34);}return _0x5d897a[_0xe579('0x30')](_0x560b34)[_0xe579('0x31')]();};}function respondWithResult(_0x124de6,_0x40d236){_0x40d236=_0x40d236||0xc8;return function(_0x583852){if(_0x583852){return _0x124de6[_0xe579('0x30')](_0x40d236)[_0xe579('0x32')](_0x583852);}};}function respondWithFilteredResult(_0x113fe6,_0x1ef86e){return function(_0x2c9c49){if(_0x2c9c49){var _0x4ac7c8=_0x2c9c49[_0xe579('0x33')],_0x3c3dd5=_0x1ef86e['offset'],_0x20721b=_0x1ef86e['offset']+_0x1ef86e[_0xe579('0x34')],_0x2d7211;if(_0x20721b>=_0x4ac7c8){_0x20721b=_0x4ac7c8;_0x2d7211=0xc8;}else{_0x2d7211=0xce;}_0x113fe6[_0xe579('0x30')](_0x2d7211);return _0x113fe6[_0xe579('0x35')](_0xe579('0x36'),_0x3c3dd5+'-'+_0x20721b+'/'+_0x4ac7c8)['json'](_0x2c9c49);}return null;};}function patchUpdates(_0x2414fb){return function(_0x5c697e){try{jsonpatch['apply'](_0x5c697e,_0x2414fb,!![]);}catch(_0x192992){return BPromise[_0xe579('0x37')](_0x192992);}return _0x5c697e[_0xe579('0x38')]();};}function saveUpdates(_0x18221f,_0x4beb75){return function(_0x4d9e57){if(_0x4d9e57){return _0x4d9e57[_0xe579('0x39')](_0x18221f)['then'](function(_0x4fe725){return _0x4fe725;});}return null;};}function removeEntity(_0x22eaea,_0x5cb6bf){return function(_0x347344){if(_0x347344){return _0x347344[_0xe579('0x3a')]()[_0xe579('0x3b')](function(){var _0x2663c9=_0x347344['get']({'plain':!![]});var _0x366a67=_0xe579('0x3c');return db[_0xe579('0x3d')][_0xe579('0x3a')]({'where':{'type':_0x366a67,'resourceId':_0x2663c9['id']}})[_0xe579('0x3b')](function(){return _0x347344;});})['then'](function(){_0x22eaea[_0xe579('0x30')](0xcc)[_0xe579('0x31')]();});}};}function handleEntityNotFound(_0x5b0890,_0x4b60d5){return function(_0x2ec0d7){if(!_0x2ec0d7){_0x5b0890[_0xe579('0x2f')](0x194);}return _0x2ec0d7;};}function handleError(_0x9108bc,_0x427bb1){_0x427bb1=_0x427bb1||0x1f4;return function(_0x501f31){logger[_0xe579('0x2a')](_0x501f31[_0xe579('0x3e')]);if(_0x501f31['name']){delete _0x501f31[_0xe579('0x3f')];}_0x9108bc[_0xe579('0x30')](_0x427bb1)[_0xe579('0x40')](_0x501f31);};}exports['index']=function(_0x45ece2,_0x3db2fb){var _0x3fcc9c={'include':[{'model':db[_0xe579('0x41')],'as':_0xe579('0x42')},{'model':db[_0xe579('0x43')],'as':_0xe579('0x44')},{'model':db[_0xe579('0x45')],'as':'mandatoryDispositionPause'}]},_0xed658a={},_0x7d4dd3={'count':0x0,'rows':[]};var _0x8f8efd=_[_0xe579('0x46')](db[_0xe579('0x47')][_0xe579('0x48')],function(_0x3291e8){return{'name':_0x3291e8[_0xe579('0x49')],'type':_0x3291e8[_0xe579('0x4a')][_0xe579('0x4b')]};});_0xed658a[_0xe579('0x4c')]=_[_0xe579('0x46')](_0x8f8efd,_0xe579('0x3f'));_0xed658a[_0xe579('0x4d')]=_['keys'](_0x45ece2[_0xe579('0x4d')]);_0xed658a[_0xe579('0x4e')]=_[_0xe579('0x4f')](_0xed658a[_0xe579('0x4c')],_0xed658a[_0xe579('0x4d')]);_0x3fcc9c[_0xe579('0x50')]=_[_0xe579('0x4f')](_0xed658a['model'],qs[_0xe579('0x51')](_0x45ece2['query'][_0xe579('0x51')]));_0x3fcc9c[_0xe579('0x50')]=_0x3fcc9c[_0xe579('0x50')]['length']?_0x3fcc9c[_0xe579('0x50')]:_0xed658a[_0xe579('0x4c')];if(!_0x45ece2[_0xe579('0x4d')][_0xe579('0x52')]('nolimit')){_0x3fcc9c[_0xe579('0x34')]=qs[_0xe579('0x34')](_0x45ece2[_0xe579('0x4d')]['limit']);_0x3fcc9c['offset']=qs[_0xe579('0x53')](_0x45ece2[_0xe579('0x4d')][_0xe579('0x53')]);}_0x3fcc9c[_0xe579('0x54')]=qs['sort'](_0x45ece2[_0xe579('0x4d')]['sort']);_0x3fcc9c[_0xe579('0x55')]=qs[_0xe579('0x4e')](_[_0xe579('0x56')](_0x45ece2['query'],_0xed658a[_0xe579('0x4e')]),_0x8f8efd);if(_0x45ece2[_0xe579('0x4d')][_0xe579('0x57')]){_0x3fcc9c[_0xe579('0x55')]=_[_0xe579('0x58')](_0x3fcc9c['where'],{'$or':_['map'](_0x8f8efd,function(_0x5bd09a){if(_0x5bd09a[_0xe579('0x4a')]!=='VIRTUAL'){var _0x129b20={};_0x129b20[_0x5bd09a[_0xe579('0x3f')]]={'$like':'%'+_0x45ece2[_0xe579('0x4d')][_0xe579('0x57')]+'%'};return _0x129b20;}})});}_0x3fcc9c=_[_0xe579('0x58')]({},_0x3fcc9c,_0x45ece2[_0xe579('0x59')]);var _0x27103d={'where':_0x3fcc9c[_0xe579('0x55')]};return db[_0xe579('0x47')][_0xe579('0x33')](_0x27103d)[_0xe579('0x3b')](function(_0x6fa16b){_0x7d4dd3['count']=_0x6fa16b;if(_0x45ece2['query'][_0xe579('0x5a')]){_0x3fcc9c[_0xe579('0x5b')]=[{'all':!![]}];}return db['MailAccount'][_0xe579('0x5c')](_0x3fcc9c);})['then'](function(_0x4ba869){_0x7d4dd3[_0xe579('0x5d')]=_0x4ba869;return _0x7d4dd3;})[_0xe579('0x3b')](respondWithFilteredResult(_0x3db2fb,_0x3fcc9c))[_0xe579('0x2e')](handleError(_0x3db2fb,null));};exports[_0xe579('0x5e')]=function(_0x4b5ed4,_0x13790a){var _0x238aba={'raw':![],'where':{'id':_0x4b5ed4['params']['id']},'include':[{'model':db[_0xe579('0x41')],'as':_0xe579('0x42')},{'model':db['MailServerOut'],'as':_0xe579('0x44')},{'model':db[_0xe579('0x45')],'as':_0xe579('0x5f')}]},_0x23b1be={};_0x23b1be[_0xe579('0x4c')]=_[_0xe579('0x60')](db[_0xe579('0x47')]['rawAttributes']);_0x23b1be[_0xe579('0x4d')]=_[_0xe579('0x60')](_0x4b5ed4[_0xe579('0x4d')]);_0x23b1be[_0xe579('0x4e')]=_[_0xe579('0x4f')](_0x23b1be[_0xe579('0x4c')],_0x23b1be['query']);_0x238aba[_0xe579('0x50')]=_[_0xe579('0x4f')](_0x23b1be['model'],qs[_0xe579('0x51')](_0x4b5ed4[_0xe579('0x4d')][_0xe579('0x51')]));_0x238aba['attributes']=_0x238aba['attributes'][_0xe579('0x61')]?_0x238aba[_0xe579('0x50')]:_0x23b1be['model'];if(_0x4b5ed4[_0xe579('0x4d')]['includeAll']){_0x238aba[_0xe579('0x5b')]=[{'all':!![]}];}_0x238aba=_[_0xe579('0x58')]({},_0x238aba,_0x4b5ed4[_0xe579('0x59')]);return db[_0xe579('0x47')][_0xe579('0x62')](_0x238aba)[_0xe579('0x3b')](handleEntityNotFound(_0x13790a,null))[_0xe579('0x3b')](respondWithResult(_0x13790a,null))[_0xe579('0x2e')](handleError(_0x13790a,null));};exports[_0xe579('0x39')]=function(_0x18cf27,_0x3b5b33){if(_0x18cf27[_0xe579('0x63')]['id']){delete _0x18cf27[_0xe579('0x63')]['id'];}return db[_0xe579('0x47')][_0xe579('0x62')]({'where':{'id':_0x18cf27[_0xe579('0x64')]['id']},'include':[{'model':db[_0xe579('0x41')],'as':'Imap'},{'model':db[_0xe579('0x43')],'as':_0xe579('0x44')},{'model':db[_0xe579('0x45')],'as':_0xe579('0x5f')}]})[_0xe579('0x3b')](handleEntityNotFound(_0x3b5b33,null))[_0xe579('0x3b')](saveUpdates(_0x18cf27[_0xe579('0x63')],null))[_0xe579('0x3b')](function(_0x24d226){if(_0x24d226&&_0x18cf27[_0xe579('0x63')][_0xe579('0x42')]){return db[_0xe579('0x41')][_0xe579('0x39')](_0x18cf27[_0xe579('0x63')]['Imap'],{'where':{'MailAccountId':_0x24d226['id']}})[_0xe579('0x3b')](function(){return _0x24d226;});}return _0x24d226;})['then'](function(_0x4c18b0){if(_0x4c18b0&&_0x18cf27['body'][_0xe579('0x44')]){return db[_0xe579('0x43')]['update'](_0x18cf27[_0xe579('0x63')][_0xe579('0x44')],{'where':{'MailAccountId':_0x4c18b0['id']}})[_0xe579('0x3b')](function(){return _0x4c18b0;});}return _0x4c18b0;})['then'](respondWithResult(_0x3b5b33,null))[_0xe579('0x2e')](handleError(_0x3b5b33,null));};exports[_0xe579('0x65')]=function(_0x385c06,_0x706d10){return db[_0xe579('0x47')][_0xe579('0x65')]()[_0xe579('0x3b')](respondWithResult(_0x706d10,null))['catch'](handleError(_0x706d10,null));};exports[_0xe579('0x66')]=function(_0x49bdc4,_0x2bf839,_0x2f843a){if(_0x49bdc4[_0xe579('0x63')]['id']){delete _0x49bdc4[_0xe579('0x63')]['id'];}return db['MailAccount'][_0xe579('0x62')]({'where':{'id':_0x49bdc4[_0xe579('0x64')]['id']}})['then'](handleEntityNotFound(_0x2bf839,null))['then'](function(_0x3b91df){if(_0x3b91df){_0x49bdc4[_0xe579('0x63')][_0xe579('0x67')]=_0x3b91df['id'];return db[_0xe579('0x68')][_0xe579('0x69')](_0x49bdc4[_0xe579('0x63')]);}})[_0xe579('0x3b')](respondWithResult(_0x2bf839,null))[_0xe579('0x2e')](handleError(_0x2bf839,null));};exports['getDispositions']=function(_0xe7e8a0,_0x108bcf,_0x564454){var _0x57c7ed={'raw':![],'where':{}};var _0xdf2e85={};var _0x30750b={'count':0x0,'rows':[]};return db['MailAccount'][_0xe579('0x6a')]({'where':{'id':_0xe7e8a0[_0xe579('0x64')]['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x108bcf,null))[_0xe579('0x3b')](function(_0xf74a15){if(_0xf74a15){_0xdf2e85['model']=_[_0xe579('0x60')](db[_0xe579('0x68')][_0xe579('0x48')]);_0xdf2e85[_0xe579('0x4d')]=_[_0xe579('0x60')](_0xe7e8a0[_0xe579('0x4d')]);_0xdf2e85['filters']=_[_0xe579('0x4f')](_0xdf2e85['model'],_0xdf2e85[_0xe579('0x4d')]);_0x57c7ed['attributes']=_[_0xe579('0x4f')](_0xdf2e85[_0xe579('0x4c')],qs[_0xe579('0x51')](_0xe7e8a0['query'][_0xe579('0x51')]));_0x57c7ed[_0xe579('0x50')]=_0x57c7ed[_0xe579('0x50')][_0xe579('0x61')]?_0x57c7ed[_0xe579('0x50')]:_0xdf2e85['model'];if(!_0xe7e8a0[_0xe579('0x4d')][_0xe579('0x52')](_0xe579('0x6b'))){_0x57c7ed[_0xe579('0x34')]=qs['limit'](_0xe7e8a0[_0xe579('0x4d')]['limit']);_0x57c7ed['offset']=qs[_0xe579('0x53')](_0xe7e8a0[_0xe579('0x4d')]['offset']);}_0x57c7ed[_0xe579('0x54')]=qs[_0xe579('0x6c')](_0xe7e8a0['query'][_0xe579('0x6c')]);_0x57c7ed[_0xe579('0x55')]=qs['filters'](_['pick'](_0xe7e8a0['query'],_0xdf2e85[_0xe579('0x4e')]));_0x57c7ed[_0xe579('0x55')][_0xe579('0x67')]=_0xf74a15['id'];if(_0xe7e8a0['query'][_0xe579('0x57')]){_0x57c7ed[_0xe579('0x55')]=_['merge'](_0x57c7ed[_0xe579('0x55')],{'$or':_[_0xe579('0x46')](_0x57c7ed[_0xe579('0x50')],function(_0x2678b9){var _0x371078={};_0x371078[_0x2678b9]={'$like':'%'+_0xe7e8a0[_0xe579('0x4d')][_0xe579('0x57')]+'%'};return _0x371078;})});}_0x57c7ed=_['merge']({},_0x57c7ed,_0xe7e8a0[_0xe579('0x59')]);return db[_0xe579('0x68')][_0xe579('0x33')]({'where':_0x57c7ed[_0xe579('0x55')]})['then'](function(_0x280b29){_0x30750b[_0xe579('0x33')]=_0x280b29;if(_0xe7e8a0[_0xe579('0x4d')][_0xe579('0x5a')]){_0x57c7ed['include']=[{'all':!![]}];}return db[_0xe579('0x68')][_0xe579('0x5c')](_0x57c7ed);})['then'](function(_0x49af1f){_0x30750b[_0xe579('0x5d')]=_0x49af1f;return _0x30750b;});}})[_0xe579('0x3b')](respondWithFilteredResult(_0x108bcf,_0x57c7ed))['catch'](handleError(_0x108bcf,null));};exports[_0xe579('0x6d')]=function(_0x433a5a,_0x1bc985,_0x3f5b98){return db[_0xe579('0x47')][_0xe579('0x62')]({'where':{'id':_0x433a5a[_0xe579('0x64')]['id']}})['then'](handleEntityNotFound(_0x1bc985,null))[_0xe579('0x3b')](function(_0xfaee90){if(_0xfaee90){return _0xfaee90[_0xe579('0x6d')](_0x433a5a['query'][_0xe579('0x6e')]);}})[_0xe579('0x3b')](respondWithStatusCode(_0x1bc985,null))[_0xe579('0x2e')](handleError(_0x1bc985,null));};exports[_0xe579('0x6f')]=function(_0x3fe496,_0x833ee6,_0x48ec31){if(_0x3fe496[_0xe579('0x63')]['id']){delete _0x3fe496['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x3fe496['params']['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x833ee6,null))['then'](function(_0x1abce1){if(_0x1abce1){_0x3fe496[_0xe579('0x63')][_0xe579('0x67')]=_0x1abce1['id'];return db['CannedAnswer'][_0xe579('0x69')](_0x3fe496[_0xe579('0x63')]);}})['then'](respondWithResult(_0x833ee6,null))['catch'](handleError(_0x833ee6,null));};exports[_0xe579('0x70')]=function(_0xdb51a,_0x23b3ed,_0x16c6ff){var _0x4d3001={'raw':![],'where':{}};var _0x3a22ec={};var _0x26dee0={'count':0x0,'rows':[]};return db[_0xe579('0x47')][_0xe579('0x6a')]({'where':{'id':_0xdb51a[_0xe579('0x64')]['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x23b3ed,null))[_0xe579('0x3b')](function(_0x286391){if(_0x286391){_0x3a22ec[_0xe579('0x4c')]=_[_0xe579('0x60')](db[_0xe579('0x71')][_0xe579('0x48')]);_0x3a22ec['query']=_[_0xe579('0x60')](_0xdb51a[_0xe579('0x4d')]);_0x3a22ec['filters']=_[_0xe579('0x4f')](_0x3a22ec[_0xe579('0x4c')],_0x3a22ec['query']);_0x4d3001[_0xe579('0x50')]=_['intersection'](_0x3a22ec['model'],qs[_0xe579('0x51')](_0xdb51a[_0xe579('0x4d')][_0xe579('0x51')]));_0x4d3001[_0xe579('0x50')]=_0x4d3001[_0xe579('0x50')][_0xe579('0x61')]?_0x4d3001[_0xe579('0x50')]:_0x3a22ec['model'];if(!_0xdb51a[_0xe579('0x4d')][_0xe579('0x52')](_0xe579('0x6b'))){_0x4d3001[_0xe579('0x34')]=qs[_0xe579('0x34')](_0xdb51a['query'][_0xe579('0x34')]);_0x4d3001[_0xe579('0x53')]=qs[_0xe579('0x53')](_0xdb51a[_0xe579('0x4d')][_0xe579('0x53')]);}_0x4d3001['order']=qs['sort'](_0xdb51a[_0xe579('0x4d')][_0xe579('0x6c')]);_0x4d3001[_0xe579('0x55')]=qs[_0xe579('0x4e')](_['pick'](_0xdb51a[_0xe579('0x4d')],_0x3a22ec[_0xe579('0x4e')]));_0x4d3001[_0xe579('0x55')][_0xe579('0x67')]=_0x286391['id'];if(_0xdb51a[_0xe579('0x4d')]['filter']){_0x4d3001[_0xe579('0x55')]=_[_0xe579('0x58')](_0x4d3001['where'],{'$or':_[_0xe579('0x46')](_0x4d3001[_0xe579('0x50')],function(_0xab8ac0){var _0x533a49={};_0x533a49[_0xab8ac0]={'$like':'%'+_0xdb51a[_0xe579('0x4d')]['filter']+'%'};return _0x533a49;})});}_0x4d3001=_[_0xe579('0x58')]({},_0x4d3001,_0xdb51a[_0xe579('0x59')]);return db[_0xe579('0x71')]['count']({'where':_0x4d3001[_0xe579('0x55')]})[_0xe579('0x3b')](function(_0x361654){_0x26dee0[_0xe579('0x33')]=_0x361654;if(_0xdb51a[_0xe579('0x4d')][_0xe579('0x5a')]){_0x4d3001[_0xe579('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe579('0x5c')](_0x4d3001);})['then'](function(_0x1d2d41){_0x26dee0['rows']=_0x1d2d41;return _0x26dee0;});}})[_0xe579('0x3b')](respondWithFilteredResult(_0x23b3ed,_0x4d3001))[_0xe579('0x2e')](handleError(_0x23b3ed,null));};exports['removeAnswers']=function(_0x37e586,_0x4501f5,_0x5502a8){return db['MailAccount'][_0xe579('0x62')]({'where':{'id':_0x37e586[_0xe579('0x64')]['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x4501f5,null))['then'](function(_0x1b999a){if(_0x1b999a){return _0x1b999a[_0xe579('0x72')](_0x37e586[_0xe579('0x4d')]['ids']);}})[_0xe579('0x3b')](respondWithStatusCode(_0x4501f5,null))[_0xe579('0x2e')](handleError(_0x4501f5,null));};exports[_0xe579('0x69')]=function(_0x2c5b25,_0x19ae2b){var _0x473261={'name':_0x2c5b25[_0xe579('0x63')][_0xe579('0x3f')],'key':_0x2c5b25[_0xe579('0x63')][_0xe579('0x4b')],'email':_0x2c5b25['body'][_0xe579('0x73')],'ListId':_0x2c5b25[_0xe579('0x63')][_0xe579('0x74')],'active':!_[_0xe579('0x75')](_0x2c5b25[_0xe579('0x63')][_0xe579('0x76')])?_0x2c5b25[_0xe579('0x63')][_0xe579('0x76')]:!![],'description':_0x2c5b25[_0xe579('0x63')][_0xe579('0x77')]||null,'Imap':{},'Smtp':{}};if(_[_0xe579('0x75')](_0x2c5b25[_0xe579('0x63')][_0xe579('0x78')])){if(_0x2c5b25[_0xe579('0x63')][_0xe579('0x79')]){_0x473261[_0xe579('0x42')]['user']=_0x473261[_0xe579('0x44')][_0xe579('0x7a')]=_0x2c5b25[_0xe579('0x63')][_0xe579('0x7b')];_0x473261[_0xe579('0x42')][_0xe579('0x7c')]=_0x473261['Smtp'][_0xe579('0x7d')]=_0x2c5b25[_0xe579('0x63')]['cpassword'];}else{_0x473261['Imap'][_0xe579('0x7e')]=_0x473261[_0xe579('0x44')][_0xe579('0x7e')]=![];}_0x473261['Imap'][_0xe579('0x7f')]=_0x2c5b25['body'][_0xe579('0x42')][_0xe579('0x7f')];_0x473261['Imap'][_0xe579('0x80')]=_0x2c5b25[_0xe579('0x63')][_0xe579('0x42')][_0xe579('0x80')];_0x473261[_0xe579('0x44')][_0xe579('0x7f')]=_0x2c5b25[_0xe579('0x63')][_0xe579('0x44')]['host'];_0x473261[_0xe579('0x44')]['port']=_0x2c5b25[_0xe579('0x63')][_0xe579('0x44')][_0xe579('0x80')];}else{_0x473261[_0xe579('0x42')][_0xe579('0x81')]=_0x473261[_0xe579('0x44')]['service']=_0x2c5b25[_0xe579('0x63')]['cservice'];_0x473261['Imap'][_0xe579('0x7a')]=_0x473261[_0xe579('0x44')][_0xe579('0x7a')]=_0x2c5b25[_0xe579('0x63')]['cuser'];_0x473261[_0xe579('0x42')][_0xe579('0x7c')]=_0x473261[_0xe579('0x44')]['pass']=_0x2c5b25['body']['cpassword'];}return db[_0xe579('0x47')][_0xe579('0x69')](_0x473261,{'include':[{'model':db['MailServerOut'],'as':_0xe579('0x44')},{'model':db[_0xe579('0x41')],'as':'Imap'}]})[_0xe579('0x3b')](function(_0x165365){var _0x478251=_0x2c5b25[_0xe579('0x7a')][_0xe579('0x82')]({'plain':!![]});if(!_0x478251)throw new Error(_0xe579('0x83'));if(_0x478251[_0xe579('0x84')]===_0xe579('0x7a')){var _0x2cb9e6=_0x165365['get']({'plain':!![]});return db[_0xe579('0x85')][_0xe579('0x62')]({'where':{'name':_0xe579('0x3c'),'userProfileId':_0x478251[_0xe579('0x86')]},'raw':!![]})[_0xe579('0x3b')](function(_0xb86150){if(_0xb86150&&_0xb86150[_0xe579('0x87')]===0x0){return db[_0xe579('0x3d')]['create']({'name':_0x2cb9e6[_0xe579('0x3f')],'resourceId':_0x2cb9e6['id'],'type':_0xb86150[_0xe579('0x3f')],'sectionId':_0xb86150['id']},{})['then'](function(){return _0x165365;});}else{return _0x165365;}})[_0xe579('0x2e')](function(_0xa0f4ac){logger['error'](_0xe579('0x88'),_0xa0f4ac);throw _0xa0f4ac;});}return _0x165365;})[_0xe579('0x3b')](respondWithResult(_0x19ae2b,0xc9))[_0xe579('0x2e')](handleError(_0x19ae2b,null));};exports[_0xe579('0x89')]=function(_0x52497e,_0x33718f,_0x3be0a2){return db[_0xe579('0x47')][_0xe579('0x6a')]({'where':{'id':_0x52497e[_0xe579('0x64')]['id']}})['then'](handleEntityNotFound(_0x33718f,null))[_0xe579('0x3b')](function(_0x2bbdfb){if(_0x2bbdfb){return _0x2bbdfb[_0xe579('0x89')]();}return null;})[_0xe579('0x3b')](respondWithResult(_0x33718f,null))[_0xe579('0x2e')](handleError(_0x33718f,null));};exports[_0xe579('0x8a')]=function(_0x4ad5f8,_0x25000f,_0x5e32da){if(_0x4ad5f8[_0xe579('0x63')]['id']){delete _0x4ad5f8[_0xe579('0x63')]['id'];}return db[_0xe579('0x47')]['find']({'where':{'id':_0x4ad5f8[_0xe579('0x64')]['id']}})['then'](handleEntityNotFound(_0x25000f,null))['then'](function(_0x4133cd){if(_0x4133cd){_0x4ad5f8[_0xe579('0x63')][_0xe579('0x67')]=_0x4133cd['id'];return db['MailServerIn'][_0xe579('0x69')](_0x4ad5f8[_0xe579('0x63')]);}})[_0xe579('0x3b')](respondWithResult(_0x25000f,null))[_0xe579('0x2e')](handleError(_0x25000f,null));};exports[_0xe579('0x8b')]=function(_0x404034,_0x2d4785,_0xa2bf9d){return db['MailAccount'][_0xe579('0x6a')]({'where':{'id':_0x404034[_0xe579('0x64')]['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x2d4785,null))[_0xe579('0x3b')](function(_0xdfadbb){if(_0xdfadbb){return _0xdfadbb[_0xe579('0x8c')](null);}return null;})[_0xe579('0x3b')](respondWithStatusCode(_0x2d4785,null))['catch'](handleError(_0x2d4785,null));};exports[_0xe579('0x8d')]=function(_0x35243c,_0x37e3f8,_0x466208){return db[_0xe579('0x47')][_0xe579('0x6a')]({'where':{'id':_0x35243c[_0xe579('0x64')]['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x37e3f8,null))['then'](function(_0x4d2f33){if(_0x4d2f33){return _0x4d2f33[_0xe579('0x8d')]();}return null;})[_0xe579('0x3b')](respondWithResult(_0x37e3f8,null))[_0xe579('0x2e')](handleError(_0x37e3f8,null));};exports[_0xe579('0x8e')]=function(_0xe0573e,_0x1ecd76,_0x421cec){if(_0xe0573e[_0xe579('0x63')]['id']){delete _0xe0573e['body']['id'];}return db['MailAccount'][_0xe579('0x62')]({'where':{'id':_0xe0573e[_0xe579('0x64')]['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x1ecd76,null))[_0xe579('0x3b')](function(_0x4836c8){if(_0x4836c8){_0xe0573e['body']['MailAccountId']=_0x4836c8['id'];return db[_0xe579('0x43')][_0xe579('0x69')](_0xe0573e[_0xe579('0x63')]);}})[_0xe579('0x3b')](respondWithResult(_0x1ecd76,null))[_0xe579('0x2e')](handleError(_0x1ecd76,null));};exports[_0xe579('0x8f')]=function(_0x3dfbf4,_0x27cadb,_0xf4eeff){return db[_0xe579('0x47')][_0xe579('0x6a')]({'where':{'id':_0x3dfbf4[_0xe579('0x64')]['id']}})['then'](handleEntityNotFound(_0x27cadb,null))[_0xe579('0x3b')](function(_0x210399){if(_0x210399){return _0x210399[_0xe579('0x90')](null);}return null;})['then'](respondWithStatusCode(_0x27cadb,null))['catch'](handleError(_0x27cadb,null));};exports[_0xe579('0x91')]=function(_0x171d32,_0x163805,_0x156949){return db[_0xe579('0x92')][_0xe579('0x62')]({'where':{'id':_0x171d32[_0xe579('0x64')]['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x163805,null))[_0xe579('0x3b')](function(_0x2b0ab9){if(_0x2b0ab9){return _0x2b0ab9[_0xe579('0x91')](_0x171d32['body'][_0xe579('0x6e')],_[_0xe579('0x93')](_0x171d32[_0xe579('0x63')],[_0xe579('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x163805,null))[_0xe579('0x2e')](handleError(_0x163805,null));};exports[_0xe579('0x94')]=function(_0xc7ef9a,_0x1be121,_0xb9fbca){var _0xdb4b78={'raw':![],'where':{}};var _0x57e438={};var _0x1f3508={'count':0x0,'rows':[]};return db[_0xe579('0x47')][_0xe579('0x6a')]({'where':{'id':_0xc7ef9a[_0xe579('0x64')]['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x1be121,null))[_0xe579('0x3b')](function(_0x357e04){if(_0x357e04){_0x57e438[_0xe579('0x4c')]=_[_0xe579('0x60')](db[_0xe579('0x92')][_0xe579('0x48')]);_0x57e438[_0xe579('0x4d')]=_[_0xe579('0x60')](_0xc7ef9a[_0xe579('0x4d')]);_0x57e438[_0xe579('0x4e')]=_[_0xe579('0x4f')](_0x57e438['model'],_0x57e438['query']);_0xdb4b78['attributes']=_[_0xe579('0x4f')](_0x57e438['model'],qs[_0xe579('0x51')](_0xc7ef9a[_0xe579('0x4d')][_0xe579('0x51')]));_0xdb4b78[_0xe579('0x50')]=_0xdb4b78[_0xe579('0x50')]['length']?_0xdb4b78[_0xe579('0x50')]:_0x57e438[_0xe579('0x4c')];if(!_0xc7ef9a['query']['hasOwnProperty']('nolimit')){_0xdb4b78[_0xe579('0x34')]=qs[_0xe579('0x34')](_0xc7ef9a[_0xe579('0x4d')][_0xe579('0x34')]);_0xdb4b78[_0xe579('0x53')]=qs[_0xe579('0x53')](_0xc7ef9a[_0xe579('0x4d')]['offset']);}_0xdb4b78['order']=qs[_0xe579('0x6c')](_0xc7ef9a[_0xe579('0x4d')][_0xe579('0x6c')]);_0xdb4b78[_0xe579('0x55')]=qs[_0xe579('0x4e')](_[_0xe579('0x56')](_0xc7ef9a['query'],_0x57e438[_0xe579('0x4e')]));_0xdb4b78[_0xe579('0x55')][_0xe579('0x67')]=_0x357e04['id'];if(_0xc7ef9a[_0xe579('0x4d')]['filter']){_0xdb4b78[_0xe579('0x55')]=_[_0xe579('0x58')](_0xdb4b78[_0xe579('0x55')],{'$or':_[_0xe579('0x46')](_0xdb4b78[_0xe579('0x50')],function(_0x1d1a05){var _0x4b1650={};_0x4b1650[_0x1d1a05]={'$like':'%'+_0xc7ef9a['query'][_0xe579('0x57')]+'%'};return _0x4b1650;})});}_0xdb4b78=_[_0xe579('0x58')]({},_0xdb4b78,_0xc7ef9a[_0xe579('0x59')]);return db[_0xe579('0x92')][_0xe579('0x33')]({'where':_0xdb4b78[_0xe579('0x55')]})['then'](function(_0xc1f52c){_0x1f3508[_0xe579('0x33')]=_0xc1f52c;if(_0xc7ef9a[_0xe579('0x4d')][_0xe579('0x5a')]){_0xdb4b78[_0xe579('0x5b')]=[{'model':db[_0xe579('0x95')],'as':_0xe579('0x96'),'required':![]},{'model':db[_0xe579('0x97')],'as':_0xe579('0x98'),'attributes':[_0xe579('0x3f'),_0xe579('0x99'),_0xe579('0x9a')],'required':![]},{'model':db[_0xe579('0x9b')],'as':_0xe579('0x9c'),'attributes':['id',_0xe579('0x3f'),_0xe579('0x9d')],'where':_0xc7ef9a[_0xe579('0x4d')][_0xe579('0x9e')]?{'id':_0xc7ef9a[_0xe579('0x4d')][_0xe579('0x9e')]}:undefined,'required':_0xc7ef9a[_0xe579('0x4d')]['tag']?!![]:![]}];}return db['MailInteraction'][_0xe579('0x5c')](_0xdb4b78);})[_0xe579('0x3b')](function(_0x52e458){_0x1f3508['rows']=_0x52e458;return _0x1f3508;});}})['then'](respondWithFilteredResult(_0x1be121,_0xdb4b78))['catch'](handleError(_0x1be121,null));};exports[_0xe579('0x9f')]=function(_0x401c88,_0x3addb4,_0x49759a){return db[_0xe579('0x47')][_0xe579('0x6a')]({'where':{'id':_0x401c88[_0xe579('0x64')]['id']}})['then'](handleEntityNotFound(_0x3addb4,null))[_0xe579('0x3b')](function(_0xb58e97){if(_0xb58e97){return db[_0xe579('0xa0')]['transaction'](function(_0x1ddf74){return db[_0xe579('0xa1')]['destroy']({'where':{'MailAccountId':_0x401c88[_0xe579('0x64')]['id']},'transaction':_0x1ddf74})[_0xe579('0x3b')](function(_0x3090da){var _0xdb0b68=_[_0xe579('0x46')](_0x401c88[_0xe579('0x63')],function(_0x3c9b21){_0x3c9b21[_0xe579('0x67')]=_0x401c88[_0xe579('0x64')]['id'];return _0x3c9b21;});return db['MailApplication'][_0xe579('0xa2')](_0xdb0b68,{'transaction':_0x1ddf74});});})['then'](function(){return db[_0xe579('0xa1')][_0xe579('0xa3')]({'where':{'MailAccountId':_0x401c88[_0xe579('0x64')]['id']},'order':'priority'});});}})[_0xe579('0x3b')](respondWithResult(_0x3addb4,null))[_0xe579('0x2e')](handleError(_0x3addb4,null));};exports['getApplications']=function(_0x478629,_0x548082,_0xd2730c){var _0xaf4cfc={};var _0xac3293={};var _0xd08a39;var _0x4f3fed;return db[_0xe579('0x47')]['findOne']({'where':{'id':_0x478629[_0xe579('0x64')]['id']}})['then'](handleEntityNotFound(_0x548082,null))[_0xe579('0x3b')](function(_0x2aaa3a){if(_0x2aaa3a){_0xd08a39=_0x2aaa3a;_0xac3293[_0xe579('0x4c')]=_[_0xe579('0x60')](db[_0xe579('0xa1')][_0xe579('0x48')]);_0xac3293[_0xe579('0x4d')]=_[_0xe579('0x60')](_0x478629['query']);_0xac3293['filters']=_[_0xe579('0x4f')](_0xac3293[_0xe579('0x4c')],_0xac3293[_0xe579('0x4d')]);_0xaf4cfc['attributes']=_[_0xe579('0x4f')](_0xac3293[_0xe579('0x4c')],qs[_0xe579('0x51')](_0x478629[_0xe579('0x4d')][_0xe579('0x51')]));_0xaf4cfc[_0xe579('0x50')]=_0xaf4cfc['attributes'][_0xe579('0x61')]?_0xaf4cfc[_0xe579('0x50')]:_0xac3293['model'];_0xaf4cfc[_0xe579('0x54')]=qs[_0xe579('0x6c')](_0x478629['query'][_0xe579('0x6c')]);_0xaf4cfc[_0xe579('0x55')]=qs[_0xe579('0x4e')](_['pick'](_0x478629['query'],_0xac3293['filters']));if(_0x478629[_0xe579('0x4d')]['filter']){_0xaf4cfc[_0xe579('0x55')]=_[_0xe579('0x58')](_0xaf4cfc['where'],{'$or':_[_0xe579('0x46')](_0xaf4cfc[_0xe579('0x50')],function(_0x2f8984){var _0xe14922={};_0xe14922[_0x2f8984]={'$like':'%'+_0x478629['query'][_0xe579('0x57')]+'%'};return _0xe14922;})});}_0xaf4cfc=_[_0xe579('0x58')]({},_0xaf4cfc,_0x478629[_0xe579('0x59')]);return _0xd08a39[_0xe579('0xa4')](_0xaf4cfc);}})[_0xe579('0x3b')](function(_0x12828a){if(_0x12828a){_0x4f3fed=_0x12828a[_0xe579('0x61')];if(!_0x478629[_0xe579('0x4d')][_0xe579('0x52')](_0xe579('0x6b'))){_0xaf4cfc[_0xe579('0x34')]=qs['limit'](_0x478629[_0xe579('0x4d')][_0xe579('0x34')]);_0xaf4cfc[_0xe579('0x53')]=qs[_0xe579('0x53')](_0x478629['query'][_0xe579('0x53')]);}return _0xd08a39[_0xe579('0xa4')](_0xaf4cfc);}})[_0xe579('0x3b')](function(_0x44bfcb){if(_0x44bfcb){return _0x44bfcb?{'count':_0x4f3fed,'rows':_0x44bfcb}:null;}})['then'](respondWithResult(_0x548082,null))['catch'](handleError(_0x548082,null));};exports[_0xe579('0xa5')]=function(_0x1a9654,_0x36b8e9,_0x27f1a3){var _0x5477cd={'raw':!![],'where':{}};var _0x31dd12={};var _0x406aae={'count':0x0,'rows':[]};return db[_0xe579('0x47')][_0xe579('0x6a')]({'where':{'id':_0x1a9654[_0xe579('0x64')]['id']}})['then'](handleEntityNotFound(_0x36b8e9,null))['then'](function(_0x45e893){if(_0x45e893){_0x31dd12[_0xe579('0x4c')]=_[_0xe579('0x60')](db[_0xe579('0xa6')][_0xe579('0x48')]);_0x31dd12[_0xe579('0x4d')]=_[_0xe579('0x60')](_0x1a9654[_0xe579('0x4d')]);_0x31dd12[_0xe579('0x4e')]=_[_0xe579('0x4f')](_0x31dd12['model'],_0x31dd12[_0xe579('0x4d')]);_0x5477cd[_0xe579('0x50')]=_[_0xe579('0x4f')](_0x31dd12['model'],qs[_0xe579('0x51')](_0x1a9654[_0xe579('0x4d')][_0xe579('0x51')]));_0x5477cd[_0xe579('0x50')]=_0x5477cd[_0xe579('0x50')][_0xe579('0x61')]?_0x5477cd['attributes']:_0x31dd12[_0xe579('0x4c')];if(!_0x1a9654['query'][_0xe579('0x52')](_0xe579('0x6b'))){_0x5477cd['limit']=qs[_0xe579('0x34')](_0x1a9654[_0xe579('0x4d')][_0xe579('0x34')]);_0x5477cd[_0xe579('0x53')]=qs['offset'](_0x1a9654[_0xe579('0x4d')][_0xe579('0x53')]);}_0x5477cd[_0xe579('0x54')]=qs['sort'](_0x1a9654['query'][_0xe579('0x6c')]);_0x5477cd[_0xe579('0x55')]=qs[_0xe579('0x4e')](_['pick'](_0x1a9654[_0xe579('0x4d')],_0x31dd12['filters']));_0x5477cd['where'][_0xe579('0x67')]=_0x45e893['id'];if(_0x1a9654[_0xe579('0x4d')][_0xe579('0x57')]){_0x5477cd['where']=_[_0xe579('0x58')](_0x5477cd['where'],{'$or':_[_0xe579('0x46')](_0x5477cd[_0xe579('0x50')],function(_0x2ff3b9){var _0x4514dd={};_0x4514dd[_0x2ff3b9]={'$like':'%'+_0x1a9654[_0xe579('0x4d')][_0xe579('0x57')]+'%'};return _0x4514dd;})});}if(_0x1a9654[_0xe579('0x4d')][_0xe579('0xa7')]){var _0x2cfa70=_0x1a9654['query'][_0xe579('0xa7')][_0xe579('0xa8')](',');var _0x413084={};_0x413084[_0x2cfa70[0x0]]={'$gte':moment(_0x2cfa70[0x1])[_0xe579('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5477cd['where']=_[_0xe579('0x58')](_0x5477cd[_0xe579('0x55')],_0x413084);}_0x5477cd=_[_0xe579('0x58')]({},_0x5477cd,_0x1a9654[_0xe579('0x59')]);return db[_0xe579('0xa6')]['count']({'where':_0x5477cd[_0xe579('0x55')]})['then'](function(_0x420e58){_0x406aae[_0xe579('0x33')]=_0x420e58;if(_0x1a9654[_0xe579('0x4d')][_0xe579('0x5a')]){_0x5477cd[_0xe579('0x5b')]=[{'all':!![]}];}return db[_0xe579('0xa6')][_0xe579('0x5c')](_0x5477cd);})[_0xe579('0x3b')](function(_0x5c08cd){_0x406aae['rows']=_0x5c08cd;return _0x406aae;});}})[_0xe579('0x3b')](respondWithFilteredResult(_0x36b8e9,_0x5477cd))[_0xe579('0x2e')](handleError(_0x36b8e9,null));};exports[_0xe579('0x40')]=function(_0x2d65fc,_0x40bc5a,_0x5888ca){var _0x595649,_0x46474d={},_0x3b4af1;if(_0x2d65fc[_0xe579('0x63')]['to']){_0x3b4af1=_0x2d65fc[_0xe579('0x63')]['to'][_0xe579('0xa8')](',')[0x0];}return db[_0xe579('0x47')][_0xe579('0x62')]({'where':{'id':_0x2d65fc['params']['id']},'include':[{'model':db[_0xe579('0xaa')],'as':_0xe579('0xab'),'include':[{'model':db['CmContact'],'as':_0xe579('0xac'),'where':{'email':_0x3b4af1},'limit':0x1,'order':[[_0xe579('0xad'),_0xe579('0xae')]]}]},{'model':db[_0xe579('0x43')],'as':_0xe579('0x44'),'raw':!![]}]})[_0xe579('0x3b')](handleEntityNotFound(_0x40bc5a,null))[_0xe579('0x3b')](function(_0x33c9fd){if(_0x33c9fd){_0x595649=_0x33c9fd;if(_0x33c9fd[_0xe579('0x44')]){if(_[_0xe579('0x75')](_0x2d65fc['body'][_0xe579('0xaf')])){_0x2d65fc[_0xe579('0x63')]['from']=util[_0xe579('0xa9')](_0xe579('0xb0'),_0x33c9fd[_0xe579('0x3f')],_0x33c9fd[_0xe579('0x73')]||_0x33c9fd[_0xe579('0x44')][_0xe579('0x7a')]);}if(_0x2d65fc[_0xe579('0x63')][_0xe579('0xb1')]&&_0x2d65fc['body'][_0xe579('0xb1')][_0xe579('0x61')]){for(var _0x552f55=0x0;_0x552f55<_0x2d65fc['body'][_0xe579('0xb1')]['length'];_0x552f55+=0x1){_0x2d65fc[_0xe579('0x63')][_0xe579('0xb1')][_0x552f55]={'filename':_0x2d65fc[_0xe579('0x63')][_0xe579('0xb1')][_0x552f55][_0xe579('0x3f')],'path':path[_0xe579('0xb2')](config[_0xe579('0xb3')],_0xe579('0xb4'),_0x2d65fc[_0xe579('0x63')][_0xe579('0xb1')][_0x552f55][_0xe579('0xb5')])};}}var _0x2d74cd={'tls':{'rejectUnauthorized':![]}};if(_[_0xe579('0x75')](_0x33c9fd[_0xe579('0x44')]['service'])){if(_0x33c9fd[_0xe579('0x44')][_0xe579('0x7e')]){_0x2d74cd[_0xe579('0xb6')]={'user':_0x33c9fd[_0xe579('0x44')][_0xe579('0x7a')],'pass':_0x33c9fd[_0xe579('0x44')][_0xe579('0x7d')]};}_0x2d74cd['host']=_0x33c9fd[_0xe579('0x44')][_0xe579('0x7f')];_0x2d74cd['port']=_0x33c9fd[_0xe579('0x44')][_0xe579('0x80')];_0x2d74cd[_0xe579('0xb7')]=_0x33c9fd[_0xe579('0x44')][_0xe579('0xb7')];}else{_0x2d74cd[_0xe579('0x81')]=_0x33c9fd[_0xe579('0x44')][_0xe579('0x81')];_0x2d74cd['auth']={'user':_0x33c9fd[_0xe579('0x44')][_0xe579('0x7a')],'pass':_0x33c9fd[_0xe579('0x44')][_0xe579('0x7d')]};}return respondWithRpcPromise(_0xe579('0xb8'),_0xe579('0xb9'),{'account':_0x2d74cd,'message':_0x2d65fc['body']});}else{throw new Error(_0xe579('0xba'));}}})[_0xe579('0x3b')](function(_0x4da464){if(_0x4da464){_0x46474d=_0x4da464;if(_0x595649[_0xe579('0xab')]){if(_0x595649[_0xe579('0xab')][_0xe579('0xac')][_0xe579('0x61')]){return _0x595649[_0xe579('0xab')][_0xe579('0xac')][0x0];}else{return db[_0xe579('0x95')][_0xe579('0x69')](_['defaults'](_0x2d65fc['body'],{'firstName':_0x2d65fc[_0xe579('0x63')]['to'],'email':_0x2d65fc[_0xe579('0x63')]['to'],'phone':_0x2d65fc[_0xe579('0x63')]['to'],'ListId':_0x595649[_0xe579('0x74')]}));}}else{throw new Error(_0xe579('0xba'));}}})[_0xe579('0x3b')](function(_0x47d99d){if(_0x47d99d){var _0x4d6755={'UserId':_0x2d65fc[_0xe579('0x7a')]['id'],'ContactId':_0x47d99d['id'],'MailAccountId':_0x595649['id'],'inReplyTo':_0x46474d[_0xe579('0xbb')],'to':_0x2d65fc[_0xe579('0x63')]['from'],'cc':_0x2d65fc[_0xe579('0x63')]['cc'],'subject':_0x2d65fc['body'][_0xe579('0xbc')],'attach':_0x2d65fc[_0xe579('0x63')][_0xe579('0xbd')],'firstMsgDirection':_0xe579('0xbe'),'lastMsgAt':moment()['format'](_0xe579('0xbf')),'lastMsgDirection':_0xe579('0xbe'),'lastMsgBody':_0x2d65fc[_0xe579('0x63')][_0xe579('0x63')],'Messages':[_[_0xe579('0x58')](_0x2d65fc['body'],{'messageId':_0x46474d[_0xe579('0xbb')],'sentAt':moment()[_0xe579('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x595649['id'],'UserId':_0x2d65fc[_0xe579('0x7a')]['id'],'ContactId':_0x47d99d['id']})]};if(_0x2d65fc[_0xe579('0x63')][_0xe579('0xc0')]){_0x4d6755=_[_0xe579('0x58')](_0x4d6755,_0x2d65fc['body'][_0xe579('0xc0')]);}return db[_0xe579('0x92')][_0xe579('0x69')](_0x4d6755,{'include':[{'model':db[_0xe579('0xa6')],'as':_0xe579('0xc1')}]});}})[_0xe579('0x3b')](respondWithResult(_0x40bc5a,null))[_0xe579('0x2e')](handleError(_0x40bc5a,null));};exports[_0xe579('0xc2')]=function(_0x5e49da,_0x1e04c3,_0x41afff){return db[_0xe579('0x47')][_0xe579('0x62')]({'where':{'id':_0x5e49da[_0xe579('0x64')]['id']},'include':[{'model':db[_0xe579('0x43')],'as':'Smtp','raw':!![]}]})[_0xe579('0x3b')](handleEntityNotFound(_0x1e04c3,null))[_0xe579('0x3b')](function(_0x4e841d){if(_0x4e841d&&_0x4e841d[_0xe579('0x44')]){var _0x89e744={'id':_0x4e841d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4e841d[_0xe579('0x44')][_0xe579('0x81')]){_0x89e744[_0xe579('0x81')]=_0x4e841d[_0xe579('0x44')][_0xe579('0x81')];}else{_0x89e744['host']=_0x4e841d[_0xe579('0x44')]['host'];_0x89e744[_0xe579('0x80')]=_0x4e841d['Smtp'][_0xe579('0x80')];_0x89e744[_0xe579('0xb7')]=_0x4e841d[_0xe579('0x44')][_0xe579('0xb7')];}if(_0x4e841d['Smtp'][_0xe579('0x7e')]){_0x89e744[_0xe579('0xb6')]={'user':_0x4e841d[_0xe579('0x44')][_0xe579('0x7a')],'pass':_0x4e841d[_0xe579('0x44')][_0xe579('0x7d')]};}return respondWithRpcPromise(_0xe579('0xc3'),_0xe579('0xc2'),{'account':_0x89e744});}})['then'](respondWithResult(_0x1e04c3,null))[_0xe579('0x2e')](handleError(_0x1e04c3,null));};exports[_0xe579('0x3a')]=function(_0x1449fe,_0x1af522){return db[_0xe579('0x47')][_0xe579('0x62')]({'where':{'id':_0x1449fe[_0xe579('0x64')]['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x1af522,null))[_0xe579('0x3b')](function(_0x4ae266){if(_0x4ae266&&_0x4ae266[_0xe579('0x81')]){throw new db[(_0xe579('0xc4'))]['ValidationError'](_0xe579('0xc5'));}return _0x4ae266;})[_0xe579('0x3b')](removeEntity(_0x1af522,null))[_0xe579('0x2e')](handleError(_0x1af522,null));};exports[_0xe579('0xc6')]=function(_0x45898c,_0x17a5e4,_0x33ca61){return db[_0xe579('0x47')]['find']({'where':{'id':_0x45898c['params']['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x17a5e4,null))[_0xe579('0x3b')](function(_0x387fed){if(_0x387fed){return _0x387fed['addAgents'](_0x45898c[_0xe579('0x63')][_0xe579('0x6e')],_[_0xe579('0x93')](_0x45898c[_0xe579('0x63')],[_0xe579('0x6e'),'id'])||{})['spread'](function(_0xf828c1){for(var _0x11028b=0x0;_0x11028b<_0x45898c[_0xe579('0x63')][_0xe579('0x6e')][_0xe579('0x61')];_0x11028b+=0x1){socket[_0xe579('0xc7')]('userMailAccount:save',{'UserId':_0x45898c['body'][_0xe579('0x6e')][_0x11028b],'MailAccountId':_0x45898c[_0xe579('0x64')]['id']});}return _0xf828c1;});}})['then'](respondWithResult(_0x17a5e4,null))[_0xe579('0x2e')](handleError(_0x17a5e4,null));};exports['removeAgents']=function(_0xe36d93,_0x6ff08,_0x809307){return db[_0xe579('0x47')][_0xe579('0x62')]({'where':{'id':_0xe36d93['params']['id']}})[_0xe579('0x3b')](handleEntityNotFound(_0x6ff08,null))[_0xe579('0x3b')](function(_0x229924){if(_0x229924){return _0x229924[_0xe579('0xc8')](_0xe36d93['query'][_0xe579('0x6e')])[_0xe579('0x3b')](function(){if(_[_0xe579('0xc9')](_0xe36d93[_0xe579('0x4d')][_0xe579('0x6e')])){for(var _0x5e8c31=0x0;_0x5e8c31<_0xe36d93['query']['ids'][_0xe579('0x61')];_0x5e8c31+=0x1){socket[_0xe579('0xc7')](_0xe579('0xca'),{'UserId':Number(_0xe36d93[_0xe579('0x4d')][_0xe579('0x6e')][_0x5e8c31]),'MailAccountId':Number(_0xe36d93[_0xe579('0x64')]['id'])});}}else{socket[_0xe579('0xc7')](_0xe579('0xca'),{'UserId':Number(_0xe36d93['query'][_0xe579('0x6e')]),'MailAccountId':Number(_0xe36d93[_0xe579('0x64')]['id'])});}});}})[_0xe579('0x3b')](respondWithStatusCode(_0x6ff08,null))[_0xe579('0x2e')](handleError(_0x6ff08,null));};exports[_0xe579('0xcb')]=function(_0x3c723b,_0x4bdc4f,_0x2b8537){var _0x25d580={};var _0x341512={};var _0x58bf5f;var _0x4a313f;return db[_0xe579('0x47')][_0xe579('0x6a')]({'where':{'id':_0x3c723b[_0xe579('0x64')]['id']}})['then'](handleEntityNotFound(_0x4bdc4f,null))['then'](function(_0x2c01fd){if(_0x2c01fd){_0x58bf5f=_0x2c01fd;_0x341512[_0xe579('0x4c')]=_[_0xe579('0x60')](db[_0xe579('0x97')]['rawAttributes']);_0x341512[_0xe579('0x4d')]=_[_0xe579('0x60')](_0x3c723b[_0xe579('0x4d')]);_0x341512[_0xe579('0x4e')]=_[_0xe579('0x4f')](_0x341512[_0xe579('0x4c')],_0x341512[_0xe579('0x4d')]);_0x25d580[_0xe579('0x50')]=_[_0xe579('0x4f')](_0x341512[_0xe579('0x4c')],qs[_0xe579('0x51')](_0x3c723b[_0xe579('0x4d')][_0xe579('0x51')]));_0x25d580[_0xe579('0x50')]=_0x25d580[_0xe579('0x50')][_0xe579('0x61')]?_0x25d580['attributes']:_0x341512[_0xe579('0x4c')];_0x25d580['order']=qs['sort'](_0x3c723b[_0xe579('0x4d')][_0xe579('0x6c')]);_0x25d580[_0xe579('0x55')]=qs[_0xe579('0x4e')](_[_0xe579('0x56')](_0x3c723b[_0xe579('0x4d')],_0x341512[_0xe579('0x4e')]));if(_0x3c723b[_0xe579('0x4d')][_0xe579('0x57')]){_0x25d580['where']=_[_0xe579('0x58')](_0x25d580[_0xe579('0x55')],{'$or':_[_0xe579('0x46')](_0x25d580[_0xe579('0x50')],function(_0x541bd2){var _0x36399e={};_0x36399e[_0x541bd2]={'$like':'%'+_0x3c723b['query'][_0xe579('0x57')]+'%'};return _0x36399e;})});}_0x25d580=_['merge']({},_0x25d580,_0x3c723b['options']);return _0x58bf5f[_0xe579('0xcb')](_0x25d580);}})[_0xe579('0x3b')](function(_0x43891a){if(_0x43891a){_0x4a313f=_0x43891a['length'];if(!_0x3c723b[_0xe579('0x4d')][_0xe579('0x52')]('nolimit')){_0x25d580[_0xe579('0x34')]=qs['limit'](_0x3c723b[_0xe579('0x4d')][_0xe579('0x34')]);_0x25d580[_0xe579('0x53')]=qs[_0xe579('0x53')](_0x3c723b[_0xe579('0x4d')][_0xe579('0x53')]);}return _0x58bf5f[_0xe579('0xcb')](_0x25d580);}})[_0xe579('0x3b')](function(_0x298d68){if(_0x298d68){return _0x298d68?{'count':_0x4a313f,'rows':_0x298d68}:null;}})['then'](respondWithResult(_0x4bdc4f,null))[_0xe579('0x2e')](handleError(_0x4bdc4f,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3b05e45..2f9d5d4 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 _0x11a8=['MailAccount','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x11a8,0x1e2));var _0x811a=function(_0x5a47ff,_0x3055e7){_0x5a47ff=_0x5a47ff-0x0;var _0x9474bc=_0x11a8[_0x5a47ff];return _0x9474bc;};'use strict';var EventEmitter=require(_0x811a('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x811a('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x811a('0x2'),'afterUpdate':'update','afterDestroy':_0x811a('0x3')};function emitEvent(_0x5b911e){return function(_0x404071,_0x31ad78,_0x4bafbf){MailAccountEvents[_0x811a('0x4')](_0x5b911e+':'+_0x404071['id'],_0x404071);MailAccountEvents[_0x811a('0x4')](_0x5b911e,_0x404071);_0x4bafbf(null);};}for(var e in events){if(events[_0x811a('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x811a('0x6')]=MailAccountEvents; \ No newline at end of file +var _0x9ffd=['hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','save','update','remove','emit'];(function(_0x331dff,_0x3b1133){var _0x26c707=function(_0x443feb){while(--_0x443feb){_0x331dff['push'](_0x331dff['shift']());}};_0x26c707(++_0x3b1133);}(_0x9ffd,0xcb));var _0xd9ff=function(_0x4ecfee,_0x573161){_0x4ecfee=_0x4ecfee-0x0;var _0x26ec4c=_0x9ffd[_0x4ecfee];return _0x26ec4c;};'use strict';var EventEmitter=require(_0xd9ff('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xd9ff('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xd9ff('0x2')](0x0);var events={'afterCreate':_0xd9ff('0x3'),'afterUpdate':_0xd9ff('0x4'),'afterDestroy':_0xd9ff('0x5')};function emitEvent(_0x4da084){return function(_0x5bada0,_0x53e16f,_0x2a99fc){MailAccountEvents[_0xd9ff('0x6')](_0x4da084+':'+_0x5bada0['id'],_0x5bada0);MailAccountEvents[_0xd9ff('0x6')](_0x4da084,_0x5bada0);_0x2a99fc(null);};}for(var e in events){if(events[_0xd9ff('0x7')](e)){var event=events[e];MailAccount[_0xd9ff('0x8')](e,emitEvent(event));}}module[_0xd9ff('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index f9147fb..a1dc71e 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 _0x8107=['define','MailAccount','mail_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x23c2b7,_0x57b41a){var _0x4c7225=function(_0x165d69){while(--_0x165d69){_0x23c2b7['push'](_0x23c2b7['shift']());}};_0x4c7225(++_0x57b41a);}(_0x8107,0x1bd));var _0x7810=function(_0x2f8be8,_0x46cff7){_0x2f8be8=_0x2f8be8-0x0;var _0x58b0d7=_0x8107[_0x2f8be8];return _0x58b0d7;};'use strict';var _=require(_0x7810('0x0'));var util=require(_0x7810('0x1'));var logger=require('../../config/logger')(_0x7810('0x2'));var moment=require(_0x7810('0x3'));var BPromise=require(_0x7810('0x4'));var rp=require(_0x7810('0x5'));var fs=require('fs');var path=require(_0x7810('0x6'));var rimraf=require(_0x7810('0x7'));var config=require(_0x7810('0x8'));var attributes=require('./mailAccount.attributes');module[_0x7810('0x9')]=function(_0x4229b2,_0x2d1882){return _0x4229b2[_0x7810('0xa')](_0x7810('0xb'),attributes,{'tableName':_0x7810('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d98=['moment','request-promise','./mailAccount.attributes','exports','MailAccount','lodash','../../config/logger','api'];(function(_0x554faf,_0x4a2f7f){var _0x35ea4e=function(_0x338fe2){while(--_0x338fe2){_0x554faf['push'](_0x554faf['shift']());}};_0x35ea4e(++_0x4a2f7f);}(_0x7d98,0x75));var _0x87d9=function(_0x3e21f4,_0x43d310){_0x3e21f4=_0x3e21f4-0x0;var _0x40fc49=_0x7d98[_0x3e21f4];return _0x40fc49;};'use strict';var _=require(_0x87d9('0x0'));var util=require('util');var logger=require(_0x87d9('0x1'))(_0x87d9('0x2'));var moment=require(_0x87d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x87d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x87d9('0x5'));module[_0x87d9('0x6')]=function(_0x2bc9fd,_0x23a797){return _0x2bc9fd['define'](_0x87d9('0x7'),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 62eb17f..ddea544 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 _0x6611=['messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','inReplyTo','MailInteraction','spread','update','interaction','created','MailMessage','attachments','originTo','originCc','bcc','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','./mailAccount.socket','register','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetMailAccount','MailAccount','findAll','options','raw','attributes','include','map','model','ShowMailAccount','find','where','catch','body','mail','difference','keys','CmContact','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','DESC','MailApplication','Applications','Smtp','get','omit','applications','list','orderBy','priority','asc','push','length','close','autoclose','*,*,*,*','create','contact'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6611,0xdd));var _0x1661=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6611[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x1661('0x0'));var moment=require(_0x1661('0x1'));var BPromise=require(_0x1661('0x2'));var rs=require(_0x1661('0x3'));var fs=require('fs');var Redis=require(_0x1661('0x4'));var db=require(_0x1661('0x5'))['db'];var utils=require(_0x1661('0x6'));var logger=require(_0x1661('0x7'))(_0x1661('0x8'));var config=require(_0x1661('0x9'));var jayson=require(_0x1661('0xa'));var client=jayson[_0x1661('0xb')]['http']({'port':0x232c});config['redis']=_[_0x1661('0xc')](config[_0x1661('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1661('0xd')]));require(_0x1661('0xe'))[_0x1661('0xf')](socket);function respondWithRpcPromise(_0x6e95e5,_0x352ca0,_0x478300){return new BPromise(function(_0x11a269,_0x265faf){return client['request'](_0x6e95e5,_0x478300)[_0x1661('0x10')](function(_0x2197f2){logger['info'](_0x1661('0x11'),_0x352ca0,'request\x20sent');logger[_0x1661('0x12')](_0x1661('0x13'),_0x352ca0,_0x1661('0x14'),JSON[_0x1661('0x15')](_0x2197f2));if(_0x2197f2[_0x1661('0x16')]){if(_0x2197f2[_0x1661('0x16')][_0x1661('0x17')]===0x1f4){logger[_0x1661('0x16')](_0x1661('0x11'),_0x352ca0,_0x2197f2[_0x1661('0x16')][_0x1661('0x18')]);return _0x265faf(_0x2197f2[_0x1661('0x16')][_0x1661('0x18')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x352ca0,_0x2197f2[_0x1661('0x16')][_0x1661('0x18')]);return _0x11a269(_0x2197f2['error'][_0x1661('0x18')]);}else{logger[_0x1661('0x19')](_0x1661('0x11'),_0x352ca0,_0x1661('0x14'));_0x11a269(_0x2197f2['result'][_0x1661('0x18')]);}})['catch'](function(_0x358aff){logger['error'](_0x1661('0x11'),_0x352ca0,_0x358aff);_0x265faf(_0x358aff);});});}exports[_0x1661('0x1a')]=function(_0x4f7d40){var _0x2f6528=this;return new Promise(function(_0x5bf58d,_0x3c1559){return db[_0x1661('0x1b')][_0x1661('0x1c')]({'raw':_0x4f7d40[_0x1661('0x1d')]?_0x4f7d40[_0x1661('0x1d')][_0x1661('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f7d40[_0x1661('0x1d')]?_0x4f7d40['options']['where']||null:null,'attributes':_0x4f7d40[_0x1661('0x1d')]?_0x4f7d40[_0x1661('0x1d')][_0x1661('0x1f')]||null:null,'limit':_0x4f7d40[_0x1661('0x1d')]?_0x4f7d40[_0x1661('0x1d')]['limit']||null:null,'include':_0x4f7d40[_0x1661('0x1d')]?_0x4f7d40['options'][_0x1661('0x20')]?_[_0x1661('0x21')](_0x4f7d40[_0x1661('0x1d')][_0x1661('0x20')],function(_0x48b807){return{'model':db[_0x48b807[_0x1661('0x22')]],'as':_0x48b807['as'],'attributes':_0x48b807[_0x1661('0x1f')],'include':_0x48b807[_0x1661('0x20')]?_['map'](_0x48b807[_0x1661('0x20')],function(_0x454c69){return{'model':db[_0x454c69['model']],'as':_0x454c69['as'],'attributes':_0x454c69[_0x1661('0x1f')],'include':_0x454c69['include']?_[_0x1661('0x21')](_0x454c69[_0x1661('0x20')],function(_0x15111e){return{'model':db[_0x15111e[_0x1661('0x22')]],'as':_0x15111e['as'],'attributes':_0x15111e[_0x1661('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1661('0x10')](function(_0x42886a){logger[_0x1661('0x19')]('GetMailAccount',_0x4f7d40);logger[_0x1661('0x12')](_0x1661('0x1a'),_0x4f7d40,JSON['stringify'](_0x42886a));_0x5bf58d(_0x42886a);})['catch'](function(_0x1e1694){logger['error'](_0x1661('0x1a'),_0x1e1694[_0x1661('0x18')],_0x4f7d40);_0x3c1559(_0x2f6528['error'](0x1f4,_0x1e1694[_0x1661('0x18')]));});});};exports[_0x1661('0x23')]=function(_0x1e40a9){var _0x732cea=this;return new Promise(function(_0x3a91cc,_0x1ffa75){return db['MailAccount'][_0x1661('0x24')]({'raw':_0x1e40a9[_0x1661('0x1d')]?_0x1e40a9['options'][_0x1661('0x1e')]===undefined?!![]:![]:!![],'where':_0x1e40a9[_0x1661('0x1d')]?_0x1e40a9['options'][_0x1661('0x25')]||null:null,'attributes':_0x1e40a9['options']?_0x1e40a9[_0x1661('0x1d')][_0x1661('0x1f')]||null:null,'include':_0x1e40a9[_0x1661('0x1d')]?_0x1e40a9[_0x1661('0x1d')][_0x1661('0x20')]?_[_0x1661('0x21')](_0x1e40a9[_0x1661('0x1d')]['include'],function(_0xfe49fb){return{'model':db[_0xfe49fb[_0x1661('0x22')]],'as':_0xfe49fb['as'],'attributes':_0xfe49fb[_0x1661('0x1f')],'include':_0xfe49fb[_0x1661('0x20')]?_['map'](_0xfe49fb[_0x1661('0x20')],function(_0x267844){return{'model':db[_0x267844[_0x1661('0x22')]],'as':_0x267844['as'],'attributes':_0x267844['attributes'],'include':_0x267844[_0x1661('0x20')]?_['map'](_0x267844['include'],function(_0x5a7751){return{'model':db[_0x5a7751[_0x1661('0x22')]],'as':_0x5a7751['as'],'attributes':_0x5a7751[_0x1661('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1661('0x10')](function(_0x349cde){logger[_0x1661('0x19')](_0x1661('0x23'),_0x1e40a9);logger['debug'](_0x1661('0x23'),_0x1e40a9,JSON[_0x1661('0x15')](_0x349cde));_0x3a91cc(_0x349cde);})[_0x1661('0x26')](function(_0x502647){logger[_0x1661('0x16')](_0x1661('0x23'),_0x502647[_0x1661('0x18')],_0x1e40a9);_0x1ffa75(_0x732cea[_0x1661('0x16')](0x1f4,_0x502647[_0x1661('0x18')]));});});};exports['NotifyMailAccount']=function(_0x4956c1){var _0x58025d=this;return new Promise(function(_0x29e452,_0x34ad79){var _0x5620a2={'body':_0x4956c1[_0x1661('0x27')],'channel':_0x1661('0x28')};var _0x20bad3=_[_0x1661('0x29')](_[_0x1661('0x2a')](db[_0x1661('0x2b')]['rawAttributes']),['createdAt',_0x1661('0x2c'),'CompanyId',_0x1661('0x2d')]);var _0x41d51d=![];if(_0x4956c1[_0x1661('0x27')]['id']){delete _0x4956c1['body']['id'];}if(_[_0x1661('0x2e')](_0x4956c1[_0x1661('0x27')][_0x1661('0x2f')])){return _0x34ad79(_0x58025d[_0x1661('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x4956c1[_0x1661('0x27')][_0x1661('0x27')])||_0x4956c1[_0x1661('0x27')]['body']===''){return _0x34ad79(_0x58025d[_0x1661('0x16')](0x1f4,_0x1661('0x30')));}if(_[_0x1661('0x2e')](_0x4956c1[_0x1661('0x27')][_0x1661('0x31')])){return _0x34ad79(_0x58025d[_0x1661('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x20bad3));}if(!_[_0x1661('0x32')](_0x20bad3,_0x4956c1[_0x1661('0x27')][_0x1661('0x31')])){return _0x34ad79(_0x58025d[_0x1661('0x16')](0x1f4,_0x1661('0x33')+_0x20bad3));}var _0xbc40fe={};_0xbc40fe[_0x4956c1[_0x1661('0x27')][_0x1661('0x31')]]=_0x4956c1['body'][_0x1661('0x2f')];return db[_0x1661('0x1b')][_0x1661('0x24')]({'where':{'id':_0x4956c1[_0x1661('0x34')]['id']},'include':[{'model':db['CmList'],'as':_0x1661('0x35'),'include':[{'model':db[_0x1661('0x2b')],'as':_0x1661('0x36'),'where':_0xbc40fe,'limit':0x1,'order':[[_0x1661('0x2c'),_0x1661('0x37')]]}]},{'model':db[_0x1661('0x38')],'as':_0x1661('0x39')},{'model':db['MailServerOut'],'as':_0x1661('0x3a')}]})['then'](function(_0x4ed509){if(_0x4ed509&&_0x4ed509['List']){var _0x2c8d17=_0x4ed509[_0x1661('0x3b')]({'plain':!![]});_0x5620a2[_0x1661('0x34')]=_[_0x1661('0x3c')](_0x2c8d17,['Applications',_0x1661('0x35')]);_0x5620a2[_0x1661('0x3d')]=_0x2c8d17[_0x1661('0x39')];_0x5620a2[_0x1661('0x3e')]=_0x2c8d17[_0x1661('0x35')];_0x5620a2['applications']=_[_0x1661('0x3f')](_0x5620a2[_0x1661('0x3d')],[_0x1661('0x40')],[_0x1661('0x41')]);if(_0x5620a2[_0x1661('0x34')]&&_0x5620a2['account']['autoclose']){_0x5620a2[_0x1661('0x3d')][_0x1661('0x42')]({'id':0x0,'priority':_0x5620a2[_0x1661('0x3d')][_0x1661('0x43')]+0x1,'app':_0x1661('0x44'),'appdata':_0x1661('0x45'),'interval':_0x1661('0x46')});}if(_0x5620a2[_0x1661('0x34')]['Applications']){delete _0x5620a2[_0x1661('0x34')]['Applications'];}if(_0x5620a2[_0x1661('0x34')][_0x1661('0x35')]){delete _0x5620a2[_0x1661('0x34')][_0x1661('0x35')];}if(_0x2c8d17[_0x1661('0x35')][_0x1661('0x36')][_0x1661('0x43')]){return _0x2c8d17[_0x1661('0x35')][_0x1661('0x36')][0x0];}var _0x34e3a9=_[_0x1661('0xc')](_0x4956c1[_0x1661('0x27')],{'firstName':_0x4956c1[_0x1661('0x27')][_0x1661('0x2f')],'ListId':_0x2c8d17[_0x1661('0x2d')]});_0x34e3a9[_0x4956c1['body']['mapKey']]=_0x4956c1[_0x1661('0x27')][_0x1661('0x2f')];return db[_0x1661('0x2b')][_0x1661('0x47')](_0x34e3a9);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x1ac938){_0x5620a2[_0x1661('0x48')]=_0x1ac938;if(_0x1ac938){if(!_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x49')]){_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x49')]=rs[_0x1661('0x4a')]()+'\x20'+_0x4956c1[_0x1661('0x27')][_0x1661('0x18')]['from'];}var _0x2f3eb7={'ContactId':_0x1ac938['id'],'MailAccountId':_0x4956c1[_0x1661('0x34')]['id'],'inReplyTo':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x49')],'to':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x2f')],'cc':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')]['cc'],'subject':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x4b')],'attach':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x4c')],'lastMsgAt':moment()[_0x1661('0x4d')](_0x1661('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x4956c1['body'][_0x1661('0x27')]};return db['MailInteraction'][_0x1661('0x24')]({'where':{'closed':![],'MailAccountId':_0x4956c1[_0x1661('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':['messageId'],'where':{'messageId':_0x4956c1['body'][_0x1661('0x18')][_0x1661('0x4f')]}}]})[_0x1661('0x10')](function(_0x4aa99b){if(_0x4aa99b){return[_0x4aa99b,![]];}return db[_0x1661('0x50')][_0x1661('0x47')](_0x2f3eb7)[_0x1661('0x10')](function(_0x534cab){return[_0x534cab,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x1661('0x51')](function(_0x3867be,_0x3f01a6){if(_0x3867be){_0x41d51d=_0x3f01a6;if(!_0x3f01a6){return _0x3867be[_0x1661('0x52')]({'inReplyTo':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x49')],'to':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')]['from'],'cc':_0x4956c1[_0x1661('0x27')]['message']['cc'],'subject':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')]['subject'],'attach':_0x3867be[_0x1661('0x4c')]?_0x3867be[_0x1661('0x4c')]:_0x4956c1[_0x1661('0x27')]['message'][_0x1661('0x4c')],'substatus':null,'substatusAt':moment()[_0x1661('0x4d')](_0x1661('0x4e')),'lastMsgAt':moment()[_0x1661('0x4d')](_0x1661('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x4956c1[_0x1661('0x27')][_0x1661('0x27')]});}else{return _0x3867be;}}})[_0x1661('0x10')](function(_0x2ede2b){_0x5620a2[_0x1661('0x53')]=_0x2ede2b[_0x1661('0x3b')]({'plain':!![]});_0x5620a2[_0x1661('0x53')][_0x1661('0x54')]=_0x41d51d;return db[_0x1661('0x55')][_0x1661('0x47')]({'body':_0x4956c1[_0x1661('0x27')][_0x1661('0x27')],'MailAccountId':_0x4956c1['account']['id'],'MailInteractionId':_0x2ede2b['id'],'direction':'in','ContactId':_0x5620a2['contact']['id'],'messageId':_0x4956c1[_0x1661('0x27')]['message']['messageId'],'from':_0x4956c1[_0x1661('0x27')]['message'][_0x1661('0x2f')],'to':_0x4956c1['body'][_0x1661('0x18')]['to'],'cc':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')]['cc'],'subject':_0x4956c1['body'][_0x1661('0x18')][_0x1661('0x4b')],'attach':_0x4956c1['body'][_0x1661('0x18')]['attach'],'Attachments':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x56')],'originTo':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x57')],'originCc':_0x4956c1[_0x1661('0x27')][_0x1661('0x18')][_0x1661('0x58')],'bcc':_0x4956c1[_0x1661('0x27')]['message'][_0x1661('0x59')]},{'include':[{'model':db[_0x1661('0x5a')],'as':'Attachments'}]});})[_0x1661('0x10')](function(_0x5b9b41){_0x5620a2['message']=_0x5b9b41;if(_0x5620a2['interaction'][_0x1661('0x5b')]){return db[_0x1661('0x5c')][_0x1661('0x24')]({'attributes':['id',_0x1661('0x5d')],'where':{'id':_0x5620a2[_0x1661('0x53')][_0x1661('0x5b')]}})[_0x1661('0x10')](function(_0x546697){if(_0x546697){_0x5620a2[_0x1661('0x3d')][_0x1661('0x5e')]({'id':0x0,'priority':0x0,'app':_0x1661('0x5f'),'appdata':_0x546697[_0x1661('0x5d')]+','+(_0x5620a2[_0x1661('0x34')][_0x1661('0x60')]||0xa),'interval':_0x1661('0x46')});}return respondWithRpcPromise('Start',_0x1661('0x61'),_0x5620a2);});}return respondWithRpcPromise('Start',_0x1661('0x61'),_0x5620a2);})['then'](function(_0x30b624){_0x29e452(_0x30b624);})[_0x1661('0x26')](function(_0x33e824){_0x34ad79(_0x58025d[_0x1661('0x16')](0x1f4,_0x33e824[_0x1661('0x18')]));});});}; \ No newline at end of file +var _0x3451=['update','interaction','attachments','originCc','bcc','Attachment','Attachments','UserId','User','agent','name','*,*,*,*','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowMailAccount','find','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','omit','list','orderBy','applications','asc','push','length','close','create','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread'];(function(_0x336529,_0x2bdc1b){var _0x4c53e1=function(_0x38bcb6){while(--_0x38bcb6){_0x336529['push'](_0x336529['shift']());}};_0x4c53e1(++_0x2bdc1b);}(_0x3451,0x19a));var _0x1345=function(_0x335877,_0x2c4acf){_0x335877=_0x335877-0x0;var _0x26fd06=_0x3451[_0x335877];return _0x26fd06;};'use strict';var _=require(_0x1345('0x0'));var util=require(_0x1345('0x1'));var moment=require('moment');var BPromise=require(_0x1345('0x2'));var rs=require(_0x1345('0x3'));var fs=require('fs');var Redis=require(_0x1345('0x4'));var db=require(_0x1345('0x5'))['db'];var utils=require(_0x1345('0x6'));var logger=require(_0x1345('0x7'))(_0x1345('0x8'));var config=require(_0x1345('0x9'));var jayson=require(_0x1345('0xa'));var client=jayson[_0x1345('0xb')][_0x1345('0xc')]({'port':0x232c});config[_0x1345('0xd')]=_['defaults'](config[_0x1345('0xd')],{'host':_0x1345('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1345('0xd')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3e04bc,_0x4a89d5,_0x1cb45c){return new BPromise(function(_0x37788f,_0x54ea40){return client['request'](_0x3e04bc,_0x1cb45c)[_0x1345('0xf')](function(_0x523971){logger[_0x1345('0x10')](_0x1345('0x11'),_0x4a89d5,_0x1345('0x12'));logger[_0x1345('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4a89d5,_0x1345('0x12'),JSON[_0x1345('0x14')](_0x523971));if(_0x523971[_0x1345('0x15')]){if(_0x523971[_0x1345('0x15')]['code']===0x1f4){logger[_0x1345('0x15')](_0x1345('0x11'),_0x4a89d5,_0x523971[_0x1345('0x15')][_0x1345('0x16')]);return _0x54ea40(_0x523971[_0x1345('0x15')][_0x1345('0x16')]);}logger[_0x1345('0x15')](_0x1345('0x11'),_0x4a89d5,_0x523971[_0x1345('0x15')][_0x1345('0x16')]);return _0x37788f(_0x523971[_0x1345('0x15')]['message']);}else{logger['info'](_0x1345('0x11'),_0x4a89d5,_0x1345('0x12'));_0x37788f(_0x523971[_0x1345('0x17')][_0x1345('0x16')]);}})['catch'](function(_0x2a88ed){logger[_0x1345('0x15')](_0x1345('0x11'),_0x4a89d5,_0x2a88ed);_0x54ea40(_0x2a88ed);});});}exports[_0x1345('0x18')]=function(_0x36b291){var _0x13a8b2=this;return new Promise(function(_0x2062ce,_0x43d209){return db[_0x1345('0x19')][_0x1345('0x1a')]({'raw':_0x36b291[_0x1345('0x1b')]?_0x36b291['options'][_0x1345('0x1c')]===undefined?!![]:![]:!![],'where':_0x36b291[_0x1345('0x1b')]?_0x36b291[_0x1345('0x1b')][_0x1345('0x1d')]||null:null,'attributes':_0x36b291[_0x1345('0x1b')]?_0x36b291[_0x1345('0x1b')][_0x1345('0x1e')]||null:null,'limit':_0x36b291[_0x1345('0x1b')]?_0x36b291[_0x1345('0x1b')][_0x1345('0x1f')]||null:null,'include':_0x36b291[_0x1345('0x1b')]?_0x36b291[_0x1345('0x1b')][_0x1345('0x20')]?_['map'](_0x36b291[_0x1345('0x1b')]['include'],function(_0xd08b03){return{'model':db[_0xd08b03[_0x1345('0x21')]],'as':_0xd08b03['as'],'attributes':_0xd08b03[_0x1345('0x1e')],'include':_0xd08b03[_0x1345('0x20')]?_[_0x1345('0x22')](_0xd08b03[_0x1345('0x20')],function(_0x3b891c){return{'model':db[_0x3b891c[_0x1345('0x21')]],'as':_0x3b891c['as'],'attributes':_0x3b891c[_0x1345('0x1e')],'include':_0x3b891c[_0x1345('0x20')]?_[_0x1345('0x22')](_0x3b891c[_0x1345('0x20')],function(_0x483e75){return{'model':db[_0x483e75[_0x1345('0x21')]],'as':_0x483e75['as'],'attributes':_0x483e75['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b598a){logger[_0x1345('0x10')](_0x1345('0x18'),_0x36b291);logger[_0x1345('0x13')](_0x1345('0x18'),_0x36b291,JSON['stringify'](_0x2b598a));_0x2062ce(_0x2b598a);})[_0x1345('0x23')](function(_0x2b2be4){logger[_0x1345('0x15')]('GetMailAccount',_0x2b2be4[_0x1345('0x16')],_0x36b291);_0x43d209(_0x13a8b2['error'](0x1f4,_0x2b2be4['message']));});});};exports[_0x1345('0x24')]=function(_0x1edcdc){var _0x7a1680=this;return new Promise(function(_0x30ea62,_0x526ed1){return db[_0x1345('0x19')][_0x1345('0x25')]({'raw':_0x1edcdc[_0x1345('0x1b')]?_0x1edcdc[_0x1345('0x1b')][_0x1345('0x1c')]===undefined?!![]:![]:!![],'where':_0x1edcdc[_0x1345('0x1b')]?_0x1edcdc[_0x1345('0x1b')][_0x1345('0x1d')]||null:null,'attributes':_0x1edcdc[_0x1345('0x1b')]?_0x1edcdc[_0x1345('0x1b')][_0x1345('0x1e')]||null:null,'include':_0x1edcdc['options']?_0x1edcdc[_0x1345('0x1b')][_0x1345('0x20')]?_[_0x1345('0x22')](_0x1edcdc[_0x1345('0x1b')][_0x1345('0x20')],function(_0x4c0890){return{'model':db[_0x4c0890[_0x1345('0x21')]],'as':_0x4c0890['as'],'attributes':_0x4c0890['attributes'],'include':_0x4c0890['include']?_[_0x1345('0x22')](_0x4c0890[_0x1345('0x20')],function(_0x3c515a){return{'model':db[_0x3c515a['model']],'as':_0x3c515a['as'],'attributes':_0x3c515a[_0x1345('0x1e')],'include':_0x3c515a[_0x1345('0x20')]?_[_0x1345('0x22')](_0x3c515a[_0x1345('0x20')],function(_0x3cf188){return{'model':db[_0x3cf188[_0x1345('0x21')]],'as':_0x3cf188['as'],'attributes':_0x3cf188[_0x1345('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5df6a9){logger['info']('ShowMailAccount',_0x1edcdc);logger['debug'](_0x1345('0x24'),_0x1edcdc,JSON[_0x1345('0x14')](_0x5df6a9));_0x30ea62(_0x5df6a9);})[_0x1345('0x23')](function(_0x280113){logger[_0x1345('0x15')]('ShowMailAccount',_0x280113['message'],_0x1edcdc);_0x526ed1(_0x7a1680[_0x1345('0x15')](0x1f4,_0x280113[_0x1345('0x16')]));});});};exports[_0x1345('0x26')]=function(_0x3b1578){var _0x3fd09f=this;return new Promise(function(_0x1eae93,_0x5be21b){var _0xf55a78={'body':_0x3b1578[_0x1345('0x27')],'channel':_0x1345('0x28')};var _0x2c2c68=_['difference'](_[_0x1345('0x29')](db[_0x1345('0x2a')][_0x1345('0x2b')]),['createdAt',_0x1345('0x2c'),_0x1345('0x2d'),_0x1345('0x2e')]);var _0x5ef3d4=![];if(_0x3b1578[_0x1345('0x27')]['id']){delete _0x3b1578[_0x1345('0x27')]['id'];}if(_[_0x1345('0x2f')](_0x3b1578[_0x1345('0x27')][_0x1345('0x30')])){return _0x5be21b(_0x3fd09f['error'](0x1f4,_0x1345('0x31')));}if(_[_0x1345('0x2f')](_0x3b1578[_0x1345('0x27')][_0x1345('0x27')])||_0x3b1578['body'][_0x1345('0x27')]===''){return _0x5be21b(_0x3fd09f[_0x1345('0x15')](0x1f4,_0x1345('0x32')));}if(_[_0x1345('0x2f')](_0x3b1578[_0x1345('0x27')][_0x1345('0x33')])){return _0x5be21b(_0x3fd09f[_0x1345('0x15')](0x1f4,_0x1345('0x34')+_0x2c2c68));}if(!_[_0x1345('0x35')](_0x2c2c68,_0x3b1578[_0x1345('0x27')][_0x1345('0x33')])){return _0x5be21b(_0x3fd09f[_0x1345('0x15')](0x1f4,_0x1345('0x36')+_0x2c2c68));}var _0xd3bfb6={};_0xd3bfb6[_0x3b1578[_0x1345('0x27')][_0x1345('0x33')]]=_0x3b1578['body'][_0x1345('0x30')];return db[_0x1345('0x19')][_0x1345('0x25')]({'where':{'id':_0x3b1578[_0x1345('0x37')]['id']},'include':[{'model':db[_0x1345('0x38')],'as':_0x1345('0x39'),'include':[{'model':db[_0x1345('0x2a')],'as':_0x1345('0x3a'),'where':_0xd3bfb6,'limit':0x1,'order':[[_0x1345('0x2c'),_0x1345('0x3b')]]}]},{'model':db[_0x1345('0x3c')],'as':_0x1345('0x3d')},{'model':db[_0x1345('0x3e')],'as':'Smtp'}]})[_0x1345('0xf')](function(_0x54e837){if(_0x54e837&&_0x54e837[_0x1345('0x39')]){var _0x36ae3a=_0x54e837['get']({'plain':!![]});_0xf55a78[_0x1345('0x37')]=_[_0x1345('0x3f')](_0x36ae3a,[_0x1345('0x3d'),'List']);_0xf55a78['applications']=_0x36ae3a['Applications'];_0xf55a78[_0x1345('0x40')]=_0x36ae3a[_0x1345('0x39')];_0xf55a78['applications']=_[_0x1345('0x41')](_0xf55a78[_0x1345('0x42')],['priority'],[_0x1345('0x43')]);if(_0xf55a78['account']&&_0xf55a78[_0x1345('0x37')]['autoclose']){_0xf55a78[_0x1345('0x42')][_0x1345('0x44')]({'id':0x0,'priority':_0xf55a78['applications'][_0x1345('0x45')]+0x1,'app':_0x1345('0x46'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0xf55a78[_0x1345('0x37')]['Applications']){delete _0xf55a78[_0x1345('0x37')][_0x1345('0x3d')];}if(_0xf55a78[_0x1345('0x37')]['List']){delete _0xf55a78['account']['List'];}if(_0x36ae3a[_0x1345('0x39')][_0x1345('0x3a')][_0x1345('0x45')]){return _0x36ae3a[_0x1345('0x39')]['Contacts'][0x0];}var _0x257009=_['defaults'](_0x3b1578[_0x1345('0x27')],{'firstName':_0x3b1578[_0x1345('0x27')][_0x1345('0x30')],'ListId':_0x36ae3a[_0x1345('0x2e')]});_0x257009[_0x3b1578[_0x1345('0x27')][_0x1345('0x33')]]=_0x3b1578[_0x1345('0x27')][_0x1345('0x30')];return db[_0x1345('0x2a')][_0x1345('0x47')](_0x257009);}else{throw new Error('List\x20not\x20found');}})[_0x1345('0xf')](function(_0x4668c9){_0xf55a78[_0x1345('0x48')]=_0x4668c9;if(_0x4668c9){if(!_0x3b1578[_0x1345('0x27')][_0x1345('0x16')][_0x1345('0x49')]){_0x3b1578[_0x1345('0x27')][_0x1345('0x16')][_0x1345('0x49')]=rs[_0x1345('0x4a')]()+'\x20'+_0x3b1578[_0x1345('0x27')][_0x1345('0x16')][_0x1345('0x30')];}var _0x21a0a7={'ContactId':_0x4668c9['id'],'MailAccountId':_0x3b1578[_0x1345('0x37')]['id'],'inReplyTo':_0x3b1578[_0x1345('0x27')]['message'][_0x1345('0x49')],'to':_0x3b1578[_0x1345('0x27')]['message'][_0x1345('0x30')],'cc':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')]['cc'],'subject':_0x3b1578['body'][_0x1345('0x16')][_0x1345('0x4b')],'attach':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')][_0x1345('0x4c')],'lastMsgAt':moment()[_0x1345('0x4d')](_0x1345('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x3b1578[_0x1345('0x27')][_0x1345('0x27')]};return db[_0x1345('0x4f')][_0x1345('0x25')]({'where':{'closed':![],'MailAccountId':_0x3b1578[_0x1345('0x37')]['id']},'include':[{'model':db[_0x1345('0x50')],'as':_0x1345('0x51'),'attributes':['messageId'],'where':{'messageId':_0x3b1578['body']['message'][_0x1345('0x52')]}}]})[_0x1345('0xf')](function(_0x3b2d9c){if(_0x3b2d9c){return[_0x3b2d9c,![]];}return db[_0x1345('0x4f')][_0x1345('0x47')](_0x21a0a7)[_0x1345('0xf')](function(_0x442f01){return[_0x442f01,!![]];});});}else{throw new Error(_0x1345('0x53'));}})[_0x1345('0x54')](function(_0x74b3d1,_0x2c1068){if(_0x74b3d1){_0x5ef3d4=_0x2c1068;if(!_0x2c1068){return _0x74b3d1[_0x1345('0x55')]({'inReplyTo':_0x3b1578[_0x1345('0x27')]['message']['messageId'],'to':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')]['from'],'cc':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')]['cc'],'subject':_0x3b1578['body'][_0x1345('0x16')][_0x1345('0x4b')],'attach':_0x74b3d1[_0x1345('0x4c')]?_0x74b3d1[_0x1345('0x4c')]:_0x3b1578['body'][_0x1345('0x16')][_0x1345('0x4c')],'substatus':null,'substatusAt':moment()[_0x1345('0x4d')](_0x1345('0x4e')),'lastMsgAt':moment()[_0x1345('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x3b1578['body'][_0x1345('0x27')]});}else{return _0x74b3d1;}}})[_0x1345('0xf')](function(_0xd7d9b7){_0xf55a78[_0x1345('0x56')]=_0xd7d9b7['get']({'plain':!![]});_0xf55a78[_0x1345('0x56')]['created']=_0x5ef3d4;return db[_0x1345('0x50')]['create']({'body':_0x3b1578[_0x1345('0x27')][_0x1345('0x27')],'MailAccountId':_0x3b1578[_0x1345('0x37')]['id'],'MailInteractionId':_0xd7d9b7['id'],'direction':'in','ContactId':_0xf55a78['contact']['id'],'messageId':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')]['messageId'],'from':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')][_0x1345('0x30')],'to':_0x3b1578['body']['message']['to'],'cc':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')]['cc'],'subject':_0x3b1578['body'][_0x1345('0x16')]['subject'],'attach':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')][_0x1345('0x4c')],'Attachments':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')][_0x1345('0x57')],'originTo':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')]['originTo'],'originCc':_0x3b1578[_0x1345('0x27')][_0x1345('0x16')][_0x1345('0x58')],'bcc':_0x3b1578[_0x1345('0x27')]['message'][_0x1345('0x59')]},{'include':[{'model':db[_0x1345('0x5a')],'as':_0x1345('0x5b')}]});})['then'](function(_0x2ad676){_0xf55a78[_0x1345('0x16')]=_0x2ad676;if(_0xf55a78[_0x1345('0x56')][_0x1345('0x5c')]){return db[_0x1345('0x5d')][_0x1345('0x25')]({'attributes':['id','name'],'where':{'id':_0xf55a78[_0x1345('0x56')][_0x1345('0x5c')]}})['then'](function(_0x43b879){if(_0x43b879){_0xf55a78[_0x1345('0x42')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1345('0x5e'),'appdata':_0x43b879[_0x1345('0x5f')]+','+(_0xf55a78[_0x1345('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x1345('0x60')});}return respondWithRpcPromise(_0x1345('0x61'),_0x1345('0x62'),_0xf55a78);});}return respondWithRpcPromise(_0x1345('0x61'),_0x1345('0x62'),_0xf55a78);})[_0x1345('0xf')](function(_0x2f12d8){_0x1eae93(_0x2f12d8);})['catch'](function(_0x12fe22){_0x5be21b(_0x3fd09f[_0x1345('0x15')](0x1f4,_0x12fe22[_0x1345('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 246ef96..b6e9315 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 _0x9b8e=['remove','update','register','length','./mailAccount.events'];(function(_0x12d4d5,_0x26d337){var _0xb10788=function(_0x491a62){while(--_0x491a62){_0x12d4d5['push'](_0x12d4d5['shift']());}};_0xb10788(++_0x26d337);}(_0x9b8e,0x158));var _0xe9b8=function(_0x260e8e,_0x2b802f){_0x260e8e=_0x260e8e-0x0;var _0x5b6cce=_0x9b8e[_0x260e8e];return _0x5b6cce;};'use strict';var MailAccountEvents=require(_0xe9b8('0x0'));var events=['save',_0xe9b8('0x1'),_0xe9b8('0x2')];function createListener(_0x58c557,_0x523ddc){return function(_0x2ba463){_0x523ddc['emit'](_0x58c557,_0x2ba463);};}function removeListener(_0x1fb7b1,_0x175526){return function(){MailAccountEvents['removeListener'](_0x1fb7b1,_0x175526);};}exports[_0xe9b8('0x3')]=function(_0x3d24e3){for(var _0x3f6b50=0x0,_0x260234=events[_0xe9b8('0x4')];_0x3f6b50<_0x260234;_0x3f6b50++){var _0x3b67fe=events[_0x3f6b50];var _0x4fe774=createListener('mailAccount:'+_0x3b67fe,_0x3d24e3);MailAccountEvents['on'](_0x3b67fe,_0x4fe774);}}; \ No newline at end of file +var _0xc9ab=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xc9ab,0x125));var _0xbc9a=function(_0x57ebf0,_0x5739bf){_0x57ebf0=_0x57ebf0-0x0;var _0x135aa9=_0xc9ab[_0x57ebf0];return _0x135aa9;};'use strict';var MailAccountEvents=require(_0xbc9a('0x0'));var events=[_0xbc9a('0x1'),_0xbc9a('0x2'),'update'];function createListener(_0x503c08,_0x48a781){return function(_0x278d63){_0x48a781[_0xbc9a('0x3')](_0x503c08,_0x278d63);};}function removeListener(_0x23d40c,_0x33e557){return function(){MailAccountEvents[_0xbc9a('0x4')](_0x23d40c,_0x33e557);};}exports[_0xbc9a('0x5')]=function(_0x5478ec){for(var _0x4745ed=0x0,_0x477055=events[_0xbc9a('0x6')];_0x4745ed<_0x477055;_0x4745ed++){var _0x26f5f4=events[_0x4745ed];var _0x14c87a=createListener(_0xbc9a('0x7')+_0x26f5f4,_0x5478ec);MailAccountEvents['on'](_0x26f5f4,_0x14c87a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 8a32782..0a7dc65 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 _0xa571=['put','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./mailApplication.controller','/:id','isAuthenticated','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa571,0x107));var _0x1a57=function(_0x44694f,_0x3ce45b){_0x44694f=_0x44694f-0x0;var _0x2b0e70=_0xa571[_0x44694f];return _0x2b0e70;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var auth=require(_0x1a57('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1a57('0x6'));router['get'](_0x1a57('0x7'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0xa')](_0x1a57('0x7'),auth[_0x1a57('0x8')](),controller['update']);router[_0x1a57('0xb')](_0x1a57('0x7'),auth[_0x1a57('0x8')](),controller['destroy']);module[_0x1a57('0xc')]=router; \ No newline at end of file +var _0x4483=['update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put'];(function(_0x4f61a1,_0x35820b){var _0xae8b64=function(_0x4f784c){while(--_0x4f784c){_0x4f61a1['push'](_0x4f61a1['shift']());}};_0xae8b64(++_0x35820b);}(_0x4483,0x1a3));var _0x3448=function(_0x136b59,_0x4ea4d0){_0x136b59=_0x136b59-0x0;var _0x3ffda0=_0x4483[_0x136b59];return _0x3ffda0;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var auth=require(_0x3448('0x5'));var interaction=require(_0x3448('0x6'));var config=require(_0x3448('0x7'));var controller=require('./mailApplication.controller');router[_0x3448('0x8')](_0x3448('0x9'),auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0xc')](_0x3448('0x9'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['delete']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);module[_0x3448('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e62dc9c..f4ad9f4 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 _0x9ee0=['STRING','sequelize'];(function(_0x5687e5,_0x1601d1){var _0x24862a=function(_0x7688e1){while(--_0x7688e1){_0x5687e5['push'](_0x5687e5['shift']());}};_0x24862a(++_0x1601d1);}(_0x9ee0,0xb3));var _0x09ee=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x9ee0[_0x2d994d];return _0xd54be4;};'use strict';var Sequelize=require(_0x09ee('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x09ee('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x09ee('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9348=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0x9348,0x181));var _0x8934=function(_0x110aa8,_0x2dfd66){_0x110aa8=_0x110aa8-0x0;var _0x5a9f28=_0x9348[_0x110aa8];return _0x5a9f28;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'priority':{'type':Sequelize[_0x8934('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8934('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8934('0x4')]()},'description':{'type':Sequelize[_0x8934('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8934('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4e2aa4e..db40a07 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 _0xf744=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','show','params','keys','MailApplication','query','filters','intersection','attributes','model','fields','length','includeAll','merge','find','catch','body','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x36123b,_0x11d60c){var _0x50677f=function(_0x435d60){while(--_0x435d60){_0x36123b['push'](_0x36123b['shift']());}};_0x50677f(++_0x11d60c);}(_0xf744,0x66));var _0x4f74=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xf744[_0x45b034];return _0x509cb0;};'use strict';var pdf=require(_0x4f74('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4f74('0x1'));var zipdir=require(_0x4f74('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f74('0x3'));var moment=require('moment');var BPromise=require(_0x4f74('0x4'));var Mustache=require(_0x4f74('0x5'));var util=require('util');var path=require(_0x4f74('0x6'));var sox=require(_0x4f74('0x7'));var csv=require(_0x4f74('0x8'));var ejs=require(_0x4f74('0x9'));var fs=require('fs');var _=require(_0x4f74('0xa'));var squel=require(_0x4f74('0xb'));var crypto=require(_0x4f74('0xc'));var jsforce=require(_0x4f74('0xd'));var deskjs=require(_0x4f74('0xe'));var toCsv=require(_0x4f74('0x8'));var querystring=require('querystring');var Papa=require(_0x4f74('0xf'));var Redis=require(_0x4f74('0x10'));var authService=require(_0x4f74('0x11'));var qs=require(_0x4f74('0x12'));var as=require(_0x4f74('0x13'));var hardwareService=require(_0x4f74('0x14'));var logger=require(_0x4f74('0x15'))(_0x4f74('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f74('0x17'));var db=require(_0x4f74('0x18'))['db'];function respondWithStatusCode(_0x4cfd62,_0x59922d){_0x59922d=_0x59922d||0xcc;return function(_0x11a9e4){if(_0x11a9e4){return _0x4cfd62['sendStatus'](_0x59922d);}return _0x4cfd62[_0x4f74('0x19')](_0x59922d)[_0x4f74('0x1a')]();};}function respondWithResult(_0x33559f,_0x2bbff1){_0x2bbff1=_0x2bbff1||0xc8;return function(_0xd20c2f){if(_0xd20c2f){return _0x33559f[_0x4f74('0x19')](_0x2bbff1)[_0x4f74('0x1b')](_0xd20c2f);}};}function respondWithFilteredResult(_0x5c3b07,_0x1b5fe9){return function(_0x5ba918){if(_0x5ba918){var _0x54bd58=_0x5ba918[_0x4f74('0x1c')],_0x1f340b=_0x1b5fe9[_0x4f74('0x1d')],_0x3d9a76=_0x1b5fe9[_0x4f74('0x1d')]+_0x1b5fe9[_0x4f74('0x1e')],_0x1b79b6;if(_0x3d9a76>=_0x54bd58){_0x3d9a76=_0x54bd58;_0x1b79b6=0xc8;}else{_0x1b79b6=0xce;}_0x5c3b07[_0x4f74('0x19')](_0x1b79b6);return _0x5c3b07['set'](_0x4f74('0x1f'),_0x1f340b+'-'+_0x3d9a76+'/'+_0x54bd58)[_0x4f74('0x1b')](_0x5ba918);}return null;};}function patchUpdates(_0x272503){return function(_0x528b1c){try{jsonpatch[_0x4f74('0x20')](_0x528b1c,_0x272503,!![]);}catch(_0x1f37f6){return BPromise['reject'](_0x1f37f6);}return _0x528b1c[_0x4f74('0x21')]();};}function saveUpdates(_0x4ba5f7,_0x399432){return function(_0x5bd958){if(_0x5bd958){return _0x5bd958[_0x4f74('0x22')](_0x4ba5f7)['then'](function(_0x10ee58){return _0x10ee58;});}return null;};}function removeEntity(_0x27607e,_0x37d746){return function(_0x476f56){if(_0x476f56){return _0x476f56[_0x4f74('0x23')]()[_0x4f74('0x24')](function(){_0x27607e[_0x4f74('0x19')](0xcc)[_0x4f74('0x1a')]();});}};}function handleEntityNotFound(_0x4ea0d3,_0x71d72d){return function(_0x37d2d1){if(!_0x37d2d1){_0x4ea0d3[_0x4f74('0x25')](0x194);}return _0x37d2d1;};}function handleError(_0x135e50,_0x59928f){_0x59928f=_0x59928f||0x1f4;return function(_0x1b9e97){logger[_0x4f74('0x26')](_0x1b9e97['stack']);if(_0x1b9e97[_0x4f74('0x27')]){delete _0x1b9e97[_0x4f74('0x27')];}_0x135e50[_0x4f74('0x19')](_0x59928f)['send'](_0x1b9e97);};}exports[_0x4f74('0x28')]=function(_0x15119a,_0x438cc6){var _0x4491f4={'raw':!![],'where':{'id':_0x15119a[_0x4f74('0x29')]['id']}},_0xc72e99={};_0xc72e99['model']=_[_0x4f74('0x2a')](db[_0x4f74('0x2b')]['rawAttributes']);_0xc72e99[_0x4f74('0x2c')]=_[_0x4f74('0x2a')](_0x15119a['query']);_0xc72e99[_0x4f74('0x2d')]=_[_0x4f74('0x2e')](_0xc72e99['model'],_0xc72e99[_0x4f74('0x2c')]);_0x4491f4[_0x4f74('0x2f')]=_['intersection'](_0xc72e99[_0x4f74('0x30')],qs[_0x4f74('0x31')](_0x15119a['query']['fields']));_0x4491f4[_0x4f74('0x2f')]=_0x4491f4[_0x4f74('0x2f')][_0x4f74('0x32')]?_0x4491f4['attributes']:_0xc72e99[_0x4f74('0x30')];if(_0x15119a[_0x4f74('0x2c')][_0x4f74('0x33')]){_0x4491f4['include']=[{'all':!![]}];}_0x4491f4=_[_0x4f74('0x34')]({},_0x4491f4,_0x15119a['options']);return db['MailApplication'][_0x4f74('0x35')](_0x4491f4)[_0x4f74('0x24')](handleEntityNotFound(_0x438cc6,null))[_0x4f74('0x24')](respondWithResult(_0x438cc6,null))[_0x4f74('0x36')](handleError(_0x438cc6,null));};exports[_0x4f74('0x22')]=function(_0x1a8083,_0x14771d){if(_0x1a8083['body']['id']){delete _0x1a8083[_0x4f74('0x37')]['id'];}return db[_0x4f74('0x2b')]['find']({'where':{'id':_0x1a8083[_0x4f74('0x29')]['id']}})[_0x4f74('0x24')](handleEntityNotFound(_0x14771d,null))[_0x4f74('0x24')](saveUpdates(_0x1a8083[_0x4f74('0x37')],null))[_0x4f74('0x24')](respondWithResult(_0x14771d,null))[_0x4f74('0x36')](handleError(_0x14771d,null));};exports['destroy']=function(_0x2628fa,_0x2749dc){return db[_0x4f74('0x2b')]['find']({'where':{'id':_0x2628fa[_0x4f74('0x29')]['id']}})[_0x4f74('0x24')](handleEntityNotFound(_0x2749dc,null))[_0x4f74('0x24')](removeEntity(_0x2749dc,null))['catch'](handleError(_0x2749dc,null));}; \ No newline at end of file +var _0x667a=['options','find','catch','update','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','destroy','then','sendStatus','error','stack','send','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','includeAll','include'];(function(_0x3c0661,_0x527afb){var _0x47f6a8=function(_0x1cc5e3){while(--_0x1cc5e3){_0x3c0661['push'](_0x3c0661['shift']());}};_0x47f6a8(++_0x527afb);}(_0x667a,0x1c5));var _0xa667=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x667a[_0xd0b415];return _0x2bdf2c;};'use strict';var pdf=require(_0xa667('0x0'));var emlformat=require(_0xa667('0x1'));var rimraf=require(_0xa667('0x2'));var zipdir=require(_0xa667('0x3'));var jsonpatch=require(_0xa667('0x4'));var rp=require(_0xa667('0x5'));var moment=require(_0xa667('0x6'));var BPromise=require(_0xa667('0x7'));var Mustache=require(_0xa667('0x8'));var util=require(_0xa667('0x9'));var path=require('path');var sox=require(_0xa667('0xa'));var csv=require(_0xa667('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa667('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa667('0xd'));var deskjs=require(_0xa667('0xe'));var toCsv=require(_0xa667('0xb'));var querystring=require(_0xa667('0xf'));var Papa=require('papaparse');var Redis=require(_0xa667('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa667('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa667('0x12'));var logger=require(_0xa667('0x13'))(_0xa667('0x14'));var utils=require(_0xa667('0x15'));var config=require(_0xa667('0x16'));var licenseUtil=require(_0xa667('0x17'));var db=require(_0xa667('0x18'))['db'];function respondWithStatusCode(_0x18234e,_0x20602a){_0x20602a=_0x20602a||0xcc;return function(_0x2c52a2){if(_0x2c52a2){return _0x18234e['sendStatus'](_0x20602a);}return _0x18234e[_0xa667('0x19')](_0x20602a)[_0xa667('0x1a')]();};}function respondWithResult(_0x52f1af,_0x33108a){_0x33108a=_0x33108a||0xc8;return function(_0x403326){if(_0x403326){return _0x52f1af['status'](_0x33108a)[_0xa667('0x1b')](_0x403326);}};}function respondWithFilteredResult(_0x1e00fa,_0x47449d){return function(_0x47e292){if(_0x47e292){var _0x231efb=_0x47e292[_0xa667('0x1c')],_0x18284b=_0x47449d[_0xa667('0x1d')],_0xc2b290=_0x47449d[_0xa667('0x1d')]+_0x47449d[_0xa667('0x1e')],_0x2887ed;if(_0xc2b290>=_0x231efb){_0xc2b290=_0x231efb;_0x2887ed=0xc8;}else{_0x2887ed=0xce;}_0x1e00fa[_0xa667('0x19')](_0x2887ed);return _0x1e00fa['set']('Content-Range',_0x18284b+'-'+_0xc2b290+'/'+_0x231efb)[_0xa667('0x1b')](_0x47e292);}return null;};}function patchUpdates(_0x2461c4){return function(_0x1eb80e){try{jsonpatch[_0xa667('0x1f')](_0x1eb80e,_0x2461c4,!![]);}catch(_0x40d5ad){return BPromise[_0xa667('0x20')](_0x40d5ad);}return _0x1eb80e[_0xa667('0x21')]();};}function saveUpdates(_0x129b7c,_0x5b6359){return function(_0x2b8596){if(_0x2b8596){return _0x2b8596['update'](_0x129b7c)['then'](function(_0x430d42){return _0x430d42;});}return null;};}function removeEntity(_0x1ec141,_0x541b6c){return function(_0x39ac55){if(_0x39ac55){return _0x39ac55[_0xa667('0x22')]()[_0xa667('0x23')](function(){_0x1ec141[_0xa667('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5642d9,_0x4b26b1){return function(_0x667e6){if(!_0x667e6){_0x5642d9[_0xa667('0x24')](0x194);}return _0x667e6;};}function handleError(_0x39f771,_0x1d911c){_0x1d911c=_0x1d911c||0x1f4;return function(_0x5e97e4){logger[_0xa667('0x25')](_0x5e97e4[_0xa667('0x26')]);if(_0x5e97e4['name']){delete _0x5e97e4['name'];}_0x39f771['status'](_0x1d911c)[_0xa667('0x27')](_0x5e97e4);};}exports['show']=function(_0x44d410,_0x6d514e){var _0x4a8635={'raw':!![],'where':{'id':_0x44d410[_0xa667('0x28')]['id']}},_0x1d6c80={};_0x1d6c80[_0xa667('0x29')]=_[_0xa667('0x2a')](db[_0xa667('0x2b')][_0xa667('0x2c')]);_0x1d6c80['query']=_[_0xa667('0x2a')](_0x44d410['query']);_0x1d6c80['filters']=_['intersection'](_0x1d6c80[_0xa667('0x29')],_0x1d6c80[_0xa667('0x2d')]);_0x4a8635[_0xa667('0x2e')]=_[_0xa667('0x2f')](_0x1d6c80[_0xa667('0x29')],qs[_0xa667('0x30')](_0x44d410['query'][_0xa667('0x30')]));_0x4a8635['attributes']=_0x4a8635['attributes']['length']?_0x4a8635[_0xa667('0x2e')]:_0x1d6c80[_0xa667('0x29')];if(_0x44d410['query'][_0xa667('0x31')]){_0x4a8635[_0xa667('0x32')]=[{'all':!![]}];}_0x4a8635=_['merge']({},_0x4a8635,_0x44d410[_0xa667('0x33')]);return db['MailApplication'][_0xa667('0x34')](_0x4a8635)[_0xa667('0x23')](handleEntityNotFound(_0x6d514e,null))[_0xa667('0x23')](respondWithResult(_0x6d514e,null))[_0xa667('0x35')](handleError(_0x6d514e,null));};exports[_0xa667('0x36')]=function(_0x5786c7,_0x274851){if(_0x5786c7[_0xa667('0x37')]['id']){delete _0x5786c7[_0xa667('0x37')]['id'];}return db[_0xa667('0x2b')][_0xa667('0x34')]({'where':{'id':_0x5786c7['params']['id']}})[_0xa667('0x23')](handleEntityNotFound(_0x274851,null))[_0xa667('0x23')](saveUpdates(_0x5786c7[_0xa667('0x37')],null))[_0xa667('0x23')](respondWithResult(_0x274851,null))['catch'](handleError(_0x274851,null));};exports[_0xa667('0x22')]=function(_0x2d753e,_0xf88ddd){return db['MailApplication'][_0xa667('0x34')]({'where':{'id':_0x2d753e['params']['id']}})[_0xa667('0x23')](handleEntityNotFound(_0xf88ddd,null))['then'](removeEntity(_0xf88ddd,null))['catch'](handleError(_0xf88ddd,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 8140731..81c8d1f 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 _0x3588=['exports','define','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x3588,0x82));var _0x8358=function(_0x4befae,_0x55b079){_0x4befae=_0x4befae-0x0;var _0x76c573=_0x3588[_0x4befae];return _0x76c573;};'use strict';var _=require(_0x8358('0x0'));var util=require(_0x8358('0x1'));var logger=require(_0x8358('0x2'))(_0x8358('0x3'));var moment=require(_0x8358('0x4'));var BPromise=require(_0x8358('0x5'));var rp=require(_0x8358('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8358('0x7'));var config=require(_0x8358('0x8'));var attributes=require(_0x8358('0x9'));module[_0x8358('0xa')]=function(_0x483bf0,_0x15dc94){return _0x483bf0[_0x8358('0xb')]('MailApplication',attributes,{'tableName':_0x8358('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8358('0xd')});}; \ No newline at end of file +var _0x1eba=['exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailApplication.attributes'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x1eba,0x1d7));var _0xa1eb=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x1eba[_0xffa198];return _0x1e4b50;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var logger=require(_0xa1eb('0x2'))(_0xa1eb('0x3'));var moment=require(_0xa1eb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa1eb('0x5'));var rimraf=require(_0xa1eb('0x6'));var config=require(_0xa1eb('0x7'));var attributes=require(_0xa1eb('0x8'));module[_0xa1eb('0x9')]=function(_0x2933d0,_0x1d0d67){return _0x2933d0[_0xa1eb('0xa')](_0xa1eb('0xb'),attributes,{'tableName':_0xa1eb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa1eb('0xd'),'collate':_0xa1eb('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 91b5e2f..72a06d4 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 _0x7dd6=['client','http','then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','result','UpdateMailApplication','MailApplication','update','options','where','limit','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ebce4,_0x2ed7ae){var _0x1050bd=function(_0x4cb290){while(--_0x4cb290){_0x1ebce4['push'](_0x1ebce4['shift']());}};_0x1050bd(++_0x2ed7ae);}(_0x7dd6,0x8f));var _0x67dd=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x7dd6[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0x67dd('0x0'));var util=require(_0x67dd('0x1'));var moment=require(_0x67dd('0x2'));var BPromise=require(_0x67dd('0x3'));var rs=require(_0x67dd('0x4'));var fs=require('fs');var Redis=require(_0x67dd('0x5'));var db=require(_0x67dd('0x6'))['db'];var utils=require(_0x67dd('0x7'));var logger=require(_0x67dd('0x8'))(_0x67dd('0x9'));var config=require(_0x67dd('0xa'));var jayson=require(_0x67dd('0xb'));var client=jayson[_0x67dd('0xc')][_0x67dd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1ad772,_0x279460,_0xdfa0e2){return new BPromise(function(_0x164785,_0x280e34){return client['request'](_0x1ad772,_0xdfa0e2)[_0x67dd('0xe')](function(_0x3a44e3){logger['info']('MailApplication,\x20%s,\x20%s',_0x279460,_0x67dd('0xf'));logger[_0x67dd('0x10')](_0x67dd('0x11'),_0x279460,'request\x20sent',JSON['stringify'](_0x3a44e3));if(_0x3a44e3['error']){if(_0x3a44e3[_0x67dd('0x12')][_0x67dd('0x13')]===0x1f4){logger['error'](_0x67dd('0x14'),_0x279460,_0x3a44e3['error'][_0x67dd('0x15')]);return _0x280e34(_0x3a44e3[_0x67dd('0x12')][_0x67dd('0x15')]);}logger['error'](_0x67dd('0x14'),_0x279460,_0x3a44e3[_0x67dd('0x12')]['message']);return _0x164785(_0x3a44e3[_0x67dd('0x12')][_0x67dd('0x15')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x279460,_0x67dd('0xf'));_0x164785(_0x3a44e3[_0x67dd('0x16')][_0x67dd('0x15')]);}})['catch'](function(_0x2c74db){logger[_0x67dd('0x12')]('MailApplication,\x20%s,\x20%s',_0x279460,_0x2c74db);_0x280e34(_0x2c74db);});});}exports[_0x67dd('0x17')]=function(_0x2d8a6c){var _0x1bd06b=this;return new Promise(function(_0xd9fd48,_0x21ccff){return db[_0x67dd('0x18')][_0x67dd('0x19')](_0x2d8a6c['body'],{'raw':_0x2d8a6c[_0x67dd('0x1a')]?_0x2d8a6c[_0x67dd('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d8a6c['options']?_0x2d8a6c[_0x67dd('0x1a')][_0x67dd('0x1b')]||null:null,'attributes':_0x2d8a6c[_0x67dd('0x1a')]?_0x2d8a6c['options']['attributes']||null:null,'limit':_0x2d8a6c[_0x67dd('0x1a')]?_0x2d8a6c[_0x67dd('0x1a')][_0x67dd('0x1c')]||null:null})['then'](function(_0x5c7e67){logger['info']('UpdateMailApplication',_0x2d8a6c);logger[_0x67dd('0x10')](_0x67dd('0x17'),_0x2d8a6c,JSON[_0x67dd('0x1d')](_0x5c7e67));_0xd9fd48(_0x5c7e67);})[_0x67dd('0x1e')](function(_0x1889ad){logger['error']('UpdateMailApplication',_0x1889ad[_0x67dd('0x15')],_0x2d8a6c);_0x21ccff(_0x1bd06b[_0x67dd('0x12')](0x1f4,_0x1889ad[_0x67dd('0x15')]));});});}; \ No newline at end of file +var _0x6596=['message','result','catch','MailApplication','options','where','attributes','limit','debug','UpdateMailApplication','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x6596,0x176));var _0x6659=function(_0x20a21d,_0x5751bc){_0x20a21d=_0x20a21d-0x0;var _0x5667aa=_0x6596[_0x20a21d];return _0x5667aa;};'use strict';var _=require(_0x6659('0x0'));var util=require(_0x6659('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6659('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6659('0x3'))['db'];var utils=require(_0x6659('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6659('0x5'));var jayson=require(_0x6659('0x6'));var client=jayson[_0x6659('0x7')][_0x6659('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x158cd4,_0xd26d94,_0x5366cc){return new BPromise(function(_0x116817,_0x51a0d8){return client[_0x6659('0x9')](_0x158cd4,_0x5366cc)[_0x6659('0xa')](function(_0x32c749){logger[_0x6659('0xb')](_0x6659('0xc'),_0xd26d94,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0xd26d94,_0x6659('0xd'),JSON[_0x6659('0xe')](_0x32c749));if(_0x32c749[_0x6659('0xf')]){if(_0x32c749['error']['code']===0x1f4){logger[_0x6659('0xf')](_0x6659('0xc'),_0xd26d94,_0x32c749[_0x6659('0xf')]['message']);return _0x51a0d8(_0x32c749[_0x6659('0xf')]['message']);}logger[_0x6659('0xf')]('MailApplication,\x20%s,\x20%s',_0xd26d94,_0x32c749[_0x6659('0xf')][_0x6659('0x10')]);return _0x116817(_0x32c749[_0x6659('0xf')][_0x6659('0x10')]);}else{logger[_0x6659('0xb')]('MailApplication,\x20%s,\x20%s',_0xd26d94,_0x6659('0xd'));_0x116817(_0x32c749[_0x6659('0x11')][_0x6659('0x10')]);}})[_0x6659('0x12')](function(_0xadd66){logger[_0x6659('0xf')]('MailApplication,\x20%s,\x20%s',_0xd26d94,_0xadd66);_0x51a0d8(_0xadd66);});});}exports['UpdateMailApplication']=function(_0x5cce23){var _0x4052ac=this;return new Promise(function(_0x1c75d5,_0x1fe378){return db[_0x6659('0x13')]['update'](_0x5cce23['body'],{'raw':_0x5cce23[_0x6659('0x14')]?_0x5cce23[_0x6659('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cce23[_0x6659('0x14')]?_0x5cce23[_0x6659('0x14')][_0x6659('0x15')]||null:null,'attributes':_0x5cce23['options']?_0x5cce23['options'][_0x6659('0x16')]||null:null,'limit':_0x5cce23['options']?_0x5cce23[_0x6659('0x14')][_0x6659('0x17')]||null:null})[_0x6659('0xa')](function(_0xb8c9ff){logger[_0x6659('0xb')]('UpdateMailApplication',_0x5cce23);logger[_0x6659('0x18')]('UpdateMailApplication',_0x5cce23,JSON['stringify'](_0xb8c9ff));_0x1c75d5(_0xb8c9ff);})[_0x6659('0x12')](function(_0x4a2c95){logger[_0x6659('0xf')](_0x6659('0x19'),_0x4a2c95[_0x6659('0x10')],_0x5cce23);_0x1fe378(_0x4052ac['error'](0x1f4,_0x4a2c95[_0x6659('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 40b6468..206919f 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 _0x59c3=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags'];(function(_0x218219,_0x3d30ef){var _0x3cdebb=function(_0x410455){while(--_0x410455){_0x218219['push'](_0x218219['shift']());}};_0x3cdebb(++_0x3d30ef);}(_0x59c3,0x133));var _0x359c=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x59c3[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var path=require(_0x359c('0x2'));var timeout=require(_0x359c('0x3'));var express=require(_0x359c('0x4'));var router=express[_0x359c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x359c('0x6'));var config=require(_0x359c('0x7'));var controller=require(_0x359c('0x8'));router[_0x359c('0x9')]('/',auth[_0x359c('0xa')](),controller[_0x359c('0xb')]);router['get'](_0x359c('0xc'),auth['isAuthenticated'](),controller[_0x359c('0xd')]);router[_0x359c('0x9')](_0x359c('0xe'),auth[_0x359c('0xa')](),controller['show']);router[_0x359c('0x9')]('/:id/messages',auth[_0x359c('0xa')](),controller[_0x359c('0xf')]);router[_0x359c('0x9')](_0x359c('0x10'),auth[_0x359c('0xa')](),controller[_0x359c('0x11')]);router['post']('/',auth[_0x359c('0xa')](),controller[_0x359c('0x12')]);router[_0x359c('0x13')](_0x359c('0x14'),auth[_0x359c('0xa')](),controller[_0x359c('0x15')]);router[_0x359c('0x13')](_0x359c('0x16'),auth[_0x359c('0xa')](),interaction[_0x359c('0x17')](_0x359c('0x18'),_0x359c('0x19')),controller['addTags']);router[_0x359c('0x1a')](_0x359c('0xe'),auth['isAuthenticated'](),interaction[_0x359c('0x17')](_0x359c('0x18'),_0x359c('0x1b')),controller[_0x359c('0x1c')]);router[_0x359c('0x1d')](_0x359c('0xe'),auth[_0x359c('0xa')](),interaction[_0x359c('0x17')](_0x359c('0x18'),_0x359c('0x1e')),controller[_0x359c('0x1f')]);router[_0x359c('0x1d')](_0x359c('0x16'),auth[_0x359c('0xa')](),controller[_0x359c('0x20')]);module[_0x359c('0x21')]=router; \ No newline at end of file +var _0xb492=['update','delete','mail','mailinteraction:destroy','destroy','removeTags','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','create','/:id/tags','mailinteraction:addtags','addTags','put','tracked'];(function(_0x49f308,_0x1d0437){var _0x160dd6=function(_0x2c4c43){while(--_0x2c4c43){_0x49f308['push'](_0x49f308['shift']());}};_0x160dd6(++_0x1d0437);}(_0xb492,0x172));var _0x2b49=function(_0x41241d,_0x49ef91){_0x41241d=_0x41241d-0x0;var _0x5e2306=_0xb492[_0x41241d];return _0x5e2306;};'use strict';var multer=require('multer');var util=require(_0x2b49('0x0'));var path=require(_0x2b49('0x1'));var timeout=require(_0x2b49('0x2'));var express=require(_0x2b49('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2b49('0x4'));var config=require(_0x2b49('0x5'));var controller=require(_0x2b49('0x6'));router[_0x2b49('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2b49('0x7')](_0x2b49('0x8'),auth[_0x2b49('0x9')](),controller[_0x2b49('0xa')]);router[_0x2b49('0x7')](_0x2b49('0xb'),auth[_0x2b49('0x9')](),controller[_0x2b49('0xc')]);router['get'](_0x2b49('0xd'),auth[_0x2b49('0x9')](),controller['getMessages']);router[_0x2b49('0x7')](_0x2b49('0xe'),auth[_0x2b49('0x9')](),controller['download']);router[_0x2b49('0xf')]('/',auth[_0x2b49('0x9')](),controller[_0x2b49('0x10')]);router[_0x2b49('0xf')](_0x2b49('0xd'),auth[_0x2b49('0x9')](),controller['addMessage']);router['post'](_0x2b49('0x11'),auth[_0x2b49('0x9')](),interaction['tracked']('mail',_0x2b49('0x12')),controller[_0x2b49('0x13')]);router[_0x2b49('0x14')]('/:id',auth[_0x2b49('0x9')](),interaction[_0x2b49('0x15')]('mail','mailinteraction:update'),controller[_0x2b49('0x16')]);router[_0x2b49('0x17')](_0x2b49('0xb'),auth[_0x2b49('0x9')](),interaction[_0x2b49('0x15')](_0x2b49('0x18'),_0x2b49('0x19')),controller[_0x2b49('0x1a')]);router[_0x2b49('0x17')](_0x2b49('0x11'),auth['isAuthenticated'](),controller[_0x2b49('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 16df7b5..0f64bf7 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 _0x0474=['long','ENUM','out','iconv','exports','BOOLEAN','DATE','STRING','TEXT'];(function(_0x698207,_0x490d94){var _0x5bd1bc=function(_0x413640){while(--_0x413640){_0x698207['push'](_0x698207['shift']());}};_0x5bd1bc(++_0x490d94);}(_0x0474,0xa5));var _0x4047=function(_0x11c7fc,_0x517fef){_0x11c7fc=_0x11c7fc-0x0;var _0x4859bc=_0x0474[_0x11c7fc];return _0x4859bc;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x4047('0x0'));module[_0x4047('0x1')]={'closed':{'type':Sequelize[_0x4047('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4047('0x3')]},'disposition':{'type':Sequelize[_0x4047('0x4')]},'secondDisposition':{'type':Sequelize[_0x4047('0x4')]},'thirdDisposition':{'type':Sequelize[_0x4047('0x4')]},'note':{'type':Sequelize[_0x4047('0x4')]},'inReplyTo':{'type':Sequelize[_0x4047('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4047('0x5')](_0x4047('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x4047('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x4047('0x3')]},'substatus':{'type':Sequelize[_0x4047('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x4047('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x4047('0x7')]('in',_0x4047('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4047('0x7')]('in',_0x4047('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x4047('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0x4047('0x5')](_0x4047('0x6'))}}; \ No newline at end of file +var _0x3aec=['exports','BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv'];(function(_0x387f45,_0x324950){var _0x3c34d5=function(_0x308f8c){while(--_0x308f8c){_0x387f45['push'](_0x387f45['shift']());}};_0x3c34d5(++_0x324950);}(_0x3aec,0xe4));var _0xc3ae=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x3aec[_0x420513];return _0x1b44ec;};'use strict';var Sequelize=require(_0xc3ae('0x0'));var iconv=require(_0xc3ae('0x1'));module[_0xc3ae('0x2')]={'closed':{'type':Sequelize[_0xc3ae('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc3ae('0x4')]},'disposition':{'type':Sequelize[_0xc3ae('0x5')]},'secondDisposition':{'type':Sequelize[_0xc3ae('0x5')]},'thirdDisposition':{'type':Sequelize[_0xc3ae('0x5')]},'note':{'type':Sequelize[_0xc3ae('0x5')]},'inReplyTo':{'type':Sequelize[_0xc3ae('0x5')](0x1fe)},'to':{'type':Sequelize[_0xc3ae('0x5')]},'cc':{'type':Sequelize[_0xc3ae('0x6')](_0xc3ae('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xc3ae('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xc3ae('0x4')]},'substatus':{'type':Sequelize[_0xc3ae('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xc3ae('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc3ae('0x8')]('in',_0xc3ae('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc3ae('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xc3ae('0x6')](_0xc3ae('0x7'))},'lastMsgText':{'type':Sequelize[_0xc3ae('0x6')](_0xc3ae('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index bff8b2e..540eb43 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 _0x634b=['filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','MailAccountId','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','a.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','contactName','i.updatedAt','i.attach','i.subject','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','rows','show','includeAll','include','options','find','create','body','params','describe','MailMessage','addMessage','ids','omit','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','mailInteractionTags:save','removeTags','unix','join','root','server','files','attachments','Attachments','Messages','bcc','createdAt','get','mkdirSync','each','subject','headers','Bcc','existsSync','build','writeFileSync','message%d.eml','download','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','html-to-text','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','sendStatus','status','end','count','offset','limit','json','apply','save','update','then','destroy','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','findOne','lastMsgBody','lastMsgText','fromString','catch','index','MailInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','tools_tags','expr','search','conditions','unreadMessages','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','plainBody','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','$gte','parse','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray'];(function(_0xd19694,_0x307428){var _0x47e07f=function(_0x39ad16){while(--_0x39ad16){_0xd19694['push'](_0xd19694['shift']());}};_0x47e07f(++_0x307428);}(_0x634b,0x66));var _0xb634=function(_0x50c6ea,_0x5e8fe1){_0x50c6ea=_0x50c6ea-0x0;var _0x3e1b76=_0x634b[_0x50c6ea];return _0x3e1b76;};'use strict';var pdf=require(_0xb634('0x0'));var emlformat=require(_0xb634('0x1'));var rimraf=require(_0xb634('0x2'));var zipdir=require(_0xb634('0x3'));var jsonpatch=require(_0xb634('0x4'));var rp=require('request-promise');var moment=require(_0xb634('0x5'));var BPromise=require(_0xb634('0x6'));var Mustache=require(_0xb634('0x7'));var util=require(_0xb634('0x8'));var path=require(_0xb634('0x9'));var sox=require(_0xb634('0xa'));var csv=require(_0xb634('0xb'));var ejs=require(_0xb634('0xc'));var fs=require('fs');var _=require(_0xb634('0xd'));var squel=require(_0xb634('0xe'));var crypto=require('crypto');var jsforce=require(_0xb634('0xf'));var deskjs=require(_0xb634('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0xb634('0x11'));var Redis=require(_0xb634('0x12'));var authService=require(_0xb634('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb634('0x14'));var hardwareService=require(_0xb634('0x15'));var logger=require('../../config/logger')(_0xb634('0x16'));var utils=require(_0xb634('0x17'));var config=require(_0xb634('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb634('0x19'))['db'];config[_0xb634('0x1a')]=_['defaults'](config[_0xb634('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb634('0x1b'))(new Redis(config[_0xb634('0x1a')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x38d017,_0x1e176e){_0x1e176e=_0x1e176e||0xcc;return function(_0x4ce4e4){if(_0x4ce4e4){return _0x38d017[_0xb634('0x1c')](_0x1e176e);}return _0x38d017[_0xb634('0x1d')](_0x1e176e)[_0xb634('0x1e')]();};}function respondWithResult(_0x51b0e9,_0x5b6d32){_0x5b6d32=_0x5b6d32||0xc8;return function(_0x246056){if(_0x246056){return _0x51b0e9['status'](_0x5b6d32)['json'](_0x246056);}};}function respondWithFilteredResult(_0x10db58,_0x9543c1){return function(_0x496d11){if(_0x496d11){var _0x3f729c=_0x496d11[_0xb634('0x1f')],_0x4e21f5=_0x9543c1[_0xb634('0x20')],_0x5d3990=_0x9543c1[_0xb634('0x20')]+_0x9543c1[_0xb634('0x21')],_0x1d4c84;if(_0x5d3990>=_0x3f729c){_0x5d3990=_0x3f729c;_0x1d4c84=0xc8;}else{_0x1d4c84=0xce;}_0x10db58[_0xb634('0x1d')](_0x1d4c84);return _0x10db58['set']('Content-Range',_0x4e21f5+'-'+_0x5d3990+'/'+_0x3f729c)[_0xb634('0x22')](_0x496d11);}return null;};}function patchUpdates(_0x5e61ae){return function(_0x465252){try{jsonpatch[_0xb634('0x23')](_0x465252,_0x5e61ae,!![]);}catch(_0x1e58d5){return BPromise['reject'](_0x1e58d5);}return _0x465252[_0xb634('0x24')]();};}function saveUpdates(_0x8c66eb,_0x5ac5ab){return function(_0x13a9fb){if(_0x13a9fb){return _0x13a9fb[_0xb634('0x25')](_0x8c66eb)[_0xb634('0x26')](function(_0x55b9eb){return _0x55b9eb;});}return null;};}function removeEntity(_0x2efad5,_0x5ce1ff){return function(_0x448ae4){if(_0x448ae4){return _0x448ae4[_0xb634('0x27')]()[_0xb634('0x26')](function(){_0x2efad5[_0xb634('0x1d')](0xcc)[_0xb634('0x1e')]();});}};}function handleEntityNotFound(_0x413d8d,_0x5d81dc){return function(_0x176d23){if(!_0x176d23){_0x413d8d[_0xb634('0x1c')](0x194);}return _0x176d23;};}function handleError(_0xdc038a,_0x314835){_0x314835=_0x314835||0x1f4;return function(_0x17ba95){logger[_0xb634('0x28')](_0x17ba95['stack']);if(_0x17ba95[_0xb634('0x29')]){delete _0x17ba95[_0xb634('0x29')];}_0xdc038a['status'](_0x314835)[_0xb634('0x2a')](_0x17ba95);};}function getInteractionUsers(_0x2ad658,_0x128796){return new BPromise(function(_0x45fd72,_0x2a90f7){try{if(_0x128796[_0x2ad658['id']]){_0x2ad658[_0xb634('0x2b')]=_[_0xb634('0x2c')](_0x128796[_0x2ad658['id']],function(_0x54044d){return{'id':_0x54044d['id'],'fullname':_0x54044d[_0xb634('0x2d')]};});}}catch(_0x433ed5){_0x2a90f7(_0x433ed5);}_0x45fd72(_0x2ad658);});}function getInteractionTags(_0x142207,_0x935bdb){return new BPromise(function(_0x3a115b,_0x34de52){try{if(_0x142207[_0xb634('0x2e')]){_0x142207[_0xb634('0x2f')]=[];_0x142207['TagIds'][_0xb634('0x30')](',')[_0xb634('0x31')](function(_0x220e57){_0x142207[_0xb634('0x2f')][_0xb634('0x32')](_0x935bdb[_0x220e57]);});}delete _0x142207[_0xb634('0x2e')];}catch(_0x404d5b){_0x34de52(_0x404d5b);}_0x3a115b(_0x142207);});}function getLastMessageText(_0x2e602a){return new BPromise(function(_0x50ae76,_0x18ed18){return db['MailInteraction'][_0xb634('0x33')]({'where':{'id':_0x2e602a['id']},'attributes':[_0xb634('0x34'),_0xb634('0x35')],'raw':!![]})[_0xb634('0x26')](function(_0x1cb5f5){if(!_0x1cb5f5['lastMsgText']){_0x2e602a[_0xb634('0x35')]=_['trimStart'](htmlToText[_0xb634('0x36')](_0x1cb5f5[_0xb634('0x34')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2e602a['lastMsgText']=_0x1cb5f5['lastMsgText'];}_0x50ae76(_0x2e602a);})[_0xb634('0x37')](function(_0x4b55b3){_0x18ed18(_0x4b55b3);});});}function updateMailInteraction(_0x55c5f0,_0x507064,_0x736769,_0x55d16a){return new BPromise(function(_0x4c6956,_0xca1b48){return getInteractionUsers(_0x55c5f0,_0x736769)['then'](function(_0x466934){return getInteractionTags(_0x466934,_0x507064);})[_0xb634('0x26')](function(_0x1b3f0c){if(_0x55d16a){_0x4c6956(getLastMessageText(_0x1b3f0c));}else{_0x4c6956(_0x1b3f0c);}})[_0xb634('0x37')](function(_0x4a758a){_0xca1b48(_0x4a758a);});});}exports[_0xb634('0x38')]=function(_0x2a8529,_0x34ad49){var _0x301ecd={},_0x2f04c7={},_0x3dede3={'count':0x0,'rows':[]};var _0x3c53d6=_['map'](db[_0xb634('0x39')][_0xb634('0x3a')],function(_0x4abfdc){return{'name':_0x4abfdc[_0xb634('0x3b')],'type':_0x4abfdc[_0xb634('0x3c')]['key']};});_0x2f04c7[_0xb634('0x3d')]=_[_0xb634('0x2c')](_0x3c53d6,_0xb634('0x29'));_0x2f04c7[_0xb634('0x3e')]=_[_0xb634('0x3f')](_0x2a8529[_0xb634('0x3e')]);_0x2f04c7[_0xb634('0x40')]=_[_0xb634('0x41')](_0x2f04c7[_0xb634('0x3d')],_0x2f04c7[_0xb634('0x3e')]);_0x301ecd[_0xb634('0x42')]=_[_0xb634('0x41')](_0x2f04c7[_0xb634('0x3d')],qs[_0xb634('0x43')](_0x2a8529['query'][_0xb634('0x43')]));_0x301ecd['attributes']=_0x301ecd[_0xb634('0x42')][_0xb634('0x44')]?_0x301ecd[_0xb634('0x42')]:_0x2f04c7[_0xb634('0x3d')];if(!_0x2a8529[_0xb634('0x3e')][_0xb634('0x45')](_0xb634('0x46'))){_0x301ecd[_0xb634('0x21')]=qs[_0xb634('0x21')](_0x2a8529[_0xb634('0x3e')][_0xb634('0x21')]);_0x301ecd[_0xb634('0x20')]=qs['offset'](_0x2a8529['query']['offset']);}_0x301ecd['order']=qs[_0xb634('0x47')](_0x2a8529[_0xb634('0x3e')]['sort']);_0x301ecd[_0xb634('0x48')]=qs[_0xb634('0x40')](_[_0xb634('0x49')](_0x2a8529[_0xb634('0x3e')],_0x2f04c7[_0xb634('0x40')]),_0x3c53d6);var _0x251e71=[];var _0xa9e4ed=squel[_0xb634('0x4a')]()[_0xb634('0x4b')]('id')[_0xb634('0x4b')](_0xb634('0x29'))[_0xb634('0x4b')](_0xb634('0x4c'))[_0xb634('0x4d')]('tools_tags');var _0x126cd1=squel[_0xb634('0x4a')]()[_0xb634('0x4b')]('u.id')[_0xb634('0x4b')](_0xb634('0x4e'))[_0xb634('0x4b')](_0xb634('0x4f'))['from'](_0xb634('0x50'),'ui')[_0xb634('0x51')](_0xb634('0x52'),'u','u.id\x20=\x20ui.UserId');var _0xda0caf=squel[_0xb634('0x4a')]()['from'](_0xb634('0x53'),'i')['left_join'](_0xb634('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xb634('0x52'),'o',_0xb634('0x55'))[_0xb634('0x51')](_0xb634('0x56'),'a','a.id\x20=\x20i.MailAccountId')[_0xb634('0x51')](_0xb634('0x57'),'me',_0xb634('0x58'))[_0xb634('0x51')](_0xb634('0x59'),'it','it.MailInteractionId\x20=\x20i.id')[_0xb634('0x51')](_0xb634('0x5a'),'t','t.id\x20=\x20it.TagId');var _0x32c263=squel[_0xb634('0x5b')]();var _0x198952=[];var _0x543bbb=squel[_0xb634('0x5b')]();var _0x333b8f;if(_0x2a8529[_0xb634('0x3e')][_0xb634('0x5c')]){_0x333b8f=as['parseSearch'](_0x2a8529[_0xb634('0x3e')][_0xb634('0x5c')]);var _0x1cd990=_0x333b8f['sqlOperator'];for(var _0x54ed4f=0x0;_0x54ed4f<_0x333b8f['conditions'][_0xb634('0x44')];_0x54ed4f++){var _0x3015ca=_0x333b8f[_0xb634('0x5d')][_0x54ed4f];var _0x2151f4='i';var _0xf957bc=_['find'](_0x3c53d6,[_0xb634('0x29'),_0x3015ca[_0xb634('0x4b')]]);if(!_0xf957bc){switch(_0x3015ca['field']){case _0xb634('0x5e'):if(_0x3015ca['value']==0x1){_0xda0caf[_0xb634('0x5f')]('`'+_0x3015ca[_0xb634('0x4b')]+'`\x20=\x200');}else{_0xda0caf['having']('`'+_0x3015ca[_0xb634('0x4b')]+'`\x20>\x200');}break;case _0xb634('0x60'):if(_0x3015ca[_0xb634('0x61')]===_0xb634('0x62')){if(_0x3015ca['value']['split']('\x20')[_0xb634('0x44')]>0x1){_0x32c263[_0x1cd990](_0xb634('0x63'),qs[_0xb634('0x64')](_0x3015ca[_0xb634('0x65')]),null);}else{var _0x211778='%'+_0x3015ca['value']+'%';_0x32c263[_0x1cd990]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x211778,_0x211778,_0x211778);}}else{_0xf957bc=_['find'](_0x3c53d6,['name',_0xb634('0x66')]);_0x3015ca[_0xb634('0x4b')]='ContactId';_0x30ab40=as[_0xb634('0x67')](_0x2151f4,_0xf957bc[_0xb634('0x3c')],_0x3015ca);_0x32c263[_0x1cd990](_0x30ab40['text'],_0x30ab40[_0xb634('0x65')][_0xb634('0x68')],_0x30ab40[_0xb634('0x65')][_0xb634('0x1e')]);}break;case _0xb634('0x69'):var _0x1c472d=_0x3015ca[_0xb634('0x65')][_0xb634('0x30')](',')[_0xb634('0x2c')](function(_0x3b7dd7){return Number(_0x3b7dd7);});_0x1c472d[_0xb634('0x31')](function(_0x1f8d10){_0x543bbb['or'](_0xb634('0x6a'),'%,'+_0x1f8d10+',%');});_0x198952=_[_0xb634('0x6b')](_0x198952,_0x1c472d);break;case _0xb634('0x6c'):if(_0x3015ca[_0xb634('0x61')]===_0xb634('0x62')){_0x32c263[_0x1cd990](_0xb634('0x6d'),'%'+_0x3015ca[_0xb634('0x65')]+'%',null);}else{_0xf957bc=_['find'](_0x3c53d6,['name',_0xb634('0x6e')]);_0x3015ca[_0xb634('0x4b')]=_0xb634('0x6e');_0x30ab40=as['buildExpression'](_0x2151f4,_0xf957bc[_0xb634('0x3c')],_0x3015ca);_0x32c263[_0x1cd990](_0x30ab40[_0xb634('0x6f')],_0x30ab40[_0xb634('0x65')][_0xb634('0x68')],_0x30ab40[_0xb634('0x65')][_0xb634('0x1e')]);}break;case _0xb634('0x70'):_0x30ab40=as[_0xb634('0x67')]('me',null,_0x3015ca);_0x32c263[_0x1cd990](_0x30ab40[_0xb634('0x6f')],_0x30ab40[_0xb634('0x65')][_0xb634('0x68')],_0x30ab40[_0xb634('0x65')][_0xb634('0x1e')]);break;}}else{var _0x30ab40=as[_0xb634('0x67')](_0x2151f4,_0xf957bc['type'],_0x3015ca);_0x32c263[_0x1cd990](_0x30ab40[_0xb634('0x6f')],_0x30ab40[_0xb634('0x65')][_0xb634('0x68')],_0x30ab40[_0xb634('0x65')][_0xb634('0x1e')]);}}}else{var _0x493c03=_(_0x2a8529[_0xb634('0x3e')])['keys']()[_0xb634('0x2c')](function(_0x26dbeb){return _[_0xb634('0x71')](_0x3c53d6,['name',_0x26dbeb])?_0x26dbeb:undefined;})[_0xb634('0x72')]()['value']();if(!_[_0xb634('0x73')](_0x493c03)){_0x493c03[_0xb634('0x31')](function(_0x8f4877){if(_0x8f4877==='MailAccountId'){_0xda0caf[_0xb634('0x48')](_0xb634('0x74'),[][_0xb634('0x75')](_0x2a8529[_0xb634('0x3e')][_0x8f4877]));}else if(_0x8f4877==='createdAt'){var _0x51d814=JSON['parse'](_0x2a8529[_0xb634('0x3e')][_0x8f4877])[_0xb634('0x76')];var _0x5b4d75=JSON[_0xb634('0x77')](_0x2a8529['query'][_0x8f4877])['$lte'];_0xda0caf[_0xb634('0x48')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51d814,_0x5b4d75);}else{if(_0x2a8529[_0xb634('0x3e')][_0x8f4877]===_0xb634('0x78')){_0xda0caf['where']('i.'+_0x8f4877+_0xb634('0x79'));}else{_0xda0caf[_0xb634('0x48')]('i.'+_0x8f4877+'\x20=\x20?',_0x2a8529[_0xb634('0x3e')][_0x8f4877]);}}});}if(_0x2a8529[_0xb634('0x3e')][_0xb634('0x7a')]){if(_0x2a8529[_0xb634('0x3e')]['read']==0x1){_0xda0caf[_0xb634('0x5f')](_0xb634('0x7b'));}else{_0xda0caf[_0xb634('0x5f')](_0xb634('0x7c'));}}if(_0x2a8529['query'][_0xb634('0x7d')]){_0x198952=_[_0xb634('0x7e')](_0x2a8529['query'][_0xb634('0x7d')])?_0x2a8529[_0xb634('0x3e')][_0xb634('0x7d')]:new Array(_0x2a8529['query'][_0xb634('0x7d')]);_0x198952[_0xb634('0x31')](function(_0x156ed7){_0x543bbb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x156ed7+',%');});}if(_0x2a8529['query'][_0xb634('0x7f')]){var _0x3b2a44=_0x2a8529[_0xb634('0x3e')][_0xb634('0x7f')][_0xb634('0x80')]('\x5c','\x5c\x5c')[_0xb634('0x80')](/'/g,'\x27\x27');if(qs[_0xb634('0x81')](_0x3b2a44)){_0x32c263['or'](_0xb634('0x82'),_0x3b2a44+'%');}else if(qs[_0xb634('0x83')](_0x3b2a44)){_0x32c263['or']('c.email\x20LIKE\x20?',_0x3b2a44+'%');}else{_0x32c263['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb634('0x64')](_0x3b2a44))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb634('0x64')](_0x3b2a44));}}}_0xda0caf['where'](_0x32c263);_0xda0caf[_0xb634('0x84')](_0xb634('0x85'));var _0x596c8c={'type':db[_0xb634('0x86')][_0xb634('0x87')]['SELECT'],'raw':!![]};var _0x28bb27=_0xda0caf[_0xb634('0x88')]();_0x28bb27[_0xb634('0x4b')]('i.id');_0x28bb27[_0xb634('0x4b')](_0xb634('0x89'),_0xb634('0x5e'));if(_0x301ecd['order']){_0x301ecd[_0xb634('0x8a')][_0xb634('0x31')](function(_0x1da5a3){var _0x1ab4b7=_0x1da5a3[0x0]==='contactName'?_0x1da5a3[0x0]:'i.'+_0x1da5a3[0x0];_0xda0caf[_0xb634('0x8a')](_0x1ab4b7,_0x1da5a3[0x1]===_0xb634('0x8b')?![]:!![]);});}if(!_[_0xb634('0x73')](_0x198952)){_0xda0caf[_0xb634('0x5f')](_0x543bbb);_0x28bb27['where'](_0xb634('0x8c'),_0x198952);}BPromise[_0xb634('0x8d')]()['then'](function(){if(!_0x333b8f){if(_0x2a8529['query'][_0xb634('0x8e')]||_0x2a8529['query'][_0xb634('0x8f')])return;_0x28bb27[_0xb634('0x48')](_0xb634('0x90'));_0xda0caf[_0xb634('0x48')](_0xb634('0x90'));return;}if(_0x2a8529[_0xb634('0x91')][_0xb634('0x92')]!=='agent')return;return _0x2a8529[_0xb634('0x91')][_0xb634('0x93')]({'attributes':['id'],'raw':!![]})[_0xb634('0x26')](function(_0x782af3){if(_['isEmpty'](_0x782af3)){_0x28bb27[_0xb634('0x48')](_0xb634('0x94'));_0xda0caf['where'](_0xb634('0x94'));}else{_0x28bb27[_0xb634('0x48')](_0xb634('0x74'),_[_0xb634('0x2c')](_0x782af3,'id'));_0xda0caf[_0xb634('0x48')](_0xb634('0x74'),_[_0xb634('0x2c')](_0x782af3,'id'));}});})[_0xb634('0x26')](function(){if(_0x2a8529['user'][_0xb634('0x92')]===_0xb634('0x95')&&!_0x333b8f&&!_0x2a8529[_0xb634('0x3e')][_0xb634('0x8e')])return[];return db[_0xb634('0x96')]['query'](_0x28bb27[_0xb634('0x97')](),_0x596c8c);})[_0xb634('0x26')](function(_0x38e455){_0x3dede3[_0xb634('0x1f')]=_0x38e455[_0xb634('0x44')];if(_0x3dede3[_0xb634('0x1f')]===0x0)return[];return db[_0xb634('0x96')][_0xb634('0x3e')](_0xa9e4ed[_0xb634('0x97')](),_0x596c8c)['then'](function(_0x2c4255){_0x251e71=_['keyBy'](_0x2c4255,'id');_0x596c8c=_[_0xb634('0x98')](_0x596c8c,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a8529[_0xb634('0x3e')][_0xb634('0x43')]){_0x301ecd[_0xb634('0x42')][_0xb634('0x31')](function(_0x112e7b){_0xda0caf[_0xb634('0x4b')]('i.'+_0x112e7b);});}else{_0xda0caf[_0xb634('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb634('0x5e'));_0xda0caf[_0xb634('0x4b')](_0xb634('0x99'),'Account.key');_0xda0caf[_0xb634('0x4b')](_0xb634('0x9a'),_0xb634('0x9b'));_0xda0caf[_0xb634('0x4b')](_0xb634('0x9c'),_0xb634('0x9d'));_0xda0caf[_0xb634('0x4b')]('i.id');_0xda0caf['field']('i.createdAt');_0xda0caf['field'](_0xb634('0x9e'));_0xda0caf[_0xb634('0x4b')]('i.closed');_0xda0caf[_0xb634('0x4b')]('i.closedAt');_0xda0caf[_0xb634('0x4b')](_0xb634('0x9f'));_0xda0caf[_0xb634('0x4b')]('i.lastMsgAt');_0xda0caf[_0xb634('0x4b')]('i.lastMsgDirection');_0xda0caf[_0xb634('0x4b')](_0xb634('0xa0'));_0xda0caf[_0xb634('0x4b')]('i.disposition');_0xda0caf['field']('i.secondDisposition');_0xda0caf[_0xb634('0x4b')](_0xb634('0xa1'));_0xda0caf['field'](_0xb634('0xa2'));_0xda0caf[_0xb634('0x4b')](_0xb634('0xa3'));_0xda0caf[_0xb634('0x4b')](_0xb634('0xa4'));_0xda0caf[_0xb634('0x4b')](_0xb634('0xa5'));_0xda0caf['field'](_0xb634('0xa6'));_0xda0caf[_0xb634('0x4b')](_0xb634('0xa7'),'Contact.firstName');_0xda0caf[_0xb634('0x4b')](_0xb634('0xa8'),_0xb634('0xa9'));_0xda0caf[_0xb634('0x4b')](_0xb634('0xaa'),_0xb634('0xab'));_0xda0caf['field'](_0xb634('0xac'),'Contact.phone');_0xda0caf['field'](_0xb634('0xad'),_0xb634('0xae'));_0xda0caf['field']('c.fax','Contact.fax');_0xda0caf[_0xb634('0x4b')](_0xb634('0xaf'),_0xb634('0xb0'));_0xda0caf[_0xb634('0x4b')](_0xb634('0xb1'),_0xb634('0xb2'));_0xda0caf['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb634('0x2e'));}if(_0x301ecd[_0xb634('0x21')])_0xda0caf['limit'](_0x301ecd[_0xb634('0x21')]);if(_0x301ecd[_0xb634('0x20')])_0xda0caf[_0xb634('0x20')](_0x301ecd['offset']);return db[_0xb634('0x96')][_0xb634('0x3e')](_0xda0caf['toString'](),_0x596c8c);})[_0xb634('0x26')](function(_0x957440){_0x126cd1[_0xb634('0x48')](_0xb634('0xb3'),_[_0xb634('0x2c')](_0x957440,'id'));return db[_0xb634('0x96')]['query'](_0x126cd1[_0xb634('0x97')](),_0x596c8c)[_0xb634('0x26')](function(_0x5d1629){var _0x10e337=_[_0xb634('0xb4')](_0x5d1629,_0xb634('0xb5'));var _0x3bf49b=[];return db['Setting'][_0xb634('0x33')]({'attributes':[_0xb634('0xb6')],'raw':!![]})['then'](function(_0x188d4b){var _0x51b524=_0x188d4b[_0xb634('0xb6')];_0x957440[_0xb634('0x31')](function(_0xdb597f){_0x3bf49b['push'](updateMailInteraction(_0xdb597f,_0x251e71,_0x10e337,_0x51b524));});return BPromise['all'](_0x3bf49b);});});});})['then'](function(_0x241d68){_0x3dede3[_0xb634('0xb7')]=_0x241d68;return _0x3dede3;})['then'](respondWithFilteredResult(_0x34ad49,_0x301ecd))[_0xb634('0x37')](handleError(_0x34ad49,null));};exports[_0xb634('0xb8')]=function(_0x40b35d,_0x20607f){var _0xb026ea={'raw':![],'where':{'id':_0x40b35d['params']['id']}},_0xcfd367={};_0xcfd367['model']=_['keys'](db[_0xb634('0x39')][_0xb634('0x3a')]);_0xcfd367[_0xb634('0x3e')]=_[_0xb634('0x3f')](_0x40b35d[_0xb634('0x3e')]);_0xcfd367[_0xb634('0x40')]=_[_0xb634('0x41')](_0xcfd367[_0xb634('0x3d')],_0xcfd367[_0xb634('0x3e')]);_0xb026ea[_0xb634('0x42')]=_[_0xb634('0x41')](_0xcfd367[_0xb634('0x3d')],qs[_0xb634('0x43')](_0x40b35d[_0xb634('0x3e')]['fields']));_0xb026ea[_0xb634('0x42')]=_0xb026ea[_0xb634('0x42')]['length']?_0xb026ea[_0xb634('0x42')]:_0xcfd367['model'];if(_0x40b35d[_0xb634('0x3e')][_0xb634('0xb9')]){_0xb026ea[_0xb634('0xba')]=[{'all':!![]}];}_0xb026ea=_[_0xb634('0x98')]({},_0xb026ea,_0x40b35d[_0xb634('0xbb')]);return db[_0xb634('0x39')][_0xb634('0xbc')](_0xb026ea)[_0xb634('0x26')](handleEntityNotFound(_0x20607f,null))['then'](respondWithResult(_0x20607f,null))[_0xb634('0x37')](handleError(_0x20607f,null));};exports[_0xb634('0xbd')]=function(_0xf7f433,_0x52c206){return db[_0xb634('0x39')][_0xb634('0xbd')](_0xf7f433['body'],{})[_0xb634('0x26')](respondWithResult(_0x52c206,0xc9))[_0xb634('0x37')](handleError(_0x52c206,null));};exports[_0xb634('0x25')]=function(_0xaf9d34,_0x4ba529){if(_0xaf9d34[_0xb634('0xbe')]['id']){delete _0xaf9d34['body']['id'];}return db[_0xb634('0x39')][_0xb634('0xbc')]({'where':{'id':_0xaf9d34[_0xb634('0xbf')]['id']}})[_0xb634('0x26')](handleEntityNotFound(_0x4ba529,null))[_0xb634('0x26')](saveUpdates(_0xaf9d34[_0xb634('0xbe')],null))['then'](respondWithResult(_0x4ba529,null))[_0xb634('0x37')](handleError(_0x4ba529,null));};exports[_0xb634('0x27')]=function(_0x1681c3,_0x134f53){return db['MailInteraction'][_0xb634('0xbc')]({'where':{'id':_0x1681c3[_0xb634('0xbf')]['id']}})[_0xb634('0x26')](handleEntityNotFound(_0x134f53,null))[_0xb634('0x26')](removeEntity(_0x134f53,null))[_0xb634('0x37')](handleError(_0x134f53,null));};exports[_0xb634('0xc0')]=function(_0x418f12,_0x2f030a){return db[_0xb634('0x39')][_0xb634('0xc0')]()['then'](respondWithResult(_0x2f030a,null))[_0xb634('0x37')](handleError(_0x2f030a,null));};exports['addMessage']=function(_0x1dfcbf,_0x3b7c10,_0x2c4b0b){return db[_0xb634('0xc1')][_0xb634('0xbc')]({'where':{'id':_0x1dfcbf['params']['id']}})[_0xb634('0x26')](handleEntityNotFound(_0x3b7c10,null))[_0xb634('0x26')](function(_0x5eb6ee){if(_0x5eb6ee){return _0x5eb6ee[_0xb634('0xc2')](_0x1dfcbf['body'][_0xb634('0xc3')],_[_0xb634('0xc4')](_0x1dfcbf[_0xb634('0xbe')],[_0xb634('0xc3'),'id'])||{});}})[_0xb634('0x26')](respondWithResult(_0x3b7c10,null))['catch'](handleError(_0x3b7c10,null));};exports[_0xb634('0xc5')]=function(_0x182ada,_0x2513ff,_0x4b7161){var _0x2d859b={'raw':![],'where':{}};var _0x4dbc06={};var _0x3c1691={'count':0x0,'rows':[]};return db[_0xb634('0x39')][_0xb634('0x33')]({'where':{'id':_0x182ada[_0xb634('0xbf')]['id']}})[_0xb634('0x26')](handleEntityNotFound(_0x2513ff,null))[_0xb634('0x26')](function(_0x3331c8){if(_0x3331c8){_0x4dbc06[_0xb634('0x3d')]=_[_0xb634('0x3f')](db[_0xb634('0xc1')][_0xb634('0x3a')]);_0x4dbc06['query']=_[_0xb634('0x3f')](_0x182ada[_0xb634('0x3e')]);_0x4dbc06[_0xb634('0x40')]=_['intersection'](_0x4dbc06[_0xb634('0x3d')],_0x4dbc06[_0xb634('0x3e')]);_0x2d859b['attributes']=_[_0xb634('0x41')](_0x4dbc06[_0xb634('0x3d')],qs[_0xb634('0x43')](_0x182ada[_0xb634('0x3e')]['fields']));_0x2d859b['attributes']=_0x2d859b[_0xb634('0x42')][_0xb634('0x44')]?_0x2d859b[_0xb634('0x42')]:_0x4dbc06[_0xb634('0x3d')];if(!_0x182ada[_0xb634('0x3e')][_0xb634('0x45')](_0xb634('0x46'))){_0x2d859b[_0xb634('0x21')]=qs[_0xb634('0x21')](_0x182ada[_0xb634('0x3e')][_0xb634('0x21')]);_0x2d859b[_0xb634('0x20')]=qs[_0xb634('0x20')](_0x182ada[_0xb634('0x3e')]['offset']);}_0x2d859b[_0xb634('0x8a')]=qs[_0xb634('0x47')](_0x182ada[_0xb634('0x3e')][_0xb634('0x47')]);_0x2d859b['where']=qs[_0xb634('0x40')](_[_0xb634('0x49')](_0x182ada[_0xb634('0x3e')],_0x4dbc06[_0xb634('0x40')]));_0x2d859b['where'][_0xb634('0xb5')]=_0x3331c8['id'];if(_0x182ada[_0xb634('0x3e')][_0xb634('0x7f')]){_0x2d859b[_0xb634('0x48')]=_[_0xb634('0x98')](_0x2d859b[_0xb634('0x48')],{'$or':_[_0xb634('0x2c')](_0x2d859b[_0xb634('0x42')],function(_0x53d858){var _0x1a4095={};_0x1a4095[_0x53d858]={'$like':'%'+_0x182ada[_0xb634('0x3e')][_0xb634('0x7f')]+'%'};return _0x1a4095;})});}if(_0x182ada[_0xb634('0x3e')][_0xb634('0x76')]){var _0x5f181c=_0x182ada['query'][_0xb634('0x76')]['split'](',');var _0x1b6712={};_0x1b6712[_0x5f181c[0x0]]={'$gte':moment(_0x5f181c[0x1])[_0xb634('0xc6')](_0xb634('0xc7'))};_0x2d859b[_0xb634('0x48')]=_[_0xb634('0x98')](_0x2d859b[_0xb634('0x48')],_0x1b6712);}_0x2d859b=_[_0xb634('0x98')]({},_0x2d859b,_0x182ada[_0xb634('0xbb')]);return db[_0xb634('0xc1')]['count']({'where':_0x2d859b[_0xb634('0x48')]})[_0xb634('0x26')](function(_0x341292){_0x3c1691[_0xb634('0x1f')]=_0x341292;if(_0x182ada[_0xb634('0x3e')][_0xb634('0xb9')]){_0x2d859b['include']=[{'all':!![]}];}return db[_0xb634('0xc1')][_0xb634('0xc8')](_0x2d859b);})[_0xb634('0x26')](function(_0x5ce404){_0x3c1691['rows']=_0x5ce404;return _0x3c1691;});}})[_0xb634('0x26')](respondWithFilteredResult(_0x2513ff,_0x2d859b))[_0xb634('0x37')](handleError(_0x2513ff,null));};exports[_0xb634('0xc9')]=function(_0x1bdee5,_0x4e700d,_0x5a0eb4){return db[_0xb634('0x39')]['find']({'where':{'id':_0x1bdee5[_0xb634('0xbf')]['id']}})[_0xb634('0x26')](handleEntityNotFound(_0x4e700d,null))[_0xb634('0x26')](function(_0x5a8377){if(_0x5a8377){return _0x5a8377['setTags'](_0x1bdee5[_0xb634('0xbe')][_0xb634('0xc3')],_['omit'](_0x1bdee5[_0xb634('0xbe')],[_0xb634('0xc3'),'id'])||{})[_0xb634('0xca')](function(){return db[_0xb634('0x69')][_0xb634('0xc8')]({'attributes':['id',_0xb634('0x29'),_0xb634('0x4c')],'where':{'id':_0x1bdee5['body'][_0xb634('0xc3')]}});})['then'](function(_0xb86654){socket[_0xb634('0xcb')](_0xb634('0xcc'),{'id':Number(_0x1bdee5['params']['id']),'tags':_0xb86654||[]});return{'id':Number(_0x1bdee5[_0xb634('0xbf')]['id']),'tags':_0xb86654||[]};});}})[_0xb634('0x26')](respondWithResult(_0x4e700d,null))[_0xb634('0x37')](handleError(_0x4e700d,null));};exports[_0xb634('0xcd')]=function(_0x428210,_0x1171d2,_0xab8149){return db[_0xb634('0x39')][_0xb634('0xbc')]({'where':{'id':_0x428210['params']['id']}})[_0xb634('0x26')](handleEntityNotFound(_0x1171d2,null))[_0xb634('0x26')](function(_0x125740){if(_0x125740){return _0x125740[_0xb634('0xcd')](_0x428210[_0xb634('0x3e')][_0xb634('0xc3')]);}})[_0xb634('0x26')](respondWithStatusCode(_0x1171d2,null))[_0xb634('0x37')](handleError(_0x1171d2,null));};exports['download']=function(_0x4fc1e8,_0x5e90b9){var _0x4b05b3=moment()[_0xb634('0xce')]()['toString']();var _0x5915b0=path[_0xb634('0xcf')](config[_0xb634('0xd0')],_0xb634('0xd1'),'files','tmp');var _0xe5ebf5=path['join'](config[_0xb634('0xd0')],_0xb634('0xd1'),_0xb634('0xd2'),'attachments');var _0x4204ff=path[_0xb634('0xcf')](_0x5915b0,_0x4b05b3);var _0x1d6982=util[_0xb634('0xc6')]('transcript-%d-%s.zip',_0x4fc1e8[_0xb634('0xbf')]['id'],_0x4b05b3);var _0x306b35=path[_0xb634('0xcf')](_0x5915b0,_0x1d6982);var _0x618033=[];if(_0x4fc1e8['query'][_0xb634('0xd3')]){_0x618033['push']({'model':db['Attachment'],'as':_0xb634('0xd4'),'raw':!![]});}var _0x304452=[{'model':db[_0xb634('0xc1')],'as':_0xb634('0xd5'),'attributes':['id','body',_0xb634('0x4d'),'to','cc',_0xb634('0xd6'),'subject',_0xb634('0xd7')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x618033}];return db['MailInteraction'][_0xb634('0xbc')]({'where':{'id':_0x4fc1e8[_0xb634('0xbf')]['id']},'include':_0x304452})[_0xb634('0x26')](handleEntityNotFound(_0x5e90b9,null))['then'](function(_0x27758e){if(_0x27758e&&_0x27758e[_0xb634('0xd5')]){var _0x5cd8a7=_0x27758e[_0xb634('0xd8')]({'plain':!![]});fs[_0xb634('0xd9')](_0x4204ff);return BPromise[_0xb634('0xda')](_0x5cd8a7[_0xb634('0xd5')],function(_0x2ba7d5,_0xbcfb7a){var _0x14e9f8={'from':_0x2ba7d5[_0xb634('0x4d')],'to':_0x2ba7d5['to'],'subject':_0x2ba7d5[_0xb634('0xdb')],'html':_0x2ba7d5[_0xb634('0xbe')],'headers':{'Date':moment(_0x2ba7d5['createdAt'])[_0xb634('0xc6')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x2ba7d5['cc']){_0x14e9f8[_0xb634('0xdc')]['Cc']=_0x2ba7d5['cc'];}if(_0x2ba7d5[_0xb634('0xd6')]){_0x14e9f8[_0xb634('0xdc')][_0xb634('0xdd')]=_0x2ba7d5[_0xb634('0xd6')];}return new BPromise(function(_0x261ec4,_0x2224df){if(_0x2ba7d5[_0xb634('0xd4')]){for(var _0x216dc9=0x0;_0x216dc9<_0x2ba7d5[_0xb634('0xd4')][_0xb634('0x44')];_0x216dc9++){var _0x48a5ad=_0x2ba7d5[_0xb634('0xd4')][_0x216dc9];var _0x217042=path[_0xb634('0xcf')](_0xe5ebf5,_0x48a5ad['basename']);if(fs[_0xb634('0xde')](_0x217042)){_0x14e9f8[_0xb634('0xd3')][_0xb634('0x32')]({'name':_0x48a5ad['name'],'contentType':_0x48a5ad[_0xb634('0x3c')],'data':fs['readFileSync'](_0x217042)});}}}emlformat[_0xb634('0xdf')](_0x14e9f8,function(_0x28ac56,_0x1948cf){if(_0x28ac56)return _0x2224df(_0x28ac56);fs[_0xb634('0xe0')](path[_0xb634('0xcf')](_0x4204ff,util[_0xb634('0xc6')](_0xb634('0xe1'),_0xbcfb7a)),_0x1948cf);return _0x261ec4(_0x1948cf);});});})[_0xb634('0x26')](function(){return new BPromise(function(_0x4cd76d,_0x3b435d){zipdir(_0x4204ff,{'saveTo':_0x306b35},function(_0x1e692c,_0x5cb7eb){if(_0x1e692c)return _0x3b435d(_0x1e692c);return _0x4cd76d(_0x5cb7eb);});})[_0xb634('0x26')](function(){return new BPromise(function(_0x470c12,_0x33485d){rimraf(_0x4204ff,function(_0x27588f){if(_0x27588f)_0x33485d(_0x27588f);return _0x470c12();});});})[_0xb634('0x26')](function(){return _0x5e90b9[_0xb634('0xe2')](_0x306b35,_0x1d6982,function(_0x258a9d){if(_0x258a9d){console[_0xb634('0xe3')]('err',_0x258a9d);}else{fs[_0xb634('0xe4')](_0x306b35);}});});});}else{return _0x5e90b9[_0xb634('0x1c')](0xc8);}})[_0xb634('0x37')](handleError(_0x5e90b9,null));}; \ No newline at end of file +var _0xeb5e=['replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','having','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','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.closed','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.fax','o.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','findOne','rows','show','params','includeAll','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','Tag','mailInteractionTags:save','removeTags','download','join','root','server','tmp','files','transcript-%d-%s.zip','attachments','Attachment','Messages','bcc','subject','mkdirSync','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','log','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','reject','save','update','then','destroy','error','name','map','fullname','TagIds','Tags','split','forEach','push','MailInteraction','lastMsgBody','lastMsgText','trimStart','catch','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','users','left_join','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','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','`\x20=\x200','`\x20>\x200','Contact','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','plainBody','some','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','isArray','filter'];(function(_0x21addb,_0x70324c){var _0x290642=function(_0xac787f){while(--_0xac787f){_0x21addb['push'](_0x21addb['shift']());}};_0x290642(++_0x70324c);}(_0xeb5e,0x151));var _0xeeb5=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xeb5e[_0x13e741];return _0x3f8bb3;};'use strict';var pdf=require(_0xeeb5('0x0'));var emlformat=require(_0xeeb5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeeb5('0x2'));var jsonpatch=require(_0xeeb5('0x3'));var rp=require(_0xeeb5('0x4'));var moment=require(_0xeeb5('0x5'));var BPromise=require(_0xeeb5('0x6'));var Mustache=require(_0xeeb5('0x7'));var util=require(_0xeeb5('0x8'));var path=require('path');var sox=require(_0xeeb5('0x9'));var csv=require(_0xeeb5('0xa'));var ejs=require(_0xeeb5('0xb'));var fs=require('fs');var _=require(_0xeeb5('0xc'));var squel=require(_0xeeb5('0xd'));var crypto=require(_0xeeb5('0xe'));var jsforce=require(_0xeeb5('0xf'));var deskjs=require(_0xeeb5('0x10'));var toCsv=require(_0xeeb5('0xa'));var querystring=require(_0xeeb5('0x11'));var Papa=require(_0xeeb5('0x12'));var htmlToText=require(_0xeeb5('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeeb5('0x14'));var as=require(_0xeeb5('0x15'));var hardwareService=require(_0xeeb5('0x16'));var logger=require(_0xeeb5('0x17'))(_0xeeb5('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeeb5('0x19'))['db'];config[_0xeeb5('0x1a')]=_[_0xeeb5('0x1b')](config['redis'],{'host':_0xeeb5('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeeb5('0x1a')]));require(_0xeeb5('0x1d'))[_0xeeb5('0x1e')](socket);function respondWithStatusCode(_0x220ede,_0xdf0827){_0xdf0827=_0xdf0827||0xcc;return function(_0x56e84c){if(_0x56e84c){return _0x220ede[_0xeeb5('0x1f')](_0xdf0827);}return _0x220ede['status'](_0xdf0827)[_0xeeb5('0x20')]();};}function respondWithResult(_0x3c0fe7,_0x4c652e){_0x4c652e=_0x4c652e||0xc8;return function(_0x5ceec9){if(_0x5ceec9){return _0x3c0fe7[_0xeeb5('0x21')](_0x4c652e)[_0xeeb5('0x22')](_0x5ceec9);}};}function respondWithFilteredResult(_0x499bd6,_0x24a09a){return function(_0x26c9f7){if(_0x26c9f7){var _0xfef960=_0x26c9f7[_0xeeb5('0x23')],_0x4cc0ad=_0x24a09a[_0xeeb5('0x24')],_0x43c2fe=_0x24a09a['offset']+_0x24a09a[_0xeeb5('0x25')],_0x5c2fe7;if(_0x43c2fe>=_0xfef960){_0x43c2fe=_0xfef960;_0x5c2fe7=0xc8;}else{_0x5c2fe7=0xce;}_0x499bd6['status'](_0x5c2fe7);return _0x499bd6[_0xeeb5('0x26')]('Content-Range',_0x4cc0ad+'-'+_0x43c2fe+'/'+_0xfef960)['json'](_0x26c9f7);}return null;};}function patchUpdates(_0x31431d){return function(_0xd20fdc){try{jsonpatch['apply'](_0xd20fdc,_0x31431d,!![]);}catch(_0x44be0c){return BPromise[_0xeeb5('0x27')](_0x44be0c);}return _0xd20fdc[_0xeeb5('0x28')]();};}function saveUpdates(_0x2fe7c5,_0x55052c){return function(_0x2e6267){if(_0x2e6267){return _0x2e6267[_0xeeb5('0x29')](_0x2fe7c5)[_0xeeb5('0x2a')](function(_0x498f72){return _0x498f72;});}return null;};}function removeEntity(_0x3b8494,_0x3d6bbf){return function(_0x32a5cf){if(_0x32a5cf){return _0x32a5cf[_0xeeb5('0x2b')]()[_0xeeb5('0x2a')](function(){_0x3b8494[_0xeeb5('0x21')](0xcc)[_0xeeb5('0x20')]();});}};}function handleEntityNotFound(_0x48b6f7,_0xafe70d){return function(_0x59b296){if(!_0x59b296){_0x48b6f7[_0xeeb5('0x1f')](0x194);}return _0x59b296;};}function handleError(_0x6fad50,_0x3f6c02){_0x3f6c02=_0x3f6c02||0x1f4;return function(_0xf6bdf2){logger[_0xeeb5('0x2c')](_0xf6bdf2['stack']);if(_0xf6bdf2[_0xeeb5('0x2d')]){delete _0xf6bdf2[_0xeeb5('0x2d')];}_0x6fad50[_0xeeb5('0x21')](_0x3f6c02)['send'](_0xf6bdf2);};}function getInteractionUsers(_0x36789e,_0x1c10b5){return new BPromise(function(_0x87b79a,_0x4e17cb){try{if(_0x1c10b5[_0x36789e['id']]){_0x36789e['Users']=_[_0xeeb5('0x2e')](_0x1c10b5[_0x36789e['id']],function(_0x24e963){return{'id':_0x24e963['id'],'fullname':_0x24e963[_0xeeb5('0x2f')]};});}}catch(_0x124798){_0x4e17cb(_0x124798);}_0x87b79a(_0x36789e);});}function getInteractionTags(_0x478080,_0x57056b){return new BPromise(function(_0x1a1e49,_0x48404e){try{if(_0x478080[_0xeeb5('0x30')]){_0x478080[_0xeeb5('0x31')]=[];_0x478080[_0xeeb5('0x30')][_0xeeb5('0x32')](',')[_0xeeb5('0x33')](function(_0x2071ad){_0x478080[_0xeeb5('0x31')][_0xeeb5('0x34')](_0x57056b[_0x2071ad]);});}delete _0x478080['TagIds'];}catch(_0x519a8d){_0x48404e(_0x519a8d);}_0x1a1e49(_0x478080);});}function getLastMessageText(_0x44e6de){return new BPromise(function(_0x23854f,_0x340bcc){return db[_0xeeb5('0x35')]['findOne']({'where':{'id':_0x44e6de['id']},'attributes':[_0xeeb5('0x36'),_0xeeb5('0x37')],'raw':!![]})[_0xeeb5('0x2a')](function(_0x280e2c){if(!_0x280e2c[_0xeeb5('0x37')]){_0x44e6de[_0xeeb5('0x37')]=_[_0xeeb5('0x38')](htmlToText['fromString'](_0x280e2c[_0xeeb5('0x36')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x44e6de['lastMsgText']=_0x280e2c[_0xeeb5('0x37')];}_0x23854f(_0x44e6de);})['catch'](function(_0x11c567){_0x340bcc(_0x11c567);});});}function updateMailInteraction(_0x2c3f21,_0x5b1f78,_0x16c752,_0x5edcc5){return new BPromise(function(_0x6cad47,_0xb34d55){return getInteractionUsers(_0x2c3f21,_0x16c752)[_0xeeb5('0x2a')](function(_0x99889f){return getInteractionTags(_0x99889f,_0x5b1f78);})[_0xeeb5('0x2a')](function(_0x28858d){if(_0x5edcc5){_0x6cad47(getLastMessageText(_0x28858d));}else{_0x6cad47(_0x28858d);}})[_0xeeb5('0x39')](function(_0x334ccc){_0xb34d55(_0x334ccc);});});}exports[_0xeeb5('0x3a')]=function(_0x1f1ca1,_0x5d23cb){var _0x13ac58={},_0x5e4fb1={},_0x26b6bb={'count':0x0,'rows':[]};var _0x219807=_[_0xeeb5('0x2e')](db[_0xeeb5('0x35')][_0xeeb5('0x3b')],function(_0x184f8e){return{'name':_0x184f8e[_0xeeb5('0x3c')],'type':_0x184f8e[_0xeeb5('0x3d')][_0xeeb5('0x3e')]};});_0x5e4fb1['model']=_[_0xeeb5('0x2e')](_0x219807,_0xeeb5('0x2d'));_0x5e4fb1[_0xeeb5('0x3f')]=_[_0xeeb5('0x40')](_0x1f1ca1[_0xeeb5('0x3f')]);_0x5e4fb1[_0xeeb5('0x41')]=_[_0xeeb5('0x42')](_0x5e4fb1[_0xeeb5('0x43')],_0x5e4fb1['query']);_0x13ac58['attributes']=_[_0xeeb5('0x42')](_0x5e4fb1['model'],qs['fields'](_0x1f1ca1['query'][_0xeeb5('0x44')]));_0x13ac58[_0xeeb5('0x45')]=_0x13ac58['attributes'][_0xeeb5('0x46')]?_0x13ac58[_0xeeb5('0x45')]:_0x5e4fb1[_0xeeb5('0x43')];if(!_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x47')](_0xeeb5('0x48'))){_0x13ac58[_0xeeb5('0x25')]=qs[_0xeeb5('0x25')](_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x25')]);_0x13ac58[_0xeeb5('0x24')]=qs[_0xeeb5('0x24')](_0x1f1ca1[_0xeeb5('0x3f')]['offset']);}_0x13ac58['order']=qs[_0xeeb5('0x49')](_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x49')]);_0x13ac58[_0xeeb5('0x4a')]=qs[_0xeeb5('0x41')](_[_0xeeb5('0x4b')](_0x1f1ca1[_0xeeb5('0x3f')],_0x5e4fb1[_0xeeb5('0x41')]),_0x219807);var _0x4d1ae6=[];var _0x3c754b=squel[_0xeeb5('0x4c')]()[_0xeeb5('0x4d')]('id')[_0xeeb5('0x4d')](_0xeeb5('0x2d'))[_0xeeb5('0x4d')](_0xeeb5('0x4e'))[_0xeeb5('0x4f')](_0xeeb5('0x50'));var _0x74eb8d=squel['select']()[_0xeeb5('0x4d')](_0xeeb5('0x51'))[_0xeeb5('0x4d')](_0xeeb5('0x52'))[_0xeeb5('0x4d')](_0xeeb5('0x53'))[_0xeeb5('0x4f')](_0xeeb5('0x54'),'ui')['left_join'](_0xeeb5('0x55'),'u','u.id\x20=\x20ui.UserId');var _0x5176ea=squel[_0xeeb5('0x4c')]()[_0xeeb5('0x4f')]('mail_interactions','i')[_0xeeb5('0x56')](_0xeeb5('0x57'),'c',_0xeeb5('0x58'))[_0xeeb5('0x56')](_0xeeb5('0x55'),'o',_0xeeb5('0x59'))['left_join'](_0xeeb5('0x5a'),'a',_0xeeb5('0x5b'))[_0xeeb5('0x56')](_0xeeb5('0x5c'),'me',_0xeeb5('0x5d'))[_0xeeb5('0x56')](_0xeeb5('0x5e'),'it',_0xeeb5('0x5f'))[_0xeeb5('0x56')](_0xeeb5('0x50'),'t',_0xeeb5('0x60'));var _0x22290c=squel[_0xeeb5('0x61')]();var _0x591415=[];var _0x4db640=squel['expr']();var _0x50abda;if(_0x1f1ca1['query'][_0xeeb5('0x62')]){_0x50abda=as[_0xeeb5('0x63')](_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x62')]);var _0x20e46a=_0x50abda[_0xeeb5('0x64')];for(var _0x530d6b=0x0;_0x530d6b<_0x50abda['conditions']['length'];_0x530d6b++){var _0x470ed9=_0x50abda[_0xeeb5('0x65')][_0x530d6b];var _0x56064f='i';var _0x1e2ef9=_['find'](_0x219807,[_0xeeb5('0x2d'),_0x470ed9[_0xeeb5('0x4d')]]);if(!_0x1e2ef9){switch(_0x470ed9[_0xeeb5('0x4d')]){case _0xeeb5('0x66'):if(_0x470ed9['value']==0x1){_0x5176ea['having']('`'+_0x470ed9[_0xeeb5('0x4d')]+_0xeeb5('0x67'));}else{_0x5176ea['having']('`'+_0x470ed9[_0xeeb5('0x4d')]+_0xeeb5('0x68'));}break;case _0xeeb5('0x69'):if(_0x470ed9['operator']==='$substring'){if(_0x470ed9[_0xeeb5('0x6a')][_0xeeb5('0x32')]('\x20')[_0xeeb5('0x46')]>0x1){_0x22290c[_0x20e46a](_0xeeb5('0x6b'),qs[_0xeeb5('0x6c')](_0x470ed9[_0xeeb5('0x6a')]),null);}else{var _0x75ce7e='%'+_0x470ed9[_0xeeb5('0x6a')]+'%';_0x22290c[_0x20e46a](_0xeeb5('0x6d'),_0x75ce7e,_0x75ce7e,_0x75ce7e);}}else{_0x1e2ef9=_[_0xeeb5('0x6e')](_0x219807,[_0xeeb5('0x2d'),_0xeeb5('0x6f')]);_0x470ed9[_0xeeb5('0x4d')]=_0xeeb5('0x6f');_0x1dc86d=as['buildExpression'](_0x56064f,_0x1e2ef9[_0xeeb5('0x3d')],_0x470ed9);_0x22290c[_0x20e46a](_0x1dc86d[_0xeeb5('0x70')],_0x1dc86d['value'][_0xeeb5('0x71')],_0x1dc86d[_0xeeb5('0x6a')][_0xeeb5('0x20')]);}break;case'Tag':var _0x55e038=_0x470ed9[_0xeeb5('0x6a')][_0xeeb5('0x32')](',')['map'](function(_0x4ef45b){return Number(_0x4ef45b);});_0x55e038[_0xeeb5('0x33')](function(_0x4b3900){_0x4db640['or'](_0xeeb5('0x72'),'%,'+_0x4b3900+',%');});_0x591415=_[_0xeeb5('0x73')](_0x591415,_0x55e038);break;case'User':if(_0x470ed9[_0xeeb5('0x74')]===_0xeeb5('0x75')){_0x22290c[_0x20e46a](_0xeeb5('0x76'),'%'+_0x470ed9['value']+'%',null);}else{_0x1e2ef9=_[_0xeeb5('0x6e')](_0x219807,[_0xeeb5('0x2d'),'UserId']);_0x470ed9[_0xeeb5('0x4d')]='UserId';_0x1dc86d=as[_0xeeb5('0x77')](_0x56064f,_0x1e2ef9['type'],_0x470ed9);_0x22290c[_0x20e46a](_0x1dc86d['text'],_0x1dc86d['value'][_0xeeb5('0x71')],_0x1dc86d['value'][_0xeeb5('0x20')]);}break;case _0xeeb5('0x78'):_0x1dc86d=as[_0xeeb5('0x77')]('me',null,_0x470ed9);_0x22290c[_0x20e46a](_0x1dc86d[_0xeeb5('0x70')],_0x1dc86d[_0xeeb5('0x6a')]['start'],_0x1dc86d[_0xeeb5('0x6a')]['end']);break;}}else{var _0x1dc86d=as[_0xeeb5('0x77')](_0x56064f,_0x1e2ef9[_0xeeb5('0x3d')],_0x470ed9);_0x22290c[_0x20e46a](_0x1dc86d['text'],_0x1dc86d[_0xeeb5('0x6a')][_0xeeb5('0x71')],_0x1dc86d[_0xeeb5('0x6a')][_0xeeb5('0x20')]);}}}else{var _0xf37196=_(_0x1f1ca1['query'])['keys']()['map'](function(_0x3a8bca){return _[_0xeeb5('0x79')](_0x219807,[_0xeeb5('0x2d'),_0x3a8bca])?_0x3a8bca:undefined;})['compact']()[_0xeeb5('0x6a')]();if(!_[_0xeeb5('0x7a')](_0xf37196)){_0xf37196[_0xeeb5('0x33')](function(_0x2fbebd){if(_0x2fbebd===_0xeeb5('0x7b')){_0x5176ea[_0xeeb5('0x4a')](_0xeeb5('0x7c'),[][_0xeeb5('0x7d')](_0x1f1ca1[_0xeeb5('0x3f')][_0x2fbebd]));}else if(_0x2fbebd===_0xeeb5('0x7e')){var _0x34fc13=JSON[_0xeeb5('0x7f')](_0x1f1ca1['query'][_0x2fbebd])[_0xeeb5('0x80')];var _0x55aa01=JSON[_0xeeb5('0x7f')](_0x1f1ca1['query'][_0x2fbebd])[_0xeeb5('0x81')];_0x5176ea[_0xeeb5('0x4a')](_0xeeb5('0x82'),_0x34fc13,_0x55aa01);}else{if(_0x1f1ca1[_0xeeb5('0x3f')][_0x2fbebd]===_0xeeb5('0x83')){_0x5176ea[_0xeeb5('0x4a')]('i.'+_0x2fbebd+'\x20IS\x20NULL');}else{_0x5176ea['where']('i.'+_0x2fbebd+_0xeeb5('0x84'),_0x1f1ca1[_0xeeb5('0x3f')][_0x2fbebd]);}}});}if(_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x85')]){if(_0x1f1ca1['query'][_0xeeb5('0x85')]==0x1){_0x5176ea['having']('`unreadMessages`\x20=\x200');}else{_0x5176ea['having']('`unreadMessages`\x20>\x200');}}if(_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x86')]){_0x591415=_[_0xeeb5('0x87')](_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x86')])?_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x86')]:new Array(_0x1f1ca1[_0xeeb5('0x3f')]['tag']);_0x591415['forEach'](function(_0x295f62){_0x4db640['or'](_0xeeb5('0x72'),'%,'+_0x295f62+',%');});}if(_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x88')]){var _0x33101a=_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x88')][_0xeeb5('0x89')]('\x5c','\x5c\x5c')[_0xeeb5('0x89')](/'/g,'\x27\x27');if(qs[_0xeeb5('0x8a')](_0x33101a)){_0x22290c['or'](_0xeeb5('0x8b'),_0x33101a+'%');}else if(qs[_0xeeb5('0x8c')](_0x33101a)){_0x22290c['or'](_0xeeb5('0x8d'),_0x33101a+'%');}else{_0x22290c['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x33101a))['or'](_0xeeb5('0x8e'),qs['getFullTextValue'](_0x33101a));}}}_0x5176ea['where'](_0x22290c);_0x5176ea[_0xeeb5('0x8f')](_0xeeb5('0x90'));var _0x2e2424={'type':db['Sequelize'][_0xeeb5('0x91')][_0xeeb5('0x92')],'raw':!![]};var _0x14c1cf=_0x5176ea[_0xeeb5('0x93')]();_0x14c1cf[_0xeeb5('0x4d')](_0xeeb5('0x90'));_0x14c1cf['field'](_0xeeb5('0x94'),_0xeeb5('0x66'));if(_0x13ac58[_0xeeb5('0x95')]){_0x13ac58[_0xeeb5('0x95')][_0xeeb5('0x33')](function(_0x5de8bf){var _0x3993c8=_0x5de8bf[0x0]===_0xeeb5('0x96')?_0x5de8bf[0x0]:'i.'+_0x5de8bf[0x0];_0x5176ea['order'](_0x3993c8,_0x5de8bf[0x1]===_0xeeb5('0x97')?![]:!![]);});}if(!_[_0xeeb5('0x7a')](_0x591415)){_0x5176ea[_0xeeb5('0x98')](_0x4db640);_0x14c1cf[_0xeeb5('0x4a')]('t.id\x20IN\x20?',_0x591415);}BPromise[_0xeeb5('0x99')]()[_0xeeb5('0x2a')](function(){if(!_0x50abda){if(_0x1f1ca1['query']['MailAccountId']||_0x1f1ca1['query'][_0xeeb5('0x9a')])return;_0x14c1cf[_0xeeb5('0x4a')](_0xeeb5('0x9b'));_0x5176ea[_0xeeb5('0x4a')](_0xeeb5('0x9b'));return;}if(_0x1f1ca1[_0xeeb5('0x9c')]['role']!==_0xeeb5('0x9d'))return;return _0x1f1ca1[_0xeeb5('0x9c')][_0xeeb5('0x9e')]({'attributes':['id'],'raw':!![]})[_0xeeb5('0x2a')](function(_0x4e5fa4){if(_[_0xeeb5('0x7a')](_0x4e5fa4)){_0x14c1cf[_0xeeb5('0x4a')](_0xeeb5('0x9f'));_0x5176ea[_0xeeb5('0x4a')](_0xeeb5('0x9f'));}else{_0x14c1cf[_0xeeb5('0x4a')](_0xeeb5('0x7c'),_[_0xeeb5('0x2e')](_0x4e5fa4,'id'));_0x5176ea[_0xeeb5('0x4a')]('i.MailAccountId\x20IN\x20?',_[_0xeeb5('0x2e')](_0x4e5fa4,'id'));}});})[_0xeeb5('0x2a')](function(){if(_0x1f1ca1[_0xeeb5('0x9c')][_0xeeb5('0xa0')]===_0xeeb5('0x9d')&&!_0x50abda&&!_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x7b')])return[];return db[_0xeeb5('0xa1')]['query'](_0x14c1cf[_0xeeb5('0xa2')](),_0x2e2424);})[_0xeeb5('0x2a')](function(_0x4baf59){_0x26b6bb[_0xeeb5('0x23')]=_0x4baf59[_0xeeb5('0x46')];if(_0x26b6bb['count']===0x0)return[];return db[_0xeeb5('0xa1')][_0xeeb5('0x3f')](_0x3c754b[_0xeeb5('0xa2')](),_0x2e2424)[_0xeeb5('0x2a')](function(_0xbd2689){_0x4d1ae6=_[_0xeeb5('0xa3')](_0xbd2689,'id');_0x2e2424=_['merge'](_0x2e2424,{'model':db[_0xeeb5('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f1ca1[_0xeeb5('0x3f')][_0xeeb5('0x44')]){_0x13ac58[_0xeeb5('0x45')][_0xeeb5('0x33')](function(_0x157a0b){_0x5176ea[_0xeeb5('0x4d')]('i.'+_0x157a0b);});}else{_0x5176ea[_0xeeb5('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xeeb5('0x66'));_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xa4'),_0xeeb5('0xa5'));_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xa6'),_0xeeb5('0xa7'));_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xa8'),_0xeeb5('0x96'));_0x5176ea['field']('i.id');_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xa9'));_0x5176ea['field']('i.updatedAt');_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xaa'));_0x5176ea['field']('i.closedAt');_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xab'));_0x5176ea[_0xeeb5('0x4d')]('i.lastMsgAt');_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xac'));_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xad'));_0x5176ea['field'](_0xeeb5('0xae'));_0x5176ea['field'](_0xeeb5('0xaf'));_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xb0'));_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xb1'));_0x5176ea[_0xeeb5('0x4d')]('i.to');_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xb2'));_0x5176ea[_0xeeb5('0x4d')]('i.MailAccountId');_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xb3'));_0x5176ea['field']('c.firstName',_0xeeb5('0xb4'));_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xb5'),_0xeeb5('0xb6'));_0x5176ea[_0xeeb5('0x4d')]('c.email',_0xeeb5('0xb7'));_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xb8'),_0xeeb5('0xb9'));_0x5176ea[_0xeeb5('0x4d')]('c.mobile','Contact.mobile');_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xba'),'Contact.fax');_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xbb'),'Owner.fullname');_0x5176ea[_0xeeb5('0x4d')](_0xeeb5('0xbc'),_0xeeb5('0xbd'));_0x5176ea[_0xeeb5('0x4d')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xeeb5('0x30'));}if(_0x13ac58['limit'])_0x5176ea[_0xeeb5('0x25')](_0x13ac58['limit']);if(_0x13ac58['offset'])_0x5176ea['offset'](_0x13ac58[_0xeeb5('0x24')]);return db[_0xeeb5('0xa1')][_0xeeb5('0x3f')](_0x5176ea[_0xeeb5('0xa2')](),_0x2e2424);})[_0xeeb5('0x2a')](function(_0x51dda2){_0x74eb8d[_0xeeb5('0x4a')](_0xeeb5('0xbe'),_['map'](_0x51dda2,'id'));return db[_0xeeb5('0xa1')]['query'](_0x74eb8d['toString'](),_0x2e2424)[_0xeeb5('0x2a')](function(_0x4d6381){var _0x40b5ac=_[_0xeeb5('0xbf')](_0x4d6381,_0xeeb5('0xc0'));var _0x490e71=[];return db['Setting'][_0xeeb5('0xc1')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x4f6b5c){var _0x3bb49b=_0x4f6b5c['enableEmailPreview'];_0x51dda2[_0xeeb5('0x33')](function(_0x86808d){_0x490e71['push'](updateMailInteraction(_0x86808d,_0x4d1ae6,_0x40b5ac,_0x3bb49b));});return BPromise['all'](_0x490e71);});});});})[_0xeeb5('0x2a')](function(_0xc52a07){_0x26b6bb[_0xeeb5('0xc2')]=_0xc52a07;return _0x26b6bb;})['then'](respondWithFilteredResult(_0x5d23cb,_0x13ac58))[_0xeeb5('0x39')](handleError(_0x5d23cb,null));};exports[_0xeeb5('0xc3')]=function(_0x4b1f1d,_0x572e89){var _0x4d6dab={'raw':![],'where':{'id':_0x4b1f1d[_0xeeb5('0xc4')]['id']}},_0x47435f={};_0x47435f[_0xeeb5('0x43')]=_[_0xeeb5('0x40')](db[_0xeeb5('0x35')][_0xeeb5('0x3b')]);_0x47435f['query']=_[_0xeeb5('0x40')](_0x4b1f1d[_0xeeb5('0x3f')]);_0x47435f[_0xeeb5('0x41')]=_[_0xeeb5('0x42')](_0x47435f[_0xeeb5('0x43')],_0x47435f[_0xeeb5('0x3f')]);_0x4d6dab[_0xeeb5('0x45')]=_[_0xeeb5('0x42')](_0x47435f[_0xeeb5('0x43')],qs['fields'](_0x4b1f1d['query']['fields']));_0x4d6dab[_0xeeb5('0x45')]=_0x4d6dab[_0xeeb5('0x45')][_0xeeb5('0x46')]?_0x4d6dab[_0xeeb5('0x45')]:_0x47435f[_0xeeb5('0x43')];if(_0x4b1f1d['query'][_0xeeb5('0xc5')]){_0x4d6dab['include']=[{'all':!![]}];}_0x4d6dab=_[_0xeeb5('0xc6')]({},_0x4d6dab,_0x4b1f1d[_0xeeb5('0xc7')]);return db['MailInteraction']['find'](_0x4d6dab)[_0xeeb5('0x2a')](handleEntityNotFound(_0x572e89,null))[_0xeeb5('0x2a')](respondWithResult(_0x572e89,null))['catch'](handleError(_0x572e89,null));};exports[_0xeeb5('0xc8')]=function(_0x5c92f0,_0x14da31){return db[_0xeeb5('0x35')][_0xeeb5('0xc8')](_0x5c92f0[_0xeeb5('0xc9')],{})['then'](respondWithResult(_0x14da31,0xc9))[_0xeeb5('0x39')](handleError(_0x14da31,null));};exports['update']=function(_0x4db17c,_0x26f837){if(_0x4db17c['body']['id']){delete _0x4db17c['body']['id'];}return db[_0xeeb5('0x35')][_0xeeb5('0x6e')]({'where':{'id':_0x4db17c[_0xeeb5('0xc4')]['id']}})[_0xeeb5('0x2a')](handleEntityNotFound(_0x26f837,null))['then'](saveUpdates(_0x4db17c[_0xeeb5('0xc9')],null))[_0xeeb5('0x2a')](respondWithResult(_0x26f837,null))[_0xeeb5('0x39')](handleError(_0x26f837,null));};exports[_0xeeb5('0x2b')]=function(_0x7b3392,_0x35faa0){return db[_0xeeb5('0x35')][_0xeeb5('0x6e')]({'where':{'id':_0x7b3392['params']['id']}})[_0xeeb5('0x2a')](handleEntityNotFound(_0x35faa0,null))[_0xeeb5('0x2a')](removeEntity(_0x35faa0,null))[_0xeeb5('0x39')](handleError(_0x35faa0,null));};exports['describe']=function(_0x4d4d67,_0x1bc1ab){return db[_0xeeb5('0x35')][_0xeeb5('0xca')]()['then'](respondWithResult(_0x1bc1ab,null))[_0xeeb5('0x39')](handleError(_0x1bc1ab,null));};exports[_0xeeb5('0xcb')]=function(_0x1880d5,_0x49b29b,_0x5bc110){return db[_0xeeb5('0xcc')][_0xeeb5('0x6e')]({'where':{'id':_0x1880d5[_0xeeb5('0xc4')]['id']}})['then'](handleEntityNotFound(_0x49b29b,null))['then'](function(_0x28bf7d){if(_0x28bf7d){return _0x28bf7d[_0xeeb5('0xcb')](_0x1880d5[_0xeeb5('0xc9')][_0xeeb5('0xcd')],_[_0xeeb5('0xce')](_0x1880d5['body'],[_0xeeb5('0xcd'),'id'])||{});}})[_0xeeb5('0x2a')](respondWithResult(_0x49b29b,null))[_0xeeb5('0x39')](handleError(_0x49b29b,null));};exports['getMessages']=function(_0x13817a,_0x3657c,_0x483657){var _0x1de2b3={'raw':![],'where':{}};var _0x47348f={};var _0x21016a={'count':0x0,'rows':[]};return db[_0xeeb5('0x35')][_0xeeb5('0xc1')]({'where':{'id':_0x13817a['params']['id']}})['then'](handleEntityNotFound(_0x3657c,null))[_0xeeb5('0x2a')](function(_0xdc2e86){if(_0xdc2e86){_0x47348f[_0xeeb5('0x43')]=_[_0xeeb5('0x40')](db[_0xeeb5('0xcc')][_0xeeb5('0x3b')]);_0x47348f['query']=_[_0xeeb5('0x40')](_0x13817a['query']);_0x47348f[_0xeeb5('0x41')]=_[_0xeeb5('0x42')](_0x47348f['model'],_0x47348f['query']);_0x1de2b3[_0xeeb5('0x45')]=_[_0xeeb5('0x42')](_0x47348f[_0xeeb5('0x43')],qs[_0xeeb5('0x44')](_0x13817a[_0xeeb5('0x3f')][_0xeeb5('0x44')]));_0x1de2b3[_0xeeb5('0x45')]=_0x1de2b3[_0xeeb5('0x45')][_0xeeb5('0x46')]?_0x1de2b3[_0xeeb5('0x45')]:_0x47348f[_0xeeb5('0x43')];if(!_0x13817a[_0xeeb5('0x3f')]['hasOwnProperty'](_0xeeb5('0x48'))){_0x1de2b3['limit']=qs[_0xeeb5('0x25')](_0x13817a['query']['limit']);_0x1de2b3[_0xeeb5('0x24')]=qs[_0xeeb5('0x24')](_0x13817a[_0xeeb5('0x3f')][_0xeeb5('0x24')]);}_0x1de2b3[_0xeeb5('0x95')]=qs[_0xeeb5('0x49')](_0x13817a[_0xeeb5('0x3f')][_0xeeb5('0x49')]);_0x1de2b3[_0xeeb5('0x4a')]=qs[_0xeeb5('0x41')](_[_0xeeb5('0x4b')](_0x13817a[_0xeeb5('0x3f')],_0x47348f['filters']));_0x1de2b3[_0xeeb5('0x4a')][_0xeeb5('0xc0')]=_0xdc2e86['id'];if(_0x13817a['query'][_0xeeb5('0x88')]){_0x1de2b3[_0xeeb5('0x4a')]=_[_0xeeb5('0xc6')](_0x1de2b3[_0xeeb5('0x4a')],{'$or':_[_0xeeb5('0x2e')](_0x1de2b3['attributes'],function(_0x34edda){var _0xf63c5={};_0xf63c5[_0x34edda]={'$like':'%'+_0x13817a['query']['filter']+'%'};return _0xf63c5;})});}if(_0x13817a[_0xeeb5('0x3f')][_0xeeb5('0x80')]){var _0x3afed0=_0x13817a[_0xeeb5('0x3f')][_0xeeb5('0x80')][_0xeeb5('0x32')](',');var _0x5f277a={};_0x5f277a[_0x3afed0[0x0]]={'$gte':moment(_0x3afed0[0x1])[_0xeeb5('0xcf')](_0xeeb5('0xd0'))};_0x1de2b3[_0xeeb5('0x4a')]=_['merge'](_0x1de2b3['where'],_0x5f277a);}_0x1de2b3=_['merge']({},_0x1de2b3,_0x13817a[_0xeeb5('0xc7')]);return db[_0xeeb5('0xcc')][_0xeeb5('0x23')]({'where':_0x1de2b3['where']})[_0xeeb5('0x2a')](function(_0x3127c5){_0x21016a['count']=_0x3127c5;if(_0x13817a[_0xeeb5('0x3f')][_0xeeb5('0xc5')]){_0x1de2b3[_0xeeb5('0xd1')]=[{'all':!![]}];}return db[_0xeeb5('0xcc')][_0xeeb5('0xd2')](_0x1de2b3);})['then'](function(_0x357e18){_0x21016a['rows']=_0x357e18;return _0x21016a;});}})[_0xeeb5('0x2a')](respondWithFilteredResult(_0x3657c,_0x1de2b3))[_0xeeb5('0x39')](handleError(_0x3657c,null));};exports[_0xeeb5('0xd3')]=function(_0x10be28,_0x333ae1,_0x5dccc5){return db[_0xeeb5('0x35')][_0xeeb5('0x6e')]({'where':{'id':_0x10be28[_0xeeb5('0xc4')]['id']}})['then'](handleEntityNotFound(_0x333ae1,null))[_0xeeb5('0x2a')](function(_0x3463b4){if(_0x3463b4){return _0x3463b4[_0xeeb5('0xd4')](_0x10be28[_0xeeb5('0xc9')]['ids'],_[_0xeeb5('0xce')](_0x10be28[_0xeeb5('0xc9')],[_0xeeb5('0xcd'),'id'])||{})['spread'](function(){return db[_0xeeb5('0xd5')][_0xeeb5('0xd2')]({'attributes':['id',_0xeeb5('0x2d'),_0xeeb5('0x4e')],'where':{'id':_0x10be28[_0xeeb5('0xc9')][_0xeeb5('0xcd')]}});})[_0xeeb5('0x2a')](function(_0x58c56c){socket['emit'](_0xeeb5('0xd6'),{'id':Number(_0x10be28[_0xeeb5('0xc4')]['id']),'tags':_0x58c56c||[]});return{'id':Number(_0x10be28[_0xeeb5('0xc4')]['id']),'tags':_0x58c56c||[]};});}})[_0xeeb5('0x2a')](respondWithResult(_0x333ae1,null))[_0xeeb5('0x39')](handleError(_0x333ae1,null));};exports[_0xeeb5('0xd7')]=function(_0x41adca,_0x56f678,_0x559f1f){return db[_0xeeb5('0x35')][_0xeeb5('0x6e')]({'where':{'id':_0x41adca['params']['id']}})[_0xeeb5('0x2a')](handleEntityNotFound(_0x56f678,null))[_0xeeb5('0x2a')](function(_0x118657){if(_0x118657){return _0x118657[_0xeeb5('0xd7')](_0x41adca[_0xeeb5('0x3f')][_0xeeb5('0xcd')]);}})['then'](respondWithStatusCode(_0x56f678,null))[_0xeeb5('0x39')](handleError(_0x56f678,null));};exports[_0xeeb5('0xd8')]=function(_0x2080ed,_0x2daeb6){var _0x78aa66=moment()['unix']()['toString']();var _0x354e2f=path[_0xeeb5('0xd9')](config[_0xeeb5('0xda')],_0xeeb5('0xdb'),'files',_0xeeb5('0xdc'));var _0x2b4cbc=path[_0xeeb5('0xd9')](config[_0xeeb5('0xda')],_0xeeb5('0xdb'),_0xeeb5('0xdd'),'attachments');var _0x5b12a9=path[_0xeeb5('0xd9')](_0x354e2f,_0x78aa66);var _0x417514=util[_0xeeb5('0xcf')](_0xeeb5('0xde'),_0x2080ed[_0xeeb5('0xc4')]['id'],_0x78aa66);var _0x4d24df=path[_0xeeb5('0xd9')](_0x354e2f,_0x417514);var _0x1572c7=[];if(_0x2080ed[_0xeeb5('0x3f')][_0xeeb5('0xdf')]){_0x1572c7[_0xeeb5('0x34')]({'model':db[_0xeeb5('0xe0')],'as':'Attachments','raw':!![]});}var _0x3009d3=[{'model':db[_0xeeb5('0xcc')],'as':_0xeeb5('0xe1'),'attributes':['id',_0xeeb5('0xc9'),_0xeeb5('0x4f'),'to','cc',_0xeeb5('0xe2'),_0xeeb5('0xe3'),_0xeeb5('0x7e')],'where':{'secret':![]},'order':qs[_0xeeb5('0x49')]('id'),'include':_0x1572c7}];return db['MailInteraction'][_0xeeb5('0x6e')]({'where':{'id':_0x2080ed['params']['id']},'include':_0x3009d3})['then'](handleEntityNotFound(_0x2daeb6,null))[_0xeeb5('0x2a')](function(_0x4b9009){if(_0x4b9009&&_0x4b9009[_0xeeb5('0xe1')]){var _0x1c3ed8=_0x4b9009['get']({'plain':!![]});fs[_0xeeb5('0xe4')](_0x5b12a9);return BPromise['each'](_0x1c3ed8[_0xeeb5('0xe1')],function(_0x5de2ce,_0x397c13){var _0xf1f93a={'from':_0x5de2ce[_0xeeb5('0x4f')],'to':_0x5de2ce['to'],'subject':_0x5de2ce[_0xeeb5('0xe3')],'html':_0x5de2ce[_0xeeb5('0xc9')],'headers':{'Date':moment(_0x5de2ce[_0xeeb5('0x7e')])[_0xeeb5('0xcf')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x5de2ce['cc']){_0xf1f93a[_0xeeb5('0xe5')]['Cc']=_0x5de2ce['cc'];}if(_0x5de2ce[_0xeeb5('0xe2')]){_0xf1f93a[_0xeeb5('0xe5')][_0xeeb5('0xe6')]=_0x5de2ce['bcc'];}return new BPromise(function(_0x493187,_0x4f58f5){if(_0x5de2ce[_0xeeb5('0xe7')]){for(var _0x4b62bd=0x0;_0x4b62bd<_0x5de2ce[_0xeeb5('0xe7')][_0xeeb5('0x46')];_0x4b62bd++){var _0x29b50e=_0x5de2ce['Attachments'][_0x4b62bd];var _0x53afc8=path[_0xeeb5('0xd9')](_0x2b4cbc,_0x29b50e[_0xeeb5('0xe8')]);if(fs[_0xeeb5('0xe9')](_0x53afc8)){_0xf1f93a[_0xeeb5('0xdf')]['push']({'name':_0x29b50e[_0xeeb5('0x2d')],'contentType':_0x29b50e[_0xeeb5('0x3d')],'data':fs[_0xeeb5('0xea')](_0x53afc8)});}}}emlformat[_0xeeb5('0xeb')](_0xf1f93a,function(_0x241a68,_0x2dde20){if(_0x241a68)return _0x4f58f5(_0x241a68);fs['writeFileSync'](path['join'](_0x5b12a9,util['format']('message%d.eml',_0x397c13)),_0x2dde20);return _0x493187(_0x2dde20);});});})[_0xeeb5('0x2a')](function(){return new BPromise(function(_0xc5070e,_0x24837f){zipdir(_0x5b12a9,{'saveTo':_0x4d24df},function(_0x561abd,_0x2ec1ef){if(_0x561abd)return _0x24837f(_0x561abd);return _0xc5070e(_0x2ec1ef);});})[_0xeeb5('0x2a')](function(){return new BPromise(function(_0x1645cf,_0x1ef8a1){rimraf(_0x5b12a9,function(_0x32490c){if(_0x32490c)_0x1ef8a1(_0x32490c);return _0x1645cf();});});})[_0xeeb5('0x2a')](function(){return _0x2daeb6[_0xeeb5('0xd8')](_0x4d24df,_0x417514,function(_0xdb718e){if(_0xdb718e){console[_0xeeb5('0xec')]('err',_0xdb718e);}else{fs['unlinkSync'](_0x4d24df);}});});});}else{return _0x2daeb6['sendStatus'](0xc8);}})[_0xeeb5('0x39')](handleError(_0x2daeb6,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index f76cf42..75c286b 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 _0x4afe=['length','emit','catch','hasOwnProperty','exports','events','MailInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0x4afe,0x8d));var _0xe4af=function(_0x2bdc3d,_0x20bd00){_0x2bdc3d=_0x2bdc3d-0x0;var _0x2aacb6=_0x4afe[_0x2bdc3d];return _0x2aacb6;};'use strict';var EventEmitter=require(_0xe4af('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xe4af('0x1')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe4af('0x2')](0x0);var events={'afterCreate':_0xe4af('0x3'),'afterUpdate':_0xe4af('0x4'),'afterDestroy':_0xe4af('0x5')};function emitEvent(_0x1269d5){return function(_0x5e8d8f,_0x43e7ec,_0xc19cc6){_0x5e8d8f[_0xe4af('0x6')]({'attributes':['id'],'raw':!![]})[_0xe4af('0x7')](function(_0xc37919){_0x5e8d8f[_0xe4af('0x8')](_0xe4af('0x9'),_0xc37919[_0xe4af('0xa')](function(_0xf87719){return{'id':_0xf87719['id']};}));return MailMessage[_0xe4af('0xb')]({'where':{'MailInteractionId':_0x5e8d8f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe4af('0x7')](function(_0x16c6f9){_0x5e8d8f[_0xe4af('0x8')]('unreadMessages',_0x16c6f9[_0xe4af('0xc')]);MailInteractionEvents[_0xe4af('0xd')](_0x1269d5+':'+_0x5e8d8f['id'],_0x5e8d8f);MailInteractionEvents['emit'](_0x1269d5,_0x5e8d8f);_0xc19cc6(null);})[_0xe4af('0xe')](_0xc19cc6(null));};}for(var e in events){if(events[_0xe4af('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xe4af('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0x9d7f=['hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty'];(function(_0x584b3f,_0x3b21a5){var _0x359088=function(_0x30a07a){while(--_0x30a07a){_0x584b3f['push'](_0x584b3f['shift']());}};_0x359088(++_0x3b21a5);}(_0x9d7f,0x1c9));var _0xf9d7=function(_0x10833e,_0x1218f3){_0x10833e=_0x10833e-0x0;var _0x5a7d8a=_0x9d7f[_0x10833e];return _0x5a7d8a;};'use strict';var EventEmitter=require(_0xf9d7('0x0'));var MailInteraction=require(_0xf9d7('0x1'))['db'][_0xf9d7('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xf9d7('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf9d7('0x4')](0x0);var events={'afterCreate':_0xf9d7('0x5'),'afterUpdate':_0xf9d7('0x6'),'afterDestroy':_0xf9d7('0x7')};function emitEvent(_0x376aa2){return function(_0x2318d5,_0x320d6d,_0x10568e){_0x2318d5[_0xf9d7('0x8')]({'attributes':['id'],'raw':!![]})[_0xf9d7('0x9')](function(_0x1787ad){_0x2318d5[_0xf9d7('0xa')](_0xf9d7('0xb'),_0x1787ad[_0xf9d7('0xc')](function(_0x92d241){return{'id':_0x92d241['id']};}));return MailMessage[_0xf9d7('0xd')]({'where':{'MailInteractionId':_0x2318d5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x45c7fb){_0x2318d5[_0xf9d7('0xa')]('unreadMessages',_0x45c7fb[_0xf9d7('0xe')]);MailInteractionEvents['emit'](_0x376aa2+':'+_0x2318d5['id'],_0x2318d5);MailInteractionEvents[_0xf9d7('0xf')](_0x376aa2,_0x2318d5);_0x10568e(null);})[_0xf9d7('0x10')](_0x10568e(null));};}for(var e in events){if(events[_0xf9d7('0x11')](e)){var event=events[e];MailInteraction[_0xf9d7('0x12')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 42f29bc..36fa92f 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 _0x6c50=['changed','substatusAt','substatus','format','closedAt','models','get','closed','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3769cd,_0x324e99){var _0x5ed793=function(_0x1316f6){while(--_0x1316f6){_0x3769cd['push'](_0x3769cd['shift']());}};_0x5ed793(++_0x324e99);}(_0x6c50,0xa4));var _0x06c5=function(_0x820316,_0x50d6a6){_0x820316=_0x820316-0x0;var _0x406b4e=_0x6c50[_0x820316];return _0x406b4e;};'use strict';var _=require(_0x06c5('0x0'));var util=require(_0x06c5('0x1'));var logger=require(_0x06c5('0x2'))(_0x06c5('0x3'));var moment=require('moment');var BPromise=require(_0x06c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x06c5('0x5'));var rimraf=require(_0x06c5('0x6'));var config=require(_0x06c5('0x7'));var attributes=require(_0x06c5('0x8'));module[_0x06c5('0x9')]=function(_0x463f4f,_0x3f5b56){return _0x463f4f[_0x06c5('0xa')](_0x06c5('0xb'),attributes,{'tableName':_0x06c5('0xc'),'paranoid':![],'indexes':[{'name':_0x06c5('0xd'),'fields':['subject','to'],'type':_0x06c5('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x222e05,_0x3010af,_0x18f1e9){if(_0x222e05['substatus']){_0x222e05['substatusAt']=moment()['format'](_0x06c5('0xf'));}if(_0x222e05['closed']){_0x222e05['closedAt']=moment()['format'](_0x06c5('0xf'));}_0x18f1e9(null,_0x3010af);},'beforeUpdate':function(_0x5613a8,_0x319710,_0x2d7502){if(_0x5613a8[_0x06c5('0x10')]('substatus')){_0x5613a8[_0x06c5('0x11')]=_0x5613a8[_0x06c5('0x12')]?moment()[_0x06c5('0x13')](_0x06c5('0xf')):null;}if(_0x5613a8['changed']('closed')){_0x5613a8[_0x06c5('0x14')]=moment()[_0x06c5('0x13')](_0x06c5('0xf'));_0x5613a8['substatus']=null;_0x5613a8[_0x06c5('0x11')]=null;}_0x2d7502(null,_0x5613a8);},'afterUpdate':function(_0x117371,_0x4ba5df,_0x3ab0f7){var _0x9045e6=_0x463f4f[_0x06c5('0x15')];var _0xb48b48=_0x117371[_0x06c5('0x16')]({'plain':!![]});if(_0xb48b48[_0x06c5('0x17')]){return _0x9045e6[_0x06c5('0x18')][_0x06c5('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0xb48b48['id']}})[_0x06c5('0x1a')](function(){_0x3ab0f7();})[_0x06c5('0x1b')](function(_0x30dc0f){_0x3ab0f7(_0x30dc0f);});}else{_0x3ab0f7();}}},'charset':_0x06c5('0x1c'),'collate':_0x06c5('0x1d')});}; \ No newline at end of file +var _0x5cbc=['define','mail_interactions','subject','FULLTEXT','substatus','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','substatusAt','changed','closed','models','get','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x558615,_0x1eb496){var _0x1e032a=function(_0x538f1d){while(--_0x538f1d){_0x558615['push'](_0x558615['shift']());}};_0x1e032a(++_0x1eb496);}(_0x5cbc,0xfb));var _0xc5cb=function(_0x87f1c4,_0x597151){_0x87f1c4=_0x87f1c4-0x0;var _0x17de95=_0x5cbc[_0x87f1c4];return _0x17de95;};'use strict';var _=require(_0xc5cb('0x0'));var util=require('util');var logger=require(_0xc5cb('0x1'))(_0xc5cb('0x2'));var moment=require(_0xc5cb('0x3'));var BPromise=require(_0xc5cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5cb('0x5'));var rimraf=require(_0xc5cb('0x6'));var config=require(_0xc5cb('0x7'));var attributes=require('./mailInteraction.attributes');module[_0xc5cb('0x8')]=function(_0x4c9a0f,_0x157991){return _0x4c9a0f[_0xc5cb('0x9')]('MailInteraction',attributes,{'tableName':_0xc5cb('0xa'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xc5cb('0xb'),'to'],'type':_0xc5cb('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45db3d,_0x45da1d,_0x5601e7){if(_0x45db3d[_0xc5cb('0xd')]){_0x45db3d['substatusAt']=moment()[_0xc5cb('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x45db3d['closed']){_0x45db3d[_0xc5cb('0xf')]=moment()['format'](_0xc5cb('0x10'));}_0x5601e7(null,_0x45da1d);},'beforeUpdate':function(_0x75eb33,_0x1e5c48,_0x57de51){if(_0x75eb33['changed'](_0xc5cb('0xd'))){_0x75eb33[_0xc5cb('0x11')]=_0x75eb33['substatus']?moment()[_0xc5cb('0xe')](_0xc5cb('0x10')):null;}if(_0x75eb33[_0xc5cb('0x12')](_0xc5cb('0x13'))){_0x75eb33[_0xc5cb('0xf')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x75eb33[_0xc5cb('0xd')]=null;_0x75eb33[_0xc5cb('0x11')]=null;}_0x57de51(null,_0x75eb33);},'afterUpdate':function(_0x431336,_0x1ded7c,_0x486638){var _0x1dc19b=_0x4c9a0f[_0xc5cb('0x14')];var _0x3eb9f0=_0x431336[_0xc5cb('0x15')]({'plain':!![]});if(_0x3eb9f0['closed']){return _0x1dc19b['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x3eb9f0['id']}})[_0xc5cb('0x16')](function(){_0x486638();})[_0xc5cb('0x17')](function(_0x5c4e41){_0x486638(_0x5c4e41);});}else{_0x486638();}}},'charset':_0xc5cb('0x18'),'collate':_0xc5cb('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 2debdea..ae613e1 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 _0xfd6f=['then','info','request\x20sent','debug','stringify','error','MailInteraction,\x20%s,\x20%s','message','catch','MailInteraction','update','body','options','attributes','UpdateMailInteraction','AddTagsToMailInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./mailInteraction.socket','register'];(function(_0x3d873a,_0x347904){var _0x93a5fa=function(_0x4a3d4d){while(--_0x4a3d4d){_0x3d873a['push'](_0x3d873a['shift']());}};_0x93a5fa(++_0x347904);}(_0xfd6f,0x19d));var _0xffd6=function(_0x5b293f,_0xc09fd7){_0x5b293f=_0x5b293f-0x0;var _0x3dcab9=_0xfd6f[_0x5b293f];return _0x3dcab9;};'use strict';var _=require(_0xffd6('0x0'));var util=require(_0xffd6('0x1'));var moment=require(_0xffd6('0x2'));var BPromise=require(_0xffd6('0x3'));var rs=require(_0xffd6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd6('0x5'))['db'];var utils=require(_0xffd6('0x6'));var logger=require(_0xffd6('0x7'))(_0xffd6('0x8'));var config=require('../../config/environment');var jayson=require(_0xffd6('0x9'));var client=jayson[_0xffd6('0xa')][_0xffd6('0xb')]({'port':0x232a});config[_0xffd6('0xc')]=_['defaults'](config[_0xffd6('0xc')],{'host':_0xffd6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xffd6('0xe'))[_0xffd6('0xf')](socket);function respondWithRpcPromise(_0x4721e1,_0x3b6caf,_0x4b1612){return new BPromise(function(_0x103aac,_0x5862f0){return client['request'](_0x4721e1,_0x4b1612)[_0xffd6('0x10')](function(_0x23b7f0){logger[_0xffd6('0x11')]('MailInteraction,\x20%s,\x20%s',_0x3b6caf,_0xffd6('0x12'));logger[_0xffd6('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3b6caf,_0xffd6('0x12'),JSON[_0xffd6('0x14')](_0x23b7f0));if(_0x23b7f0[_0xffd6('0x15')]){if(_0x23b7f0[_0xffd6('0x15')]['code']===0x1f4){logger['error'](_0xffd6('0x16'),_0x3b6caf,_0x23b7f0[_0xffd6('0x15')][_0xffd6('0x17')]);return _0x5862f0(_0x23b7f0['error'][_0xffd6('0x17')]);}logger[_0xffd6('0x15')]('MailInteraction,\x20%s,\x20%s',_0x3b6caf,_0x23b7f0[_0xffd6('0x15')]['message']);return _0x103aac(_0x23b7f0[_0xffd6('0x15')][_0xffd6('0x17')]);}else{logger[_0xffd6('0x11')](_0xffd6('0x16'),_0x3b6caf,_0xffd6('0x12'));_0x103aac(_0x23b7f0['result'][_0xffd6('0x17')]);}})[_0xffd6('0x18')](function(_0x44ac8a){logger[_0xffd6('0x15')]('MailInteraction,\x20%s,\x20%s',_0x3b6caf,_0x44ac8a);_0x5862f0(_0x44ac8a);});});}exports['UpdateMailInteraction']=function(_0x1d0b5f){var _0x5d3bb0=this;return new Promise(function(_0x5599d3,_0x453e4e){return db[_0xffd6('0x19')][_0xffd6('0x1a')](_0x1d0b5f[_0xffd6('0x1b')],{'raw':_0x1d0b5f[_0xffd6('0x1c')]?_0x1d0b5f[_0xffd6('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d0b5f[_0xffd6('0x1c')]?_0x1d0b5f[_0xffd6('0x1c')]['where']||null:null,'attributes':_0x1d0b5f[_0xffd6('0x1c')]?_0x1d0b5f['options'][_0xffd6('0x1d')]||null:null,'limit':_0x1d0b5f[_0xffd6('0x1c')]?_0x1d0b5f[_0xffd6('0x1c')]['limit']||null:null})['then'](function(_0x4b75c6){logger[_0xffd6('0x11')](_0xffd6('0x1e'),_0x1d0b5f);logger[_0xffd6('0x13')]('UpdateMailInteraction',_0x1d0b5f,JSON[_0xffd6('0x14')](_0x4b75c6));_0x5599d3(_0x4b75c6);})[_0xffd6('0x18')](function(_0x12352c){logger[_0xffd6('0x15')](_0xffd6('0x1e'),_0x12352c['message'],_0x1d0b5f);_0x453e4e(_0x5d3bb0[_0xffd6('0x15')](0x1f4,_0x12352c[_0xffd6('0x17')]));});});};exports[_0xffd6('0x1f')]=function(_0xb11654){return new Promise(function(_0x1f6ce7,_0x434ee0){return db[_0xffd6('0x19')][_0xffd6('0x20')]({'where':_0xb11654[_0xffd6('0x1c')]?_0xb11654[_0xffd6('0x1c')][_0xffd6('0x21')]||null:null})['then'](function(_0x22021d){if(_0x22021d){return _0x22021d[_0xffd6('0x22')](_0xb11654[_0xffd6('0x1b')][_0xffd6('0x23')],_[_0xffd6('0x24')](_0xb11654[_0xffd6('0x1b')],['ids','id'])||{});}})[_0xffd6('0x25')](function(_0x263fa9){logger[_0xffd6('0x11')](_0xffd6('0x26'),_0xb11654);logger[_0xffd6('0x13')](_0xffd6('0x26'),_0xb11654,JSON[_0xffd6('0x14')](_0x263fa9));_0x1f6ce7(_0x263fa9);})[_0xffd6('0x18')](function(_0x443028){logger[_0xffd6('0x15')](_0xffd6('0x26'),_0x443028[_0xffd6('0x17')],_0xb11654);_0x434ee0(_this['error'](0x1f4,_0x443028[_0xffd6('0x17')]));});});}; \ No newline at end of file +var _0xd4bd=['../../config/environment','http','defaults','redis','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x31080a,_0x55b5cd){var _0x58d2fc=function(_0x446558){while(--_0x446558){_0x31080a['push'](_0x31080a['shift']());}};_0x58d2fc(++_0x55b5cd);}(_0xd4bd,0x15f));var _0xdd4b=function(_0x5ad18c,_0x340ac2){_0x5ad18c=_0x5ad18c-0x0;var _0x23d3bb=_0xd4bd[_0x5ad18c];return _0x23d3bb;};'use strict';var _=require(_0xdd4b('0x0'));var util=require(_0xdd4b('0x1'));var moment=require(_0xdd4b('0x2'));var BPromise=require(_0xdd4b('0x3'));var rs=require(_0xdd4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd4b('0x5'))['db'];var utils=require(_0xdd4b('0x6'));var logger=require(_0xdd4b('0x7'))(_0xdd4b('0x8'));var config=require(_0xdd4b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdd4b('0xa')]({'port':0x232a});config['redis']=_[_0xdd4b('0xb')](config[_0xdd4b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd4b('0xc')]));require(_0xdd4b('0xd'))['register'](socket);function respondWithRpcPromise(_0x13918e,_0x14be78,_0x44012e){return new BPromise(function(_0x4803eb,_0x7e077e){return client[_0xdd4b('0xe')](_0x13918e,_0x44012e)[_0xdd4b('0xf')](function(_0x16c146){logger[_0xdd4b('0x10')](_0xdd4b('0x11'),_0x14be78,_0xdd4b('0x12'));logger[_0xdd4b('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x14be78,_0xdd4b('0x12'),JSON['stringify'](_0x16c146));if(_0x16c146[_0xdd4b('0x14')]){if(_0x16c146[_0xdd4b('0x14')][_0xdd4b('0x15')]===0x1f4){logger[_0xdd4b('0x14')](_0xdd4b('0x11'),_0x14be78,_0x16c146[_0xdd4b('0x14')]['message']);return _0x7e077e(_0x16c146['error'][_0xdd4b('0x16')]);}logger[_0xdd4b('0x14')](_0xdd4b('0x11'),_0x14be78,_0x16c146[_0xdd4b('0x14')][_0xdd4b('0x16')]);return _0x4803eb(_0x16c146[_0xdd4b('0x14')][_0xdd4b('0x16')]);}else{logger['info'](_0xdd4b('0x11'),_0x14be78,_0xdd4b('0x12'));_0x4803eb(_0x16c146[_0xdd4b('0x17')]['message']);}})[_0xdd4b('0x18')](function(_0x4bdfa6){logger['error'](_0xdd4b('0x11'),_0x14be78,_0x4bdfa6);_0x7e077e(_0x4bdfa6);});});}exports[_0xdd4b('0x19')]=function(_0x58aa9d){var _0x1bfea7=this;return new Promise(function(_0x2202d1,_0xf6eb51){return db[_0xdd4b('0x1a')][_0xdd4b('0x1b')](_0x58aa9d[_0xdd4b('0x1c')],{'raw':_0x58aa9d[_0xdd4b('0x1d')]?_0x58aa9d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58aa9d[_0xdd4b('0x1d')]?_0x58aa9d[_0xdd4b('0x1d')][_0xdd4b('0x1e')]||null:null,'attributes':_0x58aa9d['options']?_0x58aa9d[_0xdd4b('0x1d')][_0xdd4b('0x1f')]||null:null,'limit':_0x58aa9d[_0xdd4b('0x1d')]?_0x58aa9d[_0xdd4b('0x1d')][_0xdd4b('0x20')]||null:null})[_0xdd4b('0xf')](function(_0x4b2013){logger['info']('UpdateMailInteraction',_0x58aa9d);logger[_0xdd4b('0x13')](_0xdd4b('0x19'),_0x58aa9d,JSON['stringify'](_0x4b2013));_0x2202d1(_0x4b2013);})['catch'](function(_0x2d4f73){logger[_0xdd4b('0x14')](_0xdd4b('0x19'),_0x2d4f73[_0xdd4b('0x16')],_0x58aa9d);_0xf6eb51(_0x1bfea7[_0xdd4b('0x14')](0x1f4,_0x2d4f73['message']));});});};exports[_0xdd4b('0x21')]=function(_0x37b074){return new Promise(function(_0x31a22b,_0x1f70b3){return db[_0xdd4b('0x1a')][_0xdd4b('0x22')]({'where':_0x37b074['options']?_0x37b074[_0xdd4b('0x1d')][_0xdd4b('0x1e')]||null:null})[_0xdd4b('0xf')](function(_0x16540c){if(_0x16540c){return _0x16540c[_0xdd4b('0x23')](_0x37b074[_0xdd4b('0x1c')][_0xdd4b('0x24')],_[_0xdd4b('0x25')](_0x37b074[_0xdd4b('0x1c')],[_0xdd4b('0x24'),'id'])||{});}})[_0xdd4b('0x26')](function(_0x20e8e8){logger[_0xdd4b('0x10')](_0xdd4b('0x27'),_0x37b074);logger[_0xdd4b('0x13')](_0xdd4b('0x27'),_0x37b074,JSON['stringify'](_0x20e8e8));_0x31a22b(_0x20e8e8);})['catch'](function(_0x235fbf){logger[_0xdd4b('0x14')](_0xdd4b('0x27'),_0x235fbf['message'],_0x37b074);_0x1f70b3(_this[_0xdd4b('0x14')](0x1f4,_0x235fbf[_0xdd4b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index d0a194d..f5bde7b 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 _0x171b=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x294f5a,_0xb51a27){var _0x50e2d8=function(_0x4c37d1){while(--_0x4c37d1){_0x294f5a['push'](_0x294f5a['shift']());}};_0x50e2d8(++_0xb51a27);}(_0x171b,0xf7));var _0xb171=function(_0x43b4f6,_0x5f4f4d){_0x43b4f6=_0x43b4f6-0x0;var _0x4f9f00=_0x171b[_0x43b4f6];return _0x4f9f00;};'use strict';var MailInteractionEvents=require(_0xb171('0x0'));var events=[_0xb171('0x1'),_0xb171('0x2'),_0xb171('0x3')];function createListener(_0x538ddc,_0x16346b){return function(_0x9cec6f){_0x16346b[_0xb171('0x4')](_0x538ddc,_0x9cec6f);};}function removeListener(_0x21829f,_0xdd2207){return function(){MailInteractionEvents[_0xb171('0x5')](_0x21829f,_0xdd2207);};}exports[_0xb171('0x6')]=function(_0x5d9068){for(var _0x370de5=0x0,_0x16b399=events[_0xb171('0x7')];_0x370de5<_0x16b399;_0x370de5++){var _0x5a437d=events[_0x370de5];var _0x36e2ea=createListener(_0xb171('0x8')+_0x5a437d,_0x5d9068);MailInteractionEvents['on'](_0x5a437d,_0x36e2ea);}}; \ No newline at end of file +var _0x13e1=['removeListener','length','mailInteraction:','./mailInteraction.events','remove','update'];(function(_0x2b6fe6,_0x24343f){var _0x5cadc9=function(_0xb7405c){while(--_0xb7405c){_0x2b6fe6['push'](_0x2b6fe6['shift']());}};_0x5cadc9(++_0x24343f);}(_0x13e1,0x14d));var _0x113e=function(_0xe9ae46,_0x3a884b){_0xe9ae46=_0xe9ae46-0x0;var _0xc47b00=_0x13e1[_0xe9ae46];return _0xc47b00;};'use strict';var MailInteractionEvents=require(_0x113e('0x0'));var events=['save',_0x113e('0x1'),_0x113e('0x2')];function createListener(_0x259758,_0x522fda){return function(_0x6db96d){_0x522fda['emit'](_0x259758,_0x6db96d);};}function removeListener(_0x588f31,_0x16d243){return function(){MailInteractionEvents[_0x113e('0x3')](_0x588f31,_0x16d243);};}exports['register']=function(_0x57f64f){for(var _0x178912=0x0,_0x321f42=events[_0x113e('0x4')];_0x178912<_0x321f42;_0x178912++){var _0x12e2e8=events[_0x178912];var _0x26d2bc=createListener(_0x113e('0x5')+_0x12e2e8,_0x57f64f);MailInteractionEvents['on'](_0x12e2e8,_0x26d2bc);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index ba18f94..b9b1020 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 _0x008c=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','tracked','mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d54b2,_0x3ac77d){var _0xb61eb=function(_0x31b5b2){while(--_0x31b5b2){_0x1d54b2['push'](_0x1d54b2['shift']());}};_0xb61eb(++_0x3ac77d);}(_0x008c,0x188));var _0xc008=function(_0x1739e3,_0x31f4bf){_0x1739e3=_0x1739e3-0x0;var _0x238d44=_0x008c[_0x1739e3];return _0x238d44;};'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 auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xc008('0xa')](),interaction[_0xc008('0x10')]('mail',_0xc008('0x11')),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router[_0xc008('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router['put'](_0xc008('0x16'),auth[_0xc008('0xa')](),controller[_0xc008('0x17')]);router[_0xc008('0x18')](_0xc008('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xedd9=['get','isAuthenticated','index','/:id','show','/:id/download','download','post','tracked','mail','create','put','update','/:id/accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x31cbf6,_0x38c215){var _0x4d1b5c=function(_0x55592b){while(--_0x55592b){_0x31cbf6['push'](_0x31cbf6['shift']());}};_0x4d1b5c(++_0x38c215);}(_0xedd9,0xfc));var _0x9edd=function(_0x1c6b05,_0x56c882){_0x1c6b05=_0x1c6b05-0x0;var _0x26d716=_0xedd9[_0x1c6b05];return _0x26d716;};'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 auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./mailMessage.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/describe',auth[_0x9edd('0x9')](),controller['describe']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth['isAuthenticated'](),controller[_0x9edd('0xe')]);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'mailmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0x9')](),controller['accept']);router[_0x9edd('0x13')](_0x9edd('0x16'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 69d5585..bdc7276 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 _0xa0a3=['medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','lodash','exports','long','TEXT'];(function(_0x52b649,_0x548706){var _0x1e82a2=function(_0x5da202){while(--_0x5da202){_0x52b649['push'](_0x52b649['shift']());}};_0x1e82a2(++_0x548706);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x1f399f,_0x152316){_0x1f399f=_0x1f399f-0x0;var _0x33315d=_0xa0a3[_0x1f399f];return _0x33315d;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3a0a('0x0'));module[_0x3a0a('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3a0a('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3a0a('0x3')](_0x3a0a('0x4'))},'read':{'type':Sequelize[_0x3a0a('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3a0a('0x6')]('in',_0x3a0a('0x7')),'defaultValue':_0x3a0a('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3a0a('0x8')](0x1fe)},'from':{'type':Sequelize[_0x3a0a('0x8')]},'to':{'type':Sequelize[_0x3a0a('0x3')](_0x3a0a('0x2'))},'cc':{'type':Sequelize[_0x3a0a('0x3')](_0x3a0a('0x2'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x3a0a('0x3')]},'sentAt':{'type':Sequelize[_0x3a0a('0x9')]},'attach':{'type':Sequelize[_0x3a0a('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3a0a('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3a0a('0x9')]},'originTo':{'type':Sequelize[_0x3a0a('0x3')](_0x3a0a('0x2'))},'originCc':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file +var _0x6dc0=['STRING','DATE','sequelize','lodash','exports','long','TEXT','medium','BOOLEAN','out'];(function(_0x1b3891,_0x13b0f7){var _0x244b6e=function(_0x11e6e3){while(--_0x11e6e3){_0x1b3891['push'](_0x1b3891['shift']());}};_0x244b6e(++_0x13b0f7);}(_0x6dc0,0xb6));var _0x06dc=function(_0x1c5793,_0x2027ee){_0x1c5793=_0x1c5793-0x0;var _0x561815=_0x6dc0[_0x1c5793];return _0x561815;};'use strict';var Sequelize=require(_0x06dc('0x0'));var _=require(_0x06dc('0x1'));module[_0x06dc('0x2')]={'body':{'type':Sequelize['TEXT'](_0x06dc('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x06dc('0x4')](_0x06dc('0x5'))},'read':{'type':Sequelize[_0x06dc('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x06dc('0x7')),'defaultValue':_0x06dc('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x06dc('0x8')]},'to':{'type':Sequelize['TEXT'](_0x06dc('0x3'))},'cc':{'type':Sequelize[_0x06dc('0x4')](_0x06dc('0x3'))},'bcc':{'type':Sequelize[_0x06dc('0x4')](_0x06dc('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x06dc('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x06dc('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x06dc('0x3'))},'originCc':{'type':Sequelize[_0x06dc('0x4')](_0x06dc('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index cd692ee..ef70023 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 _0x4539=['sort','where','filter','merge','VIRTUAL','name','options','count','include','findAll','rows','show','params','keys','fields','includeAll','find','body','describe','create','out','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','user','auth','pass','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','channel','EventManager','acceptmessage','mail-interactions','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interface','event','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','bcc','subject','createdAt','Attachment','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','push','readFileSync','build','writeFileSync','log','unlinkSync','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','stack','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order'];(function(_0x7a4f0e,_0x308afc){var _0x447521=function(_0x6c33e9){while(--_0x6c33e9){_0x7a4f0e['push'](_0x7a4f0e['shift']());}};_0x447521(++_0x308afc);}(_0x4539,0x10c));var _0x9453=function(_0x3e1b62,_0xf643cb){_0x3e1b62=_0x3e1b62-0x0;var _0x3c5ce7=_0x4539[_0x3e1b62];return _0x3c5ce7;};'use strict';var pdf=require(_0x9453('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9453('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9453('0x2'));var moment=require(_0x9453('0x3'));var BPromise=require(_0x9453('0x4'));var Mustache=require(_0x9453('0x5'));var util=require(_0x9453('0x6'));var path=require(_0x9453('0x7'));var sox=require(_0x9453('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9453('0x9'));var squel=require(_0x9453('0xa'));var crypto=require(_0x9453('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9453('0xc'));var Papa=require(_0x9453('0xd'));var Redis=require(_0x9453('0xe'));var authService=require(_0x9453('0xf'));var qs=require(_0x9453('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9453('0x11'));var logger=require(_0x9453('0x12'))('api');var utils=require(_0x9453('0x13'));var config=require(_0x9453('0x14'));var licenseUtil=require(_0x9453('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9453('0x16')](config[_0x9453('0x17')],{'host':_0x9453('0x18'),'port':0x18eb});var socket=require(_0x9453('0x19'))(new Redis(config[_0x9453('0x17')]));require('./mailMessage.socket')[_0x9453('0x1a')](socket);var jayson=require(_0x9453('0x1b'));var client=jayson[_0x9453('0x1c')][_0x9453('0x1d')]({'port':0x232c});var client9003=jayson[_0x9453('0x1c')]['http']({'port':0x232b});var client9002=jayson[_0x9453('0x1c')][_0x9453('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x26beb4,_0xcb8244,_0x561fa9,_0x488f4b){return new BPromise(function(_0x20c08c,_0x48199e){var _0x30ab30=_0x488f4b||client;return _0x30ab30['request'](_0x26beb4,_0x561fa9)['then'](function(_0x1e649e){logger[_0x9453('0x1e')](_0x9453('0x1f'),_0xcb8244,_0x9453('0x20'));logger[_0x9453('0x21')](_0x9453('0x22'),_0xcb8244,'request\x20sent',JSON[_0x9453('0x23')](_0x1e649e));if(_0x1e649e[_0x9453('0x24')]){if(_0x1e649e['error'][_0x9453('0x25')]===0x1f4){logger[_0x9453('0x24')](_0x9453('0x1f'),_0xcb8244,_0x1e649e[_0x9453('0x24')][_0x9453('0x26')]);return _0x48199e(_0x1e649e['error'][_0x9453('0x26')]);}logger[_0x9453('0x24')](_0x9453('0x1f'),_0xcb8244,_0x1e649e[_0x9453('0x24')][_0x9453('0x26')]);return _0x20c08c(_0x1e649e[_0x9453('0x24')][_0x9453('0x26')]);}else{logger['info'](_0x9453('0x1f'),_0xcb8244,_0x9453('0x20'));_0x20c08c(_0x1e649e[_0x9453('0x27')][_0x9453('0x26')]);}})[_0x9453('0x28')](function(_0x5c2eb6){logger[_0x9453('0x24')]('MailMessage,\x20%s,\x20%s',_0xcb8244,_0x5c2eb6);_0x48199e(_0x5c2eb6);});});}function respondWithStatusCode(_0x48d44e,_0x1e68ae){_0x1e68ae=_0x1e68ae||0xcc;return function(_0xc7acfe){if(_0xc7acfe){return _0x48d44e[_0x9453('0x29')](_0x1e68ae);}return _0x48d44e['status'](_0x1e68ae)[_0x9453('0x2a')]();};}function respondWithResult(_0x3c62fc,_0x2faf8d){_0x2faf8d=_0x2faf8d||0xc8;return function(_0x535cca){if(_0x535cca){return _0x3c62fc[_0x9453('0x2b')](_0x2faf8d)[_0x9453('0x2c')](_0x535cca);}};}function respondWithFilteredResult(_0x283e2e,_0x4e73df){return function(_0x20c947){if(_0x20c947){var _0x11196a=_0x20c947['count'],_0x5b0b7e=_0x4e73df[_0x9453('0x2d')],_0x5697fc=_0x4e73df[_0x9453('0x2d')]+_0x4e73df[_0x9453('0x2e')],_0x18103d;if(_0x5697fc>=_0x11196a){_0x5697fc=_0x11196a;_0x18103d=0xc8;}else{_0x18103d=0xce;}_0x283e2e[_0x9453('0x2b')](_0x18103d);return _0x283e2e['set'](_0x9453('0x2f'),_0x5b0b7e+'-'+_0x5697fc+'/'+_0x11196a)['json'](_0x20c947);}return null;};}function patchUpdates(_0x49d82a){return function(_0x178333){try{jsonpatch['apply'](_0x178333,_0x49d82a,!![]);}catch(_0x42ddea){return BPromise[_0x9453('0x30')](_0x42ddea);}return _0x178333[_0x9453('0x31')]();};}function saveUpdates(_0x347dee,_0x539c31){return function(_0x100f4e){if(_0x100f4e){return _0x100f4e[_0x9453('0x32')](_0x347dee)[_0x9453('0x33')](function(_0x35550a){return _0x35550a;});}return null;};}function removeEntity(_0x453869,_0x34902d){return function(_0xb99de4){if(_0xb99de4){return _0xb99de4[_0x9453('0x34')]()[_0x9453('0x33')](function(){_0x453869[_0x9453('0x2b')](0xcc)[_0x9453('0x2a')]();});}};}function handleEntityNotFound(_0x55749d,_0x5e1d49){return function(_0x1b7248){if(!_0x1b7248){_0x55749d[_0x9453('0x29')](0x194);}return _0x1b7248;};}function handleError(_0xb56f8,_0x35a8f0){_0x35a8f0=_0x35a8f0||0x1f4;return function(_0x2efb5d){logger[_0x9453('0x24')](_0x2efb5d[_0x9453('0x35')]);if(_0x2efb5d['name']){delete _0x2efb5d['name'];}_0xb56f8[_0x9453('0x2b')](_0x35a8f0)[_0x9453('0x36')](_0x2efb5d);};}exports[_0x9453('0x37')]=function(_0xe8a3d,_0x3dc2bf){var _0x316756={},_0x5c18b4={},_0x2780c3={'count':0x0,'rows':[]};var _0x4b882a=_[_0x9453('0x38')](db[_0x9453('0x39')][_0x9453('0x3a')],function(_0x439882){return{'name':_0x439882[_0x9453('0x3b')],'type':_0x439882[_0x9453('0x3c')][_0x9453('0x3d')]};});_0x5c18b4['model']=_[_0x9453('0x38')](_0x4b882a,'name');_0x5c18b4[_0x9453('0x3e')]=_['keys'](_0xe8a3d['query']);_0x5c18b4[_0x9453('0x3f')]=_[_0x9453('0x40')](_0x5c18b4[_0x9453('0x41')],_0x5c18b4[_0x9453('0x3e')]);_0x316756[_0x9453('0x42')]=_[_0x9453('0x40')](_0x5c18b4[_0x9453('0x41')],qs['fields'](_0xe8a3d['query']['fields']));_0x316756[_0x9453('0x42')]=_0x316756['attributes'][_0x9453('0x43')]?_0x316756[_0x9453('0x42')]:_0x5c18b4[_0x9453('0x41')];if(!_0xe8a3d[_0x9453('0x3e')]['hasOwnProperty'](_0x9453('0x44'))){_0x316756[_0x9453('0x2e')]=qs[_0x9453('0x2e')](_0xe8a3d[_0x9453('0x3e')]['limit']);_0x316756[_0x9453('0x2d')]=qs[_0x9453('0x2d')](_0xe8a3d[_0x9453('0x3e')][_0x9453('0x2d')]);}_0x316756[_0x9453('0x45')]=qs[_0x9453('0x46')](_0xe8a3d['query'][_0x9453('0x46')]);_0x316756[_0x9453('0x47')]=qs[_0x9453('0x3f')](_['pick'](_0xe8a3d[_0x9453('0x3e')],_0x5c18b4['filters']),_0x4b882a);if(_0xe8a3d[_0x9453('0x3e')][_0x9453('0x48')]){_0x316756['where']=_[_0x9453('0x49')](_0x316756['where'],{'$or':_[_0x9453('0x38')](_0x4b882a,function(_0x3877bb){if(_0x3877bb['type']!==_0x9453('0x4a')){var _0x249748={};_0x249748[_0x3877bb[_0x9453('0x4b')]]={'$like':'%'+_0xe8a3d[_0x9453('0x3e')][_0x9453('0x48')]+'%'};return _0x249748;}})});}_0x316756=_[_0x9453('0x49')]({},_0x316756,_0xe8a3d[_0x9453('0x4c')]);var _0x24b924={'where':_0x316756['where']};return db[_0x9453('0x39')][_0x9453('0x4d')](_0x24b924)[_0x9453('0x33')](function(_0x66bf76){_0x2780c3[_0x9453('0x4d')]=_0x66bf76;if(_0xe8a3d[_0x9453('0x3e')]['includeAll']){_0x316756[_0x9453('0x4e')]=[{'all':!![]}];}return db['MailMessage'][_0x9453('0x4f')](_0x316756);})['then'](function(_0x3cda64){_0x2780c3[_0x9453('0x50')]=_0x3cda64;return _0x2780c3;})[_0x9453('0x33')](respondWithFilteredResult(_0x3dc2bf,_0x316756))[_0x9453('0x28')](handleError(_0x3dc2bf,null));};exports[_0x9453('0x51')]=function(_0xf66514,_0x33fd96){var _0x3d1a9c={'raw':!![],'where':{'id':_0xf66514[_0x9453('0x52')]['id']}},_0x49bb27={};_0x49bb27[_0x9453('0x41')]=_[_0x9453('0x53')](db[_0x9453('0x39')]['rawAttributes']);_0x49bb27['query']=_[_0x9453('0x53')](_0xf66514[_0x9453('0x3e')]);_0x49bb27[_0x9453('0x3f')]=_['intersection'](_0x49bb27[_0x9453('0x41')],_0x49bb27[_0x9453('0x3e')]);_0x3d1a9c[_0x9453('0x42')]=_[_0x9453('0x40')](_0x49bb27[_0x9453('0x41')],qs['fields'](_0xf66514[_0x9453('0x3e')][_0x9453('0x54')]));_0x3d1a9c[_0x9453('0x42')]=_0x3d1a9c['attributes'][_0x9453('0x43')]?_0x3d1a9c['attributes']:_0x49bb27['model'];if(_0xf66514[_0x9453('0x3e')][_0x9453('0x55')]){_0x3d1a9c[_0x9453('0x4e')]=[{'all':!![]}];}_0x3d1a9c=_[_0x9453('0x49')]({},_0x3d1a9c,_0xf66514[_0x9453('0x4c')]);return db['MailMessage'][_0x9453('0x56')](_0x3d1a9c)[_0x9453('0x33')](handleEntityNotFound(_0x33fd96,null))[_0x9453('0x33')](respondWithResult(_0x33fd96,null))['catch'](handleError(_0x33fd96,null));};exports['update']=function(_0x35d000,_0x4464a3){if(_0x35d000[_0x9453('0x57')]['id']){delete _0x35d000['body']['id'];}return db[_0x9453('0x39')][_0x9453('0x56')]({'where':{'id':_0x35d000[_0x9453('0x52')]['id']}})[_0x9453('0x33')](handleEntityNotFound(_0x4464a3,null))[_0x9453('0x33')](saveUpdates(_0x35d000[_0x9453('0x57')],null))['then'](respondWithResult(_0x4464a3,null))[_0x9453('0x28')](handleError(_0x4464a3,null));};exports[_0x9453('0x34')]=function(_0x3b5839,_0x385c02){return db[_0x9453('0x39')][_0x9453('0x56')]({'where':{'id':_0x3b5839[_0x9453('0x52')]['id']}})[_0x9453('0x33')](handleEntityNotFound(_0x385c02,null))[_0x9453('0x33')](removeEntity(_0x385c02,null))['catch'](handleError(_0x385c02,null));};exports[_0x9453('0x58')]=function(_0x15ed66,_0x3f0cb9){return db['MailMessage'][_0x9453('0x58')]()[_0x9453('0x33')](respondWithResult(_0x3f0cb9,null))[_0x9453('0x28')](handleError(_0x3f0cb9,null));};exports[_0x9453('0x59')]=function(_0x392667,_0x5422d2){return db[_0x9453('0x39')][_0x9453('0x59')](_0x392667[_0x9453('0x57')])['then'](function(_0x1963bd){if(_0x1963bd){if(_0x1963bd['direction']===_0x9453('0x5a')&&!_0x1963bd[_0x9453('0x5b')]){var _0x1c4f69,_0x54499c,_0x41ed33;if(_0x392667[_0x9453('0x57')]['to']){_0x54499c=_0x392667[_0x9453('0x57')]['to'][_0x9453('0x5c')](',')[0x0];}return db[_0x9453('0x5d')]['findOne']({'where':{'id':_0x1963bd[_0x9453('0x5e')]},'include':[{'model':db[_0x9453('0x5f')],'as':_0x9453('0x60'),'include':[{'model':db[_0x9453('0x61')],'as':_0x9453('0x62'),'where':{'email':_0x54499c},'limit':0x1,'order':[[_0x9453('0x63'),_0x9453('0x64')]]}]},{'model':db['MailServerOut'],'as':_0x9453('0x65'),'raw':!![]}]})[_0x9453('0x33')](function(_0x4184f6){_0x1c4f69=_0x4184f6;if(_0x1c4f69&&_0x1c4f69[_0x9453('0x65')]){var _0x4f78e8={'tls':{'rejectUnauthorized':![]}};if(_[_0x9453('0x66')](_0x1c4f69[_0x9453('0x65')][_0x9453('0x67')])){_0x4f78e8[_0x9453('0x68')]=_0x1c4f69[_0x9453('0x65')][_0x9453('0x68')];_0x4f78e8[_0x9453('0x69')]=_0x1c4f69['Smtp'][_0x9453('0x69')];_0x4f78e8[_0x9453('0x6a')]=_0x1c4f69[_0x9453('0x65')][_0x9453('0x6a')];if(_0x1c4f69[_0x9453('0x65')]['authentication']){_0x4f78e8['auth']={'user':_0x1c4f69[_0x9453('0x65')][_0x9453('0x6b')],'pass':_0x1c4f69[_0x9453('0x65')]['pass']};}}else{_0x4f78e8['service']=_0x1c4f69['Smtp']['service'];_0x4f78e8[_0x9453('0x6c')]={'user':_0x1c4f69[_0x9453('0x65')][_0x9453('0x6b')],'pass':_0x1c4f69['Smtp'][_0x9453('0x6d')]};_0x4f78e8[_0x9453('0x6a')]=_0x1c4f69[_0x9453('0x65')][_0x9453('0x6a')];}if(_0x392667[_0x9453('0x57')]['attachments']&&_0x392667[_0x9453('0x57')][_0x9453('0x6e')][_0x9453('0x43')]){for(var _0x372bc5=0x0;_0x372bc5<_0x392667[_0x9453('0x57')]['attachments']['length'];_0x372bc5+=0x1){_0x392667[_0x9453('0x57')][_0x9453('0x6e')][_0x372bc5]={'filename':_0x392667[_0x9453('0x57')][_0x9453('0x6e')][_0x372bc5][_0x9453('0x4b')],'path':path[_0x9453('0x6f')](config[_0x9453('0x70')],_0x9453('0x71'),_0x392667[_0x9453('0x57')][_0x9453('0x6e')][_0x372bc5][_0x9453('0x72')])};}}_0x41ed33={'account':_0x4f78e8,'message':_0x392667[_0x9453('0x57')]};return;}})[_0x9453('0x33')](function(){if(_0x1c4f69[_0x9453('0x60')]){if(_0x1c4f69[_0x9453('0x60')][_0x9453('0x62')][_0x9453('0x43')]){return _0x1c4f69[_0x9453('0x60')]['Contacts'][0x0];}else{return db[_0x9453('0x61')][_0x9453('0x59')](_[_0x9453('0x16')](_0x392667[_0x9453('0x57')],{'firstName':_0x392667[_0x9453('0x57')]['to'],'email':_0x392667[_0x9453('0x57')]['to'],'phone':_0x392667['body']['to'],'ListId':_0x1c4f69[_0x9453('0x73')]}));}}else{throw new Error(_0x9453('0x74'));}})[_0x9453('0x33')](function(){if(_0x41ed33){return respondWithRpcPromise(_0x9453('0x75'),_0x9453('0x76'),_0x41ed33,client9003)[_0x9453('0x33')](function(_0x121bed){return _0x1963bd[_0x9453('0x32')]({'read':!![],'messageId':_0x121bed[_0x9453('0x77')],'sentAt':moment()[_0x9453('0x78')](_0x9453('0x79'))});})[_0x9453('0x28')](function(_0x592ef7){logger[_0x9453('0x24')]('%s',JSON['stringify'](_0x592ef7));return _0x1963bd;});}return _0x1963bd;});}return _0x1963bd;}})[_0x9453('0x33')](respondWithResult(_0x5422d2,0xc9))[_0x9453('0x28')](handleError(_0x5422d2,null));};var interaction_log=require(_0x9453('0x12'))('mail-interactions');exports[_0x9453('0x7a')]=function(_0x3c20e7,_0x57224a,_0x1c58b7){var _0xc5d463={'channel':_0x9453('0x7b')};if(_0x3c20e7['body']['id']){delete _0x3c20e7['body']['id'];}_0x3c20e7[_0x9453('0x57')][_0x9453('0x7c')]=!![];_0x3c20e7[_0x9453('0x57')][_0x9453('0x7d')]=moment()[_0x9453('0x78')](_0x9453('0x79'));_0x3c20e7[_0x9453('0x57')][_0x9453('0x7e')]=_0x3c20e7[_0x9453('0x57')][_0x9453('0x7e')]||_0x3c20e7[_0x9453('0x6b')]['id'];return db[_0x9453('0x39')][_0x9453('0x56')]({'where':{'id':_0x3c20e7[_0x9453('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9453('0x7f')}]})[_0x9453('0x33')](handleEntityNotFound(_0x57224a,null))[_0x9453('0x33')](saveUpdates(_0x3c20e7[_0x9453('0x57')],null))[_0x9453('0x33')](function(_0x24a158){if(_0x24a158){_0xc5d463['message']=_0x24a158[_0x9453('0x80')]({'plain':!![]});return db[_0x9453('0x81')][_0x9453('0x56')]({'where':{'id':_0x24a158[_0x9453('0x82')]}});}return null;})[_0x9453('0x33')](handleEntityNotFound(_0x57224a,null))[_0x9453('0x33')](function(_0x59fb3b){if(_0x59fb3b){return _0x59fb3b['update']({'UserId':_0x3c20e7[_0x9453('0x57')][_0x9453('0x7e')],'read1stAt':_['isNil'](_0x59fb3b[_0x9453('0x83')])?moment()[_0x9453('0x78')](_0x9453('0x79')):undefined});}return null;})[_0x9453('0x33')](function(_0x6ca8e1){if(_0x6ca8e1){_0xc5d463[_0x9453('0x84')]=_0x6ca8e1[_0x9453('0x80')]({'plain':!![]});interaction_log[_0x9453('0x1e')](_0x9453('0x85'),_0x3c20e7[_0x9453('0x6b')]['id'],_0x3c20e7[_0x9453('0x6b')][_0x9453('0x4b')],_0x3c20e7[_0x9453('0x6b')][_0x9453('0x86')],_0xc5d463['interaction']['id'],_0x3c20e7[_0x9453('0x57')]?JSON[_0x9453('0x23')](_0x3c20e7['body']):_0x9453('0x87'));return respondWithRpcPromise(_0x9453('0x88'),_0x9453('0x89'),_0xc5d463);}return null;})[_0x9453('0x33')](function(_0x4cd60b){if(_0x4cd60b){if(_0x3c20e7['body'][_0x9453('0x8a')]){_0xc5d463[_0x9453('0x26')]['interface']=util['format']('SIP/%s',_0x3c20e7[_0x9453('0x6b')][_0x9453('0x4b')]);_0xc5d463[_0x9453('0x26')][_0x9453('0x8b')]=_0xc5d463[_0x9453('0x8b')];_0xc5d463[_0x9453('0x26')]['event']=_0x9453('0x7a');return respondWithRpcPromise('EventManager',_0x9453('0x8c'),{'event':_0x9453('0x8d'),'message':_0xc5d463[_0x9453('0x26')]},client9002)['then'](function(){return _0xc5d463;});}return _0xc5d463;}return null;})[_0x9453('0x33')](respondWithResult(_0x57224a,null))['catch'](handleError(_0x57224a,null));};var interaction_log=require(_0x9453('0x12'))(_0x9453('0x8e'));exports[_0x9453('0x30')]=function(_0x3f3d2a,_0x47653d,_0x5e2740){var _0x3bb10d={'agent':{},'channel':'mail'};if(_0x3f3d2a[_0x9453('0x57')]['id']){delete _0x3f3d2a[_0x9453('0x57')]['id'];}_0x3f3d2a[_0x9453('0x57')][_0x9453('0x7e')]=_0x3f3d2a['body'][_0x9453('0x7e')]||_0x3f3d2a[_0x9453('0x6b')]['id'];_0x3bb10d['agent']['id']=_0x3f3d2a[_0x9453('0x57')][_0x9453('0x7e')];return db[_0x9453('0x39')][_0x9453('0x56')]({'where':{'id':_0x3f3d2a['params']['id'],'UserId':null}})[_0x9453('0x33')](handleEntityNotFound(_0x47653d,null))[_0x9453('0x33')](function(_0x2af067){if(_0x2af067){_0x3bb10d[_0x9453('0x26')]=_0x2af067[_0x9453('0x80')]({'plain':!![]});return db['MailInteraction'][_0x9453('0x56')]({'where':{'id':_0x2af067[_0x9453('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x47653d,null))[_0x9453('0x33')](function(_0x5d9090){if(_0x5d9090){_0x3bb10d[_0x9453('0x84')]=_0x5d9090[_0x9453('0x80')]({'plain':!![]});interaction_log[_0x9453('0x1e')](_0x9453('0x8f'),_0x3f3d2a['user']['id'],_0x3f3d2a[_0x9453('0x6b')][_0x9453('0x4b')],_0x3f3d2a[_0x9453('0x6b')][_0x9453('0x86')],_0x3bb10d[_0x9453('0x84')]['id'],_0x3f3d2a[_0x9453('0x57')]?JSON[_0x9453('0x23')](_0x3f3d2a['body']):_0x9453('0x87'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x3bb10d);}return null;})[_0x9453('0x33')](function(_0x48ce29){if(_0x48ce29){_0x48ce29[_0x9453('0x26')][_0x9453('0x90')]=util[_0x9453('0x78')]('SIP/%s',_0x3f3d2a['user']['name']);_0x48ce29[_0x9453('0x26')]['channel']=_0x3bb10d[_0x9453('0x8b')];_0x48ce29['message'][_0x9453('0x91')]=_0x9453('0x30');respondWithRpcPromise(_0x9453('0x8c'),_0x9453('0x8c'),{'event':_0x9453('0x92'),'message':_0x48ce29['message']},client9002);return _0x3bb10d;}return null;})[_0x9453('0x33')](respondWithResult(_0x47653d,null))[_0x9453('0x28')](handleError(_0x47653d,null));};exports[_0x9453('0x93')]=function(_0x1bee79,_0xf4429b){var _0x5c10e7=moment()[_0x9453('0x94')]()[_0x9453('0x95')]();var _0x4641b0=path[_0x9453('0x6f')](config['root'],_0x9453('0x96'),_0x9453('0x97'),_0x9453('0x98'));var _0x54a79f=path[_0x9453('0x6f')](config[_0x9453('0x70')],'server',_0x9453('0x97'),_0x9453('0x6e'));var _0x2b4c06=util[_0x9453('0x78')](_0x9453('0x99'),_0x5c10e7);return db[_0x9453('0x39')][_0x9453('0x56')]({'where':{'id':_0x1bee79[_0x9453('0x52')]['id']},'attributes':['id','body','from','to','cc',_0x9453('0x9a'),_0x9453('0x9b'),_0x9453('0x9c')],'include':_0x1bee79[_0x9453('0x3e')]['attachments']?[{'model':db[_0x9453('0x9d')],'as':'Attachments'}]:undefined})[_0x9453('0x33')](handleEntityNotFound(_0xf4429b,null))['then'](function(_0x473098){if(_0x473098){var _0x25af48=_0x473098;var _0x231710={'from':_0x25af48[_0x9453('0x9e')],'to':_0x25af48['to'],'subject':_0x25af48[_0x9453('0x9b')],'html':_0x25af48[_0x9453('0x57')],'headers':{'Date':moment(_0x25af48[_0x9453('0x9c')])[_0x9453('0x78')](_0x9453('0x9f'))},'attachments':[]};if(_0x473098['cc']){_0x231710['headers']['Cc']=_0x473098['cc'];}if(_0x473098[_0x9453('0x9a')]){_0x231710[_0x9453('0xa0')]['Bcc']=_0x473098[_0x9453('0x9a')];}return new BPromise(function(_0xfee3f3,_0x5e97e1){if(_0x473098[_0x9453('0xa1')]){for(var _0x352dc5=0x0;_0x352dc5<_0x473098[_0x9453('0xa1')][_0x9453('0x43')];_0x352dc5++){var _0x4ff679=_0x473098[_0x9453('0xa1')][_0x352dc5];var _0x112226=path[_0x9453('0x6f')](_0x54a79f,_0x4ff679['basename']);if(fs[_0x9453('0xa2')](_0x112226)){_0x231710[_0x9453('0x6e')][_0x9453('0xa3')]({'name':_0x4ff679[_0x9453('0x4b')],'contentType':_0x4ff679['type'],'data':fs[_0x9453('0xa4')](_0x112226)});}}}emlformat[_0x9453('0xa5')](_0x231710,function(_0xcca9ed,_0x5bde51){if(_0xcca9ed)return _0x5e97e1(_0xcca9ed);fs[_0x9453('0xa6')](path[_0x9453('0x6f')](_0x4641b0,_0x2b4c06),_0x5bde51);return _0xfee3f3(_0x5bde51);});});}})[_0x9453('0x33')](function(_0x372c69){if(_0x372c69){return _0xf4429b['download'](path[_0x9453('0x6f')](_0x4641b0,_0x2b4c06),_0x2b4c06,function(_0x4251d1){if(_0x4251d1){console[_0x9453('0xa7')]('err',_0x4251d1);}else{fs[_0x9453('0xa8')](path[_0x9453('0x6f')](_0x4641b0,_0x2b4c06));}});}})['catch'](handleError(_0xf4429b,null));}; \ No newline at end of file +var _0x6b13=['List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','readAt','UserId','MailInteraction','read1stAt','interaction','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','get','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','server','files','message-%s.eml','from','subject','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','push','readFileSync','build','log','err','unlinkSync','eml-format','fast-json-patch','request-promise','moment','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','client','http','request','info','request\x20sent','debug','error','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','model','query','intersection','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','fields','length','options','find','body','describe','create','direction','out','MailAccount','MailAccountId','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','port','secure','user','pass','attachments','join','root','server/files/attachments','basename','List'];(function(_0x1f0c26,_0x365f93){var _0x2ebbc6=function(_0x563c22){while(--_0x563c22){_0x1f0c26['push'](_0x1f0c26['shift']());}};_0x2ebbc6(++_0x365f93);}(_0x6b13,0xd0));var _0x36b1=function(_0x366bf8,_0x44ed87){_0x366bf8=_0x366bf8-0x0;var _0x3bb18e=_0x6b13[_0x366bf8];return _0x3bb18e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x36b1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x36b1('0x1'));var rp=require(_0x36b1('0x2'));var moment=require(_0x36b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x36b1('0x4'));var util=require(_0x36b1('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x36b1('0x6'));var fs=require('fs');var _=require(_0x36b1('0x7'));var squel=require(_0x36b1('0x8'));var crypto=require(_0x36b1('0x9'));var jsforce=require(_0x36b1('0xa'));var deskjs=require(_0x36b1('0xb'));var toCsv=require(_0x36b1('0xc'));var querystring=require('querystring');var Papa=require(_0x36b1('0xd'));var Redis=require('ioredis');var authService=require(_0x36b1('0xe'));var qs=require(_0x36b1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36b1('0x10'));var logger=require(_0x36b1('0x11'))(_0x36b1('0x12'));var utils=require(_0x36b1('0x13'));var config=require(_0x36b1('0x14'));var licenseUtil=require(_0x36b1('0x15'));var db=require(_0x36b1('0x16'))['db'];config[_0x36b1('0x17')]=_[_0x36b1('0x18')](config[_0x36b1('0x17')],{'host':_0x36b1('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36b1('0x17')]));require(_0x36b1('0x1a'))[_0x36b1('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x36b1('0x1c')][_0x36b1('0x1d')]({'port':0x232c});var client9003=jayson[_0x36b1('0x1c')][_0x36b1('0x1d')]({'port':0x232b});var client9002=jayson['client'][_0x36b1('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xf82b6,_0x33a961,_0x2ed554,_0x4dee55){return new BPromise(function(_0x521cc3,_0x2013a8){var _0x4bb2b6=_0x4dee55||client;return _0x4bb2b6[_0x36b1('0x1e')](_0xf82b6,_0x2ed554)['then'](function(_0x5c9ae5){logger[_0x36b1('0x1f')]('MailMessage,\x20%s,\x20%s',_0x33a961,_0x36b1('0x20'));logger[_0x36b1('0x21')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x33a961,'request\x20sent',JSON['stringify'](_0x5c9ae5));if(_0x5c9ae5[_0x36b1('0x22')]){if(_0x5c9ae5[_0x36b1('0x22')]['code']===0x1f4){logger[_0x36b1('0x22')](_0x36b1('0x23'),_0x33a961,_0x5c9ae5['error'][_0x36b1('0x24')]);return _0x2013a8(_0x5c9ae5[_0x36b1('0x22')][_0x36b1('0x24')]);}logger['error'](_0x36b1('0x23'),_0x33a961,_0x5c9ae5[_0x36b1('0x22')][_0x36b1('0x24')]);return _0x521cc3(_0x5c9ae5[_0x36b1('0x22')][_0x36b1('0x24')]);}else{logger['info'](_0x36b1('0x23'),_0x33a961,_0x36b1('0x20'));_0x521cc3(_0x5c9ae5[_0x36b1('0x25')][_0x36b1('0x24')]);}})[_0x36b1('0x26')](function(_0x1b075d){logger[_0x36b1('0x22')]('MailMessage,\x20%s,\x20%s',_0x33a961,_0x1b075d);_0x2013a8(_0x1b075d);});});}function respondWithStatusCode(_0x595ddd,_0xd3e90){_0xd3e90=_0xd3e90||0xcc;return function(_0x2048cd){if(_0x2048cd){return _0x595ddd[_0x36b1('0x27')](_0xd3e90);}return _0x595ddd[_0x36b1('0x28')](_0xd3e90)[_0x36b1('0x29')]();};}function respondWithResult(_0x484dc1,_0x73de86){_0x73de86=_0x73de86||0xc8;return function(_0x3c43ba){if(_0x3c43ba){return _0x484dc1[_0x36b1('0x28')](_0x73de86)[_0x36b1('0x2a')](_0x3c43ba);}};}function respondWithFilteredResult(_0x1e81ce,_0x502ecd){return function(_0x1f8820){if(_0x1f8820){var _0x6e4386=_0x1f8820[_0x36b1('0x2b')],_0x408567=_0x502ecd[_0x36b1('0x2c')],_0x39ca13=_0x502ecd[_0x36b1('0x2c')]+_0x502ecd[_0x36b1('0x2d')],_0x1169f7;if(_0x39ca13>=_0x6e4386){_0x39ca13=_0x6e4386;_0x1169f7=0xc8;}else{_0x1169f7=0xce;}_0x1e81ce[_0x36b1('0x28')](_0x1169f7);return _0x1e81ce['set'](_0x36b1('0x2e'),_0x408567+'-'+_0x39ca13+'/'+_0x6e4386)[_0x36b1('0x2a')](_0x1f8820);}return null;};}function patchUpdates(_0x56702b){return function(_0x44ae8a){try{jsonpatch[_0x36b1('0x2f')](_0x44ae8a,_0x56702b,!![]);}catch(_0x4801ed){return BPromise[_0x36b1('0x30')](_0x4801ed);}return _0x44ae8a[_0x36b1('0x31')]();};}function saveUpdates(_0xd8007a,_0x138341){return function(_0x1bd62e){if(_0x1bd62e){return _0x1bd62e[_0x36b1('0x32')](_0xd8007a)[_0x36b1('0x33')](function(_0x5aa478){return _0x5aa478;});}return null;};}function removeEntity(_0x45107d,_0x5a73ec){return function(_0x507001){if(_0x507001){return _0x507001[_0x36b1('0x34')]()[_0x36b1('0x33')](function(){_0x45107d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dca75,_0x5f7e38){return function(_0x3ba30b){if(!_0x3ba30b){_0x5dca75[_0x36b1('0x27')](0x194);}return _0x3ba30b;};}function handleError(_0x2a3cb3,_0x3abd01){_0x3abd01=_0x3abd01||0x1f4;return function(_0x597eb6){logger[_0x36b1('0x22')](_0x597eb6[_0x36b1('0x35')]);if(_0x597eb6['name']){delete _0x597eb6[_0x36b1('0x36')];}_0x2a3cb3[_0x36b1('0x28')](_0x3abd01)[_0x36b1('0x37')](_0x597eb6);};}exports[_0x36b1('0x38')]=function(_0x2cfa67,_0x2f34c3){var _0xe7999c={},_0x2f244a={},_0xdd569b={'count':0x0,'rows':[]};var _0x4d68a3=_[_0x36b1('0x39')](db[_0x36b1('0x3a')][_0x36b1('0x3b')],function(_0xdb65ea){return{'name':_0xdb65ea[_0x36b1('0x3c')],'type':_0xdb65ea['type']['key']};});_0x2f244a[_0x36b1('0x3d')]=_['map'](_0x4d68a3,_0x36b1('0x36'));_0x2f244a[_0x36b1('0x3e')]=_['keys'](_0x2cfa67[_0x36b1('0x3e')]);_0x2f244a['filters']=_[_0x36b1('0x3f')](_0x2f244a[_0x36b1('0x3d')],_0x2f244a['query']);_0xe7999c[_0x36b1('0x40')]=_[_0x36b1('0x3f')](_0x2f244a[_0x36b1('0x3d')],qs['fields'](_0x2cfa67[_0x36b1('0x3e')]['fields']));_0xe7999c[_0x36b1('0x40')]=_0xe7999c['attributes']['length']?_0xe7999c[_0x36b1('0x40')]:_0x2f244a[_0x36b1('0x3d')];if(!_0x2cfa67['query'][_0x36b1('0x41')]('nolimit')){_0xe7999c['limit']=qs['limit'](_0x2cfa67[_0x36b1('0x3e')][_0x36b1('0x2d')]);_0xe7999c[_0x36b1('0x2c')]=qs[_0x36b1('0x2c')](_0x2cfa67[_0x36b1('0x3e')]['offset']);}_0xe7999c[_0x36b1('0x42')]=qs[_0x36b1('0x43')](_0x2cfa67[_0x36b1('0x3e')][_0x36b1('0x43')]);_0xe7999c[_0x36b1('0x44')]=qs[_0x36b1('0x45')](_[_0x36b1('0x46')](_0x2cfa67[_0x36b1('0x3e')],_0x2f244a[_0x36b1('0x45')]),_0x4d68a3);if(_0x2cfa67[_0x36b1('0x3e')][_0x36b1('0x47')]){_0xe7999c['where']=_[_0x36b1('0x48')](_0xe7999c[_0x36b1('0x44')],{'$or':_[_0x36b1('0x39')](_0x4d68a3,function(_0x1dbfca){if(_0x1dbfca[_0x36b1('0x49')]!==_0x36b1('0x4a')){var _0x5734c7={};_0x5734c7[_0x1dbfca['name']]={'$like':'%'+_0x2cfa67[_0x36b1('0x3e')][_0x36b1('0x47')]+'%'};return _0x5734c7;}})});}_0xe7999c=_[_0x36b1('0x48')]({},_0xe7999c,_0x2cfa67['options']);var _0x5cbbf4={'where':_0xe7999c[_0x36b1('0x44')]};return db[_0x36b1('0x3a')]['count'](_0x5cbbf4)[_0x36b1('0x33')](function(_0x12b538){_0xdd569b[_0x36b1('0x2b')]=_0x12b538;if(_0x2cfa67[_0x36b1('0x3e')][_0x36b1('0x4b')]){_0xe7999c[_0x36b1('0x4c')]=[{'all':!![]}];}return db[_0x36b1('0x3a')][_0x36b1('0x4d')](_0xe7999c);})[_0x36b1('0x33')](function(_0x3ca32d){_0xdd569b[_0x36b1('0x4e')]=_0x3ca32d;return _0xdd569b;})[_0x36b1('0x33')](respondWithFilteredResult(_0x2f34c3,_0xe7999c))[_0x36b1('0x26')](handleError(_0x2f34c3,null));};exports[_0x36b1('0x4f')]=function(_0x3a7126,_0x1de042){var _0x4009a7={'raw':!![],'where':{'id':_0x3a7126[_0x36b1('0x50')]['id']}},_0x3b1d77={};_0x3b1d77['model']=_[_0x36b1('0x51')](db['MailMessage'][_0x36b1('0x3b')]);_0x3b1d77[_0x36b1('0x3e')]=_[_0x36b1('0x51')](_0x3a7126[_0x36b1('0x3e')]);_0x3b1d77['filters']=_[_0x36b1('0x3f')](_0x3b1d77[_0x36b1('0x3d')],_0x3b1d77[_0x36b1('0x3e')]);_0x4009a7[_0x36b1('0x40')]=_['intersection'](_0x3b1d77[_0x36b1('0x3d')],qs[_0x36b1('0x52')](_0x3a7126['query'][_0x36b1('0x52')]));_0x4009a7[_0x36b1('0x40')]=_0x4009a7[_0x36b1('0x40')][_0x36b1('0x53')]?_0x4009a7[_0x36b1('0x40')]:_0x3b1d77[_0x36b1('0x3d')];if(_0x3a7126['query'][_0x36b1('0x4b')]){_0x4009a7['include']=[{'all':!![]}];}_0x4009a7=_[_0x36b1('0x48')]({},_0x4009a7,_0x3a7126[_0x36b1('0x54')]);return db[_0x36b1('0x3a')][_0x36b1('0x55')](_0x4009a7)[_0x36b1('0x33')](handleEntityNotFound(_0x1de042,null))[_0x36b1('0x33')](respondWithResult(_0x1de042,null))[_0x36b1('0x26')](handleError(_0x1de042,null));};exports[_0x36b1('0x32')]=function(_0x158272,_0x3b8bdb){if(_0x158272['body']['id']){delete _0x158272[_0x36b1('0x56')]['id'];}return db[_0x36b1('0x3a')][_0x36b1('0x55')]({'where':{'id':_0x158272[_0x36b1('0x50')]['id']}})[_0x36b1('0x33')](handleEntityNotFound(_0x3b8bdb,null))[_0x36b1('0x33')](saveUpdates(_0x158272[_0x36b1('0x56')],null))[_0x36b1('0x33')](respondWithResult(_0x3b8bdb,null))[_0x36b1('0x26')](handleError(_0x3b8bdb,null));};exports[_0x36b1('0x34')]=function(_0x5b97a3,_0x342eba){return db[_0x36b1('0x3a')][_0x36b1('0x55')]({'where':{'id':_0x5b97a3[_0x36b1('0x50')]['id']}})[_0x36b1('0x33')](handleEntityNotFound(_0x342eba,null))['then'](removeEntity(_0x342eba,null))[_0x36b1('0x26')](handleError(_0x342eba,null));};exports[_0x36b1('0x57')]=function(_0x31ce3b,_0x199504){return db[_0x36b1('0x3a')][_0x36b1('0x57')]()[_0x36b1('0x33')](respondWithResult(_0x199504,null))[_0x36b1('0x26')](handleError(_0x199504,null));};exports[_0x36b1('0x58')]=function(_0x3c39d5,_0x2a878d){return db[_0x36b1('0x3a')][_0x36b1('0x58')](_0x3c39d5[_0x36b1('0x56')])[_0x36b1('0x33')](function(_0x452c15){if(_0x452c15){if(_0x452c15[_0x36b1('0x59')]===_0x36b1('0x5a')&&!_0x452c15['secret']){var _0x8c5605,_0x458f15,_0x10ebec;if(_0x3c39d5[_0x36b1('0x56')]['to']){_0x458f15=_0x3c39d5[_0x36b1('0x56')]['to']['split'](',')[0x0];}return db[_0x36b1('0x5b')]['findOne']({'where':{'id':_0x452c15[_0x36b1('0x5c')]},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x36b1('0x5d')],'as':_0x36b1('0x5e'),'where':{'email':_0x458f15},'limit':0x1,'order':[[_0x36b1('0x5f'),_0x36b1('0x60')]]}]},{'model':db['MailServerOut'],'as':_0x36b1('0x61'),'raw':!![]}]})[_0x36b1('0x33')](function(_0x1d0975){_0x8c5605=_0x1d0975;if(_0x8c5605&&_0x8c5605['Smtp']){var _0x137e8c={'tls':{'rejectUnauthorized':![]}};if(_[_0x36b1('0x62')](_0x8c5605[_0x36b1('0x61')][_0x36b1('0x63')])){_0x137e8c['host']=_0x8c5605[_0x36b1('0x61')]['host'];_0x137e8c[_0x36b1('0x64')]=_0x8c5605[_0x36b1('0x61')][_0x36b1('0x64')];_0x137e8c[_0x36b1('0x65')]=_0x8c5605[_0x36b1('0x61')][_0x36b1('0x65')];if(_0x8c5605['Smtp']['authentication']){_0x137e8c['auth']={'user':_0x8c5605[_0x36b1('0x61')][_0x36b1('0x66')],'pass':_0x8c5605[_0x36b1('0x61')][_0x36b1('0x67')]};}}else{_0x137e8c[_0x36b1('0x63')]=_0x8c5605[_0x36b1('0x61')]['service'];_0x137e8c['auth']={'user':_0x8c5605[_0x36b1('0x61')][_0x36b1('0x66')],'pass':_0x8c5605[_0x36b1('0x61')][_0x36b1('0x67')]};_0x137e8c[_0x36b1('0x65')]=_0x8c5605[_0x36b1('0x61')]['secure'];}if(_0x3c39d5[_0x36b1('0x56')][_0x36b1('0x68')]&&_0x3c39d5[_0x36b1('0x56')][_0x36b1('0x68')][_0x36b1('0x53')]){for(var _0xd6265d=0x0;_0xd6265d<_0x3c39d5['body']['attachments']['length'];_0xd6265d+=0x1){_0x3c39d5[_0x36b1('0x56')][_0x36b1('0x68')][_0xd6265d]={'filename':_0x3c39d5[_0x36b1('0x56')][_0x36b1('0x68')][_0xd6265d][_0x36b1('0x36')],'path':path[_0x36b1('0x69')](config[_0x36b1('0x6a')],_0x36b1('0x6b'),_0x3c39d5[_0x36b1('0x56')][_0x36b1('0x68')][_0xd6265d][_0x36b1('0x6c')])};}}_0x10ebec={'account':_0x137e8c,'message':_0x3c39d5[_0x36b1('0x56')]};return;}})[_0x36b1('0x33')](function(){if(_0x8c5605['List']){if(_0x8c5605[_0x36b1('0x6d')]['Contacts'][_0x36b1('0x53')]){return _0x8c5605[_0x36b1('0x6d')][_0x36b1('0x5e')][0x0];}else{return db[_0x36b1('0x5d')][_0x36b1('0x58')](_[_0x36b1('0x18')](_0x3c39d5[_0x36b1('0x56')],{'firstName':_0x3c39d5[_0x36b1('0x56')]['to'],'email':_0x3c39d5[_0x36b1('0x56')]['to'],'phone':_0x3c39d5[_0x36b1('0x56')]['to'],'ListId':_0x8c5605['ListId']}));}}else{throw new Error(_0x36b1('0x6e'));}})[_0x36b1('0x33')](function(){if(_0x10ebec){return respondWithRpcPromise(_0x36b1('0x6f'),'sendMail',_0x10ebec,client9003)[_0x36b1('0x33')](function(_0x2d6601){return _0x452c15['update']({'read':!![],'messageId':_0x2d6601[_0x36b1('0x70')],'sentAt':moment()[_0x36b1('0x71')](_0x36b1('0x72'))});})[_0x36b1('0x26')](function(_0x19bb2c){logger['error']('%s',JSON[_0x36b1('0x73')](_0x19bb2c));return _0x452c15;});}return _0x452c15;});}return _0x452c15;}})[_0x36b1('0x33')](respondWithResult(_0x2a878d,0xc9))['catch'](handleError(_0x2a878d,null));};var interaction_log=require(_0x36b1('0x11'))('mail-interactions');exports[_0x36b1('0x74')]=function(_0x136529,_0x3eaf74,_0x993f68){var _0x8320ee={'channel':_0x36b1('0x75')};if(_0x136529[_0x36b1('0x56')]['id']){delete _0x136529[_0x36b1('0x56')]['id'];}_0x136529[_0x36b1('0x56')]['read']=!![];_0x136529[_0x36b1('0x56')][_0x36b1('0x76')]=moment()[_0x36b1('0x71')]('YYYY-MM-DD\x20HH:mm:ss');_0x136529[_0x36b1('0x56')]['UserId']=_0x136529['body'][_0x36b1('0x77')]||_0x136529[_0x36b1('0x66')]['id'];return db[_0x36b1('0x3a')][_0x36b1('0x55')]({'where':{'id':_0x136529[_0x36b1('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x36b1('0x5d')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x3eaf74,null))['then'](saveUpdates(_0x136529['body'],null))[_0x36b1('0x33')](function(_0x19c1ec){if(_0x19c1ec){_0x8320ee[_0x36b1('0x24')]=_0x19c1ec['get']({'plain':!![]});return db[_0x36b1('0x78')]['find']({'where':{'id':_0x19c1ec['MailInteractionId']}});}return null;})[_0x36b1('0x33')](handleEntityNotFound(_0x3eaf74,null))['then'](function(_0x5ca511){if(_0x5ca511){return _0x5ca511[_0x36b1('0x32')]({'UserId':_0x136529[_0x36b1('0x56')][_0x36b1('0x77')],'read1stAt':_[_0x36b1('0x62')](_0x5ca511[_0x36b1('0x79')])?moment()[_0x36b1('0x71')](_0x36b1('0x72')):undefined});}return null;})[_0x36b1('0x33')](function(_0x318c74){if(_0x318c74){_0x8320ee[_0x36b1('0x7a')]=_0x318c74['get']({'plain':!![]});interaction_log[_0x36b1('0x1f')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x136529[_0x36b1('0x66')]['id'],_0x136529['user']['name'],_0x136529['user'][_0x36b1('0x7b')],_0x8320ee[_0x36b1('0x7a')]['id'],_0x136529[_0x36b1('0x56')]?JSON[_0x36b1('0x73')](_0x136529['body']):'null');return respondWithRpcPromise(_0x36b1('0x7c'),_0x36b1('0x7d'),_0x8320ee);}return null;})['then'](function(_0x586bc0){if(_0x586bc0){if(_0x136529['body'][_0x36b1('0x7e')]){_0x8320ee['message'][_0x36b1('0x7f')]=util[_0x36b1('0x71')](_0x36b1('0x80'),_0x136529['user'][_0x36b1('0x36')]);_0x8320ee['message'][_0x36b1('0x81')]=_0x8320ee[_0x36b1('0x81')];_0x8320ee[_0x36b1('0x24')][_0x36b1('0x82')]=_0x36b1('0x74');return respondWithRpcPromise(_0x36b1('0x83'),_0x36b1('0x83'),{'event':_0x36b1('0x84'),'message':_0x8320ee['message']},client9002)[_0x36b1('0x33')](function(){return _0x8320ee;});}return _0x8320ee;}return null;})['then'](respondWithResult(_0x3eaf74,null))[_0x36b1('0x26')](handleError(_0x3eaf74,null));};var interaction_log=require(_0x36b1('0x11'))('mail-interactions');exports['reject']=function(_0x7cbd51,_0x30967e,_0x4930ae){var _0x4a3fc4={'agent':{},'channel':_0x36b1('0x75')};if(_0x7cbd51[_0x36b1('0x56')]['id']){delete _0x7cbd51[_0x36b1('0x56')]['id'];}_0x7cbd51[_0x36b1('0x56')][_0x36b1('0x77')]=_0x7cbd51[_0x36b1('0x56')][_0x36b1('0x77')]||_0x7cbd51[_0x36b1('0x66')]['id'];_0x4a3fc4[_0x36b1('0x85')]['id']=_0x7cbd51[_0x36b1('0x56')]['UserId'];return db['MailMessage'][_0x36b1('0x55')]({'where':{'id':_0x7cbd51[_0x36b1('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x30967e,null))[_0x36b1('0x33')](function(_0x5b8b08){if(_0x5b8b08){_0x4a3fc4[_0x36b1('0x24')]=_0x5b8b08[_0x36b1('0x86')]({'plain':!![]});return db[_0x36b1('0x78')][_0x36b1('0x55')]({'where':{'id':_0x5b8b08[_0x36b1('0x87')]}});}return null;})['then'](handleEntityNotFound(_0x30967e,null))[_0x36b1('0x33')](function(_0x25e31b){if(_0x25e31b){_0x4a3fc4['interaction']=_0x25e31b[_0x36b1('0x86')]({'plain':!![]});interaction_log['info'](_0x36b1('0x88'),_0x7cbd51['user']['id'],_0x7cbd51[_0x36b1('0x66')]['name'],_0x7cbd51[_0x36b1('0x66')][_0x36b1('0x7b')],_0x4a3fc4[_0x36b1('0x7a')]['id'],_0x7cbd51[_0x36b1('0x56')]?JSON[_0x36b1('0x73')](_0x7cbd51[_0x36b1('0x56')]):'null');return respondWithRpcPromise(_0x36b1('0x89'),_0x36b1('0x8a'),_0x4a3fc4);}return null;})['then'](function(_0x4b930d){if(_0x4b930d){_0x4b930d[_0x36b1('0x24')][_0x36b1('0x7f')]=util['format'](_0x36b1('0x80'),_0x7cbd51[_0x36b1('0x66')][_0x36b1('0x36')]);_0x4b930d[_0x36b1('0x24')][_0x36b1('0x81')]=_0x4a3fc4[_0x36b1('0x81')];_0x4b930d[_0x36b1('0x24')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x36b1('0x8b'),'message':_0x4b930d['message']},client9002);return _0x4a3fc4;}return null;})[_0x36b1('0x33')](respondWithResult(_0x30967e,null))['catch'](handleError(_0x30967e,null));};exports[_0x36b1('0x8c')]=function(_0x1e4583,_0x2c43b5){var _0x198647=moment()[_0x36b1('0x8d')]()[_0x36b1('0x8e')]();var _0x2041ae=path[_0x36b1('0x69')](config[_0x36b1('0x6a')],_0x36b1('0x8f'),_0x36b1('0x90'),'tmp');var _0x104f16=path['join'](config[_0x36b1('0x6a')],_0x36b1('0x8f'),_0x36b1('0x90'),_0x36b1('0x68'));var _0x54b734=util[_0x36b1('0x71')](_0x36b1('0x91'),_0x198647);return db[_0x36b1('0x3a')][_0x36b1('0x55')]({'where':{'id':_0x1e4583['params']['id']},'attributes':['id','body',_0x36b1('0x92'),'to','cc','bcc',_0x36b1('0x93'),'createdAt'],'include':_0x1e4583[_0x36b1('0x3e')][_0x36b1('0x68')]?[{'model':db['Attachment'],'as':_0x36b1('0x94')}]:undefined})[_0x36b1('0x33')](handleEntityNotFound(_0x2c43b5,null))[_0x36b1('0x33')](function(_0x5b42fd){if(_0x5b42fd){var _0xec504=_0x5b42fd;var _0x5db0fe={'from':_0xec504['from'],'to':_0xec504['to'],'subject':_0xec504[_0x36b1('0x93')],'html':_0xec504[_0x36b1('0x56')],'headers':{'Date':moment(_0xec504['createdAt'])[_0x36b1('0x71')](_0x36b1('0x95'))},'attachments':[]};if(_0x5b42fd['cc']){_0x5db0fe[_0x36b1('0x96')]['Cc']=_0x5b42fd['cc'];}if(_0x5b42fd[_0x36b1('0x97')]){_0x5db0fe['headers']['Bcc']=_0x5b42fd[_0x36b1('0x97')];}return new BPromise(function(_0x475835,_0x4de861){if(_0x5b42fd[_0x36b1('0x94')]){for(var _0x45bf7a=0x0;_0x45bf7a<_0x5b42fd[_0x36b1('0x94')][_0x36b1('0x53')];_0x45bf7a++){var _0x525755=_0x5b42fd[_0x36b1('0x94')][_0x45bf7a];var _0x520590=path[_0x36b1('0x69')](_0x104f16,_0x525755[_0x36b1('0x6c')]);if(fs[_0x36b1('0x98')](_0x520590)){_0x5db0fe[_0x36b1('0x68')][_0x36b1('0x99')]({'name':_0x525755[_0x36b1('0x36')],'contentType':_0x525755[_0x36b1('0x49')],'data':fs[_0x36b1('0x9a')](_0x520590)});}}}emlformat[_0x36b1('0x9b')](_0x5db0fe,function(_0x76038a,_0x46f276){if(_0x76038a)return _0x4de861(_0x76038a);fs['writeFileSync'](path[_0x36b1('0x69')](_0x2041ae,_0x54b734),_0x46f276);return _0x475835(_0x46f276);});});}})['then'](function(_0x1810b9){if(_0x1810b9){return _0x2c43b5['download'](path[_0x36b1('0x69')](_0x2041ae,_0x54b734),_0x54b734,function(_0x4ca203){if(_0x4ca203){console[_0x36b1('0x9c')](_0x36b1('0x9d'),_0x4ca203);}else{fs[_0x36b1('0x9e')](path[_0x36b1('0x69')](_0x2041ae,_0x54b734));}});}})[_0x36b1('0x26')](handleError(_0x2c43b5,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 6d75380..ec6d3fa 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 _0x14ec=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x565afa,_0x2ddc58){var _0x1e85fe=function(_0x50375a){while(--_0x50375a){_0x565afa['push'](_0x565afa['shift']());}};_0x1e85fe(++_0x2ddc58);}(_0x14ec,0xeb));var _0xc14e=function(_0x5d3947,_0x12a2d5){_0x5d3947=_0x5d3947-0x0;var _0x5123c6=_0x14ec[_0x5d3947];return _0x5123c6;};'use strict';var EventEmitter=require(_0xc14e('0x0'));var MailMessage=require(_0xc14e('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc14e('0x2')](0x0);var events={'afterCreate':_0xc14e('0x3'),'afterUpdate':_0xc14e('0x4'),'afterDestroy':_0xc14e('0x5')};function emitEvent(_0x7a0da2){return function(_0x5d1f3f,_0x14ca03,_0x508cfa){MailMessageEvents[_0xc14e('0x6')](_0x7a0da2+':'+_0x5d1f3f['id'],_0x5d1f3f);MailMessageEvents['emit'](_0x7a0da2,_0x5d1f3f);_0x508cfa(null);};}for(var e in events){if(events[_0xc14e('0x7')](e)){var event=events[e];MailMessage[_0xc14e('0x8')](e,emitEvent(event));}}module[_0xc14e('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x0bbe=['setMaxListeners','update','remove','emit','hook','../../mysqldb','MailMessage'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x0bbe,0xb4));var _0xe0bb=function(_0x5a70c0,_0x3eac7e){_0x5a70c0=_0x5a70c0-0x0;var _0x46e0c1=_0x0bbe[_0x5a70c0];return _0x46e0c1;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xe0bb('0x0'))['db'][_0xe0bb('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe0bb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe0bb('0x3'),'afterDestroy':_0xe0bb('0x4')};function emitEvent(_0x53c821){return function(_0x2b9290,_0x3191a9,_0x251ea2){MailMessageEvents[_0xe0bb('0x5')](_0x53c821+':'+_0x2b9290['id'],_0x2b9290);MailMessageEvents[_0xe0bb('0x5')](_0x53c821,_0x2b9290);_0x251ea2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xe0bb('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f57816a..0d2fc50 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 _0x0406=['get','direction','toLowerCase','secret','MailInteraction','findOne','MailInteractionId','createdAt','catch','error','utf8mb4','util','../../config/logger','api','moment','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models'];(function(_0x55fb83,_0x1d3856){var _0x59a87a=function(_0x38bdd1){while(--_0x38bdd1){_0x55fb83['push'](_0x55fb83['shift']());}};_0x59a87a(++_0x1d3856);}(_0x0406,0x6b));var _0x6040=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0406[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x6040('0x0'));var logger=require(_0x6040('0x1'))(_0x6040('0x2'));var moment=require(_0x6040('0x3'));var BPromise=require('bluebird');var rp=require(_0x6040('0x4'));var htmlToText=require(_0x6040('0x5'));var fs=require('fs');var path=require(_0x6040('0x6'));var rimraf=require(_0x6040('0x7'));var config=require(_0x6040('0x8'));var attributes=require(_0x6040('0x9'));module[_0x6040('0xa')]=function(_0x40ca38,_0x4d4c99){return _0x40ca38['define'](_0x6040('0xb'),attributes,{'tableName':_0x6040('0xc'),'paranoid':![],'indexes':[{'name':_0x6040('0xd'),'fields':[_0x6040('0xd')]},{'name':_0x6040('0xe'),'fields':[_0x6040('0xf'),_0x6040('0x10')],'type':_0x6040('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1fee6b,_0x26d762,_0x4e4a92){if(_0x1fee6b[_0x6040('0x12')]){_0x1fee6b['plainBody']=htmlToText[_0x6040('0x13')](_0x1fee6b[_0x6040('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4e4a92(null,_0x26d762);},'afterCreate':function(_0x27133d,_0x232120,_0x152bdd){var _0x76c99e=_0x40ca38[_0x6040('0x14')];var _0x4b85a5=_0x27133d[_0x6040('0x15')]({'plain':!![]});if(_0x4b85a5[_0x6040('0x16')][_0x6040('0x17')]()==='in'||_0x4b85a5[_0x6040('0x16')]['toLowerCase']()==='out'&&!_0x4b85a5[_0x6040('0x18')]&&!_['isNil'](_0x4b85a5['UserId'])){_0x76c99e[_0x6040('0x19')][_0x6040('0x1a')]({'where':{'id':_0x4b85a5[_0x6040('0x1b')]}})['then'](function(_0x3b56e8){if(_0x3b56e8){_0x3b56e8['update']({'lastMsgAt':_0x4b85a5[_0x6040('0x1c')],'lastMsgDirection':_0x4b85a5['direction']['toLowerCase'](),'lastMsgBody':_0x4b85a5[_0x6040('0x12')]});}})[_0x6040('0x1d')](function(_0x45ff43){console[_0x6040('0x1e')](_0x45ff43);});}_0x152bdd();}},'charset':_0x6040('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xede8=['moment','bluebird','request-promise','path','rimraf','./mailMessage.attributes','define','MailMessage','mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xede8,0xe4));var _0x8ede=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xede8[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x8ede('0x0'));var logger=require(_0x8ede('0x1'))(_0x8ede('0x2'));var moment=require(_0x8ede('0x3'));var BPromise=require(_0x8ede('0x4'));var rp=require(_0x8ede('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x8ede('0x6'));var rimraf=require(_0x8ede('0x7'));var config=require('../../config/environment');var attributes=require(_0x8ede('0x8'));module['exports']=function(_0x5332df,_0x5bcf2f){return _0x5332df[_0x8ede('0x9')](_0x8ede('0xa'),attributes,{'tableName':_0x8ede('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':'fti_mail_messages','fields':[_0x8ede('0xc'),_0x8ede('0xd')],'type':_0x8ede('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x107afe,_0x1a3ff6,_0x5f0fd0){if(_0x107afe[_0x8ede('0xf')]){_0x107afe[_0x8ede('0xc')]=htmlToText[_0x8ede('0x10')](_0x107afe[_0x8ede('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5f0fd0(null,_0x1a3ff6);},'afterCreate':function(_0x518cf4,_0x4f9262,_0x278b7f){var _0x2042e6=_0x5332df[_0x8ede('0x11')];var _0x5b4e2b=_0x518cf4[_0x8ede('0x12')]({'plain':!![]});if(_0x5b4e2b[_0x8ede('0x13')]['toLowerCase']()==='in'||_0x5b4e2b[_0x8ede('0x13')][_0x8ede('0x14')]()===_0x8ede('0x15')&&!_0x5b4e2b[_0x8ede('0x16')]&&!_[_0x8ede('0x17')](_0x5b4e2b[_0x8ede('0x18')])){_0x2042e6[_0x8ede('0x19')]['findOne']({'where':{'id':_0x5b4e2b[_0x8ede('0x1a')]}})[_0x8ede('0x1b')](function(_0x307a60){if(_0x307a60){_0x307a60[_0x8ede('0x1c')]({'lastMsgAt':_0x5b4e2b['createdAt'],'lastMsgDirection':_0x5b4e2b[_0x8ede('0x13')][_0x8ede('0x14')](),'lastMsgBody':_0x5b4e2b[_0x8ede('0xf')]});}})[_0x8ede('0x1d')](function(_0xafc406){console[_0x8ede('0x1e')](_0xafc406);});}_0x278b7f();}},'charset':_0x8ede('0x1f'),'collate':_0x8ede('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 40e15f8..89fc591 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 _0xc2a8=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','lodash','util','moment','bluebird'];(function(_0x320631,_0x39e800){var _0x222983=function(_0x4bd970){while(--_0x4bd970){_0x320631['push'](_0x320631['shift']());}};_0x222983(++_0x39e800);}(_0xc2a8,0x1bc));var _0x8c2a=function(_0x5515af,_0x50920f){_0x5515af=_0x5515af-0x0;var _0x176deb=_0xc2a8[_0x5515af];return _0x176deb;};'use strict';var _=require(_0x8c2a('0x0'));var util=require(_0x8c2a('0x1'));var moment=require(_0x8c2a('0x2'));var BPromise=require(_0x8c2a('0x3'));var rs=require(_0x8c2a('0x4'));var fs=require('fs');var Redis=require(_0x8c2a('0x5'));var db=require(_0x8c2a('0x6'))['db'];var utils=require(_0x8c2a('0x7'));var logger=require('../../config/logger')(_0x8c2a('0x8'));var config=require(_0x8c2a('0x9'));var jayson=require(_0x8c2a('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8c2a('0xb')](config[_0x8c2a('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8c2a('0xd'))[_0x8c2a('0xe')](socket);function respondWithRpcPromise(_0x505c06,_0x228010,_0x1a0d00){return new BPromise(function(_0x3d4f5b,_0x5a2eba){return client[_0x8c2a('0xf')](_0x505c06,_0x1a0d00)[_0x8c2a('0x10')](function(_0x220b6c){logger[_0x8c2a('0x11')](_0x8c2a('0x12'),_0x228010,_0x8c2a('0x13'));logger['debug'](_0x8c2a('0x14'),_0x228010,_0x8c2a('0x13'),JSON[_0x8c2a('0x15')](_0x220b6c));if(_0x220b6c[_0x8c2a('0x16')]){if(_0x220b6c[_0x8c2a('0x16')][_0x8c2a('0x17')]===0x1f4){logger[_0x8c2a('0x16')]('MailMessage,\x20%s,\x20%s',_0x228010,_0x220b6c['error'][_0x8c2a('0x18')]);return _0x5a2eba(_0x220b6c[_0x8c2a('0x16')][_0x8c2a('0x18')]);}logger['error'](_0x8c2a('0x12'),_0x228010,_0x220b6c['error'][_0x8c2a('0x18')]);return _0x3d4f5b(_0x220b6c[_0x8c2a('0x16')][_0x8c2a('0x18')]);}else{logger[_0x8c2a('0x11')]('MailMessage,\x20%s,\x20%s',_0x228010,'request\x20sent');_0x3d4f5b(_0x220b6c[_0x8c2a('0x19')][_0x8c2a('0x18')]);}})[_0x8c2a('0x1a')](function(_0x70d871){logger[_0x8c2a('0x16')](_0x8c2a('0x12'),_0x228010,_0x70d871);_0x5a2eba(_0x70d871);});});}exports[_0x8c2a('0x1b')]=function(_0x3036ee){var _0x3a01da=this;return new Promise(function(_0x29359c,_0x4717f0){return db[_0x8c2a('0x1c')]['create'](_0x3036ee[_0x8c2a('0x1d')],{'raw':_0x3036ee[_0x8c2a('0x1e')]?_0x3036ee[_0x8c2a('0x1e')][_0x8c2a('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x59947c){logger[_0x8c2a('0x11')](_0x8c2a('0x1b'),_0x3036ee);logger['debug'](_0x8c2a('0x1b'),_0x3036ee,JSON[_0x8c2a('0x15')](_0x59947c));_0x29359c(_0x59947c);})[_0x8c2a('0x1a')](function(_0xa18570){logger[_0x8c2a('0x16')](_0x8c2a('0x1b'),_0xa18570[_0x8c2a('0x18')],_0x3036ee);_0x4717f0(_0x3a01da[_0x8c2a('0x16')](0x1f4,_0xa18570['message']));});});}; \ No newline at end of file +var _0x45b2=['util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','request\x20sent','stringify','error','code','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','MailMessage','create','body','options','debug'];(function(_0x432505,_0x269cfe){var _0x8b6a3e=function(_0x4ad87d){while(--_0x4ad87d){_0x432505['push'](_0x432505['shift']());}};_0x8b6a3e(++_0x269cfe);}(_0x45b2,0x1ed));var _0x245b=function(_0x7853f5,_0x561e20){_0x7853f5=_0x7853f5-0x0;var _0x477a3a=_0x45b2[_0x7853f5];return _0x477a3a;};'use strict';var _=require('lodash');var util=require(_0x245b('0x0'));var moment=require(_0x245b('0x1'));var BPromise=require(_0x245b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x245b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x245b('0x4'))(_0x245b('0x5'));var config=require('../../config/environment');var jayson=require(_0x245b('0x6'));var client=jayson[_0x245b('0x7')]['http']({'port':0x232a});config[_0x245b('0x8')]=_[_0x245b('0x9')](config[_0x245b('0x8')],{'host':_0x245b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x245b('0x8')]));require(_0x245b('0xb'))[_0x245b('0xc')](socket);function respondWithRpcPromise(_0x4fa608,_0xf30c5b,_0x3de73d){return new BPromise(function(_0x1c281d,_0x147225){return client[_0x245b('0xd')](_0x4fa608,_0x3de73d)[_0x245b('0xe')](function(_0x25ef19){logger[_0x245b('0xf')]('MailMessage,\x20%s,\x20%s',_0xf30c5b,_0x245b('0x10'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0xf30c5b,_0x245b('0x10'),JSON[_0x245b('0x11')](_0x25ef19));if(_0x25ef19[_0x245b('0x12')]){if(_0x25ef19[_0x245b('0x12')][_0x245b('0x13')]===0x1f4){logger[_0x245b('0x12')](_0x245b('0x14'),_0xf30c5b,_0x25ef19[_0x245b('0x12')][_0x245b('0x15')]);return _0x147225(_0x25ef19[_0x245b('0x12')][_0x245b('0x15')]);}logger[_0x245b('0x12')](_0x245b('0x14'),_0xf30c5b,_0x25ef19[_0x245b('0x12')][_0x245b('0x15')]);return _0x1c281d(_0x25ef19[_0x245b('0x12')][_0x245b('0x15')]);}else{logger[_0x245b('0xf')](_0x245b('0x14'),_0xf30c5b,_0x245b('0x10'));_0x1c281d(_0x25ef19['result'][_0x245b('0x15')]);}})[_0x245b('0x16')](function(_0x5d4099){logger['error'](_0x245b('0x14'),_0xf30c5b,_0x5d4099);_0x147225(_0x5d4099);});});}exports[_0x245b('0x17')]=function(_0x34b19f){var _0x5d03bc=this;return new Promise(function(_0x5f01c7,_0x198e10){return db[_0x245b('0x18')][_0x245b('0x19')](_0x34b19f[_0x245b('0x1a')],{'raw':_0x34b19f[_0x245b('0x1b')]?_0x34b19f['options']['raw']===undefined?!![]:![]:!![]})[_0x245b('0xe')](function(_0x1475ed){logger['info']('CreateMailMessage',_0x34b19f);logger[_0x245b('0x1c')](_0x245b('0x17'),_0x34b19f,JSON[_0x245b('0x11')](_0x1475ed));_0x5f01c7(_0x1475ed);})[_0x245b('0x16')](function(_0x288918){logger[_0x245b('0x12')](_0x245b('0x17'),_0x288918['message'],_0x34b19f);_0x198e10(_0x5d03bc[_0x245b('0x12')](0x1f4,_0x288918['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index c405d82..e62908d 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 _0x8255=['removeListener','register','length','./mailMessage.events','save','remove','update'];(function(_0x9c7185,_0x2afe09){var _0x3a946a=function(_0x3a2f06){while(--_0x3a2f06){_0x9c7185['push'](_0x9c7185['shift']());}};_0x3a946a(++_0x2afe09);}(_0x8255,0x176));var _0x5825=function(_0x1df8bc,_0x4c03c9){_0x1df8bc=_0x1df8bc-0x0;var _0x5da4ae=_0x8255[_0x1df8bc];return _0x5da4ae;};'use strict';var MailMessageEvents=require(_0x5825('0x0'));var events=[_0x5825('0x1'),_0x5825('0x2'),_0x5825('0x3')];function createListener(_0x201689,_0x65c6e){return function(_0x2f0ce0){_0x65c6e['emit'](_0x201689,_0x2f0ce0);};}function removeListener(_0x4d1534,_0x5f2bc3){return function(){MailMessageEvents[_0x5825('0x4')](_0x4d1534,_0x5f2bc3);};}exports[_0x5825('0x5')]=function(_0x122c90){for(var _0xa8e4d1=0x0,_0x383a49=events[_0x5825('0x6')];_0xa8e4d1<_0x383a49;_0xa8e4d1++){var _0x27d87e=events[_0xa8e4d1];var _0x577974=createListener('mailMessage:'+_0x27d87e,_0x122c90);MailMessageEvents['on'](_0x27d87e,_0x577974);}}; \ No newline at end of file +var _0x7b40=['remove','update','emit','removeListener','mailMessage:','./mailMessage.events','save'];(function(_0x2d1d2b,_0x30f1fe){var _0x55d4ea=function(_0xac3c3c){while(--_0xac3c3c){_0x2d1d2b['push'](_0x2d1d2b['shift']());}};_0x55d4ea(++_0x30f1fe);}(_0x7b40,0x7c));var _0x07b4=function(_0x5c5e0c,_0x4399a2){_0x5c5e0c=_0x5c5e0c-0x0;var _0x2c0269=_0x7b40[_0x5c5e0c];return _0x2c0269;};'use strict';var MailMessageEvents=require(_0x07b4('0x0'));var events=[_0x07b4('0x1'),_0x07b4('0x2'),_0x07b4('0x3')];function createListener(_0x708cb5,_0x126dd2){return function(_0x3e3575){_0x126dd2[_0x07b4('0x4')](_0x708cb5,_0x3e3575);};}function removeListener(_0x396501,_0x4ab696){return function(){MailMessageEvents[_0x07b4('0x5')](_0x396501,_0x4ab696);};}exports['register']=function(_0x2e7f47){for(var _0xd45f4d=0x0,_0x415c99=events['length'];_0xd45f4d<_0x415c99;_0xd45f4d++){var _0x1351ab=events[_0xd45f4d];var _0x251677=createListener(_0x07b4('0x6')+_0x1351ab,_0x2e7f47);MailMessageEvents['on'](_0x1351ab,_0x251677);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 31ddcbb..d5c7900 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 _0x3e60=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3e60,0xc7));var _0x03e6=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x3e60[_0x20b29c];return _0x20d81b;};'use strict';var multer=require(_0x03e6('0x0'));var util=require(_0x03e6('0x1'));var path=require(_0x03e6('0x2'));var timeout=require(_0x03e6('0x3'));var express=require(_0x03e6('0x4'));var router=express[_0x03e6('0x5')]();var auth=require(_0x03e6('0x6'));var interaction=require(_0x03e6('0x7'));var config=require(_0x03e6('0x8'));var controller=require(_0x03e6('0x9'));router[_0x03e6('0xa')]('/',auth[_0x03e6('0xb')](),controller[_0x03e6('0xc')]);router[_0x03e6('0xa')](_0x03e6('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x03e6('0xa')](_0x03e6('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x03e6('0xa')]('/:id/members',auth[_0x03e6('0xb')](),controller[_0x03e6('0xf')]);router['get'](_0x03e6('0x10'),auth[_0x03e6('0xb')](),controller[_0x03e6('0x11')]);router[_0x03e6('0xa')](_0x03e6('0x12'),auth[_0x03e6('0xb')](),controller[_0x03e6('0x13')]);router['post']('/',auth[_0x03e6('0xb')](),controller[_0x03e6('0x14')]);router[_0x03e6('0x15')](_0x03e6('0x10'),auth[_0x03e6('0xb')](),controller['addTeams']);router['post'](_0x03e6('0x12'),auth[_0x03e6('0xb')](),controller[_0x03e6('0x16')]);router['put'](_0x03e6('0xe'),auth[_0x03e6('0xb')](),controller[_0x03e6('0x17')]);router[_0x03e6('0x18')](_0x03e6('0xe'),auth['isAuthenticated'](),controller[_0x03e6('0x19')]);router['delete'](_0x03e6('0x10'),auth['isAuthenticated'](),controller[_0x03e6('0x1a')]);router[_0x03e6('0x18')]('/:id/users',auth[_0x03e6('0xb')](),controller[_0x03e6('0x1b')]);module[_0x03e6('0x1c')]=router; \ No newline at end of file +var _0x7511=['describe','show','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','/:id','delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','/describe','isAuthenticated'];(function(_0x17204c,_0x59662f){var _0x26fa9a=function(_0x8f54ad){while(--_0x8f54ad){_0x17204c['push'](_0x17204c['shift']());}};_0x26fa9a(++_0x59662f);}(_0x7511,0x1e2));var _0x1751=function(_0x26fa43,_0x30a86c){_0x26fa43=_0x26fa43-0x0;var _0x81ca8d=_0x7511[_0x26fa43];return _0x81ca8d;};'use strict';var multer=require(_0x1751('0x0'));var util=require(_0x1751('0x1'));var path=require(_0x1751('0x2'));var timeout=require(_0x1751('0x3'));var express=require(_0x1751('0x4'));var router=express['Router']();var auth=require(_0x1751('0x5'));var interaction=require(_0x1751('0x6'));var config=require(_0x1751('0x7'));var controller=require(_0x1751('0x8'));router[_0x1751('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1751('0x9')](_0x1751('0xa'),auth[_0x1751('0xb')](),controller[_0x1751('0xc')]);router[_0x1751('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1751('0xd')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x1751('0x9')]('/:id/teams',auth[_0x1751('0xb')](),controller['getTeams']);router['get'](_0x1751('0xe'),auth['isAuthenticated'](),controller[_0x1751('0xf')]);router[_0x1751('0x10')]('/',auth['isAuthenticated'](),controller[_0x1751('0x11')]);router[_0x1751('0x10')](_0x1751('0x12'),auth[_0x1751('0xb')](),controller[_0x1751('0x13')]);router[_0x1751('0x10')](_0x1751('0xe'),auth['isAuthenticated'](),controller[_0x1751('0x14')]);router[_0x1751('0x15')](_0x1751('0x16'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x1751('0x16'),auth[_0x1751('0xb')](),controller['destroy']);router[_0x1751('0x17')](_0x1751('0x12'),auth[_0x1751('0xb')](),controller['removeTeams']);router[_0x1751('0x17')]('/:id/users',auth[_0x1751('0xb')](),controller[_0x1751('0x18')]);module[_0x1751('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 7d16376..35a2bb9 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 _0x1c01=['roundrobin','sequelize','exports','STRING','name','INTEGER','beepall'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x1c01,0x190));var _0x11c0=function(_0x52ceb8,_0x1c63ea){_0x52ceb8=_0x52ceb8-0x0;var _0x28a714=_0x1c01[_0x52ceb8];return _0x28a714;};'use strict';var Sequelize=require(_0x11c0('0x0'));module[_0x11c0('0x1')]={'name':{'type':Sequelize[_0x11c0('0x2')],'unique':_0x11c0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x11c0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x11c0('0x5'),_0x11c0('0x6'))}}; \ No newline at end of file +var _0xc8a4=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x389195,_0x2a42fa){var _0x4b8211=function(_0x49dc4a){while(--_0x49dc4a){_0x389195['push'](_0x389195['shift']());}};_0x4b8211(++_0x2a42fa);}(_0xc8a4,0x99));var _0x4c8a=function(_0x37335b,_0x3f0cf1){_0x37335b=_0x37335b-0x0;var _0x492149=_0xc8a4[_0x37335b];return _0x492149;};'use strict';var Sequelize=require(_0x4c8a('0x0'));module[_0x4c8a('0x1')]={'name':{'type':Sequelize[_0x4c8a('0x2')],'unique':_0x4c8a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4c8a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c8a('0x5')](_0x4c8a('0x6'),_0x4c8a('0x7'),_0x4c8a('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 0a113ae..95508c8 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 _0xccde=['hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','keys','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','describe','getMembers','findOne','pick','MailQueueId','UserMailQueue','agent','mailPause','updatedAt','rows','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','sequelize','each','findOrCreate','emit','userMailQueue:save','removeTeams','User','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','transaction','isEmpty','removeAgents','addAgents','omit','spread','userMailQueue:remove','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','count','offset','limit','set','reject','update','then','get','UserProfileResource','destroy','error','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xccde,0x1e1));var _0xeccd=function(_0x5ad190,_0xd39c9e){_0x5ad190=_0x5ad190-0x0;var _0x518ed3=_0xccde[_0x5ad190];return _0x518ed3;};'use strict';var pdf=require(_0xeccd('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xeccd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeccd('0x2'));var rp=require(_0xeccd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeccd('0x4'));var util=require(_0xeccd('0x5'));var path=require(_0xeccd('0x6'));var sox=require(_0xeccd('0x7'));var csv=require(_0xeccd('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeccd('0x9'));var squel=require(_0xeccd('0xa'));var crypto=require(_0xeccd('0xb'));var jsforce=require(_0xeccd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeccd('0x8'));var querystring=require(_0xeccd('0xd'));var Papa=require(_0xeccd('0xe'));var Redis=require(_0xeccd('0xf'));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(_0xeccd('0x10'))(_0xeccd('0x11'));var utils=require(_0xeccd('0x12'));var config=require(_0xeccd('0x13'));var licenseUtil=require(_0xeccd('0x14'));var db=require('../../mysqldb')['db'];config[_0xeccd('0x15')]=_[_0xeccd('0x16')](config[_0xeccd('0x15')],{'host':_0xeccd('0x17'),'port':0x18eb});var socket=require(_0xeccd('0x18'))(new Redis(config[_0xeccd('0x15')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x4073e0,_0x133005){_0x133005=_0x133005||0xcc;return function(_0x25b7e2){if(_0x25b7e2){return _0x4073e0[_0xeccd('0x19')](_0x133005);}return _0x4073e0['status'](_0x133005)[_0xeccd('0x1a')]();};}function respondWithResult(_0x3dc35f,_0x496061){_0x496061=_0x496061||0xc8;return function(_0x53f4d8){if(_0x53f4d8){return _0x3dc35f[_0xeccd('0x1b')](_0x496061)[_0xeccd('0x1c')](_0x53f4d8);}};}function respondWithFilteredResult(_0x2e96f3,_0x38cc1b){return function(_0xb0fad7){if(_0xb0fad7){var _0x360d25=_0xb0fad7[_0xeccd('0x1d')],_0x466d98=_0x38cc1b[_0xeccd('0x1e')],_0x17596a=_0x38cc1b[_0xeccd('0x1e')]+_0x38cc1b[_0xeccd('0x1f')],_0x5ba676;if(_0x17596a>=_0x360d25){_0x17596a=_0x360d25;_0x5ba676=0xc8;}else{_0x5ba676=0xce;}_0x2e96f3[_0xeccd('0x1b')](_0x5ba676);return _0x2e96f3[_0xeccd('0x20')]('Content-Range',_0x466d98+'-'+_0x17596a+'/'+_0x360d25)['json'](_0xb0fad7);}return null;};}function patchUpdates(_0x50f041){return function(_0x22976d){try{jsonpatch['apply'](_0x22976d,_0x50f041,!![]);}catch(_0x132793){return BPromise[_0xeccd('0x21')](_0x132793);}return _0x22976d['save']();};}function saveUpdates(_0x1747af,_0x526243){return function(_0x8b62e){if(_0x8b62e){return _0x8b62e[_0xeccd('0x22')](_0x1747af)[_0xeccd('0x23')](function(_0x4537e1){return _0x4537e1;});}return null;};}function removeEntity(_0x16e97a,_0x5c4672){return function(_0x4bc387){if(_0x4bc387){return _0x4bc387['destroy']()[_0xeccd('0x23')](function(){var _0x244d22=_0x4bc387[_0xeccd('0x24')]({'plain':!![]});var _0x449883='MailQueues';return db[_0xeccd('0x25')][_0xeccd('0x26')]({'where':{'type':_0x449883,'resourceId':_0x244d22['id']}})[_0xeccd('0x23')](function(){return _0x4bc387;});})[_0xeccd('0x23')](function(){_0x16e97a['status'](0xcc)[_0xeccd('0x1a')]();});}};}function handleEntityNotFound(_0x4240df,_0x3e42e8){return function(_0x2bf027){if(!_0x2bf027){_0x4240df[_0xeccd('0x19')](0x194);}return _0x2bf027;};}function handleError(_0x1c0a3f,_0x2ea699){_0x2ea699=_0x2ea699||0x1f4;return function(_0x33af3a){logger[_0xeccd('0x27')](_0x33af3a['stack']);if(_0x33af3a[_0xeccd('0x28')]){delete _0x33af3a['name'];}_0x1c0a3f[_0xeccd('0x1b')](_0x2ea699)[_0xeccd('0x29')](_0x33af3a);};}exports[_0xeccd('0x2a')]=function(_0x28d25a,_0x330f8d){var _0x46dabd={},_0x49858a={},_0x1b75c0={'count':0x0,'rows':[]};var _0x3e0669=_[_0xeccd('0x2b')](db[_0xeccd('0x2c')][_0xeccd('0x2d')],function(_0x207d97){return{'name':_0x207d97[_0xeccd('0x2e')],'type':_0x207d97['type'][_0xeccd('0x2f')]};});_0x49858a[_0xeccd('0x30')]=_['map'](_0x3e0669,_0xeccd('0x28'));_0x49858a[_0xeccd('0x31')]=_['keys'](_0x28d25a[_0xeccd('0x31')]);_0x49858a[_0xeccd('0x32')]=_[_0xeccd('0x33')](_0x49858a[_0xeccd('0x30')],_0x49858a[_0xeccd('0x31')]);_0x46dabd[_0xeccd('0x34')]=_[_0xeccd('0x33')](_0x49858a[_0xeccd('0x30')],qs[_0xeccd('0x35')](_0x28d25a['query']['fields']));_0x46dabd[_0xeccd('0x34')]=_0x46dabd[_0xeccd('0x34')][_0xeccd('0x36')]?_0x46dabd[_0xeccd('0x34')]:_0x49858a[_0xeccd('0x30')];if(!_0x28d25a[_0xeccd('0x31')][_0xeccd('0x37')](_0xeccd('0x38'))){_0x46dabd[_0xeccd('0x1f')]=qs[_0xeccd('0x1f')](_0x28d25a[_0xeccd('0x31')][_0xeccd('0x1f')]);_0x46dabd['offset']=qs[_0xeccd('0x1e')](_0x28d25a['query'][_0xeccd('0x1e')]);}_0x46dabd[_0xeccd('0x39')]=qs[_0xeccd('0x3a')](_0x28d25a['query'][_0xeccd('0x3a')]);_0x46dabd[_0xeccd('0x3b')]=qs['filters'](_['pick'](_0x28d25a[_0xeccd('0x31')],_0x49858a[_0xeccd('0x32')]),_0x3e0669);if(_0x28d25a[_0xeccd('0x31')]['filter']){_0x46dabd[_0xeccd('0x3b')]=_['merge'](_0x46dabd[_0xeccd('0x3b')],{'$or':_['map'](_0x3e0669,function(_0x29b0c9){if(_0x29b0c9[_0xeccd('0x3c')]!==_0xeccd('0x3d')){var _0x22bf5c={};_0x22bf5c[_0x29b0c9['name']]={'$like':'%'+_0x28d25a['query'][_0xeccd('0x3e')]+'%'};return _0x22bf5c;}})});}_0x46dabd=_['merge']({},_0x46dabd,_0x28d25a[_0xeccd('0x3f')]);var _0x37604c={'where':_0x46dabd['where']};return db['MailQueue'][_0xeccd('0x1d')](_0x37604c)[_0xeccd('0x23')](function(_0x498109){_0x1b75c0[_0xeccd('0x1d')]=_0x498109;if(_0x28d25a[_0xeccd('0x31')][_0xeccd('0x40')]){_0x46dabd[_0xeccd('0x41')]=[{'all':!![]}];}return db[_0xeccd('0x2c')][_0xeccd('0x42')](_0x46dabd);})['then'](function(_0x351862){_0x1b75c0['rows']=_0x351862;return _0x1b75c0;})[_0xeccd('0x23')](respondWithFilteredResult(_0x330f8d,_0x46dabd))[_0xeccd('0x43')](handleError(_0x330f8d,null));};exports['show']=function(_0x186dfc,_0x47cc7a){var _0x193e3a={'raw':!![],'where':{'id':_0x186dfc[_0xeccd('0x44')]['id']}},_0x34247a={};_0x34247a['model']=_[_0xeccd('0x45')](db[_0xeccd('0x2c')][_0xeccd('0x2d')]);_0x34247a[_0xeccd('0x31')]=_['keys'](_0x186dfc['query']);_0x34247a[_0xeccd('0x32')]=_[_0xeccd('0x33')](_0x34247a[_0xeccd('0x30')],_0x34247a[_0xeccd('0x31')]);_0x193e3a[_0xeccd('0x34')]=_[_0xeccd('0x33')](_0x34247a[_0xeccd('0x30')],qs[_0xeccd('0x35')](_0x186dfc[_0xeccd('0x31')]['fields']));_0x193e3a['attributes']=_0x193e3a[_0xeccd('0x34')][_0xeccd('0x36')]?_0x193e3a[_0xeccd('0x34')]:_0x34247a[_0xeccd('0x30')];if(_0x186dfc[_0xeccd('0x31')][_0xeccd('0x40')]){_0x193e3a[_0xeccd('0x41')]=[{'all':!![]}];}_0x193e3a=_[_0xeccd('0x46')]({},_0x193e3a,_0x186dfc['options']);return db['MailQueue']['find'](_0x193e3a)[_0xeccd('0x23')](handleEntityNotFound(_0x47cc7a,null))['then'](respondWithResult(_0x47cc7a,null))[_0xeccd('0x43')](handleError(_0x47cc7a,null));};exports[_0xeccd('0x47')]=function(_0x5033e9,_0x3efb54){return db[_0xeccd('0x2c')][_0xeccd('0x47')](_0x5033e9[_0xeccd('0x48')],{})['then'](function(_0x2fef72){var _0x5cdef1=_0x5033e9[_0xeccd('0x49')][_0xeccd('0x24')]({'plain':!![]});if(!_0x5cdef1)throw new Error(_0xeccd('0x4a'));if(_0x5cdef1[_0xeccd('0x4b')]===_0xeccd('0x49')){var _0x4d6c9a=_0x2fef72[_0xeccd('0x24')]({'plain':!![]});var _0x4217f2='MailQueues';return db['UserProfileSection'][_0xeccd('0x4c')]({'where':{'name':_0x4217f2,'userProfileId':_0x5cdef1['userProfileId']},'raw':!![]})[_0xeccd('0x23')](function(_0x55579a){if(_0x55579a&&_0x55579a[_0xeccd('0x4d')]===0x0){return db[_0xeccd('0x25')][_0xeccd('0x47')]({'name':_0x4d6c9a['name'],'resourceId':_0x4d6c9a['id'],'type':_0x55579a['name'],'sectionId':_0x55579a['id']},{})[_0xeccd('0x23')](function(){return _0x2fef72;});}else{return _0x2fef72;}})['catch'](function(_0x3c0c4c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0c4c);throw _0x3c0c4c;});}return _0x2fef72;})[_0xeccd('0x23')](respondWithResult(_0x3efb54,0xc9))[_0xeccd('0x43')](handleError(_0x3efb54,null));};exports[_0xeccd('0x22')]=function(_0x557966,_0x37303f){if(_0x557966['body']['id']){delete _0x557966[_0xeccd('0x48')]['id'];}return db['MailQueue'][_0xeccd('0x4c')]({'where':{'id':_0x557966[_0xeccd('0x44')]['id']}})['then'](handleEntityNotFound(_0x37303f,null))[_0xeccd('0x23')](saveUpdates(_0x557966[_0xeccd('0x48')],null))[_0xeccd('0x23')](respondWithResult(_0x37303f,null))[_0xeccd('0x43')](handleError(_0x37303f,null));};exports[_0xeccd('0x26')]=function(_0x13a929,_0xb503d){return db[_0xeccd('0x2c')][_0xeccd('0x4c')]({'where':{'id':_0x13a929[_0xeccd('0x44')]['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0xb503d,null))[_0xeccd('0x23')](removeEntity(_0xb503d,null))[_0xeccd('0x43')](handleError(_0xb503d,null));};exports['describe']=function(_0x121464,_0x32afa0){return db[_0xeccd('0x2c')][_0xeccd('0x4e')]()[_0xeccd('0x23')](respondWithResult(_0x32afa0,null))['catch'](handleError(_0x32afa0,null));};exports[_0xeccd('0x4f')]=function(_0x25b1dd,_0x557cbb,_0x61bda){var _0x14c3ba={'raw':!![],'where':{}},_0xfa3655={},_0x4d9763;return db[_0xeccd('0x2c')][_0xeccd('0x50')]({'where':{'id':_0x25b1dd['params']['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0x557cbb,null))[_0xeccd('0x23')](function(_0x426efd){if(_0x426efd){_0x4d9763=_0x426efd['get']({'plain':!![]});_0xfa3655[_0xeccd('0x30')]=_['keys'](db['UserMailQueue'][_0xeccd('0x2d')]);_0xfa3655[_0xeccd('0x31')]=_[_0xeccd('0x45')](_0x25b1dd[_0xeccd('0x31')]);_0xfa3655['filters']=_[_0xeccd('0x33')](_0xfa3655[_0xeccd('0x30')],_0xfa3655[_0xeccd('0x31')]);_0x14c3ba[_0xeccd('0x34')]=_[_0xeccd('0x33')](_0xfa3655[_0xeccd('0x30')],qs[_0xeccd('0x35')](_0x25b1dd['query'][_0xeccd('0x35')]));_0x14c3ba[_0xeccd('0x34')]=_0x14c3ba[_0xeccd('0x34')][_0xeccd('0x36')]?_0x14c3ba[_0xeccd('0x34')]:_0xfa3655[_0xeccd('0x30')];if(!_0x25b1dd[_0xeccd('0x31')][_0xeccd('0x37')](_0xeccd('0x38'))){_0x14c3ba['limit']=qs[_0xeccd('0x1f')](_0x25b1dd[_0xeccd('0x31')][_0xeccd('0x1f')]);_0x14c3ba[_0xeccd('0x1e')]=qs['offset'](_0x25b1dd['query'][_0xeccd('0x1e')]);}_0x14c3ba[_0xeccd('0x39')]=qs[_0xeccd('0x3a')](_0x25b1dd[_0xeccd('0x31')]['sort']);_0x14c3ba[_0xeccd('0x3b')]=qs[_0xeccd('0x32')](_[_0xeccd('0x51')](_0x25b1dd['query'],_0xfa3655[_0xeccd('0x32')]));_0x14c3ba[_0xeccd('0x3b')][_0xeccd('0x52')]=_0x426efd['id'];if(_0x25b1dd[_0xeccd('0x31')][_0xeccd('0x3e')]){_0x14c3ba[_0xeccd('0x3b')]=_[_0xeccd('0x46')](_0x14c3ba[_0xeccd('0x3b')],{'$or':_[_0xeccd('0x2b')](_0x14c3ba[_0xeccd('0x34')],function(_0x567726){var _0x575d78={};_0x575d78[_0x567726]={'$like':'%'+_0x25b1dd['query'][_0xeccd('0x3e')]+'%'};return _0x575d78;})});}_0x14c3ba=_[_0xeccd('0x46')]({},_0x14c3ba,_0x25b1dd['options']);return db[_0xeccd('0x53')][_0xeccd('0x42')](_0x14c3ba);}})[_0xeccd('0x23')](function(_0x25f7d8){if(_0x25f7d8){return db['User']['findAndCountAll']({'where':{'id':_[_0xeccd('0x2b')](_0x25f7d8,'UserId'),'role':_0xeccd('0x54')},'attributes':['id',_0xeccd('0x28'),_0xeccd('0x55'),_0xeccd('0x56'),'createdAt']});}})[_0xeccd('0x23')](function(_0x24c7ee){if(_0x24c7ee){return{'count':_0x24c7ee['count'],'rows':_[_0xeccd('0x2b')](_0x24c7ee[_0xeccd('0x57')],function(_0x17a977){return{'membername':_0x17a977[_0xeccd('0x28')],'UserId':_0x17a977['id'],'queue_name':_0x4d9763[_0xeccd('0x28')],'MailQueueId':_0x4d9763['id'],'interface':util[_0xeccd('0x58')](_0xeccd('0x59'),'SIP',_0x17a977[_0xeccd('0x28')]),'penalty':0x0,'paused':_0x17a977[_0xeccd('0x55')],'createdAt':_0x17a977[_0xeccd('0x5a')],'updatedAt':_0x17a977['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x557cbb,_0x14c3ba))['catch'](handleError(_0x557cbb,null));};exports[_0xeccd('0x5b')]=function(_0xae9f0e,_0x56cb73,_0x3702ab){var _0x104636={};var _0x2c2bf6={};var _0x3f1fa6;var _0xb9f42e;return db[_0xeccd('0x2c')]['findOne']({'where':{'id':_0xae9f0e[_0xeccd('0x44')]['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0x56cb73,null))[_0xeccd('0x23')](function(_0x5b6b4b){if(_0x5b6b4b){_0x3f1fa6=_0x5b6b4b;_0x2c2bf6[_0xeccd('0x30')]=_[_0xeccd('0x45')](db[_0xeccd('0x5c')][_0xeccd('0x2d')]);_0x2c2bf6[_0xeccd('0x31')]=_[_0xeccd('0x45')](_0xae9f0e[_0xeccd('0x31')]);_0x2c2bf6[_0xeccd('0x32')]=_[_0xeccd('0x33')](_0x2c2bf6['model'],_0x2c2bf6[_0xeccd('0x31')]);_0x104636['attributes']=_[_0xeccd('0x33')](_0x2c2bf6[_0xeccd('0x30')],qs['fields'](_0xae9f0e['query'][_0xeccd('0x35')]));_0x104636['attributes']=_0x104636['attributes'][_0xeccd('0x36')]?_0x104636[_0xeccd('0x34')]:_0x2c2bf6['model'];_0x104636[_0xeccd('0x39')]=qs['sort'](_0xae9f0e[_0xeccd('0x31')]['sort']);_0x104636[_0xeccd('0x3b')]=qs[_0xeccd('0x32')](_[_0xeccd('0x51')](_0xae9f0e[_0xeccd('0x31')],_0x2c2bf6['filters']));if(_0xae9f0e[_0xeccd('0x31')][_0xeccd('0x3e')]){_0x104636[_0xeccd('0x3b')]=_[_0xeccd('0x46')](_0x104636[_0xeccd('0x3b')],{'$or':_[_0xeccd('0x2b')](_0x104636['attributes'],function(_0xd9335){var _0x573646={};_0x573646[_0xd9335]={'$like':'%'+_0xae9f0e[_0xeccd('0x31')][_0xeccd('0x3e')]+'%'};return _0x573646;})});}_0x104636=_['merge']({},_0x104636,_0xae9f0e['options']);return _0x3f1fa6[_0xeccd('0x5b')](_0x104636);}})[_0xeccd('0x23')](function(_0x4b052c){if(_0x4b052c){_0xb9f42e=_0x4b052c[_0xeccd('0x36')];if(!_0xae9f0e[_0xeccd('0x31')][_0xeccd('0x37')](_0xeccd('0x38'))){_0x104636[_0xeccd('0x1f')]=qs['limit'](_0xae9f0e[_0xeccd('0x31')][_0xeccd('0x1f')]);_0x104636[_0xeccd('0x1e')]=qs[_0xeccd('0x1e')](_0xae9f0e[_0xeccd('0x31')]['offset']);}return _0x3f1fa6[_0xeccd('0x5b')](_0x104636);}})[_0xeccd('0x23')](function(_0x2e71c7){if(_0x2e71c7){return _0x2e71c7?{'count':_0xb9f42e,'rows':_0x2e71c7}:null;}})['then'](respondWithResult(_0x56cb73,null))[_0xeccd('0x43')](handleError(_0x56cb73,null));};exports[_0xeccd('0x5d')]=function(_0x55e8f9,_0x2e2859,_0xe4d86b){var _0x56bef4=_0x55e8f9[_0xeccd('0x48')][_0xeccd('0x5e')];return db[_0xeccd('0x5c')][_0xeccd('0x42')]({'where':{'id':_0x56bef4},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeccd('0x5f'),'attributes':['id',_0xeccd('0x28'),'online',_0xeccd('0x60'),_0xeccd('0x61')],'raw':!![]}]})[_0xeccd('0x23')](function(_0x559f53){if(_0x559f53){var _0x235e58=_['flatMap'](_0x559f53,function(_0x870c3c){var _0x3c1561=_0x870c3c[_0xeccd('0x24')]({'plain':!![]});return _0x3c1561[_0xeccd('0x5f')];});return db['MailQueue']['find']({'where':{'id':_0x55e8f9[_0xeccd('0x44')]['id']}})[_0xeccd('0x23')](function(_0x357be5){return db[_0xeccd('0x62')]['transaction'](function(_0x4388b3){return _0x357be5['addTeams'](_0x56bef4,{'transaction':_0x4388b3})['then'](function(){return BPromise[_0xeccd('0x63')](_0x235e58,function(_0x2a026c){return db['UserMailQueue'][_0xeccd('0x64')]({'where':{'UserId':_0x2a026c['id'],'MailQueueId':_0x55e8f9[_0xeccd('0x44')]['id']},'transaction':_0x4388b3});});})[_0xeccd('0x23')](function(){_0x235e58['forEach'](function(_0x4e1483){socket[_0xeccd('0x65')](_0xeccd('0x66'),{'UserId':_0x4e1483['id'],'MailQueueId':_0x357be5['id']});});});});});}})['then'](respondWithStatusCode(_0x2e2859,null))[_0xeccd('0x43')](handleError(_0x2e2859,null));};exports[_0xeccd('0x67')]=function(_0x3156e3,_0x22849e,_0x2ff021){return db[_0xeccd('0x5c')]['findAll']({'where':{'id':_0x3156e3['query'][_0xeccd('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xeccd('0x68')],'as':_0xeccd('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xeccd('0x23')](handleEntityNotFound(_0x22849e,null))[_0xeccd('0x23')](function(_0x2edd2b){var _0x172b43=_['map'](_0x2edd2b,'id');var _0x48df41=[];var _0x381741=[];var _0x1afd33=squel[_0xeccd('0x69')]();_0x1afd33[_0xeccd('0x6a')](_0xeccd('0x6b'))[_0xeccd('0x6c')](_0xeccd('0x6d'),'tq')[_0xeccd('0x6e')](_0xeccd('0x6f'),'ut',_0xeccd('0x70'))[_0xeccd('0x3b')](_0xeccd('0x71'),_0x3156e3[_0xeccd('0x44')]['id']);for(var _0x459877=0x0;_0x459877<_0x2edd2b[_0xeccd('0x36')];_0x459877+=0x1){let _0x3e75e0=_0x2edd2b[_0x459877];for(var _0x50d9b7=0x0;_0x50d9b7<_0x3e75e0[_0xeccd('0x5f')][_0xeccd('0x36')];_0x50d9b7+=0x1){let _0x51d68b=_0x3e75e0[_0xeccd('0x5f')][_0x50d9b7];var _0x1d899a=_0x1afd33[_0xeccd('0x72')]();_0x1d899a['where'](_0xeccd('0x73'),_0x51d68b['id']);_0x381741[_0xeccd('0x74')](db[_0xeccd('0x62')][_0xeccd('0x31')](_0x1d899a[_0xeccd('0x75')](),{'type':db[_0xeccd('0x62')][_0xeccd('0x76')][_0xeccd('0x77')]})[_0xeccd('0x23')](function(_0x25ad43){if(_0x25ad43[_0xeccd('0x36')]===0x1){return _0x51d68b['id'];}else{var _0x140fb5=_[_0xeccd('0x78')](_['map'](_0x25ad43,_0xeccd('0x79')),function(_0xaca278){return _[_0xeccd('0x7a')](_0x172b43,_0xaca278);});if(_0x140fb5){return _0x51d68b['id'];}}}));}}return BPromise['all'](_0x381741)[_0xeccd('0x23')](function(_0x44509e){_0x48df41=_(_0x48df41)[_0xeccd('0x7b')](_0x44509e)[_0xeccd('0x7c')]()[_0xeccd('0x7d')]();return db['MailQueue'][_0xeccd('0x4c')]({'where':{'id':_0x3156e3[_0xeccd('0x44')]['id']}})[_0xeccd('0x23')](function(_0x3778ad){return db[_0xeccd('0x62')][_0xeccd('0x7e')](function(_0x3d3cf6){return _0x3778ad[_0xeccd('0x67')](_0x3156e3[_0xeccd('0x31')][_0xeccd('0x5e')],{'transaction':_0x3d3cf6})['then'](function(){if(!_[_0xeccd('0x7f')](_0x48df41)){return _0x3778ad[_0xeccd('0x80')](_0x48df41,{'transaction':_0x3d3cf6});}})[_0xeccd('0x23')](function(){_0x48df41['forEach'](function(_0x44c9bd){socket['emit']('userMailQueue:remove',{'UserId':_0x44c9bd,'MailQueueId':_0x3778ad['id']});});});});});});})['then'](respondWithStatusCode(_0x22849e,null))[_0xeccd('0x43')](handleError(_0x22849e,null));};exports[_0xeccd('0x81')]=function(_0x2d189d,_0x5990ef,_0x12b18e){return db[_0xeccd('0x2c')][_0xeccd('0x4c')]({'where':{'id':_0x2d189d[_0xeccd('0x44')]['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0x5990ef,null))[_0xeccd('0x23')](function(_0x20017e){if(_0x20017e){return _0x20017e['addAgents'](_0x2d189d[_0xeccd('0x48')][_0xeccd('0x5e')],_[_0xeccd('0x82')](_0x2d189d[_0xeccd('0x48')],[_0xeccd('0x5e'),'id'])||{})[_0xeccd('0x83')](function(_0x2a4f95){for(var _0x549d7a=0x0;_0x549d7a<_0x2d189d['body'][_0xeccd('0x5e')]['length'];_0x549d7a+=0x1){socket['emit'](_0xeccd('0x66'),{'UserId':_0x2d189d['body'][_0xeccd('0x5e')][_0x549d7a],'MailQueueId':_0x2d189d['params']['id']});}return _0x2a4f95;});}})['then'](respondWithResult(_0x5990ef,null))[_0xeccd('0x43')](handleError(_0x5990ef,null));};exports[_0xeccd('0x80')]=function(_0x35c5a0,_0x41911f,_0x5995ed){return db[_0xeccd('0x2c')]['find']({'where':{'id':_0x35c5a0[_0xeccd('0x44')]['id']}})[_0xeccd('0x23')](handleEntityNotFound(_0x41911f,null))[_0xeccd('0x23')](function(_0x505b9d){if(_0x505b9d){return _0x505b9d[_0xeccd('0x80')](_0x35c5a0['query'][_0xeccd('0x5e')])['then'](function(){if(_['isArray'](_0x35c5a0[_0xeccd('0x31')][_0xeccd('0x5e')])){for(var _0x463dbc=0x0;_0x463dbc<_0x35c5a0[_0xeccd('0x31')]['ids'][_0xeccd('0x36')];_0x463dbc+=0x1){socket['emit'](_0xeccd('0x84'),{'UserId':Number(_0x35c5a0[_0xeccd('0x31')]['ids'][_0x463dbc]),'MailQueueId':Number(_0x35c5a0[_0xeccd('0x44')]['id'])});}}else{socket[_0xeccd('0x65')](_0xeccd('0x84'),{'UserId':Number(_0x35c5a0[_0xeccd('0x31')][_0xeccd('0x5e')]),'MailQueueId':Number(_0x35c5a0[_0xeccd('0x44')]['id'])});}});}})[_0xeccd('0x23')](respondWithStatusCode(_0x41911f,null))[_0xeccd('0x43')](handleError(_0x41911f,null));};exports[_0xeccd('0x85')]=function(_0x4ce5a2,_0x41acc5,_0x3c1f09){var _0x488975={};var _0x5a7fb8={};var _0x4bd879;var _0x57c5d5;return db[_0xeccd('0x2c')][_0xeccd('0x50')]({'where':{'id':_0x4ce5a2['params']['id']}})['then'](handleEntityNotFound(_0x41acc5,null))[_0xeccd('0x23')](function(_0x160676){if(_0x160676){_0x4bd879=_0x160676;_0x5a7fb8[_0xeccd('0x30')]=_['keys'](db[_0xeccd('0x68')][_0xeccd('0x2d')]);_0x5a7fb8['query']=_[_0xeccd('0x45')](_0x4ce5a2[_0xeccd('0x31')]);_0x5a7fb8[_0xeccd('0x32')]=_['intersection'](_0x5a7fb8[_0xeccd('0x30')],_0x5a7fb8['query']);_0x488975[_0xeccd('0x34')]=_[_0xeccd('0x33')](_0x5a7fb8['model'],qs[_0xeccd('0x35')](_0x4ce5a2[_0xeccd('0x31')][_0xeccd('0x35')]));_0x488975[_0xeccd('0x34')]=_0x488975[_0xeccd('0x34')][_0xeccd('0x36')]?_0x488975[_0xeccd('0x34')]:_0x5a7fb8['model'];_0x488975[_0xeccd('0x39')]=qs[_0xeccd('0x3a')](_0x4ce5a2[_0xeccd('0x31')][_0xeccd('0x3a')]);_0x488975[_0xeccd('0x3b')]=qs[_0xeccd('0x32')](_[_0xeccd('0x51')](_0x4ce5a2[_0xeccd('0x31')],_0x5a7fb8['filters']));if(_0x4ce5a2[_0xeccd('0x31')][_0xeccd('0x3e')]){_0x488975[_0xeccd('0x3b')]=_['merge'](_0x488975[_0xeccd('0x3b')],{'$or':_[_0xeccd('0x2b')](_0x488975[_0xeccd('0x34')],function(_0x16b803){var _0x4a36f6={};_0x4a36f6[_0x16b803]={'$like':'%'+_0x4ce5a2[_0xeccd('0x31')][_0xeccd('0x3e')]+'%'};return _0x4a36f6;})});}_0x488975=_[_0xeccd('0x46')]({},_0x488975,_0x4ce5a2[_0xeccd('0x3f')]);return _0x4bd879[_0xeccd('0x85')](_0x488975);}})[_0xeccd('0x23')](function(_0x3fd5a9){if(_0x3fd5a9){_0x57c5d5=_0x3fd5a9['length'];if(!_0x4ce5a2['query'][_0xeccd('0x37')](_0xeccd('0x38'))){_0x488975[_0xeccd('0x1f')]=qs['limit'](_0x4ce5a2[_0xeccd('0x31')][_0xeccd('0x1f')]);_0x488975['offset']=qs[_0xeccd('0x1e')](_0x4ce5a2[_0xeccd('0x31')][_0xeccd('0x1e')]);}return _0x4bd879[_0xeccd('0x85')](_0x488975);}})[_0xeccd('0x23')](function(_0x87b65d){if(_0x87b65d){return _0x87b65d?{'count':_0x57c5d5,'rows':_0x87b65d}:null;}})[_0xeccd('0x23')](respondWithResult(_0x41acc5,null))['catch'](handleError(_0x41acc5,null));}; \ No newline at end of file +var _0xfc61=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','register','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','error','name','send','index','map','MailQueue','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','describe','getMembers','UserMailQueue','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','Agents','voicePause','sequelize','transaction','each','forEach','emit','userMailQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','value','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring'];(function(_0x5df445,_0x3d96e2){var _0x4f76b5=function(_0x33ff8e){while(--_0x33ff8e){_0x5df445['push'](_0x5df445['shift']());}};_0x4f76b5(++_0x3d96e2);}(_0xfc61,0x78));var _0x1fc6=function(_0x53b16b,_0x2a6550){_0x53b16b=_0x53b16b-0x0;var _0x5d10f3=_0xfc61[_0x53b16b];return _0x5d10f3;};'use strict';var pdf=require(_0x1fc6('0x0'));var emlformat=require(_0x1fc6('0x1'));var rimraf=require(_0x1fc6('0x2'));var zipdir=require(_0x1fc6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1fc6('0x4'));var Mustache=require(_0x1fc6('0x5'));var util=require(_0x1fc6('0x6'));var path=require(_0x1fc6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1fc6('0x8'));var fs=require('fs');var _=require(_0x1fc6('0x9'));var squel=require(_0x1fc6('0xa'));var crypto=require(_0x1fc6('0xb'));var jsforce=require(_0x1fc6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1fc6('0xd'));var querystring=require(_0x1fc6('0xe'));var Papa=require(_0x1fc6('0xf'));var Redis=require(_0x1fc6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1fc6('0x11'));var as=require(_0x1fc6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1fc6('0x13'))(_0x1fc6('0x14'));var utils=require(_0x1fc6('0x15'));var config=require(_0x1fc6('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1fc6('0x17')]=_[_0x1fc6('0x18')](config[_0x1fc6('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1fc6('0x17')]));require('./mailQueue.socket')[_0x1fc6('0x19')](socket);function respondWithStatusCode(_0x35ecb5,_0x2e43f1){_0x2e43f1=_0x2e43f1||0xcc;return function(_0xe160d5){if(_0xe160d5){return _0x35ecb5[_0x1fc6('0x1a')](_0x2e43f1);}return _0x35ecb5[_0x1fc6('0x1b')](_0x2e43f1)[_0x1fc6('0x1c')]();};}function respondWithResult(_0x141d3e,_0x578045){_0x578045=_0x578045||0xc8;return function(_0xd671fc){if(_0xd671fc){return _0x141d3e[_0x1fc6('0x1b')](_0x578045)[_0x1fc6('0x1d')](_0xd671fc);}};}function respondWithFilteredResult(_0xcde85e,_0x3a144b){return function(_0x2b0294){if(_0x2b0294){var _0x3e9406=_0x2b0294[_0x1fc6('0x1e')],_0x5f3b49=_0x3a144b[_0x1fc6('0x1f')],_0x3e2996=_0x3a144b[_0x1fc6('0x1f')]+_0x3a144b[_0x1fc6('0x20')],_0x318bb5;if(_0x3e2996>=_0x3e9406){_0x3e2996=_0x3e9406;_0x318bb5=0xc8;}else{_0x318bb5=0xce;}_0xcde85e[_0x1fc6('0x1b')](_0x318bb5);return _0xcde85e['set']('Content-Range',_0x5f3b49+'-'+_0x3e2996+'/'+_0x3e9406)['json'](_0x2b0294);}return null;};}function patchUpdates(_0x37742e){return function(_0x3ae4a3){try{jsonpatch['apply'](_0x3ae4a3,_0x37742e,!![]);}catch(_0x1b52b3){return BPromise[_0x1fc6('0x21')](_0x1b52b3);}return _0x3ae4a3[_0x1fc6('0x22')]();};}function saveUpdates(_0x38a792,_0xbd5b8){return function(_0x421a6f){if(_0x421a6f){return _0x421a6f[_0x1fc6('0x23')](_0x38a792)[_0x1fc6('0x24')](function(_0x891eba){return _0x891eba;});}return null;};}function removeEntity(_0xc6965f,_0x2465a4){return function(_0xe5a4fb){if(_0xe5a4fb){return _0xe5a4fb[_0x1fc6('0x25')]()['then'](function(){var _0x2975ca=_0xe5a4fb[_0x1fc6('0x26')]({'plain':!![]});var _0x202506=_0x1fc6('0x27');return db[_0x1fc6('0x28')][_0x1fc6('0x25')]({'where':{'type':_0x202506,'resourceId':_0x2975ca['id']}})[_0x1fc6('0x24')](function(){return _0xe5a4fb;});})[_0x1fc6('0x24')](function(){_0xc6965f[_0x1fc6('0x1b')](0xcc)[_0x1fc6('0x1c')]();});}};}function handleEntityNotFound(_0x1dc319,_0x2aa8b){return function(_0x2be9f8){if(!_0x2be9f8){_0x1dc319[_0x1fc6('0x1a')](0x194);}return _0x2be9f8;};}function handleError(_0x481c38,_0x287c3e){_0x287c3e=_0x287c3e||0x1f4;return function(_0x2996db){logger[_0x1fc6('0x29')](_0x2996db['stack']);if(_0x2996db[_0x1fc6('0x2a')]){delete _0x2996db[_0x1fc6('0x2a')];}_0x481c38[_0x1fc6('0x1b')](_0x287c3e)[_0x1fc6('0x2b')](_0x2996db);};}exports[_0x1fc6('0x2c')]=function(_0x41886c,_0x39612c){var _0x37cc93={},_0x56720a={},_0x1ad343={'count':0x0,'rows':[]};var _0x279bb5=_[_0x1fc6('0x2d')](db[_0x1fc6('0x2e')][_0x1fc6('0x2f')],function(_0x987ac7){return{'name':_0x987ac7[_0x1fc6('0x30')],'type':_0x987ac7['type'][_0x1fc6('0x31')]};});_0x56720a[_0x1fc6('0x32')]=_[_0x1fc6('0x2d')](_0x279bb5,_0x1fc6('0x2a'));_0x56720a[_0x1fc6('0x33')]=_['keys'](_0x41886c['query']);_0x56720a[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0x56720a[_0x1fc6('0x32')],_0x56720a[_0x1fc6('0x33')]);_0x37cc93['attributes']=_[_0x1fc6('0x35')](_0x56720a[_0x1fc6('0x32')],qs[_0x1fc6('0x36')](_0x41886c[_0x1fc6('0x33')][_0x1fc6('0x36')]));_0x37cc93['attributes']=_0x37cc93[_0x1fc6('0x37')][_0x1fc6('0x38')]?_0x37cc93[_0x1fc6('0x37')]:_0x56720a[_0x1fc6('0x32')];if(!_0x41886c[_0x1fc6('0x33')][_0x1fc6('0x39')](_0x1fc6('0x3a'))){_0x37cc93[_0x1fc6('0x20')]=qs[_0x1fc6('0x20')](_0x41886c[_0x1fc6('0x33')][_0x1fc6('0x20')]);_0x37cc93[_0x1fc6('0x1f')]=qs[_0x1fc6('0x1f')](_0x41886c[_0x1fc6('0x33')][_0x1fc6('0x1f')]);}_0x37cc93[_0x1fc6('0x3b')]=qs[_0x1fc6('0x3c')](_0x41886c[_0x1fc6('0x33')][_0x1fc6('0x3c')]);_0x37cc93['where']=qs[_0x1fc6('0x34')](_[_0x1fc6('0x3d')](_0x41886c[_0x1fc6('0x33')],_0x56720a[_0x1fc6('0x34')]),_0x279bb5);if(_0x41886c['query'][_0x1fc6('0x3e')]){_0x37cc93[_0x1fc6('0x3f')]=_[_0x1fc6('0x40')](_0x37cc93[_0x1fc6('0x3f')],{'$or':_[_0x1fc6('0x2d')](_0x279bb5,function(_0x1f6d6a){if(_0x1f6d6a['type']!==_0x1fc6('0x41')){var _0x4e7ac1={};_0x4e7ac1[_0x1f6d6a[_0x1fc6('0x2a')]]={'$like':'%'+_0x41886c[_0x1fc6('0x33')][_0x1fc6('0x3e')]+'%'};return _0x4e7ac1;}})});}_0x37cc93=_[_0x1fc6('0x40')]({},_0x37cc93,_0x41886c[_0x1fc6('0x42')]);var _0x52e6bd={'where':_0x37cc93[_0x1fc6('0x3f')]};return db[_0x1fc6('0x2e')][_0x1fc6('0x1e')](_0x52e6bd)[_0x1fc6('0x24')](function(_0x3913dc){_0x1ad343['count']=_0x3913dc;if(_0x41886c[_0x1fc6('0x33')][_0x1fc6('0x43')]){_0x37cc93[_0x1fc6('0x44')]=[{'all':!![]}];}return db[_0x1fc6('0x2e')]['findAll'](_0x37cc93);})[_0x1fc6('0x24')](function(_0x3bafe1){_0x1ad343[_0x1fc6('0x45')]=_0x3bafe1;return _0x1ad343;})[_0x1fc6('0x24')](respondWithFilteredResult(_0x39612c,_0x37cc93))[_0x1fc6('0x46')](handleError(_0x39612c,null));};exports[_0x1fc6('0x47')]=function(_0x13e630,_0x18db1a){var _0x2ca93f={'raw':!![],'where':{'id':_0x13e630[_0x1fc6('0x48')]['id']}},_0x149024={};_0x149024['model']=_[_0x1fc6('0x49')](db[_0x1fc6('0x2e')][_0x1fc6('0x2f')]);_0x149024[_0x1fc6('0x33')]=_['keys'](_0x13e630['query']);_0x149024[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0x149024[_0x1fc6('0x32')],_0x149024[_0x1fc6('0x33')]);_0x2ca93f['attributes']=_['intersection'](_0x149024[_0x1fc6('0x32')],qs['fields'](_0x13e630[_0x1fc6('0x33')][_0x1fc6('0x36')]));_0x2ca93f['attributes']=_0x2ca93f[_0x1fc6('0x37')][_0x1fc6('0x38')]?_0x2ca93f['attributes']:_0x149024['model'];if(_0x13e630[_0x1fc6('0x33')]['includeAll']){_0x2ca93f['include']=[{'all':!![]}];}_0x2ca93f=_[_0x1fc6('0x40')]({},_0x2ca93f,_0x13e630[_0x1fc6('0x42')]);return db[_0x1fc6('0x2e')][_0x1fc6('0x4a')](_0x2ca93f)['then'](handleEntityNotFound(_0x18db1a,null))[_0x1fc6('0x24')](respondWithResult(_0x18db1a,null))[_0x1fc6('0x46')](handleError(_0x18db1a,null));};exports[_0x1fc6('0x4b')]=function(_0x5b59ab,_0x2656dd){return db['MailQueue'][_0x1fc6('0x4b')](_0x5b59ab[_0x1fc6('0x4c')],{})['then'](function(_0x16eea6){var _0x239fd4=_0x5b59ab[_0x1fc6('0x4d')][_0x1fc6('0x26')]({'plain':!![]});if(!_0x239fd4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x239fd4[_0x1fc6('0x4e')]==='user'){var _0x7a66ba=_0x16eea6['get']({'plain':!![]});var _0x3520cf=_0x1fc6('0x27');return db[_0x1fc6('0x4f')]['find']({'where':{'name':_0x3520cf,'userProfileId':_0x239fd4[_0x1fc6('0x50')]},'raw':!![]})[_0x1fc6('0x24')](function(_0x28f94d){if(_0x28f94d&&_0x28f94d['autoAssociation']===0x0){return db[_0x1fc6('0x28')]['create']({'name':_0x7a66ba[_0x1fc6('0x2a')],'resourceId':_0x7a66ba['id'],'type':_0x28f94d['name'],'sectionId':_0x28f94d['id']},{})['then'](function(){return _0x16eea6;});}else{return _0x16eea6;}})[_0x1fc6('0x46')](function(_0x43242b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43242b);throw _0x43242b;});}return _0x16eea6;})['then'](respondWithResult(_0x2656dd,0xc9))[_0x1fc6('0x46')](handleError(_0x2656dd,null));};exports[_0x1fc6('0x23')]=function(_0x331634,_0x28f058){if(_0x331634[_0x1fc6('0x4c')]['id']){delete _0x331634[_0x1fc6('0x4c')]['id'];}return db[_0x1fc6('0x2e')][_0x1fc6('0x4a')]({'where':{'id':_0x331634[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x24')](handleEntityNotFound(_0x28f058,null))[_0x1fc6('0x24')](saveUpdates(_0x331634['body'],null))[_0x1fc6('0x24')](respondWithResult(_0x28f058,null))[_0x1fc6('0x46')](handleError(_0x28f058,null));};exports[_0x1fc6('0x25')]=function(_0x1124c5,_0x139f2e){return db[_0x1fc6('0x2e')][_0x1fc6('0x4a')]({'where':{'id':_0x1124c5[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x24')](handleEntityNotFound(_0x139f2e,null))[_0x1fc6('0x24')](removeEntity(_0x139f2e,null))[_0x1fc6('0x46')](handleError(_0x139f2e,null));};exports[_0x1fc6('0x51')]=function(_0x554ffd,_0x443602){return db[_0x1fc6('0x2e')][_0x1fc6('0x51')]()[_0x1fc6('0x24')](respondWithResult(_0x443602,null))['catch'](handleError(_0x443602,null));};exports[_0x1fc6('0x52')]=function(_0x155440,_0x7f3ad6,_0x12f174){var _0x317419={'raw':!![],'where':{}},_0x4171f1={},_0x4d4356;return db[_0x1fc6('0x2e')]['findOne']({'where':{'id':_0x155440[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x24')](handleEntityNotFound(_0x7f3ad6,null))[_0x1fc6('0x24')](function(_0x58b84a){if(_0x58b84a){_0x4d4356=_0x58b84a[_0x1fc6('0x26')]({'plain':!![]});_0x4171f1[_0x1fc6('0x32')]=_['keys'](db[_0x1fc6('0x53')][_0x1fc6('0x2f')]);_0x4171f1[_0x1fc6('0x33')]=_[_0x1fc6('0x49')](_0x155440[_0x1fc6('0x33')]);_0x4171f1[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0x4171f1[_0x1fc6('0x32')],_0x4171f1[_0x1fc6('0x33')]);_0x317419[_0x1fc6('0x37')]=_[_0x1fc6('0x35')](_0x4171f1[_0x1fc6('0x32')],qs['fields'](_0x155440[_0x1fc6('0x33')][_0x1fc6('0x36')]));_0x317419[_0x1fc6('0x37')]=_0x317419[_0x1fc6('0x37')]['length']?_0x317419[_0x1fc6('0x37')]:_0x4171f1[_0x1fc6('0x32')];if(!_0x155440[_0x1fc6('0x33')][_0x1fc6('0x39')](_0x1fc6('0x3a'))){_0x317419[_0x1fc6('0x20')]=qs[_0x1fc6('0x20')](_0x155440[_0x1fc6('0x33')][_0x1fc6('0x20')]);_0x317419[_0x1fc6('0x1f')]=qs[_0x1fc6('0x1f')](_0x155440[_0x1fc6('0x33')]['offset']);}_0x317419['order']=qs[_0x1fc6('0x3c')](_0x155440[_0x1fc6('0x33')]['sort']);_0x317419[_0x1fc6('0x3f')]=qs['filters'](_[_0x1fc6('0x3d')](_0x155440[_0x1fc6('0x33')],_0x4171f1['filters']));_0x317419[_0x1fc6('0x3f')][_0x1fc6('0x54')]=_0x58b84a['id'];if(_0x155440[_0x1fc6('0x33')][_0x1fc6('0x3e')]){_0x317419['where']=_[_0x1fc6('0x40')](_0x317419['where'],{'$or':_[_0x1fc6('0x2d')](_0x317419[_0x1fc6('0x37')],function(_0x532042){var _0x2383ad={};_0x2383ad[_0x532042]={'$like':'%'+_0x155440['query'][_0x1fc6('0x3e')]+'%'};return _0x2383ad;})});}_0x317419=_['merge']({},_0x317419,_0x155440[_0x1fc6('0x42')]);return db[_0x1fc6('0x53')][_0x1fc6('0x55')](_0x317419);}})[_0x1fc6('0x24')](function(_0x1f3675){if(_0x1f3675){return db[_0x1fc6('0x56')][_0x1fc6('0x57')]({'where':{'id':_[_0x1fc6('0x2d')](_0x1f3675,_0x1fc6('0x58')),'role':_0x1fc6('0x59')},'attributes':['id','name',_0x1fc6('0x5a'),_0x1fc6('0x5b'),_0x1fc6('0x5c')]});}})[_0x1fc6('0x24')](function(_0x49bb94){if(_0x49bb94){return{'count':_0x49bb94[_0x1fc6('0x1e')],'rows':_[_0x1fc6('0x2d')](_0x49bb94[_0x1fc6('0x45')],function(_0x5d979f){return{'membername':_0x5d979f[_0x1fc6('0x2a')],'UserId':_0x5d979f['id'],'queue_name':_0x4d4356[_0x1fc6('0x2a')],'MailQueueId':_0x4d4356['id'],'interface':util[_0x1fc6('0x5d')](_0x1fc6('0x5e'),_0x1fc6('0x5f'),_0x5d979f['name']),'penalty':0x0,'paused':_0x5d979f[_0x1fc6('0x5a')],'createdAt':_0x5d979f[_0x1fc6('0x5c')],'updatedAt':_0x5d979f[_0x1fc6('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1fc6('0x24')](respondWithFilteredResult(_0x7f3ad6,_0x317419))[_0x1fc6('0x46')](handleError(_0x7f3ad6,null));};exports[_0x1fc6('0x60')]=function(_0x269e7d,_0x44769d,_0x54a83d){var _0x5c9bb6={};var _0x1597b7={};var _0xd1ffbf;var _0x56528d;return db[_0x1fc6('0x2e')][_0x1fc6('0x61')]({'where':{'id':_0x269e7d['params']['id']}})[_0x1fc6('0x24')](handleEntityNotFound(_0x44769d,null))[_0x1fc6('0x24')](function(_0x2092ce){if(_0x2092ce){_0xd1ffbf=_0x2092ce;_0x1597b7[_0x1fc6('0x32')]=_[_0x1fc6('0x49')](db['Team'][_0x1fc6('0x2f')]);_0x1597b7['query']=_[_0x1fc6('0x49')](_0x269e7d[_0x1fc6('0x33')]);_0x1597b7['filters']=_[_0x1fc6('0x35')](_0x1597b7['model'],_0x1597b7[_0x1fc6('0x33')]);_0x5c9bb6[_0x1fc6('0x37')]=_[_0x1fc6('0x35')](_0x1597b7['model'],qs[_0x1fc6('0x36')](_0x269e7d['query'][_0x1fc6('0x36')]));_0x5c9bb6[_0x1fc6('0x37')]=_0x5c9bb6['attributes'][_0x1fc6('0x38')]?_0x5c9bb6[_0x1fc6('0x37')]:_0x1597b7[_0x1fc6('0x32')];_0x5c9bb6['order']=qs['sort'](_0x269e7d[_0x1fc6('0x33')][_0x1fc6('0x3c')]);_0x5c9bb6[_0x1fc6('0x3f')]=qs[_0x1fc6('0x34')](_[_0x1fc6('0x3d')](_0x269e7d[_0x1fc6('0x33')],_0x1597b7[_0x1fc6('0x34')]));if(_0x269e7d[_0x1fc6('0x33')][_0x1fc6('0x3e')]){_0x5c9bb6['where']=_[_0x1fc6('0x40')](_0x5c9bb6['where'],{'$or':_['map'](_0x5c9bb6[_0x1fc6('0x37')],function(_0x303dbb){var _0x5e8a5c={};_0x5e8a5c[_0x303dbb]={'$like':'%'+_0x269e7d[_0x1fc6('0x33')][_0x1fc6('0x3e')]+'%'};return _0x5e8a5c;})});}_0x5c9bb6=_[_0x1fc6('0x40')]({},_0x5c9bb6,_0x269e7d[_0x1fc6('0x42')]);return _0xd1ffbf['getTeams'](_0x5c9bb6);}})[_0x1fc6('0x24')](function(_0x213273){if(_0x213273){_0x56528d=_0x213273[_0x1fc6('0x38')];if(!_0x269e7d[_0x1fc6('0x33')]['hasOwnProperty']('nolimit')){_0x5c9bb6['limit']=qs['limit'](_0x269e7d[_0x1fc6('0x33')][_0x1fc6('0x20')]);_0x5c9bb6[_0x1fc6('0x1f')]=qs['offset'](_0x269e7d['query']['offset']);}return _0xd1ffbf[_0x1fc6('0x60')](_0x5c9bb6);}})[_0x1fc6('0x24')](function(_0x22d464){if(_0x22d464){return _0x22d464?{'count':_0x56528d,'rows':_0x22d464}:null;}})['then'](respondWithResult(_0x44769d,null))['catch'](handleError(_0x44769d,null));};exports[_0x1fc6('0x62')]=function(_0xfc6206,_0x23a81c,_0x1bd362){var _0x5a2742=_0xfc6206[_0x1fc6('0x4c')][_0x1fc6('0x63')];return db['Team'][_0x1fc6('0x55')]({'where':{'id':_0x5a2742},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1fc6('0x64'),'attributes':['id','name','online',_0x1fc6('0x65'),'interface'],'raw':!![]}]})[_0x1fc6('0x24')](function(_0x26c1f6){if(_0x26c1f6){var _0x400f94=_['flatMap'](_0x26c1f6,function(_0xf43e22){var _0x2aabc2=_0xf43e22['get']({'plain':!![]});return _0x2aabc2[_0x1fc6('0x64')];});return db[_0x1fc6('0x2e')]['find']({'where':{'id':_0xfc6206[_0x1fc6('0x48')]['id']}})['then'](function(_0x232bb9){return db[_0x1fc6('0x66')][_0x1fc6('0x67')](function(_0x5c6316){return _0x232bb9[_0x1fc6('0x62')](_0x5a2742,{'transaction':_0x5c6316})['then'](function(){return BPromise[_0x1fc6('0x68')](_0x400f94,function(_0x2d7233){return db[_0x1fc6('0x53')]['findOrCreate']({'where':{'UserId':_0x2d7233['id'],'MailQueueId':_0xfc6206[_0x1fc6('0x48')]['id']},'transaction':_0x5c6316});});})[_0x1fc6('0x24')](function(){_0x400f94[_0x1fc6('0x69')](function(_0x501c0b){socket[_0x1fc6('0x6a')](_0x1fc6('0x6b'),{'UserId':_0x501c0b['id'],'MailQueueId':_0x232bb9['id']});});});});});}})[_0x1fc6('0x24')](respondWithStatusCode(_0x23a81c,null))[_0x1fc6('0x46')](handleError(_0x23a81c,null));};exports[_0x1fc6('0x6c')]=function(_0x5c4ca2,_0x20ef33,_0x2cb884){return db[_0x1fc6('0x6d')][_0x1fc6('0x55')]({'where':{'id':_0x5c4ca2[_0x1fc6('0x33')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1fc6('0x56')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x20ef33,null))[_0x1fc6('0x24')](function(_0x2cf0f4){var _0x5e819f=_[_0x1fc6('0x2d')](_0x2cf0f4,'id');var _0x1f7eb1=[];var _0x46f134=[];var _0x383387=squel[_0x1fc6('0x6e')]();_0x383387[_0x1fc6('0x6f')](_0x1fc6('0x70'))[_0x1fc6('0x71')](_0x1fc6('0x72'),'tq')[_0x1fc6('0x73')](_0x1fc6('0x74'),'ut',_0x1fc6('0x75'))[_0x1fc6('0x3f')](_0x1fc6('0x76'),_0x5c4ca2['params']['id']);for(var _0xe5aefe=0x0;_0xe5aefe<_0x2cf0f4[_0x1fc6('0x38')];_0xe5aefe+=0x1){let _0x397362=_0x2cf0f4[_0xe5aefe];for(var _0x21526a=0x0;_0x21526a<_0x397362[_0x1fc6('0x64')]['length'];_0x21526a+=0x1){let _0x583a30=_0x397362[_0x1fc6('0x64')][_0x21526a];var _0x173d1e=_0x383387['clone']();_0x173d1e[_0x1fc6('0x3f')](_0x1fc6('0x77'),_0x583a30['id']);_0x46f134[_0x1fc6('0x78')](db[_0x1fc6('0x66')][_0x1fc6('0x33')](_0x173d1e[_0x1fc6('0x79')](),{'type':db['sequelize'][_0x1fc6('0x7a')][_0x1fc6('0x7b')]})[_0x1fc6('0x24')](function(_0x555790){if(_0x555790[_0x1fc6('0x38')]===0x1){return _0x583a30['id'];}else{var _0x37e182=_['every'](_[_0x1fc6('0x2d')](_0x555790,'TeamId'),function(_0x2dc868){return _[_0x1fc6('0x7c')](_0x5e819f,_0x2dc868);});if(_0x37e182){return _0x583a30['id'];}}}));}}return BPromise[_0x1fc6('0x7d')](_0x46f134)[_0x1fc6('0x24')](function(_0x1c2f40){_0x1f7eb1=_(_0x1f7eb1)[_0x1fc6('0x7e')](_0x1c2f40)['compact']()[_0x1fc6('0x7f')]();return db[_0x1fc6('0x2e')][_0x1fc6('0x4a')]({'where':{'id':_0x5c4ca2[_0x1fc6('0x48')]['id']}})[_0x1fc6('0x24')](function(_0x5755fc){return db[_0x1fc6('0x66')][_0x1fc6('0x67')](function(_0x53f4e6){return _0x5755fc['removeTeams'](_0x5c4ca2[_0x1fc6('0x33')]['ids'],{'transaction':_0x53f4e6})[_0x1fc6('0x24')](function(){if(!_['isEmpty'](_0x1f7eb1)){return _0x5755fc[_0x1fc6('0x80')](_0x1f7eb1,{'transaction':_0x53f4e6});}})[_0x1fc6('0x24')](function(){_0x1f7eb1['forEach'](function(_0x18758c){socket[_0x1fc6('0x6a')](_0x1fc6('0x81'),{'UserId':_0x18758c,'MailQueueId':_0x5755fc['id']});});});});});});})[_0x1fc6('0x24')](respondWithStatusCode(_0x20ef33,null))[_0x1fc6('0x46')](handleError(_0x20ef33,null));};exports['addAgents']=function(_0x14e846,_0x533d8c,_0x121541){return db[_0x1fc6('0x2e')][_0x1fc6('0x4a')]({'where':{'id':_0x14e846['params']['id']}})[_0x1fc6('0x24')](handleEntityNotFound(_0x533d8c,null))[_0x1fc6('0x24')](function(_0x215dd0){if(_0x215dd0){return _0x215dd0[_0x1fc6('0x82')](_0x14e846[_0x1fc6('0x4c')][_0x1fc6('0x63')],_[_0x1fc6('0x83')](_0x14e846[_0x1fc6('0x4c')],['ids','id'])||{})[_0x1fc6('0x84')](function(_0x61c784){for(var _0x1db139=0x0;_0x1db139<_0x14e846[_0x1fc6('0x4c')][_0x1fc6('0x63')][_0x1fc6('0x38')];_0x1db139+=0x1){socket[_0x1fc6('0x6a')](_0x1fc6('0x6b'),{'UserId':_0x14e846['body'][_0x1fc6('0x63')][_0x1db139],'MailQueueId':_0x14e846[_0x1fc6('0x48')]['id']});}return _0x61c784;});}})[_0x1fc6('0x24')](respondWithResult(_0x533d8c,null))['catch'](handleError(_0x533d8c,null));};exports[_0x1fc6('0x80')]=function(_0x443389,_0x26bc3b,_0x7ec348){return db[_0x1fc6('0x2e')][_0x1fc6('0x4a')]({'where':{'id':_0x443389[_0x1fc6('0x48')]['id']}})['then'](handleEntityNotFound(_0x26bc3b,null))[_0x1fc6('0x24')](function(_0x16f97a){if(_0x16f97a){return _0x16f97a[_0x1fc6('0x80')](_0x443389['query'][_0x1fc6('0x63')])[_0x1fc6('0x24')](function(){if(_[_0x1fc6('0x85')](_0x443389[_0x1fc6('0x33')][_0x1fc6('0x63')])){for(var _0xd9259f=0x0;_0xd9259f<_0x443389[_0x1fc6('0x33')][_0x1fc6('0x63')][_0x1fc6('0x38')];_0xd9259f+=0x1){socket[_0x1fc6('0x6a')](_0x1fc6('0x81'),{'UserId':Number(_0x443389['query']['ids'][_0xd9259f]),'MailQueueId':Number(_0x443389[_0x1fc6('0x48')]['id'])});}}else{socket[_0x1fc6('0x6a')](_0x1fc6('0x81'),{'UserId':Number(_0x443389[_0x1fc6('0x33')][_0x1fc6('0x63')]),'MailQueueId':Number(_0x443389[_0x1fc6('0x48')]['id'])});}});}})[_0x1fc6('0x24')](respondWithStatusCode(_0x26bc3b,null))[_0x1fc6('0x46')](handleError(_0x26bc3b,null));};exports[_0x1fc6('0x86')]=function(_0x3b0bb7,_0x4559ed,_0x23e5a3){var _0x3bdb5d={};var _0x5ed03f={};var _0x34a31e;var _0x2f9202;return db[_0x1fc6('0x2e')][_0x1fc6('0x61')]({'where':{'id':_0x3b0bb7['params']['id']}})[_0x1fc6('0x24')](handleEntityNotFound(_0x4559ed,null))[_0x1fc6('0x24')](function(_0x28349c){if(_0x28349c){_0x34a31e=_0x28349c;_0x5ed03f[_0x1fc6('0x32')]=_[_0x1fc6('0x49')](db[_0x1fc6('0x56')]['rawAttributes']);_0x5ed03f[_0x1fc6('0x33')]=_[_0x1fc6('0x49')](_0x3b0bb7[_0x1fc6('0x33')]);_0x5ed03f[_0x1fc6('0x34')]=_[_0x1fc6('0x35')](_0x5ed03f[_0x1fc6('0x32')],_0x5ed03f[_0x1fc6('0x33')]);_0x3bdb5d[_0x1fc6('0x37')]=_['intersection'](_0x5ed03f[_0x1fc6('0x32')],qs['fields'](_0x3b0bb7['query'][_0x1fc6('0x36')]));_0x3bdb5d['attributes']=_0x3bdb5d[_0x1fc6('0x37')][_0x1fc6('0x38')]?_0x3bdb5d['attributes']:_0x5ed03f['model'];_0x3bdb5d[_0x1fc6('0x3b')]=qs[_0x1fc6('0x3c')](_0x3b0bb7[_0x1fc6('0x33')][_0x1fc6('0x3c')]);_0x3bdb5d[_0x1fc6('0x3f')]=qs[_0x1fc6('0x34')](_['pick'](_0x3b0bb7[_0x1fc6('0x33')],_0x5ed03f['filters']));if(_0x3b0bb7[_0x1fc6('0x33')]['filter']){_0x3bdb5d['where']=_['merge'](_0x3bdb5d[_0x1fc6('0x3f')],{'$or':_[_0x1fc6('0x2d')](_0x3bdb5d[_0x1fc6('0x37')],function(_0x230b5e){var _0x2ae6a7={};_0x2ae6a7[_0x230b5e]={'$like':'%'+_0x3b0bb7[_0x1fc6('0x33')][_0x1fc6('0x3e')]+'%'};return _0x2ae6a7;})});}_0x3bdb5d=_['merge']({},_0x3bdb5d,_0x3b0bb7['options']);return _0x34a31e[_0x1fc6('0x86')](_0x3bdb5d);}})[_0x1fc6('0x24')](function(_0x1ec3e5){if(_0x1ec3e5){_0x2f9202=_0x1ec3e5['length'];if(!_0x3b0bb7[_0x1fc6('0x33')][_0x1fc6('0x39')](_0x1fc6('0x3a'))){_0x3bdb5d[_0x1fc6('0x20')]=qs[_0x1fc6('0x20')](_0x3b0bb7[_0x1fc6('0x33')][_0x1fc6('0x20')]);_0x3bdb5d[_0x1fc6('0x1f')]=qs['offset'](_0x3b0bb7['query'][_0x1fc6('0x1f')]);}return _0x34a31e[_0x1fc6('0x86')](_0x3bdb5d);}})[_0x1fc6('0x24')](function(_0x4d3e87){if(_0x4d3e87){return _0x4d3e87?{'count':_0x2f9202,'rows':_0x4d3e87}:null;}})[_0x1fc6('0x24')](respondWithResult(_0x4559ed,null))['catch'](handleError(_0x4559ed,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index abf9e54..87dc0db 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 _0x0d58=['emit','exports','events','../../mysqldb','MailQueue','setMaxListeners','update','remove'];(function(_0x31c3ec,_0x41a015){var _0x319164=function(_0x52c298){while(--_0x52c298){_0x31c3ec['push'](_0x31c3ec['shift']());}};_0x319164(++_0x41a015);}(_0x0d58,0x1ba));var _0x80d5=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0x0d58[_0x5de532];return _0x4e9192;};'use strict';var EventEmitter=require(_0x80d5('0x0'));var MailQueue=require(_0x80d5('0x1'))['db'][_0x80d5('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x80d5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x80d5('0x4'),'afterDestroy':_0x80d5('0x5')};function emitEvent(_0x146ffa){return function(_0x14ac3d,_0x5d4f94,_0x18fb68){MailQueueEvents[_0x80d5('0x6')](_0x146ffa+':'+_0x14ac3d['id'],_0x14ac3d);MailQueueEvents[_0x80d5('0x6')](_0x146ffa,_0x14ac3d);_0x18fb68(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x80d5('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x2c18=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x2c18,0x177));var _0x82c1=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x2c18[_0x134192];return _0x3cd080;};'use strict';var EventEmitter=require(_0x82c1('0x0'));var MailQueue=require(_0x82c1('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x82c1('0x2')](0x0);var events={'afterCreate':_0x82c1('0x3'),'afterUpdate':_0x82c1('0x4'),'afterDestroy':_0x82c1('0x5')};function emitEvent(_0x36735f){return function(_0x5183ed,_0x5b76a0,_0x5899d9){MailQueueEvents[_0x82c1('0x6')](_0x36735f+':'+_0x5183ed['id'],_0x5183ed);MailQueueEvents[_0x82c1('0x6')](_0x36735f,_0x5183ed);_0x5899d9(null);};}for(var e in events){if(events[_0x82c1('0x7')](e)){var event=events[e];MailQueue[_0x82c1('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 94751c5..b6dda7c 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 _0x4b1e=['rimraf','MailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x57ce90,_0x519e42){var _0x562661=function(_0x5b5a0f){while(--_0x5b5a0f){_0x57ce90['push'](_0x57ce90['shift']());}};_0x562661(++_0x519e42);}(_0x4b1e,0x14c));var _0xe4b1=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x4b1e[_0x40ebff];return _0x40122a;};'use strict';var _=require(_0xe4b1('0x0'));var util=require(_0xe4b1('0x1'));var logger=require(_0xe4b1('0x2'))(_0xe4b1('0x3'));var moment=require(_0xe4b1('0x4'));var BPromise=require(_0xe4b1('0x5'));var rp=require(_0xe4b1('0x6'));var fs=require('fs');var path=require(_0xe4b1('0x7'));var rimraf=require(_0xe4b1('0x8'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module['exports']=function(_0x45d1a1,_0x3eea67){return _0x45d1a1['define'](_0xe4b1('0x9'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe48d=['../../config/environment','./mailQueue.attributes','exports','mail_queues','api','moment','request-promise','path','rimraf'];(function(_0x2b37aa,_0x1d40dc){var _0x52b73d=function(_0x5eb623){while(--_0x5eb623){_0x2b37aa['push'](_0x2b37aa['shift']());}};_0x52b73d(++_0x1d40dc);}(_0xe48d,0x1d8));var _0xde48=function(_0x51e999,_0x1e7e76){_0x51e999=_0x51e999-0x0;var _0x46a243=_0xe48d[_0x51e999];return _0x46a243;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xde48('0x0'));var moment=require(_0xde48('0x1'));var BPromise=require('bluebird');var rp=require(_0xde48('0x2'));var fs=require('fs');var path=require(_0xde48('0x3'));var rimraf=require(_0xde48('0x4'));var config=require(_0xde48('0x5'));var attributes=require(_0xde48('0x6'));module[_0xde48('0x7')]=function(_0x573ecf,_0x17fe9b){return _0x573ecf['define']('MailQueue',attributes,{'tableName':_0xde48('0x8'),'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 c757d76..3e2cd24 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 _0x43e9=['rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','map','model','catch','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x27b3df,_0x34a01a){var _0x275390=function(_0x46e282){while(--_0x46e282){_0x27b3df['push'](_0x27b3df['shift']());}};_0x275390(++_0x34a01a);}(_0x43e9,0x148));var _0x943e=function(_0x588120,_0x5c2bbd){_0x588120=_0x588120-0x0;var _0x4eccb4=_0x43e9[_0x588120];return _0x4eccb4;};'use strict';var _=require(_0x943e('0x0'));var util=require(_0x943e('0x1'));var moment=require(_0x943e('0x2'));var BPromise=require(_0x943e('0x3'));var rs=require(_0x943e('0x4'));var fs=require('fs');var Redis=require(_0x943e('0x5'));var db=require(_0x943e('0x6'))['db'];var utils=require(_0x943e('0x7'));var logger=require('../../config/logger')(_0x943e('0x8'));var config=require('../../config/environment');var jayson=require(_0x943e('0x9'));var client=jayson[_0x943e('0xa')][_0x943e('0xb')]({'port':0x232a});config[_0x943e('0xc')]=_[_0x943e('0xd')](config[_0x943e('0xc')],{'host':_0x943e('0xe'),'port':0x18eb});var socket=require(_0x943e('0xf'))(new Redis(config[_0x943e('0xc')]));require(_0x943e('0x10'))[_0x943e('0x11')](socket);function respondWithRpcPromise(_0x2aa16c,_0x1ddb60,_0x34088d){return new BPromise(function(_0x133d0c,_0x1facc4){return client[_0x943e('0x12')](_0x2aa16c,_0x34088d)[_0x943e('0x13')](function(_0x2ca8d1){logger[_0x943e('0x14')](_0x943e('0x15'),_0x1ddb60,_0x943e('0x16'));logger[_0x943e('0x17')](_0x943e('0x18'),_0x1ddb60,_0x943e('0x16'),JSON[_0x943e('0x19')](_0x2ca8d1));if(_0x2ca8d1[_0x943e('0x1a')]){if(_0x2ca8d1[_0x943e('0x1a')]['code']===0x1f4){logger[_0x943e('0x1a')](_0x943e('0x15'),_0x1ddb60,_0x2ca8d1[_0x943e('0x1a')][_0x943e('0x1b')]);return _0x1facc4(_0x2ca8d1[_0x943e('0x1a')][_0x943e('0x1b')]);}logger[_0x943e('0x1a')](_0x943e('0x15'),_0x1ddb60,_0x2ca8d1[_0x943e('0x1a')]['message']);return _0x133d0c(_0x2ca8d1[_0x943e('0x1a')][_0x943e('0x1b')]);}else{logger[_0x943e('0x14')](_0x943e('0x15'),_0x1ddb60,_0x943e('0x16'));_0x133d0c(_0x2ca8d1[_0x943e('0x1c')][_0x943e('0x1b')]);}})['catch'](function(_0x4d9468){logger[_0x943e('0x1a')](_0x943e('0x15'),_0x1ddb60,_0x4d9468);_0x1facc4(_0x4d9468);});});}exports[_0x943e('0x1d')]=function(_0x41cfef){var _0xc8b2af=this;return new Promise(function(_0x58ef97,_0x2653cc){return db[_0x943e('0x1e')]['findAll']({'raw':_0x41cfef[_0x943e('0x1f')]?_0x41cfef[_0x943e('0x1f')][_0x943e('0x20')]===undefined?!![]:![]:!![],'where':_0x41cfef[_0x943e('0x1f')]?_0x41cfef[_0x943e('0x1f')][_0x943e('0x21')]||null:null,'attributes':_0x41cfef[_0x943e('0x1f')]?_0x41cfef[_0x943e('0x1f')][_0x943e('0x22')]||null:null,'limit':_0x41cfef['options']?_0x41cfef[_0x943e('0x1f')][_0x943e('0x23')]||null:null,'include':_0x41cfef['options']?_0x41cfef[_0x943e('0x1f')][_0x943e('0x24')]?_[_0x943e('0x25')](_0x41cfef[_0x943e('0x1f')][_0x943e('0x24')],function(_0x10ded0){return{'model':db[_0x10ded0['model']],'as':_0x10ded0['as'],'attributes':_0x10ded0['attributes'],'include':_0x10ded0['include']?_[_0x943e('0x25')](_0x10ded0[_0x943e('0x24')],function(_0x5f42a9){return{'model':db[_0x5f42a9[_0x943e('0x26')]],'as':_0x5f42a9['as'],'attributes':_0x5f42a9['attributes'],'include':_0x5f42a9[_0x943e('0x24')]?_[_0x943e('0x25')](_0x5f42a9[_0x943e('0x24')],function(_0x582d86){return{'model':db[_0x582d86[_0x943e('0x26')]],'as':_0x582d86['as'],'attributes':_0x582d86[_0x943e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x943e('0x13')](function(_0x37daf0){logger[_0x943e('0x14')](_0x943e('0x1d'),_0x41cfef);logger[_0x943e('0x17')]('GetMailQueue',_0x41cfef,JSON[_0x943e('0x19')](_0x37daf0));_0x58ef97(_0x37daf0);})[_0x943e('0x27')](function(_0x5d794b){logger['error'](_0x943e('0x1d'),_0x5d794b['message'],_0x41cfef);_0x2653cc(_0xc8b2af['error'](0x1f4,_0x5d794b[_0x943e('0x1b')]));});});};exports[_0x943e('0x28')]=function(_0x47d867){var _0x268714=this;return new Promise(function(_0x45c182,_0xdd7ccf){return db['MailQueue'][_0x943e('0x29')]({'raw':_0x47d867[_0x943e('0x1f')]?_0x47d867[_0x943e('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x47d867['options']?_0x47d867['options'][_0x943e('0x21')]||null:null,'attributes':_0x47d867['options']?_0x47d867[_0x943e('0x1f')]['attributes']||null:null,'include':_0x47d867[_0x943e('0x1f')]?_0x47d867[_0x943e('0x1f')][_0x943e('0x24')]?_[_0x943e('0x25')](_0x47d867[_0x943e('0x1f')][_0x943e('0x24')],function(_0x8cfcef){return{'model':db[_0x8cfcef[_0x943e('0x26')]],'as':_0x8cfcef['as'],'attributes':_0x8cfcef[_0x943e('0x22')],'include':_0x8cfcef[_0x943e('0x24')]?_[_0x943e('0x25')](_0x8cfcef[_0x943e('0x24')],function(_0x4a9997){return{'model':db[_0x4a9997['model']],'as':_0x4a9997['as'],'attributes':_0x4a9997[_0x943e('0x22')],'include':_0x4a9997[_0x943e('0x24')]?_[_0x943e('0x25')](_0x4a9997[_0x943e('0x24')],function(_0x120143){return{'model':db[_0x120143[_0x943e('0x26')]],'as':_0x120143['as'],'attributes':_0x120143[_0x943e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x459cc4){logger[_0x943e('0x14')](_0x943e('0x28'),_0x47d867);logger['debug'](_0x943e('0x28'),_0x47d867,JSON[_0x943e('0x19')](_0x459cc4));_0x45c182(_0x459cc4);})[_0x943e('0x27')](function(_0x427b19){logger['error'](_0x943e('0x28'),_0x427b19[_0x943e('0x1b')],_0x47d867);_0xdd7ccf(_0x268714[_0x943e('0x1a')](0x1f4,_0x427b19[_0x943e('0x1b')]));});});}; \ No newline at end of file +var _0xf674=['GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','map','model','then','ShowMailQueue','find','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailQueue.socket','register','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x5e42ef,_0x55a5ff){var _0x2a51c0=function(_0x5b368a){while(--_0x5b368a){_0x5e42ef['push'](_0x5e42ef['shift']());}};_0x2a51c0(++_0x55a5ff);}(_0xf674,0xb2));var _0x4f67=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0xf674[_0x5235dd];return _0x13059d;};'use strict';var _=require(_0x4f67('0x0'));var util=require('util');var moment=require(_0x4f67('0x1'));var BPromise=require(_0x4f67('0x2'));var rs=require(_0x4f67('0x3'));var fs=require('fs');var Redis=require(_0x4f67('0x4'));var db=require(_0x4f67('0x5'))['db'];var utils=require(_0x4f67('0x6'));var logger=require('../../config/logger')(_0x4f67('0x7'));var config=require(_0x4f67('0x8'));var jayson=require(_0x4f67('0x9'));var client=jayson['client'][_0x4f67('0xa')]({'port':0x232a});config['redis']=_[_0x4f67('0xb')](config[_0x4f67('0xc')],{'host':_0x4f67('0xd'),'port':0x18eb});var socket=require(_0x4f67('0xe'))(new Redis(config[_0x4f67('0xc')]));require(_0x4f67('0xf'))[_0x4f67('0x10')](socket);function respondWithRpcPromise(_0x1f1dc3,_0x3b5fc4,_0x251543){return new BPromise(function(_0x18ea37,_0x53a8df){return client['request'](_0x1f1dc3,_0x251543)['then'](function(_0x5157ae){logger['info'](_0x4f67('0x11'),_0x3b5fc4,'request\x20sent');logger[_0x4f67('0x12')](_0x4f67('0x13'),_0x3b5fc4,_0x4f67('0x14'),JSON[_0x4f67('0x15')](_0x5157ae));if(_0x5157ae[_0x4f67('0x16')]){if(_0x5157ae[_0x4f67('0x16')][_0x4f67('0x17')]===0x1f4){logger[_0x4f67('0x16')](_0x4f67('0x11'),_0x3b5fc4,_0x5157ae[_0x4f67('0x16')]['message']);return _0x53a8df(_0x5157ae[_0x4f67('0x16')][_0x4f67('0x18')]);}logger[_0x4f67('0x16')](_0x4f67('0x11'),_0x3b5fc4,_0x5157ae['error'][_0x4f67('0x18')]);return _0x18ea37(_0x5157ae[_0x4f67('0x16')]['message']);}else{logger[_0x4f67('0x19')](_0x4f67('0x11'),_0x3b5fc4,_0x4f67('0x14'));_0x18ea37(_0x5157ae[_0x4f67('0x1a')]['message']);}})['catch'](function(_0xdfbf53){logger[_0x4f67('0x16')](_0x4f67('0x11'),_0x3b5fc4,_0xdfbf53);_0x53a8df(_0xdfbf53);});});}exports[_0x4f67('0x1b')]=function(_0x22847c){var _0xf0814f=this;return new Promise(function(_0x41cace,_0xb0a11b){return db[_0x4f67('0x1c')]['findAll']({'raw':_0x22847c['options']?_0x22847c[_0x4f67('0x1d')][_0x4f67('0x1e')]===undefined?!![]:![]:!![],'where':_0x22847c[_0x4f67('0x1d')]?_0x22847c[_0x4f67('0x1d')][_0x4f67('0x1f')]||null:null,'attributes':_0x22847c[_0x4f67('0x1d')]?_0x22847c['options'][_0x4f67('0x20')]||null:null,'limit':_0x22847c[_0x4f67('0x1d')]?_0x22847c['options'][_0x4f67('0x21')]||null:null,'include':_0x22847c['options']?_0x22847c[_0x4f67('0x1d')][_0x4f67('0x22')]?_[_0x4f67('0x23')](_0x22847c[_0x4f67('0x1d')][_0x4f67('0x22')],function(_0x29ac97){return{'model':db[_0x29ac97['model']],'as':_0x29ac97['as'],'attributes':_0x29ac97[_0x4f67('0x20')],'include':_0x29ac97[_0x4f67('0x22')]?_[_0x4f67('0x23')](_0x29ac97[_0x4f67('0x22')],function(_0x4f0e9f){return{'model':db[_0x4f0e9f[_0x4f67('0x24')]],'as':_0x4f0e9f['as'],'attributes':_0x4f0e9f[_0x4f67('0x20')],'include':_0x4f0e9f['include']?_['map'](_0x4f0e9f[_0x4f67('0x22')],function(_0x1796dd){return{'model':db[_0x1796dd[_0x4f67('0x24')]],'as':_0x1796dd['as'],'attributes':_0x1796dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f67('0x25')](function(_0x5c5b22){logger[_0x4f67('0x19')]('GetMailQueue',_0x22847c);logger[_0x4f67('0x12')](_0x4f67('0x1b'),_0x22847c,JSON[_0x4f67('0x15')](_0x5c5b22));_0x41cace(_0x5c5b22);})['catch'](function(_0x1d40a6){logger[_0x4f67('0x16')]('GetMailQueue',_0x1d40a6[_0x4f67('0x18')],_0x22847c);_0xb0a11b(_0xf0814f[_0x4f67('0x16')](0x1f4,_0x1d40a6[_0x4f67('0x18')]));});});};exports[_0x4f67('0x26')]=function(_0xd4258f){var _0xd271e=this;return new Promise(function(_0x317c9c,_0x5c1cfc){return db[_0x4f67('0x1c')][_0x4f67('0x27')]({'raw':_0xd4258f[_0x4f67('0x1d')]?_0xd4258f[_0x4f67('0x1d')][_0x4f67('0x1e')]===undefined?!![]:![]:!![],'where':_0xd4258f[_0x4f67('0x1d')]?_0xd4258f['options'][_0x4f67('0x1f')]||null:null,'attributes':_0xd4258f['options']?_0xd4258f[_0x4f67('0x1d')][_0x4f67('0x20')]||null:null,'include':_0xd4258f[_0x4f67('0x1d')]?_0xd4258f[_0x4f67('0x1d')][_0x4f67('0x22')]?_[_0x4f67('0x23')](_0xd4258f['options'][_0x4f67('0x22')],function(_0x4a1652){return{'model':db[_0x4a1652[_0x4f67('0x24')]],'as':_0x4a1652['as'],'attributes':_0x4a1652[_0x4f67('0x20')],'include':_0x4a1652[_0x4f67('0x22')]?_[_0x4f67('0x23')](_0x4a1652[_0x4f67('0x22')],function(_0x3eb6fa){return{'model':db[_0x3eb6fa['model']],'as':_0x3eb6fa['as'],'attributes':_0x3eb6fa[_0x4f67('0x20')],'include':_0x3eb6fa[_0x4f67('0x22')]?_['map'](_0x3eb6fa['include'],function(_0x53a2a7){return{'model':db[_0x53a2a7[_0x4f67('0x24')]],'as':_0x53a2a7['as'],'attributes':_0x53a2a7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x310011){logger[_0x4f67('0x19')](_0x4f67('0x26'),_0xd4258f);logger['debug'](_0x4f67('0x26'),_0xd4258f,JSON['stringify'](_0x310011));_0x317c9c(_0x310011);})[_0x4f67('0x28')](function(_0x405916){logger[_0x4f67('0x16')](_0x4f67('0x26'),_0x405916[_0x4f67('0x18')],_0xd4258f);_0x5c1cfc(_0xd271e[_0x4f67('0x16')](0x1f4,_0x405916[_0x4f67('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 535092a..dd7d3be 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 _0x4603=['save','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x391ea9,_0x143522){var _0x24c791=function(_0xbfc708){while(--_0xbfc708){_0x391ea9['push'](_0x391ea9['shift']());}};_0x24c791(++_0x143522);}(_0x4603,0x156));var _0x3460=function(_0x137909,_0x37ce59){_0x137909=_0x137909-0x0;var _0x596106=_0x4603[_0x137909];return _0x596106;};'use strict';var MailQueueEvents=require(_0x3460('0x0'));var events=[_0x3460('0x1'),'remove','update'];function createListener(_0x53e8b5,_0xda5251){return function(_0x368ed0){_0xda5251[_0x3460('0x2')](_0x53e8b5,_0x368ed0);};}function removeListener(_0x29fc07,_0x237352){return function(){MailQueueEvents[_0x3460('0x3')](_0x29fc07,_0x237352);};}exports[_0x3460('0x4')]=function(_0x2f7b87){for(var _0x2fb502=0x0,_0xd20bab=events[_0x3460('0x5')];_0x2fb502<_0xd20bab;_0x2fb502++){var _0x5e2eae=events[_0x2fb502];var _0x5944e3=createListener(_0x3460('0x6')+_0x5e2eae,_0x2f7b87);MailQueueEvents['on'](_0x5e2eae,_0x5944e3);}}; \ No newline at end of file +var _0x4ff6=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','remove'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4ff6,0x86));var _0x64ff=function(_0xdad9d9,_0x75e191){_0xdad9d9=_0xdad9d9-0x0;var _0x1d3082=_0x4ff6[_0xdad9d9];return _0x1d3082;};'use strict';var MailQueueEvents=require(_0x64ff('0x0'));var events=['save',_0x64ff('0x1'),_0x64ff('0x2')];function createListener(_0x338aca,_0x2d2b41){return function(_0x552b50){_0x2d2b41[_0x64ff('0x3')](_0x338aca,_0x552b50);};}function removeListener(_0x34f80e,_0x53bf29){return function(){MailQueueEvents[_0x64ff('0x4')](_0x34f80e,_0x53bf29);};}exports[_0x64ff('0x5')]=function(_0x35ce9c){for(var _0x5ea165=0x0,_0x30a912=events[_0x64ff('0x6')];_0x5ea165<_0x30a912;_0x5ea165++){var _0x58447c=events[_0x5ea165];var _0x554685=createListener(_0x64ff('0x7')+_0x58447c,_0x35ce9c);MailQueueEvents['on'](_0x58447c,_0x554685);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 28cf5b7..5a2b3c1 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 _0x8278=['post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x407659,_0x49dddf){var _0x9f23eb=function(_0x465c56){while(--_0x465c56){_0x407659['push'](_0x407659['shift']());}};_0x9f23eb(++_0x49dddf);}(_0x8278,0x1a9));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8827('0x0'));var util=require(_0x8827('0x1'));var path=require(_0x8827('0x2'));var timeout=require(_0x8827('0x3'));var express=require(_0x8827('0x4'));var router=express['Router']();var auth=require(_0x8827('0x5'));var interaction=require(_0x8827('0x6'));var config=require(_0x8827('0x7'));var controller=require('./mailQueueReport.controller');router[_0x8827('0x8')]('/',auth[_0x8827('0x9')](),controller[_0x8827('0xa')]);router[_0x8827('0x8')](_0x8827('0xb'),auth[_0x8827('0x9')](),controller[_0x8827('0xc')]);router['get'](_0x8827('0xd'),auth['isAuthenticated'](),controller[_0x8827('0xe')]);router[_0x8827('0xf')]('/',auth[_0x8827('0x9')](),controller[_0x8827('0x10')]);router['put'](_0x8827('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x8827('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x8827('0x12')]);module[_0x8827('0x13')]=router; \ No newline at end of file +var _0x0bfc=['../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports','multer','path','express','Router'];(function(_0x454ce7,_0x37129d){var _0x36d959=function(_0x1cced1){while(--_0x1cced1){_0x454ce7['push'](_0x454ce7['shift']());}};_0x36d959(++_0x37129d);}(_0x0bfc,0xb7));var _0xc0bf=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x0bfc[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0xc0bf('0x0'));var util=require('util');var path=require(_0xc0bf('0x1'));var timeout=require('connect-timeout');var express=require(_0xc0bf('0x2'));var router=express[_0xc0bf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc0bf('0x4'));var config=require('../../config/environment');var controller=require(_0xc0bf('0x5'));router[_0xc0bf('0x6')]('/',auth[_0xc0bf('0x7')](),controller[_0xc0bf('0x8')]);router['get'](_0xc0bf('0x9'),auth[_0xc0bf('0x7')](),controller[_0xc0bf('0xa')]);router[_0xc0bf('0x6')](_0xc0bf('0xb'),auth['isAuthenticated'](),controller[_0xc0bf('0xc')]);router['post']('/',auth[_0xc0bf('0x7')](),controller[_0xc0bf('0xd')]);router[_0xc0bf('0xe')](_0xc0bf('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc0bf('0xb'),auth['isAuthenticated'](),controller[_0xc0bf('0xf')]);module[_0xc0bf('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 8dd8af6..86f6c3e 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 _0x5ff8=['DATE','moment','sequelize','STRING'];(function(_0x2fd214,_0x23f771){var _0xd2c36a=function(_0x217e93){while(--_0x217e93){_0x2fd214['push'](_0x2fd214['shift']());}};_0xd2c36a(++_0x23f771);}(_0x5ff8,0xfd));var _0x85ff=function(_0x363dfb,_0x3b63fc){_0x363dfb=_0x363dfb-0x0;var _0x5b4e79=_0x5ff8[_0x363dfb];return _0x5b4e79;};'use strict';var moment=require(_0x85ff('0x0'));var Sequelize=require(_0x85ff('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x85ff('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x85ff('0x2')]},'joinAt':{'type':Sequelize[_0x85ff('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x85ff('0x3')]},'reason':{'type':Sequelize[_0x85ff('0x2')]}}; \ No newline at end of file +var _0xd07e=['sequelize','exports','STRING','DATE'];(function(_0x12ee9f,_0x2292ab){var _0x5df1fd=function(_0x38656f){while(--_0x38656f){_0x12ee9f['push'](_0x12ee9f['shift']());}};_0x5df1fd(++_0x2292ab);}(_0xd07e,0xe8));var _0xed07=function(_0x4cf779,_0x407469){_0x4cf779=_0x4cf779-0x0;var _0x3388b0=_0xd07e[_0x4cf779];return _0x3388b0;};'use strict';var moment=require('moment');var Sequelize=require(_0xed07('0x0'));module[_0xed07('0x1')]={'uniqueid':{'type':Sequelize[_0xed07('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xed07('0x2')]},'joinAt':{'type':Sequelize[_0xed07('0x3')]},'leaveAt':{'type':Sequelize[_0xed07('0x3')]},'acceptAt':{'type':Sequelize[_0xed07('0x3')]},'exitAt':{'type':Sequelize[_0xed07('0x3')]},'reason':{'type':Sequelize[_0xed07('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5c4226f..643921b 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 _0x26a0=['rows','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','limit','set','save','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x106798,_0x5038ba){var _0x2d9ecb=function(_0x4ff6de){while(--_0x4ff6de){_0x106798['push'](_0x106798['shift']());}};_0x2d9ecb(++_0x5038ba);}(_0x26a0,0x9d));var _0x026a=function(_0x482490,_0x1783f1){_0x482490=_0x482490-0x0;var _0xe33c42=_0x26a0[_0x482490];return _0xe33c42;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x026a('0x0'));var rimraf=require(_0x026a('0x1'));var zipdir=require(_0x026a('0x2'));var jsonpatch=require(_0x026a('0x3'));var rp=require(_0x026a('0x4'));var moment=require('moment');var BPromise=require(_0x026a('0x5'));var Mustache=require(_0x026a('0x6'));var util=require(_0x026a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x026a('0x8'));var ejs=require(_0x026a('0x9'));var fs=require('fs');var _=require(_0x026a('0xa'));var squel=require(_0x026a('0xb'));var crypto=require(_0x026a('0xc'));var jsforce=require(_0x026a('0xd'));var deskjs=require(_0x026a('0xe'));var toCsv=require(_0x026a('0x8'));var querystring=require(_0x026a('0xf'));var Papa=require(_0x026a('0x10'));var Redis=require(_0x026a('0x11'));var authService=require(_0x026a('0x12'));var qs=require(_0x026a('0x13'));var as=require(_0x026a('0x14'));var hardwareService=require(_0x026a('0x15'));var logger=require(_0x026a('0x16'))(_0x026a('0x17'));var utils=require(_0x026a('0x18'));var config=require(_0x026a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19b424,_0x507800){_0x507800=_0x507800||0xcc;return function(_0x2f5ac6){if(_0x2f5ac6){return _0x19b424[_0x026a('0x1a')](_0x507800);}return _0x19b424['status'](_0x507800)[_0x026a('0x1b')]();};}function respondWithResult(_0xc701b4,_0x2e150c){_0x2e150c=_0x2e150c||0xc8;return function(_0xa5c084){if(_0xa5c084){return _0xc701b4[_0x026a('0x1c')](_0x2e150c)['json'](_0xa5c084);}};}function respondWithFilteredResult(_0x3014c9,_0x32c71a){return function(_0x1992d0){if(_0x1992d0){var _0x37bba9=_0x1992d0[_0x026a('0x1d')],_0x2325d1=_0x32c71a['offset'],_0x19fe7a=_0x32c71a['offset']+_0x32c71a[_0x026a('0x1e')],_0x432f7b;if(_0x19fe7a>=_0x37bba9){_0x19fe7a=_0x37bba9;_0x432f7b=0xc8;}else{_0x432f7b=0xce;}_0x3014c9['status'](_0x432f7b);return _0x3014c9[_0x026a('0x1f')]('Content-Range',_0x2325d1+'-'+_0x19fe7a+'/'+_0x37bba9)['json'](_0x1992d0);}return null;};}function patchUpdates(_0x1d4f27){return function(_0x30c176){try{jsonpatch['apply'](_0x30c176,_0x1d4f27,!![]);}catch(_0x327a5b){return BPromise['reject'](_0x327a5b);}return _0x30c176[_0x026a('0x20')]();};}function saveUpdates(_0x7b2ffe,_0x44d2d6){return function(_0xc41182){if(_0xc41182){return _0xc41182['update'](_0x7b2ffe)[_0x026a('0x21')](function(_0x112ad1){return _0x112ad1;});}return null;};}function removeEntity(_0x3fd08c,_0x28af19){return function(_0x3bb921){if(_0x3bb921){return _0x3bb921[_0x026a('0x22')]()[_0x026a('0x21')](function(){_0x3fd08c[_0x026a('0x1c')](0xcc)[_0x026a('0x1b')]();});}};}function handleEntityNotFound(_0x275591,_0x4623b8){return function(_0x220fcd){if(!_0x220fcd){_0x275591[_0x026a('0x1a')](0x194);}return _0x220fcd;};}function handleError(_0x37b43b,_0x448f0b){_0x448f0b=_0x448f0b||0x1f4;return function(_0x2aced5){logger[_0x026a('0x23')](_0x2aced5[_0x026a('0x24')]);if(_0x2aced5[_0x026a('0x25')]){delete _0x2aced5[_0x026a('0x25')];}_0x37b43b['status'](_0x448f0b)[_0x026a('0x26')](_0x2aced5);};}exports[_0x026a('0x27')]=function(_0x23e65b,_0x428e4a){var _0x462787={},_0xce11be={},_0x582d54={'count':0x0,'rows':[]};var _0x1f9183=_[_0x026a('0x28')](db[_0x026a('0x29')][_0x026a('0x2a')],function(_0x271fda){return{'name':_0x271fda[_0x026a('0x2b')],'type':_0x271fda[_0x026a('0x2c')]['key']};});_0xce11be['model']=_[_0x026a('0x28')](_0x1f9183,_0x026a('0x25'));_0xce11be['query']=_[_0x026a('0x2d')](_0x23e65b[_0x026a('0x2e')]);_0xce11be[_0x026a('0x2f')]=_[_0x026a('0x30')](_0xce11be[_0x026a('0x31')],_0xce11be['query']);_0x462787['attributes']=_[_0x026a('0x30')](_0xce11be[_0x026a('0x31')],qs[_0x026a('0x32')](_0x23e65b['query']['fields']));_0x462787[_0x026a('0x33')]=_0x462787[_0x026a('0x33')]['length']?_0x462787['attributes']:_0xce11be['model'];if(!_0x23e65b[_0x026a('0x2e')][_0x026a('0x34')](_0x026a('0x35'))){_0x462787[_0x026a('0x1e')]=qs[_0x026a('0x1e')](_0x23e65b[_0x026a('0x2e')][_0x026a('0x1e')]);_0x462787[_0x026a('0x36')]=qs[_0x026a('0x36')](_0x23e65b[_0x026a('0x2e')]['offset']);}_0x462787['order']=qs[_0x026a('0x37')](_0x23e65b[_0x026a('0x2e')][_0x026a('0x37')]);_0x462787[_0x026a('0x38')]=qs[_0x026a('0x2f')](_[_0x026a('0x39')](_0x23e65b[_0x026a('0x2e')],_0xce11be['filters']),_0x1f9183);if(_0x23e65b[_0x026a('0x2e')][_0x026a('0x3a')]){_0x462787[_0x026a('0x38')]=_[_0x026a('0x3b')](_0x462787[_0x026a('0x38')],{'$or':_['map'](_0x1f9183,function(_0x45597d){if(_0x45597d['type']!==_0x026a('0x3c')){var _0x1b0edb={};_0x1b0edb[_0x45597d[_0x026a('0x25')]]={'$like':'%'+_0x23e65b['query']['filter']+'%'};return _0x1b0edb;}})});}_0x462787=_[_0x026a('0x3b')]({},_0x462787,_0x23e65b[_0x026a('0x3d')]);var _0x2d5db0={'where':_0x462787[_0x026a('0x38')]};return db[_0x026a('0x29')][_0x026a('0x1d')](_0x2d5db0)['then'](function(_0x19f3a8){_0x582d54[_0x026a('0x1d')]=_0x19f3a8;if(_0x23e65b['query'][_0x026a('0x3e')]){_0x462787[_0x026a('0x3f')]=[{'all':!![]}];}return db[_0x026a('0x29')][_0x026a('0x40')](_0x462787);})[_0x026a('0x21')](function(_0x245891){_0x582d54[_0x026a('0x41')]=_0x245891;return _0x582d54;})[_0x026a('0x21')](respondWithFilteredResult(_0x428e4a,_0x462787))[_0x026a('0x42')](handleError(_0x428e4a,null));};exports[_0x026a('0x43')]=function(_0x3b9b55,_0x253271){var _0xa59677={'raw':!![],'where':{'id':_0x3b9b55[_0x026a('0x44')]['id']}},_0xbf2b20={};_0xbf2b20[_0x026a('0x31')]=_[_0x026a('0x2d')](db[_0x026a('0x29')][_0x026a('0x2a')]);_0xbf2b20[_0x026a('0x2e')]=_[_0x026a('0x2d')](_0x3b9b55[_0x026a('0x2e')]);_0xbf2b20['filters']=_[_0x026a('0x30')](_0xbf2b20['model'],_0xbf2b20[_0x026a('0x2e')]);_0xa59677['attributes']=_[_0x026a('0x30')](_0xbf2b20[_0x026a('0x31')],qs[_0x026a('0x32')](_0x3b9b55[_0x026a('0x2e')]['fields']));_0xa59677[_0x026a('0x33')]=_0xa59677[_0x026a('0x33')][_0x026a('0x45')]?_0xa59677[_0x026a('0x33')]:_0xbf2b20[_0x026a('0x31')];if(_0x3b9b55[_0x026a('0x2e')]['includeAll']){_0xa59677[_0x026a('0x3f')]=[{'all':!![]}];}_0xa59677=_[_0x026a('0x3b')]({},_0xa59677,_0x3b9b55[_0x026a('0x3d')]);return db[_0x026a('0x29')][_0x026a('0x46')](_0xa59677)['then'](handleEntityNotFound(_0x253271,null))[_0x026a('0x21')](respondWithResult(_0x253271,null))[_0x026a('0x42')](handleError(_0x253271,null));};exports[_0x026a('0x47')]=function(_0x2d373d,_0x16f623){return db[_0x026a('0x29')]['create'](_0x2d373d[_0x026a('0x48')],{})['then'](respondWithResult(_0x16f623,0xc9))['catch'](handleError(_0x16f623,null));};exports['update']=function(_0x5506bd,_0x3232d0){if(_0x5506bd[_0x026a('0x48')]['id']){delete _0x5506bd[_0x026a('0x48')]['id'];}return db[_0x026a('0x29')][_0x026a('0x46')]({'where':{'id':_0x5506bd[_0x026a('0x44')]['id']}})[_0x026a('0x21')](handleEntityNotFound(_0x3232d0,null))[_0x026a('0x21')](saveUpdates(_0x5506bd[_0x026a('0x48')],null))[_0x026a('0x21')](respondWithResult(_0x3232d0,null))[_0x026a('0x42')](handleError(_0x3232d0,null));};exports['destroy']=function(_0x10d476,_0x328d56){return db[_0x026a('0x29')][_0x026a('0x46')]({'where':{'id':_0x10d476[_0x026a('0x44')]['id']}})['then'](handleEntityNotFound(_0x328d56,null))[_0x026a('0x21')](removeEntity(_0x328d56,null))[_0x026a('0x42')](handleError(_0x328d56,null));};exports[_0x026a('0x49')]=function(_0xbddf60,_0xd6e3b7){return db[_0x026a('0x29')]['describe']()['then'](respondWithResult(_0xd6e3b7,null))['catch'](handleError(_0xd6e3b7,null));}; \ No newline at end of file +var _0xf39d=['destroy','then','sendStatus','error','name','status','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','create','body','update','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','json','count','limit','set','Content-Range','apply','reject','save'];(function(_0x442520,_0x47cdeb){var _0x4b57b6=function(_0x1cd284){while(--_0x1cd284){_0x442520['push'](_0x442520['shift']());}};_0x4b57b6(++_0x47cdeb);}(_0xf39d,0x164));var _0xdf39=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0xf39d[_0x5c4f6b];return _0x104c4e;};'use strict';var pdf=require(_0xdf39('0x0'));var emlformat=require(_0xdf39('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdf39('0x2'));var jsonpatch=require(_0xdf39('0x3'));var rp=require(_0xdf39('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdf39('0x5'));var util=require(_0xdf39('0x6'));var path=require(_0xdf39('0x7'));var sox=require(_0xdf39('0x8'));var csv=require(_0xdf39('0x9'));var ejs=require(_0xdf39('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf39('0xb'));var crypto=require(_0xdf39('0xc'));var jsforce=require(_0xdf39('0xd'));var deskjs=require(_0xdf39('0xe'));var toCsv=require(_0xdf39('0x9'));var querystring=require(_0xdf39('0xf'));var Papa=require(_0xdf39('0x10'));var Redis=require('ioredis');var authService=require(_0xdf39('0x11'));var qs=require(_0xdf39('0x12'));var as=require(_0xdf39('0x13'));var hardwareService=require(_0xdf39('0x14'));var logger=require(_0xdf39('0x15'))(_0xdf39('0x16'));var utils=require('../../config/utils');var config=require(_0xdf39('0x17'));var licenseUtil=require(_0xdf39('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7fcddd,_0x243cb0){_0x243cb0=_0x243cb0||0xcc;return function(_0x29ed62){if(_0x29ed62){return _0x7fcddd['sendStatus'](_0x243cb0);}return _0x7fcddd['status'](_0x243cb0)[_0xdf39('0x19')]();};}function respondWithResult(_0x4c200e,_0x462712){_0x462712=_0x462712||0xc8;return function(_0x2386e0){if(_0x2386e0){return _0x4c200e['status'](_0x462712)[_0xdf39('0x1a')](_0x2386e0);}};}function respondWithFilteredResult(_0x89cf4,_0x1d19f7){return function(_0x40359c){if(_0x40359c){var _0x54a5e3=_0x40359c[_0xdf39('0x1b')],_0x1744fe=_0x1d19f7['offset'],_0x4a5225=_0x1d19f7['offset']+_0x1d19f7[_0xdf39('0x1c')],_0x40ed58;if(_0x4a5225>=_0x54a5e3){_0x4a5225=_0x54a5e3;_0x40ed58=0xc8;}else{_0x40ed58=0xce;}_0x89cf4['status'](_0x40ed58);return _0x89cf4[_0xdf39('0x1d')](_0xdf39('0x1e'),_0x1744fe+'-'+_0x4a5225+'/'+_0x54a5e3)[_0xdf39('0x1a')](_0x40359c);}return null;};}function patchUpdates(_0x16cbd0){return function(_0xb4519f){try{jsonpatch[_0xdf39('0x1f')](_0xb4519f,_0x16cbd0,!![]);}catch(_0x406b69){return BPromise[_0xdf39('0x20')](_0x406b69);}return _0xb4519f[_0xdf39('0x21')]();};}function saveUpdates(_0x40f535,_0x4023e4){return function(_0x59dd0d){if(_0x59dd0d){return _0x59dd0d['update'](_0x40f535)['then'](function(_0x397857){return _0x397857;});}return null;};}function removeEntity(_0x1e4293,_0x510bc0){return function(_0xa82764){if(_0xa82764){return _0xa82764[_0xdf39('0x22')]()[_0xdf39('0x23')](function(){_0x1e4293['status'](0xcc)[_0xdf39('0x19')]();});}};}function handleEntityNotFound(_0x52b8f2,_0x4d54af){return function(_0x37dc1c){if(!_0x37dc1c){_0x52b8f2[_0xdf39('0x24')](0x194);}return _0x37dc1c;};}function handleError(_0xc24e6e,_0x33eded){_0x33eded=_0x33eded||0x1f4;return function(_0x2fb3a5){logger[_0xdf39('0x25')](_0x2fb3a5['stack']);if(_0x2fb3a5[_0xdf39('0x26')]){delete _0x2fb3a5[_0xdf39('0x26')];}_0xc24e6e[_0xdf39('0x27')](_0x33eded)[_0xdf39('0x28')](_0x2fb3a5);};}exports[_0xdf39('0x29')]=function(_0x1290db,_0x13b0d7){var _0x4c8361={},_0x3a7559={},_0x4a3e71={'count':0x0,'rows':[]};var _0x77e2d7=_[_0xdf39('0x2a')](db[_0xdf39('0x2b')][_0xdf39('0x2c')],function(_0x59e33c){return{'name':_0x59e33c[_0xdf39('0x2d')],'type':_0x59e33c[_0xdf39('0x2e')][_0xdf39('0x2f')]};});_0x3a7559[_0xdf39('0x30')]=_[_0xdf39('0x2a')](_0x77e2d7,_0xdf39('0x26'));_0x3a7559[_0xdf39('0x31')]=_[_0xdf39('0x32')](_0x1290db[_0xdf39('0x31')]);_0x3a7559[_0xdf39('0x33')]=_[_0xdf39('0x34')](_0x3a7559[_0xdf39('0x30')],_0x3a7559[_0xdf39('0x31')]);_0x4c8361[_0xdf39('0x35')]=_['intersection'](_0x3a7559[_0xdf39('0x30')],qs[_0xdf39('0x36')](_0x1290db['query']['fields']));_0x4c8361[_0xdf39('0x35')]=_0x4c8361['attributes'][_0xdf39('0x37')]?_0x4c8361['attributes']:_0x3a7559[_0xdf39('0x30')];if(!_0x1290db['query'][_0xdf39('0x38')](_0xdf39('0x39'))){_0x4c8361['limit']=qs[_0xdf39('0x1c')](_0x1290db[_0xdf39('0x31')][_0xdf39('0x1c')]);_0x4c8361[_0xdf39('0x3a')]=qs[_0xdf39('0x3a')](_0x1290db[_0xdf39('0x31')][_0xdf39('0x3a')]);}_0x4c8361[_0xdf39('0x3b')]=qs[_0xdf39('0x3c')](_0x1290db['query']['sort']);_0x4c8361[_0xdf39('0x3d')]=qs[_0xdf39('0x33')](_[_0xdf39('0x3e')](_0x1290db[_0xdf39('0x31')],_0x3a7559[_0xdf39('0x33')]),_0x77e2d7);if(_0x1290db[_0xdf39('0x31')][_0xdf39('0x3f')]){_0x4c8361[_0xdf39('0x3d')]=_[_0xdf39('0x40')](_0x4c8361[_0xdf39('0x3d')],{'$or':_[_0xdf39('0x2a')](_0x77e2d7,function(_0x157c60){if(_0x157c60[_0xdf39('0x2e')]!==_0xdf39('0x41')){var _0x39d482={};_0x39d482[_0x157c60[_0xdf39('0x26')]]={'$like':'%'+_0x1290db[_0xdf39('0x31')][_0xdf39('0x3f')]+'%'};return _0x39d482;}})});}_0x4c8361=_['merge']({},_0x4c8361,_0x1290db[_0xdf39('0x42')]);var _0x1a1d88={'where':_0x4c8361[_0xdf39('0x3d')]};return db[_0xdf39('0x2b')][_0xdf39('0x1b')](_0x1a1d88)['then'](function(_0x44e509){_0x4a3e71[_0xdf39('0x1b')]=_0x44e509;if(_0x1290db[_0xdf39('0x31')]['includeAll']){_0x4c8361[_0xdf39('0x43')]=[{'all':!![]}];}return db[_0xdf39('0x2b')]['findAll'](_0x4c8361);})[_0xdf39('0x23')](function(_0x38797d){_0x4a3e71[_0xdf39('0x44')]=_0x38797d;return _0x4a3e71;})[_0xdf39('0x23')](respondWithFilteredResult(_0x13b0d7,_0x4c8361))[_0xdf39('0x45')](handleError(_0x13b0d7,null));};exports[_0xdf39('0x46')]=function(_0x48b544,_0x16ae66){var _0x54187d={'raw':!![],'where':{'id':_0x48b544[_0xdf39('0x47')]['id']}},_0x4e673f={};_0x4e673f[_0xdf39('0x30')]=_[_0xdf39('0x32')](db['MailQueueReport'][_0xdf39('0x2c')]);_0x4e673f[_0xdf39('0x31')]=_[_0xdf39('0x32')](_0x48b544[_0xdf39('0x31')]);_0x4e673f['filters']=_['intersection'](_0x4e673f[_0xdf39('0x30')],_0x4e673f[_0xdf39('0x31')]);_0x54187d[_0xdf39('0x35')]=_[_0xdf39('0x34')](_0x4e673f[_0xdf39('0x30')],qs[_0xdf39('0x36')](_0x48b544[_0xdf39('0x31')][_0xdf39('0x36')]));_0x54187d['attributes']=_0x54187d['attributes'][_0xdf39('0x37')]?_0x54187d['attributes']:_0x4e673f['model'];if(_0x48b544['query'][_0xdf39('0x48')]){_0x54187d[_0xdf39('0x43')]=[{'all':!![]}];}_0x54187d=_['merge']({},_0x54187d,_0x48b544[_0xdf39('0x42')]);return db['MailQueueReport']['find'](_0x54187d)[_0xdf39('0x23')](handleEntityNotFound(_0x16ae66,null))[_0xdf39('0x23')](respondWithResult(_0x16ae66,null))[_0xdf39('0x45')](handleError(_0x16ae66,null));};exports['create']=function(_0x4e906a,_0x2a1532){return db[_0xdf39('0x2b')][_0xdf39('0x49')](_0x4e906a[_0xdf39('0x4a')],{})[_0xdf39('0x23')](respondWithResult(_0x2a1532,0xc9))[_0xdf39('0x45')](handleError(_0x2a1532,null));};exports[_0xdf39('0x4b')]=function(_0x4a1dbe,_0x147c74){if(_0x4a1dbe[_0xdf39('0x4a')]['id']){delete _0x4a1dbe[_0xdf39('0x4a')]['id'];}return db[_0xdf39('0x2b')][_0xdf39('0x4c')]({'where':{'id':_0x4a1dbe[_0xdf39('0x47')]['id']}})[_0xdf39('0x23')](handleEntityNotFound(_0x147c74,null))[_0xdf39('0x23')](saveUpdates(_0x4a1dbe[_0xdf39('0x4a')],null))[_0xdf39('0x23')](respondWithResult(_0x147c74,null))[_0xdf39('0x45')](handleError(_0x147c74,null));};exports['destroy']=function(_0x3a4883,_0x106fc1){return db[_0xdf39('0x2b')][_0xdf39('0x4c')]({'where':{'id':_0x3a4883[_0xdf39('0x47')]['id']}})[_0xdf39('0x23')](handleEntityNotFound(_0x106fc1,null))[_0xdf39('0x23')](removeEntity(_0x106fc1,null))[_0xdf39('0x45')](handleError(_0x106fc1,null));};exports[_0xdf39('0x4d')]=function(_0x3f36ac,_0x5fba2c){return db[_0xdf39('0x2b')]['describe']()[_0xdf39('0x23')](respondWithResult(_0x5fba2c,null))['catch'](handleError(_0x5fba2c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ec96544..99a4461 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 _0xc343=['bluebird','path','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','util','../../config/logger','api','moment'];(function(_0xed5729,_0x4979b1){var _0x4607e4=function(_0x2d77e2){while(--_0x2d77e2){_0xed5729['push'](_0xed5729['shift']());}};_0x4607e4(++_0x4979b1);}(_0xc343,0x1bf));var _0x3c34=function(_0x2382e6,_0x213904){_0x2382e6=_0x2382e6-0x0;var _0x2c33ab=_0xc343[_0x2382e6];return _0x2c33ab;};'use strict';var _=require('lodash');var util=require(_0x3c34('0x0'));var logger=require(_0x3c34('0x1'))(_0x3c34('0x2'));var moment=require(_0x3c34('0x3'));var BPromise=require(_0x3c34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c34('0x5'));var rimraf=require('rimraf');var config=require(_0x3c34('0x6'));var attributes=require(_0x3c34('0x7'));module[_0x3c34('0x8')]=function(_0x207bfd,_0x41db89){return _0x207bfd[_0x3c34('0x9')]('MailQueueReport',attributes,{'tableName':_0x3c34('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2691=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5da8b4,_0x4c9c7f){var _0xce3409=function(_0x569d73){while(--_0x569d73){_0x5da8b4['push'](_0x5da8b4['shift']());}};_0xce3409(++_0x4c9c7f);}(_0x2691,0x132));var _0x1269=function(_0x3dfc54,_0x2effee){_0x3dfc54=_0x3dfc54-0x0;var _0x2cbfe2=_0x2691[_0x3dfc54];return _0x2cbfe2;};'use strict';var _=require(_0x1269('0x0'));var util=require(_0x1269('0x1'));var logger=require(_0x1269('0x2'))(_0x1269('0x3'));var moment=require(_0x1269('0x4'));var BPromise=require(_0x1269('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1269('0x6'));var rimraf=require(_0x1269('0x7'));var config=require(_0x1269('0x8'));var attributes=require(_0x1269('0x9'));module[_0x1269('0xa')]=function(_0x28edc5,_0x21f45d){return _0x28edc5['define']('MailQueueReport',attributes,{'tableName':_0x1269('0xb'),'paranoid':![],'indexes':[{'name':_0x1269('0xc'),'fields':[_0x1269('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 09b736c..013310c 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 _0xaf07=['MailQueueReport,\x20%s,\x20%s','message','result','catch','CreateMailQueueReport','create','body','options','raw','debug','stringify','UpdateMailQueueReport','MailQueueReport','where','attributes','limit','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xfddc55,_0x52bbee){var _0x1927bd=function(_0xb4923d){while(--_0xb4923d){_0xfddc55['push'](_0xfddc55['shift']());}};_0x1927bd(++_0x52bbee);}(_0xaf07,0x16f));var _0x7af0=function(_0x534678,_0x2135bd){_0x534678=_0x534678-0x0;var _0x5291c6=_0xaf07[_0x534678];return _0x5291c6;};'use strict';var _=require(_0x7af0('0x0'));var util=require(_0x7af0('0x1'));var moment=require(_0x7af0('0x2'));var BPromise=require(_0x7af0('0x3'));var rs=require(_0x7af0('0x4'));var fs=require('fs');var Redis=require(_0x7af0('0x5'));var db=require(_0x7af0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7af0('0x7'))(_0x7af0('0x8'));var config=require(_0x7af0('0x9'));var jayson=require(_0x7af0('0xa'));var client=jayson['client'][_0x7af0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a9517,_0xce545d,_0x12c001){return new BPromise(function(_0xf7b343,_0x4fa86f){return client[_0x7af0('0xc')](_0x2a9517,_0x12c001)[_0x7af0('0xd')](function(_0x2a6568){logger['info']('MailQueueReport,\x20%s,\x20%s',_0xce545d,_0x7af0('0xe'));logger['debug'](_0x7af0('0xf'),_0xce545d,'request\x20sent',JSON['stringify'](_0x2a6568));if(_0x2a6568[_0x7af0('0x10')]){if(_0x2a6568[_0x7af0('0x10')][_0x7af0('0x11')]===0x1f4){logger[_0x7af0('0x10')](_0x7af0('0x12'),_0xce545d,_0x2a6568['error'][_0x7af0('0x13')]);return _0x4fa86f(_0x2a6568[_0x7af0('0x10')]['message']);}logger['error'](_0x7af0('0x12'),_0xce545d,_0x2a6568[_0x7af0('0x10')][_0x7af0('0x13')]);return _0xf7b343(_0x2a6568[_0x7af0('0x10')][_0x7af0('0x13')]);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0xce545d,_0x7af0('0xe'));_0xf7b343(_0x2a6568[_0x7af0('0x14')][_0x7af0('0x13')]);}})[_0x7af0('0x15')](function(_0xcc5012){logger['error'](_0x7af0('0x12'),_0xce545d,_0xcc5012);_0x4fa86f(_0xcc5012);});});}exports[_0x7af0('0x16')]=function(_0x5a409e){var _0x7a783a=this;return new Promise(function(_0x262b82,_0x434807){return db['MailQueueReport'][_0x7af0('0x17')](_0x5a409e[_0x7af0('0x18')],{'raw':_0x5a409e['options']?_0x5a409e[_0x7af0('0x19')][_0x7af0('0x1a')]===undefined?!![]:![]:!![]})[_0x7af0('0xd')](function(_0x3e3d71){logger['info'](_0x7af0('0x16'),_0x5a409e);logger[_0x7af0('0x1b')](_0x7af0('0x16'),_0x5a409e,JSON[_0x7af0('0x1c')](_0x3e3d71));_0x262b82(_0x3e3d71);})[_0x7af0('0x15')](function(_0x237b9f){logger[_0x7af0('0x10')](_0x7af0('0x16'),_0x237b9f[_0x7af0('0x13')],_0x5a409e);_0x434807(_0x7a783a[_0x7af0('0x10')](0x1f4,_0x237b9f[_0x7af0('0x13')]));});});};exports[_0x7af0('0x1d')]=function(_0x3da9c4){var _0x454c88=this;return new Promise(function(_0x224d1d,_0x323762){return db[_0x7af0('0x1e')]['update'](_0x3da9c4[_0x7af0('0x18')],{'raw':_0x3da9c4['options']?_0x3da9c4[_0x7af0('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3da9c4['options']?_0x3da9c4[_0x7af0('0x19')][_0x7af0('0x1f')]||null:null,'attributes':_0x3da9c4[_0x7af0('0x19')]?_0x3da9c4[_0x7af0('0x19')][_0x7af0('0x20')]||null:null,'limit':_0x3da9c4[_0x7af0('0x19')]?_0x3da9c4[_0x7af0('0x19')][_0x7af0('0x21')]||null:null})[_0x7af0('0xd')](function(_0x28976a){logger[_0x7af0('0x22')](_0x7af0('0x1d'),_0x3da9c4);logger[_0x7af0('0x1b')](_0x7af0('0x1d'),_0x3da9c4,JSON[_0x7af0('0x1c')](_0x28976a));_0x224d1d(_0x28976a);})['catch'](function(_0x1c14c4){logger[_0x7af0('0x10')](_0x7af0('0x1d'),_0x1c14c4[_0x7af0('0x13')],_0x3da9c4);_0x323762(_0x454c88[_0x7af0('0x10')](0x1f4,_0x1c14c4[_0x7af0('0x13')]));});});}; \ No newline at end of file +var _0x12d5=['../../config/environment','jayson/promise','client','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateMailQueueReport','MailQueueReport','create','raw','debug','UpdateMailQueueReport','update','body','options','where','attributes','limit','lodash','util','randomstring','ioredis','rpc'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x12d5,0x127));var _0x512d=function(_0x3fcd67,_0x4d624e){_0x3fcd67=_0x3fcd67-0x0;var _0x22ced0=_0x12d5[_0x3fcd67];return _0x22ced0;};'use strict';var _=require(_0x512d('0x0'));var util=require(_0x512d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x512d('0x2'));var fs=require('fs');var Redis=require(_0x512d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x512d('0x4'));var config=require(_0x512d('0x5'));var jayson=require(_0x512d('0x6'));var client=jayson[_0x512d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x545050,_0xd31305,_0x5ee467){return new BPromise(function(_0xf07b5d,_0x2f73f7){return client[_0x512d('0x8')](_0x545050,_0x5ee467)[_0x512d('0x9')](function(_0x512d8b){logger[_0x512d('0xa')](_0x512d('0xb'),_0xd31305,_0x512d('0xc'));logger['debug'](_0x512d('0xd'),_0xd31305,_0x512d('0xc'),JSON[_0x512d('0xe')](_0x512d8b));if(_0x512d8b['error']){if(_0x512d8b[_0x512d('0xf')]['code']===0x1f4){logger[_0x512d('0xf')]('MailQueueReport,\x20%s,\x20%s',_0xd31305,_0x512d8b[_0x512d('0xf')]['message']);return _0x2f73f7(_0x512d8b['error'][_0x512d('0x10')]);}logger['error'](_0x512d('0xb'),_0xd31305,_0x512d8b[_0x512d('0xf')][_0x512d('0x10')]);return _0xf07b5d(_0x512d8b[_0x512d('0xf')]['message']);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0xd31305,_0x512d('0xc'));_0xf07b5d(_0x512d8b['result'][_0x512d('0x10')]);}})[_0x512d('0x11')](function(_0x25f63c){logger['error'](_0x512d('0xb'),_0xd31305,_0x25f63c);_0x2f73f7(_0x25f63c);});});}exports[_0x512d('0x12')]=function(_0x11673b){var _0x8e8c3c=this;return new Promise(function(_0x5c3b04,_0x349e49){return db[_0x512d('0x13')][_0x512d('0x14')](_0x11673b['body'],{'raw':_0x11673b['options']?_0x11673b['options'][_0x512d('0x15')]===undefined?!![]:![]:!![]})[_0x512d('0x9')](function(_0x5894f0){logger['info'](_0x512d('0x12'),_0x11673b);logger[_0x512d('0x16')](_0x512d('0x12'),_0x11673b,JSON[_0x512d('0xe')](_0x5894f0));_0x5c3b04(_0x5894f0);})[_0x512d('0x11')](function(_0x4f5699){logger['error'](_0x512d('0x12'),_0x4f5699['message'],_0x11673b);_0x349e49(_0x8e8c3c['error'](0x1f4,_0x4f5699[_0x512d('0x10')]));});});};exports[_0x512d('0x17')]=function(_0x52d415){var _0x3b89e3=this;return new Promise(function(_0x121341,_0x109429){return db[_0x512d('0x13')][_0x512d('0x18')](_0x52d415[_0x512d('0x19')],{'raw':_0x52d415[_0x512d('0x1a')]?_0x52d415[_0x512d('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52d415[_0x512d('0x1a')]?_0x52d415[_0x512d('0x1a')][_0x512d('0x1b')]||null:null,'attributes':_0x52d415[_0x512d('0x1a')]?_0x52d415['options'][_0x512d('0x1c')]||null:null,'limit':_0x52d415['options']?_0x52d415['options'][_0x512d('0x1d')]||null:null})[_0x512d('0x9')](function(_0x3dd7b0){logger[_0x512d('0xa')](_0x512d('0x17'),_0x52d415);logger['debug'](_0x512d('0x17'),_0x52d415,JSON[_0x512d('0xe')](_0x3dd7b0));_0x121341(_0x3dd7b0);})[_0x512d('0x11')](function(_0x27eeb0){logger[_0x512d('0xf')](_0x512d('0x17'),_0x27eeb0['message'],_0x52d415);_0x109429(_0x3b89e3['error'](0x1f4,_0x27eeb0[_0x512d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index c4623c2..584b57f 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 _0xf710=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf710,0x1b8));var _0x0f71=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xf710[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0f71('0x0'));var util=require(_0x0f71('0x1'));var path=require(_0x0f71('0x2'));var timeout=require(_0x0f71('0x3'));var express=require(_0x0f71('0x4'));var router=express['Router']();var auth=require(_0x0f71('0x5'));var interaction=require(_0x0f71('0x6'));var config=require(_0x0f71('0x7'));module[_0x0f71('0x8')]=router; \ No newline at end of file +var _0xb33b=['connect-timeout','express','Router','../../components/interaction/service','exports','util','path'];(function(_0x1661d2,_0x4d6937){var _0x17c605=function(_0x2f3a90){while(--_0x2f3a90){_0x1661d2['push'](_0x1661d2['shift']());}};_0x17c605(++_0x4d6937);}(_0xb33b,0x1a2));var _0xbb33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb33b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xbb33('0x0'));var path=require(_0xbb33('0x1'));var timeout=require(_0xbb33('0x2'));var express=require(_0xbb33('0x3'));var router=express[_0xbb33('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xbb33('0x5'));var config=require('../../config/environment');module[_0xbb33('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 8420861..d5b9c3e 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 _0x5c6f=['STRING','INTEGER','BOOLEAN','INBOX','exports'];(function(_0x1fa387,_0x40e45f){var _0x2f0101=function(_0x55e833){while(--_0x55e833){_0x1fa387['push'](_0x1fa387['shift']());}};_0x2f0101(++_0x40e45f);}(_0x5c6f,0x17b));var _0xf5c6=function(_0x5f30d3,_0x51385e){_0x5f30d3=_0x5f30d3-0x0;var _0x26d14e=_0x5c6f[_0x5f30d3];return _0x26d14e;};'use strict';var Sequelize=require('sequelize');module[_0xf5c6('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xf5c6('0x1')]},'port':{'type':Sequelize[_0xf5c6('0x2')]},'tls':{'type':Sequelize[_0xf5c6('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf5c6('0x1')],'defaultValue':_0xf5c6('0x4')},'connTimeout':{'type':Sequelize[_0xf5c6('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xf5c6('0x1')]}}; \ No newline at end of file +var _0x0e02=['exports','BOOLEAN','STRING','INTEGER','sequelize'];(function(_0x3d8dae,_0x2d97af){var _0x592650=function(_0x18df0a){while(--_0x18df0a){_0x3d8dae['push'](_0x3d8dae['shift']());}};_0x592650(++_0x2d97af);}(_0x0e02,0x121));var _0x20e0=function(_0x29bf8e,_0xd3209b){_0x29bf8e=_0x29bf8e-0x0;var _0x1ea5ed=_0x0e02[_0x29bf8e];return _0x1ea5ed;};'use strict';var Sequelize=require(_0x20e0('0x0'));module[_0x20e0('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x20e0('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x20e0('0x3')],'unique':'username'},'password':{'type':Sequelize[_0x20e0('0x3')]},'port':{'type':Sequelize[_0x20e0('0x4')]},'tls':{'type':Sequelize[_0x20e0('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x20e0('0x3')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x20e0('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x20e0('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 99f4a21..1f27075 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 _0x1775=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','util'];(function(_0x215f27,_0x46ef38){var _0x11a6c8=function(_0x54ec88){while(--_0x54ec88){_0x215f27['push'](_0x215f27['shift']());}};_0x11a6c8(++_0x46ef38);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var logger=require(_0x5177('0x1'))(_0x5177('0x2'));var moment=require(_0x5177('0x3'));var BPromise=require(_0x5177('0x4'));var rp=require(_0x5177('0x5'));var fs=require('fs');var path=require(_0x5177('0x6'));var rimraf=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var attributes=require(_0x5177('0x9'));module[_0x5177('0xa')]=function(_0x2c5c42,_0x153c1a){return _0x2c5c42[_0x5177('0xb')](_0x5177('0xc'),attributes,{'tableName':_0x5177('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fad=['request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash','util','../../config/logger','moment','bluebird'];(function(_0x59008b,_0x75ea97){var _0x20359c=function(_0x3e3199){while(--_0x3e3199){_0x59008b['push'](_0x59008b['shift']());}};_0x20359c(++_0x75ea97);}(_0x4fad,0xcb));var _0xd4fa=function(_0x453b0c,_0x23bfa8){_0x453b0c=_0x453b0c-0x0;var _0x577af3=_0x4fad[_0x453b0c];return _0x577af3;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var logger=require(_0xd4fa('0x2'))('api');var moment=require(_0xd4fa('0x3'));var BPromise=require(_0xd4fa('0x4'));var rp=require(_0xd4fa('0x5'));var fs=require('fs');var path=require(_0xd4fa('0x6'));var rimraf=require(_0xd4fa('0x7'));var config=require(_0xd4fa('0x8'));var attributes=require(_0xd4fa('0x9'));module[_0xd4fa('0xa')]=function(_0x597fbe,_0x2d4e07){return _0x597fbe['define'](_0xd4fa('0xb'),attributes,{'tableName':_0xd4fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 73d724d..8111f5d 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 _0xb586=['where','limit','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMailServerIn','MailServerIn','options','raw'];(function(_0x55b416,_0xf249a1){var _0x17ed4a=function(_0x2ba3cc){while(--_0x2ba3cc){_0x55b416['push'](_0x55b416['shift']());}};_0x17ed4a(++_0xf249a1);}(_0xb586,0x17d));var _0x6b58=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0xb586[_0xce9195];return _0x530fe6;};'use strict';var _=require(_0x6b58('0x0'));var util=require(_0x6b58('0x1'));var moment=require(_0x6b58('0x2'));var BPromise=require(_0x6b58('0x3'));var rs=require(_0x6b58('0x4'));var fs=require('fs');var Redis=require(_0x6b58('0x5'));var db=require(_0x6b58('0x6'))['db'];var utils=require(_0x6b58('0x7'));var logger=require(_0x6b58('0x8'))(_0x6b58('0x9'));var config=require(_0x6b58('0xa'));var jayson=require(_0x6b58('0xb'));var client=jayson[_0x6b58('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x403d07,_0x5d979e,_0x3a108b){return new BPromise(function(_0x20a895,_0x170cca){return client[_0x6b58('0xd')](_0x403d07,_0x3a108b)[_0x6b58('0xe')](function(_0x419b06){logger[_0x6b58('0xf')](_0x6b58('0x10'),_0x5d979e,_0x6b58('0x11'));logger['debug'](_0x6b58('0x12'),_0x5d979e,_0x6b58('0x11'),JSON['stringify'](_0x419b06));if(_0x419b06['error']){if(_0x419b06[_0x6b58('0x13')][_0x6b58('0x14')]===0x1f4){logger[_0x6b58('0x13')]('MailServerIn,\x20%s,\x20%s',_0x5d979e,_0x419b06[_0x6b58('0x13')]['message']);return _0x170cca(_0x419b06[_0x6b58('0x13')]['message']);}logger[_0x6b58('0x13')]('MailServerIn,\x20%s,\x20%s',_0x5d979e,_0x419b06['error'][_0x6b58('0x15')]);return _0x20a895(_0x419b06[_0x6b58('0x13')][_0x6b58('0x15')]);}else{logger[_0x6b58('0xf')](_0x6b58('0x10'),_0x5d979e,'request\x20sent');_0x20a895(_0x419b06['result'][_0x6b58('0x15')]);}})[_0x6b58('0x16')](function(_0x26b435){logger['error'](_0x6b58('0x10'),_0x5d979e,_0x26b435);_0x170cca(_0x26b435);});});}exports[_0x6b58('0x17')]=function(_0xb08a31){var _0x238046=this;return new Promise(function(_0x3f14e5,_0xf1e478){return db[_0x6b58('0x18')]['findAll']({'raw':_0xb08a31[_0x6b58('0x19')]?_0xb08a31[_0x6b58('0x19')][_0x6b58('0x1a')]===undefined?!![]:![]:!![],'where':_0xb08a31[_0x6b58('0x19')]?_0xb08a31[_0x6b58('0x19')][_0x6b58('0x1b')]||null:null,'attributes':_0xb08a31[_0x6b58('0x19')]?_0xb08a31[_0x6b58('0x19')]['attributes']||null:null,'limit':_0xb08a31[_0x6b58('0x19')]?_0xb08a31[_0x6b58('0x19')][_0x6b58('0x1c')]||null:null,'include':_0xb08a31[_0x6b58('0x19')]?_0xb08a31[_0x6b58('0x19')][_0x6b58('0x1d')]?_[_0x6b58('0x1e')](_0xb08a31[_0x6b58('0x19')][_0x6b58('0x1d')],function(_0x4f7d65){return{'model':db[_0x4f7d65[_0x6b58('0x1f')]],'as':_0x4f7d65['as'],'attributes':_0x4f7d65[_0x6b58('0x20')],'include':_0x4f7d65[_0x6b58('0x1d')]?_['map'](_0x4f7d65['include'],function(_0x331f76){return{'model':db[_0x331f76['model']],'as':_0x331f76['as'],'attributes':_0x331f76['attributes'],'include':_0x331f76['include']?_[_0x6b58('0x1e')](_0x331f76[_0x6b58('0x1d')],function(_0x389048){return{'model':db[_0x389048[_0x6b58('0x1f')]],'as':_0x389048['as'],'attributes':_0x389048[_0x6b58('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6b58('0xe')](function(_0x2cdc0c){logger[_0x6b58('0xf')](_0x6b58('0x17'),_0xb08a31);logger['debug'](_0x6b58('0x17'),_0xb08a31,JSON[_0x6b58('0x21')](_0x2cdc0c));_0x3f14e5(_0x2cdc0c);})[_0x6b58('0x16')](function(_0x22a7cc){logger['error'](_0x6b58('0x17'),_0x22a7cc[_0x6b58('0x15')],_0xb08a31);_0xf1e478(_0x238046[_0x6b58('0x13')](0x1f4,_0x22a7cc['message']));});});}; \ No newline at end of file +var _0x6770=['stringify','error','code','message','request\x20sent','catch','findAll','options','include','map','model','attributes','then','GetMailServerIn','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x3b1a47,_0xe670c7){var _0x12fc69=function(_0x43aed5){while(--_0x43aed5){_0x3b1a47['push'](_0x3b1a47['shift']());}};_0x12fc69(++_0xe670c7);}(_0x6770,0xa4));var _0x0677=function(_0x23a84b,_0x2079b9){_0x23a84b=_0x23a84b-0x0;var _0x11f861=_0x6770[_0x23a84b];return _0x11f861;};'use strict';var _=require(_0x0677('0x0'));var util=require(_0x0677('0x1'));var moment=require(_0x0677('0x2'));var BPromise=require('bluebird');var rs=require(_0x0677('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0677('0x4'))['db'];var utils=require(_0x0677('0x5'));var logger=require('../../config/logger')(_0x0677('0x6'));var config=require(_0x0677('0x7'));var jayson=require(_0x0677('0x8'));var client=jayson[_0x0677('0x9')][_0x0677('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fcee4,_0x2d9d51,_0x1ae1d8){return new BPromise(function(_0x3ac38e,_0x31d4d5){return client[_0x0677('0xb')](_0x2fcee4,_0x1ae1d8)['then'](function(_0x27613a){logger[_0x0677('0xc')](_0x0677('0xd'),_0x2d9d51,'request\x20sent');logger[_0x0677('0xe')](_0x0677('0xf'),_0x2d9d51,'request\x20sent',JSON[_0x0677('0x10')](_0x27613a));if(_0x27613a['error']){if(_0x27613a[_0x0677('0x11')][_0x0677('0x12')]===0x1f4){logger[_0x0677('0x11')](_0x0677('0xd'),_0x2d9d51,_0x27613a['error'][_0x0677('0x13')]);return _0x31d4d5(_0x27613a[_0x0677('0x11')][_0x0677('0x13')]);}logger[_0x0677('0x11')](_0x0677('0xd'),_0x2d9d51,_0x27613a[_0x0677('0x11')][_0x0677('0x13')]);return _0x3ac38e(_0x27613a['error'][_0x0677('0x13')]);}else{logger['info'](_0x0677('0xd'),_0x2d9d51,_0x0677('0x14'));_0x3ac38e(_0x27613a['result']['message']);}})[_0x0677('0x15')](function(_0x1806df){logger[_0x0677('0x11')](_0x0677('0xd'),_0x2d9d51,_0x1806df);_0x31d4d5(_0x1806df);});});}exports['GetMailServerIn']=function(_0x5b0d3d){var _0x313f19=this;return new Promise(function(_0x1c26eb,_0x52b176){return db['MailServerIn'][_0x0677('0x16')]({'raw':_0x5b0d3d[_0x0677('0x17')]?_0x5b0d3d[_0x0677('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5b0d3d[_0x0677('0x17')]?_0x5b0d3d[_0x0677('0x17')]['where']||null:null,'attributes':_0x5b0d3d[_0x0677('0x17')]?_0x5b0d3d[_0x0677('0x17')]['attributes']||null:null,'limit':_0x5b0d3d['options']?_0x5b0d3d['options']['limit']||null:null,'include':_0x5b0d3d[_0x0677('0x17')]?_0x5b0d3d[_0x0677('0x17')][_0x0677('0x18')]?_[_0x0677('0x19')](_0x5b0d3d[_0x0677('0x17')][_0x0677('0x18')],function(_0x34889a){return{'model':db[_0x34889a[_0x0677('0x1a')]],'as':_0x34889a['as'],'attributes':_0x34889a[_0x0677('0x1b')],'include':_0x34889a[_0x0677('0x18')]?_[_0x0677('0x19')](_0x34889a[_0x0677('0x18')],function(_0x54743a){return{'model':db[_0x54743a['model']],'as':_0x54743a['as'],'attributes':_0x54743a[_0x0677('0x1b')],'include':_0x54743a[_0x0677('0x18')]?_['map'](_0x54743a['include'],function(_0x26eb02){return{'model':db[_0x26eb02[_0x0677('0x1a')]],'as':_0x26eb02['as'],'attributes':_0x26eb02[_0x0677('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0677('0x1c')](function(_0x1d281f){logger['info']('GetMailServerIn',_0x5b0d3d);logger[_0x0677('0xe')](_0x0677('0x1d'),_0x5b0d3d,JSON[_0x0677('0x10')](_0x1d281f));_0x1c26eb(_0x1d281f);})[_0x0677('0x15')](function(_0x5598b3){logger[_0x0677('0x11')](_0x0677('0x1d'),_0x5598b3[_0x0677('0x13')],_0x5b0d3d);_0x52b176(_0x313f19['error'](0x1f4,_0x5598b3['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 1989736..50db8fe 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 _0x2096=['show','put','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','/:id'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x2096,0x166));var _0x6209=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x2096[_0x88cd7b];return _0x56fcc8;};'use strict';var multer=require(_0x6209('0x0'));var util=require('util');var path=require(_0x6209('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6209('0x2')]();var auth=require(_0x6209('0x3'));var interaction=require(_0x6209('0x4'));var config=require(_0x6209('0x5'));var controller=require(_0x6209('0x6'));router[_0x6209('0x7')]('/',auth[_0x6209('0x8')](),controller['index']);router[_0x6209('0x7')](_0x6209('0x9'),auth[_0x6209('0x8')](),controller[_0x6209('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6209('0xb')](_0x6209('0x9'),auth['isAuthenticated'](),controller[_0x6209('0xc')]);router[_0x6209('0xd')](_0x6209('0x9'),auth[_0x6209('0x8')](),controller[_0x6209('0xe')]);module[_0x6209('0xf')]=router; \ No newline at end of file +var _0x005f=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','multer','path'];(function(_0x96d59a,_0x87df53){var _0x920118=function(_0x83c189){while(--_0x83c189){_0x96d59a['push'](_0x96d59a['shift']());}};_0x920118(++_0x87df53);}(_0x005f,0x1d9));var _0xf005=function(_0x174e20,_0x95186c){_0x174e20=_0x174e20-0x0;var _0x4bf624=_0x005f[_0x174e20];return _0x4bf624;};'use strict';var multer=require(_0xf005('0x0'));var util=require('util');var path=require(_0xf005('0x1'));var timeout=require(_0xf005('0x2'));var express=require(_0xf005('0x3'));var router=express[_0xf005('0x4')]();var auth=require(_0xf005('0x5'));var interaction=require(_0xf005('0x6'));var config=require('../../config/environment');var controller=require(_0xf005('0x7'));router[_0xf005('0x8')]('/',auth[_0xf005('0x9')](),controller[_0xf005('0xa')]);router[_0xf005('0x8')]('/:id',auth[_0xf005('0x9')](),controller[_0xf005('0xb')]);router[_0xf005('0xc')]('/',auth['isAuthenticated'](),controller[_0xf005('0xd')]);router[_0xf005('0xe')](_0xf005('0xf'),auth[_0xf005('0x9')](),controller[_0xf005('0x10')]);router[_0xf005('0x11')](_0xf005('0xf'),auth[_0xf005('0x9')](),controller[_0xf005('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index d61dfe0..762775e 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 _0xd8fb=['BOOLEAN','sequelize','exports','STRING'];(function(_0x57a3ba,_0x5bc1c6){var _0x4e1a8e=function(_0x588a2f){while(--_0x588a2f){_0x57a3ba['push'](_0x57a3ba['shift']());}};_0x4e1a8e(++_0x5bc1c6);}(_0xd8fb,0x99));var _0xbd8f=function(_0x18f272,_0x445b7f){_0x18f272=_0x18f272-0x0;var _0x313c45=_0xd8fb[_0x18f272];return _0x313c45;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'description':{'type':Sequelize[_0xbd8f('0x2')]},'host':{'type':Sequelize[_0xbd8f('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xbd8f('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xbd8f('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9fd4=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x3706ad,_0x502ec7){var _0x5bc955=function(_0x15ff39){while(--_0x15ff39){_0x3706ad['push'](_0x3706ad['shift']());}};_0x5bc955(++_0x502ec7);}(_0x9fd4,0x16c));var _0x49fd=function(_0x30e977,_0x5edc12){_0x30e977=_0x30e977-0x0;var _0x536cb5=_0x9fd4[_0x30e977];return _0x536cb5;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'description':{'type':Sequelize[_0x49fd('0x2')]},'host':{'type':Sequelize[_0x49fd('0x2')]},'user':{'type':Sequelize[_0x49fd('0x2')]},'pass':{'type':Sequelize[_0x49fd('0x2')]},'port':{'type':Sequelize[_0x49fd('0x3')]},'secure':{'type':Sequelize[_0x49fd('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x49fd('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 10aa4d4..8a22527 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 _0x066b=['index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','rows','catch','show','params','include','find','create','body','destroy','html-pdf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name'];(function(_0xf346a3,_0x3d5ba2){var _0x59033f=function(_0x30445f){while(--_0x30445f){_0xf346a3['push'](_0xf346a3['shift']());}};_0x59033f(++_0x3d5ba2);}(_0x066b,0xb3));var _0xb066=function(_0x458885,_0x2253e7){_0x458885=_0x458885-0x0;var _0x5e6fa8=_0x066b[_0x458885];return _0x5e6fa8;};'use strict';var pdf=require(_0xb066('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb066('0x1'));var rp=require(_0xb066('0x2'));var moment=require(_0xb066('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb066('0x4'));var path=require(_0xb066('0x5'));var sox=require(_0xb066('0x6'));var csv=require(_0xb066('0x7'));var ejs=require(_0xb066('0x8'));var fs=require('fs');var _=require(_0xb066('0x9'));var squel=require(_0xb066('0xa'));var crypto=require(_0xb066('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb066('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb066('0xd'));var Papa=require('papaparse');var Redis=require(_0xb066('0xe'));var authService=require(_0xb066('0xf'));var qs=require(_0xb066('0x10'));var as=require(_0xb066('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb066('0x12'))(_0xb066('0x13'));var utils=require('../../config/utils');var config=require(_0xb066('0x14'));var licenseUtil=require(_0xb066('0x15'));var db=require(_0xb066('0x16'))['db'];function respondWithStatusCode(_0x9d1eba,_0x3bf656){_0x3bf656=_0x3bf656||0xcc;return function(_0x498c09){if(_0x498c09){return _0x9d1eba['sendStatus'](_0x3bf656);}return _0x9d1eba[_0xb066('0x17')](_0x3bf656)[_0xb066('0x18')]();};}function respondWithResult(_0x287aed,_0x52f2b7){_0x52f2b7=_0x52f2b7||0xc8;return function(_0x44b9c9){if(_0x44b9c9){return _0x287aed[_0xb066('0x17')](_0x52f2b7)['json'](_0x44b9c9);}};}function respondWithFilteredResult(_0x26cffc,_0x4a3f76){return function(_0x20c07d){if(_0x20c07d){var _0x5f4ae9=_0x20c07d['count'],_0x3ec941=_0x4a3f76[_0xb066('0x19')],_0xb4bc92=_0x4a3f76[_0xb066('0x19')]+_0x4a3f76[_0xb066('0x1a')],_0x565fbc;if(_0xb4bc92>=_0x5f4ae9){_0xb4bc92=_0x5f4ae9;_0x565fbc=0xc8;}else{_0x565fbc=0xce;}_0x26cffc[_0xb066('0x17')](_0x565fbc);return _0x26cffc[_0xb066('0x1b')](_0xb066('0x1c'),_0x3ec941+'-'+_0xb4bc92+'/'+_0x5f4ae9)['json'](_0x20c07d);}return null;};}function patchUpdates(_0x57d941){return function(_0x3a98ee){try{jsonpatch[_0xb066('0x1d')](_0x3a98ee,_0x57d941,!![]);}catch(_0xf2aed0){return BPromise[_0xb066('0x1e')](_0xf2aed0);}return _0x3a98ee[_0xb066('0x1f')]();};}function saveUpdates(_0x5b032e,_0x3f81e0){return function(_0x315b37){if(_0x315b37){return _0x315b37[_0xb066('0x20')](_0x5b032e)[_0xb066('0x21')](function(_0x160c43){return _0x160c43;});}return null;};}function removeEntity(_0x5272ca,_0x2a368e){return function(_0x26cf14){if(_0x26cf14){return _0x26cf14['destroy']()['then'](function(){_0x5272ca[_0xb066('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36d04f,_0x577db8){return function(_0x14aff7){if(!_0x14aff7){_0x36d04f[_0xb066('0x22')](0x194);}return _0x14aff7;};}function handleError(_0x5fc47b,_0x2177ee){_0x2177ee=_0x2177ee||0x1f4;return function(_0x2230e9){logger['error'](_0x2230e9[_0xb066('0x23')]);if(_0x2230e9[_0xb066('0x24')]){delete _0x2230e9[_0xb066('0x24')];}_0x5fc47b[_0xb066('0x17')](_0x2177ee)['send'](_0x2230e9);};}exports[_0xb066('0x25')]=function(_0x2250ae,_0x21e51f){var _0x9762de={},_0x2b6b3e={},_0x8fef77={'count':0x0,'rows':[]};var _0x12515a=_[_0xb066('0x26')](db[_0xb066('0x27')][_0xb066('0x28')],function(_0x1ecebf){return{'name':_0x1ecebf[_0xb066('0x29')],'type':_0x1ecebf[_0xb066('0x2a')][_0xb066('0x2b')]};});_0x2b6b3e[_0xb066('0x2c')]=_[_0xb066('0x26')](_0x12515a,_0xb066('0x24'));_0x2b6b3e[_0xb066('0x2d')]=_[_0xb066('0x2e')](_0x2250ae[_0xb066('0x2d')]);_0x2b6b3e[_0xb066('0x2f')]=_[_0xb066('0x30')](_0x2b6b3e[_0xb066('0x2c')],_0x2b6b3e['query']);_0x9762de[_0xb066('0x31')]=_[_0xb066('0x30')](_0x2b6b3e[_0xb066('0x2c')],qs[_0xb066('0x32')](_0x2250ae[_0xb066('0x2d')][_0xb066('0x32')]));_0x9762de[_0xb066('0x31')]=_0x9762de[_0xb066('0x31')][_0xb066('0x33')]?_0x9762de[_0xb066('0x31')]:_0x2b6b3e[_0xb066('0x2c')];if(!_0x2250ae[_0xb066('0x2d')][_0xb066('0x34')](_0xb066('0x35'))){_0x9762de['limit']=qs[_0xb066('0x1a')](_0x2250ae[_0xb066('0x2d')][_0xb066('0x1a')]);_0x9762de[_0xb066('0x19')]=qs[_0xb066('0x19')](_0x2250ae[_0xb066('0x2d')][_0xb066('0x19')]);}_0x9762de[_0xb066('0x36')]=qs['sort'](_0x2250ae[_0xb066('0x2d')][_0xb066('0x37')]);_0x9762de['where']=qs['filters'](_['pick'](_0x2250ae[_0xb066('0x2d')],_0x2b6b3e[_0xb066('0x2f')]),_0x12515a);if(_0x2250ae[_0xb066('0x2d')]['filter']){_0x9762de[_0xb066('0x38')]=_[_0xb066('0x39')](_0x9762de['where'],{'$or':_[_0xb066('0x26')](_0x12515a,function(_0x573fbe){if(_0x573fbe[_0xb066('0x2a')]!==_0xb066('0x3a')){var _0x1b6a23={};_0x1b6a23[_0x573fbe[_0xb066('0x24')]]={'$like':'%'+_0x2250ae['query'][_0xb066('0x3b')]+'%'};return _0x1b6a23;}})});}_0x9762de=_['merge']({},_0x9762de,_0x2250ae[_0xb066('0x3c')]);var _0x1b5642={'where':_0x9762de[_0xb066('0x38')]};return db[_0xb066('0x27')][_0xb066('0x3d')](_0x1b5642)[_0xb066('0x21')](function(_0x2cc5bb){_0x8fef77[_0xb066('0x3d')]=_0x2cc5bb;if(_0x2250ae[_0xb066('0x2d')][_0xb066('0x3e')]){_0x9762de['include']=[{'all':!![]}];}return db[_0xb066('0x27')]['findAll'](_0x9762de);})[_0xb066('0x21')](function(_0x260548){_0x8fef77[_0xb066('0x3f')]=_0x260548;return _0x8fef77;})[_0xb066('0x21')](respondWithFilteredResult(_0x21e51f,_0x9762de))[_0xb066('0x40')](handleError(_0x21e51f,null));};exports[_0xb066('0x41')]=function(_0x35d54e,_0x5f10f2){var _0x113500={'raw':!![],'where':{'id':_0x35d54e[_0xb066('0x42')]['id']}},_0x2b9498={};_0x2b9498['model']=_[_0xb066('0x2e')](db[_0xb066('0x27')][_0xb066('0x28')]);_0x2b9498[_0xb066('0x2d')]=_[_0xb066('0x2e')](_0x35d54e[_0xb066('0x2d')]);_0x2b9498[_0xb066('0x2f')]=_[_0xb066('0x30')](_0x2b9498['model'],_0x2b9498[_0xb066('0x2d')]);_0x113500[_0xb066('0x31')]=_[_0xb066('0x30')](_0x2b9498[_0xb066('0x2c')],qs[_0xb066('0x32')](_0x35d54e[_0xb066('0x2d')][_0xb066('0x32')]));_0x113500[_0xb066('0x31')]=_0x113500[_0xb066('0x31')]['length']?_0x113500[_0xb066('0x31')]:_0x2b9498[_0xb066('0x2c')];if(_0x35d54e['query'][_0xb066('0x3e')]){_0x113500[_0xb066('0x43')]=[{'all':!![]}];}_0x113500=_['merge']({},_0x113500,_0x35d54e['options']);return db[_0xb066('0x27')][_0xb066('0x44')](_0x113500)[_0xb066('0x21')](handleEntityNotFound(_0x5f10f2,null))['then'](respondWithResult(_0x5f10f2,null))[_0xb066('0x40')](handleError(_0x5f10f2,null));};exports[_0xb066('0x45')]=function(_0xf6498e,_0x41fb2c){return db[_0xb066('0x27')]['create'](_0xf6498e[_0xb066('0x46')],{})[_0xb066('0x21')](respondWithResult(_0x41fb2c,0xc9))[_0xb066('0x40')](handleError(_0x41fb2c,null));};exports['update']=function(_0x5de7e1,_0x483ef4){if(_0x5de7e1[_0xb066('0x46')]['id']){delete _0x5de7e1[_0xb066('0x46')]['id'];}return db[_0xb066('0x27')][_0xb066('0x44')]({'where':{'id':_0x5de7e1['params']['id']}})[_0xb066('0x21')](handleEntityNotFound(_0x483ef4,null))['then'](saveUpdates(_0x5de7e1[_0xb066('0x46')],null))[_0xb066('0x21')](respondWithResult(_0x483ef4,null))[_0xb066('0x40')](handleError(_0x483ef4,null));};exports[_0xb066('0x47')]=function(_0x3eca79,_0x2d2f58){return db[_0xb066('0x27')]['find']({'where':{'id':_0x3eca79[_0xb066('0x42')]['id']}})[_0xb066('0x21')](handleEntityNotFound(_0x2d2f58,null))[_0xb066('0x21')](removeEntity(_0x2d2f58,null))[_0xb066('0x40')](handleError(_0x2d2f58,null));}; \ No newline at end of file +var _0x26f9=['map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','fields','create','body','find','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','count','limit','set','apply','reject','update','then','stack','name','send','index'];(function(_0x60ef35,_0x4a66e5){var _0x4cc5c9=function(_0x45d553){while(--_0x45d553){_0x60ef35['push'](_0x60ef35['shift']());}};_0x4cc5c9(++_0x4a66e5);}(_0x26f9,0x166));var _0x926f=function(_0x3c2666,_0x15fd23){_0x3c2666=_0x3c2666-0x0;var _0x10c814=_0x26f9[_0x3c2666];return _0x10c814;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x926f('0x0'));var jsonpatch=require(_0x926f('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x926f('0x2'));var util=require(_0x926f('0x3'));var path=require(_0x926f('0x4'));var sox=require(_0x926f('0x5'));var csv=require(_0x926f('0x6'));var ejs=require(_0x926f('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x926f('0x8'));var crypto=require(_0x926f('0x9'));var jsforce=require(_0x926f('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x926f('0xb'));var Redis=require('ioredis');var authService=require(_0x926f('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x926f('0xd'));var hardwareService=require(_0x926f('0xe'));var logger=require(_0x926f('0xf'))(_0x926f('0x10'));var utils=require(_0x926f('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d5f91,_0x1586fa){_0x1586fa=_0x1586fa||0xcc;return function(_0x2cec3f){if(_0x2cec3f){return _0x1d5f91[_0x926f('0x12')](_0x1586fa);}return _0x1d5f91[_0x926f('0x13')](_0x1586fa)[_0x926f('0x14')]();};}function respondWithResult(_0x31b803,_0x3cc1f8){_0x3cc1f8=_0x3cc1f8||0xc8;return function(_0x5c5a9d){if(_0x5c5a9d){return _0x31b803[_0x926f('0x13')](_0x3cc1f8)['json'](_0x5c5a9d);}};}function respondWithFilteredResult(_0x118a29,_0x4c5b06){return function(_0x2d4d35){if(_0x2d4d35){var _0x401d2b=_0x2d4d35[_0x926f('0x15')],_0x82b274=_0x4c5b06['offset'],_0x1343c4=_0x4c5b06['offset']+_0x4c5b06[_0x926f('0x16')],_0x26de02;if(_0x1343c4>=_0x401d2b){_0x1343c4=_0x401d2b;_0x26de02=0xc8;}else{_0x26de02=0xce;}_0x118a29['status'](_0x26de02);return _0x118a29[_0x926f('0x17')]('Content-Range',_0x82b274+'-'+_0x1343c4+'/'+_0x401d2b)['json'](_0x2d4d35);}return null;};}function patchUpdates(_0xe4461a){return function(_0x290072){try{jsonpatch[_0x926f('0x18')](_0x290072,_0xe4461a,!![]);}catch(_0x3aec4e){return BPromise[_0x926f('0x19')](_0x3aec4e);}return _0x290072['save']();};}function saveUpdates(_0x22c370,_0x116999){return function(_0x2f224b){if(_0x2f224b){return _0x2f224b[_0x926f('0x1a')](_0x22c370)[_0x926f('0x1b')](function(_0x23b0a8){return _0x23b0a8;});}return null;};}function removeEntity(_0x9e7b97,_0x5d3659){return function(_0x2f73c5){if(_0x2f73c5){return _0x2f73c5['destroy']()[_0x926f('0x1b')](function(){_0x9e7b97['status'](0xcc)[_0x926f('0x14')]();});}};}function handleEntityNotFound(_0x153e3a,_0x2f4fb5){return function(_0x1a1b71){if(!_0x1a1b71){_0x153e3a[_0x926f('0x12')](0x194);}return _0x1a1b71;};}function handleError(_0x5b81c4,_0x43cebc){_0x43cebc=_0x43cebc||0x1f4;return function(_0x4c8eb3){logger['error'](_0x4c8eb3[_0x926f('0x1c')]);if(_0x4c8eb3[_0x926f('0x1d')]){delete _0x4c8eb3[_0x926f('0x1d')];}_0x5b81c4['status'](_0x43cebc)[_0x926f('0x1e')](_0x4c8eb3);};}exports[_0x926f('0x1f')]=function(_0x16f9a6,_0x9e1781){var _0x2edc60={},_0x594eae={},_0x3edd1d={'count':0x0,'rows':[]};var _0x520d98=_[_0x926f('0x20')](db[_0x926f('0x21')][_0x926f('0x22')],function(_0x3fd9f0){return{'name':_0x3fd9f0[_0x926f('0x23')],'type':_0x3fd9f0[_0x926f('0x24')][_0x926f('0x25')]};});_0x594eae[_0x926f('0x26')]=_[_0x926f('0x20')](_0x520d98,_0x926f('0x1d'));_0x594eae[_0x926f('0x27')]=_[_0x926f('0x28')](_0x16f9a6[_0x926f('0x27')]);_0x594eae[_0x926f('0x29')]=_['intersection'](_0x594eae[_0x926f('0x26')],_0x594eae[_0x926f('0x27')]);_0x2edc60['attributes']=_[_0x926f('0x2a')](_0x594eae[_0x926f('0x26')],qs['fields'](_0x16f9a6[_0x926f('0x27')]['fields']));_0x2edc60[_0x926f('0x2b')]=_0x2edc60['attributes'][_0x926f('0x2c')]?_0x2edc60[_0x926f('0x2b')]:_0x594eae['model'];if(!_0x16f9a6[_0x926f('0x27')]['hasOwnProperty'](_0x926f('0x2d'))){_0x2edc60['limit']=qs[_0x926f('0x16')](_0x16f9a6['query'][_0x926f('0x16')]);_0x2edc60[_0x926f('0x2e')]=qs[_0x926f('0x2e')](_0x16f9a6[_0x926f('0x27')]['offset']);}_0x2edc60[_0x926f('0x2f')]=qs[_0x926f('0x30')](_0x16f9a6[_0x926f('0x27')][_0x926f('0x30')]);_0x2edc60[_0x926f('0x31')]=qs[_0x926f('0x29')](_[_0x926f('0x32')](_0x16f9a6[_0x926f('0x27')],_0x594eae[_0x926f('0x29')]),_0x520d98);if(_0x16f9a6[_0x926f('0x27')][_0x926f('0x33')]){_0x2edc60[_0x926f('0x31')]=_['merge'](_0x2edc60[_0x926f('0x31')],{'$or':_[_0x926f('0x20')](_0x520d98,function(_0x2210c2){if(_0x2210c2['type']!==_0x926f('0x34')){var _0x2fcdba={};_0x2fcdba[_0x2210c2[_0x926f('0x1d')]]={'$like':'%'+_0x16f9a6[_0x926f('0x27')][_0x926f('0x33')]+'%'};return _0x2fcdba;}})});}_0x2edc60=_[_0x926f('0x35')]({},_0x2edc60,_0x16f9a6[_0x926f('0x36')]);var _0x18f5ca={'where':_0x2edc60[_0x926f('0x31')]};return db['MailServerOut'][_0x926f('0x15')](_0x18f5ca)['then'](function(_0x2b5839){_0x3edd1d[_0x926f('0x15')]=_0x2b5839;if(_0x16f9a6[_0x926f('0x27')][_0x926f('0x37')]){_0x2edc60[_0x926f('0x38')]=[{'all':!![]}];}return db[_0x926f('0x21')][_0x926f('0x39')](_0x2edc60);})[_0x926f('0x1b')](function(_0x54356b){_0x3edd1d[_0x926f('0x3a')]=_0x54356b;return _0x3edd1d;})[_0x926f('0x1b')](respondWithFilteredResult(_0x9e1781,_0x2edc60))[_0x926f('0x3b')](handleError(_0x9e1781,null));};exports['show']=function(_0x535fda,_0x3dc61a){var _0x238502={'raw':!![],'where':{'id':_0x535fda[_0x926f('0x3c')]['id']}},_0xf7380d={};_0xf7380d[_0x926f('0x26')]=_[_0x926f('0x28')](db[_0x926f('0x21')][_0x926f('0x22')]);_0xf7380d[_0x926f('0x27')]=_[_0x926f('0x28')](_0x535fda['query']);_0xf7380d[_0x926f('0x29')]=_[_0x926f('0x2a')](_0xf7380d[_0x926f('0x26')],_0xf7380d[_0x926f('0x27')]);_0x238502[_0x926f('0x2b')]=_[_0x926f('0x2a')](_0xf7380d[_0x926f('0x26')],qs[_0x926f('0x3d')](_0x535fda[_0x926f('0x27')][_0x926f('0x3d')]));_0x238502[_0x926f('0x2b')]=_0x238502[_0x926f('0x2b')]['length']?_0x238502[_0x926f('0x2b')]:_0xf7380d[_0x926f('0x26')];if(_0x535fda[_0x926f('0x27')][_0x926f('0x37')]){_0x238502[_0x926f('0x38')]=[{'all':!![]}];}_0x238502=_[_0x926f('0x35')]({},_0x238502,_0x535fda[_0x926f('0x36')]);return db['MailServerOut']['find'](_0x238502)[_0x926f('0x1b')](handleEntityNotFound(_0x3dc61a,null))['then'](respondWithResult(_0x3dc61a,null))[_0x926f('0x3b')](handleError(_0x3dc61a,null));};exports[_0x926f('0x3e')]=function(_0x4f5c26,_0x1cb9dc){return db[_0x926f('0x21')][_0x926f('0x3e')](_0x4f5c26[_0x926f('0x3f')],{})[_0x926f('0x1b')](respondWithResult(_0x1cb9dc,0xc9))['catch'](handleError(_0x1cb9dc,null));};exports[_0x926f('0x1a')]=function(_0x436472,_0x19ef11){if(_0x436472[_0x926f('0x3f')]['id']){delete _0x436472[_0x926f('0x3f')]['id'];}return db[_0x926f('0x21')][_0x926f('0x40')]({'where':{'id':_0x436472[_0x926f('0x3c')]['id']}})[_0x926f('0x1b')](handleEntityNotFound(_0x19ef11,null))[_0x926f('0x1b')](saveUpdates(_0x436472[_0x926f('0x3f')],null))[_0x926f('0x1b')](respondWithResult(_0x19ef11,null))['catch'](handleError(_0x19ef11,null));};exports['destroy']=function(_0x4adcd3,_0x13d668){return db[_0x926f('0x21')][_0x926f('0x40')]({'where':{'id':_0x4adcd3['params']['id']}})[_0x926f('0x1b')](handleEntityNotFound(_0x13d668,null))[_0x926f('0x1b')](removeEntity(_0x13d668,null))[_0x926f('0x3b')](handleError(_0x13d668,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9a22192..06fd277 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 _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','define','mail_servers_out'];(function(_0x203cd8,_0x2b1d44){var _0x114c3b=function(_0x5d79e1){while(--_0x5d79e1){_0x203cd8['push'](_0x203cd8['shift']());}};_0x114c3b(++_0x2b1d44);}(_0x1261,0x144));var _0x1126=function(_0x117821,_0xaa1933){_0x117821=_0x117821-0x0;var _0x4ae9ff=_0x1261[_0x117821];return _0x4ae9ff;};'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')]('MailServerOut',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['define','MailServerOut','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x4da2fb,_0x4e90cb){var _0x1348e8=function(_0x347356){while(--_0x347356){_0x4da2fb['push'](_0x4da2fb['shift']());}};_0x1348e8(++_0x4e90cb);}(_0x814b,0x1a2));var _0xb814=function(_0x170772,_0x1f1ee7){_0x170772=_0x170772-0x0;var _0x3ef69c=_0x814b[_0x170772];return _0x3ef69c;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'mail_servers_out','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 cf0318d..a3b88f5 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 _0xe705=['debug','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent'];(function(_0x32d816,_0x3308b1){var _0x20bd35=function(_0x2a68e2){while(--_0x2a68e2){_0x32d816['push'](_0x32d816['shift']());}};_0x20bd35(++_0x3308b1);}(_0xe705,0xaf));var _0x5e70=function(_0x4bbaba,_0x15097c){_0x4bbaba=_0x4bbaba-0x0;var _0x34ff2b=_0xe705[_0x4bbaba];return _0x34ff2b;};'use strict';var _=require(_0x5e70('0x0'));var util=require(_0x5e70('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5e70('0x2'));var fs=require('fs');var Redis=require(_0x5e70('0x3'));var db=require(_0x5e70('0x4'))['db'];var utils=require(_0x5e70('0x5'));var logger=require(_0x5e70('0x6'))(_0x5e70('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5e70('0x8')][_0x5e70('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x578ee4,_0x3b277b,_0x457f68){return new BPromise(function(_0x597b0a,_0x488816){return client[_0x5e70('0xa')](_0x578ee4,_0x457f68)[_0x5e70('0xb')](function(_0xe372e){logger['info'](_0x5e70('0xc'),_0x3b277b,_0x5e70('0xd'));logger[_0x5e70('0xe')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3b277b,_0x5e70('0xd'),JSON['stringify'](_0xe372e));if(_0xe372e[_0x5e70('0xf')]){if(_0xe372e[_0x5e70('0xf')][_0x5e70('0x10')]===0x1f4){logger[_0x5e70('0xf')](_0x5e70('0xc'),_0x3b277b,_0xe372e[_0x5e70('0xf')][_0x5e70('0x11')]);return _0x488816(_0xe372e[_0x5e70('0xf')][_0x5e70('0x11')]);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x3b277b,_0xe372e[_0x5e70('0xf')][_0x5e70('0x11')]);return _0x597b0a(_0xe372e['error']['message']);}else{logger[_0x5e70('0x12')](_0x5e70('0xc'),_0x3b277b,_0x5e70('0xd'));_0x597b0a(_0xe372e[_0x5e70('0x13')]['message']);}})[_0x5e70('0x14')](function(_0x90420c){logger[_0x5e70('0xf')](_0x5e70('0xc'),_0x3b277b,_0x90420c);_0x488816(_0x90420c);});});} \ No newline at end of file +var _0xb961=['../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','code','MailServerOut,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xb961,0x1b8));var _0x1b96=function(_0x20363a,_0xe52a02){_0x20363a=_0x20363a-0x0;var _0x422124=_0xb961[_0x20363a];return _0x422124;};'use strict';var _=require(_0x1b96('0x0'));var util=require(_0x1b96('0x1'));var moment=require(_0x1b96('0x2'));var BPromise=require(_0x1b96('0x3'));var rs=require(_0x1b96('0x4'));var fs=require('fs');var Redis=require(_0x1b96('0x5'));var db=require(_0x1b96('0x6'))['db'];var utils=require(_0x1b96('0x7'));var logger=require(_0x1b96('0x8'))(_0x1b96('0x9'));var config=require(_0x1b96('0xa'));var jayson=require(_0x1b96('0xb'));var client=jayson[_0x1b96('0xc')][_0x1b96('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5cc71b,_0x3d05e3,_0x3be1f6){return new BPromise(function(_0x2f5343,_0x41d412){return client['request'](_0x5cc71b,_0x3be1f6)[_0x1b96('0xe')](function(_0x46eaee){logger[_0x1b96('0xf')]('MailServerOut,\x20%s,\x20%s',_0x3d05e3,_0x1b96('0x10'));logger[_0x1b96('0x11')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3d05e3,_0x1b96('0x10'),JSON[_0x1b96('0x12')](_0x46eaee));if(_0x46eaee['error']){if(_0x46eaee['error'][_0x1b96('0x13')]===0x1f4){logger['error'](_0x1b96('0x14'),_0x3d05e3,_0x46eaee['error']['message']);return _0x41d412(_0x46eaee['error']['message']);}logger[_0x1b96('0x15')](_0x1b96('0x14'),_0x3d05e3,_0x46eaee[_0x1b96('0x15')]['message']);return _0x2f5343(_0x46eaee[_0x1b96('0x15')][_0x1b96('0x16')]);}else{logger['info']('MailServerOut,\x20%s,\x20%s',_0x3d05e3,_0x1b96('0x10'));_0x2f5343(_0x46eaee[_0x1b96('0x17')][_0x1b96('0x16')]);}})[_0x1b96('0x18')](function(_0x421b4d){logger[_0x1b96('0x15')](_0x1b96('0x14'),_0x3d05e3,_0x421b4d);_0x41d412(_0x421b4d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a9fdf9f..3fe838c 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 _0x83dd=['../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x10c74e,_0x4182c1){var _0x5048a5=function(_0x25f9e3){while(--_0x25f9e3){_0x10c74e['push'](_0x10c74e['shift']());}};_0x5048a5(++_0x4182c1);}(_0x83dd,0x1ee));var _0xd83d=function(_0x144d48,_0x5530d0){_0x144d48=_0x144d48-0x0;var _0x29240f=_0x83dd[_0x144d48];return _0x29240f;};'use strict';var multer=require(_0xd83d('0x0'));var util=require(_0xd83d('0x1'));var path=require(_0xd83d('0x2'));var timeout=require(_0xd83d('0x3'));var express=require(_0xd83d('0x4'));var router=express[_0xd83d('0x5')]();var auth=require(_0xd83d('0x6'));var interaction=require(_0xd83d('0x7'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0xd83d('0x8')](),controller[_0xd83d('0x9')]);router[_0xd83d('0xa')](_0xd83d('0xb'),auth[_0xd83d('0x8')](),controller[_0xd83d('0xc')]);router[_0xd83d('0xa')](_0xd83d('0xd'),auth[_0xd83d('0x8')](),controller[_0xd83d('0xe')]);router[_0xd83d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd83d('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd83d('0x11')]('/:id',auth[_0xd83d('0x8')](),controller[_0xd83d('0x12')]);module[_0xd83d('0x13')]=router; \ No newline at end of file +var _0xd0e2=['/describe','describe','/:id','isAuthenticated','show','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index'];(function(_0x5d0990,_0x41d3ea){var _0x55271f=function(_0x277705){while(--_0x277705){_0x5d0990['push'](_0x5d0990['shift']());}};_0x55271f(++_0x41d3ea);}(_0xd0e2,0x1ad));var _0x2d0e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd0e2[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x2d0e('0x0'));var util=require(_0x2d0e('0x1'));var path=require(_0x2d0e('0x2'));var timeout=require(_0x2d0e('0x3'));var express=require(_0x2d0e('0x4'));var router=express[_0x2d0e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2d0e('0x6'));var config=require(_0x2d0e('0x7'));var controller=require(_0x2d0e('0x8'));router[_0x2d0e('0x9')]('/',auth['isAuthenticated'](),controller[_0x2d0e('0xa')]);router[_0x2d0e('0x9')](_0x2d0e('0xb'),auth['isAuthenticated'](),controller[_0x2d0e('0xc')]);router[_0x2d0e('0x9')](_0x2d0e('0xd'),auth[_0x2d0e('0xe')](),controller[_0x2d0e('0xf')]);router[_0x2d0e('0x10')]('/',auth[_0x2d0e('0xe')](),controller['create']);router['put'](_0x2d0e('0xd'),auth['isAuthenticated'](),controller[_0x2d0e('0x11')]);router[_0x2d0e('0x12')](_0x2d0e('0xd'),auth[_0x2d0e('0xe')](),controller[_0x2d0e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index aa9ce5e..73b46a6 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 _0x2af8=['sequelize','STRING','name'];(function(_0x1bf8cc,_0x118778){var _0x322d20=function(_0x36953d){while(--_0x36953d){_0x1bf8cc['push'](_0x1bf8cc['shift']());}};_0x322d20(++_0x118778);}(_0x2af8,0xf6));var _0x82af=function(_0x2871c2,_0xe4c551){_0x2871c2=_0x2871c2-0x0;var _0x279bac=_0x2af8[_0x2871c2];return _0x279bac;};'use strict';var Sequelize=require(_0x82af('0x0'));module['exports']={'name':{'type':Sequelize[_0x82af('0x1')],'unique':_0x82af('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd47f=['name','sequelize','STRING'];(function(_0x37974a,_0x2804cf){var _0x45fd4e=function(_0x33559d){while(--_0x33559d){_0x37974a['push'](_0x37974a['shift']());}};_0x45fd4e(++_0x2804cf);}(_0xd47f,0x1bd));var _0xfd47=function(_0x1d4923,_0x4e222f){_0x1d4923=_0x1d4923-0x0;var _0x14ea9a=_0xd47f[_0x1d4923];return _0x14ea9a;};'use strict';var Sequelize=require(_0xfd47('0x0'));module['exports']={'name':{'type':Sequelize[_0xfd47('0x1')],'unique':_0xfd47('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfd47('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index caf42f0..53a630e 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 _0xb7e8=['query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','apply','save','update','destroy','then','error','stack','name','map','MailSubstatus','rawAttributes','fieldName','type','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7e8,0xac));var _0x8b7e=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0xb7e8[_0x22eb96];return _0x5e1adf;};'use strict';var pdf=require(_0x8b7e('0x0'));var emlformat=require(_0x8b7e('0x1'));var rimraf=require(_0x8b7e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8b7e('0x3'));var rp=require(_0x8b7e('0x4'));var moment=require(_0x8b7e('0x5'));var BPromise=require(_0x8b7e('0x6'));var Mustache=require(_0x8b7e('0x7'));var util=require(_0x8b7e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8b7e('0x9'));var ejs=require(_0x8b7e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b7e('0xb'));var crypto=require(_0x8b7e('0xc'));var jsforce=require(_0x8b7e('0xd'));var deskjs=require(_0x8b7e('0xe'));var toCsv=require(_0x8b7e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b7e('0xf'));var authService=require(_0x8b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8b7e('0x11'));var hardwareService=require(_0x8b7e('0x12'));var logger=require(_0x8b7e('0x13'))(_0x8b7e('0x14'));var utils=require(_0x8b7e('0x15'));var config=require(_0x8b7e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x109849,_0x197393){_0x197393=_0x197393||0xcc;return function(_0x34e3cc){if(_0x34e3cc){return _0x109849['sendStatus'](_0x197393);}return _0x109849[_0x8b7e('0x17')](_0x197393)[_0x8b7e('0x18')]();};}function respondWithResult(_0x565c3b,_0x30be80){_0x30be80=_0x30be80||0xc8;return function(_0x124f9e){if(_0x124f9e){return _0x565c3b[_0x8b7e('0x17')](_0x30be80)[_0x8b7e('0x19')](_0x124f9e);}};}function respondWithFilteredResult(_0x558816,_0x4b03a2){return function(_0x593f19){if(_0x593f19){var _0x2c7cdf=_0x593f19[_0x8b7e('0x1a')],_0x2e6e35=_0x4b03a2[_0x8b7e('0x1b')],_0x1b7c77=_0x4b03a2[_0x8b7e('0x1b')]+_0x4b03a2[_0x8b7e('0x1c')],_0x3513a9;if(_0x1b7c77>=_0x2c7cdf){_0x1b7c77=_0x2c7cdf;_0x3513a9=0xc8;}else{_0x3513a9=0xce;}_0x558816[_0x8b7e('0x17')](_0x3513a9);return _0x558816[_0x8b7e('0x1d')]('Content-Range',_0x2e6e35+'-'+_0x1b7c77+'/'+_0x2c7cdf)['json'](_0x593f19);}return null;};}function patchUpdates(_0x20e61a){return function(_0x20199d){try{jsonpatch[_0x8b7e('0x1e')](_0x20199d,_0x20e61a,!![]);}catch(_0x28ed6d){return BPromise['reject'](_0x28ed6d);}return _0x20199d[_0x8b7e('0x1f')]();};}function saveUpdates(_0xd723ac,_0xaea893){return function(_0x5d289a){if(_0x5d289a){return _0x5d289a[_0x8b7e('0x20')](_0xd723ac)['then'](function(_0x30f247){return _0x30f247;});}return null;};}function removeEntity(_0x134c3,_0x1a1230){return function(_0x491c5b){if(_0x491c5b){return _0x491c5b[_0x8b7e('0x21')]()[_0x8b7e('0x22')](function(){_0x134c3[_0x8b7e('0x17')](0xcc)[_0x8b7e('0x18')]();});}};}function handleEntityNotFound(_0x4e26b6,_0x8def0f){return function(_0x235004){if(!_0x235004){_0x4e26b6['sendStatus'](0x194);}return _0x235004;};}function handleError(_0x5aed46,_0x2fe78a){_0x2fe78a=_0x2fe78a||0x1f4;return function(_0x53e462){logger[_0x8b7e('0x23')](_0x53e462[_0x8b7e('0x24')]);if(_0x53e462[_0x8b7e('0x25')]){delete _0x53e462['name'];}_0x5aed46[_0x8b7e('0x17')](_0x2fe78a)['send'](_0x53e462);};}exports['index']=function(_0x59e8aa,_0x50c136){var _0x219c63={},_0x5cb52d={},_0x1d1258={'count':0x0,'rows':[]};var _0xa59ae7=_[_0x8b7e('0x26')](db[_0x8b7e('0x27')][_0x8b7e('0x28')],function(_0x80167c){return{'name':_0x80167c[_0x8b7e('0x29')],'type':_0x80167c[_0x8b7e('0x2a')]['key']};});_0x5cb52d[_0x8b7e('0x2b')]=_[_0x8b7e('0x26')](_0xa59ae7,'name');_0x5cb52d[_0x8b7e('0x2c')]=_[_0x8b7e('0x2d')](_0x59e8aa[_0x8b7e('0x2c')]);_0x5cb52d['filters']=_['intersection'](_0x5cb52d[_0x8b7e('0x2b')],_0x5cb52d['query']);_0x219c63[_0x8b7e('0x2e')]=_[_0x8b7e('0x2f')](_0x5cb52d['model'],qs['fields'](_0x59e8aa['query'][_0x8b7e('0x30')]));_0x219c63['attributes']=_0x219c63['attributes'][_0x8b7e('0x31')]?_0x219c63[_0x8b7e('0x2e')]:_0x5cb52d[_0x8b7e('0x2b')];if(!_0x59e8aa[_0x8b7e('0x2c')][_0x8b7e('0x32')](_0x8b7e('0x33'))){_0x219c63[_0x8b7e('0x1c')]=qs[_0x8b7e('0x1c')](_0x59e8aa[_0x8b7e('0x2c')][_0x8b7e('0x1c')]);_0x219c63['offset']=qs['offset'](_0x59e8aa[_0x8b7e('0x2c')][_0x8b7e('0x1b')]);}_0x219c63[_0x8b7e('0x34')]=qs[_0x8b7e('0x35')](_0x59e8aa['query'][_0x8b7e('0x35')]);_0x219c63['where']=qs[_0x8b7e('0x36')](_[_0x8b7e('0x37')](_0x59e8aa[_0x8b7e('0x2c')],_0x5cb52d[_0x8b7e('0x36')]),_0xa59ae7);if(_0x59e8aa['query']['filter']){_0x219c63['where']=_['merge'](_0x219c63[_0x8b7e('0x38')],{'$or':_['map'](_0xa59ae7,function(_0x52349e){if(_0x52349e[_0x8b7e('0x2a')]!==_0x8b7e('0x39')){var _0x5dfea2={};_0x5dfea2[_0x52349e[_0x8b7e('0x25')]]={'$like':'%'+_0x59e8aa['query'][_0x8b7e('0x3a')]+'%'};return _0x5dfea2;}})});}_0x219c63=_[_0x8b7e('0x3b')]({},_0x219c63,_0x59e8aa[_0x8b7e('0x3c')]);var _0x3ca000={'where':_0x219c63[_0x8b7e('0x38')]};return db[_0x8b7e('0x27')][_0x8b7e('0x1a')](_0x3ca000)[_0x8b7e('0x22')](function(_0x10d51c){_0x1d1258[_0x8b7e('0x1a')]=_0x10d51c;if(_0x59e8aa['query'][_0x8b7e('0x3d')]){_0x219c63[_0x8b7e('0x3e')]=[{'all':!![]}];}return db[_0x8b7e('0x27')][_0x8b7e('0x3f')](_0x219c63);})[_0x8b7e('0x22')](function(_0x5ce086){_0x1d1258[_0x8b7e('0x40')]=_0x5ce086;return _0x1d1258;})[_0x8b7e('0x22')](respondWithFilteredResult(_0x50c136,_0x219c63))['catch'](handleError(_0x50c136,null));};exports[_0x8b7e('0x41')]=function(_0x5be921,_0x3e295d){var _0x59e567={'raw':!![],'where':{'id':_0x5be921[_0x8b7e('0x42')]['id']}},_0x1f0a03={};_0x1f0a03[_0x8b7e('0x2b')]=_[_0x8b7e('0x2d')](db[_0x8b7e('0x27')][_0x8b7e('0x28')]);_0x1f0a03[_0x8b7e('0x2c')]=_['keys'](_0x5be921[_0x8b7e('0x2c')]);_0x1f0a03[_0x8b7e('0x36')]=_[_0x8b7e('0x2f')](_0x1f0a03[_0x8b7e('0x2b')],_0x1f0a03[_0x8b7e('0x2c')]);_0x59e567[_0x8b7e('0x2e')]=_[_0x8b7e('0x2f')](_0x1f0a03[_0x8b7e('0x2b')],qs[_0x8b7e('0x30')](_0x5be921[_0x8b7e('0x2c')][_0x8b7e('0x30')]));_0x59e567[_0x8b7e('0x2e')]=_0x59e567['attributes'][_0x8b7e('0x31')]?_0x59e567[_0x8b7e('0x2e')]:_0x1f0a03[_0x8b7e('0x2b')];if(_0x5be921[_0x8b7e('0x2c')][_0x8b7e('0x3d')]){_0x59e567[_0x8b7e('0x3e')]=[{'all':!![]}];}_0x59e567=_[_0x8b7e('0x3b')]({},_0x59e567,_0x5be921[_0x8b7e('0x3c')]);return db[_0x8b7e('0x27')][_0x8b7e('0x43')](_0x59e567)[_0x8b7e('0x22')](handleEntityNotFound(_0x3e295d,null))['then'](respondWithResult(_0x3e295d,null))[_0x8b7e('0x44')](handleError(_0x3e295d,null));};exports[_0x8b7e('0x45')]=function(_0x5c03ef,_0x4157fa){return db[_0x8b7e('0x27')][_0x8b7e('0x45')](_0x5c03ef[_0x8b7e('0x46')],{})[_0x8b7e('0x22')](respondWithResult(_0x4157fa,0xc9))['catch'](handleError(_0x4157fa,null));};exports[_0x8b7e('0x20')]=function(_0x311d3c,_0x309f0c){if(_0x311d3c['body']['id']){delete _0x311d3c[_0x8b7e('0x46')]['id'];}return db[_0x8b7e('0x27')]['find']({'where':{'id':_0x311d3c[_0x8b7e('0x42')]['id']}})[_0x8b7e('0x22')](handleEntityNotFound(_0x309f0c,null))[_0x8b7e('0x22')](saveUpdates(_0x311d3c[_0x8b7e('0x46')],null))['then'](respondWithResult(_0x309f0c,null))[_0x8b7e('0x44')](handleError(_0x309f0c,null));};exports[_0x8b7e('0x21')]=function(_0x453d86,_0x130a91){return db['MailSubstatus'][_0x8b7e('0x43')]({'where':{'id':_0x453d86[_0x8b7e('0x42')]['id']}})[_0x8b7e('0x22')](handleEntityNotFound(_0x130a91,null))[_0x8b7e('0x22')](removeEntity(_0x130a91,null))[_0x8b7e('0x44')](handleError(_0x130a91,null));};exports[_0x8b7e('0x47')]=function(_0x301a3c,_0xdd9a72){return db[_0x8b7e('0x27')]['describe']()['then'](respondWithResult(_0xdd9a72,null))['catch'](handleError(_0xdd9a72,null));}; \ No newline at end of file +var _0xb401=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailSubstatus','includeAll','include','rows','show','find','catch','create','body','params','describe','html-pdf','request-promise','moment','bluebird','mustache','util','path','sox','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x52b48a,_0x4be672){var _0x234d06=function(_0x4c9e33){while(--_0x4c9e33){_0x52b48a['push'](_0x52b48a['shift']());}};_0x234d06(++_0x4be672);}(_0xb401,0x108));var _0x1b40=function(_0x481299,_0x43b7a1){_0x481299=_0x481299-0x0;var _0x380b8a=_0xb401[_0x481299];return _0x380b8a;};'use strict';var pdf=require(_0x1b40('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1b40('0x1'));var moment=require(_0x1b40('0x2'));var BPromise=require(_0x1b40('0x3'));var Mustache=require(_0x1b40('0x4'));var util=require(_0x1b40('0x5'));var path=require(_0x1b40('0x6'));var sox=require(_0x1b40('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b40('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1b40('0x9'));var toCsv=require(_0x1b40('0xa'));var querystring=require(_0x1b40('0xb'));var Papa=require(_0x1b40('0xc'));var Redis=require(_0x1b40('0xd'));var authService=require(_0x1b40('0xe'));var qs=require(_0x1b40('0xf'));var as=require(_0x1b40('0x10'));var hardwareService=require(_0x1b40('0x11'));var logger=require(_0x1b40('0x12'))(_0x1b40('0x13'));var utils=require('../../config/utils');var config=require(_0x1b40('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1b40('0x15'))['db'];function respondWithStatusCode(_0x443875,_0x2fb716){_0x2fb716=_0x2fb716||0xcc;return function(_0x380915){if(_0x380915){return _0x443875['sendStatus'](_0x2fb716);}return _0x443875[_0x1b40('0x16')](_0x2fb716)[_0x1b40('0x17')]();};}function respondWithResult(_0x2a32f6,_0x1733ed){_0x1733ed=_0x1733ed||0xc8;return function(_0x4acb54){if(_0x4acb54){return _0x2a32f6[_0x1b40('0x16')](_0x1733ed)[_0x1b40('0x18')](_0x4acb54);}};}function respondWithFilteredResult(_0x321568,_0xcf121c){return function(_0x377761){if(_0x377761){var _0x41d15f=_0x377761[_0x1b40('0x19')],_0x21cced=_0xcf121c['offset'],_0x30d28e=_0xcf121c[_0x1b40('0x1a')]+_0xcf121c[_0x1b40('0x1b')],_0x322a05;if(_0x30d28e>=_0x41d15f){_0x30d28e=_0x41d15f;_0x322a05=0xc8;}else{_0x322a05=0xce;}_0x321568[_0x1b40('0x16')](_0x322a05);return _0x321568[_0x1b40('0x1c')]('Content-Range',_0x21cced+'-'+_0x30d28e+'/'+_0x41d15f)[_0x1b40('0x18')](_0x377761);}return null;};}function patchUpdates(_0x5a9e44){return function(_0x5281df){try{jsonpatch[_0x1b40('0x1d')](_0x5281df,_0x5a9e44,!![]);}catch(_0xe55a45){return BPromise['reject'](_0xe55a45);}return _0x5281df['save']();};}function saveUpdates(_0x5ad99c,_0x376bdd){return function(_0x1e0600){if(_0x1e0600){return _0x1e0600['update'](_0x5ad99c)[_0x1b40('0x1e')](function(_0x13867){return _0x13867;});}return null;};}function removeEntity(_0x55f045,_0x21a6d4){return function(_0x22c9ec){if(_0x22c9ec){return _0x22c9ec[_0x1b40('0x1f')]()[_0x1b40('0x1e')](function(){_0x55f045['status'](0xcc)[_0x1b40('0x17')]();});}};}function handleEntityNotFound(_0x27f3f9,_0x55db95){return function(_0x262cc5){if(!_0x262cc5){_0x27f3f9[_0x1b40('0x20')](0x194);}return _0x262cc5;};}function handleError(_0x1b7bd4,_0x294da8){_0x294da8=_0x294da8||0x1f4;return function(_0x120a3f){logger[_0x1b40('0x21')](_0x120a3f['stack']);if(_0x120a3f[_0x1b40('0x22')]){delete _0x120a3f[_0x1b40('0x22')];}_0x1b7bd4[_0x1b40('0x16')](_0x294da8)[_0x1b40('0x23')](_0x120a3f);};}exports[_0x1b40('0x24')]=function(_0x18f8a2,_0x745cf6){var _0x217e2d={},_0x2786a5={},_0xa21c8c={'count':0x0,'rows':[]};var _0x2ae008=_[_0x1b40('0x25')](db['MailSubstatus'][_0x1b40('0x26')],function(_0x21cbc7){return{'name':_0x21cbc7[_0x1b40('0x27')],'type':_0x21cbc7[_0x1b40('0x28')][_0x1b40('0x29')]};});_0x2786a5['model']=_[_0x1b40('0x25')](_0x2ae008,_0x1b40('0x22'));_0x2786a5[_0x1b40('0x2a')]=_[_0x1b40('0x2b')](_0x18f8a2[_0x1b40('0x2a')]);_0x2786a5[_0x1b40('0x2c')]=_['intersection'](_0x2786a5[_0x1b40('0x2d')],_0x2786a5[_0x1b40('0x2a')]);_0x217e2d[_0x1b40('0x2e')]=_[_0x1b40('0x2f')](_0x2786a5[_0x1b40('0x2d')],qs[_0x1b40('0x30')](_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x30')]));_0x217e2d['attributes']=_0x217e2d[_0x1b40('0x2e')][_0x1b40('0x31')]?_0x217e2d['attributes']:_0x2786a5[_0x1b40('0x2d')];if(!_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x32')](_0x1b40('0x33'))){_0x217e2d[_0x1b40('0x1b')]=qs[_0x1b40('0x1b')](_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x1b')]);_0x217e2d[_0x1b40('0x1a')]=qs[_0x1b40('0x1a')](_0x18f8a2['query'][_0x1b40('0x1a')]);}_0x217e2d[_0x1b40('0x34')]=qs['sort'](_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x35')]);_0x217e2d[_0x1b40('0x36')]=qs[_0x1b40('0x2c')](_[_0x1b40('0x37')](_0x18f8a2['query'],_0x2786a5[_0x1b40('0x2c')]),_0x2ae008);if(_0x18f8a2['query'][_0x1b40('0x38')]){_0x217e2d[_0x1b40('0x36')]=_[_0x1b40('0x39')](_0x217e2d[_0x1b40('0x36')],{'$or':_[_0x1b40('0x25')](_0x2ae008,function(_0x4de175){if(_0x4de175[_0x1b40('0x28')]!==_0x1b40('0x3a')){var _0x4b2e99={};_0x4b2e99[_0x4de175[_0x1b40('0x22')]]={'$like':'%'+_0x18f8a2['query'][_0x1b40('0x38')]+'%'};return _0x4b2e99;}})});}_0x217e2d=_[_0x1b40('0x39')]({},_0x217e2d,_0x18f8a2['options']);var _0x1f0e74={'where':_0x217e2d[_0x1b40('0x36')]};return db[_0x1b40('0x3b')][_0x1b40('0x19')](_0x1f0e74)[_0x1b40('0x1e')](function(_0x10aa8f){_0xa21c8c[_0x1b40('0x19')]=_0x10aa8f;if(_0x18f8a2[_0x1b40('0x2a')][_0x1b40('0x3c')]){_0x217e2d[_0x1b40('0x3d')]=[{'all':!![]}];}return db[_0x1b40('0x3b')]['findAll'](_0x217e2d);})[_0x1b40('0x1e')](function(_0x2ffb1e){_0xa21c8c[_0x1b40('0x3e')]=_0x2ffb1e;return _0xa21c8c;})['then'](respondWithFilteredResult(_0x745cf6,_0x217e2d))['catch'](handleError(_0x745cf6,null));};exports[_0x1b40('0x3f')]=function(_0x4edbaf,_0x1f6dc7){var _0xe3fddd={'raw':!![],'where':{'id':_0x4edbaf['params']['id']}},_0x4a01c4={};_0x4a01c4['model']=_['keys'](db[_0x1b40('0x3b')][_0x1b40('0x26')]);_0x4a01c4[_0x1b40('0x2a')]=_[_0x1b40('0x2b')](_0x4edbaf['query']);_0x4a01c4[_0x1b40('0x2c')]=_['intersection'](_0x4a01c4[_0x1b40('0x2d')],_0x4a01c4[_0x1b40('0x2a')]);_0xe3fddd[_0x1b40('0x2e')]=_[_0x1b40('0x2f')](_0x4a01c4['model'],qs[_0x1b40('0x30')](_0x4edbaf['query'][_0x1b40('0x30')]));_0xe3fddd[_0x1b40('0x2e')]=_0xe3fddd['attributes']['length']?_0xe3fddd['attributes']:_0x4a01c4[_0x1b40('0x2d')];if(_0x4edbaf['query']['includeAll']){_0xe3fddd[_0x1b40('0x3d')]=[{'all':!![]}];}_0xe3fddd=_[_0x1b40('0x39')]({},_0xe3fddd,_0x4edbaf['options']);return db['MailSubstatus'][_0x1b40('0x40')](_0xe3fddd)[_0x1b40('0x1e')](handleEntityNotFound(_0x1f6dc7,null))['then'](respondWithResult(_0x1f6dc7,null))[_0x1b40('0x41')](handleError(_0x1f6dc7,null));};exports[_0x1b40('0x42')]=function(_0x282a50,_0x458ee4){return db['MailSubstatus'][_0x1b40('0x42')](_0x282a50[_0x1b40('0x43')],{})['then'](respondWithResult(_0x458ee4,0xc9))['catch'](handleError(_0x458ee4,null));};exports['update']=function(_0x4d9593,_0xb83e57){if(_0x4d9593['body']['id']){delete _0x4d9593[_0x1b40('0x43')]['id'];}return db[_0x1b40('0x3b')][_0x1b40('0x40')]({'where':{'id':_0x4d9593[_0x1b40('0x44')]['id']}})[_0x1b40('0x1e')](handleEntityNotFound(_0xb83e57,null))[_0x1b40('0x1e')](saveUpdates(_0x4d9593['body'],null))[_0x1b40('0x1e')](respondWithResult(_0xb83e57,null))['catch'](handleError(_0xb83e57,null));};exports[_0x1b40('0x1f')]=function(_0x4cf808,_0x21b4f0){return db[_0x1b40('0x3b')]['find']({'where':{'id':_0x4cf808[_0x1b40('0x44')]['id']}})[_0x1b40('0x1e')](handleEntityNotFound(_0x21b4f0,null))[_0x1b40('0x1e')](removeEntity(_0x21b4f0,null))[_0x1b40('0x41')](handleError(_0x21b4f0,null));};exports['describe']=function(_0x329ed2,_0x349943){return db['MailSubstatus'][_0x1b40('0x45')]()[_0x1b40('0x1e')](respondWithResult(_0x349943,null))[_0x1b40('0x41')](handleError(_0x349943,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f54c3fc..5fba6e5 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 _0xb574=['./mailSubstatus.attributes','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x22c726,_0x4aa141){var _0x55af64=function(_0x338a01){while(--_0x338a01){_0x22c726['push'](_0x22c726['shift']());}};_0x55af64(++_0x4aa141);}(_0xb574,0x106));var _0x4b57=function(_0x2759e2,_0x17fb16){_0x2759e2=_0x2759e2-0x0;var _0x51e4f3=_0xb574[_0x2759e2];return _0x51e4f3;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var logger=require('../../config/logger')(_0x4b57('0x2'));var moment=require(_0x4b57('0x3'));var BPromise=require('bluebird');var rp=require(_0x4b57('0x4'));var fs=require('fs');var path=require(_0x4b57('0x5'));var rimraf=require(_0x4b57('0x6'));var config=require(_0x4b57('0x7'));var attributes=require(_0x4b57('0x8'));module['exports']=function(_0x4eb019,_0x1c97e5){return _0x4eb019['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb35=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','util'];(function(_0x1f1467,_0x58c99c){var _0x5b92a3=function(_0x389999){while(--_0x389999){_0x1f1467['push'](_0x1f1467['shift']());}};_0x5b92a3(++_0x58c99c);}(_0xbb35,0x1d3));var _0x5bb3=function(_0x587119,_0x4e695a){_0x587119=_0x587119-0x0;var _0x2025dc=_0xbb35[_0x587119];return _0x2025dc;};'use strict';var _=require('lodash');var util=require(_0x5bb3('0x0'));var logger=require(_0x5bb3('0x1'))(_0x5bb3('0x2'));var moment=require(_0x5bb3('0x3'));var BPromise=require(_0x5bb3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb3('0x5'));var rimraf=require(_0x5bb3('0x6'));var config=require(_0x5bb3('0x7'));var attributes=require(_0x5bb3('0x8'));module[_0x5bb3('0x9')]=function(_0x321535,_0x46ef03){return _0x321535[_0x5bb3('0xa')](_0x5bb3('0xb'),attributes,{'tableName':'mail_substatuses','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 2a7cb5b..325339d 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 _0x1be1=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x1be1,0x192));var _0x11be=function(_0x442afc,_0x3a39ed){_0x442afc=_0x442afc-0x0;var _0x429932=_0x1be1[_0x442afc];return _0x429932;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});} \ No newline at end of file +var _0x6c76=['request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','MailSubstatus,\x20%s,\x20%s'];(function(_0x277b27,_0xa9ab46){var _0x4ecb25=function(_0x3969c6){while(--_0x3969c6){_0x277b27['push'](_0x277b27['shift']());}};_0x4ecb25(++_0xa9ab46);}(_0x6c76,0x184));var _0x66c7=function(_0x11daf2,_0x294aba){_0x11daf2=_0x11daf2-0x0;var _0xf9068d=_0x6c76[_0x11daf2];return _0xf9068d;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('MailSubstatus,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 4b2b0e5..d0dac8b 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 _0x0f75=['multer','path','Router','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0x0f75,0xa2));var _0x50f7=function(_0x300107,_0x4be4fe){_0x300107=_0x300107-0x0;var _0xb7ac2f=_0x0f75[_0x300107];return _0xb7ac2f;};'use strict';var multer=require(_0x50f7('0x0'));var util=require('util');var path=require(_0x50f7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x50f7('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x50f7('0x3'));var config=require('../../config/environment');var controller=require(_0x50f7('0x4'));router[_0x50f7('0x5')]('/',auth[_0x50f7('0x6')](),controller[_0x50f7('0x7')]);router[_0x50f7('0x5')]('/describe',auth[_0x50f7('0x6')](),controller[_0x50f7('0x8')]);router['get']('/:id',auth[_0x50f7('0x6')](),controller[_0x50f7('0x9')]);router[_0x50f7('0xa')]('/',auth['isAuthenticated'](),controller[_0x50f7('0xb')]);router[_0x50f7('0xc')]('/:id',auth[_0x50f7('0x6')](),controller[_0x50f7('0xd')]);router[_0x50f7('0xe')](_0x50f7('0xf'),auth[_0x50f7('0x6')](),controller[_0x50f7('0x10')]);module[_0x50f7('0x11')]=router; \ No newline at end of file +var _0xb3a1=['get','/describe','describe','/:id','show','post','isAuthenticated','put','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller'];(function(_0x2ef548,_0x3f534f){var _0x3b1cb9=function(_0x319457){while(--_0x319457){_0x2ef548['push'](_0x2ef548['shift']());}};_0x3b1cb9(++_0x3f534f);}(_0xb3a1,0xf5));var _0x1b3a=function(_0x3707d7,_0x16e3b2){_0x3707d7=_0x3707d7-0x0;var _0x20f06c=_0xb3a1[_0x3707d7];return _0x20f06c;};'use strict';var multer=require('multer');var util=require(_0x1b3a('0x0'));var path=require(_0x1b3a('0x1'));var timeout=require(_0x1b3a('0x2'));var express=require(_0x1b3a('0x3'));var router=express['Router']();var auth=require(_0x1b3a('0x4'));var interaction=require(_0x1b3a('0x5'));var config=require('../../config/environment');var controller=require(_0x1b3a('0x6'));router[_0x1b3a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1b3a('0x8'),auth['isAuthenticated'](),controller[_0x1b3a('0x9')]);router['get'](_0x1b3a('0xa'),auth['isAuthenticated'](),controller[_0x1b3a('0xb')]);router[_0x1b3a('0xc')]('/',auth[_0x1b3a('0xd')](),controller['create']);router[_0x1b3a('0xe')]('/:id',auth[_0x1b3a('0xd')](),controller[_0x1b3a('0xf')]);router['delete'](_0x1b3a('0xa'),auth[_0x1b3a('0xd')](),controller[_0x1b3a('0x10')]);module[_0x1b3a('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 3de9467..8502763 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 _0xdaf4=['ENUM','account','queue','NOW','moment','sequelize','exports','STRING'];(function(_0x5a6d88,_0x952684){var _0x58f931=function(_0x15f5d0){while(--_0x15f5d0){_0x5a6d88['push'](_0x5a6d88['shift']());}};_0x58f931(++_0x952684);}(_0xdaf4,0xec));var _0x4daf=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xdaf4[_0x344a3f];return _0x264712;};'use strict';var moment=require(_0x4daf('0x0'));var Sequelize=require(_0x4daf('0x1'));module[_0x4daf('0x2')]={'uniqueid':{'type':Sequelize[_0x4daf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x4daf('0x4')](_0x4daf('0x5'),'agent',_0x4daf('0x6')),'allowNull':![],'defaultValue':_0x4daf('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x4daf('0x7')]}}; \ No newline at end of file +var _0x407a=['queue','NOW','sequelize','exports','STRING','ENUM','agent'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x407a,0xbf));var _0xa407=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x407a[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0xa407('0x0'));module[_0xa407('0x1')]={'uniqueid':{'type':Sequelize[_0xa407('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa407('0x3')]('account',_0xa407('0x4'),_0xa407('0x5')),'allowNull':![],'defaultValue':_0xa407('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xa407('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0ad371e..8c533e3 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 _0x0426=['nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','then','sendStatus','error','stack','name','send','MailTransferReport','fieldName','key','model','map','query','filters','intersection','fields','attributes','length'];(function(_0x3ea705,_0x1d2a49){var _0x49d7c7=function(_0x2ab9b4){while(--_0x2ab9b4){_0x3ea705['push'](_0x3ea705['shift']());}};_0x49d7c7(++_0x1d2a49);}(_0x0426,0x188));var _0x6042=function(_0x3e5c88,_0x2548a5){_0x3e5c88=_0x3e5c88-0x0;var _0x4e0032=_0x0426[_0x3e5c88];return _0x4e0032;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6042('0x0'));var rimraf=require(_0x6042('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6042('0x2'));var rp=require(_0x6042('0x3'));var moment=require(_0x6042('0x4'));var BPromise=require(_0x6042('0x5'));var Mustache=require(_0x6042('0x6'));var util=require(_0x6042('0x7'));var path=require('path');var sox=require(_0x6042('0x8'));var csv=require(_0x6042('0x9'));var ejs=require(_0x6042('0xa'));var fs=require('fs');var _=require(_0x6042('0xb'));var squel=require(_0x6042('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6042('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6042('0xe'));var Papa=require(_0x6042('0xf'));var Redis=require(_0x6042('0x10'));var authService=require(_0x6042('0x11'));var qs=require(_0x6042('0x12'));var as=require(_0x6042('0x13'));var hardwareService=require(_0x6042('0x14'));var logger=require('../../config/logger')(_0x6042('0x15'));var utils=require(_0x6042('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6042('0x17'))['db'];function respondWithStatusCode(_0x536394,_0x1304f1){_0x1304f1=_0x1304f1||0xcc;return function(_0x3b77d6){if(_0x3b77d6){return _0x536394['sendStatus'](_0x1304f1);}return _0x536394[_0x6042('0x18')](_0x1304f1)[_0x6042('0x19')]();};}function respondWithResult(_0x3bebca,_0x4e5348){_0x4e5348=_0x4e5348||0xc8;return function(_0x3fce){if(_0x3fce){return _0x3bebca[_0x6042('0x18')](_0x4e5348)[_0x6042('0x1a')](_0x3fce);}};}function respondWithFilteredResult(_0xce7083,_0x5f27d7){return function(_0x5f4baf){if(_0x5f4baf){var _0x1eacfa=_0x5f4baf[_0x6042('0x1b')],_0x5ae454=_0x5f27d7[_0x6042('0x1c')],_0x25bd6f=_0x5f27d7[_0x6042('0x1c')]+_0x5f27d7[_0x6042('0x1d')],_0x500fd2;if(_0x25bd6f>=_0x1eacfa){_0x25bd6f=_0x1eacfa;_0x500fd2=0xc8;}else{_0x500fd2=0xce;}_0xce7083[_0x6042('0x18')](_0x500fd2);return _0xce7083[_0x6042('0x1e')](_0x6042('0x1f'),_0x5ae454+'-'+_0x25bd6f+'/'+_0x1eacfa)['json'](_0x5f4baf);}return null;};}function patchUpdates(_0x43f0d6){return function(_0x38630d){try{jsonpatch[_0x6042('0x20')](_0x38630d,_0x43f0d6,!![]);}catch(_0x503bbf){return BPromise['reject'](_0x503bbf);}return _0x38630d['save']();};}function saveUpdates(_0x579f82,_0x518cfd){return function(_0x3dbaa8){if(_0x3dbaa8){return _0x3dbaa8[_0x6042('0x21')](_0x579f82)['then'](function(_0x310bb8){return _0x310bb8;});}return null;};}function removeEntity(_0x56ac4c,_0x20f4f9){return function(_0x29696d){if(_0x29696d){return _0x29696d[_0x6042('0x22')]()[_0x6042('0x23')](function(){_0x56ac4c[_0x6042('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26e55b,_0x15173c){return function(_0x11291a){if(!_0x11291a){_0x26e55b[_0x6042('0x24')](0x194);}return _0x11291a;};}function handleError(_0x1e44fb,_0x13dcba){_0x13dcba=_0x13dcba||0x1f4;return function(_0x4426df){logger[_0x6042('0x25')](_0x4426df[_0x6042('0x26')]);if(_0x4426df[_0x6042('0x27')]){delete _0x4426df[_0x6042('0x27')];}_0x1e44fb['status'](_0x13dcba)[_0x6042('0x28')](_0x4426df);};}exports['index']=function(_0x33e4b2,_0x178216){var _0x37f8de={},_0x5a54f7={},_0x1799a2={'count':0x0,'rows':[]};var _0x50e37f=_['map'](db[_0x6042('0x29')]['rawAttributes'],function(_0xaf7ff0){return{'name':_0xaf7ff0[_0x6042('0x2a')],'type':_0xaf7ff0['type'][_0x6042('0x2b')]};});_0x5a54f7[_0x6042('0x2c')]=_[_0x6042('0x2d')](_0x50e37f,'name');_0x5a54f7[_0x6042('0x2e')]=_['keys'](_0x33e4b2[_0x6042('0x2e')]);_0x5a54f7[_0x6042('0x2f')]=_[_0x6042('0x30')](_0x5a54f7[_0x6042('0x2c')],_0x5a54f7[_0x6042('0x2e')]);_0x37f8de['attributes']=_[_0x6042('0x30')](_0x5a54f7[_0x6042('0x2c')],qs['fields'](_0x33e4b2[_0x6042('0x2e')][_0x6042('0x31')]));_0x37f8de[_0x6042('0x32')]=_0x37f8de[_0x6042('0x32')][_0x6042('0x33')]?_0x37f8de['attributes']:_0x5a54f7['model'];if(!_0x33e4b2[_0x6042('0x2e')]['hasOwnProperty'](_0x6042('0x34'))){_0x37f8de[_0x6042('0x1d')]=qs[_0x6042('0x1d')](_0x33e4b2['query'][_0x6042('0x1d')]);_0x37f8de[_0x6042('0x1c')]=qs[_0x6042('0x1c')](_0x33e4b2[_0x6042('0x2e')][_0x6042('0x1c')]);}_0x37f8de[_0x6042('0x35')]=qs[_0x6042('0x36')](_0x33e4b2[_0x6042('0x2e')]['sort']);_0x37f8de['where']=qs['filters'](_[_0x6042('0x37')](_0x33e4b2[_0x6042('0x2e')],_0x5a54f7[_0x6042('0x2f')]),_0x50e37f);if(_0x33e4b2[_0x6042('0x2e')][_0x6042('0x38')]){_0x37f8de['where']=_[_0x6042('0x39')](_0x37f8de[_0x6042('0x3a')],{'$or':_['map'](_0x50e37f,function(_0x58eda5){if(_0x58eda5['type']!==_0x6042('0x3b')){var _0x537c54={};_0x537c54[_0x58eda5[_0x6042('0x27')]]={'$like':'%'+_0x33e4b2[_0x6042('0x2e')][_0x6042('0x38')]+'%'};return _0x537c54;}})});}_0x37f8de=_['merge']({},_0x37f8de,_0x33e4b2[_0x6042('0x3c')]);var _0x18ae46={'where':_0x37f8de['where']};return db['MailTransferReport']['count'](_0x18ae46)[_0x6042('0x23')](function(_0x35a436){_0x1799a2['count']=_0x35a436;if(_0x33e4b2[_0x6042('0x2e')][_0x6042('0x3d')]){_0x37f8de[_0x6042('0x3e')]=[{'all':!![]}];}return db[_0x6042('0x29')][_0x6042('0x3f')](_0x37f8de);})[_0x6042('0x23')](function(_0x581f2a){_0x1799a2[_0x6042('0x40')]=_0x581f2a;return _0x1799a2;})['then'](respondWithFilteredResult(_0x178216,_0x37f8de))[_0x6042('0x41')](handleError(_0x178216,null));};exports[_0x6042('0x42')]=function(_0x384fe2,_0x307dfb){var _0x3e6d8f={'raw':!![],'where':{'id':_0x384fe2[_0x6042('0x43')]['id']}},_0x39b8fb={};_0x39b8fb[_0x6042('0x2c')]=_[_0x6042('0x44')](db[_0x6042('0x29')][_0x6042('0x45')]);_0x39b8fb[_0x6042('0x2e')]=_[_0x6042('0x44')](_0x384fe2[_0x6042('0x2e')]);_0x39b8fb['filters']=_[_0x6042('0x30')](_0x39b8fb[_0x6042('0x2c')],_0x39b8fb['query']);_0x3e6d8f['attributes']=_['intersection'](_0x39b8fb[_0x6042('0x2c')],qs['fields'](_0x384fe2['query'][_0x6042('0x31')]));_0x3e6d8f[_0x6042('0x32')]=_0x3e6d8f['attributes'][_0x6042('0x33')]?_0x3e6d8f[_0x6042('0x32')]:_0x39b8fb['model'];if(_0x384fe2[_0x6042('0x2e')][_0x6042('0x3d')]){_0x3e6d8f['include']=[{'all':!![]}];}_0x3e6d8f=_[_0x6042('0x39')]({},_0x3e6d8f,_0x384fe2[_0x6042('0x3c')]);return db[_0x6042('0x29')][_0x6042('0x46')](_0x3e6d8f)[_0x6042('0x23')](handleEntityNotFound(_0x307dfb,null))[_0x6042('0x23')](respondWithResult(_0x307dfb,null))['catch'](handleError(_0x307dfb,null));};exports[_0x6042('0x47')]=function(_0x15f2d5,_0x15fe30){return db['MailTransferReport'][_0x6042('0x47')](_0x15f2d5[_0x6042('0x48')],{})[_0x6042('0x23')](respondWithResult(_0x15fe30,0xc9))[_0x6042('0x41')](handleError(_0x15fe30,null));};exports[_0x6042('0x21')]=function(_0x517c42,_0x4ce6d3){if(_0x517c42[_0x6042('0x48')]['id']){delete _0x517c42['body']['id'];}return db[_0x6042('0x29')][_0x6042('0x46')]({'where':{'id':_0x517c42[_0x6042('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ce6d3,null))[_0x6042('0x23')](saveUpdates(_0x517c42[_0x6042('0x48')],null))[_0x6042('0x23')](respondWithResult(_0x4ce6d3,null))[_0x6042('0x41')](handleError(_0x4ce6d3,null));};exports[_0x6042('0x22')]=function(_0x5f3f2d,_0x239670){return db[_0x6042('0x29')][_0x6042('0x46')]({'where':{'id':_0x5f3f2d['params']['id']}})[_0x6042('0x23')](handleEntityNotFound(_0x239670,null))['then'](removeEntity(_0x239670,null))['catch'](handleError(_0x239670,null));};exports['describe']=function(_0x467b3c,_0x13e93d){return db[_0x6042('0x29')][_0x6042('0x49')]()[_0x6042('0x23')](respondWithResult(_0x13e93d,null))[_0x6042('0x41')](handleError(_0x13e93d,null));}; \ No newline at end of file +var _0x7ee0=['rows','catch','show','keys','includeAll','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','filter','MailTransferReport','include','findAll'];(function(_0x5aae34,_0x3342ad){var _0x128c35=function(_0x5b70e7){while(--_0x5b70e7){_0x5aae34['push'](_0x5aae34['shift']());}};_0x128c35(++_0x3342ad);}(_0x7ee0,0x123));var _0x07ee=function(_0x1b3156,_0x5d478a){_0x1b3156=_0x1b3156-0x0;var _0x3383f8=_0x7ee0[_0x1b3156];return _0x3383f8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x07ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07ee('0x1'));var jsonpatch=require(_0x07ee('0x2'));var rp=require(_0x07ee('0x3'));var moment=require(_0x07ee('0x4'));var BPromise=require(_0x07ee('0x5'));var Mustache=require(_0x07ee('0x6'));var util=require(_0x07ee('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x07ee('0x8'));var ejs=require(_0x07ee('0x9'));var fs=require('fs');var _=require(_0x07ee('0xa'));var squel=require(_0x07ee('0xb'));var crypto=require(_0x07ee('0xc'));var jsforce=require(_0x07ee('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x07ee('0x8'));var querystring=require(_0x07ee('0xe'));var Papa=require('papaparse');var Redis=require(_0x07ee('0xf'));var authService=require(_0x07ee('0x10'));var qs=require(_0x07ee('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x07ee('0x12'));var logger=require('../../config/logger')(_0x07ee('0x13'));var utils=require(_0x07ee('0x14'));var config=require(_0x07ee('0x15'));var licenseUtil=require(_0x07ee('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xae5172,_0x36d1bf){_0x36d1bf=_0x36d1bf||0xcc;return function(_0x17a46f){if(_0x17a46f){return _0xae5172[_0x07ee('0x17')](_0x36d1bf);}return _0xae5172['status'](_0x36d1bf)['end']();};}function respondWithResult(_0x3e9cb3,_0xb88eb1){_0xb88eb1=_0xb88eb1||0xc8;return function(_0x491624){if(_0x491624){return _0x3e9cb3[_0x07ee('0x18')](_0xb88eb1)[_0x07ee('0x19')](_0x491624);}};}function respondWithFilteredResult(_0x4b394e,_0x36c589){return function(_0x30ea8e){if(_0x30ea8e){var _0x88675e=_0x30ea8e[_0x07ee('0x1a')],_0x4ae67f=_0x36c589[_0x07ee('0x1b')],_0x16e0f4=_0x36c589[_0x07ee('0x1b')]+_0x36c589[_0x07ee('0x1c')],_0x4949b2;if(_0x16e0f4>=_0x88675e){_0x16e0f4=_0x88675e;_0x4949b2=0xc8;}else{_0x4949b2=0xce;}_0x4b394e[_0x07ee('0x18')](_0x4949b2);return _0x4b394e['set'](_0x07ee('0x1d'),_0x4ae67f+'-'+_0x16e0f4+'/'+_0x88675e)[_0x07ee('0x19')](_0x30ea8e);}return null;};}function patchUpdates(_0x1de8f2){return function(_0x225bb0){try{jsonpatch[_0x07ee('0x1e')](_0x225bb0,_0x1de8f2,!![]);}catch(_0x5c5ca2){return BPromise[_0x07ee('0x1f')](_0x5c5ca2);}return _0x225bb0['save']();};}function saveUpdates(_0x137d29,_0x318bbb){return function(_0x15013b){if(_0x15013b){return _0x15013b[_0x07ee('0x20')](_0x137d29)[_0x07ee('0x21')](function(_0xf249c){return _0xf249c;});}return null;};}function removeEntity(_0x3e3cf2,_0x5d29c2){return function(_0x4d40f4){if(_0x4d40f4){return _0x4d40f4[_0x07ee('0x22')]()[_0x07ee('0x21')](function(){_0x3e3cf2[_0x07ee('0x18')](0xcc)[_0x07ee('0x23')]();});}};}function handleEntityNotFound(_0x382cfb,_0x3058fa){return function(_0x40038d){if(!_0x40038d){_0x382cfb['sendStatus'](0x194);}return _0x40038d;};}function handleError(_0x42c5a4,_0x36b759){_0x36b759=_0x36b759||0x1f4;return function(_0x29d69b){logger[_0x07ee('0x24')](_0x29d69b[_0x07ee('0x25')]);if(_0x29d69b[_0x07ee('0x26')]){delete _0x29d69b[_0x07ee('0x26')];}_0x42c5a4[_0x07ee('0x18')](_0x36b759)['send'](_0x29d69b);};}exports['index']=function(_0x410cf1,_0x1ba2b2){var _0xe21fa4={},_0x2b1a35={},_0x5dfdf9={'count':0x0,'rows':[]};var _0x26d115=_[_0x07ee('0x27')](db['MailTransferReport'][_0x07ee('0x28')],function(_0x3ba927){return{'name':_0x3ba927['fieldName'],'type':_0x3ba927[_0x07ee('0x29')][_0x07ee('0x2a')]};});_0x2b1a35[_0x07ee('0x2b')]=_[_0x07ee('0x27')](_0x26d115,_0x07ee('0x26'));_0x2b1a35[_0x07ee('0x2c')]=_['keys'](_0x410cf1[_0x07ee('0x2c')]);_0x2b1a35[_0x07ee('0x2d')]=_[_0x07ee('0x2e')](_0x2b1a35[_0x07ee('0x2b')],_0x2b1a35[_0x07ee('0x2c')]);_0xe21fa4[_0x07ee('0x2f')]=_[_0x07ee('0x2e')](_0x2b1a35['model'],qs[_0x07ee('0x30')](_0x410cf1['query'][_0x07ee('0x30')]));_0xe21fa4[_0x07ee('0x2f')]=_0xe21fa4[_0x07ee('0x2f')][_0x07ee('0x31')]?_0xe21fa4[_0x07ee('0x2f')]:_0x2b1a35[_0x07ee('0x2b')];if(!_0x410cf1[_0x07ee('0x2c')]['hasOwnProperty'](_0x07ee('0x32'))){_0xe21fa4['limit']=qs[_0x07ee('0x1c')](_0x410cf1[_0x07ee('0x2c')][_0x07ee('0x1c')]);_0xe21fa4[_0x07ee('0x1b')]=qs[_0x07ee('0x1b')](_0x410cf1[_0x07ee('0x2c')]['offset']);}_0xe21fa4['order']=qs[_0x07ee('0x33')](_0x410cf1[_0x07ee('0x2c')][_0x07ee('0x33')]);_0xe21fa4[_0x07ee('0x34')]=qs['filters'](_[_0x07ee('0x35')](_0x410cf1[_0x07ee('0x2c')],_0x2b1a35[_0x07ee('0x2d')]),_0x26d115);if(_0x410cf1[_0x07ee('0x2c')]['filter']){_0xe21fa4['where']=_[_0x07ee('0x36')](_0xe21fa4[_0x07ee('0x34')],{'$or':_[_0x07ee('0x27')](_0x26d115,function(_0xaecb07){if(_0xaecb07[_0x07ee('0x29')]!=='VIRTUAL'){var _0x442819={};_0x442819[_0xaecb07[_0x07ee('0x26')]]={'$like':'%'+_0x410cf1[_0x07ee('0x2c')][_0x07ee('0x37')]+'%'};return _0x442819;}})});}_0xe21fa4=_[_0x07ee('0x36')]({},_0xe21fa4,_0x410cf1['options']);var _0x3b3305={'where':_0xe21fa4[_0x07ee('0x34')]};return db[_0x07ee('0x38')]['count'](_0x3b3305)[_0x07ee('0x21')](function(_0x4a5bae){_0x5dfdf9['count']=_0x4a5bae;if(_0x410cf1[_0x07ee('0x2c')]['includeAll']){_0xe21fa4[_0x07ee('0x39')]=[{'all':!![]}];}return db[_0x07ee('0x38')][_0x07ee('0x3a')](_0xe21fa4);})[_0x07ee('0x21')](function(_0x27d3b8){_0x5dfdf9[_0x07ee('0x3b')]=_0x27d3b8;return _0x5dfdf9;})[_0x07ee('0x21')](respondWithFilteredResult(_0x1ba2b2,_0xe21fa4))[_0x07ee('0x3c')](handleError(_0x1ba2b2,null));};exports[_0x07ee('0x3d')]=function(_0x140aa3,_0x289ccc){var _0x457a4b={'raw':!![],'where':{'id':_0x140aa3['params']['id']}},_0x218183={};_0x218183[_0x07ee('0x2b')]=_[_0x07ee('0x3e')](db[_0x07ee('0x38')][_0x07ee('0x28')]);_0x218183['query']=_[_0x07ee('0x3e')](_0x140aa3[_0x07ee('0x2c')]);_0x218183[_0x07ee('0x2d')]=_[_0x07ee('0x2e')](_0x218183[_0x07ee('0x2b')],_0x218183[_0x07ee('0x2c')]);_0x457a4b[_0x07ee('0x2f')]=_['intersection'](_0x218183[_0x07ee('0x2b')],qs[_0x07ee('0x30')](_0x140aa3[_0x07ee('0x2c')]['fields']));_0x457a4b['attributes']=_0x457a4b['attributes'][_0x07ee('0x31')]?_0x457a4b[_0x07ee('0x2f')]:_0x218183[_0x07ee('0x2b')];if(_0x140aa3[_0x07ee('0x2c')][_0x07ee('0x3f')]){_0x457a4b[_0x07ee('0x39')]=[{'all':!![]}];}_0x457a4b=_['merge']({},_0x457a4b,_0x140aa3[_0x07ee('0x40')]);return db[_0x07ee('0x38')][_0x07ee('0x41')](_0x457a4b)[_0x07ee('0x21')](handleEntityNotFound(_0x289ccc,null))[_0x07ee('0x21')](respondWithResult(_0x289ccc,null))['catch'](handleError(_0x289ccc,null));};exports['create']=function(_0x3d912c,_0x4e0e9b){return db[_0x07ee('0x38')][_0x07ee('0x42')](_0x3d912c[_0x07ee('0x43')],{})[_0x07ee('0x21')](respondWithResult(_0x4e0e9b,0xc9))[_0x07ee('0x3c')](handleError(_0x4e0e9b,null));};exports[_0x07ee('0x20')]=function(_0x1ae13b,_0x1eb407){if(_0x1ae13b[_0x07ee('0x43')]['id']){delete _0x1ae13b[_0x07ee('0x43')]['id'];}return db['MailTransferReport'][_0x07ee('0x41')]({'where':{'id':_0x1ae13b[_0x07ee('0x44')]['id']}})[_0x07ee('0x21')](handleEntityNotFound(_0x1eb407,null))[_0x07ee('0x21')](saveUpdates(_0x1ae13b[_0x07ee('0x43')],null))[_0x07ee('0x21')](respondWithResult(_0x1eb407,null))['catch'](handleError(_0x1eb407,null));};exports[_0x07ee('0x22')]=function(_0x4e5859,_0x1f13c3){return db[_0x07ee('0x38')][_0x07ee('0x41')]({'where':{'id':_0x4e5859[_0x07ee('0x44')]['id']}})[_0x07ee('0x21')](handleEntityNotFound(_0x1f13c3,null))[_0x07ee('0x21')](removeEntity(_0x1f13c3,null))[_0x07ee('0x3c')](handleError(_0x1f13c3,null));};exports[_0x07ee('0x45')]=function(_0x265844,_0xbc78ae){return db['MailTransferReport'][_0x07ee('0x45')]()[_0x07ee('0x21')](respondWithResult(_0xbc78ae,null))[_0x07ee('0x3c')](handleError(_0xbc78ae,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a952e3d..8379c6d 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 _0x6de7=['../../config/logger','moment','bluebird','request-promise','path','rimraf','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x518a85,_0x173400){var _0x2f9f93=function(_0x8d9863){while(--_0x8d9863){_0x518a85['push'](_0x518a85['shift']());}};_0x2f9f93(++_0x173400);}(_0x6de7,0xd6));var _0x76de=function(_0x24a82,_0x836580){_0x24a82=_0x24a82-0x0;var _0x37095d=_0x6de7[_0x24a82];return _0x37095d;};'use strict';var _=require(_0x76de('0x0'));var util=require(_0x76de('0x1'));var logger=require(_0x76de('0x2'))('api');var moment=require(_0x76de('0x3'));var BPromise=require(_0x76de('0x4'));var rp=require(_0x76de('0x5'));var fs=require('fs');var path=require(_0x76de('0x6'));var rimraf=require(_0x76de('0x7'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x3794d6,_0x1e4526){return _0x3794d6[_0x76de('0x8')](_0x76de('0x9'),attributes,{'tableName':_0x76de('0xa'),'paranoid':![],'indexes':[{'name':_0x76de('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x36b0=['lodash','../../config/logger','api','moment','request-promise','path','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x31a986,_0x622aaf){var _0x46d6ea=function(_0x286b37){while(--_0x286b37){_0x31a986['push'](_0x31a986['shift']());}};_0x46d6ea(++_0x622aaf);}(_0x36b0,0x117));var _0x036b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x36b0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x036b('0x0'));var util=require('util');var logger=require(_0x036b('0x1'))(_0x036b('0x2'));var moment=require(_0x036b('0x3'));var BPromise=require('bluebird');var rp=require(_0x036b('0x4'));var fs=require('fs');var path=require(_0x036b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0xe2ab0e,_0x5a1fe2){return _0xe2ab0e['define'](_0x036b('0x6'),attributes,{'tableName':_0x036b('0x7'),'paranoid':![],'indexes':[{'name':_0x036b('0x8'),'fields':[_0x036b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 93a6e2e..e555c2e 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 _0xd000=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3cda26,_0x31a42a){var _0x45469f=function(_0x27a69d){while(--_0x27a69d){_0x3cda26['push'](_0x3cda26['shift']());}};_0x45469f(++_0x31a42a);}(_0xd000,0x1b7));var _0x0d00=function(_0x15006a,_0x189944){_0x15006a=_0x15006a-0x0;var _0x2e35f3=_0xd000[_0x15006a];return _0x2e35f3;};'use strict';var _=require(_0x0d00('0x0'));var util=require('util');var moment=require(_0x0d00('0x1'));var BPromise=require(_0x0d00('0x2'));var rs=require(_0x0d00('0x3'));var fs=require('fs');var Redis=require(_0x0d00('0x4'));var db=require(_0x0d00('0x5'))['db'];var utils=require(_0x0d00('0x6'));var logger=require(_0x0d00('0x7'))(_0x0d00('0x8'));var config=require(_0x0d00('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0d00('0xa')][_0x0d00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x154c2d,_0x3ed51,_0x510bd1){return new BPromise(function(_0x2601cc,_0x270460){return client[_0x0d00('0xc')](_0x154c2d,_0x510bd1)[_0x0d00('0xd')](function(_0x53789c){logger[_0x0d00('0xe')](_0x0d00('0xf'),_0x3ed51,'request\x20sent');logger[_0x0d00('0x10')](_0x0d00('0x11'),_0x3ed51,_0x0d00('0x12'),JSON[_0x0d00('0x13')](_0x53789c));if(_0x53789c[_0x0d00('0x14')]){if(_0x53789c[_0x0d00('0x14')]['code']===0x1f4){logger['error'](_0x0d00('0xf'),_0x3ed51,_0x53789c[_0x0d00('0x14')]['message']);return _0x270460(_0x53789c[_0x0d00('0x14')][_0x0d00('0x15')]);}logger[_0x0d00('0x14')](_0x0d00('0xf'),_0x3ed51,_0x53789c['error'][_0x0d00('0x15')]);return _0x2601cc(_0x53789c['error'][_0x0d00('0x15')]);}else{logger[_0x0d00('0xe')](_0x0d00('0xf'),_0x3ed51,_0x0d00('0x12'));_0x2601cc(_0x53789c[_0x0d00('0x16')][_0x0d00('0x15')]);}})['catch'](function(_0x1be0c7){logger[_0x0d00('0x14')](_0x0d00('0xf'),_0x3ed51,_0x1be0c7);_0x270460(_0x1be0c7);});});} \ No newline at end of file +var _0xfc74=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x2434d7,_0x153841){var _0x410458=function(_0x3000e0){while(--_0x3000e0){_0x2434d7['push'](_0x2434d7['shift']());}};_0x410458(++_0x153841);}(_0xfc74,0x136));var _0x4fc7=function(_0x209992,_0x5d79c9){_0x209992=_0x209992-0x0;var _0x1264a2=_0xfc74[_0x209992];return _0x1264a2;};'use strict';var _=require(_0x4fc7('0x0'));var util=require('util');var moment=require(_0x4fc7('0x1'));var BPromise=require(_0x4fc7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fc7('0x3'));var db=require(_0x4fc7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4fc7('0x5'))(_0x4fc7('0x6'));var config=require(_0x4fc7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4602c8,_0x5c0c14,_0x19e711){return new BPromise(function(_0x424a80,_0x2dbbe1){return client[_0x4fc7('0x8')](_0x4602c8,_0x19e711)[_0x4fc7('0x9')](function(_0x59fdeb){logger[_0x4fc7('0xa')](_0x4fc7('0xb'),_0x5c0c14,_0x4fc7('0xc'));logger[_0x4fc7('0xd')](_0x4fc7('0xe'),_0x5c0c14,_0x4fc7('0xc'),JSON[_0x4fc7('0xf')](_0x59fdeb));if(_0x59fdeb[_0x4fc7('0x10')]){if(_0x59fdeb['error']['code']===0x1f4){logger[_0x4fc7('0x10')](_0x4fc7('0xb'),_0x5c0c14,_0x59fdeb['error'][_0x4fc7('0x11')]);return _0x2dbbe1(_0x59fdeb[_0x4fc7('0x10')]['message']);}logger[_0x4fc7('0x10')](_0x4fc7('0xb'),_0x5c0c14,_0x59fdeb[_0x4fc7('0x10')][_0x4fc7('0x11')]);return _0x424a80(_0x59fdeb[_0x4fc7('0x10')][_0x4fc7('0x11')]);}else{logger[_0x4fc7('0xa')](_0x4fc7('0xb'),_0x5c0c14,_0x4fc7('0xc'));_0x424a80(_0x59fdeb[_0x4fc7('0x12')][_0x4fc7('0x11')]);}})[_0x4fc7('0x13')](function(_0x4ec4ae){logger[_0x4fc7('0x10')](_0x4fc7('0xb'),_0x5c0c14,_0x4ec4ae);_0x2dbbe1(_0x4ec4ae);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index dbd9f88..226e68e 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 _0x3a1e=['create','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a1e,0x191));var _0xe3a1=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x3a1e[_0x43b584];return _0x48f27b;};'use strict';var multer=require('multer');var util=require(_0xe3a1('0x0'));var path=require(_0xe3a1('0x1'));var timeout=require(_0xe3a1('0x2'));var express=require(_0xe3a1('0x3'));var router=express[_0xe3a1('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe3a1('0x5'));var config=require(_0xe3a1('0x6'));var controller=require('./memberReport.controller');router[_0xe3a1('0x7')]('/',auth[_0xe3a1('0x8')](),controller['index']);router[_0xe3a1('0x7')](_0xe3a1('0x9'),auth[_0xe3a1('0x8')](),controller[_0xe3a1('0xa')]);router[_0xe3a1('0x7')]('/:id',auth[_0xe3a1('0x8')](),controller[_0xe3a1('0xb')]);router[_0xe3a1('0xc')]('/',auth[_0xe3a1('0x8')](),controller[_0xe3a1('0xd')]);router['put'](_0xe3a1('0xe'),auth[_0xe3a1('0x8')](),controller[_0xe3a1('0xf')]);router['delete'](_0xe3a1('0xe'),auth[_0xe3a1('0x8')](),controller[_0xe3a1('0x10')]);module[_0xe3a1('0x11')]=router; \ No newline at end of file +var _0xbca6=['/:id','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./memberReport.controller','index','get','/describe','isAuthenticated','describe','create','put'];(function(_0x3f04d4,_0x148990){var _0x318e65=function(_0x3535ad){while(--_0x3535ad){_0x3f04d4['push'](_0x3f04d4['shift']());}};_0x318e65(++_0x148990);}(_0xbca6,0xfb));var _0x6bca=function(_0x3231fd,_0x3995aa){_0x3231fd=_0x3231fd-0x0;var _0xb07fa4=_0xbca6[_0x3231fd];return _0xb07fa4;};'use strict';var multer=require(_0x6bca('0x0'));var util=require(_0x6bca('0x1'));var path=require(_0x6bca('0x2'));var timeout=require('connect-timeout');var express=require(_0x6bca('0x3'));var router=express[_0x6bca('0x4')]();var auth=require(_0x6bca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6bca('0x6'));var controller=require(_0x6bca('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6bca('0x8')]);router[_0x6bca('0x9')](_0x6bca('0xa'),auth[_0x6bca('0xb')](),controller[_0x6bca('0xc')]);router[_0x6bca('0x9')]('/:id',auth[_0x6bca('0xb')](),controller['show']);router['post']('/',auth[_0x6bca('0xb')](),controller[_0x6bca('0xd')]);router[_0x6bca('0xe')](_0x6bca('0xf'),auth[_0x6bca('0xb')](),controller[_0x6bca('0x10')]);router['delete']('/:id',auth[_0x6bca('0xb')](),controller[_0x6bca('0x11')]);module[_0x6bca('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 bed033b..5020f71 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 _0xea09=['exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','INTEGER'];(function(_0x10ce62,_0x18e8e4){var _0x337b44=function(_0x54f339){while(--_0x54f339){_0x10ce62['push'](_0x10ce62['shift']());}};_0x337b44(++_0x18e8e4);}(_0xea09,0xd0));var _0x9ea0=function(_0x399630,_0xc8ff40){_0x399630=_0x399630-0x0;var _0x541a0f=_0xea09[_0x399630];return _0x541a0f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x9ea0('0x0')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9ea0('0x1')],'defaultValue':_0x9ea0('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x9ea0('0x3')]},'exitAt':{'type':Sequelize[_0x9ea0('0x3')],'set':function(_0x53dd70){var _0x37dd11=moment(_0x53dd70);var _0x1e2eb1=moment(this[_0x9ea0('0x4')](_0x9ea0('0x5')));var _0xc4f0f3=_0x37dd11[_0x9ea0('0x6')](_0x1e2eb1,_0x9ea0('0x7'));this[_0x9ea0('0x8')]('exitAt',_0x53dd70);this[_0x9ea0('0x8')](_0x9ea0('0x9'),_0xc4f0f3||null);}},'data1':{'type':Sequelize[_0x9ea0('0x1')],'comment':_0x9ea0('0xa')},'data2':{'type':Sequelize[_0x9ea0('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x9ea0('0x1')],'comment':_0x9ea0('0xb')},'data4':{'type':Sequelize[_0x9ea0('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x9ea0('0x1')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x9ea0('0xc')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x296d=['STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports'];(function(_0x45b89e,_0x426d42){var _0x1fdb9a=function(_0xd62d53){while(--_0xd62d53){_0x45b89e['push'](_0x45b89e['shift']());}};_0x1fdb9a(++_0x426d42);}(_0x296d,0x1d9));var _0xd296=function(_0x18cf74,_0x1b6eb6){_0x18cf74=_0x18cf74-0x0;var _0x2f6f1f=_0x296d[_0x18cf74];return _0x2f6f1f;};'use strict';var Sequelize=require(_0xd296('0x0'));var moment=require(_0xd296('0x1'));module[_0xd296('0x2')]={'channel':{'type':Sequelize[_0xd296('0x3')]},'membername':{'type':Sequelize[_0xd296('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd296('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xd296('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xd296('0x5')]},'exitAt':{'type':Sequelize[_0xd296('0x5')],'set':function(_0x40b0c4){var _0x206849=moment(_0x40b0c4);var _0x5d8f14=moment(this[_0xd296('0x6')](_0xd296('0x7')));var _0x5b3f75=_0x206849['diff'](_0x5d8f14,'seconds');this['setDataValue'](_0xd296('0x8'),_0x40b0c4);this[_0xd296('0x9')](_0xd296('0xa'),_0x5b3f75||null);}},'data1':{'type':Sequelize[_0xd296('0x3')],'comment':_0xd296('0xb')},'data2':{'type':Sequelize['STRING'],'comment':_0xd296('0xc')},'data3':{'type':Sequelize[_0xd296('0x3')],'comment':_0xd296('0xd')},'data4':{'type':Sequelize[_0xd296('0x3')],'comment':_0xd296('0xe')},'data5':{'type':Sequelize[_0xd296('0x3')],'comment':_0xd296('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xd296('0x10')]},'uniqueid':{'type':Sequelize[_0xd296('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b686645..f9fbbad 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 _0xcbd3=['mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','Content-Range','json','apply','save','update','then','destroy','name','index','map','MemberReport','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x25bea7,_0x49ab45){var _0x175952=function(_0x56a0b5){while(--_0x56a0b5){_0x25bea7['push'](_0x25bea7['shift']());}};_0x175952(++_0x49ab45);}(_0xcbd3,0x1e2));var _0x3cbd=function(_0x4a5f20,_0x13dbc7){_0x4a5f20=_0x4a5f20-0x0;var _0x4e076b=_0xcbd3[_0x4a5f20];return _0x4e076b;};'use strict';var pdf=require(_0x3cbd('0x0'));var emlformat=require(_0x3cbd('0x1'));var rimraf=require(_0x3cbd('0x2'));var zipdir=require(_0x3cbd('0x3'));var jsonpatch=require(_0x3cbd('0x4'));var rp=require(_0x3cbd('0x5'));var moment=require(_0x3cbd('0x6'));var BPromise=require(_0x3cbd('0x7'));var Mustache=require(_0x3cbd('0x8'));var util=require(_0x3cbd('0x9'));var path=require(_0x3cbd('0xa'));var sox=require(_0x3cbd('0xb'));var csv=require(_0x3cbd('0xc'));var ejs=require(_0x3cbd('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3cbd('0xe'));var crypto=require('crypto');var jsforce=require(_0x3cbd('0xf'));var deskjs=require(_0x3cbd('0x10'));var toCsv=require(_0x3cbd('0xc'));var querystring=require(_0x3cbd('0x11'));var Papa=require(_0x3cbd('0x12'));var Redis=require(_0x3cbd('0x13'));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(_0x3cbd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x3cbd('0x15'));var licenseUtil=require(_0x3cbd('0x16'));var db=require(_0x3cbd('0x17'))['db'];function respondWithStatusCode(_0x1fc971,_0x388b87){_0x388b87=_0x388b87||0xcc;return function(_0x87f3d7){if(_0x87f3d7){return _0x1fc971[_0x3cbd('0x18')](_0x388b87);}return _0x1fc971['status'](_0x388b87)[_0x3cbd('0x19')]();};}function respondWithResult(_0x1fcf89,_0x49f3ea){_0x49f3ea=_0x49f3ea||0xc8;return function(_0x38a24d){if(_0x38a24d){return _0x1fcf89['status'](_0x49f3ea)['json'](_0x38a24d);}};}function respondWithFilteredResult(_0x19a939,_0x18911e){return function(_0x237629){if(_0x237629){var _0x28ba3a=_0x237629[_0x3cbd('0x1a')],_0x1b9c4f=_0x18911e[_0x3cbd('0x1b')],_0x467066=_0x18911e[_0x3cbd('0x1b')]+_0x18911e['limit'],_0x5be208;if(_0x467066>=_0x28ba3a){_0x467066=_0x28ba3a;_0x5be208=0xc8;}else{_0x5be208=0xce;}_0x19a939['status'](_0x5be208);return _0x19a939['set'](_0x3cbd('0x1c'),_0x1b9c4f+'-'+_0x467066+'/'+_0x28ba3a)[_0x3cbd('0x1d')](_0x237629);}return null;};}function patchUpdates(_0x43996e){return function(_0x20a763){try{jsonpatch[_0x3cbd('0x1e')](_0x20a763,_0x43996e,!![]);}catch(_0x20d31c){return BPromise['reject'](_0x20d31c);}return _0x20a763[_0x3cbd('0x1f')]();};}function saveUpdates(_0x450108,_0x547ce1){return function(_0x5f41a4){if(_0x5f41a4){return _0x5f41a4[_0x3cbd('0x20')](_0x450108)[_0x3cbd('0x21')](function(_0x24a9db){return _0x24a9db;});}return null;};}function removeEntity(_0x70111b,_0x4eb146){return function(_0xcf6897){if(_0xcf6897){return _0xcf6897[_0x3cbd('0x22')]()['then'](function(){_0x70111b['status'](0xcc)[_0x3cbd('0x19')]();});}};}function handleEntityNotFound(_0x55b8dd,_0xeaff4d){return function(_0x2e3e07){if(!_0x2e3e07){_0x55b8dd['sendStatus'](0x194);}return _0x2e3e07;};}function handleError(_0x2a198d,_0x47cbf6){_0x47cbf6=_0x47cbf6||0x1f4;return function(_0x352ca9){logger['error'](_0x352ca9['stack']);if(_0x352ca9[_0x3cbd('0x23')]){delete _0x352ca9[_0x3cbd('0x23')];}_0x2a198d['status'](_0x47cbf6)['send'](_0x352ca9);};}exports[_0x3cbd('0x24')]=function(_0x4432ce,_0x2c9a8b){var _0x49681a={},_0x466806={},_0x15ed97={'count':0x0,'rows':[]};var _0x289af3=_[_0x3cbd('0x25')](db[_0x3cbd('0x26')]['rawAttributes'],function(_0x276424){return{'name':_0x276424[_0x3cbd('0x27')],'type':_0x276424[_0x3cbd('0x28')]['key']};});_0x466806[_0x3cbd('0x29')]=_[_0x3cbd('0x25')](_0x289af3,_0x3cbd('0x23'));_0x466806[_0x3cbd('0x2a')]=_['keys'](_0x4432ce[_0x3cbd('0x2a')]);_0x466806[_0x3cbd('0x2b')]=_[_0x3cbd('0x2c')](_0x466806['model'],_0x466806[_0x3cbd('0x2a')]);_0x49681a[_0x3cbd('0x2d')]=_['intersection'](_0x466806['model'],qs[_0x3cbd('0x2e')](_0x4432ce[_0x3cbd('0x2a')]['fields']));_0x49681a[_0x3cbd('0x2d')]=_0x49681a[_0x3cbd('0x2d')][_0x3cbd('0x2f')]?_0x49681a[_0x3cbd('0x2d')]:_0x466806[_0x3cbd('0x29')];if(!_0x4432ce['query'][_0x3cbd('0x30')](_0x3cbd('0x31'))){_0x49681a['limit']=qs[_0x3cbd('0x32')](_0x4432ce[_0x3cbd('0x2a')][_0x3cbd('0x32')]);_0x49681a[_0x3cbd('0x1b')]=qs[_0x3cbd('0x1b')](_0x4432ce['query'][_0x3cbd('0x1b')]);}_0x49681a[_0x3cbd('0x33')]=qs['sort'](_0x4432ce['query'][_0x3cbd('0x34')]);_0x49681a[_0x3cbd('0x35')]=qs['filters'](_['pick'](_0x4432ce[_0x3cbd('0x2a')],_0x466806['filters']),_0x289af3);if(_0x4432ce[_0x3cbd('0x2a')][_0x3cbd('0x36')]){_0x49681a[_0x3cbd('0x35')]=_[_0x3cbd('0x37')](_0x49681a[_0x3cbd('0x35')],{'$or':_[_0x3cbd('0x25')](_0x289af3,function(_0x2318aa){if(_0x2318aa['type']!==_0x3cbd('0x38')){var _0x252856={};_0x252856[_0x2318aa[_0x3cbd('0x23')]]={'$like':'%'+_0x4432ce['query'][_0x3cbd('0x36')]+'%'};return _0x252856;}})});}_0x49681a=_['merge']({},_0x49681a,_0x4432ce[_0x3cbd('0x39')]);var _0x1209b0={'where':_0x49681a[_0x3cbd('0x35')]};return db[_0x3cbd('0x26')][_0x3cbd('0x1a')](_0x1209b0)[_0x3cbd('0x21')](function(_0x240b12){_0x15ed97[_0x3cbd('0x1a')]=_0x240b12;if(_0x4432ce[_0x3cbd('0x2a')]['includeAll']){_0x49681a[_0x3cbd('0x3a')]=[{'all':!![]}];}return db[_0x3cbd('0x26')][_0x3cbd('0x3b')](_0x49681a);})[_0x3cbd('0x21')](function(_0x5b7f66){_0x15ed97[_0x3cbd('0x3c')]=_0x5b7f66;return _0x15ed97;})[_0x3cbd('0x21')](respondWithFilteredResult(_0x2c9a8b,_0x49681a))[_0x3cbd('0x3d')](handleError(_0x2c9a8b,null));};exports['show']=function(_0x53db3f,_0x1dbdc6){var _0x2fe969={'raw':!![],'where':{'id':_0x53db3f[_0x3cbd('0x3e')]['id']}},_0x25e1bc={};_0x25e1bc[_0x3cbd('0x29')]=_[_0x3cbd('0x3f')](db['MemberReport'][_0x3cbd('0x40')]);_0x25e1bc[_0x3cbd('0x2a')]=_[_0x3cbd('0x3f')](_0x53db3f[_0x3cbd('0x2a')]);_0x25e1bc[_0x3cbd('0x2b')]=_[_0x3cbd('0x2c')](_0x25e1bc[_0x3cbd('0x29')],_0x25e1bc[_0x3cbd('0x2a')]);_0x2fe969[_0x3cbd('0x2d')]=_[_0x3cbd('0x2c')](_0x25e1bc[_0x3cbd('0x29')],qs['fields'](_0x53db3f[_0x3cbd('0x2a')][_0x3cbd('0x2e')]));_0x2fe969['attributes']=_0x2fe969['attributes'][_0x3cbd('0x2f')]?_0x2fe969[_0x3cbd('0x2d')]:_0x25e1bc['model'];if(_0x53db3f['query'][_0x3cbd('0x41')]){_0x2fe969[_0x3cbd('0x3a')]=[{'all':!![]}];}_0x2fe969=_[_0x3cbd('0x37')]({},_0x2fe969,_0x53db3f[_0x3cbd('0x39')]);return db['MemberReport'][_0x3cbd('0x42')](_0x2fe969)[_0x3cbd('0x21')](handleEntityNotFound(_0x1dbdc6,null))[_0x3cbd('0x21')](respondWithResult(_0x1dbdc6,null))[_0x3cbd('0x3d')](handleError(_0x1dbdc6,null));};exports[_0x3cbd('0x43')]=function(_0xd1c6be,_0x339b02){return db[_0x3cbd('0x26')]['create'](_0xd1c6be[_0x3cbd('0x44')],{})[_0x3cbd('0x21')](respondWithResult(_0x339b02,0xc9))[_0x3cbd('0x3d')](handleError(_0x339b02,null));};exports[_0x3cbd('0x20')]=function(_0x5ceb0b,_0x3565d6){if(_0x5ceb0b['body']['id']){delete _0x5ceb0b['body']['id'];}return db[_0x3cbd('0x26')][_0x3cbd('0x42')]({'where':{'id':_0x5ceb0b['params']['id']}})['then'](handleEntityNotFound(_0x3565d6,null))[_0x3cbd('0x21')](saveUpdates(_0x5ceb0b[_0x3cbd('0x44')],null))[_0x3cbd('0x21')](respondWithResult(_0x3565d6,null))[_0x3cbd('0x3d')](handleError(_0x3565d6,null));};exports[_0x3cbd('0x22')]=function(_0x3109fb,_0x19b6e8){return db[_0x3cbd('0x26')][_0x3cbd('0x42')]({'where':{'id':_0x3109fb[_0x3cbd('0x3e')]['id']}})[_0x3cbd('0x21')](handleEntityNotFound(_0x19b6e8,null))[_0x3cbd('0x21')](removeEntity(_0x19b6e8,null))[_0x3cbd('0x3d')](handleError(_0x19b6e8,null));};exports[_0x3cbd('0x45')]=function(_0x32e62b,_0x1bf588){return db[_0x3cbd('0x26')][_0x3cbd('0x45')]()[_0x3cbd('0x21')](respondWithResult(_0x1bf588,null))['catch'](handleError(_0x1bf588,null));}; \ No newline at end of file +var _0x079d=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','options','includeAll','MemberReport','rows','show','find','catch','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x225d18,_0xf43acc){var _0x16d093=function(_0x2ef4eb){while(--_0x2ef4eb){_0x225d18['push'](_0x225d18['shift']());}};_0x16d093(++_0xf43acc);}(_0x079d,0x162));var _0xd079=function(_0x43f78e,_0x2a2f63){_0x43f78e=_0x43f78e-0x0;var _0x45b6a5=_0x079d[_0x43f78e];return _0x45b6a5;};'use strict';var pdf=require(_0xd079('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd079('0x1'));var zipdir=require(_0xd079('0x2'));var jsonpatch=require(_0xd079('0x3'));var rp=require(_0xd079('0x4'));var moment=require(_0xd079('0x5'));var BPromise=require(_0xd079('0x6'));var Mustache=require(_0xd079('0x7'));var util=require(_0xd079('0x8'));var path=require(_0xd079('0x9'));var sox=require(_0xd079('0xa'));var csv=require(_0xd079('0xb'));var ejs=require(_0xd079('0xc'));var fs=require('fs');var _=require(_0xd079('0xd'));var squel=require(_0xd079('0xe'));var crypto=require(_0xd079('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd079('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd079('0x11'));var Papa=require(_0xd079('0x12'));var Redis=require(_0xd079('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd079('0x14'));var hardwareService=require(_0xd079('0x15'));var logger=require(_0xd079('0x16'))('api');var utils=require(_0xd079('0x17'));var config=require(_0xd079('0x18'));var licenseUtil=require(_0xd079('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59b682,_0x3401da){_0x3401da=_0x3401da||0xcc;return function(_0x3e212e){if(_0x3e212e){return _0x59b682[_0xd079('0x1a')](_0x3401da);}return _0x59b682[_0xd079('0x1b')](_0x3401da)['end']();};}function respondWithResult(_0x11b7f7,_0x227b33){_0x227b33=_0x227b33||0xc8;return function(_0x3554ca){if(_0x3554ca){return _0x11b7f7[_0xd079('0x1b')](_0x227b33)[_0xd079('0x1c')](_0x3554ca);}};}function respondWithFilteredResult(_0x51431e,_0x33a250){return function(_0x2bc309){if(_0x2bc309){var _0x4ede61=_0x2bc309[_0xd079('0x1d')],_0x5b7176=_0x33a250['offset'],_0x379982=_0x33a250[_0xd079('0x1e')]+_0x33a250[_0xd079('0x1f')],_0x4aeeda;if(_0x379982>=_0x4ede61){_0x379982=_0x4ede61;_0x4aeeda=0xc8;}else{_0x4aeeda=0xce;}_0x51431e[_0xd079('0x1b')](_0x4aeeda);return _0x51431e['set'](_0xd079('0x20'),_0x5b7176+'-'+_0x379982+'/'+_0x4ede61)[_0xd079('0x1c')](_0x2bc309);}return null;};}function patchUpdates(_0x4d02c9){return function(_0x86f7db){try{jsonpatch[_0xd079('0x21')](_0x86f7db,_0x4d02c9,!![]);}catch(_0x1ded33){return BPromise[_0xd079('0x22')](_0x1ded33);}return _0x86f7db[_0xd079('0x23')]();};}function saveUpdates(_0x42139c,_0x24ea1a){return function(_0x2a7cfb){if(_0x2a7cfb){return _0x2a7cfb[_0xd079('0x24')](_0x42139c)[_0xd079('0x25')](function(_0x33182e){return _0x33182e;});}return null;};}function removeEntity(_0x46c8b3,_0x4f5c16){return function(_0x3388fe){if(_0x3388fe){return _0x3388fe[_0xd079('0x26')]()[_0xd079('0x25')](function(){_0x46c8b3[_0xd079('0x1b')](0xcc)[_0xd079('0x27')]();});}};}function handleEntityNotFound(_0x8a6f5b,_0x2d8e99){return function(_0x5da269){if(!_0x5da269){_0x8a6f5b[_0xd079('0x1a')](0x194);}return _0x5da269;};}function handleError(_0x3f79bc,_0x5a89c2){_0x5a89c2=_0x5a89c2||0x1f4;return function(_0x2ef6db){logger[_0xd079('0x28')](_0x2ef6db[_0xd079('0x29')]);if(_0x2ef6db[_0xd079('0x2a')]){delete _0x2ef6db[_0xd079('0x2a')];}_0x3f79bc['status'](_0x5a89c2)[_0xd079('0x2b')](_0x2ef6db);};}exports['index']=function(_0x34184e,_0x316497){var _0x229d2f={},_0x558f49={},_0x5d0ef7={'count':0x0,'rows':[]};var _0x3e4929=_['map'](db['MemberReport'][_0xd079('0x2c')],function(_0x4e592c){return{'name':_0x4e592c[_0xd079('0x2d')],'type':_0x4e592c['type'][_0xd079('0x2e')]};});_0x558f49['model']=_['map'](_0x3e4929,_0xd079('0x2a'));_0x558f49[_0xd079('0x2f')]=_['keys'](_0x34184e[_0xd079('0x2f')]);_0x558f49[_0xd079('0x30')]=_[_0xd079('0x31')](_0x558f49[_0xd079('0x32')],_0x558f49[_0xd079('0x2f')]);_0x229d2f[_0xd079('0x33')]=_['intersection'](_0x558f49[_0xd079('0x32')],qs['fields'](_0x34184e['query'][_0xd079('0x34')]));_0x229d2f['attributes']=_0x229d2f[_0xd079('0x33')][_0xd079('0x35')]?_0x229d2f[_0xd079('0x33')]:_0x558f49[_0xd079('0x32')];if(!_0x34184e['query'][_0xd079('0x36')](_0xd079('0x37'))){_0x229d2f['limit']=qs[_0xd079('0x1f')](_0x34184e['query'][_0xd079('0x1f')]);_0x229d2f[_0xd079('0x1e')]=qs[_0xd079('0x1e')](_0x34184e[_0xd079('0x2f')][_0xd079('0x1e')]);}_0x229d2f[_0xd079('0x38')]=qs[_0xd079('0x39')](_0x34184e['query'][_0xd079('0x39')]);_0x229d2f['where']=qs[_0xd079('0x30')](_[_0xd079('0x3a')](_0x34184e[_0xd079('0x2f')],_0x558f49['filters']),_0x3e4929);if(_0x34184e[_0xd079('0x2f')]['filter']){_0x229d2f[_0xd079('0x3b')]=_[_0xd079('0x3c')](_0x229d2f[_0xd079('0x3b')],{'$or':_[_0xd079('0x3d')](_0x3e4929,function(_0x57baa6){if(_0x57baa6[_0xd079('0x3e')]!=='VIRTUAL'){var _0x3f9f44={};_0x3f9f44[_0x57baa6[_0xd079('0x2a')]]={'$like':'%'+_0x34184e['query']['filter']+'%'};return _0x3f9f44;}})});}_0x229d2f=_['merge']({},_0x229d2f,_0x34184e[_0xd079('0x3f')]);var _0x19d603={'where':_0x229d2f[_0xd079('0x3b')]};return db['MemberReport'][_0xd079('0x1d')](_0x19d603)[_0xd079('0x25')](function(_0x49a1ac){_0x5d0ef7[_0xd079('0x1d')]=_0x49a1ac;if(_0x34184e[_0xd079('0x2f')][_0xd079('0x40')]){_0x229d2f['include']=[{'all':!![]}];}return db[_0xd079('0x41')]['findAll'](_0x229d2f);})['then'](function(_0x4b762f){_0x5d0ef7[_0xd079('0x42')]=_0x4b762f;return _0x5d0ef7;})[_0xd079('0x25')](respondWithFilteredResult(_0x316497,_0x229d2f))['catch'](handleError(_0x316497,null));};exports[_0xd079('0x43')]=function(_0xcfff69,_0x89dbba){var _0x135307={'raw':!![],'where':{'id':_0xcfff69['params']['id']}},_0x17aeb3={};_0x17aeb3['model']=_['keys'](db[_0xd079('0x41')]['rawAttributes']);_0x17aeb3[_0xd079('0x2f')]=_['keys'](_0xcfff69[_0xd079('0x2f')]);_0x17aeb3['filters']=_[_0xd079('0x31')](_0x17aeb3[_0xd079('0x32')],_0x17aeb3[_0xd079('0x2f')]);_0x135307[_0xd079('0x33')]=_['intersection'](_0x17aeb3[_0xd079('0x32')],qs[_0xd079('0x34')](_0xcfff69[_0xd079('0x2f')][_0xd079('0x34')]));_0x135307['attributes']=_0x135307[_0xd079('0x33')][_0xd079('0x35')]?_0x135307['attributes']:_0x17aeb3[_0xd079('0x32')];if(_0xcfff69[_0xd079('0x2f')][_0xd079('0x40')]){_0x135307['include']=[{'all':!![]}];}_0x135307=_[_0xd079('0x3c')]({},_0x135307,_0xcfff69['options']);return db['MemberReport'][_0xd079('0x44')](_0x135307)[_0xd079('0x25')](handleEntityNotFound(_0x89dbba,null))[_0xd079('0x25')](respondWithResult(_0x89dbba,null))[_0xd079('0x45')](handleError(_0x89dbba,null));};exports[_0xd079('0x46')]=function(_0x202f55,_0x218f27){return db[_0xd079('0x41')][_0xd079('0x46')](_0x202f55[_0xd079('0x47')],{})[_0xd079('0x25')](respondWithResult(_0x218f27,0xc9))[_0xd079('0x45')](handleError(_0x218f27,null));};exports['update']=function(_0x107cd3,_0x381bb0){if(_0x107cd3[_0xd079('0x47')]['id']){delete _0x107cd3[_0xd079('0x47')]['id'];}return db[_0xd079('0x41')][_0xd079('0x44')]({'where':{'id':_0x107cd3[_0xd079('0x48')]['id']}})[_0xd079('0x25')](handleEntityNotFound(_0x381bb0,null))[_0xd079('0x25')](saveUpdates(_0x107cd3[_0xd079('0x47')],null))[_0xd079('0x25')](respondWithResult(_0x381bb0,null))[_0xd079('0x45')](handleError(_0x381bb0,null));};exports[_0xd079('0x26')]=function(_0x1c5d07,_0x1d0a81){return db[_0xd079('0x41')]['find']({'where':{'id':_0x1c5d07[_0xd079('0x48')]['id']}})[_0xd079('0x25')](handleEntityNotFound(_0x1d0a81,null))[_0xd079('0x25')](removeEntity(_0x1d0a81,null))['catch'](handleError(_0x1d0a81,null));};exports[_0xd079('0x49')]=function(_0x38cb08,_0x1d5b91){return db[_0xd079('0x41')]['describe']()[_0xd079('0x25')](respondWithResult(_0x1d5b91,null))['catch'](handleError(_0x1d5b91,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 1e67288..a40dc71 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 _0xd59c=['membername_interface','membername','interface','util','moment','bluebird','request-promise','../../config/environment','exports','report_member'];(function(_0x351975,_0x550cf5){var _0x495241=function(_0x1bda94){while(--_0x1bda94){_0x351975['push'](_0x351975['shift']());}};_0x495241(++_0x550cf5);}(_0xd59c,0x1a7));var _0xcd59=function(_0x430223,_0x445563){_0x430223=_0x430223-0x0;var _0x228bc3=_0xd59c[_0x430223];return _0x228bc3;};'use strict';var _=require('lodash');var util=require(_0xcd59('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xcd59('0x1'));var BPromise=require(_0xcd59('0x2'));var rp=require(_0xcd59('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcd59('0x4'));var attributes=require('./memberReport.attributes');module[_0xcd59('0x5')]=function(_0x185ab8,_0x5f5a5a){return _0x185ab8['define']('MemberReport',attributes,{'tableName':_0xcd59('0x6'),'paranoid':![],'indexes':[{'name':_0xcd59('0x7'),'fields':[_0xcd59('0x8'),_0xcd59('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c89=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','membername_interface','membername','lodash'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0x0c89,0x99));var _0x90c8=function(_0x393ff9,_0x378853){_0x393ff9=_0x393ff9-0x0;var _0x44b9d7=_0x0c89[_0x393ff9];return _0x44b9d7;};'use strict';var _=require(_0x90c8('0x0'));var util=require(_0x90c8('0x1'));var logger=require(_0x90c8('0x2'))('api');var moment=require(_0x90c8('0x3'));var BPromise=require(_0x90c8('0x4'));var rp=require(_0x90c8('0x5'));var fs=require('fs');var path=require(_0x90c8('0x6'));var rimraf=require(_0x90c8('0x7'));var config=require(_0x90c8('0x8'));var attributes=require(_0x90c8('0x9'));module['exports']=function(_0x9d72d,_0x539f71){return _0x9d72d[_0x90c8('0xa')](_0x90c8('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x90c8('0xc'),'fields':[_0x90c8('0xd'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ab5390b..eb6ce21 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 _0x3ad4=['include','model','attributes','catch','CreateMemberReport','create','body','UpdateMemberReport','update','debug','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetMemberReport','MemberReport','findAll','options','raw','where','limit','map'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x3ad4,0xee));var _0x43ad=function(_0x2290ae,_0xbbbf35){_0x2290ae=_0x2290ae-0x0;var _0x38bdd0=_0x3ad4[_0x2290ae];return _0x38bdd0;};'use strict';var _=require(_0x43ad('0x0'));var util=require(_0x43ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x43ad('0x2'));var fs=require('fs');var Redis=require(_0x43ad('0x3'));var db=require(_0x43ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x43ad('0x5'));var config=require(_0x43ad('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x43ad('0x7')][_0x43ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ba324,_0x1b03ad,_0x170a12){return new BPromise(function(_0x192304,_0x2789fe){return client[_0x43ad('0x9')](_0x5ba324,_0x170a12)[_0x43ad('0xa')](function(_0x2a7ca8){logger['info'](_0x43ad('0xb'),_0x1b03ad,_0x43ad('0xc'));logger['debug'](_0x43ad('0xd'),_0x1b03ad,'request\x20sent',JSON[_0x43ad('0xe')](_0x2a7ca8));if(_0x2a7ca8[_0x43ad('0xf')]){if(_0x2a7ca8[_0x43ad('0xf')][_0x43ad('0x10')]===0x1f4){logger[_0x43ad('0xf')]('MemberReport,\x20%s,\x20%s',_0x1b03ad,_0x2a7ca8[_0x43ad('0xf')][_0x43ad('0x11')]);return _0x2789fe(_0x2a7ca8[_0x43ad('0xf')][_0x43ad('0x11')]);}logger[_0x43ad('0xf')](_0x43ad('0xb'),_0x1b03ad,_0x2a7ca8[_0x43ad('0xf')]['message']);return _0x192304(_0x2a7ca8[_0x43ad('0xf')]['message']);}else{logger[_0x43ad('0x12')](_0x43ad('0xb'),_0x1b03ad,_0x43ad('0xc'));_0x192304(_0x2a7ca8[_0x43ad('0x13')][_0x43ad('0x11')]);}})['catch'](function(_0x439db9){logger[_0x43ad('0xf')]('MemberReport,\x20%s,\x20%s',_0x1b03ad,_0x439db9);_0x2789fe(_0x439db9);});});}exports[_0x43ad('0x14')]=function(_0x2e4795){var _0x4c2723=this;return new Promise(function(_0x5a3856,_0xea6f8d){return db[_0x43ad('0x15')][_0x43ad('0x16')]({'raw':_0x2e4795[_0x43ad('0x17')]?_0x2e4795[_0x43ad('0x17')][_0x43ad('0x18')]===undefined?!![]:![]:!![],'where':_0x2e4795[_0x43ad('0x17')]?_0x2e4795['options'][_0x43ad('0x19')]||null:null,'attributes':_0x2e4795[_0x43ad('0x17')]?_0x2e4795[_0x43ad('0x17')]['attributes']||null:null,'limit':_0x2e4795['options']?_0x2e4795['options'][_0x43ad('0x1a')]||null:null,'include':_0x2e4795[_0x43ad('0x17')]?_0x2e4795[_0x43ad('0x17')]['include']?_[_0x43ad('0x1b')](_0x2e4795[_0x43ad('0x17')][_0x43ad('0x1c')],function(_0x360ba7){return{'model':db[_0x360ba7['model']],'as':_0x360ba7['as'],'attributes':_0x360ba7['attributes'],'include':_0x360ba7[_0x43ad('0x1c')]?_[_0x43ad('0x1b')](_0x360ba7[_0x43ad('0x1c')],function(_0x3061c2){return{'model':db[_0x3061c2[_0x43ad('0x1d')]],'as':_0x3061c2['as'],'attributes':_0x3061c2[_0x43ad('0x1e')],'include':_0x3061c2[_0x43ad('0x1c')]?_[_0x43ad('0x1b')](_0x3061c2[_0x43ad('0x1c')],function(_0x1f858f){return{'model':db[_0x1f858f[_0x43ad('0x1d')]],'as':_0x1f858f['as'],'attributes':_0x1f858f[_0x43ad('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x43ad('0xa')](function(_0x5e05cc){logger[_0x43ad('0x12')](_0x43ad('0x14'),_0x2e4795);logger['debug'](_0x43ad('0x14'),_0x2e4795,JSON['stringify'](_0x5e05cc));_0x5a3856(_0x5e05cc);})[_0x43ad('0x1f')](function(_0x2002c7){logger[_0x43ad('0xf')](_0x43ad('0x14'),_0x2002c7[_0x43ad('0x11')],_0x2e4795);_0xea6f8d(_0x4c2723[_0x43ad('0xf')](0x1f4,_0x2002c7[_0x43ad('0x11')]));});});};exports[_0x43ad('0x20')]=function(_0x3635c7){var _0x37d413=this;return new Promise(function(_0x4eebe6,_0x14abd2){return db['MemberReport'][_0x43ad('0x21')](_0x3635c7[_0x43ad('0x22')],{'raw':_0x3635c7[_0x43ad('0x17')]?_0x3635c7[_0x43ad('0x17')][_0x43ad('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x59cd02){logger[_0x43ad('0x12')](_0x43ad('0x20'),_0x3635c7);logger['debug'](_0x43ad('0x20'),_0x3635c7,JSON[_0x43ad('0xe')](_0x59cd02));_0x4eebe6(_0x59cd02);})[_0x43ad('0x1f')](function(_0x17f9d2){logger[_0x43ad('0xf')](_0x43ad('0x20'),_0x17f9d2[_0x43ad('0x11')],_0x3635c7);_0x14abd2(_0x37d413['error'](0x1f4,_0x17f9d2['message']));});});};exports[_0x43ad('0x23')]=function(_0x5efa51){var _0x117d45=this;return new Promise(function(_0x581516,_0x579879){return db[_0x43ad('0x15')][_0x43ad('0x24')](_0x5efa51[_0x43ad('0x22')],{'raw':_0x5efa51[_0x43ad('0x17')]?_0x5efa51[_0x43ad('0x17')][_0x43ad('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5efa51[_0x43ad('0x17')]?_0x5efa51[_0x43ad('0x17')][_0x43ad('0x19')]||null:null,'attributes':_0x5efa51['options']?_0x5efa51[_0x43ad('0x17')]['attributes']||null:null,'limit':_0x5efa51[_0x43ad('0x17')]?_0x5efa51[_0x43ad('0x17')][_0x43ad('0x1a')]||null:null})['then'](function(_0x4aa589){logger[_0x43ad('0x12')]('UpdateMemberReport',_0x5efa51);logger[_0x43ad('0x25')](_0x43ad('0x23'),_0x5efa51,JSON[_0x43ad('0xe')](_0x4aa589));_0x581516(_0x4aa589);})['catch'](function(_0x59d5d1){logger[_0x43ad('0xf')]('UpdateMemberReport',_0x59d5d1[_0x43ad('0x11')],_0x5efa51);_0x579879(_0x117d45['error'](0x1f4,_0x59d5d1[_0x43ad('0x11')]));});});}; \ No newline at end of file +var _0x3f3e=['map','model','then','GetMemberReport','stringify','catch','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','MemberReport','options','where','attributes','limit','include'];(function(_0x14eb15,_0x5df0a8){var _0x460dab=function(_0x107e8d){while(--_0x107e8d){_0x14eb15['push'](_0x14eb15['shift']());}};_0x460dab(++_0x5df0a8);}(_0x3f3e,0xc8));var _0xe3f3=function(_0x4efb5a,_0x501e39){_0x4efb5a=_0x4efb5a-0x0;var _0x20a9e1=_0x3f3e[_0x4efb5a];return _0x20a9e1;};'use strict';var _=require(_0xe3f3('0x0'));var util=require(_0xe3f3('0x1'));var moment=require(_0xe3f3('0x2'));var BPromise=require(_0xe3f3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3f3('0x4'));var db=require(_0xe3f3('0x5'))['db'];var utils=require(_0xe3f3('0x6'));var logger=require(_0xe3f3('0x7'))(_0xe3f3('0x8'));var config=require(_0xe3f3('0x9'));var jayson=require(_0xe3f3('0xa'));var client=jayson[_0xe3f3('0xb')][_0xe3f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4107ea,_0x467eab,_0x546ae4){return new BPromise(function(_0xd3410b,_0x24457e){return client[_0xe3f3('0xd')](_0x4107ea,_0x546ae4)['then'](function(_0x20ea75){logger[_0xe3f3('0xe')](_0xe3f3('0xf'),_0x467eab,_0xe3f3('0x10'));logger[_0xe3f3('0x11')](_0xe3f3('0x12'),_0x467eab,'request\x20sent',JSON['stringify'](_0x20ea75));if(_0x20ea75[_0xe3f3('0x13')]){if(_0x20ea75[_0xe3f3('0x13')]['code']===0x1f4){logger[_0xe3f3('0x13')](_0xe3f3('0xf'),_0x467eab,_0x20ea75['error'][_0xe3f3('0x14')]);return _0x24457e(_0x20ea75[_0xe3f3('0x13')][_0xe3f3('0x14')]);}logger[_0xe3f3('0x13')](_0xe3f3('0xf'),_0x467eab,_0x20ea75['error'][_0xe3f3('0x14')]);return _0xd3410b(_0x20ea75[_0xe3f3('0x13')][_0xe3f3('0x14')]);}else{logger['info'](_0xe3f3('0xf'),_0x467eab,_0xe3f3('0x10'));_0xd3410b(_0x20ea75[_0xe3f3('0x15')][_0xe3f3('0x14')]);}})['catch'](function(_0x2a4d76){logger[_0xe3f3('0x13')](_0xe3f3('0xf'),_0x467eab,_0x2a4d76);_0x24457e(_0x2a4d76);});});}exports['GetMemberReport']=function(_0x2b6e81){var _0x286f83=this;return new Promise(function(_0x3ce334,_0x1a662a){return db[_0xe3f3('0x16')]['findAll']({'raw':_0x2b6e81[_0xe3f3('0x17')]?_0x2b6e81[_0xe3f3('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2b6e81[_0xe3f3('0x17')]?_0x2b6e81[_0xe3f3('0x17')][_0xe3f3('0x18')]||null:null,'attributes':_0x2b6e81[_0xe3f3('0x17')]?_0x2b6e81['options'][_0xe3f3('0x19')]||null:null,'limit':_0x2b6e81[_0xe3f3('0x17')]?_0x2b6e81[_0xe3f3('0x17')][_0xe3f3('0x1a')]||null:null,'include':_0x2b6e81['options']?_0x2b6e81[_0xe3f3('0x17')][_0xe3f3('0x1b')]?_[_0xe3f3('0x1c')](_0x2b6e81[_0xe3f3('0x17')][_0xe3f3('0x1b')],function(_0xfc9240){return{'model':db[_0xfc9240['model']],'as':_0xfc9240['as'],'attributes':_0xfc9240['attributes'],'include':_0xfc9240[_0xe3f3('0x1b')]?_['map'](_0xfc9240['include'],function(_0x4affac){return{'model':db[_0x4affac[_0xe3f3('0x1d')]],'as':_0x4affac['as'],'attributes':_0x4affac[_0xe3f3('0x19')],'include':_0x4affac[_0xe3f3('0x1b')]?_[_0xe3f3('0x1c')](_0x4affac['include'],function(_0x586eec){return{'model':db[_0x586eec['model']],'as':_0x586eec['as'],'attributes':_0x586eec['attributes']};}):[]};}):[]};}):[]:[]})[_0xe3f3('0x1e')](function(_0x517bb3){logger['info'](_0xe3f3('0x1f'),_0x2b6e81);logger['debug'](_0xe3f3('0x1f'),_0x2b6e81,JSON[_0xe3f3('0x20')](_0x517bb3));_0x3ce334(_0x517bb3);})[_0xe3f3('0x21')](function(_0x4eda3d){logger[_0xe3f3('0x13')](_0xe3f3('0x1f'),_0x4eda3d[_0xe3f3('0x14')],_0x2b6e81);_0x1a662a(_0x286f83[_0xe3f3('0x13')](0x1f4,_0x4eda3d['message']));});});};exports[_0xe3f3('0x22')]=function(_0x18f313){var _0x52c7a1=this;return new Promise(function(_0x4d856b,_0x39f604){return db[_0xe3f3('0x16')][_0xe3f3('0x23')](_0x18f313[_0xe3f3('0x24')],{'raw':_0x18f313[_0xe3f3('0x17')]?_0x18f313['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5ef6c6){logger[_0xe3f3('0xe')](_0xe3f3('0x22'),_0x18f313);logger[_0xe3f3('0x11')](_0xe3f3('0x22'),_0x18f313,JSON[_0xe3f3('0x20')](_0x5ef6c6));_0x4d856b(_0x5ef6c6);})[_0xe3f3('0x21')](function(_0x36c583){logger[_0xe3f3('0x13')](_0xe3f3('0x22'),_0x36c583[_0xe3f3('0x14')],_0x18f313);_0x39f604(_0x52c7a1[_0xe3f3('0x13')](0x1f4,_0x36c583['message']));});});};exports['UpdateMemberReport']=function(_0x111f4b){var _0x2a775a=this;return new Promise(function(_0x297fc3,_0x4887c1){return db[_0xe3f3('0x16')]['update'](_0x111f4b['body'],{'raw':_0x111f4b['options']?_0x111f4b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x111f4b[_0xe3f3('0x17')]?_0x111f4b[_0xe3f3('0x17')]['where']||null:null,'attributes':_0x111f4b[_0xe3f3('0x17')]?_0x111f4b[_0xe3f3('0x17')][_0xe3f3('0x19')]||null:null,'limit':_0x111f4b[_0xe3f3('0x17')]?_0x111f4b[_0xe3f3('0x17')][_0xe3f3('0x1a')]||null:null})[_0xe3f3('0x1e')](function(_0x231922){logger[_0xe3f3('0xe')](_0xe3f3('0x25'),_0x111f4b);logger[_0xe3f3('0x11')](_0xe3f3('0x25'),_0x111f4b,JSON['stringify'](_0x231922));_0x297fc3(_0x231922);})[_0xe3f3('0x21')](function(_0x37dfb1){logger[_0xe3f3('0x13')](_0xe3f3('0x25'),_0x37dfb1['message'],_0x111f4b);_0x4887c1(_0x2a775a[_0xe3f3('0x13')](0x1f4,_0x37dfb1[_0xe3f3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 043f720..827cde6 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 _0x0713=['index','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./migration.controller','get'];(function(_0x4cb231,_0x3d3c5b){var _0x4d5063=function(_0x4af9d0){while(--_0x4af9d0){_0x4cb231['push'](_0x4cb231['shift']());}};_0x4d5063(++_0x3d3c5b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',controller[_0x3071('0x8')]);module[_0x3071('0x9')]=router; \ No newline at end of file +var _0xf290=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','index','util','connect-timeout'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0xf290,0xde));var _0x0f29=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0xf290[_0x269ee8];return _0x4d98bd;};'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 auth=require(_0x0f29('0x3'));var interaction=require(_0x0f29('0x4'));var config=require(_0x0f29('0x5'));var controller=require(_0x0f29('0x6'));router['get']('/',controller[_0x0f29('0x7')]);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 ca37156..a71eef4 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 _0x4f1d=['sequelize'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x4f1d,0x91));var _0xd4f1=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0x4f1d[_0x1d0aee];return _0x34ee2c;};'use strict';var Sequelize=require(_0xd4f1('0x0'));module['exports']={'version':{'type':Sequelize['STRING'],'unique':'version'}}; \ No newline at end of file +var _0xa1cc=['exports','STRING','version','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1cc,0x93));var _0xca1c=function(_0x4ec4da,_0x221d44){_0x4ec4da=_0x4ec4da-0x0;var _0x247043=_0xa1cc[_0x4ec4da];return _0x247043;};'use strict';var Sequelize=require(_0xca1c('0x0'));module[_0xca1c('0x1')]={'version':{'type':Sequelize[_0xca1c('0x2')],'unique':_0xca1c('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 836c7cc..8af9cfe 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 _0xb684=['Content-Range','apply','reject','save','update','then','destroy','end','error','send','index','map','Migration','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','name','options','includeAll','rows','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set'];(function(_0x3932eb,_0x43b210){var _0x5316e5=function(_0x1744e8){while(--_0x1744e8){_0x3932eb['push'](_0x3932eb['shift']());}};_0x5316e5(++_0x43b210);}(_0xb684,0xa8));var _0x4b68=function(_0x695180,_0x2f5ed3){_0x695180=_0x695180-0x0;var _0x2ccec3=_0xb684[_0x695180];return _0x2ccec3;};'use strict';var pdf=require(_0x4b68('0x0'));var emlformat=require(_0x4b68('0x1'));var rimraf=require(_0x4b68('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b68('0x3'));var rp=require(_0x4b68('0x4'));var moment=require(_0x4b68('0x5'));var BPromise=require(_0x4b68('0x6'));var Mustache=require(_0x4b68('0x7'));var util=require('util');var path=require(_0x4b68('0x8'));var sox=require(_0x4b68('0x9'));var csv=require(_0x4b68('0xa'));var ejs=require(_0x4b68('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4b68('0xc'));var deskjs=require(_0x4b68('0xd'));var toCsv=require(_0x4b68('0xa'));var querystring=require('querystring');var Papa=require(_0x4b68('0xe'));var Redis=require(_0x4b68('0xf'));var authService=require(_0x4b68('0x10'));var qs=require(_0x4b68('0x11'));var as=require(_0x4b68('0x12'));var hardwareService=require(_0x4b68('0x13'));var logger=require(_0x4b68('0x14'))('api');var utils=require(_0x4b68('0x15'));var config=require(_0x4b68('0x16'));var licenseUtil=require(_0x4b68('0x17'));var db=require(_0x4b68('0x18'))['db'];function respondWithStatusCode(_0x376563,_0x22aad2){_0x22aad2=_0x22aad2||0xcc;return function(_0xd86c2f){if(_0xd86c2f){return _0x376563[_0x4b68('0x19')](_0x22aad2);}return _0x376563[_0x4b68('0x1a')](_0x22aad2)['end']();};}function respondWithResult(_0x1cc395,_0x254152){_0x254152=_0x254152||0xc8;return function(_0x4596e3){if(_0x4596e3){return _0x1cc395[_0x4b68('0x1a')](_0x254152)[_0x4b68('0x1b')](_0x4596e3);}};}function respondWithFilteredResult(_0x5cf7da,_0xe66424){return function(_0x4b87bf){if(_0x4b87bf){var _0x86ac04=_0x4b87bf['count'],_0x1d6f75=_0xe66424['offset'],_0x4f4d77=_0xe66424[_0x4b68('0x1c')]+_0xe66424['limit'],_0x33db82;if(_0x4f4d77>=_0x86ac04){_0x4f4d77=_0x86ac04;_0x33db82=0xc8;}else{_0x33db82=0xce;}_0x5cf7da[_0x4b68('0x1a')](_0x33db82);return _0x5cf7da[_0x4b68('0x1d')](_0x4b68('0x1e'),_0x1d6f75+'-'+_0x4f4d77+'/'+_0x86ac04)['json'](_0x4b87bf);}return null;};}function patchUpdates(_0x4b0538){return function(_0x47809b){try{jsonpatch[_0x4b68('0x1f')](_0x47809b,_0x4b0538,!![]);}catch(_0x270940){return BPromise[_0x4b68('0x20')](_0x270940);}return _0x47809b[_0x4b68('0x21')]();};}function saveUpdates(_0x38b7ad,_0x19c3c6){return function(_0xfb9f46){if(_0xfb9f46){return _0xfb9f46[_0x4b68('0x22')](_0x38b7ad)[_0x4b68('0x23')](function(_0x6a3bc9){return _0x6a3bc9;});}return null;};}function removeEntity(_0x133762,_0x40f30c){return function(_0x5e6f02){if(_0x5e6f02){return _0x5e6f02[_0x4b68('0x24')]()[_0x4b68('0x23')](function(){_0x133762[_0x4b68('0x1a')](0xcc)[_0x4b68('0x25')]();});}};}function handleEntityNotFound(_0x428d79,_0x5155d5){return function(_0x2a4354){if(!_0x2a4354){_0x428d79[_0x4b68('0x19')](0x194);}return _0x2a4354;};}function handleError(_0xf727d0,_0x4f26ed){_0x4f26ed=_0x4f26ed||0x1f4;return function(_0x43d070){logger[_0x4b68('0x26')](_0x43d070['stack']);if(_0x43d070['name']){delete _0x43d070['name'];}_0xf727d0[_0x4b68('0x1a')](_0x4f26ed)[_0x4b68('0x27')](_0x43d070);};}exports[_0x4b68('0x28')]=function(_0x1502bd,_0x2a2c6a){var _0x4e9297={},_0x1e3dc4={},_0x50d551={'count':0x0,'rows':[]};var _0x550fd6=_[_0x4b68('0x29')](db[_0x4b68('0x2a')][_0x4b68('0x2b')],function(_0x54e0d3){return{'name':_0x54e0d3['fieldName'],'type':_0x54e0d3['type']['key']};});_0x1e3dc4[_0x4b68('0x2c')]=_[_0x4b68('0x29')](_0x550fd6,'name');_0x1e3dc4[_0x4b68('0x2d')]=_['keys'](_0x1502bd['query']);_0x1e3dc4[_0x4b68('0x2e')]=_[_0x4b68('0x2f')](_0x1e3dc4[_0x4b68('0x2c')],_0x1e3dc4[_0x4b68('0x2d')]);_0x4e9297[_0x4b68('0x30')]=_[_0x4b68('0x2f')](_0x1e3dc4[_0x4b68('0x2c')],qs[_0x4b68('0x31')](_0x1502bd[_0x4b68('0x2d')]['fields']));_0x4e9297[_0x4b68('0x30')]=_0x4e9297[_0x4b68('0x30')][_0x4b68('0x32')]?_0x4e9297[_0x4b68('0x30')]:_0x1e3dc4[_0x4b68('0x2c')];if(!_0x1502bd[_0x4b68('0x2d')][_0x4b68('0x33')](_0x4b68('0x34'))){_0x4e9297[_0x4b68('0x35')]=qs['limit'](_0x1502bd[_0x4b68('0x2d')][_0x4b68('0x35')]);_0x4e9297['offset']=qs[_0x4b68('0x1c')](_0x1502bd[_0x4b68('0x2d')]['offset']);}_0x4e9297[_0x4b68('0x36')]=qs[_0x4b68('0x37')](_0x1502bd[_0x4b68('0x2d')][_0x4b68('0x37')]);_0x4e9297[_0x4b68('0x38')]=qs[_0x4b68('0x2e')](_['pick'](_0x1502bd[_0x4b68('0x2d')],_0x1e3dc4[_0x4b68('0x2e')]),_0x550fd6);if(_0x1502bd[_0x4b68('0x2d')][_0x4b68('0x39')]){_0x4e9297['where']=_[_0x4b68('0x3a')](_0x4e9297[_0x4b68('0x38')],{'$or':_['map'](_0x550fd6,function(_0x5ba145){if(_0x5ba145[_0x4b68('0x3b')]!==_0x4b68('0x3c')){var _0x5c3831={};_0x5c3831[_0x5ba145[_0x4b68('0x3d')]]={'$like':'%'+_0x1502bd[_0x4b68('0x2d')][_0x4b68('0x39')]+'%'};return _0x5c3831;}})});}_0x4e9297=_[_0x4b68('0x3a')]({},_0x4e9297,_0x1502bd[_0x4b68('0x3e')]);var _0x1ae592={'where':_0x4e9297['where']};return db[_0x4b68('0x2a')]['count'](_0x1ae592)['then'](function(_0x48f39f){_0x50d551['count']=_0x48f39f;if(_0x1502bd[_0x4b68('0x2d')][_0x4b68('0x3f')]){_0x4e9297['include']=[{'all':!![]}];}return db['Migration']['findAll'](_0x4e9297);})['then'](function(_0x282a3c){_0x50d551[_0x4b68('0x40')]=_0x282a3c;return _0x50d551;})[_0x4b68('0x23')](respondWithFilteredResult(_0x2a2c6a,_0x4e9297))[_0x4b68('0x41')](handleError(_0x2a2c6a,null));}; \ No newline at end of file +var _0x6ed4=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','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','count','offset','apply','reject','save','update','destroy','then','sendStatus','error','name','map','Migration','rawAttributes'];(function(_0x2486a4,_0x3e3650){var _0x14cf68=function(_0x1b6f40){while(--_0x1b6f40){_0x2486a4['push'](_0x2486a4['shift']());}};_0x14cf68(++_0x3e3650);}(_0x6ed4,0x1e6));var _0x46ed=function(_0x388c0e,_0x492355){_0x388c0e=_0x388c0e-0x0;var _0x226ae9=_0x6ed4[_0x388c0e];return _0x226ae9;};'use strict';var pdf=require(_0x46ed('0x0'));var emlformat=require(_0x46ed('0x1'));var rimraf=require(_0x46ed('0x2'));var zipdir=require(_0x46ed('0x3'));var jsonpatch=require(_0x46ed('0x4'));var rp=require('request-promise');var moment=require(_0x46ed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x46ed('0x6'));var util=require(_0x46ed('0x7'));var path=require(_0x46ed('0x8'));var sox=require('sox');var csv=require(_0x46ed('0x9'));var ejs=require(_0x46ed('0xa'));var fs=require('fs');var _=require(_0x46ed('0xb'));var squel=require('squel');var crypto=require(_0x46ed('0xc'));var jsforce=require(_0x46ed('0xd'));var deskjs=require(_0x46ed('0xe'));var toCsv=require(_0x46ed('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x46ed('0xf'));var authService=require(_0x46ed('0x10'));var qs=require(_0x46ed('0x11'));var as=require(_0x46ed('0x12'));var hardwareService=require(_0x46ed('0x13'));var logger=require(_0x46ed('0x14'))(_0x46ed('0x15'));var utils=require(_0x46ed('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x46ed('0x17'));var db=require(_0x46ed('0x18'))['db'];function respondWithStatusCode(_0x3e37ec,_0x23c362){_0x23c362=_0x23c362||0xcc;return function(_0x2ba246){if(_0x2ba246){return _0x3e37ec['sendStatus'](_0x23c362);}return _0x3e37ec[_0x46ed('0x19')](_0x23c362)[_0x46ed('0x1a')]();};}function respondWithResult(_0x32e11d,_0x5b7913){_0x5b7913=_0x5b7913||0xc8;return function(_0x5a3822){if(_0x5a3822){return _0x32e11d[_0x46ed('0x19')](_0x5b7913)[_0x46ed('0x1b')](_0x5a3822);}};}function respondWithFilteredResult(_0x550507,_0x5acfe7){return function(_0x239f21){if(_0x239f21){var _0x46dc07=_0x239f21[_0x46ed('0x1c')],_0x287388=_0x5acfe7['offset'],_0x5cf81b=_0x5acfe7[_0x46ed('0x1d')]+_0x5acfe7['limit'],_0x21f4e8;if(_0x5cf81b>=_0x46dc07){_0x5cf81b=_0x46dc07;_0x21f4e8=0xc8;}else{_0x21f4e8=0xce;}_0x550507['status'](_0x21f4e8);return _0x550507['set']('Content-Range',_0x287388+'-'+_0x5cf81b+'/'+_0x46dc07)[_0x46ed('0x1b')](_0x239f21);}return null;};}function patchUpdates(_0x1d86b2){return function(_0x12143c){try{jsonpatch[_0x46ed('0x1e')](_0x12143c,_0x1d86b2,!![]);}catch(_0xec2426){return BPromise[_0x46ed('0x1f')](_0xec2426);}return _0x12143c[_0x46ed('0x20')]();};}function saveUpdates(_0x160689,_0x2530df){return function(_0x2b5daa){if(_0x2b5daa){return _0x2b5daa[_0x46ed('0x21')](_0x160689)['then'](function(_0x46830c){return _0x46830c;});}return null;};}function removeEntity(_0x559203,_0x1dd863){return function(_0x3f9183){if(_0x3f9183){return _0x3f9183[_0x46ed('0x22')]()[_0x46ed('0x23')](function(){_0x559203[_0x46ed('0x19')](0xcc)[_0x46ed('0x1a')]();});}};}function handleEntityNotFound(_0xe56440,_0x4ee383){return function(_0x321814){if(!_0x321814){_0xe56440[_0x46ed('0x24')](0x194);}return _0x321814;};}function handleError(_0x103f0b,_0x57af19){_0x57af19=_0x57af19||0x1f4;return function(_0x134b55){logger[_0x46ed('0x25')](_0x134b55['stack']);if(_0x134b55[_0x46ed('0x26')]){delete _0x134b55[_0x46ed('0x26')];}_0x103f0b['status'](_0x57af19)['send'](_0x134b55);};}exports['index']=function(_0xb860a8,_0x170363){var _0x40129b={},_0x54b0d8={},_0x55186f={'count':0x0,'rows':[]};var _0x3c458d=_[_0x46ed('0x27')](db[_0x46ed('0x28')][_0x46ed('0x29')],function(_0x27b381){return{'name':_0x27b381[_0x46ed('0x2a')],'type':_0x27b381[_0x46ed('0x2b')]['key']};});_0x54b0d8[_0x46ed('0x2c')]=_[_0x46ed('0x27')](_0x3c458d,_0x46ed('0x26'));_0x54b0d8[_0x46ed('0x2d')]=_[_0x46ed('0x2e')](_0xb860a8[_0x46ed('0x2d')]);_0x54b0d8[_0x46ed('0x2f')]=_[_0x46ed('0x30')](_0x54b0d8[_0x46ed('0x2c')],_0x54b0d8[_0x46ed('0x2d')]);_0x40129b[_0x46ed('0x31')]=_[_0x46ed('0x30')](_0x54b0d8['model'],qs[_0x46ed('0x32')](_0xb860a8[_0x46ed('0x2d')]['fields']));_0x40129b[_0x46ed('0x31')]=_0x40129b[_0x46ed('0x31')][_0x46ed('0x33')]?_0x40129b[_0x46ed('0x31')]:_0x54b0d8[_0x46ed('0x2c')];if(!_0xb860a8[_0x46ed('0x2d')][_0x46ed('0x34')](_0x46ed('0x35'))){_0x40129b[_0x46ed('0x36')]=qs[_0x46ed('0x36')](_0xb860a8[_0x46ed('0x2d')][_0x46ed('0x36')]);_0x40129b[_0x46ed('0x1d')]=qs[_0x46ed('0x1d')](_0xb860a8['query'][_0x46ed('0x1d')]);}_0x40129b[_0x46ed('0x37')]=qs[_0x46ed('0x38')](_0xb860a8[_0x46ed('0x2d')][_0x46ed('0x38')]);_0x40129b['where']=qs[_0x46ed('0x2f')](_[_0x46ed('0x39')](_0xb860a8['query'],_0x54b0d8[_0x46ed('0x2f')]),_0x3c458d);if(_0xb860a8['query'][_0x46ed('0x3a')]){_0x40129b[_0x46ed('0x3b')]=_[_0x46ed('0x3c')](_0x40129b['where'],{'$or':_[_0x46ed('0x27')](_0x3c458d,function(_0x42eb32){if(_0x42eb32['type']!==_0x46ed('0x3d')){var _0x16832f={};_0x16832f[_0x42eb32[_0x46ed('0x26')]]={'$like':'%'+_0xb860a8[_0x46ed('0x2d')][_0x46ed('0x3a')]+'%'};return _0x16832f;}})});}_0x40129b=_['merge']({},_0x40129b,_0xb860a8[_0x46ed('0x3e')]);var _0x1ee555={'where':_0x40129b['where']};return db[_0x46ed('0x28')][_0x46ed('0x1c')](_0x1ee555)[_0x46ed('0x23')](function(_0x1be2a5){_0x55186f[_0x46ed('0x1c')]=_0x1be2a5;if(_0xb860a8[_0x46ed('0x2d')][_0x46ed('0x3f')]){_0x40129b[_0x46ed('0x40')]=[{'all':!![]}];}return db['Migration'][_0x46ed('0x41')](_0x40129b);})['then'](function(_0x3876b6){_0x55186f['rows']=_0x3876b6;return _0x55186f;})[_0x46ed('0x23')](respondWithFilteredResult(_0x170363,_0x40129b))['catch'](handleError(_0x170363,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 498cced..4c01195 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 _0x9c2a=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x205cf4,_0x24fbef){var _0x441a66=function(_0x4a235e){while(--_0x4a235e){_0x205cf4['push'](_0x205cf4['shift']());}};_0x441a66(++_0x24fbef);}(_0x9c2a,0x10b));var _0xa9c2=function(_0x9f27a3,_0x3716d9){_0x9f27a3=_0x9f27a3-0x0;var _0x1e712e=_0x9c2a[_0x9f27a3];return _0x1e712e;};'use strict';var _=require(_0xa9c2('0x0'));var util=require('util');var logger=require(_0xa9c2('0x1'))(_0xa9c2('0x2'));var moment=require(_0xa9c2('0x3'));var BPromise=require(_0xa9c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9c2('0x5'));var rimraf=require(_0xa9c2('0x6'));var config=require(_0xa9c2('0x7'));var attributes=require(_0xa9c2('0x8'));module[_0xa9c2('0x9')]=function(_0x380f3f,_0x3b1926){return _0x380f3f[_0xa9c2('0xa')](_0xa9c2('0xb'),attributes,{'tableName':_0xa9c2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x405d=['moment','path','rimraf','../../config/environment','define','Migration','migrations','lodash','util','../../config/logger','api'];(function(_0x1b4f12,_0x4d5251){var _0x4ed340=function(_0x7ac553){while(--_0x7ac553){_0x1b4f12['push'](_0x1b4f12['shift']());}};_0x4ed340(++_0x4d5251);}(_0x405d,0x167));var _0xd405=function(_0x18c6a8,_0x114294){_0x18c6a8=_0x18c6a8-0x0;var _0x55530e=_0x405d[_0x18c6a8];return _0x55530e;};'use strict';var _=require(_0xd405('0x0'));var util=require(_0xd405('0x1'));var logger=require(_0xd405('0x2'))(_0xd405('0x3'));var moment=require(_0xd405('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd405('0x5'));var rimraf=require(_0xd405('0x6'));var config=require(_0xd405('0x7'));var attributes=require('./migration.attributes');module['exports']=function(_0x212efa,_0x23cb90){return _0x212efa[_0xd405('0x8')](_0xd405('0x9'),attributes,{'tableName':_0xd405('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 cea5f95..f39c517 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 _0x8aaa=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8aaa,0x19f));var _0xa8aa=function(_0x5c027f,_0xa40135){_0x5c027f=_0x5c027f-0x0;var _0x5392f3=_0x8aaa[_0x5c027f];return _0x5392f3;};'use strict';var _=require('lodash');var util=require(_0xa8aa('0x0'));var moment=require(_0xa8aa('0x1'));var BPromise=require(_0xa8aa('0x2'));var rs=require(_0xa8aa('0x3'));var fs=require('fs');var Redis=require(_0xa8aa('0x4'));var db=require(_0xa8aa('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa8aa('0x6'));var config=require(_0xa8aa('0x7'));var jayson=require(_0xa8aa('0x8'));var client=jayson[_0xa8aa('0x9')][_0xa8aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x348505,_0x3e30fc,_0x1ee027){return new BPromise(function(_0x3d64a4,_0x55a14a){return client['request'](_0x348505,_0x1ee027)[_0xa8aa('0xb')](function(_0x17d622){logger[_0xa8aa('0xc')](_0xa8aa('0xd'),_0x3e30fc,_0xa8aa('0xe'));logger[_0xa8aa('0xf')](_0xa8aa('0x10'),_0x3e30fc,_0xa8aa('0xe'),JSON[_0xa8aa('0x11')](_0x17d622));if(_0x17d622[_0xa8aa('0x12')]){if(_0x17d622[_0xa8aa('0x12')][_0xa8aa('0x13')]===0x1f4){logger[_0xa8aa('0x12')](_0xa8aa('0xd'),_0x3e30fc,_0x17d622['error']['message']);return _0x55a14a(_0x17d622['error'][_0xa8aa('0x14')]);}logger[_0xa8aa('0x12')](_0xa8aa('0xd'),_0x3e30fc,_0x17d622[_0xa8aa('0x12')][_0xa8aa('0x14')]);return _0x3d64a4(_0x17d622[_0xa8aa('0x12')]['message']);}else{logger['info'](_0xa8aa('0xd'),_0x3e30fc,_0xa8aa('0xe'));_0x3d64a4(_0x17d622[_0xa8aa('0x15')][_0xa8aa('0x14')]);}})[_0xa8aa('0x16')](function(_0x5aa0d5){logger['error']('Migration,\x20%s,\x20%s',_0x3e30fc,_0x5aa0d5);_0x55a14a(_0x5aa0d5);});});} \ No newline at end of file +var _0x8aa7=['request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x320834,_0x25f988){var _0x57dbd3=function(_0x31f779){while(--_0x31f779){_0x320834['push'](_0x320834['shift']());}};_0x57dbd3(++_0x25f988);}(_0x8aa7,0x1c4));var _0x78aa=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x8aa7[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x78aa('0x0'));var util=require(_0x78aa('0x1'));var moment=require(_0x78aa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78aa('0x3'));var db=require(_0x78aa('0x4'))['db'];var utils=require(_0x78aa('0x5'));var logger=require(_0x78aa('0x6'))('rpc');var config=require(_0x78aa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x78aa('0x8')][_0x78aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41f122,_0x163f2c,_0x41fb95){return new BPromise(function(_0x2fe7c6,_0x30efd6){return client[_0x78aa('0xa')](_0x41f122,_0x41fb95)[_0x78aa('0xb')](function(_0x12f5ec){logger['info'](_0x78aa('0xc'),_0x163f2c,_0x78aa('0xd'));logger[_0x78aa('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x163f2c,'request\x20sent',JSON[_0x78aa('0xf')](_0x12f5ec));if(_0x12f5ec['error']){if(_0x12f5ec[_0x78aa('0x10')][_0x78aa('0x11')]===0x1f4){logger[_0x78aa('0x10')]('Migration,\x20%s,\x20%s',_0x163f2c,_0x12f5ec[_0x78aa('0x10')][_0x78aa('0x12')]);return _0x30efd6(_0x12f5ec[_0x78aa('0x10')][_0x78aa('0x12')]);}logger['error'](_0x78aa('0xc'),_0x163f2c,_0x12f5ec[_0x78aa('0x10')][_0x78aa('0x12')]);return _0x2fe7c6(_0x12f5ec['error'][_0x78aa('0x12')]);}else{logger['info'](_0x78aa('0xc'),_0x163f2c,_0x78aa('0xd'));_0x2fe7c6(_0x12f5ec[_0x78aa('0x13')][_0x78aa('0x12')]);}})[_0x78aa('0x14')](function(_0x393f80){logger[_0x78aa('0x10')](_0x78aa('0xc'),_0x163f2c,_0x393f80);_0x30efd6(_0x393f80);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8e23f3e..fabd4c7 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 _0x28ca=['Router','../../components/interaction/service','../../config/environment','./network.controller','/:id','isAuthenticated','show','post','delete','destroy','exports','util','connect-timeout','express'];(function(_0xe22ea5,_0x21c514){var _0xb5fd20=function(_0x5ce8a2){while(--_0x5ce8a2){_0xe22ea5['push'](_0xe22ea5['shift']());}};_0xb5fd20(++_0x21c514);}(_0x28ca,0x89));var _0xa28c=function(_0xf07499,_0x48f4c4){_0xf07499=_0xf07499-0x0;var _0x178f02=_0x28ca[_0xf07499];return _0x178f02;};'use strict';var multer=require('multer');var util=require(_0xa28c('0x0'));var path=require('path');var timeout=require(_0xa28c('0x1'));var express=require(_0xa28c('0x2'));var router=express[_0xa28c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa28c('0x4'));var config=require(_0xa28c('0x5'));var controller=require(_0xa28c('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa28c('0x7'),auth[_0xa28c('0x8')](),controller[_0xa28c('0x9')]);router[_0xa28c('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xa28c('0x8')](),controller['update']);router[_0xa28c('0xb')](_0xa28c('0x7'),auth['isAuthenticated'](),controller[_0xa28c('0xc')]);module[_0xa28c('0xd')]=router; \ No newline at end of file +var _0x543f=['isAuthenticated','show','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x543f,0x18f));var _0xf543=function(_0x3a3540,_0x3861ad){_0x3a3540=_0x3a3540-0x0;var _0x29b02=_0x543f[_0x3a3540];return _0x29b02;};'use strict';var multer=require(_0xf543('0x0'));var util=require(_0xf543('0x1'));var path=require(_0xf543('0x2'));var timeout=require(_0xf543('0x3'));var express=require(_0xf543('0x4'));var router=express[_0xf543('0x5')]();var auth=require(_0xf543('0x6'));var interaction=require(_0xf543('0x7'));var config=require(_0xf543('0x8'));var controller=require('./network.controller');router['get']('/',auth[_0xf543('0x9')](),controller['index']);router['get']('/:id',auth[_0xf543('0x9')](),controller[_0xf543('0xa')]);router[_0xf543('0xb')]('/',auth['isAuthenticated'](),controller[_0xf543('0xc')]);router[_0xf543('0xd')](_0xf543('0xe'),auth[_0xf543('0x9')](),controller[_0xf543('0xf')]);router[_0xf543('0x10')]('/:id',auth[_0xf543('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 0ba71d5..280c9af 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 _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x5b7122,_0x63dddc){var _0x33613f=function(_0x4375c5){while(--_0x4375c5){_0x5b7122['push'](_0x5b7122['shift']());}};_0x33613f(++_0x63dddc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x2333e4,_0xf1d97e){var _0x5ae29f=function(_0x2bef72){while(--_0x2bef72){_0x2333e4['push'](_0x2333e4['shift']());}};_0x5ae29f(++_0xf1d97e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 374dbde..abea2be 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 _0x70a7=['json','offset','limit','set','Content-Range','apply','save','stack','name','send','index','map','Network','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','count','include','findAll','rows','show','rawAttributes','length','includeAll','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','update','params','server/files/templates/stun_multiple.ejs','destroy','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','Network,\x20%s,\x20%s','result','catch','status','end'];(function(_0x1c4dde,_0x3a2057){var _0xa90920=function(_0x517f04){while(--_0x517f04){_0x1c4dde['push'](_0x1c4dde['shift']());}};_0xa90920(++_0x3a2057);}(_0x70a7,0xae));var _0x770a=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x70a7[_0x16e57d];return _0x40239c;};'use strict';var pdf=require(_0x770a('0x0'));var emlformat=require(_0x770a('0x1'));var rimraf=require(_0x770a('0x2'));var zipdir=require(_0x770a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x770a('0x4'));var BPromise=require(_0x770a('0x5'));var Mustache=require('mustache');var util=require(_0x770a('0x6'));var path=require('path');var sox=require(_0x770a('0x7'));var csv=require(_0x770a('0x8'));var ejs=require(_0x770a('0x9'));var fs=require('fs');var _=require(_0x770a('0xa'));var squel=require('squel');var crypto=require(_0x770a('0xb'));var jsforce=require(_0x770a('0xc'));var deskjs=require(_0x770a('0xd'));var toCsv=require(_0x770a('0x8'));var querystring=require(_0x770a('0xe'));var Papa=require(_0x770a('0xf'));var Redis=require(_0x770a('0x10'));var authService=require(_0x770a('0x11'));var qs=require(_0x770a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x770a('0x13'));var logger=require('../../config/logger')(_0x770a('0x14'));var utils=require(_0x770a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x770a('0x16'));var db=require(_0x770a('0x17'))['db'];var jayson=require(_0x770a('0x18'));var client=jayson[_0x770a('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7cb148,_0x313933,_0x3b8050,_0x372399){return new BPromise(function(_0x3b651d,_0x2cf901){var _0x24d2f5=_0x372399||client;return _0x24d2f5[_0x770a('0x1a')](_0x7cb148,_0x3b8050)[_0x770a('0x1b')](function(_0x174fcc){logger[_0x770a('0x1c')]('Network,\x20%s,\x20%s',_0x313933,_0x770a('0x1d'));logger[_0x770a('0x1e')](_0x770a('0x1f'),_0x313933,_0x770a('0x1d'),JSON['stringify'](_0x174fcc));if(_0x174fcc[_0x770a('0x20')]){if(_0x174fcc['error'][_0x770a('0x21')]===0x1f4){logger[_0x770a('0x20')]('Network,\x20%s,\x20%s',_0x313933,_0x174fcc[_0x770a('0x20')]['message']);return _0x2cf901(_0x174fcc[_0x770a('0x20')][_0x770a('0x22')]);}logger[_0x770a('0x20')](_0x770a('0x23'),_0x313933,_0x174fcc['error']['message']);return _0x3b651d(_0x174fcc['error']['message']);}else{logger['info'](_0x770a('0x23'),_0x313933,_0x770a('0x1d'));_0x3b651d(_0x174fcc[_0x770a('0x24')][_0x770a('0x22')]);}})[_0x770a('0x25')](function(_0x4a4363){logger[_0x770a('0x20')](_0x770a('0x23'),_0x313933,_0x4a4363);_0x2cf901(_0x4a4363);});});}function respondWithStatusCode(_0x4cd250,_0x59ad2f){_0x59ad2f=_0x59ad2f||0xcc;return function(_0x141a43){if(_0x141a43){return _0x4cd250['sendStatus'](_0x59ad2f);}return _0x4cd250[_0x770a('0x26')](_0x59ad2f)[_0x770a('0x27')]();};}function respondWithResult(_0x99b890,_0x206cb2){_0x206cb2=_0x206cb2||0xc8;return function(_0xfbed77){if(_0xfbed77){return _0x99b890['status'](_0x206cb2)[_0x770a('0x28')](_0xfbed77);}};}function respondWithFilteredResult(_0x29c998,_0x2e0038){return function(_0x7e4846){if(_0x7e4846){var _0x3eaf67=_0x7e4846['count'],_0x3bbe35=_0x2e0038[_0x770a('0x29')],_0x5e25bb=_0x2e0038[_0x770a('0x29')]+_0x2e0038[_0x770a('0x2a')],_0x51c3b2;if(_0x5e25bb>=_0x3eaf67){_0x5e25bb=_0x3eaf67;_0x51c3b2=0xc8;}else{_0x51c3b2=0xce;}_0x29c998[_0x770a('0x26')](_0x51c3b2);return _0x29c998[_0x770a('0x2b')](_0x770a('0x2c'),_0x3bbe35+'-'+_0x5e25bb+'/'+_0x3eaf67)[_0x770a('0x28')](_0x7e4846);}return null;};}function patchUpdates(_0x66f006){return function(_0x3ae307){try{jsonpatch[_0x770a('0x2d')](_0x3ae307,_0x66f006,!![]);}catch(_0x27b0df){return BPromise['reject'](_0x27b0df);}return _0x3ae307[_0x770a('0x2e')]();};}function saveUpdates(_0x46ac2c,_0x2fcd8b){return function(_0x547d99){if(_0x547d99){return _0x547d99['update'](_0x46ac2c)[_0x770a('0x1b')](function(_0x194ce5){return _0x194ce5;});}return null;};}function removeEntity(_0x101775,_0x21abae){return function(_0x1c314c){if(_0x1c314c){return _0x1c314c['destroy']()[_0x770a('0x1b')](function(){_0x101775['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5af415,_0x205faf){return function(_0x3141b7){if(!_0x3141b7){_0x5af415['sendStatus'](0x194);}return _0x3141b7;};}function handleError(_0x24ad6b,_0x47a460){_0x47a460=_0x47a460||0x1f4;return function(_0x28b962){logger['error'](_0x28b962[_0x770a('0x2f')]);if(_0x28b962['name']){delete _0x28b962[_0x770a('0x30')];}_0x24ad6b[_0x770a('0x26')](_0x47a460)[_0x770a('0x31')](_0x28b962);};}exports[_0x770a('0x32')]=function(_0x176cd8,_0x36a8e1){var _0x1fecb5={},_0x343202={},_0x35c6cb={'count':0x0,'rows':[]};var _0x417fd5=_[_0x770a('0x33')](db[_0x770a('0x34')]['rawAttributes'],function(_0x41d9df){return{'name':_0x41d9df[_0x770a('0x35')],'type':_0x41d9df['type'][_0x770a('0x36')]};});_0x343202[_0x770a('0x37')]=_['map'](_0x417fd5,_0x770a('0x30'));_0x343202['query']=_[_0x770a('0x38')](_0x176cd8[_0x770a('0x39')]);_0x343202[_0x770a('0x3a')]=_['intersection'](_0x343202['model'],_0x343202['query']);_0x1fecb5['attributes']=_[_0x770a('0x3b')](_0x343202[_0x770a('0x37')],qs[_0x770a('0x3c')](_0x176cd8[_0x770a('0x39')][_0x770a('0x3c')]));_0x1fecb5[_0x770a('0x3d')]=_0x1fecb5[_0x770a('0x3d')]['length']?_0x1fecb5[_0x770a('0x3d')]:_0x343202[_0x770a('0x37')];if(!_0x176cd8['query'][_0x770a('0x3e')]('nolimit')){_0x1fecb5['limit']=qs[_0x770a('0x2a')](_0x176cd8[_0x770a('0x39')]['limit']);_0x1fecb5[_0x770a('0x29')]=qs[_0x770a('0x29')](_0x176cd8['query']['offset']);}_0x1fecb5[_0x770a('0x3f')]=qs['sort'](_0x176cd8['query'][_0x770a('0x40')]);_0x1fecb5[_0x770a('0x41')]=qs[_0x770a('0x3a')](_[_0x770a('0x42')](_0x176cd8[_0x770a('0x39')],_0x343202[_0x770a('0x3a')]),_0x417fd5);if(_0x176cd8[_0x770a('0x39')][_0x770a('0x43')]){_0x1fecb5['where']=_[_0x770a('0x44')](_0x1fecb5[_0x770a('0x41')],{'$or':_[_0x770a('0x33')](_0x417fd5,function(_0x3594e0){if(_0x3594e0[_0x770a('0x45')]!==_0x770a('0x46')){var _0x56af85={};_0x56af85[_0x3594e0[_0x770a('0x30')]]={'$like':'%'+_0x176cd8[_0x770a('0x39')][_0x770a('0x43')]+'%'};return _0x56af85;}})});}_0x1fecb5=_[_0x770a('0x44')]({},_0x1fecb5,_0x176cd8['options']);var _0x3f3bda={'where':_0x1fecb5[_0x770a('0x41')]};return db[_0x770a('0x34')][_0x770a('0x47')](_0x3f3bda)[_0x770a('0x1b')](function(_0x5d9aee){_0x35c6cb[_0x770a('0x47')]=_0x5d9aee;if(_0x176cd8[_0x770a('0x39')]['includeAll']){_0x1fecb5[_0x770a('0x48')]=[{'all':!![]}];}return db['Network'][_0x770a('0x49')](_0x1fecb5);})[_0x770a('0x1b')](function(_0x45b6df){_0x35c6cb[_0x770a('0x4a')]=_0x45b6df;return _0x35c6cb;})['then'](respondWithFilteredResult(_0x36a8e1,_0x1fecb5))[_0x770a('0x25')](handleError(_0x36a8e1,null));};exports[_0x770a('0x4b')]=function(_0x23fa1b,_0x3adb5b){var _0x12138a={'raw':!![],'where':{'id':_0x23fa1b['params']['id']}},_0x256422={};_0x256422[_0x770a('0x37')]=_[_0x770a('0x38')](db['Network'][_0x770a('0x4c')]);_0x256422[_0x770a('0x39')]=_[_0x770a('0x38')](_0x23fa1b[_0x770a('0x39')]);_0x256422[_0x770a('0x3a')]=_[_0x770a('0x3b')](_0x256422[_0x770a('0x37')],_0x256422[_0x770a('0x39')]);_0x12138a[_0x770a('0x3d')]=_['intersection'](_0x256422[_0x770a('0x37')],qs[_0x770a('0x3c')](_0x23fa1b['query']['fields']));_0x12138a['attributes']=_0x12138a[_0x770a('0x3d')][_0x770a('0x4d')]?_0x12138a[_0x770a('0x3d')]:_0x256422[_0x770a('0x37')];if(_0x23fa1b[_0x770a('0x39')][_0x770a('0x4e')]){_0x12138a[_0x770a('0x48')]=[{'all':!![]}];}_0x12138a=_['merge']({},_0x12138a,_0x23fa1b['options']);return db['Network'][_0x770a('0x4f')](_0x12138a)['then'](handleEntityNotFound(_0x3adb5b,null))[_0x770a('0x1b')](respondWithResult(_0x3adb5b,null))[_0x770a('0x25')](handleError(_0x3adb5b,null));};exports[_0x770a('0x50')]=function(_0xd2210,_0x5d898c,_0x55487b){var _0x50b807;return db[_0x770a('0x51')][_0x770a('0x52')](function(_0x33e8cb){return db[_0x770a('0x34')][_0x770a('0x50')](_0xd2210[_0x770a('0x53')],{'raw':!![]})[_0x770a('0x1b')](function(_0x21a155){_0x50b807=_0x21a155;return db[_0x770a('0x34')][_0x770a('0x49')]({'where':{'type':_0xd2210[_0x770a('0x53')][_0x770a('0x45')]},'raw':!![]});})['then'](function(_0x1beef9){if(_0x50b807[_0x770a('0x45')][_0x770a('0x54')]()==_0x770a('0x55')){var _0x369917=fs[_0x770a('0x56')](path[_0x770a('0x57')](config[_0x770a('0x58')],'server/files/templates/stun_multiple.ejs'),_0x770a('0x59'));var _0x1b8fb2=ejs[_0x770a('0x5a')](_0x369917,{'networks':_0x1beef9||[]});fs['writeFileSync'](_0x770a('0x5b'),_0x1b8fb2);return respondWithRpcPromise('Reload','create',{'module':_0x770a('0x5c')});}else if(_0x50b807[_0x770a('0x45')][_0x770a('0x54')]()==_0x770a('0x5d')){var _0x2fff1c=fs['readFileSync'](path[_0x770a('0x57')](config[_0x770a('0x58')],_0x770a('0x5e')),_0x770a('0x59'));var _0x4ad231=ejs[_0x770a('0x5a')](_0x2fff1c,{'networks':_0x1beef9||[]});fs[_0x770a('0x5f')](_0x770a('0x60'),_0x4ad231);return respondWithRpcPromise(_0x770a('0x61'),_0x770a('0x50'),{'module':_0x770a('0x5c')});}else{var _0x1cc0f8=fs[_0x770a('0x56')](path['join'](config[_0x770a('0x58')],_0x770a('0x62')),'utf8');var _0x3fad18=ejs[_0x770a('0x5a')](_0x1cc0f8,{'networks':_0x1beef9||[]});fs[_0x770a('0x5f')](util[_0x770a('0x63')](_0x770a('0x64'),_0xd2210[_0x770a('0x53')][_0x770a('0x45')][_0x770a('0x65')]()),_0x3fad18);return respondWithRpcPromise(_0x770a('0x61'),_0x770a('0x50'),{'module':_0x770a('0x66')});}return null;})[_0x770a('0x1b')](function(){return _0x50b807;});})[_0x770a('0x1b')](respondWithResult(_0x5d898c,0xc9))['catch'](handleError(_0x5d898c,null));};exports[_0x770a('0x67')]=function(_0x4d8bd6,_0x23f756,_0x1f47d6){var _0x57c844;return db[_0x770a('0x51')][_0x770a('0x52')](function(_0x4703e6){return db['Network'][_0x770a('0x4f')]({'where':{'id':_0x4d8bd6[_0x770a('0x68')]['id']}})[_0x770a('0x1b')](handleEntityNotFound(_0x23f756,null))[_0x770a('0x1b')](saveUpdates(_0x4d8bd6[_0x770a('0x53')],null))['then'](function(_0x4c1ce1){if(_0x4c1ce1){_0x57c844=_0x4c1ce1;return db['Network']['findAll']({'where':{'type':_0x57c844[_0x770a('0x45')]},'raw':!![]});}return null;})[_0x770a('0x1b')](function(_0x47b7ed){if(_0x57c844[_0x770a('0x45')][_0x770a('0x54')]()=='STUN'){var _0x5ebaf5=fs[_0x770a('0x56')](path[_0x770a('0x57')](config[_0x770a('0x58')],_0x770a('0x69')),_0x770a('0x59'));var _0x476c6c=ejs[_0x770a('0x5a')](_0x5ebaf5,{'networks':_0x47b7ed||[]});fs[_0x770a('0x5f')](_0x770a('0x5b'),_0x476c6c);return respondWithRpcPromise(_0x770a('0x61'),_0x770a('0x67'),{'module':_0x770a('0x5c')});}else if(_0x57c844['type'][_0x770a('0x54')]()=='TURN'){var _0x51cc10=fs['readFileSync'](path[_0x770a('0x57')](config[_0x770a('0x58')],'server/files/templates/turn_multiple.ejs'),_0x770a('0x59'));var _0xd29976=ejs[_0x770a('0x5a')](_0x51cc10,{'networks':_0x47b7ed||[]});fs[_0x770a('0x5f')](_0x770a('0x60'),_0xd29976);return respondWithRpcPromise('Reload',_0x770a('0x67'),{'module':'res_stun_monitor.so'});}else{var _0x5e8b90=fs['readFileSync'](path[_0x770a('0x57')](config['root'],_0x770a('0x62')),_0x770a('0x59'));var _0x6069b3=ejs[_0x770a('0x5a')](_0x5e8b90,{'networks':_0x47b7ed||[]});fs['writeFileSync'](util[_0x770a('0x63')](_0x770a('0x64'),_0x4d8bd6[_0x770a('0x53')][_0x770a('0x45')][_0x770a('0x65')]()),_0x6069b3);return respondWithRpcPromise(_0x770a('0x61'),_0x770a('0x67'),{'module':_0x770a('0x66')});}return null;})[_0x770a('0x1b')](function(_0x7dd05){if(_0x7dd05){return _0x57c844;}return null;});})[_0x770a('0x1b')](respondWithResult(_0x23f756,null))[_0x770a('0x25')](handleError(_0x23f756,null));};exports[_0x770a('0x6a')]=function(_0x194018,_0x2b5800,_0x392381){var _0x2edde6;return db[_0x770a('0x34')][_0x770a('0x4f')]({'where':{'id':_0x194018['params']['id']}})[_0x770a('0x1b')](function(_0xfe5fa4){_0x2edde6=_0xfe5fa4;return _0xfe5fa4;})[_0x770a('0x1b')](handleEntityNotFound(_0x2b5800,null))['then'](removeEntity(_0x2b5800,null))[_0x770a('0x1b')](function(){if(_0x2edde6){return db[_0x770a('0x34')]['findAll']({'where':{'type':_0x2edde6[_0x770a('0x45')]},'raw':!![]});}})[_0x770a('0x1b')](function(_0x3ed594){if(_0x2edde6[_0x770a('0x45')]['toUpperCase']()==_0x770a('0x55')){var _0x398164=fs[_0x770a('0x56')](path[_0x770a('0x57')](config[_0x770a('0x58')],_0x770a('0x69')),_0x770a('0x59'));var _0x53e7c9=ejs[_0x770a('0x5a')](_0x398164,{'networks':_0x3ed594||[]});fs[_0x770a('0x5f')](_0x770a('0x5b'),_0x53e7c9);return respondWithRpcPromise('Reload',_0x770a('0x6a'),{'module':_0x770a('0x5c')});}else if(_0x2edde6[_0x770a('0x45')][_0x770a('0x54')]()=='TURN'){var _0x1fe7f5=fs[_0x770a('0x56')](path['join'](config[_0x770a('0x58')],_0x770a('0x5e')),_0x770a('0x59'));var _0x1b70be=ejs['render'](_0x1fe7f5,{'networks':_0x3ed594||[]});fs['writeFileSync'](_0x770a('0x60'),_0x1b70be);return respondWithRpcPromise(_0x770a('0x61'),_0x770a('0x6a'),{'module':'res_stun_monitor.so'});}else{var _0x19f801=fs[_0x770a('0x56')](path[_0x770a('0x57')](config['root'],'server/files/templates/network.ejs'),_0x770a('0x59'));var _0x4d65f9=ejs[_0x770a('0x5a')](_0x19f801,{'networks':_0x3ed594||[]});fs[_0x770a('0x5f')](util[_0x770a('0x63')](_0x770a('0x64'),_0x194018[_0x770a('0x53')][_0x770a('0x45')][_0x770a('0x65')]()),_0x4d65f9);return respondWithRpcPromise('Reload',_0x770a('0x6a'),{'module':_0x770a('0x66')});}return null;})[_0x770a('0x25')](handleError(_0x2b5800,null));}; \ No newline at end of file +var _0x12f1=['update','end','sendStatus','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','where','pick','filter','merge','options','Network','includeAll','rows','catch','params','keys','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','destroy','findAll','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','json','count','limit','set','apply','save'];(function(_0x1db863,_0x8f181d){var _0x18b578=function(_0x1a1c30){while(--_0x1a1c30){_0x1db863['push'](_0x1db863['shift']());}};_0x18b578(++_0x8f181d);}(_0x12f1,0x105));var _0x112f=function(_0xa4b78d,_0x369973){_0xa4b78d=_0xa4b78d-0x0;var _0x13cca3=_0x12f1[_0xa4b78d];return _0x13cca3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x112f('0x0'));var jsonpatch=require(_0x112f('0x1'));var rp=require('request-promise');var moment=require(_0x112f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x112f('0x3'));var util=require(_0x112f('0x4'));var path=require(_0x112f('0x5'));var sox=require(_0x112f('0x6'));var csv=require(_0x112f('0x7'));var ejs=require(_0x112f('0x8'));var fs=require('fs');var _=require(_0x112f('0x9'));var squel=require(_0x112f('0xa'));var crypto=require(_0x112f('0xb'));var jsforce=require(_0x112f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x112f('0x7'));var querystring=require(_0x112f('0xd'));var Papa=require(_0x112f('0xe'));var Redis=require(_0x112f('0xf'));var authService=require(_0x112f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x112f('0x11'));var logger=require(_0x112f('0x12'))(_0x112f('0x13'));var utils=require(_0x112f('0x14'));var config=require(_0x112f('0x15'));var licenseUtil=require(_0x112f('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x112f('0x17'));var client=jayson['client'][_0x112f('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x500e6e,_0x47f5f4,_0x19cb0f,_0x3805e7){return new BPromise(function(_0x136160,_0x25e10e){var _0x4e8013=_0x3805e7||client;return _0x4e8013[_0x112f('0x19')](_0x500e6e,_0x19cb0f)[_0x112f('0x1a')](function(_0xdfef4f){logger[_0x112f('0x1b')](_0x112f('0x1c'),_0x47f5f4,_0x112f('0x1d'));logger[_0x112f('0x1e')]('Network,\x20%s,\x20%s,\x20%s',_0x47f5f4,_0x112f('0x1d'),JSON[_0x112f('0x1f')](_0xdfef4f));if(_0xdfef4f[_0x112f('0x20')]){if(_0xdfef4f[_0x112f('0x20')]['code']===0x1f4){logger[_0x112f('0x20')](_0x112f('0x1c'),_0x47f5f4,_0xdfef4f['error']['message']);return _0x25e10e(_0xdfef4f['error']['message']);}logger[_0x112f('0x20')]('Network,\x20%s,\x20%s',_0x47f5f4,_0xdfef4f[_0x112f('0x20')][_0x112f('0x21')]);return _0x136160(_0xdfef4f[_0x112f('0x20')][_0x112f('0x21')]);}else{logger[_0x112f('0x1b')](_0x112f('0x1c'),_0x47f5f4,_0x112f('0x1d'));_0x136160(_0xdfef4f[_0x112f('0x22')]['message']);}})['catch'](function(_0x5a8f02){logger[_0x112f('0x20')]('Network,\x20%s,\x20%s',_0x47f5f4,_0x5a8f02);_0x25e10e(_0x5a8f02);});});}function respondWithStatusCode(_0x13b315,_0x33cb13){_0x33cb13=_0x33cb13||0xcc;return function(_0x3feaf){if(_0x3feaf){return _0x13b315['sendStatus'](_0x33cb13);}return _0x13b315[_0x112f('0x23')](_0x33cb13)['end']();};}function respondWithResult(_0x57051b,_0x13b65e){_0x13b65e=_0x13b65e||0xc8;return function(_0x56b8a6){if(_0x56b8a6){return _0x57051b[_0x112f('0x23')](_0x13b65e)[_0x112f('0x24')](_0x56b8a6);}};}function respondWithFilteredResult(_0x13b2ef,_0xb200c8){return function(_0x5eb1d3){if(_0x5eb1d3){var _0x4f9ccc=_0x5eb1d3[_0x112f('0x25')],_0x2d395a=_0xb200c8['offset'],_0x174212=_0xb200c8['offset']+_0xb200c8[_0x112f('0x26')],_0x4e090a;if(_0x174212>=_0x4f9ccc){_0x174212=_0x4f9ccc;_0x4e090a=0xc8;}else{_0x4e090a=0xce;}_0x13b2ef[_0x112f('0x23')](_0x4e090a);return _0x13b2ef[_0x112f('0x27')]('Content-Range',_0x2d395a+'-'+_0x174212+'/'+_0x4f9ccc)['json'](_0x5eb1d3);}return null;};}function patchUpdates(_0x4cccca){return function(_0x3037a0){try{jsonpatch[_0x112f('0x28')](_0x3037a0,_0x4cccca,!![]);}catch(_0xb27c8f){return BPromise['reject'](_0xb27c8f);}return _0x3037a0[_0x112f('0x29')]();};}function saveUpdates(_0x5ac47e,_0x2f1015){return function(_0x3186d3){if(_0x3186d3){return _0x3186d3[_0x112f('0x2a')](_0x5ac47e)[_0x112f('0x1a')](function(_0x4b9149){return _0x4b9149;});}return null;};}function removeEntity(_0x1d39e3,_0x1e3554){return function(_0x445c17){if(_0x445c17){return _0x445c17['destroy']()['then'](function(){_0x1d39e3[_0x112f('0x23')](0xcc)[_0x112f('0x2b')]();});}};}function handleEntityNotFound(_0x4e345f,_0x29070c){return function(_0x522fdb){if(!_0x522fdb){_0x4e345f[_0x112f('0x2c')](0x194);}return _0x522fdb;};}function handleError(_0x2c14f4,_0x55480e){_0x55480e=_0x55480e||0x1f4;return function(_0x1edc70){logger[_0x112f('0x20')](_0x1edc70['stack']);if(_0x1edc70['name']){delete _0x1edc70[_0x112f('0x2d')];}_0x2c14f4[_0x112f('0x23')](_0x55480e)[_0x112f('0x2e')](_0x1edc70);};}exports[_0x112f('0x2f')]=function(_0x182cdf,_0x1fbfbf){var _0x28eb73={},_0x3cf096={},_0x18d25b={'count':0x0,'rows':[]};var _0x2746b5=_[_0x112f('0x30')](db['Network'][_0x112f('0x31')],function(_0x5932e0){return{'name':_0x5932e0[_0x112f('0x32')],'type':_0x5932e0[_0x112f('0x33')]['key']};});_0x3cf096[_0x112f('0x34')]=_[_0x112f('0x30')](_0x2746b5,_0x112f('0x2d'));_0x3cf096[_0x112f('0x35')]=_['keys'](_0x182cdf[_0x112f('0x35')]);_0x3cf096[_0x112f('0x36')]=_[_0x112f('0x37')](_0x3cf096[_0x112f('0x34')],_0x3cf096['query']);_0x28eb73[_0x112f('0x38')]=_[_0x112f('0x37')](_0x3cf096['model'],qs['fields'](_0x182cdf[_0x112f('0x35')][_0x112f('0x39')]));_0x28eb73[_0x112f('0x38')]=_0x28eb73[_0x112f('0x38')][_0x112f('0x3a')]?_0x28eb73['attributes']:_0x3cf096[_0x112f('0x34')];if(!_0x182cdf[_0x112f('0x35')][_0x112f('0x3b')](_0x112f('0x3c'))){_0x28eb73[_0x112f('0x26')]=qs['limit'](_0x182cdf['query']['limit']);_0x28eb73[_0x112f('0x3d')]=qs[_0x112f('0x3d')](_0x182cdf['query'][_0x112f('0x3d')]);}_0x28eb73[_0x112f('0x3e')]=qs['sort'](_0x182cdf[_0x112f('0x35')]['sort']);_0x28eb73[_0x112f('0x3f')]=qs[_0x112f('0x36')](_[_0x112f('0x40')](_0x182cdf[_0x112f('0x35')],_0x3cf096[_0x112f('0x36')]),_0x2746b5);if(_0x182cdf[_0x112f('0x35')][_0x112f('0x41')]){_0x28eb73['where']=_['merge'](_0x28eb73[_0x112f('0x3f')],{'$or':_[_0x112f('0x30')](_0x2746b5,function(_0xb77938){if(_0xb77938['type']!=='VIRTUAL'){var _0x4283a4={};_0x4283a4[_0xb77938[_0x112f('0x2d')]]={'$like':'%'+_0x182cdf[_0x112f('0x35')][_0x112f('0x41')]+'%'};return _0x4283a4;}})});}_0x28eb73=_[_0x112f('0x42')]({},_0x28eb73,_0x182cdf[_0x112f('0x43')]);var _0x3e906c={'where':_0x28eb73[_0x112f('0x3f')]};return db[_0x112f('0x44')]['count'](_0x3e906c)[_0x112f('0x1a')](function(_0x529ac2){_0x18d25b[_0x112f('0x25')]=_0x529ac2;if(_0x182cdf['query'][_0x112f('0x45')]){_0x28eb73['include']=[{'all':!![]}];}return db[_0x112f('0x44')]['findAll'](_0x28eb73);})[_0x112f('0x1a')](function(_0x220aeb){_0x18d25b[_0x112f('0x46')]=_0x220aeb;return _0x18d25b;})['then'](respondWithFilteredResult(_0x1fbfbf,_0x28eb73))[_0x112f('0x47')](handleError(_0x1fbfbf,null));};exports['show']=function(_0x442e07,_0x40024b){var _0x4ebc6={'raw':!![],'where':{'id':_0x442e07[_0x112f('0x48')]['id']}},_0x3b7f1={};_0x3b7f1[_0x112f('0x34')]=_['keys'](db[_0x112f('0x44')][_0x112f('0x31')]);_0x3b7f1['query']=_[_0x112f('0x49')](_0x442e07[_0x112f('0x35')]);_0x3b7f1[_0x112f('0x36')]=_[_0x112f('0x37')](_0x3b7f1[_0x112f('0x34')],_0x3b7f1[_0x112f('0x35')]);_0x4ebc6['attributes']=_[_0x112f('0x37')](_0x3b7f1[_0x112f('0x34')],qs[_0x112f('0x39')](_0x442e07[_0x112f('0x35')]['fields']));_0x4ebc6[_0x112f('0x38')]=_0x4ebc6[_0x112f('0x38')][_0x112f('0x3a')]?_0x4ebc6['attributes']:_0x3b7f1[_0x112f('0x34')];if(_0x442e07[_0x112f('0x35')][_0x112f('0x45')]){_0x4ebc6['include']=[{'all':!![]}];}_0x4ebc6=_['merge']({},_0x4ebc6,_0x442e07[_0x112f('0x43')]);return db[_0x112f('0x44')][_0x112f('0x4a')](_0x4ebc6)[_0x112f('0x1a')](handleEntityNotFound(_0x40024b,null))['then'](respondWithResult(_0x40024b,null))[_0x112f('0x47')](handleError(_0x40024b,null));};exports[_0x112f('0x4b')]=function(_0x528b43,_0x2f66a4,_0x785467){var _0x4e9810;return db[_0x112f('0x4c')][_0x112f('0x4d')](function(_0x5663e2){return db[_0x112f('0x44')][_0x112f('0x4b')](_0x528b43[_0x112f('0x4e')],{'raw':!![]})['then'](function(_0x3cc371){_0x4e9810=_0x3cc371;return db['Network']['findAll']({'where':{'type':_0x528b43[_0x112f('0x4e')][_0x112f('0x33')]},'raw':!![]});})['then'](function(_0x28a2c6){if(_0x4e9810[_0x112f('0x33')][_0x112f('0x4f')]()==_0x112f('0x50')){var _0x324448=fs[_0x112f('0x51')](path[_0x112f('0x52')](config[_0x112f('0x53')],_0x112f('0x54')),_0x112f('0x55'));var _0x4db25f=ejs[_0x112f('0x56')](_0x324448,{'networks':_0x28a2c6||[]});fs['writeFileSync'](_0x112f('0x57'),_0x4db25f);return respondWithRpcPromise('Reload',_0x112f('0x4b'),{'module':_0x112f('0x58')});}else if(_0x4e9810['type']['toUpperCase']()==_0x112f('0x59')){var _0x22422e=fs[_0x112f('0x51')](path[_0x112f('0x52')](config[_0x112f('0x53')],'server/files/templates/turn_multiple.ejs'),_0x112f('0x55'));var _0x36fb5a=ejs[_0x112f('0x56')](_0x22422e,{'networks':_0x28a2c6||[]});fs[_0x112f('0x5a')](_0x112f('0x5b'),_0x36fb5a);return respondWithRpcPromise(_0x112f('0x5c'),_0x112f('0x4b'),{'module':'res_stun_monitor.so'});}else{var _0x230db3=fs[_0x112f('0x51')](path['join'](config[_0x112f('0x53')],_0x112f('0x5d')),_0x112f('0x55'));var _0x30d68e=ejs[_0x112f('0x56')](_0x230db3,{'networks':_0x28a2c6||[]});fs[_0x112f('0x5a')](util[_0x112f('0x5e')](_0x112f('0x5f'),_0x528b43[_0x112f('0x4e')]['type'][_0x112f('0x60')]()),_0x30d68e);return respondWithRpcPromise(_0x112f('0x5c'),_0x112f('0x4b'),{'module':_0x112f('0x61')});}return null;})[_0x112f('0x1a')](function(){return _0x4e9810;});})[_0x112f('0x1a')](respondWithResult(_0x2f66a4,0xc9))[_0x112f('0x47')](handleError(_0x2f66a4,null));};exports[_0x112f('0x2a')]=function(_0x2608bc,_0x254862,_0x34dc81){var _0x41228b;return db[_0x112f('0x4c')]['transaction'](function(_0x5c4477){return db[_0x112f('0x44')]['find']({'where':{'id':_0x2608bc[_0x112f('0x48')]['id']}})[_0x112f('0x1a')](handleEntityNotFound(_0x254862,null))[_0x112f('0x1a')](saveUpdates(_0x2608bc[_0x112f('0x4e')],null))[_0x112f('0x1a')](function(_0x5a492e){if(_0x5a492e){_0x41228b=_0x5a492e;return db['Network']['findAll']({'where':{'type':_0x41228b[_0x112f('0x33')]},'raw':!![]});}return null;})['then'](function(_0xc5c69e){if(_0x41228b[_0x112f('0x33')][_0x112f('0x4f')]()==_0x112f('0x50')){var _0x433ef6=fs[_0x112f('0x51')](path['join'](config[_0x112f('0x53')],_0x112f('0x54')),_0x112f('0x55'));var _0x1058a2=ejs[_0x112f('0x56')](_0x433ef6,{'networks':_0xc5c69e||[]});fs[_0x112f('0x5a')](_0x112f('0x57'),_0x1058a2);return respondWithRpcPromise('Reload',_0x112f('0x2a'),{'module':'res_stun_monitor.so'});}else if(_0x41228b[_0x112f('0x33')]['toUpperCase']()==_0x112f('0x59')){var _0x16c103=fs['readFileSync'](path[_0x112f('0x52')](config[_0x112f('0x53')],_0x112f('0x62')),'utf8');var _0x1ca328=ejs['render'](_0x16c103,{'networks':_0xc5c69e||[]});fs[_0x112f('0x5a')](_0x112f('0x5b'),_0x1ca328);return respondWithRpcPromise(_0x112f('0x5c'),_0x112f('0x2a'),{'module':_0x112f('0x58')});}else{var _0x4b313e=fs[_0x112f('0x51')](path[_0x112f('0x52')](config[_0x112f('0x53')],_0x112f('0x5d')),'utf8');var _0x3d112e=ejs[_0x112f('0x56')](_0x4b313e,{'networks':_0xc5c69e||[]});fs[_0x112f('0x5a')](util[_0x112f('0x5e')](_0x112f('0x5f'),_0x2608bc[_0x112f('0x4e')][_0x112f('0x33')][_0x112f('0x60')]()),_0x3d112e);return respondWithRpcPromise(_0x112f('0x5c'),_0x112f('0x2a'),{'module':'chan_sip.so'});}return null;})[_0x112f('0x1a')](function(_0x3e8831){if(_0x3e8831){return _0x41228b;}return null;});})[_0x112f('0x1a')](respondWithResult(_0x254862,null))['catch'](handleError(_0x254862,null));};exports[_0x112f('0x63')]=function(_0x1e915d,_0x1d4c1e,_0x1acc8b){var _0x3bdd4e;return db[_0x112f('0x44')][_0x112f('0x4a')]({'where':{'id':_0x1e915d[_0x112f('0x48')]['id']}})['then'](function(_0x414ef3){_0x3bdd4e=_0x414ef3;return _0x414ef3;})[_0x112f('0x1a')](handleEntityNotFound(_0x1d4c1e,null))[_0x112f('0x1a')](removeEntity(_0x1d4c1e,null))['then'](function(){if(_0x3bdd4e){return db[_0x112f('0x44')][_0x112f('0x64')]({'where':{'type':_0x3bdd4e[_0x112f('0x33')]},'raw':!![]});}})[_0x112f('0x1a')](function(_0x4b43f3){if(_0x3bdd4e[_0x112f('0x33')][_0x112f('0x4f')]()=='STUN'){var _0x297c34=fs[_0x112f('0x51')](path[_0x112f('0x52')](config[_0x112f('0x53')],'server/files/templates/stun_multiple.ejs'),_0x112f('0x55'));var _0x34d7c4=ejs['render'](_0x297c34,{'networks':_0x4b43f3||[]});fs[_0x112f('0x5a')](_0x112f('0x57'),_0x34d7c4);return respondWithRpcPromise('Reload',_0x112f('0x63'),{'module':_0x112f('0x58')});}else if(_0x3bdd4e['type'][_0x112f('0x4f')]()==_0x112f('0x59')){var _0x34da64=fs['readFileSync'](path[_0x112f('0x52')](config[_0x112f('0x53')],_0x112f('0x62')),_0x112f('0x55'));var _0x4404f5=ejs[_0x112f('0x56')](_0x34da64,{'networks':_0x4b43f3||[]});fs[_0x112f('0x5a')](_0x112f('0x5b'),_0x4404f5);return respondWithRpcPromise(_0x112f('0x5c'),_0x112f('0x63'),{'module':_0x112f('0x58')});}else{var _0x419076=fs['readFileSync'](path[_0x112f('0x52')](config['root'],_0x112f('0x5d')),_0x112f('0x55'));var _0x1785b3=ejs[_0x112f('0x56')](_0x419076,{'networks':_0x4b43f3||[]});fs['writeFileSync'](util[_0x112f('0x5e')](_0x112f('0x5f'),_0x1e915d[_0x112f('0x4e')][_0x112f('0x33')]['toLowerCase']()),_0x1785b3);return respondWithRpcPromise(_0x112f('0x5c'),_0x112f('0x63'),{'module':_0x112f('0x61')});}return null;})[_0x112f('0x47')](handleError(_0x1d4c1e,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 4c38f82..79cbd12 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 _0xdab5=['exports','define','network','lodash','util','api','moment','path','rimraf','./network.attributes'];(function(_0x960040,_0x4c0800){var _0x48f5fd=function(_0x226635){while(--_0x226635){_0x960040['push'](_0x960040['shift']());}};_0x48f5fd(++_0x4c0800);}(_0xdab5,0x14d));var _0x5dab=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xdab5[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x5dab('0x0'));var util=require(_0x5dab('0x1'));var logger=require('../../config/logger')(_0x5dab('0x2'));var moment=require(_0x5dab('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5dab('0x4'));var rimraf=require(_0x5dab('0x5'));var config=require('../../config/environment');var attributes=require(_0x5dab('0x6'));module[_0x5dab('0x7')]=function(_0x2993c8,_0x3d7c79){return _0x2993c8[_0x5dab('0x8')]('Network',attributes,{'tableName':_0x5dab('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd26=['path','rimraf','../../config/environment','./network.attributes','exports','Network','network','lodash','util','api','moment','request-promise'];(function(_0x14e1ac,_0x5bcc04){var _0x523a25=function(_0x981e3e){while(--_0x981e3e){_0x14e1ac['push'](_0x14e1ac['shift']());}};_0x523a25(++_0x5bcc04);}(_0xdd26,0x7f));var _0x6dd2=function(_0x14cb94,_0x2f3b3e){_0x14cb94=_0x14cb94-0x0;var _0x471b6f=_0xdd26[_0x14cb94];return _0x471b6f;};'use strict';var _=require(_0x6dd2('0x0'));var util=require(_0x6dd2('0x1'));var logger=require('../../config/logger')(_0x6dd2('0x2'));var moment=require(_0x6dd2('0x3'));var BPromise=require('bluebird');var rp=require(_0x6dd2('0x4'));var fs=require('fs');var path=require(_0x6dd2('0x5'));var rimraf=require(_0x6dd2('0x6'));var config=require(_0x6dd2('0x7'));var attributes=require(_0x6dd2('0x8'));module[_0x6dd2('0x9')]=function(_0x181f09,_0x1ae2c6){return _0x181f09['define'](_0x6dd2('0xa'),attributes,{'tableName':_0x6dd2('0xb'),'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 059aff3..42165d4 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 _0x7787=['catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x86bd48,_0x58bd5c){var _0x4d9e61=function(_0x161e23){while(--_0x161e23){_0x86bd48['push'](_0x86bd48['shift']());}};_0x4d9e61(++_0x58bd5c);}(_0x7787,0x6a));var _0x7778=function(_0x4d6126,_0x1dea75){_0x4d6126=_0x4d6126-0x0;var _0x37710f=_0x7787[_0x4d6126];return _0x37710f;};'use strict';var _=require(_0x7778('0x0'));var util=require('util');var moment=require(_0x7778('0x1'));var BPromise=require(_0x7778('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7778('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7778('0x4'))(_0x7778('0x5'));var config=require(_0x7778('0x6'));var jayson=require(_0x7778('0x7'));var client=jayson['client'][_0x7778('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49a64a,_0x245877,_0x34ba91){return new BPromise(function(_0x1315cf,_0xe50881){return client[_0x7778('0x9')](_0x49a64a,_0x34ba91)['then'](function(_0x3b300e){logger[_0x7778('0xa')](_0x7778('0xb'),_0x245877,_0x7778('0xc'));logger[_0x7778('0xd')](_0x7778('0xe'),_0x245877,_0x7778('0xc'),JSON[_0x7778('0xf')](_0x3b300e));if(_0x3b300e[_0x7778('0x10')]){if(_0x3b300e['error'][_0x7778('0x11')]===0x1f4){logger[_0x7778('0x10')](_0x7778('0xb'),_0x245877,_0x3b300e[_0x7778('0x10')][_0x7778('0x12')]);return _0xe50881(_0x3b300e[_0x7778('0x10')]['message']);}logger['error'](_0x7778('0xb'),_0x245877,_0x3b300e['error'][_0x7778('0x12')]);return _0x1315cf(_0x3b300e['error']['message']);}else{logger[_0x7778('0xa')](_0x7778('0xb'),_0x245877,_0x7778('0xc'));_0x1315cf(_0x3b300e[_0x7778('0x13')][_0x7778('0x12')]);}})[_0x7778('0x14')](function(_0x16701b){logger[_0x7778('0x10')](_0x7778('0xb'),_0x245877,_0x16701b);_0xe50881(_0x16701b);});});} \ No newline at end of file +var _0x6875=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x52c8e1,_0x596b96){var _0x4d3a7f=function(_0x2d8eb6){while(--_0x2d8eb6){_0x52c8e1['push'](_0x52c8e1['shift']());}};_0x4d3a7f(++_0x596b96);}(_0x6875,0x7e));var _0x5687=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6875[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x5687('0x0'));var util=require(_0x5687('0x1'));var moment=require(_0x5687('0x2'));var BPromise=require(_0x5687('0x3'));var rs=require(_0x5687('0x4'));var fs=require('fs');var Redis=require(_0x5687('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5687('0x6'))(_0x5687('0x7'));var config=require(_0x5687('0x8'));var jayson=require(_0x5687('0x9'));var client=jayson['client'][_0x5687('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x573931,_0x1564ce,_0x553614){return new BPromise(function(_0x2de9d7,_0x264c31){return client[_0x5687('0xb')](_0x573931,_0x553614)['then'](function(_0x182f4a){logger[_0x5687('0xc')](_0x5687('0xd'),_0x1564ce,_0x5687('0xe'));logger[_0x5687('0xf')](_0x5687('0x10'),_0x1564ce,_0x5687('0xe'),JSON['stringify'](_0x182f4a));if(_0x182f4a['error']){if(_0x182f4a[_0x5687('0x11')][_0x5687('0x12')]===0x1f4){logger[_0x5687('0x11')](_0x5687('0xd'),_0x1564ce,_0x182f4a[_0x5687('0x11')][_0x5687('0x13')]);return _0x264c31(_0x182f4a['error']['message']);}logger[_0x5687('0x11')](_0x5687('0xd'),_0x1564ce,_0x182f4a[_0x5687('0x11')][_0x5687('0x13')]);return _0x2de9d7(_0x182f4a['error'][_0x5687('0x13')]);}else{logger[_0x5687('0xc')](_0x5687('0xd'),_0x1564ce,_0x5687('0xe'));_0x2de9d7(_0x182f4a[_0x5687('0x14')][_0x5687('0x13')]);}})[_0x5687('0x15')](function(_0xfbc99e){logger[_0x5687('0x11')]('Network,\x20%s,\x20%s',_0x1564ce,_0xfbc99e);_0x264c31(_0xfbc99e);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index dd97837..06f1a96 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57bf=['connect-timeout','../../config/environment','post','sendNotification','exports','multer','path'];(function(_0x33ee08,_0x44ceac){var _0x34c394=function(_0xd1a80){while(--_0xd1a80){_0x33ee08['push'](_0x33ee08['shift']());}};_0x34c394(++_0x44ceac);}(_0x57bf,0xbb));var _0xf57b=function(_0x105172,_0x484800){_0x105172=_0x105172-0x0;var _0x453676=_0x57bf[_0x105172];return _0x453676;};'use strict';var multer=require(_0xf57b('0x0'));var util=require('util');var path=require(_0xf57b('0x1'));var timeout=require(_0xf57b('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf57b('0x3'));var controller=require('./notification.controller');router[_0xf57b('0x4')]('/',auth['isAuthenticated'](),controller[_0xf57b('0x5')]);module[_0xf57b('0x6')]=router; \ No newline at end of file +var _0xe88c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendNotification','multer','util','path','connect-timeout','express'];(function(_0x1ab882,_0x420226){var _0x3f391f=function(_0x31f02e){while(--_0x31f02e){_0x1ab882['push'](_0x1ab882['shift']());}};_0x3f391f(++_0x420226);}(_0xe88c,0x1cf));var _0xce88=function(_0x4c5a52,_0x59ef62){_0x4c5a52=_0x4c5a52-0x0;var _0x5b40f5=_0xe88c[_0x4c5a52];return _0x5b40f5;};'use strict';var multer=require(_0xce88('0x0'));var util=require(_0xce88('0x1'));var path=require(_0xce88('0x2'));var timeout=require(_0xce88('0x3'));var express=require(_0xce88('0x4'));var router=express[_0xce88('0x5')]();var auth=require(_0xce88('0x6'));var interaction=require(_0xce88('0x7'));var config=require(_0xce88('0x8'));var controller=require('./notification.controller');router[_0xce88('0x9')]('/',auth[_0xce88('0xa')](),controller[_0xce88('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index a4c84f0..645e850 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab9a=['sequelize','exports','TEXT','BOOLEAN'];(function(_0x52ba69,_0x4dbc51){var _0x4afb27=function(_0xaad7e9){while(--_0xaad7e9){_0x52ba69['push'](_0x52ba69['shift']());}};_0x4afb27(++_0x4dbc51);}(_0xab9a,0x1e4));var _0xaab9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xab9a[_0x13e741];return _0x3f8bb3;};'use strict';var Sequelize=require(_0xaab9('0x0'));module[_0xaab9('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xaab9('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xaab9('0x3')]}}; \ No newline at end of file +var _0xc243=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4e5e99,_0x2312d8){var _0x58906c=function(_0x124241){while(--_0x124241){_0x4e5e99['push'](_0x4e5e99['shift']());}};_0x58906c(++_0x2312d8);}(_0xc243,0xc8));var _0x3c24=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0xc243[_0x17882c];return _0x355a59;};'use strict';var Sequelize=require(_0x3c24('0x0'));module[_0x3c24('0x1')]={'body':{'type':Sequelize[_0x3c24('0x2')]},'senderName':{'type':Sequelize[_0x3c24('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x3c24('0x3')]},'beep':{'type':Sequelize[_0x3c24('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 73d9078..e6dda6e 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb793=['lodash','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./notification.socket','register','end','json','offset','limit','status','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','sendNotification','body','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','catch','text','findOne','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','queue','replace','Queue','ids','push','all','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs'];(function(_0x52fa1e,_0x39a40f){var _0x26849d=function(_0x4e52c3){while(--_0x4e52c3){_0x52fa1e['push'](_0x52fa1e['shift']());}};_0x26849d(++_0x39a40f);}(_0xb793,0xbc));var _0x3b79=function(_0x5d4ce8,_0x42c16a){_0x5d4ce8=_0x5d4ce8-0x0;var _0x41ae1f=_0xb793[_0x5d4ce8];return _0x41ae1f;};'use strict';var pdf=require(_0x3b79('0x0'));var emlformat=require(_0x3b79('0x1'));var rimraf=require(_0x3b79('0x2'));var zipdir=require(_0x3b79('0x3'));var jsonpatch=require(_0x3b79('0x4'));var rp=require(_0x3b79('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3b79('0x6'));var util=require(_0x3b79('0x7'));var path=require('path');var sox=require(_0x3b79('0x8'));var csv=require('to-csv');var ejs=require(_0x3b79('0x9'));var fs=require('fs');var _=require(_0x3b79('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b79('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3b79('0xc'));var querystring=require(_0x3b79('0xd'));var Papa=require(_0x3b79('0xe'));var Redis=require('ioredis');var authService=require(_0x3b79('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3b79('0x10'));var hardwareService=require(_0x3b79('0x11'));var logger=require(_0x3b79('0x12'))(_0x3b79('0x13'));var utils=require(_0x3b79('0x14'));var config=require(_0x3b79('0x15'));var licenseUtil=require(_0x3b79('0x16'));var db=require('../../mysqldb')['db'];config[_0x3b79('0x17')]=_[_0x3b79('0x18')](config[_0x3b79('0x17')],{'host':_0x3b79('0x19'),'port':0x18eb});var socket=require(_0x3b79('0x1a'))(new Redis(config[_0x3b79('0x17')]));require(_0x3b79('0x1b'))[_0x3b79('0x1c')](socket);function respondWithStatusCode(_0x3f5c0e,_0x6f5692){_0x6f5692=_0x6f5692||0xcc;return function(_0x304b25){if(_0x304b25){return _0x3f5c0e['sendStatus'](_0x6f5692);}return _0x3f5c0e['status'](_0x6f5692)[_0x3b79('0x1d')]();};}function respondWithResult(_0x583416,_0x1994a3){_0x1994a3=_0x1994a3||0xc8;return function(_0x4ec81f){if(_0x4ec81f){return _0x583416['status'](_0x1994a3)[_0x3b79('0x1e')](_0x4ec81f);}};}function respondWithFilteredResult(_0x2c901d,_0x2d4662){return function(_0x44add9){if(_0x44add9){var _0x25519c=_0x44add9['count'],_0x36ffea=_0x2d4662[_0x3b79('0x1f')],_0xdc6a11=_0x2d4662[_0x3b79('0x1f')]+_0x2d4662[_0x3b79('0x20')],_0x1d6289;if(_0xdc6a11>=_0x25519c){_0xdc6a11=_0x25519c;_0x1d6289=0xc8;}else{_0x1d6289=0xce;}_0x2c901d[_0x3b79('0x21')](_0x1d6289);return _0x2c901d['set'](_0x3b79('0x22'),_0x36ffea+'-'+_0xdc6a11+'/'+_0x25519c)['json'](_0x44add9);}return null;};}function patchUpdates(_0x1d48a0){return function(_0x44d76c){try{jsonpatch['apply'](_0x44d76c,_0x1d48a0,!![]);}catch(_0x24ec42){return BPromise['reject'](_0x24ec42);}return _0x44d76c[_0x3b79('0x23')]();};}function saveUpdates(_0x571013,_0x17ce32){return function(_0x14f716){if(_0x14f716){return _0x14f716[_0x3b79('0x24')](_0x571013)[_0x3b79('0x25')](function(_0xed0787){return _0xed0787;});}return null;};}function removeEntity(_0x3eea57,_0x5bb577){return function(_0x196f0e){if(_0x196f0e){return _0x196f0e[_0x3b79('0x26')]()[_0x3b79('0x25')](function(){_0x3eea57[_0x3b79('0x21')](0xcc)[_0x3b79('0x1d')]();});}};}function handleEntityNotFound(_0x439a0c,_0x4ac8c4){return function(_0x44daf){if(!_0x44daf){_0x439a0c[_0x3b79('0x27')](0x194);}return _0x44daf;};}function handleError(_0x5c15ed,_0x242ef7){_0x242ef7=_0x242ef7||0x1f4;return function(_0x55f00b){logger[_0x3b79('0x28')](_0x55f00b[_0x3b79('0x29')]);if(_0x55f00b[_0x3b79('0x2a')]){delete _0x55f00b['name'];}_0x5c15ed[_0x3b79('0x21')](_0x242ef7)[_0x3b79('0x2b')](_0x55f00b);};}exports[_0x3b79('0x2c')]=function(_0x324c26,_0x42f62c,_0x259af4){if(!_0x324c26[_0x3b79('0x2d')]['hasOwnProperty']('text')&&!_0x324c26[_0x3b79('0x2d')][_0x3b79('0x2e')]('TemplateId')){throw new db['Sequelize'][(_0x3b79('0x2f'))](_0x3b79('0x30'));}else{if(_0x324c26[_0x3b79('0x2d')][_0x3b79('0x2e')]('TemplateId')&&!_0x324c26[_0x3b79('0x2d')]['hasOwnProperty'](_0x3b79('0x31'))){throw new db[(_0x3b79('0x32'))][(_0x3b79('0x2f'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x324c26[_0x3b79('0x2d')][_0x3b79('0x2e')](_0x3b79('0x33'))){throw new db[(_0x3b79('0x32'))][(_0x3b79('0x2f'))](_0x3b79('0x34'));}else{try{var _0x27ced5=JSON['parse'](_0x324c26[_0x3b79('0x2d')]['recipients']);}catch(_0x4b49a7){logger[_0x3b79('0x28')](_0x4b49a7);throw new db[(_0x3b79('0x32'))][(_0x3b79('0x2f'))](_0x3b79('0x35'));}var _0x401875=['chatqueue',_0x3b79('0x36'),_0x3b79('0x37'),_0x3b79('0x38'),_0x3b79('0x39'),_0x3b79('0x3a'),_0x3b79('0x3b'),'team',_0x3b79('0x3c')];if(_['some'](_0x27ced5,function(_0x3e446e){return!_[_0x3b79('0x3d')](_0x401875,_0x3e446e[_0x3b79('0x3e')][_0x3b79('0x3f')]());})){throw new db[(_0x3b79('0x32'))]['ValidationError'](_0x3b79('0x40'));}}}var _0x53e438={};_0x53e438[_0x3b79('0x41')]=_0x324c26['body'][_0x3b79('0x2e')]('senderName')?_0x324c26[_0x3b79('0x2d')][_0x3b79('0x41')]:_0x324c26[_0x3b79('0x3c')][_0x3b79('0x42')];_0x53e438[_0x3b79('0x43')]=_[_0x3b79('0x44')](_0x324c26[_0x3b79('0x2d')][_0x3b79('0x43')])?null:_0x324c26[_0x3b79('0x2d')][_0x3b79('0x43')];_0x53e438[_0x3b79('0x45')]=_0x324c26[_0x3b79('0x2d')][_0x3b79('0x45')]||![];_0x53e438[_0x3b79('0x46')]=_0x324c26[_0x3b79('0x3c')]['id'];return getContent(_0x324c26['body'])['then'](function(_0x6fddcb){_0x53e438[_0x3b79('0x2d')]=_0x6fddcb;return getRecipients(_0x27ced5);})[_0x3b79('0x25')](function(_0x4fc365){_0x53e438[_0x3b79('0x47')]=_['sortBy'](_0x4fc365)[_0x3b79('0x48')](',');return db[_0x3b79('0x49')][_0x3b79('0x4a')](function(_0x5d7f46){return db[_0x3b79('0x4b')][_0x3b79('0x4c')](_0x53e438,{'raw':!![],'transaction':_0x5d7f46})['then'](function(_0x3fda70){var _0x5d14a1={'sender':_0x53e438[_0x3b79('0x41')],'description':_0x53e438[_0x3b79('0x43')],'content':_0x53e438['body'],'beep':_0x53e438['beep']};_0x4fc365[_0x3b79('0x4d')](function(_0x6844c9){_0x5d14a1[_0x3b79('0x4e')]=_0x6844c9;socket[_0x3b79('0x4f')](_0x3b79('0x50'),_0x5d14a1);});return _0x3fda70;});});})[_0x3b79('0x25')](respondWithResult(_0x42f62c,0xc9))[_0x3b79('0x51')](handleError(_0x42f62c,null));};function getContent(_0x17107e){return new BPromise(function(_0x56d250,_0x2e9589){if(_0x17107e[_0x3b79('0x52')]){_0x56d250(_0x17107e[_0x3b79('0x52')]);return;}return db['Template'][_0x3b79('0x53')]({'attributes':['html'],'where':{'id':_0x17107e[_0x3b79('0x54')]},'raw':!![]})[_0x3b79('0x25')](function(_0x589ebf){if(!_0x589ebf)throw new db[(_0x3b79('0x32'))]['ValidationError'](_0x3b79('0x55'));var _0x301d9b=Mustache[_0x3b79('0x56')](_0x589ebf[_0x3b79('0x57')],_0x17107e[_0x3b79('0x31')]);_0x56d250(_0x301d9b);})['catch'](function(_0x40e892){_0x2e9589(_0x40e892);});});}function getRecipients(_0x56c684){return new BPromise(function(_0x3f9f18,_0x3924b5){var _0x4cd637=[];var _0x2e3d9e=[];_0x56c684[_0x3b79('0x4d')](function(_0x47d0d1){var _0x2b91bc=_[_0x3b79('0x58')](_0x47d0d1[_0x3b79('0x3e')][_0x3b79('0x3f')]());if(_0x2b91bc===_0x3b79('0x59')){_0x4cd637=_['union'](_0x4cd637,_0x47d0d1['ids']);}else{if(_[_0x3b79('0x3d')](_0x2b91bc,_0x3b79('0x5a')))_0x2b91bc=_0x2b91bc[_0x3b79('0x5b')](_0x3b79('0x5a'),_0x3b79('0x5c'));_0x47d0d1[_0x3b79('0x5d')][_0x3b79('0x4d')](function(_0x44e9c8){_0x2e3d9e[_0x3b79('0x5e')](getAgents(_0x2b91bc,_0x44e9c8));});}});return BPromise[_0x3b79('0x5f')](_0x2e3d9e)[_0x3b79('0x25')](function(_0x6a94b1){_0x4cd637=_['union'](_0x4cd637,_[_0x3b79('0x60')](_0x6a94b1));_0x3f9f18(_0x4cd637);})['catch'](function(_0x47a32c){_0x3924b5(_0x47a32c);});});}function getAgents(_0x267547,_0x47bdc2){return new BPromise(function(_0x255abd,_0x46f95c){return db[_0x267547][_0x3b79('0x53')]({'where':{'id':_0x47bdc2}})['then'](function(_0x2f7eb7){return _0x2f7eb7[_0x3b79('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x406b63){var _0x3ec346=_[_0x3b79('0x62')](_0x406b63,'id');_0x255abd(_0x3ec346);});})[_0x3b79('0x51')](function(_0x2d1017){_0x46f95c(_0x2d1017);});});} \ No newline at end of file +var _0x4442=['smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union','queue','Queue','ids','push','all','flatten','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./notification.socket','register','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','sendNotification','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','faxqueue','mailqueue'];(function(_0x208c4b,_0x57a28e){var _0x344ab6=function(_0xe9fe00){while(--_0xe9fe00){_0x208c4b['push'](_0x208c4b['shift']());}};_0x344ab6(++_0x57a28e);}(_0x4442,0x1cb));var _0x2444=function(_0x2ed67e,_0x5f316c){_0x2ed67e=_0x2ed67e-0x0;var _0x59248b=_0x4442[_0x2ed67e];return _0x59248b;};'use strict';var pdf=require(_0x2444('0x0'));var emlformat=require(_0x2444('0x1'));var rimraf=require(_0x2444('0x2'));var zipdir=require(_0x2444('0x3'));var jsonpatch=require(_0x2444('0x4'));var rp=require(_0x2444('0x5'));var moment=require('moment');var BPromise=require(_0x2444('0x6'));var Mustache=require(_0x2444('0x7'));var util=require(_0x2444('0x8'));var path=require('path');var sox=require(_0x2444('0x9'));var csv=require(_0x2444('0xa'));var ejs=require(_0x2444('0xb'));var fs=require('fs');var _=require(_0x2444('0xc'));var squel=require('squel');var crypto=require(_0x2444('0xd'));var jsforce=require(_0x2444('0xe'));var deskjs=require(_0x2444('0xf'));var toCsv=require(_0x2444('0xa'));var querystring=require(_0x2444('0x10'));var Papa=require('papaparse');var Redis=require(_0x2444('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2444('0x12'));var as=require(_0x2444('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2444('0x14'))(_0x2444('0x15'));var utils=require(_0x2444('0x16'));var config=require(_0x2444('0x17'));var licenseUtil=require(_0x2444('0x18'));var db=require(_0x2444('0x19'))['db'];config[_0x2444('0x1a')]=_[_0x2444('0x1b')](config[_0x2444('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2444('0x1c'))(new Redis(config[_0x2444('0x1a')]));require(_0x2444('0x1d'))[_0x2444('0x1e')](socket);function respondWithStatusCode(_0x40e324,_0x1455eb){_0x1455eb=_0x1455eb||0xcc;return function(_0x2e17f6){if(_0x2e17f6){return _0x40e324['sendStatus'](_0x1455eb);}return _0x40e324[_0x2444('0x1f')](_0x1455eb)[_0x2444('0x20')]();};}function respondWithResult(_0x17c959,_0x3ef5ec){_0x3ef5ec=_0x3ef5ec||0xc8;return function(_0x577ed3){if(_0x577ed3){return _0x17c959[_0x2444('0x1f')](_0x3ef5ec)[_0x2444('0x21')](_0x577ed3);}};}function respondWithFilteredResult(_0x30d329,_0xe56320){return function(_0x5bade3){if(_0x5bade3){var _0x163e83=_0x5bade3[_0x2444('0x22')],_0x436836=_0xe56320[_0x2444('0x23')],_0x4376c6=_0xe56320[_0x2444('0x23')]+_0xe56320[_0x2444('0x24')],_0x5a829f;if(_0x4376c6>=_0x163e83){_0x4376c6=_0x163e83;_0x5a829f=0xc8;}else{_0x5a829f=0xce;}_0x30d329[_0x2444('0x1f')](_0x5a829f);return _0x30d329[_0x2444('0x25')]('Content-Range',_0x436836+'-'+_0x4376c6+'/'+_0x163e83)[_0x2444('0x21')](_0x5bade3);}return null;};}function patchUpdates(_0x3a7705){return function(_0x1675a2){try{jsonpatch['apply'](_0x1675a2,_0x3a7705,!![]);}catch(_0x2eecfa){return BPromise[_0x2444('0x26')](_0x2eecfa);}return _0x1675a2[_0x2444('0x27')]();};}function saveUpdates(_0x2e8666,_0x239a19){return function(_0x2ddd67){if(_0x2ddd67){return _0x2ddd67[_0x2444('0x28')](_0x2e8666)[_0x2444('0x29')](function(_0x36ffa2){return _0x36ffa2;});}return null;};}function removeEntity(_0x5da90c,_0x4480f4){return function(_0x3ed97c){if(_0x3ed97c){return _0x3ed97c[_0x2444('0x2a')]()[_0x2444('0x29')](function(){_0x5da90c['status'](0xcc)[_0x2444('0x20')]();});}};}function handleEntityNotFound(_0x154a9a,_0x5dedcd){return function(_0x562d5f){if(!_0x562d5f){_0x154a9a[_0x2444('0x2b')](0x194);}return _0x562d5f;};}function handleError(_0x24b029,_0x4187c4){_0x4187c4=_0x4187c4||0x1f4;return function(_0x1f79da){logger[_0x2444('0x2c')](_0x1f79da[_0x2444('0x2d')]);if(_0x1f79da[_0x2444('0x2e')]){delete _0x1f79da[_0x2444('0x2e')];}_0x24b029[_0x2444('0x1f')](_0x4187c4)[_0x2444('0x2f')](_0x1f79da);};}exports[_0x2444('0x30')]=function(_0x5d1363,_0x2d4944,_0x2be430){if(!_0x5d1363[_0x2444('0x31')]['hasOwnProperty'](_0x2444('0x32'))&&!_0x5d1363[_0x2444('0x31')][_0x2444('0x33')](_0x2444('0x34'))){throw new db[(_0x2444('0x35'))][(_0x2444('0x36'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5d1363[_0x2444('0x31')][_0x2444('0x33')](_0x2444('0x34'))&&!_0x5d1363[_0x2444('0x31')]['hasOwnProperty'](_0x2444('0x37'))){throw new db['Sequelize'][(_0x2444('0x36'))](_0x2444('0x38'));}if(!_0x5d1363['body']['hasOwnProperty']('recipients')){throw new db[(_0x2444('0x35'))][(_0x2444('0x36'))](_0x2444('0x39'));}else{try{var _0x7f7036=JSON[_0x2444('0x3a')](_0x5d1363[_0x2444('0x31')]['recipients']);}catch(_0x1e20d9){logger['error'](_0x1e20d9);throw new db[(_0x2444('0x35'))][(_0x2444('0x36'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x2a7c93=['chatqueue',_0x2444('0x3b'),_0x2444('0x3c'),'openchannelqueue',_0x2444('0x3d'),_0x2444('0x3e'),_0x2444('0x3f'),_0x2444('0x40'),_0x2444('0x41')];if(_[_0x2444('0x42')](_0x7f7036,function(_0x4f2cfd){return!_[_0x2444('0x43')](_0x2a7c93,_0x4f2cfd[_0x2444('0x44')][_0x2444('0x45')]());})){throw new db[(_0x2444('0x35'))][(_0x2444('0x36'))](_0x2444('0x46'));}}}var _0x329257={};_0x329257[_0x2444('0x47')]=_0x5d1363[_0x2444('0x31')]['hasOwnProperty']('senderName')?_0x5d1363[_0x2444('0x31')][_0x2444('0x47')]:_0x5d1363['user'][_0x2444('0x48')];_0x329257[_0x2444('0x49')]=_[_0x2444('0x4a')](_0x5d1363[_0x2444('0x31')][_0x2444('0x49')])?null:_0x5d1363[_0x2444('0x31')][_0x2444('0x49')];_0x329257['beep']=_0x5d1363['body'][_0x2444('0x4b')]||![];_0x329257[_0x2444('0x4c')]=_0x5d1363[_0x2444('0x41')]['id'];return getContent(_0x5d1363[_0x2444('0x31')])[_0x2444('0x29')](function(_0x169333){_0x329257[_0x2444('0x31')]=_0x169333;return getRecipients(_0x7f7036);})[_0x2444('0x29')](function(_0x2e56f5){_0x329257[_0x2444('0x4d')]=_[_0x2444('0x4e')](_0x2e56f5)[_0x2444('0x4f')](',');return db[_0x2444('0x50')][_0x2444('0x51')](function(_0x18af31){return db[_0x2444('0x52')][_0x2444('0x53')](_0x329257,{'raw':!![],'transaction':_0x18af31})[_0x2444('0x29')](function(_0x527f1b){var _0x56b444={'sender':_0x329257[_0x2444('0x47')],'description':_0x329257[_0x2444('0x49')],'content':_0x329257[_0x2444('0x31')],'beep':_0x329257[_0x2444('0x4b')]};_0x2e56f5[_0x2444('0x54')](function(_0x2e7810){_0x56b444[_0x2444('0x55')]=_0x2e7810;socket[_0x2444('0x56')](_0x2444('0x57'),_0x56b444);});return _0x527f1b;});});})[_0x2444('0x29')](respondWithResult(_0x2d4944,0xc9))['catch'](handleError(_0x2d4944,null));};function getContent(_0x528e9d){return new BPromise(function(_0x585036,_0x13f003){if(_0x528e9d['text']){_0x585036(_0x528e9d[_0x2444('0x32')]);return;}return db[_0x2444('0x58')][_0x2444('0x59')]({'attributes':[_0x2444('0x5a')],'where':{'id':_0x528e9d[_0x2444('0x34')]},'raw':!![]})['then'](function(_0x3c3c0d){if(!_0x3c3c0d)throw new db[(_0x2444('0x35'))][(_0x2444('0x36'))](_0x2444('0x5b'));var _0x3cacc6=Mustache[_0x2444('0x5c')](_0x3c3c0d[_0x2444('0x5a')],_0x528e9d[_0x2444('0x37')]);_0x585036(_0x3cacc6);})[_0x2444('0x5d')](function(_0x3edc46){_0x13f003(_0x3edc46);});});}function getRecipients(_0xb4db26){return new BPromise(function(_0x2ebb69,_0x3c3411){var _0x1972d0=[];var _0x289196=[];_0xb4db26[_0x2444('0x54')](function(_0x33f79f){var _0x42b73d=_[_0x2444('0x5e')](_0x33f79f['model']['toLowerCase']());if(_0x42b73d===_0x2444('0x5f')){_0x1972d0=_[_0x2444('0x60')](_0x1972d0,_0x33f79f['ids']);}else{if(_[_0x2444('0x43')](_0x42b73d,_0x2444('0x61')))_0x42b73d=_0x42b73d['replace'](_0x2444('0x61'),_0x2444('0x62'));_0x33f79f[_0x2444('0x63')]['forEach'](function(_0x1e3f7b){_0x289196[_0x2444('0x64')](getAgents(_0x42b73d,_0x1e3f7b));});}});return BPromise[_0x2444('0x65')](_0x289196)[_0x2444('0x29')](function(_0x37581a){_0x1972d0=_[_0x2444('0x60')](_0x1972d0,_[_0x2444('0x66')](_0x37581a));_0x2ebb69(_0x1972d0);})['catch'](function(_0x20be24){_0x3c3411(_0x20be24);});});}function getAgents(_0x1a778e,_0x2d7bed){return new BPromise(function(_0x332c24,_0x164480){return db[_0x1a778e][_0x2444('0x59')]({'where':{'id':_0x2d7bed}})[_0x2444('0x29')](function(_0xaa2a6){return _0xaa2a6['getAgents']({'attributes':['id'],'raw':!![]})[_0x2444('0x29')](function(_0xbed5d4){var _0x5858f2=_[_0x2444('0x67')](_0xbed5d4,'id');_0x332c24(_0x5858f2);});})[_0x2444('0x5d')](function(_0x5a5b39){_0x164480(_0x5a5b39);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index ee8690f..f108018 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x19f338,_0x3fd09d){var _0x44bf38=function(_0x43e396){while(--_0x43e396){_0x19f338['push'](_0x19f338['shift']());}};_0x44bf38(++_0x3fd09d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require('events');var Notification=require(_0x65f6('0x0'))['db']['Notification'];var NotificationEvents=new EventEmitter();NotificationEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){NotificationEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);NotificationEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=NotificationEvents; \ No newline at end of file +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x326d24,_0x2a0658){var _0x2ef917=function(_0x1321d5){while(--_0x1321d5){_0x326d24['push'](_0x326d24['shift']());}};_0x2ef917(++_0x2a0658);}(_0xdb28,0x106));var _0x8db2=function(_0x1bce3e,_0x4777f2){_0x1bce3e=_0x1bce3e-0x0;var _0x1e5f79=_0xdb28[_0x1bce3e];return _0x1e5f79;};'use strict';var EventEmitter=require(_0x8db2('0x0'));var Notification=require(_0x8db2('0x1'))['db'][_0x8db2('0x2')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x8db2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8db2('0x4'),'afterDestroy':_0x8db2('0x5')};function emitEvent(_0xfcf49f){return function(_0x4426fe,_0x11109e,_0x52bf99){NotificationEvents[_0x8db2('0x6')](_0xfcf49f+':'+_0x4426fe['id'],_0x4426fe);NotificationEvents[_0x8db2('0x6')](_0xfcf49f,_0x4426fe);_0x52bf99(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Notification['hook'](e,emitEvent(event));}}module[_0x8db2('0x7')]=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 3ae6a04..952ec61 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad2f=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./notification.attributes','exports','define','Notification','notifications','utf8mb4'];(function(_0x180fc0,_0x1552ff){var _0x4c3a3a=function(_0x4cd165){while(--_0x4cd165){_0x180fc0['push'](_0x180fc0['shift']());}};_0x4c3a3a(++_0x1552ff);}(_0xad2f,0x91));var _0xfad2=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xad2f[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xfad2('0x0'));var util=require(_0xfad2('0x1'));var logger=require(_0xfad2('0x2'))(_0xfad2('0x3'));var moment=require(_0xfad2('0x4'));var BPromise=require(_0xfad2('0x5'));var rp=require(_0xfad2('0x6'));var fs=require('fs');var path=require(_0xfad2('0x7'));var rimraf=require('rimraf');var config=require(_0xfad2('0x8'));var attributes=require(_0xfad2('0x9'));module[_0xfad2('0xa')]=function(_0x13d451,_0x33c251){return _0x13d451[_0xfad2('0xb')](_0xfad2('0xc'),attributes,{'tableName':_0xfad2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfad2('0xe'),'collate':_0xfad2('0xf')});}; \ No newline at end of file +var _0x4258=['define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x6b7dd0,_0x2eebf2){var _0x2356cc=function(_0x18c8d8){while(--_0x18c8d8){_0x6b7dd0['push'](_0x6b7dd0['shift']());}};_0x2356cc(++_0x2eebf2);}(_0x4258,0x18f));var _0x8425=function(_0x5e4908,_0x3838ef){_0x5e4908=_0x5e4908-0x0;var _0x271aab=_0x4258[_0x5e4908];return _0x271aab;};'use strict';var _=require(_0x8425('0x0'));var util=require(_0x8425('0x1'));var logger=require(_0x8425('0x2'))(_0x8425('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8425('0x4'));var fs=require('fs');var path=require(_0x8425('0x5'));var rimraf=require(_0x8425('0x6'));var config=require(_0x8425('0x7'));var attributes=require('./notification.attributes');module[_0x8425('0x8')]=function(_0x48647b,_0x8d13d){return _0x48647b[_0x8425('0x9')]('Notification',attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8425('0xa'),'collate':_0x8425('0xb')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 2438e41..a5d97db 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x185b=['redis','localhost','socket.io-emitter','./notification.socket','register','request','info','Notification,\x20%s,\x20%s','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x185b,0x1a4));var _0xb185=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x185b[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xb185('0x0'));var util=require(_0xb185('0x1'));var moment=require(_0xb185('0x2'));var BPromise=require(_0xb185('0x3'));var rs=require(_0xb185('0x4'));var fs=require('fs');var Redis=require(_0xb185('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb185('0x6'));var logger=require(_0xb185('0x7'))(_0xb185('0x8'));var config=require(_0xb185('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb185('0xa')][_0xb185('0xb')]({'port':0x232a});config[_0xb185('0xc')]=_['defaults'](config[_0xb185('0xc')],{'host':_0xb185('0xd'),'port':0x18eb});var socket=require(_0xb185('0xe'))(new Redis(config['redis']));require(_0xb185('0xf'))[_0xb185('0x10')](socket);function respondWithRpcPromise(_0x457c99,_0x36cead,_0x4428be){return new BPromise(function(_0x3298fa,_0x16e013){return client[_0xb185('0x11')](_0x457c99,_0x4428be)['then'](function(_0xe4120c){logger[_0xb185('0x12')](_0xb185('0x13'),_0x36cead,_0xb185('0x14'));logger[_0xb185('0x15')](_0xb185('0x16'),_0x36cead,_0xb185('0x14'),JSON[_0xb185('0x17')](_0xe4120c));if(_0xe4120c[_0xb185('0x18')]){if(_0xe4120c['error']['code']===0x1f4){logger[_0xb185('0x18')]('Notification,\x20%s,\x20%s',_0x36cead,_0xe4120c['error'][_0xb185('0x19')]);return _0x16e013(_0xe4120c['error'][_0xb185('0x19')]);}logger[_0xb185('0x18')](_0xb185('0x13'),_0x36cead,_0xe4120c[_0xb185('0x18')][_0xb185('0x19')]);return _0x3298fa(_0xe4120c[_0xb185('0x18')]['message']);}else{logger['info']('Notification,\x20%s,\x20%s',_0x36cead,'request\x20sent');_0x3298fa(_0xe4120c[_0xb185('0x1a')][_0xb185('0x19')]);}})['catch'](function(_0x5f6812){logger[_0xb185('0x18')](_0xb185('0x13'),_0x36cead,_0x5f6812);_0x16e013(_0x5f6812);});});} \ No newline at end of file +var _0x23b8=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./notification.socket','register','then','info','Notification,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x1d238b,_0x46e25b){var _0x3cef2c=function(_0x3b2547){while(--_0x3b2547){_0x1d238b['push'](_0x1d238b['shift']());}};_0x3cef2c(++_0x46e25b);}(_0x23b8,0x173));var _0x823b=function(_0x4513e8,_0x16f480){_0x4513e8=_0x4513e8-0x0;var _0x1e8758=_0x23b8[_0x4513e8];return _0x1e8758;};'use strict';var _=require('lodash');var util=require(_0x823b('0x0'));var moment=require(_0x823b('0x1'));var BPromise=require(_0x823b('0x2'));var rs=require(_0x823b('0x3'));var fs=require('fs');var Redis=require(_0x823b('0x4'));var db=require(_0x823b('0x5'))['db'];var utils=require(_0x823b('0x6'));var logger=require('../../config/logger')(_0x823b('0x7'));var config=require(_0x823b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x823b('0x9')][_0x823b('0xa')]({'port':0x232a});config[_0x823b('0xb')]=_[_0x823b('0xc')](config[_0x823b('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x823b('0xd'))(new Redis(config[_0x823b('0xb')]));require(_0x823b('0xe'))[_0x823b('0xf')](socket);function respondWithRpcPromise(_0x30a353,_0x1e6079,_0xdc5772){return new BPromise(function(_0x4d494c,_0x24c6b8){return client['request'](_0x30a353,_0xdc5772)[_0x823b('0x10')](function(_0x1ba037){logger[_0x823b('0x11')](_0x823b('0x12'),_0x1e6079,_0x823b('0x13'));logger['debug']('Notification,\x20%s,\x20%s,\x20%s',_0x1e6079,_0x823b('0x13'),JSON['stringify'](_0x1ba037));if(_0x1ba037[_0x823b('0x14')]){if(_0x1ba037[_0x823b('0x14')][_0x823b('0x15')]===0x1f4){logger[_0x823b('0x14')]('Notification,\x20%s,\x20%s',_0x1e6079,_0x1ba037['error'][_0x823b('0x16')]);return _0x24c6b8(_0x1ba037['error'][_0x823b('0x16')]);}logger[_0x823b('0x14')](_0x823b('0x12'),_0x1e6079,_0x1ba037[_0x823b('0x14')][_0x823b('0x16')]);return _0x4d494c(_0x1ba037[_0x823b('0x14')][_0x823b('0x16')]);}else{logger['info'](_0x823b('0x12'),_0x1e6079,_0x823b('0x13'));_0x4d494c(_0x1ba037[_0x823b('0x17')][_0x823b('0x16')]);}})[_0x823b('0x18')](function(_0x46e754){logger[_0x823b('0x14')](_0x823b('0x12'),_0x1e6079,_0x46e754);_0x24c6b8(_0x46e754);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 24851c4..edd3593 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0ca=['register','length','notification:','./notification.events','save','remove','update','emit','removeListener'];(function(_0x250b8b,_0x1d3b34){var _0x458585=function(_0x53147d){while(--_0x53147d){_0x250b8b['push'](_0x250b8b['shift']());}};_0x458585(++_0x1d3b34);}(_0xb0ca,0x1ce));var _0xab0c=function(_0x569ec5,_0x5ab480){_0x569ec5=_0x569ec5-0x0;var _0x185e84=_0xb0ca[_0x569ec5];return _0x185e84;};'use strict';var NotificationEvents=require(_0xab0c('0x0'));var events=[_0xab0c('0x1'),_0xab0c('0x2'),_0xab0c('0x3')];function createListener(_0x39dce1,_0x235435){return function(_0x46648f){_0x235435[_0xab0c('0x4')](_0x39dce1,_0x46648f);};}function removeListener(_0x1a7902,_0x3a92c2){return function(){NotificationEvents[_0xab0c('0x5')](_0x1a7902,_0x3a92c2);};}exports[_0xab0c('0x6')]=function(_0x1f4feb){for(var _0x478ae7=0x0,_0x1e0bb7=events[_0xab0c('0x7')];_0x478ae7<_0x1e0bb7;_0x478ae7++){var _0x4ecda5=events[_0x478ae7];var _0x4d7684=createListener(_0xab0c('0x8')+_0x4ecda5,_0x1f4feb);NotificationEvents['on'](_0x4ecda5,_0x4d7684);}}; \ No newline at end of file +var _0x5e22=['removeListener','register','notification:','./notification.events','save','remove','update'];(function(_0xc4298f,_0x5488e4){var _0x2926be=function(_0x4f1ae0){while(--_0x4f1ae0){_0xc4298f['push'](_0xc4298f['shift']());}};_0x2926be(++_0x5488e4);}(_0x5e22,0x1d8));var _0x25e2=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x5e22[_0x2261ce];return _0x524640;};'use strict';var NotificationEvents=require(_0x25e2('0x0'));var events=[_0x25e2('0x1'),_0x25e2('0x2'),_0x25e2('0x3')];function createListener(_0x21715b,_0x303652){return function(_0x7d8fee){_0x303652['emit'](_0x21715b,_0x7d8fee);};}function removeListener(_0x25350f,_0x68bb24){return function(){NotificationEvents[_0x25e2('0x4')](_0x25350f,_0x68bb24);};}exports[_0x25e2('0x5')]=function(_0x6922f2){for(var _0x32e58f=0x0,_0xf849cb=events['length'];_0x32e58f<_0xf849cb;_0x32e58f++){var _0x11341b=events[_0x32e58f];var _0x305b7d=createListener(_0x25e2('0x6')+_0x11341b,_0x6922f2);NotificationEvents['on'](_0x11341b,_0x305b7d);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index ec5e0be..56d58f1 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 _0xa265=['destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0xa265,0x13d));var _0x5a26=function(_0x21521c,_0x31c977){_0x21521c=_0x21521c-0x0;var _0x3293f6=_0xa265[_0x21521c];return _0x3293f6;};'use strict';var multer=require(_0x5a26('0x0'));var util=require(_0x5a26('0x1'));var path=require(_0x5a26('0x2'));var timeout=require(_0x5a26('0x3'));var express=require(_0x5a26('0x4'));var router=express['Router']();var auth=require(_0x5a26('0x5'));var interaction=require(_0x5a26('0x6'));var config=require(_0x5a26('0x7'));var controller=require(_0x5a26('0x8'));router[_0x5a26('0x9')]('/',auth[_0x5a26('0xa')](),controller['index']);router['get'](_0x5a26('0xb'),auth['isAuthenticated'](),controller[_0x5a26('0xc')]);router['get'](_0x5a26('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5a26('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5a26('0xe')]);router[_0x5a26('0x9')](_0x5a26('0xf'),auth[_0x5a26('0xa')](),controller[_0x5a26('0x10')]);router[_0x5a26('0x9')](_0x5a26('0x11'),auth['isAuthenticated'](),controller[_0x5a26('0x12')]);router[_0x5a26('0x9')](_0x5a26('0x13'),auth[_0x5a26('0xa')](),controller['getInteractions']);router[_0x5a26('0x9')](_0x5a26('0x14'),auth[_0x5a26('0xa')](),controller[_0x5a26('0x15')]);router[_0x5a26('0x16')]('/',auth[_0x5a26('0xa')](),controller[_0x5a26('0x17')]);router[_0x5a26('0x16')](_0x5a26('0x18'),auth[_0x5a26('0xa')](),controller[_0x5a26('0x19')]);router[_0x5a26('0x16')](_0x5a26('0xf'),auth[_0x5a26('0xa')](),controller[_0x5a26('0x1a')]);router[_0x5a26('0x16')](_0x5a26('0x1b'),controller[_0x5a26('0x1c')]);router[_0x5a26('0x16')](_0x5a26('0x11'),auth['isAuthenticated'](),controller[_0x5a26('0x1d')]);router['post'](_0x5a26('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0x5a26('0x16')](_0x5a26('0x1e'),auth[_0x5a26('0xa')](),controller[_0x5a26('0x1f')]);router[_0x5a26('0x20')](_0x5a26('0xd'),auth[_0x5a26('0xa')](),controller[_0x5a26('0x21')]);router['delete']('/:id',auth[_0x5a26('0xa')](),controller[_0x5a26('0x22')]);router[_0x5a26('0x23')]('/:id/dispositions',auth[_0x5a26('0xa')](),controller[_0x5a26('0x24')]);router[_0x5a26('0x23')](_0x5a26('0xf'),auth[_0x5a26('0xa')](),controller[_0x5a26('0x25')]);router[_0x5a26('0x23')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x5a26('0x26')]=router; \ No newline at end of file +var _0x87e8=['/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','addApplications','send','put','update','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x4fd381,_0x353a9d){var _0x4a6056=function(_0xc4133b){while(--_0xc4133b){_0x4fd381['push'](_0x4fd381['shift']());}};_0x4a6056(++_0x353a9d);}(_0x87e8,0x1ac));var _0x887e=function(_0x928b87,_0x53480a){_0x928b87=_0x928b87-0x0;var _0x1e7638=_0x87e8[_0x928b87];return _0x1e7638;};'use strict';var multer=require(_0x887e('0x0'));var util=require(_0x887e('0x1'));var path=require('path');var timeout=require(_0x887e('0x2'));var express=require(_0x887e('0x3'));var router=express[_0x887e('0x4')]();var auth=require(_0x887e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x887e('0x6'));var controller=require(_0x887e('0x7'));router[_0x887e('0x8')]('/',auth[_0x887e('0x9')](),controller[_0x887e('0xa')]);router['get'](_0x887e('0xb'),auth[_0x887e('0x9')](),controller[_0x887e('0xc')]);router['get'](_0x887e('0xd'),auth[_0x887e('0x9')](),controller[_0x887e('0xe')]);router[_0x887e('0x8')](_0x887e('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x887e('0x10'),auth[_0x887e('0x9')](),controller[_0x887e('0x11')]);router[_0x887e('0x8')](_0x887e('0x12'),auth[_0x887e('0x9')](),controller['getApplications']);router['get'](_0x887e('0x13'),auth['isAuthenticated'](),controller[_0x887e('0x14')]);router[_0x887e('0x8')](_0x887e('0x15'),auth[_0x887e('0x9')](),controller[_0x887e('0x16')]);router['post']('/',auth[_0x887e('0x9')](),controller[_0x887e('0x17')]);router[_0x887e('0x18')](_0x887e('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x887e('0x10'),auth[_0x887e('0x9')](),controller[_0x887e('0x19')]);router['post'](_0x887e('0x1a'),controller[_0x887e('0x1b')]);router['post'](_0x887e('0x12'),auth[_0x887e('0x9')](),controller[_0x887e('0x1c')]);router[_0x887e('0x18')](_0x887e('0x15'),auth[_0x887e('0x9')](),controller['addAgents']);router[_0x887e('0x18')]('/:id/send',auth[_0x887e('0x9')](),controller[_0x887e('0x1d')]);router[_0x887e('0x1e')](_0x887e('0xd'),auth['isAuthenticated'](),controller[_0x887e('0x1f')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0x887e('0x9')](),controller[_0x887e('0x20')]);router[_0x887e('0x21')]('/:id/canned_answers',auth[_0x887e('0x9')](),controller[_0x887e('0x22')]);router[_0x887e('0x21')](_0x887e('0x15'),auth['isAuthenticated'](),controller[_0x887e('0x23')]);module[_0x887e('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e76fcd7..db03ecc 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 _0x29a3=['name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x216b8a,_0x459a11){var _0x344626=function(_0x27c690){while(--_0x27c690){_0x216b8a['push'](_0x216b8a['shift']());}};_0x344626(++_0x459a11);}(_0x29a3,0x15b));var _0x329a=function(_0x45c2f4,_0xdeb5a0){_0x45c2f4=_0x45c2f4-0x0;var _0x489990=_0x29a3[_0x45c2f4];return _0x489990;};'use strict';var Sequelize=require(_0x329a('0x0'));var rs=require(_0x329a('0x1'));module[_0x329a('0x2')]={'name':{'type':Sequelize[_0x329a('0x3')],'unique':_0x329a('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x329a('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x329a('0x5')]();}},'replyUri':{'type':Sequelize[_0x329a('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x329a('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x329a('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x329a('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x329a('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x329a('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x329a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x329a('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x329a('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x329a('0x7')],'defaultValue':![],'comment':_0x329a('0xa'),'set':function(_0x23ce65){if(!_0x23ce65)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x329a('0xb')](_0x329a('0xc'),_0x23ce65);}}}; \ No newline at end of file +var _0xac50=['name','generate','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x23e451,_0x29fe26){var _0x313a6d=function(_0x59b1f6){while(--_0x59b1f6){_0x23e451['push'](_0x23e451['shift']());}};_0x313a6d(++_0x29fe26);}(_0xac50,0xc9));var _0x0ac5=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xac50[_0x35885a];return _0xe86249;};'use strict';var Sequelize=require(_0x0ac5('0x0'));var rs=require('randomstring');module[_0x0ac5('0x1')]={'name':{'type':Sequelize[_0x0ac5('0x2')],'unique':_0x0ac5('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x0ac5('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0ac5('0x4')]();}},'replyUri':{'type':Sequelize[_0x0ac5('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x0ac5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0ac5('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0ac5('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0ac5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x0ac5('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0ac5('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0ac5('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x0ac5('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0ac5('0x9'),'set':function(_0x4d8c68){if(!_0x4d8c68)this[_0x0ac5('0xa')]('mandatoryDispositionPauseId',null);this[_0x0ac5('0xa')](_0x0ac5('0xb'),_0x4d8c68);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 6dd6739..f1ecd84 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 _0xee14=['length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','include','rows','catch','params','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','asc','ListId','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','priority','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','findAll','addAgents','omit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','emit','getAgents','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x237836,_0x5c9545){var _0x57806b=function(_0x538779){while(--_0x538779){_0x237836['push'](_0x237836['shift']());}};_0x57806b(++_0x5c9545);}(_0xee14,0x13a));var _0x4ee1=function(_0x3c6678,_0x5b7a3a){_0x3c6678=_0x3c6678-0x0;var _0x4cdff2=_0xee14[_0x3c6678];return _0x4cdff2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4ee1('0x0'));var zipdir=require(_0x4ee1('0x1'));var jsonpatch=require(_0x4ee1('0x2'));var rp=require(_0x4ee1('0x3'));var moment=require(_0x4ee1('0x4'));var BPromise=require(_0x4ee1('0x5'));var Mustache=require(_0x4ee1('0x6'));var util=require(_0x4ee1('0x7'));var path=require(_0x4ee1('0x8'));var sox=require('sox');var csv=require(_0x4ee1('0x9'));var ejs=require('ejs');var fs=require('fs');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('0x9'));var querystring=require('querystring');var Papa=require(_0x4ee1('0xf'));var Redis=require(_0x4ee1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4ee1('0x11'));var as=require(_0x4ee1('0x12'));var hardwareService=require(_0x4ee1('0x13'));var logger=require(_0x4ee1('0x14'))('api');var utils=require(_0x4ee1('0x15'));var config=require(_0x4ee1('0x16'));var licenseUtil=require(_0x4ee1('0x17'));var db=require(_0x4ee1('0x18'))['db'];config[_0x4ee1('0x19')]=_[_0x4ee1('0x1a')](config['redis'],{'host':_0x4ee1('0x1b'),'port':0x18eb});var socket=require(_0x4ee1('0x1c'))(new Redis(config[_0x4ee1('0x19')]));require(_0x4ee1('0x1d'))[_0x4ee1('0x1e')](socket);var jayson=require(_0x4ee1('0x1f'));var client=jayson[_0x4ee1('0x20')][_0x4ee1('0x21')]({'port':0x232c});var client9002=jayson[_0x4ee1('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9194,_0x38008f,_0x34651b,_0x1b1e0e){return new BPromise(function(_0x123c5e,_0x38fc33){var _0x2eff91=_0x1b1e0e||client;return _0x2eff91[_0x4ee1('0x22')](_0x2f9194,_0x34651b)[_0x4ee1('0x23')](function(_0x3a0967){logger[_0x4ee1('0x24')]('OpenchannelAccount,\x20%s,\x20%s',_0x38008f,_0x4ee1('0x25'));logger[_0x4ee1('0x26')](_0x4ee1('0x27'),_0x38008f,_0x4ee1('0x25'),JSON[_0x4ee1('0x28')](_0x3a0967));if(_0x3a0967[_0x4ee1('0x29')]){if(_0x3a0967['error'][_0x4ee1('0x2a')]===0x1f4){logger[_0x4ee1('0x29')](_0x4ee1('0x2b'),_0x38008f,_0x3a0967[_0x4ee1('0x29')][_0x4ee1('0x2c')]);return _0x38fc33(_0x3a0967[_0x4ee1('0x29')][_0x4ee1('0x2c')]);}logger[_0x4ee1('0x29')](_0x4ee1('0x2b'),_0x38008f,_0x3a0967[_0x4ee1('0x29')]['message']);return _0x123c5e(_0x3a0967['error'][_0x4ee1('0x2c')]);}else{logger[_0x4ee1('0x24')](_0x4ee1('0x2b'),_0x38008f,_0x4ee1('0x25'));_0x123c5e(_0x3a0967[_0x4ee1('0x2d')][_0x4ee1('0x2c')]);}})['catch'](function(_0x5cc0b5){logger[_0x4ee1('0x29')](_0x4ee1('0x2b'),_0x38008f,_0x5cc0b5);_0x38fc33(_0x5cc0b5);});});}function respondWithStatusCode(_0x4d39dd,_0x35900d){_0x35900d=_0x35900d||0xcc;return function(_0x213db8){if(_0x213db8){return _0x4d39dd[_0x4ee1('0x2e')](_0x35900d);}return _0x4d39dd[_0x4ee1('0x2f')](_0x35900d)[_0x4ee1('0x30')]();};}function respondWithResult(_0x3c7b2a,_0x45bd0d){_0x45bd0d=_0x45bd0d||0xc8;return function(_0x56c4d3){if(_0x56c4d3){return _0x3c7b2a[_0x4ee1('0x2f')](_0x45bd0d)['json'](_0x56c4d3);}};}function respondWithFilteredResult(_0x4746c2,_0x4ec408){return function(_0x3dc870){if(_0x3dc870){var _0x1d91be=_0x3dc870['count'],_0x59a34e=_0x4ec408[_0x4ee1('0x31')],_0x13944c=_0x4ec408['offset']+_0x4ec408[_0x4ee1('0x32')],_0x19ba11;if(_0x13944c>=_0x1d91be){_0x13944c=_0x1d91be;_0x19ba11=0xc8;}else{_0x19ba11=0xce;}_0x4746c2[_0x4ee1('0x2f')](_0x19ba11);return _0x4746c2[_0x4ee1('0x33')](_0x4ee1('0x34'),_0x59a34e+'-'+_0x13944c+'/'+_0x1d91be)[_0x4ee1('0x35')](_0x3dc870);}return null;};}function patchUpdates(_0x58b1a3){return function(_0xf66ab2){try{jsonpatch[_0x4ee1('0x36')](_0xf66ab2,_0x58b1a3,!![]);}catch(_0x422ba8){return BPromise[_0x4ee1('0x37')](_0x422ba8);}return _0xf66ab2[_0x4ee1('0x38')]();};}function saveUpdates(_0x393990,_0x5dbb15){return function(_0x4aa2b8){if(_0x4aa2b8){return _0x4aa2b8[_0x4ee1('0x39')](_0x393990)[_0x4ee1('0x23')](function(_0x41ab60){return _0x41ab60;});}return null;};}function removeEntity(_0x5a2f6f,_0x963c2b){return function(_0x3a57bf){if(_0x3a57bf){return _0x3a57bf[_0x4ee1('0x3a')]()[_0x4ee1('0x23')](function(){var _0x9f882d=_0x3a57bf[_0x4ee1('0x3b')]({'plain':!![]});var _0x1d3d64=_0x4ee1('0x3c');return db[_0x4ee1('0x3d')][_0x4ee1('0x3a')]({'where':{'type':_0x1d3d64,'resourceId':_0x9f882d['id']}})[_0x4ee1('0x23')](function(){return _0x3a57bf;});})[_0x4ee1('0x23')](function(){_0x5a2f6f[_0x4ee1('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x463d90,_0x3de40e){return function(_0x882468){if(!_0x882468){_0x463d90['sendStatus'](0x194);}return _0x882468;};}function handleError(_0x4858f9,_0x257f67){_0x257f67=_0x257f67||0x1f4;return function(_0x84480e){logger[_0x4ee1('0x29')](_0x84480e[_0x4ee1('0x3e')]);if(_0x84480e['name']){delete _0x84480e[_0x4ee1('0x3f')];}_0x4858f9[_0x4ee1('0x2f')](_0x257f67)[_0x4ee1('0x40')](_0x84480e);};}exports[_0x4ee1('0x41')]=function(_0x2653c4,_0x2445c2){var _0x194525={'include':[{'model':db[_0x4ee1('0x42')],'as':_0x4ee1('0x43')}]},_0x325b59={},_0x59b5cc={'count':0x0,'rows':[]};var _0x345003=_[_0x4ee1('0x44')](db[_0x4ee1('0x45')][_0x4ee1('0x46')],function(_0x543b2e){return{'name':_0x543b2e[_0x4ee1('0x47')],'type':_0x543b2e[_0x4ee1('0x48')][_0x4ee1('0x49')]};});_0x325b59[_0x4ee1('0x4a')]=_[_0x4ee1('0x44')](_0x345003,_0x4ee1('0x3f'));_0x325b59[_0x4ee1('0x4b')]=_[_0x4ee1('0x4c')](_0x2653c4[_0x4ee1('0x4b')]);_0x325b59[_0x4ee1('0x4d')]=_[_0x4ee1('0x4e')](_0x325b59[_0x4ee1('0x4a')],_0x325b59[_0x4ee1('0x4b')]);_0x194525['attributes']=_[_0x4ee1('0x4e')](_0x325b59[_0x4ee1('0x4a')],qs['fields'](_0x2653c4[_0x4ee1('0x4b')]['fields']));_0x194525[_0x4ee1('0x4f')]=_0x194525['attributes'][_0x4ee1('0x50')]?_0x194525[_0x4ee1('0x4f')]:_0x325b59['model'];if(!_0x2653c4[_0x4ee1('0x4b')][_0x4ee1('0x51')](_0x4ee1('0x52'))){_0x194525[_0x4ee1('0x32')]=qs['limit'](_0x2653c4[_0x4ee1('0x4b')][_0x4ee1('0x32')]);_0x194525[_0x4ee1('0x31')]=qs['offset'](_0x2653c4['query'][_0x4ee1('0x31')]);}_0x194525[_0x4ee1('0x53')]=qs[_0x4ee1('0x54')](_0x2653c4[_0x4ee1('0x4b')][_0x4ee1('0x54')]);_0x194525['where']=qs['filters'](_[_0x4ee1('0x55')](_0x2653c4[_0x4ee1('0x4b')],_0x325b59[_0x4ee1('0x4d')]),_0x345003);if(_0x2653c4[_0x4ee1('0x4b')]['filter']){_0x194525[_0x4ee1('0x56')]=_[_0x4ee1('0x57')](_0x194525['where'],{'$or':_[_0x4ee1('0x44')](_0x345003,function(_0x16dc20){if(_0x16dc20[_0x4ee1('0x48')]!==_0x4ee1('0x58')){var _0x38db17={};_0x38db17[_0x16dc20[_0x4ee1('0x3f')]]={'$like':'%'+_0x2653c4[_0x4ee1('0x4b')][_0x4ee1('0x59')]+'%'};return _0x38db17;}})});}_0x194525=_[_0x4ee1('0x57')]({},_0x194525,_0x2653c4['options']);var _0x49b667={'where':_0x194525[_0x4ee1('0x56')]};return db[_0x4ee1('0x45')][_0x4ee1('0x5a')](_0x49b667)[_0x4ee1('0x23')](function(_0x58e963){_0x59b5cc[_0x4ee1('0x5a')]=_0x58e963;if(_0x2653c4[_0x4ee1('0x4b')][_0x4ee1('0x5b')]){_0x194525[_0x4ee1('0x5c')]=[{'all':!![]}];}return db[_0x4ee1('0x45')]['findAll'](_0x194525);})[_0x4ee1('0x23')](function(_0x4ae560){_0x59b5cc[_0x4ee1('0x5d')]=_0x4ae560;return _0x59b5cc;})['then'](respondWithFilteredResult(_0x2445c2,_0x194525))[_0x4ee1('0x5e')](handleError(_0x2445c2,null));};exports['show']=function(_0x572bbd,_0x5a1114){var _0x30a1cd={'raw':![],'where':{'id':_0x572bbd[_0x4ee1('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0x4ee1('0x43')}]},_0x480796={};_0x480796[_0x4ee1('0x4a')]=_[_0x4ee1('0x4c')](db['OpenchannelAccount'][_0x4ee1('0x46')]);_0x480796[_0x4ee1('0x4b')]=_[_0x4ee1('0x4c')](_0x572bbd[_0x4ee1('0x4b')]);_0x480796[_0x4ee1('0x4d')]=_[_0x4ee1('0x4e')](_0x480796[_0x4ee1('0x4a')],_0x480796['query']);_0x30a1cd['attributes']=_[_0x4ee1('0x4e')](_0x480796[_0x4ee1('0x4a')],qs[_0x4ee1('0x60')](_0x572bbd[_0x4ee1('0x4b')][_0x4ee1('0x60')]));_0x30a1cd[_0x4ee1('0x4f')]=_0x30a1cd[_0x4ee1('0x4f')][_0x4ee1('0x50')]?_0x30a1cd[_0x4ee1('0x4f')]:_0x480796[_0x4ee1('0x4a')];if(_0x572bbd[_0x4ee1('0x4b')][_0x4ee1('0x5b')]){_0x30a1cd[_0x4ee1('0x5c')]=[{'all':!![]}];}_0x30a1cd=_['merge']({},_0x30a1cd,_0x572bbd[_0x4ee1('0x61')]);return db['OpenchannelAccount'][_0x4ee1('0x62')](_0x30a1cd)[_0x4ee1('0x23')](handleEntityNotFound(_0x5a1114,null))['then'](respondWithResult(_0x5a1114,null))[_0x4ee1('0x5e')](handleError(_0x5a1114,null));};exports[_0x4ee1('0x63')]=function(_0x5243bd,_0x54808b){return db[_0x4ee1('0x45')]['create'](_0x5243bd[_0x4ee1('0x64')],{})[_0x4ee1('0x23')](function(_0x59ba70){var _0x43489c=_0x5243bd[_0x4ee1('0x65')][_0x4ee1('0x3b')]({'plain':!![]});if(!_0x43489c)throw new Error(_0x4ee1('0x66'));if(_0x43489c[_0x4ee1('0x67')]===_0x4ee1('0x65')){var _0x11f619=_0x59ba70['get']({'plain':!![]});var _0x533a6b=_0x4ee1('0x3c');return db[_0x4ee1('0x68')]['find']({'where':{'name':_0x533a6b,'userProfileId':_0x43489c[_0x4ee1('0x69')]},'raw':!![]})[_0x4ee1('0x23')](function(_0x330736){if(_0x330736&&_0x330736['autoAssociation']===0x0){return db[_0x4ee1('0x3d')]['create']({'name':_0x11f619[_0x4ee1('0x3f')],'resourceId':_0x11f619['id'],'type':_0x330736['name'],'sectionId':_0x330736['id']},{})['then'](function(){return _0x59ba70;});}else{return _0x59ba70;}})[_0x4ee1('0x5e')](function(_0x16fcd0){logger[_0x4ee1('0x29')](_0x4ee1('0x6a'),_0x16fcd0);throw _0x16fcd0;});}return _0x59ba70;})[_0x4ee1('0x23')](respondWithResult(_0x54808b,0xc9))['catch'](handleError(_0x54808b,null));};exports[_0x4ee1('0x39')]=function(_0x41d269,_0x10f4e){if(_0x41d269['body']['id']){delete _0x41d269[_0x4ee1('0x64')]['id'];}return db[_0x4ee1('0x45')][_0x4ee1('0x62')]({'where':{'id':_0x41d269[_0x4ee1('0x5f')]['id']},'include':[{'model':db[_0x4ee1('0x42')],'as':_0x4ee1('0x43')}]})[_0x4ee1('0x23')](handleEntityNotFound(_0x10f4e,null))[_0x4ee1('0x23')](saveUpdates(_0x41d269[_0x4ee1('0x64')],null))[_0x4ee1('0x23')](respondWithResult(_0x10f4e,null))[_0x4ee1('0x5e')](handleError(_0x10f4e,null));};exports[_0x4ee1('0x3a')]=function(_0x5d396c,_0x10cc37){return db['OpenchannelAccount'][_0x4ee1('0x62')]({'where':{'id':_0x5d396c['params']['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x10cc37,null))[_0x4ee1('0x23')](removeEntity(_0x10cc37,null))[_0x4ee1('0x5e')](handleError(_0x10cc37,null));};exports[_0x4ee1('0x6b')]=function(_0xf368bb,_0x272461){return db[_0x4ee1('0x45')][_0x4ee1('0x6b')]()[_0x4ee1('0x23')](respondWithResult(_0x272461,null))[_0x4ee1('0x5e')](handleError(_0x272461,null));};exports[_0x4ee1('0x6c')]=function(_0x19ec51,_0x4eb653,_0x759888){if(_0x19ec51[_0x4ee1('0x64')]['id']){delete _0x19ec51[_0x4ee1('0x64')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x19ec51[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x4eb653,null))['then'](function(_0x318e43){if(_0x318e43){_0x19ec51[_0x4ee1('0x64')][_0x4ee1('0x6d')]=_0x318e43['id'];return db[_0x4ee1('0x6e')][_0x4ee1('0x63')](_0x19ec51[_0x4ee1('0x64')]);}})[_0x4ee1('0x23')](respondWithResult(_0x4eb653,null))[_0x4ee1('0x5e')](handleError(_0x4eb653,null));};exports[_0x4ee1('0x6f')]=function(_0x3824bf,_0x59ba73,_0x219153){var _0x40a90b={'raw':![],'where':{}};var _0x578c4d={};var _0x52bbda={'count':0x0,'rows':[]};return db[_0x4ee1('0x45')][_0x4ee1('0x70')]({'where':{'id':_0x3824bf[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x59ba73,null))[_0x4ee1('0x23')](function(_0x26b0ab){if(_0x26b0ab){_0x578c4d[_0x4ee1('0x4a')]=_['keys'](db[_0x4ee1('0x6e')][_0x4ee1('0x46')]);_0x578c4d[_0x4ee1('0x4b')]=_[_0x4ee1('0x4c')](_0x3824bf[_0x4ee1('0x4b')]);_0x578c4d['filters']=_[_0x4ee1('0x4e')](_0x578c4d['model'],_0x578c4d[_0x4ee1('0x4b')]);_0x40a90b[_0x4ee1('0x4f')]=_['intersection'](_0x578c4d['model'],qs[_0x4ee1('0x60')](_0x3824bf[_0x4ee1('0x4b')]['fields']));_0x40a90b[_0x4ee1('0x4f')]=_0x40a90b['attributes']['length']?_0x40a90b[_0x4ee1('0x4f')]:_0x578c4d[_0x4ee1('0x4a')];if(!_0x3824bf[_0x4ee1('0x4b')][_0x4ee1('0x51')](_0x4ee1('0x52'))){_0x40a90b[_0x4ee1('0x32')]=qs['limit'](_0x3824bf[_0x4ee1('0x4b')]['limit']);_0x40a90b['offset']=qs[_0x4ee1('0x31')](_0x3824bf[_0x4ee1('0x4b')][_0x4ee1('0x31')]);}_0x40a90b[_0x4ee1('0x53')]=qs[_0x4ee1('0x54')](_0x3824bf[_0x4ee1('0x4b')][_0x4ee1('0x54')]);_0x40a90b[_0x4ee1('0x56')]=qs['filters'](_[_0x4ee1('0x55')](_0x3824bf[_0x4ee1('0x4b')],_0x578c4d['filters']));_0x40a90b[_0x4ee1('0x56')][_0x4ee1('0x6d')]=_0x26b0ab['id'];if(_0x3824bf[_0x4ee1('0x4b')][_0x4ee1('0x59')]){_0x40a90b[_0x4ee1('0x56')]=_[_0x4ee1('0x57')](_0x40a90b[_0x4ee1('0x56')],{'$or':_['map'](_0x40a90b[_0x4ee1('0x4f')],function(_0x4f1c0e){var _0x844bff={};_0x844bff[_0x4f1c0e]={'$like':'%'+_0x3824bf[_0x4ee1('0x4b')][_0x4ee1('0x59')]+'%'};return _0x844bff;})});}_0x40a90b=_[_0x4ee1('0x57')]({},_0x40a90b,_0x3824bf['options']);return db[_0x4ee1('0x6e')][_0x4ee1('0x5a')]({'where':_0x40a90b[_0x4ee1('0x56')]})['then'](function(_0x4b8765){_0x52bbda[_0x4ee1('0x5a')]=_0x4b8765;if(_0x3824bf['query'][_0x4ee1('0x5b')]){_0x40a90b[_0x4ee1('0x5c')]=[{'all':!![]}];}return db[_0x4ee1('0x6e')]['findAll'](_0x40a90b);})['then'](function(_0x27fd3b){_0x52bbda[_0x4ee1('0x5d')]=_0x27fd3b;return _0x52bbda;});}})[_0x4ee1('0x23')](respondWithFilteredResult(_0x59ba73,_0x40a90b))[_0x4ee1('0x5e')](handleError(_0x59ba73,null));};exports[_0x4ee1('0x71')]=function(_0x335c90,_0x458e18,_0x5727ef){return db['OpenchannelAccount']['find']({'where':{'id':_0x335c90[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x458e18,null))[_0x4ee1('0x23')](function(_0xd919bc){if(_0xd919bc){return _0xd919bc['removeDispositions'](_0x335c90[_0x4ee1('0x4b')]['ids']);}})[_0x4ee1('0x23')](respondWithStatusCode(_0x458e18,null))[_0x4ee1('0x5e')](handleError(_0x458e18,null));};exports[_0x4ee1('0x72')]=function(_0x362ab7,_0x38a62e,_0x190f59){if(_0x362ab7['body']['id']){delete _0x362ab7[_0x4ee1('0x64')]['id'];}return db[_0x4ee1('0x45')][_0x4ee1('0x62')]({'where':{'id':_0x362ab7[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x38a62e,null))[_0x4ee1('0x23')](function(_0x3c3fc8){if(_0x3c3fc8){_0x362ab7[_0x4ee1('0x64')][_0x4ee1('0x6d')]=_0x3c3fc8['id'];return db[_0x4ee1('0x73')][_0x4ee1('0x63')](_0x362ab7['body']);}})[_0x4ee1('0x23')](respondWithResult(_0x38a62e,null))[_0x4ee1('0x5e')](handleError(_0x38a62e,null));};exports[_0x4ee1('0x74')]=function(_0x248f25,_0x3dca3f,_0x2d1fb4){var _0x2beffb={'raw':![],'where':{}};var _0xb223a4={};var _0x4c6025={'count':0x0,'rows':[]};return db[_0x4ee1('0x45')][_0x4ee1('0x70')]({'where':{'id':_0x248f25[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x3dca3f,null))[_0x4ee1('0x23')](function(_0x3468f5){if(_0x3468f5){_0xb223a4[_0x4ee1('0x4a')]=_['keys'](db[_0x4ee1('0x73')][_0x4ee1('0x46')]);_0xb223a4['query']=_[_0x4ee1('0x4c')](_0x248f25[_0x4ee1('0x4b')]);_0xb223a4['filters']=_['intersection'](_0xb223a4[_0x4ee1('0x4a')],_0xb223a4['query']);_0x2beffb[_0x4ee1('0x4f')]=_[_0x4ee1('0x4e')](_0xb223a4['model'],qs[_0x4ee1('0x60')](_0x248f25[_0x4ee1('0x4b')][_0x4ee1('0x60')]));_0x2beffb[_0x4ee1('0x4f')]=_0x2beffb['attributes'][_0x4ee1('0x50')]?_0x2beffb[_0x4ee1('0x4f')]:_0xb223a4[_0x4ee1('0x4a')];if(!_0x248f25[_0x4ee1('0x4b')][_0x4ee1('0x51')](_0x4ee1('0x52'))){_0x2beffb[_0x4ee1('0x32')]=qs[_0x4ee1('0x32')](_0x248f25['query'][_0x4ee1('0x32')]);_0x2beffb[_0x4ee1('0x31')]=qs['offset'](_0x248f25[_0x4ee1('0x4b')]['offset']);}_0x2beffb['order']=qs[_0x4ee1('0x54')](_0x248f25[_0x4ee1('0x4b')][_0x4ee1('0x54')]);_0x2beffb[_0x4ee1('0x56')]=qs[_0x4ee1('0x4d')](_[_0x4ee1('0x55')](_0x248f25['query'],_0xb223a4[_0x4ee1('0x4d')]));_0x2beffb[_0x4ee1('0x56')][_0x4ee1('0x6d')]=_0x3468f5['id'];if(_0x248f25[_0x4ee1('0x4b')][_0x4ee1('0x59')]){_0x2beffb[_0x4ee1('0x56')]=_[_0x4ee1('0x57')](_0x2beffb[_0x4ee1('0x56')],{'$or':_['map'](_0x2beffb[_0x4ee1('0x4f')],function(_0x3bb526){var _0x2704ed={};_0x2704ed[_0x3bb526]={'$like':'%'+_0x248f25[_0x4ee1('0x4b')][_0x4ee1('0x59')]+'%'};return _0x2704ed;})});}_0x2beffb=_['merge']({},_0x2beffb,_0x248f25[_0x4ee1('0x61')]);return db['CannedAnswer'][_0x4ee1('0x5a')]({'where':_0x2beffb[_0x4ee1('0x56')]})[_0x4ee1('0x23')](function(_0x3bcd9b){_0x4c6025['count']=_0x3bcd9b;if(_0x248f25[_0x4ee1('0x4b')][_0x4ee1('0x5b')]){_0x2beffb['include']=[{'all':!![]}];}return db[_0x4ee1('0x73')]['findAll'](_0x2beffb);})[_0x4ee1('0x23')](function(_0x2b141f){_0x4c6025['rows']=_0x2b141f;return _0x4c6025;});}})['then'](respondWithFilteredResult(_0x3dca3f,_0x2beffb))[_0x4ee1('0x5e')](handleError(_0x3dca3f,null));};exports[_0x4ee1('0x75')]=function(_0x5bba50,_0x573793,_0x53d4d7){return db[_0x4ee1('0x45')]['find']({'where':{'id':_0x5bba50[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x573793,null))[_0x4ee1('0x23')](function(_0x32436e){if(_0x32436e){return _0x32436e['removeAnswers'](_0x5bba50[_0x4ee1('0x4b')][_0x4ee1('0x76')]);}})['then'](respondWithStatusCode(_0x573793,null))[_0x4ee1('0x5e')](handleError(_0x573793,null));};exports[_0x4ee1('0x77')]=function(_0x25378d,_0x4b6db0,_0x50ea1d){var _0x2f6c31={'body':_0x25378d[_0x4ee1('0x64')],'channel':_0x4ee1('0x78')};var _0x2046a4=[];var _0x17ce67=[];var _0x114ef1={};var _0x322254=![];return db[_0x4ee1('0x79')][_0x4ee1('0x6b')]()[_0x4ee1('0x23')](function(_0x3be714){if(!_0x3be714){throw new db[(_0x4ee1('0x7a'))]['ValidationError'](_0x4ee1('0x7b'));}_0x2046a4=_[_0x4ee1('0x7c')](_[_0x4ee1('0x4c')](_0x3be714),[_0x4ee1('0x7d'),_0x4ee1('0x7e')]);_0x17ce67=_[_0x4ee1('0x7c')](_['keys'](_0x3be714),[_0x4ee1('0x7d'),'updatedAt',_0x4ee1('0x7f'),'ListId']);if(_0x25378d[_0x4ee1('0x64')]['id']){delete _0x25378d[_0x4ee1('0x64')]['id'];}if(_[_0x4ee1('0x80')](_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x81')])){throw new db[(_0x4ee1('0x7a'))][(_0x4ee1('0x82'))](_0x4ee1('0x83'));}if(_[_0x4ee1('0x80')](_0x25378d['body'][_0x4ee1('0x64')])||_0x25378d[_0x4ee1('0x64')]['body']===''){throw new db[(_0x4ee1('0x7a'))][(_0x4ee1('0x82'))](_0x4ee1('0x84'));}if(_[_0x4ee1('0x80')](_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x85')])){throw new db[(_0x4ee1('0x7a'))]['ValidationError'](_0x4ee1('0x86')+_0x17ce67);}if(!_[_0x4ee1('0x87')](_0x17ce67,_0x25378d[_0x4ee1('0x64')]['mapKey'])){throw new db[(_0x4ee1('0x7a'))][(_0x4ee1('0x82'))](_0x4ee1('0x88')+_0x17ce67);}_0x114ef1[_0x25378d['body']['mapKey']]=_0x25378d[_0x4ee1('0x64')]['from'];})[_0x4ee1('0x23')](function(){return db[_0x4ee1('0x45')][_0x4ee1('0x62')]({'where':{'id':_0x25378d['params']['id']},'include':[{'model':db[_0x4ee1('0x89')],'as':_0x4ee1('0x8a'),'include':[{'model':db[_0x4ee1('0x79')],'as':_0x4ee1('0x8b'),'where':_0x114ef1,'limit':0x1,'order':[[_0x4ee1('0x7e'),_0x4ee1('0x8c')]]}]},{'model':db[_0x4ee1('0x8d')],'as':_0x4ee1('0x8e')}]});})['then'](handleEntityNotFound(_0x4b6db0,null))[_0x4ee1('0x23')](function(_0x387999){if(_0x387999&&_0x387999[_0x4ee1('0x8a')]){_0x2f6c31[_0x4ee1('0x8f')]=_0x387999;_0x2f6c31[_0x4ee1('0x90')]=_0x387999[_0x4ee1('0x8e')];_0x2f6c31[_0x4ee1('0x91')]=_0x387999['List'];_0x2f6c31[_0x4ee1('0x90')]=_['orderBy'](_0x2f6c31[_0x4ee1('0x90')],['priority'],[_0x4ee1('0x92')]);if(_0x2f6c31[_0x4ee1('0x8f')][_0x4ee1('0x8e')]){delete _0x2f6c31[_0x4ee1('0x8f')]['Applications'];}if(_0x2f6c31['account'][_0x4ee1('0x8a')]&&_0x2f6c31[_0x4ee1('0x8f')]['List'][_0x4ee1('0x8b')][_0x4ee1('0x50')]){return _0x2f6c31[_0x4ee1('0x8f')]['List'][_0x4ee1('0x8b')][0x0];}var _0x2e2dad=_[_0x4ee1('0x1a')](_0x25378d['body'],{'firstName':_0x25378d[_0x4ee1('0x64')]['from'],'ListId':_0x387999[_0x4ee1('0x93')]});_0x2e2dad[_0x25378d['body'][_0x4ee1('0x85')]]=_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x81')];return db[_0x4ee1('0x79')][_0x4ee1('0x63')](_0x2e2dad,{'fields':_0x2046a4,'raw':!![]});}})[_0x4ee1('0x23')](handleEntityNotFound(_0x4b6db0,null))[_0x4ee1('0x23')](function(_0x55e83f){_0x2f6c31[_0x4ee1('0x94')]=_0x55e83f;if(_0x55e83f){var _0x42a1c0={'ContactId':_0x55e83f['id'],'OpenchannelAccountId':_0x25378d[_0x4ee1('0x5f')]['id'],'from':(_0x55e83f[_0x4ee1('0x95')]||'')+'\x20'+(_0x55e83f[_0x4ee1('0x96')]||'')};var _0x1acaa5={'OpenchannelAccountId':_0x25378d['params']['id'],'closed':![]};if(_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x97')]){_0x1acaa5['threadId']=_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x97')];return db['OpenchannelInteraction'][_0x4ee1('0x62')]({'where':_0x1acaa5})[_0x4ee1('0x23')](function(_0x39864d){if(_0x39864d){return[_0x39864d,![]];}_0x42a1c0[_0x4ee1('0x97')]=_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x97')];_0x42a1c0[_0x4ee1('0x98')]=_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x98')];return db[_0x4ee1('0x99')][_0x4ee1('0x63')](_0x42a1c0)['then'](function(_0x4206a7){return[_0x4206a7,!![]];});});}else{_0x1acaa5[_0x4ee1('0x97')]=null;}_0x1acaa5[_0x4ee1('0x9a')]=_0x55e83f['id'];return db[_0x4ee1('0x99')]['find']({'where':_0x1acaa5})[_0x4ee1('0x23')](function(_0x38595b){if(_0x38595b){return[_0x38595b,![]];}return db[_0x4ee1('0x99')][_0x4ee1('0x63')](_0x42a1c0)[_0x4ee1('0x23')](function(_0x205189){return[_0x205189,!![]];});});}})[_0x4ee1('0x9b')](function(_0x46fd83,_0x347de3){if(_0x46fd83){_0x322254=_0x347de3;if(!_0x347de3){var _0x1cb8dd={'from':(_0x2f6c31['contact'][_0x4ee1('0x95')]||'')+'\x20'+(_0x2f6c31['contact'][_0x4ee1('0x96')]||'')};if(_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x97')]&&_0x25378d['body'][_0x4ee1('0x9c')]&&_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x97')]!=_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x9c')]){_0x1cb8dd[_0x4ee1('0x97')]=_0x25378d[_0x4ee1('0x64')]['messageId'];}return _0x46fd83['update'](_0x1cb8dd);}else{return _0x46fd83;}}})[_0x4ee1('0x23')](function(_0x4a811b){_0x2f6c31[_0x4ee1('0x9d')]=_0x4a811b[_0x4ee1('0x3b')]({'plain':!![]});_0x2f6c31[_0x4ee1('0x9d')][_0x4ee1('0x9e')]=_0x322254;if(_0x2f6c31[_0x4ee1('0x9d')][_0x4ee1('0x9e')]){if(_0x2f6c31[_0x4ee1('0x8f')]['autoclose']){_0x2f6c31[_0x4ee1('0x90')][_0x4ee1('0x9f')]({'id':0x0,'priority':_0x2f6c31['applications']['length']+0x1,'app':_0x4ee1('0xa0'),'appdata':_0x4ee1('0xa1'),'interval':_0x4ee1('0xa2')});}}return db[_0x4ee1('0xa3')]['create']({'body':_0x25378d[_0x4ee1('0x64')][_0x4ee1('0x64')],'OpenchannelAccountId':_0x25378d[_0x4ee1('0x5f')]['id'],'OpenchannelInteractionId':_0x4a811b['id'],'direction':'in','ContactId':_0x2f6c31['contact']['id'],'AttachmentId':_0x25378d[_0x4ee1('0x64')][_0x4ee1('0xa4')]});})[_0x4ee1('0x23')](function(_0xdc201b){_0x2f6c31[_0x4ee1('0x2c')]=_0xdc201b;if(_0x2f6c31[_0x4ee1('0x9d')][_0x4ee1('0xa5')]){return db[_0x4ee1('0xa6')][_0x4ee1('0x62')]({'attributes':['id',_0x4ee1('0x3f')],'where':{'id':_0x2f6c31[_0x4ee1('0x9d')][_0x4ee1('0xa5')]}})['then'](function(_0x276895){if(_0x276895){_0x2f6c31[_0x4ee1('0x90')][_0x4ee1('0xa7')]({'id':0x0,'priority':0x0,'app':_0x4ee1('0xa8'),'appdata':_0x276895[_0x4ee1('0x3f')]+','+(_0x2f6c31[_0x4ee1('0x8f')][_0x4ee1('0xa9')]||0xa),'interval':_0x4ee1('0xa2')});_0x2f6c31[_0x4ee1('0xaa')]=![];}return respondWithRpcPromise(_0x4ee1('0xab'),'startRouting',_0x2f6c31);});}return respondWithRpcPromise(_0x4ee1('0xab'),_0x4ee1('0xac'),_0x2f6c31);})[_0x4ee1('0x23')](function(_0x4fa1b8){respondWithRpcPromise(_0x4ee1('0xad'),'EventManager',{'event':_0x4ee1('0x77'),'message':_0x4fa1b8},client9002);return _0x4fa1b8;})[_0x4ee1('0x23')](respondWithResult(_0x4b6db0,null))[_0x4ee1('0x5e')](handleError(_0x4b6db0,null));};exports[_0x4ee1('0xae')]=function(_0x1e399e,_0x466219,_0x52f1e4){return db[_0x4ee1('0x45')][_0x4ee1('0x70')]({'where':{'id':_0x1e399e['params']['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x466219,null))[_0x4ee1('0x23')](function(_0xe5dd85){if(_0xe5dd85){return db[_0x4ee1('0xaf')][_0x4ee1('0xb0')](function(_0x2ebf0c){return db[_0x4ee1('0x8d')][_0x4ee1('0x3a')]({'where':{'OpenchannelAccountId':_0x1e399e[_0x4ee1('0x5f')]['id']},'transaction':_0x2ebf0c})[_0x4ee1('0x23')](function(_0x4b3cbc){var _0x1f8452=_[_0x4ee1('0x44')](_0x1e399e[_0x4ee1('0x64')],function(_0x731079){_0x731079[_0x4ee1('0x6d')]=_0x1e399e[_0x4ee1('0x5f')]['id'];return _0x731079;});return db['OpenchannelApplication']['bulkCreate'](_0x1f8452,{'transaction':_0x2ebf0c});});})[_0x4ee1('0x23')](function(){return db[_0x4ee1('0x8d')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x1e399e[_0x4ee1('0x5f')]['id']},'order':_0x4ee1('0xb1')});});}})[_0x4ee1('0x23')](respondWithResult(_0x466219,null))[_0x4ee1('0x5e')](handleError(_0x466219,null));};exports[_0x4ee1('0xb2')]=function(_0x381b0b,_0x350fa0,_0x1921db){var _0x35db5f={};var _0x5c555d={};var _0x33d924;var _0x4e55ce;return db[_0x4ee1('0x45')][_0x4ee1('0x70')]({'where':{'id':_0x381b0b[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x350fa0,null))[_0x4ee1('0x23')](function(_0x5805a3){if(_0x5805a3){_0x33d924=_0x5805a3;_0x5c555d['model']=_[_0x4ee1('0x4c')](db[_0x4ee1('0x8d')]['rawAttributes']);_0x5c555d[_0x4ee1('0x4b')]=_[_0x4ee1('0x4c')](_0x381b0b[_0x4ee1('0x4b')]);_0x5c555d[_0x4ee1('0x4d')]=_['intersection'](_0x5c555d[_0x4ee1('0x4a')],_0x5c555d['query']);_0x35db5f[_0x4ee1('0x4f')]=_['intersection'](_0x5c555d[_0x4ee1('0x4a')],qs[_0x4ee1('0x60')](_0x381b0b[_0x4ee1('0x4b')][_0x4ee1('0x60')]));_0x35db5f[_0x4ee1('0x4f')]=_0x35db5f[_0x4ee1('0x4f')][_0x4ee1('0x50')]?_0x35db5f[_0x4ee1('0x4f')]:_0x5c555d[_0x4ee1('0x4a')];_0x35db5f[_0x4ee1('0x53')]=qs['sort'](_0x381b0b[_0x4ee1('0x4b')]['sort']);_0x35db5f[_0x4ee1('0x56')]=qs['filters'](_['pick'](_0x381b0b[_0x4ee1('0x4b')],_0x5c555d[_0x4ee1('0x4d')]));if(_0x381b0b[_0x4ee1('0x4b')][_0x4ee1('0x59')]){_0x35db5f[_0x4ee1('0x56')]=_[_0x4ee1('0x57')](_0x35db5f[_0x4ee1('0x56')],{'$or':_[_0x4ee1('0x44')](_0x35db5f[_0x4ee1('0x4f')],function(_0x52caac){var _0x4e6764={};_0x4e6764[_0x52caac]={'$like':'%'+_0x381b0b[_0x4ee1('0x4b')]['filter']+'%'};return _0x4e6764;})});}_0x35db5f=_[_0x4ee1('0x57')]({},_0x35db5f,_0x381b0b[_0x4ee1('0x61')]);return _0x33d924[_0x4ee1('0xb2')](_0x35db5f);}})[_0x4ee1('0x23')](function(_0x184845){if(_0x184845){_0x4e55ce=_0x184845[_0x4ee1('0x50')];if(!_0x381b0b[_0x4ee1('0x4b')][_0x4ee1('0x51')](_0x4ee1('0x52'))){_0x35db5f[_0x4ee1('0x32')]=qs[_0x4ee1('0x32')](_0x381b0b[_0x4ee1('0x4b')][_0x4ee1('0x32')]);_0x35db5f[_0x4ee1('0x31')]=qs[_0x4ee1('0x31')](_0x381b0b['query'][_0x4ee1('0x31')]);}return _0x33d924[_0x4ee1('0xb2')](_0x35db5f);}})['then'](function(_0x174123){if(_0x174123){return _0x174123?{'count':_0x4e55ce,'rows':_0x174123}:null;}})[_0x4ee1('0x23')](respondWithResult(_0x350fa0,null))[_0x4ee1('0x5e')](handleError(_0x350fa0,null));};exports[_0x4ee1('0xb3')]=function(_0x57f729,_0x103af5,_0x3fa788){var _0x4cdf88={'raw':![],'where':{}};var _0x8c5c76={};var _0x1df9df={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x57f729[_0x4ee1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x103af5,null))[_0x4ee1('0x23')](function(_0x10c29f){if(_0x10c29f){_0x8c5c76[_0x4ee1('0x4a')]=_[_0x4ee1('0x4c')](db['OpenchannelInteraction'][_0x4ee1('0x46')]);_0x8c5c76['query']=_[_0x4ee1('0x4c')](_0x57f729[_0x4ee1('0x4b')]);_0x8c5c76[_0x4ee1('0x4d')]=_['intersection'](_0x8c5c76[_0x4ee1('0x4a')],_0x8c5c76[_0x4ee1('0x4b')]);_0x4cdf88[_0x4ee1('0x4f')]=_[_0x4ee1('0x4e')](_0x8c5c76[_0x4ee1('0x4a')],qs[_0x4ee1('0x60')](_0x57f729['query'][_0x4ee1('0x60')]));_0x4cdf88[_0x4ee1('0x4f')]=_0x4cdf88['attributes'][_0x4ee1('0x50')]?_0x4cdf88[_0x4ee1('0x4f')]:_0x8c5c76['model'];if(!_0x57f729[_0x4ee1('0x4b')][_0x4ee1('0x51')]('nolimit')){_0x4cdf88[_0x4ee1('0x32')]=qs['limit'](_0x57f729[_0x4ee1('0x4b')]['limit']);_0x4cdf88[_0x4ee1('0x31')]=qs['offset'](_0x57f729['query']['offset']);}_0x4cdf88['order']=qs[_0x4ee1('0x54')](_0x57f729['query'][_0x4ee1('0x54')]);_0x4cdf88[_0x4ee1('0x56')]=qs[_0x4ee1('0x4d')](_[_0x4ee1('0x55')](_0x57f729[_0x4ee1('0x4b')],_0x8c5c76[_0x4ee1('0x4d')]));_0x4cdf88[_0x4ee1('0x56')][_0x4ee1('0x6d')]=_0x10c29f['id'];if(_0x57f729[_0x4ee1('0x4b')][_0x4ee1('0x59')]){_0x4cdf88[_0x4ee1('0x56')]=_[_0x4ee1('0x57')](_0x4cdf88[_0x4ee1('0x56')],{'$or':_[_0x4ee1('0x44')](_0x4cdf88[_0x4ee1('0x4f')],function(_0x201d5d){var _0x3be22e={};_0x3be22e[_0x201d5d]={'$like':'%'+_0x57f729[_0x4ee1('0x4b')][_0x4ee1('0x59')]+'%'};return _0x3be22e;})});}_0x4cdf88=_[_0x4ee1('0x57')]({},_0x4cdf88,_0x57f729[_0x4ee1('0x61')]);return db[_0x4ee1('0x99')][_0x4ee1('0x5a')]({'where':_0x4cdf88[_0x4ee1('0x56')]})[_0x4ee1('0x23')](function(_0xbcc87a){_0x1df9df[_0x4ee1('0x5a')]=_0xbcc87a;if(_0x57f729[_0x4ee1('0x4b')][_0x4ee1('0x5b')]){_0x4cdf88[_0x4ee1('0x5c')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x4ee1('0xb4'),'attributes':[_0x4ee1('0x3f'),_0x4ee1('0xb5'),'internal'],'required':![]},{'model':db[_0x4ee1('0xb6')],'as':_0x4ee1('0xb7'),'attributes':['id',_0x4ee1('0x3f'),_0x4ee1('0xb8')],'where':_0x57f729[_0x4ee1('0x4b')][_0x4ee1('0xb9')]?{'id':_0x57f729[_0x4ee1('0x4b')][_0x4ee1('0xb9')]}:undefined,'required':_0x57f729[_0x4ee1('0x4b')][_0x4ee1('0xb9')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x4ee1('0xba')](_0x4cdf88);})[_0x4ee1('0x23')](function(_0x31651d){_0x1df9df[_0x4ee1('0x5d')]=_0x31651d;return _0x1df9df;});}})[_0x4ee1('0x23')](respondWithFilteredResult(_0x103af5,_0x4cdf88))[_0x4ee1('0x5e')](handleError(_0x103af5,null));};exports['addAgents']=function(_0x3fea38,_0x49569c,_0x404b93){return db[_0x4ee1('0x45')][_0x4ee1('0x62')]({'where':{'id':_0x3fea38[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x49569c,null))['then'](function(_0x2eb073){if(_0x2eb073){return _0x2eb073[_0x4ee1('0xbb')](_0x3fea38[_0x4ee1('0x64')][_0x4ee1('0x76')],_[_0x4ee1('0xbc')](_0x3fea38[_0x4ee1('0x64')],['ids','id'])||{})[_0x4ee1('0x9b')](function(_0x57fafb){for(var _0x28d6ca=0x0;_0x28d6ca<_0x3fea38[_0x4ee1('0x64')]['ids']['length'];_0x28d6ca+=0x1){socket['emit'](_0x4ee1('0xbd'),{'UserId':_0x3fea38['body']['ids'][_0x28d6ca],'OpenchannelAccountId':_0x3fea38[_0x4ee1('0x5f')]['id']});}return _0x57fafb;});}})[_0x4ee1('0x23')](respondWithResult(_0x49569c,null))['catch'](handleError(_0x49569c,null));};exports[_0x4ee1('0xbe')]=function(_0xc94228,_0x1b34d3,_0x503b57){return db[_0x4ee1('0x45')][_0x4ee1('0x62')]({'where':{'id':_0xc94228[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x1b34d3,null))[_0x4ee1('0x23')](function(_0x2d3a16){if(_0x2d3a16){return _0x2d3a16[_0x4ee1('0xbe')](_0xc94228['query'][_0x4ee1('0x76')])[_0x4ee1('0x23')](function(){if(_['isArray'](_0xc94228['query']['ids'])){for(var _0x112009=0x0;_0x112009<_0xc94228[_0x4ee1('0x4b')][_0x4ee1('0x76')]['length'];_0x112009+=0x1){socket['emit'](_0x4ee1('0xbf'),{'UserId':Number(_0xc94228['query'][_0x4ee1('0x76')][_0x112009]),'OpenchannelAccountId':Number(_0xc94228[_0x4ee1('0x5f')]['id'])});}}else{socket[_0x4ee1('0xc0')]('userOpenchannelAccount:remove',{'UserId':Number(_0xc94228[_0x4ee1('0x4b')][_0x4ee1('0x76')]),'OpenchannelAccountId':Number(_0xc94228['params']['id'])});}});}})[_0x4ee1('0x23')](respondWithStatusCode(_0x1b34d3,null))[_0x4ee1('0x5e')](handleError(_0x1b34d3,null));};exports[_0x4ee1('0xc1')]=function(_0xf96a3e,_0x17333d,_0x1e82a0){var _0x2d4bcd={};var _0x5e2e11={};var _0x479ae9;var _0x2e36d1;return db['OpenchannelAccount'][_0x4ee1('0x70')]({'where':{'id':_0xf96a3e[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x17333d,null))['then'](function(_0x3ed355){if(_0x3ed355){_0x479ae9=_0x3ed355;_0x5e2e11[_0x4ee1('0x4a')]=_[_0x4ee1('0x4c')](db[_0x4ee1('0xa6')][_0x4ee1('0x46')]);_0x5e2e11['query']=_[_0x4ee1('0x4c')](_0xf96a3e['query']);_0x5e2e11[_0x4ee1('0x4d')]=_[_0x4ee1('0x4e')](_0x5e2e11['model'],_0x5e2e11[_0x4ee1('0x4b')]);_0x2d4bcd[_0x4ee1('0x4f')]=_[_0x4ee1('0x4e')](_0x5e2e11[_0x4ee1('0x4a')],qs['fields'](_0xf96a3e[_0x4ee1('0x4b')][_0x4ee1('0x60')]));_0x2d4bcd['attributes']=_0x2d4bcd['attributes'][_0x4ee1('0x50')]?_0x2d4bcd[_0x4ee1('0x4f')]:_0x5e2e11[_0x4ee1('0x4a')];_0x2d4bcd[_0x4ee1('0x53')]=qs[_0x4ee1('0x54')](_0xf96a3e[_0x4ee1('0x4b')][_0x4ee1('0x54')]);_0x2d4bcd[_0x4ee1('0x56')]=qs[_0x4ee1('0x4d')](_['pick'](_0xf96a3e['query'],_0x5e2e11[_0x4ee1('0x4d')]));if(_0xf96a3e[_0x4ee1('0x4b')][_0x4ee1('0x59')]){_0x2d4bcd[_0x4ee1('0x56')]=_[_0x4ee1('0x57')](_0x2d4bcd['where'],{'$or':_['map'](_0x2d4bcd[_0x4ee1('0x4f')],function(_0x3c38ee){var _0x39fe98={};_0x39fe98[_0x3c38ee]={'$like':'%'+_0xf96a3e[_0x4ee1('0x4b')][_0x4ee1('0x59')]+'%'};return _0x39fe98;})});}_0x2d4bcd=_[_0x4ee1('0x57')]({},_0x2d4bcd,_0xf96a3e[_0x4ee1('0x61')]);return _0x479ae9[_0x4ee1('0xc1')](_0x2d4bcd);}})['then'](function(_0x454a55){if(_0x454a55){_0x2e36d1=_0x454a55[_0x4ee1('0x50')];if(!_0xf96a3e[_0x4ee1('0x4b')][_0x4ee1('0x51')]('nolimit')){_0x2d4bcd[_0x4ee1('0x32')]=qs[_0x4ee1('0x32')](_0xf96a3e[_0x4ee1('0x4b')][_0x4ee1('0x32')]);_0x2d4bcd['offset']=qs[_0x4ee1('0x31')](_0xf96a3e[_0x4ee1('0x4b')]['offset']);}return _0x479ae9[_0x4ee1('0xc1')](_0x2d4bcd);}})['then'](function(_0x562cc6){if(_0x562cc6){return _0x562cc6?{'count':_0x2e36d1,'rows':_0x562cc6}:null;}})[_0x4ee1('0x23')](respondWithResult(_0x17333d,null))['catch'](handleError(_0x17333d,null));};exports[_0x4ee1('0x40')]=function(_0x34316d,_0x2e3d7f,_0x58e754){var _0x520e56,_0x505eb0,_0x3adfaa;if(_[_0x4ee1('0x80')](_0x34316d[_0x4ee1('0x64')][_0x4ee1('0x64')])||_0x34316d['body']['body']===''){throw new db[(_0x4ee1('0x7a'))][(_0x4ee1('0x82'))](_0x4ee1('0x84'));}if(_['isNil'](_0x34316d[_0x4ee1('0x64')]['to'])){}_0x520e56=_0x34316d[_0x4ee1('0x64')]['to'];return db[_0x4ee1('0x45')][_0x4ee1('0x70')]({'where':{'id':_0x34316d[_0x4ee1('0x5f')]['id']}})[_0x4ee1('0x23')](handleEntityNotFound(_0x2e3d7f,null))[_0x4ee1('0x23')](function(_0x34e5f6){if(_0x34e5f6){return db[_0x4ee1('0x45')]['find']({'where':{'id':_0x34e5f6['id']},'include':[{'model':db[_0x4ee1('0x89')],'as':'List','include':[{'model':db[_0x4ee1('0x79')],'as':'Contacts','where':{[_0x34e5f6[_0x4ee1('0x85')]]:_0x520e56},'limit':0x1,'order':[[_0x4ee1('0x7e'),_0x4ee1('0x8c')]]}]}]})[_0x4ee1('0x23')](handleEntityNotFound(_0x2e3d7f,null))[_0x4ee1('0x23')](function(_0xa1efb3){if(_0xa1efb3&&_0xa1efb3[_0x4ee1('0x8a')]){_0x505eb0=_0xa1efb3[_0x4ee1('0x3b')]({'plain':!![]});if(_0x505eb0[_0x4ee1('0x8a')]&&_0x505eb0[_0x4ee1('0x8a')][_0x4ee1('0x8b')][_0x4ee1('0x50')]){return _0x505eb0[_0x4ee1('0x8a')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x4ee1('0x1a')](_0x34316d[_0x4ee1('0x64')],{'firstName':_0x520e56,[_0xa1efb3[_0x4ee1('0x85')]]:_0x520e56,'phone':_0x520e56,'ListId':_0x505eb0[_0x4ee1('0x93')]}));}})[_0x4ee1('0x23')](handleEntityNotFound(_0x2e3d7f,null))[_0x4ee1('0x23')](function(_0x37b222){if(_0x37b222){_0x3adfaa=_0x37b222;return db['OpenchannelInteraction'][_0x4ee1('0x62')]({'where':{'ContactId':_0x3adfaa['id'],'closed':![],'OpenchannelAccountId':_0x505eb0['id']}})['then'](function(_0x2d7c22){if(_0x2d7c22){return[_0x2d7c22,![]];}return db[_0x4ee1('0x99')][_0x4ee1('0x63')]({'UserId':_0x34316d[_0x4ee1('0x65')]['id'],'ContactId':_0x3adfaa['id'],'OpenchannelAccountId':_0x505eb0['id'],'lastMsgDirection':_0x4ee1('0xc2'),'Messages':[_['merge'](_0x34316d[_0x4ee1('0x64')],{'read':![],'body':_0x34316d['body'][_0x4ee1('0x64')],'OpenchannelAccountId':_0x505eb0['id'],'UserId':_0x34316d[_0x4ee1('0x65')]['id'],'ContactId':_0x3adfaa['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x4ee1('0xc3')}]})[_0x4ee1('0x23')](function(_0x19bee2){return[_0x19bee2,!![]];});});}})[_0x4ee1('0x9b')](function(_0x3bc60c,_0x3626f7){if(_0x3626f7){return _0x3bc60c;}return db['OpenchannelMessage'][_0x4ee1('0x63')](_['merge'](_0x34316d[_0x4ee1('0x64')],{'read':![],'body':_0x34316d['body']['body'],'OpenchannelAccountId':_0x505eb0['id'],'OpenchannelInteractionId':_0x3bc60c['id'],'UserId':_0x34316d[_0x4ee1('0x65')]['id'],'ContactId':_0x3adfaa['id']}))[_0x4ee1('0x23')](function(_0x52ee01){_0x3bc60c[_0x4ee1('0xc4')]['Messages']=[];_0x3bc60c['dataValues'][_0x4ee1('0xc3')][_0x4ee1('0x9f')](_0x52ee01[_0x4ee1('0xc4')]);return _0x3bc60c;});});}})[_0x4ee1('0x23')](respondWithResult(_0x2e3d7f,null))[_0x4ee1('0x5e')](handleError(_0x2e3d7f,null));}; \ No newline at end of file +var _0xafc4=['merge','options','count','includeAll','include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','isNil','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','Applications','account','applications','list','orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','close','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','addApplications','sequelize','OpenchannelApplication','bulkCreate','getApplications','Owner','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','out','dataValues','Messages','push','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','offset','limit','status','set','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x4b9b50,_0x313b7d){var _0x204cfa=function(_0x2031d6){while(--_0x2031d6){_0x4b9b50['push'](_0x4b9b50['shift']());}};_0x204cfa(++_0x313b7d);}(_0xafc4,0x69));var _0x4afc=function(_0x1d1c66,_0x33b222){_0x1d1c66=_0x1d1c66-0x0;var _0x675bc2=_0xafc4[_0x1d1c66];return _0x675bc2;};'use strict';var pdf=require(_0x4afc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4afc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4afc('0x2'));var rp=require(_0x4afc('0x3'));var moment=require(_0x4afc('0x4'));var BPromise=require(_0x4afc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4afc('0x6'));var csv=require(_0x4afc('0x7'));var ejs=require(_0x4afc('0x8'));var fs=require('fs');var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x7'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];config[_0x4afc('0x16')]=_[_0x4afc('0x17')](config[_0x4afc('0x16')],{'host':_0x4afc('0x18'),'port':0x18eb});var socket=require(_0x4afc('0x19'))(new Redis(config[_0x4afc('0x16')]));require('./openchannelAccount.socket')[_0x4afc('0x1a')](socket);var jayson=require(_0x4afc('0x1b'));var client=jayson[_0x4afc('0x1c')][_0x4afc('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2452ae,_0x4f3127,_0x23ae30,_0x24ed6d){return new BPromise(function(_0x2b928b,_0x31eec4){var _0x3a306f=_0x24ed6d||client;return _0x3a306f[_0x4afc('0x1e')](_0x2452ae,_0x23ae30)[_0x4afc('0x1f')](function(_0x3ad418){logger[_0x4afc('0x20')](_0x4afc('0x21'),_0x4f3127,_0x4afc('0x22'));logger['debug'](_0x4afc('0x23'),_0x4f3127,_0x4afc('0x22'),JSON[_0x4afc('0x24')](_0x3ad418));if(_0x3ad418[_0x4afc('0x25')]){if(_0x3ad418['error'][_0x4afc('0x26')]===0x1f4){logger[_0x4afc('0x25')](_0x4afc('0x21'),_0x4f3127,_0x3ad418[_0x4afc('0x25')][_0x4afc('0x27')]);return _0x31eec4(_0x3ad418[_0x4afc('0x25')][_0x4afc('0x27')]);}logger['error'](_0x4afc('0x21'),_0x4f3127,_0x3ad418[_0x4afc('0x25')]['message']);return _0x2b928b(_0x3ad418[_0x4afc('0x25')]['message']);}else{logger[_0x4afc('0x20')](_0x4afc('0x21'),_0x4f3127,_0x4afc('0x22'));_0x2b928b(_0x3ad418[_0x4afc('0x28')][_0x4afc('0x27')]);}})[_0x4afc('0x29')](function(_0x40a0db){logger[_0x4afc('0x25')](_0x4afc('0x21'),_0x4f3127,_0x40a0db);_0x31eec4(_0x40a0db);});});}function respondWithStatusCode(_0x100220,_0x4e8273){_0x4e8273=_0x4e8273||0xcc;return function(_0x359c07){if(_0x359c07){return _0x100220[_0x4afc('0x2a')](_0x4e8273);}return _0x100220['status'](_0x4e8273)[_0x4afc('0x2b')]();};}function respondWithResult(_0x244f6c,_0x2d6112){_0x2d6112=_0x2d6112||0xc8;return function(_0x4e254d){if(_0x4e254d){return _0x244f6c['status'](_0x2d6112)['json'](_0x4e254d);}};}function respondWithFilteredResult(_0x426e9d,_0x5db47e){return function(_0x5e4747){if(_0x5e4747){var _0xd26d2f=_0x5e4747['count'],_0x628e42=_0x5db47e[_0x4afc('0x2c')],_0x494fe7=_0x5db47e[_0x4afc('0x2c')]+_0x5db47e[_0x4afc('0x2d')],_0x514278;if(_0x494fe7>=_0xd26d2f){_0x494fe7=_0xd26d2f;_0x514278=0xc8;}else{_0x514278=0xce;}_0x426e9d[_0x4afc('0x2e')](_0x514278);return _0x426e9d[_0x4afc('0x2f')](_0x4afc('0x30'),_0x628e42+'-'+_0x494fe7+'/'+_0xd26d2f)['json'](_0x5e4747);}return null;};}function patchUpdates(_0x290391){return function(_0x3d1693){try{jsonpatch[_0x4afc('0x31')](_0x3d1693,_0x290391,!![]);}catch(_0x2f178c){return BPromise[_0x4afc('0x32')](_0x2f178c);}return _0x3d1693[_0x4afc('0x33')]();};}function saveUpdates(_0xbabe1e,_0x406789){return function(_0x5ac7a8){if(_0x5ac7a8){return _0x5ac7a8[_0x4afc('0x34')](_0xbabe1e)['then'](function(_0x539b61){return _0x539b61;});}return null;};}function removeEntity(_0x324a12,_0x33ebbc){return function(_0x266f7f){if(_0x266f7f){return _0x266f7f[_0x4afc('0x35')]()[_0x4afc('0x1f')](function(){var _0x3f50cc=_0x266f7f['get']({'plain':!![]});var _0x380f9f=_0x4afc('0x36');return db[_0x4afc('0x37')][_0x4afc('0x35')]({'where':{'type':_0x380f9f,'resourceId':_0x3f50cc['id']}})[_0x4afc('0x1f')](function(){return _0x266f7f;});})[_0x4afc('0x1f')](function(){_0x324a12['status'](0xcc)[_0x4afc('0x2b')]();});}};}function handleEntityNotFound(_0x2ddce1,_0x91565d){return function(_0x283bc2){if(!_0x283bc2){_0x2ddce1['sendStatus'](0x194);}return _0x283bc2;};}function handleError(_0x4be1e6,_0x43c341){_0x43c341=_0x43c341||0x1f4;return function(_0x22bd75){logger[_0x4afc('0x25')](_0x22bd75['stack']);if(_0x22bd75['name']){delete _0x22bd75[_0x4afc('0x38')];}_0x4be1e6['status'](_0x43c341)['send'](_0x22bd75);};}exports[_0x4afc('0x39')]=function(_0x1dc853,_0x2be40e){var _0x3e41f5={'include':[{'model':db[_0x4afc('0x3a')],'as':_0x4afc('0x3b')}]},_0x395bc6={},_0x4420fb={'count':0x0,'rows':[]};var _0x3ccc5a=_[_0x4afc('0x3c')](db[_0x4afc('0x3d')][_0x4afc('0x3e')],function(_0x15c6cb){return{'name':_0x15c6cb[_0x4afc('0x3f')],'type':_0x15c6cb[_0x4afc('0x40')]['key']};});_0x395bc6[_0x4afc('0x41')]=_[_0x4afc('0x3c')](_0x3ccc5a,_0x4afc('0x38'));_0x395bc6[_0x4afc('0x42')]=_[_0x4afc('0x43')](_0x1dc853[_0x4afc('0x42')]);_0x395bc6[_0x4afc('0x44')]=_['intersection'](_0x395bc6['model'],_0x395bc6['query']);_0x3e41f5[_0x4afc('0x45')]=_[_0x4afc('0x46')](_0x395bc6['model'],qs[_0x4afc('0x47')](_0x1dc853[_0x4afc('0x42')][_0x4afc('0x47')]));_0x3e41f5[_0x4afc('0x45')]=_0x3e41f5['attributes'][_0x4afc('0x48')]?_0x3e41f5[_0x4afc('0x45')]:_0x395bc6[_0x4afc('0x41')];if(!_0x1dc853[_0x4afc('0x42')][_0x4afc('0x49')](_0x4afc('0x4a'))){_0x3e41f5['limit']=qs[_0x4afc('0x2d')](_0x1dc853['query'][_0x4afc('0x2d')]);_0x3e41f5[_0x4afc('0x2c')]=qs[_0x4afc('0x2c')](_0x1dc853['query']['offset']);}_0x3e41f5[_0x4afc('0x4b')]=qs[_0x4afc('0x4c')](_0x1dc853[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x3e41f5[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x1dc853[_0x4afc('0x42')],_0x395bc6['filters']),_0x3ccc5a);if(_0x1dc853[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x3e41f5['where']=_[_0x4afc('0x50')](_0x3e41f5['where'],{'$or':_[_0x4afc('0x3c')](_0x3ccc5a,function(_0x24a731){if(_0x24a731[_0x4afc('0x40')]!=='VIRTUAL'){var _0xd0f517={};_0xd0f517[_0x24a731[_0x4afc('0x38')]]={'$like':'%'+_0x1dc853[_0x4afc('0x42')][_0x4afc('0x4f')]+'%'};return _0xd0f517;}})});}_0x3e41f5=_[_0x4afc('0x50')]({},_0x3e41f5,_0x1dc853[_0x4afc('0x51')]);var _0x5d9d90={'where':_0x3e41f5['where']};return db['OpenchannelAccount'][_0x4afc('0x52')](_0x5d9d90)[_0x4afc('0x1f')](function(_0x42e274){_0x4420fb[_0x4afc('0x52')]=_0x42e274;if(_0x1dc853[_0x4afc('0x42')][_0x4afc('0x53')]){_0x3e41f5[_0x4afc('0x54')]=[{'all':!![]}];}return db[_0x4afc('0x3d')][_0x4afc('0x55')](_0x3e41f5);})[_0x4afc('0x1f')](function(_0x48dbe3){_0x4420fb[_0x4afc('0x56')]=_0x48dbe3;return _0x4420fb;})['then'](respondWithFilteredResult(_0x2be40e,_0x3e41f5))['catch'](handleError(_0x2be40e,null));};exports[_0x4afc('0x57')]=function(_0x5c7606,_0x428d78){var _0x355198={'raw':![],'where':{'id':_0x5c7606[_0x4afc('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x4afc('0x3b')}]},_0x2fe2ae={};_0x2fe2ae['model']=_[_0x4afc('0x43')](db[_0x4afc('0x3d')][_0x4afc('0x3e')]);_0x2fe2ae[_0x4afc('0x42')]=_[_0x4afc('0x43')](_0x5c7606[_0x4afc('0x42')]);_0x2fe2ae[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0x2fe2ae[_0x4afc('0x41')],_0x2fe2ae[_0x4afc('0x42')]);_0x355198[_0x4afc('0x45')]=_[_0x4afc('0x46')](_0x2fe2ae['model'],qs[_0x4afc('0x47')](_0x5c7606[_0x4afc('0x42')][_0x4afc('0x47')]));_0x355198[_0x4afc('0x45')]=_0x355198[_0x4afc('0x45')][_0x4afc('0x48')]?_0x355198[_0x4afc('0x45')]:_0x2fe2ae[_0x4afc('0x41')];if(_0x5c7606[_0x4afc('0x42')][_0x4afc('0x53')]){_0x355198[_0x4afc('0x54')]=[{'all':!![]}];}_0x355198=_[_0x4afc('0x50')]({},_0x355198,_0x5c7606[_0x4afc('0x51')]);return db['OpenchannelAccount'][_0x4afc('0x59')](_0x355198)['then'](handleEntityNotFound(_0x428d78,null))[_0x4afc('0x1f')](respondWithResult(_0x428d78,null))[_0x4afc('0x29')](handleError(_0x428d78,null));};exports[_0x4afc('0x5a')]=function(_0x2d9f3d,_0x518d6f){return db['OpenchannelAccount'][_0x4afc('0x5a')](_0x2d9f3d[_0x4afc('0x5b')],{})['then'](function(_0x40021e){var _0x3af52c=_0x2d9f3d[_0x4afc('0x5c')][_0x4afc('0x5d')]({'plain':!![]});if(!_0x3af52c)throw new Error(_0x4afc('0x5e'));if(_0x3af52c[_0x4afc('0x5f')]===_0x4afc('0x5c')){var _0x13891d=_0x40021e[_0x4afc('0x5d')]({'plain':!![]});var _0x3369a8=_0x4afc('0x36');return db[_0x4afc('0x60')][_0x4afc('0x59')]({'where':{'name':_0x3369a8,'userProfileId':_0x3af52c[_0x4afc('0x61')]},'raw':!![]})['then'](function(_0x42c65e){if(_0x42c65e&&_0x42c65e[_0x4afc('0x62')]===0x0){return db[_0x4afc('0x37')][_0x4afc('0x5a')]({'name':_0x13891d[_0x4afc('0x38')],'resourceId':_0x13891d['id'],'type':_0x42c65e[_0x4afc('0x38')],'sectionId':_0x42c65e['id']},{})[_0x4afc('0x1f')](function(){return _0x40021e;});}else{return _0x40021e;}})['catch'](function(_0x1771e8){logger[_0x4afc('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1771e8);throw _0x1771e8;});}return _0x40021e;})['then'](respondWithResult(_0x518d6f,0xc9))[_0x4afc('0x29')](handleError(_0x518d6f,null));};exports[_0x4afc('0x34')]=function(_0x2d7066,_0x389040){if(_0x2d7066[_0x4afc('0x5b')]['id']){delete _0x2d7066[_0x4afc('0x5b')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x2d7066[_0x4afc('0x58')]['id']},'include':[{'model':db[_0x4afc('0x3a')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x389040,null))[_0x4afc('0x1f')](saveUpdates(_0x2d7066[_0x4afc('0x5b')],null))['then'](respondWithResult(_0x389040,null))[_0x4afc('0x29')](handleError(_0x389040,null));};exports[_0x4afc('0x35')]=function(_0x5be1a7,_0x56573a){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x5be1a7[_0x4afc('0x58')]['id']}})['then'](handleEntityNotFound(_0x56573a,null))[_0x4afc('0x1f')](removeEntity(_0x56573a,null))['catch'](handleError(_0x56573a,null));};exports['describe']=function(_0x10e5c6,_0x37b5aa){return db[_0x4afc('0x3d')][_0x4afc('0x63')]()[_0x4afc('0x1f')](respondWithResult(_0x37b5aa,null))[_0x4afc('0x29')](handleError(_0x37b5aa,null));};exports[_0x4afc('0x64')]=function(_0xe05d53,_0x3d1825,_0x4a616e){if(_0xe05d53[_0x4afc('0x5b')]['id']){delete _0xe05d53[_0x4afc('0x5b')]['id'];}return db[_0x4afc('0x3d')]['find']({'where':{'id':_0xe05d53['params']['id']}})['then'](handleEntityNotFound(_0x3d1825,null))[_0x4afc('0x1f')](function(_0x135931){if(_0x135931){_0xe05d53[_0x4afc('0x5b')]['OpenchannelAccountId']=_0x135931['id'];return db[_0x4afc('0x65')]['create'](_0xe05d53['body']);}})['then'](respondWithResult(_0x3d1825,null))[_0x4afc('0x29')](handleError(_0x3d1825,null));};exports[_0x4afc('0x66')]=function(_0x315fc3,_0x4e0fb6,_0x1e56b7){var _0x45cfea={'raw':![],'where':{}};var _0x18ab12={};var _0x5e3e9b={'count':0x0,'rows':[]};return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x315fc3[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x4e0fb6,null))[_0x4afc('0x1f')](function(_0x481263){if(_0x481263){_0x18ab12['model']=_[_0x4afc('0x43')](db[_0x4afc('0x65')][_0x4afc('0x3e')]);_0x18ab12['query']=_[_0x4afc('0x43')](_0x315fc3[_0x4afc('0x42')]);_0x18ab12[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0x18ab12[_0x4afc('0x41')],_0x18ab12['query']);_0x45cfea[_0x4afc('0x45')]=_[_0x4afc('0x46')](_0x18ab12['model'],qs[_0x4afc('0x47')](_0x315fc3[_0x4afc('0x42')][_0x4afc('0x47')]));_0x45cfea['attributes']=_0x45cfea[_0x4afc('0x45')][_0x4afc('0x48')]?_0x45cfea[_0x4afc('0x45')]:_0x18ab12[_0x4afc('0x41')];if(!_0x315fc3[_0x4afc('0x42')][_0x4afc('0x49')](_0x4afc('0x4a'))){_0x45cfea[_0x4afc('0x2d')]=qs['limit'](_0x315fc3[_0x4afc('0x42')]['limit']);_0x45cfea['offset']=qs[_0x4afc('0x2c')](_0x315fc3[_0x4afc('0x42')][_0x4afc('0x2c')]);}_0x45cfea['order']=qs['sort'](_0x315fc3[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x45cfea[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x315fc3[_0x4afc('0x42')],_0x18ab12[_0x4afc('0x44')]));_0x45cfea[_0x4afc('0x4d')][_0x4afc('0x68')]=_0x481263['id'];if(_0x315fc3[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x45cfea[_0x4afc('0x4d')]=_[_0x4afc('0x50')](_0x45cfea[_0x4afc('0x4d')],{'$or':_[_0x4afc('0x3c')](_0x45cfea[_0x4afc('0x45')],function(_0x4f8b24){var _0x2d7d36={};_0x2d7d36[_0x4f8b24]={'$like':'%'+_0x315fc3[_0x4afc('0x42')][_0x4afc('0x4f')]+'%'};return _0x2d7d36;})});}_0x45cfea=_[_0x4afc('0x50')]({},_0x45cfea,_0x315fc3[_0x4afc('0x51')]);return db[_0x4afc('0x65')][_0x4afc('0x52')]({'where':_0x45cfea[_0x4afc('0x4d')]})[_0x4afc('0x1f')](function(_0x4d3da7){_0x5e3e9b[_0x4afc('0x52')]=_0x4d3da7;if(_0x315fc3[_0x4afc('0x42')][_0x4afc('0x53')]){_0x45cfea[_0x4afc('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x4afc('0x55')](_0x45cfea);})[_0x4afc('0x1f')](function(_0x4ce81a){_0x5e3e9b[_0x4afc('0x56')]=_0x4ce81a;return _0x5e3e9b;});}})[_0x4afc('0x1f')](respondWithFilteredResult(_0x4e0fb6,_0x45cfea))[_0x4afc('0x29')](handleError(_0x4e0fb6,null));};exports[_0x4afc('0x69')]=function(_0xf9b232,_0x253d25,_0x2b20ad){return db['OpenchannelAccount'][_0x4afc('0x59')]({'where':{'id':_0xf9b232[_0x4afc('0x58')]['id']}})['then'](handleEntityNotFound(_0x253d25,null))[_0x4afc('0x1f')](function(_0x41a3a9){if(_0x41a3a9){return _0x41a3a9[_0x4afc('0x69')](_0xf9b232['query'][_0x4afc('0x6a')]);}})[_0x4afc('0x1f')](respondWithStatusCode(_0x253d25,null))[_0x4afc('0x29')](handleError(_0x253d25,null));};exports[_0x4afc('0x6b')]=function(_0x4a6f77,_0x1bbe21,_0x29297c){if(_0x4a6f77['body']['id']){delete _0x4a6f77[_0x4afc('0x5b')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x4a6f77['params']['id']}})['then'](handleEntityNotFound(_0x1bbe21,null))[_0x4afc('0x1f')](function(_0x41116b){if(_0x41116b){_0x4a6f77[_0x4afc('0x5b')][_0x4afc('0x68')]=_0x41116b['id'];return db[_0x4afc('0x6c')][_0x4afc('0x5a')](_0x4a6f77[_0x4afc('0x5b')]);}})[_0x4afc('0x1f')](respondWithResult(_0x1bbe21,null))[_0x4afc('0x29')](handleError(_0x1bbe21,null));};exports[_0x4afc('0x6d')]=function(_0x32a7a3,_0x6d81f2,_0x2775ec){var _0x257d02={'raw':![],'where':{}};var _0x23a491={};var _0x143340={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x4afc('0x67')]({'where':{'id':_0x32a7a3[_0x4afc('0x58')]['id']}})['then'](handleEntityNotFound(_0x6d81f2,null))[_0x4afc('0x1f')](function(_0x4d92e6){if(_0x4d92e6){_0x23a491['model']=_[_0x4afc('0x43')](db['CannedAnswer']['rawAttributes']);_0x23a491[_0x4afc('0x42')]=_['keys'](_0x32a7a3[_0x4afc('0x42')]);_0x23a491['filters']=_[_0x4afc('0x46')](_0x23a491[_0x4afc('0x41')],_0x23a491[_0x4afc('0x42')]);_0x257d02[_0x4afc('0x45')]=_[_0x4afc('0x46')](_0x23a491['model'],qs[_0x4afc('0x47')](_0x32a7a3[_0x4afc('0x42')]['fields']));_0x257d02['attributes']=_0x257d02[_0x4afc('0x45')][_0x4afc('0x48')]?_0x257d02[_0x4afc('0x45')]:_0x23a491[_0x4afc('0x41')];if(!_0x32a7a3[_0x4afc('0x42')]['hasOwnProperty'](_0x4afc('0x4a'))){_0x257d02[_0x4afc('0x2d')]=qs[_0x4afc('0x2d')](_0x32a7a3[_0x4afc('0x42')]['limit']);_0x257d02[_0x4afc('0x2c')]=qs['offset'](_0x32a7a3[_0x4afc('0x42')][_0x4afc('0x2c')]);}_0x257d02[_0x4afc('0x4b')]=qs[_0x4afc('0x4c')](_0x32a7a3[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x257d02[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x32a7a3[_0x4afc('0x42')],_0x23a491[_0x4afc('0x44')]));_0x257d02['where'][_0x4afc('0x68')]=_0x4d92e6['id'];if(_0x32a7a3['query'][_0x4afc('0x4f')]){_0x257d02['where']=_['merge'](_0x257d02[_0x4afc('0x4d')],{'$or':_['map'](_0x257d02['attributes'],function(_0x360d43){var _0x489c9d={};_0x489c9d[_0x360d43]={'$like':'%'+_0x32a7a3[_0x4afc('0x42')][_0x4afc('0x4f')]+'%'};return _0x489c9d;})});}_0x257d02=_['merge']({},_0x257d02,_0x32a7a3[_0x4afc('0x51')]);return db[_0x4afc('0x6c')]['count']({'where':_0x257d02[_0x4afc('0x4d')]})[_0x4afc('0x1f')](function(_0x3ec068){_0x143340['count']=_0x3ec068;if(_0x32a7a3[_0x4afc('0x42')][_0x4afc('0x53')]){_0x257d02[_0x4afc('0x54')]=[{'all':!![]}];}return db[_0x4afc('0x6c')][_0x4afc('0x55')](_0x257d02);})[_0x4afc('0x1f')](function(_0x5cc914){_0x143340['rows']=_0x5cc914;return _0x143340;});}})[_0x4afc('0x1f')](respondWithFilteredResult(_0x6d81f2,_0x257d02))[_0x4afc('0x29')](handleError(_0x6d81f2,null));};exports['removeAnswers']=function(_0x28381d,_0x2ff7a1,_0x4f2536){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x28381d[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x2ff7a1,null))[_0x4afc('0x1f')](function(_0x4b1bbc){if(_0x4b1bbc){return _0x4b1bbc[_0x4afc('0x6e')](_0x28381d[_0x4afc('0x42')][_0x4afc('0x6a')]);}})[_0x4afc('0x1f')](respondWithStatusCode(_0x2ff7a1,null))[_0x4afc('0x29')](handleError(_0x2ff7a1,null));};exports['notify']=function(_0x793480,_0x37f9ea,_0x31b518){var _0x57a878={'body':_0x793480[_0x4afc('0x5b')],'channel':_0x4afc('0x6f')};var _0x5bcfa7=[];var _0x530119=[];var _0x4c27a2={};var _0x1119a9=![];return db[_0x4afc('0x70')]['describe']()[_0x4afc('0x1f')](function(_0x46fe46){if(!_0x46fe46){throw new db['Sequelize'][(_0x4afc('0x71'))](_0x4afc('0x72'));}_0x5bcfa7=_[_0x4afc('0x73')](_[_0x4afc('0x43')](_0x46fe46),[_0x4afc('0x74'),_0x4afc('0x75')]);_0x530119=_[_0x4afc('0x73')](_[_0x4afc('0x43')](_0x46fe46),[_0x4afc('0x74'),'updatedAt',_0x4afc('0x76'),_0x4afc('0x77')]);if(_0x793480[_0x4afc('0x5b')]['id']){delete _0x793480[_0x4afc('0x5b')]['id'];}if(_['isNil'](_0x793480[_0x4afc('0x5b')][_0x4afc('0x78')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x4afc('0x79')](_0x793480[_0x4afc('0x5b')][_0x4afc('0x5b')])||_0x793480['body'][_0x4afc('0x5b')]===''){throw new db[(_0x4afc('0x7a'))][(_0x4afc('0x71'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4afc('0x79')](_0x793480['body']['mapKey'])){throw new db[(_0x4afc('0x7a'))][(_0x4afc('0x71'))](_0x4afc('0x7b')+_0x530119);}if(!_['includes'](_0x530119,_0x793480[_0x4afc('0x5b')][_0x4afc('0x7c')])){throw new db[(_0x4afc('0x7a'))][(_0x4afc('0x71'))](_0x4afc('0x7d')+_0x530119);}_0x4c27a2[_0x793480[_0x4afc('0x5b')][_0x4afc('0x7c')]]=_0x793480[_0x4afc('0x5b')][_0x4afc('0x78')];})['then'](function(){return db['OpenchannelAccount'][_0x4afc('0x59')]({'where':{'id':_0x793480[_0x4afc('0x58')]['id']},'include':[{'model':db[_0x4afc('0x7e')],'as':_0x4afc('0x7f'),'include':[{'model':db['CmContact'],'as':_0x4afc('0x80'),'where':_0x4c27a2,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x4afc('0x81')}]});})[_0x4afc('0x1f')](handleEntityNotFound(_0x37f9ea,null))[_0x4afc('0x1f')](function(_0x3e26e9){if(_0x3e26e9&&_0x3e26e9[_0x4afc('0x7f')]){_0x57a878[_0x4afc('0x82')]=_0x3e26e9;_0x57a878[_0x4afc('0x83')]=_0x3e26e9[_0x4afc('0x81')];_0x57a878[_0x4afc('0x84')]=_0x3e26e9[_0x4afc('0x7f')];_0x57a878[_0x4afc('0x83')]=_[_0x4afc('0x85')](_0x57a878[_0x4afc('0x83')],['priority'],[_0x4afc('0x86')]);if(_0x57a878[_0x4afc('0x82')][_0x4afc('0x81')]){delete _0x57a878[_0x4afc('0x82')]['Applications'];}if(_0x57a878[_0x4afc('0x82')][_0x4afc('0x7f')]&&_0x57a878['account'][_0x4afc('0x7f')][_0x4afc('0x80')][_0x4afc('0x48')]){return _0x57a878[_0x4afc('0x82')]['List'][_0x4afc('0x80')][0x0];}var _0x12aadc=_[_0x4afc('0x17')](_0x793480['body'],{'firstName':_0x793480[_0x4afc('0x5b')][_0x4afc('0x78')],'ListId':_0x3e26e9['ListId']});_0x12aadc[_0x793480[_0x4afc('0x5b')]['mapKey']]=_0x793480[_0x4afc('0x5b')][_0x4afc('0x78')];return db[_0x4afc('0x70')][_0x4afc('0x5a')](_0x12aadc,{'fields':_0x5bcfa7,'raw':!![]});}})[_0x4afc('0x1f')](handleEntityNotFound(_0x37f9ea,null))[_0x4afc('0x1f')](function(_0x3aff77){_0x57a878[_0x4afc('0x87')]=_0x3aff77;if(_0x3aff77){var _0x518a6f={'ContactId':_0x3aff77['id'],'OpenchannelAccountId':_0x793480['params']['id'],'from':(_0x3aff77[_0x4afc('0x88')]||'')+'\x20'+(_0x3aff77[_0x4afc('0x89')]||'')};var _0x434314={'OpenchannelAccountId':_0x793480['params']['id'],'closed':![]};if(_0x793480[_0x4afc('0x5b')][_0x4afc('0x8a')]){_0x434314['threadId']=_0x793480[_0x4afc('0x5b')][_0x4afc('0x8a')];return db[_0x4afc('0x8b')]['find']({'where':_0x434314})[_0x4afc('0x1f')](function(_0x43a30c){if(_0x43a30c){return[_0x43a30c,![]];}_0x518a6f[_0x4afc('0x8a')]=_0x793480['body'][_0x4afc('0x8a')];_0x518a6f[_0x4afc('0x8c')]=_0x793480[_0x4afc('0x5b')][_0x4afc('0x8c')];return db[_0x4afc('0x8b')][_0x4afc('0x5a')](_0x518a6f)[_0x4afc('0x1f')](function(_0x2e1881){return[_0x2e1881,!![]];});});}else{_0x434314[_0x4afc('0x8a')]=null;}_0x434314['ContactId']=_0x3aff77['id'];return db[_0x4afc('0x8b')][_0x4afc('0x59')]({'where':_0x434314})[_0x4afc('0x1f')](function(_0x4ee2aa){if(_0x4ee2aa){return[_0x4ee2aa,![]];}return db['OpenchannelInteraction'][_0x4afc('0x5a')](_0x518a6f)[_0x4afc('0x1f')](function(_0x2ddf9f){return[_0x2ddf9f,!![]];});});}})[_0x4afc('0x8d')](function(_0xc8fba2,_0x4118f3){if(_0xc8fba2){_0x1119a9=_0x4118f3;if(!_0x4118f3){var _0x1ef0de={'from':(_0x57a878[_0x4afc('0x87')][_0x4afc('0x88')]||'')+'\x20'+(_0x57a878['contact'][_0x4afc('0x89')]||'')};if(_0x793480[_0x4afc('0x5b')][_0x4afc('0x8a')]&&_0x793480['body'][_0x4afc('0x8e')]&&_0x793480[_0x4afc('0x5b')][_0x4afc('0x8a')]!=_0x793480['body'][_0x4afc('0x8e')]){_0x1ef0de[_0x4afc('0x8a')]=_0x793480[_0x4afc('0x5b')][_0x4afc('0x8e')];}return _0xc8fba2[_0x4afc('0x34')](_0x1ef0de);}else{return _0xc8fba2;}}})[_0x4afc('0x1f')](function(_0x4b9745){_0x57a878[_0x4afc('0x8f')]=_0x4b9745['get']({'plain':!![]});_0x57a878['interaction'][_0x4afc('0x90')]=_0x1119a9;if(_0x57a878['interaction'][_0x4afc('0x90')]){if(_0x57a878[_0x4afc('0x82')][_0x4afc('0x91')]){_0x57a878[_0x4afc('0x83')]['push']({'id':0x0,'priority':_0x57a878[_0x4afc('0x83')]['length']+0x1,'app':_0x4afc('0x92'),'appdata':_0x4afc('0x93'),'interval':'*,*,*,*'});}}return db[_0x4afc('0x94')][_0x4afc('0x5a')]({'body':_0x793480[_0x4afc('0x5b')][_0x4afc('0x5b')],'OpenchannelAccountId':_0x793480['params']['id'],'OpenchannelInteractionId':_0x4b9745['id'],'direction':'in','ContactId':_0x57a878[_0x4afc('0x87')]['id'],'AttachmentId':_0x793480['body'][_0x4afc('0x95')]});})[_0x4afc('0x1f')](function(_0x4c8632){_0x57a878[_0x4afc('0x27')]=_0x4c8632;if(_0x57a878[_0x4afc('0x8f')][_0x4afc('0x96')]){return db[_0x4afc('0x97')]['find']({'attributes':['id',_0x4afc('0x38')],'where':{'id':_0x57a878['interaction'][_0x4afc('0x96')]}})[_0x4afc('0x1f')](function(_0x3377c5){if(_0x3377c5){_0x57a878[_0x4afc('0x83')][_0x4afc('0x98')]({'id':0x0,'priority':0x0,'app':_0x4afc('0x99'),'appdata':_0x3377c5['name']+','+(_0x57a878['account'][_0x4afc('0x9a')]||0xa),'interval':_0x4afc('0x9b')});_0x57a878[_0x4afc('0x9c')]=![];}return respondWithRpcPromise(_0x4afc('0x9d'),_0x4afc('0x9e'),_0x57a878);});}return respondWithRpcPromise(_0x4afc('0x9d'),'startRouting',_0x57a878);})[_0x4afc('0x1f')](function(_0x17771b){respondWithRpcPromise(_0x4afc('0x9f'),_0x4afc('0x9f'),{'event':_0x4afc('0xa0'),'message':_0x17771b},client9002);return _0x17771b;})['then'](respondWithResult(_0x37f9ea,null))[_0x4afc('0x29')](handleError(_0x37f9ea,null));};exports[_0x4afc('0xa1')]=function(_0x2e2f0a,_0x54cbfa,_0x17443e){return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x2e2f0a[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x54cbfa,null))[_0x4afc('0x1f')](function(_0x164b69){if(_0x164b69){return db[_0x4afc('0xa2')]['transaction'](function(_0x20ba44){return db[_0x4afc('0xa3')][_0x4afc('0x35')]({'where':{'OpenchannelAccountId':_0x2e2f0a[_0x4afc('0x58')]['id']},'transaction':_0x20ba44})[_0x4afc('0x1f')](function(_0xc36399){var _0x23a727=_['map'](_0x2e2f0a[_0x4afc('0x5b')],function(_0x45e4f4){_0x45e4f4[_0x4afc('0x68')]=_0x2e2f0a[_0x4afc('0x58')]['id'];return _0x45e4f4;});return db[_0x4afc('0xa3')][_0x4afc('0xa4')](_0x23a727,{'transaction':_0x20ba44});});})[_0x4afc('0x1f')](function(){return db['OpenchannelApplication']['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2e2f0a[_0x4afc('0x58')]['id']},'order':'priority'});});}})[_0x4afc('0x1f')](respondWithResult(_0x54cbfa,null))[_0x4afc('0x29')](handleError(_0x54cbfa,null));};exports[_0x4afc('0xa5')]=function(_0x51dd4d,_0x75a628,_0x1ea1cb){var _0x1033a8={};var _0x31757b={};var _0x4a62e1;var _0x481418;return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x51dd4d[_0x4afc('0x58')]['id']}})['then'](handleEntityNotFound(_0x75a628,null))[_0x4afc('0x1f')](function(_0x48830a){if(_0x48830a){_0x4a62e1=_0x48830a;_0x31757b[_0x4afc('0x41')]=_['keys'](db[_0x4afc('0xa3')]['rawAttributes']);_0x31757b[_0x4afc('0x42')]=_['keys'](_0x51dd4d[_0x4afc('0x42')]);_0x31757b[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0x31757b['model'],_0x31757b[_0x4afc('0x42')]);_0x1033a8['attributes']=_[_0x4afc('0x46')](_0x31757b['model'],qs[_0x4afc('0x47')](_0x51dd4d[_0x4afc('0x42')]['fields']));_0x1033a8[_0x4afc('0x45')]=_0x1033a8['attributes']['length']?_0x1033a8[_0x4afc('0x45')]:_0x31757b[_0x4afc('0x41')];_0x1033a8[_0x4afc('0x4b')]=qs[_0x4afc('0x4c')](_0x51dd4d[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x1033a8[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x51dd4d['query'],_0x31757b[_0x4afc('0x44')]));if(_0x51dd4d[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x1033a8[_0x4afc('0x4d')]=_[_0x4afc('0x50')](_0x1033a8['where'],{'$or':_[_0x4afc('0x3c')](_0x1033a8['attributes'],function(_0x399644){var _0x14c79c={};_0x14c79c[_0x399644]={'$like':'%'+_0x51dd4d['query'][_0x4afc('0x4f')]+'%'};return _0x14c79c;})});}_0x1033a8=_[_0x4afc('0x50')]({},_0x1033a8,_0x51dd4d['options']);return _0x4a62e1[_0x4afc('0xa5')](_0x1033a8);}})[_0x4afc('0x1f')](function(_0xffddad){if(_0xffddad){_0x481418=_0xffddad['length'];if(!_0x51dd4d['query'][_0x4afc('0x49')](_0x4afc('0x4a'))){_0x1033a8[_0x4afc('0x2d')]=qs[_0x4afc('0x2d')](_0x51dd4d[_0x4afc('0x42')][_0x4afc('0x2d')]);_0x1033a8[_0x4afc('0x2c')]=qs['offset'](_0x51dd4d[_0x4afc('0x42')][_0x4afc('0x2c')]);}return _0x4a62e1[_0x4afc('0xa5')](_0x1033a8);}})[_0x4afc('0x1f')](function(_0x1a3f6a){if(_0x1a3f6a){return _0x1a3f6a?{'count':_0x481418,'rows':_0x1a3f6a}:null;}})[_0x4afc('0x1f')](respondWithResult(_0x75a628,null))[_0x4afc('0x29')](handleError(_0x75a628,null));};exports['getInteractions']=function(_0xc0ff4e,_0x5a492d,_0x2177a3){var _0x21a41f={'raw':![],'where':{}};var _0xbe1818={};var _0x354f3a={'count':0x0,'rows':[]};return db[_0x4afc('0x3d')]['findOne']({'where':{'id':_0xc0ff4e['params']['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x5a492d,null))['then'](function(_0x5d8cb3){if(_0x5d8cb3){_0xbe1818[_0x4afc('0x41')]=_[_0x4afc('0x43')](db['OpenchannelInteraction'][_0x4afc('0x3e')]);_0xbe1818[_0x4afc('0x42')]=_['keys'](_0xc0ff4e[_0x4afc('0x42')]);_0xbe1818[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0xbe1818[_0x4afc('0x41')],_0xbe1818[_0x4afc('0x42')]);_0x21a41f['attributes']=_['intersection'](_0xbe1818[_0x4afc('0x41')],qs[_0x4afc('0x47')](_0xc0ff4e[_0x4afc('0x42')]['fields']));_0x21a41f['attributes']=_0x21a41f['attributes']['length']?_0x21a41f[_0x4afc('0x45')]:_0xbe1818[_0x4afc('0x41')];if(!_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0x49')]('nolimit')){_0x21a41f[_0x4afc('0x2d')]=qs[_0x4afc('0x2d')](_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0x2d')]);_0x21a41f['offset']=qs[_0x4afc('0x2c')](_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0x2c')]);}_0x21a41f[_0x4afc('0x4b')]=qs[_0x4afc('0x4c')](_0xc0ff4e[_0x4afc('0x42')]['sort']);_0x21a41f[_0x4afc('0x4d')]=qs[_0x4afc('0x44')](_['pick'](_0xc0ff4e[_0x4afc('0x42')],_0xbe1818['filters']));_0x21a41f['where'][_0x4afc('0x68')]=_0x5d8cb3['id'];if(_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x21a41f[_0x4afc('0x4d')]=_[_0x4afc('0x50')](_0x21a41f[_0x4afc('0x4d')],{'$or':_[_0x4afc('0x3c')](_0x21a41f['attributes'],function(_0x253e57){var _0x36f6ad={};_0x36f6ad[_0x253e57]={'$like':'%'+_0xc0ff4e['query'][_0x4afc('0x4f')]+'%'};return _0x36f6ad;})});}_0x21a41f=_[_0x4afc('0x50')]({},_0x21a41f,_0xc0ff4e['options']);return db[_0x4afc('0x8b')][_0x4afc('0x52')]({'where':_0x21a41f[_0x4afc('0x4d')]})['then'](function(_0x409be5){_0x354f3a[_0x4afc('0x52')]=_0x409be5;if(_0xc0ff4e[_0x4afc('0x42')]['includeAll']){_0x21a41f['include']=[{'model':db[_0x4afc('0x70')],'as':'Contact','required':![]},{'model':db[_0x4afc('0x97')],'as':_0x4afc('0xa6'),'attributes':[_0x4afc('0x38'),'fullname','internal'],'required':![]},{'model':db[_0x4afc('0xa7')],'as':_0x4afc('0xa8'),'attributes':['id',_0x4afc('0x38'),_0x4afc('0xa9')],'where':_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0xaa')]?{'id':_0xc0ff4e['query'][_0x4afc('0xaa')]}:undefined,'required':_0xc0ff4e[_0x4afc('0x42')][_0x4afc('0xaa')]?!![]:![]}];}return db[_0x4afc('0x8b')][_0x4afc('0x55')](_0x21a41f);})['then'](function(_0x1da8c0){_0x354f3a[_0x4afc('0x56')]=_0x1da8c0;return _0x354f3a;});}})[_0x4afc('0x1f')](respondWithFilteredResult(_0x5a492d,_0x21a41f))['catch'](handleError(_0x5a492d,null));};exports[_0x4afc('0xab')]=function(_0x133d22,_0x5256df,_0x537fae){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x133d22[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x5256df,null))[_0x4afc('0x1f')](function(_0x4f68fa){if(_0x4f68fa){return _0x4f68fa[_0x4afc('0xab')](_0x133d22[_0x4afc('0x5b')]['ids'],_[_0x4afc('0xac')](_0x133d22[_0x4afc('0x5b')],['ids','id'])||{})[_0x4afc('0x8d')](function(_0x17940a){for(var _0x3b3226=0x0;_0x3b3226<_0x133d22[_0x4afc('0x5b')][_0x4afc('0x6a')][_0x4afc('0x48')];_0x3b3226+=0x1){socket['emit'](_0x4afc('0xad'),{'UserId':_0x133d22[_0x4afc('0x5b')][_0x4afc('0x6a')][_0x3b3226],'OpenchannelAccountId':_0x133d22[_0x4afc('0x58')]['id']});}return _0x17940a;});}})['then'](respondWithResult(_0x5256df,null))[_0x4afc('0x29')](handleError(_0x5256df,null));};exports[_0x4afc('0xae')]=function(_0x3cac2f,_0x127814,_0x49ee03){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x3cac2f[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x127814,null))[_0x4afc('0x1f')](function(_0x338de8){if(_0x338de8){return _0x338de8[_0x4afc('0xae')](_0x3cac2f['query']['ids'])['then'](function(){if(_[_0x4afc('0xaf')](_0x3cac2f['query'][_0x4afc('0x6a')])){for(var _0x4e05af=0x0;_0x4e05af<_0x3cac2f[_0x4afc('0x42')][_0x4afc('0x6a')][_0x4afc('0x48')];_0x4e05af+=0x1){socket['emit'](_0x4afc('0xb0'),{'UserId':Number(_0x3cac2f[_0x4afc('0x42')][_0x4afc('0x6a')][_0x4e05af]),'OpenchannelAccountId':Number(_0x3cac2f[_0x4afc('0x58')]['id'])});}}else{socket['emit'](_0x4afc('0xb0'),{'UserId':Number(_0x3cac2f[_0x4afc('0x42')][_0x4afc('0x6a')]),'OpenchannelAccountId':Number(_0x3cac2f['params']['id'])});}});}})[_0x4afc('0x1f')](respondWithStatusCode(_0x127814,null))[_0x4afc('0x29')](handleError(_0x127814,null));};exports['getAgents']=function(_0x43f64e,_0x2e041a,_0x6ad393){var _0x1d6bd2={};var _0x2864fa={};var _0x48d0ee;var _0x563172;return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x43f64e[_0x4afc('0x58')]['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x2e041a,null))[_0x4afc('0x1f')](function(_0x5152ab){if(_0x5152ab){_0x48d0ee=_0x5152ab;_0x2864fa[_0x4afc('0x41')]=_[_0x4afc('0x43')](db[_0x4afc('0x97')][_0x4afc('0x3e')]);_0x2864fa['query']=_[_0x4afc('0x43')](_0x43f64e[_0x4afc('0x42')]);_0x2864fa[_0x4afc('0x44')]=_[_0x4afc('0x46')](_0x2864fa[_0x4afc('0x41')],_0x2864fa[_0x4afc('0x42')]);_0x1d6bd2[_0x4afc('0x45')]=_['intersection'](_0x2864fa[_0x4afc('0x41')],qs[_0x4afc('0x47')](_0x43f64e[_0x4afc('0x42')]['fields']));_0x1d6bd2['attributes']=_0x1d6bd2['attributes']['length']?_0x1d6bd2['attributes']:_0x2864fa[_0x4afc('0x41')];_0x1d6bd2['order']=qs[_0x4afc('0x4c')](_0x43f64e[_0x4afc('0x42')][_0x4afc('0x4c')]);_0x1d6bd2['where']=qs[_0x4afc('0x44')](_[_0x4afc('0x4e')](_0x43f64e[_0x4afc('0x42')],_0x2864fa[_0x4afc('0x44')]));if(_0x43f64e[_0x4afc('0x42')][_0x4afc('0x4f')]){_0x1d6bd2[_0x4afc('0x4d')]=_[_0x4afc('0x50')](_0x1d6bd2['where'],{'$or':_[_0x4afc('0x3c')](_0x1d6bd2[_0x4afc('0x45')],function(_0x5f3751){var _0x2d7590={};_0x2d7590[_0x5f3751]={'$like':'%'+_0x43f64e[_0x4afc('0x42')]['filter']+'%'};return _0x2d7590;})});}_0x1d6bd2=_['merge']({},_0x1d6bd2,_0x43f64e[_0x4afc('0x51')]);return _0x48d0ee[_0x4afc('0xb1')](_0x1d6bd2);}})[_0x4afc('0x1f')](function(_0x444e1a){if(_0x444e1a){_0x563172=_0x444e1a['length'];if(!_0x43f64e[_0x4afc('0x42')][_0x4afc('0x49')](_0x4afc('0x4a'))){_0x1d6bd2[_0x4afc('0x2d')]=qs['limit'](_0x43f64e['query']['limit']);_0x1d6bd2[_0x4afc('0x2c')]=qs[_0x4afc('0x2c')](_0x43f64e['query'][_0x4afc('0x2c')]);}return _0x48d0ee['getAgents'](_0x1d6bd2);}})['then'](function(_0x319692){if(_0x319692){return _0x319692?{'count':_0x563172,'rows':_0x319692}:null;}})['then'](respondWithResult(_0x2e041a,null))[_0x4afc('0x29')](handleError(_0x2e041a,null));};exports[_0x4afc('0xb2')]=function(_0x33ee71,_0x172a8a,_0x316e76){var _0x485f68,_0x39c4b5,_0x5bb7b9;if(_[_0x4afc('0x79')](_0x33ee71[_0x4afc('0x5b')][_0x4afc('0x5b')])||_0x33ee71[_0x4afc('0x5b')][_0x4afc('0x5b')]===''){throw new db['Sequelize'][(_0x4afc('0x71'))](_0x4afc('0xb3'));}if(_[_0x4afc('0x79')](_0x33ee71[_0x4afc('0x5b')]['to'])){}_0x485f68=_0x33ee71['body']['to'];return db[_0x4afc('0x3d')][_0x4afc('0x67')]({'where':{'id':_0x33ee71['params']['id']}})[_0x4afc('0x1f')](handleEntityNotFound(_0x172a8a,null))['then'](function(_0x588d22){if(_0x588d22){return db[_0x4afc('0x3d')][_0x4afc('0x59')]({'where':{'id':_0x588d22['id']},'include':[{'model':db[_0x4afc('0x7e')],'as':_0x4afc('0x7f'),'include':[{'model':db[_0x4afc('0x70')],'as':_0x4afc('0x80'),'where':{[_0x588d22[_0x4afc('0x7c')]]:_0x485f68},'limit':0x1,'order':[[_0x4afc('0x75'),_0x4afc('0xb4')]]}]}]})[_0x4afc('0x1f')](handleEntityNotFound(_0x172a8a,null))['then'](function(_0x46d574){if(_0x46d574&&_0x46d574[_0x4afc('0x7f')]){_0x39c4b5=_0x46d574[_0x4afc('0x5d')]({'plain':!![]});if(_0x39c4b5[_0x4afc('0x7f')]&&_0x39c4b5['List'][_0x4afc('0x80')][_0x4afc('0x48')]){return _0x39c4b5[_0x4afc('0x7f')][_0x4afc('0x80')][0x0];}return db[_0x4afc('0x70')][_0x4afc('0x5a')](_[_0x4afc('0x17')](_0x33ee71['body'],{'firstName':_0x485f68,[_0x46d574['mapKey']]:_0x485f68,'phone':_0x485f68,'ListId':_0x39c4b5['ListId']}));}})['then'](handleEntityNotFound(_0x172a8a,null))[_0x4afc('0x1f')](function(_0x3af1d3){if(_0x3af1d3){_0x5bb7b9=_0x3af1d3;return db[_0x4afc('0x8b')][_0x4afc('0x59')]({'where':{'ContactId':_0x5bb7b9['id'],'closed':![],'OpenchannelAccountId':_0x39c4b5['id']}})[_0x4afc('0x1f')](function(_0x938d9a){if(_0x938d9a){return[_0x938d9a,![]];}return db[_0x4afc('0x8b')]['create']({'UserId':_0x33ee71[_0x4afc('0x5c')]['id'],'ContactId':_0x5bb7b9['id'],'OpenchannelAccountId':_0x39c4b5['id'],'lastMsgDirection':_0x4afc('0xb5'),'Messages':[_[_0x4afc('0x50')](_0x33ee71[_0x4afc('0x5b')],{'read':![],'body':_0x33ee71[_0x4afc('0x5b')][_0x4afc('0x5b')],'OpenchannelAccountId':_0x39c4b5['id'],'UserId':_0x33ee71[_0x4afc('0x5c')]['id'],'ContactId':_0x5bb7b9['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x4afc('0x1f')](function(_0x2fb006){return[_0x2fb006,!![]];});});}})[_0x4afc('0x8d')](function(_0xa1b979,_0xef44ed){if(_0xef44ed){return _0xa1b979;}return db[_0x4afc('0x94')][_0x4afc('0x5a')](_[_0x4afc('0x50')](_0x33ee71[_0x4afc('0x5b')],{'read':![],'body':_0x33ee71[_0x4afc('0x5b')]['body'],'OpenchannelAccountId':_0x39c4b5['id'],'OpenchannelInteractionId':_0xa1b979['id'],'UserId':_0x33ee71[_0x4afc('0x5c')]['id'],'ContactId':_0x5bb7b9['id']}))[_0x4afc('0x1f')](function(_0x394182){_0xa1b979[_0x4afc('0xb6')][_0x4afc('0xb7')]=[];_0xa1b979[_0x4afc('0xb6')][_0x4afc('0xb7')][_0x4afc('0xb8')](_0x394182[_0x4afc('0xb6')]);return _0xa1b979;});});}})[_0x4afc('0x1f')](respondWithResult(_0x172a8a,null))[_0x4afc('0x29')](handleError(_0x172a8a,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 96404d3..ab9fba8 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 _0x03b6=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x223b9b,_0x243b96){var _0x53c8f2=function(_0x528e5b){while(--_0x528e5b){_0x223b9b['push'](_0x223b9b['shift']());}};_0x53c8f2(++_0x243b96);}(_0x03b6,0xfd));var _0x603b=function(_0x5146c9,_0xedfc2){_0x5146c9=_0x5146c9-0x0;var _0x10a4f4=_0x03b6[_0x5146c9];return _0x10a4f4;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x603b('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x603b('0x1')](0x0);var events={'afterCreate':_0x603b('0x2'),'afterUpdate':_0x603b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x123cf9){return function(_0x3ec8ae,_0x1aa741,_0x5539ae){OpenchannelAccountEvents[_0x603b('0x4')](_0x123cf9+':'+_0x3ec8ae['id'],_0x3ec8ae);OpenchannelAccountEvents[_0x603b('0x4')](_0x123cf9,_0x3ec8ae);_0x5539ae(null);};}for(var e in events){if(events[_0x603b('0x5')](e)){var event=events[e];OpenchannelAccount[_0x603b('0x6')](e,emitEvent(event));}}module[_0x603b('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x62f5=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelAccount','save'];(function(_0x133f40,_0x349875){var _0xa62bb5=function(_0x543273){while(--_0x543273){_0x133f40['push'](_0x133f40['shift']());}};_0xa62bb5(++_0x349875);}(_0x62f5,0xa5));var _0x562f=function(_0x43f2b0,_0x45331c){_0x43f2b0=_0x43f2b0-0x0;var _0x3bd246=_0x62f5[_0x43f2b0];return _0x3bd246;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x562f('0x0'))['db'][_0x562f('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x562f('0x2'),'afterUpdate':'update','afterDestroy':_0x562f('0x3')};function emitEvent(_0x843c16){return function(_0x598eea,_0x696678,_0x1f9abb){OpenchannelAccountEvents[_0x562f('0x4')](_0x843c16+':'+_0x598eea['id'],_0x598eea);OpenchannelAccountEvents[_0x562f('0x4')](_0x843c16,_0x598eea);_0x1f9abb(null);};}for(var e in events){if(events[_0x562f('0x5')](e)){var event=events[e];OpenchannelAccount[_0x562f('0x6')](e,emitEvent(event));}}module[_0x562f('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index fcf8023..3b4f76e 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 _0xef3e=['request-promise','path','rimraf','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','api','moment','bluebird'];(function(_0xf563d8,_0x7e7303){var _0x529a15=function(_0x47eb0e){while(--_0x47eb0e){_0xf563d8['push'](_0xf563d8['shift']());}};_0x529a15(++_0x7e7303);}(_0xef3e,0x17c));var _0xeef3=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xef3e[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0xeef3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeef3('0x1'));var moment=require(_0xeef3('0x2'));var BPromise=require(_0xeef3('0x3'));var rp=require(_0xeef3('0x4'));var fs=require('fs');var path=require(_0xeef3('0x5'));var rimraf=require(_0xeef3('0x6'));var config=require('../../config/environment');var attributes=require(_0xeef3('0x7'));module[_0xeef3('0x8')]=function(_0x4065a4,_0x105be7){return _0x4065a4[_0xeef3('0x9')](_0xeef3('0xa'),attributes,{'tableName':_0xeef3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3860=['exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelAccount.attributes'];(function(_0x272ea4,_0x432f54){var _0x2ba8be=function(_0x16935a){while(--_0x16935a){_0x272ea4['push'](_0x272ea4['shift']());}};_0x2ba8be(++_0x432f54);}(_0x3860,0x1e5));var _0x0386=function(_0x3e57d3,_0x1ad4a0){_0x3e57d3=_0x3e57d3-0x0;var _0x3a4948=_0x3860[_0x3e57d3];return _0x3a4948;};'use strict';var _=require(_0x0386('0x0'));var util=require(_0x0386('0x1'));var logger=require(_0x0386('0x2'))('api');var moment=require(_0x0386('0x3'));var BPromise=require(_0x0386('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0386('0x5'));var rimraf=require(_0x0386('0x6'));var config=require(_0x0386('0x7'));var attributes=require(_0x0386('0x8'));module[_0x0386('0x9')]=function(_0x5723a5,_0x5238c2){return _0x5723a5[_0x0386('0xa')](_0x0386('0xb'),attributes,{'tableName':_0x0386('0xc'),'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 0a5fc3f..fb00aba 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 _0xb7f9=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x587515,_0x5dcde3){var _0x553977=function(_0x13fb69){while(--_0x13fb69){_0x587515['push'](_0x587515['shift']());}};_0x553977(++_0x5dcde3);}(_0xb7f9,0x180));var _0x9b7f=function(_0x45c448,_0x326332){_0x45c448=_0x45c448-0x0;var _0x415d10=_0xb7f9[_0x45c448];return _0x415d10;};'use strict';var _=require('lodash');var util=require(_0x9b7f('0x0'));var moment=require(_0x9b7f('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b7f('0x2'));var fs=require('fs');var Redis=require(_0x9b7f('0x3'));var db=require(_0x9b7f('0x4'))['db'];var utils=require(_0x9b7f('0x5'));var logger=require(_0x9b7f('0x6'))(_0x9b7f('0x7'));var config=require(_0x9b7f('0x8'));var jayson=require(_0x9b7f('0x9'));var client=jayson[_0x9b7f('0xa')][_0x9b7f('0xb')]({'port':0x232a});config[_0x9b7f('0xc')]=_[_0x9b7f('0xd')](config[_0x9b7f('0xc')],{'host':_0x9b7f('0xe'),'port':0x18eb});var socket=require(_0x9b7f('0xf'))(new Redis(config[_0x9b7f('0xc')]));require(_0x9b7f('0x10'))[_0x9b7f('0x11')](socket);function respondWithRpcPromise(_0x363a42,_0x3e52e2,_0x55eb29){return new BPromise(function(_0x38b6e1,_0x895cd2){return client[_0x9b7f('0x12')](_0x363a42,_0x55eb29)['then'](function(_0x598781){logger[_0x9b7f('0x13')](_0x9b7f('0x14'),_0x3e52e2,_0x9b7f('0x15'));logger['debug'](_0x9b7f('0x16'),_0x3e52e2,_0x9b7f('0x15'),JSON['stringify'](_0x598781));if(_0x598781[_0x9b7f('0x17')]){if(_0x598781[_0x9b7f('0x17')][_0x9b7f('0x18')]===0x1f4){logger[_0x9b7f('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e52e2,_0x598781[_0x9b7f('0x17')][_0x9b7f('0x19')]);return _0x895cd2(_0x598781['error'][_0x9b7f('0x19')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3e52e2,_0x598781[_0x9b7f('0x17')][_0x9b7f('0x19')]);return _0x38b6e1(_0x598781[_0x9b7f('0x17')][_0x9b7f('0x19')]);}else{logger[_0x9b7f('0x13')](_0x9b7f('0x14'),_0x3e52e2,'request\x20sent');_0x38b6e1(_0x598781[_0x9b7f('0x1a')][_0x9b7f('0x19')]);}})[_0x9b7f('0x1b')](function(_0x174d8b){logger[_0x9b7f('0x17')](_0x9b7f('0x14'),_0x3e52e2,_0x174d8b);_0x895cd2(_0x174d8b);});});} \ No newline at end of file +var _0x76a3=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','client'];(function(_0x4864ea,_0x7764ed){var _0x12e74f=function(_0x3fe41d){while(--_0x3fe41d){_0x4864ea['push'](_0x4864ea['shift']());}};_0x12e74f(++_0x7764ed);}(_0x76a3,0x12d));var _0x376a=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x76a3[_0x5e36d1];return _0x950b9e;};'use strict';var _=require(_0x376a('0x0'));var util=require('util');var moment=require(_0x376a('0x1'));var BPromise=require(_0x376a('0x2'));var rs=require(_0x376a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x376a('0x4'))['db'];var utils=require(_0x376a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x376a('0x6')][_0x376a('0x7')]({'port':0x232a});config[_0x376a('0x8')]=_[_0x376a('0x9')](config['redis'],{'host':_0x376a('0xa'),'port':0x18eb});var socket=require(_0x376a('0xb'))(new Redis(config[_0x376a('0x8')]));require('./openchannelAccount.socket')[_0x376a('0xc')](socket);function respondWithRpcPromise(_0x4c6715,_0x1aaf7e,_0x3037ef){return new BPromise(function(_0x16476f,_0x3d8b5f){return client[_0x376a('0xd')](_0x4c6715,_0x3037ef)[_0x376a('0xe')](function(_0x3a6bb1){logger[_0x376a('0xf')](_0x376a('0x10'),_0x1aaf7e,_0x376a('0x11'));logger['debug'](_0x376a('0x12'),_0x1aaf7e,_0x376a('0x11'),JSON['stringify'](_0x3a6bb1));if(_0x3a6bb1[_0x376a('0x13')]){if(_0x3a6bb1[_0x376a('0x13')][_0x376a('0x14')]===0x1f4){logger[_0x376a('0x13')](_0x376a('0x10'),_0x1aaf7e,_0x3a6bb1[_0x376a('0x13')][_0x376a('0x15')]);return _0x3d8b5f(_0x3a6bb1[_0x376a('0x13')][_0x376a('0x15')]);}logger[_0x376a('0x13')](_0x376a('0x10'),_0x1aaf7e,_0x3a6bb1[_0x376a('0x13')][_0x376a('0x15')]);return _0x16476f(_0x3a6bb1['error'][_0x376a('0x15')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x1aaf7e,_0x376a('0x11'));_0x16476f(_0x3a6bb1['result'][_0x376a('0x15')]);}})['catch'](function(_0xc466c2){logger[_0x376a('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x1aaf7e,_0xc466c2);_0x3d8b5f(_0xc466c2);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7c564e0..f9a27b8 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 _0x364a=['removeListener','length','./openchannelAccount.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x364a,0x17c));var _0xa364=function(_0x45aa26,_0x206b0b){_0x45aa26=_0x45aa26-0x0;var _0x4da7ca=_0x364a[_0x45aa26];return _0x4da7ca;};'use strict';var OpenchannelAccountEvents=require(_0xa364('0x0'));var events=[_0xa364('0x1'),_0xa364('0x2'),_0xa364('0x3')];function createListener(_0x1b38ef,_0xc438e0){return function(_0x4b28a8){_0xc438e0['emit'](_0x1b38ef,_0x4b28a8);};}function removeListener(_0x43f48b,_0x5a1666){return function(){OpenchannelAccountEvents[_0xa364('0x4')](_0x43f48b,_0x5a1666);};}exports['register']=function(_0x55f28b){for(var _0x1fc334=0x0,_0x526dbf=events[_0xa364('0x5')];_0x1fc334<_0x526dbf;_0x1fc334++){var _0x24034b=events[_0x1fc334];var _0x257788=createListener('openchannelAccount:'+_0x24034b,_0x55f28b);OpenchannelAccountEvents['on'](_0x24034b,_0x257788);}}; \ No newline at end of file +var _0xe9cc=['./openchannelAccount.events','save','remove','update','emit','length','openchannelAccount:'];(function(_0x451ff6,_0x3c71d6){var _0x94ce=function(_0x312331){while(--_0x312331){_0x451ff6['push'](_0x451ff6['shift']());}};_0x94ce(++_0x3c71d6);}(_0xe9cc,0x1ea));var _0xce9c=function(_0x1d9a3d,_0x27b142){_0x1d9a3d=_0x1d9a3d-0x0;var _0x5ef785=_0xe9cc[_0x1d9a3d];return _0x5ef785;};'use strict';var OpenchannelAccountEvents=require(_0xce9c('0x0'));var events=[_0xce9c('0x1'),_0xce9c('0x2'),_0xce9c('0x3')];function createListener(_0xa1bf40,_0x8287a0){return function(_0x2522ad){_0x8287a0[_0xce9c('0x4')](_0xa1bf40,_0x2522ad);};}function removeListener(_0x300f9f,_0x4a28cc){return function(){OpenchannelAccountEvents['removeListener'](_0x300f9f,_0x4a28cc);};}exports['register']=function(_0x12acf7){for(var _0x14d3bf=0x0,_0x39b51c=events[_0xce9c('0x5')];_0x14d3bf<_0x39b51c;_0x14d3bf++){var _0x336f90=events[_0x14d3bf];var _0x2cf7f9=createListener(_0xce9c('0x6')+_0x336f90,_0x12acf7);OpenchannelAccountEvents['on'](_0x336f90,_0x2cf7f9);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 85a35db..317587c 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 _0xe69d=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports'];(function(_0x452791,_0x1c20df){var _0x459acf=function(_0x42a14b){while(--_0x42a14b){_0x452791['push'](_0x452791['shift']());}};_0x459acf(++_0x1c20df);}(_0xe69d,0xff));var _0xde69=function(_0x35ac06,_0x3c39ac){_0x35ac06=_0x35ac06-0x0;var _0x379a51=_0xe69d[_0x35ac06];return _0x379a51;};'use strict';var multer=require(_0xde69('0x0'));var util=require('util');var path=require(_0xde69('0x1'));var timeout=require(_0xde69('0x2'));var express=require(_0xde69('0x3'));var router=express[_0xde69('0x4')]();var auth=require(_0xde69('0x5'));var interaction=require(_0xde69('0x6'));var config=require('../../config/environment');var controller=require('./openchannelApplication.controller');router[_0xde69('0x7')]('/',auth[_0xde69('0x8')](),controller['index']);router['get']('/:id',auth[_0xde69('0x8')](),controller[_0xde69('0x9')]);router[_0xde69('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xde69('0xb')]('/:id',auth[_0xde69('0x8')](),controller[_0xde69('0xc')]);router[_0xde69('0xd')](_0xde69('0xe'),auth['isAuthenticated'](),controller[_0xde69('0xf')]);module[_0xde69('0x10')]=router; \ No newline at end of file +var _0xeffa=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x3b04e1,_0x3547d0){var _0x402020=function(_0x48d7a1){while(--_0x48d7a1){_0x3b04e1['push'](_0x3b04e1['shift']());}};_0x402020(++_0x3547d0);}(_0xeffa,0x1c9));var _0xaeff=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xeffa[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require(_0xaeff('0x0'));var util=require(_0xaeff('0x1'));var path=require(_0xaeff('0x2'));var timeout=require(_0xaeff('0x3'));var express=require(_0xaeff('0x4'));var router=express[_0xaeff('0x5')]();var auth=require(_0xaeff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaeff('0x7'));var controller=require(_0xaeff('0x8'));router[_0xaeff('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xaeff('0x9')]('/:id',auth[_0xaeff('0xa')](),controller['show']);router['post']('/',auth[_0xaeff('0xa')](),controller[_0xaeff('0xb')]);router['put'](_0xaeff('0xc'),auth[_0xaeff('0xa')](),controller[_0xaeff('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xaeff('0xe')]);module[_0xaeff('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 5d67043..32c80bf 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 _0x768f=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0x2833f4,_0x286f1f){var _0x51d46f=function(_0x3f063f){while(--_0x3f063f){_0x2833f4['push'](_0x2833f4['shift']());}};_0x51d46f(++_0x286f1f);}(_0x768f,0x17a));var _0xf768=function(_0x2a81b3,_0x3bd92d){_0x2a81b3=_0x2a81b3-0x0;var _0x3619c0=_0x768f[_0x2a81b3];return _0x3619c0;};'use strict';var Sequelize=require(_0xf768('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf768('0x1')],'allowNull':![],'defaultValue':_0xf768('0x2')},'appdata':{'type':Sequelize[_0xf768('0x3')]()},'description':{'type':Sequelize[_0xf768('0x1')]},'interval':{'type':Sequelize[_0xf768('0x1')],'defaultValue':_0xf768('0x4')}}; \ No newline at end of file +var _0xfe61=['TEXT','STRING','*,*,*,*','INTEGER','noop'];(function(_0x387713,_0x4cbfe0){var _0x3b8151=function(_0x494233){while(--_0x494233){_0x387713['push'](_0x387713['shift']());}};_0x3b8151(++_0x4cbfe0);}(_0xfe61,0x8f));var _0x1fe6=function(_0x27057e,_0x38618b){_0x27057e=_0x27057e-0x0;var _0x1bb751=_0xfe61[_0x27057e];return _0x1bb751;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x1fe6('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1fe6('0x1')},'appdata':{'type':Sequelize[_0x1fe6('0x2')]()},'description':{'type':Sequelize[_0x1fe6('0x3')]},'interval':{'type':Sequelize[_0x1fe6('0x3')],'defaultValue':_0x1fe6('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index f2ec43a..7c8f4a6 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 _0x3980=['create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','apply','reject','update','sendStatus','error','name','send','index','OpenchannelApplication','rawAttributes','fieldName','key','map','keys','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','sort','filters','where','merge','type','VIRTUAL','filter','options','then','includeAll','findAll','catch','params','include','find'];(function(_0x17bb62,_0x253786){var _0x1ef8d8=function(_0x44c031){while(--_0x44c031){_0x17bb62['push'](_0x17bb62['shift']());}};_0x1ef8d8(++_0x253786);}(_0x3980,0xe0));var _0x0398=function(_0x251ce1,_0x2dcac8){_0x251ce1=_0x251ce1-0x0;var _0x372d1f=_0x3980[_0x251ce1];return _0x372d1f;};'use strict';var pdf=require(_0x0398('0x0'));var emlformat=require(_0x0398('0x1'));var rimraf=require(_0x0398('0x2'));var zipdir=require(_0x0398('0x3'));var jsonpatch=require(_0x0398('0x4'));var rp=require(_0x0398('0x5'));var moment=require(_0x0398('0x6'));var BPromise=require(_0x0398('0x7'));var Mustache=require(_0x0398('0x8'));var util=require(_0x0398('0x9'));var path=require(_0x0398('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0398('0xb'));var fs=require('fs');var _=require(_0x0398('0xc'));var squel=require(_0x0398('0xd'));var crypto=require(_0x0398('0xe'));var jsforce=require(_0x0398('0xf'));var deskjs=require(_0x0398('0x10'));var toCsv=require(_0x0398('0x11'));var querystring=require(_0x0398('0x12'));var Papa=require(_0x0398('0x13'));var Redis=require(_0x0398('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x0398('0x15'));var as=require(_0x0398('0x16'));var hardwareService=require(_0x0398('0x17'));var logger=require(_0x0398('0x18'))('api');var utils=require(_0x0398('0x19'));var config=require(_0x0398('0x1a'));var licenseUtil=require(_0x0398('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15663d,_0xee3624){_0xee3624=_0xee3624||0xcc;return function(_0x50f4e0){if(_0x50f4e0){return _0x15663d['sendStatus'](_0xee3624);}return _0x15663d[_0x0398('0x1c')](_0xee3624)[_0x0398('0x1d')]();};}function respondWithResult(_0x2cf308,_0x32e57d){_0x32e57d=_0x32e57d||0xc8;return function(_0x60e541){if(_0x60e541){return _0x2cf308[_0x0398('0x1c')](_0x32e57d)[_0x0398('0x1e')](_0x60e541);}};}function respondWithFilteredResult(_0x200538,_0x479113){return function(_0x30a16b){if(_0x30a16b){var _0x4b3189=_0x30a16b[_0x0398('0x1f')],_0x55e0e6=_0x479113[_0x0398('0x20')],_0x14f193=_0x479113[_0x0398('0x20')]+_0x479113[_0x0398('0x21')],_0x3fce9e;if(_0x14f193>=_0x4b3189){_0x14f193=_0x4b3189;_0x3fce9e=0xc8;}else{_0x3fce9e=0xce;}_0x200538[_0x0398('0x1c')](_0x3fce9e);return _0x200538[_0x0398('0x22')]('Content-Range',_0x55e0e6+'-'+_0x14f193+'/'+_0x4b3189)['json'](_0x30a16b);}return null;};}function patchUpdates(_0x323e54){return function(_0x104e16){try{jsonpatch[_0x0398('0x23')](_0x104e16,_0x323e54,!![]);}catch(_0x37ca72){return BPromise[_0x0398('0x24')](_0x37ca72);}return _0x104e16['save']();};}function saveUpdates(_0xe1336c,_0x39b5f7){return function(_0x2b95fc){if(_0x2b95fc){return _0x2b95fc[_0x0398('0x25')](_0xe1336c)['then'](function(_0x4daf6b){return _0x4daf6b;});}return null;};}function removeEntity(_0x32d136,_0x2c6720){return function(_0x5169f9){if(_0x5169f9){return _0x5169f9['destroy']()['then'](function(){_0x32d136[_0x0398('0x1c')](0xcc)[_0x0398('0x1d')]();});}};}function handleEntityNotFound(_0x18061a,_0x135b1e){return function(_0x2044e0){if(!_0x2044e0){_0x18061a[_0x0398('0x26')](0x194);}return _0x2044e0;};}function handleError(_0x5ef88c,_0x29c632){_0x29c632=_0x29c632||0x1f4;return function(_0x446628){logger[_0x0398('0x27')](_0x446628['stack']);if(_0x446628[_0x0398('0x28')]){delete _0x446628[_0x0398('0x28')];}_0x5ef88c[_0x0398('0x1c')](_0x29c632)[_0x0398('0x29')](_0x446628);};}exports[_0x0398('0x2a')]=function(_0x29cc77,_0x352861){var _0x2b05bd={},_0x204e5b={},_0x10d321={'count':0x0,'rows':[]};var _0x1622f5=_['map'](db[_0x0398('0x2b')][_0x0398('0x2c')],function(_0x54df93){return{'name':_0x54df93[_0x0398('0x2d')],'type':_0x54df93['type'][_0x0398('0x2e')]};});_0x204e5b['model']=_[_0x0398('0x2f')](_0x1622f5,'name');_0x204e5b['query']=_[_0x0398('0x30')](_0x29cc77['query']);_0x204e5b['filters']=_[_0x0398('0x31')](_0x204e5b['model'],_0x204e5b[_0x0398('0x32')]);_0x2b05bd[_0x0398('0x33')]=_['intersection'](_0x204e5b[_0x0398('0x34')],qs[_0x0398('0x35')](_0x29cc77[_0x0398('0x32')][_0x0398('0x35')]));_0x2b05bd[_0x0398('0x33')]=_0x2b05bd[_0x0398('0x33')][_0x0398('0x36')]?_0x2b05bd[_0x0398('0x33')]:_0x204e5b[_0x0398('0x34')];if(!_0x29cc77[_0x0398('0x32')][_0x0398('0x37')](_0x0398('0x38'))){_0x2b05bd[_0x0398('0x21')]=qs['limit'](_0x29cc77[_0x0398('0x32')][_0x0398('0x21')]);_0x2b05bd[_0x0398('0x20')]=qs[_0x0398('0x20')](_0x29cc77[_0x0398('0x32')]['offset']);}_0x2b05bd['order']=qs['sort'](_0x29cc77[_0x0398('0x32')][_0x0398('0x39')]);_0x2b05bd['where']=qs['filters'](_['pick'](_0x29cc77[_0x0398('0x32')],_0x204e5b[_0x0398('0x3a')]),_0x1622f5);if(_0x29cc77['query']['filter']){_0x2b05bd[_0x0398('0x3b')]=_[_0x0398('0x3c')](_0x2b05bd[_0x0398('0x3b')],{'$or':_[_0x0398('0x2f')](_0x1622f5,function(_0x476ecc){if(_0x476ecc[_0x0398('0x3d')]!==_0x0398('0x3e')){var _0x2a8653={};_0x2a8653[_0x476ecc[_0x0398('0x28')]]={'$like':'%'+_0x29cc77[_0x0398('0x32')][_0x0398('0x3f')]+'%'};return _0x2a8653;}})});}_0x2b05bd=_[_0x0398('0x3c')]({},_0x2b05bd,_0x29cc77[_0x0398('0x40')]);var _0x1b8ae2={'where':_0x2b05bd['where']};return db[_0x0398('0x2b')][_0x0398('0x1f')](_0x1b8ae2)[_0x0398('0x41')](function(_0x31893a){_0x10d321['count']=_0x31893a;if(_0x29cc77[_0x0398('0x32')][_0x0398('0x42')]){_0x2b05bd['include']=[{'all':!![]}];}return db[_0x0398('0x2b')][_0x0398('0x43')](_0x2b05bd);})[_0x0398('0x41')](function(_0x5aa4a4){_0x10d321['rows']=_0x5aa4a4;return _0x10d321;})['then'](respondWithFilteredResult(_0x352861,_0x2b05bd))[_0x0398('0x44')](handleError(_0x352861,null));};exports['show']=function(_0x15c4bc,_0x306091){var _0x45d132={'raw':!![],'where':{'id':_0x15c4bc[_0x0398('0x45')]['id']}},_0x1ca34b={};_0x1ca34b[_0x0398('0x34')]=_[_0x0398('0x30')](db[_0x0398('0x2b')][_0x0398('0x2c')]);_0x1ca34b['query']=_[_0x0398('0x30')](_0x15c4bc['query']);_0x1ca34b['filters']=_['intersection'](_0x1ca34b['model'],_0x1ca34b[_0x0398('0x32')]);_0x45d132[_0x0398('0x33')]=_[_0x0398('0x31')](_0x1ca34b[_0x0398('0x34')],qs[_0x0398('0x35')](_0x15c4bc['query']['fields']));_0x45d132[_0x0398('0x33')]=_0x45d132[_0x0398('0x33')][_0x0398('0x36')]?_0x45d132[_0x0398('0x33')]:_0x1ca34b[_0x0398('0x34')];if(_0x15c4bc[_0x0398('0x32')][_0x0398('0x42')]){_0x45d132[_0x0398('0x46')]=[{'all':!![]}];}_0x45d132=_[_0x0398('0x3c')]({},_0x45d132,_0x15c4bc[_0x0398('0x40')]);return db['OpenchannelApplication'][_0x0398('0x47')](_0x45d132)['then'](handleEntityNotFound(_0x306091,null))[_0x0398('0x41')](respondWithResult(_0x306091,null))[_0x0398('0x44')](handleError(_0x306091,null));};exports[_0x0398('0x48')]=function(_0x28ad50,_0x24ef1e){return db['OpenchannelApplication'][_0x0398('0x48')](_0x28ad50[_0x0398('0x49')],{})[_0x0398('0x41')](respondWithResult(_0x24ef1e,0xc9))[_0x0398('0x44')](handleError(_0x24ef1e,null));};exports['update']=function(_0x3047db,_0x19e731){if(_0x3047db[_0x0398('0x49')]['id']){delete _0x3047db['body']['id'];}return db[_0x0398('0x2b')][_0x0398('0x47')]({'where':{'id':_0x3047db[_0x0398('0x45')]['id']}})['then'](handleEntityNotFound(_0x19e731,null))[_0x0398('0x41')](saveUpdates(_0x3047db[_0x0398('0x49')],null))[_0x0398('0x41')](respondWithResult(_0x19e731,null))[_0x0398('0x44')](handleError(_0x19e731,null));};exports['destroy']=function(_0x4a5423,_0x57a443){return db[_0x0398('0x2b')][_0x0398('0x47')]({'where':{'id':_0x4a5423[_0x0398('0x45')]['id']}})['then'](handleEntityNotFound(_0x57a443,null))['then'](removeEntity(_0x57a443,null))[_0x0398('0x44')](handleError(_0x57a443,null));}; \ No newline at end of file +var _0xa454=['fields','includeAll','find','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','length','model','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','OpenchannelApplication','then','findAll','catch','show','params'];(function(_0x1e4f67,_0xd1196){var _0x233ff5=function(_0x44d34d){while(--_0x44d34d){_0x1e4f67['push'](_0x1e4f67['shift']());}};_0x233ff5(++_0xd1196);}(_0xa454,0x1ce));var _0x4a45=function(_0x5ce579,_0x2bfc6d){_0x5ce579=_0x5ce579-0x0;var _0x5234cd=_0xa454[_0x5ce579];return _0x5234cd;};'use strict';var pdf=require(_0x4a45('0x0'));var emlformat=require(_0x4a45('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4a45('0x2'));var jsonpatch=require(_0x4a45('0x3'));var rp=require(_0x4a45('0x4'));var moment=require(_0x4a45('0x5'));var BPromise=require(_0x4a45('0x6'));var Mustache=require(_0x4a45('0x7'));var util=require(_0x4a45('0x8'));var path=require('path');var sox=require(_0x4a45('0x9'));var csv=require(_0x4a45('0xa'));var ejs=require(_0x4a45('0xb'));var fs=require('fs');var _=require(_0x4a45('0xc'));var squel=require(_0x4a45('0xd'));var crypto=require(_0x4a45('0xe'));var jsforce=require(_0x4a45('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4a45('0xa'));var querystring=require('querystring');var Papa=require(_0x4a45('0x10'));var Redis=require(_0x4a45('0x11'));var authService=require(_0x4a45('0x12'));var qs=require(_0x4a45('0x13'));var as=require(_0x4a45('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4a45('0x15'));var utils=require(_0x4a45('0x16'));var config=require(_0x4a45('0x17'));var licenseUtil=require(_0x4a45('0x18'));var db=require(_0x4a45('0x19'))['db'];function respondWithStatusCode(_0x13a02d,_0x3b7e2c){_0x3b7e2c=_0x3b7e2c||0xcc;return function(_0x332dea){if(_0x332dea){return _0x13a02d[_0x4a45('0x1a')](_0x3b7e2c);}return _0x13a02d[_0x4a45('0x1b')](_0x3b7e2c)[_0x4a45('0x1c')]();};}function respondWithResult(_0x1734b1,_0x34c984){_0x34c984=_0x34c984||0xc8;return function(_0x521533){if(_0x521533){return _0x1734b1[_0x4a45('0x1b')](_0x34c984)['json'](_0x521533);}};}function respondWithFilteredResult(_0x5e9fab,_0x585216){return function(_0x5e3b58){if(_0x5e3b58){var _0x53ec31=_0x5e3b58[_0x4a45('0x1d')],_0x4673ab=_0x585216[_0x4a45('0x1e')],_0x25d6a6=_0x585216[_0x4a45('0x1e')]+_0x585216[_0x4a45('0x1f')],_0x48dc73;if(_0x25d6a6>=_0x53ec31){_0x25d6a6=_0x53ec31;_0x48dc73=0xc8;}else{_0x48dc73=0xce;}_0x5e9fab[_0x4a45('0x1b')](_0x48dc73);return _0x5e9fab[_0x4a45('0x20')](_0x4a45('0x21'),_0x4673ab+'-'+_0x25d6a6+'/'+_0x53ec31)['json'](_0x5e3b58);}return null;};}function patchUpdates(_0x31496e){return function(_0x594ce4){try{jsonpatch[_0x4a45('0x22')](_0x594ce4,_0x31496e,!![]);}catch(_0x56137a){return BPromise[_0x4a45('0x23')](_0x56137a);}return _0x594ce4[_0x4a45('0x24')]();};}function saveUpdates(_0x3227ab,_0xf33013){return function(_0x1d7e8b){if(_0x1d7e8b){return _0x1d7e8b['update'](_0x3227ab)['then'](function(_0x51c3da){return _0x51c3da;});}return null;};}function removeEntity(_0x3dc465,_0xfb0686){return function(_0x271dbb){if(_0x271dbb){return _0x271dbb[_0x4a45('0x25')]()['then'](function(){_0x3dc465[_0x4a45('0x1b')](0xcc)[_0x4a45('0x1c')]();});}};}function handleEntityNotFound(_0x72776,_0x4499db){return function(_0x56baf4){if(!_0x56baf4){_0x72776[_0x4a45('0x1a')](0x194);}return _0x56baf4;};}function handleError(_0x54dd55,_0x136a7c){_0x136a7c=_0x136a7c||0x1f4;return function(_0x561ef7){logger[_0x4a45('0x26')](_0x561ef7[_0x4a45('0x27')]);if(_0x561ef7[_0x4a45('0x28')]){delete _0x561ef7[_0x4a45('0x28')];}_0x54dd55['status'](_0x136a7c)[_0x4a45('0x29')](_0x561ef7);};}exports[_0x4a45('0x2a')]=function(_0x2cfecc,_0x10d5c7){var _0x29323e={},_0x1b1691={},_0x1b5b92={'count':0x0,'rows':[]};var _0x1064a3=_[_0x4a45('0x2b')](db['OpenchannelApplication'][_0x4a45('0x2c')],function(_0x3353fe){return{'name':_0x3353fe[_0x4a45('0x2d')],'type':_0x3353fe[_0x4a45('0x2e')][_0x4a45('0x2f')]};});_0x1b1691['model']=_[_0x4a45('0x2b')](_0x1064a3,_0x4a45('0x28'));_0x1b1691[_0x4a45('0x30')]=_[_0x4a45('0x31')](_0x2cfecc[_0x4a45('0x30')]);_0x1b1691['filters']=_['intersection'](_0x1b1691['model'],_0x1b1691[_0x4a45('0x30')]);_0x29323e[_0x4a45('0x32')]=_[_0x4a45('0x33')](_0x1b1691['model'],qs['fields'](_0x2cfecc['query']['fields']));_0x29323e[_0x4a45('0x32')]=_0x29323e[_0x4a45('0x32')][_0x4a45('0x34')]?_0x29323e[_0x4a45('0x32')]:_0x1b1691[_0x4a45('0x35')];if(!_0x2cfecc['query'][_0x4a45('0x36')](_0x4a45('0x37'))){_0x29323e[_0x4a45('0x1f')]=qs[_0x4a45('0x1f')](_0x2cfecc[_0x4a45('0x30')][_0x4a45('0x1f')]);_0x29323e[_0x4a45('0x1e')]=qs[_0x4a45('0x1e')](_0x2cfecc[_0x4a45('0x30')][_0x4a45('0x1e')]);}_0x29323e['order']=qs[_0x4a45('0x38')](_0x2cfecc[_0x4a45('0x30')][_0x4a45('0x38')]);_0x29323e[_0x4a45('0x39')]=qs[_0x4a45('0x3a')](_[_0x4a45('0x3b')](_0x2cfecc[_0x4a45('0x30')],_0x1b1691[_0x4a45('0x3a')]),_0x1064a3);if(_0x2cfecc['query']['filter']){_0x29323e[_0x4a45('0x39')]=_[_0x4a45('0x3c')](_0x29323e[_0x4a45('0x39')],{'$or':_['map'](_0x1064a3,function(_0x1b0a09){if(_0x1b0a09[_0x4a45('0x2e')]!==_0x4a45('0x3d')){var _0x2997b2={};_0x2997b2[_0x1b0a09[_0x4a45('0x28')]]={'$like':'%'+_0x2cfecc['query'][_0x4a45('0x3e')]+'%'};return _0x2997b2;}})});}_0x29323e=_[_0x4a45('0x3c')]({},_0x29323e,_0x2cfecc[_0x4a45('0x3f')]);var _0x5222d2={'where':_0x29323e[_0x4a45('0x39')]};return db[_0x4a45('0x40')]['count'](_0x5222d2)[_0x4a45('0x41')](function(_0x1b8e5d){_0x1b5b92[_0x4a45('0x1d')]=_0x1b8e5d;if(_0x2cfecc[_0x4a45('0x30')]['includeAll']){_0x29323e['include']=[{'all':!![]}];}return db[_0x4a45('0x40')][_0x4a45('0x42')](_0x29323e);})[_0x4a45('0x41')](function(_0x164276){_0x1b5b92['rows']=_0x164276;return _0x1b5b92;})['then'](respondWithFilteredResult(_0x10d5c7,_0x29323e))[_0x4a45('0x43')](handleError(_0x10d5c7,null));};exports[_0x4a45('0x44')]=function(_0x50e7fb,_0x541f7b){var _0x964b46={'raw':!![],'where':{'id':_0x50e7fb[_0x4a45('0x45')]['id']}},_0x17bb0b={};_0x17bb0b[_0x4a45('0x35')]=_['keys'](db['OpenchannelApplication'][_0x4a45('0x2c')]);_0x17bb0b[_0x4a45('0x30')]=_[_0x4a45('0x31')](_0x50e7fb[_0x4a45('0x30')]);_0x17bb0b[_0x4a45('0x3a')]=_[_0x4a45('0x33')](_0x17bb0b[_0x4a45('0x35')],_0x17bb0b[_0x4a45('0x30')]);_0x964b46[_0x4a45('0x32')]=_[_0x4a45('0x33')](_0x17bb0b[_0x4a45('0x35')],qs[_0x4a45('0x46')](_0x50e7fb[_0x4a45('0x30')][_0x4a45('0x46')]));_0x964b46[_0x4a45('0x32')]=_0x964b46[_0x4a45('0x32')][_0x4a45('0x34')]?_0x964b46[_0x4a45('0x32')]:_0x17bb0b[_0x4a45('0x35')];if(_0x50e7fb[_0x4a45('0x30')][_0x4a45('0x47')]){_0x964b46['include']=[{'all':!![]}];}_0x964b46=_[_0x4a45('0x3c')]({},_0x964b46,_0x50e7fb[_0x4a45('0x3f')]);return db[_0x4a45('0x40')][_0x4a45('0x48')](_0x964b46)[_0x4a45('0x41')](handleEntityNotFound(_0x541f7b,null))[_0x4a45('0x41')](respondWithResult(_0x541f7b,null))[_0x4a45('0x43')](handleError(_0x541f7b,null));};exports[_0x4a45('0x49')]=function(_0x32c827,_0x43de50){return db[_0x4a45('0x40')]['create'](_0x32c827[_0x4a45('0x4a')],{})[_0x4a45('0x41')](respondWithResult(_0x43de50,0xc9))[_0x4a45('0x43')](handleError(_0x43de50,null));};exports[_0x4a45('0x4b')]=function(_0x265fc0,_0x1c95c7){if(_0x265fc0[_0x4a45('0x4a')]['id']){delete _0x265fc0['body']['id'];}return db[_0x4a45('0x40')][_0x4a45('0x48')]({'where':{'id':_0x265fc0[_0x4a45('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c95c7,null))[_0x4a45('0x41')](saveUpdates(_0x265fc0[_0x4a45('0x4a')],null))['then'](respondWithResult(_0x1c95c7,null))[_0x4a45('0x43')](handleError(_0x1c95c7,null));};exports['destroy']=function(_0x2e0d10,_0x5f593b){return db[_0x4a45('0x40')][_0x4a45('0x48')]({'where':{'id':_0x2e0d10[_0x4a45('0x45')]['id']}})[_0x4a45('0x41')](handleEntityNotFound(_0x5f593b,null))[_0x4a45('0x41')](removeEntity(_0x5f593b,null))[_0x4a45('0x43')](handleError(_0x5f593b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 24b06d8..95b38f5 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 _0x37c8=['util','../../config/logger','bluebird','path','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2fe58d,_0x36c8da){var _0x2d7de1=function(_0x3b5ce4){while(--_0x3b5ce4){_0x2fe58d['push'](_0x2fe58d['shift']());}};_0x2d7de1(++_0x36c8da);}(_0x37c8,0x6e));var _0x837c=function(_0x27c24e,_0x5db1c7){_0x27c24e=_0x27c24e-0x0;var _0x39004a=_0x37c8[_0x27c24e];return _0x39004a;};'use strict';var _=require('lodash');var util=require(_0x837c('0x0'));var logger=require(_0x837c('0x1'))('api');var moment=require('moment');var BPromise=require(_0x837c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x837c('0x3'));var rimraf=require('rimraf');var config=require(_0x837c('0x4'));var attributes=require(_0x837c('0x5'));module[_0x837c('0x6')]=function(_0x885867,_0x2a9a85){return _0x885867['define'](_0x837c('0x7'),attributes,{'tableName':_0x837c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x837c('0x9'),'collate':_0x837c('0xa')});}; \ No newline at end of file +var _0x74cc=['rimraf','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','path'];(function(_0x20cecd,_0x19fdd6){var _0x5a6169=function(_0x175d03){while(--_0x175d03){_0x20cecd['push'](_0x20cecd['shift']());}};_0x5a6169(++_0x19fdd6);}(_0x74cc,0xc6));var _0xc74c=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x74cc[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0xc74c('0x0'));var logger=require(_0xc74c('0x1'))(_0xc74c('0x2'));var moment=require(_0xc74c('0x3'));var BPromise=require(_0xc74c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc74c('0x5'));var rimraf=require(_0xc74c('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xc74c('0x7')]=function(_0x4eb8ba,_0xfd9379){return _0x4eb8ba[_0xc74c('0x8')](_0xc74c('0x9'),attributes,{'tableName':_0xc74c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc74c('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 1923fb1..27153ee 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 _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index a90f6ce..c8d74b0 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 _0x1d40=['exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','index','/describe','get','/:id','show','/:id/download','download','post','/:id/tags','openchannel','openchannelinteraction:addtags','openchannelinteraction:update','update','delete','tracked','openchannelinteraction:destroy','destroy','removeTags'];(function(_0x3517d9,_0x1e6703){var _0x29a2f4=function(_0x29efb9){while(--_0x29efb9){_0x3517d9['push'](_0x3517d9['shift']());}};_0x29a2f4(++_0x1e6703);}(_0x1d40,0x1b1));var _0x01d4=function(_0x4ccad7,_0x2daf62){_0x4ccad7=_0x4ccad7-0x0;var _0x3a1bc0=_0x1d40[_0x4ccad7];return _0x3a1bc0;};'use strict';var multer=require(_0x01d4('0x0'));var util=require(_0x01d4('0x1'));var path=require(_0x01d4('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x01d4('0x3')]();var auth=require(_0x01d4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x01d4('0x5'));var controller=require(_0x01d4('0x6'));router['get']('/',auth[_0x01d4('0x7')](),controller[_0x01d4('0x8')]);router['get'](_0x01d4('0x9'),auth[_0x01d4('0x7')](),controller['describe']);router[_0x01d4('0xa')](_0x01d4('0xb'),auth[_0x01d4('0x7')](),controller[_0x01d4('0xc')]);router[_0x01d4('0xa')]('/:id/messages',auth[_0x01d4('0x7')](),controller['getMessages']);router[_0x01d4('0xa')](_0x01d4('0xd'),auth[_0x01d4('0x7')](),controller[_0x01d4('0xe')]);router[_0x01d4('0xf')]('/',auth[_0x01d4('0x7')](),controller['create']);router[_0x01d4('0xf')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x01d4('0xf')](_0x01d4('0x10'),auth[_0x01d4('0x7')](),interaction['tracked'](_0x01d4('0x11'),_0x01d4('0x12')),controller['addTags']);router['put'](_0x01d4('0xb'),auth[_0x01d4('0x7')](),interaction['tracked']('openchannel',_0x01d4('0x13')),controller[_0x01d4('0x14')]);router[_0x01d4('0x15')](_0x01d4('0xb'),auth[_0x01d4('0x7')](),interaction[_0x01d4('0x16')](_0x01d4('0x11'),_0x01d4('0x17')),controller[_0x01d4('0x18')]);router[_0x01d4('0x15')]('/:id/tags',auth[_0x01d4('0x7')](),controller[_0x01d4('0x19')]);module[_0x01d4('0x1a')]=router; \ No newline at end of file +var _0xb4f4=['destroy','delete','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','openchannelinteraction:destroy'];(function(_0x12ed7d,_0x3fcc0e){var _0x5c05fa=function(_0x55f78f){while(--_0x55f78f){_0x12ed7d['push'](_0x12ed7d['shift']());}};_0x5c05fa(++_0x3fcc0e);}(_0xb4f4,0x158));var _0x4b4f=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xb4f4[_0x2070da];return _0x4f9fe1;};'use strict';var multer=require(_0x4b4f('0x0'));var util=require(_0x4b4f('0x1'));var path=require(_0x4b4f('0x2'));var timeout=require(_0x4b4f('0x3'));var express=require(_0x4b4f('0x4'));var router=express[_0x4b4f('0x5')]();var auth=require(_0x4b4f('0x6'));var interaction=require(_0x4b4f('0x7'));var config=require(_0x4b4f('0x8'));var controller=require(_0x4b4f('0x9'));router[_0x4b4f('0xa')]('/',auth[_0x4b4f('0xb')](),controller[_0x4b4f('0xc')]);router[_0x4b4f('0xa')](_0x4b4f('0xd'),auth[_0x4b4f('0xb')](),controller[_0x4b4f('0xe')]);router['get'](_0x4b4f('0xf'),auth[_0x4b4f('0xb')](),controller[_0x4b4f('0x10')]);router[_0x4b4f('0xa')](_0x4b4f('0x11'),auth['isAuthenticated'](),controller[_0x4b4f('0x12')]);router['get']('/:id/download',auth[_0x4b4f('0xb')](),controller[_0x4b4f('0x13')]);router[_0x4b4f('0x14')]('/',auth[_0x4b4f('0xb')](),controller['create']);router[_0x4b4f('0x14')]('/:id/messages',auth[_0x4b4f('0xb')](),controller[_0x4b4f('0x15')]);router[_0x4b4f('0x14')]('/:id/tags',auth[_0x4b4f('0xb')](),interaction[_0x4b4f('0x16')](_0x4b4f('0x17'),_0x4b4f('0x18')),controller[_0x4b4f('0x19')]);router[_0x4b4f('0x1a')](_0x4b4f('0xf'),auth[_0x4b4f('0xb')](),interaction[_0x4b4f('0x16')](_0x4b4f('0x17'),_0x4b4f('0x1b')),controller[_0x4b4f('0x1c')]);router['delete'](_0x4b4f('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0x4b4f('0x17'),_0x4b4f('0x1d')),controller[_0x4b4f('0x1e')]);router[_0x4b4f('0x1f')](_0x4b4f('0x20'),auth[_0x4b4f('0xb')](),controller[_0x4b4f('0x21')]);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 26f3c59..efda8ac 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 _0xee29=['sequelize','exports','BOOLEAN','DATE','STRING','out'];(function(_0x3853b3,_0x40dcff){var _0x473e34=function(_0x27741b){while(--_0x27741b){_0x3853b3['push'](_0x3853b3['shift']());}};_0x473e34(++_0x40dcff);}(_0xee29,0xd8));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9ee2('0x0'));module[_0x9ee2('0x1')]={'closed':{'type':Sequelize[_0x9ee2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9ee2('0x3')]},'disposition':{'type':Sequelize[_0x9ee2('0x4')]},'secondDisposition':{'type':Sequelize[_0x9ee2('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9ee2('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x9ee2('0x4')]},'externalUrl':{'type':Sequelize[_0x9ee2('0x4')]},'lastMsgAt':{'type':Sequelize[_0x9ee2('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9ee2('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3f16=['out','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x506eda,_0x1a5294){var _0x58b701=function(_0x22b921){while(--_0x22b921){_0x506eda['push'](_0x506eda['shift']());}};_0x58b701(++_0x1a5294);}(_0x3f16,0x151));var _0x63f1=function(_0x3acc7d,_0x36d9c5){_0x3acc7d=_0x3acc7d-0x0;var _0x657a6=_0x3f16[_0x3acc7d];return _0x657a6;};'use strict';var Sequelize=require(_0x63f1('0x0'));module[_0x63f1('0x1')]={'closed':{'type':Sequelize[_0x63f1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x63f1('0x3')]},'secondDisposition':{'type':Sequelize[_0x63f1('0x3')]},'thirdDisposition':{'type':Sequelize[_0x63f1('0x3')]},'note':{'type':Sequelize[_0x63f1('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0x63f1('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x63f1('0x5')]('in',_0x63f1('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x63f1('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index cdd900b..d7b9d40 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 _0x189c=['conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','OpenchannelInteraction','a.key','Account.key','a.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.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','merge','options','create','destroy','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','color','openchannelInteractionTags:save','removeTags','download','root','server','tmp','files','join','transcript-%d-%s.zip','CmContact','lastName','attachments','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','out','System','Contact','firstName','renderFile','views','downloadInteraction.html','toFile','.pdf','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator'];(function(_0x50f039,_0x5f53a2){var _0x5875b4=function(_0x45aae0){while(--_0x45aae0){_0x50f039['push'](_0x50f039['shift']());}};_0x5875b4(++_0x5f53a2);}(_0x189c,0x9b));var _0xc189=function(_0xc94bb,_0x3831f6){_0xc94bb=_0xc94bb-0x0;var _0x20b30f=_0x189c[_0xc94bb];return _0x20b30f;};'use strict';var pdf=require(_0xc189('0x0'));var emlformat=require(_0xc189('0x1'));var rimraf=require(_0xc189('0x2'));var zipdir=require(_0xc189('0x3'));var jsonpatch=require(_0xc189('0x4'));var rp=require(_0xc189('0x5'));var moment=require(_0xc189('0x6'));var BPromise=require(_0xc189('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc189('0x8'));var sox=require('sox');var csv=require(_0xc189('0x9'));var ejs=require(_0xc189('0xa'));var fs=require('fs');var _=require(_0xc189('0xb'));var squel=require(_0xc189('0xc'));var crypto=require('crypto');var jsforce=require(_0xc189('0xd'));var deskjs=require(_0xc189('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc189('0xf'));var Papa=require(_0xc189('0x10'));var Redis=require('ioredis');var authService=require(_0xc189('0x11'));var qs=require(_0xc189('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc189('0x13'))('api');var utils=require(_0xc189('0x14'));var config=require(_0xc189('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xc189('0x16')]=_['defaults'](config['redis'],{'host':_0xc189('0x17'),'port':0x18eb});var socket=require(_0xc189('0x18'))(new Redis(config[_0xc189('0x16')]));require(_0xc189('0x19'))[_0xc189('0x1a')](socket);function respondWithStatusCode(_0x3676be,_0x33cd08){_0x33cd08=_0x33cd08||0xcc;return function(_0x2af307){if(_0x2af307){return _0x3676be[_0xc189('0x1b')](_0x33cd08);}return _0x3676be[_0xc189('0x1c')](_0x33cd08)['end']();};}function respondWithResult(_0x11c6a8,_0x5630d4){_0x5630d4=_0x5630d4||0xc8;return function(_0xd4f9d4){if(_0xd4f9d4){return _0x11c6a8[_0xc189('0x1c')](_0x5630d4)[_0xc189('0x1d')](_0xd4f9d4);}};}function respondWithFilteredResult(_0x19d933,_0x5b4198){return function(_0x5a9012){if(_0x5a9012){var _0x5a9e69=_0x5a9012[_0xc189('0x1e')],_0x35bacd=_0x5b4198[_0xc189('0x1f')],_0x26bc35=_0x5b4198[_0xc189('0x1f')]+_0x5b4198[_0xc189('0x20')],_0x9514a2;if(_0x26bc35>=_0x5a9e69){_0x26bc35=_0x5a9e69;_0x9514a2=0xc8;}else{_0x9514a2=0xce;}_0x19d933['status'](_0x9514a2);return _0x19d933[_0xc189('0x21')](_0xc189('0x22'),_0x35bacd+'-'+_0x26bc35+'/'+_0x5a9e69)[_0xc189('0x1d')](_0x5a9012);}return null;};}function patchUpdates(_0x4a588d){return function(_0x44fd0d){try{jsonpatch[_0xc189('0x23')](_0x44fd0d,_0x4a588d,!![]);}catch(_0x47233b){return BPromise[_0xc189('0x24')](_0x47233b);}return _0x44fd0d[_0xc189('0x25')]();};}function saveUpdates(_0x1563cf,_0x3fa762){return function(_0x281a98){if(_0x281a98){return _0x281a98[_0xc189('0x26')](_0x1563cf)[_0xc189('0x27')](function(_0x544484){return _0x544484;});}return null;};}function removeEntity(_0x35cde2,_0x555cf4){return function(_0x314a92){if(_0x314a92){return _0x314a92['destroy']()[_0xc189('0x27')](function(){_0x35cde2[_0xc189('0x1c')](0xcc)[_0xc189('0x28')]();});}};}function handleEntityNotFound(_0x98d6de,_0x2d2f66){return function(_0x19768a){if(!_0x19768a){_0x98d6de[_0xc189('0x1b')](0x194);}return _0x19768a;};}function handleError(_0x20467d,_0x4d207c){_0x4d207c=_0x4d207c||0x1f4;return function(_0x3308dd){logger[_0xc189('0x29')](_0x3308dd[_0xc189('0x2a')]);if(_0x3308dd[_0xc189('0x2b')]){delete _0x3308dd[_0xc189('0x2b')];}_0x20467d[_0xc189('0x1c')](_0x4d207c)['send'](_0x3308dd);};}function getInteractionUsers(_0x142d4a,_0x40fefd){return new BPromise(function(_0x17a676,_0x5c106a){try{if(_0x40fefd[_0x142d4a['id']]){_0x142d4a[_0xc189('0x2c')]=_[_0xc189('0x2d')](_0x40fefd[_0x142d4a['id']],function(_0x29872c){return{'id':_0x29872c['id'],'fullname':_0x29872c[_0xc189('0x2e')]};});}}catch(_0x50ef00){_0x5c106a(_0x50ef00);}_0x17a676(_0x142d4a);});}function getInteractionTags(_0x129fa4,_0x474248){return new BPromise(function(_0x300ea0,_0x46e169){try{if(_0x129fa4[_0xc189('0x2f')]){_0x129fa4[_0xc189('0x30')]=[];_0x129fa4['TagIds'][_0xc189('0x31')](',')[_0xc189('0x32')](function(_0x5248f6){_0x129fa4[_0xc189('0x30')][_0xc189('0x33')](_0x474248[_0x5248f6]);});}delete _0x129fa4['TagIds'];}catch(_0x3fb1f3){_0x46e169(_0x3fb1f3);}_0x300ea0(_0x129fa4);});}function updateOpenchannelInteraction(_0xf0bcc3,_0x2b9be4,_0x474291){return new BPromise(function(_0x6eef2,_0x4586ee){return getInteractionUsers(_0xf0bcc3,_0x474291)[_0xc189('0x27')](function(_0x150dc0){return getInteractionTags(_0x150dc0,_0x2b9be4);})[_0xc189('0x27')](function(_0x45d3c3){_0x6eef2(_0x45d3c3);})[_0xc189('0x34')](function(_0x382a6c){_0x4586ee(_0x382a6c);});});}exports[_0xc189('0x35')]=function(_0x3a7703,_0xefe139){var _0x1b0534={},_0x258a56={},_0x18eda1={'count':0x0,'rows':[]};var _0x47874d=_[_0xc189('0x2d')](db['OpenchannelInteraction'][_0xc189('0x36')],function(_0x188959){return{'name':_0x188959[_0xc189('0x37')],'type':_0x188959[_0xc189('0x38')][_0xc189('0x39')]};});_0x258a56[_0xc189('0x3a')]=_[_0xc189('0x2d')](_0x47874d,'name');_0x258a56[_0xc189('0x3b')]=_[_0xc189('0x3c')](_0x3a7703[_0xc189('0x3b')]);_0x258a56[_0xc189('0x3d')]=_[_0xc189('0x3e')](_0x258a56[_0xc189('0x3a')],_0x258a56[_0xc189('0x3b')]);_0x1b0534[_0xc189('0x3f')]=_[_0xc189('0x3e')](_0x258a56[_0xc189('0x3a')],qs[_0xc189('0x40')](_0x3a7703[_0xc189('0x3b')][_0xc189('0x40')]));_0x1b0534[_0xc189('0x3f')]=_0x1b0534[_0xc189('0x3f')][_0xc189('0x41')]?_0x1b0534[_0xc189('0x3f')]:_0x258a56['model'];if(!_0x3a7703[_0xc189('0x3b')]['hasOwnProperty'](_0xc189('0x42'))){_0x1b0534[_0xc189('0x20')]=qs['limit'](_0x3a7703[_0xc189('0x3b')]['limit']);_0x1b0534[_0xc189('0x1f')]=qs['offset'](_0x3a7703['query'][_0xc189('0x1f')]);}_0x1b0534['order']=qs[_0xc189('0x43')](_0x3a7703[_0xc189('0x3b')][_0xc189('0x43')]);_0x1b0534[_0xc189('0x44')]=qs['filters'](_[_0xc189('0x45')](_0x3a7703[_0xc189('0x3b')],_0x258a56['filters']),_0x47874d);var _0x51ae08=[];var _0x54a408=squel[_0xc189('0x46')]()[_0xc189('0x47')]('id')[_0xc189('0x47')](_0xc189('0x2b'))[_0xc189('0x47')]('color')[_0xc189('0x48')](_0xc189('0x49'));var _0x82ae8e=squel[_0xc189('0x46')]()[_0xc189('0x47')](_0xc189('0x4a'))[_0xc189('0x47')](_0xc189('0x4b'))['field'](_0xc189('0x4c'))['from'](_0xc189('0x4d'),'ui')[_0xc189('0x4e')](_0xc189('0x4f'),'u',_0xc189('0x50'));var _0x1842f2=squel[_0xc189('0x46')]()[_0xc189('0x48')](_0xc189('0x51'),'i')['left_join']('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc189('0x4e')](_0xc189('0x4f'),'o','o.id\x20=\x20i.UserId')[_0xc189('0x4e')](_0xc189('0x52'),'a',_0xc189('0x53'))[_0xc189('0x4e')](_0xc189('0x54'),'me',_0xc189('0x55'))[_0xc189('0x4e')](_0xc189('0x56'),'it',_0xc189('0x57'))[_0xc189('0x4e')](_0xc189('0x49'),'t',_0xc189('0x58'));var _0x1efef6=squel[_0xc189('0x59')]();var _0x32e85d=[];var _0x4ed0c5=squel[_0xc189('0x59')]();var _0x588d83;if(_0x3a7703[_0xc189('0x3b')][_0xc189('0x5a')]){_0x588d83=as['parseSearch'](_0x3a7703[_0xc189('0x3b')][_0xc189('0x5a')]);var _0x5759d8=_0x588d83[_0xc189('0x5b')];for(var _0x2ddfaa=0x0;_0x2ddfaa<_0x588d83[_0xc189('0x5c')]['length'];_0x2ddfaa++){var _0x2178b6=_0x588d83['conditions'][_0x2ddfaa];var _0x265623='i';var _0x336f68=_[_0xc189('0x5d')](_0x47874d,[_0xc189('0x2b'),_0x2178b6[_0xc189('0x47')]]);if(!_0x336f68){switch(_0x2178b6[_0xc189('0x47')]){case _0xc189('0x5e'):if(_0x2178b6[_0xc189('0x5f')]==0x1){_0x1842f2[_0xc189('0x60')]('`'+_0x2178b6['field']+_0xc189('0x61'));}else{_0x1842f2['having']('`'+_0x2178b6[_0xc189('0x47')]+_0xc189('0x62'));}break;case'Contact':if(_0x2178b6[_0xc189('0x63')]==='$substring'){if(_0x2178b6[_0xc189('0x5f')][_0xc189('0x31')]('\x20')[_0xc189('0x41')]>0x1){_0x1efef6[_0x5759d8]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc189('0x64')](_0x2178b6[_0xc189('0x5f')]),null);}else{var _0x51fe48='%'+_0x2178b6['value']+'%';_0x1efef6[_0x5759d8](_0xc189('0x65'),_0x51fe48,_0x51fe48,_0x51fe48);}}else{_0x336f68=_[_0xc189('0x5d')](_0x47874d,[_0xc189('0x2b'),_0xc189('0x66')]);_0x2178b6[_0xc189('0x47')]='ContactId';_0x49527b=as[_0xc189('0x67')](_0x265623,_0x336f68['type'],_0x2178b6);_0x1efef6[_0x5759d8](_0x49527b[_0xc189('0x68')],_0x49527b[_0xc189('0x5f')][_0xc189('0x69')],_0x49527b[_0xc189('0x5f')]['end']);}break;case _0xc189('0x6a'):var _0x4a53dc=_0x2178b6[_0xc189('0x5f')]['split'](',')['map'](function(_0x4069c8){return Number(_0x4069c8);});_0x4a53dc[_0xc189('0x32')](function(_0x58239f){_0x4ed0c5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x58239f+',%');});_0x32e85d=_[_0xc189('0x6b')](_0x32e85d,_0x4a53dc);break;case _0xc189('0x6c'):if(_0x2178b6[_0xc189('0x63')]===_0xc189('0x6d')){_0x1efef6[_0x5759d8](_0xc189('0x6e'),'%'+_0x2178b6['value']+'%',null);}else{_0x336f68=_[_0xc189('0x5d')](_0x47874d,[_0xc189('0x2b'),_0xc189('0x6f')]);_0x2178b6[_0xc189('0x47')]=_0xc189('0x6f');_0x49527b=as[_0xc189('0x67')](_0x265623,_0x336f68[_0xc189('0x38')],_0x2178b6);_0x1efef6[_0x5759d8](_0x49527b[_0xc189('0x68')],_0x49527b[_0xc189('0x5f')][_0xc189('0x69')],_0x49527b[_0xc189('0x5f')][_0xc189('0x28')]);}break;case _0xc189('0x70'):_0x49527b=as[_0xc189('0x67')]('me',null,_0x2178b6);_0x1efef6[_0x5759d8](_0x49527b['text'],_0x49527b['value'][_0xc189('0x69')],_0x49527b[_0xc189('0x5f')][_0xc189('0x28')]);break;}}else{var _0x49527b=as['buildExpression'](_0x265623,_0x336f68[_0xc189('0x38')],_0x2178b6);_0x1efef6[_0x5759d8](_0x49527b[_0xc189('0x68')],_0x49527b[_0xc189('0x5f')]['start'],_0x49527b[_0xc189('0x5f')][_0xc189('0x28')]);}}}else{var _0x234952=_(_0x3a7703[_0xc189('0x3b')])[_0xc189('0x3c')]()[_0xc189('0x2d')](function(_0x38a9d7){return _['some'](_0x47874d,[_0xc189('0x2b'),_0x38a9d7])?_0x38a9d7:undefined;})[_0xc189('0x71')]()['value']();if(!_['isEmpty'](_0x234952)){_0x234952[_0xc189('0x32')](function(_0x21b57d){if(_0x21b57d===_0xc189('0x72')){_0x1842f2[_0xc189('0x44')](_0xc189('0x73'),[][_0xc189('0x74')](_0x3a7703[_0xc189('0x3b')][_0x21b57d]));}else if(_0x21b57d===_0xc189('0x75')){var _0x1b699d=JSON[_0xc189('0x76')](_0x3a7703[_0xc189('0x3b')][_0x21b57d])[_0xc189('0x77')];var _0x37e37c=JSON['parse'](_0x3a7703[_0xc189('0x3b')][_0x21b57d])[_0xc189('0x78')];_0x1842f2[_0xc189('0x44')](_0xc189('0x79'),_0x1b699d,_0x37e37c);}else{if(_0x3a7703[_0xc189('0x3b')][_0x21b57d]===_0xc189('0x7a')){_0x1842f2[_0xc189('0x44')]('i.'+_0x21b57d+_0xc189('0x7b'));}else{_0x1842f2['where']('i.'+_0x21b57d+_0xc189('0x7c'),_0x3a7703[_0xc189('0x3b')][_0x21b57d]);}}});}if(_0x3a7703[_0xc189('0x3b')][_0xc189('0x7d')]){if(_0x3a7703[_0xc189('0x3b')][_0xc189('0x7d')]==0x1){_0x1842f2[_0xc189('0x60')](_0xc189('0x7e'));}else{_0x1842f2['having'](_0xc189('0x7f'));}}if(_0x3a7703[_0xc189('0x3b')][_0xc189('0x80')]){_0x32e85d=_[_0xc189('0x81')](_0x3a7703[_0xc189('0x3b')]['tag'])?_0x3a7703[_0xc189('0x3b')]['tag']:new Array(_0x3a7703[_0xc189('0x3b')][_0xc189('0x80')]);_0x32e85d['forEach'](function(_0x32a5e2){_0x4ed0c5['or'](_0xc189('0x82'),'%,'+_0x32a5e2+',%');});}if(_0x3a7703[_0xc189('0x3b')][_0xc189('0x83')]){var _0x32e7f6=_0x3a7703[_0xc189('0x3b')][_0xc189('0x83')]['replace']('\x5c','\x5c\x5c')[_0xc189('0x84')](/'/g,'\x27\x27');if(qs[_0xc189('0x85')](_0x32e7f6)){_0x1efef6['or'](_0xc189('0x86'),_0x32e7f6+'%');}else{_0x1efef6['or'](_0xc189('0x87'),qs['getFullTextValue'](_0x32e7f6))['or'](_0xc189('0x88'),_0x32e7f6+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x32e7f6+'%');}}}_0x1842f2[_0xc189('0x44')](_0x1efef6);_0x1842f2[_0xc189('0x89')](_0xc189('0x8a'));var _0x30e689={'type':db[_0xc189('0x8b')][_0xc189('0x8c')]['SELECT'],'raw':!![]};var _0x34bd56=_0x1842f2[_0xc189('0x8d')]();_0x34bd56[_0xc189('0x47')](_0xc189('0x8a'));_0x34bd56['field'](_0xc189('0x8e'),'unreadMessages');if(_0x1b0534[_0xc189('0x8f')]){_0x1b0534[_0xc189('0x8f')][_0xc189('0x32')](function(_0x1047a5){var _0x2368c5=_0x1047a5[0x0]==='contactName'?_0x1047a5[0x0]:'i.'+_0x1047a5[0x0];_0x1842f2['order'](_0x2368c5,_0x1047a5[0x1]===_0xc189('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x32e85d)){_0x1842f2['having'](_0x4ed0c5);_0x34bd56[_0xc189('0x44')]('t.id\x20IN\x20?',_0x32e85d);}BPromise['resolve']()[_0xc189('0x27')](function(){if(!_0x588d83){if(_0x3a7703['query'][_0xc189('0x72')]||_0x3a7703[_0xc189('0x3b')][_0xc189('0x91')])return;_0x34bd56[_0xc189('0x44')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1842f2[_0xc189('0x44')](_0xc189('0x92'));return;}if(_0x3a7703[_0xc189('0x93')][_0xc189('0x94')]!==_0xc189('0x95'))return;return _0x3a7703[_0xc189('0x93')][_0xc189('0x96')]({'attributes':['id'],'raw':!![]})[_0xc189('0x27')](function(_0x3786ad){if(_['isEmpty'](_0x3786ad)){_0x34bd56[_0xc189('0x44')](_0xc189('0x97'));_0x1842f2[_0xc189('0x44')](_0xc189('0x97'));}else{_0x34bd56['where'](_0xc189('0x73'),_[_0xc189('0x2d')](_0x3786ad,'id'));_0x1842f2['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xc189('0x2d')](_0x3786ad,'id'));}});})['then'](function(){if(_0x3a7703[_0xc189('0x93')][_0xc189('0x94')]===_0xc189('0x95')&&!_0x588d83&&!_0x3a7703['query'][_0xc189('0x72')])return[];return db[_0xc189('0x98')]['query'](_0x34bd56['toString'](),_0x30e689);})[_0xc189('0x27')](function(_0x43346c){_0x18eda1[_0xc189('0x1e')]=_0x43346c[_0xc189('0x41')];if(_0x18eda1[_0xc189('0x1e')]===0x0)return[];return db[_0xc189('0x98')][_0xc189('0x3b')](_0x54a408[_0xc189('0x99')](),_0x30e689)[_0xc189('0x27')](function(_0x1fd1fc){_0x51ae08=_[_0xc189('0x9a')](_0x1fd1fc,'id');_0x30e689=_['merge'](_0x30e689,{'model':db[_0xc189('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a7703[_0xc189('0x3b')][_0xc189('0x40')]){_0x1b0534[_0xc189('0x3f')][_0xc189('0x32')](function(_0x44646d){_0x1842f2[_0xc189('0x47')]('i.'+_0x44646d);});}else{_0x1842f2[_0xc189('0x47')](_0xc189('0x8e'),'unreadMessages');_0x1842f2['field'](_0xc189('0x9c'),_0xc189('0x9d'));_0x1842f2[_0xc189('0x47')](_0xc189('0x9e'),'Account.mandatoryDisposition');_0x1842f2[_0xc189('0x47')](_0xc189('0x9f'),'contactName');_0x1842f2[_0xc189('0x47')](_0xc189('0xa0'));_0x1842f2['field'](_0xc189('0xa1'),_0xc189('0xa2'));_0x1842f2[_0xc189('0x47')](_0xc189('0xa3'),_0xc189('0xa4'));_0x1842f2[_0xc189('0x47')]('c.email','Contact.email');_0x1842f2[_0xc189('0x47')](_0xc189('0xa5'),'Contact.phone');_0x1842f2[_0xc189('0x47')](_0xc189('0xa6'),_0xc189('0xa7'));_0x1842f2[_0xc189('0x47')]('c.fax',_0xc189('0xa8'));_0x1842f2[_0xc189('0x47')](_0xc189('0xa9'),_0xc189('0xaa'));_0x1842f2[_0xc189('0x47')](_0xc189('0xab'),_0xc189('0xac'));_0x1842f2[_0xc189('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x1b0534[_0xc189('0x20')])_0x1842f2[_0xc189('0x20')](_0x1b0534[_0xc189('0x20')]);if(_0x1b0534[_0xc189('0x1f')])_0x1842f2[_0xc189('0x1f')](_0x1b0534['offset']);return db['sequelize']['query'](_0x1842f2[_0xc189('0x99')](),_0x30e689);})['then'](function(_0x571833){_0x82ae8e['where'](_0xc189('0xad'),_['map'](_0x571833,'id'));return db[_0xc189('0x98')]['query'](_0x82ae8e['toString'](),_0x30e689)['then'](function(_0x21a34d){var _0x4535aa=_[_0xc189('0xae')](_0x21a34d,_0xc189('0xaf'));var _0x421c4e=[];_0x571833[_0xc189('0x32')](function(_0x36683f){_0x421c4e[_0xc189('0x33')](updateOpenchannelInteraction(_0x36683f,_0x51ae08,_0x4535aa));});return BPromise[_0xc189('0xb0')](_0x421c4e);});});})[_0xc189('0x27')](function(_0x8892eb){_0x18eda1[_0xc189('0xb1')]=_0x8892eb;return _0x18eda1;})[_0xc189('0x27')](respondWithFilteredResult(_0xefe139,_0x1b0534))[_0xc189('0x34')](handleError(_0xefe139,null));};exports[_0xc189('0xb2')]=function(_0x20473a,_0x3ff61f){var _0x49d693={};if(_0x20473a[_0xc189('0x3b')][_0xc189('0x38')]&&_0x20473a['query']['type']===_0xc189('0x48')){_0x49d693[_0xc189('0x48')]=_0x20473a[_0xc189('0xb3')]['id'];}else{_0x49d693['id']=_0x20473a[_0xc189('0xb3')]['id'];}var _0x15611e={'raw':![],'where':_0x49d693},_0x2ddb2e={};_0x2ddb2e[_0xc189('0x3a')]=_[_0xc189('0x3c')](db[_0xc189('0x9b')][_0xc189('0x36')]);_0x2ddb2e[_0xc189('0x3b')]=_['keys'](_0x20473a[_0xc189('0x3b')]);_0x2ddb2e['filters']=_[_0xc189('0x3e')](_0x2ddb2e[_0xc189('0x3a')],_0x2ddb2e[_0xc189('0x3b')]);_0x15611e[_0xc189('0x3f')]=_[_0xc189('0x3e')](_0x2ddb2e[_0xc189('0x3a')],qs[_0xc189('0x40')](_0x20473a[_0xc189('0x3b')][_0xc189('0x40')]));_0x15611e['attributes']=_0x15611e[_0xc189('0x3f')]['length']?_0x15611e[_0xc189('0x3f')]:_0x2ddb2e['model'];if(_0x20473a[_0xc189('0x3b')][_0xc189('0xb4')]){_0x15611e['include']=[{'all':!![]}];}_0x15611e=_[_0xc189('0xb5')]({},_0x15611e,_0x20473a[_0xc189('0xb6')]);return db[_0xc189('0x9b')][_0xc189('0x5d')](_0x15611e)[_0xc189('0x27')](handleEntityNotFound(_0x3ff61f,null))['then'](respondWithResult(_0x3ff61f,null))[_0xc189('0x34')](handleError(_0x3ff61f,null));};exports[_0xc189('0xb7')]=function(_0x21a59b,_0x240ae2){return db[_0xc189('0x9b')][_0xc189('0xb7')](_0x21a59b[_0xc189('0x70')],{})[_0xc189('0x27')](respondWithResult(_0x240ae2,0xc9))[_0xc189('0x34')](handleError(_0x240ae2,null));};exports[_0xc189('0x26')]=function(_0x2c7b27,_0x544849){if(_0x2c7b27['body']['id']){delete _0x2c7b27[_0xc189('0x70')]['id'];}return db[_0xc189('0x9b')][_0xc189('0x5d')]({'where':{'id':_0x2c7b27[_0xc189('0xb3')]['id']}})[_0xc189('0x27')](handleEntityNotFound(_0x544849,null))[_0xc189('0x27')](saveUpdates(_0x2c7b27['body'],null))[_0xc189('0x27')](respondWithResult(_0x544849,null))[_0xc189('0x34')](handleError(_0x544849,null));};exports[_0xc189('0xb8')]=function(_0x552e89,_0x549e92){return db[_0xc189('0x9b')]['find']({'where':{'id':_0x552e89[_0xc189('0xb3')]['id']}})[_0xc189('0x27')](handleEntityNotFound(_0x549e92,null))[_0xc189('0x27')](removeEntity(_0x549e92,null))[_0xc189('0x34')](handleError(_0x549e92,null));};exports['describe']=function(_0x2b54e6,_0x282869){return db[_0xc189('0x9b')]['describe']()['then'](respondWithResult(_0x282869,null))['catch'](handleError(_0x282869,null));};exports['addMessage']=function(_0x24b2b0,_0x790fe6,_0x3e56a5){return db[_0xc189('0xb9')]['find']({'where':{'id':_0x24b2b0[_0xc189('0xb3')]['id']}})[_0xc189('0x27')](handleEntityNotFound(_0x790fe6,null))[_0xc189('0x27')](function(_0x3f9085){if(_0x3f9085){return _0x3f9085['addMessage'](_0x24b2b0[_0xc189('0x70')][_0xc189('0xba')],_[_0xc189('0xbb')](_0x24b2b0[_0xc189('0x70')],['ids','id'])||{});}})[_0xc189('0x27')](respondWithResult(_0x790fe6,null))[_0xc189('0x34')](handleError(_0x790fe6,null));};exports[_0xc189('0xbc')]=function(_0x5ae09f,_0x27f9f3,_0x18685e){var _0x105894={'raw':![],'where':{}};var _0x493875={};var _0x5cf2c8={'count':0x0,'rows':[]};return db[_0xc189('0x9b')][_0xc189('0xbd')]({'where':{'id':_0x5ae09f[_0xc189('0xb3')]['id']}})['then'](handleEntityNotFound(_0x27f9f3,null))[_0xc189('0x27')](function(_0x543b89){if(_0x543b89){_0x493875['model']=_[_0xc189('0x3c')](db['OpenchannelMessage']['rawAttributes']);_0x493875[_0xc189('0x3b')]=_[_0xc189('0x3c')](_0x5ae09f[_0xc189('0x3b')]);_0x493875['filters']=_[_0xc189('0x3e')](_0x493875['model'],_0x493875[_0xc189('0x3b')]);_0x105894['attributes']=_[_0xc189('0x3e')](_0x493875['model'],qs[_0xc189('0x40')](_0x5ae09f[_0xc189('0x3b')][_0xc189('0x40')]));_0x105894[_0xc189('0x3f')]=_0x105894['attributes']['length']?_0x105894['attributes']:_0x493875[_0xc189('0x3a')];if(!_0x5ae09f[_0xc189('0x3b')][_0xc189('0xbe')]('nolimit')){_0x105894['limit']=qs[_0xc189('0x20')](_0x5ae09f[_0xc189('0x3b')][_0xc189('0x20')]);_0x105894[_0xc189('0x1f')]=qs['offset'](_0x5ae09f[_0xc189('0x3b')]['offset']);}_0x105894[_0xc189('0x8f')]=qs[_0xc189('0x43')](_0x5ae09f[_0xc189('0x3b')][_0xc189('0x43')]);_0x105894[_0xc189('0x44')]=qs[_0xc189('0x3d')](_[_0xc189('0x45')](_0x5ae09f[_0xc189('0x3b')],_0x493875['filters']));_0x105894['where'][_0xc189('0xaf')]=_0x543b89['id'];if(_0x5ae09f['query'][_0xc189('0x83')]){_0x105894[_0xc189('0x44')]=_[_0xc189('0xb5')](_0x105894['where'],{'$or':_[_0xc189('0x2d')](_0x105894['attributes'],function(_0x2f8479){var _0x298d94={};_0x298d94[_0x2f8479]={'$like':'%'+_0x5ae09f[_0xc189('0x3b')][_0xc189('0x83')]+'%'};return _0x298d94;})});}if(_0x5ae09f['query']['$gte']){var _0x4aa197=_0x5ae09f[_0xc189('0x3b')]['$gte'][_0xc189('0x31')](',');var _0x209da5={};_0x209da5[_0x4aa197[0x0]]={'$gte':moment(_0x4aa197[0x1])[_0xc189('0xbf')](_0xc189('0xc0'))};_0x105894['where']=_[_0xc189('0xb5')](_0x105894[_0xc189('0x44')],_0x209da5);}_0x105894=_[_0xc189('0xb5')]({},_0x105894,_0x5ae09f['options']);return db[_0xc189('0xb9')][_0xc189('0x1e')]({'where':_0x105894[_0xc189('0x44')]})[_0xc189('0x27')](function(_0x5b9799){_0x5cf2c8[_0xc189('0x1e')]=_0x5b9799;if(_0x5ae09f[_0xc189('0x3b')][_0xc189('0xb4')]){_0x105894[_0xc189('0xc1')]=[{'all':!![]}];}return db[_0xc189('0xb9')][_0xc189('0xc2')](_0x105894);})[_0xc189('0x27')](function(_0x5c2ec4){_0x5cf2c8['rows']=_0x5c2ec4;return _0x5cf2c8;});}})[_0xc189('0x27')](respondWithFilteredResult(_0x27f9f3,_0x105894))[_0xc189('0x34')](handleError(_0x27f9f3,null));};exports[_0xc189('0xc3')]=function(_0x1c9d7d,_0x54ab24,_0x6e0322){return db['OpenchannelInteraction'][_0xc189('0x5d')]({'where':{'id':_0x1c9d7d['params']['id']}})[_0xc189('0x27')](handleEntityNotFound(_0x54ab24,null))[_0xc189('0x27')](function(_0xc4ad0d){if(_0xc4ad0d){return _0xc4ad0d[_0xc189('0xc4')](_0x1c9d7d[_0xc189('0x70')][_0xc189('0xba')],_[_0xc189('0xbb')](_0x1c9d7d[_0xc189('0x70')],[_0xc189('0xba'),'id'])||{})[_0xc189('0xc5')](function(){return db['Tag'][_0xc189('0xc2')]({'attributes':['id',_0xc189('0x2b'),_0xc189('0xc6')],'where':{'id':_0x1c9d7d[_0xc189('0x70')][_0xc189('0xba')]}});})['then'](function(_0x26e934){socket['emit'](_0xc189('0xc7'),{'id':Number(_0x1c9d7d[_0xc189('0xb3')]['id']),'tags':_0x26e934||[]});return{'id':Number(_0x1c9d7d[_0xc189('0xb3')]['id']),'tags':_0x26e934||[]};});}})['then'](respondWithResult(_0x54ab24,null))[_0xc189('0x34')](handleError(_0x54ab24,null));};exports[_0xc189('0xc8')]=function(_0x521784,_0x5eedae,_0x292910){return db[_0xc189('0x9b')][_0xc189('0x5d')]({'where':{'id':_0x521784[_0xc189('0xb3')]['id']}})[_0xc189('0x27')](handleEntityNotFound(_0x5eedae,null))['then'](function(_0x3e5542){if(_0x3e5542){return _0x3e5542[_0xc189('0xc8')](_0x521784['query'][_0xc189('0xba')]);}})[_0xc189('0x27')](respondWithStatusCode(_0x5eedae,null))[_0xc189('0x34')](handleError(_0x5eedae,null));};exports[_0xc189('0xc9')]=function(_0x31f7a0,_0xfb6219){var _0x536994=moment()['unix']()['toString']();var _0x14460e=path['join'](config[_0xc189('0xca')],_0xc189('0xcb'),'files',_0xc189('0xcc'));var _0x461a4b=path['join'](config['root'],_0xc189('0xcb'),_0xc189('0xcd'),'attachments');var _0x2b9f0c=path[_0xc189('0xce')](_0x14460e,_0x536994);var _0x36aa0f=util['format'](_0xc189('0xcf'),_0x31f7a0[_0xc189('0xb3')]['id'],_0x536994);var _0x43613b=path[_0xc189('0xce')](_0x14460e,_0x36aa0f);var _0x1a87d5=[];_0x1a87d5[_0xc189('0x33')]({'model':db[_0xc189('0x6c')],'as':_0xc189('0x6c'),'attributes':['id',_0xc189('0x2e')],'raw':!![]});_0x1a87d5[_0xc189('0x33')]({'model':db[_0xc189('0xd0')],'as':'Contact','attributes':['id','firstName',_0xc189('0xd1')],'raw':!![]});if(_0x31f7a0['query'][_0xc189('0xd2')]){_0x1a87d5[_0xc189('0x33')]({'model':db[_0xc189('0xd3')],'as':_0xc189('0xd3'),'raw':!![]});}var _0x33c94c=[{'model':db[_0xc189('0xb9')],'as':_0xc189('0xd4'),'attributes':['id',_0xc189('0x70'),_0xc189('0x75'),_0xc189('0xd5'),_0xc189('0xd6'),_0xc189('0x7d')],'include':_0x1a87d5}];_0x33c94c[_0xc189('0x33')]({'model':db[_0xc189('0xd7')],'as':_0xc189('0xd8'),'attributes':['id','name']});_0x33c94c[_0xc189('0x33')]({'model':db['User'],'as':_0xc189('0xd9'),'attributes':['id',_0xc189('0x2e')]});return db[_0xc189('0x9b')]['find']({'where':{'id':_0x31f7a0['params']['id']},'include':_0x33c94c})[_0xc189('0x27')](handleEntityNotFound(_0xfb6219,null))[_0xc189('0x27')](function(_0x314763){if(_0x314763){var _0xd5f116=_0x314763[_0xc189('0xda')]({'plain':!![]});fs[_0xc189('0xdb')](_0x2b9f0c);var _0x14055d={'format':'A4','border':_0xc189('0xdc'),'header':{'height':_0xc189('0xdd'),'contents':{'first':_0xc189('0xde')}},'footer':{'height':_0xc189('0xdf'),'contents':{'default':util['format'](_0xc189('0xe0'),util[_0xc189('0xbf')](_0xc189('0xe1'),_0xc189('0xe2'),_0xd5f116['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x3f078e={'channel':'Openchannel','account':_0xd5f116[_0xc189('0xd8')][_0xc189('0x2b')],'agent':_0xd5f116[_0xc189('0xd9')]?_0xd5f116[_0xc189('0xd9')]['fullname']:_0xc189('0xe3'),'createdAt':moment(_0xd5f116[_0xc189('0x75')])[_0xc189('0xbf')](_0xc189('0xc0'))[_0xc189('0x99')](),'closedAt':_0xd5f116['closed']?moment(_0xd5f116[_0xc189('0xe4')])[_0xc189('0xbf')](_0xc189('0xc0'))[_0xc189('0x99')]():'','disposition':_0xd5f116[_0xc189('0xe5')],'visibility':_0xd5f116[_0xc189('0xe6')]?_0xc189('0xe7'):_0xc189('0xe8'),'messages':_(_0xd5f116[_0xc189('0xd4')])[_0xc189('0x83')]({'secret':![]})['map'](function(_0x13221b){if(_0x13221b[_0xc189('0xd3')]){var _0xf93f0e=path[_0xc189('0xce')](_0x461a4b,_0x13221b[_0xc189('0xd3')][_0xc189('0xe9')]);if(fs[_0xc189('0xea')](_0xf93f0e)){fs[_0xc189('0xeb')](_0xf93f0e)['pipe'](fs[_0xc189('0xec')](path[_0xc189('0xce')](_0x2b9f0c,_0x13221b[_0xc189('0xd3')]['basename'])));}}return{'date':moment(_0x13221b['createdAt'])[_0xc189('0xbf')](_0xc189('0xc0'))[_0xc189('0x99')](),'sender':_0x13221b[_0xc189('0xd5')]===_0xc189('0xed')?_0x13221b[_0xc189('0x6c')]?_0x13221b[_0xc189('0x6c')][_0xc189('0x2e')]:_0xc189('0xee'):_0x13221b[_0xc189('0xef')][_0xc189('0xf0')]+(_0x13221b['Contact'][_0xc189('0xd1')]?'\x20'+_0x13221b[_0xc189('0xef')][_0xc189('0xd1')]:''),'body':_0x13221b[_0xc189('0xd3')]?_0x13221b[_0xc189('0xd3')]['basename']:_0x13221b[_0xc189('0x70')],'direction':_0x13221b['direction']===_0xc189('0xed')?'A':'C','secret':_0x13221b['secret'],'read':_0x13221b[_0xc189('0x7d')],'attachment':_0x13221b[_0xc189('0xd3')]};})[_0xc189('0x5f')]()};return ejs[_0xc189('0xf1')](path[_0xc189('0xce')](config[_0xc189('0xca')],_0xc189('0xcb'),_0xc189('0xf2'),_0xc189('0xf3')),{'interaction':_0x3f078e})[_0xc189('0x27')](function(_0x5c7226){return new BPromise(function(_0x4f1fb0,_0x51785d){pdf[_0xc189('0xb7')](_0x5c7226,_0x14055d)[_0xc189('0xf4')](path[_0xc189('0xce')](_0x2b9f0c,'transcript-'+_0xd5f116['id']+'-'+_0x536994+_0xc189('0xf5')),function(_0x516646,_0x1b7a24){if(_0x516646)return _0x51785d(_0x516646);_0x4f1fb0(_0x1b7a24);});});})[_0xc189('0x27')](function(){return new BPromise(function(_0x471a0e,_0x433e59){zipdir(_0x2b9f0c,{'saveTo':_0x43613b},function(_0x3fb089,_0xa92f6){if(_0x3fb089)return _0x433e59(_0x3fb089);return _0x471a0e(_0xa92f6);});})[_0xc189('0x27')](function(){return new BPromise(function(_0x4cbab7,_0x48233b){rimraf(_0x2b9f0c,function(_0x4fad88){if(_0x4fad88)_0x48233b(_0x4fad88);return _0x4cbab7();});});})[_0xc189('0x27')](function(){return _0xfb6219['download'](_0x43613b,_0x36aa0f,function(_0x32bce3){if(_0x32bce3){console['log'](_0xc189('0xf6'),_0x32bce3);}else{fs['unlinkSync'](_0x43613b);}});});});}else{return _0xfb6219[_0xc189('0x1b')](0xc8);}})[_0xc189('0x34')](handleError(_0xfb6219,null));}; \ No newline at end of file +var _0xdda0=['Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','options','create','body','update','destroy','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','root','server','tmp','join','files','attachments','CmContact','Contact','firstName','Attachment','Messages','direction','secret','Account','Owner','fullname','get','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','disposition','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','renderFile','views','toFile','transcript-','.pdf','log','err','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','then','end','error','stack','name','map','Tags','split','forEach','push','TagIds','catch','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','isEmpty','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','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','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','toString','count','merge','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','i.*','c.firstName','Contact.firstName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname'];(function(_0x23497d,_0x51e0fe){var _0x50b77e=function(_0x43d85d){while(--_0x43d85d){_0x23497d['push'](_0x23497d['shift']());}};_0x50b77e(++_0x51e0fe);}(_0xdda0,0x156));var _0x0dda=function(_0x43710f,_0x36d29d){_0x43710f=_0x43710f-0x0;var _0x469113=_0xdda0[_0x43710f];return _0x469113;};'use strict';var pdf=require(_0x0dda('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0dda('0x1'));var zipdir=require(_0x0dda('0x2'));var jsonpatch=require(_0x0dda('0x3'));var rp=require(_0x0dda('0x4'));var moment=require('moment');var BPromise=require(_0x0dda('0x5'));var Mustache=require(_0x0dda('0x6'));var util=require(_0x0dda('0x7'));var path=require(_0x0dda('0x8'));var sox=require(_0x0dda('0x9'));var csv=require(_0x0dda('0xa'));var ejs=require(_0x0dda('0xb'));var fs=require('fs');var _=require(_0x0dda('0xc'));var squel=require(_0x0dda('0xd'));var crypto=require(_0x0dda('0xe'));var jsforce=require(_0x0dda('0xf'));var deskjs=require(_0x0dda('0x10'));var toCsv=require(_0x0dda('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0dda('0x11'));var authService=require(_0x0dda('0x12'));var qs=require(_0x0dda('0x13'));var as=require(_0x0dda('0x14'));var hardwareService=require(_0x0dda('0x15'));var logger=require(_0x0dda('0x16'))('api');var utils=require(_0x0dda('0x17'));var config=require(_0x0dda('0x18'));var licenseUtil=require(_0x0dda('0x19'));var db=require(_0x0dda('0x1a'))['db'];config[_0x0dda('0x1b')]=_[_0x0dda('0x1c')](config['redis'],{'host':_0x0dda('0x1d'),'port':0x18eb});var socket=require(_0x0dda('0x1e'))(new Redis(config[_0x0dda('0x1b')]));require('./openchannelInteraction.socket')[_0x0dda('0x1f')](socket);function respondWithStatusCode(_0x21909,_0x35331c){_0x35331c=_0x35331c||0xcc;return function(_0x1037dd){if(_0x1037dd){return _0x21909[_0x0dda('0x20')](_0x35331c);}return _0x21909[_0x0dda('0x21')](_0x35331c)['end']();};}function respondWithResult(_0x60dec9,_0x3d16be){_0x3d16be=_0x3d16be||0xc8;return function(_0x1a9430){if(_0x1a9430){return _0x60dec9[_0x0dda('0x21')](_0x3d16be)[_0x0dda('0x22')](_0x1a9430);}};}function respondWithFilteredResult(_0x22f8e7,_0x467bf1){return function(_0x4bf9ca){if(_0x4bf9ca){var _0x1892b3=_0x4bf9ca['count'],_0x4d4afc=_0x467bf1[_0x0dda('0x23')],_0x4ecf10=_0x467bf1[_0x0dda('0x23')]+_0x467bf1[_0x0dda('0x24')],_0x3f6313;if(_0x4ecf10>=_0x1892b3){_0x4ecf10=_0x1892b3;_0x3f6313=0xc8;}else{_0x3f6313=0xce;}_0x22f8e7[_0x0dda('0x21')](_0x3f6313);return _0x22f8e7[_0x0dda('0x25')](_0x0dda('0x26'),_0x4d4afc+'-'+_0x4ecf10+'/'+_0x1892b3)['json'](_0x4bf9ca);}return null;};}function patchUpdates(_0x2a2744){return function(_0x320f22){try{jsonpatch['apply'](_0x320f22,_0x2a2744,!![]);}catch(_0x54d111){return BPromise[_0x0dda('0x27')](_0x54d111);}return _0x320f22[_0x0dda('0x28')]();};}function saveUpdates(_0x5e3d09,_0x30139b){return function(_0x5eef71){if(_0x5eef71){return _0x5eef71['update'](_0x5e3d09)[_0x0dda('0x29')](function(_0x40e7e6){return _0x40e7e6;});}return null;};}function removeEntity(_0x2c8367,_0x87d432){return function(_0x37f5c2){if(_0x37f5c2){return _0x37f5c2['destroy']()['then'](function(){_0x2c8367[_0x0dda('0x21')](0xcc)[_0x0dda('0x2a')]();});}};}function handleEntityNotFound(_0x303e56,_0x3eabed){return function(_0x190eb0){if(!_0x190eb0){_0x303e56[_0x0dda('0x20')](0x194);}return _0x190eb0;};}function handleError(_0xaa7967,_0x552b46){_0x552b46=_0x552b46||0x1f4;return function(_0x2f2b3f){logger[_0x0dda('0x2b')](_0x2f2b3f[_0x0dda('0x2c')]);if(_0x2f2b3f[_0x0dda('0x2d')]){delete _0x2f2b3f[_0x0dda('0x2d')];}_0xaa7967[_0x0dda('0x21')](_0x552b46)['send'](_0x2f2b3f);};}function getInteractionUsers(_0xd61a0e,_0x528b7d){return new BPromise(function(_0x4c57b1,_0x5f3ffb){try{if(_0x528b7d[_0xd61a0e['id']]){_0xd61a0e['Users']=_[_0x0dda('0x2e')](_0x528b7d[_0xd61a0e['id']],function(_0x336482){return{'id':_0x336482['id'],'fullname':_0x336482['fullname']};});}}catch(_0x31784a){_0x5f3ffb(_0x31784a);}_0x4c57b1(_0xd61a0e);});}function getInteractionTags(_0x3ec2ca,_0x2e3cee){return new BPromise(function(_0x46c749,_0x26b09c){try{if(_0x3ec2ca['TagIds']){_0x3ec2ca[_0x0dda('0x2f')]=[];_0x3ec2ca['TagIds'][_0x0dda('0x30')](',')[_0x0dda('0x31')](function(_0x43e404){_0x3ec2ca[_0x0dda('0x2f')][_0x0dda('0x32')](_0x2e3cee[_0x43e404]);});}delete _0x3ec2ca[_0x0dda('0x33')];}catch(_0x18ee3e){_0x26b09c(_0x18ee3e);}_0x46c749(_0x3ec2ca);});}function updateOpenchannelInteraction(_0x4a31a2,_0x47632e,_0x17fc95){return new BPromise(function(_0x1832f3,_0x2da7e0){return getInteractionUsers(_0x4a31a2,_0x17fc95)[_0x0dda('0x29')](function(_0xafc1c4){return getInteractionTags(_0xafc1c4,_0x47632e);})[_0x0dda('0x29')](function(_0x178b25){_0x1832f3(_0x178b25);})[_0x0dda('0x34')](function(_0x3136bd){_0x2da7e0(_0x3136bd);});});}exports['index']=function(_0x23fe95,_0x5b90dd){var _0x220957={},_0x33dbf7={},_0x258f29={'count':0x0,'rows':[]};var _0x193d77=_[_0x0dda('0x2e')](db[_0x0dda('0x35')][_0x0dda('0x36')],function(_0x23e09d){return{'name':_0x23e09d[_0x0dda('0x37')],'type':_0x23e09d[_0x0dda('0x38')]['key']};});_0x33dbf7[_0x0dda('0x39')]=_[_0x0dda('0x2e')](_0x193d77,'name');_0x33dbf7[_0x0dda('0x3a')]=_[_0x0dda('0x3b')](_0x23fe95[_0x0dda('0x3a')]);_0x33dbf7['filters']=_[_0x0dda('0x3c')](_0x33dbf7[_0x0dda('0x39')],_0x33dbf7[_0x0dda('0x3a')]);_0x220957[_0x0dda('0x3d')]=_[_0x0dda('0x3c')](_0x33dbf7[_0x0dda('0x39')],qs[_0x0dda('0x3e')](_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x3e')]));_0x220957[_0x0dda('0x3d')]=_0x220957[_0x0dda('0x3d')][_0x0dda('0x3f')]?_0x220957[_0x0dda('0x3d')]:_0x33dbf7['model'];if(!_0x23fe95['query'][_0x0dda('0x40')](_0x0dda('0x41'))){_0x220957[_0x0dda('0x24')]=qs[_0x0dda('0x24')](_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x24')]);_0x220957['offset']=qs[_0x0dda('0x23')](_0x23fe95[_0x0dda('0x3a')]['offset']);}_0x220957[_0x0dda('0x42')]=qs[_0x0dda('0x43')](_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x43')]);_0x220957[_0x0dda('0x44')]=qs[_0x0dda('0x45')](_[_0x0dda('0x46')](_0x23fe95[_0x0dda('0x3a')],_0x33dbf7['filters']),_0x193d77);var _0x542f9c=[];var _0x393b1b=squel[_0x0dda('0x47')]()['field']('id')[_0x0dda('0x48')]('name')[_0x0dda('0x48')]('color')[_0x0dda('0x49')](_0x0dda('0x4a'));var _0x4c49c0=squel[_0x0dda('0x47')]()['field'](_0x0dda('0x4b'))[_0x0dda('0x48')](_0x0dda('0x4c'))['field'](_0x0dda('0x4d'))[_0x0dda('0x49')](_0x0dda('0x4e'),'ui')[_0x0dda('0x4f')](_0x0dda('0x50'),'u',_0x0dda('0x51'));var _0x1db89f=squel[_0x0dda('0x47')]()['from'](_0x0dda('0x52'),'i')[_0x0dda('0x4f')](_0x0dda('0x53'),'c',_0x0dda('0x54'))[_0x0dda('0x4f')]('users','o',_0x0dda('0x55'))[_0x0dda('0x4f')](_0x0dda('0x56'),'a',_0x0dda('0x57'))[_0x0dda('0x4f')]('openchannel_messages','me',_0x0dda('0x58'))[_0x0dda('0x4f')](_0x0dda('0x59'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x0dda('0x4f')](_0x0dda('0x4a'),'t',_0x0dda('0x5a'));var _0x51e517=squel[_0x0dda('0x5b')]();var _0x168eee=[];var _0x359808=squel[_0x0dda('0x5b')]();var _0x2313da;if(_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x5c')]){_0x2313da=as['parseSearch'](_0x23fe95[_0x0dda('0x3a')]['search']);var _0x95f87d=_0x2313da[_0x0dda('0x5d')];for(var _0x4fe66a=0x0;_0x4fe66a<_0x2313da['conditions'][_0x0dda('0x3f')];_0x4fe66a++){var _0xd92b3f=_0x2313da['conditions'][_0x4fe66a];var _0x29bc0e='i';var _0xab2bbb=_[_0x0dda('0x5e')](_0x193d77,[_0x0dda('0x2d'),_0xd92b3f[_0x0dda('0x48')]]);if(!_0xab2bbb){switch(_0xd92b3f[_0x0dda('0x48')]){case _0x0dda('0x5f'):if(_0xd92b3f[_0x0dda('0x60')]==0x1){_0x1db89f[_0x0dda('0x61')]('`'+_0xd92b3f[_0x0dda('0x48')]+_0x0dda('0x62'));}else{_0x1db89f[_0x0dda('0x61')]('`'+_0xd92b3f[_0x0dda('0x48')]+_0x0dda('0x63'));}break;case'Contact':if(_0xd92b3f[_0x0dda('0x64')]===_0x0dda('0x65')){if(_0xd92b3f[_0x0dda('0x60')][_0x0dda('0x30')]('\x20')['length']>0x1){_0x51e517[_0x95f87d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0dda('0x66')](_0xd92b3f[_0x0dda('0x60')]),null);}else{var _0x15dec2='%'+_0xd92b3f[_0x0dda('0x60')]+'%';_0x51e517[_0x95f87d](_0x0dda('0x67'),_0x15dec2,_0x15dec2,_0x15dec2);}}else{_0xab2bbb=_['find'](_0x193d77,[_0x0dda('0x2d'),_0x0dda('0x68')]);_0xd92b3f[_0x0dda('0x48')]=_0x0dda('0x68');_0x22f7eb=as[_0x0dda('0x69')](_0x29bc0e,_0xab2bbb['type'],_0xd92b3f);_0x51e517[_0x95f87d](_0x22f7eb[_0x0dda('0x6a')],_0x22f7eb[_0x0dda('0x60')]['start'],_0x22f7eb[_0x0dda('0x60')][_0x0dda('0x2a')]);}break;case'Tag':var _0x22562b=_0xd92b3f[_0x0dda('0x60')]['split'](',')[_0x0dda('0x2e')](function(_0x426ccf){return Number(_0x426ccf);});_0x22562b['forEach'](function(_0x597940){_0x359808['or'](_0x0dda('0x6b'),'%,'+_0x597940+',%');});_0x168eee=_[_0x0dda('0x6c')](_0x168eee,_0x22562b);break;case _0x0dda('0x6d'):if(_0xd92b3f[_0x0dda('0x64')]===_0x0dda('0x65')){_0x51e517[_0x95f87d](_0x0dda('0x6e'),'%'+_0xd92b3f['value']+'%',null);}else{_0xab2bbb=_['find'](_0x193d77,[_0x0dda('0x2d'),_0x0dda('0x6f')]);_0xd92b3f['field']=_0x0dda('0x6f');_0x22f7eb=as[_0x0dda('0x69')](_0x29bc0e,_0xab2bbb[_0x0dda('0x38')],_0xd92b3f);_0x51e517[_0x95f87d](_0x22f7eb[_0x0dda('0x6a')],_0x22f7eb[_0x0dda('0x60')]['start'],_0x22f7eb[_0x0dda('0x60')][_0x0dda('0x2a')]);}break;case'body':_0x22f7eb=as['buildExpression']('me',null,_0xd92b3f);_0x51e517[_0x95f87d](_0x22f7eb[_0x0dda('0x6a')],_0x22f7eb[_0x0dda('0x60')][_0x0dda('0x70')],_0x22f7eb[_0x0dda('0x60')][_0x0dda('0x2a')]);break;}}else{var _0x22f7eb=as[_0x0dda('0x69')](_0x29bc0e,_0xab2bbb[_0x0dda('0x38')],_0xd92b3f);_0x51e517[_0x95f87d](_0x22f7eb[_0x0dda('0x6a')],_0x22f7eb[_0x0dda('0x60')][_0x0dda('0x70')],_0x22f7eb[_0x0dda('0x60')][_0x0dda('0x2a')]);}}}else{var _0x5721f0=_(_0x23fe95[_0x0dda('0x3a')])[_0x0dda('0x3b')]()[_0x0dda('0x2e')](function(_0x115a45){return _['some'](_0x193d77,[_0x0dda('0x2d'),_0x115a45])?_0x115a45:undefined;})[_0x0dda('0x71')]()['value']();if(!_[_0x0dda('0x72')](_0x5721f0)){_0x5721f0[_0x0dda('0x31')](function(_0x228e28){if(_0x228e28===_0x0dda('0x73')){_0x1db89f[_0x0dda('0x44')]('i.OpenchannelAccountId\x20IN\x20?',[][_0x0dda('0x74')](_0x23fe95[_0x0dda('0x3a')][_0x228e28]));}else if(_0x228e28===_0x0dda('0x75')){var _0x413ab1=JSON[_0x0dda('0x76')](_0x23fe95[_0x0dda('0x3a')][_0x228e28])[_0x0dda('0x77')];var _0x39f41f=JSON['parse'](_0x23fe95[_0x0dda('0x3a')][_0x228e28])[_0x0dda('0x78')];_0x1db89f[_0x0dda('0x44')](_0x0dda('0x79'),_0x413ab1,_0x39f41f);}else{if(_0x23fe95[_0x0dda('0x3a')][_0x228e28]===_0x0dda('0x7a')){_0x1db89f[_0x0dda('0x44')]('i.'+_0x228e28+_0x0dda('0x7b'));}else{_0x1db89f['where']('i.'+_0x228e28+_0x0dda('0x7c'),_0x23fe95[_0x0dda('0x3a')][_0x228e28]);}}});}if(_0x23fe95[_0x0dda('0x3a')]['read']){if(_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x7d')]==0x1){_0x1db89f['having'](_0x0dda('0x7e'));}else{_0x1db89f[_0x0dda('0x61')](_0x0dda('0x7f'));}}if(_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x80')]){_0x168eee=_[_0x0dda('0x81')](_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x80')])?_0x23fe95[_0x0dda('0x3a')]['tag']:new Array(_0x23fe95['query']['tag']);_0x168eee['forEach'](function(_0x81cffd){_0x359808['or'](_0x0dda('0x6b'),'%,'+_0x81cffd+',%');});}if(_0x23fe95[_0x0dda('0x3a')]['filter']){var _0x2c4a0a=_0x23fe95[_0x0dda('0x3a')]['filter'][_0x0dda('0x82')]('\x5c','\x5c\x5c')[_0x0dda('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2c4a0a)){_0x51e517['or'](_0x0dda('0x83'),_0x2c4a0a+'%');}else{_0x51e517['or'](_0x0dda('0x84'),qs[_0x0dda('0x66')](_0x2c4a0a))['or']('i.from\x20LIKE\x20?',_0x2c4a0a+'%')['or'](_0x0dda('0x85'),_0x2c4a0a+'%');}}}_0x1db89f[_0x0dda('0x44')](_0x51e517);_0x1db89f[_0x0dda('0x86')](_0x0dda('0x87'));var _0x3ebaac={'type':db[_0x0dda('0x88')][_0x0dda('0x89')]['SELECT'],'raw':!![]};var _0x4b5da7=_0x1db89f[_0x0dda('0x8a')]();_0x4b5da7[_0x0dda('0x48')]('i.id');_0x4b5da7['field'](_0x0dda('0x8b'),_0x0dda('0x5f'));if(_0x220957['order']){_0x220957[_0x0dda('0x42')][_0x0dda('0x31')](function(_0x198763){var _0x4ca368=_0x198763[0x0]===_0x0dda('0x8c')?_0x198763[0x0]:'i.'+_0x198763[0x0];_0x1db89f[_0x0dda('0x42')](_0x4ca368,_0x198763[0x1]===_0x0dda('0x8d')?![]:!![]);});}if(!_['isEmpty'](_0x168eee)){_0x1db89f[_0x0dda('0x61')](_0x359808);_0x4b5da7[_0x0dda('0x44')](_0x0dda('0x8e'),_0x168eee);}BPromise[_0x0dda('0x8f')]()[_0x0dda('0x29')](function(){if(!_0x2313da){if(_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x73')]||_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x90')])return;_0x4b5da7[_0x0dda('0x44')](_0x0dda('0x91'));_0x1db89f[_0x0dda('0x44')](_0x0dda('0x91'));return;}if(_0x23fe95[_0x0dda('0x92')][_0x0dda('0x93')]!==_0x0dda('0x94'))return;return _0x23fe95['user'][_0x0dda('0x95')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb867fc){if(_[_0x0dda('0x72')](_0xb867fc)){_0x4b5da7[_0x0dda('0x44')](_0x0dda('0x96'));_0x1db89f[_0x0dda('0x44')](_0x0dda('0x96'));}else{_0x4b5da7[_0x0dda('0x44')](_0x0dda('0x97'),_[_0x0dda('0x2e')](_0xb867fc,'id'));_0x1db89f['where'](_0x0dda('0x97'),_['map'](_0xb867fc,'id'));}});})[_0x0dda('0x29')](function(){if(_0x23fe95['user']['role']===_0x0dda('0x94')&&!_0x2313da&&!_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x73')])return[];return db['sequelize'][_0x0dda('0x3a')](_0x4b5da7[_0x0dda('0x98')](),_0x3ebaac);})[_0x0dda('0x29')](function(_0x5f2a31){_0x258f29[_0x0dda('0x99')]=_0x5f2a31[_0x0dda('0x3f')];if(_0x258f29[_0x0dda('0x99')]===0x0)return[];return db['sequelize'][_0x0dda('0x3a')](_0x393b1b[_0x0dda('0x98')](),_0x3ebaac)[_0x0dda('0x29')](function(_0x2931f7){_0x542f9c=_['keyBy'](_0x2931f7,'id');_0x3ebaac=_[_0x0dda('0x9a')](_0x3ebaac,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x23fe95[_0x0dda('0x3a')][_0x0dda('0x3e')]){_0x220957[_0x0dda('0x3d')][_0x0dda('0x31')](function(_0x549874){_0x1db89f[_0x0dda('0x48')]('i.'+_0x549874);});}else{_0x1db89f['field'](_0x0dda('0x8b'),'unreadMessages');_0x1db89f[_0x0dda('0x48')](_0x0dda('0x9b'),_0x0dda('0x9c'));_0x1db89f[_0x0dda('0x48')](_0x0dda('0x9d'),_0x0dda('0x9e'));_0x1db89f[_0x0dda('0x48')](_0x0dda('0x9f'),_0x0dda('0x8c'));_0x1db89f[_0x0dda('0x48')](_0x0dda('0xa0'));_0x1db89f[_0x0dda('0x48')](_0x0dda('0xa1'),_0x0dda('0xa2'));_0x1db89f[_0x0dda('0x48')]('c.lastName','Contact.lastName');_0x1db89f[_0x0dda('0x48')](_0x0dda('0xa3'),_0x0dda('0xa4'));_0x1db89f[_0x0dda('0x48')](_0x0dda('0xa5'),_0x0dda('0xa6'));_0x1db89f[_0x0dda('0x48')](_0x0dda('0xa7'),_0x0dda('0xa8'));_0x1db89f[_0x0dda('0x48')](_0x0dda('0xa9'),_0x0dda('0xaa'));_0x1db89f[_0x0dda('0x48')](_0x0dda('0xab'),_0x0dda('0xac'));_0x1db89f[_0x0dda('0x48')](_0x0dda('0xad'),_0x0dda('0xae'));_0x1db89f['field'](_0x0dda('0xaf'),_0x0dda('0x33'));}if(_0x220957[_0x0dda('0x24')])_0x1db89f[_0x0dda('0x24')](_0x220957[_0x0dda('0x24')]);if(_0x220957[_0x0dda('0x23')])_0x1db89f[_0x0dda('0x23')](_0x220957[_0x0dda('0x23')]);return db[_0x0dda('0xb0')][_0x0dda('0x3a')](_0x1db89f['toString'](),_0x3ebaac);})[_0x0dda('0x29')](function(_0xe28927){_0x4c49c0[_0x0dda('0x44')](_0x0dda('0xb1'),_[_0x0dda('0x2e')](_0xe28927,'id'));return db[_0x0dda('0xb0')]['query'](_0x4c49c0['toString'](),_0x3ebaac)[_0x0dda('0x29')](function(_0x28d896){var _0x3409ca=_[_0x0dda('0xb2')](_0x28d896,_0x0dda('0xb3'));var _0x5d1d53=[];_0xe28927[_0x0dda('0x31')](function(_0x3f6b66){_0x5d1d53[_0x0dda('0x32')](updateOpenchannelInteraction(_0x3f6b66,_0x542f9c,_0x3409ca));});return BPromise[_0x0dda('0xb4')](_0x5d1d53);});});})[_0x0dda('0x29')](function(_0x14ae82){_0x258f29[_0x0dda('0xb5')]=_0x14ae82;return _0x258f29;})['then'](respondWithFilteredResult(_0x5b90dd,_0x220957))[_0x0dda('0x34')](handleError(_0x5b90dd,null));};exports[_0x0dda('0xb6')]=function(_0x2669e3,_0x2ddadc){var _0x5020e5={};if(_0x2669e3[_0x0dda('0x3a')][_0x0dda('0x38')]&&_0x2669e3['query']['type']==='from'){_0x5020e5['from']=_0x2669e3[_0x0dda('0xb7')]['id'];}else{_0x5020e5['id']=_0x2669e3['params']['id'];}var _0x26d9b0={'raw':![],'where':_0x5020e5},_0x2ea214={};_0x2ea214[_0x0dda('0x39')]=_[_0x0dda('0x3b')](db[_0x0dda('0x35')][_0x0dda('0x36')]);_0x2ea214[_0x0dda('0x3a')]=_[_0x0dda('0x3b')](_0x2669e3[_0x0dda('0x3a')]);_0x2ea214[_0x0dda('0x45')]=_[_0x0dda('0x3c')](_0x2ea214[_0x0dda('0x39')],_0x2ea214[_0x0dda('0x3a')]);_0x26d9b0[_0x0dda('0x3d')]=_['intersection'](_0x2ea214[_0x0dda('0x39')],qs[_0x0dda('0x3e')](_0x2669e3[_0x0dda('0x3a')]['fields']));_0x26d9b0[_0x0dda('0x3d')]=_0x26d9b0[_0x0dda('0x3d')][_0x0dda('0x3f')]?_0x26d9b0['attributes']:_0x2ea214['model'];if(_0x2669e3[_0x0dda('0x3a')][_0x0dda('0xb8')]){_0x26d9b0[_0x0dda('0xb9')]=[{'all':!![]}];}_0x26d9b0=_[_0x0dda('0x9a')]({},_0x26d9b0,_0x2669e3[_0x0dda('0xba')]);return db[_0x0dda('0x35')][_0x0dda('0x5e')](_0x26d9b0)[_0x0dda('0x29')](handleEntityNotFound(_0x2ddadc,null))[_0x0dda('0x29')](respondWithResult(_0x2ddadc,null))[_0x0dda('0x34')](handleError(_0x2ddadc,null));};exports[_0x0dda('0xbb')]=function(_0x39f06c,_0xa35834){return db['OpenchannelInteraction'][_0x0dda('0xbb')](_0x39f06c[_0x0dda('0xbc')],{})[_0x0dda('0x29')](respondWithResult(_0xa35834,0xc9))['catch'](handleError(_0xa35834,null));};exports[_0x0dda('0xbd')]=function(_0x253e1d,_0x42bf1f){if(_0x253e1d[_0x0dda('0xbc')]['id']){delete _0x253e1d[_0x0dda('0xbc')]['id'];}return db['OpenchannelInteraction'][_0x0dda('0x5e')]({'where':{'id':_0x253e1d['params']['id']}})[_0x0dda('0x29')](handleEntityNotFound(_0x42bf1f,null))['then'](saveUpdates(_0x253e1d[_0x0dda('0xbc')],null))[_0x0dda('0x29')](respondWithResult(_0x42bf1f,null))['catch'](handleError(_0x42bf1f,null));};exports[_0x0dda('0xbe')]=function(_0x2ecc9e,_0xe70e1f){return db[_0x0dda('0x35')][_0x0dda('0x5e')]({'where':{'id':_0x2ecc9e[_0x0dda('0xb7')]['id']}})[_0x0dda('0x29')](handleEntityNotFound(_0xe70e1f,null))['then'](removeEntity(_0xe70e1f,null))[_0x0dda('0x34')](handleError(_0xe70e1f,null));};exports[_0x0dda('0xbf')]=function(_0x44bd06,_0x29b938){return db['OpenchannelInteraction']['describe']()[_0x0dda('0x29')](respondWithResult(_0x29b938,null))[_0x0dda('0x34')](handleError(_0x29b938,null));};exports['addMessage']=function(_0x1dd766,_0x140d38,_0x36192a){return db['OpenchannelMessage'][_0x0dda('0x5e')]({'where':{'id':_0x1dd766[_0x0dda('0xb7')]['id']}})['then'](handleEntityNotFound(_0x140d38,null))[_0x0dda('0x29')](function(_0x115c1f){if(_0x115c1f){return _0x115c1f[_0x0dda('0xc0')](_0x1dd766['body'][_0x0dda('0xc1')],_[_0x0dda('0xc2')](_0x1dd766[_0x0dda('0xbc')],[_0x0dda('0xc1'),'id'])||{});}})[_0x0dda('0x29')](respondWithResult(_0x140d38,null))[_0x0dda('0x34')](handleError(_0x140d38,null));};exports[_0x0dda('0xc3')]=function(_0x5210de,_0x4a31d5,_0x4dcc88){var _0x2aea76={'raw':![],'where':{}};var _0x483c7a={};var _0x46b979={'count':0x0,'rows':[]};return db[_0x0dda('0x35')][_0x0dda('0xc4')]({'where':{'id':_0x5210de['params']['id']}})[_0x0dda('0x29')](handleEntityNotFound(_0x4a31d5,null))['then'](function(_0x140668){if(_0x140668){_0x483c7a[_0x0dda('0x39')]=_[_0x0dda('0x3b')](db[_0x0dda('0xc5')][_0x0dda('0x36')]);_0x483c7a[_0x0dda('0x3a')]=_[_0x0dda('0x3b')](_0x5210de[_0x0dda('0x3a')]);_0x483c7a[_0x0dda('0x45')]=_['intersection'](_0x483c7a['model'],_0x483c7a[_0x0dda('0x3a')]);_0x2aea76['attributes']=_['intersection'](_0x483c7a['model'],qs['fields'](_0x5210de['query']['fields']));_0x2aea76[_0x0dda('0x3d')]=_0x2aea76[_0x0dda('0x3d')]['length']?_0x2aea76[_0x0dda('0x3d')]:_0x483c7a[_0x0dda('0x39')];if(!_0x5210de[_0x0dda('0x3a')][_0x0dda('0x40')]('nolimit')){_0x2aea76[_0x0dda('0x24')]=qs[_0x0dda('0x24')](_0x5210de[_0x0dda('0x3a')][_0x0dda('0x24')]);_0x2aea76[_0x0dda('0x23')]=qs[_0x0dda('0x23')](_0x5210de[_0x0dda('0x3a')]['offset']);}_0x2aea76['order']=qs['sort'](_0x5210de[_0x0dda('0x3a')]['sort']);_0x2aea76['where']=qs[_0x0dda('0x45')](_[_0x0dda('0x46')](_0x5210de['query'],_0x483c7a[_0x0dda('0x45')]));_0x2aea76['where'][_0x0dda('0xb3')]=_0x140668['id'];if(_0x5210de[_0x0dda('0x3a')]['filter']){_0x2aea76[_0x0dda('0x44')]=_[_0x0dda('0x9a')](_0x2aea76[_0x0dda('0x44')],{'$or':_[_0x0dda('0x2e')](_0x2aea76[_0x0dda('0x3d')],function(_0xca240c){var _0x425120={};_0x425120[_0xca240c]={'$like':'%'+_0x5210de[_0x0dda('0x3a')][_0x0dda('0xc6')]+'%'};return _0x425120;})});}if(_0x5210de['query'][_0x0dda('0x77')]){var _0x1b85f9=_0x5210de['query'][_0x0dda('0x77')][_0x0dda('0x30')](',');var _0x385057={};_0x385057[_0x1b85f9[0x0]]={'$gte':moment(_0x1b85f9[0x1])[_0x0dda('0xc7')](_0x0dda('0xc8'))};_0x2aea76[_0x0dda('0x44')]=_[_0x0dda('0x9a')](_0x2aea76[_0x0dda('0x44')],_0x385057);}_0x2aea76=_[_0x0dda('0x9a')]({},_0x2aea76,_0x5210de['options']);return db[_0x0dda('0xc5')][_0x0dda('0x99')]({'where':_0x2aea76[_0x0dda('0x44')]})[_0x0dda('0x29')](function(_0x40a431){_0x46b979[_0x0dda('0x99')]=_0x40a431;if(_0x5210de['query'][_0x0dda('0xb8')]){_0x2aea76[_0x0dda('0xb9')]=[{'all':!![]}];}return db[_0x0dda('0xc5')][_0x0dda('0xc9')](_0x2aea76);})[_0x0dda('0x29')](function(_0x58565c){_0x46b979[_0x0dda('0xb5')]=_0x58565c;return _0x46b979;});}})[_0x0dda('0x29')](respondWithFilteredResult(_0x4a31d5,_0x2aea76))['catch'](handleError(_0x4a31d5,null));};exports[_0x0dda('0xca')]=function(_0x46553e,_0x293b6a,_0x153082){return db[_0x0dda('0x35')][_0x0dda('0x5e')]({'where':{'id':_0x46553e[_0x0dda('0xb7')]['id']}})[_0x0dda('0x29')](handleEntityNotFound(_0x293b6a,null))[_0x0dda('0x29')](function(_0x29c735){if(_0x29c735){return _0x29c735[_0x0dda('0xcb')](_0x46553e[_0x0dda('0xbc')][_0x0dda('0xc1')],_[_0x0dda('0xc2')](_0x46553e[_0x0dda('0xbc')],[_0x0dda('0xc1'),'id'])||{})[_0x0dda('0xcc')](function(){return db[_0x0dda('0xcd')][_0x0dda('0xc9')]({'attributes':['id',_0x0dda('0x2d'),_0x0dda('0xce')],'where':{'id':_0x46553e[_0x0dda('0xbc')][_0x0dda('0xc1')]}});})['then'](function(_0x510c83){socket[_0x0dda('0xcf')]('openchannelInteractionTags:save',{'id':Number(_0x46553e[_0x0dda('0xb7')]['id']),'tags':_0x510c83||[]});return{'id':Number(_0x46553e[_0x0dda('0xb7')]['id']),'tags':_0x510c83||[]};});}})[_0x0dda('0x29')](respondWithResult(_0x293b6a,null))[_0x0dda('0x34')](handleError(_0x293b6a,null));};exports[_0x0dda('0xd0')]=function(_0x167deb,_0x199d40,_0x30a09c){return db[_0x0dda('0x35')][_0x0dda('0x5e')]({'where':{'id':_0x167deb[_0x0dda('0xb7')]['id']}})['then'](handleEntityNotFound(_0x199d40,null))[_0x0dda('0x29')](function(_0x95ebac){if(_0x95ebac){return _0x95ebac[_0x0dda('0xd0')](_0x167deb[_0x0dda('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x199d40,null))[_0x0dda('0x34')](handleError(_0x199d40,null));};exports[_0x0dda('0xd1')]=function(_0x526237,_0x40d3df){var _0x3f4f65=moment()[_0x0dda('0xd2')]()[_0x0dda('0x98')]();var _0x3bd183=path['join'](config[_0x0dda('0xd3')],_0x0dda('0xd4'),'files',_0x0dda('0xd5'));var _0x43a545=path[_0x0dda('0xd6')](config[_0x0dda('0xd3')],_0x0dda('0xd4'),_0x0dda('0xd7'),_0x0dda('0xd8'));var _0x57a003=path[_0x0dda('0xd6')](_0x3bd183,_0x3f4f65);var _0x5c98a9=util[_0x0dda('0xc7')]('transcript-%d-%s.zip',_0x526237['params']['id'],_0x3f4f65);var _0x475402=path['join'](_0x3bd183,_0x5c98a9);var _0x47bbc3=[];_0x47bbc3['push']({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x47bbc3['push']({'model':db[_0x0dda('0xd9')],'as':_0x0dda('0xda'),'attributes':['id',_0x0dda('0xdb'),'lastName'],'raw':!![]});if(_0x526237[_0x0dda('0x3a')][_0x0dda('0xd8')]){_0x47bbc3['push']({'model':db[_0x0dda('0xdc')],'as':_0x0dda('0xdc'),'raw':!![]});}var _0x4e0047=[{'model':db[_0x0dda('0xc5')],'as':_0x0dda('0xdd'),'attributes':['id',_0x0dda('0xbc'),_0x0dda('0x75'),_0x0dda('0xde'),_0x0dda('0xdf'),_0x0dda('0x7d')],'include':_0x47bbc3}];_0x4e0047['push']({'model':db['OpenchannelAccount'],'as':_0x0dda('0xe0'),'attributes':['id',_0x0dda('0x2d')]});_0x4e0047[_0x0dda('0x32')]({'model':db[_0x0dda('0x6d')],'as':_0x0dda('0xe1'),'attributes':['id',_0x0dda('0xe2')]});return db[_0x0dda('0x35')]['find']({'where':{'id':_0x526237[_0x0dda('0xb7')]['id']},'include':_0x4e0047})[_0x0dda('0x29')](handleEntityNotFound(_0x40d3df,null))[_0x0dda('0x29')](function(_0x4c7043){if(_0x4c7043){var _0x419c4a=_0x4c7043[_0x0dda('0xe3')]({'plain':!![]});fs['mkdirSync'](_0x57a003);var _0x2754b6={'format':'A4','border':_0x0dda('0xe4'),'header':{'height':_0x0dda('0xe5'),'contents':{'first':_0x0dda('0xe6')}},'footer':{'height':_0x0dda('0xe7'),'contents':{'default':util[_0x0dda('0xc7')](_0x0dda('0xe8'),util[_0x0dda('0xc7')](_0x0dda('0xe9'),_0x0dda('0xea'),_0x419c4a['id']),moment()[_0x0dda('0xc7')](_0x0dda('0xeb'))[_0x0dda('0x98')]())}}};var _0x42ba6f={'channel':_0x0dda('0xea'),'account':_0x419c4a['Account'][_0x0dda('0x2d')],'agent':_0x419c4a[_0x0dda('0xe1')]?_0x419c4a[_0x0dda('0xe1')]['fullname']:_0x0dda('0xec'),'createdAt':moment(_0x419c4a[_0x0dda('0x75')])[_0x0dda('0xc7')](_0x0dda('0xc8'))[_0x0dda('0x98')](),'closedAt':_0x419c4a[_0x0dda('0xed')]?moment(_0x419c4a[_0x0dda('0xee')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0dda('0x98')]():'','disposition':_0x419c4a[_0x0dda('0xef')],'visibility':_0x419c4a['threadId']?_0x0dda('0xf0'):_0x0dda('0xf1'),'messages':_(_0x419c4a[_0x0dda('0xdd')])[_0x0dda('0xc6')]({'secret':![]})[_0x0dda('0x2e')](function(_0x47e59e){if(_0x47e59e[_0x0dda('0xdc')]){var _0x454a87=path[_0x0dda('0xd6')](_0x43a545,_0x47e59e[_0x0dda('0xdc')][_0x0dda('0xf2')]);if(fs[_0x0dda('0xf3')](_0x454a87)){fs[_0x0dda('0xf4')](_0x454a87)[_0x0dda('0xf5')](fs[_0x0dda('0xf6')](path[_0x0dda('0xd6')](_0x57a003,_0x47e59e[_0x0dda('0xdc')][_0x0dda('0xf2')])));}}return{'date':moment(_0x47e59e[_0x0dda('0x75')])[_0x0dda('0xc7')](_0x0dda('0xc8'))[_0x0dda('0x98')](),'sender':_0x47e59e[_0x0dda('0xde')]===_0x0dda('0xf7')?_0x47e59e[_0x0dda('0x6d')]?_0x47e59e[_0x0dda('0x6d')]['fullname']:_0x0dda('0xf8'):_0x47e59e[_0x0dda('0xda')][_0x0dda('0xdb')]+(_0x47e59e[_0x0dda('0xda')]['lastName']?'\x20'+_0x47e59e['Contact'][_0x0dda('0xf9')]:''),'body':_0x47e59e[_0x0dda('0xdc')]?_0x47e59e['Attachment'][_0x0dda('0xf2')]:_0x47e59e['body'],'direction':_0x47e59e[_0x0dda('0xde')]===_0x0dda('0xf7')?'A':'C','secret':_0x47e59e[_0x0dda('0xdf')],'read':_0x47e59e[_0x0dda('0x7d')],'attachment':_0x47e59e['Attachment']};})[_0x0dda('0x60')]()};return ejs[_0x0dda('0xfa')](path[_0x0dda('0xd6')](config[_0x0dda('0xd3')],_0x0dda('0xd4'),_0x0dda('0xfb'),'downloadInteraction.html'),{'interaction':_0x42ba6f})[_0x0dda('0x29')](function(_0x4a11f0){return new BPromise(function(_0x4dd3bd,_0x40a9a8){pdf[_0x0dda('0xbb')](_0x4a11f0,_0x2754b6)[_0x0dda('0xfc')](path[_0x0dda('0xd6')](_0x57a003,_0x0dda('0xfd')+_0x419c4a['id']+'-'+_0x3f4f65+_0x0dda('0xfe')),function(_0x6f759f,_0x280dfc){if(_0x6f759f)return _0x40a9a8(_0x6f759f);_0x4dd3bd(_0x280dfc);});});})[_0x0dda('0x29')](function(){return new BPromise(function(_0x4add4d,_0x4a3ae8){zipdir(_0x57a003,{'saveTo':_0x475402},function(_0x227280,_0x3161d8){if(_0x227280)return _0x4a3ae8(_0x227280);return _0x4add4d(_0x3161d8);});})[_0x0dda('0x29')](function(){return new BPromise(function(_0x4046f5,_0xdd980d){rimraf(_0x57a003,function(_0x5eda59){if(_0x5eda59)_0xdd980d(_0x5eda59);return _0x4046f5();});});})[_0x0dda('0x29')](function(){return _0x40d3df[_0x0dda('0xd1')](_0x475402,_0x5c98a9,function(_0x4e9172){if(_0x4e9172){console[_0x0dda('0xff')](_0x0dda('0x100'),_0x4e9172);}else{fs['unlinkSync'](_0x475402);}});});});}else{return _0x40d3df[_0x0dda('0x20')](0xc8);}})['catch'](handleError(_0x40d3df,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 94f9205..ae26659 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 _0x079d=['setDataValue','map','emit','catch','hasOwnProperty','hook','OpenchannelInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x079d,0x19c));var _0xd079=function(_0x156d3c,_0x4ac0bb){_0x156d3c=_0x156d3c-0x0;var _0x3207e8=_0x079d[_0x156d3c];return _0x3207e8;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xd079('0x0')];var OpenchannelMessage=require(_0xd079('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd079('0x2')](0x0);var events={'afterCreate':_0xd079('0x3'),'afterUpdate':_0xd079('0x4'),'afterDestroy':_0xd079('0x5')};function emitEvent(_0x1915b9){return function(_0x4d41a6,_0x2e3985,_0xe2d5f9){_0x4d41a6[_0xd079('0x6')]({'attributes':['id'],'raw':!![]})[_0xd079('0x7')](function(_0xe1082){_0x4d41a6[_0xd079('0x8')]('Users',_0xe1082[_0xd079('0x9')](function(_0x3197b5){return{'id':_0x3197b5['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4d41a6['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd079('0x7')](function(_0x520368){_0x4d41a6['setDataValue']('unreadMessages',_0x520368['length']);OpenchannelInteractionEvents[_0xd079('0xa')](_0x1915b9+':'+_0x4d41a6['id'],_0x4d41a6);OpenchannelInteractionEvents[_0xd079('0xa')](_0x1915b9,_0x4d41a6);_0xe2d5f9(null);})[_0xd079('0xb')](_0xe2d5f9(null));};}for(var e in events){if(events[_0xd079('0xc')](e)){var event=events[e];OpenchannelInteraction[_0xd079('0xd')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x3324=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages'];(function(_0x3a93b7,_0x658183){var _0x2ed891=function(_0x1a60de){while(--_0x1a60de){_0x3a93b7['push'](_0x3a93b7['shift']());}};_0x2ed891(++_0x658183);}(_0x3324,0x1ea));var _0x4332=function(_0x20ebb9,_0x3535bb){_0x20ebb9=_0x20ebb9-0x0;var _0x1ec31d=_0x3324[_0x20ebb9];return _0x1ec31d;};'use strict';var EventEmitter=require(_0x4332('0x0'));var OpenchannelInteraction=require(_0x4332('0x1'))['db'][_0x4332('0x2')];var OpenchannelMessage=require(_0x4332('0x1'))['db'][_0x4332('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4332('0x4')](0x0);var events={'afterCreate':_0x4332('0x5'),'afterUpdate':'update','afterDestroy':_0x4332('0x6')};function emitEvent(_0x43b24d){return function(_0xa5bee8,_0x27c7fa,_0x2e872b){_0xa5bee8[_0x4332('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1ce83f){_0xa5bee8[_0x4332('0x8')](_0x4332('0x9'),_0x1ce83f[_0x4332('0xa')](function(_0x198617){return{'id':_0x198617['id']};}));return OpenchannelMessage[_0x4332('0xb')]({'where':{'OpenchannelInteractionId':_0xa5bee8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4332('0xc')](function(_0x32f53b){_0xa5bee8['setDataValue'](_0x4332('0xd'),_0x32f53b['length']);OpenchannelInteractionEvents[_0x4332('0xe')](_0x43b24d+':'+_0xa5bee8['id'],_0xa5bee8);OpenchannelInteractionEvents[_0x4332('0xe')](_0x43b24d,_0xa5bee8);_0x2e872b(null);})[_0x4332('0xf')](_0x2e872b(null));};}for(var e in events){if(events[_0x4332('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x4332('0x11')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 20e85d0..d04e867 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 _0x8375=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelInteraction'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x8375,0xa8));var _0x5837=function(_0x21520f,_0x5cf758){_0x21520f=_0x21520f-0x0;var _0x46ff38=_0x8375[_0x21520f];return _0x46ff38;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var logger=require(_0x5837('0x2'))('api');var moment=require(_0x5837('0x3'));var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require(_0x5837('0x7'));var config=require(_0x5837('0x8'));var attributes=require('./openchannelInteraction.attributes');module[_0x5837('0x9')]=function(_0x19491e,_0x365da3){return _0x19491e[_0x5837('0xa')](_0x5837('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x508caf,_0x1e44c4,_0x6c5828){if(_0x508caf['changed'](_0x5837('0xc'))){_0x508caf['closedAt']=moment()[_0x5837('0xd')](_0x5837('0xe'));}_0x6c5828(null,_0x508caf);}}});}; \ No newline at end of file +var _0xfc76=['../../config/logger','api','moment','bluebird','path','rimraf','./openchannelInteraction.attributes','define','openchannel_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x59c80a,_0x2ed67f){var _0x391a69=function(_0x117a92){while(--_0x117a92){_0x59c80a['push'](_0x59c80a['shift']());}};_0x391a69(++_0x2ed67f);}(_0xfc76,0xb5));var _0x6fc7=function(_0x48f6a0,_0x275ba3){_0x48f6a0=_0x48f6a0-0x0;var _0x1ba0e4=_0xfc76[_0x48f6a0];return _0x1ba0e4;};'use strict';var _=require('lodash');var util=require(_0x6fc7('0x0'));var logger=require(_0x6fc7('0x1'))(_0x6fc7('0x2'));var moment=require(_0x6fc7('0x3'));var BPromise=require(_0x6fc7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6fc7('0x5'));var rimraf=require(_0x6fc7('0x6'));var config=require('../../config/environment');var attributes=require(_0x6fc7('0x7'));module['exports']=function(_0xe8177b,_0x82a35a){return _0xe8177b[_0x6fc7('0x8')]('OpenchannelInteraction',attributes,{'tableName':_0x6fc7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x407b0a,_0x347c00,_0x1d4fee){if(_0x407b0a[_0x6fc7('0xa')](_0x6fc7('0xb'))){_0x407b0a['closedAt']=moment()[_0x6fc7('0xc')](_0x6fc7('0xd'));}_0x1d4fee(null,_0x407b0a);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index bf22584..6cea963 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 _0x8042=['update','body','options','raw','where','attributes','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','catch','OpenchannelInteraction'];(function(_0x553aaf,_0x1bb778){var _0x507fab=function(_0x3e1c5a){while(--_0x3e1c5a){_0x553aaf['push'](_0x553aaf['shift']());}};_0x507fab(++_0x1bb778);}(_0x8042,0x1ed));var _0x2804=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0x8042[_0x53f608];return _0x495b7d;};'use strict';var _=require(_0x2804('0x0'));var util=require(_0x2804('0x1'));var moment=require('moment');var BPromise=require(_0x2804('0x2'));var rs=require(_0x2804('0x3'));var fs=require('fs');var Redis=require(_0x2804('0x4'));var db=require(_0x2804('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2804('0x6'))(_0x2804('0x7'));var config=require(_0x2804('0x8'));var jayson=require(_0x2804('0x9'));var client=jayson['client'][_0x2804('0xa')]({'port':0x232a});config[_0x2804('0xb')]=_[_0x2804('0xc')](config['redis'],{'host':_0x2804('0xd'),'port':0x18eb});var socket=require(_0x2804('0xe'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0x2804('0xf')](socket);function respondWithRpcPromise(_0x462dcd,_0x1a2a01,_0x34c542){return new BPromise(function(_0x5d258f,_0x39ebfd){return client[_0x2804('0x10')](_0x462dcd,_0x34c542)['then'](function(_0x387e36){logger[_0x2804('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1a2a01,_0x2804('0x12'));logger[_0x2804('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x1a2a01,'request\x20sent',JSON[_0x2804('0x14')](_0x387e36));if(_0x387e36[_0x2804('0x15')]){if(_0x387e36['error'][_0x2804('0x16')]===0x1f4){logger[_0x2804('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1a2a01,_0x387e36[_0x2804('0x15')][_0x2804('0x17')]);return _0x39ebfd(_0x387e36[_0x2804('0x15')][_0x2804('0x17')]);}logger[_0x2804('0x15')](_0x2804('0x18'),_0x1a2a01,_0x387e36[_0x2804('0x15')]['message']);return _0x5d258f(_0x387e36[_0x2804('0x15')][_0x2804('0x17')]);}else{logger[_0x2804('0x11')](_0x2804('0x18'),_0x1a2a01,_0x2804('0x12'));_0x5d258f(_0x387e36['result'][_0x2804('0x17')]);}})[_0x2804('0x19')](function(_0x23c621){logger[_0x2804('0x15')](_0x2804('0x18'),_0x1a2a01,_0x23c621);_0x39ebfd(_0x23c621);});});}exports['UpdateOpenchannelInteraction']=function(_0x4f5264){var _0x5006be=this;return new Promise(function(_0x30ad30,_0x2b81de){return db[_0x2804('0x1a')][_0x2804('0x1b')](_0x4f5264[_0x2804('0x1c')],{'raw':_0x4f5264[_0x2804('0x1d')]?_0x4f5264[_0x2804('0x1d')][_0x2804('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f5264[_0x2804('0x1d')]?_0x4f5264[_0x2804('0x1d')][_0x2804('0x1f')]||null:null,'attributes':_0x4f5264[_0x2804('0x1d')]?_0x4f5264['options'][_0x2804('0x20')]||null:null,'limit':_0x4f5264[_0x2804('0x1d')]?_0x4f5264['options']['limit']||null:null})[_0x2804('0x21')](function(_0x19909b){logger[_0x2804('0x11')](_0x2804('0x22'),_0x4f5264);logger[_0x2804('0x13')](_0x2804('0x22'),_0x4f5264,JSON[_0x2804('0x14')](_0x19909b));_0x30ad30(_0x19909b);})[_0x2804('0x19')](function(_0x54e7e7){logger[_0x2804('0x15')](_0x2804('0x22'),_0x54e7e7[_0x2804('0x17')],_0x4f5264);_0x2b81de(_0x5006be[_0x2804('0x15')](0x1f4,_0x54e7e7[_0x2804('0x17')]));});});};exports[_0x2804('0x23')]=function(_0x265049){return new Promise(function(_0x3f4027,_0xf00bdc){return db[_0x2804('0x1a')]['find']({'where':_0x265049[_0x2804('0x1d')]?_0x265049[_0x2804('0x1d')][_0x2804('0x1f')]||null:null})[_0x2804('0x21')](function(_0x4b1c63){if(_0x4b1c63){return _0x4b1c63[_0x2804('0x24')](_0x265049[_0x2804('0x1c')][_0x2804('0x25')],_[_0x2804('0x26')](_0x265049[_0x2804('0x1c')],[_0x2804('0x25'),'id'])||{});}})['spread'](function(_0x2ea54d){logger[_0x2804('0x11')](_0x2804('0x27'),_0x265049);logger[_0x2804('0x13')]('AddTags',_0x265049,JSON['stringify'](_0x2ea54d));_0x3f4027(_0x2ea54d);})[_0x2804('0x19')](function(_0xff384b){logger[_0x2804('0x15')](_0x2804('0x27'),_0xff384b[_0x2804('0x17')],_0x265049);_0xf00bdc(_this['error'](0x1f4,_0xff384b[_0x2804('0x17')]));});});}; \ No newline at end of file +var _0xf3b2=['raw','options','where','limit','debug','find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf3b2,0x152));var _0x2f3b=function(_0x41f7b2,_0x58547b){_0x41f7b2=_0x41f7b2-0x0;var _0x19ec6d=_0xf3b2[_0x41f7b2];return _0x19ec6d;};'use strict';var _=require(_0x2f3b('0x0'));var util=require('util');var moment=require(_0x2f3b('0x1'));var BPromise=require(_0x2f3b('0x2'));var rs=require(_0x2f3b('0x3'));var fs=require('fs');var Redis=require(_0x2f3b('0x4'));var db=require(_0x2f3b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2f3b('0x6'));var config=require(_0x2f3b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2f3b('0x8')][_0x2f3b('0x9')]({'port':0x232a});config[_0x2f3b('0xa')]=_[_0x2f3b('0xb')](config[_0x2f3b('0xa')],{'host':_0x2f3b('0xc'),'port':0x18eb});var socket=require(_0x2f3b('0xd'))(new Redis(config[_0x2f3b('0xa')]));require(_0x2f3b('0xe'))[_0x2f3b('0xf')](socket);function respondWithRpcPromise(_0x49600e,_0x446e68,_0x5f07cc){return new BPromise(function(_0x4f7d75,_0x400337){return client[_0x2f3b('0x10')](_0x49600e,_0x5f07cc)[_0x2f3b('0x11')](function(_0x5a7ac8){logger[_0x2f3b('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x446e68,_0x2f3b('0x13'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x446e68,_0x2f3b('0x13'),JSON[_0x2f3b('0x14')](_0x5a7ac8));if(_0x5a7ac8['error']){if(_0x5a7ac8[_0x2f3b('0x15')][_0x2f3b('0x16')]===0x1f4){logger['error'](_0x2f3b('0x17'),_0x446e68,_0x5a7ac8[_0x2f3b('0x15')][_0x2f3b('0x18')]);return _0x400337(_0x5a7ac8[_0x2f3b('0x15')][_0x2f3b('0x18')]);}logger[_0x2f3b('0x15')](_0x2f3b('0x17'),_0x446e68,_0x5a7ac8[_0x2f3b('0x15')][_0x2f3b('0x18')]);return _0x4f7d75(_0x5a7ac8[_0x2f3b('0x15')]['message']);}else{logger[_0x2f3b('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x446e68,_0x2f3b('0x13'));_0x4f7d75(_0x5a7ac8[_0x2f3b('0x19')][_0x2f3b('0x18')]);}})[_0x2f3b('0x1a')](function(_0x4c6a43){logger[_0x2f3b('0x15')](_0x2f3b('0x17'),_0x446e68,_0x4c6a43);_0x400337(_0x4c6a43);});});}exports[_0x2f3b('0x1b')]=function(_0x198520){var _0x21d525=this;return new Promise(function(_0x512015,_0x3f09fb){return db[_0x2f3b('0x1c')][_0x2f3b('0x1d')](_0x198520[_0x2f3b('0x1e')],{'raw':_0x198520['options']?_0x198520['options'][_0x2f3b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x198520['options']?_0x198520[_0x2f3b('0x20')][_0x2f3b('0x21')]||null:null,'attributes':_0x198520['options']?_0x198520[_0x2f3b('0x20')]['attributes']||null:null,'limit':_0x198520[_0x2f3b('0x20')]?_0x198520[_0x2f3b('0x20')][_0x2f3b('0x22')]||null:null})['then'](function(_0x48e2fc){logger['info'](_0x2f3b('0x1b'),_0x198520);logger[_0x2f3b('0x23')](_0x2f3b('0x1b'),_0x198520,JSON[_0x2f3b('0x14')](_0x48e2fc));_0x512015(_0x48e2fc);})[_0x2f3b('0x1a')](function(_0x1300dc){logger[_0x2f3b('0x15')](_0x2f3b('0x1b'),_0x1300dc['message'],_0x198520);_0x3f09fb(_0x21d525[_0x2f3b('0x15')](0x1f4,_0x1300dc['message']));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x4d9e5f){return new Promise(function(_0x454890,_0x5142ae){return db[_0x2f3b('0x1c')][_0x2f3b('0x24')]({'where':_0x4d9e5f['options']?_0x4d9e5f[_0x2f3b('0x20')][_0x2f3b('0x21')]||null:null})[_0x2f3b('0x11')](function(_0x3bd0a2){if(_0x3bd0a2){return _0x3bd0a2[_0x2f3b('0x25')](_0x4d9e5f[_0x2f3b('0x1e')][_0x2f3b('0x26')],_['omit'](_0x4d9e5f[_0x2f3b('0x1e')],[_0x2f3b('0x26'),'id'])||{});}})[_0x2f3b('0x27')](function(_0x47969c){logger[_0x2f3b('0x12')](_0x2f3b('0x28'),_0x4d9e5f);logger[_0x2f3b('0x23')](_0x2f3b('0x28'),_0x4d9e5f,JSON[_0x2f3b('0x14')](_0x47969c));_0x454890(_0x47969c);})[_0x2f3b('0x1a')](function(_0x24561e){logger['error'](_0x2f3b('0x28'),_0x24561e['message'],_0x4d9e5f);_0x5142ae(_this['error'](0x1f4,_0x24561e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e0c955a..58029fe 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 _0xae70=['./openchannelInteraction.events','remove','update','removeListener','register','openchannelInteraction:'];(function(_0x2f1a2f,_0x2ffa4b){var _0x260fbd=function(_0x5ca460){while(--_0x5ca460){_0x2f1a2f['push'](_0x2f1a2f['shift']());}};_0x260fbd(++_0x2ffa4b);}(_0xae70,0x90));var _0x0ae7=function(_0x4a3e96,_0x10f47a){_0x4a3e96=_0x4a3e96-0x0;var _0x3eda1e=_0xae70[_0x4a3e96];return _0x3eda1e;};'use strict';var OpenchannelInteractionEvents=require(_0x0ae7('0x0'));var events=['save',_0x0ae7('0x1'),_0x0ae7('0x2')];function createListener(_0x3ff99f,_0x2678d8){return function(_0x5f1736){_0x2678d8['emit'](_0x3ff99f,_0x5f1736);};}function removeListener(_0x236be0,_0x2e6de8){return function(){OpenchannelInteractionEvents[_0x0ae7('0x3')](_0x236be0,_0x2e6de8);};}exports[_0x0ae7('0x4')]=function(_0x54f1b2){for(var _0x45eadd=0x0,_0xfba345=events['length'];_0x45eadd<_0xfba345;_0x45eadd++){var _0x2a81f0=events[_0x45eadd];var _0x3bb23b=createListener(_0x0ae7('0x5')+_0x2a81f0,_0x54f1b2);OpenchannelInteractionEvents['on'](_0x2a81f0,_0x3bb23b);}}; \ No newline at end of file +var _0xc6f9=['save','update','emit','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x37d039,_0x15895c){var _0x2467e0=function(_0x4432b5){while(--_0x4432b5){_0x37d039['push'](_0x37d039['shift']());}};_0x2467e0(++_0x15895c);}(_0xc6f9,0x179));var _0x9c6f=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc6f9[_0x2dafbe];return _0x58a45a;};'use strict';var OpenchannelInteractionEvents=require(_0x9c6f('0x0'));var events=[_0x9c6f('0x1'),'remove',_0x9c6f('0x2')];function createListener(_0x1eebd9,_0x21fac7){return function(_0x1e7a84){_0x21fac7[_0x9c6f('0x3')](_0x1eebd9,_0x1e7a84);};}function removeListener(_0x5813d5,_0x343325){return function(){OpenchannelInteractionEvents['removeListener'](_0x5813d5,_0x343325);};}exports[_0x9c6f('0x4')]=function(_0x5a377f){for(var _0x29ed1e=0x0,_0x132ee5=events[_0x9c6f('0x5')];_0x29ed1e<_0x132ee5;_0x29ed1e++){var _0x25167b=events[_0x29ed1e];var _0x1a8d66=createListener(_0x9c6f('0x6')+_0x25167b,_0x5a377f);OpenchannelInteractionEvents['on'](_0x25167b,_0x1a8d66);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b41f431..bace1c7 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 _0x616c=['../../components/interaction/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','show','post','tracked','openchannel','create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0x616c,0x92));var _0xc616=function(_0x546182,_0x2302aa){_0x546182=_0x546182-0x0;var _0x3468ba=_0x616c[_0x546182];return _0x3468ba;};'use strict';var multer=require(_0xc616('0x0'));var util=require(_0xc616('0x1'));var path=require('path');var timeout=require(_0xc616('0x2'));var express=require(_0xc616('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xc616('0x4'));var config=require(_0xc616('0x5'));var controller=require(_0xc616('0x6'));router['get']('/',auth[_0xc616('0x7')](),controller[_0xc616('0x8')]);router[_0xc616('0x9')](_0xc616('0xa'),auth[_0xc616('0x7')](),controller['describe']);router[_0xc616('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc616('0xb')]);router[_0xc616('0xc')]('/',auth['isAuthenticated'](),interaction[_0xc616('0xd')](_0xc616('0xe'),'openchannelmessage:create'),controller[_0xc616('0xf')]);router['put']('/:id',auth[_0xc616('0x7')](),controller[_0xc616('0x10')]);router[_0xc616('0x11')](_0xc616('0x12'),auth[_0xc616('0x7')](),controller[_0xc616('0x13')]);router[_0xc616('0x11')]('/:id/reject',auth[_0xc616('0x7')](),controller[_0xc616('0x14')]);router[_0xc616('0x15')](_0xc616('0x16'),auth[_0xc616('0x7')](),controller[_0xc616('0x17')]);module[_0xc616('0x18')]=router; \ No newline at end of file +var _0x177f=['./openchannelMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','tracked','openchannel','openchannelmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x376106,_0x30646a){var _0x397b62=function(_0xf8fbac){while(--_0xf8fbac){_0x376106['push'](_0x376106['shift']());}};_0x397b62(++_0x30646a);}(_0x177f,0x117));var _0xf177=function(_0x6f7b07,_0x5077f6){_0x6f7b07=_0x6f7b07-0x0;var _0x299377=_0x177f[_0x6f7b07];return _0x299377;};'use strict';var multer=require(_0xf177('0x0'));var util=require(_0xf177('0x1'));var path=require(_0xf177('0x2'));var timeout=require(_0xf177('0x3'));var express=require('express');var router=express[_0xf177('0x4')]();var auth=require(_0xf177('0x5'));var interaction=require(_0xf177('0x6'));var config=require('../../config/environment');var controller=require(_0xf177('0x7'));router['get']('/',auth[_0xf177('0x8')](),controller[_0xf177('0x9')]);router[_0xf177('0xa')](_0xf177('0xb'),auth[_0xf177('0x8')](),controller[_0xf177('0xc')]);router[_0xf177('0xa')]('/:id',auth[_0xf177('0x8')](),controller[_0xf177('0xd')]);router[_0xf177('0xe')]('/',auth['isAuthenticated'](),interaction[_0xf177('0xf')](_0xf177('0x10'),_0xf177('0x11')),controller['create']);router[_0xf177('0x12')](_0xf177('0x13'),auth[_0xf177('0x8')](),controller[_0xf177('0x14')]);router[_0xf177('0x12')](_0xf177('0x15'),auth[_0xf177('0x8')](),controller[_0xf177('0x16')]);router[_0xf177('0x12')](_0xf177('0x17'),auth[_0xf177('0x8')](),controller[_0xf177('0x18')]);router[_0xf177('0x19')](_0xf177('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index b1b5036..1ba9c38 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 _0x8356=['medium','BOOLEAN','ENUM','out','sequelize','TEXT'];(function(_0x58b449,_0x3975f8){var _0x46d4cc=function(_0x25adcc){while(--_0x25adcc){_0x58b449['push'](_0x58b449['shift']());}};_0x46d4cc(++_0x3975f8);}(_0x8356,0x8e));var _0x6835=function(_0x567758,_0x533bba){_0x567758=_0x567758-0x0;var _0x1d0e7f=_0x8356[_0x567758];return _0x1d0e7f;};'use strict';var Sequelize=require(_0x6835('0x0'));module['exports']={'body':{'type':Sequelize[_0x6835('0x1')](_0x6835('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6835('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6835('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6835('0x4')]('in',_0x6835('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6835('0x1')]}}; \ No newline at end of file +var _0x35c0=['sequelize','exports','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0x1e3a63,_0x1cb88a){var _0xf4c7cd=function(_0x2f3429){while(--_0x2f3429){_0x1e3a63['push'](_0x1e3a63['shift']());}};_0xf4c7cd(++_0x1cb88a);}(_0x35c0,0x130));var _0x035c=function(_0x3009af,_0x56350a){_0x3009af=_0x3009af-0x0;var _0x3d5c87=_0x35c0[_0x3009af];return _0x3d5c87;};'use strict';var Sequelize=require(_0x035c('0x0'));module[_0x035c('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x035c('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x035c('0x3')]('in',_0x035c('0x4')),'defaultValue':_0x035c('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x035c('0x5')]},'providerName':{'type':Sequelize[_0x035c('0x6')]},'providerResponse':{'type':Sequelize[_0x035c('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0033ad7..12d2144 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 _0x6582=['[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','manual','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','openchannel','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','interface','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','OpenchannelMessage','rawAttributes','model','map','keys','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','get'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x6582,0x108));var _0x2658=function(_0x24507a,_0x58e59b){_0x24507a=_0x24507a-0x0;var _0x20ed6a=_0x6582[_0x24507a];return _0x20ed6a;};'use strict';var pdf=require(_0x2658('0x0'));var emlformat=require(_0x2658('0x1'));var rimraf=require(_0x2658('0x2'));var zipdir=require(_0x2658('0x3'));var jsonpatch=require(_0x2658('0x4'));var rp=require('request-promise');var moment=require(_0x2658('0x5'));var BPromise=require(_0x2658('0x6'));var Mustache=require(_0x2658('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2658('0x8'));var ejs=require(_0x2658('0x9'));var fs=require('fs');var _=require(_0x2658('0xa'));var squel=require(_0x2658('0xb'));var crypto=require(_0x2658('0xc'));var jsforce=require(_0x2658('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2658('0x8'));var querystring=require(_0x2658('0xe'));var Papa=require(_0x2658('0xf'));var Redis=require(_0x2658('0x10'));var authService=require(_0x2658('0x11'));var qs=require(_0x2658('0x12'));var as=require(_0x2658('0x13'));var hardwareService=require(_0x2658('0x14'));var logger=require(_0x2658('0x15'))('api');var utils=require(_0x2658('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2658('0x17'));var db=require(_0x2658('0x18'))['db'];config[_0x2658('0x19')]=_[_0x2658('0x1a')](config[_0x2658('0x19')],{'host':_0x2658('0x1b'),'port':0x18eb});var socket=require(_0x2658('0x1c'))(new Redis(config['redis']));require(_0x2658('0x1d'))[_0x2658('0x1e')](socket);var jayson=require(_0x2658('0x1f'));var client=jayson[_0x2658('0x20')][_0x2658('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x2658('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5d8ed5,_0x15bd54,_0x496524,_0xc820a){return new BPromise(function(_0x44c6d2,_0x3ebf10){var _0x215211=_0xc820a||client;return _0x215211['request'](_0x5d8ed5,_0x496524)[_0x2658('0x22')](function(_0x57337e){logger[_0x2658('0x23')](_0x2658('0x24'),_0x15bd54,_0x2658('0x25'));logger[_0x2658('0x26')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x15bd54,_0x2658('0x25'),JSON[_0x2658('0x27')](_0x57337e));if(_0x57337e[_0x2658('0x28')]){if(_0x57337e[_0x2658('0x28')][_0x2658('0x29')]===0x1f4){logger[_0x2658('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x15bd54,_0x57337e[_0x2658('0x28')]['message']);return _0x3ebf10(_0x57337e['error'][_0x2658('0x2a')]);}logger[_0x2658('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x15bd54,_0x57337e[_0x2658('0x28')]['message']);return _0x44c6d2(_0x57337e[_0x2658('0x28')][_0x2658('0x2a')]);}else{logger[_0x2658('0x23')](_0x2658('0x24'),_0x15bd54,_0x2658('0x25'));_0x44c6d2(_0x57337e[_0x2658('0x2b')][_0x2658('0x2a')]);}})[_0x2658('0x2c')](function(_0x2496bf){logger[_0x2658('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x15bd54,_0x2496bf);_0x3ebf10(_0x2496bf);});});}function respondWithStatusCode(_0x2062ef,_0x4676a4){_0x4676a4=_0x4676a4||0xcc;return function(_0x338f06){if(_0x338f06){return _0x2062ef[_0x2658('0x2d')](_0x4676a4);}return _0x2062ef[_0x2658('0x2e')](_0x4676a4)[_0x2658('0x2f')]();};}function respondWithResult(_0x58385f,_0x1d2bf4){_0x1d2bf4=_0x1d2bf4||0xc8;return function(_0x474dfe){if(_0x474dfe){return _0x58385f[_0x2658('0x2e')](_0x1d2bf4)[_0x2658('0x30')](_0x474dfe);}};}function respondWithFilteredResult(_0x27e0f5,_0x1492cb){return function(_0x256172){if(_0x256172){var _0xb8d245=_0x256172[_0x2658('0x31')],_0xd891fe=_0x1492cb[_0x2658('0x32')],_0x14784=_0x1492cb[_0x2658('0x32')]+_0x1492cb[_0x2658('0x33')],_0x2d1fad;if(_0x14784>=_0xb8d245){_0x14784=_0xb8d245;_0x2d1fad=0xc8;}else{_0x2d1fad=0xce;}_0x27e0f5[_0x2658('0x2e')](_0x2d1fad);return _0x27e0f5[_0x2658('0x34')](_0x2658('0x35'),_0xd891fe+'-'+_0x14784+'/'+_0xb8d245)['json'](_0x256172);}return null;};}function patchUpdates(_0x14bcce){return function(_0x556dca){try{jsonpatch[_0x2658('0x36')](_0x556dca,_0x14bcce,!![]);}catch(_0x49bd5e){return BPromise[_0x2658('0x37')](_0x49bd5e);}return _0x556dca[_0x2658('0x38')]();};}function saveUpdates(_0x28cea6,_0x5e9e6f){return function(_0x25ca0f){if(_0x25ca0f){return _0x25ca0f[_0x2658('0x39')](_0x28cea6)[_0x2658('0x22')](function(_0x455e1b){return _0x455e1b;});}return null;};}function removeEntity(_0x28b0bf,_0x11793a){return function(_0x147240){if(_0x147240){return _0x147240[_0x2658('0x3a')]()[_0x2658('0x22')](function(){_0x28b0bf['status'](0xcc)[_0x2658('0x2f')]();});}};}function handleEntityNotFound(_0xebb0df,_0x23bd89){return function(_0x4e7578){if(!_0x4e7578){_0xebb0df['sendStatus'](0x194);}return _0x4e7578;};}function handleError(_0x5c0f51,_0x15e7ec){_0x15e7ec=_0x15e7ec||0x1f4;return function(_0x202d6e){logger[_0x2658('0x28')](_0x202d6e[_0x2658('0x3b')]);if(_0x202d6e[_0x2658('0x3c')]){delete _0x202d6e[_0x2658('0x3c')];}_0x5c0f51['status'](_0x15e7ec)[_0x2658('0x3d')](_0x202d6e);};}exports[_0x2658('0x3e')]=function(_0x2b3b99,_0x5ad5f0){var _0xb8fd62={},_0x3798ba={},_0x117010={'count':0x0,'rows':[]};var _0x180c59=_['map'](db[_0x2658('0x3f')][_0x2658('0x40')],function(_0x5cb0b9){return{'name':_0x5cb0b9['fieldName'],'type':_0x5cb0b9['type']['key']};});_0x3798ba[_0x2658('0x41')]=_[_0x2658('0x42')](_0x180c59,_0x2658('0x3c'));_0x3798ba['query']=_[_0x2658('0x43')](_0x2b3b99['query']);_0x3798ba['filters']=_[_0x2658('0x44')](_0x3798ba[_0x2658('0x41')],_0x3798ba[_0x2658('0x45')]);_0xb8fd62['attributes']=_['intersection'](_0x3798ba['model'],qs['fields'](_0x2b3b99[_0x2658('0x45')][_0x2658('0x46')]));_0xb8fd62[_0x2658('0x47')]=_0xb8fd62[_0x2658('0x47')]['length']?_0xb8fd62[_0x2658('0x47')]:_0x3798ba[_0x2658('0x41')];if(!_0x2b3b99[_0x2658('0x45')][_0x2658('0x48')](_0x2658('0x49'))){_0xb8fd62['limit']=qs[_0x2658('0x33')](_0x2b3b99[_0x2658('0x45')][_0x2658('0x33')]);_0xb8fd62[_0x2658('0x32')]=qs[_0x2658('0x32')](_0x2b3b99[_0x2658('0x45')][_0x2658('0x32')]);}_0xb8fd62[_0x2658('0x4a')]=qs[_0x2658('0x4b')](_0x2b3b99[_0x2658('0x45')][_0x2658('0x4b')]);_0xb8fd62[_0x2658('0x4c')]=qs['filters'](_['pick'](_0x2b3b99[_0x2658('0x45')],_0x3798ba[_0x2658('0x4d')]),_0x180c59);if(_0x2b3b99[_0x2658('0x45')]['filter']){_0xb8fd62[_0x2658('0x4c')]=_[_0x2658('0x4e')](_0xb8fd62[_0x2658('0x4c')],{'$or':_[_0x2658('0x42')](_0x180c59,function(_0x5c1340){if(_0x5c1340[_0x2658('0x4f')]!==_0x2658('0x50')){var _0x41ac72={};_0x41ac72[_0x5c1340[_0x2658('0x3c')]]={'$like':'%'+_0x2b3b99[_0x2658('0x45')][_0x2658('0x51')]+'%'};return _0x41ac72;}})});}_0xb8fd62=_['merge']({},_0xb8fd62,_0x2b3b99[_0x2658('0x52')]);var _0x59c41b={'where':_0xb8fd62[_0x2658('0x4c')]};return db[_0x2658('0x3f')]['count'](_0x59c41b)[_0x2658('0x22')](function(_0x21f380){_0x117010['count']=_0x21f380;if(_0x2b3b99[_0x2658('0x45')][_0x2658('0x53')]){_0xb8fd62[_0x2658('0x54')]=[{'all':!![]}];}return db[_0x2658('0x3f')][_0x2658('0x55')](_0xb8fd62);})['then'](function(_0x2764f0){_0x117010[_0x2658('0x56')]=_0x2764f0;return _0x117010;})['then'](respondWithFilteredResult(_0x5ad5f0,_0xb8fd62))[_0x2658('0x2c')](handleError(_0x5ad5f0,null));};exports[_0x2658('0x57')]=function(_0x2e0558,_0x1efb33){var _0x5d699d={'raw':!![],'where':{'id':_0x2e0558[_0x2658('0x58')]['id']}},_0x2436c1={};_0x2436c1[_0x2658('0x41')]=_[_0x2658('0x43')](db[_0x2658('0x3f')][_0x2658('0x40')]);_0x2436c1[_0x2658('0x45')]=_['keys'](_0x2e0558[_0x2658('0x45')]);_0x2436c1['filters']=_[_0x2658('0x44')](_0x2436c1['model'],_0x2436c1[_0x2658('0x45')]);_0x5d699d[_0x2658('0x47')]=_[_0x2658('0x44')](_0x2436c1[_0x2658('0x41')],qs[_0x2658('0x46')](_0x2e0558['query'][_0x2658('0x46')]));_0x5d699d[_0x2658('0x47')]=_0x5d699d[_0x2658('0x47')]['length']?_0x5d699d[_0x2658('0x47')]:_0x2436c1[_0x2658('0x41')];if(_0x2e0558[_0x2658('0x45')][_0x2658('0x53')]){_0x5d699d['include']=[{'all':!![]}];}_0x5d699d=_[_0x2658('0x4e')]({},_0x5d699d,_0x2e0558['options']);return db['OpenchannelMessage'][_0x2658('0x59')](_0x5d699d)[_0x2658('0x22')](handleEntityNotFound(_0x1efb33,null))[_0x2658('0x22')](respondWithResult(_0x1efb33,null))['catch'](handleError(_0x1efb33,null));};exports[_0x2658('0x5a')]=function(_0x27efa5,_0x54b7c5){return db[_0x2658('0x3f')]['create'](_0x27efa5['body'],{})[_0x2658('0x22')](respondWithResult(_0x54b7c5,0xc9))[_0x2658('0x2c')](handleError(_0x54b7c5,null));};exports['update']=function(_0x209875,_0x763583){if(_0x209875[_0x2658('0x5b')]['id']){delete _0x209875['body']['id'];}return db['OpenchannelMessage'][_0x2658('0x59')]({'where':{'id':_0x209875['params']['id']}})['then'](handleEntityNotFound(_0x763583,null))[_0x2658('0x22')](saveUpdates(_0x209875['body'],null))[_0x2658('0x22')](respondWithResult(_0x763583,null))[_0x2658('0x2c')](handleError(_0x763583,null));};exports[_0x2658('0x3a')]=function(_0x2adab1,_0x22f2dc){return db[_0x2658('0x3f')][_0x2658('0x59')]({'where':{'id':_0x2adab1['params']['id']}})[_0x2658('0x22')](handleEntityNotFound(_0x22f2dc,null))['then'](removeEntity(_0x22f2dc,null))[_0x2658('0x2c')](handleError(_0x22f2dc,null));};exports[_0x2658('0x5c')]=function(_0x2f5a07,_0x41208a){return db['OpenchannelMessage']['describe']()[_0x2658('0x22')](respondWithResult(_0x41208a,null))[_0x2658('0x2c')](handleError(_0x41208a,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports[_0x2658('0x5d')]=function(_0x313256,_0x41b9ca,_0x3d5b82){var _0x2040e6={'channel':'openchannel'};if(_0x313256[_0x2658('0x5b')]['id']){delete _0x313256['body']['id'];}_0x313256[_0x2658('0x5b')][_0x2658('0x5e')]=!![];_0x313256['body'][_0x2658('0x5f')]=moment()[_0x2658('0x60')](_0x2658('0x61'));_0x313256[_0x2658('0x5b')][_0x2658('0x62')]=_0x313256[_0x2658('0x5b')][_0x2658('0x62')]||_0x313256['user']['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x313256['params']['id'],'UserId':null},'include':[{'model':db[_0x2658('0x63')],'as':'Contact'}]})[_0x2658('0x22')](handleEntityNotFound(_0x41b9ca,null))[_0x2658('0x22')](saveUpdates(_0x313256[_0x2658('0x5b')],null))[_0x2658('0x22')](function(_0x47a6bb){if(_0x47a6bb){_0x2040e6[_0x2658('0x2a')]=_0x47a6bb['get']({'plain':!![]});return db[_0x2658('0x64')][_0x2658('0x59')]({'where':{'id':_0x47a6bb[_0x2658('0x65')]}});}return null;})[_0x2658('0x22')](handleEntityNotFound(_0x41b9ca,null))['then'](function(_0x2a92b7){if(_0x2a92b7){return _0x2a92b7['update']({'UserId':_0x313256[_0x2658('0x5b')][_0x2658('0x62')],'read1stAt':_[_0x2658('0x66')](_0x2a92b7[_0x2658('0x67')])?moment()[_0x2658('0x60')](_0x2658('0x61')):undefined});}return null;})[_0x2658('0x22')](function(_0x37cab0){if(_0x37cab0){_0x2040e6['interaction']=_0x37cab0[_0x2658('0x68')]({'plain':!![]});interaction_log[_0x2658('0x23')](_0x2658('0x69'),_0x313256['user']['id'],_0x313256[_0x2658('0x6a')]['name'],_0x313256[_0x2658('0x6a')]['role'],_0x2040e6[_0x2658('0x6b')]['id'],_0x313256[_0x2658('0x5b')]?JSON[_0x2658('0x27')](_0x313256['body']):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2040e6);}return null;})['then'](function(_0x2d4bb9){if(_0x2d4bb9){if(_0x313256[_0x2658('0x5b')][_0x2658('0x6c')]){_0x2040e6[_0x2658('0x2a')]['interface']=util[_0x2658('0x60')](_0x2658('0x6d'),_0x313256['user'][_0x2658('0x3c')]);_0x2040e6['message'][_0x2658('0x6e')]=_0x2040e6[_0x2658('0x6e')];_0x2040e6[_0x2658('0x2a')][_0x2658('0x6f')]=_0x2658('0x5d');return respondWithRpcPromise(_0x2658('0x70'),_0x2658('0x70'),{'event':_0x2658('0x71'),'message':_0x2040e6[_0x2658('0x2a')]},client9002)['then'](function(){return _0x2040e6;});}return _0x2040e6;}return null;})['then'](respondWithResult(_0x41b9ca,null))[_0x2658('0x2c')](handleError(_0x41b9ca,null));};var interaction_log=require(_0x2658('0x15'))(_0x2658('0x72'));exports['reject']=function(_0x335650,_0x431951,_0x1191ee){var _0x24b42d={'agent':{},'channel':_0x2658('0x73')};if(_0x335650['body']['id']){delete _0x335650[_0x2658('0x5b')]['id'];}_0x335650[_0x2658('0x5b')][_0x2658('0x62')]=_0x335650['body'][_0x2658('0x62')]||_0x335650[_0x2658('0x6a')]['id'];_0x24b42d[_0x2658('0x74')]['id']=_0x335650[_0x2658('0x5b')]['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x335650[_0x2658('0x58')]['id'],'UserId':null}})[_0x2658('0x22')](handleEntityNotFound(_0x431951,null))[_0x2658('0x22')](function(_0x1d793e){if(_0x1d793e){_0x24b42d[_0x2658('0x2a')]=_0x1d793e[_0x2658('0x68')]({'plain':!![]});return db[_0x2658('0x64')]['find']({'where':{'id':_0x1d793e['OpenchannelInteractionId']}});}return null;})[_0x2658('0x22')](handleEntityNotFound(_0x431951,null))[_0x2658('0x22')](function(_0x4ac1b4){if(_0x4ac1b4){_0x24b42d['interaction']=_0x4ac1b4[_0x2658('0x68')]({'plain':!![]});interaction_log[_0x2658('0x23')](_0x2658('0x75'),_0x335650[_0x2658('0x6a')]['id'],_0x335650[_0x2658('0x6a')][_0x2658('0x3c')],_0x335650[_0x2658('0x6a')]['role'],_0x24b42d['interaction']['id'],_0x335650[_0x2658('0x5b')]?JSON['stringify'](_0x335650[_0x2658('0x5b')]):_0x2658('0x76'));return respondWithRpcPromise(_0x2658('0x77'),_0x2658('0x78'),_0x24b42d);}return null;})[_0x2658('0x22')](function(_0x4b47a6){if(_0x4b47a6){_0x4b47a6[_0x2658('0x2a')][_0x2658('0x79')]=util[_0x2658('0x60')](_0x2658('0x6d'),_0x335650[_0x2658('0x6a')]['name']);_0x4b47a6[_0x2658('0x2a')]['channel']=_0x24b42d[_0x2658('0x6e')];_0x4b47a6[_0x2658('0x2a')]['event']=_0x2658('0x37');respondWithRpcPromise('EventManager',_0x2658('0x70'),{'event':_0x2658('0x7a'),'message':_0x4b47a6[_0x2658('0x2a')]},client9002);return _0x24b42d;}return null;})['then'](respondWithResult(_0x431951,null))[_0x2658('0x2c')](handleError(_0x431951,null));}; \ No newline at end of file +var _0xd9dc=['then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','reject','save','update','destroy','stack','name','send','index','map','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','OpenchannelMessage','includeAll','findAll','rows','show','rawAttributes','find','create','body','params','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0xd9dc,0x1be));var _0xcd9d=function(_0x1dd0b6,_0x5c4f29){_0x1dd0b6=_0x1dd0b6-0x0;var _0x294238=_0xd9dc[_0x1dd0b6];return _0x294238;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcd9d('0x0'));var rimraf=require(_0xcd9d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd9d('0x2'));var rp=require(_0xcd9d('0x3'));var moment=require(_0xcd9d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcd9d('0x5'));var util=require(_0xcd9d('0x6'));var path=require(_0xcd9d('0x7'));var sox=require(_0xcd9d('0x8'));var csv=require(_0xcd9d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd9d('0xa'));var squel=require(_0xcd9d('0xb'));var crypto=require(_0xcd9d('0xc'));var jsforce=require(_0xcd9d('0xd'));var deskjs=require(_0xcd9d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xcd9d('0xf'));var Papa=require(_0xcd9d('0x10'));var Redis=require(_0xcd9d('0x11'));var authService=require(_0xcd9d('0x12'));var qs=require(_0xcd9d('0x13'));var as=require(_0xcd9d('0x14'));var hardwareService=require(_0xcd9d('0x15'));var logger=require(_0xcd9d('0x16'))('api');var utils=require(_0xcd9d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xcd9d('0x18'));var db=require('../../mysqldb')['db'];config[_0xcd9d('0x19')]=_[_0xcd9d('0x1a')](config[_0xcd9d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xcd9d('0x1b'))(new Redis(config['redis']));require(_0xcd9d('0x1c'))[_0xcd9d('0x1d')](socket);var jayson=require(_0xcd9d('0x1e'));var client=jayson['client'][_0xcd9d('0x1f')]({'port':0x232c});var client9002=jayson[_0xcd9d('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d5aa,_0x5a7248,_0x3ea72c,_0x534c8f){return new BPromise(function(_0x3e5e23,_0x32bb76){var _0x3a66af=_0x534c8f||client;return _0x3a66af[_0xcd9d('0x21')](_0x40d5aa,_0x3ea72c)[_0xcd9d('0x22')](function(_0x4381e2){logger[_0xcd9d('0x23')](_0xcd9d('0x24'),_0x5a7248,_0xcd9d('0x25'));logger[_0xcd9d('0x26')](_0xcd9d('0x27'),_0x5a7248,'request\x20sent',JSON[_0xcd9d('0x28')](_0x4381e2));if(_0x4381e2[_0xcd9d('0x29')]){if(_0x4381e2[_0xcd9d('0x29')]['code']===0x1f4){logger[_0xcd9d('0x29')](_0xcd9d('0x24'),_0x5a7248,_0x4381e2[_0xcd9d('0x29')][_0xcd9d('0x2a')]);return _0x32bb76(_0x4381e2[_0xcd9d('0x29')][_0xcd9d('0x2a')]);}logger[_0xcd9d('0x29')](_0xcd9d('0x24'),_0x5a7248,_0x4381e2['error']['message']);return _0x3e5e23(_0x4381e2[_0xcd9d('0x29')][_0xcd9d('0x2a')]);}else{logger[_0xcd9d('0x23')](_0xcd9d('0x24'),_0x5a7248,'request\x20sent');_0x3e5e23(_0x4381e2[_0xcd9d('0x2b')][_0xcd9d('0x2a')]);}})[_0xcd9d('0x2c')](function(_0xf0f632){logger[_0xcd9d('0x29')](_0xcd9d('0x24'),_0x5a7248,_0xf0f632);_0x32bb76(_0xf0f632);});});}function respondWithStatusCode(_0x33aca7,_0x1f8579){_0x1f8579=_0x1f8579||0xcc;return function(_0xf21e2){if(_0xf21e2){return _0x33aca7[_0xcd9d('0x2d')](_0x1f8579);}return _0x33aca7[_0xcd9d('0x2e')](_0x1f8579)[_0xcd9d('0x2f')]();};}function respondWithResult(_0x3826d3,_0x5ad994){_0x5ad994=_0x5ad994||0xc8;return function(_0x44dd6b){if(_0x44dd6b){return _0x3826d3[_0xcd9d('0x2e')](_0x5ad994)['json'](_0x44dd6b);}};}function respondWithFilteredResult(_0x588db6,_0xf84e80){return function(_0x124da9){if(_0x124da9){var _0x5b1fd6=_0x124da9[_0xcd9d('0x30')],_0xcf8b36=_0xf84e80[_0xcd9d('0x31')],_0x2d3347=_0xf84e80['offset']+_0xf84e80[_0xcd9d('0x32')],_0x3c70de;if(_0x2d3347>=_0x5b1fd6){_0x2d3347=_0x5b1fd6;_0x3c70de=0xc8;}else{_0x3c70de=0xce;}_0x588db6[_0xcd9d('0x2e')](_0x3c70de);return _0x588db6[_0xcd9d('0x33')]('Content-Range',_0xcf8b36+'-'+_0x2d3347+'/'+_0x5b1fd6)[_0xcd9d('0x34')](_0x124da9);}return null;};}function patchUpdates(_0xcd6fa9){return function(_0x38e3e2){try{jsonpatch['apply'](_0x38e3e2,_0xcd6fa9,!![]);}catch(_0x154dd8){return BPromise[_0xcd9d('0x35')](_0x154dd8);}return _0x38e3e2[_0xcd9d('0x36')]();};}function saveUpdates(_0xa4440,_0x5e483d){return function(_0x48dd7b){if(_0x48dd7b){return _0x48dd7b[_0xcd9d('0x37')](_0xa4440)['then'](function(_0x5a0c5f){return _0x5a0c5f;});}return null;};}function removeEntity(_0x600a40,_0x155a7e){return function(_0x1c1a3c){if(_0x1c1a3c){return _0x1c1a3c[_0xcd9d('0x38')]()['then'](function(){_0x600a40['status'](0xcc)[_0xcd9d('0x2f')]();});}};}function handleEntityNotFound(_0x8e354c,_0xbe855f){return function(_0x57ac64){if(!_0x57ac64){_0x8e354c[_0xcd9d('0x2d')](0x194);}return _0x57ac64;};}function handleError(_0x1bd2e8,_0x13553c){_0x13553c=_0x13553c||0x1f4;return function(_0x1cac92){logger[_0xcd9d('0x29')](_0x1cac92[_0xcd9d('0x39')]);if(_0x1cac92[_0xcd9d('0x3a')]){delete _0x1cac92[_0xcd9d('0x3a')];}_0x1bd2e8[_0xcd9d('0x2e')](_0x13553c)[_0xcd9d('0x3b')](_0x1cac92);};}exports[_0xcd9d('0x3c')]=function(_0x3a815d,_0x52cb2c){var _0x2f6eff={},_0x383c1d={},_0x5630c7={'count':0x0,'rows':[]};var _0x56c864=_[_0xcd9d('0x3d')](db['OpenchannelMessage']['rawAttributes'],function(_0x31c5ea){return{'name':_0x31c5ea[_0xcd9d('0x3e')],'type':_0x31c5ea[_0xcd9d('0x3f')][_0xcd9d('0x40')]};});_0x383c1d['model']=_[_0xcd9d('0x3d')](_0x56c864,_0xcd9d('0x3a'));_0x383c1d['query']=_[_0xcd9d('0x41')](_0x3a815d[_0xcd9d('0x42')]);_0x383c1d[_0xcd9d('0x43')]=_[_0xcd9d('0x44')](_0x383c1d['model'],_0x383c1d['query']);_0x2f6eff[_0xcd9d('0x45')]=_['intersection'](_0x383c1d[_0xcd9d('0x46')],qs[_0xcd9d('0x47')](_0x3a815d[_0xcd9d('0x42')]['fields']));_0x2f6eff[_0xcd9d('0x45')]=_0x2f6eff[_0xcd9d('0x45')][_0xcd9d('0x48')]?_0x2f6eff[_0xcd9d('0x45')]:_0x383c1d[_0xcd9d('0x46')];if(!_0x3a815d[_0xcd9d('0x42')][_0xcd9d('0x49')](_0xcd9d('0x4a'))){_0x2f6eff[_0xcd9d('0x32')]=qs[_0xcd9d('0x32')](_0x3a815d[_0xcd9d('0x42')]['limit']);_0x2f6eff['offset']=qs['offset'](_0x3a815d[_0xcd9d('0x42')][_0xcd9d('0x31')]);}_0x2f6eff[_0xcd9d('0x4b')]=qs['sort'](_0x3a815d[_0xcd9d('0x42')][_0xcd9d('0x4c')]);_0x2f6eff['where']=qs[_0xcd9d('0x43')](_['pick'](_0x3a815d[_0xcd9d('0x42')],_0x383c1d[_0xcd9d('0x43')]),_0x56c864);if(_0x3a815d['query']['filter']){_0x2f6eff[_0xcd9d('0x4d')]=_[_0xcd9d('0x4e')](_0x2f6eff[_0xcd9d('0x4d')],{'$or':_[_0xcd9d('0x3d')](_0x56c864,function(_0x2dea79){if(_0x2dea79[_0xcd9d('0x3f')]!=='VIRTUAL'){var _0x5f1401={};_0x5f1401[_0x2dea79['name']]={'$like':'%'+_0x3a815d[_0xcd9d('0x42')][_0xcd9d('0x4f')]+'%'};return _0x5f1401;}})});}_0x2f6eff=_['merge']({},_0x2f6eff,_0x3a815d[_0xcd9d('0x50')]);var _0x3cf390={'where':_0x2f6eff[_0xcd9d('0x4d')]};return db[_0xcd9d('0x51')][_0xcd9d('0x30')](_0x3cf390)[_0xcd9d('0x22')](function(_0x253729){_0x5630c7[_0xcd9d('0x30')]=_0x253729;if(_0x3a815d[_0xcd9d('0x42')][_0xcd9d('0x52')]){_0x2f6eff['include']=[{'all':!![]}];}return db[_0xcd9d('0x51')][_0xcd9d('0x53')](_0x2f6eff);})[_0xcd9d('0x22')](function(_0x2b927c){_0x5630c7[_0xcd9d('0x54')]=_0x2b927c;return _0x5630c7;})[_0xcd9d('0x22')](respondWithFilteredResult(_0x52cb2c,_0x2f6eff))[_0xcd9d('0x2c')](handleError(_0x52cb2c,null));};exports[_0xcd9d('0x55')]=function(_0x5a1c79,_0xb6276){var _0x308c01={'raw':!![],'where':{'id':_0x5a1c79['params']['id']}},_0x46a5d6={};_0x46a5d6[_0xcd9d('0x46')]=_[_0xcd9d('0x41')](db[_0xcd9d('0x51')][_0xcd9d('0x56')]);_0x46a5d6[_0xcd9d('0x42')]=_[_0xcd9d('0x41')](_0x5a1c79[_0xcd9d('0x42')]);_0x46a5d6[_0xcd9d('0x43')]=_['intersection'](_0x46a5d6[_0xcd9d('0x46')],_0x46a5d6[_0xcd9d('0x42')]);_0x308c01[_0xcd9d('0x45')]=_[_0xcd9d('0x44')](_0x46a5d6['model'],qs[_0xcd9d('0x47')](_0x5a1c79[_0xcd9d('0x42')][_0xcd9d('0x47')]));_0x308c01[_0xcd9d('0x45')]=_0x308c01['attributes'][_0xcd9d('0x48')]?_0x308c01[_0xcd9d('0x45')]:_0x46a5d6[_0xcd9d('0x46')];if(_0x5a1c79[_0xcd9d('0x42')][_0xcd9d('0x52')]){_0x308c01['include']=[{'all':!![]}];}_0x308c01=_[_0xcd9d('0x4e')]({},_0x308c01,_0x5a1c79[_0xcd9d('0x50')]);return db['OpenchannelMessage'][_0xcd9d('0x57')](_0x308c01)[_0xcd9d('0x22')](handleEntityNotFound(_0xb6276,null))['then'](respondWithResult(_0xb6276,null))[_0xcd9d('0x2c')](handleError(_0xb6276,null));};exports[_0xcd9d('0x58')]=function(_0x28f4bd,_0x4193bb){return db[_0xcd9d('0x51')][_0xcd9d('0x58')](_0x28f4bd['body'],{})['then'](respondWithResult(_0x4193bb,0xc9))['catch'](handleError(_0x4193bb,null));};exports[_0xcd9d('0x37')]=function(_0x372bce,_0x36ab7d){if(_0x372bce['body']['id']){delete _0x372bce[_0xcd9d('0x59')]['id'];}return db[_0xcd9d('0x51')]['find']({'where':{'id':_0x372bce[_0xcd9d('0x5a')]['id']}})[_0xcd9d('0x22')](handleEntityNotFound(_0x36ab7d,null))[_0xcd9d('0x22')](saveUpdates(_0x372bce['body'],null))[_0xcd9d('0x22')](respondWithResult(_0x36ab7d,null))[_0xcd9d('0x2c')](handleError(_0x36ab7d,null));};exports['destroy']=function(_0x167135,_0x5af756){return db[_0xcd9d('0x51')][_0xcd9d('0x57')]({'where':{'id':_0x167135[_0xcd9d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5af756,null))[_0xcd9d('0x22')](removeEntity(_0x5af756,null))[_0xcd9d('0x2c')](handleError(_0x5af756,null));};exports[_0xcd9d('0x5b')]=function(_0x3b77d2,_0xbd5461){return db[_0xcd9d('0x51')][_0xcd9d('0x5b')]()[_0xcd9d('0x22')](respondWithResult(_0xbd5461,null))[_0xcd9d('0x2c')](handleError(_0xbd5461,null));};var interaction_log=require('../../config/logger')(_0xcd9d('0x5c'));exports[_0xcd9d('0x5d')]=function(_0x303584,_0x5e6052,_0x1be86e){var _0x282048={'channel':_0xcd9d('0x5e')};if(_0x303584[_0xcd9d('0x59')]['id']){delete _0x303584[_0xcd9d('0x59')]['id'];}_0x303584[_0xcd9d('0x59')]['read']=!![];_0x303584['body'][_0xcd9d('0x5f')]=moment()[_0xcd9d('0x60')](_0xcd9d('0x61'));_0x303584[_0xcd9d('0x59')][_0xcd9d('0x62')]=_0x303584['body'][_0xcd9d('0x62')]||_0x303584['user']['id'];return db[_0xcd9d('0x51')]['find']({'where':{'id':_0x303584[_0xcd9d('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xcd9d('0x63')}]})[_0xcd9d('0x22')](handleEntityNotFound(_0x5e6052,null))['then'](saveUpdates(_0x303584[_0xcd9d('0x59')],null))['then'](function(_0xfa1be9){if(_0xfa1be9){_0x282048[_0xcd9d('0x2a')]=_0xfa1be9['get']({'plain':!![]});return db[_0xcd9d('0x64')][_0xcd9d('0x57')]({'where':{'id':_0xfa1be9[_0xcd9d('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x5e6052,null))[_0xcd9d('0x22')](function(_0x521e27){if(_0x521e27){return _0x521e27['update']({'UserId':_0x303584[_0xcd9d('0x59')][_0xcd9d('0x62')],'read1stAt':_[_0xcd9d('0x66')](_0x521e27['read1stAt'])?moment()[_0xcd9d('0x60')](_0xcd9d('0x61')):undefined});}return null;})[_0xcd9d('0x22')](function(_0x26cad2){if(_0x26cad2){_0x282048[_0xcd9d('0x67')]=_0x26cad2[_0xcd9d('0x68')]({'plain':!![]});interaction_log['info'](_0xcd9d('0x69'),_0x303584[_0xcd9d('0x6a')]['id'],_0x303584['user'][_0xcd9d('0x3a')],_0x303584['user'][_0xcd9d('0x6b')],_0x282048[_0xcd9d('0x67')]['id'],_0x303584[_0xcd9d('0x59')]?JSON[_0xcd9d('0x28')](_0x303584[_0xcd9d('0x59')]):_0xcd9d('0x6c'));return respondWithRpcPromise(_0xcd9d('0x6d'),_0xcd9d('0x6e'),_0x282048);}return null;})[_0xcd9d('0x22')](function(_0x4a16f8){if(_0x4a16f8){if(_0x303584[_0xcd9d('0x59')]['manual']){_0x282048[_0xcd9d('0x2a')][_0xcd9d('0x6f')]=util[_0xcd9d('0x60')](_0xcd9d('0x70'),_0x303584[_0xcd9d('0x6a')]['name']);_0x282048[_0xcd9d('0x2a')][_0xcd9d('0x71')]=_0x282048[_0xcd9d('0x71')];_0x282048[_0xcd9d('0x2a')][_0xcd9d('0x72')]='accept';return respondWithRpcPromise('EventManager',_0xcd9d('0x73'),{'event':'acceptmessage','message':_0x282048[_0xcd9d('0x2a')]},client9002)[_0xcd9d('0x22')](function(){return _0x282048;});}return _0x282048;}return null;})['then'](respondWithResult(_0x5e6052,null))[_0xcd9d('0x2c')](handleError(_0x5e6052,null));};var interaction_log=require(_0xcd9d('0x16'))(_0xcd9d('0x5c'));exports[_0xcd9d('0x35')]=function(_0x5e9b80,_0x52b1bc,_0x565ee7){var _0x4b42ae={'agent':{},'channel':'openchannel'};if(_0x5e9b80[_0xcd9d('0x59')]['id']){delete _0x5e9b80['body']['id'];}_0x5e9b80[_0xcd9d('0x59')][_0xcd9d('0x62')]=_0x5e9b80[_0xcd9d('0x59')][_0xcd9d('0x62')]||_0x5e9b80[_0xcd9d('0x6a')]['id'];_0x4b42ae[_0xcd9d('0x74')]['id']=_0x5e9b80['body'][_0xcd9d('0x62')];return db[_0xcd9d('0x51')][_0xcd9d('0x57')]({'where':{'id':_0x5e9b80['params']['id'],'UserId':null}})[_0xcd9d('0x22')](handleEntityNotFound(_0x52b1bc,null))[_0xcd9d('0x22')](function(_0x28be95){if(_0x28be95){_0x4b42ae['message']=_0x28be95[_0xcd9d('0x68')]({'plain':!![]});return db['OpenchannelInteraction'][_0xcd9d('0x57')]({'where':{'id':_0x28be95[_0xcd9d('0x65')]}});}return null;})[_0xcd9d('0x22')](handleEntityNotFound(_0x52b1bc,null))[_0xcd9d('0x22')](function(_0x2eefbc){if(_0x2eefbc){_0x4b42ae[_0xcd9d('0x67')]=_0x2eefbc[_0xcd9d('0x68')]({'plain':!![]});interaction_log[_0xcd9d('0x23')](_0xcd9d('0x75'),_0x5e9b80[_0xcd9d('0x6a')]['id'],_0x5e9b80['user']['name'],_0x5e9b80[_0xcd9d('0x6a')][_0xcd9d('0x6b')],_0x4b42ae[_0xcd9d('0x67')]['id'],_0x5e9b80[_0xcd9d('0x59')]?JSON['stringify'](_0x5e9b80['body']):'null');return respondWithRpcPromise(_0xcd9d('0x76'),'rejectMessage',_0x4b42ae);}return null;})[_0xcd9d('0x22')](function(_0xe82822){if(_0xe82822){_0xe82822[_0xcd9d('0x2a')][_0xcd9d('0x6f')]=util[_0xcd9d('0x60')](_0xcd9d('0x70'),_0x5e9b80[_0xcd9d('0x6a')][_0xcd9d('0x3a')]);_0xe82822[_0xcd9d('0x2a')][_0xcd9d('0x71')]=_0x4b42ae['channel'];_0xe82822[_0xcd9d('0x2a')][_0xcd9d('0x72')]=_0xcd9d('0x35');respondWithRpcPromise(_0xcd9d('0x73'),_0xcd9d('0x73'),{'event':_0xcd9d('0x77'),'message':_0xe82822[_0xcd9d('0x2a')]},client9002);return _0x4b42ae;}return null;})[_0xcd9d('0x22')](respondWithResult(_0x52b1bc,null))[_0xcd9d('0x2c')](handleError(_0x52b1bc,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index c7316fd..12d3b34 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 _0x0c6d=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hook'];(function(_0x34794e,_0x37753c){var _0x1ea14a=function(_0xfd9548){while(--_0xfd9548){_0x34794e['push'](_0x34794e['shift']());}};_0x1ea14a(++_0x37753c);}(_0x0c6d,0x1e9));var _0xd0c6=function(_0x22f048,_0x4119e9){_0x22f048=_0x22f048-0x0;var _0x2a9370=_0x0c6d[_0x22f048];return _0x2a9370;};'use strict';var EventEmitter=require(_0xd0c6('0x0'));var OpenchannelMessage=require(_0xd0c6('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xd0c6('0x2')](0x0);var events={'afterCreate':_0xd0c6('0x3'),'afterUpdate':'update','afterDestroy':_0xd0c6('0x4')};function emitEvent(_0x250969){return function(_0x55b3ca,_0x40b6f5,_0x25d5cd){OpenchannelMessageEvents[_0xd0c6('0x5')](_0x250969+':'+_0x55b3ca['id'],_0x55b3ca);OpenchannelMessageEvents['emit'](_0x250969,_0x55b3ca);_0x25d5cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xd0c6('0x6')](e,emitEvent(event));}}module[_0xd0c6('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xfd97=['../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5cbb51,_0x3c2086){var _0x489f77=function(_0x1cbd7d){while(--_0x1cbd7d){_0x5cbb51['push'](_0x5cbb51['shift']());}};_0x489f77(++_0x3c2086);}(_0xfd97,0xa9));var _0x7fd9=function(_0x127a3c,_0xd22972){_0x127a3c=_0x127a3c-0x0;var _0x5a999b=_0xfd97[_0x127a3c];return _0x5a999b;};'use strict';var EventEmitter=require(_0x7fd9('0x0'));var OpenchannelMessage=require(_0x7fd9('0x1'))['db'][_0x7fd9('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7fd9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7fd9('0x4'),'afterDestroy':_0x7fd9('0x5')};function emitEvent(_0x2b493c){return function(_0x5c4a08,_0x37cddd,_0x5ea896){OpenchannelMessageEvents[_0x7fd9('0x6')](_0x2b493c+':'+_0x5c4a08['id'],_0x5c4a08);OpenchannelMessageEvents[_0x7fd9('0x6')](_0x2b493c,_0x5c4a08);_0x5ea896(null);};}for(var e in events){if(events[_0x7fd9('0x7')](e)){var event=events[e];OpenchannelMessage[_0x7fd9('0x8')](e,emitEvent(event));}}module[_0x7fd9('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index c63f63a..46a618b 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 _0xd70f=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','models','get','direction','toLowerCase','secret','isNil','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteractionId','keys','replyUri','info','afterCreate','format','Interactions','length','Interaction','Contact','POST','method','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelMessage,\x20%s,\x20%s','inspect'];(function(_0x4deff,_0x42c328){var _0x440123=function(_0x2d7dde){while(--_0x2d7dde){_0x4deff['push'](_0x4deff['shift']());}};_0x440123(++_0x42c328);}(_0xd70f,0xc2));var _0xfd70=function(_0x1389a4,_0x3f411d){_0x1389a4=_0x1389a4-0x0;var _0x44b4c9=_0xd70f[_0x1389a4];return _0x44b4c9;};'use strict';var _=require(_0xfd70('0x0'));var util=require(_0xfd70('0x1'));var logger=require(_0xfd70('0x2'))('api');var moment=require(_0xfd70('0x3'));var BPromise=require(_0xfd70('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfd70('0x5'));var config=require(_0xfd70('0x6'));var attributes=require(_0xfd70('0x7'));module[_0xfd70('0x8')]=function(_0x2b97ec,_0x47c50f){return _0x2b97ec[_0xfd70('0x9')]('OpenchannelMessage',attributes,{'tableName':_0xfd70('0xa'),'paranoid':![],'indexes':[{'name':_0xfd70('0xb'),'fields':[_0xfd70('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31ac4e,_0x1196d4,_0x78708b){var _0x2a0b5b=_0x2b97ec[_0xfd70('0xd')];var _0x81124=_0x31ac4e[_0xfd70('0xe')]({'plain':!![]});if(_0x81124[_0xfd70('0xf')]['toLowerCase']()==='in'||_0x81124[_0xfd70('0xf')][_0xfd70('0x10')]()==='out'&&!_0x81124[_0xfd70('0x11')]&&!_[_0xfd70('0x12')](_0x81124['UserId'])){_0x2a0b5b[_0xfd70('0x13')][_0xfd70('0x14')]({'where':{'id':_0x81124['OpenchannelInteractionId']}})[_0xfd70('0x15')](function(_0x50b387){if(_0x50b387){_0x50b387[_0xfd70('0x16')]({'lastMsgAt':_0x81124[_0xfd70('0x17')],'lastMsgDirection':_0x81124[_0xfd70('0xf')][_0xfd70('0x10')]()});}})[_0xfd70('0x18')](function(_0x5cb32a){console[_0xfd70('0x19')](_0x5cb32a);});}if(_0x81124['direction']==='out'&&!_0x81124[_0xfd70('0x11')]){var _0x45ac18;_0x2a0b5b[_0xfd70('0x1a')][_0xfd70('0x1b')]()['then'](function(_0x397df2){return _0x2a0b5b[_0xfd70('0x1c')]['find']({'where':{'id':_0x81124[_0xfd70('0x1d')]},'include':[{'model':_0x2a0b5b[_0xfd70('0x13')],'as':'Interactions','where':{'id':_0x81124[_0xfd70('0x1e')]},'limit':0x1,'include':[{'model':_0x2a0b5b[_0xfd70('0x1a')],'as':'Contact','attributes':_[_0xfd70('0x1f')](_0x397df2)}]}]});})['then'](function(_0xd24edd){_0x45ac18=_0xd24edd[_0xfd70('0xe')]({'plain':!![]});if(_0x45ac18&&_0x45ac18[_0xfd70('0x20')]){logger[_0xfd70('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0xfd70('0x22'),util[_0xfd70('0x23')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x81124['id'],_0x45ac18['replyUri']));if(_0x45ac18['Interactions']&&_0x45ac18[_0xfd70('0x24')][_0xfd70('0x25')]){_0x81124[_0xfd70('0x26')]=_['omit'](_0x45ac18[_0xfd70('0x24')][0x0],'Contact');_0x81124[_0xfd70('0x27')]=_0x45ac18[_0xfd70('0x24')][0x0][_0xfd70('0x27')];}var _0x1196d4={'method':_0xfd70('0x28'),'uri':encodeURI(_0x45ac18['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1196d4[_0xfd70('0x29')]){case'GET':_0x1196d4['qs']=_0x81124;break;case'POST':_0x1196d4[_0xfd70('0xc')]=_0x81124;break;}return rp(_0x1196d4)[_0xfd70('0x15')](function(_0xe43279){logger[_0xfd70('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0xfd70('0x22'),util[_0xfd70('0x23')](_0xfd70('0x2a'),_0x81124['id'],_0x45ac18['replyUri']));if(_0xe43279['body'][_0xfd70('0x2b')]&&_0xe43279['body'][_0xfd70('0x2b')]!=_0x81124[_0xfd70('0x26')]['threadId']){return _0x2a0b5b[_0xfd70('0x13')][_0xfd70('0x16')]({'threadId':_0xe43279[_0xfd70('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x81124[_0xfd70('0x26')]['id']}});}else{return;}})[_0xfd70('0x15')](function(){return _0x31ac4e[_0xfd70('0x16')]({'read':!![]});})['catch'](function(_0x1fb955){logger[_0xfd70('0x19')](_0xfd70('0x2c'),_0xfd70('0x22'),util[_0xfd70('0x2d')](_0x1fb955,{'showHidden':![],'depth':null}));_0x78708b();});}else{_0x78708b();}})['finally'](function(){_0x78708b();});}else{_0x78708b();}}},'charset':_0xfd70('0x2e'),'collate':_0xfd70('0x2f')});}; \ No newline at end of file +var _0xa96b=['error','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','POST','method','body','then','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','fti_openchannel_messages','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','createdAt'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0xa96b,0x17f));var _0xba96=function(_0x5927bc,_0x53c55c){_0x5927bc=_0x5927bc-0x0;var _0xfffd95=_0xa96b[_0x5927bc];return _0xfffd95;};'use strict';var _=require(_0xba96('0x0'));var util=require(_0xba96('0x1'));var logger=require(_0xba96('0x2'))(_0xba96('0x3'));var moment=require(_0xba96('0x4'));var BPromise=require('bluebird');var rp=require(_0xba96('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba96('0x6'));var config=require(_0xba96('0x7'));var attributes=require(_0xba96('0x8'));module['exports']=function(_0x20b0fd,_0x182f0f){return _0x20b0fd[_0xba96('0x9')](_0xba96('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xba96('0xb'),'fields':['body'],'type':_0xba96('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x160682,_0x19cdbe,_0x5c8cb8){var _0x45c019=_0x20b0fd[_0xba96('0xd')];var _0x459597=_0x160682[_0xba96('0xe')]({'plain':!![]});if(_0x459597['direction'][_0xba96('0xf')]()==='in'||_0x459597[_0xba96('0x10')][_0xba96('0xf')]()===_0xba96('0x11')&&!_0x459597[_0xba96('0x12')]&&!_['isNil'](_0x459597[_0xba96('0x13')])){_0x45c019[_0xba96('0x14')][_0xba96('0x15')]({'where':{'id':_0x459597[_0xba96('0x16')]}})['then'](function(_0x5ee063){if(_0x5ee063){_0x5ee063[_0xba96('0x17')]({'lastMsgAt':_0x459597[_0xba96('0x18')],'lastMsgDirection':_0x459597[_0xba96('0x10')][_0xba96('0xf')]()});}})['catch'](function(_0x21f031){console[_0xba96('0x19')](_0x21f031);});}if(_0x459597[_0xba96('0x10')]===_0xba96('0x11')&&!_0x459597[_0xba96('0x12')]){var _0x431c27;_0x45c019['CmContact'][_0xba96('0x1a')]()['then'](function(_0x26e903){return _0x45c019[_0xba96('0x1b')][_0xba96('0x1c')]({'where':{'id':_0x459597[_0xba96('0x1d')]},'include':[{'model':_0x45c019['OpenchannelInteraction'],'as':_0xba96('0x1e'),'where':{'id':_0x459597[_0xba96('0x16')]},'limit':0x1,'include':[{'model':_0x45c019[_0xba96('0x1f')],'as':_0xba96('0x20'),'attributes':_['keys'](_0x26e903)}]}]});})['then'](function(_0x55df39){_0x431c27=_0x55df39[_0xba96('0xe')]({'plain':!![]});if(_0x431c27&&_0x431c27[_0xba96('0x21')]){logger[_0xba96('0x22')](_0xba96('0x23'),_0xba96('0x24'),util[_0xba96('0x25')](_0xba96('0x26'),_0x459597['id'],_0x431c27[_0xba96('0x21')]));if(_0x431c27['Interactions']&&_0x431c27[_0xba96('0x1e')][_0xba96('0x27')]){_0x459597['Interaction']=_['omit'](_0x431c27['Interactions'][0x0],_0xba96('0x20'));_0x459597['Contact']=_0x431c27[_0xba96('0x1e')][0x0][_0xba96('0x20')];}var _0x19cdbe={'method':_0xba96('0x28'),'uri':encodeURI(_0x431c27[_0xba96('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x19cdbe[_0xba96('0x29')]){case'GET':_0x19cdbe['qs']=_0x459597;break;case _0xba96('0x28'):_0x19cdbe[_0xba96('0x2a')]=_0x459597;break;}return rp(_0x19cdbe)[_0xba96('0x2b')](function(_0x12ce37){logger[_0xba96('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0xba96('0x24'),util[_0xba96('0x25')](_0xba96('0x2c'),_0x459597['id'],_0x431c27[_0xba96('0x21')]));if(_0x12ce37[_0xba96('0x2a')][_0xba96('0x2d')]&&_0x12ce37[_0xba96('0x2a')]['threadId']!=_0x459597[_0xba96('0x2e')][_0xba96('0x2d')]){return _0x45c019[_0xba96('0x14')][_0xba96('0x17')]({'threadId':_0x12ce37['body'][_0xba96('0x2d')]},{'logging':!![],'where':{'id':_0x459597[_0xba96('0x2e')]['id']}});}else{return;}})[_0xba96('0x2b')](function(){return _0x160682[_0xba96('0x17')]({'read':!![]});})['catch'](function(_0x179911){logger[_0xba96('0x19')](_0xba96('0x23'),_0xba96('0x24'),util[_0xba96('0x2f')](_0x179911,{'showHidden':![],'depth':null}));_0x5c8cb8();});}else{_0x5c8cb8();}})[_0xba96('0x30')](function(){_0x5c8cb8();});}else{_0x5c8cb8();}}},'charset':_0xba96('0x31'),'collate':_0xba96('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 387f005..56a7f97 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(_0x100170,_0xcf84b1){var _0x336f68=function(_0x4ba174){while(--_0x4ba174){_0x100170['push'](_0x100170['shift']());}};_0x336f68(++_0xcf84b1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56c4bc,_0x1cfb34){_0x56c4bc=_0x56c4bc-0x0;var _0xa0ae69=_0x5f2f[_0x56c4bc];return _0xa0ae69;};'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 _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x12d509,_0xdf9b7f){var _0x17d827=function(_0xdeb9ac){while(--_0xdeb9ac){_0x12d509['push'](_0x12d509['shift']());}};_0x17d827(++_0xdf9b7f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 1eb5d42..1424bf0 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 _0xe706=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x170b0b,_0x4aa600){var _0x33cd22=function(_0x35263c){while(--_0x35263c){_0x170b0b['push'](_0x170b0b['shift']());}};_0x33cd22(++_0x4aa600);}(_0xe706,0xa3));var _0x6e70=function(_0x36f47e,_0x1d85cd){_0x36f47e=_0x36f47e-0x0;var _0x4e6a98=_0xe706[_0x36f47e];return _0x4e6a98;};'use strict';var OpenchannelMessageEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelMessageEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelMessageEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file +var _0xb43b=['./openchannelMessage.events','save','update','emit','removeListener','length','openchannelMessage:'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5be3f7,_0x122e30){_0x5be3f7=_0x5be3f7-0x0;var _0x2a882a=_0xb43b[_0x5be3f7];return _0x2a882a;};'use strict';var OpenchannelMessageEvents=require(_0xbb43('0x0'));var events=[_0xbb43('0x1'),'remove',_0xbb43('0x2')];function createListener(_0x1995f8,_0x22bc86){return function(_0x4cf605){_0x22bc86[_0xbb43('0x3')](_0x1995f8,_0x4cf605);};}function removeListener(_0x41aff6,_0x351254){return function(){OpenchannelMessageEvents[_0xbb43('0x4')](_0x41aff6,_0x351254);};}exports['register']=function(_0x491fb9){for(var _0x378df5=0x0,_0x553520=events[_0xbb43('0x5')];_0x378df5<_0x553520;_0x378df5++){var _0x1ccd49=events[_0x378df5];var _0x2a2f11=createListener(_0xbb43('0x6')+_0x1ccd49,_0x491fb9);OpenchannelMessageEvents['on'](_0x1ccd49,_0x2a2f11);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c3e7f25..93ab24f 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 _0x891b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy','removeTeams','removeAgents','exports','path','connect-timeout','Router'];(function(_0x2986de,_0x18bb71){var _0xf3238f=function(_0xf3f61a){while(--_0xf3f61a){_0x2986de['push'](_0x2986de['shift']());}};_0xf3238f(++_0x18bb71);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb891('0x0'));var timeout=require(_0xb891('0x1'));var express=require('express');var router=express[_0xb891('0x2')]();var auth=require(_0xb891('0x3'));var interaction=require(_0xb891('0x4'));var config=require(_0xb891('0x5'));var controller=require('./openchannelQueue.controller');router[_0xb891('0x6')]('/',auth[_0xb891('0x7')](),controller['index']);router[_0xb891('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb891('0x6')](_0xb891('0x8'),auth[_0xb891('0x7')](),controller[_0xb891('0x9')]);router[_0xb891('0x6')](_0xb891('0xa'),auth[_0xb891('0x7')](),controller['getMembers']);router[_0xb891('0x6')](_0xb891('0xb'),auth[_0xb891('0x7')](),controller[_0xb891('0xc')]);router[_0xb891('0x6')](_0xb891('0xd'),auth[_0xb891('0x7')](),controller[_0xb891('0xe')]);router[_0xb891('0xf')]('/',auth[_0xb891('0x7')](),controller[_0xb891('0x10')]);router['post'](_0xb891('0xb'),auth[_0xb891('0x7')](),controller[_0xb891('0x11')]);router['post'](_0xb891('0xd'),auth[_0xb891('0x7')](),controller['addAgents']);router[_0xb891('0x12')]('/:id',auth[_0xb891('0x7')](),controller[_0xb891('0x13')]);router[_0xb891('0x14')](_0xb891('0x8'),auth[_0xb891('0x7')](),controller[_0xb891('0x15')]);router['delete']('/:id/teams',auth[_0xb891('0x7')](),controller[_0xb891('0x16')]);router[_0xb891('0x14')](_0xb891('0xd'),auth[_0xb891('0x7')](),controller[_0xb891('0x17')]);module[_0xb891('0x18')]=router; \ No newline at end of file +var _0xa6bb=['/:id/members','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','/:id','removeTeams','delete','removeAgents','exports','util','path','connect-timeout','express','Router','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x4400f7,_0xe6e042){var _0x158216=function(_0x1b7e14){while(--_0x1b7e14){_0x4400f7['push'](_0x4400f7['shift']());}};_0x158216(++_0xe6e042);}(_0xa6bb,0x12c));var _0xba6b=function(_0xa5a2b4,_0x936502){_0xa5a2b4=_0xa5a2b4-0x0;var _0xff79bf=_0xa6bb[_0xa5a2b4];return _0xff79bf;};'use strict';var multer=require('multer');var util=require(_0xba6b('0x0'));var path=require(_0xba6b('0x1'));var timeout=require(_0xba6b('0x2'));var express=require(_0xba6b('0x3'));var router=express[_0xba6b('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xba6b('0x5'));var controller=require(_0xba6b('0x6'));router[_0xba6b('0x7')]('/',auth[_0xba6b('0x8')](),controller['index']);router['get'](_0xba6b('0x9'),auth[_0xba6b('0x8')](),controller[_0xba6b('0xa')]);router['get']('/:id',auth[_0xba6b('0x8')](),controller[_0xba6b('0xb')]);router[_0xba6b('0x7')](_0xba6b('0xc'),auth[_0xba6b('0x8')](),controller['getMembers']);router[_0xba6b('0x7')](_0xba6b('0xd'),auth[_0xba6b('0x8')](),controller['getTeams']);router[_0xba6b('0x7')](_0xba6b('0xe'),auth[_0xba6b('0x8')](),controller[_0xba6b('0xf')]);router['post']('/',auth[_0xba6b('0x8')](),controller['create']);router[_0xba6b('0x10')](_0xba6b('0xd'),auth[_0xba6b('0x8')](),controller[_0xba6b('0x11')]);router[_0xba6b('0x10')]('/:id/users',auth[_0xba6b('0x8')](),controller[_0xba6b('0x12')]);router['put'](_0xba6b('0x13'),auth[_0xba6b('0x8')](),controller['update']);router['delete'](_0xba6b('0x13'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xba6b('0x14')]);router[_0xba6b('0x15')](_0xba6b('0xe'),auth[_0xba6b('0x8')](),controller[_0xba6b('0x16')]);module[_0xba6b('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9a7ad3f..8d985ea 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 _0x811d=['INTEGER','roundrobin','sequelize','exports','STRING','name'];(function(_0x500d3a,_0x57ded9){var _0x17e4a8=function(_0x83e988){while(--_0x83e988){_0x500d3a['push'](_0x500d3a['shift']());}};_0x17e4a8(++_0x57ded9);}(_0x811d,0xb6));var _0xd811=function(_0x501c77,_0x4ab0e5){_0x501c77=_0x501c77-0x0;var _0x5265eb=_0x811d[_0x501c77];return _0x5265eb;};'use strict';var Sequelize=require(_0xd811('0x0'));module[_0xd811('0x1')]={'name':{'type':Sequelize[_0xd811('0x2')],'unique':_0xd811('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd811('0x2')]},'timeout':{'type':Sequelize[_0xd811('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0xd811('0x5'))}}; \ No newline at end of file +var _0x4815=['STRING','name','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x16ff97,_0x3a5cc8){var _0x272a5c=function(_0xaa9878){while(--_0xaa9878){_0x16ff97['push'](_0x16ff97['shift']());}};_0x272a5c(++_0x3a5cc8);}(_0x4815,0x1f1));var _0x5481=function(_0x3f75be,_0x38bc4b){_0x3f75be=_0x3f75be-0x0;var _0x4469ae=_0x4815[_0x3f75be];return _0x4469ae;};'use strict';var Sequelize=require(_0x5481('0x0'));module['exports']={'name':{'type':Sequelize[_0x5481('0x1')],'unique':_0x5481('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5481('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5481('0x3')](_0x5481('0x4'),'beepall',_0x5481('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 1a9b42f..f48c988 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 _0x6826=['where','merge','type','include','findAll','catch','show','params','includeAll','options','find','create','body','get','role','user','OpenchannelQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserOpenchannelQueue','length','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','spread','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','end','json','count','offset','limit','status','set','Content-Range','apply','reject','then','destroy','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x6c2d27,_0x511e6a){var _0x3a3a70=function(_0x15e3ab){while(--_0x15e3ab){_0x6c2d27['push'](_0x6c2d27['shift']());}};_0x3a3a70(++_0x511e6a);}(_0x6826,0x167));var _0x6682=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0x6826[_0x35485a];return _0x5148e6;};'use strict';var pdf=require(_0x6682('0x0'));var emlformat=require(_0x6682('0x1'));var rimraf=require(_0x6682('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6682('0x3'));var rp=require(_0x6682('0x4'));var moment=require(_0x6682('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6682('0x6'));var util=require('util');var path=require(_0x6682('0x7'));var sox=require(_0x6682('0x8'));var csv=require('to-csv');var ejs=require(_0x6682('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6682('0xa'));var jsforce=require(_0x6682('0xb'));var deskjs=require(_0x6682('0xc'));var toCsv=require(_0x6682('0xd'));var querystring=require(_0x6682('0xe'));var Papa=require('papaparse');var Redis=require(_0x6682('0xf'));var authService=require(_0x6682('0x10'));var qs=require(_0x6682('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6682('0x12'));var logger=require(_0x6682('0x13'))(_0x6682('0x14'));var utils=require(_0x6682('0x15'));var config=require(_0x6682('0x16'));var licenseUtil=require(_0x6682('0x17'));var db=require(_0x6682('0x18'))['db'];config[_0x6682('0x19')]=_['defaults'](config[_0x6682('0x19')],{'host':_0x6682('0x1a'),'port':0x18eb});var socket=require(_0x6682('0x1b'))(new Redis(config[_0x6682('0x19')]));require(_0x6682('0x1c'))['register'](socket);function respondWithStatusCode(_0x5a7d63,_0x497a34){_0x497a34=_0x497a34||0xcc;return function(_0x11b7d2){if(_0x11b7d2){return _0x5a7d63['sendStatus'](_0x497a34);}return _0x5a7d63['status'](_0x497a34)[_0x6682('0x1d')]();};}function respondWithResult(_0x1afc9d,_0x18be1e){_0x18be1e=_0x18be1e||0xc8;return function(_0x411654){if(_0x411654){return _0x1afc9d['status'](_0x18be1e)[_0x6682('0x1e')](_0x411654);}};}function respondWithFilteredResult(_0x1d71a9,_0x4c1afa){return function(_0x36d44f){if(_0x36d44f){var _0x1fc56b=_0x36d44f[_0x6682('0x1f')],_0x29fc0b=_0x4c1afa['offset'],_0x384c31=_0x4c1afa[_0x6682('0x20')]+_0x4c1afa[_0x6682('0x21')],_0x1e1995;if(_0x384c31>=_0x1fc56b){_0x384c31=_0x1fc56b;_0x1e1995=0xc8;}else{_0x1e1995=0xce;}_0x1d71a9[_0x6682('0x22')](_0x1e1995);return _0x1d71a9[_0x6682('0x23')](_0x6682('0x24'),_0x29fc0b+'-'+_0x384c31+'/'+_0x1fc56b)[_0x6682('0x1e')](_0x36d44f);}return null;};}function patchUpdates(_0x43ff21){return function(_0x590889){try{jsonpatch[_0x6682('0x25')](_0x590889,_0x43ff21,!![]);}catch(_0x56fbee){return BPromise[_0x6682('0x26')](_0x56fbee);}return _0x590889['save']();};}function saveUpdates(_0x237a28,_0x3c4ca7){return function(_0x2c8ff1){if(_0x2c8ff1){return _0x2c8ff1['update'](_0x237a28)[_0x6682('0x27')](function(_0x2eec82){return _0x2eec82;});}return null;};}function removeEntity(_0x4c8d46,_0x3cc70f){return function(_0x2354df){if(_0x2354df){return _0x2354df[_0x6682('0x28')]()[_0x6682('0x27')](function(){var _0x646395=_0x2354df['get']({'plain':!![]});var _0x45dc34='OpenchannelQueues';return db[_0x6682('0x29')]['destroy']({'where':{'type':_0x45dc34,'resourceId':_0x646395['id']}})[_0x6682('0x27')](function(){return _0x2354df;});})['then'](function(){_0x4c8d46[_0x6682('0x22')](0xcc)[_0x6682('0x1d')]();});}};}function handleEntityNotFound(_0x2e32b2,_0x2e80e2){return function(_0x211090){if(!_0x211090){_0x2e32b2['sendStatus'](0x194);}return _0x211090;};}function handleError(_0x433710,_0x1866ec){_0x1866ec=_0x1866ec||0x1f4;return function(_0x5ae968){logger[_0x6682('0x2a')](_0x5ae968['stack']);if(_0x5ae968['name']){delete _0x5ae968[_0x6682('0x2b')];}_0x433710[_0x6682('0x22')](_0x1866ec)[_0x6682('0x2c')](_0x5ae968);};}exports[_0x6682('0x2d')]=function(_0x493a88,_0x2fbb3e){var _0x238169={},_0x331cce={},_0x33b949={'count':0x0,'rows':[]};var _0x5b0138=_[_0x6682('0x2e')](db[_0x6682('0x2f')][_0x6682('0x30')],function(_0x101244){return{'name':_0x101244[_0x6682('0x31')],'type':_0x101244['type'][_0x6682('0x32')]};});_0x331cce[_0x6682('0x33')]=_[_0x6682('0x2e')](_0x5b0138,_0x6682('0x2b'));_0x331cce['query']=_[_0x6682('0x34')](_0x493a88[_0x6682('0x35')]);_0x331cce[_0x6682('0x36')]=_[_0x6682('0x37')](_0x331cce[_0x6682('0x33')],_0x331cce[_0x6682('0x35')]);_0x238169[_0x6682('0x38')]=_[_0x6682('0x37')](_0x331cce[_0x6682('0x33')],qs[_0x6682('0x39')](_0x493a88[_0x6682('0x35')]['fields']));_0x238169[_0x6682('0x38')]=_0x238169[_0x6682('0x38')]['length']?_0x238169[_0x6682('0x38')]:_0x331cce[_0x6682('0x33')];if(!_0x493a88[_0x6682('0x35')][_0x6682('0x3a')](_0x6682('0x3b'))){_0x238169[_0x6682('0x21')]=qs['limit'](_0x493a88['query'][_0x6682('0x21')]);_0x238169[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x493a88[_0x6682('0x35')]['offset']);}_0x238169[_0x6682('0x3c')]=qs['sort'](_0x493a88[_0x6682('0x35')][_0x6682('0x3d')]);_0x238169['where']=qs[_0x6682('0x36')](_[_0x6682('0x3e')](_0x493a88[_0x6682('0x35')],_0x331cce[_0x6682('0x36')]),_0x5b0138);if(_0x493a88['query'][_0x6682('0x3f')]){_0x238169[_0x6682('0x40')]=_[_0x6682('0x41')](_0x238169[_0x6682('0x40')],{'$or':_[_0x6682('0x2e')](_0x5b0138,function(_0x3700ca){if(_0x3700ca[_0x6682('0x42')]!=='VIRTUAL'){var _0x2daa28={};_0x2daa28[_0x3700ca[_0x6682('0x2b')]]={'$like':'%'+_0x493a88['query'][_0x6682('0x3f')]+'%'};return _0x2daa28;}})});}_0x238169=_[_0x6682('0x41')]({},_0x238169,_0x493a88['options']);var _0x3b33b2={'where':_0x238169[_0x6682('0x40')]};return db[_0x6682('0x2f')]['count'](_0x3b33b2)[_0x6682('0x27')](function(_0xecc587){_0x33b949[_0x6682('0x1f')]=_0xecc587;if(_0x493a88[_0x6682('0x35')]['includeAll']){_0x238169[_0x6682('0x43')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x6682('0x44')](_0x238169);})[_0x6682('0x27')](function(_0x433268){_0x33b949['rows']=_0x433268;return _0x33b949;})[_0x6682('0x27')](respondWithFilteredResult(_0x2fbb3e,_0x238169))[_0x6682('0x45')](handleError(_0x2fbb3e,null));};exports[_0x6682('0x46')]=function(_0x2f48e5,_0x965bde){var _0x18324d={'raw':!![],'where':{'id':_0x2f48e5[_0x6682('0x47')]['id']}},_0x4b26b3={};_0x4b26b3['model']=_[_0x6682('0x34')](db['OpenchannelQueue'][_0x6682('0x30')]);_0x4b26b3[_0x6682('0x35')]=_['keys'](_0x2f48e5['query']);_0x4b26b3[_0x6682('0x36')]=_[_0x6682('0x37')](_0x4b26b3[_0x6682('0x33')],_0x4b26b3[_0x6682('0x35')]);_0x18324d['attributes']=_['intersection'](_0x4b26b3['model'],qs[_0x6682('0x39')](_0x2f48e5[_0x6682('0x35')][_0x6682('0x39')]));_0x18324d[_0x6682('0x38')]=_0x18324d[_0x6682('0x38')]['length']?_0x18324d['attributes']:_0x4b26b3['model'];if(_0x2f48e5['query'][_0x6682('0x48')]){_0x18324d[_0x6682('0x43')]=[{'all':!![]}];}_0x18324d=_['merge']({},_0x18324d,_0x2f48e5[_0x6682('0x49')]);return db[_0x6682('0x2f')][_0x6682('0x4a')](_0x18324d)['then'](handleEntityNotFound(_0x965bde,null))[_0x6682('0x27')](respondWithResult(_0x965bde,null))[_0x6682('0x45')](handleError(_0x965bde,null));};exports['create']=function(_0xe0fa63,_0x45625a){return db[_0x6682('0x2f')][_0x6682('0x4b')](_0xe0fa63[_0x6682('0x4c')],{})[_0x6682('0x27')](function(_0x40b49c){var _0x38987d=_0xe0fa63['user'][_0x6682('0x4d')]({'plain':!![]});if(!_0x38987d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38987d[_0x6682('0x4e')]===_0x6682('0x4f')){var _0xefe7ba=_0x40b49c[_0x6682('0x4d')]({'plain':!![]});var _0x27ed79=_0x6682('0x50');return db[_0x6682('0x51')][_0x6682('0x4a')]({'where':{'name':_0x27ed79,'userProfileId':_0x38987d['userProfileId']},'raw':!![]})[_0x6682('0x27')](function(_0x4f66f4){if(_0x4f66f4&&_0x4f66f4[_0x6682('0x52')]===0x0){return db[_0x6682('0x29')]['create']({'name':_0xefe7ba['name'],'resourceId':_0xefe7ba['id'],'type':_0x4f66f4[_0x6682('0x2b')],'sectionId':_0x4f66f4['id']},{})[_0x6682('0x27')](function(){return _0x40b49c;});}else{return _0x40b49c;}})['catch'](function(_0x26adee){logger['error'](_0x6682('0x53'),_0x26adee);throw _0x26adee;});}return _0x40b49c;})[_0x6682('0x27')](respondWithResult(_0x45625a,0xc9))[_0x6682('0x45')](handleError(_0x45625a,null));};exports[_0x6682('0x54')]=function(_0x3d8794,_0x18709c){if(_0x3d8794['body']['id']){delete _0x3d8794[_0x6682('0x4c')]['id'];}return db[_0x6682('0x2f')][_0x6682('0x4a')]({'where':{'id':_0x3d8794['params']['id']}})[_0x6682('0x27')](handleEntityNotFound(_0x18709c,null))[_0x6682('0x27')](saveUpdates(_0x3d8794['body'],null))['then'](respondWithResult(_0x18709c,null))['catch'](handleError(_0x18709c,null));};exports[_0x6682('0x28')]=function(_0x370c41,_0x32c74b){return db['OpenchannelQueue']['find']({'where':{'id':_0x370c41['params']['id']}})[_0x6682('0x27')](handleEntityNotFound(_0x32c74b,null))[_0x6682('0x27')](removeEntity(_0x32c74b,null))[_0x6682('0x45')](handleError(_0x32c74b,null));};exports[_0x6682('0x55')]=function(_0x557acf,_0x3a095a){return db[_0x6682('0x2f')][_0x6682('0x55')]()[_0x6682('0x27')](respondWithResult(_0x3a095a,null))['catch'](handleError(_0x3a095a,null));};exports[_0x6682('0x56')]=function(_0x295bb5,_0x4039bc,_0x283c9e){var _0x51effc={'raw':!![],'where':{}},_0x21c954={},_0x387267;return db[_0x6682('0x2f')][_0x6682('0x57')]({'where':{'id':_0x295bb5[_0x6682('0x47')]['id']}})['then'](handleEntityNotFound(_0x4039bc,null))[_0x6682('0x27')](function(_0x193519){if(_0x193519){_0x387267=_0x193519[_0x6682('0x4d')]({'plain':!![]});_0x21c954[_0x6682('0x33')]=_[_0x6682('0x34')](db[_0x6682('0x58')][_0x6682('0x30')]);_0x21c954[_0x6682('0x35')]=_[_0x6682('0x34')](_0x295bb5['query']);_0x21c954[_0x6682('0x36')]=_[_0x6682('0x37')](_0x21c954[_0x6682('0x33')],_0x21c954[_0x6682('0x35')]);_0x51effc['attributes']=_[_0x6682('0x37')](_0x21c954[_0x6682('0x33')],qs[_0x6682('0x39')](_0x295bb5['query'][_0x6682('0x39')]));_0x51effc['attributes']=_0x51effc[_0x6682('0x38')][_0x6682('0x59')]?_0x51effc[_0x6682('0x38')]:_0x21c954[_0x6682('0x33')];if(!_0x295bb5[_0x6682('0x35')][_0x6682('0x3a')]('nolimit')){_0x51effc[_0x6682('0x21')]=qs[_0x6682('0x21')](_0x295bb5[_0x6682('0x35')][_0x6682('0x21')]);_0x51effc[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x295bb5[_0x6682('0x35')]['offset']);}_0x51effc[_0x6682('0x3c')]=qs[_0x6682('0x3d')](_0x295bb5[_0x6682('0x35')][_0x6682('0x3d')]);_0x51effc[_0x6682('0x40')]=qs[_0x6682('0x36')](_[_0x6682('0x3e')](_0x295bb5['query'],_0x21c954['filters']));_0x51effc['where'][_0x6682('0x5a')]=_0x193519['id'];if(_0x295bb5[_0x6682('0x35')][_0x6682('0x3f')]){_0x51effc[_0x6682('0x40')]=_['merge'](_0x51effc['where'],{'$or':_[_0x6682('0x2e')](_0x51effc['attributes'],function(_0x31e13c){var _0x3160c0={};_0x3160c0[_0x31e13c]={'$like':'%'+_0x295bb5[_0x6682('0x35')]['filter']+'%'};return _0x3160c0;})});}_0x51effc=_['merge']({},_0x51effc,_0x295bb5[_0x6682('0x49')]);return db[_0x6682('0x58')][_0x6682('0x44')](_0x51effc);}})['then'](function(_0x536744){if(_0x536744){return db[_0x6682('0x5b')][_0x6682('0x5c')]({'where':{'id':_[_0x6682('0x2e')](_0x536744,_0x6682('0x5d')),'role':_0x6682('0x5e')},'attributes':['id','name',_0x6682('0x5f'),_0x6682('0x60'),_0x6682('0x61')]});}})[_0x6682('0x27')](function(_0x43092d){if(_0x43092d){return{'count':_0x43092d[_0x6682('0x1f')],'rows':_[_0x6682('0x2e')](_0x43092d[_0x6682('0x62')],function(_0x451b75){return{'membername':_0x451b75[_0x6682('0x2b')],'UserId':_0x451b75['id'],'queue_name':_0x387267[_0x6682('0x2b')],'OpenchannelQueueId':_0x387267['id'],'interface':util[_0x6682('0x63')](_0x6682('0x64'),_0x6682('0x65'),_0x451b75[_0x6682('0x2b')]),'penalty':0x0,'paused':_0x451b75[_0x6682('0x5f')],'createdAt':_0x451b75[_0x6682('0x61')],'updatedAt':_0x451b75['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6682('0x27')](respondWithFilteredResult(_0x4039bc,_0x51effc))[_0x6682('0x45')](handleError(_0x4039bc,null));};exports[_0x6682('0x66')]=function(_0x1d94ea,_0x86af71,_0x127887){var _0x17ccca={};var _0x422f8e={};var _0x6c2383;var _0x586350;return db[_0x6682('0x2f')][_0x6682('0x57')]({'where':{'id':_0x1d94ea[_0x6682('0x47')]['id']}})[_0x6682('0x27')](handleEntityNotFound(_0x86af71,null))['then'](function(_0x148ef6){if(_0x148ef6){_0x6c2383=_0x148ef6;_0x422f8e['model']=_[_0x6682('0x34')](db[_0x6682('0x67')][_0x6682('0x30')]);_0x422f8e[_0x6682('0x35')]=_[_0x6682('0x34')](_0x1d94ea[_0x6682('0x35')]);_0x422f8e[_0x6682('0x36')]=_[_0x6682('0x37')](_0x422f8e[_0x6682('0x33')],_0x422f8e[_0x6682('0x35')]);_0x17ccca[_0x6682('0x38')]=_[_0x6682('0x37')](_0x422f8e[_0x6682('0x33')],qs[_0x6682('0x39')](_0x1d94ea[_0x6682('0x35')]['fields']));_0x17ccca[_0x6682('0x38')]=_0x17ccca[_0x6682('0x38')]['length']?_0x17ccca[_0x6682('0x38')]:_0x422f8e[_0x6682('0x33')];_0x17ccca[_0x6682('0x3c')]=qs[_0x6682('0x3d')](_0x1d94ea['query'][_0x6682('0x3d')]);_0x17ccca[_0x6682('0x40')]=qs[_0x6682('0x36')](_[_0x6682('0x3e')](_0x1d94ea[_0x6682('0x35')],_0x422f8e[_0x6682('0x36')]));if(_0x1d94ea[_0x6682('0x35')][_0x6682('0x3f')]){_0x17ccca[_0x6682('0x40')]=_[_0x6682('0x41')](_0x17ccca['where'],{'$or':_['map'](_0x17ccca[_0x6682('0x38')],function(_0x1ab543){var _0x570ad8={};_0x570ad8[_0x1ab543]={'$like':'%'+_0x1d94ea['query']['filter']+'%'};return _0x570ad8;})});}_0x17ccca=_[_0x6682('0x41')]({},_0x17ccca,_0x1d94ea[_0x6682('0x49')]);return _0x6c2383[_0x6682('0x66')](_0x17ccca);}})[_0x6682('0x27')](function(_0x3de3be){if(_0x3de3be){_0x586350=_0x3de3be[_0x6682('0x59')];if(!_0x1d94ea[_0x6682('0x35')][_0x6682('0x3a')](_0x6682('0x3b'))){_0x17ccca[_0x6682('0x21')]=qs[_0x6682('0x21')](_0x1d94ea[_0x6682('0x35')][_0x6682('0x21')]);_0x17ccca[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x1d94ea[_0x6682('0x35')]['offset']);}return _0x6c2383['getTeams'](_0x17ccca);}})[_0x6682('0x27')](function(_0x408f7c){if(_0x408f7c){return _0x408f7c?{'count':_0x586350,'rows':_0x408f7c}:null;}})['then'](respondWithResult(_0x86af71,null))[_0x6682('0x45')](handleError(_0x86af71,null));};exports[_0x6682('0x68')]=function(_0x3f9152,_0x5135e1,_0xa41990){var _0xa41513=_0x3f9152[_0x6682('0x4c')][_0x6682('0x69')];return db[_0x6682('0x67')]['findAll']({'where':{'id':_0xa41513},'attributes':['id'],'include':[{'model':db[_0x6682('0x5b')],'as':_0x6682('0x6a'),'attributes':['id',_0x6682('0x2b'),_0x6682('0x6b'),'voicePause',_0x6682('0x6c')],'raw':!![]}]})[_0x6682('0x27')](function(_0x4ff971){if(_0x4ff971){var _0x16378f=_[_0x6682('0x6d')](_0x4ff971,function(_0x1b8858){var _0x37a120=_0x1b8858['get']({'plain':!![]});return _0x37a120[_0x6682('0x6a')];});return db['OpenchannelQueue'][_0x6682('0x4a')]({'where':{'id':_0x3f9152[_0x6682('0x47')]['id']}})[_0x6682('0x27')](function(_0x415b26){return db['sequelize'][_0x6682('0x6e')](function(_0x3a6a9c){return _0x415b26[_0x6682('0x68')](_0xa41513,{'transaction':_0x3a6a9c})[_0x6682('0x27')](function(){return BPromise[_0x6682('0x6f')](_0x16378f,function(_0x2d2ec6){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x2d2ec6['id'],'OpenchannelQueueId':_0x3f9152[_0x6682('0x47')]['id']},'transaction':_0x3a6a9c});});})['then'](function(){_0x16378f[_0x6682('0x70')](function(_0x316c51){socket[_0x6682('0x71')](_0x6682('0x72'),{'UserId':_0x316c51['id'],'OpenchannelQueueId':_0x415b26['id']});});});});});}})['then'](respondWithStatusCode(_0x5135e1,null))[_0x6682('0x45')](handleError(_0x5135e1,null));};exports[_0x6682('0x73')]=function(_0x5c97fe,_0x44c465,_0x15e1dc){return db[_0x6682('0x67')][_0x6682('0x44')]({'where':{'id':_0x5c97fe[_0x6682('0x35')][_0x6682('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6682('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x6682('0x27')](handleEntityNotFound(_0x44c465,null))[_0x6682('0x27')](function(_0x429e64){var _0x58e6fc=_[_0x6682('0x2e')](_0x429e64,'id');var _0x3811eb=[];var _0x3bdd74=[];var _0x4c5401=squel[_0x6682('0x74')]();_0x4c5401[_0x6682('0x75')](_0x6682('0x76'))[_0x6682('0x77')](_0x6682('0x78'),'tq')[_0x6682('0x79')](_0x6682('0x7a'),'ut',_0x6682('0x7b'))[_0x6682('0x40')](_0x6682('0x7c'),_0x5c97fe[_0x6682('0x47')]['id']);for(var _0x9baac3=0x0;_0x9baac3<_0x429e64['length'];_0x9baac3+=0x1){let _0x3dee11=_0x429e64[_0x9baac3];for(var _0x5724c2=0x0;_0x5724c2<_0x3dee11[_0x6682('0x6a')][_0x6682('0x59')];_0x5724c2+=0x1){let _0x2fd7a7=_0x3dee11[_0x6682('0x6a')][_0x5724c2];var _0x578f98=_0x4c5401['clone']();_0x578f98[_0x6682('0x40')](_0x6682('0x7d'),_0x2fd7a7['id']);_0x3bdd74['push'](db[_0x6682('0x7e')]['query'](_0x578f98['toString'](),{'type':db[_0x6682('0x7e')][_0x6682('0x7f')][_0x6682('0x80')]})[_0x6682('0x27')](function(_0x3d8ca8){if(_0x3d8ca8[_0x6682('0x59')]===0x1){return _0x2fd7a7['id'];}else{var _0x48289c=_[_0x6682('0x81')](_[_0x6682('0x2e')](_0x3d8ca8,'TeamId'),function(_0xc1b5f){return _[_0x6682('0x82')](_0x58e6fc,_0xc1b5f);});if(_0x48289c){return _0x2fd7a7['id'];}}}));}}return BPromise[_0x6682('0x83')](_0x3bdd74)[_0x6682('0x27')](function(_0x5073bf){_0x3811eb=_(_0x3811eb)[_0x6682('0x84')](_0x5073bf)[_0x6682('0x85')]()[_0x6682('0x86')]();return db['OpenchannelQueue'][_0x6682('0x4a')]({'where':{'id':_0x5c97fe[_0x6682('0x47')]['id']}})['then'](function(_0x30f861){return db[_0x6682('0x7e')][_0x6682('0x6e')](function(_0x1c21e1){return _0x30f861['removeTeams'](_0x5c97fe[_0x6682('0x35')][_0x6682('0x69')],{'transaction':_0x1c21e1})['then'](function(){if(!_[_0x6682('0x87')](_0x3811eb)){return _0x30f861[_0x6682('0x88')](_0x3811eb,{'transaction':_0x1c21e1});}})[_0x6682('0x27')](function(){_0x3811eb[_0x6682('0x70')](function(_0x6a4349){socket[_0x6682('0x71')](_0x6682('0x89'),{'UserId':_0x6a4349,'OpenchannelQueueId':_0x30f861['id']});});});});});});})[_0x6682('0x27')](respondWithStatusCode(_0x44c465,null))[_0x6682('0x45')](handleError(_0x44c465,null));};exports[_0x6682('0x8a')]=function(_0x49d40b,_0x414b62,_0x41cae7){return db['OpenchannelQueue'][_0x6682('0x4a')]({'where':{'id':_0x49d40b[_0x6682('0x47')]['id']}})[_0x6682('0x27')](handleEntityNotFound(_0x414b62,null))[_0x6682('0x27')](function(_0x57052e){if(_0x57052e){return _0x57052e[_0x6682('0x8a')](_0x49d40b[_0x6682('0x4c')][_0x6682('0x69')],_['omit'](_0x49d40b[_0x6682('0x4c')],[_0x6682('0x69'),'id'])||{})[_0x6682('0x8b')](function(_0x1040bc){for(var _0x4e7919=0x0;_0x4e7919<_0x49d40b[_0x6682('0x4c')]['ids'][_0x6682('0x59')];_0x4e7919+=0x1){socket[_0x6682('0x71')](_0x6682('0x72'),{'UserId':_0x49d40b['body'][_0x6682('0x69')][_0x4e7919],'OpenchannelQueueId':_0x49d40b[_0x6682('0x47')]['id']});}return _0x1040bc;});}})[_0x6682('0x27')](respondWithResult(_0x414b62,null))[_0x6682('0x45')](handleError(_0x414b62,null));};exports[_0x6682('0x88')]=function(_0x36bb26,_0x50aed6,_0x3f535d){return db['OpenchannelQueue'][_0x6682('0x4a')]({'where':{'id':_0x36bb26[_0x6682('0x47')]['id']}})[_0x6682('0x27')](handleEntityNotFound(_0x50aed6,null))[_0x6682('0x27')](function(_0x3ae3a5){if(_0x3ae3a5){return _0x3ae3a5[_0x6682('0x88')](_0x36bb26[_0x6682('0x35')][_0x6682('0x69')])[_0x6682('0x27')](function(){if(_['isArray'](_0x36bb26[_0x6682('0x35')][_0x6682('0x69')])){for(var _0x221dd8=0x0;_0x221dd8<_0x36bb26[_0x6682('0x35')][_0x6682('0x69')][_0x6682('0x59')];_0x221dd8+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x36bb26[_0x6682('0x35')][_0x6682('0x69')][_0x221dd8]),'OpenchannelQueueId':Number(_0x36bb26['params']['id'])});}}else{socket[_0x6682('0x71')](_0x6682('0x89'),{'UserId':Number(_0x36bb26[_0x6682('0x35')][_0x6682('0x69')]),'OpenchannelQueueId':Number(_0x36bb26['params']['id'])});}});}})[_0x6682('0x27')](respondWithStatusCode(_0x50aed6,null))[_0x6682('0x45')](handleError(_0x50aed6,null));};exports['getAgents']=function(_0x5be60d,_0x3f2244,_0x4e6220){var _0x2b6300={};var _0x324ba2={};var _0x3e0b3c;var _0x42557f;return db['OpenchannelQueue'][_0x6682('0x57')]({'where':{'id':_0x5be60d[_0x6682('0x47')]['id']}})[_0x6682('0x27')](handleEntityNotFound(_0x3f2244,null))[_0x6682('0x27')](function(_0x2c24a7){if(_0x2c24a7){_0x3e0b3c=_0x2c24a7;_0x324ba2[_0x6682('0x33')]=_[_0x6682('0x34')](db[_0x6682('0x5b')][_0x6682('0x30')]);_0x324ba2[_0x6682('0x35')]=_[_0x6682('0x34')](_0x5be60d[_0x6682('0x35')]);_0x324ba2[_0x6682('0x36')]=_['intersection'](_0x324ba2[_0x6682('0x33')],_0x324ba2[_0x6682('0x35')]);_0x2b6300[_0x6682('0x38')]=_['intersection'](_0x324ba2[_0x6682('0x33')],qs[_0x6682('0x39')](_0x5be60d[_0x6682('0x35')][_0x6682('0x39')]));_0x2b6300['attributes']=_0x2b6300[_0x6682('0x38')]['length']?_0x2b6300[_0x6682('0x38')]:_0x324ba2[_0x6682('0x33')];_0x2b6300['order']=qs['sort'](_0x5be60d[_0x6682('0x35')][_0x6682('0x3d')]);_0x2b6300[_0x6682('0x40')]=qs['filters'](_[_0x6682('0x3e')](_0x5be60d[_0x6682('0x35')],_0x324ba2[_0x6682('0x36')]));if(_0x5be60d[_0x6682('0x35')][_0x6682('0x3f')]){_0x2b6300[_0x6682('0x40')]=_[_0x6682('0x41')](_0x2b6300[_0x6682('0x40')],{'$or':_[_0x6682('0x2e')](_0x2b6300[_0x6682('0x38')],function(_0x26ab93){var _0x48fb03={};_0x48fb03[_0x26ab93]={'$like':'%'+_0x5be60d[_0x6682('0x35')][_0x6682('0x3f')]+'%'};return _0x48fb03;})});}_0x2b6300=_[_0x6682('0x41')]({},_0x2b6300,_0x5be60d[_0x6682('0x49')]);return _0x3e0b3c[_0x6682('0x8c')](_0x2b6300);}})[_0x6682('0x27')](function(_0x23939e){if(_0x23939e){_0x42557f=_0x23939e[_0x6682('0x59')];if(!_0x5be60d[_0x6682('0x35')][_0x6682('0x3a')](_0x6682('0x3b'))){_0x2b6300[_0x6682('0x21')]=qs['limit'](_0x5be60d['query'][_0x6682('0x21')]);_0x2b6300[_0x6682('0x20')]=qs[_0x6682('0x20')](_0x5be60d[_0x6682('0x35')][_0x6682('0x20')]);}return _0x3e0b3c[_0x6682('0x8c')](_0x2b6300);}})[_0x6682('0x27')](function(_0x1d19e8){if(_0x1d19e8){return _0x1d19e8?{'count':_0x42557f,'rows':_0x1d19e8}:null;}})[_0x6682('0x27')](respondWithResult(_0x3f2244,null))[_0x6682('0x45')](handleError(_0x3f2244,null));}; \ No newline at end of file +var _0x065c=['ids','Team','Agents','interface','flatMap','sequelize','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','apply','update','then','UserProfileResource','destroy','end','error','stack','name','map','OpenchannelQueue','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','get','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','SIP','getTeams','addTeams'];(function(_0x28509b,_0x5831ff){var _0x1e0b6=function(_0x37d8a2){while(--_0x37d8a2){_0x28509b['push'](_0x28509b['shift']());}};_0x1e0b6(++_0x5831ff);}(_0x065c,0xa9));var _0xc065=function(_0x173113,_0x316a7c){_0x173113=_0x173113-0x0;var _0x3bea89=_0x065c[_0x173113];return _0x3bea89;};'use strict';var pdf=require(_0xc065('0x0'));var emlformat=require(_0xc065('0x1'));var rimraf=require(_0xc065('0x2'));var zipdir=require(_0xc065('0x3'));var jsonpatch=require(_0xc065('0x4'));var rp=require(_0xc065('0x5'));var moment=require(_0xc065('0x6'));var BPromise=require(_0xc065('0x7'));var Mustache=require(_0xc065('0x8'));var util=require(_0xc065('0x9'));var path=require(_0xc065('0xa'));var sox=require(_0xc065('0xb'));var csv=require(_0xc065('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc065('0xd'));var crypto=require(_0xc065('0xe'));var jsforce=require(_0xc065('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc065('0x10'));var Redis=require(_0xc065('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc065('0x12'));var as=require(_0xc065('0x13'));var hardwareService=require(_0xc065('0x14'));var logger=require('../../config/logger')(_0xc065('0x15'));var utils=require(_0xc065('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc065('0x17'));var db=require(_0xc065('0x18'))['db'];config[_0xc065('0x19')]=_['defaults'](config[_0xc065('0x19')],{'host':_0xc065('0x1a'),'port':0x18eb});var socket=require(_0xc065('0x1b'))(new Redis(config[_0xc065('0x19')]));require(_0xc065('0x1c'))[_0xc065('0x1d')](socket);function respondWithStatusCode(_0x177bb5,_0x84d888){_0x84d888=_0x84d888||0xcc;return function(_0x4c50a2){if(_0x4c50a2){return _0x177bb5[_0xc065('0x1e')](_0x84d888);}return _0x177bb5[_0xc065('0x1f')](_0x84d888)['end']();};}function respondWithResult(_0x4a7c02,_0x26cf0e){_0x26cf0e=_0x26cf0e||0xc8;return function(_0x34dcf9){if(_0x34dcf9){return _0x4a7c02[_0xc065('0x1f')](_0x26cf0e)['json'](_0x34dcf9);}};}function respondWithFilteredResult(_0x8502aa,_0x391f3e){return function(_0x27cf59){if(_0x27cf59){var _0x5863b8=_0x27cf59[_0xc065('0x20')],_0x58276c=_0x391f3e['offset'],_0xd9ce9e=_0x391f3e[_0xc065('0x21')]+_0x391f3e[_0xc065('0x22')],_0x2e7c04;if(_0xd9ce9e>=_0x5863b8){_0xd9ce9e=_0x5863b8;_0x2e7c04=0xc8;}else{_0x2e7c04=0xce;}_0x8502aa[_0xc065('0x1f')](_0x2e7c04);return _0x8502aa[_0xc065('0x23')](_0xc065('0x24'),_0x58276c+'-'+_0xd9ce9e+'/'+_0x5863b8)['json'](_0x27cf59);}return null;};}function patchUpdates(_0x393601){return function(_0x44e2ed){try{jsonpatch[_0xc065('0x25')](_0x44e2ed,_0x393601,!![]);}catch(_0x144f1b){return BPromise['reject'](_0x144f1b);}return _0x44e2ed['save']();};}function saveUpdates(_0x3306fc,_0x54a91c){return function(_0x5af6db){if(_0x5af6db){return _0x5af6db[_0xc065('0x26')](_0x3306fc)[_0xc065('0x27')](function(_0x423598){return _0x423598;});}return null;};}function removeEntity(_0x146f36,_0x4d3595){return function(_0x417946){if(_0x417946){return _0x417946['destroy']()['then'](function(){var _0x258499=_0x417946['get']({'plain':!![]});var _0x49d101='OpenchannelQueues';return db[_0xc065('0x28')][_0xc065('0x29')]({'where':{'type':_0x49d101,'resourceId':_0x258499['id']}})[_0xc065('0x27')](function(){return _0x417946;});})[_0xc065('0x27')](function(){_0x146f36[_0xc065('0x1f')](0xcc)[_0xc065('0x2a')]();});}};}function handleEntityNotFound(_0x14c4d0,_0x429795){return function(_0x48fd6a){if(!_0x48fd6a){_0x14c4d0[_0xc065('0x1e')](0x194);}return _0x48fd6a;};}function handleError(_0x3f2cad,_0x2b94b1){_0x2b94b1=_0x2b94b1||0x1f4;return function(_0x10908c){logger[_0xc065('0x2b')](_0x10908c[_0xc065('0x2c')]);if(_0x10908c[_0xc065('0x2d')]){delete _0x10908c[_0xc065('0x2d')];}_0x3f2cad['status'](_0x2b94b1)['send'](_0x10908c);};}exports['index']=function(_0x544b4c,_0x31f223){var _0x58c001={},_0x10bf08={},_0x1745bc={'count':0x0,'rows':[]};var _0x37c2ac=_[_0xc065('0x2e')](db[_0xc065('0x2f')]['rawAttributes'],function(_0x19b845){return{'name':_0x19b845['fieldName'],'type':_0x19b845[_0xc065('0x30')]['key']};});_0x10bf08['model']=_[_0xc065('0x2e')](_0x37c2ac,'name');_0x10bf08[_0xc065('0x31')]=_[_0xc065('0x32')](_0x544b4c[_0xc065('0x31')]);_0x10bf08[_0xc065('0x33')]=_['intersection'](_0x10bf08['model'],_0x10bf08[_0xc065('0x31')]);_0x58c001['attributes']=_[_0xc065('0x34')](_0x10bf08[_0xc065('0x35')],qs[_0xc065('0x36')](_0x544b4c['query'][_0xc065('0x36')]));_0x58c001['attributes']=_0x58c001[_0xc065('0x37')]['length']?_0x58c001[_0xc065('0x37')]:_0x10bf08[_0xc065('0x35')];if(!_0x544b4c[_0xc065('0x31')][_0xc065('0x38')]('nolimit')){_0x58c001['limit']=qs[_0xc065('0x22')](_0x544b4c[_0xc065('0x31')][_0xc065('0x22')]);_0x58c001['offset']=qs['offset'](_0x544b4c['query'][_0xc065('0x21')]);}_0x58c001[_0xc065('0x39')]=qs[_0xc065('0x3a')](_0x544b4c[_0xc065('0x31')][_0xc065('0x3a')]);_0x58c001[_0xc065('0x3b')]=qs[_0xc065('0x33')](_[_0xc065('0x3c')](_0x544b4c[_0xc065('0x31')],_0x10bf08['filters']),_0x37c2ac);if(_0x544b4c[_0xc065('0x31')]['filter']){_0x58c001[_0xc065('0x3b')]=_[_0xc065('0x3d')](_0x58c001['where'],{'$or':_[_0xc065('0x2e')](_0x37c2ac,function(_0x106e55){if(_0x106e55[_0xc065('0x30')]!==_0xc065('0x3e')){var _0x4a36c3={};_0x4a36c3[_0x106e55[_0xc065('0x2d')]]={'$like':'%'+_0x544b4c[_0xc065('0x31')][_0xc065('0x3f')]+'%'};return _0x4a36c3;}})});}_0x58c001=_[_0xc065('0x3d')]({},_0x58c001,_0x544b4c['options']);var _0x2bb06f={'where':_0x58c001['where']};return db[_0xc065('0x2f')][_0xc065('0x20')](_0x2bb06f)[_0xc065('0x27')](function(_0xeefe3d){_0x1745bc[_0xc065('0x20')]=_0xeefe3d;if(_0x544b4c[_0xc065('0x31')][_0xc065('0x40')]){_0x58c001[_0xc065('0x41')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0xc065('0x42')](_0x58c001);})[_0xc065('0x27')](function(_0x3eb2c1){_0x1745bc[_0xc065('0x43')]=_0x3eb2c1;return _0x1745bc;})['then'](respondWithFilteredResult(_0x31f223,_0x58c001))[_0xc065('0x44')](handleError(_0x31f223,null));};exports[_0xc065('0x45')]=function(_0x12f259,_0x59c18d){var _0x40ee91={'raw':!![],'where':{'id':_0x12f259[_0xc065('0x46')]['id']}},_0x35804d={};_0x35804d[_0xc065('0x35')]=_[_0xc065('0x32')](db[_0xc065('0x2f')][_0xc065('0x47')]);_0x35804d[_0xc065('0x31')]=_['keys'](_0x12f259['query']);_0x35804d['filters']=_[_0xc065('0x34')](_0x35804d[_0xc065('0x35')],_0x35804d['query']);_0x40ee91[_0xc065('0x37')]=_['intersection'](_0x35804d[_0xc065('0x35')],qs['fields'](_0x12f259[_0xc065('0x31')][_0xc065('0x36')]));_0x40ee91[_0xc065('0x37')]=_0x40ee91[_0xc065('0x37')][_0xc065('0x48')]?_0x40ee91[_0xc065('0x37')]:_0x35804d['model'];if(_0x12f259['query'][_0xc065('0x40')]){_0x40ee91[_0xc065('0x41')]=[{'all':!![]}];}_0x40ee91=_[_0xc065('0x3d')]({},_0x40ee91,_0x12f259[_0xc065('0x49')]);return db[_0xc065('0x2f')][_0xc065('0x4a')](_0x40ee91)['then'](handleEntityNotFound(_0x59c18d,null))[_0xc065('0x27')](respondWithResult(_0x59c18d,null))[_0xc065('0x44')](handleError(_0x59c18d,null));};exports[_0xc065('0x4b')]=function(_0x351410,_0x4cd90d){return db[_0xc065('0x2f')][_0xc065('0x4b')](_0x351410[_0xc065('0x4c')],{})['then'](function(_0x5bf228){var _0x47489a=_0x351410['user']['get']({'plain':!![]});if(!_0x47489a)throw new Error(_0xc065('0x4d'));if(_0x47489a[_0xc065('0x4e')]===_0xc065('0x4f')){var _0x49afa6=_0x5bf228['get']({'plain':!![]});var _0x41f75c=_0xc065('0x50');return db[_0xc065('0x51')][_0xc065('0x4a')]({'where':{'name':_0x41f75c,'userProfileId':_0x47489a[_0xc065('0x52')]},'raw':!![]})[_0xc065('0x27')](function(_0x382881){if(_0x382881&&_0x382881[_0xc065('0x53')]===0x0){return db[_0xc065('0x28')][_0xc065('0x4b')]({'name':_0x49afa6[_0xc065('0x2d')],'resourceId':_0x49afa6['id'],'type':_0x382881[_0xc065('0x2d')],'sectionId':_0x382881['id']},{})[_0xc065('0x27')](function(){return _0x5bf228;});}else{return _0x5bf228;}})[_0xc065('0x44')](function(_0x2b89f7){logger[_0xc065('0x2b')](_0xc065('0x54'),_0x2b89f7);throw _0x2b89f7;});}return _0x5bf228;})['then'](respondWithResult(_0x4cd90d,0xc9))['catch'](handleError(_0x4cd90d,null));};exports[_0xc065('0x26')]=function(_0x35482b,_0x18f03f){if(_0x35482b[_0xc065('0x4c')]['id']){delete _0x35482b[_0xc065('0x4c')]['id'];}return db[_0xc065('0x2f')][_0xc065('0x4a')]({'where':{'id':_0x35482b[_0xc065('0x46')]['id']}})[_0xc065('0x27')](handleEntityNotFound(_0x18f03f,null))[_0xc065('0x27')](saveUpdates(_0x35482b['body'],null))[_0xc065('0x27')](respondWithResult(_0x18f03f,null))[_0xc065('0x44')](handleError(_0x18f03f,null));};exports[_0xc065('0x29')]=function(_0x2e8b18,_0x394cad){return db[_0xc065('0x2f')][_0xc065('0x4a')]({'where':{'id':_0x2e8b18[_0xc065('0x46')]['id']}})[_0xc065('0x27')](handleEntityNotFound(_0x394cad,null))[_0xc065('0x27')](removeEntity(_0x394cad,null))[_0xc065('0x44')](handleError(_0x394cad,null));};exports['describe']=function(_0x20f90a,_0x1263f8){return db['OpenchannelQueue'][_0xc065('0x55')]()[_0xc065('0x27')](respondWithResult(_0x1263f8,null))[_0xc065('0x44')](handleError(_0x1263f8,null));};exports['getMembers']=function(_0x2138e1,_0x4e57b0,_0x395c9a){var _0x440f1e={'raw':!![],'where':{}},_0x612556={},_0x2a34d5;return db[_0xc065('0x2f')][_0xc065('0x56')]({'where':{'id':_0x2138e1['params']['id']}})[_0xc065('0x27')](handleEntityNotFound(_0x4e57b0,null))[_0xc065('0x27')](function(_0x312d9f){if(_0x312d9f){_0x2a34d5=_0x312d9f[_0xc065('0x57')]({'plain':!![]});_0x612556[_0xc065('0x35')]=_[_0xc065('0x32')](db[_0xc065('0x58')][_0xc065('0x47')]);_0x612556[_0xc065('0x31')]=_[_0xc065('0x32')](_0x2138e1[_0xc065('0x31')]);_0x612556[_0xc065('0x33')]=_[_0xc065('0x34')](_0x612556[_0xc065('0x35')],_0x612556[_0xc065('0x31')]);_0x440f1e[_0xc065('0x37')]=_[_0xc065('0x34')](_0x612556['model'],qs[_0xc065('0x36')](_0x2138e1[_0xc065('0x31')]['fields']));_0x440f1e[_0xc065('0x37')]=_0x440f1e['attributes'][_0xc065('0x48')]?_0x440f1e['attributes']:_0x612556[_0xc065('0x35')];if(!_0x2138e1[_0xc065('0x31')][_0xc065('0x38')]('nolimit')){_0x440f1e['limit']=qs[_0xc065('0x22')](_0x2138e1[_0xc065('0x31')][_0xc065('0x22')]);_0x440f1e[_0xc065('0x21')]=qs['offset'](_0x2138e1[_0xc065('0x31')]['offset']);}_0x440f1e[_0xc065('0x39')]=qs['sort'](_0x2138e1['query'][_0xc065('0x3a')]);_0x440f1e['where']=qs[_0xc065('0x33')](_['pick'](_0x2138e1[_0xc065('0x31')],_0x612556[_0xc065('0x33')]));_0x440f1e[_0xc065('0x3b')][_0xc065('0x59')]=_0x312d9f['id'];if(_0x2138e1[_0xc065('0x31')][_0xc065('0x3f')]){_0x440f1e[_0xc065('0x3b')]=_['merge'](_0x440f1e['where'],{'$or':_['map'](_0x440f1e['attributes'],function(_0x4139ea){var _0x363d74={};_0x363d74[_0x4139ea]={'$like':'%'+_0x2138e1[_0xc065('0x31')]['filter']+'%'};return _0x363d74;})});}_0x440f1e=_[_0xc065('0x3d')]({},_0x440f1e,_0x2138e1[_0xc065('0x49')]);return db[_0xc065('0x58')]['findAll'](_0x440f1e);}})[_0xc065('0x27')](function(_0xd947b6){if(_0xd947b6){return db[_0xc065('0x5a')][_0xc065('0x5b')]({'where':{'id':_['map'](_0xd947b6,_0xc065('0x5c')),'role':_0xc065('0x5d')},'attributes':['id',_0xc065('0x2d'),_0xc065('0x5e'),_0xc065('0x5f'),'createdAt']});}})[_0xc065('0x27')](function(_0x40cd26){if(_0x40cd26){return{'count':_0x40cd26[_0xc065('0x20')],'rows':_['map'](_0x40cd26['rows'],function(_0x77a9f7){return{'membername':_0x77a9f7[_0xc065('0x2d')],'UserId':_0x77a9f7['id'],'queue_name':_0x2a34d5[_0xc065('0x2d')],'OpenchannelQueueId':_0x2a34d5['id'],'interface':util['format']('%s/%s',_0xc065('0x60'),_0x77a9f7['name']),'penalty':0x0,'paused':_0x77a9f7[_0xc065('0x5e')],'createdAt':_0x77a9f7['createdAt'],'updatedAt':_0x77a9f7[_0xc065('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc065('0x27')](respondWithFilteredResult(_0x4e57b0,_0x440f1e))[_0xc065('0x44')](handleError(_0x4e57b0,null));};exports[_0xc065('0x61')]=function(_0x539355,_0x223879,_0x2a8fd1){var _0x18954d={};var _0x52ef0f={};var _0x114cf7;var _0x30a44b;return db[_0xc065('0x2f')][_0xc065('0x56')]({'where':{'id':_0x539355[_0xc065('0x46')]['id']}})['then'](handleEntityNotFound(_0x223879,null))[_0xc065('0x27')](function(_0x2306ff){if(_0x2306ff){_0x114cf7=_0x2306ff;_0x52ef0f[_0xc065('0x35')]=_[_0xc065('0x32')](db['Team'][_0xc065('0x47')]);_0x52ef0f[_0xc065('0x31')]=_[_0xc065('0x32')](_0x539355[_0xc065('0x31')]);_0x52ef0f[_0xc065('0x33')]=_['intersection'](_0x52ef0f[_0xc065('0x35')],_0x52ef0f['query']);_0x18954d[_0xc065('0x37')]=_[_0xc065('0x34')](_0x52ef0f[_0xc065('0x35')],qs[_0xc065('0x36')](_0x539355['query']['fields']));_0x18954d[_0xc065('0x37')]=_0x18954d[_0xc065('0x37')]['length']?_0x18954d['attributes']:_0x52ef0f[_0xc065('0x35')];_0x18954d['order']=qs['sort'](_0x539355['query'][_0xc065('0x3a')]);_0x18954d['where']=qs['filters'](_[_0xc065('0x3c')](_0x539355['query'],_0x52ef0f[_0xc065('0x33')]));if(_0x539355[_0xc065('0x31')][_0xc065('0x3f')]){_0x18954d[_0xc065('0x3b')]=_[_0xc065('0x3d')](_0x18954d[_0xc065('0x3b')],{'$or':_[_0xc065('0x2e')](_0x18954d[_0xc065('0x37')],function(_0x1b1e4f){var _0x4a5f18={};_0x4a5f18[_0x1b1e4f]={'$like':'%'+_0x539355[_0xc065('0x31')][_0xc065('0x3f')]+'%'};return _0x4a5f18;})});}_0x18954d=_[_0xc065('0x3d')]({},_0x18954d,_0x539355[_0xc065('0x49')]);return _0x114cf7[_0xc065('0x61')](_0x18954d);}})['then'](function(_0x2ee48f){if(_0x2ee48f){_0x30a44b=_0x2ee48f['length'];if(!_0x539355[_0xc065('0x31')][_0xc065('0x38')]('nolimit')){_0x18954d['limit']=qs[_0xc065('0x22')](_0x539355[_0xc065('0x31')][_0xc065('0x22')]);_0x18954d[_0xc065('0x21')]=qs[_0xc065('0x21')](_0x539355[_0xc065('0x31')][_0xc065('0x21')]);}return _0x114cf7['getTeams'](_0x18954d);}})[_0xc065('0x27')](function(_0x99591c){if(_0x99591c){return _0x99591c?{'count':_0x30a44b,'rows':_0x99591c}:null;}})[_0xc065('0x27')](respondWithResult(_0x223879,null))['catch'](handleError(_0x223879,null));};exports[_0xc065('0x62')]=function(_0x1190cb,_0x23b002,_0x2f4de6){var _0x512cd3=_0x1190cb['body'][_0xc065('0x63')];return db[_0xc065('0x64')][_0xc065('0x42')]({'where':{'id':_0x512cd3},'attributes':['id'],'include':[{'model':db[_0xc065('0x5a')],'as':_0xc065('0x65'),'attributes':['id',_0xc065('0x2d'),'online','voicePause',_0xc065('0x66')],'raw':!![]}]})[_0xc065('0x27')](function(_0x3a0c9e){if(_0x3a0c9e){var _0x5bc0f3=_[_0xc065('0x67')](_0x3a0c9e,function(_0x177fdf){var _0x2cfda3=_0x177fdf[_0xc065('0x57')]({'plain':!![]});return _0x2cfda3['Agents'];});return db[_0xc065('0x2f')][_0xc065('0x4a')]({'where':{'id':_0x1190cb[_0xc065('0x46')]['id']}})[_0xc065('0x27')](function(_0x18a3d9){return db[_0xc065('0x68')]['transaction'](function(_0xa037bd){return _0x18a3d9[_0xc065('0x62')](_0x512cd3,{'transaction':_0xa037bd})[_0xc065('0x27')](function(){return BPromise[_0xc065('0x69')](_0x5bc0f3,function(_0x35719b){return db['UserOpenchannelQueue'][_0xc065('0x6a')]({'where':{'UserId':_0x35719b['id'],'OpenchannelQueueId':_0x1190cb['params']['id']},'transaction':_0xa037bd});});})[_0xc065('0x27')](function(){_0x5bc0f3['forEach'](function(_0x12eaed){socket['emit'](_0xc065('0x6b'),{'UserId':_0x12eaed['id'],'OpenchannelQueueId':_0x18a3d9['id']});});});});});}})[_0xc065('0x27')](respondWithStatusCode(_0x23b002,null))['catch'](handleError(_0x23b002,null));};exports[_0xc065('0x6c')]=function(_0x5ba020,_0x167593,_0x2f0291){return db[_0xc065('0x64')][_0xc065('0x42')]({'where':{'id':_0x5ba020['query'][_0xc065('0x63')]},'attributes':['id'],'include':[{'model':db[_0xc065('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc065('0x27')](handleEntityNotFound(_0x167593,null))['then'](function(_0x170381){var _0x401770=_[_0xc065('0x2e')](_0x170381,'id');var _0x475a14=[];var _0x301a26=[];var _0xd85219=squel[_0xc065('0x6d')]();_0xd85219['field'](_0xc065('0x6e'))[_0xc065('0x6f')](_0xc065('0x70'),'tq')[_0xc065('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xc065('0x3b')](_0xc065('0x72'),_0x5ba020['params']['id']);for(var _0x78ac1c=0x0;_0x78ac1c<_0x170381[_0xc065('0x48')];_0x78ac1c+=0x1){let _0x15ff18=_0x170381[_0x78ac1c];for(var _0x8edb2f=0x0;_0x8edb2f<_0x15ff18[_0xc065('0x65')][_0xc065('0x48')];_0x8edb2f+=0x1){let _0x52c30b=_0x15ff18[_0xc065('0x65')][_0x8edb2f];var _0x35d8be=_0xd85219['clone']();_0x35d8be[_0xc065('0x3b')](_0xc065('0x73'),_0x52c30b['id']);_0x301a26[_0xc065('0x74')](db['sequelize']['query'](_0x35d8be[_0xc065('0x75')](),{'type':db['sequelize'][_0xc065('0x76')]['SELECT']})[_0xc065('0x27')](function(_0x5d8673){if(_0x5d8673[_0xc065('0x48')]===0x1){return _0x52c30b['id'];}else{var _0x14fd13=_[_0xc065('0x77')](_[_0xc065('0x2e')](_0x5d8673,_0xc065('0x78')),function(_0x545ad6){return _['includes'](_0x401770,_0x545ad6);});if(_0x14fd13){return _0x52c30b['id'];}}}));}}return BPromise[_0xc065('0x79')](_0x301a26)[_0xc065('0x27')](function(_0x3a8068){_0x475a14=_(_0x475a14)[_0xc065('0x7a')](_0x3a8068)[_0xc065('0x7b')]()[_0xc065('0x7c')]();return db[_0xc065('0x2f')]['find']({'where':{'id':_0x5ba020[_0xc065('0x46')]['id']}})[_0xc065('0x27')](function(_0x57b458){return db['sequelize']['transaction'](function(_0x1b8cbf){return _0x57b458[_0xc065('0x6c')](_0x5ba020[_0xc065('0x31')]['ids'],{'transaction':_0x1b8cbf})[_0xc065('0x27')](function(){if(!_[_0xc065('0x7d')](_0x475a14)){return _0x57b458[_0xc065('0x7e')](_0x475a14,{'transaction':_0x1b8cbf});}})['then'](function(){_0x475a14['forEach'](function(_0x2ca408){socket[_0xc065('0x7f')](_0xc065('0x80'),{'UserId':_0x2ca408,'OpenchannelQueueId':_0x57b458['id']});});});});});});})[_0xc065('0x27')](respondWithStatusCode(_0x167593,null))[_0xc065('0x44')](handleError(_0x167593,null));};exports[_0xc065('0x81')]=function(_0x583e80,_0x4b0d93,_0x3107a8){return db[_0xc065('0x2f')]['find']({'where':{'id':_0x583e80[_0xc065('0x46')]['id']}})[_0xc065('0x27')](handleEntityNotFound(_0x4b0d93,null))[_0xc065('0x27')](function(_0x43c364){if(_0x43c364){return _0x43c364['addAgents'](_0x583e80[_0xc065('0x4c')][_0xc065('0x63')],_[_0xc065('0x82')](_0x583e80[_0xc065('0x4c')],[_0xc065('0x63'),'id'])||{})[_0xc065('0x83')](function(_0x38530c){for(var _0x3b3106=0x0;_0x3b3106<_0x583e80[_0xc065('0x4c')][_0xc065('0x63')][_0xc065('0x48')];_0x3b3106+=0x1){socket[_0xc065('0x7f')](_0xc065('0x6b'),{'UserId':_0x583e80[_0xc065('0x4c')][_0xc065('0x63')][_0x3b3106],'OpenchannelQueueId':_0x583e80[_0xc065('0x46')]['id']});}return _0x38530c;});}})[_0xc065('0x27')](respondWithResult(_0x4b0d93,null))[_0xc065('0x44')](handleError(_0x4b0d93,null));};exports[_0xc065('0x7e')]=function(_0x1a24b6,_0x5da060,_0x358be9){return db[_0xc065('0x2f')][_0xc065('0x4a')]({'where':{'id':_0x1a24b6[_0xc065('0x46')]['id']}})['then'](handleEntityNotFound(_0x5da060,null))[_0xc065('0x27')](function(_0x3e5853){if(_0x3e5853){return _0x3e5853['removeAgents'](_0x1a24b6['query']['ids'])[_0xc065('0x27')](function(){if(_[_0xc065('0x84')](_0x1a24b6[_0xc065('0x31')][_0xc065('0x63')])){for(var _0x4827d9=0x0;_0x4827d9<_0x1a24b6[_0xc065('0x31')][_0xc065('0x63')][_0xc065('0x48')];_0x4827d9+=0x1){socket[_0xc065('0x7f')](_0xc065('0x80'),{'UserId':Number(_0x1a24b6['query'][_0xc065('0x63')][_0x4827d9]),'OpenchannelQueueId':Number(_0x1a24b6[_0xc065('0x46')]['id'])});}}else{socket[_0xc065('0x7f')](_0xc065('0x80'),{'UserId':Number(_0x1a24b6[_0xc065('0x31')][_0xc065('0x63')]),'OpenchannelQueueId':Number(_0x1a24b6[_0xc065('0x46')]['id'])});}});}})[_0xc065('0x27')](respondWithStatusCode(_0x5da060,null))['catch'](handleError(_0x5da060,null));};exports[_0xc065('0x85')]=function(_0x3b88e8,_0x539225,_0x2c37f6){var _0x48be80={};var _0x3fcbd2={};var _0xc97572;var _0x37e329;return db[_0xc065('0x2f')]['findOne']({'where':{'id':_0x3b88e8[_0xc065('0x46')]['id']}})[_0xc065('0x27')](handleEntityNotFound(_0x539225,null))[_0xc065('0x27')](function(_0x26b19a){if(_0x26b19a){_0xc97572=_0x26b19a;_0x3fcbd2[_0xc065('0x35')]=_[_0xc065('0x32')](db[_0xc065('0x5a')][_0xc065('0x47')]);_0x3fcbd2[_0xc065('0x31')]=_[_0xc065('0x32')](_0x3b88e8['query']);_0x3fcbd2[_0xc065('0x33')]=_[_0xc065('0x34')](_0x3fcbd2[_0xc065('0x35')],_0x3fcbd2[_0xc065('0x31')]);_0x48be80['attributes']=_[_0xc065('0x34')](_0x3fcbd2[_0xc065('0x35')],qs[_0xc065('0x36')](_0x3b88e8[_0xc065('0x31')][_0xc065('0x36')]));_0x48be80[_0xc065('0x37')]=_0x48be80[_0xc065('0x37')]['length']?_0x48be80['attributes']:_0x3fcbd2[_0xc065('0x35')];_0x48be80['order']=qs['sort'](_0x3b88e8[_0xc065('0x31')][_0xc065('0x3a')]);_0x48be80[_0xc065('0x3b')]=qs[_0xc065('0x33')](_[_0xc065('0x3c')](_0x3b88e8[_0xc065('0x31')],_0x3fcbd2[_0xc065('0x33')]));if(_0x3b88e8[_0xc065('0x31')][_0xc065('0x3f')]){_0x48be80[_0xc065('0x3b')]=_['merge'](_0x48be80[_0xc065('0x3b')],{'$or':_[_0xc065('0x2e')](_0x48be80[_0xc065('0x37')],function(_0x2f2c49){var _0x2f976e={};_0x2f976e[_0x2f2c49]={'$like':'%'+_0x3b88e8[_0xc065('0x31')][_0xc065('0x3f')]+'%'};return _0x2f976e;})});}_0x48be80=_[_0xc065('0x3d')]({},_0x48be80,_0x3b88e8[_0xc065('0x49')]);return _0xc97572[_0xc065('0x85')](_0x48be80);}})[_0xc065('0x27')](function(_0x56118c){if(_0x56118c){_0x37e329=_0x56118c[_0xc065('0x48')];if(!_0x3b88e8[_0xc065('0x31')][_0xc065('0x38')]('nolimit')){_0x48be80[_0xc065('0x22')]=qs[_0xc065('0x22')](_0x3b88e8[_0xc065('0x31')][_0xc065('0x22')]);_0x48be80[_0xc065('0x21')]=qs[_0xc065('0x21')](_0x3b88e8[_0xc065('0x31')][_0xc065('0x21')]);}return _0xc97572[_0xc065('0x85')](_0x48be80);}})[_0xc065('0x27')](function(_0x42f737){if(_0x42f737){return _0x42f737?{'count':_0x37e329,'rows':_0x42f737}:null;}})[_0xc065('0x27')](respondWithResult(_0x539225,null))[_0xc065('0x44')](handleError(_0x539225,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 4fbce10..b61228e 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 _0x15d5=['emit','hook','events','../../mysqldb','OpenchannelQueue','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x15d5,0x122));var _0x515d=function(_0x253c04,_0x29091a){_0x253c04=_0x253c04-0x0;var _0x369901=_0x15d5[_0x253c04];return _0x369901;};'use strict';var EventEmitter=require(_0x515d('0x0'));var OpenchannelQueue=require(_0x515d('0x1'))['db'][_0x515d('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x515d('0x3')};function emitEvent(_0x1b868f){return function(_0x2a4032,_0x360d0f,_0x42cc38){OpenchannelQueueEvents[_0x515d('0x4')](_0x1b868f+':'+_0x2a4032['id'],_0x2a4032);OpenchannelQueueEvents['emit'](_0x1b868f,_0x2a4032);_0x42cc38(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x515d('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x6912=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','update'];(function(_0x59578b,_0x1f3530){var _0xdc473b=function(_0x8a35ef){while(--_0x8a35ef){_0x59578b['push'](_0x59578b['shift']());}};_0xdc473b(++_0x1f3530);}(_0x6912,0x1c7));var _0x2691=function(_0x12ef6d,_0x1c869d){_0x12ef6d=_0x12ef6d-0x0;var _0x58f416=_0x6912[_0x12ef6d];return _0x58f416;};'use strict';var EventEmitter=require(_0x2691('0x0'));var OpenchannelQueue=require(_0x2691('0x1'))['db'][_0x2691('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2691('0x3'),'afterUpdate':_0x2691('0x4'),'afterDestroy':_0x2691('0x5')};function emitEvent(_0x46e3dc){return function(_0x516826,_0x27261d,_0x40d7ad){OpenchannelQueueEvents[_0x2691('0x6')](_0x46e3dc+':'+_0x516826['id'],_0x516826);OpenchannelQueueEvents[_0x2691('0x6')](_0x46e3dc,_0x516826);_0x40d7ad(null);};}for(var e in events){if(events[_0x2691('0x7')](e)){var event=events[e];OpenchannelQueue[_0x2691('0x8')](e,emitEvent(event));}}module[_0x2691('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 018bc8e..655bb72 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 _0x330f=['define','OpenchannelQueue','lodash','util','api','moment','rimraf','./openchannelQueue.attributes','exports'];(function(_0x3ca879,_0x2e88ee){var _0x1f0bae=function(_0x114b52){while(--_0x114b52){_0x3ca879['push'](_0x3ca879['shift']());}};_0x1f0bae(++_0x2e88ee);}(_0x330f,0xe3));var _0xf330=function(_0x2cdd4d,_0x394c2f){_0x2cdd4d=_0x2cdd4d-0x0;var _0x55cbc8=_0x330f[_0x2cdd4d];return _0x55cbc8;};'use strict';var _=require(_0xf330('0x0'));var util=require(_0xf330('0x1'));var logger=require('../../config/logger')(_0xf330('0x2'));var moment=require(_0xf330('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf330('0x4'));var config=require('../../config/environment');var attributes=require(_0xf330('0x5'));module[_0xf330('0x6')]=function(_0x2e60ef,_0x2c3329){return _0x2e60ef[_0xf330('0x7')](_0xf330('0x8'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6594=['exports','define','openchannel_queues','moment','bluebird','request-promise','path','rimraf'];(function(_0x2f5673,_0x1cd93f){var _0x35b810=function(_0x46a3de){while(--_0x46a3de){_0x2f5673['push'](_0x2f5673['shift']());}};_0x35b810(++_0x1cd93f);}(_0x6594,0xcb));var _0x4659=function(_0x5e8295,_0x4fcee0){_0x5e8295=_0x5e8295-0x0;var _0x2b08aa=_0x6594[_0x5e8295];return _0x2b08aa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4659('0x0'));var BPromise=require(_0x4659('0x1'));var rp=require(_0x4659('0x2'));var fs=require('fs');var path=require(_0x4659('0x3'));var rimraf=require(_0x4659('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x4659('0x5')]=function(_0x2f59ce,_0x246729){return _0x2f59ce[_0x4659('0x6')]('OpenchannelQueue',attributes,{'tableName':_0x4659('0x7'),'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 7fa2f52..6cc9199 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 _0x7a95=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','include','map','model','then','catch','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0x7a95,0x95));var _0x57a9=function(_0x3c4c1b,_0x567fb1){_0x3c4c1b=_0x3c4c1b-0x0;var _0x1e0d7c=_0x7a95[_0x3c4c1b];return _0x1e0d7c;};'use strict';var _=require(_0x57a9('0x0'));var util=require(_0x57a9('0x1'));var moment=require(_0x57a9('0x2'));var BPromise=require(_0x57a9('0x3'));var rs=require(_0x57a9('0x4'));var fs=require('fs');var Redis=require(_0x57a9('0x5'));var db=require(_0x57a9('0x6'))['db'];var utils=require(_0x57a9('0x7'));var logger=require(_0x57a9('0x8'))(_0x57a9('0x9'));var config=require(_0x57a9('0xa'));var jayson=require(_0x57a9('0xb'));var client=jayson[_0x57a9('0xc')][_0x57a9('0xd')]({'port':0x232a});config[_0x57a9('0xe')]=_[_0x57a9('0xf')](config[_0x57a9('0xe')],{'host':_0x57a9('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57a9('0xe')]));require(_0x57a9('0x11'))[_0x57a9('0x12')](socket);function respondWithRpcPromise(_0x15fc68,_0x3f617f,_0x34bf73){return new BPromise(function(_0x9a40bf,_0x4a3b6f){return client[_0x57a9('0x13')](_0x15fc68,_0x34bf73)['then'](function(_0x1c4d55){logger['info'](_0x57a9('0x14'),_0x3f617f,_0x57a9('0x15'));logger[_0x57a9('0x16')](_0x57a9('0x17'),_0x3f617f,_0x57a9('0x15'),JSON[_0x57a9('0x18')](_0x1c4d55));if(_0x1c4d55[_0x57a9('0x19')]){if(_0x1c4d55['error'][_0x57a9('0x1a')]===0x1f4){logger[_0x57a9('0x19')](_0x57a9('0x14'),_0x3f617f,_0x1c4d55[_0x57a9('0x19')][_0x57a9('0x1b')]);return _0x4a3b6f(_0x1c4d55[_0x57a9('0x19')][_0x57a9('0x1b')]);}logger['error'](_0x57a9('0x14'),_0x3f617f,_0x1c4d55[_0x57a9('0x19')][_0x57a9('0x1b')]);return _0x9a40bf(_0x1c4d55[_0x57a9('0x19')][_0x57a9('0x1b')]);}else{logger[_0x57a9('0x1c')]('OpenchannelQueue,\x20%s,\x20%s',_0x3f617f,_0x57a9('0x15'));_0x9a40bf(_0x1c4d55['result'][_0x57a9('0x1b')]);}})['catch'](function(_0x3dabe7){logger[_0x57a9('0x19')](_0x57a9('0x14'),_0x3f617f,_0x3dabe7);_0x4a3b6f(_0x3dabe7);});});}exports[_0x57a9('0x1d')]=function(_0x38ef9c){var _0x31136c=this;return new Promise(function(_0x348657,_0x58d1c0){return db[_0x57a9('0x1e')][_0x57a9('0x1f')]({'raw':_0x38ef9c[_0x57a9('0x20')]?_0x38ef9c[_0x57a9('0x20')][_0x57a9('0x21')]===undefined?!![]:![]:!![],'where':_0x38ef9c[_0x57a9('0x20')]?_0x38ef9c[_0x57a9('0x20')]['where']||null:null,'attributes':_0x38ef9c[_0x57a9('0x20')]?_0x38ef9c['options'][_0x57a9('0x22')]||null:null,'limit':_0x38ef9c['options']?_0x38ef9c[_0x57a9('0x20')][_0x57a9('0x23')]||null:null,'include':_0x38ef9c['options']?_0x38ef9c['options'][_0x57a9('0x24')]?_[_0x57a9('0x25')](_0x38ef9c['options'][_0x57a9('0x24')],function(_0x249279){return{'model':db[_0x249279[_0x57a9('0x26')]],'as':_0x249279['as'],'attributes':_0x249279[_0x57a9('0x22')],'include':_0x249279[_0x57a9('0x24')]?_['map'](_0x249279[_0x57a9('0x24')],function(_0x18d86d){return{'model':db[_0x18d86d[_0x57a9('0x26')]],'as':_0x18d86d['as'],'attributes':_0x18d86d[_0x57a9('0x22')],'include':_0x18d86d[_0x57a9('0x24')]?_[_0x57a9('0x25')](_0x18d86d[_0x57a9('0x24')],function(_0x33e3f1){return{'model':db[_0x33e3f1[_0x57a9('0x26')]],'as':_0x33e3f1['as'],'attributes':_0x33e3f1[_0x57a9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x57a9('0x27')](function(_0x2ec437){logger[_0x57a9('0x1c')]('GetOpenchannelQueue',_0x38ef9c);logger['debug'](_0x57a9('0x1d'),_0x38ef9c,JSON[_0x57a9('0x18')](_0x2ec437));_0x348657(_0x2ec437);})[_0x57a9('0x28')](function(_0x4a8f1f){logger['error'](_0x57a9('0x1d'),_0x4a8f1f[_0x57a9('0x1b')],_0x38ef9c);_0x58d1c0(_0x31136c[_0x57a9('0x19')](0x1f4,_0x4a8f1f['message']));});});};exports['ShowOpenchannelQueue']=function(_0x3fed80){var _0x758b82=this;return new Promise(function(_0x468ff2,_0xffade7){return db[_0x57a9('0x1e')][_0x57a9('0x29')]({'raw':_0x3fed80[_0x57a9('0x20')]?_0x3fed80[_0x57a9('0x20')][_0x57a9('0x21')]===undefined?!![]:![]:!![],'where':_0x3fed80['options']?_0x3fed80[_0x57a9('0x20')]['where']||null:null,'attributes':_0x3fed80[_0x57a9('0x20')]?_0x3fed80[_0x57a9('0x20')][_0x57a9('0x22')]||null:null,'include':_0x3fed80[_0x57a9('0x20')]?_0x3fed80['options'][_0x57a9('0x24')]?_[_0x57a9('0x25')](_0x3fed80['options'][_0x57a9('0x24')],function(_0x430ee6){return{'model':db[_0x430ee6[_0x57a9('0x26')]],'as':_0x430ee6['as'],'attributes':_0x430ee6[_0x57a9('0x22')],'include':_0x430ee6[_0x57a9('0x24')]?_[_0x57a9('0x25')](_0x430ee6[_0x57a9('0x24')],function(_0x43bde9){return{'model':db[_0x43bde9[_0x57a9('0x26')]],'as':_0x43bde9['as'],'attributes':_0x43bde9[_0x57a9('0x22')],'include':_0x43bde9[_0x57a9('0x24')]?_[_0x57a9('0x25')](_0x43bde9['include'],function(_0x4a3781){return{'model':db[_0x4a3781[_0x57a9('0x26')]],'as':_0x4a3781['as'],'attributes':_0x4a3781[_0x57a9('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fa37c){logger[_0x57a9('0x1c')](_0x57a9('0x2a'),_0x3fed80);logger[_0x57a9('0x16')](_0x57a9('0x2a'),_0x3fed80,JSON[_0x57a9('0x18')](_0x3fa37c));_0x468ff2(_0x3fa37c);})[_0x57a9('0x28')](function(_0x3184d7){logger[_0x57a9('0x19')](_0x57a9('0x2a'),_0x3184d7['message'],_0x3fed80);_0xffade7(_0x758b82[_0x57a9('0x19')](0x1f4,_0x3184d7[_0x57a9('0x1b')]));});});}; \ No newline at end of file +var _0x1cd9=['info','OpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetOpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowOpenchannelQueue','OpenchannelQueue','find','raw','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1cd9,0xb4));var _0x91cd=function(_0x34933a,_0x327378){_0x34933a=_0x34933a-0x0;var _0x36abb4=_0x1cd9[_0x34933a];return _0x36abb4;};'use strict';var _=require(_0x91cd('0x0'));var util=require(_0x91cd('0x1'));var moment=require(_0x91cd('0x2'));var BPromise=require(_0x91cd('0x3'));var rs=require(_0x91cd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x91cd('0x5'));var logger=require(_0x91cd('0x6'))(_0x91cd('0x7'));var config=require('../../config/environment');var jayson=require(_0x91cd('0x8'));var client=jayson[_0x91cd('0x9')]['http']({'port':0x232a});config[_0x91cd('0xa')]=_['defaults'](config[_0x91cd('0xa')],{'host':_0x91cd('0xb'),'port':0x18eb});var socket=require(_0x91cd('0xc'))(new Redis(config['redis']));require(_0x91cd('0xd'))[_0x91cd('0xe')](socket);function respondWithRpcPromise(_0x385dd9,_0xe753bc,_0x23aaf0){return new BPromise(function(_0x275e1f,_0x66495c){return client['request'](_0x385dd9,_0x23aaf0)['then'](function(_0x147614){logger[_0x91cd('0xf')](_0x91cd('0x10'),_0xe753bc,'request\x20sent');logger[_0x91cd('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xe753bc,_0x91cd('0x12'),JSON[_0x91cd('0x13')](_0x147614));if(_0x147614[_0x91cd('0x14')]){if(_0x147614[_0x91cd('0x14')][_0x91cd('0x15')]===0x1f4){logger[_0x91cd('0x14')](_0x91cd('0x10'),_0xe753bc,_0x147614[_0x91cd('0x14')]['message']);return _0x66495c(_0x147614[_0x91cd('0x14')]['message']);}logger[_0x91cd('0x14')](_0x91cd('0x10'),_0xe753bc,_0x147614['error'][_0x91cd('0x16')]);return _0x275e1f(_0x147614['error'][_0x91cd('0x16')]);}else{logger[_0x91cd('0xf')](_0x91cd('0x10'),_0xe753bc,_0x91cd('0x12'));_0x275e1f(_0x147614[_0x91cd('0x17')]['message']);}})['catch'](function(_0x12d817){logger[_0x91cd('0x14')](_0x91cd('0x10'),_0xe753bc,_0x12d817);_0x66495c(_0x12d817);});});}exports[_0x91cd('0x18')]=function(_0x5456b7){var _0x451ff4=this;return new Promise(function(_0x5906ed,_0x2fdcd0){return db['OpenchannelQueue'][_0x91cd('0x19')]({'raw':_0x5456b7[_0x91cd('0x1a')]?_0x5456b7[_0x91cd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5456b7[_0x91cd('0x1a')]?_0x5456b7[_0x91cd('0x1a')][_0x91cd('0x1b')]||null:null,'attributes':_0x5456b7[_0x91cd('0x1a')]?_0x5456b7[_0x91cd('0x1a')][_0x91cd('0x1c')]||null:null,'limit':_0x5456b7[_0x91cd('0x1a')]?_0x5456b7['options'][_0x91cd('0x1d')]||null:null,'include':_0x5456b7[_0x91cd('0x1a')]?_0x5456b7[_0x91cd('0x1a')][_0x91cd('0x1e')]?_[_0x91cd('0x1f')](_0x5456b7[_0x91cd('0x1a')]['include'],function(_0x3017a6){return{'model':db[_0x3017a6['model']],'as':_0x3017a6['as'],'attributes':_0x3017a6[_0x91cd('0x1c')],'include':_0x3017a6['include']?_[_0x91cd('0x1f')](_0x3017a6[_0x91cd('0x1e')],function(_0xccbbf9){return{'model':db[_0xccbbf9[_0x91cd('0x20')]],'as':_0xccbbf9['as'],'attributes':_0xccbbf9[_0x91cd('0x1c')],'include':_0xccbbf9['include']?_[_0x91cd('0x1f')](_0xccbbf9[_0x91cd('0x1e')],function(_0x2c0227){return{'model':db[_0x2c0227[_0x91cd('0x20')]],'as':_0x2c0227['as'],'attributes':_0x2c0227[_0x91cd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x91cd('0x21')](function(_0x46ef68){logger[_0x91cd('0xf')](_0x91cd('0x18'),_0x5456b7);logger[_0x91cd('0x11')](_0x91cd('0x18'),_0x5456b7,JSON[_0x91cd('0x13')](_0x46ef68));_0x5906ed(_0x46ef68);})['catch'](function(_0xf0253a){logger[_0x91cd('0x14')](_0x91cd('0x18'),_0xf0253a['message'],_0x5456b7);_0x2fdcd0(_0x451ff4[_0x91cd('0x14')](0x1f4,_0xf0253a[_0x91cd('0x16')]));});});};exports[_0x91cd('0x22')]=function(_0x75d50a){var _0x8cd80c=this;return new Promise(function(_0x29d2da,_0x20672d){return db[_0x91cd('0x23')][_0x91cd('0x24')]({'raw':_0x75d50a[_0x91cd('0x1a')]?_0x75d50a['options'][_0x91cd('0x25')]===undefined?!![]:![]:!![],'where':_0x75d50a[_0x91cd('0x1a')]?_0x75d50a[_0x91cd('0x1a')][_0x91cd('0x1b')]||null:null,'attributes':_0x75d50a[_0x91cd('0x1a')]?_0x75d50a['options']['attributes']||null:null,'include':_0x75d50a['options']?_0x75d50a[_0x91cd('0x1a')][_0x91cd('0x1e')]?_['map'](_0x75d50a['options'][_0x91cd('0x1e')],function(_0x243d9e){return{'model':db[_0x243d9e['model']],'as':_0x243d9e['as'],'attributes':_0x243d9e['attributes'],'include':_0x243d9e['include']?_[_0x91cd('0x1f')](_0x243d9e[_0x91cd('0x1e')],function(_0x413f18){return{'model':db[_0x413f18['model']],'as':_0x413f18['as'],'attributes':_0x413f18[_0x91cd('0x1c')],'include':_0x413f18[_0x91cd('0x1e')]?_[_0x91cd('0x1f')](_0x413f18[_0x91cd('0x1e')],function(_0x41e312){return{'model':db[_0x41e312[_0x91cd('0x20')]],'as':_0x41e312['as'],'attributes':_0x41e312[_0x91cd('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x91cd('0x21')](function(_0x43a961){logger['info'](_0x91cd('0x22'),_0x75d50a);logger[_0x91cd('0x11')](_0x91cd('0x22'),_0x75d50a,JSON[_0x91cd('0x13')](_0x43a961));_0x29d2da(_0x43a961);})[_0x91cd('0x26')](function(_0x2d0fd6){logger[_0x91cd('0x14')](_0x91cd('0x22'),_0x2d0fd6[_0x91cd('0x16')],_0x75d50a);_0x20672d(_0x8cd80c[_0x91cd('0x14')](0x1f4,_0x2d0fd6[_0x91cd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index cdba680..1b28221 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 _0x3375=['openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x2dbfd6,_0xa3f98d){var _0x638637=function(_0x5b103b){while(--_0x5b103b){_0x2dbfd6['push'](_0x2dbfd6['shift']());}};_0x638637(++_0xa3f98d);}(_0x3375,0x78));var _0x5337=function(_0x30089a,_0x534ecb){_0x30089a=_0x30089a-0x0;var _0x37ab8a=_0x3375[_0x30089a];return _0x37ab8a;};'use strict';var OpenchannelQueueEvents=require(_0x5337('0x0'));var events=[_0x5337('0x1'),_0x5337('0x2'),_0x5337('0x3')];function createListener(_0x302d60,_0x1f9372){return function(_0x21a8ba){_0x1f9372[_0x5337('0x4')](_0x302d60,_0x21a8ba);};}function removeListener(_0x25c5c1,_0x17a791){return function(){OpenchannelQueueEvents[_0x5337('0x5')](_0x25c5c1,_0x17a791);};}exports['register']=function(_0x579694){for(var _0x548940=0x0,_0x47a3d9=events['length'];_0x548940<_0x47a3d9;_0x548940++){var _0x155920=events[_0x548940];var _0x3b1049=createListener(_0x5337('0x6')+_0x155920,_0x579694);OpenchannelQueueEvents['on'](_0x155920,_0x3b1049);}}; \ No newline at end of file +var _0xa102=['emit','removeListener','register','openchannelQueue:','./openchannelQueue.events','save','update'];(function(_0xaa6a4,_0x64b067){var _0xdc31a4=function(_0x4269d8){while(--_0x4269d8){_0xaa6a4['push'](_0xaa6a4['shift']());}};_0xdc31a4(++_0x64b067);}(_0xa102,0x1b6));var _0x2a10=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0xa102[_0x50aa2e];return _0x5e07f0;};'use strict';var OpenchannelQueueEvents=require(_0x2a10('0x0'));var events=[_0x2a10('0x1'),'remove',_0x2a10('0x2')];function createListener(_0xc28c,_0x28a8d8){return function(_0x184460){_0x28a8d8[_0x2a10('0x3')](_0xc28c,_0x184460);};}function removeListener(_0x149c80,_0x5c4e0f){return function(){OpenchannelQueueEvents[_0x2a10('0x4')](_0x149c80,_0x5c4e0f);};}exports[_0x2a10('0x5')]=function(_0x5e4f97){for(var _0x3f3e9b=0x0,_0x57bb61=events['length'];_0x3f3e9b<_0x57bb61;_0x3f3e9b++){var _0x343e53=events[_0x3f3e9b];var _0x48f1d7=createListener(_0x2a10('0x6')+_0x343e53,_0x5e4f97);OpenchannelQueueEvents['on'](_0x343e53,_0x48f1d7);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2635580..e4d6ce6 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 _0xda0b=['/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xda0b,0x144));var _0xbda0=function(_0x3e5828,_0x3d77ee){_0x3e5828=_0x3e5828-0x0;var _0x386a71=_0xda0b[_0x3e5828];return _0x386a71;};'use strict';var multer=require(_0xbda0('0x0'));var util=require(_0xbda0('0x1'));var path=require(_0xbda0('0x2'));var timeout=require(_0xbda0('0x3'));var express=require(_0xbda0('0x4'));var router=express[_0xbda0('0x5')]();var auth=require(_0xbda0('0x6'));var interaction=require(_0xbda0('0x7'));var config=require('../../config/environment');var controller=require(_0xbda0('0x8'));router[_0xbda0('0x9')]('/',auth[_0xbda0('0xa')](),controller[_0xbda0('0xb')]);router[_0xbda0('0x9')](_0xbda0('0xc'),auth[_0xbda0('0xa')](),controller[_0xbda0('0xd')]);router['get'](_0xbda0('0xe'),auth[_0xbda0('0xa')](),controller[_0xbda0('0xf')]);router['post']('/',auth[_0xbda0('0xa')](),controller[_0xbda0('0x10')]);router['put'](_0xbda0('0xe'),auth['isAuthenticated'](),controller[_0xbda0('0x11')]);router[_0xbda0('0x12')](_0xbda0('0xe'),auth[_0xbda0('0xa')](),controller[_0xbda0('0x13')]);module[_0xbda0('0x14')]=router; \ No newline at end of file +var _0x9ca8=['connect-timeout','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','show','create','put','/:id','update','delete','destroy','util','path'];(function(_0x11ee3a,_0x2896e0){var _0x427973=function(_0x5c9f7f){while(--_0x5c9f7f){_0x11ee3a['push'](_0x11ee3a['shift']());}};_0x427973(++_0x2896e0);}(_0x9ca8,0x1b8));var _0x89ca=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x9ca8[_0x11f249];return _0x5c3656;};'use strict';var multer=require('multer');var util=require(_0x89ca('0x0'));var path=require(_0x89ca('0x1'));var timeout=require(_0x89ca('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x89ca('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x89ca('0x4'));var controller=require(_0x89ca('0x5'));router['get']('/',auth[_0x89ca('0x6')](),controller[_0x89ca('0x7')]);router[_0x89ca('0x8')]('/describe',auth[_0x89ca('0x6')](),controller[_0x89ca('0x9')]);router[_0x89ca('0x8')]('/:id',auth[_0x89ca('0x6')](),controller[_0x89ca('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x89ca('0xb')]);router[_0x89ca('0xc')](_0x89ca('0xd'),auth[_0x89ca('0x6')](),controller[_0x89ca('0xe')]);router[_0x89ca('0xf')](_0x89ca('0xd'),auth['isAuthenticated'](),controller[_0x89ca('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 1010b4f..09b6f1c 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 _0xdde6=['moment','sequelize','exports','DATE','STRING'];(function(_0x5f493b,_0x529bc0){var _0x2fc69e=function(_0x4c6574){while(--_0x4c6574){_0x5f493b['push'](_0x5f493b['shift']());}};_0x2fc69e(++_0x529bc0);}(_0xdde6,0x163));var _0x6dde=function(_0xf922c2,_0xd3dba1){_0xf922c2=_0xf922c2-0x0;var _0x927e9f=_0xdde6[_0xf922c2];return _0x927e9f;};'use strict';var moment=require(_0x6dde('0x0'));var Sequelize=require(_0x6dde('0x1'));module[_0x6dde('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6dde('0x3')]},'leaveAt':{'type':Sequelize[_0x6dde('0x3')]},'acceptAt':{'type':Sequelize[_0x6dde('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6dde('0x4')]}}; \ No newline at end of file +var _0x5cc9=['sequelize','exports','STRING','DATE','moment'];(function(_0x362a30,_0xad7db6){var _0x2b8744=function(_0x47b761){while(--_0x47b761){_0x362a30['push'](_0x362a30['shift']());}};_0x2b8744(++_0xad7db6);}(_0x5cc9,0xd1));var _0x95cc=function(_0x26e964,_0x4b9dc8){_0x26e964=_0x26e964-0x0;var _0x3ca94d=_0x5cc9[_0x26e964];return _0x3ca94d;};'use strict';var moment=require(_0x95cc('0x0'));var Sequelize=require(_0x95cc('0x1'));module[_0x95cc('0x2')]={'uniqueid':{'type':Sequelize[_0x95cc('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x95cc('0x3')]},'joinAt':{'type':Sequelize[_0x95cc('0x4')]},'leaveAt':{'type':Sequelize[_0x95cc('0x4')]},'acceptAt':{'type':Sequelize[_0x95cc('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x95cc('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index b6a1421..4c57193 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 _0x33a4=['ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','count','includeAll','OpenchannelQueueReport','findAll','rows','catch','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv'];(function(_0x49ad8f,_0x5d4458){var _0x925768=function(_0x14e463){while(--_0x14e463){_0x49ad8f['push'](_0x49ad8f['shift']());}};_0x925768(++_0x5d4458);}(_0x33a4,0x88));var _0x433a=function(_0x126ea3,_0x3a6808){_0x126ea3=_0x126ea3-0x0;var _0x42cbef=_0x33a4[_0x126ea3];return _0x42cbef;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x433a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x433a('0x1'));var jsonpatch=require(_0x433a('0x2'));var rp=require(_0x433a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x433a('0x4'));var path=require(_0x433a('0x5'));var sox=require(_0x433a('0x6'));var csv=require(_0x433a('0x7'));var ejs=require(_0x433a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x433a('0x9'));var crypto=require('crypto');var jsforce=require(_0x433a('0xa'));var deskjs=require(_0x433a('0xb'));var toCsv=require(_0x433a('0x7'));var querystring=require(_0x433a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x433a('0xd'));var qs=require(_0x433a('0xe'));var as=require(_0x433a('0xf'));var hardwareService=require(_0x433a('0x10'));var logger=require(_0x433a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x433a('0x12'));var licenseUtil=require(_0x433a('0x13'));var db=require(_0x433a('0x14'))['db'];function respondWithStatusCode(_0xd9260c,_0x5edeaf){_0x5edeaf=_0x5edeaf||0xcc;return function(_0x2d064c){if(_0x2d064c){return _0xd9260c[_0x433a('0x15')](_0x5edeaf);}return _0xd9260c['status'](_0x5edeaf)[_0x433a('0x16')]();};}function respondWithResult(_0x524a57,_0x36d1a6){_0x36d1a6=_0x36d1a6||0xc8;return function(_0x1f6cee){if(_0x1f6cee){return _0x524a57[_0x433a('0x17')](_0x36d1a6)['json'](_0x1f6cee);}};}function respondWithFilteredResult(_0x4ba178,_0x14e3a7){return function(_0x24311f){if(_0x24311f){var _0x35ebaf=_0x24311f['count'],_0x3a58c8=_0x14e3a7[_0x433a('0x18')],_0x29c51f=_0x14e3a7[_0x433a('0x18')]+_0x14e3a7[_0x433a('0x19')],_0x4df77a;if(_0x29c51f>=_0x35ebaf){_0x29c51f=_0x35ebaf;_0x4df77a=0xc8;}else{_0x4df77a=0xce;}_0x4ba178[_0x433a('0x17')](_0x4df77a);return _0x4ba178[_0x433a('0x1a')](_0x433a('0x1b'),_0x3a58c8+'-'+_0x29c51f+'/'+_0x35ebaf)[_0x433a('0x1c')](_0x24311f);}return null;};}function patchUpdates(_0x2a6234){return function(_0x382f45){try{jsonpatch[_0x433a('0x1d')](_0x382f45,_0x2a6234,!![]);}catch(_0x36db9f){return BPromise['reject'](_0x36db9f);}return _0x382f45[_0x433a('0x1e')]();};}function saveUpdates(_0x566ae7,_0x2f16a8){return function(_0x5a63b6){if(_0x5a63b6){return _0x5a63b6[_0x433a('0x1f')](_0x566ae7)[_0x433a('0x20')](function(_0xd9cfe6){return _0xd9cfe6;});}return null;};}function removeEntity(_0xa2dfe5,_0x389b90){return function(_0x1501f2){if(_0x1501f2){return _0x1501f2[_0x433a('0x21')]()['then'](function(){_0xa2dfe5['status'](0xcc)[_0x433a('0x16')]();});}};}function handleEntityNotFound(_0x5a50ff,_0x326785){return function(_0x4e6142){if(!_0x4e6142){_0x5a50ff[_0x433a('0x15')](0x194);}return _0x4e6142;};}function handleError(_0x24ab09,_0x3a1d6d){_0x3a1d6d=_0x3a1d6d||0x1f4;return function(_0x3ef4ab){logger[_0x433a('0x22')](_0x3ef4ab[_0x433a('0x23')]);if(_0x3ef4ab['name']){delete _0x3ef4ab[_0x433a('0x24')];}_0x24ab09[_0x433a('0x17')](_0x3a1d6d)['send'](_0x3ef4ab);};}exports[_0x433a('0x25')]=function(_0x571461,_0x590b7e){var _0x5ec211={},_0x457bdb={},_0x4fcecc={'count':0x0,'rows':[]};var _0x1b0d85=_['map'](db['OpenchannelQueueReport'][_0x433a('0x26')],function(_0x1d5d78){return{'name':_0x1d5d78[_0x433a('0x27')],'type':_0x1d5d78['type'][_0x433a('0x28')]};});_0x457bdb[_0x433a('0x29')]=_[_0x433a('0x2a')](_0x1b0d85,'name');_0x457bdb['query']=_[_0x433a('0x2b')](_0x571461[_0x433a('0x2c')]);_0x457bdb[_0x433a('0x2d')]=_[_0x433a('0x2e')](_0x457bdb[_0x433a('0x29')],_0x457bdb[_0x433a('0x2c')]);_0x5ec211[_0x433a('0x2f')]=_[_0x433a('0x2e')](_0x457bdb['model'],qs[_0x433a('0x30')](_0x571461[_0x433a('0x2c')][_0x433a('0x30')]));_0x5ec211[_0x433a('0x2f')]=_0x5ec211[_0x433a('0x2f')][_0x433a('0x31')]?_0x5ec211[_0x433a('0x2f')]:_0x457bdb[_0x433a('0x29')];if(!_0x571461[_0x433a('0x2c')][_0x433a('0x32')](_0x433a('0x33'))){_0x5ec211['limit']=qs[_0x433a('0x19')](_0x571461[_0x433a('0x2c')][_0x433a('0x19')]);_0x5ec211[_0x433a('0x18')]=qs[_0x433a('0x18')](_0x571461[_0x433a('0x2c')][_0x433a('0x18')]);}_0x5ec211[_0x433a('0x34')]=qs[_0x433a('0x35')](_0x571461[_0x433a('0x2c')][_0x433a('0x35')]);_0x5ec211['where']=qs[_0x433a('0x2d')](_[_0x433a('0x36')](_0x571461['query'],_0x457bdb['filters']),_0x1b0d85);if(_0x571461[_0x433a('0x2c')]['filter']){_0x5ec211[_0x433a('0x37')]=_[_0x433a('0x38')](_0x5ec211[_0x433a('0x37')],{'$or':_['map'](_0x1b0d85,function(_0x5bdff7){if(_0x5bdff7[_0x433a('0x39')]!==_0x433a('0x3a')){var _0x3e25cf={};_0x3e25cf[_0x5bdff7[_0x433a('0x24')]]={'$like':'%'+_0x571461[_0x433a('0x2c')][_0x433a('0x3b')]+'%'};return _0x3e25cf;}})});}_0x5ec211=_['merge']({},_0x5ec211,_0x571461['options']);var _0x1989c0={'where':_0x5ec211[_0x433a('0x37')]};return db['OpenchannelQueueReport'][_0x433a('0x3c')](_0x1989c0)[_0x433a('0x20')](function(_0x1024fb){_0x4fcecc[_0x433a('0x3c')]=_0x1024fb;if(_0x571461[_0x433a('0x2c')][_0x433a('0x3d')]){_0x5ec211['include']=[{'all':!![]}];}return db[_0x433a('0x3e')][_0x433a('0x3f')](_0x5ec211);})[_0x433a('0x20')](function(_0x45d6e3){_0x4fcecc[_0x433a('0x40')]=_0x45d6e3;return _0x4fcecc;})[_0x433a('0x20')](respondWithFilteredResult(_0x590b7e,_0x5ec211))[_0x433a('0x41')](handleError(_0x590b7e,null));};exports['show']=function(_0x4bb830,_0x2e56d5){var _0x189867={'raw':!![],'where':{'id':_0x4bb830['params']['id']}},_0x12b606={};_0x12b606[_0x433a('0x29')]=_['keys'](db[_0x433a('0x3e')][_0x433a('0x26')]);_0x12b606[_0x433a('0x2c')]=_[_0x433a('0x2b')](_0x4bb830['query']);_0x12b606[_0x433a('0x2d')]=_[_0x433a('0x2e')](_0x12b606[_0x433a('0x29')],_0x12b606[_0x433a('0x2c')]);_0x189867[_0x433a('0x2f')]=_[_0x433a('0x2e')](_0x12b606[_0x433a('0x29')],qs['fields'](_0x4bb830[_0x433a('0x2c')][_0x433a('0x30')]));_0x189867[_0x433a('0x2f')]=_0x189867[_0x433a('0x2f')][_0x433a('0x31')]?_0x189867[_0x433a('0x2f')]:_0x12b606[_0x433a('0x29')];if(_0x4bb830[_0x433a('0x2c')][_0x433a('0x3d')]){_0x189867['include']=[{'all':!![]}];}_0x189867=_[_0x433a('0x38')]({},_0x189867,_0x4bb830[_0x433a('0x42')]);return db[_0x433a('0x3e')][_0x433a('0x43')](_0x189867)['then'](handleEntityNotFound(_0x2e56d5,null))[_0x433a('0x20')](respondWithResult(_0x2e56d5,null))[_0x433a('0x41')](handleError(_0x2e56d5,null));};exports[_0x433a('0x44')]=function(_0x469c1c,_0x486577){return db['OpenchannelQueueReport'][_0x433a('0x44')](_0x469c1c[_0x433a('0x45')],{})[_0x433a('0x20')](respondWithResult(_0x486577,0xc9))[_0x433a('0x41')](handleError(_0x486577,null));};exports[_0x433a('0x1f')]=function(_0x45addd,_0x19d571){if(_0x45addd[_0x433a('0x45')]['id']){delete _0x45addd[_0x433a('0x45')]['id'];}return db[_0x433a('0x3e')]['find']({'where':{'id':_0x45addd[_0x433a('0x46')]['id']}})[_0x433a('0x20')](handleEntityNotFound(_0x19d571,null))[_0x433a('0x20')](saveUpdates(_0x45addd['body'],null))['then'](respondWithResult(_0x19d571,null))[_0x433a('0x41')](handleError(_0x19d571,null));};exports[_0x433a('0x21')]=function(_0x3777a5,_0x120111){return db[_0x433a('0x3e')][_0x433a('0x43')]({'where':{'id':_0x3777a5['params']['id']}})[_0x433a('0x20')](handleEntityNotFound(_0x120111,null))[_0x433a('0x20')](removeEntity(_0x120111,null))[_0x433a('0x41')](handleError(_0x120111,null));};exports[_0x433a('0x47')]=function(_0x34ec21,_0x580406){return db[_0x433a('0x3e')][_0x433a('0x47')]()[_0x433a('0x20')](respondWithResult(_0x580406,null))[_0x433a('0x41')](handleError(_0x580406,null));}; \ No newline at end of file +var _0x3f49=['eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','count','limit','set','apply','reject','update','status','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','catch','params','keys','find','create','body','destroy','describe','html-pdf'];(function(_0x34ebb4,_0x2822c5){var _0x57affd=function(_0x4ebbb7){while(--_0x4ebbb7){_0x34ebb4['push'](_0x34ebb4['shift']());}};_0x57affd(++_0x2822c5);}(_0x3f49,0x11f));var _0x93f4=function(_0x104a6e,_0x3fc4ba){_0x104a6e=_0x104a6e-0x0;var _0x5c4df9=_0x3f49[_0x104a6e];return _0x5c4df9;};'use strict';var pdf=require(_0x93f4('0x0'));var emlformat=require(_0x93f4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x93f4('0x2'));var jsonpatch=require(_0x93f4('0x3'));var rp=require(_0x93f4('0x4'));var moment=require('moment');var BPromise=require(_0x93f4('0x5'));var Mustache=require(_0x93f4('0x6'));var util=require('util');var path=require('path');var sox=require(_0x93f4('0x7'));var csv=require(_0x93f4('0x8'));var ejs=require(_0x93f4('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x93f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x93f4('0xb'));var deskjs=require(_0x93f4('0xc'));var toCsv=require(_0x93f4('0x8'));var querystring=require(_0x93f4('0xd'));var Papa=require(_0x93f4('0xe'));var Redis=require(_0x93f4('0xf'));var authService=require(_0x93f4('0x10'));var qs=require(_0x93f4('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x93f4('0x12'))(_0x93f4('0x13'));var utils=require(_0x93f4('0x14'));var config=require(_0x93f4('0x15'));var licenseUtil=require(_0x93f4('0x16'));var db=require(_0x93f4('0x17'))['db'];function respondWithStatusCode(_0x3109b7,_0x1d2edb){_0x1d2edb=_0x1d2edb||0xcc;return function(_0x54e7c6){if(_0x54e7c6){return _0x3109b7[_0x93f4('0x18')](_0x1d2edb);}return _0x3109b7['status'](_0x1d2edb)['end']();};}function respondWithResult(_0x86a454,_0x1d63ef){_0x1d63ef=_0x1d63ef||0xc8;return function(_0x1f8832){if(_0x1f8832){return _0x86a454['status'](_0x1d63ef)['json'](_0x1f8832);}};}function respondWithFilteredResult(_0x356da0,_0x40f50a){return function(_0x3fdf23){if(_0x3fdf23){var _0x5e4e32=_0x3fdf23[_0x93f4('0x19')],_0x33dfb3=_0x40f50a['offset'],_0x7e36d5=_0x40f50a['offset']+_0x40f50a[_0x93f4('0x1a')],_0x53151e;if(_0x7e36d5>=_0x5e4e32){_0x7e36d5=_0x5e4e32;_0x53151e=0xc8;}else{_0x53151e=0xce;}_0x356da0['status'](_0x53151e);return _0x356da0[_0x93f4('0x1b')]('Content-Range',_0x33dfb3+'-'+_0x7e36d5+'/'+_0x5e4e32)['json'](_0x3fdf23);}return null;};}function patchUpdates(_0x489cb8){return function(_0x1daa01){try{jsonpatch[_0x93f4('0x1c')](_0x1daa01,_0x489cb8,!![]);}catch(_0x525784){return BPromise[_0x93f4('0x1d')](_0x525784);}return _0x1daa01['save']();};}function saveUpdates(_0x3ead08,_0x3182d6){return function(_0xfb95e3){if(_0xfb95e3){return _0xfb95e3[_0x93f4('0x1e')](_0x3ead08)['then'](function(_0x4fde20){return _0x4fde20;});}return null;};}function removeEntity(_0x16f885,_0x432f99){return function(_0x5b0de8){if(_0x5b0de8){return _0x5b0de8['destroy']()['then'](function(){_0x16f885[_0x93f4('0x1f')](0xcc)[_0x93f4('0x20')]();});}};}function handleEntityNotFound(_0x475f0b,_0x4c87e3){return function(_0x31e249){if(!_0x31e249){_0x475f0b['sendStatus'](0x194);}return _0x31e249;};}function handleError(_0x20e337,_0xbd348){_0xbd348=_0xbd348||0x1f4;return function(_0x5afabf){logger[_0x93f4('0x21')](_0x5afabf[_0x93f4('0x22')]);if(_0x5afabf[_0x93f4('0x23')]){delete _0x5afabf[_0x93f4('0x23')];}_0x20e337['status'](_0xbd348)[_0x93f4('0x24')](_0x5afabf);};}exports[_0x93f4('0x25')]=function(_0x2fa1b1,_0x353ab7){var _0x590d52={},_0x2dfef0={},_0x9aba61={'count':0x0,'rows':[]};var _0x30606b=_[_0x93f4('0x26')](db[_0x93f4('0x27')][_0x93f4('0x28')],function(_0x47776e){return{'name':_0x47776e[_0x93f4('0x29')],'type':_0x47776e['type'][_0x93f4('0x2a')]};});_0x2dfef0[_0x93f4('0x2b')]=_['map'](_0x30606b,'name');_0x2dfef0[_0x93f4('0x2c')]=_['keys'](_0x2fa1b1[_0x93f4('0x2c')]);_0x2dfef0['filters']=_[_0x93f4('0x2d')](_0x2dfef0['model'],_0x2dfef0['query']);_0x590d52[_0x93f4('0x2e')]=_[_0x93f4('0x2d')](_0x2dfef0[_0x93f4('0x2b')],qs['fields'](_0x2fa1b1[_0x93f4('0x2c')][_0x93f4('0x2f')]));_0x590d52[_0x93f4('0x2e')]=_0x590d52[_0x93f4('0x2e')][_0x93f4('0x30')]?_0x590d52[_0x93f4('0x2e')]:_0x2dfef0[_0x93f4('0x2b')];if(!_0x2fa1b1[_0x93f4('0x2c')]['hasOwnProperty'](_0x93f4('0x31'))){_0x590d52[_0x93f4('0x1a')]=qs['limit'](_0x2fa1b1[_0x93f4('0x2c')][_0x93f4('0x1a')]);_0x590d52['offset']=qs['offset'](_0x2fa1b1[_0x93f4('0x2c')][_0x93f4('0x32')]);}_0x590d52[_0x93f4('0x33')]=qs[_0x93f4('0x34')](_0x2fa1b1[_0x93f4('0x2c')][_0x93f4('0x34')]);_0x590d52[_0x93f4('0x35')]=qs[_0x93f4('0x36')](_[_0x93f4('0x37')](_0x2fa1b1[_0x93f4('0x2c')],_0x2dfef0[_0x93f4('0x36')]),_0x30606b);if(_0x2fa1b1[_0x93f4('0x2c')][_0x93f4('0x38')]){_0x590d52[_0x93f4('0x35')]=_[_0x93f4('0x39')](_0x590d52[_0x93f4('0x35')],{'$or':_[_0x93f4('0x26')](_0x30606b,function(_0x31468d){if(_0x31468d['type']!==_0x93f4('0x3a')){var _0x4c0f9f={};_0x4c0f9f[_0x31468d[_0x93f4('0x23')]]={'$like':'%'+_0x2fa1b1[_0x93f4('0x2c')][_0x93f4('0x38')]+'%'};return _0x4c0f9f;}})});}_0x590d52=_[_0x93f4('0x39')]({},_0x590d52,_0x2fa1b1[_0x93f4('0x3b')]);var _0xeb97a6={'where':_0x590d52[_0x93f4('0x35')]};return db[_0x93f4('0x27')][_0x93f4('0x19')](_0xeb97a6)[_0x93f4('0x3c')](function(_0x20b814){_0x9aba61[_0x93f4('0x19')]=_0x20b814;if(_0x2fa1b1[_0x93f4('0x2c')][_0x93f4('0x3d')]){_0x590d52[_0x93f4('0x3e')]=[{'all':!![]}];}return db['OpenchannelQueueReport']['findAll'](_0x590d52);})['then'](function(_0x41b77f){_0x9aba61[_0x93f4('0x3f')]=_0x41b77f;return _0x9aba61;})[_0x93f4('0x3c')](respondWithFilteredResult(_0x353ab7,_0x590d52))[_0x93f4('0x40')](handleError(_0x353ab7,null));};exports['show']=function(_0x2c6309,_0x130227){var _0x2238d0={'raw':!![],'where':{'id':_0x2c6309[_0x93f4('0x41')]['id']}},_0x782e10={};_0x782e10[_0x93f4('0x2b')]=_[_0x93f4('0x42')](db[_0x93f4('0x27')][_0x93f4('0x28')]);_0x782e10[_0x93f4('0x2c')]=_['keys'](_0x2c6309[_0x93f4('0x2c')]);_0x782e10['filters']=_[_0x93f4('0x2d')](_0x782e10[_0x93f4('0x2b')],_0x782e10[_0x93f4('0x2c')]);_0x2238d0['attributes']=_[_0x93f4('0x2d')](_0x782e10[_0x93f4('0x2b')],qs[_0x93f4('0x2f')](_0x2c6309[_0x93f4('0x2c')]['fields']));_0x2238d0[_0x93f4('0x2e')]=_0x2238d0[_0x93f4('0x2e')][_0x93f4('0x30')]?_0x2238d0['attributes']:_0x782e10[_0x93f4('0x2b')];if(_0x2c6309[_0x93f4('0x2c')][_0x93f4('0x3d')]){_0x2238d0[_0x93f4('0x3e')]=[{'all':!![]}];}_0x2238d0=_[_0x93f4('0x39')]({},_0x2238d0,_0x2c6309[_0x93f4('0x3b')]);return db[_0x93f4('0x27')][_0x93f4('0x43')](_0x2238d0)[_0x93f4('0x3c')](handleEntityNotFound(_0x130227,null))[_0x93f4('0x3c')](respondWithResult(_0x130227,null))[_0x93f4('0x40')](handleError(_0x130227,null));};exports[_0x93f4('0x44')]=function(_0xc5dcd8,_0x2964ca){return db[_0x93f4('0x27')]['create'](_0xc5dcd8[_0x93f4('0x45')],{})[_0x93f4('0x3c')](respondWithResult(_0x2964ca,0xc9))[_0x93f4('0x40')](handleError(_0x2964ca,null));};exports[_0x93f4('0x1e')]=function(_0x248bdf,_0x15f48f){if(_0x248bdf['body']['id']){delete _0x248bdf[_0x93f4('0x45')]['id'];}return db[_0x93f4('0x27')]['find']({'where':{'id':_0x248bdf[_0x93f4('0x41')]['id']}})[_0x93f4('0x3c')](handleEntityNotFound(_0x15f48f,null))[_0x93f4('0x3c')](saveUpdates(_0x248bdf[_0x93f4('0x45')],null))['then'](respondWithResult(_0x15f48f,null))[_0x93f4('0x40')](handleError(_0x15f48f,null));};exports[_0x93f4('0x46')]=function(_0x467e5b,_0x48352b){return db[_0x93f4('0x27')][_0x93f4('0x43')]({'where':{'id':_0x467e5b[_0x93f4('0x41')]['id']}})[_0x93f4('0x3c')](handleEntityNotFound(_0x48352b,null))['then'](removeEntity(_0x48352b,null))['catch'](handleError(_0x48352b,null));};exports[_0x93f4('0x47')]=function(_0x22421e,_0x6b274a){return db[_0x93f4('0x27')][_0x93f4('0x47')]()[_0x93f4('0x3c')](respondWithResult(_0x6b274a,null))[_0x93f4('0x40')](handleError(_0x6b274a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 864a62f..2c7f8ac 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 _0x34c6=['./openchannelQueueReport.attributes','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x447926,_0x15cdcc){var _0x387a18=function(_0xea5781){while(--_0xea5781){_0x447926['push'](_0x447926['shift']());}};_0x387a18(++_0x15cdcc);}(_0x34c6,0x1cd));var _0x634c=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x34c6[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x634c('0x0'));var util=require('util');var logger=require(_0x634c('0x1'))(_0x634c('0x2'));var moment=require(_0x634c('0x3'));var BPromise=require(_0x634c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x634c('0x5'));var config=require(_0x634c('0x6'));var attributes=require(_0x634c('0x7'));module['exports']=function(_0x2aab37,_0x550409){return _0x2aab37[_0x634c('0x8')](_0x634c('0x9'),attributes,{'tableName':_0x634c('0xa'),'paranoid':![],'indexes':[{'name':_0x634c('0xb'),'fields':[_0x634c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28a2=['moment','bluebird','request-promise','rimraf','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var logger=require(_0x228a('0x2'))(_0x228a('0x3'));var moment=require(_0x228a('0x4'));var BPromise=require(_0x228a('0x5'));var rp=require(_0x228a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x228a('0x7'));var config=require('../../config/environment');var attributes=require(_0x228a('0x8'));module[_0x228a('0x9')]=function(_0x17727b,_0xf86d1d){return _0x17727b[_0x228a('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x228a('0xb'),'paranoid':![],'indexes':[{'name':_0x228a('0xc'),'fields':[_0x228a('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 2326265..de135dd 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 _0xc09a=['http','request','then','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc09a,0x137));var _0xac09=function(_0x47e75e,_0x410f1b){_0x47e75e=_0x47e75e-0x0;var _0x5ef6cf=_0xc09a[_0x47e75e];return _0x5ef6cf;};'use strict';var _=require(_0xac09('0x0'));var util=require(_0xac09('0x1'));var moment=require(_0xac09('0x2'));var BPromise=require(_0xac09('0x3'));var rs=require(_0xac09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac09('0x5'));var logger=require(_0xac09('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xac09('0x7'));var client=jayson[_0xac09('0x8')][_0xac09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x128ea9,_0x19778a,_0x33a601){return new BPromise(function(_0x43cf45,_0x705cfc){return client[_0xac09('0xa')](_0x128ea9,_0x33a601)[_0xac09('0xb')](function(_0x4f3d24){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x19778a,'request\x20sent');logger[_0xac09('0xc')](_0xac09('0xd'),_0x19778a,_0xac09('0xe'),JSON[_0xac09('0xf')](_0x4f3d24));if(_0x4f3d24[_0xac09('0x10')]){if(_0x4f3d24['error'][_0xac09('0x11')]===0x1f4){logger[_0xac09('0x10')](_0xac09('0x12'),_0x19778a,_0x4f3d24['error']['message']);return _0x705cfc(_0x4f3d24[_0xac09('0x10')][_0xac09('0x13')]);}logger[_0xac09('0x10')](_0xac09('0x12'),_0x19778a,_0x4f3d24[_0xac09('0x10')]['message']);return _0x43cf45(_0x4f3d24[_0xac09('0x10')][_0xac09('0x13')]);}else{logger[_0xac09('0x14')](_0xac09('0x12'),_0x19778a,_0xac09('0xe'));_0x43cf45(_0x4f3d24[_0xac09('0x15')][_0xac09('0x13')]);}})[_0xac09('0x16')](function(_0x19860a){logger[_0xac09('0x10')](_0xac09('0x12'),_0x19778a,_0x19860a);_0x705cfc(_0x19860a);});});}exports[_0xac09('0x17')]=function(_0xee2731){var _0x255d61=this;return new Promise(function(_0x3ef657,_0x44f837){return db[_0xac09('0x18')][_0xac09('0x19')](_0xee2731[_0xac09('0x1a')],{'raw':_0xee2731[_0xac09('0x1b')]?_0xee2731['options'][_0xac09('0x1c')]===undefined?!![]:![]:!![]})[_0xac09('0xb')](function(_0x2e6416){logger['info']('CreateOpenchannelQueueReport',_0xee2731);logger[_0xac09('0xc')](_0xac09('0x17'),_0xee2731,JSON[_0xac09('0xf')](_0x2e6416));_0x3ef657(_0x2e6416);})[_0xac09('0x16')](function(_0x5ef333){logger[_0xac09('0x10')]('CreateOpenchannelQueueReport',_0x5ef333[_0xac09('0x13')],_0xee2731);_0x44f837(_0x255d61[_0xac09('0x10')](0x1f4,_0x5ef333['message']));});});};exports[_0xac09('0x1d')]=function(_0x447cdb){var _0x8a8b9a=this;return new Promise(function(_0x1c7a20,_0x553bba){return db[_0xac09('0x18')]['update'](_0x447cdb['body'],{'raw':_0x447cdb[_0xac09('0x1b')]?_0x447cdb[_0xac09('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x447cdb[_0xac09('0x1b')]?_0x447cdb['options'][_0xac09('0x1e')]||null:null,'attributes':_0x447cdb[_0xac09('0x1b')]?_0x447cdb[_0xac09('0x1b')][_0xac09('0x1f')]||null:null,'limit':_0x447cdb[_0xac09('0x1b')]?_0x447cdb[_0xac09('0x1b')]['limit']||null:null})[_0xac09('0xb')](function(_0x58f337){logger['info'](_0xac09('0x1d'),_0x447cdb);logger['debug'](_0xac09('0x1d'),_0x447cdb,JSON[_0xac09('0xf')](_0x58f337));_0x1c7a20(_0x58f337);})[_0xac09('0x16')](function(_0x327e7d){logger[_0xac09('0x10')](_0xac09('0x1d'),_0x327e7d[_0xac09('0x13')],_0x447cdb);_0x553bba(_0x8a8b9a[_0xac09('0x10')](0x1f4,_0x327e7d[_0xac09('0x13')]));});});}; \ No newline at end of file +var _0x667b=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','body','options','raw','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','where'];(function(_0x2f9499,_0x71865f){var _0xf4ba08=function(_0x12b2cf){while(--_0x12b2cf){_0x2f9499['push'](_0x2f9499['shift']());}};_0xf4ba08(++_0x71865f);}(_0x667b,0x117));var _0xb667=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x667b[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require(_0xb667('0x0'));var moment=require('moment');var BPromise=require(_0xb667('0x1'));var rs=require(_0xb667('0x2'));var fs=require('fs');var Redis=require(_0xb667('0x3'));var db=require(_0xb667('0x4'))['db'];var utils=require(_0xb667('0x5'));var logger=require(_0xb667('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb667('0x7'));var client=jayson[_0xb667('0x8')][_0xb667('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3495a0,_0x1f5227,_0x25505e){return new BPromise(function(_0x2bf14f,_0xaddc65){return client[_0xb667('0xa')](_0x3495a0,_0x25505e)[_0xb667('0xb')](function(_0x21d7e3){logger[_0xb667('0xc')](_0xb667('0xd'),_0x1f5227,_0xb667('0xe'));logger['debug'](_0xb667('0xf'),_0x1f5227,_0xb667('0xe'),JSON[_0xb667('0x10')](_0x21d7e3));if(_0x21d7e3[_0xb667('0x11')]){if(_0x21d7e3[_0xb667('0x11')][_0xb667('0x12')]===0x1f4){logger[_0xb667('0x11')](_0xb667('0xd'),_0x1f5227,_0x21d7e3[_0xb667('0x11')]['message']);return _0xaddc65(_0x21d7e3[_0xb667('0x11')][_0xb667('0x13')]);}logger[_0xb667('0x11')](_0xb667('0xd'),_0x1f5227,_0x21d7e3[_0xb667('0x11')][_0xb667('0x13')]);return _0x2bf14f(_0x21d7e3[_0xb667('0x11')][_0xb667('0x13')]);}else{logger[_0xb667('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x1f5227,_0xb667('0xe'));_0x2bf14f(_0x21d7e3[_0xb667('0x14')][_0xb667('0x13')]);}})[_0xb667('0x15')](function(_0x3985c0){logger[_0xb667('0x11')](_0xb667('0xd'),_0x1f5227,_0x3985c0);_0xaddc65(_0x3985c0);});});}exports['CreateOpenchannelQueueReport']=function(_0x10cda3){var _0x5d7402=this;return new Promise(function(_0x40955a,_0x3ee0fd){return db[_0xb667('0x16')]['create'](_0x10cda3[_0xb667('0x17')],{'raw':_0x10cda3[_0xb667('0x18')]?_0x10cda3[_0xb667('0x18')][_0xb667('0x19')]===undefined?!![]:![]:!![]})[_0xb667('0xb')](function(_0x3b77ef){logger[_0xb667('0xc')](_0xb667('0x1a'),_0x10cda3);logger[_0xb667('0x1b')]('CreateOpenchannelQueueReport',_0x10cda3,JSON['stringify'](_0x3b77ef));_0x40955a(_0x3b77ef);})['catch'](function(_0x16d357){logger[_0xb667('0x11')](_0xb667('0x1a'),_0x16d357[_0xb667('0x13')],_0x10cda3);_0x3ee0fd(_0x5d7402['error'](0x1f4,_0x16d357['message']));});});};exports[_0xb667('0x1c')]=function(_0x32ddb1){var _0x1f6651=this;return new Promise(function(_0x4e9d65,_0x17be8f){return db['OpenchannelQueueReport'][_0xb667('0x1d')](_0x32ddb1[_0xb667('0x17')],{'raw':_0x32ddb1[_0xb667('0x18')]?_0x32ddb1[_0xb667('0x18')][_0xb667('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32ddb1[_0xb667('0x18')]?_0x32ddb1[_0xb667('0x18')][_0xb667('0x1e')]||null:null,'attributes':_0x32ddb1[_0xb667('0x18')]?_0x32ddb1[_0xb667('0x18')]['attributes']||null:null,'limit':_0x32ddb1[_0xb667('0x18')]?_0x32ddb1[_0xb667('0x18')]['limit']||null:null})[_0xb667('0xb')](function(_0x54ba28){logger[_0xb667('0xc')](_0xb667('0x1c'),_0x32ddb1);logger[_0xb667('0x1b')](_0xb667('0x1c'),_0x32ddb1,JSON[_0xb667('0x10')](_0x54ba28));_0x4e9d65(_0x54ba28);})[_0xb667('0x15')](function(_0x1343e6){logger[_0xb667('0x11')](_0xb667('0x1c'),_0x1343e6[_0xb667('0x13')],_0x32ddb1);_0x17be8f(_0x1f6651[_0xb667('0x11')](0x1f4,_0x1343e6[_0xb667('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 8b18627..3aced5a 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 1b38009..3a2a682 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 _0x1064=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x1064,0x153));var _0x4106=function(_0x81f39d,_0x507863){_0x81f39d=_0x81f39d-0x0;var _0x3884ce=_0x1064[_0x81f39d];return _0x3884ce;};'use strict';var moment=require('moment');var Sequelize=require(_0x4106('0x0'));module[_0x4106('0x1')]={'uniqueid':{'type':Sequelize[_0x4106('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4106('0x3')](_0x4106('0x4'),_0x4106('0x5'),'queue'),'allowNull':![],'defaultValue':_0x4106('0x6')},'transferredAt':{'type':Sequelize[_0x4106('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcdca=['sequelize','exports','ENUM','agent','queue','NOW','moment'];(function(_0x3aa93a,_0x5d6c6c){var _0x525a71=function(_0x2a7f0f){while(--_0x2a7f0f){_0x3aa93a['push'](_0x3aa93a['shift']());}};_0x525a71(++_0x5d6c6c);}(_0xcdca,0xca));var _0xacdc=function(_0x1145af,_0xae3e9c){_0x1145af=_0x1145af-0x0;var _0x58b733=_0xcdca[_0x1145af];return _0x58b733;};'use strict';var moment=require(_0xacdc('0x0'));var Sequelize=require(_0xacdc('0x1'));module[_0xacdc('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xacdc('0x3')]('account',_0xacdc('0x4'),'queue'),'allowNull':![],'defaultValue':_0xacdc('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xacdc('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index c98fbd3..792f0f9 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 _0x885e=['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/environment','../../config/license/util','status','end','json','count','offset','limit','set','apply','reject','save','update','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','findAll','rows','catch','show','params','keys','include','body','find','destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x885e,0x8d));var _0xe885=function(_0x528c33,_0x4e4ef1){_0x528c33=_0x528c33-0x0;var _0x5b65cb=_0x885e[_0x528c33];return _0x5b65cb;};'use strict';var pdf=require(_0xe885('0x0'));var emlformat=require(_0xe885('0x1'));var rimraf=require(_0xe885('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe885('0x3'));var moment=require(_0xe885('0x4'));var BPromise=require(_0xe885('0x5'));var Mustache=require(_0xe885('0x6'));var util=require(_0xe885('0x7'));var path=require('path');var sox=require(_0xe885('0x8'));var csv=require(_0xe885('0x9'));var ejs=require(_0xe885('0xa'));var fs=require('fs');var _=require(_0xe885('0xb'));var squel=require(_0xe885('0xc'));var crypto=require(_0xe885('0xd'));var jsforce=require(_0xe885('0xe'));var deskjs=require(_0xe885('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe885('0x10'));var Papa=require(_0xe885('0x11'));var Redis=require('ioredis');var authService=require(_0xe885('0x12'));var qs=require(_0xe885('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe885('0x14'));var logger=require(_0xe885('0x15'))(_0xe885('0x16'));var utils=require(_0xe885('0x17'));var config=require(_0xe885('0x18'));var licenseUtil=require(_0xe885('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x487b3c,_0x1d0a8d){_0x1d0a8d=_0x1d0a8d||0xcc;return function(_0x3e4bf4){if(_0x3e4bf4){return _0x487b3c['sendStatus'](_0x1d0a8d);}return _0x487b3c[_0xe885('0x1a')](_0x1d0a8d)[_0xe885('0x1b')]();};}function respondWithResult(_0x408785,_0x3d5e19){_0x3d5e19=_0x3d5e19||0xc8;return function(_0x372a51){if(_0x372a51){return _0x408785[_0xe885('0x1a')](_0x3d5e19)[_0xe885('0x1c')](_0x372a51);}};}function respondWithFilteredResult(_0x496cf5,_0x23ba9c){return function(_0x4a0b35){if(_0x4a0b35){var _0x2c76ce=_0x4a0b35[_0xe885('0x1d')],_0xacf7a4=_0x23ba9c[_0xe885('0x1e')],_0x5e1ddf=_0x23ba9c[_0xe885('0x1e')]+_0x23ba9c[_0xe885('0x1f')],_0x263e11;if(_0x5e1ddf>=_0x2c76ce){_0x5e1ddf=_0x2c76ce;_0x263e11=0xc8;}else{_0x263e11=0xce;}_0x496cf5[_0xe885('0x1a')](_0x263e11);return _0x496cf5[_0xe885('0x20')]('Content-Range',_0xacf7a4+'-'+_0x5e1ddf+'/'+_0x2c76ce)[_0xe885('0x1c')](_0x4a0b35);}return null;};}function patchUpdates(_0x31bba4){return function(_0xbe62a0){try{jsonpatch[_0xe885('0x21')](_0xbe62a0,_0x31bba4,!![]);}catch(_0x4f630c){return BPromise[_0xe885('0x22')](_0x4f630c);}return _0xbe62a0[_0xe885('0x23')]();};}function saveUpdates(_0x37fc13,_0x253477){return function(_0xf75f33){if(_0xf75f33){return _0xf75f33[_0xe885('0x24')](_0x37fc13)['then'](function(_0x342e27){return _0x342e27;});}return null;};}function removeEntity(_0x84ed5,_0x177def){return function(_0x3603f3){if(_0x3603f3){return _0x3603f3['destroy']()['then'](function(){_0x84ed5['status'](0xcc)[_0xe885('0x1b')]();});}};}function handleEntityNotFound(_0x53facf,_0x39733c){return function(_0x4b863f){if(!_0x4b863f){_0x53facf['sendStatus'](0x194);}return _0x4b863f;};}function handleError(_0x367e52,_0x5c653a){_0x5c653a=_0x5c653a||0x1f4;return function(_0xe928c7){logger['error'](_0xe928c7[_0xe885('0x25')]);if(_0xe928c7['name']){delete _0xe928c7[_0xe885('0x26')];}_0x367e52[_0xe885('0x1a')](_0x5c653a)[_0xe885('0x27')](_0xe928c7);};}exports[_0xe885('0x28')]=function(_0x5d452f,_0x406fc9){var _0xb36574={},_0x469cb0={},_0x5c67e3={'count':0x0,'rows':[]};var _0x11c3c2=_[_0xe885('0x29')](db[_0xe885('0x2a')][_0xe885('0x2b')],function(_0x5046a3){return{'name':_0x5046a3[_0xe885('0x2c')],'type':_0x5046a3[_0xe885('0x2d')][_0xe885('0x2e')]};});_0x469cb0[_0xe885('0x2f')]=_[_0xe885('0x29')](_0x11c3c2,_0xe885('0x26'));_0x469cb0[_0xe885('0x30')]=_['keys'](_0x5d452f[_0xe885('0x30')]);_0x469cb0[_0xe885('0x31')]=_[_0xe885('0x32')](_0x469cb0[_0xe885('0x2f')],_0x469cb0[_0xe885('0x30')]);_0xb36574['attributes']=_[_0xe885('0x32')](_0x469cb0[_0xe885('0x2f')],qs[_0xe885('0x33')](_0x5d452f[_0xe885('0x30')][_0xe885('0x33')]));_0xb36574[_0xe885('0x34')]=_0xb36574[_0xe885('0x34')][_0xe885('0x35')]?_0xb36574[_0xe885('0x34')]:_0x469cb0[_0xe885('0x2f')];if(!_0x5d452f[_0xe885('0x30')][_0xe885('0x36')](_0xe885('0x37'))){_0xb36574['limit']=qs[_0xe885('0x1f')](_0x5d452f[_0xe885('0x30')][_0xe885('0x1f')]);_0xb36574[_0xe885('0x1e')]=qs['offset'](_0x5d452f[_0xe885('0x30')][_0xe885('0x1e')]);}_0xb36574[_0xe885('0x38')]=qs[_0xe885('0x39')](_0x5d452f[_0xe885('0x30')]['sort']);_0xb36574[_0xe885('0x3a')]=qs[_0xe885('0x31')](_[_0xe885('0x3b')](_0x5d452f['query'],_0x469cb0[_0xe885('0x31')]),_0x11c3c2);if(_0x5d452f[_0xe885('0x30')][_0xe885('0x3c')]){_0xb36574['where']=_[_0xe885('0x3d')](_0xb36574[_0xe885('0x3a')],{'$or':_['map'](_0x11c3c2,function(_0x208d6f){if(_0x208d6f[_0xe885('0x2d')]!=='VIRTUAL'){var _0x219975={};_0x219975[_0x208d6f['name']]={'$like':'%'+_0x5d452f['query'][_0xe885('0x3c')]+'%'};return _0x219975;}})});}_0xb36574=_[_0xe885('0x3d')]({},_0xb36574,_0x5d452f[_0xe885('0x3e')]);var _0x2f5c79={'where':_0xb36574[_0xe885('0x3a')]};return db['OpenchannelTransferReport'][_0xe885('0x1d')](_0x2f5c79)[_0xe885('0x3f')](function(_0x54deef){_0x5c67e3['count']=_0x54deef;if(_0x5d452f[_0xe885('0x30')]['includeAll']){_0xb36574['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xe885('0x40')](_0xb36574);})[_0xe885('0x3f')](function(_0xfddcd8){_0x5c67e3[_0xe885('0x41')]=_0xfddcd8;return _0x5c67e3;})['then'](respondWithFilteredResult(_0x406fc9,_0xb36574))[_0xe885('0x42')](handleError(_0x406fc9,null));};exports[_0xe885('0x43')]=function(_0x3ed3b1,_0xf978c4){var _0x3ecdf2={'raw':!![],'where':{'id':_0x3ed3b1[_0xe885('0x44')]['id']}},_0x28d0ee={};_0x28d0ee[_0xe885('0x2f')]=_[_0xe885('0x45')](db[_0xe885('0x2a')][_0xe885('0x2b')]);_0x28d0ee[_0xe885('0x30')]=_[_0xe885('0x45')](_0x3ed3b1['query']);_0x28d0ee[_0xe885('0x31')]=_[_0xe885('0x32')](_0x28d0ee[_0xe885('0x2f')],_0x28d0ee['query']);_0x3ecdf2[_0xe885('0x34')]=_[_0xe885('0x32')](_0x28d0ee[_0xe885('0x2f')],qs[_0xe885('0x33')](_0x3ed3b1[_0xe885('0x30')][_0xe885('0x33')]));_0x3ecdf2[_0xe885('0x34')]=_0x3ecdf2[_0xe885('0x34')]['length']?_0x3ecdf2['attributes']:_0x28d0ee[_0xe885('0x2f')];if(_0x3ed3b1[_0xe885('0x30')]['includeAll']){_0x3ecdf2[_0xe885('0x46')]=[{'all':!![]}];}_0x3ecdf2=_[_0xe885('0x3d')]({},_0x3ecdf2,_0x3ed3b1[_0xe885('0x3e')]);return db[_0xe885('0x2a')]['find'](_0x3ecdf2)['then'](handleEntityNotFound(_0xf978c4,null))[_0xe885('0x3f')](respondWithResult(_0xf978c4,null))['catch'](handleError(_0xf978c4,null));};exports['create']=function(_0xb90d4,_0x362cbf){return db[_0xe885('0x2a')]['create'](_0xb90d4['body'],{})[_0xe885('0x3f')](respondWithResult(_0x362cbf,0xc9))[_0xe885('0x42')](handleError(_0x362cbf,null));};exports[_0xe885('0x24')]=function(_0x15c4a0,_0x95b5b){if(_0x15c4a0[_0xe885('0x47')]['id']){delete _0x15c4a0['body']['id'];}return db[_0xe885('0x2a')][_0xe885('0x48')]({'where':{'id':_0x15c4a0[_0xe885('0x44')]['id']}})[_0xe885('0x3f')](handleEntityNotFound(_0x95b5b,null))[_0xe885('0x3f')](saveUpdates(_0x15c4a0[_0xe885('0x47')],null))[_0xe885('0x3f')](respondWithResult(_0x95b5b,null))[_0xe885('0x42')](handleError(_0x95b5b,null));};exports[_0xe885('0x49')]=function(_0x4bc914,_0x560dd8){return db[_0xe885('0x2a')][_0xe885('0x48')]({'where':{'id':_0x4bc914[_0xe885('0x44')]['id']}})[_0xe885('0x3f')](handleEntityNotFound(_0x560dd8,null))[_0xe885('0x3f')](removeEntity(_0x560dd8,null))[_0xe885('0x42')](handleError(_0x560dd8,null));};exports['describe']=function(_0x405e0a,_0x23cc1f){return db['OpenchannelTransferReport'][_0xe885('0x4a')]()[_0xe885('0x3f')](respondWithResult(_0x23cc1f,null))[_0xe885('0x42')](handleError(_0x23cc1f,null));}; \ No newline at end of file +var _0x707b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','rows','show','includeAll','find','catch','create','update','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis'];(function(_0x2eb166,_0xd9613c){var _0x1197d6=function(_0x465ab6){while(--_0x465ab6){_0x2eb166['push'](_0x2eb166['shift']());}};_0x1197d6(++_0xd9613c);}(_0x707b,0x11f));var _0xb707=function(_0x30662f,_0x4d202e){_0x30662f=_0x30662f-0x0;var _0x40d038=_0x707b[_0x30662f];return _0x40d038;};'use strict';var pdf=require(_0xb707('0x0'));var emlformat=require(_0xb707('0x1'));var rimraf=require(_0xb707('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb707('0x3'));var rp=require('request-promise');var moment=require(_0xb707('0x4'));var BPromise=require(_0xb707('0x5'));var Mustache=require(_0xb707('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb707('0x7'));var csv=require('to-csv');var ejs=require(_0xb707('0x8'));var fs=require('fs');var _=require(_0xb707('0x9'));var squel=require(_0xb707('0xa'));var crypto=require(_0xb707('0xb'));var jsforce=require(_0xb707('0xc'));var deskjs=require(_0xb707('0xd'));var toCsv=require(_0xb707('0xe'));var querystring=require('querystring');var Papa=require(_0xb707('0xf'));var Redis=require(_0xb707('0x10'));var authService=require(_0xb707('0x11'));var qs=require(_0xb707('0x12'));var as=require(_0xb707('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb707('0x14'));var utils=require(_0xb707('0x15'));var config=require(_0xb707('0x16'));var licenseUtil=require(_0xb707('0x17'));var db=require(_0xb707('0x18'))['db'];function respondWithStatusCode(_0xd06556,_0x4fd308){_0x4fd308=_0x4fd308||0xcc;return function(_0x38c8b2){if(_0x38c8b2){return _0xd06556['sendStatus'](_0x4fd308);}return _0xd06556[_0xb707('0x19')](_0x4fd308)['end']();};}function respondWithResult(_0xb0c331,_0x43b846){_0x43b846=_0x43b846||0xc8;return function(_0x372482){if(_0x372482){return _0xb0c331[_0xb707('0x19')](_0x43b846)[_0xb707('0x1a')](_0x372482);}};}function respondWithFilteredResult(_0x1190a3,_0xe8cc93){return function(_0x155dfa){if(_0x155dfa){var _0x1fa0ee=_0x155dfa[_0xb707('0x1b')],_0x54bf60=_0xe8cc93['offset'],_0x591978=_0xe8cc93[_0xb707('0x1c')]+_0xe8cc93[_0xb707('0x1d')],_0x42feab;if(_0x591978>=_0x1fa0ee){_0x591978=_0x1fa0ee;_0x42feab=0xc8;}else{_0x42feab=0xce;}_0x1190a3[_0xb707('0x19')](_0x42feab);return _0x1190a3[_0xb707('0x1e')]('Content-Range',_0x54bf60+'-'+_0x591978+'/'+_0x1fa0ee)[_0xb707('0x1a')](_0x155dfa);}return null;};}function patchUpdates(_0x385a20){return function(_0x5a0f10){try{jsonpatch[_0xb707('0x1f')](_0x5a0f10,_0x385a20,!![]);}catch(_0x22821d){return BPromise[_0xb707('0x20')](_0x22821d);}return _0x5a0f10[_0xb707('0x21')]();};}function saveUpdates(_0x522457,_0x5ddbec){return function(_0x19d1a9){if(_0x19d1a9){return _0x19d1a9['update'](_0x522457)[_0xb707('0x22')](function(_0x20fa6f){return _0x20fa6f;});}return null;};}function removeEntity(_0x2e8eca,_0x34a579){return function(_0x11b40b){if(_0x11b40b){return _0x11b40b[_0xb707('0x23')]()[_0xb707('0x22')](function(){_0x2e8eca['status'](0xcc)[_0xb707('0x24')]();});}};}function handleEntityNotFound(_0x3d38c2,_0x361f8d){return function(_0x3c316b){if(!_0x3c316b){_0x3d38c2[_0xb707('0x25')](0x194);}return _0x3c316b;};}function handleError(_0x36a68b,_0x58719e){_0x58719e=_0x58719e||0x1f4;return function(_0xa463df){logger[_0xb707('0x26')](_0xa463df[_0xb707('0x27')]);if(_0xa463df[_0xb707('0x28')]){delete _0xa463df[_0xb707('0x28')];}_0x36a68b['status'](_0x58719e)[_0xb707('0x29')](_0xa463df);};}exports[_0xb707('0x2a')]=function(_0x44ff55,_0x1b275e){var _0xc92d54={},_0x5cf12f={},_0x2ad3c3={'count':0x0,'rows':[]};var _0x2460cc=_[_0xb707('0x2b')](db[_0xb707('0x2c')][_0xb707('0x2d')],function(_0x42b139){return{'name':_0x42b139['fieldName'],'type':_0x42b139[_0xb707('0x2e')]['key']};});_0x5cf12f['model']=_[_0xb707('0x2b')](_0x2460cc,_0xb707('0x28'));_0x5cf12f[_0xb707('0x2f')]=_[_0xb707('0x30')](_0x44ff55[_0xb707('0x2f')]);_0x5cf12f[_0xb707('0x31')]=_[_0xb707('0x32')](_0x5cf12f[_0xb707('0x33')],_0x5cf12f[_0xb707('0x2f')]);_0xc92d54[_0xb707('0x34')]=_['intersection'](_0x5cf12f[_0xb707('0x33')],qs[_0xb707('0x35')](_0x44ff55[_0xb707('0x2f')][_0xb707('0x35')]));_0xc92d54[_0xb707('0x34')]=_0xc92d54[_0xb707('0x34')][_0xb707('0x36')]?_0xc92d54[_0xb707('0x34')]:_0x5cf12f[_0xb707('0x33')];if(!_0x44ff55['query'][_0xb707('0x37')](_0xb707('0x38'))){_0xc92d54['limit']=qs[_0xb707('0x1d')](_0x44ff55[_0xb707('0x2f')][_0xb707('0x1d')]);_0xc92d54[_0xb707('0x1c')]=qs[_0xb707('0x1c')](_0x44ff55[_0xb707('0x2f')][_0xb707('0x1c')]);}_0xc92d54[_0xb707('0x39')]=qs[_0xb707('0x3a')](_0x44ff55[_0xb707('0x2f')][_0xb707('0x3a')]);_0xc92d54['where']=qs[_0xb707('0x31')](_[_0xb707('0x3b')](_0x44ff55[_0xb707('0x2f')],_0x5cf12f[_0xb707('0x31')]),_0x2460cc);if(_0x44ff55[_0xb707('0x2f')][_0xb707('0x3c')]){_0xc92d54[_0xb707('0x3d')]=_[_0xb707('0x3e')](_0xc92d54[_0xb707('0x3d')],{'$or':_[_0xb707('0x2b')](_0x2460cc,function(_0x351927){if(_0x351927[_0xb707('0x2e')]!==_0xb707('0x3f')){var _0x5937bc={};_0x5937bc[_0x351927[_0xb707('0x28')]]={'$like':'%'+_0x44ff55[_0xb707('0x2f')][_0xb707('0x3c')]+'%'};return _0x5937bc;}})});}_0xc92d54=_['merge']({},_0xc92d54,_0x44ff55[_0xb707('0x40')]);var _0x15ad04={'where':_0xc92d54[_0xb707('0x3d')]};return db[_0xb707('0x2c')][_0xb707('0x1b')](_0x15ad04)[_0xb707('0x22')](function(_0x261b89){_0x2ad3c3[_0xb707('0x1b')]=_0x261b89;if(_0x44ff55[_0xb707('0x2f')]['includeAll']){_0xc92d54[_0xb707('0x41')]=[{'all':!![]}];}return db[_0xb707('0x2c')]['findAll'](_0xc92d54);})[_0xb707('0x22')](function(_0x4f9779){_0x2ad3c3[_0xb707('0x42')]=_0x4f9779;return _0x2ad3c3;})[_0xb707('0x22')](respondWithFilteredResult(_0x1b275e,_0xc92d54))['catch'](handleError(_0x1b275e,null));};exports[_0xb707('0x43')]=function(_0x798295,_0x535c25){var _0x72266f={'raw':!![],'where':{'id':_0x798295['params']['id']}},_0x2463c6={};_0x2463c6[_0xb707('0x33')]=_[_0xb707('0x30')](db[_0xb707('0x2c')]['rawAttributes']);_0x2463c6['query']=_[_0xb707('0x30')](_0x798295[_0xb707('0x2f')]);_0x2463c6[_0xb707('0x31')]=_[_0xb707('0x32')](_0x2463c6['model'],_0x2463c6['query']);_0x72266f[_0xb707('0x34')]=_[_0xb707('0x32')](_0x2463c6[_0xb707('0x33')],qs[_0xb707('0x35')](_0x798295[_0xb707('0x2f')][_0xb707('0x35')]));_0x72266f['attributes']=_0x72266f['attributes'][_0xb707('0x36')]?_0x72266f[_0xb707('0x34')]:_0x2463c6[_0xb707('0x33')];if(_0x798295[_0xb707('0x2f')][_0xb707('0x44')]){_0x72266f[_0xb707('0x41')]=[{'all':!![]}];}_0x72266f=_[_0xb707('0x3e')]({},_0x72266f,_0x798295['options']);return db[_0xb707('0x2c')][_0xb707('0x45')](_0x72266f)[_0xb707('0x22')](handleEntityNotFound(_0x535c25,null))[_0xb707('0x22')](respondWithResult(_0x535c25,null))[_0xb707('0x46')](handleError(_0x535c25,null));};exports[_0xb707('0x47')]=function(_0x103120,_0x156b88){return db[_0xb707('0x2c')][_0xb707('0x47')](_0x103120['body'],{})['then'](respondWithResult(_0x156b88,0xc9))[_0xb707('0x46')](handleError(_0x156b88,null));};exports[_0xb707('0x48')]=function(_0x30cccb,_0xb6a19b){if(_0x30cccb[_0xb707('0x49')]['id']){delete _0x30cccb[_0xb707('0x49')]['id'];}return db[_0xb707('0x2c')][_0xb707('0x45')]({'where':{'id':_0x30cccb[_0xb707('0x4a')]['id']}})[_0xb707('0x22')](handleEntityNotFound(_0xb6a19b,null))['then'](saveUpdates(_0x30cccb[_0xb707('0x49')],null))[_0xb707('0x22')](respondWithResult(_0xb6a19b,null))[_0xb707('0x46')](handleError(_0xb6a19b,null));};exports[_0xb707('0x23')]=function(_0x530b82,_0x2204c1){return db[_0xb707('0x2c')][_0xb707('0x45')]({'where':{'id':_0x530b82[_0xb707('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2204c1,null))['then'](removeEntity(_0x2204c1,null))[_0xb707('0x46')](handleError(_0x2204c1,null));};exports[_0xb707('0x4b')]=function(_0x393042,_0x3fdde9){return db[_0xb707('0x2c')][_0xb707('0x4b')]()['then'](respondWithResult(_0x3fdde9,null))['catch'](handleError(_0x3fdde9,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f30fb12..595a9d5 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 _0xa8e8=['define','OpenchannelTransferReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0xa8e8,0xcf));var _0x8a8e=function(_0x460013,_0x2ebc73){_0x460013=_0x460013-0x0;var _0x55924f=_0xa8e8[_0x460013];return _0x55924f;};'use strict';var _=require('lodash');var util=require(_0x8a8e('0x0'));var logger=require(_0x8a8e('0x1'))(_0x8a8e('0x2'));var moment=require('moment');var BPromise=require(_0x8a8e('0x3'));var rp=require(_0x8a8e('0x4'));var fs=require('fs');var path=require(_0x8a8e('0x5'));var rimraf=require(_0x8a8e('0x6'));var config=require(_0x8a8e('0x7'));var attributes=require(_0x8a8e('0x8'));module['exports']=function(_0x3e7531,_0x272022){return _0x3e7531[_0x8a8e('0x9')](_0x8a8e('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8a8e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6405=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x62765a,_0x390c3e){var _0x178c2e=function(_0x3cf6fe){while(--_0x3cf6fe){_0x62765a['push'](_0x62765a['shift']());}};_0x178c2e(++_0x390c3e);}(_0x6405,0x1e1));var _0x5640=function(_0x139c57,_0xa22f9e){_0x139c57=_0x139c57-0x0;var _0x262126=_0x6405[_0x139c57];return _0x262126;};'use strict';var _=require(_0x5640('0x0'));var util=require(_0x5640('0x1'));var logger=require(_0x5640('0x2'))(_0x5640('0x3'));var moment=require('moment');var BPromise=require(_0x5640('0x4'));var rp=require(_0x5640('0x5'));var fs=require('fs');var path=require(_0x5640('0x6'));var rimraf=require(_0x5640('0x7'));var config=require(_0x5640('0x8'));var attributes=require(_0x5640('0x9'));module[_0x5640('0xa')]=function(_0x58d1c3,_0x425003){return _0x58d1c3[_0x5640('0xb')](_0x5640('0xc'),attributes,{'tableName':_0x5640('0xd'),'paranoid':![],'indexes':[{'name':_0x5640('0xe'),'fields':[_0x5640('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 5a08510..1e64699 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 _0x5c17=['catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x36c331,_0x237d5a){var _0x1c4653=function(_0x4d1fab){while(--_0x4d1fab){_0x36c331['push'](_0x36c331['shift']());}};_0x1c4653(++_0x237d5a);}(_0x5c17,0x1ba));var _0x75c1=function(_0x36429b,_0x1b12e9){_0x36429b=_0x36429b-0x0;var _0x2ebfc0=_0x5c17[_0x36429b];return _0x2ebfc0;};'use strict';var _=require(_0x75c1('0x0'));var util=require(_0x75c1('0x1'));var moment=require('moment');var BPromise=require(_0x75c1('0x2'));var rs=require(_0x75c1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75c1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75c1('0x5'))(_0x75c1('0x6'));var config=require(_0x75c1('0x7'));var jayson=require(_0x75c1('0x8'));var client=jayson[_0x75c1('0x9')][_0x75c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43a58a,_0x3c80fe,_0x2b98bd){return new BPromise(function(_0x4a729f,_0x904874){return client['request'](_0x43a58a,_0x2b98bd)['then'](function(_0x110d36){logger[_0x75c1('0xb')](_0x75c1('0xc'),_0x3c80fe,'request\x20sent');logger[_0x75c1('0xd')](_0x75c1('0xe'),_0x3c80fe,_0x75c1('0xf'),JSON[_0x75c1('0x10')](_0x110d36));if(_0x110d36['error']){if(_0x110d36[_0x75c1('0x11')]['code']===0x1f4){logger['error'](_0x75c1('0xc'),_0x3c80fe,_0x110d36[_0x75c1('0x11')][_0x75c1('0x12')]);return _0x904874(_0x110d36[_0x75c1('0x11')]['message']);}logger[_0x75c1('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3c80fe,_0x110d36[_0x75c1('0x11')]['message']);return _0x4a729f(_0x110d36[_0x75c1('0x11')][_0x75c1('0x12')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x3c80fe,_0x75c1('0xf'));_0x4a729f(_0x110d36[_0x75c1('0x13')]['message']);}})[_0x75c1('0x14')](function(_0x3f14f8){logger[_0x75c1('0x11')](_0x75c1('0xc'),_0x3c80fe,_0x3f14f8);_0x904874(_0x3f14f8);});});} \ No newline at end of file +var _0x366c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','randomstring'];(function(_0x684450,_0x6f5a72){var _0x1ef3e3=function(_0x1efcbe){while(--_0x1efcbe){_0x684450['push'](_0x684450['shift']());}};_0x1ef3e3(++_0x6f5a72);}(_0x366c,0x9d));var _0xc366=function(_0x457dcf,_0x311e7e){_0x457dcf=_0x457dcf-0x0;var _0x7d54a4=_0x366c[_0x457dcf];return _0x7d54a4;};'use strict';var _=require(_0xc366('0x0'));var util=require(_0xc366('0x1'));var moment=require(_0xc366('0x2'));var BPromise=require('bluebird');var rs=require(_0xc366('0x3'));var fs=require('fs');var Redis=require(_0xc366('0x4'));var db=require(_0xc366('0x5'))['db'];var utils=require(_0xc366('0x6'));var logger=require(_0xc366('0x7'))(_0xc366('0x8'));var config=require(_0xc366('0x9'));var jayson=require(_0xc366('0xa'));var client=jayson[_0xc366('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e0305,_0x2ef7e6,_0x15e875){return new BPromise(function(_0x300144,_0xb8289f){return client[_0xc366('0xc')](_0x5e0305,_0x15e875)[_0xc366('0xd')](function(_0x19dc7c){logger[_0xc366('0xe')](_0xc366('0xf'),_0x2ef7e6,_0xc366('0x10'));logger[_0xc366('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2ef7e6,_0xc366('0x10'),JSON[_0xc366('0x12')](_0x19dc7c));if(_0x19dc7c[_0xc366('0x13')]){if(_0x19dc7c[_0xc366('0x13')][_0xc366('0x14')]===0x1f4){logger[_0xc366('0x13')](_0xc366('0xf'),_0x2ef7e6,_0x19dc7c['error'][_0xc366('0x15')]);return _0xb8289f(_0x19dc7c['error'][_0xc366('0x15')]);}logger['error'](_0xc366('0xf'),_0x2ef7e6,_0x19dc7c['error'][_0xc366('0x15')]);return _0x300144(_0x19dc7c[_0xc366('0x13')][_0xc366('0x15')]);}else{logger[_0xc366('0xe')](_0xc366('0xf'),_0x2ef7e6,_0xc366('0x10'));_0x300144(_0x19dc7c[_0xc366('0x16')]['message']);}})['catch'](function(_0x19d494){logger[_0xc366('0x13')](_0xc366('0xf'),_0x2ef7e6,_0x19d494);_0xb8289f(_0x19d494);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index cd81708..b42a727 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 _0xa87b=['./pause.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa87b,0x199));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xba87('0x0'));var util=require(_0xba87('0x1'));var path=require(_0xba87('0x2'));var timeout=require(_0xba87('0x3'));var express=require('express');var router=express[_0xba87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xba87('0x5'));var config=require(_0xba87('0x6'));var controller=require(_0xba87('0x7'));router[_0xba87('0x8')]('/',auth[_0xba87('0x9')](),controller[_0xba87('0xa')]);router['get'](_0xba87('0xb'),auth[_0xba87('0x9')](),controller['show']);router[_0xba87('0xc')]('/',auth[_0xba87('0x9')](),controller[_0xba87('0xd')]);router['put'](_0xba87('0xb'),auth[_0xba87('0x9')](),controller[_0xba87('0xe')]);router['delete'](_0xba87('0xb'),auth[_0xba87('0x9')](),controller[_0xba87('0xf')]);module['exports']=router; \ No newline at end of file +var _0x86d1=['update','delete','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','get','isAuthenticated','show','post','create','put','/:id'];(function(_0x31e3e4,_0x5c795a){var _0x4ee39e=function(_0x21ee01){while(--_0x21ee01){_0x31e3e4['push'](_0x31e3e4['shift']());}};_0x4ee39e(++_0x5c795a);}(_0x86d1,0x1b7));var _0x186d=function(_0x7d2a81,_0x3c0b4b){_0x7d2a81=_0x7d2a81-0x0;var _0x378945=_0x86d1[_0x7d2a81];return _0x378945;};'use strict';var multer=require(_0x186d('0x0'));var util=require('util');var path=require(_0x186d('0x1'));var timeout=require(_0x186d('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x186d('0x3'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x186d('0x4')]('/',auth[_0x186d('0x5')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x186d('0x6')]);router[_0x186d('0x7')]('/',auth['isAuthenticated'](),controller[_0x186d('0x8')]);router[_0x186d('0x9')](_0x186d('0xa'),auth[_0x186d('0x5')](),controller[_0x186d('0xb')]);router[_0x186d('0xc')](_0x186d('0xa'),auth[_0x186d('0x5')](),controller[_0x186d('0xd')]);module[_0x186d('0xe')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 345f305..e05b3cb 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 _0xcea1=['name','sequelize','exports','STRING'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0xcea1,0x101));var _0x1cea=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0xcea1[_0x1f8053];return _0x174fd8;};'use strict';var Sequelize=require(_0x1cea('0x0'));module[_0x1cea('0x1')]={'name':{'type':Sequelize[_0x1cea('0x2')],'unique':_0x1cea('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7134=['exports','STRING','name','sequelize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7134,0x15f));var _0x4713=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7134[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4713('0x0'));module[_0x4713('0x1')]={'name':{'type':Sequelize[_0x4713('0x2')],'unique':_0x4713('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4713('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index c559713..f4f2d80 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 _0x1326=['destroy','then','get','Pauses','UserProfileResource','end','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','count','include','findAll','rows','catch','params','includeAll','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','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','status','json','offset','set','Content-Range','reject','save','update'];(function(_0x141cdc,_0xa038e9){var _0x2d7d88=function(_0x5d161f){while(--_0x5d161f){_0x141cdc['push'](_0x141cdc['shift']());}};_0x2d7d88(++_0xa038e9);}(_0x1326,0xdd));var _0x6132=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0x1326[_0x4eec9b];return _0x2e3849;};'use strict';var pdf=require(_0x6132('0x0'));var emlformat=require(_0x6132('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6132('0x2'));var jsonpatch=require(_0x6132('0x3'));var rp=require(_0x6132('0x4'));var moment=require(_0x6132('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6132('0x6'));var util=require(_0x6132('0x7'));var path=require('path');var sox=require(_0x6132('0x8'));var csv=require(_0x6132('0x9'));var ejs=require(_0x6132('0xa'));var fs=require('fs');var _=require(_0x6132('0xb'));var squel=require(_0x6132('0xc'));var crypto=require(_0x6132('0xd'));var jsforce=require(_0x6132('0xe'));var deskjs=require(_0x6132('0xf'));var toCsv=require(_0x6132('0x9'));var querystring=require(_0x6132('0x10'));var Papa=require(_0x6132('0x11'));var Redis=require('ioredis');var authService=require(_0x6132('0x12'));var qs=require(_0x6132('0x13'));var as=require(_0x6132('0x14'));var hardwareService=require(_0x6132('0x15'));var logger=require(_0x6132('0x16'))(_0x6132('0x17'));var utils=require(_0x6132('0x18'));var config=require(_0x6132('0x19'));var licenseUtil=require(_0x6132('0x1a'));var db=require(_0x6132('0x1b'))['db'];function respondWithStatusCode(_0x26be4d,_0xe8bfbf){_0xe8bfbf=_0xe8bfbf||0xcc;return function(_0x12afae){if(_0x12afae){return _0x26be4d[_0x6132('0x1c')](_0xe8bfbf);}return _0x26be4d[_0x6132('0x1d')](_0xe8bfbf)['end']();};}function respondWithResult(_0x256073,_0x3496c5){_0x3496c5=_0x3496c5||0xc8;return function(_0x15ef1f){if(_0x15ef1f){return _0x256073[_0x6132('0x1d')](_0x3496c5)[_0x6132('0x1e')](_0x15ef1f);}};}function respondWithFilteredResult(_0xb6a4c,_0x4a8c8a){return function(_0x178740){if(_0x178740){var _0x44b3b2=_0x178740['count'],_0x13d864=_0x4a8c8a['offset'],_0x20baa3=_0x4a8c8a[_0x6132('0x1f')]+_0x4a8c8a['limit'],_0x3c9e27;if(_0x20baa3>=_0x44b3b2){_0x20baa3=_0x44b3b2;_0x3c9e27=0xc8;}else{_0x3c9e27=0xce;}_0xb6a4c[_0x6132('0x1d')](_0x3c9e27);return _0xb6a4c[_0x6132('0x20')](_0x6132('0x21'),_0x13d864+'-'+_0x20baa3+'/'+_0x44b3b2)[_0x6132('0x1e')](_0x178740);}return null;};}function patchUpdates(_0x58fb13){return function(_0x4ce64f){try{jsonpatch['apply'](_0x4ce64f,_0x58fb13,!![]);}catch(_0x2a5fff){return BPromise[_0x6132('0x22')](_0x2a5fff);}return _0x4ce64f[_0x6132('0x23')]();};}function saveUpdates(_0x56576e,_0x49c69b){return function(_0xf6463c){if(_0xf6463c){return _0xf6463c[_0x6132('0x24')](_0x56576e)['then'](function(_0x1ecc1c){return _0x1ecc1c;});}return null;};}function removeEntity(_0x3a4517,_0x47bb7b){return function(_0x3a74eb){if(_0x3a74eb){return _0x3a74eb[_0x6132('0x25')]()[_0x6132('0x26')](function(){var _0xb25628=_0x3a74eb[_0x6132('0x27')]({'plain':!![]});var _0x178d97=_0x6132('0x28');return db[_0x6132('0x29')][_0x6132('0x25')]({'where':{'type':_0x178d97,'resourceId':_0xb25628['id']}})[_0x6132('0x26')](function(){return _0x3a74eb;});})[_0x6132('0x26')](function(){_0x3a4517['status'](0xcc)[_0x6132('0x2a')]();});}};}function handleEntityNotFound(_0x5df92a,_0x2678f3){return function(_0x49df03){if(!_0x49df03){_0x5df92a[_0x6132('0x1c')](0x194);}return _0x49df03;};}function handleError(_0x10e816,_0x177f18){_0x177f18=_0x177f18||0x1f4;return function(_0x4c54ea){logger[_0x6132('0x2b')](_0x4c54ea[_0x6132('0x2c')]);if(_0x4c54ea['name']){delete _0x4c54ea[_0x6132('0x2d')];}_0x10e816[_0x6132('0x1d')](_0x177f18)[_0x6132('0x2e')](_0x4c54ea);};}exports['index']=function(_0x6f3eec,_0x2801e0){var _0x1f7556={},_0x5c228e={},_0x3e8ea2={'count':0x0,'rows':[]};var _0x294cd2=_[_0x6132('0x2f')](db[_0x6132('0x30')][_0x6132('0x31')],function(_0x28f127){return{'name':_0x28f127[_0x6132('0x32')],'type':_0x28f127[_0x6132('0x33')][_0x6132('0x34')]};});_0x5c228e[_0x6132('0x35')]=_[_0x6132('0x2f')](_0x294cd2,_0x6132('0x2d'));_0x5c228e[_0x6132('0x36')]=_[_0x6132('0x37')](_0x6f3eec['query']);_0x5c228e[_0x6132('0x38')]=_[_0x6132('0x39')](_0x5c228e['model'],_0x5c228e[_0x6132('0x36')]);_0x1f7556['attributes']=_['intersection'](_0x5c228e[_0x6132('0x35')],qs[_0x6132('0x3a')](_0x6f3eec[_0x6132('0x36')][_0x6132('0x3a')]));_0x1f7556[_0x6132('0x3b')]=_0x1f7556[_0x6132('0x3b')][_0x6132('0x3c')]?_0x1f7556[_0x6132('0x3b')]:_0x5c228e[_0x6132('0x35')];if(!_0x6f3eec[_0x6132('0x36')][_0x6132('0x3d')]('nolimit')){_0x1f7556[_0x6132('0x3e')]=qs['limit'](_0x6f3eec[_0x6132('0x36')][_0x6132('0x3e')]);_0x1f7556[_0x6132('0x1f')]=qs['offset'](_0x6f3eec[_0x6132('0x36')][_0x6132('0x1f')]);}_0x1f7556[_0x6132('0x3f')]=qs[_0x6132('0x40')](_0x6f3eec[_0x6132('0x36')][_0x6132('0x40')]);_0x1f7556[_0x6132('0x41')]=qs[_0x6132('0x38')](_[_0x6132('0x42')](_0x6f3eec[_0x6132('0x36')],_0x5c228e[_0x6132('0x38')]),_0x294cd2);if(_0x6f3eec[_0x6132('0x36')][_0x6132('0x43')]){_0x1f7556[_0x6132('0x41')]=_['merge'](_0x1f7556[_0x6132('0x41')],{'$or':_[_0x6132('0x2f')](_0x294cd2,function(_0x3042af){if(_0x3042af[_0x6132('0x33')]!==_0x6132('0x44')){var _0x4bf013={};_0x4bf013[_0x3042af[_0x6132('0x2d')]]={'$like':'%'+_0x6f3eec[_0x6132('0x36')][_0x6132('0x43')]+'%'};return _0x4bf013;}})});}_0x1f7556=_['merge']({},_0x1f7556,_0x6f3eec['options']);var _0x3865ad={'where':_0x1f7556[_0x6132('0x41')]};return db[_0x6132('0x30')][_0x6132('0x45')](_0x3865ad)[_0x6132('0x26')](function(_0x360b17){_0x3e8ea2[_0x6132('0x45')]=_0x360b17;if(_0x6f3eec[_0x6132('0x36')]['includeAll']){_0x1f7556[_0x6132('0x46')]=[{'all':!![]}];}return db['Pause'][_0x6132('0x47')](_0x1f7556);})[_0x6132('0x26')](function(_0x1913e9){_0x3e8ea2[_0x6132('0x48')]=_0x1913e9;return _0x3e8ea2;})[_0x6132('0x26')](respondWithFilteredResult(_0x2801e0,_0x1f7556))[_0x6132('0x49')](handleError(_0x2801e0,null));};exports['show']=function(_0x119777,_0x1b301f){var _0x68e676={'raw':!![],'where':{'id':_0x119777[_0x6132('0x4a')]['id']}},_0x2a6145={};_0x2a6145['model']=_[_0x6132('0x37')](db[_0x6132('0x30')]['rawAttributes']);_0x2a6145[_0x6132('0x36')]=_[_0x6132('0x37')](_0x119777['query']);_0x2a6145[_0x6132('0x38')]=_['intersection'](_0x2a6145['model'],_0x2a6145[_0x6132('0x36')]);_0x68e676['attributes']=_['intersection'](_0x2a6145['model'],qs[_0x6132('0x3a')](_0x119777[_0x6132('0x36')][_0x6132('0x3a')]));_0x68e676['attributes']=_0x68e676[_0x6132('0x3b')][_0x6132('0x3c')]?_0x68e676['attributes']:_0x2a6145[_0x6132('0x35')];if(_0x119777['query'][_0x6132('0x4b')]){_0x68e676[_0x6132('0x46')]=[{'all':!![]}];}_0x68e676=_['merge']({},_0x68e676,_0x119777[_0x6132('0x4c')]);return db[_0x6132('0x30')][_0x6132('0x4d')](_0x68e676)[_0x6132('0x26')](handleEntityNotFound(_0x1b301f,null))[_0x6132('0x26')](respondWithResult(_0x1b301f,null))['catch'](handleError(_0x1b301f,null));};exports[_0x6132('0x4e')]=function(_0x3092b2,_0x2cd86a){return db[_0x6132('0x30')][_0x6132('0x4e')](_0x3092b2['body'],{})[_0x6132('0x26')](function(_0x5e5a68){var _0x4eef1b=_0x3092b2[_0x6132('0x4f')][_0x6132('0x27')]({'plain':!![]});if(!_0x4eef1b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4eef1b[_0x6132('0x50')]===_0x6132('0x4f')){var _0x47bd8f=_0x5e5a68['get']({'plain':!![]});var _0x132e6d=_0x6132('0x28');return db[_0x6132('0x51')][_0x6132('0x4d')]({'where':{'name':_0x132e6d,'userProfileId':_0x4eef1b[_0x6132('0x52')]},'raw':!![]})[_0x6132('0x26')](function(_0x24539d){if(_0x24539d&&_0x24539d[_0x6132('0x53')]===0x0){return db[_0x6132('0x29')][_0x6132('0x4e')]({'name':_0x47bd8f[_0x6132('0x2d')],'resourceId':_0x47bd8f['id'],'type':_0x24539d[_0x6132('0x2d')],'sectionId':_0x24539d['id']},{})[_0x6132('0x26')](function(){return _0x5e5a68;});}else{return _0x5e5a68;}})[_0x6132('0x49')](function(_0x213f33){logger[_0x6132('0x2b')](_0x6132('0x54'),_0x213f33);throw _0x213f33;});}return _0x5e5a68;})[_0x6132('0x26')](respondWithResult(_0x2cd86a,0xc9))[_0x6132('0x49')](handleError(_0x2cd86a,null));};exports['update']=function(_0x4a5ebd,_0xf5285a){if(_0x4a5ebd[_0x6132('0x55')]['id']){delete _0x4a5ebd[_0x6132('0x55')]['id'];}return db[_0x6132('0x30')][_0x6132('0x4d')]({'where':{'id':_0x4a5ebd['params']['id']}})['then'](handleEntityNotFound(_0xf5285a,null))[_0x6132('0x26')](saveUpdates(_0x4a5ebd['body'],null))['then'](respondWithResult(_0xf5285a,null))[_0x6132('0x49')](handleError(_0xf5285a,null));};exports[_0x6132('0x25')]=function(_0xcab53c,_0x3359a0){return db[_0x6132('0x30')][_0x6132('0x4d')]({'where':{'id':_0xcab53c[_0x6132('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3359a0,null))[_0x6132('0x26')](removeEntity(_0x3359a0,null))[_0x6132('0x49')](handleError(_0x3359a0,null));}; \ No newline at end of file +var _0xafed=['where','pick','filters','merge','type','VIRTUAL','filter','options','Pause','count','includeAll','include','findAll','keys','rawAttributes','length','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort'];(function(_0x50fdc6,_0x38408b){var _0x37f374=function(_0x178eda){while(--_0x178eda){_0x50fdc6['push'](_0x50fdc6['shift']());}};_0x37f374(++_0x38408b);}(_0xafed,0x1ac));var _0xdafe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafed[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xdafe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdafe('0x1'));var jsonpatch=require(_0xdafe('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdafe('0x3'));var Mustache=require(_0xdafe('0x4'));var util=require('util');var path=require(_0xdafe('0x5'));var sox=require(_0xdafe('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdafe('0x7'));var squel=require(_0xdafe('0x8'));var crypto=require(_0xdafe('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xdafe('0xa'));var toCsv=require('to-csv');var querystring=require(_0xdafe('0xb'));var Papa=require(_0xdafe('0xc'));var Redis=require(_0xdafe('0xd'));var authService=require(_0xdafe('0xe'));var qs=require(_0xdafe('0xf'));var as=require(_0xdafe('0x10'));var hardwareService=require(_0xdafe('0x11'));var logger=require(_0xdafe('0x12'))(_0xdafe('0x13'));var utils=require(_0xdafe('0x14'));var config=require(_0xdafe('0x15'));var licenseUtil=require(_0xdafe('0x16'));var db=require(_0xdafe('0x17'))['db'];function respondWithStatusCode(_0x4ac1ea,_0x2e3dfe){_0x2e3dfe=_0x2e3dfe||0xcc;return function(_0x9c7802){if(_0x9c7802){return _0x4ac1ea[_0xdafe('0x18')](_0x2e3dfe);}return _0x4ac1ea[_0xdafe('0x19')](_0x2e3dfe)['end']();};}function respondWithResult(_0x568255,_0x45dd06){_0x45dd06=_0x45dd06||0xc8;return function(_0x311c50){if(_0x311c50){return _0x568255[_0xdafe('0x19')](_0x45dd06)[_0xdafe('0x1a')](_0x311c50);}};}function respondWithFilteredResult(_0x167de3,_0x2c0a7f){return function(_0x136801){if(_0x136801){var _0x2503d6=_0x136801['count'],_0x3c7e7f=_0x2c0a7f[_0xdafe('0x1b')],_0x7bafcb=_0x2c0a7f[_0xdafe('0x1b')]+_0x2c0a7f[_0xdafe('0x1c')],_0x53e9e4;if(_0x7bafcb>=_0x2503d6){_0x7bafcb=_0x2503d6;_0x53e9e4=0xc8;}else{_0x53e9e4=0xce;}_0x167de3[_0xdafe('0x19')](_0x53e9e4);return _0x167de3[_0xdafe('0x1d')](_0xdafe('0x1e'),_0x3c7e7f+'-'+_0x7bafcb+'/'+_0x2503d6)[_0xdafe('0x1a')](_0x136801);}return null;};}function patchUpdates(_0x5c7cb7){return function(_0x51d22b){try{jsonpatch[_0xdafe('0x1f')](_0x51d22b,_0x5c7cb7,!![]);}catch(_0x536f42){return BPromise['reject'](_0x536f42);}return _0x51d22b[_0xdafe('0x20')]();};}function saveUpdates(_0x2d3571,_0x227a96){return function(_0x4afcc8){if(_0x4afcc8){return _0x4afcc8[_0xdafe('0x21')](_0x2d3571)[_0xdafe('0x22')](function(_0x7649e){return _0x7649e;});}return null;};}function removeEntity(_0x993bd1,_0x26f24a){return function(_0xb349d6){if(_0xb349d6){return _0xb349d6[_0xdafe('0x23')]()[_0xdafe('0x22')](function(){var _0x59c0d9=_0xb349d6['get']({'plain':!![]});var _0x225733=_0xdafe('0x24');return db[_0xdafe('0x25')][_0xdafe('0x23')]({'where':{'type':_0x225733,'resourceId':_0x59c0d9['id']}})[_0xdafe('0x22')](function(){return _0xb349d6;});})['then'](function(){_0x993bd1[_0xdafe('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x326c7e,_0x4c60d7){return function(_0x3f8df0){if(!_0x3f8df0){_0x326c7e[_0xdafe('0x18')](0x194);}return _0x3f8df0;};}function handleError(_0x1773dd,_0x407d7d){_0x407d7d=_0x407d7d||0x1f4;return function(_0x497f6a){logger[_0xdafe('0x26')](_0x497f6a[_0xdafe('0x27')]);if(_0x497f6a[_0xdafe('0x28')]){delete _0x497f6a[_0xdafe('0x28')];}_0x1773dd[_0xdafe('0x19')](_0x407d7d)[_0xdafe('0x29')](_0x497f6a);};}exports['index']=function(_0x13cecc,_0x5e986b){var _0x44f96c={},_0x827742={},_0xbed48f={'count':0x0,'rows':[]};var _0x57f150=_['map'](db['Pause']['rawAttributes'],function(_0x515d1b){return{'name':_0x515d1b['fieldName'],'type':_0x515d1b['type'][_0xdafe('0x2a')]};});_0x827742[_0xdafe('0x2b')]=_[_0xdafe('0x2c')](_0x57f150,_0xdafe('0x28'));_0x827742[_0xdafe('0x2d')]=_['keys'](_0x13cecc[_0xdafe('0x2d')]);_0x827742['filters']=_[_0xdafe('0x2e')](_0x827742[_0xdafe('0x2b')],_0x827742[_0xdafe('0x2d')]);_0x44f96c[_0xdafe('0x2f')]=_[_0xdafe('0x2e')](_0x827742[_0xdafe('0x2b')],qs[_0xdafe('0x30')](_0x13cecc[_0xdafe('0x2d')][_0xdafe('0x30')]));_0x44f96c['attributes']=_0x44f96c[_0xdafe('0x2f')]['length']?_0x44f96c[_0xdafe('0x2f')]:_0x827742['model'];if(!_0x13cecc[_0xdafe('0x2d')][_0xdafe('0x31')](_0xdafe('0x32'))){_0x44f96c['limit']=qs[_0xdafe('0x1c')](_0x13cecc[_0xdafe('0x2d')][_0xdafe('0x1c')]);_0x44f96c['offset']=qs[_0xdafe('0x1b')](_0x13cecc[_0xdafe('0x2d')][_0xdafe('0x1b')]);}_0x44f96c['order']=qs[_0xdafe('0x33')](_0x13cecc[_0xdafe('0x2d')][_0xdafe('0x33')]);_0x44f96c[_0xdafe('0x34')]=qs['filters'](_[_0xdafe('0x35')](_0x13cecc['query'],_0x827742[_0xdafe('0x36')]),_0x57f150);if(_0x13cecc[_0xdafe('0x2d')]['filter']){_0x44f96c['where']=_[_0xdafe('0x37')](_0x44f96c[_0xdafe('0x34')],{'$or':_[_0xdafe('0x2c')](_0x57f150,function(_0x1dc8d3){if(_0x1dc8d3[_0xdafe('0x38')]!==_0xdafe('0x39')){var _0x26f9ca={};_0x26f9ca[_0x1dc8d3[_0xdafe('0x28')]]={'$like':'%'+_0x13cecc[_0xdafe('0x2d')][_0xdafe('0x3a')]+'%'};return _0x26f9ca;}})});}_0x44f96c=_[_0xdafe('0x37')]({},_0x44f96c,_0x13cecc[_0xdafe('0x3b')]);var _0x23123d={'where':_0x44f96c['where']};return db[_0xdafe('0x3c')][_0xdafe('0x3d')](_0x23123d)['then'](function(_0x2ca203){_0xbed48f[_0xdafe('0x3d')]=_0x2ca203;if(_0x13cecc[_0xdafe('0x2d')][_0xdafe('0x3e')]){_0x44f96c[_0xdafe('0x3f')]=[{'all':!![]}];}return db[_0xdafe('0x3c')][_0xdafe('0x40')](_0x44f96c);})['then'](function(_0x1e2373){_0xbed48f['rows']=_0x1e2373;return _0xbed48f;})[_0xdafe('0x22')](respondWithFilteredResult(_0x5e986b,_0x44f96c))['catch'](handleError(_0x5e986b,null));};exports['show']=function(_0x5859ec,_0x30a7e0){var _0x1b8197={'raw':!![],'where':{'id':_0x5859ec['params']['id']}},_0x24c94f={};_0x24c94f[_0xdafe('0x2b')]=_[_0xdafe('0x41')](db[_0xdafe('0x3c')][_0xdafe('0x42')]);_0x24c94f[_0xdafe('0x2d')]=_['keys'](_0x5859ec[_0xdafe('0x2d')]);_0x24c94f[_0xdafe('0x36')]=_[_0xdafe('0x2e')](_0x24c94f['model'],_0x24c94f['query']);_0x1b8197[_0xdafe('0x2f')]=_[_0xdafe('0x2e')](_0x24c94f[_0xdafe('0x2b')],qs[_0xdafe('0x30')](_0x5859ec[_0xdafe('0x2d')]['fields']));_0x1b8197[_0xdafe('0x2f')]=_0x1b8197['attributes'][_0xdafe('0x43')]?_0x1b8197['attributes']:_0x24c94f[_0xdafe('0x2b')];if(_0x5859ec[_0xdafe('0x2d')]['includeAll']){_0x1b8197['include']=[{'all':!![]}];}_0x1b8197=_[_0xdafe('0x37')]({},_0x1b8197,_0x5859ec['options']);return db['Pause'][_0xdafe('0x44')](_0x1b8197)['then'](handleEntityNotFound(_0x30a7e0,null))[_0xdafe('0x22')](respondWithResult(_0x30a7e0,null))[_0xdafe('0x45')](handleError(_0x30a7e0,null));};exports[_0xdafe('0x46')]=function(_0x36f2d9,_0xca6f03){return db[_0xdafe('0x3c')]['create'](_0x36f2d9[_0xdafe('0x47')],{})['then'](function(_0x3a8aca){var _0x409f03=_0x36f2d9['user'][_0xdafe('0x48')]({'plain':!![]});if(!_0x409f03)throw new Error(_0xdafe('0x49'));if(_0x409f03[_0xdafe('0x4a')]===_0xdafe('0x4b')){var _0x36a161=_0x3a8aca['get']({'plain':!![]});var _0x21fb7b=_0xdafe('0x24');return db[_0xdafe('0x4c')][_0xdafe('0x44')]({'where':{'name':_0x21fb7b,'userProfileId':_0x409f03[_0xdafe('0x4d')]},'raw':!![]})['then'](function(_0x110b4a){if(_0x110b4a&&_0x110b4a['autoAssociation']===0x0){return db[_0xdafe('0x25')]['create']({'name':_0x36a161[_0xdafe('0x28')],'resourceId':_0x36a161['id'],'type':_0x110b4a[_0xdafe('0x28')],'sectionId':_0x110b4a['id']},{})[_0xdafe('0x22')](function(){return _0x3a8aca;});}else{return _0x3a8aca;}})[_0xdafe('0x45')](function(_0xc43a87){logger[_0xdafe('0x26')](_0xdafe('0x4e'),_0xc43a87);throw _0xc43a87;});}return _0x3a8aca;})[_0xdafe('0x22')](respondWithResult(_0xca6f03,0xc9))[_0xdafe('0x45')](handleError(_0xca6f03,null));};exports[_0xdafe('0x21')]=function(_0xce073a,_0x2d1160){if(_0xce073a[_0xdafe('0x47')]['id']){delete _0xce073a['body']['id'];}return db[_0xdafe('0x3c')]['find']({'where':{'id':_0xce073a[_0xdafe('0x4f')]['id']}})[_0xdafe('0x22')](handleEntityNotFound(_0x2d1160,null))[_0xdafe('0x22')](saveUpdates(_0xce073a['body'],null))[_0xdafe('0x22')](respondWithResult(_0x2d1160,null))[_0xdafe('0x45')](handleError(_0x2d1160,null));};exports[_0xdafe('0x23')]=function(_0x18f31f,_0xa0f822){return db[_0xdafe('0x3c')][_0xdafe('0x44')]({'where':{'id':_0x18f31f[_0xdafe('0x4f')]['id']}})[_0xdafe('0x22')](handleEntityNotFound(_0xa0f822,null))['then'](removeEntity(_0xa0f822,null))[_0xdafe('0x45')](handleError(_0xa0f822,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5395249..6d5cb1c 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 _0xb44a=['../../config/logger','moment','path','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses'];(function(_0x207b52,_0x264f03){var _0x319c8d=function(_0x3f6cbb){while(--_0x3f6cbb){_0x207b52['push'](_0x207b52['shift']());}};_0x319c8d(++_0x264f03);}(_0xb44a,0x1c2));var _0xab44=function(_0x4f5fbc,_0x74cb4e){_0x4f5fbc=_0x4f5fbc-0x0;var _0x486e0e=_0xb44a[_0x4f5fbc];return _0x486e0e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d07=['define','Pause','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x599422,_0x593e11){var _0x473fdd=function(_0x437dce){while(--_0x437dce){_0x599422['push'](_0x599422['shift']());}};_0x473fdd(++_0x593e11);}(_0x2d07,0x13a));var _0x72d0=function(_0x53b55f,_0x7980d0){_0x53b55f=_0x53b55f-0x0;var _0x71d9fa=_0x2d07[_0x53b55f];return _0x71d9fa;};'use strict';var _=require(_0x72d0('0x0'));var util=require(_0x72d0('0x1'));var logger=require('../../config/logger')(_0x72d0('0x2'));var moment=require(_0x72d0('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d0('0x4'));var fs=require('fs');var path=require(_0x72d0('0x5'));var rimraf=require(_0x72d0('0x6'));var config=require(_0x72d0('0x7'));var attributes=require(_0x72d0('0x8'));module[_0x72d0('0x9')]=function(_0x4e0f5c,_0x180424){return _0x4e0f5c[_0x72d0('0xa')](_0x72d0('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index d95fdac..8f52c0d 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 _0x8151=['request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowPause','Pause','options','raw','where','attributes','include','map','model','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x59db33,_0x5e7cdc){var _0x5a0c47=function(_0x4bf449){while(--_0x4bf449){_0x59db33['push'](_0x59db33['shift']());}};_0x5a0c47(++_0x5e7cdc);}(_0x8151,0xd5));var _0x1815=function(_0x37bef1,_0xecf330){_0x37bef1=_0x37bef1-0x0;var _0x342427=_0x8151[_0x37bef1];return _0x342427;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1815('0x0'));var BPromise=require(_0x1815('0x1'));var rs=require(_0x1815('0x2'));var fs=require('fs');var Redis=require(_0x1815('0x3'));var db=require(_0x1815('0x4'))['db'];var utils=require(_0x1815('0x5'));var logger=require(_0x1815('0x6'))('rpc');var config=require(_0x1815('0x7'));var jayson=require(_0x1815('0x8'));var client=jayson[_0x1815('0x9')][_0x1815('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47bf47,_0xe0e3ee,_0x188820){return new BPromise(function(_0x5ab467,_0x188b88){return client[_0x1815('0xb')](_0x47bf47,_0x188820)[_0x1815('0xc')](function(_0x39170a){logger[_0x1815('0xd')](_0x1815('0xe'),_0xe0e3ee,_0x1815('0xf'));logger[_0x1815('0x10')]('Pause,\x20%s,\x20%s,\x20%s',_0xe0e3ee,_0x1815('0xf'),JSON[_0x1815('0x11')](_0x39170a));if(_0x39170a[_0x1815('0x12')]){if(_0x39170a[_0x1815('0x12')][_0x1815('0x13')]===0x1f4){logger['error'](_0x1815('0xe'),_0xe0e3ee,_0x39170a[_0x1815('0x12')][_0x1815('0x14')]);return _0x188b88(_0x39170a[_0x1815('0x12')]['message']);}logger[_0x1815('0x12')](_0x1815('0xe'),_0xe0e3ee,_0x39170a[_0x1815('0x12')][_0x1815('0x14')]);return _0x5ab467(_0x39170a[_0x1815('0x12')][_0x1815('0x14')]);}else{logger['info'](_0x1815('0xe'),_0xe0e3ee,'request\x20sent');_0x5ab467(_0x39170a[_0x1815('0x15')][_0x1815('0x14')]);}})['catch'](function(_0x18b108){logger[_0x1815('0x12')]('Pause,\x20%s,\x20%s',_0xe0e3ee,_0x18b108);_0x188b88(_0x18b108);});});}exports[_0x1815('0x16')]=function(_0x8f5f6f){var _0xa930aa=this;return new Promise(function(_0x15da37,_0x52cc42){return db[_0x1815('0x17')]['find']({'raw':_0x8f5f6f[_0x1815('0x18')]?_0x8f5f6f[_0x1815('0x18')][_0x1815('0x19')]===undefined?!![]:![]:!![],'where':_0x8f5f6f['options']?_0x8f5f6f[_0x1815('0x18')][_0x1815('0x1a')]||null:null,'attributes':_0x8f5f6f[_0x1815('0x18')]?_0x8f5f6f[_0x1815('0x18')][_0x1815('0x1b')]||null:null,'include':_0x8f5f6f[_0x1815('0x18')]?_0x8f5f6f[_0x1815('0x18')][_0x1815('0x1c')]?_['map'](_0x8f5f6f[_0x1815('0x18')][_0x1815('0x1c')],function(_0x51ac7c){return{'model':db[_0x51ac7c['model']],'as':_0x51ac7c['as'],'attributes':_0x51ac7c[_0x1815('0x1b')],'include':_0x51ac7c['include']?_[_0x1815('0x1d')](_0x51ac7c[_0x1815('0x1c')],function(_0x512415){return{'model':db[_0x512415[_0x1815('0x1e')]],'as':_0x512415['as'],'attributes':_0x512415[_0x1815('0x1b')],'include':_0x512415[_0x1815('0x1c')]?_['map'](_0x512415['include'],function(_0x47be58){return{'model':db[_0x47be58[_0x1815('0x1e')]],'as':_0x47be58['as'],'attributes':_0x47be58[_0x1815('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1815('0xc')](function(_0x52ccfb){logger[_0x1815('0xd')](_0x1815('0x16'),_0x8f5f6f);logger[_0x1815('0x10')]('ShowPause',_0x8f5f6f,JSON[_0x1815('0x11')](_0x52ccfb));_0x15da37(_0x52ccfb);})[_0x1815('0x1f')](function(_0x24c4e0){logger[_0x1815('0x12')](_0x1815('0x16'),_0x24c4e0['message'],_0x8f5f6f);_0x52cc42(_0xa930aa[_0x1815('0x12')](0x1f4,_0x24c4e0['message']));});});}; \ No newline at end of file +var _0x5226=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','Pause','options','where','attributes','include','map','model','ShowPause','util'];(function(_0x370de7,_0x26a6d8){var _0x391a3d=function(_0x2f6bab){while(--_0x2f6bab){_0x370de7['push'](_0x370de7['shift']());}};_0x391a3d(++_0x26a6d8);}(_0x5226,0x12b));var _0x6522=function(_0x554ba9,_0x225492){_0x554ba9=_0x554ba9-0x0;var _0x423c11=_0x5226[_0x554ba9];return _0x423c11;};'use strict';var _=require('lodash');var util=require(_0x6522('0x0'));var moment=require(_0x6522('0x1'));var BPromise=require(_0x6522('0x2'));var rs=require(_0x6522('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6522('0x4'))['db'];var utils=require(_0x6522('0x5'));var logger=require(_0x6522('0x6'))('rpc');var config=require(_0x6522('0x7'));var jayson=require(_0x6522('0x8'));var client=jayson[_0x6522('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f1d0b,_0x411885,_0x298622){return new BPromise(function(_0xe6ea30,_0x8ac866){return client[_0x6522('0xa')](_0x1f1d0b,_0x298622)[_0x6522('0xb')](function(_0x9cb2ea){logger[_0x6522('0xc')](_0x6522('0xd'),_0x411885,_0x6522('0xe'));logger[_0x6522('0xf')]('Pause,\x20%s,\x20%s,\x20%s',_0x411885,'request\x20sent',JSON[_0x6522('0x10')](_0x9cb2ea));if(_0x9cb2ea[_0x6522('0x11')]){if(_0x9cb2ea[_0x6522('0x11')][_0x6522('0x12')]===0x1f4){logger[_0x6522('0x11')](_0x6522('0xd'),_0x411885,_0x9cb2ea['error'][_0x6522('0x13')]);return _0x8ac866(_0x9cb2ea[_0x6522('0x11')]['message']);}logger['error'](_0x6522('0xd'),_0x411885,_0x9cb2ea[_0x6522('0x11')][_0x6522('0x13')]);return _0xe6ea30(_0x9cb2ea['error']['message']);}else{logger[_0x6522('0xc')]('Pause,\x20%s,\x20%s',_0x411885,_0x6522('0xe'));_0xe6ea30(_0x9cb2ea[_0x6522('0x14')][_0x6522('0x13')]);}})[_0x6522('0x15')](function(_0x5ac206){logger['error'](_0x6522('0xd'),_0x411885,_0x5ac206);_0x8ac866(_0x5ac206);});});}exports['ShowPause']=function(_0x29f9de){var _0x2d8b15=this;return new Promise(function(_0x3e8360,_0x4c7418){return db[_0x6522('0x16')]['find']({'raw':_0x29f9de[_0x6522('0x17')]?_0x29f9de[_0x6522('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x29f9de[_0x6522('0x17')]?_0x29f9de['options'][_0x6522('0x18')]||null:null,'attributes':_0x29f9de[_0x6522('0x17')]?_0x29f9de[_0x6522('0x17')][_0x6522('0x19')]||null:null,'include':_0x29f9de[_0x6522('0x17')]?_0x29f9de[_0x6522('0x17')]['include']?_['map'](_0x29f9de[_0x6522('0x17')][_0x6522('0x1a')],function(_0x1cdbc9){return{'model':db[_0x1cdbc9['model']],'as':_0x1cdbc9['as'],'attributes':_0x1cdbc9['attributes'],'include':_0x1cdbc9[_0x6522('0x1a')]?_[_0x6522('0x1b')](_0x1cdbc9['include'],function(_0x578df2){return{'model':db[_0x578df2[_0x6522('0x1c')]],'as':_0x578df2['as'],'attributes':_0x578df2['attributes'],'include':_0x578df2['include']?_[_0x6522('0x1b')](_0x578df2[_0x6522('0x1a')],function(_0x1badf4){return{'model':db[_0x1badf4['model']],'as':_0x1badf4['as'],'attributes':_0x1badf4['attributes']};}):[]};}):[]};}):[]:[]})[_0x6522('0xb')](function(_0x48553b){logger[_0x6522('0xc')](_0x6522('0x1d'),_0x29f9de);logger[_0x6522('0xf')](_0x6522('0x1d'),_0x29f9de,JSON[_0x6522('0x10')](_0x48553b));_0x3e8360(_0x48553b);})[_0x6522('0x15')](function(_0x2ffd58){logger['error'](_0x6522('0x1d'),_0x2ffd58[_0x6522('0x13')],_0x29f9de);_0x4c7418(_0x2d8b15[_0x6522('0x11')](0x1f4,_0x2ffd58[_0x6522('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index d8830f1..74f310f 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 _0x8bb1=['/:id','show','/:id/download','download','diskStorage','root','server/files/plugins','replace','format','basename','originalname','extname','post','upload','/webhook','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet'];(function(_0x195fd3,_0x4f710b){var _0x34759c=function(_0x513585){while(--_0x513585){_0x195fd3['push'](_0x195fd3['shift']());}};_0x34759c(++_0x4f710b);}(_0x8bb1,0xcc));var _0x18bb=function(_0x234830,_0xcee0db){_0x234830=_0x234830-0x0;var _0x25ed18=_0x8bb1[_0x234830];return _0x25ed18;};'use strict';var multer=require(_0x18bb('0x0'));var util=require(_0x18bb('0x1'));var path=require(_0x18bb('0x2'));var timeout=require(_0x18bb('0x3'));var express=require(_0x18bb('0x4'));var router=express[_0x18bb('0x5')]();var auth=require(_0x18bb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x18bb('0x7'));var controller=require(_0x18bb('0x8'));router[_0x18bb('0x9')]('/',auth[_0x18bb('0xa')](),controller[_0x18bb('0xb')]);router[_0x18bb('0x9')]('/webhook',controller[_0x18bb('0xc')]);router[_0x18bb('0x9')](_0x18bb('0xd'),auth[_0x18bb('0xa')](),controller[_0x18bb('0xe')]);router['get'](_0x18bb('0xf'),auth[_0x18bb('0xa')](),controller[_0x18bb('0x10')]);var upload=multer({'storage':multer[_0x18bb('0x11')]({'destination':function(_0x2f2f5a,_0x11c2b6,_0x3b7745){_0x3b7745(null,path['join'](config[_0x18bb('0x12')],_0x18bb('0x13')));},'filename':function(_0x38a148,_0x28eed3,_0x5e8283){_0x28eed3['originalname']=_0x28eed3['originalname'][_0x18bb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5e8283(null,util[_0x18bb('0x15')]('%s-%s%s',path[_0x18bb('0x16')](_0x28eed3[_0x18bb('0x17')],path[_0x18bb('0x18')](_0x28eed3[_0x18bb('0x17')])),Date['now'](),path[_0x18bb('0x18')](_0x28eed3[_0x18bb('0x17')])));}})});router[_0x18bb('0x19')]('/',upload['single']('file'),controller[_0x18bb('0x1a')]);router['post'](_0x18bb('0x1b'),controller['webhookPost']);router[_0x18bb('0x1c')](_0x18bb('0xd'),auth['isAuthenticated'](),controller[_0x18bb('0x1d')]);router[_0x18bb('0x1e')]('/:id',auth[_0x18bb('0xa')](),controller[_0x18bb('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x6f1c=['download','diskStorage','root','server/files/plugins','originalname','replace','format','%s-%s%s','now','extname','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6f1c,0x1ab));var _0xc6f1=function(_0x12a5c2,_0x1802da){_0x12a5c2=_0x12a5c2-0x0;var _0x47ac93=_0x6f1c[_0x12a5c2];return _0x47ac93;};'use strict';var multer=require(_0xc6f1('0x0'));var util=require(_0xc6f1('0x1'));var path=require(_0xc6f1('0x2'));var timeout=require('connect-timeout');var express=require(_0xc6f1('0x3'));var router=express[_0xc6f1('0x4')]();var auth=require(_0xc6f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc6f1('0x6'));var controller=require('./plugin.controller');router[_0xc6f1('0x7')]('/',auth[_0xc6f1('0x8')](),controller[_0xc6f1('0x9')]);router['get'](_0xc6f1('0xa'),controller[_0xc6f1('0xb')]);router[_0xc6f1('0x7')](_0xc6f1('0xc'),auth[_0xc6f1('0x8')](),controller[_0xc6f1('0xd')]);router['get'](_0xc6f1('0xe'),auth['isAuthenticated'](),controller[_0xc6f1('0xf')]);var upload=multer({'storage':multer[_0xc6f1('0x10')]({'destination':function(_0x5ed881,_0x205546,_0x4e5341){_0x4e5341(null,path['join'](config[_0xc6f1('0x11')],_0xc6f1('0x12')));},'filename':function(_0x1f547b,_0x1b2c58,_0x53b760){_0x1b2c58[_0xc6f1('0x13')]=_0x1b2c58[_0xc6f1('0x13')][_0xc6f1('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53b760(null,util[_0xc6f1('0x15')](_0xc6f1('0x16'),path['basename'](_0x1b2c58['originalname'],path['extname'](_0x1b2c58[_0xc6f1('0x13')])),Date[_0xc6f1('0x17')](),path[_0xc6f1('0x18')](_0x1b2c58['originalname'])));}})});router['post']('/',upload[_0xc6f1('0x19')](_0xc6f1('0x1a')),controller[_0xc6f1('0x1b')]);router[_0xc6f1('0x1c')](_0xc6f1('0xa'),controller[_0xc6f1('0x1d')]);router[_0xc6f1('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0xc6f1('0x1f')]);router[_0xc6f1('0x20')]('/:id',auth[_0xc6f1('0x8')](),controller[_0xc6f1('0x20')]);module[_0xc6f1('0x21')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f7d9328..9f5f52b 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 _0xc274=['html','TEXT','STRING','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','sequelize','ENUM'];(function(_0x4bcf2d,_0x58bb1c){var _0x58aabe=function(_0x56da19){while(--_0x56da19){_0x4bcf2d['push'](_0x4bcf2d['shift']());}};_0x58aabe(++_0x58bb1c);}(_0xc274,0x127));var _0x4c27=function(_0x424339,_0x3cf1f0){_0x424339=_0x424339-0x0;var _0x250e65=_0xc274[_0x424339];return _0x250e65;};'use strict';var Sequelize=require(_0x4c27('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4c27('0x1')](_0x4c27('0x2'),'script')},'description':{'type':Sequelize[_0x4c27('0x3')]},'version':{'type':Sequelize[_0x4c27('0x3')]},'path':{'type':Sequelize[_0x4c27('0x4')],'comment':_0x4c27('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4c27('0x6')},'sidebar':{'type':Sequelize[_0x4c27('0x1')](_0x4c27('0x7'),_0x4c27('0x8'),_0x4c27('0x9'),_0x4c27('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x4c27('0x4')]},'adminUrl':{'type':Sequelize[_0x4c27('0x4')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x4c27('0x4')]},'scriptPath':{'type':Sequelize[_0x4c27('0x4')]}}; \ No newline at end of file +var _0xee4e=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING'];(function(_0x1cdf19,_0x2c4b46){var _0x340a02=function(_0x101858){while(--_0x101858){_0x1cdf19['push'](_0x1cdf19['shift']());}};_0x340a02(++_0x2c4b46);}(_0xee4e,0x18a));var _0xeee4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xee4e[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xeee4('0x0')]={'name':{'type':Sequelize[_0xeee4('0x1')]},'type':{'type':Sequelize[_0xeee4('0x2')](_0xeee4('0x3'),'script')},'description':{'type':Sequelize[_0xeee4('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xeee4('0x1')],'comment':_0xeee4('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xeee4('0x6')},'sidebar':{'type':Sequelize[_0xeee4('0x2')](_0xeee4('0x7'),_0xeee4('0x8'),_0xeee4('0x9'),_0xeee4('0xa')),'defaultValue':_0xeee4('0x9'),'comment':_0xeee4('0xb')},'icon':{'type':Sequelize[_0xeee4('0x1')]},'adminUrl':{'type':Sequelize[_0xeee4('0x1')]},'agentUrl':{'type':Sequelize[_0xeee4('0x1')]},'scriptName':{'type':Sequelize[_0xeee4('0x1')]},'scriptPath':{'type':Sequelize[_0xeee4('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 395613d..7cee7aa 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 _0x6409=['filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','download','find','root','server/files/plugins','%s.zip','basename','warning','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','error','pipe','**/*','join','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','catch','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','type','views','Invalid\x20manifest:\x20views\x20missing','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','format','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','archiver','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','count','offset','set','reject','save','update','destroy','then','Plugins','UserProfileResource','end','stack','name','send','map','Plugin','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x13c70c,_0x546b34){var _0x50f0f2=function(_0x2a2991){while(--_0x2a2991){_0x13c70c['push'](_0x13c70c['shift']());}};_0x50f0f2(++_0x546b34);}(_0x6409,0x1ae));var _0x9640=function(_0x3ba634,_0x18e15a){_0x3ba634=_0x3ba634-0x0;var _0x196484=_0x6409[_0x3ba634];return _0x196484;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9640('0x0'));var zipdir=require(_0x9640('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9640('0x2'));var BPromise=require(_0x9640('0x3'));var Mustache=require(_0x9640('0x4'));var util=require(_0x9640('0x5'));var path=require(_0x9640('0x6'));var sox=require(_0x9640('0x7'));var csv=require(_0x9640('0x8'));var ejs=require(_0x9640('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9640('0xa'));var jsforce=require(_0x9640('0xb'));var deskjs=require(_0x9640('0xc'));var toCsv=require(_0x9640('0x8'));var querystring=require(_0x9640('0xd'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x9640('0x0'));var archiver=require(_0x9640('0xe'));var Redis=require('ioredis');var authService=require(_0x9640('0xf'));var qs=require(_0x9640('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9640('0x11'));var logger=require(_0x9640('0x12'))(_0x9640('0x13'));var utils=require('../../config/utils');var config=require(_0x9640('0x14'));var licenseUtil=require(_0x9640('0x15'));var db=require('../../mysqldb')['db'];config[_0x9640('0x16')]=_[_0x9640('0x17')](config[_0x9640('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9640('0x18'))(new Redis(config[_0x9640('0x16')]));require(_0x9640('0x19'))[_0x9640('0x1a')](socket);function respondWithStatusCode(_0x367c54,_0x51866f){_0x51866f=_0x51866f||0xcc;return function(_0x3b44ca){if(_0x3b44ca){return _0x367c54[_0x9640('0x1b')](_0x51866f);}return _0x367c54[_0x9640('0x1c')](_0x51866f)['end']();};}function respondWithResult(_0x163107,_0x156908){_0x156908=_0x156908||0xc8;return function(_0x212c83){if(_0x212c83){return _0x163107[_0x9640('0x1c')](_0x156908)[_0x9640('0x1d')](_0x212c83);}};}function respondWithFilteredResult(_0x510902,_0x30941f){return function(_0x220cca){if(_0x220cca){var _0x5d02a4=_0x220cca[_0x9640('0x1e')],_0x440b3b=_0x30941f[_0x9640('0x1f')],_0x5a4d19=_0x30941f[_0x9640('0x1f')]+_0x30941f['limit'],_0x50d51f;if(_0x5a4d19>=_0x5d02a4){_0x5a4d19=_0x5d02a4;_0x50d51f=0xc8;}else{_0x50d51f=0xce;}_0x510902[_0x9640('0x1c')](_0x50d51f);return _0x510902[_0x9640('0x20')]('Content-Range',_0x440b3b+'-'+_0x5a4d19+'/'+_0x5d02a4)[_0x9640('0x1d')](_0x220cca);}return null;};}function patchUpdates(_0x4e4080){return function(_0x143b79){try{jsonpatch['apply'](_0x143b79,_0x4e4080,!![]);}catch(_0x56af0a){return BPromise[_0x9640('0x21')](_0x56af0a);}return _0x143b79[_0x9640('0x22')]();};}function saveUpdates(_0x5c5cd1,_0x5005ad){return function(_0x4717bb){if(_0x4717bb){return _0x4717bb[_0x9640('0x23')](_0x5c5cd1)['then'](function(_0x36e04f){return _0x36e04f;});}return null;};}function removeEntity(_0x29bf16,_0x4e84fc){return function(_0x43372c){if(_0x43372c){return _0x43372c[_0x9640('0x24')]()[_0x9640('0x25')](function(){var _0x195480=_0x43372c['get']({'plain':!![]});var _0x15d90a=_0x9640('0x26');return db[_0x9640('0x27')][_0x9640('0x24')]({'where':{'type':_0x15d90a,'resourceId':_0x195480['id']}})['then'](function(){return _0x43372c;});})[_0x9640('0x25')](function(){_0x29bf16[_0x9640('0x1c')](0xcc)[_0x9640('0x28')]();});}};}function handleEntityNotFound(_0x1b0df1,_0x100db8){return function(_0x525224){if(!_0x525224){_0x1b0df1['sendStatus'](0x194);}return _0x525224;};}function handleError(_0x2c6007,_0x23e15c){_0x23e15c=_0x23e15c||0x1f4;return function(_0x334fcd){logger['error'](_0x334fcd[_0x9640('0x29')]);if(_0x334fcd[_0x9640('0x2a')]){delete _0x334fcd[_0x9640('0x2a')];}_0x2c6007[_0x9640('0x1c')](_0x23e15c)[_0x9640('0x2b')](_0x334fcd);};}exports['index']=function(_0x3b8700,_0x2084e2){var _0x4c66f4={},_0x2ba53f={},_0x3a8dad={'count':0x0,'rows':[]};var _0x1d159d=_[_0x9640('0x2c')](db[_0x9640('0x2d')]['rawAttributes'],function(_0x5da0bf){return{'name':_0x5da0bf[_0x9640('0x2e')],'type':_0x5da0bf['type'][_0x9640('0x2f')]};});_0x2ba53f['model']=_[_0x9640('0x2c')](_0x1d159d,_0x9640('0x2a'));_0x2ba53f[_0x9640('0x30')]=_['keys'](_0x3b8700[_0x9640('0x30')]);_0x2ba53f[_0x9640('0x31')]=_[_0x9640('0x32')](_0x2ba53f['model'],_0x2ba53f[_0x9640('0x30')]);_0x4c66f4['attributes']=_[_0x9640('0x32')](_0x2ba53f[_0x9640('0x33')],qs[_0x9640('0x34')](_0x3b8700[_0x9640('0x30')]['fields']));_0x4c66f4[_0x9640('0x35')]=_0x4c66f4[_0x9640('0x35')][_0x9640('0x36')]?_0x4c66f4[_0x9640('0x35')]:_0x2ba53f[_0x9640('0x33')];if(!_0x3b8700['query'][_0x9640('0x37')](_0x9640('0x38'))){_0x4c66f4[_0x9640('0x39')]=qs[_0x9640('0x39')](_0x3b8700[_0x9640('0x30')][_0x9640('0x39')]);_0x4c66f4['offset']=qs[_0x9640('0x1f')](_0x3b8700[_0x9640('0x30')][_0x9640('0x1f')]);}_0x4c66f4[_0x9640('0x3a')]=qs[_0x9640('0x3b')](_0x3b8700[_0x9640('0x30')]['sort']);_0x4c66f4[_0x9640('0x3c')]=qs[_0x9640('0x31')](_[_0x9640('0x3d')](_0x3b8700[_0x9640('0x30')],_0x2ba53f[_0x9640('0x31')]),_0x1d159d);if(_0x3b8700[_0x9640('0x30')][_0x9640('0x3e')]){_0x4c66f4[_0x9640('0x3c')]=_[_0x9640('0x3f')](_0x4c66f4[_0x9640('0x3c')],{'$or':_[_0x9640('0x2c')](_0x1d159d,function(_0x2e0988){if(_0x2e0988['type']!==_0x9640('0x40')){var _0x12e81c={};_0x12e81c[_0x2e0988['name']]={'$like':'%'+_0x3b8700[_0x9640('0x30')][_0x9640('0x3e')]+'%'};return _0x12e81c;}})});}_0x4c66f4=_['merge']({},_0x4c66f4,_0x3b8700[_0x9640('0x41')]);var _0x33fa0d={'where':_0x4c66f4[_0x9640('0x3c')]};return db[_0x9640('0x2d')][_0x9640('0x1e')](_0x33fa0d)[_0x9640('0x25')](function(_0x17d7b0){_0x3a8dad['count']=_0x17d7b0;if(_0x3b8700[_0x9640('0x30')]['includeAll']){_0x4c66f4[_0x9640('0x42')]=[{'all':!![]}];}return db[_0x9640('0x2d')][_0x9640('0x43')](_0x4c66f4);})['then'](function(_0x2e9aa5){_0x3a8dad[_0x9640('0x44')]=_0x2e9aa5;return _0x3a8dad;})[_0x9640('0x25')](respondWithFilteredResult(_0x2084e2,_0x4c66f4))['catch'](handleError(_0x2084e2,null));};exports[_0x9640('0x45')]=function(_0x2922f2,_0x33b7be){var _0x565a04={'raw':!![],'where':{'id':_0x2922f2[_0x9640('0x46')]['id']}},_0xaf429f={};_0xaf429f[_0x9640('0x33')]=_[_0x9640('0x47')](db[_0x9640('0x2d')][_0x9640('0x48')]);_0xaf429f['query']=_[_0x9640('0x47')](_0x2922f2[_0x9640('0x30')]);_0xaf429f[_0x9640('0x31')]=_[_0x9640('0x32')](_0xaf429f['model'],_0xaf429f['query']);_0x565a04[_0x9640('0x35')]=_['intersection'](_0xaf429f[_0x9640('0x33')],qs[_0x9640('0x34')](_0x2922f2[_0x9640('0x30')][_0x9640('0x34')]));_0x565a04[_0x9640('0x35')]=_0x565a04['attributes'][_0x9640('0x36')]?_0x565a04[_0x9640('0x35')]:_0xaf429f['model'];if(_0x2922f2[_0x9640('0x30')][_0x9640('0x49')]){_0x565a04[_0x9640('0x42')]=[{'all':!![]}];}_0x565a04=_[_0x9640('0x3f')]({},_0x565a04,_0x2922f2['options']);return db[_0x9640('0x2d')]['find'](_0x565a04)[_0x9640('0x25')](handleEntityNotFound(_0x33b7be,null))[_0x9640('0x25')](respondWithResult(_0x33b7be,null))['catch'](handleError(_0x33b7be,null));};exports[_0x9640('0x4a')]=function(_0x22e809,_0x1a2a5b,_0x5da0a0){return db[_0x9640('0x2d')][_0x9640('0x4b')]({'where':{'id':_0x22e809['params']['id']},'attributes':[_0x9640('0x2a'),_0x9640('0x6')],'raw':!![]})[_0x9640('0x25')](handleEntityNotFound(_0x1a2a5b,null))[_0x9640('0x25')](function(_0x945ec1){if(_0x945ec1){var _0x564cbd=path['join'](config[_0x9640('0x4c')],_0x9640('0x4d'),util['format'](_0x9640('0x4e'),path[_0x9640('0x4f')](_0x945ec1[_0x9640('0x6')])));var _0x5aa81a=fs['createWriteStream'](_0x564cbd);var _0x24d291=archiver('zip',{'zlib':{'level':0x9}});_0x24d291['on'](_0x9640('0x50'),function(_0x4c7463){if(_0x4c7463[_0x9640('0x51')]==='ENOENT'){logger['error'](_0x4c7463);}else{throw new db[(_0x9640('0x52'))][(_0x9640('0x53'))](_0x9640('0x54'));}});_0x24d291['on'](_0x9640('0x55'),function(_0x5de186){throw new db[(_0x9640('0x52'))][(_0x9640('0x53'))](_0x9640('0x54'));});_0x24d291[_0x9640('0x56')](_0x5aa81a);_0x24d291['glob'](_0x9640('0x57'),{'cwd':path[_0x9640('0x58')](config[_0x9640('0x4c')],_0x9640('0x4d'),path[_0x9640('0x59')](_0x945ec1[_0x9640('0x6')])),'ignore':[path[_0x9640('0x58')](path[_0x9640('0x4f')](_0x945ec1[_0x9640('0x6')]),_0x9640('0x5a')),path['join'](path[_0x9640('0x4f')](_0x945ec1[_0x9640('0x6')]),'attachments/**/*')],'nodir':!![]})[_0x9640('0x5b')]();_0x5aa81a['on']('close',function(){if(!fs[_0x9640('0x5c')](_0x564cbd)){throw new db['Sequelize']['Error'](_0x9640('0x5d'));}return _0x1a2a5b[_0x9640('0x4a')](_0x564cbd,util['format'](_0x9640('0x4e'),path['basename'](_0x945ec1[_0x9640('0x6')])),function(_0x33a583){if(_0x33a583){throw new db[(_0x9640('0x52'))][(_0x9640('0x53'))](_0x9640('0x5e'));}fs[_0x9640('0x5f')](_0x564cbd);logger[_0x9640('0x60')](_0x9640('0x61'));logger[_0x9640('0x60')]('Temporary\x20file\x20removed');});});}return null;})[_0x9640('0x62')](handleError(_0x1a2a5b,null));};exports[_0x9640('0x63')]=function(_0x21273f,_0x592208,_0x49608c){var _0x4996ba=path[_0x9640('0x4f')](_0x21273f[_0x9640('0x64')]['filename'],path[_0x9640('0x65')](_0x21273f[_0x9640('0x64')][_0x9640('0x66')]));var _0x40f458=path['join'](config[_0x9640('0x4c')],_0x9640('0x4d'),_0x21273f[_0x9640('0x64')][_0x9640('0x66')]);var _0x21db8f=path['join'](config[_0x9640('0x4c')],'server/files/plugins',_0x4996ba);logger[_0x9640('0x60')](_0x9640('0x67'),_0x40f458);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x21db8f);try{fs[_0x9640('0x68')](_0x40f458,parseInt(_0x9640('0x69'),0x8));extract(_0x40f458,{'dir':_0x21db8f},function(_0x5af687){if(_0x5af687){logger[_0x9640('0x55')](_0x5af687);handleError(_0x5af687,!![]);};var _0x14dd97=fs[_0x9640('0x6a')](_0x21db8f);if(_0x14dd97[_0x9640('0x36')]>0x1){removeReferences(_0x40f458,_0x21db8f);logger[_0x9640('0x55')]('Invalid\x20plugin\x20structure');return _0x49608c(new Error(_0x9640('0x6b')));}var _0x184bcc=fs['lstatSync'](path['join'](_0x21db8f,_0x14dd97[0x0]));if(_0x184bcc['isFile']()){removeReferences(_0x40f458,_0x21db8f);logger['error'](_0x9640('0x6b'));return _0x49608c(new Error(_0x9640('0x6b')));}if(_0x184bcc[_0x9640('0x6c')]()){var _0x184fcc=fs['readdirSync'](path[_0x9640('0x58')](_0x21db8f,_0x14dd97[0x0]));if(_0x184fcc[_0x9640('0x36')]===0x0){removeReferences(_0x40f458,_0x21db8f);logger[_0x9640('0x55')](_0x9640('0x6b'));return _0x49608c(new Error(_0x9640('0x6b')));}var _0x58b3ec=_0x184fcc[_0x9640('0x6d')](function(_0x3ecfe3){return _0x3ecfe3===_0x9640('0x6e');});if(!_0x58b3ec){return _0x49608c(new Error('Plugin\x20manifest\x20missing'));}var _0x429d16=fs[_0x9640('0x6f')](path['join'](_0x21db8f,_0x14dd97[0x0],_0x9640('0x6e')));var _0x4b7bee=JSON[_0x9640('0x70')](_0x429d16);if(_0x9640('0x71')==typeof _0x4b7bee[_0x9640('0x2a')]){return _0x49608c(new Error(_0x9640('0x72')));}if(_0x9640('0x71')==typeof _0x4b7bee['type']){return _0x49608c(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x9640('0x71')==typeof _0x4b7bee[_0x9640('0x73')]){return _0x49608c(new Error(_0x9640('0x74')));}if(_0x9640('0x71')==typeof _0x4b7bee[_0x9640('0x75')]){return _0x49608c(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4b7bee[_0x9640('0x76')]==='html'){if('undefined'==typeof _0x4b7bee[_0x9640('0x75')][_0x9640('0x77')]){return _0x49608c(new Error(_0x9640('0x78')));}if(_0x9640('0x71')==typeof _0x4b7bee[_0x9640('0x75')][_0x9640('0x77')]['admin']&&'undefined'==typeof _0x4b7bee['parameters'][_0x9640('0x77')]['agent']){return _0x49608c(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4b7bee[_0x9640('0x76')]===_0x9640('0x79')){if('undefined'==typeof _0x4b7bee[_0x9640('0x75')][_0x9640('0x7a')]){return _0x49608c(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x9640('0x71')==typeof _0x4b7bee[_0x9640('0x75')][_0x9640('0x7b')]){return _0x49608c(new Error(_0x9640('0x7c')));}}else{return _0x49608c(new Error(_0x9640('0x7d')));}var _0x5f0184=_0x4b7bee[_0x9640('0x2a')];var _0x1ce0af=_0x4b7bee[_0x9640('0x7e')];var _0x237d03=_0x4b7bee[_0x9640('0x76')];var _0x263eb8=_0x4b7bee[_0x9640('0x7f')]?_0x4b7bee[_0x9640('0x7f')]:'always';var _0x370345=_0x4b7bee[_0x9640('0x80')]?_0x4b7bee[_0x9640('0x80')]:_0x9640('0x81');var _0x5b42f3='';var _0x28ed57='';var _0x44498e='';var _0x32fb3d='';var _0x1106b8=_0x4b7bee[_0x9640('0x73')];if(_0x237d03==='html'){if('undefined'!=typeof _0x4b7bee[_0x9640('0x75')][_0x9640('0x77')][_0x9640('0x82')]){var _0x132a4c=_0x4b7bee[_0x9640('0x75')][_0x9640('0x77')][_0x9640('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x9640('0x83')](_0x132a4c)){_0x5b42f3=path[_0x9640('0x58')](_0x9640('0x84'),_0x4996ba,_0x14dd97[0x0],_0x132a4c);}else{_0x5b42f3=_0x132a4c;}}else{logger[_0x9640('0x60')](_0x9640('0x85'));}if('undefined'!=typeof _0x4b7bee['parameters']['views'][_0x9640('0x86')]){var _0x462274=_0x4b7bee['parameters'][_0x9640('0x77')][_0x9640('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x9640('0x83')](_0x462274)){_0x28ed57=path[_0x9640('0x58')](_0x9640('0x84'),_0x4996ba,_0x14dd97[0x0],_0x462274);}else{_0x28ed57=_0x462274;}}else{logger[_0x9640('0x60')](_0x9640('0x87'));}}else if(_0x237d03==='script'){_0x44498e=_0x4b7bee[_0x9640('0x75')][_0x9640('0x7a')];_0x32fb3d=_0x4b7bee[_0x9640('0x75')][_0x9640('0x7b')];if(_0x9640('0x71')!=typeof _0x4b7bee[_0x9640('0x75')][_0x9640('0x77')]){if(_0x9640('0x71')!=typeof _0x4b7bee['parameters']['views'][_0x9640('0x82')]){var _0x132a4c=_0x4b7bee[_0x9640('0x75')]['views'][_0x9640('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x9640('0x83')](_0x132a4c)){_0x5b42f3=path[_0x9640('0x58')]('plugins',_0x4996ba,_0x14dd97[0x0],_0x132a4c);}else{_0x5b42f3=_0x132a4c;}}if(_0x9640('0x71')!=typeof _0x4b7bee[_0x9640('0x75')]['views'][_0x9640('0x86')]){var _0x462274=_0x4b7bee[_0x9640('0x75')][_0x9640('0x77')][_0x9640('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x9640('0x83')](_0x462274)){_0x28ed57=path[_0x9640('0x58')](_0x9640('0x84'),_0x4996ba,_0x14dd97[0x0],_0x462274);}else{_0x28ed57=_0x462274;}}}}var _0x13e3c4={'name':_0x5f0184,'description':_0x1ce0af,'path':path[_0x9640('0x58')](_0x4996ba,_0x14dd97[0x0]),'type':_0x237d03,'sidebar':_0x263eb8,'icon':_0x370345,'adminUrl':_0x5b42f3,'agentUrl':_0x28ed57,'scriptName':_0x44498e,'scriptPath':_0x32fb3d,'version':_0x1106b8};removeReferences(_0x40f458,null);return db['Plugin'][_0x9640('0x88')](_0x13e3c4)['then'](function(_0x244089){var _0x3e5330={'role':_0x21273f[_0x9640('0x89')][_0x9640('0x8a')],'userProfileId':_0x21273f['body']['userProfileId']};if(!_0x3e5330)throw new Error(_0x9640('0x8b'));if(_0x3e5330[_0x9640('0x8a')]===_0x9640('0x8c')){var _0x78f748=_0x244089[_0x9640('0x8d')]({'plain':!![]});return db[_0x9640('0x8e')][_0x9640('0x4b')]({'where':{'name':_0x9640('0x26'),'userProfileId':_0x3e5330[_0x9640('0x8f')]},'raw':!![]})[_0x9640('0x25')](function(_0xc341c1){if(_0xc341c1&&_0xc341c1[_0x9640('0x90')]===0x0){return db['UserProfileResource'][_0x9640('0x88')]({'name':_0x78f748[_0x9640('0x2a')],'resourceId':_0x78f748['id'],'type':_0xc341c1['name'],'sectionId':_0xc341c1['id']},{})['then'](function(){return _0x244089;});}else{return _0x244089;}})[_0x9640('0x62')](function(_0x15ab44){logger[_0x9640('0x55')](_0x9640('0x91'),_0x15ab44);throw _0x15ab44;});}return _0x244089;})[_0x9640('0x25')](respondWithResult(_0x592208,null))['catch'](handleError(_0x592208,null));}});}catch(_0x152e81){_0x592208[_0x9640('0x1c')](0x1f4)[_0x9640('0x2b')](_0x152e81);}};function removeReferences(_0x2e8a6c,_0x4f7ae3){try{if(_0x2e8a6c){fs['unlinkSync'](_0x2e8a6c);logger[_0x9640('0x60')](_0x9640('0x92'));}if(_0x4f7ae3){rimraf(_0x4f7ae3,function(){});logger[_0x9640('0x60')](_0x9640('0x93'));}}catch(_0x1b2907){logger[_0x9640('0x55')](_0x1b2907);}}exports[_0x9640('0x23')]=function(_0x4c2d71,_0x3071b0,_0x47e78d){return db[_0x9640('0x2d')][_0x9640('0x4b')]({'where':{'id':_0x4c2d71[_0x9640('0x46')]['id']}})[_0x9640('0x25')](handleEntityNotFound(_0x3071b0,null))['then'](saveUpdates(_0x4c2d71[_0x9640('0x89')],null))['then'](respondWithResult(_0x3071b0,null))[_0x9640('0x62')](handleError(_0x3071b0,null));};exports['delete']=function(_0x1c315c,_0x2bf044,_0x26078e){return db[_0x9640('0x2d')][_0x9640('0x4b')]({'where':{'id':_0x1c315c['params']['id']}})['then'](function(_0x37ef72){if(_0x37ef72){return _0x37ef72[_0x9640('0x24')]();}})[_0x9640('0x25')](function(_0x17ebec){rimraf(path[_0x9640('0x58')](config[_0x9640('0x4c')],_0x9640('0x4d'),path[_0x9640('0x59')](_0x17ebec[_0x9640('0x6')])),function(){});return _0x17ebec;})[_0x9640('0x25')](handleEntityNotFound(_0x2bf044,null))[_0x9640('0x25')](respondWithStatusCode(_0x2bf044,null))[_0x9640('0x62')](handleError(_0x2bf044,null));};exports['webhookGet']=function(_0x58a14e,_0x4561b7,_0xffa2b6){return BPromise['resolve']()[_0x9640('0x25')](function(){if(!_0x58a14e['query']['path']){throw new Error(_0x9640('0x94'));}if(!_0x58a14e['query']['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x2e447c=_0x58a14e['query']['hostname']?_0x58a14e[_0x9640('0x30')][_0x9640('0x95')]+':'+_0x58a14e[_0x9640('0x30')][_0x9640('0x96')]:_0x9640('0x97')+_0x58a14e['query'][_0x9640('0x96')];var _0x3fae31=_0x58a14e[_0x9640('0x30')][_0x9640('0x1d')]?_0x58a14e['query'][_0x9640('0x1d')]:!![];var _0x3e5f30=_0x58a14e[_0x9640('0x30')]['encoding']?_0x58a14e[_0x9640('0x30')][_0x9640('0x98')]:null;var _0x459cfc={'method':_0x58a14e[_0x9640('0x99')],'uri':util[_0x9640('0x9a')]('%s%s',_0x2e447c,_0x58a14e[_0x9640('0x30')][_0x9640('0x6')]),'json':_0x3fae31,'resolveWithFullResponse':!![],'encoding':_0x3e5f30,'qs':_0x58a14e[_0x9640('0x30')]};if(_0x58a14e[_0x9640('0x9b')]){_0x459cfc[_0x9640('0x9b')]=_0x58a14e[_0x9640('0x9b')];if(_0x459cfc['headers'][_0x9640('0x9c')]){delete _0x459cfc['headers'][_0x9640('0x9c')];}}if(_0x459cfc['headers']['content-type']){delete _0x459cfc[_0x9640('0x9b')][_0x9640('0x9d')];}return rp(_0x459cfc);})[_0x9640('0x25')](function(_0x135a03){if(_0x135a03){_0x4561b7['set'](_0x135a03['headers']);logger['info'](_0x135a03[_0x9640('0x89')]);if(_[_0x9640('0x9e')](_0x58a14e[_0x9640('0x30')]['path'],'download')&&_0x135a03[_0x9640('0x9f')]==0x1f4){return _0x4561b7[_0x9640('0x1b')](_0x135a03[_0x9640('0x9f')]);}else{return _0x4561b7['status'](_0x135a03[_0x9640('0x9f')])[_0x9640('0x2b')](_0x135a03[_0x9640('0x89')]);}}else{return _0x4561b7[_0x9640('0x1b')](0xc8);}})[_0x9640('0x62')](handleError(_0x4561b7,null));};exports[_0x9640('0xa0')]=function(_0x592309,_0x533bb8,_0x261a33){return BPromise[_0x9640('0xa1')]()[_0x9640('0x25')](function(){if(!_0x592309[_0x9640('0x30')]['path']){throw new Error(_0x9640('0x94'));}if(!_0x592309['query'][_0x9640('0x96')]){throw new Error(_0x9640('0xa2'));}var _0x4f6de8=_0x592309[_0x9640('0x30')]['hostname']?_0x592309[_0x9640('0x30')][_0x9640('0x95')]+':'+_0x592309['query']['port']:_0x9640('0x97')+_0x592309[_0x9640('0x30')][_0x9640('0x96')];var _0x23bb0a=_0x592309[_0x9640('0x30')][_0x9640('0x1d')]?_0x592309['query'][_0x9640('0x1d')]:!![];var _0x28f382=_0x592309['query'][_0x9640('0x98')]?_0x592309[_0x9640('0x30')][_0x9640('0x98')]:null;var _0x4c12e1={'method':_0x592309[_0x9640('0x99')],'uri':util['format'](_0x9640('0xa3'),_0x4f6de8,_0x592309['query'][_0x9640('0x6')]),'json':_0x23bb0a,'resolveWithFullResponse':!![],'encoding':_0x28f382,'body':_0x592309[_0x9640('0x89')]};if(_0x592309['headers']){_0x4c12e1[_0x9640('0x9b')]=_0x592309[_0x9640('0x9b')];if(_0x4c12e1[_0x9640('0x9b')]['content-length']){delete _0x4c12e1[_0x9640('0x9b')]['content-length'];}}if(_0x4c12e1[_0x9640('0x9b')][_0x9640('0x9d')]){delete _0x4c12e1[_0x9640('0x9b')][_0x9640('0x9d')];}return rp(_0x4c12e1);})[_0x9640('0x25')](function(_0xf37e0e){if(_0xf37e0e){_0x533bb8[_0x9640('0x20')](_0xf37e0e[_0x9640('0x9b')]);logger[_0x9640('0x60')](_0xf37e0e[_0x9640('0x89')]);return _0x533bb8[_0x9640('0x1c')](_0xf37e0e[_0x9640('0x9f')])[_0x9640('0x2b')](_0xf37e0e['body']);}else{return _0x533bb8['sendStatus'](0xc8);}})[_0x9640('0x62')](handleError(_0x533bb8,null));}; \ No newline at end of file +var _0x95f5=['hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','keys','includeAll','find','download','params','join','root','server/files/plugins','createWriteStream','zip','warning','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon-apps','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','dirname','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x2697b5,_0x5769e6){var _0x54bc5a=function(_0x11116c){while(--_0x11116c){_0x2697b5['push'](_0x2697b5['shift']());}};_0x54bc5a(++_0x5769e6);}(_0x95f5,0x70));var _0x595f=function(_0x407fb0,_0x35dabb){_0x407fb0=_0x407fb0-0x0;var _0x2db901=_0x95f5[_0x407fb0];return _0x2db901;};'use strict';var pdf=require(_0x595f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x595f('0x1'));var jsonpatch=require(_0x595f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x595f('0x3'));var Mustache=require(_0x595f('0x4'));var util=require(_0x595f('0x5'));var path=require(_0x595f('0x6'));var sox=require(_0x595f('0x7'));var csv=require('to-csv');var ejs=require(_0x595f('0x8'));var fs=require('fs');var _=require(_0x595f('0x9'));var squel=require(_0x595f('0xa'));var crypto=require(_0x595f('0xb'));var jsforce=require(_0x595f('0xc'));var deskjs=require(_0x595f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x595f('0xe'));var Papa=require(_0x595f('0xf'));var extract=require(_0x595f('0x10'));var rimraf=require('rimraf');var archiver=require(_0x595f('0x11'));var Redis=require(_0x595f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x595f('0x13'));var hardwareService=require(_0x595f('0x14'));var logger=require(_0x595f('0x15'))(_0x595f('0x16'));var utils=require(_0x595f('0x17'));var config=require(_0x595f('0x18'));var licenseUtil=require(_0x595f('0x19'));var db=require(_0x595f('0x1a'))['db'];config[_0x595f('0x1b')]=_[_0x595f('0x1c')](config[_0x595f('0x1b')],{'host':_0x595f('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x595f('0x1b')]));require('./plugin.socket')[_0x595f('0x1e')](socket);function respondWithStatusCode(_0x436429,_0x1de0b0){_0x1de0b0=_0x1de0b0||0xcc;return function(_0x2b7af1){if(_0x2b7af1){return _0x436429[_0x595f('0x1f')](_0x1de0b0);}return _0x436429['status'](_0x1de0b0)[_0x595f('0x20')]();};}function respondWithResult(_0x9b9d84,_0x2ec643){_0x2ec643=_0x2ec643||0xc8;return function(_0x1defbb){if(_0x1defbb){return _0x9b9d84[_0x595f('0x21')](_0x2ec643)[_0x595f('0x22')](_0x1defbb);}};}function respondWithFilteredResult(_0xfb986c,_0x16b90d){return function(_0x5904ef){if(_0x5904ef){var _0x24662a=_0x5904ef[_0x595f('0x23')],_0x5ef05c=_0x16b90d[_0x595f('0x24')],_0x37bef7=_0x16b90d[_0x595f('0x24')]+_0x16b90d['limit'],_0x3a3acd;if(_0x37bef7>=_0x24662a){_0x37bef7=_0x24662a;_0x3a3acd=0xc8;}else{_0x3a3acd=0xce;}_0xfb986c[_0x595f('0x21')](_0x3a3acd);return _0xfb986c['set'](_0x595f('0x25'),_0x5ef05c+'-'+_0x37bef7+'/'+_0x24662a)[_0x595f('0x22')](_0x5904ef);}return null;};}function patchUpdates(_0x416067){return function(_0x36b08a){try{jsonpatch[_0x595f('0x26')](_0x36b08a,_0x416067,!![]);}catch(_0x3dc503){return BPromise[_0x595f('0x27')](_0x3dc503);}return _0x36b08a[_0x595f('0x28')]();};}function saveUpdates(_0x2cc882,_0x29af99){return function(_0x4754a4){if(_0x4754a4){return _0x4754a4[_0x595f('0x29')](_0x2cc882)[_0x595f('0x2a')](function(_0x3010e0){return _0x3010e0;});}return null;};}function removeEntity(_0x39c9e6,_0x2097f2){return function(_0x248c67){if(_0x248c67){return _0x248c67[_0x595f('0x2b')]()[_0x595f('0x2a')](function(){var _0x1a5903=_0x248c67[_0x595f('0x2c')]({'plain':!![]});var _0x1cd71a=_0x595f('0x2d');return db[_0x595f('0x2e')]['destroy']({'where':{'type':_0x1cd71a,'resourceId':_0x1a5903['id']}})[_0x595f('0x2a')](function(){return _0x248c67;});})[_0x595f('0x2a')](function(){_0x39c9e6['status'](0xcc)[_0x595f('0x20')]();});}};}function handleEntityNotFound(_0x2e4b13,_0x1c84ad){return function(_0x1021a0){if(!_0x1021a0){_0x2e4b13[_0x595f('0x1f')](0x194);}return _0x1021a0;};}function handleError(_0xc94561,_0x1d3664){_0x1d3664=_0x1d3664||0x1f4;return function(_0x47dfcd){logger[_0x595f('0x2f')](_0x47dfcd[_0x595f('0x30')]);if(_0x47dfcd[_0x595f('0x31')]){delete _0x47dfcd[_0x595f('0x31')];}_0xc94561[_0x595f('0x21')](_0x1d3664)[_0x595f('0x32')](_0x47dfcd);};}exports[_0x595f('0x33')]=function(_0x27dcce,_0x3877d7){var _0x29cf30={},_0x205ae8={},_0x685b94={'count':0x0,'rows':[]};var _0x25692c=_[_0x595f('0x34')](db[_0x595f('0x35')][_0x595f('0x36')],function(_0x30b7f8){return{'name':_0x30b7f8['fieldName'],'type':_0x30b7f8['type'][_0x595f('0x37')]};});_0x205ae8[_0x595f('0x38')]=_[_0x595f('0x34')](_0x25692c,_0x595f('0x31'));_0x205ae8['query']=_['keys'](_0x27dcce[_0x595f('0x39')]);_0x205ae8[_0x595f('0x3a')]=_[_0x595f('0x3b')](_0x205ae8['model'],_0x205ae8[_0x595f('0x39')]);_0x29cf30['attributes']=_['intersection'](_0x205ae8['model'],qs[_0x595f('0x3c')](_0x27dcce[_0x595f('0x39')][_0x595f('0x3c')]));_0x29cf30[_0x595f('0x3d')]=_0x29cf30[_0x595f('0x3d')][_0x595f('0x3e')]?_0x29cf30[_0x595f('0x3d')]:_0x205ae8[_0x595f('0x38')];if(!_0x27dcce[_0x595f('0x39')][_0x595f('0x3f')](_0x595f('0x40'))){_0x29cf30[_0x595f('0x41')]=qs[_0x595f('0x41')](_0x27dcce[_0x595f('0x39')]['limit']);_0x29cf30['offset']=qs['offset'](_0x27dcce[_0x595f('0x39')][_0x595f('0x24')]);}_0x29cf30[_0x595f('0x42')]=qs[_0x595f('0x43')](_0x27dcce[_0x595f('0x39')][_0x595f('0x43')]);_0x29cf30[_0x595f('0x44')]=qs[_0x595f('0x3a')](_[_0x595f('0x45')](_0x27dcce[_0x595f('0x39')],_0x205ae8[_0x595f('0x3a')]),_0x25692c);if(_0x27dcce['query'][_0x595f('0x46')]){_0x29cf30['where']=_[_0x595f('0x47')](_0x29cf30[_0x595f('0x44')],{'$or':_['map'](_0x25692c,function(_0x594cce){if(_0x594cce[_0x595f('0x48')]!==_0x595f('0x49')){var _0x573355={};_0x573355[_0x594cce[_0x595f('0x31')]]={'$like':'%'+_0x27dcce['query']['filter']+'%'};return _0x573355;}})});}_0x29cf30=_[_0x595f('0x47')]({},_0x29cf30,_0x27dcce[_0x595f('0x4a')]);var _0x126dcd={'where':_0x29cf30[_0x595f('0x44')]};return db['Plugin'][_0x595f('0x23')](_0x126dcd)['then'](function(_0x5844b5){_0x685b94[_0x595f('0x23')]=_0x5844b5;if(_0x27dcce[_0x595f('0x39')]['includeAll']){_0x29cf30[_0x595f('0x4b')]=[{'all':!![]}];}return db[_0x595f('0x35')][_0x595f('0x4c')](_0x29cf30);})[_0x595f('0x2a')](function(_0x5443cc){_0x685b94[_0x595f('0x4d')]=_0x5443cc;return _0x685b94;})[_0x595f('0x2a')](respondWithFilteredResult(_0x3877d7,_0x29cf30))[_0x595f('0x4e')](handleError(_0x3877d7,null));};exports[_0x595f('0x4f')]=function(_0x497829,_0x38a974){var _0x5ccca0={'raw':!![],'where':{'id':_0x497829['params']['id']}},_0xc2140={};_0xc2140['model']=_[_0x595f('0x50')](db[_0x595f('0x35')]['rawAttributes']);_0xc2140[_0x595f('0x39')]=_['keys'](_0x497829['query']);_0xc2140[_0x595f('0x3a')]=_[_0x595f('0x3b')](_0xc2140[_0x595f('0x38')],_0xc2140[_0x595f('0x39')]);_0x5ccca0['attributes']=_[_0x595f('0x3b')](_0xc2140['model'],qs['fields'](_0x497829['query'][_0x595f('0x3c')]));_0x5ccca0[_0x595f('0x3d')]=_0x5ccca0['attributes'][_0x595f('0x3e')]?_0x5ccca0['attributes']:_0xc2140['model'];if(_0x497829[_0x595f('0x39')][_0x595f('0x51')]){_0x5ccca0[_0x595f('0x4b')]=[{'all':!![]}];}_0x5ccca0=_[_0x595f('0x47')]({},_0x5ccca0,_0x497829[_0x595f('0x4a')]);return db[_0x595f('0x35')][_0x595f('0x52')](_0x5ccca0)[_0x595f('0x2a')](handleEntityNotFound(_0x38a974,null))[_0x595f('0x2a')](respondWithResult(_0x38a974,null))[_0x595f('0x4e')](handleError(_0x38a974,null));};exports[_0x595f('0x53')]=function(_0x5d8b62,_0x293eb2,_0x48c808){return db[_0x595f('0x35')][_0x595f('0x52')]({'where':{'id':_0x5d8b62[_0x595f('0x54')]['id']},'attributes':[_0x595f('0x31'),_0x595f('0x6')],'raw':!![]})[_0x595f('0x2a')](handleEntityNotFound(_0x293eb2,null))[_0x595f('0x2a')](function(_0x15ee59){if(_0x15ee59){var _0x47f800=path[_0x595f('0x55')](config[_0x595f('0x56')],_0x595f('0x57'),util['format']('%s.zip',path['basename'](_0x15ee59['path'])));var _0xea061c=fs[_0x595f('0x58')](_0x47f800);var _0x51af5f=archiver(_0x595f('0x59'),{'zlib':{'level':0x9}});_0x51af5f['on'](_0x595f('0x5a'),function(_0x1ef666){if(_0x1ef666['code']==='ENOENT'){logger[_0x595f('0x2f')](_0x1ef666);}else{throw new db[(_0x595f('0x5b'))]['Error'](_0x595f('0x5c'));}});_0x51af5f['on']('error',function(_0x10f342){throw new db[(_0x595f('0x5b'))][(_0x595f('0x5d'))](_0x595f('0x5c'));});_0x51af5f[_0x595f('0x5e')](_0xea061c);_0x51af5f[_0x595f('0x5f')](_0x595f('0x60'),{'cwd':path[_0x595f('0x55')](config[_0x595f('0x56')],_0x595f('0x57'),path['dirname'](_0x15ee59['path'])),'ignore':[path['join'](path[_0x595f('0x61')](_0x15ee59[_0x595f('0x6')]),_0x595f('0x62')),path['join'](path[_0x595f('0x61')](_0x15ee59[_0x595f('0x6')]),_0x595f('0x63'))],'nodir':!![]})[_0x595f('0x64')]();_0xea061c['on'](_0x595f('0x65'),function(){if(!fs[_0x595f('0x66')](_0x47f800)){throw new db[(_0x595f('0x5b'))][(_0x595f('0x5d'))](_0x595f('0x67'));}return _0x293eb2[_0x595f('0x53')](_0x47f800,util['format'](_0x595f('0x68'),path[_0x595f('0x61')](_0x15ee59['path'])),function(_0x42d005){if(_0x42d005){throw new db[(_0x595f('0x5b'))][(_0x595f('0x5d'))](_0x595f('0x69'));}fs[_0x595f('0x6a')](_0x47f800);logger[_0x595f('0x6b')](_0x595f('0x6c'));logger[_0x595f('0x6b')](_0x595f('0x6d'));});});}return null;})['catch'](handleError(_0x293eb2,null));};exports[_0x595f('0x6e')]=function(_0x517c62,_0x46bda1,_0x2e6748){var _0x156bbd=path[_0x595f('0x61')](_0x517c62[_0x595f('0x6f')]['filename'],path['extname'](_0x517c62['file']['filename']));var _0x4d15ad=path['join'](config['root'],_0x595f('0x57'),_0x517c62[_0x595f('0x6f')]['filename']);var _0x122a17=path[_0x595f('0x55')](config[_0x595f('0x56')],_0x595f('0x57'),_0x156bbd);logger['info'](_0x595f('0x70'),_0x4d15ad);logger[_0x595f('0x6b')]('Plugin\x20upload\x20destination:\x20%s',_0x122a17);try{fs[_0x595f('0x71')](_0x4d15ad,parseInt(_0x595f('0x72'),0x8));extract(_0x4d15ad,{'dir':_0x122a17},function(_0x475269){if(_0x475269){logger[_0x595f('0x2f')](_0x475269);handleError(_0x475269,!![]);};var _0x104593=fs[_0x595f('0x73')](_0x122a17);if(_0x104593['length']>0x1){removeReferences(_0x4d15ad,_0x122a17);logger[_0x595f('0x2f')](_0x595f('0x74'));return _0x2e6748(new Error(_0x595f('0x74')));}var _0x35edd1=fs[_0x595f('0x75')](path[_0x595f('0x55')](_0x122a17,_0x104593[0x0]));if(_0x35edd1[_0x595f('0x76')]()){removeReferences(_0x4d15ad,_0x122a17);logger[_0x595f('0x2f')](_0x595f('0x74'));return _0x2e6748(new Error(_0x595f('0x74')));}if(_0x35edd1['isDirectory']()){var _0x2b80d4=fs['readdirSync'](path['join'](_0x122a17,_0x104593[0x0]));if(_0x2b80d4[_0x595f('0x3e')]===0x0){removeReferences(_0x4d15ad,_0x122a17);logger['error'](_0x595f('0x74'));return _0x2e6748(new Error('Invalid\x20plugin\x20structure'));}var _0x51806d=_0x2b80d4[_0x595f('0x77')](function(_0x29840b){return _0x29840b===_0x595f('0x78');});if(!_0x51806d){return _0x2e6748(new Error(_0x595f('0x79')));}var _0x6ff683=fs[_0x595f('0x7a')](path['join'](_0x122a17,_0x104593[0x0],_0x595f('0x78')));var _0x31f111=JSON[_0x595f('0x7b')](_0x6ff683);if(_0x595f('0x7c')==typeof _0x31f111[_0x595f('0x31')]){return _0x2e6748(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x595f('0x7c')==typeof _0x31f111[_0x595f('0x48')]){return _0x2e6748(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x595f('0x7c')==typeof _0x31f111[_0x595f('0x7d')]){return _0x2e6748(new Error(_0x595f('0x7e')));}if('undefined'==typeof _0x31f111['parameters']){return _0x2e6748(new Error(_0x595f('0x7f')));}if(_0x31f111[_0x595f('0x48')]===_0x595f('0x80')){if(_0x595f('0x7c')==typeof _0x31f111[_0x595f('0x81')][_0x595f('0x82')]){return _0x2e6748(new Error(_0x595f('0x83')));}if(_0x595f('0x7c')==typeof _0x31f111[_0x595f('0x81')][_0x595f('0x82')][_0x595f('0x84')]&&_0x595f('0x7c')==typeof _0x31f111[_0x595f('0x81')][_0x595f('0x82')][_0x595f('0x85')]){return _0x2e6748(new Error(_0x595f('0x86')));}}else if(_0x31f111[_0x595f('0x48')]===_0x595f('0x87')){if(_0x595f('0x7c')==typeof _0x31f111[_0x595f('0x81')][_0x595f('0x88')]){return _0x2e6748(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x595f('0x7c')==typeof _0x31f111[_0x595f('0x81')][_0x595f('0x89')]){return _0x2e6748(new Error(_0x595f('0x8a')));}}else{return _0x2e6748(new Error(_0x595f('0x8b')));}var _0x271314=_0x31f111['name'];var _0x742ba1=_0x31f111[_0x595f('0x8c')];var _0x11a301=_0x31f111['type'];var _0xb9a41e=_0x31f111[_0x595f('0x8d')]?_0x31f111[_0x595f('0x8d')]:_0x595f('0x8e');var _0x1f2eeb=_0x31f111['icon']?_0x31f111['icon']:_0x595f('0x8f');var _0x56a767='';var _0x179066='';var _0x14f4c0='';var _0x2dbd4e='';var _0x187200=_0x31f111[_0x595f('0x7d')];if(_0x11a301===_0x595f('0x80')){if(_0x595f('0x7c')!=typeof _0x31f111['parameters']['views']['admin']){var _0x510024=_0x31f111[_0x595f('0x81')][_0x595f('0x82')][_0x595f('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x595f('0x90')](_0x510024)){_0x56a767=path[_0x595f('0x55')]('plugins',_0x156bbd,_0x104593[0x0],_0x510024);}else{_0x56a767=_0x510024;}}else{logger[_0x595f('0x6b')](_0x595f('0x91'));}if(_0x595f('0x7c')!=typeof _0x31f111[_0x595f('0x81')]['views'][_0x595f('0x85')]){var _0xb9d9d5=_0x31f111['parameters'][_0x595f('0x82')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x595f('0x90')](_0xb9d9d5)){_0x179066=path[_0x595f('0x55')]('plugins',_0x156bbd,_0x104593[0x0],_0xb9d9d5);}else{_0x179066=_0xb9d9d5;}}else{logger[_0x595f('0x6b')](_0x595f('0x92'));}}else if(_0x11a301===_0x595f('0x87')){_0x14f4c0=_0x31f111['parameters'][_0x595f('0x88')];_0x2dbd4e=_0x31f111[_0x595f('0x81')][_0x595f('0x89')];if('undefined'!=typeof _0x31f111[_0x595f('0x81')][_0x595f('0x82')]){if(_0x595f('0x7c')!=typeof _0x31f111[_0x595f('0x81')]['views']['admin']){var _0x510024=_0x31f111['parameters'][_0x595f('0x82')][_0x595f('0x84')];if(!/^(f|ht)tps?:\/\//i[_0x595f('0x90')](_0x510024)){_0x56a767=path[_0x595f('0x55')](_0x595f('0x93'),_0x156bbd,_0x104593[0x0],_0x510024);}else{_0x56a767=_0x510024;}}if(_0x595f('0x7c')!=typeof _0x31f111['parameters'][_0x595f('0x82')][_0x595f('0x85')]){var _0xb9d9d5=_0x31f111['parameters'][_0x595f('0x82')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x595f('0x90')](_0xb9d9d5)){_0x179066=path[_0x595f('0x55')](_0x595f('0x93'),_0x156bbd,_0x104593[0x0],_0xb9d9d5);}else{_0x179066=_0xb9d9d5;}}}}var _0xfe5f22={'name':_0x271314,'description':_0x742ba1,'path':path[_0x595f('0x55')](_0x156bbd,_0x104593[0x0]),'type':_0x11a301,'sidebar':_0xb9a41e,'icon':_0x1f2eeb,'adminUrl':_0x56a767,'agentUrl':_0x179066,'scriptName':_0x14f4c0,'scriptPath':_0x2dbd4e,'version':_0x187200};removeReferences(_0x4d15ad,null);return db[_0x595f('0x35')][_0x595f('0x94')](_0xfe5f22)['then'](function(_0x4bc4af){var _0x562419={'role':_0x517c62[_0x595f('0x95')][_0x595f('0x96')],'userProfileId':_0x517c62[_0x595f('0x95')]['userProfileId']};if(!_0x562419)throw new Error(_0x595f('0x97'));if(_0x562419['role']===_0x595f('0x98')){var _0x2d9120=_0x4bc4af[_0x595f('0x2c')]({'plain':!![]});return db[_0x595f('0x99')][_0x595f('0x52')]({'where':{'name':_0x595f('0x2d'),'userProfileId':_0x562419['userProfileId']},'raw':!![]})[_0x595f('0x2a')](function(_0x35e6f5){if(_0x35e6f5&&_0x35e6f5[_0x595f('0x9a')]===0x0){return db[_0x595f('0x2e')][_0x595f('0x94')]({'name':_0x2d9120[_0x595f('0x31')],'resourceId':_0x2d9120['id'],'type':_0x35e6f5['name'],'sectionId':_0x35e6f5['id']},{})['then'](function(){return _0x4bc4af;});}else{return _0x4bc4af;}})[_0x595f('0x4e')](function(_0x5ce3ef){logger[_0x595f('0x2f')](_0x595f('0x9b'),_0x5ce3ef);throw _0x5ce3ef;});}return _0x4bc4af;})[_0x595f('0x2a')](respondWithResult(_0x46bda1,null))['catch'](handleError(_0x46bda1,null));}});}catch(_0x417bd6){_0x46bda1[_0x595f('0x21')](0x1f4)[_0x595f('0x32')](_0x417bd6);}};function removeReferences(_0x551795,_0x31619e){try{if(_0x551795){fs[_0x595f('0x6a')](_0x551795);logger[_0x595f('0x6b')](_0x595f('0x9c'));}if(_0x31619e){rimraf(_0x31619e,function(){});logger[_0x595f('0x6b')]('Extracted\x20folder\x20removed');}}catch(_0x38bde7){logger['error'](_0x38bde7);}}exports[_0x595f('0x29')]=function(_0x3b1482,_0x5a70c2,_0x4af5e9){return db[_0x595f('0x35')][_0x595f('0x52')]({'where':{'id':_0x3b1482[_0x595f('0x54')]['id']}})[_0x595f('0x2a')](handleEntityNotFound(_0x5a70c2,null))['then'](saveUpdates(_0x3b1482['body'],null))[_0x595f('0x2a')](respondWithResult(_0x5a70c2,null))[_0x595f('0x4e')](handleError(_0x5a70c2,null));};exports[_0x595f('0x9d')]=function(_0x33e672,_0x2c1ad5,_0x1a98d1){return db[_0x595f('0x35')][_0x595f('0x52')]({'where':{'id':_0x33e672['params']['id']}})[_0x595f('0x2a')](function(_0x5489db){if(_0x5489db){return _0x5489db[_0x595f('0x2b')]();}})[_0x595f('0x2a')](function(_0x49d01e){rimraf(path[_0x595f('0x55')](config[_0x595f('0x56')],_0x595f('0x57'),path[_0x595f('0x9e')](_0x49d01e[_0x595f('0x6')])),function(){});return _0x49d01e;})[_0x595f('0x2a')](handleEntityNotFound(_0x2c1ad5,null))[_0x595f('0x2a')](respondWithStatusCode(_0x2c1ad5,null))[_0x595f('0x4e')](handleError(_0x2c1ad5,null));};exports['webhookGet']=function(_0x3569ad,_0x399f00,_0x2f03ef){return BPromise[_0x595f('0x9f')]()[_0x595f('0x2a')](function(){if(!_0x3569ad[_0x595f('0x39')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3569ad[_0x595f('0x39')]['port']){throw new Error(_0x595f('0xa0'));}var _0x55f912=_0x3569ad[_0x595f('0x39')][_0x595f('0xa1')]?_0x3569ad['query'][_0x595f('0xa1')]+':'+_0x3569ad['query'][_0x595f('0xa2')]:_0x595f('0xa3')+_0x3569ad[_0x595f('0x39')][_0x595f('0xa2')];var _0x5f0bdf=_0x3569ad[_0x595f('0x39')][_0x595f('0x22')]?_0x3569ad[_0x595f('0x39')]['json']:!![];var _0x438aae=_0x3569ad['query']['encoding']?_0x3569ad[_0x595f('0x39')][_0x595f('0xa4')]:null;var _0x1e1d2f={'method':_0x3569ad[_0x595f('0xa5')],'uri':util['format'](_0x595f('0xa6'),_0x55f912,_0x3569ad['query'][_0x595f('0x6')]),'json':_0x5f0bdf,'resolveWithFullResponse':!![],'encoding':_0x438aae,'qs':_0x3569ad['query']};if(_0x3569ad[_0x595f('0xa7')]){_0x1e1d2f[_0x595f('0xa7')]=_0x3569ad[_0x595f('0xa7')];if(_0x1e1d2f[_0x595f('0xa7')][_0x595f('0xa8')]){delete _0x1e1d2f['headers'][_0x595f('0xa8')];}}if(_0x1e1d2f[_0x595f('0xa7')][_0x595f('0xa9')]){delete _0x1e1d2f[_0x595f('0xa7')][_0x595f('0xa9')];}return rp(_0x1e1d2f);})[_0x595f('0x2a')](function(_0x5645ac){if(_0x5645ac){_0x399f00[_0x595f('0xaa')](_0x5645ac[_0x595f('0xa7')]);logger[_0x595f('0x6b')](_0x5645ac[_0x595f('0x95')]);if(_[_0x595f('0xab')](_0x3569ad['query'][_0x595f('0x6')],_0x595f('0x53'))&&_0x5645ac[_0x595f('0xac')]==0x1f4){return _0x399f00['sendStatus'](_0x5645ac['statusCode']);}else{return _0x399f00[_0x595f('0x21')](_0x5645ac[_0x595f('0xac')])[_0x595f('0x32')](_0x5645ac[_0x595f('0x95')]);}}else{return _0x399f00[_0x595f('0x1f')](0xc8);}})[_0x595f('0x4e')](handleError(_0x399f00,null));};exports[_0x595f('0xad')]=function(_0x261233,_0x1b4dc0,_0x11b6b9){return BPromise['resolve']()[_0x595f('0x2a')](function(){if(!_0x261233[_0x595f('0x39')]['path']){throw new Error(_0x595f('0xae'));}if(!_0x261233['query']['port']){throw new Error(_0x595f('0xa0'));}var _0x213010=_0x261233[_0x595f('0x39')][_0x595f('0xa1')]?_0x261233[_0x595f('0x39')]['hostname']+':'+_0x261233['query']['port']:_0x595f('0xa3')+_0x261233['query']['port'];var _0x3efa61=_0x261233[_0x595f('0x39')][_0x595f('0x22')]?_0x261233['query']['json']:!![];var _0x4fb43b=_0x261233[_0x595f('0x39')]['encoding']?_0x261233['query'][_0x595f('0xa4')]:null;var _0x89ac5d={'method':_0x261233['method'],'uri':util['format'](_0x595f('0xa6'),_0x213010,_0x261233[_0x595f('0x39')][_0x595f('0x6')]),'json':_0x3efa61,'resolveWithFullResponse':!![],'encoding':_0x4fb43b,'body':_0x261233[_0x595f('0x95')]};if(_0x261233[_0x595f('0xa7')]){_0x89ac5d[_0x595f('0xa7')]=_0x261233[_0x595f('0xa7')];if(_0x89ac5d[_0x595f('0xa7')]['content-length']){delete _0x89ac5d[_0x595f('0xa7')]['content-length'];}}if(_0x89ac5d[_0x595f('0xa7')][_0x595f('0xa9')]){delete _0x89ac5d[_0x595f('0xa7')][_0x595f('0xa9')];}return rp(_0x89ac5d);})[_0x595f('0x2a')](function(_0xd27068){if(_0xd27068){_0x1b4dc0[_0x595f('0xaa')](_0xd27068[_0x595f('0xa7')]);logger[_0x595f('0x6b')](_0xd27068['body']);return _0x1b4dc0[_0x595f('0x21')](_0xd27068['statusCode'])[_0x595f('0x32')](_0xd27068[_0x595f('0x95')]);}else{return _0x1b4dc0[_0x595f('0x1f')](0xc8);}})[_0x595f('0x4e')](handleError(_0x1b4dc0,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 6f7f00d..43ce361 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 _0xd943=['../../mysqldb','Plugin','setMaxListeners','update','remove','emit','events'];(function(_0x4f22a2,_0x25d366){var _0x4fcb2b=function(_0x5bf931){while(--_0x5bf931){_0x4f22a2['push'](_0x4f22a2['shift']());}};_0x4fcb2b(++_0x25d366);}(_0xd943,0x15d));var _0x3d94=function(_0xe4e841,_0x5e4273){_0xe4e841=_0xe4e841-0x0;var _0x34972e=_0xd943[_0xe4e841];return _0x34972e;};'use strict';var EventEmitter=require(_0x3d94('0x0'));var Plugin=require(_0x3d94('0x1'))['db'][_0x3d94('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x3d94('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3d94('0x4'),'afterDestroy':_0x3d94('0x5')};function emitEvent(_0x38b5ca){return function(_0xc13b61,_0xaf8962,_0x5751f6){PluginEvents['emit'](_0x38b5ca+':'+_0xc13b61['id'],_0xc13b61);PluginEvents[_0x3d94('0x6')](_0x38b5ca,_0xc13b61);_0x5751f6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','Plugin','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x2032,0xd9));var _0x2203=function(_0x1c00c3,_0x153065){_0x1c00c3=_0x1c00c3-0x0;var _0xbc5857=_0x2032[_0x1c00c3];return _0xbc5857;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){PluginEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);PluginEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Plugin[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index cc2990f..d9f2bf0 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 _0xee14=['Plugin','plugins','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define'];(function(_0x55048f,_0x37b1aa){var _0x33ba88=function(_0x403ba6){while(--_0x403ba6){_0x55048f['push'](_0x55048f['shift']());}};_0x33ba88(++_0x37b1aa);}(_0xee14,0x13a));var _0x4ee1=function(_0x48996a,_0x1604c1){_0x48996a=_0x48996a-0x0;var _0x196b34=_0xee14[_0x48996a];return _0x196b34;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));module['exports']=function(_0xba6d36,_0x573700){return _0xba6d36[_0x4ee1('0x9')](_0x4ee1('0xa'),attributes,{'tableName':_0x4ee1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x032e=['exports','define','Plugin','plugins','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./plugin.attributes'];(function(_0x55e059,_0x2df2c5){var _0x1e6bb7=function(_0x15799b){while(--_0x15799b){_0x55e059['push'](_0x55e059['shift']());}};_0x1e6bb7(++_0x2df2c5);}(_0x032e,0x124));var _0xe032=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x032e[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var logger=require(_0xe032('0x1'))(_0xe032('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe032('0x3'));var fs=require('fs');var path=require(_0xe032('0x4'));var rimraf=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var attributes=require(_0xe032('0x7'));module[_0xe032('0x8')]=function(_0x2ba8a0,_0x33ad0b){return _0x2ba8a0[_0xe032('0x9')](_0xe032('0xa'),attributes,{'tableName':_0xe032('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 aab1a9b..3cc3f4d 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 _0x010e=['../../config/utils','rpc','jayson/promise','http','defaults','redis','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Plugin','create','body','raw','CreatePlugin','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x8dd85f,_0x102a4c){var _0x5d55ee=function(_0x1463ab){while(--_0x1463ab){_0x8dd85f['push'](_0x8dd85f['shift']());}};_0x5d55ee(++_0x102a4c);}(_0x010e,0x1da));var _0xe010=function(_0x39cf45,_0x49f7d9){_0x39cf45=_0x39cf45-0x0;var _0x9d55a4=_0x010e[_0x39cf45];return _0x9d55a4;};'use strict';var _=require('lodash');var util=require(_0xe010('0x0'));var moment=require(_0xe010('0x1'));var BPromise=require(_0xe010('0x2'));var rs=require(_0xe010('0x3'));var fs=require('fs');var Redis=require(_0xe010('0x4'));var db=require(_0xe010('0x5'))['db'];var utils=require(_0xe010('0x6'));var logger=require('../../config/logger')(_0xe010('0x7'));var config=require('../../config/environment');var jayson=require(_0xe010('0x8'));var client=jayson['client'][_0xe010('0x9')]({'port':0x232a});config['redis']=_[_0xe010('0xa')](config[_0xe010('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe010('0xc'))(new Redis(config[_0xe010('0xb')]));require('./plugin.socket')[_0xe010('0xd')](socket);function respondWithRpcPromise(_0x55b90a,_0x2d2ffb,_0xcbf3b7){return new BPromise(function(_0xa0a4cd,_0x30058b){return client[_0xe010('0xe')](_0x55b90a,_0xcbf3b7)[_0xe010('0xf')](function(_0xa993b9){logger[_0xe010('0x10')](_0xe010('0x11'),_0x2d2ffb,_0xe010('0x12'));logger['debug'](_0xe010('0x13'),_0x2d2ffb,_0xe010('0x12'),JSON[_0xe010('0x14')](_0xa993b9));if(_0xa993b9[_0xe010('0x15')]){if(_0xa993b9['error'][_0xe010('0x16')]===0x1f4){logger[_0xe010('0x15')](_0xe010('0x11'),_0x2d2ffb,_0xa993b9[_0xe010('0x15')][_0xe010('0x17')]);return _0x30058b(_0xa993b9[_0xe010('0x15')][_0xe010('0x17')]);}logger[_0xe010('0x15')](_0xe010('0x11'),_0x2d2ffb,_0xa993b9['error'][_0xe010('0x17')]);return _0xa0a4cd(_0xa993b9[_0xe010('0x15')]['message']);}else{logger['info'](_0xe010('0x11'),_0x2d2ffb,_0xe010('0x12'));_0xa0a4cd(_0xa993b9[_0xe010('0x18')][_0xe010('0x17')]);}})['catch'](function(_0xe6d240){logger[_0xe010('0x15')]('Plugin,\x20%s,\x20%s',_0x2d2ffb,_0xe6d240);_0x30058b(_0xe6d240);});});}exports['CreatePlugin']=function(_0x21b9c8){var _0x4872d1=this;return new Promise(function(_0x188c61,_0x57c2ef){return db[_0xe010('0x19')][_0xe010('0x1a')](_0x21b9c8[_0xe010('0x1b')],{'raw':_0x21b9c8['options']?_0x21b9c8['options'][_0xe010('0x1c')]===undefined?!![]:![]:!![]})[_0xe010('0xf')](function(_0x4691b3){logger[_0xe010('0x10')](_0xe010('0x1d'),_0x21b9c8);logger[_0xe010('0x1e')](_0xe010('0x1d'),_0x21b9c8,JSON[_0xe010('0x14')](_0x4691b3));_0x188c61(_0x4691b3);})[_0xe010('0x1f')](function(_0xb4fd9f){logger[_0xe010('0x15')](_0xe010('0x1d'),_0xb4fd9f[_0xe010('0x17')],_0x21b9c8);_0x57c2ef(_0x4872d1[_0xe010('0x15')](0x1f4,_0xb4fd9f[_0xe010('0x17')]));});});}; \ No newline at end of file +var _0x2e28=['register','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','create','body','raw','then','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./plugin.socket'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x2e28,0x1f3));var _0x82e2=function(_0x2d607b,_0x455193){_0x2d607b=_0x2d607b-0x0;var _0x5be31d=_0x2e28[_0x2d607b];return _0x5be31d;};'use strict';var _=require(_0x82e2('0x0'));var util=require(_0x82e2('0x1'));var moment=require('moment');var BPromise=require(_0x82e2('0x2'));var rs=require(_0x82e2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x82e2('0x4'))(_0x82e2('0x5'));var config=require(_0x82e2('0x6'));var jayson=require(_0x82e2('0x7'));var client=jayson[_0x82e2('0x8')]['http']({'port':0x232a});config[_0x82e2('0x9')]=_['defaults'](config[_0x82e2('0x9')],{'host':_0x82e2('0xa'),'port':0x18eb});var socket=require(_0x82e2('0xb'))(new Redis(config[_0x82e2('0x9')]));require(_0x82e2('0xc'))[_0x82e2('0xd')](socket);function respondWithRpcPromise(_0x112b8f,_0x2fecf9,_0x573e97){return new BPromise(function(_0x321efb,_0x1b6efa){return client[_0x82e2('0xe')](_0x112b8f,_0x573e97)['then'](function(_0x1b1f4e){logger['info'](_0x82e2('0xf'),_0x2fecf9,_0x82e2('0x10'));logger[_0x82e2('0x11')](_0x82e2('0x12'),_0x2fecf9,'request\x20sent',JSON[_0x82e2('0x13')](_0x1b1f4e));if(_0x1b1f4e[_0x82e2('0x14')]){if(_0x1b1f4e[_0x82e2('0x14')][_0x82e2('0x15')]===0x1f4){logger['error'](_0x82e2('0xf'),_0x2fecf9,_0x1b1f4e['error'][_0x82e2('0x16')]);return _0x1b6efa(_0x1b1f4e[_0x82e2('0x14')]['message']);}logger['error'](_0x82e2('0xf'),_0x2fecf9,_0x1b1f4e[_0x82e2('0x14')]['message']);return _0x321efb(_0x1b1f4e[_0x82e2('0x14')][_0x82e2('0x16')]);}else{logger[_0x82e2('0x17')](_0x82e2('0xf'),_0x2fecf9,_0x82e2('0x10'));_0x321efb(_0x1b1f4e[_0x82e2('0x18')][_0x82e2('0x16')]);}})[_0x82e2('0x19')](function(_0x5bb66d){logger[_0x82e2('0x14')](_0x82e2('0xf'),_0x2fecf9,_0x5bb66d);_0x1b6efa(_0x5bb66d);});});}exports[_0x82e2('0x1a')]=function(_0x1c4095){var _0x5c75c2=this;return new Promise(function(_0x3ae21c,_0x3548e7){return db[_0x82e2('0x1b')][_0x82e2('0x1c')](_0x1c4095[_0x82e2('0x1d')],{'raw':_0x1c4095['options']?_0x1c4095['options'][_0x82e2('0x1e')]===undefined?!![]:![]:!![]})[_0x82e2('0x1f')](function(_0xcea498){logger[_0x82e2('0x17')](_0x82e2('0x1a'),_0x1c4095);logger['debug'](_0x82e2('0x1a'),_0x1c4095,JSON['stringify'](_0xcea498));_0x3ae21c(_0xcea498);})[_0x82e2('0x19')](function(_0xcec334){logger[_0x82e2('0x14')](_0x82e2('0x1a'),_0xcec334[_0x82e2('0x16')],_0x1c4095);_0x3548e7(_0x5c75c2['error'](0x1f4,_0xcec334[_0x82e2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4fcb635..50c57a3 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 _0xffc8=['removeListener','length','plugin:','remove','update'];(function(_0x57a1d1,_0x4675aa){var _0x50b9ce=function(_0x33576c){while(--_0x33576c){_0x57a1d1['push'](_0x57a1d1['shift']());}};_0x50b9ce(++_0x4675aa);}(_0xffc8,0x111));var _0x8ffc=function(_0x2828a2,_0x10be4b){_0x2828a2=_0x2828a2-0x0;var _0xf5be16=_0xffc8[_0x2828a2];return _0xf5be16;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0x8ffc('0x0'),_0x8ffc('0x1')];function createListener(_0x1b0b87,_0x242cb5){return function(_0x385192){_0x242cb5['emit'](_0x1b0b87,_0x385192);};}function removeListener(_0x534266,_0x51ecac){return function(){PluginEvents[_0x8ffc('0x2')](_0x534266,_0x51ecac);};}exports['register']=function(_0x1a820e){for(var _0x20aea6=0x0,_0x5afcd7=events[_0x8ffc('0x3')];_0x20aea6<_0x5afcd7;_0x20aea6++){var _0x3e2dff=events[_0x20aea6];var _0x52067e=createListener(_0x8ffc('0x4')+_0x3e2dff,_0x1a820e);PluginEvents['on'](_0x3e2dff,_0x52067e);}}; \ No newline at end of file +var _0x5797=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x5ade0f,_0x49b7b8){var _0x80b6b2=function(_0x53d7af){while(--_0x53d7af){_0x5ade0f['push'](_0x5ade0f['shift']());}};_0x80b6b2(++_0x49b7b8);}(_0x5797,0x89));var _0x7579=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5797[_0x53ccf2];return _0x5a2964;};'use strict';var PluginEvents=require(_0x7579('0x0'));var events=[_0x7579('0x1'),_0x7579('0x2'),_0x7579('0x3')];function createListener(_0x6069e3,_0x39eff1){return function(_0x461a42){_0x39eff1[_0x7579('0x4')](_0x6069e3,_0x461a42);};}function removeListener(_0x2bb988,_0x54a06f){return function(){PluginEvents[_0x7579('0x5')](_0x2bb988,_0x54a06f);};}exports[_0x7579('0x6')]=function(_0x366449){for(var _0x28ac0e=0x0,_0x4e9093=events[_0x7579('0x7')];_0x28ac0e<_0x4e9093;_0x28ac0e++){var _0x27673a=events[_0x28ac0e];var _0x401979=createListener(_0x7579('0x8')+_0x27673a,_0x366449);PluginEvents['on'](_0x27673a,_0x401979);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 951d4bb..ecec640 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 _0x3d6a=['index','/:id','show','create','put','update','destroy','exports','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated'];(function(_0x1ebffe,_0x184696){var _0x353e6d=function(_0x23c583){while(--_0x23c583){_0x1ebffe['push'](_0x1ebffe['shift']());}};_0x353e6d(++_0x184696);}(_0x3d6a,0x140));var _0xa3d6=function(_0x2a7f45,_0x523045){_0x2a7f45=_0x2a7f45-0x0;var _0x100b11=_0x3d6a[_0x2a7f45];return _0x100b11;};'use strict';var express=require('express');var router=express[_0xa3d6('0x0')]();var auth=require(_0xa3d6('0x1'));var controller=require(_0xa3d6('0x2'));router[_0xa3d6('0x3')]('/',auth[_0xa3d6('0x4')](),controller[_0xa3d6('0x5')]);router[_0xa3d6('0x3')](_0xa3d6('0x6'),auth[_0xa3d6('0x4')](),controller[_0xa3d6('0x7')]);router['post']('/',auth[_0xa3d6('0x4')](),controller[_0xa3d6('0x8')]);router[_0xa3d6('0x9')]('/:id',auth[_0xa3d6('0x4')](),controller[_0xa3d6('0xa')]);router['delete']('/:id',auth[_0xa3d6('0x4')](),controller[_0xa3d6('0xb')]);module[_0xa3d6('0xc')]=router; \ No newline at end of file +var _0xbb6f=['put','update','destroy','exports','Router','./pm2.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x77ba7,_0x2e7705){var _0x50d606=function(_0x15c898){while(--_0x15c898){_0x77ba7['push'](_0x77ba7['shift']());}};_0x50d606(++_0x2e7705);}(_0xbb6f,0xac));var _0xfbb6=function(_0x2e8ce2,_0x1e3109){_0x2e8ce2=_0x2e8ce2-0x0;var _0x44ca16=_0xbb6f[_0x2e8ce2];return _0x44ca16;};'use strict';var express=require('express');var router=express[_0xfbb6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xfbb6('0x1'));router[_0xfbb6('0x2')]('/',auth[_0xfbb6('0x3')](),controller[_0xfbb6('0x4')]);router[_0xfbb6('0x2')](_0xfbb6('0x5'),auth[_0xfbb6('0x3')](),controller[_0xfbb6('0x6')]);router['post']('/',auth[_0xfbb6('0x3')](),controller[_0xfbb6('0x7')]);router[_0xfbb6('0x8')](_0xfbb6('0x5'),auth[_0xfbb6('0x3')](),controller[_0xfbb6('0x9')]);router['delete'](_0xfbb6('0x5'),auth['isAuthenticated'](),controller[_0xfbb6('0xa')]);module[_0xfbb6('0xb')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 70eff74..d768241 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 _0xfb80=['destroy','delete','dump','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','name','status','send','npm\x20install','info','index','list','then','reject','express','length','catch','show','describe','body','script','chdir','Missing\x20name\x20and/or\x20path','restart','stop','params'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0xfb80,0x1e3));var _0x0fb8=function(_0x30d061,_0x54ed28){_0x30d061=_0x30d061-0x0;var _0x16c8fc=_0xfb80[_0x30d061];return _0x16c8fc;};'use strict';var _=require('lodash');var pm2=require(_0x0fb8('0x0'));var logger=require(_0x0fb8('0x1'))(_0x0fb8('0x2'));var path=require(_0x0fb8('0x3'));var exec=require('child_process')[_0x0fb8('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x37df34,_0x442c93){return function(_0xdd4b45){if(!_0xdd4b45){_0x37df34[_0x0fb8('0x5')](0x194);;}return _0xdd4b45;};}function respondWithResult(_0xb4ba40,_0x25d761){_0x25d761=_0x25d761||0xc8;return function(_0x1229fe){if(_0x1229fe){return _0xb4ba40['status'](_0x25d761)[_0x0fb8('0x6')](_0x1229fe);}return null;};}function handleError(_0x1b7945,_0x5d0d31){_0x5d0d31=_0x5d0d31||0x1f4;return function(_0x623ebe){logger[_0x0fb8('0x7')](_0x623ebe['stack']);if(_0x623ebe[_0x0fb8('0x8')]){delete _0x623ebe[_0x0fb8('0x8')];}_0x1b7945[_0x0fb8('0x9')](_0x5d0d31)[_0x0fb8('0xa')](_0x623ebe);};}function execChildProcess(){return new BPromise(function(_0x522f0c,_0x17f713){exec(_0x0fb8('0xb'),function(_0x309af5,_0x53745e,_0x2d4e1c){logger[_0x0fb8('0xc')](_0x53745e);logger[_0x0fb8('0xc')](_0x2d4e1c);if(_0x309af5){logger['error'](_0x309af5);return _0x17f713(_0x309af5);}return _0x522f0c(_0x53745e);});});}exports[_0x0fb8('0xd')]=function(_0x4b6637,_0x6a5484){return pm2[_0x0fb8('0xe')]()[_0x0fb8('0xf')](function(_0xf5b461){if(_0xf5b461){var _0x2094b8=_[_0x0fb8('0x10')](_0xf5b461,function(_0x454890){return _0x454890[_0x0fb8('0x8')]===_0x0fb8('0x11')||_0x454890[_0x0fb8('0x8')]==='motion2';});return{'rows':_0x2094b8,'count':_0x2094b8[_0x0fb8('0x12')]};}return null;})['then'](respondWithResult(_0x6a5484,null))[_0x0fb8('0x13')](handleError(_0x6a5484,null));};exports[_0x0fb8('0x14')]=function(_0x35f3d3,_0x3be5df){return pm2[_0x0fb8('0x15')](_0x35f3d3['params']['id'])[_0x0fb8('0xf')](respondWithResult(_0x3be5df,null))['then'](handleEntityNotFound(_0x3be5df,null))['catch'](handleError(_0x3be5df,null));};exports['create']=function(_0x628829,_0x16319b){if(_0x628829[_0x0fb8('0x16')][_0x0fb8('0x8')]&&_0x628829['body'][_0x0fb8('0x17')]){var _0x231934=path['join'](__dirname,'../../files/plugins',_0x628829[_0x0fb8('0x16')]['script']);var _0x58eedf=process['cwd']();process[_0x0fb8('0x18')](path['dirname'](_0x231934));return execChildProcess()[_0x0fb8('0xf')](function(_0x3c6e58){process[_0x0fb8('0x18')](_0x58eedf);return pm2['start']({'name':_0x628829[_0x0fb8('0x16')][_0x0fb8('0x8')],'script':_0x231934});})['then'](function(_0x5c8553){pm2['dump']();return _0x5c8553[0x0];})[_0x0fb8('0xf')](respondWithResult(_0x16319b,0xc9))[_0x0fb8('0x13')](handleError(_0x16319b,null));}else{return _0x16319b[_0x0fb8('0x9')](0x1f4)[_0x0fb8('0xa')]({'message':_0x0fb8('0x19')});}};exports['update']=function(_0x25a7f0,_0x4368fe){if(_0x25a7f0['body']['id']){delete _0x25a7f0['body']['id'];}var _0x4e87c8={'online':_0x0fb8('0x1a'),'stopped':_0x0fb8('0x1b')};if(_0x4e87c8['hasOwnProperty'](_0x25a7f0[_0x0fb8('0x16')][_0x0fb8('0x9')])){return pm2[_0x4e87c8[_0x25a7f0[_0x0fb8('0x16')]['status']]](_0x25a7f0[_0x0fb8('0x1c')]['id'])[_0x0fb8('0xf')](respondWithResult(_0x4368fe,0xc8))[_0x0fb8('0x13')](handleError(_0x4368fe,null));}else{return _0x4368fe[_0x0fb8('0x9')](0x1f4)[_0x0fb8('0xa')]({'message':'Unknown\x20status'});}};exports[_0x0fb8('0x1d')]=function(_0x1342b9,_0x129819){if(_0x1342b9[_0x0fb8('0x16')]['id']){delete _0x1342b9[_0x0fb8('0x16')]['id'];}if(_0x1342b9['params']['id']){return pm2[_0x0fb8('0x1e')](_0x1342b9[_0x0fb8('0x1c')]['id'])[_0x0fb8('0xf')](function(_0x1e91f3){pm2[_0x0fb8('0x1f')]();return _0x1e91f3[0x0];})[_0x0fb8('0xf')](respondWithResult(_0x129819,null))['catch'](handleError(_0x129819,null));}else{return _0x129819[_0x0fb8('0x9')](0x1f4)[_0x0fb8('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xa1c1=['delete','Unknown\x20id','lodash','../../config/logger','path','child_process','bluebird','sendStatus','json','error','stack','name','status','send','npm\x20install','info','index','then','reject','express','catch','show','create','body','script','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','params','Unknown\x20status','destroy'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xa1c1,0x8e));var _0x1a1c=function(_0x59a337,_0x3a0913){_0x59a337=_0x59a337-0x0;var _0xa4e464=_0xa1c1[_0x59a337];return _0xa4e464;};'use strict';var _=require(_0x1a1c('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x1a1c('0x1'))('api');var path=require(_0x1a1c('0x2'));var exec=require(_0x1a1c('0x3'))['exec'];var BPromise=require(_0x1a1c('0x4'));function handleEntityNotFound(_0x47c985,_0x297346){return function(_0x34edad){if(!_0x34edad){_0x47c985[_0x1a1c('0x5')](0x194);;}return _0x34edad;};}function respondWithResult(_0x41a5e5,_0x4a082e){_0x4a082e=_0x4a082e||0xc8;return function(_0x45ed83){if(_0x45ed83){return _0x41a5e5['status'](_0x4a082e)[_0x1a1c('0x6')](_0x45ed83);}return null;};}function handleError(_0x35a1c2,_0x1a71c5){_0x1a71c5=_0x1a71c5||0x1f4;return function(_0x248078){logger[_0x1a1c('0x7')](_0x248078[_0x1a1c('0x8')]);if(_0x248078[_0x1a1c('0x9')]){delete _0x248078[_0x1a1c('0x9')];}_0x35a1c2[_0x1a1c('0xa')](_0x1a71c5)[_0x1a1c('0xb')](_0x248078);};}function execChildProcess(){return new BPromise(function(_0x3b79c6,_0x2bbe4e){exec(_0x1a1c('0xc'),function(_0x2ac7d7,_0xeb143d,_0x297541){logger[_0x1a1c('0xd')](_0xeb143d);logger[_0x1a1c('0xd')](_0x297541);if(_0x2ac7d7){logger[_0x1a1c('0x7')](_0x2ac7d7);return _0x2bbe4e(_0x2ac7d7);}return _0x3b79c6(_0xeb143d);});});}exports[_0x1a1c('0xe')]=function(_0x1ff4d4,_0x23ceb8){return pm2['list']()[_0x1a1c('0xf')](function(_0xf9e09c){if(_0xf9e09c){var _0x27098e=_[_0x1a1c('0x10')](_0xf9e09c,function(_0x4e38c7){return _0x4e38c7['name']===_0x1a1c('0x11')||_0x4e38c7[_0x1a1c('0x9')]==='motion2';});return{'rows':_0x27098e,'count':_0x27098e['length']};}return null;})['then'](respondWithResult(_0x23ceb8,null))[_0x1a1c('0x12')](handleError(_0x23ceb8,null));};exports[_0x1a1c('0x13')]=function(_0x1d746c,_0x20c7b3){return pm2['describe'](_0x1d746c['params']['id'])['then'](respondWithResult(_0x20c7b3,null))[_0x1a1c('0xf')](handleEntityNotFound(_0x20c7b3,null))['catch'](handleError(_0x20c7b3,null));};exports[_0x1a1c('0x14')]=function(_0x5d4f0a,_0x46537e){if(_0x5d4f0a['body'][_0x1a1c('0x9')]&&_0x5d4f0a[_0x1a1c('0x15')][_0x1a1c('0x16')]){var _0x325b69=path['join'](__dirname,'../../files/plugins',_0x5d4f0a[_0x1a1c('0x15')][_0x1a1c('0x16')]);var _0x35c2d9=process[_0x1a1c('0x17')]();process[_0x1a1c('0x18')](path['dirname'](_0x325b69));return execChildProcess()['then'](function(_0xaaab06){process[_0x1a1c('0x18')](_0x35c2d9);return pm2['start']({'name':_0x5d4f0a[_0x1a1c('0x15')][_0x1a1c('0x9')],'script':_0x325b69});})['then'](function(_0x3af7a3){pm2[_0x1a1c('0x19')]();return _0x3af7a3[0x0];})['then'](respondWithResult(_0x46537e,0xc9))[_0x1a1c('0x12')](handleError(_0x46537e,null));}else{return _0x46537e[_0x1a1c('0xa')](0x1f4)[_0x1a1c('0xb')]({'message':_0x1a1c('0x1a')});}};exports[_0x1a1c('0x1b')]=function(_0x53236c,_0x1fcf13){if(_0x53236c[_0x1a1c('0x15')]['id']){delete _0x53236c[_0x1a1c('0x15')]['id'];}var _0x298187={'online':_0x1a1c('0x1c'),'stopped':'stop'};if(_0x298187[_0x1a1c('0x1d')](_0x53236c[_0x1a1c('0x15')][_0x1a1c('0xa')])){return pm2[_0x298187[_0x53236c[_0x1a1c('0x15')][_0x1a1c('0xa')]]](_0x53236c[_0x1a1c('0x1e')]['id'])[_0x1a1c('0xf')](respondWithResult(_0x1fcf13,0xc8))[_0x1a1c('0x12')](handleError(_0x1fcf13,null));}else{return _0x1fcf13['status'](0x1f4)[_0x1a1c('0xb')]({'message':_0x1a1c('0x1f')});}};exports[_0x1a1c('0x20')]=function(_0x3931e9,_0x13e71e){if(_0x3931e9[_0x1a1c('0x15')]['id']){delete _0x3931e9[_0x1a1c('0x15')]['id'];}if(_0x3931e9[_0x1a1c('0x1e')]['id']){return pm2[_0x1a1c('0x21')](_0x3931e9[_0x1a1c('0x1e')]['id'])[_0x1a1c('0xf')](function(_0x20c1d6){pm2[_0x1a1c('0x19')]();return _0x20c1d6[0x0];})[_0x1a1c('0xf')](respondWithResult(_0x13e71e,null))[_0x1a1c('0x12')](handleError(_0x13e71e,null));}else{return _0x13e71e[_0x1a1c('0xa')](0x1f4)[_0x1a1c('0xb')]({'message':_0x1a1c('0x22')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9ea5f9c..c8763a5 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 _0x15dc=['util','path','connect-timeout','../../components/auth/service','../../config/environment','exports','multer'];(function(_0x1101c0,_0x261bb3){var _0x575d97=function(_0x41a3b3){while(--_0x41a3b3){_0x1101c0['push'](_0x1101c0['shift']());}};_0x575d97(++_0x261bb3);}(_0x15dc,0x133));var _0xc15d=function(_0x5e2f45,_0x19cecb){_0x5e2f45=_0x5e2f45-0x0;var _0x4b370f=_0x15dc[_0x5e2f45];return _0x4b370f;};'use strict';var multer=require(_0xc15d('0x0'));var util=require(_0xc15d('0x1'));var path=require(_0xc15d('0x2'));var timeout=require(_0xc15d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc15d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc15d('0x5'));module[_0xc15d('0x6')]=router; \ No newline at end of file +var _0xfc34=['util','connect-timeout','Router','../../config/environment','exports','multer'];(function(_0x1a809b,_0x4c15e3){var _0x5d90e6=function(_0x5dd2e1){while(--_0x5dd2e1){_0x1a809b['push'](_0x1a809b['shift']());}};_0x5d90e6(++_0x4c15e3);}(_0xfc34,0xad));var _0x4fc3=function(_0x57b90a,_0x246933){_0x57b90a=_0x57b90a-0x0;var _0x9b9abd=_0xfc34[_0x57b90a];return _0x9b9abd;};'use strict';var multer=require(_0x4fc3('0x0'));var util=require(_0x4fc3('0x1'));var path=require('path');var timeout=require(_0x4fc3('0x2'));var express=require('express');var router=express[_0x4fc3('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4fc3('0x4'));module[_0x4fc3('0x5')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 92a17b7..b080456 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 _0x9d84=['STRING','DATE','sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d84,0x82));var _0x49d8=function(_0x5a54ad,_0x4c82f0){_0x5a54ad=_0x5a54ad-0x0;var _0x5147f5=_0x9d84[_0x5a54ad];return _0x5147f5;};'use strict';var Sequelize=require(_0x49d8('0x0'));module['exports']={'state':{'type':Sequelize[_0x49d8('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x49d8('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x49d8('0x2')]},'starttime':{'type':Sequelize[_0x49d8('0x3')]},'responsetime':{'type':Sequelize[_0x49d8('0x3')]},'ringtime':{'type':Sequelize[_0x49d8('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x72f9=['INTEGER','STRING','DATE'];(function(_0x4890a9,_0x39bda5){var _0x313b0f=function(_0x389f58){while(--_0x389f58){_0x4890a9['push'](_0x4890a9['shift']());}};_0x313b0f(++_0x39bda5);}(_0x72f9,0x150));var _0x972f=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0x72f9[_0x1db831];return _0x39ba56;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x972f('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x972f('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x972f('0x1')]},'starttime':{'type':Sequelize[_0x972f('0x2')]},'responsetime':{'type':Sequelize[_0x972f('0x2')]},'ringtime':{'type':Sequelize[_0x972f('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x972f('0x1')]},'campaigntype':{'type':Sequelize[_0x972f('0x1')]},'membername':{'type':Sequelize[_0x972f('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 75c9dfb..eacb987 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 _0x6631=['util','api','bluebird','request-promise','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x6631,0x7d));var _0x1663=function(_0x34baa1,_0x5c1e7a){_0x34baa1=_0x34baa1-0x0;var _0x49529b=_0x6631[_0x34baa1];return _0x49529b;};'use strict';var _=require(_0x1663('0x0'));var util=require(_0x1663('0x1'));var logger=require('../../config/logger')(_0x1663('0x2'));var moment=require('moment');var BPromise=require(_0x1663('0x3'));var rp=require(_0x1663('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1663('0x5'));var attributes=require(_0x1663('0x6'));module['exports']=function(_0x41a522,_0x30c716){return _0x41a522['define'](_0x1663('0x7'),attributes,{'tableName':_0x1663('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8086=['bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api'];(function(_0x48b00a,_0x216967){var _0x4f9be7=function(_0x47fe40){while(--_0x47fe40){_0x48b00a['push'](_0x48b00a['shift']());}};_0x4f9be7(++_0x216967);}(_0x8086,0xf3));var _0x6808=function(_0x1d0f51,_0x5ae8f5){_0x1d0f51=_0x1d0f51-0x0;var _0x5cb669=_0x8086[_0x1d0f51];return _0x5cb669;};'use strict';var _=require(_0x6808('0x0'));var util=require(_0x6808('0x1'));var logger=require(_0x6808('0x2'))(_0x6808('0x3'));var moment=require('moment');var BPromise=require(_0x6808('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6808('0x5'));var rimraf=require(_0x6808('0x6'));var config=require(_0x6808('0x7'));var attributes=require(_0x6808('0x8'));module[_0x6808('0x9')]=function(_0x8fd1e4,_0x5173e6){return _0x8fd1e4[_0x6808('0xa')](_0x6808('0xb'),attributes,{'tableName':_0x6808('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 26fe3a2..a5a71a5 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 _0x5f8d=['code','ReportAgentPreview,\x20%s,\x20%s','message','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3e8951,_0x48b324){var _0x55bfdb=function(_0x2f853e){while(--_0x2f853e){_0x3e8951['push'](_0x3e8951['shift']());}};_0x55bfdb(++_0x48b324);}(_0x5f8d,0x1b2));var _0xd5f8=function(_0x53a0e9,_0xfd13b8){_0x53a0e9=_0x53a0e9-0x0;var _0x3ab17e=_0x5f8d[_0x53a0e9];return _0x3ab17e;};'use strict';var _=require(_0xd5f8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd5f8('0x1'));var fs=require('fs');var Redis=require(_0xd5f8('0x2'));var db=require(_0xd5f8('0x3'))['db'];var utils=require(_0xd5f8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd5f8('0x5'));var jayson=require(_0xd5f8('0x6'));var client=jayson[_0xd5f8('0x7')][_0xd5f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b45e3,_0x5302d6,_0x100981){return new BPromise(function(_0x4f650a,_0x179685){return client['request'](_0x1b45e3,_0x100981)[_0xd5f8('0x9')](function(_0x6ee0d8){logger[_0xd5f8('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x5302d6,_0xd5f8('0xb'));logger[_0xd5f8('0xc')](_0xd5f8('0xd'),_0x5302d6,'request\x20sent',JSON[_0xd5f8('0xe')](_0x6ee0d8));if(_0x6ee0d8[_0xd5f8('0xf')]){if(_0x6ee0d8[_0xd5f8('0xf')][_0xd5f8('0x10')]===0x1f4){logger['error'](_0xd5f8('0x11'),_0x5302d6,_0x6ee0d8[_0xd5f8('0xf')]['message']);return _0x179685(_0x6ee0d8[_0xd5f8('0xf')]['message']);}logger['error'](_0xd5f8('0x11'),_0x5302d6,_0x6ee0d8[_0xd5f8('0xf')][_0xd5f8('0x12')]);return _0x4f650a(_0x6ee0d8[_0xd5f8('0xf')][_0xd5f8('0x12')]);}else{logger['info'](_0xd5f8('0x11'),_0x5302d6,'request\x20sent');_0x4f650a(_0x6ee0d8['result'][_0xd5f8('0x12')]);}})[_0xd5f8('0x13')](function(_0x15d8dc){logger[_0xd5f8('0xf')](_0xd5f8('0x11'),_0x5302d6,_0x15d8dc);_0x179685(_0x15d8dc);});});}exports[_0xd5f8('0x14')]=function(_0x1aae0b){var _0x2ff7c3=this;return new Promise(function(_0x554562,_0x92881a){return db[_0xd5f8('0x15')]['create'](_0x1aae0b[_0xd5f8('0x16')],{'raw':_0x1aae0b[_0xd5f8('0x17')]?_0x1aae0b[_0xd5f8('0x17')][_0xd5f8('0x18')]===undefined?!![]:![]:!![]})[_0xd5f8('0x9')](function(_0x23816a){logger[_0xd5f8('0xa')]('CreateReportAgentPreview',_0x1aae0b);logger[_0xd5f8('0xc')](_0xd5f8('0x14'),_0x1aae0b,JSON[_0xd5f8('0xe')](_0x23816a));_0x554562(_0x23816a);})['catch'](function(_0x282d7d){logger[_0xd5f8('0xf')](_0xd5f8('0x14'),_0x282d7d['message'],_0x1aae0b);_0x92881a(_0x2ff7c3[_0xd5f8('0xf')](0x1f4,_0x282d7d[_0xd5f8('0x12')]));});});}; \ No newline at end of file +var _0x7f1b=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x41c99c,_0x3f1548){var _0x4800e5=function(_0x10fc4b){while(--_0x10fc4b){_0x41c99c['push'](_0x41c99c['shift']());}};_0x4800e5(++_0x3f1548);}(_0x7f1b,0x6f));var _0xb7f1=function(_0x349d7f,_0x3b4f75){_0x349d7f=_0x349d7f-0x0;var _0x4a39ae=_0x7f1b[_0x349d7f];return _0x4a39ae;};'use strict';var _=require(_0xb7f1('0x0'));var util=require(_0xb7f1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7f1('0x2'));var db=require(_0xb7f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7f1('0x4'))('rpc');var config=require(_0xb7f1('0x5'));var jayson=require(_0xb7f1('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x788e2a,_0x41d226,_0x55846){return new BPromise(function(_0x29daeb,_0x2da6b4){return client['request'](_0x788e2a,_0x55846)['then'](function(_0x1ae992){logger[_0xb7f1('0x7')](_0xb7f1('0x8'),_0x41d226,'request\x20sent');logger[_0xb7f1('0x9')](_0xb7f1('0xa'),_0x41d226,'request\x20sent',JSON[_0xb7f1('0xb')](_0x1ae992));if(_0x1ae992['error']){if(_0x1ae992[_0xb7f1('0xc')][_0xb7f1('0xd')]===0x1f4){logger[_0xb7f1('0xc')](_0xb7f1('0x8'),_0x41d226,_0x1ae992['error'][_0xb7f1('0xe')]);return _0x2da6b4(_0x1ae992[_0xb7f1('0xc')][_0xb7f1('0xe')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x41d226,_0x1ae992[_0xb7f1('0xc')][_0xb7f1('0xe')]);return _0x29daeb(_0x1ae992[_0xb7f1('0xc')][_0xb7f1('0xe')]);}else{logger[_0xb7f1('0x7')](_0xb7f1('0x8'),_0x41d226,_0xb7f1('0xf'));_0x29daeb(_0x1ae992[_0xb7f1('0x10')][_0xb7f1('0xe')]);}})[_0xb7f1('0x11')](function(_0x14a54b){logger[_0xb7f1('0xc')](_0xb7f1('0x8'),_0x41d226,_0x14a54b);_0x2da6b4(_0x14a54b);});});}exports[_0xb7f1('0x12')]=function(_0x211145){var _0x3deaf4=this;return new Promise(function(_0x151f6f,_0x277083){return db[_0xb7f1('0x13')][_0xb7f1('0x14')](_0x211145[_0xb7f1('0x15')],{'raw':_0x211145[_0xb7f1('0x16')]?_0x211145[_0xb7f1('0x16')][_0xb7f1('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xf5fbc8){logger[_0xb7f1('0x7')](_0xb7f1('0x12'),_0x211145);logger[_0xb7f1('0x9')]('CreateReportAgentPreview',_0x211145,JSON[_0xb7f1('0xb')](_0xf5fbc8));_0x151f6f(_0xf5fbc8);})['catch'](function(_0xc74f3b){logger[_0xb7f1('0xc')](_0xb7f1('0x12'),_0xc74f3b[_0xb7f1('0xe')],_0x211145);_0x277083(_0x3deaf4[_0xb7f1('0xc')](0x1f4,_0xc74f3b['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 3c23f43..591a1fc 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 _0x3133=['openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','whatsappQueues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/:id','/outbound','/outbound/channels','/agents','agents','put','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3133,0x13a));var _0x3313=function(_0x13138c,_0x3197c5){_0x13138c=_0x13138c-0x0;var _0x105f93=_0x3133[_0x13138c];return _0x105f93;};'use strict';var multer=require('multer');var util=require(_0x3313('0x0'));var path=require(_0x3313('0x1'));var express=require(_0x3313('0x2'));var router=express[_0x3313('0x3')]();var auth=require(_0x3313('0x4'));var controller=require(_0x3313('0x5'));router[_0x3313('0x6')](_0x3313('0x7'),auth[_0x3313('0x8')](),controller['voiceChannels']);router[_0x3313('0x6')](_0x3313('0x9'),auth[_0x3313('0x8')](),controller[_0x3313('0xa')]);router[_0x3313('0x6')](_0x3313('0xb'),auth[_0x3313('0x8')](),controller[_0x3313('0xc')]);router[_0x3313('0x6')](_0x3313('0xd'),auth[_0x3313('0x8')](),controller['voiceQueues']);router[_0x3313('0x6')](_0x3313('0xe'),auth[_0x3313('0x8')](),controller['chatQueues']);router[_0x3313('0x6')](_0x3313('0xf'),auth[_0x3313('0x8')](),controller[_0x3313('0x10')]);router[_0x3313('0x6')](_0x3313('0x11'),auth[_0x3313('0x8')](),controller[_0x3313('0x12')]);router[_0x3313('0x6')]('/openchannel/queues',auth[_0x3313('0x8')](),controller[_0x3313('0x13')]);router[_0x3313('0x6')](_0x3313('0x14'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x3313('0x6')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0x3313('0x15')]);router[_0x3313('0x6')]('/fax/queues',auth[_0x3313('0x8')](),controller[_0x3313('0x16')]);router[_0x3313('0x6')]('/voice/queues/preview/:id',auth[_0x3313('0x8')](),controller[_0x3313('0x17')]);router['get'](_0x3313('0x18'),auth[_0x3313('0x8')](),controller[_0x3313('0x19')]);router[_0x3313('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x3313('0x1a')]);router[_0x3313('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x3313('0x1b')]);router[_0x3313('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x3313('0x6')](_0x3313('0x1c'),auth[_0x3313('0x8')](),controller['showVoiceQueues']);router[_0x3313('0x6')](_0x3313('0x1d'),auth[_0x3313('0x8')](),controller['outbound']);router['get'](_0x3313('0x1e'),auth[_0x3313('0x8')](),controller['outboundChannels']);router[_0x3313('0x6')](_0x3313('0x1f'),auth['isAuthenticated'](),controller[_0x3313('0x20')]);router[_0x3313('0x21')]('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router[_0x3313('0x6')](_0x3313('0x22'),auth[_0x3313('0x8')](),controller[_0x3313('0x23')]);router[_0x3313('0x6')](_0x3313('0x24'),auth[_0x3313('0x8')](),controller[_0x3313('0x25')]);router['get'](_0x3313('0x26'),auth[_0x3313('0x8')](),controller[_0x3313('0x27')]);router[_0x3313('0x6')](_0x3313('0x28'),auth[_0x3313('0x8')](),controller['faxAccounts']);router['get'](_0x3313('0x29'),auth['isAuthenticated'](),controller[_0x3313('0x2a')]);router[_0x3313('0x6')]('/mail/queues/waitinginteractions',auth[_0x3313('0x8')](),controller[_0x3313('0x2b')]);router[_0x3313('0x6')](_0x3313('0x2c'),auth[_0x3313('0x8')](),controller[_0x3313('0x2d')]);router[_0x3313('0x6')](_0x3313('0x2e'),auth['isAuthenticated'](),controller[_0x3313('0x2f')]);router[_0x3313('0x6')](_0x3313('0x30'),auth[_0x3313('0x8')](),controller[_0x3313('0x31')]);router[_0x3313('0x6')](_0x3313('0x32'),auth['isAuthenticated'](),controller[_0x3313('0x33')]);router[_0x3313('0x6')](_0x3313('0x34'),auth['isAuthenticated'](),controller[_0x3313('0x35')]);router[_0x3313('0x36')](_0x3313('0x37'),auth[_0x3313('0x8')](),controller['queueNotify'](_0x3313('0x38')));router['get']('/mail/queues/:id',auth[_0x3313('0x8')](),controller['showMailQueues']);router['post'](_0x3313('0x39'),auth['isAuthenticated'](),controller[_0x3313('0x3a')](_0x3313('0x3b')));router['get'](_0x3313('0x3c'),auth[_0x3313('0x8')](),controller[_0x3313('0x3d')]);router[_0x3313('0x36')](_0x3313('0x3e'),auth[_0x3313('0x8')](),controller['queueNotify']('fax'));router[_0x3313('0x6')](_0x3313('0x3f'),auth['isAuthenticated'](),controller[_0x3313('0x40')]);router[_0x3313('0x36')](_0x3313('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0x3313('0x42')));router['get'](_0x3313('0x43'),auth[_0x3313('0x8')](),controller[_0x3313('0x44')]);router[_0x3313('0x36')](_0x3313('0x45'),auth['isAuthenticated'](),controller[_0x3313('0x3a')]('sms'));router[_0x3313('0x36')]('/whatsapp/queues/:id/notify',auth[_0x3313('0x8')](),controller[_0x3313('0x3a')](_0x3313('0x46')));router[_0x3313('0x6')](_0x3313('0x47'),auth[_0x3313('0x8')](),controller[_0x3313('0x48')]);router['get']('/whatsapp/queues/:id',auth[_0x3313('0x8')](),controller[_0x3313('0x49')]);router[_0x3313('0x36')](_0x3313('0x4a'),auth['isAuthenticated'](),controller['agentNotify']);module[_0x3313('0x4b')]=router; \ No newline at end of file +var _0x97c1=['voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','util','path','express','Router','./rpc.controller','get','/voice/channels','isAuthenticated'];(function(_0x4b3f3e,_0x47dfcc){var _0x921fc3=function(_0x3e4b3b){while(--_0x3e4b3b){_0x4b3f3e['push'](_0x4b3f3e['shift']());}};_0x921fc3(++_0x47dfcc);}(_0x97c1,0x183));var _0x197c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x97c1[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x197c('0x0'));var path=require(_0x197c('0x1'));var express=require(_0x197c('0x2'));var router=express[_0x197c('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x197c('0x4'));router[_0x197c('0x5')](_0x197c('0x6'),auth[_0x197c('0x7')](),controller[_0x197c('0x8')]);router[_0x197c('0x5')](_0x197c('0x9'),auth[_0x197c('0x7')](),controller[_0x197c('0xa')]);router[_0x197c('0x5')](_0x197c('0xb'),auth[_0x197c('0x7')](),controller[_0x197c('0xc')]);router[_0x197c('0x5')](_0x197c('0xd'),auth[_0x197c('0x7')](),controller[_0x197c('0xe')]);router['get'](_0x197c('0xf'),auth[_0x197c('0x7')](),controller[_0x197c('0x10')]);router[_0x197c('0x5')]('/mail/queues',auth[_0x197c('0x7')](),controller[_0x197c('0x11')]);router[_0x197c('0x5')]('/mail/accounts',auth[_0x197c('0x7')](),controller[_0x197c('0x12')]);router[_0x197c('0x5')](_0x197c('0x13'),auth['isAuthenticated'](),controller[_0x197c('0x14')]);router['get'](_0x197c('0x15'),auth['isAuthenticated'](),controller['smsQueues']);router[_0x197c('0x5')](_0x197c('0x16'),auth[_0x197c('0x7')](),controller[_0x197c('0x17')]);router[_0x197c('0x5')](_0x197c('0x18'),auth[_0x197c('0x7')](),controller[_0x197c('0x19')]);router[_0x197c('0x5')]('/voice/queues/preview/:id',auth[_0x197c('0x7')](),controller[_0x197c('0x1a')]);router['get']('/voice/queues/channels',auth[_0x197c('0x7')](),controller[_0x197c('0x1b')]);router[_0x197c('0x5')](_0x197c('0x1c'),auth['isAuthenticated'](),controller[_0x197c('0x1d')]);router[_0x197c('0x5')](_0x197c('0x1e'),auth[_0x197c('0x7')](),controller[_0x197c('0x1f')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x197c('0x7')](),controller[_0x197c('0x20')]);router[_0x197c('0x5')]('/voice/queues/:id',auth[_0x197c('0x7')](),controller[_0x197c('0x21')]);router['get'](_0x197c('0x22'),auth[_0x197c('0x7')](),controller[_0x197c('0x23')]);router[_0x197c('0x5')](_0x197c('0x24'),auth['isAuthenticated'](),controller[_0x197c('0x25')]);router[_0x197c('0x5')]('/agents',auth[_0x197c('0x7')](),controller[_0x197c('0x26')]);router[_0x197c('0x27')](_0x197c('0x28'),auth[_0x197c('0x7')](),controller[_0x197c('0x29')]);router[_0x197c('0x5')](_0x197c('0x2a'),auth['isAuthenticated'](),controller[_0x197c('0x2b')]);router['get'](_0x197c('0x2c'),auth[_0x197c('0x7')](),controller[_0x197c('0x2d')]);router[_0x197c('0x5')](_0x197c('0x2e'),auth[_0x197c('0x7')](),controller[_0x197c('0x2f')]);router[_0x197c('0x5')](_0x197c('0x30'),auth[_0x197c('0x7')](),controller['faxAccounts']);router[_0x197c('0x5')]('/chat/queues/waitinginteractions',auth[_0x197c('0x7')](),controller[_0x197c('0x31')]);router['get']('/mail/queues/waitinginteractions',auth[_0x197c('0x7')](),controller[_0x197c('0x32')]);router['get'](_0x197c('0x33'),auth[_0x197c('0x7')](),controller[_0x197c('0x34')]);router[_0x197c('0x5')](_0x197c('0x35'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x197c('0x5')]('/sms/queues/waitinginteractions',auth[_0x197c('0x7')](),controller[_0x197c('0x36')]);router[_0x197c('0x5')](_0x197c('0x37'),auth[_0x197c('0x7')](),controller[_0x197c('0x38')]);router[_0x197c('0x5')](_0x197c('0x39'),auth[_0x197c('0x7')](),controller[_0x197c('0x3a')]);router[_0x197c('0x3b')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x197c('0x3c')](_0x197c('0x3d')));router['get'](_0x197c('0x3e'),auth[_0x197c('0x7')](),controller[_0x197c('0x3f')]);router[_0x197c('0x3b')](_0x197c('0x40'),auth['isAuthenticated'](),controller[_0x197c('0x3c')](_0x197c('0x41')));router[_0x197c('0x5')]('/chat/queues/:id',auth['isAuthenticated'](),controller['showChatQueues']);router[_0x197c('0x3b')]('/fax/queues/:id/notify',auth[_0x197c('0x7')](),controller[_0x197c('0x3c')](_0x197c('0x42')));router[_0x197c('0x5')](_0x197c('0x43'),auth[_0x197c('0x7')](),controller['showFaxQueues']);router[_0x197c('0x3b')](_0x197c('0x44'),auth[_0x197c('0x7')](),controller[_0x197c('0x3c')](_0x197c('0x45')));router[_0x197c('0x5')]('/openchannel/queues/:id',auth[_0x197c('0x7')](),controller[_0x197c('0x46')]);router[_0x197c('0x3b')]('/sms/queues/:id/notify',auth[_0x197c('0x7')](),controller[_0x197c('0x3c')](_0x197c('0x47')));router[_0x197c('0x3b')](_0x197c('0x48'),auth[_0x197c('0x7')](),controller['queueNotify'](_0x197c('0x49')));router[_0x197c('0x5')]('/sms/queues/:id',auth[_0x197c('0x7')](),controller[_0x197c('0x4a')]);router[_0x197c('0x5')](_0x197c('0x4b'),auth[_0x197c('0x7')](),controller[_0x197c('0x4c')]);router['post'](_0x197c('0x4d'),auth['isAuthenticated'](),controller[_0x197c('0x4e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 80670e4..56b3075 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 _0xfda5=['OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','MessageId','InteractionId','TransferReport','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','\x20Message\x20not\x20found','From','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','find','voiceChannels','voiceChannelMixMonitor','merge','query','params','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels'];(function(_0x5ebf4f,_0x4f4a49){var _0x103ef3=function(_0x4c8926){while(--_0x4c8926){_0x5ebf4f['push'](_0x5ebf4f['shift']());}};_0x103ef3(++_0x4f4a49);}(_0xfda5,0xcb));var _0x5fda=function(_0x16f1f3,_0x681a69){_0x16f1f3=_0x16f1f3-0x0;var _0x3491bc=_0xfda5[_0x16f1f3];return _0x3491bc;};'use strict';var BPromise=require(_0x5fda('0x0'));var moment=require(_0x5fda('0x1'));var _=require(_0x5fda('0x2'));var util=require(_0x5fda('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x5fda('0x4'))(_0x5fda('0x5'));var jayson=require(_0x5fda('0x6'));var amiClient=jayson[_0x5fda('0x7')][_0x5fda('0x8')]({'port':0x232a});var mailClient=jayson[_0x5fda('0x7')][_0x5fda('0x8')]({'port':0x232b});var routingClient=jayson[_0x5fda('0x7')][_0x5fda('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x22d611,_0x221867,_0x2982c1){return new BPromise(function(_0x53bd55,_0xeb87f4){var _0x2f3fb3=_0x2982c1?_0x2982c1:amiClient;return _0x2f3fb3[_0x5fda('0x9')](_0x22d611,_0x221867)[_0x5fda('0xa')](function(_0xb4f66d){if(_0xb4f66d[_0x5fda('0xb')]){if(_0xb4f66d[_0x5fda('0xb')][_0x5fda('0xc')]===0x1f4){return _0xeb87f4(_0xb4f66d[_0x5fda('0xb')][_0x5fda('0xd')]);}return _0x53bd55(_0xb4f66d[_0x5fda('0xb')]['message']);}else{_0x53bd55(_0xb4f66d[_0x5fda('0xe')]);}})[_0x5fda('0xf')](function(_0x15f6b8){_0xeb87f4(_0x15f6b8);});});}function respondWithResult(_0xe05397,_0x48fdd4){_0x48fdd4=_0x48fdd4||0xc8;return function(_0xd5e3b8){if(_0xd5e3b8){return _0xe05397[_0x5fda('0x10')](_0x48fdd4)[_0x5fda('0x11')](_0xd5e3b8);}return _0xe05397['sendStatus'](0x194);};}function handleError(_0x1181b9,_0x115adc){_0x115adc=_0x115adc||0x1f4;return function(_0x9b64ae){logger[_0x5fda('0xb')](_0x9b64ae['stack']);if(_0x9b64ae[_0x5fda('0x12')]){delete _0x9b64ae['name'];}_0x1181b9[_0x5fda('0x10')](_0x115adc)[_0x5fda('0x13')](_0x9b64ae);};}function findById(_0x4af23c){return function(_0x1f2b86){if(!_[_0x5fda('0x14')](_0x4af23c)&&!_[_0x5fda('0x14')](_0x1f2b86)&&!_[_0x5fda('0x14')](_0x1f2b86[_0x5fda('0x15')])){return _[_0x5fda('0x16')](_0x1f2b86[_0x5fda('0x15')],function(_0x47391c){return _0x47391c['id']==_0x4af23c;});}return null;};}exports[_0x5fda('0x17')]=function(_0x10f75b,_0x932042){return respondWithRpcPromise('VoiceChannels',_0x10f75b['query'])[_0x5fda('0xa')](respondWithResult(_0x932042,null))[_0x5fda('0xf')](handleError(_0x932042,null));};exports[_0x5fda('0x18')]=function(_0x2c6038,_0x29ca3c){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x5fda('0x19')](_0x2c6038[_0x5fda('0x1a')],_0x2c6038[_0x5fda('0x1b')]))[_0x5fda('0xa')](respondWithResult(_0x29ca3c,null))['catch'](handleError(_0x29ca3c,null));};exports['voiceChannelStopMixMonitor']=function(_0x455519,_0x44c4f5){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x5fda('0x19')](_0x455519[_0x5fda('0x1a')],_0x455519[_0x5fda('0x1b')]))[_0x5fda('0xa')](respondWithResult(_0x44c4f5,null))['catch'](handleError(_0x44c4f5,null));};exports['voiceQueues']=function(_0x5c5182,_0x51a2c9){return respondWithRpcPromise(_0x5fda('0x1c'),_0x5c5182[_0x5fda('0x1a')])[_0x5fda('0xa')](respondWithResult(_0x51a2c9,null))['catch'](handleError(_0x51a2c9,null));};exports['showVoiceQueues']=function(_0x14337c,_0x17233d){return respondWithRpcPromise(_0x5fda('0x1c'),_0x14337c[_0x5fda('0x1a')])['then'](findById(_0x14337c[_0x5fda('0x1b')]['id']))['then'](respondWithResult(_0x17233d,null))[_0x5fda('0xf')](handleError(_0x17233d,null));};exports[_0x5fda('0x1d')]=function(_0x4192f6,_0x547242){return respondWithRpcPromise(_0x5fda('0x1e'),_[_0x5fda('0x19')](_0x4192f6[_0x5fda('0x1a')],_0x4192f6[_0x5fda('0x1b')]))[_0x5fda('0xa')](respondWithResult(_0x547242,null))[_0x5fda('0xf')](handleError(_0x547242,null));};exports['voiceQueuesChannels']=function(_0xda3dce,_0x42aee7){return respondWithRpcPromise(_0x5fda('0x1f'),_0xda3dce[_0x5fda('0x1a')])[_0x5fda('0xa')](respondWithResult(_0x42aee7,null))['catch'](handleError(_0x42aee7,null));};exports[_0x5fda('0x20')]=function(_0x50c7ce,_0x23f3a7){return respondWithRpcPromise(_0x5fda('0x21'),_[_0x5fda('0x19')](_0x50c7ce[_0x5fda('0x1a')],_0x50c7ce[_0x5fda('0x1b')]))[_0x5fda('0xa')](respondWithResult(_0x23f3a7,null))[_0x5fda('0xf')](handleError(_0x23f3a7,null));};exports['voiceQueuesChannelHangup']=function(_0x59281e,_0x842132){return respondWithRpcPromise(_0x5fda('0x22'),_['merge'](_0x59281e[_0x5fda('0x1a')],_0x59281e[_0x5fda('0x1b')]))[_0x5fda('0xa')](respondWithResult(_0x842132,null))['catch'](handleError(_0x842132,null));};exports[_0x5fda('0x23')]=function(_0x32f443,_0x454269){return respondWithRpcPromise(_0x5fda('0x24'),_[_0x5fda('0x19')](_0x32f443['query'],_0x32f443['params']))[_0x5fda('0xa')](respondWithResult(_0x454269,null))[_0x5fda('0xf')](handleError(_0x454269,null));};exports['outbound']=function(_0x5273d3,_0x2f952a){return respondWithRpcPromise(_0x5fda('0x25'),_0x5273d3['query'])[_0x5fda('0xa')](respondWithResult(_0x2f952a,null))['catch'](handleError(_0x2f952a,null));};exports[_0x5fda('0x26')]=function(_0x4c0876,_0x3cd112){return respondWithRpcPromise(_0x5fda('0x27'),_0x4c0876[_0x5fda('0x1a')])[_0x5fda('0xa')](respondWithResult(_0x3cd112,null))['catch'](handleError(_0x3cd112,null));};exports[_0x5fda('0x28')]=function(_0x254ba5,_0x1b43b3){var _0x3d7789;return respondWithRpcPromise('Agents',_0x254ba5[_0x5fda('0x1a')])[_0x5fda('0xa')](function(_0x2b9f80){_0x3d7789=_0x2b9f80;return respondWithRpcPromise(_0x5fda('0x29'),_0x254ba5['query'],routingClient);})['then'](function(_0x3f2849){return _[_0x5fda('0x19')]({},_0x3f2849,_0x3d7789);})['then'](respondWithResult(_0x1b43b3,null))['catch'](handleError(_0x1b43b3,null));};exports[_0x5fda('0x2a')]=function(_0x441e64,_0x2f9fd7){if(_0x441e64[_0x5fda('0x2b')]&&_0x441e64[_0x5fda('0x2b')]['interaction']&&_0x441e64[_0x5fda('0x2c')]&&_0x441e64[_0x5fda('0x2c')][_0x5fda('0x12')]){for(var _0x5e4b4f in _0x441e64['body'][_0x5fda('0x2d')]){if(_0x441e64['body']['interaction']['hasOwnProperty'](_0x5e4b4f)){db[_0x5fda('0x2e')][_0x5fda('0x2f')]({'where':{'channel':_0x5e4b4f,'membername':_0x441e64[_0x5fda('0x2c')]['name'],'type':_0x5fda('0x30'),'exitAt':null,'uniqueid':_0x441e64[_0x5fda('0x2b')][_0x5fda('0x2d')][_0x5e4b4f]&&_0x441e64[_0x5fda('0x2b')][_0x5fda('0x2d')][_0x5e4b4f][_0x5fda('0x31')]?{'$notIn':_0x441e64[_0x5fda('0x2b')][_0x5fda('0x2d')][_0x5e4b4f]}:{'$ne':null}}})[_0x5fda('0xa')](function(_0x555669){var _0x14e7bb=moment()[_0x5fda('0x32')](_0x5fda('0x33'));for(var _0x4681d6=0x0,_0x56c651=_0x555669[_0x5fda('0x31')];_0x4681d6<_0x56c651;_0x4681d6+=0x1){_0x555669[_0x4681d6][_0x5fda('0x34')]({'exitAt':_0x14e7bb});}});for(var _0x2bbd18=0x0;_0x2bbd18<_0x441e64[_0x5fda('0x2b')][_0x5fda('0x2d')][_0x5e4b4f][_0x5fda('0x31')];_0x2bbd18+=0x1){db[_0x5fda('0x2e')][_0x5fda('0x35')]({'where':{'channel':_0x5e4b4f,'membername':_0x441e64[_0x5fda('0x2c')][_0x5fda('0x12')],'type':'INTERACTION','uniqueid':_0x441e64[_0x5fda('0x2b')]['interaction'][_0x5e4b4f][_0x2bbd18],'exitAt':null},'defaults':{'channel':_0x5e4b4f,'membername':_0x441e64[_0x5fda('0x2c')][_0x5fda('0x12')],'interface':_['isNil'](_0x441e64[_0x5fda('0x2c')][_0x5fda('0x36')])?util['format']('SIP/%s',_0x441e64['user'][_0x5fda('0x12')]):_0x441e64[_0x5fda('0x2c')]['interface'],'type':_0x5fda('0x30'),'enterAt':moment()[_0x5fda('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x5fda('0x37'),'internal':_0x441e64[_0x5fda('0x2c')][_0x5fda('0x38')],'uniqueid':_0x441e64['body'][_0x5fda('0x2d')][_0x5e4b4f][_0x2bbd18]}});}}}}return respondWithRpcPromise(_0x5fda('0x39'),{'id':_0x441e64['params']['id'],'capacity':_0x441e64[_0x5fda('0x2b')][_0x5fda('0x3a')]},routingClient)[_0x5fda('0xa')](respondWithResult(_0x2f9fd7,null))['catch'](handleError(_0x2f9fd7,null));};exports[_0x5fda('0x3b')]=function(_0x384e6c,_0x4b7ce3){return respondWithRpcPromise('Telephones',_0x384e6c[_0x5fda('0x1a')])[_0x5fda('0xa')](respondWithResult(_0x4b7ce3,null))[_0x5fda('0xf')](handleError(_0x4b7ce3,null));};exports[_0x5fda('0x3c')]=function(_0x2a51a0,_0x3f5b38){return respondWithRpcPromise(_0x5fda('0x3d'),_0x2a51a0[_0x5fda('0x1a')])[_0x5fda('0xa')](respondWithResult(_0x3f5b38,null))[_0x5fda('0xf')](handleError(_0x3f5b38,null));};exports[_0x5fda('0x3e')]=function(_0xfc7ef9,_0xe2325e){return respondWithRpcPromise(_0x5fda('0x3f'),_0xfc7ef9['query'])[_0x5fda('0xa')](respondWithResult(_0xe2325e,null))[_0x5fda('0xf')](handleError(_0xe2325e,null));};exports[_0x5fda('0x40')]=function(_0xe93776,_0x704204){return respondWithRpcPromise(_0x5fda('0x41'),_0xe93776[_0x5fda('0x1a')],routingClient)['then'](respondWithResult(_0x704204,null))[_0x5fda('0xf')](handleError(_0x704204,null));};exports[_0x5fda('0x42')]=function(_0x191af1,_0x519955){return respondWithRpcPromise(_0x5fda('0x41'),_0x191af1[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](findById(_0x191af1[_0x5fda('0x1b')]['id']))[_0x5fda('0xa')](respondWithResult(_0x519955,null))[_0x5fda('0xf')](handleError(_0x519955,null));};exports[_0x5fda('0x43')]=function(_0x2b6a56,_0x287acc){return respondWithRpcPromise(_0x5fda('0x44'),_0x2b6a56[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](respondWithResult(_0x287acc,null))[_0x5fda('0xf')](handleError(_0x287acc,null));};exports[_0x5fda('0x45')]=function(_0x426459,_0x36f8ad){return respondWithRpcPromise(_0x5fda('0x44'),_0x426459[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](findById(_0x426459['params']['id']))[_0x5fda('0xa')](respondWithResult(_0x36f8ad,null))[_0x5fda('0xf')](handleError(_0x36f8ad,null));};exports['mailAccounts']=function(_0x2fdee5,_0x4eecb8){return respondWithRpcPromise('MailAccounts',_0x2fdee5[_0x5fda('0x1a')],mailClient)[_0x5fda('0xa')](respondWithResult(_0x4eecb8,null))['catch'](handleError(_0x4eecb8,null));};exports['openchannelQueues']=function(_0x13e396,_0x1a7ceb){return respondWithRpcPromise(_0x5fda('0x46'),_0x13e396[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](respondWithResult(_0x1a7ceb,null))[_0x5fda('0xf')](handleError(_0x1a7ceb,null));};exports['showOpenchannelQueues']=function(_0x5f57e1,_0x5189cb){return respondWithRpcPromise('OpenchannelQueues',_0x5f57e1[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](findById(_0x5f57e1[_0x5fda('0x1b')]['id']))['then'](respondWithResult(_0x5189cb,null))[_0x5fda('0xf')](handleError(_0x5189cb,null));};exports['smsQueues']=function(_0x4b87e5,_0x44476a){return respondWithRpcPromise(_0x5fda('0x47'),_0x4b87e5['query'],routingClient)[_0x5fda('0xa')](respondWithResult(_0x44476a,null))['catch'](handleError(_0x44476a,null));};exports[_0x5fda('0x48')]=function(_0x4ab6af,_0x3d4827){return respondWithRpcPromise(_0x5fda('0x47'),_0x4ab6af[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](findById(_0x4ab6af[_0x5fda('0x1b')]['id']))[_0x5fda('0xa')](respondWithResult(_0x3d4827,null))[_0x5fda('0xf')](handleError(_0x3d4827,null));};exports[_0x5fda('0x49')]=function(_0x46524b,_0x5f5339){return respondWithRpcPromise(_0x5fda('0x4a'),_0x46524b[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](respondWithResult(_0x5f5339,null))['catch'](handleError(_0x5f5339,null));};exports[_0x5fda('0x4b')]=function(_0x4b6ca0,_0xd3e4ef){return respondWithRpcPromise(_0x5fda('0x4a'),_0x4b6ca0[_0x5fda('0x1a')],routingClient)['then'](findById(_0x4b6ca0['params']['id']))['then'](respondWithResult(_0xd3e4ef,null))['catch'](handleError(_0xd3e4ef,null));};exports['faxQueues']=function(_0x450499,_0x5c8e8a){return respondWithRpcPromise('FaxQueues',_0x450499['query'],routingClient)[_0x5fda('0xa')](respondWithResult(_0x5c8e8a,null))[_0x5fda('0xf')](handleError(_0x5c8e8a,null));};exports[_0x5fda('0x4c')]=function(_0x276bc2,_0x1a1910){return respondWithRpcPromise(_0x5fda('0x4d'),_0x276bc2['query'],routingClient)[_0x5fda('0xa')](findById(_0x276bc2[_0x5fda('0x1b')]['id']))[_0x5fda('0xa')](respondWithResult(_0x1a1910,null))[_0x5fda('0xf')](handleError(_0x1a1910,null));};exports[_0x5fda('0x4e')]=function(_0x5f20cf,_0x14dbfc){return respondWithRpcPromise('FaxAccounts',_0x5f20cf['query'])['then'](respondWithResult(_0x14dbfc,null))[_0x5fda('0xf')](handleError(_0x14dbfc,null));};exports[_0x5fda('0x4f')]=function(_0x199388,_0x7104e4){return respondWithRpcPromise(_0x5fda('0x50'),_0x199388[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](respondWithResult(_0x7104e4,null))['catch'](handleError(_0x7104e4,null));};exports[_0x5fda('0x51')]=function(_0x264257,_0x408743){return respondWithRpcPromise(_0x5fda('0x52'),_0x264257[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](respondWithResult(_0x408743,null))[_0x5fda('0xf')](handleError(_0x408743,null));};exports[_0x5fda('0x53')]=function(_0x30cafd,_0x4ba8d8){return respondWithRpcPromise(_0x5fda('0x54'),_0x30cafd[_0x5fda('0x1a')],routingClient)['then'](respondWithResult(_0x4ba8d8,null))[_0x5fda('0xf')](handleError(_0x4ba8d8,null));};exports[_0x5fda('0x55')]=function(_0x1db8dd,_0x3fdfce){return respondWithRpcPromise(_0x5fda('0x54'),_0x1db8dd[_0x5fda('0x1a')],routingClient)['then'](function(_0x424591){if(_0x1db8dd[_0x5fda('0x1a')][_0x5fda('0x56')]!==undefined){var _0x3c900d=_(_0x424591[_0x5fda('0x15')])[_0x5fda('0x57')]([_0x1db8dd[_0x5fda('0x1a')][_0x5fda('0x56')],_0x1db8dd['params']['id']])[_0x5fda('0x58')](_0x5fda('0x59'))['uniq']()[_0x5fda('0x5a')]();return _0x424591['rows']['filter'](function(_0x5ddaa0){return _0x3c900d[_0x5fda('0x5b')](_0x5ddaa0[_0x5fda('0x59')])>-0x1;});}else{return _0x424591[_0x5fda('0x15')]['filter'](function(_0x178e37){return _0x178e37['queue_id']===parseInt(_0x1db8dd['params']['id']);});}})[_0x5fda('0xa')](respondWithResult(_0x3fdfce,null))[_0x5fda('0xf')](handleError(_0x3fdfce,null));};exports[_0x5fda('0x5c')]=function(_0x1fcb59,_0x1a9372){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x1fcb59['query'],routingClient)[_0x5fda('0xa')](respondWithResult(_0x1a9372,null))[_0x5fda('0xf')](handleError(_0x1a9372,null));};exports[_0x5fda('0x5d')]=function(_0x3ce839,_0x8becf2){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x3ce839['query'],routingClient)[_0x5fda('0xa')](respondWithResult(_0x8becf2,null))[_0x5fda('0xf')](handleError(_0x8becf2,null));};exports['faxQueuesWaitingInteractions']=function(_0x1cd911,_0x5dac2d){return respondWithRpcPromise(_0x5fda('0x5e'),_0x1cd911[_0x5fda('0x1a')],routingClient)[_0x5fda('0xa')](respondWithResult(_0x5dac2d,null))['catch'](handleError(_0x5dac2d,null));};exports[_0x5fda('0x5f')]=function(_0x2929de){return function(_0x2fb6e0,_0xabede5){var _0x59da85,_0x456cba;var _0x10fefa=_[_0x5fda('0x60')](_0x2929de);var _0x21bae9=_0x2929de===_0x5fda('0x61')?_0x5fda('0x62'):_0x5fda('0x63');return db[_0x10fefa+'Queue'][_0x5fda('0x64')]({'raw':!![],'where':{'id':_0x2fb6e0[_0x5fda('0x1b')]['id']}})['then'](function(_0x19ebd1){if(_[_0x5fda('0x14')](_0x19ebd1)){throw new Error(_0x10fefa+_0x5fda('0x65'));}_0x59da85=_0x19ebd1;return db[_0x10fefa+_0x5fda('0x66')]['findOne']({'where':{'id':_0x2fb6e0[_0x5fda('0x2b')][_0x5fda('0x67')]},'include':[{'model':db[_0x10fefa+_0x5fda('0x68')],'as':'Interaction'},{'model':db[_0x10fefa+_0x21bae9],'as':_0x5fda('0x63')}]});})[_0x5fda('0xa')](function(_0x4d8729){if(_[_0x5fda('0x14')](_0x4d8729)){throw new Error(_0x10fefa+'\x20Message\x20not\x20found');}_0x456cba=_0x4d8729;return _0x4d8729[_0x5fda('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5951cf={'uniqueid':_0x2929de+'.'+_0x456cba['id']+'.'+_0x456cba[_0x5fda('0x68')]['id'],'FromUserId':_0x2fb6e0[_0x5fda('0x2c')]['id'],'type':'queue'};_0x5951cf[_0x10fefa+_0x5fda('0x6a')]=_0x456cba['id'];_0x5951cf[_0x10fefa+_0x5fda('0x6b')]=_0x456cba[_0x5fda('0x68')]['id'];_0x5951cf['From'+_0x10fefa+_0x21bae9+'Id']=_0x456cba[_0x5fda('0x63')]['id'];_0x5951cf['To'+_0x10fefa+'QueueId']=_0x59da85['id'];return db[_0x10fefa+_0x5fda('0x6c')][_0x5fda('0x6d')](_0x5951cf);})[_0x5fda('0xa')](function(){return respondWithRpcPromise(_0x5fda('0x6e'),{'channel':_0x2929de,'interaction':_0x456cba[_0x5fda('0x68')],'message':_0x456cba,'account':_0x456cba['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x5fda('0x6f'),'appdata':_0x59da85['name']+','+(_0x456cba['Account'][_0x5fda('0x70')]||0x12c),'interval':_0x5fda('0x71')}]},routingClient);})[_0x5fda('0xa')](respondWithResult(_0xabede5,null))['catch'](handleError(_0xabede5,null));};};exports[_0x5fda('0x72')]=function(_0x27044f,_0x4d83ba){var _0x82ffee,_0x543e80;if(_['isNil'](_0x27044f[_0x5fda('0x2b')]['channel'])){throw new Error(_0x5fda('0x73'));}var _0x2ccd06=_0x27044f[_0x5fda('0x2b')][_0x5fda('0x74')];var _0x3f4e05=_[_0x5fda('0x60')](_0x2ccd06);var _0x453d6f=_0x2ccd06===_0x5fda('0x61')?_0x5fda('0x62'):'Account';return db[_0x5fda('0x75')][_0x5fda('0x64')]({'raw':!![],'where':{'id':_0x27044f['params']['id'],'role':_0x5fda('0x37')}})[_0x5fda('0xa')](function(_0x3c07e4){if(_[_0x5fda('0x14')](_0x3c07e4)){throw new Error(_0x5fda('0x76'));}_0x82ffee=_0x3c07e4;return db[_0x3f4e05+_0x5fda('0x66')]['findOne']({'where':{'id':_0x27044f[_0x5fda('0x2b')][_0x5fda('0x67')]},'include':[{'model':db[_0x3f4e05+_0x5fda('0x68')],'as':_0x5fda('0x68')},{'model':db[_0x3f4e05+_0x453d6f],'as':_0x5fda('0x63')}]});})[_0x5fda('0xa')](function(_0x1de39f){if(_['isNil'](_0x1de39f)){throw new Error(_0x3f4e05+_0x5fda('0x77'));}_0x543e80=_0x1de39f;return _0x1de39f[_0x5fda('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5fda('0xa')](function(){var _0x12445c={'uniqueid':_0x2ccd06+'.'+_0x543e80['id']+'.'+_0x543e80[_0x5fda('0x68')]['id'],'FromUserId':_0x27044f[_0x5fda('0x2c')]['id'],'type':_0x5fda('0x6f'),'ToUserId':_0x82ffee['id']};_0x12445c[_0x3f4e05+'MessageId']=_0x543e80['id'];_0x12445c[_0x3f4e05+_0x5fda('0x6b')]=_0x543e80[_0x5fda('0x68')]['id'];_0x12445c[_0x5fda('0x78')+_0x3f4e05+_0x453d6f+'Id']=_0x543e80[_0x5fda('0x63')]['id'];return db[_0x3f4e05+'TransferReport']['create'](_0x12445c);})[_0x5fda('0xa')](function(){return respondWithRpcPromise(_0x5fda('0x6e'),{'channel':_0x2ccd06,'interaction':_0x543e80[_0x5fda('0x68')],'message':_0x543e80,'account':_0x543e80[_0x5fda('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x82ffee[_0x5fda('0x12')]+','+(_0x543e80[_0x5fda('0x63')]['agentTransferTimeout']||0x12c),'interval':_0x5fda('0x71')}]},routingClient);})[_0x5fda('0xa')](respondWithResult(_0x4d83ba,null))[_0x5fda('0xf')](handleError(_0x4d83ba,null));}; \ No newline at end of file +var _0x96f3=['openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','InteractionId','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','message','result','status','json','name','isNil','rows','find','VoiceChannels','then','catch','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','interface','INTERACTION','agent','internal','AgentCapacity','telephones','Telephones','trunks','Trunks','Campaigns','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','faxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x3d064a,_0x12cf18){var _0x5b2a83=function(_0x241866){while(--_0x241866){_0x3d064a['push'](_0x3d064a['shift']());}};_0x5b2a83(++_0x12cf18);}(_0x96f3,0xa2));var _0x396f=function(_0x282299,_0x160625){_0x282299=_0x282299-0x0;var _0x398946=_0x96f3[_0x282299];return _0x398946;};'use strict';var BPromise=require(_0x396f('0x0'));var moment=require(_0x396f('0x1'));var _=require(_0x396f('0x2'));var util=require(_0x396f('0x3'));var db=require(_0x396f('0x4'))['db'];var logger=require(_0x396f('0x5'))('api');var jayson=require(_0x396f('0x6'));var amiClient=jayson[_0x396f('0x7')][_0x396f('0x8')]({'port':0x232a});var mailClient=jayson[_0x396f('0x7')][_0x396f('0x8')]({'port':0x232b});var routingClient=jayson[_0x396f('0x7')][_0x396f('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x4a02b3,_0x46b117,_0x414bad){return new BPromise(function(_0x50f530,_0x4d17ef){var _0x431eaa=_0x414bad?_0x414bad:amiClient;return _0x431eaa[_0x396f('0x9')](_0x4a02b3,_0x46b117)['then'](function(_0x2124d6){if(_0x2124d6[_0x396f('0xa')]){if(_0x2124d6[_0x396f('0xa')]['code']===0x1f4){return _0x4d17ef(_0x2124d6['error'][_0x396f('0xb')]);}return _0x50f530(_0x2124d6[_0x396f('0xa')][_0x396f('0xb')]);}else{_0x50f530(_0x2124d6[_0x396f('0xc')]);}})['catch'](function(_0x59cdc0){_0x4d17ef(_0x59cdc0);});});}function respondWithResult(_0x4decf0,_0x265325){_0x265325=_0x265325||0xc8;return function(_0x3d7eac){if(_0x3d7eac){return _0x4decf0[_0x396f('0xd')](_0x265325)[_0x396f('0xe')](_0x3d7eac);}return _0x4decf0['sendStatus'](0x194);};}function handleError(_0x2363cb,_0x64f0cc){_0x64f0cc=_0x64f0cc||0x1f4;return function(_0x471cf3){logger['error'](_0x471cf3['stack']);if(_0x471cf3[_0x396f('0xf')]){delete _0x471cf3[_0x396f('0xf')];}_0x2363cb[_0x396f('0xd')](_0x64f0cc)['send'](_0x471cf3);};}function findById(_0x44b1c4){return function(_0x218384){if(!_[_0x396f('0x10')](_0x44b1c4)&&!_['isNil'](_0x218384)&&!_[_0x396f('0x10')](_0x218384[_0x396f('0x11')])){return _[_0x396f('0x12')](_0x218384['rows'],function(_0x4eecd6){return _0x4eecd6['id']==_0x44b1c4;});}return null;};}exports['voiceChannels']=function(_0x1f99c2,_0x2b24c4){return respondWithRpcPromise(_0x396f('0x13'),_0x1f99c2['query'])[_0x396f('0x14')](respondWithResult(_0x2b24c4,null))[_0x396f('0x15')](handleError(_0x2b24c4,null));};exports[_0x396f('0x16')]=function(_0x26d390,_0x254c32){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x396f('0x17')](_0x26d390[_0x396f('0x18')],_0x26d390[_0x396f('0x19')]))['then'](respondWithResult(_0x254c32,null))['catch'](handleError(_0x254c32,null));};exports[_0x396f('0x1a')]=function(_0x49c9e4,_0x19303c){return respondWithRpcPromise(_0x396f('0x1b'),_[_0x396f('0x17')](_0x49c9e4['query'],_0x49c9e4[_0x396f('0x19')]))[_0x396f('0x14')](respondWithResult(_0x19303c,null))[_0x396f('0x15')](handleError(_0x19303c,null));};exports[_0x396f('0x1c')]=function(_0x2966ac,_0x3ffefc){return respondWithRpcPromise(_0x396f('0x1d'),_0x2966ac[_0x396f('0x18')])['then'](respondWithResult(_0x3ffefc,null))[_0x396f('0x15')](handleError(_0x3ffefc,null));};exports[_0x396f('0x1e')]=function(_0x1e1375,_0x9e2baa){return respondWithRpcPromise(_0x396f('0x1d'),_0x1e1375[_0x396f('0x18')])[_0x396f('0x14')](findById(_0x1e1375[_0x396f('0x19')]['id']))[_0x396f('0x14')](respondWithResult(_0x9e2baa,null))['catch'](handleError(_0x9e2baa,null));};exports[_0x396f('0x1f')]=function(_0x4df4b5,_0x45dd61){return respondWithRpcPromise(_0x396f('0x20'),_[_0x396f('0x17')](_0x4df4b5[_0x396f('0x18')],_0x4df4b5[_0x396f('0x19')]))[_0x396f('0x14')](respondWithResult(_0x45dd61,null))[_0x396f('0x15')](handleError(_0x45dd61,null));};exports[_0x396f('0x21')]=function(_0x2f2dd1,_0x1fc98f){return respondWithRpcPromise(_0x396f('0x22'),_0x2f2dd1['query'])[_0x396f('0x14')](respondWithResult(_0x1fc98f,null))[_0x396f('0x15')](handleError(_0x1fc98f,null));};exports[_0x396f('0x23')]=function(_0x34b144,_0xae600f){return respondWithRpcPromise(_0x396f('0x24'),_[_0x396f('0x17')](_0x34b144[_0x396f('0x18')],_0x34b144[_0x396f('0x19')]))[_0x396f('0x14')](respondWithResult(_0xae600f,null))[_0x396f('0x15')](handleError(_0xae600f,null));};exports[_0x396f('0x25')]=function(_0xe56ac2,_0x14f735){return respondWithRpcPromise(_0x396f('0x26'),_[_0x396f('0x17')](_0xe56ac2[_0x396f('0x18')],_0xe56ac2[_0x396f('0x19')]))[_0x396f('0x14')](respondWithResult(_0x14f735,null))['catch'](handleError(_0x14f735,null));};exports[_0x396f('0x27')]=function(_0x562f6f,_0x2c1d1e){return respondWithRpcPromise(_0x396f('0x28'),_['merge'](_0x562f6f[_0x396f('0x18')],_0x562f6f[_0x396f('0x19')]))[_0x396f('0x14')](respondWithResult(_0x2c1d1e,null))[_0x396f('0x15')](handleError(_0x2c1d1e,null));};exports[_0x396f('0x29')]=function(_0x3c28bd,_0x5a730b){return respondWithRpcPromise('Outbound',_0x3c28bd[_0x396f('0x18')])[_0x396f('0x14')](respondWithResult(_0x5a730b,null))[_0x396f('0x15')](handleError(_0x5a730b,null));};exports[_0x396f('0x2a')]=function(_0x2cdfca,_0x1dcbc1){return respondWithRpcPromise(_0x396f('0x2b'),_0x2cdfca[_0x396f('0x18')])[_0x396f('0x14')](respondWithResult(_0x1dcbc1,null))[_0x396f('0x15')](handleError(_0x1dcbc1,null));};exports['agents']=function(_0x46d63e,_0x5426c0){var _0x2e75a9;return respondWithRpcPromise('Agents',_0x46d63e[_0x396f('0x18')])[_0x396f('0x14')](function(_0x46b8d1){_0x2e75a9=_0x46b8d1;return respondWithRpcPromise(_0x396f('0x2c'),_0x46d63e[_0x396f('0x18')],routingClient);})[_0x396f('0x14')](function(_0x3c7232){return _['merge']({},_0x3c7232,_0x2e75a9);})[_0x396f('0x14')](respondWithResult(_0x5426c0,null))['catch'](handleError(_0x5426c0,null));};exports[_0x396f('0x2d')]=function(_0x5f54f7,_0x4ffcf1){if(_0x5f54f7[_0x396f('0x2e')]&&_0x5f54f7[_0x396f('0x2e')][_0x396f('0x2f')]&&_0x5f54f7['user']&&_0x5f54f7[_0x396f('0x30')][_0x396f('0xf')]){for(var _0x15f2ed in _0x5f54f7[_0x396f('0x2e')]['interaction']){if(_0x5f54f7[_0x396f('0x2e')][_0x396f('0x2f')]['hasOwnProperty'](_0x15f2ed)){db['MemberReport'][_0x396f('0x31')]({'where':{'channel':_0x15f2ed,'membername':_0x5f54f7[_0x396f('0x30')][_0x396f('0xf')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x5f54f7['body'][_0x396f('0x2f')][_0x15f2ed]&&_0x5f54f7[_0x396f('0x2e')][_0x396f('0x2f')][_0x15f2ed][_0x396f('0x32')]?{'$notIn':_0x5f54f7['body'][_0x396f('0x2f')][_0x15f2ed]}:{'$ne':null}}})[_0x396f('0x14')](function(_0x47eb7e){var _0x137e7b=moment()[_0x396f('0x33')](_0x396f('0x34'));for(var _0x2b1622=0x0,_0x2ba0e=_0x47eb7e[_0x396f('0x32')];_0x2b1622<_0x2ba0e;_0x2b1622+=0x1){_0x47eb7e[_0x2b1622]['updateAttributes']({'exitAt':_0x137e7b});}});for(var _0x1095a1=0x0;_0x1095a1<_0x5f54f7[_0x396f('0x2e')][_0x396f('0x2f')][_0x15f2ed][_0x396f('0x32')];_0x1095a1+=0x1){db[_0x396f('0x35')][_0x396f('0x36')]({'where':{'channel':_0x15f2ed,'membername':_0x5f54f7['user'][_0x396f('0xf')],'type':'INTERACTION','uniqueid':_0x5f54f7[_0x396f('0x2e')][_0x396f('0x2f')][_0x15f2ed][_0x1095a1],'exitAt':null},'defaults':{'channel':_0x15f2ed,'membername':_0x5f54f7[_0x396f('0x30')]['name'],'interface':_[_0x396f('0x10')](_0x5f54f7['user'][_0x396f('0x37')])?util[_0x396f('0x33')]('SIP/%s',_0x5f54f7[_0x396f('0x30')][_0x396f('0xf')]):_0x5f54f7[_0x396f('0x30')][_0x396f('0x37')],'type':_0x396f('0x38'),'enterAt':moment()[_0x396f('0x33')](_0x396f('0x34')),'role':_0x396f('0x39'),'internal':_0x5f54f7[_0x396f('0x30')][_0x396f('0x3a')],'uniqueid':_0x5f54f7[_0x396f('0x2e')][_0x396f('0x2f')][_0x15f2ed][_0x1095a1]}});}}}}return respondWithRpcPromise(_0x396f('0x3b'),{'id':_0x5f54f7[_0x396f('0x19')]['id'],'capacity':_0x5f54f7['body']['capacity']},routingClient)[_0x396f('0x14')](respondWithResult(_0x4ffcf1,null))['catch'](handleError(_0x4ffcf1,null));};exports[_0x396f('0x3c')]=function(_0x806367,_0x164562){return respondWithRpcPromise(_0x396f('0x3d'),_0x806367['query'])['then'](respondWithResult(_0x164562,null))[_0x396f('0x15')](handleError(_0x164562,null));};exports[_0x396f('0x3e')]=function(_0x5669db,_0x481135){return respondWithRpcPromise(_0x396f('0x3f'),_0x5669db[_0x396f('0x18')])['then'](respondWithResult(_0x481135,null))[_0x396f('0x15')](handleError(_0x481135,null));};exports['campaigns']=function(_0x422df6,_0x4e1fa7){return respondWithRpcPromise(_0x396f('0x40'),_0x422df6[_0x396f('0x18')])[_0x396f('0x14')](respondWithResult(_0x4e1fa7,null))[_0x396f('0x15')](handleError(_0x4e1fa7,null));};exports['chatQueues']=function(_0xe5dd36,_0x22401e){return respondWithRpcPromise(_0x396f('0x41'),_0xe5dd36['query'],routingClient)['then'](respondWithResult(_0x22401e,null))[_0x396f('0x15')](handleError(_0x22401e,null));};exports[_0x396f('0x42')]=function(_0x33aa42,_0x470997){return respondWithRpcPromise(_0x396f('0x41'),_0x33aa42[_0x396f('0x18')],routingClient)[_0x396f('0x14')](findById(_0x33aa42[_0x396f('0x19')]['id']))[_0x396f('0x14')](respondWithResult(_0x470997,null))[_0x396f('0x15')](handleError(_0x470997,null));};exports['mailQueues']=function(_0x156dcf,_0x961003){return respondWithRpcPromise(_0x396f('0x43'),_0x156dcf['query'],routingClient)[_0x396f('0x14')](respondWithResult(_0x961003,null))['catch'](handleError(_0x961003,null));};exports[_0x396f('0x44')]=function(_0xf0dd27,_0x5031d7){return respondWithRpcPromise(_0x396f('0x43'),_0xf0dd27[_0x396f('0x18')],routingClient)['then'](findById(_0xf0dd27[_0x396f('0x19')]['id']))['then'](respondWithResult(_0x5031d7,null))[_0x396f('0x15')](handleError(_0x5031d7,null));};exports[_0x396f('0x45')]=function(_0x536e2c,_0x378a2d){return respondWithRpcPromise(_0x396f('0x46'),_0x536e2c[_0x396f('0x18')],mailClient)[_0x396f('0x14')](respondWithResult(_0x378a2d,null))[_0x396f('0x15')](handleError(_0x378a2d,null));};exports['openchannelQueues']=function(_0x906642,_0x1e5957){return respondWithRpcPromise(_0x396f('0x47'),_0x906642['query'],routingClient)[_0x396f('0x14')](respondWithResult(_0x1e5957,null))[_0x396f('0x15')](handleError(_0x1e5957,null));};exports[_0x396f('0x48')]=function(_0x27ca16,_0x448d49){return respondWithRpcPromise(_0x396f('0x47'),_0x27ca16[_0x396f('0x18')],routingClient)[_0x396f('0x14')](findById(_0x27ca16['params']['id']))['then'](respondWithResult(_0x448d49,null))['catch'](handleError(_0x448d49,null));};exports[_0x396f('0x49')]=function(_0x58ac66,_0x54ab33){return respondWithRpcPromise(_0x396f('0x4a'),_0x58ac66[_0x396f('0x18')],routingClient)[_0x396f('0x14')](respondWithResult(_0x54ab33,null))[_0x396f('0x15')](handleError(_0x54ab33,null));};exports[_0x396f('0x4b')]=function(_0x383c7a,_0x512478){return respondWithRpcPromise(_0x396f('0x4a'),_0x383c7a['query'],routingClient)['then'](findById(_0x383c7a[_0x396f('0x19')]['id']))['then'](respondWithResult(_0x512478,null))['catch'](handleError(_0x512478,null));};exports[_0x396f('0x4c')]=function(_0x1f3e04,_0x46e228){return respondWithRpcPromise('WhatsappQueues',_0x1f3e04[_0x396f('0x18')],routingClient)[_0x396f('0x14')](respondWithResult(_0x46e228,null))[_0x396f('0x15')](handleError(_0x46e228,null));};exports[_0x396f('0x4d')]=function(_0x218d84,_0x51fe32){return respondWithRpcPromise(_0x396f('0x4e'),_0x218d84[_0x396f('0x18')],routingClient)[_0x396f('0x14')](findById(_0x218d84[_0x396f('0x19')]['id']))['then'](respondWithResult(_0x51fe32,null))[_0x396f('0x15')](handleError(_0x51fe32,null));};exports[_0x396f('0x4f')]=function(_0x1dfe5b,_0x28ef65){return respondWithRpcPromise('FaxQueues',_0x1dfe5b[_0x396f('0x18')],routingClient)[_0x396f('0x14')](respondWithResult(_0x28ef65,null))[_0x396f('0x15')](handleError(_0x28ef65,null));};exports['showFaxQueues']=function(_0x3ea0f3,_0x510aa4){return respondWithRpcPromise('FaxQueues',_0x3ea0f3[_0x396f('0x18')],routingClient)[_0x396f('0x14')](findById(_0x3ea0f3[_0x396f('0x19')]['id']))[_0x396f('0x14')](respondWithResult(_0x510aa4,null))[_0x396f('0x15')](handleError(_0x510aa4,null));};exports[_0x396f('0x50')]=function(_0x3a3a7c,_0x1f83f2){return respondWithRpcPromise(_0x396f('0x51'),_0x3a3a7c[_0x396f('0x18')])[_0x396f('0x14')](respondWithResult(_0x1f83f2,null))[_0x396f('0x15')](handleError(_0x1f83f2,null));};exports[_0x396f('0x52')]=function(_0xdad768,_0x5dc2a2){return respondWithRpcPromise(_0x396f('0x53'),_0xdad768[_0x396f('0x18')],routingClient)['then'](respondWithResult(_0x5dc2a2,null))[_0x396f('0x15')](handleError(_0x5dc2a2,null));};exports['mailQueuesWaitingInteractions']=function(_0x4fb542,_0x360da1){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x4fb542[_0x396f('0x18')],routingClient)[_0x396f('0x14')](respondWithResult(_0x360da1,null))[_0x396f('0x15')](handleError(_0x360da1,null));};exports[_0x396f('0x54')]=function(_0x3cb575,_0x520529){return respondWithRpcPromise(_0x396f('0x55'),_0x3cb575[_0x396f('0x18')],routingClient)[_0x396f('0x14')](respondWithResult(_0x520529,null))['catch'](handleError(_0x520529,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x2593ec,_0x4129b1){return respondWithRpcPromise(_0x396f('0x55'),_0x2593ec['query'],routingClient)[_0x396f('0x14')](function(_0x19a1de){if(_0x2593ec[_0x396f('0x18')]['type']!==undefined){var _0x5b850e=_(_0x19a1de[_0x396f('0x11')])[_0x396f('0x56')]([_0x2593ec[_0x396f('0x18')]['type'],_0x2593ec[_0x396f('0x19')]['id']])[_0x396f('0x57')](_0x396f('0x58'))[_0x396f('0x59')]()[_0x396f('0x5a')]();return _0x19a1de['rows']['filter'](function(_0x4e58f2){return _0x5b850e[_0x396f('0x5b')](_0x4e58f2[_0x396f('0x58')])>-0x1;});}else{return _0x19a1de[_0x396f('0x11')][_0x396f('0x56')](function(_0x5dd274){return _0x5dd274['queue_id']===parseInt(_0x2593ec['params']['id']);});}})[_0x396f('0x14')](respondWithResult(_0x4129b1,null))['catch'](handleError(_0x4129b1,null));};exports[_0x396f('0x5c')]=function(_0x5a3681,_0x2d1f65){return respondWithRpcPromise(_0x396f('0x5d'),_0x5a3681['query'],routingClient)[_0x396f('0x14')](respondWithResult(_0x2d1f65,null))[_0x396f('0x15')](handleError(_0x2d1f65,null));};exports[_0x396f('0x5e')]=function(_0x5789d,_0x4bc1e){return respondWithRpcPromise(_0x396f('0x5f'),_0x5789d[_0x396f('0x18')],routingClient)[_0x396f('0x14')](respondWithResult(_0x4bc1e,null))['catch'](handleError(_0x4bc1e,null));};exports[_0x396f('0x60')]=function(_0x473d90,_0x49c4b2){return respondWithRpcPromise(_0x396f('0x61'),_0x473d90[_0x396f('0x18')],routingClient)[_0x396f('0x14')](respondWithResult(_0x49c4b2,null))[_0x396f('0x15')](handleError(_0x49c4b2,null));};exports[_0x396f('0x62')]=function(_0x18fe67){return function(_0x29c1a5,_0x487253){var _0x1fcb90,_0x5b6fdf;var _0x37543d=_[_0x396f('0x63')](_0x18fe67);var _0x4c3fa8=_0x18fe67===_0x396f('0x64')?_0x396f('0x65'):_0x396f('0x66');return db[_0x37543d+'Queue'][_0x396f('0x67')]({'raw':!![],'where':{'id':_0x29c1a5[_0x396f('0x19')]['id']}})['then'](function(_0x1657da){if(_[_0x396f('0x10')](_0x1657da)){throw new Error(_0x37543d+'\x20Queue\x20not\x20found');}_0x1fcb90=_0x1657da;return db[_0x37543d+_0x396f('0x68')][_0x396f('0x67')]({'where':{'id':_0x29c1a5[_0x396f('0x2e')][_0x396f('0x69')]},'include':[{'model':db[_0x37543d+'Interaction'],'as':_0x396f('0x6a')},{'model':db[_0x37543d+_0x4c3fa8],'as':'Account'}]});})[_0x396f('0x14')](function(_0x15d128){if(_['isNil'](_0x15d128)){throw new Error(_0x37543d+_0x396f('0x6b'));}_0x5b6fdf=_0x15d128;return _0x15d128[_0x396f('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x396f('0x14')](function(){var _0x9a8e39={'uniqueid':_0x18fe67+'.'+_0x5b6fdf['id']+'.'+_0x5b6fdf[_0x396f('0x6a')]['id'],'FromUserId':_0x29c1a5[_0x396f('0x30')]['id'],'type':_0x396f('0x6d')};_0x9a8e39[_0x37543d+_0x396f('0x6e')]=_0x5b6fdf['id'];_0x9a8e39[_0x37543d+'InteractionId']=_0x5b6fdf[_0x396f('0x6a')]['id'];_0x9a8e39[_0x396f('0x6f')+_0x37543d+_0x4c3fa8+'Id']=_0x5b6fdf['Account']['id'];_0x9a8e39['To'+_0x37543d+_0x396f('0x70')]=_0x1fcb90['id'];return db[_0x37543d+_0x396f('0x71')]['create'](_0x9a8e39);})[_0x396f('0x14')](function(){return respondWithRpcPromise(_0x396f('0x72'),{'channel':_0x18fe67,'interaction':_0x5b6fdf[_0x396f('0x6a')],'message':_0x5b6fdf,'account':_0x5b6fdf['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x396f('0x6d'),'appdata':_0x1fcb90[_0x396f('0xf')]+','+(_0x5b6fdf[_0x396f('0x66')][_0x396f('0x73')]||0x12c),'interval':_0x396f('0x74')}]},routingClient);})[_0x396f('0x14')](respondWithResult(_0x487253,null))[_0x396f('0x15')](handleError(_0x487253,null));};};exports[_0x396f('0x75')]=function(_0x8c4de6,_0x46684d){var _0x4c6283,_0x2ccb19;if(_[_0x396f('0x10')](_0x8c4de6[_0x396f('0x2e')]['channel'])){throw new Error(_0x396f('0x76'));}var _0xe37f77=_0x8c4de6['body'][_0x396f('0x77')];var _0x300f01=_[_0x396f('0x63')](_0xe37f77);var _0x1ee54b=_0xe37f77==='chat'?_0x396f('0x65'):_0x396f('0x66');return db[_0x396f('0x78')][_0x396f('0x67')]({'raw':!![],'where':{'id':_0x8c4de6[_0x396f('0x19')]['id'],'role':_0x396f('0x39')}})[_0x396f('0x14')](function(_0x4b169e){if(_[_0x396f('0x10')](_0x4b169e)){throw new Error(_0x396f('0x79'));}_0x4c6283=_0x4b169e;return db[_0x300f01+'Message'][_0x396f('0x67')]({'where':{'id':_0x8c4de6[_0x396f('0x2e')][_0x396f('0x69')]},'include':[{'model':db[_0x300f01+_0x396f('0x6a')],'as':_0x396f('0x6a')},{'model':db[_0x300f01+_0x1ee54b],'as':'Account'}]});})[_0x396f('0x14')](function(_0xb2e8a5){if(_[_0x396f('0x10')](_0xb2e8a5)){throw new Error(_0x300f01+_0x396f('0x6b'));}_0x2ccb19=_0xb2e8a5;return _0xb2e8a5[_0x396f('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x396f('0x14')](function(){var _0x4f5329={'uniqueid':_0xe37f77+'.'+_0x2ccb19['id']+'.'+_0x2ccb19['Interaction']['id'],'FromUserId':_0x8c4de6['user']['id'],'type':_0x396f('0x6d'),'ToUserId':_0x4c6283['id']};_0x4f5329[_0x300f01+_0x396f('0x6e')]=_0x2ccb19['id'];_0x4f5329[_0x300f01+_0x396f('0x7a')]=_0x2ccb19[_0x396f('0x6a')]['id'];_0x4f5329[_0x396f('0x6f')+_0x300f01+_0x1ee54b+'Id']=_0x2ccb19[_0x396f('0x66')]['id'];return db[_0x300f01+_0x396f('0x71')]['create'](_0x4f5329);})['then'](function(){return respondWithRpcPromise(_0x396f('0x72'),{'channel':_0xe37f77,'interaction':_0x2ccb19[_0x396f('0x6a')],'message':_0x2ccb19,'account':_0x2ccb19[_0x396f('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0x396f('0x39'),'appdata':_0x4c6283[_0x396f('0xf')]+','+(_0x2ccb19[_0x396f('0x66')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x396f('0x14')](respondWithResult(_0x46684d,null))[_0x396f('0x15')](handleError(_0x46684d,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 9c344ab..4c73c4f 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 _0x1fe9=['../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create','put','update','delete','exports','multer','util','path','express','../../components/auth/service'];(function(_0x379062,_0x25a617){var _0x4f9acd=function(_0x12c588){while(--_0x12c588){_0x379062['push'](_0x379062['shift']());}};_0x4f9acd(++_0x25a617);}(_0x1fe9,0xd7));var _0x91fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1fe9[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x91fe('0x0'));var util=require(_0x91fe('0x1'));var path=require(_0x91fe('0x2'));var timeout=require('connect-timeout');var express=require(_0x91fe('0x3'));var router=express['Router']();var auth=require(_0x91fe('0x4'));var interaction=require(_0x91fe('0x5'));var config=require(_0x91fe('0x6'));var controller=require(_0x91fe('0x7'));router[_0x91fe('0x8')]('/',auth[_0x91fe('0x9')](),controller[_0x91fe('0xa')]);router[_0x91fe('0x8')](_0x91fe('0xb'),auth[_0x91fe('0x9')](),controller['show']);router[_0x91fe('0x8')](_0x91fe('0xc'),auth[_0x91fe('0x9')](),controller[_0x91fe('0xd')]);router[_0x91fe('0xe')]('/',auth['isAuthenticated'](),controller[_0x91fe('0xf')]);router[_0x91fe('0x10')](_0x91fe('0xb'),auth[_0x91fe('0x9')](),controller[_0x91fe('0x11')]);router[_0x91fe('0x12')](_0x91fe('0xb'),auth[_0x91fe('0x9')](),controller['destroy']);module[_0x91fe('0x13')]=router; \ No newline at end of file +var _0x68b2=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create','update'];(function(_0x4776fe,_0x1348a9){var _0xe774d0=function(_0xcb2550){while(--_0xcb2550){_0x4776fe['push'](_0x4776fe['shift']());}};_0xe774d0(++_0x1348a9);}(_0x68b2,0x12e));var _0x268b=function(_0xc7f23c,_0x2be758){_0xc7f23c=_0xc7f23c-0x0;var _0x4b4def=_0x68b2[_0xc7f23c];return _0x4b4def;};'use strict';var multer=require(_0x268b('0x0'));var util=require(_0x268b('0x1'));var path=require(_0x268b('0x2'));var timeout=require(_0x268b('0x3'));var express=require(_0x268b('0x4'));var router=express[_0x268b('0x5')]();var auth=require(_0x268b('0x6'));var interaction=require(_0x268b('0x7'));var config=require('../../config/environment');var controller=require(_0x268b('0x8'));router[_0x268b('0x9')]('/',auth[_0x268b('0xa')](),controller[_0x268b('0xb')]);router['get'](_0x268b('0xc'),auth[_0x268b('0xa')](),controller['show']);router[_0x268b('0x9')](_0x268b('0xd'),auth[_0x268b('0xa')](),controller[_0x268b('0xe')]);router[_0x268b('0xf')]('/',auth['isAuthenticated'](),controller[_0x268b('0x10')]);router['put'](_0x268b('0xc'),auth[_0x268b('0xa')](),controller[_0x268b('0x11')]);router['delete'](_0x268b('0xc'),auth[_0x268b('0xa')](),controller[_0x268b('0x12')]);module[_0x268b('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 2f42dee..c4c1ff4 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 _0x7da7=['custom','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','weeks','hours','minutes','days','ENUM','csv','xlsx','default'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7da7,0x10d));var _0x77da=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x7da7[_0x4d7f3f];return _0x5d67cc;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x77da('0x2')],'allowNull':![],'defaultValue':_0x77da('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x77da('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x77da('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x77da('0x6'),_0x77da('0x7'),'months',_0x77da('0x8'),'days',_0x77da('0x9'),_0x77da('0xa')),'allowNull':![],'defaultValue':_0x77da('0xb')},'output':{'type':Sequelize[_0x77da('0xc')](_0x77da('0xd'),'pdf',_0x77da('0xe')),'allowNull':![],'defaultValue':_0x77da('0xd')},'type':{'type':Sequelize[_0x77da('0xc')]('custom',_0x77da('0xf')),'allowNull':![],'defaultValue':_0x77da('0x10')},'sendMail':{'type':Sequelize[_0x77da('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0x77da('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x77da('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x77da('0x11')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7e4b=['years','quarters','months','weeks','hours','days','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x7e4b,0x84));var _0xb7e4=function(_0x3e307d,_0x274c48){_0x3e307d=_0x3e307d-0x0;var _0x424aa9=_0x7e4b[_0x3e307d];return _0x424aa9;};'use strict';var Sequelize=require(_0xb7e4('0x0'));module[_0xb7e4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb7e4('0x2')]},'active':{'type':Sequelize[_0xb7e4('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb7e4('0x4')},'startAt':{'type':Sequelize[_0xb7e4('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb7e4('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb7e4('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb7e4('0x7')](_0xb7e4('0x8'),_0xb7e4('0x9'),_0xb7e4('0xa'),_0xb7e4('0xb'),'days',_0xb7e4('0xc'),'minutes'),'allowNull':![],'defaultValue':_0xb7e4('0xd')},'output':{'type':Sequelize[_0xb7e4('0x7')](_0xb7e4('0xe'),_0xb7e4('0xf'),_0xb7e4('0x10')),'allowNull':![],'defaultValue':_0xb7e4('0xe')},'type':{'type':Sequelize[_0xb7e4('0x7')](_0xb7e4('0x11'),_0xb7e4('0x12')),'allowNull':![],'defaultValue':_0xb7e4('0x11')},'sendMail':{'type':Sequelize[_0xb7e4('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xb7e4('0x2')]},'cc':{'type':Sequelize[_0xb7e4('0x13')]},'bcc':{'type':Sequelize['TEXT']},'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 f83a661..2bf2321 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 _0x8fd3=['fieldName','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','fields','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','../../config/schedule','run','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','reject','save','update','then','get','Scheduler','UserProfileResource','end','error','name','map','Schedule','rawAttributes'];(function(_0x1c5b1a,_0x3db3fe){var _0x351b48=function(_0x35e628){while(--_0x35e628){_0x1c5b1a['push'](_0x1c5b1a['shift']());}};_0x351b48(++_0x3db3fe);}(_0x8fd3,0xc9));var _0x38fd=function(_0x9fcc79,_0x1dd477){_0x9fcc79=_0x9fcc79-0x0;var _0x34d975=_0x8fd3[_0x9fcc79];return _0x34d975;};'use strict';var pdf=require(_0x38fd('0x0'));var emlformat=require(_0x38fd('0x1'));var rimraf=require(_0x38fd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38fd('0x3'));var rp=require(_0x38fd('0x4'));var moment=require(_0x38fd('0x5'));var BPromise=require(_0x38fd('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38fd('0x7'));var sox=require(_0x38fd('0x8'));var csv=require(_0x38fd('0x9'));var ejs=require(_0x38fd('0xa'));var fs=require('fs');var _=require(_0x38fd('0xb'));var squel=require(_0x38fd('0xc'));var crypto=require(_0x38fd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x38fd('0xe'));var toCsv=require(_0x38fd('0x9'));var querystring=require(_0x38fd('0xf'));var Papa=require(_0x38fd('0x10'));var Redis=require(_0x38fd('0x11'));var authService=require(_0x38fd('0x12'));var qs=require(_0x38fd('0x13'));var as=require(_0x38fd('0x14'));var hardwareService=require(_0x38fd('0x15'));var logger=require('../../config/logger')(_0x38fd('0x16'));var utils=require(_0x38fd('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x38fd('0x18'))['db'];function respondWithStatusCode(_0x595daf,_0x5c27a8){_0x5c27a8=_0x5c27a8||0xcc;return function(_0x128566){if(_0x128566){return _0x595daf[_0x38fd('0x19')](_0x5c27a8);}return _0x595daf[_0x38fd('0x1a')](_0x5c27a8)['end']();};}function respondWithResult(_0x20a0e5,_0xd8a157){_0xd8a157=_0xd8a157||0xc8;return function(_0x2d5ff0){if(_0x2d5ff0){return _0x20a0e5[_0x38fd('0x1a')](_0xd8a157)['json'](_0x2d5ff0);}};}function respondWithFilteredResult(_0x3514e4,_0x186391){return function(_0x37faa6){if(_0x37faa6){var _0x10f724=_0x37faa6[_0x38fd('0x1b')],_0x45a28c=_0x186391[_0x38fd('0x1c')],_0x1cde83=_0x186391['offset']+_0x186391[_0x38fd('0x1d')],_0x3b1406;if(_0x1cde83>=_0x10f724){_0x1cde83=_0x10f724;_0x3b1406=0xc8;}else{_0x3b1406=0xce;}_0x3514e4[_0x38fd('0x1a')](_0x3b1406);return _0x3514e4['set'](_0x38fd('0x1e'),_0x45a28c+'-'+_0x1cde83+'/'+_0x10f724)[_0x38fd('0x1f')](_0x37faa6);}return null;};}function patchUpdates(_0x7e3c21){return function(_0xc22b0f){try{jsonpatch['apply'](_0xc22b0f,_0x7e3c21,!![]);}catch(_0x39e107){return BPromise[_0x38fd('0x20')](_0x39e107);}return _0xc22b0f[_0x38fd('0x21')]();};}function saveUpdates(_0x523a7a,_0x33822e){return function(_0x4dcc6f){if(_0x4dcc6f){return _0x4dcc6f[_0x38fd('0x22')](_0x523a7a)[_0x38fd('0x23')](function(_0x53aca8){return _0x53aca8;});}return null;};}function removeEntity(_0x88e7b6,_0x23811f){return function(_0x4bb78a){if(_0x4bb78a){return _0x4bb78a['destroy']()[_0x38fd('0x23')](function(){var _0x43123c=_0x4bb78a[_0x38fd('0x24')]({'plain':!![]});var _0x5aab9a=_0x38fd('0x25');return db[_0x38fd('0x26')]['destroy']({'where':{'type':_0x5aab9a,'resourceId':_0x43123c['id']}})[_0x38fd('0x23')](function(){return _0x4bb78a;});})[_0x38fd('0x23')](function(){_0x88e7b6[_0x38fd('0x1a')](0xcc)[_0x38fd('0x27')]();});}};}function handleEntityNotFound(_0x10caa8,_0x289dd1){return function(_0x590250){if(!_0x590250){_0x10caa8[_0x38fd('0x19')](0x194);}return _0x590250;};}function handleError(_0xdaa302,_0x439b4c){_0x439b4c=_0x439b4c||0x1f4;return function(_0x17f2ad){logger[_0x38fd('0x28')](_0x17f2ad['stack']);if(_0x17f2ad[_0x38fd('0x29')]){delete _0x17f2ad[_0x38fd('0x29')];}_0xdaa302[_0x38fd('0x1a')](_0x439b4c)['send'](_0x17f2ad);};}exports['index']=function(_0x57c6a2,_0x4fe64d){var _0x1bcbac={},_0x3fdf99={},_0xf9bb43={'count':0x0,'rows':[]};var _0x4fcb8b=_[_0x38fd('0x2a')](db[_0x38fd('0x2b')][_0x38fd('0x2c')],function(_0x31dbd5){return{'name':_0x31dbd5[_0x38fd('0x2d')],'type':_0x31dbd5['type'][_0x38fd('0x2e')]};});_0x3fdf99[_0x38fd('0x2f')]=_[_0x38fd('0x2a')](_0x4fcb8b,_0x38fd('0x29'));_0x3fdf99[_0x38fd('0x30')]=_[_0x38fd('0x31')](_0x57c6a2[_0x38fd('0x30')]);_0x3fdf99['filters']=_['intersection'](_0x3fdf99[_0x38fd('0x2f')],_0x3fdf99[_0x38fd('0x30')]);_0x1bcbac[_0x38fd('0x32')]=_[_0x38fd('0x33')](_0x3fdf99[_0x38fd('0x2f')],qs['fields'](_0x57c6a2[_0x38fd('0x30')]['fields']));_0x1bcbac[_0x38fd('0x32')]=_0x1bcbac['attributes'][_0x38fd('0x34')]?_0x1bcbac[_0x38fd('0x32')]:_0x3fdf99[_0x38fd('0x2f')];if(!_0x57c6a2[_0x38fd('0x30')][_0x38fd('0x35')](_0x38fd('0x36'))){_0x1bcbac[_0x38fd('0x1d')]=qs[_0x38fd('0x1d')](_0x57c6a2[_0x38fd('0x30')][_0x38fd('0x1d')]);_0x1bcbac[_0x38fd('0x1c')]=qs['offset'](_0x57c6a2[_0x38fd('0x30')][_0x38fd('0x1c')]);}_0x1bcbac[_0x38fd('0x37')]=qs[_0x38fd('0x38')](_0x57c6a2[_0x38fd('0x30')][_0x38fd('0x38')]);_0x1bcbac['where']=qs[_0x38fd('0x39')](_['pick'](_0x57c6a2['query'],_0x3fdf99['filters']),_0x4fcb8b);if(_0x57c6a2['query'][_0x38fd('0x3a')]){_0x1bcbac[_0x38fd('0x3b')]=_[_0x38fd('0x3c')](_0x1bcbac[_0x38fd('0x3b')],{'$or':_[_0x38fd('0x2a')](_0x4fcb8b,function(_0x1df5a6){if(_0x1df5a6[_0x38fd('0x3d')]!==_0x38fd('0x3e')){var _0x16e744={};_0x16e744[_0x1df5a6['name']]={'$like':'%'+_0x57c6a2['query'][_0x38fd('0x3a')]+'%'};return _0x16e744;}})});}_0x1bcbac=_[_0x38fd('0x3c')]({},_0x1bcbac,_0x57c6a2[_0x38fd('0x3f')]);var _0xdfce17={'where':_0x1bcbac[_0x38fd('0x3b')]};return db[_0x38fd('0x2b')][_0x38fd('0x1b')](_0xdfce17)[_0x38fd('0x23')](function(_0x534e7f){_0xf9bb43['count']=_0x534e7f;if(_0x57c6a2['query'][_0x38fd('0x40')]){_0x1bcbac[_0x38fd('0x41')]=[{'all':!![]}];}return db[_0x38fd('0x2b')][_0x38fd('0x42')](_0x1bcbac);})[_0x38fd('0x23')](function(_0x56bb80){_0xf9bb43['rows']=_0x56bb80;return _0xf9bb43;})[_0x38fd('0x23')](respondWithFilteredResult(_0x4fe64d,_0x1bcbac))[_0x38fd('0x43')](handleError(_0x4fe64d,null));};exports[_0x38fd('0x44')]=function(_0x349ff9,_0x5d9288){var _0x2f3fa4={'raw':![],'where':{'id':_0x349ff9[_0x38fd('0x45')]['id']}},_0x3e8225={};_0x3e8225[_0x38fd('0x2f')]=_['keys'](db[_0x38fd('0x2b')][_0x38fd('0x2c')]);_0x3e8225[_0x38fd('0x30')]=_['keys'](_0x349ff9[_0x38fd('0x30')]);_0x3e8225[_0x38fd('0x39')]=_['intersection'](_0x3e8225['model'],_0x3e8225[_0x38fd('0x30')]);_0x2f3fa4[_0x38fd('0x32')]=_[_0x38fd('0x33')](_0x3e8225[_0x38fd('0x2f')],qs[_0x38fd('0x46')](_0x349ff9[_0x38fd('0x30')][_0x38fd('0x46')]));_0x2f3fa4[_0x38fd('0x32')]=_0x2f3fa4['attributes']['length']?_0x2f3fa4[_0x38fd('0x32')]:_0x3e8225[_0x38fd('0x2f')];if(_0x349ff9[_0x38fd('0x30')][_0x38fd('0x40')]){_0x2f3fa4['include']=[{'all':!![]}];}_0x2f3fa4=_[_0x38fd('0x3c')]({},_0x2f3fa4,_0x349ff9[_0x38fd('0x3f')]);return db[_0x38fd('0x2b')][_0x38fd('0x47')](_0x2f3fa4)[_0x38fd('0x23')](handleEntityNotFound(_0x5d9288,null))[_0x38fd('0x23')](respondWithResult(_0x5d9288,null))[_0x38fd('0x43')](handleError(_0x5d9288,null));};exports[_0x38fd('0x48')]=function(_0x378455,_0x1f6b9e){return db[_0x38fd('0x2b')]['create'](_0x378455[_0x38fd('0x49')],{})[_0x38fd('0x23')](function(_0x367c98){var _0x1e0e27=_0x378455[_0x38fd('0x4a')][_0x38fd('0x24')]({'plain':!![]});if(!_0x1e0e27)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e0e27[_0x38fd('0x4b')]===_0x38fd('0x4a')){var _0x41f89e=_0x367c98[_0x38fd('0x24')]({'plain':!![]});var _0x75b9a8=_0x38fd('0x25');return db[_0x38fd('0x4c')][_0x38fd('0x47')]({'where':{'name':_0x75b9a8,'userProfileId':_0x1e0e27['userProfileId']},'raw':!![]})[_0x38fd('0x23')](function(_0x4eab0d){if(_0x4eab0d&&_0x4eab0d[_0x38fd('0x4d')]===0x0){return db[_0x38fd('0x26')][_0x38fd('0x48')]({'name':_0x41f89e['name'],'resourceId':_0x41f89e['id'],'type':_0x4eab0d[_0x38fd('0x29')],'sectionId':_0x4eab0d['id']},{})[_0x38fd('0x23')](function(){return _0x367c98;});}else{return _0x367c98;}})[_0x38fd('0x43')](function(_0x49b04c){logger[_0x38fd('0x28')](_0x38fd('0x4e'),_0x49b04c);throw _0x49b04c;});}return _0x367c98;})[_0x38fd('0x23')](respondWithResult(_0x1f6b9e,0xc9))['catch'](handleError(_0x1f6b9e,null));};exports['update']=function(_0xb5a249,_0x45e126){if(_0xb5a249[_0x38fd('0x49')]['id']){delete _0xb5a249['body']['id'];}return db[_0x38fd('0x2b')][_0x38fd('0x47')]({'where':{'id':_0xb5a249[_0x38fd('0x45')]['id']}})[_0x38fd('0x23')](handleEntityNotFound(_0x45e126,null))[_0x38fd('0x23')](saveUpdates(_0xb5a249[_0x38fd('0x49')],null))[_0x38fd('0x23')](respondWithResult(_0x45e126,null))[_0x38fd('0x43')](handleError(_0x45e126,null));};exports[_0x38fd('0x4f')]=function(_0x2219f8,_0x33d959){return db[_0x38fd('0x2b')][_0x38fd('0x47')]({'where':{'id':_0x2219f8[_0x38fd('0x45')]['id']}})[_0x38fd('0x23')](handleEntityNotFound(_0x33d959,null))[_0x38fd('0x23')](removeEntity(_0x33d959,null))[_0x38fd('0x43')](handleError(_0x33d959,null));};exports['run']=function(_0x364a91,_0x58cf0f,_0x59b36d){var _0xb784eb=require(_0x38fd('0x50'));return db[_0x38fd('0x2b')][_0x38fd('0x47')]({'where':{'id':_0x364a91[_0x38fd('0x45')]['id']},'raw':!![]})[_0x38fd('0x23')](handleEntityNotFound(_0x58cf0f,null))['then'](function(){_0xb784eb[_0x38fd('0x51')](_0x364a91[_0x38fd('0x45')]['id']);})[_0x38fd('0x23')](respondWithStatusCode(_0x58cf0f,null))[_0x38fd('0x43')](handleError(_0x58cf0f,null));}; \ No newline at end of file +var _0xfa42=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','then','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','Schedule','fieldName','key','model','map','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','user','get'];(function(_0x31fc42,_0x4a8071){var _0x44d4e8=function(_0xe3dd90){while(--_0xe3dd90){_0x31fc42['push'](_0x31fc42['shift']());}};_0x44d4e8(++_0x4a8071);}(_0xfa42,0xb7));var _0x2fa4=function(_0x1bd36b,_0x235f84){_0x1bd36b=_0x1bd36b-0x0;var _0x4e536b=_0xfa42[_0x1bd36b];return _0x4e536b;};'use strict';var pdf=require(_0x2fa4('0x0'));var emlformat=require(_0x2fa4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2fa4('0x2'));var jsonpatch=require(_0x2fa4('0x3'));var rp=require(_0x2fa4('0x4'));var moment=require(_0x2fa4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2fa4('0x6'));var util=require(_0x2fa4('0x7'));var path=require(_0x2fa4('0x8'));var sox=require(_0x2fa4('0x9'));var csv=require(_0x2fa4('0xa'));var ejs=require(_0x2fa4('0xb'));var fs=require('fs');var _=require(_0x2fa4('0xc'));var squel=require(_0x2fa4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2fa4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2fa4('0xf'));var Papa=require(_0x2fa4('0x10'));var Redis=require(_0x2fa4('0x11'));var authService=require(_0x2fa4('0x12'));var qs=require(_0x2fa4('0x13'));var as=require(_0x2fa4('0x14'));var hardwareService=require(_0x2fa4('0x15'));var logger=require(_0x2fa4('0x16'))(_0x2fa4('0x17'));var utils=require(_0x2fa4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2fa4('0x19'));var db=require(_0x2fa4('0x1a'))['db'];function respondWithStatusCode(_0x4c163f,_0x131e51){_0x131e51=_0x131e51||0xcc;return function(_0x597bdf){if(_0x597bdf){return _0x4c163f[_0x2fa4('0x1b')](_0x131e51);}return _0x4c163f[_0x2fa4('0x1c')](_0x131e51)[_0x2fa4('0x1d')]();};}function respondWithResult(_0x11784e,_0x377442){_0x377442=_0x377442||0xc8;return function(_0x58008c){if(_0x58008c){return _0x11784e[_0x2fa4('0x1c')](_0x377442)['json'](_0x58008c);}};}function respondWithFilteredResult(_0x384338,_0x2d415e){return function(_0xdfb132){if(_0xdfb132){var _0x158a36=_0xdfb132[_0x2fa4('0x1e')],_0x48007d=_0x2d415e[_0x2fa4('0x1f')],_0x2bc36a=_0x2d415e['offset']+_0x2d415e[_0x2fa4('0x20')],_0x48a8e1;if(_0x2bc36a>=_0x158a36){_0x2bc36a=_0x158a36;_0x48a8e1=0xc8;}else{_0x48a8e1=0xce;}_0x384338[_0x2fa4('0x1c')](_0x48a8e1);return _0x384338[_0x2fa4('0x21')]('Content-Range',_0x48007d+'-'+_0x2bc36a+'/'+_0x158a36)[_0x2fa4('0x22')](_0xdfb132);}return null;};}function patchUpdates(_0x455a53){return function(_0x184f66){try{jsonpatch[_0x2fa4('0x23')](_0x184f66,_0x455a53,!![]);}catch(_0x200a10){return BPromise['reject'](_0x200a10);}return _0x184f66[_0x2fa4('0x24')]();};}function saveUpdates(_0x27ede5,_0x24f08e){return function(_0x3c7cb4){if(_0x3c7cb4){return _0x3c7cb4[_0x2fa4('0x25')](_0x27ede5)[_0x2fa4('0x26')](function(_0x49cdd6){return _0x49cdd6;});}return null;};}function removeEntity(_0x3fc910,_0x228513){return function(_0x182380){if(_0x182380){return _0x182380['destroy']()['then'](function(){var _0x4c5bfa=_0x182380['get']({'plain':!![]});var _0x3a8526=_0x2fa4('0x27');return db[_0x2fa4('0x28')][_0x2fa4('0x29')]({'where':{'type':_0x3a8526,'resourceId':_0x4c5bfa['id']}})[_0x2fa4('0x26')](function(){return _0x182380;});})[_0x2fa4('0x26')](function(){_0x3fc910[_0x2fa4('0x1c')](0xcc)[_0x2fa4('0x1d')]();});}};}function handleEntityNotFound(_0x5c1b8c,_0x5b49ca){return function(_0x53a092){if(!_0x53a092){_0x5c1b8c[_0x2fa4('0x1b')](0x194);}return _0x53a092;};}function handleError(_0x58cbc5,_0x3a2bc2){_0x3a2bc2=_0x3a2bc2||0x1f4;return function(_0x2c2862){logger[_0x2fa4('0x2a')](_0x2c2862[_0x2fa4('0x2b')]);if(_0x2c2862['name']){delete _0x2c2862[_0x2fa4('0x2c')];}_0x58cbc5['status'](_0x3a2bc2)[_0x2fa4('0x2d')](_0x2c2862);};}exports[_0x2fa4('0x2e')]=function(_0x9470bd,_0x341a09){var _0x3271ac={},_0x276094={},_0x517c0c={'count':0x0,'rows':[]};var _0x4867d2=_['map'](db[_0x2fa4('0x2f')]['rawAttributes'],function(_0x457789){return{'name':_0x457789[_0x2fa4('0x30')],'type':_0x457789['type'][_0x2fa4('0x31')]};});_0x276094[_0x2fa4('0x32')]=_[_0x2fa4('0x33')](_0x4867d2,_0x2fa4('0x2c'));_0x276094['query']=_[_0x2fa4('0x34')](_0x9470bd['query']);_0x276094[_0x2fa4('0x35')]=_['intersection'](_0x276094[_0x2fa4('0x32')],_0x276094['query']);_0x3271ac[_0x2fa4('0x36')]=_[_0x2fa4('0x37')](_0x276094[_0x2fa4('0x32')],qs[_0x2fa4('0x38')](_0x9470bd[_0x2fa4('0x39')]['fields']));_0x3271ac[_0x2fa4('0x36')]=_0x3271ac[_0x2fa4('0x36')][_0x2fa4('0x3a')]?_0x3271ac[_0x2fa4('0x36')]:_0x276094[_0x2fa4('0x32')];if(!_0x9470bd[_0x2fa4('0x39')][_0x2fa4('0x3b')](_0x2fa4('0x3c'))){_0x3271ac[_0x2fa4('0x20')]=qs[_0x2fa4('0x20')](_0x9470bd['query'][_0x2fa4('0x20')]);_0x3271ac[_0x2fa4('0x1f')]=qs[_0x2fa4('0x1f')](_0x9470bd[_0x2fa4('0x39')][_0x2fa4('0x1f')]);}_0x3271ac[_0x2fa4('0x3d')]=qs[_0x2fa4('0x3e')](_0x9470bd['query'][_0x2fa4('0x3e')]);_0x3271ac[_0x2fa4('0x3f')]=qs[_0x2fa4('0x35')](_[_0x2fa4('0x40')](_0x9470bd[_0x2fa4('0x39')],_0x276094[_0x2fa4('0x35')]),_0x4867d2);if(_0x9470bd['query'][_0x2fa4('0x41')]){_0x3271ac['where']=_['merge'](_0x3271ac[_0x2fa4('0x3f')],{'$or':_[_0x2fa4('0x33')](_0x4867d2,function(_0x31ea52){if(_0x31ea52[_0x2fa4('0x42')]!=='VIRTUAL'){var _0xb6e9f6={};_0xb6e9f6[_0x31ea52[_0x2fa4('0x2c')]]={'$like':'%'+_0x9470bd[_0x2fa4('0x39')][_0x2fa4('0x41')]+'%'};return _0xb6e9f6;}})});}_0x3271ac=_[_0x2fa4('0x43')]({},_0x3271ac,_0x9470bd['options']);var _0x25a7a5={'where':_0x3271ac[_0x2fa4('0x3f')]};return db[_0x2fa4('0x2f')][_0x2fa4('0x1e')](_0x25a7a5)[_0x2fa4('0x26')](function(_0x2db37b){_0x517c0c[_0x2fa4('0x1e')]=_0x2db37b;if(_0x9470bd[_0x2fa4('0x39')][_0x2fa4('0x44')]){_0x3271ac[_0x2fa4('0x45')]=[{'all':!![]}];}return db[_0x2fa4('0x2f')][_0x2fa4('0x46')](_0x3271ac);})[_0x2fa4('0x26')](function(_0x58fd76){_0x517c0c[_0x2fa4('0x47')]=_0x58fd76;return _0x517c0c;})[_0x2fa4('0x26')](respondWithFilteredResult(_0x341a09,_0x3271ac))['catch'](handleError(_0x341a09,null));};exports[_0x2fa4('0x48')]=function(_0xe42e26,_0x3803c0){var _0x591cfa={'raw':![],'where':{'id':_0xe42e26[_0x2fa4('0x49')]['id']}},_0xbaeaf7={};_0xbaeaf7['model']=_[_0x2fa4('0x34')](db[_0x2fa4('0x2f')][_0x2fa4('0x4a')]);_0xbaeaf7[_0x2fa4('0x39')]=_[_0x2fa4('0x34')](_0xe42e26['query']);_0xbaeaf7[_0x2fa4('0x35')]=_[_0x2fa4('0x37')](_0xbaeaf7[_0x2fa4('0x32')],_0xbaeaf7[_0x2fa4('0x39')]);_0x591cfa[_0x2fa4('0x36')]=_[_0x2fa4('0x37')](_0xbaeaf7[_0x2fa4('0x32')],qs[_0x2fa4('0x38')](_0xe42e26[_0x2fa4('0x39')]['fields']));_0x591cfa['attributes']=_0x591cfa[_0x2fa4('0x36')][_0x2fa4('0x3a')]?_0x591cfa[_0x2fa4('0x36')]:_0xbaeaf7['model'];if(_0xe42e26[_0x2fa4('0x39')][_0x2fa4('0x44')]){_0x591cfa[_0x2fa4('0x45')]=[{'all':!![]}];}_0x591cfa=_[_0x2fa4('0x43')]({},_0x591cfa,_0xe42e26[_0x2fa4('0x4b')]);return db[_0x2fa4('0x2f')][_0x2fa4('0x4c')](_0x591cfa)[_0x2fa4('0x26')](handleEntityNotFound(_0x3803c0,null))['then'](respondWithResult(_0x3803c0,null))[_0x2fa4('0x4d')](handleError(_0x3803c0,null));};exports[_0x2fa4('0x4e')]=function(_0x403c0e,_0x440d27){return db['Schedule'][_0x2fa4('0x4e')](_0x403c0e['body'],{})[_0x2fa4('0x26')](function(_0x43d153){var _0x74e0ec=_0x403c0e[_0x2fa4('0x4f')][_0x2fa4('0x50')]({'plain':!![]});if(!_0x74e0ec)throw new Error(_0x2fa4('0x51'));if(_0x74e0ec[_0x2fa4('0x52')]===_0x2fa4('0x4f')){var _0x134b0b=_0x43d153['get']({'plain':!![]});var _0x5b2e45=_0x2fa4('0x27');return db['UserProfileSection'][_0x2fa4('0x4c')]({'where':{'name':_0x5b2e45,'userProfileId':_0x74e0ec[_0x2fa4('0x53')]},'raw':!![]})[_0x2fa4('0x26')](function(_0x22c491){if(_0x22c491&&_0x22c491[_0x2fa4('0x54')]===0x0){return db[_0x2fa4('0x28')]['create']({'name':_0x134b0b['name'],'resourceId':_0x134b0b['id'],'type':_0x22c491[_0x2fa4('0x2c')],'sectionId':_0x22c491['id']},{})[_0x2fa4('0x26')](function(){return _0x43d153;});}else{return _0x43d153;}})['catch'](function(_0x395535){logger[_0x2fa4('0x2a')](_0x2fa4('0x55'),_0x395535);throw _0x395535;});}return _0x43d153;})['then'](respondWithResult(_0x440d27,0xc9))['catch'](handleError(_0x440d27,null));};exports[_0x2fa4('0x25')]=function(_0x353b72,_0x41b7c3){if(_0x353b72[_0x2fa4('0x56')]['id']){delete _0x353b72[_0x2fa4('0x56')]['id'];}return db[_0x2fa4('0x2f')][_0x2fa4('0x4c')]({'where':{'id':_0x353b72[_0x2fa4('0x49')]['id']}})[_0x2fa4('0x26')](handleEntityNotFound(_0x41b7c3,null))[_0x2fa4('0x26')](saveUpdates(_0x353b72['body'],null))['then'](respondWithResult(_0x41b7c3,null))[_0x2fa4('0x4d')](handleError(_0x41b7c3,null));};exports['destroy']=function(_0x3a02ea,_0x382768){return db[_0x2fa4('0x2f')][_0x2fa4('0x4c')]({'where':{'id':_0x3a02ea[_0x2fa4('0x49')]['id']}})[_0x2fa4('0x26')](handleEntityNotFound(_0x382768,null))[_0x2fa4('0x26')](removeEntity(_0x382768,null))['catch'](handleError(_0x382768,null));};exports['run']=function(_0x50d175,_0xaaa1bc,_0x277d94){var _0x4252d7=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x50d175[_0x2fa4('0x49')]['id']},'raw':!![]})[_0x2fa4('0x26')](handleEntityNotFound(_0xaaa1bc,null))[_0x2fa4('0x26')](function(){_0x4252d7[_0x2fa4('0x57')](_0x50d175[_0x2fa4('0x49')]['id']);})['then'](respondWithStatusCode(_0xaaa1bc,null))['catch'](handleError(_0xaaa1bc,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 01e05f3..9602571 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 _0x9e91=['rimraf','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger','request-promise','path'];(function(_0x29e211,_0x497b4a){var _0x307738=function(_0x3cc367){while(--_0x3cc367){_0x29e211['push'](_0x29e211['shift']());}};_0x307738(++_0x497b4a);}(_0x9e91,0x1aa));var _0x19e9=function(_0x379d08,_0x296885){_0x379d08=_0x379d08-0x0;var _0x2fd396=_0x9e91[_0x379d08];return _0x2fd396;};'use strict';var _=require('lodash');var util=require(_0x19e9('0x0'));var logger=require(_0x19e9('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x19e9('0x2'));var fs=require('fs');var path=require(_0x19e9('0x3'));var rimraf=require(_0x19e9('0x4'));var config=require('../../config/environment');var attributes=require(_0x19e9('0x5'));module[_0x19e9('0x6')]=function(_0x1af059,_0x5e1f78){return _0x1af059[_0x19e9('0x7')](_0x19e9('0x8'),attributes,{'tableName':_0x19e9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b67=['bluebird','path','../../config/environment','./schedule.attributes','exports','lodash','util','../../config/logger','moment'];(function(_0x699b5f,_0x27e798){var _0xc05971=function(_0x44476d){while(--_0x44476d){_0x699b5f['push'](_0x699b5f['shift']());}};_0xc05971(++_0x27e798);}(_0x6b67,0x68));var _0x76b6=function(_0x374459,_0x49ea0a){_0x374459=_0x374459-0x0;var _0x3da4ab=_0x6b67[_0x374459];return _0x3da4ab;};'use strict';var _=require(_0x76b6('0x0'));var util=require(_0x76b6('0x1'));var logger=require(_0x76b6('0x2'))('api');var moment=require(_0x76b6('0x3'));var BPromise=require(_0x76b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76b6('0x5'));var rimraf=require('rimraf');var config=require(_0x76b6('0x6'));var attributes=require(_0x76b6('0x7'));module[_0x76b6('0x8')]=function(_0x37be42,_0xaea4ed){return _0x37be42['define']('Schedule',attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 90acd2b..4779a31 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 _0xda3d=['message','info','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x199450,_0x2f7e06){var _0x36321a=function(_0x4f2131){while(--_0x4f2131){_0x199450['push'](_0x199450['shift']());}};_0x36321a(++_0x2f7e06);}(_0xda3d,0x1bc));var _0xdda3=function(_0x3517b7,_0x48ee87){_0x3517b7=_0x3517b7-0x0;var _0x406f40=_0xda3d[_0x3517b7];return _0x406f40;};'use strict';var _=require(_0xdda3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdda3('0x1'));var rs=require(_0xdda3('0x2'));var fs=require('fs');var Redis=require(_0xdda3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdda3('0x4'));var logger=require(_0xdda3('0x5'))('rpc');var config=require(_0xdda3('0x6'));var jayson=require(_0xdda3('0x7'));var client=jayson['client'][_0xdda3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x114d8f,_0x563bd7,_0x139fdd){return new BPromise(function(_0x21995c,_0x443fbe){return client[_0xdda3('0x9')](_0x114d8f,_0x139fdd)[_0xdda3('0xa')](function(_0x46c3ee){logger['info'](_0xdda3('0xb'),_0x563bd7,_0xdda3('0xc'));logger[_0xdda3('0xd')](_0xdda3('0xe'),_0x563bd7,_0xdda3('0xc'),JSON[_0xdda3('0xf')](_0x46c3ee));if(_0x46c3ee[_0xdda3('0x10')]){if(_0x46c3ee['error'][_0xdda3('0x11')]===0x1f4){logger[_0xdda3('0x10')]('Schedule,\x20%s,\x20%s',_0x563bd7,_0x46c3ee[_0xdda3('0x10')][_0xdda3('0x12')]);return _0x443fbe(_0x46c3ee['error'][_0xdda3('0x12')]);}logger['error'](_0xdda3('0xb'),_0x563bd7,_0x46c3ee[_0xdda3('0x10')][_0xdda3('0x12')]);return _0x21995c(_0x46c3ee[_0xdda3('0x10')][_0xdda3('0x12')]);}else{logger[_0xdda3('0x13')]('Schedule,\x20%s,\x20%s',_0x563bd7,'request\x20sent');_0x21995c(_0x46c3ee['result'][_0xdda3('0x12')]);}})[_0xdda3('0x14')](function(_0x1ddcdb){logger[_0xdda3('0x10')](_0xdda3('0xb'),_0x563bd7,_0x1ddcdb);_0x443fbe(_0x1ddcdb);});});} \ No newline at end of file +var _0xbf50=['rpc','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2d4c9e,_0x42d5c9){var _0x37c1c5=function(_0x4b5aad){while(--_0x4b5aad){_0x2d4c9e['push'](_0x2d4c9e['shift']());}};_0x37c1c5(++_0x42d5c9);}(_0xbf50,0x93));var _0x0bf5=function(_0xb5c10c,_0x33d4e6){_0xb5c10c=_0xb5c10c-0x0;var _0x309636=_0xbf50[_0xb5c10c];return _0x309636;};'use strict';var _=require(_0x0bf5('0x0'));var util=require('util');var moment=require(_0x0bf5('0x1'));var BPromise=require(_0x0bf5('0x2'));var rs=require(_0x0bf5('0x3'));var fs=require('fs');var Redis=require(_0x0bf5('0x4'));var db=require(_0x0bf5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bf5('0x6'))(_0x0bf5('0x7'));var config=require('../../config/environment');var jayson=require(_0x0bf5('0x8'));var client=jayson[_0x0bf5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47584b,_0x169675,_0x130ca0){return new BPromise(function(_0x574158,_0x5bb05e){return client[_0x0bf5('0xa')](_0x47584b,_0x130ca0)[_0x0bf5('0xb')](function(_0x3392e2){logger[_0x0bf5('0xc')](_0x0bf5('0xd'),_0x169675,_0x0bf5('0xe'));logger[_0x0bf5('0xf')](_0x0bf5('0x10'),_0x169675,_0x0bf5('0xe'),JSON[_0x0bf5('0x11')](_0x3392e2));if(_0x3392e2[_0x0bf5('0x12')]){if(_0x3392e2[_0x0bf5('0x12')]['code']===0x1f4){logger[_0x0bf5('0x12')](_0x0bf5('0xd'),_0x169675,_0x3392e2[_0x0bf5('0x12')]['message']);return _0x5bb05e(_0x3392e2[_0x0bf5('0x12')]['message']);}logger['error'](_0x0bf5('0xd'),_0x169675,_0x3392e2[_0x0bf5('0x12')][_0x0bf5('0x13')]);return _0x574158(_0x3392e2[_0x0bf5('0x12')]['message']);}else{logger[_0x0bf5('0xc')](_0x0bf5('0xd'),_0x169675,_0x0bf5('0xe'));_0x574158(_0x3392e2[_0x0bf5('0x14')][_0x0bf5('0x13')]);}})[_0x0bf5('0x15')](function(_0x23d4bf){logger[_0x0bf5('0x12')](_0x0bf5('0xd'),_0x169675,_0x23d4bf);_0x5bb05e(_0x23d4bf);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index eff6eb0..032bb19 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 _0xeed2=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download','post','put','update','exports','multer','util','path'];(function(_0x4c8d9e,_0x147c50){var _0x2503ee=function(_0x1563fb){while(--_0x1563fb){_0x4c8d9e['push'](_0x4c8d9e['shift']());}};_0x2503ee(++_0x147c50);}(_0xeed2,0xc5));var _0x2eed=function(_0x283667,_0x3570b2){_0x283667=_0x283667-0x0;var _0x6bf465=_0xeed2[_0x283667];return _0x6bf465;};'use strict';var multer=require(_0x2eed('0x0'));var util=require(_0x2eed('0x1'));var path=require(_0x2eed('0x2'));var timeout=require(_0x2eed('0x3'));var express=require(_0x2eed('0x4'));var router=express[_0x2eed('0x5')]();var auth=require(_0x2eed('0x6'));var interaction=require(_0x2eed('0x7'));var config=require('../../config/environment');var controller=require(_0x2eed('0x8'));router[_0x2eed('0x9')]('/',auth[_0x2eed('0xa')](),controller['index']);router['get'](_0x2eed('0xb'),auth[_0x2eed('0xa')](),controller[_0x2eed('0xc')]);router[_0x2eed('0x9')](_0x2eed('0xd'),auth[_0x2eed('0xa')](),controller[_0x2eed('0xe')]);router[_0x2eed('0x9')]('/:id/download',auth[_0x2eed('0xa')](),controller[_0x2eed('0xf')]);router[_0x2eed('0x10')]('/',auth[_0x2eed('0xa')](),controller['create']);router[_0x2eed('0x11')]('/:id',auth[_0x2eed('0xa')](),controller[_0x2eed('0x12')]);router['delete']('/:id',auth[_0x2eed('0xa')](),controller['destroy']);module[_0x2eed('0x13')]=router; \ No newline at end of file +var _0x291f=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','isAuthenticated','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','multer','util'];(function(_0x1a2455,_0xdaa32e){var _0xd2286c=function(_0x1427b2){while(--_0x1427b2){_0x1a2455['push'](_0x1a2455['shift']());}};_0xd2286c(++_0xdaa32e);}(_0x291f,0x1a0));var _0xf291=function(_0x4546d7,_0x5bba6a){_0x4546d7=_0x4546d7-0x0;var _0x6572b=_0x291f[_0x4546d7];return _0x6572b;};'use strict';var multer=require(_0xf291('0x0'));var util=require(_0xf291('0x1'));var path=require('path');var timeout=require(_0xf291('0x2'));var express=require(_0xf291('0x3'));var router=express['Router']();var auth=require(_0xf291('0x4'));var interaction=require(_0xf291('0x5'));var config=require(_0xf291('0x6'));var controller=require(_0xf291('0x7'));router[_0xf291('0x8')]('/',auth['isAuthenticated'](),controller[_0xf291('0x9')]);router[_0xf291('0x8')]('/describe',auth[_0xf291('0xa')](),controller[_0xf291('0xb')]);router[_0xf291('0x8')](_0xf291('0xc'),auth[_0xf291('0xa')](),controller[_0xf291('0xd')]);router[_0xf291('0x8')](_0xf291('0xe'),auth[_0xf291('0xa')](),controller[_0xf291('0xf')]);router[_0xf291('0x10')]('/',auth[_0xf291('0xa')](),controller[_0xf291('0x11')]);router[_0xf291('0x12')](_0xf291('0xc'),auth['isAuthenticated'](),controller[_0xf291('0x13')]);router[_0xf291('0x14')](_0xf291('0xc'),auth[_0xf291('0xa')](),controller[_0xf291('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1d7fe92..d49a116 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 _0x5c12=['getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','moment','path','exports','VIRTUAL'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x5c12,0x188));var _0x25c1=function(_0x1e500e,_0x2c9d74){_0x1e500e=_0x1e500e-0x0;var _0x10dc5e=_0x5c12[_0x1e500e];return _0x10dc5e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var config=require('../../config/environment');module[_0x25c1('0x2')]={'format':{'type':Sequelize[_0x25c1('0x3')],'get':function(){return this[_0x25c1('0x4')](_0x25c1('0x5'))?path[_0x25c1('0x6')](this[_0x25c1('0x4')](_0x25c1('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x25c1('0x7')]},'value':{'type':Sequelize[_0x25c1('0x7')],'set':function(_0x382922){var _0x4ab674=_0x382922['replace'](/\\/g,'/');this[_0x25c1('0x8')](_0x25c1('0x5'),_0x4ab674);}},'rating':{'type':Sequelize[_0x25c1('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x25c1('0x9')],'set':function(_0xf8363f){this['setDataValue'](_0x25c1('0xa'),moment()[_0x25c1('0xb')](_0xf8363f,'ms'));this[_0x25c1('0x8')](_0x25c1('0xc'),moment());this[_0x25c1('0x8')]('duration',_0xf8363f);}},'startedAt':{'type':Sequelize[_0x25c1('0xd')],'get':function(){return moment(this[_0x25c1('0x4')]('startedAt'))[_0x25c1('0xe')](_0x25c1('0xf'))[_0x25c1('0x10')]();}},'closedAt':{'type':Sequelize[_0x25c1('0xd')],'get':function(){return moment(this['getDataValue']('closedAt'))['format']('MM-DD-YYYY\x20HH:mm')[_0x25c1('0x10')]();}},'createdAt':{'type':Sequelize[_0x25c1('0xd')],'get':function(){return moment(this[_0x25c1('0x4')](_0x25c1('0x11')))[_0x25c1('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x25c1('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('updatedAt'))[_0x25c1('0xe')](_0x25c1('0xf'))['toString']();}}}; \ No newline at end of file +var _0xd6d6=['STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','VIRTUAL','getDataValue','value','extname'];(function(_0x187137,_0x25e2d8){var _0x58e935=function(_0x1edb0b){while(--_0x1edb0b){_0x187137['push'](_0x187137['shift']());}};_0x58e935(++_0x25e2d8);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x14d036,_0x473443){_0x14d036=_0x14d036-0x0;var _0xad7e03=_0xd6d6[_0x14d036];return _0xad7e03;};'use strict';var Sequelize=require(_0x6d6d('0x0'));var moment=require(_0x6d6d('0x1'));var path=require(_0x6d6d('0x2'));var config=require(_0x6d6d('0x3'));module['exports']={'format':{'type':Sequelize[_0x6d6d('0x4')],'get':function(){return this[_0x6d6d('0x5')](_0x6d6d('0x6'))?path[_0x6d6d('0x7')](this[_0x6d6d('0x5')](_0x6d6d('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x6d6d('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x6d6d('0x8')],'set':function(_0x1bf731){var _0x44f83d=_0x1bf731[_0x6d6d('0x9')](/\\/g,'/');this[_0x6d6d('0xa')](_0x6d6d('0x6'),_0x44f83d);}},'rating':{'type':Sequelize[_0x6d6d('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x51dd38){this[_0x6d6d('0xa')](_0x6d6d('0xc'),moment()[_0x6d6d('0xd')](_0x51dd38,'ms'));this[_0x6d6d('0xa')](_0x6d6d('0xe'),moment());this['setDataValue'](_0x6d6d('0xf'),_0x51dd38);}},'startedAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x6d6d('0x11')](_0x6d6d('0x12'))[_0x6d6d('0x13')]();}},'closedAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this[_0x6d6d('0x5')](_0x6d6d('0xe')))[_0x6d6d('0x11')](_0x6d6d('0x12'))['toString']();}},'createdAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this[_0x6d6d('0x5')](_0x6d6d('0x14')))[_0x6d6d('0x11')](_0x6d6d('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x6d6d('0x10')],'get':function(){return moment(this['getDataValue'](_0x6d6d('0x15')))[_0x6d6d('0x11')](_0x6d6d('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8c4896a..9a2f04a 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 _0x39af=['../../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','count','offset','set','Content-Range','apply','save','update','destroy','then','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','filename','unlink','message','ScreenRecording\x20not\x20found','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x2898b5,_0x2666bc){var _0x1e6a72=function(_0x272a13){while(--_0x272a13){_0x2898b5['push'](_0x2898b5['shift']());}};_0x1e6a72(++_0x2666bc);}(_0x39af,0xc2));var _0xf39a=function(_0x266ca1,_0x86f8c1){_0x266ca1=_0x266ca1-0x0;var _0x2ba923=_0x39af[_0x266ca1];return _0x2ba923;};'use strict';var pdf=require(_0xf39a('0x0'));var emlformat=require(_0xf39a('0x1'));var rimraf=require(_0xf39a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf39a('0x3'));var rp=require(_0xf39a('0x4'));var moment=require(_0xf39a('0x5'));var BPromise=require(_0xf39a('0x6'));var Mustache=require(_0xf39a('0x7'));var util=require(_0xf39a('0x8'));var path=require(_0xf39a('0x9'));var sox=require('sox');var csv=require(_0xf39a('0xa'));var ejs=require(_0xf39a('0xb'));var fs=require('fs');var _=require(_0xf39a('0xc'));var squel=require(_0xf39a('0xd'));var crypto=require(_0xf39a('0xe'));var jsforce=require(_0xf39a('0xf'));var deskjs=require(_0xf39a('0x10'));var toCsv=require(_0xf39a('0xa'));var querystring=require(_0xf39a('0x11'));var Papa=require(_0xf39a('0x12'));var Redis=require(_0xf39a('0x13'));var authService=require(_0xf39a('0x14'));var qs=require(_0xf39a('0x15'));var as=require(_0xf39a('0x16'));var hardwareService=require(_0xf39a('0x17'));var logger=require(_0xf39a('0x18'))(_0xf39a('0x19'));var utils=require(_0xf39a('0x1a'));var config=require(_0xf39a('0x1b'));var licenseUtil=require(_0xf39a('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46db78,_0x1dfc98){_0x1dfc98=_0x1dfc98||0xcc;return function(_0x2f444f){if(_0x2f444f){return _0x46db78['sendStatus'](_0x1dfc98);}return _0x46db78[_0xf39a('0x1d')](_0x1dfc98)[_0xf39a('0x1e')]();};}function respondWithResult(_0x723b25,_0x1738ce){_0x1738ce=_0x1738ce||0xc8;return function(_0x308b35){if(_0x308b35){return _0x723b25[_0xf39a('0x1d')](_0x1738ce)[_0xf39a('0x1f')](_0x308b35);}};}function respondWithFilteredResult(_0xa35b57,_0x65b32e){return function(_0x267060){if(_0x267060){var _0x31bc6e=_0x267060[_0xf39a('0x20')],_0x191e1d=_0x65b32e['offset'],_0x47a22a=_0x65b32e[_0xf39a('0x21')]+_0x65b32e['limit'],_0x139272;if(_0x47a22a>=_0x31bc6e){_0x47a22a=_0x31bc6e;_0x139272=0xc8;}else{_0x139272=0xce;}_0xa35b57[_0xf39a('0x1d')](_0x139272);return _0xa35b57[_0xf39a('0x22')](_0xf39a('0x23'),_0x191e1d+'-'+_0x47a22a+'/'+_0x31bc6e)[_0xf39a('0x1f')](_0x267060);}return null;};}function patchUpdates(_0x1035e6){return function(_0x3bcf05){try{jsonpatch[_0xf39a('0x24')](_0x3bcf05,_0x1035e6,!![]);}catch(_0x297536){return BPromise['reject'](_0x297536);}return _0x3bcf05[_0xf39a('0x25')]();};}function saveUpdates(_0x22fc29,_0x1436c8){return function(_0x619c03){if(_0x619c03){return _0x619c03[_0xf39a('0x26')](_0x22fc29)['then'](function(_0x155918){return _0x155918;});}return null;};}function removeEntity(_0x3ff554,_0x8e5403){return function(_0x11894f){if(_0x11894f){return _0x11894f[_0xf39a('0x27')]()[_0xf39a('0x28')](function(){_0x3ff554[_0xf39a('0x1d')](0xcc)[_0xf39a('0x1e')]();});}};}function handleEntityNotFound(_0x31f7a6,_0x312d06){return function(_0x2e7e95){if(!_0x2e7e95){_0x31f7a6['sendStatus'](0x194);}return _0x2e7e95;};}function handleError(_0x3bb24c,_0xa47ec0){_0xa47ec0=_0xa47ec0||0x1f4;return function(_0x14aa55){logger['error'](_0x14aa55[_0xf39a('0x29')]);if(_0x14aa55[_0xf39a('0x2a')]){delete _0x14aa55[_0xf39a('0x2a')];}_0x3bb24c[_0xf39a('0x1d')](_0xa47ec0)['send'](_0x14aa55);};}exports[_0xf39a('0x2b')]=function(_0xfa8b2f,_0x113b2e){var _0x1a5b0f={},_0x3dea91={},_0x391fe9={'count':0x0,'rows':[]};var _0xabe20b=_[_0xf39a('0x2c')](db[_0xf39a('0x2d')][_0xf39a('0x2e')],function(_0x5e809a){return{'name':_0x5e809a[_0xf39a('0x2f')],'type':_0x5e809a[_0xf39a('0x30')][_0xf39a('0x31')]};});_0x3dea91[_0xf39a('0x32')]=_['differenceBy'](_['map'](_0xabe20b,_0xf39a('0x2a')),[_0xf39a('0x33')]);_0x3dea91['query']=_['keys'](_0xfa8b2f[_0xf39a('0x34')]);_0x3dea91[_0xf39a('0x35')]=_['intersection'](_0x3dea91[_0xf39a('0x32')],_0x3dea91[_0xf39a('0x34')]);_0x1a5b0f['attributes']=_[_0xf39a('0x36')](_0x3dea91['model'],qs[_0xf39a('0x37')](_0xfa8b2f['query'][_0xf39a('0x37')]));_0x1a5b0f[_0xf39a('0x38')]=_0x1a5b0f['attributes'][_0xf39a('0x39')]?_0x1a5b0f[_0xf39a('0x38')]:_0x3dea91[_0xf39a('0x32')];if(!_0xfa8b2f[_0xf39a('0x34')][_0xf39a('0x3a')]('nolimit')){_0x1a5b0f[_0xf39a('0x3b')]=qs[_0xf39a('0x3b')](_0xfa8b2f['query'][_0xf39a('0x3b')]);_0x1a5b0f['offset']=qs[_0xf39a('0x21')](_0xfa8b2f[_0xf39a('0x34')][_0xf39a('0x21')]);}_0x1a5b0f[_0xf39a('0x3c')]=qs[_0xf39a('0x3d')](_0xfa8b2f[_0xf39a('0x34')][_0xf39a('0x3d')]);_0x1a5b0f[_0xf39a('0x3e')]=qs[_0xf39a('0x35')](_[_0xf39a('0x3f')](_0xfa8b2f[_0xf39a('0x34')],_0x3dea91[_0xf39a('0x35')]),_0xabe20b);if(_0xfa8b2f[_0xf39a('0x34')]['filter']){_0x1a5b0f[_0xf39a('0x3e')]=_[_0xf39a('0x40')](_0x1a5b0f[_0xf39a('0x3e')],{'$or':_[_0xf39a('0x2c')](_0xabe20b,function(_0x3be7ba){if(_0x3be7ba[_0xf39a('0x30')]!==_0xf39a('0x41')){var _0x591f33={};_0x591f33[_0x3be7ba[_0xf39a('0x2a')]]={'$like':'%'+_0xfa8b2f['query']['filter']+'%'};return _0x591f33;}})});}_0x1a5b0f=_[_0xf39a('0x40')]({},_0x1a5b0f,_0xfa8b2f[_0xf39a('0x42')]);var _0xe7c96a={'where':_0x1a5b0f['where']};return db[_0xf39a('0x2d')][_0xf39a('0x20')](_0xe7c96a)[_0xf39a('0x28')](function(_0x22f9d0){_0x391fe9[_0xf39a('0x20')]=_0x22f9d0;if(_0xfa8b2f[_0xf39a('0x34')][_0xf39a('0x43')]){_0x1a5b0f['include']=[{'all':!![]}];}return db[_0xf39a('0x2d')][_0xf39a('0x44')](_0x1a5b0f);})[_0xf39a('0x28')](function(_0x50e6da){_0x391fe9[_0xf39a('0x45')]=_0x50e6da;return _0x391fe9;})['then'](respondWithFilteredResult(_0x113b2e,_0x1a5b0f))[_0xf39a('0x46')](handleError(_0x113b2e,null));};exports[_0xf39a('0x47')]=function(_0x38126a,_0x57b0a7){var _0x13146c={'raw':![],'where':{'id':_0x38126a['params']['id']}},_0x13c5b1={};_0x13c5b1[_0xf39a('0x32')]=_[_0xf39a('0x48')](db[_0xf39a('0x2d')][_0xf39a('0x2e')]);_0x13c5b1['query']=_[_0xf39a('0x48')](_0x38126a[_0xf39a('0x34')]);_0x13c5b1[_0xf39a('0x35')]=_[_0xf39a('0x36')](_0x13c5b1[_0xf39a('0x32')],_0x13c5b1[_0xf39a('0x34')]);_0x13146c[_0xf39a('0x38')]=_['intersection'](_0x13c5b1[_0xf39a('0x32')],qs['fields'](_0x38126a[_0xf39a('0x34')]['fields']));_0x13146c[_0xf39a('0x38')]=_0x13146c['attributes']['length']?_0x13146c[_0xf39a('0x38')]:_0x13c5b1[_0xf39a('0x32')];if(_0x38126a[_0xf39a('0x34')][_0xf39a('0x43')]){_0x13146c[_0xf39a('0x49')]=[{'all':!![]}];}_0x13146c=_[_0xf39a('0x40')]({},_0x13146c,_0x38126a[_0xf39a('0x42')]);return db['ScreenRecording'][_0xf39a('0x4a')](_0x13146c)[_0xf39a('0x28')](handleEntityNotFound(_0x57b0a7,null))['then'](respondWithResult(_0x57b0a7,null))[_0xf39a('0x46')](handleError(_0x57b0a7,null));};exports[_0xf39a('0x4b')]=function(_0x5caa3e,_0x168371){return db[_0xf39a('0x2d')][_0xf39a('0x4b')](_0x5caa3e['body'],{})[_0xf39a('0x28')](respondWithResult(_0x168371,0xc9))['catch'](handleError(_0x168371,null));};exports['update']=function(_0x8d27a3,_0x571200){if(_0x8d27a3[_0xf39a('0x4c')]['id']){delete _0x8d27a3[_0xf39a('0x4c')]['id'];}delete _0x8d27a3['body'][_0xf39a('0x4d')];delete _0x8d27a3[_0xf39a('0x4c')][_0xf39a('0x4e')];delete _0x8d27a3[_0xf39a('0x4c')][_0xf39a('0x4f')];delete _0x8d27a3[_0xf39a('0x4c')][_0xf39a('0x50')];return db[_0xf39a('0x2d')][_0xf39a('0x4a')]({'where':{'id':_0x8d27a3[_0xf39a('0x51')]['id']}})[_0xf39a('0x28')](handleEntityNotFound(_0x571200,null))['then'](saveUpdates(_0x8d27a3['body'],null))['then'](respondWithResult(_0x571200,null))[_0xf39a('0x46')](handleError(_0x571200,null));};exports[_0xf39a('0x52')]=function(_0x159880,_0x4e01e8){return db[_0xf39a('0x2d')][_0xf39a('0x52')]()[_0xf39a('0x28')](respondWithResult(_0x4e01e8,null))[_0xf39a('0x46')](handleError(_0x4e01e8,null));};exports[_0xf39a('0x53')]=function(_0x4bdb88,_0x5cd261,_0x379bad){var _0x4fc8a1=require(_0xf39a('0x54'));var _0x2b2bf2=![];var _0x4ba43a={};if(_0x4bdb88['query']['type']&&_0x4bdb88[_0xf39a('0x34')][_0xf39a('0x30')]==='uniqueid'){_0x4ba43a[_0xf39a('0x55')]=_0x4bdb88[_0xf39a('0x51')]['id'];}else{_0x4ba43a['id']=_0x4bdb88['params']['id'];}return db[_0xf39a('0x2d')][_0xf39a('0x4a')]({'where':_0x4ba43a,'attributes':['id',_0xf39a('0x50')],'raw':!![]})[_0xf39a('0x28')](handleEntityNotFound(_0x5cd261,null))['then'](function(_0x1d14e7){if(_0x1d14e7){var _0x1eb82d=path[_0xf39a('0x56')](config[_0xf39a('0x57')],_0xf39a('0x58'),_0x1d14e7[_0xf39a('0x50')]);var _0x59e483=util['format'](_0xf39a('0x59'),_0x1eb82d);if(fs[_0xf39a('0x5a')](_0x59e483)){_0x2b2bf2=!![];return _0x4fc8a1['decryptFile'](_0x59e483,_0x1eb82d,config[_0xf39a('0x5b')][_0xf39a('0x5c')])['then'](function(){return _0x1d14e7;});}return _0x1d14e7;}})[_0xf39a('0x28')](function(_0x323ad3){if(_0x323ad3){var _0x1f06b1=path['join'](config[_0xf39a('0x57')],_0xf39a('0x58'),_0x323ad3[_0xf39a('0x50')]);if(!fs[_0xf39a('0x5a')](_0x1f06b1)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x323ad3[_0xf39a('0x5d')]){return _0x5cd261[_0xf39a('0x53')](_0x1f06b1,_0x323ad3['filename']+path['extname'](_0x1f06b1),function(){if(_0x2b2bf2){fs[_0xf39a('0x5e')](_0x1f06b1);}});}else{return _0x5cd261[_0xf39a('0x53')](_0x1f06b1,function(_0x277cb7){if(_0x2b2bf2){fs[_0xf39a('0x5e')](_0x1f06b1);}});}}})[_0xf39a('0x46')](function(_0x38546d){if(_0x38546d[_0xf39a('0x5f')]===_0xf39a('0x60')){_0x5cd261['status'](0x194)[_0xf39a('0x61')](_0xf39a('0x62'));}else{return handleError(_0x5cd261,null);}});};exports[_0xf39a('0x27')]=function(_0x275be7,_0x2655aa){return db['ScreenRecording']['find']({'where':{'id':_0x275be7[_0xf39a('0x51')]['id']}})[_0xf39a('0x28')](function(_0x41bc04){if(!_0x41bc04)throw new ReferenceError(_0xf39a('0x63'));return _0x41bc04;})['then'](function(_0x46ccba){var _0x38846b=path[_0xf39a('0x56')](config['root'],_0xf39a('0x58'),_0x46ccba['value']);logger[_0xf39a('0x64')](_0xf39a('0x65'),_0x38846b);if(!_[_0xf39a('0x66')](_0x46ccba[_0xf39a('0x50')])&&fs[_0xf39a('0x5a')](_0x38846b)){logger[_0xf39a('0x64')](_0xf39a('0x67')+_0x38846b+_0xf39a('0x68'));fs['unlinkSync'](_0x38846b);}_0x38846b=_0x38846b+_0xf39a('0x69');if(!_[_0xf39a('0x66')](_0x46ccba['value'])&&fs['existsSync'](_0x38846b)){logger[_0xf39a('0x64')](_0xf39a('0x67')+_0x38846b+_0xf39a('0x68'));fs[_0xf39a('0x6a')](_0x38846b);}return _0x46ccba;})[_0xf39a('0x28')](function(_0x370d6b){if(!_0x370d6b)throw new InternalError();return _0x370d6b[_0xf39a('0x27')]();})['then'](function(){_0x2655aa['status'](0xcc)[_0xf39a('0x1e')]();})['catch'](handleError(_0x2655aa,null));}; \ No newline at end of file +var _0x88a2=['ScreenRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','end','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','json','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','rawAttributes','fieldName','differenceBy','format','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','duration','closedAt','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','existsSync','secrets','recording','join','root','filename','unlink','download'];(function(_0x5ede1a,_0x51e4d0){var _0x9b0761=function(_0x3cf50b){while(--_0x3cf50b){_0x5ede1a['push'](_0x5ede1a['shift']());}};_0x9b0761(++_0x51e4d0);}(_0x88a2,0x1e6));var _0x288a=function(_0x562792,_0x507fbc){_0x562792=_0x562792-0x0;var _0x2b9ae1=_0x88a2[_0x562792];return _0x2b9ae1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x288a('0x0'));var rimraf=require(_0x288a('0x1'));var zipdir=require(_0x288a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x288a('0x3'));var moment=require(_0x288a('0x4'));var BPromise=require(_0x288a('0x5'));var Mustache=require('mustache');var util=require(_0x288a('0x6'));var path=require(_0x288a('0x7'));var sox=require(_0x288a('0x8'));var csv=require(_0x288a('0x9'));var ejs=require(_0x288a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x288a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x288a('0xc'));var toCsv=require(_0x288a('0x9'));var querystring=require(_0x288a('0xd'));var Papa=require('papaparse');var Redis=require(_0x288a('0xe'));var authService=require(_0x288a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x288a('0x10'))('api');var utils=require(_0x288a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x288a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb5a396,_0x4161ea){_0x4161ea=_0x4161ea||0xcc;return function(_0x1ceb4c){if(_0x1ceb4c){return _0xb5a396[_0x288a('0x13')](_0x4161ea);}return _0xb5a396['status'](_0x4161ea)['end']();};}function respondWithResult(_0x11f136,_0x4229c1){_0x4229c1=_0x4229c1||0xc8;return function(_0x4550dd){if(_0x4550dd){return _0x11f136[_0x288a('0x14')](_0x4229c1)[_0x288a('0x15')](_0x4550dd);}};}function respondWithFilteredResult(_0x3832a2,_0x229110){return function(_0x296966){if(_0x296966){var _0x20fd77=_0x296966[_0x288a('0x16')],_0x1cfb12=_0x229110[_0x288a('0x17')],_0x21c6b3=_0x229110['offset']+_0x229110['limit'],_0x587a47;if(_0x21c6b3>=_0x20fd77){_0x21c6b3=_0x20fd77;_0x587a47=0xc8;}else{_0x587a47=0xce;}_0x3832a2[_0x288a('0x14')](_0x587a47);return _0x3832a2['set'](_0x288a('0x18'),_0x1cfb12+'-'+_0x21c6b3+'/'+_0x20fd77)[_0x288a('0x15')](_0x296966);}return null;};}function patchUpdates(_0x19ac2a){return function(_0x4f0724){try{jsonpatch[_0x288a('0x19')](_0x4f0724,_0x19ac2a,!![]);}catch(_0x5eb240){return BPromise['reject'](_0x5eb240);}return _0x4f0724[_0x288a('0x1a')]();};}function saveUpdates(_0x2a05f3,_0x18396c){return function(_0x2ccc99){if(_0x2ccc99){return _0x2ccc99[_0x288a('0x1b')](_0x2a05f3)[_0x288a('0x1c')](function(_0x2e9408){return _0x2e9408;});}return null;};}function removeEntity(_0x3d3d43,_0x1faf29){return function(_0x519b6){if(_0x519b6){return _0x519b6[_0x288a('0x1d')]()[_0x288a('0x1c')](function(){_0x3d3d43['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b7ef,_0x43ec3f){return function(_0x5bad87){if(!_0x5bad87){_0x15b7ef[_0x288a('0x13')](0x194);}return _0x5bad87;};}function handleError(_0x57df5a,_0x412d0d){_0x412d0d=_0x412d0d||0x1f4;return function(_0x2f9b63){logger[_0x288a('0x1e')](_0x2f9b63[_0x288a('0x1f')]);if(_0x2f9b63[_0x288a('0x20')]){delete _0x2f9b63[_0x288a('0x20')];}_0x57df5a[_0x288a('0x14')](_0x412d0d)[_0x288a('0x21')](_0x2f9b63);};}exports[_0x288a('0x22')]=function(_0x716bf6,_0x583498){var _0x503d4a={},_0x4f25ec={},_0x282ec4={'count':0x0,'rows':[]};var _0x58f5f4=_[_0x288a('0x23')](db[_0x288a('0x24')][_0x288a('0x25')],function(_0x42cc1a){return{'name':_0x42cc1a[_0x288a('0x26')],'type':_0x42cc1a['type']['key']};});_0x4f25ec['model']=_[_0x288a('0x27')](_[_0x288a('0x23')](_0x58f5f4,_0x288a('0x20')),[_0x288a('0x28')]);_0x4f25ec[_0x288a('0x29')]=_[_0x288a('0x2a')](_0x716bf6['query']);_0x4f25ec[_0x288a('0x2b')]=_[_0x288a('0x2c')](_0x4f25ec[_0x288a('0x2d')],_0x4f25ec['query']);_0x503d4a[_0x288a('0x2e')]=_[_0x288a('0x2c')](_0x4f25ec[_0x288a('0x2d')],qs[_0x288a('0x2f')](_0x716bf6[_0x288a('0x29')][_0x288a('0x2f')]));_0x503d4a[_0x288a('0x2e')]=_0x503d4a[_0x288a('0x2e')]['length']?_0x503d4a[_0x288a('0x2e')]:_0x4f25ec['model'];if(!_0x716bf6[_0x288a('0x29')][_0x288a('0x30')](_0x288a('0x31'))){_0x503d4a[_0x288a('0x32')]=qs[_0x288a('0x32')](_0x716bf6[_0x288a('0x29')][_0x288a('0x32')]);_0x503d4a[_0x288a('0x17')]=qs['offset'](_0x716bf6['query'][_0x288a('0x17')]);}_0x503d4a[_0x288a('0x33')]=qs[_0x288a('0x34')](_0x716bf6[_0x288a('0x29')][_0x288a('0x34')]);_0x503d4a[_0x288a('0x35')]=qs[_0x288a('0x2b')](_['pick'](_0x716bf6['query'],_0x4f25ec['filters']),_0x58f5f4);if(_0x716bf6[_0x288a('0x29')][_0x288a('0x36')]){_0x503d4a[_0x288a('0x35')]=_[_0x288a('0x37')](_0x503d4a['where'],{'$or':_[_0x288a('0x23')](_0x58f5f4,function(_0x3993cf){if(_0x3993cf[_0x288a('0x38')]!==_0x288a('0x39')){var _0x2c3a6f={};_0x2c3a6f[_0x3993cf['name']]={'$like':'%'+_0x716bf6[_0x288a('0x29')]['filter']+'%'};return _0x2c3a6f;}})});}_0x503d4a=_[_0x288a('0x37')]({},_0x503d4a,_0x716bf6[_0x288a('0x3a')]);var _0x4a8b29={'where':_0x503d4a[_0x288a('0x35')]};return db[_0x288a('0x24')][_0x288a('0x16')](_0x4a8b29)[_0x288a('0x1c')](function(_0x3bdd19){_0x282ec4[_0x288a('0x16')]=_0x3bdd19;if(_0x716bf6[_0x288a('0x29')]['includeAll']){_0x503d4a[_0x288a('0x3b')]=[{'all':!![]}];}return db[_0x288a('0x24')][_0x288a('0x3c')](_0x503d4a);})[_0x288a('0x1c')](function(_0x2fdaca){_0x282ec4[_0x288a('0x3d')]=_0x2fdaca;return _0x282ec4;})[_0x288a('0x1c')](respondWithFilteredResult(_0x583498,_0x503d4a))[_0x288a('0x3e')](handleError(_0x583498,null));};exports[_0x288a('0x3f')]=function(_0x23507e,_0x2ca6a6){var _0x4c2a29={'raw':![],'where':{'id':_0x23507e[_0x288a('0x40')]['id']}},_0xaf9e={};_0xaf9e[_0x288a('0x2d')]=_[_0x288a('0x2a')](db[_0x288a('0x24')][_0x288a('0x25')]);_0xaf9e[_0x288a('0x29')]=_['keys'](_0x23507e[_0x288a('0x29')]);_0xaf9e[_0x288a('0x2b')]=_[_0x288a('0x2c')](_0xaf9e[_0x288a('0x2d')],_0xaf9e[_0x288a('0x29')]);_0x4c2a29[_0x288a('0x2e')]=_[_0x288a('0x2c')](_0xaf9e['model'],qs['fields'](_0x23507e['query'][_0x288a('0x2f')]));_0x4c2a29['attributes']=_0x4c2a29[_0x288a('0x2e')]['length']?_0x4c2a29[_0x288a('0x2e')]:_0xaf9e[_0x288a('0x2d')];if(_0x23507e[_0x288a('0x29')][_0x288a('0x41')]){_0x4c2a29[_0x288a('0x3b')]=[{'all':!![]}];}_0x4c2a29=_[_0x288a('0x37')]({},_0x4c2a29,_0x23507e[_0x288a('0x3a')]);return db[_0x288a('0x24')][_0x288a('0x42')](_0x4c2a29)[_0x288a('0x1c')](handleEntityNotFound(_0x2ca6a6,null))['then'](respondWithResult(_0x2ca6a6,null))[_0x288a('0x3e')](handleError(_0x2ca6a6,null));};exports[_0x288a('0x43')]=function(_0x553046,_0x5f4cc7){return db[_0x288a('0x24')][_0x288a('0x43')](_0x553046[_0x288a('0x44')],{})[_0x288a('0x1c')](respondWithResult(_0x5f4cc7,0xc9))['catch'](handleError(_0x5f4cc7,null));};exports['update']=function(_0xdcbadb,_0x5afea5){if(_0xdcbadb['body']['id']){delete _0xdcbadb[_0x288a('0x44')]['id'];}delete _0xdcbadb['body'][_0x288a('0x45')];delete _0xdcbadb[_0x288a('0x44')]['createdAt'];delete _0xdcbadb[_0x288a('0x44')][_0x288a('0x46')];delete _0xdcbadb[_0x288a('0x44')]['value'];return db[_0x288a('0x24')]['find']({'where':{'id':_0xdcbadb['params']['id']}})[_0x288a('0x1c')](handleEntityNotFound(_0x5afea5,null))['then'](saveUpdates(_0xdcbadb['body'],null))[_0x288a('0x1c')](respondWithResult(_0x5afea5,null))['catch'](handleError(_0x5afea5,null));};exports[_0x288a('0x47')]=function(_0x56b2fd,_0x2e5515){return db[_0x288a('0x24')]['describe']()[_0x288a('0x1c')](respondWithResult(_0x2e5515,null))[_0x288a('0x3e')](handleError(_0x2e5515,null));};exports['download']=function(_0x36f769,_0x1b6d84,_0x519ac6){var _0x5042a0=require(_0x288a('0x48'));var _0x4f3143=![];var _0x275107={};if(_0x36f769['query'][_0x288a('0x38')]&&_0x36f769[_0x288a('0x29')][_0x288a('0x38')]==='uniqueid'){_0x275107[_0x288a('0x49')]=_0x36f769[_0x288a('0x40')]['id'];}else{_0x275107['id']=_0x36f769[_0x288a('0x40')]['id'];}return db[_0x288a('0x24')][_0x288a('0x42')]({'where':_0x275107,'attributes':['id',_0x288a('0x4a')],'raw':!![]})['then'](handleEntityNotFound(_0x1b6d84,null))['then'](function(_0x1c5a3c){if(_0x1c5a3c){var _0x3af084=path['join'](config['root'],_0x288a('0x4b'),_0x1c5a3c['value']);var _0x457379=util[_0x288a('0x28')]('%s.cypher',_0x3af084);if(fs[_0x288a('0x4c')](_0x457379)){_0x4f3143=!![];return _0x5042a0['decryptFile'](_0x457379,_0x3af084,config[_0x288a('0x4d')][_0x288a('0x4e')])[_0x288a('0x1c')](function(){return _0x1c5a3c;});}return _0x1c5a3c;}})[_0x288a('0x1c')](function(_0x195e55){if(_0x195e55){var _0x56de51=path[_0x288a('0x4f')](config[_0x288a('0x50')],_0x288a('0x4b'),_0x195e55[_0x288a('0x4a')]);if(!fs['existsSync'](_0x56de51)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x195e55[_0x288a('0x51')]){return _0x1b6d84['download'](_0x56de51,_0x195e55[_0x288a('0x51')]+path['extname'](_0x56de51),function(){if(_0x4f3143){fs[_0x288a('0x52')](_0x56de51);}});}else{return _0x1b6d84[_0x288a('0x53')](_0x56de51,function(_0x1ca976){if(_0x4f3143){fs[_0x288a('0x52')](_0x56de51);}});}}})[_0x288a('0x3e')](function(_0x2d84a3){if(_0x2d84a3['message']===_0x288a('0x54')){_0x1b6d84['status'](0x194)['send'](_0x288a('0x55'));}else{return handleError(_0x1b6d84,null);}});};exports['destroy']=function(_0xd9fba1,_0x480772){return db['ScreenRecording']['find']({'where':{'id':_0xd9fba1[_0x288a('0x40')]['id']}})[_0x288a('0x1c')](function(_0x3d3300){if(!_0x3d3300)throw new ReferenceError(_0x288a('0x56'));return _0x3d3300;})['then'](function(_0x43552e){var _0x125bcf=path[_0x288a('0x4f')](config[_0x288a('0x50')],_0x288a('0x4b'),_0x43552e['value']);logger['info'](_0x288a('0x57'),_0x125bcf);if(!_['isNil'](_0x43552e[_0x288a('0x4a')])&&fs[_0x288a('0x4c')](_0x125bcf)){logger[_0x288a('0x58')](_0x288a('0x59')+_0x125bcf+_0x288a('0x5a'));fs[_0x288a('0x5b')](_0x125bcf);}_0x125bcf=_0x125bcf+_0x288a('0x5c');if(!_[_0x288a('0x5d')](_0x43552e[_0x288a('0x4a')])&&fs[_0x288a('0x4c')](_0x125bcf)){logger[_0x288a('0x58')]('File:\x20\x22'+_0x125bcf+_0x288a('0x5a'));fs[_0x288a('0x5b')](_0x125bcf);}return _0x43552e;})[_0x288a('0x1c')](function(_0xd32f1e){if(!_0xd32f1e)throw new InternalError();return _0xd32f1e[_0x288a('0x1d')]();})[_0x288a('0x1c')](function(){_0x480772[_0x288a('0x14')](0xcc)[_0x288a('0x5e')]();})[_0x288a('0x3e')](handleError(_0x480772,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index f0d12d7..8632d36 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 _0xbdfb=['interactionid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x5749e9,_0x4db682){var _0x10ada1=function(_0xd50ed1){while(--_0xd50ed1){_0x5749e9['push'](_0x5749e9['shift']());}};_0x10ada1(++_0x4db682);}(_0xbdfb,0xd1));var _0xbbdf=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0xbdfb[_0x5beda8];return _0x2aa042;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var logger=require(_0xbbdf('0x2'))(_0xbbdf('0x3'));var moment=require(_0xbbdf('0x4'));var BPromise=require('bluebird');var rp=require(_0xbbdf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbdf('0x6'));var config=require(_0xbbdf('0x7'));var attributes=require(_0xbbdf('0x8'));module[_0xbbdf('0x9')]=function(_0x433132,_0x5c8b61){return _0x433132[_0xbbdf('0xa')](_0xbbdf('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xbbdf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7ae=['../../config/environment','./screenRecording.attributes','exports','screen_recordings','interactionid','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x54334a,_0x56bcd8){var _0x51cd78=function(_0x4f9df3){while(--_0x4f9df3){_0x54334a['push'](_0x54334a['shift']());}};_0x51cd78(++_0x56bcd8);}(_0xb7ae,0x1c8));var _0xeb7a=function(_0x1adba6,_0x2e4c52){_0x1adba6=_0x1adba6-0x0;var _0x36ef49=_0xb7ae[_0x1adba6];return _0x36ef49;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeb7a('0x0'))(_0xeb7a('0x1'));var moment=require('moment');var BPromise=require(_0xeb7a('0x2'));var rp=require(_0xeb7a('0x3'));var fs=require('fs');var path=require(_0xeb7a('0x4'));var rimraf=require(_0xeb7a('0x5'));var config=require(_0xeb7a('0x6'));var attributes=require(_0xeb7a('0x7'));module[_0xeb7a('0x8')]=function(_0x399476,_0x9f1f4f){return _0x399476['define']('ScreenRecording',attributes,{'tableName':_0xeb7a('0x9'),'paranoid':![],'indexes':[{'name':_0xeb7a('0xa'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 460c24f..3994dac 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 _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x3f2ffc,_0x3c2a07){var _0x5bfc9e=function(_0x12398f){while(--_0x12398f){_0x3f2ffc['push'](_0x3f2ffc['shift']());}};_0x5bfc9e(++_0x3c2a07);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x910aab,_0x583d9c){var _0x2c8785=function(_0x3a7ca1){while(--_0x3a7ca1){_0x910aab['push'](_0x910aab['shift']());}};_0x2c8785(++_0x583d9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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/setting/index.js b/server/api/setting/index.js index e89c996..64f5f49 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 _0x0d12=['put','/:id','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getDate','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','logo','post','single','addLogo','format','%s%s','logologin','originalname','file','addLogoLogin','preferred','extname','favicon','/:id/favicon'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x0d12,0x81));var _0x20d1=function(_0x5693bb,_0x50a44b){_0x5693bb=_0x5693bb-0x0;var _0x72bb42=_0x0d12[_0x5693bb];return _0x72bb42;};'use strict';var multer=require(_0x20d1('0x0'));var util=require('util');var path=require(_0x20d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x20d1('0x2'));var router=express[_0x20d1('0x3')]();var auth=require(_0x20d1('0x4'));var interaction=require(_0x20d1('0x5'));var config=require(_0x20d1('0x6'));var controller=require('./setting.controller');router[_0x20d1('0x7')]('/',auth[_0x20d1('0x8')](),controller[_0x20d1('0x9')]);router[_0x20d1('0x7')]('/now',controller[_0x20d1('0xa')]);router[_0x20d1('0x7')]('/:id',controller[_0x20d1('0xb')]);router['get'](_0x20d1('0xc'),controller[_0x20d1('0xd')]);router['get'](_0x20d1('0xe'),controller[_0x20d1('0xf')]);router['get'](_0x20d1('0x10'),controller[_0x20d1('0x11')]);router['get'](_0x20d1('0x12'),controller[_0x20d1('0x13')]);router['get']('/:id/favicon',controller[_0x20d1('0x14')]);var upload=multer({'storage':multer[_0x20d1('0x15')]({'destination':function(_0x4d1c24,_0xd75db1,_0x41cfb2){_0x41cfb2(null,path[_0x20d1('0x16')](config[_0x20d1('0x17')],_0x20d1('0x18')));},'filename':function(_0x335063,_0x3ffaa2,_0x418ed4){_0x418ed4(null,util['format']('%s%s',_0x20d1('0x19'),path['extname'](_0x3ffaa2['originalname'])));}})});router[_0x20d1('0x1a')]('/:id/logo',upload[_0x20d1('0x1b')]('file'),controller[_0x20d1('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3972ec,_0x43fa3c,_0x4be92b){_0x4be92b(null,path['join'](config[_0x20d1('0x17')],_0x20d1('0x18')));},'filename':function(_0x21c74c,_0x56e9c5,_0x45f803){_0x45f803(null,util[_0x20d1('0x1d')](_0x20d1('0x1e'),_0x20d1('0x1f'),path['extname'](_0x56e9c5[_0x20d1('0x20')])));}})});router[_0x20d1('0x1a')](_0x20d1('0xe'),upload[_0x20d1('0x1b')](_0x20d1('0x21')),controller[_0x20d1('0x22')]);var upload=multer({'storage':multer[_0x20d1('0x15')]({'destination':function(_0xadd0ad,_0xd50101,_0x1c885a){_0x1c885a(null,path[_0x20d1('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x3ab53d,_0x4e2afa,_0x20e6f0){_0x20e6f0(null,util['format']('%s%s',_0x20d1('0x23'),path[_0x20d1('0x24')](_0x4e2afa[_0x20d1('0x20')])));}})});router['post'](_0x20d1('0x12'),upload[_0x20d1('0x1b')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x20d1('0x15')]({'destination':function(_0x1ea746,_0x414b77,_0x43a16c){_0x43a16c(null,path[_0x20d1('0x16')](config[_0x20d1('0x17')],_0x20d1('0x18')));},'filename':function(_0x37057a,_0x425e3a,_0x464602){_0x464602(null,util[_0x20d1('0x1d')](_0x20d1('0x1e'),_0x20d1('0x25'),path[_0x20d1('0x24')](_0x425e3a[_0x20d1('0x20')])));}})});router[_0x20d1('0x1a')](_0x20d1('0x26'),upload['single'](_0x20d1('0x21')),controller['addFavicon']);router[_0x20d1('0x27')](_0x20d1('0x28'),auth[_0x20d1('0x8')](),controller['update']);module[_0x20d1('0x29')]=router; \ No newline at end of file +var _0x556c=['join','root','server/files/images/logos/','format','logo','post','single','file','addLogo','logologin','originalname','/:id/logo_login','addLogoLogin','%s%s','preferred','extname','favicon','/:id/favicon','addFavicon','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','/:id','/:id/logo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage'];(function(_0x50f30c,_0x22eaa1){var _0x46b465=function(_0xc1a54a){while(--_0xc1a54a){_0x50f30c['push'](_0x50f30c['shift']());}};_0x46b465(++_0x22eaa1);}(_0x556c,0x119));var _0xc556=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x556c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc556('0x0'));var util=require(_0xc556('0x1'));var path=require(_0xc556('0x2'));var timeout=require(_0xc556('0x3'));var express=require(_0xc556('0x4'));var router=express[_0xc556('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc556('0x6'));var config=require(_0xc556('0x7'));var controller=require(_0xc556('0x8'));router[_0xc556('0x9')]('/',auth['isAuthenticated'](),controller[_0xc556('0xa')]);router['get'](_0xc556('0xb'),controller['getDate']);router[_0xc556('0x9')](_0xc556('0xc'),controller['show']);router[_0xc556('0x9')](_0xc556('0xd'),controller['getLogo']);router[_0xc556('0x9')]('/:id/logo_login',controller[_0xc556('0xe')]);router['get'](_0xc556('0xf'),controller['gdpr']);router['get'](_0xc556('0x10'),controller[_0xc556('0x11')]);router['get']('/:id/favicon',controller[_0xc556('0x12')]);var upload=multer({'storage':multer[_0xc556('0x13')]({'destination':function(_0x142281,_0x44a813,_0x4055ba){_0x4055ba(null,path[_0xc556('0x14')](config[_0xc556('0x15')],_0xc556('0x16')));},'filename':function(_0x1508c8,_0x442e89,_0x4a3508){_0x4a3508(null,util[_0xc556('0x17')]('%s%s',_0xc556('0x18'),path['extname'](_0x442e89['originalname'])));}})});router[_0xc556('0x19')](_0xc556('0xd'),upload[_0xc556('0x1a')](_0xc556('0x1b')),controller[_0xc556('0x1c')]);var upload=multer({'storage':multer[_0xc556('0x13')]({'destination':function(_0x335608,_0x2d4a37,_0x26880d){_0x26880d(null,path['join'](config[_0xc556('0x15')],_0xc556('0x16')));},'filename':function(_0x203100,_0x3d4d8f,_0x41bea1){_0x41bea1(null,util[_0xc556('0x17')]('%s%s',_0xc556('0x1d'),path['extname'](_0x3d4d8f[_0xc556('0x1e')])));}})});router['post'](_0xc556('0x1f'),upload[_0xc556('0x1a')]('file'),controller[_0xc556('0x20')]);var upload=multer({'storage':multer[_0xc556('0x13')]({'destination':function(_0x9faac8,_0x29df5b,_0x3650d0){_0x3650d0(null,path[_0xc556('0x14')](config[_0xc556('0x15')],_0xc556('0x16')));},'filename':function(_0x352a19,_0x479671,_0x90036f){_0x90036f(null,util[_0xc556('0x17')](_0xc556('0x21'),_0xc556('0x22'),path[_0xc556('0x23')](_0x479671[_0xc556('0x1e')])));}})});router[_0xc556('0x19')]('/:id/preferred',upload[_0xc556('0x1a')](_0xc556('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0xc556('0x13')]({'destination':function(_0x14811c,_0x84396c,_0x3c6fa8){_0x3c6fa8(null,path['join'](config[_0xc556('0x15')],_0xc556('0x16')));},'filename':function(_0x37e8c8,_0x2f18b9,_0x6c25ca){_0x6c25ca(null,util['format'](_0xc556('0x21'),_0xc556('0x24'),path[_0xc556('0x23')](_0x2f18b9[_0xc556('0x1e')])));}})});router[_0xc556('0x19')](_0xc556('0x25'),upload[_0xc556('0x1a')](_0xc556('0x1b')),controller[_0xc556('0x26')]);router[_0xc556('0x27')](_0xc556('0xc'),auth[_0xc556('0x28')](),controller[_0xc556('0x29')]);module[_0xc556('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 9bfa5ee..43b36ae 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 _0x8aeb=['/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','min_internal','INTEGER'];(function(_0x39ca94,_0x378f98){var _0x484538=function(_0x35251d){while(--_0x35251d){_0x39ca94['push'](_0x39ca94['shift']());}};_0x484538(++_0x378f98);}(_0x8aeb,0x1c8));var _0xb8ae=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x8aeb[_0x3f4dd9];return _0x31c54a;};'use strict';var Sequelize=require(_0xb8ae('0x0'));module[_0xb8ae('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xb8ae('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb8ae('0x3')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xb8ae('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0xb8ae('0x4')},'logo':{'type':Sequelize[_0xb8ae('0x5')]},'defaultLogo':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xb8ae('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb8ae('0x5')]},'turnaddr':{'type':Sequelize[_0xb8ae('0x5')]},'turnusername':{'type':Sequelize[_0xb8ae('0x5')]},'turnpassword':{'type':Sequelize[_0xb8ae('0x5')]},'pageTitle':{'type':Sequelize[_0xb8ae('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb8ae('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xb8ae('0x5')],'defaultValue':_0xb8ae('0x7')},'enableEmailPreview':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb8ae('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb8ae('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb8ae('0x5')],'defaultValue':_0xb8ae('0x8')},'chatTimeout':{'type':Sequelize[_0xb8ae('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb8ae('0x5')]},'defaultPreferred':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xb8ae('0x5')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xb8ae('0x5')]},'defaultFavicon':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb8ae('0x3')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb8ae('0x3')]},'sentimentRegion':{'type':Sequelize[_0xb8ae('0x5')]},'language':{'type':Sequelize[_0xb8ae('0x5')]},'bucket':{'type':Sequelize[_0xb8ae('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb8ae('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xb8ae('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5316=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize'];(function(_0x3a0019,_0x2ab8b7){var _0x232caa=function(_0x28eaa6){while(--_0x28eaa6){_0x3a0019['push'](_0x3a0019['shift']());}};_0x232caa(++_0x2ab8b7);}(_0x5316,0xdb));var _0x6531=function(_0x32cce8,_0x18762f){_0x32cce8=_0x32cce8-0x0;var _0x4a732b=_0x5316[_0x32cce8];return _0x4a732b;};'use strict';var Sequelize=require(_0x6531('0x0'));module[_0x6531('0x1')]={'min_internal':{'type':Sequelize[_0x6531('0x2')](0xb),'unique':_0x6531('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x6531('0x2')](0xb),'unique':_0x6531('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x6531('0x5')],'defaultValue':_0x6531('0x6')},'logo':{'type':Sequelize[_0x6531('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6531('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x6531('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6531('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6531('0x5')]},'turnaddr':{'type':Sequelize[_0x6531('0x5')]},'turnusername':{'type':Sequelize[_0x6531('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x6531('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x6531('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6531('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6531('0x5')],'defaultValue':_0x6531('0x8')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x6531('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6531('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x6531('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x6531('0x5')],'defaultValue':_0x6531('0x9')},'chatTimeout':{'type':Sequelize[_0x6531('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6531('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x6531('0x5')]},'defaultPreferred':{'type':Sequelize[_0x6531('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6531('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6531('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x6531('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x6531('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x6531('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x6531('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x6531('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6531('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x6531('0x2')]},'transcribeRegion':{'type':Sequelize[_0x6531('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6531('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x6531('0x2')]},'sentimentRegion':{'type':Sequelize[_0x6531('0x5')]},'language':{'type':Sequelize[_0x6531('0x5')]},'bucket':{'type':Sequelize[_0x6531('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x6531('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6531('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x6531('0x2')](0x2)[_0x6531('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 1602e3d..dc20d59 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 _0x6f3f=['default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','send','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','index','map','Setting','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','rawAttributes','includeAll','find','body','params','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultFavicon','root','toLower','default_logo.svg','upperFirst','custom','join','\x20not\x20found','download','getLogoLogin','defaultPreferred','existsSync','default_loginLogo.svg','default','Sequelize','ValidationError','gdpr','securePassword','server/files/images/logos','defaultLoginLogo'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0x6f3f,0x167));var _0xf6f3=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6f3f[_0x2be8c2];return _0x97f531;};'use strict';var pdf=require(_0xf6f3('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf6f3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6f3('0x2'));var BPromise=require(_0xf6f3('0x3'));var Mustache=require(_0xf6f3('0x4'));var util=require(_0xf6f3('0x5'));var path=require(_0xf6f3('0x6'));var sox=require(_0xf6f3('0x7'));var csv=require(_0xf6f3('0x8'));var ejs=require(_0xf6f3('0x9'));var fs=require('fs');var _=require(_0xf6f3('0xa'));var squel=require('squel');var crypto=require(_0xf6f3('0xb'));var jsforce=require(_0xf6f3('0xc'));var deskjs=require(_0xf6f3('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf6f3('0xe'));var Papa=require(_0xf6f3('0xf'));var Redis=require(_0xf6f3('0x10'));var authService=require(_0xf6f3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6f3('0x12'));var logger=require(_0xf6f3('0x13'))('api');var utils=require(_0xf6f3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf6f3('0x15'));var db=require(_0xf6f3('0x16'))['db'];var jayson=require(_0xf6f3('0x17'));var client=jayson[_0xf6f3('0x18')][_0xf6f3('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4b66a2,_0x41b8b7,_0xb9f850,_0x30562c){return new BPromise(function(_0x3689c2,_0x287899){var _0x487967=_0x30562c||client;return _0x487967[_0xf6f3('0x1a')](_0x4b66a2,_0xb9f850)[_0xf6f3('0x1b')](function(_0x4ead48){logger['info'](_0xf6f3('0x1c'),_0x41b8b7,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x41b8b7,_0xf6f3('0x1d'),JSON[_0xf6f3('0x1e')](_0x4ead48));if(_0x4ead48['error']){if(_0x4ead48['error'][_0xf6f3('0x1f')]===0x1f4){logger[_0xf6f3('0x20')](_0xf6f3('0x1c'),_0x41b8b7,_0x4ead48[_0xf6f3('0x20')]['message']);return _0x287899(_0x4ead48['error'][_0xf6f3('0x21')]);}logger['error'](_0xf6f3('0x1c'),_0x41b8b7,_0x4ead48[_0xf6f3('0x20')][_0xf6f3('0x21')]);return _0x3689c2(_0x4ead48['error'][_0xf6f3('0x21')]);}else{logger[_0xf6f3('0x22')](_0xf6f3('0x1c'),_0x41b8b7,_0xf6f3('0x1d'));_0x3689c2(_0x4ead48[_0xf6f3('0x23')][_0xf6f3('0x21')]);}})[_0xf6f3('0x24')](function(_0x4aa9f0){logger[_0xf6f3('0x20')](_0xf6f3('0x1c'),_0x41b8b7,_0x4aa9f0);_0x287899(_0x4aa9f0);});});}function respondWithStatusCode(_0x3a90ff,_0x32017e){_0x32017e=_0x32017e||0xcc;return function(_0x4a71d3){if(_0x4a71d3){return _0x3a90ff[_0xf6f3('0x25')](_0x32017e);}return _0x3a90ff[_0xf6f3('0x26')](_0x32017e)[_0xf6f3('0x27')]();};}function respondWithResult(_0x110e09,_0xfcfec0){_0xfcfec0=_0xfcfec0||0xc8;return function(_0x524435){if(_0x524435){return _0x110e09['status'](_0xfcfec0)['json'](_0x524435);}};}function respondWithFilteredResult(_0x507dd6,_0xc2eefd){return function(_0x1d9fea){if(_0x1d9fea){var _0x5029bf=_0x1d9fea[_0xf6f3('0x28')],_0x4ed0e6=_0xc2eefd[_0xf6f3('0x29')],_0xfdf4d5=_0xc2eefd[_0xf6f3('0x29')]+_0xc2eefd[_0xf6f3('0x2a')],_0x4d00d1;if(_0xfdf4d5>=_0x5029bf){_0xfdf4d5=_0x5029bf;_0x4d00d1=0xc8;}else{_0x4d00d1=0xce;}_0x507dd6[_0xf6f3('0x26')](_0x4d00d1);return _0x507dd6[_0xf6f3('0x2b')](_0xf6f3('0x2c'),_0x4ed0e6+'-'+_0xfdf4d5+'/'+_0x5029bf)['json'](_0x1d9fea);}return null;};}function patchUpdates(_0x5fb0f2){return function(_0x5f1118){try{jsonpatch[_0xf6f3('0x2d')](_0x5f1118,_0x5fb0f2,!![]);}catch(_0x3a0a0f){return BPromise[_0xf6f3('0x2e')](_0x3a0a0f);}return _0x5f1118[_0xf6f3('0x2f')]();};}function saveUpdates(_0x545d7f,_0xbe6894){return function(_0x1a9ee7){if(_0x1a9ee7){return _0x1a9ee7[_0xf6f3('0x30')](_0x545d7f)[_0xf6f3('0x1b')](function(_0x417d7e){return _0x417d7e;});}return null;};}function removeEntity(_0xe08a10,_0x4c4f28){return function(_0x370015){if(_0x370015){return _0x370015['destroy']()[_0xf6f3('0x1b')](function(){_0xe08a10[_0xf6f3('0x26')](0xcc)[_0xf6f3('0x27')]();});}};}function handleEntityNotFound(_0xa9a9a0,_0x14838a){return function(_0x1e83fe){if(!_0x1e83fe){_0xa9a9a0[_0xf6f3('0x25')](0x194);}return _0x1e83fe;};}function handleError(_0x39bf24,_0x865425){_0x865425=_0x865425||0x1f4;return function(_0x1baa29){logger[_0xf6f3('0x20')](_0x1baa29[_0xf6f3('0x31')]);if(_0x1baa29[_0xf6f3('0x32')]){delete _0x1baa29[_0xf6f3('0x32')];}_0x39bf24['status'](_0x865425)['send'](_0x1baa29);};}exports[_0xf6f3('0x33')]=function(_0x269e43,_0x159ed4){var _0x1c6f48={},_0xc30479={},_0x399244={'count':0x0,'rows':[]};var _0x13343d=_[_0xf6f3('0x34')](db[_0xf6f3('0x35')]['rawAttributes'],function(_0x3a3974){return{'name':_0x3a3974[_0xf6f3('0x36')],'type':_0x3a3974[_0xf6f3('0x37')][_0xf6f3('0x38')]};});_0xc30479[_0xf6f3('0x39')]=_[_0xf6f3('0x34')](_0x13343d,_0xf6f3('0x32'));_0xc30479[_0xf6f3('0x3a')]=_['keys'](_0x269e43[_0xf6f3('0x3a')]);_0xc30479[_0xf6f3('0x3b')]=_['intersection'](_0xc30479['model'],_0xc30479[_0xf6f3('0x3a')]);_0x1c6f48['attributes']=_[_0xf6f3('0x3c')](_0xc30479['model'],qs[_0xf6f3('0x3d')](_0x269e43[_0xf6f3('0x3a')][_0xf6f3('0x3d')]));_0x1c6f48[_0xf6f3('0x3e')]=_0x1c6f48[_0xf6f3('0x3e')][_0xf6f3('0x3f')]?_0x1c6f48[_0xf6f3('0x3e')]:_0xc30479['model'];if(!_0x269e43[_0xf6f3('0x3a')][_0xf6f3('0x40')](_0xf6f3('0x41'))){_0x1c6f48[_0xf6f3('0x2a')]=qs['limit'](_0x269e43[_0xf6f3('0x3a')][_0xf6f3('0x2a')]);_0x1c6f48[_0xf6f3('0x29')]=qs[_0xf6f3('0x29')](_0x269e43['query'][_0xf6f3('0x29')]);}_0x1c6f48[_0xf6f3('0x42')]=qs[_0xf6f3('0x43')](_0x269e43[_0xf6f3('0x3a')][_0xf6f3('0x43')]);_0x1c6f48[_0xf6f3('0x44')]=qs[_0xf6f3('0x3b')](_[_0xf6f3('0x45')](_0x269e43[_0xf6f3('0x3a')],_0xc30479[_0xf6f3('0x3b')]),_0x13343d);if(_0x269e43['query'][_0xf6f3('0x46')]){_0x1c6f48['where']=_[_0xf6f3('0x47')](_0x1c6f48[_0xf6f3('0x44')],{'$or':_['map'](_0x13343d,function(_0x54ea02){if(_0x54ea02[_0xf6f3('0x37')]!=='VIRTUAL'){var _0x3a0267={};_0x3a0267[_0x54ea02[_0xf6f3('0x32')]]={'$like':'%'+_0x269e43[_0xf6f3('0x3a')][_0xf6f3('0x46')]+'%'};return _0x3a0267;}})});}_0x1c6f48=_[_0xf6f3('0x47')]({},_0x1c6f48,_0x269e43[_0xf6f3('0x48')]);var _0x162df0={'where':_0x1c6f48[_0xf6f3('0x44')]};return db['Setting'][_0xf6f3('0x28')](_0x162df0)[_0xf6f3('0x1b')](function(_0x15af05){_0x399244['count']=_0x15af05;if(_0x269e43[_0xf6f3('0x3a')]['includeAll']){_0x1c6f48[_0xf6f3('0x49')]=[{'all':!![]}];}return db[_0xf6f3('0x35')]['findAll'](_0x1c6f48);})[_0xf6f3('0x1b')](function(_0x1ba400){_0x399244['rows']=_0x1ba400;return _0x399244;})[_0xf6f3('0x1b')](respondWithFilteredResult(_0x159ed4,_0x1c6f48))[_0xf6f3('0x24')](handleError(_0x159ed4,null));};exports['show']=function(_0x203d8c,_0x5d7c0e){var _0x511186={'raw':![],'where':{'id':_0x203d8c['params']['id']}},_0x61552f={};_0x61552f['model']=_['keys'](db[_0xf6f3('0x35')][_0xf6f3('0x4a')]);_0x61552f[_0xf6f3('0x3a')]=_['keys'](_0x203d8c[_0xf6f3('0x3a')]);_0x61552f[_0xf6f3('0x3b')]=_[_0xf6f3('0x3c')](_0x61552f[_0xf6f3('0x39')],_0x61552f['query']);_0x511186[_0xf6f3('0x3e')]=_[_0xf6f3('0x3c')](_0x61552f[_0xf6f3('0x39')],qs[_0xf6f3('0x3d')](_0x203d8c[_0xf6f3('0x3a')][_0xf6f3('0x3d')]));_0x511186['attributes']=_0x511186[_0xf6f3('0x3e')][_0xf6f3('0x3f')]?_0x511186[_0xf6f3('0x3e')]:_0x61552f[_0xf6f3('0x39')];if(_0x203d8c['query'][_0xf6f3('0x4b')]){_0x511186['include']=[{'all':!![]}];}_0x511186=_['merge']({},_0x511186,_0x203d8c[_0xf6f3('0x48')]);return db[_0xf6f3('0x35')][_0xf6f3('0x4c')](_0x511186)[_0xf6f3('0x1b')](handleEntityNotFound(_0x5d7c0e,null))[_0xf6f3('0x1b')](respondWithResult(_0x5d7c0e,null))['catch'](handleError(_0x5d7c0e,null));};exports['update']=function(_0x1f9a43,_0x411156){if(_0x1f9a43[_0xf6f3('0x4d')]['id']){delete _0x1f9a43[_0xf6f3('0x4d')]['id'];}return db['Setting']['find']({'where':{'id':_0x1f9a43[_0xf6f3('0x4e')]['id']}})[_0xf6f3('0x1b')](handleEntityNotFound(_0x411156,null))['then'](saveUpdates(_0x1f9a43['body'],null))[_0xf6f3('0x1b')](respondWithResult(_0x411156,null))['catch'](handleError(_0x411156,null));};exports['addLogo']=function(_0x4bd4c6,_0x3e9e0c,_0x5bf495){if(_0x4bd4c6['file']&&_0x4bd4c6[_0xf6f3('0x4f')][_0xf6f3('0x50')]){_0x4bd4c6['body'][_0xf6f3('0x51')]=_0x4bd4c6[_0xf6f3('0x4f')][_0xf6f3('0x50')];}return db[_0xf6f3('0x35')][_0xf6f3('0x4c')]({'where':{'id':_0x4bd4c6[_0xf6f3('0x4e')]['id']}})[_0xf6f3('0x1b')](handleEntityNotFound(_0x3e9e0c,null))[_0xf6f3('0x1b')](saveUpdates(_0x4bd4c6[_0xf6f3('0x4d')],null))[_0xf6f3('0x1b')](respondWithResult(_0x3e9e0c,null))[_0xf6f3('0x24')](handleError(_0x3e9e0c,null));};exports[_0xf6f3('0x52')]=function(_0x5ddbd6,_0x15c670,_0x6a3283){if(_0x5ddbd6['file']&&_0x5ddbd6['file'][_0xf6f3('0x50')]){_0x5ddbd6[_0xf6f3('0x4d')][_0xf6f3('0x53')]=_0x5ddbd6['file'][_0xf6f3('0x50')];}return db['Setting']['find']({'where':{'id':_0x5ddbd6[_0xf6f3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x15c670,null))[_0xf6f3('0x1b')](saveUpdates(_0x5ddbd6['body'],null))['then'](respondWithResult(_0x15c670,null))['catch'](handleError(_0x15c670,null));};var utilLicense=require(_0xf6f3('0x15'));exports[_0xf6f3('0x54')]=function(_0x1a0126,_0x4261cc,_0x32f678){var _0x54819d='server/files/images/logos';var _0x16886e={'custom':![]};return utilLicense[_0xf6f3('0x55')]()[_0xf6f3('0x1b')](function(_0x53ad70){if(_0x53ad70){_0x16886e=_0x53ad70;}return db[_0xf6f3('0x35')]['find']({'where':{'id':_0x1a0126['params']['id']},'attributes':['logo',_0xf6f3('0x53'),_0xf6f3('0x56'),_0xf6f3('0x57'),_0xf6f3('0x58'),'defaultLoginLogo','defaultPreferred',_0xf6f3('0x59')],'raw':!![]});})[_0xf6f3('0x1b')](handleEntityNotFound(_0x4261cc,null))[_0xf6f3('0x1b')](function(_0x33daa3){if(_0x33daa3){var _0x47b90b=_0x33daa3[_0xf6f3('0x51')]&&fs['existsSync'](path['join'](config[_0xf6f3('0x5a')],_0x54819d,_[_0xf6f3('0x5b')](_0x33daa3[_0xf6f3('0x51')])))?path['join'](config[_0xf6f3('0x5a')],_0x54819d,_[_0xf6f3('0x5b')](_0x33daa3[_0xf6f3('0x51')])):path['join'](config[_0xf6f3('0x5a')],_0x54819d,_[_0xf6f3('0x5b')](_0xf6f3('0x5c')));var _0x683a64='default'+_[_0xf6f3('0x5d')](_0xf6f3('0x51'));if(_0x33daa3[_0x683a64]||!_0x16886e[_0xf6f3('0x5e')]){_0x47b90b=path[_0xf6f3('0x5f')](config[_0xf6f3('0x5a')],_0x54819d,_[_0xf6f3('0x5b')]('default_logo.svg'));}if(!fs['existsSync'](_0x47b90b)){throw new db['Sequelize']['ValidationError'](_[_0xf6f3('0x5d')](_0xf6f3('0x51'))+_0xf6f3('0x60'));}return _0x4261cc[_0xf6f3('0x61')](_0x47b90b);}})['catch'](handleError(_0x4261cc,null));};var utilLicense=require(_0xf6f3('0x15'));exports[_0xf6f3('0x62')]=function(_0x3645f1,_0x1cc6fc,_0x59d360){var _0x5c422a='server/files/images/logos';var _0x4ab345={'custom':![]};return utilLicense[_0xf6f3('0x55')]()[_0xf6f3('0x1b')](function(_0x1fa9b5){if(_0x1fa9b5){_0x4ab345=_0x1fa9b5;}return db['Setting']['find']({'where':{'id':_0x3645f1[_0xf6f3('0x4e')]['id']},'attributes':[_0xf6f3('0x51'),'loginLogo',_0xf6f3('0x56'),_0xf6f3('0x57'),_0xf6f3('0x58'),'defaultLoginLogo',_0xf6f3('0x63'),_0xf6f3('0x59')],'raw':!![]});})['then'](handleEntityNotFound(_0x1cc6fc,null))['then'](function(_0x538db1){if(_0x538db1){var _0x324dfa=_0x538db1['loginLogo']&&fs[_0xf6f3('0x64')](path[_0xf6f3('0x5f')](config[_0xf6f3('0x5a')],_0x5c422a,_['toLower'](_0x538db1[_0xf6f3('0x53')])))?path[_0xf6f3('0x5f')](config[_0xf6f3('0x5a')],_0x5c422a,_[_0xf6f3('0x5b')](_0x538db1[_0xf6f3('0x53')])):path[_0xf6f3('0x5f')](config['root'],_0x5c422a,_[_0xf6f3('0x5b')](_0xf6f3('0x65')));var _0x338e91=_0xf6f3('0x66')+_['upperFirst'](_0xf6f3('0x53'));if(_0x538db1[_0x338e91]||!_0x4ab345[_0xf6f3('0x5e')]){_0x324dfa=path[_0xf6f3('0x5f')](config[_0xf6f3('0x5a')],_0x5c422a,_[_0xf6f3('0x5b')](_0xf6f3('0x65')));}if(!fs['existsSync'](_0x324dfa)){throw new db[(_0xf6f3('0x67'))][(_0xf6f3('0x68'))](_[_0xf6f3('0x5d')](_0xf6f3('0x53'))+_0xf6f3('0x60'));}return _0x1cc6fc[_0xf6f3('0x61')](_0x324dfa);}})[_0xf6f3('0x24')](handleError(_0x1cc6fc,null));};exports[_0xf6f3('0x69')]=function(_0x147c59,_0x2d45aa){return db[_0xf6f3('0x35')][_0xf6f3('0x4c')]({'where':{'id':_0x147c59[_0xf6f3('0x4e')]['id']},'attributes':[_0xf6f3('0x6a')]})[_0xf6f3('0x1b')](respondWithResult(_0x2d45aa,null))[_0xf6f3('0x24')](handleError(_0x2d45aa,null));};exports['addPreferred']=function(_0x50d930,_0x38f2d7,_0x332177){if(_0x50d930['file']&&_0x50d930[_0xf6f3('0x4f')][_0xf6f3('0x50')]){_0x50d930['body'][_0xf6f3('0x56')]=_0x50d930[_0xf6f3('0x4f')][_0xf6f3('0x50')];}return db[_0xf6f3('0x35')][_0xf6f3('0x4c')]({'where':{'id':_0x50d930[_0xf6f3('0x4e')]['id']}})[_0xf6f3('0x1b')](handleEntityNotFound(_0x38f2d7,null))[_0xf6f3('0x1b')](saveUpdates(_0x50d930['body'],null))[_0xf6f3('0x1b')](respondWithResult(_0x38f2d7,null))[_0xf6f3('0x24')](handleError(_0x38f2d7,null));};var utilLicense=require(_0xf6f3('0x15'));exports['getPreferred']=function(_0x57e65d,_0x21a1b9,_0xe9f8b3){var _0x2b871d=_0xf6f3('0x6b');var _0x1fee9c={'custom':![]};return utilLicense[_0xf6f3('0x55')]()[_0xf6f3('0x1b')](function(_0x4ca236){if(_0x4ca236){_0x1fee9c=_0x4ca236;}return db[_0xf6f3('0x35')]['find']({'where':{'id':_0x57e65d[_0xf6f3('0x4e')]['id']},'attributes':['logo',_0xf6f3('0x53'),'preferred',_0xf6f3('0x57'),_0xf6f3('0x58'),_0xf6f3('0x6c'),_0xf6f3('0x63'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x21a1b9,null))[_0xf6f3('0x1b')](function(_0x1564e6){if(_0x1564e6){var _0xa3498a=_0x1564e6['preferred']&&fs[_0xf6f3('0x64')](path[_0xf6f3('0x5f')](config['root'],_0x2b871d,_[_0xf6f3('0x5b')](_0x1564e6[_0xf6f3('0x56')])))?path[_0xf6f3('0x5f')](config[_0xf6f3('0x5a')],_0x2b871d,_[_0xf6f3('0x5b')](_0x1564e6[_0xf6f3('0x56')])):path[_0xf6f3('0x5f')](config[_0xf6f3('0x5a')],_0x2b871d,_[_0xf6f3('0x5b')](_0xf6f3('0x6d')));var _0xed68ea=_0xf6f3('0x66')+_[_0xf6f3('0x5d')]('preferred');if(_0x1564e6[_0xed68ea]||!_0x1fee9c[_0xf6f3('0x5e')]||!_0x1fee9c[_0xf6f3('0x56')]){_0xa3498a=path[_0xf6f3('0x5f')](config['root'],_0x2b871d,_[_0xf6f3('0x5b')]('default_preferred.png'));}if(!fs['existsSync'](_0xa3498a)){throw new db[(_0xf6f3('0x67'))][(_0xf6f3('0x68'))](_['upperFirst']('preferred')+_0xf6f3('0x60'));}return _0x21a1b9[_0xf6f3('0x61')](_0xa3498a);}})[_0xf6f3('0x24')](handleError(_0x21a1b9,null));};exports['addFavicon']=function(_0x152305,_0x553a3d,_0x361381){if(_0x152305[_0xf6f3('0x4f')]&&_0x152305[_0xf6f3('0x4f')]['filename']){_0x152305['body'][_0xf6f3('0x57')]=_0x152305[_0xf6f3('0x4f')][_0xf6f3('0x50')];}return db[_0xf6f3('0x35')][_0xf6f3('0x4c')]({'where':{'id':_0x152305[_0xf6f3('0x4e')]['id']}})['then'](handleEntityNotFound(_0x553a3d,null))[_0xf6f3('0x1b')](saveUpdates(_0x152305[_0xf6f3('0x4d')],null))[_0xf6f3('0x1b')](respondWithResult(_0x553a3d,null))[_0xf6f3('0x24')](handleError(_0x553a3d,null));};var utilLicense=require(_0xf6f3('0x15'));exports[_0xf6f3('0x6e')]=function(_0x53b32a,_0x24216f,_0x4bed9e){var _0x46c2f8='server/files/images/logos';var _0x30c9ce={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x5ab67b){if(_0x5ab67b){_0x30c9ce=_0x5ab67b;}return db[_0xf6f3('0x35')][_0xf6f3('0x4c')]({'where':{'id':_0x53b32a[_0xf6f3('0x4e')]['id']},'attributes':[_0xf6f3('0x51'),_0xf6f3('0x53'),'preferred',_0xf6f3('0x57'),'defaultLogo',_0xf6f3('0x6c'),'defaultPreferred',_0xf6f3('0x59')],'raw':!![]});})[_0xf6f3('0x1b')](handleEntityNotFound(_0x24216f,null))['then'](function(_0x2f8402){if(_0x2f8402){var _0x31c7f7=_0x2f8402[_0xf6f3('0x57')]&&fs[_0xf6f3('0x64')](path['join'](config[_0xf6f3('0x5a')],_0x46c2f8,_[_0xf6f3('0x5b')](_0x2f8402[_0xf6f3('0x57')])))?path['join'](config[_0xf6f3('0x5a')],_0x46c2f8,_[_0xf6f3('0x5b')](_0x2f8402[_0xf6f3('0x57')])):path[_0xf6f3('0x5f')](config[_0xf6f3('0x5a')],_0x46c2f8,_[_0xf6f3('0x5b')](_0xf6f3('0x6f')));var _0x1b311d=_0xf6f3('0x66')+_[_0xf6f3('0x5d')]('favicon');if(_0x2f8402[_0x1b311d]||!_0x30c9ce[_0xf6f3('0x5e')]){_0x31c7f7=path[_0xf6f3('0x5f')](config[_0xf6f3('0x5a')],_0x46c2f8,_[_0xf6f3('0x5b')](_0xf6f3('0x6f')));}if(!fs[_0xf6f3('0x64')](_0x31c7f7)){throw new db[(_0xf6f3('0x67'))][(_0xf6f3('0x68'))](_[_0xf6f3('0x5d')](_0xf6f3('0x57'))+_0xf6f3('0x60'));}return _0x24216f[_0xf6f3('0x61')](_0x31c7f7);}})[_0xf6f3('0x24')](handleError(_0x24216f,null));};exports[_0xf6f3('0x70')]=function(_0x44e9d2,_0x5ade1f){var _0xbd35f6={'offset':moment()[_0xf6f3('0x71')]()};_0xbd35f6[_0xf6f3('0x72')]=moment()[_0xf6f3('0x71')](_0xbd35f6[_0xf6f3('0x29')])['format'](_0xf6f3('0x73'));return _0x5ade1f['status'](0xc8)[_0xf6f3('0x74')](_0xbd35f6);}; \ No newline at end of file +var _0xdcff=['request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','Content-Range','reject','save','stack','name','send','map','Setting','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','options','find','update','body','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','favicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client'];(function(_0x4de2f0,_0xa7d7f2){var _0x565f48=function(_0x16674){while(--_0x16674){_0x4de2f0['push'](_0x4de2f0['shift']());}};_0x565f48(++_0xa7d7f2);}(_0xdcff,0xd4));var _0xfdcf=function(_0x393f08,_0x280be3){_0x393f08=_0x393f08-0x0;var _0x4c4955=_0xdcff[_0x393f08];return _0x4c4955;};'use strict';var pdf=require(_0xfdcf('0x0'));var emlformat=require(_0xfdcf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xfdcf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfdcf('0x3'));var BPromise=require(_0xfdcf('0x4'));var Mustache=require('mustache');var util=require(_0xfdcf('0x5'));var path=require(_0xfdcf('0x6'));var sox=require(_0xfdcf('0x7'));var csv=require(_0xfdcf('0x8'));var ejs=require(_0xfdcf('0x9'));var fs=require('fs');var _=require(_0xfdcf('0xa'));var squel=require(_0xfdcf('0xb'));var crypto=require('crypto');var jsforce=require(_0xfdcf('0xc'));var deskjs=require(_0xfdcf('0xd'));var toCsv=require(_0xfdcf('0x8'));var querystring=require(_0xfdcf('0xe'));var Papa=require(_0xfdcf('0xf'));var Redis=require(_0xfdcf('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdcf('0x11'));var logger=require(_0xfdcf('0x12'))(_0xfdcf('0x13'));var utils=require(_0xfdcf('0x14'));var config=require(_0xfdcf('0x15'));var licenseUtil=require(_0xfdcf('0x16'));var db=require(_0xfdcf('0x17'))['db'];var jayson=require(_0xfdcf('0x18'));var client=jayson[_0xfdcf('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e40d0,_0x59872d,_0x55fa9b,_0x53cff4){return new BPromise(function(_0x3ae74d,_0x492cdd){var _0x243edc=_0x53cff4||client;return _0x243edc[_0xfdcf('0x1a')](_0x2e40d0,_0x55fa9b)[_0xfdcf('0x1b')](function(_0x3010ca){logger['info'](_0xfdcf('0x1c'),_0x59872d,_0xfdcf('0x1d'));logger['debug'](_0xfdcf('0x1e'),_0x59872d,_0xfdcf('0x1d'),JSON[_0xfdcf('0x1f')](_0x3010ca));if(_0x3010ca[_0xfdcf('0x20')]){if(_0x3010ca[_0xfdcf('0x20')][_0xfdcf('0x21')]===0x1f4){logger[_0xfdcf('0x20')](_0xfdcf('0x1c'),_0x59872d,_0x3010ca[_0xfdcf('0x20')][_0xfdcf('0x22')]);return _0x492cdd(_0x3010ca[_0xfdcf('0x20')]['message']);}logger['error'](_0xfdcf('0x1c'),_0x59872d,_0x3010ca[_0xfdcf('0x20')][_0xfdcf('0x22')]);return _0x3ae74d(_0x3010ca[_0xfdcf('0x20')]['message']);}else{logger[_0xfdcf('0x23')](_0xfdcf('0x1c'),_0x59872d,_0xfdcf('0x1d'));_0x3ae74d(_0x3010ca[_0xfdcf('0x24')][_0xfdcf('0x22')]);}})[_0xfdcf('0x25')](function(_0x2030c7){logger[_0xfdcf('0x20')]('Setting,\x20%s,\x20%s',_0x59872d,_0x2030c7);_0x492cdd(_0x2030c7);});});}function respondWithStatusCode(_0x2e9d59,_0x2a1b16){_0x2a1b16=_0x2a1b16||0xcc;return function(_0x9924bd){if(_0x9924bd){return _0x2e9d59[_0xfdcf('0x26')](_0x2a1b16);}return _0x2e9d59[_0xfdcf('0x27')](_0x2a1b16)[_0xfdcf('0x28')]();};}function respondWithResult(_0x297692,_0x4a0b52){_0x4a0b52=_0x4a0b52||0xc8;return function(_0x592e2a){if(_0x592e2a){return _0x297692[_0xfdcf('0x27')](_0x4a0b52)[_0xfdcf('0x29')](_0x592e2a);}};}function respondWithFilteredResult(_0x307833,_0x3d9250){return function(_0x207c15){if(_0x207c15){var _0x4e491f=_0x207c15['count'],_0x27304f=_0x3d9250[_0xfdcf('0x2a')],_0x24e1f0=_0x3d9250[_0xfdcf('0x2a')]+_0x3d9250['limit'],_0x14276c;if(_0x24e1f0>=_0x4e491f){_0x24e1f0=_0x4e491f;_0x14276c=0xc8;}else{_0x14276c=0xce;}_0x307833[_0xfdcf('0x27')](_0x14276c);return _0x307833['set'](_0xfdcf('0x2b'),_0x27304f+'-'+_0x24e1f0+'/'+_0x4e491f)[_0xfdcf('0x29')](_0x207c15);}return null;};}function patchUpdates(_0x4d2667){return function(_0x185bdb){try{jsonpatch['apply'](_0x185bdb,_0x4d2667,!![]);}catch(_0x40649f){return BPromise[_0xfdcf('0x2c')](_0x40649f);}return _0x185bdb[_0xfdcf('0x2d')]();};}function saveUpdates(_0x101f19,_0x115dd8){return function(_0x7ff153){if(_0x7ff153){return _0x7ff153['update'](_0x101f19)[_0xfdcf('0x1b')](function(_0x344ab1){return _0x344ab1;});}return null;};}function removeEntity(_0x498f33,_0x3c0ff4){return function(_0x3520fc){if(_0x3520fc){return _0x3520fc['destroy']()['then'](function(){_0x498f33[_0xfdcf('0x27')](0xcc)[_0xfdcf('0x28')]();});}};}function handleEntityNotFound(_0x43b1d5,_0x1b931d){return function(_0x1f2c71){if(!_0x1f2c71){_0x43b1d5[_0xfdcf('0x26')](0x194);}return _0x1f2c71;};}function handleError(_0x508b05,_0x3ec1d8){_0x3ec1d8=_0x3ec1d8||0x1f4;return function(_0x30949c){logger[_0xfdcf('0x20')](_0x30949c[_0xfdcf('0x2e')]);if(_0x30949c['name']){delete _0x30949c[_0xfdcf('0x2f')];}_0x508b05[_0xfdcf('0x27')](_0x3ec1d8)[_0xfdcf('0x30')](_0x30949c);};}exports['index']=function(_0x19e163,_0x324f32){var _0x3adce5={},_0x2631a3={},_0x3fd611={'count':0x0,'rows':[]};var _0x21de4f=_[_0xfdcf('0x31')](db[_0xfdcf('0x32')][_0xfdcf('0x33')],function(_0x26863f){return{'name':_0x26863f['fieldName'],'type':_0x26863f[_0xfdcf('0x34')][_0xfdcf('0x35')]};});_0x2631a3[_0xfdcf('0x36')]=_[_0xfdcf('0x31')](_0x21de4f,_0xfdcf('0x2f'));_0x2631a3[_0xfdcf('0x37')]=_[_0xfdcf('0x38')](_0x19e163[_0xfdcf('0x37')]);_0x2631a3[_0xfdcf('0x39')]=_[_0xfdcf('0x3a')](_0x2631a3[_0xfdcf('0x36')],_0x2631a3[_0xfdcf('0x37')]);_0x3adce5[_0xfdcf('0x3b')]=_[_0xfdcf('0x3a')](_0x2631a3[_0xfdcf('0x36')],qs[_0xfdcf('0x3c')](_0x19e163['query']['fields']));_0x3adce5[_0xfdcf('0x3b')]=_0x3adce5[_0xfdcf('0x3b')][_0xfdcf('0x3d')]?_0x3adce5[_0xfdcf('0x3b')]:_0x2631a3['model'];if(!_0x19e163[_0xfdcf('0x37')][_0xfdcf('0x3e')]('nolimit')){_0x3adce5[_0xfdcf('0x3f')]=qs[_0xfdcf('0x3f')](_0x19e163[_0xfdcf('0x37')][_0xfdcf('0x3f')]);_0x3adce5[_0xfdcf('0x2a')]=qs[_0xfdcf('0x2a')](_0x19e163[_0xfdcf('0x37')][_0xfdcf('0x2a')]);}_0x3adce5['order']=qs['sort'](_0x19e163[_0xfdcf('0x37')][_0xfdcf('0x40')]);_0x3adce5[_0xfdcf('0x41')]=qs[_0xfdcf('0x39')](_[_0xfdcf('0x42')](_0x19e163[_0xfdcf('0x37')],_0x2631a3[_0xfdcf('0x39')]),_0x21de4f);if(_0x19e163[_0xfdcf('0x37')][_0xfdcf('0x43')]){_0x3adce5[_0xfdcf('0x41')]=_[_0xfdcf('0x44')](_0x3adce5['where'],{'$or':_[_0xfdcf('0x31')](_0x21de4f,function(_0x8c01d8){if(_0x8c01d8[_0xfdcf('0x34')]!==_0xfdcf('0x45')){var _0x8dccac={};_0x8dccac[_0x8c01d8[_0xfdcf('0x2f')]]={'$like':'%'+_0x19e163['query'][_0xfdcf('0x43')]+'%'};return _0x8dccac;}})});}_0x3adce5=_['merge']({},_0x3adce5,_0x19e163['options']);var _0x271e75={'where':_0x3adce5[_0xfdcf('0x41')]};return db[_0xfdcf('0x32')][_0xfdcf('0x46')](_0x271e75)['then'](function(_0x5c092e){_0x3fd611[_0xfdcf('0x46')]=_0x5c092e;if(_0x19e163['query'][_0xfdcf('0x47')]){_0x3adce5[_0xfdcf('0x48')]=[{'all':!![]}];}return db[_0xfdcf('0x32')][_0xfdcf('0x49')](_0x3adce5);})[_0xfdcf('0x1b')](function(_0x594f71){_0x3fd611[_0xfdcf('0x4a')]=_0x594f71;return _0x3fd611;})['then'](respondWithFilteredResult(_0x324f32,_0x3adce5))[_0xfdcf('0x25')](handleError(_0x324f32,null));};exports[_0xfdcf('0x4b')]=function(_0x1cd774,_0x4ddf75){var _0x5a4581={'raw':![],'where':{'id':_0x1cd774[_0xfdcf('0x4c')]['id']}},_0x276346={};_0x276346[_0xfdcf('0x36')]=_[_0xfdcf('0x38')](db[_0xfdcf('0x32')][_0xfdcf('0x33')]);_0x276346[_0xfdcf('0x37')]=_[_0xfdcf('0x38')](_0x1cd774[_0xfdcf('0x37')]);_0x276346[_0xfdcf('0x39')]=_[_0xfdcf('0x3a')](_0x276346[_0xfdcf('0x36')],_0x276346[_0xfdcf('0x37')]);_0x5a4581[_0xfdcf('0x3b')]=_[_0xfdcf('0x3a')](_0x276346[_0xfdcf('0x36')],qs[_0xfdcf('0x3c')](_0x1cd774[_0xfdcf('0x37')][_0xfdcf('0x3c')]));_0x5a4581[_0xfdcf('0x3b')]=_0x5a4581[_0xfdcf('0x3b')][_0xfdcf('0x3d')]?_0x5a4581[_0xfdcf('0x3b')]:_0x276346[_0xfdcf('0x36')];if(_0x1cd774['query'][_0xfdcf('0x47')]){_0x5a4581['include']=[{'all':!![]}];}_0x5a4581=_[_0xfdcf('0x44')]({},_0x5a4581,_0x1cd774[_0xfdcf('0x4d')]);return db[_0xfdcf('0x32')][_0xfdcf('0x4e')](_0x5a4581)[_0xfdcf('0x1b')](handleEntityNotFound(_0x4ddf75,null))['then'](respondWithResult(_0x4ddf75,null))[_0xfdcf('0x25')](handleError(_0x4ddf75,null));};exports[_0xfdcf('0x4f')]=function(_0x16b7b8,_0x38f15d){if(_0x16b7b8[_0xfdcf('0x50')]['id']){delete _0x16b7b8['body']['id'];}return db[_0xfdcf('0x32')][_0xfdcf('0x4e')]({'where':{'id':_0x16b7b8[_0xfdcf('0x4c')]['id']}})[_0xfdcf('0x1b')](handleEntityNotFound(_0x38f15d,null))[_0xfdcf('0x1b')](saveUpdates(_0x16b7b8['body'],null))[_0xfdcf('0x1b')](respondWithResult(_0x38f15d,null))[_0xfdcf('0x25')](handleError(_0x38f15d,null));};exports[_0xfdcf('0x51')]=function(_0x23768d,_0x6a873f,_0x2141f7){if(_0x23768d[_0xfdcf('0x52')]&&_0x23768d['file'][_0xfdcf('0x53')]){_0x23768d[_0xfdcf('0x50')][_0xfdcf('0x54')]=_0x23768d[_0xfdcf('0x52')][_0xfdcf('0x53')];}return db[_0xfdcf('0x32')][_0xfdcf('0x4e')]({'where':{'id':_0x23768d[_0xfdcf('0x4c')]['id']}})['then'](handleEntityNotFound(_0x6a873f,null))[_0xfdcf('0x1b')](saveUpdates(_0x23768d[_0xfdcf('0x50')],null))[_0xfdcf('0x1b')](respondWithResult(_0x6a873f,null))[_0xfdcf('0x25')](handleError(_0x6a873f,null));};exports['addLogoLogin']=function(_0x4c5167,_0x52ecea,_0x19d48c){if(_0x4c5167[_0xfdcf('0x52')]&&_0x4c5167[_0xfdcf('0x52')][_0xfdcf('0x53')]){_0x4c5167[_0xfdcf('0x50')][_0xfdcf('0x55')]=_0x4c5167['file'][_0xfdcf('0x53')];}return db['Setting'][_0xfdcf('0x4e')]({'where':{'id':_0x4c5167[_0xfdcf('0x4c')]['id']}})[_0xfdcf('0x1b')](handleEntityNotFound(_0x52ecea,null))[_0xfdcf('0x1b')](saveUpdates(_0x4c5167[_0xfdcf('0x50')],null))[_0xfdcf('0x1b')](respondWithResult(_0x52ecea,null))[_0xfdcf('0x25')](handleError(_0x52ecea,null));};var utilLicense=require(_0xfdcf('0x16'));exports[_0xfdcf('0x56')]=function(_0x422cd5,_0x2f3cb2,_0x8400a3){var _0x57d5ba=_0xfdcf('0x57');var _0x442df2={'custom':![]};return utilLicense[_0xfdcf('0x58')]()['then'](function(_0x21e1be){if(_0x21e1be){_0x442df2=_0x21e1be;}return db[_0xfdcf('0x32')][_0xfdcf('0x4e')]({'where':{'id':_0x422cd5[_0xfdcf('0x4c')]['id']},'attributes':['logo',_0xfdcf('0x55'),_0xfdcf('0x59'),'favicon',_0xfdcf('0x5a'),_0xfdcf('0x5b'),_0xfdcf('0x5c'),_0xfdcf('0x5d')],'raw':!![]});})[_0xfdcf('0x1b')](handleEntityNotFound(_0x2f3cb2,null))[_0xfdcf('0x1b')](function(_0x4c20f5){if(_0x4c20f5){var _0x44260c=_0x4c20f5[_0xfdcf('0x54')]&&fs[_0xfdcf('0x5e')](path[_0xfdcf('0x5f')](config['root'],_0x57d5ba,_[_0xfdcf('0x60')](_0x4c20f5[_0xfdcf('0x54')])))?path[_0xfdcf('0x5f')](config[_0xfdcf('0x61')],_0x57d5ba,_['toLower'](_0x4c20f5[_0xfdcf('0x54')])):path[_0xfdcf('0x5f')](config[_0xfdcf('0x61')],_0x57d5ba,_[_0xfdcf('0x60')](_0xfdcf('0x62')));var _0x1dad96=_0xfdcf('0x63')+_['upperFirst'](_0xfdcf('0x54'));if(_0x4c20f5[_0x1dad96]||!_0x442df2['custom']){_0x44260c=path[_0xfdcf('0x5f')](config[_0xfdcf('0x61')],_0x57d5ba,_[_0xfdcf('0x60')]('default_logo.svg'));}if(!fs[_0xfdcf('0x5e')](_0x44260c)){throw new db[(_0xfdcf('0x64'))][(_0xfdcf('0x65'))](_[_0xfdcf('0x66')](_0xfdcf('0x54'))+_0xfdcf('0x67'));}return _0x2f3cb2[_0xfdcf('0x68')](_0x44260c);}})[_0xfdcf('0x25')](handleError(_0x2f3cb2,null));};var utilLicense=require(_0xfdcf('0x16'));exports[_0xfdcf('0x69')]=function(_0x53691c,_0x358624,_0x53a65f){var _0x386d9e=_0xfdcf('0x57');var _0x12cfcb={'custom':![]};return utilLicense[_0xfdcf('0x58')]()[_0xfdcf('0x1b')](function(_0xc87775){if(_0xc87775){_0x12cfcb=_0xc87775;}return db['Setting']['find']({'where':{'id':_0x53691c[_0xfdcf('0x4c')]['id']},'attributes':[_0xfdcf('0x54'),_0xfdcf('0x55'),_0xfdcf('0x59'),_0xfdcf('0x6a'),_0xfdcf('0x5a'),_0xfdcf('0x5b'),_0xfdcf('0x5c'),_0xfdcf('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x358624,null))[_0xfdcf('0x1b')](function(_0x536e69){if(_0x536e69){var _0x43df14=_0x536e69[_0xfdcf('0x55')]&&fs[_0xfdcf('0x5e')](path[_0xfdcf('0x5f')](config[_0xfdcf('0x61')],_0x386d9e,_['toLower'](_0x536e69[_0xfdcf('0x55')])))?path['join'](config['root'],_0x386d9e,_[_0xfdcf('0x60')](_0x536e69['loginLogo'])):path[_0xfdcf('0x5f')](config['root'],_0x386d9e,_[_0xfdcf('0x60')](_0xfdcf('0x6b')));var _0x1f46fa='default'+_['upperFirst'](_0xfdcf('0x55'));if(_0x536e69[_0x1f46fa]||!_0x12cfcb['custom']){_0x43df14=path['join'](config[_0xfdcf('0x61')],_0x386d9e,_[_0xfdcf('0x60')](_0xfdcf('0x6b')));}if(!fs[_0xfdcf('0x5e')](_0x43df14)){throw new db[(_0xfdcf('0x64'))]['ValidationError'](_[_0xfdcf('0x66')]('loginLogo')+_0xfdcf('0x67'));}return _0x358624[_0xfdcf('0x68')](_0x43df14);}})['catch'](handleError(_0x358624,null));};exports[_0xfdcf('0x6c')]=function(_0x4af2eb,_0x7a016c){return db['Setting'][_0xfdcf('0x4e')]({'where':{'id':_0x4af2eb['params']['id']},'attributes':[_0xfdcf('0x6d')]})[_0xfdcf('0x1b')](respondWithResult(_0x7a016c,null))[_0xfdcf('0x25')](handleError(_0x7a016c,null));};exports[_0xfdcf('0x6e')]=function(_0x17e590,_0x5bdd88,_0x2287cf){if(_0x17e590[_0xfdcf('0x52')]&&_0x17e590[_0xfdcf('0x52')][_0xfdcf('0x53')]){_0x17e590[_0xfdcf('0x50')][_0xfdcf('0x59')]=_0x17e590['file'][_0xfdcf('0x53')];}return db[_0xfdcf('0x32')]['find']({'where':{'id':_0x17e590['params']['id']}})[_0xfdcf('0x1b')](handleEntityNotFound(_0x5bdd88,null))[_0xfdcf('0x1b')](saveUpdates(_0x17e590[_0xfdcf('0x50')],null))[_0xfdcf('0x1b')](respondWithResult(_0x5bdd88,null))[_0xfdcf('0x25')](handleError(_0x5bdd88,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0xcd8e09,_0x2ec609,_0x5cb472){var _0x46bc1f=_0xfdcf('0x57');var _0x52766b={'custom':![]};return utilLicense[_0xfdcf('0x58')]()[_0xfdcf('0x1b')](function(_0x136ee5){if(_0x136ee5){_0x52766b=_0x136ee5;}return db[_0xfdcf('0x32')][_0xfdcf('0x4e')]({'where':{'id':_0xcd8e09['params']['id']},'attributes':['logo',_0xfdcf('0x55'),_0xfdcf('0x59'),_0xfdcf('0x6a'),_0xfdcf('0x5a'),_0xfdcf('0x5b'),_0xfdcf('0x5c'),_0xfdcf('0x5d')],'raw':!![]});})[_0xfdcf('0x1b')](handleEntityNotFound(_0x2ec609,null))[_0xfdcf('0x1b')](function(_0x3526c8){if(_0x3526c8){var _0x4e0b9c=_0x3526c8[_0xfdcf('0x59')]&&fs[_0xfdcf('0x5e')](path[_0xfdcf('0x5f')](config[_0xfdcf('0x61')],_0x46bc1f,_[_0xfdcf('0x60')](_0x3526c8['preferred'])))?path[_0xfdcf('0x5f')](config[_0xfdcf('0x61')],_0x46bc1f,_[_0xfdcf('0x60')](_0x3526c8[_0xfdcf('0x59')])):path['join'](config[_0xfdcf('0x61')],_0x46bc1f,_['toLower']('default_preferred.png'));var _0x3e48dd=_0xfdcf('0x63')+_[_0xfdcf('0x66')](_0xfdcf('0x59'));if(_0x3526c8[_0x3e48dd]||!_0x52766b[_0xfdcf('0x6f')]||!_0x52766b['preferred']){_0x4e0b9c=path['join'](config[_0xfdcf('0x61')],_0x46bc1f,_['toLower']('default_preferred.png'));}if(!fs['existsSync'](_0x4e0b9c)){throw new db[(_0xfdcf('0x64'))]['ValidationError'](_[_0xfdcf('0x66')]('preferred')+_0xfdcf('0x67'));}return _0x2ec609[_0xfdcf('0x68')](_0x4e0b9c);}})[_0xfdcf('0x25')](handleError(_0x2ec609,null));};exports[_0xfdcf('0x70')]=function(_0x2ca80e,_0x3630ba,_0x4c37a3){if(_0x2ca80e[_0xfdcf('0x52')]&&_0x2ca80e['file'][_0xfdcf('0x53')]){_0x2ca80e['body'][_0xfdcf('0x6a')]=_0x2ca80e[_0xfdcf('0x52')]['filename'];}return db['Setting'][_0xfdcf('0x4e')]({'where':{'id':_0x2ca80e['params']['id']}})[_0xfdcf('0x1b')](handleEntityNotFound(_0x3630ba,null))[_0xfdcf('0x1b')](saveUpdates(_0x2ca80e[_0xfdcf('0x50')],null))[_0xfdcf('0x1b')](respondWithResult(_0x3630ba,null))['catch'](handleError(_0x3630ba,null));};var utilLicense=require('../../config/license/util');exports[_0xfdcf('0x71')]=function(_0x31cba2,_0x4c2ebb,_0xb5413f){var _0x2ecbde=_0xfdcf('0x57');var _0x3cd1c7={'custom':![]};return utilLicense[_0xfdcf('0x58')]()[_0xfdcf('0x1b')](function(_0x4fe731){if(_0x4fe731){_0x3cd1c7=_0x4fe731;}return db[_0xfdcf('0x32')][_0xfdcf('0x4e')]({'where':{'id':_0x31cba2[_0xfdcf('0x4c')]['id']},'attributes':['logo','loginLogo',_0xfdcf('0x59'),_0xfdcf('0x6a'),_0xfdcf('0x5a'),_0xfdcf('0x5b'),_0xfdcf('0x5c'),'defaultFavicon'],'raw':!![]});})[_0xfdcf('0x1b')](handleEntityNotFound(_0x4c2ebb,null))[_0xfdcf('0x1b')](function(_0x30d5f4){if(_0x30d5f4){var _0x3c3009=_0x30d5f4['favicon']&&fs[_0xfdcf('0x5e')](path[_0xfdcf('0x5f')](config['root'],_0x2ecbde,_[_0xfdcf('0x60')](_0x30d5f4[_0xfdcf('0x6a')])))?path[_0xfdcf('0x5f')](config[_0xfdcf('0x61')],_0x2ecbde,_[_0xfdcf('0x60')](_0x30d5f4[_0xfdcf('0x6a')])):path[_0xfdcf('0x5f')](config[_0xfdcf('0x61')],_0x2ecbde,_['toLower'](_0xfdcf('0x72')));var _0x22ba89='default'+_[_0xfdcf('0x66')](_0xfdcf('0x6a'));if(_0x30d5f4[_0x22ba89]||!_0x3cd1c7[_0xfdcf('0x6f')]){_0x3c3009=path[_0xfdcf('0x5f')](config['root'],_0x2ecbde,_[_0xfdcf('0x60')](_0xfdcf('0x72')));}if(!fs['existsSync'](_0x3c3009)){throw new db[(_0xfdcf('0x64'))][(_0xfdcf('0x65'))](_[_0xfdcf('0x66')](_0xfdcf('0x6a'))+_0xfdcf('0x67'));}return _0x4c2ebb['download'](_0x3c3009);}})[_0xfdcf('0x25')](handleError(_0x4c2ebb,null));};exports[_0xfdcf('0x73')]=function(_0x4b3fbd,_0x469e5d){var _0x4662e6={'offset':moment()[_0xfdcf('0x74')]()};_0x4662e6['now']=moment()['utcOffset'](_0x4662e6[_0xfdcf('0x2a')])[_0xfdcf('0x75')](_0xfdcf('0x76'));return _0x469e5d[_0xfdcf('0x27')](0xc8)[_0xfdcf('0x30')](_0x4662e6);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f3a93f1..767501a 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 _0x39ff=['exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x156a77,_0x522c13){var _0x32398a=function(_0x55a47a){while(--_0x55a47a){_0x156a77['push'](_0x156a77['shift']());}};_0x32398a(++_0x522c13);}(_0x39ff,0x7d));var _0xf39f=function(_0x11c3b2,_0x575a2c){_0x11c3b2=_0x11c3b2-0x0;var _0x15030b=_0x39ff[_0x11c3b2];return _0x15030b;};'use strict';var _=require(_0xf39f('0x0'));var util=require('util');var logger=require(_0xf39f('0x1'))(_0xf39f('0x2'));var moment=require(_0xf39f('0x3'));var BPromise=require(_0xf39f('0x4'));var rp=require(_0xf39f('0x5'));var fs=require('fs');var path=require(_0xf39f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./setting.attributes');module[_0xf39f('0x7')]=function(_0x31ca26,_0x52f365){return _0x31ca26[_0xf39f('0x8')](_0xf39f('0x9'),attributes,{'tableName':_0xf39f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd73b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Setting','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd73b,0x1d0));var _0xbd73=function(_0x33055f,_0x24cf57){_0x33055f=_0x33055f-0x0;var _0x8dae2e=_0xd73b[_0x33055f];return _0x8dae2e;};'use strict';var _=require(_0xbd73('0x0'));var util=require(_0xbd73('0x1'));var logger=require(_0xbd73('0x2'))(_0xbd73('0x3'));var moment=require(_0xbd73('0x4'));var BPromise=require(_0xbd73('0x5'));var rp=require(_0xbd73('0x6'));var fs=require('fs');var path=require(_0xbd73('0x7'));var rimraf=require(_0xbd73('0x8'));var config=require(_0xbd73('0x9'));var attributes=require('./setting.attributes');module[_0xbd73('0xa')]=function(_0x59434f,_0x5ea802){return _0x59434f[_0xbd73('0xb')](_0xbd73('0xc'),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 59394d7..1e898ca 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 _0xff8e=['../../config/environment','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0xff8e,0x99));var _0xeff8=function(_0x5c233d,_0x3a6304){_0x5c233d=_0x5c233d-0x0;var _0x40772f=_0xff8e[_0x5c233d];return _0x40772f;};'use strict';var _=require(_0xeff8('0x0'));var util=require(_0xeff8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeff8('0x2'));var fs=require('fs');var Redis=require(_0xeff8('0x3'));var db=require(_0xeff8('0x4'))['db'];var utils=require(_0xeff8('0x5'));var logger=require('../../config/logger')(_0xeff8('0x6'));var config=require(_0xeff8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeff8('0x8')][_0xeff8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d3e01,_0x5149ef,_0x448e78){return new BPromise(function(_0x471cd8,_0x37f610){return client[_0xeff8('0xa')](_0x2d3e01,_0x448e78)['then'](function(_0x2c6fab){logger[_0xeff8('0xb')](_0xeff8('0xc'),_0x5149ef,_0xeff8('0xd'));logger[_0xeff8('0xe')](_0xeff8('0xf'),_0x5149ef,_0xeff8('0xd'),JSON['stringify'](_0x2c6fab));if(_0x2c6fab[_0xeff8('0x10')]){if(_0x2c6fab[_0xeff8('0x10')][_0xeff8('0x11')]===0x1f4){logger[_0xeff8('0x10')]('Setting,\x20%s,\x20%s',_0x5149ef,_0x2c6fab[_0xeff8('0x10')][_0xeff8('0x12')]);return _0x37f610(_0x2c6fab[_0xeff8('0x10')][_0xeff8('0x12')]);}logger[_0xeff8('0x10')](_0xeff8('0xc'),_0x5149ef,_0x2c6fab[_0xeff8('0x10')]['message']);return _0x471cd8(_0x2c6fab[_0xeff8('0x10')][_0xeff8('0x12')]);}else{logger['info'](_0xeff8('0xc'),_0x5149ef,'request\x20sent');_0x471cd8(_0x2c6fab[_0xeff8('0x13')][_0xeff8('0x12')]);}})['catch'](function(_0xdcb319){logger['error'](_0xeff8('0xc'),_0x5149ef,_0xdcb319);_0x37f610(_0xdcb319);});});} \ No newline at end of file +var _0x1830=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring'];(function(_0x540092,_0x4f418f){var _0x16999d=function(_0x22a465){while(--_0x22a465){_0x540092['push'](_0x540092['shift']());}};_0x16999d(++_0x4f418f);}(_0x1830,0x19e));var _0x0183=function(_0x310a23,_0x49f6b5){_0x310a23=_0x310a23-0x0;var _0x50fe57=_0x1830[_0x310a23];return _0x50fe57;};'use strict';var _=require(_0x0183('0x0'));var util=require(_0x0183('0x1'));var moment=require(_0x0183('0x2'));var BPromise=require('bluebird');var rs=require(_0x0183('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0183('0x4'))['db'];var utils=require(_0x0183('0x5'));var logger=require(_0x0183('0x6'))(_0x0183('0x7'));var config=require(_0x0183('0x8'));var jayson=require(_0x0183('0x9'));var client=jayson[_0x0183('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17a125,_0xd135ae,_0x15d3a4){return new BPromise(function(_0x58b9ed,_0x4c3f1a){return client[_0x0183('0xb')](_0x17a125,_0x15d3a4)[_0x0183('0xc')](function(_0x1138a7){logger['info'](_0x0183('0xd'),_0xd135ae,'request\x20sent');logger['debug'](_0x0183('0xe'),_0xd135ae,'request\x20sent',JSON[_0x0183('0xf')](_0x1138a7));if(_0x1138a7[_0x0183('0x10')]){if(_0x1138a7[_0x0183('0x10')][_0x0183('0x11')]===0x1f4){logger[_0x0183('0x10')]('Setting,\x20%s,\x20%s',_0xd135ae,_0x1138a7['error'][_0x0183('0x12')]);return _0x4c3f1a(_0x1138a7['error']['message']);}logger['error'](_0x0183('0xd'),_0xd135ae,_0x1138a7[_0x0183('0x10')][_0x0183('0x12')]);return _0x58b9ed(_0x1138a7[_0x0183('0x10')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0xd135ae,_0x0183('0x13'));_0x58b9ed(_0x1138a7[_0x0183('0x14')][_0x0183('0x12')]);}})[_0x0183('0x15')](function(_0x486a27){logger[_0x0183('0x10')](_0x0183('0xd'),_0xd135ae,_0x486a27);_0x4c3f1a(_0x486a27);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d60d1ab..b567df3 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 _0xbaf0=['show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post','addDisposition','/:id/notify','notify','/:id/send','send','status','addAgents','update','removeDispositions','delete','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x379dca,_0x3340b3){var _0x19f5e0=function(_0x201749){while(--_0x201749){_0x379dca['push'](_0x379dca['shift']());}};_0x19f5e0(++_0x3340b3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0x0baf('0x8')](_0x0baf('0x14'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router['get'](_0x0baf('0x16'),controller['statusGet']);router[_0x0baf('0x8')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x18')]);router[_0x0baf('0x19')]('/',auth[_0x0baf('0x9')](),controller['create']);router['post'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x19')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller['addAnswer']);router[_0x0baf('0x19')](_0x0baf('0x1b'),controller[_0x0baf('0x1c')]);router[_0x0baf('0x19')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller['addApplications']);router['post'](_0x0baf('0x1d'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1e')]);router[_0x0baf('0x19')](_0x0baf('0x16'),controller[_0x0baf('0x1f')]);router[_0x0baf('0x19')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x20')]);router['put'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0x21')]);router['delete']('/:id',auth[_0x0baf('0x9')](),controller['destroy']);router['delete'](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x22')]);router[_0x0baf('0x23')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x24')]);router[_0x0baf('0x23')](_0x0baf('0x17'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x25')]);module[_0x0baf('0x26')]=router; \ No newline at end of file +var _0x0713=['/:id/notify','notify','/:id/send','status','/:id/users','addAgents','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/status','getAgents','post','create','addDisposition','addAnswer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x7')](_0x3071('0x10'),auth['isAuthenticated'](),controller[_0x3071('0x11')]);router[_0x3071('0x7')](_0x3071('0x12'),auth[_0x3071('0x8')](),controller[_0x3071('0x13')]);router['get']('/:id/interactions',auth[_0x3071('0x8')](),controller['getInteractions']);router[_0x3071('0x7')](_0x3071('0x14'),controller['statusGet']);router[_0x3071('0x7')]('/:id/users',auth[_0x3071('0x8')](),controller[_0x3071('0x15')]);router[_0x3071('0x16')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x17')]);router[_0x3071('0x16')](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0x18')]);router[_0x3071('0x16')]('/:id/canned_answers',auth[_0x3071('0x8')](),controller[_0x3071('0x19')]);router[_0x3071('0x16')](_0x3071('0x1a'),controller[_0x3071('0x1b')]);router[_0x3071('0x16')](_0x3071('0x12'),auth[_0x3071('0x8')](),controller['addApplications']);router[_0x3071('0x16')](_0x3071('0x1c'),auth[_0x3071('0x8')](),controller['send']);router[_0x3071('0x16')]('/:id/status',controller[_0x3071('0x1d')]);router[_0x3071('0x16')](_0x3071('0x1e'),auth[_0x3071('0x8')](),controller[_0x3071('0x1f')]);router[_0x3071('0x20')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller['update']);router['delete'](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x21')]);router[_0x3071('0x22')](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0x23')]);router[_0x3071('0x22')](_0x3071('0x10'),auth['isAuthenticated'](),controller[_0x3071('0x24')]);router[_0x3071('0x22')](_0x3071('0x1e'),auth['isAuthenticated'](),controller[_0x3071('0x25')]);module[_0x3071('0x26')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 0a853d7..cb64a04 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 _0x93e2=['setDataValue','mandatoryDisposition','sequelize','exports','name','generate','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId'];(function(_0x1046b8,_0x25b099){var _0x27449a=function(_0x3f158e){while(--_0x3f158e){_0x1046b8['push'](_0x1046b8['shift']());}};_0x27449a(++_0x25b099);}(_0x93e2,0x10a));var _0x293e=function(_0x42b360,_0x147c94){_0x42b360=_0x42b360-0x0;var _0x3f8165=_0x93e2[_0x42b360];return _0x3f8165;};'use strict';var Sequelize=require(_0x293e('0x0'));var rs=require('randomstring');module[_0x293e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x293e('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x293e('0x3')]();}},'phone':{'type':Sequelize[_0x293e('0x4')]},'type':{'type':Sequelize[_0x293e('0x5')](_0x293e('0x6'),_0x293e('0x7'),_0x293e('0x8'),_0x293e('0x9'),_0x293e('0xa'),'clickatell',_0x293e('0xb'),_0x293e('0xc'),_0x293e('0xd'))},'accountSid':{'type':Sequelize[_0x293e('0x4')]},'authId':{'type':Sequelize[_0x293e('0x4')]},'authToken':{'type':Sequelize[_0x293e('0x4')]},'smsMethod':{'type':Sequelize[_0x293e('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x293e('0x4')]},'password':{'type':Sequelize[_0x293e('0x4')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x293e('0x4')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x293e('0xe')],'defaultValue':function(){return _0x293e('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x293e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x293e('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x293e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x293e('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x293e('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x293e('0x10')],'comment':_0x293e('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x293e('0x11')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4073c2){if(!_0x4073c2)this['setDataValue'](_0x293e('0x13'),null);this[_0x293e('0x14')](_0x293e('0x15'),_0x4073c2);}}}; \ No newline at end of file +var _0x8ec1=['clicksend','plivo','clickatell','infobip','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','generate','twilio'];(function(_0x1bd78f,_0x375e67){var _0x49b5eb=function(_0x4ef8bb){while(--_0x4ef8bb){_0x1bd78f['push'](_0x1bd78f['shift']());}};_0x49b5eb(++_0x375e67);}(_0x8ec1,0x19d));var _0x18ec=function(_0x536ed3,_0x481b22){_0x536ed3=_0x536ed3-0x0;var _0x1a3f43=_0x8ec1[_0x536ed3];return _0x1a3f43;};'use strict';var Sequelize=require(_0x18ec('0x0'));var rs=require(_0x18ec('0x1'));module['exports']={'name':{'type':Sequelize[_0x18ec('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x18ec('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x18ec('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x18ec('0x2')],'defaultValue':function(){return rs[_0x18ec('0x3')]();}},'phone':{'type':Sequelize[_0x18ec('0x2')]},'type':{'type':Sequelize['ENUM'](_0x18ec('0x4'),'skebby','connectel',_0x18ec('0x5'),_0x18ec('0x6'),_0x18ec('0x7'),'csc',_0x18ec('0x8'),_0x18ec('0x9'))},'accountSid':{'type':Sequelize[_0x18ec('0x2')]},'authId':{'type':Sequelize[_0x18ec('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x18ec('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0x18ec('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x18ec('0x2')]},'senderString':{'type':Sequelize[_0x18ec('0x2')]},'deliveryReport':{'type':Sequelize[_0x18ec('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x18ec('0x2')]},'notificationTemplate':{'type':Sequelize[_0x18ec('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x18ec('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x18ec('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x18ec('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x18ec('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x18ec('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x18ec('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x18ec('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x18ec('0xd')],'comment':_0x18ec('0xe')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x18ec('0xf'),'set':function(_0x50ae3a){if(!_0x50ae3a)this[_0x18ec('0x10')](_0x18ec('0x11'),null);this[_0x18ec('0x10')](_0x18ec('0x12'),_0x50ae3a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 3283d25..1d494f7 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 _0x2a84=['bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','count','offset','status','Content-Range','apply','save','update','then','destroy','get','SmsAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','getAnswers','CannedAnswer','hasOwnProperty','removeAnswers','notify','sms','Applications','account','applications','asc','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','Body','MessageSid','skebby','sender','clicksend','messageId','message_id','plivo','From','infobip','results','text','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','ValidationError','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','Start','startRouting','entity\x20found','set','Content-Type','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','groupName','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a84,0xdf));var _0x42a8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2a84[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x42a8('0x0'));var emlformat=require(_0x42a8('0x1'));var rimraf=require(_0x42a8('0x2'));var zipdir=require(_0x42a8('0x3'));var jsonpatch=require(_0x42a8('0x4'));var rp=require(_0x42a8('0x5'));var moment=require(_0x42a8('0x6'));var BPromise=require(_0x42a8('0x7'));var Mustache=require('mustache');var util=require(_0x42a8('0x8'));var path=require(_0x42a8('0x9'));var sox=require('sox');var csv=require(_0x42a8('0xa'));var ejs=require(_0x42a8('0xb'));var fs=require('fs');var _=require(_0x42a8('0xc'));var squel=require(_0x42a8('0xd'));var crypto=require(_0x42a8('0xe'));var jsforce=require(_0x42a8('0xf'));var deskjs=require(_0x42a8('0x10'));var toCsv=require(_0x42a8('0xa'));var querystring=require('querystring');var Papa=require(_0x42a8('0x11'));var Redis=require(_0x42a8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x42a8('0x13'));var as=require(_0x42a8('0x14'));var hardwareService=require(_0x42a8('0x15'));var logger=require(_0x42a8('0x16'))(_0x42a8('0x17'));var utils=require(_0x42a8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x42a8('0x19'));var db=require(_0x42a8('0x1a'))['db'];config['redis']=_[_0x42a8('0x1b')](config[_0x42a8('0x1c')],{'host':_0x42a8('0x1d'),'port':0x18eb});var socket=require(_0x42a8('0x1e'))(new Redis(config[_0x42a8('0x1c')]));require('./smsAccount.socket')[_0x42a8('0x1f')](socket);var jayson=require(_0x42a8('0x20'));var client=jayson['client'][_0x42a8('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x29a5dc,_0x4c99ce,_0x15858b,_0x2509fe){return new BPromise(function(_0x5592ab,_0x5c6c24){var _0x42d863=_0x2509fe||client;return _0x42d863[_0x42a8('0x22')](_0x29a5dc,_0x15858b)['then'](function(_0x4dbf66){logger[_0x42a8('0x23')](_0x42a8('0x24'),_0x4c99ce,_0x42a8('0x25'));logger[_0x42a8('0x26')](_0x42a8('0x27'),_0x4c99ce,_0x42a8('0x25'),JSON[_0x42a8('0x28')](_0x4dbf66));if(_0x4dbf66['error']){if(_0x4dbf66['error']['code']===0x1f4){logger[_0x42a8('0x29')](_0x42a8('0x24'),_0x4c99ce,_0x4dbf66[_0x42a8('0x29')][_0x42a8('0x2a')]);return _0x5c6c24(_0x4dbf66[_0x42a8('0x29')]['message']);}logger[_0x42a8('0x29')](_0x42a8('0x24'),_0x4c99ce,_0x4dbf66[_0x42a8('0x29')][_0x42a8('0x2a')]);return _0x5592ab(_0x4dbf66[_0x42a8('0x29')][_0x42a8('0x2a')]);}else{logger[_0x42a8('0x23')](_0x42a8('0x24'),_0x4c99ce,_0x42a8('0x25'));_0x5592ab(_0x4dbf66[_0x42a8('0x2b')][_0x42a8('0x2a')]);}})[_0x42a8('0x2c')](function(_0x145d74){logger[_0x42a8('0x29')](_0x42a8('0x24'),_0x4c99ce,_0x145d74);_0x5c6c24(_0x145d74);});});}function respondWithStatusCode(_0x261711,_0x25f36e){_0x25f36e=_0x25f36e||0xcc;return function(_0x51e248){if(_0x51e248){return _0x261711[_0x42a8('0x2d')](_0x25f36e);}return _0x261711['status'](_0x25f36e)[_0x42a8('0x2e')]();};}function respondWithResult(_0x1e1591,_0x4f5a1f){_0x4f5a1f=_0x4f5a1f||0xc8;return function(_0x4bd93a){if(_0x4bd93a){return _0x1e1591['status'](_0x4f5a1f)[_0x42a8('0x2f')](_0x4bd93a);}};}function respondWithFilteredResult(_0x2359ae,_0x417123){return function(_0xc0c19f){if(_0xc0c19f){var _0x3e937d=_0xc0c19f[_0x42a8('0x30')],_0x1e1cfb=_0x417123[_0x42a8('0x31')],_0x1ed8cc=_0x417123[_0x42a8('0x31')]+_0x417123['limit'],_0x4aae8f;if(_0x1ed8cc>=_0x3e937d){_0x1ed8cc=_0x3e937d;_0x4aae8f=0xc8;}else{_0x4aae8f=0xce;}_0x2359ae[_0x42a8('0x32')](_0x4aae8f);return _0x2359ae['set'](_0x42a8('0x33'),_0x1e1cfb+'-'+_0x1ed8cc+'/'+_0x3e937d)[_0x42a8('0x2f')](_0xc0c19f);}return null;};}function patchUpdates(_0x3d2a56){return function(_0x15eb91){try{jsonpatch[_0x42a8('0x34')](_0x15eb91,_0x3d2a56,!![]);}catch(_0x1e3279){return BPromise['reject'](_0x1e3279);}return _0x15eb91[_0x42a8('0x35')]();};}function saveUpdates(_0x239db4,_0x1dee27){return function(_0x36eda2){if(_0x36eda2){return _0x36eda2[_0x42a8('0x36')](_0x239db4)[_0x42a8('0x37')](function(_0x430cc9){return _0x430cc9;});}return null;};}function removeEntity(_0x4ef116,_0x2c0b9c){return function(_0x4385a4){if(_0x4385a4){return _0x4385a4[_0x42a8('0x38')]()['then'](function(){var _0x82dce=_0x4385a4[_0x42a8('0x39')]({'plain':!![]});var _0x55eaa5=_0x42a8('0x3a');return db[_0x42a8('0x3b')]['destroy']({'where':{'type':_0x55eaa5,'resourceId':_0x82dce['id']}})['then'](function(){return _0x4385a4;});})['then'](function(){_0x4ef116[_0x42a8('0x32')](0xcc)[_0x42a8('0x2e')]();});}};}function handleEntityNotFound(_0x302f89,_0x26a4da){return function(_0x5745c5){if(!_0x5745c5){_0x302f89[_0x42a8('0x2d')](0x194);}return _0x5745c5;};}function handleError(_0x5d639d,_0x5b40c5){_0x5b40c5=_0x5b40c5||0x1f4;return function(_0x303881){logger[_0x42a8('0x29')](_0x303881['stack']);if(_0x303881[_0x42a8('0x3c')]){delete _0x303881[_0x42a8('0x3c')];}_0x5d639d[_0x42a8('0x32')](_0x5b40c5)[_0x42a8('0x3d')](_0x303881);};}exports[_0x42a8('0x3e')]=function(_0x54f7b9,_0x593232){var _0xfb62c5={'include':[{'model':db['Pause'],'as':_0x42a8('0x3f')}]},_0x1407fd={},_0x47c8f3={'count':0x0,'rows':[]};var _0x512ba5=_[_0x42a8('0x40')](db[_0x42a8('0x41')][_0x42a8('0x42')],function(_0x44d054){return{'name':_0x44d054[_0x42a8('0x43')],'type':_0x44d054['type'][_0x42a8('0x44')]};});_0x1407fd[_0x42a8('0x45')]=_[_0x42a8('0x40')](_0x512ba5,'name');_0x1407fd[_0x42a8('0x46')]=_[_0x42a8('0x47')](_0x54f7b9['query']);_0x1407fd[_0x42a8('0x48')]=_['intersection'](_0x1407fd[_0x42a8('0x45')],_0x1407fd[_0x42a8('0x46')]);_0xfb62c5[_0x42a8('0x49')]=_[_0x42a8('0x4a')](_0x1407fd[_0x42a8('0x45')],qs[_0x42a8('0x4b')](_0x54f7b9[_0x42a8('0x46')][_0x42a8('0x4b')]));_0xfb62c5['attributes']=_0xfb62c5['attributes'][_0x42a8('0x4c')]?_0xfb62c5[_0x42a8('0x49')]:_0x1407fd['model'];if(!_0x54f7b9['query']['hasOwnProperty']('nolimit')){_0xfb62c5[_0x42a8('0x4d')]=qs[_0x42a8('0x4d')](_0x54f7b9[_0x42a8('0x46')][_0x42a8('0x4d')]);_0xfb62c5['offset']=qs[_0x42a8('0x31')](_0x54f7b9[_0x42a8('0x46')][_0x42a8('0x31')]);}_0xfb62c5[_0x42a8('0x4e')]=qs[_0x42a8('0x4f')](_0x54f7b9[_0x42a8('0x46')][_0x42a8('0x4f')]);_0xfb62c5[_0x42a8('0x50')]=qs[_0x42a8('0x48')](_[_0x42a8('0x51')](_0x54f7b9[_0x42a8('0x46')],_0x1407fd[_0x42a8('0x48')]),_0x512ba5);if(_0x54f7b9['query'][_0x42a8('0x52')]){_0xfb62c5[_0x42a8('0x50')]=_[_0x42a8('0x53')](_0xfb62c5[_0x42a8('0x50')],{'$or':_['map'](_0x512ba5,function(_0x544853){if(_0x544853[_0x42a8('0x54')]!==_0x42a8('0x55')){var _0x1e4948={};_0x1e4948[_0x544853[_0x42a8('0x3c')]]={'$like':'%'+_0x54f7b9[_0x42a8('0x46')]['filter']+'%'};return _0x1e4948;}})});}_0xfb62c5=_['merge']({},_0xfb62c5,_0x54f7b9[_0x42a8('0x56')]);var _0x27ccf0={'where':_0xfb62c5[_0x42a8('0x50')]};return db['SmsAccount'][_0x42a8('0x30')](_0x27ccf0)[_0x42a8('0x37')](function(_0x160ef3){_0x47c8f3['count']=_0x160ef3;if(_0x54f7b9[_0x42a8('0x46')][_0x42a8('0x57')]){_0xfb62c5[_0x42a8('0x58')]=[{'all':!![]}];}return db['SmsAccount'][_0x42a8('0x59')](_0xfb62c5);})[_0x42a8('0x37')](function(_0x16ca6e){_0x47c8f3[_0x42a8('0x5a')]=_0x16ca6e;return _0x47c8f3;})[_0x42a8('0x37')](respondWithFilteredResult(_0x593232,_0xfb62c5))['catch'](handleError(_0x593232,null));};exports[_0x42a8('0x5b')]=function(_0x6bff9,_0x32841d){var _0x59cc69={'raw':![],'where':{'id':_0x6bff9[_0x42a8('0x5c')]['id']},'include':[{'model':db[_0x42a8('0x5d')],'as':_0x42a8('0x3f')}]},_0x5718cd={};_0x5718cd['model']=_[_0x42a8('0x47')](db[_0x42a8('0x41')][_0x42a8('0x42')]);_0x5718cd[_0x42a8('0x46')]=_[_0x42a8('0x47')](_0x6bff9[_0x42a8('0x46')]);_0x5718cd['filters']=_[_0x42a8('0x4a')](_0x5718cd[_0x42a8('0x45')],_0x5718cd[_0x42a8('0x46')]);_0x59cc69[_0x42a8('0x49')]=_[_0x42a8('0x4a')](_0x5718cd[_0x42a8('0x45')],qs[_0x42a8('0x4b')](_0x6bff9[_0x42a8('0x46')][_0x42a8('0x4b')]));_0x59cc69[_0x42a8('0x49')]=_0x59cc69[_0x42a8('0x49')][_0x42a8('0x4c')]?_0x59cc69[_0x42a8('0x49')]:_0x5718cd[_0x42a8('0x45')];if(_0x6bff9[_0x42a8('0x46')][_0x42a8('0x57')]){_0x59cc69[_0x42a8('0x58')]=[{'all':!![]}];}_0x59cc69=_[_0x42a8('0x53')]({},_0x59cc69,_0x6bff9[_0x42a8('0x56')]);return db['SmsAccount'][_0x42a8('0x5e')](_0x59cc69)[_0x42a8('0x37')](handleEntityNotFound(_0x32841d,null))[_0x42a8('0x37')](respondWithResult(_0x32841d,null))[_0x42a8('0x2c')](handleError(_0x32841d,null));};exports[_0x42a8('0x5f')]=function(_0x597322,_0x2ad616){return db[_0x42a8('0x41')][_0x42a8('0x5f')](_0x597322[_0x42a8('0x60')],{})[_0x42a8('0x37')](function(_0x29b48e){var _0x1c2ef5=_0x597322[_0x42a8('0x61')][_0x42a8('0x39')]({'plain':!![]});if(!_0x1c2ef5)throw new Error(_0x42a8('0x62'));if(_0x1c2ef5['role']==='user'){var _0x585429=_0x29b48e[_0x42a8('0x39')]({'plain':!![]});var _0x4fe651=_0x42a8('0x3a');return db[_0x42a8('0x63')][_0x42a8('0x5e')]({'where':{'name':_0x4fe651,'userProfileId':_0x1c2ef5['userProfileId']},'raw':!![]})[_0x42a8('0x37')](function(_0x52f4c7){if(_0x52f4c7&&_0x52f4c7['autoAssociation']===0x0){return db[_0x42a8('0x3b')][_0x42a8('0x5f')]({'name':_0x585429[_0x42a8('0x3c')],'resourceId':_0x585429['id'],'type':_0x52f4c7[_0x42a8('0x3c')],'sectionId':_0x52f4c7['id']},{})['then'](function(){return _0x29b48e;});}else{return _0x29b48e;}})[_0x42a8('0x2c')](function(_0x376e5b){logger[_0x42a8('0x29')](_0x42a8('0x64'),_0x376e5b);throw _0x376e5b;});}return _0x29b48e;})[_0x42a8('0x37')](respondWithResult(_0x2ad616,0xc9))['catch'](handleError(_0x2ad616,null));};exports[_0x42a8('0x36')]=function(_0x156186,_0x490dee){if(_0x156186[_0x42a8('0x60')]['id']){delete _0x156186[_0x42a8('0x60')]['id'];}return db['SmsAccount'][_0x42a8('0x5e')]({'where':{'id':_0x156186[_0x42a8('0x5c')]['id']},'include':[{'model':db[_0x42a8('0x5d')],'as':_0x42a8('0x3f')}]})['then'](handleEntityNotFound(_0x490dee,null))[_0x42a8('0x37')](saveUpdates(_0x156186[_0x42a8('0x60')],null))[_0x42a8('0x37')](respondWithResult(_0x490dee,null))[_0x42a8('0x2c')](handleError(_0x490dee,null));};exports[_0x42a8('0x38')]=function(_0x53244c,_0x3d180d){return db[_0x42a8('0x41')][_0x42a8('0x5e')]({'where':{'id':_0x53244c[_0x42a8('0x5c')]['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x3d180d,null))['then'](removeEntity(_0x3d180d,null))[_0x42a8('0x2c')](handleError(_0x3d180d,null));};exports[_0x42a8('0x65')]=function(_0x4f3d41,_0x479369){return db['SmsAccount'][_0x42a8('0x65')]()[_0x42a8('0x37')](respondWithResult(_0x479369,null))[_0x42a8('0x2c')](handleError(_0x479369,null));};exports[_0x42a8('0x66')]=function(_0x250628,_0x5453e0,_0x435c64){if(_0x250628[_0x42a8('0x60')]['id']){delete _0x250628['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x250628[_0x42a8('0x5c')]['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x5453e0,null))[_0x42a8('0x37')](function(_0xc5927d){if(_0xc5927d){_0x250628[_0x42a8('0x60')][_0x42a8('0x67')]=_0xc5927d['id'];return db[_0x42a8('0x68')]['create'](_0x250628[_0x42a8('0x60')]);}})['then'](respondWithResult(_0x5453e0,null))['catch'](handleError(_0x5453e0,null));};exports[_0x42a8('0x69')]=function(_0x5471b6,_0x468c18,_0x301eaa){var _0x2010b0={'raw':![],'where':{}};var _0x43b3be={};var _0x172453={'count':0x0,'rows':[]};return db[_0x42a8('0x41')][_0x42a8('0x6a')]({'where':{'id':_0x5471b6[_0x42a8('0x5c')]['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x468c18,null))[_0x42a8('0x37')](function(_0x53eb2a){if(_0x53eb2a){_0x43b3be[_0x42a8('0x45')]=_[_0x42a8('0x47')](db[_0x42a8('0x68')]['rawAttributes']);_0x43b3be[_0x42a8('0x46')]=_[_0x42a8('0x47')](_0x5471b6[_0x42a8('0x46')]);_0x43b3be[_0x42a8('0x48')]=_[_0x42a8('0x4a')](_0x43b3be[_0x42a8('0x45')],_0x43b3be['query']);_0x2010b0['attributes']=_[_0x42a8('0x4a')](_0x43b3be[_0x42a8('0x45')],qs[_0x42a8('0x4b')](_0x5471b6[_0x42a8('0x46')]['fields']));_0x2010b0[_0x42a8('0x49')]=_0x2010b0[_0x42a8('0x49')][_0x42a8('0x4c')]?_0x2010b0[_0x42a8('0x49')]:_0x43b3be[_0x42a8('0x45')];if(!_0x5471b6[_0x42a8('0x46')]['hasOwnProperty'](_0x42a8('0x6b'))){_0x2010b0[_0x42a8('0x4d')]=qs[_0x42a8('0x4d')](_0x5471b6[_0x42a8('0x46')]['limit']);_0x2010b0[_0x42a8('0x31')]=qs[_0x42a8('0x31')](_0x5471b6[_0x42a8('0x46')][_0x42a8('0x31')]);}_0x2010b0['order']=qs[_0x42a8('0x4f')](_0x5471b6[_0x42a8('0x46')][_0x42a8('0x4f')]);_0x2010b0[_0x42a8('0x50')]=qs[_0x42a8('0x48')](_[_0x42a8('0x51')](_0x5471b6[_0x42a8('0x46')],_0x43b3be[_0x42a8('0x48')]));_0x2010b0[_0x42a8('0x50')]['SmsAccountId']=_0x53eb2a['id'];if(_0x5471b6[_0x42a8('0x46')][_0x42a8('0x52')]){_0x2010b0[_0x42a8('0x50')]=_[_0x42a8('0x53')](_0x2010b0['where'],{'$or':_[_0x42a8('0x40')](_0x2010b0['attributes'],function(_0x2a2c12){var _0x254baf={};_0x254baf[_0x2a2c12]={'$like':'%'+_0x5471b6['query'][_0x42a8('0x52')]+'%'};return _0x254baf;})});}_0x2010b0=_[_0x42a8('0x53')]({},_0x2010b0,_0x5471b6[_0x42a8('0x56')]);return db[_0x42a8('0x68')][_0x42a8('0x30')]({'where':_0x2010b0[_0x42a8('0x50')]})[_0x42a8('0x37')](function(_0x3356b6){_0x172453[_0x42a8('0x30')]=_0x3356b6;if(_0x5471b6[_0x42a8('0x46')]['includeAll']){_0x2010b0[_0x42a8('0x58')]=[{'all':!![]}];}return db[_0x42a8('0x68')][_0x42a8('0x59')](_0x2010b0);})['then'](function(_0x218728){_0x172453['rows']=_0x218728;return _0x172453;});}})[_0x42a8('0x37')](respondWithFilteredResult(_0x468c18,_0x2010b0))['catch'](handleError(_0x468c18,null));};exports[_0x42a8('0x6c')]=function(_0x5c7116,_0x35c2f5,_0x3a8a31){return db[_0x42a8('0x41')]['find']({'where':{'id':_0x5c7116[_0x42a8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x35c2f5,null))[_0x42a8('0x37')](function(_0x528fba){if(_0x528fba){return _0x528fba[_0x42a8('0x6c')](_0x5c7116[_0x42a8('0x46')][_0x42a8('0x6d')]);}})[_0x42a8('0x37')](respondWithStatusCode(_0x35c2f5,null))[_0x42a8('0x2c')](handleError(_0x35c2f5,null));};exports['addAnswer']=function(_0x3a06ff,_0x28a862,_0x93a76a){if(_0x3a06ff['body']['id']){delete _0x3a06ff[_0x42a8('0x60')]['id'];}return db[_0x42a8('0x41')][_0x42a8('0x5e')]({'where':{'id':_0x3a06ff[_0x42a8('0x5c')]['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x28a862,null))[_0x42a8('0x37')](function(_0x3aea48){if(_0x3aea48){_0x3a06ff['body'][_0x42a8('0x67')]=_0x3aea48['id'];return db['CannedAnswer'][_0x42a8('0x5f')](_0x3a06ff[_0x42a8('0x60')]);}})[_0x42a8('0x37')](respondWithResult(_0x28a862,null))[_0x42a8('0x2c')](handleError(_0x28a862,null));};exports[_0x42a8('0x6e')]=function(_0x3fbb26,_0x2a501f,_0x55040d){var _0xfed600={'raw':![],'where':{}};var _0xf80801={};var _0x3ce7cb={'count':0x0,'rows':[]};return db[_0x42a8('0x41')][_0x42a8('0x6a')]({'where':{'id':_0x3fbb26[_0x42a8('0x5c')]['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x2a501f,null))[_0x42a8('0x37')](function(_0x3cc72d){if(_0x3cc72d){_0xf80801['model']=_['keys'](db[_0x42a8('0x6f')]['rawAttributes']);_0xf80801[_0x42a8('0x46')]=_['keys'](_0x3fbb26[_0x42a8('0x46')]);_0xf80801[_0x42a8('0x48')]=_[_0x42a8('0x4a')](_0xf80801[_0x42a8('0x45')],_0xf80801[_0x42a8('0x46')]);_0xfed600[_0x42a8('0x49')]=_[_0x42a8('0x4a')](_0xf80801['model'],qs[_0x42a8('0x4b')](_0x3fbb26[_0x42a8('0x46')]['fields']));_0xfed600[_0x42a8('0x49')]=_0xfed600[_0x42a8('0x49')][_0x42a8('0x4c')]?_0xfed600[_0x42a8('0x49')]:_0xf80801['model'];if(!_0x3fbb26[_0x42a8('0x46')][_0x42a8('0x70')](_0x42a8('0x6b'))){_0xfed600[_0x42a8('0x4d')]=qs[_0x42a8('0x4d')](_0x3fbb26['query'][_0x42a8('0x4d')]);_0xfed600[_0x42a8('0x31')]=qs[_0x42a8('0x31')](_0x3fbb26[_0x42a8('0x46')]['offset']);}_0xfed600[_0x42a8('0x4e')]=qs[_0x42a8('0x4f')](_0x3fbb26[_0x42a8('0x46')]['sort']);_0xfed600[_0x42a8('0x50')]=qs[_0x42a8('0x48')](_[_0x42a8('0x51')](_0x3fbb26['query'],_0xf80801[_0x42a8('0x48')]));_0xfed600[_0x42a8('0x50')][_0x42a8('0x67')]=_0x3cc72d['id'];if(_0x3fbb26[_0x42a8('0x46')][_0x42a8('0x52')]){_0xfed600[_0x42a8('0x50')]=_['merge'](_0xfed600['where'],{'$or':_['map'](_0xfed600[_0x42a8('0x49')],function(_0x3cd380){var _0x15f2f6={};_0x15f2f6[_0x3cd380]={'$like':'%'+_0x3fbb26[_0x42a8('0x46')]['filter']+'%'};return _0x15f2f6;})});}_0xfed600=_[_0x42a8('0x53')]({},_0xfed600,_0x3fbb26[_0x42a8('0x56')]);return db['CannedAnswer'][_0x42a8('0x30')]({'where':_0xfed600[_0x42a8('0x50')]})[_0x42a8('0x37')](function(_0x1bebf4){_0x3ce7cb[_0x42a8('0x30')]=_0x1bebf4;if(_0x3fbb26[_0x42a8('0x46')][_0x42a8('0x57')]){_0xfed600[_0x42a8('0x58')]=[{'all':!![]}];}return db[_0x42a8('0x6f')][_0x42a8('0x59')](_0xfed600);})[_0x42a8('0x37')](function(_0x45c8c2){_0x3ce7cb[_0x42a8('0x5a')]=_0x45c8c2;return _0x3ce7cb;});}})[_0x42a8('0x37')](respondWithFilteredResult(_0x2a501f,_0xfed600))['catch'](handleError(_0x2a501f,null));};exports['removeAnswers']=function(_0x42f73f,_0x540416,_0x5be882){return db['SmsAccount'][_0x42a8('0x5e')]({'where':{'id':_0x42f73f[_0x42a8('0x5c')]['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x540416,null))[_0x42a8('0x37')](function(_0x93a375){if(_0x93a375){return _0x93a375[_0x42a8('0x71')](_0x42f73f[_0x42a8('0x46')][_0x42a8('0x6d')]);}})[_0x42a8('0x37')](respondWithStatusCode(_0x540416,null))[_0x42a8('0x2c')](handleError(_0x540416,null));};exports[_0x42a8('0x72')]=function(_0x1566b5,_0x1a8c6e,_0x42fbb4){var _0xac0d95={'channel':_0x42a8('0x73')};var _0x20258f=[];var _0x5baeaf=[];var _0x367746={};return db['SmsAccount']['find']({'where':{'id':_0x1566b5[_0x42a8('0x5c')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x42a8('0x74')}]})['then'](handleEntityNotFound(_0x1a8c6e,null))[_0x42a8('0x37')](function(_0x36f7c1){_0xac0d95[_0x42a8('0x75')]=_0x36f7c1;_0xac0d95[_0x42a8('0x76')]=_['orderBy'](_0x36f7c1['Applications'],['priority'],[_0x42a8('0x77')]);if(_0xac0d95[_0x42a8('0x75')][_0x42a8('0x74')]){delete _0xac0d95[_0x42a8('0x75')][_0x42a8('0x74')];}return db[_0x42a8('0x78')][_0x42a8('0x65')]();})[_0x42a8('0x37')](function(_0x59703a){if(!_0x59703a){throw new db[(_0x42a8('0x79'))]['ValidationError']('no\x20available\x20attributes');}_0x20258f=_[_0x42a8('0x7a')](_[_0x42a8('0x47')](_0x59703a),[_0x42a8('0x7b'),_0x42a8('0x7c')]);_0x5baeaf=_[_0x42a8('0x7a')](_['keys'](_0x59703a),['createdAt',_0x42a8('0x7c'),_0x42a8('0x7d'),_0x42a8('0x7e')]);_0xac0d95[_0x42a8('0x60')]={'mapKey':_0x42a8('0x7f')};if(_0xac0d95['account'][_0x42a8('0x54')]){switch(_0xac0d95['account'][_0x42a8('0x54')]){case _0x42a8('0x80'):_0xac0d95[_0x42a8('0x60')][_0x42a8('0x81')]=_0x1566b5[_0x42a8('0x60')]['From'];_0xac0d95[_0x42a8('0x60')]['body']=_0x1566b5['body'][_0x42a8('0x82')];_0xac0d95[_0x42a8('0x60')]['messageId']=_0x1566b5['body'][_0x42a8('0x83')];break;case _0x42a8('0x84'):_0xac0d95['body'][_0x42a8('0x81')]='+'+_0x1566b5[_0x42a8('0x60')][_0x42a8('0x85')];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x60')]=_0x1566b5[_0x42a8('0x60')]['text'];break;case'connectel':_0xac0d95['body'][_0x42a8('0x81')]=_0x1566b5['body']['from'];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x60')]=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x2a')];break;case _0x42a8('0x86'):_0xac0d95['body']['from']=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x81')];_0xac0d95['body']['body']=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x60')];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x87')]=_0x1566b5['body'][_0x42a8('0x88')];break;case _0x42a8('0x89'):_0xac0d95[_0x42a8('0x60')][_0x42a8('0x81')]=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x8a')];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x60')]=_0x1566b5[_0x42a8('0x60')]['Text'];_0xac0d95['body'][_0x42a8('0x87')]=_0x1566b5[_0x42a8('0x60')]['MessageUUID'];break;case _0x42a8('0x8b'):_0xac0d95[_0x42a8('0x60')][_0x42a8('0x81')]='+'+_0x1566b5[_0x42a8('0x60')]['results'][0x0]['from'];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x60')]=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x8c')][0x0][_0x42a8('0x8d')];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x87')]=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x8c')][0x0]['messageId'];break;case _0x42a8('0x8e'):_0xac0d95[_0x42a8('0x60')][_0x42a8('0x81')]=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x8f')];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x60')]=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x90')][_0x42a8('0x2a')];break;case _0x42a8('0x91'):_0xac0d95[_0x42a8('0x60')]['from']=_0x1566b5['body'][_0x42a8('0x92')];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x60')]=_0x1566b5[_0x42a8('0x60')]['text'];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x87')]=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x93')];break;case _0x42a8('0x94'):_0xac0d95[_0x42a8('0x60')]['from']=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x81')];_0xac0d95[_0x42a8('0x60')][_0x42a8('0x60')]=_0x1566b5['body']['message'];_0xac0d95['body'][_0x42a8('0x87')]=_0x1566b5[_0x42a8('0x60')][_0x42a8('0x95')];break;}}if(_0xac0d95[_0x42a8('0x60')]['id']){delete _0xac0d95[_0x42a8('0x60')]['id'];}if(_[_0x42a8('0x96')](_0xac0d95[_0x42a8('0x60')][_0x42a8('0x81')])){throw new db[(_0x42a8('0x79'))][(_0x42a8('0x97'))]('from\x20is\x20mandatory');}if(_[_0x42a8('0x96')](_0xac0d95['body'][_0x42a8('0x60')])||_0xac0d95[_0x42a8('0x60')][_0x42a8('0x60')]===''){throw new db[(_0x42a8('0x79'))][(_0x42a8('0x97'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xac0d95[_0x42a8('0x60')][_0x42a8('0x98')])){throw new db[(_0x42a8('0x79'))][(_0x42a8('0x97'))](_0x42a8('0x99')+_0x5baeaf);}if(!_['includes'](_0x5baeaf,_0xac0d95['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0x42a8('0x9a')+_0x5baeaf);}_0x367746[_0xac0d95['body'][_0x42a8('0x98')]]=_0xac0d95[_0x42a8('0x60')]['from'];return db[_0x42a8('0x9b')][_0x42a8('0x5e')]({'where':{'id':_0xac0d95[_0x42a8('0x75')][_0x42a8('0x7e')]},'include':[{'model':db[_0x42a8('0x78')],'as':_0x42a8('0x9c'),'where':_0x367746,'limit':0x1,'order':[[_0x42a8('0x7c'),_0x42a8('0x9d')]]}]});})['then'](handleEntityNotFound(_0x1a8c6e,null))[_0x42a8('0x37')](function(_0x49440e){if(_0x49440e){_0xac0d95[_0x42a8('0x9e')]=_[_0x42a8('0x9f')](_0x49440e,['Contacts']);if(_0x49440e[_0x42a8('0x9c')]['length']){return _0x49440e[_0x42a8('0x9c')][0x0];}var _0x47535d=_['defaults'](_0xac0d95['body'],{'firstName':_0xac0d95['body'][_0x42a8('0x81')],'ListId':_0x49440e['id']});_0x47535d[_0xac0d95[_0x42a8('0x60')]['mapKey']]=_0xac0d95[_0x42a8('0x60')][_0x42a8('0x81')];return db['CmContact']['create'](_0x47535d,{'fields':_0x20258f,'raw':!![]});}})[_0x42a8('0x37')](handleEntityNotFound(_0x1a8c6e,null))[_0x42a8('0x37')](function(_0x1bd706){if(_0x1bd706){_0xac0d95[_0x42a8('0xa0')]=_0x1bd706;var _0x5f0f8e={'ContactId':_0x1bd706['id'],'phone':_0xac0d95[_0x42a8('0x60')][_0x42a8('0x81')],'SmsAccountId':_0x1566b5[_0x42a8('0x5c')]['id']};var _0x5d6e5e={'ContactId':_0x1bd706['id'],'SmsAccountId':_0x1566b5[_0x42a8('0x5c')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x5d6e5e})[_0x42a8('0x37')](function(_0x5a7f87){if(_0x5a7f87){return[_0x5a7f87,![]];}return db[_0x42a8('0xa1')][_0x42a8('0x5f')](_0x5f0f8e)[_0x42a8('0x37')](function(_0x5eb57e){return[_0x5eb57e,!![]];});});}})[_0x42a8('0xa2')](function(_0x4fbc27,_0x2e25c8){_0xac0d95['interaction']=_0x4fbc27[_0x42a8('0x39')]({'plain':!![]});_0xac0d95[_0x42a8('0xa3')][_0x42a8('0xa4')]=![];if(_0x2e25c8){if(_0xac0d95[_0x42a8('0x75')]['autoclose']){_0xac0d95[_0x42a8('0x76')][_0x42a8('0xa5')]({'id':0x0,'priority':_0xac0d95['applications']['length']+0x1,'app':_0x42a8('0xa6'),'appdata':_0x42a8('0xa7'),'interval':_0x42a8('0xa8')});}_0xac0d95[_0x42a8('0xa3')][_0x42a8('0xa4')]=!![];}return db[_0x42a8('0xa9')][_0x42a8('0x5f')]({'phone':_0xac0d95[_0x42a8('0x60')][_0x42a8('0x81')],'messageId':_0xac0d95[_0x42a8('0x60')]['messageId'],'body':_0xac0d95[_0x42a8('0x60')][_0x42a8('0x60')],'SmsAccountId':_0x1566b5['params']['id'],'SmsInteractionId':_0x4fbc27['id'],'direction':'in','ContactId':_0x4fbc27[_0x42a8('0xaa')],'AttachmentId':_0xac0d95[_0x42a8('0x60')][_0x42a8('0xab')]});})[_0x42a8('0x37')](function(_0x593c0e){_0xac0d95[_0x42a8('0x2a')]=_0x593c0e;if(_0xac0d95[_0x42a8('0xa3')][_0x42a8('0xac')]){return db[_0x42a8('0xad')]['find']({'attributes':['id',_0x42a8('0x3c')],'where':{'id':_0xac0d95[_0x42a8('0xa3')][_0x42a8('0xac')]}})['then'](function(_0xf0290){if(_0xf0290){_0xac0d95['applications'][_0x42a8('0xae')]({'id':0x0,'priority':0x0,'app':_0x42a8('0xaf'),'appdata':_0xf0290[_0x42a8('0x3c')]+','+(_0xac0d95[_0x42a8('0x75')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x42a8('0xb0'),_0x42a8('0xb1'),_0xac0d95);});}return respondWithRpcPromise(_0x42a8('0xb0'),_0x42a8('0xb1'),_0xac0d95);})[_0x42a8('0x37')](function(_0x4ee86a){if(_0x4ee86a){var _0x5cfe7f=0xc8;var _0x2936da='receiveMessage';logger[_0x42a8('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2936da,_0x5cfe7f,_0x42a8('0xb2'));logger[_0x42a8('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2936da,_0x5cfe7f,_0x42a8('0xb2'),JSON[_0x42a8('0x28')](_0x4ee86a));if(_0xac0d95[_0x42a8('0x75')][_0x42a8('0x54')]===_0x42a8('0x80')){return _0x1a8c6e[_0x42a8('0x32')](_0x5cfe7f)[_0x42a8('0xb3')](_0x42a8('0xb4'),'text/xml')[_0x42a8('0x3d')]('\x0a');}else{return _0x1a8c6e['status'](_0x5cfe7f)['json'](_0x4ee86a);}}})[_0x42a8('0x2c')](handleError(_0x1a8c6e,null));};exports[_0x42a8('0xb5')]=function(_0x523408,_0x3744d5,_0x9acf65){return db[_0x42a8('0x41')][_0x42a8('0x6a')]({'where':{'id':_0x523408['params']['id']}})['then'](handleEntityNotFound(_0x3744d5,null))[_0x42a8('0x37')](function(_0x2f8b81){if(_0x2f8b81){return db[_0x42a8('0xb6')][_0x42a8('0xb7')](function(_0x2ebac9){return db[_0x42a8('0xb8')]['destroy']({'where':{'SmsAccountId':_0x523408[_0x42a8('0x5c')]['id']},'transaction':_0x2ebac9})[_0x42a8('0x37')](function(_0x2c741c){var _0x5356ea=_[_0x42a8('0x40')](_0x523408['body'],function(_0x1d4e2d){_0x1d4e2d['SmsAccountId']=_0x523408['params']['id'];return _0x1d4e2d;});return db[_0x42a8('0xb8')][_0x42a8('0xb9')](_0x5356ea,{'transaction':_0x2ebac9});});})[_0x42a8('0x37')](function(){return db[_0x42a8('0xb8')][_0x42a8('0xba')]({'where':{'SmsAccountId':_0x523408[_0x42a8('0x5c')]['id']},'order':_0x42a8('0xbb')});});}})[_0x42a8('0x37')](respondWithResult(_0x3744d5,null))[_0x42a8('0x2c')](handleError(_0x3744d5,null));};exports[_0x42a8('0xbc')]=function(_0x46c46f,_0x1acd86,_0x59084b){var _0x3b2f9e={};var _0x43bf21={};var _0x215d6b;var _0x4309b4;return db[_0x42a8('0x41')][_0x42a8('0x6a')]({'where':{'id':_0x46c46f['params']['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x1acd86,null))[_0x42a8('0x37')](function(_0x29740c){if(_0x29740c){_0x215d6b=_0x29740c;_0x43bf21[_0x42a8('0x45')]=_[_0x42a8('0x47')](db[_0x42a8('0xb8')][_0x42a8('0x42')]);_0x43bf21[_0x42a8('0x46')]=_[_0x42a8('0x47')](_0x46c46f['query']);_0x43bf21[_0x42a8('0x48')]=_[_0x42a8('0x4a')](_0x43bf21[_0x42a8('0x45')],_0x43bf21[_0x42a8('0x46')]);_0x3b2f9e[_0x42a8('0x49')]=_[_0x42a8('0x4a')](_0x43bf21[_0x42a8('0x45')],qs['fields'](_0x46c46f[_0x42a8('0x46')][_0x42a8('0x4b')]));_0x3b2f9e['attributes']=_0x3b2f9e[_0x42a8('0x49')]['length']?_0x3b2f9e[_0x42a8('0x49')]:_0x43bf21['model'];_0x3b2f9e[_0x42a8('0x4e')]=qs['sort'](_0x46c46f[_0x42a8('0x46')]['sort']);_0x3b2f9e[_0x42a8('0x50')]=qs[_0x42a8('0x48')](_[_0x42a8('0x51')](_0x46c46f[_0x42a8('0x46')],_0x43bf21[_0x42a8('0x48')]));if(_0x46c46f[_0x42a8('0x46')][_0x42a8('0x52')]){_0x3b2f9e[_0x42a8('0x50')]=_[_0x42a8('0x53')](_0x3b2f9e[_0x42a8('0x50')],{'$or':_[_0x42a8('0x40')](_0x3b2f9e[_0x42a8('0x49')],function(_0x5c8360){var _0x50bc04={};_0x50bc04[_0x5c8360]={'$like':'%'+_0x46c46f[_0x42a8('0x46')][_0x42a8('0x52')]+'%'};return _0x50bc04;})});}_0x3b2f9e=_['merge']({},_0x3b2f9e,_0x46c46f[_0x42a8('0x56')]);return _0x215d6b[_0x42a8('0xbc')](_0x3b2f9e);}})[_0x42a8('0x37')](function(_0x2464c3){if(_0x2464c3){_0x4309b4=_0x2464c3['length'];if(!_0x46c46f[_0x42a8('0x46')][_0x42a8('0x70')](_0x42a8('0x6b'))){_0x3b2f9e[_0x42a8('0x4d')]=qs[_0x42a8('0x4d')](_0x46c46f['query']['limit']);_0x3b2f9e[_0x42a8('0x31')]=qs[_0x42a8('0x31')](_0x46c46f[_0x42a8('0x46')]['offset']);}return _0x215d6b[_0x42a8('0xbc')](_0x3b2f9e);}})['then'](function(_0x323d38){if(_0x323d38){return _0x323d38?{'count':_0x4309b4,'rows':_0x323d38}:null;}})['then'](respondWithResult(_0x1acd86,null))[_0x42a8('0x2c')](handleError(_0x1acd86,null));};exports[_0x42a8('0xbd')]=function(_0x2e289e,_0x5bafc8,_0x40262e){var _0x20c5a3={'raw':![],'where':{}};var _0x2e7f2d={};var _0xf497e={'count':0x0,'rows':[]};return db['SmsAccount'][_0x42a8('0x6a')]({'where':{'id':_0x2e289e[_0x42a8('0x5c')]['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x5bafc8,null))['then'](function(_0x5ec189){if(_0x5ec189){_0x2e7f2d[_0x42a8('0x45')]=_['keys'](db[_0x42a8('0xa1')]['rawAttributes']);_0x2e7f2d[_0x42a8('0x46')]=_['keys'](_0x2e289e[_0x42a8('0x46')]);_0x2e7f2d[_0x42a8('0x48')]=_['intersection'](_0x2e7f2d['model'],_0x2e7f2d[_0x42a8('0x46')]);_0x20c5a3[_0x42a8('0x49')]=_[_0x42a8('0x4a')](_0x2e7f2d[_0x42a8('0x45')],qs[_0x42a8('0x4b')](_0x2e289e[_0x42a8('0x46')][_0x42a8('0x4b')]));_0x20c5a3[_0x42a8('0x49')]=_0x20c5a3['attributes']['length']?_0x20c5a3[_0x42a8('0x49')]:_0x2e7f2d['model'];if(!_0x2e289e[_0x42a8('0x46')][_0x42a8('0x70')](_0x42a8('0x6b'))){_0x20c5a3['limit']=qs[_0x42a8('0x4d')](_0x2e289e[_0x42a8('0x46')][_0x42a8('0x4d')]);_0x20c5a3[_0x42a8('0x31')]=qs[_0x42a8('0x31')](_0x2e289e['query'][_0x42a8('0x31')]);}_0x20c5a3[_0x42a8('0x4e')]=qs[_0x42a8('0x4f')](_0x2e289e[_0x42a8('0x46')]['sort']);_0x20c5a3['where']=qs[_0x42a8('0x48')](_['pick'](_0x2e289e['query'],_0x2e7f2d['filters']));_0x20c5a3[_0x42a8('0x50')][_0x42a8('0x67')]=_0x5ec189['id'];if(_0x2e289e[_0x42a8('0x46')]['filter']){_0x20c5a3[_0x42a8('0x50')]=_[_0x42a8('0x53')](_0x20c5a3[_0x42a8('0x50')],{'$or':_['map'](_0x20c5a3[_0x42a8('0x49')],function(_0x591577){var _0x4507dc={};_0x4507dc[_0x591577]={'$like':'%'+_0x2e289e[_0x42a8('0x46')][_0x42a8('0x52')]+'%'};return _0x4507dc;})});}_0x20c5a3=_[_0x42a8('0x53')]({},_0x20c5a3,_0x2e289e['options']);return db[_0x42a8('0xa1')][_0x42a8('0x30')]({'where':_0x20c5a3[_0x42a8('0x50')]})[_0x42a8('0x37')](function(_0x5b6862){_0xf497e[_0x42a8('0x30')]=_0x5b6862;if(_0x2e289e['query']['includeAll']){_0x20c5a3['include']=[{'model':db[_0x42a8('0x78')],'as':_0x42a8('0xbe'),'required':![]},{'model':db[_0x42a8('0xad')],'as':_0x42a8('0xbf'),'attributes':[_0x42a8('0x3c'),_0x42a8('0xc0'),_0x42a8('0xc1')],'required':![]},{'model':db[_0x42a8('0xc2')],'as':_0x42a8('0xc3'),'attributes':['id',_0x42a8('0x3c'),_0x42a8('0xc4')],'where':_0x2e289e[_0x42a8('0x46')][_0x42a8('0xc5')]?{'id':_0x2e289e[_0x42a8('0x46')][_0x42a8('0xc5')]}:undefined,'required':_0x2e289e[_0x42a8('0x46')][_0x42a8('0xc5')]?!![]:![]}];}return db[_0x42a8('0xa1')][_0x42a8('0x59')](_0x20c5a3);})[_0x42a8('0x37')](function(_0xd7b20b){_0xf497e[_0x42a8('0x5a')]=_0xd7b20b;return _0xf497e;});}})['then'](respondWithFilteredResult(_0x5bafc8,_0x20c5a3))['catch'](handleError(_0x5bafc8,null));};exports[_0x42a8('0x3d')]=function(_0x3d9873,_0x24614b,_0x36f5c6){var _0x44744e,_0x3430fa,_0x247ca8;if(_[_0x42a8('0x96')](_0x3d9873[_0x42a8('0x60')][_0x42a8('0x60')])||_0x3d9873[_0x42a8('0x60')][_0x42a8('0x60')]===''){throw new db[(_0x42a8('0x79'))]['ValidationError'](_0x42a8('0xc6'));}if(_[_0x42a8('0x96')](_0x3d9873['body']['to'])){throw new db[(_0x42a8('0x79'))][(_0x42a8('0x97'))](_0x42a8('0xc7'));}_0x44744e=_0x3d9873['body']['to'];return db[_0x42a8('0x41')][_0x42a8('0x5e')]({'where':{'id':_0x3d9873['params']['id']},'include':[{'model':db['CmList'],'as':_0x42a8('0xc8'),'include':[{'model':db['CmContact'],'as':_0x42a8('0x9c'),'where':{'mobile':_0x44744e},'limit':0x1,'order':[[_0x42a8('0x7c'),_0x42a8('0x9d')]]}]}]})[_0x42a8('0x37')](handleEntityNotFound(_0x24614b,null))[_0x42a8('0x37')](function(_0xb0ab89){if(_0xb0ab89&&_0xb0ab89[_0x42a8('0xc8')]){_0x3430fa=_0xb0ab89[_0x42a8('0x39')]({'plain':!![]});if(_0x3430fa[_0x42a8('0xc8')]&&_0x3430fa[_0x42a8('0xc8')][_0x42a8('0x9c')][_0x42a8('0x4c')]){return _0x3430fa[_0x42a8('0xc8')][_0x42a8('0x9c')][0x0];}return db['CmContact'][_0x42a8('0x5f')](_[_0x42a8('0x1b')](_0x3d9873[_0x42a8('0x60')],{'firstName':_0x44744e,'mobile':_0x44744e,'phone':_0x44744e,'ListId':_0x3430fa['ListId']}));}})[_0x42a8('0x37')](handleEntityNotFound(_0x24614b,null))[_0x42a8('0x37')](function(_0x28a13a){if(_0x28a13a){_0x247ca8=_0x28a13a;return db[_0x42a8('0xa1')][_0x42a8('0x5e')]({'where':{'ContactId':_0x247ca8['id'],'closed':![],'SmsAccountId':_0x3430fa['id']}})['then'](function(_0x1093ee){if(_0x1093ee){return[_0x1093ee,![]];}return db[_0x42a8('0xa1')][_0x42a8('0x5f')]({'UserId':_0x3d9873[_0x42a8('0x61')]['id'],'ContactId':_0x247ca8['id'],'SmsAccountId':_0x3430fa['id'],'phone':_0x44744e,'firstMsgDirection':_0x42a8('0xc9'),'Messages':[_[_0x42a8('0x53')](_0x3d9873[_0x42a8('0x60')],{'read':![],'body':_0x3d9873[_0x42a8('0x60')][_0x42a8('0x60')],'phone':_0x44744e,'SmsAccountId':_0x3430fa['id'],'UserId':_0x3d9873[_0x42a8('0x61')]['id'],'ContactId':_0x247ca8['id']})]},{'include':[{'model':db[_0x42a8('0xa9')],'as':_0x42a8('0xca')}]})[_0x42a8('0x37')](function(_0xb40727){return[_0xb40727,!![]];});});}})['spread'](function(_0x46e52f,_0x9141e8){if(_0x9141e8){return _0x46e52f;}return db[_0x42a8('0xa9')][_0x42a8('0x5f')](_[_0x42a8('0x53')](_0x3d9873[_0x42a8('0x60')],{'read':![],'body':_0x3d9873[_0x42a8('0x60')][_0x42a8('0x60')],'phone':_0x44744e,'SmsAccountId':_0x3430fa['id'],'SmsInteractionId':_0x46e52f['id'],'UserId':_0x3d9873[_0x42a8('0x61')]['id'],'ContactId':_0x247ca8['id']}))['then'](function(_0x22fc78){_0x46e52f[_0x42a8('0xcb')][_0x42a8('0xca')]=[];_0x46e52f['dataValues'][_0x42a8('0xca')]['push'](_0x22fc78[_0x42a8('0xcb')]);return _0x46e52f;});})[_0x42a8('0x37')](respondWithResult(_0x24614b,null))['catch'](handleError(_0x24614b,null));};exports[_0x42a8('0x32')]=function(_0x3b1c7f,_0x54223b,_0x403c46){if(_0x3b1c7f[_0x42a8('0x60')]['id']){delete _0x3b1c7f['body']['id'];}console[_0x42a8('0xcc')](_0x42a8('0xcd'),_0x3b1c7f['body']);var _0x40827f,_0x32cf7a,_0x45ec0f;return db['SmsAccount'][_0x42a8('0x5e')]({'where':{'id':_0x3b1c7f['params']['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x54223b,null))[_0x42a8('0x37')](function(_0x4b829b){if(_0x4b829b){_0x45ec0f=_0x4b829b;logger['debug'](_0x42a8('0x27'),_0x42a8('0x32'),_0x42a8('0xce'),_0x4b829b[_0x42a8('0x54')],util[_0x42a8('0xcf')](_0x3b1c7f[_0x42a8('0x60')],{'showHidden':![],'depth':null}));switch(_0x4b829b[_0x42a8('0x54')]){case _0x42a8('0x84'):if(_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0xd0')]&&_0x3b1c7f['body']['status']){_0x32cf7a=_0x3b1c7f[_0x42a8('0x60')]['status'];return db[_0x42a8('0xa9')][_0x42a8('0x5e')]({'where':{'messageId':_0x3b1c7f[_0x42a8('0x60')]['skebby_dispatch_id']}});}break;case _0x42a8('0xd1'):if(_0x3b1c7f['body'][_0x42a8('0xd2')]&&_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0xd3')]){_0x32cf7a=_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0xd3')];return db[_0x42a8('0xa9')][_0x42a8('0x5e')]({'where':{'messageId':_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0xd2')]}});}break;case'clicksend':if(_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0x88')]&&_0x3b1c7f['body'][_0x42a8('0xd4')]){_0x32cf7a=_0x3b1c7f[_0x42a8('0x60')]['status_code'];return db['SmsMessage'][_0x42a8('0x5e')]({'where':{'messageId':_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0x88')]}});}break;case _0x42a8('0x8b'):var _0xb3f184=_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0x8c')][0x0];if(_0xb3f184[_0x42a8('0x87')]&&_0xb3f184[_0x42a8('0x32')]['groupName']===_0x42a8('0xd5')){_0x32cf7a=_0xb3f184[_0x42a8('0x32')][_0x42a8('0xd6')];return db[_0x42a8('0xa9')]['find']({'where':{'messageId':_0xb3f184[_0x42a8('0x87')]}});}break;case _0x42a8('0x91'):if(_0x3b1c7f['body'][_0x42a8('0x87')]&&_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0x32')]){_0x32cf7a=_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0x32')];return db[_0x42a8('0xa9')][_0x42a8('0x5e')]({'where':{'messageId':_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0x87')]}});}break;case _0x42a8('0x94'):if(_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0xd7')]&&_0x3b1c7f['body']['status']){_0x32cf7a=_0x3b1c7f['body'][_0x42a8('0x32')];return db['SmsMessage'][_0x42a8('0x5e')]({'where':{'messageId':_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0xd7')]}});}break;}}})[_0x42a8('0x37')](handleEntityNotFound(_0x54223b,null))['then'](function(_0x39c65e){if(_0x39c65e){_0x40827f=_0x39c65e;switch(_0x45ec0f['type']){case'skebby':if(_0x32cf7a===_0x42a8('0xd5')){return _0x40827f['update']({'read':!![]});}else{logger[_0x42a8('0x29')](_0x42a8('0x27'),_0x42a8('0x32'),_0x42a8('0x84'),util[_0x42a8('0xcf')](_0x3b1c7f['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x32cf7a==='1'){return _0x40827f['update']({'read':!![]});}else{logger[_0x42a8('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x42a8('0x32'),_0x42a8('0x84'),util[_0x42a8('0xcf')](_0x3b1c7f['body'],{'showHidden':![],'depth':null}));}break;case _0x42a8('0x86'):if(!_0x3b1c7f[_0x42a8('0x60')][_0x42a8('0xd8')]&&_0x32cf7a>=0xc8&&_0x32cf7a<=0xce){return _0x40827f['update']({'read':!![]});}else{logger['error'](_0x42a8('0x27'),_0x42a8('0x32'),'clicksend',util[_0x42a8('0xcf')](_0x3b1c7f[_0x42a8('0x60')],{'showHidden':![],'depth':null}));}break;case _0x42a8('0x8b'):var _0x7901ff=_0x3b1c7f['body'][_0x42a8('0x8c')][0x0];if(_0x7901ff[_0x42a8('0x32')][_0x42a8('0xd6')]===_0x42a8('0xd5')){return _0x40827f[_0x42a8('0x36')]({'read':!![]});}else{logger['error'](_0x42a8('0x27'),_0x42a8('0x32'),'infobip',util[_0x42a8('0xcf')](_0x3b1c7f[_0x42a8('0x60')],{'showHidden':![],'depth':null}));}break;case _0x42a8('0x91'):if(_0x32cf7a==_0x42a8('0xd9')||_0x32cf7a==_0x42a8('0xda')){return _0x40827f[_0x42a8('0x36')]({'read':!![]});}else{logger['error'](_0x42a8('0x27'),_0x42a8('0x32'),_0x42a8('0x91'),util['inspect'](_0x3b1c7f[_0x42a8('0x60')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x32cf7a===_0x42a8('0xdb')||_0x32cf7a===_0x42a8('0xdc')){return _0x40827f[_0x42a8('0x36')]({'read':!![]});}else{logger[_0x42a8('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','intelepeer',util[_0x42a8('0xcf')](_0x3b1c7f[_0x42a8('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x40827f;}})[_0x42a8('0x37')](respondWithResult(_0x54223b,null))['catch'](handleError(_0x54223b,null));};exports[_0x42a8('0xdd')]=function(_0x2795c3,_0x2b7091,_0x2ec476){var _0x372e58,_0x4cbf16,_0x55c77d;return db[_0x42a8('0x41')]['find']({'where':{'id':_0x2795c3[_0x42a8('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2b7091,null))[_0x42a8('0x37')](function(_0x408559){if(_0x408559){_0x55c77d=_0x408559;logger[_0x42a8('0x26')](_0x42a8('0x27'),_0x42a8('0x32'),_0x42a8('0xce'),_0x408559[_0x42a8('0x54')],util['inspect'](_0x2795c3[_0x42a8('0x46')],{'showHidden':![],'depth':null}));switch(_0x408559[_0x42a8('0x54')]){case _0x42a8('0x8e'):if(_0x2795c3['query'][_0x42a8('0xde')]&&_0x2795c3[_0x42a8('0x46')][_0x42a8('0xdf')]){_0x4cbf16=_0x2795c3[_0x42a8('0x46')][_0x42a8('0xdf')];return db['SmsMessage']['find']({'where':{'messageId':_0x2795c3[_0x42a8('0x46')][_0x42a8('0xde')]}});}break;}}})['then'](handleEntityNotFound(_0x2b7091,null))['then'](function(_0x1221a9){if(_0x1221a9){_0x372e58=_0x1221a9;switch(_0x55c77d[_0x42a8('0x54')]){case'csc':if(_0x4cbf16==='2'||_0x4cbf16==='6'){return _0x372e58['update']({'read':!![]});}else{logger[_0x42a8('0x29')](_0x42a8('0x27'),_0x42a8('0x32'),'csc',util[_0x42a8('0xcf')](_0x2795c3[_0x42a8('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x372e58;}})['then'](respondWithResult(_0x2b7091,null))[_0x42a8('0x2c')](handleError(_0x2b7091,null));};exports[_0x42a8('0xe0')]=function(_0xfea099,_0x64046b,_0x47ab1e){return db[_0x42a8('0x41')][_0x42a8('0x5e')]({'where':{'id':_0xfea099['params']['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x64046b,null))[_0x42a8('0x37')](function(_0xc32ca5){if(_0xc32ca5){return _0xc32ca5['addAgents'](_0xfea099['body']['ids'],_[_0x42a8('0x9f')](_0xfea099[_0x42a8('0x60')],[_0x42a8('0x6d'),'id'])||{})[_0x42a8('0xa2')](function(_0x415cde){for(var _0x1674ba=0x0;_0x1674ba<_0xfea099[_0x42a8('0x60')]['ids'][_0x42a8('0x4c')];_0x1674ba+=0x1){socket[_0x42a8('0xe1')](_0x42a8('0xe2'),{'UserId':_0xfea099['body'][_0x42a8('0x6d')][_0x1674ba],'SmsAccountId':_0xfea099[_0x42a8('0x5c')]['id']});}return _0x415cde;});}})[_0x42a8('0x37')](respondWithResult(_0x64046b,null))[_0x42a8('0x2c')](handleError(_0x64046b,null));};exports[_0x42a8('0xe3')]=function(_0x20b86c,_0x428ff2,_0x389704){return db[_0x42a8('0x41')][_0x42a8('0x5e')]({'where':{'id':_0x20b86c[_0x42a8('0x5c')]['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0x428ff2,null))[_0x42a8('0x37')](function(_0x3615e8){if(_0x3615e8){return _0x3615e8[_0x42a8('0xe3')](_0x20b86c[_0x42a8('0x46')]['ids'])[_0x42a8('0x37')](function(){if(_['isArray'](_0x20b86c[_0x42a8('0x46')][_0x42a8('0x6d')])){for(var _0x6fa2bd=0x0;_0x6fa2bd<_0x20b86c[_0x42a8('0x46')]['ids'][_0x42a8('0x4c')];_0x6fa2bd+=0x1){socket['emit'](_0x42a8('0xe4'),{'UserId':Number(_0x20b86c['query'][_0x42a8('0x6d')][_0x6fa2bd]),'SmsAccountId':Number(_0x20b86c[_0x42a8('0x5c')]['id'])});}}else{socket[_0x42a8('0xe1')](_0x42a8('0xe4'),{'UserId':Number(_0x20b86c[_0x42a8('0x46')][_0x42a8('0x6d')]),'SmsAccountId':Number(_0x20b86c[_0x42a8('0x5c')]['id'])});}});}})[_0x42a8('0x37')](respondWithStatusCode(_0x428ff2,null))[_0x42a8('0x2c')](handleError(_0x428ff2,null));};exports[_0x42a8('0xe5')]=function(_0x46b784,_0xe50a61,_0x1da122){var _0x40bcb8={};var _0x275776={};var _0x2702b1;var _0x5bd5c3;return db['SmsAccount'][_0x42a8('0x6a')]({'where':{'id':_0x46b784['params']['id']}})[_0x42a8('0x37')](handleEntityNotFound(_0xe50a61,null))[_0x42a8('0x37')](function(_0x232bdf){if(_0x232bdf){_0x2702b1=_0x232bdf;_0x275776[_0x42a8('0x45')]=_[_0x42a8('0x47')](db[_0x42a8('0xad')][_0x42a8('0x42')]);_0x275776[_0x42a8('0x46')]=_[_0x42a8('0x47')](_0x46b784[_0x42a8('0x46')]);_0x275776[_0x42a8('0x48')]=_[_0x42a8('0x4a')](_0x275776[_0x42a8('0x45')],_0x275776[_0x42a8('0x46')]);_0x40bcb8[_0x42a8('0x49')]=_[_0x42a8('0x4a')](_0x275776['model'],qs[_0x42a8('0x4b')](_0x46b784['query'][_0x42a8('0x4b')]));_0x40bcb8[_0x42a8('0x49')]=_0x40bcb8[_0x42a8('0x49')][_0x42a8('0x4c')]?_0x40bcb8[_0x42a8('0x49')]:_0x275776[_0x42a8('0x45')];_0x40bcb8[_0x42a8('0x4e')]=qs['sort'](_0x46b784[_0x42a8('0x46')][_0x42a8('0x4f')]);_0x40bcb8[_0x42a8('0x50')]=qs[_0x42a8('0x48')](_[_0x42a8('0x51')](_0x46b784['query'],_0x275776[_0x42a8('0x48')]));if(_0x46b784[_0x42a8('0x46')]['filter']){_0x40bcb8[_0x42a8('0x50')]=_[_0x42a8('0x53')](_0x40bcb8[_0x42a8('0x50')],{'$or':_[_0x42a8('0x40')](_0x40bcb8[_0x42a8('0x49')],function(_0x2d4ed1){var _0x244e3d={};_0x244e3d[_0x2d4ed1]={'$like':'%'+_0x46b784[_0x42a8('0x46')][_0x42a8('0x52')]+'%'};return _0x244e3d;})});}_0x40bcb8=_[_0x42a8('0x53')]({},_0x40bcb8,_0x46b784[_0x42a8('0x56')]);return _0x2702b1['getAgents'](_0x40bcb8);}})[_0x42a8('0x37')](function(_0x430375){if(_0x430375){_0x5bd5c3=_0x430375['length'];if(!_0x46b784[_0x42a8('0x46')][_0x42a8('0x70')](_0x42a8('0x6b'))){_0x40bcb8[_0x42a8('0x4d')]=qs[_0x42a8('0x4d')](_0x46b784[_0x42a8('0x46')][_0x42a8('0x4d')]);_0x40bcb8[_0x42a8('0x31')]=qs[_0x42a8('0x31')](_0x46b784[_0x42a8('0x46')]['offset']);}return _0x2702b1[_0x42a8('0xe5')](_0x40bcb8);}})[_0x42a8('0x37')](function(_0xe34b9f){if(_0xe34b9f){return _0xe34b9f?{'count':_0x5bd5c3,'rows':_0xe34b9f}:null;}})[_0x42a8('0x37')](respondWithResult(_0xe50a61,null))[_0x42a8('0x2c')](handleError(_0xe50a61,null));}; \ No newline at end of file +var _0x06d6=['UserProfileResource','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SmsAccount','count','includeAll','include','findAll','rows','show','params','Pause','mandatoryDispositionPause','intersection','create','user','get','role','SmsAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','mobile','account','twilio','from','From','Body','messageId','skebby','sender','text','plivo','MessageUUID','infobip','results','csc','clickatell','replyMessageId','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','omit','Contacts','defaults','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','set','send','\x0a','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','List','out','Messages','spread','SmsMessage','dataValues','log','endpoint\x20/status\x20POST\x20/','inspect','skebby_dispatch_id','connectel','statusInt','requestid','clicksend','message_id','status_code','groupName','redif','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','eml-format','rimraf','bluebird','util','path','sox','to-csv','ejs','lodash','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','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','destroy','then'];(function(_0x145f26,_0x5b5422){var _0x435fa5=function(_0x3a01c6){while(--_0x3a01c6){_0x145f26['push'](_0x145f26['shift']());}};_0x435fa5(++_0x5b5422);}(_0x06d6,0x18c));var _0x606d=function(_0x4f4e82,_0xae3ad5){_0x4f4e82=_0x4f4e82-0x0;var _0x2f4761=_0x06d6[_0x4f4e82];return _0x2f4761;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x606d('0x0'));var rimraf=require(_0x606d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x606d('0x2'));var Mustache=require('mustache');var util=require(_0x606d('0x3'));var path=require(_0x606d('0x4'));var sox=require(_0x606d('0x5'));var csv=require(_0x606d('0x6'));var ejs=require(_0x606d('0x7'));var fs=require('fs');var _=require(_0x606d('0x8'));var squel=require(_0x606d('0x9'));var crypto=require(_0x606d('0xa'));var jsforce=require(_0x606d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x606d('0xc'));var Papa=require('papaparse');var Redis=require(_0x606d('0xd'));var authService=require(_0x606d('0xe'));var qs=require(_0x606d('0xf'));var as=require(_0x606d('0x10'));var hardwareService=require(_0x606d('0x11'));var logger=require(_0x606d('0x12'))(_0x606d('0x13'));var utils=require(_0x606d('0x14'));var config=require(_0x606d('0x15'));var licenseUtil=require(_0x606d('0x16'));var db=require(_0x606d('0x17'))['db'];config[_0x606d('0x18')]=_['defaults'](config['redis'],{'host':_0x606d('0x19'),'port':0x18eb});var socket=require(_0x606d('0x1a'))(new Redis(config[_0x606d('0x18')]));require('./smsAccount.socket')[_0x606d('0x1b')](socket);var jayson=require(_0x606d('0x1c'));var client=jayson[_0x606d('0x1d')][_0x606d('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x14f6e7,_0x3d2a21,_0x26dcff,_0x4d0823){return new BPromise(function(_0x2fcd66,_0x311e6d){var _0x53d4b6=_0x4d0823||client;return _0x53d4b6['request'](_0x14f6e7,_0x26dcff)['then'](function(_0x1db611){logger[_0x606d('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x3d2a21,_0x606d('0x20'));logger['debug'](_0x606d('0x21'),_0x3d2a21,_0x606d('0x20'),JSON[_0x606d('0x22')](_0x1db611));if(_0x1db611[_0x606d('0x23')]){if(_0x1db611[_0x606d('0x23')][_0x606d('0x24')]===0x1f4){logger['error'](_0x606d('0x25'),_0x3d2a21,_0x1db611[_0x606d('0x23')]['message']);return _0x311e6d(_0x1db611[_0x606d('0x23')][_0x606d('0x26')]);}logger[_0x606d('0x23')](_0x606d('0x25'),_0x3d2a21,_0x1db611[_0x606d('0x23')]['message']);return _0x2fcd66(_0x1db611[_0x606d('0x23')][_0x606d('0x26')]);}else{logger[_0x606d('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x3d2a21,_0x606d('0x20'));_0x2fcd66(_0x1db611['result'][_0x606d('0x26')]);}})[_0x606d('0x27')](function(_0x352ff0){logger[_0x606d('0x23')](_0x606d('0x25'),_0x3d2a21,_0x352ff0);_0x311e6d(_0x352ff0);});});}function respondWithStatusCode(_0x305cc5,_0x575d33){_0x575d33=_0x575d33||0xcc;return function(_0x3c9174){if(_0x3c9174){return _0x305cc5[_0x606d('0x28')](_0x575d33);}return _0x305cc5[_0x606d('0x29')](_0x575d33)[_0x606d('0x2a')]();};}function respondWithResult(_0x2b4395,_0x353459){_0x353459=_0x353459||0xc8;return function(_0xa3897){if(_0xa3897){return _0x2b4395[_0x606d('0x29')](_0x353459)[_0x606d('0x2b')](_0xa3897);}};}function respondWithFilteredResult(_0x37bcbf,_0x3971fe){return function(_0x33ad2b){if(_0x33ad2b){var _0x1877e8=_0x33ad2b['count'],_0x40803e=_0x3971fe[_0x606d('0x2c')],_0x38cf64=_0x3971fe[_0x606d('0x2c')]+_0x3971fe[_0x606d('0x2d')],_0x1e6d6c;if(_0x38cf64>=_0x1877e8){_0x38cf64=_0x1877e8;_0x1e6d6c=0xc8;}else{_0x1e6d6c=0xce;}_0x37bcbf[_0x606d('0x29')](_0x1e6d6c);return _0x37bcbf['set'](_0x606d('0x2e'),_0x40803e+'-'+_0x38cf64+'/'+_0x1877e8)[_0x606d('0x2b')](_0x33ad2b);}return null;};}function patchUpdates(_0x412742){return function(_0x40d26c){try{jsonpatch[_0x606d('0x2f')](_0x40d26c,_0x412742,!![]);}catch(_0x47a5d6){return BPromise[_0x606d('0x30')](_0x47a5d6);}return _0x40d26c[_0x606d('0x31')]();};}function saveUpdates(_0x99272a,_0x10045f){return function(_0x3c7305){if(_0x3c7305){return _0x3c7305['update'](_0x99272a)['then'](function(_0x1bc968){return _0x1bc968;});}return null;};}function removeEntity(_0x47cb88,_0x11d6da){return function(_0x9bb571){if(_0x9bb571){return _0x9bb571[_0x606d('0x32')]()[_0x606d('0x33')](function(){var _0x35ca9b=_0x9bb571['get']({'plain':!![]});var _0x34b52e='SmsAccounts';return db[_0x606d('0x34')][_0x606d('0x32')]({'where':{'type':_0x34b52e,'resourceId':_0x35ca9b['id']}})[_0x606d('0x33')](function(){return _0x9bb571;});})[_0x606d('0x33')](function(){_0x47cb88[_0x606d('0x29')](0xcc)[_0x606d('0x2a')]();});}};}function handleEntityNotFound(_0x14ed11,_0x300855){return function(_0x41d72b){if(!_0x41d72b){_0x14ed11['sendStatus'](0x194);}return _0x41d72b;};}function handleError(_0x2c8698,_0x28b0eb){_0x28b0eb=_0x28b0eb||0x1f4;return function(_0x30cdba){logger[_0x606d('0x23')](_0x30cdba[_0x606d('0x35')]);if(_0x30cdba[_0x606d('0x36')]){delete _0x30cdba[_0x606d('0x36')];}_0x2c8698[_0x606d('0x29')](_0x28b0eb)['send'](_0x30cdba);};}exports[_0x606d('0x37')]=function(_0x52b7a2,_0x383eda){var _0xc737c6={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xea3718={},_0x5d865b={'count':0x0,'rows':[]};var _0x2f7bcc=_[_0x606d('0x38')](db['SmsAccount'][_0x606d('0x39')],function(_0x2b9738){return{'name':_0x2b9738['fieldName'],'type':_0x2b9738[_0x606d('0x3a')][_0x606d('0x3b')]};});_0xea3718[_0x606d('0x3c')]=_[_0x606d('0x38')](_0x2f7bcc,_0x606d('0x36'));_0xea3718[_0x606d('0x3d')]=_[_0x606d('0x3e')](_0x52b7a2[_0x606d('0x3d')]);_0xea3718[_0x606d('0x3f')]=_['intersection'](_0xea3718[_0x606d('0x3c')],_0xea3718[_0x606d('0x3d')]);_0xc737c6[_0x606d('0x40')]=_['intersection'](_0xea3718[_0x606d('0x3c')],qs[_0x606d('0x41')](_0x52b7a2[_0x606d('0x3d')][_0x606d('0x41')]));_0xc737c6[_0x606d('0x40')]=_0xc737c6[_0x606d('0x40')][_0x606d('0x42')]?_0xc737c6['attributes']:_0xea3718[_0x606d('0x3c')];if(!_0x52b7a2[_0x606d('0x3d')]['hasOwnProperty'](_0x606d('0x43'))){_0xc737c6[_0x606d('0x2d')]=qs[_0x606d('0x2d')](_0x52b7a2[_0x606d('0x3d')][_0x606d('0x2d')]);_0xc737c6['offset']=qs[_0x606d('0x2c')](_0x52b7a2['query'][_0x606d('0x2c')]);}_0xc737c6[_0x606d('0x44')]=qs[_0x606d('0x45')](_0x52b7a2[_0x606d('0x3d')][_0x606d('0x45')]);_0xc737c6[_0x606d('0x46')]=qs['filters'](_[_0x606d('0x47')](_0x52b7a2[_0x606d('0x3d')],_0xea3718[_0x606d('0x3f')]),_0x2f7bcc);if(_0x52b7a2['query'][_0x606d('0x48')]){_0xc737c6[_0x606d('0x46')]=_['merge'](_0xc737c6['where'],{'$or':_[_0x606d('0x38')](_0x2f7bcc,function(_0x5c42b8){if(_0x5c42b8['type']!==_0x606d('0x49')){var _0x468f7f={};_0x468f7f[_0x5c42b8[_0x606d('0x36')]]={'$like':'%'+_0x52b7a2[_0x606d('0x3d')][_0x606d('0x48')]+'%'};return _0x468f7f;}})});}_0xc737c6=_[_0x606d('0x4a')]({},_0xc737c6,_0x52b7a2[_0x606d('0x4b')]);var _0x528c1c={'where':_0xc737c6[_0x606d('0x46')]};return db[_0x606d('0x4c')][_0x606d('0x4d')](_0x528c1c)[_0x606d('0x33')](function(_0x517a56){_0x5d865b[_0x606d('0x4d')]=_0x517a56;if(_0x52b7a2[_0x606d('0x3d')][_0x606d('0x4e')]){_0xc737c6[_0x606d('0x4f')]=[{'all':!![]}];}return db[_0x606d('0x4c')][_0x606d('0x50')](_0xc737c6);})['then'](function(_0x18bb86){_0x5d865b[_0x606d('0x51')]=_0x18bb86;return _0x5d865b;})[_0x606d('0x33')](respondWithFilteredResult(_0x383eda,_0xc737c6))[_0x606d('0x27')](handleError(_0x383eda,null));};exports[_0x606d('0x52')]=function(_0x5159d7,_0x52e90e){var _0x5d0fc9={'raw':![],'where':{'id':_0x5159d7[_0x606d('0x53')]['id']},'include':[{'model':db[_0x606d('0x54')],'as':_0x606d('0x55')}]},_0x4ec89e={};_0x4ec89e['model']=_['keys'](db[_0x606d('0x4c')][_0x606d('0x39')]);_0x4ec89e[_0x606d('0x3d')]=_[_0x606d('0x3e')](_0x5159d7['query']);_0x4ec89e[_0x606d('0x3f')]=_[_0x606d('0x56')](_0x4ec89e[_0x606d('0x3c')],_0x4ec89e[_0x606d('0x3d')]);_0x5d0fc9['attributes']=_[_0x606d('0x56')](_0x4ec89e[_0x606d('0x3c')],qs[_0x606d('0x41')](_0x5159d7[_0x606d('0x3d')][_0x606d('0x41')]));_0x5d0fc9['attributes']=_0x5d0fc9[_0x606d('0x40')][_0x606d('0x42')]?_0x5d0fc9['attributes']:_0x4ec89e['model'];if(_0x5159d7['query'][_0x606d('0x4e')]){_0x5d0fc9[_0x606d('0x4f')]=[{'all':!![]}];}_0x5d0fc9=_[_0x606d('0x4a')]({},_0x5d0fc9,_0x5159d7[_0x606d('0x4b')]);return db[_0x606d('0x4c')]['find'](_0x5d0fc9)[_0x606d('0x33')](handleEntityNotFound(_0x52e90e,null))[_0x606d('0x33')](respondWithResult(_0x52e90e,null))['catch'](handleError(_0x52e90e,null));};exports[_0x606d('0x57')]=function(_0x244489,_0x20fc85){return db[_0x606d('0x4c')]['create'](_0x244489['body'],{})[_0x606d('0x33')](function(_0x43b1a8){var _0x205e25=_0x244489[_0x606d('0x58')][_0x606d('0x59')]({'plain':!![]});if(!_0x205e25)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x205e25[_0x606d('0x5a')]==='user'){var _0x596971=_0x43b1a8[_0x606d('0x59')]({'plain':!![]});var _0xdc0585=_0x606d('0x5b');return db[_0x606d('0x5c')][_0x606d('0x5d')]({'where':{'name':_0xdc0585,'userProfileId':_0x205e25[_0x606d('0x5e')]},'raw':!![]})['then'](function(_0x50a447){if(_0x50a447&&_0x50a447[_0x606d('0x5f')]===0x0){return db[_0x606d('0x34')][_0x606d('0x57')]({'name':_0x596971[_0x606d('0x36')],'resourceId':_0x596971['id'],'type':_0x50a447[_0x606d('0x36')],'sectionId':_0x50a447['id']},{})['then'](function(){return _0x43b1a8;});}else{return _0x43b1a8;}})['catch'](function(_0x3da90e){logger[_0x606d('0x23')](_0x606d('0x60'),_0x3da90e);throw _0x3da90e;});}return _0x43b1a8;})['then'](respondWithResult(_0x20fc85,0xc9))['catch'](handleError(_0x20fc85,null));};exports[_0x606d('0x61')]=function(_0x3921c2,_0x2d9b51){if(_0x3921c2['body']['id']){delete _0x3921c2[_0x606d('0x62')]['id'];}return db[_0x606d('0x4c')][_0x606d('0x5d')]({'where':{'id':_0x3921c2[_0x606d('0x53')]['id']},'include':[{'model':db[_0x606d('0x54')],'as':_0x606d('0x55')}]})['then'](handleEntityNotFound(_0x2d9b51,null))[_0x606d('0x33')](saveUpdates(_0x3921c2['body'],null))[_0x606d('0x33')](respondWithResult(_0x2d9b51,null))[_0x606d('0x27')](handleError(_0x2d9b51,null));};exports['destroy']=function(_0x4983ec,_0x4557ff){return db[_0x606d('0x4c')]['find']({'where':{'id':_0x4983ec[_0x606d('0x53')]['id']}})['then'](handleEntityNotFound(_0x4557ff,null))['then'](removeEntity(_0x4557ff,null))['catch'](handleError(_0x4557ff,null));};exports[_0x606d('0x63')]=function(_0x4b0601,_0x5a3d2e){return db[_0x606d('0x4c')][_0x606d('0x63')]()['then'](respondWithResult(_0x5a3d2e,null))[_0x606d('0x27')](handleError(_0x5a3d2e,null));};exports[_0x606d('0x64')]=function(_0xfd1536,_0x40eadd,_0x3d5e0c){if(_0xfd1536['body']['id']){delete _0xfd1536['body']['id'];}return db['SmsAccount'][_0x606d('0x5d')]({'where':{'id':_0xfd1536['params']['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x40eadd,null))[_0x606d('0x33')](function(_0xe1f07f){if(_0xe1f07f){_0xfd1536[_0x606d('0x62')][_0x606d('0x65')]=_0xe1f07f['id'];return db[_0x606d('0x66')]['create'](_0xfd1536[_0x606d('0x62')]);}})['then'](respondWithResult(_0x40eadd,null))[_0x606d('0x27')](handleError(_0x40eadd,null));};exports[_0x606d('0x67')]=function(_0x269a70,_0x189ae3,_0x221246){var _0x22c3d9={'raw':![],'where':{}};var _0x21c74c={};var _0x2c66a6={'count':0x0,'rows':[]};return db['SmsAccount'][_0x606d('0x68')]({'where':{'id':_0x269a70[_0x606d('0x53')]['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x189ae3,null))[_0x606d('0x33')](function(_0x4d79ba){if(_0x4d79ba){_0x21c74c[_0x606d('0x3c')]=_['keys'](db[_0x606d('0x66')]['rawAttributes']);_0x21c74c['query']=_[_0x606d('0x3e')](_0x269a70[_0x606d('0x3d')]);_0x21c74c[_0x606d('0x3f')]=_[_0x606d('0x56')](_0x21c74c['model'],_0x21c74c[_0x606d('0x3d')]);_0x22c3d9[_0x606d('0x40')]=_['intersection'](_0x21c74c['model'],qs[_0x606d('0x41')](_0x269a70['query']['fields']));_0x22c3d9[_0x606d('0x40')]=_0x22c3d9[_0x606d('0x40')]['length']?_0x22c3d9[_0x606d('0x40')]:_0x21c74c[_0x606d('0x3c')];if(!_0x269a70[_0x606d('0x3d')][_0x606d('0x69')](_0x606d('0x43'))){_0x22c3d9[_0x606d('0x2d')]=qs[_0x606d('0x2d')](_0x269a70[_0x606d('0x3d')][_0x606d('0x2d')]);_0x22c3d9[_0x606d('0x2c')]=qs[_0x606d('0x2c')](_0x269a70[_0x606d('0x3d')][_0x606d('0x2c')]);}_0x22c3d9['order']=qs[_0x606d('0x45')](_0x269a70[_0x606d('0x3d')][_0x606d('0x45')]);_0x22c3d9[_0x606d('0x46')]=qs[_0x606d('0x3f')](_['pick'](_0x269a70[_0x606d('0x3d')],_0x21c74c['filters']));_0x22c3d9[_0x606d('0x46')][_0x606d('0x65')]=_0x4d79ba['id'];if(_0x269a70[_0x606d('0x3d')]['filter']){_0x22c3d9[_0x606d('0x46')]=_[_0x606d('0x4a')](_0x22c3d9[_0x606d('0x46')],{'$or':_[_0x606d('0x38')](_0x22c3d9[_0x606d('0x40')],function(_0x30b785){var _0x4fcfde={};_0x4fcfde[_0x30b785]={'$like':'%'+_0x269a70[_0x606d('0x3d')][_0x606d('0x48')]+'%'};return _0x4fcfde;})});}_0x22c3d9=_['merge']({},_0x22c3d9,_0x269a70[_0x606d('0x4b')]);return db[_0x606d('0x66')][_0x606d('0x4d')]({'where':_0x22c3d9['where']})['then'](function(_0x227a53){_0x2c66a6['count']=_0x227a53;if(_0x269a70[_0x606d('0x3d')][_0x606d('0x4e')]){_0x22c3d9[_0x606d('0x4f')]=[{'all':!![]}];}return db[_0x606d('0x66')][_0x606d('0x50')](_0x22c3d9);})[_0x606d('0x33')](function(_0x4aa1ff){_0x2c66a6[_0x606d('0x51')]=_0x4aa1ff;return _0x2c66a6;});}})[_0x606d('0x33')](respondWithFilteredResult(_0x189ae3,_0x22c3d9))[_0x606d('0x27')](handleError(_0x189ae3,null));};exports[_0x606d('0x6a')]=function(_0x492843,_0x4a58f2,_0x2b86af){return db['SmsAccount'][_0x606d('0x5d')]({'where':{'id':_0x492843[_0x606d('0x53')]['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x4a58f2,null))[_0x606d('0x33')](function(_0x1c35ad){if(_0x1c35ad){return _0x1c35ad[_0x606d('0x6a')](_0x492843[_0x606d('0x3d')][_0x606d('0x6b')]);}})[_0x606d('0x33')](respondWithStatusCode(_0x4a58f2,null))[_0x606d('0x27')](handleError(_0x4a58f2,null));};exports[_0x606d('0x6c')]=function(_0x20ecca,_0x348757,_0x442cf0){if(_0x20ecca[_0x606d('0x62')]['id']){delete _0x20ecca[_0x606d('0x62')]['id'];}return db[_0x606d('0x4c')][_0x606d('0x5d')]({'where':{'id':_0x20ecca[_0x606d('0x53')]['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x348757,null))[_0x606d('0x33')](function(_0x1cb23c){if(_0x1cb23c){_0x20ecca[_0x606d('0x62')]['SmsAccountId']=_0x1cb23c['id'];return db[_0x606d('0x6d')][_0x606d('0x57')](_0x20ecca['body']);}})[_0x606d('0x33')](respondWithResult(_0x348757,null))[_0x606d('0x27')](handleError(_0x348757,null));};exports['getAnswers']=function(_0x2a3186,_0x2463a6,_0x164166){var _0x19445d={'raw':![],'where':{}};var _0xb181e7={};var _0x224540={'count':0x0,'rows':[]};return db[_0x606d('0x4c')][_0x606d('0x68')]({'where':{'id':_0x2a3186['params']['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x2463a6,null))[_0x606d('0x33')](function(_0x514772){if(_0x514772){_0xb181e7[_0x606d('0x3c')]=_[_0x606d('0x3e')](db[_0x606d('0x6d')][_0x606d('0x39')]);_0xb181e7[_0x606d('0x3d')]=_[_0x606d('0x3e')](_0x2a3186['query']);_0xb181e7[_0x606d('0x3f')]=_[_0x606d('0x56')](_0xb181e7[_0x606d('0x3c')],_0xb181e7[_0x606d('0x3d')]);_0x19445d[_0x606d('0x40')]=_[_0x606d('0x56')](_0xb181e7[_0x606d('0x3c')],qs['fields'](_0x2a3186[_0x606d('0x3d')]['fields']));_0x19445d[_0x606d('0x40')]=_0x19445d[_0x606d('0x40')][_0x606d('0x42')]?_0x19445d[_0x606d('0x40')]:_0xb181e7['model'];if(!_0x2a3186[_0x606d('0x3d')]['hasOwnProperty'](_0x606d('0x43'))){_0x19445d[_0x606d('0x2d')]=qs['limit'](_0x2a3186[_0x606d('0x3d')]['limit']);_0x19445d[_0x606d('0x2c')]=qs[_0x606d('0x2c')](_0x2a3186['query']['offset']);}_0x19445d[_0x606d('0x44')]=qs[_0x606d('0x45')](_0x2a3186[_0x606d('0x3d')][_0x606d('0x45')]);_0x19445d[_0x606d('0x46')]=qs[_0x606d('0x3f')](_[_0x606d('0x47')](_0x2a3186[_0x606d('0x3d')],_0xb181e7[_0x606d('0x3f')]));_0x19445d[_0x606d('0x46')][_0x606d('0x65')]=_0x514772['id'];if(_0x2a3186[_0x606d('0x3d')][_0x606d('0x48')]){_0x19445d[_0x606d('0x46')]=_[_0x606d('0x4a')](_0x19445d[_0x606d('0x46')],{'$or':_[_0x606d('0x38')](_0x19445d[_0x606d('0x40')],function(_0x4a85de){var _0x9f7afe={};_0x9f7afe[_0x4a85de]={'$like':'%'+_0x2a3186[_0x606d('0x3d')][_0x606d('0x48')]+'%'};return _0x9f7afe;})});}_0x19445d=_[_0x606d('0x4a')]({},_0x19445d,_0x2a3186[_0x606d('0x4b')]);return db['CannedAnswer']['count']({'where':_0x19445d[_0x606d('0x46')]})[_0x606d('0x33')](function(_0x2efeb8){_0x224540[_0x606d('0x4d')]=_0x2efeb8;if(_0x2a3186[_0x606d('0x3d')][_0x606d('0x4e')]){_0x19445d[_0x606d('0x4f')]=[{'all':!![]}];}return db[_0x606d('0x6d')][_0x606d('0x50')](_0x19445d);})[_0x606d('0x33')](function(_0x1baa47){_0x224540['rows']=_0x1baa47;return _0x224540;});}})[_0x606d('0x33')](respondWithFilteredResult(_0x2463a6,_0x19445d))[_0x606d('0x27')](handleError(_0x2463a6,null));};exports[_0x606d('0x6e')]=function(_0x3540f9,_0x35d575,_0x23dd88){return db[_0x606d('0x4c')][_0x606d('0x5d')]({'where':{'id':_0x3540f9[_0x606d('0x53')]['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x35d575,null))['then'](function(_0xa4fbad){if(_0xa4fbad){return _0xa4fbad['removeAnswers'](_0x3540f9[_0x606d('0x3d')][_0x606d('0x6b')]);}})[_0x606d('0x33')](respondWithStatusCode(_0x35d575,null))[_0x606d('0x27')](handleError(_0x35d575,null));};exports['notify']=function(_0x40a291,_0x3bca59,_0x3531ee){var _0x492dc2={'channel':_0x606d('0x6f')};var _0x38b0af=[];var _0x409133=[];var _0x185811={};return db['SmsAccount'][_0x606d('0x5d')]({'where':{'id':_0x40a291[_0x606d('0x53')]['id']},'include':[{'model':db[_0x606d('0x70')],'as':_0x606d('0x71')}]})[_0x606d('0x33')](handleEntityNotFound(_0x3bca59,null))[_0x606d('0x33')](function(_0x29a48c){_0x492dc2['account']=_0x29a48c;_0x492dc2[_0x606d('0x72')]=_[_0x606d('0x73')](_0x29a48c[_0x606d('0x71')],[_0x606d('0x74')],[_0x606d('0x75')]);if(_0x492dc2['account']['Applications']){delete _0x492dc2['account'][_0x606d('0x71')];}return db[_0x606d('0x76')]['describe']();})[_0x606d('0x33')](function(_0x30904c){if(!_0x30904c){throw new db[(_0x606d('0x77'))][(_0x606d('0x78'))]('no\x20available\x20attributes');}_0x38b0af=_['difference'](_[_0x606d('0x3e')](_0x30904c),[_0x606d('0x79'),_0x606d('0x7a')]);_0x409133=_[_0x606d('0x7b')](_[_0x606d('0x3e')](_0x30904c),[_0x606d('0x79'),_0x606d('0x7a'),_0x606d('0x7c'),_0x606d('0x7d')]);_0x492dc2[_0x606d('0x62')]={'mapKey':_0x606d('0x7e')};if(_0x492dc2[_0x606d('0x7f')][_0x606d('0x3a')]){switch(_0x492dc2[_0x606d('0x7f')]['type']){case _0x606d('0x80'):_0x492dc2[_0x606d('0x62')][_0x606d('0x81')]=_0x40a291[_0x606d('0x62')][_0x606d('0x82')];_0x492dc2[_0x606d('0x62')][_0x606d('0x62')]=_0x40a291[_0x606d('0x62')][_0x606d('0x83')];_0x492dc2[_0x606d('0x62')][_0x606d('0x84')]=_0x40a291[_0x606d('0x62')]['MessageSid'];break;case _0x606d('0x85'):_0x492dc2[_0x606d('0x62')][_0x606d('0x81')]='+'+_0x40a291[_0x606d('0x62')][_0x606d('0x86')];_0x492dc2[_0x606d('0x62')][_0x606d('0x62')]=_0x40a291[_0x606d('0x62')][_0x606d('0x87')];break;case'connectel':_0x492dc2[_0x606d('0x62')][_0x606d('0x81')]=_0x40a291[_0x606d('0x62')][_0x606d('0x81')];_0x492dc2[_0x606d('0x62')][_0x606d('0x62')]=_0x40a291['body'][_0x606d('0x26')];break;case'clicksend':_0x492dc2[_0x606d('0x62')][_0x606d('0x81')]=_0x40a291[_0x606d('0x62')][_0x606d('0x81')];_0x492dc2['body'][_0x606d('0x62')]=_0x40a291[_0x606d('0x62')][_0x606d('0x62')];_0x492dc2[_0x606d('0x62')][_0x606d('0x84')]=_0x40a291['body']['message_id'];break;case _0x606d('0x88'):_0x492dc2['body'][_0x606d('0x81')]=_0x40a291[_0x606d('0x62')]['From'];_0x492dc2[_0x606d('0x62')][_0x606d('0x62')]=_0x40a291['body']['Text'];_0x492dc2[_0x606d('0x62')][_0x606d('0x84')]=_0x40a291[_0x606d('0x62')][_0x606d('0x89')];break;case _0x606d('0x8a'):_0x492dc2[_0x606d('0x62')][_0x606d('0x81')]='+'+_0x40a291[_0x606d('0x62')][_0x606d('0x8b')][0x0][_0x606d('0x81')];_0x492dc2[_0x606d('0x62')][_0x606d('0x62')]=_0x40a291['body'][_0x606d('0x8b')][0x0][_0x606d('0x87')];_0x492dc2[_0x606d('0x62')][_0x606d('0x84')]=_0x40a291[_0x606d('0x62')][_0x606d('0x8b')][0x0][_0x606d('0x84')];break;case _0x606d('0x8c'):_0x492dc2[_0x606d('0x62')]['from']=_0x40a291[_0x606d('0x62')]['originatingAddress'];_0x492dc2[_0x606d('0x62')][_0x606d('0x62')]=_0x40a291[_0x606d('0x62')]['segmentedMessage'][_0x606d('0x26')];break;case _0x606d('0x8d'):_0x492dc2[_0x606d('0x62')]['from']=_0x40a291[_0x606d('0x62')]['fromNumber'];_0x492dc2[_0x606d('0x62')][_0x606d('0x62')]=_0x40a291['body'][_0x606d('0x87')];_0x492dc2['body'][_0x606d('0x84')]=_0x40a291['body'][_0x606d('0x8e')];break;case _0x606d('0x8f'):_0x492dc2[_0x606d('0x62')][_0x606d('0x81')]=_0x40a291[_0x606d('0x62')][_0x606d('0x81')];_0x492dc2['body']['body']=_0x40a291[_0x606d('0x62')][_0x606d('0x26')];_0x492dc2[_0x606d('0x62')]['messageId']=_0x40a291[_0x606d('0x62')]['refid'];break;}}if(_0x492dc2[_0x606d('0x62')]['id']){delete _0x492dc2[_0x606d('0x62')]['id'];}if(_[_0x606d('0x90')](_0x492dc2[_0x606d('0x62')][_0x606d('0x81')])){throw new db[(_0x606d('0x77'))][(_0x606d('0x78'))](_0x606d('0x91'));}if(_[_0x606d('0x90')](_0x492dc2[_0x606d('0x62')][_0x606d('0x62')])||_0x492dc2[_0x606d('0x62')]['body']===''){throw new db[(_0x606d('0x77'))][(_0x606d('0x78'))](_0x606d('0x92'));}if(_['isNil'](_0x492dc2[_0x606d('0x62')][_0x606d('0x93')])){throw new db['Sequelize']['ValidationError'](_0x606d('0x94')+_0x409133);}if(!_[_0x606d('0x95')](_0x409133,_0x492dc2[_0x606d('0x62')][_0x606d('0x93')])){throw new db[(_0x606d('0x77'))][(_0x606d('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x409133);}_0x185811[_0x492dc2[_0x606d('0x62')][_0x606d('0x93')]]=_0x492dc2[_0x606d('0x62')]['from'];return db[_0x606d('0x96')][_0x606d('0x5d')]({'where':{'id':_0x492dc2[_0x606d('0x7f')][_0x606d('0x7d')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x185811,'limit':0x1,'order':[['updatedAt',_0x606d('0x97')]]}]});})[_0x606d('0x33')](handleEntityNotFound(_0x3bca59,null))[_0x606d('0x33')](function(_0x2e8c0d){if(_0x2e8c0d){_0x492dc2['list']=_[_0x606d('0x98')](_0x2e8c0d,[_0x606d('0x99')]);if(_0x2e8c0d[_0x606d('0x99')][_0x606d('0x42')]){return _0x2e8c0d['Contacts'][0x0];}var _0x59deb0=_[_0x606d('0x9a')](_0x492dc2[_0x606d('0x62')],{'firstName':_0x492dc2['body']['from'],'ListId':_0x2e8c0d['id']});_0x59deb0[_0x492dc2[_0x606d('0x62')][_0x606d('0x93')]]=_0x492dc2[_0x606d('0x62')][_0x606d('0x81')];return db[_0x606d('0x76')][_0x606d('0x57')](_0x59deb0,{'fields':_0x38b0af,'raw':!![]});}})[_0x606d('0x33')](handleEntityNotFound(_0x3bca59,null))[_0x606d('0x33')](function(_0x17de5d){if(_0x17de5d){_0x492dc2[_0x606d('0x9b')]=_0x17de5d;var _0x1b74c3={'ContactId':_0x17de5d['id'],'phone':_0x492dc2[_0x606d('0x62')]['from'],'SmsAccountId':_0x40a291[_0x606d('0x53')]['id']};var _0x9355ad={'ContactId':_0x17de5d['id'],'SmsAccountId':_0x40a291['params']['id'],'closed':![]};return db[_0x606d('0x9c')][_0x606d('0x5d')]({'where':_0x9355ad})[_0x606d('0x33')](function(_0xc31f65){if(_0xc31f65){return[_0xc31f65,![]];}return db[_0x606d('0x9c')]['create'](_0x1b74c3)[_0x606d('0x33')](function(_0x4c5a4a){return[_0x4c5a4a,!![]];});});}})['spread'](function(_0x13b6cc,_0x366d34){_0x492dc2[_0x606d('0x9d')]=_0x13b6cc[_0x606d('0x59')]({'plain':!![]});_0x492dc2[_0x606d('0x9d')][_0x606d('0x9e')]=![];if(_0x366d34){if(_0x492dc2[_0x606d('0x7f')][_0x606d('0x9f')]){_0x492dc2[_0x606d('0x72')][_0x606d('0xa0')]({'id':0x0,'priority':_0x492dc2[_0x606d('0x72')][_0x606d('0x42')]+0x1,'app':_0x606d('0xa1'),'appdata':_0x606d('0xa2'),'interval':_0x606d('0xa3')});}_0x492dc2[_0x606d('0x9d')]['created']=!![];}return db['SmsMessage'][_0x606d('0x57')]({'phone':_0x492dc2[_0x606d('0x62')][_0x606d('0x81')],'messageId':_0x492dc2[_0x606d('0x62')][_0x606d('0x84')],'body':_0x492dc2[_0x606d('0x62')][_0x606d('0x62')],'SmsAccountId':_0x40a291[_0x606d('0x53')]['id'],'SmsInteractionId':_0x13b6cc['id'],'direction':'in','ContactId':_0x13b6cc['ContactId'],'AttachmentId':_0x492dc2['body'][_0x606d('0xa4')]});})['then'](function(_0x2a93d3){_0x492dc2[_0x606d('0x26')]=_0x2a93d3;if(_0x492dc2[_0x606d('0x9d')][_0x606d('0xa5')]){return db[_0x606d('0xa6')][_0x606d('0x5d')]({'attributes':['id',_0x606d('0x36')],'where':{'id':_0x492dc2[_0x606d('0x9d')][_0x606d('0xa5')]}})[_0x606d('0x33')](function(_0x3a2f15){if(_0x3a2f15){_0x492dc2[_0x606d('0x72')][_0x606d('0xa7')]({'id':0x0,'priority':0x0,'app':_0x606d('0xa8'),'appdata':_0x3a2f15[_0x606d('0x36')]+','+(_0x492dc2[_0x606d('0x7f')][_0x606d('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x606d('0xaa'),_0x606d('0xab'),_0x492dc2);});}return respondWithRpcPromise(_0x606d('0xaa'),_0x606d('0xab'),_0x492dc2);})[_0x606d('0x33')](function(_0x383716){if(_0x383716){var _0x5c224f=0xc8;var _0x12355e=_0x606d('0xac');logger[_0x606d('0x1f')](_0x606d('0x21'),_0x12355e,_0x5c224f,_0x606d('0xad'));logger[_0x606d('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x12355e,_0x5c224f,_0x606d('0xad'),JSON['stringify'](_0x383716));if(_0x492dc2[_0x606d('0x7f')][_0x606d('0x3a')]===_0x606d('0x80')){return _0x3bca59[_0x606d('0x29')](_0x5c224f)[_0x606d('0xaf')]('Content-Type','text/xml')[_0x606d('0xb0')](_0x606d('0xb1'));}else{return _0x3bca59['status'](_0x5c224f)['json'](_0x383716);}}})[_0x606d('0x27')](handleError(_0x3bca59,null));};exports[_0x606d('0xb2')]=function(_0x4cf535,_0x1d4ec2,_0x107416){return db[_0x606d('0x4c')][_0x606d('0x68')]({'where':{'id':_0x4cf535[_0x606d('0x53')]['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x1d4ec2,null))[_0x606d('0x33')](function(_0x4df5c0){if(_0x4df5c0){return db[_0x606d('0xb3')][_0x606d('0xb4')](function(_0x58696b){return db[_0x606d('0x70')][_0x606d('0x32')]({'where':{'SmsAccountId':_0x4cf535[_0x606d('0x53')]['id']},'transaction':_0x58696b})[_0x606d('0x33')](function(_0x25de6b){var _0x90f6f=_[_0x606d('0x38')](_0x4cf535[_0x606d('0x62')],function(_0xc29369){_0xc29369[_0x606d('0x65')]=_0x4cf535[_0x606d('0x53')]['id'];return _0xc29369;});return db[_0x606d('0x70')][_0x606d('0xb5')](_0x90f6f,{'transaction':_0x58696b});});})[_0x606d('0x33')](function(){return db[_0x606d('0x70')]['findAndCountAll']({'where':{'SmsAccountId':_0x4cf535[_0x606d('0x53')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x1d4ec2,null))[_0x606d('0x27')](handleError(_0x1d4ec2,null));};exports[_0x606d('0xb6')]=function(_0x4fccb4,_0x584095,_0xc2dba5){var _0x2a9abd={};var _0x2fef67={};var _0x55200f;var _0x2a26b9;return db[_0x606d('0x4c')]['findOne']({'where':{'id':_0x4fccb4['params']['id']}})['then'](handleEntityNotFound(_0x584095,null))[_0x606d('0x33')](function(_0xbbdf96){if(_0xbbdf96){_0x55200f=_0xbbdf96;_0x2fef67[_0x606d('0x3c')]=_[_0x606d('0x3e')](db[_0x606d('0x70')][_0x606d('0x39')]);_0x2fef67[_0x606d('0x3d')]=_['keys'](_0x4fccb4[_0x606d('0x3d')]);_0x2fef67[_0x606d('0x3f')]=_['intersection'](_0x2fef67[_0x606d('0x3c')],_0x2fef67[_0x606d('0x3d')]);_0x2a9abd[_0x606d('0x40')]=_['intersection'](_0x2fef67[_0x606d('0x3c')],qs[_0x606d('0x41')](_0x4fccb4[_0x606d('0x3d')][_0x606d('0x41')]));_0x2a9abd[_0x606d('0x40')]=_0x2a9abd['attributes'][_0x606d('0x42')]?_0x2a9abd[_0x606d('0x40')]:_0x2fef67[_0x606d('0x3c')];_0x2a9abd[_0x606d('0x44')]=qs[_0x606d('0x45')](_0x4fccb4[_0x606d('0x3d')]['sort']);_0x2a9abd[_0x606d('0x46')]=qs[_0x606d('0x3f')](_[_0x606d('0x47')](_0x4fccb4[_0x606d('0x3d')],_0x2fef67[_0x606d('0x3f')]));if(_0x4fccb4[_0x606d('0x3d')][_0x606d('0x48')]){_0x2a9abd[_0x606d('0x46')]=_[_0x606d('0x4a')](_0x2a9abd[_0x606d('0x46')],{'$or':_['map'](_0x2a9abd[_0x606d('0x40')],function(_0x27e1fc){var _0x12ff17={};_0x12ff17[_0x27e1fc]={'$like':'%'+_0x4fccb4[_0x606d('0x3d')][_0x606d('0x48')]+'%'};return _0x12ff17;})});}_0x2a9abd=_[_0x606d('0x4a')]({},_0x2a9abd,_0x4fccb4['options']);return _0x55200f[_0x606d('0xb6')](_0x2a9abd);}})['then'](function(_0x30dcae){if(_0x30dcae){_0x2a26b9=_0x30dcae[_0x606d('0x42')];if(!_0x4fccb4['query'][_0x606d('0x69')]('nolimit')){_0x2a9abd['limit']=qs['limit'](_0x4fccb4[_0x606d('0x3d')][_0x606d('0x2d')]);_0x2a9abd[_0x606d('0x2c')]=qs[_0x606d('0x2c')](_0x4fccb4['query'][_0x606d('0x2c')]);}return _0x55200f[_0x606d('0xb6')](_0x2a9abd);}})[_0x606d('0x33')](function(_0x345fb5){if(_0x345fb5){return _0x345fb5?{'count':_0x2a26b9,'rows':_0x345fb5}:null;}})['then'](respondWithResult(_0x584095,null))['catch'](handleError(_0x584095,null));};exports[_0x606d('0xb7')]=function(_0x338017,_0x50fff4,_0x2f8e0a){var _0x2c0180={'raw':![],'where':{}};var _0x5bb61a={};var _0x38102a={'count':0x0,'rows':[]};return db[_0x606d('0x4c')]['findOne']({'where':{'id':_0x338017[_0x606d('0x53')]['id']}})['then'](handleEntityNotFound(_0x50fff4,null))[_0x606d('0x33')](function(_0x2feecb){if(_0x2feecb){_0x5bb61a[_0x606d('0x3c')]=_[_0x606d('0x3e')](db['SmsInteraction']['rawAttributes']);_0x5bb61a[_0x606d('0x3d')]=_[_0x606d('0x3e')](_0x338017['query']);_0x5bb61a[_0x606d('0x3f')]=_['intersection'](_0x5bb61a[_0x606d('0x3c')],_0x5bb61a['query']);_0x2c0180[_0x606d('0x40')]=_['intersection'](_0x5bb61a['model'],qs[_0x606d('0x41')](_0x338017[_0x606d('0x3d')][_0x606d('0x41')]));_0x2c0180[_0x606d('0x40')]=_0x2c0180['attributes'][_0x606d('0x42')]?_0x2c0180[_0x606d('0x40')]:_0x5bb61a['model'];if(!_0x338017[_0x606d('0x3d')][_0x606d('0x69')](_0x606d('0x43'))){_0x2c0180['limit']=qs['limit'](_0x338017[_0x606d('0x3d')]['limit']);_0x2c0180['offset']=qs[_0x606d('0x2c')](_0x338017[_0x606d('0x3d')][_0x606d('0x2c')]);}_0x2c0180['order']=qs[_0x606d('0x45')](_0x338017['query'][_0x606d('0x45')]);_0x2c0180[_0x606d('0x46')]=qs[_0x606d('0x3f')](_[_0x606d('0x47')](_0x338017['query'],_0x5bb61a[_0x606d('0x3f')]));_0x2c0180[_0x606d('0x46')][_0x606d('0x65')]=_0x2feecb['id'];if(_0x338017[_0x606d('0x3d')][_0x606d('0x48')]){_0x2c0180[_0x606d('0x46')]=_[_0x606d('0x4a')](_0x2c0180['where'],{'$or':_[_0x606d('0x38')](_0x2c0180[_0x606d('0x40')],function(_0x5e61d4){var _0x2c6399={};_0x2c6399[_0x5e61d4]={'$like':'%'+_0x338017['query'][_0x606d('0x48')]+'%'};return _0x2c6399;})});}_0x2c0180=_['merge']({},_0x2c0180,_0x338017[_0x606d('0x4b')]);return db[_0x606d('0x9c')][_0x606d('0x4d')]({'where':_0x2c0180[_0x606d('0x46')]})['then'](function(_0x40d39c){_0x38102a['count']=_0x40d39c;if(_0x338017['query'][_0x606d('0x4e')]){_0x2c0180['include']=[{'model':db[_0x606d('0x76')],'as':_0x606d('0xb8'),'required':![]},{'model':db[_0x606d('0xa6')],'as':_0x606d('0xb9'),'attributes':[_0x606d('0x36'),_0x606d('0xba'),'internal'],'required':![]},{'model':db[_0x606d('0xbb')],'as':_0x606d('0xbc'),'attributes':['id',_0x606d('0x36'),_0x606d('0xbd')],'where':_0x338017[_0x606d('0x3d')][_0x606d('0xbe')]?{'id':_0x338017['query']['tag']}:undefined,'required':_0x338017[_0x606d('0x3d')][_0x606d('0xbe')]?!![]:![]}];}return db['SmsInteraction'][_0x606d('0x50')](_0x2c0180);})[_0x606d('0x33')](function(_0x303e33){_0x38102a['rows']=_0x303e33;return _0x38102a;});}})[_0x606d('0x33')](respondWithFilteredResult(_0x50fff4,_0x2c0180))[_0x606d('0x27')](handleError(_0x50fff4,null));};exports['send']=function(_0x1bfcdb,_0xb9d122,_0x589a4e){var _0x257571,_0x282ce9,_0x3b516f;if(_[_0x606d('0x90')](_0x1bfcdb[_0x606d('0x62')]['body'])||_0x1bfcdb['body'][_0x606d('0x62')]===''){throw new db[(_0x606d('0x77'))]['ValidationError'](_0x606d('0x92'));}if(_[_0x606d('0x90')](_0x1bfcdb['body']['to'])){throw new db[(_0x606d('0x77'))]['ValidationError']('to\x20is\x20mandatory');}_0x257571=_0x1bfcdb['body']['to'];return db['SmsAccount'][_0x606d('0x5d')]({'where':{'id':_0x1bfcdb[_0x606d('0x53')]['id']},'include':[{'model':db[_0x606d('0x96')],'as':_0x606d('0xbf'),'include':[{'model':db[_0x606d('0x76')],'as':_0x606d('0x99'),'where':{'mobile':_0x257571},'limit':0x1,'order':[[_0x606d('0x7a'),'DESC']]}]}]})[_0x606d('0x33')](handleEntityNotFound(_0xb9d122,null))[_0x606d('0x33')](function(_0xf1e120){if(_0xf1e120&&_0xf1e120[_0x606d('0xbf')]){_0x282ce9=_0xf1e120['get']({'plain':!![]});if(_0x282ce9[_0x606d('0xbf')]&&_0x282ce9[_0x606d('0xbf')]['Contacts'][_0x606d('0x42')]){return _0x282ce9['List']['Contacts'][0x0];}return db[_0x606d('0x76')][_0x606d('0x57')](_[_0x606d('0x9a')](_0x1bfcdb[_0x606d('0x62')],{'firstName':_0x257571,'mobile':_0x257571,'phone':_0x257571,'ListId':_0x282ce9[_0x606d('0x7d')]}));}})['then'](handleEntityNotFound(_0xb9d122,null))['then'](function(_0x37334d){if(_0x37334d){_0x3b516f=_0x37334d;return db[_0x606d('0x9c')][_0x606d('0x5d')]({'where':{'ContactId':_0x3b516f['id'],'closed':![],'SmsAccountId':_0x282ce9['id']}})[_0x606d('0x33')](function(_0x211e2d){if(_0x211e2d){return[_0x211e2d,![]];}return db[_0x606d('0x9c')]['create']({'UserId':_0x1bfcdb[_0x606d('0x58')]['id'],'ContactId':_0x3b516f['id'],'SmsAccountId':_0x282ce9['id'],'phone':_0x257571,'firstMsgDirection':_0x606d('0xc0'),'Messages':[_[_0x606d('0x4a')](_0x1bfcdb[_0x606d('0x62')],{'read':![],'body':_0x1bfcdb[_0x606d('0x62')][_0x606d('0x62')],'phone':_0x257571,'SmsAccountId':_0x282ce9['id'],'UserId':_0x1bfcdb[_0x606d('0x58')]['id'],'ContactId':_0x3b516f['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x606d('0xc1')}]})['then'](function(_0x5b5a3c){return[_0x5b5a3c,!![]];});});}})[_0x606d('0xc2')](function(_0x18e94f,_0x39aeed){if(_0x39aeed){return _0x18e94f;}return db[_0x606d('0xc3')]['create'](_[_0x606d('0x4a')](_0x1bfcdb[_0x606d('0x62')],{'read':![],'body':_0x1bfcdb[_0x606d('0x62')][_0x606d('0x62')],'phone':_0x257571,'SmsAccountId':_0x282ce9['id'],'SmsInteractionId':_0x18e94f['id'],'UserId':_0x1bfcdb['user']['id'],'ContactId':_0x3b516f['id']}))[_0x606d('0x33')](function(_0x4454f7){_0x18e94f['dataValues'][_0x606d('0xc1')]=[];_0x18e94f[_0x606d('0xc4')][_0x606d('0xc1')][_0x606d('0xa0')](_0x4454f7[_0x606d('0xc4')]);return _0x18e94f;});})[_0x606d('0x33')](respondWithResult(_0xb9d122,null))[_0x606d('0x27')](handleError(_0xb9d122,null));};exports['status']=function(_0xa021a0,_0x56885a,_0x2b9b78){if(_0xa021a0[_0x606d('0x62')]['id']){delete _0xa021a0[_0x606d('0x62')]['id'];}console[_0x606d('0xc5')](_0x606d('0xc6'),_0xa021a0[_0x606d('0x62')]);var _0xbe9f71,_0x3c1840,_0x23675a;return db[_0x606d('0x4c')][_0x606d('0x5d')]({'where':{'id':_0xa021a0[_0x606d('0x53')]['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x56885a,null))['then'](function(_0x190ef8){if(_0x190ef8){_0x23675a=_0x190ef8;logger[_0x606d('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x606d('0x29'),'received\x20delivery\x20report\x20from',_0x190ef8['type'],util[_0x606d('0xc7')](_0xa021a0[_0x606d('0x62')],{'showHidden':![],'depth':null}));switch(_0x190ef8['type']){case'skebby':if(_0xa021a0['body'][_0x606d('0xc8')]&&_0xa021a0[_0x606d('0x62')][_0x606d('0x29')]){_0x3c1840=_0xa021a0[_0x606d('0x62')]['status'];return db[_0x606d('0xc3')]['find']({'where':{'messageId':_0xa021a0[_0x606d('0x62')]['skebby_dispatch_id']}});}break;case _0x606d('0xc9'):if(_0xa021a0[_0x606d('0x62')]['requestid']&&_0xa021a0[_0x606d('0x62')][_0x606d('0xca')]){_0x3c1840=_0xa021a0[_0x606d('0x62')][_0x606d('0xca')];return db['SmsMessage'][_0x606d('0x5d')]({'where':{'messageId':_0xa021a0[_0x606d('0x62')][_0x606d('0xcb')]}});}break;case _0x606d('0xcc'):if(_0xa021a0[_0x606d('0x62')][_0x606d('0xcd')]&&_0xa021a0['body'][_0x606d('0xce')]){_0x3c1840=_0xa021a0['body'][_0x606d('0xce')];return db[_0x606d('0xc3')][_0x606d('0x5d')]({'where':{'messageId':_0xa021a0[_0x606d('0x62')][_0x606d('0xcd')]}});}break;case _0x606d('0x8a'):var _0x1b6916=_0xa021a0[_0x606d('0x62')][_0x606d('0x8b')][0x0];if(_0x1b6916[_0x606d('0x84')]&&_0x1b6916[_0x606d('0x29')][_0x606d('0xcf')]==='DELIVERED'){_0x3c1840=_0x1b6916[_0x606d('0x29')][_0x606d('0xcf')];return db[_0x606d('0xc3')]['find']({'where':{'messageId':_0x1b6916[_0x606d('0x84')]}});}break;case _0x606d('0x8d'):if(_0xa021a0[_0x606d('0x62')][_0x606d('0x84')]&&_0xa021a0[_0x606d('0x62')][_0x606d('0x29')]){_0x3c1840=_0xa021a0[_0x606d('0x62')][_0x606d('0x29')];return db[_0x606d('0xc3')][_0x606d('0x5d')]({'where':{'messageId':_0xa021a0[_0x606d('0x62')]['messageId']}});}break;case'intelepeer':if(_0xa021a0[_0x606d('0x62')][_0x606d('0xd0')]&&_0xa021a0[_0x606d('0x62')][_0x606d('0x29')]){_0x3c1840=_0xa021a0['body'][_0x606d('0x29')];return db[_0x606d('0xc3')][_0x606d('0x5d')]({'where':{'messageId':_0xa021a0[_0x606d('0x62')][_0x606d('0xd0')]}});}break;}}})[_0x606d('0x33')](handleEntityNotFound(_0x56885a,null))[_0x606d('0x33')](function(_0x8a5a5a){if(_0x8a5a5a){_0xbe9f71=_0x8a5a5a;switch(_0x23675a[_0x606d('0x3a')]){case _0x606d('0x85'):if(_0x3c1840===_0x606d('0xd1')){return _0xbe9f71[_0x606d('0x61')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0x606d('0xc7')](_0xa021a0[_0x606d('0x62')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x3c1840==='1'){return _0xbe9f71[_0x606d('0x61')]({'read':!![]});}else{logger[_0x606d('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x606d('0x85'),util[_0x606d('0xc7')](_0xa021a0[_0x606d('0x62')],{'showHidden':![],'depth':null}));}break;case _0x606d('0xcc'):if(!_0xa021a0['body']['error_code']&&_0x3c1840>=0xc8&&_0x3c1840<=0xce){return _0xbe9f71[_0x606d('0x61')]({'read':!![]});}else{logger[_0x606d('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x606d('0x29'),_0x606d('0xcc'),util['inspect'](_0xa021a0[_0x606d('0x62')],{'showHidden':![],'depth':null}));}break;case _0x606d('0x8a'):var _0x58ba67=_0xa021a0[_0x606d('0x62')][_0x606d('0x8b')][0x0];if(_0x58ba67['status'][_0x606d('0xcf')]===_0x606d('0xd1')){return _0xbe9f71[_0x606d('0x61')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x606d('0x29'),_0x606d('0x8a'),util[_0x606d('0xc7')](_0xa021a0[_0x606d('0x62')],{'showHidden':![],'depth':null}));}break;case _0x606d('0x8d'):if(_0x3c1840==_0x606d('0xd2')||_0x3c1840==_0x606d('0xd3')){return _0xbe9f71[_0x606d('0x61')]({'read':!![]});}else{logger[_0x606d('0x23')](_0x606d('0x21'),_0x606d('0x29'),_0x606d('0x8d'),util[_0x606d('0xc7')](_0xa021a0[_0x606d('0x62')],{'showHidden':![],'depth':null}));}break;case _0x606d('0x8f'):if(_0x3c1840===_0x606d('0xd4')||_0x3c1840===_0x606d('0xd5')){return _0xbe9f71['update']({'read':!![]});}else{logger['error'](_0x606d('0x21'),'status',_0x606d('0x8f'),util['inspect'](_0xa021a0[_0x606d('0x62')],{'showHidden':![],'depth':null}));}break;}return _0xbe9f71;}})[_0x606d('0x33')](respondWithResult(_0x56885a,null))[_0x606d('0x27')](handleError(_0x56885a,null));};exports[_0x606d('0xd6')]=function(_0x7b0d47,_0x52166f,_0x47d02d){var _0x412986,_0x1f7639,_0x36df09;return db[_0x606d('0x4c')][_0x606d('0x5d')]({'where':{'id':_0x7b0d47[_0x606d('0x53')]['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x52166f,null))[_0x606d('0x33')](function(_0x188d15){if(_0x188d15){_0x36df09=_0x188d15;logger[_0x606d('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x606d('0x29'),_0x606d('0xd7'),_0x188d15[_0x606d('0x3a')],util[_0x606d('0xc7')](_0x7b0d47[_0x606d('0x3d')],{'showHidden':![],'depth':null}));switch(_0x188d15['type']){case'csc':if(_0x7b0d47[_0x606d('0x3d')]['message-id']&&_0x7b0d47['query'][_0x606d('0xd8')]){_0x1f7639=_0x7b0d47[_0x606d('0x3d')]['state'];return db['SmsMessage'][_0x606d('0x5d')]({'where':{'messageId':_0x7b0d47[_0x606d('0x3d')][_0x606d('0xd9')]}});}break;}}})[_0x606d('0x33')](handleEntityNotFound(_0x52166f,null))['then'](function(_0x328fb4){if(_0x328fb4){_0x412986=_0x328fb4;switch(_0x36df09[_0x606d('0x3a')]){case _0x606d('0x8c'):if(_0x1f7639==='2'||_0x1f7639==='6'){return _0x412986['update']({'read':!![]});}else{logger[_0x606d('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x606d('0x29'),'csc',util[_0x606d('0xc7')](_0x7b0d47['query'],{'showHidden':![],'depth':null}));};break;}return _0x412986;}})[_0x606d('0x33')](respondWithResult(_0x52166f,null))[_0x606d('0x27')](handleError(_0x52166f,null));};exports[_0x606d('0xda')]=function(_0xbe8423,_0x581171,_0x1c602e){return db['SmsAccount'][_0x606d('0x5d')]({'where':{'id':_0xbe8423['params']['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x581171,null))[_0x606d('0x33')](function(_0x2f28fe){if(_0x2f28fe){return _0x2f28fe[_0x606d('0xda')](_0xbe8423['body'][_0x606d('0x6b')],_[_0x606d('0x98')](_0xbe8423[_0x606d('0x62')],[_0x606d('0x6b'),'id'])||{})[_0x606d('0xc2')](function(_0x5ce3f8){for(var _0x473422=0x0;_0x473422<_0xbe8423['body']['ids']['length'];_0x473422+=0x1){socket[_0x606d('0xdb')](_0x606d('0xdc'),{'UserId':_0xbe8423[_0x606d('0x62')][_0x606d('0x6b')][_0x473422],'SmsAccountId':_0xbe8423[_0x606d('0x53')]['id']});}return _0x5ce3f8;});}})[_0x606d('0x33')](respondWithResult(_0x581171,null))[_0x606d('0x27')](handleError(_0x581171,null));};exports[_0x606d('0xdd')]=function(_0x452aa9,_0x56d96d,_0x25f256){return db[_0x606d('0x4c')][_0x606d('0x5d')]({'where':{'id':_0x452aa9[_0x606d('0x53')]['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x56d96d,null))['then'](function(_0xab73f0){if(_0xab73f0){return _0xab73f0['removeAgents'](_0x452aa9[_0x606d('0x3d')]['ids'])['then'](function(){if(_[_0x606d('0xde')](_0x452aa9[_0x606d('0x3d')][_0x606d('0x6b')])){for(var _0x8db738=0x0;_0x8db738<_0x452aa9[_0x606d('0x3d')][_0x606d('0x6b')]['length'];_0x8db738+=0x1){socket[_0x606d('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x452aa9[_0x606d('0x3d')][_0x606d('0x6b')][_0x8db738]),'SmsAccountId':Number(_0x452aa9['params']['id'])});}}else{socket[_0x606d('0xdb')]('userSmsAccount:remove',{'UserId':Number(_0x452aa9[_0x606d('0x3d')][_0x606d('0x6b')]),'SmsAccountId':Number(_0x452aa9[_0x606d('0x53')]['id'])});}});}})[_0x606d('0x33')](respondWithStatusCode(_0x56d96d,null))[_0x606d('0x27')](handleError(_0x56d96d,null));};exports[_0x606d('0xdf')]=function(_0x3c7d5f,_0x2aa160,_0x41ac99){var _0x548a8a={};var _0x6adc8b={};var _0x589404;var _0x275a4d;return db[_0x606d('0x4c')][_0x606d('0x68')]({'where':{'id':_0x3c7d5f['params']['id']}})[_0x606d('0x33')](handleEntityNotFound(_0x2aa160,null))[_0x606d('0x33')](function(_0x35d3f2){if(_0x35d3f2){_0x589404=_0x35d3f2;_0x6adc8b[_0x606d('0x3c')]=_[_0x606d('0x3e')](db['User']['rawAttributes']);_0x6adc8b[_0x606d('0x3d')]=_[_0x606d('0x3e')](_0x3c7d5f[_0x606d('0x3d')]);_0x6adc8b[_0x606d('0x3f')]=_[_0x606d('0x56')](_0x6adc8b[_0x606d('0x3c')],_0x6adc8b[_0x606d('0x3d')]);_0x548a8a[_0x606d('0x40')]=_['intersection'](_0x6adc8b[_0x606d('0x3c')],qs[_0x606d('0x41')](_0x3c7d5f['query'][_0x606d('0x41')]));_0x548a8a[_0x606d('0x40')]=_0x548a8a[_0x606d('0x40')][_0x606d('0x42')]?_0x548a8a[_0x606d('0x40')]:_0x6adc8b[_0x606d('0x3c')];_0x548a8a['order']=qs[_0x606d('0x45')](_0x3c7d5f[_0x606d('0x3d')][_0x606d('0x45')]);_0x548a8a[_0x606d('0x46')]=qs['filters'](_[_0x606d('0x47')](_0x3c7d5f['query'],_0x6adc8b[_0x606d('0x3f')]));if(_0x3c7d5f[_0x606d('0x3d')][_0x606d('0x48')]){_0x548a8a[_0x606d('0x46')]=_[_0x606d('0x4a')](_0x548a8a[_0x606d('0x46')],{'$or':_['map'](_0x548a8a[_0x606d('0x40')],function(_0x2394b1){var _0x778600={};_0x778600[_0x2394b1]={'$like':'%'+_0x3c7d5f['query'][_0x606d('0x48')]+'%'};return _0x778600;})});}_0x548a8a=_[_0x606d('0x4a')]({},_0x548a8a,_0x3c7d5f[_0x606d('0x4b')]);return _0x589404[_0x606d('0xdf')](_0x548a8a);}})['then'](function(_0x2b0cdf){if(_0x2b0cdf){_0x275a4d=_0x2b0cdf[_0x606d('0x42')];if(!_0x3c7d5f[_0x606d('0x3d')]['hasOwnProperty'](_0x606d('0x43'))){_0x548a8a['limit']=qs['limit'](_0x3c7d5f[_0x606d('0x3d')][_0x606d('0x2d')]);_0x548a8a[_0x606d('0x2c')]=qs[_0x606d('0x2c')](_0x3c7d5f[_0x606d('0x3d')]['offset']);}return _0x589404[_0x606d('0xdf')](_0x548a8a);}})[_0x606d('0x33')](function(_0xf5c4c6){if(_0xf5c4c6){return _0xf5c4c6?{'count':_0x275a4d,'rows':_0xf5c4c6}:null;}})[_0x606d('0x33')](respondWithResult(_0x2aa160,null))[_0x606d('0x27')](handleError(_0x2aa160,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 341073c..ade7a07 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 _0x0c5e=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x49931c,_0x4436cd){var _0x31551f=function(_0x154fd6){while(--_0x154fd6){_0x49931c['push'](_0x49931c['shift']());}};_0x31551f(++_0x4436cd);}(_0x0c5e,0x101));var _0xe0c5=function(_0x2f1753,_0x458f6d){_0x2f1753=_0x2f1753-0x0;var _0x56a164=_0x0c5e[_0x2f1753];return _0x56a164;};'use strict';var EventEmitter=require(_0xe0c5('0x0'));var SmsAccount=require(_0xe0c5('0x1'))['db'][_0xe0c5('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe0c5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe0c5('0x4'),'afterDestroy':_0xe0c5('0x5')};function emitEvent(_0x4583b2){return function(_0x517744,_0xc6b367,_0x24bc8a){SmsAccountEvents[_0xe0c5('0x6')](_0x4583b2+':'+_0x517744['id'],_0x517744);SmsAccountEvents[_0xe0c5('0x6')](_0x4583b2,_0x517744);_0x24bc8a(null);};}for(var e in events){if(events[_0xe0c5('0x7')](e)){var event=events[e];SmsAccount[_0xe0c5('0x8')](e,emitEvent(event));}}module[_0xe0c5('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x1533=['events','SmsAccount','update','remove','emit','hasOwnProperty','exports'];(function(_0x3871dc,_0x1117f4){var _0x288c69=function(_0x1a5c7a){while(--_0x1a5c7a){_0x3871dc['push'](_0x3871dc['shift']());}};_0x288c69(++_0x1117f4);}(_0x1533,0x19d));var _0x3153=function(_0x38037a,_0x196abc){_0x38037a=_0x38037a-0x0;var _0x1a1246=_0x1533[_0x38037a];return _0x1a1246;};'use strict';var EventEmitter=require(_0x3153('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x3153('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3153('0x2'),'afterDestroy':_0x3153('0x3')};function emitEvent(_0x10c870){return function(_0x327816,_0x53c223,_0x3dfd56){SmsAccountEvents[_0x3153('0x4')](_0x10c870+':'+_0x327816['id'],_0x327816);SmsAccountEvents[_0x3153('0x4')](_0x10c870,_0x327816);_0x3dfd56(null);};}for(var e in events){if(events[_0x3153('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x3153('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 3ca5f39..d2c01e0 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 _0x661c=['./smsAccount.attributes','exports','define','sms_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x28769a,_0x78b317){var _0x499ebc=function(_0x37dcb4){while(--_0x37dcb4){_0x28769a['push'](_0x28769a['shift']());}};_0x499ebc(++_0x78b317);}(_0x661c,0x122));var _0xc661=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x661c[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xc661('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc661('0x1'));var moment=require('moment');var BPromise=require(_0xc661('0x2'));var rp=require(_0xc661('0x3'));var fs=require('fs');var path=require(_0xc661('0x4'));var rimraf=require(_0xc661('0x5'));var config=require(_0xc661('0x6'));var attributes=require(_0xc661('0x7'));module[_0xc661('0x8')]=function(_0x502716,_0x4de875){return _0x502716[_0xc661('0x9')]('SmsAccount',attributes,{'tableName':_0xc661('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa799=['moment','bluebird','path','rimraf','./smsAccount.attributes','SmsAccount','sms_accounts','util','api'];(function(_0x50bdcb,_0x148ed3){var _0x241039=function(_0x15df12){while(--_0x15df12){_0x50bdcb['push'](_0x50bdcb['shift']());}};_0x241039(++_0x148ed3);}(_0xa799,0x139));var _0x9a79=function(_0x15d6ee,_0x2ae709){_0x15d6ee=_0x15d6ee-0x0;var _0x3923cb=_0xa799[_0x15d6ee];return _0x3923cb;};'use strict';var _=require('lodash');var util=require(_0x9a79('0x0'));var logger=require('../../config/logger')(_0x9a79('0x1'));var moment=require(_0x9a79('0x2'));var BPromise=require(_0x9a79('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9a79('0x4'));var rimraf=require(_0x9a79('0x5'));var config=require('../../config/environment');var attributes=require(_0x9a79('0x6'));module['exports']=function(_0x58ce6b,_0x1117ca){return _0x58ce6b['define'](_0x9a79('0x7'),attributes,{'tableName':_0x9a79('0x8'),'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 1c880ea..08661f0 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 _0x1ea7=['info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','options','attributes','map','model','include','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','register','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1ea7,0x1d1));var _0x71ea=function(_0x3ccc44,_0x207b0c){_0x3ccc44=_0x3ccc44-0x0;var _0x5d74bb=_0x1ea7[_0x3ccc44];return _0x5d74bb;};'use strict';var _=require(_0x71ea('0x0'));var util=require('util');var moment=require(_0x71ea('0x1'));var BPromise=require(_0x71ea('0x2'));var rs=require(_0x71ea('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71ea('0x4'))['db'];var utils=require(_0x71ea('0x5'));var logger=require(_0x71ea('0x6'))(_0x71ea('0x7'));var config=require(_0x71ea('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x71ea('0x9')]['http']({'port':0x232a});config[_0x71ea('0xa')]=_[_0x71ea('0xb')](config[_0x71ea('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x71ea('0xa')]));require('./smsAccount.socket')[_0x71ea('0xc')](socket);function respondWithRpcPromise(_0x2836cc,_0x2a3131,_0xa546ae){return new BPromise(function(_0x549647,_0x418a50){return client[_0x71ea('0xd')](_0x2836cc,_0xa546ae)[_0x71ea('0xe')](function(_0x3d6af8){logger[_0x71ea('0xf')]('SmsAccount,\x20%s,\x20%s',_0x2a3131,_0x71ea('0x10'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a3131,'request\x20sent',JSON[_0x71ea('0x11')](_0x3d6af8));if(_0x3d6af8['error']){if(_0x3d6af8[_0x71ea('0x12')][_0x71ea('0x13')]===0x1f4){logger[_0x71ea('0x12')](_0x71ea('0x14'),_0x2a3131,_0x3d6af8[_0x71ea('0x12')]['message']);return _0x418a50(_0x3d6af8[_0x71ea('0x12')][_0x71ea('0x15')]);}logger['error'](_0x71ea('0x14'),_0x2a3131,_0x3d6af8[_0x71ea('0x12')][_0x71ea('0x15')]);return _0x549647(_0x3d6af8[_0x71ea('0x12')]['message']);}else{logger[_0x71ea('0xf')](_0x71ea('0x14'),_0x2a3131,_0x71ea('0x10'));_0x549647(_0x3d6af8[_0x71ea('0x16')][_0x71ea('0x15')]);}})[_0x71ea('0x17')](function(_0x49e164){logger[_0x71ea('0x12')](_0x71ea('0x14'),_0x2a3131,_0x49e164);_0x418a50(_0x49e164);});});}exports[_0x71ea('0x18')]=function(_0xe21b72){var _0x368dd3=this;return new Promise(function(_0x6cc3f7,_0x47cec7){return db[_0x71ea('0x19')]['find']({'raw':_0xe21b72[_0x71ea('0x1a')]?_0xe21b72[_0x71ea('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xe21b72[_0x71ea('0x1a')]?_0xe21b72[_0x71ea('0x1a')]['where']||null:null,'attributes':_0xe21b72['options']?_0xe21b72[_0x71ea('0x1a')][_0x71ea('0x1b')]||null:null,'include':_0xe21b72[_0x71ea('0x1a')]?_0xe21b72[_0x71ea('0x1a')]['include']?_[_0x71ea('0x1c')](_0xe21b72[_0x71ea('0x1a')]['include'],function(_0x52e9d3){return{'model':db[_0x52e9d3[_0x71ea('0x1d')]],'as':_0x52e9d3['as'],'attributes':_0x52e9d3[_0x71ea('0x1b')],'include':_0x52e9d3['include']?_[_0x71ea('0x1c')](_0x52e9d3[_0x71ea('0x1e')],function(_0x129e3f){return{'model':db[_0x129e3f[_0x71ea('0x1d')]],'as':_0x129e3f['as'],'attributes':_0x129e3f[_0x71ea('0x1b')],'include':_0x129e3f[_0x71ea('0x1e')]?_[_0x71ea('0x1c')](_0x129e3f['include'],function(_0xa83502){return{'model':db[_0xa83502[_0x71ea('0x1d')]],'as':_0xa83502['as'],'attributes':_0xa83502['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x365d12){logger[_0x71ea('0xf')](_0x71ea('0x18'),_0xe21b72);logger[_0x71ea('0x1f')](_0x71ea('0x18'),_0xe21b72,JSON[_0x71ea('0x11')](_0x365d12));_0x6cc3f7(_0x365d12);})[_0x71ea('0x17')](function(_0xf966b2){logger[_0x71ea('0x12')](_0x71ea('0x18'),_0xf966b2[_0x71ea('0x15')],_0xe21b72);_0x47cec7(_0x368dd3[_0x71ea('0x12')](0x1f4,_0xf966b2[_0x71ea('0x15')]));});});}; \ No newline at end of file +var _0xa099=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','SmsAccount','options','raw','where','attributes','include','map','model','ShowSmsAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4fe523,_0x911059){var _0x53c43a=function(_0x334f88){while(--_0x334f88){_0x4fe523['push'](_0x4fe523['shift']());}};_0x53c43a(++_0x911059);}(_0xa099,0x1db));var _0x9a09=function(_0x351a91,_0x478e9d){_0x351a91=_0x351a91-0x0;var _0x1539bc=_0xa099[_0x351a91];return _0x1539bc;};'use strict';var _=require(_0x9a09('0x0'));var util=require(_0x9a09('0x1'));var moment=require(_0x9a09('0x2'));var BPromise=require(_0x9a09('0x3'));var rs=require(_0x9a09('0x4'));var fs=require('fs');var Redis=require(_0x9a09('0x5'));var db=require(_0x9a09('0x6'))['db'];var utils=require(_0x9a09('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x9a09('0x8'));var jayson=require(_0x9a09('0x9'));var client=jayson[_0x9a09('0xa')][_0x9a09('0xb')]({'port':0x232a});config[_0x9a09('0xc')]=_['defaults'](config['redis'],{'host':_0x9a09('0xd'),'port':0x18eb});var socket=require(_0x9a09('0xe'))(new Redis(config[_0x9a09('0xc')]));require(_0x9a09('0xf'))['register'](socket);function respondWithRpcPromise(_0x59fab7,_0x39d4fa,_0x211665){return new BPromise(function(_0x4605bd,_0x7ce014){return client[_0x9a09('0x10')](_0x59fab7,_0x211665)[_0x9a09('0x11')](function(_0x491217){logger[_0x9a09('0x12')](_0x9a09('0x13'),_0x39d4fa,'request\x20sent');logger[_0x9a09('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x39d4fa,_0x9a09('0x15'),JSON[_0x9a09('0x16')](_0x491217));if(_0x491217[_0x9a09('0x17')]){if(_0x491217[_0x9a09('0x17')][_0x9a09('0x18')]===0x1f4){logger['error'](_0x9a09('0x13'),_0x39d4fa,_0x491217[_0x9a09('0x17')][_0x9a09('0x19')]);return _0x7ce014(_0x491217[_0x9a09('0x17')][_0x9a09('0x19')]);}logger['error'](_0x9a09('0x13'),_0x39d4fa,_0x491217[_0x9a09('0x17')][_0x9a09('0x19')]);return _0x4605bd(_0x491217['error'][_0x9a09('0x19')]);}else{logger['info'](_0x9a09('0x13'),_0x39d4fa,'request\x20sent');_0x4605bd(_0x491217[_0x9a09('0x1a')]['message']);}})['catch'](function(_0x59a64d){logger[_0x9a09('0x17')](_0x9a09('0x13'),_0x39d4fa,_0x59a64d);_0x7ce014(_0x59a64d);});});}exports['ShowSmsAccount']=function(_0x130e75){var _0x192056=this;return new Promise(function(_0x540ad5,_0x48fe01){return db[_0x9a09('0x1b')]['find']({'raw':_0x130e75[_0x9a09('0x1c')]?_0x130e75[_0x9a09('0x1c')][_0x9a09('0x1d')]===undefined?!![]:![]:!![],'where':_0x130e75['options']?_0x130e75[_0x9a09('0x1c')][_0x9a09('0x1e')]||null:null,'attributes':_0x130e75[_0x9a09('0x1c')]?_0x130e75[_0x9a09('0x1c')][_0x9a09('0x1f')]||null:null,'include':_0x130e75['options']?_0x130e75[_0x9a09('0x1c')][_0x9a09('0x20')]?_[_0x9a09('0x21')](_0x130e75['options'][_0x9a09('0x20')],function(_0x4ef3dc){return{'model':db[_0x4ef3dc[_0x9a09('0x22')]],'as':_0x4ef3dc['as'],'attributes':_0x4ef3dc[_0x9a09('0x1f')],'include':_0x4ef3dc[_0x9a09('0x20')]?_[_0x9a09('0x21')](_0x4ef3dc[_0x9a09('0x20')],function(_0x5ca086){return{'model':db[_0x5ca086[_0x9a09('0x22')]],'as':_0x5ca086['as'],'attributes':_0x5ca086['attributes'],'include':_0x5ca086[_0x9a09('0x20')]?_[_0x9a09('0x21')](_0x5ca086[_0x9a09('0x20')],function(_0x2907d0){return{'model':db[_0x2907d0[_0x9a09('0x22')]],'as':_0x2907d0['as'],'attributes':_0x2907d0[_0x9a09('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9a09('0x11')](function(_0x515951){logger[_0x9a09('0x12')]('ShowSmsAccount',_0x130e75);logger[_0x9a09('0x14')](_0x9a09('0x23'),_0x130e75,JSON['stringify'](_0x515951));_0x540ad5(_0x515951);})[_0x9a09('0x24')](function(_0x2d586c){logger[_0x9a09('0x17')](_0x9a09('0x23'),_0x2d586c[_0x9a09('0x19')],_0x130e75);_0x48fe01(_0x192056['error'](0x1f4,_0x2d586c[_0x9a09('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 1a7b9b2..b8143f6 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 _0xbe5d=['register','smsAccount:','./smsAccount.events','save','update'];(function(_0x21ff41,_0x15a575){var _0x1ca605=function(_0x53c39e){while(--_0x53c39e){_0x21ff41['push'](_0x21ff41['shift']());}};_0x1ca605(++_0x15a575);}(_0xbe5d,0x1b0));var _0xdbe5=function(_0x2799b2,_0x3d0279){_0x2799b2=_0x2799b2-0x0;var _0x4af7f9=_0xbe5d[_0x2799b2];return _0x4af7f9;};'use strict';var SmsAccountEvents=require(_0xdbe5('0x0'));var events=[_0xdbe5('0x1'),'remove',_0xdbe5('0x2')];function createListener(_0x7b7b98,_0x11d1eb){return function(_0x5765c1){_0x11d1eb['emit'](_0x7b7b98,_0x5765c1);};}function removeListener(_0x11b771,_0x34951d){return function(){SmsAccountEvents['removeListener'](_0x11b771,_0x34951d);};}exports[_0xdbe5('0x3')]=function(_0x30ad16){for(var _0x9a1df0=0x0,_0x393f91=events['length'];_0x9a1df0<_0x393f91;_0x9a1df0++){var _0xb2d505=events[_0x9a1df0];var _0x1b7a19=createListener(_0xdbe5('0x4')+_0xb2d505,_0x30ad16);SmsAccountEvents['on'](_0xb2d505,_0x1b7a19);}}; \ No newline at end of file +var _0x80e4=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x80e4,0x103));var _0x480e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x80e4[_0x102e37];return _0x35a07c;};'use strict';var SmsAccountEvents=require(_0x480e('0x0'));var events=[_0x480e('0x1'),_0x480e('0x2'),'update'];function createListener(_0x245125,_0x42df3c){return function(_0x29d6dd){_0x42df3c[_0x480e('0x3')](_0x245125,_0x29d6dd);};}function removeListener(_0x189f11,_0x4bc189){return function(){SmsAccountEvents[_0x480e('0x4')](_0x189f11,_0x4bc189);};}exports[_0x480e('0x5')]=function(_0x14c268){for(var _0x135a83=0x0,_0x318a8d=events[_0x480e('0x6')];_0x135a83<_0x318a8d;_0x135a83++){var _0x27a40e=events[_0x135a83];var _0x429246=createListener(_0x480e('0x7')+_0x27a40e,_0x14c268);SmsAccountEvents['on'](_0x27a40e,_0x429246);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 4c74398..2e24b61 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 _0x6fcb=['./smsApplication.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6fcb,0x1f0));var _0xb6fc=function(_0x3ed209,_0x6032a1){_0x3ed209=_0x3ed209-0x0;var _0x43ec99=_0x6fcb[_0x3ed209];return _0x43ec99;};'use strict';var multer=require(_0xb6fc('0x0'));var util=require(_0xb6fc('0x1'));var path=require(_0xb6fc('0x2'));var timeout=require(_0xb6fc('0x3'));var express=require(_0xb6fc('0x4'));var router=express[_0xb6fc('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb6fc('0x6'));var config=require(_0xb6fc('0x7'));var controller=require(_0xb6fc('0x8'));router[_0xb6fc('0x9')]('/',auth[_0xb6fc('0xa')](),controller['index']);router[_0xb6fc('0x9')](_0xb6fc('0xb'),auth[_0xb6fc('0xa')](),controller[_0xb6fc('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb6fc('0xd')]);router['put'](_0xb6fc('0xb'),auth[_0xb6fc('0xa')](),controller[_0xb6fc('0xe')]);router[_0xb6fc('0xf')](_0xb6fc('0xb'),auth['isAuthenticated'](),controller[_0xb6fc('0x10')]);module[_0xb6fc('0x11')]=router; \ No newline at end of file +var _0x3e24=['util','connect-timeout','Router','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','update','delete','exports','multer'];(function(_0x2ffc46,_0x35ce3c){var _0x1eda8f=function(_0x285344){while(--_0x285344){_0x2ffc46['push'](_0x2ffc46['shift']());}};_0x1eda8f(++_0x35ce3c);}(_0x3e24,0x9b));var _0x43e2=function(_0x4b4dd0,_0x4b7586){_0x4b4dd0=_0x4b4dd0-0x0;var _0x42da25=_0x3e24[_0x4b4dd0];return _0x42da25;};'use strict';var multer=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var path=require('path');var timeout=require(_0x43e2('0x2'));var express=require('express');var router=express[_0x43e2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x43e2('0x4'));var config=require('../../config/environment');var controller=require(_0x43e2('0x5'));router[_0x43e2('0x6')]('/',auth[_0x43e2('0x7')](),controller[_0x43e2('0x8')]);router['get'](_0x43e2('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x43e2('0x9'),auth[_0x43e2('0x7')](),controller[_0x43e2('0xa')]);router[_0x43e2('0xb')](_0x43e2('0x9'),auth[_0x43e2('0x7')](),controller['destroy']);module[_0x43e2('0xc')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 078433a..d5293cc 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 _0xca48=['noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xca48,0x160));var _0x8ca4=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xca48[_0xc4001c];return _0x49f7bc;};'use strict';var Sequelize=require(_0x8ca4('0x0'));module[_0x8ca4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8ca4('0x2')},'appdata':{'type':Sequelize[_0x8ca4('0x3')]()},'description':{'type':Sequelize[_0x8ca4('0x4')]},'interval':{'type':Sequelize[_0x8ca4('0x4')],'defaultValue':_0x8ca4('0x5')}}; \ No newline at end of file +var _0x8efd=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x2e8d0a,_0x4b73ac){var _0x9dd67d=function(_0xd47cf9){while(--_0xd47cf9){_0x2e8d0a['push'](_0x2e8d0a['shift']());}};_0x9dd67d(++_0x4b73ac);}(_0x8efd,0x107));var _0xd8ef=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8efd[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xd8ef('0x0'));module[_0xd8ef('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd8ef('0x2')],'allowNull':![],'defaultValue':_0xd8ef('0x3')},'appdata':{'type':Sequelize[_0xd8ef('0x4')]()},'description':{'type':Sequelize[_0xd8ef('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd8ef('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 64bd61b..3a9307e 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 _0xe820=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','status','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','SmsApplication','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','html-pdf','rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x43fc26,_0x12908c){var _0x236985=function(_0x479b95){while(--_0x479b95){_0x43fc26['push'](_0x43fc26['shift']());}};_0x236985(++_0x12908c);}(_0xe820,0xd2));var _0x0e82=function(_0x400a5b,_0x4c3ea3){_0x400a5b=_0x400a5b-0x0;var _0x2ea33f=_0xe820[_0x400a5b];return _0x2ea33f;};'use strict';var pdf=require(_0x0e82('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0e82('0x2'));var moment=require(_0x0e82('0x3'));var BPromise=require(_0x0e82('0x4'));var Mustache=require('mustache');var util=require(_0x0e82('0x5'));var path=require('path');var sox=require(_0x0e82('0x6'));var csv=require(_0x0e82('0x7'));var ejs=require(_0x0e82('0x8'));var fs=require('fs');var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x7'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];function respondWithStatusCode(_0x21c40b,_0x1da28a){_0x1da28a=_0x1da28a||0xcc;return function(_0x166dc2){if(_0x166dc2){return _0x21c40b[_0x0e82('0x18')](_0x1da28a);}return _0x21c40b['status'](_0x1da28a)[_0x0e82('0x19')]();};}function respondWithResult(_0x5c161c,_0x48d99b){_0x48d99b=_0x48d99b||0xc8;return function(_0x1e4ddb){if(_0x1e4ddb){return _0x5c161c['status'](_0x48d99b)['json'](_0x1e4ddb);}};}function respondWithFilteredResult(_0x5a2d28,_0x3298c7){return function(_0x4d1aa0){if(_0x4d1aa0){var _0x585b9b=_0x4d1aa0[_0x0e82('0x1a')],_0x1149b1=_0x3298c7[_0x0e82('0x1b')],_0x582f45=_0x3298c7[_0x0e82('0x1b')]+_0x3298c7['limit'],_0x319303;if(_0x582f45>=_0x585b9b){_0x582f45=_0x585b9b;_0x319303=0xc8;}else{_0x319303=0xce;}_0x5a2d28[_0x0e82('0x1c')](_0x319303);return _0x5a2d28[_0x0e82('0x1d')](_0x0e82('0x1e'),_0x1149b1+'-'+_0x582f45+'/'+_0x585b9b)[_0x0e82('0x1f')](_0x4d1aa0);}return null;};}function patchUpdates(_0x3b9933){return function(_0x1230e6){try{jsonpatch[_0x0e82('0x20')](_0x1230e6,_0x3b9933,!![]);}catch(_0x3735c0){return BPromise[_0x0e82('0x21')](_0x3735c0);}return _0x1230e6[_0x0e82('0x22')]();};}function saveUpdates(_0x5903c,_0x493280){return function(_0x5ba6ee){if(_0x5ba6ee){return _0x5ba6ee[_0x0e82('0x23')](_0x5903c)[_0x0e82('0x24')](function(_0x13e8f8){return _0x13e8f8;});}return null;};}function removeEntity(_0xb0a31,_0xd48046){return function(_0x1bdad4){if(_0x1bdad4){return _0x1bdad4[_0x0e82('0x25')]()[_0x0e82('0x24')](function(){_0xb0a31['status'](0xcc)[_0x0e82('0x19')]();});}};}function handleEntityNotFound(_0x13f023,_0x3d6c28){return function(_0x24f883){if(!_0x24f883){_0x13f023['sendStatus'](0x194);}return _0x24f883;};}function handleError(_0xee85dd,_0x24e990){_0x24e990=_0x24e990||0x1f4;return function(_0x7a9399){logger[_0x0e82('0x26')](_0x7a9399['stack']);if(_0x7a9399[_0x0e82('0x27')]){delete _0x7a9399['name'];}_0xee85dd['status'](_0x24e990)[_0x0e82('0x28')](_0x7a9399);};}exports[_0x0e82('0x29')]=function(_0x4c5fc1,_0x19b96d){var _0xe3c530={},_0x149e7e={},_0x5ca9e3={'count':0x0,'rows':[]};var _0x93d2f1=_[_0x0e82('0x2a')](db['SmsApplication'][_0x0e82('0x2b')],function(_0x59a5b6){return{'name':_0x59a5b6[_0x0e82('0x2c')],'type':_0x59a5b6[_0x0e82('0x2d')]['key']};});_0x149e7e[_0x0e82('0x2e')]=_[_0x0e82('0x2a')](_0x93d2f1,_0x0e82('0x27'));_0x149e7e['query']=_['keys'](_0x4c5fc1[_0x0e82('0x2f')]);_0x149e7e['filters']=_[_0x0e82('0x30')](_0x149e7e['model'],_0x149e7e[_0x0e82('0x2f')]);_0xe3c530[_0x0e82('0x31')]=_[_0x0e82('0x30')](_0x149e7e['model'],qs[_0x0e82('0x32')](_0x4c5fc1['query'][_0x0e82('0x32')]));_0xe3c530[_0x0e82('0x31')]=_0xe3c530[_0x0e82('0x31')][_0x0e82('0x33')]?_0xe3c530[_0x0e82('0x31')]:_0x149e7e[_0x0e82('0x2e')];if(!_0x4c5fc1['query'][_0x0e82('0x34')](_0x0e82('0x35'))){_0xe3c530[_0x0e82('0x36')]=qs[_0x0e82('0x36')](_0x4c5fc1[_0x0e82('0x2f')][_0x0e82('0x36')]);_0xe3c530[_0x0e82('0x1b')]=qs[_0x0e82('0x1b')](_0x4c5fc1[_0x0e82('0x2f')][_0x0e82('0x1b')]);}_0xe3c530[_0x0e82('0x37')]=qs[_0x0e82('0x38')](_0x4c5fc1[_0x0e82('0x2f')][_0x0e82('0x38')]);_0xe3c530[_0x0e82('0x39')]=qs['filters'](_[_0x0e82('0x3a')](_0x4c5fc1[_0x0e82('0x2f')],_0x149e7e[_0x0e82('0x3b')]),_0x93d2f1);if(_0x4c5fc1[_0x0e82('0x2f')]['filter']){_0xe3c530[_0x0e82('0x39')]=_[_0x0e82('0x3c')](_0xe3c530['where'],{'$or':_[_0x0e82('0x2a')](_0x93d2f1,function(_0x57e505){if(_0x57e505['type']!==_0x0e82('0x3d')){var _0x1a77c3={};_0x1a77c3[_0x57e505[_0x0e82('0x27')]]={'$like':'%'+_0x4c5fc1[_0x0e82('0x2f')][_0x0e82('0x3e')]+'%'};return _0x1a77c3;}})});}_0xe3c530=_[_0x0e82('0x3c')]({},_0xe3c530,_0x4c5fc1[_0x0e82('0x3f')]);var _0x50fed8={'where':_0xe3c530['where']};return db[_0x0e82('0x40')][_0x0e82('0x1a')](_0x50fed8)[_0x0e82('0x24')](function(_0x135c1b){_0x5ca9e3[_0x0e82('0x1a')]=_0x135c1b;if(_0x4c5fc1[_0x0e82('0x2f')][_0x0e82('0x41')]){_0xe3c530[_0x0e82('0x42')]=[{'all':!![]}];}return db['SmsApplication'][_0x0e82('0x43')](_0xe3c530);})[_0x0e82('0x24')](function(_0x233a18){_0x5ca9e3[_0x0e82('0x44')]=_0x233a18;return _0x5ca9e3;})[_0x0e82('0x24')](respondWithFilteredResult(_0x19b96d,_0xe3c530))[_0x0e82('0x45')](handleError(_0x19b96d,null));};exports[_0x0e82('0x46')]=function(_0x53f221,_0x311cb8){var _0x184e4c={'raw':!![],'where':{'id':_0x53f221[_0x0e82('0x47')]['id']}},_0x3dd4f5={};_0x3dd4f5[_0x0e82('0x2e')]=_[_0x0e82('0x48')](db[_0x0e82('0x40')]['rawAttributes']);_0x3dd4f5['query']=_['keys'](_0x53f221['query']);_0x3dd4f5['filters']=_['intersection'](_0x3dd4f5[_0x0e82('0x2e')],_0x3dd4f5[_0x0e82('0x2f')]);_0x184e4c[_0x0e82('0x31')]=_[_0x0e82('0x30')](_0x3dd4f5[_0x0e82('0x2e')],qs[_0x0e82('0x32')](_0x53f221[_0x0e82('0x2f')][_0x0e82('0x32')]));_0x184e4c['attributes']=_0x184e4c['attributes'][_0x0e82('0x33')]?_0x184e4c[_0x0e82('0x31')]:_0x3dd4f5[_0x0e82('0x2e')];if(_0x53f221[_0x0e82('0x2f')][_0x0e82('0x41')]){_0x184e4c[_0x0e82('0x42')]=[{'all':!![]}];}_0x184e4c=_[_0x0e82('0x3c')]({},_0x184e4c,_0x53f221[_0x0e82('0x3f')]);return db['SmsApplication'][_0x0e82('0x49')](_0x184e4c)['then'](handleEntityNotFound(_0x311cb8,null))[_0x0e82('0x24')](respondWithResult(_0x311cb8,null))['catch'](handleError(_0x311cb8,null));};exports[_0x0e82('0x4a')]=function(_0x4fd25d,_0x153a2d){return db[_0x0e82('0x40')][_0x0e82('0x4a')](_0x4fd25d['body'],{})['then'](respondWithResult(_0x153a2d,0xc9))[_0x0e82('0x45')](handleError(_0x153a2d,null));};exports[_0x0e82('0x23')]=function(_0x267070,_0x4e38d2){if(_0x267070[_0x0e82('0x4b')]['id']){delete _0x267070['body']['id'];}return db[_0x0e82('0x40')][_0x0e82('0x49')]({'where':{'id':_0x267070[_0x0e82('0x47')]['id']}})[_0x0e82('0x24')](handleEntityNotFound(_0x4e38d2,null))[_0x0e82('0x24')](saveUpdates(_0x267070[_0x0e82('0x4b')],null))[_0x0e82('0x24')](respondWithResult(_0x4e38d2,null))[_0x0e82('0x45')](handleError(_0x4e38d2,null));};exports[_0x0e82('0x25')]=function(_0x287abc,_0x41e27e){return db[_0x0e82('0x40')]['find']({'where':{'id':_0x287abc[_0x0e82('0x47')]['id']}})[_0x0e82('0x24')](handleEntityNotFound(_0x41e27e,null))['then'](removeEntity(_0x41e27e,null))[_0x0e82('0x45')](handleError(_0x41e27e,null));}; \ No newline at end of file +var _0x0f13=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','apply','reject','save','update','then','destroy','sendStatus','error','send','index','map','fieldName','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','SmsApplication','count','findAll','rows','show','params','rawAttributes','includeAll','include','find','catch','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel'];(function(_0xe6770d,_0x22cd3b){var _0x1a8e1b=function(_0x1291e0){while(--_0x1291e0){_0xe6770d['push'](_0xe6770d['shift']());}};_0x1a8e1b(++_0x22cd3b);}(_0x0f13,0x16a));var _0x30f1=function(_0x4c3ebd,_0x35d1a0){_0x4c3ebd=_0x4c3ebd-0x0;var _0x47974a=_0x0f13[_0x4c3ebd];return _0x47974a;};'use strict';var pdf=require(_0x30f1('0x0'));var emlformat=require(_0x30f1('0x1'));var rimraf=require(_0x30f1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x30f1('0x3'));var rp=require(_0x30f1('0x4'));var moment=require(_0x30f1('0x5'));var BPromise=require(_0x30f1('0x6'));var Mustache=require(_0x30f1('0x7'));var util=require(_0x30f1('0x8'));var path=require(_0x30f1('0x9'));var sox=require('sox');var csv=require(_0x30f1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x30f1('0xb'));var squel=require(_0x30f1('0xc'));var crypto=require(_0x30f1('0xd'));var jsforce=require(_0x30f1('0xe'));var deskjs=require(_0x30f1('0xf'));var toCsv=require(_0x30f1('0xa'));var querystring=require(_0x30f1('0x10'));var Papa=require('papaparse');var Redis=require(_0x30f1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x30f1('0x12'));var as=require(_0x30f1('0x13'));var hardwareService=require(_0x30f1('0x14'));var logger=require(_0x30f1('0x15'))(_0x30f1('0x16'));var utils=require(_0x30f1('0x17'));var config=require(_0x30f1('0x18'));var licenseUtil=require(_0x30f1('0x19'));var db=require(_0x30f1('0x1a'))['db'];function respondWithStatusCode(_0x2f3bdf,_0x329d32){_0x329d32=_0x329d32||0xcc;return function(_0x5e7cee){if(_0x5e7cee){return _0x2f3bdf['sendStatus'](_0x329d32);}return _0x2f3bdf['status'](_0x329d32)[_0x30f1('0x1b')]();};}function respondWithResult(_0x36795e,_0x55b9db){_0x55b9db=_0x55b9db||0xc8;return function(_0x1a9042){if(_0x1a9042){return _0x36795e[_0x30f1('0x1c')](_0x55b9db)[_0x30f1('0x1d')](_0x1a9042);}};}function respondWithFilteredResult(_0x3bdae8,_0x332cec){return function(_0x1eeb73){if(_0x1eeb73){var _0x5acddd=_0x1eeb73['count'],_0x54bc84=_0x332cec[_0x30f1('0x1e')],_0x229b39=_0x332cec[_0x30f1('0x1e')]+_0x332cec[_0x30f1('0x1f')],_0x4d85ae;if(_0x229b39>=_0x5acddd){_0x229b39=_0x5acddd;_0x4d85ae=0xc8;}else{_0x4d85ae=0xce;}_0x3bdae8[_0x30f1('0x1c')](_0x4d85ae);return _0x3bdae8['set']('Content-Range',_0x54bc84+'-'+_0x229b39+'/'+_0x5acddd)[_0x30f1('0x1d')](_0x1eeb73);}return null;};}function patchUpdates(_0x52938c){return function(_0x866f25){try{jsonpatch[_0x30f1('0x20')](_0x866f25,_0x52938c,!![]);}catch(_0x54f2c8){return BPromise[_0x30f1('0x21')](_0x54f2c8);}return _0x866f25[_0x30f1('0x22')]();};}function saveUpdates(_0x40655b,_0x56d265){return function(_0x550e97){if(_0x550e97){return _0x550e97[_0x30f1('0x23')](_0x40655b)[_0x30f1('0x24')](function(_0x540c04){return _0x540c04;});}return null;};}function removeEntity(_0x181b6b,_0x39914d){return function(_0x3895cc){if(_0x3895cc){return _0x3895cc[_0x30f1('0x25')]()[_0x30f1('0x24')](function(){_0x181b6b[_0x30f1('0x1c')](0xcc)[_0x30f1('0x1b')]();});}};}function handleEntityNotFound(_0x4b40a3,_0x13893e){return function(_0x272c83){if(!_0x272c83){_0x4b40a3[_0x30f1('0x26')](0x194);}return _0x272c83;};}function handleError(_0x36beea,_0x22852c){_0x22852c=_0x22852c||0x1f4;return function(_0x44d9a6){logger[_0x30f1('0x27')](_0x44d9a6['stack']);if(_0x44d9a6['name']){delete _0x44d9a6['name'];}_0x36beea[_0x30f1('0x1c')](_0x22852c)[_0x30f1('0x28')](_0x44d9a6);};}exports[_0x30f1('0x29')]=function(_0x119f05,_0x5976ad){var _0x2bac8f={},_0x3139fb={},_0x46ba1f={'count':0x0,'rows':[]};var _0x4c131d=_[_0x30f1('0x2a')](db['SmsApplication']['rawAttributes'],function(_0x2d5f14){return{'name':_0x2d5f14[_0x30f1('0x2b')],'type':_0x2d5f14[_0x30f1('0x2c')][_0x30f1('0x2d')]};});_0x3139fb['model']=_['map'](_0x4c131d,'name');_0x3139fb[_0x30f1('0x2e')]=_[_0x30f1('0x2f')](_0x119f05[_0x30f1('0x2e')]);_0x3139fb['filters']=_[_0x30f1('0x30')](_0x3139fb[_0x30f1('0x31')],_0x3139fb[_0x30f1('0x2e')]);_0x2bac8f[_0x30f1('0x32')]=_[_0x30f1('0x30')](_0x3139fb['model'],qs[_0x30f1('0x33')](_0x119f05[_0x30f1('0x2e')][_0x30f1('0x33')]));_0x2bac8f['attributes']=_0x2bac8f[_0x30f1('0x32')]['length']?_0x2bac8f[_0x30f1('0x32')]:_0x3139fb[_0x30f1('0x31')];if(!_0x119f05['query'][_0x30f1('0x34')]('nolimit')){_0x2bac8f[_0x30f1('0x1f')]=qs[_0x30f1('0x1f')](_0x119f05[_0x30f1('0x2e')]['limit']);_0x2bac8f[_0x30f1('0x1e')]=qs['offset'](_0x119f05[_0x30f1('0x2e')][_0x30f1('0x1e')]);}_0x2bac8f[_0x30f1('0x35')]=qs['sort'](_0x119f05[_0x30f1('0x2e')][_0x30f1('0x36')]);_0x2bac8f['where']=qs[_0x30f1('0x37')](_[_0x30f1('0x38')](_0x119f05[_0x30f1('0x2e')],_0x3139fb[_0x30f1('0x37')]),_0x4c131d);if(_0x119f05[_0x30f1('0x2e')][_0x30f1('0x39')]){_0x2bac8f[_0x30f1('0x3a')]=_[_0x30f1('0x3b')](_0x2bac8f[_0x30f1('0x3a')],{'$or':_[_0x30f1('0x2a')](_0x4c131d,function(_0x4fc7aa){if(_0x4fc7aa[_0x30f1('0x2c')]!==_0x30f1('0x3c')){var _0x59c36e={};_0x59c36e[_0x4fc7aa['name']]={'$like':'%'+_0x119f05[_0x30f1('0x2e')]['filter']+'%'};return _0x59c36e;}})});}_0x2bac8f=_['merge']({},_0x2bac8f,_0x119f05[_0x30f1('0x3d')]);var _0x4e2e74={'where':_0x2bac8f[_0x30f1('0x3a')]};return db[_0x30f1('0x3e')][_0x30f1('0x3f')](_0x4e2e74)['then'](function(_0x2bc678){_0x46ba1f[_0x30f1('0x3f')]=_0x2bc678;if(_0x119f05['query']['includeAll']){_0x2bac8f['include']=[{'all':!![]}];}return db[_0x30f1('0x3e')][_0x30f1('0x40')](_0x2bac8f);})[_0x30f1('0x24')](function(_0x46dfec){_0x46ba1f[_0x30f1('0x41')]=_0x46dfec;return _0x46ba1f;})[_0x30f1('0x24')](respondWithFilteredResult(_0x5976ad,_0x2bac8f))['catch'](handleError(_0x5976ad,null));};exports[_0x30f1('0x42')]=function(_0x110778,_0x4a05b3){var _0x407e36={'raw':!![],'where':{'id':_0x110778[_0x30f1('0x43')]['id']}},_0x5e0bd2={};_0x5e0bd2[_0x30f1('0x31')]=_['keys'](db['SmsApplication'][_0x30f1('0x44')]);_0x5e0bd2[_0x30f1('0x2e')]=_[_0x30f1('0x2f')](_0x110778[_0x30f1('0x2e')]);_0x5e0bd2[_0x30f1('0x37')]=_[_0x30f1('0x30')](_0x5e0bd2[_0x30f1('0x31')],_0x5e0bd2[_0x30f1('0x2e')]);_0x407e36['attributes']=_[_0x30f1('0x30')](_0x5e0bd2['model'],qs['fields'](_0x110778[_0x30f1('0x2e')]['fields']));_0x407e36['attributes']=_0x407e36[_0x30f1('0x32')]['length']?_0x407e36[_0x30f1('0x32')]:_0x5e0bd2[_0x30f1('0x31')];if(_0x110778[_0x30f1('0x2e')][_0x30f1('0x45')]){_0x407e36[_0x30f1('0x46')]=[{'all':!![]}];}_0x407e36=_['merge']({},_0x407e36,_0x110778['options']);return db['SmsApplication'][_0x30f1('0x47')](_0x407e36)['then'](handleEntityNotFound(_0x4a05b3,null))['then'](respondWithResult(_0x4a05b3,null))[_0x30f1('0x48')](handleError(_0x4a05b3,null));};exports['create']=function(_0x521c7f,_0x6d1342){return db[_0x30f1('0x3e')][_0x30f1('0x49')](_0x521c7f['body'],{})[_0x30f1('0x24')](respondWithResult(_0x6d1342,0xc9))[_0x30f1('0x48')](handleError(_0x6d1342,null));};exports[_0x30f1('0x23')]=function(_0x69dfc2,_0x1a5ac8){if(_0x69dfc2[_0x30f1('0x4a')]['id']){delete _0x69dfc2[_0x30f1('0x4a')]['id'];}return db[_0x30f1('0x3e')][_0x30f1('0x47')]({'where':{'id':_0x69dfc2[_0x30f1('0x43')]['id']}})[_0x30f1('0x24')](handleEntityNotFound(_0x1a5ac8,null))[_0x30f1('0x24')](saveUpdates(_0x69dfc2[_0x30f1('0x4a')],null))[_0x30f1('0x24')](respondWithResult(_0x1a5ac8,null))['catch'](handleError(_0x1a5ac8,null));};exports[_0x30f1('0x25')]=function(_0x107b4e,_0x3b2e49){return db[_0x30f1('0x3e')][_0x30f1('0x47')]({'where':{'id':_0x107b4e[_0x30f1('0x43')]['id']}})[_0x30f1('0x24')](handleEntityNotFound(_0x3b2e49,null))[_0x30f1('0x24')](removeEntity(_0x3b2e49,null))['catch'](handleError(_0x3b2e49,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index a361614..640b857 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 _0xc95d=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x51f34d,_0x5847ca){var _0x2a747e=function(_0x439ed6){while(--_0x439ed6){_0x51f34d['push'](_0x51f34d['shift']());}};_0x2a747e(++_0x5847ca);}(_0xc95d,0xd8));var _0xdc95=function(_0x47695c,_0x34d59b){_0x47695c=_0x47695c-0x0;var _0x218087=_0xc95d[_0x47695c];return _0x218087;};'use strict';var _=require(_0xdc95('0x0'));var util=require('util');var logger=require(_0xdc95('0x1'))(_0xdc95('0x2'));var moment=require(_0xdc95('0x3'));var BPromise=require(_0xdc95('0x4'));var rp=require(_0xdc95('0x5'));var fs=require('fs');var path=require(_0xdc95('0x6'));var rimraf=require(_0xdc95('0x7'));var config=require(_0xdc95('0x8'));var attributes=require(_0xdc95('0x9'));module[_0xdc95('0xa')]=function(_0x2c2fa4,_0x1698c5){return _0x2c2fa4[_0xdc95('0xb')](_0xdc95('0xc'),attributes,{'tableName':_0xdc95('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdc95('0xe'),'collate':_0xdc95('0xf')});}; \ No newline at end of file +var _0x1702=['request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x2c6af3,_0x3ce442){var _0x4895bf=function(_0x5566cf){while(--_0x5566cf){_0x2c6af3['push'](_0x2c6af3['shift']());}};_0x4895bf(++_0x3ce442);}(_0x1702,0x1cb));var _0x2170=function(_0x1b3b42,_0x182bc9){_0x1b3b42=_0x1b3b42-0x0;var _0x4dfcec=_0x1702[_0x1b3b42];return _0x4dfcec;};'use strict';var _=require(_0x2170('0x0'));var util=require(_0x2170('0x1'));var logger=require('../../config/logger')(_0x2170('0x2'));var moment=require(_0x2170('0x3'));var BPromise=require(_0x2170('0x4'));var rp=require(_0x2170('0x5'));var fs=require('fs');var path=require(_0x2170('0x6'));var rimraf=require(_0x2170('0x7'));var config=require(_0x2170('0x8'));var attributes=require(_0x2170('0x9'));module[_0x2170('0xa')]=function(_0xf4c6b1,_0x1d0a42){return _0xf4c6b1[_0x2170('0xb')](_0x2170('0xc'),attributes,{'tableName':_0x2170('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2170('0xe'),'collate':_0x2170('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index de19a92..edc5832 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 _0xdc97=['SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x262a21,_0xb5c415){var _0x30012c=function(_0x3723e1){while(--_0x3723e1){_0x262a21['push'](_0x262a21['shift']());}};_0x30012c(++_0xb5c415);}(_0xdc97,0x13b));var _0x7dc9=function(_0x45383c,_0x5ee1e5){_0x45383c=_0x45383c-0x0;var _0x231021=_0xdc97[_0x45383c];return _0x231021;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var moment=require(_0x7dc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x7dc9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dc9('0x4'))['db'];var utils=require(_0x7dc9('0x5'));var logger=require('../../config/logger')(_0x7dc9('0x6'));var config=require(_0x7dc9('0x7'));var jayson=require(_0x7dc9('0x8'));var client=jayson[_0x7dc9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2636ef,_0x4f91c7,_0x4b3229){return new BPromise(function(_0x2ff923,_0x23737d){return client[_0x7dc9('0xa')](_0x2636ef,_0x4b3229)[_0x7dc9('0xb')](function(_0x3dd07e){logger['info'](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));logger[_0x7dc9('0xe')](_0x7dc9('0xf'),_0x4f91c7,_0x7dc9('0xd'),JSON[_0x7dc9('0x10')](_0x3dd07e));if(_0x3dd07e[_0x7dc9('0x11')]){if(_0x3dd07e['error']['code']===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x23737d(_0x3dd07e['error'][_0x7dc9('0x12')]);}logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x3dd07e[_0x7dc9('0x11')][_0x7dc9('0x12')]);return _0x2ff923(_0x3dd07e[_0x7dc9('0x11')]['message']);}else{logger[_0x7dc9('0x13')](_0x7dc9('0xc'),_0x4f91c7,_0x7dc9('0xd'));_0x2ff923(_0x3dd07e[_0x7dc9('0x14')][_0x7dc9('0x12')]);}})[_0x7dc9('0x15')](function(_0x45698c){logger[_0x7dc9('0x11')](_0x7dc9('0xc'),_0x4f91c7,_0x45698c);_0x23737d(_0x45698c);});});} \ No newline at end of file +var _0xc4f5=['debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x31acd6,_0x22452d){var _0x50178d=function(_0x67c148){while(--_0x67c148){_0x31acd6['push'](_0x31acd6['shift']());}};_0x50178d(++_0x22452d);}(_0xc4f5,0xa5));var _0x5c4f=function(_0x583125,_0x34c12b){_0x583125=_0x583125-0x0;var _0x118c4d=_0xc4f5[_0x583125];return _0x118c4d;};'use strict';var _=require('lodash');var util=require(_0x5c4f('0x0'));var moment=require(_0x5c4f('0x1'));var BPromise=require(_0x5c4f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5c4f('0x3'));var db=require(_0x5c4f('0x4'))['db'];var utils=require(_0x5c4f('0x5'));var logger=require(_0x5c4f('0x6'))(_0x5c4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x5c4f('0x8'));var client=jayson[_0x5c4f('0x9')][_0x5c4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x123651,_0x51be50,_0x48f095){return new BPromise(function(_0x1ec0c8,_0x4a7bd4){return client[_0x5c4f('0xb')](_0x123651,_0x48f095)['then'](function(_0x381d46){logger[_0x5c4f('0xc')](_0x5c4f('0xd'),_0x51be50,_0x5c4f('0xe'));logger[_0x5c4f('0xf')](_0x5c4f('0x10'),_0x51be50,_0x5c4f('0xe'),JSON['stringify'](_0x381d46));if(_0x381d46[_0x5c4f('0x11')]){if(_0x381d46[_0x5c4f('0x11')]['code']===0x1f4){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x4a7bd4(_0x381d46[_0x5c4f('0x11')]['message']);}logger['error'](_0x5c4f('0xd'),_0x51be50,_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);return _0x1ec0c8(_0x381d46[_0x5c4f('0x11')][_0x5c4f('0x12')]);}else{logger['info']('SmsApplication,\x20%s,\x20%s',_0x51be50,_0x5c4f('0xe'));_0x1ec0c8(_0x381d46['result']['message']);}})[_0x5c4f('0x13')](function(_0x5154eb){logger[_0x5c4f('0x11')](_0x5c4f('0xd'),_0x51be50,_0x5154eb);_0x4a7bd4(_0x5154eb);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index f7ddb72..0b7a017 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 _0x2210=['post','/:id/messages','addMessage','/:id/tags','sms','smsinteraction:addtags','put','/:id','tracked','smsinteraction:update','smsinteraction:destroy','destroy','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','index','isAuthenticated','describe','getMessages','/:id/download'];(function(_0x301200,_0x149e5e){var _0x26e3f2=function(_0x28b794){while(--_0x28b794){_0x301200['push'](_0x301200['shift']());}};_0x26e3f2(++_0x149e5e);}(_0x2210,0x1f4));var _0x0221=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x2210[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x0221('0x0'));var util=require(_0x0221('0x1'));var path=require(_0x0221('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0221('0x3')]();var auth=require(_0x0221('0x4'));var interaction=require(_0x0221('0x5'));var config=require('../../config/environment');var controller=require(_0x0221('0x6'));router[_0x0221('0x7')]('/',auth['isAuthenticated'](),controller[_0x0221('0x8')]);router['get']('/describe',auth[_0x0221('0x9')](),controller[_0x0221('0xa')]);router['get']('/:id',auth[_0x0221('0x9')](),controller['show']);router[_0x0221('0x7')]('/:id/messages',auth[_0x0221('0x9')](),controller[_0x0221('0xb')]);router[_0x0221('0x7')](_0x0221('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x0221('0xd')]('/',auth[_0x0221('0x9')](),controller['create']);router[_0x0221('0xd')](_0x0221('0xe'),auth['isAuthenticated'](),controller[_0x0221('0xf')]);router[_0x0221('0xd')](_0x0221('0x10'),auth[_0x0221('0x9')](),interaction['tracked'](_0x0221('0x11'),_0x0221('0x12')),controller['addTags']);router[_0x0221('0x13')](_0x0221('0x14'),auth[_0x0221('0x9')](),interaction[_0x0221('0x15')]('sms',_0x0221('0x16')),controller['update']);router['delete']('/:id',auth[_0x0221('0x9')](),interaction[_0x0221('0x15')](_0x0221('0x11'),_0x0221('0x17')),controller[_0x0221('0x18')]);router[_0x0221('0x19')](_0x0221('0x10'),auth[_0x0221('0x9')](),controller['removeTags']);module[_0x0221('0x1a')]=router; \ No newline at end of file +var _0x9d6e=['/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','removeTags','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x3d8a90,_0xf5f381){var _0x74f158=function(_0x1285f5){while(--_0x1285f5){_0x3d8a90['push'](_0x3d8a90['shift']());}};_0x74f158(++_0xf5f381);}(_0x9d6e,0xcc));var _0xe9d6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9d6e[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xe9d6('0x0'));var util=require(_0xe9d6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xe9d6('0x2'));var interaction=require(_0xe9d6('0x3'));var config=require(_0xe9d6('0x4'));var controller=require(_0xe9d6('0x5'));router[_0xe9d6('0x6')]('/',auth[_0xe9d6('0x7')](),controller[_0xe9d6('0x8')]);router[_0xe9d6('0x6')](_0xe9d6('0x9'),auth[_0xe9d6('0x7')](),controller['describe']);router[_0xe9d6('0x6')](_0xe9d6('0xa'),auth[_0xe9d6('0x7')](),controller[_0xe9d6('0xb')]);router[_0xe9d6('0x6')](_0xe9d6('0xc'),auth[_0xe9d6('0x7')](),controller[_0xe9d6('0xd')]);router['get']('/:id/download',auth[_0xe9d6('0x7')](),controller['download']);router[_0xe9d6('0xe')]('/',auth[_0xe9d6('0x7')](),controller[_0xe9d6('0xf')]);router[_0xe9d6('0xe')]('/:id/messages',auth['isAuthenticated'](),controller[_0xe9d6('0x10')]);router[_0xe9d6('0xe')](_0xe9d6('0x11'),auth[_0xe9d6('0x7')](),interaction[_0xe9d6('0x12')](_0xe9d6('0x13'),_0xe9d6('0x14')),controller[_0xe9d6('0x15')]);router[_0xe9d6('0x16')](_0xe9d6('0xa'),auth['isAuthenticated'](),interaction[_0xe9d6('0x12')](_0xe9d6('0x13'),_0xe9d6('0x17')),controller['update']);router['delete'](_0xe9d6('0xa'),auth[_0xe9d6('0x7')](),interaction['tracked'](_0xe9d6('0x13'),'smsinteraction:destroy'),controller['destroy']);router[_0xe9d6('0x18')](_0xe9d6('0x11'),auth[_0xe9d6('0x7')](),controller[_0xe9d6('0x19')]);module[_0xe9d6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index a975d7b..a0195c9 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 _0x9631=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x329546,_0x59b559){var _0x9482b7=function(_0x1913fa){while(--_0x1913fa){_0x329546['push'](_0x329546['shift']());}};_0x9482b7(++_0x59b559);}(_0x9631,0x19c));var _0x1963=function(_0x174fae,_0x5d7bad){_0x174fae=_0x174fae-0x0;var _0x5d8970=_0x9631[_0x174fae];return _0x5d8970;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1963('0x0'));module[_0x1963('0x1')]={'closed':{'type':Sequelize[_0x1963('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1963('0x3')]},'disposition':{'type':Sequelize[_0x1963('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x1963('0x4')]},'note':{'type':Sequelize[_0x1963('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1963('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1963('0x5')]('in',_0x1963('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1963('0x5')]('in',_0x1963('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x20b7=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x1da8a2,_0x33c02c){var _0x16c2bb=function(_0x95c284){while(--_0x95c284){_0x1da8a2['push'](_0x1da8a2['shift']());}};_0x16c2bb(++_0x33c02c);}(_0x20b7,0xc3));var _0x720b=function(_0x5a4bc9,_0x4c3207){_0x5a4bc9=_0x5a4bc9-0x0;var _0x563b2c=_0x20b7[_0x5a4bc9];return _0x563b2c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x720b('0x0'));module[_0x720b('0x1')]={'closed':{'type':Sequelize[_0x720b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x720b('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x720b('0x4')]},'thirdDisposition':{'type':Sequelize[_0x720b('0x4')]},'note':{'type':Sequelize[_0x720b('0x4')]},'phone':{'type':Sequelize[_0x720b('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x720b('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x720b('0x5')]('in',_0x720b('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index f08be66..6e502e3 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 _0x16cd=['where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','agent','toString','sequelize','keyBy','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.*','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','SmsInteractionId','rows','catch','params','includeAll','include','options','create','update','describe','addMessage','ids','omit','findOne','SmsMessage','nolimit','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','smsInteractionTags:save','join','root','server','files','attachments','CmContact','lastName','Messages','direction','SmsAccount','Account','mkdirSync','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','Owner','closed','closedAt','out','firstName','secret','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','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/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','end','stack','send','Users','fullname','TagIds','forEach','Tags','push','index','SmsInteraction','rawAttributes','type','key','map','name','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','pick','field','color','from','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','SmsAccountId'];(function(_0x2681d4,_0x4806f2){var _0x40d09e=function(_0x817e14){while(--_0x817e14){_0x2681d4['push'](_0x2681d4['shift']());}};_0x40d09e(++_0x4806f2);}(_0x16cd,0x15d));var _0xd16c=function(_0x334599,_0x4b1cfa){_0x334599=_0x334599-0x0;var _0x4cdff2=_0x16cd[_0x334599];return _0x4cdff2;};'use strict';var pdf=require(_0xd16c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd16c('0x1'));var jsonpatch=require(_0xd16c('0x2'));var rp=require(_0xd16c('0x3'));var moment=require(_0xd16c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd16c('0x5'));var util=require(_0xd16c('0x6'));var path=require(_0xd16c('0x7'));var sox=require('sox');var csv=require(_0xd16c('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd16c('0x9'));var squel=require('squel');var crypto=require(_0xd16c('0xa'));var jsforce=require(_0xd16c('0xb'));var deskjs=require(_0xd16c('0xc'));var toCsv=require(_0xd16c('0x8'));var querystring=require(_0xd16c('0xd'));var Papa=require(_0xd16c('0xe'));var Redis=require(_0xd16c('0xf'));var authService=require(_0xd16c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd16c('0x11'));var hardwareService=require(_0xd16c('0x12'));var logger=require(_0xd16c('0x13'))(_0xd16c('0x14'));var utils=require(_0xd16c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd16c('0x16'));var db=require(_0xd16c('0x17'))['db'];config[_0xd16c('0x18')]=_['defaults'](config['redis'],{'host':_0xd16c('0x19'),'port':0x18eb});var socket=require(_0xd16c('0x1a'))(new Redis(config[_0xd16c('0x18')]));require(_0xd16c('0x1b'))[_0xd16c('0x1c')](socket);function respondWithStatusCode(_0x375ce2,_0x452c3e){_0x452c3e=_0x452c3e||0xcc;return function(_0x30c855){if(_0x30c855){return _0x375ce2[_0xd16c('0x1d')](_0x452c3e);}return _0x375ce2[_0xd16c('0x1e')](_0x452c3e)['end']();};}function respondWithResult(_0x2138a7,_0x44336a){_0x44336a=_0x44336a||0xc8;return function(_0x494d76){if(_0x494d76){return _0x2138a7[_0xd16c('0x1e')](_0x44336a)['json'](_0x494d76);}};}function respondWithFilteredResult(_0x423794,_0xb8cff9){return function(_0x374f1d){if(_0x374f1d){var _0x29c1cb=_0x374f1d[_0xd16c('0x1f')],_0x2b61fd=_0xb8cff9[_0xd16c('0x20')],_0x64eb41=_0xb8cff9['offset']+_0xb8cff9[_0xd16c('0x21')],_0x47d753;if(_0x64eb41>=_0x29c1cb){_0x64eb41=_0x29c1cb;_0x47d753=0xc8;}else{_0x47d753=0xce;}_0x423794[_0xd16c('0x1e')](_0x47d753);return _0x423794[_0xd16c('0x22')](_0xd16c('0x23'),_0x2b61fd+'-'+_0x64eb41+'/'+_0x29c1cb)[_0xd16c('0x24')](_0x374f1d);}return null;};}function patchUpdates(_0x1c4b9d){return function(_0x2993db){try{jsonpatch[_0xd16c('0x25')](_0x2993db,_0x1c4b9d,!![]);}catch(_0x9eb4a){return BPromise['reject'](_0x9eb4a);}return _0x2993db[_0xd16c('0x26')]();};}function saveUpdates(_0x2a2007,_0x57fdfc){return function(_0x2c912b){if(_0x2c912b){return _0x2c912b['update'](_0x2a2007)[_0xd16c('0x27')](function(_0x55db63){return _0x55db63;});}return null;};}function removeEntity(_0x575163,_0x28db1d){return function(_0x47ad57){if(_0x47ad57){return _0x47ad57[_0xd16c('0x28')]()['then'](function(){_0x575163[_0xd16c('0x1e')](0xcc)[_0xd16c('0x29')]();});}};}function handleEntityNotFound(_0x4873e8,_0x492111){return function(_0x1f4035){if(!_0x1f4035){_0x4873e8[_0xd16c('0x1d')](0x194);}return _0x1f4035;};}function handleError(_0x1a21ba,_0x14683f){_0x14683f=_0x14683f||0x1f4;return function(_0x4c5b85){logger['error'](_0x4c5b85[_0xd16c('0x2a')]);if(_0x4c5b85['name']){delete _0x4c5b85['name'];}_0x1a21ba[_0xd16c('0x1e')](_0x14683f)[_0xd16c('0x2b')](_0x4c5b85);};}function getInteractionUsers(_0x213b17,_0x20d43b){return new BPromise(function(_0x2a5dfe,_0x5c5909){try{if(_0x20d43b[_0x213b17['id']]){_0x213b17[_0xd16c('0x2c')]=_['map'](_0x20d43b[_0x213b17['id']],function(_0x493707){return{'id':_0x493707['id'],'fullname':_0x493707[_0xd16c('0x2d')]};});}}catch(_0x5ce7e6){_0x5c5909(_0x5ce7e6);}_0x2a5dfe(_0x213b17);});}function getInteractionTags(_0xf745df,_0x5c1e33){return new BPromise(function(_0x25b93c,_0x43ca21){try{if(_0xf745df['TagIds']){_0xf745df['Tags']=[];_0xf745df[_0xd16c('0x2e')]['split'](',')[_0xd16c('0x2f')](function(_0xb86e81){_0xf745df[_0xd16c('0x30')][_0xd16c('0x31')](_0x5c1e33[_0xb86e81]);});}delete _0xf745df[_0xd16c('0x2e')];}catch(_0x3b8041){_0x43ca21(_0x3b8041);}_0x25b93c(_0xf745df);});}function updateSmsInteraction(_0x3847b1,_0x1fdbff,_0x3e74c7){return new BPromise(function(_0x568f01,_0x2352be){return getInteractionUsers(_0x3847b1,_0x3e74c7)[_0xd16c('0x27')](function(_0x4e49fe){return getInteractionTags(_0x4e49fe,_0x1fdbff);})[_0xd16c('0x27')](function(_0x2afe58){_0x568f01(_0x2afe58);})['catch'](function(_0x44bd9f){_0x2352be(_0x44bd9f);});});}exports[_0xd16c('0x32')]=function(_0x36e22d,_0xd73bc3){var _0x149197={},_0x3784e8={},_0xf72594={'count':0x0,'rows':[]};var _0x43c1d3=_['map'](db[_0xd16c('0x33')][_0xd16c('0x34')],function(_0x59568f){return{'name':_0x59568f['fieldName'],'type':_0x59568f[_0xd16c('0x35')][_0xd16c('0x36')]};});_0x3784e8['model']=_[_0xd16c('0x37')](_0x43c1d3,_0xd16c('0x38'));_0x3784e8[_0xd16c('0x39')]=_[_0xd16c('0x3a')](_0x36e22d[_0xd16c('0x39')]);_0x3784e8[_0xd16c('0x3b')]=_[_0xd16c('0x3c')](_0x3784e8['model'],_0x3784e8[_0xd16c('0x39')]);_0x149197['attributes']=_[_0xd16c('0x3c')](_0x3784e8[_0xd16c('0x3d')],qs[_0xd16c('0x3e')](_0x36e22d[_0xd16c('0x39')][_0xd16c('0x3e')]));_0x149197[_0xd16c('0x3f')]=_0x149197[_0xd16c('0x3f')]['length']?_0x149197[_0xd16c('0x3f')]:_0x3784e8[_0xd16c('0x3d')];if(!_0x36e22d['query'][_0xd16c('0x40')]('nolimit')){_0x149197[_0xd16c('0x21')]=qs[_0xd16c('0x21')](_0x36e22d['query'][_0xd16c('0x21')]);_0x149197[_0xd16c('0x20')]=qs['offset'](_0x36e22d['query']['offset']);}_0x149197[_0xd16c('0x41')]=qs['sort'](_0x36e22d[_0xd16c('0x39')][_0xd16c('0x42')]);_0x149197['where']=qs['filters'](_[_0xd16c('0x43')](_0x36e22d[_0xd16c('0x39')],_0x3784e8[_0xd16c('0x3b')]),_0x43c1d3);var _0x32b1e3=[];var _0x8d4de3=squel['select']()[_0xd16c('0x44')]('id')[_0xd16c('0x44')](_0xd16c('0x38'))['field'](_0xd16c('0x45'))[_0xd16c('0x46')]('tools_tags');var _0x4994c4=squel[_0xd16c('0x47')]()[_0xd16c('0x44')](_0xd16c('0x48'))['field'](_0xd16c('0x49'))[_0xd16c('0x44')](_0xd16c('0x4a'))[_0xd16c('0x46')](_0xd16c('0x4b'),'ui')[_0xd16c('0x4c')](_0xd16c('0x4d'),'u',_0xd16c('0x4e'));var _0x2144c6=squel[_0xd16c('0x47')]()[_0xd16c('0x46')](_0xd16c('0x4f'),'i')[_0xd16c('0x4c')]('cm_contacts','c',_0xd16c('0x50'))[_0xd16c('0x4c')](_0xd16c('0x4d'),'o',_0xd16c('0x51'))[_0xd16c('0x4c')](_0xd16c('0x52'),'a','a.id\x20=\x20i.SmsAccountId')[_0xd16c('0x4c')](_0xd16c('0x53'),'me','me.SmsInteractionId\x20=\x20i.id')['left_join'](_0xd16c('0x54'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xd16c('0x4c')](_0xd16c('0x55'),'t',_0xd16c('0x56'));var _0xdc1e22=squel['expr']();var _0x36422a=[];var _0x4dc5b5=squel[_0xd16c('0x57')]();var _0x1d640e;if(_0x36e22d[_0xd16c('0x39')][_0xd16c('0x58')]){_0x1d640e=as[_0xd16c('0x59')](_0x36e22d[_0xd16c('0x39')][_0xd16c('0x58')]);var _0x5ecf4c=_0x1d640e['sqlOperator'];for(var _0x344bfe=0x0;_0x344bfe<_0x1d640e[_0xd16c('0x5a')][_0xd16c('0x5b')];_0x344bfe++){var _0x2cc255=_0x1d640e[_0xd16c('0x5a')][_0x344bfe];var _0x6900ec='i';var _0x113003=_[_0xd16c('0x5c')](_0x43c1d3,['name',_0x2cc255[_0xd16c('0x44')]]);if(!_0x113003){switch(_0x2cc255['field']){case _0xd16c('0x5d'):if(_0x2cc255[_0xd16c('0x5e')]==0x1){_0x2144c6[_0xd16c('0x5f')]('`'+_0x2cc255[_0xd16c('0x44')]+_0xd16c('0x60'));}else{_0x2144c6[_0xd16c('0x5f')]('`'+_0x2cc255[_0xd16c('0x44')]+'`\x20>\x200');}break;case _0xd16c('0x61'):if(_0x2cc255[_0xd16c('0x62')]===_0xd16c('0x63')){if(_0x2cc255[_0xd16c('0x5e')][_0xd16c('0x64')]('\x20')['length']>0x1){_0xdc1e22[_0x5ecf4c](_0xd16c('0x65'),qs[_0xd16c('0x66')](_0x2cc255[_0xd16c('0x5e')]),null);}else{var _0x509395='%'+_0x2cc255[_0xd16c('0x5e')]+'%';_0xdc1e22[_0x5ecf4c](_0xd16c('0x67'),_0x509395,_0x509395,_0x509395);}}else{_0x113003=_[_0xd16c('0x5c')](_0x43c1d3,[_0xd16c('0x38'),_0xd16c('0x68')]);_0x2cc255[_0xd16c('0x44')]=_0xd16c('0x68');_0x526541=as['buildExpression'](_0x6900ec,_0x113003[_0xd16c('0x35')],_0x2cc255);_0xdc1e22[_0x5ecf4c](_0x526541[_0xd16c('0x69')],_0x526541[_0xd16c('0x5e')][_0xd16c('0x6a')],_0x526541[_0xd16c('0x5e')]['end']);}break;case _0xd16c('0x6b'):var _0x59e25e=_0x2cc255[_0xd16c('0x5e')]['split'](',')[_0xd16c('0x37')](function(_0x248340){return Number(_0x248340);});_0x59e25e['forEach'](function(_0x29a3d0){_0x4dc5b5['or'](_0xd16c('0x6c'),'%,'+_0x29a3d0+',%');});_0x36422a=_[_0xd16c('0x6d')](_0x36422a,_0x59e25e);break;case _0xd16c('0x6e'):if(_0x2cc255[_0xd16c('0x62')]===_0xd16c('0x63')){_0xdc1e22[_0x5ecf4c](_0xd16c('0x6f'),'%'+_0x2cc255[_0xd16c('0x5e')]+'%',null);}else{_0x113003=_[_0xd16c('0x5c')](_0x43c1d3,['name',_0xd16c('0x70')]);_0x2cc255['field']=_0xd16c('0x70');_0x526541=as[_0xd16c('0x71')](_0x6900ec,_0x113003[_0xd16c('0x35')],_0x2cc255);_0xdc1e22[_0x5ecf4c](_0x526541[_0xd16c('0x69')],_0x526541[_0xd16c('0x5e')][_0xd16c('0x6a')],_0x526541[_0xd16c('0x5e')][_0xd16c('0x29')]);}break;case _0xd16c('0x72'):_0x526541=as[_0xd16c('0x71')]('me',null,_0x2cc255);_0xdc1e22[_0x5ecf4c](_0x526541[_0xd16c('0x69')],_0x526541[_0xd16c('0x5e')]['start'],_0x526541[_0xd16c('0x5e')][_0xd16c('0x29')]);break;}}else{var _0x526541=as['buildExpression'](_0x6900ec,_0x113003[_0xd16c('0x35')],_0x2cc255);_0xdc1e22[_0x5ecf4c](_0x526541[_0xd16c('0x69')],_0x526541[_0xd16c('0x5e')][_0xd16c('0x6a')],_0x526541['value']['end']);}}}else{var _0x291034=_(_0x36e22d['query'])[_0xd16c('0x3a')]()[_0xd16c('0x37')](function(_0x23514f){return _[_0xd16c('0x73')](_0x43c1d3,['name',_0x23514f])?_0x23514f:undefined;})[_0xd16c('0x74')]()['value']();if(!_[_0xd16c('0x75')](_0x291034)){_0x291034['forEach'](function(_0x3df940){if(_0x3df940===_0xd16c('0x76')){_0x2144c6[_0xd16c('0x77')](_0xd16c('0x78'),[]['concat'](_0x36e22d['query'][_0x3df940]));}else if(_0x3df940===_0xd16c('0x79')){var _0x2f299c=JSON['parse'](_0x36e22d[_0xd16c('0x39')][_0x3df940])['$gte'];var _0x1b9d08=JSON[_0xd16c('0x7a')](_0x36e22d[_0xd16c('0x39')][_0x3df940])[_0xd16c('0x7b')];_0x2144c6['where'](_0xd16c('0x7c'),_0x2f299c,_0x1b9d08);}else{if(_0x36e22d[_0xd16c('0x39')][_0x3df940]===_0xd16c('0x7d')){_0x2144c6[_0xd16c('0x77')]('i.'+_0x3df940+_0xd16c('0x7e'));}else{_0x2144c6[_0xd16c('0x77')]('i.'+_0x3df940+'\x20=\x20?',_0x36e22d['query'][_0x3df940]);}}});}if(_0x36e22d[_0xd16c('0x39')][_0xd16c('0x7f')]){if(_0x36e22d[_0xd16c('0x39')][_0xd16c('0x7f')]==0x1){_0x2144c6[_0xd16c('0x5f')](_0xd16c('0x80'));}else{_0x2144c6['having'](_0xd16c('0x81'));}}if(_0x36e22d[_0xd16c('0x39')][_0xd16c('0x82')]){_0x36422a=_[_0xd16c('0x83')](_0x36e22d[_0xd16c('0x39')][_0xd16c('0x82')])?_0x36e22d[_0xd16c('0x39')][_0xd16c('0x82')]:new Array(_0x36e22d[_0xd16c('0x39')][_0xd16c('0x82')]);_0x36422a[_0xd16c('0x2f')](function(_0x356636){_0x4dc5b5['or'](_0xd16c('0x6c'),'%,'+_0x356636+',%');});}if(_0x36e22d[_0xd16c('0x39')]['filter']){var _0x2dd096=_0x36e22d[_0xd16c('0x39')][_0xd16c('0x84')]['replace']('\x5c','\x5c\x5c')[_0xd16c('0x85')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2dd096)){_0xdc1e22['or'](_0xd16c('0x86'),_0x2dd096+'%')['or']('i.phone\x20LIKE\x20?',_0x2dd096+'%');}else{_0xdc1e22['or'](_0xd16c('0x87'),qs[_0xd16c('0x66')](_0x2dd096))['or'](_0xd16c('0x88'),_0x2dd096+'%');}}}_0x2144c6[_0xd16c('0x77')](_0xdc1e22);_0x2144c6['group'](_0xd16c('0x89'));var _0x565244={'type':db[_0xd16c('0x8a')][_0xd16c('0x8b')][_0xd16c('0x8c')],'raw':!![]};var _0x4843f5=_0x2144c6[_0xd16c('0x8d')]();_0x4843f5[_0xd16c('0x44')](_0xd16c('0x89'));_0x4843f5[_0xd16c('0x44')](_0xd16c('0x8e'),_0xd16c('0x5d'));if(_0x149197[_0xd16c('0x41')]){_0x149197[_0xd16c('0x41')]['forEach'](function(_0x39ca7b){var _0x4552d6=_0x39ca7b[0x0]==='contactName'?_0x39ca7b[0x0]:'i.'+_0x39ca7b[0x0];_0x2144c6[_0xd16c('0x41')](_0x4552d6,_0x39ca7b[0x1]==='DESC'?![]:!![]);});}if(!_[_0xd16c('0x75')](_0x36422a)){_0x2144c6[_0xd16c('0x5f')](_0x4dc5b5);_0x4843f5['where'](_0xd16c('0x8f'),_0x36422a);}BPromise[_0xd16c('0x90')]()['then'](function(){if(!_0x1d640e){if(_0x36e22d['query'][_0xd16c('0x76')]||_0x36e22d[_0xd16c('0x39')][_0xd16c('0x91')])return;_0x4843f5[_0xd16c('0x77')](_0xd16c('0x92'));_0x2144c6['where'](_0xd16c('0x92'));return;}if(_0x36e22d[_0xd16c('0x93')][_0xd16c('0x94')]!=='agent')return;return _0x36e22d[_0xd16c('0x93')][_0xd16c('0x95')]({'attributes':['id'],'raw':!![]})[_0xd16c('0x27')](function(_0x243659){if(_[_0xd16c('0x75')](_0x243659)){_0x4843f5['where']('i.SmsAccountId\x20IS\x20NULL');_0x2144c6[_0xd16c('0x77')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x4843f5[_0xd16c('0x77')]('i.SmsAccountId\x20IN\x20?',_[_0xd16c('0x37')](_0x243659,'id'));_0x2144c6[_0xd16c('0x77')](_0xd16c('0x78'),_[_0xd16c('0x37')](_0x243659,'id'));}});})[_0xd16c('0x27')](function(){if(_0x36e22d[_0xd16c('0x93')]['role']===_0xd16c('0x96')&&!_0x1d640e&&!_0x36e22d[_0xd16c('0x39')][_0xd16c('0x76')])return[];return db['sequelize'][_0xd16c('0x39')](_0x4843f5[_0xd16c('0x97')](),_0x565244);})['then'](function(_0xcad032){_0xf72594[_0xd16c('0x1f')]=_0xcad032['length'];if(_0xf72594[_0xd16c('0x1f')]===0x0)return[];return db[_0xd16c('0x98')]['query'](_0x8d4de3[_0xd16c('0x97')](),_0x565244)['then'](function(_0x5f8e4a){_0x32b1e3=_[_0xd16c('0x99')](_0x5f8e4a,'id');_0x565244=_['merge'](_0x565244,{'model':db[_0xd16c('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36e22d[_0xd16c('0x39')][_0xd16c('0x3e')]){_0x149197[_0xd16c('0x3f')][_0xd16c('0x2f')](function(_0xc78b6c){_0x2144c6['field']('i.'+_0xc78b6c);});}else{_0x2144c6[_0xd16c('0x44')](_0xd16c('0x8e'),_0xd16c('0x5d'));_0x2144c6[_0xd16c('0x44')](_0xd16c('0x9a'),_0xd16c('0x9b'));_0x2144c6[_0xd16c('0x44')](_0xd16c('0x9c'),_0xd16c('0x9d'));_0x2144c6['field'](_0xd16c('0x9e'),_0xd16c('0x9f'));_0x2144c6[_0xd16c('0x44')](_0xd16c('0xa0'));_0x2144c6['field']('c.firstName',_0xd16c('0xa1'));_0x2144c6[_0xd16c('0x44')](_0xd16c('0xa2'),_0xd16c('0xa3'));_0x2144c6[_0xd16c('0x44')]('c.email',_0xd16c('0xa4'));_0x2144c6[_0xd16c('0x44')](_0xd16c('0xa5'),_0xd16c('0xa6'));_0x2144c6[_0xd16c('0x44')](_0xd16c('0xa7'),'Contact.mobile');_0x2144c6[_0xd16c('0x44')](_0xd16c('0xa8'),_0xd16c('0xa9'));_0x2144c6[_0xd16c('0x44')](_0xd16c('0xaa'),_0xd16c('0xab'));_0x2144c6[_0xd16c('0x44')]('o.internal',_0xd16c('0xac'));_0x2144c6[_0xd16c('0x44')](_0xd16c('0xad'),'TagIds');}if(_0x149197['limit'])_0x2144c6[_0xd16c('0x21')](_0x149197[_0xd16c('0x21')]);if(_0x149197[_0xd16c('0x20')])_0x2144c6[_0xd16c('0x20')](_0x149197[_0xd16c('0x20')]);return db[_0xd16c('0x98')]['query'](_0x2144c6[_0xd16c('0x97')](),_0x565244);})[_0xd16c('0x27')](function(_0xee2aef){_0x4994c4[_0xd16c('0x77')]('ui.SmsInteractionId\x20IN\x20?',_[_0xd16c('0x37')](_0xee2aef,'id'));return db[_0xd16c('0x98')][_0xd16c('0x39')](_0x4994c4[_0xd16c('0x97')](),_0x565244)[_0xd16c('0x27')](function(_0x51cfa1){var _0x5678ee=_['groupBy'](_0x51cfa1,_0xd16c('0xae'));var _0x290941=[];_0xee2aef[_0xd16c('0x2f')](function(_0xa8deb9){_0x290941['push'](updateSmsInteraction(_0xa8deb9,_0x32b1e3,_0x5678ee));});return BPromise['all'](_0x290941);});});})[_0xd16c('0x27')](function(_0x13f6e7){_0xf72594[_0xd16c('0xaf')]=_0x13f6e7;return _0xf72594;})['then'](respondWithFilteredResult(_0xd73bc3,_0x149197))[_0xd16c('0xb0')](handleError(_0xd73bc3,null));};exports['show']=function(_0x33d302,_0x32a47d){var _0x947e30={'raw':![],'where':{'id':_0x33d302[_0xd16c('0xb1')]['id']}},_0x5d2db9={};_0x5d2db9[_0xd16c('0x3d')]=_['keys'](db[_0xd16c('0x33')][_0xd16c('0x34')]);_0x5d2db9[_0xd16c('0x39')]=_[_0xd16c('0x3a')](_0x33d302[_0xd16c('0x39')]);_0x5d2db9[_0xd16c('0x3b')]=_[_0xd16c('0x3c')](_0x5d2db9['model'],_0x5d2db9[_0xd16c('0x39')]);_0x947e30[_0xd16c('0x3f')]=_['intersection'](_0x5d2db9[_0xd16c('0x3d')],qs['fields'](_0x33d302[_0xd16c('0x39')]['fields']));_0x947e30[_0xd16c('0x3f')]=_0x947e30[_0xd16c('0x3f')][_0xd16c('0x5b')]?_0x947e30[_0xd16c('0x3f')]:_0x5d2db9[_0xd16c('0x3d')];if(_0x33d302[_0xd16c('0x39')][_0xd16c('0xb2')]){_0x947e30[_0xd16c('0xb3')]=[{'all':!![]}];}_0x947e30=_['merge']({},_0x947e30,_0x33d302[_0xd16c('0xb4')]);return db[_0xd16c('0x33')][_0xd16c('0x5c')](_0x947e30)[_0xd16c('0x27')](handleEntityNotFound(_0x32a47d,null))['then'](respondWithResult(_0x32a47d,null))[_0xd16c('0xb0')](handleError(_0x32a47d,null));};exports[_0xd16c('0xb5')]=function(_0xe9f740,_0x11c488){return db[_0xd16c('0x33')][_0xd16c('0xb5')](_0xe9f740['body'],{})[_0xd16c('0x27')](respondWithResult(_0x11c488,0xc9))[_0xd16c('0xb0')](handleError(_0x11c488,null));};exports[_0xd16c('0xb6')]=function(_0x5d3fe0,_0x4874e9){if(_0x5d3fe0[_0xd16c('0x72')]['id']){delete _0x5d3fe0[_0xd16c('0x72')]['id'];}return db[_0xd16c('0x33')][_0xd16c('0x5c')]({'where':{'id':_0x5d3fe0[_0xd16c('0xb1')]['id']}})[_0xd16c('0x27')](handleEntityNotFound(_0x4874e9,null))[_0xd16c('0x27')](saveUpdates(_0x5d3fe0[_0xd16c('0x72')],null))[_0xd16c('0x27')](respondWithResult(_0x4874e9,null))[_0xd16c('0xb0')](handleError(_0x4874e9,null));};exports[_0xd16c('0x28')]=function(_0x4dd64b,_0x19acfe){return db[_0xd16c('0x33')]['find']({'where':{'id':_0x4dd64b['params']['id']}})[_0xd16c('0x27')](handleEntityNotFound(_0x19acfe,null))[_0xd16c('0x27')](removeEntity(_0x19acfe,null))['catch'](handleError(_0x19acfe,null));};exports[_0xd16c('0xb7')]=function(_0x5e6606,_0x40f697){return db[_0xd16c('0x33')]['describe']()[_0xd16c('0x27')](respondWithResult(_0x40f697,null))[_0xd16c('0xb0')](handleError(_0x40f697,null));};exports['addMessage']=function(_0x50180d,_0x4f0721,_0x2d943a){return db['SmsMessage'][_0xd16c('0x5c')]({'where':{'id':_0x50180d['params']['id']}})[_0xd16c('0x27')](handleEntityNotFound(_0x4f0721,null))[_0xd16c('0x27')](function(_0x360115){if(_0x360115){return _0x360115[_0xd16c('0xb8')](_0x50180d['body'][_0xd16c('0xb9')],_[_0xd16c('0xba')](_0x50180d['body'],['ids','id'])||{});}})[_0xd16c('0x27')](respondWithResult(_0x4f0721,null))[_0xd16c('0xb0')](handleError(_0x4f0721,null));};exports['getMessages']=function(_0x39d208,_0x3e1843,_0x4ef01c){var _0x5ed571={'raw':![],'where':{}};var _0x240347={};var _0x11443f={'count':0x0,'rows':[]};return db[_0xd16c('0x33')][_0xd16c('0xbb')]({'where':{'id':_0x39d208[_0xd16c('0xb1')]['id']}})[_0xd16c('0x27')](handleEntityNotFound(_0x3e1843,null))[_0xd16c('0x27')](function(_0xe14f10){if(_0xe14f10){_0x240347['model']=_[_0xd16c('0x3a')](db[_0xd16c('0xbc')][_0xd16c('0x34')]);_0x240347['query']=_[_0xd16c('0x3a')](_0x39d208[_0xd16c('0x39')]);_0x240347[_0xd16c('0x3b')]=_[_0xd16c('0x3c')](_0x240347['model'],_0x240347['query']);_0x5ed571[_0xd16c('0x3f')]=_[_0xd16c('0x3c')](_0x240347[_0xd16c('0x3d')],qs[_0xd16c('0x3e')](_0x39d208[_0xd16c('0x39')][_0xd16c('0x3e')]));_0x5ed571[_0xd16c('0x3f')]=_0x5ed571[_0xd16c('0x3f')][_0xd16c('0x5b')]?_0x5ed571[_0xd16c('0x3f')]:_0x240347[_0xd16c('0x3d')];if(!_0x39d208['query'][_0xd16c('0x40')](_0xd16c('0xbd'))){_0x5ed571[_0xd16c('0x21')]=qs[_0xd16c('0x21')](_0x39d208[_0xd16c('0x39')][_0xd16c('0x21')]);_0x5ed571[_0xd16c('0x20')]=qs['offset'](_0x39d208[_0xd16c('0x39')][_0xd16c('0x20')]);}_0x5ed571['order']=qs[_0xd16c('0x42')](_0x39d208[_0xd16c('0x39')][_0xd16c('0x42')]);_0x5ed571[_0xd16c('0x77')]=qs['filters'](_[_0xd16c('0x43')](_0x39d208['query'],_0x240347[_0xd16c('0x3b')]));_0x5ed571[_0xd16c('0x77')][_0xd16c('0xae')]=_0xe14f10['id'];if(_0x39d208[_0xd16c('0x39')]['filter']){_0x5ed571[_0xd16c('0x77')]=_[_0xd16c('0xbe')](_0x5ed571[_0xd16c('0x77')],{'$or':_[_0xd16c('0x37')](_0x5ed571[_0xd16c('0x3f')],function(_0x1ac6ca){var _0x2de1a4={};_0x2de1a4[_0x1ac6ca]={'$like':'%'+_0x39d208[_0xd16c('0x39')][_0xd16c('0x84')]+'%'};return _0x2de1a4;})});}if(_0x39d208[_0xd16c('0x39')][_0xd16c('0xbf')]){var _0x2a4bd0=_0x39d208[_0xd16c('0x39')][_0xd16c('0xbf')][_0xd16c('0x64')](',');var _0x4c1f20={};_0x4c1f20[_0x2a4bd0[0x0]]={'$gte':moment(_0x2a4bd0[0x1])[_0xd16c('0xc0')](_0xd16c('0xc1'))};_0x5ed571['where']=_[_0xd16c('0xbe')](_0x5ed571['where'],_0x4c1f20);}_0x5ed571=_[_0xd16c('0xbe')]({},_0x5ed571,_0x39d208[_0xd16c('0xb4')]);return db[_0xd16c('0xbc')]['count']({'where':_0x5ed571[_0xd16c('0x77')]})['then'](function(_0x473754){_0x11443f[_0xd16c('0x1f')]=_0x473754;if(_0x39d208['query'][_0xd16c('0xb2')]){_0x5ed571[_0xd16c('0xb3')]=[{'all':!![]}];}return db[_0xd16c('0xbc')][_0xd16c('0xc2')](_0x5ed571);})[_0xd16c('0x27')](function(_0x2b1fba){_0x11443f['rows']=_0x2b1fba;return _0x11443f;});}})[_0xd16c('0x27')](respondWithFilteredResult(_0x3e1843,_0x5ed571))[_0xd16c('0xb0')](handleError(_0x3e1843,null));};exports[_0xd16c('0xc3')]=function(_0x4cb9eb,_0x144c7c,_0x18974a){return db[_0xd16c('0x33')][_0xd16c('0x5c')]({'where':{'id':_0x4cb9eb['params']['id']}})[_0xd16c('0x27')](handleEntityNotFound(_0x144c7c,null))[_0xd16c('0x27')](function(_0x34a1df){if(_0x34a1df){return _0x34a1df['setTags'](_0x4cb9eb[_0xd16c('0x72')]['ids'],_[_0xd16c('0xba')](_0x4cb9eb[_0xd16c('0x72')],[_0xd16c('0xb9'),'id'])||{})[_0xd16c('0xc4')](function(){return db[_0xd16c('0x6b')][_0xd16c('0xc2')]({'attributes':['id',_0xd16c('0x38'),'color'],'where':{'id':_0x4cb9eb['body']['ids']}});})[_0xd16c('0x27')](function(_0x33b803){socket[_0xd16c('0xc5')](_0xd16c('0xc6'),{'id':Number(_0x4cb9eb[_0xd16c('0xb1')]['id']),'tags':_0x33b803||[]});return{'id':Number(_0x4cb9eb[_0xd16c('0xb1')]['id']),'tags':_0x33b803||[]};});}})[_0xd16c('0x27')](respondWithResult(_0x144c7c,null))['catch'](handleError(_0x144c7c,null));};exports['removeTags']=function(_0x488ecf,_0x124b35,_0x4d55c3){return db[_0xd16c('0x33')][_0xd16c('0x5c')]({'where':{'id':_0x488ecf[_0xd16c('0xb1')]['id']}})['then'](handleEntityNotFound(_0x124b35,null))['then'](function(_0x50660b){if(_0x50660b){return _0x50660b['removeTags'](_0x488ecf[_0xd16c('0x39')]['ids']);}})[_0xd16c('0x27')](respondWithStatusCode(_0x124b35,null))[_0xd16c('0xb0')](handleError(_0x124b35,null));};exports['download']=function(_0x441ed0,_0x465c3e){var _0x348a6b=moment()['unix']()[_0xd16c('0x97')]();var _0x28e1fe=path[_0xd16c('0xc7')](config[_0xd16c('0xc8')],_0xd16c('0xc9'),_0xd16c('0xca'),'tmp');var _0xe037e2=path[_0xd16c('0xc7')](config[_0xd16c('0xc8')],_0xd16c('0xc9'),_0xd16c('0xca'),_0xd16c('0xcb'));var _0x3f944b=path[_0xd16c('0xc7')](_0x28e1fe,_0x348a6b);var _0x5ca5fd=util[_0xd16c('0xc0')]('transcript-%d-%s.zip',_0x441ed0[_0xd16c('0xb1')]['id'],_0x348a6b);var _0x54cda2=path[_0xd16c('0xc7')](_0x28e1fe,_0x5ca5fd);var _0x14d8a5=[];_0x14d8a5[_0xd16c('0x31')]({'model':db[_0xd16c('0x6e')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x14d8a5[_0xd16c('0x31')]({'model':db[_0xd16c('0xcc')],'as':'Contact','attributes':['id','firstName',_0xd16c('0xcd')],'raw':!![]});var _0x571c8d=[{'model':db['SmsMessage'],'as':_0xd16c('0xce'),'attributes':['id',_0xd16c('0x72'),_0xd16c('0x79'),_0xd16c('0xcf'),'secret',_0xd16c('0x7f')],'include':_0x14d8a5}];_0x571c8d[_0xd16c('0x31')]({'model':db[_0xd16c('0xd0')],'as':_0xd16c('0xd1'),'attributes':['id',_0xd16c('0x38')]});_0x571c8d[_0xd16c('0x31')]({'model':db[_0xd16c('0x6e')],'as':'Owner','attributes':['id',_0xd16c('0x2d')]});return db[_0xd16c('0x33')]['find']({'where':{'id':_0x441ed0[_0xd16c('0xb1')]['id']},'include':_0x571c8d})['then'](handleEntityNotFound(_0x465c3e,null))[_0xd16c('0x27')](function(_0x51d9b4){if(_0x51d9b4){var _0x181140=_0x51d9b4['get']({'plain':!![]});fs[_0xd16c('0xd2')](_0x3f944b);var _0x3e269c={'format':'A4','border':_0xd16c('0xd3'),'header':{'height':_0xd16c('0xd4'),'contents':{'first':_0xd16c('0xd5')}},'footer':{'height':_0xd16c('0xd6'),'contents':{'default':util['format'](_0xd16c('0xd7'),util[_0xd16c('0xc0')](_0xd16c('0xd8'),_0xd16c('0xd9'),_0x181140['id']),moment()[_0xd16c('0xc0')](_0xd16c('0xda'))[_0xd16c('0x97')]())}}};var _0x3c7482={'channel':_0xd16c('0xd9'),'account':_0x181140[_0xd16c('0xd1')][_0xd16c('0x38')],'agent':_0x181140['Owner']?_0x181140[_0xd16c('0xdb')][_0xd16c('0x2d')]:'N.A.','createdAt':moment(_0x181140[_0xd16c('0x79')])[_0xd16c('0xc0')](_0xd16c('0xc1'))[_0xd16c('0x97')](),'closedAt':_0x181140[_0xd16c('0xdc')]?moment(_0x181140[_0xd16c('0xdd')])[_0xd16c('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x181140['disposition'],'messages':_(_0x181140[_0xd16c('0xce')])[_0xd16c('0x84')]({'secret':![]})['map'](function(_0x5a4ca4){return{'date':moment(_0x5a4ca4[_0xd16c('0x79')])[_0xd16c('0xc0')](_0xd16c('0xc1'))['toString'](),'sender':_0x5a4ca4['direction']===_0xd16c('0xde')?_0x5a4ca4[_0xd16c('0x6e')]?_0x5a4ca4[_0xd16c('0x6e')][_0xd16c('0x2d')]:'System':_0x5a4ca4[_0xd16c('0x61')][_0xd16c('0xdf')]+(_0x5a4ca4[_0xd16c('0x61')][_0xd16c('0xcd')]?'\x20'+_0x5a4ca4[_0xd16c('0x61')]['lastName']:''),'body':_0x5a4ca4[_0xd16c('0x72')],'direction':_0x5a4ca4[_0xd16c('0xcf')]===_0xd16c('0xde')?'A':'C','secret':_0x5a4ca4[_0xd16c('0xe0')],'read':_0x5a4ca4[_0xd16c('0x7f')]};})[_0xd16c('0x5e')]()};return ejs[_0xd16c('0xe1')](path[_0xd16c('0xc7')](config[_0xd16c('0xc8')],_0xd16c('0xc9'),'views',_0xd16c('0xe2')),{'interaction':_0x3c7482})[_0xd16c('0x27')](function(_0x55845a){return new BPromise(function(_0x116372,_0x2bee5f){pdf[_0xd16c('0xb5')](_0x55845a,_0x3e269c)[_0xd16c('0xe3')](path[_0xd16c('0xc7')](_0x3f944b,_0xd16c('0xe4')+_0x181140['id']+'-'+_0x348a6b+_0xd16c('0xe5')),function(_0x70ca70,_0x3de220){if(_0x70ca70)return _0x2bee5f(_0x70ca70);_0x116372(_0x3de220);});});})['then'](function(){return new BPromise(function(_0x18db17,_0x11c62a){zipdir(_0x3f944b,{'saveTo':_0x54cda2},function(_0x3ce4b7,_0x38d1f2){if(_0x3ce4b7)return _0x11c62a(_0x3ce4b7);return _0x18db17(_0x38d1f2);});})[_0xd16c('0x27')](function(){return new BPromise(function(_0x518946,_0x5894ff){rimraf(_0x3f944b,function(_0x504e7c){if(_0x504e7c)_0x5894ff(_0x504e7c);return _0x518946();});});})[_0xd16c('0x27')](function(){return _0x465c3e[_0xd16c('0xe6')](_0x54cda2,_0x5ca5fd,function(_0x3c5fca){if(_0x3c5fca){console[_0xd16c('0xe7')](_0xd16c('0xe8'),_0x3c5fca);}else{fs[_0xd16c('0xe9')](_0x54cda2);}});});});}else{return _0x465c3e[_0xd16c('0x1d')](0xc8);}})[_0xd16c('0xb0')](handleError(_0x465c3e,null));}; \ No newline at end of file +var _0xa49a=['Owner','get','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','direction','System','firstName','views','downloadInteraction.html','toFile','.pdf','download','log','err','html-pdf','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./smsInteraction.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','name','map','fullname','Tags','TagIds','forEach','push','catch','index','SmsInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','color','from','tools_tags','select','field','u.id','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','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','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','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','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','some','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','order','DESC','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','agent','sequelize','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.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.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','show','params','includeAll','include','options','create','describe','addMessage','SmsMessage','ids','findOne','format','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','server','files','tmp','root','attachments','join','transcript-%d-%s.zip','CmContact','lastName','Messages','secret','SmsAccount','Account'];(function(_0xb78227,_0x3f91bd){var _0x47abda=function(_0x3cdbc3){while(--_0x3cdbc3){_0xb78227['push'](_0xb78227['shift']());}};_0x47abda(++_0x3f91bd);}(_0xa49a,0x1e6));var _0xaa49=function(_0x3ed5d9,_0x54fd95){_0x3ed5d9=_0x3ed5d9-0x0;var _0x5bd747=_0xa49a[_0x3ed5d9];return _0x5bd747;};'use strict';var pdf=require(_0xaa49('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xaa49('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa49('0x2'));var rp=require('request-promise');var moment=require(_0xaa49('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaa49('0x4'));var util=require(_0xaa49('0x5'));var path=require('path');var sox=require(_0xaa49('0x6'));var csv=require(_0xaa49('0x7'));var ejs=require(_0xaa49('0x8'));var fs=require('fs');var _=require(_0xaa49('0x9'));var squel=require(_0xaa49('0xa'));var crypto=require(_0xaa49('0xb'));var jsforce=require(_0xaa49('0xc'));var deskjs=require(_0xaa49('0xd'));var toCsv=require(_0xaa49('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaa49('0xe'));var as=require(_0xaa49('0xf'));var hardwareService=require(_0xaa49('0x10'));var logger=require(_0xaa49('0x11'))('api');var utils=require(_0xaa49('0x12'));var config=require(_0xaa49('0x13'));var licenseUtil=require(_0xaa49('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xaa49('0x15')],{'host':_0xaa49('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaa49('0x17'))[_0xaa49('0x18')](socket);function respondWithStatusCode(_0x3d6ff5,_0x2d2c45){_0x2d2c45=_0x2d2c45||0xcc;return function(_0xe903e6){if(_0xe903e6){return _0x3d6ff5[_0xaa49('0x19')](_0x2d2c45);}return _0x3d6ff5['status'](_0x2d2c45)[_0xaa49('0x1a')]();};}function respondWithResult(_0x5a7bff,_0x48de32){_0x48de32=_0x48de32||0xc8;return function(_0x3ec300){if(_0x3ec300){return _0x5a7bff[_0xaa49('0x1b')](_0x48de32)[_0xaa49('0x1c')](_0x3ec300);}};}function respondWithFilteredResult(_0x264910,_0x5b1482){return function(_0x1f1ed5){if(_0x1f1ed5){var _0x16e5ef=_0x1f1ed5[_0xaa49('0x1d')],_0xf5ba6a=_0x5b1482[_0xaa49('0x1e')],_0x34286c=_0x5b1482[_0xaa49('0x1e')]+_0x5b1482['limit'],_0xee9c3f;if(_0x34286c>=_0x16e5ef){_0x34286c=_0x16e5ef;_0xee9c3f=0xc8;}else{_0xee9c3f=0xce;}_0x264910[_0xaa49('0x1b')](_0xee9c3f);return _0x264910[_0xaa49('0x1f')](_0xaa49('0x20'),_0xf5ba6a+'-'+_0x34286c+'/'+_0x16e5ef)[_0xaa49('0x1c')](_0x1f1ed5);}return null;};}function patchUpdates(_0x217c54){return function(_0x14ab43){try{jsonpatch[_0xaa49('0x21')](_0x14ab43,_0x217c54,!![]);}catch(_0x544d29){return BPromise['reject'](_0x544d29);}return _0x14ab43['save']();};}function saveUpdates(_0x50d82c,_0x23a077){return function(_0x58e70b){if(_0x58e70b){return _0x58e70b[_0xaa49('0x22')](_0x50d82c)[_0xaa49('0x23')](function(_0xc13020){return _0xc13020;});}return null;};}function removeEntity(_0x1a6082,_0x202914){return function(_0x265d8c){if(_0x265d8c){return _0x265d8c[_0xaa49('0x24')]()[_0xaa49('0x23')](function(){_0x1a6082['status'](0xcc)[_0xaa49('0x1a')]();});}};}function handleEntityNotFound(_0x402d76,_0x5ca28b){return function(_0x43f78d){if(!_0x43f78d){_0x402d76[_0xaa49('0x19')](0x194);}return _0x43f78d;};}function handleError(_0x5617c2,_0x10e771){_0x10e771=_0x10e771||0x1f4;return function(_0xf31105){logger[_0xaa49('0x25')](_0xf31105[_0xaa49('0x26')]);if(_0xf31105[_0xaa49('0x27')]){delete _0xf31105[_0xaa49('0x27')];}_0x5617c2['status'](_0x10e771)['send'](_0xf31105);};}function getInteractionUsers(_0x35caf1,_0x552ccf){return new BPromise(function(_0x115e13,_0x3664d2){try{if(_0x552ccf[_0x35caf1['id']]){_0x35caf1['Users']=_[_0xaa49('0x28')](_0x552ccf[_0x35caf1['id']],function(_0xec8a25){return{'id':_0xec8a25['id'],'fullname':_0xec8a25[_0xaa49('0x29')]};});}}catch(_0x1dcd31){_0x3664d2(_0x1dcd31);}_0x115e13(_0x35caf1);});}function getInteractionTags(_0x5d8ff0,_0x1ed7b1){return new BPromise(function(_0x2c4d86,_0x1843a4){try{if(_0x5d8ff0['TagIds']){_0x5d8ff0[_0xaa49('0x2a')]=[];_0x5d8ff0[_0xaa49('0x2b')]['split'](',')[_0xaa49('0x2c')](function(_0x1e7ede){_0x5d8ff0[_0xaa49('0x2a')][_0xaa49('0x2d')](_0x1ed7b1[_0x1e7ede]);});}delete _0x5d8ff0[_0xaa49('0x2b')];}catch(_0x38b15b){_0x1843a4(_0x38b15b);}_0x2c4d86(_0x5d8ff0);});}function updateSmsInteraction(_0x3b49e0,_0x5879e0,_0x1e5296){return new BPromise(function(_0x571abc,_0x520970){return getInteractionUsers(_0x3b49e0,_0x1e5296)['then'](function(_0x4e67e0){return getInteractionTags(_0x4e67e0,_0x5879e0);})[_0xaa49('0x23')](function(_0x5a52f3){_0x571abc(_0x5a52f3);})[_0xaa49('0x2e')](function(_0xc0ef74){_0x520970(_0xc0ef74);});});}exports[_0xaa49('0x2f')]=function(_0xed1475,_0x2a265e){var _0x298628={},_0x36cd8f={},_0x321426={'count':0x0,'rows':[]};var _0x5ccc11=_[_0xaa49('0x28')](db[_0xaa49('0x30')][_0xaa49('0x31')],function(_0x2d18cc){return{'name':_0x2d18cc['fieldName'],'type':_0x2d18cc[_0xaa49('0x32')][_0xaa49('0x33')]};});_0x36cd8f[_0xaa49('0x34')]=_['map'](_0x5ccc11,'name');_0x36cd8f[_0xaa49('0x35')]=_[_0xaa49('0x36')](_0xed1475[_0xaa49('0x35')]);_0x36cd8f[_0xaa49('0x37')]=_[_0xaa49('0x38')](_0x36cd8f[_0xaa49('0x34')],_0x36cd8f['query']);_0x298628[_0xaa49('0x39')]=_['intersection'](_0x36cd8f[_0xaa49('0x34')],qs[_0xaa49('0x3a')](_0xed1475[_0xaa49('0x35')][_0xaa49('0x3a')]));_0x298628['attributes']=_0x298628['attributes'][_0xaa49('0x3b')]?_0x298628[_0xaa49('0x39')]:_0x36cd8f['model'];if(!_0xed1475[_0xaa49('0x35')][_0xaa49('0x3c')](_0xaa49('0x3d'))){_0x298628[_0xaa49('0x3e')]=qs[_0xaa49('0x3e')](_0xed1475[_0xaa49('0x35')][_0xaa49('0x3e')]);_0x298628[_0xaa49('0x1e')]=qs[_0xaa49('0x1e')](_0xed1475['query'][_0xaa49('0x1e')]);}_0x298628['order']=qs['sort'](_0xed1475[_0xaa49('0x35')][_0xaa49('0x3f')]);_0x298628['where']=qs['filters'](_['pick'](_0xed1475[_0xaa49('0x35')],_0x36cd8f[_0xaa49('0x37')]),_0x5ccc11);var _0x552ef4=[];var _0x141979=squel['select']()['field']('id')['field'](_0xaa49('0x27'))['field'](_0xaa49('0x40'))[_0xaa49('0x41')](_0xaa49('0x42'));var _0x15a9a5=squel[_0xaa49('0x43')]()[_0xaa49('0x44')](_0xaa49('0x45'))[_0xaa49('0x44')]('u.fullname')[_0xaa49('0x44')]('ui.SmsInteractionId')[_0xaa49('0x41')](_0xaa49('0x46'),'ui')[_0xaa49('0x47')](_0xaa49('0x48'),'u',_0xaa49('0x49'));var _0x308164=squel[_0xaa49('0x43')]()['from'](_0xaa49('0x4a'),'i')['left_join'](_0xaa49('0x4b'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xaa49('0x47')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0xaa49('0x4c'),'a',_0xaa49('0x4d'))[_0xaa49('0x47')]('sms_messages','me',_0xaa49('0x4e'))['left_join'](_0xaa49('0x4f'),'it',_0xaa49('0x50'))['left_join'](_0xaa49('0x42'),'t',_0xaa49('0x51'));var _0x47d4ff=squel[_0xaa49('0x52')]();var _0x921608=[];var _0x1f88bf=squel[_0xaa49('0x52')]();var _0x448c7c;if(_0xed1475[_0xaa49('0x35')]['search']){_0x448c7c=as[_0xaa49('0x53')](_0xed1475['query']['search']);var _0x2201ca=_0x448c7c['sqlOperator'];for(var _0x3d2b78=0x0;_0x3d2b78<_0x448c7c[_0xaa49('0x54')][_0xaa49('0x3b')];_0x3d2b78++){var _0x168e4b=_0x448c7c[_0xaa49('0x54')][_0x3d2b78];var _0x2d40af='i';var _0x1ec3f1=_[_0xaa49('0x55')](_0x5ccc11,[_0xaa49('0x27'),_0x168e4b[_0xaa49('0x44')]]);if(!_0x1ec3f1){switch(_0x168e4b[_0xaa49('0x44')]){case _0xaa49('0x56'):if(_0x168e4b[_0xaa49('0x57')]==0x1){_0x308164[_0xaa49('0x58')]('`'+_0x168e4b[_0xaa49('0x44')]+_0xaa49('0x59'));}else{_0x308164[_0xaa49('0x58')]('`'+_0x168e4b[_0xaa49('0x44')]+_0xaa49('0x5a'));}break;case _0xaa49('0x5b'):if(_0x168e4b['operator']===_0xaa49('0x5c')){if(_0x168e4b[_0xaa49('0x57')][_0xaa49('0x5d')]('\x20')[_0xaa49('0x3b')]>0x1){_0x47d4ff[_0x2201ca](_0xaa49('0x5e'),qs[_0xaa49('0x5f')](_0x168e4b[_0xaa49('0x57')]),null);}else{var _0x22bf29='%'+_0x168e4b[_0xaa49('0x57')]+'%';_0x47d4ff[_0x2201ca](_0xaa49('0x60'),_0x22bf29,_0x22bf29,_0x22bf29);}}else{_0x1ec3f1=_[_0xaa49('0x55')](_0x5ccc11,[_0xaa49('0x27'),_0xaa49('0x61')]);_0x168e4b[_0xaa49('0x44')]=_0xaa49('0x61');_0x559e98=as[_0xaa49('0x62')](_0x2d40af,_0x1ec3f1['type'],_0x168e4b);_0x47d4ff[_0x2201ca](_0x559e98['text'],_0x559e98['value'][_0xaa49('0x63')],_0x559e98[_0xaa49('0x57')]['end']);}break;case _0xaa49('0x64'):var _0x2cbc4d=_0x168e4b[_0xaa49('0x57')][_0xaa49('0x5d')](',')[_0xaa49('0x28')](function(_0x49bd1c){return Number(_0x49bd1c);});_0x2cbc4d[_0xaa49('0x2c')](function(_0x538fbf){_0x1f88bf['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x538fbf+',%');});_0x921608=_[_0xaa49('0x65')](_0x921608,_0x2cbc4d);break;case _0xaa49('0x66'):if(_0x168e4b[_0xaa49('0x67')]===_0xaa49('0x5c')){_0x47d4ff[_0x2201ca](_0xaa49('0x68'),'%'+_0x168e4b[_0xaa49('0x57')]+'%',null);}else{_0x1ec3f1=_[_0xaa49('0x55')](_0x5ccc11,[_0xaa49('0x27'),_0xaa49('0x69')]);_0x168e4b[_0xaa49('0x44')]=_0xaa49('0x69');_0x559e98=as[_0xaa49('0x62')](_0x2d40af,_0x1ec3f1[_0xaa49('0x32')],_0x168e4b);_0x47d4ff[_0x2201ca](_0x559e98['text'],_0x559e98[_0xaa49('0x57')]['start'],_0x559e98[_0xaa49('0x57')][_0xaa49('0x1a')]);}break;case _0xaa49('0x6a'):_0x559e98=as[_0xaa49('0x62')]('me',null,_0x168e4b);_0x47d4ff[_0x2201ca](_0x559e98['text'],_0x559e98[_0xaa49('0x57')][_0xaa49('0x63')],_0x559e98[_0xaa49('0x57')][_0xaa49('0x1a')]);break;}}else{var _0x559e98=as[_0xaa49('0x62')](_0x2d40af,_0x1ec3f1[_0xaa49('0x32')],_0x168e4b);_0x47d4ff[_0x2201ca](_0x559e98[_0xaa49('0x6b')],_0x559e98[_0xaa49('0x57')]['start'],_0x559e98['value']['end']);}}}else{var _0x1c3bab=_(_0xed1475[_0xaa49('0x35')])[_0xaa49('0x36')]()['map'](function(_0x2b6815){return _[_0xaa49('0x6c')](_0x5ccc11,[_0xaa49('0x27'),_0x2b6815])?_0x2b6815:undefined;})['compact']()[_0xaa49('0x57')]();if(!_[_0xaa49('0x6d')](_0x1c3bab)){_0x1c3bab['forEach'](function(_0x23b6b1){if(_0x23b6b1===_0xaa49('0x6e')){_0x308164[_0xaa49('0x6f')](_0xaa49('0x70'),[][_0xaa49('0x71')](_0xed1475['query'][_0x23b6b1]));}else if(_0x23b6b1===_0xaa49('0x72')){var _0x2a39ab=JSON['parse'](_0xed1475[_0xaa49('0x35')][_0x23b6b1])[_0xaa49('0x73')];var _0x2ab770=JSON[_0xaa49('0x74')](_0xed1475[_0xaa49('0x35')][_0x23b6b1])[_0xaa49('0x75')];_0x308164[_0xaa49('0x6f')](_0xaa49('0x76'),_0x2a39ab,_0x2ab770);}else{if(_0xed1475[_0xaa49('0x35')][_0x23b6b1]===_0xaa49('0x77')){_0x308164[_0xaa49('0x6f')]('i.'+_0x23b6b1+_0xaa49('0x78'));}else{_0x308164[_0xaa49('0x6f')]('i.'+_0x23b6b1+_0xaa49('0x79'),_0xed1475[_0xaa49('0x35')][_0x23b6b1]);}}});}if(_0xed1475[_0xaa49('0x35')][_0xaa49('0x7a')]){if(_0xed1475[_0xaa49('0x35')]['read']==0x1){_0x308164[_0xaa49('0x58')](_0xaa49('0x7b'));}else{_0x308164[_0xaa49('0x58')](_0xaa49('0x7c'));}}if(_0xed1475[_0xaa49('0x35')][_0xaa49('0x7d')]){_0x921608=_['isArray'](_0xed1475[_0xaa49('0x35')][_0xaa49('0x7d')])?_0xed1475[_0xaa49('0x35')][_0xaa49('0x7d')]:new Array(_0xed1475[_0xaa49('0x35')][_0xaa49('0x7d')]);_0x921608[_0xaa49('0x2c')](function(_0x5e6432){_0x1f88bf['or'](_0xaa49('0x7e'),'%,'+_0x5e6432+',%');});}if(_0xed1475['query']['filter']){var _0x5e7212=_0xed1475['query'][_0xaa49('0x7f')][_0xaa49('0x80')]('\x5c','\x5c\x5c')[_0xaa49('0x80')](/'/g,'\x27\x27');if(qs[_0xaa49('0x81')](_0x5e7212)){_0x47d4ff['or'](_0xaa49('0x82'),_0x5e7212+'%')['or'](_0xaa49('0x83'),_0x5e7212+'%');}else{_0x47d4ff['or'](_0xaa49('0x84'),qs['getFullTextValue'](_0x5e7212))['or'](_0xaa49('0x85'),_0x5e7212+'%');}}}_0x308164['where'](_0x47d4ff);_0x308164[_0xaa49('0x86')](_0xaa49('0x87'));var _0x1e5ea3={'type':db[_0xaa49('0x88')][_0xaa49('0x89')][_0xaa49('0x8a')],'raw':!![]};var _0x4e3959=_0x308164['clone']();_0x4e3959[_0xaa49('0x44')](_0xaa49('0x87'));_0x4e3959[_0xaa49('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x298628['order']){_0x298628[_0xaa49('0x8b')][_0xaa49('0x2c')](function(_0x1147ec){var _0x5f0212=_0x1147ec[0x0]==='contactName'?_0x1147ec[0x0]:'i.'+_0x1147ec[0x0];_0x308164[_0xaa49('0x8b')](_0x5f0212,_0x1147ec[0x1]===_0xaa49('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x921608)){_0x308164['having'](_0x1f88bf);_0x4e3959[_0xaa49('0x6f')](_0xaa49('0x8d'),_0x921608);}BPromise[_0xaa49('0x8e')]()['then'](function(){if(!_0x448c7c){if(_0xed1475[_0xaa49('0x35')]['SmsAccountId']||_0xed1475['query'][_0xaa49('0x8f')])return;_0x4e3959[_0xaa49('0x6f')](_0xaa49('0x90'));_0x308164[_0xaa49('0x6f')](_0xaa49('0x90'));return;}if(_0xed1475[_0xaa49('0x91')][_0xaa49('0x92')]!=='agent')return;return _0xed1475[_0xaa49('0x91')][_0xaa49('0x93')]({'attributes':['id'],'raw':!![]})[_0xaa49('0x23')](function(_0x5f37b2){if(_['isEmpty'](_0x5f37b2)){_0x4e3959[_0xaa49('0x6f')]('i.SmsAccountId\x20IS\x20NULL');_0x308164['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0x4e3959[_0xaa49('0x6f')](_0xaa49('0x70'),_[_0xaa49('0x28')](_0x5f37b2,'id'));_0x308164[_0xaa49('0x6f')](_0xaa49('0x70'),_[_0xaa49('0x28')](_0x5f37b2,'id'));}});})['then'](function(){if(_0xed1475[_0xaa49('0x91')]['role']===_0xaa49('0x94')&&!_0x448c7c&&!_0xed1475['query'][_0xaa49('0x6e')])return[];return db[_0xaa49('0x95')][_0xaa49('0x35')](_0x4e3959['toString'](),_0x1e5ea3);})['then'](function(_0x5ed158){_0x321426[_0xaa49('0x1d')]=_0x5ed158[_0xaa49('0x3b')];if(_0x321426['count']===0x0)return[];return db[_0xaa49('0x95')][_0xaa49('0x35')](_0x141979['toString'](),_0x1e5ea3)['then'](function(_0x47be9c){_0x552ef4=_['keyBy'](_0x47be9c,'id');_0x1e5ea3=_[_0xaa49('0x96')](_0x1e5ea3,{'model':db[_0xaa49('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xed1475['query'][_0xaa49('0x3a')]){_0x298628[_0xaa49('0x39')][_0xaa49('0x2c')](function(_0x456ae4){_0x308164[_0xaa49('0x44')]('i.'+_0x456ae4);});}else{_0x308164[_0xaa49('0x44')](_0xaa49('0x97'),'unreadMessages');_0x308164[_0xaa49('0x44')](_0xaa49('0x98'),'Account.key');_0x308164[_0xaa49('0x44')]('a.mandatoryDisposition',_0xaa49('0x99'));_0x308164[_0xaa49('0x44')](_0xaa49('0x9a'),'contactName');_0x308164[_0xaa49('0x44')](_0xaa49('0x9b'));_0x308164['field'](_0xaa49('0x9c'),_0xaa49('0x9d'));_0x308164[_0xaa49('0x44')](_0xaa49('0x9e'),_0xaa49('0x9f'));_0x308164['field'](_0xaa49('0xa0'),_0xaa49('0xa1'));_0x308164[_0xaa49('0x44')](_0xaa49('0xa2'),'Contact.phone');_0x308164[_0xaa49('0x44')](_0xaa49('0xa3'),_0xaa49('0xa4'));_0x308164['field'](_0xaa49('0xa5'),_0xaa49('0xa6'));_0x308164[_0xaa49('0x44')](_0xaa49('0xa7'),'Owner.fullname');_0x308164['field']('o.internal',_0xaa49('0xa8'));_0x308164[_0xaa49('0x44')](_0xaa49('0xa9'),'TagIds');}if(_0x298628['limit'])_0x308164[_0xaa49('0x3e')](_0x298628['limit']);if(_0x298628[_0xaa49('0x1e')])_0x308164['offset'](_0x298628[_0xaa49('0x1e')]);return db[_0xaa49('0x95')][_0xaa49('0x35')](_0x308164[_0xaa49('0xaa')](),_0x1e5ea3);})['then'](function(_0x52273f){_0x15a9a5[_0xaa49('0x6f')](_0xaa49('0xab'),_['map'](_0x52273f,'id'));return db[_0xaa49('0x95')][_0xaa49('0x35')](_0x15a9a5[_0xaa49('0xaa')](),_0x1e5ea3)[_0xaa49('0x23')](function(_0x5ab17c){var _0x4e1b51=_[_0xaa49('0xac')](_0x5ab17c,_0xaa49('0xad'));var _0x56c1a9=[];_0x52273f[_0xaa49('0x2c')](function(_0x1629c6){_0x56c1a9['push'](updateSmsInteraction(_0x1629c6,_0x552ef4,_0x4e1b51));});return BPromise['all'](_0x56c1a9);});});})[_0xaa49('0x23')](function(_0x151b81){_0x321426['rows']=_0x151b81;return _0x321426;})[_0xaa49('0x23')](respondWithFilteredResult(_0x2a265e,_0x298628))[_0xaa49('0x2e')](handleError(_0x2a265e,null));};exports[_0xaa49('0xae')]=function(_0x4bc38f,_0x2cf593){var _0x205af7={'raw':![],'where':{'id':_0x4bc38f[_0xaa49('0xaf')]['id']}},_0x4bd958={};_0x4bd958[_0xaa49('0x34')]=_[_0xaa49('0x36')](db[_0xaa49('0x30')][_0xaa49('0x31')]);_0x4bd958[_0xaa49('0x35')]=_[_0xaa49('0x36')](_0x4bc38f[_0xaa49('0x35')]);_0x4bd958[_0xaa49('0x37')]=_[_0xaa49('0x38')](_0x4bd958[_0xaa49('0x34')],_0x4bd958[_0xaa49('0x35')]);_0x205af7[_0xaa49('0x39')]=_[_0xaa49('0x38')](_0x4bd958[_0xaa49('0x34')],qs[_0xaa49('0x3a')](_0x4bc38f[_0xaa49('0x35')][_0xaa49('0x3a')]));_0x205af7['attributes']=_0x205af7[_0xaa49('0x39')]['length']?_0x205af7[_0xaa49('0x39')]:_0x4bd958[_0xaa49('0x34')];if(_0x4bc38f[_0xaa49('0x35')][_0xaa49('0xb0')]){_0x205af7[_0xaa49('0xb1')]=[{'all':!![]}];}_0x205af7=_[_0xaa49('0x96')]({},_0x205af7,_0x4bc38f[_0xaa49('0xb2')]);return db[_0xaa49('0x30')][_0xaa49('0x55')](_0x205af7)[_0xaa49('0x23')](handleEntityNotFound(_0x2cf593,null))[_0xaa49('0x23')](respondWithResult(_0x2cf593,null))['catch'](handleError(_0x2cf593,null));};exports[_0xaa49('0xb3')]=function(_0x2a9f73,_0x8b28a2){return db[_0xaa49('0x30')][_0xaa49('0xb3')](_0x2a9f73[_0xaa49('0x6a')],{})[_0xaa49('0x23')](respondWithResult(_0x8b28a2,0xc9))[_0xaa49('0x2e')](handleError(_0x8b28a2,null));};exports[_0xaa49('0x22')]=function(_0x18c919,_0xb34c48){if(_0x18c919[_0xaa49('0x6a')]['id']){delete _0x18c919[_0xaa49('0x6a')]['id'];}return db[_0xaa49('0x30')][_0xaa49('0x55')]({'where':{'id':_0x18c919[_0xaa49('0xaf')]['id']}})[_0xaa49('0x23')](handleEntityNotFound(_0xb34c48,null))[_0xaa49('0x23')](saveUpdates(_0x18c919[_0xaa49('0x6a')],null))[_0xaa49('0x23')](respondWithResult(_0xb34c48,null))['catch'](handleError(_0xb34c48,null));};exports[_0xaa49('0x24')]=function(_0xaa876b,_0x1a6f73){return db['SmsInteraction'][_0xaa49('0x55')]({'where':{'id':_0xaa876b['params']['id']}})[_0xaa49('0x23')](handleEntityNotFound(_0x1a6f73,null))[_0xaa49('0x23')](removeEntity(_0x1a6f73,null))['catch'](handleError(_0x1a6f73,null));};exports[_0xaa49('0xb4')]=function(_0x46b123,_0x14f34c){return db[_0xaa49('0x30')]['describe']()[_0xaa49('0x23')](respondWithResult(_0x14f34c,null))[_0xaa49('0x2e')](handleError(_0x14f34c,null));};exports[_0xaa49('0xb5')]=function(_0x4c0a39,_0x462cee,_0x2fd4f6){return db[_0xaa49('0xb6')][_0xaa49('0x55')]({'where':{'id':_0x4c0a39[_0xaa49('0xaf')]['id']}})[_0xaa49('0x23')](handleEntityNotFound(_0x462cee,null))[_0xaa49('0x23')](function(_0x1b4dd3){if(_0x1b4dd3){return _0x1b4dd3['addMessage'](_0x4c0a39[_0xaa49('0x6a')][_0xaa49('0xb7')],_['omit'](_0x4c0a39[_0xaa49('0x6a')],[_0xaa49('0xb7'),'id'])||{});}})[_0xaa49('0x23')](respondWithResult(_0x462cee,null))['catch'](handleError(_0x462cee,null));};exports['getMessages']=function(_0x3cf814,_0x2614d3,_0x30a734){var _0x23d4dc={'raw':![],'where':{}};var _0x1af5a7={};var _0x21b47e={'count':0x0,'rows':[]};return db[_0xaa49('0x30')][_0xaa49('0xb8')]({'where':{'id':_0x3cf814[_0xaa49('0xaf')]['id']}})[_0xaa49('0x23')](handleEntityNotFound(_0x2614d3,null))['then'](function(_0x4904a0){if(_0x4904a0){_0x1af5a7[_0xaa49('0x34')]=_[_0xaa49('0x36')](db[_0xaa49('0xb6')]['rawAttributes']);_0x1af5a7[_0xaa49('0x35')]=_[_0xaa49('0x36')](_0x3cf814['query']);_0x1af5a7['filters']=_[_0xaa49('0x38')](_0x1af5a7[_0xaa49('0x34')],_0x1af5a7[_0xaa49('0x35')]);_0x23d4dc['attributes']=_[_0xaa49('0x38')](_0x1af5a7[_0xaa49('0x34')],qs['fields'](_0x3cf814[_0xaa49('0x35')][_0xaa49('0x3a')]));_0x23d4dc[_0xaa49('0x39')]=_0x23d4dc[_0xaa49('0x39')][_0xaa49('0x3b')]?_0x23d4dc[_0xaa49('0x39')]:_0x1af5a7['model'];if(!_0x3cf814['query'][_0xaa49('0x3c')](_0xaa49('0x3d'))){_0x23d4dc[_0xaa49('0x3e')]=qs['limit'](_0x3cf814['query'][_0xaa49('0x3e')]);_0x23d4dc[_0xaa49('0x1e')]=qs['offset'](_0x3cf814[_0xaa49('0x35')][_0xaa49('0x1e')]);}_0x23d4dc[_0xaa49('0x8b')]=qs[_0xaa49('0x3f')](_0x3cf814[_0xaa49('0x35')][_0xaa49('0x3f')]);_0x23d4dc['where']=qs['filters'](_['pick'](_0x3cf814[_0xaa49('0x35')],_0x1af5a7[_0xaa49('0x37')]));_0x23d4dc[_0xaa49('0x6f')][_0xaa49('0xad')]=_0x4904a0['id'];if(_0x3cf814[_0xaa49('0x35')]['filter']){_0x23d4dc[_0xaa49('0x6f')]=_['merge'](_0x23d4dc[_0xaa49('0x6f')],{'$or':_[_0xaa49('0x28')](_0x23d4dc['attributes'],function(_0x2c787b){var _0x2aa90b={};_0x2aa90b[_0x2c787b]={'$like':'%'+_0x3cf814['query'][_0xaa49('0x7f')]+'%'};return _0x2aa90b;})});}if(_0x3cf814[_0xaa49('0x35')][_0xaa49('0x73')]){var _0x4b7f8c=_0x3cf814['query'][_0xaa49('0x73')][_0xaa49('0x5d')](',');var _0x4d2327={};_0x4d2327[_0x4b7f8c[0x0]]={'$gte':moment(_0x4b7f8c[0x1])[_0xaa49('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x23d4dc[_0xaa49('0x6f')]=_['merge'](_0x23d4dc[_0xaa49('0x6f')],_0x4d2327);}_0x23d4dc=_[_0xaa49('0x96')]({},_0x23d4dc,_0x3cf814[_0xaa49('0xb2')]);return db[_0xaa49('0xb6')][_0xaa49('0x1d')]({'where':_0x23d4dc['where']})['then'](function(_0x52c55d){_0x21b47e[_0xaa49('0x1d')]=_0x52c55d;if(_0x3cf814['query'][_0xaa49('0xb0')]){_0x23d4dc[_0xaa49('0xb1')]=[{'all':!![]}];}return db[_0xaa49('0xb6')][_0xaa49('0xba')](_0x23d4dc);})[_0xaa49('0x23')](function(_0x1e1a7f){_0x21b47e['rows']=_0x1e1a7f;return _0x21b47e;});}})['then'](respondWithFilteredResult(_0x2614d3,_0x23d4dc))[_0xaa49('0x2e')](handleError(_0x2614d3,null));};exports[_0xaa49('0xbb')]=function(_0x2f6f37,_0x4e1e5a,_0x418640){return db['SmsInteraction']['find']({'where':{'id':_0x2f6f37[_0xaa49('0xaf')]['id']}})[_0xaa49('0x23')](handleEntityNotFound(_0x4e1e5a,null))['then'](function(_0x329b66){if(_0x329b66){return _0x329b66[_0xaa49('0xbc')](_0x2f6f37[_0xaa49('0x6a')]['ids'],_['omit'](_0x2f6f37[_0xaa49('0x6a')],[_0xaa49('0xb7'),'id'])||{})[_0xaa49('0xbd')](function(){return db[_0xaa49('0x64')][_0xaa49('0xba')]({'attributes':['id',_0xaa49('0x27'),_0xaa49('0x40')],'where':{'id':_0x2f6f37['body'][_0xaa49('0xb7')]}});})['then'](function(_0x335dca){socket[_0xaa49('0xbe')](_0xaa49('0xbf'),{'id':Number(_0x2f6f37[_0xaa49('0xaf')]['id']),'tags':_0x335dca||[]});return{'id':Number(_0x2f6f37['params']['id']),'tags':_0x335dca||[]};});}})['then'](respondWithResult(_0x4e1e5a,null))[_0xaa49('0x2e')](handleError(_0x4e1e5a,null));};exports[_0xaa49('0xc0')]=function(_0x6d13af,_0x43d780,_0xa402ca){return db[_0xaa49('0x30')]['find']({'where':{'id':_0x6d13af[_0xaa49('0xaf')]['id']}})[_0xaa49('0x23')](handleEntityNotFound(_0x43d780,null))[_0xaa49('0x23')](function(_0x3738bc){if(_0x3738bc){return _0x3738bc[_0xaa49('0xc0')](_0x6d13af['query'][_0xaa49('0xb7')]);}})[_0xaa49('0x23')](respondWithStatusCode(_0x43d780,null))[_0xaa49('0x2e')](handleError(_0x43d780,null));};exports['download']=function(_0x28346d,_0x35c058){var _0x3e20b2=moment()[_0xaa49('0xc1')]()[_0xaa49('0xaa')]();var _0x313246=path['join'](config['root'],_0xaa49('0xc2'),_0xaa49('0xc3'),_0xaa49('0xc4'));var _0x504eee=path['join'](config[_0xaa49('0xc5')],_0xaa49('0xc2'),_0xaa49('0xc3'),_0xaa49('0xc6'));var _0x26059e=path[_0xaa49('0xc7')](_0x313246,_0x3e20b2);var _0x59d1a0=util[_0xaa49('0xb9')](_0xaa49('0xc8'),_0x28346d[_0xaa49('0xaf')]['id'],_0x3e20b2);var _0x44f9ff=path[_0xaa49('0xc7')](_0x313246,_0x59d1a0);var _0x5883f0=[];_0x5883f0['push']({'model':db[_0xaa49('0x66')],'as':'User','attributes':['id',_0xaa49('0x29')],'raw':!![]});_0x5883f0[_0xaa49('0x2d')]({'model':db[_0xaa49('0xc9')],'as':_0xaa49('0x5b'),'attributes':['id','firstName',_0xaa49('0xca')],'raw':!![]});var _0x1a79be=[{'model':db[_0xaa49('0xb6')],'as':_0xaa49('0xcb'),'attributes':['id','body',_0xaa49('0x72'),'direction',_0xaa49('0xcc'),_0xaa49('0x7a')],'include':_0x5883f0}];_0x1a79be[_0xaa49('0x2d')]({'model':db[_0xaa49('0xcd')],'as':_0xaa49('0xce'),'attributes':['id',_0xaa49('0x27')]});_0x1a79be[_0xaa49('0x2d')]({'model':db[_0xaa49('0x66')],'as':_0xaa49('0xcf'),'attributes':['id',_0xaa49('0x29')]});return db[_0xaa49('0x30')][_0xaa49('0x55')]({'where':{'id':_0x28346d[_0xaa49('0xaf')]['id']},'include':_0x1a79be})['then'](handleEntityNotFound(_0x35c058,null))[_0xaa49('0x23')](function(_0x2206b3){if(_0x2206b3){var _0x1c16f5=_0x2206b3[_0xaa49('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x26059e);var _0x2b48e2={'format':'A4','border':_0xaa49('0xd1'),'header':{'height':_0xaa49('0xd2'),'contents':{'first':_0xaa49('0xd3')}},'footer':{'height':_0xaa49('0xd4'),'contents':{'default':util[_0xaa49('0xb9')](_0xaa49('0xd5'),util['format'](_0xaa49('0xd6'),_0xaa49('0xd7'),_0x1c16f5['id']),moment()['format'](_0xaa49('0xd8'))[_0xaa49('0xaa')]())}}};var _0x585ac5={'channel':_0xaa49('0xd7'),'account':_0x1c16f5[_0xaa49('0xce')][_0xaa49('0x27')],'agent':_0x1c16f5[_0xaa49('0xcf')]?_0x1c16f5['Owner'][_0xaa49('0x29')]:_0xaa49('0xd9'),'createdAt':moment(_0x1c16f5[_0xaa49('0x72')])[_0xaa49('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0xaa49('0xaa')](),'closedAt':_0x1c16f5[_0xaa49('0xda')]?moment(_0x1c16f5[_0xaa49('0xdb')])[_0xaa49('0xb9')](_0xaa49('0xdc'))[_0xaa49('0xaa')]():'','disposition':_0x1c16f5['disposition'],'messages':_(_0x1c16f5[_0xaa49('0xcb')])['filter']({'secret':![]})['map'](function(_0x207bf5){return{'date':moment(_0x207bf5[_0xaa49('0x72')])[_0xaa49('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0xaa49('0xaa')](),'sender':_0x207bf5[_0xaa49('0xdd')]==='out'?_0x207bf5[_0xaa49('0x66')]?_0x207bf5['User'][_0xaa49('0x29')]:_0xaa49('0xde'):_0x207bf5[_0xaa49('0x5b')][_0xaa49('0xdf')]+(_0x207bf5[_0xaa49('0x5b')][_0xaa49('0xca')]?'\x20'+_0x207bf5['Contact'][_0xaa49('0xca')]:''),'body':_0x207bf5[_0xaa49('0x6a')],'direction':_0x207bf5[_0xaa49('0xdd')]==='out'?'A':'C','secret':_0x207bf5[_0xaa49('0xcc')],'read':_0x207bf5[_0xaa49('0x7a')]};})[_0xaa49('0x57')]()};return ejs['renderFile'](path['join'](config[_0xaa49('0xc5')],_0xaa49('0xc2'),_0xaa49('0xe0'),_0xaa49('0xe1')),{'interaction':_0x585ac5})['then'](function(_0x2dd2ec){return new BPromise(function(_0x3e20d5,_0x4b019f){pdf[_0xaa49('0xb3')](_0x2dd2ec,_0x2b48e2)[_0xaa49('0xe2')](path['join'](_0x26059e,'transcript-'+_0x1c16f5['id']+'-'+_0x3e20b2+_0xaa49('0xe3')),function(_0x12fe2d,_0x196fda){if(_0x12fe2d)return _0x4b019f(_0x12fe2d);_0x3e20d5(_0x196fda);});});})[_0xaa49('0x23')](function(){return new BPromise(function(_0x1a7761,_0x42812e){zipdir(_0x26059e,{'saveTo':_0x44f9ff},function(_0xd099f5,_0x927392){if(_0xd099f5)return _0x42812e(_0xd099f5);return _0x1a7761(_0x927392);});})[_0xaa49('0x23')](function(){return new BPromise(function(_0x2781e1,_0x1fce55){rimraf(_0x26059e,function(_0x449d5c){if(_0x449d5c)_0x1fce55(_0x449d5c);return _0x2781e1();});});})[_0xaa49('0x23')](function(){return _0x35c058[_0xaa49('0xe4')](_0x44f9ff,_0x59d1a0,function(_0x54058d){if(_0x54058d){console[_0xaa49('0xe5')](_0xaa49('0xe6'),_0x54058d);}else{fs['unlinkSync'](_0x44f9ff);}});});});}else{return _0x35c058['sendStatus'](0xc8);}})['catch'](handleError(_0x35c058,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 37467bb..df4f190 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 _0x5292=['setDataValue','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','then','map'];(function(_0x2bb719,_0x3dbb7a){var _0x18c336=function(_0x5ebc43){while(--_0x5ebc43){_0x2bb719['push'](_0x2bb719['shift']());}};_0x18c336(++_0x3dbb7a);}(_0x5292,0xf7));var _0x2529=function(_0x5c049a,_0x2c1263){_0x5c049a=_0x5c049a-0x0;var _0x168e70=_0x5292[_0x5c049a];return _0x168e70;};'use strict';var EventEmitter=require(_0x2529('0x0'));var SmsInteraction=require(_0x2529('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x2529('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2529('0x2')](0x0);var events={'afterCreate':_0x2529('0x3'),'afterUpdate':_0x2529('0x4'),'afterDestroy':_0x2529('0x5')};function emitEvent(_0x5d25dc){return function(_0x28c08d,_0x482dba,_0x4c9b4c){_0x28c08d['getUsers']({'attributes':['id'],'raw':!![]})[_0x2529('0x6')](function(_0x43cbef){_0x28c08d['setDataValue']('Users',_0x43cbef[_0x2529('0x7')](function(_0x2a0306){return{'id':_0x2a0306['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x28c08d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2529('0x6')](function(_0x44c8da){_0x28c08d[_0x2529('0x8')](_0x2529('0x9'),_0x44c8da[_0x2529('0xa')]);SmsInteractionEvents[_0x2529('0xb')](_0x5d25dc+':'+_0x28c08d['id'],_0x28c08d);SmsInteractionEvents[_0x2529('0xb')](_0x5d25dc,_0x28c08d);_0x4c9b4c(null);})[_0x2529('0xc')](_0x4c9b4c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x2529('0xd')](e,emitEvent(event));}}module[_0x2529('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0xb138=['exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','remove','getUsers','setDataValue','Users','findAll','unreadMessages','length','emit','hasOwnProperty','hook'];(function(_0x5dab4e,_0x48a999){var _0x4be667=function(_0x4715af){while(--_0x4715af){_0x5dab4e['push'](_0x5dab4e['shift']());}};_0x4be667(++_0x48a999);}(_0xb138,0x1dd));var _0x8b13=function(_0x14b5dc,_0x48fc78){_0x14b5dc=_0x14b5dc-0x0;var _0x59c774=_0xb138[_0x14b5dc];return _0x59c774;};'use strict';var EventEmitter=require(_0x8b13('0x0'));var SmsInteraction=require(_0x8b13('0x1'))['db'][_0x8b13('0x2')];var SmsMessage=require(_0x8b13('0x1'))['db'][_0x8b13('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8b13('0x4')](0x0);var events={'afterCreate':_0x8b13('0x5'),'afterUpdate':'update','afterDestroy':_0x8b13('0x6')};function emitEvent(_0x241acb){return function(_0x3af81a,_0x5ae5b2,_0xd19a0f){_0x3af81a[_0x8b13('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3fdf4d){_0x3af81a[_0x8b13('0x8')](_0x8b13('0x9'),_0x3fdf4d['map'](function(_0x8570b0){return{'id':_0x8570b0['id']};}));return SmsMessage[_0x8b13('0xa')]({'where':{'SmsInteractionId':_0x3af81a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x53ae50){_0x3af81a[_0x8b13('0x8')](_0x8b13('0xb'),_0x53ae50[_0x8b13('0xc')]);SmsInteractionEvents[_0x8b13('0xd')](_0x241acb+':'+_0x3af81a['id'],_0x3af81a);SmsInteractionEvents[_0x8b13('0xd')](_0x241acb,_0x3af81a);_0xd19a0f(null);})['catch'](_0xd19a0f(null));};}for(var e in events){if(events[_0x8b13('0xe')](e)){var event=events[e];SmsInteraction[_0x8b13('0xf')](e,emitEvent(event));}}module[_0x8b13('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index c6db33a..b50f979 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 _0x9c80=['closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api','moment','bluebird','rimraf','exports','SmsInteraction','changed','closed'];(function(_0x117666,_0xad5b3f){var _0x5a27f6=function(_0x4741b7){while(--_0x4741b7){_0x117666['push'](_0x117666['shift']());}};_0x5a27f6(++_0xad5b3f);}(_0x9c80,0xff));var _0x09c8=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x9c80[_0x487b0c];return _0x1adbdc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x09c8('0x0'))(_0x09c8('0x1'));var moment=require(_0x09c8('0x2'));var BPromise=require(_0x09c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09c8('0x4'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0x09c8('0x5')]=function(_0x2ba8af,_0x309b8c){return _0x2ba8af['define'](_0x09c8('0x6'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3464b5,_0x4b7f85,_0x64351f){if(_0x3464b5[_0x09c8('0x7')](_0x09c8('0x8'))){_0x3464b5[_0x09c8('0x9')]=moment()['format'](_0x09c8('0xa'));}_0x64351f(null,_0x3464b5);}}});}; \ No newline at end of file +var _0x660d=['../../config/environment','./smsInteraction.attributes','SmsInteraction','sms_interactions','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0x660d,0x117));var _0xd660=function(_0x5872cb,_0x3ea3e1){_0x5872cb=_0x5872cb-0x0;var _0xe0e5a1=_0x660d[_0x5872cb];return _0xe0e5a1;};'use strict';var _=require(_0xd660('0x0'));var util=require(_0xd660('0x1'));var logger=require(_0xd660('0x2'))(_0xd660('0x3'));var moment=require(_0xd660('0x4'));var BPromise=require(_0xd660('0x5'));var rp=require(_0xd660('0x6'));var fs=require('fs');var path=require(_0xd660('0x7'));var rimraf=require(_0xd660('0x8'));var config=require(_0xd660('0x9'));var attributes=require(_0xd660('0xa'));module['exports']=function(_0x1ea350,_0x430d59){return _0x1ea350['define'](_0xd660('0xb'),attributes,{'tableName':_0xd660('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x412533,_0x52c258,_0x5afdee){if(_0x412533['changed'](_0xd660('0xd'))){_0x412533[_0xd660('0xe')]=moment()[_0xd660('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5afdee(null,_0x412533);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 4d7c4af..0797ec0 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 _0x5f7b=['request','then','info','SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','find','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','register'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x5f7b,0x1d3));var _0xb5f7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5f7b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xb5f7('0x0'));var util=require('util');var moment=require(_0xb5f7('0x1'));var BPromise=require(_0xb5f7('0x2'));var rs=require(_0xb5f7('0x3'));var fs=require('fs');var Redis=require(_0xb5f7('0x4'));var db=require(_0xb5f7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb5f7('0x6'))(_0xb5f7('0x7'));var config=require(_0xb5f7('0x8'));var jayson=require(_0xb5f7('0x9'));var client=jayson[_0xb5f7('0xa')]['http']({'port':0x232a});config[_0xb5f7('0xb')]=_[_0xb5f7('0xc')](config[_0xb5f7('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb5f7('0xb')]));require('./smsInteraction.socket')[_0xb5f7('0xd')](socket);function respondWithRpcPromise(_0x2bee32,_0x435483,_0x7f2062){return new BPromise(function(_0x1d752c,_0x583147){return client[_0xb5f7('0xe')](_0x2bee32,_0x7f2062)[_0xb5f7('0xf')](function(_0x5f2ef0){logger[_0xb5f7('0x10')](_0xb5f7('0x11'),_0x435483,'request\x20sent');logger[_0xb5f7('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x435483,_0xb5f7('0x13'),JSON[_0xb5f7('0x14')](_0x5f2ef0));if(_0x5f2ef0[_0xb5f7('0x15')]){if(_0x5f2ef0['error']['code']===0x1f4){logger[_0xb5f7('0x15')](_0xb5f7('0x11'),_0x435483,_0x5f2ef0[_0xb5f7('0x15')]['message']);return _0x583147(_0x5f2ef0[_0xb5f7('0x15')][_0xb5f7('0x16')]);}logger['error'](_0xb5f7('0x11'),_0x435483,_0x5f2ef0[_0xb5f7('0x15')][_0xb5f7('0x16')]);return _0x1d752c(_0x5f2ef0[_0xb5f7('0x15')][_0xb5f7('0x16')]);}else{logger[_0xb5f7('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x435483,_0xb5f7('0x13'));_0x1d752c(_0x5f2ef0[_0xb5f7('0x17')]['message']);}})[_0xb5f7('0x18')](function(_0x4f773c){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x435483,_0x4f773c);_0x583147(_0x4f773c);});});}exports[_0xb5f7('0x19')]=function(_0x29d3a6){var _0x44be79=this;return new Promise(function(_0x534a00,_0x1cef6e){return db[_0xb5f7('0x1a')][_0xb5f7('0x1b')](_0x29d3a6[_0xb5f7('0x1c')],{'raw':_0x29d3a6[_0xb5f7('0x1d')]?_0x29d3a6[_0xb5f7('0x1d')][_0xb5f7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29d3a6[_0xb5f7('0x1d')]?_0x29d3a6[_0xb5f7('0x1d')][_0xb5f7('0x1f')]||null:null,'attributes':_0x29d3a6[_0xb5f7('0x1d')]?_0x29d3a6[_0xb5f7('0x1d')]['attributes']||null:null,'limit':_0x29d3a6[_0xb5f7('0x1d')]?_0x29d3a6['options'][_0xb5f7('0x20')]||null:null})[_0xb5f7('0xf')](function(_0x1a788a){logger['info']('UpdateSmsInteraction',_0x29d3a6);logger['debug'](_0xb5f7('0x19'),_0x29d3a6,JSON[_0xb5f7('0x14')](_0x1a788a));_0x534a00(_0x1a788a);})[_0xb5f7('0x18')](function(_0x3df795){logger[_0xb5f7('0x15')](_0xb5f7('0x19'),_0x3df795[_0xb5f7('0x16')],_0x29d3a6);_0x1cef6e(_0x44be79['error'](0x1f4,_0x3df795['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x1c0158){return new Promise(function(_0xbcf8f1,_0x3bffc4){return db[_0xb5f7('0x1a')][_0xb5f7('0x21')]({'where':_0x1c0158[_0xb5f7('0x1d')]?_0x1c0158[_0xb5f7('0x1d')][_0xb5f7('0x1f')]||null:null})[_0xb5f7('0xf')](function(_0x211f65){if(_0x211f65){return _0x211f65['addTags'](_0x1c0158[_0xb5f7('0x1c')]['ids'],_['omit'](_0x1c0158[_0xb5f7('0x1c')],[_0xb5f7('0x22'),'id'])||{});}})[_0xb5f7('0x23')](function(_0x7ab097){logger[_0xb5f7('0x10')](_0xb5f7('0x24'),_0x1c0158);logger[_0xb5f7('0x12')](_0xb5f7('0x24'),_0x1c0158,JSON['stringify'](_0x7ab097));_0xbcf8f1(_0x7ab097);})[_0xb5f7('0x18')](function(_0x5b903b){logger[_0xb5f7('0x15')](_0xb5f7('0x24'),_0x5b903b['message'],_0x1c0158);_0x3bffc4(_this[_0xb5f7('0x15')](0x1f4,_0x5b903b[_0xb5f7('0x16')]));});});}; \ No newline at end of file +var _0x6a95=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','body','options','where','attributes','limit','info','AddTagsToSmsInteraction','SmsInteraction','addTags','ids','omit'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x6a95,0x1db));var _0x56a9=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x6a95[_0x5b78e8];return _0xf2c321;};'use strict';var _=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var moment=require(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});config[_0x56a9('0xc')]=_[_0x56a9('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x56a9('0xe'))(new Redis(config[_0x56a9('0xc')]));require('./smsInteraction.socket')[_0x56a9('0xf')](socket);function respondWithRpcPromise(_0x1eddfd,_0x2d590d,_0xcf7c){return new BPromise(function(_0x3c1506,_0x319ff3){return client[_0x56a9('0x10')](_0x1eddfd,_0xcf7c)[_0x56a9('0x11')](function(_0x9ab10c){logger['info'](_0x56a9('0x12'),_0x2d590d,'request\x20sent');logger[_0x56a9('0x13')](_0x56a9('0x14'),_0x2d590d,_0x56a9('0x15'),JSON[_0x56a9('0x16')](_0x9ab10c));if(_0x9ab10c[_0x56a9('0x17')]){if(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x18')]===0x1f4){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error']['message']);return _0x319ff3(_0x9ab10c[_0x56a9('0x17')][_0x56a9('0x19')]);}logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x9ab10c['error'][_0x56a9('0x19')]);return _0x3c1506(_0x9ab10c['error']['message']);}else{logger['info'](_0x56a9('0x12'),_0x2d590d,_0x56a9('0x15'));_0x3c1506(_0x9ab10c[_0x56a9('0x1a')][_0x56a9('0x19')]);}})[_0x56a9('0x1b')](function(_0x429e24){logger[_0x56a9('0x17')](_0x56a9('0x12'),_0x2d590d,_0x429e24);_0x319ff3(_0x429e24);});});}exports[_0x56a9('0x1c')]=function(_0x335cc3){var _0x2ff2ca=this;return new Promise(function(_0x62f79f,_0x5f145f){return db['SmsInteraction'][_0x56a9('0x1d')](_0x335cc3[_0x56a9('0x1e')],{'raw':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3[_0x56a9('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3[_0x56a9('0x1f')][_0x56a9('0x20')]||null:null,'attributes':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3['options'][_0x56a9('0x21')]||null:null,'limit':_0x335cc3[_0x56a9('0x1f')]?_0x335cc3[_0x56a9('0x1f')][_0x56a9('0x22')]||null:null})[_0x56a9('0x11')](function(_0x52016c){logger[_0x56a9('0x23')](_0x56a9('0x1c'),_0x335cc3);logger[_0x56a9('0x13')]('UpdateSmsInteraction',_0x335cc3,JSON[_0x56a9('0x16')](_0x52016c));_0x62f79f(_0x52016c);})['catch'](function(_0x22744f){logger[_0x56a9('0x17')](_0x56a9('0x1c'),_0x22744f[_0x56a9('0x19')],_0x335cc3);_0x5f145f(_0x2ff2ca[_0x56a9('0x17')](0x1f4,_0x22744f[_0x56a9('0x19')]));});});};exports[_0x56a9('0x24')]=function(_0xff5f55){return new Promise(function(_0x51fd64,_0x437ccf){return db[_0x56a9('0x25')]['find']({'where':_0xff5f55[_0x56a9('0x1f')]?_0xff5f55['options']['where']||null:null})[_0x56a9('0x11')](function(_0x4c1e3e){if(_0x4c1e3e){return _0x4c1e3e[_0x56a9('0x26')](_0xff5f55[_0x56a9('0x1e')][_0x56a9('0x27')],_[_0x56a9('0x28')](_0xff5f55['body'],[_0x56a9('0x27'),'id'])||{});}})[_0x56a9('0x29')](function(_0x362353){logger[_0x56a9('0x23')](_0x56a9('0x2a'),_0xff5f55);logger[_0x56a9('0x13')](_0x56a9('0x2a'),_0xff5f55,JSON[_0x56a9('0x16')](_0x362353));_0x51fd64(_0x362353);})[_0x56a9('0x1b')](function(_0x392b72){logger[_0x56a9('0x17')](_0x56a9('0x2a'),_0x392b72['message'],_0xff5f55);_0x437ccf(_this[_0x56a9('0x17')](0x1f4,_0x392b72[_0x56a9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 93ccfcb..468cece 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 _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x2032,0xd9));var _0x2203=function(_0x133717,_0x4d23c2){_0x133717=_0x133717-0x0;var _0x479846=_0x2032[_0x133717];return _0x479846;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file +var _0x2032=['save','remove','update','removeListener','register','length','smsInteraction:'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x2032,0xd9));var _0x2203=function(_0x570a81,_0x519341){_0x570a81=_0x570a81-0x0;var _0x1dbaa9=_0x2032[_0x570a81];return _0x1dbaa9;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2203('0x0'),_0x2203('0x1'),_0x2203('0x2')];function createListener(_0x4c28da,_0x486390){return function(_0x228a29){_0x486390['emit'](_0x4c28da,_0x228a29);};}function removeListener(_0x46c49a,_0x880dcd){return function(){SmsInteractionEvents[_0x2203('0x3')](_0x46c49a,_0x880dcd);};}exports[_0x2203('0x4')]=function(_0x3f7ba1){for(var _0x13367a=0x0,_0x2e0f63=events[_0x2203('0x5')];_0x13367a<_0x2e0f63;_0x13367a++){var _0x18c4d6=events[_0x13367a];var _0x2049ff=createListener(_0x2203('0x6')+_0x18c4d6,_0x3f7ba1);SmsInteractionEvents['on'](_0x18c4d6,_0x2049ff);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 64ac1ab..b9c1f08 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 _0xb892=['path','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','update','put','accept','/:id/reject','exports','multer','util'];(function(_0x4dda08,_0xee2532){var _0x403038=function(_0xce2091){while(--_0xce2091){_0x4dda08['push'](_0x4dda08['shift']());}};_0x403038(++_0xee2532);}(_0xb892,0x193));var _0x2b89=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0xb892[_0x4b73a2];return _0x383c66;};'use strict';var multer=require(_0x2b89('0x0'));var util=require(_0x2b89('0x1'));var path=require(_0x2b89('0x2'));var timeout=require('connect-timeout');var express=require(_0x2b89('0x3'));var router=express[_0x2b89('0x4')]();var auth=require(_0x2b89('0x5'));var interaction=require(_0x2b89('0x6'));var config=require('../../config/environment');var controller=require(_0x2b89('0x7'));router[_0x2b89('0x8')]('/',auth[_0x2b89('0x9')](),controller[_0x2b89('0xa')]);router['get'](_0x2b89('0xb'),auth[_0x2b89('0x9')](),controller[_0x2b89('0xc')]);router[_0x2b89('0x8')](_0x2b89('0xd'),auth['isAuthenticated'](),controller[_0x2b89('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x2b89('0xf')](_0x2b89('0x10'),_0x2b89('0x11')),controller[_0x2b89('0x12')]);router[_0x2b89('0x13')](_0x2b89('0x14'),controller[_0x2b89('0x15')]);router['put'](_0x2b89('0xd'),auth[_0x2b89('0x9')](),controller[_0x2b89('0x16')]);router[_0x2b89('0x17')]('/:id/accept',auth['isAuthenticated'](),controller[_0x2b89('0x18')]);router[_0x2b89('0x17')](_0x2b89('0x19'),auth[_0x2b89('0x9')](),controller['reject']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2b89('0x1a')]=router; \ No newline at end of file +var _0x8056=['status','put','/:id/reject','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','post','smsmessage:create','create'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x8056,0x98));var _0x6805=function(_0x19fc44,_0x4bca56){_0x19fc44=_0x19fc44-0x0;var _0x3414ec=_0x8056[_0x19fc44];return _0x3414ec;};'use strict';var multer=require(_0x6805('0x0'));var util=require(_0x6805('0x1'));var path=require(_0x6805('0x2'));var timeout=require(_0x6805('0x3'));var express=require('express');var router=express[_0x6805('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6805('0x5'));var config=require(_0x6805('0x6'));var controller=require('./smsMessage.controller');router[_0x6805('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6805('0x7')](_0x6805('0x8'),auth['isAuthenticated'](),controller[_0x6805('0x9')]);router[_0x6805('0x7')](_0x6805('0xa'),auth[_0x6805('0xb')](),controller[_0x6805('0xc')]);router[_0x6805('0xd')]('/',auth[_0x6805('0xb')](),interaction['tracked']('sms',_0x6805('0xe')),controller[_0x6805('0xf')]);router[_0x6805('0xd')]('/:id/status',controller[_0x6805('0x10')]);router[_0x6805('0x11')](_0x6805('0xa'),auth[_0x6805('0xb')](),controller['update']);router[_0x6805('0x11')]('/:id/accept',auth[_0x6805('0xb')](),controller['accept']);router[_0x6805('0x11')](_0x6805('0x12'),auth[_0x6805('0xb')](),controller['reject']);router[_0x6805('0x13')]('/:id',auth[_0x6805('0xb')](),controller[_0x6805('0x14')]);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 0f08660..a6d46a9 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 _0x4529=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','exports'];(function(_0x346047,_0x4b6669){var _0x536fed=function(_0x2a0a97){while(--_0x2a0a97){_0x346047['push'](_0x346047['shift']());}};_0x536fed(++_0x4b6669);}(_0x4529,0x19f));var _0x9452=function(_0x964390,_0x52758d){_0x964390=_0x964390-0x0;var _0x24ae37=_0x4529[_0x964390];return _0x24ae37;};'use strict';var Sequelize=require('sequelize');module[_0x9452('0x0')]={'body':{'type':Sequelize[_0x9452('0x1')](_0x9452('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9452('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9452('0x4')]('in','out'),'defaultValue':_0x9452('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x9452('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x9452('0x7')]},'secret':{'type':Sequelize[_0x9452('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9452('0x6')]},'providerResponse':{'type':Sequelize[_0x9452('0x1')]}}; \ No newline at end of file +var _0x2ad8=['TEXT','medium','BOOLEAN','ENUM','out','STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ad8,0xb5));var _0x82ad=function(_0x3024ce,_0x441227){_0x3024ce=_0x3024ce-0x0;var _0x560230=_0x2ad8[_0x3024ce];return _0x560230;};'use strict';var Sequelize=require('sequelize');module[_0x82ad('0x0')]={'body':{'type':Sequelize[_0x82ad('0x1')](_0x82ad('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x82ad('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x82ad('0x4')]('in',_0x82ad('0x5')),'defaultValue':_0x82ad('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x82ad('0x6')](0xbe)},'phone':{'type':Sequelize[_0x82ad('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x82ad('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x82ad('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 02a30df..8d01a22 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 _0xd96d=['event','accept','EventManager','acceptmessage','sms','agent','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','channel','rejectmessage','SmsAccount','SmsAccountId','debug','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','indexOf','sent','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','path','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','defaults','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','SmsMessage','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','limit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','findAll','catch','show','params','find','create','body','update','describe','sms-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','get','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','manual','interface'];(function(_0x369a98,_0x32250c){var _0x29565c=function(_0x1a6973){while(--_0x1a6973){_0x369a98['push'](_0x369a98['shift']());}};_0x29565c(++_0x32250c);}(_0xd96d,0x1a4));var _0xdd96=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xd96d[_0x4c7fb5];return _0x2e10ac;};'use strict';var pdf=require(_0xdd96('0x0'));var emlformat=require(_0xdd96('0x1'));var rimraf=require(_0xdd96('0x2'));var zipdir=require(_0xdd96('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdd96('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdd96('0x5'));var crypto=require(_0xdd96('0x6'));var jsforce=require(_0xdd96('0x7'));var deskjs=require(_0xdd96('0x8'));var toCsv=require('to-csv');var querystring=require(_0xdd96('0x9'));var Papa=require(_0xdd96('0xa'));var Redis=require(_0xdd96('0xb'));var authService=require(_0xdd96('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xdd96('0xd'));var hardwareService=require(_0xdd96('0xe'));var logger=require(_0xdd96('0xf'))(_0xdd96('0x10'));var utils=require(_0xdd96('0x11'));var config=require(_0xdd96('0x12'));var licenseUtil=require(_0xdd96('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xdd96('0x14')](config[_0xdd96('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd96('0x16'))(new Redis(config[_0xdd96('0x15')]));require(_0xdd96('0x17'))[_0xdd96('0x18')](socket);var jayson=require(_0xdd96('0x19'));var client=jayson['client'][_0xdd96('0x1a')]({'port':0x232c});var client9002=jayson['client'][_0xdd96('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4305cb,_0x45e25b,_0x193827,_0x54b82b){return new BPromise(function(_0x383d1a,_0x24f5ad){var _0x525899=_0x54b82b||client;return _0x525899[_0xdd96('0x1b')](_0x4305cb,_0x193827)['then'](function(_0x16715c){logger[_0xdd96('0x1c')](_0xdd96('0x1d'),_0x45e25b,_0xdd96('0x1e'));logger['debug'](_0xdd96('0x1f'),_0x45e25b,'request\x20sent',JSON[_0xdd96('0x20')](_0x16715c));if(_0x16715c['error']){if(_0x16715c[_0xdd96('0x21')][_0xdd96('0x22')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x45e25b,_0x16715c['error'][_0xdd96('0x23')]);return _0x24f5ad(_0x16715c['error']['message']);}logger[_0xdd96('0x21')](_0xdd96('0x1d'),_0x45e25b,_0x16715c[_0xdd96('0x21')][_0xdd96('0x23')]);return _0x383d1a(_0x16715c[_0xdd96('0x21')][_0xdd96('0x23')]);}else{logger['info'](_0xdd96('0x1d'),_0x45e25b,_0xdd96('0x1e'));_0x383d1a(_0x16715c['result'][_0xdd96('0x23')]);}})['catch'](function(_0x3328f1){logger['error'](_0xdd96('0x1d'),_0x45e25b,_0x3328f1);_0x24f5ad(_0x3328f1);});});}function respondWithStatusCode(_0x51997b,_0x63cb31){_0x63cb31=_0x63cb31||0xcc;return function(_0x19a576){if(_0x19a576){return _0x51997b[_0xdd96('0x24')](_0x63cb31);}return _0x51997b[_0xdd96('0x25')](_0x63cb31)[_0xdd96('0x26')]();};}function respondWithResult(_0x56bb6b,_0x376612){_0x376612=_0x376612||0xc8;return function(_0x4c81e3){if(_0x4c81e3){return _0x56bb6b[_0xdd96('0x25')](_0x376612)[_0xdd96('0x27')](_0x4c81e3);}};}function respondWithFilteredResult(_0x5c3240,_0x193e81){return function(_0x318da3){if(_0x318da3){var _0x28144f=_0x318da3[_0xdd96('0x28')],_0x4782b8=_0x193e81[_0xdd96('0x29')],_0x19c514=_0x193e81[_0xdd96('0x29')]+_0x193e81['limit'],_0x21da28;if(_0x19c514>=_0x28144f){_0x19c514=_0x28144f;_0x21da28=0xc8;}else{_0x21da28=0xce;}_0x5c3240[_0xdd96('0x25')](_0x21da28);return _0x5c3240['set'](_0xdd96('0x2a'),_0x4782b8+'-'+_0x19c514+'/'+_0x28144f)[_0xdd96('0x27')](_0x318da3);}return null;};}function patchUpdates(_0xcc555e){return function(_0x58936a){try{jsonpatch[_0xdd96('0x2b')](_0x58936a,_0xcc555e,!![]);}catch(_0x43f33d){return BPromise[_0xdd96('0x2c')](_0x43f33d);}return _0x58936a[_0xdd96('0x2d')]();};}function saveUpdates(_0x5aa94f,_0xe1ea5b){return function(_0xb6d05d){if(_0xb6d05d){return _0xb6d05d['update'](_0x5aa94f)[_0xdd96('0x2e')](function(_0x20e0d8){return _0x20e0d8;});}return null;};}function removeEntity(_0x2884e8,_0x1e8ddb){return function(_0x4ca1b8){if(_0x4ca1b8){return _0x4ca1b8[_0xdd96('0x2f')]()[_0xdd96('0x2e')](function(){_0x2884e8[_0xdd96('0x25')](0xcc)[_0xdd96('0x26')]();});}};}function handleEntityNotFound(_0x202d4d,_0x3ea5f1){return function(_0xb33fd){if(!_0xb33fd){_0x202d4d[_0xdd96('0x24')](0x194);}return _0xb33fd;};}function handleError(_0x5239e6,_0x309cf1){_0x309cf1=_0x309cf1||0x1f4;return function(_0x41af67){logger[_0xdd96('0x21')](_0x41af67[_0xdd96('0x30')]);if(_0x41af67[_0xdd96('0x31')]){delete _0x41af67['name'];}_0x5239e6['status'](_0x309cf1)[_0xdd96('0x32')](_0x41af67);};}exports['index']=function(_0x58e634,_0x3369c1){var _0x4d7959={},_0x17de1c={},_0x38da37={'count':0x0,'rows':[]};var _0x5bb563=_[_0xdd96('0x33')](db[_0xdd96('0x34')][_0xdd96('0x35')],function(_0x2c5a4c){return{'name':_0x2c5a4c['fieldName'],'type':_0x2c5a4c[_0xdd96('0x36')]['key']};});_0x17de1c[_0xdd96('0x37')]=_[_0xdd96('0x33')](_0x5bb563,_0xdd96('0x31'));_0x17de1c[_0xdd96('0x38')]=_[_0xdd96('0x39')](_0x58e634['query']);_0x17de1c[_0xdd96('0x3a')]=_['intersection'](_0x17de1c[_0xdd96('0x37')],_0x17de1c['query']);_0x4d7959[_0xdd96('0x3b')]=_[_0xdd96('0x3c')](_0x17de1c[_0xdd96('0x37')],qs[_0xdd96('0x3d')](_0x58e634[_0xdd96('0x38')]['fields']));_0x4d7959[_0xdd96('0x3b')]=_0x4d7959[_0xdd96('0x3b')][_0xdd96('0x3e')]?_0x4d7959[_0xdd96('0x3b')]:_0x17de1c['model'];if(!_0x58e634[_0xdd96('0x38')]['hasOwnProperty']('nolimit')){_0x4d7959[_0xdd96('0x3f')]=qs['limit'](_0x58e634[_0xdd96('0x38')][_0xdd96('0x3f')]);_0x4d7959['offset']=qs[_0xdd96('0x29')](_0x58e634[_0xdd96('0x38')]['offset']);}_0x4d7959[_0xdd96('0x40')]=qs[_0xdd96('0x41')](_0x58e634[_0xdd96('0x38')][_0xdd96('0x41')]);_0x4d7959['where']=qs['filters'](_[_0xdd96('0x42')](_0x58e634[_0xdd96('0x38')],_0x17de1c[_0xdd96('0x3a')]),_0x5bb563);if(_0x58e634[_0xdd96('0x38')][_0xdd96('0x43')]){_0x4d7959['where']=_['merge'](_0x4d7959['where'],{'$or':_[_0xdd96('0x33')](_0x5bb563,function(_0x3b41c6){if(_0x3b41c6[_0xdd96('0x36')]!==_0xdd96('0x44')){var _0x36022b={};_0x36022b[_0x3b41c6[_0xdd96('0x31')]]={'$like':'%'+_0x58e634[_0xdd96('0x38')][_0xdd96('0x43')]+'%'};return _0x36022b;}})});}_0x4d7959=_['merge']({},_0x4d7959,_0x58e634[_0xdd96('0x45')]);var _0x53e425={'where':_0x4d7959[_0xdd96('0x46')]};return db[_0xdd96('0x34')][_0xdd96('0x28')](_0x53e425)[_0xdd96('0x2e')](function(_0x2908df){_0x38da37[_0xdd96('0x28')]=_0x2908df;if(_0x58e634[_0xdd96('0x38')][_0xdd96('0x47')]){_0x4d7959['include']=[{'all':!![]}];}return db[_0xdd96('0x34')][_0xdd96('0x48')](_0x4d7959);})[_0xdd96('0x2e')](function(_0xa8a391){_0x38da37['rows']=_0xa8a391;return _0x38da37;})[_0xdd96('0x2e')](respondWithFilteredResult(_0x3369c1,_0x4d7959))[_0xdd96('0x49')](handleError(_0x3369c1,null));};exports[_0xdd96('0x4a')]=function(_0x14d14f,_0x4ef5a2){var _0x5efcaf={'raw':!![],'where':{'id':_0x14d14f[_0xdd96('0x4b')]['id']}},_0x5dbc8f={};_0x5dbc8f[_0xdd96('0x37')]=_[_0xdd96('0x39')](db['SmsMessage'][_0xdd96('0x35')]);_0x5dbc8f[_0xdd96('0x38')]=_[_0xdd96('0x39')](_0x14d14f[_0xdd96('0x38')]);_0x5dbc8f[_0xdd96('0x3a')]=_['intersection'](_0x5dbc8f[_0xdd96('0x37')],_0x5dbc8f[_0xdd96('0x38')]);_0x5efcaf[_0xdd96('0x3b')]=_['intersection'](_0x5dbc8f['model'],qs[_0xdd96('0x3d')](_0x14d14f[_0xdd96('0x38')][_0xdd96('0x3d')]));_0x5efcaf['attributes']=_0x5efcaf['attributes'][_0xdd96('0x3e')]?_0x5efcaf['attributes']:_0x5dbc8f[_0xdd96('0x37')];if(_0x14d14f['query']['includeAll']){_0x5efcaf['include']=[{'all':!![]}];}_0x5efcaf=_['merge']({},_0x5efcaf,_0x14d14f[_0xdd96('0x45')]);return db[_0xdd96('0x34')][_0xdd96('0x4c')](_0x5efcaf)[_0xdd96('0x2e')](handleEntityNotFound(_0x4ef5a2,null))[_0xdd96('0x2e')](respondWithResult(_0x4ef5a2,null))['catch'](handleError(_0x4ef5a2,null));};exports[_0xdd96('0x4d')]=function(_0x22a1dc,_0x383d9f){return db[_0xdd96('0x34')][_0xdd96('0x4d')](_0x22a1dc[_0xdd96('0x4e')],{})[_0xdd96('0x2e')](respondWithResult(_0x383d9f,0xc9))[_0xdd96('0x49')](handleError(_0x383d9f,null));};exports[_0xdd96('0x4f')]=function(_0x1e25a4,_0x250492){if(_0x1e25a4[_0xdd96('0x4e')]['id']){delete _0x1e25a4[_0xdd96('0x4e')]['id'];}return db[_0xdd96('0x34')][_0xdd96('0x4c')]({'where':{'id':_0x1e25a4[_0xdd96('0x4b')]['id']}})[_0xdd96('0x2e')](handleEntityNotFound(_0x250492,null))[_0xdd96('0x2e')](saveUpdates(_0x1e25a4['body'],null))[_0xdd96('0x2e')](respondWithResult(_0x250492,null))[_0xdd96('0x49')](handleError(_0x250492,null));};exports[_0xdd96('0x2f')]=function(_0x362e4c,_0x3e861f){return db[_0xdd96('0x34')][_0xdd96('0x4c')]({'where':{'id':_0x362e4c[_0xdd96('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e861f,null))['then'](removeEntity(_0x3e861f,null))['catch'](handleError(_0x3e861f,null));};exports['describe']=function(_0x34f6fd,_0x33656c){return db[_0xdd96('0x34')][_0xdd96('0x50')]()[_0xdd96('0x2e')](respondWithResult(_0x33656c,null))['catch'](handleError(_0x33656c,null));};var interaction_log=require(_0xdd96('0xf'))(_0xdd96('0x51'));exports['accept']=function(_0x3d9a8b,_0xd1df44,_0x181ab9){var _0x8c4cfa={'channel':'sms'};if(_0x3d9a8b[_0xdd96('0x4e')]['id']){delete _0x3d9a8b[_0xdd96('0x4e')]['id'];}_0x3d9a8b[_0xdd96('0x4e')][_0xdd96('0x52')]=!![];_0x3d9a8b[_0xdd96('0x4e')][_0xdd96('0x53')]=moment()[_0xdd96('0x54')](_0xdd96('0x55'));_0x3d9a8b[_0xdd96('0x4e')][_0xdd96('0x56')]=_0x3d9a8b[_0xdd96('0x4e')]['UserId']||_0x3d9a8b['user']['id'];return db[_0xdd96('0x34')][_0xdd96('0x4c')]({'where':{'id':_0x3d9a8b[_0xdd96('0x4b')]['id'],'UserId':null},'include':[{'model':db[_0xdd96('0x57')],'as':'Contact'}]})[_0xdd96('0x2e')](handleEntityNotFound(_0xd1df44,null))[_0xdd96('0x2e')](saveUpdates(_0x3d9a8b[_0xdd96('0x4e')],null))['then'](function(_0x238e26){if(_0x238e26){_0x8c4cfa['message']=_0x238e26[_0xdd96('0x58')]({'plain':!![]});return db['SmsInteraction'][_0xdd96('0x4c')]({'where':{'id':_0x238e26[_0xdd96('0x59')]}});}return null;})[_0xdd96('0x2e')](handleEntityNotFound(_0xd1df44,null))[_0xdd96('0x2e')](function(_0x232453){if(_0x232453){return _0x232453[_0xdd96('0x4f')]({'UserId':_0x3d9a8b[_0xdd96('0x4e')][_0xdd96('0x56')],'read1stAt':_['isNil'](_0x232453[_0xdd96('0x5a')])?moment()[_0xdd96('0x54')](_0xdd96('0x55')):undefined});}return null;})[_0xdd96('0x2e')](function(_0x2a9eb7){if(_0x2a9eb7){_0x8c4cfa[_0xdd96('0x5b')]=_0x2a9eb7['get']({'plain':!![]});interaction_log['info'](_0xdd96('0x5c'),_0x3d9a8b[_0xdd96('0x5d')]['id'],_0x3d9a8b[_0xdd96('0x5d')]['name'],_0x3d9a8b['user'][_0xdd96('0x5e')],_0x8c4cfa[_0xdd96('0x5b')]['id'],_0x3d9a8b['body']?JSON['stringify'](_0x3d9a8b['body']):_0xdd96('0x5f'));return respondWithRpcPromise(_0xdd96('0x60'),_0xdd96('0x61'),_0x8c4cfa);}return null;})[_0xdd96('0x2e')](function(_0x59e02b){if(_0x59e02b){if(_0x3d9a8b[_0xdd96('0x4e')][_0xdd96('0x62')]){_0x8c4cfa[_0xdd96('0x23')][_0xdd96('0x63')]=util[_0xdd96('0x54')]('SIP/%s',_0x3d9a8b['user']['name']);_0x8c4cfa[_0xdd96('0x23')]['channel']=_0x8c4cfa['channel'];_0x8c4cfa[_0xdd96('0x23')][_0xdd96('0x64')]=_0xdd96('0x65');return respondWithRpcPromise(_0xdd96('0x66'),_0xdd96('0x66'),{'event':_0xdd96('0x67'),'message':_0x8c4cfa[_0xdd96('0x23')]},client9002)['then'](function(){return _0x8c4cfa;});}return _0x8c4cfa;}return null;})[_0xdd96('0x2e')](respondWithResult(_0xd1df44,null))['catch'](handleError(_0xd1df44,null));};var interaction_log=require(_0xdd96('0xf'))('sms-interactions');exports['reject']=function(_0x2285e3,_0x574f21,_0x5bf89f){var _0x3fdaa0={'agent':{},'channel':_0xdd96('0x68')};if(_0x2285e3[_0xdd96('0x4e')]['id']){delete _0x2285e3[_0xdd96('0x4e')]['id'];}_0x2285e3[_0xdd96('0x4e')][_0xdd96('0x56')]=_0x2285e3[_0xdd96('0x4e')][_0xdd96('0x56')]||_0x2285e3[_0xdd96('0x5d')]['id'];_0x3fdaa0[_0xdd96('0x69')]['id']=_0x2285e3[_0xdd96('0x4e')][_0xdd96('0x56')];return db[_0xdd96('0x34')][_0xdd96('0x4c')]({'where':{'id':_0x2285e3[_0xdd96('0x4b')]['id'],'UserId':null}})[_0xdd96('0x2e')](handleEntityNotFound(_0x574f21,null))[_0xdd96('0x2e')](function(_0x3a8756){if(_0x3a8756){_0x3fdaa0[_0xdd96('0x23')]=_0x3a8756[_0xdd96('0x58')]({'plain':!![]});return db[_0xdd96('0x6a')][_0xdd96('0x4c')]({'where':{'id':_0x3a8756[_0xdd96('0x59')]}});}return null;})[_0xdd96('0x2e')](handleEntityNotFound(_0x574f21,null))[_0xdd96('0x2e')](function(_0x35e294){if(_0x35e294){_0x3fdaa0[_0xdd96('0x5b')]=_0x35e294['get']({'plain':!![]});interaction_log[_0xdd96('0x1c')](_0xdd96('0x6b'),_0x2285e3[_0xdd96('0x5d')]['id'],_0x2285e3[_0xdd96('0x5d')]['name'],_0x2285e3['user'][_0xdd96('0x5e')],_0x3fdaa0[_0xdd96('0x5b')]['id'],_0x2285e3[_0xdd96('0x4e')]?JSON[_0xdd96('0x20')](_0x2285e3['body']):_0xdd96('0x5f'));return respondWithRpcPromise(_0xdd96('0x6c'),_0xdd96('0x6d'),_0x3fdaa0);}return null;})[_0xdd96('0x2e')](function(_0x3f58f3){if(_0x3f58f3){_0x3f58f3['message'][_0xdd96('0x63')]=util[_0xdd96('0x54')](_0xdd96('0x6e'),_0x2285e3[_0xdd96('0x5d')][_0xdd96('0x31')]);_0x3f58f3['message'][_0xdd96('0x6f')]=_0x3fdaa0[_0xdd96('0x6f')];_0x3f58f3[_0xdd96('0x23')][_0xdd96('0x64')]=_0xdd96('0x2c');respondWithRpcPromise('EventManager',_0xdd96('0x66'),{'event':_0xdd96('0x70'),'message':_0x3f58f3['message']},client9002);return _0x3fdaa0;}return null;})[_0xdd96('0x2e')](respondWithResult(_0x574f21,null))[_0xdd96('0x49')](handleError(_0x574f21,null));};exports['status']=function(_0x3cb665,_0x94bdd7,_0x1e643b){if(_0x3cb665['body']['id']){delete _0x3cb665['body']['id'];}var _0x3dda9a;return db[_0xdd96('0x34')][_0xdd96('0x4c')]({'where':{'id':_0x3cb665['params']['id']}})['then'](handleEntityNotFound(_0x94bdd7,null))[_0xdd96('0x2e')](function(_0x3f5cae){if(_0x3f5cae){_0x3dda9a=_0x3f5cae;return db[_0xdd96('0x71')][_0xdd96('0x4c')]({'where':{'id':_0x3f5cae[_0xdd96('0x72')]}});}})[_0xdd96('0x2e')](handleEntityNotFound(_0x94bdd7,null))[_0xdd96('0x2e')](function(_0x5bbce3){if(_0x5bbce3){logger[_0xdd96('0x73')](_0xdd96('0x1f'),_0xdd96('0x25'),'received\x20delivery\x20report\x20from',_0x5bbce3[_0xdd96('0x36')],util[_0xdd96('0x74')](_0x3cb665[_0xdd96('0x4e')],{'showHidden':![],'depth':null}));switch(_0x5bbce3[_0xdd96('0x36')]){case'twilio':if(_0x3cb665['body']['MessageSid']&&_0x3cb665[_0xdd96('0x4e')][_0xdd96('0x75')]===_0x3dda9a[_0xdd96('0x76')]){return _0x3dda9a[_0xdd96('0x4f')]({'read':!![]});}else{logger[_0xdd96('0x21')](_0xdd96('0x77'),'status',_0xdd96('0x78'),util[_0xdd96('0x74')](_0x3cb665[_0xdd96('0x4e')],{'showHidden':![],'depth':null}));}break;case _0xdd96('0x79'):if(_0x3cb665[_0xdd96('0x4e')]['MessageUUID']&&_0x3cb665[_0xdd96('0x4e')]['MessageUUID']===_0x3dda9a[_0xdd96('0x76')]&&_[_0xdd96('0x7a')]([_0xdd96('0x7b'),'delivered'],_0x3cb665[_0xdd96('0x4e')][_0xdd96('0x7c')])>=0x0){return _0x3dda9a[_0xdd96('0x4f')]({'read':!![]});}else{logger['error'](_0xdd96('0x77'),_0xdd96('0x25'),_0xdd96('0x7d'),util[_0xdd96('0x74')](_0x3cb665[_0xdd96('0x4e')],{'showHidden':![],'depth':null}));}break;case _0xdd96('0x7e'):var _0xd8fdc9=_0x3cb665[_0xdd96('0x4e')][_0xdd96('0x7f')][0x0];if(_0xd8fdc9[_0xdd96('0x25')][_0xdd96('0x80')]===_0xdd96('0x81')){return _0x3dda9a[_0xdd96('0x4f')]({'read':!![]});}else{logger[_0xdd96('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdd96('0x25'),'infobip',util[_0xdd96('0x74')](_0x3cb665['body'],{'showHidden':![],'depth':null}));}break;}return _0x3dda9a;}})['then'](respondWithResult(_0x94bdd7,null))[_0xdd96('0x49')](handleError(_0x94bdd7,null));}; \ No newline at end of file +var _0x0e7f=['include','rows','show','find','create','body','destroy','params','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','SmsInteraction','SmsInteractionId','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','acceptmessage','reject','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./smsMessage.socket','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll'];(function(_0x28b227,_0x2ec02e){var _0x132168=function(_0x19ac3a){while(--_0x19ac3a){_0x28b227['push'](_0x28b227['shift']());}};_0x132168(++_0x2ec02e);}(_0x0e7f,0x144));var _0xf0e7=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x0e7f[_0x34aec4];return _0x51e1a7;};'use strict';var pdf=require(_0xf0e7('0x0'));var emlformat=require(_0xf0e7('0x1'));var rimraf=require(_0xf0e7('0x2'));var zipdir=require(_0xf0e7('0x3'));var jsonpatch=require(_0xf0e7('0x4'));var rp=require(_0xf0e7('0x5'));var moment=require(_0xf0e7('0x6'));var BPromise=require(_0xf0e7('0x7'));var Mustache=require(_0xf0e7('0x8'));var util=require(_0xf0e7('0x9'));var path=require(_0xf0e7('0xa'));var sox=require(_0xf0e7('0xb'));var csv=require(_0xf0e7('0xc'));var ejs=require(_0xf0e7('0xd'));var fs=require('fs');var _=require(_0xf0e7('0xe'));var squel=require('squel');var crypto=require(_0xf0e7('0xf'));var jsforce=require(_0xf0e7('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf0e7('0xc'));var querystring=require('querystring');var Papa=require(_0xf0e7('0x11'));var Redis=require(_0xf0e7('0x12'));var authService=require(_0xf0e7('0x13'));var qs=require(_0xf0e7('0x14'));var as=require(_0xf0e7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0e7('0x16'))(_0xf0e7('0x17'));var utils=require(_0xf0e7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf0e7('0x19'));var db=require(_0xf0e7('0x1a'))['db'];config[_0xf0e7('0x1b')]=_[_0xf0e7('0x1c')](config[_0xf0e7('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf0e7('0x1b')]));require(_0xf0e7('0x1d'))['register'](socket);var jayson=require(_0xf0e7('0x1e'));var client=jayson[_0xf0e7('0x1f')][_0xf0e7('0x20')]({'port':0x232c});var client9002=jayson[_0xf0e7('0x1f')][_0xf0e7('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x294239,_0x44f540,_0x328b2d,_0x6e1e55){return new BPromise(function(_0x5707a1,_0xc47b3a){var _0x581e8a=_0x6e1e55||client;return _0x581e8a['request'](_0x294239,_0x328b2d)[_0xf0e7('0x21')](function(_0x49394c){logger[_0xf0e7('0x22')]('SmsMessage,\x20%s,\x20%s',_0x44f540,_0xf0e7('0x23'));logger[_0xf0e7('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x44f540,_0xf0e7('0x23'),JSON['stringify'](_0x49394c));if(_0x49394c[_0xf0e7('0x25')]){if(_0x49394c[_0xf0e7('0x25')][_0xf0e7('0x26')]===0x1f4){logger['error'](_0xf0e7('0x27'),_0x44f540,_0x49394c[_0xf0e7('0x25')][_0xf0e7('0x28')]);return _0xc47b3a(_0x49394c[_0xf0e7('0x25')][_0xf0e7('0x28')]);}logger[_0xf0e7('0x25')](_0xf0e7('0x27'),_0x44f540,_0x49394c[_0xf0e7('0x25')][_0xf0e7('0x28')]);return _0x5707a1(_0x49394c[_0xf0e7('0x25')][_0xf0e7('0x28')]);}else{logger[_0xf0e7('0x22')](_0xf0e7('0x27'),_0x44f540,_0xf0e7('0x23'));_0x5707a1(_0x49394c[_0xf0e7('0x29')][_0xf0e7('0x28')]);}})[_0xf0e7('0x2a')](function(_0x199c84){logger[_0xf0e7('0x25')](_0xf0e7('0x27'),_0x44f540,_0x199c84);_0xc47b3a(_0x199c84);});});}function respondWithStatusCode(_0x4744d0,_0x5d666b){_0x5d666b=_0x5d666b||0xcc;return function(_0xa92945){if(_0xa92945){return _0x4744d0['sendStatus'](_0x5d666b);}return _0x4744d0[_0xf0e7('0x2b')](_0x5d666b)[_0xf0e7('0x2c')]();};}function respondWithResult(_0x3da5eb,_0x4364dc){_0x4364dc=_0x4364dc||0xc8;return function(_0x183b65){if(_0x183b65){return _0x3da5eb['status'](_0x4364dc)[_0xf0e7('0x2d')](_0x183b65);}};}function respondWithFilteredResult(_0x483d9f,_0x3ae935){return function(_0xca0fa9){if(_0xca0fa9){var _0x1083bd=_0xca0fa9[_0xf0e7('0x2e')],_0x37a2b2=_0x3ae935[_0xf0e7('0x2f')],_0xd765c4=_0x3ae935[_0xf0e7('0x2f')]+_0x3ae935[_0xf0e7('0x30')],_0x1512e5;if(_0xd765c4>=_0x1083bd){_0xd765c4=_0x1083bd;_0x1512e5=0xc8;}else{_0x1512e5=0xce;}_0x483d9f[_0xf0e7('0x2b')](_0x1512e5);return _0x483d9f[_0xf0e7('0x31')](_0xf0e7('0x32'),_0x37a2b2+'-'+_0xd765c4+'/'+_0x1083bd)[_0xf0e7('0x2d')](_0xca0fa9);}return null;};}function patchUpdates(_0x152b30){return function(_0x13bd18){try{jsonpatch[_0xf0e7('0x33')](_0x13bd18,_0x152b30,!![]);}catch(_0x3a3252){return BPromise['reject'](_0x3a3252);}return _0x13bd18[_0xf0e7('0x34')]();};}function saveUpdates(_0x34c64f,_0x53faf0){return function(_0x38921d){if(_0x38921d){return _0x38921d[_0xf0e7('0x35')](_0x34c64f)[_0xf0e7('0x21')](function(_0x1bebcd){return _0x1bebcd;});}return null;};}function removeEntity(_0x58d330,_0x52cbd1){return function(_0x1ed3f1){if(_0x1ed3f1){return _0x1ed3f1['destroy']()[_0xf0e7('0x21')](function(){_0x58d330[_0xf0e7('0x2b')](0xcc)[_0xf0e7('0x2c')]();});}};}function handleEntityNotFound(_0x1b7642,_0x11b7b2){return function(_0x4eb5a9){if(!_0x4eb5a9){_0x1b7642['sendStatus'](0x194);}return _0x4eb5a9;};}function handleError(_0x4e98cc,_0x30bbca){_0x30bbca=_0x30bbca||0x1f4;return function(_0x28e20e){logger[_0xf0e7('0x25')](_0x28e20e[_0xf0e7('0x36')]);if(_0x28e20e[_0xf0e7('0x37')]){delete _0x28e20e[_0xf0e7('0x37')];}_0x4e98cc[_0xf0e7('0x2b')](_0x30bbca)['send'](_0x28e20e);};}exports[_0xf0e7('0x38')]=function(_0x13af6a,_0x44f64d){var _0x5b2caf={},_0x399993={},_0x26b6d={'count':0x0,'rows':[]};var _0x3a83d3=_[_0xf0e7('0x39')](db[_0xf0e7('0x3a')][_0xf0e7('0x3b')],function(_0x5b6909){return{'name':_0x5b6909[_0xf0e7('0x3c')],'type':_0x5b6909[_0xf0e7('0x3d')][_0xf0e7('0x3e')]};});_0x399993[_0xf0e7('0x3f')]=_[_0xf0e7('0x39')](_0x3a83d3,_0xf0e7('0x37'));_0x399993[_0xf0e7('0x40')]=_[_0xf0e7('0x41')](_0x13af6a['query']);_0x399993['filters']=_[_0xf0e7('0x42')](_0x399993[_0xf0e7('0x3f')],_0x399993['query']);_0x5b2caf[_0xf0e7('0x43')]=_[_0xf0e7('0x42')](_0x399993[_0xf0e7('0x3f')],qs[_0xf0e7('0x44')](_0x13af6a[_0xf0e7('0x40')][_0xf0e7('0x44')]));_0x5b2caf[_0xf0e7('0x43')]=_0x5b2caf[_0xf0e7('0x43')][_0xf0e7('0x45')]?_0x5b2caf[_0xf0e7('0x43')]:_0x399993[_0xf0e7('0x3f')];if(!_0x13af6a[_0xf0e7('0x40')][_0xf0e7('0x46')](_0xf0e7('0x47'))){_0x5b2caf[_0xf0e7('0x30')]=qs['limit'](_0x13af6a[_0xf0e7('0x40')][_0xf0e7('0x30')]);_0x5b2caf[_0xf0e7('0x2f')]=qs[_0xf0e7('0x2f')](_0x13af6a[_0xf0e7('0x40')][_0xf0e7('0x2f')]);}_0x5b2caf[_0xf0e7('0x48')]=qs['sort'](_0x13af6a[_0xf0e7('0x40')][_0xf0e7('0x49')]);_0x5b2caf['where']=qs[_0xf0e7('0x4a')](_[_0xf0e7('0x4b')](_0x13af6a[_0xf0e7('0x40')],_0x399993[_0xf0e7('0x4a')]),_0x3a83d3);if(_0x13af6a['query'][_0xf0e7('0x4c')]){_0x5b2caf['where']=_['merge'](_0x5b2caf[_0xf0e7('0x4d')],{'$or':_[_0xf0e7('0x39')](_0x3a83d3,function(_0x54df51){if(_0x54df51[_0xf0e7('0x3d')]!=='VIRTUAL'){var _0x5d5a41={};_0x5d5a41[_0x54df51['name']]={'$like':'%'+_0x13af6a['query'][_0xf0e7('0x4c')]+'%'};return _0x5d5a41;}})});}_0x5b2caf=_[_0xf0e7('0x4e')]({},_0x5b2caf,_0x13af6a[_0xf0e7('0x4f')]);var _0x1b8f43={'where':_0x5b2caf[_0xf0e7('0x4d')]};return db[_0xf0e7('0x3a')]['count'](_0x1b8f43)[_0xf0e7('0x21')](function(_0x2784e5){_0x26b6d['count']=_0x2784e5;if(_0x13af6a[_0xf0e7('0x40')][_0xf0e7('0x50')]){_0x5b2caf[_0xf0e7('0x51')]=[{'all':!![]}];}return db[_0xf0e7('0x3a')]['findAll'](_0x5b2caf);})['then'](function(_0x346269){_0x26b6d[_0xf0e7('0x52')]=_0x346269;return _0x26b6d;})[_0xf0e7('0x21')](respondWithFilteredResult(_0x44f64d,_0x5b2caf))['catch'](handleError(_0x44f64d,null));};exports[_0xf0e7('0x53')]=function(_0x40a26f,_0x456696){var _0x5c2de6={'raw':!![],'where':{'id':_0x40a26f['params']['id']}},_0x388a32={};_0x388a32['model']=_['keys'](db['SmsMessage']['rawAttributes']);_0x388a32[_0xf0e7('0x40')]=_[_0xf0e7('0x41')](_0x40a26f[_0xf0e7('0x40')]);_0x388a32[_0xf0e7('0x4a')]=_['intersection'](_0x388a32[_0xf0e7('0x3f')],_0x388a32['query']);_0x5c2de6['attributes']=_[_0xf0e7('0x42')](_0x388a32[_0xf0e7('0x3f')],qs[_0xf0e7('0x44')](_0x40a26f[_0xf0e7('0x40')][_0xf0e7('0x44')]));_0x5c2de6['attributes']=_0x5c2de6['attributes'][_0xf0e7('0x45')]?_0x5c2de6[_0xf0e7('0x43')]:_0x388a32[_0xf0e7('0x3f')];if(_0x40a26f[_0xf0e7('0x40')][_0xf0e7('0x50')]){_0x5c2de6[_0xf0e7('0x51')]=[{'all':!![]}];}_0x5c2de6=_[_0xf0e7('0x4e')]({},_0x5c2de6,_0x40a26f['options']);return db[_0xf0e7('0x3a')][_0xf0e7('0x54')](_0x5c2de6)[_0xf0e7('0x21')](handleEntityNotFound(_0x456696,null))[_0xf0e7('0x21')](respondWithResult(_0x456696,null))[_0xf0e7('0x2a')](handleError(_0x456696,null));};exports[_0xf0e7('0x55')]=function(_0x366adc,_0x33e29e){return db[_0xf0e7('0x3a')][_0xf0e7('0x55')](_0x366adc['body'],{})[_0xf0e7('0x21')](respondWithResult(_0x33e29e,0xc9))[_0xf0e7('0x2a')](handleError(_0x33e29e,null));};exports[_0xf0e7('0x35')]=function(_0x2035a0,_0x4e62df){if(_0x2035a0['body']['id']){delete _0x2035a0[_0xf0e7('0x56')]['id'];}return db['SmsMessage'][_0xf0e7('0x54')]({'where':{'id':_0x2035a0['params']['id']}})[_0xf0e7('0x21')](handleEntityNotFound(_0x4e62df,null))[_0xf0e7('0x21')](saveUpdates(_0x2035a0[_0xf0e7('0x56')],null))[_0xf0e7('0x21')](respondWithResult(_0x4e62df,null))[_0xf0e7('0x2a')](handleError(_0x4e62df,null));};exports[_0xf0e7('0x57')]=function(_0xa5aba1,_0x476f92){return db[_0xf0e7('0x3a')][_0xf0e7('0x54')]({'where':{'id':_0xa5aba1[_0xf0e7('0x58')]['id']}})['then'](handleEntityNotFound(_0x476f92,null))[_0xf0e7('0x21')](removeEntity(_0x476f92,null))['catch'](handleError(_0x476f92,null));};exports[_0xf0e7('0x59')]=function(_0x59c4b0,_0x2381e8){return db[_0xf0e7('0x3a')]['describe']()[_0xf0e7('0x21')](respondWithResult(_0x2381e8,null))[_0xf0e7('0x2a')](handleError(_0x2381e8,null));};var interaction_log=require(_0xf0e7('0x16'))(_0xf0e7('0x5a'));exports['accept']=function(_0x1dc726,_0x46642b,_0x21be27){var _0x2cddb9={'channel':_0xf0e7('0x5b')};if(_0x1dc726['body']['id']){delete _0x1dc726[_0xf0e7('0x56')]['id'];}_0x1dc726[_0xf0e7('0x56')][_0xf0e7('0x5c')]=!![];_0x1dc726[_0xf0e7('0x56')][_0xf0e7('0x5d')]=moment()[_0xf0e7('0x5e')](_0xf0e7('0x5f'));_0x1dc726[_0xf0e7('0x56')][_0xf0e7('0x60')]=_0x1dc726[_0xf0e7('0x56')][_0xf0e7('0x60')]||_0x1dc726[_0xf0e7('0x61')]['id'];return db[_0xf0e7('0x3a')][_0xf0e7('0x54')]({'where':{'id':_0x1dc726['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xf0e7('0x21')](handleEntityNotFound(_0x46642b,null))[_0xf0e7('0x21')](saveUpdates(_0x1dc726[_0xf0e7('0x56')],null))[_0xf0e7('0x21')](function(_0x29dd45){if(_0x29dd45){_0x2cddb9[_0xf0e7('0x28')]=_0x29dd45['get']({'plain':!![]});return db[_0xf0e7('0x62')][_0xf0e7('0x54')]({'where':{'id':_0x29dd45[_0xf0e7('0x63')]}});}return null;})[_0xf0e7('0x21')](handleEntityNotFound(_0x46642b,null))[_0xf0e7('0x21')](function(_0x1d467e){if(_0x1d467e){return _0x1d467e['update']({'UserId':_0x1dc726[_0xf0e7('0x56')]['UserId'],'read1stAt':_['isNil'](_0x1d467e['read1stAt'])?moment()[_0xf0e7('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf0e7('0x21')](function(_0x48a93b){if(_0x48a93b){_0x2cddb9[_0xf0e7('0x64')]=_0x48a93b[_0xf0e7('0x65')]({'plain':!![]});interaction_log['info'](_0xf0e7('0x66'),_0x1dc726[_0xf0e7('0x61')]['id'],_0x1dc726[_0xf0e7('0x61')]['name'],_0x1dc726['user']['role'],_0x2cddb9['interaction']['id'],_0x1dc726[_0xf0e7('0x56')]?JSON[_0xf0e7('0x67')](_0x1dc726['body']):_0xf0e7('0x68'));return respondWithRpcPromise(_0xf0e7('0x69'),_0xf0e7('0x6a'),_0x2cddb9);}return null;})[_0xf0e7('0x21')](function(_0x32f344){if(_0x32f344){if(_0x1dc726[_0xf0e7('0x56')][_0xf0e7('0x6b')]){_0x2cddb9[_0xf0e7('0x28')][_0xf0e7('0x6c')]=util[_0xf0e7('0x5e')]('SIP/%s',_0x1dc726[_0xf0e7('0x61')][_0xf0e7('0x37')]);_0x2cddb9['message'][_0xf0e7('0x6d')]=_0x2cddb9[_0xf0e7('0x6d')];_0x2cddb9[_0xf0e7('0x28')]['event']='accept';return respondWithRpcPromise('EventManager',_0xf0e7('0x6e'),{'event':_0xf0e7('0x6f'),'message':_0x2cddb9['message']},client9002)[_0xf0e7('0x21')](function(){return _0x2cddb9;});}return _0x2cddb9;}return null;})[_0xf0e7('0x21')](respondWithResult(_0x46642b,null))[_0xf0e7('0x2a')](handleError(_0x46642b,null));};var interaction_log=require(_0xf0e7('0x16'))('sms-interactions');exports[_0xf0e7('0x70')]=function(_0x754b2e,_0x2f7a14,_0x597a9b){var _0x66efe={'agent':{},'channel':_0xf0e7('0x5b')};if(_0x754b2e[_0xf0e7('0x56')]['id']){delete _0x754b2e['body']['id'];}_0x754b2e[_0xf0e7('0x56')]['UserId']=_0x754b2e[_0xf0e7('0x56')]['UserId']||_0x754b2e[_0xf0e7('0x61')]['id'];_0x66efe[_0xf0e7('0x71')]['id']=_0x754b2e['body'][_0xf0e7('0x60')];return db['SmsMessage'][_0xf0e7('0x54')]({'where':{'id':_0x754b2e[_0xf0e7('0x58')]['id'],'UserId':null}})[_0xf0e7('0x21')](handleEntityNotFound(_0x2f7a14,null))[_0xf0e7('0x21')](function(_0x5aca17){if(_0x5aca17){_0x66efe[_0xf0e7('0x28')]=_0x5aca17[_0xf0e7('0x65')]({'plain':!![]});return db[_0xf0e7('0x62')]['find']({'where':{'id':_0x5aca17['SmsInteractionId']}});}return null;})[_0xf0e7('0x21')](handleEntityNotFound(_0x2f7a14,null))[_0xf0e7('0x21')](function(_0x40592c){if(_0x40592c){_0x66efe[_0xf0e7('0x64')]=_0x40592c['get']({'plain':!![]});interaction_log[_0xf0e7('0x22')](_0xf0e7('0x72'),_0x754b2e['user']['id'],_0x754b2e[_0xf0e7('0x61')][_0xf0e7('0x37')],_0x754b2e[_0xf0e7('0x61')][_0xf0e7('0x73')],_0x66efe[_0xf0e7('0x64')]['id'],_0x754b2e[_0xf0e7('0x56')]?JSON[_0xf0e7('0x67')](_0x754b2e['body']):'null');return respondWithRpcPromise(_0xf0e7('0x74'),'rejectMessage',_0x66efe);}return null;})['then'](function(_0xe0b574){if(_0xe0b574){_0xe0b574['message']['interface']=util[_0xf0e7('0x5e')]('SIP/%s',_0x754b2e[_0xf0e7('0x61')][_0xf0e7('0x37')]);_0xe0b574[_0xf0e7('0x28')][_0xf0e7('0x6d')]=_0x66efe['channel'];_0xe0b574[_0xf0e7('0x28')]['event']=_0xf0e7('0x70');respondWithRpcPromise(_0xf0e7('0x6e'),'EventManager',{'event':'rejectmessage','message':_0xe0b574['message']},client9002);return _0x66efe;}return null;})['then'](respondWithResult(_0x2f7a14,null))[_0xf0e7('0x2a')](handleError(_0x2f7a14,null));};exports[_0xf0e7('0x2b')]=function(_0x2478ad,_0x18d08e,_0xfb59fc){if(_0x2478ad[_0xf0e7('0x56')]['id']){delete _0x2478ad[_0xf0e7('0x56')]['id'];}var _0x53ee16;return db[_0xf0e7('0x3a')][_0xf0e7('0x54')]({'where':{'id':_0x2478ad['params']['id']}})[_0xf0e7('0x21')](handleEntityNotFound(_0x18d08e,null))[_0xf0e7('0x21')](function(_0x3ddb99){if(_0x3ddb99){_0x53ee16=_0x3ddb99;return db['SmsAccount'][_0xf0e7('0x54')]({'where':{'id':_0x3ddb99[_0xf0e7('0x75')]}});}})[_0xf0e7('0x21')](handleEntityNotFound(_0x18d08e,null))[_0xf0e7('0x21')](function(_0x5f3932){if(_0x5f3932){logger[_0xf0e7('0x24')](_0xf0e7('0x76'),_0xf0e7('0x2b'),_0xf0e7('0x77'),_0x5f3932[_0xf0e7('0x3d')],util[_0xf0e7('0x78')](_0x2478ad['body'],{'showHidden':![],'depth':null}));switch(_0x5f3932['type']){case _0xf0e7('0x79'):if(_0x2478ad['body'][_0xf0e7('0x7a')]&&_0x2478ad[_0xf0e7('0x56')]['MessageSid']===_0x53ee16['messageId']){return _0x53ee16['update']({'read':!![]});}else{logger[_0xf0e7('0x25')](_0xf0e7('0x7b'),'status',_0xf0e7('0x79'),util[_0xf0e7('0x78')](_0x2478ad['body'],{'showHidden':![],'depth':null}));}break;case _0xf0e7('0x7c'):if(_0x2478ad['body']['MessageUUID']&&_0x2478ad[_0xf0e7('0x56')][_0xf0e7('0x7d')]===_0x53ee16[_0xf0e7('0x7e')]&&_[_0xf0e7('0x7f')]([_0xf0e7('0x80'),_0xf0e7('0x81')],_0x2478ad[_0xf0e7('0x56')][_0xf0e7('0x82')])>=0x0){return _0x53ee16[_0xf0e7('0x35')]({'read':!![]});}else{logger[_0xf0e7('0x25')](_0xf0e7('0x7b'),_0xf0e7('0x2b'),_0xf0e7('0x83'),util[_0xf0e7('0x78')](_0x2478ad[_0xf0e7('0x56')],{'showHidden':![],'depth':null}));}break;case _0xf0e7('0x84'):var _0x371528=_0x2478ad['body']['results'][0x0];if(_0x371528['status'][_0xf0e7('0x85')]===_0xf0e7('0x86')){return _0x53ee16['update']({'read':!![]});}else{logger[_0xf0e7('0x25')](_0xf0e7('0x7b'),_0xf0e7('0x2b'),_0xf0e7('0x84'),util[_0xf0e7('0x78')](_0x2478ad[_0xf0e7('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x53ee16;}})['then'](respondWithResult(_0x18d08e,null))[_0xf0e7('0x2a')](handleError(_0x18d08e,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d003ad5..4e72132 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 _0xc9a9=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1691c9,_0x109408){var _0x4d701a=function(_0x556f42){while(--_0x556f42){_0x1691c9['push'](_0x1691c9['shift']());}};_0x4d701a(++_0x109408);}(_0xc9a9,0x64));var _0x9c9a=function(_0x65e6a4,_0x47699f){_0x65e6a4=_0x65e6a4-0x0;var _0x15c2d1=_0xc9a9[_0x65e6a4];return _0x15c2d1;};'use strict';var EventEmitter=require(_0x9c9a('0x0'));var SmsMessage=require(_0x9c9a('0x1'))['db'][_0x9c9a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x9c9a('0x3')](0x0);var events={'afterCreate':_0x9c9a('0x4'),'afterUpdate':_0x9c9a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2d757e){return function(_0x1a12d5,_0x5e151a,_0x1957e4){SmsMessageEvents[_0x9c9a('0x6')](_0x2d757e+':'+_0x1a12d5['id'],_0x1a12d5);SmsMessageEvents['emit'](_0x2d757e,_0x1a12d5);_0x1957e4(null);};}for(var e in events){if(events[_0x9c9a('0x7')](e)){var event=events[e];SmsMessage[_0x9c9a('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x70fe=['remove','emit','hasOwnProperty','hook','exports','events','save','update'];(function(_0x434e3b,_0x2e3fe6){var _0x1da4cf=function(_0x48782c){while(--_0x48782c){_0x434e3b['push'](_0x434e3b['shift']());}};_0x1da4cf(++_0x2e3fe6);}(_0x70fe,0x1a5));var _0xe70f=function(_0x2b3df1,_0x38cc6a){_0x2b3df1=_0x2b3df1-0x0;var _0x2d6b7e=_0x70fe[_0x2b3df1];return _0x2d6b7e;};'use strict';var EventEmitter=require(_0xe70f('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe70f('0x1'),'afterUpdate':_0xe70f('0x2'),'afterDestroy':_0xe70f('0x3')};function emitEvent(_0x43559d){return function(_0x5761a5,_0x3cda43,_0x39834e){SmsMessageEvents['emit'](_0x43559d+':'+_0x5761a5['id'],_0x5761a5);SmsMessageEvents[_0xe70f('0x4')](_0x43559d,_0x5761a5);_0x39834e(null);};}for(var e in events){if(events[_0xe70f('0x5')](e)){var event=events[e];SmsMessage[_0xe70f('0x6')](e,emitEvent(event));}}module[_0xe70f('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ca8a9a8..9c8647b 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 _0xeaf7=['skebby','username','password','smsMethod','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','read','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/v2/send/','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','senderString','format','%s:%s','Basic\x20%s','base64','http_code','data','head','message_id','clickSend','plivo','authId','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messageId','csc','crypto','sender','text','timestamp','keys','sort','apiKey','md5','digest','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','SmsInteraction','findOne','SmsInteractionId','then','update','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0xeaf7,0xbe));var _0x7eaf=function(_0x58df71,_0x3bc978){_0x58df71=_0x58df71-0x0;var _0x1845d2=_0xeaf7[_0x58df71];return _0x1845d2;};'use strict';var _=require(_0x7eaf('0x0'));var util=require('util');var logger=require(_0x7eaf('0x1'))(_0x7eaf('0x2'));var moment=require('moment');var BPromise=require(_0x7eaf('0x3'));var rp=require(_0x7eaf('0x4'));var fs=require('fs');var path=require(_0x7eaf('0x5'));var rimraf=require(_0x7eaf('0x6'));var config=require(_0x7eaf('0x7'));var attributes=require(_0x7eaf('0x8'));module[_0x7eaf('0x9')]=function(_0x3b3ae8,_0x559d56){return _0x3b3ae8[_0x7eaf('0xa')](_0x7eaf('0xb'),attributes,{'tableName':_0x7eaf('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x7eaf('0xd'),'fields':[_0x7eaf('0xe')],'type':_0x7eaf('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3c8daa,_0x4d2300,_0x240a48){var _0x4912e4=_0x3b3ae8[_0x7eaf('0x10')];var _0x141d32=_0x3c8daa[_0x7eaf('0x11')]({'plain':!![]});if(_0x141d32[_0x7eaf('0x12')][_0x7eaf('0x13')]()==='in'||_0x141d32[_0x7eaf('0x12')][_0x7eaf('0x13')]()===_0x7eaf('0x14')&&!_0x141d32[_0x7eaf('0x15')]&&!_['isNil'](_0x141d32[_0x7eaf('0x16')])){_0x4912e4[_0x7eaf('0x17')][_0x7eaf('0x18')]({'where':{'id':_0x141d32[_0x7eaf('0x19')]}})[_0x7eaf('0x1a')](function(_0x4a0584){if(_0x4a0584){_0x4a0584[_0x7eaf('0x1b')]({'lastMsgAt':_0x141d32['createdAt'],'lastMsgDirection':_0x141d32[_0x7eaf('0x12')][_0x7eaf('0x13')]()});}})[_0x7eaf('0x1c')](function(_0x4721c7){console['error'](_0x4721c7);});}if(_0x141d32[_0x7eaf('0x12')]==='out'&&!_0x141d32['secret']){var _0x3a2d29;_0x4912e4[_0x7eaf('0x1d')][_0x7eaf('0x1e')]({'where':{'id':_0x141d32[_0x7eaf('0x1f')]},'raw':!![]})[_0x7eaf('0x1a')](function(_0x19c208){_0x3a2d29=_0x19c208;if(_0x3a2d29&&_0x3a2d29[_0x7eaf('0x20')]){switch(_0x3a2d29[_0x7eaf('0x20')]){case _0x7eaf('0x21'):var _0x3bb907=require('twilio');if(_0x3a2d29[_0x7eaf('0x22')]&&_0x3a2d29[_0x7eaf('0x23')]&&_0x3a2d29[_0x7eaf('0x24')]){var _0x565e8d=new _0x3bb907(_0x3a2d29[_0x7eaf('0x22')],_0x3a2d29['authToken']);_0x565e8d[_0x7eaf('0x25')][_0x7eaf('0x26')]({'body':_0x141d32['body'],'to':_0x141d32[_0x7eaf('0x24')],'from':_0x3a2d29['phone'],'statusCallback':_0x3a2d29[_0x7eaf('0x27')]+_0x7eaf('0x28')+_0x141d32['id']+_0x7eaf('0x29')+_0x3a2d29[_0x7eaf('0x2a')]})[_0x7eaf('0x1a')](function(_0x3c0c37){if(_0x3c0c37['sid']){return _0x3c8daa[_0x7eaf('0x1b')]({'messageId':_0x3c0c37[_0x7eaf('0x2b')]});}})[_0x7eaf('0x1c')](function(_0x1896be){logger[_0x7eaf('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7eaf('0x2d'),_0x7eaf('0x21'),util[_0x7eaf('0x2e')](_0x1896be,{'showHidden':![],'depth':null}));});}else{logger[_0x7eaf('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7eaf('0x2d'),_0x7eaf('0x21'),_0x7eaf('0x2f'));}break;case _0x7eaf('0x30'):var _0x44a59d='https://api.skebby.it/API/v1.0/REST/';if(_0x3a2d29[_0x7eaf('0x31')]&&_0x3a2d29[_0x7eaf('0x32')]){var _0x5ea6ed={'recipient':[_0x141d32[_0x7eaf('0x24')]],'message':_0x141d32['body'],'message_type':_0x3a2d29[_0x7eaf('0x33')]};if(_0x3a2d29[_0x7eaf('0x33')]&&_0x3a2d29[_0x7eaf('0x33')]!=='SI'){_0x5ea6ed['sender']=_0x3a2d29[_0x7eaf('0x24')];}var _0x54d9cb={'url':_0x44a59d+'login?username='+_0x3a2d29['username']+_0x7eaf('0x34')+_0x3a2d29[_0x7eaf('0x32')],'method':_0x7eaf('0x35')};rp(_0x54d9cb)[_0x7eaf('0x1a')](function(_0x43aba6){var _0x446122=_0x43aba6['split'](';');var _0x51b99c={'user_key':_0x446122[0x0],'session_key':_0x446122[0x1]};_0x54d9cb={'url':_0x44a59d+_0x7eaf('0x36'),'method':_0x7eaf('0x37'),'headers':{'user_key':_0x51b99c[_0x7eaf('0x38')],'Session_key':_0x51b99c[_0x7eaf('0x39')]},'json':!![],'body':_0x5ea6ed};return rp(_0x54d9cb);})['then'](function(_0x2874de){if(_0x2874de[_0x7eaf('0x3a')]>=0x1){var _0xd15a2d={'messageId':_0x2874de[_0x7eaf('0x3b')]};if(_0x3a2d29['smsMethod']!=='GP'||!_0x3a2d29['deliveryReport']){_0xd15a2d[_0x7eaf('0x3c')]=!![];}return _0x3c8daa[_0x7eaf('0x1b')](_0xd15a2d);}else{return logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),_0x7eaf('0x2d'),_0x7eaf('0x30'),util[_0x7eaf('0x2e')](_0x2874de,{'showHidden':![],'depth':null}));}})[_0x7eaf('0x1c')](function(_0x777af3){return logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),_0x7eaf('0x2d'),_0x7eaf('0x30'),util[_0x7eaf('0x2e')](_0x777af3,{'showHidden':![],'depth':null}));});}else{logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),_0x7eaf('0x2d'),_0x7eaf('0x30'),_0x7eaf('0x3e'));}break;case _0x7eaf('0x3f'):if(_0x3a2d29[_0x7eaf('0x23')]){var _0x4ad1b6={'recipient':_0x141d32[_0x7eaf('0x24')],'message':_0x141d32['body'],'sender':_0x3a2d29['senderString']||_0x3a2d29['phone'],'authorization':_0x3a2d29[_0x7eaf('0x23')]};var _0x4d2300={'method':'POST','uri':_0x7eaf('0x40'),'body':_0x4ad1b6,'json':!![]};rp(_0x4d2300)[_0x7eaf('0x1a')](function(_0x42d64a){var _0x7cafe1={'messageId':_0x42d64a['requestid']};if(!_0x3a2d29[_0x7eaf('0x41')]){_0x7cafe1[_0x7eaf('0x3c')]=!![];}return _0x3c8daa[_0x7eaf('0x1b')](_0x7cafe1);})[_0x7eaf('0x1c')](function(_0x57f4e0){logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),_0x7eaf('0x2d'),_0x7eaf('0x3f'),util['inspect'](_0x57f4e0,{'showHidden':![],'depth':null}));});}else{logger[_0x7eaf('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7eaf('0x2d'),_0x7eaf('0x3f'),_0x7eaf('0x42'));}break;case _0x7eaf('0x43'):if(_0x3a2d29[_0x7eaf('0x31')]&&_0x3a2d29[_0x7eaf('0x32')]){var _0x4ad1b6={'messages':[{'source':'xCALLY\x20Motion','to':_0x141d32[_0x7eaf('0x24')],'body':_0x141d32['body'],'from':_0x3a2d29[_0x7eaf('0x44')]||_0x3a2d29[_0x7eaf('0x24')]}]};var _0x5105cc=util[_0x7eaf('0x45')](_0x7eaf('0x46'),_0x3a2d29[_0x7eaf('0x31')],_0x3a2d29['password']);var _0x4d2300={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4ad1b6,'headers':{'Authorization':util[_0x7eaf('0x45')](_0x7eaf('0x47'),new Buffer(_0x5105cc)['toString'](_0x7eaf('0x48')))},'json':!![]};rp(_0x4d2300)[_0x7eaf('0x1a')](function(_0x5588b5){if(_0x5588b5['http_code']>=0xc8&&_0x5588b5[_0x7eaf('0x49')]<=0xce){if(_0x5588b5['data']&&_0x5588b5[_0x7eaf('0x4a')]['queued_count']>0x0){var _0x1b6a64=_[_0x7eaf('0x4b')](_0x5588b5[_0x7eaf('0x4a')][_0x7eaf('0x25')]);var _0x15df3c={'messageId':_0x1b6a64[_0x7eaf('0x4c')]};if(!_0x3a2d29[_0x7eaf('0x41')]){_0x15df3c[_0x7eaf('0x3c')]=!![];}return _0x3c8daa[_0x7eaf('0x1b')](_0x15df3c);}else{logger['error'](_0x7eaf('0x3d'),'afterCreate',_0x7eaf('0x4d'),util['inspect'](_0x5588b5,{'showHidden':![],'depth':null}));}}else{logger[_0x7eaf('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7eaf('0x2d'),_0x7eaf('0x4d'),util[_0x7eaf('0x2e')](_0x5588b5,{'showHidden':![],'depth':null}));}})[_0x7eaf('0x1c')](function(_0x52498e){logger[_0x7eaf('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',util[_0x7eaf('0x2e')](_0x52498e,{'showHidden':![],'depth':null}));});}else{logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),'afterCreate',_0x7eaf('0x4d'),_0x7eaf('0x3e'));}break;case _0x7eaf('0x4e'):if(_0x3a2d29[_0x7eaf('0x4f')]&&_0x3a2d29[_0x7eaf('0x23')]){var _0x4ad1b6={'dst':_0x141d32[_0x7eaf('0x24')],'text':_0x141d32[_0x7eaf('0xe')],'src':_0x3a2d29[_0x7eaf('0x44')]||_0x3a2d29['phone'],'url':_0x3a2d29[_0x7eaf('0x27')]+_0x7eaf('0x28')+_0x141d32['id']+'/status?token='+_0x3a2d29[_0x7eaf('0x2a')]};var _0x5105cc=util[_0x7eaf('0x45')](_0x7eaf('0x46'),_0x3a2d29[_0x7eaf('0x4f')],_0x3a2d29[_0x7eaf('0x23')]);var _0x4d2300={'method':_0x7eaf('0x37'),'uri':util[_0x7eaf('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3a2d29['authId']),'body':_0x4ad1b6,'headers':{'Authorization':util[_0x7eaf('0x45')](_0x7eaf('0x47'),new Buffer(_0x5105cc)[_0x7eaf('0x50')](_0x7eaf('0x48')))},'json':!![]};rp(_0x4d2300)[_0x7eaf('0x1a')](function(_0x401bff){var _0x4673e3={'messageId':_0x401bff[_0x7eaf('0x51')][0x0]};return _0x3c8daa[_0x7eaf('0x1b')](_0x4673e3);})[_0x7eaf('0x1c')](function(_0x26ff2b){logger[_0x7eaf('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7eaf('0x4e'),util[_0x7eaf('0x2e')](_0x26ff2b,{'showHidden':![],'depth':null}));});}else{logger[_0x7eaf('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7eaf('0x2d'),_0x7eaf('0x4e'),_0x7eaf('0x52'));}break;case _0x7eaf('0x53'):if(_0x3a2d29[_0x7eaf('0x31')]&&_0x3a2d29['password']){if(_0x3a2d29[_0x7eaf('0x54')]){var _0x612640={'method':_0x7eaf('0x37'),'uri':_0x3a2d29['baseUrl']+_0x7eaf('0x55'),'body':{'username':_0x3a2d29['username'],'password':_0x3a2d29['password']},'json':!![]};return rp(_0x612640)[_0x7eaf('0x1a')](function(_0x1bf688){var _0x461af0={'method':_0x7eaf('0x37'),'uri':_0x3a2d29[_0x7eaf('0x54')]+_0x7eaf('0x56'),'body':{'messages':[{'from':_0x3a2d29['phone'],'destinations':[{'to':_0x141d32['phone']}],'text':_0x141d32['body'],'notifyUrl':_0x3a2d29[_0x7eaf('0x27')]+_0x7eaf('0x28')+_0x141d32['id']+_0x7eaf('0x29')+_0x3a2d29['token'],'notifyContentType':_0x7eaf('0x57'),'callbackData':_0x3a2d29[_0x7eaf('0x24')]+';'+_0x141d32['body']}]},'headers':{'Authorization':_0x7eaf('0x58')+_0x1bf688[_0x7eaf('0x2a')]},'json':!![]};return rp(_0x461af0)['then'](function(_0x5bda6a){if(_0x5bda6a[_0x7eaf('0x25')]){var _0x4079fb={'messageId':_0x5bda6a['messages'][0x0][_0x7eaf('0x59')]};if(!_0x3a2d29['deliveryReport']){_0x4079fb['read']=!![];}return _0x3c8daa[_0x7eaf('0x1b')](_0x4079fb);}else{return logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),_0x7eaf('0x2d'),'infobip',util[_0x7eaf('0x2e')](_0x5bda6a,{'showHidden':![],'depth':null}));}});})[_0x7eaf('0x1c')](function(_0x1bc523){return logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),_0x7eaf('0x2d'),_0x7eaf('0x53'),util[_0x7eaf('0x2e')](_0x1bc523,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7eaf('0x3d'),_0x7eaf('0x2d'),_0x7eaf('0x53'),'Missing\x20parameters:\x20base_url');}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7eaf('0x2d'),'infobip',_0x7eaf('0x3e'));}break;case _0x7eaf('0x5a'):var _0x501c67=require(_0x7eaf('0x5b'));if(_0x3a2d29['apiKey']){var _0x3d1c9a={};_0x3d1c9a['login']=_0x3a2d29['username'];_0x3d1c9a[_0x7eaf('0x24')]=_0x141d32['phone'];_0x3d1c9a[_0x7eaf('0x5c')]=_0x3a2d29[_0x7eaf('0x24')];_0x3d1c9a[_0x7eaf('0x5d')]=_0x141d32['body'];_0x3d1c9a[_0x7eaf('0x5e')]=+new Date();var _0xf19209='';var _0x2b6ed5='';var _0x3806ac=Object[_0x7eaf('0x5f')](_0x3d1c9a);_0x3806ac[_0x7eaf('0x60')]();for(var _0x3ddede=0x0;_0x3ddede<_0x3806ac['length'];_0x3ddede++){if(_0xf19209!=''){_0xf19209+='&';}_0xf19209+=_0x3806ac[_0x3ddede]+'='+encodeURIComponent(_0x3d1c9a[_0x3806ac[_0x3ddede]]);_0x2b6ed5+=_0x3d1c9a[_0x3806ac[_0x3ddede]];}_0x2b6ed5+=_0x3a2d29[_0x7eaf('0x61')];_0x2b6ed5=_0x501c67['createHash'](_0x7eaf('0x62'))[_0x7eaf('0x1b')](_0x2b6ed5)[_0x7eaf('0x63')]('hex');if(_0xf19209!==''){_0xf19209+='&';}_0xf19209+=_0x7eaf('0x64')+_0x2b6ed5;var _0x54d9cb={'method':_0x7eaf('0x35'),'uri':_0x3a2d29[_0x7eaf('0x54')]+_0x7eaf('0x65')+_0xf19209,'json':!![]};return rp(_0x54d9cb)[_0x7eaf('0x1a')](function(_0x2206b0){var _0x17ca38=Object[_0x7eaf('0x5f')](_0x2206b0);if(_0x2206b0[_0x17ca38[0x0]]['error']&&parseInt(_0x2206b0[_0x17ca38[0x0]][_0x7eaf('0x2c')])===0x0){var _0x59526b={'messageId':_0x2206b0[_0x17ca38[0x0]][_0x7eaf('0x66')]};if(!_0x3a2d29[_0x7eaf('0x41')]){_0x59526b['read']=!![];}return _0x3c8daa[_0x7eaf('0x1b')](_0x59526b);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7eaf('0x2d'),'csc',util[_0x7eaf('0x2e')](_0x2206b0['error'],{'showHidden':![],'depth':null}));}})[_0x7eaf('0x1c')](function(_0x3d805b){return logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),'afterCreate',_0x7eaf('0x5a'),util[_0x7eaf('0x2e')](_0x3d805b,{'showHidden':![],'depth':null}));});}else{logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),_0x7eaf('0x2d'),'csc',_0x7eaf('0x67'));}break;case'clickatell':if(_0x3a2d29[_0x7eaf('0x61')]){var _0x3f719c={'method':_0x7eaf('0x37'),'uri':_0x7eaf('0x68'),'headers':{'Authorization':_0x3a2d29[_0x7eaf('0x61')]},'body':{'content':_0x141d32[_0x7eaf('0xe')],'to':[_0x141d32[_0x7eaf('0x24')]],'from':_0x3a2d29['phone'],'binary':![],'clientMessageId':_0x7eaf('0x69'),'charset':_0x7eaf('0x6a')},'json':!![]};rp(_0x3f719c)[_0x7eaf('0x1a')](function(_0x3ecb7c){if(!_0x3ecb7c[_0x7eaf('0x2c')]){var _0x2c48b0={'messageId':_0x3ecb7c[_0x7eaf('0x25')][0x0][_0x7eaf('0x6b')]};if(!_0x3a2d29[_0x7eaf('0x41')]){_0x2c48b0['read']=!![];}return _0x3c8daa[_0x7eaf('0x1b')](_0x2c48b0);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7eaf('0x2d'),_0x7eaf('0x6c'),util[_0x7eaf('0x2e')](_0x3ecb7c['error'],{'showHidden':![],'depth':null}));}})[_0x7eaf('0x1c')](function(_0xcb465c){return logger['error'](_0x7eaf('0x3d'),_0x7eaf('0x2d'),_0x7eaf('0x6c'),util[_0x7eaf('0x2e')](_0xcb465c,{'showHidden':![],'depth':null}));});}else{logger[_0x7eaf('0x2c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7eaf('0x2d'),_0x7eaf('0x6c'),_0x7eaf('0x67'));}break;case _0x7eaf('0x6d'):if(_0x3a2d29[_0x7eaf('0x61')]){var _0x3fbaea={};var _0x54d9cb={'method':_0x7eaf('0x37'),'uri':_0x7eaf('0x6e'),'headers':{'Authorization':_0x7eaf('0x6f')+_0x3a2d29['apiKey'],'Content-Type':_0x7eaf('0x57')},'body':{'from':_0x3a2d29[_0x7eaf('0x24')],'to':_0x141d32[_0x7eaf('0x24')],'text':_0x141d32[_0x7eaf('0xe')]},'json':!![]};return rp(_0x54d9cb)[_0x7eaf('0x1a')](function(_0x1e5296){if(_0x1e5296[_0x7eaf('0x70')]==0xca){_0x3fbaea[_0x7eaf('0x71')]=_0x1e5296;var _0x52af2f={'method':_0x7eaf('0x37'),'uri':_0x7eaf('0x72'),'headers':{'Authorization':'Bearer\x20'+_0x3a2d29[_0x7eaf('0x61')],'Content-Type':'application/json'},'body':{'refid':_0x3fbaea[_0x7eaf('0x71')]['refid']},'json':!![]};return rp(_0x52af2f)['then'](function(_0x371fd2){_0x3fbaea['status']=_0x371fd2;var _0x829dcb={'messageId':_0x3fbaea['message'][_0x7eaf('0x73')],'read':!![]};return _0x3c8daa[_0x7eaf('0x1b')](_0x829dcb);});}else{return logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),_0x7eaf('0x2d'),'intelepeer',util[_0x7eaf('0x2e')](_0x1e5296,{'showHidden':![],'depth':null}));}})[_0x7eaf('0x1c')](function(_0x4e18a4){return logger['error'](_0x7eaf('0x3d'),_0x7eaf('0x2d'),'intelepeer',util[_0x7eaf('0x2e')](_0x4e18a4,{'showHidden':![],'depth':null}));});}else{return logger[_0x7eaf('0x2c')](_0x7eaf('0x3d'),_0x7eaf('0x2d'),_0x7eaf('0x6d'),_0x7eaf('0x74'));}break;}}})['finally'](function(){_0x240a48();});}else{_0x240a48();}}},'charset':_0x7eaf('0x75'),'collate':_0x7eaf('0x76')});}; \ No newline at end of file +var _0x3fef=['password','smsMethod','sender','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','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','token','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','text','timestamp','keys','sort','length','md5','digest','signature=','/external/get/send.php?','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiKey','uuid','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','SmsInteraction','findOne','update','createdAt','catch','error','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username'];(function(_0x617d4e,_0x2592d5){var _0x39a278=function(_0x1e7705){while(--_0x1e7705){_0x617d4e['push'](_0x617d4e['shift']());}};_0x39a278(++_0x2592d5);}(_0x3fef,0xbb));var _0xf3fe=function(_0x1caede,_0x330d8d){_0x1caede=_0x1caede-0x0;var _0x875306=_0x3fef[_0x1caede];return _0x875306;};'use strict';var _=require(_0xf3fe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf3fe('0x1'));var moment=require(_0xf3fe('0x2'));var BPromise=require(_0xf3fe('0x3'));var rp=require(_0xf3fe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3fe('0x5'));var config=require(_0xf3fe('0x6'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0xd64b98,_0x278ec4){return _0xd64b98[_0xf3fe('0x7')](_0xf3fe('0x8'),attributes,{'tableName':_0xf3fe('0x9'),'paranoid':![],'indexes':[{'name':_0xf3fe('0xa'),'fields':[_0xf3fe('0xa')]},{'name':_0xf3fe('0xb'),'fields':[_0xf3fe('0xc')],'type':_0xf3fe('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1383f7,_0x3ebf9c,_0x3dd3b0){var _0x4f2a20=_0xd64b98[_0xf3fe('0xe')];var _0x68b86d=_0x1383f7[_0xf3fe('0xf')]({'plain':!![]});if(_0x68b86d['direction'][_0xf3fe('0x10')]()==='in'||_0x68b86d[_0xf3fe('0x11')][_0xf3fe('0x10')]()===_0xf3fe('0x12')&&!_0x68b86d[_0xf3fe('0x13')]&&!_['isNil'](_0x68b86d[_0xf3fe('0x14')])){_0x4f2a20[_0xf3fe('0x15')][_0xf3fe('0x16')]({'where':{'id':_0x68b86d['SmsInteractionId']}})['then'](function(_0x271486){if(_0x271486){_0x271486[_0xf3fe('0x17')]({'lastMsgAt':_0x68b86d[_0xf3fe('0x18')],'lastMsgDirection':_0x68b86d[_0xf3fe('0x11')][_0xf3fe('0x10')]()});}})[_0xf3fe('0x19')](function(_0x2afdcc){console[_0xf3fe('0x1a')](_0x2afdcc);});}if(_0x68b86d[_0xf3fe('0x11')]===_0xf3fe('0x12')&&!_0x68b86d[_0xf3fe('0x13')]){var _0x9ac09a;_0x4f2a20['SmsAccount'][_0xf3fe('0x1b')]({'where':{'id':_0x68b86d[_0xf3fe('0x1c')]},'raw':!![]})[_0xf3fe('0x1d')](function(_0x25d178){_0x9ac09a=_0x25d178;if(_0x9ac09a&&_0x9ac09a[_0xf3fe('0x1e')]){switch(_0x9ac09a[_0xf3fe('0x1e')]){case _0xf3fe('0x1f'):var _0x5389bd=require(_0xf3fe('0x1f'));if(_0x9ac09a[_0xf3fe('0x20')]&&_0x9ac09a[_0xf3fe('0x21')]&&_0x9ac09a[_0xf3fe('0x22')]){var _0x3d210b=new _0x5389bd(_0x9ac09a[_0xf3fe('0x20')],_0x9ac09a[_0xf3fe('0x21')]);_0x3d210b['messages'][_0xf3fe('0x23')]({'body':_0x68b86d[_0xf3fe('0xc')],'to':_0x68b86d[_0xf3fe('0x22')],'from':_0x9ac09a['phone'],'statusCallback':_0x9ac09a[_0xf3fe('0x24')]+_0xf3fe('0x25')+_0x68b86d['id']+_0xf3fe('0x26')+_0x9ac09a['token']})[_0xf3fe('0x1d')](function(_0x23cfd8){if(_0x23cfd8[_0xf3fe('0x27')]){return _0x1383f7[_0xf3fe('0x17')]({'messageId':_0x23cfd8[_0xf3fe('0x27')]});}})[_0xf3fe('0x19')](function(_0x506999){logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x1f'),util[_0xf3fe('0x2a')](_0x506999,{'showHidden':![],'depth':null}));});}else{logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x1f'),_0xf3fe('0x2b'));}break;case _0xf3fe('0x2c'):var _0x26bb3c=_0xf3fe('0x2d');if(_0x9ac09a[_0xf3fe('0x2e')]&&_0x9ac09a[_0xf3fe('0x2f')]){var _0x2f881b={'recipient':[_0x68b86d[_0xf3fe('0x22')]],'message':_0x68b86d[_0xf3fe('0xc')],'message_type':_0x9ac09a[_0xf3fe('0x30')]};if(_0x9ac09a[_0xf3fe('0x30')]&&_0x9ac09a[_0xf3fe('0x30')]!=='SI'){_0x2f881b[_0xf3fe('0x31')]=_0x9ac09a['phone'];}var _0x163877={'url':_0x26bb3c+'login?username='+_0x9ac09a['username']+_0xf3fe('0x32')+_0x9ac09a['password'],'method':_0xf3fe('0x33')};rp(_0x163877)[_0xf3fe('0x1d')](function(_0xe18bf7){var _0x12f07f=_0xe18bf7[_0xf3fe('0x34')](';');var _0x6aaa26={'user_key':_0x12f07f[0x0],'session_key':_0x12f07f[0x1]};_0x163877={'url':_0x26bb3c+_0xf3fe('0x35'),'method':_0xf3fe('0x36'),'headers':{'user_key':_0x6aaa26[_0xf3fe('0x37')],'Session_key':_0x6aaa26[_0xf3fe('0x38')]},'json':!![],'body':_0x2f881b};return rp(_0x163877);})[_0xf3fe('0x1d')](function(_0x4e4e97){if(_0x4e4e97[_0xf3fe('0x39')]>=0x1){var _0x3dccf4={'messageId':_0x4e4e97[_0xf3fe('0x3a')]};if(_0x9ac09a['smsMethod']!=='GP'||!_0x9ac09a[_0xf3fe('0x3b')]){_0x3dccf4[_0xf3fe('0x3c')]=!![];}return _0x1383f7[_0xf3fe('0x17')](_0x3dccf4);}else{return logger[_0xf3fe('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf3fe('0x29'),_0xf3fe('0x2c'),util[_0xf3fe('0x2a')](_0x4e4e97,{'showHidden':![],'depth':null}));}})['catch'](function(_0x535e88){return logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x2c'),util['inspect'](_0x535e88,{'showHidden':![],'depth':null}));});}else{logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x2c'),_0xf3fe('0x3d'));}break;case'connectel':if(_0x9ac09a[_0xf3fe('0x21')]){var _0x31de4c={'recipient':_0x68b86d[_0xf3fe('0x22')],'message':_0x68b86d[_0xf3fe('0xc')],'sender':_0x9ac09a[_0xf3fe('0x3e')]||_0x9ac09a['phone'],'authorization':_0x9ac09a[_0xf3fe('0x21')]};var _0x3ebf9c={'method':_0xf3fe('0x36'),'uri':_0xf3fe('0x3f'),'body':_0x31de4c,'json':!![]};rp(_0x3ebf9c)[_0xf3fe('0x1d')](function(_0x54193c){var _0x2fd660={'messageId':_0x54193c[_0xf3fe('0x40')]};if(!_0x9ac09a['deliveryReport']){_0x2fd660[_0xf3fe('0x3c')]=!![];}return _0x1383f7[_0xf3fe('0x17')](_0x2fd660);})[_0xf3fe('0x19')](function(_0x2ae252){logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x41'),util['inspect'](_0x2ae252,{'showHidden':![],'depth':null}));});}else{logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),'afterCreate',_0xf3fe('0x41'),_0xf3fe('0x42'));}break;case'clicksend':if(_0x9ac09a[_0xf3fe('0x2e')]&&_0x9ac09a['password']){var _0x31de4c={'messages':[{'source':'xCALLY\x20Motion','to':_0x68b86d['phone'],'body':_0x68b86d['body'],'from':_0x9ac09a[_0xf3fe('0x3e')]||_0x9ac09a[_0xf3fe('0x22')]}]};var _0x1b6f3d=util[_0xf3fe('0x43')](_0xf3fe('0x44'),_0x9ac09a['username'],_0x9ac09a[_0xf3fe('0x2f')]);var _0x3ebf9c={'method':_0xf3fe('0x36'),'uri':_0xf3fe('0x45'),'body':_0x31de4c,'headers':{'Authorization':util[_0xf3fe('0x43')](_0xf3fe('0x46'),new Buffer(_0x1b6f3d)[_0xf3fe('0x47')]('base64'))},'json':!![]};rp(_0x3ebf9c)[_0xf3fe('0x1d')](function(_0x3375d2){if(_0x3375d2[_0xf3fe('0x48')]>=0xc8&&_0x3375d2[_0xf3fe('0x48')]<=0xce){if(_0x3375d2[_0xf3fe('0x49')]&&_0x3375d2[_0xf3fe('0x49')][_0xf3fe('0x4a')]>0x0){var _0x300be7=_[_0xf3fe('0x4b')](_0x3375d2['data']['messages']);var _0x49c2d5={'messageId':_0x300be7[_0xf3fe('0x4c')]};if(!_0x9ac09a['deliveryReport']){_0x49c2d5[_0xf3fe('0x3c')]=!![];}return _0x1383f7[_0xf3fe('0x17')](_0x49c2d5);}else{logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),'clickSend',util['inspect'](_0x3375d2,{'showHidden':![],'depth':null}));}}else{logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),'afterCreate',_0xf3fe('0x4d'),util[_0xf3fe('0x2a')](_0x3375d2,{'showHidden':![],'depth':null}));}})[_0xf3fe('0x19')](function(_0x3ba9d0){logger['error'](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x4d'),util['inspect'](_0x3ba9d0,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf3fe('0x28'),'afterCreate',_0xf3fe('0x4d'),_0xf3fe('0x3d'));}break;case _0xf3fe('0x4e'):if(_0x9ac09a[_0xf3fe('0x4f')]&&_0x9ac09a[_0xf3fe('0x21')]){var _0x31de4c={'dst':_0x68b86d['phone'],'text':_0x68b86d[_0xf3fe('0xc')],'src':_0x9ac09a[_0xf3fe('0x3e')]||_0x9ac09a[_0xf3fe('0x22')],'url':_0x9ac09a[_0xf3fe('0x24')]+'/api/sms/messages/'+_0x68b86d['id']+_0xf3fe('0x26')+_0x9ac09a[_0xf3fe('0x50')]};var _0x1b6f3d=util[_0xf3fe('0x43')]('%s:%s',_0x9ac09a[_0xf3fe('0x4f')],_0x9ac09a[_0xf3fe('0x21')]);var _0x3ebf9c={'method':_0xf3fe('0x36'),'uri':util['format'](_0xf3fe('0x51'),_0x9ac09a['authId']),'body':_0x31de4c,'headers':{'Authorization':util[_0xf3fe('0x43')](_0xf3fe('0x46'),new Buffer(_0x1b6f3d)[_0xf3fe('0x47')](_0xf3fe('0x52')))},'json':!![]};rp(_0x3ebf9c)['then'](function(_0x468123){var _0x2ff258={'messageId':_0x468123[_0xf3fe('0x53')][0x0]};return _0x1383f7[_0xf3fe('0x17')](_0x2ff258);})[_0xf3fe('0x19')](function(_0x3443d2){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf3fe('0x29'),_0xf3fe('0x4e'),util[_0xf3fe('0x2a')](_0x3443d2,{'showHidden':![],'depth':null}));});}else{logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xf3fe('0x54'):if(_0x9ac09a[_0xf3fe('0x2e')]&&_0x9ac09a[_0xf3fe('0x2f')]){if(_0x9ac09a[_0xf3fe('0x55')]){var _0x1dc668={'method':_0xf3fe('0x36'),'uri':_0x9ac09a['baseUrl']+_0xf3fe('0x56'),'body':{'username':_0x9ac09a['username'],'password':_0x9ac09a['password']},'json':!![]};return rp(_0x1dc668)[_0xf3fe('0x1d')](function(_0x2ebd77){var _0x2508ac={'method':_0xf3fe('0x36'),'uri':_0x9ac09a['baseUrl']+_0xf3fe('0x57'),'body':{'messages':[{'from':_0x9ac09a['phone'],'destinations':[{'to':_0x68b86d[_0xf3fe('0x22')]}],'text':_0x68b86d[_0xf3fe('0xc')],'notifyUrl':_0x9ac09a['remote']+'/api/sms/messages/'+_0x68b86d['id']+_0xf3fe('0x26')+_0x9ac09a['token'],'notifyContentType':'application/json','callbackData':_0x9ac09a[_0xf3fe('0x22')]+';'+_0x68b86d[_0xf3fe('0xc')]}]},'headers':{'Authorization':_0xf3fe('0x58')+_0x2ebd77[_0xf3fe('0x50')]},'json':!![]};return rp(_0x2508ac)[_0xf3fe('0x1d')](function(_0x5ab422){if(_0x5ab422[_0xf3fe('0x59')]){var _0x198b7b={'messageId':_0x5ab422['messages'][0x0][_0xf3fe('0xa')]};if(!_0x9ac09a[_0xf3fe('0x3b')]){_0x198b7b[_0xf3fe('0x3c')]=!![];}return _0x1383f7['update'](_0x198b7b);}else{return logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x54'),util[_0xf3fe('0x2a')](_0x5ab422,{'showHidden':![],'depth':null}));}});})[_0xf3fe('0x19')](function(_0x34f0e0){return logger['error'](_0xf3fe('0x28'),'afterCreate',_0xf3fe('0x54'),util[_0xf3fe('0x2a')](_0x34f0e0,{'showHidden':![],'depth':null}));});}else{logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x54'),_0xf3fe('0x5a'));}}else{logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x3068d7=require('crypto');if(_0x9ac09a['apiKey']){var _0x1fd393={};_0x1fd393['login']=_0x9ac09a['username'];_0x1fd393[_0xf3fe('0x22')]=_0x68b86d[_0xf3fe('0x22')];_0x1fd393['sender']=_0x9ac09a[_0xf3fe('0x22')];_0x1fd393[_0xf3fe('0x5b')]=_0x68b86d['body'];_0x1fd393[_0xf3fe('0x5c')]=+new Date();var _0x450b7b='';var _0x3b5c3a='';var _0xfa7419=Object[_0xf3fe('0x5d')](_0x1fd393);_0xfa7419[_0xf3fe('0x5e')]();for(var _0xb009bf=0x0;_0xb009bf<_0xfa7419[_0xf3fe('0x5f')];_0xb009bf++){if(_0x450b7b!=''){_0x450b7b+='&';}_0x450b7b+=_0xfa7419[_0xb009bf]+'='+encodeURIComponent(_0x1fd393[_0xfa7419[_0xb009bf]]);_0x3b5c3a+=_0x1fd393[_0xfa7419[_0xb009bf]];}_0x3b5c3a+=_0x9ac09a['apiKey'];_0x3b5c3a=_0x3068d7['createHash'](_0xf3fe('0x60'))[_0xf3fe('0x17')](_0x3b5c3a)[_0xf3fe('0x61')]('hex');if(_0x450b7b!==''){_0x450b7b+='&';}_0x450b7b+=_0xf3fe('0x62')+_0x3b5c3a;var _0x163877={'method':_0xf3fe('0x33'),'uri':_0x9ac09a[_0xf3fe('0x55')]+_0xf3fe('0x63')+_0x450b7b,'json':!![]};return rp(_0x163877)[_0xf3fe('0x1d')](function(_0x1dcc87){var _0x505d2d=Object[_0xf3fe('0x5d')](_0x1dcc87);if(_0x1dcc87[_0x505d2d[0x0]][_0xf3fe('0x1a')]&&parseInt(_0x1dcc87[_0x505d2d[0x0]][_0xf3fe('0x1a')])===0x0){var _0x5884e2={'messageId':_0x1dcc87[_0x505d2d[0x0]]['id_sms']};if(!_0x9ac09a[_0xf3fe('0x3b')]){_0x5884e2[_0xf3fe('0x3c')]=!![];}return _0x1383f7['update'](_0x5884e2);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf3fe('0x29'),'csc',util[_0xf3fe('0x2a')](_0x1dcc87[_0xf3fe('0x1a')],{'showHidden':![],'depth':null}));}})[_0xf3fe('0x19')](function(_0xc6aa8e){return logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x64'),util[_0xf3fe('0x2a')](_0xc6aa8e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf3fe('0x28'),_0xf3fe('0x29'),'csc',_0xf3fe('0x65'));}break;case _0xf3fe('0x66'):if(_0x9ac09a['apiKey']){var _0x27a049={'method':_0xf3fe('0x36'),'uri':_0xf3fe('0x67'),'headers':{'Authorization':_0x9ac09a[_0xf3fe('0x68')]},'body':{'content':_0x68b86d['body'],'to':[_0x68b86d[_0xf3fe('0x22')]],'from':_0x9ac09a[_0xf3fe('0x22')],'binary':![],'clientMessageId':_0xf3fe('0x69'),'charset':'UTF-8'},'json':!![]};rp(_0x27a049)[_0xf3fe('0x1d')](function(_0xb8b037){if(!_0xb8b037[_0xf3fe('0x1a')]){var _0x24f622={'messageId':_0xb8b037['messages'][0x0][_0xf3fe('0x6a')]};if(!_0x9ac09a[_0xf3fe('0x3b')]){_0x24f622['read']=!![];}return _0x1383f7[_0xf3fe('0x17')](_0x24f622);}else{return logger[_0xf3fe('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf3fe('0x29'),'clickatell',util[_0xf3fe('0x2a')](_0xb8b037[_0xf3fe('0x1a')],{'showHidden':![],'depth':null}));}})[_0xf3fe('0x19')](function(_0x5bf05c){return logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x66'),util['inspect'](_0x5bf05c,{'showHidden':![],'depth':null}));});}else{logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),_0xf3fe('0x66'),'Missing\x20parameters:\x20apiKey');}break;case _0xf3fe('0x6b'):if(_0x9ac09a[_0xf3fe('0x68')]){var _0x3a818d={};var _0x163877={'method':_0xf3fe('0x36'),'uri':_0xf3fe('0x6c'),'headers':{'Authorization':_0xf3fe('0x6d')+_0x9ac09a[_0xf3fe('0x68')],'Content-Type':_0xf3fe('0x6e')},'body':{'from':_0x9ac09a[_0xf3fe('0x22')],'to':_0x68b86d[_0xf3fe('0x22')],'text':_0x68b86d[_0xf3fe('0xc')]},'json':!![]};return rp(_0x163877)[_0xf3fe('0x1d')](function(_0x40345b){if(_0x40345b[_0xf3fe('0x6f')]==0xca){_0x3a818d[_0xf3fe('0x70')]=_0x40345b;var _0x4c71f1={'method':_0xf3fe('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x9ac09a[_0xf3fe('0x68')],'Content-Type':'application/json'},'body':{'refid':_0x3a818d[_0xf3fe('0x70')]['refid']},'json':!![]};return rp(_0x4c71f1)[_0xf3fe('0x1d')](function(_0x3a5a55){_0x3a818d['status']=_0x3a5a55;var _0x43b340={'messageId':_0x3a818d['message'][_0xf3fe('0x71')],'read':!![]};return _0x1383f7[_0xf3fe('0x17')](_0x43b340);});}else{return logger['error'](_0xf3fe('0x28'),_0xf3fe('0x29'),'intelepeer',util[_0xf3fe('0x2a')](_0x40345b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3828a4){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xf3fe('0x29'),_0xf3fe('0x6b'),util[_0xf3fe('0x2a')](_0x3828a4,{'showHidden':![],'depth':null}));});}else{return logger[_0xf3fe('0x1a')](_0xf3fe('0x28'),_0xf3fe('0x29'),'intelepeer',_0xf3fe('0x72'));}break;}}})['finally'](function(){_0x3dd3b0();});}else{_0x3dd3b0();}}},'charset':_0xf3fe('0x73'),'collate':_0xf3fe('0x74')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e369b4c..ff433aa 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 _0x8670=['create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','info','catch','CreateSmsMessage','SmsMessage'];(function(_0x43f782,_0x2b5a88){var _0x35a266=function(_0x27310f){while(--_0x27310f){_0x43f782['push'](_0x43f782['shift']());}};_0x35a266(++_0x2b5a88);}(_0x8670,0x1cc));var _0x0867=function(_0x40c402,_0x42ee7d){_0x40c402=_0x40c402-0x0;var _0x4e7680=_0x8670[_0x40c402];return _0x4e7680;};'use strict';var _=require(_0x0867('0x0'));var util=require('util');var moment=require(_0x0867('0x1'));var BPromise=require(_0x0867('0x2'));var rs=require(_0x0867('0x3'));var fs=require('fs');var Redis=require(_0x0867('0x4'));var db=require(_0x0867('0x5'))['db'];var utils=require(_0x0867('0x6'));var logger=require(_0x0867('0x7'))('rpc');var config=require(_0x0867('0x8'));var jayson=require(_0x0867('0x9'));var client=jayson['client'][_0x0867('0xa')]({'port':0x232a});config[_0x0867('0xb')]=_[_0x0867('0xc')](config[_0x0867('0xb')],{'host':_0x0867('0xd'),'port':0x18eb});var socket=require(_0x0867('0xe'))(new Redis(config[_0x0867('0xb')]));require(_0x0867('0xf'))[_0x0867('0x10')](socket);function respondWithRpcPromise(_0x3102fd,_0x3eb00d,_0x1c6531){return new BPromise(function(_0x295ea4,_0x3d861e){return client[_0x0867('0x11')](_0x3102fd,_0x1c6531)[_0x0867('0x12')](function(_0x4d5af4){logger['info']('SmsMessage,\x20%s,\x20%s',_0x3eb00d,'request\x20sent');logger['debug'](_0x0867('0x13'),_0x3eb00d,_0x0867('0x14'),JSON[_0x0867('0x15')](_0x4d5af4));if(_0x4d5af4[_0x0867('0x16')]){if(_0x4d5af4['error'][_0x0867('0x17')]===0x1f4){logger[_0x0867('0x16')](_0x0867('0x18'),_0x3eb00d,_0x4d5af4[_0x0867('0x16')][_0x0867('0x19')]);return _0x3d861e(_0x4d5af4['error'][_0x0867('0x19')]);}logger[_0x0867('0x16')](_0x0867('0x18'),_0x3eb00d,_0x4d5af4[_0x0867('0x16')][_0x0867('0x19')]);return _0x295ea4(_0x4d5af4[_0x0867('0x16')]['message']);}else{logger[_0x0867('0x1a')](_0x0867('0x18'),_0x3eb00d,'request\x20sent');_0x295ea4(_0x4d5af4['result'][_0x0867('0x19')]);}})[_0x0867('0x1b')](function(_0x426fba){logger[_0x0867('0x16')](_0x0867('0x18'),_0x3eb00d,_0x426fba);_0x3d861e(_0x426fba);});});}exports[_0x0867('0x1c')]=function(_0x523107){var _0x3ae0a4=this;return new Promise(function(_0x3d608d,_0x5ddf65){return db[_0x0867('0x1d')][_0x0867('0x1e')](_0x523107[_0x0867('0x1f')],{'raw':_0x523107[_0x0867('0x20')]?_0x523107[_0x0867('0x20')][_0x0867('0x21')]===undefined?!![]:![]:!![]})[_0x0867('0x12')](function(_0x595b3e){logger[_0x0867('0x1a')](_0x0867('0x1c'),_0x523107);logger[_0x0867('0x22')](_0x0867('0x1c'),_0x523107,JSON[_0x0867('0x15')](_0x595b3e));_0x3d608d(_0x595b3e);})[_0x0867('0x1b')](function(_0x4eff28){logger[_0x0867('0x16')](_0x0867('0x1c'),_0x4eff28[_0x0867('0x19')],_0x523107);_0x5ddf65(_0x3ae0a4[_0x0867('0x16')](0x1f4,_0x4eff28[_0x0867('0x19')]));});});}; \ No newline at end of file +var _0xaaec=['catch','CreateSmsMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x315fe9,_0x4c6e8a){var _0x42d15d=function(_0x21d7f2){while(--_0x21d7f2){_0x315fe9['push'](_0x315fe9['shift']());}};_0x42d15d(++_0x4c6e8a);}(_0xaaec,0x1ab));var _0xcaae=function(_0x40eb37,_0x31b4cb){_0x40eb37=_0x40eb37-0x0;var _0x15227d=_0xaaec[_0x40eb37];return _0x15227d;};'use strict';var _=require(_0xcaae('0x0'));var util=require(_0xcaae('0x1'));var moment=require(_0xcaae('0x2'));var BPromise=require(_0xcaae('0x3'));var rs=require(_0xcaae('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcaae('0x5'))['db'];var utils=require(_0xcaae('0x6'));var logger=require(_0xcaae('0x7'))(_0xcaae('0x8'));var config=require(_0xcaae('0x9'));var jayson=require(_0xcaae('0xa'));var client=jayson[_0xcaae('0xb')][_0xcaae('0xc')]({'port':0x232a});config[_0xcaae('0xd')]=_[_0xcaae('0xe')](config['redis'],{'host':_0xcaae('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcaae('0xd')]));require(_0xcaae('0x10'))[_0xcaae('0x11')](socket);function respondWithRpcPromise(_0x384d04,_0x472608,_0xa568fe){return new BPromise(function(_0x543c67,_0x2351cb){return client['request'](_0x384d04,_0xa568fe)[_0xcaae('0x12')](function(_0x144e75){logger[_0xcaae('0x13')](_0xcaae('0x14'),_0x472608,_0xcaae('0x15'));logger['debug'](_0xcaae('0x16'),_0x472608,_0xcaae('0x15'),JSON[_0xcaae('0x17')](_0x144e75));if(_0x144e75['error']){if(_0x144e75[_0xcaae('0x18')][_0xcaae('0x19')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x472608,_0x144e75[_0xcaae('0x18')][_0xcaae('0x1a')]);return _0x2351cb(_0x144e75[_0xcaae('0x18')][_0xcaae('0x1a')]);}logger[_0xcaae('0x18')](_0xcaae('0x14'),_0x472608,_0x144e75[_0xcaae('0x18')]['message']);return _0x543c67(_0x144e75['error'][_0xcaae('0x1a')]);}else{logger[_0xcaae('0x13')](_0xcaae('0x14'),_0x472608,_0xcaae('0x15'));_0x543c67(_0x144e75[_0xcaae('0x1b')]['message']);}})[_0xcaae('0x1c')](function(_0xd96032){logger[_0xcaae('0x18')](_0xcaae('0x14'),_0x472608,_0xd96032);_0x2351cb(_0xd96032);});});}exports[_0xcaae('0x1d')]=function(_0x5afd50){var _0x290d5b=this;return new Promise(function(_0x4afc83,_0x4b03e6){return db['SmsMessage'][_0xcaae('0x1e')](_0x5afd50[_0xcaae('0x1f')],{'raw':_0x5afd50[_0xcaae('0x20')]?_0x5afd50[_0xcaae('0x20')][_0xcaae('0x21')]===undefined?!![]:![]:!![]})[_0xcaae('0x12')](function(_0x480a27){logger[_0xcaae('0x13')](_0xcaae('0x1d'),_0x5afd50);logger[_0xcaae('0x22')]('CreateSmsMessage',_0x5afd50,JSON[_0xcaae('0x17')](_0x480a27));_0x4afc83(_0x480a27);})[_0xcaae('0x1c')](function(_0x298c76){logger[_0xcaae('0x18')](_0xcaae('0x1d'),_0x298c76['message'],_0x5afd50);_0x4b03e6(_0x290d5b['error'](0x1f4,_0x298c76[_0xcaae('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 690fddf..b279ce3 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 _0xd9d8=['save','remove','update','emit','removeListener','register','smsMessage:','./smsMessage.events'];(function(_0x4fa5e3,_0x2f75dc){var _0x1a2f1e=function(_0x5bcfc0){while(--_0x5bcfc0){_0x4fa5e3['push'](_0x4fa5e3['shift']());}};_0x1a2f1e(++_0x2f75dc);}(_0xd9d8,0x7f));var _0x8d9d=function(_0x561da8,_0x4c4ab6){_0x561da8=_0x561da8-0x0;var _0x2079d0=_0xd9d8[_0x561da8];return _0x2079d0;};'use strict';var SmsMessageEvents=require(_0x8d9d('0x0'));var events=[_0x8d9d('0x1'),_0x8d9d('0x2'),_0x8d9d('0x3')];function createListener(_0xa15016,_0x388830){return function(_0x51c8d6){_0x388830[_0x8d9d('0x4')](_0xa15016,_0x51c8d6);};}function removeListener(_0x4d0c66,_0x10070a){return function(){SmsMessageEvents[_0x8d9d('0x5')](_0x4d0c66,_0x10070a);};}exports[_0x8d9d('0x6')]=function(_0x38c997){for(var _0x419ba7=0x0,_0x1a61aa=events['length'];_0x419ba7<_0x1a61aa;_0x419ba7++){var _0x4f43e6=events[_0x419ba7];var _0xcbc992=createListener(_0x8d9d('0x7')+_0x4f43e6,_0x38c997);SmsMessageEvents['on'](_0x4f43e6,_0xcbc992);}}; \ No newline at end of file +var _0x7afc=['smsMessage:','update','emit','register'];(function(_0x2425f5,_0x55ce0a){var _0x15e96e=function(_0xf3eab6){while(--_0xf3eab6){_0x2425f5['push'](_0x2425f5['shift']());}};_0x15e96e(++_0x55ce0a);}(_0x7afc,0x12d));var _0xc7af=function(_0x3c126c,_0x22f353){_0x3c126c=_0x3c126c-0x0;var _0x3b89e4=_0x7afc[_0x3c126c];return _0x3b89e4;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save','remove',_0xc7af('0x0')];function createListener(_0x52843f,_0x2f81ea){return function(_0x646fa9){_0x2f81ea[_0xc7af('0x1')](_0x52843f,_0x646fa9);};}function removeListener(_0x135014,_0x5ae88e){return function(){SmsMessageEvents['removeListener'](_0x135014,_0x5ae88e);};}exports[_0xc7af('0x2')]=function(_0x18abc4){for(var _0x4f91cd=0x0,_0x1f0556=events['length'];_0x4f91cd<_0x1f0556;_0x4f91cd++){var _0x20768f=events[_0x4f91cd];var _0x50642a=createListener(_0xc7af('0x3')+_0x20768f,_0x18abc4);SmsMessageEvents['on'](_0x20768f,_0x50642a);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 6627a60..b2921e3 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 _0xeecc=['isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','./smsQueue.controller','get'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xeecc,0x12d));var _0xceec=function(_0x475c56,_0x44b13d){_0x475c56=_0x475c56-0x0;var _0x5146c0=_0xeecc[_0x475c56];return _0x5146c0;};'use strict';var multer=require(_0xceec('0x0'));var util=require(_0xceec('0x1'));var path=require(_0xceec('0x2'));var timeout=require(_0xceec('0x3'));var express=require('express');var router=express[_0xceec('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xceec('0x5'));router[_0xceec('0x6')]('/',auth[_0xceec('0x7')](),controller[_0xceec('0x8')]);router['get'](_0xceec('0x9'),auth['isAuthenticated'](),controller[_0xceec('0xa')]);router[_0xceec('0x6')](_0xceec('0xb'),auth[_0xceec('0x7')](),controller[_0xceec('0xc')]);router[_0xceec('0x6')](_0xceec('0xd'),auth['isAuthenticated'](),controller[_0xceec('0xe')]);router[_0xceec('0x6')](_0xceec('0xf'),auth[_0xceec('0x7')](),controller[_0xceec('0x10')]);router['get'](_0xceec('0x11'),auth[_0xceec('0x7')](),controller[_0xceec('0x12')]);router[_0xceec('0x13')]('/',auth[_0xceec('0x7')](),controller['create']);router[_0xceec('0x13')]('/:id/teams',auth[_0xceec('0x7')](),controller[_0xceec('0x14')]);router[_0xceec('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xceec('0x15')]);router['put'](_0xceec('0xb'),auth[_0xceec('0x7')](),controller[_0xceec('0x16')]);router[_0xceec('0x17')](_0xceec('0xb'),auth[_0xceec('0x7')](),controller[_0xceec('0x18')]);router[_0xceec('0x17')](_0xceec('0xf'),auth[_0xceec('0x7')](),controller[_0xceec('0x19')]);router['delete'](_0xceec('0x11'),auth[_0xceec('0x7')](),controller[_0xceec('0x1a')]);module[_0xceec('0x1b')]=router; \ No newline at end of file +var _0x2f74=['removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy'];(function(_0x2c74f4,_0x57fd68){var _0x2d4e8d=function(_0x498759){while(--_0x498759){_0x2c74f4['push'](_0x2c74f4['shift']());}};_0x2d4e8d(++_0x57fd68);}(_0x2f74,0x7b));var _0x42f7=function(_0x1613d9,_0x2f583e){_0x1613d9=_0x1613d9-0x0;var _0x1ab5e0=_0x2f74[_0x1613d9];return _0x1ab5e0;};'use strict';var multer=require(_0x42f7('0x0'));var util=require('util');var path=require(_0x42f7('0x1'));var timeout=require(_0x42f7('0x2'));var express=require(_0x42f7('0x3'));var router=express[_0x42f7('0x4')]();var auth=require(_0x42f7('0x5'));var interaction=require(_0x42f7('0x6'));var config=require(_0x42f7('0x7'));var controller=require(_0x42f7('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x42f7('0x9')](_0x42f7('0xa'),auth[_0x42f7('0xb')](),controller[_0x42f7('0xc')]);router[_0x42f7('0x9')](_0x42f7('0xd'),auth[_0x42f7('0xb')](),controller[_0x42f7('0xe')]);router['get'](_0x42f7('0xf'),auth[_0x42f7('0xb')](),controller[_0x42f7('0x10')]);router[_0x42f7('0x9')](_0x42f7('0x11'),auth[_0x42f7('0xb')](),controller['getTeams']);router[_0x42f7('0x9')](_0x42f7('0x12'),auth[_0x42f7('0xb')](),controller[_0x42f7('0x13')]);router[_0x42f7('0x14')]('/',auth[_0x42f7('0xb')](),controller[_0x42f7('0x15')]);router[_0x42f7('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x42f7('0x16')]);router[_0x42f7('0x14')](_0x42f7('0x12'),auth[_0x42f7('0xb')](),controller[_0x42f7('0x17')]);router['put'](_0x42f7('0xd'),auth['isAuthenticated'](),controller[_0x42f7('0x18')]);router[_0x42f7('0x19')](_0x42f7('0xd'),auth[_0x42f7('0xb')](),controller[_0x42f7('0x1a')]);router[_0x42f7('0x19')](_0x42f7('0x11'),auth['isAuthenticated'](),controller[_0x42f7('0x1b')]);router[_0x42f7('0x19')](_0x42f7('0x12'),auth[_0x42f7('0xb')](),controller[_0x42f7('0x1c')]);module[_0x42f7('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 897cf0a..7ed4bab 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 _0x687a=['rrmemory','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x37cffb,_0x4c6261){var _0x4984c5=function(_0xaa4512){while(--_0xaa4512){_0x37cffb['push'](_0x37cffb['shift']());}};_0x4984c5(++_0x4c6261);}(_0x687a,0x1e4));var _0xa687=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x687a[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0xa687('0x0'));module[_0xa687('0x1')]={'name':{'type':Sequelize[_0xa687('0x2')],'unique':_0xa687('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa687('0x2')]},'timeout':{'type':Sequelize[_0xa687('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa687('0x5')](_0xa687('0x6'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x4ff8=['ENUM','rrmemory','beepall','roundrobin','exports','name','STRING','INTEGER'];(function(_0x5523a0,_0x5ccefa){var _0x1f92a1=function(_0x27b272){while(--_0x27b272){_0x5523a0['push'](_0x5523a0['shift']());}};_0x1f92a1(++_0x5ccefa);}(_0x4ff8,0x1c4));var _0x84ff=function(_0xb13ea5,_0x50167f){_0xb13ea5=_0xb13ea5-0x0;var _0x1de7f2=_0x4ff8[_0xb13ea5];return _0x1de7f2;};'use strict';var Sequelize=require('sequelize');module[_0x84ff('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x84ff('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x84ff('0x2')]},'timeout':{'type':Sequelize[_0x84ff('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x84ff('0x4')](_0x84ff('0x5'),_0x84ff('0x6'),_0x84ff('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 26ef195..1ed6fa6 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 _0x0f4d=['TeamId','all','union','compact','value','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','SmsQueues','UserProfileResource','end','sendStatus','stack','name','index','map','SmsQueue','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','order','UserSmsQueue','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','findAll','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Team','User','field','tq.TeamId','from','team_has_sms_queues','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every'];(function(_0x1e4e1c,_0x3a3f7c){var _0x4327f5=function(_0x5d6e1f){while(--_0x5d6e1f){_0x1e4e1c['push'](_0x1e4e1c['shift']());}};_0x4327f5(++_0x3a3f7c);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x34cae3,_0x399d31){_0x34cae3=_0x34cae3-0x0;var _0x13cd2f=_0x0f4d[_0x34cae3];return _0x13cd2f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd0f4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd0f4('0x1'));var moment=require(_0xd0f4('0x2'));var BPromise=require(_0xd0f4('0x3'));var Mustache=require(_0xd0f4('0x4'));var util=require(_0xd0f4('0x5'));var path=require(_0xd0f4('0x6'));var sox=require(_0xd0f4('0x7'));var csv=require(_0xd0f4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd0f4('0x9'));var squel=require(_0xd0f4('0xa'));var crypto=require('crypto');var jsforce=require(_0xd0f4('0xb'));var deskjs=require(_0xd0f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd0f4('0xd'));var Papa=require(_0xd0f4('0xe'));var Redis=require('ioredis');var authService=require(_0xd0f4('0xf'));var qs=require(_0xd0f4('0x10'));var as=require(_0xd0f4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd0f4('0x12'));var utils=require(_0xd0f4('0x13'));var config=require(_0xd0f4('0x14'));var licenseUtil=require(_0xd0f4('0x15'));var db=require(_0xd0f4('0x16'))['db'];config[_0xd0f4('0x17')]=_[_0xd0f4('0x18')](config['redis'],{'host':_0xd0f4('0x19'),'port':0x18eb});var socket=require(_0xd0f4('0x1a'))(new Redis(config['redis']));require(_0xd0f4('0x1b'))['register'](socket);function respondWithStatusCode(_0x828792,_0x48254a){_0x48254a=_0x48254a||0xcc;return function(_0x401779){if(_0x401779){return _0x828792['sendStatus'](_0x48254a);}return _0x828792['status'](_0x48254a)['end']();};}function respondWithResult(_0x45b32e,_0x320d37){_0x320d37=_0x320d37||0xc8;return function(_0xe37a0d){if(_0xe37a0d){return _0x45b32e[_0xd0f4('0x1c')](_0x320d37)[_0xd0f4('0x1d')](_0xe37a0d);}};}function respondWithFilteredResult(_0x10acbe,_0xe8cefc){return function(_0x35be48){if(_0x35be48){var _0x247cff=_0x35be48[_0xd0f4('0x1e')],_0x5de07b=_0xe8cefc[_0xd0f4('0x1f')],_0xb7169b=_0xe8cefc['offset']+_0xe8cefc[_0xd0f4('0x20')],_0x1e4fb3;if(_0xb7169b>=_0x247cff){_0xb7169b=_0x247cff;_0x1e4fb3=0xc8;}else{_0x1e4fb3=0xce;}_0x10acbe[_0xd0f4('0x1c')](_0x1e4fb3);return _0x10acbe[_0xd0f4('0x21')](_0xd0f4('0x22'),_0x5de07b+'-'+_0xb7169b+'/'+_0x247cff)['json'](_0x35be48);}return null;};}function patchUpdates(_0x38b112){return function(_0xda1d14){try{jsonpatch[_0xd0f4('0x23')](_0xda1d14,_0x38b112,!![]);}catch(_0x1e799f){return BPromise[_0xd0f4('0x24')](_0x1e799f);}return _0xda1d14[_0xd0f4('0x25')]();};}function saveUpdates(_0x25ee43,_0x4d3a99){return function(_0x23488f){if(_0x23488f){return _0x23488f[_0xd0f4('0x26')](_0x25ee43)[_0xd0f4('0x27')](function(_0x299904){return _0x299904;});}return null;};}function removeEntity(_0x4d49c0,_0x14ffba){return function(_0x524d73){if(_0x524d73){return _0x524d73[_0xd0f4('0x28')]()[_0xd0f4('0x27')](function(){var _0x1cf493=_0x524d73['get']({'plain':!![]});var _0x42d944=_0xd0f4('0x29');return db[_0xd0f4('0x2a')][_0xd0f4('0x28')]({'where':{'type':_0x42d944,'resourceId':_0x1cf493['id']}})[_0xd0f4('0x27')](function(){return _0x524d73;});})['then'](function(){_0x4d49c0[_0xd0f4('0x1c')](0xcc)[_0xd0f4('0x2b')]();});}};}function handleEntityNotFound(_0x1b36c2,_0x128628){return function(_0x31c48c){if(!_0x31c48c){_0x1b36c2[_0xd0f4('0x2c')](0x194);}return _0x31c48c;};}function handleError(_0x1d3246,_0x33eb58){_0x33eb58=_0x33eb58||0x1f4;return function(_0x3cb97c){logger['error'](_0x3cb97c[_0xd0f4('0x2d')]);if(_0x3cb97c[_0xd0f4('0x2e')]){delete _0x3cb97c[_0xd0f4('0x2e')];}_0x1d3246[_0xd0f4('0x1c')](_0x33eb58)['send'](_0x3cb97c);};}exports[_0xd0f4('0x2f')]=function(_0x52a22a,_0x4f92a9){var _0x4f7fd3={},_0x22f599={},_0x2973aa={'count':0x0,'rows':[]};var _0x3a024c=_[_0xd0f4('0x30')](db[_0xd0f4('0x31')][_0xd0f4('0x32')],function(_0x220f22){return{'name':_0x220f22[_0xd0f4('0x33')],'type':_0x220f22['type'][_0xd0f4('0x34')]};});_0x22f599['model']=_[_0xd0f4('0x30')](_0x3a024c,_0xd0f4('0x2e'));_0x22f599['query']=_['keys'](_0x52a22a[_0xd0f4('0x35')]);_0x22f599['filters']=_[_0xd0f4('0x36')](_0x22f599[_0xd0f4('0x37')],_0x22f599['query']);_0x4f7fd3[_0xd0f4('0x38')]=_[_0xd0f4('0x36')](_0x22f599['model'],qs['fields'](_0x52a22a[_0xd0f4('0x35')][_0xd0f4('0x39')]));_0x4f7fd3['attributes']=_0x4f7fd3[_0xd0f4('0x38')]['length']?_0x4f7fd3[_0xd0f4('0x38')]:_0x22f599[_0xd0f4('0x37')];if(!_0x52a22a['query'][_0xd0f4('0x3a')](_0xd0f4('0x3b'))){_0x4f7fd3[_0xd0f4('0x20')]=qs[_0xd0f4('0x20')](_0x52a22a[_0xd0f4('0x35')]['limit']);_0x4f7fd3[_0xd0f4('0x1f')]=qs[_0xd0f4('0x1f')](_0x52a22a[_0xd0f4('0x35')][_0xd0f4('0x1f')]);}_0x4f7fd3['order']=qs[_0xd0f4('0x3c')](_0x52a22a[_0xd0f4('0x35')][_0xd0f4('0x3c')]);_0x4f7fd3[_0xd0f4('0x3d')]=qs[_0xd0f4('0x3e')](_[_0xd0f4('0x3f')](_0x52a22a['query'],_0x22f599[_0xd0f4('0x3e')]),_0x3a024c);if(_0x52a22a[_0xd0f4('0x35')][_0xd0f4('0x40')]){_0x4f7fd3['where']=_[_0xd0f4('0x41')](_0x4f7fd3[_0xd0f4('0x3d')],{'$or':_['map'](_0x3a024c,function(_0xeda633){if(_0xeda633[_0xd0f4('0x42')]!=='VIRTUAL'){var _0x5202d2={};_0x5202d2[_0xeda633[_0xd0f4('0x2e')]]={'$like':'%'+_0x52a22a[_0xd0f4('0x35')][_0xd0f4('0x40')]+'%'};return _0x5202d2;}})});}_0x4f7fd3=_['merge']({},_0x4f7fd3,_0x52a22a[_0xd0f4('0x43')]);var _0x4c9e28={'where':_0x4f7fd3[_0xd0f4('0x3d')]};return db['SmsQueue'][_0xd0f4('0x1e')](_0x4c9e28)[_0xd0f4('0x27')](function(_0x4492d1){_0x2973aa[_0xd0f4('0x1e')]=_0x4492d1;if(_0x52a22a['query'][_0xd0f4('0x44')]){_0x4f7fd3[_0xd0f4('0x45')]=[{'all':!![]}];}return db[_0xd0f4('0x31')]['findAll'](_0x4f7fd3);})['then'](function(_0x123df0){_0x2973aa[_0xd0f4('0x46')]=_0x123df0;return _0x2973aa;})[_0xd0f4('0x27')](respondWithFilteredResult(_0x4f92a9,_0x4f7fd3))[_0xd0f4('0x47')](handleError(_0x4f92a9,null));};exports[_0xd0f4('0x48')]=function(_0x2b8f94,_0x76a147){var _0x2a65e3={'raw':!![],'where':{'id':_0x2b8f94[_0xd0f4('0x49')]['id']}},_0x244d05={};_0x244d05[_0xd0f4('0x37')]=_[_0xd0f4('0x4a')](db['SmsQueue'][_0xd0f4('0x32')]);_0x244d05[_0xd0f4('0x35')]=_['keys'](_0x2b8f94[_0xd0f4('0x35')]);_0x244d05[_0xd0f4('0x3e')]=_[_0xd0f4('0x36')](_0x244d05[_0xd0f4('0x37')],_0x244d05[_0xd0f4('0x35')]);_0x2a65e3[_0xd0f4('0x38')]=_[_0xd0f4('0x36')](_0x244d05['model'],qs[_0xd0f4('0x39')](_0x2b8f94[_0xd0f4('0x35')][_0xd0f4('0x39')]));_0x2a65e3['attributes']=_0x2a65e3[_0xd0f4('0x38')][_0xd0f4('0x4b')]?_0x2a65e3[_0xd0f4('0x38')]:_0x244d05[_0xd0f4('0x37')];if(_0x2b8f94[_0xd0f4('0x35')][_0xd0f4('0x44')]){_0x2a65e3['include']=[{'all':!![]}];}_0x2a65e3=_['merge']({},_0x2a65e3,_0x2b8f94[_0xd0f4('0x43')]);return db[_0xd0f4('0x31')][_0xd0f4('0x4c')](_0x2a65e3)[_0xd0f4('0x27')](handleEntityNotFound(_0x76a147,null))['then'](respondWithResult(_0x76a147,null))[_0xd0f4('0x47')](handleError(_0x76a147,null));};exports[_0xd0f4('0x4d')]=function(_0x4c378f,_0x5c9549){return db[_0xd0f4('0x31')][_0xd0f4('0x4d')](_0x4c378f[_0xd0f4('0x4e')],{})[_0xd0f4('0x27')](function(_0x41783e){var _0x3c8f78=_0x4c378f[_0xd0f4('0x4f')][_0xd0f4('0x50')]({'plain':!![]});if(!_0x3c8f78)throw new Error(_0xd0f4('0x51'));if(_0x3c8f78[_0xd0f4('0x52')]===_0xd0f4('0x4f')){var _0x3c7389=_0x41783e['get']({'plain':!![]});var _0x15e648=_0xd0f4('0x29');return db[_0xd0f4('0x53')]['find']({'where':{'name':_0x15e648,'userProfileId':_0x3c8f78[_0xd0f4('0x54')]},'raw':!![]})[_0xd0f4('0x27')](function(_0x1d8543){if(_0x1d8543&&_0x1d8543['autoAssociation']===0x0){return db[_0xd0f4('0x2a')]['create']({'name':_0x3c7389[_0xd0f4('0x2e')],'resourceId':_0x3c7389['id'],'type':_0x1d8543['name'],'sectionId':_0x1d8543['id']},{})['then'](function(){return _0x41783e;});}else{return _0x41783e;}})[_0xd0f4('0x47')](function(_0x2f16e4){logger[_0xd0f4('0x55')](_0xd0f4('0x56'),_0x2f16e4);throw _0x2f16e4;});}return _0x41783e;})[_0xd0f4('0x27')](respondWithResult(_0x5c9549,0xc9))[_0xd0f4('0x47')](handleError(_0x5c9549,null));};exports['update']=function(_0x217294,_0xfa6554){if(_0x217294[_0xd0f4('0x4e')]['id']){delete _0x217294[_0xd0f4('0x4e')]['id'];}return db[_0xd0f4('0x31')][_0xd0f4('0x4c')]({'where':{'id':_0x217294['params']['id']}})[_0xd0f4('0x27')](handleEntityNotFound(_0xfa6554,null))['then'](saveUpdates(_0x217294['body'],null))[_0xd0f4('0x27')](respondWithResult(_0xfa6554,null))[_0xd0f4('0x47')](handleError(_0xfa6554,null));};exports[_0xd0f4('0x28')]=function(_0x4ae27c,_0x1ccf7a){return db[_0xd0f4('0x31')][_0xd0f4('0x4c')]({'where':{'id':_0x4ae27c[_0xd0f4('0x49')]['id']}})[_0xd0f4('0x27')](handleEntityNotFound(_0x1ccf7a,null))[_0xd0f4('0x27')](removeEntity(_0x1ccf7a,null))[_0xd0f4('0x47')](handleError(_0x1ccf7a,null));};exports[_0xd0f4('0x57')]=function(_0x3137e7,_0x3cb0aa){return db['SmsQueue'][_0xd0f4('0x57')]()[_0xd0f4('0x27')](respondWithResult(_0x3cb0aa,null))[_0xd0f4('0x47')](handleError(_0x3cb0aa,null));};exports[_0xd0f4('0x58')]=function(_0x4c33e1,_0xb83d39,_0x14218f){var _0x842273={'raw':!![],'where':{}},_0x43c6c9={},_0x39f79c;return db[_0xd0f4('0x31')]['findOne']({'where':{'id':_0x4c33e1['params']['id']}})[_0xd0f4('0x27')](handleEntityNotFound(_0xb83d39,null))[_0xd0f4('0x27')](function(_0x20d658){if(_0x20d658){_0x39f79c=_0x20d658[_0xd0f4('0x50')]({'plain':!![]});_0x43c6c9[_0xd0f4('0x37')]=_[_0xd0f4('0x4a')](db['UserSmsQueue'][_0xd0f4('0x32')]);_0x43c6c9[_0xd0f4('0x35')]=_[_0xd0f4('0x4a')](_0x4c33e1['query']);_0x43c6c9[_0xd0f4('0x3e')]=_[_0xd0f4('0x36')](_0x43c6c9['model'],_0x43c6c9['query']);_0x842273[_0xd0f4('0x38')]=_['intersection'](_0x43c6c9[_0xd0f4('0x37')],qs[_0xd0f4('0x39')](_0x4c33e1['query'][_0xd0f4('0x39')]));_0x842273[_0xd0f4('0x38')]=_0x842273['attributes'][_0xd0f4('0x4b')]?_0x842273[_0xd0f4('0x38')]:_0x43c6c9[_0xd0f4('0x37')];if(!_0x4c33e1['query']['hasOwnProperty'](_0xd0f4('0x3b'))){_0x842273[_0xd0f4('0x20')]=qs['limit'](_0x4c33e1[_0xd0f4('0x35')][_0xd0f4('0x20')]);_0x842273['offset']=qs[_0xd0f4('0x1f')](_0x4c33e1[_0xd0f4('0x35')][_0xd0f4('0x1f')]);}_0x842273[_0xd0f4('0x59')]=qs[_0xd0f4('0x3c')](_0x4c33e1['query'][_0xd0f4('0x3c')]);_0x842273['where']=qs[_0xd0f4('0x3e')](_[_0xd0f4('0x3f')](_0x4c33e1[_0xd0f4('0x35')],_0x43c6c9[_0xd0f4('0x3e')]));_0x842273[_0xd0f4('0x3d')]['SmsQueueId']=_0x20d658['id'];if(_0x4c33e1['query']['filter']){_0x842273[_0xd0f4('0x3d')]=_[_0xd0f4('0x41')](_0x842273[_0xd0f4('0x3d')],{'$or':_[_0xd0f4('0x30')](_0x842273[_0xd0f4('0x38')],function(_0xf430bb){var _0x3d9370={};_0x3d9370[_0xf430bb]={'$like':'%'+_0x4c33e1[_0xd0f4('0x35')][_0xd0f4('0x40')]+'%'};return _0x3d9370;})});}_0x842273=_[_0xd0f4('0x41')]({},_0x842273,_0x4c33e1[_0xd0f4('0x43')]);return db[_0xd0f4('0x5a')]['findAll'](_0x842273);}})['then'](function(_0x3b7c6f){if(_0x3b7c6f){return db['User'][_0xd0f4('0x5b')]({'where':{'id':_['map'](_0x3b7c6f,_0xd0f4('0x5c')),'role':'agent'},'attributes':['id',_0xd0f4('0x2e'),_0xd0f4('0x5d'),_0xd0f4('0x5e'),_0xd0f4('0x5f')]});}})['then'](function(_0xca7aa7){if(_0xca7aa7){return{'count':_0xca7aa7['count'],'rows':_[_0xd0f4('0x30')](_0xca7aa7[_0xd0f4('0x46')],function(_0x348fe4){return{'membername':_0x348fe4[_0xd0f4('0x2e')],'UserId':_0x348fe4['id'],'queue_name':_0x39f79c[_0xd0f4('0x2e')],'SmsQueueId':_0x39f79c['id'],'interface':util[_0xd0f4('0x60')](_0xd0f4('0x61'),_0xd0f4('0x62'),_0x348fe4[_0xd0f4('0x2e')]),'penalty':0x0,'paused':_0x348fe4[_0xd0f4('0x5d')],'createdAt':_0x348fe4[_0xd0f4('0x5f')],'updatedAt':_0x348fe4[_0xd0f4('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xb83d39,_0x842273))[_0xd0f4('0x47')](handleError(_0xb83d39,null));};exports[_0xd0f4('0x63')]=function(_0x5eed6a,_0x5cd6c4,_0x4c4fa7){var _0x364266={};var _0x3a6300={};var _0x177e0c;var _0x517b05;return db[_0xd0f4('0x31')][_0xd0f4('0x64')]({'where':{'id':_0x5eed6a[_0xd0f4('0x49')]['id']}})[_0xd0f4('0x27')](handleEntityNotFound(_0x5cd6c4,null))[_0xd0f4('0x27')](function(_0x53c12a){if(_0x53c12a){_0x177e0c=_0x53c12a;_0x3a6300[_0xd0f4('0x37')]=_[_0xd0f4('0x4a')](db['Team'][_0xd0f4('0x32')]);_0x3a6300[_0xd0f4('0x35')]=_['keys'](_0x5eed6a['query']);_0x3a6300['filters']=_[_0xd0f4('0x36')](_0x3a6300[_0xd0f4('0x37')],_0x3a6300[_0xd0f4('0x35')]);_0x364266[_0xd0f4('0x38')]=_[_0xd0f4('0x36')](_0x3a6300[_0xd0f4('0x37')],qs[_0xd0f4('0x39')](_0x5eed6a[_0xd0f4('0x35')][_0xd0f4('0x39')]));_0x364266[_0xd0f4('0x38')]=_0x364266[_0xd0f4('0x38')][_0xd0f4('0x4b')]?_0x364266['attributes']:_0x3a6300[_0xd0f4('0x37')];_0x364266[_0xd0f4('0x59')]=qs[_0xd0f4('0x3c')](_0x5eed6a[_0xd0f4('0x35')]['sort']);_0x364266[_0xd0f4('0x3d')]=qs[_0xd0f4('0x3e')](_[_0xd0f4('0x3f')](_0x5eed6a[_0xd0f4('0x35')],_0x3a6300['filters']));if(_0x5eed6a['query'][_0xd0f4('0x40')]){_0x364266['where']=_[_0xd0f4('0x41')](_0x364266[_0xd0f4('0x3d')],{'$or':_[_0xd0f4('0x30')](_0x364266['attributes'],function(_0xcbb144){var _0x1f67c9={};_0x1f67c9[_0xcbb144]={'$like':'%'+_0x5eed6a[_0xd0f4('0x35')][_0xd0f4('0x40')]+'%'};return _0x1f67c9;})});}_0x364266=_[_0xd0f4('0x41')]({},_0x364266,_0x5eed6a[_0xd0f4('0x43')]);return _0x177e0c[_0xd0f4('0x63')](_0x364266);}})[_0xd0f4('0x27')](function(_0x118989){if(_0x118989){_0x517b05=_0x118989[_0xd0f4('0x4b')];if(!_0x5eed6a[_0xd0f4('0x35')][_0xd0f4('0x3a')](_0xd0f4('0x3b'))){_0x364266[_0xd0f4('0x20')]=qs[_0xd0f4('0x20')](_0x5eed6a[_0xd0f4('0x35')][_0xd0f4('0x20')]);_0x364266[_0xd0f4('0x1f')]=qs[_0xd0f4('0x1f')](_0x5eed6a[_0xd0f4('0x35')][_0xd0f4('0x1f')]);}return _0x177e0c[_0xd0f4('0x63')](_0x364266);}})[_0xd0f4('0x27')](function(_0x2ebf99){if(_0x2ebf99){return _0x2ebf99?{'count':_0x517b05,'rows':_0x2ebf99}:null;}})[_0xd0f4('0x27')](respondWithResult(_0x5cd6c4,null))[_0xd0f4('0x47')](handleError(_0x5cd6c4,null));};exports[_0xd0f4('0x65')]=function(_0x554fa0,_0x55e0c0,_0x5efb96){var _0x37660c=_0x554fa0['body'][_0xd0f4('0x66')];return db['Team'][_0xd0f4('0x67')]({'where':{'id':_0x37660c},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd0f4('0x68'),'attributes':['id',_0xd0f4('0x2e'),_0xd0f4('0x69'),_0xd0f4('0x6a'),_0xd0f4('0x6b')],'raw':!![]}]})[_0xd0f4('0x27')](function(_0x448230){if(_0x448230){var _0x5c739d=_[_0xd0f4('0x6c')](_0x448230,function(_0x46fc20){var _0x6d9fc4=_0x46fc20[_0xd0f4('0x50')]({'plain':!![]});return _0x6d9fc4[_0xd0f4('0x68')];});return db[_0xd0f4('0x31')][_0xd0f4('0x4c')]({'where':{'id':_0x554fa0['params']['id']}})[_0xd0f4('0x27')](function(_0x5f23d2){return db['sequelize'][_0xd0f4('0x6d')](function(_0x4a933d){return _0x5f23d2[_0xd0f4('0x65')](_0x37660c,{'transaction':_0x4a933d})[_0xd0f4('0x27')](function(){return BPromise[_0xd0f4('0x6e')](_0x5c739d,function(_0x2d5b3c){return db[_0xd0f4('0x5a')][_0xd0f4('0x6f')]({'where':{'UserId':_0x2d5b3c['id'],'SmsQueueId':_0x554fa0[_0xd0f4('0x49')]['id']},'transaction':_0x4a933d});});})[_0xd0f4('0x27')](function(){_0x5c739d[_0xd0f4('0x70')](function(_0xb38921){socket[_0xd0f4('0x71')](_0xd0f4('0x72'),{'UserId':_0xb38921['id'],'SmsQueueId':_0x5f23d2['id']});});});});});}})[_0xd0f4('0x27')](respondWithStatusCode(_0x55e0c0,null))[_0xd0f4('0x47')](handleError(_0x55e0c0,null));};exports[_0xd0f4('0x73')]=function(_0x4fa8cd,_0x545a45,_0xaa8a15){return db[_0xd0f4('0x74')]['findAll']({'where':{'id':_0x4fa8cd[_0xd0f4('0x35')][_0xd0f4('0x66')]},'attributes':['id'],'include':[{'model':db[_0xd0f4('0x75')],'as':_0xd0f4('0x68'),'attributes':['id'],'raw':!![]}]})[_0xd0f4('0x27')](handleEntityNotFound(_0x545a45,null))[_0xd0f4('0x27')](function(_0x3fd476){var _0x28e689=_[_0xd0f4('0x30')](_0x3fd476,'id');var _0x449571=[];var _0x3ebeb0=[];var _0x23a765=squel['select']();_0x23a765[_0xd0f4('0x76')](_0xd0f4('0x77'))[_0xd0f4('0x78')](_0xd0f4('0x79'),'tq')['join']('user_has_teams','ut',_0xd0f4('0x7a'))[_0xd0f4('0x3d')](_0xd0f4('0x7b'),_0x4fa8cd[_0xd0f4('0x49')]['id']);for(var _0x20a2ac=0x0;_0x20a2ac<_0x3fd476['length'];_0x20a2ac+=0x1){let _0x2b8035=_0x3fd476[_0x20a2ac];for(var _0x393821=0x0;_0x393821<_0x2b8035[_0xd0f4('0x68')][_0xd0f4('0x4b')];_0x393821+=0x1){let _0x872301=_0x2b8035[_0xd0f4('0x68')][_0x393821];var _0x2aa213=_0x23a765[_0xd0f4('0x7c')]();_0x2aa213['where'](_0xd0f4('0x7d'),_0x872301['id']);_0x3ebeb0[_0xd0f4('0x7e')](db[_0xd0f4('0x7f')][_0xd0f4('0x35')](_0x2aa213[_0xd0f4('0x80')](),{'type':db[_0xd0f4('0x7f')][_0xd0f4('0x81')][_0xd0f4('0x82')]})[_0xd0f4('0x27')](function(_0x3876f7){if(_0x3876f7[_0xd0f4('0x4b')]===0x1){return _0x872301['id'];}else{var _0x3e0b37=_[_0xd0f4('0x83')](_[_0xd0f4('0x30')](_0x3876f7,_0xd0f4('0x84')),function(_0x183475){return _['includes'](_0x28e689,_0x183475);});if(_0x3e0b37){return _0x872301['id'];}}}));}}return BPromise[_0xd0f4('0x85')](_0x3ebeb0)[_0xd0f4('0x27')](function(_0x1b1fd4){_0x449571=_(_0x449571)[_0xd0f4('0x86')](_0x1b1fd4)[_0xd0f4('0x87')]()[_0xd0f4('0x88')]();return db[_0xd0f4('0x31')][_0xd0f4('0x4c')]({'where':{'id':_0x4fa8cd[_0xd0f4('0x49')]['id']}})[_0xd0f4('0x27')](function(_0x56e7eb){return db[_0xd0f4('0x7f')]['transaction'](function(_0x2e7320){return _0x56e7eb[_0xd0f4('0x73')](_0x4fa8cd['query']['ids'],{'transaction':_0x2e7320})[_0xd0f4('0x27')](function(){if(!_['isEmpty'](_0x449571)){return _0x56e7eb[_0xd0f4('0x89')](_0x449571,{'transaction':_0x2e7320});}})[_0xd0f4('0x27')](function(){_0x449571['forEach'](function(_0x467fd1){socket[_0xd0f4('0x71')](_0xd0f4('0x8a'),{'UserId':_0x467fd1,'SmsQueueId':_0x56e7eb['id']});});});});});});})[_0xd0f4('0x27')](respondWithStatusCode(_0x545a45,null))[_0xd0f4('0x47')](handleError(_0x545a45,null));};exports[_0xd0f4('0x8b')]=function(_0x956e37,_0x1a6f61,_0x2626f9){return db[_0xd0f4('0x31')][_0xd0f4('0x4c')]({'where':{'id':_0x956e37['params']['id']}})[_0xd0f4('0x27')](handleEntityNotFound(_0x1a6f61,null))['then'](function(_0x175f7a){if(_0x175f7a){return _0x175f7a['addAgents'](_0x956e37['body'][_0xd0f4('0x66')],_[_0xd0f4('0x8c')](_0x956e37[_0xd0f4('0x4e')],[_0xd0f4('0x66'),'id'])||{})[_0xd0f4('0x8d')](function(_0x228cf0){for(var _0x4c3df4=0x0;_0x4c3df4<_0x956e37[_0xd0f4('0x4e')][_0xd0f4('0x66')][_0xd0f4('0x4b')];_0x4c3df4+=0x1){socket[_0xd0f4('0x71')](_0xd0f4('0x72'),{'UserId':_0x956e37[_0xd0f4('0x4e')][_0xd0f4('0x66')][_0x4c3df4],'SmsQueueId':_0x956e37[_0xd0f4('0x49')]['id']});}return _0x228cf0;});}})[_0xd0f4('0x27')](respondWithResult(_0x1a6f61,null))[_0xd0f4('0x47')](handleError(_0x1a6f61,null));};exports[_0xd0f4('0x89')]=function(_0x45b4c3,_0x2bba97,_0x3ec4d1){return db[_0xd0f4('0x31')][_0xd0f4('0x4c')]({'where':{'id':_0x45b4c3[_0xd0f4('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bba97,null))[_0xd0f4('0x27')](function(_0x26fb87){if(_0x26fb87){return _0x26fb87[_0xd0f4('0x89')](_0x45b4c3[_0xd0f4('0x35')][_0xd0f4('0x66')])[_0xd0f4('0x27')](function(){if(_[_0xd0f4('0x8e')](_0x45b4c3[_0xd0f4('0x35')][_0xd0f4('0x66')])){for(var _0x468f7a=0x0;_0x468f7a<_0x45b4c3['query'][_0xd0f4('0x66')][_0xd0f4('0x4b')];_0x468f7a+=0x1){socket[_0xd0f4('0x71')](_0xd0f4('0x8a'),{'UserId':Number(_0x45b4c3['query']['ids'][_0x468f7a]),'SmsQueueId':Number(_0x45b4c3['params']['id'])});}}else{socket[_0xd0f4('0x71')](_0xd0f4('0x8a'),{'UserId':Number(_0x45b4c3[_0xd0f4('0x35')][_0xd0f4('0x66')]),'SmsQueueId':Number(_0x45b4c3[_0xd0f4('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x2bba97,null))[_0xd0f4('0x47')](handleError(_0x2bba97,null));};exports[_0xd0f4('0x8f')]=function(_0xcea4ab,_0x1fad55,_0x50864e){var _0x27db37={};var _0x481c4d={};var _0x576313;var _0x1a9294;return db[_0xd0f4('0x31')][_0xd0f4('0x64')]({'where':{'id':_0xcea4ab['params']['id']}})['then'](handleEntityNotFound(_0x1fad55,null))[_0xd0f4('0x27')](function(_0x2c2302){if(_0x2c2302){_0x576313=_0x2c2302;_0x481c4d[_0xd0f4('0x37')]=_['keys'](db[_0xd0f4('0x75')][_0xd0f4('0x32')]);_0x481c4d[_0xd0f4('0x35')]=_[_0xd0f4('0x4a')](_0xcea4ab['query']);_0x481c4d[_0xd0f4('0x3e')]=_['intersection'](_0x481c4d[_0xd0f4('0x37')],_0x481c4d[_0xd0f4('0x35')]);_0x27db37[_0xd0f4('0x38')]=_[_0xd0f4('0x36')](_0x481c4d['model'],qs[_0xd0f4('0x39')](_0xcea4ab['query']['fields']));_0x27db37['attributes']=_0x27db37[_0xd0f4('0x38')]['length']?_0x27db37[_0xd0f4('0x38')]:_0x481c4d[_0xd0f4('0x37')];_0x27db37[_0xd0f4('0x59')]=qs[_0xd0f4('0x3c')](_0xcea4ab[_0xd0f4('0x35')]['sort']);_0x27db37[_0xd0f4('0x3d')]=qs[_0xd0f4('0x3e')](_[_0xd0f4('0x3f')](_0xcea4ab[_0xd0f4('0x35')],_0x481c4d[_0xd0f4('0x3e')]));if(_0xcea4ab[_0xd0f4('0x35')][_0xd0f4('0x40')]){_0x27db37[_0xd0f4('0x3d')]=_[_0xd0f4('0x41')](_0x27db37['where'],{'$or':_['map'](_0x27db37[_0xd0f4('0x38')],function(_0x400a13){var _0x1d3918={};_0x1d3918[_0x400a13]={'$like':'%'+_0xcea4ab[_0xd0f4('0x35')]['filter']+'%'};return _0x1d3918;})});}_0x27db37=_['merge']({},_0x27db37,_0xcea4ab[_0xd0f4('0x43')]);return _0x576313['getAgents'](_0x27db37);}})[_0xd0f4('0x27')](function(_0x223070){if(_0x223070){_0x1a9294=_0x223070['length'];if(!_0xcea4ab[_0xd0f4('0x35')]['hasOwnProperty'](_0xd0f4('0x3b'))){_0x27db37['limit']=qs['limit'](_0xcea4ab[_0xd0f4('0x35')][_0xd0f4('0x20')]);_0x27db37[_0xd0f4('0x1f')]=qs[_0xd0f4('0x1f')](_0xcea4ab[_0xd0f4('0x35')][_0xd0f4('0x1f')]);}return _0x576313[_0xd0f4('0x8f')](_0x27db37);}})[_0xd0f4('0x27')](function(_0xc2e77a){if(_0xc2e77a){return _0xc2e77a?{'count':_0x1a9294,'rows':_0xc2e77a}:null;}})[_0xd0f4('0x27')](respondWithResult(_0x1fad55,null))[_0xd0f4('0x47')](handleError(_0x1fad55,null));}; \ No newline at end of file +var _0x814b=['union','value','removeAgents','addAgents','omit','spread','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','get','SmsQueues','UserProfileResource','error','name','send','map','SmsQueue','fieldName','type','model','query','keys','filters','attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','count','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','describe','UserSmsQueue','hasOwnProperty','sort','pick','SmsQueueId','User','findAndCountAll','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all'];(function(_0x19bd5b,_0x439291){var _0x2ee998=function(_0x5df139){while(--_0x5df139){_0x19bd5b['push'](_0x19bd5b['shift']());}};_0x2ee998(++_0x439291);}(_0x814b,0x1a2));var _0xb814=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x814b[_0x31bab3];return _0x4fd382;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');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('0xb'));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'];config[_0xb814('0x1b')]=_[_0xb814('0x1c')](config[_0xb814('0x1b')],{'host':_0xb814('0x1d'),'port':0x18eb});var socket=require(_0xb814('0x1e'))(new Redis(config[_0xb814('0x1b')]));require(_0xb814('0x1f'))[_0xb814('0x20')](socket);function respondWithStatusCode(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xcc;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x21')](_0x44fb96);}return _0x3f4881[_0xb814('0x22')](_0x44fb96)[_0xb814('0x23')]();};}function respondWithResult(_0x45e0d0,_0x265a83){_0x265a83=_0x265a83||0xc8;return function(_0x125ce2){if(_0x125ce2){return _0x45e0d0[_0xb814('0x22')](_0x265a83)[_0xb814('0x24')](_0x125ce2);}};}function respondWithFilteredResult(_0x48c9df,_0x168a48){return function(_0x55ba16){if(_0x55ba16){var _0x270598=_0x55ba16['count'],_0xfac75b=_0x168a48[_0xb814('0x25')],_0x4c3007=_0x168a48['offset']+_0x168a48['limit'],_0x4b55a7;if(_0x4c3007>=_0x270598){_0x4c3007=_0x270598;_0x4b55a7=0xc8;}else{_0x4b55a7=0xce;}_0x48c9df[_0xb814('0x22')](_0x4b55a7);return _0x48c9df[_0xb814('0x26')](_0xb814('0x27'),_0xfac75b+'-'+_0x4c3007+'/'+_0x270598)['json'](_0x55ba16);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x28')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x29')](_0x1808a3);}return _0x531032[_0xb814('0x2a')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x2b')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x2c')]()[_0xb814('0x2b')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2d')]({'plain':!![]});var _0x5755ea=_0xb814('0x2e');return db[_0xb814('0x2f')][_0xb814('0x2c')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x2b')](function(){return _0x31c7ec;});})[_0xb814('0x2b')](function(){_0x3f81d0[_0xb814('0x22')](0xcc)[_0xb814('0x23')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x21')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x30')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x31')]){delete _0x37d24d[_0xb814('0x31')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x32')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x33')](db[_0xb814('0x34')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x35')],'type':_0x51d5ae[_0xb814('0x36')]['key']};});_0x419cd9[_0xb814('0x37')]=_[_0xb814('0x33')](_0x2431e2,_0xb814('0x31'));_0x419cd9[_0xb814('0x38')]=_[_0xb814('0x39')](_0x6efe9a[_0xb814('0x38')]);_0x419cd9[_0xb814('0x3a')]=_['intersection'](_0x419cd9[_0xb814('0x37')],_0x419cd9[_0xb814('0x38')]);_0x4cfc58[_0xb814('0x3b')]=_[_0xb814('0x3c')](_0x419cd9[_0xb814('0x37')],qs['fields'](_0x6efe9a[_0xb814('0x38')]['fields']));_0x4cfc58[_0xb814('0x3b')]=_0x4cfc58[_0xb814('0x3b')][_0xb814('0x3d')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x37')];if(!_0x6efe9a[_0xb814('0x38')]['hasOwnProperty'](_0xb814('0x3e'))){_0x4cfc58[_0xb814('0x3f')]=qs[_0xb814('0x3f')](_0x6efe9a[_0xb814('0x38')][_0xb814('0x3f')]);_0x4cfc58[_0xb814('0x25')]=qs['offset'](_0x6efe9a[_0xb814('0x38')]['offset']);}_0x4cfc58[_0xb814('0x40')]=qs['sort'](_0x6efe9a[_0xb814('0x38')]['sort']);_0x4cfc58[_0xb814('0x41')]=qs[_0xb814('0x3a')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58[_0xb814('0x41')]=_[_0xb814('0x43')](_0x4cfc58[_0xb814('0x41')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x36')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x31')]]={'$like':'%'+_0x6efe9a[_0xb814('0x38')][_0xb814('0x42')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x43')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x44')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x41')]};return db[_0xb814('0x34')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x45')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x46')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x34')][_0xb814('0x47')](_0x4cfc58);})[_0xb814('0x2b')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x2b')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x48')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x49')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x4a')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x37')]=_[_0xb814('0x39')](db[_0xb814('0x34')][_0xb814('0x4b')]);_0x534eb8[_0xb814('0x38')]=_[_0xb814('0x39')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x3c')](_0x534eb8[_0xb814('0x37')],_0x534eb8[_0xb814('0x38')]);_0x450a08[_0xb814('0x3b')]=_[_0xb814('0x3c')](_0x534eb8[_0xb814('0x37')],qs[_0xb814('0x4c')](_0x22cf27[_0xb814('0x38')][_0xb814('0x4c')]));_0x450a08[_0xb814('0x3b')]=_0x450a08[_0xb814('0x3b')]['length']?_0x450a08[_0xb814('0x3b')]:_0x534eb8[_0xb814('0x37')];if(_0x22cf27['query'][_0xb814('0x46')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x43')]({},_0x450a08,_0x22cf27[_0xb814('0x44')]);return db[_0xb814('0x34')][_0xb814('0x4d')](_0x450a08)[_0xb814('0x2b')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x2b')](respondWithResult(_0x7d92aa,null))[_0xb814('0x48')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4e')]=function(_0x32a397,_0x2a422a){return db['SmsQueue']['create'](_0x32a397[_0xb814('0x4f')],{})[_0xb814('0x2b')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x50')][_0xb814('0x2d')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x51'));if(_0x3f8e29['role']===_0xb814('0x50')){var _0x388324=_0x4156d8[_0xb814('0x2d')]({'plain':!![]});var _0x5a916d=_0xb814('0x2e');return db['UserProfileSection'][_0xb814('0x4d')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x2b')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2f')][_0xb814('0x4e')]({'name':_0x388324[_0xb814('0x31')],'resourceId':_0x388324['id'],'type':_0x3cf8f8['name'],'sectionId':_0x3cf8f8['id']},{})[_0xb814('0x2b')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x2b')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4f')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x34')]['find']({'where':{'id':_0x3b9709[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4f')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x48')](handleError(_0x35f59a,null));};exports[_0xb814('0x2c')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x34')][_0xb814('0x4d')]({'where':{'id':_0xb2bd82[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x48')](handleError(_0x113fe5,null));};exports[_0xb814('0x52')]=function(_0x5d71d5,_0x29a127){return db[_0xb814('0x34')]['describe']()[_0xb814('0x2b')](respondWithResult(_0x29a127,null))['catch'](handleError(_0x29a127,null));};exports['getMembers']=function(_0x2114ca,_0x5257be,_0x3ff213){var _0xd1cd8b={'raw':!![],'where':{}},_0x2dec52={},_0x586957;return db[_0xb814('0x34')]['findOne']({'where':{'id':_0x2114ca[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x5257be,null))[_0xb814('0x2b')](function(_0x176585){if(_0x176585){_0x586957=_0x176585[_0xb814('0x2d')]({'plain':!![]});_0x2dec52[_0xb814('0x37')]=_[_0xb814('0x39')](db[_0xb814('0x53')][_0xb814('0x4b')]);_0x2dec52['query']=_[_0xb814('0x39')](_0x2114ca[_0xb814('0x38')]);_0x2dec52[_0xb814('0x3a')]=_[_0xb814('0x3c')](_0x2dec52[_0xb814('0x37')],_0x2dec52[_0xb814('0x38')]);_0xd1cd8b['attributes']=_[_0xb814('0x3c')](_0x2dec52['model'],qs[_0xb814('0x4c')](_0x2114ca[_0xb814('0x38')][_0xb814('0x4c')]));_0xd1cd8b['attributes']=_0xd1cd8b[_0xb814('0x3b')]['length']?_0xd1cd8b[_0xb814('0x3b')]:_0x2dec52['model'];if(!_0x2114ca[_0xb814('0x38')][_0xb814('0x54')](_0xb814('0x3e'))){_0xd1cd8b[_0xb814('0x3f')]=qs[_0xb814('0x3f')](_0x2114ca[_0xb814('0x38')][_0xb814('0x3f')]);_0xd1cd8b['offset']=qs[_0xb814('0x25')](_0x2114ca['query'][_0xb814('0x25')]);}_0xd1cd8b[_0xb814('0x40')]=qs[_0xb814('0x55')](_0x2114ca[_0xb814('0x38')][_0xb814('0x55')]);_0xd1cd8b[_0xb814('0x41')]=qs['filters'](_[_0xb814('0x56')](_0x2114ca[_0xb814('0x38')],_0x2dec52['filters']));_0xd1cd8b[_0xb814('0x41')][_0xb814('0x57')]=_0x176585['id'];if(_0x2114ca[_0xb814('0x38')][_0xb814('0x42')]){_0xd1cd8b[_0xb814('0x41')]=_['merge'](_0xd1cd8b[_0xb814('0x41')],{'$or':_['map'](_0xd1cd8b[_0xb814('0x3b')],function(_0x16f8f2){var _0x2645f6={};_0x2645f6[_0x16f8f2]={'$like':'%'+_0x2114ca[_0xb814('0x38')][_0xb814('0x42')]+'%'};return _0x2645f6;})});}_0xd1cd8b=_[_0xb814('0x43')]({},_0xd1cd8b,_0x2114ca['options']);return db['UserSmsQueue']['findAll'](_0xd1cd8b);}})[_0xb814('0x2b')](function(_0x490e5c){if(_0x490e5c){return db[_0xb814('0x58')][_0xb814('0x59')]({'where':{'id':_[_0xb814('0x33')](_0x490e5c,'UserId'),'role':_0xb814('0x5a')},'attributes':['id',_0xb814('0x31'),_0xb814('0x5b'),'updatedAt',_0xb814('0x5c')]});}})[_0xb814('0x2b')](function(_0x1f39c0){if(_0x1f39c0){return{'count':_0x1f39c0[_0xb814('0x45')],'rows':_['map'](_0x1f39c0['rows'],function(_0x28eaf8){return{'membername':_0x28eaf8[_0xb814('0x31')],'UserId':_0x28eaf8['id'],'queue_name':_0x586957[_0xb814('0x31')],'SmsQueueId':_0x586957['id'],'interface':util[_0xb814('0x5d')](_0xb814('0x5e'),_0xb814('0x5f'),_0x28eaf8[_0xb814('0x31')]),'penalty':0x0,'paused':_0x28eaf8[_0xb814('0x5b')],'createdAt':_0x28eaf8[_0xb814('0x5c')],'updatedAt':_0x28eaf8[_0xb814('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb814('0x2b')](respondWithFilteredResult(_0x5257be,_0xd1cd8b))[_0xb814('0x48')](handleError(_0x5257be,null));};exports[_0xb814('0x61')]=function(_0x21fc41,_0xc94e99,_0x55a9c4){var _0x2332dc={};var _0x33cfc4={};var _0xfc9a65;var _0x357b90;return db[_0xb814('0x34')][_0xb814('0x62')]({'where':{'id':_0x21fc41['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0xc94e99,null))['then'](function(_0x872d43){if(_0x872d43){_0xfc9a65=_0x872d43;_0x33cfc4[_0xb814('0x37')]=_[_0xb814('0x39')](db[_0xb814('0x63')][_0xb814('0x4b')]);_0x33cfc4['query']=_['keys'](_0x21fc41[_0xb814('0x38')]);_0x33cfc4[_0xb814('0x3a')]=_[_0xb814('0x3c')](_0x33cfc4[_0xb814('0x37')],_0x33cfc4['query']);_0x2332dc[_0xb814('0x3b')]=_['intersection'](_0x33cfc4[_0xb814('0x37')],qs[_0xb814('0x4c')](_0x21fc41['query']['fields']));_0x2332dc[_0xb814('0x3b')]=_0x2332dc['attributes'][_0xb814('0x3d')]?_0x2332dc[_0xb814('0x3b')]:_0x33cfc4[_0xb814('0x37')];_0x2332dc[_0xb814('0x40')]=qs[_0xb814('0x55')](_0x21fc41[_0xb814('0x38')][_0xb814('0x55')]);_0x2332dc['where']=qs[_0xb814('0x3a')](_['pick'](_0x21fc41[_0xb814('0x38')],_0x33cfc4['filters']));if(_0x21fc41[_0xb814('0x38')][_0xb814('0x42')]){_0x2332dc['where']=_[_0xb814('0x43')](_0x2332dc['where'],{'$or':_[_0xb814('0x33')](_0x2332dc[_0xb814('0x3b')],function(_0x4e15c2){var _0x5a0c4a={};_0x5a0c4a[_0x4e15c2]={'$like':'%'+_0x21fc41[_0xb814('0x38')][_0xb814('0x42')]+'%'};return _0x5a0c4a;})});}_0x2332dc=_[_0xb814('0x43')]({},_0x2332dc,_0x21fc41[_0xb814('0x44')]);return _0xfc9a65[_0xb814('0x61')](_0x2332dc);}})[_0xb814('0x2b')](function(_0x2b12a9){if(_0x2b12a9){_0x357b90=_0x2b12a9[_0xb814('0x3d')];if(!_0x21fc41[_0xb814('0x38')][_0xb814('0x54')]('nolimit')){_0x2332dc['limit']=qs['limit'](_0x21fc41['query']['limit']);_0x2332dc[_0xb814('0x25')]=qs[_0xb814('0x25')](_0x21fc41[_0xb814('0x38')]['offset']);}return _0xfc9a65[_0xb814('0x61')](_0x2332dc);}})[_0xb814('0x2b')](function(_0x31c072){if(_0x31c072){return _0x31c072?{'count':_0x357b90,'rows':_0x31c072}:null;}})[_0xb814('0x2b')](respondWithResult(_0xc94e99,null))[_0xb814('0x48')](handleError(_0xc94e99,null));};exports[_0xb814('0x64')]=function(_0x3367b8,_0x1d9f13,_0x5cf5ad){var _0x20efc3=_0x3367b8[_0xb814('0x4f')][_0xb814('0x65')];return db[_0xb814('0x63')]['findAll']({'where':{'id':_0x20efc3},'attributes':['id'],'include':[{'model':db[_0xb814('0x58')],'as':_0xb814('0x66'),'attributes':['id',_0xb814('0x31'),_0xb814('0x67'),_0xb814('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x252f9c){if(_0x252f9c){var _0x57b3f2=_[_0xb814('0x69')](_0x252f9c,function(_0x3882f8){var _0x592aae=_0x3882f8[_0xb814('0x2d')]({'plain':!![]});return _0x592aae['Agents'];});return db[_0xb814('0x34')]['find']({'where':{'id':_0x3367b8[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](function(_0x41867b){return db[_0xb814('0x6a')][_0xb814('0x6b')](function(_0x1ae812){return _0x41867b[_0xb814('0x64')](_0x20efc3,{'transaction':_0x1ae812})['then'](function(){return BPromise['each'](_0x57b3f2,function(_0x21aa36){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x21aa36['id'],'SmsQueueId':_0x3367b8[_0xb814('0x4a')]['id']},'transaction':_0x1ae812});});})[_0xb814('0x2b')](function(){_0x57b3f2[_0xb814('0x6c')](function(_0x57bf1b){socket[_0xb814('0x6d')]('userSmsQueue:save',{'UserId':_0x57bf1b['id'],'SmsQueueId':_0x41867b['id']});});});});});}})[_0xb814('0x2b')](respondWithStatusCode(_0x1d9f13,null))[_0xb814('0x48')](handleError(_0x1d9f13,null));};exports[_0xb814('0x6e')]=function(_0x2d2b6c,_0x4c8a00,_0x1454b3){return db[_0xb814('0x63')][_0xb814('0x47')]({'where':{'id':_0x2d2b6c['query'][_0xb814('0x65')]},'attributes':['id'],'include':[{'model':db[_0xb814('0x58')],'as':_0xb814('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c8a00,null))[_0xb814('0x2b')](function(_0x2d0651){var _0x9dc06b=_[_0xb814('0x33')](_0x2d0651,'id');var _0x40b3c5=[];var _0x1ae8e8=[];var _0x37a7ab=squel[_0xb814('0x6f')]();_0x37a7ab[_0xb814('0x70')](_0xb814('0x71'))[_0xb814('0x72')](_0xb814('0x73'),'tq')[_0xb814('0x74')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb814('0x41')]('SmsQueueId\x20=\x20?',_0x2d2b6c[_0xb814('0x4a')]['id']);for(var _0x3949fd=0x0;_0x3949fd<_0x2d0651[_0xb814('0x3d')];_0x3949fd+=0x1){let _0x2bc95b=_0x2d0651[_0x3949fd];for(var _0x405db7=0x0;_0x405db7<_0x2bc95b[_0xb814('0x66')][_0xb814('0x3d')];_0x405db7+=0x1){let _0x5db5d0=_0x2bc95b['Agents'][_0x405db7];var _0x3f6df9=_0x37a7ab['clone']();_0x3f6df9[_0xb814('0x41')](_0xb814('0x75'),_0x5db5d0['id']);_0x1ae8e8[_0xb814('0x76')](db['sequelize'][_0xb814('0x38')](_0x3f6df9[_0xb814('0x77')](),{'type':db[_0xb814('0x6a')][_0xb814('0x78')][_0xb814('0x79')]})['then'](function(_0x59425f){if(_0x59425f[_0xb814('0x3d')]===0x1){return _0x5db5d0['id'];}else{var _0x4ac8c5=_[_0xb814('0x7a')](_[_0xb814('0x33')](_0x59425f,_0xb814('0x7b')),function(_0x4b96a6){return _[_0xb814('0x7c')](_0x9dc06b,_0x4b96a6);});if(_0x4ac8c5){return _0x5db5d0['id'];}}}));}}return BPromise[_0xb814('0x7d')](_0x1ae8e8)['then'](function(_0x32562d){_0x40b3c5=_(_0x40b3c5)[_0xb814('0x7e')](_0x32562d)['compact']()[_0xb814('0x7f')]();return db[_0xb814('0x34')][_0xb814('0x4d')]({'where':{'id':_0x2d2b6c[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](function(_0x2ee22e){return db[_0xb814('0x6a')][_0xb814('0x6b')](function(_0xb115ba){return _0x2ee22e[_0xb814('0x6e')](_0x2d2b6c[_0xb814('0x38')][_0xb814('0x65')],{'transaction':_0xb115ba})['then'](function(){if(!_['isEmpty'](_0x40b3c5)){return _0x2ee22e[_0xb814('0x80')](_0x40b3c5,{'transaction':_0xb115ba});}})['then'](function(){_0x40b3c5['forEach'](function(_0x3f2ff9){socket['emit']('userSmsQueue:remove',{'UserId':_0x3f2ff9,'SmsQueueId':_0x2ee22e['id']});});});});});});})['then'](respondWithStatusCode(_0x4c8a00,null))[_0xb814('0x48')](handleError(_0x4c8a00,null));};exports[_0xb814('0x81')]=function(_0x3341f5,_0x5eb4b1,_0xa721d3){return db['SmsQueue'][_0xb814('0x4d')]({'where':{'id':_0x3341f5[_0xb814('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5eb4b1,null))[_0xb814('0x2b')](function(_0x53467f){if(_0x53467f){return _0x53467f[_0xb814('0x81')](_0x3341f5[_0xb814('0x4f')][_0xb814('0x65')],_[_0xb814('0x82')](_0x3341f5[_0xb814('0x4f')],[_0xb814('0x65'),'id'])||{})[_0xb814('0x83')](function(_0x2b7abf){for(var _0x3a3b35=0x0;_0x3a3b35<_0x3341f5[_0xb814('0x4f')][_0xb814('0x65')][_0xb814('0x3d')];_0x3a3b35+=0x1){socket[_0xb814('0x6d')](_0xb814('0x84'),{'UserId':_0x3341f5[_0xb814('0x4f')]['ids'][_0x3a3b35],'SmsQueueId':_0x3341f5[_0xb814('0x4a')]['id']});}return _0x2b7abf;});}})[_0xb814('0x2b')](respondWithResult(_0x5eb4b1,null))['catch'](handleError(_0x5eb4b1,null));};exports[_0xb814('0x80')]=function(_0x552aae,_0x1868d9,_0x570191){return db['SmsQueue'][_0xb814('0x4d')]({'where':{'id':_0x552aae['params']['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x1868d9,null))['then'](function(_0xdf3e07){if(_0xdf3e07){return _0xdf3e07['removeAgents'](_0x552aae['query'][_0xb814('0x65')])[_0xb814('0x2b')](function(){if(_[_0xb814('0x85')](_0x552aae[_0xb814('0x38')][_0xb814('0x65')])){for(var _0x4339a2=0x0;_0x4339a2<_0x552aae[_0xb814('0x38')][_0xb814('0x65')][_0xb814('0x3d')];_0x4339a2+=0x1){socket[_0xb814('0x6d')](_0xb814('0x86'),{'UserId':Number(_0x552aae['query'][_0xb814('0x65')][_0x4339a2]),'SmsQueueId':Number(_0x552aae['params']['id'])});}}else{socket[_0xb814('0x6d')](_0xb814('0x86'),{'UserId':Number(_0x552aae[_0xb814('0x38')]['ids']),'SmsQueueId':Number(_0x552aae[_0xb814('0x4a')]['id'])});}});}})[_0xb814('0x2b')](respondWithStatusCode(_0x1868d9,null))[_0xb814('0x48')](handleError(_0x1868d9,null));};exports[_0xb814('0x87')]=function(_0x290718,_0x2972b9,_0x26ce1a){var _0x44588a={};var _0x1462fb={};var _0x11d14f;var _0x3b65c0;return db[_0xb814('0x34')][_0xb814('0x62')]({'where':{'id':_0x290718[_0xb814('0x4a')]['id']}})[_0xb814('0x2b')](handleEntityNotFound(_0x2972b9,null))['then'](function(_0x37dec4){if(_0x37dec4){_0x11d14f=_0x37dec4;_0x1462fb[_0xb814('0x37')]=_[_0xb814('0x39')](db['User']['rawAttributes']);_0x1462fb[_0xb814('0x38')]=_['keys'](_0x290718['query']);_0x1462fb['filters']=_['intersection'](_0x1462fb[_0xb814('0x37')],_0x1462fb[_0xb814('0x38')]);_0x44588a['attributes']=_[_0xb814('0x3c')](_0x1462fb[_0xb814('0x37')],qs[_0xb814('0x4c')](_0x290718[_0xb814('0x38')][_0xb814('0x4c')]));_0x44588a[_0xb814('0x3b')]=_0x44588a[_0xb814('0x3b')][_0xb814('0x3d')]?_0x44588a[_0xb814('0x3b')]:_0x1462fb[_0xb814('0x37')];_0x44588a[_0xb814('0x40')]=qs['sort'](_0x290718[_0xb814('0x38')]['sort']);_0x44588a[_0xb814('0x41')]=qs[_0xb814('0x3a')](_[_0xb814('0x56')](_0x290718[_0xb814('0x38')],_0x1462fb[_0xb814('0x3a')]));if(_0x290718[_0xb814('0x38')][_0xb814('0x42')]){_0x44588a[_0xb814('0x41')]=_['merge'](_0x44588a['where'],{'$or':_['map'](_0x44588a[_0xb814('0x3b')],function(_0x4a2e90){var _0x1f49eb={};_0x1f49eb[_0x4a2e90]={'$like':'%'+_0x290718[_0xb814('0x38')][_0xb814('0x42')]+'%'};return _0x1f49eb;})});}_0x44588a=_[_0xb814('0x43')]({},_0x44588a,_0x290718[_0xb814('0x44')]);return _0x11d14f[_0xb814('0x87')](_0x44588a);}})[_0xb814('0x2b')](function(_0x1a5685){if(_0x1a5685){_0x3b65c0=_0x1a5685['length'];if(!_0x290718['query'][_0xb814('0x54')](_0xb814('0x3e'))){_0x44588a[_0xb814('0x3f')]=qs[_0xb814('0x3f')](_0x290718[_0xb814('0x38')][_0xb814('0x3f')]);_0x44588a['offset']=qs[_0xb814('0x25')](_0x290718['query'][_0xb814('0x25')]);}return _0x11d14f[_0xb814('0x87')](_0x44588a);}})[_0xb814('0x2b')](function(_0x94aa05){if(_0x94aa05){return _0x94aa05?{'count':_0x3b65c0,'rows':_0x94aa05}:null;}})[_0xb814('0x2b')](respondWithResult(_0x2972b9,null))[_0xb814('0x48')](handleError(_0x2972b9,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 66cf65f..a994602 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 _0xab44=['../../mysqldb','save','update','remove','hook','exports','events'];(function(_0x3b2a21,_0x28df4f){var _0x450202=function(_0x2e0cfc){while(--_0x2e0cfc){_0x3b2a21['push'](_0x3b2a21['shift']());}};_0x450202(++_0x28df4f);}(_0xab44,0x1aa));var _0x4ab4=function(_0x708dfd,_0x119c1e){_0x708dfd=_0x708dfd-0x0;var _0xa78a78=_0xab44[_0x708dfd];return _0xa78a78;};'use strict';var EventEmitter=require(_0x4ab4('0x0'));var SmsQueue=require(_0x4ab4('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ab4('0x2'),'afterUpdate':_0x4ab4('0x3'),'afterDestroy':_0x4ab4('0x4')};function emitEvent(_0x2b144b){return function(_0x315467,_0x16515,_0xe1ccdd){SmsQueueEvents['emit'](_0x2b144b+':'+_0x315467['id'],_0x315467);SmsQueueEvents['emit'](_0x2b144b,_0x315467);_0xe1ccdd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x4ab4('0x5')](e,emitEvent(event));}}module[_0x4ab4('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0xc0f3=['emit','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','update'];(function(_0x288947,_0x38614b){var _0x531fd3=function(_0x440076){while(--_0x440076){_0x288947['push'](_0x288947['shift']());}};_0x531fd3(++_0x38614b);}(_0xc0f3,0x1d8));var _0x3c0f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc0f3[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x3c0f('0x0'))['db'][_0x3c0f('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3c0f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3c0f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x51a884){return function(_0x16c444,_0x3e0757,_0x268952){SmsQueueEvents[_0x3c0f('0x4')](_0x51a884+':'+_0x16c444['id'],_0x16c444);SmsQueueEvents[_0x3c0f('0x4')](_0x51a884,_0x16c444);_0x268952(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x3c0f('0x5')](e,emitEvent(event));}}module[_0x3c0f('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index cafcd91..7e369ce 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 _0x4417=['exports','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./smsQueue.attributes'];(function(_0x1fda1,_0x281e28){var _0xbbc8e6=function(_0xaa48e6){while(--_0xaa48e6){_0x1fda1['push'](_0x1fda1['shift']());}};_0xbbc8e6(++_0x281e28);}(_0x4417,0xa8));var _0x7441=function(_0x43f629,_0x4eee7a){_0x43f629=_0x43f629-0x0;var _0x3027aa=_0x4417[_0x43f629];return _0x3027aa;};'use strict';var _=require(_0x7441('0x0'));var util=require('util');var logger=require(_0x7441('0x1'))(_0x7441('0x2'));var moment=require(_0x7441('0x3'));var BPromise=require(_0x7441('0x4'));var rp=require(_0x7441('0x5'));var fs=require('fs');var path=require(_0x7441('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7441('0x7'));module[_0x7441('0x8')]=function(_0x120d8f,_0x295d0f){return _0x120d8f['define'](_0x7441('0x9'),attributes,{'tableName':_0x7441('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x60eb=['define','SmsQueue','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x46e0d2,_0x16abb8){var _0x314fae=function(_0x2884ad){while(--_0x2884ad){_0x46e0d2['push'](_0x46e0d2['shift']());}};_0x314fae(++_0x16abb8);}(_0x60eb,0x19a));var _0xb60e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x60eb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xb60e('0x0'));var logger=require(_0xb60e('0x1'))(_0xb60e('0x2'));var moment=require(_0xb60e('0x3'));var BPromise=require('bluebird');var rp=require(_0xb60e('0x4'));var fs=require('fs');var path=require(_0xb60e('0x5'));var rimraf=require(_0xb60e('0x6'));var config=require(_0xb60e('0x7'));var attributes=require(_0xb60e('0x8'));module[_0xb60e('0x9')]=function(_0x2916a2,_0x3e45b5){return _0x2916a2[_0xb60e('0xa')](_0xb60e('0xb'),attributes,{'tableName':'sms_queues','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 6dc124b..cca9ec9 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 _0xafc5=['ioredis','../../mysqldb','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','findAll','options','attributes','limit','include','model','map','catch','ShowSmsQueue','raw','util','moment','bluebird','randomstring'];(function(_0x5a1e9e,_0x40e663){var _0x26ece2=function(_0x31c4f6){while(--_0x31c4f6){_0x5a1e9e['push'](_0x5a1e9e['shift']());}};_0x26ece2(++_0x40e663);}(_0xafc5,0x84));var _0x5afc=function(_0x871039,_0x21ec60){_0x871039=_0x871039-0x0;var _0x4d66b8=_0xafc5[_0x871039];return _0x4d66b8;};'use strict';var _=require('lodash');var util=require(_0x5afc('0x0'));var moment=require(_0x5afc('0x1'));var BPromise=require(_0x5afc('0x2'));var rs=require(_0x5afc('0x3'));var fs=require('fs');var Redis=require(_0x5afc('0x4'));var db=require(_0x5afc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5afc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5afc('0x7')]({'port':0x232a});config[_0x5afc('0x8')]=_[_0x5afc('0x9')](config['redis'],{'host':_0x5afc('0xa'),'port':0x18eb});var socket=require(_0x5afc('0xb'))(new Redis(config[_0x5afc('0x8')]));require(_0x5afc('0xc'))['register'](socket);function respondWithRpcPromise(_0x322a23,_0x4a5f6a,_0x462432){return new BPromise(function(_0x20d52a,_0x21bc81){return client['request'](_0x322a23,_0x462432)[_0x5afc('0xd')](function(_0x15c62b){logger[_0x5afc('0xe')]('SmsQueue,\x20%s,\x20%s',_0x4a5f6a,_0x5afc('0xf'));logger['debug'](_0x5afc('0x10'),_0x4a5f6a,_0x5afc('0xf'),JSON[_0x5afc('0x11')](_0x15c62b));if(_0x15c62b[_0x5afc('0x12')]){if(_0x15c62b[_0x5afc('0x12')]['code']===0x1f4){logger[_0x5afc('0x12')](_0x5afc('0x13'),_0x4a5f6a,_0x15c62b[_0x5afc('0x12')][_0x5afc('0x14')]);return _0x21bc81(_0x15c62b[_0x5afc('0x12')]['message']);}logger[_0x5afc('0x12')](_0x5afc('0x13'),_0x4a5f6a,_0x15c62b[_0x5afc('0x12')]['message']);return _0x20d52a(_0x15c62b['error']['message']);}else{logger['info'](_0x5afc('0x13'),_0x4a5f6a,_0x5afc('0xf'));_0x20d52a(_0x15c62b[_0x5afc('0x15')]['message']);}})['catch'](function(_0x5d2961){logger['error'](_0x5afc('0x13'),_0x4a5f6a,_0x5d2961);_0x21bc81(_0x5d2961);});});}exports[_0x5afc('0x16')]=function(_0x23b1ff){var _0x322f1c=this;return new Promise(function(_0x186b63,_0x96e870){return db[_0x5afc('0x17')][_0x5afc('0x18')]({'raw':_0x23b1ff['options']?_0x23b1ff[_0x5afc('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x23b1ff['options']?_0x23b1ff[_0x5afc('0x19')]['where']||null:null,'attributes':_0x23b1ff[_0x5afc('0x19')]?_0x23b1ff['options'][_0x5afc('0x1a')]||null:null,'limit':_0x23b1ff[_0x5afc('0x19')]?_0x23b1ff[_0x5afc('0x19')][_0x5afc('0x1b')]||null:null,'include':_0x23b1ff['options']?_0x23b1ff[_0x5afc('0x19')]['include']?_['map'](_0x23b1ff['options'][_0x5afc('0x1c')],function(_0x14068d){return{'model':db[_0x14068d[_0x5afc('0x1d')]],'as':_0x14068d['as'],'attributes':_0x14068d[_0x5afc('0x1a')],'include':_0x14068d[_0x5afc('0x1c')]?_[_0x5afc('0x1e')](_0x14068d['include'],function(_0x13fe45){return{'model':db[_0x13fe45[_0x5afc('0x1d')]],'as':_0x13fe45['as'],'attributes':_0x13fe45[_0x5afc('0x1a')],'include':_0x13fe45['include']?_[_0x5afc('0x1e')](_0x13fe45[_0x5afc('0x1c')],function(_0x1d9cb4){return{'model':db[_0x1d9cb4[_0x5afc('0x1d')]],'as':_0x1d9cb4['as'],'attributes':_0x1d9cb4[_0x5afc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5afc('0xd')](function(_0x3816ea){logger[_0x5afc('0xe')](_0x5afc('0x16'),_0x23b1ff);logger['debug']('GetSmsQueue',_0x23b1ff,JSON[_0x5afc('0x11')](_0x3816ea));_0x186b63(_0x3816ea);})[_0x5afc('0x1f')](function(_0x5850bb){logger['error'](_0x5afc('0x16'),_0x5850bb['message'],_0x23b1ff);_0x96e870(_0x322f1c[_0x5afc('0x12')](0x1f4,_0x5850bb['message']));});});};exports[_0x5afc('0x20')]=function(_0x461761){var _0xfb7284=this;return new Promise(function(_0x1fb229,_0x22d184){return db['SmsQueue']['find']({'raw':_0x461761['options']?_0x461761[_0x5afc('0x19')][_0x5afc('0x21')]===undefined?!![]:![]:!![],'where':_0x461761[_0x5afc('0x19')]?_0x461761['options']['where']||null:null,'attributes':_0x461761['options']?_0x461761['options']['attributes']||null:null,'include':_0x461761['options']?_0x461761[_0x5afc('0x19')][_0x5afc('0x1c')]?_[_0x5afc('0x1e')](_0x461761['options'][_0x5afc('0x1c')],function(_0x4d0002){return{'model':db[_0x4d0002[_0x5afc('0x1d')]],'as':_0x4d0002['as'],'attributes':_0x4d0002[_0x5afc('0x1a')],'include':_0x4d0002[_0x5afc('0x1c')]?_[_0x5afc('0x1e')](_0x4d0002[_0x5afc('0x1c')],function(_0x484dcf){return{'model':db[_0x484dcf[_0x5afc('0x1d')]],'as':_0x484dcf['as'],'attributes':_0x484dcf[_0x5afc('0x1a')],'include':_0x484dcf[_0x5afc('0x1c')]?_['map'](_0x484dcf['include'],function(_0x913a6e){return{'model':db[_0x913a6e[_0x5afc('0x1d')]],'as':_0x913a6e['as'],'attributes':_0x913a6e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5afc('0xd')](function(_0x138ce9){logger['info'](_0x5afc('0x20'),_0x461761);logger['debug'](_0x5afc('0x20'),_0x461761,JSON[_0x5afc('0x11')](_0x138ce9));_0x1fb229(_0x138ce9);})[_0x5afc('0x1f')](function(_0x29b1a8){logger[_0x5afc('0x12')](_0x5afc('0x20'),_0x29b1a8[_0x5afc('0x14')],_0x461761);_0x22d184(_0xfb7284[_0x5afc('0x12')](0x1f4,_0x29b1a8[_0x5afc('0x14')]));});});}; \ No newline at end of file +var _0x5f0b=['options','raw','where','attributes','limit','include','map','model','then','ShowSmsQueue','find','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSmsQueue'];(function(_0x3578ac,_0x31e6fa){var _0x21f362=function(_0x5c6ce6){while(--_0x5c6ce6){_0x3578ac['push'](_0x3578ac['shift']());}};_0x21f362(++_0x31e6fa);}(_0x5f0b,0xa7));var _0xb5f0=function(_0xb58c21,_0x1450dc){_0xb58c21=_0xb58c21-0x0;var _0x24773e=_0x5f0b[_0xb58c21];return _0x24773e;};'use strict';var _=require('lodash');var util=require(_0xb5f0('0x0'));var moment=require(_0xb5f0('0x1'));var BPromise=require('bluebird');var rs=require(_0xb5f0('0x2'));var fs=require('fs');var Redis=require(_0xb5f0('0x3'));var db=require(_0xb5f0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb5f0('0x5'));var config=require(_0xb5f0('0x6'));var jayson=require(_0xb5f0('0x7'));var client=jayson[_0xb5f0('0x8')][_0xb5f0('0x9')]({'port':0x232a});config[_0xb5f0('0xa')]=_[_0xb5f0('0xb')](config[_0xb5f0('0xa')],{'host':_0xb5f0('0xc'),'port':0x18eb});var socket=require(_0xb5f0('0xd'))(new Redis(config['redis']));require(_0xb5f0('0xe'))[_0xb5f0('0xf')](socket);function respondWithRpcPromise(_0x1ad6e7,_0x6cda90,_0x5d2ccd){return new BPromise(function(_0x493999,_0x4dc5c8){return client['request'](_0x1ad6e7,_0x5d2ccd)['then'](function(_0x1ded18){logger['info'](_0xb5f0('0x10'),_0x6cda90,_0xb5f0('0x11'));logger[_0xb5f0('0x12')](_0xb5f0('0x13'),_0x6cda90,_0xb5f0('0x11'),JSON[_0xb5f0('0x14')](_0x1ded18));if(_0x1ded18[_0xb5f0('0x15')]){if(_0x1ded18[_0xb5f0('0x15')][_0xb5f0('0x16')]===0x1f4){logger['error'](_0xb5f0('0x10'),_0x6cda90,_0x1ded18[_0xb5f0('0x15')][_0xb5f0('0x17')]);return _0x4dc5c8(_0x1ded18[_0xb5f0('0x15')]['message']);}logger[_0xb5f0('0x15')]('SmsQueue,\x20%s,\x20%s',_0x6cda90,_0x1ded18[_0xb5f0('0x15')][_0xb5f0('0x17')]);return _0x493999(_0x1ded18[_0xb5f0('0x15')][_0xb5f0('0x17')]);}else{logger[_0xb5f0('0x18')](_0xb5f0('0x10'),_0x6cda90,'request\x20sent');_0x493999(_0x1ded18[_0xb5f0('0x19')][_0xb5f0('0x17')]);}})[_0xb5f0('0x1a')](function(_0x435fe4){logger[_0xb5f0('0x15')]('SmsQueue,\x20%s,\x20%s',_0x6cda90,_0x435fe4);_0x4dc5c8(_0x435fe4);});});}exports[_0xb5f0('0x1b')]=function(_0x47b54d){var _0x4ad368=this;return new Promise(function(_0x43cfe2,_0x48f9d6){return db['SmsQueue']['findAll']({'raw':_0x47b54d[_0xb5f0('0x1c')]?_0x47b54d['options'][_0xb5f0('0x1d')]===undefined?!![]:![]:!![],'where':_0x47b54d['options']?_0x47b54d['options'][_0xb5f0('0x1e')]||null:null,'attributes':_0x47b54d[_0xb5f0('0x1c')]?_0x47b54d['options'][_0xb5f0('0x1f')]||null:null,'limit':_0x47b54d['options']?_0x47b54d[_0xb5f0('0x1c')][_0xb5f0('0x20')]||null:null,'include':_0x47b54d['options']?_0x47b54d[_0xb5f0('0x1c')][_0xb5f0('0x21')]?_[_0xb5f0('0x22')](_0x47b54d[_0xb5f0('0x1c')][_0xb5f0('0x21')],function(_0x386916){return{'model':db[_0x386916['model']],'as':_0x386916['as'],'attributes':_0x386916[_0xb5f0('0x1f')],'include':_0x386916['include']?_['map'](_0x386916['include'],function(_0x37db95){return{'model':db[_0x37db95[_0xb5f0('0x23')]],'as':_0x37db95['as'],'attributes':_0x37db95[_0xb5f0('0x1f')],'include':_0x37db95[_0xb5f0('0x21')]?_['map'](_0x37db95['include'],function(_0x2b43bd){return{'model':db[_0x2b43bd[_0xb5f0('0x23')]],'as':_0x2b43bd['as'],'attributes':_0x2b43bd['attributes']};}):[]};}):[]};}):[]:[]})[_0xb5f0('0x24')](function(_0x407de1){logger['info']('GetSmsQueue',_0x47b54d);logger[_0xb5f0('0x12')](_0xb5f0('0x1b'),_0x47b54d,JSON[_0xb5f0('0x14')](_0x407de1));_0x43cfe2(_0x407de1);})['catch'](function(_0x1f7f8f){logger[_0xb5f0('0x15')](_0xb5f0('0x1b'),_0x1f7f8f[_0xb5f0('0x17')],_0x47b54d);_0x48f9d6(_0x4ad368[_0xb5f0('0x15')](0x1f4,_0x1f7f8f[_0xb5f0('0x17')]));});});};exports[_0xb5f0('0x25')]=function(_0xe9f381){var _0x5bf7b4=this;return new Promise(function(_0x319b16,_0x5136d9){return db['SmsQueue'][_0xb5f0('0x26')]({'raw':_0xe9f381[_0xb5f0('0x1c')]?_0xe9f381[_0xb5f0('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xe9f381['options']?_0xe9f381[_0xb5f0('0x1c')]['where']||null:null,'attributes':_0xe9f381[_0xb5f0('0x1c')]?_0xe9f381['options']['attributes']||null:null,'include':_0xe9f381[_0xb5f0('0x1c')]?_0xe9f381[_0xb5f0('0x1c')][_0xb5f0('0x21')]?_[_0xb5f0('0x22')](_0xe9f381['options'][_0xb5f0('0x21')],function(_0x193d59){return{'model':db[_0x193d59['model']],'as':_0x193d59['as'],'attributes':_0x193d59[_0xb5f0('0x1f')],'include':_0x193d59[_0xb5f0('0x21')]?_[_0xb5f0('0x22')](_0x193d59['include'],function(_0x411997){return{'model':db[_0x411997['model']],'as':_0x411997['as'],'attributes':_0x411997[_0xb5f0('0x1f')],'include':_0x411997['include']?_[_0xb5f0('0x22')](_0x411997[_0xb5f0('0x21')],function(_0x34735a){return{'model':db[_0x34735a[_0xb5f0('0x23')]],'as':_0x34735a['as'],'attributes':_0x34735a[_0xb5f0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb5f0('0x24')](function(_0x29967c){logger[_0xb5f0('0x18')]('ShowSmsQueue',_0xe9f381);logger[_0xb5f0('0x12')](_0xb5f0('0x25'),_0xe9f381,JSON['stringify'](_0x29967c));_0x319b16(_0x29967c);})['catch'](function(_0x2e07c0){logger[_0xb5f0('0x15')](_0xb5f0('0x25'),_0x2e07c0['message'],_0xe9f381);_0x5136d9(_0x5bf7b4[_0xb5f0('0x15')](0x1f4,_0x2e07c0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 1f562e8..82c220c 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 _0x528f=['emit','removeListener','smsQueue:','./smsQueue.events','remove'];(function(_0x15c2d4,_0x464499){var _0x2fe288=function(_0x30a0a3){while(--_0x30a0a3){_0x15c2d4['push'](_0x15c2d4['shift']());}};_0x2fe288(++_0x464499);}(_0x528f,0x166));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require(_0xf528('0x0'));var events=['save',_0xf528('0x1'),'update'];function createListener(_0x83768b,_0x505e08){return function(_0x4b61e6){_0x505e08[_0xf528('0x2')](_0x83768b,_0x4b61e6);};}function removeListener(_0x100720,_0x151daf){return function(){SmsQueueEvents[_0xf528('0x3')](_0x100720,_0x151daf);};}exports['register']=function(_0x465924){for(var _0x44b972=0x0,_0xfde561=events['length'];_0x44b972<_0xfde561;_0x44b972++){var _0x20ecc4=events[_0x44b972];var _0x4f7968=createListener(_0xf528('0x4')+_0x20ecc4,_0x465924);SmsQueueEvents['on'](_0x20ecc4,_0x4f7968);}}; \ No newline at end of file +var _0xfd82=['removeListener','register','length','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfd82,0xff));var _0x2fd8=function(_0x160cd7,_0x540c04){_0x160cd7=_0x160cd7-0x0;var _0x2b7574=_0xfd82[_0x160cd7];return _0x2b7574;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x2fd8('0x0'),_0x2fd8('0x1'),_0x2fd8('0x2')];function createListener(_0x5b3adb,_0x36b86a){return function(_0x5c2437){_0x36b86a[_0x2fd8('0x3')](_0x5b3adb,_0x5c2437);};}function removeListener(_0x2a2e1c,_0x3d71a2){return function(){SmsQueueEvents[_0x2fd8('0x4')](_0x2a2e1c,_0x3d71a2);};}exports[_0x2fd8('0x5')]=function(_0x6a3696){for(var _0x3200f4=0x0,_0x381743=events[_0x2fd8('0x6')];_0x3200f4<_0x381743;_0x3200f4++){var _0x46f652=events[_0x3200f4];var _0x516d4f=createListener('smsQueue:'+_0x46f652,_0x6a3696);SmsQueueEvents['on'](_0x46f652,_0x516d4f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 07434e6..980a0f3 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 _0x2865=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','update','destroy','exports','path','connect-timeout','express'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x2865,0x1ad));var _0x5286=function(_0x339875,_0x1d5e1b){_0x339875=_0x339875-0x0;var _0x4f7a26=_0x2865[_0x339875];return _0x4f7a26;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5286('0x0'));var timeout=require(_0x5286('0x1'));var express=require(_0x5286('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5286('0x3'));var config=require(_0x5286('0x4'));var controller=require(_0x5286('0x5'));router[_0x5286('0x6')]('/',auth[_0x5286('0x7')](),controller[_0x5286('0x8')]);router[_0x5286('0x6')]('/describe',auth[_0x5286('0x7')](),controller[_0x5286('0x9')]);router['get'](_0x5286('0xa'),auth[_0x5286('0x7')](),controller['show']);router[_0x5286('0xb')]('/',auth[_0x5286('0x7')](),controller[_0x5286('0xc')]);router['put'](_0x5286('0xa'),auth[_0x5286('0x7')](),controller[_0x5286('0xd')]);router['delete'](_0x5286('0xa'),auth[_0x5286('0x7')](),controller[_0x5286('0xe')]);module[_0x5286('0xf')]=router; \ No newline at end of file +var _0x979d=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','show','post','/:id','update','delete','exports','util','path'];(function(_0x2b80ad,_0x403bb4){var _0x24a864=function(_0x531d4d){while(--_0x531d4d){_0x2b80ad['push'](_0x2b80ad['shift']());}};_0x24a864(++_0x403bb4);}(_0x979d,0x7c));var _0xd979=function(_0x121a3f,_0x262b36){_0x121a3f=_0x121a3f-0x0;var _0x2a47d6=_0x979d[_0x121a3f];return _0x2a47d6;};'use strict';var multer=require('multer');var util=require(_0xd979('0x0'));var path=require(_0xd979('0x1'));var timeout=require(_0xd979('0x2'));var express=require(_0xd979('0x3'));var router=express[_0xd979('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd979('0x5'));var config=require(_0xd979('0x6'));var controller=require(_0xd979('0x7'));router[_0xd979('0x8')]('/',auth[_0xd979('0x9')](),controller[_0xd979('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xd979('0xb')]);router[_0xd979('0x8')]('/:id',auth[_0xd979('0x9')](),controller[_0xd979('0xc')]);router[_0xd979('0xd')]('/',auth[_0xd979('0x9')](),controller['create']);router['put'](_0xd979('0xe'),auth['isAuthenticated'](),controller[_0xd979('0xf')]);router[_0xd979('0x10')](_0xd979('0xe'),auth[_0xd979('0x9')](),controller['destroy']);module[_0xd979('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1243e03..b91c693 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 _0x9e75=['DATE','moment','exports','STRING'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x9e75,0x171));var _0x59e7=function(_0x440115,_0x21d391){_0x440115=_0x440115-0x0;var _0x5e5836=_0x9e75[_0x440115];return _0x5e5836;};'use strict';var moment=require(_0x59e7('0x0'));var Sequelize=require('sequelize');module[_0x59e7('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x59e7('0x2')]},'joinAt':{'type':Sequelize[_0x59e7('0x3')]},'leaveAt':{'type':Sequelize[_0x59e7('0x3')]},'acceptAt':{'type':Sequelize[_0x59e7('0x3')]},'exitAt':{'type':Sequelize[_0x59e7('0x3')]},'reason':{'type':Sequelize[_0x59e7('0x2')]}}; \ No newline at end of file +var _0xab02=['sequelize','exports','STRING','DATE','moment'];(function(_0x26ad08,_0x784432){var _0xfeebfb=function(_0x119ea4){while(--_0x119ea4){_0x26ad08['push'](_0x26ad08['shift']());}};_0xfeebfb(++_0x784432);}(_0xab02,0x117));var _0x2ab0=function(_0x1d5543,_0x12223d){_0x1d5543=_0x1d5543-0x0;var _0x1c45d1=_0xab02[_0x1d5543];return _0x1c45d1;};'use strict';var moment=require(_0x2ab0('0x0'));var Sequelize=require(_0x2ab0('0x1'));module[_0x2ab0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2ab0('0x3')]},'joinAt':{'type':Sequelize[_0x2ab0('0x4')]},'leaveAt':{'type':Sequelize[_0x2ab0('0x4')]},'acceptAt':{'type':Sequelize[_0x2ab0('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x2ab0('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 9df6655..a9abd15 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 _0xd929=['status','end','json','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','SmsQueueReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','count','includeAll','findAll','rows','catch','show','params','keys','include','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x23f3fb,_0x3ba6e6){var _0x4461cb=function(_0x5b2404){while(--_0x5b2404){_0x23f3fb['push'](_0x23f3fb['shift']());}};_0x4461cb(++_0x3ba6e6);}(_0xd929,0x167));var _0x9d92=function(_0x8bdbfc,_0x268b60){_0x8bdbfc=_0x8bdbfc-0x0;var _0x8faaea=_0xd929[_0x8bdbfc];return _0x8faaea;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9d92('0x0'));var zipdir=require(_0x9d92('0x1'));var jsonpatch=require(_0x9d92('0x2'));var rp=require(_0x9d92('0x3'));var moment=require(_0x9d92('0x4'));var BPromise=require(_0x9d92('0x5'));var Mustache=require(_0x9d92('0x6'));var util=require(_0x9d92('0x7'));var path=require(_0x9d92('0x8'));var sox=require(_0x9d92('0x9'));var csv=require('to-csv');var ejs=require(_0x9d92('0xa'));var fs=require('fs');var _=require(_0x9d92('0xb'));var squel=require(_0x9d92('0xc'));var crypto=require(_0x9d92('0xd'));var jsforce=require(_0x9d92('0xe'));var deskjs=require(_0x9d92('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d92('0x10'));var Redis=require(_0x9d92('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9d92('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d92('0x13'));var logger=require('../../config/logger')(_0x9d92('0x14'));var utils=require(_0x9d92('0x15'));var config=require(_0x9d92('0x16'));var licenseUtil=require(_0x9d92('0x17'));var db=require(_0x9d92('0x18'))['db'];function respondWithStatusCode(_0x2a4e3c,_0x1264c9){_0x1264c9=_0x1264c9||0xcc;return function(_0x45b8b1){if(_0x45b8b1){return _0x2a4e3c[_0x9d92('0x19')](_0x1264c9);}return _0x2a4e3c[_0x9d92('0x1a')](_0x1264c9)[_0x9d92('0x1b')]();};}function respondWithResult(_0x1b64c3,_0x509ad1){_0x509ad1=_0x509ad1||0xc8;return function(_0x40a87f){if(_0x40a87f){return _0x1b64c3[_0x9d92('0x1a')](_0x509ad1)[_0x9d92('0x1c')](_0x40a87f);}};}function respondWithFilteredResult(_0x507f33,_0x5d9f95){return function(_0x35d831){if(_0x35d831){var _0x3e02e8=_0x35d831['count'],_0x36232a=_0x5d9f95[_0x9d92('0x1d')],_0xaf7171=_0x5d9f95[_0x9d92('0x1d')]+_0x5d9f95[_0x9d92('0x1e')],_0xaab954;if(_0xaf7171>=_0x3e02e8){_0xaf7171=_0x3e02e8;_0xaab954=0xc8;}else{_0xaab954=0xce;}_0x507f33[_0x9d92('0x1a')](_0xaab954);return _0x507f33[_0x9d92('0x1f')]('Content-Range',_0x36232a+'-'+_0xaf7171+'/'+_0x3e02e8)['json'](_0x35d831);}return null;};}function patchUpdates(_0x52fb22){return function(_0x24d7f8){try{jsonpatch[_0x9d92('0x20')](_0x24d7f8,_0x52fb22,!![]);}catch(_0x569814){return BPromise[_0x9d92('0x21')](_0x569814);}return _0x24d7f8[_0x9d92('0x22')]();};}function saveUpdates(_0x39fa37,_0x1d321f){return function(_0x38ba9b){if(_0x38ba9b){return _0x38ba9b[_0x9d92('0x23')](_0x39fa37)[_0x9d92('0x24')](function(_0x4fdf14){return _0x4fdf14;});}return null;};}function removeEntity(_0x31f92b,_0x118844){return function(_0xcb3c16){if(_0xcb3c16){return _0xcb3c16['destroy']()[_0x9d92('0x24')](function(){_0x31f92b[_0x9d92('0x1a')](0xcc)[_0x9d92('0x1b')]();});}};}function handleEntityNotFound(_0x49f244,_0x11fb48){return function(_0x46d5db){if(!_0x46d5db){_0x49f244['sendStatus'](0x194);}return _0x46d5db;};}function handleError(_0x129930,_0x4b0afc){_0x4b0afc=_0x4b0afc||0x1f4;return function(_0x4d9779){logger[_0x9d92('0x25')](_0x4d9779[_0x9d92('0x26')]);if(_0x4d9779[_0x9d92('0x27')]){delete _0x4d9779[_0x9d92('0x27')];}_0x129930['status'](_0x4b0afc)[_0x9d92('0x28')](_0x4d9779);};}exports['index']=function(_0x51891d,_0x3f8f5c){var _0x506156={},_0xf70a05={},_0x4867be={'count':0x0,'rows':[]};var _0x523e99=_['map'](db[_0x9d92('0x29')][_0x9d92('0x2a')],function(_0x3ecf77){return{'name':_0x3ecf77[_0x9d92('0x2b')],'type':_0x3ecf77[_0x9d92('0x2c')]['key']};});_0xf70a05[_0x9d92('0x2d')]=_[_0x9d92('0x2e')](_0x523e99,_0x9d92('0x27'));_0xf70a05[_0x9d92('0x2f')]=_['keys'](_0x51891d[_0x9d92('0x2f')]);_0xf70a05[_0x9d92('0x30')]=_[_0x9d92('0x31')](_0xf70a05[_0x9d92('0x2d')],_0xf70a05[_0x9d92('0x2f')]);_0x506156['attributes']=_['intersection'](_0xf70a05['model'],qs[_0x9d92('0x32')](_0x51891d[_0x9d92('0x2f')][_0x9d92('0x32')]));_0x506156[_0x9d92('0x33')]=_0x506156[_0x9d92('0x33')][_0x9d92('0x34')]?_0x506156[_0x9d92('0x33')]:_0xf70a05['model'];if(!_0x51891d[_0x9d92('0x2f')][_0x9d92('0x35')](_0x9d92('0x36'))){_0x506156[_0x9d92('0x1e')]=qs[_0x9d92('0x1e')](_0x51891d[_0x9d92('0x2f')][_0x9d92('0x1e')]);_0x506156[_0x9d92('0x1d')]=qs[_0x9d92('0x1d')](_0x51891d[_0x9d92('0x2f')]['offset']);}_0x506156[_0x9d92('0x37')]=qs[_0x9d92('0x38')](_0x51891d[_0x9d92('0x2f')][_0x9d92('0x38')]);_0x506156['where']=qs[_0x9d92('0x30')](_[_0x9d92('0x39')](_0x51891d['query'],_0xf70a05[_0x9d92('0x30')]),_0x523e99);if(_0x51891d[_0x9d92('0x2f')]['filter']){_0x506156[_0x9d92('0x3a')]=_['merge'](_0x506156[_0x9d92('0x3a')],{'$or':_['map'](_0x523e99,function(_0x5ed4d5){if(_0x5ed4d5[_0x9d92('0x2c')]!==_0x9d92('0x3b')){var _0x544b70={};_0x544b70[_0x5ed4d5[_0x9d92('0x27')]]={'$like':'%'+_0x51891d[_0x9d92('0x2f')][_0x9d92('0x3c')]+'%'};return _0x544b70;}})});}_0x506156=_[_0x9d92('0x3d')]({},_0x506156,_0x51891d[_0x9d92('0x3e')]);var _0x21cfae={'where':_0x506156[_0x9d92('0x3a')]};return db[_0x9d92('0x29')][_0x9d92('0x3f')](_0x21cfae)[_0x9d92('0x24')](function(_0x3335e1){_0x4867be[_0x9d92('0x3f')]=_0x3335e1;if(_0x51891d['query'][_0x9d92('0x40')]){_0x506156['include']=[{'all':!![]}];}return db[_0x9d92('0x29')][_0x9d92('0x41')](_0x506156);})['then'](function(_0x20ecdd){_0x4867be[_0x9d92('0x42')]=_0x20ecdd;return _0x4867be;})[_0x9d92('0x24')](respondWithFilteredResult(_0x3f8f5c,_0x506156))[_0x9d92('0x43')](handleError(_0x3f8f5c,null));};exports[_0x9d92('0x44')]=function(_0x2dcbbe,_0x432282){var _0x4b1b06={'raw':!![],'where':{'id':_0x2dcbbe[_0x9d92('0x45')]['id']}},_0x123551={};_0x123551['model']=_['keys'](db[_0x9d92('0x29')][_0x9d92('0x2a')]);_0x123551[_0x9d92('0x2f')]=_[_0x9d92('0x46')](_0x2dcbbe[_0x9d92('0x2f')]);_0x123551[_0x9d92('0x30')]=_[_0x9d92('0x31')](_0x123551['model'],_0x123551[_0x9d92('0x2f')]);_0x4b1b06[_0x9d92('0x33')]=_[_0x9d92('0x31')](_0x123551[_0x9d92('0x2d')],qs[_0x9d92('0x32')](_0x2dcbbe['query'][_0x9d92('0x32')]));_0x4b1b06[_0x9d92('0x33')]=_0x4b1b06[_0x9d92('0x33')][_0x9d92('0x34')]?_0x4b1b06[_0x9d92('0x33')]:_0x123551[_0x9d92('0x2d')];if(_0x2dcbbe[_0x9d92('0x2f')][_0x9d92('0x40')]){_0x4b1b06[_0x9d92('0x47')]=[{'all':!![]}];}_0x4b1b06=_['merge']({},_0x4b1b06,_0x2dcbbe[_0x9d92('0x3e')]);return db[_0x9d92('0x29')]['find'](_0x4b1b06)[_0x9d92('0x24')](handleEntityNotFound(_0x432282,null))['then'](respondWithResult(_0x432282,null))['catch'](handleError(_0x432282,null));};exports[_0x9d92('0x48')]=function(_0x351b8d,_0x5ce82e){return db[_0x9d92('0x29')][_0x9d92('0x48')](_0x351b8d[_0x9d92('0x49')],{})[_0x9d92('0x24')](respondWithResult(_0x5ce82e,0xc9))['catch'](handleError(_0x5ce82e,null));};exports['update']=function(_0x33c69b,_0x2249a2){if(_0x33c69b[_0x9d92('0x49')]['id']){delete _0x33c69b[_0x9d92('0x49')]['id'];}return db[_0x9d92('0x29')][_0x9d92('0x4a')]({'where':{'id':_0x33c69b[_0x9d92('0x45')]['id']}})['then'](handleEntityNotFound(_0x2249a2,null))[_0x9d92('0x24')](saveUpdates(_0x33c69b[_0x9d92('0x49')],null))['then'](respondWithResult(_0x2249a2,null))['catch'](handleError(_0x2249a2,null));};exports[_0x9d92('0x4b')]=function(_0x29f64c,_0x1ef2e7){return db[_0x9d92('0x29')][_0x9d92('0x4a')]({'where':{'id':_0x29f64c['params']['id']}})[_0x9d92('0x24')](handleEntityNotFound(_0x1ef2e7,null))[_0x9d92('0x24')](removeEntity(_0x1ef2e7,null))['catch'](handleError(_0x1ef2e7,null));};exports['describe']=function(_0x30c198,_0x34b614){return db['SmsQueueReport'][_0x9d92('0x4c')]()[_0x9d92('0x24')](respondWithResult(_0x34b614,null))[_0x9d92('0x43')](handleError(_0x34b614,null));}; \ No newline at end of file +var _0x0d87=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe'];(function(_0x3d01d4,_0x848ead){var _0x5e192d=function(_0x56c8f8){while(--_0x56c8f8){_0x3d01d4['push'](_0x3d01d4['shift']());}};_0x5e192d(++_0x848ead);}(_0x0d87,0x13c));var _0x70d8=function(_0x3c1876,_0x53540e){_0x3c1876=_0x3c1876-0x0;var _0x3cab15=_0x0d87[_0x3c1876];return _0x3cab15;};'use strict';var pdf=require(_0x70d8('0x0'));var emlformat=require(_0x70d8('0x1'));var rimraf=require(_0x70d8('0x2'));var zipdir=require(_0x70d8('0x3'));var jsonpatch=require(_0x70d8('0x4'));var rp=require('request-promise');var moment=require(_0x70d8('0x5'));var BPromise=require(_0x70d8('0x6'));var Mustache=require(_0x70d8('0x7'));var util=require(_0x70d8('0x8'));var path=require(_0x70d8('0x9'));var sox=require(_0x70d8('0xa'));var csv=require(_0x70d8('0xb'));var ejs=require(_0x70d8('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x70d8('0xd'));var crypto=require(_0x70d8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x70d8('0xf'));var toCsv=require(_0x70d8('0xb'));var querystring=require('querystring');var Papa=require(_0x70d8('0x10'));var Redis=require('ioredis');var authService=require(_0x70d8('0x11'));var qs=require(_0x70d8('0x12'));var as=require(_0x70d8('0x13'));var hardwareService=require(_0x70d8('0x14'));var logger=require(_0x70d8('0x15'))(_0x70d8('0x16'));var utils=require(_0x70d8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x70d8('0x18'));var db=require(_0x70d8('0x19'))['db'];function respondWithStatusCode(_0xce0aca,_0x32b59a){_0x32b59a=_0x32b59a||0xcc;return function(_0x3550ac){if(_0x3550ac){return _0xce0aca[_0x70d8('0x1a')](_0x32b59a);}return _0xce0aca['status'](_0x32b59a)[_0x70d8('0x1b')]();};}function respondWithResult(_0x1e9ba0,_0x16e17d){_0x16e17d=_0x16e17d||0xc8;return function(_0xce0bdf){if(_0xce0bdf){return _0x1e9ba0[_0x70d8('0x1c')](_0x16e17d)['json'](_0xce0bdf);}};}function respondWithFilteredResult(_0x1e8c6b,_0x4dfe78){return function(_0x1f92b7){if(_0x1f92b7){var _0x48374=_0x1f92b7[_0x70d8('0x1d')],_0x145f3b=_0x4dfe78[_0x70d8('0x1e')],_0x5c0012=_0x4dfe78['offset']+_0x4dfe78[_0x70d8('0x1f')],_0x4d5f4c;if(_0x5c0012>=_0x48374){_0x5c0012=_0x48374;_0x4d5f4c=0xc8;}else{_0x4d5f4c=0xce;}_0x1e8c6b['status'](_0x4d5f4c);return _0x1e8c6b[_0x70d8('0x20')](_0x70d8('0x21'),_0x145f3b+'-'+_0x5c0012+'/'+_0x48374)[_0x70d8('0x22')](_0x1f92b7);}return null;};}function patchUpdates(_0x2f4c37){return function(_0x440bf1){try{jsonpatch[_0x70d8('0x23')](_0x440bf1,_0x2f4c37,!![]);}catch(_0x5d6bf3){return BPromise[_0x70d8('0x24')](_0x5d6bf3);}return _0x440bf1[_0x70d8('0x25')]();};}function saveUpdates(_0x5d920a,_0x214f2e){return function(_0x5f1b93){if(_0x5f1b93){return _0x5f1b93[_0x70d8('0x26')](_0x5d920a)[_0x70d8('0x27')](function(_0x385c32){return _0x385c32;});}return null;};}function removeEntity(_0x76ea1,_0x47f79b){return function(_0x34bc83){if(_0x34bc83){return _0x34bc83[_0x70d8('0x28')]()['then'](function(){_0x76ea1[_0x70d8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xddd2be,_0x32d239){return function(_0x641d10){if(!_0x641d10){_0xddd2be[_0x70d8('0x1a')](0x194);}return _0x641d10;};}function handleError(_0x571d12,_0x414646){_0x414646=_0x414646||0x1f4;return function(_0x2de79){logger[_0x70d8('0x29')](_0x2de79['stack']);if(_0x2de79[_0x70d8('0x2a')]){delete _0x2de79['name'];}_0x571d12[_0x70d8('0x1c')](_0x414646)[_0x70d8('0x2b')](_0x2de79);};}exports[_0x70d8('0x2c')]=function(_0x2c4ee7,_0x23032c){var _0x1f84da={},_0x45340d={},_0x5a60ea={'count':0x0,'rows':[]};var _0x404a5e=_[_0x70d8('0x2d')](db[_0x70d8('0x2e')][_0x70d8('0x2f')],function(_0x15e19a){return{'name':_0x15e19a[_0x70d8('0x30')],'type':_0x15e19a[_0x70d8('0x31')][_0x70d8('0x32')]};});_0x45340d[_0x70d8('0x33')]=_[_0x70d8('0x2d')](_0x404a5e,_0x70d8('0x2a'));_0x45340d[_0x70d8('0x34')]=_[_0x70d8('0x35')](_0x2c4ee7[_0x70d8('0x34')]);_0x45340d['filters']=_[_0x70d8('0x36')](_0x45340d[_0x70d8('0x33')],_0x45340d['query']);_0x1f84da[_0x70d8('0x37')]=_[_0x70d8('0x36')](_0x45340d[_0x70d8('0x33')],qs[_0x70d8('0x38')](_0x2c4ee7['query'][_0x70d8('0x38')]));_0x1f84da['attributes']=_0x1f84da['attributes']['length']?_0x1f84da['attributes']:_0x45340d[_0x70d8('0x33')];if(!_0x2c4ee7['query'][_0x70d8('0x39')](_0x70d8('0x3a'))){_0x1f84da[_0x70d8('0x1f')]=qs[_0x70d8('0x1f')](_0x2c4ee7['query'][_0x70d8('0x1f')]);_0x1f84da[_0x70d8('0x1e')]=qs[_0x70d8('0x1e')](_0x2c4ee7[_0x70d8('0x34')][_0x70d8('0x1e')]);}_0x1f84da[_0x70d8('0x3b')]=qs['sort'](_0x2c4ee7['query'][_0x70d8('0x3c')]);_0x1f84da[_0x70d8('0x3d')]=qs[_0x70d8('0x3e')](_[_0x70d8('0x3f')](_0x2c4ee7[_0x70d8('0x34')],_0x45340d['filters']),_0x404a5e);if(_0x2c4ee7[_0x70d8('0x34')][_0x70d8('0x40')]){_0x1f84da['where']=_[_0x70d8('0x41')](_0x1f84da[_0x70d8('0x3d')],{'$or':_['map'](_0x404a5e,function(_0x25fe17){if(_0x25fe17['type']!==_0x70d8('0x42')){var _0x30d249={};_0x30d249[_0x25fe17['name']]={'$like':'%'+_0x2c4ee7['query']['filter']+'%'};return _0x30d249;}})});}_0x1f84da=_[_0x70d8('0x41')]({},_0x1f84da,_0x2c4ee7['options']);var _0x1a1887={'where':_0x1f84da[_0x70d8('0x3d')]};return db[_0x70d8('0x2e')][_0x70d8('0x1d')](_0x1a1887)['then'](function(_0x1804eb){_0x5a60ea[_0x70d8('0x1d')]=_0x1804eb;if(_0x2c4ee7['query'][_0x70d8('0x43')]){_0x1f84da[_0x70d8('0x44')]=[{'all':!![]}];}return db[_0x70d8('0x2e')][_0x70d8('0x45')](_0x1f84da);})[_0x70d8('0x27')](function(_0x1c7a5d){_0x5a60ea[_0x70d8('0x46')]=_0x1c7a5d;return _0x5a60ea;})['then'](respondWithFilteredResult(_0x23032c,_0x1f84da))[_0x70d8('0x47')](handleError(_0x23032c,null));};exports[_0x70d8('0x48')]=function(_0x1952af,_0x538fb4){var _0x3524f9={'raw':!![],'where':{'id':_0x1952af[_0x70d8('0x49')]['id']}},_0x4071e7={};_0x4071e7['model']=_[_0x70d8('0x35')](db[_0x70d8('0x2e')][_0x70d8('0x2f')]);_0x4071e7['query']=_[_0x70d8('0x35')](_0x1952af[_0x70d8('0x34')]);_0x4071e7[_0x70d8('0x3e')]=_['intersection'](_0x4071e7[_0x70d8('0x33')],_0x4071e7['query']);_0x3524f9['attributes']=_[_0x70d8('0x36')](_0x4071e7[_0x70d8('0x33')],qs[_0x70d8('0x38')](_0x1952af[_0x70d8('0x34')][_0x70d8('0x38')]));_0x3524f9[_0x70d8('0x37')]=_0x3524f9[_0x70d8('0x37')]['length']?_0x3524f9['attributes']:_0x4071e7['model'];if(_0x1952af[_0x70d8('0x34')][_0x70d8('0x43')]){_0x3524f9['include']=[{'all':!![]}];}_0x3524f9=_[_0x70d8('0x41')]({},_0x3524f9,_0x1952af[_0x70d8('0x4a')]);return db['SmsQueueReport'][_0x70d8('0x4b')](_0x3524f9)['then'](handleEntityNotFound(_0x538fb4,null))['then'](respondWithResult(_0x538fb4,null))['catch'](handleError(_0x538fb4,null));};exports[_0x70d8('0x4c')]=function(_0x42e690,_0x331e2b){return db[_0x70d8('0x2e')][_0x70d8('0x4c')](_0x42e690['body'],{})[_0x70d8('0x27')](respondWithResult(_0x331e2b,0xc9))[_0x70d8('0x47')](handleError(_0x331e2b,null));};exports['update']=function(_0x1c4702,_0x5557ad){if(_0x1c4702['body']['id']){delete _0x1c4702[_0x70d8('0x4d')]['id'];}return db['SmsQueueReport'][_0x70d8('0x4b')]({'where':{'id':_0x1c4702[_0x70d8('0x49')]['id']}})[_0x70d8('0x27')](handleEntityNotFound(_0x5557ad,null))['then'](saveUpdates(_0x1c4702[_0x70d8('0x4d')],null))[_0x70d8('0x27')](respondWithResult(_0x5557ad,null))[_0x70d8('0x47')](handleError(_0x5557ad,null));};exports['destroy']=function(_0x4f2569,_0x2e53df){return db[_0x70d8('0x2e')]['find']({'where':{'id':_0x4f2569[_0x70d8('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e53df,null))['then'](removeEntity(_0x2e53df,null))['catch'](handleError(_0x2e53df,null));};exports[_0x70d8('0x4e')]=function(_0x1e3db6,_0x5903c3){return db[_0x70d8('0x2e')][_0x70d8('0x4e')]()[_0x70d8('0x27')](respondWithResult(_0x5903c3,null))[_0x70d8('0x47')](handleError(_0x5903c3,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index d7838e1..088b300 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 _0x92aa=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','define','SmsQueueReport'];(function(_0xbe7801,_0x24ebe9){var _0x3a8062=function(_0x295f04){while(--_0x295f04){_0xbe7801['push'](_0xbe7801['shift']());}};_0x3a8062(++_0x24ebe9);}(_0x92aa,0xf3));var _0xa92a=function(_0x11aa18,_0x1d54f8){_0x11aa18=_0x11aa18-0x0;var _0x4586e1=_0x92aa[_0x11aa18];return _0x4586e1;};'use strict';var _=require(_0xa92a('0x0'));var util=require(_0xa92a('0x1'));var logger=require(_0xa92a('0x2'))(_0xa92a('0x3'));var moment=require(_0xa92a('0x4'));var BPromise=require('bluebird');var rp=require(_0xa92a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa92a('0x6'));var attributes=require('./smsQueueReport.attributes');module[_0xa92a('0x7')]=function(_0x50a3e1,_0x53e138){return _0x50a3e1[_0xa92a('0x8')](_0xa92a('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0xa92a('0xa'),'fields':[_0xa92a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf3=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./smsQueueReport.attributes','exports','SmsQueueReport','uniqueid','lodash'];(function(_0x1e6939,_0x58ed73){var _0x3a6f1b=function(_0x36bd01){while(--_0x36bd01){_0x1e6939['push'](_0x1e6939['shift']());}};_0x3a6f1b(++_0x58ed73);}(_0xbaf3,0x1df));var _0x3baf=function(_0x4367a3,_0x1d2146){_0x4367a3=_0x4367a3-0x0;var _0x3d52e2=_0xbaf3[_0x4367a3];return _0x3d52e2;};'use strict';var _=require(_0x3baf('0x0'));var util=require(_0x3baf('0x1'));var logger=require(_0x3baf('0x2'))(_0x3baf('0x3'));var moment=require('moment');var BPromise=require(_0x3baf('0x4'));var rp=require(_0x3baf('0x5'));var fs=require('fs');var path=require(_0x3baf('0x6'));var rimraf=require('rimraf');var config=require(_0x3baf('0x7'));var attributes=require(_0x3baf('0x8'));module[_0x3baf('0x9')]=function(_0x38bc65,_0xdfda72){return _0x38bc65['define'](_0x3baf('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x3baf('0xb'),'fields':[_0x3baf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 82c1693..0298828 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 _0x80ab=['../../config/utils','rpc','jayson/promise','client','request','then','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','stringify','UpdateSmsQueueReport','update','where','attributes','lodash','moment','randomstring','../../mysqldb'];(function(_0x2a2a77,_0x34e415){var _0x3c8e22=function(_0x26d669){while(--_0x26d669){_0x2a2a77['push'](_0x2a2a77['shift']());}};_0x3c8e22(++_0x34e415);}(_0x80ab,0x97));var _0xb80a=function(_0x24a440,_0x9015c8){_0x24a440=_0x24a440-0x0;var _0xf9d75a=_0x80ab[_0x24a440];return _0xf9d75a;};'use strict';var _=require(_0xb80a('0x0'));var util=require('util');var moment=require(_0xb80a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb80a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb80a('0x3'))['db'];var utils=require(_0xb80a('0x4'));var logger=require('../../config/logger')(_0xb80a('0x5'));var config=require('../../config/environment');var jayson=require(_0xb80a('0x6'));var client=jayson[_0xb80a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2518f2,_0x1fcd45,_0x1b0b80){return new BPromise(function(_0x43a88c,_0x4380e8){return client[_0xb80a('0x8')](_0x2518f2,_0x1b0b80)[_0xb80a('0x9')](function(_0x578247){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1fcd45,_0xb80a('0xa'));logger['debug'](_0xb80a('0xb'),_0x1fcd45,_0xb80a('0xa'),JSON['stringify'](_0x578247));if(_0x578247[_0xb80a('0xc')]){if(_0x578247[_0xb80a('0xc')][_0xb80a('0xd')]===0x1f4){logger[_0xb80a('0xc')](_0xb80a('0xe'),_0x1fcd45,_0x578247[_0xb80a('0xc')][_0xb80a('0xf')]);return _0x4380e8(_0x578247[_0xb80a('0xc')]['message']);}logger[_0xb80a('0xc')](_0xb80a('0xe'),_0x1fcd45,_0x578247['error'][_0xb80a('0xf')]);return _0x43a88c(_0x578247[_0xb80a('0xc')]['message']);}else{logger[_0xb80a('0x10')](_0xb80a('0xe'),_0x1fcd45,'request\x20sent');_0x43a88c(_0x578247[_0xb80a('0x11')][_0xb80a('0xf')]);}})[_0xb80a('0x12')](function(_0x20ff0e){logger[_0xb80a('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x1fcd45,_0x20ff0e);_0x4380e8(_0x20ff0e);});});}exports[_0xb80a('0x13')]=function(_0x516466){var _0x85500b=this;return new Promise(function(_0x33a45f,_0x165f72){return db[_0xb80a('0x14')][_0xb80a('0x15')](_0x516466[_0xb80a('0x16')],{'raw':_0x516466[_0xb80a('0x17')]?_0x516466['options'][_0xb80a('0x18')]===undefined?!![]:![]:!![]})[_0xb80a('0x9')](function(_0x7e2746){logger[_0xb80a('0x10')](_0xb80a('0x13'),_0x516466);logger[_0xb80a('0x19')](_0xb80a('0x13'),_0x516466,JSON[_0xb80a('0x1a')](_0x7e2746));_0x33a45f(_0x7e2746);})[_0xb80a('0x12')](function(_0x588f53){logger[_0xb80a('0xc')]('CreateSmsQueueReport',_0x588f53[_0xb80a('0xf')],_0x516466);_0x165f72(_0x85500b[_0xb80a('0xc')](0x1f4,_0x588f53['message']));});});};exports[_0xb80a('0x1b')]=function(_0x5e99a8){var _0xc218af=this;return new Promise(function(_0x3edddc,_0x123f8c){return db[_0xb80a('0x14')][_0xb80a('0x1c')](_0x5e99a8[_0xb80a('0x16')],{'raw':_0x5e99a8[_0xb80a('0x17')]?_0x5e99a8[_0xb80a('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e99a8[_0xb80a('0x17')]?_0x5e99a8['options'][_0xb80a('0x1d')]||null:null,'attributes':_0x5e99a8['options']?_0x5e99a8[_0xb80a('0x17')][_0xb80a('0x1e')]||null:null,'limit':_0x5e99a8['options']?_0x5e99a8[_0xb80a('0x17')]['limit']||null:null})[_0xb80a('0x9')](function(_0x53614a){logger[_0xb80a('0x10')]('UpdateSmsQueueReport',_0x5e99a8);logger[_0xb80a('0x19')](_0xb80a('0x1b'),_0x5e99a8,JSON[_0xb80a('0x1a')](_0x53614a));_0x3edddc(_0x53614a);})[_0xb80a('0x12')](function(_0x2fd701){logger[_0xb80a('0xc')]('UpdateSmsQueueReport',_0x2fd701[_0xb80a('0xf')],_0x5e99a8);_0x123f8c(_0xc218af[_0xb80a('0xc')](0x1f4,_0x2fd701[_0xb80a('0xf')]));});});}; \ No newline at end of file +var _0xc8c6=['../../config/logger','../../config/environment','jayson/promise','request','then','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','info','result','catch','CreateSmsQueueReport','create','body','options','debug','UpdateSmsQueueReport','SmsQueueReport','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc8c6,0x95));var _0x6c8c=function(_0x2dac5e,_0x50d131){_0x2dac5e=_0x2dac5e-0x0;var _0x2b27a3=_0xc8c6[_0x2dac5e];return _0x2b27a3;};'use strict';var _=require(_0x6c8c('0x0'));var util=require(_0x6c8c('0x1'));var moment=require(_0x6c8c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c8c('0x3'));var fs=require('fs');var Redis=require(_0x6c8c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c8c('0x5'));var logger=require(_0x6c8c('0x6'))('rpc');var config=require(_0x6c8c('0x7'));var jayson=require(_0x6c8c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52de03,_0x2b713b,_0x216e10){return new BPromise(function(_0x106e51,_0x1c0650){return client[_0x6c8c('0x9')](_0x52de03,_0x216e10)[_0x6c8c('0xa')](function(_0x53ca70){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x2b713b,_0x6c8c('0xb'));logger['debug'](_0x6c8c('0xc'),_0x2b713b,'request\x20sent',JSON[_0x6c8c('0xd')](_0x53ca70));if(_0x53ca70[_0x6c8c('0xe')]){if(_0x53ca70['error'][_0x6c8c('0xf')]===0x1f4){logger[_0x6c8c('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x2b713b,_0x53ca70[_0x6c8c('0xe')][_0x6c8c('0x10')]);return _0x1c0650(_0x53ca70[_0x6c8c('0xe')]['message']);}logger[_0x6c8c('0xe')](_0x6c8c('0x11'),_0x2b713b,_0x53ca70[_0x6c8c('0xe')]['message']);return _0x106e51(_0x53ca70[_0x6c8c('0xe')][_0x6c8c('0x10')]);}else{logger[_0x6c8c('0x12')](_0x6c8c('0x11'),_0x2b713b,_0x6c8c('0xb'));_0x106e51(_0x53ca70[_0x6c8c('0x13')][_0x6c8c('0x10')]);}})[_0x6c8c('0x14')](function(_0x4e974f){logger[_0x6c8c('0xe')](_0x6c8c('0x11'),_0x2b713b,_0x4e974f);_0x1c0650(_0x4e974f);});});}exports[_0x6c8c('0x15')]=function(_0x590f0f){var _0x31872b=this;return new Promise(function(_0xae2401,_0x3dda12){return db['SmsQueueReport'][_0x6c8c('0x16')](_0x590f0f[_0x6c8c('0x17')],{'raw':_0x590f0f[_0x6c8c('0x18')]?_0x590f0f[_0x6c8c('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2e7cb2){logger['info']('CreateSmsQueueReport',_0x590f0f);logger[_0x6c8c('0x19')](_0x6c8c('0x15'),_0x590f0f,JSON[_0x6c8c('0xd')](_0x2e7cb2));_0xae2401(_0x2e7cb2);})[_0x6c8c('0x14')](function(_0x57c23d){logger[_0x6c8c('0xe')](_0x6c8c('0x15'),_0x57c23d[_0x6c8c('0x10')],_0x590f0f);_0x3dda12(_0x31872b[_0x6c8c('0xe')](0x1f4,_0x57c23d['message']));});});};exports[_0x6c8c('0x1a')]=function(_0xf2de36){var _0x50650b=this;return new Promise(function(_0x129ce1,_0x312d64){return db[_0x6c8c('0x1b')]['update'](_0xf2de36[_0x6c8c('0x17')],{'raw':_0xf2de36['options']?_0xf2de36[_0x6c8c('0x18')][_0x6c8c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2de36['options']?_0xf2de36[_0x6c8c('0x18')][_0x6c8c('0x1d')]||null:null,'attributes':_0xf2de36[_0x6c8c('0x18')]?_0xf2de36['options'][_0x6c8c('0x1e')]||null:null,'limit':_0xf2de36[_0x6c8c('0x18')]?_0xf2de36[_0x6c8c('0x18')]['limit']||null:null})[_0x6c8c('0xa')](function(_0x6691c){logger[_0x6c8c('0x12')]('UpdateSmsQueueReport',_0xf2de36);logger[_0x6c8c('0x19')](_0x6c8c('0x1a'),_0xf2de36,JSON[_0x6c8c('0xd')](_0x6691c));_0x129ce1(_0x6691c);})[_0x6c8c('0x14')](function(_0x303758){logger['error'](_0x6c8c('0x1a'),_0x303758['message'],_0xf2de36);_0x312d64(_0x50650b['error'](0x1f4,_0x303758[_0x6c8c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 08aff40..d73c08f 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 _0xd7d1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x28f153,_0x4852ed){var _0x56b861=function(_0x3cbf02){while(--_0x3cbf02){_0x28f153['push'](_0x28f153['shift']());}};_0x56b861(++_0x4852ed);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0xe9a597,_0x2a05fd){_0xe9a597=_0xe9a597-0x0;var _0x17ccb=_0xd7d1[_0xe9a597];return _0x17ccb;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var auth=require(_0x1d7d('0x6'));var interaction=require(_0x1d7d('0x7'));var config=require(_0x1d7d('0x8'));var controller=require(_0x1d7d('0x9'));router[_0x1d7d('0xa')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xc')]);router['get'](_0x1d7d('0xd'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xa')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')]('/',auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x12')]);router[_0x1d7d('0x13')]('/:id',auth[_0x1d7d('0xb')](),controller['update']);router[_0x1d7d('0x14')](_0x1d7d('0xf'),auth[_0x1d7d('0xb')](),controller[_0x1d7d('0x15')]);module['exports']=router; \ No newline at end of file +var _0xac4a=['Router','../../config/environment','./smsTransferReport.controller','get','index','/describe','describe','show','isAuthenticated','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x2f2d0a,_0x4d0b76){var _0x13b909=function(_0x1fa415){while(--_0x1fa415){_0x2f2d0a['push'](_0x2f2d0a['shift']());}};_0x13b909(++_0x4d0b76);}(_0xac4a,0x13f));var _0xaac4=function(_0x118620,_0x168b2a){_0x118620=_0x118620-0x0;var _0x3207cd=_0xac4a[_0x118620];return _0x3207cd;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaac4('0x6'));var controller=require(_0xaac4('0x7'));router[_0xaac4('0x8')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x9')]);router['get'](_0xaac4('0xa'),auth['isAuthenticated'](),controller[_0xaac4('0xb')]);router[_0xaac4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['post']('/',auth[_0xaac4('0xd')](),controller['create']);router['put'](_0xaac4('0xe'),auth[_0xaac4('0xd')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')](_0xaac4('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xaac4('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 4e0fc12..14c6b7f 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 _0x8eb7=['STRING','ENUM','account','agent','queue','DATE','sequelize','exports'];(function(_0x36c6c7,_0x2986d0){var _0x269241=function(_0x546579){while(--_0x546579){_0x36c6c7['push'](_0x36c6c7['shift']());}};_0x269241(++_0x2986d0);}(_0x8eb7,0x1ee));var _0x78eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8eb7[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x78eb('0x0'));module[_0x78eb('0x1')]={'uniqueid':{'type':Sequelize[_0x78eb('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x78eb('0x3')](_0x78eb('0x4'),_0x78eb('0x5'),'queue'),'allowNull':![],'defaultValue':_0x78eb('0x6')},'transferredAt':{'type':Sequelize[_0x78eb('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9f00=['moment','exports','STRING','ENUM','account','agent','queue','DATE','NOW'];(function(_0x5de349,_0xe42887){var _0x5982a7=function(_0x1d98b1){while(--_0x1d98b1){_0x5de349['push'](_0x5de349['shift']());}};_0x5982a7(++_0xe42887);}(_0x9f00,0x171));var _0x09f0=function(_0x1abb18,_0x3960ec){_0x1abb18=_0x1abb18-0x0;var _0x2a4e44=_0x9f00[_0x1abb18];return _0x2a4e44;};'use strict';var moment=require(_0x09f0('0x0'));var Sequelize=require('sequelize');module[_0x09f0('0x1')]={'uniqueid':{'type':Sequelize[_0x09f0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x09f0('0x3')](_0x09f0('0x4'),_0x09f0('0x5'),_0x09f0('0x6')),'allowNull':![],'defaultValue':_0x09f0('0x6')},'transferredAt':{'type':Sequelize[_0x09f0('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x09f0('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index e300c19..2a690f4 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 _0x9d02=['merge','includeAll','include','findAll','catch','params','intersection','fields','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','bluebird','util','path','sox','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter'];(function(_0xdabc5e,_0x3a35a6){var _0x284739=function(_0x1aa194){while(--_0x1aa194){_0xdabc5e['push'](_0xdabc5e['shift']());}};_0x284739(++_0x3a35a6);}(_0x9d02,0x118));var _0x29d0=function(_0x291862,_0xc6e374){_0x291862=_0x291862-0x0;var _0x40449f=_0x9d02[_0x291862];return _0x40449f;};'use strict';var pdf=require(_0x29d0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x29d0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29d0('0x2'));var rp=require('request-promise');var moment=require(_0x29d0('0x3'));var BPromise=require(_0x29d0('0x4'));var Mustache=require('mustache');var util=require(_0x29d0('0x5'));var path=require(_0x29d0('0x6'));var sox=require(_0x29d0('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x29d0('0x8'));var crypto=require(_0x29d0('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x29d0('0xa'));var toCsv=require(_0x29d0('0xb'));var querystring=require('querystring');var Papa=require(_0x29d0('0xc'));var Redis=require(_0x29d0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x29d0('0xe'));var as=require(_0x29d0('0xf'));var hardwareService=require(_0x29d0('0x10'));var logger=require(_0x29d0('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x29d0('0x12'));var licenseUtil=require(_0x29d0('0x13'));var db=require(_0x29d0('0x14'))['db'];function respondWithStatusCode(_0x1413fd,_0x12cba7){_0x12cba7=_0x12cba7||0xcc;return function(_0x357120){if(_0x357120){return _0x1413fd[_0x29d0('0x15')](_0x12cba7);}return _0x1413fd[_0x29d0('0x16')](_0x12cba7)[_0x29d0('0x17')]();};}function respondWithResult(_0x4c5eed,_0x22903c){_0x22903c=_0x22903c||0xc8;return function(_0x2474b3){if(_0x2474b3){return _0x4c5eed[_0x29d0('0x16')](_0x22903c)[_0x29d0('0x18')](_0x2474b3);}};}function respondWithFilteredResult(_0x120c96,_0xa0b9dc){return function(_0x55ba12){if(_0x55ba12){var _0x24562f=_0x55ba12[_0x29d0('0x19')],_0x1826d0=_0xa0b9dc[_0x29d0('0x1a')],_0x75a016=_0xa0b9dc[_0x29d0('0x1a')]+_0xa0b9dc[_0x29d0('0x1b')],_0x49e919;if(_0x75a016>=_0x24562f){_0x75a016=_0x24562f;_0x49e919=0xc8;}else{_0x49e919=0xce;}_0x120c96[_0x29d0('0x16')](_0x49e919);return _0x120c96[_0x29d0('0x1c')]('Content-Range',_0x1826d0+'-'+_0x75a016+'/'+_0x24562f)[_0x29d0('0x18')](_0x55ba12);}return null;};}function patchUpdates(_0x3bb3b5){return function(_0x1135f6){try{jsonpatch[_0x29d0('0x1d')](_0x1135f6,_0x3bb3b5,!![]);}catch(_0x46562c){return BPromise[_0x29d0('0x1e')](_0x46562c);}return _0x1135f6['save']();};}function saveUpdates(_0x385e63,_0x170993){return function(_0x1e87f0){if(_0x1e87f0){return _0x1e87f0['update'](_0x385e63)[_0x29d0('0x1f')](function(_0x347c45){return _0x347c45;});}return null;};}function removeEntity(_0x1f9e73,_0x4179a0){return function(_0x5cf0dc){if(_0x5cf0dc){return _0x5cf0dc[_0x29d0('0x20')]()[_0x29d0('0x1f')](function(){_0x1f9e73[_0x29d0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40da12,_0x1c80f2){return function(_0x7e2520){if(!_0x7e2520){_0x40da12[_0x29d0('0x15')](0x194);}return _0x7e2520;};}function handleError(_0x2a976d,_0x286e30){_0x286e30=_0x286e30||0x1f4;return function(_0x39037a){logger['error'](_0x39037a[_0x29d0('0x21')]);if(_0x39037a[_0x29d0('0x22')]){delete _0x39037a[_0x29d0('0x22')];}_0x2a976d[_0x29d0('0x16')](_0x286e30)[_0x29d0('0x23')](_0x39037a);};}exports[_0x29d0('0x24')]=function(_0x5c4be8,_0x342a0d){var _0x4b6012={},_0x435918={},_0x579948={'count':0x0,'rows':[]};var _0x123637=_[_0x29d0('0x25')](db[_0x29d0('0x26')][_0x29d0('0x27')],function(_0x9573ff){return{'name':_0x9573ff[_0x29d0('0x28')],'type':_0x9573ff[_0x29d0('0x29')][_0x29d0('0x2a')]};});_0x435918[_0x29d0('0x2b')]=_[_0x29d0('0x25')](_0x123637,_0x29d0('0x22'));_0x435918['query']=_[_0x29d0('0x2c')](_0x5c4be8[_0x29d0('0x2d')]);_0x435918[_0x29d0('0x2e')]=_['intersection'](_0x435918[_0x29d0('0x2b')],_0x435918['query']);_0x4b6012[_0x29d0('0x2f')]=_['intersection'](_0x435918[_0x29d0('0x2b')],qs['fields'](_0x5c4be8[_0x29d0('0x2d')]['fields']));_0x4b6012[_0x29d0('0x2f')]=_0x4b6012[_0x29d0('0x2f')][_0x29d0('0x30')]?_0x4b6012[_0x29d0('0x2f')]:_0x435918[_0x29d0('0x2b')];if(!_0x5c4be8['query'][_0x29d0('0x31')](_0x29d0('0x32'))){_0x4b6012['limit']=qs['limit'](_0x5c4be8['query']['limit']);_0x4b6012[_0x29d0('0x1a')]=qs['offset'](_0x5c4be8[_0x29d0('0x2d')][_0x29d0('0x1a')]);}_0x4b6012[_0x29d0('0x33')]=qs[_0x29d0('0x34')](_0x5c4be8['query'][_0x29d0('0x34')]);_0x4b6012[_0x29d0('0x35')]=qs[_0x29d0('0x2e')](_['pick'](_0x5c4be8['query'],_0x435918['filters']),_0x123637);if(_0x5c4be8['query'][_0x29d0('0x36')]){_0x4b6012[_0x29d0('0x35')]=_[_0x29d0('0x37')](_0x4b6012[_0x29d0('0x35')],{'$or':_[_0x29d0('0x25')](_0x123637,function(_0x2e77fd){if(_0x2e77fd[_0x29d0('0x29')]!=='VIRTUAL'){var _0x3e7198={};_0x3e7198[_0x2e77fd[_0x29d0('0x22')]]={'$like':'%'+_0x5c4be8[_0x29d0('0x2d')]['filter']+'%'};return _0x3e7198;}})});}_0x4b6012=_[_0x29d0('0x37')]({},_0x4b6012,_0x5c4be8['options']);var _0x2751d5={'where':_0x4b6012['where']};return db['SmsTransferReport'][_0x29d0('0x19')](_0x2751d5)[_0x29d0('0x1f')](function(_0x3ffece){_0x579948['count']=_0x3ffece;if(_0x5c4be8[_0x29d0('0x2d')][_0x29d0('0x38')]){_0x4b6012[_0x29d0('0x39')]=[{'all':!![]}];}return db[_0x29d0('0x26')][_0x29d0('0x3a')](_0x4b6012);})[_0x29d0('0x1f')](function(_0x2c5bbe){_0x579948['rows']=_0x2c5bbe;return _0x579948;})['then'](respondWithFilteredResult(_0x342a0d,_0x4b6012))[_0x29d0('0x3b')](handleError(_0x342a0d,null));};exports['show']=function(_0x144a10,_0x3f95db){var _0x23a1f1={'raw':!![],'where':{'id':_0x144a10[_0x29d0('0x3c')]['id']}},_0x79ea89={};_0x79ea89['model']=_[_0x29d0('0x2c')](db[_0x29d0('0x26')][_0x29d0('0x27')]);_0x79ea89[_0x29d0('0x2d')]=_['keys'](_0x144a10[_0x29d0('0x2d')]);_0x79ea89[_0x29d0('0x2e')]=_[_0x29d0('0x3d')](_0x79ea89[_0x29d0('0x2b')],_0x79ea89[_0x29d0('0x2d')]);_0x23a1f1[_0x29d0('0x2f')]=_[_0x29d0('0x3d')](_0x79ea89[_0x29d0('0x2b')],qs[_0x29d0('0x3e')](_0x144a10[_0x29d0('0x2d')][_0x29d0('0x3e')]));_0x23a1f1[_0x29d0('0x2f')]=_0x23a1f1[_0x29d0('0x2f')][_0x29d0('0x30')]?_0x23a1f1['attributes']:_0x79ea89[_0x29d0('0x2b')];if(_0x144a10['query'][_0x29d0('0x38')]){_0x23a1f1[_0x29d0('0x39')]=[{'all':!![]}];}_0x23a1f1=_[_0x29d0('0x37')]({},_0x23a1f1,_0x144a10['options']);return db['SmsTransferReport'][_0x29d0('0x3f')](_0x23a1f1)[_0x29d0('0x1f')](handleEntityNotFound(_0x3f95db,null))[_0x29d0('0x1f')](respondWithResult(_0x3f95db,null))[_0x29d0('0x3b')](handleError(_0x3f95db,null));};exports['create']=function(_0x3750b0,_0x1f4d7a){return db[_0x29d0('0x26')][_0x29d0('0x40')](_0x3750b0[_0x29d0('0x41')],{})[_0x29d0('0x1f')](respondWithResult(_0x1f4d7a,0xc9))[_0x29d0('0x3b')](handleError(_0x1f4d7a,null));};exports['update']=function(_0x5ce627,_0x2bfff8){if(_0x5ce627[_0x29d0('0x41')]['id']){delete _0x5ce627['body']['id'];}return db[_0x29d0('0x26')]['find']({'where':{'id':_0x5ce627[_0x29d0('0x3c')]['id']}})[_0x29d0('0x1f')](handleEntityNotFound(_0x2bfff8,null))[_0x29d0('0x1f')](saveUpdates(_0x5ce627['body'],null))['then'](respondWithResult(_0x2bfff8,null))[_0x29d0('0x3b')](handleError(_0x2bfff8,null));};exports[_0x29d0('0x20')]=function(_0x364302,_0x4cc68b){return db['SmsTransferReport'][_0x29d0('0x3f')]({'where':{'id':_0x364302['params']['id']}})[_0x29d0('0x1f')](handleEntityNotFound(_0x4cc68b,null))[_0x29d0('0x1f')](removeEntity(_0x4cc68b,null))['catch'](handleError(_0x4cc68b,null));};exports[_0x29d0('0x42')]=function(_0x44ebe6,_0x3defc6){return db[_0x29d0('0x26')]['describe']()[_0x29d0('0x1f')](respondWithResult(_0x3defc6,null))[_0x29d0('0x3b')](handleError(_0x3defc6,null));}; \ No newline at end of file +var _0x544a=['offset','limit','set','Content-Range','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','SmsTransferReport','fields','find','create','body','update','destroy','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x7b7b07,_0x6d42ca){var _0x3a6601=function(_0x1cd772){while(--_0x1cd772){_0x7b7b07['push'](_0x7b7b07['shift']());}};_0x3a6601(++_0x6d42ca);}(_0x544a,0xbd));var _0xa544=function(_0x50fd2d,_0x2caa66){_0x50fd2d=_0x50fd2d-0x0;var _0x23b611=_0x544a[_0x50fd2d];return _0x23b611;};'use strict';var pdf=require(_0xa544('0x0'));var emlformat=require(_0xa544('0x1'));var rimraf=require(_0xa544('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa544('0x3'));var moment=require('moment');var BPromise=require(_0xa544('0x4'));var Mustache=require(_0xa544('0x5'));var util=require('util');var path=require(_0xa544('0x6'));var sox=require(_0xa544('0x7'));var csv=require(_0xa544('0x8'));var ejs=require(_0xa544('0x9'));var fs=require('fs');var _=require(_0xa544('0xa'));var squel=require('squel');var crypto=require(_0xa544('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa544('0xc'));var toCsv=require(_0xa544('0x8'));var querystring=require('querystring');var Papa=require(_0xa544('0xd'));var Redis=require(_0xa544('0xe'));var authService=require(_0xa544('0xf'));var qs=require(_0xa544('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa544('0x11'));var logger=require(_0xa544('0x12'))('api');var utils=require(_0xa544('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa544('0x14'));var db=require(_0xa544('0x15'))['db'];function respondWithStatusCode(_0x4ca317,_0x310bd4){_0x310bd4=_0x310bd4||0xcc;return function(_0x272364){if(_0x272364){return _0x4ca317[_0xa544('0x16')](_0x310bd4);}return _0x4ca317[_0xa544('0x17')](_0x310bd4)[_0xa544('0x18')]();};}function respondWithResult(_0x40404a,_0x1ffda8){_0x1ffda8=_0x1ffda8||0xc8;return function(_0x4261d5){if(_0x4261d5){return _0x40404a[_0xa544('0x17')](_0x1ffda8)[_0xa544('0x19')](_0x4261d5);}};}function respondWithFilteredResult(_0x76e46d,_0x2cfc7a){return function(_0x4cb09c){if(_0x4cb09c){var _0xf285db=_0x4cb09c[_0xa544('0x1a')],_0x127ae5=_0x2cfc7a[_0xa544('0x1b')],_0x5341f1=_0x2cfc7a[_0xa544('0x1b')]+_0x2cfc7a[_0xa544('0x1c')],_0x9093bd;if(_0x5341f1>=_0xf285db){_0x5341f1=_0xf285db;_0x9093bd=0xc8;}else{_0x9093bd=0xce;}_0x76e46d[_0xa544('0x17')](_0x9093bd);return _0x76e46d[_0xa544('0x1d')](_0xa544('0x1e'),_0x127ae5+'-'+_0x5341f1+'/'+_0xf285db)[_0xa544('0x19')](_0x4cb09c);}return null;};}function patchUpdates(_0x1cb087){return function(_0x4f91ec){try{jsonpatch['apply'](_0x4f91ec,_0x1cb087,!![]);}catch(_0x51c042){return BPromise[_0xa544('0x1f')](_0x51c042);}return _0x4f91ec[_0xa544('0x20')]();};}function saveUpdates(_0x57a154,_0x453b93){return function(_0xa644ba){if(_0xa644ba){return _0xa644ba['update'](_0x57a154)[_0xa544('0x21')](function(_0x2a5029){return _0x2a5029;});}return null;};}function removeEntity(_0x2d332e,_0xb7df3d){return function(_0x5cb6ad){if(_0x5cb6ad){return _0x5cb6ad['destroy']()['then'](function(){_0x2d332e[_0xa544('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x407a61,_0x3794e3){return function(_0x11a6db){if(!_0x11a6db){_0x407a61[_0xa544('0x16')](0x194);}return _0x11a6db;};}function handleError(_0x14a587,_0x13150b){_0x13150b=_0x13150b||0x1f4;return function(_0xcd7bfa){logger[_0xa544('0x22')](_0xcd7bfa[_0xa544('0x23')]);if(_0xcd7bfa['name']){delete _0xcd7bfa[_0xa544('0x24')];}_0x14a587[_0xa544('0x17')](_0x13150b)['send'](_0xcd7bfa);};}exports[_0xa544('0x25')]=function(_0x116924,_0x43db5b){var _0x4fdf9e={},_0x1cc970={},_0x925a20={'count':0x0,'rows':[]};var _0x2939db=_[_0xa544('0x26')](db['SmsTransferReport'][_0xa544('0x27')],function(_0x290c45){return{'name':_0x290c45[_0xa544('0x28')],'type':_0x290c45['type'][_0xa544('0x29')]};});_0x1cc970[_0xa544('0x2a')]=_['map'](_0x2939db,'name');_0x1cc970[_0xa544('0x2b')]=_[_0xa544('0x2c')](_0x116924[_0xa544('0x2b')]);_0x1cc970['filters']=_[_0xa544('0x2d')](_0x1cc970[_0xa544('0x2a')],_0x1cc970[_0xa544('0x2b')]);_0x4fdf9e['attributes']=_[_0xa544('0x2d')](_0x1cc970[_0xa544('0x2a')],qs['fields'](_0x116924[_0xa544('0x2b')]['fields']));_0x4fdf9e[_0xa544('0x2e')]=_0x4fdf9e[_0xa544('0x2e')][_0xa544('0x2f')]?_0x4fdf9e['attributes']:_0x1cc970['model'];if(!_0x116924[_0xa544('0x2b')][_0xa544('0x30')](_0xa544('0x31'))){_0x4fdf9e['limit']=qs['limit'](_0x116924[_0xa544('0x2b')][_0xa544('0x1c')]);_0x4fdf9e[_0xa544('0x1b')]=qs['offset'](_0x116924['query'][_0xa544('0x1b')]);}_0x4fdf9e[_0xa544('0x32')]=qs[_0xa544('0x33')](_0x116924[_0xa544('0x2b')][_0xa544('0x33')]);_0x4fdf9e[_0xa544('0x34')]=qs[_0xa544('0x35')](_['pick'](_0x116924[_0xa544('0x2b')],_0x1cc970[_0xa544('0x35')]),_0x2939db);if(_0x116924[_0xa544('0x2b')][_0xa544('0x36')]){_0x4fdf9e['where']=_[_0xa544('0x37')](_0x4fdf9e[_0xa544('0x34')],{'$or':_[_0xa544('0x26')](_0x2939db,function(_0x31b81d){if(_0x31b81d['type']!==_0xa544('0x38')){var _0x2a89c9={};_0x2a89c9[_0x31b81d[_0xa544('0x24')]]={'$like':'%'+_0x116924['query'][_0xa544('0x36')]+'%'};return _0x2a89c9;}})});}_0x4fdf9e=_[_0xa544('0x37')]({},_0x4fdf9e,_0x116924[_0xa544('0x39')]);var _0x28e888={'where':_0x4fdf9e['where']};return db['SmsTransferReport'][_0xa544('0x1a')](_0x28e888)[_0xa544('0x21')](function(_0x50c517){_0x925a20[_0xa544('0x1a')]=_0x50c517;if(_0x116924[_0xa544('0x2b')][_0xa544('0x3a')]){_0x4fdf9e[_0xa544('0x3b')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xa544('0x3c')](_0x4fdf9e);})['then'](function(_0x564771){_0x925a20[_0xa544('0x3d')]=_0x564771;return _0x925a20;})[_0xa544('0x21')](respondWithFilteredResult(_0x43db5b,_0x4fdf9e))[_0xa544('0x3e')](handleError(_0x43db5b,null));};exports[_0xa544('0x3f')]=function(_0x42fcce,_0x2d0a52){var _0x70c14b={'raw':!![],'where':{'id':_0x42fcce[_0xa544('0x40')]['id']}},_0x1a5b73={};_0x1a5b73[_0xa544('0x2a')]=_['keys'](db[_0xa544('0x41')][_0xa544('0x27')]);_0x1a5b73['query']=_['keys'](_0x42fcce[_0xa544('0x2b')]);_0x1a5b73[_0xa544('0x35')]=_['intersection'](_0x1a5b73[_0xa544('0x2a')],_0x1a5b73['query']);_0x70c14b[_0xa544('0x2e')]=_[_0xa544('0x2d')](_0x1a5b73[_0xa544('0x2a')],qs[_0xa544('0x42')](_0x42fcce[_0xa544('0x2b')][_0xa544('0x42')]));_0x70c14b['attributes']=_0x70c14b['attributes'][_0xa544('0x2f')]?_0x70c14b[_0xa544('0x2e')]:_0x1a5b73[_0xa544('0x2a')];if(_0x42fcce['query']['includeAll']){_0x70c14b[_0xa544('0x3b')]=[{'all':!![]}];}_0x70c14b=_[_0xa544('0x37')]({},_0x70c14b,_0x42fcce[_0xa544('0x39')]);return db[_0xa544('0x41')][_0xa544('0x43')](_0x70c14b)[_0xa544('0x21')](handleEntityNotFound(_0x2d0a52,null))[_0xa544('0x21')](respondWithResult(_0x2d0a52,null))[_0xa544('0x3e')](handleError(_0x2d0a52,null));};exports[_0xa544('0x44')]=function(_0x74346e,_0x55951d){return db[_0xa544('0x41')][_0xa544('0x44')](_0x74346e[_0xa544('0x45')],{})[_0xa544('0x21')](respondWithResult(_0x55951d,0xc9))[_0xa544('0x3e')](handleError(_0x55951d,null));};exports[_0xa544('0x46')]=function(_0x4ed3de,_0x5bfb1b){if(_0x4ed3de[_0xa544('0x45')]['id']){delete _0x4ed3de[_0xa544('0x45')]['id'];}return db[_0xa544('0x41')][_0xa544('0x43')]({'where':{'id':_0x4ed3de[_0xa544('0x40')]['id']}})[_0xa544('0x21')](handleEntityNotFound(_0x5bfb1b,null))[_0xa544('0x21')](saveUpdates(_0x4ed3de['body'],null))['then'](respondWithResult(_0x5bfb1b,null))[_0xa544('0x3e')](handleError(_0x5bfb1b,null));};exports[_0xa544('0x47')]=function(_0x987504,_0x2da6e5){return db[_0xa544('0x41')]['find']({'where':{'id':_0x987504[_0xa544('0x40')]['id']}})[_0xa544('0x21')](handleEntityNotFound(_0x2da6e5,null))[_0xa544('0x21')](removeEntity(_0x2da6e5,null))[_0xa544('0x3e')](handleError(_0x2da6e5,null));};exports['describe']=function(_0x909aa9,_0x1b8e91){return db[_0xa544('0x41')]['describe']()[_0xa544('0x21')](respondWithResult(_0x1b8e91,null))[_0xa544('0x3e')](handleError(_0x1b8e91,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4ecba1b..a483457 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 _0x7096=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','api','bluebird','request-promise','path'];(function(_0x1c7aaf,_0x35f2b4){var _0x582310=function(_0x48a36c){while(--_0x48a36c){_0x1c7aaf['push'](_0x1c7aaf['shift']());}};_0x582310(++_0x35f2b4);}(_0x7096,0x10c));var _0x6709=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7096[_0x24237f];return _0x48298e;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf61e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4a05e7,_0x22f0df){var _0x126423=function(_0x58f08c){while(--_0x58f08c){_0x4a05e7['push'](_0x4a05e7['shift']());}};_0x126423(++_0x22f0df);}(_0xf61e,0x191));var _0xef61=function(_0x109001,_0x308be9){_0x109001=_0x109001-0x0;var _0x2d97dc=_0xf61e[_0x109001];return _0x2d97dc;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('SmsTransferReport',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index fbcd481..07a86cb 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 _0x8e91=['info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1148d5,_0x559401){var _0x585624=function(_0x57f3ba){while(--_0x57f3ba){_0x1148d5['push'](_0x1148d5['shift']());}};_0x585624(++_0x559401);}(_0x8e91,0x1c1));var _0x18e9=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x8e91[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x18e9('0x0'));var util=require('util');var moment=require(_0x18e9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18e9('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x18e9('0x3'))(_0x18e9('0x4'));var config=require(_0x18e9('0x5'));var jayson=require(_0x18e9('0x6'));var client=jayson[_0x18e9('0x7')][_0x18e9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39a7c7,_0xb3725,_0x5129cd){return new BPromise(function(_0x53e99c,_0x558a85){return client[_0x18e9('0x9')](_0x39a7c7,_0x5129cd)[_0x18e9('0xa')](function(_0x280454){logger[_0x18e9('0xb')](_0x18e9('0xc'),_0xb3725,_0x18e9('0xd'));logger['debug'](_0x18e9('0xe'),_0xb3725,_0x18e9('0xd'),JSON[_0x18e9('0xf')](_0x280454));if(_0x280454[_0x18e9('0x10')]){if(_0x280454['error'][_0x18e9('0x11')]===0x1f4){logger['error'](_0x18e9('0xc'),_0xb3725,_0x280454[_0x18e9('0x10')][_0x18e9('0x12')]);return _0x558a85(_0x280454[_0x18e9('0x10')][_0x18e9('0x12')]);}logger[_0x18e9('0x10')](_0x18e9('0xc'),_0xb3725,_0x280454[_0x18e9('0x10')][_0x18e9('0x12')]);return _0x53e99c(_0x280454[_0x18e9('0x10')][_0x18e9('0x12')]);}else{logger[_0x18e9('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0xb3725,_0x18e9('0xd'));_0x53e99c(_0x280454[_0x18e9('0x13')][_0x18e9('0x12')]);}})['catch'](function(_0x380d3b){logger[_0x18e9('0x10')](_0x18e9('0xc'),_0xb3725,_0x380d3b);_0x558a85(_0x380d3b);});});} \ No newline at end of file +var _0x2d5b=['lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','SmsTransferReport,\x20%s,\x20%s','result','catch'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2d5b,0x1ce));var _0xb2d5=function(_0x46c6a2,_0x441de6){_0x46c6a2=_0x46c6a2-0x0;var _0x3d6fe8=_0x2d5b[_0x46c6a2];return _0x3d6fe8;};'use strict';var _=require(_0xb2d5('0x0'));var util=require(_0xb2d5('0x1'));var moment=require('moment');var BPromise=require(_0xb2d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb2d5('0x3'));var logger=require('../../config/logger')(_0xb2d5('0x4'));var config=require(_0xb2d5('0x5'));var jayson=require(_0xb2d5('0x6'));var client=jayson[_0xb2d5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x362d8f,_0x3d60d6,_0x4c950e){return new BPromise(function(_0x392b77,_0x4ba188){return client[_0xb2d5('0x8')](_0x362d8f,_0x4c950e)[_0xb2d5('0x9')](function(_0x4a11b7){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x3d60d6,_0xb2d5('0xa'));logger[_0xb2d5('0xb')](_0xb2d5('0xc'),_0x3d60d6,_0xb2d5('0xa'),JSON[_0xb2d5('0xd')](_0x4a11b7));if(_0x4a11b7[_0xb2d5('0xe')]){if(_0x4a11b7[_0xb2d5('0xe')][_0xb2d5('0xf')]===0x1f4){logger[_0xb2d5('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x3d60d6,_0x4a11b7[_0xb2d5('0xe')]['message']);return _0x4ba188(_0x4a11b7[_0xb2d5('0xe')][_0xb2d5('0x10')]);}logger[_0xb2d5('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x3d60d6,_0x4a11b7[_0xb2d5('0xe')][_0xb2d5('0x10')]);return _0x392b77(_0x4a11b7['error'][_0xb2d5('0x10')]);}else{logger[_0xb2d5('0x11')](_0xb2d5('0x12'),_0x3d60d6,_0xb2d5('0xa'));_0x392b77(_0x4a11b7[_0xb2d5('0x13')][_0xb2d5('0x10')]);}})[_0xb2d5('0x14')](function(_0x2dc0bf){logger[_0xb2d5('0xe')](_0xb2d5('0x12'),_0x3d60d6,_0x2dc0bf);_0x4ba188(_0x2dc0bf);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 439c743..9cff25e 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 _0xe1f6=['show','download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','post','single','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0xce4c10,_0x50ae1e){var _0x4b58ea=function(_0x2a9677){while(--_0x2a9677){_0xce4c10['push'](_0xce4c10['shift']());}};_0x4b58ea(++_0x50ae1e);}(_0xe1f6,0x116));var _0x6e1f=function(_0x16b994,_0x22872a){_0x16b994=_0x16b994-0x0;var _0xfc3e0f=_0xe1f6[_0x16b994];return _0xfc3e0f;};'use strict';var multer=require(_0x6e1f('0x0'));var util=require(_0x6e1f('0x1'));var path=require(_0x6e1f('0x2'));var timeout=require(_0x6e1f('0x3'));var express=require(_0x6e1f('0x4'));var router=express[_0x6e1f('0x5')]();var auth=require(_0x6e1f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e1f('0x7'));var controller=require('./sound.controller');router[_0x6e1f('0x8')]('/',auth[_0x6e1f('0x9')](),controller[_0x6e1f('0xa')]);router[_0x6e1f('0x8')](_0x6e1f('0xb'),auth[_0x6e1f('0x9')](),controller[_0x6e1f('0xc')]);router[_0x6e1f('0x8')]('/:id/download',auth[_0x6e1f('0x9')](),controller[_0x6e1f('0xd')]);var upload=multer({'storage':multer[_0x6e1f('0xe')]({'destination':function(_0x4fa338,_0x1caf5b,_0x559ce4){_0x559ce4(null,path[_0x6e1f('0xf')](config['root'],_0x6e1f('0x10')));},'filename':function(_0xc9082a,_0x287001,_0x51407d){_0x287001[_0x6e1f('0x11')]=_0x287001[_0x6e1f('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x51407d(null,util[_0x6e1f('0x12')](_0x6e1f('0x13'),path[_0x6e1f('0x14')](_0x287001[_0x6e1f('0x11')],path[_0x6e1f('0x15')](_0x287001[_0x6e1f('0x11')])),Date['now'](),path['extname'](_0x287001[_0x6e1f('0x11')])));}})});router[_0x6e1f('0x16')]('/',upload[_0x6e1f('0x17')]('file'),controller[_0x6e1f('0x18')]);router[_0x6e1f('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x6e1f('0x1a')]);router[_0x6e1f('0x1b')](_0x6e1f('0xb'),auth[_0x6e1f('0x9')](),controller[_0x6e1f('0x1b')]);module[_0x6e1f('0x1c')]=router; \ No newline at end of file +var _0xd433=['get','diskStorage','join','root','server/files/sounds/original/','originalname','format','%s-%s%s','extname','now','post','single','file','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show'];(function(_0x4232d8,_0x13fd09){var _0x324de2=function(_0x167ad5){while(--_0x167ad5){_0x4232d8['push'](_0x4232d8['shift']());}};_0x324de2(++_0x13fd09);}(_0xd433,0x102));var _0x3d43=function(_0x5a3bb9,_0x5180f6){_0x5a3bb9=_0x5a3bb9-0x0;var _0x2f76b7=_0xd433[_0x5a3bb9];return _0x2f76b7;};'use strict';var multer=require(_0x3d43('0x0'));var util=require('util');var path=require(_0x3d43('0x1'));var timeout=require(_0x3d43('0x2'));var express=require(_0x3d43('0x3'));var router=express[_0x3d43('0x4')]();var auth=require(_0x3d43('0x5'));var interaction=require(_0x3d43('0x6'));var config=require(_0x3d43('0x7'));var controller=require('./sound.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3d43('0x8')]);router['get'](_0x3d43('0x9'),auth[_0x3d43('0xa')](),controller[_0x3d43('0xb')]);router[_0x3d43('0xc')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x3d43('0xd')]({'destination':function(_0x46940f,_0x355360,_0x2e5c4c){_0x2e5c4c(null,path[_0x3d43('0xe')](config[_0x3d43('0xf')],_0x3d43('0x10')));},'filename':function(_0x48d0c0,_0x6f3346,_0x40c7a1){_0x6f3346[_0x3d43('0x11')]=_0x6f3346['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x40c7a1(null,util[_0x3d43('0x12')](_0x3d43('0x13'),path['basename'](_0x6f3346[_0x3d43('0x11')],path[_0x3d43('0x14')](_0x6f3346[_0x3d43('0x11')])),Date[_0x3d43('0x15')](),path[_0x3d43('0x14')](_0x6f3346[_0x3d43('0x11')])));}})});router[_0x3d43('0x16')]('/',upload[_0x3d43('0x17')](_0x3d43('0x18')),controller[_0x3d43('0x19')]);router[_0x3d43('0x1a')](_0x3d43('0x9'),auth['isAuthenticated'](),controller[_0x3d43('0x1b')]);router[_0x3d43('0x1c')]('/:id',auth[_0x3d43('0xa')](),controller[_0x3d43('0x1c')]);module[_0x3d43('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 5d87cde..e3902b0 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 _0x860f=['INTEGER','FLOAT','exports','STRING','BIGINT'];(function(_0x358cdc,_0x46028c){var _0x203442=function(_0x256816){while(--_0x256816){_0x358cdc['push'](_0x358cdc['shift']());}};_0x203442(++_0x46028c);}(_0x860f,0x10b));var _0xf860=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x860f[_0x5b78e8];return _0xf2c321;};'use strict';var Sequelize=require('sequelize');module[_0xf860('0x0')]={'name':{'type':Sequelize[_0xf860('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xf860('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xf860('0x2')]},'original_channelCount':{'type':Sequelize[_0xf860('0x3')]},'original_bitRate':{'type':Sequelize[_0xf860('0x2')]},'original_sampleRate':{'type':Sequelize[_0xf860('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xf860('0x4')]},'converted_sampleCount':{'type':Sequelize[_0xf860('0x2')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xf860('0x2')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x30a4=['STRING','name','INTEGER','BIGINT','FLOAT','sequelize'];(function(_0x2f389e,_0x584040){var _0x5921ab=function(_0x4f1bbc){while(--_0x4f1bbc){_0x2f389e['push'](_0x2f389e['shift']());}};_0x5921ab(++_0x584040);}(_0x30a4,0xa1));var _0x430a=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x30a4[_0x1e17eb];return _0x4de4c7;};'use strict';var Sequelize=require(_0x430a('0x0'));module['exports']={'name':{'type':Sequelize[_0x430a('0x1')],'unique':_0x430a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x430a('0x1')]},'display_name':{'type':Sequelize[_0x430a('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x430a('0x1')]},'original_format':{'type':Sequelize[_0x430a('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x430a('0x3')]},'original_bitRate':{'type':Sequelize[_0x430a('0x4')]},'original_sampleRate':{'type':Sequelize[_0x430a('0x3')]},'converted_format':{'type':Sequelize[_0x430a('0x1')]},'converted_duration':{'type':Sequelize[_0x430a('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x430a('0x4')]},'converted_channelCount':{'type':Sequelize[_0x430a('0x3')]},'converted_bitRate':{'type':Sequelize[_0x430a('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x430a('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 604f9ec..6f520d4 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 _0x1d9c=['find','catch','download','save_name','converted_format','join','root','server/files/sounds/converted','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','original_format','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','nolimit','limit','order','sort','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','params','length'];(function(_0x2a990c,_0x241e85){var _0x47d328=function(_0xdad74){while(--_0xdad74){_0x2a990c['push'](_0x2a990c['shift']());}};_0x47d328(++_0x241e85);}(_0x1d9c,0x12e));var _0xc1d9=function(_0x1af232,_0x543140){_0x1af232=_0x1af232-0x0;var _0x248a80=_0x1d9c[_0x1af232];return _0x248a80;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc1d9('0x0'));var zipdir=require(_0xc1d9('0x1'));var jsonpatch=require(_0xc1d9('0x2'));var rp=require(_0xc1d9('0x3'));var moment=require('moment');var BPromise=require(_0xc1d9('0x4'));var Mustache=require(_0xc1d9('0x5'));var util=require(_0xc1d9('0x6'));var path=require(_0xc1d9('0x7'));var sox=require(_0xc1d9('0x8'));var csv=require(_0xc1d9('0x9'));var ejs=require(_0xc1d9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc1d9('0xb'));var crypto=require('crypto');var jsforce=require(_0xc1d9('0xc'));var deskjs=require(_0xc1d9('0xd'));var toCsv=require(_0xc1d9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc1d9('0xe'));var authService=require(_0xc1d9('0xf'));var qs=require(_0xc1d9('0x10'));var as=require(_0xc1d9('0x11'));var hardwareService=require(_0xc1d9('0x12'));var logger=require(_0xc1d9('0x13'))('api');var utils=require(_0xc1d9('0x14'));var config=require(_0xc1d9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1d9('0x16'))['db'];function respondWithStatusCode(_0x1a20e0,_0xce9f08){_0xce9f08=_0xce9f08||0xcc;return function(_0x31deeb){if(_0x31deeb){return _0x1a20e0[_0xc1d9('0x17')](_0xce9f08);}return _0x1a20e0[_0xc1d9('0x18')](_0xce9f08)[_0xc1d9('0x19')]();};}function respondWithResult(_0x19ca5a,_0x51b146){_0x51b146=_0x51b146||0xc8;return function(_0x5053e5){if(_0x5053e5){return _0x19ca5a[_0xc1d9('0x18')](_0x51b146)[_0xc1d9('0x1a')](_0x5053e5);}};}function respondWithFilteredResult(_0xb15915,_0x2e6562){return function(_0x2a6544){if(_0x2a6544){var _0xd7a205=_0x2a6544[_0xc1d9('0x1b')],_0x2899be=_0x2e6562[_0xc1d9('0x1c')],_0x4a1ff8=_0x2e6562[_0xc1d9('0x1c')]+_0x2e6562['limit'],_0x4d2c80;if(_0x4a1ff8>=_0xd7a205){_0x4a1ff8=_0xd7a205;_0x4d2c80=0xc8;}else{_0x4d2c80=0xce;}_0xb15915[_0xc1d9('0x18')](_0x4d2c80);return _0xb15915[_0xc1d9('0x1d')](_0xc1d9('0x1e'),_0x2899be+'-'+_0x4a1ff8+'/'+_0xd7a205)['json'](_0x2a6544);}return null;};}function patchUpdates(_0x5e9006){return function(_0x301f6d){try{jsonpatch['apply'](_0x301f6d,_0x5e9006,!![]);}catch(_0x5d2b4f){return BPromise[_0xc1d9('0x1f')](_0x5d2b4f);}return _0x301f6d[_0xc1d9('0x20')]();};}function saveUpdates(_0x24409a,_0x16e575){return function(_0x51d1fb){if(_0x51d1fb){return _0x51d1fb['update'](_0x24409a)[_0xc1d9('0x21')](function(_0x16d5c2){return _0x16d5c2;});}return null;};}function removeEntity(_0x1e9de2,_0x412dab){return function(_0x3e3855){if(_0x3e3855){return _0x3e3855[_0xc1d9('0x22')]()[_0xc1d9('0x21')](function(){var _0x4ab3ce=_0x3e3855[_0xc1d9('0x23')]({'plain':!![]});var _0x55ba92=_0xc1d9('0x24');return db[_0xc1d9('0x25')][_0xc1d9('0x22')]({'where':{'type':_0x55ba92,'resourceId':_0x4ab3ce['id']}})[_0xc1d9('0x21')](function(){return _0x3e3855;});})[_0xc1d9('0x21')](function(){_0x1e9de2[_0xc1d9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x76417e,_0x19f2c3){return function(_0x4bd6dd){if(!_0x4bd6dd){_0x76417e['sendStatus'](0x194);}return _0x4bd6dd;};}function handleError(_0x38e0bb,_0x2ef3fe){_0x2ef3fe=_0x2ef3fe||0x1f4;return function(_0x316cda){logger[_0xc1d9('0x26')](_0x316cda[_0xc1d9('0x27')]);if(_0x316cda[_0xc1d9('0x28')]){delete _0x316cda[_0xc1d9('0x28')];}_0x38e0bb[_0xc1d9('0x18')](_0x2ef3fe)[_0xc1d9('0x29')](_0x316cda);};}exports[_0xc1d9('0x2a')]=function(_0x53bb13,_0x5a619d){var _0x2ab1b8={},_0xf5c845={},_0xc1adce={'count':0x0,'rows':[]};var _0x154619=_[_0xc1d9('0x2b')](db[_0xc1d9('0x2c')][_0xc1d9('0x2d')],function(_0x3e63c){return{'name':_0x3e63c['fieldName'],'type':_0x3e63c[_0xc1d9('0x2e')][_0xc1d9('0x2f')]};});_0xf5c845[_0xc1d9('0x30')]=_[_0xc1d9('0x2b')](_0x154619,_0xc1d9('0x28'));_0xf5c845[_0xc1d9('0x31')]=_[_0xc1d9('0x32')](_0x53bb13[_0xc1d9('0x31')]);_0xf5c845['filters']=_[_0xc1d9('0x33')](_0xf5c845['model'],_0xf5c845[_0xc1d9('0x31')]);_0x2ab1b8['attributes']=_[_0xc1d9('0x33')](_0xf5c845['model'],qs[_0xc1d9('0x34')](_0x53bb13[_0xc1d9('0x31')][_0xc1d9('0x34')]));_0x2ab1b8[_0xc1d9('0x35')]=_0x2ab1b8[_0xc1d9('0x35')]['length']?_0x2ab1b8['attributes']:_0xf5c845[_0xc1d9('0x30')];if(!_0x53bb13['query']['hasOwnProperty'](_0xc1d9('0x36'))){_0x2ab1b8[_0xc1d9('0x37')]=qs[_0xc1d9('0x37')](_0x53bb13[_0xc1d9('0x31')][_0xc1d9('0x37')]);_0x2ab1b8[_0xc1d9('0x1c')]=qs[_0xc1d9('0x1c')](_0x53bb13[_0xc1d9('0x31')]['offset']);}_0x2ab1b8[_0xc1d9('0x38')]=qs[_0xc1d9('0x39')](_0x53bb13[_0xc1d9('0x31')][_0xc1d9('0x39')]);_0x2ab1b8['where']=qs[_0xc1d9('0x3a')](_[_0xc1d9('0x3b')](_0x53bb13[_0xc1d9('0x31')],_0xf5c845[_0xc1d9('0x3a')]),_0x154619);if(_0x53bb13['query'][_0xc1d9('0x3c')]){_0x2ab1b8['where']=_[_0xc1d9('0x3d')](_0x2ab1b8[_0xc1d9('0x3e')],{'$or':_[_0xc1d9('0x2b')](_0x154619,function(_0x4fd4c8){if(_0x4fd4c8[_0xc1d9('0x2e')]!==_0xc1d9('0x3f')){var _0x234008={};_0x234008[_0x4fd4c8[_0xc1d9('0x28')]]={'$like':'%'+_0x53bb13[_0xc1d9('0x31')][_0xc1d9('0x3c')]+'%'};return _0x234008;}})});}_0x2ab1b8=_[_0xc1d9('0x3d')]({},_0x2ab1b8,_0x53bb13['options']);var _0x47f7ec={'where':_0x2ab1b8[_0xc1d9('0x3e')]};return db[_0xc1d9('0x2c')][_0xc1d9('0x1b')](_0x47f7ec)[_0xc1d9('0x21')](function(_0x5d1fb3){_0xc1adce[_0xc1d9('0x1b')]=_0x5d1fb3;if(_0x53bb13[_0xc1d9('0x31')][_0xc1d9('0x40')]){_0x2ab1b8[_0xc1d9('0x41')]=[{'all':!![]}];}return db[_0xc1d9('0x2c')][_0xc1d9('0x42')](_0x2ab1b8);})[_0xc1d9('0x21')](function(_0x171e2){_0xc1adce[_0xc1d9('0x43')]=_0x171e2;return _0xc1adce;})[_0xc1d9('0x21')](respondWithFilteredResult(_0x5a619d,_0x2ab1b8))['catch'](handleError(_0x5a619d,null));};exports['show']=function(_0x4429cd,_0x449b30){var _0x142700={'raw':!![],'where':{'id':_0x4429cd[_0xc1d9('0x44')]['id']}},_0x3faf62={};_0x3faf62[_0xc1d9('0x30')]=_['keys'](db[_0xc1d9('0x2c')][_0xc1d9('0x2d')]);_0x3faf62[_0xc1d9('0x31')]=_[_0xc1d9('0x32')](_0x4429cd[_0xc1d9('0x31')]);_0x3faf62['filters']=_['intersection'](_0x3faf62[_0xc1d9('0x30')],_0x3faf62[_0xc1d9('0x31')]);_0x142700[_0xc1d9('0x35')]=_[_0xc1d9('0x33')](_0x3faf62[_0xc1d9('0x30')],qs[_0xc1d9('0x34')](_0x4429cd[_0xc1d9('0x31')][_0xc1d9('0x34')]));_0x142700[_0xc1d9('0x35')]=_0x142700[_0xc1d9('0x35')][_0xc1d9('0x45')]?_0x142700[_0xc1d9('0x35')]:_0x3faf62[_0xc1d9('0x30')];if(_0x4429cd[_0xc1d9('0x31')][_0xc1d9('0x40')]){_0x142700['include']=[{'all':!![]}];}_0x142700=_[_0xc1d9('0x3d')]({},_0x142700,_0x4429cd['options']);return db['Sound'][_0xc1d9('0x46')](_0x142700)[_0xc1d9('0x21')](handleEntityNotFound(_0x449b30,null))[_0xc1d9('0x21')](respondWithResult(_0x449b30,null))[_0xc1d9('0x47')](handleError(_0x449b30,null));};exports[_0xc1d9('0x48')]=function(_0x46f35f,_0x1b1722,_0x16e83e){return db['Sound']['find']({'where':{'id':_0x46f35f[_0xc1d9('0x44')]['id']},'attributes':[_0xc1d9('0x28'),_0xc1d9('0x49'),_0xc1d9('0x4a')],'raw':!![]})[_0xc1d9('0x21')](handleEntityNotFound(_0x1b1722,null))[_0xc1d9('0x21')](function(_0x5cfad3){if(_0x5cfad3){if(!fs['existsSync'](path[_0xc1d9('0x4b')](config[_0xc1d9('0x4c')],_0xc1d9('0x4d'),_0x5cfad3[_0xc1d9('0x49')]+'.'+_0x5cfad3[_0xc1d9('0x4a')]))){throw new db['Sequelize']['ValidationError'](_0xc1d9('0x4e'));}return _0x1b1722[_0xc1d9('0x48')](path[_0xc1d9('0x4b')](config['root'],_0xc1d9('0x4d'),util[_0xc1d9('0x4f')](_0xc1d9('0x50'),_0x5cfad3[_0xc1d9('0x49')],_0x5cfad3[_0xc1d9('0x4a')])),util[_0xc1d9('0x4f')](_0xc1d9('0x50'),_0x5cfad3['name'],_0x5cfad3[_0xc1d9('0x4a')]));}return null;})['catch'](handleError(_0x1b1722,null));};exports[_0xc1d9('0x51')]=function(_0x4d0087,_0x14e363,_0x176e83){var _0x1869af={'name':path[_0xc1d9('0x52')](_0x4d0087[_0xc1d9('0x53')][_0xc1d9('0x54')],path[_0xc1d9('0x55')](_0x4d0087[_0xc1d9('0x53')][_0xc1d9('0x54')])),'save_name':path[_0xc1d9('0x52')](_0x4d0087[_0xc1d9('0x53')][_0xc1d9('0x56')],path[_0xc1d9('0x55')](_0x4d0087[_0xc1d9('0x53')][_0xc1d9('0x56')])),'original_format':path['extname'](_0x4d0087[_0xc1d9('0x53')][_0xc1d9('0x54')])[_0xc1d9('0x57')](0x1),'converted_format':_0xc1d9('0x58')};var _0x4cc222=path[_0xc1d9('0x4b')](config[_0xc1d9('0x4c')],_0xc1d9('0x59'),_0x4d0087['file'][_0xc1d9('0x56')]);var _0x20b832=path[_0xc1d9('0x4b')](config['root'],_0xc1d9('0x4d'),util['format'](_0xc1d9('0x50'),path['basename'](_0x4d0087[_0xc1d9('0x53')][_0xc1d9('0x56')],path[_0xc1d9('0x55')](_0x4d0087[_0xc1d9('0x53')][_0xc1d9('0x56')])),_0x1869af[_0xc1d9('0x4a')]));logger[_0xc1d9('0x5a')](_0xc1d9('0x5b'),_0x4cc222);logger[_0xc1d9('0x5a')](_0xc1d9('0x5c'),_0x20b832);try{fs[_0xc1d9('0x5d')](_0x4cc222,parseInt(_0xc1d9('0x5e'),0x8));var _0x28899c=sox[_0xc1d9('0x5f')](_0x4cc222,_0x20b832,{'sampleRate':0x1f40,'format':_0xc1d9('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x28899c['on'](_0xc1d9('0x26'),function(_0x55fc2e){fs['unlinkSync'](_0x4cc222);_0x14e363[_0xc1d9('0x18')](0x1f4)[_0xc1d9('0x29')](_0x55fc2e);});_0x28899c['on'](_0xc1d9('0x60'),function(_0x533d14){_0x1869af[_0xc1d9('0x61')]=isNaN(_0x533d14[_0xc1d9('0x62')])?null:_0x533d14['duration']*0x3e8;_0x1869af[_0xc1d9('0x63')]=isNaN(_0x533d14[_0xc1d9('0x64')])?null:_0x533d14[_0xc1d9('0x64')];_0x1869af[_0xc1d9('0x65')]=isNaN(_0x533d14[_0xc1d9('0x66')])?null:_0x533d14[_0xc1d9('0x66')];_0x1869af[_0xc1d9('0x67')]=isNaN(_0x533d14['bitRate'])?null:_0x533d14[_0xc1d9('0x68')];_0x1869af[_0xc1d9('0x69')]=isNaN(_0x533d14[_0xc1d9('0x6a')])?null:_0x533d14[_0xc1d9('0x6a')];});_0x28899c['on'](_0xc1d9('0x6b'),function(_0x318424){_0x1869af[_0xc1d9('0x6c')]=isNaN(_0x318424[_0xc1d9('0x62')])?null:_0x318424[_0xc1d9('0x62')]*0x3e8;_0x1869af[_0xc1d9('0x6d')]=isNaN(_0x318424[_0xc1d9('0x64')])?null:_0x318424[_0xc1d9('0x64')];_0x1869af[_0xc1d9('0x6e')]=isNaN(_0x318424[_0xc1d9('0x66')])?null:_0x318424[_0xc1d9('0x66')];_0x1869af[_0xc1d9('0x6f')]=isNaN(_0x318424[_0xc1d9('0x68')])?null:_0x318424[_0xc1d9('0x68')];_0x1869af[_0xc1d9('0x70')]=isNaN(_0x318424[_0xc1d9('0x6a')])?null:_0x318424[_0xc1d9('0x6a')];});_0x28899c['on'](_0xc1d9('0x19'),function(){fs[_0xc1d9('0x5d')](_0x20b832,parseInt('0777',0x8));return db[_0xc1d9('0x2c')][_0xc1d9('0x51')](_0x1869af)[_0xc1d9('0x21')](function(_0x14fb36){var _0xeb0ac3={'role':_0x4d0087[_0xc1d9('0x71')][_0xc1d9('0x72')],'userProfileId':_0x4d0087[_0xc1d9('0x71')][_0xc1d9('0x73')]};if(!_0xeb0ac3)throw new Error(_0xc1d9('0x74'));if(_0xeb0ac3[_0xc1d9('0x72')]==='user'){var _0x163369=_0x14fb36['get']({'plain':!![]});return db[_0xc1d9('0x75')][_0xc1d9('0x46')]({'where':{'name':_0xc1d9('0x24'),'userProfileId':_0xeb0ac3[_0xc1d9('0x73')]},'raw':!![]})[_0xc1d9('0x21')](function(_0x4e8ccd){if(_0x4e8ccd&&_0x4e8ccd[_0xc1d9('0x76')]===0x0){return db[_0xc1d9('0x25')][_0xc1d9('0x51')]({'name':_0x163369[_0xc1d9('0x28')],'resourceId':_0x163369['id'],'type':_0x4e8ccd[_0xc1d9('0x28')],'sectionId':_0x4e8ccd['id']},{})[_0xc1d9('0x21')](function(){return _0x14fb36;});}else{return _0x14fb36;}})['catch'](function(_0x55d098){logger[_0xc1d9('0x26')](_0xc1d9('0x77'),_0x55d098);throw _0x55d098;});}return _0x14fb36;})[_0xc1d9('0x21')](respondWithResult(_0x14e363,null))[_0xc1d9('0x47')](handleError(_0x14e363,null));});_0x28899c['start']();}catch(_0x15f7f3){_0x14e363[_0xc1d9('0x18')](0x1f4)['send'](_0x15f7f3);}};exports[_0xc1d9('0x78')]=function(_0x2d80cb,_0x1512bc,_0x41a348){return db[_0xc1d9('0x2c')]['find']({'where':{'id':_0x2d80cb[_0xc1d9('0x44')]['id']}})['then'](handleEntityNotFound(_0x1512bc,null))[_0xc1d9('0x21')](saveUpdates(_[_0xc1d9('0x3b')](_0x2d80cb[_0xc1d9('0x71')],[_0xc1d9('0x28'),_0xc1d9('0x79')]),null))[_0xc1d9('0x21')](respondWithResult(_0x1512bc,null))[_0xc1d9('0x47')](handleError(_0x1512bc,null));};exports['delete']=function(_0x11bbd7,_0x91b966,_0x33e22b){return db[_0xc1d9('0x2c')][_0xc1d9('0x46')]({'where':{'id':_0x11bbd7['params']['id']}})['then'](function(_0x49c288){if(_0x49c288){return _0x49c288[_0xc1d9('0x22')]();}})[_0xc1d9('0x21')](function(_0x40ffad){var _0x48b866=path[_0xc1d9('0x4b')](config[_0xc1d9('0x4c')],_0xc1d9('0x59'),util[_0xc1d9('0x4f')]('%s.%s',_0x40ffad['save_name'],_0x40ffad[_0xc1d9('0x7a')]));var _0x33a9ed=path['join'](config[_0xc1d9('0x4c')],_0xc1d9('0x4d'),util[_0xc1d9('0x4f')]('%s.%s',_0x40ffad[_0xc1d9('0x49')],_0x40ffad['converted_format']));fs[_0xc1d9('0x7b')](_0x48b866);fs[_0xc1d9('0x7b')](_0x33a9ed);return _0x40ffad;})[_0xc1d9('0x21')](function(_0x3f1f02){if(_0x3f1f02){return _0x91b966['status'](0xcc)[_0xc1d9('0x19')]();}})[_0xc1d9('0x21')](handleEntityNotFound(_0x91b966,null))[_0xc1d9('0x47')](handleError(_0x91b966,null));}; \ No newline at end of file +var _0x6a36=['find','catch','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','download','format','%s.%s','file','originalname','extname','basename','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','error','unlinkSync','src','duration','original_sampleCount','sampleCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_sampleRate','chmodSync','create','body','role','userProfileId','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','map','Sound','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys'];(function(_0x548ab9,_0x11b7f5){var _0x2f3414=function(_0x27e38d){while(--_0x27e38d){_0x548ab9['push'](_0x548ab9['shift']());}};_0x2f3414(++_0x11b7f5);}(_0x6a36,0x1a5));var _0x66a3=function(_0x14d8f6,_0x9ca864){_0x14d8f6=_0x14d8f6-0x0;var _0x3433ac=_0x6a36[_0x14d8f6];return _0x3433ac;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x66a3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x66a3('0x1'));var jsonpatch=require(_0x66a3('0x2'));var rp=require(_0x66a3('0x3'));var moment=require('moment');var BPromise=require(_0x66a3('0x4'));var Mustache=require(_0x66a3('0x5'));var util=require(_0x66a3('0x6'));var path=require(_0x66a3('0x7'));var sox=require(_0x66a3('0x8'));var csv=require(_0x66a3('0x9'));var ejs=require(_0x66a3('0xa'));var fs=require('fs');var _=require(_0x66a3('0xb'));var squel=require(_0x66a3('0xc'));var crypto=require(_0x66a3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x66a3('0xe'));var toCsv=require(_0x66a3('0x9'));var querystring=require(_0x66a3('0xf'));var Papa=require(_0x66a3('0x10'));var Redis=require('ioredis');var authService=require(_0x66a3('0x11'));var qs=require(_0x66a3('0x12'));var as=require(_0x66a3('0x13'));var hardwareService=require(_0x66a3('0x14'));var logger=require(_0x66a3('0x15'))('api');var utils=require(_0x66a3('0x16'));var config=require(_0x66a3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x66a3('0x18'))['db'];function respondWithStatusCode(_0x32c05d,_0x2f7537){_0x2f7537=_0x2f7537||0xcc;return function(_0x3b805b){if(_0x3b805b){return _0x32c05d[_0x66a3('0x19')](_0x2f7537);}return _0x32c05d[_0x66a3('0x1a')](_0x2f7537)[_0x66a3('0x1b')]();};}function respondWithResult(_0x4c0fd1,_0x58f617){_0x58f617=_0x58f617||0xc8;return function(_0x2fdd55){if(_0x2fdd55){return _0x4c0fd1[_0x66a3('0x1a')](_0x58f617)[_0x66a3('0x1c')](_0x2fdd55);}};}function respondWithFilteredResult(_0xa0e9cb,_0x470637){return function(_0x37a915){if(_0x37a915){var _0x594050=_0x37a915[_0x66a3('0x1d')],_0x2ff217=_0x470637[_0x66a3('0x1e')],_0x4cd9c7=_0x470637['offset']+_0x470637[_0x66a3('0x1f')],_0x436269;if(_0x4cd9c7>=_0x594050){_0x4cd9c7=_0x594050;_0x436269=0xc8;}else{_0x436269=0xce;}_0xa0e9cb['status'](_0x436269);return _0xa0e9cb[_0x66a3('0x20')](_0x66a3('0x21'),_0x2ff217+'-'+_0x4cd9c7+'/'+_0x594050)['json'](_0x37a915);}return null;};}function patchUpdates(_0x60e4ba){return function(_0x1b923a){try{jsonpatch['apply'](_0x1b923a,_0x60e4ba,!![]);}catch(_0x24ef72){return BPromise[_0x66a3('0x22')](_0x24ef72);}return _0x1b923a[_0x66a3('0x23')]();};}function saveUpdates(_0x11cd7c,_0x44cd20){return function(_0x5dc7ba){if(_0x5dc7ba){return _0x5dc7ba[_0x66a3('0x24')](_0x11cd7c)[_0x66a3('0x25')](function(_0x189149){return _0x189149;});}return null;};}function removeEntity(_0x36906f,_0x588464){return function(_0x3cbe28){if(_0x3cbe28){return _0x3cbe28[_0x66a3('0x26')]()[_0x66a3('0x25')](function(){var _0x2a3ad2=_0x3cbe28[_0x66a3('0x27')]({'plain':!![]});var _0x255a2c='Sounds';return db[_0x66a3('0x28')]['destroy']({'where':{'type':_0x255a2c,'resourceId':_0x2a3ad2['id']}})['then'](function(){return _0x3cbe28;});})[_0x66a3('0x25')](function(){_0x36906f['status'](0xcc)[_0x66a3('0x1b')]();});}};}function handleEntityNotFound(_0x18f1b4,_0x374dc2){return function(_0x200bb9){if(!_0x200bb9){_0x18f1b4[_0x66a3('0x19')](0x194);}return _0x200bb9;};}function handleError(_0x55880c,_0x10b5a1){_0x10b5a1=_0x10b5a1||0x1f4;return function(_0x3516ea){logger['error'](_0x3516ea['stack']);if(_0x3516ea[_0x66a3('0x29')]){delete _0x3516ea['name'];}_0x55880c[_0x66a3('0x1a')](_0x10b5a1)[_0x66a3('0x2a')](_0x3516ea);};}exports[_0x66a3('0x2b')]=function(_0x5177b0,_0x202e3b){var _0x5bfe25={},_0x52db12={},_0x3fef78={'count':0x0,'rows':[]};var _0x396ef3=_[_0x66a3('0x2c')](db[_0x66a3('0x2d')][_0x66a3('0x2e')],function(_0x11ba2d){return{'name':_0x11ba2d[_0x66a3('0x2f')],'type':_0x11ba2d[_0x66a3('0x30')][_0x66a3('0x31')]};});_0x52db12[_0x66a3('0x32')]=_[_0x66a3('0x2c')](_0x396ef3,_0x66a3('0x29'));_0x52db12[_0x66a3('0x33')]=_['keys'](_0x5177b0[_0x66a3('0x33')]);_0x52db12[_0x66a3('0x34')]=_[_0x66a3('0x35')](_0x52db12[_0x66a3('0x32')],_0x52db12[_0x66a3('0x33')]);_0x5bfe25['attributes']=_[_0x66a3('0x35')](_0x52db12[_0x66a3('0x32')],qs[_0x66a3('0x36')](_0x5177b0[_0x66a3('0x33')][_0x66a3('0x36')]));_0x5bfe25['attributes']=_0x5bfe25[_0x66a3('0x37')][_0x66a3('0x38')]?_0x5bfe25[_0x66a3('0x37')]:_0x52db12[_0x66a3('0x32')];if(!_0x5177b0['query']['hasOwnProperty'](_0x66a3('0x39'))){_0x5bfe25[_0x66a3('0x1f')]=qs[_0x66a3('0x1f')](_0x5177b0[_0x66a3('0x33')]['limit']);_0x5bfe25[_0x66a3('0x1e')]=qs[_0x66a3('0x1e')](_0x5177b0[_0x66a3('0x33')][_0x66a3('0x1e')]);}_0x5bfe25[_0x66a3('0x3a')]=qs[_0x66a3('0x3b')](_0x5177b0[_0x66a3('0x33')]['sort']);_0x5bfe25[_0x66a3('0x3c')]=qs[_0x66a3('0x34')](_['pick'](_0x5177b0[_0x66a3('0x33')],_0x52db12[_0x66a3('0x34')]),_0x396ef3);if(_0x5177b0[_0x66a3('0x33')][_0x66a3('0x3d')]){_0x5bfe25['where']=_[_0x66a3('0x3e')](_0x5bfe25[_0x66a3('0x3c')],{'$or':_[_0x66a3('0x2c')](_0x396ef3,function(_0x3885f9){if(_0x3885f9[_0x66a3('0x30')]!==_0x66a3('0x3f')){var _0x238e6f={};_0x238e6f[_0x3885f9[_0x66a3('0x29')]]={'$like':'%'+_0x5177b0[_0x66a3('0x33')][_0x66a3('0x3d')]+'%'};return _0x238e6f;}})});}_0x5bfe25=_[_0x66a3('0x3e')]({},_0x5bfe25,_0x5177b0['options']);var _0x538aa8={'where':_0x5bfe25[_0x66a3('0x3c')]};return db[_0x66a3('0x2d')][_0x66a3('0x1d')](_0x538aa8)[_0x66a3('0x25')](function(_0x136d46){_0x3fef78[_0x66a3('0x1d')]=_0x136d46;if(_0x5177b0[_0x66a3('0x33')][_0x66a3('0x40')]){_0x5bfe25[_0x66a3('0x41')]=[{'all':!![]}];}return db[_0x66a3('0x2d')][_0x66a3('0x42')](_0x5bfe25);})['then'](function(_0x681d9d){_0x3fef78[_0x66a3('0x43')]=_0x681d9d;return _0x3fef78;})[_0x66a3('0x25')](respondWithFilteredResult(_0x202e3b,_0x5bfe25))['catch'](handleError(_0x202e3b,null));};exports[_0x66a3('0x44')]=function(_0x37805f,_0x10f726){var _0x351230={'raw':!![],'where':{'id':_0x37805f[_0x66a3('0x45')]['id']}},_0x287325={};_0x287325['model']=_[_0x66a3('0x46')](db[_0x66a3('0x2d')][_0x66a3('0x2e')]);_0x287325['query']=_[_0x66a3('0x46')](_0x37805f[_0x66a3('0x33')]);_0x287325[_0x66a3('0x34')]=_['intersection'](_0x287325['model'],_0x287325[_0x66a3('0x33')]);_0x351230[_0x66a3('0x37')]=_[_0x66a3('0x35')](_0x287325[_0x66a3('0x32')],qs['fields'](_0x37805f[_0x66a3('0x33')][_0x66a3('0x36')]));_0x351230[_0x66a3('0x37')]=_0x351230['attributes'][_0x66a3('0x38')]?_0x351230[_0x66a3('0x37')]:_0x287325['model'];if(_0x37805f[_0x66a3('0x33')][_0x66a3('0x40')]){_0x351230[_0x66a3('0x41')]=[{'all':!![]}];}_0x351230=_[_0x66a3('0x3e')]({},_0x351230,_0x37805f['options']);return db[_0x66a3('0x2d')][_0x66a3('0x47')](_0x351230)[_0x66a3('0x25')](handleEntityNotFound(_0x10f726,null))[_0x66a3('0x25')](respondWithResult(_0x10f726,null))[_0x66a3('0x48')](handleError(_0x10f726,null));};exports['download']=function(_0x43f0e8,_0x3580e1,_0x304139){return db['Sound']['find']({'where':{'id':_0x43f0e8[_0x66a3('0x45')]['id']},'attributes':[_0x66a3('0x29'),_0x66a3('0x49'),_0x66a3('0x4a')],'raw':!![]})[_0x66a3('0x25')](handleEntityNotFound(_0x3580e1,null))[_0x66a3('0x25')](function(_0x12a0e4){if(_0x12a0e4){if(!fs['existsSync'](path[_0x66a3('0x4b')](config[_0x66a3('0x4c')],_0x66a3('0x4d'),_0x12a0e4[_0x66a3('0x49')]+'.'+_0x12a0e4[_0x66a3('0x4a')]))){throw new db[(_0x66a3('0x4e'))]['ValidationError'](_0x66a3('0x4f'));}return _0x3580e1[_0x66a3('0x50')](path[_0x66a3('0x4b')](config[_0x66a3('0x4c')],_0x66a3('0x4d'),util[_0x66a3('0x51')](_0x66a3('0x52'),_0x12a0e4['save_name'],_0x12a0e4[_0x66a3('0x4a')])),util['format'](_0x66a3('0x52'),_0x12a0e4[_0x66a3('0x29')],_0x12a0e4[_0x66a3('0x4a')]));}return null;})[_0x66a3('0x48')](handleError(_0x3580e1,null));};exports['create']=function(_0x40216,_0x4237d0,_0x21fedc){var _0x309a55={'name':path['basename'](_0x40216[_0x66a3('0x53')][_0x66a3('0x54')],path[_0x66a3('0x55')](_0x40216[_0x66a3('0x53')][_0x66a3('0x54')])),'save_name':path[_0x66a3('0x56')](_0x40216[_0x66a3('0x53')]['filename'],path['extname'](_0x40216[_0x66a3('0x53')][_0x66a3('0x57')])),'original_format':path[_0x66a3('0x55')](_0x40216[_0x66a3('0x53')][_0x66a3('0x54')])[_0x66a3('0x58')](0x1),'converted_format':'wav'};var _0x4555a4=path[_0x66a3('0x4b')](config[_0x66a3('0x4c')],_0x66a3('0x59'),_0x40216[_0x66a3('0x53')][_0x66a3('0x57')]);var _0x3471a3=path[_0x66a3('0x4b')](config[_0x66a3('0x4c')],_0x66a3('0x4d'),util[_0x66a3('0x51')](_0x66a3('0x52'),path[_0x66a3('0x56')](_0x40216[_0x66a3('0x53')][_0x66a3('0x57')],path[_0x66a3('0x55')](_0x40216[_0x66a3('0x53')][_0x66a3('0x57')])),_0x309a55[_0x66a3('0x4a')]));logger[_0x66a3('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x4555a4);logger[_0x66a3('0x5a')](_0x66a3('0x5b'),_0x3471a3);try{fs['chmodSync'](_0x4555a4,parseInt(_0x66a3('0x5c'),0x8));var _0x4a3bab=sox[_0x66a3('0x5d')](_0x4555a4,_0x3471a3,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4a3bab['on'](_0x66a3('0x5e'),function(_0x44c2f0){fs[_0x66a3('0x5f')](_0x4555a4);_0x4237d0[_0x66a3('0x1a')](0x1f4)['send'](_0x44c2f0);});_0x4a3bab['on'](_0x66a3('0x60'),function(_0x129e0a){_0x309a55['original_duration']=isNaN(_0x129e0a['duration'])?null:_0x129e0a[_0x66a3('0x61')]*0x3e8;_0x309a55[_0x66a3('0x62')]=isNaN(_0x129e0a[_0x66a3('0x63')])?null:_0x129e0a['sampleCount'];_0x309a55['original_channelCount']=isNaN(_0x129e0a[_0x66a3('0x64')])?null:_0x129e0a[_0x66a3('0x64')];_0x309a55['original_bitRate']=isNaN(_0x129e0a[_0x66a3('0x65')])?null:_0x129e0a[_0x66a3('0x65')];_0x309a55[_0x66a3('0x66')]=isNaN(_0x129e0a[_0x66a3('0x67')])?null:_0x129e0a[_0x66a3('0x67')];});_0x4a3bab['on'](_0x66a3('0x68'),function(_0x511774){_0x309a55[_0x66a3('0x69')]=isNaN(_0x511774[_0x66a3('0x61')])?null:_0x511774[_0x66a3('0x61')]*0x3e8;_0x309a55['converted_sampleCount']=isNaN(_0x511774[_0x66a3('0x63')])?null:_0x511774['sampleCount'];_0x309a55[_0x66a3('0x6a')]=isNaN(_0x511774[_0x66a3('0x64')])?null:_0x511774[_0x66a3('0x64')];_0x309a55['converted_bitRate']=isNaN(_0x511774[_0x66a3('0x65')])?null:_0x511774[_0x66a3('0x65')];_0x309a55[_0x66a3('0x6b')]=isNaN(_0x511774['sampleRate'])?null:_0x511774[_0x66a3('0x67')];});_0x4a3bab['on'](_0x66a3('0x1b'),function(){fs[_0x66a3('0x6c')](_0x3471a3,parseInt(_0x66a3('0x5c'),0x8));return db[_0x66a3('0x2d')][_0x66a3('0x6d')](_0x309a55)[_0x66a3('0x25')](function(_0x5ecf07){var _0x6926d3={'role':_0x40216[_0x66a3('0x6e')][_0x66a3('0x6f')],'userProfileId':_0x40216[_0x66a3('0x6e')][_0x66a3('0x70')]};if(!_0x6926d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6926d3[_0x66a3('0x6f')]===_0x66a3('0x71')){var _0x4f0b16=_0x5ecf07['get']({'plain':!![]});return db[_0x66a3('0x72')]['find']({'where':{'name':_0x66a3('0x73'),'userProfileId':_0x6926d3[_0x66a3('0x70')]},'raw':!![]})[_0x66a3('0x25')](function(_0x4f9e4f){if(_0x4f9e4f&&_0x4f9e4f[_0x66a3('0x74')]===0x0){return db[_0x66a3('0x28')][_0x66a3('0x6d')]({'name':_0x4f0b16[_0x66a3('0x29')],'resourceId':_0x4f0b16['id'],'type':_0x4f9e4f[_0x66a3('0x29')],'sectionId':_0x4f9e4f['id']},{})['then'](function(){return _0x5ecf07;});}else{return _0x5ecf07;}})[_0x66a3('0x48')](function(_0x30e89f){logger[_0x66a3('0x5e')](_0x66a3('0x75'),_0x30e89f);throw _0x30e89f;});}return _0x5ecf07;})[_0x66a3('0x25')](respondWithResult(_0x4237d0,null))[_0x66a3('0x48')](handleError(_0x4237d0,null));});_0x4a3bab[_0x66a3('0x76')]();}catch(_0x486139){_0x4237d0[_0x66a3('0x1a')](0x1f4)['send'](_0x486139);}};exports[_0x66a3('0x24')]=function(_0x3dd631,_0x1227ad,_0x4748df){return db[_0x66a3('0x2d')][_0x66a3('0x47')]({'where':{'id':_0x3dd631['params']['id']}})[_0x66a3('0x25')](handleEntityNotFound(_0x1227ad,null))[_0x66a3('0x25')](saveUpdates(_[_0x66a3('0x77')](_0x3dd631[_0x66a3('0x6e')],[_0x66a3('0x29'),_0x66a3('0x78')]),null))[_0x66a3('0x25')](respondWithResult(_0x1227ad,null))[_0x66a3('0x48')](handleError(_0x1227ad,null));};exports[_0x66a3('0x79')]=function(_0x4e962e,_0x217d91,_0x32d1c7){return db['Sound'][_0x66a3('0x47')]({'where':{'id':_0x4e962e[_0x66a3('0x45')]['id']}})['then'](function(_0x48f560){if(_0x48f560){return _0x48f560[_0x66a3('0x26')]();}})[_0x66a3('0x25')](function(_0x29951b){var _0xcdbb87=path[_0x66a3('0x4b')](config[_0x66a3('0x4c')],'server/files/sounds/original',util['format'](_0x66a3('0x52'),_0x29951b[_0x66a3('0x49')],_0x29951b[_0x66a3('0x7a')]));var _0x3b66d4=path[_0x66a3('0x4b')](config['root'],'server/files/sounds/converted',util[_0x66a3('0x51')](_0x66a3('0x52'),_0x29951b[_0x66a3('0x49')],_0x29951b[_0x66a3('0x4a')]));fs[_0x66a3('0x5f')](_0xcdbb87);fs[_0x66a3('0x5f')](_0x3b66d4);return _0x29951b;})['then'](function(_0xfbc2b){if(_0xfbc2b){return _0x217d91[_0x66a3('0x1a')](0xcc)[_0x66a3('0x1b')]();}})[_0x66a3('0x25')](handleEntityNotFound(_0x217d91,null))[_0x66a3('0x48')](handleError(_0x217d91,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c7b7fef..9b38dcb 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 _0x3b8e=['./sound.attributes','exports','Sound','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3b8e,0xea));var _0xe3b8=function(_0x2c44db,_0x1c9475){_0x2c44db=_0x2c44db-0x0;var _0x484250=_0x3b8e[_0x2c44db];return _0x484250;};'use strict';var _=require(_0xe3b8('0x0'));var util=require('util');var logger=require(_0xe3b8('0x1'))(_0xe3b8('0x2'));var moment=require(_0xe3b8('0x3'));var BPromise=require(_0xe3b8('0x4'));var rp=require(_0xe3b8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3b8('0x6'));var config=require(_0xe3b8('0x7'));var attributes=require(_0xe3b8('0x8'));module[_0xe3b8('0x9')]=function(_0x46db1c,_0x2d64bc){return _0x46db1c['define'](_0xe3b8('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dc1=['define','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./sound.attributes','exports'];(function(_0x4909bb,_0x4bb2f8){var _0x121db3=function(_0x161d6c){while(--_0x161d6c){_0x4909bb['push'](_0x4909bb['shift']());}};_0x121db3(++_0x4bb2f8);}(_0x8dc1,0x84));var _0x18dc=function(_0xc8f5a3,_0x4a02a5){_0xc8f5a3=_0xc8f5a3-0x0;var _0x55041a=_0x8dc1[_0xc8f5a3];return _0x55041a;};'use strict';var _=require(_0x18dc('0x0'));var util=require(_0x18dc('0x1'));var logger=require(_0x18dc('0x2'))(_0x18dc('0x3'));var moment=require(_0x18dc('0x4'));var BPromise=require(_0x18dc('0x5'));var rp=require(_0x18dc('0x6'));var fs=require('fs');var path=require(_0x18dc('0x7'));var rimraf=require('rimraf');var config=require(_0x18dc('0x8'));var attributes=require(_0x18dc('0x9'));module[_0x18dc('0xa')]=function(_0x1e9589,_0x36a402){return _0x1e9589[_0x18dc('0xb')]('Sound',attributes,{'tableName':_0x18dc('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 0c70118..bca5a9e 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 _0x4407=['raw','attributes','include','map','model','debug','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','ShowSound','find','options'];(function(_0x2b2751,_0x2eb305){var _0x5ca950=function(_0xa4e023){while(--_0xa4e023){_0x2b2751['push'](_0x2b2751['shift']());}};_0x5ca950(++_0x2eb305);}(_0x4407,0x16f));var _0x7440=function(_0x3860e4,_0x20f443){_0x3860e4=_0x3860e4-0x0;var _0x2d78a3=_0x4407[_0x3860e4];return _0x2d78a3;};'use strict';var _=require('lodash');var util=require(_0x7440('0x0'));var moment=require(_0x7440('0x1'));var BPromise=require(_0x7440('0x2'));var rs=require(_0x7440('0x3'));var fs=require('fs');var Redis=require(_0x7440('0x4'));var db=require(_0x7440('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7440('0x6'))(_0x7440('0x7'));var config=require(_0x7440('0x8'));var jayson=require(_0x7440('0x9'));var client=jayson['client'][_0x7440('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x280a35,_0x85b018,_0x34e454){return new BPromise(function(_0x18f844,_0x21f98a){return client[_0x7440('0xb')](_0x280a35,_0x34e454)[_0x7440('0xc')](function(_0x4ec80f){logger['info'](_0x7440('0xd'),_0x85b018,_0x7440('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x85b018,'request\x20sent',JSON[_0x7440('0xf')](_0x4ec80f));if(_0x4ec80f[_0x7440('0x10')]){if(_0x4ec80f[_0x7440('0x10')]['code']===0x1f4){logger[_0x7440('0x10')](_0x7440('0xd'),_0x85b018,_0x4ec80f[_0x7440('0x10')][_0x7440('0x11')]);return _0x21f98a(_0x4ec80f[_0x7440('0x10')][_0x7440('0x11')]);}logger['error'](_0x7440('0xd'),_0x85b018,_0x4ec80f[_0x7440('0x10')]['message']);return _0x18f844(_0x4ec80f[_0x7440('0x10')][_0x7440('0x11')]);}else{logger[_0x7440('0x12')](_0x7440('0xd'),_0x85b018,_0x7440('0xe'));_0x18f844(_0x4ec80f[_0x7440('0x13')]['message']);}})['catch'](function(_0x36d3f8){logger['error'](_0x7440('0xd'),_0x85b018,_0x36d3f8);_0x21f98a(_0x36d3f8);});});}exports[_0x7440('0x14')]=function(_0x2c3d8c){var _0x28b8a2=this;return new Promise(function(_0x2a3529,_0x78f18e){return db['Sound'][_0x7440('0x15')]({'raw':_0x2c3d8c[_0x7440('0x16')]?_0x2c3d8c[_0x7440('0x16')][_0x7440('0x17')]===undefined?!![]:![]:!![],'where':_0x2c3d8c[_0x7440('0x16')]?_0x2c3d8c[_0x7440('0x16')]['where']||null:null,'attributes':_0x2c3d8c['options']?_0x2c3d8c[_0x7440('0x16')][_0x7440('0x18')]||null:null,'include':_0x2c3d8c[_0x7440('0x16')]?_0x2c3d8c[_0x7440('0x16')][_0x7440('0x19')]?_[_0x7440('0x1a')](_0x2c3d8c['options']['include'],function(_0x482fc5){return{'model':db[_0x482fc5[_0x7440('0x1b')]],'as':_0x482fc5['as'],'attributes':_0x482fc5[_0x7440('0x18')],'include':_0x482fc5[_0x7440('0x19')]?_[_0x7440('0x1a')](_0x482fc5['include'],function(_0x20668){return{'model':db[_0x20668[_0x7440('0x1b')]],'as':_0x20668['as'],'attributes':_0x20668[_0x7440('0x18')],'include':_0x20668[_0x7440('0x19')]?_[_0x7440('0x1a')](_0x20668[_0x7440('0x19')],function(_0xefc089){return{'model':db[_0xefc089[_0x7440('0x1b')]],'as':_0xefc089['as'],'attributes':_0xefc089[_0x7440('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7440('0xc')](function(_0x764cf0){logger[_0x7440('0x12')](_0x7440('0x14'),_0x2c3d8c);logger[_0x7440('0x1c')](_0x7440('0x14'),_0x2c3d8c,JSON[_0x7440('0xf')](_0x764cf0));_0x2a3529(_0x764cf0);})[_0x7440('0x1d')](function(_0x50d4ef){logger[_0x7440('0x10')](_0x7440('0x14'),_0x50d4ef['message'],_0x2c3d8c);_0x78f18e(_0x28b8a2[_0x7440('0x10')](0x1f4,_0x50d4ef[_0x7440('0x11')]));});});}; \ No newline at end of file +var _0x2bfa=['options','raw','where','attributes','model','include','map','stringify','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','ShowSound','Sound','find'];(function(_0x2a6378,_0x1dc219){var _0xff38ad=function(_0x3966df){while(--_0x3966df){_0x2a6378['push'](_0x2a6378['shift']());}};_0xff38ad(++_0x1dc219);}(_0x2bfa,0x7d));var _0xa2bf=function(_0x4eb89d,_0x4d9086){_0x4eb89d=_0x4eb89d-0x0;var _0x46fcbf=_0x2bfa[_0x4eb89d];return _0x46fcbf;};'use strict';var _=require(_0xa2bf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2bf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2bf('0x2'));var db=require(_0xa2bf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa2bf('0x4'))(_0xa2bf('0x5'));var config=require('../../config/environment');var jayson=require(_0xa2bf('0x6'));var client=jayson[_0xa2bf('0x7')][_0xa2bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c7e34,_0xbf175e,_0x1820f6){return new BPromise(function(_0x57d424,_0x36dfba){return client[_0xa2bf('0x9')](_0x4c7e34,_0x1820f6)['then'](function(_0x3fcc7d){logger[_0xa2bf('0xa')](_0xa2bf('0xb'),_0xbf175e,_0xa2bf('0xc'));logger['debug'](_0xa2bf('0xd'),_0xbf175e,_0xa2bf('0xc'),JSON['stringify'](_0x3fcc7d));if(_0x3fcc7d['error']){if(_0x3fcc7d[_0xa2bf('0xe')][_0xa2bf('0xf')]===0x1f4){logger[_0xa2bf('0xe')](_0xa2bf('0xb'),_0xbf175e,_0x3fcc7d[_0xa2bf('0xe')][_0xa2bf('0x10')]);return _0x36dfba(_0x3fcc7d[_0xa2bf('0xe')][_0xa2bf('0x10')]);}logger[_0xa2bf('0xe')](_0xa2bf('0xb'),_0xbf175e,_0x3fcc7d[_0xa2bf('0xe')][_0xa2bf('0x10')]);return _0x57d424(_0x3fcc7d[_0xa2bf('0xe')][_0xa2bf('0x10')]);}else{logger[_0xa2bf('0xa')](_0xa2bf('0xb'),_0xbf175e,_0xa2bf('0xc'));_0x57d424(_0x3fcc7d['result']['message']);}})['catch'](function(_0x19e9a1){logger[_0xa2bf('0xe')](_0xa2bf('0xb'),_0xbf175e,_0x19e9a1);_0x36dfba(_0x19e9a1);});});}exports[_0xa2bf('0x11')]=function(_0x387717){var _0x1f674=this;return new Promise(function(_0x48f1af,_0x26a976){return db[_0xa2bf('0x12')][_0xa2bf('0x13')]({'raw':_0x387717[_0xa2bf('0x14')]?_0x387717[_0xa2bf('0x14')][_0xa2bf('0x15')]===undefined?!![]:![]:!![],'where':_0x387717['options']?_0x387717[_0xa2bf('0x14')][_0xa2bf('0x16')]||null:null,'attributes':_0x387717[_0xa2bf('0x14')]?_0x387717[_0xa2bf('0x14')][_0xa2bf('0x17')]||null:null,'include':_0x387717[_0xa2bf('0x14')]?_0x387717[_0xa2bf('0x14')]['include']?_['map'](_0x387717[_0xa2bf('0x14')]['include'],function(_0x15c886){return{'model':db[_0x15c886[_0xa2bf('0x18')]],'as':_0x15c886['as'],'attributes':_0x15c886[_0xa2bf('0x17')],'include':_0x15c886[_0xa2bf('0x19')]?_['map'](_0x15c886[_0xa2bf('0x19')],function(_0xf5cec){return{'model':db[_0xf5cec[_0xa2bf('0x18')]],'as':_0xf5cec['as'],'attributes':_0xf5cec[_0xa2bf('0x17')],'include':_0xf5cec[_0xa2bf('0x19')]?_[_0xa2bf('0x1a')](_0xf5cec[_0xa2bf('0x19')],function(_0x59814b){return{'model':db[_0x59814b[_0xa2bf('0x18')]],'as':_0x59814b['as'],'attributes':_0x59814b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xb90954){logger['info'](_0xa2bf('0x11'),_0x387717);logger['debug'](_0xa2bf('0x11'),_0x387717,JSON[_0xa2bf('0x1b')](_0xb90954));_0x48f1af(_0xb90954);})[_0xa2bf('0x1c')](function(_0x20262a){logger[_0xa2bf('0xe')](_0xa2bf('0x11'),_0x20262a[_0xa2bf('0x10')],_0x387717);_0x26a976(_0x1f674[_0xa2bf('0xe')](0x1f4,_0x20262a[_0xa2bf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 21de5f4..438d629 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 _0x2089=['post','create','put','/:id','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x614b0f,_0x20b206){var _0x3ef8e6=function(_0x2e6fdb){while(--_0x2e6fdb){_0x614b0f['push'](_0x614b0f['shift']());}};_0x3ef8e6(++_0x20b206);}(_0x2089,0x17c));var _0x9208=function(_0x2fb86d,_0xac5f2d){_0x2fb86d=_0x2fb86d-0x0;var _0x51ad75=_0x2089[_0x2fb86d];return _0x51ad75;};'use strict';var multer=require('multer');var util=require(_0x9208('0x0'));var path=require(_0x9208('0x1'));var timeout=require(_0x9208('0x2'));var express=require(_0x9208('0x3'));var router=express['Router']();var auth=require(_0x9208('0x4'));var interaction=require(_0x9208('0x5'));var config=require(_0x9208('0x6'));var controller=require('./squareMessage.controller');router[_0x9208('0x7')]('/',auth[_0x9208('0x8')](),controller[_0x9208('0x9')]);router['get']('/:id',auth[_0x9208('0x8')](),controller[_0x9208('0xa')]);router[_0x9208('0xb')]('/',auth[_0x9208('0x8')](),controller[_0x9208('0xc')]);router[_0x9208('0xd')](_0x9208('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x9208('0xf')](_0x9208('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x9208('0x10')]=router; \ No newline at end of file +var _0x5d56=['../../config/environment','./squareMessage.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2adc0d,_0x371b7a){var _0x4b5786=function(_0x4edd35){while(--_0x4edd35){_0x2adc0d['push'](_0x2adc0d['shift']());}};_0x4b5786(++_0x371b7a);}(_0x5d56,0x6b));var _0x65d5=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x5d56[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x65d5('0x0'));var util=require(_0x65d5('0x1'));var path=require(_0x65d5('0x2'));var timeout=require(_0x65d5('0x3'));var express=require(_0x65d5('0x4'));var router=express[_0x65d5('0x5')]();var auth=require(_0x65d5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x65d5('0x7'));var controller=require(_0x65d5('0x8'));router[_0x65d5('0x9')]('/',auth[_0x65d5('0xa')](),controller['index']);router[_0x65d5('0x9')](_0x65d5('0xb'),auth[_0x65d5('0xa')](),controller[_0x65d5('0xc')]);router[_0x65d5('0xd')]('/',auth['isAuthenticated'](),controller[_0x65d5('0xe')]);router[_0x65d5('0xf')](_0x65d5('0xb'),auth['isAuthenticated'](),controller[_0x65d5('0x10')]);router[_0x65d5('0x11')](_0x65d5('0xb'),auth[_0x65d5('0xa')](),controller[_0x65d5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 56b7cde..3bc47cf 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 _0x723e=['STRING','TEXT','medium','ENUM','out','exports'];(function(_0x24a1dd,_0xeac48){var _0x175376=function(_0x53d2fb){while(--_0x53d2fb){_0x24a1dd['push'](_0x24a1dd['shift']());}};_0x175376(++_0xeac48);}(_0x723e,0x179));var _0xe723=function(_0x38c9df,_0x322b20){_0x38c9df=_0x38c9df-0x0;var _0x1b315a=_0x723e[_0x38c9df];return _0x1b315a;};'use strict';var Sequelize=require('sequelize');module[_0xe723('0x0')]={'uniqueid':{'type':Sequelize[_0xe723('0x1')]},'body':{'type':Sequelize[_0xe723('0x2')](_0xe723('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xe723('0x4')]('in',_0xe723('0x5')),'defaultValue':_0xe723('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xe723('0x1')]},'providerResponse':{'type':Sequelize[_0xe723('0x2')]}}; \ No newline at end of file +var _0x29d4=['medium','ENUM','out','sequelize','STRING','TEXT'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x29d4,0x1a1));var _0x429d=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x29d4[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x429d('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x429d('0x1')]},'body':{'type':Sequelize[_0x429d('0x2')](_0x429d('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x429d('0x4')]('in',_0x429d('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x429d('0x1')]},'providerResponse':{'type':Sequelize[_0x429d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 0d87193..b05213b 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 _0x7d82=['../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','type','key','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x9d4f85,_0xe44ca1){var _0x1a3ed1=function(_0x160ad2){while(--_0x160ad2){_0x9d4f85['push'](_0x9d4f85['shift']());}};_0x1a3ed1(++_0xe44ca1);}(_0x7d82,0xcc));var _0x27d8=function(_0x33ffd8,_0x5de443){_0x33ffd8=_0x33ffd8-0x0;var _0x4bacf2=_0x7d82[_0x33ffd8];return _0x4bacf2;};'use strict';var pdf=require(_0x27d8('0x0'));var emlformat=require(_0x27d8('0x1'));var rimraf=require(_0x27d8('0x2'));var zipdir=require(_0x27d8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27d8('0x4'));var moment=require(_0x27d8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x27d8('0x6'));var path=require(_0x27d8('0x7'));var sox=require(_0x27d8('0x8'));var csv=require('to-csv');var ejs=require(_0x27d8('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x27d8('0xa'));var crypto=require(_0x27d8('0xb'));var jsforce=require(_0x27d8('0xc'));var deskjs=require(_0x27d8('0xd'));var toCsv=require(_0x27d8('0xe'));var querystring=require(_0x27d8('0xf'));var Papa=require(_0x27d8('0x10'));var Redis=require(_0x27d8('0x11'));var authService=require(_0x27d8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x27d8('0x13'));var hardwareService=require(_0x27d8('0x14'));var logger=require('../../config/logger')(_0x27d8('0x15'));var utils=require(_0x27d8('0x16'));var config=require(_0x27d8('0x17'));var licenseUtil=require(_0x27d8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x453be4,_0x5220b1){_0x5220b1=_0x5220b1||0xcc;return function(_0x325f0a){if(_0x325f0a){return _0x453be4[_0x27d8('0x19')](_0x5220b1);}return _0x453be4[_0x27d8('0x1a')](_0x5220b1)[_0x27d8('0x1b')]();};}function respondWithResult(_0x510d35,_0x29808b){_0x29808b=_0x29808b||0xc8;return function(_0x3c481a){if(_0x3c481a){return _0x510d35[_0x27d8('0x1a')](_0x29808b)[_0x27d8('0x1c')](_0x3c481a);}};}function respondWithFilteredResult(_0x207624,_0x4115d4){return function(_0x1ebff0){if(_0x1ebff0){var _0x230564=_0x1ebff0[_0x27d8('0x1d')],_0x584959=_0x4115d4['offset'],_0x612880=_0x4115d4[_0x27d8('0x1e')]+_0x4115d4[_0x27d8('0x1f')],_0x1d88a1;if(_0x612880>=_0x230564){_0x612880=_0x230564;_0x1d88a1=0xc8;}else{_0x1d88a1=0xce;}_0x207624[_0x27d8('0x1a')](_0x1d88a1);return _0x207624[_0x27d8('0x20')](_0x27d8('0x21'),_0x584959+'-'+_0x612880+'/'+_0x230564)[_0x27d8('0x1c')](_0x1ebff0);}return null;};}function patchUpdates(_0x3f2721){return function(_0x115e9e){try{jsonpatch[_0x27d8('0x22')](_0x115e9e,_0x3f2721,!![]);}catch(_0x361352){return BPromise[_0x27d8('0x23')](_0x361352);}return _0x115e9e[_0x27d8('0x24')]();};}function saveUpdates(_0x502cbe,_0x2fcedb){return function(_0x1746b9){if(_0x1746b9){return _0x1746b9[_0x27d8('0x25')](_0x502cbe)[_0x27d8('0x26')](function(_0x3ebee0){return _0x3ebee0;});}return null;};}function removeEntity(_0x4417c7,_0x3f4378){return function(_0x5ddad6){if(_0x5ddad6){return _0x5ddad6[_0x27d8('0x27')]()[_0x27d8('0x26')](function(){_0x4417c7[_0x27d8('0x1a')](0xcc)[_0x27d8('0x1b')]();});}};}function handleEntityNotFound(_0x136da2,_0x224fa1){return function(_0xc6d996){if(!_0xc6d996){_0x136da2[_0x27d8('0x19')](0x194);}return _0xc6d996;};}function handleError(_0x15b51b,_0x47bd45){_0x47bd45=_0x47bd45||0x1f4;return function(_0x17cb65){logger[_0x27d8('0x28')](_0x17cb65[_0x27d8('0x29')]);if(_0x17cb65[_0x27d8('0x2a')]){delete _0x17cb65[_0x27d8('0x2a')];}_0x15b51b[_0x27d8('0x1a')](_0x47bd45)['send'](_0x17cb65);};}exports[_0x27d8('0x2b')]=function(_0x504be9,_0x54c8de){var _0x1aaab4={},_0x1a879f={},_0x25be0a={'count':0x0,'rows':[]};var _0x1dc9cc=_[_0x27d8('0x2c')](db[_0x27d8('0x2d')][_0x27d8('0x2e')],function(_0x3f1a2b){return{'name':_0x3f1a2b['fieldName'],'type':_0x3f1a2b[_0x27d8('0x2f')][_0x27d8('0x30')]};});_0x1a879f['model']=_['map'](_0x1dc9cc,'name');_0x1a879f[_0x27d8('0x31')]=_['keys'](_0x504be9['query']);_0x1a879f[_0x27d8('0x32')]=_['intersection'](_0x1a879f[_0x27d8('0x33')],_0x1a879f['query']);_0x1aaab4[_0x27d8('0x34')]=_['intersection'](_0x1a879f['model'],qs[_0x27d8('0x35')](_0x504be9[_0x27d8('0x31')]['fields']));_0x1aaab4[_0x27d8('0x34')]=_0x1aaab4[_0x27d8('0x34')][_0x27d8('0x36')]?_0x1aaab4['attributes']:_0x1a879f[_0x27d8('0x33')];if(!_0x504be9['query'][_0x27d8('0x37')](_0x27d8('0x38'))){_0x1aaab4[_0x27d8('0x1f')]=qs['limit'](_0x504be9[_0x27d8('0x31')]['limit']);_0x1aaab4[_0x27d8('0x1e')]=qs['offset'](_0x504be9['query']['offset']);}_0x1aaab4['order']=qs[_0x27d8('0x39')](_0x504be9[_0x27d8('0x31')][_0x27d8('0x39')]);_0x1aaab4[_0x27d8('0x3a')]=qs[_0x27d8('0x32')](_[_0x27d8('0x3b')](_0x504be9['query'],_0x1a879f['filters']),_0x1dc9cc);if(_0x504be9[_0x27d8('0x31')][_0x27d8('0x3c')]){_0x1aaab4['where']=_['merge'](_0x1aaab4[_0x27d8('0x3a')],{'$or':_[_0x27d8('0x2c')](_0x1dc9cc,function(_0x436f8a){if(_0x436f8a[_0x27d8('0x2f')]!==_0x27d8('0x3d')){var _0x2b63e5={};_0x2b63e5[_0x436f8a[_0x27d8('0x2a')]]={'$like':'%'+_0x504be9['query']['filter']+'%'};return _0x2b63e5;}})});}_0x1aaab4=_[_0x27d8('0x3e')]({},_0x1aaab4,_0x504be9[_0x27d8('0x3f')]);var _0x53c0b9={'where':_0x1aaab4[_0x27d8('0x3a')]};return db[_0x27d8('0x2d')][_0x27d8('0x1d')](_0x53c0b9)['then'](function(_0x1d86e9){_0x25be0a[_0x27d8('0x1d')]=_0x1d86e9;if(_0x504be9[_0x27d8('0x31')][_0x27d8('0x40')]){_0x1aaab4[_0x27d8('0x41')]=[{'all':!![]}];}return db[_0x27d8('0x2d')][_0x27d8('0x42')](_0x1aaab4);})[_0x27d8('0x26')](function(_0x13f46a){_0x25be0a[_0x27d8('0x43')]=_0x13f46a;return _0x25be0a;})[_0x27d8('0x26')](respondWithFilteredResult(_0x54c8de,_0x1aaab4))[_0x27d8('0x44')](handleError(_0x54c8de,null));};exports[_0x27d8('0x45')]=function(_0x29c076,_0x4434d5){var _0x3c4b77={'raw':!![],'where':{'id':_0x29c076[_0x27d8('0x46')]['id']}},_0x4ecc00={};_0x4ecc00[_0x27d8('0x33')]=_[_0x27d8('0x47')](db[_0x27d8('0x2d')][_0x27d8('0x2e')]);_0x4ecc00[_0x27d8('0x31')]=_[_0x27d8('0x47')](_0x29c076[_0x27d8('0x31')]);_0x4ecc00[_0x27d8('0x32')]=_['intersection'](_0x4ecc00[_0x27d8('0x33')],_0x4ecc00[_0x27d8('0x31')]);_0x3c4b77[_0x27d8('0x34')]=_[_0x27d8('0x48')](_0x4ecc00[_0x27d8('0x33')],qs['fields'](_0x29c076['query'][_0x27d8('0x35')]));_0x3c4b77['attributes']=_0x3c4b77[_0x27d8('0x34')][_0x27d8('0x36')]?_0x3c4b77[_0x27d8('0x34')]:_0x4ecc00['model'];if(_0x29c076[_0x27d8('0x31')][_0x27d8('0x40')]){_0x3c4b77[_0x27d8('0x41')]=[{'all':!![]}];}_0x3c4b77=_[_0x27d8('0x3e')]({},_0x3c4b77,_0x29c076[_0x27d8('0x3f')]);return db['SquareMessage']['find'](_0x3c4b77)['then'](handleEntityNotFound(_0x4434d5,null))[_0x27d8('0x26')](respondWithResult(_0x4434d5,null))['catch'](handleError(_0x4434d5,null));};exports['create']=function(_0xfe593d,_0x5e1560){return db[_0x27d8('0x2d')][_0x27d8('0x49')](_0xfe593d[_0x27d8('0x4a')],{})[_0x27d8('0x26')](respondWithResult(_0x5e1560,0xc9))[_0x27d8('0x44')](handleError(_0x5e1560,null));};exports[_0x27d8('0x25')]=function(_0x54fdfc,_0x412a79){if(_0x54fdfc[_0x27d8('0x4a')]['id']){delete _0x54fdfc[_0x27d8('0x4a')]['id'];}return db[_0x27d8('0x2d')]['find']({'where':{'id':_0x54fdfc[_0x27d8('0x46')]['id']}})['then'](handleEntityNotFound(_0x412a79,null))['then'](saveUpdates(_0x54fdfc[_0x27d8('0x4a')],null))[_0x27d8('0x26')](respondWithResult(_0x412a79,null))[_0x27d8('0x44')](handleError(_0x412a79,null));};exports[_0x27d8('0x27')]=function(_0x79b331,_0xe274e7){return db[_0x27d8('0x2d')][_0x27d8('0x4b')]({'where':{'id':_0x79b331[_0x27d8('0x46')]['id']}})[_0x27d8('0x26')](handleEntityNotFound(_0xe274e7,null))['then'](removeEntity(_0xe274e7,null))['catch'](handleError(_0xe274e7,null));}; \ No newline at end of file +var _0xc986=['rawAttributes','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','count','include','show','params','fields','includeAll','find','catch','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','set','reject','save','then','destroy','name','send','index','map','SquareMessage'];(function(_0xca213a,_0x16bda5){var _0x15b26e=function(_0x1a6a93){while(--_0x1a6a93){_0xca213a['push'](_0xca213a['shift']());}};_0x15b26e(++_0x16bda5);}(_0xc986,0xa4));var _0x6c98=function(_0x50d8b2,_0x46f88d){_0x50d8b2=_0x50d8b2-0x0;var _0x2f9972=_0xc986[_0x50d8b2];return _0x2f9972;};'use strict';var pdf=require(_0x6c98('0x0'));var emlformat=require(_0x6c98('0x1'));var rimraf=require(_0x6c98('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c98('0x3'));var rp=require(_0x6c98('0x4'));var moment=require(_0x6c98('0x5'));var BPromise=require(_0x6c98('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6c98('0x7'));var csv=require(_0x6c98('0x8'));var ejs=require(_0x6c98('0x9'));var fs=require('fs');var _=require(_0x6c98('0xa'));var squel=require(_0x6c98('0xb'));var crypto=require('crypto');var jsforce=require(_0x6c98('0xc'));var deskjs=require(_0x6c98('0xd'));var toCsv=require(_0x6c98('0x8'));var querystring=require(_0x6c98('0xe'));var Papa=require(_0x6c98('0xf'));var Redis=require(_0x6c98('0x10'));var authService=require(_0x6c98('0x11'));var qs=require(_0x6c98('0x12'));var as=require(_0x6c98('0x13'));var hardwareService=require(_0x6c98('0x14'));var logger=require('../../config/logger')(_0x6c98('0x15'));var utils=require(_0x6c98('0x16'));var config=require(_0x6c98('0x17'));var licenseUtil=require(_0x6c98('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ca3d2,_0x4cc46){_0x4cc46=_0x4cc46||0xcc;return function(_0x469d82){if(_0x469d82){return _0x5ca3d2[_0x6c98('0x19')](_0x4cc46);}return _0x5ca3d2[_0x6c98('0x1a')](_0x4cc46)[_0x6c98('0x1b')]();};}function respondWithResult(_0x139734,_0x1b3c30){_0x1b3c30=_0x1b3c30||0xc8;return function(_0x9d50eb){if(_0x9d50eb){return _0x139734[_0x6c98('0x1a')](_0x1b3c30)[_0x6c98('0x1c')](_0x9d50eb);}};}function respondWithFilteredResult(_0x3b7d70,_0xe8682){return function(_0x534fb8){if(_0x534fb8){var _0x212615=_0x534fb8['count'],_0x463fed=_0xe8682['offset'],_0x4524c0=_0xe8682['offset']+_0xe8682[_0x6c98('0x1d')],_0x144154;if(_0x4524c0>=_0x212615){_0x4524c0=_0x212615;_0x144154=0xc8;}else{_0x144154=0xce;}_0x3b7d70[_0x6c98('0x1a')](_0x144154);return _0x3b7d70[_0x6c98('0x1e')]('Content-Range',_0x463fed+'-'+_0x4524c0+'/'+_0x212615)[_0x6c98('0x1c')](_0x534fb8);}return null;};}function patchUpdates(_0x45ce0a){return function(_0x3ab29b){try{jsonpatch['apply'](_0x3ab29b,_0x45ce0a,!![]);}catch(_0xc7e677){return BPromise[_0x6c98('0x1f')](_0xc7e677);}return _0x3ab29b[_0x6c98('0x20')]();};}function saveUpdates(_0x49bf88,_0x3b1802){return function(_0x20408e){if(_0x20408e){return _0x20408e['update'](_0x49bf88)[_0x6c98('0x21')](function(_0x262bc5){return _0x262bc5;});}return null;};}function removeEntity(_0x5a4b7e,_0x183af2){return function(_0x1ab705){if(_0x1ab705){return _0x1ab705[_0x6c98('0x22')]()[_0x6c98('0x21')](function(){_0x5a4b7e[_0x6c98('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x393b56,_0x47a20e){return function(_0x296702){if(!_0x296702){_0x393b56[_0x6c98('0x19')](0x194);}return _0x296702;};}function handleError(_0x318eca,_0x527fda){_0x527fda=_0x527fda||0x1f4;return function(_0x5de282){logger['error'](_0x5de282['stack']);if(_0x5de282[_0x6c98('0x23')]){delete _0x5de282[_0x6c98('0x23')];}_0x318eca[_0x6c98('0x1a')](_0x527fda)[_0x6c98('0x24')](_0x5de282);};}exports[_0x6c98('0x25')]=function(_0x38bbf2,_0x1c102f){var _0x1ccb7a={},_0x59f4d1={},_0x4b14a5={'count':0x0,'rows':[]};var _0x13968d=_[_0x6c98('0x26')](db[_0x6c98('0x27')][_0x6c98('0x28')],function(_0x45dac1){return{'name':_0x45dac1['fieldName'],'type':_0x45dac1[_0x6c98('0x29')]['key']};});_0x59f4d1[_0x6c98('0x2a')]=_['map'](_0x13968d,_0x6c98('0x23'));_0x59f4d1['query']=_[_0x6c98('0x2b')](_0x38bbf2[_0x6c98('0x2c')]);_0x59f4d1[_0x6c98('0x2d')]=_[_0x6c98('0x2e')](_0x59f4d1['model'],_0x59f4d1[_0x6c98('0x2c')]);_0x1ccb7a[_0x6c98('0x2f')]=_[_0x6c98('0x2e')](_0x59f4d1[_0x6c98('0x2a')],qs['fields'](_0x38bbf2[_0x6c98('0x2c')]['fields']));_0x1ccb7a[_0x6c98('0x2f')]=_0x1ccb7a[_0x6c98('0x2f')][_0x6c98('0x30')]?_0x1ccb7a[_0x6c98('0x2f')]:_0x59f4d1[_0x6c98('0x2a')];if(!_0x38bbf2[_0x6c98('0x2c')][_0x6c98('0x31')]('nolimit')){_0x1ccb7a[_0x6c98('0x1d')]=qs[_0x6c98('0x1d')](_0x38bbf2[_0x6c98('0x2c')][_0x6c98('0x1d')]);_0x1ccb7a[_0x6c98('0x32')]=qs[_0x6c98('0x32')](_0x38bbf2[_0x6c98('0x2c')]['offset']);}_0x1ccb7a[_0x6c98('0x33')]=qs[_0x6c98('0x34')](_0x38bbf2[_0x6c98('0x2c')][_0x6c98('0x34')]);_0x1ccb7a[_0x6c98('0x35')]=qs[_0x6c98('0x2d')](_[_0x6c98('0x36')](_0x38bbf2[_0x6c98('0x2c')],_0x59f4d1['filters']),_0x13968d);if(_0x38bbf2[_0x6c98('0x2c')][_0x6c98('0x37')]){_0x1ccb7a[_0x6c98('0x35')]=_[_0x6c98('0x38')](_0x1ccb7a[_0x6c98('0x35')],{'$or':_[_0x6c98('0x26')](_0x13968d,function(_0x599ac3){if(_0x599ac3['type']!==_0x6c98('0x39')){var _0x42225b={};_0x42225b[_0x599ac3['name']]={'$like':'%'+_0x38bbf2['query'][_0x6c98('0x37')]+'%'};return _0x42225b;}})});}_0x1ccb7a=_[_0x6c98('0x38')]({},_0x1ccb7a,_0x38bbf2['options']);var _0x2f4b9e={'where':_0x1ccb7a[_0x6c98('0x35')]};return db['SquareMessage'][_0x6c98('0x3a')](_0x2f4b9e)[_0x6c98('0x21')](function(_0x5eebd3){_0x4b14a5[_0x6c98('0x3a')]=_0x5eebd3;if(_0x38bbf2[_0x6c98('0x2c')]['includeAll']){_0x1ccb7a[_0x6c98('0x3b')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x1ccb7a);})['then'](function(_0x3d357d){_0x4b14a5['rows']=_0x3d357d;return _0x4b14a5;})[_0x6c98('0x21')](respondWithFilteredResult(_0x1c102f,_0x1ccb7a))['catch'](handleError(_0x1c102f,null));};exports[_0x6c98('0x3c')]=function(_0x2ae25d,_0xbb17f0){var _0x4a7cbd={'raw':!![],'where':{'id':_0x2ae25d[_0x6c98('0x3d')]['id']}},_0x9ef0ec={};_0x9ef0ec[_0x6c98('0x2a')]=_[_0x6c98('0x2b')](db[_0x6c98('0x27')][_0x6c98('0x28')]);_0x9ef0ec[_0x6c98('0x2c')]=_[_0x6c98('0x2b')](_0x2ae25d[_0x6c98('0x2c')]);_0x9ef0ec[_0x6c98('0x2d')]=_[_0x6c98('0x2e')](_0x9ef0ec[_0x6c98('0x2a')],_0x9ef0ec['query']);_0x4a7cbd[_0x6c98('0x2f')]=_[_0x6c98('0x2e')](_0x9ef0ec[_0x6c98('0x2a')],qs[_0x6c98('0x3e')](_0x2ae25d[_0x6c98('0x2c')]['fields']));_0x4a7cbd[_0x6c98('0x2f')]=_0x4a7cbd[_0x6c98('0x2f')][_0x6c98('0x30')]?_0x4a7cbd['attributes']:_0x9ef0ec[_0x6c98('0x2a')];if(_0x2ae25d[_0x6c98('0x2c')][_0x6c98('0x3f')]){_0x4a7cbd[_0x6c98('0x3b')]=[{'all':!![]}];}_0x4a7cbd=_[_0x6c98('0x38')]({},_0x4a7cbd,_0x2ae25d['options']);return db[_0x6c98('0x27')][_0x6c98('0x40')](_0x4a7cbd)[_0x6c98('0x21')](handleEntityNotFound(_0xbb17f0,null))[_0x6c98('0x21')](respondWithResult(_0xbb17f0,null))[_0x6c98('0x41')](handleError(_0xbb17f0,null));};exports['create']=function(_0x2e1e60,_0x1fa951){return db[_0x6c98('0x27')]['create'](_0x2e1e60[_0x6c98('0x42')],{})['then'](respondWithResult(_0x1fa951,0xc9))['catch'](handleError(_0x1fa951,null));};exports[_0x6c98('0x43')]=function(_0x4e428d,_0x89cdb6){if(_0x4e428d[_0x6c98('0x42')]['id']){delete _0x4e428d[_0x6c98('0x42')]['id'];}return db[_0x6c98('0x27')][_0x6c98('0x40')]({'where':{'id':_0x4e428d[_0x6c98('0x3d')]['id']}})[_0x6c98('0x21')](handleEntityNotFound(_0x89cdb6,null))[_0x6c98('0x21')](saveUpdates(_0x4e428d['body'],null))['then'](respondWithResult(_0x89cdb6,null))['catch'](handleError(_0x89cdb6,null));};exports['destroy']=function(_0x56efd3,_0x4366df){return db[_0x6c98('0x27')][_0x6c98('0x40')]({'where':{'id':_0x56efd3[_0x6c98('0x3d')]['id']}})[_0x6c98('0x21')](handleEntityNotFound(_0x4366df,null))['then'](removeEntity(_0x4366df,null))[_0x6c98('0x41')](handleError(_0x4366df,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9687450..47f9fa4 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 _0xa40f=['./squareMessage.attributes','exports','SquareMessage','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xa40f,0x18b));var _0xfa40=function(_0x317af3,_0xaf1e9d){_0x317af3=_0x317af3-0x0;var _0x1dbfed=_0xa40f[_0x317af3];return _0x1dbfed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa40('0x0'))('api');var moment=require(_0xfa40('0x1'));var BPromise=require(_0xfa40('0x2'));var rp=require(_0xfa40('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa40('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa40('0x5'));module[_0xfa40('0x6')]=function(_0x21b01c,_0xac6d9){return _0x21b01c['define'](_0xfa40('0x7'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0513=['request-promise','rimraf','exports','SquareMessage','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3a4e81,_0x453b4e){var _0x572874=function(_0x2956aa){while(--_0x2956aa){_0x3a4e81['push'](_0x3a4e81['shift']());}};_0x572874(++_0x453b4e);}(_0x0513,0xc2));var _0x3051=function(_0x1de14f,_0x3563cb){_0x1de14f=_0x1de14f-0x0;var _0x512594=_0x0513[_0x1de14f];return _0x512594;};'use strict';var _=require(_0x3051('0x0'));var util=require(_0x3051('0x1'));var logger=require(_0x3051('0x2'))(_0x3051('0x3'));var moment=require(_0x3051('0x4'));var BPromise=require(_0x3051('0x5'));var rp=require(_0x3051('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3051('0x7'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x3051('0x8')]=function(_0x6bdc94,_0x3f7938){return _0x6bdc94['define'](_0x3051('0x9'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index f881292..28faa33 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x4d1e32,_0x469e89){var _0xd3ae18=function(_0x2065a8){while(--_0x2065a8){_0x4d1e32['push'](_0x4d1e32['shift']());}};_0xd3ae18(++_0x469e89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x102603,_0x1c9be4){var _0x1694dc=function(_0x32ca50){while(--_0x32ca50){_0x102603['push'](_0x102603['shift']());}};_0x1694dc(++_0x1c9be4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 665a39f..a2633e3 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 _0x3b8c=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','/:id','/:id/test','15s','test','post','update','delete','destroy','exports','multer','util'];(function(_0xb0418,_0x1f0d3e){var _0xeb46f6=function(_0xd611cf){while(--_0xd611cf){_0xb0418['push'](_0xb0418['shift']());}};_0xeb46f6(++_0x1f0d3e);}(_0x3b8c,0x1b3));var _0xc3b8=function(_0xa721f,_0x6264){_0xa721f=_0xa721f-0x0;var _0x38a9b9=_0x3b8c[_0xa721f];return _0x38a9b9;};'use strict';var multer=require(_0xc3b8('0x0'));var util=require(_0xc3b8('0x1'));var path=require(_0xc3b8('0x2'));var timeout=require(_0xc3b8('0x3'));var express=require(_0xc3b8('0x4'));var router=express['Router']();var auth=require(_0xc3b8('0x5'));var interaction=require(_0xc3b8('0x6'));var config=require('../../config/environment');var controller=require(_0xc3b8('0x7'));router[_0xc3b8('0x8')]('/',auth[_0xc3b8('0x9')](),controller['index']);router['get'](_0xc3b8('0xa'),auth[_0xc3b8('0x9')](),controller['show']);router[_0xc3b8('0x8')](_0xc3b8('0xb'),auth[_0xc3b8('0x9')](),timeout(_0xc3b8('0xc')),controller[_0xc3b8('0xd')]);router[_0xc3b8('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xc3b8('0xa'),auth[_0xc3b8('0x9')](),controller[_0xc3b8('0xf')]);router[_0xc3b8('0x10')](_0xc3b8('0xa'),auth['isAuthenticated'](),controller[_0xc3b8('0x11')]);module[_0xc3b8('0x12')]=router; \ No newline at end of file +var _0xcfbf=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/test','15s','post','create','put','update','delete','exports','multer'];(function(_0x22f05b,_0x6bc751){var _0x41ee92=function(_0x113190){while(--_0x113190){_0x22f05b['push'](_0x22f05b['shift']());}};_0x41ee92(++_0x6bc751);}(_0xcfbf,0x8b));var _0xfcfb=function(_0x344461,_0x4eaef2){_0x344461=_0x344461-0x0;var _0x30e6ad=_0xcfbf[_0x344461];return _0x30e6ad;};'use strict';var multer=require(_0xfcfb('0x0'));var util=require(_0xfcfb('0x1'));var path=require(_0xfcfb('0x2'));var timeout=require('connect-timeout');var express=require(_0xfcfb('0x3'));var router=express[_0xfcfb('0x4')]();var auth=require(_0xfcfb('0x5'));var interaction=require(_0xfcfb('0x6'));var config=require(_0xfcfb('0x7'));var controller=require('./squareOdbc.controller');router[_0xfcfb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfcfb('0x8')](_0xfcfb('0x9'),auth[_0xfcfb('0xa')](),controller[_0xfcfb('0xb')]);router[_0xfcfb('0x8')](_0xfcfb('0xc'),auth[_0xfcfb('0xa')](),timeout(_0xfcfb('0xd')),controller['test']);router[_0xfcfb('0xe')]('/',auth[_0xfcfb('0xa')](),controller[_0xfcfb('0xf')]);router[_0xfcfb('0x10')](_0xfcfb('0x9'),auth[_0xfcfb('0xa')](),controller[_0xfcfb('0x11')]);router[_0xfcfb('0x12')]('/:id',auth[_0xfcfb('0xa')](),controller['destroy']);module[_0xfcfb('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index e36796d..acb6fca 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 _0x7f4f=['STRING','exports','name'];(function(_0x3242df,_0x7ecae2){var _0x413f17=function(_0x3ca948){while(--_0x3ca948){_0x3242df['push'](_0x3242df['shift']());}};_0x413f17(++_0x7ecae2);}(_0x7f4f,0xfd));var _0xf7f4=function(_0x53e2ff,_0x7f3cda){_0x53e2ff=_0x53e2ff-0x0;var _0xfcf871=_0x7f4f[_0x53e2ff];return _0xfcf871;};'use strict';var Sequelize=require('sequelize');module[_0xf7f4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xf7f4('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf7f4('0x2')]},'description':{'type':Sequelize[_0xf7f4('0x2')]}}; \ No newline at end of file +var _0x32fc=['STRING','sequelize','name'];(function(_0x41af36,_0x32684d){var _0x532e00=function(_0x4f817c){while(--_0x4f817c){_0x41af36['push'](_0x41af36['shift']());}};_0x532e00(++_0x32684d);}(_0x32fc,0xb2));var _0xc32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc32f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc32f('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc32f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9cd3ab8..b8750ab 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 _0x98dc=['attributes','fields','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','json','apply','save','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x3b1bc6,_0x43460a){var _0x58956a=function(_0x40099b){while(--_0x40099b){_0x3b1bc6['push'](_0x3b1bc6['shift']());}};_0x58956a(++_0x43460a);}(_0x98dc,0x10f));var _0xc98d=function(_0x145035,_0x403511){_0x145035=_0x145035-0x0;var _0x11cd91=_0x98dc[_0x145035];return _0x11cd91;};'use strict';var pdf=require(_0xc98d('0x0'));var emlformat=require(_0xc98d('0x1'));var rimraf=require(_0xc98d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc98d('0x3'));var BPromise=require(_0xc98d('0x4'));var Mustache=require(_0xc98d('0x5'));var util=require(_0xc98d('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc98d('0x7'));var fs=require('fs');var _=require(_0xc98d('0x8'));var squel=require(_0xc98d('0x9'));var crypto=require(_0xc98d('0xa'));var jsforce=require(_0xc98d('0xb'));var deskjs=require(_0xc98d('0xc'));var toCsv=require(_0xc98d('0xd'));var querystring=require(_0xc98d('0xe'));var Papa=require(_0xc98d('0xf'));var Redis=require(_0xc98d('0x10'));var authService=require(_0xc98d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc98d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc98d('0x13'))('api');var utils=require(_0xc98d('0x14'));var config=require(_0xc98d('0x15'));var licenseUtil=require(_0xc98d('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48527d,_0xa46424){_0xa46424=_0xa46424||0xcc;return function(_0x12c22b){if(_0x12c22b){return _0x48527d['sendStatus'](_0xa46424);}return _0x48527d[_0xc98d('0x17')](_0xa46424)[_0xc98d('0x18')]();};}function respondWithResult(_0x109446,_0x4328bf){_0x4328bf=_0x4328bf||0xc8;return function(_0x2d11ff){if(_0x2d11ff){return _0x109446['status'](_0x4328bf)['json'](_0x2d11ff);}};}function respondWithFilteredResult(_0x57d2e4,_0xd36336){return function(_0x40df3a){if(_0x40df3a){var _0x144dfa=_0x40df3a[_0xc98d('0x19')],_0x1bf356=_0xd36336[_0xc98d('0x1a')],_0x23292a=_0xd36336[_0xc98d('0x1a')]+_0xd36336['limit'],_0x5df3d5;if(_0x23292a>=_0x144dfa){_0x23292a=_0x144dfa;_0x5df3d5=0xc8;}else{_0x5df3d5=0xce;}_0x57d2e4['status'](_0x5df3d5);return _0x57d2e4['set']('Content-Range',_0x1bf356+'-'+_0x23292a+'/'+_0x144dfa)[_0xc98d('0x1b')](_0x40df3a);}return null;};}function patchUpdates(_0x56715d){return function(_0x368c24){try{jsonpatch[_0xc98d('0x1c')](_0x368c24,_0x56715d,!![]);}catch(_0x5c1186){return BPromise['reject'](_0x5c1186);}return _0x368c24[_0xc98d('0x1d')]();};}function saveUpdates(_0x3cf18f,_0xb706c3){return function(_0x4e22f2){if(_0x4e22f2){return _0x4e22f2['update'](_0x3cf18f)[_0xc98d('0x1e')](function(_0x78e006){return _0x78e006;});}return null;};}function removeEntity(_0x39dae2,_0x582fc6){return function(_0x1d5c6c){if(_0x1d5c6c){return _0x1d5c6c[_0xc98d('0x1f')]()[_0xc98d('0x1e')](function(){var _0x4d3084=_0x1d5c6c[_0xc98d('0x20')]({'plain':!![]});var _0x1a5801='ODBC';return db[_0xc98d('0x21')]['destroy']({'where':{'type':_0x1a5801,'resourceId':_0x4d3084['id']}})[_0xc98d('0x1e')](function(){return _0x1d5c6c;});})[_0xc98d('0x1e')](function(){_0x39dae2[_0xc98d('0x17')](0xcc)[_0xc98d('0x18')]();});}};}function handleEntityNotFound(_0x4328be,_0x4bae59){return function(_0x330830){if(!_0x330830){_0x4328be[_0xc98d('0x22')](0x194);}return _0x330830;};}function handleError(_0x44f801,_0x415179){_0x415179=_0x415179||0x1f4;return function(_0x187ba2){logger['error'](_0x187ba2[_0xc98d('0x23')]);if(_0x187ba2[_0xc98d('0x24')]){delete _0x187ba2[_0xc98d('0x24')];}_0x44f801['status'](_0x415179)[_0xc98d('0x25')](_0x187ba2);};}exports[_0xc98d('0x26')]=function(_0x45fdb6,_0x52c1f9){var _0x3fbf46={},_0x3588ab={},_0x2e26b8={'count':0x0,'rows':[]};var _0x52d84a=_[_0xc98d('0x27')](db[_0xc98d('0x28')][_0xc98d('0x29')],function(_0x9e7302){return{'name':_0x9e7302['fieldName'],'type':_0x9e7302[_0xc98d('0x2a')][_0xc98d('0x2b')]};});_0x3588ab[_0xc98d('0x2c')]=_[_0xc98d('0x27')](_0x52d84a,_0xc98d('0x24'));_0x3588ab[_0xc98d('0x2d')]=_[_0xc98d('0x2e')](_0x45fdb6[_0xc98d('0x2d')]);_0x3588ab[_0xc98d('0x2f')]=_[_0xc98d('0x30')](_0x3588ab[_0xc98d('0x2c')],_0x3588ab['query']);_0x3fbf46[_0xc98d('0x31')]=_[_0xc98d('0x30')](_0x3588ab[_0xc98d('0x2c')],qs[_0xc98d('0x32')](_0x45fdb6[_0xc98d('0x2d')][_0xc98d('0x32')]));_0x3fbf46[_0xc98d('0x31')]=_0x3fbf46[_0xc98d('0x31')]['length']?_0x3fbf46[_0xc98d('0x31')]:_0x3588ab['model'];if(!_0x45fdb6[_0xc98d('0x2d')]['hasOwnProperty'](_0xc98d('0x33'))){_0x3fbf46[_0xc98d('0x34')]=qs[_0xc98d('0x34')](_0x45fdb6[_0xc98d('0x2d')][_0xc98d('0x34')]);_0x3fbf46[_0xc98d('0x1a')]=qs['offset'](_0x45fdb6['query'][_0xc98d('0x1a')]);}_0x3fbf46['order']=qs[_0xc98d('0x35')](_0x45fdb6[_0xc98d('0x2d')][_0xc98d('0x35')]);_0x3fbf46[_0xc98d('0x36')]=qs[_0xc98d('0x2f')](_[_0xc98d('0x37')](_0x45fdb6[_0xc98d('0x2d')],_0x3588ab[_0xc98d('0x2f')]),_0x52d84a);if(_0x45fdb6[_0xc98d('0x2d')][_0xc98d('0x38')]){_0x3fbf46[_0xc98d('0x36')]=_[_0xc98d('0x39')](_0x3fbf46[_0xc98d('0x36')],{'$or':_[_0xc98d('0x27')](_0x52d84a,function(_0xf99fee){if(_0xf99fee[_0xc98d('0x2a')]!==_0xc98d('0x3a')){var _0x4dbb6e={};_0x4dbb6e[_0xf99fee[_0xc98d('0x24')]]={'$like':'%'+_0x45fdb6[_0xc98d('0x2d')][_0xc98d('0x38')]+'%'};return _0x4dbb6e;}})});}_0x3fbf46=_[_0xc98d('0x39')]({},_0x3fbf46,_0x45fdb6[_0xc98d('0x3b')]);var _0x7d2650={'where':_0x3fbf46['where']};return db[_0xc98d('0x28')][_0xc98d('0x19')](_0x7d2650)[_0xc98d('0x1e')](function(_0x29826c){_0x2e26b8[_0xc98d('0x19')]=_0x29826c;if(_0x45fdb6[_0xc98d('0x2d')][_0xc98d('0x3c')]){_0x3fbf46[_0xc98d('0x3d')]=[{'all':!![]}];}return db[_0xc98d('0x28')]['findAll'](_0x3fbf46);})[_0xc98d('0x1e')](function(_0x4c4ab7){_0x2e26b8[_0xc98d('0x3e')]=_0x4c4ab7;return _0x2e26b8;})[_0xc98d('0x1e')](respondWithFilteredResult(_0x52c1f9,_0x3fbf46))[_0xc98d('0x3f')](handleError(_0x52c1f9,null));};exports[_0xc98d('0x40')]=function(_0x476fe7,_0x161b72){var _0x3153ba={'raw':!![],'where':{'id':_0x476fe7[_0xc98d('0x41')]['id']}},_0x5ab342={};_0x5ab342['model']=_[_0xc98d('0x2e')](db[_0xc98d('0x28')][_0xc98d('0x29')]);_0x5ab342[_0xc98d('0x2d')]=_['keys'](_0x476fe7[_0xc98d('0x2d')]);_0x5ab342[_0xc98d('0x2f')]=_[_0xc98d('0x30')](_0x5ab342[_0xc98d('0x2c')],_0x5ab342[_0xc98d('0x2d')]);_0x3153ba[_0xc98d('0x31')]=_['intersection'](_0x5ab342[_0xc98d('0x2c')],qs[_0xc98d('0x32')](_0x476fe7['query'][_0xc98d('0x32')]));_0x3153ba[_0xc98d('0x31')]=_0x3153ba[_0xc98d('0x31')]['length']?_0x3153ba[_0xc98d('0x31')]:_0x5ab342['model'];if(_0x476fe7['query'][_0xc98d('0x3c')]){_0x3153ba[_0xc98d('0x3d')]=[{'all':!![]}];}_0x3153ba=_['merge']({},_0x3153ba,_0x476fe7[_0xc98d('0x3b')]);return db[_0xc98d('0x28')][_0xc98d('0x42')](_0x3153ba)[_0xc98d('0x1e')](handleEntityNotFound(_0x161b72,null))[_0xc98d('0x1e')](respondWithResult(_0x161b72,null))[_0xc98d('0x3f')](handleError(_0x161b72,null));};exports[_0xc98d('0x43')]=function(_0x3cc646,_0x1c8215){return db['SquareOdbc'][_0xc98d('0x43')](_0x3cc646['body'],{})[_0xc98d('0x1e')](function(_0x49797c){var _0x3c7265=_0x3cc646['user'][_0xc98d('0x20')]({'plain':!![]});if(!_0x3c7265)throw new Error(_0xc98d('0x44'));if(_0x3c7265[_0xc98d('0x45')]===_0xc98d('0x46')){var _0x5d7918=_0x49797c[_0xc98d('0x20')]({'plain':!![]});var _0x45b85c='ODBC';return db['UserProfileSection']['find']({'where':{'name':_0x45b85c,'userProfileId':_0x3c7265[_0xc98d('0x47')]},'raw':!![]})[_0xc98d('0x1e')](function(_0x44a640){if(_0x44a640&&_0x44a640[_0xc98d('0x48')]===0x0){return db[_0xc98d('0x21')][_0xc98d('0x43')]({'name':_0x5d7918['name'],'resourceId':_0x5d7918['id'],'type':_0x44a640[_0xc98d('0x24')],'sectionId':_0x44a640['id']},{})['then'](function(){return _0x49797c;});}else{return _0x49797c;}})['catch'](function(_0x18cf2b){logger[_0xc98d('0x49')](_0xc98d('0x4a'),_0x18cf2b);throw _0x18cf2b;});}return _0x49797c;})[_0xc98d('0x1e')](respondWithResult(_0x1c8215,0xc9))['catch'](handleError(_0x1c8215,null));};exports['update']=function(_0x1032fc,_0xbde6e8){if(_0x1032fc[_0xc98d('0x4b')]['id']){delete _0x1032fc['body']['id'];}return db[_0xc98d('0x28')][_0xc98d('0x42')]({'where':{'id':_0x1032fc[_0xc98d('0x41')]['id']}})[_0xc98d('0x1e')](handleEntityNotFound(_0xbde6e8,null))[_0xc98d('0x1e')](saveUpdates(_0x1032fc[_0xc98d('0x4b')],null))[_0xc98d('0x1e')](respondWithResult(_0xbde6e8,null))['catch'](handleError(_0xbde6e8,null));};exports[_0xc98d('0x1f')]=function(_0x904e70,_0x565dab){return db[_0xc98d('0x28')][_0xc98d('0x42')]({'where':{'id':_0x904e70[_0xc98d('0x41')]['id']}})['then'](handleEntityNotFound(_0x565dab,null))['then'](removeEntity(_0x565dab,null))['catch'](handleError(_0x565dab,null));};exports[_0xc98d('0x4c')]=function(_0x2038fa,_0x3b4c97,_0x413ccc){var _0xcda3bb;return db[_0xc98d('0x28')]['find']({'where':{'id':_0x2038fa[_0xc98d('0x41')]['id']},'attributes':['id',_0xc98d('0x4d')]})[_0xc98d('0x1e')](handleEntityNotFound(_0x3b4c97,null))[_0xc98d('0x1e')](function(_0x2dfa9b){if(_0x2dfa9b){var _0x1b28aa=require(_0xc98d('0x4e'))();_0x1b28aa['openSync'](_0x2dfa9b['dsn']);_0x1b28aa[_0xc98d('0x4f')]();return _0x2dfa9b;}})[_0xc98d('0x1e')](respondWithResult(_0x3b4c97,null))[_0xc98d('0x3f')](handleError(_0x3b4c97,null));}; \ No newline at end of file +var _0xa870=['error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','UserProfileResource','end'];(function(_0x18e7d7,_0xf62a49){var _0x3e538e=function(_0x3340e0){while(--_0x3340e0){_0x18e7d7['push'](_0x18e7d7['shift']());}};_0x3e538e(++_0xf62a49);}(_0xa870,0x84));var _0x0a87=function(_0x17ab28,_0x5ed1bc){_0x17ab28=_0x17ab28-0x0;var _0x14ac88=_0xa870[_0x17ab28];return _0x14ac88;};'use strict';var pdf=require(_0x0a87('0x0'));var emlformat=require(_0x0a87('0x1'));var rimraf=require(_0x0a87('0x2'));var zipdir=require(_0x0a87('0x3'));var jsonpatch=require(_0x0a87('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a87('0x5'));var Mustache=require(_0x0a87('0x6'));var util=require(_0x0a87('0x7'));var path=require(_0x0a87('0x8'));var sox=require(_0x0a87('0x9'));var csv=require(_0x0a87('0xa'));var ejs=require(_0x0a87('0xb'));var fs=require('fs');var _=require(_0x0a87('0xc'));var squel=require('squel');var crypto=require(_0x0a87('0xd'));var jsforce=require(_0x0a87('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0a87('0xa'));var querystring=require('querystring');var Papa=require(_0x0a87('0xf'));var Redis=require(_0x0a87('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0a87('0x11'));var as=require(_0x0a87('0x12'));var hardwareService=require(_0x0a87('0x13'));var logger=require(_0x0a87('0x14'))(_0x0a87('0x15'));var utils=require(_0x0a87('0x16'));var config=require(_0x0a87('0x17'));var licenseUtil=require(_0x0a87('0x18'));var db=require(_0x0a87('0x19'))['db'];function respondWithStatusCode(_0x213984,_0x330e08){_0x330e08=_0x330e08||0xcc;return function(_0x56e1b8){if(_0x56e1b8){return _0x213984[_0x0a87('0x1a')](_0x330e08);}return _0x213984['status'](_0x330e08)['end']();};}function respondWithResult(_0x28ba0a,_0x182245){_0x182245=_0x182245||0xc8;return function(_0x34610c){if(_0x34610c){return _0x28ba0a[_0x0a87('0x1b')](_0x182245)[_0x0a87('0x1c')](_0x34610c);}};}function respondWithFilteredResult(_0x338ec9,_0x3f9165){return function(_0x3b6fb2){if(_0x3b6fb2){var _0x4ec201=_0x3b6fb2[_0x0a87('0x1d')],_0x209c2e=_0x3f9165[_0x0a87('0x1e')],_0x5ab6b7=_0x3f9165[_0x0a87('0x1e')]+_0x3f9165[_0x0a87('0x1f')],_0x3fd7d8;if(_0x5ab6b7>=_0x4ec201){_0x5ab6b7=_0x4ec201;_0x3fd7d8=0xc8;}else{_0x3fd7d8=0xce;}_0x338ec9[_0x0a87('0x1b')](_0x3fd7d8);return _0x338ec9[_0x0a87('0x20')]('Content-Range',_0x209c2e+'-'+_0x5ab6b7+'/'+_0x4ec201)[_0x0a87('0x1c')](_0x3b6fb2);}return null;};}function patchUpdates(_0x76892c){return function(_0xe0cc44){try{jsonpatch[_0x0a87('0x21')](_0xe0cc44,_0x76892c,!![]);}catch(_0x13e3b2){return BPromise[_0x0a87('0x22')](_0x13e3b2);}return _0xe0cc44['save']();};}function saveUpdates(_0x2b367c,_0x519ba5){return function(_0xbb84ba){if(_0xbb84ba){return _0xbb84ba[_0x0a87('0x23')](_0x2b367c)[_0x0a87('0x24')](function(_0x4545a8){return _0x4545a8;});}return null;};}function removeEntity(_0x1fc494,_0x3979e0){return function(_0x47d9f1){if(_0x47d9f1){return _0x47d9f1[_0x0a87('0x25')]()['then'](function(){var _0x863ae4=_0x47d9f1['get']({'plain':!![]});var _0x5a5b43='ODBC';return db[_0x0a87('0x26')][_0x0a87('0x25')]({'where':{'type':_0x5a5b43,'resourceId':_0x863ae4['id']}})[_0x0a87('0x24')](function(){return _0x47d9f1;});})[_0x0a87('0x24')](function(){_0x1fc494[_0x0a87('0x1b')](0xcc)[_0x0a87('0x27')]();});}};}function handleEntityNotFound(_0x335f1c,_0x2f713f){return function(_0x421d0c){if(!_0x421d0c){_0x335f1c[_0x0a87('0x1a')](0x194);}return _0x421d0c;};}function handleError(_0x164880,_0x311917){_0x311917=_0x311917||0x1f4;return function(_0x309dd7){logger[_0x0a87('0x28')](_0x309dd7['stack']);if(_0x309dd7[_0x0a87('0x29')]){delete _0x309dd7[_0x0a87('0x29')];}_0x164880[_0x0a87('0x1b')](_0x311917)[_0x0a87('0x2a')](_0x309dd7);};}exports[_0x0a87('0x2b')]=function(_0x2cb1ed,_0xa1a123){var _0x3731cc={},_0x2df78e={},_0x5cd7e7={'count':0x0,'rows':[]};var _0x2674ed=_[_0x0a87('0x2c')](db[_0x0a87('0x2d')][_0x0a87('0x2e')],function(_0x2c0535){return{'name':_0x2c0535[_0x0a87('0x2f')],'type':_0x2c0535[_0x0a87('0x30')]['key']};});_0x2df78e[_0x0a87('0x31')]=_[_0x0a87('0x2c')](_0x2674ed,_0x0a87('0x29'));_0x2df78e[_0x0a87('0x32')]=_[_0x0a87('0x33')](_0x2cb1ed[_0x0a87('0x32')]);_0x2df78e['filters']=_[_0x0a87('0x34')](_0x2df78e['model'],_0x2df78e[_0x0a87('0x32')]);_0x3731cc[_0x0a87('0x35')]=_['intersection'](_0x2df78e[_0x0a87('0x31')],qs['fields'](_0x2cb1ed[_0x0a87('0x32')][_0x0a87('0x36')]));_0x3731cc[_0x0a87('0x35')]=_0x3731cc[_0x0a87('0x35')][_0x0a87('0x37')]?_0x3731cc[_0x0a87('0x35')]:_0x2df78e[_0x0a87('0x31')];if(!_0x2cb1ed[_0x0a87('0x32')][_0x0a87('0x38')](_0x0a87('0x39'))){_0x3731cc[_0x0a87('0x1f')]=qs[_0x0a87('0x1f')](_0x2cb1ed[_0x0a87('0x32')][_0x0a87('0x1f')]);_0x3731cc['offset']=qs[_0x0a87('0x1e')](_0x2cb1ed[_0x0a87('0x32')][_0x0a87('0x1e')]);}_0x3731cc[_0x0a87('0x3a')]=qs[_0x0a87('0x3b')](_0x2cb1ed[_0x0a87('0x32')][_0x0a87('0x3b')]);_0x3731cc[_0x0a87('0x3c')]=qs[_0x0a87('0x3d')](_[_0x0a87('0x3e')](_0x2cb1ed['query'],_0x2df78e['filters']),_0x2674ed);if(_0x2cb1ed['query'][_0x0a87('0x3f')]){_0x3731cc['where']=_[_0x0a87('0x40')](_0x3731cc[_0x0a87('0x3c')],{'$or':_[_0x0a87('0x2c')](_0x2674ed,function(_0xf0c300){if(_0xf0c300[_0x0a87('0x30')]!==_0x0a87('0x41')){var _0x40b02e={};_0x40b02e[_0xf0c300[_0x0a87('0x29')]]={'$like':'%'+_0x2cb1ed['query']['filter']+'%'};return _0x40b02e;}})});}_0x3731cc=_[_0x0a87('0x40')]({},_0x3731cc,_0x2cb1ed[_0x0a87('0x42')]);var _0x5dd126={'where':_0x3731cc[_0x0a87('0x3c')]};return db[_0x0a87('0x2d')][_0x0a87('0x1d')](_0x5dd126)['then'](function(_0x27ed67){_0x5cd7e7['count']=_0x27ed67;if(_0x2cb1ed['query'][_0x0a87('0x43')]){_0x3731cc['include']=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x3731cc);})[_0x0a87('0x24')](function(_0x39f85f){_0x5cd7e7['rows']=_0x39f85f;return _0x5cd7e7;})[_0x0a87('0x24')](respondWithFilteredResult(_0xa1a123,_0x3731cc))[_0x0a87('0x44')](handleError(_0xa1a123,null));};exports[_0x0a87('0x45')]=function(_0x16afbc,_0x5d8e67){var _0x29459e={'raw':!![],'where':{'id':_0x16afbc[_0x0a87('0x46')]['id']}},_0x4825b9={};_0x4825b9[_0x0a87('0x31')]=_[_0x0a87('0x33')](db['SquareOdbc'][_0x0a87('0x2e')]);_0x4825b9[_0x0a87('0x32')]=_[_0x0a87('0x33')](_0x16afbc[_0x0a87('0x32')]);_0x4825b9[_0x0a87('0x3d')]=_[_0x0a87('0x34')](_0x4825b9[_0x0a87('0x31')],_0x4825b9['query']);_0x29459e[_0x0a87('0x35')]=_[_0x0a87('0x34')](_0x4825b9[_0x0a87('0x31')],qs[_0x0a87('0x36')](_0x16afbc[_0x0a87('0x32')][_0x0a87('0x36')]));_0x29459e['attributes']=_0x29459e[_0x0a87('0x35')][_0x0a87('0x37')]?_0x29459e['attributes']:_0x4825b9[_0x0a87('0x31')];if(_0x16afbc[_0x0a87('0x32')][_0x0a87('0x43')]){_0x29459e[_0x0a87('0x47')]=[{'all':!![]}];}_0x29459e=_[_0x0a87('0x40')]({},_0x29459e,_0x16afbc[_0x0a87('0x42')]);return db[_0x0a87('0x2d')][_0x0a87('0x48')](_0x29459e)[_0x0a87('0x24')](handleEntityNotFound(_0x5d8e67,null))[_0x0a87('0x24')](respondWithResult(_0x5d8e67,null))['catch'](handleError(_0x5d8e67,null));};exports[_0x0a87('0x49')]=function(_0x16f7d4,_0x35960c){return db[_0x0a87('0x2d')][_0x0a87('0x49')](_0x16f7d4[_0x0a87('0x4a')],{})[_0x0a87('0x24')](function(_0x107437){var _0x111e00=_0x16f7d4[_0x0a87('0x4b')][_0x0a87('0x4c')]({'plain':!![]});if(!_0x111e00)throw new Error(_0x0a87('0x4d'));if(_0x111e00[_0x0a87('0x4e')]===_0x0a87('0x4b')){var _0x437833=_0x107437[_0x0a87('0x4c')]({'plain':!![]});var _0x34b9aa='ODBC';return db[_0x0a87('0x4f')][_0x0a87('0x48')]({'where':{'name':_0x34b9aa,'userProfileId':_0x111e00['userProfileId']},'raw':!![]})[_0x0a87('0x24')](function(_0x322d3a){if(_0x322d3a&&_0x322d3a[_0x0a87('0x50')]===0x0){return db[_0x0a87('0x26')][_0x0a87('0x49')]({'name':_0x437833[_0x0a87('0x29')],'resourceId':_0x437833['id'],'type':_0x322d3a[_0x0a87('0x29')],'sectionId':_0x322d3a['id']},{})['then'](function(){return _0x107437;});}else{return _0x107437;}})[_0x0a87('0x44')](function(_0x3ba136){logger[_0x0a87('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ba136);throw _0x3ba136;});}return _0x107437;})[_0x0a87('0x24')](respondWithResult(_0x35960c,0xc9))[_0x0a87('0x44')](handleError(_0x35960c,null));};exports[_0x0a87('0x23')]=function(_0x41427f,_0x3ccc12){if(_0x41427f['body']['id']){delete _0x41427f['body']['id'];}return db[_0x0a87('0x2d')][_0x0a87('0x48')]({'where':{'id':_0x41427f[_0x0a87('0x46')]['id']}})[_0x0a87('0x24')](handleEntityNotFound(_0x3ccc12,null))[_0x0a87('0x24')](saveUpdates(_0x41427f['body'],null))[_0x0a87('0x24')](respondWithResult(_0x3ccc12,null))['catch'](handleError(_0x3ccc12,null));};exports[_0x0a87('0x25')]=function(_0x5e0545,_0x10fa3b){return db[_0x0a87('0x2d')]['find']({'where':{'id':_0x5e0545[_0x0a87('0x46')]['id']}})[_0x0a87('0x24')](handleEntityNotFound(_0x10fa3b,null))['then'](removeEntity(_0x10fa3b,null))[_0x0a87('0x44')](handleError(_0x10fa3b,null));};exports[_0x0a87('0x51')]=function(_0x533a41,_0xf8a70e,_0x596572){var _0x15cb71;return db[_0x0a87('0x2d')][_0x0a87('0x48')]({'where':{'id':_0x533a41[_0x0a87('0x46')]['id']},'attributes':['id',_0x0a87('0x52')]})['then'](handleEntityNotFound(_0xf8a70e,null))['then'](function(_0x399c61){if(_0x399c61){var _0x2586bb=require(_0x0a87('0x53'))();_0x2586bb[_0x0a87('0x54')](_0x399c61['dsn']);_0x2586bb[_0x0a87('0x55')]();return _0x399c61;}})[_0x0a87('0x24')](respondWithResult(_0xf8a70e,null))[_0x0a87('0x44')](handleError(_0xf8a70e,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e463087..0687b86 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 _0xa9f0=['exports','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5e31e2,_0x273090){var _0x294e2c=function(_0x20ab82){while(--_0x20ab82){_0x5e31e2['push'](_0x5e31e2['shift']());}};_0x294e2c(++_0x273090);}(_0xa9f0,0x153));var _0x0a9f=function(_0x3a872c,_0x17718b){_0x3a872c=_0x3a872c-0x0;var _0x2c39d4=_0xa9f0[_0x3a872c];return _0x2c39d4;};'use strict';var _=require(_0x0a9f('0x0'));var util=require('util');var logger=require(_0x0a9f('0x1'))(_0x0a9f('0x2'));var moment=require(_0x0a9f('0x3'));var BPromise=require(_0x0a9f('0x4'));var rp=require(_0x0a9f('0x5'));var fs=require('fs');var path=require(_0x0a9f('0x6'));var rimraf=require(_0x0a9f('0x7'));var config=require(_0x0a9f('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x0a9f('0x9')]=function(_0x54579c,_0x19b209){return _0x54579c['define'](_0x0a9f('0xa'),attributes,{'tableName':_0x0a9f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa24a=['define','SquareOdbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x25738d,_0x30ce7a){var _0x32a80d=function(_0x51e7d6){while(--_0x51e7d6){_0x25738d['push'](_0x25738d['shift']());}};_0x32a80d(++_0x30ce7a);}(_0xa24a,0x1a2));var _0xaa24=function(_0x131949,_0x5962e7){_0x131949=_0x131949-0x0;var _0x386f14=_0xa24a[_0x131949];return _0x386f14;};'use strict';var _=require(_0xaa24('0x0'));var util=require(_0xaa24('0x1'));var logger=require(_0xaa24('0x2'))(_0xaa24('0x3'));var moment=require(_0xaa24('0x4'));var BPromise=require(_0xaa24('0x5'));var rp=require(_0xaa24('0x6'));var fs=require('fs');var path=require(_0xaa24('0x7'));var rimraf=require(_0xaa24('0x8'));var config=require(_0xaa24('0x9'));var attributes=require('./squareOdbc.attributes');module[_0xaa24('0xa')]=function(_0x1844ac,_0x4b621a){return _0x1844ac[_0xaa24('0xb')](_0xaa24('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 07540bd..2928262 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x4c3593,_0x4ea381){var _0x1172d1=function(_0x434b93){while(--_0x434b93){_0x4c3593['push'](_0x4c3593['shift']());}};_0x1172d1(++_0x4ea381);}(_0x55ca,0x126));var _0xa55c=function(_0x10b317,_0x2adf32){_0x10b317=_0x10b317-0x0;var _0x1e3054=_0x55ca[_0x10b317];return _0x1e3054;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x54c516,_0x420575){var _0x2583c0=function(_0x4171e4){while(--_0x4171e4){_0x54c516['push'](_0x54c516['shift']());}};_0x2583c0(++_0x420575);}(_0x008c,0x188));var _0xc008=function(_0xfbdbd1,_0x2dc9d9){_0xfbdbd1=_0xfbdbd1-0x0;var _0x3e55b7=_0x008c[_0xfbdbd1];return _0x3e55b7;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index a75dcfe..3ce8f61 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 _0x96bc=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','get','isAuthenticated','show','getUsers','post','create','addUsers','put','/:id','update','delete','destroy','/:id/users','removeUsers','exports','multer'];(function(_0x38c5a9,_0x3db609){var _0x5b7f7d=function(_0x1ecd06){while(--_0x1ecd06){_0x38c5a9['push'](_0x38c5a9['shift']());}};_0x5b7f7d(++_0x3db609);}(_0x96bc,0xc7));var _0xc96b=function(_0x3ed82c,_0x2c4239){_0x3ed82c=_0x3ed82c-0x0;var _0x1642f8=_0x96bc[_0x3ed82c];return _0x1642f8;};'use strict';var multer=require(_0xc96b('0x0'));var util=require(_0xc96b('0x1'));var path=require(_0xc96b('0x2'));var timeout=require(_0xc96b('0x3'));var express=require(_0xc96b('0x4'));var router=express['Router']();var auth=require(_0xc96b('0x5'));var interaction=require(_0xc96b('0x6'));var config=require(_0xc96b('0x7'));var controller=require(_0xc96b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc96b('0x9')]);router[_0xc96b('0xa')]('/:id',auth[_0xc96b('0xb')](),controller[_0xc96b('0xc')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xc96b('0xd')]);router[_0xc96b('0xe')]('/',auth[_0xc96b('0xb')](),controller[_0xc96b('0xf')]);router[_0xc96b('0xe')]('/:id/users',auth[_0xc96b('0xb')](),controller[_0xc96b('0x10')]);router[_0xc96b('0x11')](_0xc96b('0x12'),auth[_0xc96b('0xb')](),controller[_0xc96b('0x13')]);router[_0xc96b('0x14')]('/:id',auth[_0xc96b('0xb')](),controller[_0xc96b('0x15')]);router[_0xc96b('0x14')](_0xc96b('0x16'),auth[_0xc96b('0xb')](),controller[_0xc96b('0x17')]);module[_0xc96b('0x18')]=router; \ No newline at end of file +var _0xaee3=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','removeUsers','exports','multer','util','path','connect-timeout'];(function(_0xa7c180,_0x29322e){var _0x2b76d3=function(_0x54fbb3){while(--_0x54fbb3){_0xa7c180['push'](_0xa7c180['shift']());}};_0x2b76d3(++_0x29322e);}(_0xaee3,0xf9));var _0x3aee=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xaee3[_0x346737];return _0x1ade2e;};'use strict';var multer=require(_0x3aee('0x0'));var util=require(_0x3aee('0x1'));var path=require(_0x3aee('0x2'));var timeout=require(_0x3aee('0x3'));var express=require(_0x3aee('0x4'));var router=express[_0x3aee('0x5')]();var auth=require(_0x3aee('0x6'));var interaction=require(_0x3aee('0x7'));var config=require(_0x3aee('0x8'));var controller=require('./squareProject.controller');router[_0x3aee('0x9')]('/',auth[_0x3aee('0xa')](),controller[_0x3aee('0xb')]);router[_0x3aee('0x9')]('/:id',auth[_0x3aee('0xa')](),controller[_0x3aee('0xc')]);router[_0x3aee('0x9')](_0x3aee('0xd'),auth['isAuthenticated'](),controller[_0x3aee('0xe')]);router[_0x3aee('0xf')]('/',auth['isAuthenticated'](),controller[_0x3aee('0x10')]);router[_0x3aee('0xf')](_0x3aee('0xd'),auth[_0x3aee('0xa')](),controller[_0x3aee('0x11')]);router[_0x3aee('0x12')]('/:id',auth[_0x3aee('0xa')](),controller[_0x3aee('0x13')]);router[_0x3aee('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x3aee('0x14')](_0x3aee('0xd'),auth[_0x3aee('0xa')](),controller[_0x3aee('0x15')]);module[_0x3aee('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index d6325b6..38edc58 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 _0xe809=['utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction','toString'];(function(_0x46218a,_0x196ffc){var _0x618b81=function(_0x5aac78){while(--_0x5aac78){_0x46218a['push'](_0x46218a['shift']());}};_0x618b81(++_0x196ffc);}(_0xe809,0x9f));var _0x9e80=function(_0x40001a,_0x4f6311){_0x40001a=_0x40001a-0x0;var _0x4b8436=_0xe809[_0x40001a];return _0x4b8436;};'use strict';var Sequelize=require(_0x9e80('0x0'));module[_0x9e80('0x1')]={'name':{'type':Sequelize[_0x9e80('0x2')],'unique':_0x9e80('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9e80('0x2')]},'notes':{'type':Sequelize[_0x9e80('0x4')]},'preproduction':{'type':Sequelize[_0x9e80('0x5')](_0x9e80('0x6')),'get':function(){if(this[_0x9e80('0x7')](_0x9e80('0x8'))){return this[_0x9e80('0x7')]('preproduction')[_0x9e80('0x9')](_0x9e80('0xa'));}}},'production':{'type':Sequelize[_0x9e80('0x5')](_0x9e80('0x6')),'get':function(){if(this[_0x9e80('0x7')](_0x9e80('0xb'))){return this[_0x9e80('0x7')](_0x9e80('0xb'))[_0x9e80('0x9')](_0x9e80('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x9e80('0xc')]}}; \ No newline at end of file +var _0x91c8=['BLOB','production','DATE','sequelize','STRING','name','TEXT','long','getDataValue','preproduction','toString','utf8'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x91c8,0x93));var _0x891c=function(_0x5cf397,_0x2b9722){_0x5cf397=_0x5cf397-0x0;var _0x1cfee4=_0x91c8[_0x5cf397];return _0x1cfee4;};'use strict';var Sequelize=require(_0x891c('0x0'));module['exports']={'name':{'type':Sequelize[_0x891c('0x1')],'unique':_0x891c('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x891c('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x891c('0x4')),'get':function(){if(this[_0x891c('0x5')](_0x891c('0x6'))){return this[_0x891c('0x5')](_0x891c('0x6'))[_0x891c('0x7')](_0x891c('0x8'));}}},'production':{'type':Sequelize[_0x891c('0x9')](_0x891c('0x4')),'get':function(){if(this[_0x891c('0x5')](_0x891c('0xa'))){return this[_0x891c('0x5')](_0x891c('0xa'))[_0x891c('0x7')](_0x891c('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x891c('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 22f6e6d..383afa3 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 _0x8a7b=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','SquareProjects','name','index','map','SquareProject','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','count','includeAll','include','findAll','rows','show','options','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','findOne','User','getUsers','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x28ecea,_0x4c98f8){var _0x2326df=function(_0x48c69a){while(--_0x48c69a){_0x28ecea['push'](_0x28ecea['shift']());}};_0x2326df(++_0x4c98f8);}(_0x8a7b,0x17e));var _0xb8a7=function(_0xd20f56,_0x4289bf){_0xd20f56=_0xd20f56-0x0;var _0x366917=_0x8a7b[_0xd20f56];return _0x366917;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb8a7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8a7('0x1'));var rp=require(_0xb8a7('0x2'));var moment=require(_0xb8a7('0x3'));var BPromise=require(_0xb8a7('0x4'));var Mustache=require(_0xb8a7('0x5'));var util=require(_0xb8a7('0x6'));var path=require(_0xb8a7('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb8a7('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb8a7('0x9'));var crypto=require(_0xb8a7('0xa'));var jsforce=require(_0xb8a7('0xb'));var deskjs=require(_0xb8a7('0xc'));var toCsv=require(_0xb8a7('0xd'));var querystring=require('querystring');var Papa=require(_0xb8a7('0xe'));var Redis=require(_0xb8a7('0xf'));var authService=require(_0xb8a7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb8a7('0x11'));var hardwareService=require(_0xb8a7('0x12'));var logger=require(_0xb8a7('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb8a7('0x14'));var licenseUtil=require(_0xb8a7('0x15'));var db=require(_0xb8a7('0x16'))['db'];config[_0xb8a7('0x17')]=_[_0xb8a7('0x18')](config[_0xb8a7('0x17')],{'host':_0xb8a7('0x19'),'port':0x18eb});var socket=require(_0xb8a7('0x1a'))(new Redis(config[_0xb8a7('0x17')]));require(_0xb8a7('0x1b'))[_0xb8a7('0x1c')](socket);function respondWithStatusCode(_0x2e35fd,_0x1776db){_0x1776db=_0x1776db||0xcc;return function(_0x4f6fc1){if(_0x4f6fc1){return _0x2e35fd[_0xb8a7('0x1d')](_0x1776db);}return _0x2e35fd['status'](_0x1776db)[_0xb8a7('0x1e')]();};}function respondWithResult(_0x3656c8,_0x120d77){_0x120d77=_0x120d77||0xc8;return function(_0x4e205f){if(_0x4e205f){return _0x3656c8[_0xb8a7('0x1f')](_0x120d77)[_0xb8a7('0x20')](_0x4e205f);}};}function respondWithFilteredResult(_0x6f6dae,_0x63c1d2){return function(_0x2b7599){if(_0x2b7599){var _0x25a067=_0x2b7599['count'],_0x35fd7c=_0x63c1d2[_0xb8a7('0x21')],_0xdae36c=_0x63c1d2['offset']+_0x63c1d2[_0xb8a7('0x22')],_0x7ffbf6;if(_0xdae36c>=_0x25a067){_0xdae36c=_0x25a067;_0x7ffbf6=0xc8;}else{_0x7ffbf6=0xce;}_0x6f6dae[_0xb8a7('0x1f')](_0x7ffbf6);return _0x6f6dae[_0xb8a7('0x23')](_0xb8a7('0x24'),_0x35fd7c+'-'+_0xdae36c+'/'+_0x25a067)[_0xb8a7('0x20')](_0x2b7599);}return null;};}function patchUpdates(_0x5497d6){return function(_0x178273){try{jsonpatch[_0xb8a7('0x25')](_0x178273,_0x5497d6,!![]);}catch(_0x1e3dc2){return BPromise[_0xb8a7('0x26')](_0x1e3dc2);}return _0x178273[_0xb8a7('0x27')]();};}function saveUpdates(_0x41e906,_0x2887b3){return function(_0x463b7e){if(_0x463b7e){return _0x463b7e['update'](_0x41e906)['then'](function(_0x545c17){return _0x545c17;});}return null;};}function removeEntity(_0x3937c8,_0x3a709c){return function(_0x568e67){if(_0x568e67){return _0x568e67[_0xb8a7('0x28')]()[_0xb8a7('0x29')](function(){var _0x2164b7=_0x568e67[_0xb8a7('0x2a')]({'plain':!![]});var _0x220083=_0xb8a7('0x2b');return db['UserProfileResource'][_0xb8a7('0x28')]({'where':{'type':_0x220083,'resourceId':_0x2164b7['id']}})[_0xb8a7('0x29')](function(){return _0x568e67;});})[_0xb8a7('0x29')](function(){_0x3937c8[_0xb8a7('0x1f')](0xcc)[_0xb8a7('0x1e')]();});}};}function handleEntityNotFound(_0x44f3b1,_0x2ac200){return function(_0x5bf0cf){if(!_0x5bf0cf){_0x44f3b1[_0xb8a7('0x1d')](0x194);}return _0x5bf0cf;};}function handleError(_0x154587,_0x11ef36){_0x11ef36=_0x11ef36||0x1f4;return function(_0xc897bd){logger['error'](_0xc897bd['stack']);if(_0xc897bd[_0xb8a7('0x2c')]){delete _0xc897bd[_0xb8a7('0x2c')];}_0x154587[_0xb8a7('0x1f')](_0x11ef36)['send'](_0xc897bd);};}exports[_0xb8a7('0x2d')]=function(_0x5516b5,_0x1e399d){var _0x2f6cfb={},_0xeb0798={},_0x18633a={'count':0x0,'rows':[]};var _0x31d485=_[_0xb8a7('0x2e')](db[_0xb8a7('0x2f')][_0xb8a7('0x30')],function(_0xb5e1ff){return{'name':_0xb5e1ff[_0xb8a7('0x31')],'type':_0xb5e1ff[_0xb8a7('0x32')][_0xb8a7('0x33')]};});_0xeb0798['model']=_[_0xb8a7('0x2e')](_0x31d485,_0xb8a7('0x2c'));_0xeb0798[_0xb8a7('0x34')]=_[_0xb8a7('0x35')](_0x5516b5[_0xb8a7('0x34')]);_0xeb0798[_0xb8a7('0x36')]=_[_0xb8a7('0x37')](_0xeb0798[_0xb8a7('0x38')],_0xeb0798['query']);_0x2f6cfb[_0xb8a7('0x39')]=_[_0xb8a7('0x37')](_0xeb0798[_0xb8a7('0x38')],qs['fields'](_0x5516b5[_0xb8a7('0x34')][_0xb8a7('0x3a')]));_0x2f6cfb[_0xb8a7('0x39')]=_0x2f6cfb[_0xb8a7('0x39')][_0xb8a7('0x3b')]?_0x2f6cfb[_0xb8a7('0x39')]:_0xeb0798['model'];if(!_0x5516b5[_0xb8a7('0x34')][_0xb8a7('0x3c')](_0xb8a7('0x3d'))){_0x2f6cfb[_0xb8a7('0x22')]=qs[_0xb8a7('0x22')](_0x5516b5[_0xb8a7('0x34')][_0xb8a7('0x22')]);_0x2f6cfb[_0xb8a7('0x21')]=qs[_0xb8a7('0x21')](_0x5516b5[_0xb8a7('0x34')]['offset']);}_0x2f6cfb[_0xb8a7('0x3e')]=qs[_0xb8a7('0x3f')](_0x5516b5[_0xb8a7('0x34')][_0xb8a7('0x3f')]);_0x2f6cfb['where']=qs[_0xb8a7('0x36')](_[_0xb8a7('0x40')](_0x5516b5[_0xb8a7('0x34')],_0xeb0798[_0xb8a7('0x36')]),_0x31d485);if(_0x5516b5[_0xb8a7('0x34')][_0xb8a7('0x41')]){_0x2f6cfb[_0xb8a7('0x42')]=_[_0xb8a7('0x43')](_0x2f6cfb[_0xb8a7('0x42')],{'$or':_[_0xb8a7('0x2e')](_0x31d485,function(_0xe65d24){if(_0xe65d24[_0xb8a7('0x32')]!=='VIRTUAL'){var _0x2a3631={};_0x2a3631[_0xe65d24['name']]={'$like':'%'+_0x5516b5[_0xb8a7('0x34')]['filter']+'%'};return _0x2a3631;}})});}_0x2f6cfb=_[_0xb8a7('0x43')]({},_0x2f6cfb,_0x5516b5['options']);var _0x389b87={'where':_0x2f6cfb[_0xb8a7('0x42')]};return db[_0xb8a7('0x2f')]['count'](_0x389b87)[_0xb8a7('0x29')](function(_0x23208c){_0x18633a[_0xb8a7('0x44')]=_0x23208c;if(_0x5516b5[_0xb8a7('0x34')][_0xb8a7('0x45')]){_0x2f6cfb[_0xb8a7('0x46')]=[{'all':!![]}];}return db[_0xb8a7('0x2f')][_0xb8a7('0x47')](_0x2f6cfb);})[_0xb8a7('0x29')](function(_0x247eac){_0x18633a[_0xb8a7('0x48')]=_0x247eac;return _0x18633a;})['then'](respondWithFilteredResult(_0x1e399d,_0x2f6cfb))['catch'](handleError(_0x1e399d,null));};exports[_0xb8a7('0x49')]=function(_0x52ad30,_0x491f55){var _0x5d9e75={'raw':![],'where':{'id':_0x52ad30['params']['id']}},_0x3243d4={};_0x3243d4[_0xb8a7('0x38')]=_['keys'](db[_0xb8a7('0x2f')][_0xb8a7('0x30')]);_0x3243d4[_0xb8a7('0x34')]=_[_0xb8a7('0x35')](_0x52ad30[_0xb8a7('0x34')]);_0x3243d4[_0xb8a7('0x36')]=_[_0xb8a7('0x37')](_0x3243d4['model'],_0x3243d4[_0xb8a7('0x34')]);_0x5d9e75[_0xb8a7('0x39')]=_[_0xb8a7('0x37')](_0x3243d4[_0xb8a7('0x38')],qs[_0xb8a7('0x3a')](_0x52ad30[_0xb8a7('0x34')][_0xb8a7('0x3a')]));_0x5d9e75[_0xb8a7('0x39')]=_0x5d9e75[_0xb8a7('0x39')]['length']?_0x5d9e75['attributes']:_0x3243d4[_0xb8a7('0x38')];if(_0x52ad30[_0xb8a7('0x34')][_0xb8a7('0x45')]){_0x5d9e75[_0xb8a7('0x46')]=[{'all':!![]}];}_0x5d9e75=_[_0xb8a7('0x43')]({},_0x5d9e75,_0x52ad30[_0xb8a7('0x4a')]);return db[_0xb8a7('0x2f')]['find'](_0x5d9e75)[_0xb8a7('0x29')](handleEntityNotFound(_0x491f55,null))[_0xb8a7('0x29')](respondWithResult(_0x491f55,null))['catch'](handleError(_0x491f55,null));};exports['create']=function(_0x1376cb,_0xffd3f5){return db[_0xb8a7('0x2f')]['create'](_0x1376cb[_0xb8a7('0x4b')],{})['then'](function(_0x358e59){var _0x396d7f=_0x1376cb[_0xb8a7('0x4c')][_0xb8a7('0x2a')]({'plain':!![]});if(!_0x396d7f)throw new Error(_0xb8a7('0x4d'));if(_0x396d7f[_0xb8a7('0x4e')]===_0xb8a7('0x4c')){var _0x931b6=_0x358e59[_0xb8a7('0x2a')]({'plain':!![]});var _0x2d0ed3=_0xb8a7('0x2b');return db[_0xb8a7('0x4f')][_0xb8a7('0x50')]({'where':{'name':_0x2d0ed3,'userProfileId':_0x396d7f[_0xb8a7('0x51')]},'raw':!![]})['then'](function(_0x548643){if(_0x548643&&_0x548643[_0xb8a7('0x52')]===0x0){return db[_0xb8a7('0x53')][_0xb8a7('0x54')]({'name':_0x931b6[_0xb8a7('0x2c')],'resourceId':_0x931b6['id'],'type':_0x548643[_0xb8a7('0x2c')],'sectionId':_0x548643['id']},{})[_0xb8a7('0x29')](function(){return _0x358e59;});}else{return _0x358e59;}})[_0xb8a7('0x55')](function(_0x32e4ec){logger[_0xb8a7('0x56')](_0xb8a7('0x57'),_0x32e4ec);throw _0x32e4ec;});}return _0x358e59;})['then'](respondWithResult(_0xffd3f5,0xc9))[_0xb8a7('0x55')](handleError(_0xffd3f5,null));};exports[_0xb8a7('0x58')]=function(_0x43af10,_0x3b3fea){if(_0x43af10['body']['id']){delete _0x43af10[_0xb8a7('0x4b')]['id'];}return db[_0xb8a7('0x2f')][_0xb8a7('0x50')]({'where':{'id':_0x43af10[_0xb8a7('0x59')]['id']}})[_0xb8a7('0x29')](handleEntityNotFound(_0x3b3fea,null))[_0xb8a7('0x29')](saveUpdates(_0x43af10['body'],null))['then'](respondWithResult(_0x3b3fea,null))[_0xb8a7('0x55')](handleError(_0x3b3fea,null));};exports[_0xb8a7('0x28')]=function(_0x36be47,_0x562519){return db['SquareProject'][_0xb8a7('0x50')]({'where':{'id':_0x36be47['params']['id']}})[_0xb8a7('0x29')](handleEntityNotFound(_0x562519,null))['then'](removeEntity(_0x562519,null))[_0xb8a7('0x55')](handleError(_0x562519,null));};exports[_0xb8a7('0x5a')]=function(_0x246de3,_0x574a60,_0x3fdd25){return db[_0xb8a7('0x2f')]['find']({'where':{'id':_0x246de3[_0xb8a7('0x59')]['id']}})[_0xb8a7('0x29')](handleEntityNotFound(_0x574a60,null))[_0xb8a7('0x29')](function(_0x2d654c){if(_0x2d654c){return _0x2d654c[_0xb8a7('0x5a')](_0x246de3[_0xb8a7('0x4b')][_0xb8a7('0x5b')],_[_0xb8a7('0x5c')](_0x246de3['body'],[_0xb8a7('0x5b'),'id'])||{});}})[_0xb8a7('0x29')](respondWithResult(_0x574a60,null))[_0xb8a7('0x55')](handleError(_0x574a60,null));};exports[_0xb8a7('0x5d')]=function(_0x3641fe,_0x17439d,_0x5683b7){return db['SquareProject'][_0xb8a7('0x50')]({'where':{'id':_0x3641fe[_0xb8a7('0x59')]['id']}})[_0xb8a7('0x29')](handleEntityNotFound(_0x17439d,null))[_0xb8a7('0x29')](function(_0x2d1be2){if(_0x2d1be2){return _0x2d1be2[_0xb8a7('0x5d')](_0x3641fe['query'][_0xb8a7('0x5b')])[_0xb8a7('0x29')](function(){if(_[_0xb8a7('0x5e')](_0x3641fe['query']['ids'])){for(var _0x1bc5f1=0x0;_0x1bc5f1<_0x3641fe['query'][_0xb8a7('0x5b')]['length'];_0x1bc5f1+=0x1){socket['emit'](_0xb8a7('0x5f'),{'UserId':Number(_0x3641fe[_0xb8a7('0x34')][_0xb8a7('0x5b')][_0x1bc5f1]),'SquareProjectId':Number(_0x3641fe[_0xb8a7('0x59')]['id'])});}}else{socket[_0xb8a7('0x60')]('userSquareProject:remove',{'UserId':Number(_0x3641fe[_0xb8a7('0x34')][_0xb8a7('0x5b')]),'SquareProjectId':Number(_0x3641fe[_0xb8a7('0x59')]['id'])});}});}})[_0xb8a7('0x29')](respondWithStatusCode(_0x17439d,null))[_0xb8a7('0x55')](handleError(_0x17439d,null));};exports['getUsers']=function(_0x568587,_0x1e8e50,_0x42dc31){var _0x210861={};var _0x4a1f79={};var _0x3e2b2e;var _0x529ae3;return db[_0xb8a7('0x2f')][_0xb8a7('0x61')]({'where':{'id':_0x568587[_0xb8a7('0x59')]['id']}})[_0xb8a7('0x29')](handleEntityNotFound(_0x1e8e50,null))[_0xb8a7('0x29')](function(_0x335c55){if(_0x335c55){_0x3e2b2e=_0x335c55;_0x4a1f79[_0xb8a7('0x38')]=_[_0xb8a7('0x35')](db[_0xb8a7('0x62')][_0xb8a7('0x30')]);_0x4a1f79[_0xb8a7('0x34')]=_[_0xb8a7('0x35')](_0x568587['query']);_0x4a1f79['filters']=_[_0xb8a7('0x37')](_0x4a1f79[_0xb8a7('0x38')],_0x4a1f79[_0xb8a7('0x34')]);_0x210861[_0xb8a7('0x39')]=_[_0xb8a7('0x37')](_0x4a1f79[_0xb8a7('0x38')],qs[_0xb8a7('0x3a')](_0x568587[_0xb8a7('0x34')][_0xb8a7('0x3a')]));_0x210861[_0xb8a7('0x39')]=_0x210861[_0xb8a7('0x39')][_0xb8a7('0x3b')]?_0x210861['attributes']:_0x4a1f79['model'];_0x210861[_0xb8a7('0x3e')]=qs['sort'](_0x568587[_0xb8a7('0x34')][_0xb8a7('0x3f')]);_0x210861[_0xb8a7('0x42')]=qs['filters'](_[_0xb8a7('0x40')](_0x568587[_0xb8a7('0x34')],_0x4a1f79[_0xb8a7('0x36')]));if(_0x568587[_0xb8a7('0x34')][_0xb8a7('0x41')]){_0x210861[_0xb8a7('0x42')]=_[_0xb8a7('0x43')](_0x210861[_0xb8a7('0x42')],{'$or':_[_0xb8a7('0x2e')](_0x210861['attributes'],function(_0x2507f8){var _0x342e0f={};_0x342e0f[_0x2507f8]={'$like':'%'+_0x568587[_0xb8a7('0x34')][_0xb8a7('0x41')]+'%'};return _0x342e0f;})});}_0x210861=_[_0xb8a7('0x43')]({},_0x210861,_0x568587[_0xb8a7('0x4a')]);return _0x3e2b2e['getUsers'](_0x210861);}})['then'](function(_0x139e10){if(_0x139e10){_0x529ae3=_0x139e10[_0xb8a7('0x3b')];if(!_0x568587[_0xb8a7('0x34')]['hasOwnProperty'](_0xb8a7('0x3d'))){_0x210861[_0xb8a7('0x22')]=qs[_0xb8a7('0x22')](_0x568587[_0xb8a7('0x34')]['limit']);_0x210861['offset']=qs[_0xb8a7('0x21')](_0x568587['query'][_0xb8a7('0x21')]);}return _0x3e2b2e[_0xb8a7('0x63')](_0x210861);}})[_0xb8a7('0x29')](function(_0x391baa){if(_0x391baa){return _0x391baa?{'count':_0x529ae3,'rows':_0x391baa}:null;}})[_0xb8a7('0x29')](respondWithResult(_0x1e8e50,null))[_0xb8a7('0x55')](handleError(_0x1e8e50,null));}; \ No newline at end of file +var _0x6425=['emit','userSquareProject:remove','getUsers','User','hasOwnProperty','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','user','role','SquareProjects','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','isArray'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x6425,0xc0));var _0x5642=function(_0x2b5aa1,_0x4060ed){_0x2b5aa1=_0x2b5aa1-0x0;var _0x366064=_0x6425[_0x2b5aa1];return _0x366064;};'use strict';var pdf=require(_0x5642('0x0'));var emlformat=require(_0x5642('0x1'));var rimraf=require(_0x5642('0x2'));var zipdir=require(_0x5642('0x3'));var jsonpatch=require(_0x5642('0x4'));var rp=require(_0x5642('0x5'));var moment=require('moment');var BPromise=require(_0x5642('0x6'));var Mustache=require(_0x5642('0x7'));var util=require(_0x5642('0x8'));var path=require('path');var sox=require(_0x5642('0x9'));var csv=require(_0x5642('0xa'));var ejs=require(_0x5642('0xb'));var fs=require('fs');var _=require(_0x5642('0xc'));var squel=require(_0x5642('0xd'));var crypto=require(_0x5642('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5642('0xf'));var Papa=require(_0x5642('0x10'));var Redis=require(_0x5642('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5642('0x12'));var as=require(_0x5642('0x13'));var hardwareService=require(_0x5642('0x14'));var logger=require('../../config/logger')(_0x5642('0x15'));var utils=require(_0x5642('0x16'));var config=require(_0x5642('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x5642('0x18')](config[_0x5642('0x19')],{'host':_0x5642('0x1a'),'port':0x18eb});var socket=require(_0x5642('0x1b'))(new Redis(config[_0x5642('0x19')]));require(_0x5642('0x1c'))[_0x5642('0x1d')](socket);function respondWithStatusCode(_0x25981f,_0x1c9270){_0x1c9270=_0x1c9270||0xcc;return function(_0x18f5be){if(_0x18f5be){return _0x25981f['sendStatus'](_0x1c9270);}return _0x25981f['status'](_0x1c9270)[_0x5642('0x1e')]();};}function respondWithResult(_0x43897d,_0x21a779){_0x21a779=_0x21a779||0xc8;return function(_0xba327d){if(_0xba327d){return _0x43897d[_0x5642('0x1f')](_0x21a779)[_0x5642('0x20')](_0xba327d);}};}function respondWithFilteredResult(_0x1e3731,_0x5c3219){return function(_0x3fc78e){if(_0x3fc78e){var _0x37ab6a=_0x3fc78e[_0x5642('0x21')],_0x20d2b7=_0x5c3219['offset'],_0x236e3d=_0x5c3219[_0x5642('0x22')]+_0x5c3219[_0x5642('0x23')],_0x560d30;if(_0x236e3d>=_0x37ab6a){_0x236e3d=_0x37ab6a;_0x560d30=0xc8;}else{_0x560d30=0xce;}_0x1e3731[_0x5642('0x1f')](_0x560d30);return _0x1e3731[_0x5642('0x24')](_0x5642('0x25'),_0x20d2b7+'-'+_0x236e3d+'/'+_0x37ab6a)['json'](_0x3fc78e);}return null;};}function patchUpdates(_0x16da9f){return function(_0x44066a){try{jsonpatch[_0x5642('0x26')](_0x44066a,_0x16da9f,!![]);}catch(_0x5c1783){return BPromise['reject'](_0x5c1783);}return _0x44066a[_0x5642('0x27')]();};}function saveUpdates(_0x24d851,_0x4bb32d){return function(_0x37df56){if(_0x37df56){return _0x37df56['update'](_0x24d851)[_0x5642('0x28')](function(_0x743de7){return _0x743de7;});}return null;};}function removeEntity(_0x34dee0,_0x85f298){return function(_0x319f46){if(_0x319f46){return _0x319f46[_0x5642('0x29')]()[_0x5642('0x28')](function(){var _0x2f6e0a=_0x319f46[_0x5642('0x2a')]({'plain':!![]});var _0x547531='SquareProjects';return db[_0x5642('0x2b')][_0x5642('0x29')]({'where':{'type':_0x547531,'resourceId':_0x2f6e0a['id']}})['then'](function(){return _0x319f46;});})[_0x5642('0x28')](function(){_0x34dee0[_0x5642('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1789ee,_0x27c5c6){return function(_0x14cd54){if(!_0x14cd54){_0x1789ee['sendStatus'](0x194);}return _0x14cd54;};}function handleError(_0x1242c1,_0xe04f3e){_0xe04f3e=_0xe04f3e||0x1f4;return function(_0x4ebc4b){logger['error'](_0x4ebc4b[_0x5642('0x2c')]);if(_0x4ebc4b[_0x5642('0x2d')]){delete _0x4ebc4b[_0x5642('0x2d')];}_0x1242c1[_0x5642('0x1f')](_0xe04f3e)['send'](_0x4ebc4b);};}exports[_0x5642('0x2e')]=function(_0x22d09b,_0x53b5bf){var _0x58c6b9={},_0xd7412f={},_0x533610={'count':0x0,'rows':[]};var _0x4cb3f3=_[_0x5642('0x2f')](db[_0x5642('0x30')][_0x5642('0x31')],function(_0x431a04){return{'name':_0x431a04[_0x5642('0x32')],'type':_0x431a04[_0x5642('0x33')][_0x5642('0x34')]};});_0xd7412f[_0x5642('0x35')]=_[_0x5642('0x2f')](_0x4cb3f3,_0x5642('0x2d'));_0xd7412f[_0x5642('0x36')]=_['keys'](_0x22d09b[_0x5642('0x36')]);_0xd7412f[_0x5642('0x37')]=_[_0x5642('0x38')](_0xd7412f[_0x5642('0x35')],_0xd7412f[_0x5642('0x36')]);_0x58c6b9[_0x5642('0x39')]=_[_0x5642('0x38')](_0xd7412f[_0x5642('0x35')],qs[_0x5642('0x3a')](_0x22d09b[_0x5642('0x36')][_0x5642('0x3a')]));_0x58c6b9[_0x5642('0x39')]=_0x58c6b9[_0x5642('0x39')]['length']?_0x58c6b9[_0x5642('0x39')]:_0xd7412f[_0x5642('0x35')];if(!_0x22d09b[_0x5642('0x36')]['hasOwnProperty']('nolimit')){_0x58c6b9['limit']=qs[_0x5642('0x23')](_0x22d09b['query'][_0x5642('0x23')]);_0x58c6b9[_0x5642('0x22')]=qs[_0x5642('0x22')](_0x22d09b[_0x5642('0x36')][_0x5642('0x22')]);}_0x58c6b9[_0x5642('0x3b')]=qs['sort'](_0x22d09b[_0x5642('0x36')][_0x5642('0x3c')]);_0x58c6b9['where']=qs[_0x5642('0x37')](_[_0x5642('0x3d')](_0x22d09b['query'],_0xd7412f[_0x5642('0x37')]),_0x4cb3f3);if(_0x22d09b['query']['filter']){_0x58c6b9[_0x5642('0x3e')]=_[_0x5642('0x3f')](_0x58c6b9[_0x5642('0x3e')],{'$or':_[_0x5642('0x2f')](_0x4cb3f3,function(_0x5c0f67){if(_0x5c0f67['type']!=='VIRTUAL'){var _0x3dd28b={};_0x3dd28b[_0x5c0f67['name']]={'$like':'%'+_0x22d09b[_0x5642('0x36')][_0x5642('0x40')]+'%'};return _0x3dd28b;}})});}_0x58c6b9=_[_0x5642('0x3f')]({},_0x58c6b9,_0x22d09b[_0x5642('0x41')]);var _0x12f6ae={'where':_0x58c6b9[_0x5642('0x3e')]};return db[_0x5642('0x30')][_0x5642('0x21')](_0x12f6ae)[_0x5642('0x28')](function(_0x42c6d7){_0x533610[_0x5642('0x21')]=_0x42c6d7;if(_0x22d09b[_0x5642('0x36')][_0x5642('0x42')]){_0x58c6b9[_0x5642('0x43')]=[{'all':!![]}];}return db[_0x5642('0x30')][_0x5642('0x44')](_0x58c6b9);})[_0x5642('0x28')](function(_0x53b774){_0x533610[_0x5642('0x45')]=_0x53b774;return _0x533610;})[_0x5642('0x28')](respondWithFilteredResult(_0x53b5bf,_0x58c6b9))[_0x5642('0x46')](handleError(_0x53b5bf,null));};exports['show']=function(_0x452cfe,_0x3e0226){var _0x46fdef={'raw':![],'where':{'id':_0x452cfe[_0x5642('0x47')]['id']}},_0x1cec1d={};_0x1cec1d[_0x5642('0x35')]=_['keys'](db[_0x5642('0x30')][_0x5642('0x31')]);_0x1cec1d[_0x5642('0x36')]=_[_0x5642('0x48')](_0x452cfe[_0x5642('0x36')]);_0x1cec1d[_0x5642('0x37')]=_[_0x5642('0x38')](_0x1cec1d['model'],_0x1cec1d[_0x5642('0x36')]);_0x46fdef[_0x5642('0x39')]=_[_0x5642('0x38')](_0x1cec1d[_0x5642('0x35')],qs['fields'](_0x452cfe[_0x5642('0x36')][_0x5642('0x3a')]));_0x46fdef['attributes']=_0x46fdef[_0x5642('0x39')][_0x5642('0x49')]?_0x46fdef['attributes']:_0x1cec1d[_0x5642('0x35')];if(_0x452cfe['query'][_0x5642('0x42')]){_0x46fdef[_0x5642('0x43')]=[{'all':!![]}];}_0x46fdef=_[_0x5642('0x3f')]({},_0x46fdef,_0x452cfe[_0x5642('0x41')]);return db['SquareProject'][_0x5642('0x4a')](_0x46fdef)[_0x5642('0x28')](handleEntityNotFound(_0x3e0226,null))[_0x5642('0x28')](respondWithResult(_0x3e0226,null))['catch'](handleError(_0x3e0226,null));};exports[_0x5642('0x4b')]=function(_0x519ed1,_0x2c5b0a){return db[_0x5642('0x30')][_0x5642('0x4b')](_0x519ed1[_0x5642('0x4c')],{})[_0x5642('0x28')](function(_0x4996b3){var _0x9eabf5=_0x519ed1[_0x5642('0x4d')][_0x5642('0x2a')]({'plain':!![]});if(!_0x9eabf5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9eabf5[_0x5642('0x4e')]===_0x5642('0x4d')){var _0x1e3add=_0x4996b3[_0x5642('0x2a')]({'plain':!![]});var _0xb0ce97=_0x5642('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0xb0ce97,'userProfileId':_0x9eabf5[_0x5642('0x50')]},'raw':!![]})[_0x5642('0x28')](function(_0x3a8eb0){if(_0x3a8eb0&&_0x3a8eb0['autoAssociation']===0x0){return db[_0x5642('0x2b')][_0x5642('0x4b')]({'name':_0x1e3add[_0x5642('0x2d')],'resourceId':_0x1e3add['id'],'type':_0x3a8eb0['name'],'sectionId':_0x3a8eb0['id']},{})['then'](function(){return _0x4996b3;});}else{return _0x4996b3;}})[_0x5642('0x46')](function(_0x185d53){logger[_0x5642('0x51')](_0x5642('0x52'),_0x185d53);throw _0x185d53;});}return _0x4996b3;})[_0x5642('0x28')](respondWithResult(_0x2c5b0a,0xc9))['catch'](handleError(_0x2c5b0a,null));};exports['update']=function(_0x340631,_0x2eea92){if(_0x340631[_0x5642('0x4c')]['id']){delete _0x340631[_0x5642('0x4c')]['id'];}return db[_0x5642('0x30')]['find']({'where':{'id':_0x340631['params']['id']}})[_0x5642('0x28')](handleEntityNotFound(_0x2eea92,null))[_0x5642('0x28')](saveUpdates(_0x340631['body'],null))['then'](respondWithResult(_0x2eea92,null))['catch'](handleError(_0x2eea92,null));};exports[_0x5642('0x29')]=function(_0x30dbef,_0x27dc63){return db[_0x5642('0x30')][_0x5642('0x4a')]({'where':{'id':_0x30dbef[_0x5642('0x47')]['id']}})[_0x5642('0x28')](handleEntityNotFound(_0x27dc63,null))[_0x5642('0x28')](removeEntity(_0x27dc63,null))[_0x5642('0x46')](handleError(_0x27dc63,null));};exports[_0x5642('0x53')]=function(_0x18cd05,_0x145d19,_0x3c6ccf){return db[_0x5642('0x30')][_0x5642('0x4a')]({'where':{'id':_0x18cd05[_0x5642('0x47')]['id']}})[_0x5642('0x28')](handleEntityNotFound(_0x145d19,null))[_0x5642('0x28')](function(_0x133510){if(_0x133510){return _0x133510['addUsers'](_0x18cd05['body'][_0x5642('0x54')],_[_0x5642('0x55')](_0x18cd05[_0x5642('0x4c')],['ids','id'])||{});}})['then'](respondWithResult(_0x145d19,null))['catch'](handleError(_0x145d19,null));};exports['removeUsers']=function(_0x324d4b,_0x1df568,_0x420508){return db['SquareProject']['find']({'where':{'id':_0x324d4b['params']['id']}})[_0x5642('0x28')](handleEntityNotFound(_0x1df568,null))[_0x5642('0x28')](function(_0x2bc967){if(_0x2bc967){return _0x2bc967['removeUsers'](_0x324d4b['query'][_0x5642('0x54')])[_0x5642('0x28')](function(){if(_[_0x5642('0x56')](_0x324d4b[_0x5642('0x36')]['ids'])){for(var _0xa208dc=0x0;_0xa208dc<_0x324d4b[_0x5642('0x36')][_0x5642('0x54')][_0x5642('0x49')];_0xa208dc+=0x1){socket[_0x5642('0x57')](_0x5642('0x58'),{'UserId':Number(_0x324d4b[_0x5642('0x36')][_0x5642('0x54')][_0xa208dc]),'SquareProjectId':Number(_0x324d4b[_0x5642('0x47')]['id'])});}}else{socket[_0x5642('0x57')](_0x5642('0x58'),{'UserId':Number(_0x324d4b[_0x5642('0x36')]['ids']),'SquareProjectId':Number(_0x324d4b[_0x5642('0x47')]['id'])});}});}})[_0x5642('0x28')](respondWithStatusCode(_0x1df568,null))[_0x5642('0x46')](handleError(_0x1df568,null));};exports[_0x5642('0x59')]=function(_0x1ad4e3,_0x4f3d7e,_0x29dd31){var _0xe519b9={};var _0x30e9ca={};var _0x301ade;var _0x3fa9d9;return db['SquareProject']['findOne']({'where':{'id':_0x1ad4e3[_0x5642('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f3d7e,null))[_0x5642('0x28')](function(_0x3c84f3){if(_0x3c84f3){_0x301ade=_0x3c84f3;_0x30e9ca[_0x5642('0x35')]=_[_0x5642('0x48')](db[_0x5642('0x5a')][_0x5642('0x31')]);_0x30e9ca['query']=_[_0x5642('0x48')](_0x1ad4e3[_0x5642('0x36')]);_0x30e9ca[_0x5642('0x37')]=_[_0x5642('0x38')](_0x30e9ca[_0x5642('0x35')],_0x30e9ca[_0x5642('0x36')]);_0xe519b9[_0x5642('0x39')]=_[_0x5642('0x38')](_0x30e9ca[_0x5642('0x35')],qs[_0x5642('0x3a')](_0x1ad4e3[_0x5642('0x36')][_0x5642('0x3a')]));_0xe519b9[_0x5642('0x39')]=_0xe519b9[_0x5642('0x39')][_0x5642('0x49')]?_0xe519b9['attributes']:_0x30e9ca[_0x5642('0x35')];_0xe519b9[_0x5642('0x3b')]=qs[_0x5642('0x3c')](_0x1ad4e3[_0x5642('0x36')][_0x5642('0x3c')]);_0xe519b9[_0x5642('0x3e')]=qs[_0x5642('0x37')](_[_0x5642('0x3d')](_0x1ad4e3['query'],_0x30e9ca['filters']));if(_0x1ad4e3[_0x5642('0x36')][_0x5642('0x40')]){_0xe519b9['where']=_['merge'](_0xe519b9[_0x5642('0x3e')],{'$or':_[_0x5642('0x2f')](_0xe519b9['attributes'],function(_0x6dc32d){var _0x5416bc={};_0x5416bc[_0x6dc32d]={'$like':'%'+_0x1ad4e3['query'][_0x5642('0x40')]+'%'};return _0x5416bc;})});}_0xe519b9=_[_0x5642('0x3f')]({},_0xe519b9,_0x1ad4e3[_0x5642('0x41')]);return _0x301ade[_0x5642('0x59')](_0xe519b9);}})[_0x5642('0x28')](function(_0xccc414){if(_0xccc414){_0x3fa9d9=_0xccc414[_0x5642('0x49')];if(!_0x1ad4e3['query'][_0x5642('0x5b')](_0x5642('0x5c'))){_0xe519b9[_0x5642('0x23')]=qs[_0x5642('0x23')](_0x1ad4e3[_0x5642('0x36')][_0x5642('0x23')]);_0xe519b9[_0x5642('0x22')]=qs[_0x5642('0x22')](_0x1ad4e3['query']['offset']);}return _0x301ade[_0x5642('0x59')](_0xe519b9);}})['then'](function(_0x5f5cd6){if(_0x5f5cd6){return _0x5f5cd6?{'count':_0x3fa9d9,'rows':_0x5f5cd6}:null;}})[_0x5642('0x28')](respondWithResult(_0x4f3d7e,null))['catch'](handleError(_0x4f3d7e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 56b7593..94471be 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 _0x3568=['../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2704d5,_0x2b3bd8){var _0x1e4474=function(_0x27412b){while(--_0x27412b){_0x2704d5['push'](_0x2704d5['shift']());}};_0x1e4474(++_0x2b3bd8);}(_0x3568,0x1e0));var _0x8356=function(_0x5aa2c5,_0xdbc45){_0x5aa2c5=_0x5aa2c5-0x0;var _0x513bc8=_0x3568[_0x5aa2c5];return _0x513bc8;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x8356('0x0'))['db'][_0x8356('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x8356('0x2')](0x0);var events={'afterCreate':_0x8356('0x3'),'afterUpdate':_0x8356('0x4'),'afterDestroy':_0x8356('0x5')};function emitEvent(_0x57dd73){return function(_0xbc867,_0x20f85e,_0x36efcf){SquareProjectEvents[_0x8356('0x6')](_0x57dd73+':'+_0xbc867['id'],_0xbc867);SquareProjectEvents[_0x8356('0x6')](_0x57dd73,_0xbc867);_0x36efcf(null);};}for(var e in events){if(events[_0x8356('0x7')](e)){var event=events[e];SquareProject[_0x8356('0x8')](e,emitEvent(event));}}module[_0x8356('0x9')]=SquareProjectEvents; \ No newline at end of file +var _0xe25e=['remove','emit','hasOwnProperty','exports','../../mysqldb','SquareProject','setMaxListeners','update'];(function(_0x21af05,_0x2322c8){var _0x4c2721=function(_0x642048){while(--_0x642048){_0x21af05['push'](_0x21af05['shift']());}};_0x4c2721(++_0x2322c8);}(_0xe25e,0x10c));var _0xee25=function(_0x29a08d,_0x551eca){_0x29a08d=_0x29a08d-0x0;var _0x10fc1a=_0xe25e[_0x29a08d];return _0x10fc1a;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xee25('0x0'))['db'][_0xee25('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xee25('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xee25('0x3'),'afterDestroy':_0xee25('0x4')};function emitEvent(_0x546d44){return function(_0x59a7f3,_0xec4af4,_0x5aad78){SquareProjectEvents[_0xee25('0x5')](_0x546d44+':'+_0x59a7f3['id'],_0x59a7f3);SquareProjectEvents['emit'](_0x546d44,_0x59a7f3);_0x5aad78(null);};}for(var e in events){if(events[_0xee25('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xee25('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b2b5273..998d89b 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 _0xa8eb=['YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','SquareProject','square_projects','changed','preproduction','savedAt','format'];(function(_0x16c540,_0x315911){var _0x2cedfe=function(_0x28fd7c){while(--_0x28fd7c){_0x16c540['push'](_0x16c540['shift']());}};_0x2cedfe(++_0x315911);}(_0xa8eb,0x179));var _0xba8e=function(_0x5dde5b,_0x1c2e75){_0x5dde5b=_0x5dde5b-0x0;var _0x255434=_0xa8eb[_0x5dde5b];return _0x255434;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./squareProject.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b1bd6,_0x54a27a,_0x20e1f5){if(_0x4b1bd6[_0xba8e('0xa')](_0xba8e('0xb'))){_0x4b1bd6[_0xba8e('0xc')]=moment()[_0xba8e('0xd')](_0xba8e('0xe'));}if(_0x4b1bd6[_0xba8e('0xa')](_0xba8e('0xf'))){_0x4b1bd6[_0xba8e('0x10')]=moment()['format'](_0xba8e('0xe'));}_0x20e1f5(null,_0x4b1bd6);}}});}; \ No newline at end of file +var _0x63b6=['square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','define'];(function(_0x1f8675,_0x272ee8){var _0x2d384e=function(_0x4d9185){while(--_0x4d9185){_0x1f8675['push'](_0x1f8675['shift']());}};_0x2d384e(++_0x272ee8);}(_0x63b6,0x127));var _0x663b=function(_0x31374c,_0x3ffe47){_0x31374c=_0x31374c-0x0;var _0x2156cc=_0x63b6[_0x31374c];return _0x2156cc;};'use strict';var _=require(_0x663b('0x0'));var util=require(_0x663b('0x1'));var logger=require(_0x663b('0x2'))('api');var moment=require(_0x663b('0x3'));var BPromise=require('bluebird');var rp=require(_0x663b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x663b('0x5'));var config=require(_0x663b('0x6'));var attributes=require(_0x663b('0x7'));module['exports']=function(_0x4486b1,_0x57e43e){return _0x4486b1[_0x663b('0x8')]('SquareProject',attributes,{'tableName':_0x663b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2976ff,_0xf8f3ff,_0x3ed933){if(_0x2976ff[_0x663b('0xa')](_0x663b('0xb'))){_0x2976ff['savedAt']=moment()[_0x663b('0xc')](_0x663b('0xd'));}if(_0x2976ff[_0x663b('0xa')](_0x663b('0xe'))){_0x2976ff[_0x663b('0xf')]=moment()[_0x663b('0xc')](_0x663b('0xd'));}_0x3ed933(null,_0x2976ff);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index cf3c7d4..23f35e9 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 _0x4e34=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowSquareProject','SquareProject','find','options','where','include','map','attributes','model','lodash','bluebird'];(function(_0x19d66c,_0x42e86d){var _0x2d0faf=function(_0x134f57){while(--_0x134f57){_0x19d66c['push'](_0x19d66c['shift']());}};_0x2d0faf(++_0x42e86d);}(_0x4e34,0x8e));var _0x44e3=function(_0x5329c3,_0x419bcf){_0x5329c3=_0x5329c3-0x0;var _0x2689c4=_0x4e34[_0x5329c3];return _0x2689c4;};'use strict';var _=require(_0x44e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x44e3('0x1'));var rs=require(_0x44e3('0x2'));var fs=require('fs');var Redis=require(_0x44e3('0x3'));var db=require(_0x44e3('0x4'))['db'];var utils=require(_0x44e3('0x5'));var logger=require(_0x44e3('0x6'))('rpc');var config=require(_0x44e3('0x7'));var jayson=require(_0x44e3('0x8'));var client=jayson[_0x44e3('0x9')][_0x44e3('0xa')]({'port':0x232a});config[_0x44e3('0xb')]=_[_0x44e3('0xc')](config[_0x44e3('0xb')],{'host':_0x44e3('0xd'),'port':0x18eb});var socket=require(_0x44e3('0xe'))(new Redis(config[_0x44e3('0xb')]));require(_0x44e3('0xf'))[_0x44e3('0x10')](socket);function respondWithRpcPromise(_0x2e1826,_0x4321ff,_0x2773cd){return new BPromise(function(_0x1c14e9,_0x3b8e80){return client['request'](_0x2e1826,_0x2773cd)[_0x44e3('0x11')](function(_0x1fe12e){logger[_0x44e3('0x12')](_0x44e3('0x13'),_0x4321ff,_0x44e3('0x14'));logger[_0x44e3('0x15')](_0x44e3('0x16'),_0x4321ff,_0x44e3('0x14'),JSON['stringify'](_0x1fe12e));if(_0x1fe12e[_0x44e3('0x17')]){if(_0x1fe12e[_0x44e3('0x17')][_0x44e3('0x18')]===0x1f4){logger[_0x44e3('0x17')]('SquareProject,\x20%s,\x20%s',_0x4321ff,_0x1fe12e[_0x44e3('0x17')][_0x44e3('0x19')]);return _0x3b8e80(_0x1fe12e[_0x44e3('0x17')][_0x44e3('0x19')]);}logger[_0x44e3('0x17')](_0x44e3('0x13'),_0x4321ff,_0x1fe12e[_0x44e3('0x17')][_0x44e3('0x19')]);return _0x1c14e9(_0x1fe12e[_0x44e3('0x17')][_0x44e3('0x19')]);}else{logger[_0x44e3('0x12')]('SquareProject,\x20%s,\x20%s',_0x4321ff,_0x44e3('0x14'));_0x1c14e9(_0x1fe12e[_0x44e3('0x1a')][_0x44e3('0x19')]);}})['catch'](function(_0x3dfb36){logger[_0x44e3('0x17')]('SquareProject,\x20%s,\x20%s',_0x4321ff,_0x3dfb36);_0x3b8e80(_0x3dfb36);});});}exports[_0x44e3('0x1b')]=function(_0x525f8c){var _0x6b3166=this;return new Promise(function(_0x11c14e,_0x2c7f0c){return db[_0x44e3('0x1c')][_0x44e3('0x1d')]({'raw':_0x525f8c[_0x44e3('0x1e')]?_0x525f8c[_0x44e3('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x525f8c[_0x44e3('0x1e')]?_0x525f8c[_0x44e3('0x1e')][_0x44e3('0x1f')]||null:null,'attributes':_0x525f8c[_0x44e3('0x1e')]?_0x525f8c[_0x44e3('0x1e')]['attributes']||null:null,'include':_0x525f8c[_0x44e3('0x1e')]?_0x525f8c['options'][_0x44e3('0x20')]?_[_0x44e3('0x21')](_0x525f8c['options']['include'],function(_0x27d8b9){return{'model':db[_0x27d8b9['model']],'as':_0x27d8b9['as'],'attributes':_0x27d8b9[_0x44e3('0x22')],'include':_0x27d8b9[_0x44e3('0x20')]?_[_0x44e3('0x21')](_0x27d8b9[_0x44e3('0x20')],function(_0x237341){return{'model':db[_0x237341[_0x44e3('0x23')]],'as':_0x237341['as'],'attributes':_0x237341[_0x44e3('0x22')],'include':_0x237341[_0x44e3('0x20')]?_[_0x44e3('0x21')](_0x237341[_0x44e3('0x20')],function(_0x17eb98){return{'model':db[_0x17eb98[_0x44e3('0x23')]],'as':_0x17eb98['as'],'attributes':_0x17eb98['attributes']};}):[]};}):[]};}):[]:[]})[_0x44e3('0x11')](function(_0x4cfee6){logger[_0x44e3('0x12')](_0x44e3('0x1b'),_0x525f8c);logger[_0x44e3('0x15')](_0x44e3('0x1b'),_0x525f8c,JSON['stringify'](_0x4cfee6));_0x11c14e(_0x4cfee6);})['catch'](function(_0x592de2){logger['error']('ShowSquareProject',_0x592de2[_0x44e3('0x19')],_0x525f8c);_0x2c7f0c(_0x6b3166[_0x44e3('0x17')](0x1f4,_0x592de2['message']));});});}; \ No newline at end of file +var _0x3154=['include','map','model','ShowSquareProject','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','options','where','attributes'];(function(_0x3e4597,_0x17e3a5){var _0xef6f3f=function(_0x3d3d44){while(--_0x3d3d44){_0x3e4597['push'](_0x3e4597['shift']());}};_0xef6f3f(++_0x17e3a5);}(_0x3154,0x98));var _0x4315=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x3154[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x4315('0x0'));var util=require('util');var moment=require(_0x4315('0x1'));var BPromise=require(_0x4315('0x2'));var rs=require(_0x4315('0x3'));var fs=require('fs');var Redis=require(_0x4315('0x4'));var db=require(_0x4315('0x5'))['db'];var utils=require(_0x4315('0x6'));var logger=require(_0x4315('0x7'))(_0x4315('0x8'));var config=require(_0x4315('0x9'));var jayson=require(_0x4315('0xa'));var client=jayson[_0x4315('0xb')]['http']({'port':0x232a});config[_0x4315('0xc')]=_[_0x4315('0xd')](config[_0x4315('0xc')],{'host':_0x4315('0xe'),'port':0x18eb});var socket=require(_0x4315('0xf'))(new Redis(config['redis']));require(_0x4315('0x10'))[_0x4315('0x11')](socket);function respondWithRpcPromise(_0x56ecde,_0x306a8b,_0x5249af){return new BPromise(function(_0x2e90de,_0x5859b8){return client[_0x4315('0x12')](_0x56ecde,_0x5249af)[_0x4315('0x13')](function(_0xd9b127){logger['info'](_0x4315('0x14'),_0x306a8b,_0x4315('0x15'));logger[_0x4315('0x16')](_0x4315('0x17'),_0x306a8b,_0x4315('0x15'),JSON[_0x4315('0x18')](_0xd9b127));if(_0xd9b127[_0x4315('0x19')]){if(_0xd9b127['error']['code']===0x1f4){logger[_0x4315('0x19')]('SquareProject,\x20%s,\x20%s',_0x306a8b,_0xd9b127[_0x4315('0x19')][_0x4315('0x1a')]);return _0x5859b8(_0xd9b127[_0x4315('0x19')][_0x4315('0x1a')]);}logger[_0x4315('0x19')]('SquareProject,\x20%s,\x20%s',_0x306a8b,_0xd9b127[_0x4315('0x19')][_0x4315('0x1a')]);return _0x2e90de(_0xd9b127[_0x4315('0x19')][_0x4315('0x1a')]);}else{logger[_0x4315('0x1b')](_0x4315('0x14'),_0x306a8b,'request\x20sent');_0x2e90de(_0xd9b127[_0x4315('0x1c')][_0x4315('0x1a')]);}})[_0x4315('0x1d')](function(_0x5a64bc){logger['error']('SquareProject,\x20%s,\x20%s',_0x306a8b,_0x5a64bc);_0x5859b8(_0x5a64bc);});});}exports['ShowSquareProject']=function(_0xb0f4f3){var _0x342752=this;return new Promise(function(_0x25f2f4,_0x575dd0){return db['SquareProject']['find']({'raw':_0xb0f4f3[_0x4315('0x1e')]?_0xb0f4f3['options']['raw']===undefined?!![]:![]:!![],'where':_0xb0f4f3[_0x4315('0x1e')]?_0xb0f4f3[_0x4315('0x1e')][_0x4315('0x1f')]||null:null,'attributes':_0xb0f4f3[_0x4315('0x1e')]?_0xb0f4f3['options'][_0x4315('0x20')]||null:null,'include':_0xb0f4f3['options']?_0xb0f4f3[_0x4315('0x1e')][_0x4315('0x21')]?_[_0x4315('0x22')](_0xb0f4f3[_0x4315('0x1e')][_0x4315('0x21')],function(_0x3a6cd6){return{'model':db[_0x3a6cd6['model']],'as':_0x3a6cd6['as'],'attributes':_0x3a6cd6[_0x4315('0x20')],'include':_0x3a6cd6[_0x4315('0x21')]?_[_0x4315('0x22')](_0x3a6cd6[_0x4315('0x21')],function(_0x457f43){return{'model':db[_0x457f43[_0x4315('0x23')]],'as':_0x457f43['as'],'attributes':_0x457f43[_0x4315('0x20')],'include':_0x457f43['include']?_['map'](_0x457f43[_0x4315('0x21')],function(_0x482f9b){return{'model':db[_0x482f9b['model']],'as':_0x482f9b['as'],'attributes':_0x482f9b[_0x4315('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4315('0x13')](function(_0x5a8c8f){logger[_0x4315('0x1b')]('ShowSquareProject',_0xb0f4f3);logger[_0x4315('0x16')]('ShowSquareProject',_0xb0f4f3,JSON[_0x4315('0x18')](_0x5a8c8f));_0x25f2f4(_0x5a8c8f);})[_0x4315('0x1d')](function(_0x1befaf){logger[_0x4315('0x19')](_0x4315('0x24'),_0x1befaf[_0x4315('0x1a')],_0xb0f4f3);_0x575dd0(_0x342752[_0x4315('0x19')](0x1f4,_0x1befaf[_0x4315('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 9da809a..d3df537 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 _0x430c=['register','length','squareProject:','./squareProject.events','update','removeListener'];(function(_0x4d817d,_0x548e91){var _0x1ad119=function(_0x3fff02){while(--_0x3fff02){_0x4d817d['push'](_0x4d817d['shift']());}};_0x1ad119(++_0x548e91);}(_0x430c,0x1a1));var _0xc430=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x430c[_0x29ae80];return _0x5d6d71;};'use strict';var SquareProjectEvents=require(_0xc430('0x0'));var events=['save','remove',_0xc430('0x1')];function createListener(_0xe2d084,_0x1d5b5e){return function(_0x503988){_0x1d5b5e['emit'](_0xe2d084,_0x503988);};}function removeListener(_0x5ccda6,_0x47d8b9){return function(){SquareProjectEvents[_0xc430('0x2')](_0x5ccda6,_0x47d8b9);};}exports[_0xc430('0x3')]=function(_0x50b256){for(var _0x42aa9c=0x0,_0x4de44f=events[_0xc430('0x4')];_0x42aa9c<_0x4de44f;_0x42aa9c++){var _0x2e51c6=events[_0x42aa9c];var _0x814a90=createListener(_0xc430('0x5')+_0x2e51c6,_0x50b256);SquareProjectEvents['on'](_0x2e51c6,_0x814a90);}}; \ No newline at end of file +var _0xadb5=['update','emit','register','length','squareProject:','save'];(function(_0x2b6ad3,_0x1a3fb3){var _0x5730b3=function(_0x32c132){while(--_0x32c132){_0x2b6ad3['push'](_0x2b6ad3['shift']());}};_0x5730b3(++_0x1a3fb3);}(_0xadb5,0xad));var _0x5adb=function(_0x3f8bd8,_0x1e02e9){_0x3f8bd8=_0x3f8bd8-0x0;var _0x424270=_0xadb5[_0x3f8bd8];return _0x424270;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){SquareProjectEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);SquareProjectEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 9713f95..cd3f049 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 _0xcb30=['post','create','put','update','delete','/:id/delete','destroy','multer','util','path','connect-timeout','express','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x388bfa,_0x1f518c){var _0x11d6a6=function(_0x40b0b3){while(--_0x40b0b3){_0x388bfa['push'](_0x388bfa['shift']());}};_0x11d6a6(++_0x1f518c);}(_0xcb30,0x181));var _0x0cb3=function(_0x4ba105,_0xf97073){_0x4ba105=_0x4ba105-0x0;var _0x5eee7b=_0xcb30[_0x4ba105];return _0x5eee7b;};'use strict';var multer=require(_0x0cb3('0x0'));var util=require(_0x0cb3('0x1'));var path=require(_0x0cb3('0x2'));var timeout=require(_0x0cb3('0x3'));var express=require(_0x0cb3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0cb3('0x5'));var controller=require(_0x0cb3('0x6'));router[_0x0cb3('0x7')]('/',auth[_0x0cb3('0x8')](),controller[_0x0cb3('0x9')]);router[_0x0cb3('0x7')](_0x0cb3('0xa'),auth[_0x0cb3('0x8')](),controller[_0x0cb3('0xb')]);router[_0x0cb3('0x7')](_0x0cb3('0xc'),auth[_0x0cb3('0x8')](),controller[_0x0cb3('0xd')]);router[_0x0cb3('0xe')]('/',auth['isAuthenticated'](),controller[_0x0cb3('0xf')]);router[_0x0cb3('0x10')](_0x0cb3('0xa'),auth['isAuthenticated'](),controller[_0x0cb3('0x11')]);router[_0x0cb3('0x12')](_0x0cb3('0x13'),auth[_0x0cb3('0x8')](),controller[_0x0cb3('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7c51=['destroy','exports','multer','path','express','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','/:id','show','put','/:id/delete'];(function(_0x3cbf19,_0x2f22da){var _0x551c6e=function(_0x4c9d3a){while(--_0x4c9d3a){_0x3cbf19['push'](_0x3cbf19['shift']());}};_0x551c6e(++_0x2f22da);}(_0x7c51,0x188));var _0x17c5=function(_0x51722f,_0x5abc41){_0x51722f=_0x51722f-0x0;var _0xf26218=_0x7c51[_0x51722f];return _0xf26218;};'use strict';var multer=require(_0x17c5('0x0'));var util=require('util');var path=require(_0x17c5('0x1'));var timeout=require('connect-timeout');var express=require(_0x17c5('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x17c5('0x3'));var config=require('../../config/environment');var controller=require(_0x17c5('0x4'));router[_0x17c5('0x5')]('/',auth[_0x17c5('0x6')](),controller['index']);router[_0x17c5('0x5')](_0x17c5('0x7'),auth[_0x17c5('0x6')](),controller[_0x17c5('0x8')]);router[_0x17c5('0x5')]('/:id/download',auth[_0x17c5('0x6')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x17c5('0x9')]('/:id',auth[_0x17c5('0x6')](),controller['update']);router['delete'](_0x17c5('0xa'),auth[_0x17c5('0x6')](),controller[_0x17c5('0xb')]);module[_0x17c5('0xc')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 37d5118..94148d5 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 _0x39bd=['VIRTUAL','getDataValue','savePath','substring','sequelize','STRING'];(function(_0x31de20,_0x3f869c){var _0x559047=function(_0x4f60d8){while(--_0x4f60d8){_0x31de20['push'](_0x31de20['shift']());}};_0x559047(++_0x3f869c);}(_0x39bd,0x7c));var _0xd39b=function(_0x53fcbf,_0x15c2c9){_0x53fcbf=_0x53fcbf-0x0;var _0x130d11=_0x39bd[_0x53fcbf];return _0x130d11;};'use strict';var Sequelize=require(_0xd39b('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd39b('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd39b('0x1')]},'extension':{'type':Sequelize[_0xd39b('0x1')]},'priority':{'type':Sequelize[_0xd39b('0x1')]},'accountcode':{'type':Sequelize[_0xd39b('0x1')]},'dnid':{'type':Sequelize[_0xd39b('0x1')]},'projectName':{'type':Sequelize[_0xd39b('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xd39b('0x1')]},'format':{'type':Sequelize[_0xd39b('0x2')],'get':function(){var _0x17dfc0='';var _0xe66dca=this[_0xd39b('0x3')](_0xd39b('0x4'));if(_0xe66dca){_0x17dfc0=_0xe66dca[_0xd39b('0x5')](_0xe66dca['lastIndexOf']('.'));}return _0x17dfc0;}}}; \ No newline at end of file +var _0x5919=['sequelize','STRING','getDataValue','savePath','substring','lastIndexOf'];(function(_0xdf14a5,_0x4ecb69){var _0x335b1b=function(_0x3ce418){while(--_0x3ce418){_0xdf14a5['push'](_0xdf14a5['shift']());}};_0x335b1b(++_0x4ecb69);}(_0x5919,0x198));var _0x9591=function(_0x461f3b,_0x2de1e3){_0x461f3b=_0x461f3b-0x0;var _0x51106b=_0x5919[_0x461f3b];return _0x51106b;};'use strict';var Sequelize=require(_0x9591('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9591('0x1')]},'callerid':{'type':Sequelize[_0x9591('0x1')]},'calleridname':{'type':Sequelize[_0x9591('0x1')]},'context':{'type':Sequelize[_0x9591('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9591('0x1')]},'accountcode':{'type':Sequelize[_0x9591('0x1')]},'dnid':{'type':Sequelize[_0x9591('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x9591('0x1')]},'filename':{'type':Sequelize[_0x9591('0x1')]},'savePath':{'type':Sequelize[_0x9591('0x1')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3239e2='';var _0x360d03=this[_0x9591('0x2')](_0x9591('0x3'));if(_0x360d03){_0x3239e2=_0x360d03[_0x9591('0x4')](_0x360d03[_0x9591('0x5')]('.'));}return _0x3239e2;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index aeced0f..98942b5 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 _0x0664=['fieldName','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','filters','include','create','body','find','download','../../components/encryptor','uniqueid','filename','format','secrets','recording','savePath','existsSync','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','SquareRecording','rawAttributes'];(function(_0x5e2528,_0x3e27ed){var _0x30c05e=function(_0x4c519c){while(--_0x4c519c){_0x5e2528['push'](_0x5e2528['shift']());}};_0x30c05e(++_0x3e27ed);}(_0x0664,0x93));var _0x4066=function(_0x34fc4d,_0x490729){_0x34fc4d=_0x34fc4d-0x0;var _0x24b8f4=_0x0664[_0x34fc4d];return _0x24b8f4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4066('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4066('0x1'));var jsonpatch=require(_0x4066('0x2'));var rp=require('request-promise');var moment=require(_0x4066('0x3'));var BPromise=require(_0x4066('0x4'));var Mustache=require(_0x4066('0x5'));var util=require(_0x4066('0x6'));var path=require(_0x4066('0x7'));var sox=require(_0x4066('0x8'));var csv=require(_0x4066('0x9'));var ejs=require(_0x4066('0xa'));var fs=require('fs');var _=require(_0x4066('0xb'));var squel=require(_0x4066('0xc'));var crypto=require('crypto');var jsforce=require(_0x4066('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4066('0x9'));var querystring=require(_0x4066('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4066('0xf'));var qs=require(_0x4066('0x10'));var as=require(_0x4066('0x11'));var hardwareService=require(_0x4066('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4066('0x13'));var db=require(_0x4066('0x14'))['db'];function respondWithStatusCode(_0x10c353,_0x12d36c){_0x12d36c=_0x12d36c||0xcc;return function(_0x425456){if(_0x425456){return _0x10c353[_0x4066('0x15')](_0x12d36c);}return _0x10c353[_0x4066('0x16')](_0x12d36c)[_0x4066('0x17')]();};}function respondWithResult(_0x5b4f38,_0x42a09c){_0x42a09c=_0x42a09c||0xc8;return function(_0x152404){if(_0x152404){return _0x5b4f38['status'](_0x42a09c)[_0x4066('0x18')](_0x152404);}};}function respondWithFilteredResult(_0x5095d6,_0x252e1c){return function(_0x5f37ea){if(_0x5f37ea){var _0x50f71d=_0x5f37ea[_0x4066('0x19')],_0x430ae4=_0x252e1c[_0x4066('0x1a')],_0x1a2f4a=_0x252e1c[_0x4066('0x1a')]+_0x252e1c[_0x4066('0x1b')],_0x309ffc;if(_0x1a2f4a>=_0x50f71d){_0x1a2f4a=_0x50f71d;_0x309ffc=0xc8;}else{_0x309ffc=0xce;}_0x5095d6[_0x4066('0x16')](_0x309ffc);return _0x5095d6[_0x4066('0x1c')](_0x4066('0x1d'),_0x430ae4+'-'+_0x1a2f4a+'/'+_0x50f71d)['json'](_0x5f37ea);}return null;};}function patchUpdates(_0x4c83ac){return function(_0x2e85ee){try{jsonpatch[_0x4066('0x1e')](_0x2e85ee,_0x4c83ac,!![]);}catch(_0x5b02a4){return BPromise[_0x4066('0x1f')](_0x5b02a4);}return _0x2e85ee[_0x4066('0x20')]();};}function saveUpdates(_0x382950,_0x35ae6b){return function(_0x361f1d){if(_0x361f1d){return _0x361f1d[_0x4066('0x21')](_0x382950)['then'](function(_0x550dcf){return _0x550dcf;});}return null;};}function removeEntity(_0x541306,_0x549504){return function(_0x3b2b7f){if(_0x3b2b7f){return _0x3b2b7f[_0x4066('0x22')]()[_0x4066('0x23')](function(){_0x541306[_0x4066('0x16')](0xcc)[_0x4066('0x17')]();});}};}function handleEntityNotFound(_0x5afa04,_0x21a1f7){return function(_0x1433a9){if(!_0x1433a9){_0x5afa04[_0x4066('0x15')](0x194);}return _0x1433a9;};}function handleError(_0x2598c6,_0x3fa05a){_0x3fa05a=_0x3fa05a||0x1f4;return function(_0x59abe2){logger['error'](_0x59abe2[_0x4066('0x24')]);if(_0x59abe2[_0x4066('0x25')]){delete _0x59abe2[_0x4066('0x25')];}_0x2598c6[_0x4066('0x16')](_0x3fa05a)[_0x4066('0x26')](_0x59abe2);};}exports[_0x4066('0x27')]=function(_0x1f9e34,_0x225298){var _0x36fcd8={},_0x1f6368={},_0x383aa5={'count':0x0,'rows':[]};var _0x2e4674=_[_0x4066('0x28')](db[_0x4066('0x29')][_0x4066('0x2a')],function(_0x496c35){return{'name':_0x496c35[_0x4066('0x2b')],'type':_0x496c35['type']['key']};});_0x1f6368['model']=_[_0x4066('0x28')](_0x2e4674,'name');_0x1f6368[_0x4066('0x2c')]=_[_0x4066('0x2d')](_0x1f9e34[_0x4066('0x2c')]);_0x1f6368['filters']=_[_0x4066('0x2e')](_0x1f6368['model'],_0x1f6368[_0x4066('0x2c')]);_0x36fcd8[_0x4066('0x2f')]=_['intersection'](_0x1f6368['model'],qs[_0x4066('0x30')](_0x1f9e34[_0x4066('0x2c')]['fields']));_0x36fcd8[_0x4066('0x2f')]=_0x36fcd8[_0x4066('0x2f')][_0x4066('0x31')]?_0x36fcd8['attributes']:_0x1f6368[_0x4066('0x32')];if(!_0x1f9e34['query'][_0x4066('0x33')](_0x4066('0x34'))){_0x36fcd8[_0x4066('0x1b')]=qs[_0x4066('0x1b')](_0x1f9e34[_0x4066('0x2c')][_0x4066('0x1b')]);_0x36fcd8[_0x4066('0x1a')]=qs[_0x4066('0x1a')](_0x1f9e34[_0x4066('0x2c')][_0x4066('0x1a')]);}_0x36fcd8[_0x4066('0x35')]=qs[_0x4066('0x36')](_0x1f9e34['query'][_0x4066('0x36')]);_0x36fcd8[_0x4066('0x37')]=qs['filters'](_[_0x4066('0x38')](_0x1f9e34[_0x4066('0x2c')],_0x1f6368['filters']),_0x2e4674);if(_0x1f9e34[_0x4066('0x2c')][_0x4066('0x39')]){_0x36fcd8[_0x4066('0x37')]=_[_0x4066('0x3a')](_0x36fcd8[_0x4066('0x37')],{'$or':_[_0x4066('0x28')](_0x2e4674,function(_0x83e8d7){if(_0x83e8d7[_0x4066('0x3b')]!==_0x4066('0x3c')){var _0x598bd5={};_0x598bd5[_0x83e8d7[_0x4066('0x25')]]={'$like':'%'+_0x1f9e34[_0x4066('0x2c')]['filter']+'%'};return _0x598bd5;}})});}_0x36fcd8=_[_0x4066('0x3a')]({},_0x36fcd8,_0x1f9e34[_0x4066('0x3d')]);var _0x35017a={'where':_0x36fcd8['where']};return db[_0x4066('0x29')][_0x4066('0x19')](_0x35017a)[_0x4066('0x23')](function(_0x44650a){_0x383aa5[_0x4066('0x19')]=_0x44650a;if(_0x1f9e34[_0x4066('0x2c')][_0x4066('0x3e')]){_0x36fcd8['include']=[{'all':!![]}];}return db[_0x4066('0x29')][_0x4066('0x3f')](_0x36fcd8);})[_0x4066('0x23')](function(_0x3496e7){_0x383aa5[_0x4066('0x40')]=_0x3496e7;return _0x383aa5;})['then'](respondWithFilteredResult(_0x225298,_0x36fcd8))[_0x4066('0x41')](handleError(_0x225298,null));};exports[_0x4066('0x42')]=function(_0x54d4d7,_0x1f0c82){var _0x285568={'raw':!![],'where':{'id':_0x54d4d7[_0x4066('0x43')]['id']}},_0x16af12={};_0x16af12[_0x4066('0x32')]=_['keys'](db[_0x4066('0x29')][_0x4066('0x2a')]);_0x16af12['query']=_[_0x4066('0x2d')](_0x54d4d7[_0x4066('0x2c')]);_0x16af12[_0x4066('0x44')]=_[_0x4066('0x2e')](_0x16af12[_0x4066('0x32')],_0x16af12[_0x4066('0x2c')]);_0x285568[_0x4066('0x2f')]=_['intersection'](_0x16af12[_0x4066('0x32')],qs[_0x4066('0x30')](_0x54d4d7[_0x4066('0x2c')][_0x4066('0x30')]));_0x285568[_0x4066('0x2f')]=_0x285568[_0x4066('0x2f')]['length']?_0x285568[_0x4066('0x2f')]:_0x16af12['model'];if(_0x54d4d7[_0x4066('0x2c')]['includeAll']){_0x285568[_0x4066('0x45')]=[{'all':!![]}];}_0x285568=_[_0x4066('0x3a')]({},_0x285568,_0x54d4d7[_0x4066('0x3d')]);return db[_0x4066('0x29')]['find'](_0x285568)[_0x4066('0x23')](handleEntityNotFound(_0x1f0c82,null))[_0x4066('0x23')](respondWithResult(_0x1f0c82,null))['catch'](handleError(_0x1f0c82,null));};exports[_0x4066('0x46')]=function(_0x5f5d66,_0x47f8b0){return db['SquareRecording'][_0x4066('0x46')](_0x5f5d66[_0x4066('0x47')],{})[_0x4066('0x23')](respondWithResult(_0x47f8b0,0xc9))[_0x4066('0x41')](handleError(_0x47f8b0,null));};exports[_0x4066('0x21')]=function(_0x5010d0,_0x88bfae){if(_0x5010d0[_0x4066('0x47')]['id']){delete _0x5010d0[_0x4066('0x47')]['id'];}return db[_0x4066('0x29')][_0x4066('0x48')]({'where':{'id':_0x5010d0['params']['id']}})[_0x4066('0x23')](handleEntityNotFound(_0x88bfae,null))[_0x4066('0x23')](saveUpdates(_0x5010d0[_0x4066('0x47')],null))[_0x4066('0x23')](respondWithResult(_0x88bfae,null))[_0x4066('0x41')](handleError(_0x88bfae,null));};exports[_0x4066('0x49')]=function(_0x3ec1a3,_0x4dfadf,_0x3dbb18){var _0x5c7a6d=require(_0x4066('0x4a'));var _0x402452=![];var _0x3bfea2={};if(_0x3ec1a3['query'][_0x4066('0x3b')]&&_0x3ec1a3[_0x4066('0x2c')]['type']===_0x4066('0x4b')){_0x3bfea2[_0x4066('0x4b')]=_0x3ec1a3[_0x4066('0x43')]['id'];}else{_0x3bfea2['id']=_0x3ec1a3[_0x4066('0x43')]['id'];}return db[_0x4066('0x29')][_0x4066('0x48')]({'where':_0x3bfea2,'attributes':['id','savePath',_0x4066('0x4c')],'raw':!![]})[_0x4066('0x23')](handleEntityNotFound(_0x4dfadf,null))[_0x4066('0x23')](function(_0x5cbd2b){if(_0x5cbd2b){var _0xe0f43c=_0x5cbd2b['savePath'];var _0x1a5e95=util[_0x4066('0x4d')]('%s.cypher',_0xe0f43c);if(fs['existsSync'](_0x1a5e95)){_0x402452=!![];return _0x5c7a6d['decryptFile'](_0x1a5e95,_0xe0f43c,config[_0x4066('0x4e')][_0x4066('0x4f')])[_0x4066('0x23')](function(){return _0x5cbd2b;});}return _0x5cbd2b;}})[_0x4066('0x23')](function(_0x4e677c){if(_0x4e677c){var _0x54562d=_0x4e677c[_0x4066('0x50')];if(!fs[_0x4066('0x51')](_0x54562d)){throw new db['Sequelize']['ValidationError'](_0x4066('0x52'));}if(_0x4e677c['filename']){return _0x4dfadf[_0x4066('0x49')](_0x54562d,_0x4e677c['filename']+path[_0x4066('0x53')](_0x54562d),function(){if(_0x402452){fs[_0x4066('0x54')](_0x54562d);}});}else{return _0x4dfadf[_0x4066('0x49')](_0x54562d,function(_0x1af91f){if(_0x402452){fs[_0x4066('0x54')](_0x54562d);}});}}})[_0x4066('0x41')](function(_0x553b8e){if(_0x553b8e[_0x4066('0x55')]===_0x4066('0x52')){_0x4dfadf[_0x4066('0x16')](0x194)[_0x4066('0x26')](_0x4066('0x56'));}else{return handleError(_0x4dfadf,null);}});};exports['destroy']=function(_0x5c9eff,_0x3256ca){return db[_0x4066('0x29')][_0x4066('0x48')]({'where':{'id':_0x5c9eff['params']['id']}})[_0x4066('0x23')](function(_0x539981){if(!_0x539981)throw new ReferenceError(_0x4066('0x57'));return _0x539981;})[_0x4066('0x23')](function(_0x52b69f){var _0x2789a2=_0x52b69f['savePath'];logger[_0x4066('0x58')](_0x4066('0x59'),_0x2789a2);if(!_['isNil'](_0x52b69f['savePath'])&&fs[_0x4066('0x51')](_0x2789a2)){logger[_0x4066('0x58')](_0x4066('0x5a')+_0x2789a2+_0x4066('0x5b'));fs[_0x4066('0x5c')](_0x2789a2);}_0x2789a2=_0x2789a2+_0x4066('0x5d');if(!_[_0x4066('0x5e')](_0x52b69f[_0x4066('0x50')])&&fs[_0x4066('0x51')](_0x2789a2)){logger[_0x4066('0x58')](_0x4066('0x5a')+_0x2789a2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4066('0x5c')](_0x2789a2);}return _0x52b69f;})['then'](function(_0x57aab9){if(!_0x57aab9)throw new InternalError();return _0x57aab9[_0x4066('0x22')]();})[_0x4066('0x23')](function(){_0x3256ca[_0x4066('0x16')](0xcc)[_0x4066('0x17')]();})[_0x4066('0x41')](handleError(_0x3256ca,null));}; \ No newline at end of file +var _0x21d4=['find','uniqueid','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','savePath','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','set','apply','reject','save','update','then','destroy','status','stack','name','send','index','SquareRecording','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body'];(function(_0x2d1393,_0x3ad9b8){var _0x2cc506=function(_0xaa3e90){while(--_0xaa3e90){_0x2d1393['push'](_0x2d1393['shift']());}};_0x2cc506(++_0x3ad9b8);}(_0x21d4,0xd5));var _0x421d=function(_0x21ec45,_0x287595){_0x21ec45=_0x21ec45-0x0;var _0x41d798=_0x21d4[_0x21ec45];return _0x41d798;};'use strict';var pdf=require(_0x421d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x421d('0x1'));var zipdir=require(_0x421d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x421d('0x3'));var BPromise=require(_0x421d('0x4'));var Mustache=require(_0x421d('0x5'));var util=require(_0x421d('0x6'));var path=require(_0x421d('0x7'));var sox=require(_0x421d('0x8'));var csv=require(_0x421d('0x9'));var ejs=require(_0x421d('0xa'));var fs=require('fs');var _=require(_0x421d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x421d('0xc'));var deskjs=require(_0x421d('0xd'));var toCsv=require(_0x421d('0x9'));var querystring=require(_0x421d('0xe'));var Papa=require('papaparse');var Redis=require(_0x421d('0xf'));var authService=require(_0x421d('0x10'));var qs=require(_0x421d('0x11'));var as=require(_0x421d('0x12'));var hardwareService=require(_0x421d('0x13'));var logger=require(_0x421d('0x14'))(_0x421d('0x15'));var utils=require('../../config/utils');var config=require(_0x421d('0x16'));var licenseUtil=require(_0x421d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x161f65,_0xeea2d6){_0xeea2d6=_0xeea2d6||0xcc;return function(_0x2ae87e){if(_0x2ae87e){return _0x161f65[_0x421d('0x18')](_0xeea2d6);}return _0x161f65['status'](_0xeea2d6)[_0x421d('0x19')]();};}function respondWithResult(_0x539e34,_0x5cf0b3){_0x5cf0b3=_0x5cf0b3||0xc8;return function(_0x5e7ca5){if(_0x5e7ca5){return _0x539e34['status'](_0x5cf0b3)[_0x421d('0x1a')](_0x5e7ca5);}};}function respondWithFilteredResult(_0x1e560d,_0x287777){return function(_0x1e713a){if(_0x1e713a){var _0xd97007=_0x1e713a['count'],_0x4cb0f0=_0x287777[_0x421d('0x1b')],_0xa186b2=_0x287777[_0x421d('0x1b')]+_0x287777[_0x421d('0x1c')],_0x2b99f9;if(_0xa186b2>=_0xd97007){_0xa186b2=_0xd97007;_0x2b99f9=0xc8;}else{_0x2b99f9=0xce;}_0x1e560d['status'](_0x2b99f9);return _0x1e560d[_0x421d('0x1d')]('Content-Range',_0x4cb0f0+'-'+_0xa186b2+'/'+_0xd97007)[_0x421d('0x1a')](_0x1e713a);}return null;};}function patchUpdates(_0x2adf1d){return function(_0xb9775e){try{jsonpatch[_0x421d('0x1e')](_0xb9775e,_0x2adf1d,!![]);}catch(_0x194cdc){return BPromise[_0x421d('0x1f')](_0x194cdc);}return _0xb9775e[_0x421d('0x20')]();};}function saveUpdates(_0x41adaa,_0xb03659){return function(_0x1f1ef2){if(_0x1f1ef2){return _0x1f1ef2[_0x421d('0x21')](_0x41adaa)[_0x421d('0x22')](function(_0x12a690){return _0x12a690;});}return null;};}function removeEntity(_0x169776,_0x27b484){return function(_0x4ccb3c){if(_0x4ccb3c){return _0x4ccb3c[_0x421d('0x23')]()[_0x421d('0x22')](function(){_0x169776[_0x421d('0x24')](0xcc)[_0x421d('0x19')]();});}};}function handleEntityNotFound(_0x3161c6,_0x4796c4){return function(_0x550b23){if(!_0x550b23){_0x3161c6[_0x421d('0x18')](0x194);}return _0x550b23;};}function handleError(_0x5cc7da,_0x428eba){_0x428eba=_0x428eba||0x1f4;return function(_0x1a76e7){logger['error'](_0x1a76e7[_0x421d('0x25')]);if(_0x1a76e7['name']){delete _0x1a76e7[_0x421d('0x26')];}_0x5cc7da[_0x421d('0x24')](_0x428eba)[_0x421d('0x27')](_0x1a76e7);};}exports[_0x421d('0x28')]=function(_0x53f7a1,_0x146905){var _0x3ec17d={},_0x5cb3f8={},_0x123051={'count':0x0,'rows':[]};var _0x56c823=_['map'](db[_0x421d('0x29')]['rawAttributes'],function(_0x3d6183){return{'name':_0x3d6183[_0x421d('0x2a')],'type':_0x3d6183[_0x421d('0x2b')]['key']};});_0x5cb3f8['model']=_[_0x421d('0x2c')](_0x56c823,'name');_0x5cb3f8[_0x421d('0x2d')]=_[_0x421d('0x2e')](_0x53f7a1[_0x421d('0x2d')]);_0x5cb3f8[_0x421d('0x2f')]=_[_0x421d('0x30')](_0x5cb3f8[_0x421d('0x31')],_0x5cb3f8[_0x421d('0x2d')]);_0x3ec17d[_0x421d('0x32')]=_['intersection'](_0x5cb3f8[_0x421d('0x31')],qs[_0x421d('0x33')](_0x53f7a1[_0x421d('0x2d')][_0x421d('0x33')]));_0x3ec17d[_0x421d('0x32')]=_0x3ec17d[_0x421d('0x32')][_0x421d('0x34')]?_0x3ec17d[_0x421d('0x32')]:_0x5cb3f8[_0x421d('0x31')];if(!_0x53f7a1[_0x421d('0x2d')][_0x421d('0x35')](_0x421d('0x36'))){_0x3ec17d[_0x421d('0x1c')]=qs[_0x421d('0x1c')](_0x53f7a1[_0x421d('0x2d')][_0x421d('0x1c')]);_0x3ec17d[_0x421d('0x1b')]=qs['offset'](_0x53f7a1[_0x421d('0x2d')]['offset']);}_0x3ec17d['order']=qs['sort'](_0x53f7a1[_0x421d('0x2d')]['sort']);_0x3ec17d[_0x421d('0x37')]=qs[_0x421d('0x2f')](_[_0x421d('0x38')](_0x53f7a1['query'],_0x5cb3f8[_0x421d('0x2f')]),_0x56c823);if(_0x53f7a1[_0x421d('0x2d')]['filter']){_0x3ec17d[_0x421d('0x37')]=_[_0x421d('0x39')](_0x3ec17d[_0x421d('0x37')],{'$or':_[_0x421d('0x2c')](_0x56c823,function(_0x5a793c){if(_0x5a793c['type']!==_0x421d('0x3a')){var _0x1b31a6={};_0x1b31a6[_0x5a793c[_0x421d('0x26')]]={'$like':'%'+_0x53f7a1[_0x421d('0x2d')][_0x421d('0x3b')]+'%'};return _0x1b31a6;}})});}_0x3ec17d=_[_0x421d('0x39')]({},_0x3ec17d,_0x53f7a1[_0x421d('0x3c')]);var _0x46c72f={'where':_0x3ec17d[_0x421d('0x37')]};return db[_0x421d('0x29')]['count'](_0x46c72f)['then'](function(_0x92d663){_0x123051[_0x421d('0x3d')]=_0x92d663;if(_0x53f7a1[_0x421d('0x2d')][_0x421d('0x3e')]){_0x3ec17d['include']=[{'all':!![]}];}return db[_0x421d('0x29')][_0x421d('0x3f')](_0x3ec17d);})[_0x421d('0x22')](function(_0x174ec7){_0x123051[_0x421d('0x40')]=_0x174ec7;return _0x123051;})[_0x421d('0x22')](respondWithFilteredResult(_0x146905,_0x3ec17d))[_0x421d('0x41')](handleError(_0x146905,null));};exports[_0x421d('0x42')]=function(_0x5d1457,_0x33bd31){var _0xc6a90a={'raw':!![],'where':{'id':_0x5d1457[_0x421d('0x43')]['id']}},_0x4ec403={};_0x4ec403[_0x421d('0x31')]=_[_0x421d('0x2e')](db[_0x421d('0x29')][_0x421d('0x44')]);_0x4ec403['query']=_['keys'](_0x5d1457[_0x421d('0x2d')]);_0x4ec403[_0x421d('0x2f')]=_[_0x421d('0x30')](_0x4ec403[_0x421d('0x31')],_0x4ec403[_0x421d('0x2d')]);_0xc6a90a[_0x421d('0x32')]=_[_0x421d('0x30')](_0x4ec403['model'],qs[_0x421d('0x33')](_0x5d1457[_0x421d('0x2d')][_0x421d('0x33')]));_0xc6a90a['attributes']=_0xc6a90a[_0x421d('0x32')]['length']?_0xc6a90a['attributes']:_0x4ec403[_0x421d('0x31')];if(_0x5d1457[_0x421d('0x2d')]['includeAll']){_0xc6a90a[_0x421d('0x45')]=[{'all':!![]}];}_0xc6a90a=_[_0x421d('0x39')]({},_0xc6a90a,_0x5d1457[_0x421d('0x3c')]);return db[_0x421d('0x29')]['find'](_0xc6a90a)[_0x421d('0x22')](handleEntityNotFound(_0x33bd31,null))[_0x421d('0x22')](respondWithResult(_0x33bd31,null))['catch'](handleError(_0x33bd31,null));};exports[_0x421d('0x46')]=function(_0x37c9a4,_0x53b0c4){return db[_0x421d('0x29')][_0x421d('0x46')](_0x37c9a4[_0x421d('0x47')],{})[_0x421d('0x22')](respondWithResult(_0x53b0c4,0xc9))['catch'](handleError(_0x53b0c4,null));};exports['update']=function(_0x381dd2,_0x1ae99e){if(_0x381dd2[_0x421d('0x47')]['id']){delete _0x381dd2[_0x421d('0x47')]['id'];}return db[_0x421d('0x29')][_0x421d('0x48')]({'where':{'id':_0x381dd2['params']['id']}})[_0x421d('0x22')](handleEntityNotFound(_0x1ae99e,null))[_0x421d('0x22')](saveUpdates(_0x381dd2[_0x421d('0x47')],null))[_0x421d('0x22')](respondWithResult(_0x1ae99e,null))[_0x421d('0x41')](handleError(_0x1ae99e,null));};exports['download']=function(_0x507eb7,_0xda2956,_0x59e490){var _0x322183=require('../../components/encryptor');var _0x53bb44=![];var _0x5852e1={};if(_0x507eb7[_0x421d('0x2d')][_0x421d('0x2b')]&&_0x507eb7[_0x421d('0x2d')][_0x421d('0x2b')]===_0x421d('0x49')){_0x5852e1[_0x421d('0x49')]=_0x507eb7[_0x421d('0x43')]['id'];}else{_0x5852e1['id']=_0x507eb7[_0x421d('0x43')]['id'];}return db[_0x421d('0x29')][_0x421d('0x48')]({'where':_0x5852e1,'attributes':['id','savePath','filename'],'raw':!![]})[_0x421d('0x22')](handleEntityNotFound(_0xda2956,null))[_0x421d('0x22')](function(_0x502707){if(_0x502707){var _0x16d43c=_0x502707['savePath'];var _0xa812bd=util['format'](_0x421d('0x4a'),_0x16d43c);if(fs['existsSync'](_0xa812bd)){_0x53bb44=!![];return _0x322183[_0x421d('0x4b')](_0xa812bd,_0x16d43c,config[_0x421d('0x4c')]['recording'])[_0x421d('0x22')](function(){return _0x502707;});}return _0x502707;}})[_0x421d('0x22')](function(_0x3d0cc0){if(_0x3d0cc0){var _0x5ae9d7=_0x3d0cc0['savePath'];if(!fs[_0x421d('0x4d')](_0x5ae9d7)){throw new db[(_0x421d('0x4e'))][(_0x421d('0x4f'))](_0x421d('0x50'));}if(_0x3d0cc0[_0x421d('0x51')]){return _0xda2956[_0x421d('0x52')](_0x5ae9d7,_0x3d0cc0['filename']+path[_0x421d('0x53')](_0x5ae9d7),function(){if(_0x53bb44){fs[_0x421d('0x54')](_0x5ae9d7);}});}else{return _0xda2956[_0x421d('0x52')](_0x5ae9d7,function(_0x235955){if(_0x53bb44){fs[_0x421d('0x54')](_0x5ae9d7);}});}}})['catch'](function(_0xca2321){if(_0xca2321[_0x421d('0x55')]===_0x421d('0x50')){_0xda2956['status'](0x194)[_0x421d('0x27')](_0x421d('0x56'));}else{return handleError(_0xda2956,null);}});};exports[_0x421d('0x23')]=function(_0x3f70d5,_0x81cdf3){return db[_0x421d('0x29')]['find']({'where':{'id':_0x3f70d5[_0x421d('0x43')]['id']}})[_0x421d('0x22')](function(_0x148a25){if(!_0x148a25)throw new ReferenceError(_0x421d('0x57'));return _0x148a25;})[_0x421d('0x22')](function(_0x49060b){var _0x956cbe=_0x49060b[_0x421d('0x58')];logger[_0x421d('0x59')](_0x421d('0x5a'),_0x956cbe);if(!_[_0x421d('0x5b')](_0x49060b[_0x421d('0x58')])&&fs[_0x421d('0x4d')](_0x956cbe)){logger[_0x421d('0x59')](_0x421d('0x5c')+_0x956cbe+_0x421d('0x5d'));fs[_0x421d('0x5e')](_0x956cbe);}_0x956cbe=_0x956cbe+'.cypher';if(!_[_0x421d('0x5b')](_0x49060b['savePath'])&&fs[_0x421d('0x4d')](_0x956cbe)){logger[_0x421d('0x59')]('File:\x20\x22'+_0x956cbe+_0x421d('0x5d'));fs[_0x421d('0x5e')](_0x956cbe);}return _0x49060b;})[_0x421d('0x22')](function(_0x57b196){if(!_0x57b196)throw new InternalError();return _0x57b196[_0x421d('0x23')]();})['then'](function(){_0x81cdf3['status'](0xcc)[_0x421d('0x19')]();})['catch'](handleError(_0x81cdf3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 7802175..3a92189 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 _0x42f4=['request-promise','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2b42e0,_0x2bec74){var _0x12bd57=function(_0x26b44a){while(--_0x26b44a){_0x2b42e0['push'](_0x2b42e0['shift']());}};_0x12bd57(++_0x2bec74);}(_0x42f4,0x19d));var _0x442f=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0x42f4[_0x2fd160];return _0x5c2031;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var logger=require(_0x442f('0x1'))(_0x442f('0x2'));var moment=require(_0x442f('0x3'));var BPromise=require(_0x442f('0x4'));var rp=require(_0x442f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x442f('0x6'));module[_0x442f('0x7')]=function(_0x545b7b,_0x3ed622){return _0x545b7b[_0x442f('0x8')](_0x442f('0x9'),attributes,{'tableName':_0x442f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa693=['util','../../config/logger','api','moment','bluebird','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','lodash'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0xa693,0xf1));var _0x3a69=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0xa693[_0x5da0d9];return _0x4b6d2f;};'use strict';var _=require(_0x3a69('0x0'));var util=require(_0x3a69('0x1'));var logger=require(_0x3a69('0x2'))(_0x3a69('0x3'));var moment=require(_0x3a69('0x4'));var BPromise=require(_0x3a69('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a69('0x6'));var attributes=require(_0x3a69('0x7'));module[_0x3a69('0x8')]=function(_0x363363,_0x3a05e0){return _0x363363[_0x3a69('0x9')](_0x3a69('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 1a329b4..2a7b51f 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 _0x1785=['request\x20sent','stringify','error','code','message','result','catch','SquareRecording','create','options','raw','CreateSquareRecording','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x56cc28,_0x4a921e){var _0x1f5798=function(_0x45f7a5){while(--_0x45f7a5){_0x56cc28['push'](_0x56cc28['shift']());}};_0x1f5798(++_0x4a921e);}(_0x1785,0x1b0));var _0x5178=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x1785[_0x1e6b59];return _0x40d7c5;};'use strict';var _=require('lodash');var util=require(_0x5178('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5178('0x1'));var fs=require('fs');var Redis=require(_0x5178('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5178('0x3'));var logger=require(_0x5178('0x4'))(_0x5178('0x5'));var config=require(_0x5178('0x6'));var jayson=require(_0x5178('0x7'));var client=jayson[_0x5178('0x8')][_0x5178('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4205ab,_0x13dc40,_0x3e3b38){return new BPromise(function(_0x59dfbb,_0x14a0ad){return client[_0x5178('0xa')](_0x4205ab,_0x3e3b38)[_0x5178('0xb')](function(_0x537a95){logger[_0x5178('0xc')](_0x5178('0xd'),_0x13dc40,'request\x20sent');logger[_0x5178('0xe')](_0x5178('0xf'),_0x13dc40,_0x5178('0x10'),JSON[_0x5178('0x11')](_0x537a95));if(_0x537a95[_0x5178('0x12')]){if(_0x537a95[_0x5178('0x12')][_0x5178('0x13')]===0x1f4){logger[_0x5178('0x12')]('SquareRecording,\x20%s,\x20%s',_0x13dc40,_0x537a95[_0x5178('0x12')]['message']);return _0x14a0ad(_0x537a95[_0x5178('0x12')][_0x5178('0x14')]);}logger['error'](_0x5178('0xd'),_0x13dc40,_0x537a95[_0x5178('0x12')][_0x5178('0x14')]);return _0x59dfbb(_0x537a95[_0x5178('0x12')][_0x5178('0x14')]);}else{logger['info'](_0x5178('0xd'),_0x13dc40,_0x5178('0x10'));_0x59dfbb(_0x537a95[_0x5178('0x15')][_0x5178('0x14')]);}})[_0x5178('0x16')](function(_0x342eff){logger[_0x5178('0x12')](_0x5178('0xd'),_0x13dc40,_0x342eff);_0x14a0ad(_0x342eff);});});}exports['CreateSquareRecording']=function(_0x613e74){var _0x44d009=this;return new Promise(function(_0x3e84d0,_0x297553){return db[_0x5178('0x17')][_0x5178('0x18')](_0x613e74['body'],{'raw':_0x613e74[_0x5178('0x19')]?_0x613e74['options'][_0x5178('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x52404c){logger[_0x5178('0xc')](_0x5178('0x1b'),_0x613e74);logger['debug']('CreateSquareRecording',_0x613e74,JSON['stringify'](_0x52404c));_0x3e84d0(_0x52404c);})[_0x5178('0x16')](function(_0x3d904b){logger[_0x5178('0x12')]('CreateSquareRecording',_0x3d904b[_0x5178('0x14')],_0x613e74);_0x297553(_0x44d009[_0x5178('0x12')](0x1f4,_0x3d904b[_0x5178('0x14')]));});});}; \ No newline at end of file +var _0x78e2=['http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','then','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x78e2,0x1e4));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x278e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x278e('0x1'));var rs=require(_0x278e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x278e('0x3'))['db'];var utils=require(_0x278e('0x4'));var logger=require(_0x278e('0x5'))(_0x278e('0x6'));var config=require(_0x278e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x278e('0x8')][_0x278e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a06cc,_0x49f8cc,_0x2cd12e){return new BPromise(function(_0x379398,_0x3cfa73){return client[_0x278e('0xa')](_0x3a06cc,_0x2cd12e)['then'](function(_0x2965ed){logger[_0x278e('0xb')](_0x278e('0xc'),_0x49f8cc,_0x278e('0xd'));logger[_0x278e('0xe')](_0x278e('0xf'),_0x49f8cc,_0x278e('0xd'),JSON['stringify'](_0x2965ed));if(_0x2965ed[_0x278e('0x10')]){if(_0x2965ed[_0x278e('0x10')][_0x278e('0x11')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x49f8cc,_0x2965ed[_0x278e('0x10')][_0x278e('0x12')]);return _0x3cfa73(_0x2965ed[_0x278e('0x10')][_0x278e('0x12')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x49f8cc,_0x2965ed[_0x278e('0x10')][_0x278e('0x12')]);return _0x379398(_0x2965ed[_0x278e('0x10')]['message']);}else{logger[_0x278e('0xb')](_0x278e('0xc'),_0x49f8cc,_0x278e('0xd'));_0x379398(_0x2965ed[_0x278e('0x13')][_0x278e('0x12')]);}})[_0x278e('0x14')](function(_0x1dca0d){logger['error']('SquareRecording,\x20%s,\x20%s',_0x49f8cc,_0x1dca0d);_0x3cfa73(_0x1dca0d);});});}exports[_0x278e('0x15')]=function(_0x53a9d1){var _0x18ca3c=this;return new Promise(function(_0x2786f8,_0x19a7d2){return db[_0x278e('0x16')][_0x278e('0x17')](_0x53a9d1[_0x278e('0x18')],{'raw':_0x53a9d1[_0x278e('0x19')]?_0x53a9d1[_0x278e('0x19')][_0x278e('0x1a')]===undefined?!![]:![]:!![]})[_0x278e('0x1b')](function(_0x5a0f8b){logger['info'](_0x278e('0x15'),_0x53a9d1);logger[_0x278e('0xe')](_0x278e('0x15'),_0x53a9d1,JSON[_0x278e('0x1c')](_0x5a0f8b));_0x2786f8(_0x5a0f8b);})[_0x278e('0x14')](function(_0x1df4c6){logger[_0x278e('0x10')](_0x278e('0x15'),_0x1df4c6[_0x278e('0x12')],_0x53a9d1);_0x19a7d2(_0x18ca3c[_0x278e('0x10')](0x1f4,_0x1df4c6[_0x278e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7fe76de..655b67f 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 _0x81ec=['get','/describe','/:id','post','create','put','update','delete','multer','connect-timeout','express','Router','../../components/interaction/service','./squareReport.controller','isAuthenticated','index'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0x81ec,0xc8));var _0xc81e=function(_0x502a8e,_0x238224){_0x502a8e=_0x502a8e-0x0;var _0x5c7054=_0x81ec[_0x502a8e];return _0x5c7054;};'use strict';var multer=require(_0xc81e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc81e('0x1'));var express=require(_0xc81e('0x2'));var router=express[_0xc81e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc81e('0x4'));var config=require('../../config/environment');var controller=require(_0xc81e('0x5'));router['get']('/',auth[_0xc81e('0x6')](),controller[_0xc81e('0x7')]);router[_0xc81e('0x8')](_0xc81e('0x9'),auth[_0xc81e('0x6')](),controller['describe']);router[_0xc81e('0x8')](_0xc81e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xc81e('0xb')]('/',auth['isAuthenticated'](),controller[_0xc81e('0xc')]);router[_0xc81e('0xd')](_0xc81e('0xa'),auth[_0xc81e('0x6')](),controller[_0xc81e('0xe')]);router[_0xc81e('0xf')](_0xc81e('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8849=['describe','/:id','show','post','create','put','update','delete','destroy','exports','path','express','../../components/auth/service','isAuthenticated','index','get','/describe'];(function(_0x52cbaa,_0x4dd3d3){var _0x38698e=function(_0x5c3b98){while(--_0x5c3b98){_0x52cbaa['push'](_0x52cbaa['shift']());}};_0x38698e(++_0x4dd3d3);}(_0x8849,0xe7));var _0x9884=function(_0x8649c,_0x2787f5){_0x8649c=_0x8649c-0x0;var _0x446d03=_0x8849[_0x8649c];return _0x446d03;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9884('0x0'));var timeout=require('connect-timeout');var express=require(_0x9884('0x1'));var router=express['Router']();var auth=require(_0x9884('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareReport.controller');router['get']('/',auth[_0x9884('0x3')](),controller[_0x9884('0x4')]);router[_0x9884('0x5')](_0x9884('0x6'),auth['isAuthenticated'](),controller[_0x9884('0x7')]);router[_0x9884('0x5')](_0x9884('0x8'),auth['isAuthenticated'](),controller[_0x9884('0x9')]);router[_0x9884('0xa')]('/',auth[_0x9884('0x3')](),controller[_0x9884('0xb')]);router[_0x9884('0xc')](_0x9884('0x8'),auth[_0x9884('0x3')](),controller[_0x9884('0xd')]);router[_0x9884('0xe')](_0x9884('0x8'),auth['isAuthenticated'](),controller[_0x9884('0xf')]);module[_0x9884('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index bf5eefd..5bb2aff 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 _0xe807=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xe807,0x189));var _0x7e80=function(_0x204b8d,_0x4efd9f){_0x204b8d=_0x204b8d-0x0;var _0x307bc5=_0xe807[_0x204b8d];return _0x307bc5;};'use strict';var Sequelize=require(_0x7e80('0x0'));module[_0x7e80('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x7e80('0x2')]},'channel':{'type':Sequelize[_0x7e80('0x2')]},'language':{'type':Sequelize[_0x7e80('0x2')]},'type':{'type':Sequelize[_0x7e80('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x7e80('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7e80('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x7e80('0x2')]},'callingtns':{'type':Sequelize[_0x7e80('0x2')]},'dnid':{'type':Sequelize[_0x7e80('0x2')]},'rdnis':{'type':Sequelize[_0x7e80('0x2')]},'context':{'type':Sequelize[_0x7e80('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7e80('0x2')]},'enhanced':{'type':Sequelize[_0x7e80('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x7e80('0x2')]},'joinAt':{'type':Sequelize[_0x7e80('0x3')]},'leaveAt':{'type':Sequelize[_0x7e80('0x3')]},'bot':{'type':Sequelize[_0x7e80('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x5486=['sequelize','exports','STRING','DATE'];(function(_0x1626a0,_0x1bc404){var _0xc01602=function(_0x29bca4){while(--_0x29bca4){_0x1626a0['push'](_0x1626a0['shift']());}};_0xc01602(++_0x1bc404);}(_0x5486,0x108));var _0x6548=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5486[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6548('0x0'));module[_0x6548('0x1')]={'network':{'type':Sequelize[_0x6548('0x2')]},'network_script':{'type':Sequelize[_0x6548('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6548('0x2')]},'language':{'type':Sequelize[_0x6548('0x2')]},'type':{'type':Sequelize[_0x6548('0x2')]},'uniqueid':{'type':Sequelize[_0x6548('0x2')]},'version':{'type':Sequelize[_0x6548('0x2')]},'callerid':{'type':Sequelize[_0x6548('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x6548('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x6548('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x6548('0x2')]},'extension':{'type':Sequelize[_0x6548('0x2')]},'priority':{'type':Sequelize[_0x6548('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6548('0x2')]},'threadid':{'type':Sequelize[_0x6548('0x2')]},'project_name':{'type':Sequelize[_0x6548('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x6548('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 1d2218a..e496f26 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 _0xc963=['find','destroy','describe','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body'];(function(_0x1abe1f,_0x597d40){var _0xe8754=function(_0x36a37b){while(--_0x36a37b){_0x1abe1f['push'](_0x1abe1f['shift']());}};_0xe8754(++_0x597d40);}(_0xc963,0x17f));var _0x3c96=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0xc963[_0x5c78d9];return _0x69ae1f;};'use strict';var pdf=require(_0x3c96('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3c96('0x1'));var jsonpatch=require(_0x3c96('0x2'));var rp=require(_0x3c96('0x3'));var moment=require(_0x3c96('0x4'));var BPromise=require(_0x3c96('0x5'));var Mustache=require('mustache');var util=require(_0x3c96('0x6'));var path=require(_0x3c96('0x7'));var sox=require(_0x3c96('0x8'));var csv=require(_0x3c96('0x9'));var ejs=require(_0x3c96('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3c96('0xb'));var crypto=require(_0x3c96('0xc'));var jsforce=require(_0x3c96('0xd'));var deskjs=require(_0x3c96('0xe'));var toCsv=require(_0x3c96('0x9'));var querystring=require(_0x3c96('0xf'));var Papa=require(_0x3c96('0x10'));var Redis=require(_0x3c96('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3c96('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c96('0x13'));var logger=require(_0x3c96('0x14'))('api');var utils=require(_0x3c96('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3c96('0x16'))['db'];function respondWithStatusCode(_0x458cec,_0x4096e0){_0x4096e0=_0x4096e0||0xcc;return function(_0x2017ae){if(_0x2017ae){return _0x458cec[_0x3c96('0x17')](_0x4096e0);}return _0x458cec[_0x3c96('0x18')](_0x4096e0)[_0x3c96('0x19')]();};}function respondWithResult(_0xd1910c,_0x115bda){_0x115bda=_0x115bda||0xc8;return function(_0xd79802){if(_0xd79802){return _0xd1910c[_0x3c96('0x18')](_0x115bda)[_0x3c96('0x1a')](_0xd79802);}};}function respondWithFilteredResult(_0x1a2850,_0x45c642){return function(_0x4bc94d){if(_0x4bc94d){var _0x3720a3=_0x4bc94d[_0x3c96('0x1b')],_0x1bc526=_0x45c642[_0x3c96('0x1c')],_0x5bfb66=_0x45c642[_0x3c96('0x1c')]+_0x45c642['limit'],_0x3162bd;if(_0x5bfb66>=_0x3720a3){_0x5bfb66=_0x3720a3;_0x3162bd=0xc8;}else{_0x3162bd=0xce;}_0x1a2850['status'](_0x3162bd);return _0x1a2850[_0x3c96('0x1d')](_0x3c96('0x1e'),_0x1bc526+'-'+_0x5bfb66+'/'+_0x3720a3)[_0x3c96('0x1a')](_0x4bc94d);}return null;};}function patchUpdates(_0x5c9df4){return function(_0xc4a84d){try{jsonpatch[_0x3c96('0x1f')](_0xc4a84d,_0x5c9df4,!![]);}catch(_0x15aa1d){return BPromise[_0x3c96('0x20')](_0x15aa1d);}return _0xc4a84d['save']();};}function saveUpdates(_0x363a60,_0x247761){return function(_0x2b141a){if(_0x2b141a){return _0x2b141a[_0x3c96('0x21')](_0x363a60)[_0x3c96('0x22')](function(_0x2a4b21){return _0x2a4b21;});}return null;};}function removeEntity(_0x4ed5a5,_0x2f2952){return function(_0x2bc43d){if(_0x2bc43d){return _0x2bc43d['destroy']()[_0x3c96('0x22')](function(){_0x4ed5a5[_0x3c96('0x18')](0xcc)[_0x3c96('0x19')]();});}};}function handleEntityNotFound(_0xaca631,_0x24c88d){return function(_0x4f91cb){if(!_0x4f91cb){_0xaca631[_0x3c96('0x17')](0x194);}return _0x4f91cb;};}function handleError(_0x5d5145,_0xc155ac){_0xc155ac=_0xc155ac||0x1f4;return function(_0x3a95f7){logger[_0x3c96('0x23')](_0x3a95f7[_0x3c96('0x24')]);if(_0x3a95f7[_0x3c96('0x25')]){delete _0x3a95f7[_0x3c96('0x25')];}_0x5d5145[_0x3c96('0x18')](_0xc155ac)['send'](_0x3a95f7);};}exports[_0x3c96('0x26')]=function(_0x48f72d,_0x30180b){var _0x521350={},_0x5e2638={},_0x253cf0={'count':0x0,'rows':[]};var _0x3a237e=_[_0x3c96('0x27')](db[_0x3c96('0x28')][_0x3c96('0x29')],function(_0x299f45){return{'name':_0x299f45[_0x3c96('0x2a')],'type':_0x299f45[_0x3c96('0x2b')][_0x3c96('0x2c')]};});_0x5e2638[_0x3c96('0x2d')]=_[_0x3c96('0x27')](_0x3a237e,_0x3c96('0x25'));_0x5e2638[_0x3c96('0x2e')]=_[_0x3c96('0x2f')](_0x48f72d['query']);_0x5e2638[_0x3c96('0x30')]=_[_0x3c96('0x31')](_0x5e2638[_0x3c96('0x2d')],_0x5e2638['query']);_0x521350[_0x3c96('0x32')]=_[_0x3c96('0x31')](_0x5e2638['model'],qs[_0x3c96('0x33')](_0x48f72d[_0x3c96('0x2e')]['fields']));_0x521350[_0x3c96('0x32')]=_0x521350[_0x3c96('0x32')][_0x3c96('0x34')]?_0x521350[_0x3c96('0x32')]:_0x5e2638[_0x3c96('0x2d')];if(!_0x48f72d[_0x3c96('0x2e')][_0x3c96('0x35')](_0x3c96('0x36'))){_0x521350[_0x3c96('0x37')]=qs['limit'](_0x48f72d[_0x3c96('0x2e')][_0x3c96('0x37')]);_0x521350[_0x3c96('0x1c')]=qs[_0x3c96('0x1c')](_0x48f72d[_0x3c96('0x2e')][_0x3c96('0x1c')]);}_0x521350[_0x3c96('0x38')]=qs['sort'](_0x48f72d[_0x3c96('0x2e')][_0x3c96('0x39')]);_0x521350[_0x3c96('0x3a')]=qs[_0x3c96('0x30')](_[_0x3c96('0x3b')](_0x48f72d[_0x3c96('0x2e')],_0x5e2638[_0x3c96('0x30')]),_0x3a237e);if(_0x48f72d[_0x3c96('0x2e')][_0x3c96('0x3c')]){_0x521350[_0x3c96('0x3a')]=_[_0x3c96('0x3d')](_0x521350[_0x3c96('0x3a')],{'$or':_['map'](_0x3a237e,function(_0x2ed687){if(_0x2ed687['type']!==_0x3c96('0x3e')){var _0x2b0dd3={};_0x2b0dd3[_0x2ed687[_0x3c96('0x25')]]={'$like':'%'+_0x48f72d[_0x3c96('0x2e')][_0x3c96('0x3c')]+'%'};return _0x2b0dd3;}})});}_0x521350=_[_0x3c96('0x3d')]({},_0x521350,_0x48f72d[_0x3c96('0x3f')]);var _0x308a08={'where':_0x521350['where']};return db[_0x3c96('0x28')][_0x3c96('0x1b')](_0x308a08)['then'](function(_0x2f04fb){_0x253cf0[_0x3c96('0x1b')]=_0x2f04fb;if(_0x48f72d[_0x3c96('0x2e')][_0x3c96('0x40')]){_0x521350[_0x3c96('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0x3c96('0x42')](_0x521350);})[_0x3c96('0x22')](function(_0x531a2a){_0x253cf0[_0x3c96('0x43')]=_0x531a2a;return _0x253cf0;})[_0x3c96('0x22')](respondWithFilteredResult(_0x30180b,_0x521350))[_0x3c96('0x44')](handleError(_0x30180b,null));};exports[_0x3c96('0x45')]=function(_0x214a77,_0x2714b4){var _0x563530={'raw':!![],'where':{'id':_0x214a77[_0x3c96('0x46')]['id']}},_0xb5c48a={};_0xb5c48a[_0x3c96('0x2d')]=_['keys'](db[_0x3c96('0x28')][_0x3c96('0x29')]);_0xb5c48a['query']=_[_0x3c96('0x2f')](_0x214a77['query']);_0xb5c48a[_0x3c96('0x30')]=_['intersection'](_0xb5c48a[_0x3c96('0x2d')],_0xb5c48a['query']);_0x563530[_0x3c96('0x32')]=_[_0x3c96('0x31')](_0xb5c48a[_0x3c96('0x2d')],qs['fields'](_0x214a77[_0x3c96('0x2e')][_0x3c96('0x33')]));_0x563530['attributes']=_0x563530[_0x3c96('0x32')][_0x3c96('0x34')]?_0x563530[_0x3c96('0x32')]:_0xb5c48a[_0x3c96('0x2d')];if(_0x214a77[_0x3c96('0x2e')][_0x3c96('0x40')]){_0x563530['include']=[{'all':!![]}];}_0x563530=_[_0x3c96('0x3d')]({},_0x563530,_0x214a77[_0x3c96('0x3f')]);return db[_0x3c96('0x28')]['find'](_0x563530)[_0x3c96('0x22')](handleEntityNotFound(_0x2714b4,null))[_0x3c96('0x22')](respondWithResult(_0x2714b4,null))[_0x3c96('0x44')](handleError(_0x2714b4,null));};exports['create']=function(_0x206aa1,_0x25e290){return db['SquareReport'][_0x3c96('0x47')](_0x206aa1['body'],{})[_0x3c96('0x22')](respondWithResult(_0x25e290,0xc9))[_0x3c96('0x44')](handleError(_0x25e290,null));};exports['update']=function(_0x30fdf,_0x4acb16){if(_0x30fdf[_0x3c96('0x48')]['id']){delete _0x30fdf[_0x3c96('0x48')]['id'];}return db[_0x3c96('0x28')][_0x3c96('0x49')]({'where':{'id':_0x30fdf[_0x3c96('0x46')]['id']}})[_0x3c96('0x22')](handleEntityNotFound(_0x4acb16,null))[_0x3c96('0x22')](saveUpdates(_0x30fdf[_0x3c96('0x48')],null))[_0x3c96('0x22')](respondWithResult(_0x4acb16,null))['catch'](handleError(_0x4acb16,null));};exports[_0x3c96('0x4a')]=function(_0x1da94c,_0x44a650){return db[_0x3c96('0x28')]['find']({'where':{'id':_0x1da94c[_0x3c96('0x46')]['id']}})[_0x3c96('0x22')](handleEntityNotFound(_0x44a650,null))[_0x3c96('0x22')](removeEntity(_0x44a650,null))[_0x3c96('0x44')](handleError(_0x44a650,null));};exports[_0x3c96('0x4b')]=function(_0x33d557,_0x1dfcb4){return db[_0x3c96('0x28')][_0x3c96('0x4b')]()['then'](respondWithResult(_0x1dfcb4,null))['catch'](handleError(_0x1dfcb4,null));}; \ No newline at end of file +var _0xe0c1=['../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','SquareReport','type','key','model','map','keys','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','then','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xe0c1,0x10f));var _0x1e0c=function(_0x2f5806,_0x3d97a8){_0x2f5806=_0x2f5806-0x0;var _0x341624=_0xe0c1[_0x2f5806];return _0x341624;};'use strict';var pdf=require(_0x1e0c('0x0'));var emlformat=require(_0x1e0c('0x1'));var rimraf=require(_0x1e0c('0x2'));var zipdir=require(_0x1e0c('0x3'));var jsonpatch=require(_0x1e0c('0x4'));var rp=require(_0x1e0c('0x5'));var moment=require(_0x1e0c('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e0c('0x7'));var fs=require('fs');var _=require(_0x1e0c('0x8'));var squel=require(_0x1e0c('0x9'));var crypto=require(_0x1e0c('0xa'));var jsforce=require(_0x1e0c('0xb'));var deskjs=require(_0x1e0c('0xc'));var toCsv=require(_0x1e0c('0xd'));var querystring=require(_0x1e0c('0xe'));var Papa=require('papaparse');var Redis=require(_0x1e0c('0xf'));var authService=require(_0x1e0c('0x10'));var qs=require(_0x1e0c('0x11'));var as=require(_0x1e0c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e0c('0x13'))(_0x1e0c('0x14'));var utils=require(_0x1e0c('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1e0c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x138605,_0x39305e){_0x39305e=_0x39305e||0xcc;return function(_0x432542){if(_0x432542){return _0x138605[_0x1e0c('0x17')](_0x39305e);}return _0x138605[_0x1e0c('0x18')](_0x39305e)[_0x1e0c('0x19')]();};}function respondWithResult(_0x1aece1,_0x1c2616){_0x1c2616=_0x1c2616||0xc8;return function(_0x1fbc44){if(_0x1fbc44){return _0x1aece1[_0x1e0c('0x18')](_0x1c2616)['json'](_0x1fbc44);}};}function respondWithFilteredResult(_0x3970ae,_0x57ad85){return function(_0x2500d7){if(_0x2500d7){var _0xcf9c3b=_0x2500d7[_0x1e0c('0x1a')],_0x13840b=_0x57ad85[_0x1e0c('0x1b')],_0xb52d20=_0x57ad85['offset']+_0x57ad85[_0x1e0c('0x1c')],_0x3dfe8e;if(_0xb52d20>=_0xcf9c3b){_0xb52d20=_0xcf9c3b;_0x3dfe8e=0xc8;}else{_0x3dfe8e=0xce;}_0x3970ae[_0x1e0c('0x18')](_0x3dfe8e);return _0x3970ae[_0x1e0c('0x1d')](_0x1e0c('0x1e'),_0x13840b+'-'+_0xb52d20+'/'+_0xcf9c3b)['json'](_0x2500d7);}return null;};}function patchUpdates(_0x539a39){return function(_0x596304){try{jsonpatch[_0x1e0c('0x1f')](_0x596304,_0x539a39,!![]);}catch(_0x268365){return BPromise[_0x1e0c('0x20')](_0x268365);}return _0x596304[_0x1e0c('0x21')]();};}function saveUpdates(_0x3f2a59,_0x3a94f0){return function(_0x159a3f){if(_0x159a3f){return _0x159a3f[_0x1e0c('0x22')](_0x3f2a59)['then'](function(_0x5d6943){return _0x5d6943;});}return null;};}function removeEntity(_0x3885d2,_0x38d8bd){return function(_0x3b1200){if(_0x3b1200){return _0x3b1200[_0x1e0c('0x23')]()['then'](function(){_0x3885d2[_0x1e0c('0x18')](0xcc)[_0x1e0c('0x19')]();});}};}function handleEntityNotFound(_0x1edf97,_0x1cf772){return function(_0x3d5f10){if(!_0x3d5f10){_0x1edf97[_0x1e0c('0x17')](0x194);}return _0x3d5f10;};}function handleError(_0x509efd,_0x50f968){_0x50f968=_0x50f968||0x1f4;return function(_0x1d7c49){logger[_0x1e0c('0x24')](_0x1d7c49[_0x1e0c('0x25')]);if(_0x1d7c49[_0x1e0c('0x26')]){delete _0x1d7c49['name'];}_0x509efd[_0x1e0c('0x18')](_0x50f968)[_0x1e0c('0x27')](_0x1d7c49);};}exports[_0x1e0c('0x28')]=function(_0x5e7e6f,_0xef59ad){var _0x1a6a87={},_0x23efc0={},_0x2d8c99={'count':0x0,'rows':[]};var _0x2c7593=_['map'](db[_0x1e0c('0x29')]['rawAttributes'],function(_0x1e49a9){return{'name':_0x1e49a9['fieldName'],'type':_0x1e49a9[_0x1e0c('0x2a')][_0x1e0c('0x2b')]};});_0x23efc0[_0x1e0c('0x2c')]=_[_0x1e0c('0x2d')](_0x2c7593,_0x1e0c('0x26'));_0x23efc0['query']=_[_0x1e0c('0x2e')](_0x5e7e6f[_0x1e0c('0x2f')]);_0x23efc0['filters']=_['intersection'](_0x23efc0[_0x1e0c('0x2c')],_0x23efc0['query']);_0x1a6a87[_0x1e0c('0x30')]=_[_0x1e0c('0x31')](_0x23efc0[_0x1e0c('0x2c')],qs[_0x1e0c('0x32')](_0x5e7e6f[_0x1e0c('0x2f')][_0x1e0c('0x32')]));_0x1a6a87[_0x1e0c('0x30')]=_0x1a6a87[_0x1e0c('0x30')][_0x1e0c('0x33')]?_0x1a6a87[_0x1e0c('0x30')]:_0x23efc0['model'];if(!_0x5e7e6f[_0x1e0c('0x2f')]['hasOwnProperty'](_0x1e0c('0x34'))){_0x1a6a87['limit']=qs[_0x1e0c('0x1c')](_0x5e7e6f['query'][_0x1e0c('0x1c')]);_0x1a6a87[_0x1e0c('0x1b')]=qs['offset'](_0x5e7e6f['query']['offset']);}_0x1a6a87[_0x1e0c('0x35')]=qs['sort'](_0x5e7e6f['query'][_0x1e0c('0x36')]);_0x1a6a87[_0x1e0c('0x37')]=qs[_0x1e0c('0x38')](_[_0x1e0c('0x39')](_0x5e7e6f[_0x1e0c('0x2f')],_0x23efc0[_0x1e0c('0x38')]),_0x2c7593);if(_0x5e7e6f['query'][_0x1e0c('0x3a')]){_0x1a6a87[_0x1e0c('0x37')]=_[_0x1e0c('0x3b')](_0x1a6a87[_0x1e0c('0x37')],{'$or':_[_0x1e0c('0x2d')](_0x2c7593,function(_0x208d98){if(_0x208d98['type']!==_0x1e0c('0x3c')){var _0x1f79a7={};_0x1f79a7[_0x208d98[_0x1e0c('0x26')]]={'$like':'%'+_0x5e7e6f[_0x1e0c('0x2f')][_0x1e0c('0x3a')]+'%'};return _0x1f79a7;}})});}_0x1a6a87=_[_0x1e0c('0x3b')]({},_0x1a6a87,_0x5e7e6f['options']);var _0x12b779={'where':_0x1a6a87[_0x1e0c('0x37')]};return db['SquareReport'][_0x1e0c('0x1a')](_0x12b779)[_0x1e0c('0x3d')](function(_0x554464){_0x2d8c99['count']=_0x554464;if(_0x5e7e6f[_0x1e0c('0x2f')][_0x1e0c('0x3e')]){_0x1a6a87[_0x1e0c('0x3f')]=[{'all':!![]}];}return db[_0x1e0c('0x29')]['findAll'](_0x1a6a87);})['then'](function(_0x477dfb){_0x2d8c99['rows']=_0x477dfb;return _0x2d8c99;})[_0x1e0c('0x3d')](respondWithFilteredResult(_0xef59ad,_0x1a6a87))[_0x1e0c('0x40')](handleError(_0xef59ad,null));};exports[_0x1e0c('0x41')]=function(_0x510579,_0x5760b6){var _0xa9d8f5={'raw':!![],'where':{'id':_0x510579[_0x1e0c('0x42')]['id']}},_0x4bb520={};_0x4bb520['model']=_[_0x1e0c('0x2e')](db['SquareReport'][_0x1e0c('0x43')]);_0x4bb520['query']=_[_0x1e0c('0x2e')](_0x510579[_0x1e0c('0x2f')]);_0x4bb520[_0x1e0c('0x38')]=_[_0x1e0c('0x31')](_0x4bb520[_0x1e0c('0x2c')],_0x4bb520[_0x1e0c('0x2f')]);_0xa9d8f5['attributes']=_['intersection'](_0x4bb520[_0x1e0c('0x2c')],qs[_0x1e0c('0x32')](_0x510579[_0x1e0c('0x2f')][_0x1e0c('0x32')]));_0xa9d8f5[_0x1e0c('0x30')]=_0xa9d8f5[_0x1e0c('0x30')]['length']?_0xa9d8f5[_0x1e0c('0x30')]:_0x4bb520[_0x1e0c('0x2c')];if(_0x510579['query']['includeAll']){_0xa9d8f5[_0x1e0c('0x3f')]=[{'all':!![]}];}_0xa9d8f5=_[_0x1e0c('0x3b')]({},_0xa9d8f5,_0x510579[_0x1e0c('0x44')]);return db[_0x1e0c('0x29')][_0x1e0c('0x45')](_0xa9d8f5)[_0x1e0c('0x3d')](handleEntityNotFound(_0x5760b6,null))[_0x1e0c('0x3d')](respondWithResult(_0x5760b6,null))[_0x1e0c('0x40')](handleError(_0x5760b6,null));};exports[_0x1e0c('0x46')]=function(_0x2d5366,_0x50564d){return db[_0x1e0c('0x29')]['create'](_0x2d5366[_0x1e0c('0x47')],{})['then'](respondWithResult(_0x50564d,0xc9))[_0x1e0c('0x40')](handleError(_0x50564d,null));};exports[_0x1e0c('0x22')]=function(_0xc205ec,_0x27ef03){if(_0xc205ec[_0x1e0c('0x47')]['id']){delete _0xc205ec[_0x1e0c('0x47')]['id'];}return db[_0x1e0c('0x29')][_0x1e0c('0x45')]({'where':{'id':_0xc205ec['params']['id']}})['then'](handleEntityNotFound(_0x27ef03,null))[_0x1e0c('0x3d')](saveUpdates(_0xc205ec[_0x1e0c('0x47')],null))[_0x1e0c('0x3d')](respondWithResult(_0x27ef03,null))['catch'](handleError(_0x27ef03,null));};exports[_0x1e0c('0x23')]=function(_0x13b962,_0x4319a3){return db['SquareReport']['find']({'where':{'id':_0x13b962[_0x1e0c('0x42')]['id']}})[_0x1e0c('0x3d')](handleEntityNotFound(_0x4319a3,null))['then'](removeEntity(_0x4319a3,null))[_0x1e0c('0x40')](handleError(_0x4319a3,null));};exports[_0x1e0c('0x48')]=function(_0x274296,_0x4b81ed){return db[_0x1e0c('0x29')]['describe']()[_0x1e0c('0x3d')](respondWithResult(_0x4b81ed,null))[_0x1e0c('0x40')](handleError(_0x4b81ed,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index fe85269..50e928c 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 _0x79ae=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','define','report_square','uid_pname','uniqueid','project_name','leaveAt'];(function(_0x2eb0ca,_0x313d32){var _0x17cf42=function(_0x229de1){while(--_0x229de1){_0x2eb0ca['push'](_0x2eb0ca['shift']());}};_0x17cf42(++_0x313d32);}(_0x79ae,0x1e0));var _0xe79a=function(_0x470fa,_0x4a7050){_0x470fa=_0x470fa-0x0;var _0x1634ea=_0x79ae[_0x470fa];return _0x1634ea;};'use strict';var _=require(_0xe79a('0x0'));var util=require('util');var logger=require(_0xe79a('0x1'))(_0xe79a('0x2'));var moment=require(_0xe79a('0x3'));var BPromise=require(_0xe79a('0x4'));var rp=require(_0xe79a('0x5'));var fs=require('fs');var path=require(_0xe79a('0x6'));var rimraf=require(_0xe79a('0x7'));var config=require(_0xe79a('0x8'));var attributes=require(_0xe79a('0x9'));module['exports']=function(_0x38cc27,_0xacc50a){return _0x38cc27[_0xe79a('0xa')]('SquareReport',attributes,{'tableName':_0xe79a('0xb'),'paranoid':![],'indexes':[{'name':_0xe79a('0xc'),'fields':[_0xe79a('0xd'),_0xe79a('0xe')]},{'name':_0xe79a('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfff5=['bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfff5,0xcc));var _0x5fff=function(_0x40ea14,_0x160f48){_0x40ea14=_0x40ea14-0x0;var _0x15a2cb=_0xfff5[_0x40ea14];return _0x15a2cb;};'use strict';var _=require(_0x5fff('0x0'));var util=require(_0x5fff('0x1'));var logger=require(_0x5fff('0x2'))('api');var moment=require(_0x5fff('0x3'));var BPromise=require(_0x5fff('0x4'));var rp=require(_0x5fff('0x5'));var fs=require('fs');var path=require(_0x5fff('0x6'));var rimraf=require('rimraf');var config=require(_0x5fff('0x7'));var attributes=require(_0x5fff('0x8'));module[_0x5fff('0x9')]=function(_0xfbb78e,_0x5673b4){return _0xfbb78e[_0x5fff('0xa')](_0x5fff('0xb'),attributes,{'tableName':_0x5fff('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x5fff('0xd'),_0x5fff('0xe')]},{'name':'leaveAt','fields':[_0x5fff('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 6cef345..618f86a 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 _0x46ed=['options','raw','CreateSquareReport','catch','UpdateSquareReport','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','create','body'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x46ed,0x168));var _0xd46e=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x46ed[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var moment=require('moment');var BPromise=require(_0xd46e('0x2'));var rs=require(_0xd46e('0x3'));var fs=require('fs');var Redis=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd46e('0x5'));var logger=require(_0xd46e('0x6'))('rpc');var config=require(_0xd46e('0x7'));var jayson=require(_0xd46e('0x8'));var client=jayson[_0xd46e('0x9')][_0xd46e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){return client[_0xd46e('0xb')](_0x45e680,_0x437ea0)[_0xd46e('0xc')](function(_0x59c88d){logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,'request\x20sent');logger[_0xd46e('0xf')](_0xd46e('0x10'),_0x855f24,_0xd46e('0x11'),JSON[_0xd46e('0x12')](_0x59c88d));if(_0x59c88d[_0xd46e('0x13')]){if(_0x59c88d[_0xd46e('0x13')]['code']===0x1f4){logger[_0xd46e('0x13')]('SquareReport,\x20%s,\x20%s',_0x855f24,_0x59c88d['error'][_0xd46e('0x14')]);return _0x31259b(_0x59c88d[_0xd46e('0x13')]['message']);}logger['error'](_0xd46e('0xe'),_0x855f24,_0x59c88d[_0xd46e('0x13')][_0xd46e('0x14')]);return _0x144687(_0x59c88d[_0xd46e('0x13')]['message']);}else{logger[_0xd46e('0xd')](_0xd46e('0xe'),_0x855f24,_0xd46e('0x11'));_0x144687(_0x59c88d[_0xd46e('0x15')][_0xd46e('0x14')]);}})['catch'](function(_0x1d50a5){logger[_0xd46e('0x13')](_0xd46e('0xe'),_0x855f24,_0x1d50a5);_0x31259b(_0x1d50a5);});});}exports['CreateSquareReport']=function(_0x5ddd04){var _0x2e8f6d=this;return new Promise(function(_0x1bd574,_0x488690){return db['SquareReport'][_0xd46e('0x16')](_0x5ddd04[_0xd46e('0x17')],{'raw':_0x5ddd04[_0xd46e('0x18')]?_0x5ddd04[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![]})[_0xd46e('0xc')](function(_0x3b5fa4){logger[_0xd46e('0xd')](_0xd46e('0x1a'),_0x5ddd04);logger[_0xd46e('0xf')](_0xd46e('0x1a'),_0x5ddd04,JSON['stringify'](_0x3b5fa4));_0x1bd574(_0x3b5fa4);})[_0xd46e('0x1b')](function(_0x1c83fa){logger[_0xd46e('0x13')](_0xd46e('0x1a'),_0x1c83fa[_0xd46e('0x14')],_0x5ddd04);_0x488690(_0x2e8f6d[_0xd46e('0x13')](0x1f4,_0x1c83fa[_0xd46e('0x14')]));});});};exports[_0xd46e('0x1c')]=function(_0x62dea5){var _0x4cf899=this;return new Promise(function(_0x314570,_0x5424e5){return db['SquareReport'][_0xd46e('0x1d')](_0x62dea5[_0xd46e('0x17')],{'raw':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')]['where']||null:null,'attributes':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x1e')]||null:null,'limit':_0x62dea5[_0xd46e('0x18')]?_0x62dea5[_0xd46e('0x18')][_0xd46e('0x1f')]||null:null})['then'](function(_0x465d54){logger[_0xd46e('0xd')](_0xd46e('0x1c'),_0x62dea5);logger[_0xd46e('0xf')](_0xd46e('0x1c'),_0x62dea5,JSON[_0xd46e('0x12')](_0x465d54));_0x314570(_0x465d54);})[_0xd46e('0x1b')](function(_0x2c5ec7){logger[_0xd46e('0x13')](_0xd46e('0x1c'),_0x2c5ec7[_0xd46e('0x14')],_0x62dea5);_0x5424e5(_0x4cf899[_0xd46e('0x13')](0x1f4,_0x2c5ec7[_0xd46e('0x14')]));});});}; \ No newline at end of file +var _0xf2ca=['then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','update','where','attributes','limit'];(function(_0x2d016a,_0x4b0f51){var _0x261513=function(_0x51942e){while(--_0x51942e){_0x2d016a['push'](_0x2d016a['shift']());}};_0x261513(++_0x4b0f51);}(_0xf2ca,0x16a));var _0xaf2c=function(_0xed9fea,_0x5ed774){_0xed9fea=_0xed9fea-0x0;var _0x198f12=_0xf2ca[_0xed9fea];return _0x198f12;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var moment=require(_0xaf2c('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf2c('0x3'));var fs=require('fs');var Redis=require(_0xaf2c('0x4'));var db=require(_0xaf2c('0x5'))['db'];var utils=require(_0xaf2c('0x6'));var logger=require(_0xaf2c('0x7'))(_0xaf2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf2c('0x9'));var client=jayson[_0xaf2c('0xa')][_0xaf2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f9531,_0x58351f,_0x37fedd){return new BPromise(function(_0x3c0421,_0x4a7397){return client[_0xaf2c('0xc')](_0x1f9531,_0x37fedd)['then'](function(_0x439ca3){logger['info'](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));logger[_0xaf2c('0xf')](_0xaf2c('0x10'),_0x58351f,'request\x20sent',JSON['stringify'](_0x439ca3));if(_0x439ca3[_0xaf2c('0x11')]){if(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x12')]===0x1f4){logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3['error']['message']);return _0x4a7397(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}logger[_0xaf2c('0x11')](_0xaf2c('0xd'),_0x58351f,_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);return _0x3c0421(_0x439ca3[_0xaf2c('0x11')][_0xaf2c('0x13')]);}else{logger[_0xaf2c('0x14')](_0xaf2c('0xd'),_0x58351f,_0xaf2c('0xe'));_0x3c0421(_0x439ca3[_0xaf2c('0x15')][_0xaf2c('0x13')]);}})[_0xaf2c('0x16')](function(_0x705d09){logger['error'](_0xaf2c('0xd'),_0x58351f,_0x705d09);_0x4a7397(_0x705d09);});});}exports['CreateSquareReport']=function(_0x278a28){var _0x474c80=this;return new Promise(function(_0x1d544a,_0x578492){return db[_0xaf2c('0x17')][_0xaf2c('0x18')](_0x278a28[_0xaf2c('0x19')],{'raw':_0x278a28[_0xaf2c('0x1a')]?_0x278a28[_0xaf2c('0x1a')][_0xaf2c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x35e712){logger[_0xaf2c('0x14')](_0xaf2c('0x1c'),_0x278a28);logger[_0xaf2c('0xf')](_0xaf2c('0x1c'),_0x278a28,JSON['stringify'](_0x35e712));_0x1d544a(_0x35e712);})[_0xaf2c('0x16')](function(_0xbf6f62){logger[_0xaf2c('0x11')]('CreateSquareReport',_0xbf6f62['message'],_0x278a28);_0x578492(_0x474c80[_0xaf2c('0x11')](0x1f4,_0xbf6f62[_0xaf2c('0x13')]));});});};exports[_0xaf2c('0x1d')]=function(_0x99f78d){var _0x591aff=this;return new Promise(function(_0x2b8f1a,_0xf1a7cf){return db[_0xaf2c('0x17')][_0xaf2c('0x1e')](_0x99f78d[_0xaf2c('0x19')],{'raw':_0x99f78d[_0xaf2c('0x1a')]?_0x99f78d[_0xaf2c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x99f78d[_0xaf2c('0x1a')]?_0x99f78d[_0xaf2c('0x1a')][_0xaf2c('0x1f')]||null:null,'attributes':_0x99f78d[_0xaf2c('0x1a')]?_0x99f78d['options'][_0xaf2c('0x20')]||null:null,'limit':_0x99f78d['options']?_0x99f78d[_0xaf2c('0x1a')][_0xaf2c('0x21')]||null:null})[_0xaf2c('0x22')](function(_0x5d685a){logger[_0xaf2c('0x14')](_0xaf2c('0x1d'),_0x99f78d);logger[_0xaf2c('0xf')]('UpdateSquareReport',_0x99f78d,JSON[_0xaf2c('0x23')](_0x5d685a));_0x2b8f1a(_0x5d685a);})[_0xaf2c('0x16')](function(_0x42e2a5){logger[_0xaf2c('0x11')]('UpdateSquareReport',_0x42e2a5[_0xaf2c('0x13')],_0x99f78d);_0xf1a7cf(_0x591aff[_0xaf2c('0x11')](0x1f4,_0x42e2a5[_0xaf2c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 63c45e5..9eb3df5 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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x483465,_0x405d2e){var _0x2dffb4=function(_0x22e33e){while(--_0x22e33e){_0x483465['push'](_0x483465['shift']());}};_0x2dffb4(++_0x405d2e);}(_0x7a54,0x106));var _0x47a5=function(_0x12ceff,_0xbaad2d){_0x12ceff=_0x12ceff-0x0;var _0x442bff=_0x7a54[_0x12ceff];return _0x442bff;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x814b,0x1a2));var _0xb814=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x814b[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f5dea45..139f665 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 _0xd251=['TEXT','sequelize','exports','STRING'];(function(_0x149cf0,_0x55c9a1){var _0x350d0d=function(_0x333496){while(--_0x333496){_0x149cf0['push'](_0x149cf0['shift']());}};_0x350d0d(++_0x55c9a1);}(_0xd251,0x1a1));var _0x1d25=function(_0x1fcddb,_0x304947){_0x1fcddb=_0x1fcddb-0x0;var _0x5a6b79=_0xd251[_0x1fcddb];return _0x5a6b79;};'use strict';var Sequelize=require(_0x1d25('0x0'));module[_0x1d25('0x1')]={'uniqueid':{'type':Sequelize[_0x1d25('0x2')]},'node':{'type':Sequelize[_0x1d25('0x2')]},'application':{'type':Sequelize[_0x1d25('0x2')]},'data':{'type':Sequelize[_0x1d25('0x3')]},'project_name':{'type':Sequelize[_0x1d25('0x2')]},'callerid':{'type':Sequelize[_0x1d25('0x2')]}}; \ No newline at end of file +var _0xc8a5=['exports','STRING','sequelize'];(function(_0x5020c2,_0x1f04d4){var _0x2b3cb7=function(_0x1c920){while(--_0x1c920){_0x5020c2['push'](_0x5020c2['shift']());}};_0x2b3cb7(++_0x1f04d4);}(_0xc8a5,0xfb));var _0x5c8a=function(_0x5e2074,_0x584499){_0x5e2074=_0x5e2074-0x0;var _0x1d032e=_0xc8a5[_0x5e2074];return _0x1d032e;};'use strict';var Sequelize=require(_0x5c8a('0x0'));module[_0x5c8a('0x1')]={'uniqueid':{'type':Sequelize[_0x5c8a('0x2')]},'node':{'type':Sequelize[_0x5c8a('0x2')]},'application':{'type':Sequelize[_0x5c8a('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x5c8a('0x2')]},'callerid':{'type':Sequelize[_0x5c8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index d570dd6..b075254 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 _0x1402=['index','SquareDetailsReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','params','keys','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send'];(function(_0x735462,_0x17f743){var _0x581a73=function(_0x5b51b2){while(--_0x5b51b2){_0x735462['push'](_0x735462['shift']());}};_0x581a73(++_0x17f743);}(_0x1402,0xba));var _0x2140=function(_0xff6d6,_0x55c0ea){_0xff6d6=_0xff6d6-0x0;var _0x1d3f22=_0x1402[_0xff6d6];return _0x1d3f22;};'use strict';var pdf=require(_0x2140('0x0'));var emlformat=require(_0x2140('0x1'));var rimraf=require(_0x2140('0x2'));var zipdir=require(_0x2140('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2140('0x4'));var moment=require(_0x2140('0x5'));var BPromise=require(_0x2140('0x6'));var Mustache=require(_0x2140('0x7'));var util=require(_0x2140('0x8'));var path=require(_0x2140('0x9'));var sox=require(_0x2140('0xa'));var csv=require(_0x2140('0xb'));var ejs=require(_0x2140('0xc'));var fs=require('fs');var _=require(_0x2140('0xd'));var squel=require(_0x2140('0xe'));var crypto=require(_0x2140('0xf'));var jsforce=require(_0x2140('0x10'));var deskjs=require(_0x2140('0x11'));var toCsv=require(_0x2140('0xb'));var querystring=require(_0x2140('0x12'));var Papa=require(_0x2140('0x13'));var Redis=require(_0x2140('0x14'));var authService=require(_0x2140('0x15'));var qs=require(_0x2140('0x16'));var as=require(_0x2140('0x17'));var hardwareService=require(_0x2140('0x18'));var logger=require(_0x2140('0x19'))('api');var utils=require(_0x2140('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b7759,_0xaa5102){_0xaa5102=_0xaa5102||0xcc;return function(_0x96beff){if(_0x96beff){return _0x2b7759[_0x2140('0x1b')](_0xaa5102);}return _0x2b7759['status'](_0xaa5102)[_0x2140('0x1c')]();};}function respondWithResult(_0xd2ea20,_0x1adcce){_0x1adcce=_0x1adcce||0xc8;return function(_0xa61949){if(_0xa61949){return _0xd2ea20[_0x2140('0x1d')](_0x1adcce)[_0x2140('0x1e')](_0xa61949);}};}function respondWithFilteredResult(_0x33ce3e,_0x254a83){return function(_0x13508a){if(_0x13508a){var _0x24b109=_0x13508a[_0x2140('0x1f')],_0x46f1b4=_0x254a83['offset'],_0x3818bc=_0x254a83[_0x2140('0x20')]+_0x254a83['limit'],_0x2d4b55;if(_0x3818bc>=_0x24b109){_0x3818bc=_0x24b109;_0x2d4b55=0xc8;}else{_0x2d4b55=0xce;}_0x33ce3e[_0x2140('0x1d')](_0x2d4b55);return _0x33ce3e[_0x2140('0x21')](_0x2140('0x22'),_0x46f1b4+'-'+_0x3818bc+'/'+_0x24b109)[_0x2140('0x1e')](_0x13508a);}return null;};}function patchUpdates(_0x46b9a2){return function(_0x18c437){try{jsonpatch[_0x2140('0x23')](_0x18c437,_0x46b9a2,!![]);}catch(_0x49f7e9){return BPromise[_0x2140('0x24')](_0x49f7e9);}return _0x18c437[_0x2140('0x25')]();};}function saveUpdates(_0x362032,_0x563eec){return function(_0xf23463){if(_0xf23463){return _0xf23463[_0x2140('0x26')](_0x362032)['then'](function(_0x21dbb1){return _0x21dbb1;});}return null;};}function removeEntity(_0x1f0ce6,_0xb9988e){return function(_0x106920){if(_0x106920){return _0x106920[_0x2140('0x27')]()[_0x2140('0x28')](function(){_0x1f0ce6[_0x2140('0x1d')](0xcc)[_0x2140('0x1c')]();});}};}function handleEntityNotFound(_0x6c5f74,_0x514afb){return function(_0x3c81e2){if(!_0x3c81e2){_0x6c5f74[_0x2140('0x1b')](0x194);}return _0x3c81e2;};}function handleError(_0xb1c71a,_0xe6cb97){_0xe6cb97=_0xe6cb97||0x1f4;return function(_0x4728fd){logger[_0x2140('0x29')](_0x4728fd[_0x2140('0x2a')]);if(_0x4728fd[_0x2140('0x2b')]){delete _0x4728fd[_0x2140('0x2b')];}_0xb1c71a['status'](_0xe6cb97)[_0x2140('0x2c')](_0x4728fd);};}exports[_0x2140('0x2d')]=function(_0x4d8c01,_0x3a4ac9){var _0x33efca={},_0x170ce8={},_0x4e52ed={'count':0x0,'rows':[]};var _0x24be51=_['map'](db[_0x2140('0x2e')][_0x2140('0x2f')],function(_0x37ba7f){return{'name':_0x37ba7f['fieldName'],'type':_0x37ba7f[_0x2140('0x30')][_0x2140('0x31')]};});_0x170ce8['model']=_['map'](_0x24be51,_0x2140('0x2b'));_0x170ce8[_0x2140('0x32')]=_['keys'](_0x4d8c01[_0x2140('0x32')]);_0x170ce8[_0x2140('0x33')]=_[_0x2140('0x34')](_0x170ce8[_0x2140('0x35')],_0x170ce8[_0x2140('0x32')]);_0x33efca[_0x2140('0x36')]=_[_0x2140('0x34')](_0x170ce8[_0x2140('0x35')],qs[_0x2140('0x37')](_0x4d8c01[_0x2140('0x32')][_0x2140('0x37')]));_0x33efca['attributes']=_0x33efca['attributes'][_0x2140('0x38')]?_0x33efca[_0x2140('0x36')]:_0x170ce8['model'];if(!_0x4d8c01[_0x2140('0x32')]['hasOwnProperty'](_0x2140('0x39'))){_0x33efca[_0x2140('0x3a')]=qs[_0x2140('0x3a')](_0x4d8c01[_0x2140('0x32')][_0x2140('0x3a')]);_0x33efca['offset']=qs[_0x2140('0x20')](_0x4d8c01['query'][_0x2140('0x20')]);}_0x33efca[_0x2140('0x3b')]=qs[_0x2140('0x3c')](_0x4d8c01[_0x2140('0x32')][_0x2140('0x3c')]);_0x33efca[_0x2140('0x3d')]=qs[_0x2140('0x33')](_[_0x2140('0x3e')](_0x4d8c01[_0x2140('0x32')],_0x170ce8[_0x2140('0x33')]),_0x24be51);if(_0x4d8c01[_0x2140('0x32')][_0x2140('0x3f')]){_0x33efca[_0x2140('0x3d')]=_[_0x2140('0x40')](_0x33efca[_0x2140('0x3d')],{'$or':_[_0x2140('0x41')](_0x24be51,function(_0x1a1a74){if(_0x1a1a74['type']!=='VIRTUAL'){var _0x1087ac={};_0x1087ac[_0x1a1a74[_0x2140('0x2b')]]={'$like':'%'+_0x4d8c01[_0x2140('0x32')][_0x2140('0x3f')]+'%'};return _0x1087ac;}})});}_0x33efca=_[_0x2140('0x40')]({},_0x33efca,_0x4d8c01[_0x2140('0x42')]);var _0x43c1ed={'where':_0x33efca[_0x2140('0x3d')]};return db[_0x2140('0x2e')][_0x2140('0x1f')](_0x43c1ed)['then'](function(_0x2e2d09){_0x4e52ed[_0x2140('0x1f')]=_0x2e2d09;if(_0x4d8c01[_0x2140('0x32')][_0x2140('0x43')]){_0x33efca[_0x2140('0x44')]=[{'all':!![]}];}return db[_0x2140('0x2e')][_0x2140('0x45')](_0x33efca);})['then'](function(_0x15e9b8){_0x4e52ed['rows']=_0x15e9b8;return _0x4e52ed;})[_0x2140('0x28')](respondWithFilteredResult(_0x3a4ac9,_0x33efca))['catch'](handleError(_0x3a4ac9,null));};exports['show']=function(_0x3b38b5,_0x4e9252){var _0x50f64b={'raw':!![],'where':{'id':_0x3b38b5[_0x2140('0x46')]['id']}},_0x37b877={};_0x37b877[_0x2140('0x35')]=_[_0x2140('0x47')](db[_0x2140('0x2e')][_0x2140('0x2f')]);_0x37b877[_0x2140('0x32')]=_[_0x2140('0x47')](_0x3b38b5[_0x2140('0x32')]);_0x37b877[_0x2140('0x33')]=_[_0x2140('0x34')](_0x37b877[_0x2140('0x35')],_0x37b877[_0x2140('0x32')]);_0x50f64b[_0x2140('0x36')]=_['intersection'](_0x37b877['model'],qs[_0x2140('0x37')](_0x3b38b5['query'][_0x2140('0x37')]));_0x50f64b['attributes']=_0x50f64b[_0x2140('0x36')]['length']?_0x50f64b[_0x2140('0x36')]:_0x37b877[_0x2140('0x35')];if(_0x3b38b5[_0x2140('0x32')][_0x2140('0x43')]){_0x50f64b['include']=[{'all':!![]}];}_0x50f64b=_[_0x2140('0x40')]({},_0x50f64b,_0x3b38b5[_0x2140('0x42')]);return db['SquareDetailsReport'][_0x2140('0x48')](_0x50f64b)['then'](handleEntityNotFound(_0x4e9252,null))['then'](respondWithResult(_0x4e9252,null))[_0x2140('0x49')](handleError(_0x4e9252,null));};exports[_0x2140('0x4a')]=function(_0x57102d,_0x4651ab){return db[_0x2140('0x2e')][_0x2140('0x4a')](_0x57102d[_0x2140('0x4b')],{})[_0x2140('0x28')](respondWithResult(_0x4651ab,0xc9))[_0x2140('0x49')](handleError(_0x4651ab,null));};exports[_0x2140('0x26')]=function(_0x54b07e,_0x4795d0){if(_0x54b07e[_0x2140('0x4b')]['id']){delete _0x54b07e[_0x2140('0x4b')]['id'];}return db[_0x2140('0x2e')]['find']({'where':{'id':_0x54b07e['params']['id']}})[_0x2140('0x28')](handleEntityNotFound(_0x4795d0,null))[_0x2140('0x28')](saveUpdates(_0x54b07e[_0x2140('0x4b')],null))[_0x2140('0x28')](respondWithResult(_0x4795d0,null))['catch'](handleError(_0x4795d0,null));};exports[_0x2140('0x27')]=function(_0x33cf66,_0x1e0c1d){return db[_0x2140('0x2e')][_0x2140('0x48')]({'where':{'id':_0x33cf66[_0x2140('0x46')]['id']}})[_0x2140('0x28')](handleEntityNotFound(_0x1e0c1d,null))[_0x2140('0x28')](removeEntity(_0x1e0c1d,null))[_0x2140('0x49')](handleError(_0x1e0c1d,null));};exports[_0x2140('0x4c')]=function(_0x13b1f1,_0x1a098b){return db[_0x2140('0x2e')]['describe']()[_0x2140('0x28')](respondWithResult(_0x1a098b,null))[_0x2140('0x49')](handleError(_0x1a098b,null));}; \ No newline at end of file +var _0x213c=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','set','Content-Range','apply','reject','destroy','then','end','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','catch','find','create','body','params','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xa2dc92,_0x1f6588){var _0x236a0f=function(_0x447de8){while(--_0x447de8){_0xa2dc92['push'](_0xa2dc92['shift']());}};_0x236a0f(++_0x1f6588);}(_0x213c,0xc4));var _0xc213=function(_0x4352c2,_0xc226f5){_0x4352c2=_0x4352c2-0x0;var _0x3bcf30=_0x213c[_0x4352c2];return _0x3bcf30;};'use strict';var pdf=require(_0xc213('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc213('0x1'));var zipdir=require(_0xc213('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc213('0x3'));var moment=require(_0xc213('0x4'));var BPromise=require(_0xc213('0x5'));var Mustache=require(_0xc213('0x6'));var util=require(_0xc213('0x7'));var path=require(_0xc213('0x8'));var sox=require(_0xc213('0x9'));var csv=require('to-csv');var ejs=require(_0xc213('0xa'));var fs=require('fs');var _=require(_0xc213('0xb'));var squel=require(_0xc213('0xc'));var crypto=require(_0xc213('0xd'));var jsforce=require(_0xc213('0xe'));var deskjs=require(_0xc213('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc213('0x10'));var Redis=require(_0xc213('0x11'));var authService=require(_0xc213('0x12'));var qs=require(_0xc213('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc213('0x14'));var logger=require(_0xc213('0x15'))('api');var utils=require(_0xc213('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc213('0x17'));var db=require(_0xc213('0x18'))['db'];function respondWithStatusCode(_0x11c662,_0x4bb139){_0x4bb139=_0x4bb139||0xcc;return function(_0x268154){if(_0x268154){return _0x11c662['sendStatus'](_0x4bb139);}return _0x11c662['status'](_0x4bb139)['end']();};}function respondWithResult(_0x44893d,_0x3dc4e0){_0x3dc4e0=_0x3dc4e0||0xc8;return function(_0x472dd4){if(_0x472dd4){return _0x44893d[_0xc213('0x19')](_0x3dc4e0)[_0xc213('0x1a')](_0x472dd4);}};}function respondWithFilteredResult(_0x5ab266,_0x3e5cd1){return function(_0x31117b){if(_0x31117b){var _0x36f294=_0x31117b['count'],_0x485f09=_0x3e5cd1['offset'],_0x1e706b=_0x3e5cd1[_0xc213('0x1b')]+_0x3e5cd1[_0xc213('0x1c')],_0x161722;if(_0x1e706b>=_0x36f294){_0x1e706b=_0x36f294;_0x161722=0xc8;}else{_0x161722=0xce;}_0x5ab266[_0xc213('0x19')](_0x161722);return _0x5ab266[_0xc213('0x1d')](_0xc213('0x1e'),_0x485f09+'-'+_0x1e706b+'/'+_0x36f294)[_0xc213('0x1a')](_0x31117b);}return null;};}function patchUpdates(_0x514ac4){return function(_0x1afb4c){try{jsonpatch[_0xc213('0x1f')](_0x1afb4c,_0x514ac4,!![]);}catch(_0x2a139e){return BPromise[_0xc213('0x20')](_0x2a139e);}return _0x1afb4c['save']();};}function saveUpdates(_0x315f94,_0x3198b5){return function(_0x431f98){if(_0x431f98){return _0x431f98['update'](_0x315f94)['then'](function(_0xa1ae0){return _0xa1ae0;});}return null;};}function removeEntity(_0x1f759d,_0xcbac83){return function(_0x5e9cb4){if(_0x5e9cb4){return _0x5e9cb4[_0xc213('0x21')]()[_0xc213('0x22')](function(){_0x1f759d['status'](0xcc)[_0xc213('0x23')]();});}};}function handleEntityNotFound(_0x3232bc,_0x816535){return function(_0x112a56){if(!_0x112a56){_0x3232bc['sendStatus'](0x194);}return _0x112a56;};}function handleError(_0x544483,_0x223ebc){_0x223ebc=_0x223ebc||0x1f4;return function(_0x57bf57){logger[_0xc213('0x24')](_0x57bf57['stack']);if(_0x57bf57[_0xc213('0x25')]){delete _0x57bf57['name'];}_0x544483[_0xc213('0x19')](_0x223ebc)[_0xc213('0x26')](_0x57bf57);};}exports[_0xc213('0x27')]=function(_0x3cef48,_0x4b038b){var _0x53d8f4={},_0x2fcb4e={},_0x47fd0e={'count':0x0,'rows':[]};var _0x16aa6f=_[_0xc213('0x28')](db[_0xc213('0x29')][_0xc213('0x2a')],function(_0xb35e4){return{'name':_0xb35e4[_0xc213('0x2b')],'type':_0xb35e4['type'][_0xc213('0x2c')]};});_0x2fcb4e['model']=_[_0xc213('0x28')](_0x16aa6f,_0xc213('0x25'));_0x2fcb4e[_0xc213('0x2d')]=_[_0xc213('0x2e')](_0x3cef48[_0xc213('0x2d')]);_0x2fcb4e[_0xc213('0x2f')]=_['intersection'](_0x2fcb4e[_0xc213('0x30')],_0x2fcb4e[_0xc213('0x2d')]);_0x53d8f4[_0xc213('0x31')]=_[_0xc213('0x32')](_0x2fcb4e[_0xc213('0x30')],qs['fields'](_0x3cef48[_0xc213('0x2d')][_0xc213('0x33')]));_0x53d8f4[_0xc213('0x31')]=_0x53d8f4[_0xc213('0x31')][_0xc213('0x34')]?_0x53d8f4[_0xc213('0x31')]:_0x2fcb4e[_0xc213('0x30')];if(!_0x3cef48[_0xc213('0x2d')][_0xc213('0x35')](_0xc213('0x36'))){_0x53d8f4[_0xc213('0x1c')]=qs[_0xc213('0x1c')](_0x3cef48[_0xc213('0x2d')]['limit']);_0x53d8f4[_0xc213('0x1b')]=qs['offset'](_0x3cef48[_0xc213('0x2d')]['offset']);}_0x53d8f4['order']=qs[_0xc213('0x37')](_0x3cef48[_0xc213('0x2d')]['sort']);_0x53d8f4[_0xc213('0x38')]=qs[_0xc213('0x2f')](_[_0xc213('0x39')](_0x3cef48[_0xc213('0x2d')],_0x2fcb4e[_0xc213('0x2f')]),_0x16aa6f);if(_0x3cef48[_0xc213('0x2d')][_0xc213('0x3a')]){_0x53d8f4[_0xc213('0x38')]=_[_0xc213('0x3b')](_0x53d8f4[_0xc213('0x38')],{'$or':_[_0xc213('0x28')](_0x16aa6f,function(_0x248f3d){if(_0x248f3d[_0xc213('0x3c')]!==_0xc213('0x3d')){var _0x5da311={};_0x5da311[_0x248f3d[_0xc213('0x25')]]={'$like':'%'+_0x3cef48['query']['filter']+'%'};return _0x5da311;}})});}_0x53d8f4=_[_0xc213('0x3b')]({},_0x53d8f4,_0x3cef48[_0xc213('0x3e')]);var _0x2a29b9={'where':_0x53d8f4[_0xc213('0x38')]};return db['SquareDetailsReport'][_0xc213('0x3f')](_0x2a29b9)[_0xc213('0x22')](function(_0x344ff6){_0x47fd0e['count']=_0x344ff6;if(_0x3cef48['query']['includeAll']){_0x53d8f4[_0xc213('0x40')]=[{'all':!![]}];}return db[_0xc213('0x29')][_0xc213('0x41')](_0x53d8f4);})[_0xc213('0x22')](function(_0x1a45d1){_0x47fd0e['rows']=_0x1a45d1;return _0x47fd0e;})[_0xc213('0x22')](respondWithFilteredResult(_0x4b038b,_0x53d8f4))[_0xc213('0x42')](handleError(_0x4b038b,null));};exports['show']=function(_0x186ec1,_0x52658a){var _0x407c23={'raw':!![],'where':{'id':_0x186ec1['params']['id']}},_0x44fe08={};_0x44fe08[_0xc213('0x30')]=_[_0xc213('0x2e')](db[_0xc213('0x29')][_0xc213('0x2a')]);_0x44fe08['query']=_[_0xc213('0x2e')](_0x186ec1['query']);_0x44fe08[_0xc213('0x2f')]=_[_0xc213('0x32')](_0x44fe08[_0xc213('0x30')],_0x44fe08['query']);_0x407c23[_0xc213('0x31')]=_[_0xc213('0x32')](_0x44fe08[_0xc213('0x30')],qs[_0xc213('0x33')](_0x186ec1[_0xc213('0x2d')]['fields']));_0x407c23[_0xc213('0x31')]=_0x407c23[_0xc213('0x31')][_0xc213('0x34')]?_0x407c23['attributes']:_0x44fe08['model'];if(_0x186ec1[_0xc213('0x2d')]['includeAll']){_0x407c23[_0xc213('0x40')]=[{'all':!![]}];}_0x407c23=_[_0xc213('0x3b')]({},_0x407c23,_0x186ec1[_0xc213('0x3e')]);return db[_0xc213('0x29')][_0xc213('0x43')](_0x407c23)[_0xc213('0x22')](handleEntityNotFound(_0x52658a,null))[_0xc213('0x22')](respondWithResult(_0x52658a,null))['catch'](handleError(_0x52658a,null));};exports[_0xc213('0x44')]=function(_0x2b8e6d,_0x39b267){return db[_0xc213('0x29')]['create'](_0x2b8e6d[_0xc213('0x45')],{})[_0xc213('0x22')](respondWithResult(_0x39b267,0xc9))[_0xc213('0x42')](handleError(_0x39b267,null));};exports['update']=function(_0x167b38,_0x534acd){if(_0x167b38['body']['id']){delete _0x167b38[_0xc213('0x45')]['id'];}return db[_0xc213('0x29')]['find']({'where':{'id':_0x167b38[_0xc213('0x46')]['id']}})[_0xc213('0x22')](handleEntityNotFound(_0x534acd,null))[_0xc213('0x22')](saveUpdates(_0x167b38['body'],null))['then'](respondWithResult(_0x534acd,null))[_0xc213('0x42')](handleError(_0x534acd,null));};exports[_0xc213('0x21')]=function(_0x88f2af,_0x17f368){return db['SquareDetailsReport'][_0xc213('0x43')]({'where':{'id':_0x88f2af['params']['id']}})[_0xc213('0x22')](handleEntityNotFound(_0x17f368,null))[_0xc213('0x22')](removeEntity(_0x17f368,null))[_0xc213('0x42')](handleError(_0x17f368,null));};exports[_0xc213('0x47')]=function(_0x5d8f5e,_0x23b9a5){return db['SquareDetailsReport'][_0xc213('0x47')]()[_0xc213('0x22')](respondWithResult(_0x23b9a5,null))[_0xc213('0x42')](handleError(_0x23b9a5,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 544c9c6..6fb7ec9 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 _0x6b8a=['request-promise','path','rimraf','exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x55cc4a,_0x3ce0e4){var _0x543d48=function(_0x30399a){while(--_0x30399a){_0x55cc4a['push'](_0x55cc4a['shift']());}};_0x543d48(++_0x3ce0e4);}(_0x6b8a,0x1b7));var _0xa6b8=function(_0x5a5e7a,_0x54c93e){_0x5a5e7a=_0x5a5e7a-0x0;var _0x2482ba=_0x6b8a[_0x5a5e7a];return _0x2482ba;};'use strict';var _=require(_0xa6b8('0x0'));var util=require(_0xa6b8('0x1'));var logger=require(_0xa6b8('0x2'))(_0xa6b8('0x3'));var moment=require(_0xa6b8('0x4'));var BPromise=require('bluebird');var rp=require(_0xa6b8('0x5'));var fs=require('fs');var path=require(_0xa6b8('0x6'));var rimraf=require(_0xa6b8('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module[_0xa6b8('0x8')]=function(_0x560c5e,_0x5bb28a){return _0x560c5e[_0xa6b8('0x9')](_0xa6b8('0xa'),attributes,{'tableName':_0xa6b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x029a=['report_square_details','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','SquareDetailsReport'];(function(_0x5e3a03,_0x2f9925){var _0x4a8548=function(_0x75336f){while(--_0x75336f){_0x5e3a03['push'](_0x5e3a03['shift']());}};_0x4a8548(++_0x2f9925);}(_0x029a,0xb5));var _0xa029=function(_0x4e627e,_0x51d5d2){_0x4e627e=_0x4e627e-0x0;var _0x46da3e=_0x029a[_0x4e627e];return _0x46da3e;};'use strict';var _=require('lodash');var util=require(_0xa029('0x0'));var logger=require(_0xa029('0x1'))('api');var moment=require(_0xa029('0x2'));var BPromise=require('bluebird');var rp=require(_0xa029('0x3'));var fs=require('fs');var path=require(_0xa029('0x4'));var rimraf=require('rimraf');var config=require(_0xa029('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0xa029('0x6')]=function(_0x525520,_0x22ac41){return _0x525520[_0xa029('0x7')](_0xa029('0x8'),attributes,{'tableName':_0xa029('0x9'),'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 6c0ea2b..f990b6c 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 _0x4c6e=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateSquareDetailsReport','create','body','options','raw'];(function(_0x445332,_0x59cdb2){var _0x425025=function(_0x37a535){while(--_0x37a535){_0x445332['push'](_0x445332['shift']());}};_0x425025(++_0x59cdb2);}(_0x4c6e,0x146));var _0xe4c6=function(_0xb1840,_0x42cb61){_0xb1840=_0xb1840-0x0;var _0x4758b3=_0x4c6e[_0xb1840];return _0x4758b3;};'use strict';var _=require(_0xe4c6('0x0'));var util=require(_0xe4c6('0x1'));var moment=require(_0xe4c6('0x2'));var BPromise=require(_0xe4c6('0x3'));var rs=require(_0xe4c6('0x4'));var fs=require('fs');var Redis=require(_0xe4c6('0x5'));var db=require(_0xe4c6('0x6'))['db'];var utils=require(_0xe4c6('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe4c6('0x8')][_0xe4c6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5efe3d,_0x2dee86,_0x1e141b){return new BPromise(function(_0x1dfa3d,_0x3c5314){return client[_0xe4c6('0xa')](_0x5efe3d,_0x1e141b)[_0xe4c6('0xb')](function(_0xf45f8f){logger[_0xe4c6('0xc')](_0xe4c6('0xd'),_0x2dee86,_0xe4c6('0xe'));logger['debug'](_0xe4c6('0xf'),_0x2dee86,_0xe4c6('0xe'),JSON['stringify'](_0xf45f8f));if(_0xf45f8f['error']){if(_0xf45f8f['error']['code']===0x1f4){logger[_0xe4c6('0x10')](_0xe4c6('0xd'),_0x2dee86,_0xf45f8f[_0xe4c6('0x10')][_0xe4c6('0x11')]);return _0x3c5314(_0xf45f8f[_0xe4c6('0x10')]['message']);}logger[_0xe4c6('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2dee86,_0xf45f8f[_0xe4c6('0x10')][_0xe4c6('0x11')]);return _0x1dfa3d(_0xf45f8f[_0xe4c6('0x10')]['message']);}else{logger[_0xe4c6('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x2dee86,'request\x20sent');_0x1dfa3d(_0xf45f8f['result'][_0xe4c6('0x11')]);}})[_0xe4c6('0x12')](function(_0x1b1cdd){logger[_0xe4c6('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2dee86,_0x1b1cdd);_0x3c5314(_0x1b1cdd);});});}exports[_0xe4c6('0x13')]=function(_0x476c16){var _0x53730c=this;return new Promise(function(_0x3ddfe9,_0x40d3b3){return db['SquareDetailsReport'][_0xe4c6('0x14')](_0x476c16[_0xe4c6('0x15')],{'raw':_0x476c16[_0xe4c6('0x16')]?_0x476c16[_0xe4c6('0x16')][_0xe4c6('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3e8535){logger[_0xe4c6('0xc')](_0xe4c6('0x13'),_0x476c16);logger[_0xe4c6('0x18')](_0xe4c6('0x13'),_0x476c16,JSON['stringify'](_0x3e8535));_0x3ddfe9(_0x3e8535);})[_0xe4c6('0x12')](function(_0x1ade3f){logger[_0xe4c6('0x10')](_0xe4c6('0x13'),_0x1ade3f[_0xe4c6('0x11')],_0x476c16);_0x40d3b3(_0x53730c['error'](0x1f4,_0x1ade3f[_0xe4c6('0x11')]));});});}; \ No newline at end of file +var _0x71dd=['debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSquareDetailsReport','create','raw'];(function(_0x4ec13d,_0x358a8f){var _0x3c3fa7=function(_0x2615f6){while(--_0x2615f6){_0x4ec13d['push'](_0x4ec13d['shift']());}};_0x3c3fa7(++_0x358a8f);}(_0x71dd,0xfd));var _0xd71d=function(_0x19f5fc,_0x4c658a){_0x19f5fc=_0x19f5fc-0x0;var _0x315fa3=_0x71dd[_0x19f5fc];return _0x315fa3;};'use strict';var _=require(_0xd71d('0x0'));var util=require(_0xd71d('0x1'));var moment=require(_0xd71d('0x2'));var BPromise=require(_0xd71d('0x3'));var rs=require(_0xd71d('0x4'));var fs=require('fs');var Redis=require(_0xd71d('0x5'));var db=require(_0xd71d('0x6'))['db'];var utils=require(_0xd71d('0x7'));var logger=require(_0xd71d('0x8'))('rpc');var config=require(_0xd71d('0x9'));var jayson=require(_0xd71d('0xa'));var client=jayson[_0xd71d('0xb')][_0xd71d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x144e69,_0x41037f,_0x4c79b1){return new BPromise(function(_0xd0e5ff,_0x1c5224){return client[_0xd71d('0xd')](_0x144e69,_0x4c79b1)[_0xd71d('0xe')](function(_0x5dd4c1){logger['info'](_0xd71d('0xf'),_0x41037f,_0xd71d('0x10'));logger['debug'](_0xd71d('0x11'),_0x41037f,_0xd71d('0x10'),JSON[_0xd71d('0x12')](_0x5dd4c1));if(_0x5dd4c1['error']){if(_0x5dd4c1['error'][_0xd71d('0x13')]===0x1f4){logger[_0xd71d('0x14')](_0xd71d('0xf'),_0x41037f,_0x5dd4c1['error'][_0xd71d('0x15')]);return _0x1c5224(_0x5dd4c1[_0xd71d('0x14')]['message']);}logger['error'](_0xd71d('0xf'),_0x41037f,_0x5dd4c1['error'][_0xd71d('0x15')]);return _0xd0e5ff(_0x5dd4c1['error'][_0xd71d('0x15')]);}else{logger['info'](_0xd71d('0xf'),_0x41037f,_0xd71d('0x10'));_0xd0e5ff(_0x5dd4c1[_0xd71d('0x16')][_0xd71d('0x15')]);}})[_0xd71d('0x17')](function(_0x135a76){logger[_0xd71d('0x14')](_0xd71d('0xf'),_0x41037f,_0x135a76);_0x1c5224(_0x135a76);});});}exports[_0xd71d('0x18')]=function(_0x4b853b){var _0x31d55d=this;return new Promise(function(_0x46c514,_0x197c1a){return db['SquareDetailsReport'][_0xd71d('0x19')](_0x4b853b['body'],{'raw':_0x4b853b['options']?_0x4b853b['options'][_0xd71d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x48daf6){logger['info'](_0xd71d('0x18'),_0x4b853b);logger[_0xd71d('0x1b')](_0xd71d('0x18'),_0x4b853b,JSON[_0xd71d('0x12')](_0x48daf6));_0x46c514(_0x48daf6);})['catch'](function(_0x547768){logger['error'](_0xd71d('0x18'),_0x547768[_0xd71d('0x15')],_0x4b853b);_0x197c1a(_0x31d55d[_0xd71d('0x14')](0x1f4,_0x547768[_0xd71d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index c5d24cc..2439da6 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 _0x1d05=['exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess'];(function(_0x83ff27,_0x59ca21){var _0x289845=function(_0x5ede0c){while(--_0x5ede0c){_0x83ff27['push'](_0x83ff27['shift']());}};_0x289845(++_0x59ca21);}(_0x1d05,0x111));var _0x51d0=function(_0x5a8deb,_0x34a19d){_0x5a8deb=_0x5a8deb-0x0;var _0x44da13=_0x1d05[_0x5a8deb];return _0x44da13;};'use strict';var express=require('express');var router=express[_0x51d0('0x0')]();var auth=require(_0x51d0('0x1'));var controller=require(_0x51d0('0x2'));router[_0x51d0('0x3')]('/',auth[_0x51d0('0x4')](),controller['index']);router['get'](_0x51d0('0x5'),auth[_0x51d0('0x4')](),controller[_0x51d0('0x6')]);module[_0x51d0('0x7')]=router; \ No newline at end of file +var _0x539d=['killProcess','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x539d,0xc9));var _0xd539=function(_0xdb0cc5,_0x33653a){_0xdb0cc5=_0xdb0cc5-0x0;var _0x153aa=_0x539d[_0xdb0cc5];return _0x153aa;};'use strict';var express=require(_0xd539('0x0'));var router=express[_0xd539('0x1')]();var auth=require(_0xd539('0x2'));var controller=require(_0xd539('0x3'));router[_0xd539('0x4')]('/',auth[_0xd539('0x5')](),controller['index']);router[_0xd539('0x4')](_0xd539('0x6'),auth[_0xd539('0x5')](),controller[_0xd539('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index ffa0ee3..bbc1d6a 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 _0xdd34=['exec','../../config/logger','util','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','getAllData','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','pid','kill','SIGINT','systeminformation','child_process'];(function(_0x3328c2,_0x33f54f){var _0x2c3070=function(_0x375cee){while(--_0x375cee){_0x3328c2['push'](_0x3328c2['shift']());}};_0x2c3070(++_0x33f54f);}(_0xdd34,0xe8));var _0x4dd3=function(_0x5342c0,_0x5071b8){_0x5342c0=_0x5342c0-0x0;var _0x21376c=_0xdd34[_0x5342c0];return _0x21376c;};'use strict';var info=require(_0x4dd3('0x0'));var exec=require(_0x4dd3('0x1'))[_0x4dd3('0x2')];var logger=require(_0x4dd3('0x3'))('api');var util=require(_0x4dd3('0x4'));var BPromise=require('bluebird');var _=require(_0x4dd3('0x5'));function handleError(_0x43f2ac,_0x5447b6,_0x372cc8){_0x5447b6=_0x5447b6||0x1f4;return function(_0x3c61fd){logger[_0x4dd3('0x6')](_0x4dd3('0x7'),_0x372cc8,_0x5447b6,util[_0x4dd3('0x8')](_0x3c61fd,{'showHidden':![],'depth':null}));delete _0x3c61fd[_0x4dd3('0x9')];_0x43f2ac[_0x4dd3('0xa')](_0x5447b6)['send'](_0x3c61fd);};}exports['index']=function(_0x1e87b7,_0x1a8fe2){return info[_0x4dd3('0xb')]()[_0x4dd3('0xc')](function(_0x3ea494){return _0x1a8fe2[_0x4dd3('0xa')](0xc8)['json'](_0x3ea494);})[_0x4dd3('0xd')](function(_0x452b09){return _0x1a8fe2['status'](0x1f4)[_0x4dd3('0xe')](_0x452b09);});};exports[_0x4dd3('0xf')]=function(_0x4c81a9,_0xd689b3){var _0x50f40c=[_0x4dd3('0x10')];return new BPromise(function(_0x445daf,_0x4de85){return exec(util[_0x4dd3('0x11')](_0x4dd3('0x12'),_0x4c81a9[_0x4dd3('0x13')]['pid']),function(_0x54ae3a,_0x291b2f,_0x26ac35){if(_0x54ae3a){return _0x4de85(_0x54ae3a);}return _0x445daf(_0x291b2f);});})['then'](function(_0x6dada9){var _0x2bb91a=![];var _0x18976c=_0x6dada9[_0x4dd3('0x14')](/\n/);for(var _0x29c644=0x0,_0x112cdd=_0x50f40c[_0x4dd3('0x15')];_0x29c644<_0x112cdd,_0x2bb91a===![];_0x29c644+=0x1){if(_0x6dada9[_0x4dd3('0x16')](_0x50f40c[_0x29c644])>=0x0){_0x2bb91a=!![];}}if(!_0x2bb91a){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x4c81a9[_0x4dd3('0x13')][_0x4dd3('0x17')]));}process[_0x4dd3('0x18')](_0x4c81a9[_0x4dd3('0x13')]['pid'],_0x4dd3('0x19'));return _0xd689b3[_0x4dd3('0xa')](0xc8)[_0x4dd3('0xe')]({'message':util[_0x4dd3('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4c81a9[_0x4dd3('0x13')][_0x4dd3('0x17')])});})[_0x4dd3('0xd')](handleError(_0xd689b3,null,_0x4dd3('0xf')));}; \ No newline at end of file +var _0x18d4=['catch','killProcess','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','getAllData','then','json'];(function(_0x5774af,_0x411c94){var _0x480589=function(_0x414114){while(--_0x414114){_0x5774af['push'](_0x5774af['shift']());}};_0x480589(++_0x411c94);}(_0x18d4,0x1ab));var _0x418d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18d4[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0x418d('0x0'));var exec=require('child_process')[_0x418d('0x1')];var logger=require(_0x418d('0x2'))(_0x418d('0x3'));var util=require(_0x418d('0x4'));var BPromise=require(_0x418d('0x5'));var _=require(_0x418d('0x6'));function handleError(_0x4df9b4,_0x7e3eb9,_0xc00b84){_0x7e3eb9=_0x7e3eb9||0x1f4;return function(_0x2067ca){logger[_0x418d('0x7')](_0x418d('0x8'),_0xc00b84,_0x7e3eb9,util[_0x418d('0x9')](_0x2067ca,{'showHidden':![],'depth':null}));delete _0x2067ca[_0x418d('0xa')];_0x4df9b4[_0x418d('0xb')](_0x7e3eb9)['send'](_0x2067ca);};}exports['index']=function(_0x524ee7,_0x3a0afb){return info[_0x418d('0xc')]()[_0x418d('0xd')](function(_0x2aaaee){return _0x3a0afb[_0x418d('0xb')](0xc8)[_0x418d('0xe')](_0x2aaaee);})[_0x418d('0xf')](function(_0x176922){return _0x3a0afb['status'](0x1f4)['json'](_0x176922);});};exports[_0x418d('0x10')]=function(_0x492c5e,_0x4d0b4c){var _0x5b77a7=['components/import/cm'];return new BPromise(function(_0x73818e,_0xeec644){return exec(util['format'](_0x418d('0x11'),_0x492c5e[_0x418d('0x12')][_0x418d('0x13')]),function(_0x31f030,_0x537ab3,_0x2d89b8){if(_0x31f030){return _0xeec644(_0x31f030);}return _0x73818e(_0x537ab3);});})[_0x418d('0xd')](function(_0x4d64c6){var _0x194647=![];var _0x8b962e=_0x4d64c6['split'](/\n/);for(var _0x46f2e4=0x0,_0x17194e=_0x5b77a7[_0x418d('0x14')];_0x46f2e4<_0x17194e,_0x194647===![];_0x46f2e4+=0x1){if(_0x4d64c6[_0x418d('0x15')](_0x5b77a7[_0x46f2e4])>=0x0){_0x194647=!![];}}if(!_0x194647){throw new Error(util['format'](_0x418d('0x16'),_0x492c5e[_0x418d('0x12')][_0x418d('0x13')]));}process[_0x418d('0x17')](_0x492c5e['params']['pid'],_0x418d('0x18'));return _0x4d0b4c[_0x418d('0xb')](0xc8)[_0x418d('0xe')]({'message':util['format'](_0x418d('0x19'),_0x492c5e[_0x418d('0x12')][_0x418d('0x13')])});})[_0x418d('0xf')](handleError(_0x4d0b4c,null,_0x418d('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7d78517..cecc451 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 _0xb58b=['put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4fa018,_0x58be4c){var _0x3d4384=function(_0x4344b6){while(--_0x4344b6){_0x4fa018['push'](_0x4fa018['shift']());}};_0x3d4384(++_0x58be4c);}(_0xb58b,0x1f1));var _0xbb58=function(_0x100733,_0x3b8687){_0x100733=_0x100733-0x0;var _0x1d0461=_0xb58b[_0x100733];return _0x1d0461;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var auth=require(_0xbb58('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbb58('0x5'));var controller=require('./tag.controller');router[_0xbb58('0x6')]('/',auth[_0xbb58('0x7')](),controller[_0xbb58('0x8')]);router['get'](_0xbb58('0x9'),auth[_0xbb58('0x7')](),controller[_0xbb58('0xa')]);router[_0xbb58('0xb')]('/',auth[_0xbb58('0x7')](),controller[_0xbb58('0xc')]);router[_0xbb58('0xd')](_0xbb58('0x9'),auth[_0xbb58('0x7')](),controller[_0xbb58('0xe')]);router[_0xbb58('0xf')]('/:id',auth[_0xbb58('0x7')](),controller['destroy']);module[_0xbb58('0x10')]=router; \ No newline at end of file +var _0x5ff3=['/:id','show','create','put','delete','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1303a2,_0x41a65e){var _0x241c4f=function(_0x3f6ec4){while(--_0x3f6ec4){_0x1303a2['push'](_0x1303a2['shift']());}};_0x241c4f(++_0x41a65e);}(_0x5ff3,0x17d));var _0x35ff=function(_0x4fc1ac,_0x1984b9){_0x4fc1ac=_0x4fc1ac-0x0;var _0x30c94f=_0x5ff3[_0x4fc1ac];return _0x30c94f;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var auth=require(_0x35ff('0x3'));var interaction=require(_0x35ff('0x4'));var config=require(_0x35ff('0x5'));var controller=require('./tag.controller');router[_0x35ff('0x6')]('/',auth[_0x35ff('0x7')](),controller[_0x35ff('0x8')]);router[_0x35ff('0x6')](_0x35ff('0x9'),auth['isAuthenticated'](),controller[_0x35ff('0xa')]);router['post']('/',auth[_0x35ff('0x7')](),controller[_0x35ff('0xb')]);router[_0x35ff('0xc')]('/:id',auth[_0x35ff('0x7')](),controller['update']);router[_0x35ff('0xd')](_0x35ff('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x35ff('0xe')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 7d8bff8..c3e943e 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 _0x4483=['exports','STRING','#0091EA','sequelize'];(function(_0x278254,_0x13241d){var _0x348000=function(_0x11f993){while(--_0x11f993){_0x278254['push'](_0x278254['shift']());}};_0x348000(++_0x13241d);}(_0x4483,0x1a3));var _0x3448=function(_0x33e424,_0x3c6976){_0x33e424=_0x33e424-0x0;var _0x234bfd=_0x4483[_0x33e424];return _0x234bfd;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'name':{'type':Sequelize[_0x3448('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x3448('0x2')],'defaultValue':_0x3448('0x3')},'description':{'type':Sequelize[_0x3448('0x2')]}}; \ No newline at end of file +var _0x36ee=['STRING','#0091EA'];(function(_0x372b84,_0x2396a3){var _0x341a2f=function(_0x1adbd2){while(--_0x1adbd2){_0x372b84['push'](_0x372b84['shift']());}};_0x341a2f(++_0x2396a3);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe36e('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xe36e('0x0')],'defaultValue':_0xe36e('0x1')},'description':{'type':Sequelize[_0xe36e('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 034d44c..1131aa3 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 _0x6bcd=['jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Tags','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','Tag','includeAll','include','rows','catch','show','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel'];(function(_0x487f0a,_0x5c19ae){var _0x2f89da=function(_0x2ae180){while(--_0x2ae180){_0x487f0a['push'](_0x487f0a['shift']());}};_0x2f89da(++_0x5c19ae);}(_0x6bcd,0xe8));var _0xd6bc=function(_0x1293fb,_0x212173){_0x1293fb=_0x1293fb-0x0;var _0x205a27=_0x6bcd[_0x1293fb];return _0x205a27;};'use strict';var pdf=require(_0xd6bc('0x0'));var emlformat=require(_0xd6bc('0x1'));var rimraf=require(_0xd6bc('0x2'));var zipdir=require(_0xd6bc('0x3'));var jsonpatch=require(_0xd6bc('0x4'));var rp=require(_0xd6bc('0x5'));var moment=require(_0xd6bc('0x6'));var BPromise=require(_0xd6bc('0x7'));var Mustache=require(_0xd6bc('0x8'));var util=require(_0xd6bc('0x9'));var path=require('path');var sox=require(_0xd6bc('0xa'));var csv=require(_0xd6bc('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd6bc('0xc'));var squel=require(_0xd6bc('0xd'));var crypto=require('crypto');var jsforce=require(_0xd6bc('0xe'));var deskjs=require(_0xd6bc('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd6bc('0x10'));var Redis=require('ioredis');var authService=require(_0xd6bc('0x11'));var qs=require(_0xd6bc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6bc('0x13'));var logger=require(_0xd6bc('0x14'))(_0xd6bc('0x15'));var utils=require('../../config/utils');var config=require(_0xd6bc('0x16'));var licenseUtil=require(_0xd6bc('0x17'));var db=require(_0xd6bc('0x18'))['db'];function respondWithStatusCode(_0x2bae13,_0x43e438){_0x43e438=_0x43e438||0xcc;return function(_0x429d5e){if(_0x429d5e){return _0x2bae13[_0xd6bc('0x19')](_0x43e438);}return _0x2bae13[_0xd6bc('0x1a')](_0x43e438)[_0xd6bc('0x1b')]();};}function respondWithResult(_0x58a47f,_0x2a02df){_0x2a02df=_0x2a02df||0xc8;return function(_0x262c2c){if(_0x262c2c){return _0x58a47f['status'](_0x2a02df)[_0xd6bc('0x1c')](_0x262c2c);}};}function respondWithFilteredResult(_0x45e3a2,_0x5f0d23){return function(_0x55a3b6){if(_0x55a3b6){var _0x343428=_0x55a3b6[_0xd6bc('0x1d')],_0x5252d8=_0x5f0d23[_0xd6bc('0x1e')],_0x5d0a75=_0x5f0d23['offset']+_0x5f0d23[_0xd6bc('0x1f')],_0x5066cb;if(_0x5d0a75>=_0x343428){_0x5d0a75=_0x343428;_0x5066cb=0xc8;}else{_0x5066cb=0xce;}_0x45e3a2[_0xd6bc('0x1a')](_0x5066cb);return _0x45e3a2[_0xd6bc('0x20')](_0xd6bc('0x21'),_0x5252d8+'-'+_0x5d0a75+'/'+_0x343428)[_0xd6bc('0x1c')](_0x55a3b6);}return null;};}function patchUpdates(_0x324c3b){return function(_0x82ce15){try{jsonpatch['apply'](_0x82ce15,_0x324c3b,!![]);}catch(_0x9d4680){return BPromise[_0xd6bc('0x22')](_0x9d4680);}return _0x82ce15[_0xd6bc('0x23')]();};}function saveUpdates(_0x1a6349,_0x141375){return function(_0x5df57a){if(_0x5df57a){return _0x5df57a[_0xd6bc('0x24')](_0x1a6349)[_0xd6bc('0x25')](function(_0x3b7353){return _0x3b7353;});}return null;};}function removeEntity(_0x49c356,_0x35a63b){return function(_0x4b5dc9){if(_0x4b5dc9){return _0x4b5dc9[_0xd6bc('0x26')]()['then'](function(){var _0x20e3d2=_0x4b5dc9[_0xd6bc('0x27')]({'plain':!![]});var _0x1a98b4=_0xd6bc('0x28');return db[_0xd6bc('0x29')][_0xd6bc('0x26')]({'where':{'type':_0x1a98b4,'resourceId':_0x20e3d2['id']}})[_0xd6bc('0x25')](function(){return _0x4b5dc9;});})['then'](function(){_0x49c356[_0xd6bc('0x1a')](0xcc)[_0xd6bc('0x1b')]();});}};}function handleEntityNotFound(_0x58fd30,_0x6933d6){return function(_0x3aa293){if(!_0x3aa293){_0x58fd30[_0xd6bc('0x19')](0x194);}return _0x3aa293;};}function handleError(_0xd3645e,_0x5de15e){_0x5de15e=_0x5de15e||0x1f4;return function(_0x68460d){logger['error'](_0x68460d[_0xd6bc('0x2a')]);if(_0x68460d['name']){delete _0x68460d[_0xd6bc('0x2b')];}_0xd3645e[_0xd6bc('0x1a')](_0x5de15e)['send'](_0x68460d);};}exports[_0xd6bc('0x2c')]=function(_0x392478,_0xdcd8ae){var _0x410131={},_0xfc4030={},_0x2f165a={'count':0x0,'rows':[]};var _0x223cfc=_[_0xd6bc('0x2d')](db['Tag'][_0xd6bc('0x2e')],function(_0x5ee140){return{'name':_0x5ee140[_0xd6bc('0x2f')],'type':_0x5ee140[_0xd6bc('0x30')][_0xd6bc('0x31')]};});_0xfc4030[_0xd6bc('0x32')]=_[_0xd6bc('0x2d')](_0x223cfc,_0xd6bc('0x2b'));_0xfc4030[_0xd6bc('0x33')]=_[_0xd6bc('0x34')](_0x392478[_0xd6bc('0x33')]);_0xfc4030[_0xd6bc('0x35')]=_['intersection'](_0xfc4030[_0xd6bc('0x32')],_0xfc4030[_0xd6bc('0x33')]);_0x410131[_0xd6bc('0x36')]=_['intersection'](_0xfc4030[_0xd6bc('0x32')],qs[_0xd6bc('0x37')](_0x392478[_0xd6bc('0x33')][_0xd6bc('0x37')]));_0x410131[_0xd6bc('0x36')]=_0x410131[_0xd6bc('0x36')][_0xd6bc('0x38')]?_0x410131['attributes']:_0xfc4030[_0xd6bc('0x32')];if(!_0x392478[_0xd6bc('0x33')][_0xd6bc('0x39')]('nolimit')){_0x410131[_0xd6bc('0x1f')]=qs[_0xd6bc('0x1f')](_0x392478[_0xd6bc('0x33')][_0xd6bc('0x1f')]);_0x410131[_0xd6bc('0x1e')]=qs[_0xd6bc('0x1e')](_0x392478[_0xd6bc('0x33')][_0xd6bc('0x1e')]);}_0x410131[_0xd6bc('0x3a')]=qs['sort'](_0x392478['query'][_0xd6bc('0x3b')]);_0x410131[_0xd6bc('0x3c')]=qs[_0xd6bc('0x35')](_[_0xd6bc('0x3d')](_0x392478[_0xd6bc('0x33')],_0xfc4030[_0xd6bc('0x35')]),_0x223cfc);if(_0x392478[_0xd6bc('0x33')]['filter']){_0x410131[_0xd6bc('0x3c')]=_[_0xd6bc('0x3e')](_0x410131['where'],{'$or':_[_0xd6bc('0x2d')](_0x223cfc,function(_0x1f8d35){if(_0x1f8d35[_0xd6bc('0x30')]!=='VIRTUAL'){var _0x200412={};_0x200412[_0x1f8d35['name']]={'$like':'%'+_0x392478[_0xd6bc('0x33')]['filter']+'%'};return _0x200412;}})});}_0x410131=_['merge']({},_0x410131,_0x392478['options']);var _0x52122a={'where':_0x410131['where']};return db[_0xd6bc('0x3f')][_0xd6bc('0x1d')](_0x52122a)['then'](function(_0x2ae1ac){_0x2f165a['count']=_0x2ae1ac;if(_0x392478[_0xd6bc('0x33')][_0xd6bc('0x40')]){_0x410131[_0xd6bc('0x41')]=[{'all':!![]}];}return db[_0xd6bc('0x3f')]['findAll'](_0x410131);})[_0xd6bc('0x25')](function(_0x424ca6){_0x2f165a[_0xd6bc('0x42')]=_0x424ca6;return _0x2f165a;})[_0xd6bc('0x25')](respondWithFilteredResult(_0xdcd8ae,_0x410131))[_0xd6bc('0x43')](handleError(_0xdcd8ae,null));};exports[_0xd6bc('0x44')]=function(_0x26630c,_0xd123f6){var _0x57fb8f={'raw':!![],'where':{'id':_0x26630c[_0xd6bc('0x45')]['id']}},_0x58dd3e={};_0x58dd3e['model']=_[_0xd6bc('0x34')](db[_0xd6bc('0x3f')]['rawAttributes']);_0x58dd3e['query']=_[_0xd6bc('0x34')](_0x26630c[_0xd6bc('0x33')]);_0x58dd3e[_0xd6bc('0x35')]=_[_0xd6bc('0x46')](_0x58dd3e['model'],_0x58dd3e[_0xd6bc('0x33')]);_0x57fb8f['attributes']=_[_0xd6bc('0x46')](_0x58dd3e[_0xd6bc('0x32')],qs[_0xd6bc('0x37')](_0x26630c['query'][_0xd6bc('0x37')]));_0x57fb8f['attributes']=_0x57fb8f[_0xd6bc('0x36')][_0xd6bc('0x38')]?_0x57fb8f[_0xd6bc('0x36')]:_0x58dd3e[_0xd6bc('0x32')];if(_0x26630c[_0xd6bc('0x33')]['includeAll']){_0x57fb8f['include']=[{'all':!![]}];}_0x57fb8f=_[_0xd6bc('0x3e')]({},_0x57fb8f,_0x26630c['options']);return db[_0xd6bc('0x3f')][_0xd6bc('0x47')](_0x57fb8f)['then'](handleEntityNotFound(_0xd123f6,null))['then'](respondWithResult(_0xd123f6,null))[_0xd6bc('0x43')](handleError(_0xd123f6,null));};exports[_0xd6bc('0x48')]=function(_0x23f647,_0xad2372){return db['Tag'][_0xd6bc('0x48')](_0x23f647['body'],{})[_0xd6bc('0x25')](function(_0x4ec717){var _0x6b907c=_0x23f647[_0xd6bc('0x49')][_0xd6bc('0x27')]({'plain':!![]});if(!_0x6b907c)throw new Error(_0xd6bc('0x4a'));if(_0x6b907c[_0xd6bc('0x4b')]===_0xd6bc('0x49')){var _0x339adb=_0x4ec717['get']({'plain':!![]});var _0xe987e=_0xd6bc('0x28');return db[_0xd6bc('0x4c')]['find']({'where':{'name':_0xe987e,'userProfileId':_0x6b907c[_0xd6bc('0x4d')]},'raw':!![]})[_0xd6bc('0x25')](function(_0x1ff4ad){if(_0x1ff4ad&&_0x1ff4ad[_0xd6bc('0x4e')]===0x0){return db[_0xd6bc('0x29')][_0xd6bc('0x48')]({'name':_0x339adb[_0xd6bc('0x2b')],'resourceId':_0x339adb['id'],'type':_0x1ff4ad[_0xd6bc('0x2b')],'sectionId':_0x1ff4ad['id']},{})['then'](function(){return _0x4ec717;});}else{return _0x4ec717;}})[_0xd6bc('0x43')](function(_0x560299){logger[_0xd6bc('0x4f')](_0xd6bc('0x50'),_0x560299);throw _0x560299;});}return _0x4ec717;})[_0xd6bc('0x25')](respondWithResult(_0xad2372,0xc9))[_0xd6bc('0x43')](handleError(_0xad2372,null));};exports[_0xd6bc('0x24')]=function(_0x12cb9a,_0x4f55fe){if(_0x12cb9a[_0xd6bc('0x51')]['id']){delete _0x12cb9a[_0xd6bc('0x51')]['id'];}return db[_0xd6bc('0x3f')][_0xd6bc('0x47')]({'where':{'id':_0x12cb9a[_0xd6bc('0x45')]['id']}})[_0xd6bc('0x25')](handleEntityNotFound(_0x4f55fe,null))[_0xd6bc('0x25')](saveUpdates(_0x12cb9a[_0xd6bc('0x51')],null))[_0xd6bc('0x25')](respondWithResult(_0x4f55fe,null))['catch'](handleError(_0x4f55fe,null));};exports[_0xd6bc('0x26')]=function(_0x34c739,_0x42db91){return db[_0xd6bc('0x3f')]['find']({'where':{'id':_0x34c739[_0xd6bc('0x45')]['id']}})[_0xd6bc('0x25')](handleEntityNotFound(_0x42db91,null))['then'](removeEntity(_0x42db91,null))['catch'](handleError(_0x42db91,null));}; \ No newline at end of file +var _0x4a33=['name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','pick','merge','filter','Tag','count','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack'];(function(_0x28c8ba,_0x346ca1){var _0x4355e5=function(_0x5e543d){while(--_0x5e543d){_0x28c8ba['push'](_0x28c8ba['shift']());}};_0x4355e5(++_0x346ca1);}(_0x4a33,0xc6));var _0x34a3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x4a33[_0x465028];return _0xb783d4;};'use strict';var pdf=require(_0x34a3('0x0'));var emlformat=require(_0x34a3('0x1'));var rimraf=require(_0x34a3('0x2'));var zipdir=require(_0x34a3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x34a3('0x4'));var moment=require('moment');var BPromise=require(_0x34a3('0x5'));var Mustache=require('mustache');var util=require(_0x34a3('0x6'));var path=require(_0x34a3('0x7'));var sox=require(_0x34a3('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x34a3('0x9'));var squel=require('squel');var crypto=require(_0x34a3('0xa'));var jsforce=require(_0x34a3('0xb'));var deskjs=require(_0x34a3('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x34a3('0xd'));var qs=require(_0x34a3('0xe'));var as=require(_0x34a3('0xf'));var hardwareService=require(_0x34a3('0x10'));var logger=require(_0x34a3('0x11'))(_0x34a3('0x12'));var utils=require(_0x34a3('0x13'));var config=require(_0x34a3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x34a3('0x15'))['db'];function respondWithStatusCode(_0x13004f,_0x442da){_0x442da=_0x442da||0xcc;return function(_0x101a9f){if(_0x101a9f){return _0x13004f[_0x34a3('0x16')](_0x442da);}return _0x13004f[_0x34a3('0x17')](_0x442da)[_0x34a3('0x18')]();};}function respondWithResult(_0x3eab05,_0x784212){_0x784212=_0x784212||0xc8;return function(_0x46b7b4){if(_0x46b7b4){return _0x3eab05[_0x34a3('0x17')](_0x784212)[_0x34a3('0x19')](_0x46b7b4);}};}function respondWithFilteredResult(_0xb4435b,_0x5da4f6){return function(_0x836ea3){if(_0x836ea3){var _0x35eadf=_0x836ea3['count'],_0x5ac373=_0x5da4f6[_0x34a3('0x1a')],_0x8b6f89=_0x5da4f6[_0x34a3('0x1a')]+_0x5da4f6['limit'],_0x2495ff;if(_0x8b6f89>=_0x35eadf){_0x8b6f89=_0x35eadf;_0x2495ff=0xc8;}else{_0x2495ff=0xce;}_0xb4435b[_0x34a3('0x17')](_0x2495ff);return _0xb4435b[_0x34a3('0x1b')](_0x34a3('0x1c'),_0x5ac373+'-'+_0x8b6f89+'/'+_0x35eadf)[_0x34a3('0x19')](_0x836ea3);}return null;};}function patchUpdates(_0x567614){return function(_0x20b149){try{jsonpatch[_0x34a3('0x1d')](_0x20b149,_0x567614,!![]);}catch(_0x25e5d6){return BPromise[_0x34a3('0x1e')](_0x25e5d6);}return _0x20b149[_0x34a3('0x1f')]();};}function saveUpdates(_0x3e8d98,_0x35bb7b){return function(_0x596046){if(_0x596046){return _0x596046['update'](_0x3e8d98)[_0x34a3('0x20')](function(_0x4d96e8){return _0x4d96e8;});}return null;};}function removeEntity(_0x41f10a,_0x346a51){return function(_0x1099ca){if(_0x1099ca){return _0x1099ca[_0x34a3('0x21')]()[_0x34a3('0x20')](function(){var _0x2af18c=_0x1099ca[_0x34a3('0x22')]({'plain':!![]});var _0x1e690e=_0x34a3('0x23');return db[_0x34a3('0x24')][_0x34a3('0x21')]({'where':{'type':_0x1e690e,'resourceId':_0x2af18c['id']}})[_0x34a3('0x20')](function(){return _0x1099ca;});})[_0x34a3('0x20')](function(){_0x41f10a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb983c,_0x10040a){return function(_0x38c0c2){if(!_0x38c0c2){_0xb983c['sendStatus'](0x194);}return _0x38c0c2;};}function handleError(_0x953889,_0x11b108){_0x11b108=_0x11b108||0x1f4;return function(_0x57dcbf){logger[_0x34a3('0x25')](_0x57dcbf[_0x34a3('0x26')]);if(_0x57dcbf[_0x34a3('0x27')]){delete _0x57dcbf[_0x34a3('0x27')];}_0x953889[_0x34a3('0x17')](_0x11b108)[_0x34a3('0x28')](_0x57dcbf);};}exports[_0x34a3('0x29')]=function(_0x90e0a7,_0x27a100){var _0x4673ac={},_0xe5e89f={},_0x23c1c7={'count':0x0,'rows':[]};var _0x500cfe=_[_0x34a3('0x2a')](db['Tag']['rawAttributes'],function(_0x1200ef){return{'name':_0x1200ef['fieldName'],'type':_0x1200ef[_0x34a3('0x2b')][_0x34a3('0x2c')]};});_0xe5e89f[_0x34a3('0x2d')]=_[_0x34a3('0x2a')](_0x500cfe,_0x34a3('0x27'));_0xe5e89f[_0x34a3('0x2e')]=_[_0x34a3('0x2f')](_0x90e0a7['query']);_0xe5e89f[_0x34a3('0x30')]=_[_0x34a3('0x31')](_0xe5e89f['model'],_0xe5e89f[_0x34a3('0x2e')]);_0x4673ac[_0x34a3('0x32')]=_[_0x34a3('0x31')](_0xe5e89f[_0x34a3('0x2d')],qs[_0x34a3('0x33')](_0x90e0a7[_0x34a3('0x2e')][_0x34a3('0x33')]));_0x4673ac['attributes']=_0x4673ac['attributes']['length']?_0x4673ac[_0x34a3('0x32')]:_0xe5e89f['model'];if(!_0x90e0a7[_0x34a3('0x2e')]['hasOwnProperty'](_0x34a3('0x34'))){_0x4673ac[_0x34a3('0x35')]=qs[_0x34a3('0x35')](_0x90e0a7[_0x34a3('0x2e')][_0x34a3('0x35')]);_0x4673ac['offset']=qs['offset'](_0x90e0a7['query'][_0x34a3('0x1a')]);}_0x4673ac[_0x34a3('0x36')]=qs['sort'](_0x90e0a7[_0x34a3('0x2e')][_0x34a3('0x37')]);_0x4673ac[_0x34a3('0x38')]=qs[_0x34a3('0x30')](_[_0x34a3('0x39')](_0x90e0a7[_0x34a3('0x2e')],_0xe5e89f[_0x34a3('0x30')]),_0x500cfe);if(_0x90e0a7[_0x34a3('0x2e')]['filter']){_0x4673ac[_0x34a3('0x38')]=_[_0x34a3('0x3a')](_0x4673ac['where'],{'$or':_[_0x34a3('0x2a')](_0x500cfe,function(_0x9db99c){if(_0x9db99c[_0x34a3('0x2b')]!=='VIRTUAL'){var _0x38c3e5={};_0x38c3e5[_0x9db99c[_0x34a3('0x27')]]={'$like':'%'+_0x90e0a7[_0x34a3('0x2e')][_0x34a3('0x3b')]+'%'};return _0x38c3e5;}})});}_0x4673ac=_[_0x34a3('0x3a')]({},_0x4673ac,_0x90e0a7['options']);var _0x5b8553={'where':_0x4673ac[_0x34a3('0x38')]};return db[_0x34a3('0x3c')][_0x34a3('0x3d')](_0x5b8553)[_0x34a3('0x20')](function(_0x5e8482){_0x23c1c7[_0x34a3('0x3d')]=_0x5e8482;if(_0x90e0a7[_0x34a3('0x2e')][_0x34a3('0x3e')]){_0x4673ac[_0x34a3('0x3f')]=[{'all':!![]}];}return db[_0x34a3('0x3c')][_0x34a3('0x40')](_0x4673ac);})[_0x34a3('0x20')](function(_0x5c3c6b){_0x23c1c7[_0x34a3('0x41')]=_0x5c3c6b;return _0x23c1c7;})[_0x34a3('0x20')](respondWithFilteredResult(_0x27a100,_0x4673ac))[_0x34a3('0x42')](handleError(_0x27a100,null));};exports['show']=function(_0x39115c,_0x54b6a3){var _0x4a7416={'raw':!![],'where':{'id':_0x39115c[_0x34a3('0x43')]['id']}},_0x5dd313={};_0x5dd313[_0x34a3('0x2d')]=_[_0x34a3('0x2f')](db[_0x34a3('0x3c')][_0x34a3('0x44')]);_0x5dd313[_0x34a3('0x2e')]=_[_0x34a3('0x2f')](_0x39115c[_0x34a3('0x2e')]);_0x5dd313[_0x34a3('0x30')]=_[_0x34a3('0x31')](_0x5dd313[_0x34a3('0x2d')],_0x5dd313['query']);_0x4a7416['attributes']=_['intersection'](_0x5dd313[_0x34a3('0x2d')],qs[_0x34a3('0x33')](_0x39115c[_0x34a3('0x2e')][_0x34a3('0x33')]));_0x4a7416[_0x34a3('0x32')]=_0x4a7416[_0x34a3('0x32')][_0x34a3('0x45')]?_0x4a7416[_0x34a3('0x32')]:_0x5dd313[_0x34a3('0x2d')];if(_0x39115c[_0x34a3('0x2e')]['includeAll']){_0x4a7416['include']=[{'all':!![]}];}_0x4a7416=_['merge']({},_0x4a7416,_0x39115c[_0x34a3('0x46')]);return db[_0x34a3('0x3c')][_0x34a3('0x47')](_0x4a7416)[_0x34a3('0x20')](handleEntityNotFound(_0x54b6a3,null))['then'](respondWithResult(_0x54b6a3,null))[_0x34a3('0x42')](handleError(_0x54b6a3,null));};exports[_0x34a3('0x48')]=function(_0x5c36ca,_0x1dbb09){return db[_0x34a3('0x3c')][_0x34a3('0x48')](_0x5c36ca[_0x34a3('0x49')],{})['then'](function(_0x3efe2e){var _0x5401de=_0x5c36ca['user']['get']({'plain':!![]});if(!_0x5401de)throw new Error(_0x34a3('0x4a'));if(_0x5401de['role']===_0x34a3('0x4b')){var _0x555060=_0x3efe2e[_0x34a3('0x22')]({'plain':!![]});var _0x5d3795=_0x34a3('0x23');return db['UserProfileSection'][_0x34a3('0x47')]({'where':{'name':_0x5d3795,'userProfileId':_0x5401de[_0x34a3('0x4c')]},'raw':!![]})[_0x34a3('0x20')](function(_0x13952f){if(_0x13952f&&_0x13952f[_0x34a3('0x4d')]===0x0){return db[_0x34a3('0x24')]['create']({'name':_0x555060[_0x34a3('0x27')],'resourceId':_0x555060['id'],'type':_0x13952f['name'],'sectionId':_0x13952f['id']},{})[_0x34a3('0x20')](function(){return _0x3efe2e;});}else{return _0x3efe2e;}})[_0x34a3('0x42')](function(_0x1022b7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1022b7);throw _0x1022b7;});}return _0x3efe2e;})[_0x34a3('0x20')](respondWithResult(_0x1dbb09,0xc9))[_0x34a3('0x42')](handleError(_0x1dbb09,null));};exports[_0x34a3('0x4e')]=function(_0x4a967c,_0x54808a){if(_0x4a967c[_0x34a3('0x49')]['id']){delete _0x4a967c[_0x34a3('0x49')]['id'];}return db[_0x34a3('0x3c')][_0x34a3('0x47')]({'where':{'id':_0x4a967c['params']['id']}})['then'](handleEntityNotFound(_0x54808a,null))[_0x34a3('0x20')](saveUpdates(_0x4a967c[_0x34a3('0x49')],null))[_0x34a3('0x20')](respondWithResult(_0x54808a,null))['catch'](handleError(_0x54808a,null));};exports[_0x34a3('0x21')]=function(_0x4ad220,_0x4475ac){return db[_0x34a3('0x3c')][_0x34a3('0x47')]({'where':{'id':_0x4ad220[_0x34a3('0x43')]['id']}})[_0x34a3('0x20')](handleEntityNotFound(_0x4475ac,null))[_0x34a3('0x20')](removeEntity(_0x4475ac,null))[_0x34a3('0x42')](handleError(_0x4475ac,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 7b6e978..8a50570 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 _0xcdc0=['Tag','tools_tags','util','../../config/logger','moment','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0xcb80ad,_0x5d6161){var _0x34b615=function(_0xb273b4){while(--_0xb273b4){_0xcb80ad['push'](_0xcb80ad['shift']());}};_0x34b615(++_0x5d6161);}(_0xcdc0,0x84));var _0x0cdc=function(_0x1c02ca,_0x5adb5a){_0x1c02ca=_0x1c02ca-0x0;var _0x6e3103=_0xcdc0[_0x1c02ca];return _0x6e3103;};'use strict';var _=require('lodash');var util=require(_0x0cdc('0x0'));var logger=require(_0x0cdc('0x1'))('api');var moment=require(_0x0cdc('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cdc('0x3'));var rimraf=require(_0x0cdc('0x4'));var config=require(_0x0cdc('0x5'));var attributes=require(_0x0cdc('0x6'));module[_0x0cdc('0x7')]=function(_0x1dbfeb,_0x9b5ed4){return _0x1dbfeb['define'](_0x0cdc('0x8'),attributes,{'tableName':_0x0cdc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd2e=['api','moment','request-promise','path','rimraf','../../config/environment','define','Tag','tools_tags','lodash','util'];(function(_0x1c24f1,_0x1ea50c){var _0x4649b9=function(_0x4cb393){while(--_0x4cb393){_0x1c24f1['push'](_0x1c24f1['shift']());}};_0x4649b9(++_0x1ea50c);}(_0xdd2e,0x13d));var _0xedd2=function(_0x805279,_0x1d652d){_0x805279=_0x805279-0x0;var _0x3896bb=_0xdd2e[_0x805279];return _0x3896bb;};'use strict';var _=require(_0xedd2('0x0'));var util=require(_0xedd2('0x1'));var logger=require('../../config/logger')(_0xedd2('0x2'));var moment=require(_0xedd2('0x3'));var BPromise=require('bluebird');var rp=require(_0xedd2('0x4'));var fs=require('fs');var path=require(_0xedd2('0x5'));var rimraf=require(_0xedd2('0x6'));var config=require(_0xedd2('0x7'));var attributes=require('./tag.attributes');module['exports']=function(_0x473dd9,_0x9bd9f4){return _0x473dd9[_0xedd2('0x8')](_0xedd2('0x9'),attributes,{'tableName':_0xedd2('0xa'),'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 aa28fad..15914f2 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 _0x222f=['result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x22309f,_0x518e87){var _0x48ac87=function(_0x1248d1){while(--_0x1248d1){_0x22309f['push'](_0x22309f['shift']());}};_0x48ac87(++_0x518e87);}(_0x222f,0x1a4));var _0xf222=function(_0x3dc6f4,_0x362e2a){_0x3dc6f4=_0x3dc6f4-0x0;var _0x3b18e9=_0x222f[_0x3dc6f4];return _0x3b18e9;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('Tag,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});} \ No newline at end of file +var _0x3c81=['Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x401770,_0xa325e7){var _0x46e1c3=function(_0x52ae1c){while(--_0x52ae1c){_0x401770['push'](_0x401770['shift']());}};_0x46e1c3(++_0xa325e7);}(_0x3c81,0x102));var _0x13c8=function(_0x1ea769,_0x26df4b){_0x1ea769=_0x1ea769-0x0;var _0x435a79=_0x3c81[_0x1ea769];return _0x435a79;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('Tag,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 1a2d6d7..8bfe170 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 _0x8c1f=['put','update','destroy','removeQueues','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','isAuthenticated','/:id','/:id/queues','getQueues','/:id/users','getAgents','create','post','addQueues'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x8c1f,0x156));var _0xf8c1=function(_0x3b04b5,_0x2ced47){_0x3b04b5=_0x3b04b5-0x0;var _0x3ca09e=_0x8c1f[_0x3b04b5];return _0x3ca09e;};'use strict';var multer=require(_0xf8c1('0x0'));var util=require('util');var path=require(_0xf8c1('0x1'));var timeout=require(_0xf8c1('0x2'));var express=require(_0xf8c1('0x3'));var router=express['Router']();var auth=require(_0xf8c1('0x4'));var interaction=require(_0xf8c1('0x5'));var config=require(_0xf8c1('0x6'));var controller=require(_0xf8c1('0x7'));router[_0xf8c1('0x8')]('/',auth[_0xf8c1('0x9')](),controller['index']);router[_0xf8c1('0x8')](_0xf8c1('0xa'),auth[_0xf8c1('0x9')](),controller['show']);router[_0xf8c1('0x8')](_0xf8c1('0xb'),auth['isAuthenticated'](),controller[_0xf8c1('0xc')]);router[_0xf8c1('0x8')](_0xf8c1('0xd'),auth[_0xf8c1('0x9')](),controller[_0xf8c1('0xe')]);router['post']('/',auth[_0xf8c1('0x9')](),controller[_0xf8c1('0xf')]);router[_0xf8c1('0x10')]('/:id/queues',auth['isAuthenticated'](),controller[_0xf8c1('0x11')]);router[_0xf8c1('0x10')](_0xf8c1('0xd'),auth[_0xf8c1('0x9')](),controller['addAgents']);router[_0xf8c1('0x12')](_0xf8c1('0xa'),auth[_0xf8c1('0x9')](),controller[_0xf8c1('0x13')]);router['delete']('/:id',auth[_0xf8c1('0x9')](),controller[_0xf8c1('0x14')]);router['delete']('/:id/queues',auth['isAuthenticated'](),controller[_0xf8c1('0x15')]);router['delete'](_0xf8c1('0xd'),auth[_0xf8c1('0x9')](),controller[_0xf8c1('0x16')]);module[_0xf8c1('0x17')]=router; \ No newline at end of file +var _0x456e=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/users','getAgents','post','create','/:id/queues','addAgents','put','update','delete','destroy','removeQueues','removeAgents'];(function(_0x3ca1cf,_0x1f71cf){var _0x5bb085=function(_0x447b9d){while(--_0x447b9d){_0x3ca1cf['push'](_0x3ca1cf['shift']());}};_0x5bb085(++_0x1f71cf);}(_0x456e,0x188));var _0xe456=function(_0x3cd773,_0x58c17e){_0x3cd773=_0x3cd773-0x0;var _0x34b9b4=_0x456e[_0x3cd773];return _0x34b9b4;};'use strict';var multer=require(_0xe456('0x0'));var util=require(_0xe456('0x1'));var path=require('path');var timeout=require(_0xe456('0x2'));var express=require(_0xe456('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe456('0x4'));var config=require(_0xe456('0x5'));var controller=require('./team.controller');router[_0xe456('0x6')]('/',auth[_0xe456('0x7')](),controller['index']);router['get'](_0xe456('0x8'),auth[_0xe456('0x7')](),controller[_0xe456('0x9')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router['get'](_0xe456('0xa'),auth['isAuthenticated'](),controller[_0xe456('0xb')]);router[_0xe456('0xc')]('/',auth[_0xe456('0x7')](),controller[_0xe456('0xd')]);router[_0xe456('0xc')](_0xe456('0xe'),auth[_0xe456('0x7')](),controller['addQueues']);router[_0xe456('0xc')]('/:id/users',auth[_0xe456('0x7')](),controller[_0xe456('0xf')]);router[_0xe456('0x10')](_0xe456('0x8'),auth['isAuthenticated'](),controller[_0xe456('0x11')]);router[_0xe456('0x12')](_0xe456('0x8'),auth['isAuthenticated'](),controller[_0xe456('0x13')]);router[_0xe456('0x12')](_0xe456('0xe'),auth[_0xe456('0x7')](),controller[_0xe456('0x14')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe456('0x15')]);module[_0xe456('0x16')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index e42c00e..0919fd6 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 _0x8ec0=['name','sequelize','STRING'];(function(_0xd7393d,_0x168e3e){var _0x573efe=function(_0x524054){while(--_0x524054){_0xd7393d['push'](_0xd7393d['shift']());}};_0x573efe(++_0x168e3e);}(_0x8ec0,0x7c));var _0x08ec=function(_0x5e5e0f,_0xbd0933){_0x5e5e0f=_0x5e5e0f-0x0;var _0x48f1a8=_0x8ec0[_0x5e5e0f];return _0x48f1a8;};'use strict';var Sequelize=require(_0x08ec('0x0'));module['exports']={'name':{'type':Sequelize[_0x08ec('0x1')],'allowNull':![],'unique':_0x08ec('0x2')},'description':{'type':Sequelize[_0x08ec('0x1')]}}; \ No newline at end of file +var _0x045f=['exports','sequelize'];(function(_0x88a94f,_0x3cd27d){var _0x4db244=function(_0x3c0d79){while(--_0x3c0d79){_0x88a94f['push'](_0x88a94f['shift']());}};_0x4db244(++_0x3cd27d);}(_0x045f,0x99));var _0xf045=function(_0x25b7bc,_0x4cb6bf){_0x25b7bc=_0x25b7bc-0x0;var _0x479fdb=_0x045f[_0x25b7bc];return _0x479fdb;};'use strict';var Sequelize=require(_0xf045('0x0'));module[_0xf045('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 5d1a07b..6827cfb 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 _0xbae8=['hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','Sequelize','add','Queues','ids','removeQueues','findOne','addAgents','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','filter','UserVoiceQueueRt','isNil','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','sms','fax','openchannel','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','sendStatus','stack','name','send','map','Team','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0xbae8,0xc7));var _0x8bae=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xbae8[_0x6d6a66];return _0x11eb6e;};'use strict';var pdf=require(_0x8bae('0x0'));var emlformat=require(_0x8bae('0x1'));var rimraf=require(_0x8bae('0x2'));var zipdir=require(_0x8bae('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8bae('0x4'));var Mustache=require(_0x8bae('0x5'));var util=require(_0x8bae('0x6'));var path=require(_0x8bae('0x7'));var sox=require(_0x8bae('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8bae('0x9'));var crypto=require(_0x8bae('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8bae('0xb'));var toCsv=require(_0x8bae('0xc'));var querystring=require(_0x8bae('0xd'));var Papa=require(_0x8bae('0xe'));var Redis=require(_0x8bae('0xf'));var authService=require(_0x8bae('0x10'));var qs=require(_0x8bae('0x11'));var as=require(_0x8bae('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8bae('0x13'));var utils=require(_0x8bae('0x14'));var config=require(_0x8bae('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bae('0x16'))['db'];config[_0x8bae('0x17')]=_[_0x8bae('0x18')](config['redis'],{'host':_0x8bae('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8bae('0x17')]));require(_0x8bae('0x1a'))[_0x8bae('0x1b')](socket);function respondWithStatusCode(_0x40f29e,_0x2cb08d){_0x2cb08d=_0x2cb08d||0xcc;return function(_0x45482a){if(_0x45482a){return _0x40f29e['sendStatus'](_0x2cb08d);}return _0x40f29e[_0x8bae('0x1c')](_0x2cb08d)[_0x8bae('0x1d')]();};}function respondWithResult(_0x13d212,_0x28631f){_0x28631f=_0x28631f||0xc8;return function(_0x446538){if(_0x446538){return _0x13d212[_0x8bae('0x1c')](_0x28631f)[_0x8bae('0x1e')](_0x446538);}};}function respondWithFilteredResult(_0x2ab203,_0x5db345){return function(_0x2e5ff0){if(_0x2e5ff0){var _0xf282d0=_0x2e5ff0[_0x8bae('0x1f')],_0x519481=_0x5db345[_0x8bae('0x20')],_0x3de56f=_0x5db345['offset']+_0x5db345[_0x8bae('0x21')],_0x30b9ad;if(_0x3de56f>=_0xf282d0){_0x3de56f=_0xf282d0;_0x30b9ad=0xc8;}else{_0x30b9ad=0xce;}_0x2ab203[_0x8bae('0x1c')](_0x30b9ad);return _0x2ab203['set'](_0x8bae('0x22'),_0x519481+'-'+_0x3de56f+'/'+_0xf282d0)[_0x8bae('0x1e')](_0x2e5ff0);}return null;};}function patchUpdates(_0x5cc53d){return function(_0x399087){try{jsonpatch[_0x8bae('0x23')](_0x399087,_0x5cc53d,!![]);}catch(_0x45f616){return BPromise[_0x8bae('0x24')](_0x45f616);}return _0x399087[_0x8bae('0x25')]();};}function saveUpdates(_0x190d3c,_0x3b9004){return function(_0x42bf89){if(_0x42bf89){return _0x42bf89[_0x8bae('0x26')](_0x190d3c)[_0x8bae('0x27')](function(_0x2be464){return _0x2be464;});}return null;};}function removeEntity(_0x42fd62,_0xb39dc){return function(_0x332e15){if(_0x332e15){return _0x332e15[_0x8bae('0x28')]()[_0x8bae('0x27')](function(){var _0x412189=_0x332e15[_0x8bae('0x29')]({'plain':!![]});var _0x5afd5d=_0x8bae('0x2a');return db[_0x8bae('0x2b')][_0x8bae('0x28')]({'where':{'type':_0x5afd5d,'resourceId':_0x412189['id']}})['then'](function(){return _0x332e15;});})[_0x8bae('0x27')](function(){_0x42fd62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x428972,_0x415f08){return function(_0x528501){if(!_0x528501){_0x428972[_0x8bae('0x2c')](0x194);}return _0x528501;};}function handleError(_0x16483f,_0x282d5d){_0x282d5d=_0x282d5d||0x1f4;return function(_0x9bee27){logger['error'](_0x9bee27[_0x8bae('0x2d')]);if(_0x9bee27[_0x8bae('0x2e')]){delete _0x9bee27[_0x8bae('0x2e')];}_0x16483f[_0x8bae('0x1c')](_0x282d5d)[_0x8bae('0x2f')](_0x9bee27);};}exports['index']=function(_0x398b9e,_0x28cce4){var _0x3cfcb3={},_0x384a0={},_0x57e81d={'count':0x0,'rows':[]};var _0x44d976=_[_0x8bae('0x30')](db[_0x8bae('0x31')][_0x8bae('0x32')],function(_0x2cd658){return{'name':_0x2cd658['fieldName'],'type':_0x2cd658[_0x8bae('0x33')][_0x8bae('0x34')]};});_0x384a0[_0x8bae('0x35')]=_['map'](_0x44d976,_0x8bae('0x2e'));_0x384a0[_0x8bae('0x36')]=_[_0x8bae('0x37')](_0x398b9e['query']);_0x384a0[_0x8bae('0x38')]=_[_0x8bae('0x39')](_0x384a0[_0x8bae('0x35')],_0x384a0[_0x8bae('0x36')]);_0x3cfcb3['attributes']=_[_0x8bae('0x39')](_0x384a0['model'],qs[_0x8bae('0x3a')](_0x398b9e[_0x8bae('0x36')][_0x8bae('0x3a')]));_0x3cfcb3[_0x8bae('0x3b')]=_0x3cfcb3[_0x8bae('0x3b')][_0x8bae('0x3c')]?_0x3cfcb3['attributes']:_0x384a0['model'];if(!_0x398b9e[_0x8bae('0x36')][_0x8bae('0x3d')](_0x8bae('0x3e'))){_0x3cfcb3['limit']=qs['limit'](_0x398b9e[_0x8bae('0x36')][_0x8bae('0x21')]);_0x3cfcb3['offset']=qs['offset'](_0x398b9e[_0x8bae('0x36')][_0x8bae('0x20')]);}_0x3cfcb3[_0x8bae('0x3f')]=qs[_0x8bae('0x40')](_0x398b9e[_0x8bae('0x36')]['sort']);_0x3cfcb3['where']=qs[_0x8bae('0x38')](_[_0x8bae('0x41')](_0x398b9e[_0x8bae('0x36')],_0x384a0[_0x8bae('0x38')]),_0x44d976);if(_0x398b9e[_0x8bae('0x36')]['filter']){_0x3cfcb3[_0x8bae('0x42')]=_[_0x8bae('0x43')](_0x3cfcb3[_0x8bae('0x42')],{'$or':_[_0x8bae('0x30')](_0x44d976,function(_0x322eef){if(_0x322eef[_0x8bae('0x33')]!==_0x8bae('0x44')){var _0x3f8431={};_0x3f8431[_0x322eef['name']]={'$like':'%'+_0x398b9e[_0x8bae('0x36')]['filter']+'%'};return _0x3f8431;}})});}_0x3cfcb3=_['merge']({},_0x3cfcb3,_0x398b9e[_0x8bae('0x45')]);var _0xc17b97={'where':_0x3cfcb3[_0x8bae('0x42')]};return db['Team']['count'](_0xc17b97)[_0x8bae('0x27')](function(_0x33b901){_0x57e81d[_0x8bae('0x1f')]=_0x33b901;if(_0x398b9e[_0x8bae('0x36')][_0x8bae('0x46')]){_0x3cfcb3['include']=[{'all':!![]}];}return db[_0x8bae('0x31')][_0x8bae('0x47')](_0x3cfcb3);})[_0x8bae('0x27')](function(_0x14e6af){_0x57e81d[_0x8bae('0x48')]=_0x14e6af;return _0x57e81d;})[_0x8bae('0x27')](respondWithFilteredResult(_0x28cce4,_0x3cfcb3))[_0x8bae('0x49')](handleError(_0x28cce4,null));};exports[_0x8bae('0x4a')]=function(_0x12709a,_0x189427){var _0x49ff97={'raw':![],'where':{'id':_0x12709a[_0x8bae('0x4b')]['id']}},_0x47ca36={};_0x47ca36[_0x8bae('0x35')]=_[_0x8bae('0x37')](db[_0x8bae('0x31')][_0x8bae('0x32')]);_0x47ca36[_0x8bae('0x36')]=_[_0x8bae('0x37')](_0x12709a[_0x8bae('0x36')]);_0x47ca36['filters']=_[_0x8bae('0x39')](_0x47ca36[_0x8bae('0x35')],_0x47ca36[_0x8bae('0x36')]);_0x49ff97[_0x8bae('0x3b')]=_[_0x8bae('0x39')](_0x47ca36[_0x8bae('0x35')],qs[_0x8bae('0x3a')](_0x12709a['query'][_0x8bae('0x3a')]));_0x49ff97[_0x8bae('0x3b')]=_0x49ff97[_0x8bae('0x3b')][_0x8bae('0x3c')]?_0x49ff97[_0x8bae('0x3b')]:_0x47ca36[_0x8bae('0x35')];if(_0x12709a['query'][_0x8bae('0x46')]){_0x49ff97[_0x8bae('0x4c')]=[{'all':!![]}];}_0x49ff97=_[_0x8bae('0x43')]({},_0x49ff97,_0x12709a['options']);return db[_0x8bae('0x31')][_0x8bae('0x4d')](_0x49ff97)[_0x8bae('0x27')](handleEntityNotFound(_0x189427,null))[_0x8bae('0x27')](respondWithResult(_0x189427,null))[_0x8bae('0x49')](handleError(_0x189427,null));};exports['create']=function(_0x26374c,_0xa22438){return db[_0x8bae('0x31')][_0x8bae('0x4e')](_0x26374c[_0x8bae('0x4f')],{})[_0x8bae('0x27')](function(_0x5019c9){var _0x28a6d3=_0x26374c['user'][_0x8bae('0x29')]({'plain':!![]});if(!_0x28a6d3)throw new Error(_0x8bae('0x50'));if(_0x28a6d3[_0x8bae('0x51')]==='user'){var _0x106dfb=_0x5019c9[_0x8bae('0x29')]({'plain':!![]});var _0x13335b=_0x8bae('0x2a');return db[_0x8bae('0x52')][_0x8bae('0x4d')]({'where':{'name':_0x13335b,'userProfileId':_0x28a6d3[_0x8bae('0x53')]},'raw':!![]})[_0x8bae('0x27')](function(_0x5def5f){if(_0x5def5f&&_0x5def5f[_0x8bae('0x54')]===0x0){return db['UserProfileResource'][_0x8bae('0x4e')]({'name':_0x106dfb[_0x8bae('0x2e')],'resourceId':_0x106dfb['id'],'type':_0x5def5f[_0x8bae('0x2e')],'sectionId':_0x5def5f['id']},{})[_0x8bae('0x27')](function(){return _0x5019c9;});}else{return _0x5019c9;}})[_0x8bae('0x49')](function(_0x179aaf){logger[_0x8bae('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x179aaf);throw _0x179aaf;});}return _0x5019c9;})['then'](respondWithResult(_0xa22438,0xc9))['catch'](handleError(_0xa22438,null));};exports[_0x8bae('0x26')]=function(_0xacec09,_0x5880a1){if(_0xacec09['body']['id']){delete _0xacec09[_0x8bae('0x4f')]['id'];}return db[_0x8bae('0x31')][_0x8bae('0x4d')]({'where':{'id':_0xacec09[_0x8bae('0x4b')]['id']}})[_0x8bae('0x27')](handleEntityNotFound(_0x5880a1,null))['then'](saveUpdates(_0xacec09[_0x8bae('0x4f')],null))['then'](respondWithResult(_0x5880a1,null))['catch'](handleError(_0x5880a1,null));};exports[_0x8bae('0x28')]=function(_0x15e851,_0x2e6823){return db[_0x8bae('0x31')][_0x8bae('0x4d')]({'where':{'id':_0x15e851[_0x8bae('0x4b')]['id']}})[_0x8bae('0x27')](handleEntityNotFound(_0x2e6823,null))[_0x8bae('0x27')](removeEntity(_0x2e6823,null))['catch'](handleError(_0x2e6823,null));};exports['getQueues']=function(_0x1924c0,_0xf55751,_0x3ce076){return db[_0x8bae('0x31')]['findOne']({'where':{'id':_0x1924c0[_0x8bae('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf55751,null))[_0x8bae('0x27')](function(_0x1c0df8){if(!_0x1924c0['query'][_0x8bae('0x56')]||!utils[_0x8bae('0x57')](_0x1924c0[_0x8bae('0x36')][_0x8bae('0x56')])){throw new db['Sequelize'][(_0x8bae('0x58'))](_0x8bae('0x59'));}var _0x14cb06={};var _0x54a8e1={};_0x54a8e1[_0x8bae('0x35')]=_[_0x8bae('0x37')](db[_[_0x8bae('0x5a')](_0x1924c0[_0x8bae('0x36')][_0x8bae('0x56')][_0x8bae('0x5b')]())+_0x8bae('0x5c')][_0x8bae('0x32')]);_0x54a8e1[_0x8bae('0x36')]=_[_0x8bae('0x37')](_0x1924c0[_0x8bae('0x36')]);_0x54a8e1[_0x8bae('0x38')]=_[_0x8bae('0x39')](_0x54a8e1[_0x8bae('0x35')],_0x54a8e1['query']);_0x14cb06[_0x8bae('0x3b')]=_[_0x8bae('0x39')](_0x54a8e1['model'],qs[_0x8bae('0x3a')](_0x1924c0['query']['fields']));_0x14cb06[_0x8bae('0x3b')]=_0x14cb06[_0x8bae('0x3b')][_0x8bae('0x3c')]?_0x14cb06[_0x8bae('0x3b')]:_0x54a8e1[_0x8bae('0x35')];_0x14cb06['limit']=qs['limit'](_0x1924c0[_0x8bae('0x36')][_0x8bae('0x21')]);_0x14cb06[_0x8bae('0x20')]=qs['offset'](_0x1924c0[_0x8bae('0x36')]['offset']);_0x14cb06['order']=qs[_0x8bae('0x40')](_0x1924c0[_0x8bae('0x36')][_0x8bae('0x40')]);_0x14cb06['where']=qs[_0x8bae('0x38')](_['pick'](_0x1924c0[_0x8bae('0x36')],_0x54a8e1[_0x8bae('0x38')]));_0x14cb06=_[_0x8bae('0x43')]({},_0x14cb06,_0x1924c0['options']);return _0x1c0df8[_0x8bae('0x29')+_['capitalize'](_0x1924c0['query'][_0x8bae('0x56')]['toLowerCase']())+'Queues'](_0x14cb06);})[_0x8bae('0x27')](respondWithResult(_0xf55751,null))[_0x8bae('0x49')](handleError(_0xf55751,null));};exports[_0x8bae('0x5d')]=function(_0x125413,_0x9212dd,_0x169a8e){return db[_0x8bae('0x31')]['findOne']({'where':{'id':_0x125413[_0x8bae('0x4b')]['id']}})[_0x8bae('0x27')](function(_0x16df61){if(_0x16df61){if(!_0x125413[_0x8bae('0x4f')][_0x8bae('0x56')]||!utils[_0x8bae('0x57')](_0x125413['body'][_0x8bae('0x56')])){throw new db[(_0x8bae('0x5e'))][(_0x8bae('0x58'))]('Unknown\x20channel');}return _0x16df61[_0x8bae('0x5f')+_[_0x8bae('0x5a')](_0x125413[_0x8bae('0x4f')][_0x8bae('0x56')]['toLowerCase']())+_0x8bae('0x60')](_0x125413['body'][_0x8bae('0x61')]);}return null;})[_0x8bae('0x27')](handleEntityNotFound(_0x9212dd,null))[_0x8bae('0x27')](respondWithStatusCode(_0x9212dd,null))[_0x8bae('0x49')](handleError(_0x9212dd,null));};exports[_0x8bae('0x62')]=function(_0x2f17df,_0x4d83b1,_0x5e979c){return db[_0x8bae('0x31')][_0x8bae('0x63')]({'where':{'id':_0x2f17df[_0x8bae('0x4b')]['id']}})[_0x8bae('0x27')](function(_0x1305e1){if(_0x1305e1){if(!_0x2f17df[_0x8bae('0x36')]['channel']||!utils[_0x8bae('0x57')](_0x2f17df[_0x8bae('0x36')][_0x8bae('0x56')])){throw new db[(_0x8bae('0x5e'))][(_0x8bae('0x58'))](_0x8bae('0x59'));}return _0x1305e1['remove'+_['capitalize'](_0x2f17df[_0x8bae('0x36')]['channel']['toLowerCase']())+_0x8bae('0x60')](_0x2f17df['query'][_0x8bae('0x61')]);}return null;})[_0x8bae('0x27')](handleEntityNotFound(_0x4d83b1,null))[_0x8bae('0x27')](respondWithStatusCode(_0x4d83b1,null))['catch'](handleError(_0x4d83b1,null));};exports[_0x8bae('0x64')]=function(_0x151545,_0x26e7ba,_0x405b9c){return db['Team'][_0x8bae('0x4d')]({'where':{'id':_0x151545['params']['id']}})['then'](handleEntityNotFound(_0x26e7ba,null))[_0x8bae('0x27')](function(_0x2411c3){if(_0x2411c3){var _0x103a17=[_0x8bae('0x65'),_0x8bae('0x66'),'Mail',_0x8bae('0x67'),_0x8bae('0x68'),_0x8bae('0x69'),_0x8bae('0x6a')];return BPromise[_0x8bae('0x6b')](_0x103a17,function(_0xb3b4d1){return _0x2411c3[_0x8bae('0x29')+_0xb3b4d1+_0x8bae('0x60')]({'attributes':['id',_0x8bae('0x2e')]})[_0x8bae('0x27')](function(_0x4718bb){return BPromise[_0x8bae('0x6b')](_0x4718bb,function(_0x3817dc){return _0x3817dc['addAgents'](_0x151545[_0x8bae('0x4f')][_0x8bae('0x61')])[_0x8bae('0x27')](function(){if(_0xb3b4d1===_0x8bae('0x65')){return db[_0x8bae('0x6c')][_0x8bae('0x47')]({'where':{'id':_0x151545[_0x8bae('0x4f')][_0x8bae('0x61')]},'attributes':['id',_0x8bae('0x2e'),_0x8bae('0x6d'),_0x8bae('0x6e'),_0x8bae('0x6f')],'raw':!![]})[_0x8bae('0x27')](function(_0xdb0d6c){return BPromise[_0x8bae('0x6b')](_[_0x8bae('0x70')](_0xdb0d6c,{'online':0x1}),function(_0x5bf762){return db[_0x8bae('0x71')]['upsert']({'membername':_0x5bf762['name'],'UserId':_0x5bf762['id'],'queue_name':_0x3817dc[_0x8bae('0x2e')],'VoiceQueueId':_0x3817dc['id'],'interface':_[_0x8bae('0x72')](_0x5bf762[_0x8bae('0x6f')])?util['format'](_0x8bae('0x73'),_0x5bf762['name']):_0x5bf762[_0x8bae('0x6f')],'paused':_0x5bf762[_0x8bae('0x6e')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x2411c3;});})['then'](function(){return _0x2411c3;});}})['then'](function(_0x39a520){if(_0x39a520){return _0x39a520[_0x8bae('0x64')](_0x151545[_0x8bae('0x4f')][_0x8bae('0x61')],_[_0x8bae('0x74')](_0x151545[_0x8bae('0x4f')],[_0x8bae('0x61'),'id'])||{})[_0x8bae('0x75')](function(_0x40d75c){for(var _0x17e8a3=0x0;_0x17e8a3<_0x151545[_0x8bae('0x4f')][_0x8bae('0x61')]['length'];_0x17e8a3+=0x1){socket[_0x8bae('0x76')](_0x8bae('0x77'),{'UserId':_0x151545['body'][_0x8bae('0x61')][_0x17e8a3],'TeamId':_0x151545[_0x8bae('0x4b')]['id']});}return _0x40d75c;});}})[_0x8bae('0x27')](respondWithResult(_0x26e7ba,null))[_0x8bae('0x49')](handleError(_0x26e7ba,null));};exports[_0x8bae('0x78')]=function(_0xa00998,_0x3e0d7d,_0x244bb2){return db[_0x8bae('0x31')][_0x8bae('0x4d')]({'where':{'id':_0xa00998[_0x8bae('0x4b')]['id']}})[_0x8bae('0x27')](handleEntityNotFound(_0x3e0d7d,null))['then'](function(_0x280d90){if(_0x280d90){return BPromise['each']([_0x8bae('0x79'),_0x8bae('0x7a'),_0x8bae('0x7b'),_0x8bae('0x7c'),_0x8bae('0x7d'),_0x8bae('0x7e'),'whatsapp'],function(_0xcb4d24){return _0x280d90[_0x8bae('0x29')+_[_0x8bae('0x5a')](_0xcb4d24)+_0x8bae('0x60')]({'attributes':['id',_0x8bae('0x2e')]})['then'](function(_0x4ba7b2){return BPromise[_0x8bae('0x6b')](_0x4ba7b2,function(_0x5106e3){return _0x5106e3['removeAgents'](_0xa00998[_0x8bae('0x36')][_0x8bae('0x61')])[_0x8bae('0x27')](function(){if(_0xcb4d24===_0x8bae('0x79')){return db[_0x8bae('0x71')][_0x8bae('0x28')]({'where':{'VoiceQueueId':_0x5106e3['id'],'UserId':_0xa00998[_0x8bae('0x36')][_0x8bae('0x61')]}});}});});})[_0x8bae('0x27')](function(){return _0x280d90;});})[_0x8bae('0x27')](function(){return _0x280d90;});}})[_0x8bae('0x27')](function(_0x3c3eac){if(_0x3c3eac){return _0x3c3eac['removeAgents'](_0xa00998[_0x8bae('0x36')][_0x8bae('0x61')])[_0x8bae('0x27')](function(){if(_[_0x8bae('0x7f')](_0xa00998['query']['ids'])){for(var _0x90215b=0x0;_0x90215b<_0xa00998[_0x8bae('0x36')]['ids'][_0x8bae('0x3c')];_0x90215b+=0x1){socket[_0x8bae('0x76')](_0x8bae('0x80'),{'UserId':Number(_0xa00998[_0x8bae('0x36')]['ids'][_0x90215b]),'TeamId':Number(_0xa00998[_0x8bae('0x4b')]['id'])});}}else{socket['emit'](_0x8bae('0x80'),{'UserId':Number(_0xa00998[_0x8bae('0x36')][_0x8bae('0x61')]),'TeamId':Number(_0xa00998[_0x8bae('0x4b')]['id'])});}});}})[_0x8bae('0x27')](respondWithStatusCode(_0x3e0d7d,null))[_0x8bae('0x49')](handleError(_0x3e0d7d,null));};exports[_0x8bae('0x81')]=function(_0x191f57,_0x5e9b2e,_0x3c75e){var _0x240fbc={};var _0x1ca6dd={};var _0x388d23;var _0x2fc871;return db['Team'][_0x8bae('0x63')]({'where':{'id':_0x191f57['params']['id']}})[_0x8bae('0x27')](handleEntityNotFound(_0x5e9b2e,null))[_0x8bae('0x27')](function(_0x5e5169){if(_0x5e5169){_0x388d23=_0x5e5169;_0x1ca6dd[_0x8bae('0x35')]=_[_0x8bae('0x37')](db[_0x8bae('0x6c')][_0x8bae('0x32')]);_0x1ca6dd[_0x8bae('0x36')]=_[_0x8bae('0x37')](_0x191f57[_0x8bae('0x36')]);_0x1ca6dd[_0x8bae('0x38')]=_[_0x8bae('0x39')](_0x1ca6dd[_0x8bae('0x35')],_0x1ca6dd['query']);_0x240fbc[_0x8bae('0x3b')]=_['intersection'](_0x1ca6dd['model'],qs[_0x8bae('0x3a')](_0x191f57[_0x8bae('0x36')][_0x8bae('0x3a')]));_0x240fbc[_0x8bae('0x3b')]=_0x240fbc[_0x8bae('0x3b')]['length']?_0x240fbc['attributes']:_0x1ca6dd[_0x8bae('0x35')];_0x240fbc[_0x8bae('0x3f')]=qs[_0x8bae('0x40')](_0x191f57[_0x8bae('0x36')][_0x8bae('0x40')]);_0x240fbc[_0x8bae('0x42')]=qs[_0x8bae('0x38')](_[_0x8bae('0x41')](_0x191f57[_0x8bae('0x36')],_0x1ca6dd[_0x8bae('0x38')]));if(_0x191f57[_0x8bae('0x36')]['filter']){_0x240fbc['where']=_[_0x8bae('0x43')](_0x240fbc[_0x8bae('0x42')],{'$or':_[_0x8bae('0x30')](_0x240fbc[_0x8bae('0x3b')],function(_0x120d60){var _0x5e4be1={};_0x5e4be1[_0x120d60]={'$like':'%'+_0x191f57['query'][_0x8bae('0x70')]+'%'};return _0x5e4be1;})});}_0x240fbc=_[_0x8bae('0x43')]({},_0x240fbc,_0x191f57[_0x8bae('0x45')]);return _0x388d23[_0x8bae('0x81')](_0x240fbc);}})['then'](function(_0x2e265c){if(_0x2e265c){_0x2fc871=_0x2e265c[_0x8bae('0x3c')];if(!_0x191f57[_0x8bae('0x36')]['hasOwnProperty'](_0x8bae('0x3e'))){_0x240fbc[_0x8bae('0x21')]=qs[_0x8bae('0x21')](_0x191f57[_0x8bae('0x36')][_0x8bae('0x21')]);_0x240fbc[_0x8bae('0x20')]=qs[_0x8bae('0x20')](_0x191f57[_0x8bae('0x36')][_0x8bae('0x20')]);}return _0x388d23['getAgents'](_0x240fbc);}})[_0x8bae('0x27')](function(_0x539ada){if(_0x539ada){return _0x539ada?{'count':_0x2fc871,'rows':_0x539ada}:null;}})[_0x8bae('0x27')](respondWithResult(_0x5e9b2e,null))[_0x8bae('0x49')](handleError(_0x5e9b2e,null));}; \ No newline at end of file +var _0x1df9=['voicePause','omit','spread','userTeam:save','removeAgents','voice','mail','sms','fax','openchannel','whatsapp','isArray','emit','userTeam:remove','getAgents','hasOwnProperty','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./team.socket','status','json','count','offset','set','Content-Range','apply','save','then','destroy','get','Teams','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','getQueues','channel','isValidChannel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','findOne','add','ids','removeQueues','ValidationError','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','online','UserVoiceQueueRt','isNil','interface','format','SIP/%s'];(function(_0x5a51a4,_0x499e94){var _0x2b9d18=function(_0x52b588){while(--_0x52b588){_0x5a51a4['push'](_0x5a51a4['shift']());}};_0x2b9d18(++_0x499e94);}(_0x1df9,0x19d));var _0x91df=function(_0xf2e805,_0x1a4e9){_0xf2e805=_0xf2e805-0x0;var _0x109842=_0x1df9[_0xf2e805];return _0x109842;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91df('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91df('0x1'));var jsonpatch=require(_0x91df('0x2'));var rp=require(_0x91df('0x3'));var moment=require(_0x91df('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x91df('0x5'));var sox=require('sox');var csv=require(_0x91df('0x6'));var ejs=require(_0x91df('0x7'));var fs=require('fs');var _=require(_0x91df('0x8'));var squel=require('squel');var crypto=require(_0x91df('0x9'));var jsforce=require(_0x91df('0xa'));var deskjs=require(_0x91df('0xb'));var toCsv=require('to-csv');var querystring=require(_0x91df('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x91df('0xd'));var hardwareService=require(_0x91df('0xe'));var logger=require(_0x91df('0xf'))('api');var utils=require(_0x91df('0x10'));var config=require(_0x91df('0x11'));var licenseUtil=require(_0x91df('0x12'));var db=require(_0x91df('0x13'))['db'];config['redis']=_[_0x91df('0x14')](config[_0x91df('0x15')],{'host':_0x91df('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91df('0x15')]));require(_0x91df('0x17'))['register'](socket);function respondWithStatusCode(_0x196ae6,_0x5ddc79){_0x5ddc79=_0x5ddc79||0xcc;return function(_0x2c3eef){if(_0x2c3eef){return _0x196ae6['sendStatus'](_0x5ddc79);}return _0x196ae6[_0x91df('0x18')](_0x5ddc79)['end']();};}function respondWithResult(_0x522225,_0x54c2eb){_0x54c2eb=_0x54c2eb||0xc8;return function(_0x37efbe){if(_0x37efbe){return _0x522225[_0x91df('0x18')](_0x54c2eb)[_0x91df('0x19')](_0x37efbe);}};}function respondWithFilteredResult(_0x4b3969,_0x4613fd){return function(_0x166237){if(_0x166237){var _0x37820a=_0x166237[_0x91df('0x1a')],_0xf4fe03=_0x4613fd[_0x91df('0x1b')],_0x2865fe=_0x4613fd[_0x91df('0x1b')]+_0x4613fd['limit'],_0x32d291;if(_0x2865fe>=_0x37820a){_0x2865fe=_0x37820a;_0x32d291=0xc8;}else{_0x32d291=0xce;}_0x4b3969['status'](_0x32d291);return _0x4b3969[_0x91df('0x1c')](_0x91df('0x1d'),_0xf4fe03+'-'+_0x2865fe+'/'+_0x37820a)[_0x91df('0x19')](_0x166237);}return null;};}function patchUpdates(_0xd6128b){return function(_0x4fd828){try{jsonpatch[_0x91df('0x1e')](_0x4fd828,_0xd6128b,!![]);}catch(_0x3a5bab){return BPromise['reject'](_0x3a5bab);}return _0x4fd828[_0x91df('0x1f')]();};}function saveUpdates(_0xd872ca,_0x887db4){return function(_0x35c368){if(_0x35c368){return _0x35c368['update'](_0xd872ca)[_0x91df('0x20')](function(_0x51c545){return _0x51c545;});}return null;};}function removeEntity(_0x535055,_0x4d6228){return function(_0x3ba927){if(_0x3ba927){return _0x3ba927[_0x91df('0x21')]()['then'](function(){var _0x18c5f9=_0x3ba927[_0x91df('0x22')]({'plain':!![]});var _0x2cbb9e=_0x91df('0x23');return db[_0x91df('0x24')][_0x91df('0x21')]({'where':{'type':_0x2cbb9e,'resourceId':_0x18c5f9['id']}})[_0x91df('0x20')](function(){return _0x3ba927;});})[_0x91df('0x20')](function(){_0x535055[_0x91df('0x18')](0xcc)[_0x91df('0x25')]();});}};}function handleEntityNotFound(_0x16ce5d,_0x39c7de){return function(_0x56b245){if(!_0x56b245){_0x16ce5d[_0x91df('0x26')](0x194);}return _0x56b245;};}function handleError(_0x23ca76,_0x254505){_0x254505=_0x254505||0x1f4;return function(_0x39ef4b){logger[_0x91df('0x27')](_0x39ef4b[_0x91df('0x28')]);if(_0x39ef4b[_0x91df('0x29')]){delete _0x39ef4b[_0x91df('0x29')];}_0x23ca76[_0x91df('0x18')](_0x254505)[_0x91df('0x2a')](_0x39ef4b);};}exports[_0x91df('0x2b')]=function(_0x43ac0c,_0x3af663){var _0x4010ad={},_0x464d5a={},_0x174fc8={'count':0x0,'rows':[]};var _0x1d1d62=_[_0x91df('0x2c')](db[_0x91df('0x2d')]['rawAttributes'],function(_0x49eae3){return{'name':_0x49eae3[_0x91df('0x2e')],'type':_0x49eae3[_0x91df('0x2f')][_0x91df('0x30')]};});_0x464d5a[_0x91df('0x31')]=_[_0x91df('0x2c')](_0x1d1d62,_0x91df('0x29'));_0x464d5a[_0x91df('0x32')]=_[_0x91df('0x33')](_0x43ac0c[_0x91df('0x32')]);_0x464d5a[_0x91df('0x34')]=_[_0x91df('0x35')](_0x464d5a[_0x91df('0x31')],_0x464d5a[_0x91df('0x32')]);_0x4010ad[_0x91df('0x36')]=_['intersection'](_0x464d5a[_0x91df('0x31')],qs[_0x91df('0x37')](_0x43ac0c[_0x91df('0x32')][_0x91df('0x37')]));_0x4010ad[_0x91df('0x36')]=_0x4010ad[_0x91df('0x36')][_0x91df('0x38')]?_0x4010ad[_0x91df('0x36')]:_0x464d5a['model'];if(!_0x43ac0c[_0x91df('0x32')]['hasOwnProperty']('nolimit')){_0x4010ad[_0x91df('0x39')]=qs[_0x91df('0x39')](_0x43ac0c[_0x91df('0x32')]['limit']);_0x4010ad[_0x91df('0x1b')]=qs[_0x91df('0x1b')](_0x43ac0c['query'][_0x91df('0x1b')]);}_0x4010ad['order']=qs[_0x91df('0x3a')](_0x43ac0c['query']['sort']);_0x4010ad[_0x91df('0x3b')]=qs[_0x91df('0x34')](_[_0x91df('0x3c')](_0x43ac0c[_0x91df('0x32')],_0x464d5a['filters']),_0x1d1d62);if(_0x43ac0c['query'][_0x91df('0x3d')]){_0x4010ad[_0x91df('0x3b')]=_[_0x91df('0x3e')](_0x4010ad[_0x91df('0x3b')],{'$or':_[_0x91df('0x2c')](_0x1d1d62,function(_0x541180){if(_0x541180[_0x91df('0x2f')]!==_0x91df('0x3f')){var _0x30913c={};_0x30913c[_0x541180[_0x91df('0x29')]]={'$like':'%'+_0x43ac0c[_0x91df('0x32')][_0x91df('0x3d')]+'%'};return _0x30913c;}})});}_0x4010ad=_[_0x91df('0x3e')]({},_0x4010ad,_0x43ac0c[_0x91df('0x40')]);var _0x353251={'where':_0x4010ad['where']};return db['Team'][_0x91df('0x1a')](_0x353251)[_0x91df('0x20')](function(_0x15c913){_0x174fc8['count']=_0x15c913;if(_0x43ac0c[_0x91df('0x32')][_0x91df('0x41')]){_0x4010ad[_0x91df('0x42')]=[{'all':!![]}];}return db[_0x91df('0x2d')][_0x91df('0x43')](_0x4010ad);})[_0x91df('0x20')](function(_0x17b08e){_0x174fc8[_0x91df('0x44')]=_0x17b08e;return _0x174fc8;})['then'](respondWithFilteredResult(_0x3af663,_0x4010ad))[_0x91df('0x45')](handleError(_0x3af663,null));};exports['show']=function(_0x84793e,_0x5625e3){var _0x3c6747={'raw':![],'where':{'id':_0x84793e[_0x91df('0x46')]['id']}},_0xc42d78={};_0xc42d78['model']=_[_0x91df('0x33')](db[_0x91df('0x2d')][_0x91df('0x47')]);_0xc42d78['query']=_[_0x91df('0x33')](_0x84793e[_0x91df('0x32')]);_0xc42d78['filters']=_[_0x91df('0x35')](_0xc42d78[_0x91df('0x31')],_0xc42d78[_0x91df('0x32')]);_0x3c6747[_0x91df('0x36')]=_['intersection'](_0xc42d78['model'],qs[_0x91df('0x37')](_0x84793e[_0x91df('0x32')][_0x91df('0x37')]));_0x3c6747['attributes']=_0x3c6747[_0x91df('0x36')][_0x91df('0x38')]?_0x3c6747[_0x91df('0x36')]:_0xc42d78[_0x91df('0x31')];if(_0x84793e[_0x91df('0x32')]['includeAll']){_0x3c6747[_0x91df('0x42')]=[{'all':!![]}];}_0x3c6747=_[_0x91df('0x3e')]({},_0x3c6747,_0x84793e['options']);return db['Team'][_0x91df('0x48')](_0x3c6747)[_0x91df('0x20')](handleEntityNotFound(_0x5625e3,null))['then'](respondWithResult(_0x5625e3,null))['catch'](handleError(_0x5625e3,null));};exports[_0x91df('0x49')]=function(_0x4fe9ac,_0x4d0965){return db[_0x91df('0x2d')]['create'](_0x4fe9ac[_0x91df('0x4a')],{})[_0x91df('0x20')](function(_0x3d5615){var _0x17e818=_0x4fe9ac[_0x91df('0x4b')][_0x91df('0x22')]({'plain':!![]});if(!_0x17e818)throw new Error(_0x91df('0x4c'));if(_0x17e818[_0x91df('0x4d')]===_0x91df('0x4b')){var _0x3eb5ba=_0x3d5615['get']({'plain':!![]});var _0x2fdf14=_0x91df('0x23');return db[_0x91df('0x4e')]['find']({'where':{'name':_0x2fdf14,'userProfileId':_0x17e818[_0x91df('0x4f')]},'raw':!![]})[_0x91df('0x20')](function(_0x59acf3){if(_0x59acf3&&_0x59acf3[_0x91df('0x50')]===0x0){return db[_0x91df('0x24')][_0x91df('0x49')]({'name':_0x3eb5ba[_0x91df('0x29')],'resourceId':_0x3eb5ba['id'],'type':_0x59acf3[_0x91df('0x29')],'sectionId':_0x59acf3['id']},{})[_0x91df('0x20')](function(){return _0x3d5615;});}else{return _0x3d5615;}})[_0x91df('0x45')](function(_0x5a3fff){logger[_0x91df('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a3fff);throw _0x5a3fff;});}return _0x3d5615;})[_0x91df('0x20')](respondWithResult(_0x4d0965,0xc9))['catch'](handleError(_0x4d0965,null));};exports[_0x91df('0x51')]=function(_0x5959ac,_0x1d8da2){if(_0x5959ac[_0x91df('0x4a')]['id']){delete _0x5959ac[_0x91df('0x4a')]['id'];}return db[_0x91df('0x2d')][_0x91df('0x48')]({'where':{'id':_0x5959ac[_0x91df('0x46')]['id']}})[_0x91df('0x20')](handleEntityNotFound(_0x1d8da2,null))['then'](saveUpdates(_0x5959ac[_0x91df('0x4a')],null))[_0x91df('0x20')](respondWithResult(_0x1d8da2,null))[_0x91df('0x45')](handleError(_0x1d8da2,null));};exports[_0x91df('0x21')]=function(_0x2807a1,_0x106123){return db[_0x91df('0x2d')][_0x91df('0x48')]({'where':{'id':_0x2807a1['params']['id']}})['then'](handleEntityNotFound(_0x106123,null))[_0x91df('0x20')](removeEntity(_0x106123,null))[_0x91df('0x45')](handleError(_0x106123,null));};exports[_0x91df('0x52')]=function(_0x31877b,_0x14265e,_0x5445df){return db['Team']['findOne']({'where':{'id':_0x31877b[_0x91df('0x46')]['id']}})['then'](handleEntityNotFound(_0x14265e,null))[_0x91df('0x20')](function(_0x4a6a62){if(!_0x31877b[_0x91df('0x32')][_0x91df('0x53')]||!utils[_0x91df('0x54')](_0x31877b['query']['channel'])){throw new db[(_0x91df('0x55'))]['ValidationError'](_0x91df('0x56'));}var _0x3205a9={};var _0x121231={};_0x121231[_0x91df('0x31')]=_[_0x91df('0x33')](db[_[_0x91df('0x57')](_0x31877b[_0x91df('0x32')][_0x91df('0x53')][_0x91df('0x58')]())+_0x91df('0x59')]['rawAttributes']);_0x121231[_0x91df('0x32')]=_[_0x91df('0x33')](_0x31877b[_0x91df('0x32')]);_0x121231[_0x91df('0x34')]=_[_0x91df('0x35')](_0x121231[_0x91df('0x31')],_0x121231[_0x91df('0x32')]);_0x3205a9[_0x91df('0x36')]=_['intersection'](_0x121231[_0x91df('0x31')],qs[_0x91df('0x37')](_0x31877b[_0x91df('0x32')][_0x91df('0x37')]));_0x3205a9['attributes']=_0x3205a9[_0x91df('0x36')][_0x91df('0x38')]?_0x3205a9[_0x91df('0x36')]:_0x121231[_0x91df('0x31')];_0x3205a9[_0x91df('0x39')]=qs[_0x91df('0x39')](_0x31877b[_0x91df('0x32')][_0x91df('0x39')]);_0x3205a9[_0x91df('0x1b')]=qs[_0x91df('0x1b')](_0x31877b['query'][_0x91df('0x1b')]);_0x3205a9[_0x91df('0x5a')]=qs[_0x91df('0x3a')](_0x31877b[_0x91df('0x32')][_0x91df('0x3a')]);_0x3205a9[_0x91df('0x3b')]=qs['filters'](_[_0x91df('0x3c')](_0x31877b['query'],_0x121231[_0x91df('0x34')]));_0x3205a9=_[_0x91df('0x3e')]({},_0x3205a9,_0x31877b[_0x91df('0x40')]);return _0x4a6a62[_0x91df('0x22')+_[_0x91df('0x57')](_0x31877b[_0x91df('0x32')]['channel'][_0x91df('0x58')]())+_0x91df('0x5b')](_0x3205a9);})['then'](respondWithResult(_0x14265e,null))['catch'](handleError(_0x14265e,null));};exports[_0x91df('0x5c')]=function(_0x2fba4e,_0x40934b,_0x8b1070){return db[_0x91df('0x2d')][_0x91df('0x5d')]({'where':{'id':_0x2fba4e['params']['id']}})[_0x91df('0x20')](function(_0x40acfe){if(_0x40acfe){if(!_0x2fba4e['body'][_0x91df('0x53')]||!utils[_0x91df('0x54')](_0x2fba4e[_0x91df('0x4a')][_0x91df('0x53')])){throw new db[(_0x91df('0x55'))]['ValidationError'](_0x91df('0x56'));}return _0x40acfe[_0x91df('0x5e')+_[_0x91df('0x57')](_0x2fba4e[_0x91df('0x4a')][_0x91df('0x53')]['toLowerCase']())+_0x91df('0x5b')](_0x2fba4e['body'][_0x91df('0x5f')]);}return null;})[_0x91df('0x20')](handleEntityNotFound(_0x40934b,null))['then'](respondWithStatusCode(_0x40934b,null))['catch'](handleError(_0x40934b,null));};exports[_0x91df('0x60')]=function(_0x36c348,_0x491b41,_0x2be20d){return db['Team']['findOne']({'where':{'id':_0x36c348[_0x91df('0x46')]['id']}})[_0x91df('0x20')](function(_0x3e4551){if(_0x3e4551){if(!_0x36c348[_0x91df('0x32')][_0x91df('0x53')]||!utils['isValidChannel'](_0x36c348[_0x91df('0x32')][_0x91df('0x53')])){throw new db[(_0x91df('0x55'))][(_0x91df('0x61'))]('Unknown\x20channel');}return _0x3e4551[_0x91df('0x62')+_['capitalize'](_0x36c348[_0x91df('0x32')]['channel'][_0x91df('0x58')]())+'Queues'](_0x36c348[_0x91df('0x32')]['ids']);}return null;})[_0x91df('0x20')](handleEntityNotFound(_0x491b41,null))[_0x91df('0x20')](respondWithStatusCode(_0x491b41,null))[_0x91df('0x45')](handleError(_0x491b41,null));};exports[_0x91df('0x63')]=function(_0x29e68b,_0x48931c,_0x1934e5){return db[_0x91df('0x2d')][_0x91df('0x48')]({'where':{'id':_0x29e68b['params']['id']}})[_0x91df('0x20')](handleEntityNotFound(_0x48931c,null))[_0x91df('0x20')](function(_0x18e0a7){if(_0x18e0a7){var _0x25a5f5=[_0x91df('0x64'),_0x91df('0x65'),_0x91df('0x66'),_0x91df('0x67'),_0x91df('0x68'),_0x91df('0x69'),_0x91df('0x6a')];return BPromise[_0x91df('0x6b')](_0x25a5f5,function(_0x32f2c3){return _0x18e0a7[_0x91df('0x22')+_0x32f2c3+_0x91df('0x5b')]({'attributes':['id','name']})[_0x91df('0x20')](function(_0x16e245){return BPromise[_0x91df('0x6b')](_0x16e245,function(_0x5455f4){return _0x5455f4['addAgents'](_0x29e68b[_0x91df('0x4a')][_0x91df('0x5f')])['then'](function(){if(_0x32f2c3===_0x91df('0x64')){return db[_0x91df('0x6c')][_0x91df('0x43')]({'where':{'id':_0x29e68b[_0x91df('0x4a')][_0x91df('0x5f')]},'attributes':['id',_0x91df('0x29'),_0x91df('0x6d'),'voicePause','interface'],'raw':!![]})[_0x91df('0x20')](function(_0x43aba6){return BPromise['each'](_[_0x91df('0x3d')](_0x43aba6,{'online':0x1}),function(_0x3d5d74){return db[_0x91df('0x6e')]['upsert']({'membername':_0x3d5d74[_0x91df('0x29')],'UserId':_0x3d5d74['id'],'queue_name':_0x5455f4[_0x91df('0x29')],'VoiceQueueId':_0x5455f4['id'],'interface':_[_0x91df('0x6f')](_0x3d5d74[_0x91df('0x70')])?util[_0x91df('0x71')](_0x91df('0x72'),_0x3d5d74['name']):_0x3d5d74[_0x91df('0x70')],'paused':_0x3d5d74[_0x91df('0x73')]||![],'penalty':0x0});});});}});});})[_0x91df('0x20')](function(){return _0x18e0a7;});})[_0x91df('0x20')](function(){return _0x18e0a7;});}})[_0x91df('0x20')](function(_0x3cb33c){if(_0x3cb33c){return _0x3cb33c[_0x91df('0x63')](_0x29e68b[_0x91df('0x4a')][_0x91df('0x5f')],_[_0x91df('0x74')](_0x29e68b[_0x91df('0x4a')],[_0x91df('0x5f'),'id'])||{})[_0x91df('0x75')](function(_0x245db0){for(var _0x2a9039=0x0;_0x2a9039<_0x29e68b[_0x91df('0x4a')][_0x91df('0x5f')]['length'];_0x2a9039+=0x1){socket['emit'](_0x91df('0x76'),{'UserId':_0x29e68b['body'][_0x91df('0x5f')][_0x2a9039],'TeamId':_0x29e68b[_0x91df('0x46')]['id']});}return _0x245db0;});}})[_0x91df('0x20')](respondWithResult(_0x48931c,null))['catch'](handleError(_0x48931c,null));};exports[_0x91df('0x77')]=function(_0x3de1b6,_0x376529,_0x4d9ff2){return db[_0x91df('0x2d')][_0x91df('0x48')]({'where':{'id':_0x3de1b6[_0x91df('0x46')]['id']}})[_0x91df('0x20')](handleEntityNotFound(_0x376529,null))[_0x91df('0x20')](function(_0x2d6065){if(_0x2d6065){return BPromise[_0x91df('0x6b')]([_0x91df('0x78'),'chat',_0x91df('0x79'),_0x91df('0x7a'),_0x91df('0x7b'),_0x91df('0x7c'),_0x91df('0x7d')],function(_0x393886){return _0x2d6065[_0x91df('0x22')+_[_0x91df('0x57')](_0x393886)+_0x91df('0x5b')]({'attributes':['id',_0x91df('0x29')]})[_0x91df('0x20')](function(_0x39236d){return BPromise[_0x91df('0x6b')](_0x39236d,function(_0x554194){return _0x554194[_0x91df('0x77')](_0x3de1b6[_0x91df('0x32')][_0x91df('0x5f')])[_0x91df('0x20')](function(){if(_0x393886===_0x91df('0x78')){return db['UserVoiceQueueRt'][_0x91df('0x21')]({'where':{'VoiceQueueId':_0x554194['id'],'UserId':_0x3de1b6[_0x91df('0x32')][_0x91df('0x5f')]}});}});});})[_0x91df('0x20')](function(){return _0x2d6065;});})[_0x91df('0x20')](function(){return _0x2d6065;});}})[_0x91df('0x20')](function(_0x3a2dcc){if(_0x3a2dcc){return _0x3a2dcc[_0x91df('0x77')](_0x3de1b6[_0x91df('0x32')]['ids'])['then'](function(){if(_[_0x91df('0x7e')](_0x3de1b6[_0x91df('0x32')][_0x91df('0x5f')])){for(var _0x3e369d=0x0;_0x3e369d<_0x3de1b6[_0x91df('0x32')]['ids'][_0x91df('0x38')];_0x3e369d+=0x1){socket[_0x91df('0x7f')]('userTeam:remove',{'UserId':Number(_0x3de1b6[_0x91df('0x32')]['ids'][_0x3e369d]),'TeamId':Number(_0x3de1b6[_0x91df('0x46')]['id'])});}}else{socket[_0x91df('0x7f')](_0x91df('0x80'),{'UserId':Number(_0x3de1b6['query'][_0x91df('0x5f')]),'TeamId':Number(_0x3de1b6[_0x91df('0x46')]['id'])});}});}})[_0x91df('0x20')](respondWithStatusCode(_0x376529,null))['catch'](handleError(_0x376529,null));};exports[_0x91df('0x81')]=function(_0x1c0b84,_0xeedeb9,_0x48afbf){var _0x17a397={};var _0x593eb9={};var _0xe9151;var _0x22b40c;return db['Team'][_0x91df('0x5d')]({'where':{'id':_0x1c0b84[_0x91df('0x46')]['id']}})[_0x91df('0x20')](handleEntityNotFound(_0xeedeb9,null))[_0x91df('0x20')](function(_0x435105){if(_0x435105){_0xe9151=_0x435105;_0x593eb9[_0x91df('0x31')]=_[_0x91df('0x33')](db[_0x91df('0x6c')][_0x91df('0x47')]);_0x593eb9[_0x91df('0x32')]=_[_0x91df('0x33')](_0x1c0b84['query']);_0x593eb9[_0x91df('0x34')]=_[_0x91df('0x35')](_0x593eb9[_0x91df('0x31')],_0x593eb9[_0x91df('0x32')]);_0x17a397['attributes']=_['intersection'](_0x593eb9[_0x91df('0x31')],qs[_0x91df('0x37')](_0x1c0b84[_0x91df('0x32')][_0x91df('0x37')]));_0x17a397['attributes']=_0x17a397[_0x91df('0x36')][_0x91df('0x38')]?_0x17a397[_0x91df('0x36')]:_0x593eb9[_0x91df('0x31')];_0x17a397['order']=qs[_0x91df('0x3a')](_0x1c0b84[_0x91df('0x32')][_0x91df('0x3a')]);_0x17a397[_0x91df('0x3b')]=qs[_0x91df('0x34')](_[_0x91df('0x3c')](_0x1c0b84[_0x91df('0x32')],_0x593eb9[_0x91df('0x34')]));if(_0x1c0b84[_0x91df('0x32')][_0x91df('0x3d')]){_0x17a397[_0x91df('0x3b')]=_[_0x91df('0x3e')](_0x17a397[_0x91df('0x3b')],{'$or':_[_0x91df('0x2c')](_0x17a397[_0x91df('0x36')],function(_0x435d2d){var _0x33e871={};_0x33e871[_0x435d2d]={'$like':'%'+_0x1c0b84['query'][_0x91df('0x3d')]+'%'};return _0x33e871;})});}_0x17a397=_[_0x91df('0x3e')]({},_0x17a397,_0x1c0b84[_0x91df('0x40')]);return _0xe9151[_0x91df('0x81')](_0x17a397);}})[_0x91df('0x20')](function(_0x110995){if(_0x110995){_0x22b40c=_0x110995[_0x91df('0x38')];if(!_0x1c0b84['query'][_0x91df('0x82')](_0x91df('0x83'))){_0x17a397[_0x91df('0x39')]=qs['limit'](_0x1c0b84[_0x91df('0x32')][_0x91df('0x39')]);_0x17a397[_0x91df('0x1b')]=qs[_0x91df('0x1b')](_0x1c0b84[_0x91df('0x32')][_0x91df('0x1b')]);}return _0xe9151[_0x91df('0x81')](_0x17a397);}})[_0x91df('0x20')](function(_0x40a549){if(_0x40a549){return _0x40a549?{'count':_0x22b40c,'rows':_0x40a549}:null;}})[_0x91df('0x20')](respondWithResult(_0xeedeb9,null))['catch'](handleError(_0xeedeb9,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b7c0c6b..65545e2 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 _0xf52c=['exports','events','../../mysqldb','Team','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x4c9b15,_0xa00fef){var _0x42655f=function(_0x158198){while(--_0x158198){_0x4c9b15['push'](_0x4c9b15['shift']());}};_0x42655f(++_0xa00fef);}(_0xf52c,0x179));var _0xcf52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf52c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xcf52('0x0'));var Team=require(_0xcf52('0x1'))['db'][_0xcf52('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xcf52('0x3')](0x0);var events={'afterCreate':_0xcf52('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e40fd){return function(_0x1561de,_0x5c88a7,_0x2dc27e){TeamEvents[_0xcf52('0x5')](_0x3e40fd+':'+_0x1561de['id'],_0x1561de);TeamEvents[_0xcf52('0x5')](_0x3e40fd,_0x1561de);_0x2dc27e(null);};}for(var e in events){if(events[_0xcf52('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xcf52('0x7')]=TeamEvents; \ No newline at end of file +var _0x77fb=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x77fb,0x1ec));var _0xb77f=function(_0x5d0c92,_0x5d9fd7){_0x5d0c92=_0x5d0c92-0x0;var _0x56756a=_0x77fb[_0x5d0c92];return _0x56756a;};'use strict';var EventEmitter=require(_0xb77f('0x0'));var Team=require(_0xb77f('0x1'))['db'][_0xb77f('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xb77f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb77f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x366f18){return function(_0x1cd077,_0x15339f,_0x7ad728){TeamEvents[_0xb77f('0x5')](_0x366f18+':'+_0x1cd077['id'],_0x1cd077);TeamEvents['emit'](_0x366f18,_0x1cd077);_0x7ad728(null);};}for(var e in events){if(events[_0xb77f('0x6')](e)){var event=events[e];Team[_0xb77f('0x7')](e,emitEvent(event));}}module[_0xb77f('0x8')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d2ae008..ccff150 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 _0x28c7=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','lodash','util','../../config/logger'];(function(_0x38e389,_0x40939b){var _0xd0c395=function(_0x2f5179){while(--_0x2f5179){_0x38e389['push'](_0x38e389['shift']());}};_0xd0c395(++_0x40939b);}(_0x28c7,0x16f));var _0x728c=function(_0x43131d,_0x2db0c4){_0x43131d=_0x43131d-0x0;var _0x27918b=_0x28c7[_0x43131d];return _0x27918b;};'use strict';var _=require(_0x728c('0x0'));var util=require(_0x728c('0x1'));var logger=require(_0x728c('0x2'))(_0x728c('0x3'));var moment=require('moment');var BPromise=require(_0x728c('0x4'));var rp=require(_0x728c('0x5'));var fs=require('fs');var path=require(_0x728c('0x6'));var rimraf=require(_0x728c('0x7'));var config=require(_0x728c('0x8'));var attributes=require('./team.attributes');module[_0x728c('0x9')]=function(_0x11792e,_0x4b0d29){return _0x11792e['define']('Team',attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb441=['moment','bluebird','request-promise','../../config/environment','define','Team','lodash','util','../../config/logger','api'];(function(_0x24563c,_0x49d7cd){var _0x14796e=function(_0x3ab3d9){while(--_0x3ab3d9){_0x24563c['push'](_0x24563c['shift']());}};_0x14796e(++_0x49d7cd);}(_0xb441,0x178));var _0x1b44=function(_0x221e9c,_0x192103){_0x221e9c=_0x221e9c-0x0;var _0x549b7a=_0xb441[_0x221e9c];return _0x549b7a;};'use strict';var _=require(_0x1b44('0x0'));var util=require(_0x1b44('0x1'));var logger=require(_0x1b44('0x2'))(_0x1b44('0x3'));var moment=require(_0x1b44('0x4'));var BPromise=require(_0x1b44('0x5'));var rp=require(_0x1b44('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b44('0x7'));var attributes=require('./team.attributes');module['exports']=function(_0xa7b67f,_0x5628df){return _0xa7b67f[_0x1b44('0x8')](_0x1b44('0x9'),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 dfdd12d..f7585fb 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 _0xfa53=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5bbbc3,_0x5f4f7b){var _0x29bf6e=function(_0x329514){while(--_0x329514){_0x5bbbc3['push'](_0x5bbbc3['shift']());}};_0x29bf6e(++_0x5f4f7b);}(_0xfa53,0x186));var _0x3fa5=function(_0x3fc40e,_0x5c2d4a){_0x3fc40e=_0x3fc40e-0x0;var _0x43ed22=_0xfa53[_0x3fc40e];return _0x43ed22;};'use strict';var _=require(_0x3fa5('0x0'));var util=require('util');var moment=require(_0x3fa5('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fa5('0x2'));var fs=require('fs');var Redis=require(_0x3fa5('0x3'));var db=require(_0x3fa5('0x4'))['db'];var utils=require(_0x3fa5('0x5'));var logger=require(_0x3fa5('0x6'))(_0x3fa5('0x7'));var config=require(_0x3fa5('0x8'));var jayson=require(_0x3fa5('0x9'));var client=jayson[_0x3fa5('0xa')][_0x3fa5('0xb')]({'port':0x232a});config[_0x3fa5('0xc')]=_[_0x3fa5('0xd')](config[_0x3fa5('0xc')],{'host':_0x3fa5('0xe'),'port':0x18eb});var socket=require(_0x3fa5('0xf'))(new Redis(config[_0x3fa5('0xc')]));require(_0x3fa5('0x10'))[_0x3fa5('0x11')](socket);function respondWithRpcPromise(_0x6e3d7b,_0x35f36a,_0x4daaa6){return new BPromise(function(_0x226ad7,_0x2f31c1){return client[_0x3fa5('0x12')](_0x6e3d7b,_0x4daaa6)[_0x3fa5('0x13')](function(_0x309360){logger[_0x3fa5('0x14')](_0x3fa5('0x15'),_0x35f36a,_0x3fa5('0x16'));logger[_0x3fa5('0x17')](_0x3fa5('0x18'),_0x35f36a,_0x3fa5('0x16'),JSON[_0x3fa5('0x19')](_0x309360));if(_0x309360[_0x3fa5('0x1a')]){if(_0x309360[_0x3fa5('0x1a')][_0x3fa5('0x1b')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x35f36a,_0x309360[_0x3fa5('0x1a')][_0x3fa5('0x1c')]);return _0x2f31c1(_0x309360[_0x3fa5('0x1a')]['message']);}logger[_0x3fa5('0x1a')](_0x3fa5('0x15'),_0x35f36a,_0x309360[_0x3fa5('0x1a')][_0x3fa5('0x1c')]);return _0x226ad7(_0x309360[_0x3fa5('0x1a')][_0x3fa5('0x1c')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x35f36a,'request\x20sent');_0x226ad7(_0x309360[_0x3fa5('0x1d')][_0x3fa5('0x1c')]);}})['catch'](function(_0x4e0f9b){logger['error'](_0x3fa5('0x15'),_0x35f36a,_0x4e0f9b);_0x2f31c1(_0x4e0f9b);});});} \ No newline at end of file +var _0x01d7=['register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','redis','socket.io-emitter','./team.socket'];(function(_0x5bd98b,_0x22bf1c){var _0x49efe7=function(_0x2223e8){while(--_0x2223e8){_0x5bd98b['push'](_0x5bd98b['shift']());}};_0x49efe7(++_0x22bf1c);}(_0x01d7,0x114));var _0x701d=function(_0x529214,_0x421e97){_0x529214=_0x529214-0x0;var _0x5e9e40=_0x01d7[_0x529214];return _0x5e9e40;};'use strict';var _=require(_0x701d('0x0'));var util=require(_0x701d('0x1'));var moment=require(_0x701d('0x2'));var BPromise=require(_0x701d('0x3'));var rs=require(_0x701d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x701d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x701d('0x6'))('rpc');var config=require(_0x701d('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x701d('0x8')]({'port':0x232a});config[_0x701d('0x9')]=_['defaults'](config[_0x701d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x701d('0xa'))(new Redis(config['redis']));require(_0x701d('0xb'))[_0x701d('0xc')](socket);function respondWithRpcPromise(_0x358d53,_0x16f23c,_0x1b053f){return new BPromise(function(_0x35c485,_0x5e133b){return client[_0x701d('0xd')](_0x358d53,_0x1b053f)[_0x701d('0xe')](function(_0xf83dce){logger[_0x701d('0xf')](_0x701d('0x10'),_0x16f23c,_0x701d('0x11'));logger[_0x701d('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x16f23c,_0x701d('0x11'),JSON[_0x701d('0x13')](_0xf83dce));if(_0xf83dce[_0x701d('0x14')]){if(_0xf83dce[_0x701d('0x14')][_0x701d('0x15')]===0x1f4){logger[_0x701d('0x14')](_0x701d('0x10'),_0x16f23c,_0xf83dce[_0x701d('0x14')][_0x701d('0x16')]);return _0x5e133b(_0xf83dce[_0x701d('0x14')][_0x701d('0x16')]);}logger[_0x701d('0x14')](_0x701d('0x10'),_0x16f23c,_0xf83dce[_0x701d('0x14')][_0x701d('0x16')]);return _0x35c485(_0xf83dce['error'][_0x701d('0x16')]);}else{logger[_0x701d('0xf')]('Team,\x20%s,\x20%s',_0x16f23c,'request\x20sent');_0x35c485(_0xf83dce[_0x701d('0x17')][_0x701d('0x16')]);}})['catch'](function(_0x56a7d9){logger[_0x701d('0x14')](_0x701d('0x10'),_0x16f23c,_0x56a7d9);_0x5e133b(_0x56a7d9);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index f15a459..ca60cb9 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 _0xf06c=['emit','removeListener','register','./team.events','save','remove','update'];(function(_0x51b21a,_0x46a107){var _0x38dbc3=function(_0x19afec){while(--_0x19afec){_0x51b21a['push'](_0x51b21a['shift']());}};_0x38dbc3(++_0x46a107);}(_0xf06c,0xc7));var _0xcf06=function(_0x28d709,_0x2bbfb5){_0x28d709=_0x28d709-0x0;var _0xdef960=_0xf06c[_0x28d709];return _0xdef960;};'use strict';var TeamEvents=require(_0xcf06('0x0'));var events=[_0xcf06('0x1'),_0xcf06('0x2'),_0xcf06('0x3')];function createListener(_0x333a67,_0x5d3402){return function(_0x46cadb){_0x5d3402[_0xcf06('0x4')](_0x333a67,_0x46cadb);};}function removeListener(_0x1d0c26,_0x49218b){return function(){TeamEvents[_0xcf06('0x5')](_0x1d0c26,_0x49218b);};}exports[_0xcf06('0x6')]=function(_0x3de2dc){for(var _0x4e6799=0x0,_0x22ac40=events['length'];_0x4e6799<_0x22ac40;_0x4e6799++){var _0x2723ad=events[_0x4e6799];var _0x48ed0c=createListener('team:'+_0x2723ad,_0x3de2dc);TeamEvents['on'](_0x2723ad,_0x48ed0c);}}; \ No newline at end of file +var _0xd906=['register','length','remove','update','removeListener'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0xd906,0x6b));var _0x6d90=function(_0x322160,_0x59ac1a){_0x322160=_0x322160-0x0;var _0x2bcfca=_0xd906[_0x322160];return _0x2bcfca;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x6d90('0x0'),_0x6d90('0x1')];function createListener(_0xa9235a,_0x149952){return function(_0x2653e){_0x149952['emit'](_0xa9235a,_0x2653e);};}function removeListener(_0x2ae140,_0x431c1e){return function(){TeamEvents[_0x6d90('0x2')](_0x2ae140,_0x431c1e);};}exports[_0x6d90('0x3')]=function(_0x4fa119){for(var _0x8ee191=0x0,_0x19eb61=events[_0x6d90('0x4')];_0x8ee191<_0x19eb61;_0x8ee191++){var _0x160c7d=events[_0x8ee191];var _0x219737=createListener('team:'+_0x160c7d,_0x4fa119);TeamEvents['on'](_0x160c7d,_0x219737);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d151f77..36a3d90 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 _0x390a=['../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','post','isAuthenticated','create','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x2fa98f,_0x31f6f8){var _0x622944=function(_0x303ca9){while(--_0x303ca9){_0x2fa98f['push'](_0x2fa98f['shift']());}};_0x622944(++_0x31f6f8);}(_0x390a,0x9d));var _0xa390=function(_0x136757,_0x1508ae){_0x136757=_0x136757-0x0;var _0x2cccfe=_0x390a[_0x136757];return _0x2cccfe;};'use strict';var multer=require(_0xa390('0x0'));var util=require('util');var path=require(_0xa390('0x1'));var timeout=require(_0xa390('0x2'));var express=require(_0xa390('0x3'));var router=express['Router']();var auth=require(_0xa390('0x4'));var interaction=require(_0xa390('0x5'));var config=require(_0xa390('0x6'));var controller=require(_0xa390('0x7'));router[_0xa390('0x8')]('/',auth['isAuthenticated'](),controller[_0xa390('0x9')]);router[_0xa390('0x8')](_0xa390('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa390('0xb')]('/',auth[_0xa390('0xc')](),controller[_0xa390('0xd')]);router[_0xa390('0xe')](_0xa390('0xa'),auth[_0xa390('0xc')](),controller[_0xa390('0xf')]);router['delete'](_0xa390('0xa'),auth[_0xa390('0xc')](),controller[_0xa390('0x10')]);module[_0xa390('0x11')]=router; \ No newline at end of file +var _0x99d7=['delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','index','/:id','show','post','create','put','isAuthenticated','update'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x99d7,0x66));var _0x799d=function(_0x266ecd,_0x4e0946){_0x266ecd=_0x266ecd-0x0;var _0x18e847=_0x99d7[_0x266ecd];return _0x18e847;};'use strict';var multer=require(_0x799d('0x0'));var util=require(_0x799d('0x1'));var path=require(_0x799d('0x2'));var timeout=require(_0x799d('0x3'));var express=require('express');var router=express[_0x799d('0x4')]();var auth=require(_0x799d('0x5'));var interaction=require(_0x799d('0x6'));var config=require(_0x799d('0x7'));var controller=require(_0x799d('0x8'));router[_0x799d('0x9')]('/',auth['isAuthenticated'](),controller[_0x799d('0xa')]);router[_0x799d('0x9')](_0x799d('0xb'),auth['isAuthenticated'](),controller[_0x799d('0xc')]);router[_0x799d('0xd')]('/',auth['isAuthenticated'](),controller[_0x799d('0xe')]);router[_0x799d('0xf')]('/:id',auth[_0x799d('0x10')](),controller[_0x799d('0x11')]);router[_0x799d('0x12')](_0x799d('0xb'),auth[_0x799d('0x10')](),controller['destroy']);module[_0x799d('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 834d8d1..d4296d0 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 _0x81da=['sequelize','exports','STRING'];(function(_0xca1d11,_0x1aff5d){var _0x5f2ecf=function(_0x1f328f){while(--_0x1f328f){_0xca1d11['push'](_0xca1d11['shift']());}};_0x5f2ecf(++_0x1aff5d);}(_0x81da,0x177));var _0xa81d=function(_0x566627,_0x593308){_0x566627=_0x566627-0x0;var _0xd2d4d6=_0x81da[_0x566627];return _0xd2d4d6;};'use strict';var Sequelize=require(_0xa81d('0x0'));module[_0xa81d('0x1')]={'name':{'type':Sequelize[_0xa81d('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x0727=['STRING','TEXT','exports'];(function(_0x2ab8ff,_0x567b74){var _0x152700=function(_0x11080a){while(--_0x11080a){_0x2ab8ff['push'](_0x2ab8ff['shift']());}};_0x152700(++_0x567b74);}(_0x0727,0x110));var _0x7072=function(_0x3e85a4,_0x18c3a9){_0x3e85a4=_0x3e85a4-0x0;var _0x21e7d1=_0x0727[_0x3e85a4];return _0x21e7d1;};'use strict';var Sequelize=require('sequelize');module[_0x7072('0x0')]={'name':{'type':Sequelize[_0x7072('0x1')]},'description':{'type':Sequelize[_0x7072('0x1')]},'html':{'type':Sequelize[_0x7072('0x2')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c51bad6..cf8bb4b 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 _0x7217=['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','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','name','send','index','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','Template','count','includeAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs'];(function(_0x2e7cb9,_0x149abf){var _0x345df4=function(_0x13ee4a){while(--_0x13ee4a){_0x2e7cb9['push'](_0x2e7cb9['shift']());}};_0x345df4(++_0x149abf);}(_0x7217,0x19e));var _0x7721=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x7217[_0x21aec3];return _0x288bbc;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');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('0x9'));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=_0x4b183e['count'],_0x25a628=_0x4e199a[_0x7721('0x1f')],_0x3cc909=_0x4e199a['offset']+_0x4e199a[_0x7721('0x20')],_0x32550d;if(_0x3cc909>=_0x5ed54){_0x3cc909=_0x5ed54;_0x32550d=0xc8;}else{_0x32550d=0xce;}_0x534f1b['status'](_0x32550d);return _0x534f1b[_0x7721('0x21')](_0x7721('0x22'),_0x25a628+'-'+_0x3cc909+'/'+_0x5ed54)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0x3e140d){return function(_0x2286e5){try{jsonpatch[_0x7721('0x23')](_0x2286e5,_0x3e140d,!![]);}catch(_0x402820){return BPromise[_0x7721('0x24')](_0x402820);}return _0x2286e5[_0x7721('0x25')]();};}function saveUpdates(_0xaeccc4,_0x4ce1db){return function(_0x288f7e){if(_0x288f7e){return _0x288f7e[_0x7721('0x26')](_0xaeccc4)[_0x7721('0x27')](function(_0xd8ad3c){return _0xd8ad3c;});}return null;};}function removeEntity(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')]()[_0x7721('0x27')](function(){var _0x3e8a4e=_0x512f31[_0x7721('0x29')]({'plain':!![]});var _0x121cc4=_0x7721('0x2a');return db[_0x7721('0x2b')]['destroy']({'where':{'type':_0x121cc4,'resourceId':_0x3e8a4e['id']}})[_0x7721('0x27')](function(){return _0x512f31;});})[_0x7721('0x27')](function(){_0x57140c[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x40d550,_0x16355a){return function(_0x424e05){if(!_0x424e05){_0x40d550[_0x7721('0x2c')](0x194);}return _0x424e05;};}function handleError(_0x40f367,_0x52316e){_0x52316e=_0x52316e||0x1f4;return function(_0x258ddf){logger['error'](_0x258ddf['stack']);if(_0x258ddf[_0x7721('0x2d')]){delete _0x258ddf[_0x7721('0x2d')];}_0x40f367[_0x7721('0x1c')](_0x52316e)[_0x7721('0x2e')](_0x258ddf);};}exports[_0x7721('0x2f')]=function(_0x37b9f0,_0xd7d703){var _0x1da2d8={},_0x5c54f0={},_0x471651={'count':0x0,'rows':[]};var _0x2871c5=_['map'](db['Template'][_0x7721('0x30')],function(_0x220bbf){return{'name':_0x220bbf['fieldName'],'type':_0x220bbf[_0x7721('0x31')][_0x7721('0x32')]};});_0x5c54f0[_0x7721('0x33')]=_['map'](_0x2871c5,_0x7721('0x2d'));_0x5c54f0[_0x7721('0x34')]=_[_0x7721('0x35')](_0x37b9f0[_0x7721('0x34')]);_0x5c54f0[_0x7721('0x36')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],_0x5c54f0[_0x7721('0x34')]);_0x1da2d8[_0x7721('0x37')]=_['intersection'](_0x5c54f0[_0x7721('0x33')],qs[_0x7721('0x38')](_0x37b9f0['query'][_0x7721('0x38')]));_0x1da2d8['attributes']=_0x1da2d8[_0x7721('0x37')][_0x7721('0x39')]?_0x1da2d8[_0x7721('0x37')]:_0x5c54f0[_0x7721('0x33')];if(!_0x37b9f0[_0x7721('0x34')][_0x7721('0x3a')](_0x7721('0x3b'))){_0x1da2d8[_0x7721('0x20')]=qs[_0x7721('0x20')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x20')]);_0x1da2d8['offset']=qs[_0x7721('0x1f')](_0x37b9f0['query'][_0x7721('0x1f')]);}_0x1da2d8[_0x7721('0x3c')]=qs[_0x7721('0x3d')](_0x37b9f0[_0x7721('0x34')][_0x7721('0x3d')]);_0x1da2d8[_0x7721('0x3e')]=qs['filters'](_['pick'](_0x37b9f0['query'],_0x5c54f0['filters']),_0x2871c5);if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x3f')]){_0x1da2d8[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x1da2d8['where'],{'$or':_[_0x7721('0x41')](_0x2871c5,function(_0x4cf659){if(_0x4cf659[_0x7721('0x31')]!==_0x7721('0x42')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x2d')]]={'$like':'%'+_0x37b9f0[_0x7721('0x34')]['filter']+'%'};return _0x5a278e;}})});}_0x1da2d8=_['merge']({},_0x1da2d8,_0x37b9f0[_0x7721('0x43')]);var _0xfc4dc4={'where':_0x1da2d8[_0x7721('0x3e')]};return db[_0x7721('0x44')]['count'](_0xfc4dc4)[_0x7721('0x27')](function(_0x120de9){_0x471651[_0x7721('0x45')]=_0x120de9;if(_0x37b9f0[_0x7721('0x34')][_0x7721('0x46')]){_0x1da2d8['include']=[{'all':!![]}];}return db[_0x7721('0x44')]['findAll'](_0x1da2d8);})[_0x7721('0x27')](function(_0x4a5b59){_0x471651[_0x7721('0x47')]=_0x4a5b59;return _0x471651;})[_0x7721('0x27')](respondWithFilteredResult(_0xd7d703,_0x1da2d8))[_0x7721('0x48')](handleError(_0xd7d703,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':!![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x35')](db[_0x7721('0x44')][_0x7721('0x30')]);_0x481fa8[_0x7721('0x34')]=_[_0x7721('0x35')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x34')]);_0x1ad315[_0x7721('0x37')]=_[_0x7721('0x4a')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x38')](_0x1453d4[_0x7721('0x34')][_0x7721('0x38')]));_0x1ad315[_0x7721('0x37')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x37')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x34')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x40')]({},_0x1ad315,_0x1453d4[_0x7721('0x43')]);return db['Template'][_0x7721('0x4b')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x27')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4c')]=function(_0x196be4,_0xf17c40){return db['Template'][_0x7721('0x4c')](_0x196be4[_0x7721('0x4d')],{})['then'](function(_0x223d93){var _0x1196c2=_0x196be4[_0x7721('0x4e')]['get']({'plain':!![]});if(!_0x1196c2)throw new Error(_0x7721('0x4f'));if(_0x1196c2['role']===_0x7721('0x4e')){var _0x310549=_0x223d93[_0x7721('0x29')]({'plain':!![]});var _0x443503=_0x7721('0x2a');return db[_0x7721('0x50')][_0x7721('0x4b')]({'where':{'name':_0x443503,'userProfileId':_0x1196c2[_0x7721('0x51')]},'raw':!![]})[_0x7721('0x27')](function(_0x3386aa){if(_0x3386aa&&_0x3386aa[_0x7721('0x52')]===0x0){return db[_0x7721('0x2b')][_0x7721('0x4c')]({'name':_0x310549[_0x7721('0x2d')],'resourceId':_0x310549['id'],'type':_0x3386aa[_0x7721('0x2d')],'sectionId':_0x3386aa['id']},{})['then'](function(){return _0x223d93;});}else{return _0x223d93;}})[_0x7721('0x48')](function(_0x2f6f30){logger[_0x7721('0x53')](_0x7721('0x54'),_0x2f6f30);throw _0x2f6f30;});}return _0x223d93;})[_0x7721('0x27')](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x26')]=function(_0x57484c,_0x234bee){if(_0x57484c[_0x7721('0x4d')]['id']){delete _0x57484c[_0x7721('0x4d')]['id'];}return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x57484c[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0x234bee,null))[_0x7721('0x27')](saveUpdates(_0x57484c[_0x7721('0x4d')],null))[_0x7721('0x27')](respondWithResult(_0x234bee,null))[_0x7721('0x48')](handleError(_0x234bee,null));};exports['destroy']=function(_0x421c27,_0xadb365){return db[_0x7721('0x44')][_0x7721('0x4b')]({'where':{'id':_0x421c27[_0x7721('0x49')]['id']}})[_0x7721('0x27')](handleEntityNotFound(_0xadb365,null))[_0x7721('0x27')](removeEntity(_0xadb365,null))[_0x7721('0x48')](handleError(_0xadb365,null));}; \ No newline at end of file +var _0x326f=['UserProfileResource','error','stack','name','index','map','Template','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','then','destroy','get','Templates'];(function(_0x56be99,_0x1de49d){var _0x5aa11a=function(_0x4bcd71){while(--_0x4bcd71){_0x56be99['push'](_0x56be99['shift']());}};_0x5aa11a(++_0x1de49d);}(_0x326f,0xd1));var _0xf326=function(_0x20aa8c,_0x2d9d3a){_0x20aa8c=_0x20aa8c-0x0;var _0x55a0ff=_0x326f[_0x20aa8c];return _0x55a0ff;};'use strict';var pdf=require(_0xf326('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf326('0x1'));var jsonpatch=require(_0xf326('0x2'));var rp=require(_0xf326('0x3'));var moment=require(_0xf326('0x4'));var BPromise=require(_0xf326('0x5'));var Mustache=require(_0xf326('0x6'));var util=require(_0xf326('0x7'));var path=require(_0xf326('0x8'));var sox=require(_0xf326('0x9'));var csv=require(_0xf326('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=_0x1f2e5a[_0xf326('0x1a')],_0x292f4b=_0x11f6d2['offset'],_0x287a2a=_0x11f6d2[_0xf326('0x1b')]+_0x11f6d2[_0xf326('0x1c')],_0x34128e;if(_0x287a2a>=_0xa63d1a){_0x287a2a=_0xa63d1a;_0x34128e=0xc8;}else{_0x34128e=0xce;}_0xdf21d9[_0xf326('0x18')](_0x34128e);return _0xdf21d9[_0xf326('0x1d')](_0xf326('0x1e'),_0x292f4b+'-'+_0x287a2a+'/'+_0xa63d1a)[_0xf326('0x1f')](_0x1f2e5a);}return null;};}function patchUpdates(_0x4d3d41){return function(_0x4a5b6c){try{jsonpatch['apply'](_0x4a5b6c,_0x4d3d41,!![]);}catch(_0x16e605){return BPromise[_0xf326('0x20')](_0x16e605);}return _0x4a5b6c['save']();};}function saveUpdates(_0x4cabce,_0x128c68){return function(_0x4dfa76){if(_0x4dfa76){return _0x4dfa76['update'](_0x4cabce)[_0xf326('0x21')](function(_0x18ead3){return _0x18ead3;});}return null;};}function removeEntity(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')]()['then'](function(){var _0x337ed5=_0x19b8ba[_0xf326('0x23')]({'plain':!![]});var _0x43c53e=_0xf326('0x24');return db[_0xf326('0x25')][_0xf326('0x22')]({'where':{'type':_0x43c53e,'resourceId':_0x337ed5['id']}})['then'](function(){return _0x19b8ba;});})['then'](function(){_0x549b46['status'](0xcc)[_0xf326('0x19')]();});}};}function handleEntityNotFound(_0x1a2c4e,_0x2cd45a){return function(_0x1ff2b5){if(!_0x1ff2b5){_0x1a2c4e[_0xf326('0x17')](0x194);}return _0x1ff2b5;};}function handleError(_0x410237,_0x5217d4){_0x5217d4=_0x5217d4||0x1f4;return function(_0x201d28){logger[_0xf326('0x26')](_0x201d28[_0xf326('0x27')]);if(_0x201d28['name']){delete _0x201d28[_0xf326('0x28')];}_0x410237['status'](_0x5217d4)['send'](_0x201d28);};}exports[_0xf326('0x29')]=function(_0x1ae23a,_0x2fa28e){var _0x5dbe63={},_0xc115d9={},_0x292500={'count':0x0,'rows':[]};var _0x55790d=_[_0xf326('0x2a')](db[_0xf326('0x2b')][_0xf326('0x2c')],function(_0x18d110){return{'name':_0x18d110[_0xf326('0x2d')],'type':_0x18d110[_0xf326('0x2e')][_0xf326('0x2f')]};});_0xc115d9[_0xf326('0x30')]=_[_0xf326('0x2a')](_0x55790d,_0xf326('0x28'));_0xc115d9['query']=_[_0xf326('0x31')](_0x1ae23a[_0xf326('0x32')]);_0xc115d9[_0xf326('0x33')]=_['intersection'](_0xc115d9[_0xf326('0x30')],_0xc115d9[_0xf326('0x32')]);_0x5dbe63[_0xf326('0x34')]=_['intersection'](_0xc115d9['model'],qs[_0xf326('0x35')](_0x1ae23a[_0xf326('0x32')][_0xf326('0x35')]));_0x5dbe63[_0xf326('0x34')]=_0x5dbe63[_0xf326('0x34')][_0xf326('0x36')]?_0x5dbe63[_0xf326('0x34')]:_0xc115d9[_0xf326('0x30')];if(!_0x1ae23a['query'][_0xf326('0x37')](_0xf326('0x38'))){_0x5dbe63['limit']=qs[_0xf326('0x1c')](_0x1ae23a['query'][_0xf326('0x1c')]);_0x5dbe63['offset']=qs['offset'](_0x1ae23a[_0xf326('0x32')]['offset']);}_0x5dbe63[_0xf326('0x39')]=qs['sort'](_0x1ae23a[_0xf326('0x32')][_0xf326('0x3a')]);_0x5dbe63[_0xf326('0x3b')]=qs['filters'](_[_0xf326('0x3c')](_0x1ae23a[_0xf326('0x32')],_0xc115d9['filters']),_0x55790d);if(_0x1ae23a[_0xf326('0x32')][_0xf326('0x3d')]){_0x5dbe63[_0xf326('0x3b')]=_[_0xf326('0x3e')](_0x5dbe63['where'],{'$or':_[_0xf326('0x2a')](_0x55790d,function(_0xb1ef35){if(_0xb1ef35[_0xf326('0x2e')]!==_0xf326('0x3f')){var _0x1d88ed={};_0x1d88ed[_0xb1ef35['name']]={'$like':'%'+_0x1ae23a[_0xf326('0x32')][_0xf326('0x3d')]+'%'};return _0x1d88ed;}})});}_0x5dbe63=_['merge']({},_0x5dbe63,_0x1ae23a['options']);var _0x40564e={'where':_0x5dbe63['where']};return db['Template'][_0xf326('0x1a')](_0x40564e)['then'](function(_0x3e1e8c){_0x292500[_0xf326('0x1a')]=_0x3e1e8c;if(_0x1ae23a[_0xf326('0x32')][_0xf326('0x40')]){_0x5dbe63['include']=[{'all':!![]}];}return db[_0xf326('0x2b')][_0xf326('0x41')](_0x5dbe63);})[_0xf326('0x21')](function(_0x365627){_0x292500[_0xf326('0x42')]=_0x365627;return _0x292500;})[_0xf326('0x21')](respondWithFilteredResult(_0x2fa28e,_0x5dbe63))[_0xf326('0x43')](handleError(_0x2fa28e,null));};exports[_0xf326('0x44')]=function(_0x31283b,_0x1227d3){var _0x361776={'raw':!![],'where':{'id':_0x31283b['params']['id']}},_0x2bab13={};_0x2bab13[_0xf326('0x30')]=_[_0xf326('0x31')](db[_0xf326('0x2b')][_0xf326('0x2c')]);_0x2bab13[_0xf326('0x32')]=_[_0xf326('0x31')](_0x31283b['query']);_0x2bab13[_0xf326('0x33')]=_[_0xf326('0x45')](_0x2bab13['model'],_0x2bab13[_0xf326('0x32')]);_0x361776[_0xf326('0x34')]=_[_0xf326('0x45')](_0x2bab13[_0xf326('0x30')],qs[_0xf326('0x35')](_0x31283b['query']['fields']));_0x361776[_0xf326('0x34')]=_0x361776[_0xf326('0x34')]['length']?_0x361776['attributes']:_0x2bab13[_0xf326('0x30')];if(_0x31283b[_0xf326('0x32')][_0xf326('0x40')]){_0x361776['include']=[{'all':!![]}];}_0x361776=_[_0xf326('0x3e')]({},_0x361776,_0x31283b[_0xf326('0x46')]);return db[_0xf326('0x2b')][_0xf326('0x47')](_0x361776)[_0xf326('0x21')](handleEntityNotFound(_0x1227d3,null))[_0xf326('0x21')](respondWithResult(_0x1227d3,null))[_0xf326('0x43')](handleError(_0x1227d3,null));};exports[_0xf326('0x48')]=function(_0x3df9a8,_0x27ced1){return db[_0xf326('0x2b')][_0xf326('0x48')](_0x3df9a8[_0xf326('0x49')],{})[_0xf326('0x21')](function(_0xeac1a1){var _0x59f9a7=_0x3df9a8[_0xf326('0x4a')][_0xf326('0x23')]({'plain':!![]});if(!_0x59f9a7)throw new Error(_0xf326('0x4b'));if(_0x59f9a7[_0xf326('0x4c')]==='user'){var _0x10f437=_0xeac1a1[_0xf326('0x23')]({'plain':!![]});var _0xca88e=_0xf326('0x24');return db['UserProfileSection'][_0xf326('0x47')]({'where':{'name':_0xca88e,'userProfileId':_0x59f9a7[_0xf326('0x4d')]},'raw':!![]})[_0xf326('0x21')](function(_0x451ac7){if(_0x451ac7&&_0x451ac7[_0xf326('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x10f437[_0xf326('0x28')],'resourceId':_0x10f437['id'],'type':_0x451ac7[_0xf326('0x28')],'sectionId':_0x451ac7['id']},{})[_0xf326('0x21')](function(){return _0xeac1a1;});}else{return _0xeac1a1;}})['catch'](function(_0x102fba){logger[_0xf326('0x26')](_0xf326('0x4f'),_0x102fba);throw _0x102fba;});}return _0xeac1a1;})['then'](respondWithResult(_0x27ced1,0xc9))['catch'](handleError(_0x27ced1,null));};exports[_0xf326('0x50')]=function(_0x5b4832,_0x1cf58f){if(_0x5b4832['body']['id']){delete _0x5b4832[_0xf326('0x49')]['id'];}return db[_0xf326('0x2b')][_0xf326('0x47')]({'where':{'id':_0x5b4832[_0xf326('0x51')]['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x1cf58f,null))[_0xf326('0x21')](saveUpdates(_0x5b4832[_0xf326('0x49')],null))['then'](respondWithResult(_0x1cf58f,null))[_0xf326('0x43')](handleError(_0x1cf58f,null));};exports[_0xf326('0x22')]=function(_0x424d24,_0x4b0d8e){return db[_0xf326('0x2b')][_0xf326('0x47')]({'where':{'id':_0x424d24[_0xf326('0x51')]['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x4b0d8e,null))[_0xf326('0x21')](removeEntity(_0x4b0d8e,null))['catch'](handleError(_0x4b0d8e,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index b8e19bf..7b67556 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 _0x5616=['request-promise','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','api','moment','bluebird'];(function(_0x169eb1,_0x5691b3){var _0x4f10f6=function(_0x3c9a68){while(--_0x3c9a68){_0x169eb1['push'](_0x169eb1['shift']());}};_0x4f10f6(++_0x5691b3);}(_0x5616,0xe5));var _0x6561=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0x5616[_0x20fb02];return _0x24a33e;};'use strict';var _=require(_0x6561('0x0'));var util=require(_0x6561('0x1'));var logger=require('../../config/logger')(_0x6561('0x2'));var moment=require(_0x6561('0x3'));var BPromise=require(_0x6561('0x4'));var rp=require(_0x6561('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6561('0x6'));var config=require(_0x6561('0x7'));var attributes=require(_0x6561('0x8'));module[_0x6561('0x9')]=function(_0x584fe0,_0x37b7c0){return _0x584fe0[_0x6561('0xa')](_0x6561('0xb'),attributes,{'tableName':_0x6561('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b69=['exports','define','tools_templates','../../config/logger','api','path','../../config/environment','./template.attributes'];(function(_0x400f84,_0x2b53a7){var _0x57e186=function(_0x1ba7d1){while(--_0x1ba7d1){_0x400f84['push'](_0x400f84['shift']());}};_0x57e186(++_0x2b53a7);}(_0x3b69,0x13b));var _0x93b6=function(_0x449fcc,_0x5bf72d){_0x449fcc=_0x449fcc-0x0;var _0x1cb603=_0x3b69[_0x449fcc];return _0x1cb603;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x93b6('0x0'))(_0x93b6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x93b6('0x2'));var rimraf=require('rimraf');var config=require(_0x93b6('0x3'));var attributes=require(_0x93b6('0x4'));module[_0x93b6('0x5')]=function(_0x29b094,_0x365c45){return _0x29b094[_0x93b6('0x6')]('Template',attributes,{'tableName':_0x93b6('0x7'),'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 36d0ef4..dabf452 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 _0x96da=['include','then','GetTemplate','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Template,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','Template','findAll','options','attributes','limit','map','model'];(function(_0x55bd01,_0x3c3085){var _0x523eb7=function(_0x1d521d){while(--_0x1d521d){_0x55bd01['push'](_0x55bd01['shift']());}};_0x523eb7(++_0x3c3085);}(_0x96da,0x84));var _0xa96d=function(_0x3c964d,_0x276602){_0x3c964d=_0x3c964d-0x0;var _0x4d9603=_0x96da[_0x3c964d];return _0x4d9603;};'use strict';var _=require(_0xa96d('0x0'));var util=require(_0xa96d('0x1'));var moment=require(_0xa96d('0x2'));var BPromise=require(_0xa96d('0x3'));var rs=require(_0xa96d('0x4'));var fs=require('fs');var Redis=require(_0xa96d('0x5'));var db=require(_0xa96d('0x6'))['db'];var utils=require(_0xa96d('0x7'));var logger=require('../../config/logger')(_0xa96d('0x8'));var config=require(_0xa96d('0x9'));var jayson=require(_0xa96d('0xa'));var client=jayson[_0xa96d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35aef6,_0x2116ae,_0x12fa50){return new BPromise(function(_0xb19dcc,_0x4ce369){return client[_0xa96d('0xc')](_0x35aef6,_0x12fa50)['then'](function(_0x482016){logger[_0xa96d('0xd')](_0xa96d('0xe'),_0x2116ae,'request\x20sent');logger['debug']('Template,\x20%s,\x20%s,\x20%s',_0x2116ae,'request\x20sent',JSON[_0xa96d('0xf')](_0x482016));if(_0x482016['error']){if(_0x482016[_0xa96d('0x10')]['code']===0x1f4){logger[_0xa96d('0x10')](_0xa96d('0xe'),_0x2116ae,_0x482016['error'][_0xa96d('0x11')]);return _0x4ce369(_0x482016[_0xa96d('0x10')][_0xa96d('0x11')]);}logger['error'](_0xa96d('0xe'),_0x2116ae,_0x482016[_0xa96d('0x10')]['message']);return _0xb19dcc(_0x482016['error'][_0xa96d('0x11')]);}else{logger[_0xa96d('0xd')](_0xa96d('0xe'),_0x2116ae,_0xa96d('0x12'));_0xb19dcc(_0x482016[_0xa96d('0x13')][_0xa96d('0x11')]);}})[_0xa96d('0x14')](function(_0x182d0a){logger[_0xa96d('0x10')](_0xa96d('0xe'),_0x2116ae,_0x182d0a);_0x4ce369(_0x182d0a);});});}exports['GetTemplate']=function(_0x5cb994){var _0x549dd1=this;return new Promise(function(_0x458773,_0x54042d){return db[_0xa96d('0x15')][_0xa96d('0x16')]({'raw':_0x5cb994[_0xa96d('0x17')]?_0x5cb994[_0xa96d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5cb994[_0xa96d('0x17')]?_0x5cb994[_0xa96d('0x17')]['where']||null:null,'attributes':_0x5cb994[_0xa96d('0x17')]?_0x5cb994[_0xa96d('0x17')][_0xa96d('0x18')]||null:null,'limit':_0x5cb994['options']?_0x5cb994[_0xa96d('0x17')][_0xa96d('0x19')]||null:null,'include':_0x5cb994['options']?_0x5cb994['options']['include']?_[_0xa96d('0x1a')](_0x5cb994[_0xa96d('0x17')]['include'],function(_0x567d0f){return{'model':db[_0x567d0f[_0xa96d('0x1b')]],'as':_0x567d0f['as'],'attributes':_0x567d0f['attributes'],'include':_0x567d0f[_0xa96d('0x1c')]?_[_0xa96d('0x1a')](_0x567d0f[_0xa96d('0x1c')],function(_0x3ada8d){return{'model':db[_0x3ada8d[_0xa96d('0x1b')]],'as':_0x3ada8d['as'],'attributes':_0x3ada8d[_0xa96d('0x18')],'include':_0x3ada8d[_0xa96d('0x1c')]?_['map'](_0x3ada8d['include'],function(_0x508032){return{'model':db[_0x508032[_0xa96d('0x1b')]],'as':_0x508032['as'],'attributes':_0x508032['attributes']};}):[]};}):[]};}):[]:[]})[_0xa96d('0x1d')](function(_0x152bf3){logger['info'](_0xa96d('0x1e'),_0x5cb994);logger[_0xa96d('0x1f')](_0xa96d('0x1e'),_0x5cb994,JSON[_0xa96d('0xf')](_0x152bf3));_0x458773(_0x152bf3);})[_0xa96d('0x14')](function(_0x4947fa){logger[_0xa96d('0x10')](_0xa96d('0x1e'),_0x4947fa[_0xa96d('0x11')],_0x5cb994);_0x54042d(_0x549dd1['error'](0x1f4,_0x4947fa[_0xa96d('0x11')]));});});}; \ No newline at end of file +var _0x7414=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Template,\x20%s,\x20%s','request\x20sent','GetTemplate','findAll','options','raw','where','attributes','include','map','model','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7414,0xbf));var _0x4741=function(_0xfc4790,_0x36e180){_0xfc4790=_0xfc4790-0x0;var _0x341f1a=_0x7414[_0xfc4790];return _0x341f1a;};'use strict';var _=require(_0x4741('0x0'));var util=require(_0x4741('0x1'));var moment=require(_0x4741('0x2'));var BPromise=require(_0x4741('0x3'));var rs=require(_0x4741('0x4'));var fs=require('fs');var Redis=require(_0x4741('0x5'));var db=require(_0x4741('0x6'))['db'];var utils=require(_0x4741('0x7'));var logger=require(_0x4741('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4741('0x9'));var client=jayson[_0x4741('0xa')][_0x4741('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a9581,_0x14fbd8,_0x27cf8f){return new BPromise(function(_0x16766,_0x1c056a){return client[_0x4741('0xc')](_0x5a9581,_0x27cf8f)[_0x4741('0xd')](function(_0x43d46f){logger[_0x4741('0xe')]('Template,\x20%s,\x20%s',_0x14fbd8,'request\x20sent');logger[_0x4741('0xf')](_0x4741('0x10'),_0x14fbd8,'request\x20sent',JSON[_0x4741('0x11')](_0x43d46f));if(_0x43d46f['error']){if(_0x43d46f[_0x4741('0x12')][_0x4741('0x13')]===0x1f4){logger[_0x4741('0x12')]('Template,\x20%s,\x20%s',_0x14fbd8,_0x43d46f['error'][_0x4741('0x14')]);return _0x1c056a(_0x43d46f[_0x4741('0x12')]['message']);}logger[_0x4741('0x12')](_0x4741('0x15'),_0x14fbd8,_0x43d46f[_0x4741('0x12')][_0x4741('0x14')]);return _0x16766(_0x43d46f['error']['message']);}else{logger[_0x4741('0xe')](_0x4741('0x15'),_0x14fbd8,_0x4741('0x16'));_0x16766(_0x43d46f['result']['message']);}})['catch'](function(_0x1a9882){logger[_0x4741('0x12')](_0x4741('0x15'),_0x14fbd8,_0x1a9882);_0x1c056a(_0x1a9882);});});}exports[_0x4741('0x17')]=function(_0x3efbca){var _0x263d4f=this;return new Promise(function(_0x173fd3,_0x546dad){return db['Template'][_0x4741('0x18')]({'raw':_0x3efbca[_0x4741('0x19')]?_0x3efbca['options'][_0x4741('0x1a')]===undefined?!![]:![]:!![],'where':_0x3efbca[_0x4741('0x19')]?_0x3efbca[_0x4741('0x19')][_0x4741('0x1b')]||null:null,'attributes':_0x3efbca['options']?_0x3efbca['options'][_0x4741('0x1c')]||null:null,'limit':_0x3efbca['options']?_0x3efbca['options']['limit']||null:null,'include':_0x3efbca[_0x4741('0x19')]?_0x3efbca[_0x4741('0x19')][_0x4741('0x1d')]?_[_0x4741('0x1e')](_0x3efbca[_0x4741('0x19')][_0x4741('0x1d')],function(_0x3dfcac){return{'model':db[_0x3dfcac[_0x4741('0x1f')]],'as':_0x3dfcac['as'],'attributes':_0x3dfcac[_0x4741('0x1c')],'include':_0x3dfcac['include']?_[_0x4741('0x1e')](_0x3dfcac['include'],function(_0x18c719){return{'model':db[_0x18c719[_0x4741('0x1f')]],'as':_0x18c719['as'],'attributes':_0x18c719[_0x4741('0x1c')],'include':_0x18c719['include']?_[_0x4741('0x1e')](_0x18c719[_0x4741('0x1d')],function(_0x137059){return{'model':db[_0x137059[_0x4741('0x1f')]],'as':_0x137059['as'],'attributes':_0x137059[_0x4741('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4741('0xd')](function(_0x2674e5){logger[_0x4741('0xe')](_0x4741('0x17'),_0x3efbca);logger[_0x4741('0xf')](_0x4741('0x17'),_0x3efbca,JSON[_0x4741('0x11')](_0x2674e5));_0x173fd3(_0x2674e5);})['catch'](function(_0x461a44){logger['error'](_0x4741('0x17'),_0x461a44[_0x4741('0x14')],_0x3efbca);_0x546dad(_0x263d4f[_0x4741('0x12')](0x1f4,_0x461a44[_0x4741('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index ae02065..92eebba 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 _0xe037=['getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/all_conditions'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xe037,0x146));var _0x7e03=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xe037[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x7e03('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7e03('0x1'));var router=express[_0x7e03('0x2')]();var auth=require(_0x7e03('0x3'));var interaction=require(_0x7e03('0x4'));var config=require(_0x7e03('0x5'));var controller=require('./trigger.controller');router[_0x7e03('0x6')]('/',auth[_0x7e03('0x7')](),controller['index']);router[_0x7e03('0x6')](_0x7e03('0x8'),auth[_0x7e03('0x7')](),controller['show']);router[_0x7e03('0x6')](_0x7e03('0x9'),auth[_0x7e03('0x7')](),controller[_0x7e03('0xa')]);router[_0x7e03('0x6')](_0x7e03('0xb'),auth[_0x7e03('0x7')](),controller[_0x7e03('0xc')]);router[_0x7e03('0x6')](_0x7e03('0xd'),auth[_0x7e03('0x7')](),controller[_0x7e03('0xe')]);router[_0x7e03('0xf')]('/',auth[_0x7e03('0x7')](),controller[_0x7e03('0x10')]);router['post'](_0x7e03('0x9'),auth[_0x7e03('0x7')](),controller[_0x7e03('0x11')]);router['post'](_0x7e03('0xb'),auth[_0x7e03('0x7')](),controller[_0x7e03('0x12')]);router[_0x7e03('0xf')]('/:id/actions',auth['isAuthenticated'](),controller['addAction']);router[_0x7e03('0x13')](_0x7e03('0x8'),auth['isAuthenticated'](),controller[_0x7e03('0x14')]);router[_0x7e03('0x15')](_0x7e03('0x8'),auth[_0x7e03('0x7')](),controller[_0x7e03('0x16')]);module[_0x7e03('0x17')]=router; \ No newline at end of file +var _0xbba3=['/:id/all_conditions','getAllConditions','getAnyConditions','getActions','addAllCondition','post','/:id/any_conditions','addAnyCondition','/:id/actions','addAction','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x2c54a2,_0x4cb47c){var _0x200a0c=function(_0x2802b5){while(--_0x2802b5){_0x2c54a2['push'](_0x2c54a2['shift']());}};_0x200a0c(++_0x4cb47c);}(_0xbba3,0x6c));var _0x3bba=function(_0x218e55,_0x93c188){_0x218e55=_0x218e55-0x0;var _0x2effe1=_0xbba3[_0x218e55];return _0x2effe1;};'use strict';var multer=require(_0x3bba('0x0'));var util=require(_0x3bba('0x1'));var path=require(_0x3bba('0x2'));var timeout=require('connect-timeout');var express=require(_0x3bba('0x3'));var router=express[_0x3bba('0x4')]();var auth=require(_0x3bba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3bba('0x6'));var controller=require('./trigger.controller');router['get']('/',auth[_0x3bba('0x7')](),controller[_0x3bba('0x8')]);router[_0x3bba('0x9')](_0x3bba('0xa'),auth['isAuthenticated'](),controller[_0x3bba('0xb')]);router[_0x3bba('0x9')](_0x3bba('0xc'),auth['isAuthenticated'](),controller[_0x3bba('0xd')]);router[_0x3bba('0x9')]('/:id/any_conditions',auth[_0x3bba('0x7')](),controller[_0x3bba('0xe')]);router[_0x3bba('0x9')]('/:id/actions',auth[_0x3bba('0x7')](),controller[_0x3bba('0xf')]);router['post']('/',auth[_0x3bba('0x7')](),controller['create']);router['post'](_0x3bba('0xc'),auth['isAuthenticated'](),controller[_0x3bba('0x10')]);router[_0x3bba('0x11')](_0x3bba('0x12'),auth[_0x3bba('0x7')](),controller[_0x3bba('0x13')]);router[_0x3bba('0x11')](_0x3bba('0x14'),auth[_0x3bba('0x7')](),controller[_0x3bba('0x15')]);router['put'](_0x3bba('0xa'),auth[_0x3bba('0x7')](),controller[_0x3bba('0x16')]);router['delete']('/:id',auth[_0x3bba('0x7')](),controller[_0x3bba('0x17')]);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 d43ec9d..56d5d71 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 _0xded4=['STRING','BOOLEAN','sequelize','exports'];(function(_0xa715f6,_0x1c2e3f){var _0x10f2d8=function(_0x39ca3d){while(--_0x39ca3d){_0xa715f6['push'](_0xa715f6['shift']());}};_0x10f2d8(++_0x1c2e3f);}(_0xded4,0x17e));var _0x4ded=function(_0xe1de40,_0xe182bb){_0xe1de40=_0xe1de40-0x0;var _0x3ba716=_0xded4[_0xe1de40];return _0x3ba716;};'use strict';var Sequelize=require(_0x4ded('0x0'));module[_0x4ded('0x1')]={'name':{'type':Sequelize[_0x4ded('0x2')]},'channel':{'type':Sequelize[_0x4ded('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x4ded('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa344=['exports','STRING','BOOLEAN','sequelize'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0xa344,0x1c7));var _0x4a34=function(_0x43a888,_0x551fc9){_0x43a888=_0x43a888-0x0;var _0x5de51e=_0xa344[_0x43a888];return _0x5de51e;};'use strict';var Sequelize=require(_0x4a34('0x0'));module[_0x4a34('0x1')]={'name':{'type':Sequelize[_0x4a34('0x2')]},'channel':{'type':Sequelize[_0x4a34('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x4a34('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 f19cf14..0eec1ca 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 _0x5455=['then','get','Triggers','UserProfileResource','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','Trigger','includeAll','include','rows','catch','params','keys','options','create','user','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','addAnyCondition','TriggerAnyId','Condition','getAllConditions','hasOwnProperty','getAnyConditions','findOne','addAction','TriggerId','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','reject','save','update'];(function(_0xbacbef,_0x4f0636){var _0x30e757=function(_0xf243c9){while(--_0xf243c9){_0xbacbef['push'](_0xbacbef['shift']());}};_0x30e757(++_0x4f0636);}(_0x5455,0x197));var _0x5545=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5455[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5545('0x0'));var rimraf=require(_0x5545('0x1'));var zipdir=require(_0x5545('0x2'));var jsonpatch=require(_0x5545('0x3'));var rp=require(_0x5545('0x4'));var moment=require(_0x5545('0x5'));var BPromise=require(_0x5545('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5545('0x7'));var sox=require(_0x5545('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5545('0x9'));var squel=require(_0x5545('0xa'));var crypto=require('crypto');var jsforce=require(_0x5545('0xb'));var deskjs=require(_0x5545('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5545('0xd'));var Papa=require(_0x5545('0xe'));var Redis=require(_0x5545('0xf'));var authService=require(_0x5545('0x10'));var qs=require(_0x5545('0x11'));var as=require(_0x5545('0x12'));var hardwareService=require(_0x5545('0x13'));var logger=require(_0x5545('0x14'))(_0x5545('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5545('0x16'));var db=require(_0x5545('0x17'))['db'];function respondWithStatusCode(_0x2a844e,_0x1af0c6){_0x1af0c6=_0x1af0c6||0xcc;return function(_0x530be6){if(_0x530be6){return _0x2a844e[_0x5545('0x18')](_0x1af0c6);}return _0x2a844e[_0x5545('0x19')](_0x1af0c6)['end']();};}function respondWithResult(_0x2736a7,_0x167f3d){_0x167f3d=_0x167f3d||0xc8;return function(_0x43f841){if(_0x43f841){return _0x2736a7[_0x5545('0x19')](_0x167f3d)['json'](_0x43f841);}};}function respondWithFilteredResult(_0x182ec5,_0x5ae7e8){return function(_0x30de43){if(_0x30de43){var _0x3fde96=_0x30de43[_0x5545('0x1a')],_0x3d95f5=_0x5ae7e8[_0x5545('0x1b')],_0x30eedc=_0x5ae7e8[_0x5545('0x1b')]+_0x5ae7e8[_0x5545('0x1c')],_0xf9256c;if(_0x30eedc>=_0x3fde96){_0x30eedc=_0x3fde96;_0xf9256c=0xc8;}else{_0xf9256c=0xce;}_0x182ec5[_0x5545('0x19')](_0xf9256c);return _0x182ec5['set'](_0x5545('0x1d'),_0x3d95f5+'-'+_0x30eedc+'/'+_0x3fde96)['json'](_0x30de43);}return null;};}function patchUpdates(_0x4d644e){return function(_0x589033){try{jsonpatch['apply'](_0x589033,_0x4d644e,!![]);}catch(_0x406fe8){return BPromise[_0x5545('0x1e')](_0x406fe8);}return _0x589033[_0x5545('0x1f')]();};}function saveUpdates(_0x58d53d,_0x3c0a2e){return function(_0x3d7ee6){if(_0x3d7ee6){return _0x3d7ee6[_0x5545('0x20')](_0x58d53d)[_0x5545('0x21')](function(_0x5dfcbc){return _0x5dfcbc;});}return null;};}function removeEntity(_0x31eb2d,_0x2c2d9e){return function(_0x50a90c){if(_0x50a90c){return _0x50a90c['destroy']()[_0x5545('0x21')](function(){var _0x4ab3ff=_0x50a90c[_0x5545('0x22')]({'plain':!![]});var _0x496a5d=_0x5545('0x23');return db[_0x5545('0x24')][_0x5545('0x25')]({'where':{'type':_0x496a5d,'resourceId':_0x4ab3ff['id']}})[_0x5545('0x21')](function(){return _0x50a90c;});})[_0x5545('0x21')](function(){_0x31eb2d[_0x5545('0x19')](0xcc)[_0x5545('0x26')]();});}};}function handleEntityNotFound(_0x55aef6,_0x4a9d7b){return function(_0x33d394){if(!_0x33d394){_0x55aef6[_0x5545('0x18')](0x194);}return _0x33d394;};}function handleError(_0x16f633,_0x4bf00e){_0x4bf00e=_0x4bf00e||0x1f4;return function(_0x1fefa3){logger['error'](_0x1fefa3[_0x5545('0x27')]);if(_0x1fefa3[_0x5545('0x28')]){delete _0x1fefa3[_0x5545('0x28')];}_0x16f633[_0x5545('0x19')](_0x4bf00e)['send'](_0x1fefa3);};}exports[_0x5545('0x29')]=function(_0x41a256,_0x46e78e){var _0x2436e4={},_0x4113d6={},_0x5dff3c={'count':0x0,'rows':[]};var _0x183656=_[_0x5545('0x2a')](db['Trigger'][_0x5545('0x2b')],function(_0x3f57d8){return{'name':_0x3f57d8[_0x5545('0x2c')],'type':_0x3f57d8[_0x5545('0x2d')][_0x5545('0x2e')]};});_0x4113d6[_0x5545('0x2f')]=_[_0x5545('0x2a')](_0x183656,_0x5545('0x28'));_0x4113d6[_0x5545('0x30')]=_['keys'](_0x41a256[_0x5545('0x30')]);_0x4113d6['filters']=_[_0x5545('0x31')](_0x4113d6[_0x5545('0x2f')],_0x4113d6[_0x5545('0x30')]);_0x2436e4[_0x5545('0x32')]=_[_0x5545('0x31')](_0x4113d6['model'],qs[_0x5545('0x33')](_0x41a256[_0x5545('0x30')]['fields']));_0x2436e4[_0x5545('0x32')]=_0x2436e4['attributes'][_0x5545('0x34')]?_0x2436e4[_0x5545('0x32')]:_0x4113d6['model'];if(!_0x41a256[_0x5545('0x30')]['hasOwnProperty'](_0x5545('0x35'))){_0x2436e4['limit']=qs['limit'](_0x41a256[_0x5545('0x30')][_0x5545('0x1c')]);_0x2436e4[_0x5545('0x1b')]=qs['offset'](_0x41a256[_0x5545('0x30')][_0x5545('0x1b')]);}_0x2436e4[_0x5545('0x36')]=qs['sort'](_0x41a256[_0x5545('0x30')][_0x5545('0x37')]);_0x2436e4[_0x5545('0x38')]=qs['filters'](_[_0x5545('0x39')](_0x41a256[_0x5545('0x30')],_0x4113d6[_0x5545('0x3a')]),_0x183656);if(_0x41a256[_0x5545('0x30')][_0x5545('0x3b')]){_0x2436e4[_0x5545('0x38')]=_[_0x5545('0x3c')](_0x2436e4[_0x5545('0x38')],{'$or':_[_0x5545('0x2a')](_0x183656,function(_0x101e91){if(_0x101e91[_0x5545('0x2d')]!==_0x5545('0x3d')){var _0x39769a={};_0x39769a[_0x101e91[_0x5545('0x28')]]={'$like':'%'+_0x41a256[_0x5545('0x30')][_0x5545('0x3b')]+'%'};return _0x39769a;}})});}_0x2436e4=_['merge']({},_0x2436e4,_0x41a256['options']);var _0x1e3b45={'where':_0x2436e4['where']};return db[_0x5545('0x3e')][_0x5545('0x1a')](_0x1e3b45)[_0x5545('0x21')](function(_0x1e86e0){_0x5dff3c[_0x5545('0x1a')]=_0x1e86e0;if(_0x41a256[_0x5545('0x30')][_0x5545('0x3f')]){_0x2436e4[_0x5545('0x40')]=[{'all':!![]}];}return db[_0x5545('0x3e')]['findAll'](_0x2436e4);})[_0x5545('0x21')](function(_0x37cdc6){_0x5dff3c[_0x5545('0x41')]=_0x37cdc6;return _0x5dff3c;})[_0x5545('0x21')](respondWithFilteredResult(_0x46e78e,_0x2436e4))[_0x5545('0x42')](handleError(_0x46e78e,null));};exports['show']=function(_0x36332d,_0x55d400){var _0x16655a={'raw':![],'where':{'id':_0x36332d[_0x5545('0x43')]['id']}},_0xb1703e={};_0xb1703e[_0x5545('0x2f')]=_[_0x5545('0x44')](db[_0x5545('0x3e')][_0x5545('0x2b')]);_0xb1703e[_0x5545('0x30')]=_[_0x5545('0x44')](_0x36332d[_0x5545('0x30')]);_0xb1703e[_0x5545('0x3a')]=_[_0x5545('0x31')](_0xb1703e['model'],_0xb1703e[_0x5545('0x30')]);_0x16655a[_0x5545('0x32')]=_[_0x5545('0x31')](_0xb1703e[_0x5545('0x2f')],qs[_0x5545('0x33')](_0x36332d[_0x5545('0x30')]['fields']));_0x16655a[_0x5545('0x32')]=_0x16655a[_0x5545('0x32')]['length']?_0x16655a[_0x5545('0x32')]:_0xb1703e[_0x5545('0x2f')];if(_0x36332d[_0x5545('0x30')][_0x5545('0x3f')]){_0x16655a['include']=[{'all':!![]}];}_0x16655a=_[_0x5545('0x3c')]({},_0x16655a,_0x36332d[_0x5545('0x45')]);return db[_0x5545('0x3e')]['find'](_0x16655a)['then'](handleEntityNotFound(_0x55d400,null))['then'](respondWithResult(_0x55d400,null))['catch'](handleError(_0x55d400,null));};exports[_0x5545('0x46')]=function(_0x29ca51,_0x1c6281){return db[_0x5545('0x3e')][_0x5545('0x46')](_0x29ca51['body'],{})[_0x5545('0x21')](function(_0xcdd10c){var _0x20e427=_0x29ca51[_0x5545('0x47')]['get']({'plain':!![]});if(!_0x20e427)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x20e427['role']==='user'){var _0x5bfc15=_0xcdd10c[_0x5545('0x22')]({'plain':!![]});var _0x1fc4d4=_0x5545('0x23');return db[_0x5545('0x48')][_0x5545('0x49')]({'where':{'name':_0x1fc4d4,'userProfileId':_0x20e427[_0x5545('0x4a')]},'raw':!![]})['then'](function(_0xbd484e){if(_0xbd484e&&_0xbd484e['autoAssociation']===0x0){return db[_0x5545('0x24')][_0x5545('0x46')]({'name':_0x5bfc15[_0x5545('0x28')],'resourceId':_0x5bfc15['id'],'type':_0xbd484e[_0x5545('0x28')],'sectionId':_0xbd484e['id']},{})[_0x5545('0x21')](function(){return _0xcdd10c;});}else{return _0xcdd10c;}})[_0x5545('0x42')](function(_0x2a7579){logger['error'](_0x5545('0x4b'),_0x2a7579);throw _0x2a7579;});}return _0xcdd10c;})[_0x5545('0x21')](respondWithResult(_0x1c6281,0xc9))[_0x5545('0x42')](handleError(_0x1c6281,null));};exports[_0x5545('0x20')]=function(_0x5eb476,_0x3dc887){if(_0x5eb476[_0x5545('0x4c')]['id']){delete _0x5eb476['body']['id'];}return db[_0x5545('0x3e')][_0x5545('0x49')]({'where':{'id':_0x5eb476[_0x5545('0x43')]['id']}})['then'](handleEntityNotFound(_0x3dc887,null))['then'](saveUpdates(_0x5eb476[_0x5545('0x4c')],null))['then'](respondWithResult(_0x3dc887,null))[_0x5545('0x42')](handleError(_0x3dc887,null));};exports[_0x5545('0x25')]=function(_0x38e8b6,_0x3fdb75){return db[_0x5545('0x3e')][_0x5545('0x49')]({'where':{'id':_0x38e8b6[_0x5545('0x43')]['id']}})['then'](handleEntityNotFound(_0x3fdb75,null))[_0x5545('0x21')](removeEntity(_0x3fdb75,null))['catch'](handleError(_0x3fdb75,null));};exports[_0x5545('0x4d')]=function(_0x1d0ba8,_0x31806d,_0x472365){if(_0x1d0ba8['body']['id']){delete _0x1d0ba8[_0x5545('0x4c')]['id'];}return db[_0x5545('0x3e')]['find']({'where':{'id':_0x1d0ba8[_0x5545('0x43')]['id']}})[_0x5545('0x21')](handleEntityNotFound(_0x31806d,null))['then'](function(_0x5a176b){if(_0x5a176b){_0x1d0ba8[_0x5545('0x4c')]['TriggerAllId']=_0x5a176b['id'];return db['Condition']['create'](_0x1d0ba8[_0x5545('0x4c')]);}})['then'](respondWithResult(_0x31806d,null))[_0x5545('0x42')](handleError(_0x31806d,null));};exports[_0x5545('0x4e')]=function(_0x264ebd,_0x443242,_0x3a6289){if(_0x264ebd['body']['id']){delete _0x264ebd[_0x5545('0x4c')]['id'];}return db[_0x5545('0x3e')][_0x5545('0x49')]({'where':{'id':_0x264ebd[_0x5545('0x43')]['id']}})[_0x5545('0x21')](handleEntityNotFound(_0x443242,null))[_0x5545('0x21')](function(_0x4fcdc1){if(_0x4fcdc1){_0x264ebd[_0x5545('0x4c')][_0x5545('0x4f')]=_0x4fcdc1['id'];return db[_0x5545('0x50')][_0x5545('0x46')](_0x264ebd['body']);}})['then'](respondWithResult(_0x443242,null))[_0x5545('0x42')](handleError(_0x443242,null));};exports[_0x5545('0x51')]=function(_0x5921b1,_0xc0a1d,_0x2e0121){var _0x5a9443={};var _0x2babe3={};var _0x451f47;var _0x5803bf;return db[_0x5545('0x3e')]['findOne']({'where':{'id':_0x5921b1[_0x5545('0x43')]['id']}})[_0x5545('0x21')](handleEntityNotFound(_0xc0a1d,null))[_0x5545('0x21')](function(_0x2adea4){if(_0x2adea4){_0x451f47=_0x2adea4;_0x2babe3[_0x5545('0x2f')]=_['keys'](db[_0x5545('0x50')][_0x5545('0x2b')]);_0x2babe3[_0x5545('0x30')]=_[_0x5545('0x44')](_0x5921b1[_0x5545('0x30')]);_0x2babe3[_0x5545('0x3a')]=_['intersection'](_0x2babe3[_0x5545('0x2f')],_0x2babe3[_0x5545('0x30')]);_0x5a9443[_0x5545('0x32')]=_[_0x5545('0x31')](_0x2babe3[_0x5545('0x2f')],qs[_0x5545('0x33')](_0x5921b1['query'][_0x5545('0x33')]));_0x5a9443['attributes']=_0x5a9443[_0x5545('0x32')][_0x5545('0x34')]?_0x5a9443['attributes']:_0x2babe3[_0x5545('0x2f')];_0x5a9443['order']=qs[_0x5545('0x37')](_0x5921b1[_0x5545('0x30')][_0x5545('0x37')]);_0x5a9443['where']=qs[_0x5545('0x3a')](_[_0x5545('0x39')](_0x5921b1[_0x5545('0x30')],_0x2babe3[_0x5545('0x3a')]));if(_0x5921b1['query'][_0x5545('0x3b')]){_0x5a9443[_0x5545('0x38')]=_[_0x5545('0x3c')](_0x5a9443['where'],{'$or':_['map'](_0x5a9443[_0x5545('0x32')],function(_0x4b00e7){var _0x33ebd0={};_0x33ebd0[_0x4b00e7]={'$like':'%'+_0x5921b1[_0x5545('0x30')]['filter']+'%'};return _0x33ebd0;})});}_0x5a9443=_['merge']({},_0x5a9443,_0x5921b1['options']);return _0x451f47['getAllConditions'](_0x5a9443);}})[_0x5545('0x21')](function(_0x5bef3a){if(_0x5bef3a){_0x5803bf=_0x5bef3a['length'];if(!_0x5921b1[_0x5545('0x30')][_0x5545('0x52')](_0x5545('0x35'))){_0x5a9443[_0x5545('0x1c')]=qs[_0x5545('0x1c')](_0x5921b1['query']['limit']);_0x5a9443[_0x5545('0x1b')]=qs[_0x5545('0x1b')](_0x5921b1[_0x5545('0x30')][_0x5545('0x1b')]);}return _0x451f47['getAllConditions'](_0x5a9443);}})[_0x5545('0x21')](function(_0x1f12db){if(_0x1f12db){return _0x1f12db?{'count':_0x5803bf,'rows':_0x1f12db}:null;}})[_0x5545('0x21')](respondWithResult(_0xc0a1d,null))['catch'](handleError(_0xc0a1d,null));};exports[_0x5545('0x53')]=function(_0x566a41,_0x289891,_0x8de219){var _0x5420dc={};var _0x22dee6={};var _0x4153a3;var _0x3d70d7;return db[_0x5545('0x3e')][_0x5545('0x54')]({'where':{'id':_0x566a41[_0x5545('0x43')]['id']}})[_0x5545('0x21')](handleEntityNotFound(_0x289891,null))[_0x5545('0x21')](function(_0x222e38){if(_0x222e38){_0x4153a3=_0x222e38;_0x22dee6[_0x5545('0x2f')]=_[_0x5545('0x44')](db[_0x5545('0x50')][_0x5545('0x2b')]);_0x22dee6[_0x5545('0x30')]=_[_0x5545('0x44')](_0x566a41['query']);_0x22dee6[_0x5545('0x3a')]=_[_0x5545('0x31')](_0x22dee6[_0x5545('0x2f')],_0x22dee6[_0x5545('0x30')]);_0x5420dc[_0x5545('0x32')]=_[_0x5545('0x31')](_0x22dee6[_0x5545('0x2f')],qs[_0x5545('0x33')](_0x566a41[_0x5545('0x30')]['fields']));_0x5420dc['attributes']=_0x5420dc[_0x5545('0x32')][_0x5545('0x34')]?_0x5420dc['attributes']:_0x22dee6[_0x5545('0x2f')];_0x5420dc['order']=qs['sort'](_0x566a41['query'][_0x5545('0x37')]);_0x5420dc[_0x5545('0x38')]=qs[_0x5545('0x3a')](_['pick'](_0x566a41[_0x5545('0x30')],_0x22dee6['filters']));if(_0x566a41[_0x5545('0x30')][_0x5545('0x3b')]){_0x5420dc[_0x5545('0x38')]=_[_0x5545('0x3c')](_0x5420dc[_0x5545('0x38')],{'$or':_['map'](_0x5420dc[_0x5545('0x32')],function(_0x1224c8){var _0xb9ceeb={};_0xb9ceeb[_0x1224c8]={'$like':'%'+_0x566a41[_0x5545('0x30')][_0x5545('0x3b')]+'%'};return _0xb9ceeb;})});}_0x5420dc=_[_0x5545('0x3c')]({},_0x5420dc,_0x566a41[_0x5545('0x45')]);return _0x4153a3['getAnyConditions'](_0x5420dc);}})[_0x5545('0x21')](function(_0x583b9f){if(_0x583b9f){_0x3d70d7=_0x583b9f[_0x5545('0x34')];if(!_0x566a41['query']['hasOwnProperty']('nolimit')){_0x5420dc[_0x5545('0x1c')]=qs[_0x5545('0x1c')](_0x566a41[_0x5545('0x30')]['limit']);_0x5420dc[_0x5545('0x1b')]=qs[_0x5545('0x1b')](_0x566a41[_0x5545('0x30')][_0x5545('0x1b')]);}return _0x4153a3[_0x5545('0x53')](_0x5420dc);}})['then'](function(_0x5cd962){if(_0x5cd962){return _0x5cd962?{'count':_0x3d70d7,'rows':_0x5cd962}:null;}})['then'](respondWithResult(_0x289891,null))[_0x5545('0x42')](handleError(_0x289891,null));};exports[_0x5545('0x55')]=function(_0x519cf7,_0x2f8b20,_0x5aa1f5){if(_0x519cf7[_0x5545('0x4c')]['id']){delete _0x519cf7[_0x5545('0x4c')]['id'];}return db[_0x5545('0x3e')][_0x5545('0x49')]({'where':{'id':_0x519cf7[_0x5545('0x43')]['id']}})[_0x5545('0x21')](handleEntityNotFound(_0x2f8b20,null))[_0x5545('0x21')](function(_0x7a34a3){if(_0x7a34a3){_0x519cf7[_0x5545('0x4c')][_0x5545('0x56')]=_0x7a34a3['id'];return db['Action'][_0x5545('0x46')](_0x519cf7[_0x5545('0x4c')]);}})['then'](respondWithResult(_0x2f8b20,null))[_0x5545('0x42')](handleError(_0x2f8b20,null));};exports['getActions']=function(_0x474814,_0x4feaaa,_0x2ec609){var _0x318590={};var _0x213c0e={};var _0x4da094;var _0x38bf19;return db['Trigger'][_0x5545('0x54')]({'where':{'id':_0x474814[_0x5545('0x43')]['id']}})['then'](handleEntityNotFound(_0x4feaaa,null))[_0x5545('0x21')](function(_0x2dc676){if(_0x2dc676){_0x4da094=_0x2dc676;_0x213c0e[_0x5545('0x2f')]=_[_0x5545('0x44')](db[_0x5545('0x57')][_0x5545('0x2b')]);_0x213c0e[_0x5545('0x30')]=_[_0x5545('0x44')](_0x474814[_0x5545('0x30')]);_0x213c0e[_0x5545('0x3a')]=_[_0x5545('0x31')](_0x213c0e[_0x5545('0x2f')],_0x213c0e['query']);_0x318590['attributes']=_[_0x5545('0x31')](_0x213c0e['model'],qs[_0x5545('0x33')](_0x474814['query']['fields']));_0x318590['attributes']=_0x318590[_0x5545('0x32')][_0x5545('0x34')]?_0x318590['attributes']:_0x213c0e[_0x5545('0x2f')];_0x318590[_0x5545('0x36')]=qs[_0x5545('0x37')](_0x474814[_0x5545('0x30')][_0x5545('0x37')]);_0x318590[_0x5545('0x38')]=qs[_0x5545('0x3a')](_[_0x5545('0x39')](_0x474814['query'],_0x213c0e[_0x5545('0x3a')]));if(_0x474814['query'][_0x5545('0x3b')]){_0x318590['where']=_[_0x5545('0x3c')](_0x318590[_0x5545('0x38')],{'$or':_[_0x5545('0x2a')](_0x318590['attributes'],function(_0x22140d){var _0x154dd4={};_0x154dd4[_0x22140d]={'$like':'%'+_0x474814[_0x5545('0x30')]['filter']+'%'};return _0x154dd4;})});}_0x318590=_[_0x5545('0x3c')]({},_0x318590,_0x474814[_0x5545('0x45')]);return _0x4da094['getActions'](_0x318590);}})['then'](function(_0x35fb1b){if(_0x35fb1b){_0x38bf19=_0x35fb1b['length'];if(!_0x474814[_0x5545('0x30')][_0x5545('0x52')]('nolimit')){_0x318590['limit']=qs[_0x5545('0x1c')](_0x474814[_0x5545('0x30')][_0x5545('0x1c')]);_0x318590['offset']=qs[_0x5545('0x1b')](_0x474814[_0x5545('0x30')][_0x5545('0x1b')]);}return _0x4da094['getActions'](_0x318590);}})[_0x5545('0x21')](function(_0x5000d3){if(_0x5000d3){return _0x5000d3?{'count':_0x38bf19,'rows':_0x5000d3}:null;}})[_0x5545('0x21')](respondWithResult(_0x4feaaa,null))[_0x5545('0x42')](handleError(_0x4feaaa,null));}; \ No newline at end of file +var _0xb647=['sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','fields','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','get','Triggers','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','model','keys','filters','attributes','intersection','query','length','hasOwnProperty','nolimit','order'];(function(_0x59bee2,_0xab2f75){var _0x445c80=function(_0x4e77a7){while(--_0x4e77a7){_0x59bee2['push'](_0x59bee2['shift']());}};_0x445c80(++_0xab2f75);}(_0xb647,0xdb));var _0x7b64=function(_0x35a74d,_0x18ce95){_0x35a74d=_0x35a74d-0x0;var _0x473e62=_0xb647[_0x35a74d];return _0x473e62;};'use strict';var pdf=require(_0x7b64('0x0'));var emlformat=require(_0x7b64('0x1'));var rimraf=require(_0x7b64('0x2'));var zipdir=require(_0x7b64('0x3'));var jsonpatch=require(_0x7b64('0x4'));var rp=require(_0x7b64('0x5'));var moment=require(_0x7b64('0x6'));var BPromise=require(_0x7b64('0x7'));var Mustache=require('mustache');var util=require(_0x7b64('0x8'));var path=require('path');var sox=require(_0x7b64('0x9'));var csv=require(_0x7b64('0xa'));var ejs=require(_0x7b64('0xb'));var fs=require('fs');var _=require(_0x7b64('0xc'));var squel=require(_0x7b64('0xd'));var crypto=require(_0x7b64('0xe'));var jsforce=require(_0x7b64('0xf'));var deskjs=require(_0x7b64('0x10'));var toCsv=require(_0x7b64('0xa'));var querystring=require('querystring');var Papa=require(_0x7b64('0x11'));var Redis=require('ioredis');var authService=require(_0x7b64('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b64('0x13'));var logger=require(_0x7b64('0x14'))('api');var utils=require(_0x7b64('0x15'));var config=require(_0x7b64('0x16'));var licenseUtil=require(_0x7b64('0x17'));var db=require(_0x7b64('0x18'))['db'];function respondWithStatusCode(_0x25e135,_0x432626){_0x432626=_0x432626||0xcc;return function(_0x5ea1dd){if(_0x5ea1dd){return _0x25e135['sendStatus'](_0x432626);}return _0x25e135[_0x7b64('0x19')](_0x432626)['end']();};}function respondWithResult(_0x530938,_0x2f21d8){_0x2f21d8=_0x2f21d8||0xc8;return function(_0x29a596){if(_0x29a596){return _0x530938[_0x7b64('0x19')](_0x2f21d8)[_0x7b64('0x1a')](_0x29a596);}};}function respondWithFilteredResult(_0x33ebe7,_0x437ddc){return function(_0x306a4e){if(_0x306a4e){var _0x519316=_0x306a4e[_0x7b64('0x1b')],_0xca026a=_0x437ddc[_0x7b64('0x1c')],_0x40066b=_0x437ddc['offset']+_0x437ddc[_0x7b64('0x1d')],_0x16ff72;if(_0x40066b>=_0x519316){_0x40066b=_0x519316;_0x16ff72=0xc8;}else{_0x16ff72=0xce;}_0x33ebe7[_0x7b64('0x19')](_0x16ff72);return _0x33ebe7['set'](_0x7b64('0x1e'),_0xca026a+'-'+_0x40066b+'/'+_0x519316)[_0x7b64('0x1a')](_0x306a4e);}return null;};}function patchUpdates(_0x5ef53f){return function(_0x23845e){try{jsonpatch[_0x7b64('0x1f')](_0x23845e,_0x5ef53f,!![]);}catch(_0x30d633){return BPromise[_0x7b64('0x20')](_0x30d633);}return _0x23845e['save']();};}function saveUpdates(_0x123a3b,_0x5c4135){return function(_0x4a7549){if(_0x4a7549){return _0x4a7549[_0x7b64('0x21')](_0x123a3b)['then'](function(_0x2d2d9a){return _0x2d2d9a;});}return null;};}function removeEntity(_0x587da6,_0x1bbd87){return function(_0x1ad95f){if(_0x1ad95f){return _0x1ad95f[_0x7b64('0x22')]()[_0x7b64('0x23')](function(){var _0x450b7e=_0x1ad95f[_0x7b64('0x24')]({'plain':!![]});var _0x215ea9=_0x7b64('0x25');return db[_0x7b64('0x26')][_0x7b64('0x22')]({'where':{'type':_0x215ea9,'resourceId':_0x450b7e['id']}})[_0x7b64('0x23')](function(){return _0x1ad95f;});})[_0x7b64('0x23')](function(){_0x587da6[_0x7b64('0x19')](0xcc)[_0x7b64('0x27')]();});}};}function handleEntityNotFound(_0x50d06c,_0xc61df8){return function(_0x5d9586){if(!_0x5d9586){_0x50d06c[_0x7b64('0x28')](0x194);}return _0x5d9586;};}function handleError(_0x21fbd3,_0x5c10ca){_0x5c10ca=_0x5c10ca||0x1f4;return function(_0x5acdb3){logger[_0x7b64('0x29')](_0x5acdb3[_0x7b64('0x2a')]);if(_0x5acdb3[_0x7b64('0x2b')]){delete _0x5acdb3[_0x7b64('0x2b')];}_0x21fbd3[_0x7b64('0x19')](_0x5c10ca)[_0x7b64('0x2c')](_0x5acdb3);};}exports[_0x7b64('0x2d')]=function(_0x2729f1,_0x53e29b){var _0x1616c9={},_0x2c4619={},_0x5d7fd9={'count':0x0,'rows':[]};var _0x6b1d0=_[_0x7b64('0x2e')](db[_0x7b64('0x2f')][_0x7b64('0x30')],function(_0x144327){return{'name':_0x144327[_0x7b64('0x31')],'type':_0x144327['type']['key']};});_0x2c4619[_0x7b64('0x32')]=_[_0x7b64('0x2e')](_0x6b1d0,'name');_0x2c4619['query']=_[_0x7b64('0x33')](_0x2729f1['query']);_0x2c4619[_0x7b64('0x34')]=_['intersection'](_0x2c4619['model'],_0x2c4619['query']);_0x1616c9[_0x7b64('0x35')]=_[_0x7b64('0x36')](_0x2c4619[_0x7b64('0x32')],qs['fields'](_0x2729f1[_0x7b64('0x37')]['fields']));_0x1616c9[_0x7b64('0x35')]=_0x1616c9[_0x7b64('0x35')][_0x7b64('0x38')]?_0x1616c9[_0x7b64('0x35')]:_0x2c4619[_0x7b64('0x32')];if(!_0x2729f1['query'][_0x7b64('0x39')](_0x7b64('0x3a'))){_0x1616c9[_0x7b64('0x1d')]=qs[_0x7b64('0x1d')](_0x2729f1['query'][_0x7b64('0x1d')]);_0x1616c9[_0x7b64('0x1c')]=qs[_0x7b64('0x1c')](_0x2729f1[_0x7b64('0x37')][_0x7b64('0x1c')]);}_0x1616c9[_0x7b64('0x3b')]=qs[_0x7b64('0x3c')](_0x2729f1['query']['sort']);_0x1616c9[_0x7b64('0x3d')]=qs[_0x7b64('0x34')](_[_0x7b64('0x3e')](_0x2729f1[_0x7b64('0x37')],_0x2c4619[_0x7b64('0x34')]),_0x6b1d0);if(_0x2729f1[_0x7b64('0x37')][_0x7b64('0x3f')]){_0x1616c9[_0x7b64('0x3d')]=_[_0x7b64('0x40')](_0x1616c9['where'],{'$or':_[_0x7b64('0x2e')](_0x6b1d0,function(_0x2e58b2){if(_0x2e58b2[_0x7b64('0x41')]!==_0x7b64('0x42')){var _0x3bf413={};_0x3bf413[_0x2e58b2[_0x7b64('0x2b')]]={'$like':'%'+_0x2729f1[_0x7b64('0x37')][_0x7b64('0x3f')]+'%'};return _0x3bf413;}})});}_0x1616c9=_[_0x7b64('0x40')]({},_0x1616c9,_0x2729f1[_0x7b64('0x43')]);var _0xb24499={'where':_0x1616c9[_0x7b64('0x3d')]};return db[_0x7b64('0x2f')][_0x7b64('0x1b')](_0xb24499)[_0x7b64('0x23')](function(_0x42cc06){_0x5d7fd9[_0x7b64('0x1b')]=_0x42cc06;if(_0x2729f1[_0x7b64('0x37')][_0x7b64('0x44')]){_0x1616c9[_0x7b64('0x45')]=[{'all':!![]}];}return db['Trigger'][_0x7b64('0x46')](_0x1616c9);})[_0x7b64('0x23')](function(_0x163580){_0x5d7fd9['rows']=_0x163580;return _0x5d7fd9;})[_0x7b64('0x23')](respondWithFilteredResult(_0x53e29b,_0x1616c9))[_0x7b64('0x47')](handleError(_0x53e29b,null));};exports['show']=function(_0x216c58,_0xf0d4a1){var _0x54d7d2={'raw':![],'where':{'id':_0x216c58['params']['id']}},_0x132d39={};_0x132d39[_0x7b64('0x32')]=_[_0x7b64('0x33')](db[_0x7b64('0x2f')]['rawAttributes']);_0x132d39[_0x7b64('0x37')]=_[_0x7b64('0x33')](_0x216c58[_0x7b64('0x37')]);_0x132d39[_0x7b64('0x34')]=_[_0x7b64('0x36')](_0x132d39[_0x7b64('0x32')],_0x132d39['query']);_0x54d7d2[_0x7b64('0x35')]=_[_0x7b64('0x36')](_0x132d39[_0x7b64('0x32')],qs[_0x7b64('0x48')](_0x216c58[_0x7b64('0x37')]['fields']));_0x54d7d2['attributes']=_0x54d7d2['attributes']['length']?_0x54d7d2[_0x7b64('0x35')]:_0x132d39[_0x7b64('0x32')];if(_0x216c58[_0x7b64('0x37')][_0x7b64('0x44')]){_0x54d7d2[_0x7b64('0x45')]=[{'all':!![]}];}_0x54d7d2=_[_0x7b64('0x40')]({},_0x54d7d2,_0x216c58[_0x7b64('0x43')]);return db[_0x7b64('0x2f')][_0x7b64('0x49')](_0x54d7d2)[_0x7b64('0x23')](handleEntityNotFound(_0xf0d4a1,null))[_0x7b64('0x23')](respondWithResult(_0xf0d4a1,null))[_0x7b64('0x47')](handleError(_0xf0d4a1,null));};exports['create']=function(_0x4c2006,_0x31d364){return db[_0x7b64('0x2f')][_0x7b64('0x4a')](_0x4c2006[_0x7b64('0x4b')],{})[_0x7b64('0x23')](function(_0x5a8639){var _0x3e5321=_0x4c2006[_0x7b64('0x4c')][_0x7b64('0x24')]({'plain':!![]});if(!_0x3e5321)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e5321[_0x7b64('0x4d')]===_0x7b64('0x4c')){var _0x27c9f9=_0x5a8639[_0x7b64('0x24')]({'plain':!![]});var _0x18c5b0='Triggers';return db[_0x7b64('0x4e')][_0x7b64('0x49')]({'where':{'name':_0x18c5b0,'userProfileId':_0x3e5321['userProfileId']},'raw':!![]})[_0x7b64('0x23')](function(_0x3dffa5){if(_0x3dffa5&&_0x3dffa5['autoAssociation']===0x0){return db[_0x7b64('0x26')][_0x7b64('0x4a')]({'name':_0x27c9f9[_0x7b64('0x2b')],'resourceId':_0x27c9f9['id'],'type':_0x3dffa5[_0x7b64('0x2b')],'sectionId':_0x3dffa5['id']},{})[_0x7b64('0x23')](function(){return _0x5a8639;});}else{return _0x5a8639;}})[_0x7b64('0x47')](function(_0x253b33){logger[_0x7b64('0x29')](_0x7b64('0x4f'),_0x253b33);throw _0x253b33;});}return _0x5a8639;})[_0x7b64('0x23')](respondWithResult(_0x31d364,0xc9))[_0x7b64('0x47')](handleError(_0x31d364,null));};exports[_0x7b64('0x21')]=function(_0x473aa3,_0x1ef736){if(_0x473aa3[_0x7b64('0x4b')]['id']){delete _0x473aa3[_0x7b64('0x4b')]['id'];}return db[_0x7b64('0x2f')][_0x7b64('0x49')]({'where':{'id':_0x473aa3['params']['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x1ef736,null))['then'](saveUpdates(_0x473aa3[_0x7b64('0x4b')],null))[_0x7b64('0x23')](respondWithResult(_0x1ef736,null))[_0x7b64('0x47')](handleError(_0x1ef736,null));};exports['destroy']=function(_0x5b4971,_0x3f16e5){return db['Trigger']['find']({'where':{'id':_0x5b4971[_0x7b64('0x50')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x3f16e5,null))[_0x7b64('0x23')](removeEntity(_0x3f16e5,null))['catch'](handleError(_0x3f16e5,null));};exports[_0x7b64('0x51')]=function(_0x9721a9,_0x1421d7,_0x32ba5d){if(_0x9721a9[_0x7b64('0x4b')]['id']){delete _0x9721a9['body']['id'];}return db['Trigger'][_0x7b64('0x49')]({'where':{'id':_0x9721a9[_0x7b64('0x50')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x1421d7,null))[_0x7b64('0x23')](function(_0x59df96){if(_0x59df96){_0x9721a9[_0x7b64('0x4b')][_0x7b64('0x52')]=_0x59df96['id'];return db[_0x7b64('0x53')][_0x7b64('0x4a')](_0x9721a9['body']);}})[_0x7b64('0x23')](respondWithResult(_0x1421d7,null))['catch'](handleError(_0x1421d7,null));};exports[_0x7b64('0x54')]=function(_0x508272,_0x553d1a,_0x56ca4b){if(_0x508272['body']['id']){delete _0x508272[_0x7b64('0x4b')]['id'];}return db[_0x7b64('0x2f')]['find']({'where':{'id':_0x508272[_0x7b64('0x50')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x553d1a,null))[_0x7b64('0x23')](function(_0x553d98){if(_0x553d98){_0x508272[_0x7b64('0x4b')][_0x7b64('0x55')]=_0x553d98['id'];return db['Condition']['create'](_0x508272[_0x7b64('0x4b')]);}})['then'](respondWithResult(_0x553d1a,null))['catch'](handleError(_0x553d1a,null));};exports[_0x7b64('0x56')]=function(_0x35a6d4,_0x4965a3,_0x4b0aa8){var _0x28002e={};var _0xb26d45={};var _0x5cd88d;var _0x86ddde;return db['Trigger'][_0x7b64('0x57')]({'where':{'id':_0x35a6d4['params']['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x4965a3,null))[_0x7b64('0x23')](function(_0x2ad554){if(_0x2ad554){_0x5cd88d=_0x2ad554;_0xb26d45[_0x7b64('0x32')]=_[_0x7b64('0x33')](db['Condition'][_0x7b64('0x30')]);_0xb26d45[_0x7b64('0x37')]=_[_0x7b64('0x33')](_0x35a6d4[_0x7b64('0x37')]);_0xb26d45['filters']=_[_0x7b64('0x36')](_0xb26d45[_0x7b64('0x32')],_0xb26d45[_0x7b64('0x37')]);_0x28002e['attributes']=_[_0x7b64('0x36')](_0xb26d45['model'],qs[_0x7b64('0x48')](_0x35a6d4[_0x7b64('0x37')]['fields']));_0x28002e['attributes']=_0x28002e[_0x7b64('0x35')]['length']?_0x28002e[_0x7b64('0x35')]:_0xb26d45[_0x7b64('0x32')];_0x28002e[_0x7b64('0x3b')]=qs[_0x7b64('0x3c')](_0x35a6d4[_0x7b64('0x37')][_0x7b64('0x3c')]);_0x28002e[_0x7b64('0x3d')]=qs[_0x7b64('0x34')](_['pick'](_0x35a6d4[_0x7b64('0x37')],_0xb26d45[_0x7b64('0x34')]));if(_0x35a6d4['query']['filter']){_0x28002e[_0x7b64('0x3d')]=_[_0x7b64('0x40')](_0x28002e['where'],{'$or':_[_0x7b64('0x2e')](_0x28002e[_0x7b64('0x35')],function(_0x4fe51b){var _0x11507c={};_0x11507c[_0x4fe51b]={'$like':'%'+_0x35a6d4[_0x7b64('0x37')]['filter']+'%'};return _0x11507c;})});}_0x28002e=_['merge']({},_0x28002e,_0x35a6d4['options']);return _0x5cd88d[_0x7b64('0x56')](_0x28002e);}})['then'](function(_0x1c170e){if(_0x1c170e){_0x86ddde=_0x1c170e[_0x7b64('0x38')];if(!_0x35a6d4[_0x7b64('0x37')]['hasOwnProperty'](_0x7b64('0x3a'))){_0x28002e[_0x7b64('0x1d')]=qs[_0x7b64('0x1d')](_0x35a6d4['query']['limit']);_0x28002e[_0x7b64('0x1c')]=qs[_0x7b64('0x1c')](_0x35a6d4['query'][_0x7b64('0x1c')]);}return _0x5cd88d[_0x7b64('0x56')](_0x28002e);}})['then'](function(_0x24cb34){if(_0x24cb34){return _0x24cb34?{'count':_0x86ddde,'rows':_0x24cb34}:null;}})[_0x7b64('0x23')](respondWithResult(_0x4965a3,null))['catch'](handleError(_0x4965a3,null));};exports[_0x7b64('0x58')]=function(_0x8941d9,_0x2e7053,_0x32672d){var _0x3a853c={};var _0x37b00b={};var _0x4bec38;var _0x4ac9b9;return db[_0x7b64('0x2f')][_0x7b64('0x57')]({'where':{'id':_0x8941d9['params']['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x2e7053,null))[_0x7b64('0x23')](function(_0x26d94d){if(_0x26d94d){_0x4bec38=_0x26d94d;_0x37b00b['model']=_[_0x7b64('0x33')](db[_0x7b64('0x53')]['rawAttributes']);_0x37b00b[_0x7b64('0x37')]=_['keys'](_0x8941d9[_0x7b64('0x37')]);_0x37b00b['filters']=_[_0x7b64('0x36')](_0x37b00b[_0x7b64('0x32')],_0x37b00b['query']);_0x3a853c[_0x7b64('0x35')]=_['intersection'](_0x37b00b[_0x7b64('0x32')],qs[_0x7b64('0x48')](_0x8941d9['query'][_0x7b64('0x48')]));_0x3a853c[_0x7b64('0x35')]=_0x3a853c[_0x7b64('0x35')]['length']?_0x3a853c[_0x7b64('0x35')]:_0x37b00b['model'];_0x3a853c['order']=qs['sort'](_0x8941d9[_0x7b64('0x37')][_0x7b64('0x3c')]);_0x3a853c[_0x7b64('0x3d')]=qs[_0x7b64('0x34')](_[_0x7b64('0x3e')](_0x8941d9['query'],_0x37b00b['filters']));if(_0x8941d9[_0x7b64('0x37')][_0x7b64('0x3f')]){_0x3a853c[_0x7b64('0x3d')]=_[_0x7b64('0x40')](_0x3a853c[_0x7b64('0x3d')],{'$or':_['map'](_0x3a853c[_0x7b64('0x35')],function(_0x49e134){var _0x2fe250={};_0x2fe250[_0x49e134]={'$like':'%'+_0x8941d9[_0x7b64('0x37')][_0x7b64('0x3f')]+'%'};return _0x2fe250;})});}_0x3a853c=_['merge']({},_0x3a853c,_0x8941d9[_0x7b64('0x43')]);return _0x4bec38['getAnyConditions'](_0x3a853c);}})[_0x7b64('0x23')](function(_0x2ebeb0){if(_0x2ebeb0){_0x4ac9b9=_0x2ebeb0['length'];if(!_0x8941d9[_0x7b64('0x37')][_0x7b64('0x39')](_0x7b64('0x3a'))){_0x3a853c[_0x7b64('0x1d')]=qs[_0x7b64('0x1d')](_0x8941d9[_0x7b64('0x37')][_0x7b64('0x1d')]);_0x3a853c['offset']=qs[_0x7b64('0x1c')](_0x8941d9['query'][_0x7b64('0x1c')]);}return _0x4bec38[_0x7b64('0x58')](_0x3a853c);}})[_0x7b64('0x23')](function(_0x2763b6){if(_0x2763b6){return _0x2763b6?{'count':_0x4ac9b9,'rows':_0x2763b6}:null;}})[_0x7b64('0x23')](respondWithResult(_0x2e7053,null))[_0x7b64('0x47')](handleError(_0x2e7053,null));};exports[_0x7b64('0x59')]=function(_0x4cd35c,_0x4a8aca,_0x1cadbf){if(_0x4cd35c[_0x7b64('0x4b')]['id']){delete _0x4cd35c[_0x7b64('0x4b')]['id'];}return db[_0x7b64('0x2f')][_0x7b64('0x49')]({'where':{'id':_0x4cd35c[_0x7b64('0x50')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x4a8aca,null))[_0x7b64('0x23')](function(_0x351819){if(_0x351819){_0x4cd35c['body'][_0x7b64('0x5a')]=_0x351819['id'];return db[_0x7b64('0x5b')][_0x7b64('0x4a')](_0x4cd35c[_0x7b64('0x4b')]);}})['then'](respondWithResult(_0x4a8aca,null))[_0x7b64('0x47')](handleError(_0x4a8aca,null));};exports[_0x7b64('0x5c')]=function(_0x2c5080,_0x5ad035,_0x3b0544){var _0x264eb8={};var _0x50797c={};var _0x108e60;var _0x18bf21;return db[_0x7b64('0x2f')][_0x7b64('0x57')]({'where':{'id':_0x2c5080[_0x7b64('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ad035,null))[_0x7b64('0x23')](function(_0x2cdbe4){if(_0x2cdbe4){_0x108e60=_0x2cdbe4;_0x50797c['model']=_[_0x7b64('0x33')](db[_0x7b64('0x5b')][_0x7b64('0x30')]);_0x50797c[_0x7b64('0x37')]=_['keys'](_0x2c5080[_0x7b64('0x37')]);_0x50797c[_0x7b64('0x34')]=_[_0x7b64('0x36')](_0x50797c[_0x7b64('0x32')],_0x50797c[_0x7b64('0x37')]);_0x264eb8[_0x7b64('0x35')]=_[_0x7b64('0x36')](_0x50797c[_0x7b64('0x32')],qs['fields'](_0x2c5080[_0x7b64('0x37')][_0x7b64('0x48')]));_0x264eb8[_0x7b64('0x35')]=_0x264eb8[_0x7b64('0x35')]['length']?_0x264eb8[_0x7b64('0x35')]:_0x50797c['model'];_0x264eb8[_0x7b64('0x3b')]=qs[_0x7b64('0x3c')](_0x2c5080[_0x7b64('0x37')]['sort']);_0x264eb8['where']=qs[_0x7b64('0x34')](_[_0x7b64('0x3e')](_0x2c5080[_0x7b64('0x37')],_0x50797c[_0x7b64('0x34')]));if(_0x2c5080[_0x7b64('0x37')][_0x7b64('0x3f')]){_0x264eb8['where']=_[_0x7b64('0x40')](_0x264eb8['where'],{'$or':_[_0x7b64('0x2e')](_0x264eb8['attributes'],function(_0x1174c1){var _0x37420b={};_0x37420b[_0x1174c1]={'$like':'%'+_0x2c5080[_0x7b64('0x37')][_0x7b64('0x3f')]+'%'};return _0x37420b;})});}_0x264eb8=_['merge']({},_0x264eb8,_0x2c5080[_0x7b64('0x43')]);return _0x108e60[_0x7b64('0x5c')](_0x264eb8);}})[_0x7b64('0x23')](function(_0x14a695){if(_0x14a695){_0x18bf21=_0x14a695[_0x7b64('0x38')];if(!_0x2c5080[_0x7b64('0x37')][_0x7b64('0x39')](_0x7b64('0x3a'))){_0x264eb8[_0x7b64('0x1d')]=qs[_0x7b64('0x1d')](_0x2c5080[_0x7b64('0x37')]['limit']);_0x264eb8[_0x7b64('0x1c')]=qs[_0x7b64('0x1c')](_0x2c5080[_0x7b64('0x37')][_0x7b64('0x1c')]);}return _0x108e60[_0x7b64('0x5c')](_0x264eb8);}})[_0x7b64('0x23')](function(_0x3d1b36){if(_0x3d1b36){return _0x3d1b36?{'count':_0x18bf21,'rows':_0x3d1b36}:null;}})['then'](respondWithResult(_0x5ad035,null))[_0x7b64('0x47')](handleError(_0x5ad035,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 7e5a194..b54a9b0 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 _0x51ab=['util','../../config/logger','api','moment','bluebird','request-promise','path','./trigger.attributes','Trigger','lodash'];(function(_0x2a49d6,_0x1ca83a){var _0x420777=function(_0x5eb6d3){while(--_0x5eb6d3){_0x2a49d6['push'](_0x2a49d6['shift']());}};_0x420777(++_0x1ca83a);}(_0x51ab,0x95));var _0xb51a=function(_0x3df8a6,_0x4abee6){_0x3df8a6=_0x3df8a6-0x0;var _0x90aef=_0x51ab[_0x3df8a6];return _0x90aef;};'use strict';var _=require(_0xb51a('0x0'));var util=require(_0xb51a('0x1'));var logger=require(_0xb51a('0x2'))(_0xb51a('0x3'));var moment=require(_0xb51a('0x4'));var BPromise=require(_0xb51a('0x5'));var rp=require(_0xb51a('0x6'));var fs=require('fs');var path=require(_0xb51a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb51a('0x8'));module['exports']=function(_0x14c13d,_0x6a424a){return _0x14c13d['define'](_0xb51a('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9918=['tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','./trigger.attributes','exports','define','Trigger'];(function(_0x4b6a2c,_0x3f24ec){var _0x5adcd0=function(_0x5e0609){while(--_0x5e0609){_0x4b6a2c['push'](_0x4b6a2c['shift']());}};_0x5adcd0(++_0x3f24ec);}(_0x9918,0xf1));var _0x8991=function(_0x602a10,_0x1e0c32){_0x602a10=_0x602a10-0x0;var _0x3d6837=_0x9918[_0x602a10];return _0x3d6837;};'use strict';var _=require(_0x8991('0x0'));var util=require(_0x8991('0x1'));var logger=require(_0x8991('0x2'))(_0x8991('0x3'));var moment=require(_0x8991('0x4'));var BPromise=require('bluebird');var rp=require(_0x8991('0x5'));var fs=require('fs');var path=require(_0x8991('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8991('0x7'));module[_0x8991('0x8')]=function(_0x59818d,_0x805d50){return _0x59818d[_0x8991('0x9')](_0x8991('0xa'),attributes,{'tableName':_0x8991('0xb'),'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 a510b05..d3dd325 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 _0xe5b5=['GetTrigger','Trigger','options','where','attributes','include','map','model','debug','ShowTrigger','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch'];(function(_0x3ca7a9,_0x4fc0c7){var _0x399428=function(_0x3f30b2){while(--_0x3f30b2){_0x3ca7a9['push'](_0x3ca7a9['shift']());}};_0x399428(++_0x4fc0c7);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x503790,_0x525c78){_0x503790=_0x503790-0x0;var _0x388092=_0xe5b5[_0x503790];return _0x388092;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('Trigger,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('Trigger,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('Trigger,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});}exports[_0x5e5b('0x19')]=function(_0x45a091){var _0x4c5f9a=this;return new Promise(function(_0xe5aa6b,_0x1560e1){return db[_0x5e5b('0x1a')]['findAll']({'raw':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1c')]||null:null,'attributes':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1d')]||null:null,'limit':_0x45a091[_0x5e5b('0x1b')]?_0x45a091[_0x5e5b('0x1b')]['limit']||null:null,'include':_0x45a091['options']?_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x45a091[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x28cd95){return{'model':db[_0x28cd95[_0x5e5b('0x20')]],'as':_0x28cd95['as'],'attributes':_0x28cd95[_0x5e5b('0x1d')],'include':_0x28cd95[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x28cd95[_0x5e5b('0x1e')],function(_0x4da321){return{'model':db[_0x4da321[_0x5e5b('0x20')]],'as':_0x4da321['as'],'attributes':_0x4da321[_0x5e5b('0x1d')],'include':_0x4da321[_0x5e5b('0x1e')]?_['map'](_0x4da321[_0x5e5b('0x1e')],function(_0xdb2863){return{'model':db[_0xdb2863['model']],'as':_0xdb2863['as'],'attributes':_0xdb2863[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x39ce16){logger[_0x5e5b('0x10')](_0x5e5b('0x19'),_0x45a091);logger[_0x5e5b('0x21')](_0x5e5b('0x19'),_0x45a091,JSON[_0x5e5b('0x13')](_0x39ce16));_0xe5aa6b(_0x39ce16);})[_0x5e5b('0x18')](function(_0x42da3b){logger[_0x5e5b('0x14')](_0x5e5b('0x19'),_0x42da3b['message'],_0x45a091);_0x1560e1(_0x4c5f9a['error'](0x1f4,_0x42da3b[_0x5e5b('0x16')]));});});};exports[_0x5e5b('0x22')]=function(_0xb68419){var _0x3dcdab=this;return new Promise(function(_0x12f1ee,_0x4b9be8){return db[_0x5e5b('0x1a')]['find']({'raw':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x23')]===undefined?!![]:![]:!![],'where':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1c')]||null:null,'attributes':_0xb68419[_0x5e5b('0x1b')]?_0xb68419['options'][_0x5e5b('0x1d')]||null:null,'include':_0xb68419[_0x5e5b('0x1b')]?_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0xb68419[_0x5e5b('0x1b')][_0x5e5b('0x1e')],function(_0x317451){return{'model':db[_0x317451['model']],'as':_0x317451['as'],'attributes':_0x317451[_0x5e5b('0x1d')],'include':_0x317451[_0x5e5b('0x1e')]?_[_0x5e5b('0x1f')](_0x317451[_0x5e5b('0x1e')],function(_0x7da7a5){return{'model':db[_0x7da7a5[_0x5e5b('0x20')]],'as':_0x7da7a5['as'],'attributes':_0x7da7a5['attributes'],'include':_0x7da7a5['include']?_[_0x5e5b('0x1f')](_0x7da7a5[_0x5e5b('0x1e')],function(_0x8ec651){return{'model':db[_0x8ec651['model']],'as':_0x8ec651['as'],'attributes':_0x8ec651[_0x5e5b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5e5b('0xf')](function(_0x18f5ba){logger[_0x5e5b('0x10')]('ShowTrigger',_0xb68419);logger[_0x5e5b('0x21')](_0x5e5b('0x22'),_0xb68419,JSON['stringify'](_0x18f5ba));_0x12f1ee(_0x18f5ba);})['catch'](function(_0xe9c586){logger[_0x5e5b('0x14')](_0x5e5b('0x22'),_0xe9c586['message'],_0xb68419);_0x4b9be8(_0x3dcdab[_0x5e5b('0x14')](0x1f4,_0xe9c586['message']));});});}; \ No newline at end of file +var _0xa5fa=['jayson/promise','client','http','request','info','debug','stringify','error','code','Trigger,\x20%s,\x20%s','message','request\x20sent','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','map','model','then','ShowTrigger','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4eac62,_0x2b6ad5){var _0x4d9b82=function(_0x1aa16c){while(--_0x1aa16c){_0x4eac62['push'](_0x4eac62['shift']());}};_0x4d9b82(++_0x2b6ad5);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x17281a,_0x487e8d){_0x17281a=_0x17281a-0x0;var _0x309717=_0xa5fa[_0x17281a];return _0x309717;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b606,_0x302138,_0xc326df){return new BPromise(function(_0x74f64f,_0x3f550e){return client[_0xaa5f('0xb')](_0x13b606,_0xc326df)['then'](function(_0x1674c2){logger[_0xaa5f('0xc')]('Trigger,\x20%s,\x20%s',_0x302138,'request\x20sent');logger[_0xaa5f('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x302138,'request\x20sent',JSON[_0xaa5f('0xe')](_0x1674c2));if(_0x1674c2['error']){if(_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x10')]===0x1f4){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')]['message']);return _0x3f550e(_0x1674c2[_0xaa5f('0xf')]['message']);}logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1674c2[_0xaa5f('0xf')][_0xaa5f('0x12')]);return _0x74f64f(_0x1674c2[_0xaa5f('0xf')]['message']);}else{logger['info'](_0xaa5f('0x11'),_0x302138,_0xaa5f('0x13'));_0x74f64f(_0x1674c2[_0xaa5f('0x14')][_0xaa5f('0x12')]);}})[_0xaa5f('0x15')](function(_0x1fa36a){logger[_0xaa5f('0xf')](_0xaa5f('0x11'),_0x302138,_0x1fa36a);_0x3f550e(_0x1fa36a);});});}exports[_0xaa5f('0x16')]=function(_0x3d874f){var _0x22175f=this;return new Promise(function(_0x1019e8,_0x4f4cd5){return db[_0xaa5f('0x17')][_0xaa5f('0x18')]({'raw':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'limit':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f[_0xaa5f('0x19')]['limit']||null:null,'include':_0x3d874f[_0xaa5f('0x19')]?_0x3d874f['options'][_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x3d874f['options'][_0xaa5f('0x1d')],function(_0x1032ce){return{'model':db[_0x1032ce['model']],'as':_0x1032ce['as'],'attributes':_0x1032ce[_0xaa5f('0x1c')],'include':_0x1032ce[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1032ce[_0xaa5f('0x1d')],function(_0x1f66c0){return{'model':db[_0x1f66c0[_0xaa5f('0x1f')]],'as':_0x1f66c0['as'],'attributes':_0x1f66c0[_0xaa5f('0x1c')],'include':_0x1f66c0[_0xaa5f('0x1d')]?_['map'](_0x1f66c0[_0xaa5f('0x1d')],function(_0x3a66e8){return{'model':db[_0x3a66e8[_0xaa5f('0x1f')]],'as':_0x3a66e8['as'],'attributes':_0x3a66e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x269209){logger[_0xaa5f('0xc')]('GetTrigger',_0x3d874f);logger[_0xaa5f('0xd')]('GetTrigger',_0x3d874f,JSON['stringify'](_0x269209));_0x1019e8(_0x269209);})[_0xaa5f('0x15')](function(_0x50998f){logger[_0xaa5f('0xf')]('GetTrigger',_0x50998f['message'],_0x3d874f);_0x4f4cd5(_0x22175f['error'](0x1f4,_0x50998f[_0xaa5f('0x12')]));});});};exports['ShowTrigger']=function(_0x310828){var _0xc0bb03=this;return new Promise(function(_0x555876,_0x58f608){return db[_0xaa5f('0x17')]['find']({'raw':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x310828[_0xaa5f('0x19')]?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1b')]||null:null,'attributes':_0x310828['options']?_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1c')]||null:null,'include':_0x310828['options']?_0x310828['options']['include']?_['map'](_0x310828[_0xaa5f('0x19')][_0xaa5f('0x1d')],function(_0x2a6015){return{'model':db[_0x2a6015[_0xaa5f('0x1f')]],'as':_0x2a6015['as'],'attributes':_0x2a6015[_0xaa5f('0x1c')],'include':_0x2a6015[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x2a6015['include'],function(_0x1ab07f){return{'model':db[_0x1ab07f[_0xaa5f('0x1f')]],'as':_0x1ab07f['as'],'attributes':_0x1ab07f[_0xaa5f('0x1c')],'include':_0x1ab07f[_0xaa5f('0x1d')]?_[_0xaa5f('0x1e')](_0x1ab07f[_0xaa5f('0x1d')],function(_0x49442c){return{'model':db[_0x49442c[_0xaa5f('0x1f')]],'as':_0x49442c['as'],'attributes':_0x49442c[_0xaa5f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa5f('0x20')](function(_0x2ac0f8){logger[_0xaa5f('0xc')]('ShowTrigger',_0x310828);logger['debug'](_0xaa5f('0x21'),_0x310828,JSON[_0xaa5f('0xe')](_0x2ac0f8));_0x555876(_0x2ac0f8);})[_0xaa5f('0x15')](function(_0x964105){logger['error'](_0xaa5f('0x21'),_0x964105[_0xaa5f('0x12')],_0x310828);_0x58f608(_0xc0bb03[_0xaa5f('0xf')](0x1f4,_0x964105[_0xaa5f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1dd4d2d..9500ef5 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 _0xf2ca=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','post','create','put','destroy'];(function(_0x35fd9c,_0x1610a2){var _0x5e17dd=function(_0x11ae08){while(--_0x11ae08){_0x35fd9c['push'](_0x35fd9c['shift']());}};_0x5e17dd(++_0x1610a2);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4fd82a,_0x29d9d5){_0x4fd82a=_0x4fd82a-0x0;var _0x21d2a8=_0xf2ca[_0x4fd82a];return _0x21d2a8;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get']('/',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xa')]);router[_0xaf2c('0xb')](_0xaf2c('0xc'),auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id/clone',auth[_0xaf2c('0x9')](),controller['clone']);router[_0xaf2c('0xe')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller['update']);router['delete'](_0xaf2c('0xc'),auth[_0xaf2c('0x9')](),controller[_0xaf2c('0x11')]);module[_0xaf2c('0x12')]=router; \ No newline at end of file +var _0x54ef=['isAuthenticated','post','clone','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','/:id'];(function(_0x34fcdc,_0x2eaa35){var _0x3a0dc2=function(_0x5f28e7){while(--_0x5f28e7){_0x34fcdc['push'](_0x34fcdc['shift']());}};_0x3a0dc2(++_0x2eaa35);}(_0x54ef,0x112));var _0xf54e=function(_0x2e5dc2,_0x2c3c84){_0x2e5dc2=_0x2e5dc2-0x0;var _0x5e2752=_0x54ef[_0x2e5dc2];return _0x5e2752;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var auth=require(_0xf54e('0x5'));var interaction=require(_0xf54e('0x6'));var config=require(_0xf54e('0x7'));var controller=require(_0xf54e('0x8'));router[_0xf54e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf54e('0x9')](_0xf54e('0xa'),auth[_0xf54e('0xb')](),controller['show']);router[_0xf54e('0xc')]('/:id/clone',auth[_0xf54e('0xb')](),controller[_0xf54e('0xd')]);router['post']('/',auth[_0xf54e('0xb')](),controller[_0xf54e('0xe')]);router[_0xf54e('0xf')](_0xf54e('0xa'),auth['isAuthenticated'](),controller[_0xf54e('0x10')]);router[_0xf54e('0x11')](_0xf54e('0xa'),auth[_0xf54e('0xb')](),controller['destroy']);module[_0xf54e('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index fa5695e..c599fc2 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 _0x9574=['all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uas','pai','fingerprint','certificate','passive','actpass','dynamic','BOOLEAN','STRING','name','ENUM','friend','user','peer','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','nonat','update','outgoing','yes','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x50cfc3,_0x526cc6){var _0x5c11ef=function(_0xeaf96a){while(--_0xeaf96a){_0x50cfc3['push'](_0x50cfc3['shift']());}};_0x5c11ef(++_0x526cc6);}(_0x9574,0x77));var _0x4957=function(_0x319d27,_0x11d391){_0x319d27=_0x319d27-0x0;var _0x33f484=_0x9574[_0x319d27];return _0x33f484;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4957('0x0')],'allowNull':![],'unique':_0x4957('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x3'),_0x4957('0x4'),_0x4957('0x5')),'allowNull':![],'defaultValue':_0x4957('0x3')},'context':{'type':Sequelize[_0x4957('0x0')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x4957('0x2')]('ALLOWED_NOT_SCREENED',_0x4957('0x6'),_0x4957('0x7'),'ALLOWED',_0x4957('0x8'),_0x4957('0x9'),_0x4957('0xa'),_0x4957('0xb'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x4957('0x0')]},'secret':{'type':Sequelize[_0x4957('0x0')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x4957('0x0')],'defaultValue':_0x4957('0xc'),'set':function(_0x54f530){this['setDataValue']('transport',_0x54f530?_0x54f530['join'](','):null);},'get':function(){return this[_0x4957('0xd')]('transport')?this['getDataValue'](_0x4957('0xe'))[_0x4957('0xf')](','):null;},'comment':_0x4957('0x10')},'dtmfmode':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x11'),_0x4957('0x12'),_0x4957('0x13'),'inband',_0x4957('0x14')),'defaultValue':_0x4957('0x11')},'directmedia':{'type':Sequelize[_0x4957('0x2')]('yes','no',_0x4957('0x15'),_0x4957('0x16'),_0x4957('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4957('0x0')]},'directmediadeny':{'type':Sequelize[_0x4957('0x0')]},'nat':{'type':Sequelize[_0x4957('0x0')],'defaultValue':'force_rport,comedia','set':function(_0x4be3a1){this[_0x4957('0x19')](_0x4957('0x1a'),_0x4be3a1?_0x4be3a1['join'](','):null);},'get':function(){return this[_0x4957('0xd')]('nat')?this[_0x4957('0xd')](_0x4957('0x1a'))[_0x4957('0xf')](','):null;},'comment':_0x4957('0x1b')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4957('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4957('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4957('0x0')],'defaultValue':_0x4957('0x1c')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4957('0x1d'),'set':function(_0x30710f){this['setDataValue'](_0x4957('0x1e'),_0x30710f?_0x30710f[_0x4957('0x1f')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x4957('0xd')](_0x4957('0x1e'))?this[_0x4957('0xd')](_0x4957('0x1e'))[_0x4957('0xf')](';'):null;},'comment':_0x4957('0x20')},'autoframing':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x4957('0x21'),'set':function(_0x4f938b){this[_0x4957('0x19')]('insecure',_0x4f938b?_0x4f938b['join'](','):null);},'get':function(){return this[_0x4957('0xd')](_0x4957('0x22'))?this['getDataValue'](_0x4957('0x22'))[_0x4957('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x4957('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4957('0x18'),'no',_0x4957('0x23'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x4957('0x18'),'no')},'accountcode':{'type':Sequelize[_0x4957('0x24')](0xb)},'setvar':{'type':Sequelize[_0x4957('0x0')]},'callerid':{'type':Sequelize[_0x4957('0x0')],'defaultValue':_0x4957('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize['ENUM'](_0x4957('0x18'),'no'),'defaultValue':_0x4957('0x18')},'busylevel':{'type':Sequelize[_0x4957('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0x4957('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4957('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0x4957('0x0')]},'template':{'type':Sequelize[_0x4957('0x0')]},'videosupport':{'type':Sequelize[_0x4957('0x2')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4957('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0x4957('0x0')]},'session_timers':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x26'),_0x4957('0x27'),_0x4957('0x28'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x4957('0x24')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x4957('0x29')),'defaultValue':_0x4957('0x29')},'t38pt_usertpsource':{'type':Sequelize[_0x4957('0x0')]},'regexten':{'type':Sequelize[_0x4957('0x0')]},'fromdomain':{'type':Sequelize[_0x4957('0x0')]},'fromuser':{'type':Sequelize[_0x4957('0x0')]},'port':{'type':Sequelize[_0x4957('0x24')](0x5)},'qualify':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no'),'defaultValue':_0x4957('0x18')},'keepalive':{'type':Sequelize[_0x4957('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x4957('0x0')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4957('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no',_0x4957('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4957('0x0')]},'callbackextension':{'type':Sequelize[_0x4957('0x0')]},'timert1':{'type':Sequelize[_0x4957('0x24')](0xb)},'timerb':{'type':Sequelize[_0x4957('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x4957('0x0')]},'contactdeny':{'type':Sequelize[_0x4957('0x0')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x4957('0x0')]},'use_q850_reason':{'type':Sequelize[_0x4957('0x0')]},'maxforwards':{'type':Sequelize[_0x4957('0x24')](0xb)},'encryption':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no')},'force_avp':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no')},'icesupport':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x4957('0x18'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x4957('0x18'),'no',_0x4957('0x2b'),_0x4957('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x4957('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4957('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0x4957('0x0')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x4957('0x0')]},'dtlscapath':{'type':Sequelize[_0x4957('0x0')]},'dtlssetup':{'type':Sequelize[_0x4957('0x2')]('active',_0x4957('0x2d'),_0x4957('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4957('0x0')]},'usereqphone':{'type':Sequelize['ENUM'](_0x4957('0x18'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x4957('0x0')]},'call_limit':{'type':Sequelize[_0x4957('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0x4957('0x2')](_0x4957('0x18'),'no')},'vmexten':{'type':Sequelize[_0x4957('0x0')]},'mohinterpret':{'type':Sequelize[_0x4957('0x0')]},'mohsuggest':{'type':Sequelize[_0x4957('0x0')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4957('0x0')]},'host':{'type':Sequelize[_0x4957('0x0')],'defaultValue':_0x4957('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x4957('0x18'),'no',_0x4957('0x15'),_0x4957('0x16'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4957('0x0')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4957('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4957('0x0')],'defaultValue':'no'}}; \ No newline at end of file +var _0xebf4=['yes','port,invite','insecure','always','INTEGER','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','update','outgoing','setDataValue','nat','getDataValue','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'];(function(_0x23810a,_0x56ef3a){var _0x542a7e=function(_0x2cbaae){while(--_0x2cbaae){_0x23810a['push'](_0x23810a['shift']());}};_0x542a7e(++_0x56ef3a);}(_0xebf4,0x75));var _0x4ebf=function(_0x33fafb,_0xeae69e){_0x33fafb=_0x33fafb-0x0;var _0x3926cc=_0xebf4[_0x33fafb];return _0x3926cc;};'use strict';var Sequelize=require('sequelize');module[_0x4ebf('0x0')]={'name':{'type':Sequelize[_0x4ebf('0x1')],'allowNull':![],'unique':_0x4ebf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x4'),_0x4ebf('0x5'),_0x4ebf('0x6')),'allowNull':![],'defaultValue':_0x4ebf('0x4')},'context':{'type':Sequelize[_0x4ebf('0x1')],'allowNull':![],'defaultValue':_0x4ebf('0x7')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x4ebf('0x8'),_0x4ebf('0x9'),_0x4ebf('0xa'),_0x4ebf('0xb'),'PROHIB_PASSED_SCREEN',_0x4ebf('0xc'),_0x4ebf('0xd'))},'deny':{'type':Sequelize[_0x4ebf('0x1')]},'permit':{'type':Sequelize[_0x4ebf('0x1')]},'secret':{'type':Sequelize[_0x4ebf('0x1')]},'md5secret':{'type':Sequelize[_0x4ebf('0x1')]},'remotesecret':{'type':Sequelize[_0x4ebf('0x1')]},'transport':{'type':Sequelize[_0x4ebf('0x1')],'defaultValue':'udp','set':function(_0x4f3081){this['setDataValue'](_0x4ebf('0xe'),_0x4f3081?_0x4f3081[_0x4ebf('0xf')](','):null);},'get':function(){return this['getDataValue']('transport')?this['getDataValue'](_0x4ebf('0xe'))[_0x4ebf('0x10')](','):null;},'comment':_0x4ebf('0x11')},'dtmfmode':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x12'),_0x4ebf('0x13'),_0x4ebf('0x14'),_0x4ebf('0x15'),_0x4ebf('0x16')),'defaultValue':_0x4ebf('0x12')},'directmedia':{'type':Sequelize[_0x4ebf('0x3')]('yes','no',_0x4ebf('0x17'),_0x4ebf('0x18'),_0x4ebf('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4ebf('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4ebf('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x4ebf('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x1470ff){this[_0x4ebf('0x1a')](_0x4ebf('0x1b'),_0x1470ff?_0x1470ff['join'](','):null);},'get':function(){return this[_0x4ebf('0x1c')](_0x4ebf('0x1b'))?this[_0x4ebf('0x1c')](_0x4ebf('0x1b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x4ebf('0x1')]},'namedcallgroup':{'type':Sequelize[_0x4ebf('0x1')]},'pickupgroup':{'type':Sequelize[_0x4ebf('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x4ebf('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4ebf('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4ebf('0x1')],'defaultValue':_0x4ebf('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4ebf('0x1e'),'set':function(_0x5e25f6){this[_0x4ebf('0x1a')](_0x4ebf('0x1f'),_0x5e25f6?_0x5e25f6[_0x4ebf('0xf')](';'):_0x4ebf('0x1e'));},'get':function(){return this[_0x4ebf('0x1c')](_0x4ebf('0x1f'))?this['getDataValue'](_0x4ebf('0x1f'))[_0x4ebf('0x10')](';'):null;},'comment':_0x4ebf('0x20')},'autoframing':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no')},'insecure':{'type':Sequelize[_0x4ebf('0x1')],'defaultValue':_0x4ebf('0x22'),'set':function(_0x46469d){this[_0x4ebf('0x1a')](_0x4ebf('0x23'),_0x46469d?_0x46469d[_0x4ebf('0xf')](','):null);},'get':function(){return this[_0x4ebf('0x1c')]('insecure')?this['getDataValue'](_0x4ebf('0x23'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x4ebf('0x21'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no','never')},'promiscredir':{'type':Sequelize[_0x4ebf('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x4ebf('0x1')]},'callerid':{'type':Sequelize[_0x4ebf('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x4ebf('0x1')]},'callcounter':{'type':Sequelize[_0x4ebf('0x3')]('yes','no'),'defaultValue':_0x4ebf('0x21')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4ebf('0x21'),'no')},'allowtransfer':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no')},'ignoresdpversion':{'type':Sequelize[_0x4ebf('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x4ebf('0x1')]},'template':{'type':Sequelize[_0x4ebf('0x1')]},'videosupport':{'type':Sequelize[_0x4ebf('0x3')]('yes','no',_0x4ebf('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x4ebf('0x21'),'no')},'mailbox':{'type':Sequelize[_0x4ebf('0x1')]},'session_timers':{'type':Sequelize[_0x4ebf('0x3')]('accept',_0x4ebf('0x26'),'originate')},'session_expires':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x27'),_0x4ebf('0x28')),'defaultValue':_0x4ebf('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x4ebf('0x1')]},'regexten':{'type':Sequelize[_0x4ebf('0x1')]},'fromdomain':{'type':Sequelize[_0x4ebf('0x1')]},'fromuser':{'type':Sequelize[_0x4ebf('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x4ebf('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no',_0x4ebf('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x4ebf('0x1')]},'timert1':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'timerb':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x4ebf('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x4ebf('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x4ebf('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'encryption':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x4ebf('0x21'),'no')},'force_avp':{'type':Sequelize[_0x4ebf('0x3')]('yes','no')},'icesupport':{'type':Sequelize['ENUM'](_0x4ebf('0x21'),'no')},'dtlsenable':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x21'),'no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x4ebf('0x2a'),_0x4ebf('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x4ebf('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4ebf('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x4ebf('0x1')]},'dtlscipher':{'type':Sequelize[_0x4ebf('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x4ebf('0x1')]},'dtlssetup':{'type':Sequelize[_0x4ebf('0x3')](_0x4ebf('0x2c'),_0x4ebf('0x2d'),_0x4ebf('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4ebf('0x1')]},'usereqphone':{'type':Sequelize[_0x4ebf('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x4ebf('0x21'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x4ebf('0x21'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x4ebf('0x1')]},'mohsuggest':{'type':Sequelize[_0x4ebf('0x1')]},'parkinglot':{'type':Sequelize[_0x4ebf('0x1')]},'description':{'type':Sequelize[_0x4ebf('0x1')]},'host':{'type':Sequelize[_0x4ebf('0x1')],'defaultValue':_0x4ebf('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x4ebf('0x21'),'no','nonat',_0x4ebf('0x18'),_0x4ebf('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4ebf('0x1')]},'otherFields':{'type':Sequelize[_0x4ebf('0x1')]},'active':{'type':Sequelize[_0x4ebf('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4ebf('0x1')],'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 330686a..67a0fa6 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 _0x6228=['api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','info','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Trunks','UserProfileResource','end','stack','name','send','index','map','Trunk','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','catch','params','keys','include','merge','find','clone','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','server/files/templates/trunk.ejs','utf8','readFileSync','join','root','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','autoAssociation','server/files/templates/registry.ejs','writeFileSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x2972cf,_0x343fde){var _0x4c173f=function(_0x30eb3a){while(--_0x30eb3a){_0x2972cf['push'](_0x2972cf['shift']());}};_0x4c173f(++_0x343fde);}(_0x6228,0xcf));var _0x8622=function(_0x439d05,_0x15c424){_0x439d05=_0x439d05-0x0;var _0x51f24f=_0x6228[_0x439d05];return _0x51f24f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8622('0x0'));var rimraf=require(_0x8622('0x1'));var zipdir=require(_0x8622('0x2'));var jsonpatch=require(_0x8622('0x3'));var rp=require(_0x8622('0x4'));var moment=require(_0x8622('0x5'));var BPromise=require(_0x8622('0x6'));var Mustache=require(_0x8622('0x7'));var util=require('util');var path=require(_0x8622('0x8'));var sox=require(_0x8622('0x9'));var csv=require(_0x8622('0xa'));var ejs=require(_0x8622('0xb'));var fs=require('fs');var _=require(_0x8622('0xc'));var squel=require(_0x8622('0xd'));var crypto=require(_0x8622('0xe'));var jsforce=require(_0x8622('0xf'));var deskjs=require(_0x8622('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8622('0x11'));var Papa=require(_0x8622('0x12'));var Redis=require(_0x8622('0x13'));var authService=require(_0x8622('0x14'));var qs=require(_0x8622('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8622('0x16'))(_0x8622('0x17'));var utils=require(_0x8622('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8622('0x19'));var db=require(_0x8622('0x1a'))['db'];var jayson=require(_0x8622('0x1b'));var client=jayson[_0x8622('0x1c')][_0x8622('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x21d61a,_0x1c2fb9,_0x9d4d1,_0x3d8313){return new BPromise(function(_0x280cd8,_0x41772b){var _0xa8f81a=_0x3d8313||client;return _0xa8f81a[_0x8622('0x1e')](_0x21d61a,_0x9d4d1)['then'](function(_0x5a392d){logger['info'](_0x8622('0x1f'),_0x1c2fb9,_0x8622('0x20'));logger['debug'](_0x8622('0x21'),_0x1c2fb9,_0x8622('0x20'),JSON['stringify'](_0x5a392d));if(_0x5a392d['error']){if(_0x5a392d[_0x8622('0x22')][_0x8622('0x23')]===0x1f4){logger[_0x8622('0x22')](_0x8622('0x1f'),_0x1c2fb9,_0x5a392d[_0x8622('0x22')][_0x8622('0x24')]);return _0x41772b(_0x5a392d[_0x8622('0x22')]['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x1c2fb9,_0x5a392d[_0x8622('0x22')][_0x8622('0x24')]);return _0x280cd8(_0x5a392d[_0x8622('0x22')]['message']);}else{logger[_0x8622('0x25')](_0x8622('0x1f'),_0x1c2fb9,_0x8622('0x20'));_0x280cd8(_0x5a392d['result']['message']);}})['catch'](function(_0x3dd483){logger['error']('Trunk,\x20%s,\x20%s',_0x1c2fb9,_0x3dd483);_0x41772b(_0x3dd483);});});}function respondWithStatusCode(_0x1d2a40,_0x168a95){_0x168a95=_0x168a95||0xcc;return function(_0x5e831a){if(_0x5e831a){return _0x1d2a40[_0x8622('0x26')](_0x168a95);}return _0x1d2a40['status'](_0x168a95)['end']();};}function respondWithResult(_0x3d2f38,_0x15a8cc){_0x15a8cc=_0x15a8cc||0xc8;return function(_0x535cbe){if(_0x535cbe){return _0x3d2f38[_0x8622('0x27')](_0x15a8cc)[_0x8622('0x28')](_0x535cbe);}};}function respondWithFilteredResult(_0x31dc65,_0x536adf){return function(_0x60b48b){if(_0x60b48b){var _0x51bc0d=_0x60b48b['count'],_0x1efe86=_0x536adf[_0x8622('0x29')],_0x4dc348=_0x536adf['offset']+_0x536adf[_0x8622('0x2a')],_0xb18f57;if(_0x4dc348>=_0x51bc0d){_0x4dc348=_0x51bc0d;_0xb18f57=0xc8;}else{_0xb18f57=0xce;}_0x31dc65[_0x8622('0x27')](_0xb18f57);return _0x31dc65[_0x8622('0x2b')](_0x8622('0x2c'),_0x1efe86+'-'+_0x4dc348+'/'+_0x51bc0d)[_0x8622('0x28')](_0x60b48b);}return null;};}function patchUpdates(_0x506e56){return function(_0x5dab32){try{jsonpatch[_0x8622('0x2d')](_0x5dab32,_0x506e56,!![]);}catch(_0x4a88b8){return BPromise[_0x8622('0x2e')](_0x4a88b8);}return _0x5dab32[_0x8622('0x2f')]();};}function saveUpdates(_0x1f0429,_0x35cf21){return function(_0xa1d09c){if(_0xa1d09c){return _0xa1d09c[_0x8622('0x30')](_0x1f0429)['then'](function(_0x1456ca){return _0x1456ca;});}return null;};}function removeEntity(_0xb693de,_0x242586){return function(_0x1a90a6){if(_0x1a90a6){return _0x1a90a6[_0x8622('0x31')]()[_0x8622('0x32')](function(){var _0x3322ae=_0x1a90a6[_0x8622('0x33')]({'plain':!![]});var _0x418263=_0x8622('0x34');return db[_0x8622('0x35')][_0x8622('0x31')]({'where':{'type':_0x418263,'resourceId':_0x3322ae['id']}})['then'](function(){return _0x1a90a6;});})[_0x8622('0x32')](function(){_0xb693de[_0x8622('0x27')](0xcc)[_0x8622('0x36')]();});}};}function handleEntityNotFound(_0x12d9b6,_0x53522a){return function(_0x4be3ae){if(!_0x4be3ae){_0x12d9b6[_0x8622('0x26')](0x194);}return _0x4be3ae;};}function handleError(_0x546055,_0x58e1bc){_0x58e1bc=_0x58e1bc||0x1f4;return function(_0x497ac4){logger[_0x8622('0x22')](_0x497ac4[_0x8622('0x37')]);if(_0x497ac4[_0x8622('0x38')]){delete _0x497ac4[_0x8622('0x38')];}_0x546055[_0x8622('0x27')](_0x58e1bc)[_0x8622('0x39')](_0x497ac4);};}exports[_0x8622('0x3a')]=function(_0x342adf,_0x3d8835){var _0x293fe6={},_0x590621={},_0x5121f1={'count':0x0,'rows':[]};var _0x347664=_[_0x8622('0x3b')](db[_0x8622('0x3c')][_0x8622('0x3d')],function(_0x17dd6d){return{'name':_0x17dd6d[_0x8622('0x3e')],'type':_0x17dd6d['type'][_0x8622('0x3f')]};});_0x590621['model']=_[_0x8622('0x3b')](_0x347664,_0x8622('0x38'));_0x590621[_0x8622('0x40')]=_['keys'](_0x342adf[_0x8622('0x40')]);_0x590621[_0x8622('0x41')]=_[_0x8622('0x42')](_0x590621['model'],_0x590621[_0x8622('0x40')]);_0x293fe6[_0x8622('0x43')]=_[_0x8622('0x42')](_0x590621[_0x8622('0x44')],qs['fields'](_0x342adf[_0x8622('0x40')][_0x8622('0x45')]));_0x293fe6['attributes']=_0x293fe6['attributes'][_0x8622('0x46')]?_0x293fe6[_0x8622('0x43')]:_0x590621['model'];if(!_0x342adf['query'][_0x8622('0x47')](_0x8622('0x48'))){_0x293fe6[_0x8622('0x2a')]=qs[_0x8622('0x2a')](_0x342adf['query'][_0x8622('0x2a')]);_0x293fe6['offset']=qs['offset'](_0x342adf[_0x8622('0x40')]['offset']);}_0x293fe6[_0x8622('0x49')]=qs['sort'](_0x342adf[_0x8622('0x40')][_0x8622('0x4a')]);_0x293fe6[_0x8622('0x4b')]=qs[_0x8622('0x41')](_[_0x8622('0x4c')](_0x342adf[_0x8622('0x40')],_0x590621[_0x8622('0x41')]),_0x347664);if(_0x342adf[_0x8622('0x40')][_0x8622('0x4d')]){_0x293fe6[_0x8622('0x4b')]=_['merge'](_0x293fe6[_0x8622('0x4b')],{'$or':_[_0x8622('0x3b')](_0x347664,function(_0x2ad754){if(_0x2ad754['type']!==_0x8622('0x4e')){var _0x39efdd={};_0x39efdd[_0x2ad754[_0x8622('0x38')]]={'$like':'%'+_0x342adf[_0x8622('0x40')]['filter']+'%'};return _0x39efdd;}})});}_0x293fe6=_['merge']({},_0x293fe6,_0x342adf[_0x8622('0x4f')]);var _0x356b7e={'where':_0x293fe6[_0x8622('0x4b')]};return db[_0x8622('0x3c')][_0x8622('0x50')](_0x356b7e)[_0x8622('0x32')](function(_0x37c894){_0x5121f1[_0x8622('0x50')]=_0x37c894;if(_0x342adf[_0x8622('0x40')][_0x8622('0x51')]){_0x293fe6['include']=[{'all':!![]}];}return db[_0x8622('0x3c')]['findAll'](_0x293fe6);})[_0x8622('0x32')](function(_0x28d033){_0x5121f1['rows']=_0x28d033;return _0x5121f1;})[_0x8622('0x32')](respondWithFilteredResult(_0x3d8835,_0x293fe6))[_0x8622('0x52')](handleError(_0x3d8835,null));};exports['show']=function(_0x5bdd8f,_0x419d47){var _0x287441={'raw':![],'where':{'id':_0x5bdd8f[_0x8622('0x53')]['id']}},_0x3fd8ca={};_0x3fd8ca[_0x8622('0x44')]=_[_0x8622('0x54')](db[_0x8622('0x3c')]['rawAttributes']);_0x3fd8ca[_0x8622('0x40')]=_[_0x8622('0x54')](_0x5bdd8f[_0x8622('0x40')]);_0x3fd8ca['filters']=_[_0x8622('0x42')](_0x3fd8ca[_0x8622('0x44')],_0x3fd8ca[_0x8622('0x40')]);_0x287441[_0x8622('0x43')]=_[_0x8622('0x42')](_0x3fd8ca[_0x8622('0x44')],qs['fields'](_0x5bdd8f[_0x8622('0x40')][_0x8622('0x45')]));_0x287441['attributes']=_0x287441[_0x8622('0x43')][_0x8622('0x46')]?_0x287441[_0x8622('0x43')]:_0x3fd8ca[_0x8622('0x44')];if(_0x5bdd8f[_0x8622('0x40')][_0x8622('0x51')]){_0x287441[_0x8622('0x55')]=[{'all':!![]}];}_0x287441=_[_0x8622('0x56')]({},_0x287441,_0x5bdd8f[_0x8622('0x4f')]);return db[_0x8622('0x3c')][_0x8622('0x57')](_0x287441)[_0x8622('0x32')](handleEntityNotFound(_0x419d47,null))[_0x8622('0x32')](respondWithResult(_0x419d47,null))[_0x8622('0x52')](handleError(_0x419d47,null));};exports[_0x8622('0x58')]=function(_0xae0201,_0x3edd3b){var _0x18161c={'where':{'id':_0xae0201[_0x8622('0x53')]['id']}},_0x466a03={};_0x466a03[_0x8622('0x44')]=_[_0x8622('0x54')](db['Trunk'][_0x8622('0x3d')]);_0x18161c[_0x8622('0x43')]=_[_0x8622('0x42')](_0x466a03[_0x8622('0x44')],qs[_0x8622('0x45')](_0xae0201[_0x8622('0x40')]['fields']));_0x18161c['attributes']=_0x18161c[_0x8622('0x43')][_0x8622('0x46')]?_0x18161c[_0x8622('0x43')]:_0x466a03[_0x8622('0x44')];if(_0xae0201['query']['includeAll']){_0x18161c[_0x8622('0x55')]=[{'all':!![]}];}_0x18161c=_['merge']({},_0x18161c,_0xae0201[_0x8622('0x4f')]);return db[_0x8622('0x3c')]['find'](_0x18161c)['then'](handleEntityNotFound(_0x3edd3b,null))[_0x8622('0x32')](function(_0x4da88d){if(_0x4da88d){var _0x2b3599=_0x4da88d[_0x8622('0x33')]({'plain':!![]});_0x2b3599=qs[_0x8622('0x59')](_0x2b3599,['id',_0x8622('0x5a'),'updatedAt']);_0xae0201['body']=_['omit'](_0xae0201['body'],['id','createdAt',_0x8622('0x5b')]);return db['Trunk'][_0x8622('0x5c')](_['merge'](_0x2b3599,_0xae0201[_0x8622('0x5d')]),{'include':_0xae0201[_0x8622('0x40')][_0x8622('0x51')]?[{'all':!![]}]:undefined})[_0x8622('0x32')](function(_0x6da9ce){var _0x4c6588=_0xae0201[_0x8622('0x5e')][_0x8622('0x33')]({'plain':!![]});if(!_0x4c6588)throw new Error(_0x8622('0x5f'));if(_0x4c6588[_0x8622('0x60')]===_0x8622('0x5e')){var _0x19e765=_0x6da9ce[_0x8622('0x33')]({'plain':!![]});var _0x5812b2=_0x8622('0x34');return db['UserProfileSection'][_0x8622('0x57')]({'where':{'name':_0x5812b2,'userProfileId':_0x4c6588[_0x8622('0x61')]},'raw':!![]})[_0x8622('0x32')](function(_0x3e23ca){if(_0x3e23ca&&_0x3e23ca['autoAssociation']===0x0){return db[_0x8622('0x35')][_0x8622('0x5c')]({'name':_0x19e765[_0x8622('0x38')],'resourceId':_0x19e765['id'],'type':_0x3e23ca[_0x8622('0x38')],'sectionId':_0x3e23ca['id']},{})[_0x8622('0x32')](function(){return _0x6da9ce;});}else{return _0x6da9ce;}})[_0x8622('0x52')](function(_0x2b6902){logger[_0x8622('0x22')](_0x8622('0x62'),_0x2b6902);throw _0x2b6902;});}return _0x6da9ce;});}})[_0x8622('0x32')](respondWithResult(_0x3edd3b,0xc9))['catch'](handleError(_0x3edd3b,null));};exports[_0x8622('0x5c')]=function(_0xad829b,_0x17b085,_0x3d9d90){var _0x24ab17;return db['Trunk'][_0x8622('0x5c')](_0xad829b[_0x8622('0x5d')],{'raw':!![]})['then'](function(_0x45fd7a){_0x24ab17=_0x45fd7a;return db[_0x8622('0x3c')][_0x8622('0x63')]({'raw':!![]});})['then'](function(_0x1961ee){var _0x173ad4=fs['readFileSync'](path['join'](config['root'],_0x8622('0x64')),_0x8622('0x65'));var _0x5cae5e=fs[_0x8622('0x66')](path[_0x8622('0x67')](config[_0x8622('0x68')],'server/files/templates/registry.ejs'),_0x8622('0x65'));var _0x24ca20=ejs[_0x8622('0x69')](_0x173ad4,{'trunks':_0x1961ee||[]});fs['writeFileSync'](_0x8622('0x6a'),_0x24ca20);if(_0x24ab17[_0x8622('0x6b')]){var _0x5667fd=ejs['render'](_0x5cae5e,{'trunks':_0x1961ee||[]});fs['writeFileSync'](_0x8622('0x6c'),_0x5667fd);}})[_0x8622('0x32')](function(){return respondWithRpcPromise(_0x8622('0x6d'),_0x8622('0x5c'),{'module':_0x8622('0x6e')});})[_0x8622('0x32')](function(){var _0xf9c3fa=_0xad829b['user'][_0x8622('0x33')]({'plain':!![]});if(!_0xf9c3fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf9c3fa[_0x8622('0x60')]===_0x8622('0x5e')){var _0x35eb37=_0x24ab17['get']({'plain':!![]});return db[_0x8622('0x6f')]['find']({'where':{'name':_0x8622('0x34'),'userProfileId':_0xf9c3fa[_0x8622('0x61')]},'raw':!![]})[_0x8622('0x32')](function(_0x310533){if(_0x310533&&_0x310533[_0x8622('0x70')]===0x0){return db[_0x8622('0x35')][_0x8622('0x5c')]({'name':_0x35eb37[_0x8622('0x38')],'resourceId':_0x35eb37['id'],'type':_0x310533[_0x8622('0x38')],'sectionId':_0x310533['id']},{})[_0x8622('0x32')](function(){return _0x24ab17;});}else{return _0x24ab17;}})[_0x8622('0x52')](function(_0x2a1241){logger['error'](_0x8622('0x62'),_0x2a1241);throw _0x2a1241;});}return _0x24ab17;})[_0x8622('0x32')](respondWithResult(_0x17b085,0xc9))['catch'](handleError(_0x17b085,null));};exports[_0x8622('0x30')]=function(_0x4f9465,_0x382eb4,_0x53d250){var _0x2c9dc6;return db['Trunk'][_0x8622('0x57')]({'where':{'id':_0x4f9465[_0x8622('0x53')]['id']}})['then'](handleEntityNotFound(_0x382eb4,null))[_0x8622('0x32')](saveUpdates(_0x4f9465[_0x8622('0x5d')],null))[_0x8622('0x32')](function(_0x117e8d){if(_0x117e8d){_0x2c9dc6=_0x117e8d;return db[_0x8622('0x3c')][_0x8622('0x63')]({'raw':!![]});}})[_0x8622('0x32')](function(_0x5c9e0c){if(_0x5c9e0c){var _0x2aacac=fs[_0x8622('0x66')](path[_0x8622('0x67')](config[_0x8622('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x5baa4f=fs[_0x8622('0x66')](path[_0x8622('0x67')](config[_0x8622('0x68')],_0x8622('0x71')),_0x8622('0x65'));var _0x185083=ejs[_0x8622('0x69')](_0x2aacac,{'trunks':_0x5c9e0c||[]});fs[_0x8622('0x72')](_0x8622('0x6a'),_0x185083);var _0x59d5c1=ejs['render'](_0x5baa4f,{'trunks':_0x5c9e0c||[]});fs[_0x8622('0x72')](_0x8622('0x6c'),_0x59d5c1);return respondWithRpcPromise(_0x8622('0x6d'),'update',{'module':'chan_sip.so'});}return null;})[_0x8622('0x32')](function(_0x2e0786){if(_0x2e0786){return _0x2c9dc6;}})[_0x8622('0x32')](respondWithResult(_0x382eb4,null))[_0x8622('0x52')](handleError(_0x382eb4,null));};exports[_0x8622('0x31')]=function(_0x193dda,_0x4dce6e,_0x5100ae){var _0x5a79d5;return db[_0x8622('0x3c')][_0x8622('0x57')]({'where':{'id':_0x193dda[_0x8622('0x53')]['id']}})[_0x8622('0x32')](handleEntityNotFound(_0x4dce6e,null))[_0x8622('0x32')](removeEntity(_0x4dce6e,null))['then'](function(){return db[_0x8622('0x3c')][_0x8622('0x63')]({'raw':!![]});})[_0x8622('0x32')](function(_0x5aaf29){var _0x376b74=fs[_0x8622('0x66')](path[_0x8622('0x67')](config['root'],_0x8622('0x64')),_0x8622('0x65'));var _0x8f7a9=fs[_0x8622('0x66')](path[_0x8622('0x67')](config['root'],_0x8622('0x71')),'utf8');var _0x36407d=ejs[_0x8622('0x69')](_0x376b74,{'trunks':_0x5aaf29});var _0x70f73e=ejs[_0x8622('0x69')](_0x8f7a9,{'trunks':_0x5aaf29});fs['writeFileSync'](_0x8622('0x6a'),_0x36407d);fs[_0x8622('0x72')](_0x8622('0x6c'),_0x70f73e);return respondWithRpcPromise('Reload',_0x8622('0x31'),{'module':'chan_sip.so'});})[_0x8622('0x52')](handleError(_0x4dce6e,null));}; \ No newline at end of file +var _0x5f25=['save','update','then','get','Trunks','UserProfileResource','destroy','stack','index','Trunk','rawAttributes','fieldName','type','key','model','map','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','clone','createdAt','updatedAt','omit','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','autoAssociation','readFileSync','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','request','Trunk,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject'];(function(_0x23f837,_0x2ce071){var _0xf6df8e=function(_0x34883c){while(--_0x34883c){_0x23f837['push'](_0x23f837['shift']());}};_0xf6df8e(++_0x2ce071);}(_0x5f25,0xb4));var _0x55f2=function(_0x161ac3,_0x142e49){_0x161ac3=_0x161ac3-0x0;var _0x3bb837=_0x5f25[_0x161ac3];return _0x3bb837;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x55f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x55f2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x55f2('0x2'));var BPromise=require(_0x55f2('0x3'));var Mustache=require(_0x55f2('0x4'));var util=require(_0x55f2('0x5'));var path=require(_0x55f2('0x6'));var sox=require(_0x55f2('0x7'));var csv=require(_0x55f2('0x8'));var ejs=require(_0x55f2('0x9'));var fs=require('fs');var _=require(_0x55f2('0xa'));var squel=require(_0x55f2('0xb'));var crypto=require(_0x55f2('0xc'));var jsforce=require(_0x55f2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x55f2('0x8'));var querystring=require(_0x55f2('0xe'));var Papa=require(_0x55f2('0xf'));var Redis=require(_0x55f2('0x10'));var authService=require(_0x55f2('0x11'));var qs=require(_0x55f2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x55f2('0x13'));var logger=require(_0x55f2('0x14'))(_0x55f2('0x15'));var utils=require(_0x55f2('0x16'));var config=require(_0x55f2('0x17'));var licenseUtil=require(_0x55f2('0x18'));var db=require(_0x55f2('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x437aeb,_0x37c1a8,_0x1bf48e,_0x489ed6){return new BPromise(function(_0xbdcb0d,_0x2352dd){var _0x3ab5fd=_0x489ed6||client;return _0x3ab5fd[_0x55f2('0x1a')](_0x437aeb,_0x1bf48e)['then'](function(_0x247b6c){logger['info'](_0x55f2('0x1b'),_0x37c1a8,_0x55f2('0x1c'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x37c1a8,'request\x20sent',JSON[_0x55f2('0x1d')](_0x247b6c));if(_0x247b6c['error']){if(_0x247b6c['error'][_0x55f2('0x1e')]===0x1f4){logger[_0x55f2('0x1f')]('Trunk,\x20%s,\x20%s',_0x37c1a8,_0x247b6c['error'][_0x55f2('0x20')]);return _0x2352dd(_0x247b6c[_0x55f2('0x1f')][_0x55f2('0x20')]);}logger[_0x55f2('0x1f')](_0x55f2('0x1b'),_0x37c1a8,_0x247b6c['error'][_0x55f2('0x20')]);return _0xbdcb0d(_0x247b6c[_0x55f2('0x1f')]['message']);}else{logger[_0x55f2('0x21')](_0x55f2('0x1b'),_0x37c1a8,_0x55f2('0x1c'));_0xbdcb0d(_0x247b6c[_0x55f2('0x22')]['message']);}})[_0x55f2('0x23')](function(_0x192e9b){logger[_0x55f2('0x1f')](_0x55f2('0x1b'),_0x37c1a8,_0x192e9b);_0x2352dd(_0x192e9b);});});}function respondWithStatusCode(_0x55f5cf,_0x59f5e5){_0x59f5e5=_0x59f5e5||0xcc;return function(_0x5167f9){if(_0x5167f9){return _0x55f5cf[_0x55f2('0x24')](_0x59f5e5);}return _0x55f5cf[_0x55f2('0x25')](_0x59f5e5)[_0x55f2('0x26')]();};}function respondWithResult(_0x559d0b,_0x2484b8){_0x2484b8=_0x2484b8||0xc8;return function(_0x164484){if(_0x164484){return _0x559d0b[_0x55f2('0x25')](_0x2484b8)[_0x55f2('0x27')](_0x164484);}};}function respondWithFilteredResult(_0xe496b0,_0x4137a6){return function(_0x2bb3e4){if(_0x2bb3e4){var _0x45db2e=_0x2bb3e4[_0x55f2('0x28')],_0x187f46=_0x4137a6[_0x55f2('0x29')],_0x33a72a=_0x4137a6['offset']+_0x4137a6['limit'],_0x152097;if(_0x33a72a>=_0x45db2e){_0x33a72a=_0x45db2e;_0x152097=0xc8;}else{_0x152097=0xce;}_0xe496b0['status'](_0x152097);return _0xe496b0[_0x55f2('0x2a')](_0x55f2('0x2b'),_0x187f46+'-'+_0x33a72a+'/'+_0x45db2e)[_0x55f2('0x27')](_0x2bb3e4);}return null;};}function patchUpdates(_0x3d2aec){return function(_0x46ca47){try{jsonpatch[_0x55f2('0x2c')](_0x46ca47,_0x3d2aec,!![]);}catch(_0x20becb){return BPromise[_0x55f2('0x2d')](_0x20becb);}return _0x46ca47[_0x55f2('0x2e')]();};}function saveUpdates(_0x10101c,_0x51e3a0){return function(_0x340dbc){if(_0x340dbc){return _0x340dbc[_0x55f2('0x2f')](_0x10101c)[_0x55f2('0x30')](function(_0x34846b){return _0x34846b;});}return null;};}function removeEntity(_0xee6a9,_0x37159a){return function(_0x37ca14){if(_0x37ca14){return _0x37ca14['destroy']()[_0x55f2('0x30')](function(){var _0x450d21=_0x37ca14[_0x55f2('0x31')]({'plain':!![]});var _0x2adf48=_0x55f2('0x32');return db[_0x55f2('0x33')][_0x55f2('0x34')]({'where':{'type':_0x2adf48,'resourceId':_0x450d21['id']}})[_0x55f2('0x30')](function(){return _0x37ca14;});})[_0x55f2('0x30')](function(){_0xee6a9[_0x55f2('0x25')](0xcc)[_0x55f2('0x26')]();});}};}function handleEntityNotFound(_0x5eda7b,_0x512401){return function(_0xb59052){if(!_0xb59052){_0x5eda7b['sendStatus'](0x194);}return _0xb59052;};}function handleError(_0x36fe3,_0x2eed0c){_0x2eed0c=_0x2eed0c||0x1f4;return function(_0x24a736){logger['error'](_0x24a736[_0x55f2('0x35')]);if(_0x24a736['name']){delete _0x24a736['name'];}_0x36fe3[_0x55f2('0x25')](_0x2eed0c)['send'](_0x24a736);};}exports[_0x55f2('0x36')]=function(_0x1e95c4,_0x184ef){var _0xa62e9a={},_0x47420a={},_0x4f2e1e={'count':0x0,'rows':[]};var _0x5bb32e=_['map'](db[_0x55f2('0x37')][_0x55f2('0x38')],function(_0x8a4064){return{'name':_0x8a4064[_0x55f2('0x39')],'type':_0x8a4064[_0x55f2('0x3a')][_0x55f2('0x3b')]};});_0x47420a[_0x55f2('0x3c')]=_[_0x55f2('0x3d')](_0x5bb32e,_0x55f2('0x3e'));_0x47420a[_0x55f2('0x3f')]=_[_0x55f2('0x40')](_0x1e95c4[_0x55f2('0x3f')]);_0x47420a['filters']=_['intersection'](_0x47420a[_0x55f2('0x3c')],_0x47420a[_0x55f2('0x3f')]);_0xa62e9a[_0x55f2('0x41')]=_[_0x55f2('0x42')](_0x47420a[_0x55f2('0x3c')],qs[_0x55f2('0x43')](_0x1e95c4[_0x55f2('0x3f')][_0x55f2('0x43')]));_0xa62e9a[_0x55f2('0x41')]=_0xa62e9a[_0x55f2('0x41')][_0x55f2('0x44')]?_0xa62e9a['attributes']:_0x47420a[_0x55f2('0x3c')];if(!_0x1e95c4[_0x55f2('0x3f')][_0x55f2('0x45')]('nolimit')){_0xa62e9a[_0x55f2('0x46')]=qs[_0x55f2('0x46')](_0x1e95c4['query'][_0x55f2('0x46')]);_0xa62e9a[_0x55f2('0x29')]=qs[_0x55f2('0x29')](_0x1e95c4[_0x55f2('0x3f')][_0x55f2('0x29')]);}_0xa62e9a[_0x55f2('0x47')]=qs[_0x55f2('0x48')](_0x1e95c4[_0x55f2('0x3f')]['sort']);_0xa62e9a[_0x55f2('0x49')]=qs['filters'](_[_0x55f2('0x4a')](_0x1e95c4[_0x55f2('0x3f')],_0x47420a[_0x55f2('0x4b')]),_0x5bb32e);if(_0x1e95c4[_0x55f2('0x3f')][_0x55f2('0x4c')]){_0xa62e9a[_0x55f2('0x49')]=_[_0x55f2('0x4d')](_0xa62e9a[_0x55f2('0x49')],{'$or':_[_0x55f2('0x3d')](_0x5bb32e,function(_0x833591){if(_0x833591[_0x55f2('0x3a')]!==_0x55f2('0x4e')){var _0x2c34b1={};_0x2c34b1[_0x833591[_0x55f2('0x3e')]]={'$like':'%'+_0x1e95c4['query']['filter']+'%'};return _0x2c34b1;}})});}_0xa62e9a=_[_0x55f2('0x4d')]({},_0xa62e9a,_0x1e95c4[_0x55f2('0x4f')]);var _0x5c4ef7={'where':_0xa62e9a[_0x55f2('0x49')]};return db[_0x55f2('0x37')][_0x55f2('0x28')](_0x5c4ef7)[_0x55f2('0x30')](function(_0x17a38b){_0x4f2e1e[_0x55f2('0x28')]=_0x17a38b;if(_0x1e95c4[_0x55f2('0x3f')][_0x55f2('0x50')]){_0xa62e9a[_0x55f2('0x51')]=[{'all':!![]}];}return db['Trunk']['findAll'](_0xa62e9a);})[_0x55f2('0x30')](function(_0x57b978){_0x4f2e1e[_0x55f2('0x52')]=_0x57b978;return _0x4f2e1e;})[_0x55f2('0x30')](respondWithFilteredResult(_0x184ef,_0xa62e9a))[_0x55f2('0x23')](handleError(_0x184ef,null));};exports[_0x55f2('0x53')]=function(_0x1fe51b,_0x3d86e9){var _0x39c441={'raw':![],'where':{'id':_0x1fe51b[_0x55f2('0x54')]['id']}},_0x56b2df={};_0x56b2df['model']=_[_0x55f2('0x40')](db[_0x55f2('0x37')]['rawAttributes']);_0x56b2df['query']=_[_0x55f2('0x40')](_0x1fe51b[_0x55f2('0x3f')]);_0x56b2df[_0x55f2('0x4b')]=_[_0x55f2('0x42')](_0x56b2df['model'],_0x56b2df['query']);_0x39c441['attributes']=_['intersection'](_0x56b2df['model'],qs['fields'](_0x1fe51b[_0x55f2('0x3f')][_0x55f2('0x43')]));_0x39c441[_0x55f2('0x41')]=_0x39c441[_0x55f2('0x41')][_0x55f2('0x44')]?_0x39c441[_0x55f2('0x41')]:_0x56b2df[_0x55f2('0x3c')];if(_0x1fe51b['query'][_0x55f2('0x50')]){_0x39c441['include']=[{'all':!![]}];}_0x39c441=_[_0x55f2('0x4d')]({},_0x39c441,_0x1fe51b[_0x55f2('0x4f')]);return db[_0x55f2('0x37')][_0x55f2('0x55')](_0x39c441)[_0x55f2('0x30')](handleEntityNotFound(_0x3d86e9,null))['then'](respondWithResult(_0x3d86e9,null))[_0x55f2('0x23')](handleError(_0x3d86e9,null));};exports[_0x55f2('0x56')]=function(_0x21b83c,_0x28d067){var _0x4f21f6={'where':{'id':_0x21b83c[_0x55f2('0x54')]['id']}},_0x292126={};_0x292126['model']=_[_0x55f2('0x40')](db['Trunk'][_0x55f2('0x38')]);_0x4f21f6[_0x55f2('0x41')]=_[_0x55f2('0x42')](_0x292126[_0x55f2('0x3c')],qs['fields'](_0x21b83c[_0x55f2('0x3f')][_0x55f2('0x43')]));_0x4f21f6[_0x55f2('0x41')]=_0x4f21f6[_0x55f2('0x41')]['length']?_0x4f21f6[_0x55f2('0x41')]:_0x292126[_0x55f2('0x3c')];if(_0x21b83c[_0x55f2('0x3f')][_0x55f2('0x50')]){_0x4f21f6[_0x55f2('0x51')]=[{'all':!![]}];}_0x4f21f6=_['merge']({},_0x4f21f6,_0x21b83c[_0x55f2('0x4f')]);return db[_0x55f2('0x37')][_0x55f2('0x55')](_0x4f21f6)['then'](handleEntityNotFound(_0x28d067,null))[_0x55f2('0x30')](function(_0x45c31e){if(_0x45c31e){var _0x4e964c=_0x45c31e['get']({'plain':!![]});_0x4e964c=qs['omit'](_0x4e964c,['id',_0x55f2('0x57'),_0x55f2('0x58')]);_0x21b83c['body']=_[_0x55f2('0x59')](_0x21b83c[_0x55f2('0x5a')],['id',_0x55f2('0x57'),'updatedAt']);return db[_0x55f2('0x37')][_0x55f2('0x5b')](_[_0x55f2('0x4d')](_0x4e964c,_0x21b83c[_0x55f2('0x5a')]),{'include':_0x21b83c[_0x55f2('0x3f')][_0x55f2('0x50')]?[{'all':!![]}]:undefined})[_0x55f2('0x30')](function(_0x2f8edd){var _0x476db1=_0x21b83c[_0x55f2('0x5c')][_0x55f2('0x31')]({'plain':!![]});if(!_0x476db1)throw new Error(_0x55f2('0x5d'));if(_0x476db1[_0x55f2('0x5e')]===_0x55f2('0x5c')){var _0x53eb1c=_0x2f8edd['get']({'plain':!![]});var _0x218013=_0x55f2('0x32');return db[_0x55f2('0x5f')]['find']({'where':{'name':_0x218013,'userProfileId':_0x476db1[_0x55f2('0x60')]},'raw':!![]})[_0x55f2('0x30')](function(_0xca2475){if(_0xca2475&&_0xca2475['autoAssociation']===0x0){return db[_0x55f2('0x33')][_0x55f2('0x5b')]({'name':_0x53eb1c[_0x55f2('0x3e')],'resourceId':_0x53eb1c['id'],'type':_0xca2475[_0x55f2('0x3e')],'sectionId':_0xca2475['id']},{})['then'](function(){return _0x2f8edd;});}else{return _0x2f8edd;}})[_0x55f2('0x23')](function(_0x252f61){logger['error'](_0x55f2('0x61'),_0x252f61);throw _0x252f61;});}return _0x2f8edd;});}})[_0x55f2('0x30')](respondWithResult(_0x28d067,0xc9))[_0x55f2('0x23')](handleError(_0x28d067,null));};exports[_0x55f2('0x5b')]=function(_0x499f6a,_0x30ec73,_0x4d5662){var _0x327c87;return db['Trunk']['create'](_0x499f6a[_0x55f2('0x5a')],{'raw':!![]})[_0x55f2('0x30')](function(_0x1b6309){_0x327c87=_0x1b6309;return db[_0x55f2('0x37')][_0x55f2('0x62')]({'raw':!![]});})['then'](function(_0x522594){var _0x28970a=fs['readFileSync'](path[_0x55f2('0x63')](config[_0x55f2('0x64')],_0x55f2('0x65')),_0x55f2('0x66'));var _0x57394b=fs['readFileSync'](path[_0x55f2('0x63')](config[_0x55f2('0x64')],_0x55f2('0x67')),_0x55f2('0x66'));var _0x276dbd=ejs[_0x55f2('0x68')](_0x28970a,{'trunks':_0x522594||[]});fs[_0x55f2('0x69')]('/etc/asterisk/sip_xcally_trunks.conf',_0x276dbd);if(_0x327c87[_0x55f2('0x6a')]){var _0x1ead3e=ejs[_0x55f2('0x68')](_0x57394b,{'trunks':_0x522594||[]});fs[_0x55f2('0x69')](_0x55f2('0x6b'),_0x1ead3e);}})[_0x55f2('0x30')](function(){return respondWithRpcPromise(_0x55f2('0x6c'),'create',{'module':_0x55f2('0x6d')});})[_0x55f2('0x30')](function(){var _0x357897=_0x499f6a['user'][_0x55f2('0x31')]({'plain':!![]});if(!_0x357897)throw new Error(_0x55f2('0x5d'));if(_0x357897['role']===_0x55f2('0x5c')){var _0x4a9dfe=_0x327c87[_0x55f2('0x31')]({'plain':!![]});return db[_0x55f2('0x5f')][_0x55f2('0x55')]({'where':{'name':'Trunks','userProfileId':_0x357897['userProfileId']},'raw':!![]})[_0x55f2('0x30')](function(_0x38dca5){if(_0x38dca5&&_0x38dca5[_0x55f2('0x6e')]===0x0){return db[_0x55f2('0x33')]['create']({'name':_0x4a9dfe['name'],'resourceId':_0x4a9dfe['id'],'type':_0x38dca5['name'],'sectionId':_0x38dca5['id']},{})[_0x55f2('0x30')](function(){return _0x327c87;});}else{return _0x327c87;}})[_0x55f2('0x23')](function(_0x29b435){logger[_0x55f2('0x1f')](_0x55f2('0x61'),_0x29b435);throw _0x29b435;});}return _0x327c87;})[_0x55f2('0x30')](respondWithResult(_0x30ec73,0xc9))[_0x55f2('0x23')](handleError(_0x30ec73,null));};exports[_0x55f2('0x2f')]=function(_0x43504c,_0x2b8aa3,_0x4684e7){var _0x1f40a1;return db[_0x55f2('0x37')][_0x55f2('0x55')]({'where':{'id':_0x43504c[_0x55f2('0x54')]['id']}})[_0x55f2('0x30')](handleEntityNotFound(_0x2b8aa3,null))['then'](saveUpdates(_0x43504c[_0x55f2('0x5a')],null))[_0x55f2('0x30')](function(_0x21edad){if(_0x21edad){_0x1f40a1=_0x21edad;return db['Trunk'][_0x55f2('0x62')]({'raw':!![]});}})[_0x55f2('0x30')](function(_0xf04bde){if(_0xf04bde){var _0x492749=fs['readFileSync'](path[_0x55f2('0x63')](config['root'],_0x55f2('0x65')),_0x55f2('0x66'));var _0x345294=fs[_0x55f2('0x6f')](path['join'](config[_0x55f2('0x64')],_0x55f2('0x67')),_0x55f2('0x66'));var _0x227375=ejs[_0x55f2('0x68')](_0x492749,{'trunks':_0xf04bde||[]});fs['writeFileSync'](_0x55f2('0x70'),_0x227375);var _0x18ac79=ejs['render'](_0x345294,{'trunks':_0xf04bde||[]});fs[_0x55f2('0x69')](_0x55f2('0x6b'),_0x18ac79);return respondWithRpcPromise('Reload','update',{'module':_0x55f2('0x6d')});}return null;})[_0x55f2('0x30')](function(_0x554f72){if(_0x554f72){return _0x1f40a1;}})[_0x55f2('0x30')](respondWithResult(_0x2b8aa3,null))['catch'](handleError(_0x2b8aa3,null));};exports[_0x55f2('0x34')]=function(_0x198ec3,_0x58d6ff,_0x3a2a0a){var _0x55ac98;return db[_0x55f2('0x37')]['find']({'where':{'id':_0x198ec3[_0x55f2('0x54')]['id']}})[_0x55f2('0x30')](handleEntityNotFound(_0x58d6ff,null))[_0x55f2('0x30')](removeEntity(_0x58d6ff,null))['then'](function(){return db[_0x55f2('0x37')]['findAll']({'raw':!![]});})['then'](function(_0x3ff499){var _0x3f3faa=fs[_0x55f2('0x6f')](path[_0x55f2('0x63')](config[_0x55f2('0x64')],'server/files/templates/trunk.ejs'),_0x55f2('0x66'));var _0x34528c=fs[_0x55f2('0x6f')](path[_0x55f2('0x63')](config[_0x55f2('0x64')],_0x55f2('0x67')),_0x55f2('0x66'));var _0xd5a8b1=ejs[_0x55f2('0x68')](_0x3f3faa,{'trunks':_0x3ff499});var _0x4392d3=ejs[_0x55f2('0x68')](_0x34528c,{'trunks':_0x3ff499});fs[_0x55f2('0x69')](_0x55f2('0x70'),_0xd5a8b1);fs[_0x55f2('0x69')]('/etc/asterisk/sip_xcally_registers.conf',_0x4392d3);return respondWithRpcPromise(_0x55f2('0x6c'),_0x55f2('0x34'),{'module':_0x55f2('0x6d')});})[_0x55f2('0x23')](handleError(_0x58d6ff,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 7e5bffc..c0bdb57 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 _0xa9ff=['util','../../config/logger','api','path','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash'];(function(_0x406ee5,_0x571e6c){var _0x87a117=function(_0x1c08c2){while(--_0x1c08c2){_0x406ee5['push'](_0x406ee5['shift']());}};_0x87a117(++_0x571e6c);}(_0xa9ff,0x1d8));var _0xfa9f=function(_0x340fdf,_0x48ad2b){_0x340fdf=_0x340fdf-0x0;var _0x1a04c2=_0xa9ff[_0x340fdf];return _0x1a04c2;};'use strict';var _=require(_0xfa9f('0x0'));var util=require(_0xfa9f('0x1'));var logger=require(_0xfa9f('0x2'))(_0xfa9f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa9f('0x4'));var rimraf=require(_0xfa9f('0x5'));var config=require('../../config/environment');var attributes=require(_0xfa9f('0x6'));module[_0xfa9f('0x7')]=function(_0x3dc535,_0x45ac5d){return _0x3dc535[_0xfa9f('0x8')](_0xfa9f('0x9'),attributes,{'tableName':_0xfa9f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab2e=['Trunk','tools_trunks','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x3170da,_0x38d32b){var _0x275645=function(_0x3c60c5){while(--_0x3c60c5){_0x3170da['push'](_0x3170da['shift']());}};_0x275645(++_0x38d32b);}(_0xab2e,0xca));var _0xeab2=function(_0x5b50a8,_0x3c22c1){_0x5b50a8=_0x5b50a8-0x0;var _0x573b78=_0xab2e[_0x5b50a8];return _0x573b78;};'use strict';var _=require(_0xeab2('0x0'));var util=require(_0xeab2('0x1'));var logger=require(_0xeab2('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeab2('0x3'));var rp=require(_0xeab2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeab2('0x5'));var config=require(_0xeab2('0x6'));var attributes=require('./trunk.attributes');module['exports']=function(_0x58241f,_0x1cded8){return _0x58241f[_0xeab2('0x7')](_0xeab2('0x8'),attributes,{'tableName':_0xeab2('0x9'),'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 b457487..b9402ea 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 _0xbaf0=['Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('Trunk,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetTrunk',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowTrunk',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0xb7e7=['request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','include','map','model','ShowTrunk','find','where','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http'];(function(_0x5ab6fd,_0x30ea0a){var _0x56eef7=function(_0x2e57b2){while(--_0x2e57b2){_0x5ab6fd['push'](_0x5ab6fd['shift']());}};_0x56eef7(++_0x30ea0a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0xb7e7[_0x5834bc];return _0x3e183a;};'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')]('Trunk,\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);});});}exports[_0x7b7e('0x14')]=function(_0x242368){var _0x200ef7=this;return new Promise(function(_0x2acb8c,_0x429a0e){return db[_0x7b7e('0x15')][_0x7b7e('0x16')]({'raw':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')]['where']||null:null,'attributes':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x19')]||null:null,'limit':_0x242368['options']?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1a')]||null:null,'include':_0x242368[_0x7b7e('0x17')]?_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x242368[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x53bbb3){return{'model':db[_0x53bbb3['model']],'as':_0x53bbb3['as'],'attributes':_0x53bbb3['attributes'],'include':_0x53bbb3[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x53bbb3[_0x7b7e('0x1b')],function(_0x483c6f){return{'model':db[_0x483c6f['model']],'as':_0x483c6f['as'],'attributes':_0x483c6f['attributes'],'include':_0x483c6f[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x483c6f[_0x7b7e('0x1b')],function(_0x7aa71){return{'model':db[_0x7aa71[_0x7b7e('0x1d')]],'as':_0x7aa71['as'],'attributes':_0x7aa71['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x21a15){logger['info']('GetTrunk',_0x242368);logger['debug'](_0x7b7e('0x14'),_0x242368,JSON[_0x7b7e('0xf')](_0x21a15));_0x2acb8c(_0x21a15);})['catch'](function(_0x3db8c4){logger['error'](_0x7b7e('0x14'),_0x3db8c4[_0x7b7e('0x12')],_0x242368);_0x429a0e(_0x200ef7[_0x7b7e('0x10')](0x1f4,_0x3db8c4['message']));});});};exports[_0x7b7e('0x1e')]=function(_0xe31336){var _0x35602a=this;return new Promise(function(_0x326dd2,_0x33f9a1){return db['Trunk'][_0x7b7e('0x1f')]({'raw':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x18')]===undefined?!![]:![]:!![],'where':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x20')]||null:null,'attributes':_0xe31336[_0x7b7e('0x17')]?_0xe31336[_0x7b7e('0x17')]['attributes']||null:null,'include':_0xe31336['options']?_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')]?_['map'](_0xe31336[_0x7b7e('0x17')][_0x7b7e('0x1b')],function(_0x2ca366){return{'model':db[_0x2ca366['model']],'as':_0x2ca366['as'],'attributes':_0x2ca366[_0x7b7e('0x19')],'include':_0x2ca366[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x2ca366[_0x7b7e('0x1b')],function(_0x31043a){return{'model':db[_0x31043a[_0x7b7e('0x1d')]],'as':_0x31043a['as'],'attributes':_0x31043a[_0x7b7e('0x19')],'include':_0x31043a[_0x7b7e('0x1b')]?_[_0x7b7e('0x1c')](_0x31043a[_0x7b7e('0x1b')],function(_0xd5a64d){return{'model':db[_0xd5a64d[_0x7b7e('0x1d')]],'as':_0xd5a64d['as'],'attributes':_0xd5a64d[_0x7b7e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7b7e('0x9')](function(_0x116563){logger[_0x7b7e('0xa')]('ShowTrunk',_0xe31336);logger[_0x7b7e('0xc')](_0x7b7e('0x1e'),_0xe31336,JSON[_0x7b7e('0xf')](_0x116563));_0x326dd2(_0x116563);})[_0x7b7e('0x13')](function(_0x36abfc){logger[_0x7b7e('0x10')](_0x7b7e('0x1e'),_0x36abfc[_0x7b7e('0x12')],_0xe31336);_0x33f9a1(_0x35602a[_0x7b7e('0x10')](0x1f4,_0x36abfc[_0x7b7e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 9da6d39..8a17d32 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 _0x026c=['/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','post','/create_many','bulkCreate','diskStorage','format','%s-%s','now','single','/:id/login','login','logout','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','describe','whoami','/:id','/:id/avatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt'];(function(_0x1d2a1d,_0x49fbea){var _0x19c046=function(_0x2c9cd0){while(--_0x2c9cd0){_0x1d2a1d['push'](_0x1d2a1d['shift']());}};_0x19c046(++_0x49fbea);}(_0x026c,0x133));var _0xc026=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x026c[_0x39c734];return _0xb2a2f9;};'use strict';var multer=require(_0xc026('0x0'));var util=require(_0xc026('0x1'));var path=require(_0xc026('0x2'));var timeout=require(_0xc026('0x3'));var express=require(_0xc026('0x4'));var router=express[_0xc026('0x5')]();var auth=require(_0xc026('0x6'));var interaction=require(_0xc026('0x7'));var config=require(_0xc026('0x8'));var controller=require(_0xc026('0x9'));router['get']('/',auth[_0xc026('0xa')](),controller[_0xc026('0xb')]);router[_0xc026('0xc')]('/describe',auth[_0xc026('0xa')](),controller[_0xc026('0xd')]);router[_0xc026('0xc')]('/whoami',auth[_0xc026('0xa')](),controller[_0xc026('0xe')]);router[_0xc026('0xc')](_0xc026('0xf'),auth[_0xc026('0xa')](),controller['show']);router[_0xc026('0xc')](_0xc026('0x10'),controller['getAvatar']);router[_0xc026('0xc')](_0xc026('0x11'),auth[_0xc026('0xa')](),controller[_0xc026('0x12')]);router[_0xc026('0xc')](_0xc026('0x13'),auth[_0xc026('0xa')](),controller[_0xc026('0x14')]);router[_0xc026('0xc')](_0xc026('0x15'),auth[_0xc026('0xa')](),controller[_0xc026('0x16')]);router[_0xc026('0xc')](_0xc026('0x17'),auth[_0xc026('0xa')](),controller['getGroups']);router[_0xc026('0xc')](_0xc026('0x18'),auth[_0xc026('0xa')](),controller[_0xc026('0x19')]);router[_0xc026('0xc')](_0xc026('0x1a'),auth[_0xc026('0xa')](),controller[_0xc026('0x1b')]);router['get'](_0xc026('0x1c'),auth[_0xc026('0xa')](),controller[_0xc026('0x1d')]);router[_0xc026('0xc')](_0xc026('0x1e'),auth['isAuthenticated'](),controller[_0xc026('0x1f')]);router['get'](_0xc026('0x20'),auth[_0xc026('0xa')](),controller[_0xc026('0x21')]);router[_0xc026('0xc')](_0xc026('0x22'),auth[_0xc026('0xa')](),controller['getSmsInteractions']);router['get']('/:id/fax/interactions',auth[_0xc026('0xa')](),controller[_0xc026('0x23')]);router['get']('/:id/whatsapp/interactions',auth[_0xc026('0xa')](),controller[_0xc026('0x24')]);router['get'](_0xc026('0x25'),auth[_0xc026('0xa')](),controller['getTeams']);router[_0xc026('0xc')](_0xc026('0x26'),auth[_0xc026('0xa')](),controller[_0xc026('0x27')]);router[_0xc026('0xc')](_0xc026('0x28'),auth['isAuthenticated'](),controller[_0xc026('0x29')]);router['get'](_0xc026('0x2a'),auth[_0xc026('0xa')](),controller[_0xc026('0x2b')]);router[_0xc026('0xc')](_0xc026('0x2c'),auth[_0xc026('0xa')](),controller[_0xc026('0x2d')]);router[_0xc026('0xc')](_0xc026('0x2e'),auth[_0xc026('0xa')](),controller['getMailAccounts']);router[_0xc026('0xc')](_0xc026('0x2f'),auth[_0xc026('0xa')](),controller[_0xc026('0x30')]);router[_0xc026('0xc')](_0xc026('0x31'),auth['isAuthenticated'](),controller[_0xc026('0x32')]);router['get']('/:id/chat_websites',auth[_0xc026('0xa')](),controller[_0xc026('0x33')]);router[_0xc026('0xc')](_0xc026('0x34'),auth[_0xc026('0xa')](),controller['getWhatsappAccounts']);router[_0xc026('0xc')](_0xc026('0x35'),auth[_0xc026('0xa')](),controller[_0xc026('0x36')]);router[_0xc026('0xc')]('/:id/scheduled_calls',auth[_0xc026('0xa')](),controller[_0xc026('0x37')]);router[_0xc026('0xc')](_0xc026('0x38'),auth[_0xc026('0xa')](),controller['getApiKey']);router[_0xc026('0x39')](_0xc026('0x11'),auth[_0xc026('0xa')](),controller['addContacts']);router[_0xc026('0x39')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc026('0x39')](_0xc026('0x3a'),auth[_0xc026('0xa')](),controller[_0xc026('0x3b')]);router[_0xc026('0x39')]('/:id/queues',auth[_0xc026('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0xc026('0x3c')]({'destination':function(_0xded498,_0x2ea723,_0x95b8dd){_0x95b8dd(null,path['join'](config['root'],'server/files/images/'));},'filename':function(_0x46d536,_0xe21e41,_0x6a35c9){_0x6a35c9(null,util[_0xc026('0x3d')](_0xc026('0x3e'),Date[_0xc026('0x3f')](),_0xe21e41['originalname']));}})});router['post'](_0xc026('0x10'),upload[_0xc026('0x40')]('file'),controller['addAvatar']);router[_0xc026('0x39')](_0xc026('0x41'),auth[_0xc026('0xa')](),controller[_0xc026('0x42')]);router[_0xc026('0x39')]('/:id/logout',auth[_0xc026('0xa')](),controller[_0xc026('0x43')]);router[_0xc026('0x39')]('/:id/pause',auth[_0xc026('0xa')](),controller[_0xc026('0x44')]);router[_0xc026('0x39')](_0xc026('0x45'),auth['isAuthenticated'](),controller[_0xc026('0x46')]);router[_0xc026('0x39')](_0xc026('0x25'),auth[_0xc026('0xa')](),controller['addTeams']);router['post'](_0xc026('0x47'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0xc026('0x39')](_0xc026('0x48'),auth[_0xc026('0xa')](),controller['addMailInteractions']);router['post']('/:id/fax_interactions',auth[_0xc026('0xa')](),controller[_0xc026('0x49')]);router[_0xc026('0x39')](_0xc026('0x4a'),auth[_0xc026('0xa')](),controller[_0xc026('0x4b')]);router['post'](_0xc026('0x4c'),auth[_0xc026('0xa')](),controller[_0xc026('0x4d')]);router[_0xc026('0x39')](_0xc026('0x4e'),auth[_0xc026('0xa')](),controller[_0xc026('0x4f')]);router['post']('/:id/fax_accounts',auth[_0xc026('0xa')](),controller[_0xc026('0x50')]);router[_0xc026('0x39')](_0xc026('0x2e'),auth[_0xc026('0xa')](),controller[_0xc026('0x51')]);router['post'](_0xc026('0x2f'),auth[_0xc026('0xa')](),controller[_0xc026('0x52')]);router[_0xc026('0x39')](_0xc026('0x31'),auth[_0xc026('0xa')](),controller[_0xc026('0x53')]);router[_0xc026('0x39')](_0xc026('0x54'),auth[_0xc026('0xa')](),controller[_0xc026('0x55')]);router[_0xc026('0x39')](_0xc026('0x34'),auth[_0xc026('0xa')](),controller[_0xc026('0x56')]);router[_0xc026('0x39')](_0xc026('0x35'),auth[_0xc026('0xa')](),controller['addSquareProjects']);router[_0xc026('0x39')]('/:id/api_key',auth[_0xc026('0xa')](),controller[_0xc026('0x57')]);router[_0xc026('0x58')]('/:id',auth['isAuthenticated'](),controller[_0xc026('0x59')]);router[_0xc026('0x58')](_0xc026('0x5a'),auth[_0xc026('0xa')](),controller[_0xc026('0x5b')]);router[_0xc026('0x5c')]('/:id/queues',auth['isAuthenticated'](),controller[_0xc026('0x5d')]);router[_0xc026('0x5c')](_0xc026('0x25'),auth[_0xc026('0xa')](),controller[_0xc026('0x5e')]);router['delete'](_0xc026('0xf'),auth[_0xc026('0xa')](),controller[_0xc026('0x5f')]);router[_0xc026('0x5c')](_0xc026('0x47'),auth[_0xc026('0xa')](),controller[_0xc026('0x60')]);router[_0xc026('0x5c')](_0xc026('0x48'),auth[_0xc026('0xa')](),controller[_0xc026('0x61')]);router[_0xc026('0x5c')](_0xc026('0x62'),auth[_0xc026('0xa')](),controller[_0xc026('0x63')]);router[_0xc026('0x5c')]('/:id/sms_interactions',auth[_0xc026('0xa')](),controller['removeSmsInteractions']);router[_0xc026('0x5c')](_0xc026('0x4c'),auth['isAuthenticated'](),controller[_0xc026('0x64')]);router['delete'](_0xc026('0x4e'),auth[_0xc026('0xa')](),controller['removeWhatsappInteractions']);router[_0xc026('0x5c')](_0xc026('0x2c'),auth[_0xc026('0xa')](),controller[_0xc026('0x65')]);router[_0xc026('0x5c')](_0xc026('0x2e'),auth['isAuthenticated'](),controller[_0xc026('0x66')]);router[_0xc026('0x5c')]('/:id/openchannel_accounts',auth[_0xc026('0xa')](),controller[_0xc026('0x67')]);router[_0xc026('0x5c')]('/:id/sms_accounts',auth[_0xc026('0xa')](),controller[_0xc026('0x68')]);router[_0xc026('0x5c')](_0xc026('0x54'),auth[_0xc026('0xa')](),controller[_0xc026('0x69')]);router[_0xc026('0x5c')](_0xc026('0x34'),auth[_0xc026('0xa')](),controller[_0xc026('0x6a')]);router[_0xc026('0x5c')](_0xc026('0x35'),auth[_0xc026('0xa')](),controller[_0xc026('0x6b')]);router[_0xc026('0x5c')](_0xc026('0x38'),auth['isAuthenticated'](),controller[_0xc026('0x6c')]);module[_0xc026('0x6d')]=router; \ No newline at end of file +var _0xdf0d=['addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','destroy','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeMailAccounts','removeOpenchannelAccounts','removeWhatsappAccounts','/:id/square_projects','removeSquareProjects','removeApiKey','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','/whoami','whoami','get','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','addQueues','join','root','server/files/images/','format','%s-%s','single','addAvatar','/:id/login','/:id/logout','pause','unpause','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts'];(function(_0x9705e6,_0x4eca32){var _0x2d8b15=function(_0x20190b){while(--_0x20190b){_0x9705e6['push'](_0x9705e6['shift']());}};_0x2d8b15(++_0x4eca32);}(_0xdf0d,0x88));var _0xddf0=function(_0x14ede5,_0x5db1e4){_0x14ede5=_0x14ede5-0x0;var _0x45ca44=_0xdf0d[_0x14ede5];return _0x45ca44;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xddf0('0x0'));var timeout=require(_0xddf0('0x1'));var express=require('express');var router=express[_0xddf0('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xddf0('0x3'));var config=require(_0xddf0('0x4'));var controller=require(_0xddf0('0x5'));router['get']('/',auth[_0xddf0('0x6')](),controller[_0xddf0('0x7')]);router['get']('/describe',auth[_0xddf0('0x6')](),controller['describe']);router['get'](_0xddf0('0x8'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x9')]);router[_0xddf0('0xa')](_0xddf0('0xb'),auth[_0xddf0('0x6')](),controller[_0xddf0('0xc')]);router[_0xddf0('0xa')]('/:id/avatar',controller[_0xddf0('0xd')]);router[_0xddf0('0xa')](_0xddf0('0xe'),auth['isAuthenticated'](),controller[_0xddf0('0xf')]);router[_0xddf0('0xa')](_0xddf0('0x10'),auth[_0xddf0('0x6')](),controller['getQueues']);router['get']('/:id/queues_rt',auth[_0xddf0('0x6')](),controller[_0xddf0('0x11')]);router['get'](_0xddf0('0x12'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x13')]);router[_0xddf0('0xa')](_0xddf0('0x14'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x15')]);router['get'](_0xddf0('0x16'),auth['isAuthenticated'](),controller[_0xddf0('0x17')]);router[_0xddf0('0xa')](_0xddf0('0x18'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x19')]);router['get'](_0xddf0('0x1a'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x1b')]);router['get']('/:id/mail/interactions',auth[_0xddf0('0x6')](),controller[_0xddf0('0x1c')]);router['get'](_0xddf0('0x1d'),auth['isAuthenticated'](),controller[_0xddf0('0x1e')]);router[_0xddf0('0xa')]('/:id/fax/interactions',auth[_0xddf0('0x6')](),controller['getFaxInteractions']);router['get'](_0xddf0('0x1f'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x20')]);router[_0xddf0('0xa')](_0xddf0('0x21'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x22')]);router['get'](_0xddf0('0x23'),auth['isAuthenticated'](),controller['getLists']);router[_0xddf0('0xa')](_0xddf0('0x24'),auth['isAuthenticated'](),controller[_0xddf0('0x25')]);router[_0xddf0('0xa')](_0xddf0('0x26'),auth['isAuthenticated'](),controller[_0xddf0('0x27')]);router[_0xddf0('0xa')](_0xddf0('0x28'),auth[_0xddf0('0x6')](),controller['getFaxAccounts']);router[_0xddf0('0xa')]('/:id/mail_accounts',auth[_0xddf0('0x6')](),controller[_0xddf0('0x29')]);router['get'](_0xddf0('0x2a'),auth[_0xddf0('0x6')](),controller['getOpenchannelAccounts']);router[_0xddf0('0xa')](_0xddf0('0x2b'),auth['isAuthenticated'](),controller[_0xddf0('0x2c')]);router[_0xddf0('0xa')](_0xddf0('0x2d'),auth[_0xddf0('0x6')](),controller['getChatWebsites']);router[_0xddf0('0xa')](_0xddf0('0x2e'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x2f')]);router[_0xddf0('0xa')]('/:id/square_projects',auth[_0xddf0('0x6')](),controller[_0xddf0('0x30')]);router['get']('/:id/scheduled_calls',auth[_0xddf0('0x6')](),controller[_0xddf0('0x31')]);router[_0xddf0('0xa')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xddf0('0x32')]);router[_0xddf0('0x33')](_0xddf0('0xe'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x34')]);router[_0xddf0('0x33')]('/',auth[_0xddf0('0x6')](),controller[_0xddf0('0x35')]);router['post'](_0xddf0('0x36'),auth[_0xddf0('0x6')](),controller['bulkCreate']);router[_0xddf0('0x33')](_0xddf0('0x10'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x24df2c,_0x2a39b7,_0x1b5c1f){_0x1b5c1f(null,path[_0xddf0('0x38')](config[_0xddf0('0x39')],_0xddf0('0x3a')));},'filename':function(_0x412c7e,_0x35bd2f,_0x35f7ae){_0x35f7ae(null,util[_0xddf0('0x3b')](_0xddf0('0x3c'),Date['now'](),_0x35bd2f['originalname']));}})});router[_0xddf0('0x33')]('/:id/avatar',upload[_0xddf0('0x3d')]('file'),controller[_0xddf0('0x3e')]);router[_0xddf0('0x33')](_0xddf0('0x3f'),auth[_0xddf0('0x6')](),controller['login']);router[_0xddf0('0x33')](_0xddf0('0x40'),auth[_0xddf0('0x6')](),controller['logout']);router[_0xddf0('0x33')]('/:id/pause',auth[_0xddf0('0x6')](),controller[_0xddf0('0x41')]);router[_0xddf0('0x33')]('/:id/unpause',auth['isAuthenticated'](),controller[_0xddf0('0x42')]);router[_0xddf0('0x33')](_0xddf0('0x21'),auth[_0xddf0('0x6')](),controller['addTeams']);router[_0xddf0('0x33')](_0xddf0('0x43'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x44')]);router[_0xddf0('0x33')]('/:id/mail_interactions',auth[_0xddf0('0x6')](),controller[_0xddf0('0x45')]);router[_0xddf0('0x33')](_0xddf0('0x46'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x47')]);router[_0xddf0('0x33')](_0xddf0('0x48'),auth['isAuthenticated'](),controller[_0xddf0('0x49')]);router[_0xddf0('0x33')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xddf0('0x4a')]);router[_0xddf0('0x33')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xddf0('0x4b')]);router[_0xddf0('0x33')](_0xddf0('0x28'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x4c')]);router[_0xddf0('0x33')](_0xddf0('0x4d'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x4e')]);router[_0xddf0('0x33')](_0xddf0('0x2a'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x4f')]);router['post']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xddf0('0x50')]);router[_0xddf0('0x33')](_0xddf0('0x2d'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x51')]);router[_0xddf0('0x33')](_0xddf0('0x2e'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x52')]);router[_0xddf0('0x33')]('/:id/square_projects',auth[_0xddf0('0x6')](),controller[_0xddf0('0x53')]);router[_0xddf0('0x33')](_0xddf0('0x54'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x55')]);router[_0xddf0('0x56')]('/:id',auth[_0xddf0('0x6')](),controller[_0xddf0('0x57')]);router['put'](_0xddf0('0x58'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x59')]);router[_0xddf0('0x5a')](_0xddf0('0x10'),auth['isAuthenticated'](),controller[_0xddf0('0x5b')]);router['delete'](_0xddf0('0x21'),auth[_0xddf0('0x6')](),controller['removeTeams']);router[_0xddf0('0x5a')](_0xddf0('0xb'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x5c')]);router[_0xddf0('0x5a')](_0xddf0('0x43'),auth[_0xddf0('0x6')](),controller['removeChatInteractions']);router[_0xddf0('0x5a')](_0xddf0('0x5d'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x5e')]);router[_0xddf0('0x5a')](_0xddf0('0x46'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x5f')]);router[_0xddf0('0x5a')](_0xddf0('0x48'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x60')]);router[_0xddf0('0x5a')](_0xddf0('0x61'),auth['isAuthenticated'](),controller[_0xddf0('0x62')]);router[_0xddf0('0x5a')](_0xddf0('0x63'),auth[_0xddf0('0x6')](),controller['removeWhatsappInteractions']);router['delete']('/:id/fax_accounts',auth[_0xddf0('0x6')](),controller['removeFaxAccounts']);router['delete']('/:id/mail_accounts',auth[_0xddf0('0x6')](),controller[_0xddf0('0x64')]);router[_0xddf0('0x5a')](_0xddf0('0x2a'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x65')]);router['delete']('/:id/sms_accounts',auth[_0xddf0('0x6')](),controller['removeSmsAccounts']);router['delete'](_0xddf0('0x2d'),auth[_0xddf0('0x6')](),controller['removeChatWebsites']);router[_0xddf0('0x5a')](_0xddf0('0x2e'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x66')]);router['delete'](_0xddf0('0x67'),auth['isAuthenticated'](),controller[_0xddf0('0x68')]);router[_0xddf0('0x5a')](_0xddf0('0x54'),auth[_0xddf0('0x6')](),controller[_0xddf0('0x69')]);module[_0xddf0('0x6a')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index c72334b..0ce1b2a 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 _0x1f0b=['update,nonat','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','map','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','sequelize','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','format','getDataValue','internal','email','ENUM','user','agent','telephone','local','INTEGER','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','update','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','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','certificate','active','passive','actpass','nonat'];(function(_0x480a47,_0x4a2f5a){var _0x517950=function(_0x1a1c73){while(--_0x1a1c73){_0x480a47['push'](_0x480a47['shift']());}};_0x517950(++_0x4a2f5a);}(_0x1f0b,0x122));var _0xb1f0=function(_0x136ed6,_0x1df16d){_0x136ed6=_0x136ed6-0x0;var _0x3bbfb9=_0x1f0b[_0x136ed6];return _0x3bbfb9;};'use strict';var Sequelize=require(_0xb1f0('0x0'));var moment=require('moment');var util=require('util');var _=require('lodash');module[_0xb1f0('0x1')]={'name':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x139372){this[_0xb1f0('0x3')](_0xb1f0('0x4'),_0x139372);this[_0xb1f0('0x3')](_0xb1f0('0x5'),_0x139372);},'comment':_0xb1f0('0x6')},'fullname':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':![],'set':function(_0xa278c8){this[_0xb1f0('0x3')]('fullname',_0xa278c8);this['setDataValue']('callerid',util[_0xb1f0('0x7')]('\x22%s\x22\x20<%s>',_0xa278c8,this[_0xb1f0('0x8')](_0xb1f0('0x9'))));}},'alias':{'type':Sequelize[_0xb1f0('0x2')]},'email':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':![],'unique':_0xb1f0('0xa'),'validate':{'isEmail':!![]},'set':function(_0x47fa61){if(_0x47fa61){this[_0xb1f0('0x3')](_0xb1f0('0xa'),_0x47fa61['toLowerCase']());}}},'role':{'type':Sequelize[_0xb1f0('0xb')]('admin',_0xb1f0('0xc'),_0xb1f0('0xd'),_0xb1f0('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xb1f0('0x2')],'defaultValue':_0xb1f0('0xf')},'internal':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':![],'unique':_0xb1f0('0x9'),'set':function(_0x5f467a){this[_0xb1f0('0x3')](_0xb1f0('0x9'),_0x5f467a);this['setDataValue']('accountcode',_0x5f467a);this['setDataValue'](_0xb1f0('0x11'),util[_0xb1f0('0x7')](_0xb1f0('0x12'),this[_0xb1f0('0x8')]('fullname'),_0x5f467a));}},'salt':{'type':Sequelize[_0xb1f0('0x2')]},'phone':{'type':Sequelize[_0xb1f0('0x2')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xb1f0('0x2')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xb1f0('0x2')]},'city':{'type':Sequelize[_0xb1f0('0x2')]},'country':{'type':Sequelize[_0xb1f0('0x2')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xb1f0('0x2')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xb1f0('0x14')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xb1f0('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xb1f0('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xb1f0('0x10')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xb1f0('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xb1f0('0x10')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xb1f0('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xb1f0('0x10')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![],'defaultValue':_0xb1f0('0x15')},'ipaddr':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0xb1f0('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x16'),_0xb1f0('0xc'),'peer'),'allowNull':!![],'defaultValue':_0xb1f0('0x16')},'context':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![],'defaultValue':_0xb1f0('0x17')},'callingpres':{'type':Sequelize['ENUM'](_0xb1f0('0x18'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED',_0xb1f0('0x19'),_0xb1f0('0x1a'),_0xb1f0('0x1b'),_0xb1f0('0x1c')),'allowNull':!![]},'deny':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![],'defaultValue':_0xb1f0('0x1d'),'set':function(_0x3cc084){this[_0xb1f0('0x3')](_0xb1f0('0x1e'),_0x3cc084?_0x3cc084[_0xb1f0('0x1f')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xb1f0('0x8')](_0xb1f0('0x1e'))['split'](','):null;},'comment':_0xb1f0('0x20')},'dtmfmode':{'type':Sequelize['ENUM'](_0xb1f0('0x21'),'info',_0xb1f0('0x22'),_0xb1f0('0x23'),_0xb1f0('0x24')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xb1f0('0xb')]('yes','no','nonat',_0xb1f0('0x25'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![],'defaultValue':_0xb1f0('0x27'),'set':function(_0x234b21){this['setDataValue'](_0xb1f0('0x28'),_0x234b21?_0x234b21[_0xb1f0('0x1f')](','):null);},'get':function(){return this['getDataValue'](_0xb1f0('0x28'))?this['getDataValue'](_0xb1f0('0x28'))[_0xb1f0('0x29')](','):null;},'comment':_0xb1f0('0x2a')},'callgroup':{'type':Sequelize[_0xb1f0('0x2')]},'namedcallgroup':{'type':Sequelize[_0xb1f0('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xb1f0('0x2')]},'language':{'type':Sequelize[_0xb1f0('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xb1f0('0x2')]},'disallow':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1e63f7){this[_0xb1f0('0x3')](_0xb1f0('0x2b'),_0x1e63f7?_0x1e63f7['join'](';'):_0xb1f0('0x2c'));},'get':function(){return this['getDataValue'](_0xb1f0('0x2b'))?this[_0xb1f0('0x8')](_0xb1f0('0x2b'))[_0xb1f0('0x29')](';'):null;},'comment':_0xb1f0('0x2d')},'autoframing':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x5e6090){this[_0xb1f0('0x3')]('insecure',_0x5e6090?_0x5e6090['join'](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue'](_0xb1f0('0x2e'))['split'](','):null;},'comment':_0xb1f0('0x2f')},'trustrpid':{'type':Sequelize[_0xb1f0('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xb1f0('0x26'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no',_0xb1f0('0x30')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xb1f0('0x26'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xb1f0('0xb')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb1f0('0x31')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xb1f0('0x26'),'no'),'allowNull':!![],'defaultValue':_0xb1f0('0x26')},'busylevel':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no',_0xb1f0('0x32')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x33'),_0xb1f0('0x34'),_0xb1f0('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xb1f0('0x36'),_0xb1f0('0x37')),'allowNull':!![],'defaultValue':_0xb1f0('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![],'defaultValue':_0xb1f0('0x26')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xb1f0('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xb1f0('0x26'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xb1f0('0xb')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xb1f0('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xb1f0('0xb')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no',_0xb1f0('0x38'),_0xb1f0('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xb1f0('0x3a'),_0xb1f0('0x3b'),_0xb1f0('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xb1f0('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xb1f0('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no',_0xb1f0('0x3d'),_0xb1f0('0x25'),_0xb1f0('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xb1f0('0x2')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xb1f0('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0xb1f0('0x10')],'defaultValue':0x0,'set':function(_0x144de3){this[_0xb1f0('0x3')](_0xb1f0('0x3f'),_0x144de3);var _0x14dd25=this[_0xb1f0('0x40')]({'plain':!![]});switch(_0x144de3){case 0x0:case 0x1:var _0x4532e6=_0x14dd25['transport']?_[_0xb1f0('0x41')](_0x14dd25[_0xb1f0('0x1e')])?_0x14dd25[_0xb1f0('0x1e')][_0xb1f0('0x1f')]():_0x14dd25[_0xb1f0('0x1e')]:_0xb1f0('0x1d');if(_0x4532e6==='wss'){_0x4532e6=_0xb1f0('0x1d');}this['setDataValue']('transport',_0x4532e6);this[_0xb1f0('0x3')](_0xb1f0('0x42'),'no');this[_0xb1f0('0x3')](_0xb1f0('0x43'),null);this[_0xb1f0('0x3')](_0xb1f0('0x44'),null);this['setDataValue'](_0xb1f0('0x45'),null);this[_0xb1f0('0x3')]('dtlsenable',null);this['setDataValue'](_0xb1f0('0x46'),null);this[_0xb1f0('0x3')](_0xb1f0('0x47'),null);this['setDataValue']('dtlscertfile',null);this[_0xb1f0('0x3')]('dtlsprivatekey',null);this[_0xb1f0('0x3')](_0xb1f0('0x48'),'no');break;case 0x2:this['setDataValue']('transport',_0xb1f0('0x49'));this[_0xb1f0('0x3')](_0xb1f0('0x42'),_0xb1f0('0x26'));this['setDataValue'](_0xb1f0('0x43'),_0xb1f0('0x26'));this['setDataValue']('force_avp',_0xb1f0('0x26'));this['setDataValue']('icesupport','yes');this[_0xb1f0('0x3')]('dtlsenable',_0xb1f0('0x26'));this[_0xb1f0('0x3')]('dtlsverify','no');this['setDataValue']('dtlssetup',_0xb1f0('0x3c'));this[_0xb1f0('0x3')](_0xb1f0('0x4a'),_0x14dd25[_0xb1f0('0x4a')]||_0xb1f0('0x4b'));this[_0xb1f0('0x3')]('dtlsprivatekey',_0x14dd25[_0xb1f0('0x4c')]||_0xb1f0('0x4d'));this[_0xb1f0('0x3')](_0xb1f0('0x48'),_0xb1f0('0x26'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3ead22){this['setDataValue']('permissions',_0x3ead22?_0x3ead22[_0xb1f0('0x1f')](','):[]);},'get':function(){return this[_0xb1f0('0x8')]('permissions')?_[_0xb1f0('0x4e')](this[_0xb1f0('0x8')](_0xb1f0('0x4f'))[_0xb1f0('0x29')](','),function(_0x268b27){return parseInt(_0x268b27,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xb1f0('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xb1f0('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xb1f0('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xb1f0('0xb')](_0xb1f0('0x26'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xb1f0('0x2')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xb1f0('0x50')],'get':function(){return this[_0xb1f0('0x8')](_0xb1f0('0x51'))?this['getDataValue'](_0xb1f0('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xb1f0('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xb1f0('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x12e8a9){if(typeof _0x12e8a9===_0xb1f0('0x52')){var _0x14ab12=_0x12e8a9==='1'?!![]:_0x12e8a9==='0'?![]:_0x12e8a9===_0xb1f0('0x53')?!![]:_0x12e8a9===_0xb1f0('0x54')?![]:![];this['setDataValue'](_0xb1f0('0x55'),_0x14ab12);}else{this[_0xb1f0('0x3')]('screenrecording',_0x12e8a9);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x441120){this['setDataValue']('blocked',_0x441120);if(_0x441120===!![]){this['setDataValue'](_0xb1f0('0x56'),moment());this[_0xb1f0('0x3')](_0xb1f0('0x57'),0x0);}else{this[_0xb1f0('0x3')](_0xb1f0('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xb1f0('0x13')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc8ed=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','refuse','uas','fingerprint','update,nonat','get','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlscertfile','dtlsprivatekey','rtcp_mux','force_avp','dtlsverify','dtlssetup','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','user','agent','telephone','internal','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xc8ed,0xe9));var _0xdc8e=function(_0x5003b5,_0x40467a){_0x5003b5=_0x5003b5-0x0;var _0x2cfab3=_0xc8ed[_0x5003b5];return _0x2cfab3;};'use strict';var Sequelize=require(_0xdc8e('0x0'));var moment=require(_0xdc8e('0x1'));var util=require(_0xdc8e('0x2'));var _=require(_0xdc8e('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdc8e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x56e632){this[_0xdc8e('0x5')]('name',_0x56e632);this[_0xdc8e('0x5')](_0xdc8e('0x6'),_0x56e632);},'comment':_0xdc8e('0x7')},'fullname':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':![],'set':function(_0x3e87f5){this['setDataValue'](_0xdc8e('0x9'),_0x3e87f5);this[_0xdc8e('0x5')](_0xdc8e('0xa'),util['format'](_0xdc8e('0xb'),_0x3e87f5,this[_0xdc8e('0xc')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':![],'unique':_0xdc8e('0xd'),'validate':{'isEmail':!![]},'set':function(_0x366a0d){if(_0x366a0d){this[_0xdc8e('0x5')](_0xdc8e('0xd'),_0x366a0d[_0xdc8e('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0xdc8e('0xf'),_0xdc8e('0x10'),_0xdc8e('0x11'),_0xdc8e('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xdc8e('0x13'),'set':function(_0x56bbaf){this[_0xdc8e('0x5')]('internal',_0x56bbaf);this['setDataValue'](_0xdc8e('0x14'),_0x56bbaf);this[_0xdc8e('0x5')](_0xdc8e('0xa'),util[_0xdc8e('0x15')](_0xdc8e('0xb'),this[_0xdc8e('0xc')](_0xdc8e('0x9')),_0x56bbaf));}},'salt':{'type':Sequelize[_0xdc8e('0x8')]},'phone':{'type':Sequelize[_0xdc8e('0x8')]},'mobile':{'type':Sequelize[_0xdc8e('0x8')]},'address':{'type':Sequelize[_0xdc8e('0x8')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xdc8e('0x8')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xdc8e('0x17')]},'voicePause':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xdc8e('0x8')],'defaultValue':_0xdc8e('0x18')},'lastPauseAt':{'type':Sequelize[_0xdc8e('0x17')]},'chatCapacity':{'type':Sequelize[_0xdc8e('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xdc8e('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xdc8e('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xdc8e('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xdc8e('0x19')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xdc8e('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdc8e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xdc8e('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x1c'),_0xdc8e('0x10'),_0xdc8e('0x1d')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![],'defaultValue':_0xdc8e('0x1e')},'callingpres':{'type':Sequelize['ENUM'](_0xdc8e('0x1f'),_0xdc8e('0x20'),_0xdc8e('0x21'),'ALLOWED',_0xdc8e('0x22'),_0xdc8e('0x23'),_0xdc8e('0x24'),_0xdc8e('0x25')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![],'defaultValue':_0xdc8e('0x26'),'set':function(_0x4e7c4a){this[_0xdc8e('0x5')](_0xdc8e('0x27'),_0x4e7c4a?_0x4e7c4a['join'](','):null);},'get':function(){return this[_0xdc8e('0xc')]('transport')?this[_0xdc8e('0xc')](_0xdc8e('0x27'))['split'](','):null;},'comment':_0xdc8e('0x28')},'dtmfmode':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x29'),_0xdc8e('0x2a'),_0xdc8e('0x2b'),'inband',_0xdc8e('0x2c')),'allowNull':!![],'defaultValue':_0xdc8e('0x29')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xdc8e('0x2d'),_0xdc8e('0x2e'),_0xdc8e('0x2f')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xdc8e('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![],'defaultValue':_0xdc8e('0x31'),'set':function(_0x5393b3){this['setDataValue'](_0xdc8e('0x32'),_0x5393b3?_0x5393b3[_0xdc8e('0x33')](','):null);},'get':function(){return this[_0xdc8e('0xc')](_0xdc8e('0x32'))?this['getDataValue']('nat')[_0xdc8e('0x34')](','):null;},'comment':_0xdc8e('0x35')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xdc8e('0x8')]},'pickupgroup':{'type':Sequelize[_0xdc8e('0x8')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xdc8e('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdc8e('0x8')]},'disallow':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':![],'defaultValue':_0xdc8e('0x36')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdc8e('0x37'),'set':function(_0x9d7f01){this[_0xdc8e('0x5')]('allow',_0x9d7f01?_0x9d7f01[_0xdc8e('0x33')](';'):_0xdc8e('0x37'));},'get':function(){return this[_0xdc8e('0xc')](_0xdc8e('0x38'))?this[_0xdc8e('0xc')](_0xdc8e('0x38'))[_0xdc8e('0x34')](';'):null;},'comment':_0xdc8e('0x39')},'autoframing':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![],'set':function(_0x46c324){this[_0xdc8e('0x5')]('insecure',_0x46c324?_0x46c324[_0xdc8e('0x33')](','):null);},'get':function(){return this[_0xdc8e('0xc')](_0xdc8e('0x3a'))?this[_0xdc8e('0xc')](_0xdc8e('0x3a'))[_0xdc8e('0x34')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xdc8e('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no',_0xdc8e('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xdc8e('0x30'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xdc8e('0x1b')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![],'defaultValue':_0xdc8e('0x3c')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![],'defaultValue':_0xdc8e('0x30')},'busylevel':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xdc8e('0x30'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xdc8e('0x30'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xdc8e('0x30'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no',_0xdc8e('0x3d')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xdc8e('0x1b')]('accept',_0xdc8e('0x3e'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xdc8e('0x1b')]('uac','uas'),'allowNull':!![],'defaultValue':_0xdc8e('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![],'defaultValue':_0xdc8e('0x30')},'keepalive':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xdc8e('0x30'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no',_0xdc8e('0x40'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xdc8e('0x19')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xdc8e('0x1b')]('active','passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xdc8e('0x1b')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xdc8e('0x1b')]('yes','no','nonat',_0xdc8e('0x2e'),_0xdc8e('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xdc8e('0x17')]},'passwordResetAt':{'type':Sequelize[_0xdc8e('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['STRING']},'showWebBar':{'type':Sequelize[_0xdc8e('0x19')],'defaultValue':0x0,'set':function(_0x4255a6){this[_0xdc8e('0x5')]('showWebBar',_0x4255a6);var _0x490999=this[_0xdc8e('0x42')]({'plain':!![]});switch(_0x4255a6){case 0x0:case 0x1:var _0x5704e6=_0x490999[_0xdc8e('0x27')]?_[_0xdc8e('0x43')](_0x490999[_0xdc8e('0x27')])?_0x490999['transport'][_0xdc8e('0x33')]():_0x490999[_0xdc8e('0x27')]:_0xdc8e('0x26');if(_0x5704e6===_0xdc8e('0x44')){_0x5704e6=_0xdc8e('0x26');}this['setDataValue']('transport',_0x5704e6);this[_0xdc8e('0x5')](_0xdc8e('0x45'),'no');this[_0xdc8e('0x5')](_0xdc8e('0x46'),null);this[_0xdc8e('0x5')]('force_avp',null);this['setDataValue'](_0xdc8e('0x47'),null);this[_0xdc8e('0x5')](_0xdc8e('0x48'),null);this[_0xdc8e('0x5')]('dtlsverify',null);this[_0xdc8e('0x5')]('dtlssetup',null);this['setDataValue'](_0xdc8e('0x49'),null);this[_0xdc8e('0x5')](_0xdc8e('0x4a'),null);this['setDataValue'](_0xdc8e('0x4b'),'no');break;case 0x2:this[_0xdc8e('0x5')](_0xdc8e('0x27'),_0xdc8e('0x44'));this[_0xdc8e('0x5')](_0xdc8e('0x45'),_0xdc8e('0x30'));this[_0xdc8e('0x5')](_0xdc8e('0x46'),_0xdc8e('0x30'));this[_0xdc8e('0x5')](_0xdc8e('0x4c'),_0xdc8e('0x30'));this['setDataValue'](_0xdc8e('0x47'),'yes');this[_0xdc8e('0x5')]('dtlsenable',_0xdc8e('0x30'));this['setDataValue'](_0xdc8e('0x4d'),'no');this[_0xdc8e('0x5')](_0xdc8e('0x4e'),'actpass');this[_0xdc8e('0x5')]('dtlscertfile',_0x490999[_0xdc8e('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0xdc8e('0x5')]('dtlsprivatekey',_0x490999[_0xdc8e('0x4a')]||_0xdc8e('0x4f'));this[_0xdc8e('0x5')](_0xdc8e('0x4b'),_0xdc8e('0x30'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x2743b9){this['setDataValue'](_0xdc8e('0x50'),_0x2743b9?_0x2743b9['join'](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0xdc8e('0x51')](this['getDataValue']('permissions')[_0xdc8e('0x34')](','),function(_0x4a46d3){return parseInt(_0x4a46d3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xdc8e('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xdc8e('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xdc8e('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xdc8e('0x1b')](_0xdc8e('0x30'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xdc8e('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdc8e('0x52')],'get':function(){return this[_0xdc8e('0xc')](_0xdc8e('0x53'))?this[_0xdc8e('0xc')](_0xdc8e('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0xdc8e('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xdc8e('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![],'set':function(_0x52c983){if(typeof _0x52c983===_0xdc8e('0x54')){var _0x1c281e=_0x52c983==='1'?!![]:_0x52c983==='0'?![]:_0x52c983===_0xdc8e('0x55')?!![]:_0x52c983===_0xdc8e('0x56')?![]:![];this[_0xdc8e('0x5')](_0xdc8e('0x57'),_0x1c281e);}else{this['setDataValue'](_0xdc8e('0x57'),_0x52c983);}}},'blocked':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':![],'set':function(_0x1e765d){this[_0xdc8e('0x5')](_0xdc8e('0x58'),_0x1e765d);if(_0x1e765d===!![]){this[_0xdc8e('0x5')](_0xdc8e('0x59'),moment());this[_0xdc8e('0x5')](_0xdc8e('0x5a'),0x0);}else{this[_0xdc8e('0x5')](_0xdc8e('0x59'),null);}}},'blockedAt':{'type':Sequelize[_0xdc8e('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xdc8e('0x19')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xdc8e('0x16')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index af7e3df..015a095 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 _0x0475=['channel','isValidChannel','Queue:remove','addAvatar','userpic','file','filename','join','server/files/images/logos/default_profile.png','download','existsSync','root','server/files/images/','getContacts','order','CmList','List','Tags','color','tag','getQueues','Queue','getVoiceQueuesRt','getGroups','ChatGroup','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','ChatInteraction','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','emit','user:forcelogout','x-forwarded-for','connection','socket','remoteAddress','UserVoiceQueue.penalty','each','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','LOGININPAUSE','concat','resolve','pause','QueuePause','updateAttributes','PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','whatsapppause','pauseType','manual','mail','chat','sms','whatsapp','openchannel','getTeams','Team','addTeams','getVoiceQueues','setDataValue','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','getWhatsappQueues','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','upsert','removeTeams','Voice','Whatsapp','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$lt','$ne','$eq','$in','$notIn','$like','$overlap','$contains','$contained','phone','CmContact','Contact','dialActive','VoiceQueue','getApiKey','retrieveApiKey','json','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','message','catch','status','end','count','offset','set','apply','reject','update','destroy','role','Users','user','Agents','agent','telephone','filter','ignore','map','value','includes','name','UserProfileResource','send','index','User','rawAttributes','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filters','where','merge','sequelize','lower','col','options','includeAll','include','rows','params','differenceBy','keys','password','salt','find','body','describe','addContacts','ids','omit','internal','securePassword','validatePasswordPattern','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','mailbox','VoiceMail','fullname','permissions','102','103','113','110','104','105','106','107','108','109','100','111','114','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','UserProfileSection','Telephones','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','findAll','isEmpty','autoAssociation','compact','all','Sequelize','ValidationError','authenticate','oldPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','interface','Unknown\x20channel','add','capitalize','toLowerCase','Queues','QueueId','Queue:save','voice','get','format','penalty','UserVoiceQueueRt','removeQueues'];(function(_0x5cbe68,_0x49da4b){var _0x59ac20=function(_0x417c00){while(--_0x417c00){_0x5cbe68['push'](_0x5cbe68['shift']());}};_0x59ac20(++_0x49da4b);}(_0x0475,0xbc));var _0x5047=function(_0x13f1eb,_0x141549){_0x13f1eb=_0x13f1eb-0x0;var _0x27fded=_0x0475[_0x13f1eb];return _0x27fded;};'use strict';var pdf=require(_0x5047('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5047('0x1'));var jsonpatch=require(_0x5047('0x2'));var rp=require(_0x5047('0x3'));var moment=require(_0x5047('0x4'));var BPromise=require(_0x5047('0x5'));var Mustache=require('mustache');var util=require(_0x5047('0x6'));var path=require(_0x5047('0x7'));var sox=require(_0x5047('0x8'));var csv=require(_0x5047('0x9'));var ejs=require(_0x5047('0xa'));var fs=require('fs');var _=require(_0x5047('0xb'));var squel=require('squel');var crypto=require(_0x5047('0xc'));var jsforce=require(_0x5047('0xd'));var deskjs=require(_0x5047('0xe'));var toCsv=require(_0x5047('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5047('0xf'));var authService=require(_0x5047('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5047('0x11'));var logger=require(_0x5047('0x12'))(_0x5047('0x13'));var utils=require(_0x5047('0x14'));var config=require(_0x5047('0x15'));var licenseUtil=require(_0x5047('0x16'));var db=require(_0x5047('0x17'))['db'];config[_0x5047('0x18')]=_[_0x5047('0x19')](config[_0x5047('0x18')],{'host':_0x5047('0x1a'),'port':0x18eb});var socket=require(_0x5047('0x1b'))(new Redis(config[_0x5047('0x18')]));require(_0x5047('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x5047('0x1d')][_0x5047('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x54055b,_0x35d82c,_0x22cdff,_0x15243c){return new BPromise(function(_0x3bc7c8,_0x31d2c4){var _0x3ac989=_0x15243c||client;return _0x3ac989[_0x5047('0x1f')](_0x54055b,_0x22cdff)[_0x5047('0x20')](function(_0x55e731){logger[_0x5047('0x21')](_0x5047('0x22'),_0x35d82c,_0x5047('0x23'));logger['debug'](_0x5047('0x24'),_0x35d82c,'request\x20sent',JSON['stringify'](_0x55e731));if(_0x55e731['error']){if(_0x55e731[_0x5047('0x25')]['code']===0x1f4){logger['error'](_0x5047('0x22'),_0x35d82c,_0x55e731[_0x5047('0x25')]['message']);return _0x31d2c4(_0x55e731[_0x5047('0x25')][_0x5047('0x26')]);}logger['error'](_0x5047('0x22'),_0x35d82c,_0x55e731[_0x5047('0x25')]['message']);return _0x3bc7c8(_0x55e731['error'][_0x5047('0x26')]);}else{logger[_0x5047('0x21')](_0x5047('0x22'),_0x35d82c,'request\x20sent');_0x3bc7c8(_0x55e731['result'][_0x5047('0x26')]);}})[_0x5047('0x27')](function(_0x432739){logger[_0x5047('0x25')](_0x5047('0x22'),_0x35d82c,_0x432739);_0x31d2c4(_0x432739);});});}function respondWithStatusCode(_0x313833,_0x1b6ad1){_0x1b6ad1=_0x1b6ad1||0xcc;return function(_0x6c0c22){if(_0x6c0c22){return _0x313833['sendStatus'](_0x1b6ad1);}return _0x313833[_0x5047('0x28')](_0x1b6ad1)[_0x5047('0x29')]();};}function respondWithResult(_0x4d4674,_0x2b5f5e){_0x2b5f5e=_0x2b5f5e||0xc8;return function(_0x2bd22e){if(_0x2bd22e){return _0x4d4674[_0x5047('0x28')](_0x2b5f5e)['json'](_0x2bd22e);}};}function respondWithFilteredResult(_0x4ff7d2,_0x11fa6a){return function(_0x437057){if(_0x437057){var _0x4b69f1=_0x437057[_0x5047('0x2a')],_0x5f2fe5=_0x11fa6a[_0x5047('0x2b')],_0x442c2e=_0x11fa6a[_0x5047('0x2b')]+_0x11fa6a['limit'],_0x207766;if(_0x442c2e>=_0x4b69f1){_0x442c2e=_0x4b69f1;_0x207766=0xc8;}else{_0x207766=0xce;}_0x4ff7d2['status'](_0x207766);return _0x4ff7d2[_0x5047('0x2c')]('Content-Range',_0x5f2fe5+'-'+_0x442c2e+'/'+_0x4b69f1)['json'](_0x437057);}return null;};}function patchUpdates(_0x1173fd){return function(_0x563638){try{jsonpatch[_0x5047('0x2d')](_0x563638,_0x1173fd,!![]);}catch(_0x5768c2){return BPromise[_0x5047('0x2e')](_0x5768c2);}return _0x563638['save']();};}function saveUpdates(_0x28484e,_0x294514){return function(_0x9e3b8d){if(_0x9e3b8d){return _0x9e3b8d[_0x5047('0x2f')](_0x28484e)['then'](function(_0xe0dd8b){return _0xe0dd8b;});}return null;};}function removeEntity(_0x3e8e70,_0x53ee6a){return function(_0x16e472){if(_0x16e472){return _0x16e472[_0x5047('0x30')]()['then'](function(){var _0x1af228=_0x16e472['get']({'plain':!![]});if(_0x1af228[_0x5047('0x31')]==='admin')return;var _0x194000=[{'name':_0x5047('0x32'),'value':_0x5047('0x33'),'ignore':!![]},{'name':_0x5047('0x34'),'value':_0x5047('0x35'),'ignore':![]},{'name':'Telephones','value':_0x5047('0x36'),'ignore':![]}];var _0x1d4523=_(_0x194000)[_0x5047('0x37')](_0x5047('0x38'))[_0x5047('0x39')](_0x5047('0x3a'))[_0x5047('0x3a')]();if(_[_0x5047('0x3b')](_0x1d4523,_0x1af228[_0x5047('0x31')])){return;}var _0x16f98b=_['find'](_0x194000,['value',_0x1af228['role']])[_0x5047('0x3c')];return db[_0x5047('0x3d')][_0x5047('0x30')]({'where':{'type':_0x16f98b,'resourceId':_0x1af228['id']}})[_0x5047('0x20')](function(){return _0x16e472;});})[_0x5047('0x20')](function(){_0x3e8e70[_0x5047('0x28')](0xcc)[_0x5047('0x29')]();});}};}function handleEntityNotFound(_0x5333bc,_0x40403a){return function(_0x319aec){if(!_0x319aec){_0x5333bc['sendStatus'](0x194);}return _0x319aec;};}function handleError(_0x1f9ac4,_0x38e301){_0x38e301=_0x38e301||0x1f4;return function(_0x340774){logger['error'](_0x340774['stack']);if(_0x340774[_0x5047('0x3c')]){delete _0x340774[_0x5047('0x3c')];}_0x1f9ac4[_0x5047('0x28')](_0x38e301)[_0x5047('0x3e')](_0x340774);};}exports[_0x5047('0x3f')]=function(_0x28a867,_0x23f339){var _0x46a136={},_0x16d6d3={},_0x28f776={'count':0x0,'rows':[]};var _0x1d8b58=_[_0x5047('0x39')](db[_0x5047('0x40')][_0x5047('0x41')],function(_0x499284){return{'name':_0x499284['fieldName'],'type':_0x499284[_0x5047('0x42')][_0x5047('0x43')]};});_0x16d6d3['model']=_['differenceBy'](_['map'](_0x1d8b58,'name'),['password','salt']);_0x16d6d3[_0x5047('0x44')]=_['keys'](_0x28a867[_0x5047('0x44')]);_0x16d6d3['filters']=_[_0x5047('0x45')](_0x16d6d3[_0x5047('0x46')],_0x16d6d3[_0x5047('0x44')]);_0x46a136['attributes']=_[_0x5047('0x45')](_0x16d6d3['model'],qs[_0x5047('0x47')](_0x28a867[_0x5047('0x44')][_0x5047('0x47')]));_0x46a136[_0x5047('0x48')]=_0x46a136['attributes'][_0x5047('0x49')]?_0x46a136[_0x5047('0x48')]:_0x16d6d3[_0x5047('0x46')];if(!_0x28a867['query'][_0x5047('0x4a')](_0x5047('0x4b'))){_0x46a136['limit']=qs[_0x5047('0x4c')](_0x28a867[_0x5047('0x44')]['limit']);_0x46a136[_0x5047('0x2b')]=qs['offset'](_0x28a867[_0x5047('0x44')][_0x5047('0x2b')]);}_0x46a136['order']=qs[_0x5047('0x4d')](_0x28a867[_0x5047('0x44')][_0x5047('0x4d')]);_0x46a136['where']=qs['filters'](_[_0x5047('0x4e')](_0x28a867[_0x5047('0x44')],_0x16d6d3[_0x5047('0x4f')]),_0x1d8b58);if(_0x28a867[_0x5047('0x44')][_0x5047('0x37')]){_0x46a136[_0x5047('0x50')]=_[_0x5047('0x51')](_0x46a136[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x1d8b58,function(_0x162072){if(_0x162072[_0x5047('0x42')]!=='VIRTUAL'){return db['sequelize'][_0x5047('0x50')](db[_0x5047('0x52')]['fn'](_0x5047('0x53'),db[_0x5047('0x52')][_0x5047('0x54')](_0x162072[_0x5047('0x3c')])),{'$like':db[_0x5047('0x52')]['fn'](_0x5047('0x53'),'%'+_0x28a867['query'][_0x5047('0x37')]+'%')});}})});}_0x46a136=_[_0x5047('0x51')]({},_0x46a136,_0x28a867[_0x5047('0x55')]);var _0x43a292={'where':_0x46a136[_0x5047('0x50')]};return db[_0x5047('0x40')]['count'](_0x43a292)[_0x5047('0x20')](function(_0x16cf72){_0x28f776[_0x5047('0x2a')]=_0x16cf72;if(_0x28a867[_0x5047('0x44')][_0x5047('0x56')]){_0x46a136[_0x5047('0x57')]=[{'all':!![]}];}return db[_0x5047('0x40')]['findAll'](_0x46a136);})['then'](function(_0x17d86d){_0x28f776[_0x5047('0x58')]=_0x17d86d;return _0x28f776;})['then'](respondWithFilteredResult(_0x23f339,_0x46a136))[_0x5047('0x27')](handleError(_0x23f339,null));};exports['show']=function(_0x4fe580,_0x1566a7){var _0x229de5={'raw':![],'where':{'id':_0x4fe580[_0x5047('0x59')]['id']}},_0x2ca9ac={};_0x2ca9ac['model']=_[_0x5047('0x5a')](_[_0x5047('0x5b')](db[_0x5047('0x40')][_0x5047('0x41')]),[_0x5047('0x5c'),_0x5047('0x5d')]);_0x2ca9ac['query']=_['keys'](_0x4fe580[_0x5047('0x44')]);_0x2ca9ac['filters']=_['intersection'](_0x2ca9ac[_0x5047('0x46')],_0x2ca9ac[_0x5047('0x44')]);_0x229de5[_0x5047('0x48')]=_['intersection'](_0x2ca9ac[_0x5047('0x46')],qs[_0x5047('0x47')](_0x4fe580[_0x5047('0x44')][_0x5047('0x47')]));_0x229de5[_0x5047('0x48')]=_0x229de5[_0x5047('0x48')]['length']?_0x229de5['attributes']:_0x2ca9ac['model'];if(_0x4fe580[_0x5047('0x44')][_0x5047('0x56')]){_0x229de5['include']=[{'all':!![]}];}_0x229de5=_[_0x5047('0x51')]({},_0x229de5,_0x4fe580[_0x5047('0x55')]);return db[_0x5047('0x40')][_0x5047('0x5e')](_0x229de5)[_0x5047('0x20')](handleEntityNotFound(_0x1566a7,null))[_0x5047('0x20')](respondWithResult(_0x1566a7,null))[_0x5047('0x27')](handleError(_0x1566a7,null));};exports[_0x5047('0x2f')]=function(_0x163ad2,_0x4ef512){if(_0x163ad2[_0x5047('0x5f')]['id']){delete _0x163ad2['body']['id'];}delete _0x163ad2[_0x5047('0x5f')][_0x5047('0x31')];return db['User'][_0x5047('0x5e')]({'where':{'id':_0x163ad2['params']['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x4ef512,null))['then'](saveUpdates(_0x163ad2[_0x5047('0x5f')],null))[_0x5047('0x20')](respondWithResult(_0x4ef512,null))[_0x5047('0x27')](handleError(_0x4ef512,null));};exports[_0x5047('0x60')]=function(_0x10b3b6,_0x44e068){return db['User'][_0x5047('0x60')]()[_0x5047('0x20')](respondWithResult(_0x44e068,null))['catch'](handleError(_0x44e068,null));};exports[_0x5047('0x61')]=function(_0x105df8,_0xaea27,_0x3c8331){return db['User'][_0x5047('0x5e')]({'where':{'id':_0x105df8[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0xaea27,null))[_0x5047('0x20')](function(_0x44dd9f){if(_0x44dd9f){return _0x44dd9f['addContacts'](_0x105df8['body'][_0x5047('0x62')],_[_0x5047('0x63')](_0x105df8[_0x5047('0x5f')],['ids','id'])||{});}})[_0x5047('0x20')](respondWithResult(_0xaea27,null))[_0x5047('0x27')](handleError(_0xaea27,null));};function validateUser(_0x4db0d2){return new BPromise(function(_0x453875,_0x2141f0){if(_0x4db0d2[_0x5047('0x64')])return _0x453875(_0x4db0d2);return db['Setting']['findById'](0x1)[_0x5047('0x20')](function(_0x329856){if(_0x329856[_0x5047('0x65')])authService[_0x5047('0x66')](_0x4db0d2['password']);db['User'][_0x5047('0x67')](_0x5047('0x64'))[_0x5047('0x20')](function(_0x208c5c){if(_[_0x5047('0x68')](_0x208c5c)){_0x4db0d2[_0x5047('0x64')]=_0x329856['min_internal']||0x1;return;}if(_['isNil'](_0x329856[_0x5047('0x69')])||_0x329856[_0x5047('0x69')]===_0x208c5c){_0x4db0d2[_0x5047('0x64')]=_0x208c5c+0x1;return;}if(_0x329856[_0x5047('0x69')]>_0x208c5c){_0x4db0d2[_0x5047('0x64')]=_0x329856[_0x5047('0x69')];return;}return db[_0x5047('0x52')]['query'](_0x5047('0x6a'),{'type':db[_0x5047('0x52')][_0x5047('0x6b')][_0x5047('0x6c')]})[_0x5047('0x20')](function(_0xb54b55){if(_0xb54b55&&_0xb54b55['length']){for(var _0x14a32d=0x0,_0x155a32=_0xb54b55[_0x5047('0x49')];_0x14a32d<_0x155a32&&_[_0x5047('0x68')](_0x4db0d2[_0x5047('0x64')]);_0x14a32d++){if(_0x329856[_0x5047('0x69')]<=_0xb54b55[_0x14a32d][_0x5047('0x6d')]){_0x4db0d2['internal']=_0xb54b55[_0x14a32d]['from'];}else if(_0x329856[_0x5047('0x69')]>_0xb54b55[_0x14a32d][_0x5047('0x6d')]&&_0x329856[_0x5047('0x69')]<=_0xb54b55[_0x14a32d]['to']){_0x4db0d2[_0x5047('0x64')]=_0x329856[_0x5047('0x69')];}}}if(_[_0x5047('0x68')](_0x4db0d2[_0x5047('0x64')])){_0x4db0d2[_0x5047('0x64')]=_0x208c5c+0x1;}return _0x453875(_0x4db0d2);});});})[_0x5047('0x27')](function(_0x49389c){_0x2141f0(_0x49389c);});});}function updateUser(_0x5261fe){return new BPromise(function(_0x5052f1,_0x54bbac){try{if(_0x5261fe['voicemail']){_0x5261fe[_0x5047('0x6e')]=_0x5261fe[_0x5047('0x64')];_0x5261fe[_0x5047('0x6f')]={'mailbox':_0x5261fe[_0x5047('0x64')],'password':_0x5261fe['password'],'fullname':_0x5261fe[_0x5047('0x70')],'email':_0x5261fe['email']};}if(_0x5261fe[_0x5047('0x31')]===_0x5047('0x35')){if(!_0x5261fe[_0x5047('0x71')])_0x5261fe['permissions']=['101',_0x5047('0x72'),_0x5047('0x73'),_0x5047('0x74'),_0x5047('0x75'),_0x5047('0x76'),_0x5047('0x77'),_0x5047('0x78'),_0x5047('0x79'),_0x5047('0x7a'),_0x5047('0x7b'),_0x5047('0x7c'),_0x5047('0x7d'),_0x5047('0x7e')];}_0x5052f1(_0x5261fe);}catch(_0x2dddc8){_0x54bbac(_0x2dddc8);}});}exports[_0x5047('0x7f')]=function(_0x5c8e9b,_0x4d154d){if(_0x5c8e9b['user'][_0x5047('0x31')]===_0x5047('0x35'))throw new Error(_0x5047('0x80'));if(_0x5c8e9b['body'][_0x5047('0x31')]===_0x5047('0x33')&&_0x5c8e9b[_0x5047('0x33')][_0x5047('0x31')]!==_0x5047('0x81')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5c8e9b['body'][_0x5047('0x31')]===_0x5047('0x81')&&_0x5c8e9b['user'][_0x5047('0x31')]!==_0x5047('0x81')){throw new Error(_0x5047('0x82'));}return licenseUtil['checkUserLimits']([_0x5c8e9b[_0x5047('0x5f')]])[_0x5047('0x20')](function(){return validateUser(_0x5c8e9b[_0x5047('0x5f')]);})['then'](function(_0x1101ea){return updateUser(_0x1101ea)[_0x5047('0x20')](function(_0xbeb5c6){if(_0xbeb5c6[_0x5047('0x31')]===_0x5047('0x81')){_0xbeb5c6[_0x5047('0x83')]=_0x5c8e9b[_0x5047('0x33')][_0x5047('0x83')];delete _0xbeb5c6['userProfileId'];}return _0xbeb5c6;});})[_0x5047('0x20')](function(_0x3a9255){return db[_0x5047('0x40')][_0x5047('0x7f')](_0x3a9255,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})['then'](function(_0x5be55f){if(_0x5c8e9b[_0x5047('0x5f')][_0x5047('0x31')]===_0x5047('0x33'))return _0x5be55f;if(_0x5c8e9b[_0x5047('0x33')][_0x5047('0x31')]!==_0x5047('0x33'))return _0x5be55f;return db[_0x5047('0x84')]['find']({'where':{'name':_0x5be55f[_0x5047('0x31')]===_0x5047('0x35')?_0x5047('0x34'):_0x5047('0x85'),'userProfileId':_0x5c8e9b[_0x5047('0x33')][_0x5047('0x86')]},'raw':!![]})[_0x5047('0x20')](function(_0x5e757b){if(!_0x5e757b||_0x5e757b['autoAssociation']!=0x0)return _0x5be55f;return db[_0x5047('0x3d')][_0x5047('0x7f')]({'name':_0x5be55f[_0x5047('0x3c')],'resourceId':_0x5be55f['id'],'type':_0x5e757b[_0x5047('0x3c')],'sectionId':_0x5e757b['id']},{})[_0x5047('0x20')](function(){return _0x5be55f;});})['catch'](function(_0x3f89dd){logger[_0x5047('0x25')](_0x5047('0x87'),_0x3f89dd);throw _0x3f89dd;});})[_0x5047('0x20')](respondWithResult(_0x4d154d,0xc9))[_0x5047('0x27')](handleError(_0x4d154d,null));};exports[_0x5047('0x88')]=function(_0xc5fd0c,_0x23d595){var _0x2bc903=_0xc5fd0c['body'];var _0x3fb3ae=[];if(_0xc5fd0c['user'][_0x5047('0x31')]==='agent')throw new Error(_0x5047('0x80'));if(_[_0x5047('0x89')](_0x2bc903,[_0x5047('0x31'),_0x5047('0x33')])&&_0xc5fd0c['user']['role']!=='admin'){throw new Error(_0x5047('0x8a'));}if(_['some'](_0x2bc903,[_0x5047('0x31'),_0x5047('0x81')])&&_0xc5fd0c[_0x5047('0x33')]['role']!==_0x5047('0x81')){throw new Error(_0x5047('0x8b'));}return licenseUtil['checkUserLimits'](_0x2bc903)[_0x5047('0x20')](function(){return validateUser(_0x2bc903[0x0]);})[_0x5047('0x20')](function(){for(var _0x31bc4d=0x1;_0x31bc4d<_0x2bc903[_0x5047('0x49')];_0x31bc4d++){var _0x2969ef=_0x2bc903[_0x31bc4d-0x1][_0x5047('0x64')];if(!_0x2bc903[_0x31bc4d][_0x5047('0x64')])_0x2bc903[_0x31bc4d][_0x5047('0x64')]=_0x2969ef+0x1;_0x3fb3ae['push'](validateUser(_0x2bc903[_0x31bc4d]));}return BPromise['all'](_0x3fb3ae);})[_0x5047('0x20')](function(){_0x3fb3ae=[];for(var _0x5ba3d5=0x0;_0x5ba3d5<_0x2bc903[_0x5047('0x49')];_0x5ba3d5++){_0x3fb3ae[_0x5047('0x8c')](updateUser(_0x2bc903[_0x5ba3d5]));}return BPromise['all'](_0x3fb3ae);})[_0x5047('0x20')](function(){return BPromise['each'](_0x2bc903,function(_0x21b16b){return db['User'][_0x5047('0x7f')](_0x21b16b,{'include':[{'model':db[_0x5047('0x6f')],'as':_0x5047('0x6f')}]})[_0x5047('0x20')](function(_0x3380de){_0x21b16b['id']=_0x3380de['id'];return _0x21b16b;});});})[_0x5047('0x20')](function(_0xabc4ab){if(_0xc5fd0c[_0x5047('0x5f')][_0x5047('0x31')]===_0x5047('0x33'))return _0xabc4ab;if(_0xc5fd0c[_0x5047('0x33')][_0x5047('0x31')]!==_0x5047('0x33'))return _0xabc4ab;var _0x330d6f=_[_0x5047('0x89')](_0xabc4ab,function(_0x55cdb9){return _0x55cdb9[_0x5047('0x31')]==='agent'||_0x55cdb9[_0x5047('0x31')]===_0x5047('0x36');});if(!_0x330d6f)return _0xabc4ab;return db[_0x5047('0x84')][_0x5047('0x8d')]({'where':{'name':{'$or':[_0x5047('0x34'),_0x5047('0x85')]},'userProfileId':_0xc5fd0c['user'][_0x5047('0x86')]},'raw':!![]})[_0x5047('0x20')](function(_0x5bbdec){if(_[_0x5047('0x8e')](_0x5bbdec)||!_[_0x5047('0x89')](_0x5bbdec,[_0x5047('0x8f'),0x0]))return _0xabc4ab;_0x3fb3ae=[];var _0x21f708=_(_0x5bbdec)[_0x5047('0x39')](function(_0xcc9827){if(_0xcc9827[_0x5047('0x8f')]===0x1)return;return _0xcc9827[_0x5047('0x3c')]===_0x5047('0x34')?_0x5047('0x35'):'telephone';})[_0x5047('0x90')]()[_0x5047('0x3a')]();for(var _0x57dc29=0x0;_0x57dc29<_0xabc4ab[_0x5047('0x49')];_0x57dc29++){if(!_[_0x5047('0x3b')](_0x21f708,_0xabc4ab[_0x57dc29][_0x5047('0x31')]))return;var _0x2e5ebd=_0xabc4ab[_0x57dc29]['role']===_0x5047('0x35')?_0x5047('0x34'):_0x5047('0x85');_0x3fb3ae['push'](db[_0x5047('0x3d')][_0x5047('0x7f')]({'name':_0xabc4ab[_0x57dc29][_0x5047('0x3c')],'resourceId':_0xabc4ab[_0x57dc29]['id'],'type':_0x2e5ebd,'sectionId':_[_0x5047('0x5e')](_0x5bbdec,[_0x5047('0x3c'),_0x2e5ebd])['id']},{}));}return BPromise[_0x5047('0x91')](_0x3fb3ae);})['then'](respondWithResult(_0x23d595,0xc9))[_0x5047('0x27')](handleError(_0x23d595,null));});};exports['changePassword']=function(_0x1d39bf,_0x2b384d,_0x3b2b93){if(_0x1d39bf[_0x5047('0x5f')]['id']){delete _0x1d39bf[_0x5047('0x5f')]['id'];}return db[_0x5047('0x40')][_0x5047('0x5e')]({'where':{'id':_0x1d39bf[_0x5047('0x59')]['id']}})[_0x5047('0x20')](function(_0x57ddbf){if(!_0x57ddbf)return null;if(_0x57ddbf['id']===_0x1d39bf['user']['id']){if(!_0x1d39bf[_0x5047('0x5f')]['oldPassword']||!_0x1d39bf['body']['newPassword']){throw new db[(_0x5047('0x92'))][(_0x5047('0x93'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x57ddbf[_0x5047('0x94')](_0x1d39bf[_0x5047('0x5f')][_0x5047('0x95')])){throw new db['Sequelize']['ValidationError'](_0x5047('0x96'));}if(_0x1d39bf[_0x5047('0x5f')][_0x5047('0x95')]===_0x1d39bf[_0x5047('0x5f')]['newPassword']){throw new db[(_0x5047('0x92'))][(_0x5047('0x93'))](_0x5047('0x97'));}}else if(_0x1d39bf[_0x5047('0x33')]['role']===_0x5047('0x81')){if(!_0x1d39bf[_0x5047('0x5f')][_0x5047('0x98')]){throw new db[(_0x5047('0x92'))][(_0x5047('0x93'))](_0x5047('0x99'));}}else if(_0x1d39bf[_0x5047('0x33')][_0x5047('0x31')]===_0x5047('0x33')){if(!_0x1d39bf[_0x5047('0x5f')][_0x5047('0x98')]){throw new db[(_0x5047('0x92'))][(_0x5047('0x93'))](_0x5047('0x99'));}if(_0x57ddbf[_0x5047('0x31')]!=='agent'){throw new db[(_0x5047('0x92'))][(_0x5047('0x93'))]('Unauthorized');}}else{throw new db[(_0x5047('0x92'))][(_0x5047('0x93'))](_0x5047('0x80'));}return _0x57ddbf;})['then'](handleEntityNotFound(_0x2b384d,null))['then'](function(_0x27c2b6){return db[_0x5047('0x9a')][_0x5047('0x9b')]({'attributes':['id',_0x5047('0x65'),_0x5047('0x9c'),'passwordHistoryLimit']})[_0x5047('0x20')](function(_0x80e827){if(_0x80e827['securePassword'])authService[_0x5047('0x66')](_0x1d39bf[_0x5047('0x5f')][_0x5047('0x98')]);if(!_0x80e827[_0x5047('0x9c')]||!_0x27c2b6[_0x5047('0x9d')])return _0x27c2b6;authService[_0x5047('0x9e')](_0x1d39bf['body'][_0x5047('0x98')],_0x27c2b6[_0x5047('0x9d')],_0x80e827['passwordHistoryLimit']);return _0x27c2b6;})[_0x5047('0x20')](saveUpdates({'password':_0x1d39bf['body'][_0x5047('0x98')],'passwordResetAt':_0x1d39bf[_0x5047('0x33')]['id']==_0x1d39bf[_0x5047('0x59')]['id']?moment():null,'previousPasswords':authService[_0x5047('0x9f')](_0x1d39bf[_0x5047('0x5f')][_0x5047('0x98')],_0x27c2b6[_0x5047('0x9d')])},null));})[_0x5047('0x20')](respondWithResult(_0x2b384d,null))[_0x5047('0x27')](handleError(_0x2b384d,null));};exports[_0x5047('0xa0')]=function(_0xa33aec,_0x3fa679,_0x5cdd3f){var _0x4f50b3=_0xa33aec['body']['channel'];return db['User'][_0x5047('0x5e')]({'where':{'id':_0xa33aec['params']['id']},'attributes':['id','name',_0x5047('0x31'),_0x5047('0xa1'),_0x5047('0xa2'),_0x5047('0xa3'),_0x5047('0xa4')]})['then'](handleEntityNotFound(_0x3fa679,null))[_0x5047('0x20')](function(_0x1cd70a){if(_0x1cd70a){if(!utils['isValidChannel'](_0x4f50b3)){throw new db[(_0x5047('0x92'))][(_0x5047('0x93'))](_0x5047('0xa5'));}return _0x1cd70a[_0x5047('0xa6')+_[_0x5047('0xa7')](_0x4f50b3[_0x5047('0xa8')]())+_0x5047('0xa9')](_0xa33aec[_0x5047('0x5f')]['ids'],{'penalty':_0xa33aec[_0x5047('0x5f')]['penalty']||0x0})['spread'](function(_0x57f037){for(var _0x47ac20=0x0;_0x47ac20<_0xa33aec[_0x5047('0x5f')][_0x5047('0x62')][_0x5047('0x49')];_0x47ac20+=0x1){var _0x47a94f={'UserId':_0xa33aec['params']['id']};_0x47a94f[_[_0x5047('0xa7')](_0x4f50b3['toLowerCase']())+_0x5047('0xaa')]=_0xa33aec[_0x5047('0x5f')][_0x5047('0x62')][_0x47ac20];socket['emit'](_0x5047('0x33')+_[_0x5047('0xa7')](_0x4f50b3[_0x5047('0xa8')]())+_0x5047('0xab'),_0x47a94f);}return _0x57f037;})[_0x5047('0x20')](function(){if(_0x4f50b3===_0x5047('0xac')){return db['VoiceQueue'][_0x5047('0x8d')]({'where':{'id':_0xa33aec['body'][_0x5047('0x62')]||[]},'raw':!![],'attributes':['id',_0x5047('0x3c')]});}})[_0x5047('0x20')](function(_0x4fa373){var _0x3ed1e3=_0x1cd70a[_0x5047('0xad')]({'plain':!![]});var _0x119991=[];if(_0x4f50b3===_0x5047('0xac')&&_0x3ed1e3[_0x5047('0x31')]==='agent'&&_0x3ed1e3['online']){for(var _0x48cfa4=0x0;_0x48cfa4<_0x4fa373['length'];_0x48cfa4+=0x1){_0x119991[_0x5047('0x8c')]({'membername':_0x3ed1e3[_0x5047('0x3c')],'UserId':_0x3ed1e3['id'],'queue_name':_0x4fa373[_0x48cfa4][_0x5047('0x3c')],'VoiceQueueId':_0x4fa373[_0x48cfa4]['id'],'interface':_['isNil'](_0x3ed1e3[_0x5047('0xa4')])?util[_0x5047('0xae')]('SIP/%s',_0x3ed1e3[_0x5047('0x3c')]):_0x3ed1e3['interface'],'paused':_0x3ed1e3[_0x5047('0xa3')]||![],'penalty':_0xa33aec[_0x5047('0x5f')][_0x5047('0xaf')]||0x0});}return BPromise['each'](_0x119991,function(_0x244a0a){return db[_0x5047('0xb0')]['upsert'](_0x244a0a);});}return _0x1cd70a;});}})[_0x5047('0x20')](respondWithStatusCode(_0x3fa679,null))[_0x5047('0x27')](handleError(_0x3fa679,null));};exports[_0x5047('0xb1')]=function(_0x3bbae2,_0x4d224e,_0x66e052){var _0x484a00;return db['User'][_0x5047('0x5e')]({'where':{'id':_0x3bbae2['params']['id']},'attributes':['id',_0x5047('0x3c'),_0x5047('0x31')]})[_0x5047('0x20')](handleEntityNotFound(_0x4d224e,null))[_0x5047('0x20')](function(_0x567ee4){if(_0x567ee4){_0x484a00=_0x567ee4;if(!_0x3bbae2[_0x5047('0x44')][_0x5047('0xb2')]||!utils[_0x5047('0xb3')](_0x3bbae2[_0x5047('0x44')][_0x5047('0xb2')])){throw new db['Sequelize'][(_0x5047('0x93'))](_0x5047('0xa5'));}return _0x567ee4['remove'+_[_0x5047('0xa7')](_0x3bbae2[_0x5047('0x44')][_0x5047('0xb2')][_0x5047('0xa8')]())+_0x5047('0xa9')](_0x3bbae2['query']['ids']);}})['then'](function(_0x5db7de){for(var _0x3f8502=0x0;_0x3f8502<_0x3bbae2[_0x5047('0x44')][_0x5047('0x62')][_0x5047('0x49')];_0x3f8502+=0x1){var _0xaa11be={'UserId':_0x3bbae2[_0x5047('0x59')]['id']};_0xaa11be[_['capitalize'](_0x3bbae2[_0x5047('0x44')][_0x5047('0xb2')]['toLowerCase']())+'QueueId']=_0x3bbae2[_0x5047('0x44')]['ids'][_0x3f8502];socket['emit'](_0x5047('0x33')+_[_0x5047('0xa7')](_0x3bbae2[_0x5047('0x44')][_0x5047('0xb2')][_0x5047('0xa8')]())+_0x5047('0xb4'),_0xaa11be);}return _0x5db7de;})['then'](function(){if(_0x3bbae2[_0x5047('0x44')][_0x5047('0xb2')]===_0x5047('0xac')){return db[_0x5047('0xb0')][_0x5047('0x30')]({'where':{'UserId':_0x3bbae2[_0x5047('0x59')]['id'],'VoiceQueueId':_0x3bbae2[_0x5047('0x44')][_0x5047('0x62')]},'individualHooks':!![]})[_0x5047('0x20')](function(){return _0x484a00;});}return _0x484a00;})[_0x5047('0x20')](respondWithStatusCode(_0x4d224e,null))[_0x5047('0x27')](handleError(_0x4d224e,null));};exports[_0x5047('0xb5')]=function(_0x5b9eec,_0x4cc295,_0x4d5b80){_0x5b9eec['body'][_0x5047('0xb6')]=_0x5b9eec[_0x5047('0xb7')][_0x5047('0xb8')];return db[_0x5047('0x40')][_0x5047('0x5e')]({'where':{'id':_0x5b9eec[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x4cc295,null))['then'](saveUpdates(_0x5b9eec['body'],null))['then'](respondWithResult(_0x4cc295,null))[_0x5047('0x27')](handleError(_0x4cc295,null));};exports['getAvatar']=function(_0x132c1a,_0x12f9f4,_0x3fe7f1){var _0x5180eb=path[_0x5047('0xb9')](config['root'],_0x5047('0xba'));return db[_0x5047('0x40')][_0x5047('0x5e')]({'where':{'id':_0x132c1a['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x5047('0x20')](handleEntityNotFound(_0x12f9f4,null))[_0x5047('0x20')](function(_0x153f9a){if(_0x153f9a){if(_[_0x5047('0x68')](_0x153f9a[_0x5047('0xb6')])){return _0x12f9f4[_0x5047('0xbb')](_0x5180eb);}else{if(!fs[_0x5047('0xbc')](path[_0x5047('0xb9')](config['root'],'server/files/images/',_0x153f9a[_0x5047('0xb6')]))){return _0x12f9f4[_0x5047('0xbb')](_0x5180eb);}return _0x12f9f4[_0x5047('0xbb')](path[_0x5047('0xb9')](config[_0x5047('0xbd')],_0x5047('0xbe'),_0x153f9a[_0x5047('0xb6')]));}}})[_0x5047('0x27')](handleError(_0x12f9f4,null));};exports[_0x5047('0xbf')]=function(_0x224d80,_0x1a618c,_0x548715){var _0x4c712f={};var _0x22960a={};var _0x2e3561;var _0x2b5cdb;return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x224d80[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x1a618c,null))[_0x5047('0x20')](function(_0x4f0522){if(_0x4f0522){_0x2e3561=_0x4f0522;_0x22960a[_0x5047('0x46')]=_[_0x5047('0x5b')](db['CmContact'][_0x5047('0x41')]);_0x22960a[_0x5047('0x44')]=_['keys'](_0x224d80['query']);_0x22960a[_0x5047('0x4f')]=_[_0x5047('0x45')](_0x22960a[_0x5047('0x46')],_0x22960a[_0x5047('0x44')]);_0x4c712f[_0x5047('0x48')]=_[_0x5047('0x45')](_0x22960a[_0x5047('0x46')],qs['fields'](_0x224d80[_0x5047('0x44')][_0x5047('0x47')]));_0x4c712f[_0x5047('0x48')]=_0x4c712f[_0x5047('0x48')][_0x5047('0x49')]?_0x4c712f[_0x5047('0x48')]:_0x22960a[_0x5047('0x46')];_0x4c712f[_0x5047('0xc0')]=qs['sort'](_0x224d80['query'][_0x5047('0x4d')]);_0x4c712f[_0x5047('0x50')]=qs[_0x5047('0x4f')](_[_0x5047('0x4e')](_0x224d80[_0x5047('0x44')],_0x22960a[_0x5047('0x4f')]));if(_0x224d80['query'][_0x5047('0x37')]){_0x4c712f[_0x5047('0x50')]=_[_0x5047('0x51')](_0x4c712f[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x4c712f[_0x5047('0x48')],function(_0x5b317e){var _0x28dded={};_0x28dded[_0x5b317e]={'$like':'%'+_0x224d80[_0x5047('0x44')]['filter']+'%'};return _0x28dded;})});}_0x4c712f=_['merge']({},_0x4c712f,_0x224d80['options']);return _0x2e3561['getContacts'](_0x4c712f);}})[_0x5047('0x20')](function(_0x14fc17){if(_0x14fc17){_0x2b5cdb=_0x14fc17[_0x5047('0x49')];if(_0x224d80[_0x5047('0x44')]['hasOwnProperty'](_0x5047('0x56'))){_0x4c712f[_0x5047('0x57')]=[{'model':db[_0x5047('0xc1')],'as':_0x5047('0xc2'),'required':![]},{'model':db['Tag'],'as':_0x5047('0xc3'),'attributes':['id',_0x5047('0x3c'),_0x5047('0xc4')],'where':_0x224d80[_0x5047('0x44')][_0x5047('0xc5')]?{'id':_0x224d80[_0x5047('0x44')]['tag']}:undefined,'required':_0x224d80[_0x5047('0x44')][_0x5047('0xc5')]?!![]:![]}];}if(!_0x224d80[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0x4c712f['limit']=qs['limit'](_0x224d80['query'][_0x5047('0x4c')]);_0x4c712f['offset']=qs[_0x5047('0x2b')](_0x224d80[_0x5047('0x44')][_0x5047('0x2b')]);}return _0x2e3561[_0x5047('0xbf')](_0x4c712f);}})[_0x5047('0x20')](function(_0x15e840){if(_0x15e840){return _0x15e840?{'count':_0x2b5cdb,'rows':_0x15e840}:null;}})[_0x5047('0x20')](respondWithResult(_0x1a618c,null))[_0x5047('0x27')](handleError(_0x1a618c,null));};exports[_0x5047('0xc6')]=function(_0xa2b466,_0x12726c,_0x121ac0){var _0x2716e8;var _0x4e8754;var _0x3a310a={};var _0x22a9ac;return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0xa2b466['params']['id']},'attributes':['id',_0x5047('0x3c'),_0x5047('0x31')]})[_0x5047('0x20')](handleEntityNotFound(_0x12726c,null))['then'](function(_0x359dc1){if(!utils[_0x5047('0xb3')](_0xa2b466[_0x5047('0x44')][_0x5047('0xb2')])){throw new db[(_0x5047('0x92'))][(_0x5047('0x93'))](_0x5047('0xa5'));}_0x2716e8=_0x359dc1;var _0x451e77={};_0x451e77['model']=_['keys'](db[_[_0x5047('0xa7')](_0xa2b466['query'][_0x5047('0xb2')])+'Queue']['rawAttributes']);_0x451e77[_0x5047('0x44')]=_[_0x5047('0x5b')](_0xa2b466['query']);_0x451e77['filters']=_['intersection'](_0x451e77['model'],_0x451e77[_0x5047('0x44')]);_0x3a310a['attributes']=_[_0x5047('0x45')](_0x451e77['model'],qs['fields'](_0xa2b466[_0x5047('0x44')]['fields']));_0x3a310a[_0x5047('0x48')]=_0x3a310a['attributes'][_0x5047('0x49')]?_0x3a310a[_0x5047('0x48')]:_0x451e77[_0x5047('0x46')];_0x3a310a['order']=qs[_0x5047('0x4d')](_0xa2b466['query']['sort']);_0x3a310a[_0x5047('0x50')]=qs[_0x5047('0x4f')](_['pick'](_0xa2b466['query'],_0x451e77['filters']));if(_0xa2b466[_0x5047('0x44')][_0x5047('0x37')]){_0x3a310a[_0x5047('0x50')]=_[_0x5047('0x51')](_0x3a310a[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x3a310a[_0x5047('0x48')],function(_0x284f48){var _0x35f529={};_0x35f529[_0x284f48]={'$like':'%'+_0xa2b466[_0x5047('0x44')][_0x5047('0x37')]+'%'};return _0x35f529;})});}_0x3a310a=_[_0x5047('0x51')]({},_0x3a310a,_0xa2b466['options']);switch(_0x2716e8[_0x5047('0x31')]){case _0x5047('0x81'):return db[_[_0x5047('0xa7')](_0xa2b466['query'][_0x5047('0xb2')])+'Queue']['findAll'](_0x3a310a);case _0x5047('0x33'):case'agent':return _0x2716e8[_0x5047('0xad')+_[_0x5047('0xa7')](_0xa2b466[_0x5047('0x44')][_0x5047('0xb2')])+_0x5047('0xa9')](_0x3a310a);default:throw new db['Sequelize'][(_0x5047('0x93'))]('Unknown\x20role');}})[_0x5047('0x20')](function(_0xf8aaea){_0x22a9ac=_0xf8aaea[_0x5047('0x49')];if(!_0xa2b466[_0x5047('0x44')]['hasOwnProperty']('nolimit')){_0x3a310a[_0x5047('0x4c')]=qs[_0x5047('0x4c')](_0xa2b466[_0x5047('0x44')][_0x5047('0x4c')]);_0x3a310a[_0x5047('0x2b')]=qs['offset'](_0xa2b466[_0x5047('0x44')][_0x5047('0x2b')]);}switch(_0x2716e8[_0x5047('0x31')]){case _0x5047('0x81'):return db[_[_0x5047('0xa7')](_0xa2b466[_0x5047('0x44')][_0x5047('0xb2')])+_0x5047('0xc7')][_0x5047('0x8d')](_0x3a310a);case _0x5047('0x33'):case _0x5047('0x35'):return _0x2716e8[_0x5047('0xad')+_[_0x5047('0xa7')](_0xa2b466[_0x5047('0x44')][_0x5047('0xb2')])+'Queues'](_0x3a310a);}})[_0x5047('0x20')](function(_0x512be8){return{'count':_0x22a9ac,'rows':_0x512be8};})['then'](respondWithResult(_0x12726c,null))[_0x5047('0x27')](handleError(_0x12726c,null));};exports['getVoiceQueuesRt']=function(_0x2246aa,_0x292c1a,_0x1b0d87){var _0x558716={};var _0x2e46b8={};var _0x18d150;var _0x1ed31b;return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x2246aa[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x292c1a,null))[_0x5047('0x20')](function(_0x4a260a){if(_0x4a260a){_0x18d150=_0x4a260a;_0x2e46b8['model']=_[_0x5047('0x5b')](db[_0x5047('0xb0')][_0x5047('0x41')]);_0x2e46b8['query']=_[_0x5047('0x5b')](_0x2246aa[_0x5047('0x44')]);_0x2e46b8[_0x5047('0x4f')]=_[_0x5047('0x45')](_0x2e46b8['model'],_0x2e46b8[_0x5047('0x44')]);_0x558716[_0x5047('0x48')]=_[_0x5047('0x45')](_0x2e46b8[_0x5047('0x46')],qs[_0x5047('0x47')](_0x2246aa[_0x5047('0x44')][_0x5047('0x47')]));_0x558716[_0x5047('0x48')]=_0x558716['attributes'][_0x5047('0x49')]?_0x558716['attributes']:_0x2e46b8[_0x5047('0x46')];_0x558716[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x2246aa['query'][_0x5047('0x4d')]);_0x558716[_0x5047('0x50')]=qs[_0x5047('0x4f')](_[_0x5047('0x4e')](_0x2246aa['query'],_0x2e46b8['filters']));if(_0x2246aa['query']['filter']){_0x558716[_0x5047('0x50')]=_[_0x5047('0x51')](_0x558716[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x558716[_0x5047('0x48')],function(_0xe73b92){var _0x2e979f={};_0x2e979f[_0xe73b92]={'$like':'%'+_0x2246aa[_0x5047('0x44')][_0x5047('0x37')]+'%'};return _0x2e979f;})});}_0x558716=_[_0x5047('0x51')]({},_0x558716,_0x2246aa[_0x5047('0x55')]);return _0x18d150[_0x5047('0xc8')](_0x558716);}})[_0x5047('0x20')](function(_0x1d4816){if(_0x1d4816){_0x1ed31b=_0x1d4816[_0x5047('0x49')];if(!_0x2246aa[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0x558716[_0x5047('0x4c')]=qs[_0x5047('0x4c')](_0x2246aa[_0x5047('0x44')][_0x5047('0x4c')]);_0x558716['offset']=qs[_0x5047('0x2b')](_0x2246aa[_0x5047('0x44')][_0x5047('0x2b')]);}return _0x18d150[_0x5047('0xc8')](_0x558716);}})[_0x5047('0x20')](function(_0xdecb65){if(_0xdecb65){return _0xdecb65?{'count':_0x1ed31b,'rows':_0xdecb65}:null;}})[_0x5047('0x20')](respondWithResult(_0x292c1a,null))[_0x5047('0x27')](handleError(_0x292c1a,null));};exports[_0x5047('0xc9')]=function(_0x298cb4,_0x708dfa,_0x16a572){var _0xb9dc={};var _0x1e2ed1={};var _0x59ef7c;var _0x3d7f9b;return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x298cb4[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x708dfa,null))[_0x5047('0x20')](function(_0x2849fa){if(_0x2849fa){_0x59ef7c=_0x2849fa;_0x1e2ed1[_0x5047('0x46')]=_[_0x5047('0x5b')](db[_0x5047('0xca')][_0x5047('0x41')]);_0x1e2ed1[_0x5047('0x44')]=_['keys'](_0x298cb4[_0x5047('0x44')]);_0x1e2ed1[_0x5047('0x4f')]=_[_0x5047('0x45')](_0x1e2ed1[_0x5047('0x46')],_0x1e2ed1['query']);_0xb9dc[_0x5047('0x48')]=_['intersection'](_0x1e2ed1['model'],qs['fields'](_0x298cb4[_0x5047('0x44')][_0x5047('0x47')]));_0xb9dc['attributes']=_0xb9dc[_0x5047('0x48')]['length']?_0xb9dc[_0x5047('0x48')]:_0x1e2ed1['model'];_0xb9dc[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x298cb4[_0x5047('0x44')][_0x5047('0x4d')]);_0xb9dc[_0x5047('0x50')]=qs[_0x5047('0x4f')](_[_0x5047('0x4e')](_0x298cb4[_0x5047('0x44')],_0x1e2ed1[_0x5047('0x4f')]));if(_0x298cb4[_0x5047('0x44')]['filter']){_0xb9dc[_0x5047('0x50')]=_[_0x5047('0x51')](_0xb9dc['where'],{'$or':_[_0x5047('0x39')](_0xb9dc[_0x5047('0x48')],function(_0x2db92b){var _0x408445={};_0x408445[_0x2db92b]={'$like':'%'+_0x298cb4[_0x5047('0x44')]['filter']+'%'};return _0x408445;})});}_0xb9dc=_[_0x5047('0x51')]({},_0xb9dc,_0x298cb4[_0x5047('0x55')]);return _0x59ef7c[_0x5047('0xc9')](_0xb9dc);}})[_0x5047('0x20')](function(_0x4e3633){if(_0x4e3633){_0x3d7f9b=_0x4e3633[_0x5047('0x49')];if(!_0x298cb4[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0xb9dc['limit']=qs['limit'](_0x298cb4[_0x5047('0x44')][_0x5047('0x4c')]);_0xb9dc[_0x5047('0x2b')]=qs[_0x5047('0x2b')](_0x298cb4[_0x5047('0x44')][_0x5047('0x2b')]);}return _0x59ef7c[_0x5047('0xc9')](_0xb9dc);}})[_0x5047('0x20')](function(_0x23eb85){if(_0x23eb85){return _0x23eb85?{'count':_0x3d7f9b,'rows':_0x23eb85}:null;}})[_0x5047('0x20')](respondWithResult(_0x708dfa,null))[_0x5047('0x27')](handleError(_0x708dfa,null));};exports['getRecordings']=function(_0x3db067,_0x517ff9,_0x3673d3){var _0x86fc25={'raw':!![],'where':{}};var _0x110996={};var _0x2775b5={'count':0x0,'rows':[]};return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x3db067['params']['id']}})['then'](handleEntityNotFound(_0x517ff9,null))['then'](function(_0x484101){if(_0x484101){_0x110996[_0x5047('0x46')]=_[_0x5047('0x5b')](db[_0x5047('0xcb')][_0x5047('0x41')]);_0x110996[_0x5047('0x44')]=_['keys'](_0x3db067['query']);_0x110996[_0x5047('0x4f')]=_[_0x5047('0x45')](_0x110996[_0x5047('0x46')],_0x110996[_0x5047('0x44')]);_0x86fc25['attributes']=_[_0x5047('0x45')](_0x110996[_0x5047('0x46')],qs[_0x5047('0x47')](_0x3db067['query'][_0x5047('0x47')]));_0x86fc25[_0x5047('0x48')]=_0x86fc25[_0x5047('0x48')][_0x5047('0x49')]?_0x86fc25[_0x5047('0x48')]:_0x110996['model'];if(!_0x3db067[_0x5047('0x44')][_0x5047('0x4a')]('nolimit')){_0x86fc25[_0x5047('0x4c')]=qs[_0x5047('0x4c')](_0x3db067[_0x5047('0x44')][_0x5047('0x4c')]);_0x86fc25['offset']=qs[_0x5047('0x2b')](_0x3db067[_0x5047('0x44')]['offset']);}_0x86fc25[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x3db067['query'][_0x5047('0x4d')]);_0x86fc25['where']=qs[_0x5047('0x4f')](_[_0x5047('0x4e')](_0x3db067[_0x5047('0x44')],_0x110996[_0x5047('0x4f')]));_0x86fc25[_0x5047('0x50')][_0x5047('0xcc')]=_0x484101['id'];if(_0x3db067['query'][_0x5047('0x37')]){_0x86fc25[_0x5047('0x50')]=_[_0x5047('0x51')](_0x86fc25[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x86fc25['attributes'],function(_0xf66a88){var _0x6931e8={};_0x6931e8[_0xf66a88]={'$like':'%'+_0x3db067['query'][_0x5047('0x37')]+'%'};return _0x6931e8;})});}_0x86fc25=_[_0x5047('0x51')]({},_0x86fc25,_0x3db067[_0x5047('0x55')]);return db['VoiceRecording'][_0x5047('0x2a')]({'where':_0x86fc25[_0x5047('0x50')]})[_0x5047('0x20')](function(_0x1f3ba3){_0x2775b5['count']=_0x1f3ba3;if(_0x3db067[_0x5047('0x44')][_0x5047('0x56')]){_0x86fc25[_0x5047('0x57')]=[{'all':!![]}];}return db[_0x5047('0xcb')][_0x5047('0x8d')](_0x86fc25);})[_0x5047('0x20')](function(_0x5a8b54){_0x2775b5[_0x5047('0x58')]=_0x5a8b54;return _0x2775b5;});}})[_0x5047('0x20')](respondWithFilteredResult(_0x517ff9,_0x86fc25))[_0x5047('0x27')](handleError(_0x517ff9,null));};exports[_0x5047('0xcd')]=function(_0x1430a9,_0x3692a8,_0x53e534){var _0x3e74f0={'raw':!![],'where':{}};var _0x1bdafa={};var _0x1c4009={'count':0x0,'rows':[]};return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x1430a9['params']['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x3692a8,null))['then'](function(_0x59f24d){if(_0x59f24d){_0x1bdafa['model']=_[_0x5047('0x5b')](db[_0x5047('0xce')]['rawAttributes']);_0x1bdafa[_0x5047('0x44')]=_[_0x5047('0x5b')](_0x1430a9['query']);_0x1bdafa[_0x5047('0x4f')]=_[_0x5047('0x45')](_0x1bdafa[_0x5047('0x46')],_0x1bdafa[_0x5047('0x44')]);_0x3e74f0[_0x5047('0x48')]=_[_0x5047('0x45')](_0x1bdafa[_0x5047('0x46')],qs['fields'](_0x1430a9[_0x5047('0x44')][_0x5047('0x47')]));_0x3e74f0[_0x5047('0x48')]=_0x3e74f0[_0x5047('0x48')][_0x5047('0x49')]?_0x3e74f0[_0x5047('0x48')]:_0x1bdafa['model'];if(!_0x1430a9[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0x3e74f0['limit']=qs[_0x5047('0x4c')](_0x1430a9['query'][_0x5047('0x4c')]);_0x3e74f0['offset']=qs[_0x5047('0x2b')](_0x1430a9[_0x5047('0x44')][_0x5047('0x2b')]);}_0x3e74f0[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x1430a9[_0x5047('0x44')][_0x5047('0x4d')]);_0x3e74f0['where']=qs[_0x5047('0x4f')](_[_0x5047('0x4e')](_0x1430a9[_0x5047('0x44')],_0x1bdafa[_0x5047('0x4f')]));_0x3e74f0[_0x5047('0x50')][_0x5047('0xcc')]=_0x59f24d['id'];if(_0x1430a9['query'][_0x5047('0x37')]){_0x3e74f0[_0x5047('0x50')]=_['merge'](_0x3e74f0['where'],{'$or':_[_0x5047('0x39')](_0x3e74f0[_0x5047('0x48')],function(_0x47cc88){var _0x19d4df={};_0x19d4df[_0x47cc88]={'$like':'%'+_0x1430a9[_0x5047('0x44')][_0x5047('0x37')]+'%'};return _0x19d4df;})});}_0x3e74f0=_['merge']({},_0x3e74f0,_0x1430a9[_0x5047('0x55')]);return db['ScreenRecording'][_0x5047('0x2a')]({'where':_0x3e74f0['where']})[_0x5047('0x20')](function(_0x23f303){_0x1c4009[_0x5047('0x2a')]=_0x23f303;if(_0x1430a9[_0x5047('0x44')][_0x5047('0x56')]){_0x3e74f0[_0x5047('0x57')]=[{'all':!![]}];}return db[_0x5047('0xce')][_0x5047('0x8d')](_0x3e74f0);})[_0x5047('0x20')](function(_0x3ffd0a){_0x1c4009['rows']=_0x3ffd0a;return _0x1c4009;});}})['then'](respondWithFilteredResult(_0x3692a8,_0x3e74f0))[_0x5047('0x27')](handleError(_0x3692a8,null));};exports['getChatInteractions']=function(_0x1e4426,_0x276cac,_0x222540){var _0x2d6db9={};var _0xba7d8b={};var _0x4b7913;var _0x324c90;return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x1e4426[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x276cac,null))[_0x5047('0x20')](function(_0x35aa6b){if(_0x35aa6b){_0x4b7913=_0x35aa6b;_0xba7d8b[_0x5047('0x46')]=_[_0x5047('0x5b')](db[_0x5047('0xcf')][_0x5047('0x41')]);_0xba7d8b['query']=_[_0x5047('0x5b')](_0x1e4426[_0x5047('0x44')]);_0xba7d8b['filters']=_[_0x5047('0x45')](_0xba7d8b[_0x5047('0x46')],_0xba7d8b[_0x5047('0x44')]);_0x2d6db9[_0x5047('0x48')]=_[_0x5047('0x45')](_0xba7d8b[_0x5047('0x46')],qs[_0x5047('0x47')](_0x1e4426['query'][_0x5047('0x47')]));_0x2d6db9['attributes']=_0x2d6db9[_0x5047('0x48')]['length']?_0x2d6db9['attributes']:_0xba7d8b['model'];_0x2d6db9['order']=qs[_0x5047('0x4d')](_0x1e4426['query'][_0x5047('0x4d')]);_0x2d6db9[_0x5047('0x50')]=qs[_0x5047('0x4f')](_['pick'](_0x1e4426[_0x5047('0x44')],_0xba7d8b['filters']));if(_0x1e4426[_0x5047('0x44')][_0x5047('0x37')]){_0x2d6db9[_0x5047('0x50')]=_[_0x5047('0x51')](_0x2d6db9[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x2d6db9[_0x5047('0x48')],function(_0x3f7a7b){var _0x5369d9={};_0x5369d9[_0x3f7a7b]={'$like':'%'+_0x1e4426[_0x5047('0x44')]['filter']+'%'};return _0x5369d9;})});}_0x2d6db9=_[_0x5047('0x51')]({},_0x2d6db9,_0x1e4426['options']);return _0x4b7913['getChatInteractions'](_0x2d6db9);}})[_0x5047('0x20')](function(_0x1d359e){if(_0x1d359e){_0x324c90=_0x1d359e[_0x5047('0x49')];if(!_0x1e4426[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0x2d6db9[_0x5047('0x4c')]=qs[_0x5047('0x4c')](_0x1e4426[_0x5047('0x44')][_0x5047('0x4c')]);_0x2d6db9[_0x5047('0x2b')]=qs['offset'](_0x1e4426[_0x5047('0x44')]['offset']);}return _0x4b7913[_0x5047('0xd0')](_0x2d6db9);}})['then'](function(_0x3f0256){if(_0x3f0256){return _0x3f0256?{'count':_0x324c90,'rows':_0x3f0256}:null;}})['then'](respondWithResult(_0x276cac,null))['catch'](handleError(_0x276cac,null));};exports[_0x5047('0xd1')]=function(_0x42c15e,_0x4e48b3,_0x31b2e4){var _0xb63742={};var _0x42986c={};var _0x28617e;var _0x4173f1;return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x42c15e[_0x5047('0x59')]['id']}})['then'](handleEntityNotFound(_0x4e48b3,null))['then'](function(_0x2b95a9){if(_0x2b95a9){_0x28617e=_0x2b95a9;_0x42986c['model']=_[_0x5047('0x5b')](db[_0x5047('0xd2')][_0x5047('0x41')]);_0x42986c[_0x5047('0x44')]=_[_0x5047('0x5b')](_0x42c15e['query']);_0x42986c[_0x5047('0x4f')]=_[_0x5047('0x45')](_0x42986c[_0x5047('0x46')],_0x42986c[_0x5047('0x44')]);_0xb63742[_0x5047('0x48')]=_[_0x5047('0x45')](_0x42986c['model'],qs[_0x5047('0x47')](_0x42c15e[_0x5047('0x44')][_0x5047('0x47')]));_0xb63742['attributes']=_0xb63742['attributes'][_0x5047('0x49')]?_0xb63742['attributes']:_0x42986c[_0x5047('0x46')];_0xb63742[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x42c15e['query'][_0x5047('0x4d')]);_0xb63742[_0x5047('0x50')]=qs[_0x5047('0x4f')](_[_0x5047('0x4e')](_0x42c15e[_0x5047('0x44')],_0x42986c['filters']));if(_0x42c15e[_0x5047('0x44')]['filter']){_0xb63742[_0x5047('0x50')]=_[_0x5047('0x51')](_0xb63742['where'],{'$or':_[_0x5047('0x39')](_0xb63742[_0x5047('0x48')],function(_0x1c341b){var _0x2006f4={};_0x2006f4[_0x1c341b]={'$like':'%'+_0x42c15e[_0x5047('0x44')][_0x5047('0x37')]+'%'};return _0x2006f4;})});}_0xb63742=_[_0x5047('0x51')]({},_0xb63742,_0x42c15e[_0x5047('0x55')]);return _0x28617e[_0x5047('0xd1')](_0xb63742);}})[_0x5047('0x20')](function(_0x28fc4c){if(_0x28fc4c){_0x4173f1=_0x28fc4c['length'];if(!_0x42c15e[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0xb63742[_0x5047('0x4c')]=qs[_0x5047('0x4c')](_0x42c15e[_0x5047('0x44')][_0x5047('0x4c')]);_0xb63742[_0x5047('0x2b')]=qs[_0x5047('0x2b')](_0x42c15e['query']['offset']);}return _0x28617e[_0x5047('0xd1')](_0xb63742);}})[_0x5047('0x20')](function(_0x481da4){if(_0x481da4){return _0x481da4?{'count':_0x4173f1,'rows':_0x481da4}:null;}})[_0x5047('0x20')](respondWithResult(_0x4e48b3,null))[_0x5047('0x27')](handleError(_0x4e48b3,null));};exports[_0x5047('0xd3')]=function(_0x783fac,_0x3fdf32,_0x1ca23b){var _0x361bcc={'raw':!![],'where':{}};var _0x5a8330={};var _0xbf6830={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x783fac[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x3fdf32,null))[_0x5047('0x20')](function(_0x5daeef){if(_0x5daeef){_0x5a8330['model']=_[_0x5047('0x5b')](db[_0x5047('0xd4')][_0x5047('0x41')]);_0x5a8330[_0x5047('0x44')]=_[_0x5047('0x5b')](_0x783fac[_0x5047('0x44')]);_0x5a8330[_0x5047('0x4f')]=_[_0x5047('0x45')](_0x5a8330['model'],_0x5a8330['query']);_0x361bcc[_0x5047('0x48')]=_[_0x5047('0x45')](_0x5a8330[_0x5047('0x46')],qs[_0x5047('0x47')](_0x783fac['query'][_0x5047('0x47')]));_0x361bcc[_0x5047('0x48')]=_0x361bcc[_0x5047('0x48')][_0x5047('0x49')]?_0x361bcc['attributes']:_0x5a8330[_0x5047('0x46')];if(!_0x783fac[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0x361bcc[_0x5047('0x4c')]=qs[_0x5047('0x4c')](_0x783fac[_0x5047('0x44')][_0x5047('0x4c')]);_0x361bcc[_0x5047('0x2b')]=qs[_0x5047('0x2b')](_0x783fac['query'][_0x5047('0x2b')]);}_0x361bcc[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x783fac[_0x5047('0x44')][_0x5047('0x4d')]);_0x361bcc[_0x5047('0x50')]=qs[_0x5047('0x4f')](_[_0x5047('0x4e')](_0x783fac[_0x5047('0x44')],_0x5a8330[_0x5047('0x4f')]));_0x361bcc['where'][_0x5047('0xcc')]=_0x5daeef['id'];if(_0x783fac['query']['filter']){_0x361bcc[_0x5047('0x50')]=_['merge'](_0x361bcc[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x361bcc[_0x5047('0x48')],function(_0x3e18d6){var _0x23cbc9={};_0x23cbc9[_0x3e18d6]={'$like':'%'+_0x783fac['query'][_0x5047('0x37')]+'%'};return _0x23cbc9;})});}_0x361bcc=_['merge']({},_0x361bcc,_0x783fac[_0x5047('0x55')]);return db[_0x5047('0xd4')]['count']({'where':_0x361bcc['where']})[_0x5047('0x20')](function(_0x56ea01){_0xbf6830[_0x5047('0x2a')]=_0x56ea01;if(_0x783fac[_0x5047('0x44')]['includeAll']){_0x361bcc['include']=[{'all':!![]}];}return db[_0x5047('0xd4')]['findAll'](_0x361bcc);})['then'](function(_0x3b6e6a){_0xbf6830[_0x5047('0x58')]=_0x3b6e6a;return _0xbf6830;});}})[_0x5047('0x20')](respondWithFilteredResult(_0x3fdf32,_0x361bcc))['catch'](handleError(_0x3fdf32,null));};exports[_0x5047('0xd5')]=function(_0x5afe94,_0x1a240d,_0x47966c){var _0x297d6a={};var _0x4f13fc={};var _0x67e53f;var _0x3dfea6;return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x5afe94[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x1a240d,null))[_0x5047('0x20')](function(_0xb2647d){if(_0xb2647d){_0x67e53f=_0xb2647d;_0x4f13fc[_0x5047('0x46')]=_['keys'](db[_0x5047('0xd6')][_0x5047('0x41')]);_0x4f13fc[_0x5047('0x44')]=_[_0x5047('0x5b')](_0x5afe94[_0x5047('0x44')]);_0x4f13fc['filters']=_[_0x5047('0x45')](_0x4f13fc['model'],_0x4f13fc[_0x5047('0x44')]);_0x297d6a[_0x5047('0x48')]=_[_0x5047('0x45')](_0x4f13fc[_0x5047('0x46')],qs[_0x5047('0x47')](_0x5afe94['query'][_0x5047('0x47')]));_0x297d6a[_0x5047('0x48')]=_0x297d6a[_0x5047('0x48')]['length']?_0x297d6a['attributes']:_0x4f13fc['model'];_0x297d6a[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x5afe94[_0x5047('0x44')][_0x5047('0x4d')]);_0x297d6a[_0x5047('0x50')]=qs[_0x5047('0x4f')](_[_0x5047('0x4e')](_0x5afe94[_0x5047('0x44')],_0x4f13fc['filters']));if(_0x5afe94[_0x5047('0x44')][_0x5047('0x37')]){_0x297d6a[_0x5047('0x50')]=_[_0x5047('0x51')](_0x297d6a[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x297d6a[_0x5047('0x48')],function(_0x226bcf){var _0x2b0fac={};_0x2b0fac[_0x226bcf]={'$like':'%'+_0x5afe94[_0x5047('0x44')]['filter']+'%'};return _0x2b0fac;})});}_0x297d6a=_['merge']({},_0x297d6a,_0x5afe94[_0x5047('0x55')]);return _0x67e53f['getSmsInteractions'](_0x297d6a);}})[_0x5047('0x20')](function(_0x17abe7){if(_0x17abe7){_0x3dfea6=_0x17abe7[_0x5047('0x49')];if(!_0x5afe94[_0x5047('0x44')]['hasOwnProperty'](_0x5047('0x4b'))){_0x297d6a[_0x5047('0x4c')]=qs[_0x5047('0x4c')](_0x5afe94[_0x5047('0x44')][_0x5047('0x4c')]);_0x297d6a[_0x5047('0x2b')]=qs[_0x5047('0x2b')](_0x5afe94['query']['offset']);}return _0x67e53f[_0x5047('0xd5')](_0x297d6a);}})['then'](function(_0x1100dd){if(_0x1100dd){return _0x1100dd?{'count':_0x3dfea6,'rows':_0x1100dd}:null;}})[_0x5047('0x20')](respondWithResult(_0x1a240d,null))['catch'](handleError(_0x1a240d,null));};exports[_0x5047('0xd7')]=function(_0x13d528,_0x2b2711,_0x127c5f){var _0x276f96={};var _0x39cd52={};var _0x56b762;var _0x3e205b;return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x13d528[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x2b2711,null))['then'](function(_0x168daa){if(_0x168daa){_0x56b762=_0x168daa;_0x39cd52[_0x5047('0x46')]=_[_0x5047('0x5b')](db[_0x5047('0xd8')][_0x5047('0x41')]);_0x39cd52['query']=_['keys'](_0x13d528[_0x5047('0x44')]);_0x39cd52[_0x5047('0x4f')]=_[_0x5047('0x45')](_0x39cd52[_0x5047('0x46')],_0x39cd52[_0x5047('0x44')]);_0x276f96[_0x5047('0x48')]=_[_0x5047('0x45')](_0x39cd52[_0x5047('0x46')],qs[_0x5047('0x47')](_0x13d528[_0x5047('0x44')]['fields']));_0x276f96['attributes']=_0x276f96['attributes'][_0x5047('0x49')]?_0x276f96['attributes']:_0x39cd52[_0x5047('0x46')];_0x276f96['order']=qs[_0x5047('0x4d')](_0x13d528['query'][_0x5047('0x4d')]);_0x276f96[_0x5047('0x50')]=qs['filters'](_[_0x5047('0x4e')](_0x13d528[_0x5047('0x44')],_0x39cd52[_0x5047('0x4f')]));if(_0x13d528[_0x5047('0x44')][_0x5047('0x37')]){_0x276f96[_0x5047('0x50')]=_[_0x5047('0x51')](_0x276f96['where'],{'$or':_[_0x5047('0x39')](_0x276f96[_0x5047('0x48')],function(_0x5b7f1e){var _0xd7694e={};_0xd7694e[_0x5b7f1e]={'$like':'%'+_0x13d528[_0x5047('0x44')]['filter']+'%'};return _0xd7694e;})});}_0x276f96=_[_0x5047('0x51')]({},_0x276f96,_0x13d528['options']);return _0x56b762[_0x5047('0xd7')](_0x276f96);}})[_0x5047('0x20')](function(_0x483cd1){if(_0x483cd1){_0x3e205b=_0x483cd1['length'];if(!_0x13d528['query'][_0x5047('0x4a')](_0x5047('0x4b'))){_0x276f96['limit']=qs[_0x5047('0x4c')](_0x13d528[_0x5047('0x44')][_0x5047('0x4c')]);_0x276f96[_0x5047('0x2b')]=qs[_0x5047('0x2b')](_0x13d528['query'][_0x5047('0x2b')]);}return _0x56b762[_0x5047('0xd7')](_0x276f96);}})[_0x5047('0x20')](function(_0x191975){if(_0x191975){return _0x191975?{'count':_0x3e205b,'rows':_0x191975}:null;}})['then'](respondWithResult(_0x2b2711,null))['catch'](handleError(_0x2b2711,null));};exports[_0x5047('0xd9')]=function(_0x3f3b15,_0x1a0932,_0x3555bb){var _0x18cdaa={};var _0xfafd5f={};var _0x74e767;var _0x14c894;return db['User'][_0x5047('0x9b')]({'where':{'id':_0x3f3b15[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x1a0932,null))[_0x5047('0x20')](function(_0x5b8228){if(_0x5b8228){_0x74e767=_0x5b8228;_0xfafd5f['model']=_[_0x5047('0x5b')](db[_0x5047('0xda')][_0x5047('0x41')]);_0xfafd5f[_0x5047('0x44')]=_[_0x5047('0x5b')](_0x3f3b15['query']);_0xfafd5f[_0x5047('0x4f')]=_[_0x5047('0x45')](_0xfafd5f[_0x5047('0x46')],_0xfafd5f[_0x5047('0x44')]);_0x18cdaa[_0x5047('0x48')]=_[_0x5047('0x45')](_0xfafd5f[_0x5047('0x46')],qs[_0x5047('0x47')](_0x3f3b15[_0x5047('0x44')]['fields']));_0x18cdaa[_0x5047('0x48')]=_0x18cdaa[_0x5047('0x48')][_0x5047('0x49')]?_0x18cdaa[_0x5047('0x48')]:_0xfafd5f[_0x5047('0x46')];_0x18cdaa[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x3f3b15['query'][_0x5047('0x4d')]);_0x18cdaa['where']=qs['filters'](_[_0x5047('0x4e')](_0x3f3b15[_0x5047('0x44')],_0xfafd5f[_0x5047('0x4f')]));if(_0x3f3b15[_0x5047('0x44')][_0x5047('0x37')]){_0x18cdaa[_0x5047('0x50')]=_[_0x5047('0x51')](_0x18cdaa[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x18cdaa[_0x5047('0x48')],function(_0x3edda0){var _0x543cb3={};_0x543cb3[_0x3edda0]={'$like':'%'+_0x3f3b15[_0x5047('0x44')]['filter']+'%'};return _0x543cb3;})});}_0x18cdaa=_['merge']({},_0x18cdaa,_0x3f3b15['options']);return _0x74e767[_0x5047('0xd9')](_0x18cdaa);}})['then'](function(_0x3d7340){if(_0x3d7340){_0x14c894=_0x3d7340['length'];if(!_0x3f3b15[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0x18cdaa[_0x5047('0x4c')]=qs[_0x5047('0x4c')](_0x3f3b15[_0x5047('0x44')]['limit']);_0x18cdaa[_0x5047('0x2b')]=qs[_0x5047('0x2b')](_0x3f3b15[_0x5047('0x44')][_0x5047('0x2b')]);}return _0x74e767['getWhatsappInteractions'](_0x18cdaa);}})[_0x5047('0x20')](function(_0x42edb4){if(_0x42edb4){return _0x42edb4?{'count':_0x14c894,'rows':_0x42edb4}:null;}})[_0x5047('0x20')](respondWithResult(_0x1a0932,null))['catch'](handleError(_0x1a0932,null));};exports[_0x5047('0xdb')]=function(_0x1b0cad,_0x38826d,_0x4e4b2d){var _0x5bfc25;var _0x2c9698;var _0x4e6e01;var _0x3a63d1=!_['isNil'](_0x1b0cad[_0x5047('0x59')]['id'])?_0x1b0cad[_0x5047('0x59')]['id']:!_[_0x5047('0x68')](_0x1b0cad[_0x5047('0x33')]['id'])?_0x1b0cad['user']['id']:null;return db[_0x5047('0x40')]['find']({'where':{'id':_0x3a63d1,'role':{'$or':[_0x5047('0x81'),_0x5047('0x33'),_0x5047('0x35')]}},'attributes':['id',_0x5047('0x3c'),'phone',_0x5047('0xdc'),_0x5047('0x31'),_0x5047('0x64'),_0x5047('0xa2')]})[_0x5047('0x20')](function(_0x3f202d){if(_0x3f202d){if(_0x3f202d['role']==='agent'){_0x5bfc25=_0x3f202d;if(_0x1b0cad[_0x5047('0x5f')][_0x5047('0xa4')]){_0x4e6e01=util[_0x5047('0xae')](_0x5047('0xdd'),_0x5bfc25[_0x1b0cad[_0x5047('0x5f')]['interface']]);}else if(_0x1b0cad[_0x5047('0x5f')][_0x5047('0xde')]){_0x4e6e01=util[_0x5047('0xae')](_0x5047('0xdf'),_0x1b0cad[_0x5047('0x5f')]['intrf']);}else{_0x4e6e01=util[_0x5047('0xae')]('SIP/%s',_0x5bfc25[_0x5047('0x3c')]);}socket['to'](util[_0x5047('0xae')]('user:%s',_0x5bfc25[_0x5047('0x3c')]))[_0x5047('0xe0')](_0x5047('0xe1'),{'ip':_0x1b0cad['headers'][_0x5047('0xe2')]||_0x1b0cad[_0x5047('0xe3')]['remoteAddress']||_0x1b0cad[_0x5047('0xe4')][_0x5047('0xe5')]||_0x1b0cad['connection'][_0x5047('0xe4')][_0x5047('0xe5')]});return db[_0x5047('0xb0')][_0x5047('0x30')]({'where':{'membername':_0x5bfc25[_0x5047('0x3c')]},'individualHooks':!![]});}}else{throw new db[(_0x5047('0x92'))][(_0x5047('0x93'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x5047('0x20')](function(){if(_0x5bfc25){return _0x5bfc25['getVoiceQueues']({'raw':!![]});}})[_0x5047('0x20')](function(_0x12cb93){if(_0x5bfc25){var _0x324987=[];if(_0x12cb93){_0x2c9698=_0x12cb93;if(_0x2c9698[_0x5047('0x49')]){for(var _0x678e0c=0x0;_0x678e0c<_0x2c9698[_0x5047('0x49')];_0x678e0c++){_0x324987[_0x5047('0x8c')]({'membername':_0x5bfc25[_0x5047('0x3c')],'UserId':_0x5bfc25['id'],'queue_name':_0x2c9698[_0x678e0c]['name'],'VoiceQueueId':_0x2c9698[_0x678e0c]['id'],'interface':_0x4e6e01,'paused':_0x5bfc25[_0x5047('0xa2')]||![],'penalty':_0x2c9698[_0x678e0c][_0x5047('0xe6')]||0x0});}return BPromise[_0x5047('0xe7')](_0x324987,function(_0x25ffa2){return db[_0x5047('0xb0')]['upsert'](_0x25ffa2);});}}}})[_0x5047('0x20')](function(){if(_0x5bfc25){return db[_0x5047('0xe8')][_0x5047('0x8d')]({'where':{'membername':_0x5bfc25[_0x5047('0x3c')],'exitAt':null}});}})[_0x5047('0x20')](function(_0x349005){if(_0x5bfc25){var _0x57011e=[];_0x349005[_0x5047('0xe9')](function(_0x3d6dbf){_0x57011e[_0x5047('0x8c')](_0x3d6dbf[_0x5047('0x2f')]({'exitAt':moment()[_0x5047('0xae')](_0x5047('0xea'))}));});return BPromise[_0x5047('0x91')](_0x57011e);}})['then'](function(){if(_0x5bfc25){var _0x4d304f=[];var _0x5a501f=[];var _0x540e9d=utils[_0x5047('0xeb')]();var _0x345e30={'membername':_0x5bfc25[_0x5047('0x3c')],'interface':_0x4e6e01,'enterAt':moment()['format'](_0x5047('0xea')),'role':_0x5bfc25[_0x5047('0x31')],'internal':_0x5bfc25[_0x5047('0x64')]};_0x540e9d['forEach'](function(_0x30f23a){_0x4d304f[_0x5047('0x8c')](_[_0x5047('0x51')]({'channel':_0x30f23a,'type':_0x5047('0xec'),'data1':_0x1b0cad[_0x5047('0x5f')][_0x5047('0xed')],'data2':_0x4e6e01},_0x345e30));if(_0x5bfc25[_0x5047('0xa2')]){_0x5a501f[_0x5047('0x8c')](_[_0x5047('0x51')]({'channel':_0x30f23a,'type':'PAUSE','data1':_0x5047('0xee')},_0x345e30));}});return db['MemberReport'][_0x5047('0x88')](_0x4d304f[_0x5047('0xef')](_0x5a501f),{'individualHooks':!![]});}})[_0x5047('0x20')](function(){if(_0x5bfc25){return _0x5bfc25[_0x5047('0x2f')]({'online':!![],'lastLoginAt':moment()[_0x5047('0xae')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5bfc25[_0x5047('0xa2')]||![],'mailPause':_0x5bfc25[_0x5047('0xa2')]||![],'chatPause':_0x5bfc25['loginInPause']||![],'faxPause':_0x5bfc25[_0x5047('0xa2')]||![],'smsPause':_0x5bfc25[_0x5047('0xa2')]||![],'openchannelPause':_0x5bfc25['loginInPause']||![],'whatsappPause':_0x5bfc25[_0x5047('0xa2')]||![],'pauseType':_0x5bfc25[_0x5047('0xa2')]?_0x5047('0xee'):null,'interface':_0x4e6e01,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x5047('0x20')](function(_0x2dd32f){if(_0x1b0cad['isMiddleware']){return _0x4e4b2d();}else{return BPromise[_0x5047('0xf0')](_0x2dd32f)[_0x5047('0x20')](respondWithResult(_0x38826d,null));}})[_0x5047('0x27')](handleError(_0x38826d,null));};exports['logout']=function(_0x7cabdf,_0x58fc8c,_0x5eac45){var _0xe2ad06;return db[_0x5047('0x40')][_0x5047('0x5e')]({'where':{'id':_0x7cabdf[_0x5047('0x59')]['id'],'role':_0x5047('0x35')},'attributes':['id',_0x5047('0x3c'),_0x5047('0x31')]})[_0x5047('0x20')](handleEntityNotFound(_0x58fc8c,null))[_0x5047('0x20')](function(_0x1bfb73){if(_0x1bfb73){_0xe2ad06=_0x1bfb73;return db[_0x5047('0xb0')]['destroy']({'where':{'membername':_0xe2ad06[_0x5047('0x3c')]},'individualHooks':!![]});}})[_0x5047('0x20')](function(){return db[_0x5047('0xe8')]['findAll']({'where':{'membername':_0xe2ad06[_0x5047('0x3c')],'exitAt':null}});})[_0x5047('0x20')](function(_0x5ce917){var _0x2b89ce=[];_0x5ce917[_0x5047('0xe9')](function(_0x3390f9){_0x2b89ce[_0x5047('0x8c')](_0x3390f9[_0x5047('0x2f')]({'exitAt':moment()[_0x5047('0xae')](_0x5047('0xea'))}));});return BPromise['all'](_0x2b89ce);})[_0x5047('0x20')](function(){return _0xe2ad06[_0x5047('0x2f')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x5047('0x20')](respondWithResult(_0x58fc8c,null))[_0x5047('0x27')](handleError(_0x58fc8c,null));};exports[_0x5047('0xf1')]=function(_0x3c94ea,_0x1df215,_0x36a010){var _0x5d4d16;return db['UserVoiceQueueRt'][_0x5047('0x2f')]({'paused':0x1},{'where':{'UserId':_0x3c94ea[_0x5047('0x59')]['id']},'individualHooks':!![]})[_0x5047('0x20')](function(){return db['User']['find']({'where':{'id':_0x3c94ea[_0x5047('0x59')]['id'],'role':'agent'},'attributes':['id',_0x5047('0x3c'),_0x5047('0x31'),_0x5047('0x64'),_0x5047('0xa4')]});})[_0x5047('0x20')](handleEntityNotFound(_0x1df215,null))[_0x5047('0x20')](function(_0x483c4f){if(_0x483c4f){_0x5d4d16=_0x483c4f;return respondWithRpcPromise(_0x5047('0xf2'),_0x5047('0xf1'),{'id':_0x5d4d16['id'],'name':_0x5d4d16['name'],'pause':!![]});}})[_0x5047('0x20')](function(){if(_0x5d4d16){return db['MemberReport']['findAll']({'where':{'membername':_0x5d4d16[_0x5047('0x3c')],'type':'PAUSE','exitAt':null}});}})[_0x5047('0x20')](function(_0x791d41){if(_0x791d41[_0x5047('0x49')]){var _0x504211=moment()[_0x5047('0xae')](_0x5047('0xea'));for(var _0x31d7df=0x0,_0x1240ac=_0x791d41['length'];_0x31d7df<_0x1240ac;_0x31d7df++){_0x791d41[_0x31d7df][_0x5047('0xf3')]({'exitAt':_0x504211});}}})[_0x5047('0x20')](function(){var _0xa72643=[];var _0x185388=utils[_0x5047('0xeb')]();_0x185388['forEach'](function(_0x2f09d7){_0xa72643[_0x5047('0x8c')]({'channel':_0x2f09d7,'membername':_0x5d4d16[_0x5047('0x3c')],'interface':_[_0x5047('0x68')](_0x5d4d16['interface'])?util[_0x5047('0xae')](_0x5047('0xdf'),_0x5d4d16[_0x5047('0x3c')]):_0x5d4d16['interface'],'type':_0x5047('0xf4'),'enterAt':moment()[_0x5047('0xae')](_0x5047('0xea')),'data1':_0x3c94ea[_0x5047('0x5f')][_0x5047('0x42')]||'DEFAULT\x20PAUSE','role':_0x5d4d16['role'],'internal':_0x5d4d16[_0x5047('0x64')]});});return db['MemberReport'][_0x5047('0x88')](_0xa72643,{'individualHooks':!![]});})[_0x5047('0x20')](function(){return _0x5d4d16[_0x5047('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3c94ea[_0x5047('0x5f')][_0x5047('0x42')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x5047('0xea'))});})[_0x5047('0x20')](respondWithResult(_0x1df215,null))[_0x5047('0x27')](handleError(_0x1df215,null));};exports[_0x5047('0xf5')]=function(_0x331c6f,_0x212b0a,_0x3b0987){var _0x15327d;return db['User'][_0x5047('0x5e')]({'where':{'id':_0x331c6f[_0x5047('0x59')]['id']},'attributes':['id',_0x5047('0x3c'),_0x5047('0x31'),_0x5047('0xa3'),_0x5047('0xf6'),_0x5047('0xf7'),_0x5047('0xf8'),'openchannelPause',_0x5047('0xf9'),_0x5047('0xfa'),_0x5047('0xfb'),'lastPauseAt']})['then'](handleEntityNotFound(_0x212b0a,null))[_0x5047('0x20')](function(_0x8115b9){if(_0x8115b9){_0x15327d=_0x8115b9;if(_0x331c6f[_0x5047('0x5f')]['channel']&&!utils[_0x5047('0xb3')](_0x331c6f['body'][_0x5047('0xb2')])){throw new db[(_0x5047('0x92'))]['ValidationError'](_0x5047('0xa5'));}switch(_0x331c6f['body'][_0x5047('0xb2')]){case'voice':return respondWithRpcPromise(_0x5047('0xf2'),_0x5047('0xf5'),{'id':_0x15327d['id'],'name':_0x15327d['name'],'pause':![]})[_0x5047('0x20')](function(){return db[_0x5047('0xb0')][_0x5047('0x2f')]({'paused':0x0},{'where':{'UserId':_0x15327d['id']},'individualHooks':!![]});})[_0x5047('0x20')](function(){return db[_0x5047('0xe8')][_0x5047('0x5e')]({'where':{'channel':_0x331c6f[_0x5047('0x5f')][_0x5047('0xb2')],'membername':_0x15327d[_0x5047('0x3c')],'type':_0x5047('0xf4'),'exitAt':null}});})['then'](function(_0x257de9){if(_0x257de9){return _0x257de9['update']({'exitAt':moment()[_0x5047('0xae')](_0x5047('0xea')),'data2':_0x5047('0xfc')},{'individualHooks':!![]});}return null;})[_0x5047('0x20')](function(){return _0x15327d[_0x5047('0x2f')]({'voicePause':![]});});case _0x5047('0xfd'):case _0x5047('0xfe'):case'fax':case _0x5047('0xff'):case _0x5047('0x100'):case _0x5047('0x101'):return db[_0x5047('0xe8')][_0x5047('0x5e')]({'where':{'channel':_0x331c6f['body'][_0x5047('0xb2')],'membername':_0x15327d[_0x5047('0x3c')],'type':'PAUSE','exitAt':null}})[_0x5047('0x20')](function(_0x1008a2){if(_0x1008a2){return _0x1008a2[_0x5047('0x2f')]({'exitAt':moment()[_0x5047('0xae')](_0x5047('0xea')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x5047('0x20')](function(){var _0xb2ef={};_[_0x5047('0x2c')](_0xb2ef,util[_0x5047('0xae')]('%s%s',_0x331c6f['body'][_0x5047('0xb2')],'Pause'),![]);return _0x15327d['update'](_0xb2ef);});default:return respondWithRpcPromise(_0x5047('0xf2'),_0x5047('0xf5'),{'id':_0x15327d['id'],'name':_0x15327d['name'],'pause':![]})['then'](function(){return db[_0x5047('0xb0')]['update']({'paused':0x0},{'where':{'UserId':_0x15327d['id']}});})[_0x5047('0x20')](function(){return db[_0x5047('0xe8')][_0x5047('0x8d')]({'where':{'membername':_0x15327d[_0x5047('0x3c')],'type':_0x5047('0xf4'),'exitAt':null}});})['then'](function(_0x4bb7f0){var _0x59be69=[];_0x4bb7f0['forEach'](function(_0x4533bd){_0x59be69[_0x5047('0x8c')](_0x4533bd['update']({'exitAt':moment()[_0x5047('0xae')](_0x5047('0xea')),'data2':_0x5047('0xfc')}));});return BPromise[_0x5047('0x91')](_0x59be69);})['then'](function(){return _0x15327d[_0x5047('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x5047('0x20')](respondWithResult(_0x212b0a,null))[_0x5047('0x27')](handleError(_0x212b0a,null));};exports[_0x5047('0x102')]=function(_0x733969,_0x25c006,_0x179089){var _0xbf55cb={};var _0x225c7d={};var _0x5e22eb;var _0x5a6da7;return db[_0x5047('0x40')][_0x5047('0x9b')]({'where':{'id':_0x733969[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x25c006,null))[_0x5047('0x20')](function(_0x408fd2){if(_0x408fd2){_0x5e22eb=_0x408fd2;_0x225c7d[_0x5047('0x46')]=_[_0x5047('0x5b')](db[_0x5047('0x103')][_0x5047('0x41')]);_0x225c7d[_0x5047('0x44')]=_['keys'](_0x733969['query']);_0x225c7d[_0x5047('0x4f')]=_['intersection'](_0x225c7d[_0x5047('0x46')],_0x225c7d[_0x5047('0x44')]);_0xbf55cb['attributes']=_['intersection'](_0x225c7d[_0x5047('0x46')],qs[_0x5047('0x47')](_0x733969[_0x5047('0x44')][_0x5047('0x47')]));_0xbf55cb[_0x5047('0x48')]=_0xbf55cb[_0x5047('0x48')]['length']?_0xbf55cb['attributes']:_0x225c7d['model'];_0xbf55cb[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x733969[_0x5047('0x44')][_0x5047('0x4d')]);_0xbf55cb[_0x5047('0x50')]=qs['filters'](_['pick'](_0x733969['query'],_0x225c7d[_0x5047('0x4f')]));if(_0x733969['query'][_0x5047('0x37')]){_0xbf55cb[_0x5047('0x50')]=_[_0x5047('0x51')](_0xbf55cb[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0xbf55cb[_0x5047('0x48')],function(_0x34086f){var _0x3bc7d7={};_0x3bc7d7[_0x34086f]={'$like':'%'+_0x733969['query'][_0x5047('0x37')]+'%'};return _0x3bc7d7;})});}_0xbf55cb=_[_0x5047('0x51')]({},_0xbf55cb,_0x733969[_0x5047('0x55')]);return _0x5e22eb[_0x5047('0x102')](_0xbf55cb);}})[_0x5047('0x20')](function(_0x64c9cd){if(_0x64c9cd){_0x5a6da7=_0x64c9cd['length'];if(!_0x733969[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0xbf55cb[_0x5047('0x4c')]=qs[_0x5047('0x4c')](_0x733969[_0x5047('0x44')][_0x5047('0x4c')]);_0xbf55cb[_0x5047('0x2b')]=qs[_0x5047('0x2b')](_0x733969[_0x5047('0x44')][_0x5047('0x2b')]);}return _0x5e22eb[_0x5047('0x102')](_0xbf55cb);}})[_0x5047('0x20')](function(_0x3df692){if(_0x3df692){return _0x3df692?{'count':_0x5a6da7,'rows':_0x3df692}:null;}})[_0x5047('0x20')](respondWithResult(_0x25c006,null))[_0x5047('0x27')](handleError(_0x25c006,null));};exports[_0x5047('0x104')]=function(_0x3fd238,_0x1b946e){return db[_0x5047('0x40')][_0x5047('0x5e')]({'where':{'id':_0x3fd238[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x1b946e,null))[_0x5047('0x20')](function(_0x3f6f37){if(_0x3f6f37){var _0x4b98bb=_0x3f6f37[_0x5047('0xad')]({'plain':!![]});return _0x3f6f37[_0x5047('0x104')](_0x3fd238[_0x5047('0x5f')][_0x5047('0x62')],_['omit'](_0x3fd238['body'],[_0x5047('0x62'),'id'])||{})[_0x5047('0x20')](function(){for(var _0x38d19d=0x0;_0x38d19d<_0x3fd238[_0x5047('0x5f')][_0x5047('0x62')][_0x5047('0x49')];_0x38d19d++){var _0x15c8c8=[];db[_0x5047('0x103')][_0x5047('0x9b')]({'where':{'id':_0x3fd238[_0x5047('0x5f')][_0x5047('0x62')][_0x38d19d]}})[_0x5047('0x20')](function(_0x27e24c){_0x15c8c8[_0x5047('0x8c')](_0x27e24c[_0x5047('0x105')]()[_0x5047('0x20')](function(_0xf06f1e){for(var _0x2d9739=0x0;_0x2d9739<_0xf06f1e[_0x5047('0x49')];_0x2d9739++){_0xf06f1e[_0x2d9739][_0x5047('0x106')]('channel','Voice');}return _0xf06f1e;}));_0x15c8c8[_0x5047('0x8c')](_0x27e24c[_0x5047('0x107')]()['then'](function(_0x5e2894){for(var _0x24cc81=0x0;_0x24cc81<_0x5e2894['length'];_0x24cc81++){_0x5e2894[_0x24cc81][_0x5047('0x106')](_0x5047('0xb2'),_0x5047('0x108'));}return _0x5e2894;}));_0x15c8c8['push'](_0x27e24c[_0x5047('0x109')]()[_0x5047('0x20')](function(_0x580e37){for(var _0x5bfbeb=0x0;_0x5bfbeb<_0x580e37[_0x5047('0x49')];_0x5bfbeb++){_0x580e37[_0x5bfbeb][_0x5047('0x106')](_0x5047('0xb2'),_0x5047('0x10a'));}return _0x580e37;}));_0x15c8c8['push'](_0x27e24c[_0x5047('0x10b')]()[_0x5047('0x20')](function(_0x10b22e){for(var _0x41a4a5=0x0;_0x41a4a5<_0x10b22e[_0x5047('0x49')];_0x41a4a5++){_0x10b22e[_0x41a4a5]['setDataValue']('channel','Sms');}return _0x10b22e;}));_0x15c8c8[_0x5047('0x8c')](_0x27e24c[_0x5047('0x10c')]()[_0x5047('0x20')](function(_0x5bcefb){for(var _0x12ded6=0x0;_0x12ded6<_0x5bcefb['length'];_0x12ded6++){_0x5bcefb[_0x12ded6][_0x5047('0x106')]('channel','Whatsapp');}return _0x5bcefb;}));_0x15c8c8[_0x5047('0x8c')](_0x27e24c[_0x5047('0x10d')]()[_0x5047('0x20')](function(_0x2e516a){for(var _0x1e1fad=0x0;_0x1e1fad<_0x2e516a[_0x5047('0x49')];_0x1e1fad++){_0x2e516a[_0x1e1fad]['setDataValue'](_0x5047('0xb2'),_0x5047('0x10e'));}return _0x2e516a;}));_0x15c8c8['push'](_0x27e24c[_0x5047('0x10f')]()[_0x5047('0x20')](function(_0x2018da){for(var _0x779766=0x0;_0x779766<_0x2018da['length'];_0x779766++){_0x2018da[_0x779766][_0x5047('0x106')](_0x5047('0xb2'),'Openchannel');}return _0x2018da;}));return BPromise[_0x5047('0x91')](_0x15c8c8);})[_0x5047('0x20')](function(_0x4dad41){var _0x4cc660=_[_0x5047('0x110')](_0x4dad41);_0x15c8c8=[];return db['sequelize'][_0x5047('0x111')](function(_0x2d80f0){for(var _0x5f4d9b=0x0;_0x5f4d9b<_0x4cc660['length'];_0x5f4d9b++){_0x15c8c8[_0x5047('0x8c')](_0x4cc660[_0x5f4d9b][_0x5047('0x112')](_0x4b98bb['id']),{'transaction':_0x2d80f0});}return BPromise[_0x5047('0x91')](_0x15c8c8)['then'](function(){if(_0x4b98bb[_0x5047('0xa1')]){return BPromise[_0x5047('0xe7')](_[_0x5047('0x37')](_0x4cc660,function(_0x2c4b7f){return _0x2c4b7f[_0x5047('0x113')]('channel')==='Voice';}),function(_0x1d23ea){return db['UserVoiceQueueRt'][_0x5047('0x114')]({'membername':_0x4b98bb[_0x5047('0x3c')],'UserId':_0x4b98bb['id'],'queue_name':_0x1d23ea[_0x5047('0x3c')],'VoiceQueueId':_0x1d23ea['id'],'interface':_[_0x5047('0x68')](_0x4b98bb[_0x5047('0xa4')])?util[_0x5047('0xae')](_0x5047('0xdf'),_0x4b98bb[_0x5047('0x3c')]):_0x4b98bb[_0x5047('0xa4')],'paused':_0x4b98bb[_0x5047('0xa3')]||![],'penalty':_0x4b98bb[_0x5047('0xaf')]},{'transaction':_0x2d80f0});});}else{return;}})[_0x5047('0x20')](function(){for(var _0x3b9ab7=0x0;_0x3b9ab7<_0x4cc660[_0x5047('0x49')];_0x3b9ab7++){var _0x52c6b0=_0x4cc660[_0x3b9ab7]['getDataValue'](_0x5047('0xb2'));var _0x4d90e3=_0x52c6b0+'QueueId';socket['emit'](_0x5047('0x33')+_0x52c6b0+_0x5047('0xab'),{'UserId':_0x4b98bb['id'],['queueField']:_0x4cc660[_0x3b9ab7]['id']});}});});});}});}})[_0x5047('0x20')](respondWithStatusCode(_0x1b946e,null))[_0x5047('0x27')](handleError(_0x1b946e,null));};exports[_0x5047('0x115')]=function(_0x439986,_0x193630){return db['User']['findOne']({'where':{'id':_0x439986[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x193630,null))['then'](function(_0x2dab84){if(_0x2dab84){var _0x5109ea=_0x2dab84[_0x5047('0xad')]({'plain':!![]});var _0x173d80=_0x439986[_0x5047('0x44')][_0x5047('0x62')];return _0x2dab84[_0x5047('0x115')](_0x173d80)[_0x5047('0x20')](function(){for(var _0x9bd2bc=0x0;_0x9bd2bc<_0x173d80[_0x5047('0x49')];_0x9bd2bc++){var _0x45ffda=[];db[_0x5047('0x103')]['findOne']({'where':{'id':_0x173d80[_0x9bd2bc]}})[_0x5047('0x20')](function(_0x1e6c6f){_0x45ffda[_0x5047('0x8c')](_0x1e6c6f[_0x5047('0x105')]()[_0x5047('0x20')](function(_0x4375ff){for(var _0x230cb2=0x0;_0x230cb2<_0x4375ff[_0x5047('0x49')];_0x230cb2++){_0x4375ff[_0x230cb2][_0x5047('0x106')](_0x5047('0xb2'),_0x5047('0x116'));}return _0x4375ff;}));_0x45ffda[_0x5047('0x8c')](_0x1e6c6f['getChatQueues']()[_0x5047('0x20')](function(_0x5dad81){for(var _0xbb4a10=0x0;_0xbb4a10<_0x5dad81[_0x5047('0x49')];_0xbb4a10++){_0x5dad81[_0xbb4a10][_0x5047('0x106')](_0x5047('0xb2'),_0x5047('0x108'));}return _0x5dad81;}));_0x45ffda[_0x5047('0x8c')](_0x1e6c6f['getMailQueues']()[_0x5047('0x20')](function(_0x282f8a){for(var _0x2321fa=0x0;_0x2321fa<_0x282f8a['length'];_0x2321fa++){_0x282f8a[_0x2321fa][_0x5047('0x106')](_0x5047('0xb2'),_0x5047('0x10a'));}return _0x282f8a;}));_0x45ffda['push'](_0x1e6c6f[_0x5047('0x10b')]()[_0x5047('0x20')](function(_0x1dcacf){for(var _0x50dbeb=0x0;_0x50dbeb<_0x1dcacf[_0x5047('0x49')];_0x50dbeb++){_0x1dcacf[_0x50dbeb]['setDataValue'](_0x5047('0xb2'),'Sms');}return _0x1dcacf;}));_0x45ffda[_0x5047('0x8c')](_0x1e6c6f[_0x5047('0x10c')]()['then'](function(_0x252fd1){for(var _0x3dce18=0x0;_0x3dce18<_0x252fd1[_0x5047('0x49')];_0x3dce18++){_0x252fd1[_0x3dce18][_0x5047('0x106')](_0x5047('0xb2'),_0x5047('0x117'));}return _0x252fd1;}));_0x45ffda[_0x5047('0x8c')](_0x1e6c6f[_0x5047('0x10d')]()[_0x5047('0x20')](function(_0x2c1ac5){for(var _0x2bcd18=0x0;_0x2bcd18<_0x2c1ac5['length'];_0x2bcd18++){_0x2c1ac5[_0x2bcd18][_0x5047('0x106')](_0x5047('0xb2'),_0x5047('0x10e'));}return _0x2c1ac5;}));_0x45ffda[_0x5047('0x8c')](_0x1e6c6f[_0x5047('0x10f')]()[_0x5047('0x20')](function(_0x4e1940){for(var _0x470890=0x0;_0x470890<_0x4e1940['length'];_0x470890++){_0x4e1940[_0x470890][_0x5047('0x106')](_0x5047('0xb2'),'Openchannel');}return _0x4e1940;}));return BPromise['all'](_0x45ffda);})[_0x5047('0x20')](function(_0x5e1497){var _0x575edf=_[_0x5047('0x110')](_0x5e1497);_0x45ffda=[];return db[_0x5047('0x52')][_0x5047('0x111')](function(_0x334331){for(var _0x1a05f9=0x0;_0x1a05f9<_0x575edf['length'];_0x1a05f9++){_0x45ffda['push'](_0x575edf[_0x1a05f9]['removeAgent'](_0x5109ea['id']),{'transaction':_0x334331});}return BPromise['all'](_0x45ffda)['then'](function(){if(_0x5109ea[_0x5047('0xa1')]){return BPromise[_0x5047('0xe7')](_['filter'](_0x575edf,function(_0x4e2219){return _0x4e2219[_0x5047('0x113')](_0x5047('0xb2'))===_0x5047('0x116');}),function(_0x19c71d){return db[_0x5047('0xb0')][_0x5047('0x30')]({'where':{'VoiceQueueId':_0x19c71d['id'],'UserId':_0x5109ea['id']},'transaction':_0x334331});});}else{return;}})['then'](function(){for(var _0x526bfb=0x0;_0x526bfb<_0x575edf[_0x5047('0x49')];_0x526bfb++){var _0x4a8f17=_0x575edf[_0x526bfb][_0x5047('0x113')](_0x5047('0xb2'));var _0x13bdcf=_0x4a8f17+'QueueId';socket[_0x5047('0xe0')]('user'+_0x4a8f17+_0x5047('0xb4'),{'UserId':_0x5109ea['id'],['queueField']:_0x575edf[_0x526bfb]['id']});}});});});}});}})[_0x5047('0x20')](respondWithStatusCode(_0x193630,null))[_0x5047('0x27')](handleError(_0x193630,null));};exports['getLists']=function(_0x8ef435,_0x21f81e,_0x136f6d){var _0x35ce32={};var _0x414520={};var _0x4c735c;var _0x3ca1ab;return db[_0x5047('0x40')]['findOne']({'where':{'id':_0x8ef435[_0x5047('0x59')]['id']}})['then'](handleEntityNotFound(_0x21f81e,null))[_0x5047('0x20')](function(_0x554440){if(_0x554440){_0x4c735c=_0x554440;_0x414520['model']=_['keys'](db[_0x5047('0xc1')][_0x5047('0x41')]);_0x414520[_0x5047('0x44')]=_['keys'](_0x8ef435[_0x5047('0x44')]);_0x414520[_0x5047('0x4f')]=_[_0x5047('0x45')](_0x414520['model'],_0x414520[_0x5047('0x44')]);_0x35ce32[_0x5047('0x48')]=_['intersection'](_0x414520[_0x5047('0x46')],qs[_0x5047('0x47')](_0x8ef435[_0x5047('0x44')][_0x5047('0x47')]));_0x35ce32[_0x5047('0x48')]=_0x35ce32[_0x5047('0x48')][_0x5047('0x49')]?_0x35ce32[_0x5047('0x48')]:_0x414520[_0x5047('0x46')];_0x35ce32[_0x5047('0xc0')]=qs[_0x5047('0x4d')](_0x8ef435[_0x5047('0x44')][_0x5047('0x4d')]);_0x35ce32[_0x5047('0x50')]=qs[_0x5047('0x4f')](_['pick'](_0x8ef435['query'],_0x414520[_0x5047('0x4f')]));if(_0x8ef435[_0x5047('0x44')][_0x5047('0x37')]){_0x35ce32[_0x5047('0x50')]=_[_0x5047('0x51')](_0x35ce32[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x35ce32[_0x5047('0x48')],function(_0x25c823){var _0x2b2158={};_0x2b2158[_0x25c823]={'$like':'%'+_0x8ef435[_0x5047('0x44')][_0x5047('0x37')]+'%'};return _0x2b2158;})});}_0x35ce32=_['merge']({},_0x35ce32,_0x8ef435['options']);return _0x4c735c[_0x5047('0x118')](_0x35ce32);}})[_0x5047('0x20')](function(_0x439bb8){if(_0x439bb8){_0x3ca1ab=_0x439bb8['length'];if(!_0x8ef435[_0x5047('0x44')][_0x5047('0x4a')](_0x5047('0x4b'))){_0x35ce32[_0x5047('0x4c')]=qs['limit'](_0x8ef435['query'][_0x5047('0x4c')]);_0x35ce32['offset']=qs[_0x5047('0x2b')](_0x8ef435[_0x5047('0x44')][_0x5047('0x2b')]);}return _0x4c735c[_0x5047('0x118')](_0x35ce32);}})[_0x5047('0x20')](function(_0x150508){if(_0x150508){return _0x150508?{'count':_0x3ca1ab,'rows':_0x150508}:null;}})[_0x5047('0x20')](respondWithResult(_0x21f81e,null))[_0x5047('0x27')](handleError(_0x21f81e,null));};exports[_0x5047('0x119')]=function(_0x265835,_0x411205,_0x20257f){var _0x2ee350={};var _0x7eae31={};var _0x1008b9;var _0xef2094;return db['User'][_0x5047('0x9b')]({'where':{'id':_0x265835[_0x5047('0x59')]['id']}})[_0x5047('0x20')](handleEntityNotFound(_0x411205,null))[_0x5047('0x20')](function(_0x26634c){if(_0x26634c){_0x1008b9=_0x26634c;_0x7eae31[_0x5047('0x46')]=_[_0x5047('0x5b')](db['User'][_0x5047('0x41')]);_0x7eae31['query']=_[_0x5047('0x5b')](_0x265835[_0x5047('0x44')]);_0x7eae31['filters']=_[_0x5047('0x45')](_0x7eae31[_0x5047('0x46')],_0x7eae31[_0x5047('0x44')]);_0x2ee350[_0x5047('0x48')]=_[_0x5047('0x45')](_0x7eae31[_0x5047('0x46')],qs[_0x5047('0x47')](_0x265835[_0x5047('0x44')][_0x5047('0x47')]));_0x2ee350['attributes']=_0x2ee350[_0x5047('0x48')]['length']?_0x2ee350['attributes']:_0x7eae31[_0x5047('0x46')];_0x2ee350[_0x5047('0xc0')]=qs['sort'](_0x265835[_0x5047('0x44')][_0x5047('0x4d')]);_0x2ee350[_0x5047('0x50')]=qs[_0x5047('0x4f')](_[_0x5047('0x4e')](_0x265835[_0x5047('0x44')],_0x7eae31['filters']));if(_0x265835[_0x5047('0x44')][_0x5047('0x37')]){_0x2ee350['where']=_[_0x5047('0x51')](_0x2ee350[_0x5047('0x50')],{'$or':_[_0x5047('0x39')](_0x2ee350['attributes'],function(_0x236f38){var _0x2b5b26={};_0x2b5b26[_0x236f38]={'$like':'%'+_0x265835[_0x5047('0x44')][_0x5047('0x37')]+'%'};return _0x2b5b26;})});}_0x2ee350[_0x5047('0x46')]=db[_0x5047('0x40')];_0x2ee350['as']=_0x5047('0x34');_0x2ee350=_[_0x5047('0x51')]({},_0x2ee350,_0x265835[_0x5047('0x55')]);return _0x1008b9[_0x5047('0x105')]({'include':[_0x2ee350]});}})[_0x5047('0x20')](function(_0x5bed45){if(_0x5bed45){var _0x50cd67={},_0x1a9429=[],_0x58a2bd=0x0;for(var _0x3409f6=0x0;_0x3409f6<_0x5bed45['length'];_0x3409f6+=0x1){for(var _0x10907f=0x0,_0x16fbe1;_0x10907f<_0x5bed45[_0x3409f6][_0x5047('0x34')]['length'];_0x10907f+=0x1){_0x16fbe1=_0x5bed45[_0x3409f6]['Agents'][_0x10907f][_0x5047('0xad')]({'plain':!![]});_0x50cd67[_0x16fbe1['id']]=_0x16fbe1;}}_0x50cd67=_[_0x5047('0x11a')](_0x50cd67);for(var _0x125bae=qs[_0x5047('0x2b')](_0x265835[_0x5047('0x44')]['offset']);_0x125bae<_0x50cd67['length']&&_0x1a9429['length']=_0x108abb){_0x15d339=_0x108abb;_0x626e3e=0xc8;}else{_0x626e3e=0xce;}_0xd03fca[_0x8202('0x27')](_0x626e3e);return _0xd03fca[_0x8202('0x2d')](_0x8202('0x2e'),_0x1daaab+'-'+_0x15d339+'/'+_0x108abb)[_0x8202('0x29')](_0x5bb092);}return null;};}function patchUpdates(_0x1fb500){return function(_0x185322){try{jsonpatch[_0x8202('0x2f')](_0x185322,_0x1fb500,!![]);}catch(_0x41e674){return BPromise[_0x8202('0x30')](_0x41e674);}return _0x185322[_0x8202('0x31')]();};}function saveUpdates(_0x4c035d,_0x20d812){return function(_0x163746){if(_0x163746){return _0x163746[_0x8202('0x32')](_0x4c035d)[_0x8202('0x33')](function(_0x28f7c1){return _0x28f7c1;});}return null;};}function removeEntity(_0xced3a1,_0xb1f08f){return function(_0x527de6){if(_0x527de6){return _0x527de6[_0x8202('0x34')]()[_0x8202('0x33')](function(){var _0x26d2e9=_0x527de6[_0x8202('0x35')]({'plain':!![]});if(_0x26d2e9['role']===_0x8202('0x36'))return;var _0x198d07=[{'name':_0x8202('0x37'),'value':_0x8202('0x38'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0x8202('0x39'),'value':_0x8202('0x3a'),'ignore':![]}];var _0xf36e7c=_(_0x198d07)[_0x8202('0x3b')](_0x8202('0x3c'))[_0x8202('0x3d')]('value')['value']();if(_['includes'](_0xf36e7c,_0x26d2e9[_0x8202('0x3e')])){return;}var _0x4bc0a3=_[_0x8202('0x3f')](_0x198d07,['value',_0x26d2e9[_0x8202('0x3e')]])['name'];return db[_0x8202('0x40')]['destroy']({'where':{'type':_0x4bc0a3,'resourceId':_0x26d2e9['id']}})[_0x8202('0x33')](function(){return _0x527de6;});})[_0x8202('0x33')](function(){_0xced3a1[_0x8202('0x27')](0xcc)[_0x8202('0x28')]();});}};}function handleEntityNotFound(_0x135e89,_0x3633d0){return function(_0x15b38e){if(!_0x15b38e){_0x135e89[_0x8202('0x41')](0x194);}return _0x15b38e;};}function handleError(_0x16f6ef,_0x151180){_0x151180=_0x151180||0x1f4;return function(_0x40ff31){logger['error'](_0x40ff31[_0x8202('0x42')]);if(_0x40ff31[_0x8202('0x43')]){delete _0x40ff31[_0x8202('0x43')];}_0x16f6ef[_0x8202('0x27')](_0x151180)[_0x8202('0x44')](_0x40ff31);};}exports['index']=function(_0x3f825e,_0x9c6403){var _0x377fbe={},_0x4d5325={},_0x304fe1={'count':0x0,'rows':[]};var _0x435c08=_[_0x8202('0x3d')](db[_0x8202('0x45')][_0x8202('0x46')],function(_0x13be7e){return{'name':_0x13be7e[_0x8202('0x47')],'type':_0x13be7e[_0x8202('0x48')][_0x8202('0x49')]};});_0x4d5325['model']=_['differenceBy'](_[_0x8202('0x3d')](_0x435c08,_0x8202('0x43')),[_0x8202('0x4a'),_0x8202('0x4b')]);_0x4d5325['query']=_[_0x8202('0x4c')](_0x3f825e['query']);_0x4d5325[_0x8202('0x4d')]=_[_0x8202('0x4e')](_0x4d5325['model'],_0x4d5325[_0x8202('0x4f')]);_0x377fbe[_0x8202('0x50')]=_[_0x8202('0x4e')](_0x4d5325[_0x8202('0x51')],qs[_0x8202('0x52')](_0x3f825e[_0x8202('0x4f')][_0x8202('0x52')]));_0x377fbe[_0x8202('0x50')]=_0x377fbe[_0x8202('0x50')][_0x8202('0x53')]?_0x377fbe[_0x8202('0x50')]:_0x4d5325[_0x8202('0x51')];if(!_0x3f825e[_0x8202('0x4f')][_0x8202('0x54')]('nolimit')){_0x377fbe[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x3f825e[_0x8202('0x4f')][_0x8202('0x2c')]);_0x377fbe['offset']=qs[_0x8202('0x2b')](_0x3f825e[_0x8202('0x4f')]['offset']);}_0x377fbe[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x3f825e[_0x8202('0x4f')][_0x8202('0x56')]);_0x377fbe[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x3f825e['query'],_0x4d5325[_0x8202('0x4d')]),_0x435c08);if(_0x3f825e[_0x8202('0x4f')][_0x8202('0x3b')]){_0x377fbe[_0x8202('0x57')]=_[_0x8202('0x59')](_0x377fbe[_0x8202('0x57')],{'$or':_['map'](_0x435c08,function(_0x47328f){if(_0x47328f[_0x8202('0x48')]!==_0x8202('0x5a')){return db[_0x8202('0x5b')][_0x8202('0x57')](db[_0x8202('0x5b')]['fn'](_0x8202('0x5c'),db['sequelize'][_0x8202('0x5d')](_0x47328f['name'])),{'$like':db['sequelize']['fn'](_0x8202('0x5c'),'%'+_0x3f825e[_0x8202('0x4f')][_0x8202('0x3b')]+'%')});}})});}_0x377fbe=_['merge']({},_0x377fbe,_0x3f825e[_0x8202('0x5e')]);var _0x2d6446={'where':_0x377fbe[_0x8202('0x57')]};return db[_0x8202('0x45')][_0x8202('0x2a')](_0x2d6446)[_0x8202('0x33')](function(_0x5818d5){_0x304fe1[_0x8202('0x2a')]=_0x5818d5;if(_0x3f825e['query'][_0x8202('0x5f')]){_0x377fbe[_0x8202('0x60')]=[{'all':!![]}];}return db['User'][_0x8202('0x61')](_0x377fbe);})[_0x8202('0x33')](function(_0x5b09bd){_0x304fe1[_0x8202('0x62')]=_0x5b09bd;return _0x304fe1;})[_0x8202('0x33')](respondWithFilteredResult(_0x9c6403,_0x377fbe))[_0x8202('0x26')](handleError(_0x9c6403,null));};exports[_0x8202('0x63')]=function(_0x2f1323,_0x4e6f4c){var _0x201886={'raw':![],'where':{'id':_0x2f1323[_0x8202('0x64')]['id']}},_0x1fa7f5={};_0x1fa7f5[_0x8202('0x51')]=_[_0x8202('0x65')](_[_0x8202('0x4c')](db['User'][_0x8202('0x46')]),['password',_0x8202('0x4b')]);_0x1fa7f5[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x2f1323[_0x8202('0x4f')]);_0x1fa7f5['filters']=_['intersection'](_0x1fa7f5[_0x8202('0x51')],_0x1fa7f5[_0x8202('0x4f')]);_0x201886[_0x8202('0x50')]=_[_0x8202('0x4e')](_0x1fa7f5[_0x8202('0x51')],qs['fields'](_0x2f1323[_0x8202('0x4f')][_0x8202('0x52')]));_0x201886[_0x8202('0x50')]=_0x201886[_0x8202('0x50')]['length']?_0x201886[_0x8202('0x50')]:_0x1fa7f5[_0x8202('0x51')];if(_0x2f1323[_0x8202('0x4f')][_0x8202('0x5f')]){_0x201886[_0x8202('0x60')]=[{'all':!![]}];}_0x201886=_[_0x8202('0x59')]({},_0x201886,_0x2f1323[_0x8202('0x5e')]);return db['User'][_0x8202('0x3f')](_0x201886)[_0x8202('0x33')](handleEntityNotFound(_0x4e6f4c,null))[_0x8202('0x33')](respondWithResult(_0x4e6f4c,null))[_0x8202('0x26')](handleError(_0x4e6f4c,null));};exports[_0x8202('0x32')]=function(_0x1ef264,_0x1a4f59){if(_0x1ef264[_0x8202('0x66')]['id']){delete _0x1ef264[_0x8202('0x66')]['id'];}delete _0x1ef264[_0x8202('0x66')][_0x8202('0x3e')];return db['User'][_0x8202('0x3f')]({'where':{'id':_0x1ef264[_0x8202('0x64')]['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x1a4f59,null))[_0x8202('0x33')](saveUpdates(_0x1ef264[_0x8202('0x66')],null))[_0x8202('0x33')](respondWithResult(_0x1a4f59,null))['catch'](handleError(_0x1a4f59,null));};exports[_0x8202('0x67')]=function(_0x4336de,_0x1363ca){return db[_0x8202('0x45')][_0x8202('0x67')]()[_0x8202('0x33')](respondWithResult(_0x1363ca,null))[_0x8202('0x26')](handleError(_0x1363ca,null));};exports[_0x8202('0x68')]=function(_0x3ce393,_0x52d9eb,_0x358b85){return db[_0x8202('0x45')]['find']({'where':{'id':_0x3ce393['params']['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x52d9eb,null))[_0x8202('0x33')](function(_0x458ced){if(_0x458ced){return _0x458ced[_0x8202('0x68')](_0x3ce393[_0x8202('0x66')][_0x8202('0x69')],_['omit'](_0x3ce393[_0x8202('0x66')],['ids','id'])||{});}})[_0x8202('0x33')](respondWithResult(_0x52d9eb,null))[_0x8202('0x26')](handleError(_0x52d9eb,null));};function validateUser(_0x2cd7b0){return new BPromise(function(_0x4b5da3,_0xc5377b){if(_0x2cd7b0[_0x8202('0x6a')])return _0x4b5da3(_0x2cd7b0);return db['Setting']['findById'](0x1)[_0x8202('0x33')](function(_0x173d5f){if(_0x173d5f['securePassword'])authService[_0x8202('0x6b')](_0x2cd7b0[_0x8202('0x4a')]);db[_0x8202('0x45')][_0x8202('0x6c')](_0x8202('0x6a'))[_0x8202('0x33')](function(_0x11a26e){if(_[_0x8202('0x6d')](_0x11a26e)){_0x2cd7b0[_0x8202('0x6a')]=_0x173d5f[_0x8202('0x6e')]||0x1;return;}if(_['isNil'](_0x173d5f[_0x8202('0x6e')])||_0x173d5f['min_internal']===_0x11a26e){_0x2cd7b0[_0x8202('0x6a')]=_0x11a26e+0x1;return;}if(_0x173d5f[_0x8202('0x6e')]>_0x11a26e){_0x2cd7b0[_0x8202('0x6a')]=_0x173d5f['min_internal'];return;}return db[_0x8202('0x5b')][_0x8202('0x4f')](_0x8202('0x6f'),{'type':db[_0x8202('0x5b')][_0x8202('0x70')][_0x8202('0x71')]})[_0x8202('0x33')](function(_0xfd114b){if(_0xfd114b&&_0xfd114b['length']){for(var _0x1852dc=0x0,_0x22154b=_0xfd114b[_0x8202('0x53')];_0x1852dc<_0x22154b&&_[_0x8202('0x6d')](_0x2cd7b0[_0x8202('0x6a')]);_0x1852dc++){if(_0x173d5f['min_internal']<=_0xfd114b[_0x1852dc][_0x8202('0x72')]){_0x2cd7b0['internal']=_0xfd114b[_0x1852dc]['from'];}else if(_0x173d5f[_0x8202('0x6e')]>_0xfd114b[_0x1852dc][_0x8202('0x72')]&&_0x173d5f[_0x8202('0x6e')]<=_0xfd114b[_0x1852dc]['to']){_0x2cd7b0[_0x8202('0x6a')]=_0x173d5f[_0x8202('0x6e')];}}}if(_[_0x8202('0x6d')](_0x2cd7b0[_0x8202('0x6a')])){_0x2cd7b0[_0x8202('0x6a')]=_0x11a26e+0x1;}return _0x4b5da3(_0x2cd7b0);});});})['catch'](function(_0x1135f8){_0xc5377b(_0x1135f8);});});}function updateUser(_0x24fdd3){return new BPromise(function(_0x57a053,_0xf3952){try{if(_0x24fdd3[_0x8202('0x73')]){_0x24fdd3[_0x8202('0x74')]=_0x24fdd3[_0x8202('0x6a')];_0x24fdd3[_0x8202('0x75')]={'mailbox':_0x24fdd3[_0x8202('0x6a')],'password':_0x24fdd3[_0x8202('0x4a')],'fullname':_0x24fdd3[_0x8202('0x76')],'email':_0x24fdd3[_0x8202('0x77')]};}if(_0x24fdd3['role']===_0x8202('0x78')){if(!_0x24fdd3[_0x8202('0x79')])_0x24fdd3[_0x8202('0x79')]=['101','102',_0x8202('0x7a'),_0x8202('0x7b'),_0x8202('0x7c'),'104',_0x8202('0x7d'),_0x8202('0x7e'),'107',_0x8202('0x7f'),'109',_0x8202('0x80'),_0x8202('0x81'),'114'];}_0x57a053(_0x24fdd3);}catch(_0x100781){_0xf3952(_0x100781);}});}exports[_0x8202('0x82')]=function(_0x5dabe3,_0x30c5d1){if(_0x5dabe3[_0x8202('0x38')][_0x8202('0x3e')]===_0x8202('0x78'))throw new Error(_0x8202('0x83'));if(_0x5dabe3[_0x8202('0x66')][_0x8202('0x3e')]===_0x8202('0x38')&&_0x5dabe3[_0x8202('0x38')][_0x8202('0x3e')]!=='admin'){throw new Error(_0x8202('0x84'));}if(_0x5dabe3[_0x8202('0x66')]['role']===_0x8202('0x36')&&_0x5dabe3['user'][_0x8202('0x3e')]!==_0x8202('0x36')){throw new Error(_0x8202('0x85'));}return licenseUtil[_0x8202('0x86')]([_0x5dabe3[_0x8202('0x66')]])['then'](function(){return validateUser(_0x5dabe3[_0x8202('0x66')]);})[_0x8202('0x33')](function(_0x5469a8){return updateUser(_0x5469a8)[_0x8202('0x33')](function(_0x198d44){if(_0x198d44[_0x8202('0x3e')]===_0x8202('0x36')){_0x198d44[_0x8202('0x87')]=_0x5dabe3[_0x8202('0x38')][_0x8202('0x87')];delete _0x198d44[_0x8202('0x88')];}return _0x198d44;});})[_0x8202('0x33')](function(_0x478030){return db[_0x8202('0x45')][_0x8202('0x82')](_0x478030,{'include':[{'model':db['VoiceMail'],'as':_0x8202('0x75')}]});})[_0x8202('0x33')](function(_0x43ce84){if(_0x5dabe3[_0x8202('0x66')][_0x8202('0x3e')]===_0x8202('0x38'))return _0x43ce84;if(_0x5dabe3[_0x8202('0x38')]['role']!==_0x8202('0x38'))return _0x43ce84;return db[_0x8202('0x89')]['find']({'where':{'name':_0x43ce84[_0x8202('0x3e')]===_0x8202('0x78')?_0x8202('0x8a'):_0x8202('0x39'),'userProfileId':_0x5dabe3['user'][_0x8202('0x88')]},'raw':!![]})['then'](function(_0x3601f9){if(!_0x3601f9||_0x3601f9[_0x8202('0x8b')]!=0x0)return _0x43ce84;return db[_0x8202('0x40')][_0x8202('0x82')]({'name':_0x43ce84[_0x8202('0x43')],'resourceId':_0x43ce84['id'],'type':_0x3601f9[_0x8202('0x43')],'sectionId':_0x3601f9['id']},{})[_0x8202('0x33')](function(){return _0x43ce84;});})[_0x8202('0x26')](function(_0x3872fd){logger[_0x8202('0x22')](_0x8202('0x8c'),_0x3872fd);throw _0x3872fd;});})[_0x8202('0x33')](respondWithResult(_0x30c5d1,0xc9))[_0x8202('0x26')](handleError(_0x30c5d1,null));};exports[_0x8202('0x8d')]=function(_0x1a147e,_0x51fe23){var _0x64a31e=_0x1a147e[_0x8202('0x66')];var _0x241cb0=[];if(_0x1a147e[_0x8202('0x38')][_0x8202('0x3e')]===_0x8202('0x78'))throw new Error(_0x8202('0x83'));if(_[_0x8202('0x8e')](_0x64a31e,[_0x8202('0x3e'),_0x8202('0x38')])&&_0x1a147e[_0x8202('0x38')][_0x8202('0x3e')]!==_0x8202('0x36')){throw new Error(_0x8202('0x84'));}if(_[_0x8202('0x8e')](_0x64a31e,[_0x8202('0x3e'),'admin'])&&_0x1a147e[_0x8202('0x38')][_0x8202('0x3e')]!=='admin'){throw new Error(_0x8202('0x8f'));}return licenseUtil[_0x8202('0x86')](_0x64a31e)['then'](function(){return validateUser(_0x64a31e[0x0]);})[_0x8202('0x33')](function(){for(var _0x474180=0x1;_0x474180<_0x64a31e[_0x8202('0x53')];_0x474180++){var _0x1624e3=_0x64a31e[_0x474180-0x1][_0x8202('0x6a')];if(!_0x64a31e[_0x474180][_0x8202('0x6a')])_0x64a31e[_0x474180][_0x8202('0x6a')]=_0x1624e3+0x1;_0x241cb0[_0x8202('0x90')](validateUser(_0x64a31e[_0x474180]));}return BPromise[_0x8202('0x91')](_0x241cb0);})[_0x8202('0x33')](function(){_0x241cb0=[];for(var _0x3b4aad=0x0;_0x3b4aad<_0x64a31e[_0x8202('0x53')];_0x3b4aad++){_0x241cb0['push'](updateUser(_0x64a31e[_0x3b4aad]));}return BPromise[_0x8202('0x91')](_0x241cb0);})[_0x8202('0x33')](function(){return BPromise['each'](_0x64a31e,function(_0x3c7c81){return db[_0x8202('0x45')][_0x8202('0x82')](_0x3c7c81,{'include':[{'model':db[_0x8202('0x75')],'as':_0x8202('0x75')}]})['then'](function(_0x2bd26b){_0x3c7c81['id']=_0x2bd26b['id'];return _0x3c7c81;});});})[_0x8202('0x33')](function(_0x2ea594){if(_0x1a147e[_0x8202('0x66')][_0x8202('0x3e')]==='user')return _0x2ea594;if(_0x1a147e[_0x8202('0x38')][_0x8202('0x3e')]!=='user')return _0x2ea594;var _0x7413ed=_[_0x8202('0x8e')](_0x2ea594,function(_0x5a04d0){return _0x5a04d0[_0x8202('0x3e')]===_0x8202('0x78')||_0x5a04d0['role']===_0x8202('0x3a');});if(!_0x7413ed)return _0x2ea594;return db[_0x8202('0x89')][_0x8202('0x61')]({'where':{'name':{'$or':[_0x8202('0x8a'),'Telephones']},'userProfileId':_0x1a147e[_0x8202('0x38')]['userProfileId']},'raw':!![]})['then'](function(_0x345a43){if(_[_0x8202('0x92')](_0x345a43)||!_[_0x8202('0x8e')](_0x345a43,[_0x8202('0x8b'),0x0]))return _0x2ea594;_0x241cb0=[];var _0x5a1eb1=_(_0x345a43)[_0x8202('0x3d')](function(_0x378104){if(_0x378104[_0x8202('0x8b')]===0x1)return;return _0x378104[_0x8202('0x43')]===_0x8202('0x8a')?_0x8202('0x78'):_0x8202('0x3a');})[_0x8202('0x93')]()[_0x8202('0x94')]();for(var _0x3e0b3e=0x0;_0x3e0b3e<_0x2ea594[_0x8202('0x53')];_0x3e0b3e++){if(!_[_0x8202('0x95')](_0x5a1eb1,_0x2ea594[_0x3e0b3e]['role']))return;var _0x17c56d=_0x2ea594[_0x3e0b3e][_0x8202('0x3e')]===_0x8202('0x78')?_0x8202('0x8a'):_0x8202('0x39');_0x241cb0[_0x8202('0x90')](db[_0x8202('0x40')][_0x8202('0x82')]({'name':_0x2ea594[_0x3e0b3e]['name'],'resourceId':_0x2ea594[_0x3e0b3e]['id'],'type':_0x17c56d,'sectionId':_['find'](_0x345a43,[_0x8202('0x43'),_0x17c56d])['id']},{}));}return BPromise['all'](_0x241cb0);})[_0x8202('0x33')](respondWithResult(_0x51fe23,0xc9))[_0x8202('0x26')](handleError(_0x51fe23,null));});};exports[_0x8202('0x96')]=function(_0xd14467,_0x217b0e,_0x386feb){if(_0xd14467[_0x8202('0x66')]['id']){delete _0xd14467[_0x8202('0x66')]['id'];}return db[_0x8202('0x45')][_0x8202('0x3f')]({'where':{'id':_0xd14467[_0x8202('0x64')]['id']}})['then'](function(_0x2cb665){if(!_0x2cb665)return null;if(_0x2cb665['id']===_0xd14467[_0x8202('0x38')]['id']){if(!_0xd14467[_0x8202('0x66')][_0x8202('0x97')]||!_0xd14467[_0x8202('0x66')][_0x8202('0x98')]){throw new db['Sequelize'][(_0x8202('0x99'))](_0x8202('0x9a'));}if(!_0x2cb665[_0x8202('0x9b')](_0xd14467[_0x8202('0x66')][_0x8202('0x97')])){throw new db[(_0x8202('0x9c'))][(_0x8202('0x99'))](_0x8202('0x9d'));}if(_0xd14467[_0x8202('0x66')]['oldPassword']===_0xd14467[_0x8202('0x66')][_0x8202('0x98')]){throw new db[(_0x8202('0x9c'))][(_0x8202('0x99'))](_0x8202('0x9e'));}}else if(_0xd14467[_0x8202('0x38')][_0x8202('0x3e')]===_0x8202('0x36')){if(!_0xd14467[_0x8202('0x66')][_0x8202('0x98')]){throw new db[(_0x8202('0x9c'))]['ValidationError'](_0x8202('0x9f'));}}else if(_0xd14467['user']['role']===_0x8202('0x38')){if(!_0xd14467[_0x8202('0x66')][_0x8202('0x98')]){throw new db['Sequelize'][(_0x8202('0x99'))](_0x8202('0x9f'));}if(_0x2cb665[_0x8202('0x3e')]!==_0x8202('0x78')){throw new db[(_0x8202('0x9c'))]['ValidationError'](_0x8202('0x83'));}}else{throw new db[(_0x8202('0x9c'))]['ValidationError'](_0x8202('0x83'));}return _0x2cb665;})[_0x8202('0x33')](handleEntityNotFound(_0x217b0e,null))[_0x8202('0x33')](function(_0x1e29a3){return db[_0x8202('0xa0')][_0x8202('0xa1')]({'attributes':['id','securePassword',_0x8202('0xa2'),_0x8202('0xa3')]})[_0x8202('0x33')](function(_0x4636c3){if(_0x4636c3['securePassword'])authService[_0x8202('0x6b')](_0xd14467[_0x8202('0x66')]['newPassword']);if(!_0x4636c3['enforcePasswordHistory']||!_0x1e29a3[_0x8202('0xa4')])return _0x1e29a3;authService[_0x8202('0xa5')](_0xd14467[_0x8202('0x66')][_0x8202('0x98')],_0x1e29a3[_0x8202('0xa4')],_0x4636c3[_0x8202('0xa3')]);return _0x1e29a3;})[_0x8202('0x33')](saveUpdates({'password':_0xd14467[_0x8202('0x66')]['newPassword'],'passwordResetAt':_0xd14467[_0x8202('0x38')]['id']==_0xd14467[_0x8202('0x64')]['id']?moment():null,'previousPasswords':authService[_0x8202('0xa6')](_0xd14467[_0x8202('0x66')]['newPassword'],_0x1e29a3[_0x8202('0xa4')])},null));})[_0x8202('0x33')](respondWithResult(_0x217b0e,null))['catch'](handleError(_0x217b0e,null));};exports[_0x8202('0xa7')]=function(_0x4f64ea,_0x148d63,_0x3ce653){var _0x3191f2=_0x4f64ea['body'][_0x8202('0xa8')];return db[_0x8202('0x45')][_0x8202('0x3f')]({'where':{'id':_0x4f64ea[_0x8202('0x64')]['id']},'attributes':['id',_0x8202('0x43'),_0x8202('0x3e'),_0x8202('0xa9'),'loginInPause',_0x8202('0xaa'),'interface']})[_0x8202('0x33')](handleEntityNotFound(_0x148d63,null))['then'](function(_0x21c9b3){if(_0x21c9b3){if(!utils[_0x8202('0xab')](_0x3191f2)){throw new db[(_0x8202('0x9c'))][(_0x8202('0x99'))]('Unknown\x20channel');}return _0x21c9b3[_0x8202('0xac')+_[_0x8202('0xad')](_0x3191f2['toLowerCase']())+'Queues'](_0x4f64ea[_0x8202('0x66')]['ids'],{'penalty':_0x4f64ea['body'][_0x8202('0xae')]||0x0})[_0x8202('0xaf')](function(_0x17db07){for(var _0x3c021e=0x0;_0x3c021e<_0x4f64ea[_0x8202('0x66')]['ids'][_0x8202('0x53')];_0x3c021e+=0x1){var _0x30af7c={'UserId':_0x4f64ea[_0x8202('0x64')]['id']};_0x30af7c[_[_0x8202('0xad')](_0x3191f2[_0x8202('0xb0')]())+'QueueId']=_0x4f64ea['body']['ids'][_0x3c021e];socket[_0x8202('0xb1')](_0x8202('0x38')+_[_0x8202('0xad')](_0x3191f2[_0x8202('0xb0')]())+'Queue:save',_0x30af7c);}return _0x17db07;})[_0x8202('0x33')](function(){if(_0x3191f2===_0x8202('0xb2')){return db[_0x8202('0xb3')]['findAll']({'where':{'id':_0x4f64ea[_0x8202('0x66')][_0x8202('0x69')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x23fb5f){var _0x399ff2=_0x21c9b3['get']({'plain':!![]});var _0x40bcdc=[];if(_0x3191f2===_0x8202('0xb2')&&_0x399ff2[_0x8202('0x3e')]===_0x8202('0x78')&&_0x399ff2[_0x8202('0xa9')]){for(var _0x1dc8fe=0x0;_0x1dc8fe<_0x23fb5f[_0x8202('0x53')];_0x1dc8fe+=0x1){_0x40bcdc['push']({'membername':_0x399ff2['name'],'UserId':_0x399ff2['id'],'queue_name':_0x23fb5f[_0x1dc8fe][_0x8202('0x43')],'VoiceQueueId':_0x23fb5f[_0x1dc8fe]['id'],'interface':_['isNil'](_0x399ff2[_0x8202('0xb4')])?util[_0x8202('0xb5')](_0x8202('0xb6'),_0x399ff2['name']):_0x399ff2[_0x8202('0xb4')],'paused':_0x399ff2[_0x8202('0xaa')]||![],'penalty':_0x4f64ea[_0x8202('0x66')][_0x8202('0xae')]||0x0});}return BPromise[_0x8202('0xb7')](_0x40bcdc,function(_0x1c9739){return db[_0x8202('0xb8')]['upsert'](_0x1c9739);});}return _0x21c9b3;});}})[_0x8202('0x33')](respondWithStatusCode(_0x148d63,null))['catch'](handleError(_0x148d63,null));};exports[_0x8202('0xb9')]=function(_0x5e72cb,_0x2a84f9,_0x2f2998){var _0xa7f0d6;return db[_0x8202('0x45')][_0x8202('0x3f')]({'where':{'id':_0x5e72cb[_0x8202('0x64')]['id']},'attributes':['id',_0x8202('0x43'),_0x8202('0x3e')]})[_0x8202('0x33')](handleEntityNotFound(_0x2a84f9,null))[_0x8202('0x33')](function(_0x17a315){if(_0x17a315){_0xa7f0d6=_0x17a315;if(!_0x5e72cb['query'][_0x8202('0xa8')]||!utils[_0x8202('0xab')](_0x5e72cb[_0x8202('0x4f')][_0x8202('0xa8')])){throw new db[(_0x8202('0x9c'))]['ValidationError'](_0x8202('0xba'));}return _0x17a315[_0x8202('0xbb')+_[_0x8202('0xad')](_0x5e72cb[_0x8202('0x4f')]['channel']['toLowerCase']())+'Queues'](_0x5e72cb['query'][_0x8202('0x69')]);}})['then'](function(_0xe0a416){for(var _0x57cd8b=0x0;_0x57cd8b<_0x5e72cb[_0x8202('0x4f')][_0x8202('0x69')][_0x8202('0x53')];_0x57cd8b+=0x1){var _0x175283={'UserId':_0x5e72cb[_0x8202('0x64')]['id']};_0x175283[_['capitalize'](_0x5e72cb['query'][_0x8202('0xa8')][_0x8202('0xb0')]())+'QueueId']=_0x5e72cb[_0x8202('0x4f')][_0x8202('0x69')][_0x57cd8b];socket['emit'](_0x8202('0x38')+_['capitalize'](_0x5e72cb[_0x8202('0x4f')]['channel'][_0x8202('0xb0')]())+_0x8202('0xbc'),_0x175283);}return _0xe0a416;})['then'](function(){if(_0x5e72cb[_0x8202('0x4f')][_0x8202('0xa8')]===_0x8202('0xb2')){return db[_0x8202('0xb8')][_0x8202('0x34')]({'where':{'UserId':_0x5e72cb[_0x8202('0x64')]['id'],'VoiceQueueId':_0x5e72cb['query'][_0x8202('0x69')]},'individualHooks':!![]})[_0x8202('0x33')](function(){return _0xa7f0d6;});}return _0xa7f0d6;})[_0x8202('0x33')](respondWithStatusCode(_0x2a84f9,null))[_0x8202('0x26')](handleError(_0x2a84f9,null));};exports[_0x8202('0xbd')]=function(_0x4e980c,_0x576322,_0x35cf84){_0x4e980c[_0x8202('0x66')][_0x8202('0xbe')]=_0x4e980c[_0x8202('0xbf')]['filename'];return db[_0x8202('0x45')][_0x8202('0x3f')]({'where':{'id':_0x4e980c[_0x8202('0x64')]['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x576322,null))['then'](saveUpdates(_0x4e980c['body'],null))[_0x8202('0x33')](respondWithResult(_0x576322,null))[_0x8202('0x26')](handleError(_0x576322,null));};exports['getAvatar']=function(_0x1c1744,_0x7c629d,_0x5c5547){var _0x57f3d7=path['join'](config['root'],_0x8202('0xc0'));return db[_0x8202('0x45')][_0x8202('0x3f')]({'where':{'id':_0x1c1744[_0x8202('0x64')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x7c629d,null))[_0x8202('0x33')](function(_0x413be8){if(_0x413be8){if(_[_0x8202('0x6d')](_0x413be8['userpic'])){return _0x7c629d[_0x8202('0xc1')](_0x57f3d7);}else{if(!fs[_0x8202('0xc2')](path[_0x8202('0xc3')](config[_0x8202('0xc4')],_0x8202('0xc5'),_0x413be8[_0x8202('0xbe')]))){return _0x7c629d['download'](_0x57f3d7);}return _0x7c629d['download'](path[_0x8202('0xc3')](config[_0x8202('0xc4')],_0x8202('0xc5'),_0x413be8[_0x8202('0xbe')]));}}})[_0x8202('0x26')](handleError(_0x7c629d,null));};exports['getContacts']=function(_0x1e0524,_0x14b062,_0x4e831d){var _0x5d83da={};var _0x38f5f6={};var _0x5a4299;var _0x119fac;return db[_0x8202('0x45')][_0x8202('0xa1')]({'where':{'id':_0x1e0524[_0x8202('0x64')]['id']}})['then'](handleEntityNotFound(_0x14b062,null))[_0x8202('0x33')](function(_0x2ee1f2){if(_0x2ee1f2){_0x5a4299=_0x2ee1f2;_0x38f5f6[_0x8202('0x51')]=_[_0x8202('0x4c')](db[_0x8202('0xc6')][_0x8202('0x46')]);_0x38f5f6['query']=_[_0x8202('0x4c')](_0x1e0524['query']);_0x38f5f6[_0x8202('0x4d')]=_['intersection'](_0x38f5f6[_0x8202('0x51')],_0x38f5f6['query']);_0x5d83da[_0x8202('0x50')]=_[_0x8202('0x4e')](_0x38f5f6['model'],qs[_0x8202('0x52')](_0x1e0524['query'][_0x8202('0x52')]));_0x5d83da[_0x8202('0x50')]=_0x5d83da['attributes']['length']?_0x5d83da[_0x8202('0x50')]:_0x38f5f6[_0x8202('0x51')];_0x5d83da[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x1e0524[_0x8202('0x4f')][_0x8202('0x56')]);_0x5d83da[_0x8202('0x57')]=qs[_0x8202('0x4d')](_['pick'](_0x1e0524['query'],_0x38f5f6[_0x8202('0x4d')]));if(_0x1e0524[_0x8202('0x4f')][_0x8202('0x3b')]){_0x5d83da[_0x8202('0x57')]=_[_0x8202('0x59')](_0x5d83da['where'],{'$or':_[_0x8202('0x3d')](_0x5d83da[_0x8202('0x50')],function(_0x20e23d){var _0x4735eb={};_0x4735eb[_0x20e23d]={'$like':'%'+_0x1e0524['query']['filter']+'%'};return _0x4735eb;})});}_0x5d83da=_[_0x8202('0x59')]({},_0x5d83da,_0x1e0524[_0x8202('0x5e')]);return _0x5a4299[_0x8202('0xc7')](_0x5d83da);}})[_0x8202('0x33')](function(_0x538d2c){if(_0x538d2c){_0x119fac=_0x538d2c[_0x8202('0x53')];if(_0x1e0524[_0x8202('0x4f')][_0x8202('0x54')](_0x8202('0x5f'))){_0x5d83da[_0x8202('0x60')]=[{'model':db['CmList'],'as':_0x8202('0xc8'),'required':![]},{'model':db[_0x8202('0xc9')],'as':'Tags','attributes':['id',_0x8202('0x43'),_0x8202('0xca')],'where':_0x1e0524[_0x8202('0x4f')][_0x8202('0xcb')]?{'id':_0x1e0524['query'][_0x8202('0xcb')]}:undefined,'required':_0x1e0524[_0x8202('0x4f')]['tag']?!![]:![]}];}if(!_0x1e0524['query'][_0x8202('0x54')]('nolimit')){_0x5d83da[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x1e0524['query'][_0x8202('0x2c')]);_0x5d83da[_0x8202('0x2b')]=qs[_0x8202('0x2b')](_0x1e0524[_0x8202('0x4f')][_0x8202('0x2b')]);}return _0x5a4299[_0x8202('0xc7')](_0x5d83da);}})[_0x8202('0x33')](function(_0x1d11b4){if(_0x1d11b4){return _0x1d11b4?{'count':_0x119fac,'rows':_0x1d11b4}:null;}})[_0x8202('0x33')](respondWithResult(_0x14b062,null))[_0x8202('0x26')](handleError(_0x14b062,null));};exports[_0x8202('0xcc')]=function(_0x81d7dc,_0x3c87a0,_0x5b1cc8){var _0x15f92c;var _0xe9daa;var _0xa18acd={};var _0x535343;return db[_0x8202('0x45')][_0x8202('0xa1')]({'where':{'id':_0x81d7dc[_0x8202('0x64')]['id']},'attributes':['id',_0x8202('0x43'),_0x8202('0x3e')]})[_0x8202('0x33')](handleEntityNotFound(_0x3c87a0,null))[_0x8202('0x33')](function(_0x57625c){if(!utils[_0x8202('0xab')](_0x81d7dc['query']['channel'])){throw new db['Sequelize'][(_0x8202('0x99'))]('Unknown\x20channel');}_0x15f92c=_0x57625c;var _0x1fc4a0={};_0x1fc4a0[_0x8202('0x51')]=_[_0x8202('0x4c')](db[_[_0x8202('0xad')](_0x81d7dc['query']['channel'])+_0x8202('0xcd')][_0x8202('0x46')]);_0x1fc4a0[_0x8202('0x4f')]=_['keys'](_0x81d7dc['query']);_0x1fc4a0[_0x8202('0x4d')]=_['intersection'](_0x1fc4a0['model'],_0x1fc4a0[_0x8202('0x4f')]);_0xa18acd['attributes']=_[_0x8202('0x4e')](_0x1fc4a0[_0x8202('0x51')],qs[_0x8202('0x52')](_0x81d7dc['query'][_0x8202('0x52')]));_0xa18acd[_0x8202('0x50')]=_0xa18acd['attributes'][_0x8202('0x53')]?_0xa18acd[_0x8202('0x50')]:_0x1fc4a0[_0x8202('0x51')];_0xa18acd[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x81d7dc[_0x8202('0x4f')][_0x8202('0x56')]);_0xa18acd[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x81d7dc['query'],_0x1fc4a0[_0x8202('0x4d')]));if(_0x81d7dc[_0x8202('0x4f')]['filter']){_0xa18acd[_0x8202('0x57')]=_[_0x8202('0x59')](_0xa18acd['where'],{'$or':_[_0x8202('0x3d')](_0xa18acd[_0x8202('0x50')],function(_0x16addd){var _0x12bca2={};_0x12bca2[_0x16addd]={'$like':'%'+_0x81d7dc[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x12bca2;})});}_0xa18acd=_[_0x8202('0x59')]({},_0xa18acd,_0x81d7dc[_0x8202('0x5e')]);switch(_0x15f92c[_0x8202('0x3e')]){case _0x8202('0x36'):return db[_[_0x8202('0xad')](_0x81d7dc['query']['channel'])+_0x8202('0xcd')][_0x8202('0x61')](_0xa18acd);case'user':case _0x8202('0x78'):return _0x15f92c[_0x8202('0x35')+_[_0x8202('0xad')](_0x81d7dc[_0x8202('0x4f')][_0x8202('0xa8')])+'Queues'](_0xa18acd);default:throw new db[(_0x8202('0x9c'))][(_0x8202('0x99'))](_0x8202('0xce'));}})['then'](function(_0x484907){_0x535343=_0x484907['length'];if(!_0x81d7dc[_0x8202('0x4f')][_0x8202('0x54')](_0x8202('0xcf'))){_0xa18acd[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x81d7dc['query']['limit']);_0xa18acd[_0x8202('0x2b')]=qs['offset'](_0x81d7dc[_0x8202('0x4f')]['offset']);}switch(_0x15f92c['role']){case'admin':return db[_['capitalize'](_0x81d7dc['query'][_0x8202('0xa8')])+_0x8202('0xcd')][_0x8202('0x61')](_0xa18acd);case _0x8202('0x38'):case _0x8202('0x78'):return _0x15f92c[_0x8202('0x35')+_['capitalize'](_0x81d7dc[_0x8202('0x4f')][_0x8202('0xa8')])+_0x8202('0xd0')](_0xa18acd);}})['then'](function(_0x2119ed){return{'count':_0x535343,'rows':_0x2119ed};})['then'](respondWithResult(_0x3c87a0,null))[_0x8202('0x26')](handleError(_0x3c87a0,null));};exports[_0x8202('0xd1')]=function(_0x22c61b,_0x32817c,_0x44171f){var _0xc3ecef={};var _0x2b2005={};var _0x5872d2;var _0x56b77d;return db[_0x8202('0x45')][_0x8202('0xa1')]({'where':{'id':_0x22c61b[_0x8202('0x64')]['id']}})['then'](handleEntityNotFound(_0x32817c,null))[_0x8202('0x33')](function(_0x8f9921){if(_0x8f9921){_0x5872d2=_0x8f9921;_0x2b2005['model']=_[_0x8202('0x4c')](db['UserVoiceQueueRt']['rawAttributes']);_0x2b2005[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x22c61b[_0x8202('0x4f')]);_0x2b2005['filters']=_[_0x8202('0x4e')](_0x2b2005[_0x8202('0x51')],_0x2b2005[_0x8202('0x4f')]);_0xc3ecef[_0x8202('0x50')]=_[_0x8202('0x4e')](_0x2b2005[_0x8202('0x51')],qs[_0x8202('0x52')](_0x22c61b[_0x8202('0x4f')]['fields']));_0xc3ecef[_0x8202('0x50')]=_0xc3ecef[_0x8202('0x50')]['length']?_0xc3ecef[_0x8202('0x50')]:_0x2b2005[_0x8202('0x51')];_0xc3ecef[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x22c61b[_0x8202('0x4f')]['sort']);_0xc3ecef[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x22c61b[_0x8202('0x4f')],_0x2b2005['filters']));if(_0x22c61b['query'][_0x8202('0x3b')]){_0xc3ecef[_0x8202('0x57')]=_[_0x8202('0x59')](_0xc3ecef[_0x8202('0x57')],{'$or':_[_0x8202('0x3d')](_0xc3ecef[_0x8202('0x50')],function(_0x3d944e){var _0x5a7157={};_0x5a7157[_0x3d944e]={'$like':'%'+_0x22c61b[_0x8202('0x4f')]['filter']+'%'};return _0x5a7157;})});}_0xc3ecef=_[_0x8202('0x59')]({},_0xc3ecef,_0x22c61b[_0x8202('0x5e')]);return _0x5872d2[_0x8202('0xd1')](_0xc3ecef);}})[_0x8202('0x33')](function(_0x1e7038){if(_0x1e7038){_0x56b77d=_0x1e7038[_0x8202('0x53')];if(!_0x22c61b[_0x8202('0x4f')][_0x8202('0x54')](_0x8202('0xcf'))){_0xc3ecef[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x22c61b['query'][_0x8202('0x2c')]);_0xc3ecef['offset']=qs[_0x8202('0x2b')](_0x22c61b[_0x8202('0x4f')][_0x8202('0x2b')]);}return _0x5872d2[_0x8202('0xd1')](_0xc3ecef);}})[_0x8202('0x33')](function(_0x28556e){if(_0x28556e){return _0x28556e?{'count':_0x56b77d,'rows':_0x28556e}:null;}})[_0x8202('0x33')](respondWithResult(_0x32817c,null))[_0x8202('0x26')](handleError(_0x32817c,null));};exports[_0x8202('0xd2')]=function(_0x5368a1,_0x50dd31,_0x1833c7){var _0x5d160a={};var _0x17e5da={};var _0x4d52b2;var _0xe0492c;return db[_0x8202('0x45')][_0x8202('0xa1')]({'where':{'id':_0x5368a1['params']['id']}})['then'](handleEntityNotFound(_0x50dd31,null))[_0x8202('0x33')](function(_0x23cb2b){if(_0x23cb2b){_0x4d52b2=_0x23cb2b;_0x17e5da['model']=_[_0x8202('0x4c')](db[_0x8202('0xd3')][_0x8202('0x46')]);_0x17e5da['query']=_['keys'](_0x5368a1[_0x8202('0x4f')]);_0x17e5da['filters']=_[_0x8202('0x4e')](_0x17e5da[_0x8202('0x51')],_0x17e5da[_0x8202('0x4f')]);_0x5d160a[_0x8202('0x50')]=_[_0x8202('0x4e')](_0x17e5da[_0x8202('0x51')],qs[_0x8202('0x52')](_0x5368a1[_0x8202('0x4f')][_0x8202('0x52')]));_0x5d160a[_0x8202('0x50')]=_0x5d160a[_0x8202('0x50')][_0x8202('0x53')]?_0x5d160a[_0x8202('0x50')]:_0x17e5da[_0x8202('0x51')];_0x5d160a[_0x8202('0x55')]=qs['sort'](_0x5368a1[_0x8202('0x4f')][_0x8202('0x56')]);_0x5d160a['where']=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x5368a1[_0x8202('0x4f')],_0x17e5da[_0x8202('0x4d')]));if(_0x5368a1[_0x8202('0x4f')]['filter']){_0x5d160a[_0x8202('0x57')]=_[_0x8202('0x59')](_0x5d160a[_0x8202('0x57')],{'$or':_[_0x8202('0x3d')](_0x5d160a[_0x8202('0x50')],function(_0x34a844){var _0x33ceca={};_0x33ceca[_0x34a844]={'$like':'%'+_0x5368a1['query'][_0x8202('0x3b')]+'%'};return _0x33ceca;})});}_0x5d160a=_[_0x8202('0x59')]({},_0x5d160a,_0x5368a1[_0x8202('0x5e')]);return _0x4d52b2[_0x8202('0xd2')](_0x5d160a);}})['then'](function(_0x455c96){if(_0x455c96){_0xe0492c=_0x455c96[_0x8202('0x53')];if(!_0x5368a1['query']['hasOwnProperty']('nolimit')){_0x5d160a[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x5368a1['query'][_0x8202('0x2c')]);_0x5d160a[_0x8202('0x2b')]=qs[_0x8202('0x2b')](_0x5368a1[_0x8202('0x4f')][_0x8202('0x2b')]);}return _0x4d52b2['getGroups'](_0x5d160a);}})[_0x8202('0x33')](function(_0x405a38){if(_0x405a38){return _0x405a38?{'count':_0xe0492c,'rows':_0x405a38}:null;}})[_0x8202('0x33')](respondWithResult(_0x50dd31,null))['catch'](handleError(_0x50dd31,null));};exports['getRecordings']=function(_0x2adf89,_0x441155,_0x2b694e){var _0x1c9ad8={'raw':!![],'where':{}};var _0x11a36e={};var _0x52274d={'count':0x0,'rows':[]};return db[_0x8202('0x45')][_0x8202('0xa1')]({'where':{'id':_0x2adf89[_0x8202('0x64')]['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x441155,null))[_0x8202('0x33')](function(_0x190e6d){if(_0x190e6d){_0x11a36e[_0x8202('0x51')]=_[_0x8202('0x4c')](db[_0x8202('0xd4')]['rawAttributes']);_0x11a36e[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x2adf89[_0x8202('0x4f')]);_0x11a36e[_0x8202('0x4d')]=_[_0x8202('0x4e')](_0x11a36e[_0x8202('0x51')],_0x11a36e[_0x8202('0x4f')]);_0x1c9ad8[_0x8202('0x50')]=_[_0x8202('0x4e')](_0x11a36e[_0x8202('0x51')],qs['fields'](_0x2adf89[_0x8202('0x4f')][_0x8202('0x52')]));_0x1c9ad8[_0x8202('0x50')]=_0x1c9ad8[_0x8202('0x50')][_0x8202('0x53')]?_0x1c9ad8[_0x8202('0x50')]:_0x11a36e[_0x8202('0x51')];if(!_0x2adf89['query'][_0x8202('0x54')](_0x8202('0xcf'))){_0x1c9ad8['limit']=qs['limit'](_0x2adf89[_0x8202('0x4f')][_0x8202('0x2c')]);_0x1c9ad8[_0x8202('0x2b')]=qs['offset'](_0x2adf89[_0x8202('0x4f')]['offset']);}_0x1c9ad8['order']=qs[_0x8202('0x56')](_0x2adf89[_0x8202('0x4f')][_0x8202('0x56')]);_0x1c9ad8[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x2adf89['query'],_0x11a36e['filters']));_0x1c9ad8[_0x8202('0x57')][_0x8202('0xd5')]=_0x190e6d['id'];if(_0x2adf89['query'][_0x8202('0x3b')]){_0x1c9ad8[_0x8202('0x57')]=_[_0x8202('0x59')](_0x1c9ad8[_0x8202('0x57')],{'$or':_[_0x8202('0x3d')](_0x1c9ad8[_0x8202('0x50')],function(_0x5ad2ce){var _0x2074a8={};_0x2074a8[_0x5ad2ce]={'$like':'%'+_0x2adf89[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x2074a8;})});}_0x1c9ad8=_[_0x8202('0x59')]({},_0x1c9ad8,_0x2adf89[_0x8202('0x5e')]);return db[_0x8202('0xd4')]['count']({'where':_0x1c9ad8[_0x8202('0x57')]})[_0x8202('0x33')](function(_0x948951){_0x52274d['count']=_0x948951;if(_0x2adf89[_0x8202('0x4f')][_0x8202('0x5f')]){_0x1c9ad8[_0x8202('0x60')]=[{'all':!![]}];}return db[_0x8202('0xd4')]['findAll'](_0x1c9ad8);})[_0x8202('0x33')](function(_0x411b2f){_0x52274d[_0x8202('0x62')]=_0x411b2f;return _0x52274d;});}})['then'](respondWithFilteredResult(_0x441155,_0x1c9ad8))[_0x8202('0x26')](handleError(_0x441155,null));};exports[_0x8202('0xd6')]=function(_0x2a49be,_0x28370d,_0x418c5b){var _0x237f65={'raw':!![],'where':{}};var _0x19e253={};var _0x4a09={'count':0x0,'rows':[]};return db[_0x8202('0x45')][_0x8202('0xa1')]({'where':{'id':_0x2a49be['params']['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x28370d,null))[_0x8202('0x33')](function(_0x1b40c2){if(_0x1b40c2){_0x19e253[_0x8202('0x51')]=_[_0x8202('0x4c')](db[_0x8202('0xd7')][_0x8202('0x46')]);_0x19e253[_0x8202('0x4f')]=_['keys'](_0x2a49be[_0x8202('0x4f')]);_0x19e253[_0x8202('0x4d')]=_[_0x8202('0x4e')](_0x19e253[_0x8202('0x51')],_0x19e253[_0x8202('0x4f')]);_0x237f65[_0x8202('0x50')]=_['intersection'](_0x19e253[_0x8202('0x51')],qs[_0x8202('0x52')](_0x2a49be[_0x8202('0x4f')][_0x8202('0x52')]));_0x237f65['attributes']=_0x237f65['attributes'][_0x8202('0x53')]?_0x237f65[_0x8202('0x50')]:_0x19e253[_0x8202('0x51')];if(!_0x2a49be[_0x8202('0x4f')][_0x8202('0x54')](_0x8202('0xcf'))){_0x237f65[_0x8202('0x2c')]=qs['limit'](_0x2a49be[_0x8202('0x4f')][_0x8202('0x2c')]);_0x237f65['offset']=qs[_0x8202('0x2b')](_0x2a49be[_0x8202('0x4f')][_0x8202('0x2b')]);}_0x237f65[_0x8202('0x55')]=qs['sort'](_0x2a49be['query'][_0x8202('0x56')]);_0x237f65[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x2a49be[_0x8202('0x4f')],_0x19e253[_0x8202('0x4d')]));_0x237f65[_0x8202('0x57')][_0x8202('0xd5')]=_0x1b40c2['id'];if(_0x2a49be['query'][_0x8202('0x3b')]){_0x237f65[_0x8202('0x57')]=_[_0x8202('0x59')](_0x237f65['where'],{'$or':_[_0x8202('0x3d')](_0x237f65[_0x8202('0x50')],function(_0x585465){var _0x5b6d46={};_0x5b6d46[_0x585465]={'$like':'%'+_0x2a49be[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x5b6d46;})});}_0x237f65=_[_0x8202('0x59')]({},_0x237f65,_0x2a49be[_0x8202('0x5e')]);return db[_0x8202('0xd7')]['count']({'where':_0x237f65[_0x8202('0x57')]})[_0x8202('0x33')](function(_0x5666de){_0x4a09['count']=_0x5666de;if(_0x2a49be['query'][_0x8202('0x5f')]){_0x237f65[_0x8202('0x60')]=[{'all':!![]}];}return db[_0x8202('0xd7')][_0x8202('0x61')](_0x237f65);})[_0x8202('0x33')](function(_0x16dff7){_0x4a09['rows']=_0x16dff7;return _0x4a09;});}})['then'](respondWithFilteredResult(_0x28370d,_0x237f65))['catch'](handleError(_0x28370d,null));};exports['getChatInteractions']=function(_0x1887ea,_0xef24f5,_0x281bd7){var _0x368e14={};var _0x28cc62={};var _0x5cda1c;var _0x2e0e0e;return db[_0x8202('0x45')][_0x8202('0xa1')]({'where':{'id':_0x1887ea[_0x8202('0x64')]['id']}})[_0x8202('0x33')](handleEntityNotFound(_0xef24f5,null))[_0x8202('0x33')](function(_0x30f054){if(_0x30f054){_0x5cda1c=_0x30f054;_0x28cc62[_0x8202('0x51')]=_['keys'](db[_0x8202('0xd8')][_0x8202('0x46')]);_0x28cc62['query']=_[_0x8202('0x4c')](_0x1887ea[_0x8202('0x4f')]);_0x28cc62['filters']=_['intersection'](_0x28cc62[_0x8202('0x51')],_0x28cc62[_0x8202('0x4f')]);_0x368e14[_0x8202('0x50')]=_[_0x8202('0x4e')](_0x28cc62[_0x8202('0x51')],qs[_0x8202('0x52')](_0x1887ea['query'][_0x8202('0x52')]));_0x368e14['attributes']=_0x368e14[_0x8202('0x50')]['length']?_0x368e14[_0x8202('0x50')]:_0x28cc62[_0x8202('0x51')];_0x368e14[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x1887ea[_0x8202('0x4f')][_0x8202('0x56')]);_0x368e14['where']=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x1887ea[_0x8202('0x4f')],_0x28cc62[_0x8202('0x4d')]));if(_0x1887ea[_0x8202('0x4f')][_0x8202('0x3b')]){_0x368e14[_0x8202('0x57')]=_[_0x8202('0x59')](_0x368e14['where'],{'$or':_['map'](_0x368e14[_0x8202('0x50')],function(_0x18175d){var _0x20a430={};_0x20a430[_0x18175d]={'$like':'%'+_0x1887ea[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x20a430;})});}_0x368e14=_[_0x8202('0x59')]({},_0x368e14,_0x1887ea[_0x8202('0x5e')]);return _0x5cda1c[_0x8202('0xd9')](_0x368e14);}})['then'](function(_0x16a191){if(_0x16a191){_0x2e0e0e=_0x16a191['length'];if(!_0x1887ea[_0x8202('0x4f')][_0x8202('0x54')](_0x8202('0xcf'))){_0x368e14[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x1887ea[_0x8202('0x4f')][_0x8202('0x2c')]);_0x368e14[_0x8202('0x2b')]=qs[_0x8202('0x2b')](_0x1887ea['query'][_0x8202('0x2b')]);}return _0x5cda1c[_0x8202('0xd9')](_0x368e14);}})[_0x8202('0x33')](function(_0x1fe3d6){if(_0x1fe3d6){return _0x1fe3d6?{'count':_0x2e0e0e,'rows':_0x1fe3d6}:null;}})['then'](respondWithResult(_0xef24f5,null))['catch'](handleError(_0xef24f5,null));};exports[_0x8202('0xda')]=function(_0x2b4ae8,_0x4e53bc,_0x514175){var _0x2bedf5={};var _0x203ab8={};var _0x123f57;var _0x5578d3;return db['User'][_0x8202('0xa1')]({'where':{'id':_0x2b4ae8[_0x8202('0x64')]['id']}})['then'](handleEntityNotFound(_0x4e53bc,null))['then'](function(_0x478476){if(_0x478476){_0x123f57=_0x478476;_0x203ab8[_0x8202('0x51')]=_[_0x8202('0x4c')](db['OpenchannelInteraction'][_0x8202('0x46')]);_0x203ab8[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x2b4ae8[_0x8202('0x4f')]);_0x203ab8[_0x8202('0x4d')]=_['intersection'](_0x203ab8['model'],_0x203ab8[_0x8202('0x4f')]);_0x2bedf5[_0x8202('0x50')]=_[_0x8202('0x4e')](_0x203ab8[_0x8202('0x51')],qs['fields'](_0x2b4ae8[_0x8202('0x4f')]['fields']));_0x2bedf5['attributes']=_0x2bedf5[_0x8202('0x50')]['length']?_0x2bedf5[_0x8202('0x50')]:_0x203ab8['model'];_0x2bedf5['order']=qs[_0x8202('0x56')](_0x2b4ae8[_0x8202('0x4f')]['sort']);_0x2bedf5[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x2b4ae8['query'],_0x203ab8['filters']));if(_0x2b4ae8['query']['filter']){_0x2bedf5['where']=_['merge'](_0x2bedf5[_0x8202('0x57')],{'$or':_['map'](_0x2bedf5['attributes'],function(_0x8b6d83){var _0x10680b={};_0x10680b[_0x8b6d83]={'$like':'%'+_0x2b4ae8[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x10680b;})});}_0x2bedf5=_['merge']({},_0x2bedf5,_0x2b4ae8[_0x8202('0x5e')]);return _0x123f57[_0x8202('0xda')](_0x2bedf5);}})[_0x8202('0x33')](function(_0x378c01){if(_0x378c01){_0x5578d3=_0x378c01[_0x8202('0x53')];if(!_0x2b4ae8[_0x8202('0x4f')][_0x8202('0x54')](_0x8202('0xcf'))){_0x2bedf5[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x2b4ae8[_0x8202('0x4f')][_0x8202('0x2c')]);_0x2bedf5['offset']=qs[_0x8202('0x2b')](_0x2b4ae8[_0x8202('0x4f')][_0x8202('0x2b')]);}return _0x123f57[_0x8202('0xda')](_0x2bedf5);}})[_0x8202('0x33')](function(_0x567baa){if(_0x567baa){return _0x567baa?{'count':_0x5578d3,'rows':_0x567baa}:null;}})[_0x8202('0x33')](respondWithResult(_0x4e53bc,null))[_0x8202('0x26')](handleError(_0x4e53bc,null));};exports[_0x8202('0xdb')]=function(_0x38da48,_0xab470b,_0x51242e){var _0x163753={'raw':!![],'where':{}};var _0x4b4439={};var _0x38f780={'count':0x0,'rows':[]};return db[_0x8202('0x45')][_0x8202('0xa1')]({'where':{'id':_0x38da48['params']['id']}})['then'](handleEntityNotFound(_0xab470b,null))[_0x8202('0x33')](function(_0x18fdf1){if(_0x18fdf1){_0x4b4439['model']=_['keys'](db[_0x8202('0xdc')]['rawAttributes']);_0x4b4439[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x38da48[_0x8202('0x4f')]);_0x4b4439[_0x8202('0x4d')]=_[_0x8202('0x4e')](_0x4b4439[_0x8202('0x51')],_0x4b4439['query']);_0x163753[_0x8202('0x50')]=_[_0x8202('0x4e')](_0x4b4439['model'],qs[_0x8202('0x52')](_0x38da48[_0x8202('0x4f')][_0x8202('0x52')]));_0x163753[_0x8202('0x50')]=_0x163753['attributes'][_0x8202('0x53')]?_0x163753[_0x8202('0x50')]:_0x4b4439[_0x8202('0x51')];if(!_0x38da48[_0x8202('0x4f')]['hasOwnProperty'](_0x8202('0xcf'))){_0x163753[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x38da48[_0x8202('0x4f')][_0x8202('0x2c')]);_0x163753[_0x8202('0x2b')]=qs[_0x8202('0x2b')](_0x38da48[_0x8202('0x4f')][_0x8202('0x2b')]);}_0x163753[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x38da48[_0x8202('0x4f')][_0x8202('0x56')]);_0x163753[_0x8202('0x57')]=qs[_0x8202('0x4d')](_['pick'](_0x38da48[_0x8202('0x4f')],_0x4b4439[_0x8202('0x4d')]));_0x163753['where']['UserId']=_0x18fdf1['id'];if(_0x38da48[_0x8202('0x4f')][_0x8202('0x3b')]){_0x163753[_0x8202('0x57')]=_[_0x8202('0x59')](_0x163753['where'],{'$or':_[_0x8202('0x3d')](_0x163753[_0x8202('0x50')],function(_0x5777b2){var _0x3ff947={};_0x3ff947[_0x5777b2]={'$like':'%'+_0x38da48[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x3ff947;})});}_0x163753=_[_0x8202('0x59')]({},_0x163753,_0x38da48[_0x8202('0x5e')]);return db[_0x8202('0xdc')][_0x8202('0x2a')]({'where':_0x163753[_0x8202('0x57')]})[_0x8202('0x33')](function(_0x446cae){_0x38f780[_0x8202('0x2a')]=_0x446cae;if(_0x38da48['query'][_0x8202('0x5f')]){_0x163753['include']=[{'all':!![]}];}return db[_0x8202('0xdc')]['findAll'](_0x163753);})[_0x8202('0x33')](function(_0x1893e6){_0x38f780[_0x8202('0x62')]=_0x1893e6;return _0x38f780;});}})[_0x8202('0x33')](respondWithFilteredResult(_0xab470b,_0x163753))[_0x8202('0x26')](handleError(_0xab470b,null));};exports[_0x8202('0xdd')]=function(_0x209c42,_0x40f974,_0x387b22){var _0x13733d={};var _0x25656c={};var _0x5c509b;var _0x450c57;return db[_0x8202('0x45')]['findOne']({'where':{'id':_0x209c42['params']['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x40f974,null))[_0x8202('0x33')](function(_0x129a1b){if(_0x129a1b){_0x5c509b=_0x129a1b;_0x25656c['model']=_[_0x8202('0x4c')](db['SmsInteraction'][_0x8202('0x46')]);_0x25656c[_0x8202('0x4f')]=_['keys'](_0x209c42['query']);_0x25656c[_0x8202('0x4d')]=_[_0x8202('0x4e')](_0x25656c['model'],_0x25656c['query']);_0x13733d['attributes']=_[_0x8202('0x4e')](_0x25656c[_0x8202('0x51')],qs['fields'](_0x209c42['query'][_0x8202('0x52')]));_0x13733d['attributes']=_0x13733d[_0x8202('0x50')][_0x8202('0x53')]?_0x13733d[_0x8202('0x50')]:_0x25656c[_0x8202('0x51')];_0x13733d[_0x8202('0x55')]=qs['sort'](_0x209c42[_0x8202('0x4f')][_0x8202('0x56')]);_0x13733d[_0x8202('0x57')]=qs['filters'](_[_0x8202('0x58')](_0x209c42[_0x8202('0x4f')],_0x25656c[_0x8202('0x4d')]));if(_0x209c42[_0x8202('0x4f')][_0x8202('0x3b')]){_0x13733d[_0x8202('0x57')]=_['merge'](_0x13733d[_0x8202('0x57')],{'$or':_[_0x8202('0x3d')](_0x13733d[_0x8202('0x50')],function(_0x4cb950){var _0x3928c2={};_0x3928c2[_0x4cb950]={'$like':'%'+_0x209c42[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x3928c2;})});}_0x13733d=_[_0x8202('0x59')]({},_0x13733d,_0x209c42[_0x8202('0x5e')]);return _0x5c509b[_0x8202('0xdd')](_0x13733d);}})[_0x8202('0x33')](function(_0x33e072){if(_0x33e072){_0x450c57=_0x33e072[_0x8202('0x53')];if(!_0x209c42['query'][_0x8202('0x54')](_0x8202('0xcf'))){_0x13733d['limit']=qs[_0x8202('0x2c')](_0x209c42[_0x8202('0x4f')][_0x8202('0x2c')]);_0x13733d[_0x8202('0x2b')]=qs[_0x8202('0x2b')](_0x209c42[_0x8202('0x4f')][_0x8202('0x2b')]);}return _0x5c509b[_0x8202('0xdd')](_0x13733d);}})[_0x8202('0x33')](function(_0xaa000a){if(_0xaa000a){return _0xaa000a?{'count':_0x450c57,'rows':_0xaa000a}:null;}})[_0x8202('0x33')](respondWithResult(_0x40f974,null))[_0x8202('0x26')](handleError(_0x40f974,null));};exports[_0x8202('0xde')]=function(_0x174eca,_0xea2fb9,_0x16aeb8){var _0x4b03b7={};var _0x4856e6={};var _0x441a37;var _0x228cad;return db[_0x8202('0x45')]['findOne']({'where':{'id':_0x174eca[_0x8202('0x64')]['id']}})[_0x8202('0x33')](handleEntityNotFound(_0xea2fb9,null))[_0x8202('0x33')](function(_0x3c7313){if(_0x3c7313){_0x441a37=_0x3c7313;_0x4856e6[_0x8202('0x51')]=_[_0x8202('0x4c')](db['FaxInteraction']['rawAttributes']);_0x4856e6[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x174eca[_0x8202('0x4f')]);_0x4856e6[_0x8202('0x4d')]=_[_0x8202('0x4e')](_0x4856e6[_0x8202('0x51')],_0x4856e6[_0x8202('0x4f')]);_0x4b03b7['attributes']=_['intersection'](_0x4856e6[_0x8202('0x51')],qs[_0x8202('0x52')](_0x174eca['query'][_0x8202('0x52')]));_0x4b03b7[_0x8202('0x50')]=_0x4b03b7['attributes'][_0x8202('0x53')]?_0x4b03b7['attributes']:_0x4856e6['model'];_0x4b03b7[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x174eca['query'][_0x8202('0x56')]);_0x4b03b7[_0x8202('0x57')]=qs['filters'](_['pick'](_0x174eca[_0x8202('0x4f')],_0x4856e6[_0x8202('0x4d')]));if(_0x174eca['query'][_0x8202('0x3b')]){_0x4b03b7[_0x8202('0x57')]=_['merge'](_0x4b03b7[_0x8202('0x57')],{'$or':_[_0x8202('0x3d')](_0x4b03b7['attributes'],function(_0x292bdc){var _0x708022={};_0x708022[_0x292bdc]={'$like':'%'+_0x174eca[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x708022;})});}_0x4b03b7=_[_0x8202('0x59')]({},_0x4b03b7,_0x174eca['options']);return _0x441a37[_0x8202('0xde')](_0x4b03b7);}})[_0x8202('0x33')](function(_0x15616b){if(_0x15616b){_0x228cad=_0x15616b[_0x8202('0x53')];if(!_0x174eca['query']['hasOwnProperty'](_0x8202('0xcf'))){_0x4b03b7['limit']=qs['limit'](_0x174eca['query']['limit']);_0x4b03b7[_0x8202('0x2b')]=qs['offset'](_0x174eca[_0x8202('0x4f')]['offset']);}return _0x441a37[_0x8202('0xde')](_0x4b03b7);}})['then'](function(_0x48d1d0){if(_0x48d1d0){return _0x48d1d0?{'count':_0x228cad,'rows':_0x48d1d0}:null;}})[_0x8202('0x33')](respondWithResult(_0xea2fb9,null))[_0x8202('0x26')](handleError(_0xea2fb9,null));};exports[_0x8202('0xdf')]=function(_0x2f07cc,_0x5968c0,_0x36569e){var _0x4a4bd5={};var _0x231c3f={};var _0x4ca8c7;var _0x1ca02e;return db['User'][_0x8202('0xa1')]({'where':{'id':_0x2f07cc[_0x8202('0x64')]['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x5968c0,null))[_0x8202('0x33')](function(_0x4158be){if(_0x4158be){_0x4ca8c7=_0x4158be;_0x231c3f[_0x8202('0x51')]=_['keys'](db['WhatsappInteraction']['rawAttributes']);_0x231c3f[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x2f07cc[_0x8202('0x4f')]);_0x231c3f[_0x8202('0x4d')]=_['intersection'](_0x231c3f['model'],_0x231c3f['query']);_0x4a4bd5['attributes']=_[_0x8202('0x4e')](_0x231c3f[_0x8202('0x51')],qs[_0x8202('0x52')](_0x2f07cc[_0x8202('0x4f')][_0x8202('0x52')]));_0x4a4bd5[_0x8202('0x50')]=_0x4a4bd5[_0x8202('0x50')][_0x8202('0x53')]?_0x4a4bd5['attributes']:_0x231c3f['model'];_0x4a4bd5[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x2f07cc[_0x8202('0x4f')][_0x8202('0x56')]);_0x4a4bd5[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x2f07cc['query'],_0x231c3f['filters']));if(_0x2f07cc[_0x8202('0x4f')]['filter']){_0x4a4bd5[_0x8202('0x57')]=_[_0x8202('0x59')](_0x4a4bd5[_0x8202('0x57')],{'$or':_[_0x8202('0x3d')](_0x4a4bd5['attributes'],function(_0x34033f){var _0x1c5c37={};_0x1c5c37[_0x34033f]={'$like':'%'+_0x2f07cc[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x1c5c37;})});}_0x4a4bd5=_[_0x8202('0x59')]({},_0x4a4bd5,_0x2f07cc[_0x8202('0x5e')]);return _0x4ca8c7['getWhatsappInteractions'](_0x4a4bd5);}})[_0x8202('0x33')](function(_0x7e7a38){if(_0x7e7a38){_0x1ca02e=_0x7e7a38['length'];if(!_0x2f07cc['query'][_0x8202('0x54')]('nolimit')){_0x4a4bd5[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x2f07cc[_0x8202('0x4f')][_0x8202('0x2c')]);_0x4a4bd5[_0x8202('0x2b')]=qs[_0x8202('0x2b')](_0x2f07cc[_0x8202('0x4f')][_0x8202('0x2b')]);}return _0x4ca8c7['getWhatsappInteractions'](_0x4a4bd5);}})[_0x8202('0x33')](function(_0x123d06){if(_0x123d06){return _0x123d06?{'count':_0x1ca02e,'rows':_0x123d06}:null;}})[_0x8202('0x33')](respondWithResult(_0x5968c0,null))['catch'](handleError(_0x5968c0,null));};exports['login']=function(_0x261bf8,_0x24d665,_0x2cf833){var _0x1196ca;var _0x53c914;var _0x26e810;var _0xec9f9c=!_['isNil'](_0x261bf8[_0x8202('0x64')]['id'])?_0x261bf8[_0x8202('0x64')]['id']:!_[_0x8202('0x6d')](_0x261bf8['user']['id'])?_0x261bf8[_0x8202('0x38')]['id']:null;return db[_0x8202('0x45')][_0x8202('0x3f')]({'where':{'id':_0xec9f9c,'role':{'$or':[_0x8202('0x36'),_0x8202('0x38'),_0x8202('0x78')]}},'attributes':['id',_0x8202('0x43'),_0x8202('0xe0'),'mobile',_0x8202('0x3e'),_0x8202('0x6a'),_0x8202('0xe1')]})[_0x8202('0x33')](function(_0x4ca971){if(_0x4ca971){if(_0x4ca971['role']==='agent'){_0x1196ca=_0x4ca971;if(_0x261bf8[_0x8202('0x66')]['interface']){_0x26e810=util[_0x8202('0xb5')]('LOCAL/%s@from-sip/n',_0x1196ca[_0x261bf8[_0x8202('0x66')][_0x8202('0xb4')]]);}else if(_0x261bf8[_0x8202('0x66')]['intrf']){_0x26e810=util[_0x8202('0xb5')]('SIP/%s',_0x261bf8[_0x8202('0x66')]['intrf']);}else{_0x26e810=util[_0x8202('0xb5')]('SIP/%s',_0x1196ca['name']);}socket['to'](util['format']('user:%s',_0x1196ca[_0x8202('0x43')]))[_0x8202('0xb1')](_0x8202('0xe2'),{'ip':_0x261bf8[_0x8202('0xe3')]['x-forwarded-for']||_0x261bf8[_0x8202('0xe4')][_0x8202('0xe5')]||_0x261bf8[_0x8202('0xe6')][_0x8202('0xe5')]||_0x261bf8[_0x8202('0xe4')][_0x8202('0xe6')]['remoteAddress']});return db[_0x8202('0xb8')][_0x8202('0x34')]({'where':{'membername':_0x1196ca[_0x8202('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x8202('0x9c'))][(_0x8202('0x99'))](_0x8202('0xe7'));}})[_0x8202('0x33')](function(){if(_0x1196ca){return _0x1196ca[_0x8202('0xe8')]({'raw':!![]});}})[_0x8202('0x33')](function(_0x49b589){if(_0x1196ca){var _0x120e91=[];if(_0x49b589){_0x53c914=_0x49b589;if(_0x53c914[_0x8202('0x53')]){for(var _0x4cffe2=0x0;_0x4cffe2<_0x53c914[_0x8202('0x53')];_0x4cffe2++){_0x120e91[_0x8202('0x90')]({'membername':_0x1196ca[_0x8202('0x43')],'UserId':_0x1196ca['id'],'queue_name':_0x53c914[_0x4cffe2][_0x8202('0x43')],'VoiceQueueId':_0x53c914[_0x4cffe2]['id'],'interface':_0x26e810,'paused':_0x1196ca[_0x8202('0xe1')]||![],'penalty':_0x53c914[_0x4cffe2]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0x8202('0xb7')](_0x120e91,function(_0x49cbaf){return db[_0x8202('0xb8')][_0x8202('0xe9')](_0x49cbaf);});}}}})['then'](function(){if(_0x1196ca){return db[_0x8202('0xea')][_0x8202('0x61')]({'where':{'membername':_0x1196ca['name'],'exitAt':null}});}})[_0x8202('0x33')](function(_0x1ebbab){if(_0x1196ca){var _0x23b081=[];_0x1ebbab['forEach'](function(_0x155785){_0x23b081[_0x8202('0x90')](_0x155785[_0x8202('0x32')]({'exitAt':moment()['format'](_0x8202('0xeb'))}));});return BPromise['all'](_0x23b081);}})[_0x8202('0x33')](function(){if(_0x1196ca){var _0x13790f=[];var _0x58fa97=[];var _0x143c51=utils[_0x8202('0xec')]();var _0x5aeb0a={'membername':_0x1196ca[_0x8202('0x43')],'interface':_0x26e810,'enterAt':moment()[_0x8202('0xb5')](_0x8202('0xeb')),'role':_0x1196ca[_0x8202('0x3e')],'internal':_0x1196ca[_0x8202('0x6a')]};_0x143c51[_0x8202('0xed')](function(_0x578324){_0x13790f[_0x8202('0x90')](_[_0x8202('0x59')]({'channel':_0x578324,'type':_0x8202('0xee'),'data1':_0x261bf8[_0x8202('0x66')][_0x8202('0xef')],'data2':_0x26e810},_0x5aeb0a));if(_0x1196ca[_0x8202('0xe1')]){_0x58fa97[_0x8202('0x90')](_['merge']({'channel':_0x578324,'type':'PAUSE','data1':_0x8202('0xf0')},_0x5aeb0a));}});return db[_0x8202('0xea')][_0x8202('0x8d')](_0x13790f[_0x8202('0xf1')](_0x58fa97),{'individualHooks':!![]});}})[_0x8202('0x33')](function(){if(_0x1196ca){return _0x1196ca['update']({'online':!![],'lastLoginAt':moment()[_0x8202('0xb5')](_0x8202('0xeb')),'voicePause':_0x1196ca[_0x8202('0xe1')]||![],'mailPause':_0x1196ca[_0x8202('0xe1')]||![],'chatPause':_0x1196ca['loginInPause']||![],'faxPause':_0x1196ca['loginInPause']||![],'smsPause':_0x1196ca['loginInPause']||![],'openchannelPause':_0x1196ca['loginInPause']||![],'whatsappPause':_0x1196ca[_0x8202('0xe1')]||![],'pauseType':_0x1196ca['loginInPause']?_0x8202('0xf0'):null,'interface':_0x26e810,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x8202('0x33')](function(_0x59d65f){if(_0x261bf8[_0x8202('0xf2')]){return _0x2cf833();}else{return BPromise[_0x8202('0xf3')](_0x59d65f)[_0x8202('0x33')](respondWithResult(_0x24d665,null));}})[_0x8202('0x26')](handleError(_0x24d665,null));};exports[_0x8202('0xf4')]=function(_0x28e6e6,_0x4128ec,_0x8f8662){var _0x1ac27c;return db[_0x8202('0x45')][_0x8202('0x3f')]({'where':{'id':_0x28e6e6[_0x8202('0x64')]['id'],'role':'agent'},'attributes':['id','name',_0x8202('0x3e')]})['then'](handleEntityNotFound(_0x4128ec,null))['then'](function(_0x12b15c){if(_0x12b15c){_0x1ac27c=_0x12b15c;return db[_0x8202('0xb8')][_0x8202('0x34')]({'where':{'membername':_0x1ac27c['name']},'individualHooks':!![]});}})[_0x8202('0x33')](function(){return db[_0x8202('0xea')][_0x8202('0x61')]({'where':{'membername':_0x1ac27c[_0x8202('0x43')],'exitAt':null}});})['then'](function(_0x52e819){var _0xfc0fdb=[];_0x52e819[_0x8202('0xed')](function(_0x284c42){_0xfc0fdb[_0x8202('0x90')](_0x284c42[_0x8202('0x32')]({'exitAt':moment()[_0x8202('0xb5')](_0x8202('0xeb'))}));});return BPromise[_0x8202('0x91')](_0xfc0fdb);})[_0x8202('0x33')](function(){return _0x1ac27c[_0x8202('0x32')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8202('0x33')](respondWithResult(_0x4128ec,null))['catch'](handleError(_0x4128ec,null));};exports['pause']=function(_0x9a27a5,_0x4e215f,_0x2bdb62){var _0x1427ee;return db['UserVoiceQueueRt'][_0x8202('0x32')]({'paused':0x1},{'where':{'UserId':_0x9a27a5[_0x8202('0x64')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x8202('0x45')][_0x8202('0x3f')]({'where':{'id':_0x9a27a5['params']['id'],'role':_0x8202('0x78')},'attributes':['id','name',_0x8202('0x3e'),_0x8202('0x6a'),_0x8202('0xb4')]});})[_0x8202('0x33')](handleEntityNotFound(_0x4e215f,null))[_0x8202('0x33')](function(_0x314309){if(_0x314309){_0x1427ee=_0x314309;return respondWithRpcPromise(_0x8202('0xf5'),_0x8202('0xf6'),{'id':_0x1427ee['id'],'name':_0x1427ee[_0x8202('0x43')],'pause':!![]});}})[_0x8202('0x33')](function(){if(_0x1427ee){return db['MemberReport']['findAll']({'where':{'membername':_0x1427ee[_0x8202('0x43')],'type':_0x8202('0xf7'),'exitAt':null}});}})[_0x8202('0x33')](function(_0x3a4a4c){if(_0x3a4a4c[_0x8202('0x53')]){var _0x23d886=moment()[_0x8202('0xb5')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1af454=0x0,_0x19c33f=_0x3a4a4c['length'];_0x1af454<_0x19c33f;_0x1af454++){_0x3a4a4c[_0x1af454][_0x8202('0xf8')]({'exitAt':_0x23d886});}}})[_0x8202('0x33')](function(){var _0x5a048a=[];var _0x2f6bde=utils[_0x8202('0xec')]();_0x2f6bde[_0x8202('0xed')](function(_0x3cdbb1){_0x5a048a[_0x8202('0x90')]({'channel':_0x3cdbb1,'membername':_0x1427ee[_0x8202('0x43')],'interface':_[_0x8202('0x6d')](_0x1427ee[_0x8202('0xb4')])?util['format'](_0x8202('0xb6'),_0x1427ee[_0x8202('0x43')]):_0x1427ee[_0x8202('0xb4')],'type':_0x8202('0xf7'),'enterAt':moment()[_0x8202('0xb5')](_0x8202('0xeb')),'data1':_0x9a27a5[_0x8202('0x66')][_0x8202('0x48')]||_0x8202('0xf9'),'role':_0x1427ee[_0x8202('0x3e')],'internal':_0x1427ee['internal']});});return db[_0x8202('0xea')][_0x8202('0x8d')](_0x5a048a,{'individualHooks':!![]});})['then'](function(){return _0x1427ee[_0x8202('0x32')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x9a27a5[_0x8202('0x66')][_0x8202('0x48')]||_0x8202('0xf9'),'lastPauseAt':moment()[_0x8202('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x8202('0x33')](respondWithResult(_0x4e215f,null))[_0x8202('0x26')](handleError(_0x4e215f,null));};exports['unpause']=function(_0x1dc8d7,_0x4bf2a3,_0x5de905){var _0x5d8c98;return db[_0x8202('0x45')]['find']({'where':{'id':_0x1dc8d7[_0x8202('0x64')]['id']},'attributes':['id',_0x8202('0x43'),_0x8202('0x3e'),_0x8202('0xaa'),_0x8202('0xfa'),'chatPause','faxPause',_0x8202('0xfb'),'smsPause','whatsapppause',_0x8202('0xfc'),_0x8202('0xfd')]})[_0x8202('0x33')](handleEntityNotFound(_0x4bf2a3,null))['then'](function(_0x1ffeb0){if(_0x1ffeb0){_0x5d8c98=_0x1ffeb0;if(_0x1dc8d7[_0x8202('0x66')][_0x8202('0xa8')]&&!utils[_0x8202('0xab')](_0x1dc8d7[_0x8202('0x66')]['channel'])){throw new db[(_0x8202('0x9c'))]['ValidationError']('Unknown\x20channel');}switch(_0x1dc8d7['body'][_0x8202('0xa8')]){case _0x8202('0xb2'):return respondWithRpcPromise('QueuePause',_0x8202('0xfe'),{'id':_0x5d8c98['id'],'name':_0x5d8c98[_0x8202('0x43')],'pause':![]})[_0x8202('0x33')](function(){return db[_0x8202('0xb8')][_0x8202('0x32')]({'paused':0x0},{'where':{'UserId':_0x5d8c98['id']},'individualHooks':!![]});})[_0x8202('0x33')](function(){return db[_0x8202('0xea')][_0x8202('0x3f')]({'where':{'channel':_0x1dc8d7[_0x8202('0x66')][_0x8202('0xa8')],'membername':_0x5d8c98['name'],'type':_0x8202('0xf7'),'exitAt':null}});})['then'](function(_0x541adc){if(_0x541adc){return _0x541adc['update']({'exitAt':moment()[_0x8202('0xb5')](_0x8202('0xeb')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x8202('0x33')](function(){return _0x5d8c98[_0x8202('0x32')]({'voicePause':![]});});case _0x8202('0xff'):case'chat':case _0x8202('0x100'):case _0x8202('0x101'):case _0x8202('0x102'):case _0x8202('0x103'):return db[_0x8202('0xea')][_0x8202('0x3f')]({'where':{'channel':_0x1dc8d7[_0x8202('0x66')]['channel'],'membername':_0x5d8c98[_0x8202('0x43')],'type':_0x8202('0xf7'),'exitAt':null}})[_0x8202('0x33')](function(_0x13c804){if(_0x13c804){return _0x13c804[_0x8202('0x32')]({'exitAt':moment()[_0x8202('0xb5')](_0x8202('0xeb')),'data2':'manual'},{'individualHooks':!![]});}return null;})['then'](function(){var _0x217364={};_[_0x8202('0x2d')](_0x217364,util[_0x8202('0xb5')](_0x8202('0x104'),_0x1dc8d7[_0x8202('0x66')]['channel'],_0x8202('0x105')),![]);return _0x5d8c98[_0x8202('0x32')](_0x217364);});default:return respondWithRpcPromise(_0x8202('0xf5'),'unpause',{'id':_0x5d8c98['id'],'name':_0x5d8c98[_0x8202('0x43')],'pause':![]})[_0x8202('0x33')](function(){return db[_0x8202('0xb8')][_0x8202('0x32')]({'paused':0x0},{'where':{'UserId':_0x5d8c98['id']}});})[_0x8202('0x33')](function(){return db[_0x8202('0xea')][_0x8202('0x61')]({'where':{'membername':_0x5d8c98['name'],'type':_0x8202('0xf7'),'exitAt':null}});})[_0x8202('0x33')](function(_0x5a0b6b){var _0x21ac46=[];_0x5a0b6b[_0x8202('0xed')](function(_0x21f254){_0x21ac46[_0x8202('0x90')](_0x21f254[_0x8202('0x32')]({'exitAt':moment()['format'](_0x8202('0xeb')),'data2':_0x8202('0x106')}));});return BPromise[_0x8202('0x91')](_0x21ac46);})[_0x8202('0x33')](function(){return _0x5d8c98[_0x8202('0x32')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x8202('0x33')](respondWithResult(_0x4bf2a3,null))[_0x8202('0x26')](handleError(_0x4bf2a3,null));};exports[_0x8202('0x107')]=function(_0x5e06b4,_0x123ad6,_0x30a74a){var _0xb2f147={};var _0x2a1631={};var _0x4884ff;var _0x4c50f9;return db['User'][_0x8202('0xa1')]({'where':{'id':_0x5e06b4['params']['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x123ad6,null))['then'](function(_0x438c11){if(_0x438c11){_0x4884ff=_0x438c11;_0x2a1631[_0x8202('0x51')]=_[_0x8202('0x4c')](db['Team'][_0x8202('0x46')]);_0x2a1631[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x5e06b4[_0x8202('0x4f')]);_0x2a1631['filters']=_[_0x8202('0x4e')](_0x2a1631[_0x8202('0x51')],_0x2a1631[_0x8202('0x4f')]);_0xb2f147[_0x8202('0x50')]=_['intersection'](_0x2a1631[_0x8202('0x51')],qs['fields'](_0x5e06b4[_0x8202('0x4f')][_0x8202('0x52')]));_0xb2f147[_0x8202('0x50')]=_0xb2f147[_0x8202('0x50')][_0x8202('0x53')]?_0xb2f147[_0x8202('0x50')]:_0x2a1631[_0x8202('0x51')];_0xb2f147['order']=qs[_0x8202('0x56')](_0x5e06b4[_0x8202('0x4f')][_0x8202('0x56')]);_0xb2f147[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x5e06b4[_0x8202('0x4f')],_0x2a1631[_0x8202('0x4d')]));if(_0x5e06b4['query'][_0x8202('0x3b')]){_0xb2f147[_0x8202('0x57')]=_[_0x8202('0x59')](_0xb2f147[_0x8202('0x57')],{'$or':_[_0x8202('0x3d')](_0xb2f147[_0x8202('0x50')],function(_0x22eec8){var _0x41687c={};_0x41687c[_0x22eec8]={'$like':'%'+_0x5e06b4[_0x8202('0x4f')]['filter']+'%'};return _0x41687c;})});}_0xb2f147=_[_0x8202('0x59')]({},_0xb2f147,_0x5e06b4[_0x8202('0x5e')]);return _0x4884ff[_0x8202('0x107')](_0xb2f147);}})[_0x8202('0x33')](function(_0x4d80c5){if(_0x4d80c5){_0x4c50f9=_0x4d80c5[_0x8202('0x53')];if(!_0x5e06b4[_0x8202('0x4f')][_0x8202('0x54')](_0x8202('0xcf'))){_0xb2f147[_0x8202('0x2c')]=qs['limit'](_0x5e06b4[_0x8202('0x4f')]['limit']);_0xb2f147['offset']=qs['offset'](_0x5e06b4[_0x8202('0x4f')][_0x8202('0x2b')]);}return _0x4884ff[_0x8202('0x107')](_0xb2f147);}})[_0x8202('0x33')](function(_0x25ea67){if(_0x25ea67){return _0x25ea67?{'count':_0x4c50f9,'rows':_0x25ea67}:null;}})[_0x8202('0x33')](respondWithResult(_0x123ad6,null))[_0x8202('0x26')](handleError(_0x123ad6,null));};exports[_0x8202('0x108')]=function(_0x3b8273,_0x185daf){return db['User']['find']({'where':{'id':_0x3b8273[_0x8202('0x64')]['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x185daf,null))['then'](function(_0x2349c2){if(_0x2349c2){var _0x56bf72=_0x2349c2[_0x8202('0x35')]({'plain':!![]});return _0x2349c2['addTeams'](_0x3b8273[_0x8202('0x66')][_0x8202('0x69')],_[_0x8202('0x109')](_0x3b8273[_0x8202('0x66')],[_0x8202('0x69'),'id'])||{})['then'](function(){for(var _0x3e7d68=0x0;_0x3e7d68<_0x3b8273[_0x8202('0x66')][_0x8202('0x69')][_0x8202('0x53')];_0x3e7d68++){var _0x2f6572=[];db['Team']['findOne']({'where':{'id':_0x3b8273[_0x8202('0x66')][_0x8202('0x69')][_0x3e7d68]}})[_0x8202('0x33')](function(_0x391870){_0x2f6572['push'](_0x391870[_0x8202('0xe8')]()[_0x8202('0x33')](function(_0x57a1af){for(var _0x59ab24=0x0;_0x59ab24<_0x57a1af[_0x8202('0x53')];_0x59ab24++){_0x57a1af[_0x59ab24]['setDataValue'](_0x8202('0xa8'),'Voice');}return _0x57a1af;}));_0x2f6572[_0x8202('0x90')](_0x391870[_0x8202('0x10a')]()[_0x8202('0x33')](function(_0x1d0c98){for(var _0x124398=0x0;_0x124398<_0x1d0c98[_0x8202('0x53')];_0x124398++){_0x1d0c98[_0x124398]['setDataValue'](_0x8202('0xa8'),_0x8202('0x10b'));}return _0x1d0c98;}));_0x2f6572[_0x8202('0x90')](_0x391870[_0x8202('0x10c')]()[_0x8202('0x33')](function(_0x4417f3){for(var _0x3b03b7=0x0;_0x3b03b7<_0x4417f3['length'];_0x3b03b7++){_0x4417f3[_0x3b03b7]['setDataValue'](_0x8202('0xa8'),_0x8202('0x10d'));}return _0x4417f3;}));_0x2f6572['push'](_0x391870[_0x8202('0x10e')]()[_0x8202('0x33')](function(_0x5c09b3){for(var _0x48bb01=0x0;_0x48bb01<_0x5c09b3[_0x8202('0x53')];_0x48bb01++){_0x5c09b3[_0x48bb01][_0x8202('0x10f')](_0x8202('0xa8'),_0x8202('0x110'));}return _0x5c09b3;}));_0x2f6572[_0x8202('0x90')](_0x391870[_0x8202('0x111')]()[_0x8202('0x33')](function(_0x2a328b){for(var _0x1fe4d3=0x0;_0x1fe4d3<_0x2a328b['length'];_0x1fe4d3++){_0x2a328b[_0x1fe4d3]['setDataValue']('channel',_0x8202('0x112'));}return _0x2a328b;}));_0x2f6572[_0x8202('0x90')](_0x391870[_0x8202('0x113')]()[_0x8202('0x33')](function(_0x24de13){for(var _0x4caecc=0x0;_0x4caecc<_0x24de13[_0x8202('0x53')];_0x4caecc++){_0x24de13[_0x4caecc]['setDataValue'](_0x8202('0xa8'),'Fax');}return _0x24de13;}));_0x2f6572[_0x8202('0x90')](_0x391870[_0x8202('0x114')]()[_0x8202('0x33')](function(_0x3d049d){for(var _0x2afb74=0x0;_0x2afb74<_0x3d049d[_0x8202('0x53')];_0x2afb74++){_0x3d049d[_0x2afb74][_0x8202('0x10f')](_0x8202('0xa8'),_0x8202('0x115'));}return _0x3d049d;}));return BPromise[_0x8202('0x91')](_0x2f6572);})[_0x8202('0x33')](function(_0x5cd9ee){var _0x19580e=_[_0x8202('0x116')](_0x5cd9ee);_0x2f6572=[];return db[_0x8202('0x5b')]['transaction'](function(_0x8884b4){for(var _0x43beaf=0x0;_0x43beaf<_0x19580e[_0x8202('0x53')];_0x43beaf++){_0x2f6572['push'](_0x19580e[_0x43beaf][_0x8202('0x117')](_0x56bf72['id']),{'transaction':_0x8884b4});}return BPromise[_0x8202('0x91')](_0x2f6572)[_0x8202('0x33')](function(){if(_0x56bf72[_0x8202('0xa9')]){return BPromise[_0x8202('0xb7')](_['filter'](_0x19580e,function(_0x393a57){return _0x393a57[_0x8202('0x118')](_0x8202('0xa8'))==='Voice';}),function(_0x45aa8c){return db[_0x8202('0xb8')][_0x8202('0xe9')]({'membername':_0x56bf72[_0x8202('0x43')],'UserId':_0x56bf72['id'],'queue_name':_0x45aa8c['name'],'VoiceQueueId':_0x45aa8c['id'],'interface':_[_0x8202('0x6d')](_0x56bf72['interface'])?util[_0x8202('0xb5')](_0x8202('0xb6'),_0x56bf72['name']):_0x56bf72[_0x8202('0xb4')],'paused':_0x56bf72[_0x8202('0xaa')]||![],'penalty':_0x56bf72[_0x8202('0xae')]},{'transaction':_0x8884b4});});}else{return;}})['then'](function(){for(var _0x2a7613=0x0;_0x2a7613<_0x19580e[_0x8202('0x53')];_0x2a7613++){var _0x5a931a=_0x19580e[_0x2a7613][_0x8202('0x118')](_0x8202('0xa8'));var _0x568777=_0x5a931a+_0x8202('0x119');socket[_0x8202('0xb1')]('user'+_0x5a931a+_0x8202('0x11a'),{'UserId':_0x56bf72['id'],['queueField']:_0x19580e[_0x2a7613]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x185daf,null))[_0x8202('0x26')](handleError(_0x185daf,null));};exports['removeTeams']=function(_0x3ca5c2,_0xc2f95f){return db['User'][_0x8202('0xa1')]({'where':{'id':_0x3ca5c2[_0x8202('0x64')]['id']}})['then'](handleEntityNotFound(_0xc2f95f,null))[_0x8202('0x33')](function(_0x2f8580){if(_0x2f8580){var _0x1fe003=_0x2f8580['get']({'plain':!![]});var _0x1a08ed=_0x3ca5c2[_0x8202('0x4f')]['ids'];return _0x2f8580[_0x8202('0x11b')](_0x1a08ed)[_0x8202('0x33')](function(){for(var _0x445877=0x0;_0x445877<_0x1a08ed[_0x8202('0x53')];_0x445877++){var _0x30c562=[];db['Team'][_0x8202('0xa1')]({'where':{'id':_0x1a08ed[_0x445877]}})[_0x8202('0x33')](function(_0x3ce5f9){_0x30c562['push'](_0x3ce5f9[_0x8202('0xe8')]()[_0x8202('0x33')](function(_0x17d1d4){for(var _0x1fc866=0x0;_0x1fc866<_0x17d1d4['length'];_0x1fc866++){_0x17d1d4[_0x1fc866][_0x8202('0x10f')](_0x8202('0xa8'),_0x8202('0x11c'));}return _0x17d1d4;}));_0x30c562[_0x8202('0x90')](_0x3ce5f9['getChatQueues']()['then'](function(_0x563ac0){for(var _0x30c10e=0x0;_0x30c10e<_0x563ac0[_0x8202('0x53')];_0x30c10e++){_0x563ac0[_0x30c10e][_0x8202('0x10f')](_0x8202('0xa8'),_0x8202('0x10b'));}return _0x563ac0;}));_0x30c562[_0x8202('0x90')](_0x3ce5f9['getMailQueues']()[_0x8202('0x33')](function(_0x197b97){for(var _0x39bc1a=0x0;_0x39bc1a<_0x197b97[_0x8202('0x53')];_0x39bc1a++){_0x197b97[_0x39bc1a]['setDataValue']('channel',_0x8202('0x10d'));}return _0x197b97;}));_0x30c562[_0x8202('0x90')](_0x3ce5f9[_0x8202('0x10e')]()['then'](function(_0x2139a7){for(var _0x52216f=0x0;_0x52216f<_0x2139a7['length'];_0x52216f++){_0x2139a7[_0x52216f][_0x8202('0x10f')](_0x8202('0xa8'),'Sms');}return _0x2139a7;}));_0x30c562[_0x8202('0x90')](_0x3ce5f9['getWhatsappQueues']()['then'](function(_0x7c9e6d){for(var _0x7f0b5c=0x0;_0x7f0b5c<_0x7c9e6d['length'];_0x7f0b5c++){_0x7c9e6d[_0x7f0b5c][_0x8202('0x10f')](_0x8202('0xa8'),'Whatsapp');}return _0x7c9e6d;}));_0x30c562['push'](_0x3ce5f9['getFaxQueues']()[_0x8202('0x33')](function(_0x520a2d){for(var _0xe3708d=0x0;_0xe3708d<_0x520a2d[_0x8202('0x53')];_0xe3708d++){_0x520a2d[_0xe3708d][_0x8202('0x10f')](_0x8202('0xa8'),_0x8202('0x11d'));}return _0x520a2d;}));_0x30c562[_0x8202('0x90')](_0x3ce5f9[_0x8202('0x114')]()['then'](function(_0x404a06){for(var _0x3b7f87=0x0;_0x3b7f87<_0x404a06[_0x8202('0x53')];_0x3b7f87++){_0x404a06[_0x3b7f87][_0x8202('0x10f')](_0x8202('0xa8'),'Openchannel');}return _0x404a06;}));return BPromise[_0x8202('0x91')](_0x30c562);})[_0x8202('0x33')](function(_0x37f821){var _0x3e45cc=_[_0x8202('0x116')](_0x37f821);_0x30c562=[];return db['sequelize'][_0x8202('0x11e')](function(_0x2df542){for(var _0x253132=0x0;_0x253132<_0x3e45cc[_0x8202('0x53')];_0x253132++){_0x30c562[_0x8202('0x90')](_0x3e45cc[_0x253132][_0x8202('0x11f')](_0x1fe003['id']),{'transaction':_0x2df542});}return BPromise[_0x8202('0x91')](_0x30c562)['then'](function(){if(_0x1fe003[_0x8202('0xa9')]){return BPromise['each'](_[_0x8202('0x3b')](_0x3e45cc,function(_0x4489d9){return _0x4489d9[_0x8202('0x118')](_0x8202('0xa8'))===_0x8202('0x11c');}),function(_0x55488b){return db[_0x8202('0xb8')][_0x8202('0x34')]({'where':{'VoiceQueueId':_0x55488b['id'],'UserId':_0x1fe003['id']},'transaction':_0x2df542});});}else{return;}})[_0x8202('0x33')](function(){for(var _0x55f6bf=0x0;_0x55f6bf<_0x3e45cc[_0x8202('0x53')];_0x55f6bf++){var _0x49ea74=_0x3e45cc[_0x55f6bf][_0x8202('0x118')](_0x8202('0xa8'));var _0x342d4c=_0x49ea74+_0x8202('0x119');socket[_0x8202('0xb1')](_0x8202('0x38')+_0x49ea74+'Queue:remove',{'UserId':_0x1fe003['id'],['queueField']:_0x3e45cc[_0x55f6bf]['id']});}});});});}});}})[_0x8202('0x33')](respondWithStatusCode(_0xc2f95f,null))[_0x8202('0x26')](handleError(_0xc2f95f,null));};exports[_0x8202('0x120')]=function(_0x12f2bc,_0x4cb7bf,_0x44b373){var _0x6cfb12={};var _0x342975={};var _0x38cf43;var _0x2a57ea;return db[_0x8202('0x45')]['findOne']({'where':{'id':_0x12f2bc['params']['id']}})[_0x8202('0x33')](handleEntityNotFound(_0x4cb7bf,null))[_0x8202('0x33')](function(_0x306031){if(_0x306031){_0x38cf43=_0x306031;_0x342975[_0x8202('0x51')]=_[_0x8202('0x4c')](db[_0x8202('0x121')][_0x8202('0x46')]);_0x342975[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x12f2bc[_0x8202('0x4f')]);_0x342975[_0x8202('0x4d')]=_[_0x8202('0x4e')](_0x342975[_0x8202('0x51')],_0x342975['query']);_0x6cfb12[_0x8202('0x50')]=_['intersection'](_0x342975[_0x8202('0x51')],qs[_0x8202('0x52')](_0x12f2bc[_0x8202('0x4f')][_0x8202('0x52')]));_0x6cfb12[_0x8202('0x50')]=_0x6cfb12[_0x8202('0x50')][_0x8202('0x53')]?_0x6cfb12[_0x8202('0x50')]:_0x342975[_0x8202('0x51')];_0x6cfb12[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x12f2bc[_0x8202('0x4f')][_0x8202('0x56')]);_0x6cfb12[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x12f2bc['query'],_0x342975['filters']));if(_0x12f2bc[_0x8202('0x4f')][_0x8202('0x3b')]){_0x6cfb12[_0x8202('0x57')]=_[_0x8202('0x59')](_0x6cfb12[_0x8202('0x57')],{'$or':_[_0x8202('0x3d')](_0x6cfb12[_0x8202('0x50')],function(_0x4196c8){var _0x52e594={};_0x52e594[_0x4196c8]={'$like':'%'+_0x12f2bc[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x52e594;})});}_0x6cfb12=_[_0x8202('0x59')]({},_0x6cfb12,_0x12f2bc[_0x8202('0x5e')]);return _0x38cf43['getLists'](_0x6cfb12);}})[_0x8202('0x33')](function(_0x107e60){if(_0x107e60){_0x2a57ea=_0x107e60[_0x8202('0x53')];if(!_0x12f2bc[_0x8202('0x4f')]['hasOwnProperty'](_0x8202('0xcf'))){_0x6cfb12[_0x8202('0x2c')]=qs[_0x8202('0x2c')](_0x12f2bc[_0x8202('0x4f')]['limit']);_0x6cfb12[_0x8202('0x2b')]=qs[_0x8202('0x2b')](_0x12f2bc[_0x8202('0x4f')][_0x8202('0x2b')]);}return _0x38cf43[_0x8202('0x120')](_0x6cfb12);}})[_0x8202('0x33')](function(_0x271c84){if(_0x271c84){return _0x271c84?{'count':_0x2a57ea,'rows':_0x271c84}:null;}})[_0x8202('0x33')](respondWithResult(_0x4cb7bf,null))[_0x8202('0x26')](handleError(_0x4cb7bf,null));};exports['getAgents']=function(_0x7b48d3,_0x9bc1bd,_0x544008){var _0x193fc3={};var _0x3013b={};var _0xd98631;var _0x82dc2;return db[_0x8202('0x45')][_0x8202('0xa1')]({'where':{'id':_0x7b48d3['params']['id']}})['then'](handleEntityNotFound(_0x9bc1bd,null))[_0x8202('0x33')](function(_0x14bcf8){if(_0x14bcf8){_0xd98631=_0x14bcf8;_0x3013b[_0x8202('0x51')]=_[_0x8202('0x4c')](db[_0x8202('0x45')][_0x8202('0x46')]);_0x3013b[_0x8202('0x4f')]=_[_0x8202('0x4c')](_0x7b48d3[_0x8202('0x4f')]);_0x3013b[_0x8202('0x4d')]=_['intersection'](_0x3013b[_0x8202('0x51')],_0x3013b[_0x8202('0x4f')]);_0x193fc3[_0x8202('0x50')]=_['intersection'](_0x3013b[_0x8202('0x51')],qs[_0x8202('0x52')](_0x7b48d3[_0x8202('0x4f')][_0x8202('0x52')]));_0x193fc3['attributes']=_0x193fc3[_0x8202('0x50')][_0x8202('0x53')]?_0x193fc3['attributes']:_0x3013b[_0x8202('0x51')];_0x193fc3[_0x8202('0x55')]=qs[_0x8202('0x56')](_0x7b48d3[_0x8202('0x4f')][_0x8202('0x56')]);_0x193fc3[_0x8202('0x57')]=qs[_0x8202('0x4d')](_[_0x8202('0x58')](_0x7b48d3['query'],_0x3013b[_0x8202('0x4d')]));if(_0x7b48d3[_0x8202('0x4f')]['filter']){_0x193fc3[_0x8202('0x57')]=_[_0x8202('0x59')](_0x193fc3['where'],{'$or':_[_0x8202('0x3d')](_0x193fc3[_0x8202('0x50')],function(_0x56b9e9){var _0x47a385={};_0x47a385[_0x56b9e9]={'$like':'%'+_0x7b48d3[_0x8202('0x4f')][_0x8202('0x3b')]+'%'};return _0x47a385;})});}_0x193fc3[_0x8202('0x51')]=db[_0x8202('0x45')];_0x193fc3['as']=_0x8202('0x8a');_0x193fc3=_[_0x8202('0x59')]({},_0x193fc3,_0x7b48d3['options']);return _0xd98631[_0x8202('0xe8')]({'include':[_0x193fc3]});}})[_0x8202('0x33')](function(_0x101a8e){if(_0x101a8e){var _0xb14203={},_0x53053d=[],_0x31ec99=0x0;for(var _0x51744e=0x0;_0x51744e<_0x101a8e[_0x8202('0x53')];_0x51744e+=0x1){for(var _0x21e2bc=0x0,_0x1c4d75;_0x21e2bc<_0x101a8e[_0x51744e][_0x8202('0x8a')][_0x8202('0x53')];_0x21e2bc+=0x1){_0x1c4d75=_0x101a8e[_0x51744e][_0x8202('0x8a')][_0x21e2bc]['get']({'plain':!![]});_0xb14203[_0x1c4d75['id']]=_0x1c4d75;}}_0xb14203=_[_0x8202('0x122')](_0xb14203);for(var _0x18aeea=qs['offset'](_0x7b48d3[_0x8202('0x4f')][_0x8202('0x2b')]);_0x18aeea<_0xb14203[_0x8202('0x53')]&&_0x53053d['length']=_0x18a1e7['agents']){throw new Error(_0x9673('0x50'));}})[_0x9673('0xe')](function(){if(_0x7a9c52){return db[_0x9673('0x2a')][_0x9673('0x48')]({'where':{'membername':_0x7a9c52[_0x9673('0x27')]},'individualHooks':!![]});}})[_0x9673('0xe')](function(){if(_0x7a9c52){return _0x7a9c52[_0x9673('0x51')]({'raw':!![]});}})[_0x9673('0xe')](function(_0x233bfc){if(_0x7a9c52){if(_0x233bfc){var _0x465887=[];_0x3aa063=_0x233bfc;if(_0x3aa063[_0x9673('0x2d')]){for(var _0x26e777=0x0;_0x26e777<_0x3aa063[_0x9673('0x2d')];_0x26e777++){_0x465887[_0x9673('0x32')](db['UserVoiceQueueRt'][_0x9673('0x52')]({'membername':_0x7a9c52[_0x9673('0x27')],'UserId':_0x7a9c52['id'],'queue_name':_0x3aa063[_0x26e777]['name'],'VoiceQueueId':_0x3aa063[_0x26e777]['id'],'interface':_0x229fcf,'paused':_0x7a9c52[_0x9673('0x4b')]||![],'penalty':_0x3aa063[_0x26e777][_0x9673('0x53')]||0x0}));}return BPromise[_0x9673('0x47')](_0x465887);}}}})['then'](function(){if(_0x7a9c52){return db['MemberReport'][_0x9673('0x1a')]({'where':{'membername':_0x7a9c52[_0x9673('0x27')],'exitAt':null}});}})[_0x9673('0xe')](function(_0x186d7f){if(_0x7a9c52){if(_0x186d7f&&_0x186d7f[_0x9673('0x2d')]){var _0x3c3a76=[];_0x186d7f[_0x9673('0x31')](function(_0x4adb7a){_0x3c3a76[_0x9673('0x32')](_0x4adb7a['update']({'exitAt':moment()['format'](_0x9673('0x2f'))}));});return BPromise[_0x9673('0x47')](_0x3c3a76);}}})[_0x9673('0xe')](function(_0x4a25a3){if(_0x7a9c52){var _0x1ffdc2=[];var _0x300cd7=[];var _0x4d1821=utils[_0x9673('0x30')]();var _0x2b1869={'membername':_0x7a9c52[_0x9673('0x27')],'interface':_0x229fcf,'enterAt':moment()[_0x9673('0x2e')](_0x9673('0x2f')),'role':_0x7a9c52[_0x9673('0x28')],'internal':_0x7a9c52[_0x9673('0x37')]};_0x4d1821[_0x9673('0x31')](function(_0x9e4b6c){_0x1ffdc2[_0x9673('0x32')](_[_0x9673('0x54')]({'channel':_0x9e4b6c,'type':_0x9673('0x55'),'data1':_0x9673('0x56'),'data2':_0x229fcf},_0x2b1869));if(_0x7a9c52[_0x9673('0x4b')]){_0x300cd7[_0x9673('0x32')](_[_0x9673('0x54')]({'channel':_0x9e4b6c,'type':_0x9673('0x35'),'data1':_0x9673('0x57')},_0x2b1869));}});return db['MemberReport'][_0x9673('0x58')](_0x1ffdc2[_0x9673('0x59')](_0x300cd7),{'individualHooks':!![]});}})[_0x9673('0xe')](function(){if(_0x7a9c52){return _0x7a9c52['update']({'online':!![],'lastLoginAt':moment()[_0x9673('0x2e')](_0x9673('0x2f')),'voicePause':_0x7a9c52[_0x9673('0x4b')]||![],'mailPause':_0x7a9c52[_0x9673('0x4b')]||![],'chatPause':_0x7a9c52['loginInPause']||![],'faxPause':_0x7a9c52[_0x9673('0x4b')]||![],'smsPause':_0x7a9c52[_0x9673('0x4b')]||![],'openchannelPause':_0x7a9c52[_0x9673('0x4b')]||![],'pauseType':_0x7a9c52[_0x9673('0x4b')]?_0x9673('0x57'):null,'lastPauseAt':moment()['format'](_0x9673('0x2f')),'interface':_0x229fcf});}})[_0x9673('0xe')](function(_0x3cabbc){_0x3b7f3f(_0x3cabbc);})['catch'](function(_0x22a1c0){_0x1a7ff5(_0x41135f[_0x9673('0x14')](0x1f4,_0x22a1c0['message']));});});}; \ No newline at end of file +var _0x659c=['include','model','attributes','GetUser','ShowUser','User','find','PauseUser','name','role','interface','UserVoiceQueueRt','MemberReport','findAll','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','push','isNil','format','SIP/%s','body','type','DEFAULT\x20PAUSE','internal','uniqueid','update','UnpauseUser','findOne','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','whatsapp','set','%s%s','Pause','all','LogoutUser','LoginUser','loginInPause','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','options','raw','where','limit','map'];(function(_0xc74b25,_0x4e6a58){var _0x4e9b9d=function(_0x382b1a){while(--_0x382b1a){_0xc74b25['push'](_0xc74b25['shift']());}};_0x4e9b9d(++_0x4e6a58);}(_0x659c,0x1aa));var _0xc659=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x659c[_0x280f4a];return _0x1bb157;};'use strict';var _=require(_0xc659('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc659('0x1'));var rs=require(_0xc659('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc659('0x3'))['db'];var utils=require(_0xc659('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc659('0x5'));var jayson=require(_0xc659('0x6'));var client=jayson[_0xc659('0x7')][_0xc659('0x8')]({'port':0x232a});config[_0xc659('0x9')]=_[_0xc659('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc659('0xb'))(new Redis(config['redis']));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x29a052,_0x2ea975,_0x422e00){return new BPromise(function(_0x35a046,_0x3f6f5a){return client[_0xc659('0xc')](_0x29a052,_0x422e00)[_0xc659('0xd')](function(_0x4267f3){logger['info'](_0xc659('0xe'),_0x2ea975,_0xc659('0xf'));logger[_0xc659('0x10')]('User,\x20%s,\x20%s,\x20%s',_0x2ea975,'request\x20sent',JSON[_0xc659('0x11')](_0x4267f3));if(_0x4267f3[_0xc659('0x12')]){if(_0x4267f3['error'][_0xc659('0x13')]===0x1f4){logger[_0xc659('0x12')](_0xc659('0xe'),_0x2ea975,_0x4267f3[_0xc659('0x12')][_0xc659('0x14')]);return _0x3f6f5a(_0x4267f3[_0xc659('0x12')][_0xc659('0x14')]);}logger[_0xc659('0x12')](_0xc659('0xe'),_0x2ea975,_0x4267f3[_0xc659('0x12')]['message']);return _0x35a046(_0x4267f3[_0xc659('0x12')][_0xc659('0x14')]);}else{logger[_0xc659('0x15')](_0xc659('0xe'),_0x2ea975,_0xc659('0xf'));_0x35a046(_0x4267f3[_0xc659('0x16')]['message']);}})[_0xc659('0x17')](function(_0x33e118){logger[_0xc659('0x12')]('User,\x20%s,\x20%s',_0x2ea975,_0x33e118);_0x3f6f5a(_0x33e118);});});}exports['GetUser']=function(_0x163064){var _0x6af6f9=this;return new Promise(function(_0x48be52,_0x463dc1){return db['User']['findAll']({'raw':_0x163064['options']?_0x163064[_0xc659('0x18')][_0xc659('0x19')]===undefined?!![]:![]:!![],'where':_0x163064[_0xc659('0x18')]?_0x163064[_0xc659('0x18')][_0xc659('0x1a')]||null:null,'attributes':_0x163064[_0xc659('0x18')]?_0x163064['options']['attributes']||null:null,'limit':_0x163064['options']?_0x163064[_0xc659('0x18')][_0xc659('0x1b')]||null:null,'include':_0x163064['options']?_0x163064[_0xc659('0x18')]['include']?_[_0xc659('0x1c')](_0x163064[_0xc659('0x18')][_0xc659('0x1d')],function(_0x36e194){return{'model':db[_0x36e194[_0xc659('0x1e')]],'as':_0x36e194['as'],'attributes':_0x36e194[_0xc659('0x1f')],'include':_0x36e194[_0xc659('0x1d')]?_[_0xc659('0x1c')](_0x36e194[_0xc659('0x1d')],function(_0x27efe0){return{'model':db[_0x27efe0[_0xc659('0x1e')]],'as':_0x27efe0['as'],'attributes':_0x27efe0[_0xc659('0x1f')],'include':_0x27efe0['include']?_[_0xc659('0x1c')](_0x27efe0[_0xc659('0x1d')],function(_0x5deee1){return{'model':db[_0x5deee1['model']],'as':_0x5deee1['as'],'attributes':_0x5deee1[_0xc659('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc659('0xd')](function(_0x2770d6){logger[_0xc659('0x15')]('GetUser',_0x163064);logger[_0xc659('0x10')](_0xc659('0x20'),_0x163064,JSON[_0xc659('0x11')](_0x2770d6));_0x48be52(_0x2770d6);})['catch'](function(_0x39eec1){logger[_0xc659('0x12')]('GetUser',_0x39eec1['message'],_0x163064);_0x463dc1(_0x6af6f9[_0xc659('0x12')](0x1f4,_0x39eec1['message']));});});};exports[_0xc659('0x21')]=function(_0x290c99){var _0x55dca5=this;return new Promise(function(_0x5181bb,_0x1e1dd0){return db[_0xc659('0x22')][_0xc659('0x23')]({'raw':_0x290c99['options']?_0x290c99[_0xc659('0x18')][_0xc659('0x19')]===undefined?!![]:![]:!![],'where':_0x290c99['options']?_0x290c99[_0xc659('0x18')]['where']||null:null,'attributes':_0x290c99[_0xc659('0x18')]?_0x290c99['options'][_0xc659('0x1f')]||null:null,'include':_0x290c99['options']?_0x290c99[_0xc659('0x18')][_0xc659('0x1d')]?_[_0xc659('0x1c')](_0x290c99[_0xc659('0x18')][_0xc659('0x1d')],function(_0x2596f1){return{'model':db[_0x2596f1[_0xc659('0x1e')]],'as':_0x2596f1['as'],'attributes':_0x2596f1[_0xc659('0x1f')],'include':_0x2596f1[_0xc659('0x1d')]?_[_0xc659('0x1c')](_0x2596f1['include'],function(_0x54b04c){return{'model':db[_0x54b04c[_0xc659('0x1e')]],'as':_0x54b04c['as'],'attributes':_0x54b04c[_0xc659('0x1f')],'include':_0x54b04c[_0xc659('0x1d')]?_['map'](_0x54b04c[_0xc659('0x1d')],function(_0x20d36d){return{'model':db[_0x20d36d[_0xc659('0x1e')]],'as':_0x20d36d['as'],'attributes':_0x20d36d[_0xc659('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc659('0xd')](function(_0x82c490){logger['info']('ShowUser',_0x290c99);logger[_0xc659('0x10')](_0xc659('0x21'),_0x290c99,JSON[_0xc659('0x11')](_0x82c490));_0x5181bb(_0x82c490);})['catch'](function(_0x286843){logger['error']('ShowUser',_0x286843[_0xc659('0x14')],_0x290c99);_0x1e1dd0(_0x55dca5[_0xc659('0x12')](0x1f4,_0x286843[_0xc659('0x14')]));});});};exports[_0xc659('0x24')]=function(_0xbc35d2){var _0x29c249=this;return new Promise(function(_0x5f4fbd,_0x2dfa9c){var _0x2cb6f2;return db[_0xc659('0x22')][_0xc659('0x23')]({'where':_0xbc35d2[_0xc659('0x18')]['where']||{},'attributes':['id',_0xc659('0x25'),_0xc659('0x26'),'internal',_0xc659('0x27')]})['then'](function(_0x5a97e6){if(_0x5a97e6){_0x2cb6f2=_0x5a97e6;return db[_0xc659('0x28')]['update']({'paused':0x1},{'where':{'UserId':_0x2cb6f2['id']},'individualHooks':!![]});}})[_0xc659('0xd')](function(){if(_0x2cb6f2){return db[_0xc659('0x29')][_0xc659('0x2a')]({'where':{'membername':_0x2cb6f2[_0xc659('0x25')],'type':_0xc659('0x2b'),'exitAt':null}});}})['then'](function(_0x3bb7e4){if(_0x2cb6f2){if(_0x3bb7e4&&_0x3bb7e4['length']){var _0x4b799b=moment()['format'](_0xc659('0x2c'));for(var _0x268194=0x0,_0x3a27e2=_0x3bb7e4[_0xc659('0x2d')];_0x268194<_0x3a27e2;_0x268194++){_0x3bb7e4[_0x268194][_0xc659('0x2e')]({'exitAt':_0x4b799b});}}}})[_0xc659('0xd')](function(){if(_0x2cb6f2){var _0x4c80df=[];var _0x2a53bf=utils[_0xc659('0x2f')]();_0x2a53bf[_0xc659('0x30')](function(_0x5b6933){_0x4c80df[_0xc659('0x31')]({'channel':_0x5b6933,'membername':_0x2cb6f2[_0xc659('0x25')],'interface':_[_0xc659('0x32')](_0x2cb6f2['interface'])?util[_0xc659('0x33')](_0xc659('0x34'),_0x2cb6f2[_0xc659('0x25')]):_0x2cb6f2[_0xc659('0x27')],'type':'PAUSE','enterAt':moment()[_0xc659('0x33')](_0xc659('0x2c')),'data1':_0xbc35d2[_0xc659('0x35')][_0xc659('0x36')]||_0xc659('0x37'),'role':_0x2cb6f2[_0xc659('0x26')],'internal':_0x2cb6f2[_0xc659('0x38')],'uniqueid':_0xbc35d2[_0xc659('0x35')][_0xc659('0x39')]||null});});return db[_0xc659('0x29')]['bulkCreate'](_0x4c80df,{'individualHooks':!![]});}})['then'](function(){if(_0x2cb6f2){return _0x2cb6f2[_0xc659('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0xbc35d2[_0xc659('0x35')][_0xc659('0x36')]||_0xc659('0x37'),'lastPauseAt':moment()[_0xc659('0x33')](_0xc659('0x2c'))});}})['then'](function(_0x45f65c){_0x5f4fbd(_0x45f65c);})[_0xc659('0x17')](function(_0x2f1ac2){_0x2dfa9c(_0x29c249[_0xc659('0x12')](0x1f4,_0x2f1ac2['message']));});});};exports[_0xc659('0x3b')]=function(_0x5bc99f){var _0x1bd163=this;return new Promise(function(_0x4298b1,_0x1b09c3){var _0x108fd2;return db[_0xc659('0x22')][_0xc659('0x3c')]({'where':_0x5bc99f[_0xc659('0x18')][_0xc659('0x1a')]||{},'attributes':['id',_0xc659('0x25')]})['then'](function(_0x30e545){if(_0x30e545){_0x108fd2=_0x30e545;if(_0x5bc99f[_0xc659('0x35')][_0xc659('0x3d')]&&!utils['isValidChannel'](_0x5bc99f[_0xc659('0x35')][_0xc659('0x3d')])){throw new Error(_0xc659('0x3e'));}switch(_0x5bc99f[_0xc659('0x35')][_0xc659('0x3d')]){case _0xc659('0x3f'):return db[_0xc659('0x28')][_0xc659('0x3a')]({'paused':0x0},{'where':{'UserId':_0x108fd2['id']}})[_0xc659('0xd')](function(){return db['MemberReport'][_0xc659('0x23')]({'where':{'channel':_0x5bc99f['body'][_0xc659('0x3d')],'membername':_0x108fd2[_0xc659('0x25')],'type':_0xc659('0x2b'),'exitAt':null}});})[_0xc659('0xd')](function(_0x27908c){if(_0x27908c){return _0x27908c[_0xc659('0x3a')]({'exitAt':moment()[_0xc659('0x33')](_0xc659('0x2c')),'data2':_0xc659('0x40')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x108fd2[_0xc659('0x3a')]({'voicePause':![]});});case _0xc659('0x41'):case _0xc659('0x42'):case _0xc659('0x43'):case _0xc659('0x44'):case _0xc659('0x45'):case _0xc659('0x46'):return db[_0xc659('0x29')][_0xc659('0x23')]({'where':{'channel':_0x5bc99f[_0xc659('0x35')][_0xc659('0x3d')],'membername':_0x108fd2[_0xc659('0x25')],'type':'PAUSE','exitAt':null}})[_0xc659('0xd')](function(_0x3c7c8f){return _0x3c7c8f['update']({'exitAt':moment()[_0xc659('0x33')](_0xc659('0x2c')),'data2':_0xc659('0x40')},{'individualHooks':!![]});})[_0xc659('0xd')](function(){var _0x3fbb29={};_[_0xc659('0x47')](_0x3fbb29,util[_0xc659('0x33')](_0xc659('0x48'),_0x5bc99f[_0xc659('0x35')]['channel'],_0xc659('0x49')),![]);return _0x108fd2[_0xc659('0x3a')](_0x3fbb29);});default:return db[_0xc659('0x28')]['update']({'paused':0x0},{'where':{'UserId':_0x108fd2['id']}})[_0xc659('0xd')](function(){return db[_0xc659('0x29')][_0xc659('0x2a')]({'where':{'membername':_0x108fd2[_0xc659('0x25')],'type':_0xc659('0x2b'),'exitAt':null}});})[_0xc659('0xd')](function(_0x296163){var _0x539b4f=[];_0x296163[_0xc659('0x30')](function(_0x1bd6eb){_0x539b4f[_0xc659('0x31')](_0x1bd6eb['update']({'exitAt':moment()[_0xc659('0x33')](_0xc659('0x2c')),'data2':_0xc659('0x40')}));});return BPromise[_0xc659('0x4a')](_0x539b4f);})[_0xc659('0xd')](function(){return _0x108fd2['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xc659('0xd')](function(_0x4ce242){_0x4298b1(_0x4ce242);})[_0xc659('0x17')](function(_0x31033f){_0x1b09c3(_0x1bd163[_0xc659('0x12')](0x1f4,_0x31033f[_0xc659('0x14')]));});});};exports[_0xc659('0x4b')]=function(_0x1c6127){var _0x34b10f=this;return new Promise(function(_0x3cb663,_0x437118){var _0xb31f2d;return db[_0xc659('0x22')][_0xc659('0x3c')]({'where':_0x1c6127[_0xc659('0x18')][_0xc659('0x1a')]||{},'attributes':['id',_0xc659('0x25')]})[_0xc659('0xd')](function(_0x4e117b){if(_0x4e117b){_0xb31f2d=_0x4e117b;return db[_0xc659('0x28')]['destroy']({'where':{'membername':_0xb31f2d[_0xc659('0x25')]},'individualHooks':!![]});}})[_0xc659('0xd')](function(){if(_0xb31f2d){return db[_0xc659('0x29')][_0xc659('0x2a')]({'where':{'membername':_0xb31f2d[_0xc659('0x25')],'exitAt':null}});}})[_0xc659('0xd')](function(_0x58ddbb){if(_0xb31f2d){if(_0x58ddbb&&_0x58ddbb[_0xc659('0x2d')]){var _0x1b4e6b=[];_0x58ddbb[_0xc659('0x30')](function(_0x23b577){_0x1b4e6b[_0xc659('0x31')](_0x23b577[_0xc659('0x3a')]({'exitAt':moment()['format'](_0xc659('0x2c'))}));});return BPromise[_0xc659('0x4a')](_0x1b4e6b);}}})[_0xc659('0xd')](function(){if(_0xb31f2d){return _0xb31f2d['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xc659('0xd')](function(_0x186e8f){_0x3cb663(_0x186e8f);})['catch'](function(_0x3b58f7){_0x437118(_0x34b10f[_0xc659('0x12')](0x1f4,_0x3b58f7[_0xc659('0x14')]));});});};exports[_0xc659('0x4c')]=function(_0x1ff5ab){var _0x1be4be=this;return new Promise(function(_0x40f32d,_0x5386d5){var _0x3b3067;var _0x2a6ed9;var _0x483767;var _0x840b5f;return db['User'][_0xc659('0x3c')]({'where':_0x1ff5ab[_0xc659('0x18')]['where']||{},'attributes':['id',_0xc659('0x25'),_0xc659('0x26'),'mobile','phone',_0xc659('0x38'),_0xc659('0x4d'),_0xc659('0x27')]})[_0xc659('0xd')](function(_0x2ab917){if(_0x2ab917){_0x3b3067=_0x2ab917;_0x840b5f=_0x1ff5ab[_0xc659('0x35')]['interface']?_0x1ff5ab['body']['interface']:util[_0xc659('0x33')](_0xc659('0x34'),_0x3b3067[_0xc659('0x25')]);return db[_0xc659('0x22')][_0xc659('0x4e')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x3b3067['id']}}});}})[_0xc659('0xd')](function(_0x561848){if(_0x561848){_0x483767=_0x561848;return require(_0xc659('0x4f'))[_0xc659('0x50')]();}})[_0xc659('0xd')](function(_0x2e8bd6){if(_0x2e8bd6&&_0x2e8bd6[_0xc659('0x51')]&&_0x483767>=_0x2e8bd6[_0xc659('0x51')]){throw new Error(_0xc659('0x52'));}})['then'](function(){if(_0x3b3067){return db['UserVoiceQueueRt'][_0xc659('0x53')]({'where':{'membername':_0x3b3067['name']},'individualHooks':!![]});}})['then'](function(){if(_0x3b3067){return _0x3b3067[_0xc659('0x54')]({'raw':!![]});}})[_0xc659('0xd')](function(_0x42dc6f){if(_0x3b3067){if(_0x42dc6f){var _0x1938a7=[];_0x2a6ed9=_0x42dc6f;if(_0x2a6ed9[_0xc659('0x2d')]){for(var _0x340ee4=0x0;_0x340ee4<_0x2a6ed9[_0xc659('0x2d')];_0x340ee4++){_0x1938a7['push'](db[_0xc659('0x28')]['upsert']({'membername':_0x3b3067[_0xc659('0x25')],'UserId':_0x3b3067['id'],'queue_name':_0x2a6ed9[_0x340ee4][_0xc659('0x25')],'VoiceQueueId':_0x2a6ed9[_0x340ee4]['id'],'interface':_0x840b5f,'paused':_0x3b3067[_0xc659('0x4d')]||![],'penalty':_0x2a6ed9[_0x340ee4][_0xc659('0x55')]||0x0}));}return BPromise[_0xc659('0x4a')](_0x1938a7);}}}})['then'](function(){if(_0x3b3067){return db[_0xc659('0x29')][_0xc659('0x2a')]({'where':{'membername':_0x3b3067[_0xc659('0x25')],'exitAt':null}});}})[_0xc659('0xd')](function(_0x230a0f){if(_0x3b3067){if(_0x230a0f&&_0x230a0f[_0xc659('0x2d')]){var _0x30addf=[];_0x230a0f[_0xc659('0x30')](function(_0x30094c){_0x30addf[_0xc659('0x31')](_0x30094c[_0xc659('0x3a')]({'exitAt':moment()[_0xc659('0x33')](_0xc659('0x2c'))}));});return BPromise['all'](_0x30addf);}}})[_0xc659('0xd')](function(_0x54f4b1){if(_0x3b3067){var _0x58f229=[];var _0x5c1edf=[];var _0x3d32d0=utils[_0xc659('0x2f')]();var _0x598571={'membername':_0x3b3067[_0xc659('0x25')],'interface':_0x840b5f,'enterAt':moment()[_0xc659('0x33')](_0xc659('0x2c')),'role':_0x3b3067[_0xc659('0x26')],'internal':_0x3b3067[_0xc659('0x38')]};_0x3d32d0[_0xc659('0x30')](function(_0x382041){_0x58f229[_0xc659('0x31')](_[_0xc659('0x56')]({'channel':_0x382041,'type':_0xc659('0x57'),'data1':_0xc659('0x58'),'data2':_0x840b5f},_0x598571));if(_0x3b3067[_0xc659('0x4d')]){_0x5c1edf['push'](_[_0xc659('0x56')]({'channel':_0x382041,'type':'PAUSE','data1':_0xc659('0x59')},_0x598571));}});return db[_0xc659('0x29')][_0xc659('0x5a')](_0x58f229['concat'](_0x5c1edf),{'individualHooks':!![]});}})[_0xc659('0xd')](function(){if(_0x3b3067){return _0x3b3067[_0xc659('0x3a')]({'online':!![],'lastLoginAt':moment()[_0xc659('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3b3067[_0xc659('0x4d')]||![],'mailPause':_0x3b3067[_0xc659('0x4d')]||![],'chatPause':_0x3b3067[_0xc659('0x4d')]||![],'faxPause':_0x3b3067[_0xc659('0x4d')]||![],'smsPause':_0x3b3067['loginInPause']||![],'openchannelPause':_0x3b3067[_0xc659('0x4d')]||![],'pauseType':_0x3b3067[_0xc659('0x4d')]?_0xc659('0x59'):null,'lastPauseAt':moment()[_0xc659('0x33')](_0xc659('0x2c')),'interface':_0x840b5f});}})[_0xc659('0xd')](function(_0x36901c){_0x40f32d(_0x36901c);})[_0xc659('0x17')](function(_0x5b894b){_0x5386d5(_0x1be4be['error'](0x1f4,_0x5b894b['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index bf76cc6..709f912 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 _0x86d8=['update','emit','removeListener','length','./user.events','save','remove'];(function(_0x330524,_0x4307ac){var _0x26e908=function(_0x5f0ece){while(--_0x5f0ece){_0x330524['push'](_0x330524['shift']());}};_0x26e908(++_0x4307ac);}(_0x86d8,0x82));var _0x886d=function(_0x56c442,_0x433de4){_0x56c442=_0x56c442-0x0;var _0x2944db=_0x86d8[_0x56c442];return _0x2944db;};'use strict';var UserEvents=require(_0x886d('0x0'));var events=[_0x886d('0x1'),_0x886d('0x2'),_0x886d('0x3')];function createListener(_0x18840c,_0x3536d0){return function(_0xb48653){_0x3536d0[_0x886d('0x4')](_0x18840c,_0xb48653);};}function removeListener(_0x509dec,_0x4b7fb3){return function(){UserEvents[_0x886d('0x5')](_0x509dec,_0x4b7fb3);};}exports['register']=function(_0x4f6e01){for(var _0xf3799a=0x0,_0x294c4c=events[_0x886d('0x6')];_0xf3799a<_0x294c4c;_0xf3799a++){var _0x65c2ca=events[_0xf3799a];var _0x33817c=createListener('user:'+_0x65c2ca,_0x4f6e01);UserEvents['on'](_0x65c2ca,_0x33817c);}}; \ No newline at end of file +var _0x09b5=['user:','./user.events','save','remove','update','removeListener','register','length'];(function(_0x753519,_0x128672){var _0x1c2c9a=function(_0x35f558){while(--_0x35f558){_0x753519['push'](_0x753519['shift']());}};_0x1c2c9a(++_0x128672);}(_0x09b5,0x181));var _0x509b=function(_0x15398a,_0x152fa7){_0x15398a=_0x15398a-0x0;var _0x3e393f=_0x09b5[_0x15398a];return _0x3e393f;};'use strict';var UserEvents=require(_0x509b('0x0'));var events=[_0x509b('0x1'),_0x509b('0x2'),_0x509b('0x3')];function createListener(_0x329801,_0x4caf86){return function(_0x413ddb){_0x4caf86['emit'](_0x329801,_0x413ddb);};}function removeListener(_0x231590,_0x616f9c){return function(){UserEvents[_0x509b('0x4')](_0x231590,_0x616f9c);};}exports[_0x509b('0x5')]=function(_0x12839e){for(var _0x20d268=0x0,_0x21c24c=events[_0x509b('0x6')];_0x20d268<_0x21c24c;_0x20d268++){var _0x10e546=events[_0x20d268];var _0x1620a4=createListener(_0x509b('0x7')+_0x10e546,_0x12839e);UserEvents['on'](_0x10e546,_0x1620a4);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index db4e6a9..e794556 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 _0x53f1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','connect-timeout'];(function(_0x3ea046,_0x553381){var _0x401460=function(_0x33e558){while(--_0x33e558){_0x3ea046['push'](_0x3ea046['shift']());}};_0x401460(++_0x553381);}(_0x53f1,0x7d));var _0x153f=function(_0x5e5f0a,_0x2a1524){_0x5e5f0a=_0x5e5f0a-0x0;var _0x19b4b8=_0x53f1[_0x5e5f0a];return _0x19b4b8;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x153f('0x0'));var express=require('express');var router=express[_0x153f('0x1')]();var auth=require(_0x153f('0x2'));var interaction=require(_0x153f('0x3'));var config=require(_0x153f('0x4'));module[_0x153f('0x5')]=router; \ No newline at end of file +var _0xbf1a=['multer','util','path','connect-timeout','Router','../../config/environment'];(function(_0x3d2b37,_0x3d0197){var _0x2c0ea6=function(_0x283da1){while(--_0x283da1){_0x3d2b37['push'](_0x3d2b37['shift']());}};_0x2c0ea6(++_0x3d0197);}(_0xbf1a,0xa2));var _0xabf1=function(_0x5b9115,_0x53697a){_0x5b9115=_0x5b9115-0x0;var _0x420a45=_0xbf1a[_0x5b9115];return _0x420a45;};'use strict';var multer=require(_0xabf1('0x0'));var util=require(_0xabf1('0x1'));var path=require(_0xabf1('0x2'));var timeout=require(_0xabf1('0x3'));var express=require('express');var router=express[_0xabf1('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xabf1('0x5'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 576bf48..df7c55e 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 _0xd8b0=['exports','sequelize'];(function(_0x448bab,_0x25517b){var _0x5dc534=function(_0x2196ba){while(--_0x2196ba){_0x448bab['push'](_0x448bab['shift']());}};_0x5dc534(++_0x25517b);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x520779,_0x4b8a86){var _0x193849=function(_0x13371e){while(--_0x13371e){_0x520779['push'](_0x520779['shift']());}};_0x193849(++_0x4b8a86);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index a3d6f92..d846d94 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 _0x3e5b=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userChatQueue.attributes','define'];(function(_0xef88e8,_0x4e4bce){var _0x181780=function(_0x42ef22){while(--_0x42ef22){_0xef88e8['push'](_0xef88e8['shift']());}};_0x181780(++_0x4e4bce);}(_0x3e5b,0x188));var _0xb3e5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3e5b[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xb3e5('0x0'));var util=require(_0xb3e5('0x1'));var logger=require(_0xb3e5('0x2'))(_0xb3e5('0x3'));var moment=require(_0xb3e5('0x4'));var BPromise=require(_0xb3e5('0x5'));var rp=require(_0xb3e5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3e5('0x7'));var config=require(_0xb3e5('0x8'));var attributes=require(_0xb3e5('0x9'));module['exports']=function(_0x55479f,_0x26fdc6){return _0x55479f[_0xb3e5('0xa')](_0xb3e5('0xb'),attributes,{'tableName':_0xb3e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9616=['./userChatQueue.attributes','exports','define','UserChatQueue','lodash','api','request-promise','path','rimraf','../../config/environment'];(function(_0x50b2f8,_0x129068){var _0xcdb090=function(_0x452b62){while(--_0x452b62){_0x50b2f8['push'](_0x50b2f8['shift']());}};_0xcdb090(++_0x129068);}(_0x9616,0x112));var _0x6961=function(_0x4d7f3f,_0x4d2803){_0x4d7f3f=_0x4d7f3f-0x0;var _0x5d67cc=_0x9616[_0x4d7f3f];return _0x5d67cc;};'use strict';var _=require(_0x6961('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6961('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6961('0x2'));var fs=require('fs');var path=require(_0x6961('0x3'));var rimraf=require(_0x6961('0x4'));var config=require(_0x6961('0x5'));var attributes=require(_0x6961('0x6'));module[_0x6961('0x7')]=function(_0x4db7c7,_0x4a634b){return _0x4db7c7[_0x6961('0x8')](_0x6961('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 6f5db99..82cf2f5 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 _0xb701=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x299261,_0x44f12b){var _0xf1e2ec=function(_0x520f23){while(--_0x520f23){_0x299261['push'](_0x299261['shift']());}};_0xf1e2ec(++_0x44f12b);}(_0xb701,0x1c9));var _0x1b70=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb701[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x1b70('0x0'));var util=require(_0x1b70('0x1'));var moment=require('moment');var BPromise=require(_0x1b70('0x2'));var rs=require(_0x1b70('0x3'));var fs=require('fs');var Redis=require(_0x1b70('0x4'));var db=require(_0x1b70('0x5'))['db'];var utils=require(_0x1b70('0x6'));var logger=require(_0x1b70('0x7'))('rpc');var config=require(_0x1b70('0x8'));var jayson=require(_0x1b70('0x9'));var client=jayson[_0x1b70('0xa')][_0x1b70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42392c,_0xad0973,_0x25c5e2){return new BPromise(function(_0x1e38d6,_0x424944){return client[_0x1b70('0xc')](_0x42392c,_0x25c5e2)['then'](function(_0x457ff6){logger['info'](_0x1b70('0xd'),_0xad0973,_0x1b70('0xe'));logger[_0x1b70('0xf')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xad0973,_0x1b70('0xe'),JSON[_0x1b70('0x10')](_0x457ff6));if(_0x457ff6[_0x1b70('0x11')]){if(_0x457ff6[_0x1b70('0x11')][_0x1b70('0x12')]===0x1f4){logger[_0x1b70('0x11')]('UserChatQueue,\x20%s,\x20%s',_0xad0973,_0x457ff6[_0x1b70('0x11')][_0x1b70('0x13')]);return _0x424944(_0x457ff6[_0x1b70('0x11')][_0x1b70('0x13')]);}logger['error'](_0x1b70('0xd'),_0xad0973,_0x457ff6[_0x1b70('0x11')][_0x1b70('0x13')]);return _0x1e38d6(_0x457ff6[_0x1b70('0x11')][_0x1b70('0x13')]);}else{logger[_0x1b70('0x14')](_0x1b70('0xd'),_0xad0973,_0x1b70('0xe'));_0x1e38d6(_0x457ff6[_0x1b70('0x15')]['message']);}})['catch'](function(_0x138940){logger['error']('UserChatQueue,\x20%s,\x20%s',_0xad0973,_0x138940);_0x424944(_0x138940);});});} \ No newline at end of file +var _0x8f38=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','catch','lodash'];(function(_0x43e042,_0x1223f9){var _0x2ee198=function(_0x18adce){while(--_0x18adce){_0x43e042['push'](_0x43e042['shift']());}};_0x2ee198(++_0x1223f9);}(_0x8f38,0x7d));var _0x88f3=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0x8f38[_0x277fa3];return _0x2e4520;};'use strict';var _=require(_0x88f3('0x0'));var util=require(_0x88f3('0x1'));var moment=require(_0x88f3('0x2'));var BPromise=require(_0x88f3('0x3'));var rs=require(_0x88f3('0x4'));var fs=require('fs');var Redis=require(_0x88f3('0x5'));var db=require(_0x88f3('0x6'))['db'];var utils=require(_0x88f3('0x7'));var logger=require('../../config/logger')(_0x88f3('0x8'));var config=require(_0x88f3('0x9'));var jayson=require(_0x88f3('0xa'));var client=jayson[_0x88f3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x103579,_0x5632a9,_0x1e2aca){return new BPromise(function(_0xf71b95,_0x5eb0ab){return client['request'](_0x103579,_0x1e2aca)[_0x88f3('0xc')](function(_0x348c5c){logger[_0x88f3('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x5632a9,_0x88f3('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x5632a9,_0x88f3('0xe'),JSON[_0x88f3('0xf')](_0x348c5c));if(_0x348c5c[_0x88f3('0x10')]){if(_0x348c5c[_0x88f3('0x10')][_0x88f3('0x11')]===0x1f4){logger[_0x88f3('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x5632a9,_0x348c5c[_0x88f3('0x10')]['message']);return _0x5eb0ab(_0x348c5c[_0x88f3('0x10')][_0x88f3('0x12')]);}logger[_0x88f3('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x5632a9,_0x348c5c[_0x88f3('0x10')][_0x88f3('0x12')]);return _0xf71b95(_0x348c5c[_0x88f3('0x10')]['message']);}else{logger['info'](_0x88f3('0x13'),_0x5632a9,_0x88f3('0xe'));_0xf71b95(_0x348c5c['result'][_0x88f3('0x12')]);}})[_0x88f3('0x14')](function(_0x21b489){logger['error'](_0x88f3('0x13'),_0x5632a9,_0x21b489);_0x5eb0ab(_0x21b489);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index f068b90..99b65ee 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 _0x1894=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','path'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x1894,0x1af));var _0x4189=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0x1894[_0x5e2cb4];return _0x282902;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4189('0x0'));var timeout=require(_0x4189('0x1'));var express=require(_0x4189('0x2'));var router=express[_0x4189('0x3')]();var auth=require(_0x4189('0x4'));var interaction=require(_0x4189('0x5'));var config=require(_0x4189('0x6'));module[_0x4189('0x7')]=router; \ No newline at end of file +var _0x8fc4=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41fef3,_0x4c9eff){var _0x8ee292=function(_0x253230){while(--_0x253230){_0x41fef3['push'](_0x41fef3['shift']());}};_0x8ee292(++_0x4c9eff);}(_0x8fc4,0x141));var _0x48fc=function(_0x162739,_0x2f5faa){_0x162739=_0x162739-0x0;var _0x97a9b=_0x8fc4[_0x162739];return _0x97a9b;};'use strict';var multer=require(_0x48fc('0x0'));var util=require('util');var path=require(_0x48fc('0x1'));var timeout=require('connect-timeout');var express=require(_0x48fc('0x2'));var router=express[_0x48fc('0x3')]();var auth=require(_0x48fc('0x4'));var interaction=require(_0x48fc('0x5'));var config=require(_0x48fc('0x6'));module[_0x48fc('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 c03ca69..341acb4 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 _0x757a=['exports','INTEGER'];(function(_0x448eb9,_0x33eb33){var _0x3818cb=function(_0xe99dd6){while(--_0xe99dd6){_0x448eb9['push'](_0x448eb9['shift']());}};_0x3818cb(++_0x33eb33);}(_0x757a,0xde));var _0xa757=function(_0x1eb415,_0x109f8c){_0x1eb415=_0x1eb415-0x0;var _0x39011e=_0x757a[_0x1eb415];return _0x39011e;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'penalty':{'type':Sequelize[_0xa757('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4fc2=['sequelize','exports','INTEGER'];(function(_0x4d7d3d,_0x21b36f){var _0x465a8a=function(_0x139426){while(--_0x139426){_0x4d7d3d['push'](_0x4d7d3d['shift']());}};_0x465a8a(++_0x21b36f);}(_0x4fc2,0x111));var _0x24fc=function(_0x5bd626,_0xdbf46d){_0x5bd626=_0x5bd626-0x0;var _0x2661ca=_0x4fc2[_0x5bd626];return _0x2661ca;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'penalty':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d97b836..68938c2 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 _0x0b37=['exports','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x5a64eb,_0x286782){var _0x3ad930=function(_0x36a52f){while(--_0x36a52f){_0x5a64eb['push'](_0x5a64eb['shift']());}};_0x3ad930(++_0x286782);}(_0x0b37,0x1d7));var _0x70b3=function(_0x27cea7,_0x296d76){_0x27cea7=_0x27cea7-0x0;var _0x2e1420=_0x0b37[_0x27cea7];return _0x2e1420;};'use strict';var _=require('lodash');var util=require(_0x70b3('0x0'));var logger=require(_0x70b3('0x1'))(_0x70b3('0x2'));var moment=require(_0x70b3('0x3'));var BPromise=require('bluebird');var rp=require(_0x70b3('0x4'));var fs=require('fs');var path=require(_0x70b3('0x5'));var rimraf=require(_0x70b3('0x6'));var config=require(_0x70b3('0x7'));var attributes=require(_0x70b3('0x8'));module[_0x70b3('0x9')]=function(_0x50a82c,_0xbef934){return _0x50a82c['define'](_0x70b3('0xa'),attributes,{'tableName':_0x70b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb65c=['bluebird','path','rimraf','./userFaxQueue.attributes','exports','UserFaxQueue','lodash','util','api','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb65c,0x16e));var _0xcb65=function(_0x1fb94f,_0x2812e7){_0x1fb94f=_0x1fb94f-0x0;var _0x2a1bd0=_0xb65c[_0x1fb94f];return _0x2a1bd0;};'use strict';var _=require(_0xcb65('0x0'));var util=require(_0xcb65('0x1'));var logger=require('../../config/logger')(_0xcb65('0x2'));var moment=require(_0xcb65('0x3'));var BPromise=require(_0xcb65('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb65('0x5'));var rimraf=require(_0xcb65('0x6'));var config=require('../../config/environment');var attributes=require(_0xcb65('0x7'));module[_0xcb65('0x8')]=function(_0x2fe2b0,_0x30f4d0){return _0x2fe2b0['define'](_0xcb65('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 8084b8d..ead4153 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 _0x7e1a=['ioredis','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e1a,0x1b7));var _0xa7e1=function(_0x1d400e,_0xfac218){_0x1d400e=_0x1d400e-0x0;var _0x2068b2=_0x7e1a[_0x1d400e];return _0x2068b2;};'use strict';var _=require(_0xa7e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa7e1('0x1'));var rs=require(_0xa7e1('0x2'));var fs=require('fs');var Redis=require(_0xa7e1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa7e1('0x4'));var client=jayson[_0xa7e1('0x5')][_0xa7e1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1027f0,_0x1243b5,_0x1e50a9){return new BPromise(function(_0x54c9f9,_0x40c9c0){return client[_0xa7e1('0x7')](_0x1027f0,_0x1e50a9)[_0xa7e1('0x8')](function(_0x754236){logger[_0xa7e1('0x9')](_0xa7e1('0xa'),_0x1243b5,_0xa7e1('0xb'));logger['debug'](_0xa7e1('0xc'),_0x1243b5,_0xa7e1('0xb'),JSON['stringify'](_0x754236));if(_0x754236['error']){if(_0x754236['error'][_0xa7e1('0xd')]===0x1f4){logger[_0xa7e1('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x1243b5,_0x754236['error']['message']);return _0x40c9c0(_0x754236[_0xa7e1('0xe')][_0xa7e1('0xf')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1243b5,_0x754236[_0xa7e1('0xe')]['message']);return _0x54c9f9(_0x754236['error'][_0xa7e1('0xf')]);}else{logger[_0xa7e1('0x9')](_0xa7e1('0xa'),_0x1243b5,_0xa7e1('0xb'));_0x54c9f9(_0x754236[_0xa7e1('0x10')][_0xa7e1('0xf')]);}})['catch'](function(_0x4fcad1){logger[_0xa7e1('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x1243b5,_0x4fcad1);_0x40c9c0(_0x4fcad1);});});} \ No newline at end of file +var _0x2a23=['jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/environment'];(function(_0x4bf83e,_0x429223){var _0x5647c9=function(_0x195bae){while(--_0x195bae){_0x4bf83e['push'](_0x4bf83e['shift']());}};_0x5647c9(++_0x429223);}(_0x2a23,0x8b));var _0x32a2=function(_0xe76ecb,_0xb6a9e){_0xe76ecb=_0xe76ecb-0x0;var _0x3fcbd9=_0x2a23[_0xe76ecb];return _0x3fcbd9;};'use strict';var _=require(_0x32a2('0x0'));var util=require('util');var moment=require(_0x32a2('0x1'));var BPromise=require(_0x32a2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x32a2('0x4'));var jayson=require(_0x32a2('0x5'));var client=jayson[_0x32a2('0x6')][_0x32a2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3c56db,_0x291076,_0x28e369){return new BPromise(function(_0x51373e,_0x20b3f1){return client['request'](_0x3c56db,_0x28e369)[_0x32a2('0x8')](function(_0x21780b){logger[_0x32a2('0x9')](_0x32a2('0xa'),_0x291076,_0x32a2('0xb'));logger['debug'](_0x32a2('0xc'),_0x291076,_0x32a2('0xb'),JSON['stringify'](_0x21780b));if(_0x21780b[_0x32a2('0xd')]){if(_0x21780b[_0x32a2('0xd')][_0x32a2('0xe')]===0x1f4){logger[_0x32a2('0xd')](_0x32a2('0xa'),_0x291076,_0x21780b['error'][_0x32a2('0xf')]);return _0x20b3f1(_0x21780b['error'][_0x32a2('0xf')]);}logger[_0x32a2('0xd')](_0x32a2('0xa'),_0x291076,_0x21780b[_0x32a2('0xd')][_0x32a2('0xf')]);return _0x51373e(_0x21780b[_0x32a2('0xd')][_0x32a2('0xf')]);}else{logger[_0x32a2('0x9')](_0x32a2('0xa'),_0x291076,'request\x20sent');_0x51373e(_0x21780b[_0x32a2('0x10')][_0x32a2('0xf')]);}})[_0x32a2('0x11')](function(_0x467c3a){logger[_0x32a2('0xd')](_0x32a2('0xa'),_0x291076,_0x467c3a);_0x20b3f1(_0x467c3a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 59ab29e..f86230d 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 _0xcb59=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x592d0d,_0x4fbf8c){var _0x55c236=function(_0x544836){while(--_0x544836){_0x592d0d['push'](_0x592d0d['shift']());}};_0x55c236(++_0x4fbf8c);}(_0xcb59,0x1a1));var _0x9cb5=function(_0x6fcc41,_0x2b0991){_0x6fcc41=_0x6fcc41-0x0;var _0x15039d=_0xcb59[_0x6fcc41];return _0x15039d;};'use strict';var multer=require(_0x9cb5('0x0'));var util=require(_0x9cb5('0x1'));var path=require(_0x9cb5('0x2'));var timeout=require(_0x9cb5('0x3'));var express=require(_0x9cb5('0x4'));var router=express[_0x9cb5('0x5')]();var auth=require(_0x9cb5('0x6'));var interaction=require(_0x9cb5('0x7'));var config=require('../../config/environment');module[_0x9cb5('0x8')]=router; \ No newline at end of file +var _0xd588=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xd588,0xc3));var _0x8d58=function(_0x4f3f42,_0x50f3af){_0x4f3f42=_0x4f3f42-0x0;var _0x30a1a4=_0xd588[_0x4f3f42];return _0x30a1a4;};'use strict';var multer=require(_0x8d58('0x0'));var util=require(_0x8d58('0x1'));var path=require(_0x8d58('0x2'));var timeout=require(_0x8d58('0x3'));var express=require('express');var router=express[_0x8d58('0x4')]();var auth=require(_0x8d58('0x5'));var interaction=require(_0x8d58('0x6'));var config=require(_0x8d58('0x7'));module[_0x8d58('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 95519d3..9af6619 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 _0xb10b=['sequelize','INTEGER'];(function(_0xf9a0dc,_0x16f024){var _0x1cf0bd=function(_0x314566){while(--_0x314566){_0xf9a0dc['push'](_0xf9a0dc['shift']());}};_0x1cf0bd(++_0x16f024);}(_0xb10b,0x12a));var _0xbb10=function(_0x35e54a,_0x46953a){_0x35e54a=_0x35e54a-0x0;var _0x35c2b0=_0xb10b[_0x35e54a];return _0x35c2b0;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x33a02c,_0xb3252b){var _0x26ebd4=function(_0x31ee4a){while(--_0x31ee4a){_0x33a02c['push'](_0x33a02c['shift']());}};_0x26ebd4(++_0xb3252b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 300fe90..16e7409 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x16929a,_0x4b560e){var _0x2b5c73=function(_0x17e1fd){while(--_0x17e1fd){_0x16929a['push'](_0x16929a['shift']());}};_0x2b5c73(++_0x4b560e);}(_0xe706,0xa3));var _0x6e70=function(_0x52826c,_0x3c3896){_0x52826c=_0x52826c-0x0;var _0x1b8c9b=_0xe706[_0x52826c];return _0x1b8c9b;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x39db49,_0x1b9b0e){var _0x4b3cfc=function(_0x128213){while(--_0x128213){_0x39db49['push'](_0x39db49['shift']());}};_0x4b3cfc(++_0x1b9b0e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 42fa826..430aeb8 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 _0x432b=['http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client'];(function(_0x30861a,_0x337deb){var _0xa37ad6=function(_0x4dad90){while(--_0x4dad90){_0x30861a['push'](_0x30861a['shift']());}};_0xa37ad6(++_0x337deb);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require('util');var moment=require(_0xb432('0x1'));var BPromise=require(_0xb432('0x2'));var rs=require(_0xb432('0x3'));var fs=require('fs');var Redis=require(_0xb432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb432('0x5'))('rpc');var config=require(_0xb432('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb432('0x7')][_0xb432('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x274447,_0x45f857,_0x14fed4){return new BPromise(function(_0x6833df,_0x198b71){return client[_0xb432('0x9')](_0x274447,_0x14fed4)['then'](function(_0x12adbe){logger[_0xb432('0xa')](_0xb432('0xb'),_0x45f857,_0xb432('0xc'));logger[_0xb432('0xd')](_0xb432('0xe'),_0x45f857,'request\x20sent',JSON['stringify'](_0x12adbe));if(_0x12adbe[_0xb432('0xf')]){if(_0x12adbe[_0xb432('0xf')]['code']===0x1f4){logger[_0xb432('0xf')](_0xb432('0xb'),_0x45f857,_0x12adbe[_0xb432('0xf')]['message']);return _0x198b71(_0x12adbe[_0xb432('0xf')][_0xb432('0x10')]);}logger['error'](_0xb432('0xb'),_0x45f857,_0x12adbe[_0xb432('0xf')][_0xb432('0x10')]);return _0x6833df(_0x12adbe[_0xb432('0xf')][_0xb432('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45f857,_0xb432('0xc'));_0x6833df(_0x12adbe[_0xb432('0x11')][_0xb432('0x10')]);}})[_0xb432('0x12')](function(_0x27365c){logger[_0xb432('0xf')](_0xb432('0xb'),_0x45f857,_0x27365c);_0x198b71(_0x27365c);});});} \ No newline at end of file +var _0x3f27=['../../config/utils','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3f27,0x1f4));var _0x73f2=function(_0x46aa9e,_0x368c3e){_0x46aa9e=_0x46aa9e-0x0;var _0x4c535e=_0x3f27[_0x46aa9e];return _0x4c535e;};'use strict';var _=require(_0x73f2('0x0'));var util=require(_0x73f2('0x1'));var moment=require(_0x73f2('0x2'));var BPromise=require(_0x73f2('0x3'));var rs=require(_0x73f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73f2('0x5'))['db'];var utils=require(_0x73f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x73f2('0x7'));var client=jayson[_0x73f2('0x8')][_0x73f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aa8ec,_0x10af7a,_0x5efe60){return new BPromise(function(_0x521fc9,_0xa2ea48){return client[_0x73f2('0xa')](_0x4aa8ec,_0x5efe60)[_0x73f2('0xb')](function(_0x3bf117){logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,'request\x20sent');logger[_0x73f2('0xe')](_0x73f2('0xf'),_0x10af7a,_0x73f2('0x10'),JSON['stringify'](_0x3bf117));if(_0x3bf117['error']){if(_0x3bf117['error'][_0x73f2('0x11')]===0x1f4){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0xa2ea48(_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0x521fc9(_0x3bf117['error']['message']);}else{logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,_0x73f2('0x10'));_0x521fc9(_0x3bf117[_0x73f2('0x14')][_0x73f2('0x13')]);}})[_0x73f2('0x15')](function(_0x32e9c6){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x32e9c6);_0xa2ea48(_0x32e9c6);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f557025..48d0f48 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 _0x5783=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x29d316,_0x38e58f){var _0x5d468c=function(_0x59e1f4){while(--_0x59e1f4){_0x29d316['push'](_0x29d316['shift']());}};_0x5d468c(++_0x38e58f);}(_0x5783,0x8e));var _0x3578=function(_0x23e2a3,_0x13e18e){_0x23e2a3=_0x23e2a3-0x0;var _0x27901b=_0x5783[_0x23e2a3];return _0x27901b;};'use strict';var multer=require(_0x3578('0x0'));var util=require(_0x3578('0x1'));var path=require('path');var timeout=require(_0x3578('0x2'));var express=require(_0x3578('0x3'));var router=express[_0x3578('0x4')]();var auth=require(_0x3578('0x5'));var interaction=require(_0x3578('0x6'));var config=require(_0x3578('0x7'));module['exports']=router; \ No newline at end of file +var _0xdc7c=['../../components/interaction/service','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2fa6c9,_0x567c30){var _0x993895=function(_0x5432c7){while(--_0x5432c7){_0x2fa6c9['push'](_0x2fa6c9['shift']());}};_0x993895(++_0x567c30);}(_0xdc7c,0xf2));var _0xcdc7=function(_0x109036,_0x3585ad){_0x109036=_0x109036-0x0;var _0x3e2cbb=_0xdc7c[_0x109036];return _0x3e2cbb;};'use strict';var multer=require(_0xcdc7('0x0'));var util=require('util');var path=require(_0xcdc7('0x1'));var timeout=require(_0xcdc7('0x2'));var express=require(_0xcdc7('0x3'));var router=express[_0xcdc7('0x4')]();var auth=require(_0xcdc7('0x5'));var interaction=require(_0xcdc7('0x6'));var config=require('../../config/environment');module[_0xcdc7('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 fb387c3..c816eea 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 _0xbaf0=['exports','INTEGER'];(function(_0x1460ab,_0x74d06e){var _0x1eeb5c=function(_0x28de38){while(--_0x28de38){_0x1460ab['push'](_0x1460ab['shift']());}};_0x1eeb5c(++_0x74d06e);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0xa61d49,_0x2793f6){var _0x2258ed=function(_0x39eff8){while(--_0x39eff8){_0xa61d49['push'](_0xa61d49['shift']());}};_0x2258ed(++_0x2793f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index b51c493..402d472 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 _0x8eb2=['path','rimraf','../../config/environment','exports','define','UserOpenchannelQueue','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x8fb92c,_0x22f31c){var _0x256658=function(_0x3743a4){while(--_0x3743a4){_0x8fb92c['push'](_0x8fb92c['shift']());}};_0x256658(++_0x22f31c);}(_0x8eb2,0x1e6));var _0x28eb=function(_0x579772,_0x5e0bbb){_0x579772=_0x579772-0x0;var _0x5831ce=_0x8eb2[_0x579772];return _0x5831ce;};'use strict';var _=require(_0x28eb('0x0'));var util=require(_0x28eb('0x1'));var logger=require(_0x28eb('0x2'))(_0x28eb('0x3'));var moment=require(_0x28eb('0x4'));var BPromise=require(_0x28eb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x28eb('0x6'));var rimraf=require(_0x28eb('0x7'));var config=require(_0x28eb('0x8'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x28eb('0x9')]=function(_0x4687c8,_0x2b82b3){return _0x4687c8[_0x28eb('0xa')](_0x28eb('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdace=['../../config/logger','api','moment','bluebird','request-promise','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x51c3fd,_0x49eedb){var _0x4c0399=function(_0x4c8db2){while(--_0x4c8db2){_0x51c3fd['push'](_0x51c3fd['shift']());}};_0x4c0399(++_0x49eedb);}(_0xdace,0x128));var _0xedac=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xdace[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require(_0xedac('0x4'));var rp=require(_0xedac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xedac('0x6'));module[_0xedac('0x7')]=function(_0x2845e9,_0x22430b){return _0x2845e9[_0xedac('0x8')](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 118f260..4d1783f 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 _0x2d70=['code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x169a50,_0xedbb28){var _0x31e1c9=function(_0x1747c3){while(--_0x1747c3){_0x169a50['push'](_0x169a50['shift']());}};_0x31e1c9(++_0xedbb28);}(_0x2d70,0x1be));var _0x02d7=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x2d70[_0x21353c];return _0xa99120;};'use strict';var _=require('lodash');var util=require(_0x02d7('0x0'));var moment=require(_0x02d7('0x1'));var BPromise=require(_0x02d7('0x2'));var rs=require(_0x02d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02d7('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x02d7('0x5'));var jayson=require(_0x02d7('0x6'));var client=jayson[_0x02d7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x210c4b,_0x4961d5,_0x5c3ab8){return new BPromise(function(_0x43b8e3,_0x1d7ed3){return client[_0x02d7('0x8')](_0x210c4b,_0x5c3ab8)[_0x02d7('0x9')](function(_0xf4a1ee){logger[_0x02d7('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4961d5,_0x02d7('0xb'));logger[_0x02d7('0xc')](_0x02d7('0xd'),_0x4961d5,_0x02d7('0xb'),JSON[_0x02d7('0xe')](_0xf4a1ee));if(_0xf4a1ee[_0x02d7('0xf')]){if(_0xf4a1ee[_0x02d7('0xf')][_0x02d7('0x10')]===0x1f4){logger[_0x02d7('0xf')](_0x02d7('0x11'),_0x4961d5,_0xf4a1ee['error'][_0x02d7('0x12')]);return _0x1d7ed3(_0xf4a1ee[_0x02d7('0xf')][_0x02d7('0x12')]);}logger['error'](_0x02d7('0x11'),_0x4961d5,_0xf4a1ee[_0x02d7('0xf')]['message']);return _0x43b8e3(_0xf4a1ee[_0x02d7('0xf')][_0x02d7('0x12')]);}else{logger[_0x02d7('0xa')](_0x02d7('0x11'),_0x4961d5,_0x02d7('0xb'));_0x43b8e3(_0xf4a1ee[_0x02d7('0x13')][_0x02d7('0x12')]);}})[_0x02d7('0x14')](function(_0x100afe){logger[_0x02d7('0xf')](_0x02d7('0x11'),_0x4961d5,_0x100afe);_0x1d7ed3(_0x100afe);});});} \ No newline at end of file +var _0x4e07=['message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s'];(function(_0x487f22,_0x2cc035){var _0x5b8880=function(_0x3cdd0f){while(--_0x3cdd0f){_0x487f22['push'](_0x487f22['shift']());}};_0x5b8880(++_0x2cc035);}(_0x4e07,0x1a6));var _0x74e0=function(_0x4f45a7,_0x3fd30f){_0x4f45a7=_0x4f45a7-0x0;var _0x120c93=_0x4e07[_0x4f45a7];return _0x120c93;};'use strict';var _=require(_0x74e0('0x0'));var util=require('util');var moment=require(_0x74e0('0x1'));var BPromise=require(_0x74e0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74e0('0x3'));var db=require(_0x74e0('0x4'))['db'];var utils=require(_0x74e0('0x5'));var logger=require('../../config/logger')(_0x74e0('0x6'));var config=require(_0x74e0('0x7'));var jayson=require(_0x74e0('0x8'));var client=jayson[_0x74e0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d8d51,_0x23a939,_0x1a5840){return new BPromise(function(_0xf704f4,_0x278b51){return client[_0x74e0('0xa')](_0x3d8d51,_0x1a5840)[_0x74e0('0xb')](function(_0x1d3b39){logger[_0x74e0('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x23a939,'request\x20sent');logger[_0x74e0('0xd')](_0x74e0('0xe'),_0x23a939,_0x74e0('0xf'),JSON[_0x74e0('0x10')](_0x1d3b39));if(_0x1d3b39['error']){if(_0x1d3b39[_0x74e0('0x11')]['code']===0x1f4){logger[_0x74e0('0x11')](_0x74e0('0x12'),_0x23a939,_0x1d3b39[_0x74e0('0x11')][_0x74e0('0x13')]);return _0x278b51(_0x1d3b39['error'][_0x74e0('0x13')]);}logger[_0x74e0('0x11')](_0x74e0('0x12'),_0x23a939,_0x1d3b39[_0x74e0('0x11')]['message']);return _0xf704f4(_0x1d3b39[_0x74e0('0x11')][_0x74e0('0x13')]);}else{logger[_0x74e0('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x23a939,'request\x20sent');_0xf704f4(_0x1d3b39[_0x74e0('0x14')][_0x74e0('0x13')]);}})['catch'](function(_0x352ace){logger[_0x74e0('0x11')](_0x74e0('0x12'),_0x23a939,_0x352ace);_0x278b51(_0x352ace);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index bf5b755..9fe4705 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 _0x0e78=['delete','removeSections','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./userProfile.controller','index','get','/describe','isAuthenticated','describe','/:id','/:id/sections','getSections','/:id/resources','post','/:id/clone','clone','addSections','addResources','put','update','destroy'];(function(_0x2c0d38,_0x1e3cfb){var _0x4d2a78=function(_0xbeb60a){while(--_0xbeb60a){_0x2c0d38['push'](_0x2c0d38['shift']());}};_0x4d2a78(++_0x1e3cfb);}(_0x0e78,0x17d));var _0x80e7=function(_0xd71a75,_0x51afd3){_0xd71a75=_0xd71a75-0x0;var _0x278bf9=_0x0e78[_0xd71a75];return _0x278bf9;};'use strict';var multer=require('multer');var util=require(_0x80e7('0x0'));var path=require(_0x80e7('0x1'));var timeout=require(_0x80e7('0x2'));var express=require(_0x80e7('0x3'));var router=express['Router']();var auth=require(_0x80e7('0x4'));var interaction=require(_0x80e7('0x5'));var config=require('../../config/environment');var controller=require(_0x80e7('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x80e7('0x7')]);router[_0x80e7('0x8')](_0x80e7('0x9'),auth[_0x80e7('0xa')](),controller[_0x80e7('0xb')]);router[_0x80e7('0x8')](_0x80e7('0xc'),auth[_0x80e7('0xa')](),controller['show']);router[_0x80e7('0x8')](_0x80e7('0xd'),auth[_0x80e7('0xa')](),controller[_0x80e7('0xe')]);router[_0x80e7('0x8')](_0x80e7('0xf'),auth[_0x80e7('0xa')](),controller['getResources']);router[_0x80e7('0x10')]('/',auth[_0x80e7('0xa')](),controller['create']);router[_0x80e7('0x10')](_0x80e7('0x11'),auth[_0x80e7('0xa')](),controller[_0x80e7('0x12')]);router['post'](_0x80e7('0xd'),auth[_0x80e7('0xa')](),controller[_0x80e7('0x13')]);router[_0x80e7('0x10')](_0x80e7('0xf'),auth[_0x80e7('0xa')](),controller[_0x80e7('0x14')]);router[_0x80e7('0x15')](_0x80e7('0xc'),auth['isAuthenticated'](),controller[_0x80e7('0x16')]);router['delete']('/:id',auth[_0x80e7('0xa')](),controller[_0x80e7('0x17')]);router[_0x80e7('0x18')](_0x80e7('0xd'),auth[_0x80e7('0xa')](),controller[_0x80e7('0x19')]);router[_0x80e7('0x18')](_0x80e7('0xf'),auth[_0x80e7('0xa')](),controller['removeResources']);module[_0x80e7('0x1a')]=router; \ No newline at end of file +var _0x333a=['/:id/sections','addSections','addResources','/:id','update','delete','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','index','get','/describe','isAuthenticated','show','getSections','/:id/resources','getResources','post','/:id/clone','clone'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x333a,0x159));var _0xa333=function(_0x275277,_0x1d705f){_0x275277=_0x275277-0x0;var _0x416c13=_0x333a[_0x275277];return _0x416c13;};'use strict';var multer=require(_0xa333('0x0'));var util=require(_0xa333('0x1'));var path=require('path');var timeout=require(_0xa333('0x2'));var express=require(_0xa333('0x3'));var router=express[_0xa333('0x4')]();var auth=require(_0xa333('0x5'));var interaction=require(_0xa333('0x6'));var config=require('../../config/environment');var controller=require(_0xa333('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa333('0x8')]);router[_0xa333('0x9')](_0xa333('0xa'),auth[_0xa333('0xb')](),controller['describe']);router[_0xa333('0x9')]('/:id',auth[_0xa333('0xb')](),controller[_0xa333('0xc')]);router[_0xa333('0x9')]('/:id/sections',auth[_0xa333('0xb')](),controller[_0xa333('0xd')]);router[_0xa333('0x9')](_0xa333('0xe'),auth['isAuthenticated'](),controller[_0xa333('0xf')]);router['post']('/',auth[_0xa333('0xb')](),controller['create']);router[_0xa333('0x10')](_0xa333('0x11'),auth['isAuthenticated'](),controller[_0xa333('0x12')]);router['post'](_0xa333('0x13'),auth[_0xa333('0xb')](),controller[_0xa333('0x14')]);router[_0xa333('0x10')](_0xa333('0xe'),auth[_0xa333('0xb')](),controller[_0xa333('0x15')]);router['put'](_0xa333('0x16'),auth[_0xa333('0xb')](),controller[_0xa333('0x17')]);router['delete'](_0xa333('0x16'),auth[_0xa333('0xb')](),controller['destroy']);router[_0xa333('0x18')](_0xa333('0x13'),auth['isAuthenticated'](),controller[_0xa333('0x19')]);router[_0xa333('0x18')](_0xa333('0xe'),auth['isAuthenticated'](),controller[_0xa333('0x1a')]);module[_0xa333('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index a2bd049..42183e9 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 _0xcc5e=['name','setDataValue','crudPermissions','getDataValue','split','sequelize','STRING'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xcc5e,0x12b));var _0xecc5=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0xcc5e[_0xa2c0a3];return _0x52c618;};'use strict';var Sequelize=require(_0xecc5('0x0'));module['exports']={'name':{'type':Sequelize[_0xecc5('0x1')],'allowNull':![],'unique':_0xecc5('0x2')},'crudPermissions':{'type':Sequelize[_0xecc5('0x1')],'set':function(_0x7511fa){this[_0xecc5('0x3')](_0xecc5('0x4'),_0x7511fa?_0x7511fa['join'](''):[]);},'get':function(){return this[_0xecc5('0x5')](_0xecc5('0x4'))?this[_0xecc5('0x5')](_0xecc5('0x4'))[_0xecc5('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xecc5('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x17b6=['exports','setDataValue','crudPermissions','join','getDataValue','split','STRING','sequelize'];(function(_0x761684,_0x2caf55){var _0x587e0d=function(_0xddb7cd){while(--_0xddb7cd){_0x761684['push'](_0x761684['shift']());}};_0x587e0d(++_0x2caf55);}(_0x17b6,0xf7));var _0x617b=function(_0x311057,_0x24d850){_0x311057=_0x311057-0x0;var _0x9b59fc=_0x17b6[_0x311057];return _0x9b59fc;};'use strict';var Sequelize=require(_0x617b('0x0'));module[_0x617b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5c2ad9){this[_0x617b('0x2')](_0x617b('0x3'),_0x5c2ad9?_0x5c2ad9[_0x617b('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x617b('0x3'))?this[_0x617b('0x5')]('crudPermissions')[_0x617b('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x617b('0x7')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 1e5e10a..a97a5b9 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 _0x903b=['model','map','query','filters','intersection','fields','attributes','length','limit','order','sort','where','filter','merge','VIRTUAL','options','UserProfile','includeAll','rows','catch','show','params','keys','include','find','create','body','clone','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','findAll','sectionId','userProfileId','update','describe','addSections','sequelize','UserProfileResource','Resources','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','union','hasOwnProperty','type','field','AnalyticExtractedReport','foreignKey','associatedResources','default','reportId','custom','CustomReports','CmContact','Tag','Tags','tag','ThroughTags','value','toLowerCase','odbc','SquareOdbc','squarerecordings','SquareProjects','projectName','JscriptyProject','Lists','ListId','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueue','QueueCampaigns','queue','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','WhatsappAccount','Team','voicequeues','VoiceQueues','users','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','intervals','Interval','Pause','scheduler','sounds','Sound','triggers','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','end','status','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','rawAttributes','fieldName','key'];(function(_0x3bb9da,_0x502962){var _0x17eef7=function(_0x94c254){while(--_0x94c254){_0x3bb9da['push'](_0x3bb9da['shift']());}};_0x17eef7(++_0x502962);}(_0x903b,0x19d));var _0xb903=function(_0x4f966a,_0x22d73b){_0x4f966a=_0x4f966a-0x0;var _0x31993d=_0x903b[_0x4f966a];return _0x31993d;};'use strict';var pdf=require(_0xb903('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb903('0x1'));var jsonpatch=require(_0xb903('0x2'));var rp=require(_0xb903('0x3'));var moment=require('moment');var BPromise=require(_0xb903('0x4'));var Mustache=require(_0xb903('0x5'));var util=require('util');var path=require(_0xb903('0x6'));var sox=require(_0xb903('0x7'));var csv=require(_0xb903('0x8'));var ejs=require(_0xb903('0x9'));var fs=require('fs');var _=require(_0xb903('0xa'));var squel=require(_0xb903('0xb'));var crypto=require(_0xb903('0xc'));var jsforce=require(_0xb903('0xd'));var deskjs=require(_0xb903('0xe'));var toCsv=require(_0xb903('0x8'));var querystring=require(_0xb903('0xf'));var Papa=require('papaparse');var Redis=require(_0xb903('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb903('0x11'));var as=require(_0xb903('0x12'));var hardwareService=require(_0xb903('0x13'));var logger=require(_0xb903('0x14'))(_0xb903('0x15'));var utils=require(_0xb903('0x16'));var config=require(_0xb903('0x17'));var licenseUtil=require(_0xb903('0x18'));var db=require(_0xb903('0x19'))['db'];config[_0xb903('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb903('0x1b'))(new Redis(config[_0xb903('0x1a')]));require(_0xb903('0x1c'))['register'](socket);function respondWithStatusCode(_0x51c260,_0x44129b){_0x44129b=_0x44129b||0xcc;return function(_0x1ae72d){if(_0x1ae72d){return _0x51c260['sendStatus'](_0x44129b);}return _0x51c260['status'](_0x44129b)[_0xb903('0x1d')]();};}function respondWithResult(_0x3c4666,_0x46d0e1){_0x46d0e1=_0x46d0e1||0xc8;return function(_0x16c505){if(_0x16c505){return _0x3c4666[_0xb903('0x1e')](_0x46d0e1)['json'](_0x16c505);}};}function respondWithFilteredResult(_0x47db7,_0x1a3ead){return function(_0x35620d){if(_0x35620d){var _0x1f6f13=_0x35620d[_0xb903('0x1f')],_0xf065f8=_0x1a3ead[_0xb903('0x20')],_0x331471=_0x1a3ead[_0xb903('0x20')]+_0x1a3ead['limit'],_0x407660;if(_0x331471>=_0x1f6f13){_0x331471=_0x1f6f13;_0x407660=0xc8;}else{_0x407660=0xce;}_0x47db7[_0xb903('0x1e')](_0x407660);return _0x47db7[_0xb903('0x21')](_0xb903('0x22'),_0xf065f8+'-'+_0x331471+'/'+_0x1f6f13)[_0xb903('0x23')](_0x35620d);}return null;};}function patchUpdates(_0x43b0c8){return function(_0x5878dd){try{jsonpatch[_0xb903('0x24')](_0x5878dd,_0x43b0c8,!![]);}catch(_0x447b71){return BPromise[_0xb903('0x25')](_0x447b71);}return _0x5878dd[_0xb903('0x26')]();};}function saveUpdates(_0x457cbf,_0x24f812){return function(_0x2495d9){if(_0x2495d9){return _0x2495d9['update'](_0x457cbf)[_0xb903('0x27')](function(_0x412110){return _0x412110;});}return null;};}function removeEntity(_0x1da009,_0x102f9d){return function(_0x1ced64){if(_0x1ced64){return _0x1ced64[_0xb903('0x28')]()[_0xb903('0x27')](function(){_0x1da009[_0xb903('0x1e')](0xcc)[_0xb903('0x1d')]();});}};}function handleEntityNotFound(_0x390ec3,_0x51a723){return function(_0xe180b7){if(!_0xe180b7){_0x390ec3[_0xb903('0x29')](0x194);}return _0xe180b7;};}function handleError(_0x44832f,_0xc138c3){_0xc138c3=_0xc138c3||0x1f4;return function(_0x383ca2){logger[_0xb903('0x2a')](_0x383ca2[_0xb903('0x2b')]);if(_0x383ca2[_0xb903('0x2c')]){delete _0x383ca2[_0xb903('0x2c')];}_0x44832f[_0xb903('0x1e')](_0xc138c3)['send'](_0x383ca2);};}exports[_0xb903('0x2d')]=function(_0x1ea7c5,_0x49a83b){var _0x50e384={},_0x4ef46c={},_0x420e03={'count':0x0,'rows':[]};var _0x71fd1e=_['map'](db['UserProfile'][_0xb903('0x2e')],function(_0xac22cd){return{'name':_0xac22cd[_0xb903('0x2f')],'type':_0xac22cd['type'][_0xb903('0x30')]};});_0x4ef46c[_0xb903('0x31')]=_[_0xb903('0x32')](_0x71fd1e,_0xb903('0x2c'));_0x4ef46c[_0xb903('0x33')]=_['keys'](_0x1ea7c5['query']);_0x4ef46c[_0xb903('0x34')]=_[_0xb903('0x35')](_0x4ef46c[_0xb903('0x31')],_0x4ef46c['query']);_0x50e384['attributes']=_[_0xb903('0x35')](_0x4ef46c[_0xb903('0x31')],qs[_0xb903('0x36')](_0x1ea7c5[_0xb903('0x33')][_0xb903('0x36')]));_0x50e384[_0xb903('0x37')]=_0x50e384[_0xb903('0x37')][_0xb903('0x38')]?_0x50e384[_0xb903('0x37')]:_0x4ef46c['model'];if(!_0x1ea7c5[_0xb903('0x33')]['hasOwnProperty']('nolimit')){_0x50e384[_0xb903('0x39')]=qs[_0xb903('0x39')](_0x1ea7c5[_0xb903('0x33')][_0xb903('0x39')]);_0x50e384['offset']=qs['offset'](_0x1ea7c5[_0xb903('0x33')]['offset']);}_0x50e384[_0xb903('0x3a')]=qs['sort'](_0x1ea7c5['query'][_0xb903('0x3b')]);_0x50e384[_0xb903('0x3c')]=qs[_0xb903('0x34')](_['pick'](_0x1ea7c5[_0xb903('0x33')],_0x4ef46c[_0xb903('0x34')]),_0x71fd1e);if(_0x1ea7c5[_0xb903('0x33')][_0xb903('0x3d')]){_0x50e384[_0xb903('0x3c')]=_[_0xb903('0x3e')](_0x50e384[_0xb903('0x3c')],{'$or':_[_0xb903('0x32')](_0x71fd1e,function(_0x4c3232){if(_0x4c3232['type']!==_0xb903('0x3f')){var _0x369cb7={};_0x369cb7[_0x4c3232['name']]={'$like':'%'+_0x1ea7c5[_0xb903('0x33')][_0xb903('0x3d')]+'%'};return _0x369cb7;}})});}_0x50e384=_[_0xb903('0x3e')]({},_0x50e384,_0x1ea7c5[_0xb903('0x40')]);var _0x29f3cf={'where':_0x50e384[_0xb903('0x3c')]};return db[_0xb903('0x41')][_0xb903('0x1f')](_0x29f3cf)['then'](function(_0x27bebf){_0x420e03[_0xb903('0x1f')]=_0x27bebf;if(_0x1ea7c5[_0xb903('0x33')][_0xb903('0x42')]){_0x50e384['include']=[{'all':!![]}];}return db[_0xb903('0x41')]['findAll'](_0x50e384);})[_0xb903('0x27')](function(_0xed3a95){_0x420e03[_0xb903('0x43')]=_0xed3a95;return _0x420e03;})[_0xb903('0x27')](respondWithFilteredResult(_0x49a83b,_0x50e384))[_0xb903('0x44')](handleError(_0x49a83b,null));};exports[_0xb903('0x45')]=function(_0x413a71,_0x82c81d){var _0x146b52={'raw':![],'where':{'id':_0x413a71[_0xb903('0x46')]['id']}},_0x2789e6={};_0x2789e6[_0xb903('0x31')]=_[_0xb903('0x47')](db['UserProfile'][_0xb903('0x2e')]);_0x2789e6[_0xb903('0x33')]=_[_0xb903('0x47')](_0x413a71[_0xb903('0x33')]);_0x2789e6[_0xb903('0x34')]=_[_0xb903('0x35')](_0x2789e6[_0xb903('0x31')],_0x2789e6[_0xb903('0x33')]);_0x146b52[_0xb903('0x37')]=_[_0xb903('0x35')](_0x2789e6[_0xb903('0x31')],qs[_0xb903('0x36')](_0x413a71['query'][_0xb903('0x36')]));_0x146b52[_0xb903('0x37')]=_0x146b52[_0xb903('0x37')][_0xb903('0x38')]?_0x146b52['attributes']:_0x2789e6[_0xb903('0x31')];if(_0x413a71['query'][_0xb903('0x42')]){_0x146b52[_0xb903('0x48')]=[{'all':!![]}];}_0x146b52=_['merge']({},_0x146b52,_0x413a71['options']);return db['UserProfile'][_0xb903('0x49')](_0x146b52)[_0xb903('0x27')](handleEntityNotFound(_0x82c81d,null))['then'](respondWithResult(_0x82c81d,null))[_0xb903('0x44')](handleError(_0x82c81d,null));};exports['create']=function(_0x5f0d29,_0x3ce02c){return db[_0xb903('0x41')][_0xb903('0x4a')](_0x5f0d29[_0xb903('0x4b')],{})['then'](respondWithResult(_0x3ce02c,0xc9))[_0xb903('0x44')](handleError(_0x3ce02c,null));};exports[_0xb903('0x4c')]=function(_0x5a2e00,_0x2b52ba){var _0x191245={'where':{'id':_0x5a2e00[_0xb903('0x46')]['id']}},_0x52ab03={};_0x52ab03[_0xb903('0x31')]=_[_0xb903('0x47')](db['UserProfile'][_0xb903('0x2e')]);_0x191245[_0xb903('0x37')]=_[_0xb903('0x35')](_0x52ab03['model'],qs[_0xb903('0x36')](_0x5a2e00['query']['fields']));_0x191245[_0xb903('0x37')]=_0x191245[_0xb903('0x37')][_0xb903('0x38')]?_0x191245[_0xb903('0x37')]:_0x52ab03[_0xb903('0x31')];if(_0x5a2e00[_0xb903('0x33')][_0xb903('0x42')]){_0x191245[_0xb903('0x48')]=[{'all':!![]}];}_0x191245=_[_0xb903('0x3e')]({},_0x191245,_0x5a2e00[_0xb903('0x40')]);return db['UserProfile'][_0xb903('0x49')](_0x191245)[_0xb903('0x27')](handleEntityNotFound(_0x2b52ba,null))['then'](function(_0xb6b973){if(_0xb6b973){var _0x525de2=_0xb6b973[_0xb903('0x4d')]({'plain':!![]});_0x525de2=qs[_0xb903('0x4e')](_0x525de2,['id','createdAt',_0xb903('0x4f'),_0xb903('0x50')]);_0x5a2e00[_0xb903('0x4b')]=_['omit'](_0x5a2e00[_0xb903('0x4b')],['id',_0xb903('0x51'),_0xb903('0x4f')]);return db['sequelize'][_0xb903('0x52')](function(_0x370d9f){return db[_0xb903('0x41')][_0xb903('0x4a')](_[_0xb903('0x3e')](_0x525de2,_0x5a2e00[_0xb903('0x4b')]),{'include':_0x5a2e00[_0xb903('0x33')][_0xb903('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x370d9f})[_0xb903('0x27')](function(_0x22b4b0){var _0x5d077a=_0x22b4b0[_0xb903('0x4d')]({'plain':!![]});return db[_0xb903('0x53')]['findAll']({'where':{'userProfileId':_0x5a2e00['params']['id']},'raw':!![]})[_0xb903('0x27')](function(_0x13e58e){if(_0x13e58e){return BPromise[_0xb903('0x54')](_0x13e58e,function(_0x2976df){return new BPromise(function(_0xbf3fd1,_0x17f8b5){if(_0x2976df[_0xb903('0x55')]===null||_0x2976df['autoAssociation']===0x1)_0xbf3fd1(null);return db['UserProfileResource'][_0xb903('0x56')]({'where':{'sectionId':_0x2976df['id']},'raw':!![]})[_0xb903('0x27')](function(_0x3ff8b0){var _0x5a2de6=_['map'](_0x3ff8b0,function(_0x41d109){return qs[_0xb903('0x4e')](_0x41d109,['id',_0xb903('0x51'),'updatedAt',_0xb903('0x57')]);});_0xbf3fd1(_0x5a2de6);})['catch'](function(_0x5deccd){_0x17f8b5(_0x5deccd);});})['then'](function(_0x463b62){var _0x51ba76=qs[_0xb903('0x4e')](_0x2976df,['id','createdAt','updatedAt']);_0x51ba76[_0xb903('0x58')]=_0x5d077a['id'];if(_0x463b62)_0x51ba76['Resources']=_0x463b62;return _0x51ba76;})[_0xb903('0x27')](function(_0x1eba62){return db[_0xb903('0x53')][_0xb903('0x4a')](_0x1eba62,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x370d9f});});})['then'](function(){return _0x5d077a;});}});});});}})[_0xb903('0x27')](respondWithResult(_0x2b52ba,0xc9))[_0xb903('0x44')](handleError(_0x2b52ba,null));};exports[_0xb903('0x59')]=function(_0x5d863e,_0x1ebb7a){if(_0x5d863e[_0xb903('0x4b')]['id']){delete _0x5d863e['body']['id'];}return db[_0xb903('0x41')][_0xb903('0x49')]({'where':{'id':_0x5d863e[_0xb903('0x46')]['id']}})[_0xb903('0x27')](handleEntityNotFound(_0x1ebb7a,null))[_0xb903('0x27')](saveUpdates(_0x5d863e['body'],null))['then'](respondWithResult(_0x1ebb7a,null))[_0xb903('0x44')](handleError(_0x1ebb7a,null));};exports[_0xb903('0x28')]=function(_0x5da914,_0x518e77){return db[_0xb903('0x41')][_0xb903('0x49')]({'where':{'id':_0x5da914[_0xb903('0x46')]['id']}})['then'](handleEntityNotFound(_0x518e77,null))[_0xb903('0x27')](removeEntity(_0x518e77,null))[_0xb903('0x44')](handleError(_0x518e77,null));};exports[_0xb903('0x5a')]=function(_0x39eea5,_0x27ac0f){return db[_0xb903('0x41')][_0xb903('0x5a')]()['then'](respondWithResult(_0x27ac0f,null))['catch'](handleError(_0x27ac0f,null));};exports[_0xb903('0x5b')]=function(_0x24b30d,_0xa8ff01){var _0x1adbd6=_0x24b30d[_0xb903('0x4b')];return db[_0xb903('0x41')][_0xb903('0x49')]({'where':{'id':_0x24b30d['params']['id']}})['then'](handleEntityNotFound(_0xa8ff01,null))['then'](function(_0x12b2b3){if(_0x12b2b3){return db[_0xb903('0x5c')][_0xb903('0x52')](function(_0x1061a7){return db[_0xb903('0x53')]['destroy']({'where':{'userProfileId':_0x24b30d['params']['id'],'sectionId':_[_0xb903('0x32')](_0x1adbd6,function(_0x554dca){return _0x554dca[_0xb903('0x57')];})},'transaction':_0x1061a7})['then'](function(){var _0x42f002=_[_0xb903('0x32')](_0x1adbd6,function(_0x56e1ca){_0x56e1ca[_0xb903('0x58')]=_0x24b30d['params']['id'];return _0x56e1ca;});var _0x58f68b=[];return BPromise['each'](_0x42f002,function(_0x31ff86){return db[_0xb903('0x53')][_0xb903('0x4a')](_0x31ff86,{'include':[{'model':db[_0xb903('0x5d')],'as':_0xb903('0x5e')}],'raw':!![],'transaction':_0x1061a7})[_0xb903('0x27')](function(_0x58285d){_0x58f68b['push'](_0x58285d[_0xb903('0x4d')]({'plain':!![]}));});})[_0xb903('0x27')](function(){return _0x58f68b;});});});}})[_0xb903('0x27')](function(_0x14dfd9){return _0x14dfd9;})[_0xb903('0x27')](respondWithResult(_0xa8ff01,null))['catch'](handleError(_0xa8ff01,null));};exports[_0xb903('0x5f')]=function(_0x1cf03f,_0x81413a){var _0x2d00cd;return db[_0xb903('0x41')]['find']({'where':{'id':_0x1cf03f[_0xb903('0x46')]['id']},'attributes':['id',_0xb903('0x2c')]})[_0xb903('0x27')](handleEntityNotFound(_0x81413a,null))[_0xb903('0x27')](function(_0x578d0c){if(_0x578d0c){_0x2d00cd=_0x578d0c;return db[_0xb903('0x53')]['destroy']({'where':{'userProfileId':_0x1cf03f[_0xb903('0x46')]['id'],'sectionId':_0x1cf03f[_0xb903('0x33')][_0xb903('0x60')]}});}})[_0xb903('0x27')](function(){return _0x2d00cd;})[_0xb903('0x27')](respondWithStatusCode(_0x81413a,null))[_0xb903('0x44')](handleError(_0x81413a,null));};exports[_0xb903('0x61')]=function(_0x7a21e3,_0x324945){var _0x2911b9=[];var _0x44974e=[];return db[_0xb903('0x53')][_0xb903('0x56')]({'where':{'userProfileId':_0x7a21e3[_0xb903('0x46')]['id']},'raw':!![]})['then'](function(_0x18e2d6){_0x2911b9=_['filter'](_0x18e2d6,function(_0x605016){return _0x605016[_0xb903('0x62')]===0x1||_['includes']([0x3eb,0x709],_0x605016[_0xb903('0x57')]);});if(!_[_0xb903('0x63')](_0x2911b9)){return _['map'](_0x2911b9,function(_0x3cae79){return _0x3cae79[_0xb903('0x57')];});}else{return;}})[_0xb903('0x27')](function(_0x110d0a){if(_0x110d0a)_0x44974e=_0x110d0a;if(_[_0xb903('0x64')](_0x44974e,0x64)){var _0x2c4276=_[_0xb903('0x49')](_0x2911b9,{'sectionId':0x64});return hasDefaultDashboard(_0x2c4276)['then'](function(_0x1b3e52){return _[_0xb903('0x32')](_0x2911b9,function(_0x49aa0b){if(_0x49aa0b[_0xb903('0x57')]===0x64){_0x49aa0b['subsections']=_0x1b3e52;}return _0x49aa0b;});});}else{return;}})[_0xb903('0x27')](function(_0x5bab41){if(_0x5bab41)_0x2911b9=_0x5bab41;if(_[_0xb903('0x64')](_0x44974e,0x3eb)){var _0x595694=_[_0xb903('0x49')](_0x2911b9,{'sectionId':0x3eb});return getCustomDashboards(_0x595694)[_0xb903('0x27')](function(_0x516da1){return _[_0xb903('0x32')](_0x2911b9,function(_0x143356){if(_0x595694[_0xb903('0x62')]){if(_0x143356[_0xb903('0x57')]===0x3eb){_0x143356[_0xb903('0x65')]=_0x516da1;}}else{if(_0x143356[_0xb903('0x57')]===0x64){_0x143356[_0xb903('0x65')]=_0x516da1;}}return _0x143356;});});}else{return;}})['then'](function(_0xe7653){if(_0xe7653)_0x2911b9=_0xe7653;if(_[_0xb903('0x64')](_0x44974e,0x709)){var _0x3fa319=_[_0xb903('0x49')](_0x2911b9,{'sectionId':0x709});return getPlugins(_0x3fa319)[_0xb903('0x27')](function(_0x4bfd52){if(_0x3fa319[_0xb903('0x62')]){return _['map'](_0x2911b9,function(_0x246042){if(_0x246042['sectionId']===0x709){_0x246042[_0xb903('0x65')]=_0x4bfd52;}return _0x246042;});}else{var _0x2bea5e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4bfd52};var _0x4f01c3=_['map'](_0x2911b9);_0x4f01c3[_0xb903('0x66')](_0x2bea5e);return _0x4f01c3;}});}else{return;}})['then'](function(_0x5c0866){if(_0x5c0866)_0x2911b9=_0x5c0866;return _[_0xb903('0x3d')](_0x2911b9,[_0xb903('0x62'),0x1]);})[_0xb903('0x27')](respondWithResult(_0x324945,null))[_0xb903('0x44')](handleError(_0x324945,null));};function hasDefaultDashboard(_0x3ea500){var _0x575931=[0x65];return new BPromise(function(_0x3ac47a,_0x43a062){try{if(_0x3ea500[_0xb903('0x55')]){_0x3ac47a(_0x575931);}else{return db[_0xb903('0x5d')][_0xb903('0x67')]({'where':{'sectionId':_0x3ea500['id']},'raw':!![]})[_0xb903('0x27')](function(_0x3dcda3){_0x3dcda3?_0x3ac47a(_0x575931):_0x3ac47a();});}}catch(_0x2ad614){_0x43a062(_0x2ad614);}});}function getCustomDashboards(_0x5ac87a){var _0x4f86a8=[];return new BPromise(function(_0x2ca068,_0x1e5553){try{if(_0x5ac87a[_0xb903('0x55')]){return db[_0xb903('0x68')][_0xb903('0x56')]({'raw':!![]})['then'](function(_0x54499a){_0x54499a[_0xb903('0x69')](function(_0x4415c6){_0x4f86a8[_0xb903('0x66')](_0x4415c6['id']+0x1869f);});_0x2ca068(_0x4f86a8);});}else{return db[_0xb903('0x5d')][_0xb903('0x56')]({'where':{'sectionId':_0x5ac87a['id']},'raw':!![]})[_0xb903('0x27')](function(_0x41c2c1){_0x41c2c1[_0xb903('0x69')](function(_0x4c1f0e){_0x4f86a8[_0xb903('0x66')](_0x4c1f0e[_0xb903('0x6a')]+0x1869f);});_0x2ca068(_0x4f86a8);});}}catch(_0x157bd5){_0x1e5553(_0x157bd5);}});}function getPlugins(_0x3a9368){var _0x22c9ef=[];return new BPromise(function(_0x14984f,_0xcdca58){try{if(_0x3a9368[_0xb903('0x55')]){return db[_0xb903('0x6b')][_0xb903('0x56')]({'raw':!![]})[_0xb903('0x27')](function(_0x4b8468){_0x4b8468['forEach'](function(_0x3a33c2){_0x22c9ef[_0xb903('0x66')](_0x3a33c2['id']+0x15b38);});_0x14984f(_0x22c9ef);});}else{return db[_0xb903('0x5d')]['findAll']({'where':{'sectionId':_0x3a9368['id']},'raw':!![]})['then'](function(_0x46dc54){_0x46dc54[_0xb903('0x69')](function(_0x4c72c1){_0x22c9ef[_0xb903('0x66')](_0x4c72c1[_0xb903('0x6a')]+0x15b38);});_0x14984f(_0x22c9ef);});}}catch(_0xf00b65){_0xcdca58(_0xf00b65);}});}exports[_0xb903('0x6c')]=function(_0x4d56bf,_0x560d5a){return db[_0xb903('0x41')]['find']({'where':{'id':_0x4d56bf['params']['id']}})[_0xb903('0x27')](handleEntityNotFound(_0x560d5a,null))[_0xb903('0x27')](function(_0x485a1a){if(_0x485a1a){return db[_0xb903('0x5c')][_0xb903('0x52')](function(_0x278d8d){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x4d56bf[_0xb903('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0xb903('0x27')](function(_0x3afe3d){if(_0x3afe3d){return db['UserProfileSection'][_0xb903('0x28')]({'where':{'userProfileId':_0x4d56bf['params']['id'],'id':_['map'](_0x3afe3d,function(_0x2f67d7){return _0x2f67d7['id'];})},'transaction':_0x278d8d});}})[_0xb903('0x27')](function(_0x34683f){var _0x34b1d4=_['map'](_0x4d56bf['body'],function(_0x4155e3){_0x4155e3[_0xb903('0x58')]=_0x4d56bf['params']['id'];return _0x4155e3;});return db[_0xb903('0x53')][_0xb903('0x6d')](_0x34b1d4,{'raw':!![],'transaction':_0x278d8d});})[_0xb903('0x27')](function(_0x4038c5){var _0x18c225=_[_0xb903('0x3d')](_[_0xb903('0x32')](_0x4038c5,function(_0xed83c8){return _0xed83c8[_0xb903('0x4d')]({'plain':!![]});}),{'includeAll':![]});if(_0x18c225){return db[_0xb903('0x53')][_0xb903('0x56')]({'where':{'userProfileId':_0x4d56bf[_0xb903('0x46')]['id'],'sectionId':_[_0xb903('0x32')](_0x18c225,function(_0xe23da2){return _0xe23da2['sectionId'];})},'attributes':['id',_0xb903('0x57')],'raw':!![]})[_0xb903('0x27')](function(_0x421cfc){var _0x25208e=_[_0xb903('0x32')](_0x4d56bf[_0xb903('0x4b')],function(_0x1e8528){_0x1e8528[_0xb903('0x58')]=_0x4d56bf['params']['id'];return _0x1e8528;});return db[_0xb903('0x5d')][_0xb903('0x6d')](_0x25208e,{'raw':!![],'transaction':_0x278d8d});});}})[_0xb903('0x44')](handleError(_0x560d5a,null));});}})[_0xb903('0x27')](function(_0xc2d2bf){var _0x28176f=_[_0xb903('0x32')](_0xc2d2bf,function(_0x203da2){return _0x203da2['get']({'plain':!![]});});})['then'](respondWithResult(_0x560d5a,null))[_0xb903('0x44')](handleError(_0x560d5a,null));};exports[_0xb903('0x6e')]=function(_0x35801c,_0x24fea5,_0x3470e3){return db['UserProfile'][_0xb903('0x49')]({'where':{'id':_0x35801c[_0xb903('0x46')]['id']}})[_0xb903('0x27')](handleEntityNotFound(_0x24fea5,null))[_0xb903('0x27')](function(_0x30011d){if(_0x30011d){return _0x30011d[_0xb903('0x6e')](_0x35801c['query'][_0xb903('0x60')]);}})[_0xb903('0x27')](respondWithStatusCode(_0x24fea5,null))['catch'](handleError(_0x24fea5,null));};exports['getResources']=function(_0x4664f7,_0x4845f5){var _0x326bc3={'raw':![],'where':{}};var _0x451a01={};var _0x4644cd={'count':0x0,'rows':[]};var _0x44cc4d=_0x4664f7[_0xb903('0x33')][_0xb903('0x6f')];if(typeof _0x44cc4d===_0xb903('0x70')){throw new db[(_0xb903('0x71'))][(_0xb903('0x72'))](_0xb903('0x73'));}var _0x490e16=_0x4664f7[_0xb903('0x33')][_0xb903('0x74')]||![];var _0x50c45b=getQueryModels(_0x44cc4d,_0x490e16);if(typeof _0x50c45b[_0xb903('0x75')]===_0xb903('0x70')){throw new db[(_0xb903('0x71'))][(_0xb903('0x72'))](_0xb903('0x76')+_0x44cc4d+'\x27');}var _0x2a7b75=[];if(!_['isEmpty'](_0x50c45b[_0xb903('0x77')])){_0x2a7b75=_0x50c45b[_0xb903('0x77')];}else{_0x2a7b75=[{'name':_0x44cc4d}];}return db['UserProfile'][_0xb903('0x67')]({'where':{'id':_0x4664f7[_0xb903('0x46')]['id']}})['then'](handleEntityNotFound(_0x4845f5,null))[_0xb903('0x27')](function(_0x3e5b11){if(_0x3e5b11){var _0x4da2a5=[];for(var _0x3a8651=0x0;_0x3a8651<_0x2a7b75['length'];_0x3a8651++){_0x4da2a5[_0xb903('0x66')](db[_0xb903('0x53')][_0xb903('0x67')]({'where':{'userProfileId':_0x3e5b11['id'],'name':_0x2a7b75[_0x3a8651][_0xb903('0x2c')]},'raw':!![]}));}return BPromise[_0xb903('0x78')](_0x4da2a5);}})[_0xb903('0x27')](function(_0x37fb73){var _0x4b964c=_[_0xb903('0x3d')](_0x37fb73,function(_0x4b3adc){return _0x4b3adc?_0x4b3adc:undefined;});var _0x413ec8=_['filter'](_0x2a7b75,[_0xb903('0x79'),!![]]);var _0x6554c0=_['isEmpty'](_0x4b964c)&&_['isEmpty'](_0x413ec8)?null:_[_0xb903('0x7a')](_0x413ec8,_0x4b964c);if(_0x6554c0){var _0x2f0de3=[];for(var _0x2143dc=0x0;_0x2143dc<_0x6554c0['length'];_0x2143dc++){var _0x5eeb00=_[_0xb903('0x49')](_0x2a7b75,function(_0x5c1b54){return _0x6554c0[_0x2143dc]?_0x5c1b54[_0xb903('0x2c')]===_0x6554c0[_0x2143dc][_0xb903('0x2c')]:null;});if(_0x5eeb00){if(_0x6554c0[_0x2143dc][_0xb903('0x79')]){_0x2f0de3[_0xb903('0x66')](getAllResources(_0x50c45b[_0xb903('0x75')],_0x6554c0[_0x2143dc]));}else{if(!_0x6554c0[_0x2143dc][_0xb903('0x55')]){_0x2f0de3[_0xb903('0x66')](getAllowedResources(_0x5eeb00,_0x6554c0[_0x2143dc],_0x50c45b[_0xb903('0x75')]));}else{if(_0x5eeb00[_0xb903('0x31')]){_0x2f0de3[_0xb903('0x66')](getAllFilteredResources(_0x5eeb00,_0x6554c0[_0x2143dc]));}}}}}return BPromise[_0xb903('0x78')](_0x2f0de3);}else{return null;}})[_0xb903('0x27')](function(_0x3637d6){var _0x1aac64=_0x3637d6;var _0x4b2c70=null;if(_0x1aac64){_0x4b2c70=_0x1aac64[_0xb903('0x38')]===0x1?_0x1aac64[0x0]:null;}if(_0x4b2c70||_0x1aac64){var _0x1afba5=db[_0x50c45b[_0xb903('0x75')]][_0xb903('0x2e')];_0x451a01['model']=_[_0xb903('0x47')](_0x1afba5);_0x451a01[_0xb903('0x33')]=_[_0xb903('0x47')](_0x4664f7[_0xb903('0x33')]);_0x451a01['filters']=_[_0xb903('0x35')](_0x451a01[_0xb903('0x31')],_0x451a01[_0xb903('0x33')]);_0x326bc3[_0xb903('0x37')]=_['intersection'](_0x451a01[_0xb903('0x31')],qs[_0xb903('0x36')](_0x4664f7[_0xb903('0x33')]['fields']));_0x326bc3['attributes']=_0x326bc3[_0xb903('0x37')]['length']?_0x326bc3[_0xb903('0x37')]:_0x451a01['model'];if(!_0x4664f7['query'][_0xb903('0x7b')]('nolimit')){_0x326bc3[_0xb903('0x39')]=qs['limit'](_0x4664f7[_0xb903('0x33')][_0xb903('0x39')]);_0x326bc3['offset']=qs[_0xb903('0x20')](_0x4664f7[_0xb903('0x33')][_0xb903('0x20')]);}_0x326bc3[_0xb903('0x3a')]=qs['sort'](_0x4664f7[_0xb903('0x33')][_0xb903('0x3b')]);_0x326bc3[_0xb903('0x3c')]=qs[_0xb903('0x34')](_['pick'](_0x4664f7[_0xb903('0x33')],_0x451a01[_0xb903('0x34')]));if(_0x4664f7[_0xb903('0x33')][_0xb903('0x3d')]){_0x326bc3[_0xb903('0x3c')]=_[_0xb903('0x3e')](_0x326bc3[_0xb903('0x3c')],{'$or':_[_0xb903('0x32')](_0x1afba5,function(_0x223407){if(_0x223407[_0xb903('0x7c')][_0xb903('0x30')]!==_0xb903('0x3f')){var _0x46918c={};_0x46918c[_0x223407[_0xb903('0x7d')]]={'$like':'%'+_0x4664f7[_0xb903('0x33')]['filter']+'%'};return _0x46918c;}})});}var _0x115df9=[];if(_0x4b2c70){var _0x46ecb5=_['find'](_0x2a7b75,[_0xb903('0x2c'),_0x4b2c70[_0xb903('0x2c')]]);if(_0x46ecb5['field']){var _0x5e3955={};if(_0x50c45b['childModel']===_0xb903('0x7e')){_0x5e3955[_0x46ecb5[_0xb903('0x7f')]]=_[_0xb903('0x32')](_0x4b2c70[_0xb903('0x80')],'id');}else{_0x5e3955[_0x46ecb5[_0xb903('0x7f')]]=_0x4b2c70[_0xb903('0x80')];}_0x115df9['push'](_0x5e3955);}else{_0x326bc3['where']['id']=_0x4b2c70[_0xb903('0x80')];}}else{for(var _0x347dcd=0x0;_0x347dcd<_0x1aac64[_0xb903('0x38')];_0x347dcd++){var _0x46ecb5=_[_0xb903('0x49')](_0x2a7b75,[_0xb903('0x2c'),_0x1aac64[_0x347dcd][_0xb903('0x2c')]]);if(_0x46ecb5[_0xb903('0x7d')]){var _0x5e3955={};_0x5e3955[_0x46ecb5[_0xb903('0x7f')]]=_0x1aac64[_0x347dcd][_0xb903('0x80')];_0x115df9['push'](_0x5e3955);}else{if(!_0x326bc3[_0xb903('0x3c')]['id'])_0x326bc3['where']['id']=[];_0x1aac64[_0x347dcd][_0xb903('0x80')][_0xb903('0x69')](function(_0x136389){_0x326bc3[_0xb903('0x3c')]['id'][_0xb903('0x66')](_0x136389);});}}}if(!_['isEmpty'](_0x115df9)){_0x326bc3[_0xb903('0x3c')]=_['merge'](_0x326bc3[_0xb903('0x3c')],{'$and':{'$or':_0x115df9}});}_0x326bc3=_[_0xb903('0x3e')]({},_0x326bc3,_0x4664f7[_0xb903('0x40')]);if(_0x4b2c70&&!_0x4b2c70['autoAssociation']&&_0x50c45b[_0xb903('0x75')]==='AnalyticExtractedReport'){if(_0x4664f7[_0xb903('0x33')][_0xb903('0x42')]){_0x326bc3[_0xb903('0x48')]=[{'all':!![]}];}return db[_0x50c45b[_0xb903('0x75')]][_0xb903('0x56')](_0x326bc3)[_0xb903('0x27')](function(_0x45948f){var _0x10976e=[];_0x45948f[_0xb903('0x69')](function(_0x3ee156){var _0x170bbc;switch(_0x3ee156['reportType']){case _0xb903('0x81'):_0x170bbc=_[_0xb903('0x49')](_0x4b2c70[_0xb903('0x80')],function(_0x5756c5){return _0x5756c5['id']===_0x3ee156[_0xb903('0x82')]&&_0x5756c5[_0xb903('0x7c')]==='DefaultReports';});break;case _0xb903('0x83'):_0x170bbc=_['find'](_0x4b2c70[_0xb903('0x80')],function(_0x28ab60){return _0x28ab60['id']===_0x3ee156['reportId']&&_0x28ab60['type']===_0xb903('0x84');});break;}if(_0x170bbc)_0x10976e[_0xb903('0x66')](_0x3ee156);});_0x4644cd[_0xb903('0x1f')]=_0x10976e['length'];_0x4644cd[_0xb903('0x43')]=_0x10976e;return _0x4644cd;});}else{return db[_0x50c45b[_0xb903('0x75')]][_0xb903('0x1f')]({'where':_0x326bc3[_0xb903('0x3c')]})[_0xb903('0x27')](function(_0x4fad0e){_0x4644cd[_0xb903('0x1f')]=_0x4fad0e;if(_0x4664f7[_0xb903('0x33')][_0xb903('0x42')]){if(_0x50c45b[_0xb903('0x75')]===_0xb903('0x85')){_0x326bc3['include']=[{'model':db[_0xb903('0x86')],'as':_0xb903('0x87'),'attributes':['id',_0xb903('0x2c'),'color'],'required':_0x4664f7['query'][_0xb903('0x88')]?!![]:![]},{'model':db['Tag'],'as':_0xb903('0x89'),'attributes':['id','name','color'],'through':_0x4664f7['query']['tag']?{'attributes':[],'where':{'TagId':_0x4664f7[_0xb903('0x33')][_0xb903('0x88')]||undefined}}:{},'required':_0x4664f7['query']['tag']?!![]:![]}];}else{_0x326bc3[_0xb903('0x48')]=[{'all':!![]}];}}return db[_0x50c45b[_0xb903('0x75')]][_0xb903('0x56')](_0x326bc3);})['then'](function(_0x1f8f9d){_0x4644cd['rows']=_0x1f8f9d;return _0x4644cd;});}}else{return _0x4644cd;}})[_0xb903('0x27')](respondWithFilteredResult(_0x4845f5,_0x326bc3))[_0xb903('0x44')](handleError(_0x4845f5,null));};function getAllResources(_0x56351a,_0x4177e5){return new BPromise(function(_0x5e5fc0,_0x6875ee){if(_0x4177e5){var _0x9bed52=_0x4177e5[_0xb903('0x3d')]?{[_0x4177e5['filter'][_0xb903('0x7d')]]:_0x4177e5[_0xb903('0x3d')][_0xb903('0x8a')]}:undefined;return db[_0x56351a]['findAll']({'where':_0x9bed52,'raw':!![]})[_0xb903('0x27')](function(_0x42bcf4){_0x4177e5[_0xb903('0x80')]=_[_0xb903('0x32')](_0x42bcf4,'id');_0x5e5fc0(_0x4177e5);})[_0xb903('0x44')](function(_0x2a629e){_0x6875ee(_0x2a629e);});}else{_0x5e5fc0(null);}});}function getAllFilteredResources(_0x19bf2d,_0x57e421){return new BPromise(function(_0x2025e4,_0x50288b){var _0x3da7e4=_0x19bf2d['filter']?{[_0x19bf2d[_0xb903('0x3d')][_0xb903('0x7d')]]:_0x19bf2d[_0xb903('0x3d')][_0xb903('0x8a')]}:undefined;return db[_0x19bf2d[_0xb903('0x31')]]['findAll']({'where':_0x3da7e4,'raw':!![]})['then'](function(_0x552190){_0x57e421[_0xb903('0x80')]=_[_0xb903('0x32')](_0x552190,function(_0x323975){return _0x323975[_0xb903('0x2c')];});_0x2025e4(_0x57e421);})['catch'](function(_0x54b9b6){_0x50288b(_0x54b9b6);});});}function getAllowedResources(_0x47dbe9,_0x5a9906,_0x5e849a){return new BPromise(function(_0x307c6b,_0x3adf66){if(_0x5a9906){return db[_0xb903('0x5d')][_0xb903('0x56')]({'where':{'sectionId':_0x5a9906['id']},'raw':!![]})[_0xb903('0x27')](function(_0x1b09ab){if(_0x47dbe9[_0xb903('0x7d')]&&_0x47dbe9[_0xb903('0x7d')]!=='id'){_0x5a9906[_0xb903('0x80')]=_[_0xb903('0x32')](_0x1b09ab,function(_0x559321){return _0x559321[_0x47dbe9[_0xb903('0x7d')]];});}else{if(_0x5e849a===_0xb903('0x7e')){_0x5a9906['associatedResources']=_[_0xb903('0x32')](_0x1b09ab,function(_0x1c3e45){return{'id':_0x1c3e45['resourceId'],'type':_0x1c3e45[_0xb903('0x7c')]};});}else{_0x5a9906['associatedResources']=_['map'](_0x1b09ab,function(_0x3b8fdc){return _0x3b8fdc[_0xb903('0x6a')];});}}_0x307c6b(_0x5a9906);})['catch'](function(_0x423e89){_0x3adf66(_0x423e89);});}else{_0x307c6b(null);}});}function getQueryModels(_0x2f0750,_0x4c3f11){var _0x2bae68=_0x2f0750[_0xb903('0x8b')]();var _0x29734a={'childModel':undefined,'parentSections':[]};switch(_0x2bae68){case'squareprojects':_0x29734a[_0xb903('0x75')]='SquareProject';break;case _0xb903('0x8c'):_0x29734a[_0xb903('0x75')]=_0xb903('0x8d');break;case _0xb903('0x8e'):_0x29734a[_0xb903('0x75')]='SquareRecording';_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0x8f'),'field':_0xb903('0x2c'),'foreignKey':_0xb903('0x90')}];break;case'projects':_0x29734a[_0xb903('0x75')]=_0xb903('0x91');break;case'contacts':_0x29734a[_0xb903('0x75')]=_0xb903('0x85');_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0x92'),'field':'id','foreignKey':_0xb903('0x93')}];break;case _0xb903('0x94'):_0x29734a[_0xb903('0x75')]=_0xb903('0x95');break;case _0xb903('0x96'):_0x29734a[_0xb903('0x75')]=_0xb903('0x97');break;case'globalcustomfields':_0x29734a[_0xb903('0x75')]='CmCustomField';break;case _0xb903('0x98'):_0x29734a[_0xb903('0x75')]=_0xb903('0x99');break;case _0xb903('0x9a'):_0x29734a['childModel']='ChatWebsite';break;case _0xb903('0x9b'):_0x29734a[_0xb903('0x75')]=_0xb903('0x9c');break;case _0xb903('0x9d'):_0x29734a[_0xb903('0x75')]=_0xb903('0x9e');break;case _0xb903('0x9f'):case _0xb903('0xa0'):case'outboundroutes':_0x29734a[_0xb903('0x75')]=_0xb903('0xa1');break;case _0xb903('0xa2'):_0x29734a[_0xb903('0x75')]=_0xb903('0xa3');break;case _0xb903('0xa4'):_0x29734a[_0xb903('0x75')]=_0xb903('0xa5');break;case _0xb903('0xa6'):_0x29734a[_0xb903('0x75')]=_0xb903('0xa7');_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0xa8'),'field':_0xb903('0x2c'),'foreignKey':_0xb903('0xa9'),'model':_0xb903('0xaa'),'filter':{'field':_0xb903('0xab'),'value':[_0xb903('0xac')]}},{'name':_0xb903('0xad'),'field':_0xb903('0x2c'),'foreignKey':_0xb903('0xa9'),'model':_0xb903('0xaa'),'filter':{'field':_0xb903('0xab'),'value':[_0xb903('0xae')]}},{'name':'VoiceQueues','field':_0xb903('0x2c'),'foreignKey':'queue','model':_0xb903('0xaf'),'filter':{'field':'type','value':['inbound']}},{'name':_0xb903('0xb0'),'field':'name','foreignKey':_0xb903('0xb1'),'model':'VoiceQueue','filter':{'field':_0xb903('0x7c'),'value':['outbound']}}];break;case'musiconholds':_0x29734a[_0xb903('0x75')]=_0xb903('0xb2');break;case _0xb903('0xb3'):_0x29734a['childModel']='VoiceChanSpy';break;case'voiceprefixes':_0x29734a[_0xb903('0x75')]=_0xb903('0xb4');break;case _0xb903('0xb5'):_0x29734a[_0xb903('0x75')]=_0xb903('0xb6');break;case _0xb903('0xb7'):_0x29734a[_0xb903('0x75')]=_0xb903('0xb8');break;case _0xb903('0xb9'):_0x29734a[_0xb903('0x75')]=_0xb903('0xba');break;case'mailsubstatuses':_0x29734a[_0xb903('0x75')]=_0xb903('0xbb');break;case _0xb903('0xbc'):_0x29734a[_0xb903('0x75')]='OpenchannelQueue';break;case _0xb903('0xbd'):_0x29734a[_0xb903('0x75')]=_0xb903('0xbe');break;case _0xb903('0xbf'):_0x29734a['childModel']=_0xb903('0xc0');break;case _0xb903('0xc1'):_0x29734a[_0xb903('0x75')]='SmsAccount';break;case'whatsappqueues':_0x29734a[_0xb903('0x75')]=_0xb903('0xc2');break;case'whatsappaccounts':_0x29734a[_0xb903('0x75')]=_0xb903('0xc3');break;case'teams':_0x29734a[_0xb903('0x75')]=_0xb903('0xc4');break;case _0xb903('0xc5'):case'queuecampaigns':_0x29734a['childModel']=_0xb903('0xaf');if(_0x4c3f11){_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0xc6')},{'name':'QueueCampaigns'}];}break;case _0xb903('0xc7'):case'agents':case'telephones':_0x29734a[_0xb903('0x75')]='User';if(_0x4c3f11){_0x29734a['parentSections']=[{'name':_0xb903('0xc8'),'filter':{'field':_0xb903('0xab'),'value':[_0xb903('0xc9'),'user']},'ignore':!![]},{'name':_0xb903('0xa8')},{'name':_0xb903('0xad')}];}break;case _0xb903('0xca'):_0x29734a[_0xb903('0x75')]=_0xb903('0xcb');break;case _0xb903('0xcc'):_0x29734a[_0xb903('0x75')]=_0xb903('0xcd');break;case _0xb903('0xce'):_0x29734a[_0xb903('0x75')]=_0xb903('0xcf');break;case'sugarcrmaccounts':_0x29734a['childModel']='SugarcrmAccount';break;case _0xb903('0xd0'):_0x29734a[_0xb903('0x75')]='DeskAccount';break;case _0xb903('0xd1'):_0x29734a[_0xb903('0x75')]='ZohoAccount';break;case _0xb903('0xd2'):_0x29734a[_0xb903('0x75')]=_0xb903('0xaa');break;case _0xb903('0xd3'):_0x29734a[_0xb903('0x75')]=_0xb903('0xd4');break;case _0xb903('0xd5'):_0x29734a['childModel']=_0xb903('0xd6');break;case'customdashboards':_0x29734a[_0xb903('0x75')]=_0xb903('0x68');break;case _0xb903('0xd7'):_0x29734a[_0xb903('0x75')]=_0xb903('0xd8');break;case'pauses':_0x29734a[_0xb903('0x75')]=_0xb903('0xd9');break;case _0xb903('0xda'):_0x29734a[_0xb903('0x75')]='Schedule';break;case _0xb903('0xdb'):_0x29734a[_0xb903('0x75')]=_0xb903('0xdc');break;case'tags':_0x29734a['childModel']=_0xb903('0x86');break;case'templates':_0x29734a[_0xb903('0x75')]='Template';break;case _0xb903('0xdd'):_0x29734a[_0xb903('0x75')]='Trigger';break;case _0xb903('0xde'):_0x29734a[_0xb903('0x75')]=_0xb903('0xdf');break;case _0xb903('0xe0'):_0x29734a[_0xb903('0x75')]=_0xb903('0xe1');break;case _0xb903('0xe2'):_0x29734a[_0xb903('0x75')]='Plugin';break;case _0xb903('0xe3'):_0x29734a[_0xb903('0x75')]=_0xb903('0x7e');_0x29734a[_0xb903('0x77')]=[{'name':_0xb903('0xe4'),'field':'id','foreignKey':_0xb903('0x82')}];break;case _0xb903('0xe5'):_0x29734a['childModel']=_0xb903('0xe6');break;case'whatsappaccounts':_0x29734a['childModel']=_0xb903('0xc3');break;default:return _0x29734a;}return _0x29734a;} \ No newline at end of file +var _0xc86f=['length','hasOwnProperty','nolimit','limit','order','sort','filter','where','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','clone','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','describe','sequelize','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','push','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','get','removeResources','getResources','section','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','Invalid\x20section\x20\x27','parentSections','all','ignore','union','childModel','pick','type','VIRTUAL','field','associatedResources','foreignKey','reportType','default','reportId','rows','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','internalroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','teams','Team','voicequeues','users','agents','admin','user','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','triggers','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','metrics','AnalyticMetric','whatsappaccounts','WhatsappAccount','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','apply','save','then','destroy','error','stack','UserProfile','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields'];(function(_0x3ecd68,_0x4930c4){var _0x1a39cc=function(_0x549817){while(--_0x549817){_0x3ecd68['push'](_0x3ecd68['shift']());}};_0x1a39cc(++_0x4930c4);}(_0xc86f,0xb3));var _0xfc86=function(_0x2713f5,_0x382adb){_0x2713f5=_0x2713f5-0x0;var _0x4e6249=_0xc86f[_0x2713f5];return _0x4e6249;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc86('0x0'));var rimraf=require(_0xfc86('0x1'));var zipdir=require(_0xfc86('0x2'));var jsonpatch=require(_0xfc86('0x3'));var rp=require(_0xfc86('0x4'));var moment=require('moment');var BPromise=require(_0xfc86('0x5'));var Mustache=require('mustache');var util=require(_0xfc86('0x6'));var path=require('path');var sox=require(_0xfc86('0x7'));var csv=require(_0xfc86('0x8'));var ejs=require(_0xfc86('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfc86('0xa'));var crypto=require(_0xfc86('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfc86('0xc'));var toCsv=require(_0xfc86('0x8'));var querystring=require('querystring');var Papa=require(_0xfc86('0xd'));var Redis=require(_0xfc86('0xe'));var authService=require(_0xfc86('0xf'));var qs=require(_0xfc86('0x10'));var as=require(_0xfc86('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc86('0x12'))(_0xfc86('0x13'));var utils=require('../../config/utils');var config=require(_0xfc86('0x14'));var licenseUtil=require(_0xfc86('0x15'));var db=require(_0xfc86('0x16'))['db'];config[_0xfc86('0x17')]=_['defaults'](config[_0xfc86('0x17')],{'host':_0xfc86('0x18'),'port':0x18eb});var socket=require(_0xfc86('0x19'))(new Redis(config[_0xfc86('0x17')]));require('./userProfile.socket')[_0xfc86('0x1a')](socket);function respondWithStatusCode(_0x1098c3,_0x3085f7){_0x3085f7=_0x3085f7||0xcc;return function(_0x49d0ca){if(_0x49d0ca){return _0x1098c3[_0xfc86('0x1b')](_0x3085f7);}return _0x1098c3[_0xfc86('0x1c')](_0x3085f7)[_0xfc86('0x1d')]();};}function respondWithResult(_0x1a31e8,_0x18ee80){_0x18ee80=_0x18ee80||0xc8;return function(_0x1f1a5c){if(_0x1f1a5c){return _0x1a31e8['status'](_0x18ee80)[_0xfc86('0x1e')](_0x1f1a5c);}};}function respondWithFilteredResult(_0x653a36,_0x347d00){return function(_0x9d3f03){if(_0x9d3f03){var _0x917206=_0x9d3f03[_0xfc86('0x1f')],_0x2e3167=_0x347d00[_0xfc86('0x20')],_0xaa96f1=_0x347d00[_0xfc86('0x20')]+_0x347d00['limit'],_0x117004;if(_0xaa96f1>=_0x917206){_0xaa96f1=_0x917206;_0x117004=0xc8;}else{_0x117004=0xce;}_0x653a36[_0xfc86('0x1c')](_0x117004);return _0x653a36['set']('Content-Range',_0x2e3167+'-'+_0xaa96f1+'/'+_0x917206)[_0xfc86('0x1e')](_0x9d3f03);}return null;};}function patchUpdates(_0x44c867){return function(_0x5439de){try{jsonpatch[_0xfc86('0x21')](_0x5439de,_0x44c867,!![]);}catch(_0xea65d9){return BPromise['reject'](_0xea65d9);}return _0x5439de[_0xfc86('0x22')]();};}function saveUpdates(_0x1a7cc6,_0x11238a){return function(_0x55e81a){if(_0x55e81a){return _0x55e81a['update'](_0x1a7cc6)[_0xfc86('0x23')](function(_0x386b16){return _0x386b16;});}return null;};}function removeEntity(_0x1cec62,_0x579d8e){return function(_0x912a3d){if(_0x912a3d){return _0x912a3d[_0xfc86('0x24')]()[_0xfc86('0x23')](function(){_0x1cec62['status'](0xcc)[_0xfc86('0x1d')]();});}};}function handleEntityNotFound(_0xa3322f,_0x20d90f){return function(_0x33b875){if(!_0x33b875){_0xa3322f[_0xfc86('0x1b')](0x194);}return _0x33b875;};}function handleError(_0xa590fa,_0x579497){_0x579497=_0x579497||0x1f4;return function(_0x3131a8){logger[_0xfc86('0x25')](_0x3131a8[_0xfc86('0x26')]);if(_0x3131a8['name']){delete _0x3131a8['name'];}_0xa590fa[_0xfc86('0x1c')](_0x579497)['send'](_0x3131a8);};}exports['index']=function(_0xf914cf,_0x3ccfcc){var _0x200be0={},_0x3a8ed4={},_0x29e60a={'count':0x0,'rows':[]};var _0x926029=_['map'](db[_0xfc86('0x27')][_0xfc86('0x28')],function(_0x12b693){return{'name':_0x12b693['fieldName'],'type':_0x12b693['type'][_0xfc86('0x29')]};});_0x3a8ed4[_0xfc86('0x2a')]=_[_0xfc86('0x2b')](_0x926029,_0xfc86('0x2c'));_0x3a8ed4[_0xfc86('0x2d')]=_[_0xfc86('0x2e')](_0xf914cf['query']);_0x3a8ed4[_0xfc86('0x2f')]=_[_0xfc86('0x30')](_0x3a8ed4[_0xfc86('0x2a')],_0x3a8ed4[_0xfc86('0x2d')]);_0x200be0[_0xfc86('0x31')]=_['intersection'](_0x3a8ed4[_0xfc86('0x2a')],qs['fields'](_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x32')]));_0x200be0['attributes']=_0x200be0['attributes'][_0xfc86('0x33')]?_0x200be0[_0xfc86('0x31')]:_0x3a8ed4[_0xfc86('0x2a')];if(!_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x34')](_0xfc86('0x35'))){_0x200be0[_0xfc86('0x36')]=qs['limit'](_0xf914cf['query']['limit']);_0x200be0[_0xfc86('0x20')]=qs['offset'](_0xf914cf['query'][_0xfc86('0x20')]);}_0x200be0[_0xfc86('0x37')]=qs[_0xfc86('0x38')](_0xf914cf['query'][_0xfc86('0x38')]);_0x200be0['where']=qs[_0xfc86('0x2f')](_['pick'](_0xf914cf[_0xfc86('0x2d')],_0x3a8ed4['filters']),_0x926029);if(_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x39')]){_0x200be0[_0xfc86('0x3a')]=_[_0xfc86('0x3b')](_0x200be0[_0xfc86('0x3a')],{'$or':_['map'](_0x926029,function(_0x27d8e9){if(_0x27d8e9['type']!=='VIRTUAL'){var _0x1cbdca={};_0x1cbdca[_0x27d8e9[_0xfc86('0x2c')]]={'$like':'%'+_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x39')]+'%'};return _0x1cbdca;}})});}_0x200be0=_['merge']({},_0x200be0,_0xf914cf[_0xfc86('0x3c')]);var _0x20da03={'where':_0x200be0[_0xfc86('0x3a')]};return db[_0xfc86('0x27')][_0xfc86('0x1f')](_0x20da03)['then'](function(_0x4a2cbf){_0x29e60a[_0xfc86('0x1f')]=_0x4a2cbf;if(_0xf914cf[_0xfc86('0x2d')][_0xfc86('0x3d')]){_0x200be0[_0xfc86('0x3e')]=[{'all':!![]}];}return db[_0xfc86('0x27')][_0xfc86('0x3f')](_0x200be0);})['then'](function(_0x4971eb){_0x29e60a['rows']=_0x4971eb;return _0x29e60a;})['then'](respondWithFilteredResult(_0x3ccfcc,_0x200be0))['catch'](handleError(_0x3ccfcc,null));};exports[_0xfc86('0x40')]=function(_0x4074d9,_0x4c5463){var _0x45f069={'raw':![],'where':{'id':_0x4074d9[_0xfc86('0x41')]['id']}},_0x4c6616={};_0x4c6616['model']=_[_0xfc86('0x2e')](db[_0xfc86('0x27')][_0xfc86('0x28')]);_0x4c6616['query']=_[_0xfc86('0x2e')](_0x4074d9[_0xfc86('0x2d')]);_0x4c6616[_0xfc86('0x2f')]=_[_0xfc86('0x30')](_0x4c6616[_0xfc86('0x2a')],_0x4c6616['query']);_0x45f069[_0xfc86('0x31')]=_[_0xfc86('0x30')](_0x4c6616[_0xfc86('0x2a')],qs[_0xfc86('0x32')](_0x4074d9[_0xfc86('0x2d')][_0xfc86('0x32')]));_0x45f069[_0xfc86('0x31')]=_0x45f069[_0xfc86('0x31')][_0xfc86('0x33')]?_0x45f069[_0xfc86('0x31')]:_0x4c6616['model'];if(_0x4074d9[_0xfc86('0x2d')][_0xfc86('0x3d')]){_0x45f069[_0xfc86('0x3e')]=[{'all':!![]}];}_0x45f069=_[_0xfc86('0x3b')]({},_0x45f069,_0x4074d9[_0xfc86('0x3c')]);return db[_0xfc86('0x27')][_0xfc86('0x42')](_0x45f069)[_0xfc86('0x23')](handleEntityNotFound(_0x4c5463,null))[_0xfc86('0x23')](respondWithResult(_0x4c5463,null))[_0xfc86('0x43')](handleError(_0x4c5463,null));};exports[_0xfc86('0x44')]=function(_0x3c4f3d,_0xd880e0){return db[_0xfc86('0x27')]['create'](_0x3c4f3d[_0xfc86('0x45')],{})[_0xfc86('0x23')](respondWithResult(_0xd880e0,0xc9))[_0xfc86('0x43')](handleError(_0xd880e0,null));};exports[_0xfc86('0x46')]=function(_0x39a2e,_0x26b236){var _0x26e602={'where':{'id':_0x39a2e['params']['id']}},_0x1f6911={};_0x1f6911[_0xfc86('0x2a')]=_[_0xfc86('0x2e')](db['UserProfile']['rawAttributes']);_0x26e602[_0xfc86('0x31')]=_[_0xfc86('0x30')](_0x1f6911[_0xfc86('0x2a')],qs[_0xfc86('0x32')](_0x39a2e['query'][_0xfc86('0x32')]));_0x26e602[_0xfc86('0x31')]=_0x26e602[_0xfc86('0x31')][_0xfc86('0x33')]?_0x26e602['attributes']:_0x1f6911[_0xfc86('0x2a')];if(_0x39a2e['query'][_0xfc86('0x3d')]){_0x26e602[_0xfc86('0x3e')]=[{'all':!![]}];}_0x26e602=_[_0xfc86('0x3b')]({},_0x26e602,_0x39a2e['options']);return db[_0xfc86('0x27')][_0xfc86('0x42')](_0x26e602)['then'](handleEntityNotFound(_0x26b236,null))['then'](function(_0x30a07e){if(_0x30a07e){var _0x5ee6fe=_0x30a07e['get']({'plain':!![]});_0x5ee6fe=qs[_0xfc86('0x47')](_0x5ee6fe,['id','createdAt',_0xfc86('0x48'),_0xfc86('0x49')]);_0x39a2e[_0xfc86('0x45')]=_[_0xfc86('0x47')](_0x39a2e[_0xfc86('0x45')],['id',_0xfc86('0x4a'),_0xfc86('0x48')]);return db['sequelize'][_0xfc86('0x4b')](function(_0xbfa740){return db[_0xfc86('0x27')][_0xfc86('0x44')](_[_0xfc86('0x3b')](_0x5ee6fe,_0x39a2e[_0xfc86('0x45')]),{'include':_0x39a2e['query'][_0xfc86('0x3d')]?[{'all':!![]}]:undefined,'transaction':_0xbfa740})[_0xfc86('0x23')](function(_0x2570fc){var _0x5382e5=_0x2570fc['get']({'plain':!![]});return db[_0xfc86('0x4c')][_0xfc86('0x3f')]({'where':{'userProfileId':_0x39a2e[_0xfc86('0x41')]['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x54b1f0){if(_0x54b1f0){return BPromise[_0xfc86('0x4d')](_0x54b1f0,function(_0x2acb34){return new BPromise(function(_0x43b6f6,_0x506ad7){if(_0x2acb34[_0xfc86('0x4e')]===null||_0x2acb34[_0xfc86('0x4e')]===0x1)_0x43b6f6(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2acb34['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x20f8d6){var _0x161a59=_[_0xfc86('0x2b')](_0x20f8d6,function(_0x49035c){return qs[_0xfc86('0x47')](_0x49035c,['id',_0xfc86('0x4a'),_0xfc86('0x48'),_0xfc86('0x4f')]);});_0x43b6f6(_0x161a59);})[_0xfc86('0x43')](function(_0x4ccf3c){_0x506ad7(_0x4ccf3c);});})['then'](function(_0x45e5ad){var _0x46f5c5=qs[_0xfc86('0x47')](_0x2acb34,['id',_0xfc86('0x4a'),'updatedAt']);_0x46f5c5[_0xfc86('0x50')]=_0x5382e5['id'];if(_0x45e5ad)_0x46f5c5[_0xfc86('0x51')]=_0x45e5ad;return _0x46f5c5;})[_0xfc86('0x23')](function(_0x2ce8e3){return db[_0xfc86('0x4c')]['create'](_0x2ce8e3,{'include':[{'model':db[_0xfc86('0x52')],'as':_0xfc86('0x51')}],'raw':!![],'transaction':_0xbfa740});});})[_0xfc86('0x23')](function(){return _0x5382e5;});}});});});}})[_0xfc86('0x23')](respondWithResult(_0x26b236,0xc9))[_0xfc86('0x43')](handleError(_0x26b236,null));};exports[_0xfc86('0x53')]=function(_0x252ecd,_0x3368ce){if(_0x252ecd[_0xfc86('0x45')]['id']){delete _0x252ecd[_0xfc86('0x45')]['id'];}return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0x252ecd['params']['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x3368ce,null))['then'](saveUpdates(_0x252ecd[_0xfc86('0x45')],null))[_0xfc86('0x23')](respondWithResult(_0x3368ce,null))['catch'](handleError(_0x3368ce,null));};exports['destroy']=function(_0x12ccf8,_0x3b76f4){return db['UserProfile'][_0xfc86('0x42')]({'where':{'id':_0x12ccf8[_0xfc86('0x41')]['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x3b76f4,null))[_0xfc86('0x23')](removeEntity(_0x3b76f4,null))[_0xfc86('0x43')](handleError(_0x3b76f4,null));};exports[_0xfc86('0x54')]=function(_0x511685,_0x2825aa){return db[_0xfc86('0x27')][_0xfc86('0x54')]()[_0xfc86('0x23')](respondWithResult(_0x2825aa,null))[_0xfc86('0x43')](handleError(_0x2825aa,null));};exports['addSections']=function(_0x200c88,_0x3bcb42){var _0x16188d=_0x200c88[_0xfc86('0x45')];return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0x200c88['params']['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x3bcb42,null))[_0xfc86('0x23')](function(_0x42a726){if(_0x42a726){return db[_0xfc86('0x55')]['transaction'](function(_0x3ff6ef){return db[_0xfc86('0x4c')][_0xfc86('0x24')]({'where':{'userProfileId':_0x200c88[_0xfc86('0x41')]['id'],'sectionId':_[_0xfc86('0x2b')](_0x16188d,function(_0x51d989){return _0x51d989[_0xfc86('0x4f')];})},'transaction':_0x3ff6ef})[_0xfc86('0x23')](function(){var _0x20292f=_['map'](_0x16188d,function(_0x396dfd){_0x396dfd[_0xfc86('0x50')]=_0x200c88[_0xfc86('0x41')]['id'];return _0x396dfd;});var _0x32c0b5=[];return BPromise[_0xfc86('0x4d')](_0x20292f,function(_0x505e34){return db[_0xfc86('0x4c')]['create'](_0x505e34,{'include':[{'model':db[_0xfc86('0x52')],'as':_0xfc86('0x51')}],'raw':!![],'transaction':_0x3ff6ef})[_0xfc86('0x23')](function(_0x4a9fd5){_0x32c0b5['push'](_0x4a9fd5['get']({'plain':!![]}));});})[_0xfc86('0x23')](function(){return _0x32c0b5;});});});}})[_0xfc86('0x23')](function(_0xbccff3){return _0xbccff3;})['then'](respondWithResult(_0x3bcb42,null))[_0xfc86('0x43')](handleError(_0x3bcb42,null));};exports[_0xfc86('0x56')]=function(_0x586a88,_0x27c2d2){var _0x20b96c;return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0x586a88[_0xfc86('0x41')]['id']},'attributes':['id',_0xfc86('0x2c')]})[_0xfc86('0x23')](handleEntityNotFound(_0x27c2d2,null))[_0xfc86('0x23')](function(_0x821fbc){if(_0x821fbc){_0x20b96c=_0x821fbc;return db[_0xfc86('0x4c')][_0xfc86('0x24')]({'where':{'userProfileId':_0x586a88[_0xfc86('0x41')]['id'],'sectionId':_0x586a88[_0xfc86('0x2d')][_0xfc86('0x57')]}});}})[_0xfc86('0x23')](function(){return _0x20b96c;})['then'](respondWithStatusCode(_0x27c2d2,null))[_0xfc86('0x43')](handleError(_0x27c2d2,null));};exports[_0xfc86('0x58')]=function(_0xedcfc3,_0x19d2a1){var _0x473694=[];var _0x12735e=[];return db['UserProfileSection'][_0xfc86('0x3f')]({'where':{'userProfileId':_0xedcfc3[_0xfc86('0x41')]['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x1d2aff){_0x473694=_[_0xfc86('0x39')](_0x1d2aff,function(_0x3b0cf4){return _0x3b0cf4[_0xfc86('0x59')]===0x1||_['includes']([0x3eb,0x709],_0x3b0cf4[_0xfc86('0x4f')]);});if(!_[_0xfc86('0x5a')](_0x473694)){return _[_0xfc86('0x2b')](_0x473694,function(_0xc840ad){return _0xc840ad[_0xfc86('0x4f')];});}else{return;}})['then'](function(_0x2aeafc){if(_0x2aeafc)_0x12735e=_0x2aeafc;if(_[_0xfc86('0x5b')](_0x12735e,0x64)){var _0x103c31=_[_0xfc86('0x42')](_0x473694,{'sectionId':0x64});return hasDefaultDashboard(_0x103c31)[_0xfc86('0x23')](function(_0x2cb602){return _[_0xfc86('0x2b')](_0x473694,function(_0x364107){if(_0x364107[_0xfc86('0x4f')]===0x64){_0x364107[_0xfc86('0x5c')]=_0x2cb602;}return _0x364107;});});}else{return;}})[_0xfc86('0x23')](function(_0x118a91){if(_0x118a91)_0x473694=_0x118a91;if(_['includes'](_0x12735e,0x3eb)){var _0x4a41fa=_['find'](_0x473694,{'sectionId':0x3eb});return getCustomDashboards(_0x4a41fa)[_0xfc86('0x23')](function(_0x25dca6){return _[_0xfc86('0x2b')](_0x473694,function(_0x4348cb){if(_0x4a41fa[_0xfc86('0x59')]){if(_0x4348cb[_0xfc86('0x4f')]===0x3eb){_0x4348cb[_0xfc86('0x5c')]=_0x25dca6;}}else{if(_0x4348cb[_0xfc86('0x4f')]===0x64){_0x4348cb[_0xfc86('0x5c')]=_0x25dca6;}}return _0x4348cb;});});}else{return;}})[_0xfc86('0x23')](function(_0x3a0b03){if(_0x3a0b03)_0x473694=_0x3a0b03;if(_[_0xfc86('0x5b')](_0x12735e,0x709)){var _0x470420=_[_0xfc86('0x42')](_0x473694,{'sectionId':0x709});return getPlugins(_0x470420)[_0xfc86('0x23')](function(_0x31a4be){if(_0x470420[_0xfc86('0x59')]){return _[_0xfc86('0x2b')](_0x473694,function(_0x3d875a){if(_0x3d875a[_0xfc86('0x4f')]===0x709){_0x3d875a[_0xfc86('0x5c')]=_0x31a4be;}return _0x3d875a;});}else{var _0x2c629b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x31a4be};var _0x16392f=_['map'](_0x473694);_0x16392f[_0xfc86('0x5d')](_0x2c629b);return _0x16392f;}});}else{return;}})[_0xfc86('0x23')](function(_0x1a31bb){if(_0x1a31bb)_0x473694=_0x1a31bb;return _[_0xfc86('0x39')](_0x473694,['enabled',0x1]);})['then'](respondWithResult(_0x19d2a1,null))[_0xfc86('0x43')](handleError(_0x19d2a1,null));};function hasDefaultDashboard(_0x38a363){var _0x21fe8c=[0x65];return new BPromise(function(_0x3158ed,_0x5f1078){try{if(_0x38a363[_0xfc86('0x4e')]){_0x3158ed(_0x21fe8c);}else{return db['UserProfileResource'][_0xfc86('0x5e')]({'where':{'sectionId':_0x38a363['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x2ef5c5){_0x2ef5c5?_0x3158ed(_0x21fe8c):_0x3158ed();});}}catch(_0x27833d){_0x5f1078(_0x27833d);}});}function getCustomDashboards(_0x436052){var _0x377e37=[];return new BPromise(function(_0x5c8cff,_0x289f20){try{if(_0x436052[_0xfc86('0x4e')]){return db['Dashboard'][_0xfc86('0x3f')]({'raw':!![]})[_0xfc86('0x23')](function(_0x5ec156){_0x5ec156[_0xfc86('0x5f')](function(_0x57ec9b){_0x377e37[_0xfc86('0x5d')](_0x57ec9b['id']+0x1869f);});_0x5c8cff(_0x377e37);});}else{return db[_0xfc86('0x52')][_0xfc86('0x3f')]({'where':{'sectionId':_0x436052['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x2035a5){_0x2035a5['forEach'](function(_0x1b8b71){_0x377e37[_0xfc86('0x5d')](_0x1b8b71[_0xfc86('0x60')]+0x1869f);});_0x5c8cff(_0x377e37);});}}catch(_0x31b90a){_0x289f20(_0x31b90a);}});}function getPlugins(_0x278046){var _0x35f4a5=[];return new BPromise(function(_0x7dfbc,_0x2a644a){try{if(_0x278046['autoAssociation']){return db[_0xfc86('0x61')][_0xfc86('0x3f')]({'raw':!![]})[_0xfc86('0x23')](function(_0x20a2ed){_0x20a2ed['forEach'](function(_0x3d6dfe){_0x35f4a5[_0xfc86('0x5d')](_0x3d6dfe['id']+0x15b38);});_0x7dfbc(_0x35f4a5);});}else{return db[_0xfc86('0x52')][_0xfc86('0x3f')]({'where':{'sectionId':_0x278046['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x3f910f){_0x3f910f['forEach'](function(_0x1ee07e){_0x35f4a5[_0xfc86('0x5d')](_0x1ee07e[_0xfc86('0x60')]+0x15b38);});_0x7dfbc(_0x35f4a5);});}}catch(_0xf4b6f9){_0x2a644a(_0xf4b6f9);}});}exports[_0xfc86('0x62')]=function(_0x1149ee,_0x6b19e1){return db[_0xfc86('0x27')]['find']({'where':{'id':_0x1149ee[_0xfc86('0x41')]['id']}})[_0xfc86('0x23')](handleEntityNotFound(_0x6b19e1,null))[_0xfc86('0x23')](function(_0x7501d3){if(_0x7501d3){return db['sequelize'][_0xfc86('0x4b')](function(_0x4a082b){return db['UserProfileSection'][_0xfc86('0x3f')]({'where':{'userProfileId':_0x1149ee[_0xfc86('0x41')]['id']},'attributes':['id'],'raw':!![]})[_0xfc86('0x23')](function(_0xe02640){if(_0xe02640){return db[_0xfc86('0x4c')][_0xfc86('0x24')]({'where':{'userProfileId':_0x1149ee[_0xfc86('0x41')]['id'],'id':_[_0xfc86('0x2b')](_0xe02640,function(_0x209e0a){return _0x209e0a['id'];})},'transaction':_0x4a082b});}})['then'](function(_0x137c17){var _0x2c7dbb=_['map'](_0x1149ee[_0xfc86('0x45')],function(_0x1a7e5d){_0x1a7e5d[_0xfc86('0x50')]=_0x1149ee[_0xfc86('0x41')]['id'];return _0x1a7e5d;});return db[_0xfc86('0x4c')][_0xfc86('0x63')](_0x2c7dbb,{'raw':!![],'transaction':_0x4a082b});})[_0xfc86('0x23')](function(_0x1d24cc){var _0x59f1a6=_[_0xfc86('0x39')](_[_0xfc86('0x2b')](_0x1d24cc,function(_0x386988){return _0x386988['get']({'plain':!![]});}),{'includeAll':![]});if(_0x59f1a6){return db[_0xfc86('0x4c')][_0xfc86('0x3f')]({'where':{'userProfileId':_0x1149ee[_0xfc86('0x41')]['id'],'sectionId':_[_0xfc86('0x2b')](_0x59f1a6,function(_0x5a18eb){return _0x5a18eb[_0xfc86('0x4f')];})},'attributes':['id',_0xfc86('0x4f')],'raw':!![]})[_0xfc86('0x23')](function(_0x40482e){var _0x1b04c=_['map'](_0x1149ee[_0xfc86('0x45')],function(_0x5d429a){_0x5d429a['userProfileId']=_0x1149ee[_0xfc86('0x41')]['id'];return _0x5d429a;});return db[_0xfc86('0x52')][_0xfc86('0x63')](_0x1b04c,{'raw':!![],'transaction':_0x4a082b});});}})[_0xfc86('0x43')](handleError(_0x6b19e1,null));});}})[_0xfc86('0x23')](function(_0x4aac1e){var _0x35ec80=_[_0xfc86('0x2b')](_0x4aac1e,function(_0x31a244){return _0x31a244[_0xfc86('0x64')]({'plain':!![]});});})[_0xfc86('0x23')](respondWithResult(_0x6b19e1,null))[_0xfc86('0x43')](handleError(_0x6b19e1,null));};exports[_0xfc86('0x65')]=function(_0xb5d911,_0x355887,_0x58f41f){return db[_0xfc86('0x27')][_0xfc86('0x42')]({'where':{'id':_0xb5d911[_0xfc86('0x41')]['id']}})['then'](handleEntityNotFound(_0x355887,null))[_0xfc86('0x23')](function(_0x26639b){if(_0x26639b){return _0x26639b['removeResources'](_0xb5d911[_0xfc86('0x2d')][_0xfc86('0x57')]);}})[_0xfc86('0x23')](respondWithStatusCode(_0x355887,null))['catch'](handleError(_0x355887,null));};exports[_0xfc86('0x66')]=function(_0x5999de,_0xfa1a08){var _0x5a723d={'raw':![],'where':{}};var _0x1e3fab={};var _0x332444={'count':0x0,'rows':[]};var _0x4738d6=_0x5999de[_0xfc86('0x2d')][_0xfc86('0x67')];if(typeof _0x4738d6===_0xfc86('0x68')){throw new db[(_0xfc86('0x69'))][(_0xfc86('0x6a'))](_0xfc86('0x6b'));}var _0x3a7868=_0x5999de['query'][_0xfc86('0x6c')]||![];var _0x3cdbb2=getQueryModels(_0x4738d6,_0x3a7868);if(typeof _0x3cdbb2['childModel']==='undefined'){throw new db['Sequelize']['ValidationError'](_0xfc86('0x6d')+_0x4738d6+'\x27');}var _0x259e50=[];if(!_['isEmpty'](_0x3cdbb2[_0xfc86('0x6e')])){_0x259e50=_0x3cdbb2[_0xfc86('0x6e')];}else{_0x259e50=[{'name':_0x4738d6}];}return db['UserProfile'][_0xfc86('0x5e')]({'where':{'id':_0x5999de[_0xfc86('0x41')]['id']}})['then'](handleEntityNotFound(_0xfa1a08,null))[_0xfc86('0x23')](function(_0x1ad19d){if(_0x1ad19d){var _0x5e411e=[];for(var _0x22c8c3=0x0;_0x22c8c3<_0x259e50[_0xfc86('0x33')];_0x22c8c3++){_0x5e411e[_0xfc86('0x5d')](db['UserProfileSection'][_0xfc86('0x5e')]({'where':{'userProfileId':_0x1ad19d['id'],'name':_0x259e50[_0x22c8c3][_0xfc86('0x2c')]},'raw':!![]}));}return BPromise[_0xfc86('0x6f')](_0x5e411e);}})['then'](function(_0x9e1b68){var _0x5add7b=_[_0xfc86('0x39')](_0x9e1b68,function(_0x2e4af0){return _0x2e4af0?_0x2e4af0:undefined;});var _0x5c9b05=_['filter'](_0x259e50,[_0xfc86('0x70'),!![]]);var _0x494267=_[_0xfc86('0x5a')](_0x5add7b)&&_['isEmpty'](_0x5c9b05)?null:_[_0xfc86('0x71')](_0x5c9b05,_0x5add7b);if(_0x494267){var _0x6a4373=[];for(var _0x986ce7=0x0;_0x986ce7<_0x494267[_0xfc86('0x33')];_0x986ce7++){var _0x40f995=_[_0xfc86('0x42')](_0x259e50,function(_0x2a884d){return _0x494267[_0x986ce7]?_0x2a884d[_0xfc86('0x2c')]===_0x494267[_0x986ce7][_0xfc86('0x2c')]:null;});if(_0x40f995){if(_0x494267[_0x986ce7][_0xfc86('0x70')]){_0x6a4373['push'](getAllResources(_0x3cdbb2[_0xfc86('0x72')],_0x494267[_0x986ce7]));}else{if(!_0x494267[_0x986ce7]['autoAssociation']){_0x6a4373[_0xfc86('0x5d')](getAllowedResources(_0x40f995,_0x494267[_0x986ce7],_0x3cdbb2[_0xfc86('0x72')]));}else{if(_0x40f995[_0xfc86('0x2a')]){_0x6a4373['push'](getAllFilteredResources(_0x40f995,_0x494267[_0x986ce7]));}}}}}return BPromise['all'](_0x6a4373);}else{return null;}})[_0xfc86('0x23')](function(_0x57233b){var _0x450bac=_0x57233b;var _0x1b4b11=null;if(_0x450bac){_0x1b4b11=_0x450bac[_0xfc86('0x33')]===0x1?_0x450bac[0x0]:null;}if(_0x1b4b11||_0x450bac){var _0x13d6c5=db[_0x3cdbb2[_0xfc86('0x72')]][_0xfc86('0x28')];_0x1e3fab[_0xfc86('0x2a')]=_[_0xfc86('0x2e')](_0x13d6c5);_0x1e3fab['query']=_[_0xfc86('0x2e')](_0x5999de[_0xfc86('0x2d')]);_0x1e3fab['filters']=_[_0xfc86('0x30')](_0x1e3fab[_0xfc86('0x2a')],_0x1e3fab[_0xfc86('0x2d')]);_0x5a723d[_0xfc86('0x31')]=_['intersection'](_0x1e3fab[_0xfc86('0x2a')],qs[_0xfc86('0x32')](_0x5999de['query'][_0xfc86('0x32')]));_0x5a723d['attributes']=_0x5a723d['attributes'][_0xfc86('0x33')]?_0x5a723d['attributes']:_0x1e3fab['model'];if(!_0x5999de[_0xfc86('0x2d')][_0xfc86('0x34')]('nolimit')){_0x5a723d['limit']=qs[_0xfc86('0x36')](_0x5999de[_0xfc86('0x2d')]['limit']);_0x5a723d[_0xfc86('0x20')]=qs[_0xfc86('0x20')](_0x5999de[_0xfc86('0x2d')][_0xfc86('0x20')]);}_0x5a723d[_0xfc86('0x37')]=qs['sort'](_0x5999de[_0xfc86('0x2d')][_0xfc86('0x38')]);_0x5a723d[_0xfc86('0x3a')]=qs[_0xfc86('0x2f')](_[_0xfc86('0x73')](_0x5999de[_0xfc86('0x2d')],_0x1e3fab['filters']));if(_0x5999de['query']['filter']){_0x5a723d[_0xfc86('0x3a')]=_[_0xfc86('0x3b')](_0x5a723d[_0xfc86('0x3a')],{'$or':_['map'](_0x13d6c5,function(_0x4a5ef0){if(_0x4a5ef0[_0xfc86('0x74')][_0xfc86('0x29')]!==_0xfc86('0x75')){var _0x44abfc={};_0x44abfc[_0x4a5ef0[_0xfc86('0x76')]]={'$like':'%'+_0x5999de[_0xfc86('0x2d')][_0xfc86('0x39')]+'%'};return _0x44abfc;}})});}var _0x46d9b6=[];if(_0x1b4b11){var _0x48452c=_[_0xfc86('0x42')](_0x259e50,[_0xfc86('0x2c'),_0x1b4b11['name']]);if(_0x48452c['field']){var _0x28bad9={};if(_0x3cdbb2[_0xfc86('0x72')]==='AnalyticExtractedReport'){_0x28bad9[_0x48452c['foreignKey']]=_[_0xfc86('0x2b')](_0x1b4b11[_0xfc86('0x77')],'id');}else{_0x28bad9[_0x48452c['foreignKey']]=_0x1b4b11[_0xfc86('0x77')];}_0x46d9b6[_0xfc86('0x5d')](_0x28bad9);}else{_0x5a723d[_0xfc86('0x3a')]['id']=_0x1b4b11[_0xfc86('0x77')];}}else{for(var _0x310728=0x0;_0x310728<_0x450bac[_0xfc86('0x33')];_0x310728++){var _0x48452c=_[_0xfc86('0x42')](_0x259e50,['name',_0x450bac[_0x310728][_0xfc86('0x2c')]]);if(_0x48452c[_0xfc86('0x76')]){var _0x28bad9={};_0x28bad9[_0x48452c[_0xfc86('0x78')]]=_0x450bac[_0x310728]['associatedResources'];_0x46d9b6[_0xfc86('0x5d')](_0x28bad9);}else{if(!_0x5a723d[_0xfc86('0x3a')]['id'])_0x5a723d[_0xfc86('0x3a')]['id']=[];_0x450bac[_0x310728]['associatedResources']['forEach'](function(_0x3b837f){_0x5a723d[_0xfc86('0x3a')]['id'][_0xfc86('0x5d')](_0x3b837f);});}}}if(!_['isEmpty'](_0x46d9b6)){_0x5a723d[_0xfc86('0x3a')]=_[_0xfc86('0x3b')](_0x5a723d[_0xfc86('0x3a')],{'$and':{'$or':_0x46d9b6}});}_0x5a723d=_[_0xfc86('0x3b')]({},_0x5a723d,_0x5999de[_0xfc86('0x3c')]);if(_0x1b4b11&&!_0x1b4b11[_0xfc86('0x4e')]&&_0x3cdbb2[_0xfc86('0x72')]==='AnalyticExtractedReport'){if(_0x5999de['query'][_0xfc86('0x3d')]){_0x5a723d[_0xfc86('0x3e')]=[{'all':!![]}];}return db[_0x3cdbb2['childModel']][_0xfc86('0x3f')](_0x5a723d)[_0xfc86('0x23')](function(_0x1751ac){var _0x50d07a=[];_0x1751ac[_0xfc86('0x5f')](function(_0x338a47){var _0x38baf7;switch(_0x338a47[_0xfc86('0x79')]){case _0xfc86('0x7a'):_0x38baf7=_['find'](_0x1b4b11['associatedResources'],function(_0x414aaa){return _0x414aaa['id']===_0x338a47[_0xfc86('0x7b')]&&_0x414aaa[_0xfc86('0x74')]==='DefaultReports';});break;case'custom':_0x38baf7=_[_0xfc86('0x42')](_0x1b4b11[_0xfc86('0x77')],function(_0x451630){return _0x451630['id']===_0x338a47[_0xfc86('0x7b')]&&_0x451630[_0xfc86('0x74')]==='CustomReports';});break;}if(_0x38baf7)_0x50d07a[_0xfc86('0x5d')](_0x338a47);});_0x332444[_0xfc86('0x1f')]=_0x50d07a['length'];_0x332444[_0xfc86('0x7c')]=_0x50d07a;return _0x332444;});}else{return db[_0x3cdbb2[_0xfc86('0x72')]][_0xfc86('0x1f')]({'where':_0x5a723d[_0xfc86('0x3a')]})[_0xfc86('0x23')](function(_0x415601){_0x332444[_0xfc86('0x1f')]=_0x415601;if(_0x5999de[_0xfc86('0x2d')]['includeAll']){if(_0x3cdbb2[_0xfc86('0x72')]==='CmContact'){_0x5a723d[_0xfc86('0x3e')]=[{'model':db[_0xfc86('0x7d')],'as':_0xfc86('0x7e'),'attributes':['id',_0xfc86('0x2c'),_0xfc86('0x7f')],'required':_0x5999de[_0xfc86('0x2d')][_0xfc86('0x80')]?!![]:![]},{'model':db[_0xfc86('0x7d')],'as':_0xfc86('0x81'),'attributes':['id','name',_0xfc86('0x7f')],'through':_0x5999de[_0xfc86('0x2d')][_0xfc86('0x80')]?{'attributes':[],'where':{'TagId':_0x5999de[_0xfc86('0x2d')]['tag']||undefined}}:{},'required':_0x5999de[_0xfc86('0x2d')][_0xfc86('0x80')]?!![]:![]}];}else{_0x5a723d[_0xfc86('0x3e')]=[{'all':!![]}];}}return db[_0x3cdbb2[_0xfc86('0x72')]]['findAll'](_0x5a723d);})[_0xfc86('0x23')](function(_0x26352a){_0x332444[_0xfc86('0x7c')]=_0x26352a;return _0x332444;});}}else{return _0x332444;}})['then'](respondWithFilteredResult(_0xfa1a08,_0x5a723d))[_0xfc86('0x43')](handleError(_0xfa1a08,null));};function getAllResources(_0x325d0c,_0x55a15c){return new BPromise(function(_0xd647cb,_0x29dc1c){if(_0x55a15c){var _0x2c3708=_0x55a15c[_0xfc86('0x39')]?{[_0x55a15c['filter'][_0xfc86('0x76')]]:_0x55a15c[_0xfc86('0x39')][_0xfc86('0x82')]}:undefined;return db[_0x325d0c]['findAll']({'where':_0x2c3708,'raw':!![]})['then'](function(_0xd409bc){_0x55a15c['associatedResources']=_[_0xfc86('0x2b')](_0xd409bc,'id');_0xd647cb(_0x55a15c);})[_0xfc86('0x43')](function(_0x3a8d02){_0x29dc1c(_0x3a8d02);});}else{_0xd647cb(null);}});}function getAllFilteredResources(_0x1df586,_0x4d5f53){return new BPromise(function(_0x3f3fe0,_0xb2983b){var _0x26cea8=_0x1df586[_0xfc86('0x39')]?{[_0x1df586['filter'][_0xfc86('0x76')]]:_0x1df586[_0xfc86('0x39')][_0xfc86('0x82')]}:undefined;return db[_0x1df586[_0xfc86('0x2a')]][_0xfc86('0x3f')]({'where':_0x26cea8,'raw':!![]})[_0xfc86('0x23')](function(_0x3e8a10){_0x4d5f53[_0xfc86('0x77')]=_[_0xfc86('0x2b')](_0x3e8a10,function(_0x34b84f){return _0x34b84f[_0xfc86('0x2c')];});_0x3f3fe0(_0x4d5f53);})['catch'](function(_0x57b607){_0xb2983b(_0x57b607);});});}function getAllowedResources(_0x153b7d,_0x3d0399,_0x18a618){return new BPromise(function(_0x1eea63,_0x159405){if(_0x3d0399){return db[_0xfc86('0x52')]['findAll']({'where':{'sectionId':_0x3d0399['id']},'raw':!![]})[_0xfc86('0x23')](function(_0x44d6ff){if(_0x153b7d[_0xfc86('0x76')]&&_0x153b7d[_0xfc86('0x76')]!=='id'){_0x3d0399[_0xfc86('0x77')]=_['map'](_0x44d6ff,function(_0x796a48){return _0x796a48[_0x153b7d[_0xfc86('0x76')]];});}else{if(_0x18a618==='AnalyticExtractedReport'){_0x3d0399['associatedResources']=_[_0xfc86('0x2b')](_0x44d6ff,function(_0x996da8){return{'id':_0x996da8[_0xfc86('0x60')],'type':_0x996da8[_0xfc86('0x74')]};});}else{_0x3d0399['associatedResources']=_[_0xfc86('0x2b')](_0x44d6ff,function(_0x56c7bc){return _0x56c7bc[_0xfc86('0x60')];});}}_0x1eea63(_0x3d0399);})[_0xfc86('0x43')](function(_0x2cc39b){_0x159405(_0x2cc39b);});}else{_0x1eea63(null);}});}function getQueryModels(_0x1312fd,_0x4f79e1){var _0x4a5b51=_0x1312fd[_0xfc86('0x83')]();var _0x1fd847={'childModel':undefined,'parentSections':[]};switch(_0x4a5b51){case _0xfc86('0x84'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x85');break;case _0xfc86('0x86'):_0x1fd847[_0xfc86('0x72')]='SquareOdbc';break;case _0xfc86('0x87'):_0x1fd847[_0xfc86('0x72')]='SquareRecording';_0x1fd847['parentSections']=[{'name':'SquareProjects','field':'name','foreignKey':_0xfc86('0x88')}];break;case'projects':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x89');break;case _0xfc86('0x8a'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x8b');_0x1fd847[_0xfc86('0x6e')]=[{'name':_0xfc86('0x8c'),'field':'id','foreignKey':_0xfc86('0x8d')}];break;case _0xfc86('0x8e'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x8f');break;case _0xfc86('0x90'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x91');break;case'globalcustomfields':_0x1fd847['childModel']=_0xfc86('0x92');break;case'chatqueues':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x93');break;case _0xfc86('0x94'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x95');break;case _0xfc86('0x96'):_0x1fd847[_0xfc86('0x72')]='FaxQueue';break;case _0xfc86('0x97'):_0x1fd847['childModel']='FaxAccount';break;case'inboundroutes':case _0xfc86('0x98'):case'outboundroutes':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x99');break;case _0xfc86('0x9a'):_0x1fd847['childModel']=_0xfc86('0x9b');break;case'voicemails':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0x9c');break;case'voicerecordings':_0x1fd847['childModel']=_0xfc86('0x9d');_0x1fd847[_0xfc86('0x6e')]=[{'name':_0xfc86('0x9e'),'field':'name','foreignKey':'membername','model':_0xfc86('0x9f'),'filter':{'field':_0xfc86('0xa0'),'value':['agent']}},{'name':_0xfc86('0xa1'),'field':_0xfc86('0x2c'),'foreignKey':_0xfc86('0xa2'),'model':'User','filter':{'field':_0xfc86('0xa0'),'value':[_0xfc86('0xa3')]}},{'name':_0xfc86('0xa4'),'field':'name','foreignKey':_0xfc86('0xa5'),'model':_0xfc86('0xa6'),'filter':{'field':_0xfc86('0x74'),'value':[_0xfc86('0xa7')]}},{'name':_0xfc86('0xa8'),'field':_0xfc86('0x2c'),'foreignKey':_0xfc86('0xa5'),'model':'VoiceQueue','filter':{'field':_0xfc86('0x74'),'value':[_0xfc86('0xa9')]}}];break;case'musiconholds':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xaa');break;case _0xfc86('0xab'):_0x1fd847['childModel']=_0xfc86('0xac');break;case _0xfc86('0xad'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xae');break;case _0xfc86('0xaf'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb0');break;case _0xfc86('0xb1'):_0x1fd847['childModel']=_0xfc86('0xb2');break;case'mailaccounts':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb3');break;case _0xfc86('0xb4'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb5');break;case _0xfc86('0xb6'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xb7');break;case _0xfc86('0xb8'):_0x1fd847[_0xfc86('0x72')]='OpenchannelAccount';break;case'smsqueues':_0x1fd847['childModel']=_0xfc86('0xb9');break;case _0xfc86('0xba'):_0x1fd847['childModel']=_0xfc86('0xbb');break;case _0xfc86('0xbc'):_0x1fd847[_0xfc86('0x72')]='WhatsappQueue';break;case'whatsappaccounts':_0x1fd847[_0xfc86('0x72')]='WhatsappAccount';break;case _0xfc86('0xbd'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xbe');break;case _0xfc86('0xbf'):case'queuecampaigns':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xa6');if(_0x4f79e1){_0x1fd847[_0xfc86('0x6e')]=[{'name':_0xfc86('0xa4')},{'name':_0xfc86('0xa8')}];}break;case _0xfc86('0xc0'):case _0xfc86('0xc1'):case'telephones':_0x1fd847['childModel']=_0xfc86('0x9f');if(_0x4f79e1){_0x1fd847[_0xfc86('0x6e')]=[{'name':'Users','filter':{'field':_0xfc86('0xa0'),'value':[_0xfc86('0xc2'),_0xfc86('0xc3')]},'ignore':!![]},{'name':_0xfc86('0x9e')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xc4');break;case _0xfc86('0xc5'):_0x1fd847[_0xfc86('0x72')]='SalesforceAccount';break;case _0xfc86('0xc6'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xc7');break;case'sugarcrmaccounts':_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xc8');break;case _0xfc86('0xc9'):_0x1fd847[_0xfc86('0x72')]='DeskAccount';break;case _0xfc86('0xca'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xcb');break;case _0xfc86('0xcc'):_0x1fd847['childModel']=_0xfc86('0x9f');break;case'cannedanswers':_0x1fd847['childModel']=_0xfc86('0xcd');break;case _0xfc86('0xce'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xcf');break;case _0xfc86('0xd0'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd1');break;case _0xfc86('0xd2'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd3');break;case _0xfc86('0xd4'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd5');break;case _0xfc86('0xd6'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd7');break;case _0xfc86('0xd8'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xd9');break;case _0xfc86('0xda'):_0x1fd847[_0xfc86('0x72')]='Tag';break;case _0xfc86('0xdb'):_0x1fd847[_0xfc86('0x72')]='Template';break;case _0xfc86('0xdc'):_0x1fd847[_0xfc86('0x72')]='Trigger';break;case'trunks':_0x1fd847[_0xfc86('0x72')]='Trunk';break;case _0xfc86('0xdd'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xde');break;case _0xfc86('0xdf'):_0x1fd847['childModel']=_0xfc86('0x61');break;case _0xfc86('0xe0'):_0x1fd847['childModel']=_0xfc86('0xe1');_0x1fd847['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0xfc86('0x7b')}];break;case _0xfc86('0xe2'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xe3');break;case _0xfc86('0xe4'):_0x1fd847[_0xfc86('0x72')]=_0xfc86('0xe5');break;default:return _0x1fd847;}return _0x1fd847;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 10fb036..094c501 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 _0x1af3=['../../mysqldb','UserProfile','update','remove','emit','hook'];(function(_0xa9937f,_0x314462){var _0x14a138=function(_0x5bf5b3){while(--_0x5bf5b3){_0xa9937f['push'](_0xa9937f['shift']());}};_0x14a138(++_0x314462);}(_0x1af3,0x12c));var _0x31af=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0x1af3[_0x3f8282];return _0x50f918;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x31af('0x0'))['db'][_0x31af('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x31af('0x2'),'afterDestroy':_0x31af('0x3')};function emitEvent(_0x394f43){return function(_0x4563ba,_0x58ee6c,_0x352540){UserProfileEvents[_0x31af('0x4')](_0x394f43+':'+_0x4563ba['id'],_0x4563ba);UserProfileEvents['emit'](_0x394f43,_0x4563ba);_0x352540(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x31af('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x5b04=['UserProfile','setMaxListeners','update','remove','emit','hook','exports','../../mysqldb'];(function(_0xb913f1,_0x54241f){var _0x5060d3=function(_0x3ba582){while(--_0x3ba582){_0xb913f1['push'](_0xb913f1['shift']());}};_0x5060d3(++_0x54241f);}(_0x5b04,0x67));var _0x45b0=function(_0x333f92,_0x55b17e){_0x333f92=_0x333f92-0x0;var _0x11c2bf=_0x5b04[_0x333f92];return _0x11c2bf;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x45b0('0x0'))['db'][_0x45b0('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x45b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x45b0('0x3'),'afterDestroy':_0x45b0('0x4')};function emitEvent(_0x4bd0e1){return function(_0x38555b,_0x5b4c0e,_0x580bca){UserProfileEvents[_0x45b0('0x5')](_0x4bd0e1+':'+_0x38555b['id'],_0x38555b);UserProfileEvents[_0x45b0('0x5')](_0x4bd0e1,_0x38555b);_0x580bca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x45b0('0x6')](e,emitEvent(event));}}module[_0x45b0('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 188bb90..0edd5e8 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 _0xcdd6=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfile','user_profiles'];(function(_0x46ae6e,_0x186f98){var _0x1d1971=function(_0x237b58){while(--_0x237b58){_0x46ae6e['push'](_0x46ae6e['shift']());}};_0x1d1971(++_0x186f98);}(_0xcdd6,0xb6));var _0x6cdd=function(_0x5cb790,_0x3f2b5d){_0x5cb790=_0x5cb790-0x0;var _0x276009=_0xcdd6[_0x5cb790];return _0x276009;};'use strict';var _=require(_0x6cdd('0x0'));var util=require(_0x6cdd('0x1'));var logger=require(_0x6cdd('0x2'))('api');var moment=require(_0x6cdd('0x3'));var BPromise=require(_0x6cdd('0x4'));var rp=require(_0x6cdd('0x5'));var fs=require('fs');var path=require(_0x6cdd('0x6'));var rimraf=require(_0x6cdd('0x7'));var config=require(_0x6cdd('0x8'));var attributes=require('./userProfile.attributes');module[_0x6cdd('0x9')]=function(_0x5aab35,_0x2e3024){return _0x5aab35[_0x6cdd('0xa')](_0x6cdd('0xb'),attributes,{'tableName':_0x6cdd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xceba=['./userProfile.attributes','exports','define','UserProfile','user_profiles','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0xceba,0x10d));var _0xaceb=function(_0x59b6fb,_0x43b483){_0x59b6fb=_0x59b6fb-0x0;var _0x488457=_0xceba[_0x59b6fb];return _0x488457;};'use strict';var _=require('lodash');var util=require(_0xaceb('0x0'));var logger=require(_0xaceb('0x1'))('api');var moment=require(_0xaceb('0x2'));var BPromise=require(_0xaceb('0x3'));var rp=require(_0xaceb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaceb('0x5'));var config=require(_0xaceb('0x6'));var attributes=require(_0xaceb('0x7'));module[_0xaceb('0x8')]=function(_0xd9c6c9,_0x30ca74){return _0xd9c6c9[_0xaceb('0x9')](_0xaceb('0xa'),attributes,{'tableName':_0xaceb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ad1f7f9..ad23850 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 _0x7dfd=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var moment=require(_0xd7df('0x2'));var BPromise=require(_0xd7df('0x3'));var rs=require(_0xd7df('0x4'));var fs=require('fs');var Redis=require(_0xd7df('0x5'));var db=require(_0xd7df('0x6'))['db'];var utils=require(_0xd7df('0x7'));var logger=require(_0xd7df('0x8'))(_0xd7df('0x9'));var config=require(_0xd7df('0xa'));var jayson=require(_0xd7df('0xb'));var client=jayson[_0xd7df('0xc')][_0xd7df('0xd')]({'port':0x232a});config[_0xd7df('0xe')]=_[_0xd7df('0xf')](config[_0xd7df('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xd7df('0x10'))(new Redis(config[_0xd7df('0xe')]));require(_0xd7df('0x11'))[_0xd7df('0x12')](socket);function respondWithRpcPromise(_0x5e59c3,_0x32c5b5,_0x532c14){return new BPromise(function(_0x183ace,_0x567e83){return client[_0xd7df('0x13')](_0x5e59c3,_0x532c14)[_0xd7df('0x14')](function(_0x28d358){logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,_0xd7df('0x17'));logger[_0xd7df('0x18')](_0xd7df('0x19'),_0x32c5b5,_0xd7df('0x17'),JSON[_0xd7df('0x1a')](_0x28d358));if(_0x28d358[_0xd7df('0x1b')]){if(_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1c')]===0x1f4){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x567e83(_0x28d358['error'][_0xd7df('0x1d')]);}logger[_0xd7df('0x1b')]('UserProfile,\x20%s,\x20%s',_0x32c5b5,_0x28d358[_0xd7df('0x1b')][_0xd7df('0x1d')]);return _0x183ace(_0x28d358['error'][_0xd7df('0x1d')]);}else{logger[_0xd7df('0x15')](_0xd7df('0x16'),_0x32c5b5,'request\x20sent');_0x183ace(_0x28d358[_0xd7df('0x1e')][_0xd7df('0x1d')]);}})[_0xd7df('0x1f')](function(_0x5ba653){logger[_0xd7df('0x1b')](_0xd7df('0x16'),_0x32c5b5,_0x5ba653);_0x567e83(_0x5ba653);});});} \ No newline at end of file +var _0x71ab=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','request\x20sent','stringify','error','message','UserProfile,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x176af6,_0x40909e){var _0x1662a0=function(_0x2d47c3){while(--_0x2d47c3){_0x176af6['push'](_0x176af6['shift']());}};_0x1662a0(++_0x40909e);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});config[_0xb71a('0xb')]=_[_0xb71a('0xc')](config[_0xb71a('0xb')],{'host':_0xb71a('0xd'),'port':0x18eb});var socket=require(_0xb71a('0xe'))(new Redis(config[_0xb71a('0xb')]));require(_0xb71a('0xf'))[_0xb71a('0x10')](socket);function respondWithRpcPromise(_0x2e8883,_0x517eed,_0xfec897){return new BPromise(function(_0x58956d,_0x3d7bd7){return client[_0xb71a('0x11')](_0x2e8883,_0xfec897)[_0xb71a('0x12')](function(_0x591311){logger[_0xb71a('0x13')]('UserProfile,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x517eed,_0xb71a('0x14'),JSON[_0xb71a('0x15')](_0x591311));if(_0x591311[_0xb71a('0x16')]){if(_0x591311[_0xb71a('0x16')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x3d7bd7(_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);}logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x591311[_0xb71a('0x16')][_0xb71a('0x17')]);return _0x58956d(_0x591311[_0xb71a('0x16')]['message']);}else{logger[_0xb71a('0x13')](_0xb71a('0x18'),_0x517eed,_0xb71a('0x14'));_0x58956d(_0x591311[_0xb71a('0x19')][_0xb71a('0x17')]);}})[_0xb71a('0x1a')](function(_0x349de1){logger[_0xb71a('0x16')](_0xb71a('0x18'),_0x517eed,_0x349de1);_0x3d7bd7(_0x349de1);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 2be354d..8703bb1 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 _0xf35a=['userProfile:','./userProfile.events','save','update','register','length'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xf35a,0xa3));var _0xaf35=function(_0x14361d,_0x4aa821){_0x14361d=_0x14361d-0x0;var _0x518d84=_0xf35a[_0x14361d];return _0x518d84;};'use strict';var UserProfileEvents=require(_0xaf35('0x0'));var events=[_0xaf35('0x1'),'remove',_0xaf35('0x2')];function createListener(_0x5499d9,_0x459773){return function(_0x3ca82d){_0x459773['emit'](_0x5499d9,_0x3ca82d);};}function removeListener(_0x15d2ce,_0x5a8b70){return function(){UserProfileEvents['removeListener'](_0x15d2ce,_0x5a8b70);};}exports[_0xaf35('0x3')]=function(_0x34276e){for(var _0x11b867=0x0,_0x5f5549=events[_0xaf35('0x4')];_0x11b867<_0x5f5549;_0x11b867++){var _0x351f11=events[_0x11b867];var _0x174f26=createListener(_0xaf35('0x5')+_0x351f11,_0x34276e);UserProfileEvents['on'](_0x351f11,_0x174f26);}}; \ No newline at end of file +var _0xdf17=['emit','removeListener','length','save','update'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0xdf17,0x76));var _0x7df1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xdf17[_0x4cf98e];return _0x1623ac;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x7df1('0x0'),'remove',_0x7df1('0x1')];function createListener(_0x3bd77b,_0x3797c5){return function(_0x2775b6){_0x3797c5[_0x7df1('0x2')](_0x3bd77b,_0x2775b6);};}function removeListener(_0x17625c,_0x5e7cb3){return function(){UserProfileEvents[_0x7df1('0x3')](_0x17625c,_0x5e7cb3);};}exports['register']=function(_0x5e4c99){for(var _0x5a8574=0x0,_0x41fa7b=events[_0x7df1('0x4')];_0x5a8574<_0x41fa7b;_0x5a8574++){var _0x55b184=events[_0x5a8574];var _0x33c7e2=createListener('userProfile:'+_0x55b184,_0x5e4c99);UserProfileEvents['on'](_0x55b184,_0x33c7e2);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f3075c3..a2816fe 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 _0x75e9=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe'];(function(_0xa41c6f,_0x448437){var _0xccef80=function(_0x3e98df){while(--_0x3e98df){_0xa41c6f['push'](_0xa41c6f['shift']());}};_0xccef80(++_0x448437);}(_0x75e9,0x1c1));var _0x975e=function(_0x5ea279,_0x101cc5){_0x5ea279=_0x5ea279-0x0;var _0x352b69=_0x75e9[_0x5ea279];return _0x352b69;};'use strict';var multer=require('multer');var util=require(_0x975e('0x0'));var path=require(_0x975e('0x1'));var timeout=require(_0x975e('0x2'));var express=require(_0x975e('0x3'));var router=express[_0x975e('0x4')]();var auth=require(_0x975e('0x5'));var interaction=require(_0x975e('0x6'));var config=require(_0x975e('0x7'));var controller=require(_0x975e('0x8'));router['get']('/',auth[_0x975e('0x9')](),controller[_0x975e('0xa')]);router[_0x975e('0xb')](_0x975e('0xc'),auth[_0x975e('0x9')](),controller['describe']);router[_0x975e('0xb')](_0x975e('0xd'),auth[_0x975e('0x9')](),controller[_0x975e('0xe')]);router[_0x975e('0xf')]('/',auth[_0x975e('0x9')](),controller[_0x975e('0x10')]);router[_0x975e('0x11')]('/:id',auth[_0x975e('0x9')](),controller[_0x975e('0x12')]);router[_0x975e('0x13')]('/:id',auth[_0x975e('0x9')](),controller[_0x975e('0x14')]);module[_0x975e('0x15')]=router; \ No newline at end of file +var _0x89f4=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','show','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x1bd85d,_0xdc683f){var _0xd40669=function(_0x318648){while(--_0x318648){_0x1bd85d['push'](_0x1bd85d['shift']());}};_0xd40669(++_0xdc683f);}(_0x89f4,0x17a));var _0x489f=function(_0x2a1d4f,_0x14ca08){_0x2a1d4f=_0x2a1d4f-0x0;var _0xfccfb3=_0x89f4[_0x2a1d4f];return _0xfccfb3;};'use strict';var multer=require('multer');var util=require(_0x489f('0x0'));var path=require(_0x489f('0x1'));var timeout=require('connect-timeout');var express=require(_0x489f('0x2'));var router=express[_0x489f('0x3')]();var auth=require(_0x489f('0x4'));var interaction=require(_0x489f('0x5'));var config=require(_0x489f('0x6'));var controller=require(_0x489f('0x7'));router[_0x489f('0x8')]('/',auth[_0x489f('0x9')](),controller['index']);router[_0x489f('0x8')](_0x489f('0xa'),auth[_0x489f('0x9')](),controller[_0x489f('0xb')]);router[_0x489f('0x8')]('/:id',auth[_0x489f('0x9')](),controller[_0x489f('0xc')]);router[_0x489f('0xd')]('/',auth[_0x489f('0x9')](),controller[_0x489f('0xe')]);router[_0x489f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x489f('0x10')]);router[_0x489f('0x11')]('/:id',auth[_0x489f('0x9')](),controller[_0x489f('0x12')]);module[_0x489f('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index be2e98e..f4df2d8 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 _0x8737=['INTEGER','STRING','sequelize'];(function(_0x48168a,_0xf9dfe5){var _0x346d98=function(_0x22e41f){while(--_0x22e41f){_0x48168a['push'](_0x48168a['shift']());}};_0x346d98(++_0xf9dfe5);}(_0x8737,0x13d));var _0x7873=function(_0x3d93de,_0x2da4bd){_0x3d93de=_0x3d93de-0x0;var _0xedef58=_0x8737[_0x3d93de];return _0xedef58;};'use strict';var Sequelize=require(_0x7873('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7873('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7873('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xacc6=['INTEGER','exports','STRING'];(function(_0x47ba4d,_0x36d47d){var _0x1aa181=function(_0x446688){while(--_0x446688){_0x47ba4d['push'](_0x47ba4d['shift']());}};_0x1aa181(++_0x36d47d);}(_0xacc6,0x109));var _0x6acc=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0xacc6[_0x3cb6dc];return _0x47ec89;};'use strict';var Sequelize=require('sequelize');module[_0x6acc('0x0')]={'name':{'type':Sequelize[_0x6acc('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x6acc('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 8754672..39309ea 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 _0x9c5a=['params','keys','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch'];(function(_0x5d4390,_0x21b7d8){var _0x4f3e01=function(_0x42372f){while(--_0x42372f){_0x5d4390['push'](_0x5d4390['shift']());}};_0x4f3e01(++_0x21b7d8);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x18e81c,_0x4cdb7c){_0x18e81c=_0x18e81c-0x0;var _0x19849c=_0x9c5a[_0x18e81c];return _0x19849c;};'use strict';var pdf=require(_0xa9c5('0x0'));var emlformat=require(_0xa9c5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa9c5('0x2'));var jsonpatch=require(_0xa9c5('0x3'));var rp=require(_0xa9c5('0x4'));var moment=require(_0xa9c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9c5('0x6'));var util=require(_0xa9c5('0x7'));var path=require('path');var sox=require(_0xa9c5('0x8'));var csv=require('to-csv');var ejs=require(_0xa9c5('0x9'));var fs=require('fs');var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=_0x19a43e[_0xa9c5('0x1b')],_0x4bb57e=_0x40b001['offset'],_0x2b0d73=_0x40b001[_0xa9c5('0x1c')]+_0x40b001[_0xa9c5('0x1d')],_0xd85c32;if(_0x2b0d73>=_0xcf13f2){_0x2b0d73=_0xcf13f2;_0xd85c32=0xc8;}else{_0xd85c32=0xce;}_0x251099[_0xa9c5('0x19')](_0xd85c32);return _0x251099[_0xa9c5('0x1e')](_0xa9c5('0x1f'),_0x4bb57e+'-'+_0x2b0d73+'/'+_0xcf13f2)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x3b8d4d){return function(_0x1e5ce6){try{jsonpatch[_0xa9c5('0x20')](_0x1e5ce6,_0x3b8d4d,!![]);}catch(_0x36c486){return BPromise[_0xa9c5('0x21')](_0x36c486);}return _0x1e5ce6[_0xa9c5('0x22')]();};}function saveUpdates(_0x54f8b9,_0x1115ad){return function(_0x21ab50){if(_0x21ab50){return _0x21ab50['update'](_0x54f8b9)['then'](function(_0xce9af6){return _0xce9af6;});}return null;};}function removeEntity(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')]()[_0xa9c5('0x24')](function(){_0x366f5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4e1b,_0x11d395){return function(_0x4b0f05){if(!_0x4b0f05){_0x3d4e1b[_0xa9c5('0x17')](0x194);}return _0x4b0f05;};}function handleError(_0x424b4c,_0x306c9b){_0x306c9b=_0x306c9b||0x1f4;return function(_0x32fc7d){logger[_0xa9c5('0x25')](_0x32fc7d[_0xa9c5('0x26')]);if(_0x32fc7d[_0xa9c5('0x27')]){delete _0x32fc7d['name'];}_0x424b4c['status'](_0x306c9b)[_0xa9c5('0x28')](_0x32fc7d);};}exports['index']=function(_0x1762ac,_0x830bad){var _0x4caefa={},_0x11a723={},_0x320dc0={'count':0x0,'rows':[]};var _0x5f468b=_[_0xa9c5('0x29')](db[_0xa9c5('0x2a')][_0xa9c5('0x2b')],function(_0x185eb8){return{'name':_0x185eb8[_0xa9c5('0x2c')],'type':_0x185eb8['type'][_0xa9c5('0x2d')]};});_0x11a723['model']=_[_0xa9c5('0x29')](_0x5f468b,_0xa9c5('0x27'));_0x11a723[_0xa9c5('0x2e')]=_['keys'](_0x1762ac[_0xa9c5('0x2e')]);_0x11a723[_0xa9c5('0x2f')]=_['intersection'](_0x11a723[_0xa9c5('0x30')],_0x11a723[_0xa9c5('0x2e')]);_0x4caefa[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x11a723[_0xa9c5('0x30')],qs[_0xa9c5('0x33')](_0x1762ac[_0xa9c5('0x2e')]['fields']));_0x4caefa[_0xa9c5('0x31')]=_0x4caefa[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x4caefa[_0xa9c5('0x31')]:_0x11a723[_0xa9c5('0x30')];if(!_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x4caefa['limit']=qs['limit'](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1d')]);_0x4caefa[_0xa9c5('0x1c')]=qs[_0xa9c5('0x1c')](_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x1c')]);}_0x4caefa['order']=qs['sort'](_0x1762ac['query'][_0xa9c5('0x37')]);_0x4caefa[_0xa9c5('0x38')]=qs['filters'](_[_0xa9c5('0x39')](_0x1762ac['query'],_0x11a723[_0xa9c5('0x2f')]),_0x5f468b);if(_0x1762ac[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x4caefa[_0xa9c5('0x38')]=_['merge'](_0x4caefa[_0xa9c5('0x38')],{'$or':_[_0xa9c5('0x29')](_0x5f468b,function(_0x191153){if(_0x191153[_0xa9c5('0x3b')]!==_0xa9c5('0x3c')){var _0x17ef8e={};_0x17ef8e[_0x191153[_0xa9c5('0x27')]]={'$like':'%'+_0x1762ac[_0xa9c5('0x2e')]['filter']+'%'};return _0x17ef8e;}})});}_0x4caefa=_[_0xa9c5('0x3d')]({},_0x4caefa,_0x1762ac[_0xa9c5('0x3e')]);var _0x841c18={'where':_0x4caefa[_0xa9c5('0x38')]};return db[_0xa9c5('0x2a')][_0xa9c5('0x1b')](_0x841c18)['then'](function(_0x307736){_0x320dc0['count']=_0x307736;if(_0x1762ac[_0xa9c5('0x2e')]['includeAll']){_0x4caefa[_0xa9c5('0x3f')]=[{'all':!![]}];}return db[_0xa9c5('0x2a')][_0xa9c5('0x40')](_0x4caefa);})['then'](function(_0x12e19c){_0x320dc0[_0xa9c5('0x41')]=_0x12e19c;return _0x320dc0;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x830bad,_0x4caefa))[_0xa9c5('0x42')](handleError(_0x830bad,null));};exports['show']=function(_0x2dbb48,_0x97803f){var _0x3db918={'raw':![],'where':{'id':_0x2dbb48[_0xa9c5('0x43')]['id']}},_0x45668e={};_0x45668e['model']=_[_0xa9c5('0x44')](db['UserProfileResource'][_0xa9c5('0x2b')]);_0x45668e[_0xa9c5('0x2e')]=_[_0xa9c5('0x44')](_0x2dbb48[_0xa9c5('0x2e')]);_0x45668e[_0xa9c5('0x2f')]=_[_0xa9c5('0x32')](_0x45668e[_0xa9c5('0x30')],_0x45668e[_0xa9c5('0x2e')]);_0x3db918[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x45668e['model'],qs[_0xa9c5('0x33')](_0x2dbb48[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x3db918[_0xa9c5('0x31')]=_0x3db918[_0xa9c5('0x31')][_0xa9c5('0x34')]?_0x3db918['attributes']:_0x45668e[_0xa9c5('0x30')];if(_0x2dbb48[_0xa9c5('0x2e')]['includeAll']){_0x3db918['include']=[{'all':!![]}];}_0x3db918=_['merge']({},_0x3db918,_0x2dbb48['options']);return db['UserProfileResource'][_0xa9c5('0x45')](_0x3db918)[_0xa9c5('0x24')](handleEntityNotFound(_0x97803f,null))[_0xa9c5('0x24')](respondWithResult(_0x97803f,null))[_0xa9c5('0x42')](handleError(_0x97803f,null));};exports[_0xa9c5('0x46')]=function(_0x240c40,_0xec9c4){return db[_0xa9c5('0x2a')][_0xa9c5('0x46')](_0x240c40[_0xa9c5('0x47')],{})[_0xa9c5('0x24')](respondWithResult(_0xec9c4,0xc9))[_0xa9c5('0x42')](handleError(_0xec9c4,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){if(_0x4bf8b4['body']['id']){delete _0x4bf8b4[_0xa9c5('0x47')]['id'];}return db[_0xa9c5('0x2a')]['find']({'where':{'id':_0x4bf8b4['params']['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x1108f0,null))[_0xa9c5('0x24')](saveUpdates(_0x4bf8b4[_0xa9c5('0x47')],null))['then'](respondWithResult(_0x1108f0,null))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0xd03cec,_0x481f9c){return db[_0xa9c5('0x2a')][_0xa9c5('0x45')]({'where':{'id':_0xd03cec[_0xa9c5('0x43')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x481f9c,null))[_0xa9c5('0x24')](removeEntity(_0x481f9c,null))[_0xa9c5('0x42')](handleError(_0x481f9c,null));};exports['describe']=function(_0x4cd8e4,_0x54c60c){return db[_0xa9c5('0x2a')][_0xa9c5('0x49')]()[_0xa9c5('0x24')](respondWithResult(_0x54c60c,null))[_0xa9c5('0x42')](handleError(_0x54c60c,null));}; \ No newline at end of file +var _0x814b=['../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','error','name','send','index','UserProfileResource','rawAttributes','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','keys','intersection','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','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'];(function(_0x5d0ed1,_0x40669a){var _0x24987d=function(_0x36c8d6){while(--_0x36c8d6){_0x5d0ed1['push'](_0x5d0ed1['shift']());}};_0x24987d(++_0x40669a);}(_0x814b,0x1a2));var _0xb814=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x814b[_0x47623f];return _0x282ce8;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');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('0xb'));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'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){_0x3b267e['status'](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(!_0x457dac){_0x52b7a3[_0xb814('0x1b')](0x194);}return _0x457dac;};}function handleError(_0x208927,_0x1c8a2e){_0x1c8a2e=_0x1c8a2e||0x1f4;return function(_0xb9e57d){logger[_0xb814('0x26')](_0xb9e57d['stack']);if(_0xb9e57d[_0xb814('0x27')]){delete _0xb9e57d[_0xb814('0x27')];}_0x208927[_0xb814('0x1c')](_0x1c8a2e)[_0xb814('0x28')](_0xb9e57d);};}exports[_0xb814('0x29')]=function(_0x1d5965,_0x3f0150){var _0x1e4e89={},_0x5a6291={},_0x271aa8={'count':0x0,'rows':[]};var _0x328a08=_['map'](db[_0xb814('0x2a')][_0xb814('0x2b')],function(_0x530744){return{'name':_0x530744['fieldName'],'type':_0x530744[_0xb814('0x2c')][_0xb814('0x2d')]};});_0x5a6291['model']=_[_0xb814('0x2e')](_0x328a08,'name');_0x5a6291[_0xb814('0x2f')]=_['keys'](_0x1d5965['query']);_0x5a6291[_0xb814('0x30')]=_['intersection'](_0x5a6291[_0xb814('0x31')],_0x5a6291[_0xb814('0x2f')]);_0x1e4e89[_0xb814('0x32')]=_['intersection'](_0x5a6291['model'],qs[_0xb814('0x33')](_0x1d5965[_0xb814('0x2f')]['fields']));_0x1e4e89[_0xb814('0x32')]=_0x1e4e89[_0xb814('0x32')][_0xb814('0x34')]?_0x1e4e89[_0xb814('0x32')]:_0x5a6291[_0xb814('0x31')];if(!_0x1d5965[_0xb814('0x2f')][_0xb814('0x35')]('nolimit')){_0x1e4e89[_0xb814('0x36')]=qs[_0xb814('0x36')](_0x1d5965[_0xb814('0x2f')][_0xb814('0x36')]);_0x1e4e89[_0xb814('0x20')]=qs['offset'](_0x1d5965[_0xb814('0x2f')]['offset']);}_0x1e4e89[_0xb814('0x37')]=qs[_0xb814('0x38')](_0x1d5965[_0xb814('0x2f')]['sort']);_0x1e4e89[_0xb814('0x39')]=qs[_0xb814('0x30')](_['pick'](_0x1d5965[_0xb814('0x2f')],_0x5a6291[_0xb814('0x30')]),_0x328a08);if(_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]){_0x1e4e89[_0xb814('0x39')]=_[_0xb814('0x3b')](_0x1e4e89['where'],{'$or':_[_0xb814('0x2e')](_0x328a08,function(_0x4e4684){if(_0x4e4684[_0xb814('0x2c')]!=='VIRTUAL'){var _0x4492ef={};_0x4492ef[_0x4e4684['name']]={'$like':'%'+_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]+'%'};return _0x4492ef;}})});}_0x1e4e89=_['merge']({},_0x1e4e89,_0x1d5965['options']);var _0x5dd6bc={'where':_0x1e4e89['where']};return db[_0xb814('0x2a')][_0xb814('0x1f')](_0x5dd6bc)[_0xb814('0x24')](function(_0x42c2ed){_0x271aa8['count']=_0x42c2ed;if(_0x1d5965['query'][_0xb814('0x3c')]){_0x1e4e89['include']=[{'all':!![]}];}return db[_0xb814('0x2a')][_0xb814('0x3d')](_0x1e4e89);})[_0xb814('0x24')](function(_0x3063bf){_0x271aa8[_0xb814('0x3e')]=_0x3063bf;return _0x271aa8;})[_0xb814('0x24')](respondWithFilteredResult(_0x3f0150,_0x1e4e89))[_0xb814('0x3f')](handleError(_0x3f0150,null));};exports[_0xb814('0x40')]=function(_0x31989d,_0x4b6ff8){var _0x544d36={'raw':![],'where':{'id':_0x31989d[_0xb814('0x41')]['id']}},_0x5d26be={};_0x5d26be['model']=_[_0xb814('0x42')](db['UserProfileResource'][_0xb814('0x2b')]);_0x5d26be[_0xb814('0x2f')]=_[_0xb814('0x42')](_0x31989d[_0xb814('0x2f')]);_0x5d26be['filters']=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],_0x5d26be[_0xb814('0x2f')]);_0x544d36[_0xb814('0x32')]=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],qs['fields'](_0x31989d[_0xb814('0x2f')][_0xb814('0x33')]));_0x544d36[_0xb814('0x32')]=_0x544d36[_0xb814('0x32')][_0xb814('0x34')]?_0x544d36[_0xb814('0x32')]:_0x5d26be[_0xb814('0x31')];if(_0x31989d['query']['includeAll']){_0x544d36[_0xb814('0x44')]=[{'all':!![]}];}_0x544d36=_[_0xb814('0x3b')]({},_0x544d36,_0x31989d[_0xb814('0x45')]);return db[_0xb814('0x2a')][_0xb814('0x46')](_0x544d36)[_0xb814('0x24')](handleEntityNotFound(_0x4b6ff8,null))[_0xb814('0x24')](respondWithResult(_0x4b6ff8,null))[_0xb814('0x3f')](handleError(_0x4b6ff8,null));};exports[_0xb814('0x47')]=function(_0x344198,_0xe73300){return db['UserProfileResource'][_0xb814('0x47')](_0x344198[_0xb814('0x48')],{})['then'](respondWithResult(_0xe73300,0xc9))[_0xb814('0x3f')](handleError(_0xe73300,null));};exports['update']=function(_0x2fb0f7,_0x37866f){if(_0x2fb0f7[_0xb814('0x48')]['id']){delete _0x2fb0f7[_0xb814('0x48')]['id'];}return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x2fb0f7[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x37866f,null))[_0xb814('0x24')](saveUpdates(_0x2fb0f7[_0xb814('0x48')],null))['then'](respondWithResult(_0x37866f,null))['catch'](handleError(_0x37866f,null));};exports[_0xb814('0x25')]=function(_0x30f07b,_0x4156d8){return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x30f07b[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x4156d8,null))['then'](removeEntity(_0x4156d8,null))[_0xb814('0x3f')](handleError(_0x4156d8,null));};exports[_0xb814('0x49')]=function(_0xf27a6e,_0x5a916d){return db[_0xb814('0x2a')]['describe']()[_0xb814('0x24')](respondWithResult(_0x5a916d,null))['catch'](handleError(_0x5a916d,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 1c9c737..b603aab 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 _0x9ebe=['compositeIndex','resourceId','sectionId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource'];(function(_0x1eb552,_0x1e4c50){var _0x3cec47=function(_0x4e2b3d){while(--_0x4e2b3d){_0x1eb552['push'](_0x1eb552['shift']());}};_0x3cec47(++_0x1e4c50);}(_0x9ebe,0x111));var _0xe9eb=function(_0x6951f4,_0x3fcf32){_0x6951f4=_0x6951f4-0x0;var _0x54b8f2=_0x9ebe[_0x6951f4];return _0x54b8f2;};'use strict';var _=require(_0xe9eb('0x0'));var util=require(_0xe9eb('0x1'));var logger=require('../../config/logger')(_0xe9eb('0x2'));var moment=require('moment');var BPromise=require(_0xe9eb('0x3'));var rp=require(_0xe9eb('0x4'));var fs=require('fs');var path=require(_0xe9eb('0x5'));var rimraf=require(_0xe9eb('0x6'));var config=require(_0xe9eb('0x7'));var attributes=require(_0xe9eb('0x8'));module[_0xe9eb('0x9')]=function(_0x15e02b,_0x482782){return _0x15e02b[_0xe9eb('0xa')](_0xe9eb('0xb'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xe9eb('0xc'),'fields':[_0xe9eb('0xd'),_0xe9eb('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6516=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','lodash'];(function(_0x2dd976,_0x1b5dc4){var _0x2265fd=function(_0x270d24){while(--_0x270d24){_0x2dd976['push'](_0x2dd976['shift']());}};_0x2265fd(++_0x1b5dc4);}(_0x6516,0x176));var _0x6651=function(_0x4e7419,_0x14accf){_0x4e7419=_0x4e7419-0x0;var _0x101c4a=_0x6516[_0x4e7419];return _0x101c4a;};'use strict';var _=require(_0x6651('0x0'));var util=require(_0x6651('0x1'));var logger=require(_0x6651('0x2'))(_0x6651('0x3'));var moment=require(_0x6651('0x4'));var BPromise=require(_0x6651('0x5'));var rp=require(_0x6651('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6651('0x7'));var config=require(_0x6651('0x8'));var attributes=require(_0x6651('0x9'));module[_0x6651('0xa')]=function(_0x36ac4f,_0x110df4){return _0x36ac4f[_0x6651('0xb')](_0x6651('0xc'),attributes,{'tableName':_0x6651('0xd'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x6651('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 6e4e9f2..5dc3838 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 _0x6332=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x24caca,_0x5165ee){var _0x9e8a22=function(_0x5cad41){while(--_0x5cad41){_0x24caca['push'](_0x24caca['shift']());}};_0x9e8a22(++_0x5165ee);}(_0x6332,0x1d7));var _0x2633=function(_0x26f777,_0x33a75f){_0x26f777=_0x26f777-0x0;var _0x492f1b=_0x6332[_0x26f777];return _0x492f1b;};'use strict';var _=require(_0x2633('0x0'));var util=require(_0x2633('0x1'));var moment=require(_0x2633('0x2'));var BPromise=require(_0x2633('0x3'));var rs=require(_0x2633('0x4'));var fs=require('fs');var Redis=require(_0x2633('0x5'));var db=require(_0x2633('0x6'))['db'];var utils=require(_0x2633('0x7'));var logger=require(_0x2633('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2633('0x9'));var client=jayson['client'][_0x2633('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5df63f,_0x302111,_0x8b0015){return new BPromise(function(_0x5d995f,_0x1877cb){return client[_0x2633('0xb')](_0x5df63f,_0x8b0015)[_0x2633('0xc')](function(_0x35277c){logger[_0x2633('0xd')](_0x2633('0xe'),_0x302111,_0x2633('0xf'));logger[_0x2633('0x10')](_0x2633('0x11'),_0x302111,_0x2633('0xf'),JSON[_0x2633('0x12')](_0x35277c));if(_0x35277c[_0x2633('0x13')]){if(_0x35277c[_0x2633('0x13')]['code']===0x1f4){logger[_0x2633('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x302111,_0x35277c[_0x2633('0x13')]['message']);return _0x1877cb(_0x35277c[_0x2633('0x13')][_0x2633('0x14')]);}logger[_0x2633('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x302111,_0x35277c[_0x2633('0x13')][_0x2633('0x14')]);return _0x5d995f(_0x35277c['error'][_0x2633('0x14')]);}else{logger[_0x2633('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x302111,'request\x20sent');_0x5d995f(_0x35277c['result'][_0x2633('0x14')]);}})[_0x2633('0x15')](function(_0x205851){logger[_0x2633('0x13')](_0x2633('0xe'),_0x302111,_0x205851);_0x1877cb(_0x205851);});});} \ No newline at end of file +var _0xf548=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0xf548,0xe7));var _0x8f54=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xf548[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x8f54('0x0'));var util=require(_0x8f54('0x1'));var moment=require(_0x8f54('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f54('0x3'));var fs=require('fs');var Redis=require(_0x8f54('0x4'));var db=require(_0x8f54('0x5'))['db'];var utils=require(_0x8f54('0x6'));var logger=require(_0x8f54('0x7'))('rpc');var config=require(_0x8f54('0x8'));var jayson=require(_0x8f54('0x9'));var client=jayson[_0x8f54('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ccead,_0x59eb05,_0x364fe6){return new BPromise(function(_0x7b200c,_0x1b3033){return client[_0x8f54('0xb')](_0x5ccead,_0x364fe6)[_0x8f54('0xc')](function(_0x4da21d){logger[_0x8f54('0xd')](_0x8f54('0xe'),_0x59eb05,_0x8f54('0xf'));logger['debug'](_0x8f54('0x10'),_0x59eb05,'request\x20sent',JSON[_0x8f54('0x11')](_0x4da21d));if(_0x4da21d[_0x8f54('0x12')]){if(_0x4da21d['error']['code']===0x1f4){logger[_0x8f54('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x59eb05,_0x4da21d[_0x8f54('0x12')][_0x8f54('0x13')]);return _0x1b3033(_0x4da21d[_0x8f54('0x12')][_0x8f54('0x13')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x59eb05,_0x4da21d[_0x8f54('0x12')][_0x8f54('0x13')]);return _0x7b200c(_0x4da21d['error'][_0x8f54('0x13')]);}else{logger[_0x8f54('0xd')](_0x8f54('0xe'),_0x59eb05,_0x8f54('0xf'));_0x7b200c(_0x4da21d['result']['message']);}})[_0x8f54('0x14')](function(_0x5a25df){logger[_0x8f54('0x12')](_0x8f54('0xe'),_0x59eb05,_0x5a25df);_0x1b3033(_0x5a25df);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 18734ab..575b7a4 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 _0x1233=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','destroy','exports','util','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1233,0x1ca));var _0x3123=function(_0x492221,_0x9e2521){_0x492221=_0x492221-0x0;var _0x398bf9=_0x1233[_0x492221];return _0x398bf9;};'use strict';var multer=require('multer');var util=require(_0x3123('0x0'));var path=require(_0x3123('0x1'));var timeout=require('connect-timeout');var express=require(_0x3123('0x2'));var router=express[_0x3123('0x3')]();var auth=require(_0x3123('0x4'));var interaction=require(_0x3123('0x5'));var config=require(_0x3123('0x6'));var controller=require(_0x3123('0x7'));router[_0x3123('0x8')]('/',auth[_0x3123('0x9')](),controller[_0x3123('0xa')]);router[_0x3123('0x8')](_0x3123('0xb'),auth['isAuthenticated'](),controller[_0x3123('0xc')]);router['get']('/:id',auth[_0x3123('0x9')](),controller[_0x3123('0xd')]);router['post']('/',auth[_0x3123('0x9')](),controller[_0x3123('0xe')]);router[_0x3123('0xf')](_0x3123('0x10'),auth[_0x3123('0x9')](),controller[_0x3123('0x11')]);router['delete']('/:id',auth[_0x3123('0x9')](),controller[_0x3123('0x12')]);module[_0x3123('0x13')]=router; \ No newline at end of file +var _0x35a6=['express','Router','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x35a6,0x1dd));var _0x635a=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x35a6[_0x143a91];return _0x1906f5;};'use strict';var multer=require(_0x635a('0x0'));var util=require(_0x635a('0x1'));var path=require('path');var timeout=require(_0x635a('0x2'));var express=require(_0x635a('0x3'));var router=express[_0x635a('0x4')]();var auth=require(_0x635a('0x5'));var interaction=require(_0x635a('0x6'));var config=require('../../config/environment');var controller=require(_0x635a('0x7'));router[_0x635a('0x8')]('/',auth[_0x635a('0x9')](),controller[_0x635a('0xa')]);router[_0x635a('0x8')](_0x635a('0xb'),auth['isAuthenticated'](),controller[_0x635a('0xc')]);router[_0x635a('0x8')](_0x635a('0xd'),auth['isAuthenticated'](),controller[_0x635a('0xe')]);router[_0x635a('0xf')]('/',auth[_0x635a('0x9')](),controller[_0x635a('0x10')]);router[_0x635a('0x11')](_0x635a('0xd'),auth[_0x635a('0x9')](),controller['update']);router[_0x635a('0x12')](_0x635a('0xd'),auth[_0x635a('0x9')](),controller['destroy']);module[_0x635a('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index cde6651..0d440d9 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 _0x3870=['INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','STRING'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x3870,0x15b));var _0x0387=function(_0x57da06,_0x4c9d35){_0x57da06=_0x57da06-0x0;var _0x118c39=_0x3870[_0x57da06];return _0x118c39;};'use strict';var Sequelize=require(_0x0387('0x0'));module[_0x0387('0x1')]={'name':{'type':Sequelize[_0x0387('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x0387('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0387('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x0387('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0387('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0387('0x2')],'set':function(_0x3169a4){this[_0x0387('0x5')](_0x0387('0x6'),_0x3169a4?_0x3169a4[_0x0387('0x7')](''):[]);},'get':function(){return this[_0x0387('0x8')](_0x0387('0x6'))?this['getDataValue']('crudPermissions')[_0x0387('0x9')](''):[];}}}; \ No newline at end of file +var _0x863f=['getDataValue','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x23d428,_0x185b73){var _0x2686ee=function(_0x52d764){while(--_0x52d764){_0x23d428['push'](_0x23d428['shift']());}};_0x2686ee(++_0x185b73);}(_0x863f,0xda));var _0xf863=function(_0x14b39a,_0x1ca14c){_0x14b39a=_0x14b39a-0x0;var _0x5a9727=_0x863f[_0x14b39a];return _0x5a9727;};'use strict';var Sequelize=require('sequelize');module[_0xf863('0x0')]={'name':{'type':Sequelize[_0xf863('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xf863('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xf863('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf863('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1a7377){this[_0xf863('0x3')](_0xf863('0x4'),_0x1a7377?_0x1a7377[_0xf863('0x5')](''):[]);},'get':function(){return this[_0xf863('0x6')](_0xf863('0x4'))?this[_0xf863('0x6')](_0xf863('0x4'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index eb9735b..2d9c130 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 _0x4846=['fieldName','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','params','intersection','include','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','UserProfileSection','rawAttributes'];(function(_0x109307,_0x4f12d1){var _0x2ea750=function(_0x4758aa){while(--_0x4758aa){_0x109307['push'](_0x109307['shift']());}};_0x2ea750(++_0x4f12d1);}(_0x4846,0x19b));var _0x6484=function(_0x2c43f8,_0x261d10){_0x2c43f8=_0x2c43f8-0x0;var _0x3c0c0f=_0x4846[_0x2c43f8];return _0x3c0c0f;};'use strict';var pdf=require(_0x6484('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6484('0x1'));var zipdir=require(_0x6484('0x2'));var jsonpatch=require(_0x6484('0x3'));var rp=require(_0x6484('0x4'));var moment=require(_0x6484('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6484('0x6'));var path=require(_0x6484('0x7'));var sox=require('sox');var csv=require(_0x6484('0x8'));var ejs=require(_0x6484('0x9'));var fs=require('fs');var _=require(_0x6484('0xa'));var squel=require(_0x6484('0xb'));var crypto=require('crypto');var jsforce=require(_0x6484('0xc'));var deskjs=require(_0x6484('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6484('0xe'));var Redis=require('ioredis');var authService=require(_0x6484('0xf'));var qs=require(_0x6484('0x10'));var as=require(_0x6484('0x11'));var hardwareService=require(_0x6484('0x12'));var logger=require(_0x6484('0x13'))(_0x6484('0x14'));var utils=require(_0x6484('0x15'));var config=require(_0x6484('0x16'));var licenseUtil=require(_0x6484('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e60f4,_0x3670cf){_0x3670cf=_0x3670cf||0xcc;return function(_0x36aea2){if(_0x36aea2){return _0x5e60f4['sendStatus'](_0x3670cf);}return _0x5e60f4[_0x6484('0x18')](_0x3670cf)[_0x6484('0x19')]();};}function respondWithResult(_0x36b381,_0x478aad){_0x478aad=_0x478aad||0xc8;return function(_0x668610){if(_0x668610){return _0x36b381['status'](_0x478aad)[_0x6484('0x1a')](_0x668610);}};}function respondWithFilteredResult(_0x162bdc,_0x5b7364){return function(_0x25b206){if(_0x25b206){var _0x4e199f=_0x25b206[_0x6484('0x1b')],_0x1feaeb=_0x5b7364['offset'],_0x3b2ac7=_0x5b7364[_0x6484('0x1c')]+_0x5b7364[_0x6484('0x1d')],_0x50eb0c;if(_0x3b2ac7>=_0x4e199f){_0x3b2ac7=_0x4e199f;_0x50eb0c=0xc8;}else{_0x50eb0c=0xce;}_0x162bdc[_0x6484('0x18')](_0x50eb0c);return _0x162bdc[_0x6484('0x1e')]('Content-Range',_0x1feaeb+'-'+_0x3b2ac7+'/'+_0x4e199f)[_0x6484('0x1a')](_0x25b206);}return null;};}function patchUpdates(_0x2eb42f){return function(_0x4b9696){try{jsonpatch[_0x6484('0x1f')](_0x4b9696,_0x2eb42f,!![]);}catch(_0x330b60){return BPromise[_0x6484('0x20')](_0x330b60);}return _0x4b9696[_0x6484('0x21')]();};}function saveUpdates(_0x3b5edf,_0x2c70d9){return function(_0x5d0b8a){if(_0x5d0b8a){return _0x5d0b8a[_0x6484('0x22')](_0x3b5edf)[_0x6484('0x23')](function(_0x2e29fe){return _0x2e29fe;});}return null;};}function removeEntity(_0x5cc2a2,_0x346798){return function(_0x5c207d){if(_0x5c207d){return _0x5c207d[_0x6484('0x24')]()['then'](function(){_0x5cc2a2[_0x6484('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x724bcc,_0x2af522){return function(_0x3d261d){if(!_0x3d261d){_0x724bcc[_0x6484('0x25')](0x194);}return _0x3d261d;};}function handleError(_0xc4e608,_0x4a0a1e){_0x4a0a1e=_0x4a0a1e||0x1f4;return function(_0x505b55){logger['error'](_0x505b55[_0x6484('0x26')]);if(_0x505b55[_0x6484('0x27')]){delete _0x505b55[_0x6484('0x27')];}_0xc4e608[_0x6484('0x18')](_0x4a0a1e)[_0x6484('0x28')](_0x505b55);};}exports[_0x6484('0x29')]=function(_0x1dcc4a,_0x330b94){var _0x4cde43={},_0x56b2ed={},_0x330e17={'count':0x0,'rows':[]};var _0x5c3667=_[_0x6484('0x2a')](db[_0x6484('0x2b')][_0x6484('0x2c')],function(_0x239cb5){return{'name':_0x239cb5[_0x6484('0x2d')],'type':_0x239cb5['type'][_0x6484('0x2e')]};});_0x56b2ed[_0x6484('0x2f')]=_[_0x6484('0x2a')](_0x5c3667,_0x6484('0x27'));_0x56b2ed['query']=_[_0x6484('0x30')](_0x1dcc4a[_0x6484('0x31')]);_0x56b2ed['filters']=_['intersection'](_0x56b2ed[_0x6484('0x2f')],_0x56b2ed[_0x6484('0x31')]);_0x4cde43[_0x6484('0x32')]=_['intersection'](_0x56b2ed[_0x6484('0x2f')],qs[_0x6484('0x33')](_0x1dcc4a[_0x6484('0x31')][_0x6484('0x33')]));_0x4cde43[_0x6484('0x32')]=_0x4cde43[_0x6484('0x32')][_0x6484('0x34')]?_0x4cde43[_0x6484('0x32')]:_0x56b2ed[_0x6484('0x2f')];if(!_0x1dcc4a[_0x6484('0x31')][_0x6484('0x35')](_0x6484('0x36'))){_0x4cde43[_0x6484('0x1d')]=qs[_0x6484('0x1d')](_0x1dcc4a[_0x6484('0x31')][_0x6484('0x1d')]);_0x4cde43[_0x6484('0x1c')]=qs[_0x6484('0x1c')](_0x1dcc4a[_0x6484('0x31')]['offset']);}_0x4cde43[_0x6484('0x37')]=qs[_0x6484('0x38')](_0x1dcc4a[_0x6484('0x31')][_0x6484('0x38')]);_0x4cde43[_0x6484('0x39')]=qs[_0x6484('0x3a')](_[_0x6484('0x3b')](_0x1dcc4a[_0x6484('0x31')],_0x56b2ed[_0x6484('0x3a')]),_0x5c3667);if(_0x1dcc4a[_0x6484('0x31')]['filter']){_0x4cde43[_0x6484('0x39')]=_['merge'](_0x4cde43[_0x6484('0x39')],{'$or':_[_0x6484('0x2a')](_0x5c3667,function(_0x2c3ab4){if(_0x2c3ab4[_0x6484('0x3c')]!==_0x6484('0x3d')){var _0x40d5c3={};_0x40d5c3[_0x2c3ab4[_0x6484('0x27')]]={'$like':'%'+_0x1dcc4a['query'][_0x6484('0x3e')]+'%'};return _0x40d5c3;}})});}_0x4cde43=_[_0x6484('0x3f')]({},_0x4cde43,_0x1dcc4a[_0x6484('0x40')]);var _0x1b622f={'where':_0x4cde43[_0x6484('0x39')]};return db[_0x6484('0x2b')][_0x6484('0x1b')](_0x1b622f)[_0x6484('0x23')](function(_0x442c99){_0x330e17[_0x6484('0x1b')]=_0x442c99;if(_0x1dcc4a['query'][_0x6484('0x41')]){_0x4cde43['include']=[{'all':!![]}];}return db[_0x6484('0x2b')][_0x6484('0x42')](_0x4cde43);})[_0x6484('0x23')](function(_0x4a8e0d){_0x330e17['rows']=_0x4a8e0d;return _0x330e17;})['then'](respondWithFilteredResult(_0x330b94,_0x4cde43))[_0x6484('0x43')](handleError(_0x330b94,null));};exports[_0x6484('0x44')]=function(_0x49aad4,_0xac45b5){var _0x2f7bdb={'raw':![],'where':{'id':_0x49aad4[_0x6484('0x45')]['id']}},_0x3b12ad={};_0x3b12ad[_0x6484('0x2f')]=_[_0x6484('0x30')](db[_0x6484('0x2b')][_0x6484('0x2c')]);_0x3b12ad[_0x6484('0x31')]=_['keys'](_0x49aad4[_0x6484('0x31')]);_0x3b12ad[_0x6484('0x3a')]=_[_0x6484('0x46')](_0x3b12ad[_0x6484('0x2f')],_0x3b12ad[_0x6484('0x31')]);_0x2f7bdb[_0x6484('0x32')]=_[_0x6484('0x46')](_0x3b12ad[_0x6484('0x2f')],qs[_0x6484('0x33')](_0x49aad4['query'][_0x6484('0x33')]));_0x2f7bdb[_0x6484('0x32')]=_0x2f7bdb['attributes']['length']?_0x2f7bdb['attributes']:_0x3b12ad[_0x6484('0x2f')];if(_0x49aad4[_0x6484('0x31')][_0x6484('0x41')]){_0x2f7bdb[_0x6484('0x47')]=[{'all':!![]}];}_0x2f7bdb=_[_0x6484('0x3f')]({},_0x2f7bdb,_0x49aad4[_0x6484('0x40')]);return db[_0x6484('0x2b')][_0x6484('0x48')](_0x2f7bdb)['then'](handleEntityNotFound(_0xac45b5,null))[_0x6484('0x23')](respondWithResult(_0xac45b5,null))['catch'](handleError(_0xac45b5,null));};exports[_0x6484('0x49')]=function(_0x3728ed,_0x543026){return db[_0x6484('0x2b')][_0x6484('0x49')](_0x3728ed['body'],{})[_0x6484('0x23')](respondWithResult(_0x543026,0xc9))[_0x6484('0x43')](handleError(_0x543026,null));};exports[_0x6484('0x22')]=function(_0x3719eb,_0x340dae){if(_0x3719eb[_0x6484('0x4a')]['id']){delete _0x3719eb[_0x6484('0x4a')]['id'];}return db[_0x6484('0x2b')]['find']({'where':{'id':_0x3719eb['params']['id']}})['then'](handleEntityNotFound(_0x340dae,null))[_0x6484('0x23')](saveUpdates(_0x3719eb[_0x6484('0x4a')],null))['then'](respondWithResult(_0x340dae,null))[_0x6484('0x43')](handleError(_0x340dae,null));};exports['destroy']=function(_0x192ae3,_0x1f7b00){return db[_0x6484('0x2b')][_0x6484('0x48')]({'where':{'id':_0x192ae3[_0x6484('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f7b00,null))[_0x6484('0x23')](removeEntity(_0x1f7b00,null))[_0x6484('0x43')](handleError(_0x1f7b00,null));};exports[_0x6484('0x4b')]=function(_0x28568c,_0x370410){return db['UserProfileSection']['describe']()[_0x6484('0x23')](respondWithResult(_0x370410,null))[_0x6484('0x43')](handleError(_0x370410,null));}; \ No newline at end of file +var _0xa0dd=['moment','bluebird','mustache','util','path','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','keys','fields','length','include','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0dd,0x172));var _0xda0d=function(_0x4bdf1b,_0x2ae1ba){_0x4bdf1b=_0x4bdf1b-0x0;var _0x169793=_0xa0dd[_0x4bdf1b];return _0x169793;};'use strict';var pdf=require(_0xda0d('0x0'));var emlformat=require(_0xda0d('0x1'));var rimraf=require(_0xda0d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda0d('0x3'));var rp=require(_0xda0d('0x4'));var moment=require(_0xda0d('0x5'));var BPromise=require(_0xda0d('0x6'));var Mustache=require(_0xda0d('0x7'));var util=require(_0xda0d('0x8'));var path=require(_0xda0d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xda0d('0xa'));var squel=require(_0xda0d('0xb'));var crypto=require(_0xda0d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xda0d('0xd'));var querystring=require(_0xda0d('0xe'));var Papa=require('papaparse');var Redis=require(_0xda0d('0xf'));var authService=require(_0xda0d('0x10'));var qs=require(_0xda0d('0x11'));var as=require(_0xda0d('0x12'));var hardwareService=require(_0xda0d('0x13'));var logger=require(_0xda0d('0x14'))(_0xda0d('0x15'));var utils=require('../../config/utils');var config=require(_0xda0d('0x16'));var licenseUtil=require(_0xda0d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3edc5f,_0x1bb803){_0x1bb803=_0x1bb803||0xcc;return function(_0x391627){if(_0x391627){return _0x3edc5f[_0xda0d('0x18')](_0x1bb803);}return _0x3edc5f[_0xda0d('0x19')](_0x1bb803)['end']();};}function respondWithResult(_0x2186f4,_0x15c417){_0x15c417=_0x15c417||0xc8;return function(_0x350ace){if(_0x350ace){return _0x2186f4[_0xda0d('0x19')](_0x15c417)[_0xda0d('0x1a')](_0x350ace);}};}function respondWithFilteredResult(_0x1b3d9f,_0x51fc3f){return function(_0x3f68b9){if(_0x3f68b9){var _0x155fcb=_0x3f68b9[_0xda0d('0x1b')],_0x50b544=_0x51fc3f[_0xda0d('0x1c')],_0x2e27da=_0x51fc3f[_0xda0d('0x1c')]+_0x51fc3f[_0xda0d('0x1d')],_0x3ae71f;if(_0x2e27da>=_0x155fcb){_0x2e27da=_0x155fcb;_0x3ae71f=0xc8;}else{_0x3ae71f=0xce;}_0x1b3d9f[_0xda0d('0x19')](_0x3ae71f);return _0x1b3d9f[_0xda0d('0x1e')](_0xda0d('0x1f'),_0x50b544+'-'+_0x2e27da+'/'+_0x155fcb)[_0xda0d('0x1a')](_0x3f68b9);}return null;};}function patchUpdates(_0x5f2c19){return function(_0x46400b){try{jsonpatch[_0xda0d('0x20')](_0x46400b,_0x5f2c19,!![]);}catch(_0x2b6ea8){return BPromise[_0xda0d('0x21')](_0x2b6ea8);}return _0x46400b[_0xda0d('0x22')]();};}function saveUpdates(_0xdda438,_0x5fb9a2){return function(_0x2e1b2d){if(_0x2e1b2d){return _0x2e1b2d[_0xda0d('0x23')](_0xdda438)['then'](function(_0x14e3d5){return _0x14e3d5;});}return null;};}function removeEntity(_0x23ec7d,_0x4b8910){return function(_0xb7c7b7){if(_0xb7c7b7){return _0xb7c7b7[_0xda0d('0x24')]()[_0xda0d('0x25')](function(){_0x23ec7d[_0xda0d('0x19')](0xcc)[_0xda0d('0x26')]();});}};}function handleEntityNotFound(_0x2e89fe,_0x36a387){return function(_0x4b5592){if(!_0x4b5592){_0x2e89fe[_0xda0d('0x18')](0x194);}return _0x4b5592;};}function handleError(_0x5562b1,_0x280b0f){_0x280b0f=_0x280b0f||0x1f4;return function(_0x4ada6e){logger[_0xda0d('0x27')](_0x4ada6e['stack']);if(_0x4ada6e[_0xda0d('0x28')]){delete _0x4ada6e[_0xda0d('0x28')];}_0x5562b1['status'](_0x280b0f)['send'](_0x4ada6e);};}exports[_0xda0d('0x29')]=function(_0x2035be,_0x7335d7){var _0x19042b={},_0xb48a71={},_0x401af7={'count':0x0,'rows':[]};var _0xb7dcfe=_[_0xda0d('0x2a')](db[_0xda0d('0x2b')][_0xda0d('0x2c')],function(_0x4da102){return{'name':_0x4da102[_0xda0d('0x2d')],'type':_0x4da102[_0xda0d('0x2e')]['key']};});_0xb48a71[_0xda0d('0x2f')]=_['map'](_0xb7dcfe,'name');_0xb48a71[_0xda0d('0x30')]=_['keys'](_0x2035be[_0xda0d('0x30')]);_0xb48a71[_0xda0d('0x31')]=_[_0xda0d('0x32')](_0xb48a71[_0xda0d('0x2f')],_0xb48a71[_0xda0d('0x30')]);_0x19042b[_0xda0d('0x33')]=_[_0xda0d('0x32')](_0xb48a71[_0xda0d('0x2f')],qs['fields'](_0x2035be[_0xda0d('0x30')]['fields']));_0x19042b[_0xda0d('0x33')]=_0x19042b[_0xda0d('0x33')]['length']?_0x19042b[_0xda0d('0x33')]:_0xb48a71[_0xda0d('0x2f')];if(!_0x2035be[_0xda0d('0x30')]['hasOwnProperty'](_0xda0d('0x34'))){_0x19042b['limit']=qs[_0xda0d('0x1d')](_0x2035be[_0xda0d('0x30')]['limit']);_0x19042b[_0xda0d('0x1c')]=qs[_0xda0d('0x1c')](_0x2035be['query']['offset']);}_0x19042b[_0xda0d('0x35')]=qs[_0xda0d('0x36')](_0x2035be[_0xda0d('0x30')]['sort']);_0x19042b[_0xda0d('0x37')]=qs[_0xda0d('0x31')](_[_0xda0d('0x38')](_0x2035be[_0xda0d('0x30')],_0xb48a71[_0xda0d('0x31')]),_0xb7dcfe);if(_0x2035be[_0xda0d('0x30')]['filter']){_0x19042b[_0xda0d('0x37')]=_[_0xda0d('0x39')](_0x19042b[_0xda0d('0x37')],{'$or':_[_0xda0d('0x2a')](_0xb7dcfe,function(_0x2a5f0e){if(_0x2a5f0e[_0xda0d('0x2e')]!==_0xda0d('0x3a')){var _0x27dc39={};_0x27dc39[_0x2a5f0e['name']]={'$like':'%'+_0x2035be[_0xda0d('0x30')][_0xda0d('0x3b')]+'%'};return _0x27dc39;}})});}_0x19042b=_['merge']({},_0x19042b,_0x2035be[_0xda0d('0x3c')]);var _0x1e2036={'where':_0x19042b[_0xda0d('0x37')]};return db[_0xda0d('0x2b')][_0xda0d('0x1b')](_0x1e2036)[_0xda0d('0x25')](function(_0x36886e){_0x401af7[_0xda0d('0x1b')]=_0x36886e;if(_0x2035be[_0xda0d('0x30')][_0xda0d('0x3d')]){_0x19042b['include']=[{'all':!![]}];}return db['UserProfileSection'][_0xda0d('0x3e')](_0x19042b);})['then'](function(_0x18a1ec){_0x401af7[_0xda0d('0x3f')]=_0x18a1ec;return _0x401af7;})[_0xda0d('0x25')](respondWithFilteredResult(_0x7335d7,_0x19042b))[_0xda0d('0x40')](handleError(_0x7335d7,null));};exports[_0xda0d('0x41')]=function(_0x1abd89,_0x53da8f){var _0x32b94c={'raw':![],'where':{'id':_0x1abd89[_0xda0d('0x42')]['id']}},_0x4bbb7f={};_0x4bbb7f['model']=_[_0xda0d('0x43')](db[_0xda0d('0x2b')][_0xda0d('0x2c')]);_0x4bbb7f[_0xda0d('0x30')]=_[_0xda0d('0x43')](_0x1abd89[_0xda0d('0x30')]);_0x4bbb7f[_0xda0d('0x31')]=_[_0xda0d('0x32')](_0x4bbb7f[_0xda0d('0x2f')],_0x4bbb7f[_0xda0d('0x30')]);_0x32b94c[_0xda0d('0x33')]=_[_0xda0d('0x32')](_0x4bbb7f[_0xda0d('0x2f')],qs[_0xda0d('0x44')](_0x1abd89[_0xda0d('0x30')][_0xda0d('0x44')]));_0x32b94c[_0xda0d('0x33')]=_0x32b94c[_0xda0d('0x33')][_0xda0d('0x45')]?_0x32b94c[_0xda0d('0x33')]:_0x4bbb7f[_0xda0d('0x2f')];if(_0x1abd89[_0xda0d('0x30')][_0xda0d('0x3d')]){_0x32b94c[_0xda0d('0x46')]=[{'all':!![]}];}_0x32b94c=_[_0xda0d('0x39')]({},_0x32b94c,_0x1abd89[_0xda0d('0x3c')]);return db[_0xda0d('0x2b')][_0xda0d('0x47')](_0x32b94c)[_0xda0d('0x25')](handleEntityNotFound(_0x53da8f,null))[_0xda0d('0x25')](respondWithResult(_0x53da8f,null))[_0xda0d('0x40')](handleError(_0x53da8f,null));};exports[_0xda0d('0x48')]=function(_0x49a437,_0x749af8){return db[_0xda0d('0x2b')]['create'](_0x49a437[_0xda0d('0x49')],{})[_0xda0d('0x25')](respondWithResult(_0x749af8,0xc9))['catch'](handleError(_0x749af8,null));};exports[_0xda0d('0x23')]=function(_0x38f4bf,_0x3476bc){if(_0x38f4bf['body']['id']){delete _0x38f4bf[_0xda0d('0x49')]['id'];}return db[_0xda0d('0x2b')][_0xda0d('0x47')]({'where':{'id':_0x38f4bf[_0xda0d('0x42')]['id']}})[_0xda0d('0x25')](handleEntityNotFound(_0x3476bc,null))['then'](saveUpdates(_0x38f4bf[_0xda0d('0x49')],null))[_0xda0d('0x25')](respondWithResult(_0x3476bc,null))[_0xda0d('0x40')](handleError(_0x3476bc,null));};exports[_0xda0d('0x24')]=function(_0x4592d8,_0x2355be){return db[_0xda0d('0x2b')][_0xda0d('0x47')]({'where':{'id':_0x4592d8['params']['id']}})[_0xda0d('0x25')](handleEntityNotFound(_0x2355be,null))[_0xda0d('0x25')](removeEntity(_0x2355be,null))[_0xda0d('0x40')](handleError(_0x2355be,null));};exports[_0xda0d('0x4a')]=function(_0x15a6c0,_0x982bb3){return db[_0xda0d('0x2b')][_0xda0d('0x4a')]()[_0xda0d('0x25')](respondWithResult(_0x982bb3,null))[_0xda0d('0x40')](handleError(_0x982bb3,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 6d0133e..d1ed7cf 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 _0x5fec=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','UserProfileSection','compositeIndex','userProfileId','lodash'];(function(_0x132c95,_0x537782){var _0xe5ccda=function(_0x334502){while(--_0x334502){_0x132c95['push'](_0x132c95['shift']());}};_0xe5ccda(++_0x537782);}(_0x5fec,0x6b));var _0xc5fe=function(_0x31b130,_0x18737f){_0x31b130=_0x31b130-0x0;var _0x595061=_0x5fec[_0x31b130];return _0x595061;};'use strict';var _=require(_0xc5fe('0x0'));var util=require('util');var logger=require(_0xc5fe('0x1'))(_0xc5fe('0x2'));var moment=require(_0xc5fe('0x3'));var BPromise=require(_0xc5fe('0x4'));var rp=require(_0xc5fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5fe('0x6'));var config=require(_0xc5fe('0x7'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x218026,_0x263dd1){return _0x218026[_0xc5fe('0x8')](_0xc5fe('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xc5fe('0xa'),'fields':['sectionId',_0xc5fe('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0044=['request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2ca616,_0x384ec8){var _0x53155f=function(_0x108627){while(--_0x108627){_0x2ca616['push'](_0x2ca616['shift']());}};_0x53155f(++_0x384ec8);}(_0x0044,0xfa));var _0x4004=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x0044[_0x176329];return _0x31997c;};'use strict';var _=require(_0x4004('0x0'));var util=require(_0x4004('0x1'));var logger=require(_0x4004('0x2'))(_0x4004('0x3'));var moment=require(_0x4004('0x4'));var BPromise=require(_0x4004('0x5'));var rp=require(_0x4004('0x6'));var fs=require('fs');var path=require(_0x4004('0x7'));var rimraf=require(_0x4004('0x8'));var config=require(_0x4004('0x9'));var attributes=require(_0x4004('0xa'));module[_0x4004('0xb')]=function(_0x162006,_0x451721){return _0x162006[_0x4004('0xc')](_0x4004('0xd'),attributes,{'tableName':_0x4004('0xe'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x4004('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 4a780c3..a9902a6 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 _0x334b=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3d1163,_0x7e050d){var _0x4f5bfa=function(_0x46daff){while(--_0x46daff){_0x3d1163['push'](_0x3d1163['shift']());}};_0x4f5bfa(++_0x7e050d);}(_0x334b,0x154));var _0xb334=function(_0x2e837f,_0x4f2d93){_0x2e837f=_0x2e837f-0x0;var _0x235fb2=_0x334b[_0x2e837f];return _0x235fb2;};'use strict';var _=require('lodash');var util=require(_0xb334('0x0'));var moment=require(_0xb334('0x1'));var BPromise=require(_0xb334('0x2'));var rs=require(_0xb334('0x3'));var fs=require('fs');var Redis=require(_0xb334('0x4'));var db=require(_0xb334('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb334('0x6'))(_0xb334('0x7'));var config=require('../../config/environment');var jayson=require(_0xb334('0x8'));var client=jayson[_0xb334('0x9')][_0xb334('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52fef0,_0x39d4b,_0x39c658){return new BPromise(function(_0x408c14,_0x802d37){return client[_0xb334('0xb')](_0x52fef0,_0x39c658)[_0xb334('0xc')](function(_0x463e63){logger['info'](_0xb334('0xd'),_0x39d4b,_0xb334('0xe'));logger[_0xb334('0xf')](_0xb334('0x10'),_0x39d4b,_0xb334('0xe'),JSON[_0xb334('0x11')](_0x463e63));if(_0x463e63[_0xb334('0x12')]){if(_0x463e63[_0xb334('0x12')]['code']===0x1f4){logger[_0xb334('0x12')](_0xb334('0xd'),_0x39d4b,_0x463e63['error'][_0xb334('0x13')]);return _0x802d37(_0x463e63['error']['message']);}logger[_0xb334('0x12')](_0xb334('0xd'),_0x39d4b,_0x463e63[_0xb334('0x12')][_0xb334('0x13')]);return _0x408c14(_0x463e63[_0xb334('0x12')][_0xb334('0x13')]);}else{logger[_0xb334('0x14')](_0xb334('0xd'),_0x39d4b,_0xb334('0xe'));_0x408c14(_0x463e63[_0xb334('0x15')][_0xb334('0x13')]);}})[_0xb334('0x16')](function(_0x1dee55){logger[_0xb334('0x12')](_0xb334('0xd'),_0x39d4b,_0x1dee55);_0x802d37(_0x1dee55);});});} \ No newline at end of file +var _0xa600=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa600,0x192));var _0x0a60=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0xa600[_0x4e198a];return _0xb84bfe;};'use strict';var _=require(_0x0a60('0x0'));var util=require(_0x0a60('0x1'));var moment=require(_0x0a60('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a60('0x3'));var fs=require('fs');var Redis=require(_0x0a60('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a60('0x5'));var logger=require(_0x0a60('0x6'))(_0x0a60('0x7'));var config=require(_0x0a60('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a60('0x9')][_0x0a60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193e55,_0x5436a0,_0x5781f6){return new BPromise(function(_0x492604,_0x3d59c6){return client[_0x0a60('0xb')](_0x193e55,_0x5781f6)[_0x0a60('0xc')](function(_0x10db45){logger[_0x0a60('0xd')](_0x0a60('0xe'),_0x5436a0,_0x0a60('0xf'));logger[_0x0a60('0x10')](_0x0a60('0x11'),_0x5436a0,'request\x20sent',JSON[_0x0a60('0x12')](_0x10db45));if(_0x10db45[_0x0a60('0x13')]){if(_0x10db45[_0x0a60('0x13')][_0x0a60('0x14')]===0x1f4){logger['error'](_0x0a60('0xe'),_0x5436a0,_0x10db45[_0x0a60('0x13')][_0x0a60('0x15')]);return _0x3d59c6(_0x10db45[_0x0a60('0x13')][_0x0a60('0x15')]);}logger[_0x0a60('0x13')]('UserProfileSection,\x20%s,\x20%s',_0x5436a0,_0x10db45[_0x0a60('0x13')]['message']);return _0x492604(_0x10db45[_0x0a60('0x13')]['message']);}else{logger[_0x0a60('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x5436a0,_0x0a60('0xf'));_0x492604(_0x10db45[_0x0a60('0x16')][_0x0a60('0x15')]);}})[_0x0a60('0x17')](function(_0x30b871){logger[_0x0a60('0x13')](_0x0a60('0xe'),_0x5436a0,_0x30b871);_0x3d59c6(_0x30b871);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9a0a8da..800a235 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 _0x95f9=['../../components/auth/service','../../config/environment','exports','util','connect-timeout','express','Router'];(function(_0xbb9493,_0xccd96){var _0x506c8e=function(_0x31475f){while(--_0x31475f){_0xbb9493['push'](_0xbb9493['shift']());}};_0x506c8e(++_0xccd96);}(_0x95f9,0x129));var _0x995f=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x95f9[_0x10004e];return _0x5af990;};'use strict';var multer=require('multer');var util=require(_0x995f('0x0'));var path=require('path');var timeout=require(_0x995f('0x1'));var express=require(_0x995f('0x2'));var router=express[_0x995f('0x3')]();var auth=require(_0x995f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x995f('0x5'));module[_0x995f('0x6')]=router; \ No newline at end of file +var _0xc45d=['connect-timeout','express','Router','../../components/interaction/service','exports','multer','util'];(function(_0x32c44f,_0x23224c){var _0x6a695a=function(_0x20fe3f){while(--_0x20fe3f){_0x32c44f['push'](_0x32c44f['shift']());}};_0x6a695a(++_0x23224c);}(_0xc45d,0x155));var _0xdc45=function(_0xd46333,_0x1b05c1){_0xd46333=_0xd46333-0x0;var _0x336108=_0xc45d[_0xd46333];return _0x336108;};'use strict';var multer=require(_0xdc45('0x0'));var util=require(_0xdc45('0x1'));var path=require('path');var timeout=require(_0xdc45('0x2'));var express=require(_0xdc45('0x3'));var router=express[_0xdc45('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xdc45('0x5'));var config=require('../../config/environment');module[_0xdc45('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b1af701..2a57a8c 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 _0xbaf0=['exports','INTEGER'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x2fd160,_0x53c0d6){var _0x5c2031=function(_0x8ecfa5){while(--_0x8ecfa5){_0x2fd160['push'](_0x2fd160['shift']());}};_0x5c2031(++_0x53c0d6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index f8099dd..7773cde 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 _0x4ee7=['exports','define','UserSmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x9a7499,_0x283f46){var _0x10a8cd=function(_0x37a6d7){while(--_0x37a6d7){_0x9a7499['push'](_0x9a7499['shift']());}};_0x10a8cd(++_0x283f46);}(_0x4ee7,0x148));var _0x74ee=function(_0x2b3c1f,_0x398187){_0x2b3c1f=_0x2b3c1f-0x0;var _0x557ba9=_0x4ee7[_0x2b3c1f];return _0x557ba9;};'use strict';var _=require(_0x74ee('0x0'));var util=require(_0x74ee('0x1'));var logger=require(_0x74ee('0x2'))(_0x74ee('0x3'));var moment=require(_0x74ee('0x4'));var BPromise=require(_0x74ee('0x5'));var rp=require(_0x74ee('0x6'));var fs=require('fs');var path=require(_0x74ee('0x7'));var rimraf=require(_0x74ee('0x8'));var config=require(_0x74ee('0x9'));var attributes=require('./userSmsQueue.attributes');module[_0x74ee('0xa')]=function(_0x1c9291,_0x4742e9){return _0x1c9291[_0x74ee('0xb')](_0x74ee('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b68=['moment','bluebird','request-promise','path','../../config/environment','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5b68,0x68));var _0x85b6=function(_0x3ee0d8,_0x1d3e3c){_0x3ee0d8=_0x3ee0d8-0x0;var _0x2ff025=_0x5b68[_0x3ee0d8];return _0x2ff025;};'use strict';var _=require(_0x85b6('0x0'));var util=require(_0x85b6('0x1'));var logger=require(_0x85b6('0x2'))(_0x85b6('0x3'));var moment=require(_0x85b6('0x4'));var BPromise=require(_0x85b6('0x5'));var rp=require(_0x85b6('0x6'));var fs=require('fs');var path=require(_0x85b6('0x7'));var rimraf=require('rimraf');var config=require(_0x85b6('0x8'));var attributes=require('./userSmsQueue.attributes');module['exports']=function(_0x30329a,_0x503beb){return _0x30329a[_0x85b6('0x9')](_0x85b6('0xa'),attributes,{'tableName':_0x85b6('0xb'),'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 89c5e9e..c5169b6 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 _0xd232=['../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0xcce84a,_0x148a0a){var _0x273e9d=function(_0x318266){while(--_0x318266){_0xcce84a['push'](_0xcce84a['shift']());}};_0x273e9d(++_0x148a0a);}(_0xd232,0x1c5));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x2d23('0x0'));var util=require(_0x2d23('0x1'));var moment=require(_0x2d23('0x2'));var BPromise=require(_0x2d23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d23('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d23('0x5'))(_0x2d23('0x6'));var config=require(_0x2d23('0x7'));var jayson=require(_0x2d23('0x8'));var client=jayson[_0x2d23('0x9')][_0x2d23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x107daf,_0x56420f,_0x105ab3){return new BPromise(function(_0x764b4c,_0x4cac6c){return client[_0x2d23('0xb')](_0x107daf,_0x105ab3)[_0x2d23('0xc')](function(_0x66bc34){logger['info'](_0x2d23('0xd'),_0x56420f,_0x2d23('0xe'));logger[_0x2d23('0xf')](_0x2d23('0x10'),_0x56420f,_0x2d23('0xe'),JSON[_0x2d23('0x11')](_0x66bc34));if(_0x66bc34['error']){if(_0x66bc34['error']['code']===0x1f4){logger[_0x2d23('0x12')](_0x2d23('0xd'),_0x56420f,_0x66bc34[_0x2d23('0x12')][_0x2d23('0x13')]);return _0x4cac6c(_0x66bc34[_0x2d23('0x12')]['message']);}logger[_0x2d23('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x56420f,_0x66bc34['error'][_0x2d23('0x13')]);return _0x764b4c(_0x66bc34[_0x2d23('0x12')]['message']);}else{logger[_0x2d23('0x14')](_0x2d23('0xd'),_0x56420f,_0x2d23('0xe'));_0x764b4c(_0x66bc34[_0x2d23('0x15')][_0x2d23('0x13')]);}})[_0x2d23('0x16')](function(_0x1a8819){logger[_0x2d23('0x12')](_0x2d23('0xd'),_0x56420f,_0x1a8819);_0x4cac6c(_0x1a8819);});});} \ No newline at end of file +var _0x02b7=['jayson/promise','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x02b7,0x15f));var _0x702b=function(_0x4bc223,_0x2a54e2){_0x4bc223=_0x4bc223-0x0;var _0x290d08=_0x02b7[_0x4bc223];return _0x290d08;};'use strict';var _=require('lodash');var util=require(_0x702b('0x0'));var moment=require('moment');var BPromise=require(_0x702b('0x1'));var rs=require(_0x702b('0x2'));var fs=require('fs');var Redis=require(_0x702b('0x3'));var db=require(_0x702b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x702b('0x5'));var config=require('../../config/environment');var jayson=require(_0x702b('0x6'));var client=jayson['client'][_0x702b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x454bef,_0xc6a746,_0x499d41){return new BPromise(function(_0x578788,_0x3682f5){return client[_0x702b('0x8')](_0x454bef,_0x499d41)['then'](function(_0x51a08b){logger[_0x702b('0x9')](_0x702b('0xa'),_0xc6a746,_0x702b('0xb'));logger[_0x702b('0xc')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0xc6a746,_0x702b('0xb'),JSON['stringify'](_0x51a08b));if(_0x51a08b[_0x702b('0xd')]){if(_0x51a08b[_0x702b('0xd')][_0x702b('0xe')]===0x1f4){logger[_0x702b('0xd')](_0x702b('0xa'),_0xc6a746,_0x51a08b['error'][_0x702b('0xf')]);return _0x3682f5(_0x51a08b[_0x702b('0xd')][_0x702b('0xf')]);}logger[_0x702b('0xd')](_0x702b('0xa'),_0xc6a746,_0x51a08b[_0x702b('0xd')][_0x702b('0xf')]);return _0x578788(_0x51a08b[_0x702b('0xd')][_0x702b('0xf')]);}else{logger[_0x702b('0x9')](_0x702b('0xa'),_0xc6a746,'request\x20sent');_0x578788(_0x51a08b['result']['message']);}})[_0x702b('0x10')](function(_0x57f2bd){logger[_0x702b('0xd')](_0x702b('0xa'),_0xc6a746,_0x57f2bd);_0x3682f5(_0x57f2bd);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index f674214..5922573 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 _0xeb2f=['../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express','../../components/auth/service'];(function(_0x2beaaf,_0x5e6a1d){var _0x5f3fb5=function(_0x4cf1d3){while(--_0x4cf1d3){_0x2beaaf['push'](_0x2beaaf['shift']());}};_0x5f3fb5(++_0x5e6a1d);}(_0xeb2f,0x1d8));var _0xfeb2=function(_0x3c3acd,_0x39cdb3){_0x3c3acd=_0x3c3acd-0x0;var _0x51c331=_0xeb2f[_0x3c3acd];return _0x51c331;};'use strict';var multer=require(_0xfeb2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfeb2('0x1'));var express=require(_0xfeb2('0x2'));var router=express['Router']();var auth=require(_0xfeb2('0x3'));var interaction=require(_0xfeb2('0x4'));var config=require(_0xfeb2('0x5'));module[_0xfeb2('0x6')]=router; \ No newline at end of file +var _0x4a2a=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x3239f2,_0x32c96f){var _0x40d5f5=function(_0x25fb18){while(--_0x25fb18){_0x3239f2['push'](_0x3239f2['shift']());}};_0x40d5f5(++_0x32c96f);}(_0x4a2a,0xe8));var _0xa4a2=function(_0x53fefa,_0x452e52){_0x53fefa=_0x53fefa-0x0;var _0x38a94e=_0x4a2a[_0x53fefa];return _0x38a94e;};'use strict';var multer=require(_0xa4a2('0x0'));var util=require(_0xa4a2('0x1'));var path=require(_0xa4a2('0x2'));var timeout=require(_0xa4a2('0x3'));var express=require(_0xa4a2('0x4'));var router=express[_0xa4a2('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa4a2('0x6'));var config=require(_0xa4a2('0x7'));module[_0xa4a2('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index aa51606..bb237b7 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x189566,_0x20c0b1){var _0x276f3e=function(_0xdcbe13){while(--_0xdcbe13){_0x189566['push'](_0x189566['shift']());}};_0x276f3e(++_0x20c0b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x314fa9,_0x14d5df){var _0x38d6c=function(_0x3f94b6){while(--_0x3f94b6){_0x314fa9['push'](_0x314fa9['shift']());}};_0x38d6c(++_0x14d5df);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 38becff..93bec31 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 _0x56a4=['./userVoiceQueue.attributes','exports','user_has_voice_queues','lodash','util','api','moment','path','rimraf','../../config/environment'];(function(_0x56b979,_0x31c89e){var _0x427f6a=function(_0x178966){while(--_0x178966){_0x56b979['push'](_0x56b979['shift']());}};_0x427f6a(++_0x31c89e);}(_0x56a4,0x11b));var _0x456a=function(_0x2570b1,_0x3fed7f){_0x2570b1=_0x2570b1-0x0;var _0x5b4e74=_0x56a4[_0x2570b1];return _0x5b4e74;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('UserVoiceQueue',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d9e=['lodash','api','bluebird','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x31d287,_0x53d1c2){_0x31d287=_0x31d287-0x0;var _0x41b624=_0x4d9e[_0x31d287];return _0x41b624;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe4d9('0x1'));var moment=require('moment');var BPromise=require(_0xe4d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d9('0x3'));var rimraf=require(_0xe4d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe4d9('0x5'));module[_0xe4d9('0x6')]=function(_0x278035,_0x34c2a2){return _0x278035[_0xe4d9('0x7')](_0xe4d9('0x8'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index b477be1..87d128f 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 _0xe18c=['request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xe18c,0x1da));var _0xce18=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe18c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xce18('0x0'));var util=require(_0xce18('0x1'));var moment=require(_0xce18('0x2'));var BPromise=require(_0xce18('0x3'));var rs=require(_0xce18('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xce18('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xce18('0x6'));var config=require('../../config/environment');var jayson=require(_0xce18('0x7'));var client=jayson[_0xce18('0x8')][_0xce18('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x548807,_0x582890,_0x1d9cec){return new BPromise(function(_0x175038,_0x29e412){return client[_0xce18('0xa')](_0x548807,_0x1d9cec)[_0xce18('0xb')](function(_0xc8ba0d){logger[_0xce18('0xc')](_0xce18('0xd'),_0x582890,_0xce18('0xe'));logger[_0xce18('0xf')](_0xce18('0x10'),_0x582890,_0xce18('0xe'),JSON['stringify'](_0xc8ba0d));if(_0xc8ba0d[_0xce18('0x11')]){if(_0xc8ba0d[_0xce18('0x11')][_0xce18('0x12')]===0x1f4){logger[_0xce18('0x11')](_0xce18('0xd'),_0x582890,_0xc8ba0d[_0xce18('0x11')]['message']);return _0x29e412(_0xc8ba0d[_0xce18('0x11')][_0xce18('0x13')]);}logger[_0xce18('0x11')](_0xce18('0xd'),_0x582890,_0xc8ba0d['error'][_0xce18('0x13')]);return _0x175038(_0xc8ba0d[_0xce18('0x11')]['message']);}else{logger[_0xce18('0xc')](_0xce18('0xd'),_0x582890,_0xce18('0xe'));_0x175038(_0xc8ba0d[_0xce18('0x14')][_0xce18('0x13')]);}})[_0xce18('0x15')](function(_0x3649e3){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x582890,_0x3649e3);_0x29e412(_0x3649e3);});});} \ No newline at end of file +var _0xab95=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request'];(function(_0x3a9d05,_0x367e7c){var _0x3b9c5e=function(_0x48df9f){while(--_0x48df9f){_0x3a9d05['push'](_0x3a9d05['shift']());}};_0x3b9c5e(++_0x367e7c);}(_0xab95,0x1be));var _0x5ab9=function(_0x4ba2df,_0x2be4a8){_0x4ba2df=_0x4ba2df-0x0;var _0x216c18=_0xab95[_0x4ba2df];return _0x216c18;};'use strict';var _=require(_0x5ab9('0x0'));var util=require(_0x5ab9('0x1'));var moment=require(_0x5ab9('0x2'));var BPromise=require(_0x5ab9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ab9('0x4'));var db=require(_0x5ab9('0x5'))['db'];var utils=require(_0x5ab9('0x6'));var logger=require('../../config/logger')(_0x5ab9('0x7'));var config=require('../../config/environment');var jayson=require(_0x5ab9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5eee43,_0x13eddf,_0xfecafb){return new BPromise(function(_0x2fc5dc,_0x47e687){return client[_0x5ab9('0x9')](_0x5eee43,_0xfecafb)['then'](function(_0x32b66c){logger[_0x5ab9('0xa')](_0x5ab9('0xb'),_0x13eddf,_0x5ab9('0xc'));logger['debug'](_0x5ab9('0xd'),_0x13eddf,_0x5ab9('0xc'),JSON[_0x5ab9('0xe')](_0x32b66c));if(_0x32b66c[_0x5ab9('0xf')]){if(_0x32b66c[_0x5ab9('0xf')][_0x5ab9('0x10')]===0x1f4){logger[_0x5ab9('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x13eddf,_0x32b66c['error'][_0x5ab9('0x11')]);return _0x47e687(_0x32b66c[_0x5ab9('0xf')][_0x5ab9('0x11')]);}logger[_0x5ab9('0xf')](_0x5ab9('0xb'),_0x13eddf,_0x32b66c[_0x5ab9('0xf')][_0x5ab9('0x11')]);return _0x2fc5dc(_0x32b66c[_0x5ab9('0xf')]['message']);}else{logger['info'](_0x5ab9('0xb'),_0x13eddf,_0x5ab9('0xc'));_0x2fc5dc(_0x32b66c[_0x5ab9('0x12')][_0x5ab9('0x11')]);}})['catch'](function(_0x3c0e46){logger[_0x5ab9('0xf')](_0x5ab9('0xb'),_0x13eddf,_0x3c0e46);_0x47e687(_0x3c0e46);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 602b229..b3e3217 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 _0xe9d1=['express','Router','../../components/auth/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x259e77,_0x52f430){var _0x1f93bd=function(_0x3c9ffe){while(--_0x3c9ffe){_0x259e77['push'](_0x259e77['shift']());}};_0x1f93bd(++_0x52f430);}(_0xe9d1,0xef));var _0x1e9d=function(_0x5e31b8,_0x23e122){_0x5e31b8=_0x5e31b8-0x0;var _0x145a9d=_0xe9d1[_0x5e31b8];return _0x145a9d;};'use strict';var multer=require(_0x1e9d('0x0'));var util=require(_0x1e9d('0x1'));var path=require(_0x1e9d('0x2'));var timeout=require(_0x1e9d('0x3'));var express=require(_0x1e9d('0x4'));var router=express[_0x1e9d('0x5')]();var auth=require(_0x1e9d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e9d('0x7'));module[_0x1e9d('0x8')]=router; \ No newline at end of file +var _0xae3a=['../../components/interaction/service','../../config/environment','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xae3a,0x7a));var _0xaae3=function(_0x4a3e73,_0x4fea7c){_0x4a3e73=_0x4a3e73-0x0;var _0x2d8eb9=_0xae3a[_0x4a3e73];return _0x2d8eb9;};'use strict';var multer=require(_0xaae3('0x0'));var util=require('util');var path=require(_0xaae3('0x1'));var timeout=require(_0xaae3('0x2'));var express=require(_0xaae3('0x3'));var router=express[_0xaae3('0x4')]();var auth=require(_0xaae3('0x5'));var interaction=require(_0xaae3('0x6'));var config=require(_0xaae3('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 311753c..5b93a0b 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 _0x54ec=['exports','INTEGER','STRING','queue_interface','Required\x20by\x20Asterisk','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x54ec,0x15b));var _0xc54e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x54ec[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xc54e('0x0'));module[_0xc54e('0x1')]={'uniqueid':{'type':Sequelize[_0xc54e('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xc54e('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xc54e('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xc54e('0x3')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xc54e('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xc54e('0x3')],'allowNull':![],'unique':_0xc54e('0x4'),'comment':_0xc54e('0x5')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xc54e('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x6621=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6621,0x1ae));var _0x1662=function(_0x7b8a87,_0x2f2523){_0x7b8a87=_0x7b8a87-0x0;var _0x2131a1=_0x6621[_0x7b8a87];return _0x2131a1;};'use strict';var Sequelize=require(_0x1662('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1662('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x1662('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1662('0x3')],'allowNull':![],'unique':_0x1662('0x4'),'comment':_0x1662('0x2')},'VoiceQueueId':{'type':Sequelize[_0x1662('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1662('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x1662('0x1')](0xb),'defaultValue':0x0,'comment':_0x1662('0x2')},'paused':{'type':Sequelize[_0x1662('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 1a9545f..83ed3e5 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 _0xdd0d=['../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xdd0d,0xb3));var _0xddd0=function(_0x1d7333,_0x92367a){_0x1d7333=_0x1d7333-0x0;var _0x6172f8=_0xdd0d[_0x1d7333];return _0x6172f8;};'use strict';var EventEmitter=require(_0xddd0('0x0'));var UserVoiceQueueRt=require(_0xddd0('0x1'))['db'][_0xddd0('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xddd0('0x3'),'afterUpdate':_0xddd0('0x4'),'afterDestroy':_0xddd0('0x5')};function emitEvent(_0x5a956d){return function(_0x12fb1f,_0xd94120,_0x316395){UserVoiceQueueRtEvents[_0xddd0('0x6')](_0x5a956d+':'+_0x12fb1f['id'],_0x12fb1f);UserVoiceQueueRtEvents[_0xddd0('0x6')](_0x5a956d,_0x12fb1f);_0x316395(null);};}for(var e in events){if(events[_0xddd0('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xddd0('0x8')](e,emitEvent(event));}}module[_0xddd0('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x8397=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x70d691,_0x4df22e){var _0x452dba=function(_0x23dc6a){while(--_0x23dc6a){_0x70d691['push'](_0x70d691['shift']());}};_0x452dba(++_0x4df22e);}(_0x8397,0x11e));var _0x7839=function(_0x27c13b,_0x53d77e){_0x27c13b=_0x27c13b-0x0;var _0x1fcd94=_0x8397[_0x27c13b];return _0x1fcd94;};'use strict';var EventEmitter=require(_0x7839('0x0'));var UserVoiceQueueRt=require(_0x7839('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7839('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7839('0x3'),'afterDestroy':_0x7839('0x4')};function emitEvent(_0x378162){return function(_0x4affe3,_0x530803,_0x4bb8ad){UserVoiceQueueRtEvents[_0x7839('0x5')](_0x378162+':'+_0x4affe3['id'],_0x4affe3);UserVoiceQueueRtEvents['emit'](_0x378162,_0x4affe3);_0x4bb8ad(null);};}for(var e in events){if(events[_0x7839('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x7839('0x7')](e,emitEvent(event));}}module[_0x7839('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index b5ab6b1..a77fef9 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 _0x73fa=['exports','define','lodash','util','../../config/logger','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x314c76,_0x57f2a0){var _0x590ac9=function(_0x55dc05){while(--_0x55dc05){_0x314c76['push'](_0x314c76['shift']());}};_0x590ac9(++_0x57f2a0);}(_0x73fa,0x14f));var _0xa73f=function(_0x34d6bd,_0x55b744){_0x34d6bd=_0x34d6bd-0x0;var _0x248396=_0x73fa[_0x34d6bd];return _0x248396;};'use strict';var _=require(_0xa73f('0x0'));var util=require(_0xa73f('0x1'));var logger=require(_0xa73f('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa73f('0x3'));var rimraf=require(_0xa73f('0x4'));var config=require(_0xa73f('0x5'));var attributes=require(_0xa73f('0x6'));module[_0xa73f('0x7')]=function(_0x430734,_0x2a914d){return _0x430734[_0xa73f('0x8')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23ea=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x13a1dc,_0x195952){var _0x11f607=function(_0x2f2d6e){while(--_0x2f2d6e){_0x13a1dc['push'](_0x13a1dc['shift']());}};_0x11f607(++_0x195952);}(_0x23ea,0x1a2));var _0xa23e=function(_0x23d706,_0x12b65b){_0x23d706=_0x23d706-0x0;var _0x66611c=_0x23ea[_0x23d706];return _0x66611c;};'use strict';var _=require(_0xa23e('0x0'));var util=require(_0xa23e('0x1'));var logger=require(_0xa23e('0x2'))(_0xa23e('0x3'));var moment=require(_0xa23e('0x4'));var BPromise=require(_0xa23e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa23e('0x6'));var config=require(_0xa23e('0x7'));var attributes=require(_0xa23e('0x8'));module['exports']=function(_0x1ff79b,_0x1210f6){return _0x1ff79b[_0xa23e('0x9')](_0xa23e('0xa'),attributes,{'tableName':_0xa23e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index efc9852..bab24cf 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 _0x0315=['GetVoiceQueueRtPauses','debug','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','info','request\x20sent','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','outboundQueuePauses'];(function(_0x1d04ef,_0x13e0b3){var _0x105789=function(_0x1a8a05){while(--_0x1a8a05){_0x1d04ef['push'](_0x1d04ef['shift']());}};_0x105789(++_0x13e0b3);}(_0x0315,0x10a));var _0x5031=function(_0x4fcd97,_0x4e553c){_0x4fcd97=_0x4fcd97-0x0;var _0x439b10=_0x0315[_0x4fcd97];return _0x439b10;};'use strict';var _=require(_0x5031('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5031('0x1'));var db=require(_0x5031('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5031('0x3'))('rpc');var config=require(_0x5031('0x4'));var jayson=require(_0x5031('0x5'));var client=jayson[_0x5031('0x6')][_0x5031('0x7')]({'port':0x232a});config[_0x5031('0x8')]=_[_0x5031('0x9')](config['redis'],{'host':_0x5031('0xa'),'port':0x18eb});var socket=require(_0x5031('0xb'))(new Redis(config['redis']));require(_0x5031('0xc'))['register'](socket);function respondWithRpcPromise(_0x186647,_0xda6dc2,_0x1e9bd5){return new BPromise(function(_0x477615,_0x305ff6){return client[_0x5031('0xd')](_0x186647,_0x1e9bd5)[_0x5031('0xe')](function(_0x14f873){logger[_0x5031('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xda6dc2,_0x5031('0x10'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0xda6dc2,_0x5031('0x10'),JSON[_0x5031('0x11')](_0x14f873));if(_0x14f873['error']){if(_0x14f873['error']['code']===0x1f4){logger[_0x5031('0x12')](_0x5031('0x13'),_0xda6dc2,_0x14f873['error'][_0x5031('0x14')]);return _0x305ff6(_0x14f873[_0x5031('0x12')][_0x5031('0x14')]);}logger['error'](_0x5031('0x13'),_0xda6dc2,_0x14f873[_0x5031('0x12')][_0x5031('0x14')]);return _0x477615(_0x14f873[_0x5031('0x12')][_0x5031('0x14')]);}else{logger[_0x5031('0xf')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xda6dc2,_0x5031('0x10'));_0x477615(_0x14f873['result']['message']);}})[_0x5031('0x15')](function(_0x2c864e){logger['error'](_0x5031('0x13'),_0xda6dc2,_0x2c864e);_0x305ff6(_0x2c864e);});});}exports['GetVoiceQueueRtPauses']=function(_0xbafaf9){var _0x52c8ba=this;return new Promise(function(_0x27b6a8,_0x1afe55){return db[_0x5031('0x16')][_0x5031('0x17')]({'raw':_0xbafaf9[_0x5031('0x18')]?_0xbafaf9[_0x5031('0x18')][_0x5031('0x19')]===undefined?!![]:![]:!![],'where':_0xbafaf9[_0x5031('0x18')]?_0xbafaf9[_0x5031('0x18')][_0x5031('0x1a')]||null:null,'attributes':[[db['sequelize']['fn'](_0x5031('0x1b'),db['sequelize']['fn']('IF',db[_0x5031('0x1c')][_0x5031('0x1d')]('`paused`\x20=\x201,\x201,\x20null'))),_0x5031('0x1e')]]})[_0x5031('0xe')](function(_0x52adba){logger[_0x5031('0xf')](_0x5031('0x1f'),_0xbafaf9);logger[_0x5031('0x20')]('GetVoiceQueueRtPauses',_0xbafaf9,JSON[_0x5031('0x11')](_0x52adba));_0x27b6a8(_0x52adba);})[_0x5031('0x15')](function(_0x35f088){logger[_0x5031('0x12')](_0x5031('0x1f'),_0x35f088[_0x5031('0x14')],_0xbafaf9);_0x1afe55(_0x52c8ba[_0x5031('0x12')](0x1f4,_0x35f088[_0x5031('0x14')]));});});}; \ No newline at end of file +var _0x4a80=['findAll','raw','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message'];(function(_0x35fb61,_0x4f9f32){var _0x20e423=function(_0x2337c2){while(--_0x2337c2){_0x35fb61['push'](_0x35fb61['shift']());}};_0x20e423(++_0x4f9f32);}(_0x4a80,0x1ec));var _0x04a8=function(_0x5cedb2,_0x4ae4fe){_0x5cedb2=_0x5cedb2-0x0;var _0x4af7eb=_0x4a80[_0x5cedb2];return _0x4af7eb;};'use strict';var _=require(_0x04a8('0x0'));var util=require(_0x04a8('0x1'));var moment=require(_0x04a8('0x2'));var BPromise=require(_0x04a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04a8('0x4'));var db=require(_0x04a8('0x5'))['db'];var utils=require(_0x04a8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x04a8('0x7'));var jayson=require(_0x04a8('0x8'));var client=jayson['client'][_0x04a8('0x9')]({'port':0x232a});config[_0x04a8('0xa')]=_[_0x04a8('0xb')](config[_0x04a8('0xa')],{'host':_0x04a8('0xc'),'port':0x18eb});var socket=require(_0x04a8('0xd'))(new Redis(config[_0x04a8('0xa')]));require(_0x04a8('0xe'))[_0x04a8('0xf')](socket);function respondWithRpcPromise(_0x16fae0,_0x5ce528,_0x32bab3){return new BPromise(function(_0x51c746,_0x177de8){return client[_0x04a8('0x10')](_0x16fae0,_0x32bab3)[_0x04a8('0x11')](function(_0x329c80){logger[_0x04a8('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5ce528,'request\x20sent');logger[_0x04a8('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x5ce528,_0x04a8('0x14'),JSON[_0x04a8('0x15')](_0x329c80));if(_0x329c80[_0x04a8('0x16')]){if(_0x329c80[_0x04a8('0x16')][_0x04a8('0x17')]===0x1f4){logger[_0x04a8('0x16')](_0x04a8('0x18'),_0x5ce528,_0x329c80[_0x04a8('0x16')]['message']);return _0x177de8(_0x329c80[_0x04a8('0x16')]['message']);}logger[_0x04a8('0x16')](_0x04a8('0x18'),_0x5ce528,_0x329c80['error']['message']);return _0x51c746(_0x329c80[_0x04a8('0x16')][_0x04a8('0x19')]);}else{logger[_0x04a8('0x12')](_0x04a8('0x18'),_0x5ce528,'request\x20sent');_0x51c746(_0x329c80['result'][_0x04a8('0x19')]);}})['catch'](function(_0x481e63){logger[_0x04a8('0x16')](_0x04a8('0x18'),_0x5ce528,_0x481e63);_0x177de8(_0x481e63);});});}exports['GetVoiceQueueRtPauses']=function(_0x7e7f62){var _0x5a8868=this;return new Promise(function(_0x29904d,_0x31d54b){return db['UserVoiceQueueRt'][_0x04a8('0x1a')]({'raw':_0x7e7f62['options']?_0x7e7f62['options'][_0x04a8('0x1b')]===undefined?!![]:![]:!![],'where':_0x7e7f62[_0x04a8('0x1c')]?_0x7e7f62[_0x04a8('0x1c')][_0x04a8('0x1d')]||null:null,'attributes':[[db[_0x04a8('0x1e')]['fn'](_0x04a8('0x1f'),db[_0x04a8('0x1e')]['fn']('IF',db['sequelize'][_0x04a8('0x20')](_0x04a8('0x21')))),_0x04a8('0x22')]]})[_0x04a8('0x11')](function(_0x16a60e){logger[_0x04a8('0x12')](_0x04a8('0x23'),_0x7e7f62);logger[_0x04a8('0x13')](_0x04a8('0x23'),_0x7e7f62,JSON['stringify'](_0x16a60e));_0x29904d(_0x16a60e);})[_0x04a8('0x24')](function(_0x220c37){logger['error'](_0x04a8('0x23'),_0x220c37[_0x04a8('0x19')],_0x7e7f62);_0x31d54b(_0x5a8868[_0x04a8('0x16')](0x1f4,_0x220c37[_0x04a8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 3bf0855..f5a235a 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 _0x8769=['./userVoiceQueueRt.events','save','remove','emit','register','userVoiceQueueRt:'];(function(_0x2bf1fc,_0x3accef){var _0x544e64=function(_0x514e09){while(--_0x514e09){_0x2bf1fc['push'](_0x2bf1fc['shift']());}};_0x544e64(++_0x3accef);}(_0x8769,0x126));var _0x9876=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x8769[_0x2b9b7f];return _0x4ed19a;};'use strict';var UserVoiceQueueRtEvents=require(_0x9876('0x0'));var events=[_0x9876('0x1'),_0x9876('0x2'),'update'];function createListener(_0xac1f40,_0x2154ca){return function(_0x4e515d){_0x2154ca[_0x9876('0x3')](_0xac1f40,_0x4e515d);};}function removeListener(_0x30e09e,_0x2e905d){return function(){UserVoiceQueueRtEvents['removeListener'](_0x30e09e,_0x2e905d);};}exports[_0x9876('0x4')]=function(_0x1de36b){for(var _0x4d6f6c=0x0,_0x403f4e=events['length'];_0x4d6f6c<_0x403f4e;_0x4d6f6c++){var _0x682aa6=events[_0x4d6f6c];var _0x53ac69=createListener(_0x9876('0x5')+_0x682aa6,_0x1de36b);UserVoiceQueueRtEvents['on'](_0x682aa6,_0x53ac69);}}; \ No newline at end of file +var _0x8e07=['save','update','emit','removeListener','register','./userVoiceQueueRt.events'];(function(_0x57f062,_0x59af63){var _0x300467=function(_0x4d5bad){while(--_0x4d5bad){_0x57f062['push'](_0x57f062['shift']());}};_0x300467(++_0x59af63);}(_0x8e07,0x1a9));var _0x78e0=function(_0x1f0baf,_0x2031c6){_0x1f0baf=_0x1f0baf-0x0;var _0x567fcf=_0x8e07[_0x1f0baf];return _0x567fcf;};'use strict';var UserVoiceQueueRtEvents=require(_0x78e0('0x0'));var events=[_0x78e0('0x1'),'remove',_0x78e0('0x2')];function createListener(_0x3747b6,_0x3f2585){return function(_0x313983){_0x3f2585[_0x78e0('0x3')](_0x3747b6,_0x313983);};}function removeListener(_0x20d1d9,_0x9a64b7){return function(){UserVoiceQueueRtEvents[_0x78e0('0x4')](_0x20d1d9,_0x9a64b7);};}exports[_0x78e0('0x5')]=function(_0x19ac5f){for(var _0x4961df=0x0,_0x261c94=events['length'];_0x4961df<_0x261c94;_0x4961df++){var _0x1eb6e3=events[_0x4961df];var _0x16e64e=createListener('userVoiceQueueRt:'+_0x1eb6e3,_0x19ac5f);UserVoiceQueueRtEvents['on'](_0x1eb6e3,_0x16e64e);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 521f9b0..15fb71d 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 _0x7028=['multer','util','path','express','Router','../../components/interaction/service','../../config/environment','exports'];(function(_0x59a3e9,_0x27fb38){var _0x5179ac=function(_0x5a9b1c){while(--_0x5a9b1c){_0x59a3e9['push'](_0x59a3e9['shift']());}};_0x5179ac(++_0x27fb38);}(_0x7028,0x180));var _0x8702=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x7028[_0x55e08b];return _0xd1a7ff;};'use strict';var multer=require(_0x8702('0x0'));var util=require(_0x8702('0x1'));var path=require(_0x8702('0x2'));var timeout=require('connect-timeout');var express=require(_0x8702('0x3'));var router=express[_0x8702('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8702('0x5'));var config=require(_0x8702('0x6'));module[_0x8702('0x7')]=router; \ No newline at end of file +var _0xa92a=['multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x587638,_0x471bf5){var _0x119cdf=function(_0x3b4514){while(--_0x3b4514){_0x587638['push'](_0x587638['shift']());}};_0x119cdf(++_0x471bf5);}(_0xa92a,0x18c));var _0xaa92=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0xa92a[_0x3ebb69];return _0x421e59;};'use strict';var multer=require(_0xaa92('0x0'));var util=require('util');var path=require(_0xaa92('0x1'));var timeout=require(_0xaa92('0x2'));var express=require(_0xaa92('0x3'));var router=express[_0xaa92('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xaa92('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 14b509c..1f26675 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 _0xd8b0=['exports','sequelize'];(function(_0x57494e,_0x2c4d3d){var _0x4099da=function(_0x38c521){while(--_0x38c521){_0x57494e['push'](_0x57494e['shift']());}};_0x4099da(++_0x2c4d3d);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x4c7d0b,_0x14d4ec){var _0x46c779=function(_0x44a1c9){while(--_0x44a1c9){_0x4c7d0b['push'](_0x4c7d0b['shift']());}};_0x46c779(++_0x14d4ec);}(_0xe706,0xa3));var _0x6e70=function(_0x3ae812,_0x104449){_0x3ae812=_0x3ae812-0x0;var _0x4dd965=_0xe706[_0x3ae812];return _0x4dd965;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('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 869db2b..51db50d 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 _0xdd4f=['exports','define','UserWhatsappQueue','lodash','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0xfed1ef,_0x91f333){_0xfed1ef=_0xfed1ef-0x0;var _0x42dd16=_0xdd4f[_0xfed1ef];return _0x42dd16;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfdd4('0x1'));var BPromise=require(_0xfdd4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdd4('0x3'));var rimraf=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var attributes=require('./userWhatsappQueue.attributes');module[_0xfdd4('0x6')]=function(_0x43cbcf,_0x30e080){return _0x43cbcf[_0xfdd4('0x7')](_0xfdd4('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36ee=['UserWhatsappQueue','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x39b1f,_0x55ada0){var _0x4b4ead=function(_0xfaf2d5){while(--_0xfaf2d5){_0x39b1f['push'](_0x39b1f['shift']());}};_0x4b4ead(++_0x55ada0);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe36e('0x0'))('api');var moment=require(_0xe36e('0x1'));var BPromise=require(_0xe36e('0x2'));var rp=require(_0xe36e('0x3'));var fs=require('fs');var path=require(_0xe36e('0x4'));var rimraf=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var attributes=require(_0xe36e('0x7'));module[_0xe36e('0x8')]=function(_0x25a07d,_0x190404){return _0x25a07d[_0xe36e('0x9')](_0xe36e('0xa'),attributes,{'tableName':'user_has_whatsapp_queues','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 f81521f..5645d6e 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 _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x17f2cd,_0xdc933a){var _0x40bd4b=function(_0x33fd7a){while(--_0x33fd7a){_0x17f2cd['push'](_0x17f2cd['shift']());}};_0x40bd4b(++_0xdc933a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x2f64e1,_0x433551){var _0x9ece19=function(_0x504812){while(--_0x504812){_0x2f64e1['push'](_0x2f64e1['shift']());}};_0x9ece19(++_0x433551);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 83c3ee2..c2cd515 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 _0x440f=['delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','create','update'];(function(_0x20b0bc,_0x126df6){var _0xc5e34f=function(_0x495855){while(--_0x495855){_0x20b0bc['push'](_0x20b0bc['shift']());}};_0xc5e34f(++_0x126df6);}(_0x440f,0x143));var _0xf440=function(_0x2e2d78,_0x3eabe5){_0x2e2d78=_0x2e2d78-0x0;var _0x7b7e3e=_0x440f[_0x2e2d78];return _0x7b7e3e;};'use strict';var multer=require('multer');var util=require(_0xf440('0x0'));var path=require(_0xf440('0x1'));var timeout=require(_0xf440('0x2'));var express=require('express');var router=express[_0xf440('0x3')]();var auth=require(_0xf440('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf440('0x5'));var controller=require(_0xf440('0x6'));router[_0xf440('0x7')]('/',auth[_0xf440('0x8')](),controller['index']);router[_0xf440('0x7')](_0xf440('0x9'),auth[_0xf440('0x8')](),controller[_0xf440('0xa')]);router['post']('/',auth[_0xf440('0x8')](),controller[_0xf440('0xb')]);router['put'](_0xf440('0x9'),auth[_0xf440('0x8')](),controller[_0xf440('0xc')]);router[_0xf440('0xd')]('/:id',auth[_0xf440('0x8')](),controller[_0xf440('0xe')]);module[_0xf440('0xf')]=router; \ No newline at end of file +var _0xd013=['./variable.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x593d56,_0x10d793){var _0xb1c92c=function(_0x25f720){while(--_0x25f720){_0x593d56['push'](_0x593d56['shift']());}};_0xb1c92c(++_0x10d793);}(_0xd013,0x1b0));var _0x3d01=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xd013[_0x4cfc1d];return _0x1c01a0;};'use strict';var multer=require(_0x3d01('0x0'));var util=require(_0x3d01('0x1'));var path=require(_0x3d01('0x2'));var timeout=require(_0x3d01('0x3'));var express=require('express');var router=express[_0x3d01('0x4')]();var auth=require(_0x3d01('0x5'));var interaction=require(_0x3d01('0x6'));var config=require(_0x3d01('0x7'));var controller=require(_0x3d01('0x8'));router[_0x3d01('0x9')]('/',auth[_0x3d01('0xa')](),controller['index']);router[_0x3d01('0x9')](_0x3d01('0xb'),auth[_0x3d01('0xa')](),controller[_0x3d01('0xc')]);router[_0x3d01('0xd')]('/',auth['isAuthenticated'](),controller[_0x3d01('0xe')]);router[_0x3d01('0xf')](_0x3d01('0xb'),auth[_0x3d01('0xa')](),controller[_0x3d01('0x10')]);router[_0x3d01('0x11')]('/:id',auth[_0x3d01('0xa')](),controller[_0x3d01('0x12')]);module[_0x3d01('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index d5f6921..ad5d59e 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 _0xdb14=['STRING','name','sequelize','exports'];(function(_0x332d42,_0x15c527){var _0x2ddb8b=function(_0x1d0cf5){while(--_0x1d0cf5){_0x332d42['push'](_0x332d42['shift']());}};_0x2ddb8b(++_0x15c527);}(_0xdb14,0x10e));var _0x4db1=function(_0xade8bc,_0x570901){_0xade8bc=_0xade8bc-0x0;var _0x8461a3=_0xdb14[_0xade8bc];return _0x8461a3;};'use strict';var Sequelize=require(_0x4db1('0x0'));module[_0x4db1('0x1')]={'name':{'type':Sequelize[_0x4db1('0x2')],'unique':_0x4db1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4db1('0x2')]}}; \ No newline at end of file +var _0x3cbd=['exports','name','STRING','sequelize'];(function(_0xa92013,_0x3b2577){var _0x49fdfa=function(_0x4b88a6){while(--_0x4b88a6){_0xa92013['push'](_0xa92013['shift']());}};_0x49fdfa(++_0x3b2577);}(_0x3cbd,0x113));var _0xd3cb=function(_0x39887a,_0x5835ca){_0x39887a=_0x39887a-0x0;var _0x1f8468=_0x3cbd[_0x39887a];return _0x1f8468;};'use strict';var Sequelize=require(_0xd3cb('0x0'));module[_0xd3cb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd3cb('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd3cb('0x3')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 8082d37..611fc1b 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 _0xdc4b=['count','includeAll','findAll','rows','catch','show','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','UserProfileResource','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','where','pick','filter','merge','VIRTUAL','Variable'];(function(_0x5609d8,_0x283093){var _0x4a54cc=function(_0x5b755b){while(--_0x5b755b){_0x5609d8['push'](_0x5609d8['shift']());}};_0x4a54cc(++_0x283093);}(_0xdc4b,0x66));var _0xbdc4=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xdc4b[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0xbdc4('0x0'));var emlformat=require(_0xbdc4('0x1'));var rimraf=require(_0xbdc4('0x2'));var zipdir=require(_0xbdc4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdc4('0x4'));var Mustache=require(_0xbdc4('0x5'));var util=require(_0xbdc4('0x6'));var path=require(_0xbdc4('0x7'));var sox=require(_0xbdc4('0x8'));var csv=require(_0xbdc4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbdc4('0xa'));var squel=require('squel');var crypto=require(_0xbdc4('0xb'));var jsforce=require(_0xbdc4('0xc'));var deskjs=require(_0xbdc4('0xd'));var toCsv=require(_0xbdc4('0x9'));var querystring=require(_0xbdc4('0xe'));var Papa=require('papaparse');var Redis=require(_0xbdc4('0xf'));var authService=require(_0xbdc4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbdc4('0x11'));var hardwareService=require(_0xbdc4('0x12'));var logger=require(_0xbdc4('0x13'))(_0xbdc4('0x14'));var utils=require(_0xbdc4('0x15'));var config=require(_0xbdc4('0x16'));var licenseUtil=require(_0xbdc4('0x17'));var db=require(_0xbdc4('0x18'))['db'];function respondWithStatusCode(_0x273d93,_0x3922e7){_0x3922e7=_0x3922e7||0xcc;return function(_0x1b79b8){if(_0x1b79b8){return _0x273d93[_0xbdc4('0x19')](_0x3922e7);}return _0x273d93[_0xbdc4('0x1a')](_0x3922e7)[_0xbdc4('0x1b')]();};}function respondWithResult(_0x30c732,_0x231c46){_0x231c46=_0x231c46||0xc8;return function(_0x7a0c9a){if(_0x7a0c9a){return _0x30c732[_0xbdc4('0x1a')](_0x231c46)[_0xbdc4('0x1c')](_0x7a0c9a);}};}function respondWithFilteredResult(_0x6856f6,_0x4b66fd){return function(_0x15a5de){if(_0x15a5de){var _0x3464f3=_0x15a5de['count'],_0x17485f=_0x4b66fd[_0xbdc4('0x1d')],_0x396288=_0x4b66fd['offset']+_0x4b66fd[_0xbdc4('0x1e')],_0x21c187;if(_0x396288>=_0x3464f3){_0x396288=_0x3464f3;_0x21c187=0xc8;}else{_0x21c187=0xce;}_0x6856f6[_0xbdc4('0x1a')](_0x21c187);return _0x6856f6[_0xbdc4('0x1f')](_0xbdc4('0x20'),_0x17485f+'-'+_0x396288+'/'+_0x3464f3)[_0xbdc4('0x1c')](_0x15a5de);}return null;};}function patchUpdates(_0x104d18){return function(_0x2a8612){try{jsonpatch[_0xbdc4('0x21')](_0x2a8612,_0x104d18,!![]);}catch(_0xa7a855){return BPromise[_0xbdc4('0x22')](_0xa7a855);}return _0x2a8612[_0xbdc4('0x23')]();};}function saveUpdates(_0x9a3df9,_0x2ec443){return function(_0x9a5fb9){if(_0x9a5fb9){return _0x9a5fb9[_0xbdc4('0x24')](_0x9a3df9)[_0xbdc4('0x25')](function(_0x63b9e0){return _0x63b9e0;});}return null;};}function removeEntity(_0x255952,_0x23a507){return function(_0x1e9bd){if(_0x1e9bd){return _0x1e9bd[_0xbdc4('0x26')]()[_0xbdc4('0x25')](function(){var _0x326db4=_0x1e9bd[_0xbdc4('0x27')]({'plain':!![]});var _0x3c841e='Variables';return db['UserProfileResource'][_0xbdc4('0x26')]({'where':{'type':_0x3c841e,'resourceId':_0x326db4['id']}})[_0xbdc4('0x25')](function(){return _0x1e9bd;});})[_0xbdc4('0x25')](function(){_0x255952['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x493e9b,_0xd2816b){return function(_0x55ac7f){if(!_0x55ac7f){_0x493e9b[_0xbdc4('0x19')](0x194);}return _0x55ac7f;};}function handleError(_0x575253,_0xe800dc){_0xe800dc=_0xe800dc||0x1f4;return function(_0x14d251){logger[_0xbdc4('0x28')](_0x14d251[_0xbdc4('0x29')]);if(_0x14d251[_0xbdc4('0x2a')]){delete _0x14d251[_0xbdc4('0x2a')];}_0x575253[_0xbdc4('0x1a')](_0xe800dc)[_0xbdc4('0x2b')](_0x14d251);};}exports[_0xbdc4('0x2c')]=function(_0xa490a5,_0x5c2f46){var _0x2faaf2={},_0x34c3aa={},_0x19a687={'count':0x0,'rows':[]};var _0x4d72db=_[_0xbdc4('0x2d')](db['Variable'][_0xbdc4('0x2e')],function(_0x2688d0){return{'name':_0x2688d0[_0xbdc4('0x2f')],'type':_0x2688d0[_0xbdc4('0x30')][_0xbdc4('0x31')]};});_0x34c3aa[_0xbdc4('0x32')]=_['map'](_0x4d72db,'name');_0x34c3aa[_0xbdc4('0x33')]=_[_0xbdc4('0x34')](_0xa490a5[_0xbdc4('0x33')]);_0x34c3aa[_0xbdc4('0x35')]=_[_0xbdc4('0x36')](_0x34c3aa['model'],_0x34c3aa[_0xbdc4('0x33')]);_0x2faaf2['attributes']=_[_0xbdc4('0x36')](_0x34c3aa['model'],qs[_0xbdc4('0x37')](_0xa490a5['query'][_0xbdc4('0x37')]));_0x2faaf2[_0xbdc4('0x38')]=_0x2faaf2[_0xbdc4('0x38')]['length']?_0x2faaf2['attributes']:_0x34c3aa[_0xbdc4('0x32')];if(!_0xa490a5[_0xbdc4('0x33')]['hasOwnProperty'](_0xbdc4('0x39'))){_0x2faaf2['limit']=qs[_0xbdc4('0x1e')](_0xa490a5[_0xbdc4('0x33')][_0xbdc4('0x1e')]);_0x2faaf2[_0xbdc4('0x1d')]=qs['offset'](_0xa490a5[_0xbdc4('0x33')][_0xbdc4('0x1d')]);}_0x2faaf2['order']=qs['sort'](_0xa490a5[_0xbdc4('0x33')]['sort']);_0x2faaf2[_0xbdc4('0x3a')]=qs['filters'](_[_0xbdc4('0x3b')](_0xa490a5['query'],_0x34c3aa[_0xbdc4('0x35')]),_0x4d72db);if(_0xa490a5[_0xbdc4('0x33')][_0xbdc4('0x3c')]){_0x2faaf2[_0xbdc4('0x3a')]=_[_0xbdc4('0x3d')](_0x2faaf2[_0xbdc4('0x3a')],{'$or':_[_0xbdc4('0x2d')](_0x4d72db,function(_0x31c5f4){if(_0x31c5f4['type']!==_0xbdc4('0x3e')){var _0x373429={};_0x373429[_0x31c5f4['name']]={'$like':'%'+_0xa490a5[_0xbdc4('0x33')][_0xbdc4('0x3c')]+'%'};return _0x373429;}})});}_0x2faaf2=_[_0xbdc4('0x3d')]({},_0x2faaf2,_0xa490a5['options']);var _0x5c8ee1={'where':_0x2faaf2[_0xbdc4('0x3a')]};return db[_0xbdc4('0x3f')]['count'](_0x5c8ee1)[_0xbdc4('0x25')](function(_0xbe8b12){_0x19a687[_0xbdc4('0x40')]=_0xbe8b12;if(_0xa490a5[_0xbdc4('0x33')][_0xbdc4('0x41')]){_0x2faaf2['include']=[{'all':!![]}];}return db[_0xbdc4('0x3f')][_0xbdc4('0x42')](_0x2faaf2);})[_0xbdc4('0x25')](function(_0x3fff25){_0x19a687[_0xbdc4('0x43')]=_0x3fff25;return _0x19a687;})[_0xbdc4('0x25')](respondWithFilteredResult(_0x5c2f46,_0x2faaf2))[_0xbdc4('0x44')](handleError(_0x5c2f46,null));};exports[_0xbdc4('0x45')]=function(_0x3bc377,_0x4a8a02){var _0x3e0fd3={'raw':!![],'where':{'id':_0x3bc377['params']['id']}},_0x70e57d={};_0x70e57d[_0xbdc4('0x32')]=_[_0xbdc4('0x34')](db[_0xbdc4('0x3f')][_0xbdc4('0x2e')]);_0x70e57d['query']=_[_0xbdc4('0x34')](_0x3bc377['query']);_0x70e57d[_0xbdc4('0x35')]=_[_0xbdc4('0x36')](_0x70e57d[_0xbdc4('0x32')],_0x70e57d['query']);_0x3e0fd3[_0xbdc4('0x38')]=_[_0xbdc4('0x36')](_0x70e57d[_0xbdc4('0x32')],qs[_0xbdc4('0x37')](_0x3bc377[_0xbdc4('0x33')][_0xbdc4('0x37')]));_0x3e0fd3[_0xbdc4('0x38')]=_0x3e0fd3[_0xbdc4('0x38')][_0xbdc4('0x46')]?_0x3e0fd3['attributes']:_0x70e57d['model'];if(_0x3bc377[_0xbdc4('0x33')]['includeAll']){_0x3e0fd3[_0xbdc4('0x47')]=[{'all':!![]}];}_0x3e0fd3=_['merge']({},_0x3e0fd3,_0x3bc377[_0xbdc4('0x48')]);return db[_0xbdc4('0x3f')][_0xbdc4('0x49')](_0x3e0fd3)['then'](handleEntityNotFound(_0x4a8a02,null))[_0xbdc4('0x25')](respondWithResult(_0x4a8a02,null))[_0xbdc4('0x44')](handleError(_0x4a8a02,null));};exports[_0xbdc4('0x4a')]=function(_0xa1e69a,_0x156f60){return db[_0xbdc4('0x3f')][_0xbdc4('0x4a')](_0xa1e69a[_0xbdc4('0x4b')],{})['then'](function(_0x28b6c5){var _0x492f7e=_0xa1e69a[_0xbdc4('0x4c')][_0xbdc4('0x27')]({'plain':!![]});if(!_0x492f7e)throw new Error(_0xbdc4('0x4d'));if(_0x492f7e[_0xbdc4('0x4e')]==='user'){var _0x1a952d=_0x28b6c5[_0xbdc4('0x27')]({'plain':!![]});var _0x299ec7=_0xbdc4('0x4f');return db[_0xbdc4('0x50')][_0xbdc4('0x49')]({'where':{'name':_0x299ec7,'userProfileId':_0x492f7e[_0xbdc4('0x51')]},'raw':!![]})['then'](function(_0x4036b8){if(_0x4036b8&&_0x4036b8['autoAssociation']===0x0){return db[_0xbdc4('0x52')]['create']({'name':_0x1a952d[_0xbdc4('0x2a')],'resourceId':_0x1a952d['id'],'type':_0x4036b8[_0xbdc4('0x2a')],'sectionId':_0x4036b8['id']},{})['then'](function(){return _0x28b6c5;});}else{return _0x28b6c5;}})[_0xbdc4('0x44')](function(_0x313fde){logger[_0xbdc4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x313fde);throw _0x313fde;});}return _0x28b6c5;})[_0xbdc4('0x25')](respondWithResult(_0x156f60,0xc9))['catch'](handleError(_0x156f60,null));};exports[_0xbdc4('0x24')]=function(_0x4139d1,_0x2ea516){if(_0x4139d1['body']['id']){delete _0x4139d1[_0xbdc4('0x4b')]['id'];}return db[_0xbdc4('0x3f')][_0xbdc4('0x49')]({'where':{'id':_0x4139d1['params']['id']}})[_0xbdc4('0x25')](handleEntityNotFound(_0x2ea516,null))['then'](saveUpdates(_0x4139d1[_0xbdc4('0x4b')],null))[_0xbdc4('0x25')](respondWithResult(_0x2ea516,null))[_0xbdc4('0x44')](handleError(_0x2ea516,null));};exports[_0xbdc4('0x26')]=function(_0x26c505,_0x38e8ea){return db[_0xbdc4('0x3f')]['find']({'where':{'id':_0x26c505['params']['id']}})[_0xbdc4('0x25')](handleEntityNotFound(_0x38e8ea,null))['then'](removeEntity(_0x38e8ea,null))[_0xbdc4('0x44')](handleError(_0x38e8ea,null));}; \ No newline at end of file +var _0x5bce=['rimraf','fast-json-patch','request-promise','bluebird','path','sox','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/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','then','destroy','get','Variables','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','Variable','includeAll','findAll','rows','catch','show','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format'];(function(_0x4b0c30,_0x38dce7){var _0x536d6e=function(_0x3f6872){while(--_0x3f6872){_0x4b0c30['push'](_0x4b0c30['shift']());}};_0x536d6e(++_0x38dce7);}(_0x5bce,0xa6));var _0xe5bc=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0x5bce[_0x2c5255];return _0x30d0ea;};'use strict';var pdf=require(_0xe5bc('0x0'));var emlformat=require(_0xe5bc('0x1'));var rimraf=require(_0xe5bc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe5bc('0x3'));var rp=require(_0xe5bc('0x4'));var moment=require('moment');var BPromise=require(_0xe5bc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe5bc('0x6'));var sox=require(_0xe5bc('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe5bc('0x8'));var squel=require(_0xe5bc('0x9'));var crypto=require(_0xe5bc('0xa'));var jsforce=require(_0xe5bc('0xb'));var deskjs=require(_0xe5bc('0xc'));var toCsv=require(_0xe5bc('0xd'));var querystring=require('querystring');var Papa=require(_0xe5bc('0xe'));var Redis=require(_0xe5bc('0xf'));var authService=require(_0xe5bc('0x10'));var qs=require(_0xe5bc('0x11'));var as=require(_0xe5bc('0x12'));var hardwareService=require(_0xe5bc('0x13'));var logger=require(_0xe5bc('0x14'))(_0xe5bc('0x15'));var utils=require(_0xe5bc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe5bc('0x17'));var db=require(_0xe5bc('0x18'))['db'];function respondWithStatusCode(_0x4a8a28,_0x4864ae){_0x4864ae=_0x4864ae||0xcc;return function(_0x155733){if(_0x155733){return _0x4a8a28[_0xe5bc('0x19')](_0x4864ae);}return _0x4a8a28[_0xe5bc('0x1a')](_0x4864ae)[_0xe5bc('0x1b')]();};}function respondWithResult(_0x4a44fd,_0x52f41d){_0x52f41d=_0x52f41d||0xc8;return function(_0x147ffd){if(_0x147ffd){return _0x4a44fd[_0xe5bc('0x1a')](_0x52f41d)[_0xe5bc('0x1c')](_0x147ffd);}};}function respondWithFilteredResult(_0x28f801,_0x5bf000){return function(_0x5b3c7e){if(_0x5b3c7e){var _0x4de360=_0x5b3c7e[_0xe5bc('0x1d')],_0x1f005d=_0x5bf000[_0xe5bc('0x1e')],_0x44cb42=_0x5bf000['offset']+_0x5bf000['limit'],_0x284f5d;if(_0x44cb42>=_0x4de360){_0x44cb42=_0x4de360;_0x284f5d=0xc8;}else{_0x284f5d=0xce;}_0x28f801[_0xe5bc('0x1a')](_0x284f5d);return _0x28f801[_0xe5bc('0x1f')](_0xe5bc('0x20'),_0x1f005d+'-'+_0x44cb42+'/'+_0x4de360)[_0xe5bc('0x1c')](_0x5b3c7e);}return null;};}function patchUpdates(_0x386752){return function(_0x18ffbd){try{jsonpatch['apply'](_0x18ffbd,_0x386752,!![]);}catch(_0x31e297){return BPromise[_0xe5bc('0x21')](_0x31e297);}return _0x18ffbd['save']();};}function saveUpdates(_0xc1ab9f,_0x41baf2){return function(_0x2bbf65){if(_0x2bbf65){return _0x2bbf65[_0xe5bc('0x22')](_0xc1ab9f)[_0xe5bc('0x23')](function(_0x10c3ee){return _0x10c3ee;});}return null;};}function removeEntity(_0x97ab77,_0x1c040b){return function(_0x36f56b){if(_0x36f56b){return _0x36f56b[_0xe5bc('0x24')]()[_0xe5bc('0x23')](function(){var _0x2c1158=_0x36f56b[_0xe5bc('0x25')]({'plain':!![]});var _0x44ae57=_0xe5bc('0x26');return db['UserProfileResource'][_0xe5bc('0x24')]({'where':{'type':_0x44ae57,'resourceId':_0x2c1158['id']}})[_0xe5bc('0x23')](function(){return _0x36f56b;});})['then'](function(){_0x97ab77[_0xe5bc('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x561bad,_0x44aaf2){return function(_0x2403af){if(!_0x2403af){_0x561bad['sendStatus'](0x194);}return _0x2403af;};}function handleError(_0x3ab4a0,_0x4ad7ab){_0x4ad7ab=_0x4ad7ab||0x1f4;return function(_0x13e388){logger[_0xe5bc('0x27')](_0x13e388[_0xe5bc('0x28')]);if(_0x13e388[_0xe5bc('0x29')]){delete _0x13e388[_0xe5bc('0x29')];}_0x3ab4a0['status'](_0x4ad7ab)[_0xe5bc('0x2a')](_0x13e388);};}exports[_0xe5bc('0x2b')]=function(_0xc79d0,_0x9949e9){var _0x5b5317={},_0x4b5786={},_0xa68a74={'count':0x0,'rows':[]};var _0x16fa90=_[_0xe5bc('0x2c')](db['Variable'][_0xe5bc('0x2d')],function(_0x16a1ad){return{'name':_0x16a1ad[_0xe5bc('0x2e')],'type':_0x16a1ad[_0xe5bc('0x2f')]['key']};});_0x4b5786[_0xe5bc('0x30')]=_[_0xe5bc('0x2c')](_0x16fa90,_0xe5bc('0x29'));_0x4b5786[_0xe5bc('0x31')]=_[_0xe5bc('0x32')](_0xc79d0[_0xe5bc('0x31')]);_0x4b5786[_0xe5bc('0x33')]=_[_0xe5bc('0x34')](_0x4b5786['model'],_0x4b5786[_0xe5bc('0x31')]);_0x5b5317['attributes']=_[_0xe5bc('0x34')](_0x4b5786['model'],qs[_0xe5bc('0x35')](_0xc79d0[_0xe5bc('0x31')][_0xe5bc('0x35')]));_0x5b5317[_0xe5bc('0x36')]=_0x5b5317[_0xe5bc('0x36')][_0xe5bc('0x37')]?_0x5b5317[_0xe5bc('0x36')]:_0x4b5786[_0xe5bc('0x30')];if(!_0xc79d0[_0xe5bc('0x31')][_0xe5bc('0x38')](_0xe5bc('0x39'))){_0x5b5317[_0xe5bc('0x3a')]=qs[_0xe5bc('0x3a')](_0xc79d0[_0xe5bc('0x31')]['limit']);_0x5b5317['offset']=qs['offset'](_0xc79d0[_0xe5bc('0x31')]['offset']);}_0x5b5317[_0xe5bc('0x3b')]=qs[_0xe5bc('0x3c')](_0xc79d0[_0xe5bc('0x31')][_0xe5bc('0x3c')]);_0x5b5317[_0xe5bc('0x3d')]=qs[_0xe5bc('0x33')](_[_0xe5bc('0x3e')](_0xc79d0[_0xe5bc('0x31')],_0x4b5786[_0xe5bc('0x33')]),_0x16fa90);if(_0xc79d0['query'][_0xe5bc('0x3f')]){_0x5b5317[_0xe5bc('0x3d')]=_[_0xe5bc('0x40')](_0x5b5317['where'],{'$or':_['map'](_0x16fa90,function(_0x4914a1){if(_0x4914a1[_0xe5bc('0x2f')]!==_0xe5bc('0x41')){var _0x2a1752={};_0x2a1752[_0x4914a1[_0xe5bc('0x29')]]={'$like':'%'+_0xc79d0[_0xe5bc('0x31')][_0xe5bc('0x3f')]+'%'};return _0x2a1752;}})});}_0x5b5317=_['merge']({},_0x5b5317,_0xc79d0['options']);var _0x7c55db={'where':_0x5b5317['where']};return db[_0xe5bc('0x42')]['count'](_0x7c55db)[_0xe5bc('0x23')](function(_0xd26a34){_0xa68a74[_0xe5bc('0x1d')]=_0xd26a34;if(_0xc79d0[_0xe5bc('0x31')][_0xe5bc('0x43')]){_0x5b5317['include']=[{'all':!![]}];}return db[_0xe5bc('0x42')][_0xe5bc('0x44')](_0x5b5317);})[_0xe5bc('0x23')](function(_0x3fa7b1){_0xa68a74[_0xe5bc('0x45')]=_0x3fa7b1;return _0xa68a74;})['then'](respondWithFilteredResult(_0x9949e9,_0x5b5317))[_0xe5bc('0x46')](handleError(_0x9949e9,null));};exports[_0xe5bc('0x47')]=function(_0x2aaa71,_0x4f9022){var _0x56d4cf={'raw':!![],'where':{'id':_0x2aaa71['params']['id']}},_0x587429={};_0x587429[_0xe5bc('0x30')]=_[_0xe5bc('0x32')](db[_0xe5bc('0x42')][_0xe5bc('0x2d')]);_0x587429[_0xe5bc('0x31')]=_['keys'](_0x2aaa71['query']);_0x587429[_0xe5bc('0x33')]=_[_0xe5bc('0x34')](_0x587429[_0xe5bc('0x30')],_0x587429[_0xe5bc('0x31')]);_0x56d4cf[_0xe5bc('0x36')]=_[_0xe5bc('0x34')](_0x587429[_0xe5bc('0x30')],qs['fields'](_0x2aaa71['query'][_0xe5bc('0x35')]));_0x56d4cf['attributes']=_0x56d4cf[_0xe5bc('0x36')][_0xe5bc('0x37')]?_0x56d4cf[_0xe5bc('0x36')]:_0x587429[_0xe5bc('0x30')];if(_0x2aaa71[_0xe5bc('0x31')][_0xe5bc('0x43')]){_0x56d4cf[_0xe5bc('0x48')]=[{'all':!![]}];}_0x56d4cf=_[_0xe5bc('0x40')]({},_0x56d4cf,_0x2aaa71[_0xe5bc('0x49')]);return db['Variable'][_0xe5bc('0x4a')](_0x56d4cf)[_0xe5bc('0x23')](handleEntityNotFound(_0x4f9022,null))[_0xe5bc('0x23')](respondWithResult(_0x4f9022,null))[_0xe5bc('0x46')](handleError(_0x4f9022,null));};exports[_0xe5bc('0x4b')]=function(_0x29bcf7,_0x233d08){return db[_0xe5bc('0x42')]['create'](_0x29bcf7[_0xe5bc('0x4c')],{})['then'](function(_0x2d9c2d){var _0xf5e440=_0x29bcf7[_0xe5bc('0x4d')]['get']({'plain':!![]});if(!_0xf5e440)throw new Error(_0xe5bc('0x4e'));if(_0xf5e440['role']===_0xe5bc('0x4d')){var _0xc1712b=_0x2d9c2d['get']({'plain':!![]});var _0x7227a4=_0xe5bc('0x26');return db[_0xe5bc('0x4f')][_0xe5bc('0x4a')]({'where':{'name':_0x7227a4,'userProfileId':_0xf5e440[_0xe5bc('0x50')]},'raw':!![]})['then'](function(_0x2f1d33){if(_0x2f1d33&&_0x2f1d33[_0xe5bc('0x51')]===0x0){return db['UserProfileResource'][_0xe5bc('0x4b')]({'name':_0xc1712b['name'],'resourceId':_0xc1712b['id'],'type':_0x2f1d33[_0xe5bc('0x29')],'sectionId':_0x2f1d33['id']},{})[_0xe5bc('0x23')](function(){return _0x2d9c2d;});}else{return _0x2d9c2d;}})[_0xe5bc('0x46')](function(_0x1e8c8f){logger[_0xe5bc('0x27')](_0xe5bc('0x52'),_0x1e8c8f);throw _0x1e8c8f;});}return _0x2d9c2d;})['then'](respondWithResult(_0x233d08,0xc9))['catch'](handleError(_0x233d08,null));};exports['update']=function(_0x1c8001,_0x4281ff){if(_0x1c8001['body']['id']){delete _0x1c8001[_0xe5bc('0x4c')]['id'];}return db[_0xe5bc('0x42')]['find']({'where':{'id':_0x1c8001[_0xe5bc('0x53')]['id']}})[_0xe5bc('0x23')](handleEntityNotFound(_0x4281ff,null))[_0xe5bc('0x23')](saveUpdates(_0x1c8001[_0xe5bc('0x4c')],null))['then'](respondWithResult(_0x4281ff,null))[_0xe5bc('0x46')](handleError(_0x4281ff,null));};exports[_0xe5bc('0x24')]=function(_0x59f12a,_0x534a4d){return db['Variable']['find']({'where':{'id':_0x59f12a[_0xe5bc('0x53')]['id']}})[_0xe5bc('0x23')](handleEntityNotFound(_0x534a4d,null))[_0xe5bc('0x23')](removeEntity(_0x534a4d,null))[_0xe5bc('0x46')](handleError(_0x534a4d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3c61b60..d0ce0f8 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 _0xd110=['bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable','lodash','util','../../config/logger','moment'];(function(_0x4f2a57,_0x762824){var _0x2aea5a=function(_0x56ebda){while(--_0x56ebda){_0x4f2a57['push'](_0x4f2a57['shift']());}};_0x2aea5a(++_0x762824);}(_0xd110,0x1e8));var _0x0d11=function(_0x1b9062,_0x3af444){_0x1b9062=_0x1b9062-0x0;var _0x43d842=_0xd110[_0x1b9062];return _0x43d842;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var logger=require(_0x0d11('0x2'))('api');var moment=require(_0x0d11('0x3'));var BPromise=require(_0x0d11('0x4'));var rp=require(_0x0d11('0x5'));var fs=require('fs');var path=require(_0x0d11('0x6'));var rimraf=require(_0x0d11('0x7'));var config=require(_0x0d11('0x8'));var attributes=require(_0x0d11('0x9'));module[_0x0d11('0xa')]=function(_0x578537,_0xf61dad){return _0x578537['define'](_0x0d11('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb441=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','../../config/logger','moment','bluebird'];(function(_0xb1174e,_0x1e68a7){var _0x285bac=function(_0x32c505){while(--_0x32c505){_0xb1174e['push'](_0xb1174e['shift']());}};_0x285bac(++_0x1e68a7);}(_0xb441,0xa5));var _0x1b44=function(_0x5a046f,_0x5bcb03){_0x5a046f=_0x5a046f-0x0;var _0x1548d1=_0xb441[_0x5a046f];return _0x1548d1;};'use strict';var _=require(_0x1b44('0x0'));var util=require('util');var logger=require(_0x1b44('0x1'))('api');var moment=require(_0x1b44('0x2'));var BPromise=require(_0x1b44('0x3'));var rp=require(_0x1b44('0x4'));var fs=require('fs');var path=require(_0x1b44('0x5'));var rimraf=require(_0x1b44('0x6'));var config=require(_0x1b44('0x7'));var attributes=require(_0x1b44('0x8'));module[_0x1b44('0x9')]=function(_0x264f3c,_0x47b04c){return _0x264f3c[_0x1b44('0xa')](_0x1b44('0xb'),attributes,{'tableName':_0x1b44('0xc'),'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 131ed32..feb95cb 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 _0x5b6b=['client','http','then','Variable,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','ShowVariable','options','raw','include','map','model','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x4bad6c,_0x29ec89){var _0x46ac3b=function(_0x7f67e0){while(--_0x7f67e0){_0x4bad6c['push'](_0x4bad6c['shift']());}};_0x46ac3b(++_0x29ec89);}(_0x5b6b,0x6b));var _0xb5b6=function(_0xabd71c,_0x22b914){_0xabd71c=_0xabd71c-0x0;var _0x20b632=_0x5b6b[_0xabd71c];return _0x20b632;};'use strict';var _=require('lodash');var util=require(_0xb5b6('0x0'));var moment=require(_0xb5b6('0x1'));var BPromise=require(_0xb5b6('0x2'));var rs=require(_0xb5b6('0x3'));var fs=require('fs');var Redis=require(_0xb5b6('0x4'));var db=require(_0xb5b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb5b6('0x6'));var config=require(_0xb5b6('0x7'));var jayson=require(_0xb5b6('0x8'));var client=jayson[_0xb5b6('0x9')][_0xb5b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x202abb,_0x500d44,_0x352038){return new BPromise(function(_0x545542,_0x2a5313){return client['request'](_0x202abb,_0x352038)[_0xb5b6('0xb')](function(_0x583920){logger['info'](_0xb5b6('0xc'),_0x500d44,'request\x20sent');logger[_0xb5b6('0xd')]('Variable,\x20%s,\x20%s,\x20%s',_0x500d44,_0xb5b6('0xe'),JSON[_0xb5b6('0xf')](_0x583920));if(_0x583920[_0xb5b6('0x10')]){if(_0x583920[_0xb5b6('0x10')][_0xb5b6('0x11')]===0x1f4){logger[_0xb5b6('0x10')](_0xb5b6('0xc'),_0x500d44,_0x583920['error'][_0xb5b6('0x12')]);return _0x2a5313(_0x583920[_0xb5b6('0x10')][_0xb5b6('0x12')]);}logger[_0xb5b6('0x10')](_0xb5b6('0xc'),_0x500d44,_0x583920[_0xb5b6('0x10')][_0xb5b6('0x12')]);return _0x545542(_0x583920[_0xb5b6('0x10')][_0xb5b6('0x12')]);}else{logger[_0xb5b6('0x13')]('Variable,\x20%s,\x20%s',_0x500d44,'request\x20sent');_0x545542(_0x583920[_0xb5b6('0x14')][_0xb5b6('0x12')]);}})[_0xb5b6('0x15')](function(_0x25f32b){logger['error']('Variable,\x20%s,\x20%s',_0x500d44,_0x25f32b);_0x2a5313(_0x25f32b);});});}exports[_0xb5b6('0x16')]=function(_0xb0ef6e){var _0x1d7048=this;return new Promise(function(_0x2c9485,_0x3c2025){return db['Variable']['find']({'raw':_0xb0ef6e[_0xb5b6('0x17')]?_0xb0ef6e[_0xb5b6('0x17')][_0xb5b6('0x18')]===undefined?!![]:![]:!![],'where':_0xb0ef6e['options']?_0xb0ef6e[_0xb5b6('0x17')]['where']||null:null,'attributes':_0xb0ef6e[_0xb5b6('0x17')]?_0xb0ef6e[_0xb5b6('0x17')]['attributes']||null:null,'include':_0xb0ef6e[_0xb5b6('0x17')]?_0xb0ef6e[_0xb5b6('0x17')][_0xb5b6('0x19')]?_[_0xb5b6('0x1a')](_0xb0ef6e[_0xb5b6('0x17')][_0xb5b6('0x19')],function(_0x262bca){return{'model':db[_0x262bca[_0xb5b6('0x1b')]],'as':_0x262bca['as'],'attributes':_0x262bca[_0xb5b6('0x1c')],'include':_0x262bca['include']?_[_0xb5b6('0x1a')](_0x262bca['include'],function(_0x44f124){return{'model':db[_0x44f124[_0xb5b6('0x1b')]],'as':_0x44f124['as'],'attributes':_0x44f124[_0xb5b6('0x1c')],'include':_0x44f124[_0xb5b6('0x19')]?_['map'](_0x44f124['include'],function(_0x17d733){return{'model':db[_0x17d733[_0xb5b6('0x1b')]],'as':_0x17d733['as'],'attributes':_0x17d733[_0xb5b6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb5b6('0xb')](function(_0x56a966){logger['info']('ShowVariable',_0xb0ef6e);logger[_0xb5b6('0xd')](_0xb5b6('0x16'),_0xb0ef6e,JSON[_0xb5b6('0xf')](_0x56a966));_0x2c9485(_0x56a966);})[_0xb5b6('0x15')](function(_0x5aa535){logger[_0xb5b6('0x10')](_0xb5b6('0x16'),_0x5aa535[_0xb5b6('0x12')],_0xb0ef6e);_0x3c2025(_0x1d7048[_0xb5b6('0x10')](0x1f4,_0x5aa535[_0xb5b6('0x12')]));});});}; \ No newline at end of file +var _0x82b3=['../../config/environment','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowVariable','Variable','find','options','raw','attributes','include','map','model','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x82b3,0x1bb));var _0x382b=function(_0x5d4315,_0x4edebd){_0x5d4315=_0x5d4315-0x0;var _0x5c9d6c=_0x82b3[_0x5d4315];return _0x5c9d6c;};'use strict';var _=require(_0x382b('0x0'));var util=require(_0x382b('0x1'));var moment=require('moment');var BPromise=require(_0x382b('0x2'));var rs=require(_0x382b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x382b('0x4'))['db'];var utils=require(_0x382b('0x5'));var logger=require(_0x382b('0x6'))('rpc');var config=require(_0x382b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x382b('0x8')][_0x382b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd9f27e,_0x5e2810,_0xb27432){return new BPromise(function(_0x228dab,_0x5d82f1){return client['request'](_0xd9f27e,_0xb27432)[_0x382b('0xa')](function(_0x1e16f6){logger[_0x382b('0xb')](_0x382b('0xc'),_0x5e2810,_0x382b('0xd'));logger[_0x382b('0xe')](_0x382b('0xf'),_0x5e2810,_0x382b('0xd'),JSON[_0x382b('0x10')](_0x1e16f6));if(_0x1e16f6['error']){if(_0x1e16f6[_0x382b('0x11')][_0x382b('0x12')]===0x1f4){logger[_0x382b('0x11')](_0x382b('0xc'),_0x5e2810,_0x1e16f6[_0x382b('0x11')]['message']);return _0x5d82f1(_0x1e16f6[_0x382b('0x11')][_0x382b('0x13')]);}logger[_0x382b('0x11')](_0x382b('0xc'),_0x5e2810,_0x1e16f6[_0x382b('0x11')][_0x382b('0x13')]);return _0x228dab(_0x1e16f6[_0x382b('0x11')][_0x382b('0x13')]);}else{logger[_0x382b('0xb')]('Variable,\x20%s,\x20%s',_0x5e2810,_0x382b('0xd'));_0x228dab(_0x1e16f6['result'][_0x382b('0x13')]);}})['catch'](function(_0x1976ae){logger[_0x382b('0x11')](_0x382b('0xc'),_0x5e2810,_0x1976ae);_0x5d82f1(_0x1976ae);});});}exports[_0x382b('0x14')]=function(_0x5f969){var _0x1f0a90=this;return new Promise(function(_0x4e1c4b,_0x3610e6){return db[_0x382b('0x15')][_0x382b('0x16')]({'raw':_0x5f969[_0x382b('0x17')]?_0x5f969['options'][_0x382b('0x18')]===undefined?!![]:![]:!![],'where':_0x5f969['options']?_0x5f969[_0x382b('0x17')]['where']||null:null,'attributes':_0x5f969[_0x382b('0x17')]?_0x5f969[_0x382b('0x17')][_0x382b('0x19')]||null:null,'include':_0x5f969[_0x382b('0x17')]?_0x5f969[_0x382b('0x17')][_0x382b('0x1a')]?_[_0x382b('0x1b')](_0x5f969[_0x382b('0x17')]['include'],function(_0x23c140){return{'model':db[_0x23c140['model']],'as':_0x23c140['as'],'attributes':_0x23c140['attributes'],'include':_0x23c140[_0x382b('0x1a')]?_['map'](_0x23c140['include'],function(_0x468c04){return{'model':db[_0x468c04[_0x382b('0x1c')]],'as':_0x468c04['as'],'attributes':_0x468c04['attributes'],'include':_0x468c04[_0x382b('0x1a')]?_[_0x382b('0x1b')](_0x468c04[_0x382b('0x1a')],function(_0x28a3fb){return{'model':db[_0x28a3fb[_0x382b('0x1c')]],'as':_0x28a3fb['as'],'attributes':_0x28a3fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x382b('0xa')](function(_0xf7a951){logger[_0x382b('0xb')](_0x382b('0x14'),_0x5f969);logger[_0x382b('0xe')](_0x382b('0x14'),_0x5f969,JSON[_0x382b('0x10')](_0xf7a951));_0x4e1c4b(_0xf7a951);})[_0x382b('0x1d')](function(_0xec3925){logger[_0x382b('0x11')](_0x382b('0x14'),_0xec3925['message'],_0x5f969);_0x3610e6(_0x1f0a90[_0x382b('0x11')](0x1f4,_0xec3925['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 78e98d5..23da858 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 _0x396b=['/restart','restart','/migrations','migrations','exports','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','pull'];(function(_0x24aec3,_0x5ec4ff){var _0x5cff6d=function(_0x2dfbda){while(--_0x2dfbda){_0x24aec3['push'](_0x24aec3['shift']());}};_0x5cff6d(++_0x5ec4ff);}(_0x396b,0xd1));var _0xb396=function(_0x3d677c,_0x291249){_0x3d677c=_0x3d677c-0x0;var _0x31a605=_0x396b[_0x3d677c];return _0x31a605;};'use strict';var express=require('express');var router=express[_0xb396('0x0')]();var auth=require(_0xb396('0x1'));var controller=require(_0xb396('0x2'));router[_0xb396('0x3')]('/',controller[_0xb396('0x4')]);router['get'](_0xb396('0x5'),auth[_0xb396('0x6')](),auth[_0xb396('0x7')](),controller[_0xb396('0x8')]);router[_0xb396('0x3')](_0xb396('0x9'),auth[_0xb396('0x6')](),auth[_0xb396('0x7')](),controller[_0xb396('0xa')]);router[_0xb396('0x3')]('/pull',auth[_0xb396('0x6')](),auth['canUpdate'](),controller[_0xb396('0xb')]);router[_0xb396('0x3')](_0xb396('0xc'),auth[_0xb396('0x6')](),controller[_0xb396('0xd')]);router[_0xb396('0x3')](_0xb396('0xe'),controller[_0xb396('0xf')]);module[_0xb396('0x10')]=router; \ No newline at end of file +var _0x1575=['canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','isAuthenticated','fetch'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1575,0x190));var _0x5157=function(_0xa46cc6,_0x2ca117){_0xa46cc6=_0xa46cc6-0x0;var _0x1a8888=_0x1575[_0xa46cc6];return _0x1a8888;};'use strict';var express=require(_0x5157('0x0'));var router=express[_0x5157('0x1')]();var auth=require(_0x5157('0x2'));var controller=require(_0x5157('0x3'));router[_0x5157('0x4')]('/',controller[_0x5157('0x5')]);router[_0x5157('0x4')]('/fetch',auth[_0x5157('0x6')](),auth['canUpdate'](),controller[_0x5157('0x7')]);router[_0x5157('0x4')]('/reset',auth[_0x5157('0x6')](),auth[_0x5157('0x8')](),controller[_0x5157('0x9')]);router[_0x5157('0x4')](_0x5157('0xa'),auth[_0x5157('0x6')](),auth[_0x5157('0x8')](),controller[_0x5157('0xb')]);router['get'](_0x5157('0xc'),auth[_0x5157('0x6')](),controller[_0x5157('0xd')]);router['get'](_0x5157('0xe'),controller[_0x5157('0xf')]);module[_0x5157('0x10')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index d8d3f89..e5aed7a 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 _0x3c03=['master','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','length','replace','.js','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.','join','server','map','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','version','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','exports','json','status','origin'];(function(_0xce2fbd,_0x3128a8){var _0x517b98=function(_0x686c2f){while(--_0x686c2f){_0xce2fbd['push'](_0xce2fbd['shift']());}};_0x517b98(++_0x3128a8);}(_0x3c03,0x16d));var _0x33c0=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x3c03[_0x580576];return _0x3f55a0;};'use strict';var Umzug=require(_0x33c0('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x33c0('0x1'));var compareVersions=require(_0x33c0('0x2'));var exec=require(_0x33c0('0x3'))[_0x33c0('0x4')];var db=require('../../mysqldb')['db'];var config=require(_0x33c0('0x5'));var pm2=require(_0x33c0('0x6'));var logger=require(_0x33c0('0x7'))(_0x33c0('0x8'));var git=require(_0x33c0('0x9'))(config[_0x33c0('0xa')]);exports[_0x33c0('0xb')]=function(_0x5e6e9f,_0x198469){var _0xb593d7={'current':module['exports'][_0x33c0('0x1')],'phonebar':0x2};if(_0x5e6e9f[_0x33c0('0xc')]&&_0x5e6e9f['query'][_0x33c0('0xd')]){return git[_0x33c0('0xe')]()[_0x33c0('0xf')](function(_0x142af7,_0x5033aa){_0xb593d7['latest']=(_0x142af7?module[_0x33c0('0x10')][_0x33c0('0x1')]:_0x5033aa['latest'])||'2.0.0';return _0x198469['status'](0xc8)[_0x33c0('0x11')](_0xb593d7);});}else{return _0x198469[_0x33c0('0x12')](0xc8)[_0x33c0('0x11')](_0xb593d7);}};exports[_0x33c0('0xe')]=function(_0x3a76e2,_0x3e632e){return git['fetch']([_0x33c0('0x13'),_0x33c0('0x14')],function(_0x1d954c){if(_0x1d954c){logger['error'](_0x1d954c);return _0x3e632e[_0x33c0('0x12')](0x1f4)['json'](_0x1d954c);}logger[_0x33c0('0x15')]('git\x20fetch');return _0x3e632e[_0x33c0('0x12')](0xc8)[_0x33c0('0x11')]({'output':_0x33c0('0x16')});});};exports[_0x33c0('0x17')]=function(_0x392232,_0x192dc0){return git['reset']([_0x33c0('0x18'),_0x33c0('0x19')],function(_0x1b775f){if(_0x1b775f){logger[_0x33c0('0x1a')](_0x1b775f);return _0x192dc0[_0x33c0('0x12')](0x1f4)[_0x33c0('0x11')](_0x1b775f);}logger['info'](_0x33c0('0x1b'));return _0x192dc0[_0x33c0('0x12')](0xc8)[_0x33c0('0x11')]({'output':_0x33c0('0x1c')});});};exports['pull']=function(_0x2e0b2c,_0x38312c){exec(_0x33c0('0x1d'),function(_0x1d1d3d,_0x51d76c,_0x302758){logger[_0x33c0('0x15')](_0x51d76c);logger[_0x33c0('0x15')](_0x302758);if(_0x1d1d3d){logger[_0x33c0('0x1a')](_0x1d1d3d);return _0x38312c[_0x33c0('0x12')](0x1f4)[_0x33c0('0x11')](_0x1d1d3d);}return _0x38312c[_0x33c0('0x12')](0xc8)[_0x33c0('0x11')]({'output':_0x51d76c});});};exports[_0x33c0('0x1e')]=function(_0x4876e6,_0x4333a2){return pm2[_0x33c0('0x1e')](_0x33c0('0x1f'))[_0x33c0('0x20')](function(_0x4ac4ff){logger[_0x33c0('0x15')](_0x33c0('0x21'),_0x4ac4ff);return _0x4333a2[_0x33c0('0x12')](0xc8)[_0x33c0('0x11')]({'output':_0x33c0('0x22')});})['catch'](function(_0x547675){logger['error'](_0x547675);return _0x4333a2[_0x33c0('0x12')](0x1f4)[_0x33c0('0x11')](_0x547675);});};exports[_0x33c0('0x23')]=function(_0x1358c9,_0x6e93f9){var _0x4059dc=fs[_0x33c0('0x24')](path['join'](config[_0x33c0('0xa')],'server',_0x33c0('0x23')));var _0x301d82=[];for(var _0x25b91a=0x0;_0x25b91a<_0x4059dc[_0x33c0('0x25')];_0x25b91a++){var _0x483461=_0x4059dc[_0x25b91a][_0x33c0('0x26')](_0x33c0('0x27'),'');if(compareVersions(module[_0x33c0('0x10')][_0x33c0('0x1')],_0x483461)===-0x1){_0x301d82[_0x33c0('0x28')](_0x483461);}}if(_0x301d82['length']){var _0x425301=_0x301d82[_0x33c0('0x29')](compareVersions);var _0x5fe38c=new Umzug({'storage':_0x33c0('0x2a'),'storageOptions':{'model':db[_0x33c0('0x2b')],'modelName':_0x33c0('0x2b'),'columnName':_0x33c0('0x1')},'migrations':{'params':[db[_0x33c0('0x2a')][_0x33c0('0x2c')](),db[_0x33c0('0x2a')][_0x33c0('0x2d')],function(){throw new Error(_0x33c0('0x2e'));}],'path':path[_0x33c0('0x2f')](config[_0x33c0('0xa')],_0x33c0('0x30'),_0x33c0('0x23')),'pattern':/\.js$/}});_0x5fe38c['up']({'migrations':_[_0x33c0('0x31')](_0x425301,function(_0x375261){return _0x375261+_0x33c0('0x27');})})['then'](function(){return _0x6e93f9[_0x33c0('0x12')](0xc8)[_0x33c0('0x11')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x33c0('0x1')]+_0x33c0('0x32')+_[_0x33c0('0x33')](_0x425301),'migrations':_[_0x33c0('0x2f')](_0x425301)});})[_0x33c0('0x34')](function(_0x1959e1){if(_0x1959e1 instanceof db['sequelize'][_0x33c0('0x35')]){return _0x6e93f9[_0x33c0('0x12')](0xc8)['json']({'output':_0x33c0('0x36')});}else{return _0x6e93f9[_0x33c0('0x12')](0x1f4)[_0x33c0('0x11')](_0x1959e1);}});}else{return _0x6e93f9['status'](0xc8)[_0x33c0('0x11')]({'output':_0x33c0('0x36')});}}; \ No newline at end of file +var _0x9672=['exports','query','latest','fetch','tags','status','json','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','migrations','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','simple-git','root','index'];(function(_0x401530,_0x4573f9){var _0x15da3d=function(_0x4c9b5f){while(--_0x4c9b5f){_0x401530['push'](_0x401530['shift']());}};_0x15da3d(++_0x4573f9);}(_0x9672,0xee));var _0x2967=function(_0xdcfc62,_0x1c9e6d){_0xdcfc62=_0xdcfc62-0x0;var _0x4ac936=_0x9672[_0xdcfc62];return _0x4ac936;};'use strict';var Umzug=require(_0x2967('0x0'));var path=require(_0x2967('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x2967('0x2'))(module,_0x2967('0x3'));var compareVersions=require(_0x2967('0x4'));var exec=require(_0x2967('0x5'))['exec'];var db=require(_0x2967('0x6'))['db'];var config=require(_0x2967('0x7'));var pm2=require(_0x2967('0x8'));var logger=require('../../config/logger')('update');var git=require(_0x2967('0x9'))(config[_0x2967('0xa')]);exports[_0x2967('0xb')]=function(_0x77f846,_0x3bcd7e){var _0xf353b6={'current':module[_0x2967('0xc')][_0x2967('0x3')],'phonebar':0x2};if(_0x77f846['query']&&_0x77f846[_0x2967('0xd')][_0x2967('0xe')]){return git[_0x2967('0xf')]()[_0x2967('0x10')](function(_0x32105d,_0x3e60ef){_0xf353b6['latest']=(_0x32105d?module[_0x2967('0xc')]['version']:_0x3e60ef[_0x2967('0xe')])||'2.0.0';return _0x3bcd7e[_0x2967('0x11')](0xc8)[_0x2967('0x12')](_0xf353b6);});}else{return _0x3bcd7e['status'](0xc8)[_0x2967('0x12')](_0xf353b6);}};exports['fetch']=function(_0x142200,_0x313b5c){return git[_0x2967('0xf')](['origin','master'],function(_0xa2e896){if(_0xa2e896){logger[_0x2967('0x13')](_0xa2e896);return _0x313b5c[_0x2967('0x11')](0x1f4)['json'](_0xa2e896);}logger['info'](_0x2967('0x14'));return _0x313b5c[_0x2967('0x11')](0xc8)[_0x2967('0x12')]({'output':_0x2967('0x15')});});};exports[_0x2967('0x16')]=function(_0x40520f,_0x426fee){return git[_0x2967('0x16')]([_0x2967('0x17'),_0x2967('0x18')],function(_0x57bf2c){if(_0x57bf2c){logger[_0x2967('0x13')](_0x57bf2c);return _0x426fee[_0x2967('0x11')](0x1f4)[_0x2967('0x12')](_0x57bf2c);}logger[_0x2967('0x19')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x426fee[_0x2967('0x11')](0xc8)[_0x2967('0x12')]({'output':_0x2967('0x1a')});});};exports['pull']=function(_0x5e0e26,_0x13f924){exec(_0x2967('0x1b'),function(_0x258eca,_0x10788e,_0x832a72){logger[_0x2967('0x19')](_0x10788e);logger[_0x2967('0x19')](_0x832a72);if(_0x258eca){logger[_0x2967('0x13')](_0x258eca);return _0x13f924[_0x2967('0x11')](0x1f4)['json'](_0x258eca);}return _0x13f924[_0x2967('0x11')](0xc8)[_0x2967('0x12')]({'output':_0x10788e});});};exports[_0x2967('0x1c')]=function(_0x197763,_0x57f715){return pm2[_0x2967('0x1c')](_0x2967('0x1d'))['then'](function(_0x153d63){logger[_0x2967('0x19')](_0x2967('0x1e'),_0x153d63);return _0x57f715[_0x2967('0x11')](0xc8)[_0x2967('0x12')]({'output':_0x2967('0x1f')});})[_0x2967('0x20')](function(_0x4e0603){logger[_0x2967('0x13')](_0x4e0603);return _0x57f715[_0x2967('0x11')](0x1f4)[_0x2967('0x12')](_0x4e0603);});};exports['migrations']=function(_0x2a04e6,_0x30ba97){var _0x2d704d=fs['readdirSync'](path[_0x2967('0x21')](config[_0x2967('0xa')],'server',_0x2967('0x22')));var _0x45c7fd=[];for(var _0xcf476e=0x0;_0xcf476e<_0x2d704d['length'];_0xcf476e++){var _0xbb2094=_0x2d704d[_0xcf476e][_0x2967('0x23')](_0x2967('0x24'),'');if(compareVersions(module['exports'][_0x2967('0x3')],_0xbb2094)===-0x1){_0x45c7fd[_0x2967('0x25')](_0xbb2094);}}if(_0x45c7fd[_0x2967('0x26')]){var _0x163786=_0x45c7fd[_0x2967('0x27')](compareVersions);var _0x3179ce=new Umzug({'storage':_0x2967('0x28'),'storageOptions':{'model':db[_0x2967('0x29')],'modelName':_0x2967('0x29'),'columnName':_0x2967('0x3')},'migrations':{'params':[db[_0x2967('0x28')][_0x2967('0x2a')](),db[_0x2967('0x28')][_0x2967('0x2b')],function(){throw new Error(_0x2967('0x2c'));}],'path':path[_0x2967('0x21')](config['root'],'server',_0x2967('0x22')),'pattern':/\.js$/}});_0x3179ce['up']({'migrations':_[_0x2967('0x2d')](_0x163786,function(_0x32cd36){return _0x32cd36+_0x2967('0x24');})})['then'](function(){return _0x30ba97[_0x2967('0x11')](0xc8)['json']({'output':_0x2967('0x2e')+module[_0x2967('0xc')][_0x2967('0x3')]+'\x20to\x20'+_[_0x2967('0x2f')](_0x163786),'migrations':_['join'](_0x163786)});})[_0x2967('0x20')](function(_0x514b8f){if(_0x514b8f instanceof db[_0x2967('0x28')][_0x2967('0x30')]){return _0x30ba97['status'](0xc8)[_0x2967('0x12')]({'output':_0x2967('0x31')});}else{return _0x30ba97[_0x2967('0x11')](0x1f4)[_0x2967('0x12')](_0x514b8f);}});}else{return _0x30ba97[_0x2967('0x11')](0xc8)[_0x2967('0x12')]({'output':_0x2967('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ef11552..53d9b7f 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 _0xaa58=['path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','/:id','update','delete','destroy','exports','multer','util'];(function(_0x26f03d,_0x4866c2){var _0x42dc9f=function(_0x110528){while(--_0x110528){_0x26f03d['push'](_0x26f03d['shift']());}};_0x42dc9f(++_0x4866c2);}(_0xaa58,0x19c));var _0x8aa5=function(_0x4860ad,_0x3caad6){_0x4860ad=_0x4860ad-0x0;var _0x1c5fa0=_0xaa58[_0x4860ad];return _0x1c5fa0;};'use strict';var multer=require(_0x8aa5('0x0'));var util=require(_0x8aa5('0x1'));var path=require(_0x8aa5('0x2'));var timeout=require('connect-timeout');var express=require(_0x8aa5('0x3'));var router=express[_0x8aa5('0x4')]();var auth=require(_0x8aa5('0x5'));var interaction=require(_0x8aa5('0x6'));var config=require('../../config/environment');var controller=require(_0x8aa5('0x7'));router['get']('/',auth[_0x8aa5('0x8')](),controller[_0x8aa5('0x9')]);router[_0x8aa5('0xa')](_0x8aa5('0xb'),auth[_0x8aa5('0x8')](),controller[_0x8aa5('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8aa5('0xd'),auth['isAuthenticated'](),controller[_0x8aa5('0xe')]);router[_0x8aa5('0xf')](_0x8aa5('0xd'),auth['isAuthenticated'](),controller[_0x8aa5('0x10')]);module[_0x8aa5('0x11')]=router; \ No newline at end of file +var _0x0c89=['./voiceAgentReport.controller','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','multer','express','Router','../../components/auth/service','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0c89,0xaf));var _0x90c8=function(_0x5694a2,_0x3a943a){_0x5694a2=_0x5694a2-0x0;var _0x4f462d=_0x0c89[_0x5694a2];return _0x4f462d;};'use strict';var multer=require(_0x90c8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x90c8('0x1'));var router=express[_0x90c8('0x2')]();var auth=require(_0x90c8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x90c8('0x4'));var controller=require(_0x90c8('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x90c8('0x6')]);router[_0x90c8('0x7')](_0x90c8('0x8'),auth[_0x90c8('0x9')](),controller[_0x90c8('0xa')]);router[_0x90c8('0x7')]('/:id',auth[_0x90c8('0x9')](),controller[_0x90c8('0xb')]);router[_0x90c8('0xc')]('/',auth['isAuthenticated'](),controller[_0x90c8('0xd')]);router['put'](_0x90c8('0xe'),auth[_0x90c8('0x9')](),controller[_0x90c8('0xf')]);router[_0x90c8('0x10')](_0x90c8('0xe'),auth[_0x90c8('0x9')](),controller[_0x90c8('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 3232fea..d94e821 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 _0x31f0=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x31f0,0xb7));var _0x031f=function(_0x2d438c,_0x5106ee){_0x2d438c=_0x2d438c-0x0;var _0x16851d=_0x31f0[_0x2d438c];return _0x16851d;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'type':{'type':Sequelize[_0x031f('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x031f('0x1')]},'calleridname':{'type':Sequelize[_0x031f('0x1')]},'queue':{'type':Sequelize[_0x031f('0x1')]},'interface':{'type':Sequelize[_0x031f('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x031f('0x2')]},'agentconnectAt':{'type':Sequelize[_0x031f('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x031f('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x031f('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x031f('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x031f('0x3')]},'agentacw':{'type':Sequelize[_0x031f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x031f('0x1')]},'lastevent':{'type':Sequelize[_0x031f('0x1')]},'channel':{'type':Sequelize[_0x031f('0x1')]},'channelstate':{'type':Sequelize[_0x031f('0x3')]},'channelstatedesc':{'type':Sequelize[_0x031f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x031f('0x1')]},'connectedlinename':{'type':Sequelize[_0x031f('0x1')]},'language':{'type':Sequelize[_0x031f('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x031f('0x1')]},'exten':{'type':Sequelize[_0x031f('0x1')]},'priority':{'type':Sequelize[_0x031f('0x1')]},'destchannel':{'type':Sequelize[_0x031f('0x1')]},'destchannelstate':{'type':Sequelize[_0x031f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x031f('0x1')]},'destcalleridnum':{'type':Sequelize[_0x031f('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x031f('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x031f('0x1')]},'destlanguage':{'type':Sequelize[_0x031f('0x1')]},'destaccountcode':{'type':Sequelize[_0x031f('0x1')]},'destcontext':{'type':Sequelize[_0x031f('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x031f('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x031f('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x031f('0x1')]},'transfer':{'type':Sequelize[_0x031f('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x031f('0x5')},'transferexten':{'type':Sequelize[_0x031f('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x031f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x24ca,0x1bc));var _0xa24c=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x24ca[_0x2fc012];return _0x2891f9;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'type':{'type':Sequelize[_0xa24c('0x1')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa24c('0x1')]},'interface':{'type':Sequelize[_0xa24c('0x1')]},'membername':{'type':Sequelize[_0xa24c('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa24c('0x2')]},'agentconnectAt':{'type':Sequelize[_0xa24c('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xa24c('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xa24c('0x2')]},'agentdumpAt':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x3')]},'agentcomplete':{'type':Sequelize[_0xa24c('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa24c('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa24c('0x3')]},'agentacw':{'type':Sequelize[_0xa24c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa24c('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x3')]},'channelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize[_0xa24c('0x1')]},'destchannelstate':{'type':Sequelize[_0xa24c('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xa24c('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xa24c('0x5')},'transferexten':{'type':Sequelize[_0xa24c('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xa24c('0x3')],'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 d752080..dfa40b4 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 _0x6578=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','VoiceAgentReport','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','destroy','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','ejs','lodash','squel','crypto','jsforce'];(function(_0x112d64,_0x39fdd5){var _0x352f35=function(_0x5ad32f){while(--_0x5ad32f){_0x112d64['push'](_0x112d64['shift']());}};_0x352f35(++_0x39fdd5);}(_0x6578,0x16b));var _0x8657=function(_0x6dca2d,_0x5c9cc){_0x6dca2d=_0x6dca2d-0x0;var _0x14e000=_0x6578[_0x6dca2d];return _0x14e000;};'use strict';var pdf=require(_0x8657('0x0'));var emlformat=require(_0x8657('0x1'));var rimraf=require(_0x8657('0x2'));var zipdir=require(_0x8657('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8657('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8657('0x5'));var path=require(_0x8657('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8657('0x7'));var fs=require('fs');var _=require(_0x8657('0x8'));var squel=require(_0x8657('0x9'));var crypto=require(_0x8657('0xa'));var jsforce=require(_0x8657('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8657('0xc'));var querystring=require(_0x8657('0xd'));var Papa=require(_0x8657('0xe'));var Redis=require('ioredis');var authService=require(_0x8657('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8657('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8657('0x11'))(_0x8657('0x12'));var utils=require(_0x8657('0x13'));var config=require(_0x8657('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8657('0x15'))['db'];function respondWithStatusCode(_0x41a78a,_0x1353e1){_0x1353e1=_0x1353e1||0xcc;return function(_0x1ed06d){if(_0x1ed06d){return _0x41a78a[_0x8657('0x16')](_0x1353e1);}return _0x41a78a['status'](_0x1353e1)[_0x8657('0x17')]();};}function respondWithResult(_0x1b0be8,_0x22f0b6){_0x22f0b6=_0x22f0b6||0xc8;return function(_0x347ec6){if(_0x347ec6){return _0x1b0be8[_0x8657('0x18')](_0x22f0b6)['json'](_0x347ec6);}};}function respondWithFilteredResult(_0x556b53,_0x4df2de){return function(_0x253dd8){if(_0x253dd8){var _0x3c2a7a=_0x253dd8[_0x8657('0x19')],_0x32980c=_0x4df2de[_0x8657('0x1a')],_0x4ca8f1=_0x4df2de[_0x8657('0x1a')]+_0x4df2de[_0x8657('0x1b')],_0x212f59;if(_0x4ca8f1>=_0x3c2a7a){_0x4ca8f1=_0x3c2a7a;_0x212f59=0xc8;}else{_0x212f59=0xce;}_0x556b53[_0x8657('0x18')](_0x212f59);return _0x556b53[_0x8657('0x1c')](_0x8657('0x1d'),_0x32980c+'-'+_0x4ca8f1+'/'+_0x3c2a7a)[_0x8657('0x1e')](_0x253dd8);}return null;};}function patchUpdates(_0x547997){return function(_0x268019){try{jsonpatch[_0x8657('0x1f')](_0x268019,_0x547997,!![]);}catch(_0x44eb5a){return BPromise[_0x8657('0x20')](_0x44eb5a);}return _0x268019[_0x8657('0x21')]();};}function saveUpdates(_0x1055b7,_0x1267af){return function(_0x236875){if(_0x236875){return _0x236875[_0x8657('0x22')](_0x1055b7)[_0x8657('0x23')](function(_0x503ebc){return _0x503ebc;});}return null;};}function removeEntity(_0x2f0407,_0x1d98fa){return function(_0x254a2e){if(_0x254a2e){return _0x254a2e['destroy']()[_0x8657('0x23')](function(){_0x2f0407['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eef26,_0x27daff){return function(_0x85fb92){if(!_0x85fb92){_0x4eef26[_0x8657('0x16')](0x194);}return _0x85fb92;};}function handleError(_0x50b516,_0x3ee0f2){_0x3ee0f2=_0x3ee0f2||0x1f4;return function(_0x19139){logger[_0x8657('0x24')](_0x19139[_0x8657('0x25')]);if(_0x19139[_0x8657('0x26')]){delete _0x19139[_0x8657('0x26')];}_0x50b516[_0x8657('0x18')](_0x3ee0f2)[_0x8657('0x27')](_0x19139);};}exports['index']=function(_0x59a413,_0x4b00dd){var _0x3b21ff={},_0x7dbb14={},_0x186bb3={'count':0x0,'rows':[]};var _0x4bbfdb=_['map'](db[_0x8657('0x28')][_0x8657('0x29')],function(_0x527ef3){return{'name':_0x527ef3['fieldName'],'type':_0x527ef3[_0x8657('0x2a')][_0x8657('0x2b')]};});_0x7dbb14[_0x8657('0x2c')]=_[_0x8657('0x2d')](_0x4bbfdb,_0x8657('0x26'));_0x7dbb14[_0x8657('0x2e')]=_[_0x8657('0x2f')](_0x59a413['query']);_0x7dbb14[_0x8657('0x30')]=_['intersection'](_0x7dbb14['model'],_0x7dbb14[_0x8657('0x2e')]);_0x3b21ff[_0x8657('0x31')]=_[_0x8657('0x32')](_0x7dbb14[_0x8657('0x2c')],qs[_0x8657('0x33')](_0x59a413[_0x8657('0x2e')][_0x8657('0x33')]));_0x3b21ff[_0x8657('0x31')]=_0x3b21ff[_0x8657('0x31')]['length']?_0x3b21ff[_0x8657('0x31')]:_0x7dbb14[_0x8657('0x2c')];if(!_0x59a413[_0x8657('0x2e')][_0x8657('0x34')](_0x8657('0x35'))){_0x3b21ff[_0x8657('0x1b')]=qs[_0x8657('0x1b')](_0x59a413[_0x8657('0x2e')]['limit']);_0x3b21ff[_0x8657('0x1a')]=qs[_0x8657('0x1a')](_0x59a413[_0x8657('0x2e')][_0x8657('0x1a')]);}_0x3b21ff[_0x8657('0x36')]=qs['sort'](_0x59a413[_0x8657('0x2e')][_0x8657('0x37')]);_0x3b21ff['where']=qs[_0x8657('0x30')](_[_0x8657('0x38')](_0x59a413[_0x8657('0x2e')],_0x7dbb14[_0x8657('0x30')]),_0x4bbfdb);if(_0x59a413[_0x8657('0x2e')][_0x8657('0x39')]){_0x3b21ff[_0x8657('0x3a')]=_[_0x8657('0x3b')](_0x3b21ff[_0x8657('0x3a')],{'$or':_[_0x8657('0x2d')](_0x4bbfdb,function(_0x4a1d70){if(_0x4a1d70[_0x8657('0x2a')]!==_0x8657('0x3c')){var _0xa9d4ea={};_0xa9d4ea[_0x4a1d70[_0x8657('0x26')]]={'$like':'%'+_0x59a413[_0x8657('0x2e')][_0x8657('0x39')]+'%'};return _0xa9d4ea;}})});}_0x3b21ff=_[_0x8657('0x3b')]({},_0x3b21ff,_0x59a413[_0x8657('0x3d')]);var _0x2735ca={'where':_0x3b21ff['where']};return db[_0x8657('0x28')]['count'](_0x2735ca)[_0x8657('0x23')](function(_0x52bf3a){_0x186bb3[_0x8657('0x19')]=_0x52bf3a;if(_0x59a413[_0x8657('0x2e')][_0x8657('0x3e')]){_0x3b21ff[_0x8657('0x3f')]=[{'all':!![]}];}return db[_0x8657('0x28')][_0x8657('0x40')](_0x3b21ff);})[_0x8657('0x23')](function(_0x47a069){_0x186bb3[_0x8657('0x41')]=_0x47a069;return _0x186bb3;})[_0x8657('0x23')](respondWithFilteredResult(_0x4b00dd,_0x3b21ff))[_0x8657('0x42')](handleError(_0x4b00dd,null));};exports[_0x8657('0x43')]=function(_0x2d328f,_0x412497){var _0x4509dc={'raw':![],'where':{'id':_0x2d328f[_0x8657('0x44')]['id']}},_0x2afacf={};_0x2afacf['model']=_[_0x8657('0x2f')](db['VoiceAgentReport']['rawAttributes']);_0x2afacf[_0x8657('0x2e')]=_[_0x8657('0x2f')](_0x2d328f['query']);_0x2afacf[_0x8657('0x30')]=_['intersection'](_0x2afacf[_0x8657('0x2c')],_0x2afacf[_0x8657('0x2e')]);_0x4509dc[_0x8657('0x31')]=_[_0x8657('0x32')](_0x2afacf[_0x8657('0x2c')],qs[_0x8657('0x33')](_0x2d328f[_0x8657('0x2e')]['fields']));_0x4509dc[_0x8657('0x31')]=_0x4509dc[_0x8657('0x31')][_0x8657('0x45')]?_0x4509dc[_0x8657('0x31')]:_0x2afacf[_0x8657('0x2c')];if(_0x2d328f[_0x8657('0x2e')]['includeAll']){_0x4509dc[_0x8657('0x3f')]=[{'all':!![]}];}_0x4509dc=_[_0x8657('0x3b')]({},_0x4509dc,_0x2d328f[_0x8657('0x3d')]);return db[_0x8657('0x28')]['find'](_0x4509dc)[_0x8657('0x23')](handleEntityNotFound(_0x412497,null))['then'](respondWithResult(_0x412497,null))[_0x8657('0x42')](handleError(_0x412497,null));};exports[_0x8657('0x46')]=function(_0x4c366f,_0x3c86c5){return db[_0x8657('0x28')][_0x8657('0x46')](_0x4c366f[_0x8657('0x47')],{})[_0x8657('0x23')](respondWithResult(_0x3c86c5,0xc9))[_0x8657('0x42')](handleError(_0x3c86c5,null));};exports[_0x8657('0x22')]=function(_0x14b7d0,_0x4789cb){if(_0x14b7d0[_0x8657('0x47')]['id']){delete _0x14b7d0['body']['id'];}return db[_0x8657('0x28')]['find']({'where':{'id':_0x14b7d0[_0x8657('0x44')]['id']}})[_0x8657('0x23')](handleEntityNotFound(_0x4789cb,null))[_0x8657('0x23')](saveUpdates(_0x14b7d0[_0x8657('0x47')],null))[_0x8657('0x23')](respondWithResult(_0x4789cb,null))[_0x8657('0x42')](handleError(_0x4789cb,null));};exports[_0x8657('0x48')]=function(_0x1ca842,_0x210fe7){return db['VoiceAgentReport'][_0x8657('0x49')]({'where':{'id':_0x1ca842['params']['id']}})[_0x8657('0x23')](handleEntityNotFound(_0x210fe7,null))['then'](removeEntity(_0x210fe7,null))[_0x8657('0x42')](handleError(_0x210fe7,null));};exports['describe']=function(_0x50ef2f,_0x21885c){return db['VoiceAgentReport'][_0x8657('0x4a')]()[_0x8657('0x23')](respondWithResult(_0x21885c,null))[_0x8657('0x42')](handleError(_0x21885c,null));}; \ No newline at end of file +var _0x43b8=['lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','fields','find','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x30117f,_0x2d77fc){var _0x16d3cf=function(_0x49a8da){while(--_0x49a8da){_0x30117f['push'](_0x30117f['shift']());}};_0x16d3cf(++_0x2d77fc);}(_0x43b8,0x1ec));var _0x843b=function(_0x2af866,_0x368167){_0x2af866=_0x2af866-0x0;var _0x227a64=_0x43b8[_0x2af866];return _0x227a64;};'use strict';var pdf=require(_0x843b('0x0'));var emlformat=require(_0x843b('0x1'));var rimraf=require(_0x843b('0x2'));var zipdir=require(_0x843b('0x3'));var jsonpatch=require(_0x843b('0x4'));var rp=require(_0x843b('0x5'));var moment=require(_0x843b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x843b('0x7'));var util=require(_0x843b('0x8'));var path=require(_0x843b('0x9'));var sox=require(_0x843b('0xa'));var csv=require('to-csv');var ejs=require(_0x843b('0xb'));var fs=require('fs');var _=require(_0x843b('0xc'));var squel=require('squel');var crypto=require(_0x843b('0xd'));var jsforce=require(_0x843b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x843b('0xf'));var Papa=require(_0x843b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x843b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x843b('0x12'));var logger=require(_0x843b('0x13'))('api');var utils=require(_0x843b('0x14'));var config=require(_0x843b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x843b('0x16'))['db'];function respondWithStatusCode(_0x4d8ec9,_0x3e9303){_0x3e9303=_0x3e9303||0xcc;return function(_0x3eb31a){if(_0x3eb31a){return _0x4d8ec9['sendStatus'](_0x3e9303);}return _0x4d8ec9['status'](_0x3e9303)[_0x843b('0x17')]();};}function respondWithResult(_0x250334,_0x4fff7a){_0x4fff7a=_0x4fff7a||0xc8;return function(_0x48c6e4){if(_0x48c6e4){return _0x250334[_0x843b('0x18')](_0x4fff7a)[_0x843b('0x19')](_0x48c6e4);}};}function respondWithFilteredResult(_0x388b87,_0x5f5c13){return function(_0x1b81d0){if(_0x1b81d0){var _0x2c8ead=_0x1b81d0[_0x843b('0x1a')],_0x224bf5=_0x5f5c13[_0x843b('0x1b')],_0x458bb7=_0x5f5c13[_0x843b('0x1b')]+_0x5f5c13['limit'],_0x558009;if(_0x458bb7>=_0x2c8ead){_0x458bb7=_0x2c8ead;_0x558009=0xc8;}else{_0x558009=0xce;}_0x388b87[_0x843b('0x18')](_0x558009);return _0x388b87[_0x843b('0x1c')](_0x843b('0x1d'),_0x224bf5+'-'+_0x458bb7+'/'+_0x2c8ead)['json'](_0x1b81d0);}return null;};}function patchUpdates(_0x123be6){return function(_0x1ef2e9){try{jsonpatch[_0x843b('0x1e')](_0x1ef2e9,_0x123be6,!![]);}catch(_0x337d1e){return BPromise['reject'](_0x337d1e);}return _0x1ef2e9[_0x843b('0x1f')]();};}function saveUpdates(_0x15e8d8,_0x3c229f){return function(_0x1c2685){if(_0x1c2685){return _0x1c2685['update'](_0x15e8d8)[_0x843b('0x20')](function(_0x457bce){return _0x457bce;});}return null;};}function removeEntity(_0x1a63ce,_0x12a0d1){return function(_0x26a749){if(_0x26a749){return _0x26a749[_0x843b('0x21')]()[_0x843b('0x20')](function(){_0x1a63ce['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x215f68,_0x10f406){return function(_0x330e1f){if(!_0x330e1f){_0x215f68[_0x843b('0x22')](0x194);}return _0x330e1f;};}function handleError(_0x2480c2,_0xa144ab){_0xa144ab=_0xa144ab||0x1f4;return function(_0x3106fd){logger[_0x843b('0x23')](_0x3106fd[_0x843b('0x24')]);if(_0x3106fd[_0x843b('0x25')]){delete _0x3106fd[_0x843b('0x25')];}_0x2480c2[_0x843b('0x18')](_0xa144ab)[_0x843b('0x26')](_0x3106fd);};}exports[_0x843b('0x27')]=function(_0x1cb32e,_0xab9797){var _0xcc2b34={},_0x59cda8={},_0x1d0376={'count':0x0,'rows':[]};var _0x3d7fd2=_[_0x843b('0x28')](db[_0x843b('0x29')][_0x843b('0x2a')],function(_0x5d2408){return{'name':_0x5d2408[_0x843b('0x2b')],'type':_0x5d2408['type'][_0x843b('0x2c')]};});_0x59cda8['model']=_[_0x843b('0x28')](_0x3d7fd2,'name');_0x59cda8['query']=_[_0x843b('0x2d')](_0x1cb32e[_0x843b('0x2e')]);_0x59cda8[_0x843b('0x2f')]=_[_0x843b('0x30')](_0x59cda8[_0x843b('0x31')],_0x59cda8[_0x843b('0x2e')]);_0xcc2b34['attributes']=_[_0x843b('0x30')](_0x59cda8['model'],qs['fields'](_0x1cb32e[_0x843b('0x2e')]['fields']));_0xcc2b34['attributes']=_0xcc2b34[_0x843b('0x32')][_0x843b('0x33')]?_0xcc2b34[_0x843b('0x32')]:_0x59cda8['model'];if(!_0x1cb32e[_0x843b('0x2e')][_0x843b('0x34')](_0x843b('0x35'))){_0xcc2b34[_0x843b('0x36')]=qs['limit'](_0x1cb32e[_0x843b('0x2e')][_0x843b('0x36')]);_0xcc2b34[_0x843b('0x1b')]=qs[_0x843b('0x1b')](_0x1cb32e['query'][_0x843b('0x1b')]);}_0xcc2b34['order']=qs[_0x843b('0x37')](_0x1cb32e[_0x843b('0x2e')][_0x843b('0x37')]);_0xcc2b34[_0x843b('0x38')]=qs[_0x843b('0x2f')](_['pick'](_0x1cb32e['query'],_0x59cda8[_0x843b('0x2f')]),_0x3d7fd2);if(_0x1cb32e[_0x843b('0x2e')][_0x843b('0x39')]){_0xcc2b34[_0x843b('0x38')]=_[_0x843b('0x3a')](_0xcc2b34['where'],{'$or':_['map'](_0x3d7fd2,function(_0x4d2704){if(_0x4d2704['type']!==_0x843b('0x3b')){var _0x4b161c={};_0x4b161c[_0x4d2704[_0x843b('0x25')]]={'$like':'%'+_0x1cb32e[_0x843b('0x2e')][_0x843b('0x39')]+'%'};return _0x4b161c;}})});}_0xcc2b34=_['merge']({},_0xcc2b34,_0x1cb32e[_0x843b('0x3c')]);var _0x5ae4fe={'where':_0xcc2b34['where']};return db[_0x843b('0x29')][_0x843b('0x1a')](_0x5ae4fe)['then'](function(_0x3de46b){_0x1d0376['count']=_0x3de46b;if(_0x1cb32e['query'][_0x843b('0x3d')]){_0xcc2b34[_0x843b('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x843b('0x3f')](_0xcc2b34);})['then'](function(_0x61a00e){_0x1d0376['rows']=_0x61a00e;return _0x1d0376;})[_0x843b('0x20')](respondWithFilteredResult(_0xab9797,_0xcc2b34))[_0x843b('0x40')](handleError(_0xab9797,null));};exports['show']=function(_0x168b62,_0x14f0f9){var _0x2f3da1={'raw':![],'where':{'id':_0x168b62['params']['id']}},_0x4f91e5={};_0x4f91e5[_0x843b('0x31')]=_[_0x843b('0x2d')](db[_0x843b('0x29')][_0x843b('0x2a')]);_0x4f91e5['query']=_[_0x843b('0x2d')](_0x168b62[_0x843b('0x2e')]);_0x4f91e5[_0x843b('0x2f')]=_[_0x843b('0x30')](_0x4f91e5[_0x843b('0x31')],_0x4f91e5[_0x843b('0x2e')]);_0x2f3da1['attributes']=_[_0x843b('0x30')](_0x4f91e5[_0x843b('0x31')],qs[_0x843b('0x41')](_0x168b62[_0x843b('0x2e')][_0x843b('0x41')]));_0x2f3da1[_0x843b('0x32')]=_0x2f3da1[_0x843b('0x32')][_0x843b('0x33')]?_0x2f3da1[_0x843b('0x32')]:_0x4f91e5[_0x843b('0x31')];if(_0x168b62[_0x843b('0x2e')][_0x843b('0x3d')]){_0x2f3da1[_0x843b('0x3e')]=[{'all':!![]}];}_0x2f3da1=_['merge']({},_0x2f3da1,_0x168b62[_0x843b('0x3c')]);return db[_0x843b('0x29')][_0x843b('0x42')](_0x2f3da1)[_0x843b('0x20')](handleEntityNotFound(_0x14f0f9,null))[_0x843b('0x20')](respondWithResult(_0x14f0f9,null))[_0x843b('0x40')](handleError(_0x14f0f9,null));};exports['create']=function(_0x9d65d6,_0x1d39cd){return db['VoiceAgentReport'][_0x843b('0x43')](_0x9d65d6['body'],{})['then'](respondWithResult(_0x1d39cd,0xc9))[_0x843b('0x40')](handleError(_0x1d39cd,null));};exports[_0x843b('0x44')]=function(_0x41b66d,_0x2c62a1){if(_0x41b66d[_0x843b('0x45')]['id']){delete _0x41b66d[_0x843b('0x45')]['id'];}return db[_0x843b('0x29')][_0x843b('0x42')]({'where':{'id':_0x41b66d[_0x843b('0x46')]['id']}})[_0x843b('0x20')](handleEntityNotFound(_0x2c62a1,null))[_0x843b('0x20')](saveUpdates(_0x41b66d[_0x843b('0x45')],null))['then'](respondWithResult(_0x2c62a1,null))[_0x843b('0x40')](handleError(_0x2c62a1,null));};exports[_0x843b('0x21')]=function(_0x30085b,_0x2ac540){return db[_0x843b('0x29')]['find']({'where':{'id':_0x30085b[_0x843b('0x46')]['id']}})[_0x843b('0x20')](handleEntityNotFound(_0x2ac540,null))['then'](removeEntity(_0x2ac540,null))[_0x843b('0x40')](handleError(_0x2ac540,null));};exports['describe']=function(_0x3a5d45,_0x45d9c4){return db['VoiceAgentReport'][_0x843b('0x47')]()[_0x843b('0x20')](respondWithResult(_0x45d9c4,null))[_0x843b('0x40')](handleError(_0x45d9c4,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 1a02795..a685131 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 _0x967c=['destuniqueid','lodash','util','../../config/logger','moment','bluebird','path','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','uniqueid'];(function(_0x5c6423,_0x562d71){var _0x563a1c=function(_0x202d75){while(--_0x202d75){_0x5c6423['push'](_0x5c6423['shift']());}};_0x563a1c(++_0x562d71);}(_0x967c,0xfd));var _0xc967=function(_0x1387f3,_0x287117){_0x1387f3=_0x1387f3-0x0;var _0x226e25=_0x967c[_0x1387f3];return _0x226e25;};'use strict';var _=require(_0xc967('0x0'));var util=require(_0xc967('0x1'));var logger=require(_0xc967('0x2'))('api');var moment=require(_0xc967('0x3'));var BPromise=require(_0xc967('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc967('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc967('0x6'));module[_0xc967('0x7')]=function(_0x154162,_0x408a54){return _0x154162[_0xc967('0x8')](_0xc967('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xc967('0xa'),_0xc967('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe363=['define','VoiceAgentReport','uniqueid','destuniqueid','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x225c48,_0x233a4f){var _0x22e42b=function(_0x3090c8){while(--_0x3090c8){_0x225c48['push'](_0x225c48['shift']());}};_0x22e42b(++_0x233a4f);}(_0xe363,0x64));var _0x3e36=function(_0x51442b,_0x3ddc42){_0x51442b=_0x51442b-0x0;var _0x48cc27=_0xe363[_0x51442b];return _0x48cc27;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e36('0x0'))('api');var moment=require('moment');var BPromise=require(_0x3e36('0x1'));var rp=require(_0x3e36('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e36('0x3'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x3f9b27,_0x1124b8){return _0x3f9b27[_0x3e36('0x4')](_0x3e36('0x5'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x3e36('0x6'),_0x3e36('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 9e934e4..3b19210 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 _0x46e8=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','debug','update','where','limit','UpdateVoiceAgentReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x46e8,0x1a7));var _0x846e=function(_0x469dd0,_0x3b692f){_0x469dd0=_0x469dd0-0x0;var _0x3eabb7=_0x46e8[_0x469dd0];return _0x3eabb7;};'use strict';var _=require(_0x846e('0x0'));var util=require(_0x846e('0x1'));var moment=require('moment');var BPromise=require(_0x846e('0x2'));var rs=require(_0x846e('0x3'));var fs=require('fs');var Redis=require(_0x846e('0x4'));var db=require(_0x846e('0x5'))['db'];var utils=require(_0x846e('0x6'));var logger=require('../../config/logger')(_0x846e('0x7'));var config=require(_0x846e('0x8'));var jayson=require(_0x846e('0x9'));var client=jayson['client'][_0x846e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5062cb,_0x327074,_0x24a45a){return new BPromise(function(_0x236b23,_0x39a7c9){return client[_0x846e('0xb')](_0x5062cb,_0x24a45a)[_0x846e('0xc')](function(_0x30a287){logger[_0x846e('0xd')](_0x846e('0xe'),_0x327074,_0x846e('0xf'));logger['debug'](_0x846e('0x10'),_0x327074,_0x846e('0xf'),JSON[_0x846e('0x11')](_0x30a287));if(_0x30a287[_0x846e('0x12')]){if(_0x30a287[_0x846e('0x12')][_0x846e('0x13')]===0x1f4){logger[_0x846e('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x327074,_0x30a287[_0x846e('0x12')][_0x846e('0x14')]);return _0x39a7c9(_0x30a287[_0x846e('0x12')][_0x846e('0x14')]);}logger[_0x846e('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x327074,_0x30a287[_0x846e('0x12')][_0x846e('0x14')]);return _0x236b23(_0x30a287[_0x846e('0x12')][_0x846e('0x14')]);}else{logger['info'](_0x846e('0xe'),_0x327074,_0x846e('0xf'));_0x236b23(_0x30a287[_0x846e('0x15')][_0x846e('0x14')]);}})[_0x846e('0x16')](function(_0x5b36ba){logger[_0x846e('0x12')](_0x846e('0xe'),_0x327074,_0x5b36ba);_0x39a7c9(_0x5b36ba);});});}exports[_0x846e('0x17')]=function(_0x4649b0){var _0x4b57de=this;return new Promise(function(_0x36a952,_0x507e34){return db[_0x846e('0x18')]['create'](_0x4649b0[_0x846e('0x19')],{'raw':_0x4649b0[_0x846e('0x1a')]?_0x4649b0[_0x846e('0x1a')][_0x846e('0x1b')]===undefined?!![]:![]:!![]})[_0x846e('0xc')](function(_0x4940b0){logger[_0x846e('0xd')]('CreateVoiceAgentReport',_0x4649b0);logger[_0x846e('0x1c')](_0x846e('0x17'),_0x4649b0,JSON[_0x846e('0x11')](_0x4940b0));_0x36a952(_0x4940b0);})[_0x846e('0x16')](function(_0x531649){logger[_0x846e('0x12')](_0x846e('0x17'),_0x531649[_0x846e('0x14')],_0x4649b0);_0x507e34(_0x4b57de[_0x846e('0x12')](0x1f4,_0x531649[_0x846e('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x59ffe7){var _0x3c09b6=this;return new Promise(function(_0x1758a9,_0x8a4029){return db[_0x846e('0x18')][_0x846e('0x1d')](_0x59ffe7[_0x846e('0x19')],{'raw':_0x59ffe7[_0x846e('0x1a')]?_0x59ffe7[_0x846e('0x1a')][_0x846e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59ffe7[_0x846e('0x1a')]?_0x59ffe7['options'][_0x846e('0x1e')]||null:null,'attributes':_0x59ffe7[_0x846e('0x1a')]?_0x59ffe7['options']['attributes']||null:null,'limit':_0x59ffe7[_0x846e('0x1a')]?_0x59ffe7[_0x846e('0x1a')][_0x846e('0x1f')]||null:null})[_0x846e('0xc')](function(_0x103841){logger[_0x846e('0xd')](_0x846e('0x20'),_0x59ffe7);logger[_0x846e('0x1c')]('UpdateVoiceAgentReport',_0x59ffe7,JSON['stringify'](_0x103841));_0x1758a9(_0x103841);})[_0x846e('0x16')](function(_0x498526){logger[_0x846e('0x12')](_0x846e('0x20'),_0x498526['message'],_0x59ffe7);_0x8a4029(_0x3c09b6[_0x846e('0x12')](0x1f4,_0x498526['message']));});});}; \ No newline at end of file +var _0x0560=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','stringify','UpdateVoiceAgentReport','update','attributes','limit','lodash','moment','randomstring','ioredis'];(function(_0x43f800,_0x1923f1){var _0x44aef7=function(_0xd6829e){while(--_0xd6829e){_0x43f800['push'](_0x43f800['shift']());}};_0x44aef7(++_0x1923f1);}(_0x0560,0x92));var _0x0056=function(_0x4688ce,_0x5b5c5c){_0x4688ce=_0x4688ce-0x0;var _0x220c8c=_0x0560[_0x4688ce];return _0x220c8c;};'use strict';var _=require(_0x0056('0x0'));var util=require('util');var moment=require(_0x0056('0x1'));var BPromise=require('bluebird');var rs=require(_0x0056('0x2'));var fs=require('fs');var Redis=require(_0x0056('0x3'));var db=require(_0x0056('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0056('0x5'))('rpc');var config=require(_0x0056('0x6'));var jayson=require(_0x0056('0x7'));var client=jayson[_0x0056('0x8')][_0x0056('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x576bbd,_0x27f59a,_0x4fe1ce){return new BPromise(function(_0x4d2b32,_0x45aafc){return client[_0x0056('0xa')](_0x576bbd,_0x4fe1ce)[_0x0056('0xb')](function(_0x4874ab){logger[_0x0056('0xc')](_0x0056('0xd'),_0x27f59a,_0x0056('0xe'));logger[_0x0056('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x27f59a,'request\x20sent',JSON['stringify'](_0x4874ab));if(_0x4874ab['error']){if(_0x4874ab[_0x0056('0x10')][_0x0056('0x11')]===0x1f4){logger[_0x0056('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x27f59a,_0x4874ab[_0x0056('0x10')][_0x0056('0x12')]);return _0x45aafc(_0x4874ab[_0x0056('0x10')]['message']);}logger[_0x0056('0x10')](_0x0056('0xd'),_0x27f59a,_0x4874ab[_0x0056('0x10')][_0x0056('0x12')]);return _0x4d2b32(_0x4874ab[_0x0056('0x10')]['message']);}else{logger['info'](_0x0056('0xd'),_0x27f59a,_0x0056('0xe'));_0x4d2b32(_0x4874ab['result'][_0x0056('0x12')]);}})[_0x0056('0x13')](function(_0x4cef1d){logger[_0x0056('0x10')](_0x0056('0xd'),_0x27f59a,_0x4cef1d);_0x45aafc(_0x4cef1d);});});}exports[_0x0056('0x14')]=function(_0x41465e){var _0x25ad24=this;return new Promise(function(_0x5f50f9,_0x50b37e){return db[_0x0056('0x15')]['create'](_0x41465e[_0x0056('0x16')],{'raw':_0x41465e['options']?_0x41465e[_0x0056('0x17')][_0x0056('0x18')]===undefined?!![]:![]:!![]})[_0x0056('0xb')](function(_0x29d6b7){logger['info']('CreateVoiceAgentReport',_0x41465e);logger[_0x0056('0xf')](_0x0056('0x14'),_0x41465e,JSON[_0x0056('0x19')](_0x29d6b7));_0x5f50f9(_0x29d6b7);})[_0x0056('0x13')](function(_0x361bed){logger[_0x0056('0x10')](_0x0056('0x14'),_0x361bed[_0x0056('0x12')],_0x41465e);_0x50b37e(_0x25ad24[_0x0056('0x10')](0x1f4,_0x361bed['message']));});});};exports[_0x0056('0x1a')]=function(_0x557b4f){var _0x1fd814=this;return new Promise(function(_0x1807e2,_0x4a6e33){return db[_0x0056('0x15')][_0x0056('0x1b')](_0x557b4f[_0x0056('0x16')],{'raw':_0x557b4f[_0x0056('0x17')]?_0x557b4f[_0x0056('0x17')][_0x0056('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x557b4f[_0x0056('0x17')]?_0x557b4f[_0x0056('0x17')]['where']||null:null,'attributes':_0x557b4f[_0x0056('0x17')]?_0x557b4f['options'][_0x0056('0x1c')]||null:null,'limit':_0x557b4f['options']?_0x557b4f[_0x0056('0x17')][_0x0056('0x1d')]||null:null})['then'](function(_0xf8b2ca){logger[_0x0056('0xc')](_0x0056('0x1a'),_0x557b4f);logger[_0x0056('0xf')]('UpdateVoiceAgentReport',_0x557b4f,JSON[_0x0056('0x19')](_0xf8b2ca));_0x1807e2(_0xf8b2ca);})[_0x0056('0x13')](function(_0x2e59b8){logger[_0x0056('0x10')](_0x0056('0x1a'),_0x2e59b8[_0x0056('0x12')],_0x557b4f);_0x4a6e33(_0x1fd814[_0x0056('0x10')](0x1f4,_0x2e59b8[_0x0056('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4583aa7..a48cc5d 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 _0xdcb6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','exports','util','path'];(function(_0x4ca2ff,_0x565d95){var _0x5a9e79=function(_0x1aa076){while(--_0x1aa076){_0x4ca2ff['push'](_0x4ca2ff['shift']());}};_0x5a9e79(++_0x565d95);}(_0xdcb6,0x18e));var _0x6dcb=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xdcb6[_0x422905];return _0x33dc6c;};'use strict';var multer=require('multer');var util=require(_0x6dcb('0x0'));var path=require(_0x6dcb('0x1'));var timeout=require(_0x6dcb('0x2'));var express=require(_0x6dcb('0x3'));var router=express[_0x6dcb('0x4')]();var auth=require(_0x6dcb('0x5'));var interaction=require(_0x6dcb('0x6'));var config=require(_0x6dcb('0x7'));var controller=require(_0x6dcb('0x8'));router[_0x6dcb('0x9')]('/',auth[_0x6dcb('0xa')](),controller[_0x6dcb('0xb')]);router[_0x6dcb('0x9')]('/describe',auth[_0x6dcb('0xa')](),controller['describe']);router['get']('/:id',auth[_0x6dcb('0xa')](),controller[_0x6dcb('0xc')]);router[_0x6dcb('0xd')]('/',auth[_0x6dcb('0xa')](),controller[_0x6dcb('0xe')]);router[_0x6dcb('0xf')]('/:id',auth[_0x6dcb('0xa')](),controller['update']);router[_0x6dcb('0x10')](_0x6dcb('0x11'),auth['isAuthenticated'](),controller[_0x6dcb('0x12')]);module[_0x6dcb('0x13')]=router; \ No newline at end of file +var _0xbf52=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x52b4fb,_0x17172b){var _0x393ddb=function(_0x390e40){while(--_0x390e40){_0x52b4fb['push'](_0x52b4fb['shift']());}};_0x393ddb(++_0x17172b);}(_0xbf52,0x174));var _0x2bf5=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0xbf52[_0x4191bc];return _0x1ffd4e;};'use strict';var multer=require(_0x2bf5('0x0'));var util=require(_0x2bf5('0x1'));var path=require(_0x2bf5('0x2'));var timeout=require(_0x2bf5('0x3'));var express=require(_0x2bf5('0x4'));var router=express[_0x2bf5('0x5')]();var auth=require(_0x2bf5('0x6'));var interaction=require(_0x2bf5('0x7'));var config=require(_0x2bf5('0x8'));var controller=require(_0x2bf5('0x9'));router[_0x2bf5('0xa')]('/',auth[_0x2bf5('0xb')](),controller[_0x2bf5('0xc')]);router[_0x2bf5('0xa')](_0x2bf5('0xd'),auth[_0x2bf5('0xb')](),controller['describe']);router[_0x2bf5('0xa')](_0x2bf5('0xe'),auth['isAuthenticated'](),controller[_0x2bf5('0xf')]);router[_0x2bf5('0x10')]('/',auth[_0x2bf5('0xb')](),controller['create']);router[_0x2bf5('0x11')]('/:id',auth[_0x2bf5('0xb')](),controller['update']);router[_0x2bf5('0x12')](_0x2bf5('0xe'),auth['isAuthenticated'](),controller[_0x2bf5('0x13')]);module[_0x2bf5('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 321e6b1..985f158 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 _0x6b8f=['TEXT','DATE','INTEGER','exports','ENUM','outbound','inbound-fax','dialer','STRING'];(function(_0x1b6736,_0xba155d){var _0x52a317=function(_0xcd3e67){while(--_0xcd3e67){_0x1b6736['push'](_0x1b6736['shift']());}};_0x52a317(++_0xba155d);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x6e7935,_0x59c46f){_0x6e7935=_0x6e7935-0x0;var _0x565012=_0x6b8f[_0x6e7935];return _0x565012;};'use strict';var Sequelize=require('sequelize');module[_0xf6b8('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf6b8('0x1')]('inbound','internal',_0xf6b8('0x2'),_0xf6b8('0x3'),'outbound-fax',_0xf6b8('0x4'))},'tag':{'type':Sequelize[_0xf6b8('0x5')]},'accountcode':{'type':Sequelize[_0xf6b8('0x5')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xf6b8('0x5')]},'destinationcontext':{'type':Sequelize[_0xf6b8('0x5')]},'callerid':{'type':Sequelize[_0xf6b8('0x5')]},'channel':{'type':Sequelize[_0xf6b8('0x5')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf6b8('0x6')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0xf6b8('0x7')]},'answertime':{'type':Sequelize[_0xf6b8('0x7')]},'endtime':{'type':Sequelize[_0xf6b8('0x7')]},'duration':{'type':Sequelize[_0xf6b8('0x8')]},'billableseconds':{'type':Sequelize[_0xf6b8('0x8')]},'mohtime':{'type':Sequelize[_0xf6b8('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xf6b8('0x5')]},'userSecondDisposition':{'type':Sequelize[_0xf6b8('0x5')]},'userThirdDisposition':{'type':Sequelize[_0xf6b8('0x5')]},'note':{'type':Sequelize[_0xf6b8('0x5')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xf6b8('0x5')]}}; \ No newline at end of file +var _0x3435=['ENUM','inbound','internal','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x2cbe8d,_0xe7c0e0){var _0x2e1793=function(_0x5a23fc){while(--_0x5a23fc){_0x2cbe8d['push'](_0x2cbe8d['shift']());}};_0x2e1793(++_0xe7c0e0);}(_0x3435,0xfa));var _0x5343=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0x3435[_0x2d89ce];return _0x3fad10;};'use strict';var Sequelize=require(_0x5343('0x0'));module[_0x5343('0x1')]={'uniqueid':{'type':Sequelize[_0x5343('0x2')]},'type':{'type':Sequelize[_0x5343('0x3')](_0x5343('0x4'),_0x5343('0x5'),'outbound',_0x5343('0x6'),_0x5343('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5343('0x2')]},'source':{'type':Sequelize[_0x5343('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5343('0x2')]},'channel':{'type':Sequelize[_0x5343('0x2')]},'destinationchannel':{'type':Sequelize[_0x5343('0x2')]},'lastapplication':{'type':Sequelize[_0x5343('0x2')]},'lastdata':{'type':Sequelize[_0x5343('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x5343('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5343('0x9')]},'duration':{'type':Sequelize[_0x5343('0xa')]},'billableseconds':{'type':Sequelize[_0x5343('0xa')]},'mohtime':{'type':Sequelize[_0x5343('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5343('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x5343('0x2')]},'userDisposition':{'type':Sequelize[_0x5343('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x5343('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5343('0x2')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x5343('0xa')]},'sipcallid':{'type':Sequelize[_0x5343('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index e1e4d70..d860854 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 _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 5b521ad..623b253 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 _0xa0de=['path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x47ae01,_0x2dd0b0){var _0x15b3b7=function(_0x540ebc){while(--_0x540ebc){_0x47ae01['push'](_0x47ae01['shift']());}};_0x15b3b7(++_0x2dd0b0);}(_0xa0de,0x1d6));var _0xea0d=function(_0x50ba46,_0x2abdfe){_0x50ba46=_0x50ba46-0x0;var _0x3e1e37=_0xa0de[_0x50ba46];return _0x3e1e37;};'use strict';var _=require(_0xea0d('0x0'));var util=require(_0xea0d('0x1'));var logger=require(_0xea0d('0x2'))('api');var moment=require(_0xea0d('0x3'));var BPromise=require(_0xea0d('0x4'));var rp=require(_0xea0d('0x5'));var fs=require('fs');var path=require(_0xea0d('0x6'));var rimraf=require(_0xea0d('0x7'));var config=require(_0xea0d('0x8'));var attributes=require(_0xea0d('0x9'));module[_0xea0d('0xa')]=function(_0x2718b5,_0x349501){return _0x2718b5[_0xea0d('0xb')]('VoiceCallReport',attributes,{'tableName':_0xea0d('0xc'),'paranoid':![],'indexes':[{'fields':[_0xea0d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2353=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceCallReport.attributes','define','VoiceCallReport'];(function(_0x1a7065,_0x45f34f){var _0x1fd3b2=function(_0x1d2cba){while(--_0x1d2cba){_0x1a7065['push'](_0x1a7065['shift']());}};_0x1fd3b2(++_0x45f34f);}(_0x2353,0x79));var _0x3235=function(_0x27bb80,_0x41a1a9){_0x27bb80=_0x27bb80-0x0;var _0x5a20a5=_0x2353[_0x27bb80];return _0x5a20a5;};'use strict';var _=require(_0x3235('0x0'));var util=require(_0x3235('0x1'));var logger=require(_0x3235('0x2'))(_0x3235('0x3'));var moment=require(_0x3235('0x4'));var BPromise=require(_0x3235('0x5'));var rp=require(_0x3235('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3235('0x7'));var config=require('../../config/environment');var attributes=require(_0x3235('0x8'));module['exports']=function(_0x5ae4bd,_0x2537f2){return _0x5ae4bd[_0x3235('0x9')](_0x3235('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x3235('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 7872863..ec342dd 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 _0x862a=['include','model','GetVoiceCallReport','CreateVoiceCallReport','create','UpdateVoiceCallReport','VoiceCallReport','update','body','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s','catch','findAll','options','raw','where','attributes','limit','map'];(function(_0x461279,_0x5d9942){var _0x1803c1=function(_0x40a0c1){while(--_0x40a0c1){_0x461279['push'](_0x461279['shift']());}};_0x1803c1(++_0x5d9942);}(_0x862a,0x10c));var _0xa862=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0x862a[_0x419550];return _0x55f9ef;};'use strict';var _=require('lodash');var util=require(_0xa862('0x0'));var moment=require('moment');var BPromise=require(_0xa862('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa862('0x2'));var db=require(_0xa862('0x3'))['db'];var utils=require(_0xa862('0x4'));var logger=require(_0xa862('0x5'))(_0xa862('0x6'));var config=require(_0xa862('0x7'));var jayson=require(_0xa862('0x8'));var client=jayson[_0xa862('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a869d,_0x467a43,_0x4ff27a){return new BPromise(function(_0x3bef3b,_0x4fa093){return client['request'](_0x5a869d,_0x4ff27a)[_0xa862('0xa')](function(_0x14eb2f){logger[_0xa862('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x467a43,_0xa862('0xc'));logger[_0xa862('0xd')](_0xa862('0xe'),_0x467a43,_0xa862('0xc'),JSON[_0xa862('0xf')](_0x14eb2f));if(_0x14eb2f[_0xa862('0x10')]){if(_0x14eb2f[_0xa862('0x10')][_0xa862('0x11')]===0x1f4){logger[_0xa862('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x467a43,_0x14eb2f[_0xa862('0x10')][_0xa862('0x12')]);return _0x4fa093(_0x14eb2f[_0xa862('0x10')][_0xa862('0x12')]);}logger[_0xa862('0x10')](_0xa862('0x13'),_0x467a43,_0x14eb2f[_0xa862('0x10')][_0xa862('0x12')]);return _0x3bef3b(_0x14eb2f[_0xa862('0x10')]['message']);}else{logger[_0xa862('0xb')](_0xa862('0x13'),_0x467a43,_0xa862('0xc'));_0x3bef3b(_0x14eb2f['result'][_0xa862('0x12')]);}})[_0xa862('0x14')](function(_0x5de70d){logger[_0xa862('0x10')]('VoiceCallReport,\x20%s,\x20%s',_0x467a43,_0x5de70d);_0x4fa093(_0x5de70d);});});}exports['GetVoiceCallReport']=function(_0xfc6af9){var _0x3c0f6e=this;return new Promise(function(_0x596387,_0x252c1b){return db['VoiceCallReport'][_0xa862('0x15')]({'raw':_0xfc6af9[_0xa862('0x16')]?_0xfc6af9['options'][_0xa862('0x17')]===undefined?!![]:![]:!![],'where':_0xfc6af9[_0xa862('0x16')]?_0xfc6af9[_0xa862('0x16')][_0xa862('0x18')]||null:null,'attributes':_0xfc6af9[_0xa862('0x16')]?_0xfc6af9[_0xa862('0x16')][_0xa862('0x19')]||null:null,'limit':_0xfc6af9[_0xa862('0x16')]?_0xfc6af9[_0xa862('0x16')][_0xa862('0x1a')]||null:null,'include':_0xfc6af9[_0xa862('0x16')]?_0xfc6af9[_0xa862('0x16')]['include']?_[_0xa862('0x1b')](_0xfc6af9[_0xa862('0x16')][_0xa862('0x1c')],function(_0x582d6e){return{'model':db[_0x582d6e[_0xa862('0x1d')]],'as':_0x582d6e['as'],'attributes':_0x582d6e[_0xa862('0x19')],'include':_0x582d6e[_0xa862('0x1c')]?_[_0xa862('0x1b')](_0x582d6e[_0xa862('0x1c')],function(_0x615fd6){return{'model':db[_0x615fd6['model']],'as':_0x615fd6['as'],'attributes':_0x615fd6[_0xa862('0x19')],'include':_0x615fd6[_0xa862('0x1c')]?_[_0xa862('0x1b')](_0x615fd6[_0xa862('0x1c')],function(_0x10516b){return{'model':db[_0x10516b[_0xa862('0x1d')]],'as':_0x10516b['as'],'attributes':_0x10516b[_0xa862('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x468692){logger[_0xa862('0xb')](_0xa862('0x1e'),_0xfc6af9);logger[_0xa862('0xd')](_0xa862('0x1e'),_0xfc6af9,JSON[_0xa862('0xf')](_0x468692));_0x596387(_0x468692);})[_0xa862('0x14')](function(_0x4cee91){logger[_0xa862('0x10')]('GetVoiceCallReport',_0x4cee91[_0xa862('0x12')],_0xfc6af9);_0x252c1b(_0x3c0f6e[_0xa862('0x10')](0x1f4,_0x4cee91[_0xa862('0x12')]));});});};exports[_0xa862('0x1f')]=function(_0x43223f){var _0x190fc8=this;return new Promise(function(_0x5934d2,_0x172090){return db['VoiceCallReport'][_0xa862('0x20')](_0x43223f['body'],{'raw':_0x43223f['options']?_0x43223f[_0xa862('0x16')][_0xa862('0x17')]===undefined?!![]:![]:!![]})[_0xa862('0xa')](function(_0x20ce93){logger[_0xa862('0xb')](_0xa862('0x1f'),_0x43223f);logger[_0xa862('0xd')](_0xa862('0x1f'),_0x43223f,JSON[_0xa862('0xf')](_0x20ce93));_0x5934d2(_0x20ce93);})[_0xa862('0x14')](function(_0x398f41){logger['error'](_0xa862('0x1f'),_0x398f41[_0xa862('0x12')],_0x43223f);_0x172090(_0x190fc8[_0xa862('0x10')](0x1f4,_0x398f41[_0xa862('0x12')]));});});};exports[_0xa862('0x21')]=function(_0x171a76){var _0x3a1ef9=this;return new Promise(function(_0x38d777,_0x33f5f3){return db[_0xa862('0x22')][_0xa862('0x23')](_0x171a76[_0xa862('0x24')],{'raw':_0x171a76[_0xa862('0x16')]?_0x171a76['options'][_0xa862('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x171a76[_0xa862('0x16')]?_0x171a76[_0xa862('0x16')][_0xa862('0x18')]||null:null,'attributes':_0x171a76[_0xa862('0x16')]?_0x171a76[_0xa862('0x16')][_0xa862('0x19')]||null:null,'limit':_0x171a76[_0xa862('0x16')]?_0x171a76[_0xa862('0x16')][_0xa862('0x1a')]||null:null})[_0xa862('0xa')](function(_0x22811b){logger[_0xa862('0xb')]('UpdateVoiceCallReport',_0x171a76);logger[_0xa862('0xd')]('UpdateVoiceCallReport',_0x171a76,JSON[_0xa862('0xf')](_0x22811b));_0x38d777(_0x22811b);})[_0xa862('0x14')](function(_0x5ebc98){logger['error'](_0xa862('0x21'),_0x5ebc98[_0xa862('0x12')],_0x171a76);_0x33f5f3(_0x3a1ef9[_0xa862('0x10')](0x1f4,_0x5ebc98[_0xa862('0x12')]));});});}; \ No newline at end of file +var _0x4b30=['request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','model','map','CreateVoiceCallReport','body','UpdateVoiceCallReport','update','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4b30,0x89));var _0x04b3=function(_0x316796,_0x31254d){_0x316796=_0x316796-0x0;var _0x421c88=_0x4b30[_0x316796];return _0x421c88;};'use strict';var _=require(_0x04b3('0x0'));var util=require(_0x04b3('0x1'));var moment=require(_0x04b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x04b3('0x3'));var fs=require('fs');var Redis=require(_0x04b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x04b3('0x5'));var logger=require(_0x04b3('0x6'))('rpc');var config=require(_0x04b3('0x7'));var jayson=require(_0x04b3('0x8'));var client=jayson[_0x04b3('0x9')][_0x04b3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3425f5,_0x4e67f7,_0x55572a){return new BPromise(function(_0x3870b9,_0x473b0c){return client[_0x04b3('0xb')](_0x3425f5,_0x55572a)[_0x04b3('0xc')](function(_0x305827){logger[_0x04b3('0xd')](_0x04b3('0xe'),_0x4e67f7,_0x04b3('0xf'));logger['debug'](_0x04b3('0x10'),_0x4e67f7,'request\x20sent',JSON[_0x04b3('0x11')](_0x305827));if(_0x305827[_0x04b3('0x12')]){if(_0x305827[_0x04b3('0x12')]['code']===0x1f4){logger[_0x04b3('0x12')](_0x04b3('0xe'),_0x4e67f7,_0x305827[_0x04b3('0x12')][_0x04b3('0x13')]);return _0x473b0c(_0x305827[_0x04b3('0x12')][_0x04b3('0x13')]);}logger[_0x04b3('0x12')](_0x04b3('0xe'),_0x4e67f7,_0x305827['error'][_0x04b3('0x13')]);return _0x3870b9(_0x305827[_0x04b3('0x12')][_0x04b3('0x13')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x4e67f7,_0x04b3('0xf'));_0x3870b9(_0x305827[_0x04b3('0x14')][_0x04b3('0x13')]);}})[_0x04b3('0x15')](function(_0x120ef8){logger[_0x04b3('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x4e67f7,_0x120ef8);_0x473b0c(_0x120ef8);});});}exports[_0x04b3('0x16')]=function(_0x53dac6){var _0x17972f=this;return new Promise(function(_0x5ca45d,_0x17a96f){return db[_0x04b3('0x17')]['findAll']({'raw':_0x53dac6[_0x04b3('0x18')]?_0x53dac6[_0x04b3('0x18')][_0x04b3('0x19')]===undefined?!![]:![]:!![],'where':_0x53dac6[_0x04b3('0x18')]?_0x53dac6['options'][_0x04b3('0x1a')]||null:null,'attributes':_0x53dac6[_0x04b3('0x18')]?_0x53dac6[_0x04b3('0x18')][_0x04b3('0x1b')]||null:null,'limit':_0x53dac6[_0x04b3('0x18')]?_0x53dac6['options'][_0x04b3('0x1c')]||null:null,'include':_0x53dac6[_0x04b3('0x18')]?_0x53dac6['options'][_0x04b3('0x1d')]?_['map'](_0x53dac6['options'][_0x04b3('0x1d')],function(_0x4ddcca){return{'model':db[_0x4ddcca[_0x04b3('0x1e')]],'as':_0x4ddcca['as'],'attributes':_0x4ddcca[_0x04b3('0x1b')],'include':_0x4ddcca[_0x04b3('0x1d')]?_[_0x04b3('0x1f')](_0x4ddcca[_0x04b3('0x1d')],function(_0x4f1bb4){return{'model':db[_0x4f1bb4[_0x04b3('0x1e')]],'as':_0x4f1bb4['as'],'attributes':_0x4f1bb4[_0x04b3('0x1b')],'include':_0x4f1bb4[_0x04b3('0x1d')]?_[_0x04b3('0x1f')](_0x4f1bb4['include'],function(_0x1529de){return{'model':db[_0x1529de[_0x04b3('0x1e')]],'as':_0x1529de['as'],'attributes':_0x1529de[_0x04b3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20b6a8){logger['info'](_0x04b3('0x16'),_0x53dac6);logger['debug'](_0x04b3('0x16'),_0x53dac6,JSON[_0x04b3('0x11')](_0x20b6a8));_0x5ca45d(_0x20b6a8);})[_0x04b3('0x15')](function(_0x1d6b61){logger[_0x04b3('0x12')]('GetVoiceCallReport',_0x1d6b61[_0x04b3('0x13')],_0x53dac6);_0x17a96f(_0x17972f[_0x04b3('0x12')](0x1f4,_0x1d6b61[_0x04b3('0x13')]));});});};exports[_0x04b3('0x20')]=function(_0x2b8b7a){var _0x3ab069=this;return new Promise(function(_0x3f25a4,_0x31e714){return db['VoiceCallReport']['create'](_0x2b8b7a[_0x04b3('0x21')],{'raw':_0x2b8b7a[_0x04b3('0x18')]?_0x2b8b7a[_0x04b3('0x18')][_0x04b3('0x19')]===undefined?!![]:![]:!![]})[_0x04b3('0xc')](function(_0x118d35){logger[_0x04b3('0xd')](_0x04b3('0x20'),_0x2b8b7a);logger['debug'](_0x04b3('0x20'),_0x2b8b7a,JSON[_0x04b3('0x11')](_0x118d35));_0x3f25a4(_0x118d35);})['catch'](function(_0x1810fb){logger[_0x04b3('0x12')](_0x04b3('0x20'),_0x1810fb[_0x04b3('0x13')],_0x2b8b7a);_0x31e714(_0x3ab069['error'](0x1f4,_0x1810fb[_0x04b3('0x13')]));});});};exports[_0x04b3('0x22')]=function(_0x25b906){var _0x480c6b=this;return new Promise(function(_0x48c305,_0x40b7bf){return db[_0x04b3('0x17')][_0x04b3('0x23')](_0x25b906[_0x04b3('0x21')],{'raw':_0x25b906[_0x04b3('0x18')]?_0x25b906[_0x04b3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25b906[_0x04b3('0x18')]?_0x25b906[_0x04b3('0x18')]['where']||null:null,'attributes':_0x25b906['options']?_0x25b906['options'][_0x04b3('0x1b')]||null:null,'limit':_0x25b906[_0x04b3('0x18')]?_0x25b906[_0x04b3('0x18')][_0x04b3('0x1c')]||null:null})[_0x04b3('0xc')](function(_0x57f9b3){logger[_0x04b3('0xd')]('UpdateVoiceCallReport',_0x25b906);logger[_0x04b3('0x24')]('UpdateVoiceCallReport',_0x25b906,JSON[_0x04b3('0x11')](_0x57f9b3));_0x48c305(_0x57f9b3);})[_0x04b3('0x15')](function(_0x32d77f){logger[_0x04b3('0x12')](_0x04b3('0x22'),_0x32d77f[_0x04b3('0x13')],_0x25b906);_0x40b7bf(_0x480c6b[_0x04b3('0x12')](0x1f4,_0x32d77f[_0x04b3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 9bc6797..b92ee72 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 _0x126e=['../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x28bbd1,_0x447fad){var _0x49d9f3=function(_0x5e3752){while(--_0x5e3752){_0x28bbd1['push'](_0x28bbd1['shift']());}};_0x49d9f3(++_0x447fad);}(_0x126e,0x108));var _0xe126=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x126e[_0x1d1779];return _0x2377e9;};'use strict';var multer=require('multer');var util=require(_0xe126('0x0'));var path=require(_0xe126('0x1'));var timeout=require(_0xe126('0x2'));var express=require(_0xe126('0x3'));var router=express[_0xe126('0x4')]();var auth=require(_0xe126('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe126('0x6'));var controller=require(_0xe126('0x7'));router[_0xe126('0x8')]('/',auth[_0xe126('0x9')](),controller[_0xe126('0xa')]);router[_0xe126('0x8')](_0xe126('0xb'),auth['isAuthenticated'](),controller[_0xe126('0xc')]);router[_0xe126('0xd')]('/',auth[_0xe126('0x9')](),controller[_0xe126('0xe')]);router[_0xe126('0xf')]('/:id',auth[_0xe126('0x9')](),controller[_0xe126('0x10')]);router['delete'](_0xe126('0xb'),auth[_0xe126('0x9')](),controller['destroy']);module[_0xe126('0x11')]=router; \ No newline at end of file +var _0x7ee1=['show','create','put','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id'];(function(_0x8182e4,_0x478b5b){var _0x210087=function(_0x20fd76){while(--_0x20fd76){_0x8182e4['push'](_0x8182e4['shift']());}};_0x210087(++_0x478b5b);}(_0x7ee1,0x8d));var _0x17ee=function(_0x480bf9,_0x520f59){_0x480bf9=_0x480bf9-0x0;var _0x4271f6=_0x7ee1[_0x480bf9];return _0x4271f6;};'use strict';var multer=require(_0x17ee('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x17ee('0x1'));var router=express[_0x17ee('0x2')]();var auth=require(_0x17ee('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x17ee('0x4'));var controller=require(_0x17ee('0x5'));router[_0x17ee('0x6')]('/',auth[_0x17ee('0x7')](),controller['index']);router[_0x17ee('0x6')](_0x17ee('0x8'),auth['isAuthenticated'](),controller[_0x17ee('0x9')]);router['post']('/',auth[_0x17ee('0x7')](),controller[_0x17ee('0xa')]);router[_0x17ee('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x17ee('0xc')]('/:id',auth[_0x17ee('0x7')](),controller[_0x17ee('0xd')]);module[_0x17ee('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index de242e4..134830c 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 _0x9d81=['split','BOOLEAN','sequelize','name','STRING','setDataValue','options','getDataValue'];(function(_0x576694,_0x1fdbff){var _0x4f9ef4=function(_0x1207f7){while(--_0x1207f7){_0x576694['push'](_0x576694['shift']());}};_0x4f9ef4(++_0x1fdbff);}(_0x9d81,0x152));var _0x19d8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9d81[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x19d8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x19d8('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0x19d8('0x2')],'set':function(_0x3570d4){this[_0x19d8('0x3')](_0x19d8('0x4'),_0x3570d4?_0x3570d4['join'](''):[]);},'get':function(){return this[_0x19d8('0x5')](_0x19d8('0x4'))?this[_0x19d8('0x5')](_0x19d8('0x4'))[_0x19d8('0x6')](''):[];}},'auth':{'type':Sequelize[_0x19d8('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x19d8('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x19d8('0x2')]},'description':{'type':Sequelize[_0x19d8('0x2')]}}; \ No newline at end of file +var _0x489c=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x11cb14,_0x25b42a){var _0x571d02=function(_0xdd406d){while(--_0xdd406d){_0x11cb14['push'](_0x11cb14['shift']());}};_0x571d02(++_0x25b42a);}(_0x489c,0x110));var _0xc489=function(_0xd839e7,_0x4209e9){_0xd839e7=_0xd839e7-0x0;var _0xc3cf23=_0x489c[_0xd839e7];return _0xc3cf23;};'use strict';var Sequelize=require(_0xc489('0x0'));module[_0xc489('0x1')]={'name':{'type':Sequelize[_0xc489('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xc489('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc489('0x2')],'set':function(_0x417fda){this[_0xc489('0x4')](_0xc489('0x5'),_0x417fda?_0x417fda[_0xc489('0x6')](''):[]);},'get':function(){return this[_0xc489('0x7')](_0xc489('0x5'))?this[_0xc489('0x7')](_0xc489('0x5'))[_0xc489('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xc489('0x2')]},'record':{'type':Sequelize[_0xc489('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc489('0x2')]},'description':{'type':Sequelize[_0xc489('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index aa312b7..bcf6d23 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 _0x20b8=['catch','show','params','merge','find','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','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','apply','update','destroy','get','ChanSpies','UserProfileResource','then','stack','name','index','VoiceChanSpy','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll'];(function(_0xc31a89,_0x1c0939){var _0x4a8407=function(_0x5b1435){while(--_0x5b1435){_0xc31a89['push'](_0xc31a89['shift']());}};_0x4a8407(++_0x1c0939);}(_0x20b8,0x14b));var _0x820b=function(_0x56dbcd,_0x5bf754){_0x56dbcd=_0x56dbcd-0x0;var _0x885edd=_0x20b8[_0x56dbcd];return _0x885edd;};'use strict';var pdf=require(_0x820b('0x0'));var emlformat=require(_0x820b('0x1'));var rimraf=require(_0x820b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x820b('0x3'));var rp=require(_0x820b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x820b('0x5'));var util=require(_0x820b('0x6'));var path=require('path');var sox=require(_0x820b('0x7'));var csv=require(_0x820b('0x8'));var ejs=require(_0x820b('0x9'));var fs=require('fs');var _=require(_0x820b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x820b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x820b('0x8'));var querystring=require(_0x820b('0xc'));var Papa=require(_0x820b('0xd'));var Redis=require(_0x820b('0xe'));var authService=require(_0x820b('0xf'));var qs=require(_0x820b('0x10'));var as=require(_0x820b('0x11'));var hardwareService=require(_0x820b('0x12'));var logger=require(_0x820b('0x13'))(_0x820b('0x14'));var utils=require(_0x820b('0x15'));var config=require(_0x820b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x482d26,_0x535947){_0x535947=_0x535947||0xcc;return function(_0x4923b){if(_0x4923b){return _0x482d26[_0x820b('0x17')](_0x535947);}return _0x482d26[_0x820b('0x18')](_0x535947)[_0x820b('0x19')]();};}function respondWithResult(_0x20ae75,_0x5d5ec5){_0x5d5ec5=_0x5d5ec5||0xc8;return function(_0x37d0f7){if(_0x37d0f7){return _0x20ae75[_0x820b('0x18')](_0x5d5ec5)['json'](_0x37d0f7);}};}function respondWithFilteredResult(_0x2eaf4f,_0x5225fb){return function(_0x3a2e8c){if(_0x3a2e8c){var _0xb69ab3=_0x3a2e8c[_0x820b('0x1a')],_0x40eada=_0x5225fb[_0x820b('0x1b')],_0x12dcf1=_0x5225fb[_0x820b('0x1b')]+_0x5225fb[_0x820b('0x1c')],_0x59fa27;if(_0x12dcf1>=_0xb69ab3){_0x12dcf1=_0xb69ab3;_0x59fa27=0xc8;}else{_0x59fa27=0xce;}_0x2eaf4f['status'](_0x59fa27);return _0x2eaf4f[_0x820b('0x1d')]('Content-Range',_0x40eada+'-'+_0x12dcf1+'/'+_0xb69ab3)['json'](_0x3a2e8c);}return null;};}function patchUpdates(_0x54dc54){return function(_0x50815f){try{jsonpatch[_0x820b('0x1e')](_0x50815f,_0x54dc54,!![]);}catch(_0x88598c){return BPromise['reject'](_0x88598c);}return _0x50815f['save']();};}function saveUpdates(_0x3b963d,_0x4e5d89){return function(_0x2fcb8a){if(_0x2fcb8a){return _0x2fcb8a[_0x820b('0x1f')](_0x3b963d)['then'](function(_0x28aa24){return _0x28aa24;});}return null;};}function removeEntity(_0x4ecfc3,_0x34c233){return function(_0x1d075a){if(_0x1d075a){return _0x1d075a[_0x820b('0x20')]()['then'](function(){var _0x504650=_0x1d075a[_0x820b('0x21')]({'plain':!![]});var _0x3c6783=_0x820b('0x22');return db[_0x820b('0x23')][_0x820b('0x20')]({'where':{'type':_0x3c6783,'resourceId':_0x504650['id']}})[_0x820b('0x24')](function(){return _0x1d075a;});})[_0x820b('0x24')](function(){_0x4ecfc3[_0x820b('0x18')](0xcc)[_0x820b('0x19')]();});}};}function handleEntityNotFound(_0x330843,_0x28e097){return function(_0xd61602){if(!_0xd61602){_0x330843[_0x820b('0x17')](0x194);}return _0xd61602;};}function handleError(_0xb993fb,_0x333989){_0x333989=_0x333989||0x1f4;return function(_0xe10afa){logger['error'](_0xe10afa[_0x820b('0x25')]);if(_0xe10afa[_0x820b('0x26')]){delete _0xe10afa[_0x820b('0x26')];}_0xb993fb[_0x820b('0x18')](_0x333989)['send'](_0xe10afa);};}exports[_0x820b('0x27')]=function(_0x239b1f,_0xbbcc9){var _0x56d90d={},_0x4c634a={},_0x498a46={'count':0x0,'rows':[]};var _0x598e06=_['map'](db[_0x820b('0x28')][_0x820b('0x29')],function(_0x4279a5){return{'name':_0x4279a5['fieldName'],'type':_0x4279a5['type'][_0x820b('0x2a')]};});_0x4c634a['model']=_[_0x820b('0x2b')](_0x598e06,_0x820b('0x26'));_0x4c634a[_0x820b('0x2c')]=_[_0x820b('0x2d')](_0x239b1f[_0x820b('0x2c')]);_0x4c634a[_0x820b('0x2e')]=_[_0x820b('0x2f')](_0x4c634a[_0x820b('0x30')],_0x4c634a[_0x820b('0x2c')]);_0x56d90d[_0x820b('0x31')]=_[_0x820b('0x2f')](_0x4c634a[_0x820b('0x30')],qs[_0x820b('0x32')](_0x239b1f['query'][_0x820b('0x32')]));_0x56d90d[_0x820b('0x31')]=_0x56d90d[_0x820b('0x31')]['length']?_0x56d90d[_0x820b('0x31')]:_0x4c634a['model'];if(!_0x239b1f[_0x820b('0x2c')][_0x820b('0x33')](_0x820b('0x34'))){_0x56d90d['limit']=qs[_0x820b('0x1c')](_0x239b1f[_0x820b('0x2c')][_0x820b('0x1c')]);_0x56d90d['offset']=qs[_0x820b('0x1b')](_0x239b1f[_0x820b('0x2c')][_0x820b('0x1b')]);}_0x56d90d[_0x820b('0x35')]=qs[_0x820b('0x36')](_0x239b1f[_0x820b('0x2c')][_0x820b('0x36')]);_0x56d90d[_0x820b('0x37')]=qs[_0x820b('0x2e')](_[_0x820b('0x38')](_0x239b1f[_0x820b('0x2c')],_0x4c634a['filters']),_0x598e06);if(_0x239b1f[_0x820b('0x2c')][_0x820b('0x39')]){_0x56d90d[_0x820b('0x37')]=_['merge'](_0x56d90d['where'],{'$or':_[_0x820b('0x2b')](_0x598e06,function(_0x5055e1){if(_0x5055e1[_0x820b('0x3a')]!==_0x820b('0x3b')){var _0xb9f71c={};_0xb9f71c[_0x5055e1[_0x820b('0x26')]]={'$like':'%'+_0x239b1f[_0x820b('0x2c')][_0x820b('0x39')]+'%'};return _0xb9f71c;}})});}_0x56d90d=_['merge']({},_0x56d90d,_0x239b1f[_0x820b('0x3c')]);var _0x1ed4fd={'where':_0x56d90d['where']};return db[_0x820b('0x28')][_0x820b('0x1a')](_0x1ed4fd)[_0x820b('0x24')](function(_0x244cd6){_0x498a46[_0x820b('0x1a')]=_0x244cd6;if(_0x239b1f[_0x820b('0x2c')][_0x820b('0x3d')]){_0x56d90d[_0x820b('0x3e')]=[{'all':!![]}];}return db[_0x820b('0x28')][_0x820b('0x3f')](_0x56d90d);})[_0x820b('0x24')](function(_0x37e84a){_0x498a46['rows']=_0x37e84a;return _0x498a46;})[_0x820b('0x24')](respondWithFilteredResult(_0xbbcc9,_0x56d90d))[_0x820b('0x40')](handleError(_0xbbcc9,null));};exports[_0x820b('0x41')]=function(_0x968537,_0xe28b22){var _0x26027e={'raw':![],'where':{'id':_0x968537[_0x820b('0x42')]['id']}},_0x3e11eb={};_0x3e11eb[_0x820b('0x30')]=_[_0x820b('0x2d')](db[_0x820b('0x28')][_0x820b('0x29')]);_0x3e11eb['query']=_[_0x820b('0x2d')](_0x968537[_0x820b('0x2c')]);_0x3e11eb['filters']=_['intersection'](_0x3e11eb[_0x820b('0x30')],_0x3e11eb['query']);_0x26027e[_0x820b('0x31')]=_[_0x820b('0x2f')](_0x3e11eb[_0x820b('0x30')],qs[_0x820b('0x32')](_0x968537[_0x820b('0x2c')]['fields']));_0x26027e[_0x820b('0x31')]=_0x26027e[_0x820b('0x31')]['length']?_0x26027e[_0x820b('0x31')]:_0x3e11eb[_0x820b('0x30')];if(_0x968537[_0x820b('0x2c')][_0x820b('0x3d')]){_0x26027e[_0x820b('0x3e')]=[{'all':!![]}];}_0x26027e=_[_0x820b('0x43')]({},_0x26027e,_0x968537[_0x820b('0x3c')]);return db[_0x820b('0x28')][_0x820b('0x44')](_0x26027e)['then'](handleEntityNotFound(_0xe28b22,null))[_0x820b('0x24')](respondWithResult(_0xe28b22,null))[_0x820b('0x40')](handleError(_0xe28b22,null));};exports['create']=function(_0x212548,_0x586f6e){return db[_0x820b('0x28')][_0x820b('0x45')](_0x212548[_0x820b('0x46')],{})['then'](function(_0x26fd92){var _0x29b964=_0x212548[_0x820b('0x47')][_0x820b('0x21')]({'plain':!![]});if(!_0x29b964)throw new Error(_0x820b('0x48'));if(_0x29b964[_0x820b('0x49')]===_0x820b('0x47')){var _0x580bf6=_0x26fd92[_0x820b('0x21')]({'plain':!![]});var _0x5d4911=_0x820b('0x22');return db[_0x820b('0x4a')][_0x820b('0x44')]({'where':{'name':_0x5d4911,'userProfileId':_0x29b964[_0x820b('0x4b')]},'raw':!![]})['then'](function(_0x554714){if(_0x554714&&_0x554714[_0x820b('0x4c')]===0x0){return db[_0x820b('0x23')][_0x820b('0x45')]({'name':_0x580bf6[_0x820b('0x26')],'resourceId':_0x580bf6['id'],'type':_0x554714[_0x820b('0x26')],'sectionId':_0x554714['id']},{})[_0x820b('0x24')](function(){return _0x26fd92;});}else{return _0x26fd92;}})[_0x820b('0x40')](function(_0x19133f){logger[_0x820b('0x4d')](_0x820b('0x4e'),_0x19133f);throw _0x19133f;});}return _0x26fd92;})['then'](respondWithResult(_0x586f6e,0xc9))[_0x820b('0x40')](handleError(_0x586f6e,null));};exports['update']=function(_0x1c3634,_0x4462b9){if(_0x1c3634[_0x820b('0x46')]['id']){delete _0x1c3634[_0x820b('0x46')]['id'];}return db[_0x820b('0x28')]['find']({'where':{'id':_0x1c3634[_0x820b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4462b9,null))[_0x820b('0x24')](saveUpdates(_0x1c3634[_0x820b('0x46')],null))[_0x820b('0x24')](respondWithResult(_0x4462b9,null))[_0x820b('0x40')](handleError(_0x4462b9,null));};exports[_0x820b('0x20')]=function(_0x1322ac,_0x174a96){return db[_0x820b('0x28')]['find']({'where':{'id':_0x1322ac[_0x820b('0x42')]['id']}})[_0x820b('0x24')](handleEntityNotFound(_0x174a96,null))[_0x820b('0x24')](removeEntity(_0x174a96,null))['catch'](handleError(_0x174a96,null));}; \ No newline at end of file +var _0x2f78=['nolimit','order','where','filter','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x2f78,0x1a9));var _0x82f7=function(_0x5ae38a,_0x550499){_0x5ae38a=_0x5ae38a-0x0;var _0xee7656=_0x2f78[_0x5ae38a];return _0xee7656;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x82f7('0x0'));var rimraf=require(_0x82f7('0x1'));var zipdir=require(_0x82f7('0x2'));var jsonpatch=require(_0x82f7('0x3'));var rp=require(_0x82f7('0x4'));var moment=require(_0x82f7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x82f7('0x6'));var util=require('util');var path=require(_0x82f7('0x7'));var sox=require(_0x82f7('0x8'));var csv=require(_0x82f7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x82f7('0xa'));var squel=require(_0x82f7('0xb'));var crypto=require(_0x82f7('0xc'));var jsforce=require(_0x82f7('0xd'));var deskjs=require(_0x82f7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x82f7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x82f7('0x10'));var as=require(_0x82f7('0x11'));var hardwareService=require(_0x82f7('0x12'));var logger=require('../../config/logger')(_0x82f7('0x13'));var utils=require(_0x82f7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x82f7('0x15'));var db=require(_0x82f7('0x16'))['db'];function respondWithStatusCode(_0x4134f6,_0x4b6721){_0x4b6721=_0x4b6721||0xcc;return function(_0x774441){if(_0x774441){return _0x4134f6['sendStatus'](_0x4b6721);}return _0x4134f6[_0x82f7('0x17')](_0x4b6721)[_0x82f7('0x18')]();};}function respondWithResult(_0x7b920a,_0x30c091){_0x30c091=_0x30c091||0xc8;return function(_0x42f84e){if(_0x42f84e){return _0x7b920a[_0x82f7('0x17')](_0x30c091)[_0x82f7('0x19')](_0x42f84e);}};}function respondWithFilteredResult(_0x36bac7,_0x58158f){return function(_0x50d006){if(_0x50d006){var _0x831a2b=_0x50d006[_0x82f7('0x1a')],_0x4d13f3=_0x58158f['offset'],_0x4b4c13=_0x58158f[_0x82f7('0x1b')]+_0x58158f[_0x82f7('0x1c')],_0x47db42;if(_0x4b4c13>=_0x831a2b){_0x4b4c13=_0x831a2b;_0x47db42=0xc8;}else{_0x47db42=0xce;}_0x36bac7[_0x82f7('0x17')](_0x47db42);return _0x36bac7['set'](_0x82f7('0x1d'),_0x4d13f3+'-'+_0x4b4c13+'/'+_0x831a2b)[_0x82f7('0x19')](_0x50d006);}return null;};}function patchUpdates(_0x3ffa70){return function(_0x121f91){try{jsonpatch[_0x82f7('0x1e')](_0x121f91,_0x3ffa70,!![]);}catch(_0x5b6c34){return BPromise['reject'](_0x5b6c34);}return _0x121f91[_0x82f7('0x1f')]();};}function saveUpdates(_0xbd7c67,_0x18e2b3){return function(_0x4f2abd){if(_0x4f2abd){return _0x4f2abd[_0x82f7('0x20')](_0xbd7c67)[_0x82f7('0x21')](function(_0x2f761e){return _0x2f761e;});}return null;};}function removeEntity(_0x4db4c3,_0x204906){return function(_0x506464){if(_0x506464){return _0x506464['destroy']()[_0x82f7('0x21')](function(){var _0x51709b=_0x506464[_0x82f7('0x22')]({'plain':!![]});var _0x4baf20='ChanSpies';return db[_0x82f7('0x23')][_0x82f7('0x24')]({'where':{'type':_0x4baf20,'resourceId':_0x51709b['id']}})[_0x82f7('0x21')](function(){return _0x506464;});})['then'](function(){_0x4db4c3[_0x82f7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa692e5,_0x466e36){return function(_0x254974){if(!_0x254974){_0xa692e5[_0x82f7('0x25')](0x194);}return _0x254974;};}function handleError(_0x17a23d,_0x98d9d6){_0x98d9d6=_0x98d9d6||0x1f4;return function(_0x402a47){logger[_0x82f7('0x26')](_0x402a47[_0x82f7('0x27')]);if(_0x402a47[_0x82f7('0x28')]){delete _0x402a47[_0x82f7('0x28')];}_0x17a23d[_0x82f7('0x17')](_0x98d9d6)['send'](_0x402a47);};}exports[_0x82f7('0x29')]=function(_0x1e1218,_0x29dba9){var _0x414d9f={},_0x515988={},_0x5e0594={'count':0x0,'rows':[]};var _0x288d03=_[_0x82f7('0x2a')](db[_0x82f7('0x2b')][_0x82f7('0x2c')],function(_0x373071){return{'name':_0x373071[_0x82f7('0x2d')],'type':_0x373071[_0x82f7('0x2e')][_0x82f7('0x2f')]};});_0x515988[_0x82f7('0x30')]=_[_0x82f7('0x2a')](_0x288d03,_0x82f7('0x28'));_0x515988['query']=_['keys'](_0x1e1218[_0x82f7('0x31')]);_0x515988[_0x82f7('0x32')]=_[_0x82f7('0x33')](_0x515988['model'],_0x515988['query']);_0x414d9f[_0x82f7('0x34')]=_[_0x82f7('0x33')](_0x515988[_0x82f7('0x30')],qs['fields'](_0x1e1218[_0x82f7('0x31')][_0x82f7('0x35')]));_0x414d9f[_0x82f7('0x34')]=_0x414d9f[_0x82f7('0x34')][_0x82f7('0x36')]?_0x414d9f[_0x82f7('0x34')]:_0x515988[_0x82f7('0x30')];if(!_0x1e1218['query']['hasOwnProperty'](_0x82f7('0x37'))){_0x414d9f[_0x82f7('0x1c')]=qs['limit'](_0x1e1218[_0x82f7('0x31')]['limit']);_0x414d9f['offset']=qs[_0x82f7('0x1b')](_0x1e1218[_0x82f7('0x31')][_0x82f7('0x1b')]);}_0x414d9f[_0x82f7('0x38')]=qs['sort'](_0x1e1218[_0x82f7('0x31')]['sort']);_0x414d9f[_0x82f7('0x39')]=qs[_0x82f7('0x32')](_['pick'](_0x1e1218['query'],_0x515988[_0x82f7('0x32')]),_0x288d03);if(_0x1e1218[_0x82f7('0x31')][_0x82f7('0x3a')]){_0x414d9f['where']=_[_0x82f7('0x3b')](_0x414d9f[_0x82f7('0x39')],{'$or':_[_0x82f7('0x2a')](_0x288d03,function(_0x31b29c){if(_0x31b29c['type']!=='VIRTUAL'){var _0x18e040={};_0x18e040[_0x31b29c[_0x82f7('0x28')]]={'$like':'%'+_0x1e1218[_0x82f7('0x31')][_0x82f7('0x3a')]+'%'};return _0x18e040;}})});}_0x414d9f=_[_0x82f7('0x3b')]({},_0x414d9f,_0x1e1218['options']);var _0x1e5948={'where':_0x414d9f[_0x82f7('0x39')]};return db['VoiceChanSpy'][_0x82f7('0x1a')](_0x1e5948)['then'](function(_0x27d895){_0x5e0594['count']=_0x27d895;if(_0x1e1218['query']['includeAll']){_0x414d9f[_0x82f7('0x3c')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x82f7('0x3d')](_0x414d9f);})['then'](function(_0x3938e4){_0x5e0594[_0x82f7('0x3e')]=_0x3938e4;return _0x5e0594;})['then'](respondWithFilteredResult(_0x29dba9,_0x414d9f))[_0x82f7('0x3f')](handleError(_0x29dba9,null));};exports[_0x82f7('0x40')]=function(_0x150fed,_0x4c6527){var _0x13d600={'raw':![],'where':{'id':_0x150fed[_0x82f7('0x41')]['id']}},_0x2efe6e={};_0x2efe6e[_0x82f7('0x30')]=_['keys'](db[_0x82f7('0x2b')][_0x82f7('0x2c')]);_0x2efe6e[_0x82f7('0x31')]=_[_0x82f7('0x42')](_0x150fed[_0x82f7('0x31')]);_0x2efe6e[_0x82f7('0x32')]=_[_0x82f7('0x33')](_0x2efe6e['model'],_0x2efe6e[_0x82f7('0x31')]);_0x13d600[_0x82f7('0x34')]=_[_0x82f7('0x33')](_0x2efe6e['model'],qs[_0x82f7('0x35')](_0x150fed[_0x82f7('0x31')][_0x82f7('0x35')]));_0x13d600[_0x82f7('0x34')]=_0x13d600[_0x82f7('0x34')]['length']?_0x13d600[_0x82f7('0x34')]:_0x2efe6e[_0x82f7('0x30')];if(_0x150fed[_0x82f7('0x31')][_0x82f7('0x43')]){_0x13d600[_0x82f7('0x3c')]=[{'all':!![]}];}_0x13d600=_[_0x82f7('0x3b')]({},_0x13d600,_0x150fed[_0x82f7('0x44')]);return db['VoiceChanSpy'][_0x82f7('0x45')](_0x13d600)[_0x82f7('0x21')](handleEntityNotFound(_0x4c6527,null))[_0x82f7('0x21')](respondWithResult(_0x4c6527,null))[_0x82f7('0x3f')](handleError(_0x4c6527,null));};exports[_0x82f7('0x46')]=function(_0x32179d,_0x54088e){return db[_0x82f7('0x2b')][_0x82f7('0x46')](_0x32179d[_0x82f7('0x47')],{})['then'](function(_0x3cb50d){var _0x3848bc=_0x32179d[_0x82f7('0x48')]['get']({'plain':!![]});if(!_0x3848bc)throw new Error(_0x82f7('0x49'));if(_0x3848bc[_0x82f7('0x4a')]===_0x82f7('0x48')){var _0x150987=_0x3cb50d['get']({'plain':!![]});var _0x3cff85=_0x82f7('0x4b');return db[_0x82f7('0x4c')]['find']({'where':{'name':_0x3cff85,'userProfileId':_0x3848bc[_0x82f7('0x4d')]},'raw':!![]})[_0x82f7('0x21')](function(_0x2a9374){if(_0x2a9374&&_0x2a9374[_0x82f7('0x4e')]===0x0){return db[_0x82f7('0x23')]['create']({'name':_0x150987[_0x82f7('0x28')],'resourceId':_0x150987['id'],'type':_0x2a9374[_0x82f7('0x28')],'sectionId':_0x2a9374['id']},{})[_0x82f7('0x21')](function(){return _0x3cb50d;});}else{return _0x3cb50d;}})[_0x82f7('0x3f')](function(_0x3a58a1){logger[_0x82f7('0x26')](_0x82f7('0x4f'),_0x3a58a1);throw _0x3a58a1;});}return _0x3cb50d;})[_0x82f7('0x21')](respondWithResult(_0x54088e,0xc9))[_0x82f7('0x3f')](handleError(_0x54088e,null));};exports[_0x82f7('0x20')]=function(_0x28ec4c,_0x3396f6){if(_0x28ec4c['body']['id']){delete _0x28ec4c[_0x82f7('0x47')]['id'];}return db[_0x82f7('0x2b')][_0x82f7('0x45')]({'where':{'id':_0x28ec4c[_0x82f7('0x41')]['id']}})['then'](handleEntityNotFound(_0x3396f6,null))['then'](saveUpdates(_0x28ec4c['body'],null))['then'](respondWithResult(_0x3396f6,null))['catch'](handleError(_0x3396f6,null));};exports['destroy']=function(_0x46582f,_0x51c10a){return db[_0x82f7('0x2b')][_0x82f7('0x45')]({'where':{'id':_0x46582f[_0x82f7('0x41')]['id']}})[_0x82f7('0x21')](handleEntityNotFound(_0x51c10a,null))['then'](removeEntity(_0x51c10a,null))[_0x82f7('0x3f')](handleError(_0x51c10a,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index d1d8979..d36f8f1 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 _0xb677=['password','merge','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','models','define','voice_chanspy','bulkCreate','catch','VoiceExtension','destroy','lodash','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','Set','CDR(type)=%s','record','push','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth'];(function(_0x50682f,_0x3efd1a){var _0x205db0=function(_0x24c26c){while(--_0x24c26c){_0x50682f['push'](_0x50682f['shift']());}};_0x205db0(++_0x3efd1a);}(_0xb677,0x119));var _0x7b67=function(_0x3499b4,_0x27864e){_0x3499b4=_0x3499b4-0x0;var _0x37813b=_0xb677[_0x3499b4];return _0x37813b;};'use strict';var _=require(_0x7b67('0x0'));var util=require('util');var BPromise=require(_0x7b67('0x1'));var attributes=require(_0x7b67('0x2'));var getUserApplications=function(_0x388b87,_0x749563,_0x13f678){var _0x3bff27=0x1;var _0x927eee=[];var _0x28e9f6={'context':_0x749563['context']||_0x7b67('0x3'),'exten':util[_0x7b67('0x4')](_0x7b67('0x5'),_0x388b87[_0x7b67('0x6')],_0x13f678),'type':'system','isApp':![],'ChanSpyId':_0x388b87['id'],'UserId':_0x749563['id']};_0x927eee['push'](_['merge']({'app':_0x7b67('0x7'),'appdata':util['format'](_0x7b67('0x8'),'chanspy'),'priority':_0x3bff27++},_0x28e9f6));if(_0x388b87[_0x7b67('0x9')]){_0x927eee[_0x7b67('0xa')](_['merge']({'app':_0x7b67('0xb'),'appdata':util['format'](_0x7b67('0xc'),_0x388b87[_0x7b67('0xd')]),'priority':_0x3bff27++},_0x28e9f6));}if(_0x388b87[_0x7b67('0xe')]){_0x927eee['push'](_['merge']({'app':'Authenticate','appdata':_0x388b87[_0x7b67('0xf')],'priority':_0x3bff27++},_0x28e9f6));}_0x927eee[_0x7b67('0xa')](_[_0x7b67('0x10')]({'app':_0x7b67('0x11'),'appdata':util[_0x7b67('0x4')](_0x7b67('0x12'),_0x749563['name'],_0x388b87[_0x7b67('0x13')]?_0x388b87[_0x7b67('0x13')][_0x7b67('0x14')](''):''),'priority':_0x3bff27++},_0x28e9f6));if(_0x388b87[_0x7b67('0x9')]){_0x927eee[_0x7b67('0xa')](_[_0x7b67('0x10')]({'app':_0x7b67('0x15'),'priority':_0x3bff27++},_0x28e9f6));}return _0x927eee;};var getChanSpyApplications=function(_0xf99987,_0x52c21b){var _0x26a656=[];for(var _0xd10561=0x0,_0x37cef1=0x1;_0xd10561<_0x52c21b[_0x7b67('0x16')];_0xd10561++,_0x37cef1=0x1){_0x26a656=_0x26a656[_0x7b67('0x17')](getUserApplications(_0xf99987,_0x52c21b[_0xd10561],_0x52c21b[_0xd10561][_0x7b67('0x18')]));if(_0x52c21b[_0xd10561]['internal']!=_0x52c21b[_0xd10561][_0x7b67('0x19')]){_0x26a656=_0x26a656[_0x7b67('0x17')](getUserApplications(_0xf99987,_0x52c21b[_0xd10561],_0x52c21b[_0xd10561][_0x7b67('0x19')]));}}return _0x26a656;};var getChanSpyPromise=function(_0x2b093c,_0x4732dc){return new BPromise(function(_0x4095e7,_0x234c20){return _0x2b093c[_0x7b67('0x1a')][_0x7b67('0x1b')]({'attributes':['id',_0x7b67('0x19'),'internal'],'where':{'role':_0x7b67('0x1c'),'chanspy':!![]},'raw':!![]})[_0x7b67('0x1d')](function(_0x55cab1){if(_0x55cab1){return _0x4095e7(getChanSpyApplications(_0x4732dc,_0x55cab1));}return _0x4095e7([]);})['catch'](function(_0x48cd2e){_0x234c20(_0x48cd2e);});});};module['exports']=function(_0x44b951,_0xeabc5c){var _0x10c8fe=_0x44b951[_0x7b67('0x1e')];return _0x44b951[_0x7b67('0x1f')]('VoiceChanSpy',attributes,{'tableName':_0x7b67('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x12d848,_0x103cc4,_0x3f5202){return getChanSpyPromise(_0x10c8fe,_0x12d848)[_0x7b67('0x1d')](function(_0x3e9630){if(_0x3e9630&&_0x3e9630[_0x7b67('0x16')]){return _0x10c8fe['VoiceExtension'][_0x7b67('0x21')](_0x3e9630);}})['then'](function(){_0x3f5202();})[_0x7b67('0x22')](function(_0x2f1e62){_0x3f5202(_0x2f1e62);});},'afterUpdate':function(_0x250fb0,_0x34a88d,_0x5f2a13){return _0x10c8fe[_0x7b67('0x23')][_0x7b67('0x24')]({'where':{'ChanSpyId':_0x250fb0['id']}})[_0x7b67('0x1d')](function(){return getChanSpyPromise(_0x10c8fe,_0x250fb0);})['then'](function(_0x5e35c9){if(_0x5e35c9&&_0x5e35c9['length']){return _0x10c8fe[_0x7b67('0x23')]['bulkCreate'](_0x5e35c9);}})['then'](function(){_0x5f2a13();})[_0x7b67('0x22')](function(_0x3de320){_0x5f2a13(_0x3de320);});},'afterDestroy':function(_0x5c02ae,_0x2fe0c5,_0x5ee04b){return _0x10c8fe['VoiceExtension'][_0x7b67('0x24')]({'where':{'ChanSpyId':_0x5c02ae['id']}})[_0x7b67('0x1d')](function(){_0x5ee04b();})[_0x7b67('0x22')](function(_0x1a7d7a){_0x5ee04b(_0x1a7d7a);});}}});}; \ No newline at end of file +var _0x1ef8=['record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','User','findAll','agent','then','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','catch','lodash','%s%s','prefix','system','push','Set','format','CDR(type)=%s','chanspy'];(function(_0xecdcbf,_0xd4aa98){var _0x4f79bd=function(_0x510475){while(--_0x510475){_0xecdcbf['push'](_0xecdcbf['shift']());}};_0x4f79bd(++_0xd4aa98);}(_0x1ef8,0xd5));var _0x81ef=function(_0x3409e9,_0x473eaa){_0x3409e9=_0x3409e9-0x0;var _0x5276be=_0x1ef8[_0x3409e9];return _0x5276be;};'use strict';var _=require(_0x81ef('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x52b69f,_0x1d17cc,_0x4005a2){var _0x1f990e=0x1;var _0x6a5df=[];var _0x28ed6e={'context':_0x1d17cc['context']||'from-sip','exten':util['format'](_0x81ef('0x1'),_0x52b69f[_0x81ef('0x2')],_0x4005a2),'type':_0x81ef('0x3'),'isApp':![],'ChanSpyId':_0x52b69f['id'],'UserId':_0x1d17cc['id']};_0x6a5df[_0x81ef('0x4')](_['merge']({'app':_0x81ef('0x5'),'appdata':util[_0x81ef('0x6')](_0x81ef('0x7'),_0x81ef('0x8')),'priority':_0x1f990e++},_0x28ed6e));if(_0x52b69f[_0x81ef('0x9')]){_0x6a5df['push'](_[_0x81ef('0xa')]({'app':_0x81ef('0xb'),'appdata':util['format'](_0x81ef('0xc'),_0x52b69f[_0x81ef('0xd')]),'priority':_0x1f990e++},_0x28ed6e));}if(_0x52b69f[_0x81ef('0xe')]){_0x6a5df[_0x81ef('0x4')](_[_0x81ef('0xa')]({'app':_0x81ef('0xf'),'appdata':_0x52b69f[_0x81ef('0x10')],'priority':_0x1f990e++},_0x28ed6e));}_0x6a5df[_0x81ef('0x4')](_[_0x81ef('0xa')]({'app':_0x81ef('0x11'),'appdata':util[_0x81ef('0x6')](_0x81ef('0x12'),_0x1d17cc[_0x81ef('0x13')],_0x52b69f[_0x81ef('0x14')]?_0x52b69f['options'][_0x81ef('0x15')](''):''),'priority':_0x1f990e++},_0x28ed6e));if(_0x52b69f[_0x81ef('0x9')]){_0x6a5df[_0x81ef('0x4')](_[_0x81ef('0xa')]({'app':_0x81ef('0x16'),'priority':_0x1f990e++},_0x28ed6e));}return _0x6a5df;};var getChanSpyApplications=function(_0x238fd6,_0x144929){var _0x416095=[];for(var _0xd1a94b=0x0,_0x4dae0f=0x1;_0xd1a94b<_0x144929[_0x81ef('0x17')];_0xd1a94b++,_0x4dae0f=0x1){_0x416095=_0x416095['concat'](getUserApplications(_0x238fd6,_0x144929[_0xd1a94b],_0x144929[_0xd1a94b]['internal']));if(_0x144929[_0xd1a94b][_0x81ef('0x18')]!=_0x144929[_0xd1a94b][_0x81ef('0x13')]){_0x416095=_0x416095['concat'](getUserApplications(_0x238fd6,_0x144929[_0xd1a94b],_0x144929[_0xd1a94b]['name']));}}return _0x416095;};var getChanSpyPromise=function(_0x3da16a,_0x250c26){return new BPromise(function(_0x23fe66,_0x2c6dd3){return _0x3da16a[_0x81ef('0x19')][_0x81ef('0x1a')]({'attributes':['id',_0x81ef('0x13'),_0x81ef('0x18')],'where':{'role':_0x81ef('0x1b'),'chanspy':!![]},'raw':!![]})[_0x81ef('0x1c')](function(_0x219e27){if(_0x219e27){return _0x23fe66(getChanSpyApplications(_0x250c26,_0x219e27));}return _0x23fe66([]);})['catch'](function(_0x5f49f6){_0x2c6dd3(_0x5f49f6);});});};module[_0x81ef('0x1d')]=function(_0x3f6a78,_0x511341){var _0x3ad6ac=_0x3f6a78[_0x81ef('0x1e')];return _0x3f6a78[_0x81ef('0x1f')](_0x81ef('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x37596b,_0x481683,_0x381396){return getChanSpyPromise(_0x3ad6ac,_0x37596b)[_0x81ef('0x1c')](function(_0x3cbce8){if(_0x3cbce8&&_0x3cbce8[_0x81ef('0x17')]){return _0x3ad6ac[_0x81ef('0x21')][_0x81ef('0x22')](_0x3cbce8);}})[_0x81ef('0x1c')](function(){_0x381396();})['catch'](function(_0x43c04b){_0x381396(_0x43c04b);});},'afterUpdate':function(_0x4dff29,_0x20900f,_0x357cdf){return _0x3ad6ac['VoiceExtension'][_0x81ef('0x23')]({'where':{'ChanSpyId':_0x4dff29['id']}})[_0x81ef('0x1c')](function(){return getChanSpyPromise(_0x3ad6ac,_0x4dff29);})[_0x81ef('0x1c')](function(_0x4ae554){if(_0x4ae554&&_0x4ae554[_0x81ef('0x17')]){return _0x3ad6ac['VoiceExtension'][_0x81ef('0x22')](_0x4ae554);}})[_0x81ef('0x1c')](function(){_0x357cdf();})[_0x81ef('0x24')](function(_0x16a9e1){_0x357cdf(_0x16a9e1);});},'afterDestroy':function(_0x211f1c,_0x31bed8,_0x232f25){return _0x3ad6ac[_0x81ef('0x21')][_0x81ef('0x23')]({'where':{'ChanSpyId':_0x211f1c['id']}})[_0x81ef('0x1c')](function(){_0x232f25();})[_0x81ef('0x24')](function(_0x1d089b){_0x232f25(_0x1d089b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e864af6..c56c258 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 _0x85e1=['stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x85e1,0x14f));var _0x185e=function(_0x4bf7b1,_0xcf3170){_0x4bf7b1=_0x4bf7b1-0x0;var _0x459a20=_0x85e1[_0x4bf7b1];return _0x459a20;};'use strict';var _=require(_0x185e('0x0'));var util=require(_0x185e('0x1'));var moment=require(_0x185e('0x2'));var BPromise=require(_0x185e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x185e('0x4'))['db'];var utils=require(_0x185e('0x5'));var logger=require(_0x185e('0x6'))(_0x185e('0x7'));var config=require(_0x185e('0x8'));var jayson=require(_0x185e('0x9'));var client=jayson[_0x185e('0xa')][_0x185e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42ffdf,_0x51c196,_0x31884f){return new BPromise(function(_0x5adacc,_0x2a7909){return client[_0x185e('0xc')](_0x42ffdf,_0x31884f)['then'](function(_0x1db5c3){logger[_0x185e('0xd')](_0x185e('0xe'),_0x51c196,'request\x20sent');logger['debug'](_0x185e('0xf'),_0x51c196,_0x185e('0x10'),JSON[_0x185e('0x11')](_0x1db5c3));if(_0x1db5c3[_0x185e('0x12')]){if(_0x1db5c3['error'][_0x185e('0x13')]===0x1f4){logger[_0x185e('0x12')](_0x185e('0xe'),_0x51c196,_0x1db5c3[_0x185e('0x12')][_0x185e('0x14')]);return _0x2a7909(_0x1db5c3['error'][_0x185e('0x14')]);}logger[_0x185e('0x12')](_0x185e('0xe'),_0x51c196,_0x1db5c3[_0x185e('0x12')]['message']);return _0x5adacc(_0x1db5c3[_0x185e('0x12')]['message']);}else{logger[_0x185e('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x51c196,'request\x20sent');_0x5adacc(_0x1db5c3[_0x185e('0x15')][_0x185e('0x14')]);}})['catch'](function(_0x4dd4ad){logger['error'](_0x185e('0xe'),_0x51c196,_0x4dd4ad);_0x2a7909(_0x4dd4ad);});});} \ No newline at end of file +var _0xe4a1=['then','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x713aa8,_0x487e3b){var _0x483d26=function(_0x57d058){while(--_0x57d058){_0x713aa8['push'](_0x713aa8['shift']());}};_0x483d26(++_0x487e3b);}(_0xe4a1,0x199));var _0x1e4a=function(_0x38b313,_0x4c5217){_0x38b313=_0x38b313-0x0;var _0x5d393d=_0xe4a1[_0x38b313];return _0x5d393d;};'use strict';var _=require(_0x1e4a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1e4a('0x1'));var rs=require(_0x1e4a('0x2'));var fs=require('fs');var Redis=require(_0x1e4a('0x3'));var db=require(_0x1e4a('0x4'))['db'];var utils=require(_0x1e4a('0x5'));var logger=require(_0x1e4a('0x6'))('rpc');var config=require(_0x1e4a('0x7'));var jayson=require(_0x1e4a('0x8'));var client=jayson[_0x1e4a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54d5c4,_0x358707,_0xe5cc6a){return new BPromise(function(_0x297141,_0x43cfa3){return client[_0x1e4a('0xa')](_0x54d5c4,_0xe5cc6a)[_0x1e4a('0xb')](function(_0xb53783){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x358707,_0x1e4a('0xc'));logger['debug'](_0x1e4a('0xd'),_0x358707,_0x1e4a('0xc'),JSON['stringify'](_0xb53783));if(_0xb53783[_0x1e4a('0xe')]){if(_0xb53783['error'][_0x1e4a('0xf')]===0x1f4){logger[_0x1e4a('0xe')](_0x1e4a('0x10'),_0x358707,_0xb53783[_0x1e4a('0xe')][_0x1e4a('0x11')]);return _0x43cfa3(_0xb53783[_0x1e4a('0xe')]['message']);}logger[_0x1e4a('0xe')](_0x1e4a('0x10'),_0x358707,_0xb53783[_0x1e4a('0xe')][_0x1e4a('0x11')]);return _0x297141(_0xb53783[_0x1e4a('0xe')]['message']);}else{logger[_0x1e4a('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x358707,_0x1e4a('0xc'));_0x297141(_0xb53783[_0x1e4a('0x13')]['message']);}})['catch'](function(_0x7e97a8){logger['error'](_0x1e4a('0x10'),_0x358707,_0x7e97a8);_0x43cfa3(_0x7e97a8);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 25e3627..c175525 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 _0xf263=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer'];(function(_0x53019f,_0x13b1f){var _0x246d32=function(_0x5c79fe){while(--_0x5c79fe){_0x53019f['push'](_0x53019f['shift']());}};_0x246d32(++_0x13b1f);}(_0xf263,0x1df));var _0x3f26=function(_0x333714,_0x3370ac){_0x333714=_0x333714-0x0;var _0x4c211e=_0xf263[_0x333714];return _0x4c211e;};'use strict';var multer=require(_0x3f26('0x0'));var util=require(_0x3f26('0x1'));var path=require(_0x3f26('0x2'));var timeout=require(_0x3f26('0x3'));var express=require('express');var router=express[_0x3f26('0x4')]();var auth=require(_0x3f26('0x5'));var interaction=require(_0x3f26('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3f26('0x7')]);router['get'](_0x3f26('0x8'),auth[_0x3f26('0x9')](),controller[_0x3f26('0xa')]);router[_0x3f26('0xb')]('/',auth[_0x3f26('0x9')](),controller[_0x3f26('0xc')]);router[_0x3f26('0xd')](_0x3f26('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3f26('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x3f26('0xf')]=router; \ No newline at end of file +var _0x6a2f=['create','put','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','index','/:id','isAuthenticated','post'];(function(_0x40b0b9,_0x59cd60){var _0x28e0e2=function(_0x2b75c6){while(--_0x2b75c6){_0x40b0b9['push'](_0x40b0b9['shift']());}};_0x28e0e2(++_0x59cd60);}(_0x6a2f,0xd0));var _0xf6a2=function(_0x485c9f,_0x399a20){_0x485c9f=_0x485c9f-0x0;var _0x2ba76e=_0x6a2f[_0x485c9f];return _0x2ba76e;};'use strict';var multer=require(_0xf6a2('0x0'));var util=require('util');var path=require(_0xf6a2('0x1'));var timeout=require(_0xf6a2('0x2'));var express=require(_0xf6a2('0x3'));var router=express[_0xf6a2('0x4')]();var auth=require(_0xf6a2('0x5'));var interaction=require(_0xf6a2('0x6'));var config=require('../../config/environment');var controller=require(_0xf6a2('0x7'));router[_0xf6a2('0x8')]('/',auth['isAuthenticated'](),controller[_0xf6a2('0x9')]);router[_0xf6a2('0x8')](_0xf6a2('0xa'),auth[_0xf6a2('0xb')](),controller['show']);router[_0xf6a2('0xc')]('/',auth['isAuthenticated'](),controller[_0xf6a2('0xd')]);router[_0xf6a2('0xe')](_0xf6a2('0xa'),auth[_0xf6a2('0xb')](),controller['update']);router['delete']('/:id',auth[_0xf6a2('0xb')](),controller[_0xf6a2('0xf')]);module[_0xf6a2('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 744524c..7444140 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 _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0xb10c1,_0x27786e){var _0x4ace54=function(_0x351a54){while(--_0x351a54){_0xb10c1['push'](_0xb10c1['shift']());}};_0x4ace54(++_0x27786e);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e74=['name','sequelize','STRING'];(function(_0x426384,_0x1901ab){var _0x3aa40a=function(_0x2db297){while(--_0x2db297){_0x426384['push'](_0x426384['shift']());}};_0x3aa40a(++_0x1901ab);}(_0x3e74,0x175));var _0x43e7=function(_0x3bd6d5,_0x25eeba){_0x3bd6d5=_0x3bd6d5-0x0;var _0x363646=_0x3e74[_0x3bd6d5];return _0x363646;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index eb1b5c7..8b4934d 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 _0x8a9a=['writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','role','UserProfileSection','autoAssociation','body','server/files/templates/context.ejs','utf8','Reload','chan_sip.so','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','Contexts','UserProfileResource','sendStatus','name','map','VoiceContext','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','includeAll','findAll','rows','show','params','include','merge','find','create','readFileSync','join','root','render'];(function(_0x5329c5,_0x2bcffc){var _0x39cf4e=function(_0x28a461){while(--_0x28a461){_0x5329c5['push'](_0x5329c5['shift']());}};_0x39cf4e(++_0x2bcffc);}(_0x8a9a,0x193));var _0xa8a9=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x8a9a[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa8a9('0x0'));var zipdir=require(_0xa8a9('0x1'));var jsonpatch=require(_0xa8a9('0x2'));var rp=require('request-promise');var moment=require(_0xa8a9('0x3'));var BPromise=require(_0xa8a9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa8a9('0x5'));var sox=require(_0xa8a9('0x6'));var csv=require(_0xa8a9('0x7'));var ejs=require(_0xa8a9('0x8'));var fs=require('fs');var _=require(_0xa8a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa8a9('0xa'));var deskjs=require(_0xa8a9('0xb'));var toCsv=require(_0xa8a9('0x7'));var querystring=require(_0xa8a9('0xc'));var Papa=require(_0xa8a9('0xd'));var Redis=require(_0xa8a9('0xe'));var authService=require(_0xa8a9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa8a9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa8a9('0x11'))('api');var utils=require(_0xa8a9('0x12'));var config=require(_0xa8a9('0x13'));var licenseUtil=require(_0xa8a9('0x14'));var db=require(_0xa8a9('0x15'))['db'];var jayson=require(_0xa8a9('0x16'));var client=jayson[_0xa8a9('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x493884,_0x42b897,_0x48af30,_0x3bb559){return new BPromise(function(_0x34bec9,_0x3a0e08){var _0xf662a6=_0x3bb559||client;return _0xf662a6[_0xa8a9('0x18')](_0x493884,_0x48af30)['then'](function(_0x3593fa){logger['info'](_0xa8a9('0x19'),_0x42b897,'request\x20sent');logger[_0xa8a9('0x1a')](_0xa8a9('0x1b'),_0x42b897,'request\x20sent',JSON[_0xa8a9('0x1c')](_0x3593fa));if(_0x3593fa['error']){if(_0x3593fa[_0xa8a9('0x1d')][_0xa8a9('0x1e')]===0x1f4){logger[_0xa8a9('0x1d')](_0xa8a9('0x19'),_0x42b897,_0x3593fa['error']['message']);return _0x3a0e08(_0x3593fa[_0xa8a9('0x1d')]['message']);}logger[_0xa8a9('0x1d')](_0xa8a9('0x19'),_0x42b897,_0x3593fa[_0xa8a9('0x1d')][_0xa8a9('0x1f')]);return _0x34bec9(_0x3593fa[_0xa8a9('0x1d')][_0xa8a9('0x1f')]);}else{logger[_0xa8a9('0x20')](_0xa8a9('0x19'),_0x42b897,_0xa8a9('0x21'));_0x34bec9(_0x3593fa[_0xa8a9('0x22')][_0xa8a9('0x1f')]);}})[_0xa8a9('0x23')](function(_0x433a63){logger['error']('VoiceContext,\x20%s,\x20%s',_0x42b897,_0x433a63);_0x3a0e08(_0x433a63);});});}function respondWithStatusCode(_0x4343f4,_0xa4c41a){_0xa4c41a=_0xa4c41a||0xcc;return function(_0x32e784){if(_0x32e784){return _0x4343f4['sendStatus'](_0xa4c41a);}return _0x4343f4[_0xa8a9('0x24')](_0xa4c41a)[_0xa8a9('0x25')]();};}function respondWithResult(_0x296deb,_0x233fe1){_0x233fe1=_0x233fe1||0xc8;return function(_0x488791){if(_0x488791){return _0x296deb[_0xa8a9('0x24')](_0x233fe1)[_0xa8a9('0x26')](_0x488791);}};}function respondWithFilteredResult(_0x2f7a56,_0x1aef34){return function(_0x5f0c62){if(_0x5f0c62){var _0x5bcc97=_0x5f0c62[_0xa8a9('0x27')],_0xfb2b69=_0x1aef34[_0xa8a9('0x28')],_0x468864=_0x1aef34[_0xa8a9('0x28')]+_0x1aef34[_0xa8a9('0x29')],_0x108959;if(_0x468864>=_0x5bcc97){_0x468864=_0x5bcc97;_0x108959=0xc8;}else{_0x108959=0xce;}_0x2f7a56[_0xa8a9('0x24')](_0x108959);return _0x2f7a56['set'](_0xa8a9('0x2a'),_0xfb2b69+'-'+_0x468864+'/'+_0x5bcc97)[_0xa8a9('0x26')](_0x5f0c62);}return null;};}function patchUpdates(_0x128727){return function(_0x2977aa){try{jsonpatch[_0xa8a9('0x2b')](_0x2977aa,_0x128727,!![]);}catch(_0x2474c3){return BPromise[_0xa8a9('0x2c')](_0x2474c3);}return _0x2977aa[_0xa8a9('0x2d')]();};}function saveUpdates(_0x131231,_0x8fa034){return function(_0xadbe15){if(_0xadbe15){return _0xadbe15[_0xa8a9('0x2e')](_0x131231)[_0xa8a9('0x2f')](function(_0x1d95fb){return _0x1d95fb;});}return null;};}function removeEntity(_0x24fa4b,_0x3255bf){return function(_0x5e8e2c){if(_0x5e8e2c){return _0x5e8e2c[_0xa8a9('0x30')]()[_0xa8a9('0x2f')](function(){var _0x34228e=_0x5e8e2c[_0xa8a9('0x31')]({'plain':!![]});var _0x5c1f35=_0xa8a9('0x32');return db[_0xa8a9('0x33')]['destroy']({'where':{'type':_0x5c1f35,'resourceId':_0x34228e['id']}})[_0xa8a9('0x2f')](function(){return _0x5e8e2c;});})[_0xa8a9('0x2f')](function(){_0x24fa4b[_0xa8a9('0x24')](0xcc)[_0xa8a9('0x25')]();});}};}function handleEntityNotFound(_0x6bb9ce,_0x5b064b){return function(_0x2dccff){if(!_0x2dccff){_0x6bb9ce[_0xa8a9('0x34')](0x194);}return _0x2dccff;};}function handleError(_0x38bfd0,_0x2d201f){_0x2d201f=_0x2d201f||0x1f4;return function(_0x2c09b2){logger[_0xa8a9('0x1d')](_0x2c09b2['stack']);if(_0x2c09b2[_0xa8a9('0x35')]){delete _0x2c09b2['name'];}_0x38bfd0['status'](_0x2d201f)['send'](_0x2c09b2);};}exports['index']=function(_0x390106,_0x4a8bc4){var _0x22671d={},_0x55f512={},_0xc715e5={'count':0x0,'rows':[]};var _0x15801f=_[_0xa8a9('0x36')](db[_0xa8a9('0x37')][_0xa8a9('0x38')],function(_0x44c488){return{'name':_0x44c488[_0xa8a9('0x39')],'type':_0x44c488[_0xa8a9('0x3a')]['key']};});_0x55f512[_0xa8a9('0x3b')]=_[_0xa8a9('0x36')](_0x15801f,_0xa8a9('0x35'));_0x55f512[_0xa8a9('0x3c')]=_[_0xa8a9('0x3d')](_0x390106[_0xa8a9('0x3c')]);_0x55f512[_0xa8a9('0x3e')]=_[_0xa8a9('0x3f')](_0x55f512[_0xa8a9('0x3b')],_0x55f512[_0xa8a9('0x3c')]);_0x22671d[_0xa8a9('0x40')]=_[_0xa8a9('0x3f')](_0x55f512[_0xa8a9('0x3b')],qs[_0xa8a9('0x41')](_0x390106[_0xa8a9('0x3c')][_0xa8a9('0x41')]));_0x22671d[_0xa8a9('0x40')]=_0x22671d['attributes'][_0xa8a9('0x42')]?_0x22671d[_0xa8a9('0x40')]:_0x55f512[_0xa8a9('0x3b')];if(!_0x390106[_0xa8a9('0x3c')][_0xa8a9('0x43')](_0xa8a9('0x44'))){_0x22671d[_0xa8a9('0x29')]=qs[_0xa8a9('0x29')](_0x390106[_0xa8a9('0x3c')][_0xa8a9('0x29')]);_0x22671d[_0xa8a9('0x28')]=qs[_0xa8a9('0x28')](_0x390106[_0xa8a9('0x3c')]['offset']);}_0x22671d['order']=qs[_0xa8a9('0x45')](_0x390106['query'][_0xa8a9('0x45')]);_0x22671d[_0xa8a9('0x46')]=qs[_0xa8a9('0x3e')](_['pick'](_0x390106[_0xa8a9('0x3c')],_0x55f512[_0xa8a9('0x3e')]),_0x15801f);if(_0x390106[_0xa8a9('0x3c')][_0xa8a9('0x47')]){_0x22671d[_0xa8a9('0x46')]=_['merge'](_0x22671d[_0xa8a9('0x46')],{'$or':_[_0xa8a9('0x36')](_0x15801f,function(_0x3695c9){if(_0x3695c9[_0xa8a9('0x3a')]!==_0xa8a9('0x48')){var _0x3d052d={};_0x3d052d[_0x3695c9['name']]={'$like':'%'+_0x390106[_0xa8a9('0x3c')][_0xa8a9('0x47')]+'%'};return _0x3d052d;}})});}_0x22671d=_['merge']({},_0x22671d,_0x390106[_0xa8a9('0x49')]);var _0x30ac05={'where':_0x22671d[_0xa8a9('0x46')]};return db[_0xa8a9('0x37')][_0xa8a9('0x27')](_0x30ac05)[_0xa8a9('0x2f')](function(_0x165b10){_0xc715e5[_0xa8a9('0x27')]=_0x165b10;if(_0x390106[_0xa8a9('0x3c')][_0xa8a9('0x4a')]){_0x22671d['include']=[{'all':!![]}];}return db[_0xa8a9('0x37')][_0xa8a9('0x4b')](_0x22671d);})[_0xa8a9('0x2f')](function(_0x30b26f){_0xc715e5[_0xa8a9('0x4c')]=_0x30b26f;return _0xc715e5;})[_0xa8a9('0x2f')](respondWithFilteredResult(_0x4a8bc4,_0x22671d))[_0xa8a9('0x23')](handleError(_0x4a8bc4,null));};exports[_0xa8a9('0x4d')]=function(_0x280fa0,_0x43e080){var _0x4e4973={'raw':![],'where':{'id':_0x280fa0[_0xa8a9('0x4e')]['id']}},_0x4d4866={};_0x4d4866[_0xa8a9('0x3b')]=_[_0xa8a9('0x3d')](db['VoiceContext'][_0xa8a9('0x38')]);_0x4d4866['query']=_[_0xa8a9('0x3d')](_0x280fa0[_0xa8a9('0x3c')]);_0x4d4866['filters']=_[_0xa8a9('0x3f')](_0x4d4866['model'],_0x4d4866[_0xa8a9('0x3c')]);_0x4e4973[_0xa8a9('0x40')]=_[_0xa8a9('0x3f')](_0x4d4866['model'],qs['fields'](_0x280fa0[_0xa8a9('0x3c')][_0xa8a9('0x41')]));_0x4e4973[_0xa8a9('0x40')]=_0x4e4973[_0xa8a9('0x40')][_0xa8a9('0x42')]?_0x4e4973[_0xa8a9('0x40')]:_0x4d4866[_0xa8a9('0x3b')];if(_0x280fa0['query'][_0xa8a9('0x4a')]){_0x4e4973[_0xa8a9('0x4f')]=[{'all':!![]}];}_0x4e4973=_[_0xa8a9('0x50')]({},_0x4e4973,_0x280fa0[_0xa8a9('0x49')]);return db[_0xa8a9('0x37')][_0xa8a9('0x51')](_0x4e4973)['then'](handleEntityNotFound(_0x43e080,null))[_0xa8a9('0x2f')](respondWithResult(_0x43e080,null))['catch'](handleError(_0x43e080,null));};exports['create']=function(_0x290a80,_0x8234d2,_0x394964){var _0x49545f;return db[_0xa8a9('0x37')][_0xa8a9('0x52')](_0x290a80['body'],{'raw':!![]})[_0xa8a9('0x2f')](function(_0x33e63e){_0x49545f=_0x33e63e;return db['VoiceContext'][_0xa8a9('0x4b')]({'raw':!![]});})[_0xa8a9('0x2f')](function(_0x32c15c){var _0x55eec5=fs[_0xa8a9('0x53')](path[_0xa8a9('0x54')](config[_0xa8a9('0x55')],'server/files/templates/context.ejs'),'utf8');var _0x2f91e8=ejs[_0xa8a9('0x56')](_0x55eec5,{'contexts':_0x32c15c||[]});fs[_0xa8a9('0x57')](_0xa8a9('0x58'),_0x2f91e8);})['then'](function(){return respondWithRpcPromise('Reload',_0xa8a9('0x52'),{'module':'chan_sip.so'});})['then'](function(){var _0x5931bf=_0x290a80[_0xa8a9('0x59')][_0xa8a9('0x31')]({'plain':!![]});if(!_0x5931bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5931bf[_0xa8a9('0x5a')]===_0xa8a9('0x59')){var _0x39dfdb=_0x49545f[_0xa8a9('0x31')]({'plain':!![]});return db[_0xa8a9('0x5b')][_0xa8a9('0x51')]({'where':{'name':'Contexts','userProfileId':_0x5931bf['userProfileId']},'raw':!![]})[_0xa8a9('0x2f')](function(_0x1aa98c){if(_0x1aa98c&&_0x1aa98c[_0xa8a9('0x5c')]===0x0){return db[_0xa8a9('0x33')][_0xa8a9('0x52')]({'name':_0x39dfdb['name'],'resourceId':_0x39dfdb['id'],'type':_0x1aa98c[_0xa8a9('0x35')],'sectionId':_0x1aa98c['id']},{})[_0xa8a9('0x2f')](function(){return _0x49545f;});}else{return _0x49545f;}})['catch'](function(_0x40b86c){logger[_0xa8a9('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40b86c);throw _0x40b86c;});}return _0x49545f;})[_0xa8a9('0x2f')](respondWithResult(_0x8234d2,0xc9))[_0xa8a9('0x23')](handleError(_0x8234d2,null));};exports[_0xa8a9('0x2e')]=function(_0x2ea4f0,_0x86fac6,_0x43650d){var _0x30e708;return db['VoiceContext'][_0xa8a9('0x51')]({'where':{'id':_0x2ea4f0[_0xa8a9('0x4e')]['id']}})[_0xa8a9('0x2f')](handleEntityNotFound(_0x86fac6,null))[_0xa8a9('0x2f')](saveUpdates(_0x2ea4f0[_0xa8a9('0x5d')],null))['then'](function(_0x24e113){if(_0x24e113){_0x30e708=_0x24e113;return db[_0xa8a9('0x37')][_0xa8a9('0x4b')]({'raw':!![]});}})[_0xa8a9('0x2f')](function(_0x40d7f5){var _0x2df4f5=fs[_0xa8a9('0x53')](path[_0xa8a9('0x54')](config['root'],_0xa8a9('0x5e')),_0xa8a9('0x5f'));var _0x2e1063=ejs[_0xa8a9('0x56')](_0x2df4f5,{'contexts':_0x40d7f5||[]});fs[_0xa8a9('0x57')](_0xa8a9('0x58'),_0x2e1063);})['then'](function(){return respondWithRpcPromise(_0xa8a9('0x60'),_0xa8a9('0x2e'),{'module':_0xa8a9('0x61')});})['then'](function(){return _0x30e708;})[_0xa8a9('0x2f')](respondWithResult(_0x86fac6,null))[_0xa8a9('0x23')](handleError(_0x86fac6,null));};exports[_0xa8a9('0x30')]=function(_0x2e1133,_0x5baf15,_0x53880d){var _0x4a0448;return db[_0xa8a9('0x37')]['find']({'where':{'id':_0x2e1133[_0xa8a9('0x4e')]['id']}})[_0xa8a9('0x2f')](handleEntityNotFound(_0x5baf15,null))['then'](removeEntity(_0x5baf15,null))[_0xa8a9('0x2f')](function(){return db[_0xa8a9('0x37')][_0xa8a9('0x4b')]({'raw':!![]});})[_0xa8a9('0x2f')](function(_0x5d89bd){var _0x16730c=fs['readFileSync'](path[_0xa8a9('0x54')](config[_0xa8a9('0x55')],'server/files/templates/context.ejs'),'utf8');var _0x3136ff=ejs['render'](_0x16730c,{'contexts':_0x5d89bd});fs[_0xa8a9('0x57')](_0xa8a9('0x58'),_0x3136ff);return respondWithRpcPromise(_0xa8a9('0x60'),'destroy',{'module':_0xa8a9('0x61')});})[_0xa8a9('0x23')](handleError(_0x5baf15,null));}; \ No newline at end of file +var _0x782e=['../../config/utils','../../config/environment','../../config/license/util','jayson/promise','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','keys','create','body','readFileSync','join','root','utf8','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','server/files/templates/context.ejs','render','/etc/asterisk/extensions_xcally_contexts.conf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2dd7a9,_0x442223){var _0x194020=function(_0x2b31d1){while(--_0x2b31d1){_0x2dd7a9['push'](_0x2dd7a9['shift']());}};_0x194020(++_0x442223);}(_0x782e,0xb9));var _0xe782=function(_0xc56818,_0x3cceba){_0xc56818=_0xc56818-0x0;var _0xe40fc4=_0x782e[_0xc56818];return _0xe40fc4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe782('0x0'));var zipdir=require(_0xe782('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe782('0x2'));var moment=require(_0xe782('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe782('0x4'));var util=require(_0xe782('0x5'));var path=require(_0xe782('0x6'));var sox=require(_0xe782('0x7'));var csv=require('to-csv');var ejs=require(_0xe782('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe782('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe782('0xa'));var toCsv=require(_0xe782('0xb'));var querystring=require(_0xe782('0xc'));var Papa=require(_0xe782('0xd'));var Redis=require(_0xe782('0xe'));var authService=require(_0xe782('0xf'));var qs=require(_0xe782('0x10'));var as=require(_0xe782('0x11'));var hardwareService=require(_0xe782('0x12'));var logger=require(_0xe782('0x13'))(_0xe782('0x14'));var utils=require(_0xe782('0x15'));var config=require(_0xe782('0x16'));var licenseUtil=require(_0xe782('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe782('0x18'));var client=jayson['client'][_0xe782('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x356c18,_0x452468,_0x395030,_0xc94acf){return new BPromise(function(_0xd57d73,_0x4e1c25){var _0x5a663c=_0xc94acf||client;return _0x5a663c['request'](_0x356c18,_0x395030)[_0xe782('0x1a')](function(_0xb2c79d){logger['info'](_0xe782('0x1b'),_0x452468,_0xe782('0x1c'));logger[_0xe782('0x1d')](_0xe782('0x1e'),_0x452468,_0xe782('0x1c'),JSON[_0xe782('0x1f')](_0xb2c79d));if(_0xb2c79d[_0xe782('0x20')]){if(_0xb2c79d[_0xe782('0x20')][_0xe782('0x21')]===0x1f4){logger[_0xe782('0x20')](_0xe782('0x1b'),_0x452468,_0xb2c79d[_0xe782('0x20')]['message']);return _0x4e1c25(_0xb2c79d[_0xe782('0x20')][_0xe782('0x22')]);}logger[_0xe782('0x20')]('VoiceContext,\x20%s,\x20%s',_0x452468,_0xb2c79d[_0xe782('0x20')]['message']);return _0xd57d73(_0xb2c79d[_0xe782('0x20')]['message']);}else{logger[_0xe782('0x23')](_0xe782('0x1b'),_0x452468,_0xe782('0x1c'));_0xd57d73(_0xb2c79d['result'][_0xe782('0x22')]);}})[_0xe782('0x24')](function(_0x143c64){logger[_0xe782('0x20')]('VoiceContext,\x20%s,\x20%s',_0x452468,_0x143c64);_0x4e1c25(_0x143c64);});});}function respondWithStatusCode(_0x657761,_0x5787c5){_0x5787c5=_0x5787c5||0xcc;return function(_0x49a47){if(_0x49a47){return _0x657761[_0xe782('0x25')](_0x5787c5);}return _0x657761[_0xe782('0x26')](_0x5787c5)[_0xe782('0x27')]();};}function respondWithResult(_0x382c9c,_0x16bcb6){_0x16bcb6=_0x16bcb6||0xc8;return function(_0x126899){if(_0x126899){return _0x382c9c[_0xe782('0x26')](_0x16bcb6)[_0xe782('0x28')](_0x126899);}};}function respondWithFilteredResult(_0x2fb1c1,_0x477b5d){return function(_0x2e57d2){if(_0x2e57d2){var _0x3e9999=_0x2e57d2[_0xe782('0x29')],_0x2502e9=_0x477b5d[_0xe782('0x2a')],_0x5f45bb=_0x477b5d['offset']+_0x477b5d['limit'],_0x294c37;if(_0x5f45bb>=_0x3e9999){_0x5f45bb=_0x3e9999;_0x294c37=0xc8;}else{_0x294c37=0xce;}_0x2fb1c1[_0xe782('0x26')](_0x294c37);return _0x2fb1c1['set']('Content-Range',_0x2502e9+'-'+_0x5f45bb+'/'+_0x3e9999)[_0xe782('0x28')](_0x2e57d2);}return null;};}function patchUpdates(_0x3e9125){return function(_0x4f0efb){try{jsonpatch[_0xe782('0x2b')](_0x4f0efb,_0x3e9125,!![]);}catch(_0x14bf9c){return BPromise[_0xe782('0x2c')](_0x14bf9c);}return _0x4f0efb[_0xe782('0x2d')]();};}function saveUpdates(_0x1dee67,_0x3d9b57){return function(_0xfa2d2f){if(_0xfa2d2f){return _0xfa2d2f[_0xe782('0x2e')](_0x1dee67)[_0xe782('0x1a')](function(_0x18f608){return _0x18f608;});}return null;};}function removeEntity(_0x453614,_0x422b7b){return function(_0x30d6a5){if(_0x30d6a5){return _0x30d6a5[_0xe782('0x2f')]()[_0xe782('0x1a')](function(){var _0x296742=_0x30d6a5[_0xe782('0x30')]({'plain':!![]});var _0x36bada=_0xe782('0x31');return db[_0xe782('0x32')][_0xe782('0x2f')]({'where':{'type':_0x36bada,'resourceId':_0x296742['id']}})[_0xe782('0x1a')](function(){return _0x30d6a5;});})[_0xe782('0x1a')](function(){_0x453614[_0xe782('0x26')](0xcc)[_0xe782('0x27')]();});}};}function handleEntityNotFound(_0x3fe268,_0x58f06c){return function(_0x414c15){if(!_0x414c15){_0x3fe268[_0xe782('0x25')](0x194);}return _0x414c15;};}function handleError(_0x28b160,_0x16039f){_0x16039f=_0x16039f||0x1f4;return function(_0x5c6770){logger[_0xe782('0x20')](_0x5c6770[_0xe782('0x33')]);if(_0x5c6770[_0xe782('0x34')]){delete _0x5c6770[_0xe782('0x34')];}_0x28b160[_0xe782('0x26')](_0x16039f)[_0xe782('0x35')](_0x5c6770);};}exports[_0xe782('0x36')]=function(_0x30cba7,_0x49f6f9){var _0x1c42b1={},_0x116ac5={},_0x84f771={'count':0x0,'rows':[]};var _0x35f41b=_[_0xe782('0x37')](db[_0xe782('0x38')]['rawAttributes'],function(_0xab8272){return{'name':_0xab8272['fieldName'],'type':_0xab8272[_0xe782('0x39')][_0xe782('0x3a')]};});_0x116ac5[_0xe782('0x3b')]=_['map'](_0x35f41b,'name');_0x116ac5['query']=_['keys'](_0x30cba7[_0xe782('0x3c')]);_0x116ac5[_0xe782('0x3d')]=_[_0xe782('0x3e')](_0x116ac5[_0xe782('0x3b')],_0x116ac5[_0xe782('0x3c')]);_0x1c42b1[_0xe782('0x3f')]=_[_0xe782('0x3e')](_0x116ac5[_0xe782('0x3b')],qs['fields'](_0x30cba7[_0xe782('0x3c')][_0xe782('0x40')]));_0x1c42b1[_0xe782('0x3f')]=_0x1c42b1[_0xe782('0x3f')][_0xe782('0x41')]?_0x1c42b1['attributes']:_0x116ac5[_0xe782('0x3b')];if(!_0x30cba7[_0xe782('0x3c')]['hasOwnProperty'](_0xe782('0x42'))){_0x1c42b1[_0xe782('0x43')]=qs[_0xe782('0x43')](_0x30cba7[_0xe782('0x3c')][_0xe782('0x43')]);_0x1c42b1['offset']=qs['offset'](_0x30cba7[_0xe782('0x3c')][_0xe782('0x2a')]);}_0x1c42b1[_0xe782('0x44')]=qs[_0xe782('0x45')](_0x30cba7[_0xe782('0x3c')][_0xe782('0x45')]);_0x1c42b1[_0xe782('0x46')]=qs[_0xe782('0x3d')](_[_0xe782('0x47')](_0x30cba7['query'],_0x116ac5[_0xe782('0x3d')]),_0x35f41b);if(_0x30cba7[_0xe782('0x3c')][_0xe782('0x48')]){_0x1c42b1['where']=_[_0xe782('0x49')](_0x1c42b1[_0xe782('0x46')],{'$or':_[_0xe782('0x37')](_0x35f41b,function(_0x362a8e){if(_0x362a8e[_0xe782('0x39')]!==_0xe782('0x4a')){var _0xa04d4e={};_0xa04d4e[_0x362a8e['name']]={'$like':'%'+_0x30cba7[_0xe782('0x3c')][_0xe782('0x48')]+'%'};return _0xa04d4e;}})});}_0x1c42b1=_[_0xe782('0x49')]({},_0x1c42b1,_0x30cba7[_0xe782('0x4b')]);var _0x2cf11f={'where':_0x1c42b1[_0xe782('0x46')]};return db[_0xe782('0x38')][_0xe782('0x29')](_0x2cf11f)['then'](function(_0x2d0238){_0x84f771[_0xe782('0x29')]=_0x2d0238;if(_0x30cba7[_0xe782('0x3c')][_0xe782('0x4c')]){_0x1c42b1[_0xe782('0x4d')]=[{'all':!![]}];}return db[_0xe782('0x38')][_0xe782('0x4e')](_0x1c42b1);})[_0xe782('0x1a')](function(_0x455186){_0x84f771[_0xe782('0x4f')]=_0x455186;return _0x84f771;})[_0xe782('0x1a')](respondWithFilteredResult(_0x49f6f9,_0x1c42b1))[_0xe782('0x24')](handleError(_0x49f6f9,null));};exports[_0xe782('0x50')]=function(_0x50fbd2,_0x368ff8){var _0x42d9d9={'raw':![],'where':{'id':_0x50fbd2['params']['id']}},_0x181ed5={};_0x181ed5['model']=_['keys'](db['VoiceContext'][_0xe782('0x51')]);_0x181ed5[_0xe782('0x3c')]=_[_0xe782('0x52')](_0x50fbd2[_0xe782('0x3c')]);_0x181ed5['filters']=_[_0xe782('0x3e')](_0x181ed5[_0xe782('0x3b')],_0x181ed5['query']);_0x42d9d9[_0xe782('0x3f')]=_[_0xe782('0x3e')](_0x181ed5['model'],qs[_0xe782('0x40')](_0x50fbd2[_0xe782('0x3c')][_0xe782('0x40')]));_0x42d9d9[_0xe782('0x3f')]=_0x42d9d9[_0xe782('0x3f')][_0xe782('0x41')]?_0x42d9d9['attributes']:_0x181ed5[_0xe782('0x3b')];if(_0x50fbd2[_0xe782('0x3c')]['includeAll']){_0x42d9d9[_0xe782('0x4d')]=[{'all':!![]}];}_0x42d9d9=_[_0xe782('0x49')]({},_0x42d9d9,_0x50fbd2[_0xe782('0x4b')]);return db['VoiceContext']['find'](_0x42d9d9)[_0xe782('0x1a')](handleEntityNotFound(_0x368ff8,null))['then'](respondWithResult(_0x368ff8,null))['catch'](handleError(_0x368ff8,null));};exports[_0xe782('0x53')]=function(_0x3e0892,_0x4a5866,_0x509303){var _0x1f9c5a;return db[_0xe782('0x38')][_0xe782('0x53')](_0x3e0892[_0xe782('0x54')],{'raw':!![]})[_0xe782('0x1a')](function(_0x10c9bd){_0x1f9c5a=_0x10c9bd;return db[_0xe782('0x38')][_0xe782('0x4e')]({'raw':!![]});})[_0xe782('0x1a')](function(_0x5008ee){var _0x224484=fs[_0xe782('0x55')](path[_0xe782('0x56')](config[_0xe782('0x57')],'server/files/templates/context.ejs'),_0xe782('0x58'));var _0x5c16e0=ejs['render'](_0x224484,{'contexts':_0x5008ee||[]});fs[_0xe782('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5c16e0);})[_0xe782('0x1a')](function(){return respondWithRpcPromise(_0xe782('0x5a'),_0xe782('0x53'),{'module':_0xe782('0x5b')});})['then'](function(){var _0x2a3a5e=_0x3e0892[_0xe782('0x5c')]['get']({'plain':!![]});if(!_0x2a3a5e)throw new Error(_0xe782('0x5d'));if(_0x2a3a5e['role']===_0xe782('0x5c')){var _0x1296fa=_0x1f9c5a[_0xe782('0x30')]({'plain':!![]});return db[_0xe782('0x5e')][_0xe782('0x5f')]({'where':{'name':_0xe782('0x31'),'userProfileId':_0x2a3a5e[_0xe782('0x60')]},'raw':!![]})[_0xe782('0x1a')](function(_0xb8aa8a){if(_0xb8aa8a&&_0xb8aa8a[_0xe782('0x61')]===0x0){return db[_0xe782('0x32')][_0xe782('0x53')]({'name':_0x1296fa[_0xe782('0x34')],'resourceId':_0x1296fa['id'],'type':_0xb8aa8a[_0xe782('0x34')],'sectionId':_0xb8aa8a['id']},{})[_0xe782('0x1a')](function(){return _0x1f9c5a;});}else{return _0x1f9c5a;}})[_0xe782('0x24')](function(_0x283e94){logger[_0xe782('0x20')](_0xe782('0x62'),_0x283e94);throw _0x283e94;});}return _0x1f9c5a;})['then'](respondWithResult(_0x4a5866,0xc9))[_0xe782('0x24')](handleError(_0x4a5866,null));};exports[_0xe782('0x2e')]=function(_0x15325f,_0x3678d4,_0x4ba1d4){var _0x4f2931;return db['VoiceContext'][_0xe782('0x5f')]({'where':{'id':_0x15325f[_0xe782('0x63')]['id']}})[_0xe782('0x1a')](handleEntityNotFound(_0x3678d4,null))[_0xe782('0x1a')](saveUpdates(_0x15325f[_0xe782('0x54')],null))[_0xe782('0x1a')](function(_0xc6fdc4){if(_0xc6fdc4){_0x4f2931=_0xc6fdc4;return db[_0xe782('0x38')][_0xe782('0x4e')]({'raw':!![]});}})[_0xe782('0x1a')](function(_0x448ebb){var _0x4a20a2=fs[_0xe782('0x55')](path[_0xe782('0x56')](config[_0xe782('0x57')],'server/files/templates/context.ejs'),_0xe782('0x58'));var _0xab2133=ejs['render'](_0x4a20a2,{'contexts':_0x448ebb||[]});fs[_0xe782('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xab2133);})['then'](function(){return respondWithRpcPromise('Reload',_0xe782('0x2e'),{'module':'chan_sip.so'});})[_0xe782('0x1a')](function(){return _0x4f2931;})['then'](respondWithResult(_0x3678d4,null))[_0xe782('0x24')](handleError(_0x3678d4,null));};exports[_0xe782('0x2f')]=function(_0x483640,_0x725020,_0x5dd34a){var _0x189132;return db[_0xe782('0x38')][_0xe782('0x5f')]({'where':{'id':_0x483640[_0xe782('0x63')]['id']}})[_0xe782('0x1a')](handleEntityNotFound(_0x725020,null))[_0xe782('0x1a')](removeEntity(_0x725020,null))[_0xe782('0x1a')](function(){return db[_0xe782('0x38')][_0xe782('0x4e')]({'raw':!![]});})[_0xe782('0x1a')](function(_0x129a12){var _0x1e9fe3=fs[_0xe782('0x55')](path[_0xe782('0x56')](config[_0xe782('0x57')],_0xe782('0x64')),_0xe782('0x58'));var _0x52bb3c=ejs[_0xe782('0x65')](_0x1e9fe3,{'contexts':_0x129a12});fs[_0xe782('0x59')](_0xe782('0x66'),_0x52bb3c);return respondWithRpcPromise('Reload',_0xe782('0x2f'),{'module':'chan_sip.so'});})[_0xe782('0x24')](handleError(_0x725020,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 44873e7..357bcb6 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 _0xfa8c=['request-promise','path','rimraf','../../config/environment','exports','define','voice_contexts','util','../../config/logger','api','bluebird'];(function(_0xe90990,_0x539ad6){var _0x3d7171=function(_0x40a100){while(--_0x40a100){_0xe90990['push'](_0xe90990['shift']());}};_0x3d7171(++_0x539ad6);}(_0xfa8c,0x172));var _0xcfa8=function(_0x5bd813,_0x1983d5){_0x5bd813=_0x5bd813-0x0;var _0x5b5853=_0xfa8c[_0x5bd813];return _0x5b5853;};'use strict';var _=require('lodash');var util=require(_0xcfa8('0x0'));var logger=require(_0xcfa8('0x1'))(_0xcfa8('0x2'));var moment=require('moment');var BPromise=require(_0xcfa8('0x3'));var rp=require(_0xcfa8('0x4'));var fs=require('fs');var path=require(_0xcfa8('0x5'));var rimraf=require(_0xcfa8('0x6'));var config=require(_0xcfa8('0x7'));var attributes=require('./voiceContext.attributes');module[_0xcfa8('0x8')]=function(_0x48662f,_0x5b2272){return _0x48662f[_0xcfa8('0x9')]('VoiceContext',attributes,{'tableName':_0xcfa8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8aad=['path','../../config/environment','./voiceContext.attributes','define','VoiceContext','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf64e5,_0x4a3232){var _0x5f312c=function(_0x4d816c){while(--_0x4d816c){_0xf64e5['push'](_0xf64e5['shift']());}};_0x5f312c(++_0x4a3232);}(_0x8aad,0x155));var _0xd8aa=function(_0x4ba103,_0x52e432){_0x4ba103=_0x4ba103-0x0;var _0x53a9e5=_0x8aad[_0x4ba103];return _0x53a9e5;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var logger=require(_0xd8aa('0x2'))(_0xd8aa('0x3'));var moment=require(_0xd8aa('0x4'));var BPromise=require(_0xd8aa('0x5'));var rp=require(_0xd8aa('0x6'));var fs=require('fs');var path=require(_0xd8aa('0x7'));var rimraf=require('rimraf');var config=require(_0xd8aa('0x8'));var attributes=require(_0xd8aa('0x9'));module['exports']=function(_0x19c83a,_0x219a2e){return _0x19c83a[_0xd8aa('0xa')](_0xd8aa('0xb'),attributes,{'tableName':'voice_contexts','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 eac8588..99a0581 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 _0x5305=['randomstring','../../config/utils','../../config/logger','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment'];(function(_0x5133c2,_0x49fa51){var _0x55b197=function(_0x59b2c8){while(--_0x59b2c8){_0x5133c2['push'](_0x5133c2['shift']());}};_0x55b197(++_0x49fa51);}(_0x5305,0x9e));var _0x5530=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5305[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x5530('0x0'));var moment=require(_0x5530('0x1'));var BPromise=require('bluebird');var rs=require(_0x5530('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5530('0x3'));var logger=require(_0x5530('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5530('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x376977,_0x3c8e43,_0x1fcd0a){return new BPromise(function(_0x382810,_0x2db166){return client[_0x5530('0x6')](_0x376977,_0x1fcd0a)[_0x5530('0x7')](function(_0x5a75ac){logger[_0x5530('0x8')](_0x5530('0x9'),_0x3c8e43,_0x5530('0xa'));logger[_0x5530('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3c8e43,_0x5530('0xa'),JSON[_0x5530('0xc')](_0x5a75ac));if(_0x5a75ac[_0x5530('0xd')]){if(_0x5a75ac[_0x5530('0xd')]['code']===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3c8e43,_0x5a75ac[_0x5530('0xd')]['message']);return _0x2db166(_0x5a75ac['error'][_0x5530('0xe')]);}logger[_0x5530('0xd')](_0x5530('0x9'),_0x3c8e43,_0x5a75ac[_0x5530('0xd')][_0x5530('0xe')]);return _0x382810(_0x5a75ac['error'][_0x5530('0xe')]);}else{logger[_0x5530('0x8')](_0x5530('0x9'),_0x3c8e43,_0x5530('0xa'));_0x382810(_0x5a75ac['result'][_0x5530('0xe')]);}})[_0x5530('0xf')](function(_0x49ee6e){logger[_0x5530('0xd')](_0x5530('0x9'),_0x3c8e43,_0x49ee6e);_0x2db166(_0x49ee6e);});});} \ No newline at end of file +var _0xa786=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xa786,0x1f1));var _0x6a78=function(_0x245d3b,_0x40738d){_0x245d3b=_0x245d3b-0x0;var _0x498686=_0xa786[_0x245d3b];return _0x498686;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var moment=require(_0x6a78('0x2'));var BPromise=require(_0x6a78('0x3'));var rs=require(_0x6a78('0x4'));var fs=require('fs');var Redis=require(_0x6a78('0x5'));var db=require(_0x6a78('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a78('0x7'))(_0x6a78('0x8'));var config=require(_0x6a78('0x9'));var jayson=require(_0x6a78('0xa'));var client=jayson['client'][_0x6a78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34deae,_0x3df8b4,_0x55482c){return new BPromise(function(_0x58d2bc,_0x489b26){return client[_0x6a78('0xc')](_0x34deae,_0x55482c)['then'](function(_0x5e3e6b){logger[_0x6a78('0xd')](_0x6a78('0xe'),_0x3df8b4,_0x6a78('0xf'));logger[_0x6a78('0x10')](_0x6a78('0x11'),_0x3df8b4,'request\x20sent',JSON['stringify'](_0x5e3e6b));if(_0x5e3e6b[_0x6a78('0x12')]){if(_0x5e3e6b[_0x6a78('0x12')]['code']===0x1f4){logger[_0x6a78('0x12')](_0x6a78('0xe'),_0x3df8b4,_0x5e3e6b[_0x6a78('0x12')][_0x6a78('0x13')]);return _0x489b26(_0x5e3e6b[_0x6a78('0x12')]['message']);}logger[_0x6a78('0x12')](_0x6a78('0xe'),_0x3df8b4,_0x5e3e6b['error'][_0x6a78('0x13')]);return _0x58d2bc(_0x5e3e6b[_0x6a78('0x12')][_0x6a78('0x13')]);}else{logger[_0x6a78('0xd')](_0x6a78('0xe'),_0x3df8b4,_0x6a78('0xf'));_0x58d2bc(_0x5e3e6b[_0x6a78('0x14')][_0x6a78('0x13')]);}})['catch'](function(_0x3f9482){logger[_0x6a78('0x12')](_0x6a78('0xe'),_0x3df8b4,_0x3f9482);_0x489b26(_0x3f9482);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c011e9e..685ccb6 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 _0xba51=['post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','/describe','describe','get','show'];(function(_0x27fa76,_0x3096fe){var _0x61f2f4=function(_0x113e58){while(--_0x113e58){_0x27fa76['push'](_0x27fa76['shift']());}};_0x61f2f4(++_0x3096fe);}(_0xba51,0x75));var _0x1ba5=function(_0x4d86e7,_0x22c92b){_0x4d86e7=_0x4d86e7-0x0;var _0x1464ac=_0xba51[_0x4d86e7];return _0x1464ac;};'use strict';var multer=require(_0x1ba5('0x0'));var util=require(_0x1ba5('0x1'));var path=require(_0x1ba5('0x2'));var timeout=require(_0x1ba5('0x3'));var express=require(_0x1ba5('0x4'));var router=express['Router']();var auth=require(_0x1ba5('0x5'));var interaction=require(_0x1ba5('0x6'));var config=require(_0x1ba5('0x7'));var controller=require(_0x1ba5('0x8'));router['get']('/',auth[_0x1ba5('0x9')](),controller[_0x1ba5('0xa')]);router['get'](_0x1ba5('0xb'),auth[_0x1ba5('0x9')](),controller[_0x1ba5('0xc')]);router[_0x1ba5('0xd')]('/:id',auth[_0x1ba5('0x9')](),controller[_0x1ba5('0xe')]);router[_0x1ba5('0xf')]('/',auth[_0x1ba5('0x9')](),controller[_0x1ba5('0x10')]);router['put'](_0x1ba5('0x11'),auth[_0x1ba5('0x9')](),controller[_0x1ba5('0x12')]);router[_0x1ba5('0x13')](_0x1ba5('0x11'),auth[_0x1ba5('0x9')](),controller[_0x1ba5('0x14')]);module[_0x1ba5('0x15')]=router; \ No newline at end of file +var _0x28a2=['Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x28a2,0x1e9));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x228a('0x0'));var util=require(_0x228a('0x1'));var path=require(_0x228a('0x2'));var timeout=require(_0x228a('0x3'));var express=require(_0x228a('0x4'));var router=express[_0x228a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x228a('0x6'));var config=require(_0x228a('0x7'));var controller=require(_0x228a('0x8'));router[_0x228a('0x9')]('/',auth[_0x228a('0xa')](),controller[_0x228a('0xb')]);router[_0x228a('0x9')](_0x228a('0xc'),auth[_0x228a('0xa')](),controller['describe']);router[_0x228a('0x9')](_0x228a('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x228a('0xe')]);router['put'](_0x228a('0xd'),auth['isAuthenticated'](),controller[_0x228a('0xf')]);router[_0x228a('0x10')](_0x228a('0xd'),auth['isAuthenticated'](),controller[_0x228a('0x11')]);module[_0x228a('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 7577b5d..ac680a1 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 _0xb50d=['DATE','called,connect,complete','STRING','INTEGER'];(function(_0x2734b5,_0x48aa84){var _0x149e28=function(_0x47f6d3){while(--_0x47f6d3){_0x2734b5['push'](_0x2734b5['shift']());}};_0x149e28(++_0x48aa84);}(_0xb50d,0x7e));var _0xdb50=function(_0x5d25bd,_0x2f3c44){_0x5d25bd=_0x5d25bd-0x0;var _0x24d31c=_0xb50d[_0x5d25bd];return _0x24d31c;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0xdb50('0x0')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xdb50('0x1')]},'channelstatedesc':{'type':Sequelize[_0xdb50('0x0')]},'calleridnum':{'type':Sequelize[_0xdb50('0x0')]},'calleridname':{'type':Sequelize[_0xdb50('0x0')]},'connectedlinenum':{'type':Sequelize[_0xdb50('0x0')]},'connectedlinename':{'type':Sequelize[_0xdb50('0x0')]},'language':{'type':Sequelize[_0xdb50('0x0')]},'accountcode':{'type':Sequelize[_0xdb50('0x0')]},'context':{'type':Sequelize[_0xdb50('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xdb50('0x1')]},'uniqueid':{'type':Sequelize[_0xdb50('0x0')]},'linkedid':{'type':Sequelize[_0xdb50('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xdb50('0x1')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xdb50('0x0')]},'destcalleridname':{'type':Sequelize[_0xdb50('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0xdb50('0x0')]},'destconnectedlinename':{'type':Sequelize[_0xdb50('0x0')]},'destlanguage':{'type':Sequelize[_0xdb50('0x0')]},'destaccountcode':{'type':Sequelize[_0xdb50('0x0')]},'destcontext':{'type':Sequelize[_0xdb50('0x0')]},'destexten':{'type':Sequelize[_0xdb50('0x0')]},'destpriority':{'type':Sequelize[_0xdb50('0x1')]},'destuniqueid':{'type':Sequelize[_0xdb50('0x0')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xdb50('0x0')]},'dialstatus':{'type':Sequelize[_0xdb50('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xdb50('0x2')]},'lastevent':{'type':Sequelize[_0xdb50('0x0')],'comment':_0xdb50('0x3')},'routeId':{'type':Sequelize[_0xdb50('0x1')]},'duration':{'type':Sequelize[_0xdb50('0x1')]},'holdtime':{'type':Sequelize[_0xdb50('0x1')]},'billableseconds':{'type':Sequelize[_0xdb50('0x1')]}}; \ No newline at end of file +var _0x59de=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0x59de,0x106));var _0xe59d=function(_0x56dbc3,_0x41c87a){_0x56dbc3=_0x56dbc3-0x0;var _0x58cf7f=_0x59de[_0x56dbc3];return _0x58cf7f;};'use strict';var Sequelize=require('sequelize');module[_0xe59d('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe59d('0x1')]},'channelstate':{'type':Sequelize[_0xe59d('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe59d('0x1')]},'calleridname':{'type':Sequelize[_0xe59d('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe59d('0x1')]},'connectedlinename':{'type':Sequelize[_0xe59d('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe59d('0x1')]},'context':{'type':Sequelize[_0xe59d('0x1')]},'exten':{'type':Sequelize[_0xe59d('0x1')]},'priority':{'type':Sequelize[_0xe59d('0x2')]},'uniqueid':{'type':Sequelize[_0xe59d('0x1')]},'linkedid':{'type':Sequelize[_0xe59d('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe59d('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe59d('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe59d('0x1')]},'destcalleridname':{'type':Sequelize[_0xe59d('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xe59d('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe59d('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe59d('0x2')]},'destuniqueid':{'type':Sequelize[_0xe59d('0x1')]},'destlinkedid':{'type':Sequelize[_0xe59d('0x1')]},'dialstring':{'type':Sequelize[_0xe59d('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe59d('0x3')]},'answertime':{'type':Sequelize[_0xe59d('0x3')]},'endtime':{'type':Sequelize[_0xe59d('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xe59d('0x4')},'routeId':{'type':Sequelize[_0xe59d('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xe59d('0x2')]},'billableseconds':{'type':Sequelize[_0xe59d('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 5b2f11c..e2843b2 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 _0x8e12=['include','findAll','catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8e12,0x9c));var _0x28e1=function(_0x78909a,_0x3e2210){_0x78909a=_0x78909a-0x0;var _0x32ad61=_0x8e12[_0x78909a];return _0x32ad61;};'use strict';var pdf=require(_0x28e1('0x0'));var emlformat=require(_0x28e1('0x1'));var rimraf=require(_0x28e1('0x2'));var zipdir=require(_0x28e1('0x3'));var jsonpatch=require(_0x28e1('0x4'));var rp=require(_0x28e1('0x5'));var moment=require(_0x28e1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x28e1('0x7'));var util=require(_0x28e1('0x8'));var path=require('path');var sox=require(_0x28e1('0x9'));var csv=require(_0x28e1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x28e1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x28e1('0xa'));var querystring=require('querystring');var Papa=require(_0x28e1('0xc'));var Redis=require('ioredis');var authService=require(_0x28e1('0xd'));var qs=require(_0x28e1('0xe'));var as=require(_0x28e1('0xf'));var hardwareService=require(_0x28e1('0x10'));var logger=require(_0x28e1('0x11'))('api');var utils=require(_0x28e1('0x12'));var config=require(_0x28e1('0x13'));var licenseUtil=require(_0x28e1('0x14'));var db=require(_0x28e1('0x15'))['db'];function respondWithStatusCode(_0x425f73,_0x1ce5cd){_0x1ce5cd=_0x1ce5cd||0xcc;return function(_0xb2bc8d){if(_0xb2bc8d){return _0x425f73[_0x28e1('0x16')](_0x1ce5cd);}return _0x425f73[_0x28e1('0x17')](_0x1ce5cd)[_0x28e1('0x18')]();};}function respondWithResult(_0x144ed8,_0x3c1597){_0x3c1597=_0x3c1597||0xc8;return function(_0x3165cb){if(_0x3165cb){return _0x144ed8['status'](_0x3c1597)[_0x28e1('0x19')](_0x3165cb);}};}function respondWithFilteredResult(_0x10b140,_0x1c980c){return function(_0x24243d){if(_0x24243d){var _0x17a260=_0x24243d[_0x28e1('0x1a')],_0x540b4c=_0x1c980c[_0x28e1('0x1b')],_0x485614=_0x1c980c[_0x28e1('0x1b')]+_0x1c980c[_0x28e1('0x1c')],_0x30085e;if(_0x485614>=_0x17a260){_0x485614=_0x17a260;_0x30085e=0xc8;}else{_0x30085e=0xce;}_0x10b140[_0x28e1('0x17')](_0x30085e);return _0x10b140[_0x28e1('0x1d')](_0x28e1('0x1e'),_0x540b4c+'-'+_0x485614+'/'+_0x17a260)['json'](_0x24243d);}return null;};}function patchUpdates(_0x15e623){return function(_0x2c4d5d){try{jsonpatch[_0x28e1('0x1f')](_0x2c4d5d,_0x15e623,!![]);}catch(_0x2f0223){return BPromise['reject'](_0x2f0223);}return _0x2c4d5d[_0x28e1('0x20')]();};}function saveUpdates(_0x5c8f90,_0xe10d09){return function(_0x59cf31){if(_0x59cf31){return _0x59cf31[_0x28e1('0x21')](_0x5c8f90)['then'](function(_0x27035a){return _0x27035a;});}return null;};}function removeEntity(_0x485c89,_0x5f26cb){return function(_0x43821f){if(_0x43821f){return _0x43821f[_0x28e1('0x22')]()[_0x28e1('0x23')](function(){_0x485c89[_0x28e1('0x17')](0xcc)[_0x28e1('0x18')]();});}};}function handleEntityNotFound(_0x48631f,_0x5412bd){return function(_0x1f940c){if(!_0x1f940c){_0x48631f[_0x28e1('0x16')](0x194);}return _0x1f940c;};}function handleError(_0x30e5fb,_0x4b99b0){_0x4b99b0=_0x4b99b0||0x1f4;return function(_0x279173){logger[_0x28e1('0x24')](_0x279173[_0x28e1('0x25')]);if(_0x279173[_0x28e1('0x26')]){delete _0x279173[_0x28e1('0x26')];}_0x30e5fb[_0x28e1('0x17')](_0x4b99b0)[_0x28e1('0x27')](_0x279173);};}exports[_0x28e1('0x28')]=function(_0x172d4b,_0x355c3a){var _0x490b49={},_0x3af378={},_0x483a3d={'count':0x0,'rows':[]};var _0x4beb78=_[_0x28e1('0x29')](db[_0x28e1('0x2a')][_0x28e1('0x2b')],function(_0x29d8a9){return{'name':_0x29d8a9[_0x28e1('0x2c')],'type':_0x29d8a9[_0x28e1('0x2d')][_0x28e1('0x2e')]};});_0x3af378[_0x28e1('0x2f')]=_['map'](_0x4beb78,_0x28e1('0x26'));_0x3af378[_0x28e1('0x30')]=_['keys'](_0x172d4b[_0x28e1('0x30')]);_0x3af378['filters']=_[_0x28e1('0x31')](_0x3af378['model'],_0x3af378[_0x28e1('0x30')]);_0x490b49[_0x28e1('0x32')]=_[_0x28e1('0x31')](_0x3af378[_0x28e1('0x2f')],qs[_0x28e1('0x33')](_0x172d4b[_0x28e1('0x30')]['fields']));_0x490b49[_0x28e1('0x32')]=_0x490b49[_0x28e1('0x32')][_0x28e1('0x34')]?_0x490b49[_0x28e1('0x32')]:_0x3af378['model'];if(!_0x172d4b['query']['hasOwnProperty'](_0x28e1('0x35'))){_0x490b49[_0x28e1('0x1c')]=qs[_0x28e1('0x1c')](_0x172d4b[_0x28e1('0x30')][_0x28e1('0x1c')]);_0x490b49['offset']=qs['offset'](_0x172d4b[_0x28e1('0x30')][_0x28e1('0x1b')]);}_0x490b49[_0x28e1('0x36')]=qs[_0x28e1('0x37')](_0x172d4b[_0x28e1('0x30')]['sort']);_0x490b49[_0x28e1('0x38')]=qs[_0x28e1('0x39')](_[_0x28e1('0x3a')](_0x172d4b[_0x28e1('0x30')],_0x3af378['filters']),_0x4beb78);if(_0x172d4b[_0x28e1('0x30')][_0x28e1('0x3b')]){_0x490b49[_0x28e1('0x38')]=_[_0x28e1('0x3c')](_0x490b49[_0x28e1('0x38')],{'$or':_['map'](_0x4beb78,function(_0x57377b){if(_0x57377b[_0x28e1('0x2d')]!=='VIRTUAL'){var _0x3c97e6={};_0x3c97e6[_0x57377b[_0x28e1('0x26')]]={'$like':'%'+_0x172d4b['query'][_0x28e1('0x3b')]+'%'};return _0x3c97e6;}})});}_0x490b49=_[_0x28e1('0x3c')]({},_0x490b49,_0x172d4b[_0x28e1('0x3d')]);var _0x1d2984={'where':_0x490b49[_0x28e1('0x38')]};return db['VoiceDialReport']['count'](_0x1d2984)[_0x28e1('0x23')](function(_0x486a67){_0x483a3d[_0x28e1('0x1a')]=_0x486a67;if(_0x172d4b[_0x28e1('0x30')][_0x28e1('0x3e')]){_0x490b49[_0x28e1('0x3f')]=[{'all':!![]}];}return db[_0x28e1('0x2a')][_0x28e1('0x40')](_0x490b49);})[_0x28e1('0x23')](function(_0x21ea3e){_0x483a3d['rows']=_0x21ea3e;return _0x483a3d;})[_0x28e1('0x23')](respondWithFilteredResult(_0x355c3a,_0x490b49))[_0x28e1('0x41')](handleError(_0x355c3a,null));};exports[_0x28e1('0x42')]=function(_0x276a8d,_0x316f0e){var _0x23be19={'raw':!![],'where':{'id':_0x276a8d[_0x28e1('0x43')]['id']}},_0x1a6b79={};_0x1a6b79[_0x28e1('0x2f')]=_[_0x28e1('0x44')](db['VoiceDialReport'][_0x28e1('0x2b')]);_0x1a6b79[_0x28e1('0x30')]=_[_0x28e1('0x44')](_0x276a8d[_0x28e1('0x30')]);_0x1a6b79[_0x28e1('0x39')]=_[_0x28e1('0x31')](_0x1a6b79[_0x28e1('0x2f')],_0x1a6b79[_0x28e1('0x30')]);_0x23be19['attributes']=_[_0x28e1('0x31')](_0x1a6b79[_0x28e1('0x2f')],qs['fields'](_0x276a8d[_0x28e1('0x30')][_0x28e1('0x33')]));_0x23be19[_0x28e1('0x32')]=_0x23be19[_0x28e1('0x32')]['length']?_0x23be19['attributes']:_0x1a6b79[_0x28e1('0x2f')];if(_0x276a8d['query'][_0x28e1('0x3e')]){_0x23be19['include']=[{'all':!![]}];}_0x23be19=_[_0x28e1('0x3c')]({},_0x23be19,_0x276a8d[_0x28e1('0x3d')]);return db[_0x28e1('0x2a')][_0x28e1('0x45')](_0x23be19)[_0x28e1('0x23')](handleEntityNotFound(_0x316f0e,null))['then'](respondWithResult(_0x316f0e,null))[_0x28e1('0x41')](handleError(_0x316f0e,null));};exports[_0x28e1('0x46')]=function(_0x532f6e,_0x14bc8e){return db[_0x28e1('0x2a')][_0x28e1('0x46')](_0x532f6e[_0x28e1('0x47')],{})[_0x28e1('0x23')](respondWithResult(_0x14bc8e,0xc9))[_0x28e1('0x41')](handleError(_0x14bc8e,null));};exports[_0x28e1('0x21')]=function(_0x202a0f,_0x9e7b6c){if(_0x202a0f[_0x28e1('0x47')]['id']){delete _0x202a0f[_0x28e1('0x47')]['id'];}return db['VoiceDialReport'][_0x28e1('0x45')]({'where':{'id':_0x202a0f[_0x28e1('0x43')]['id']}})[_0x28e1('0x23')](handleEntityNotFound(_0x9e7b6c,null))[_0x28e1('0x23')](saveUpdates(_0x202a0f[_0x28e1('0x47')],null))['then'](respondWithResult(_0x9e7b6c,null))['catch'](handleError(_0x9e7b6c,null));};exports[_0x28e1('0x22')]=function(_0x49dc5a,_0x56bf5f){return db[_0x28e1('0x2a')][_0x28e1('0x45')]({'where':{'id':_0x49dc5a[_0x28e1('0x43')]['id']}})[_0x28e1('0x23')](handleEntityNotFound(_0x56bf5f,null))['then'](removeEntity(_0x56bf5f,null))[_0x28e1('0x41')](handleError(_0x56bf5f,null));};exports[_0x28e1('0x48')]=function(_0x1db393,_0x265180){return db['VoiceDialReport'][_0x28e1('0x48')]()[_0x28e1('0x23')](respondWithResult(_0x265180,null))[_0x28e1('0x41')](handleError(_0x265180,null));}; \ No newline at end of file +var _0x111d=['json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','type','model','keys','query','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','VoiceDialReport','include','findAll','rows','catch','params','intersection','length','includeAll','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0xa084e5,_0x587617){var _0x71a4c0=function(_0x424c81){while(--_0x424c81){_0xa084e5['push'](_0xa084e5['shift']());}};_0x71a4c0(++_0x587617);}(_0x111d,0xb7));var _0xd111=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x111d[_0x28947d];return _0x12d2ee;};'use strict';var pdf=require(_0xd111('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd111('0x1'));var zipdir=require(_0xd111('0x2'));var jsonpatch=require(_0xd111('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd111('0x4'));var Mustache=require('mustache');var util=require(_0xd111('0x5'));var path=require(_0xd111('0x6'));var sox=require(_0xd111('0x7'));var csv=require(_0xd111('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd111('0x9'));var squel=require(_0xd111('0xa'));var crypto=require(_0xd111('0xb'));var jsforce=require(_0xd111('0xc'));var deskjs=require(_0xd111('0xd'));var toCsv=require(_0xd111('0x8'));var querystring=require(_0xd111('0xe'));var Papa=require('papaparse');var Redis=require(_0xd111('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd111('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd111('0x11'));var logger=require('../../config/logger')(_0xd111('0x12'));var utils=require('../../config/utils');var config=require(_0xd111('0x13'));var licenseUtil=require(_0xd111('0x14'));var db=require(_0xd111('0x15'))['db'];function respondWithStatusCode(_0x44053e,_0x4ac407){_0x4ac407=_0x4ac407||0xcc;return function(_0x373ee6){if(_0x373ee6){return _0x44053e[_0xd111('0x16')](_0x4ac407);}return _0x44053e[_0xd111('0x17')](_0x4ac407)['end']();};}function respondWithResult(_0x23ec15,_0x28dfbe){_0x28dfbe=_0x28dfbe||0xc8;return function(_0x3dd0b8){if(_0x3dd0b8){return _0x23ec15[_0xd111('0x17')](_0x28dfbe)[_0xd111('0x18')](_0x3dd0b8);}};}function respondWithFilteredResult(_0x143ea8,_0x5b2ef0){return function(_0x192967){if(_0x192967){var _0x4fdc99=_0x192967[_0xd111('0x19')],_0x463d9e=_0x5b2ef0[_0xd111('0x1a')],_0x15c685=_0x5b2ef0[_0xd111('0x1a')]+_0x5b2ef0[_0xd111('0x1b')],_0x41ecaf;if(_0x15c685>=_0x4fdc99){_0x15c685=_0x4fdc99;_0x41ecaf=0xc8;}else{_0x41ecaf=0xce;}_0x143ea8[_0xd111('0x17')](_0x41ecaf);return _0x143ea8[_0xd111('0x1c')](_0xd111('0x1d'),_0x463d9e+'-'+_0x15c685+'/'+_0x4fdc99)[_0xd111('0x18')](_0x192967);}return null;};}function patchUpdates(_0x286b96){return function(_0x5db5bb){try{jsonpatch[_0xd111('0x1e')](_0x5db5bb,_0x286b96,!![]);}catch(_0x45b132){return BPromise['reject'](_0x45b132);}return _0x5db5bb[_0xd111('0x1f')]();};}function saveUpdates(_0x55c431,_0x5c62af){return function(_0x36e6e0){if(_0x36e6e0){return _0x36e6e0[_0xd111('0x20')](_0x55c431)[_0xd111('0x21')](function(_0x22af85){return _0x22af85;});}return null;};}function removeEntity(_0xfc31cf,_0x321e2d){return function(_0x261f37){if(_0x261f37){return _0x261f37[_0xd111('0x22')]()['then'](function(){_0xfc31cf[_0xd111('0x17')](0xcc)[_0xd111('0x23')]();});}};}function handleEntityNotFound(_0x5c0b41,_0x68c10b){return function(_0x13eb78){if(!_0x13eb78){_0x5c0b41['sendStatus'](0x194);}return _0x13eb78;};}function handleError(_0x4ae8f9,_0x2386ff){_0x2386ff=_0x2386ff||0x1f4;return function(_0x4fda78){logger[_0xd111('0x24')](_0x4fda78[_0xd111('0x25')]);if(_0x4fda78[_0xd111('0x26')]){delete _0x4fda78[_0xd111('0x26')];}_0x4ae8f9[_0xd111('0x17')](_0x2386ff)['send'](_0x4fda78);};}exports[_0xd111('0x27')]=function(_0x14619d,_0x2f24ec){var _0x412f00={},_0x3c5884={},_0x385c07={'count':0x0,'rows':[]};var _0x4c8f84=_[_0xd111('0x28')](db['VoiceDialReport'][_0xd111('0x29')],function(_0x5364d0){return{'name':_0x5364d0['fieldName'],'type':_0x5364d0[_0xd111('0x2a')]['key']};});_0x3c5884[_0xd111('0x2b')]=_[_0xd111('0x28')](_0x4c8f84,_0xd111('0x26'));_0x3c5884['query']=_[_0xd111('0x2c')](_0x14619d[_0xd111('0x2d')]);_0x3c5884['filters']=_['intersection'](_0x3c5884[_0xd111('0x2b')],_0x3c5884[_0xd111('0x2d')]);_0x412f00[_0xd111('0x2e')]=_['intersection'](_0x3c5884['model'],qs[_0xd111('0x2f')](_0x14619d[_0xd111('0x2d')]['fields']));_0x412f00[_0xd111('0x2e')]=_0x412f00['attributes']['length']?_0x412f00['attributes']:_0x3c5884[_0xd111('0x2b')];if(!_0x14619d[_0xd111('0x2d')][_0xd111('0x30')]('nolimit')){_0x412f00[_0xd111('0x1b')]=qs['limit'](_0x14619d['query'][_0xd111('0x1b')]);_0x412f00[_0xd111('0x1a')]=qs[_0xd111('0x1a')](_0x14619d[_0xd111('0x2d')]['offset']);}_0x412f00[_0xd111('0x31')]=qs['sort'](_0x14619d[_0xd111('0x2d')][_0xd111('0x32')]);_0x412f00[_0xd111('0x33')]=qs[_0xd111('0x34')](_[_0xd111('0x35')](_0x14619d['query'],_0x3c5884[_0xd111('0x34')]),_0x4c8f84);if(_0x14619d[_0xd111('0x2d')][_0xd111('0x36')]){_0x412f00['where']=_[_0xd111('0x37')](_0x412f00[_0xd111('0x33')],{'$or':_['map'](_0x4c8f84,function(_0x437609){if(_0x437609['type']!==_0xd111('0x38')){var _0x15b72a={};_0x15b72a[_0x437609[_0xd111('0x26')]]={'$like':'%'+_0x14619d[_0xd111('0x2d')][_0xd111('0x36')]+'%'};return _0x15b72a;}})});}_0x412f00=_[_0xd111('0x37')]({},_0x412f00,_0x14619d['options']);var _0x901805={'where':_0x412f00[_0xd111('0x33')]};return db[_0xd111('0x39')][_0xd111('0x19')](_0x901805)['then'](function(_0x3b19ae){_0x385c07[_0xd111('0x19')]=_0x3b19ae;if(_0x14619d['query']['includeAll']){_0x412f00[_0xd111('0x3a')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xd111('0x3b')](_0x412f00);})[_0xd111('0x21')](function(_0x709af1){_0x385c07[_0xd111('0x3c')]=_0x709af1;return _0x385c07;})['then'](respondWithFilteredResult(_0x2f24ec,_0x412f00))[_0xd111('0x3d')](handleError(_0x2f24ec,null));};exports['show']=function(_0x120336,_0x2fbef9){var _0x57ab98={'raw':!![],'where':{'id':_0x120336[_0xd111('0x3e')]['id']}},_0xe6cd89={};_0xe6cd89[_0xd111('0x2b')]=_[_0xd111('0x2c')](db['VoiceDialReport'][_0xd111('0x29')]);_0xe6cd89[_0xd111('0x2d')]=_[_0xd111('0x2c')](_0x120336[_0xd111('0x2d')]);_0xe6cd89[_0xd111('0x34')]=_[_0xd111('0x3f')](_0xe6cd89[_0xd111('0x2b')],_0xe6cd89[_0xd111('0x2d')]);_0x57ab98[_0xd111('0x2e')]=_[_0xd111('0x3f')](_0xe6cd89[_0xd111('0x2b')],qs[_0xd111('0x2f')](_0x120336[_0xd111('0x2d')][_0xd111('0x2f')]));_0x57ab98[_0xd111('0x2e')]=_0x57ab98[_0xd111('0x2e')][_0xd111('0x40')]?_0x57ab98['attributes']:_0xe6cd89[_0xd111('0x2b')];if(_0x120336[_0xd111('0x2d')][_0xd111('0x41')]){_0x57ab98[_0xd111('0x3a')]=[{'all':!![]}];}_0x57ab98=_[_0xd111('0x37')]({},_0x57ab98,_0x120336['options']);return db[_0xd111('0x39')]['find'](_0x57ab98)[_0xd111('0x21')](handleEntityNotFound(_0x2fbef9,null))[_0xd111('0x21')](respondWithResult(_0x2fbef9,null))[_0xd111('0x3d')](handleError(_0x2fbef9,null));};exports['create']=function(_0x3f778c,_0x51e2b4){return db[_0xd111('0x39')][_0xd111('0x42')](_0x3f778c['body'],{})[_0xd111('0x21')](respondWithResult(_0x51e2b4,0xc9))[_0xd111('0x3d')](handleError(_0x51e2b4,null));};exports[_0xd111('0x20')]=function(_0x205241,_0x506156){if(_0x205241[_0xd111('0x43')]['id']){delete _0x205241['body']['id'];}return db['VoiceDialReport'][_0xd111('0x44')]({'where':{'id':_0x205241[_0xd111('0x3e')]['id']}})[_0xd111('0x21')](handleEntityNotFound(_0x506156,null))[_0xd111('0x21')](saveUpdates(_0x205241[_0xd111('0x43')],null))[_0xd111('0x21')](respondWithResult(_0x506156,null))[_0xd111('0x3d')](handleError(_0x506156,null));};exports[_0xd111('0x22')]=function(_0x28cb2c,_0x4dbc00){return db[_0xd111('0x39')][_0xd111('0x44')]({'where':{'id':_0x28cb2c[_0xd111('0x3e')]['id']}})[_0xd111('0x21')](handleEntityNotFound(_0x4dbc00,null))[_0xd111('0x21')](removeEntity(_0x4dbc00,null))[_0xd111('0x3d')](handleError(_0x4dbc00,null));};exports['describe']=function(_0x28c1e8,_0x2a54e2){return db[_0xd111('0x39')]['describe']()[_0xd111('0x21')](respondWithResult(_0x2a54e2,null))[_0xd111('0x3d')](handleError(_0x2a54e2,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 0cc38f6..d102c67 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 _0xb9e8=['moment','request-promise','./voiceDialReport.attributes','exports','VoiceDialReport','lodash','../../config/logger','api'];(function(_0x18624e,_0x172c43){var _0x41ef95=function(_0x587da8){while(--_0x587da8){_0x18624e['push'](_0x18624e['shift']());}};_0x41ef95(++_0x172c43);}(_0xb9e8,0x10d));var _0x8b9e=function(_0x5bdbfd,_0x3aaf24){_0x5bdbfd=_0x5bdbfd-0x0;var _0x5711c0=_0xb9e8[_0x5bdbfd];return _0x5711c0;};'use strict';var _=require(_0x8b9e('0x0'));var util=require('util');var logger=require(_0x8b9e('0x1'))(_0x8b9e('0x2'));var moment=require(_0x8b9e('0x3'));var BPromise=require('bluebird');var rp=require(_0x8b9e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8b9e('0x5'));module[_0x8b9e('0x6')]=function(_0xb144cf,_0x2e4073){return _0xb144cf['define'](_0x8b9e('0x7'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdade=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x2bf5bd,_0x120787){var _0xc810c0=function(_0xba9dd3){while(--_0xba9dd3){_0x2bf5bd['push'](_0x2bf5bd['shift']());}};_0xc810c0(++_0x120787);}(_0xdade,0x13a));var _0xedad=function(_0xb89b87,_0x3f1511){_0xb89b87=_0xb89b87-0x0;var _0xbd34e0=_0xdade[_0xb89b87];return _0xbd34e0;};'use strict';var _=require('lodash');var util=require(_0xedad('0x0'));var logger=require(_0xedad('0x1'))('api');var moment=require('moment');var BPromise=require(_0xedad('0x2'));var rp=require(_0xedad('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xedad('0x4'));var config=require('../../config/environment');var attributes=require(_0xedad('0x5'));module[_0xedad('0x6')]=function(_0x42e233,_0x4e6ce0){return _0x42e233[_0xedad('0x7')](_0xedad('0x8'),attributes,{'tableName':_0xedad('0x9'),'paranoid':![],'indexes':[{'fields':[_0xedad('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 93b38b7..061cffc 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 _0x1118=['stringify','body','where','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','info','debug'];(function(_0x4e2894,_0x24e71d){var _0x4adae9=function(_0x2fe0fe){while(--_0x2fe0fe){_0x4e2894['push'](_0x4e2894['shift']());}};_0x4adae9(++_0x24e71d);}(_0x1118,0x19b));var _0x8111=function(_0x43a11e,_0x1300b5){_0x43a11e=_0x43a11e-0x0;var _0x51fab6=_0x1118[_0x43a11e];return _0x51fab6;};'use strict';var _=require(_0x8111('0x0'));var util=require(_0x8111('0x1'));var moment=require(_0x8111('0x2'));var BPromise=require(_0x8111('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8111('0x4'));var db=require(_0x8111('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8111('0x6'))(_0x8111('0x7'));var config=require('../../config/environment');var jayson=require(_0x8111('0x8'));var client=jayson[_0x8111('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f1e36,_0xb39286,_0x5709b5){return new BPromise(function(_0x5e8800,_0x3ee340){return client['request'](_0x4f1e36,_0x5709b5)[_0x8111('0xa')](function(_0x5ca5d0){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0xb39286,_0x8111('0xb'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0xb39286,'request\x20sent',JSON['stringify'](_0x5ca5d0));if(_0x5ca5d0['error']){if(_0x5ca5d0['error']['code']===0x1f4){logger[_0x8111('0xc')](_0x8111('0xd'),_0xb39286,_0x5ca5d0[_0x8111('0xc')][_0x8111('0xe')]);return _0x3ee340(_0x5ca5d0[_0x8111('0xc')][_0x8111('0xe')]);}logger[_0x8111('0xc')](_0x8111('0xd'),_0xb39286,_0x5ca5d0['error']['message']);return _0x5e8800(_0x5ca5d0['error'][_0x8111('0xe')]);}else{logger['info'](_0x8111('0xd'),_0xb39286,_0x8111('0xb'));_0x5e8800(_0x5ca5d0[_0x8111('0xf')][_0x8111('0xe')]);}})[_0x8111('0x10')](function(_0x180fe8){logger[_0x8111('0xc')](_0x8111('0xd'),_0xb39286,_0x180fe8);_0x3ee340(_0x180fe8);});});}exports[_0x8111('0x11')]=function(_0xcb4b17){var _0x23edbe=this;return new Promise(function(_0x26841b,_0x6023e9){return db[_0x8111('0x12')][_0x8111('0x13')](_0xcb4b17['body'],{'raw':_0xcb4b17[_0x8111('0x14')]?_0xcb4b17[_0x8111('0x14')][_0x8111('0x15')]===undefined?!![]:![]:!![]})[_0x8111('0xa')](function(_0x18a786){logger[_0x8111('0x16')]('CreateVoiceDialReport',_0xcb4b17);logger[_0x8111('0x17')](_0x8111('0x11'),_0xcb4b17,JSON[_0x8111('0x18')](_0x18a786));_0x26841b(_0x18a786);})[_0x8111('0x10')](function(_0xb4b4a){logger[_0x8111('0xc')]('CreateVoiceDialReport',_0xb4b4a['message'],_0xcb4b17);_0x6023e9(_0x23edbe['error'](0x1f4,_0xb4b4a[_0x8111('0xe')]));});});};exports['UpdateVoiceDialReport']=function(_0x49584c){var _0x3e64b7=this;return new Promise(function(_0xc24f4,_0x5ec869){return db['VoiceDialReport']['update'](_0x49584c[_0x8111('0x19')],{'raw':_0x49584c[_0x8111('0x14')]?_0x49584c[_0x8111('0x14')][_0x8111('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49584c[_0x8111('0x14')]?_0x49584c[_0x8111('0x14')][_0x8111('0x1a')]||null:null,'attributes':_0x49584c[_0x8111('0x14')]?_0x49584c['options']['attributes']||null:null,'limit':_0x49584c[_0x8111('0x14')]?_0x49584c[_0x8111('0x14')][_0x8111('0x1b')]||null:null})[_0x8111('0xa')](function(_0x2da19c){logger['info'](_0x8111('0x1c'),_0x49584c);logger[_0x8111('0x17')](_0x8111('0x1c'),_0x49584c,JSON['stringify'](_0x2da19c));_0xc24f4(_0x2da19c);})[_0x8111('0x10')](function(_0x4fac98){logger['error'](_0x8111('0x1c'),_0x4fac98[_0x8111('0xe')],_0x49584c);_0x5ec869(_0x3e64b7[_0x8111('0xc')](0x1f4,_0x4fac98['message']));});});}; \ No newline at end of file +var _0xcc50=['message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','debug','stringify','UpdateVoiceDialReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcc50,0xcf));var _0x0cc5=function(_0x31b2a5,_0x2480b4){_0x31b2a5=_0x31b2a5-0x0;var _0x198fa4=_0xcc50[_0x31b2a5];return _0x198fa4;};'use strict';var _=require(_0x0cc5('0x0'));var util=require(_0x0cc5('0x1'));var moment=require('moment');var BPromise=require(_0x0cc5('0x2'));var rs=require(_0x0cc5('0x3'));var fs=require('fs');var Redis=require(_0x0cc5('0x4'));var db=require(_0x0cc5('0x5'))['db'];var utils=require(_0x0cc5('0x6'));var logger=require(_0x0cc5('0x7'))(_0x0cc5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0cc5('0x9')][_0x0cc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22cddb,_0x3cfe77,_0xa953ce){return new BPromise(function(_0xab6145,_0x152733){return client['request'](_0x22cddb,_0xa953ce)[_0x0cc5('0xb')](function(_0x82e17d){logger['info'](_0x0cc5('0xc'),_0x3cfe77,_0x0cc5('0xd'));logger['debug'](_0x0cc5('0xe'),_0x3cfe77,'request\x20sent',JSON['stringify'](_0x82e17d));if(_0x82e17d[_0x0cc5('0xf')]){if(_0x82e17d[_0x0cc5('0xf')][_0x0cc5('0x10')]===0x1f4){logger[_0x0cc5('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x3cfe77,_0x82e17d['error'][_0x0cc5('0x11')]);return _0x152733(_0x82e17d[_0x0cc5('0xf')][_0x0cc5('0x11')]);}logger[_0x0cc5('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x3cfe77,_0x82e17d[_0x0cc5('0xf')][_0x0cc5('0x11')]);return _0xab6145(_0x82e17d['error']['message']);}else{logger[_0x0cc5('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x3cfe77,_0x0cc5('0xd'));_0xab6145(_0x82e17d[_0x0cc5('0x13')][_0x0cc5('0x11')]);}})[_0x0cc5('0x14')](function(_0x7d624a){logger['error'](_0x0cc5('0xc'),_0x3cfe77,_0x7d624a);_0x152733(_0x7d624a);});});}exports[_0x0cc5('0x15')]=function(_0x431736){var _0x5ef56a=this;return new Promise(function(_0x855d8f,_0x26255a){return db[_0x0cc5('0x16')][_0x0cc5('0x17')](_0x431736[_0x0cc5('0x18')],{'raw':_0x431736[_0x0cc5('0x19')]?_0x431736[_0x0cc5('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x13c551){logger[_0x0cc5('0x12')](_0x0cc5('0x15'),_0x431736);logger[_0x0cc5('0x1a')](_0x0cc5('0x15'),_0x431736,JSON[_0x0cc5('0x1b')](_0x13c551));_0x855d8f(_0x13c551);})[_0x0cc5('0x14')](function(_0x48df52){logger[_0x0cc5('0xf')](_0x0cc5('0x15'),_0x48df52[_0x0cc5('0x11')],_0x431736);_0x26255a(_0x5ef56a[_0x0cc5('0xf')](0x1f4,_0x48df52[_0x0cc5('0x11')]));});});};exports[_0x0cc5('0x1c')]=function(_0x10f04f){var _0x46df98=this;return new Promise(function(_0x10f424,_0x2c54a9){return db[_0x0cc5('0x16')]['update'](_0x10f04f['body'],{'raw':_0x10f04f[_0x0cc5('0x19')]?_0x10f04f[_0x0cc5('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10f04f['options']?_0x10f04f[_0x0cc5('0x19')][_0x0cc5('0x1d')]||null:null,'attributes':_0x10f04f[_0x0cc5('0x19')]?_0x10f04f['options'][_0x0cc5('0x1e')]||null:null,'limit':_0x10f04f['options']?_0x10f04f[_0x0cc5('0x19')][_0x0cc5('0x1f')]||null:null})[_0x0cc5('0xb')](function(_0x375417){logger[_0x0cc5('0x12')](_0x0cc5('0x1c'),_0x10f04f);logger[_0x0cc5('0x1a')]('UpdateVoiceDialReport',_0x10f04f,JSON[_0x0cc5('0x1b')](_0x375417));_0x10f424(_0x375417);})['catch'](function(_0x4b8bbd){logger[_0x0cc5('0xf')](_0x0cc5('0x1c'),_0x4b8bbd['message'],_0x10f04f);_0x2c54a9(_0x46df98[_0x0cc5('0xf')](0x1f4,_0x4b8bbd['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 214b734..30a1f6e 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 _0x8ac1=['isAuthenticated','create','post','/:id','update','delete','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','show'];(function(_0x25e483,_0x2eedd8){var _0x117af9=function(_0x1705ec){while(--_0x1705ec){_0x25e483['push'](_0x25e483['shift']());}};_0x117af9(++_0x2eedd8);}(_0x8ac1,0x6d));var _0x18ac=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8ac1[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x18ac('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x18ac('0x1'));var express=require(_0x18ac('0x2'));var router=express[_0x18ac('0x3')]();var auth=require(_0x18ac('0x4'));var interaction=require(_0x18ac('0x5'));var config=require(_0x18ac('0x6'));var controller=require(_0x18ac('0x7'));router[_0x18ac('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x18ac('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x18ac('0x9')]);router['post']('/',auth[_0x18ac('0xa')](),controller[_0x18ac('0xb')]);router[_0x18ac('0xc')]('/:id/applications',auth[_0x18ac('0xa')](),controller['addApplications']);router['put'](_0x18ac('0xd'),auth[_0x18ac('0xa')](),controller[_0x18ac('0xe')]);router[_0x18ac('0xf')]('/:id',auth[_0x18ac('0xa')](),controller['destroy']);module[_0x18ac('0x10')]=router; \ No newline at end of file +var _0x2cf9=['./voiceExtension.controller','get','isAuthenticated','index','/:id','/:id/applications','addApplications','put','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x419128,_0x277965){var _0x1fd0da=function(_0x2c0e13){while(--_0x2c0e13){_0x419128['push'](_0x419128['shift']());}};_0x1fd0da(++_0x277965);}(_0x2cf9,0x149));var _0x92cf=function(_0x58d0bc,_0x48c016){_0x58d0bc=_0x58d0bc-0x0;var _0x28cfcc=_0x2cf9[_0x58d0bc];return _0x28cfcc;};'use strict';var multer=require('multer');var util=require(_0x92cf('0x0'));var path=require(_0x92cf('0x1'));var timeout=require(_0x92cf('0x2'));var express=require(_0x92cf('0x3'));var router=express['Router']();var auth=require(_0x92cf('0x4'));var interaction=require(_0x92cf('0x5'));var config=require(_0x92cf('0x6'));var controller=require(_0x92cf('0x7'));router[_0x92cf('0x8')]('/',auth[_0x92cf('0x9')](),controller[_0x92cf('0xa')]);router[_0x92cf('0x8')](_0x92cf('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x92cf('0x9')](),controller['create']);router['post'](_0x92cf('0xc'),auth[_0x92cf('0x9')](),controller[_0x92cf('0xd')]);router[_0x92cf('0xe')](_0x92cf('0xb'),auth[_0x92cf('0x9')](),controller['update']);router['delete']('/:id',auth[_0x92cf('0x9')](),controller[_0x92cf('0xf')]);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 b4c03e8..987df52 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x2b4087,_0x5c1307){var _0x4adcbe=function(_0x541b48){while(--_0x541b48){_0x2b4087['push'](_0x2b4087['shift']());}};_0x4adcbe(++_0x5c1307);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x2862a5,_0x11a486){var _0x45e19a=function(_0x106020){while(--_0x106020){_0x2862a5['push'](_0x2862a5['shift']());}};_0x45e19a(++_0x11a486);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 88fec6e..783f54f 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 _0x3301=['body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OutboundRoutes','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','VoiceExtensionId','bulkCreate','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','ignore','map','value','type','error','stack','name','send','VoiceExtension','rawAttributes','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','intersection','fields','find','params','create','startsWith','exten'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x3301,0x154));var _0x1330=function(_0x5cdae6,_0x50e1fc){_0x5cdae6=_0x5cdae6-0x0;var _0x18e71d=_0x3301[_0x5cdae6];return _0x18e71d;};'use strict';var pdf=require(_0x1330('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1330('0x1'));var jsonpatch=require(_0x1330('0x2'));var rp=require(_0x1330('0x3'));var moment=require(_0x1330('0x4'));var BPromise=require(_0x1330('0x5'));var Mustache=require(_0x1330('0x6'));var util=require(_0x1330('0x7'));var path=require(_0x1330('0x8'));var sox=require(_0x1330('0x9'));var csv=require(_0x1330('0xa'));var ejs=require(_0x1330('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1330('0xc'));var crypto=require(_0x1330('0xd'));var jsforce=require(_0x1330('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1330('0xa'));var querystring=require(_0x1330('0xf'));var Papa=require(_0x1330('0x10'));var Redis=require(_0x1330('0x11'));var authService=require(_0x1330('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1330('0x13'));var logger=require(_0x1330('0x14'))(_0x1330('0x15'));var utils=require(_0x1330('0x16'));var config=require(_0x1330('0x17'));var licenseUtil=require(_0x1330('0x18'));var db=require(_0x1330('0x19'))['db'];config[_0x1330('0x1a')]=_['defaults'](config[_0x1330('0x1a')],{'host':_0x1330('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1330('0x1c'))[_0x1330('0x1d')](socket);function respondWithStatusCode(_0x2534b3,_0x127be8){_0x127be8=_0x127be8||0xcc;return function(_0x5389f3){if(_0x5389f3){return _0x2534b3[_0x1330('0x1e')](_0x127be8);}return _0x2534b3[_0x1330('0x1f')](_0x127be8)[_0x1330('0x20')]();};}function respondWithResult(_0x596fc0,_0x43f357){_0x43f357=_0x43f357||0xc8;return function(_0xb08f7e){if(_0xb08f7e){return _0x596fc0[_0x1330('0x1f')](_0x43f357)[_0x1330('0x21')](_0xb08f7e);}};}function respondWithFilteredResult(_0x59b339,_0x249903){return function(_0x21c577){if(_0x21c577){var _0x2e6ca8=_0x21c577[_0x1330('0x22')],_0x30061e=_0x249903['offset'],_0x2d8301=_0x249903[_0x1330('0x23')]+_0x249903[_0x1330('0x24')],_0x28f426;if(_0x2d8301>=_0x2e6ca8){_0x2d8301=_0x2e6ca8;_0x28f426=0xc8;}else{_0x28f426=0xce;}_0x59b339[_0x1330('0x1f')](_0x28f426);return _0x59b339[_0x1330('0x25')](_0x1330('0x26'),_0x30061e+'-'+_0x2d8301+'/'+_0x2e6ca8)[_0x1330('0x21')](_0x21c577);}return null;};}function patchUpdates(_0x1ccb0e){return function(_0x270e7a){try{jsonpatch['apply'](_0x270e7a,_0x1ccb0e,!![]);}catch(_0x315ba6){return BPromise[_0x1330('0x27')](_0x315ba6);}return _0x270e7a[_0x1330('0x28')]();};}function saveUpdates(_0x56b5cb,_0x3cf492){return function(_0xf32d94){if(_0xf32d94){return _0xf32d94[_0x1330('0x29')](_0x56b5cb)[_0x1330('0x2a')](function(_0x26dfbd){return _0x26dfbd;});}return null;};}function removeEntity(_0x3ce2bb,_0x195b47){return function(_0x4067fc){if(_0x4067fc){return _0x4067fc[_0x1330('0x2b')]()['then'](function(){var _0x328604=_0x4067fc[_0x1330('0x2c')]({'plain':!![]});var _0x37b64b=[{'name':_0x1330('0x2d'),'value':_0x1330('0x2e'),'ignore':![]},{'name':'OutboundRoutes','value':_0x1330('0x2f'),'ignore':![]},{'name':_0x1330('0x30'),'value':_0x1330('0x31'),'ignore':![]}];var _0x1f4cfd=_(_0x37b64b)['filter'](_0x1330('0x32'))[_0x1330('0x33')](_0x1330('0x34'))[_0x1330('0x34')]();if(_['includes'](_0x1f4cfd,_0x328604['type'])){return;}var _0x29e276=_['find'](_0x37b64b,[_0x1330('0x34'),_0x328604[_0x1330('0x35')]])['name'];return db['UserProfileResource'][_0x1330('0x2b')]({'where':{'type':_0x29e276,'resourceId':_0x328604['id']}})['then'](function(){return _0x4067fc;});})[_0x1330('0x2a')](function(){_0x3ce2bb['status'](0xcc)[_0x1330('0x20')]();});}};}function handleEntityNotFound(_0x890e49,_0x3fe5ba){return function(_0x1969aa){if(!_0x1969aa){_0x890e49['sendStatus'](0x194);}return _0x1969aa;};}function handleError(_0x47bd80,_0x29fc8a){_0x29fc8a=_0x29fc8a||0x1f4;return function(_0x2f7224){logger[_0x1330('0x36')](_0x2f7224[_0x1330('0x37')]);if(_0x2f7224[_0x1330('0x38')]){delete _0x2f7224[_0x1330('0x38')];}_0x47bd80[_0x1330('0x1f')](_0x29fc8a)[_0x1330('0x39')](_0x2f7224);};}exports['index']=function(_0x46bd29,_0x19577f){var _0x5a87ba={},_0x3c414d={},_0x2913a5={'count':0x0,'rows':[]};var _0x395212=_[_0x1330('0x33')](db[_0x1330('0x3a')][_0x1330('0x3b')],function(_0x2ab7b1){return{'name':_0x2ab7b1['fieldName'],'type':_0x2ab7b1[_0x1330('0x35')][_0x1330('0x3c')]};});_0x3c414d[_0x1330('0x3d')]=_['map'](_0x395212,_0x1330('0x38'));_0x3c414d[_0x1330('0x3e')]=_[_0x1330('0x3f')](_0x46bd29[_0x1330('0x3e')]);_0x3c414d[_0x1330('0x40')]=_['intersection'](_0x3c414d[_0x1330('0x3d')],_0x3c414d[_0x1330('0x3e')]);_0x5a87ba['attributes']=_['intersection'](_0x3c414d[_0x1330('0x3d')],qs['fields'](_0x46bd29['query']['fields']));_0x5a87ba[_0x1330('0x41')]=_0x5a87ba[_0x1330('0x41')][_0x1330('0x42')]?_0x5a87ba[_0x1330('0x41')]:_0x3c414d[_0x1330('0x3d')];if(!_0x46bd29[_0x1330('0x3e')][_0x1330('0x43')](_0x1330('0x44'))){_0x5a87ba[_0x1330('0x24')]=qs[_0x1330('0x24')](_0x46bd29[_0x1330('0x3e')][_0x1330('0x24')]);_0x5a87ba['offset']=qs['offset'](_0x46bd29[_0x1330('0x3e')]['offset']);}_0x5a87ba['order']=qs[_0x1330('0x45')](_0x46bd29['query']['sort']);_0x5a87ba[_0x1330('0x46')]=qs['filters'](_[_0x1330('0x47')](_0x46bd29[_0x1330('0x3e')],_0x3c414d[_0x1330('0x40')]),_0x395212);if(_0x46bd29['query']['filter']){_0x5a87ba[_0x1330('0x46')]=_[_0x1330('0x48')](_0x5a87ba[_0x1330('0x46')],{'$or':_[_0x1330('0x33')](_0x395212,function(_0x15330d){if(_0x15330d[_0x1330('0x35')]!==_0x1330('0x49')){var _0x3b0c67={};_0x3b0c67[_0x15330d[_0x1330('0x38')]]={'$like':'%'+_0x46bd29[_0x1330('0x3e')][_0x1330('0x4a')]+'%'};return _0x3b0c67;}})});}_0x5a87ba=_[_0x1330('0x48')]({},_0x5a87ba,_0x46bd29[_0x1330('0x4b')]);var _0x2f2d8f={'where':_0x5a87ba['where']};return db[_0x1330('0x3a')][_0x1330('0x22')](_0x2f2d8f)[_0x1330('0x2a')](function(_0x3cbd7b){_0x2913a5[_0x1330('0x22')]=_0x3cbd7b;if(_0x46bd29[_0x1330('0x3e')][_0x1330('0x4c')]){_0x5a87ba[_0x1330('0x4d')]=[{'all':!![]}];}return db[_0x1330('0x3a')]['findAll'](_0x5a87ba);})[_0x1330('0x2a')](function(_0x1faa54){_0x2913a5[_0x1330('0x4e')]=_0x1faa54;return _0x2913a5;})['then'](respondWithFilteredResult(_0x19577f,_0x5a87ba))[_0x1330('0x4f')](handleError(_0x19577f,null));};exports[_0x1330('0x50')]=function(_0xbe9297,_0x2970ff){var _0x56d3eb={'raw':![],'where':{'id':_0xbe9297['params']['id']}},_0x811540={};_0x811540[_0x1330('0x3d')]=_[_0x1330('0x3f')](db[_0x1330('0x3a')]['rawAttributes']);_0x811540[_0x1330('0x3e')]=_[_0x1330('0x3f')](_0xbe9297[_0x1330('0x3e')]);_0x811540[_0x1330('0x40')]=_[_0x1330('0x51')](_0x811540[_0x1330('0x3d')],_0x811540[_0x1330('0x3e')]);_0x56d3eb[_0x1330('0x41')]=_[_0x1330('0x51')](_0x811540[_0x1330('0x3d')],qs[_0x1330('0x52')](_0xbe9297[_0x1330('0x3e')][_0x1330('0x52')]));_0x56d3eb['attributes']=_0x56d3eb[_0x1330('0x41')][_0x1330('0x42')]?_0x56d3eb[_0x1330('0x41')]:_0x811540[_0x1330('0x3d')];if(_0xbe9297[_0x1330('0x3e')][_0x1330('0x4c')]){_0x56d3eb['include']=[{'all':!![]}];}_0x56d3eb=_[_0x1330('0x48')]({},_0x56d3eb,_0xbe9297[_0x1330('0x4b')]);return db['VoiceExtension'][_0x1330('0x53')](_0x56d3eb)['then'](handleEntityNotFound(_0x2970ff,null))['then'](respondWithResult(_0x2970ff,null))[_0x1330('0x4f')](handleError(_0x2970ff,null));};exports['destroy']=function(_0x2ddc8c,_0x243b09){return db[_0x1330('0x3a')][_0x1330('0x53')]({'where':{'id':_0x2ddc8c[_0x1330('0x54')]['id']}})[_0x1330('0x2a')](handleEntityNotFound(_0x243b09,null))['then'](removeEntity(_0x243b09,null))[_0x1330('0x4f')](handleError(_0x243b09,null));};exports[_0x1330('0x55')]=function(_0x1de0fb,_0x3daf02){if(_0x1de0fb['body']['type']===_0x1330('0x2f')&&!_[_0x1330('0x56')](_0x1de0fb['body'][_0x1330('0x57')],'_')){_0x1de0fb[_0x1330('0x58')][_0x1330('0x57')]='_'['concat'](_0x1de0fb[_0x1330('0x58')][_0x1330('0x57')]);}return db[_0x1330('0x3a')][_0x1330('0x55')](_0x1de0fb['body'],{'raw':![]})[_0x1330('0x2a')](function(_0x1f3e28){var _0x2658b7=_0x1de0fb['user'][_0x1330('0x2c')]({'plain':!![]});if(!_0x2658b7)throw new Error(_0x1330('0x59'));if(_0x2658b7[_0x1330('0x5a')]===_0x1330('0x5b')){var _0x1230e4=_0x1f3e28[_0x1330('0x2c')]({'plain':!![]});var _0xb2d202=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x1330('0x5c'),'value':_0x1330('0x2f')},{'name':_0x1330('0x30'),'value':'internal'}];var _0x30bdfd=_[_0x1330('0x53')](_0xb2d202,['value',_0x1230e4['type']])[_0x1330('0x38')];return db['UserProfileSection'][_0x1330('0x53')]({'where':{'name':_0x30bdfd,'userProfileId':_0x2658b7[_0x1330('0x5d')]},'raw':!![]})['then'](function(_0x4b627f){if(_0x4b627f&&_0x4b627f[_0x1330('0x5e')]===0x0){return db[_0x1330('0x5f')][_0x1330('0x55')]({'name':_0x1230e4[_0x1330('0x38')],'resourceId':_0x1230e4['id'],'type':_0x4b627f[_0x1330('0x38')],'sectionId':_0x4b627f['id']},{})[_0x1330('0x2a')](function(){return _0x1f3e28;});}else{return _0x1f3e28;}})[_0x1330('0x4f')](function(_0x4ea43d){logger[_0x1330('0x36')](_0x1330('0x60'),_0x4ea43d);throw _0x4ea43d;});}return _0x1f3e28;})[_0x1330('0x2a')](respondWithResult(_0x3daf02,0xc9))[_0x1330('0x4f')](handleError(_0x3daf02,null));};exports[_0x1330('0x29')]=function(_0x59be4f,_0x438a17){if(_0x59be4f[_0x1330('0x58')]['id']){delete _0x59be4f[_0x1330('0x58')]['id'];}return db['VoiceExtension'][_0x1330('0x53')]({'where':{'id':_0x59be4f[_0x1330('0x54')]['id']}})[_0x1330('0x2a')](handleEntityNotFound(_0x438a17,null))['then'](function(_0x1d3edb){if(_0x1d3edb){return db[_0x1330('0x3a')][_0x1330('0x29')](_[_0x1330('0x47')](_0x59be4f[_0x1330('0x58')],[_0x1330('0x57'),_0x1330('0x61'),_0x1330('0x62'),_0x1330('0x63'),_0x1330('0x64'),_0x1330('0x65')]),{'where':{'context':_0x1d3edb['context'],'exten':_0x1d3edb[_0x1330('0x57')]},'individualHooks':!![]})[_0x1330('0x2a')](function(_0x57bdf0){return _0x57bdf0;});}return null;})[_0x1330('0x2a')](respondWithStatusCode(_0x438a17,null))[_0x1330('0x4f')](handleError(_0x438a17,null));};exports[_0x1330('0x66')]=function(_0x5a5bb4,_0x5a8fa7,_0x5331e3){return db[_0x1330('0x3a')][_0x1330('0x67')]({'where':{'id':_0x5a5bb4[_0x1330('0x54')]['id']}})[_0x1330('0x2a')](handleEntityNotFound(_0x5a8fa7,null))[_0x1330('0x2a')](function(_0x2fda9a){if(_0x2fda9a){return db[_0x1330('0x68')]['transaction'](function(_0x541b17){return db['VoiceExtension'][_0x1330('0x2b')]({'where':{'VoiceExtensionId':_0x5a5bb4[_0x1330('0x54')]['id']},'transaction':_0x541b17})[_0x1330('0x2a')](function(_0x3ff686){var _0x3ee538=_['map'](_0x5a5bb4['body'],function(_0x43d2b4){_0x43d2b4[_0x1330('0x69')]=_0x5a5bb4[_0x1330('0x54')]['id'];return _0x43d2b4;});return db['VoiceExtension'][_0x1330('0x6a')](_0x3ee538,{'transaction':_0x541b17});});})['then'](function(){return db[_0x1330('0x3a')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x5a5bb4['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x5a8fa7,null))[_0x1330('0x4f')](handleError(_0x5a8fa7,null));}; \ No newline at end of file +var _0x3e21=['../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','json','count','limit','status','set','apply','reject','save','update','then','destroy','get','OutboundRoutes','InternalRoutes','internal','ignore','map','value','includes','type','find','error','stack','name','send','index','VoiceExtension','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filter','VIRTUAL','merge','findAll','rows','catch','rawAttributes','includeAll','include','params','body','outbound','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','userProfileId','autoAssociation','UserProfileResource','pick','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','sequelize','VoiceExtensionId','bulkCreate','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x33f750,_0x3a0638){var _0xd2186a=function(_0x20b011){while(--_0x20b011){_0x33f750['push'](_0x33f750['shift']());}};_0xd2186a(++_0x3a0638);}(_0x3e21,0xc0));var _0x13e2=function(_0x2274f2,_0x71d568){_0x2274f2=_0x2274f2-0x0;var _0x25fd42=_0x3e21[_0x2274f2];return _0x25fd42;};'use strict';var pdf=require(_0x13e2('0x0'));var emlformat=require(_0x13e2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x13e2('0x2'));var jsonpatch=require(_0x13e2('0x3'));var rp=require(_0x13e2('0x4'));var moment=require(_0x13e2('0x5'));var BPromise=require(_0x13e2('0x6'));var Mustache=require(_0x13e2('0x7'));var util=require(_0x13e2('0x8'));var path=require(_0x13e2('0x9'));var sox=require(_0x13e2('0xa'));var csv=require(_0x13e2('0xb'));var ejs=require(_0x13e2('0xc'));var fs=require('fs');var _=require(_0x13e2('0xd'));var squel=require(_0x13e2('0xe'));var crypto=require(_0x13e2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x13e2('0x10'));var toCsv=require('to-csv');var querystring=require(_0x13e2('0x11'));var Papa=require('papaparse');var Redis=require(_0x13e2('0x12'));var authService=require(_0x13e2('0x13'));var qs=require(_0x13e2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13e2('0x15'));var logger=require(_0x13e2('0x16'))(_0x13e2('0x17'));var utils=require('../../config/utils');var config=require(_0x13e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x13e2('0x19'))['db'];config[_0x13e2('0x1a')]=_[_0x13e2('0x1b')](config[_0x13e2('0x1a')],{'host':_0x13e2('0x1c'),'port':0x18eb});var socket=require(_0x13e2('0x1d'))(new Redis(config['redis']));require(_0x13e2('0x1e'))[_0x13e2('0x1f')](socket);function respondWithStatusCode(_0x42342c,_0x4c2db5){_0x4c2db5=_0x4c2db5||0xcc;return function(_0x46f552){if(_0x46f552){return _0x42342c[_0x13e2('0x20')](_0x4c2db5);}return _0x42342c['status'](_0x4c2db5)[_0x13e2('0x21')]();};}function respondWithResult(_0x1128d8,_0x1aa92e){_0x1aa92e=_0x1aa92e||0xc8;return function(_0x540ef4){if(_0x540ef4){return _0x1128d8['status'](_0x1aa92e)[_0x13e2('0x22')](_0x540ef4);}};}function respondWithFilteredResult(_0x5a3493,_0x12f5a5){return function(_0x1bdb93){if(_0x1bdb93){var _0x2692cd=_0x1bdb93[_0x13e2('0x23')],_0x4f529c=_0x12f5a5['offset'],_0x1eec1b=_0x12f5a5['offset']+_0x12f5a5[_0x13e2('0x24')],_0x3bb061;if(_0x1eec1b>=_0x2692cd){_0x1eec1b=_0x2692cd;_0x3bb061=0xc8;}else{_0x3bb061=0xce;}_0x5a3493[_0x13e2('0x25')](_0x3bb061);return _0x5a3493[_0x13e2('0x26')]('Content-Range',_0x4f529c+'-'+_0x1eec1b+'/'+_0x2692cd)[_0x13e2('0x22')](_0x1bdb93);}return null;};}function patchUpdates(_0x4d3898){return function(_0x5f5a79){try{jsonpatch[_0x13e2('0x27')](_0x5f5a79,_0x4d3898,!![]);}catch(_0x1a1948){return BPromise[_0x13e2('0x28')](_0x1a1948);}return _0x5f5a79[_0x13e2('0x29')]();};}function saveUpdates(_0x22cda6,_0x26742f){return function(_0x321672){if(_0x321672){return _0x321672[_0x13e2('0x2a')](_0x22cda6)[_0x13e2('0x2b')](function(_0xc52cdf){return _0xc52cdf;});}return null;};}function removeEntity(_0x5641ea,_0x38ef5e){return function(_0x298aeb){if(_0x298aeb){return _0x298aeb[_0x13e2('0x2c')]()[_0x13e2('0x2b')](function(){var _0x2c7d4e=_0x298aeb[_0x13e2('0x2d')]({'plain':!![]});var _0x4cdf4f=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x13e2('0x2e'),'value':'outbound','ignore':![]},{'name':_0x13e2('0x2f'),'value':_0x13e2('0x30'),'ignore':![]}];var _0x596fd6=_(_0x4cdf4f)['filter'](_0x13e2('0x31'))[_0x13e2('0x32')](_0x13e2('0x33'))[_0x13e2('0x33')]();if(_[_0x13e2('0x34')](_0x596fd6,_0x2c7d4e[_0x13e2('0x35')])){return;}var _0x105e50=_[_0x13e2('0x36')](_0x4cdf4f,[_0x13e2('0x33'),_0x2c7d4e[_0x13e2('0x35')]])['name'];return db['UserProfileResource'][_0x13e2('0x2c')]({'where':{'type':_0x105e50,'resourceId':_0x2c7d4e['id']}})[_0x13e2('0x2b')](function(){return _0x298aeb;});})[_0x13e2('0x2b')](function(){_0x5641ea['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dde74,_0x71fed9){return function(_0x492123){if(!_0x492123){_0x4dde74[_0x13e2('0x20')](0x194);}return _0x492123;};}function handleError(_0x1490e2,_0x55cb3f){_0x55cb3f=_0x55cb3f||0x1f4;return function(_0x2e5e9f){logger[_0x13e2('0x37')](_0x2e5e9f[_0x13e2('0x38')]);if(_0x2e5e9f[_0x13e2('0x39')]){delete _0x2e5e9f['name'];}_0x1490e2[_0x13e2('0x25')](_0x55cb3f)[_0x13e2('0x3a')](_0x2e5e9f);};}exports[_0x13e2('0x3b')]=function(_0x41c618,_0x266564){var _0x5b32f0={},_0x41cb7e={},_0x1f836f={'count':0x0,'rows':[]};var _0x25f898=_[_0x13e2('0x32')](db[_0x13e2('0x3c')]['rawAttributes'],function(_0x1a10ef){return{'name':_0x1a10ef[_0x13e2('0x3d')],'type':_0x1a10ef[_0x13e2('0x35')][_0x13e2('0x3e')]};});_0x41cb7e[_0x13e2('0x3f')]=_[_0x13e2('0x32')](_0x25f898,_0x13e2('0x39'));_0x41cb7e[_0x13e2('0x40')]=_[_0x13e2('0x41')](_0x41c618[_0x13e2('0x40')]);_0x41cb7e[_0x13e2('0x42')]=_[_0x13e2('0x43')](_0x41cb7e[_0x13e2('0x3f')],_0x41cb7e['query']);_0x5b32f0[_0x13e2('0x44')]=_[_0x13e2('0x43')](_0x41cb7e[_0x13e2('0x3f')],qs[_0x13e2('0x45')](_0x41c618[_0x13e2('0x40')]['fields']));_0x5b32f0[_0x13e2('0x44')]=_0x5b32f0[_0x13e2('0x44')][_0x13e2('0x46')]?_0x5b32f0[_0x13e2('0x44')]:_0x41cb7e[_0x13e2('0x3f')];if(!_0x41c618[_0x13e2('0x40')][_0x13e2('0x47')]('nolimit')){_0x5b32f0[_0x13e2('0x24')]=qs[_0x13e2('0x24')](_0x41c618[_0x13e2('0x40')][_0x13e2('0x24')]);_0x5b32f0[_0x13e2('0x48')]=qs['offset'](_0x41c618['query'][_0x13e2('0x48')]);}_0x5b32f0[_0x13e2('0x49')]=qs[_0x13e2('0x4a')](_0x41c618[_0x13e2('0x40')][_0x13e2('0x4a')]);_0x5b32f0[_0x13e2('0x4b')]=qs[_0x13e2('0x42')](_['pick'](_0x41c618['query'],_0x41cb7e[_0x13e2('0x42')]),_0x25f898);if(_0x41c618[_0x13e2('0x40')][_0x13e2('0x4c')]){_0x5b32f0['where']=_['merge'](_0x5b32f0[_0x13e2('0x4b')],{'$or':_['map'](_0x25f898,function(_0x3a0fd9){if(_0x3a0fd9['type']!==_0x13e2('0x4d')){var _0x2e1ff6={};_0x2e1ff6[_0x3a0fd9[_0x13e2('0x39')]]={'$like':'%'+_0x41c618['query'][_0x13e2('0x4c')]+'%'};return _0x2e1ff6;}})});}_0x5b32f0=_[_0x13e2('0x4e')]({},_0x5b32f0,_0x41c618['options']);var _0x2ce3bc={'where':_0x5b32f0['where']};return db[_0x13e2('0x3c')]['count'](_0x2ce3bc)[_0x13e2('0x2b')](function(_0x41dec0){_0x1f836f[_0x13e2('0x23')]=_0x41dec0;if(_0x41c618['query']['includeAll']){_0x5b32f0['include']=[{'all':!![]}];}return db[_0x13e2('0x3c')][_0x13e2('0x4f')](_0x5b32f0);})[_0x13e2('0x2b')](function(_0x35088e){_0x1f836f[_0x13e2('0x50')]=_0x35088e;return _0x1f836f;})[_0x13e2('0x2b')](respondWithFilteredResult(_0x266564,_0x5b32f0))[_0x13e2('0x51')](handleError(_0x266564,null));};exports['show']=function(_0x23868a,_0x51f843){var _0x370ea6={'raw':![],'where':{'id':_0x23868a['params']['id']}},_0x25b0ef={};_0x25b0ef[_0x13e2('0x3f')]=_['keys'](db[_0x13e2('0x3c')][_0x13e2('0x52')]);_0x25b0ef['query']=_[_0x13e2('0x41')](_0x23868a[_0x13e2('0x40')]);_0x25b0ef['filters']=_['intersection'](_0x25b0ef['model'],_0x25b0ef[_0x13e2('0x40')]);_0x370ea6[_0x13e2('0x44')]=_[_0x13e2('0x43')](_0x25b0ef[_0x13e2('0x3f')],qs[_0x13e2('0x45')](_0x23868a[_0x13e2('0x40')][_0x13e2('0x45')]));_0x370ea6['attributes']=_0x370ea6[_0x13e2('0x44')][_0x13e2('0x46')]?_0x370ea6[_0x13e2('0x44')]:_0x25b0ef[_0x13e2('0x3f')];if(_0x23868a[_0x13e2('0x40')][_0x13e2('0x53')]){_0x370ea6[_0x13e2('0x54')]=[{'all':!![]}];}_0x370ea6=_[_0x13e2('0x4e')]({},_0x370ea6,_0x23868a['options']);return db[_0x13e2('0x3c')][_0x13e2('0x36')](_0x370ea6)[_0x13e2('0x2b')](handleEntityNotFound(_0x51f843,null))['then'](respondWithResult(_0x51f843,null))['catch'](handleError(_0x51f843,null));};exports['destroy']=function(_0x58ac69,_0x5c2914){return db['VoiceExtension'][_0x13e2('0x36')]({'where':{'id':_0x58ac69[_0x13e2('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c2914,null))[_0x13e2('0x2b')](removeEntity(_0x5c2914,null))[_0x13e2('0x51')](handleError(_0x5c2914,null));};exports['create']=function(_0x2ebff9,_0x5b4a90){if(_0x2ebff9[_0x13e2('0x56')][_0x13e2('0x35')]===_0x13e2('0x57')&&!_['startsWith'](_0x2ebff9[_0x13e2('0x56')]['exten'],'_')){_0x2ebff9[_0x13e2('0x56')][_0x13e2('0x58')]='_'[_0x13e2('0x59')](_0x2ebff9['body'][_0x13e2('0x58')]);}return db['VoiceExtension'][_0x13e2('0x5a')](_0x2ebff9[_0x13e2('0x56')],{'raw':![]})[_0x13e2('0x2b')](function(_0x11a710){var _0x1a93ea=_0x2ebff9[_0x13e2('0x5b')][_0x13e2('0x2d')]({'plain':!![]});if(!_0x1a93ea)throw new Error(_0x13e2('0x5c'));if(_0x1a93ea['role']==='user'){var _0x491e10=_0x11a710[_0x13e2('0x2d')]({'plain':!![]});var _0x525e29=[{'name':'InboundRoutes','value':_0x13e2('0x5d')},{'name':'OutboundRoutes','value':_0x13e2('0x57')},{'name':'InternalRoutes','value':_0x13e2('0x30')}];var _0xfae8c3=_[_0x13e2('0x36')](_0x525e29,['value',_0x491e10[_0x13e2('0x35')]])['name'];return db['UserProfileSection'][_0x13e2('0x36')]({'where':{'name':_0xfae8c3,'userProfileId':_0x1a93ea[_0x13e2('0x5e')]},'raw':!![]})[_0x13e2('0x2b')](function(_0x313d0a){if(_0x313d0a&&_0x313d0a[_0x13e2('0x5f')]===0x0){return db[_0x13e2('0x60')][_0x13e2('0x5a')]({'name':_0x491e10[_0x13e2('0x39')],'resourceId':_0x491e10['id'],'type':_0x313d0a['name'],'sectionId':_0x313d0a['id']},{})[_0x13e2('0x2b')](function(){return _0x11a710;});}else{return _0x11a710;}})['catch'](function(_0x2cb748){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2cb748);throw _0x2cb748;});}return _0x11a710;})[_0x13e2('0x2b')](respondWithResult(_0x5b4a90,0xc9))[_0x13e2('0x51')](handleError(_0x5b4a90,null));};exports[_0x13e2('0x2a')]=function(_0x429cdc,_0x4372b5){if(_0x429cdc[_0x13e2('0x56')]['id']){delete _0x429cdc[_0x13e2('0x56')]['id'];}return db[_0x13e2('0x3c')][_0x13e2('0x36')]({'where':{'id':_0x429cdc[_0x13e2('0x55')]['id']}})['then'](handleEntityNotFound(_0x4372b5,null))[_0x13e2('0x2b')](function(_0x5b265e){if(_0x5b265e){return db[_0x13e2('0x3c')][_0x13e2('0x2a')](_[_0x13e2('0x61')](_0x429cdc[_0x13e2('0x56')],[_0x13e2('0x58'),'context','description',_0x13e2('0x62'),_0x13e2('0x63'),_0x13e2('0x64')]),{'where':{'context':_0x5b265e[_0x13e2('0x65')],'exten':_0x5b265e[_0x13e2('0x58')]},'individualHooks':!![]})[_0x13e2('0x2b')](function(_0xb54374){return _0xb54374;});}return null;})[_0x13e2('0x2b')](respondWithStatusCode(_0x4372b5,null))[_0x13e2('0x51')](handleError(_0x4372b5,null));};exports[_0x13e2('0x66')]=function(_0x271494,_0x11be58,_0x38199a){return db[_0x13e2('0x3c')][_0x13e2('0x67')]({'where':{'id':_0x271494[_0x13e2('0x55')]['id']}})[_0x13e2('0x2b')](handleEntityNotFound(_0x11be58,null))[_0x13e2('0x2b')](function(_0x3bdf26){if(_0x3bdf26){return db[_0x13e2('0x68')]['transaction'](function(_0x2521ea){return db[_0x13e2('0x3c')]['destroy']({'where':{'VoiceExtensionId':_0x271494[_0x13e2('0x55')]['id']},'transaction':_0x2521ea})[_0x13e2('0x2b')](function(_0x1e2427){var _0x5d221e=_[_0x13e2('0x32')](_0x271494[_0x13e2('0x56')],function(_0x337763){_0x337763[_0x13e2('0x69')]=_0x271494[_0x13e2('0x55')]['id'];return _0x337763;});return db[_0x13e2('0x3c')][_0x13e2('0x6a')](_0x5d221e,{'transaction':_0x2521ea});});})[_0x13e2('0x2b')](function(){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x271494[_0x13e2('0x55')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x11be58,null))[_0x13e2('0x51')](handleError(_0x11be58,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 92f5bc2..66f87c0 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 _0xac29=['hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','save','update','emit'];(function(_0x2edf21,_0x4f35a2){var _0x4e6c6f=function(_0x20e42f){while(--_0x20e42f){_0x2edf21['push'](_0x2edf21['shift']());}};_0x4e6c6f(++_0x4f35a2);}(_0xac29,0xb2));var _0x9ac2=function(_0x482e1d,_0x193a27){_0x482e1d=_0x482e1d-0x0;var _0x47ca0e=_0xac29[_0x482e1d];return _0x47ca0e;};'use strict';var EventEmitter=require(_0x9ac2('0x0'));var VoiceExtension=require(_0x9ac2('0x1'))['db'][_0x9ac2('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9ac2('0x3'),'afterUpdate':_0x9ac2('0x4'),'afterDestroy':'remove'};function emitEvent(_0xd382f){return function(_0x2a9d5e,_0x55fd7f,_0x39833b){VoiceExtensionEvents['emit'](_0xd382f+':'+_0x2a9d5e['id'],_0x2a9d5e);VoiceExtensionEvents[_0x9ac2('0x5')](_0xd382f,_0x2a9d5e);_0x39833b(null);};}for(var e in events){if(events[_0x9ac2('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x9ac2('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x212f=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','save'];(function(_0x100918,_0x224f2f){var _0x11baa4=function(_0xfcc4a7){while(--_0xfcc4a7){_0x100918['push'](_0x100918['shift']());}};_0x11baa4(++_0x224f2f);}(_0x212f,0x1e5));var _0xf212=function(_0x1100cf,_0x3a6dce){_0x1100cf=_0x1100cf-0x0;var _0x51d764=_0x212f[_0x1100cf];return _0x51d764;};'use strict';var EventEmitter=require(_0xf212('0x0'));var VoiceExtension=require(_0xf212('0x1'))['db'][_0xf212('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf212('0x3')](0x0);var events={'afterCreate':_0xf212('0x4'),'afterUpdate':_0xf212('0x5'),'afterDestroy':'remove'};function emitEvent(_0xa1e219){return function(_0x58c7f7,_0x589851,_0x58251d){VoiceExtensionEvents['emit'](_0xa1e219+':'+_0x58c7f7['id'],_0x58c7f7);VoiceExtensionEvents[_0xf212('0x6')](_0xa1e219,_0x58c7f7);_0x58251d(null);};}for(var e in events){if(events[_0xf212('0x7')](e)){var event=events[e];VoiceExtension[_0xf212('0x8')](e,emitEvent(event));}}module[_0xf212('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 56ef9ed..2e1acee 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 _0xe3bd=['../../config/logger','api','request-promise','../../config/environment','exports','voice_extensions','lodash','util'];(function(_0x53b11e,_0x2a85b5){var _0x3711f7=function(_0x241154){while(--_0x241154){_0x53b11e['push'](_0x53b11e['shift']());}};_0x3711f7(++_0x2a85b5);}(_0xe3bd,0x19e));var _0xde3b=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0xe3bd[_0x4d8dc3];return _0x9b03d9;};'use strict';var _=require(_0xde3b('0x0'));var util=require(_0xde3b('0x1'));var logger=require(_0xde3b('0x2'))(_0xde3b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde3b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xde3b('0x5'));var attributes=require('./voiceExtension.attributes');module[_0xde3b('0x6')]=function(_0x1ee787,_0x3c15f2){return _0x1ee787['define']('VoiceExtension',attributes,{'tableName':_0xde3b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55df=['rimraf','../../config/environment','exports','define','VoiceExtension','lodash','../../config/logger','api','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x55df,0x1a9));var _0xf55d=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x55df[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xf55d('0x0'));var util=require('util');var logger=require(_0xf55d('0x1'))(_0xf55d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf55d('0x3'));var fs=require('fs');var path=require(_0xf55d('0x4'));var rimraf=require(_0xf55d('0x5'));var config=require(_0xf55d('0x6'));var attributes=require('./voiceExtension.attributes');module[_0xf55d('0x7')]=function(_0x2011f9,_0x19bd07){return _0x2011f9[_0xf55d('0x8')](_0xf55d('0x9'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2b572a2..78a2a7d 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 _0x9e2c=['../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x161587,_0x5c4528){var _0x293546=function(_0x40406e){while(--_0x40406e){_0x161587['push'](_0x161587['shift']());}};_0x293546(++_0x5c4528);}(_0x9e2c,0x119));var _0xc9e2=function(_0x1277e8,_0x27f64c){_0x1277e8=_0x1277e8-0x0;var _0x1031e3=_0x9e2c[_0x1277e8];return _0x1031e3;};'use strict';var _=require(_0xc9e2('0x0'));var util=require(_0xc9e2('0x1'));var moment=require(_0xc9e2('0x2'));var BPromise=require(_0xc9e2('0x3'));var rs=require(_0xc9e2('0x4'));var fs=require('fs');var Redis=require(_0xc9e2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9e2('0x6'));var logger=require(_0xc9e2('0x7'))(_0xc9e2('0x8'));var config=require(_0xc9e2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc9e2('0xa')][_0xc9e2('0xb')]({'port':0x232a});config['redis']=_[_0xc9e2('0xc')](config[_0xc9e2('0xd')],{'host':_0xc9e2('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc9e2('0xd')]));require(_0xc9e2('0xf'))[_0xc9e2('0x10')](socket);function respondWithRpcPromise(_0x3b33f6,_0x32255e,_0x27382a){return new BPromise(function(_0x5469f7,_0x4f1ffd){return client['request'](_0x3b33f6,_0x27382a)[_0xc9e2('0x11')](function(_0x78d488){logger['info'](_0xc9e2('0x12'),_0x32255e,_0xc9e2('0x13'));logger[_0xc9e2('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x32255e,_0xc9e2('0x13'),JSON[_0xc9e2('0x15')](_0x78d488));if(_0x78d488[_0xc9e2('0x16')]){if(_0x78d488[_0xc9e2('0x16')][_0xc9e2('0x17')]===0x1f4){logger[_0xc9e2('0x16')](_0xc9e2('0x12'),_0x32255e,_0x78d488[_0xc9e2('0x16')][_0xc9e2('0x18')]);return _0x4f1ffd(_0x78d488[_0xc9e2('0x16')][_0xc9e2('0x18')]);}logger['error'](_0xc9e2('0x12'),_0x32255e,_0x78d488[_0xc9e2('0x16')]['message']);return _0x5469f7(_0x78d488[_0xc9e2('0x16')][_0xc9e2('0x18')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x32255e,_0xc9e2('0x13'));_0x5469f7(_0x78d488['result'][_0xc9e2('0x18')]);}})['catch'](function(_0x4399e4){logger[_0xc9e2('0x16')](_0xc9e2('0x12'),_0x32255e,_0x4399e4);_0x4f1ffd(_0x4399e4);});});}exports[_0xc9e2('0x19')]=function(_0xb6037a){var _0x20ca75=this;return new Promise(function(_0x424bfa,_0x587b0c){return db[_0xc9e2('0x1a')][_0xc9e2('0x1b')]({'raw':_0xb6037a[_0xc9e2('0x1c')]?_0xb6037a[_0xc9e2('0x1c')][_0xc9e2('0x1d')]===undefined?!![]:![]:!![],'where':_0xb6037a['options']?_0xb6037a[_0xc9e2('0x1c')][_0xc9e2('0x1e')]||null:null,'attributes':_0xb6037a[_0xc9e2('0x1c')]?_0xb6037a[_0xc9e2('0x1c')][_0xc9e2('0x1f')]||null:null,'limit':_0xb6037a[_0xc9e2('0x1c')]?_0xb6037a['options']['limit']||null:null,'include':_0xb6037a[_0xc9e2('0x1c')]?_0xb6037a[_0xc9e2('0x1c')][_0xc9e2('0x20')]?_[_0xc9e2('0x21')](_0xb6037a[_0xc9e2('0x1c')][_0xc9e2('0x20')],function(_0x14bef9){return{'model':db[_0x14bef9['model']],'as':_0x14bef9['as'],'attributes':_0x14bef9['attributes'],'include':_0x14bef9['include']?_[_0xc9e2('0x21')](_0x14bef9[_0xc9e2('0x20')],function(_0x1457f0){return{'model':db[_0x1457f0[_0xc9e2('0x22')]],'as':_0x1457f0['as'],'attributes':_0x1457f0[_0xc9e2('0x1f')],'include':_0x1457f0[_0xc9e2('0x20')]?_[_0xc9e2('0x21')](_0x1457f0['include'],function(_0x1f13c0){return{'model':db[_0x1f13c0['model']],'as':_0x1f13c0['as'],'attributes':_0x1f13c0[_0xc9e2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc9e2('0x11')](function(_0x53d12b){logger['info']('GetVoiceExtension',_0xb6037a);logger[_0xc9e2('0x14')](_0xc9e2('0x19'),_0xb6037a,JSON[_0xc9e2('0x15')](_0x53d12b));_0x424bfa(_0x53d12b);})[_0xc9e2('0x23')](function(_0x3419af){logger[_0xc9e2('0x16')](_0xc9e2('0x19'),_0x3419af[_0xc9e2('0x18')],_0xb6037a);_0x587b0c(_0x20ca75['error'](0x1f4,_0x3419af[_0xc9e2('0x18')]));});});}; \ No newline at end of file +var _0x2111=['defaults','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','where','limit','include','model','map','attributes','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x2111,0x176));var _0x1211=function(_0x3d7a9f,_0x24e0f1){_0x3d7a9f=_0x3d7a9f-0x0;var _0x13f5f1=_0x2111[_0x3d7a9f];return _0x13f5f1;};'use strict';var _=require('lodash');var util=require(_0x1211('0x0'));var moment=require('moment');var BPromise=require(_0x1211('0x1'));var rs=require(_0x1211('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1211('0x3'))['db'];var utils=require(_0x1211('0x4'));var logger=require(_0x1211('0x5'))('rpc');var config=require(_0x1211('0x6'));var jayson=require(_0x1211('0x7'));var client=jayson[_0x1211('0x8')][_0x1211('0x9')]({'port':0x232a});config[_0x1211('0xa')]=_[_0x1211('0xb')](config[_0x1211('0xa')],{'host':_0x1211('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1211('0xa')]));require(_0x1211('0xd'))[_0x1211('0xe')](socket);function respondWithRpcPromise(_0x24156c,_0xcf1a7,_0x672ced){return new BPromise(function(_0x2ef866,_0x4221d5){return client['request'](_0x24156c,_0x672ced)[_0x1211('0xf')](function(_0x15d140){logger[_0x1211('0x10')](_0x1211('0x11'),_0xcf1a7,'request\x20sent');logger[_0x1211('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0xcf1a7,_0x1211('0x13'),JSON[_0x1211('0x14')](_0x15d140));if(_0x15d140['error']){if(_0x15d140[_0x1211('0x15')][_0x1211('0x16')]===0x1f4){logger['error'](_0x1211('0x11'),_0xcf1a7,_0x15d140[_0x1211('0x15')][_0x1211('0x17')]);return _0x4221d5(_0x15d140[_0x1211('0x15')][_0x1211('0x17')]);}logger['error'](_0x1211('0x11'),_0xcf1a7,_0x15d140[_0x1211('0x15')][_0x1211('0x17')]);return _0x2ef866(_0x15d140['error'][_0x1211('0x17')]);}else{logger[_0x1211('0x10')]('VoiceExtension,\x20%s,\x20%s',_0xcf1a7,_0x1211('0x13'));_0x2ef866(_0x15d140[_0x1211('0x18')][_0x1211('0x17')]);}})[_0x1211('0x19')](function(_0x5da2f3){logger[_0x1211('0x15')]('VoiceExtension,\x20%s,\x20%s',_0xcf1a7,_0x5da2f3);_0x4221d5(_0x5da2f3);});});}exports[_0x1211('0x1a')]=function(_0x28dd49){var _0x45d9b4=this;return new Promise(function(_0x1f5628,_0xf0f776){return db['VoiceExtension'][_0x1211('0x1b')]({'raw':_0x28dd49[_0x1211('0x1c')]?_0x28dd49[_0x1211('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x28dd49[_0x1211('0x1c')]?_0x28dd49[_0x1211('0x1c')][_0x1211('0x1d')]||null:null,'attributes':_0x28dd49[_0x1211('0x1c')]?_0x28dd49[_0x1211('0x1c')]['attributes']||null:null,'limit':_0x28dd49[_0x1211('0x1c')]?_0x28dd49[_0x1211('0x1c')][_0x1211('0x1e')]||null:null,'include':_0x28dd49['options']?_0x28dd49[_0x1211('0x1c')][_0x1211('0x1f')]?_['map'](_0x28dd49[_0x1211('0x1c')][_0x1211('0x1f')],function(_0x4f4636){return{'model':db[_0x4f4636[_0x1211('0x20')]],'as':_0x4f4636['as'],'attributes':_0x4f4636['attributes'],'include':_0x4f4636[_0x1211('0x1f')]?_[_0x1211('0x21')](_0x4f4636['include'],function(_0x477110){return{'model':db[_0x477110['model']],'as':_0x477110['as'],'attributes':_0x477110['attributes'],'include':_0x477110[_0x1211('0x1f')]?_[_0x1211('0x21')](_0x477110['include'],function(_0x27ee38){return{'model':db[_0x27ee38[_0x1211('0x20')]],'as':_0x27ee38['as'],'attributes':_0x27ee38[_0x1211('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1211('0xf')](function(_0x561299){logger[_0x1211('0x10')](_0x1211('0x1a'),_0x28dd49);logger['debug']('GetVoiceExtension',_0x28dd49,JSON[_0x1211('0x14')](_0x561299));_0x1f5628(_0x561299);})[_0x1211('0x19')](function(_0x501d47){logger[_0x1211('0x15')](_0x1211('0x1a'),_0x501d47['message'],_0x28dd49);_0xf0f776(_0x45d9b4[_0x1211('0x15')](0x1f4,_0x501d47[_0x1211('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f1d6ce9..be86359 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 _0xe6f1=['./voiceExtension.events','save','remove','update','removeListener','register','voiceExtension:'];(function(_0x16e128,_0xb7c980){var _0x158f3a=function(_0x2084f2){while(--_0x2084f2){_0x16e128['push'](_0x16e128['shift']());}};_0x158f3a(++_0xb7c980);}(_0xe6f1,0x16c));var _0x1e6f=function(_0x4cefc3,_0x23f291){_0x4cefc3=_0x4cefc3-0x0;var _0x1cc779=_0xe6f1[_0x4cefc3];return _0x1cc779;};'use strict';var VoiceExtensionEvents=require(_0x1e6f('0x0'));var events=[_0x1e6f('0x1'),_0x1e6f('0x2'),_0x1e6f('0x3')];function createListener(_0x234e71,_0x428ddc){return function(_0x18683b){_0x428ddc['emit'](_0x234e71,_0x18683b);};}function removeListener(_0x1867db,_0x3b9e47){return function(){VoiceExtensionEvents[_0x1e6f('0x4')](_0x1867db,_0x3b9e47);};}exports[_0x1e6f('0x5')]=function(_0x50af1a){for(var _0x373d7c=0x0,_0x26f4fb=events['length'];_0x373d7c<_0x26f4fb;_0x373d7c++){var _0x292c36=events[_0x373d7c];var _0x337bc6=createListener(_0x1e6f('0x6')+_0x292c36,_0x50af1a);VoiceExtensionEvents['on'](_0x292c36,_0x337bc6);}}; \ No newline at end of file +var _0x22b7=['update','removeListener','./voiceExtension.events','save'];(function(_0x204ab4,_0x4e93b5){var _0x349bf5=function(_0x558546){while(--_0x558546){_0x204ab4['push'](_0x204ab4['shift']());}};_0x349bf5(++_0x4e93b5);}(_0x22b7,0x162));var _0x722b=function(_0x5d2507,_0x556fac){_0x5d2507=_0x5d2507-0x0;var _0x198c07=_0x22b7[_0x5d2507];return _0x198c07;};'use strict';var VoiceExtensionEvents=require(_0x722b('0x0'));var events=[_0x722b('0x1'),'remove',_0x722b('0x2')];function createListener(_0x4efd40,_0x2b7e28){return function(_0x33cb15){_0x2b7e28['emit'](_0x4efd40,_0x33cb15);};}function removeListener(_0x447dbd,_0x347159){return function(){VoiceExtensionEvents[_0x722b('0x3')](_0x447dbd,_0x347159);};}exports['register']=function(_0x20fdf6){for(var _0x153671=0x0,_0x3c36b0=events['length'];_0x153671<_0x3c36b0;_0x153671++){var _0x40e6a1=events[_0x153671];var _0x3cceeb=createListener('voiceExtension:'+_0x40e6a1,_0x20fdf6);VoiceExtensionEvents['on'](_0x40e6a1,_0x3cceeb);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d9bf70c..cc55708 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 _0xf7b5=['util','path','connect-timeout','express','Router','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','post','put','update','delete','destroy','exports','multer'];(function(_0x2650f2,_0x11f046){var _0x3b1db3=function(_0x47a9c8){while(--_0x47a9c8){_0x2650f2['push'](_0x2650f2['shift']());}};_0x3b1db3(++_0x11f046);}(_0xf7b5,0x1cb));var _0x5f7b=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xf7b5[_0x264545];return _0x114d10;};'use strict';var multer=require(_0x5f7b('0x0'));var util=require(_0x5f7b('0x1'));var path=require(_0x5f7b('0x2'));var timeout=require(_0x5f7b('0x3'));var express=require(_0x5f7b('0x4'));var router=express[_0x5f7b('0x5')]();var auth=require(_0x5f7b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5f7b('0x7'));router[_0x5f7b('0x8')]('/',auth[_0x5f7b('0x9')](),controller[_0x5f7b('0xa')]);router[_0x5f7b('0x8')](_0x5f7b('0xb'),auth[_0x5f7b('0x9')](),controller[_0x5f7b('0xc')]);router[_0x5f7b('0x8')](_0x5f7b('0xd'),auth[_0x5f7b('0x9')](),controller['getMessages']);router[_0x5f7b('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5f7b('0xf')](_0x5f7b('0xb'),auth['isAuthenticated'](),controller[_0x5f7b('0x10')]);router[_0x5f7b('0x11')](_0x5f7b('0xb'),auth[_0x5f7b('0x9')](),controller[_0x5f7b('0x12')]);module[_0x5f7b('0x13')]=router; \ No newline at end of file +var _0x8ca8=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','create','put','delete','destroy','exports','multer'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x8ca8,0xe3));var _0x88ca=function(_0x53e33f,_0x2024e5){_0x53e33f=_0x53e33f-0x0;var _0x2140b0=_0x8ca8[_0x53e33f];return _0x2140b0;};'use strict';var multer=require(_0x88ca('0x0'));var util=require('util');var path=require(_0x88ca('0x1'));var timeout=require(_0x88ca('0x2'));var express=require(_0x88ca('0x3'));var router=express[_0x88ca('0x4')]();var auth=require(_0x88ca('0x5'));var interaction=require(_0x88ca('0x6'));var config=require('../../config/environment');var controller=require(_0x88ca('0x7'));router[_0x88ca('0x8')]('/',auth[_0x88ca('0x9')](),controller[_0x88ca('0xa')]);router[_0x88ca('0x8')](_0x88ca('0xb'),auth['isAuthenticated'](),controller[_0x88ca('0xc')]);router[_0x88ca('0x8')]('/:id/messages',auth[_0x88ca('0x9')](),controller[_0x88ca('0xd')]);router['post']('/',auth[_0x88ca('0x9')](),controller[_0x88ca('0xe')]);router[_0x88ca('0xf')](_0x88ca('0xb'),auth[_0x88ca('0x9')](),controller['update']);router[_0x88ca('0x10')](_0x88ca('0xb'),auth[_0x88ca('0x9')](),controller[_0x88ca('0x11')]);module[_0x88ca('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index fe429f9..f3540bb 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 _0xe5b5=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x1c22ac,_0x4c86bd){var _0x4c867a=function(_0x370c7d){while(--_0x370c7d){_0x1c22ac['push'](_0x1c22ac['shift']());}};_0x4c867a(++_0x4c86bd);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0xe5b5[_0x1b8e60];return _0x363363;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'customer_id':{'type':Sequelize[_0x5e5b('0x2')]},'context':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x3'),'unique':_0x5e5b('0x4')},'mailbox':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5e5b('0x4')},'password':{'type':Sequelize[_0x5e5b('0x2')]},'fullname':{'type':Sequelize[_0x5e5b('0x2')]},'email':{'type':Sequelize[_0x5e5b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x40bc5b){this[_0x5e5b('0x5')](_0x5e5b('0x6'),typeof _0x40bc5b===_0x5e5b('0x7')&&_0x40bc5b[_0x5e5b('0x8')]()?_0x40bc5b[_0x5e5b('0x8')]():null);}},'pager':{'type':Sequelize[_0x5e5b('0x2')]},'tz':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x9')},'attach':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':_0x5e5b('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x5e5b('0x2')]},'callback':{'type':Sequelize[_0x5e5b('0x2')]},'review':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5e5b('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5e5b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x5e5b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x5e5b('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x5e5b('0x2')]},'maxsecs':{'type':Sequelize[_0x5e5b('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5e5b('0xf')],'get':function(){return this[_0x5e5b('0x10')](_0x5e5b('0x11'))+'\x20-\x20'+this[_0x5e5b('0x10')](_0x5e5b('0x12'));}}}; \ No newline at end of file +var _0x0713=['trim','central','ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','STRING','from-voicemail','contest_mailbox','setDataValue','email','string'];(function(_0x53b50e,_0xc49361){var _0x3f8625=function(_0x4ce88b){while(--_0x4ce88b){_0x53b50e['push'](_0x53b50e['shift']());}};_0x3f8625(++_0xc49361);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0x3071('0x0')]},'context':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x1'),'unique':_0x3071('0x2')},'mailbox':{'type':Sequelize[_0x3071('0x0')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x3071('0x0')]},'fullname':{'type':Sequelize[_0x3071('0x0')]},'email':{'type':Sequelize[_0x3071('0x0')],'validate':{'isEmail':!![]},'set':function(_0x3137c8){this[_0x3071('0x3')](_0x3071('0x4'),typeof _0x3137c8===_0x3071('0x5')&&_0x3137c8[_0x3071('0x6')]()?_0x3137c8[_0x3071('0x6')]():null);}},'pager':{'type':Sequelize[_0x3071('0x0')]},'tz':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0x7')},'attach':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0x3071('0x0')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x3071('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x3071('0x8')](_0x3071('0x9'),'no'),'defaultValue':_0x3071('0x9'),'allowNull':![]},'stamp':{'type':_0x3071('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x3071('0x0')]},'maxsecs':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x3071('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x3071('0xc')],'get':function(){return this[_0x3071('0xd')](_0x3071('0xe'))+_0x3071('0xf')+this[_0x3071('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index db8e800..d50accb 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 _0x8ed7=['apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','stack','name','status','send','index','map','VoiceMail','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','rows','catch','params','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','set','Content-Range'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8ed7,0x8b));var _0x78ed=function(_0x3271b5,_0x422fbc){_0x3271b5=_0x3271b5-0x0;var _0x2fb6ce=_0x8ed7[_0x3271b5];return _0x2fb6ce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x78ed('0x0'));var rimraf=require(_0x78ed('0x1'));var zipdir=require(_0x78ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x78ed('0x3'));var BPromise=require(_0x78ed('0x4'));var Mustache=require(_0x78ed('0x5'));var util=require(_0x78ed('0x6'));var path=require(_0x78ed('0x7'));var sox=require(_0x78ed('0x8'));var csv=require(_0x78ed('0x9'));var ejs=require(_0x78ed('0xa'));var fs=require('fs');var _=require(_0x78ed('0xb'));var squel=require('squel');var crypto=require(_0x78ed('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x78ed('0xd'));var toCsv=require('to-csv');var querystring=require(_0x78ed('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78ed('0xf'));var qs=require(_0x78ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78ed('0x11'));var logger=require(_0x78ed('0x12'))('api');var utils=require(_0x78ed('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x78ed('0x14'));var db=require(_0x78ed('0x15'))['db'];function respondWithStatusCode(_0x3ec02d,_0x2cb17b){_0x2cb17b=_0x2cb17b||0xcc;return function(_0x1a5254){if(_0x1a5254){return _0x3ec02d[_0x78ed('0x16')](_0x2cb17b);}return _0x3ec02d['status'](_0x2cb17b)[_0x78ed('0x17')]();};}function respondWithResult(_0x4b97ba,_0x538306){_0x538306=_0x538306||0xc8;return function(_0x510322){if(_0x510322){return _0x4b97ba['status'](_0x538306)['json'](_0x510322);}};}function respondWithFilteredResult(_0x2e88ad,_0x272171){return function(_0x2e9007){if(_0x2e9007){var _0x195b7e=_0x2e9007[_0x78ed('0x18')],_0x250d59=_0x272171[_0x78ed('0x19')],_0x454a65=_0x272171[_0x78ed('0x19')]+_0x272171[_0x78ed('0x1a')],_0x336ae1;if(_0x454a65>=_0x195b7e){_0x454a65=_0x195b7e;_0x336ae1=0xc8;}else{_0x336ae1=0xce;}_0x2e88ad['status'](_0x336ae1);return _0x2e88ad[_0x78ed('0x1b')](_0x78ed('0x1c'),_0x250d59+'-'+_0x454a65+'/'+_0x195b7e)['json'](_0x2e9007);}return null;};}function patchUpdates(_0x47eb69){return function(_0x2868d1){try{jsonpatch[_0x78ed('0x1d')](_0x2868d1,_0x47eb69,!![]);}catch(_0x2e9e1d){return BPromise[_0x78ed('0x1e')](_0x2e9e1d);}return _0x2868d1[_0x78ed('0x1f')]();};}function saveUpdates(_0x3bd736,_0x3479ec){return function(_0xf0eeee){if(_0xf0eeee){return _0xf0eeee[_0x78ed('0x20')](_0x3bd736)[_0x78ed('0x21')](function(_0x1badbe){return _0x1badbe;});}return null;};}function removeEntity(_0x4f1edb,_0x5ee188){return function(_0x425310){if(_0x425310){return _0x425310['destroy']()[_0x78ed('0x21')](function(){var _0x55f0e8=_0x425310[_0x78ed('0x22')]({'plain':!![]});var _0x590d90=_0x78ed('0x23');return db[_0x78ed('0x24')][_0x78ed('0x25')]({'where':{'type':_0x590d90,'resourceId':_0x55f0e8['id']}})['then'](function(){return _0x425310;});})[_0x78ed('0x21')](function(){_0x4f1edb['status'](0xcc)[_0x78ed('0x17')]();});}};}function handleEntityNotFound(_0x2a4573,_0x34fb0e){return function(_0x59349a){if(!_0x59349a){_0x2a4573['sendStatus'](0x194);}return _0x59349a;};}function handleError(_0x464050,_0x575b6e){_0x575b6e=_0x575b6e||0x1f4;return function(_0x1887df){logger['error'](_0x1887df[_0x78ed('0x26')]);if(_0x1887df[_0x78ed('0x27')]){delete _0x1887df[_0x78ed('0x27')];}_0x464050[_0x78ed('0x28')](_0x575b6e)[_0x78ed('0x29')](_0x1887df);};}exports[_0x78ed('0x2a')]=function(_0x3cd100,_0x312801){var _0x10ea7d={},_0x4f6cdd={},_0x246d17={'count':0x0,'rows':[]};var _0x9b1ba6=_[_0x78ed('0x2b')](db[_0x78ed('0x2c')]['rawAttributes'],function(_0x4a8a5e){return{'name':_0x4a8a5e['fieldName'],'type':_0x4a8a5e['type'][_0x78ed('0x2d')]};});_0x4f6cdd[_0x78ed('0x2e')]=_[_0x78ed('0x2b')](_0x9b1ba6,_0x78ed('0x27'));_0x4f6cdd[_0x78ed('0x2f')]=_[_0x78ed('0x30')](_0x3cd100[_0x78ed('0x2f')]);_0x4f6cdd['filters']=_[_0x78ed('0x31')](_0x4f6cdd['model'],_0x4f6cdd[_0x78ed('0x2f')]);_0x10ea7d[_0x78ed('0x32')]=_['intersection'](_0x4f6cdd[_0x78ed('0x2e')],qs[_0x78ed('0x33')](_0x3cd100[_0x78ed('0x2f')][_0x78ed('0x33')]));_0x10ea7d[_0x78ed('0x32')]=_0x10ea7d[_0x78ed('0x32')][_0x78ed('0x34')]?_0x10ea7d[_0x78ed('0x32')]:_0x4f6cdd['model'];if(!_0x3cd100[_0x78ed('0x2f')]['hasOwnProperty'](_0x78ed('0x35'))){_0x10ea7d[_0x78ed('0x1a')]=qs[_0x78ed('0x1a')](_0x3cd100[_0x78ed('0x2f')][_0x78ed('0x1a')]);_0x10ea7d[_0x78ed('0x19')]=qs[_0x78ed('0x19')](_0x3cd100['query'][_0x78ed('0x19')]);}_0x10ea7d[_0x78ed('0x36')]=qs[_0x78ed('0x37')](_0x3cd100[_0x78ed('0x2f')][_0x78ed('0x37')]);_0x10ea7d[_0x78ed('0x38')]=qs[_0x78ed('0x39')](_[_0x78ed('0x3a')](_0x3cd100[_0x78ed('0x2f')],_0x4f6cdd[_0x78ed('0x39')]),_0x9b1ba6);if(_0x3cd100[_0x78ed('0x2f')]['filter']){_0x10ea7d['where']=_[_0x78ed('0x3b')](_0x10ea7d['where'],{'$or':_[_0x78ed('0x2b')](_0x9b1ba6,function(_0x4006fd){if(_0x4006fd['type']!==_0x78ed('0x3c')){var _0x1149c0={};_0x1149c0[_0x4006fd[_0x78ed('0x27')]]={'$like':'%'+_0x3cd100[_0x78ed('0x2f')][_0x78ed('0x3d')]+'%'};return _0x1149c0;}})});}_0x10ea7d=_[_0x78ed('0x3b')]({},_0x10ea7d,_0x3cd100['options']);var _0x5c64e4={'where':_0x10ea7d[_0x78ed('0x38')]};return db[_0x78ed('0x2c')][_0x78ed('0x18')](_0x5c64e4)['then'](function(_0x4f0db5){_0x246d17[_0x78ed('0x18')]=_0x4f0db5;if(_0x3cd100[_0x78ed('0x2f')]['includeAll']){_0x10ea7d[_0x78ed('0x3e')]=[{'all':!![]}];}return db[_0x78ed('0x2c')]['findAll'](_0x10ea7d);})['then'](function(_0xbd96b1){_0x246d17[_0x78ed('0x3f')]=_0xbd96b1;return _0x246d17;})[_0x78ed('0x21')](respondWithFilteredResult(_0x312801,_0x10ea7d))[_0x78ed('0x40')](handleError(_0x312801,null));};exports['show']=function(_0x5c42fe,_0x4ebdd6){var _0x1e1dbd={'raw':!![],'where':{'id':_0x5c42fe[_0x78ed('0x41')]['id']}},_0x547a75={};_0x547a75['model']=_[_0x78ed('0x30')](db[_0x78ed('0x2c')][_0x78ed('0x42')]);_0x547a75[_0x78ed('0x2f')]=_[_0x78ed('0x30')](_0x5c42fe['query']);_0x547a75[_0x78ed('0x39')]=_[_0x78ed('0x31')](_0x547a75[_0x78ed('0x2e')],_0x547a75[_0x78ed('0x2f')]);_0x1e1dbd[_0x78ed('0x32')]=_['intersection'](_0x547a75['model'],qs[_0x78ed('0x33')](_0x5c42fe[_0x78ed('0x2f')][_0x78ed('0x33')]));_0x1e1dbd[_0x78ed('0x32')]=_0x1e1dbd['attributes'][_0x78ed('0x34')]?_0x1e1dbd[_0x78ed('0x32')]:_0x547a75[_0x78ed('0x2e')];if(_0x5c42fe[_0x78ed('0x2f')][_0x78ed('0x43')]){_0x1e1dbd[_0x78ed('0x3e')]=[{'all':!![]}];}_0x1e1dbd=_['merge']({},_0x1e1dbd,_0x5c42fe[_0x78ed('0x44')]);return db['VoiceMail'][_0x78ed('0x45')](_0x1e1dbd)['then'](handleEntityNotFound(_0x4ebdd6,null))[_0x78ed('0x21')](respondWithResult(_0x4ebdd6,null))[_0x78ed('0x40')](handleError(_0x4ebdd6,null));};exports[_0x78ed('0x46')]=function(_0x275924,_0x329e1d){return db['VoiceMail']['create'](_0x275924[_0x78ed('0x47')],{})[_0x78ed('0x21')](function(_0x39da99){var _0x4c68f1=_0x275924[_0x78ed('0x48')][_0x78ed('0x22')]({'plain':!![]});if(!_0x4c68f1)throw new Error(_0x78ed('0x49'));if(_0x4c68f1['role']==='user'){var _0x338f48=_0x39da99['get']({'plain':!![]});var _0x1a79df=_0x78ed('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x1a79df,'userProfileId':_0x4c68f1[_0x78ed('0x4a')]},'raw':!![]})[_0x78ed('0x21')](function(_0x4ac75c){if(_0x4ac75c&&_0x4ac75c[_0x78ed('0x4b')]===0x0){return db[_0x78ed('0x24')][_0x78ed('0x46')]({'name':_0x338f48[_0x78ed('0x27')],'resourceId':_0x338f48['id'],'type':_0x4ac75c[_0x78ed('0x27')],'sectionId':_0x4ac75c['id']},{})[_0x78ed('0x21')](function(){return _0x39da99;});}else{return _0x39da99;}})[_0x78ed('0x40')](function(_0x25920b){logger[_0x78ed('0x4c')](_0x78ed('0x4d'),_0x25920b);throw _0x25920b;});}return _0x39da99;})[_0x78ed('0x21')](respondWithResult(_0x329e1d,0xc9))['catch'](handleError(_0x329e1d,null));};exports[_0x78ed('0x20')]=function(_0x2ff779,_0x540a2d){if(_0x2ff779[_0x78ed('0x47')]['id']){delete _0x2ff779[_0x78ed('0x47')]['id'];}return db[_0x78ed('0x2c')][_0x78ed('0x45')]({'where':{'id':_0x2ff779[_0x78ed('0x41')]['id']}})['then'](handleEntityNotFound(_0x540a2d,null))[_0x78ed('0x21')](saveUpdates(_0x2ff779['body'],null))[_0x78ed('0x21')](respondWithResult(_0x540a2d,null))[_0x78ed('0x40')](handleError(_0x540a2d,null));};exports[_0x78ed('0x25')]=function(_0x3eae51,_0x3d5862){return db[_0x78ed('0x2c')]['find']({'where':{'id':_0x3eae51['params']['id']}})[_0x78ed('0x21')](handleEntityNotFound(_0x3d5862,null))['then'](removeEntity(_0x3d5862,null))[_0x78ed('0x40')](handleError(_0x3d5862,null));};exports[_0x78ed('0x4e')]=function(_0x2afe98,_0x369a3b,_0x5658b5){return db[_0x78ed('0x2c')][_0x78ed('0x4f')]({'where':{'id':_0x2afe98[_0x78ed('0x41')]['id']}})[_0x78ed('0x21')](handleEntityNotFound(_0x369a3b,null))[_0x78ed('0x21')](function(_0x53709d){var _0x5df4f6;var _0x2feb17={},_0x39d7b8={};_0x39d7b8['model']=_[_0x78ed('0x30')](db[_0x78ed('0x50')][_0x78ed('0x42')]);_0x39d7b8['query']=_[_0x78ed('0x30')](_0x2afe98['query']);_0x39d7b8[_0x78ed('0x39')]=_['intersection'](_0x39d7b8['model'],_0x39d7b8[_0x78ed('0x2f')]);_0x2feb17[_0x78ed('0x32')]=_[_0x78ed('0x31')](_0x39d7b8[_0x78ed('0x2e')],qs[_0x78ed('0x33')](_0x2afe98[_0x78ed('0x2f')][_0x78ed('0x33')]));_0x2feb17[_0x78ed('0x32')]=_0x2feb17[_0x78ed('0x32')][_0x78ed('0x34')]?_0x2feb17[_0x78ed('0x32')]:_0x39d7b8[_0x78ed('0x2e')];if(!_0x2afe98['query'][_0x78ed('0x51')](_0x78ed('0x35'))){_0x2feb17[_0x78ed('0x1a')]=qs['limit'](_0x2afe98['query'][_0x78ed('0x1a')]);_0x2feb17[_0x78ed('0x19')]=qs[_0x78ed('0x19')](_0x2afe98[_0x78ed('0x2f')][_0x78ed('0x19')]);}_0x2feb17['order']=qs[_0x78ed('0x37')](_0x2afe98[_0x78ed('0x2f')][_0x78ed('0x37')]);_0x2feb17['where']=qs[_0x78ed('0x39')](_[_0x78ed('0x3a')](_0x2afe98[_0x78ed('0x2f')],_0x39d7b8[_0x78ed('0x39')]));if(_0x2afe98[_0x78ed('0x2f')][_0x78ed('0x3d')]){_0x2feb17[_0x78ed('0x38')]=_[_0x78ed('0x3b')](_0x2feb17[_0x78ed('0x38')],{'$or':_['map'](_0x2feb17[_0x78ed('0x32')],function(_0x413c35){var _0x3fa09e={};_0x3fa09e[_0x413c35]={'$like':'%'+_0x2afe98[_0x78ed('0x2f')][_0x78ed('0x3d')]+'%'};return _0x3fa09e;})});}_0x2feb17[_0x78ed('0x38')]=_[_0x78ed('0x3b')](_0x2feb17['where'],{'mailboxuser':_0x53709d[_0x78ed('0x52')]});_0x2feb17=_[_0x78ed('0x3b')]({},_0x2feb17,_0x2afe98[_0x78ed('0x44')]);return db['VoiceMailMessage'][_0x78ed('0x53')](_0x2feb17)[_0x78ed('0x21')](respondWithFilteredResult(_0x369a3b,_0x2feb17));})[_0x78ed('0x40')](handleError(_0x369a3b,null));}; \ No newline at end of file +var _0xab75=['options','includeAll','include','findAll','rows','catch','show','params','intersection','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','destroy','getMessages','findOne','VoiceMailMessage','pick','mailbox','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','Voicemails','UserProfileResource','error','stack','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','map','query','keys','filters','model','fields','attributes','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL'];(function(_0x1e4e22,_0x567aad){var _0x5a26ea=function(_0x1f9afd){while(--_0x1f9afd){_0x1e4e22['push'](_0x1e4e22['shift']());}};_0x5a26ea(++_0x567aad);}(_0xab75,0x11f));var _0x5ab7=function(_0x2ec15c,_0x1d45d3){_0x2ec15c=_0x2ec15c-0x0;var _0x40d942=_0xab75[_0x2ec15c];return _0x40d942;};'use strict';var pdf=require(_0x5ab7('0x0'));var emlformat=require(_0x5ab7('0x1'));var rimraf=require(_0x5ab7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5ab7('0x3'));var moment=require(_0x5ab7('0x4'));var BPromise=require(_0x5ab7('0x5'));var Mustache=require('mustache');var util=require(_0x5ab7('0x6'));var path=require(_0x5ab7('0x7'));var sox=require(_0x5ab7('0x8'));var csv=require(_0x5ab7('0x9'));var ejs=require(_0x5ab7('0xa'));var fs=require('fs');var _=require(_0x5ab7('0xb'));var squel=require(_0x5ab7('0xc'));var crypto=require(_0x5ab7('0xd'));var jsforce=require(_0x5ab7('0xe'));var deskjs=require(_0x5ab7('0xf'));var toCsv=require(_0x5ab7('0x9'));var querystring=require('querystring');var Papa=require(_0x5ab7('0x10'));var Redis=require(_0x5ab7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5ab7('0x12'));var as=require(_0x5ab7('0x13'));var hardwareService=require(_0x5ab7('0x14'));var logger=require(_0x5ab7('0x15'))(_0x5ab7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ab7('0x17'));var db=require(_0x5ab7('0x18'))['db'];function respondWithStatusCode(_0x574502,_0x457c24){_0x457c24=_0x457c24||0xcc;return function(_0x1d6ae0){if(_0x1d6ae0){return _0x574502[_0x5ab7('0x19')](_0x457c24);}return _0x574502[_0x5ab7('0x1a')](_0x457c24)[_0x5ab7('0x1b')]();};}function respondWithResult(_0x350bd9,_0xdca16b){_0xdca16b=_0xdca16b||0xc8;return function(_0xd3255d){if(_0xd3255d){return _0x350bd9['status'](_0xdca16b)[_0x5ab7('0x1c')](_0xd3255d);}};}function respondWithFilteredResult(_0x10daf0,_0x477d0d){return function(_0x456a4b){if(_0x456a4b){var _0x3ad6c9=_0x456a4b[_0x5ab7('0x1d')],_0x3a973d=_0x477d0d[_0x5ab7('0x1e')],_0x361c60=_0x477d0d['offset']+_0x477d0d[_0x5ab7('0x1f')],_0x2a126c;if(_0x361c60>=_0x3ad6c9){_0x361c60=_0x3ad6c9;_0x2a126c=0xc8;}else{_0x2a126c=0xce;}_0x10daf0[_0x5ab7('0x1a')](_0x2a126c);return _0x10daf0[_0x5ab7('0x20')]('Content-Range',_0x3a973d+'-'+_0x361c60+'/'+_0x3ad6c9)[_0x5ab7('0x1c')](_0x456a4b);}return null;};}function patchUpdates(_0x111aa1){return function(_0xf0a8a9){try{jsonpatch[_0x5ab7('0x21')](_0xf0a8a9,_0x111aa1,!![]);}catch(_0x4b9182){return BPromise[_0x5ab7('0x22')](_0x4b9182);}return _0xf0a8a9[_0x5ab7('0x23')]();};}function saveUpdates(_0x38dc30,_0x1975fc){return function(_0x4e31c6){if(_0x4e31c6){return _0x4e31c6[_0x5ab7('0x24')](_0x38dc30)['then'](function(_0x1f2831){return _0x1f2831;});}return null;};}function removeEntity(_0x1ed9b9,_0x44bda3){return function(_0x5eca9d){if(_0x5eca9d){return _0x5eca9d['destroy']()[_0x5ab7('0x25')](function(){var _0x5519c3=_0x5eca9d[_0x5ab7('0x26')]({'plain':!![]});var _0x6d36b5=_0x5ab7('0x27');return db[_0x5ab7('0x28')]['destroy']({'where':{'type':_0x6d36b5,'resourceId':_0x5519c3['id']}})[_0x5ab7('0x25')](function(){return _0x5eca9d;});})[_0x5ab7('0x25')](function(){_0x1ed9b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x158235,_0x4a2d92){return function(_0x57341a){if(!_0x57341a){_0x158235[_0x5ab7('0x19')](0x194);}return _0x57341a;};}function handleError(_0x166c85,_0x4198b7){_0x4198b7=_0x4198b7||0x1f4;return function(_0x25bf65){logger[_0x5ab7('0x29')](_0x25bf65[_0x5ab7('0x2a')]);if(_0x25bf65[_0x5ab7('0x2b')]){delete _0x25bf65['name'];}_0x166c85[_0x5ab7('0x1a')](_0x4198b7)[_0x5ab7('0x2c')](_0x25bf65);};}exports[_0x5ab7('0x2d')]=function(_0x275ddd,_0x5c0c4c){var _0x4e4b14={},_0x1cddec={},_0x364d26={'count':0x0,'rows':[]};var _0x39baa9=_['map'](db[_0x5ab7('0x2e')][_0x5ab7('0x2f')],function(_0x51ae7a){return{'name':_0x51ae7a[_0x5ab7('0x30')],'type':_0x51ae7a[_0x5ab7('0x31')][_0x5ab7('0x32')]};});_0x1cddec['model']=_[_0x5ab7('0x33')](_0x39baa9,_0x5ab7('0x2b'));_0x1cddec[_0x5ab7('0x34')]=_[_0x5ab7('0x35')](_0x275ddd[_0x5ab7('0x34')]);_0x1cddec[_0x5ab7('0x36')]=_['intersection'](_0x1cddec[_0x5ab7('0x37')],_0x1cddec['query']);_0x4e4b14['attributes']=_['intersection'](_0x1cddec[_0x5ab7('0x37')],qs[_0x5ab7('0x38')](_0x275ddd[_0x5ab7('0x34')][_0x5ab7('0x38')]));_0x4e4b14['attributes']=_0x4e4b14[_0x5ab7('0x39')]['length']?_0x4e4b14[_0x5ab7('0x39')]:_0x1cddec[_0x5ab7('0x37')];if(!_0x275ddd['query'][_0x5ab7('0x3a')](_0x5ab7('0x3b'))){_0x4e4b14[_0x5ab7('0x1f')]=qs[_0x5ab7('0x1f')](_0x275ddd['query'][_0x5ab7('0x1f')]);_0x4e4b14[_0x5ab7('0x1e')]=qs[_0x5ab7('0x1e')](_0x275ddd[_0x5ab7('0x34')][_0x5ab7('0x1e')]);}_0x4e4b14['order']=qs[_0x5ab7('0x3c')](_0x275ddd[_0x5ab7('0x34')][_0x5ab7('0x3c')]);_0x4e4b14[_0x5ab7('0x3d')]=qs[_0x5ab7('0x36')](_['pick'](_0x275ddd[_0x5ab7('0x34')],_0x1cddec[_0x5ab7('0x36')]),_0x39baa9);if(_0x275ddd[_0x5ab7('0x34')][_0x5ab7('0x3e')]){_0x4e4b14[_0x5ab7('0x3d')]=_[_0x5ab7('0x3f')](_0x4e4b14[_0x5ab7('0x3d')],{'$or':_[_0x5ab7('0x33')](_0x39baa9,function(_0x5c5a03){if(_0x5c5a03[_0x5ab7('0x31')]!==_0x5ab7('0x40')){var _0x20f0a7={};_0x20f0a7[_0x5c5a03['name']]={'$like':'%'+_0x275ddd['query'][_0x5ab7('0x3e')]+'%'};return _0x20f0a7;}})});}_0x4e4b14=_['merge']({},_0x4e4b14,_0x275ddd[_0x5ab7('0x41')]);var _0x1c612c={'where':_0x4e4b14[_0x5ab7('0x3d')]};return db[_0x5ab7('0x2e')][_0x5ab7('0x1d')](_0x1c612c)['then'](function(_0x58ea18){_0x364d26[_0x5ab7('0x1d')]=_0x58ea18;if(_0x275ddd[_0x5ab7('0x34')][_0x5ab7('0x42')]){_0x4e4b14[_0x5ab7('0x43')]=[{'all':!![]}];}return db[_0x5ab7('0x2e')][_0x5ab7('0x44')](_0x4e4b14);})[_0x5ab7('0x25')](function(_0x3f8a02){_0x364d26[_0x5ab7('0x45')]=_0x3f8a02;return _0x364d26;})[_0x5ab7('0x25')](respondWithFilteredResult(_0x5c0c4c,_0x4e4b14))[_0x5ab7('0x46')](handleError(_0x5c0c4c,null));};exports[_0x5ab7('0x47')]=function(_0xb492eb,_0x3c0c0d){var _0x56ede2={'raw':!![],'where':{'id':_0xb492eb[_0x5ab7('0x48')]['id']}},_0x5429e1={};_0x5429e1[_0x5ab7('0x37')]=_[_0x5ab7('0x35')](db[_0x5ab7('0x2e')]['rawAttributes']);_0x5429e1['query']=_[_0x5ab7('0x35')](_0xb492eb['query']);_0x5429e1[_0x5ab7('0x36')]=_[_0x5ab7('0x49')](_0x5429e1[_0x5ab7('0x37')],_0x5429e1['query']);_0x56ede2[_0x5ab7('0x39')]=_['intersection'](_0x5429e1['model'],qs[_0x5ab7('0x38')](_0xb492eb[_0x5ab7('0x34')][_0x5ab7('0x38')]));_0x56ede2[_0x5ab7('0x39')]=_0x56ede2[_0x5ab7('0x39')][_0x5ab7('0x4a')]?_0x56ede2[_0x5ab7('0x39')]:_0x5429e1['model'];if(_0xb492eb['query'][_0x5ab7('0x42')]){_0x56ede2[_0x5ab7('0x43')]=[{'all':!![]}];}_0x56ede2=_[_0x5ab7('0x3f')]({},_0x56ede2,_0xb492eb[_0x5ab7('0x41')]);return db[_0x5ab7('0x2e')][_0x5ab7('0x4b')](_0x56ede2)[_0x5ab7('0x25')](handleEntityNotFound(_0x3c0c0d,null))[_0x5ab7('0x25')](respondWithResult(_0x3c0c0d,null))[_0x5ab7('0x46')](handleError(_0x3c0c0d,null));};exports[_0x5ab7('0x4c')]=function(_0x2c5a21,_0x308c8b){return db[_0x5ab7('0x2e')][_0x5ab7('0x4c')](_0x2c5a21[_0x5ab7('0x4d')],{})[_0x5ab7('0x25')](function(_0x55e231){var _0x2679c2=_0x2c5a21['user'][_0x5ab7('0x26')]({'plain':!![]});if(!_0x2679c2)throw new Error(_0x5ab7('0x4e'));if(_0x2679c2['role']===_0x5ab7('0x4f')){var _0x468224=_0x55e231[_0x5ab7('0x26')]({'plain':!![]});var _0x5a533c='Voicemails';return db['UserProfileSection'][_0x5ab7('0x4b')]({'where':{'name':_0x5a533c,'userProfileId':_0x2679c2[_0x5ab7('0x50')]},'raw':!![]})[_0x5ab7('0x25')](function(_0x1198dc){if(_0x1198dc&&_0x1198dc[_0x5ab7('0x51')]===0x0){return db[_0x5ab7('0x28')][_0x5ab7('0x4c')]({'name':_0x468224[_0x5ab7('0x2b')],'resourceId':_0x468224['id'],'type':_0x1198dc[_0x5ab7('0x2b')],'sectionId':_0x1198dc['id']},{})[_0x5ab7('0x25')](function(){return _0x55e231;});}else{return _0x55e231;}})[_0x5ab7('0x46')](function(_0x3020bf){logger[_0x5ab7('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3020bf);throw _0x3020bf;});}return _0x55e231;})[_0x5ab7('0x25')](respondWithResult(_0x308c8b,0xc9))[_0x5ab7('0x46')](handleError(_0x308c8b,null));};exports[_0x5ab7('0x24')]=function(_0x14c5ad,_0x177687){if(_0x14c5ad['body']['id']){delete _0x14c5ad[_0x5ab7('0x4d')]['id'];}return db[_0x5ab7('0x2e')][_0x5ab7('0x4b')]({'where':{'id':_0x14c5ad[_0x5ab7('0x48')]['id']}})[_0x5ab7('0x25')](handleEntityNotFound(_0x177687,null))[_0x5ab7('0x25')](saveUpdates(_0x14c5ad[_0x5ab7('0x4d')],null))['then'](respondWithResult(_0x177687,null))[_0x5ab7('0x46')](handleError(_0x177687,null));};exports[_0x5ab7('0x52')]=function(_0x4b5704,_0x3ea90a){return db['VoiceMail'][_0x5ab7('0x4b')]({'where':{'id':_0x4b5704[_0x5ab7('0x48')]['id']}})[_0x5ab7('0x25')](handleEntityNotFound(_0x3ea90a,null))[_0x5ab7('0x25')](removeEntity(_0x3ea90a,null))[_0x5ab7('0x46')](handleError(_0x3ea90a,null));};exports[_0x5ab7('0x53')]=function(_0x1c0698,_0x32d74f,_0x524aa9){return db[_0x5ab7('0x2e')][_0x5ab7('0x54')]({'where':{'id':_0x1c0698[_0x5ab7('0x48')]['id']}})[_0x5ab7('0x25')](handleEntityNotFound(_0x32d74f,null))[_0x5ab7('0x25')](function(_0x334017){var _0x32c951;var _0x60d7d4={},_0x7c32d={};_0x7c32d['model']=_['keys'](db[_0x5ab7('0x55')][_0x5ab7('0x2f')]);_0x7c32d[_0x5ab7('0x34')]=_[_0x5ab7('0x35')](_0x1c0698['query']);_0x7c32d[_0x5ab7('0x36')]=_[_0x5ab7('0x49')](_0x7c32d[_0x5ab7('0x37')],_0x7c32d[_0x5ab7('0x34')]);_0x60d7d4[_0x5ab7('0x39')]=_[_0x5ab7('0x49')](_0x7c32d[_0x5ab7('0x37')],qs[_0x5ab7('0x38')](_0x1c0698[_0x5ab7('0x34')]['fields']));_0x60d7d4[_0x5ab7('0x39')]=_0x60d7d4[_0x5ab7('0x39')][_0x5ab7('0x4a')]?_0x60d7d4[_0x5ab7('0x39')]:_0x7c32d[_0x5ab7('0x37')];if(!_0x1c0698['query'][_0x5ab7('0x3a')]('nolimit')){_0x60d7d4['limit']=qs['limit'](_0x1c0698[_0x5ab7('0x34')][_0x5ab7('0x1f')]);_0x60d7d4[_0x5ab7('0x1e')]=qs['offset'](_0x1c0698[_0x5ab7('0x34')][_0x5ab7('0x1e')]);}_0x60d7d4['order']=qs['sort'](_0x1c0698[_0x5ab7('0x34')][_0x5ab7('0x3c')]);_0x60d7d4['where']=qs[_0x5ab7('0x36')](_[_0x5ab7('0x56')](_0x1c0698[_0x5ab7('0x34')],_0x7c32d['filters']));if(_0x1c0698[_0x5ab7('0x34')][_0x5ab7('0x3e')]){_0x60d7d4[_0x5ab7('0x3d')]=_[_0x5ab7('0x3f')](_0x60d7d4[_0x5ab7('0x3d')],{'$or':_[_0x5ab7('0x33')](_0x60d7d4[_0x5ab7('0x39')],function(_0x1c411c){var _0x522d28={};_0x522d28[_0x1c411c]={'$like':'%'+_0x1c0698[_0x5ab7('0x34')][_0x5ab7('0x3e')]+'%'};return _0x522d28;})});}_0x60d7d4['where']=_[_0x5ab7('0x3f')](_0x60d7d4[_0x5ab7('0x3d')],{'mailboxuser':_0x334017[_0x5ab7('0x57')]});_0x60d7d4=_['merge']({},_0x60d7d4,_0x1c0698[_0x5ab7('0x41')]);return db[_0x5ab7('0x55')]['findAndCountAll'](_0x60d7d4)['then'](respondWithFilteredResult(_0x32d74f,_0x60d7d4));})[_0x5ab7('0x46')](handleError(_0x32d74f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 1dfa0fb..29bf988 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 _0xd9aa=['define','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMail.attributes'];(function(_0x297ea6,_0x1f783d){var _0x22024b=function(_0xae32c7){while(--_0xae32c7){_0x297ea6['push'](_0x297ea6['shift']());}};_0x22024b(++_0x1f783d);}(_0xd9aa,0x93));var _0xad9a=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xd9aa[_0x22b68a];return _0x1ac67a;};'use strict';var _=require(_0xad9a('0x0'));var util=require(_0xad9a('0x1'));var logger=require(_0xad9a('0x2'))(_0xad9a('0x3'));var moment=require(_0xad9a('0x4'));var BPromise=require(_0xad9a('0x5'));var rp=require(_0xad9a('0x6'));var fs=require('fs');var path=require(_0xad9a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xad9a('0x8'));module['exports']=function(_0x4d7e7b,_0x14a90){return _0x4d7e7b[_0xad9a('0x9')]('VoiceMail',attributes,{'tableName':_0xad9a('0xa'),'paranoid':![],'indexes':[{'name':_0xad9a('0xb'),'fields':['mailbox',_0xad9a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb46c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','mailbox','context','lodash','../../config/logger','api'];(function(_0x4ef7bc,_0x1e8207){var _0x30a74f=function(_0x5c728e){while(--_0x5c728e){_0x4ef7bc['push'](_0x4ef7bc['shift']());}};_0x30a74f(++_0x1e8207);}(_0xb46c,0x17d));var _0xcb46=function(_0x3a0f53,_0x386552){_0x3a0f53=_0x3a0f53-0x0;var _0x1b1106=_0xb46c[_0x3a0f53];return _0x1b1106;};'use strict';var _=require(_0xcb46('0x0'));var util=require('util');var logger=require(_0xcb46('0x1'))(_0xcb46('0x2'));var moment=require(_0xcb46('0x3'));var BPromise=require(_0xcb46('0x4'));var rp=require(_0xcb46('0x5'));var fs=require('fs');var path=require(_0xcb46('0x6'));var rimraf=require(_0xcb46('0x7'));var config=require(_0xcb46('0x8'));var attributes=require(_0xcb46('0x9'));module[_0xcb46('0xa')]=function(_0x5b3899,_0x1ee554){return _0x5b3899[_0xcb46('0xb')](_0xcb46('0xc'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xcb46('0xd'),'fields':[_0xcb46('0xe'),_0xcb46('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 7b2a9f1..e1acedf 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 _0x1a1e=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x32a8,_0x36a3b0){var _0x4be89b=function(_0x5cccd3){while(--_0x5cccd3){_0x32a8['push'](_0x32a8['shift']());}};_0x4be89b(++_0x36a3b0);}(_0x1a1e,0xe4));var _0xe1a1=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x1a1e[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0xe1a1('0x0'));var util=require(_0xe1a1('0x1'));var moment=require('moment');var BPromise=require(_0xe1a1('0x2'));var rs=require(_0xe1a1('0x3'));var fs=require('fs');var Redis=require(_0xe1a1('0x4'));var db=require(_0xe1a1('0x5'))['db'];var utils=require(_0xe1a1('0x6'));var logger=require('../../config/logger')(_0xe1a1('0x7'));var config=require(_0xe1a1('0x8'));var jayson=require(_0xe1a1('0x9'));var client=jayson[_0xe1a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe7985,_0x23bf8e,_0x4ce076){return new BPromise(function(_0x95fa7b,_0x4ca78e){return client[_0xe1a1('0xb')](_0xe7985,_0x4ce076)[_0xe1a1('0xc')](function(_0x532b00){logger[_0xe1a1('0xd')](_0xe1a1('0xe'),_0x23bf8e,_0xe1a1('0xf'));logger[_0xe1a1('0x10')](_0xe1a1('0x11'),_0x23bf8e,_0xe1a1('0xf'),JSON[_0xe1a1('0x12')](_0x532b00));if(_0x532b00[_0xe1a1('0x13')]){if(_0x532b00[_0xe1a1('0x13')][_0xe1a1('0x14')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x23bf8e,_0x532b00[_0xe1a1('0x13')][_0xe1a1('0x15')]);return _0x4ca78e(_0x532b00[_0xe1a1('0x13')][_0xe1a1('0x15')]);}logger[_0xe1a1('0x13')]('VoiceMail,\x20%s,\x20%s',_0x23bf8e,_0x532b00[_0xe1a1('0x13')]['message']);return _0x95fa7b(_0x532b00[_0xe1a1('0x13')][_0xe1a1('0x15')]);}else{logger['info'](_0xe1a1('0xe'),_0x23bf8e,_0xe1a1('0xf'));_0x95fa7b(_0x532b00[_0xe1a1('0x16')][_0xe1a1('0x15')]);}})[_0xe1a1('0x17')](function(_0x59ac36){logger[_0xe1a1('0x13')](_0xe1a1('0xe'),_0x23bf8e,_0x59ac36);_0x4ca78e(_0x59ac36);});});} \ No newline at end of file +var _0x7272=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x438125,_0x9388ed){var _0x46775c=function(_0x128518){while(--_0x128518){_0x438125['push'](_0x438125['shift']());}};_0x46775c(++_0x9388ed);}(_0x7272,0x125));var _0x2727=function(_0x537960,_0x3f0594){_0x537960=_0x537960-0x0;var _0x204e78=_0x7272[_0x537960];return _0x204e78;};'use strict';var _=require('lodash');var util=require(_0x2727('0x0'));var moment=require(_0x2727('0x1'));var BPromise=require(_0x2727('0x2'));var rs=require(_0x2727('0x3'));var fs=require('fs');var Redis=require(_0x2727('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2727('0x5'))(_0x2727('0x6'));var config=require(_0x2727('0x7'));var jayson=require(_0x2727('0x8'));var client=jayson[_0x2727('0x9')][_0x2727('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x329e86,_0xb4fc60,_0x565cfc){return new BPromise(function(_0x362c2a,_0x2b97a7){return client[_0x2727('0xb')](_0x329e86,_0x565cfc)[_0x2727('0xc')](function(_0x53f2a7){logger[_0x2727('0xd')]('VoiceMail,\x20%s,\x20%s',_0xb4fc60,_0x2727('0xe'));logger[_0x2727('0xf')](_0x2727('0x10'),_0xb4fc60,_0x2727('0xe'),JSON[_0x2727('0x11')](_0x53f2a7));if(_0x53f2a7[_0x2727('0x12')]){if(_0x53f2a7['error'][_0x2727('0x13')]===0x1f4){logger[_0x2727('0x12')]('VoiceMail,\x20%s,\x20%s',_0xb4fc60,_0x53f2a7['error']['message']);return _0x2b97a7(_0x53f2a7[_0x2727('0x12')]['message']);}logger[_0x2727('0x12')](_0x2727('0x14'),_0xb4fc60,_0x53f2a7[_0x2727('0x12')][_0x2727('0x15')]);return _0x362c2a(_0x53f2a7[_0x2727('0x12')][_0x2727('0x15')]);}else{logger[_0x2727('0xd')]('VoiceMail,\x20%s,\x20%s',_0xb4fc60,_0x2727('0xe'));_0x362c2a(_0x53f2a7[_0x2727('0x16')][_0x2727('0x15')]);}})['catch'](function(_0x11c790){logger[_0x2727('0x12')](_0x2727('0x14'),_0xb4fc60,_0x11c790);_0x2b97a7(_0x11c790);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 22e8a23..3699e4a 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 _0xf494=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x57fd62,_0x3afae1){var _0x53ac0d=function(_0x340dec){while(--_0x340dec){_0x57fd62['push'](_0x57fd62['shift']());}};_0x53ac0d(++_0x3afae1);}(_0xf494,0x1c6));var _0x4f49=function(_0x4cdde0,_0xce35f3){_0x4cdde0=_0x4cdde0-0x0;var _0x782faa=_0xf494[_0x4cdde0];return _0x782faa;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var auth=require(_0x4f49('0x5'));var interaction=require(_0x4f49('0x6'));var config=require(_0x4f49('0x7'));var controller=require(_0x4f49('0x8'));router[_0x4f49('0x9')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0xb')]);router[_0x4f49('0x9')](_0x4f49('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x4f49('0x9')](_0x4f49('0xd'),auth[_0x4f49('0xa')](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')]('/',auth[_0x4f49('0xa')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')]('/:id',auth[_0x4f49('0xa')](),controller[_0x4f49('0x12')]);router['delete'](_0x4f49('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4f49('0x13')]=router; \ No newline at end of file +var _0x5fab=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','download','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x24c392,_0x2e5f85){var _0x4c0c4a=function(_0x47ec2c){while(--_0x47ec2c){_0x24c392['push'](_0x24c392['shift']());}};_0x4c0c4a(++_0x2e5f85);}(_0x5fab,0x177));var _0xb5fa=function(_0x3b8139,_0x459b80){_0x3b8139=_0x3b8139-0x0;var _0x5143a4=_0x5fab[_0x3b8139];return _0x5143a4;};'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 auth=require(_0xb5fa('0x5'));var interaction=require(_0xb5fa('0x6'));var config=require(_0xb5fa('0x7'));var controller=require(_0xb5fa('0x8'));router[_0xb5fa('0x9')]('/',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xb')]);router['get']('/:id',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xc')]);router[_0xb5fa('0x9')]('/:id/download',auth[_0xb5fa('0xa')](),controller[_0xb5fa('0xd')]);router[_0xb5fa('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb5fa('0xf')](_0xb5fa('0x10'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x11')]);router[_0xb5fa('0x12')](_0xb5fa('0x10'),auth[_0xb5fa('0xa')](),controller[_0xb5fa('0x13')]);module[_0xb5fa('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index cf963e4..fd41cd8 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 _0xe1fb=['exports','VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','sequelize'];(function(_0x483248,_0x58870b){var _0x2018f6=function(_0x3b2509){while(--_0x3b2509){_0x483248['push'](_0x483248['shift']());}};_0x2018f6(++_0x58870b);}(_0xe1fb,0x117));var _0xbe1f=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe1fb[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xbe1f('0x0'));module[_0xbe1f('0x1')]={'name':{'type':Sequelize[_0xbe1f('0x2')],'get':function(_0x1618af){return this[_0xbe1f('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xbe1f('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xbe1f('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xbe1f('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xbe1f('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xbe1f('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xbe1f('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xbe1f('0x5')](_0xbe1f('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xbe1f('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xbe1f('0x4')],'defaultValue':''},'stamp':{'type':_0xbe1f('0x7'),'allowNull':![]}}; \ No newline at end of file +var _0xd513=['BLOB','long','TIMESTAMP','exports','VIRTUAL','STRING'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0xd513,0x171));var _0x3d51=function(_0xadf244,_0x3baddd){_0xadf244=_0xadf244-0x0;var _0x3c6b13=_0xd513[_0xadf244];return _0x3c6b13;};'use strict';var Sequelize=require('sequelize');module[_0x3d51('0x0')]={'name':{'type':Sequelize[_0x3d51('0x1')],'get':function(_0x579290){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3d51('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x3d51('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x3d51('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0x3d51('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x3d51('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3d51('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x3d51('0x3')](_0x3d51('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x3d51('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3d51('0x2')],'defaultValue':''},'stamp':{'type':_0x3d51('0x5'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 18576c5..551c23e 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 _0xb126=['rows','catch','show','params','keys','intersection','find','create','body','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','recording','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','fields','attributes','length','sort','filter','where','merge','options','includeAll','findAll'];(function(_0xf2ae84,_0xf0eb22){var _0x420815=function(_0x1d5ef3){while(--_0x1d5ef3){_0xf2ae84['push'](_0xf2ae84['shift']());}};_0x420815(++_0xf0eb22);}(_0xb126,0x108));var _0x6b12=function(_0x1dda8c,_0x10f95a){_0x1dda8c=_0x1dda8c-0x0;var _0x930f3=_0xb126[_0x1dda8c];return _0x930f3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b12('0x0'));var rimraf=require(_0x6b12('0x1'));var zipdir=require(_0x6b12('0x2'));var jsonpatch=require(_0x6b12('0x3'));var rp=require(_0x6b12('0x4'));var moment=require(_0x6b12('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6b12('0x6'));var util=require(_0x6b12('0x7'));var path=require(_0x6b12('0x8'));var sox=require(_0x6b12('0x9'));var csv=require(_0x6b12('0xa'));var ejs=require(_0x6b12('0xb'));var fs=require('fs');var _=require(_0x6b12('0xc'));var squel=require(_0x6b12('0xd'));var crypto=require('crypto');var jsforce=require(_0x6b12('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6b12('0xa'));var querystring=require(_0x6b12('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b12('0x10'));var authService=require(_0x6b12('0x11'));var qs=require(_0x6b12('0x12'));var as=require(_0x6b12('0x13'));var hardwareService=require(_0x6b12('0x14'));var logger=require(_0x6b12('0x15'))(_0x6b12('0x16'));var utils=require('../../config/utils');var config=require(_0x6b12('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b12('0x18'))['db'];function respondWithStatusCode(_0xdcce62,_0x19d37c){_0x19d37c=_0x19d37c||0xcc;return function(_0x3b6990){if(_0x3b6990){return _0xdcce62[_0x6b12('0x19')](_0x19d37c);}return _0xdcce62['status'](_0x19d37c)[_0x6b12('0x1a')]();};}function respondWithResult(_0x4f4818,_0x10aae9){_0x10aae9=_0x10aae9||0xc8;return function(_0x5c2170){if(_0x5c2170){return _0x4f4818[_0x6b12('0x1b')](_0x10aae9)['json'](_0x5c2170);}};}function respondWithFilteredResult(_0xe1d0a9,_0xa4bbc9){return function(_0x5a0785){if(_0x5a0785){var _0x521983=_0x5a0785[_0x6b12('0x1c')],_0x3055d6=_0xa4bbc9[_0x6b12('0x1d')],_0x11c422=_0xa4bbc9[_0x6b12('0x1d')]+_0xa4bbc9[_0x6b12('0x1e')],_0x3d9ad9;if(_0x11c422>=_0x521983){_0x11c422=_0x521983;_0x3d9ad9=0xc8;}else{_0x3d9ad9=0xce;}_0xe1d0a9['status'](_0x3d9ad9);return _0xe1d0a9[_0x6b12('0x1f')]('Content-Range',_0x3055d6+'-'+_0x11c422+'/'+_0x521983)[_0x6b12('0x20')](_0x5a0785);}return null;};}function patchUpdates(_0x36d697){return function(_0x135f9a){try{jsonpatch[_0x6b12('0x21')](_0x135f9a,_0x36d697,!![]);}catch(_0x397e72){return BPromise[_0x6b12('0x22')](_0x397e72);}return _0x135f9a[_0x6b12('0x23')]();};}function saveUpdates(_0x26aed1,_0x4364ae){return function(_0x1ddb45){if(_0x1ddb45){return _0x1ddb45[_0x6b12('0x24')](_0x26aed1)[_0x6b12('0x25')](function(_0x2a346b){return _0x2a346b;});}return null;};}function removeEntity(_0x3fb436,_0x5a0967){return function(_0x475045){if(_0x475045){return _0x475045[_0x6b12('0x26')]()[_0x6b12('0x25')](function(){_0x3fb436[_0x6b12('0x1b')](0xcc)[_0x6b12('0x1a')]();});}};}function handleEntityNotFound(_0x1d62c5,_0x2fa6ad){return function(_0x1f63b5){if(!_0x1f63b5){_0x1d62c5[_0x6b12('0x19')](0x194);}return _0x1f63b5;};}function handleError(_0x4a1017,_0x4e11b2){_0x4e11b2=_0x4e11b2||0x1f4;return function(_0x2f3acf){logger[_0x6b12('0x27')](_0x2f3acf[_0x6b12('0x28')]);if(_0x2f3acf[_0x6b12('0x29')]){delete _0x2f3acf[_0x6b12('0x29')];}_0x4a1017['status'](_0x4e11b2)[_0x6b12('0x2a')](_0x2f3acf);};}exports[_0x6b12('0x2b')]=function(_0x470f6f,_0x270339){var _0x413224={},_0x3c1331={},_0x12b39e={'count':0x0,'rows':[]};var _0x42cda3=_[_0x6b12('0x2c')](db[_0x6b12('0x2d')][_0x6b12('0x2e')],function(_0x1335f0){return{'name':_0x1335f0[_0x6b12('0x2f')],'type':_0x1335f0[_0x6b12('0x30')][_0x6b12('0x31')]};});_0x3c1331[_0x6b12('0x32')]=_[_0x6b12('0x33')](_[_0x6b12('0x2c')](_0x42cda3,_0x6b12('0x29')),[_0x6b12('0x29')]);_0x3c1331[_0x6b12('0x34')]=_['keys'](_0x470f6f[_0x6b12('0x34')]);_0x3c1331[_0x6b12('0x35')]=_['intersection'](_0x3c1331['model'],_0x3c1331[_0x6b12('0x34')]);_0x413224['attributes']=_['intersection'](_0x3c1331[_0x6b12('0x32')],qs['fields'](_0x470f6f['query'][_0x6b12('0x36')]));_0x413224[_0x6b12('0x37')]=_0x413224['attributes'][_0x6b12('0x38')]?_0x413224['attributes']:_0x3c1331[_0x6b12('0x32')];if(!_0x470f6f[_0x6b12('0x34')]['hasOwnProperty']('nolimit')){_0x413224[_0x6b12('0x1e')]=qs[_0x6b12('0x1e')](_0x470f6f[_0x6b12('0x34')][_0x6b12('0x1e')]);_0x413224[_0x6b12('0x1d')]=qs['offset'](_0x470f6f[_0x6b12('0x34')]['offset']);}_0x413224['order']=qs[_0x6b12('0x39')](_0x470f6f['query'][_0x6b12('0x39')]);_0x413224['where']=qs[_0x6b12('0x35')](_['pick'](_0x470f6f[_0x6b12('0x34')],_0x3c1331[_0x6b12('0x35')]),_0x42cda3);if(_0x470f6f[_0x6b12('0x34')][_0x6b12('0x3a')]){_0x413224[_0x6b12('0x3b')]=_[_0x6b12('0x3c')](_0x413224['where'],{'$or':_[_0x6b12('0x2c')](_0x42cda3,function(_0x11e965){if(_0x11e965['type']!=='VIRTUAL'){var _0xf2c63d={};_0xf2c63d[_0x11e965[_0x6b12('0x29')]]={'$like':'%'+_0x470f6f['query']['filter']+'%'};return _0xf2c63d;}})});}_0x413224=_[_0x6b12('0x3c')]({},_0x413224,_0x470f6f[_0x6b12('0x3d')]);var _0x327ace={'where':_0x413224['where']};return db[_0x6b12('0x2d')][_0x6b12('0x1c')](_0x327ace)['then'](function(_0x3cd446){_0x12b39e['count']=_0x3cd446;if(_0x470f6f['query'][_0x6b12('0x3e')]){_0x413224['include']=[{'all':!![]}];}return db[_0x6b12('0x2d')][_0x6b12('0x3f')](_0x413224);})['then'](function(_0x36ede9){_0x12b39e[_0x6b12('0x40')]=_0x36ede9;return _0x12b39e;})[_0x6b12('0x25')](respondWithFilteredResult(_0x270339,_0x413224))[_0x6b12('0x41')](handleError(_0x270339,null));};exports[_0x6b12('0x42')]=function(_0x53d5f0,_0x19f3e0){var _0x1d5540={'raw':!![],'where':{'id':_0x53d5f0[_0x6b12('0x43')]['id']}},_0x4f2901={};_0x4f2901['model']=_[_0x6b12('0x44')](db[_0x6b12('0x2d')]['rawAttributes']);_0x4f2901[_0x6b12('0x34')]=_[_0x6b12('0x44')](_0x53d5f0['query']);_0x4f2901[_0x6b12('0x35')]=_[_0x6b12('0x45')](_0x4f2901[_0x6b12('0x32')],_0x4f2901[_0x6b12('0x34')]);_0x1d5540[_0x6b12('0x37')]=_[_0x6b12('0x45')](_0x4f2901[_0x6b12('0x32')],qs[_0x6b12('0x36')](_0x53d5f0[_0x6b12('0x34')]['fields']));_0x1d5540['attributes']=_0x1d5540['attributes']['length']?_0x1d5540[_0x6b12('0x37')]:_0x4f2901['model'];if(_0x53d5f0[_0x6b12('0x34')][_0x6b12('0x3e')]){_0x1d5540['include']=[{'all':!![]}];}_0x1d5540=_[_0x6b12('0x3c')]({},_0x1d5540,_0x53d5f0['options']);return db['VoiceMailMessage'][_0x6b12('0x46')](_0x1d5540)[_0x6b12('0x25')](handleEntityNotFound(_0x19f3e0,null))[_0x6b12('0x25')](respondWithResult(_0x19f3e0,null))[_0x6b12('0x41')](handleError(_0x19f3e0,null));};exports[_0x6b12('0x47')]=function(_0x7ad66b,_0x4a55d3){return db[_0x6b12('0x2d')]['create'](_0x7ad66b[_0x6b12('0x48')],{})[_0x6b12('0x25')](respondWithResult(_0x4a55d3,0xc9))['catch'](handleError(_0x4a55d3,null));};exports['update']=function(_0x38e68f,_0x234cd0){if(_0x38e68f[_0x6b12('0x48')]['id']){delete _0x38e68f['body']['id'];}return db[_0x6b12('0x2d')][_0x6b12('0x46')]({'where':{'id':_0x38e68f[_0x6b12('0x43')]['id']}})['then'](handleEntityNotFound(_0x234cd0,null))['then'](saveUpdates(_0x38e68f[_0x6b12('0x48')],null))[_0x6b12('0x25')](respondWithResult(_0x234cd0,null))[_0x6b12('0x41')](handleError(_0x234cd0,null));};exports['destroy']=function(_0x3e5822,_0x2387ce){return db[_0x6b12('0x2d')][_0x6b12('0x46')]({'where':{'id':_0x3e5822['params']['id']}})[_0x6b12('0x25')](handleEntityNotFound(_0x2387ce,null))[_0x6b12('0x25')](removeEntity(_0x2387ce,null))['catch'](handleError(_0x2387ce,null));};exports['download']=function(_0x516ce7,_0x3caa44,_0x420d09){return db['VoiceMailMessage'][_0x6b12('0x46')]({'where':{'id':_0x516ce7[_0x6b12('0x43')]['id']},'attributes':['id','recording','msg_id']})[_0x6b12('0x25')](handleEntityNotFound(_0x3caa44,null))[_0x6b12('0x25')](function(_0x2cce00){if(_0x2cce00){if(!_0x2cce00['recording']){throw new db[(_0x6b12('0x49'))][(_0x6b12('0x4a'))](_0x6b12('0x4b'));}var _0x5d5c21={'Content-Type':_0x6b12('0x4c'),'Content-Disposition':_0x6b12('0x4d')};if(_0x2cce00[_0x6b12('0x4e')]){_0x5d5c21[_0x6b12('0x4f')]=_0x6b12('0x50')+_0x2cce00[_0x6b12('0x4e')]+'.wav\x22';}_0x3caa44[_0x6b12('0x1f')](_0x5d5c21);return _0x3caa44[_0x6b12('0x2a')](new Buffer(_0x2cce00[_0x6b12('0x51')]));}})[_0x6b12('0x41')](handleError(_0x3caa44,null));}; \ No newline at end of file +var _0x6acb=['ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','update','then','error','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','download','recording','msg_id','Sequelize','audio/wav','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','to-csv'];(function(_0x4496c1,_0x103294){var _0xa2da11=function(_0x22d096){while(--_0x22d096){_0x4496c1['push'](_0x4496c1['shift']());}};_0xa2da11(++_0x103294);}(_0x6acb,0xe0));var _0xb6ac=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x6acb[_0x41382c];return _0x4da35b;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb6ac('0x0'));var zipdir=require(_0xb6ac('0x1'));var jsonpatch=require(_0xb6ac('0x2'));var rp=require(_0xb6ac('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb6ac('0x4'));var util=require('util');var path=require(_0xb6ac('0x5'));var sox=require('sox');var csv=require(_0xb6ac('0x6'));var ejs=require(_0xb6ac('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb6ac('0x8'));var crypto=require('crypto');var jsforce=require(_0xb6ac('0x9'));var deskjs=require(_0xb6ac('0xa'));var toCsv=require(_0xb6ac('0x6'));var querystring=require(_0xb6ac('0xb'));var Papa=require(_0xb6ac('0xc'));var Redis=require(_0xb6ac('0xd'));var authService=require(_0xb6ac('0xe'));var qs=require(_0xb6ac('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6ac('0x10'));var logger=require(_0xb6ac('0x11'))(_0xb6ac('0x12'));var utils=require(_0xb6ac('0x13'));var config=require(_0xb6ac('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb6ac('0x15'))['db'];function respondWithStatusCode(_0x355da9,_0x80082d){_0x80082d=_0x80082d||0xcc;return function(_0x607a7a){if(_0x607a7a){return _0x355da9[_0xb6ac('0x16')](_0x80082d);}return _0x355da9[_0xb6ac('0x17')](_0x80082d)[_0xb6ac('0x18')]();};}function respondWithResult(_0x52fae3,_0x94b7a9){_0x94b7a9=_0x94b7a9||0xc8;return function(_0x295d22){if(_0x295d22){return _0x52fae3[_0xb6ac('0x17')](_0x94b7a9)[_0xb6ac('0x19')](_0x295d22);}};}function respondWithFilteredResult(_0x5cd32b,_0x3deebf){return function(_0x5255f8){if(_0x5255f8){var _0x52879c=_0x5255f8[_0xb6ac('0x1a')],_0x2b19fc=_0x3deebf[_0xb6ac('0x1b')],_0x5b0631=_0x3deebf[_0xb6ac('0x1b')]+_0x3deebf['limit'],_0x5d1df3;if(_0x5b0631>=_0x52879c){_0x5b0631=_0x52879c;_0x5d1df3=0xc8;}else{_0x5d1df3=0xce;}_0x5cd32b[_0xb6ac('0x17')](_0x5d1df3);return _0x5cd32b[_0xb6ac('0x1c')](_0xb6ac('0x1d'),_0x2b19fc+'-'+_0x5b0631+'/'+_0x52879c)[_0xb6ac('0x19')](_0x5255f8);}return null;};}function patchUpdates(_0x3941c7){return function(_0x202db0){try{jsonpatch['apply'](_0x202db0,_0x3941c7,!![]);}catch(_0x376fcb){return BPromise[_0xb6ac('0x1e')](_0x376fcb);}return _0x202db0['save']();};}function saveUpdates(_0x484b22,_0x414714){return function(_0x4b3124){if(_0x4b3124){return _0x4b3124[_0xb6ac('0x1f')](_0x484b22)['then'](function(_0x5e2bc5){return _0x5e2bc5;});}return null;};}function removeEntity(_0x5eca1e,_0x56195b){return function(_0x31aafc){if(_0x31aafc){return _0x31aafc['destroy']()[_0xb6ac('0x20')](function(){_0x5eca1e[_0xb6ac('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10458d,_0x5761f4){return function(_0x9fe3b8){if(!_0x9fe3b8){_0x10458d[_0xb6ac('0x16')](0x194);}return _0x9fe3b8;};}function handleError(_0x53fa7d,_0x229931){_0x229931=_0x229931||0x1f4;return function(_0x2ee9cb){logger[_0xb6ac('0x21')](_0x2ee9cb[_0xb6ac('0x22')]);if(_0x2ee9cb[_0xb6ac('0x23')]){delete _0x2ee9cb[_0xb6ac('0x23')];}_0x53fa7d[_0xb6ac('0x17')](_0x229931)[_0xb6ac('0x24')](_0x2ee9cb);};}exports['index']=function(_0x28dc9a,_0x2e7adc){var _0x462c70={},_0x3285bd={},_0x38730d={'count':0x0,'rows':[]};var _0x2c8ada=_[_0xb6ac('0x25')](db[_0xb6ac('0x26')][_0xb6ac('0x27')],function(_0x5f1da3){return{'name':_0x5f1da3[_0xb6ac('0x28')],'type':_0x5f1da3['type'][_0xb6ac('0x29')]};});_0x3285bd[_0xb6ac('0x2a')]=_[_0xb6ac('0x2b')](_[_0xb6ac('0x25')](_0x2c8ada,_0xb6ac('0x23')),[_0xb6ac('0x23')]);_0x3285bd['query']=_[_0xb6ac('0x2c')](_0x28dc9a[_0xb6ac('0x2d')]);_0x3285bd[_0xb6ac('0x2e')]=_[_0xb6ac('0x2f')](_0x3285bd[_0xb6ac('0x2a')],_0x3285bd[_0xb6ac('0x2d')]);_0x462c70[_0xb6ac('0x30')]=_[_0xb6ac('0x2f')](_0x3285bd[_0xb6ac('0x2a')],qs[_0xb6ac('0x31')](_0x28dc9a[_0xb6ac('0x2d')]['fields']));_0x462c70[_0xb6ac('0x30')]=_0x462c70[_0xb6ac('0x30')][_0xb6ac('0x32')]?_0x462c70[_0xb6ac('0x30')]:_0x3285bd['model'];if(!_0x28dc9a[_0xb6ac('0x2d')]['hasOwnProperty'](_0xb6ac('0x33'))){_0x462c70[_0xb6ac('0x34')]=qs[_0xb6ac('0x34')](_0x28dc9a[_0xb6ac('0x2d')]['limit']);_0x462c70['offset']=qs['offset'](_0x28dc9a[_0xb6ac('0x2d')]['offset']);}_0x462c70['order']=qs[_0xb6ac('0x35')](_0x28dc9a[_0xb6ac('0x2d')][_0xb6ac('0x35')]);_0x462c70[_0xb6ac('0x36')]=qs[_0xb6ac('0x2e')](_[_0xb6ac('0x37')](_0x28dc9a[_0xb6ac('0x2d')],_0x3285bd[_0xb6ac('0x2e')]),_0x2c8ada);if(_0x28dc9a[_0xb6ac('0x2d')][_0xb6ac('0x38')]){_0x462c70['where']=_[_0xb6ac('0x39')](_0x462c70['where'],{'$or':_['map'](_0x2c8ada,function(_0x17c977){if(_0x17c977['type']!==_0xb6ac('0x3a')){var _0x2e5e37={};_0x2e5e37[_0x17c977['name']]={'$like':'%'+_0x28dc9a[_0xb6ac('0x2d')][_0xb6ac('0x38')]+'%'};return _0x2e5e37;}})});}_0x462c70=_[_0xb6ac('0x39')]({},_0x462c70,_0x28dc9a[_0xb6ac('0x3b')]);var _0x2a0f1f={'where':_0x462c70[_0xb6ac('0x36')]};return db[_0xb6ac('0x26')]['count'](_0x2a0f1f)[_0xb6ac('0x20')](function(_0x50a113){_0x38730d[_0xb6ac('0x1a')]=_0x50a113;if(_0x28dc9a['query'][_0xb6ac('0x3c')]){_0x462c70['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xb6ac('0x3d')](_0x462c70);})[_0xb6ac('0x20')](function(_0x3345ba){_0x38730d[_0xb6ac('0x3e')]=_0x3345ba;return _0x38730d;})[_0xb6ac('0x20')](respondWithFilteredResult(_0x2e7adc,_0x462c70))[_0xb6ac('0x3f')](handleError(_0x2e7adc,null));};exports['show']=function(_0x471521,_0x3dfd41){var _0x28084f={'raw':!![],'where':{'id':_0x471521[_0xb6ac('0x40')]['id']}},_0x3c1fd3={};_0x3c1fd3[_0xb6ac('0x2a')]=_['keys'](db[_0xb6ac('0x26')]['rawAttributes']);_0x3c1fd3[_0xb6ac('0x2d')]=_[_0xb6ac('0x2c')](_0x471521[_0xb6ac('0x2d')]);_0x3c1fd3['filters']=_[_0xb6ac('0x2f')](_0x3c1fd3[_0xb6ac('0x2a')],_0x3c1fd3[_0xb6ac('0x2d')]);_0x28084f['attributes']=_[_0xb6ac('0x2f')](_0x3c1fd3[_0xb6ac('0x2a')],qs[_0xb6ac('0x31')](_0x471521['query'][_0xb6ac('0x31')]));_0x28084f[_0xb6ac('0x30')]=_0x28084f['attributes'][_0xb6ac('0x32')]?_0x28084f[_0xb6ac('0x30')]:_0x3c1fd3[_0xb6ac('0x2a')];if(_0x471521['query'][_0xb6ac('0x3c')]){_0x28084f[_0xb6ac('0x41')]=[{'all':!![]}];}_0x28084f=_[_0xb6ac('0x39')]({},_0x28084f,_0x471521['options']);return db[_0xb6ac('0x26')][_0xb6ac('0x42')](_0x28084f)['then'](handleEntityNotFound(_0x3dfd41,null))['then'](respondWithResult(_0x3dfd41,null))[_0xb6ac('0x3f')](handleError(_0x3dfd41,null));};exports['create']=function(_0x2bf54e,_0x4df7bf){return db[_0xb6ac('0x26')][_0xb6ac('0x43')](_0x2bf54e['body'],{})[_0xb6ac('0x20')](respondWithResult(_0x4df7bf,0xc9))[_0xb6ac('0x3f')](handleError(_0x4df7bf,null));};exports[_0xb6ac('0x1f')]=function(_0x2328ff,_0x127b3e){if(_0x2328ff[_0xb6ac('0x44')]['id']){delete _0x2328ff[_0xb6ac('0x44')]['id'];}return db[_0xb6ac('0x26')][_0xb6ac('0x42')]({'where':{'id':_0x2328ff[_0xb6ac('0x40')]['id']}})[_0xb6ac('0x20')](handleEntityNotFound(_0x127b3e,null))['then'](saveUpdates(_0x2328ff['body'],null))[_0xb6ac('0x20')](respondWithResult(_0x127b3e,null))[_0xb6ac('0x3f')](handleError(_0x127b3e,null));};exports[_0xb6ac('0x45')]=function(_0x37e47b,_0x4ee024){return db[_0xb6ac('0x26')]['find']({'where':{'id':_0x37e47b[_0xb6ac('0x40')]['id']}})['then'](handleEntityNotFound(_0x4ee024,null))[_0xb6ac('0x20')](removeEntity(_0x4ee024,null))[_0xb6ac('0x3f')](handleError(_0x4ee024,null));};exports[_0xb6ac('0x46')]=function(_0x3e0d28,_0x14c4af,_0x47d7ac){return db[_0xb6ac('0x26')]['find']({'where':{'id':_0x3e0d28[_0xb6ac('0x40')]['id']},'attributes':['id',_0xb6ac('0x47'),_0xb6ac('0x48')]})[_0xb6ac('0x20')](handleEntityNotFound(_0x14c4af,null))[_0xb6ac('0x20')](function(_0x58c992){if(_0x58c992){if(!_0x58c992[_0xb6ac('0x47')]){throw new db[(_0xb6ac('0x49'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x4b32c5={'Content-Type':_0xb6ac('0x4a'),'Content-Disposition':'attachment'};if(_0x58c992['msg_id']){_0x4b32c5['Content-Disposition']=_0xb6ac('0x4b')+_0x58c992[_0xb6ac('0x48')]+_0xb6ac('0x4c');}_0x14c4af['set'](_0x4b32c5);return _0x14c4af[_0xb6ac('0x24')](new Buffer(_0x58c992[_0xb6ac('0x47')]));}})[_0xb6ac('0x3f')](handleError(_0x14c4af,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 2e2f83d..b58d6fe 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 _0x551c=['exports','define','VoiceMailMessage','dir','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x551c,0x10c));var _0xc551=function(_0x444333,_0x326cd8){_0x444333=_0x444333-0x0;var _0x1aa95c=_0x551c[_0x444333];return _0x1aa95c;};'use strict';var _=require(_0xc551('0x0'));var util=require('util');var logger=require(_0xc551('0x1'))(_0xc551('0x2'));var moment=require(_0xc551('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc551('0x4'));var rimraf=require(_0xc551('0x5'));var config=require(_0xc551('0x6'));var attributes=require(_0xc551('0x7'));module[_0xc551('0x8')]=function(_0x4e7d2c,_0x378112){return _0x4e7d2c[_0xc551('0x9')](_0xc551('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0xc551('0xb'),'fields':[_0xc551('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xdfbc=['dir','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages'];(function(_0x3b19e2,_0x5636a4){var _0x6506e0=function(_0x3a5534){while(--_0x3a5534){_0x3b19e2['push'](_0x3b19e2['shift']());}};_0x6506e0(++_0x5636a4);}(_0xdfbc,0x119));var _0xcdfb=function(_0x44b40c,_0x2e3f08){_0x44b40c=_0x44b40c-0x0;var _0x5c4f85=_0xdfbc[_0x44b40c];return _0x5c4f85;};'use strict';var _=require(_0xcdfb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcdfb('0x1'));var moment=require(_0xcdfb('0x2'));var BPromise=require(_0xcdfb('0x3'));var rp=require(_0xcdfb('0x4'));var fs=require('fs');var path=require(_0xcdfb('0x5'));var rimraf=require(_0xcdfb('0x6'));var config=require(_0xcdfb('0x7'));var attributes=require(_0xcdfb('0x8'));module[_0xcdfb('0x9')]=function(_0x450cd3,_0x2d1c2f){return _0x450cd3[_0xcdfb('0xa')](_0xcdfb('0xb'),attributes,{'tableName':_0xcdfb('0xc'),'paranoid':![],'indexes':[{'name':_0xcdfb('0xd'),'fields':[_0xcdfb('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 74afd55..5f9bf03 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x5e8eb6,_0x1f33a2){var _0x2b8f67=function(_0x10fc99){while(--_0x10fc99){_0x5e8eb6['push'](_0x5e8eb6['shift']());}};_0x2b8f67(++_0x1f33a2);}(_0x2032,0xd9));var _0x2203=function(_0x562379,_0x39c3b0){_0x562379=_0x562379-0x0;var _0x200638=_0x2032[_0x562379];return _0x200638;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2203('0x3'));var db=require(_0x2203('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2203('0x5'))(_0x2203('0x6'));var config=require(_0x2203('0x7'));var jayson=require(_0x2203('0x8'));var client=jayson[_0x2203('0x9')][_0x2203('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e0f63,_0x2676aa,_0x18c4d6){return new BPromise(function(_0x2049ff,_0x2999ed){return client['request'](_0x2e0f63,_0x18c4d6)['then'](function(_0x10f055){logger['info'](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));logger[_0x2203('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x2676aa,_0x2203('0xc'),JSON['stringify'](_0x10f055));if(_0x10f055[_0x2203('0xe')]){if(_0x10f055['error'][_0x2203('0xf')]===0x1f4){logger[_0x2203('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x2676aa,_0x10f055['error'][_0x2203('0x10')]);return _0x2049ff(_0x10f055[_0x2203('0xe')][_0x2203('0x10')]);}else{logger[_0x2203('0x11')](_0x2203('0xb'),_0x2676aa,_0x2203('0xc'));_0x2049ff(_0x10f055[_0x2203('0x12')][_0x2203('0x10')]);}})[_0x2203('0x13')](function(_0x3053f3){logger['error'](_0x2203('0xb'),_0x2676aa,_0x3053f3);_0x2999ed(_0x3053f3);});});} \ 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','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xce87e3,_0x58cae4){var _0x7d87f4=function(_0x5bc232){while(--_0x5bc232){_0xce87e3['push'](_0xce87e3['shift']());}};_0x7d87f4(++_0x58cae4);}(_0xadb5,0xad));var _0x5adb=function(_0xfb4bbd,_0x2ff25b){_0xfb4bbd=_0xfb4bbd-0x0;var _0x53f6ec=_0xadb5[_0xfb4bbd];return _0x53f6ec;};'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']('VoiceMailMessage,\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/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1f3b943..af31ea3 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 _0x3f72=['/:id/sounds/:id2','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','/:id/sounds','getSounds','post','put','update','delete'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x3f72,0x17c));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x23f7('0x0'));var util=require(_0x23f7('0x1'));var path=require(_0x23f7('0x2'));var timeout=require(_0x23f7('0x3'));var express=require(_0x23f7('0x4'));var router=express[_0x23f7('0x5')]();var auth=require(_0x23f7('0x6'));var interaction=require(_0x23f7('0x7'));var config=require('../../config/environment');var controller=require(_0x23f7('0x8'));router[_0x23f7('0x9')]('/',auth[_0x23f7('0xa')](),controller['index']);router[_0x23f7('0x9')](_0x23f7('0xb'),auth[_0x23f7('0xa')](),controller[_0x23f7('0xc')]);router[_0x23f7('0x9')](_0x23f7('0xd'),auth['isAuthenticated'](),controller[_0x23f7('0xe')]);router[_0x23f7('0xf')]('/',auth[_0x23f7('0xa')](),controller['create']);router['post'](_0x23f7('0xd'),auth['isAuthenticated'](),controller['addSound']);router[_0x23f7('0x10')](_0x23f7('0xb'),auth[_0x23f7('0xa')](),controller[_0x23f7('0x11')]);router['delete'](_0x23f7('0xb'),auth[_0x23f7('0xa')](),controller['destroy']);router[_0x23f7('0x12')](_0x23f7('0x13'),auth['isAuthenticated'](),controller['removeSound']);module[_0x23f7('0x14')]=router; \ No newline at end of file +var _0x8cea=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','/:id/sounds','post','create','addSound','put','update','delete','destroy','removeSound'];(function(_0x53e149,_0x2e5dff){var _0x16a2c5=function(_0x5cdab2){while(--_0x5cdab2){_0x53e149['push'](_0x53e149['shift']());}};_0x16a2c5(++_0x2e5dff);}(_0x8cea,0x139));var _0xa8ce=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0x8cea[_0x319cb9];return _0x1735fc;};'use strict';var multer=require(_0xa8ce('0x0'));var util=require(_0xa8ce('0x1'));var path=require(_0xa8ce('0x2'));var timeout=require(_0xa8ce('0x3'));var express=require('express');var router=express[_0xa8ce('0x4')]();var auth=require(_0xa8ce('0x5'));var interaction=require(_0xa8ce('0x6'));var config=require(_0xa8ce('0x7'));var controller=require(_0xa8ce('0x8'));router[_0xa8ce('0x9')]('/',auth['isAuthenticated'](),controller[_0xa8ce('0xa')]);router[_0xa8ce('0x9')](_0xa8ce('0xb'),auth[_0xa8ce('0xc')](),controller[_0xa8ce('0xd')]);router['get'](_0xa8ce('0xe'),auth[_0xa8ce('0xc')](),controller['getSounds']);router[_0xa8ce('0xf')]('/',auth[_0xa8ce('0xc')](),controller[_0xa8ce('0x10')]);router['post'](_0xa8ce('0xe'),auth['isAuthenticated'](),controller[_0xa8ce('0x11')]);router[_0xa8ce('0x12')]('/:id',auth[_0xa8ce('0xc')](),controller[_0xa8ce('0x13')]);router[_0xa8ce('0x14')](_0xa8ce('0xb'),auth[_0xa8ce('0xc')](),controller[_0xa8ce('0x15')]);router[_0xa8ce('0x14')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xa8ce('0x16')]);module[_0xa8ce('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 96f2061..9e513f4 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 _0xc997=['STRING','name','custom','files','quietmp3nb','alpha','TIMESTAMP','sequelize','exports'];(function(_0x73ab9a,_0x460d22){var _0x42776e=function(_0x200966){while(--_0x200966){_0x73ab9a['push'](_0x73ab9a['shift']());}};_0x42776e(++_0x460d22);}(_0xc997,0xcd));var _0x7c99=function(_0xd9f651,_0x32fcbe){_0xd9f651=_0xd9f651-0x0;var _0x1f3d94=_0xc997[_0xd9f651];return _0x1f3d94;};'use strict';var Sequelize=require(_0x7c99('0x0'));module[_0x7c99('0x1')]={'name':{'type':Sequelize[_0x7c99('0x2')],'allowNull':![],'unique':_0x7c99('0x3')},'mode':{'type':Sequelize['ENUM'](_0x7c99('0x4'),_0x7c99('0x5'),'mp3nb',_0x7c99('0x6'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x7c99('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x7c99('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x7c99('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x7c99('0x2')],'allowNull':!![],'defaultValue':_0x7c99('0x7')},'format':{'type':Sequelize[_0x7c99('0x2')],'allowNull':!![]},'stamp':{'type':_0x7c99('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9895=['files','mp3','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','name','custom'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x9895,0x17f));var _0x5989=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9895[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x5989('0x0'));module[_0x5989('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5989('0x2')},'mode':{'type':Sequelize['ENUM'](_0x5989('0x3'),_0x5989('0x4'),'mp3nb','quietmp3nb','quietmp3',_0x5989('0x5')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x5989('0x6')],'allowNull':!![]},'digit':{'type':Sequelize[_0x5989('0x6')],'allowNull':!![]},'sort':{'type':Sequelize[_0x5989('0x6')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x5989('0x6')],'allowNull':!![]},'stamp':{'type':_0x5989('0x7')},'defaultEntry':{'type':Sequelize[_0x5989('0x8')],'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 048d46a..c4b6850 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 _0x88ab=['find','body','create','transaction','mode','files','directory','join','server/files/moh','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','sequelize','readdirSync','forEach','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','createdAt','basename','extname','%s.%s','symlinkSync','Sequelize','removeSound','id2','unlinkSync','format','getSounds','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','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','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params'];(function(_0x109a23,_0xba2f47){var _0x2c082e=function(_0x3e1e63){while(--_0x3e1e63){_0x109a23['push'](_0x109a23['shift']());}};_0x2c082e(++_0xba2f47);}(_0x88ab,0x10d));var _0xb88a=function(_0x3f0e94,_0x21a8c6){_0x3f0e94=_0x3f0e94-0x0;var _0x2e0ff4=_0x88ab[_0x3f0e94];return _0x2e0ff4;};'use strict';var pdf=require(_0xb88a('0x0'));var emlformat=require(_0xb88a('0x1'));var rimraf=require(_0xb88a('0x2'));var zipdir=require(_0xb88a('0x3'));var jsonpatch=require(_0xb88a('0x4'));var rp=require('request-promise');var moment=require(_0xb88a('0x5'));var BPromise=require(_0xb88a('0x6'));var Mustache=require(_0xb88a('0x7'));var util=require(_0xb88a('0x8'));var path=require('path');var sox=require(_0xb88a('0x9'));var csv=require(_0xb88a('0xa'));var ejs=require(_0xb88a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb88a('0xc'));var crypto=require(_0xb88a('0xd'));var jsforce=require(_0xb88a('0xe'));var deskjs=require(_0xb88a('0xf'));var toCsv=require(_0xb88a('0xa'));var querystring=require(_0xb88a('0x10'));var Papa=require('papaparse');var Redis=require(_0xb88a('0x11'));var authService=require(_0xb88a('0x12'));var qs=require(_0xb88a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb88a('0x14'));var logger=require(_0xb88a('0x15'))(_0xb88a('0x16'));var utils=require(_0xb88a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb88a('0x18'));var db=require(_0xb88a('0x19'))['db'];function respondWithStatusCode(_0x11c698,_0x478689){_0x478689=_0x478689||0xcc;return function(_0x8383e6){if(_0x8383e6){return _0x11c698[_0xb88a('0x1a')](_0x478689);}return _0x11c698[_0xb88a('0x1b')](_0x478689)[_0xb88a('0x1c')]();};}function respondWithResult(_0x327c58,_0x4e8f5d){_0x4e8f5d=_0x4e8f5d||0xc8;return function(_0x1ad361){if(_0x1ad361){return _0x327c58[_0xb88a('0x1b')](_0x4e8f5d)[_0xb88a('0x1d')](_0x1ad361);}};}function respondWithFilteredResult(_0x1fd557,_0x276a75){return function(_0x32dff3){if(_0x32dff3){var _0xeffc3d=_0x32dff3[_0xb88a('0x1e')],_0x21bc05=_0x276a75[_0xb88a('0x1f')],_0x1209ee=_0x276a75['offset']+_0x276a75[_0xb88a('0x20')],_0x3f3475;if(_0x1209ee>=_0xeffc3d){_0x1209ee=_0xeffc3d;_0x3f3475=0xc8;}else{_0x3f3475=0xce;}_0x1fd557['status'](_0x3f3475);return _0x1fd557[_0xb88a('0x21')](_0xb88a('0x22'),_0x21bc05+'-'+_0x1209ee+'/'+_0xeffc3d)[_0xb88a('0x1d')](_0x32dff3);}return null;};}function patchUpdates(_0xe47617){return function(_0x496bd0){try{jsonpatch[_0xb88a('0x23')](_0x496bd0,_0xe47617,!![]);}catch(_0x15d92e){return BPromise[_0xb88a('0x24')](_0x15d92e);}return _0x496bd0[_0xb88a('0x25')]();};}function saveUpdates(_0x1e48b2,_0x175344){return function(_0x529e01){if(_0x529e01){return _0x529e01[_0xb88a('0x26')](_0x1e48b2)[_0xb88a('0x27')](function(_0x92feaf){return _0x92feaf;});}return null;};}function removeEntity(_0x33637b,_0xc88211){return function(_0x2ee28c){if(_0x2ee28c){return _0x2ee28c[_0xb88a('0x28')]()[_0xb88a('0x27')](function(){var _0x1beb20=_0x2ee28c[_0xb88a('0x29')]({'plain':!![]});var _0x26a2bc=_0xb88a('0x2a');return db[_0xb88a('0x2b')][_0xb88a('0x28')]({'where':{'type':_0x26a2bc,'resourceId':_0x1beb20['id']}})[_0xb88a('0x27')](function(){return _0x2ee28c;});})['then'](function(){_0x33637b[_0xb88a('0x1b')](0xcc)[_0xb88a('0x1c')]();});}};}function handleEntityNotFound(_0x375b62,_0x341dda){return function(_0x28601b){if(!_0x28601b){_0x375b62['sendStatus'](0x194);}return _0x28601b;};}function handleError(_0xc34f65,_0xddca27){_0xddca27=_0xddca27||0x1f4;return function(_0xf8a77f){logger[_0xb88a('0x2c')](_0xf8a77f[_0xb88a('0x2d')]);if(_0xf8a77f[_0xb88a('0x2e')]){delete _0xf8a77f['name'];}_0xc34f65[_0xb88a('0x1b')](_0xddca27)[_0xb88a('0x2f')](_0xf8a77f);};}exports[_0xb88a('0x30')]=function(_0x4e431f,_0x188c73){var _0x4b6fd7={},_0x1c79c1={},_0x27080f={'count':0x0,'rows':[]};var _0x361c2e=_['map'](db[_0xb88a('0x31')][_0xb88a('0x32')],function(_0x170839){return{'name':_0x170839['fieldName'],'type':_0x170839[_0xb88a('0x33')][_0xb88a('0x34')]};});_0x1c79c1[_0xb88a('0x35')]=_[_0xb88a('0x36')](_0x361c2e,_0xb88a('0x2e'));_0x1c79c1[_0xb88a('0x37')]=_[_0xb88a('0x38')](_0x4e431f['query']);_0x1c79c1['filters']=_[_0xb88a('0x39')](_0x1c79c1['model'],_0x1c79c1[_0xb88a('0x37')]);_0x4b6fd7[_0xb88a('0x3a')]=_[_0xb88a('0x39')](_0x1c79c1[_0xb88a('0x35')],qs[_0xb88a('0x3b')](_0x4e431f[_0xb88a('0x37')]['fields']));_0x4b6fd7['attributes']=_0x4b6fd7['attributes'][_0xb88a('0x3c')]?_0x4b6fd7[_0xb88a('0x3a')]:_0x1c79c1['model'];if(!_0x4e431f['query'][_0xb88a('0x3d')](_0xb88a('0x3e'))){_0x4b6fd7[_0xb88a('0x20')]=qs[_0xb88a('0x20')](_0x4e431f['query']['limit']);_0x4b6fd7[_0xb88a('0x1f')]=qs[_0xb88a('0x1f')](_0x4e431f[_0xb88a('0x37')]['offset']);}_0x4b6fd7['order']=qs[_0xb88a('0x3f')](_0x4e431f[_0xb88a('0x37')][_0xb88a('0x3f')]);_0x4b6fd7['where']=qs[_0xb88a('0x40')](_['pick'](_0x4e431f[_0xb88a('0x37')],_0x1c79c1['filters']),_0x361c2e);if(_0x4e431f[_0xb88a('0x37')][_0xb88a('0x41')]){_0x4b6fd7[_0xb88a('0x42')]=_[_0xb88a('0x43')](_0x4b6fd7['where'],{'$or':_['map'](_0x361c2e,function(_0xba0108){if(_0xba0108['type']!==_0xb88a('0x44')){var _0x1e5fb5={};_0x1e5fb5[_0xba0108[_0xb88a('0x2e')]]={'$like':'%'+_0x4e431f[_0xb88a('0x37')][_0xb88a('0x41')]+'%'};return _0x1e5fb5;}})});}_0x4b6fd7=_[_0xb88a('0x43')]({},_0x4b6fd7,_0x4e431f[_0xb88a('0x45')]);var _0x4c0ca1={'where':_0x4b6fd7['where']};return db[_0xb88a('0x31')][_0xb88a('0x1e')](_0x4c0ca1)['then'](function(_0x1b7d55){_0x27080f[_0xb88a('0x1e')]=_0x1b7d55;if(_0x4e431f[_0xb88a('0x37')][_0xb88a('0x46')]){_0x4b6fd7[_0xb88a('0x47')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x4b6fd7);})[_0xb88a('0x27')](function(_0x35bd0f){_0x27080f[_0xb88a('0x48')]=_0x35bd0f;return _0x27080f;})[_0xb88a('0x27')](respondWithFilteredResult(_0x188c73,_0x4b6fd7))[_0xb88a('0x49')](handleError(_0x188c73,null));};exports[_0xb88a('0x4a')]=function(_0x2b3cc5,_0x53c6ea){var _0xe4f6fb={'raw':![],'where':{'id':_0x2b3cc5[_0xb88a('0x4b')]['id']}},_0x22031c={};_0x22031c[_0xb88a('0x35')]=_[_0xb88a('0x38')](db[_0xb88a('0x31')]['rawAttributes']);_0x22031c[_0xb88a('0x37')]=_[_0xb88a('0x38')](_0x2b3cc5['query']);_0x22031c[_0xb88a('0x40')]=_[_0xb88a('0x39')](_0x22031c[_0xb88a('0x35')],_0x22031c[_0xb88a('0x37')]);_0xe4f6fb['attributes']=_[_0xb88a('0x39')](_0x22031c[_0xb88a('0x35')],qs[_0xb88a('0x3b')](_0x2b3cc5[_0xb88a('0x37')][_0xb88a('0x3b')]));_0xe4f6fb[_0xb88a('0x3a')]=_0xe4f6fb[_0xb88a('0x3a')][_0xb88a('0x3c')]?_0xe4f6fb[_0xb88a('0x3a')]:_0x22031c[_0xb88a('0x35')];if(_0x2b3cc5['query'][_0xb88a('0x46')]){_0xe4f6fb['include']=[{'all':!![]}];}_0xe4f6fb=_['merge']({},_0xe4f6fb,_0x2b3cc5[_0xb88a('0x45')]);return db['VoiceMusicOnHold'][_0xb88a('0x4c')](_0xe4f6fb)['then'](handleEntityNotFound(_0x53c6ea,null))[_0xb88a('0x27')](respondWithResult(_0x53c6ea,null))[_0xb88a('0x49')](handleError(_0x53c6ea,null));};exports[_0xb88a('0x26')]=function(_0x54aba,_0x5912ba){if(_0x54aba[_0xb88a('0x4d')]['id']){delete _0x54aba[_0xb88a('0x4d')]['id'];}return db[_0xb88a('0x31')][_0xb88a('0x4c')]({'where':{'id':_0x54aba[_0xb88a('0x4b')]['id']}})[_0xb88a('0x27')](handleEntityNotFound(_0x5912ba,null))[_0xb88a('0x27')](saveUpdates(_0x54aba[_0xb88a('0x4d')],null))[_0xb88a('0x27')](respondWithResult(_0x5912ba,null))['catch'](handleError(_0x5912ba,null));};exports[_0xb88a('0x4e')]=function(_0x5c2548,_0x2eb742,_0x1ce5a6){return db['sequelize'][_0xb88a('0x4f')](function(_0x5502c3){if(_0x5c2548[_0xb88a('0x4d')][_0xb88a('0x50')]===_0xb88a('0x51')){_0x5c2548['body'][_0xb88a('0x52')]=path[_0xb88a('0x53')](config['root'],_0xb88a('0x54'),_0x5c2548[_0xb88a('0x4d')]['name']);}return db[_0xb88a('0x31')][_0xb88a('0x4e')](_0x5c2548[_0xb88a('0x4d')],{'transaction':_0x5502c3})['then'](function(_0x4e7915){if(_0x5c2548[_0xb88a('0x4d')]['mode']===_0xb88a('0x51')){fs['mkdirSync'](_0x4e7915[_0xb88a('0x52')],parseInt(_0xb88a('0x55'),0x8));}var _0x5e2ad5=_0x5c2548[_0xb88a('0x56')][_0xb88a('0x29')]({'plain':!![]});if(!_0x5e2ad5)throw new Error(_0xb88a('0x57'));if(_0x5e2ad5[_0xb88a('0x58')]===_0xb88a('0x56')){var _0x5fbb0a=_0x4e7915[_0xb88a('0x29')]({'plain':!![]});return db[_0xb88a('0x59')][_0xb88a('0x4c')]({'where':{'name':_0xb88a('0x2a'),'userProfileId':_0x5e2ad5[_0xb88a('0x5a')]},'raw':!![]})[_0xb88a('0x27')](function(_0x3c9d7f){if(_0x3c9d7f&&_0x3c9d7f[_0xb88a('0x5b')]===0x0){return db['UserProfileResource'][_0xb88a('0x4e')]({'name':_0x5fbb0a[_0xb88a('0x2e')],'resourceId':_0x5fbb0a['id'],'type':_0x3c9d7f['name'],'sectionId':_0x3c9d7f['id']},{})[_0xb88a('0x27')](function(){return _0x4e7915;});}else{return _0x4e7915;}})['catch'](function(_0x20b8cb){logger[_0xb88a('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20b8cb);});}return _0x4e7915;});})['then'](respondWithResult(_0x2eb742,0xc9))[_0xb88a('0x49')](handleError(_0x2eb742,null));};exports['destroy']=function(_0x4be650,_0x21df78,_0xb93aac){var _0x4d4ace;return db[_0xb88a('0x31')][_0xb88a('0x4c')]({'where':{'id':_0x4be650[_0xb88a('0x4b')]['id']}})[_0xb88a('0x27')](function(_0x2767a9){if(_0x2767a9){return db[_0xb88a('0x5c')]['transaction'](function(_0x24a812){return _0x2767a9[_0xb88a('0x28')]({'transaction':_0x24a812,'raw':!![]})['then'](function(_0x1abc8e){if(_0x1abc8e[_0xb88a('0x52')]){fs[_0xb88a('0x5d')](_0x1abc8e[_0xb88a('0x52')])[_0xb88a('0x5e')](function(_0xf14d30){fs['unlinkSync'](path['join'](_0x1abc8e['directory'],_0xf14d30));});fs[_0xb88a('0x5f')](_0x1abc8e[_0xb88a('0x52')]);}return _0x1abc8e;});})['catch'](function(_0x519256){throw new db['Sequelize'][(_0xb88a('0x60'))](_0x519256[_0xb88a('0x61')]);});}})['then'](handleEntityNotFound(_0x21df78,null))['then'](removeEntity(_0x21df78,null))[_0xb88a('0x49')](handleError(_0x21df78,null));};exports['addSound']=function(_0x35ff35,_0x608146,_0x3b20a4){return db[_0xb88a('0x5c')]['transaction'](function(_0x487ca8){var _0x530284;return db['VoiceMusicOnHold'][_0xb88a('0x4c')]({'where':{'id':_0x35ff35[_0xb88a('0x4b')]['id']}})[_0xb88a('0x27')](function(_0x20bc6f){if(_0x20bc6f){_0x530284=_0x20bc6f;return _0x20bc6f[_0xb88a('0x62')](_0x35ff35['body']['id'],{'transaction':_0x487ca8});}})['then'](function(_0x295937){if(_0x295937){return db[_0xb88a('0x63')][_0xb88a('0x64')]({'where':{'id':_0x35ff35[_0xb88a('0x4d')]['id']},'attributes':['id',_0xb88a('0x2e'),_0xb88a('0x65'),_0xb88a('0x66'),_0xb88a('0x67')],'raw':!![]});}})[_0xb88a('0x27')](function(_0x474217){if(_0x474217){var _0x30b3dd=path[_0xb88a('0x53')](config['root'],'server/files/sounds/converted',util['format']('%s.%s',path[_0xb88a('0x68')](_0x474217['save_name'],path[_0xb88a('0x69')](_0x474217[_0xb88a('0x65')])),_0x474217[_0xb88a('0x66')]));var _0x4986b8=path['join'](config['root'],_0xb88a('0x54'),_0x530284[_0xb88a('0x2e')],util['format'](_0xb88a('0x6a'),_0x474217['name'],_0x474217['converted_format']));fs[_0xb88a('0x6b')](_0x30b3dd,_0x4986b8);return _0x474217;}})[_0xb88a('0x49')](function(_0x3a113c){throw new db[(_0xb88a('0x6c'))][(_0xb88a('0x60'))](_0x3a113c[_0xb88a('0x61')]);});})[_0xb88a('0x27')](handleEntityNotFound(_0x608146,null))[_0xb88a('0x27')](respondWithResult(_0x608146,0xc9))[_0xb88a('0x49')](handleError(_0x608146,null));};exports[_0xb88a('0x6d')]=function(_0x5e7768,_0x29cb1d,_0x2a75a1){return db[_0xb88a('0x5c')]['transaction'](function(_0x54429e){var _0x83656f;return db[_0xb88a('0x31')][_0xb88a('0x64')]({'where':{'id':_0x5e7768['params']['id']}})['then'](handleEntityNotFound(_0x29cb1d,null))[_0xb88a('0x27')](function(_0xac94c1){if(_0xac94c1){_0x83656f=_0xac94c1;return _0xac94c1['removeSound'](_0x5e7768[_0xb88a('0x4b')][_0xb88a('0x6e')]);}})['then'](function(_0x5350d8){if(_0x5350d8){return db['Sound'][_0xb88a('0x64')]({'where':{'id':_0x5e7768[_0xb88a('0x4b')][_0xb88a('0x6e')]},'attributes':['id',_0xb88a('0x2e'),'save_name','converted_format','createdAt'],'raw':!![]});}})[_0xb88a('0x27')](function(_0x5eb00d){if(_0x5eb00d){fs[_0xb88a('0x6f')](path[_0xb88a('0x53')](_0x83656f['directory'],util[_0xb88a('0x70')](_0xb88a('0x6a'),_0x5eb00d[_0xb88a('0x2e')],_0x5eb00d[_0xb88a('0x66')])));return _0x5eb00d;}})[_0xb88a('0x49')](function(_0x4b99e1){throw new db[(_0xb88a('0x6c'))][(_0xb88a('0x60'))](_0x4b99e1[_0xb88a('0x61')]);});})['then'](handleEntityNotFound(_0x29cb1d,null))[_0xb88a('0x27')](respondWithStatusCode(_0x29cb1d,0xcc))[_0xb88a('0x49')](handleError(_0x29cb1d,null));};exports[_0xb88a('0x71')]=function(_0x36b7c1,_0xa1826c,_0x1ea3a3){var _0x4e0e30={};var _0x28df57={};var _0x693880;var _0x166277;return db[_0xb88a('0x31')][_0xb88a('0x64')]({'where':{'id':_0x36b7c1[_0xb88a('0x4b')]['id']}})[_0xb88a('0x27')](handleEntityNotFound(_0xa1826c,null))[_0xb88a('0x27')](function(_0xd9ddab){if(_0xd9ddab){_0x693880=_0xd9ddab;_0x28df57[_0xb88a('0x35')]=_[_0xb88a('0x38')](db[_0xb88a('0x63')]['rawAttributes']);_0x28df57[_0xb88a('0x37')]=_[_0xb88a('0x38')](_0x36b7c1[_0xb88a('0x37')]);_0x28df57[_0xb88a('0x40')]=_[_0xb88a('0x39')](_0x28df57[_0xb88a('0x35')],_0x28df57[_0xb88a('0x37')]);_0x4e0e30[_0xb88a('0x3a')]=_['intersection'](_0x28df57[_0xb88a('0x35')],qs['fields'](_0x36b7c1[_0xb88a('0x37')][_0xb88a('0x3b')]));_0x4e0e30[_0xb88a('0x3a')]=_0x4e0e30[_0xb88a('0x3a')][_0xb88a('0x3c')]?_0x4e0e30[_0xb88a('0x3a')]:_0x28df57[_0xb88a('0x35')];_0x4e0e30[_0xb88a('0x72')]=qs['sort'](_0x36b7c1[_0xb88a('0x37')][_0xb88a('0x3f')]);_0x4e0e30[_0xb88a('0x42')]=qs[_0xb88a('0x40')](_['pick'](_0x36b7c1['query'],_0x28df57['filters']));if(_0x36b7c1[_0xb88a('0x37')][_0xb88a('0x41')]){_0x4e0e30[_0xb88a('0x42')]=_[_0xb88a('0x43')](_0x4e0e30['where'],{'$or':_[_0xb88a('0x36')](_0x4e0e30[_0xb88a('0x3a')],function(_0x3852c0){var _0x3b31e4={};_0x3b31e4[_0x3852c0]={'$like':'%'+_0x36b7c1[_0xb88a('0x37')]['filter']+'%'};return _0x3b31e4;})});}_0x4e0e30=_[_0xb88a('0x43')]({},_0x4e0e30,_0x36b7c1['options']);return _0x693880[_0xb88a('0x71')](_0x4e0e30);}})[_0xb88a('0x27')](function(_0x56c12c){if(_0x56c12c){_0x166277=_0x56c12c[_0xb88a('0x3c')];if(!_0x36b7c1[_0xb88a('0x37')][_0xb88a('0x3d')]('nolimit')){_0x4e0e30[_0xb88a('0x20')]=qs[_0xb88a('0x20')](_0x36b7c1[_0xb88a('0x37')][_0xb88a('0x20')]);_0x4e0e30['offset']=qs[_0xb88a('0x1f')](_0x36b7c1[_0xb88a('0x37')][_0xb88a('0x1f')]);}return _0x693880[_0xb88a('0x71')](_0x4e0e30);}})[_0xb88a('0x27')](function(_0x4e8b25){if(_0x4e8b25){return _0x4e8b25?{'count':_0x166277,'rows':_0x4e8b25}:null;}})[_0xb88a('0x27')](respondWithResult(_0xa1826c,null))[_0xb88a('0x49')](handleError(_0xa1826c,null));}; \ No newline at end of file +var _0xe326=['basename','extname','%s.%s','symlinkSync','removeSound','id2','Sound','getSounds','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','json','apply','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','error','name','send','index','VoiceMusicOnHold','rawAttributes','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format'];(function(_0x266f39,_0x397dda){var _0x412f6d=function(_0x40d86d){while(--_0x40d86d){_0x266f39['push'](_0x266f39['shift']());}};_0x412f6d(++_0x397dda);}(_0xe326,0x1bc));var _0x6e32=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0xe326[_0x3bab09];return _0x164376;};'use strict';var pdf=require(_0x6e32('0x0'));var emlformat=require(_0x6e32('0x1'));var rimraf=require(_0x6e32('0x2'));var zipdir=require(_0x6e32('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6e32('0x4'));var BPromise=require(_0x6e32('0x5'));var Mustache=require('mustache');var util=require(_0x6e32('0x6'));var path=require('path');var sox=require(_0x6e32('0x7'));var csv=require(_0x6e32('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e32('0x9'));var squel=require('squel');var crypto=require(_0x6e32('0xa'));var jsforce=require(_0x6e32('0xb'));var deskjs=require(_0x6e32('0xc'));var toCsv=require(_0x6e32('0x8'));var querystring=require(_0x6e32('0xd'));var Papa=require(_0x6e32('0xe'));var Redis=require('ioredis');var authService=require(_0x6e32('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6e32('0x10'));var hardwareService=require(_0x6e32('0x11'));var logger=require(_0x6e32('0x12'))(_0x6e32('0x13'));var utils=require('../../config/utils');var config=require(_0x6e32('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e32('0x15'))['db'];function respondWithStatusCode(_0x3f86ab,_0x5081a7){_0x5081a7=_0x5081a7||0xcc;return function(_0x340a17){if(_0x340a17){return _0x3f86ab[_0x6e32('0x16')](_0x5081a7);}return _0x3f86ab[_0x6e32('0x17')](_0x5081a7)[_0x6e32('0x18')]();};}function respondWithResult(_0xd5ad8b,_0x24cb82){_0x24cb82=_0x24cb82||0xc8;return function(_0x18d995){if(_0x18d995){return _0xd5ad8b[_0x6e32('0x17')](_0x24cb82)['json'](_0x18d995);}};}function respondWithFilteredResult(_0x38c5a2,_0x394363){return function(_0x112351){if(_0x112351){var _0x300aa8=_0x112351['count'],_0x84c278=_0x394363['offset'],_0x156dc5=_0x394363[_0x6e32('0x19')]+_0x394363[_0x6e32('0x1a')],_0x51f89b;if(_0x156dc5>=_0x300aa8){_0x156dc5=_0x300aa8;_0x51f89b=0xc8;}else{_0x51f89b=0xce;}_0x38c5a2[_0x6e32('0x17')](_0x51f89b);return _0x38c5a2[_0x6e32('0x1b')]('Content-Range',_0x84c278+'-'+_0x156dc5+'/'+_0x300aa8)[_0x6e32('0x1c')](_0x112351);}return null;};}function patchUpdates(_0x1f5c3b){return function(_0x454738){try{jsonpatch[_0x6e32('0x1d')](_0x454738,_0x1f5c3b,!![]);}catch(_0x1f956c){return BPromise['reject'](_0x1f956c);}return _0x454738[_0x6e32('0x1e')]();};}function saveUpdates(_0x59b40b,_0x2aa0d8){return function(_0x4c7608){if(_0x4c7608){return _0x4c7608[_0x6e32('0x1f')](_0x59b40b)['then'](function(_0x175602){return _0x175602;});}return null;};}function removeEntity(_0x3d43c7,_0x32cfc2){return function(_0x1cb92d){if(_0x1cb92d){return _0x1cb92d[_0x6e32('0x20')]()['then'](function(){var _0x32dd46=_0x1cb92d[_0x6e32('0x21')]({'plain':!![]});var _0x4ae48f=_0x6e32('0x22');return db[_0x6e32('0x23')][_0x6e32('0x20')]({'where':{'type':_0x4ae48f,'resourceId':_0x32dd46['id']}})['then'](function(){return _0x1cb92d;});})[_0x6e32('0x24')](function(){_0x3d43c7['status'](0xcc)[_0x6e32('0x18')]();});}};}function handleEntityNotFound(_0x24cd3b,_0x3b47a2){return function(_0x2066fd){if(!_0x2066fd){_0x24cd3b[_0x6e32('0x16')](0x194);}return _0x2066fd;};}function handleError(_0x9eb9cf,_0x3fc068){_0x3fc068=_0x3fc068||0x1f4;return function(_0xb6dc3b){logger[_0x6e32('0x25')](_0xb6dc3b['stack']);if(_0xb6dc3b['name']){delete _0xb6dc3b[_0x6e32('0x26')];}_0x9eb9cf[_0x6e32('0x17')](_0x3fc068)[_0x6e32('0x27')](_0xb6dc3b);};}exports[_0x6e32('0x28')]=function(_0x56d35c,_0xb937b8){var _0x358607={},_0x196ef1={},_0x54c3fe={'count':0x0,'rows':[]};var _0x2408d9=_['map'](db[_0x6e32('0x29')][_0x6e32('0x2a')],function(_0x11add6){return{'name':_0x11add6['fieldName'],'type':_0x11add6['type']['key']};});_0x196ef1['model']=_['map'](_0x2408d9,_0x6e32('0x26'));_0x196ef1[_0x6e32('0x2b')]=_[_0x6e32('0x2c')](_0x56d35c[_0x6e32('0x2b')]);_0x196ef1[_0x6e32('0x2d')]=_['intersection'](_0x196ef1['model'],_0x196ef1[_0x6e32('0x2b')]);_0x358607[_0x6e32('0x2e')]=_[_0x6e32('0x2f')](_0x196ef1[_0x6e32('0x30')],qs[_0x6e32('0x31')](_0x56d35c[_0x6e32('0x2b')]['fields']));_0x358607['attributes']=_0x358607[_0x6e32('0x2e')][_0x6e32('0x32')]?_0x358607['attributes']:_0x196ef1['model'];if(!_0x56d35c['query'][_0x6e32('0x33')](_0x6e32('0x34'))){_0x358607[_0x6e32('0x1a')]=qs[_0x6e32('0x1a')](_0x56d35c[_0x6e32('0x2b')][_0x6e32('0x1a')]);_0x358607['offset']=qs[_0x6e32('0x19')](_0x56d35c[_0x6e32('0x2b')][_0x6e32('0x19')]);}_0x358607[_0x6e32('0x35')]=qs[_0x6e32('0x36')](_0x56d35c[_0x6e32('0x2b')][_0x6e32('0x36')]);_0x358607[_0x6e32('0x37')]=qs[_0x6e32('0x2d')](_[_0x6e32('0x38')](_0x56d35c[_0x6e32('0x2b')],_0x196ef1[_0x6e32('0x2d')]),_0x2408d9);if(_0x56d35c[_0x6e32('0x2b')][_0x6e32('0x39')]){_0x358607[_0x6e32('0x37')]=_[_0x6e32('0x3a')](_0x358607[_0x6e32('0x37')],{'$or':_['map'](_0x2408d9,function(_0x565a97){if(_0x565a97['type']!==_0x6e32('0x3b')){var _0x330b17={};_0x330b17[_0x565a97[_0x6e32('0x26')]]={'$like':'%'+_0x56d35c['query'][_0x6e32('0x39')]+'%'};return _0x330b17;}})});}_0x358607=_[_0x6e32('0x3a')]({},_0x358607,_0x56d35c[_0x6e32('0x3c')]);var _0x9c0f38={'where':_0x358607['where']};return db[_0x6e32('0x29')][_0x6e32('0x3d')](_0x9c0f38)['then'](function(_0x33a819){_0x54c3fe['count']=_0x33a819;if(_0x56d35c[_0x6e32('0x2b')][_0x6e32('0x3e')]){_0x358607[_0x6e32('0x3f')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x358607);})[_0x6e32('0x24')](function(_0x16ca13){_0x54c3fe[_0x6e32('0x40')]=_0x16ca13;return _0x54c3fe;})['then'](respondWithFilteredResult(_0xb937b8,_0x358607))[_0x6e32('0x41')](handleError(_0xb937b8,null));};exports[_0x6e32('0x42')]=function(_0x431e71,_0x435cfe){var _0x2b9333={'raw':![],'where':{'id':_0x431e71[_0x6e32('0x43')]['id']}},_0x4d8a00={};_0x4d8a00['model']=_[_0x6e32('0x2c')](db[_0x6e32('0x29')][_0x6e32('0x2a')]);_0x4d8a00[_0x6e32('0x2b')]=_[_0x6e32('0x2c')](_0x431e71[_0x6e32('0x2b')]);_0x4d8a00[_0x6e32('0x2d')]=_['intersection'](_0x4d8a00[_0x6e32('0x30')],_0x4d8a00[_0x6e32('0x2b')]);_0x2b9333[_0x6e32('0x2e')]=_[_0x6e32('0x2f')](_0x4d8a00[_0x6e32('0x30')],qs[_0x6e32('0x31')](_0x431e71[_0x6e32('0x2b')]['fields']));_0x2b9333[_0x6e32('0x2e')]=_0x2b9333['attributes']['length']?_0x2b9333[_0x6e32('0x2e')]:_0x4d8a00[_0x6e32('0x30')];if(_0x431e71[_0x6e32('0x2b')][_0x6e32('0x3e')]){_0x2b9333['include']=[{'all':!![]}];}_0x2b9333=_[_0x6e32('0x3a')]({},_0x2b9333,_0x431e71[_0x6e32('0x3c')]);return db[_0x6e32('0x29')][_0x6e32('0x44')](_0x2b9333)[_0x6e32('0x24')](handleEntityNotFound(_0x435cfe,null))[_0x6e32('0x24')](respondWithResult(_0x435cfe,null))[_0x6e32('0x41')](handleError(_0x435cfe,null));};exports[_0x6e32('0x1f')]=function(_0x2334ec,_0x5cc559){if(_0x2334ec[_0x6e32('0x45')]['id']){delete _0x2334ec[_0x6e32('0x45')]['id'];}return db['VoiceMusicOnHold'][_0x6e32('0x44')]({'where':{'id':_0x2334ec[_0x6e32('0x43')]['id']}})['then'](handleEntityNotFound(_0x5cc559,null))[_0x6e32('0x24')](saveUpdates(_0x2334ec[_0x6e32('0x45')],null))[_0x6e32('0x24')](respondWithResult(_0x5cc559,null))[_0x6e32('0x41')](handleError(_0x5cc559,null));};exports[_0x6e32('0x46')]=function(_0x312a24,_0xd29f6d,_0x7c848b){return db[_0x6e32('0x47')][_0x6e32('0x48')](function(_0x1896ac){if(_0x312a24['body'][_0x6e32('0x49')]===_0x6e32('0x4a')){_0x312a24['body'][_0x6e32('0x4b')]=path[_0x6e32('0x4c')](config[_0x6e32('0x4d')],_0x6e32('0x4e'),_0x312a24[_0x6e32('0x45')][_0x6e32('0x26')]);}return db[_0x6e32('0x29')][_0x6e32('0x46')](_0x312a24[_0x6e32('0x45')],{'transaction':_0x1896ac})[_0x6e32('0x24')](function(_0x56d3aa){if(_0x312a24[_0x6e32('0x45')][_0x6e32('0x49')]===_0x6e32('0x4a')){fs[_0x6e32('0x4f')](_0x56d3aa['directory'],parseInt(_0x6e32('0x50'),0x8));}var _0x5377e1=_0x312a24[_0x6e32('0x51')]['get']({'plain':!![]});if(!_0x5377e1)throw new Error(_0x6e32('0x52'));if(_0x5377e1[_0x6e32('0x53')]===_0x6e32('0x51')){var _0x2fa25d=_0x56d3aa[_0x6e32('0x21')]({'plain':!![]});return db[_0x6e32('0x54')][_0x6e32('0x44')]({'where':{'name':_0x6e32('0x22'),'userProfileId':_0x5377e1[_0x6e32('0x55')]},'raw':!![]})[_0x6e32('0x24')](function(_0x10860a){if(_0x10860a&&_0x10860a[_0x6e32('0x56')]===0x0){return db[_0x6e32('0x23')][_0x6e32('0x46')]({'name':_0x2fa25d[_0x6e32('0x26')],'resourceId':_0x2fa25d['id'],'type':_0x10860a[_0x6e32('0x26')],'sectionId':_0x10860a['id']},{})[_0x6e32('0x24')](function(){return _0x56d3aa;});}else{return _0x56d3aa;}})[_0x6e32('0x41')](function(_0x42937d){logger[_0x6e32('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42937d);});}return _0x56d3aa;});})[_0x6e32('0x24')](respondWithResult(_0xd29f6d,0xc9))['catch'](handleError(_0xd29f6d,null));};exports[_0x6e32('0x20')]=function(_0xb9b561,_0x5dcfc0,_0x227cee){var _0x407700;return db[_0x6e32('0x29')][_0x6e32('0x44')]({'where':{'id':_0xb9b561[_0x6e32('0x43')]['id']}})[_0x6e32('0x24')](function(_0x28ae65){if(_0x28ae65){return db[_0x6e32('0x47')][_0x6e32('0x48')](function(_0xef3e90){return _0x28ae65[_0x6e32('0x20')]({'transaction':_0xef3e90,'raw':!![]})[_0x6e32('0x24')](function(_0x25fbb0){if(_0x25fbb0[_0x6e32('0x4b')]){fs[_0x6e32('0x57')](_0x25fbb0['directory'])[_0x6e32('0x58')](function(_0x1cdaf1){fs[_0x6e32('0x59')](path[_0x6e32('0x4c')](_0x25fbb0[_0x6e32('0x4b')],_0x1cdaf1));});fs[_0x6e32('0x5a')](_0x25fbb0[_0x6e32('0x4b')]);}return _0x25fbb0;});})[_0x6e32('0x41')](function(_0x2301ca){throw new db[(_0x6e32('0x5b'))][(_0x6e32('0x5c'))](_0x2301ca[_0x6e32('0x5d')]);});}})['then'](handleEntityNotFound(_0x5dcfc0,null))[_0x6e32('0x24')](removeEntity(_0x5dcfc0,null))[_0x6e32('0x41')](handleError(_0x5dcfc0,null));};exports[_0x6e32('0x5e')]=function(_0x1e9c85,_0x2908cb,_0x4dea16){return db[_0x6e32('0x47')][_0x6e32('0x48')](function(_0x10c12f){var _0x443a47;return db[_0x6e32('0x29')][_0x6e32('0x44')]({'where':{'id':_0x1e9c85[_0x6e32('0x43')]['id']}})['then'](function(_0x57256a){if(_0x57256a){_0x443a47=_0x57256a;return _0x57256a[_0x6e32('0x5e')](_0x1e9c85['body']['id'],{'transaction':_0x10c12f});}})[_0x6e32('0x24')](function(_0x4d6ad4){if(_0x4d6ad4){return db['Sound'][_0x6e32('0x5f')]({'where':{'id':_0x1e9c85['body']['id']},'attributes':['id',_0x6e32('0x26'),_0x6e32('0x60'),_0x6e32('0x61'),_0x6e32('0x62')],'raw':!![]});}})['then'](function(_0x30181c){if(_0x30181c){var _0x5bdb17=path[_0x6e32('0x4c')](config['root'],_0x6e32('0x63'),util[_0x6e32('0x64')]('%s.%s',path[_0x6e32('0x65')](_0x30181c['save_name'],path[_0x6e32('0x66')](_0x30181c[_0x6e32('0x60')])),_0x30181c['converted_format']));var _0x3557f7=path['join'](config[_0x6e32('0x4d')],'server/files/moh',_0x443a47[_0x6e32('0x26')],util[_0x6e32('0x64')](_0x6e32('0x67'),_0x30181c[_0x6e32('0x26')],_0x30181c[_0x6e32('0x61')]));fs[_0x6e32('0x68')](_0x5bdb17,_0x3557f7);return _0x30181c;}})[_0x6e32('0x41')](function(_0x4f2b01){throw new db[(_0x6e32('0x5b'))][(_0x6e32('0x5c'))](_0x4f2b01['message']);});})[_0x6e32('0x24')](handleEntityNotFound(_0x2908cb,null))[_0x6e32('0x24')](respondWithResult(_0x2908cb,0xc9))[_0x6e32('0x41')](handleError(_0x2908cb,null));};exports[_0x6e32('0x69')]=function(_0x551ea7,_0x32b05c,_0x14ff97){return db[_0x6e32('0x47')][_0x6e32('0x48')](function(_0x43e1aa){var _0x42bf99;return db['VoiceMusicOnHold'][_0x6e32('0x5f')]({'where':{'id':_0x551ea7['params']['id']}})['then'](handleEntityNotFound(_0x32b05c,null))[_0x6e32('0x24')](function(_0x24162d){if(_0x24162d){_0x42bf99=_0x24162d;return _0x24162d[_0x6e32('0x69')](_0x551ea7[_0x6e32('0x43')][_0x6e32('0x6a')]);}})[_0x6e32('0x24')](function(_0x18ab24){if(_0x18ab24){return db[_0x6e32('0x6b')][_0x6e32('0x5f')]({'where':{'id':_0x551ea7[_0x6e32('0x43')][_0x6e32('0x6a')]},'attributes':['id',_0x6e32('0x26'),_0x6e32('0x60'),'converted_format',_0x6e32('0x62')],'raw':!![]});}})['then'](function(_0x2847b4){if(_0x2847b4){fs['unlinkSync'](path['join'](_0x42bf99[_0x6e32('0x4b')],util[_0x6e32('0x64')](_0x6e32('0x67'),_0x2847b4[_0x6e32('0x26')],_0x2847b4[_0x6e32('0x61')])));return _0x2847b4;}})['catch'](function(_0x5e0c4f){throw new db[(_0x6e32('0x5b'))]['ValidationError'](_0x5e0c4f[_0x6e32('0x5d')]);});})[_0x6e32('0x24')](handleEntityNotFound(_0x32b05c,null))[_0x6e32('0x24')](respondWithStatusCode(_0x32b05c,0xcc))[_0x6e32('0x41')](handleError(_0x32b05c,null));};exports['getSounds']=function(_0x112a5d,_0x49322c,_0x536915){var _0x1813aa={};var _0x36802d={};var _0x15a409;var _0x5a8fe2;return db[_0x6e32('0x29')][_0x6e32('0x5f')]({'where':{'id':_0x112a5d[_0x6e32('0x43')]['id']}})[_0x6e32('0x24')](handleEntityNotFound(_0x49322c,null))[_0x6e32('0x24')](function(_0x5cc1c5){if(_0x5cc1c5){_0x15a409=_0x5cc1c5;_0x36802d[_0x6e32('0x30')]=_['keys'](db[_0x6e32('0x6b')][_0x6e32('0x2a')]);_0x36802d[_0x6e32('0x2b')]=_[_0x6e32('0x2c')](_0x112a5d[_0x6e32('0x2b')]);_0x36802d[_0x6e32('0x2d')]=_[_0x6e32('0x2f')](_0x36802d[_0x6e32('0x30')],_0x36802d[_0x6e32('0x2b')]);_0x1813aa[_0x6e32('0x2e')]=_[_0x6e32('0x2f')](_0x36802d['model'],qs[_0x6e32('0x31')](_0x112a5d[_0x6e32('0x2b')][_0x6e32('0x31')]));_0x1813aa[_0x6e32('0x2e')]=_0x1813aa[_0x6e32('0x2e')][_0x6e32('0x32')]?_0x1813aa[_0x6e32('0x2e')]:_0x36802d[_0x6e32('0x30')];_0x1813aa[_0x6e32('0x35')]=qs[_0x6e32('0x36')](_0x112a5d[_0x6e32('0x2b')][_0x6e32('0x36')]);_0x1813aa[_0x6e32('0x37')]=qs[_0x6e32('0x2d')](_['pick'](_0x112a5d['query'],_0x36802d[_0x6e32('0x2d')]));if(_0x112a5d[_0x6e32('0x2b')][_0x6e32('0x39')]){_0x1813aa[_0x6e32('0x37')]=_[_0x6e32('0x3a')](_0x1813aa[_0x6e32('0x37')],{'$or':_['map'](_0x1813aa[_0x6e32('0x2e')],function(_0x291eda){var _0x4229be={};_0x4229be[_0x291eda]={'$like':'%'+_0x112a5d[_0x6e32('0x2b')][_0x6e32('0x39')]+'%'};return _0x4229be;})});}_0x1813aa=_[_0x6e32('0x3a')]({},_0x1813aa,_0x112a5d['options']);return _0x15a409[_0x6e32('0x6c')](_0x1813aa);}})[_0x6e32('0x24')](function(_0x331a18){if(_0x331a18){_0x5a8fe2=_0x331a18[_0x6e32('0x32')];if(!_0x112a5d[_0x6e32('0x2b')][_0x6e32('0x33')](_0x6e32('0x34'))){_0x1813aa[_0x6e32('0x1a')]=qs[_0x6e32('0x1a')](_0x112a5d['query'][_0x6e32('0x1a')]);_0x1813aa['offset']=qs[_0x6e32('0x19')](_0x112a5d[_0x6e32('0x2b')][_0x6e32('0x19')]);}return _0x15a409[_0x6e32('0x6c')](_0x1813aa);}})[_0x6e32('0x24')](function(_0x4c77df){if(_0x4c77df){return _0x4c77df?{'count':_0x5a8fe2,'rows':_0x4c77df}:null;}})[_0x6e32('0x24')](respondWithResult(_0x49322c,null))[_0x6e32('0x41')](handleError(_0x49322c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 199892e..cb4f162 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 _0xbd1d=['voice_musiconhold','util','../../config/logger','api','bluebird','request-promise','path','./voiceMusicOnHold.attributes','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbd1d,0x1c3));var _0xdbd1=function(_0x225252,_0x160079){_0x225252=_0x225252-0x0;var _0x4d305e=_0xbd1d[_0x225252];return _0x4d305e;};'use strict';var _=require('lodash');var util=require(_0xdbd1('0x0'));var logger=require(_0xdbd1('0x1'))(_0xdbd1('0x2'));var moment=require('moment');var BPromise=require(_0xdbd1('0x3'));var rp=require(_0xdbd1('0x4'));var fs=require('fs');var path=require(_0xdbd1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdbd1('0x6'));module[_0xdbd1('0x7')]=function(_0x1cfc09,_0x2ff50b){return _0x1cfc09['define']('VoiceMusicOnHold',attributes,{'tableName':_0xdbd1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0354=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0354,0x10f));var _0x4035=function(_0x1e3554,_0x4dff60){_0x1e3554=_0x1e3554-0x0;var _0x2158af=_0x0354[_0x1e3554];return _0x2158af;};'use strict';var _=require(_0x4035('0x0'));var util=require('util');var logger=require(_0x4035('0x1'))(_0x4035('0x2'));var moment=require(_0x4035('0x3'));var BPromise=require(_0x4035('0x4'));var rp=require(_0x4035('0x5'));var fs=require('fs');var path=require(_0x4035('0x6'));var rimraf=require(_0x4035('0x7'));var config=require(_0x4035('0x8'));var attributes=require(_0x4035('0x9'));module[_0x4035('0xa')]=function(_0x38114e,_0x2c2e38){return _0x38114e['define'](_0x4035('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 9b80061..08d7af3 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 _0xd2cc=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0xe18690,_0xcb4ffc){var _0x3c8fd9=function(_0x2688fd){while(--_0x2688fd){_0xe18690['push'](_0xe18690['shift']());}};_0x3c8fd9(++_0xcb4ffc);}(_0xd2cc,0x157));var _0xcd2c=function(_0x26c3b9,_0x2f7830){_0x26c3b9=_0x26c3b9-0x0;var _0x1c6818=_0xd2cc[_0x26c3b9];return _0x1c6818;};'use strict';var _=require(_0xcd2c('0x0'));var util=require(_0xcd2c('0x1'));var moment=require(_0xcd2c('0x2'));var BPromise=require(_0xcd2c('0x3'));var rs=require(_0xcd2c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd2c('0x5'))['db'];var utils=require(_0xcd2c('0x6'));var logger=require(_0xcd2c('0x7'))(_0xcd2c('0x8'));var config=require('../../config/environment');var jayson=require(_0xcd2c('0x9'));var client=jayson[_0xcd2c('0xa')][_0xcd2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x420f25,_0x5627b0,_0x4b078f){return new BPromise(function(_0xf5b09,_0x3d8a97){return client[_0xcd2c('0xc')](_0x420f25,_0x4b078f)['then'](function(_0x19d74c){logger[_0xcd2c('0xd')](_0xcd2c('0xe'),_0x5627b0,_0xcd2c('0xf'));logger[_0xcd2c('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x5627b0,_0xcd2c('0xf'),JSON[_0xcd2c('0x11')](_0x19d74c));if(_0x19d74c[_0xcd2c('0x12')]){if(_0x19d74c['error'][_0xcd2c('0x13')]===0x1f4){logger[_0xcd2c('0x12')](_0xcd2c('0xe'),_0x5627b0,_0x19d74c[_0xcd2c('0x12')][_0xcd2c('0x14')]);return _0x3d8a97(_0x19d74c[_0xcd2c('0x12')][_0xcd2c('0x14')]);}logger['error'](_0xcd2c('0xe'),_0x5627b0,_0x19d74c['error']['message']);return _0xf5b09(_0x19d74c[_0xcd2c('0x12')][_0xcd2c('0x14')]);}else{logger[_0xcd2c('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5627b0,'request\x20sent');_0xf5b09(_0x19d74c[_0xcd2c('0x15')]['message']);}})[_0xcd2c('0x16')](function(_0x26481c){logger[_0xcd2c('0x12')](_0xcd2c('0xe'),_0x5627b0,_0x26481c);_0x3d8a97(_0x26481c);});});} \ No newline at end of file +var _0xb5cb=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0xb5cb,0x1ed));var _0xbb5c=function(_0x267559,_0x1f907c){_0x267559=_0x267559-0x0;var _0x2fafc9=_0xb5cb[_0x267559];return _0x2fafc9;};'use strict';var _=require(_0xbb5c('0x0'));var util=require('util');var moment=require(_0xbb5c('0x1'));var BPromise=require('bluebird');var rs=require(_0xbb5c('0x2'));var fs=require('fs');var Redis=require(_0xbb5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb5c('0x4'));var logger=require(_0xbb5c('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbb5c('0x6'));var client=jayson[_0xbb5c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31935c,_0x512de4,_0x77d918){return new BPromise(function(_0x3f84bb,_0x48c5b2){return client['request'](_0x31935c,_0x77d918)[_0xbb5c('0x8')](function(_0x2382b0){logger[_0xbb5c('0x9')](_0xbb5c('0xa'),_0x512de4,_0xbb5c('0xb'));logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x512de4,_0xbb5c('0xb'),JSON[_0xbb5c('0xc')](_0x2382b0));if(_0x2382b0[_0xbb5c('0xd')]){if(_0x2382b0[_0xbb5c('0xd')]['code']===0x1f4){logger[_0xbb5c('0xd')](_0xbb5c('0xa'),_0x512de4,_0x2382b0[_0xbb5c('0xd')][_0xbb5c('0xe')]);return _0x48c5b2(_0x2382b0[_0xbb5c('0xd')]['message']);}logger[_0xbb5c('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x512de4,_0x2382b0[_0xbb5c('0xd')]['message']);return _0x3f84bb(_0x2382b0[_0xbb5c('0xd')]['message']);}else{logger[_0xbb5c('0x9')](_0xbb5c('0xa'),_0x512de4,_0xbb5c('0xb'));_0x3f84bb(_0x2382b0[_0xbb5c('0xf')][_0xbb5c('0xe')]);}})[_0xbb5c('0x10')](function(_0x4bd683){logger[_0xbb5c('0xd')](_0xbb5c('0xa'),_0x512de4,_0x4bd683);_0x48c5b2(_0x4bd683);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index c90295b..bf54022 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 _0x6f94=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','index','/describe','describe','/:id','isAuthenticated','show','getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents','exports'];(function(_0x31c155,_0x2abeba){var _0x1d06fc=function(_0xb9a30e){while(--_0xb9a30e){_0x31c155['push'](_0x31c155['shift']());}};_0x1d06fc(++_0x2abeba);}(_0x6f94,0x1ba));var _0x46f9=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x6f94[_0x1da527];return _0x40fc7c;};'use strict';var multer=require(_0x46f9('0x0'));var util=require(_0x46f9('0x1'));var path=require(_0x46f9('0x2'));var timeout=require(_0x46f9('0x3'));var express=require(_0x46f9('0x4'));var router=express[_0x46f9('0x5')]();var auth=require(_0x46f9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x46f9('0x7'));var controller=require(_0x46f9('0x8'));router[_0x46f9('0x9')]('/',auth['isAuthenticated'](),controller[_0x46f9('0xa')]);router[_0x46f9('0x9')](_0x46f9('0xb'),auth['isAuthenticated'](),controller[_0x46f9('0xc')]);router['get'](_0x46f9('0xd'),auth[_0x46f9('0xe')](),controller[_0x46f9('0xf')]);router[_0x46f9('0x9')]('/:id/users',auth[_0x46f9('0xe')](),controller[_0x46f9('0x10')]);router[_0x46f9('0x11')]('/',auth[_0x46f9('0xe')](),controller[_0x46f9('0x12')]);router[_0x46f9('0x11')]('/:id/users',auth[_0x46f9('0xe')](),controller[_0x46f9('0x13')]);router[_0x46f9('0x14')](_0x46f9('0xd'),auth['isAuthenticated'](),controller[_0x46f9('0x15')]);router['delete'](_0x46f9('0xd'),auth[_0x46f9('0xe')](),controller[_0x46f9('0x16')]);router[_0x46f9('0x17')]('/:id/users',auth[_0x46f9('0xe')](),controller[_0x46f9('0x18')]);module[_0x46f9('0x19')]=router; \ No newline at end of file +var _0x2b39=['../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','isAuthenticated','describe','/:id','show','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b39,0x181));var _0x92b3=function(_0x3e4667,_0x159f55){_0x3e4667=_0x3e4667-0x0;var _0x89df4e=_0x2b39[_0x3e4667];return _0x89df4e;};'use strict';var multer=require(_0x92b3('0x0'));var util=require(_0x92b3('0x1'));var path=require(_0x92b3('0x2'));var timeout=require(_0x92b3('0x3'));var express=require(_0x92b3('0x4'));var router=express['Router']();var auth=require(_0x92b3('0x5'));var interaction=require(_0x92b3('0x6'));var config=require(_0x92b3('0x7'));var controller=require(_0x92b3('0x8'));router[_0x92b3('0x9')]('/',auth['isAuthenticated'](),controller[_0x92b3('0xa')]);router[_0x92b3('0x9')]('/describe',auth[_0x92b3('0xb')](),controller[_0x92b3('0xc')]);router[_0x92b3('0x9')](_0x92b3('0xd'),auth['isAuthenticated'](),controller[_0x92b3('0xe')]);router['get'](_0x92b3('0xf'),auth[_0x92b3('0xb')](),controller[_0x92b3('0x10')]);router[_0x92b3('0x11')]('/',auth[_0x92b3('0xb')](),controller[_0x92b3('0x12')]);router[_0x92b3('0x11')](_0x92b3('0xf'),auth['isAuthenticated'](),controller[_0x92b3('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x92b3('0x14')]);router[_0x92b3('0x15')](_0x92b3('0xd'),auth[_0x92b3('0xb')](),controller[_0x92b3('0x16')]);router[_0x92b3('0x15')](_0x92b3('0xf'),auth[_0x92b3('0xb')](),controller['removeAgents']);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 06d08ac..fabb9f4 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 _0xb6b1=['STRING','VIRTUAL','getDataValue','INTEGER','sequelize'];(function(_0xec555e,_0x34e5eb){var _0x5738c4=function(_0x21afb1){while(--_0x21afb1){_0xec555e['push'](_0xec555e['shift']());}};_0x5738c4(++_0x34e5eb);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x59616b,_0x38e534){_0x59616b=_0x59616b-0x0;var _0x5c4523=_0xb6b1[_0x59616b];return _0x5c4523;};'use strict';var Sequelize=require(_0x1b6b('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b6b('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x1b6b('0x2')],'get':function(_0x29651a){return'system-'+this[_0x1b6b('0x3')]('name')+'-';}},'description':{'type':Sequelize[_0x1b6b('0x1')]},'callerIdAll':{'type':Sequelize[_0x1b6b('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x1b6b('0x4')]}}; \ No newline at end of file +var _0x280f=['getDataValue','INTEGER','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x280f,0xe2));var _0xf280=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x280f[_0x4536a4];return _0x4fd1c1;};'use strict';var Sequelize=require(_0xf280('0x0'));module['exports']={'name':{'type':Sequelize[_0xf280('0x1')],'allowNull':![],'unique':_0xf280('0x2')},'prefix':{'type':Sequelize[_0xf280('0x3')],'get':function(_0x2d0377){return _0xf280('0x4')+this[_0xf280('0x5')](_0xf280('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xf280('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xf280('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 3f10c15..8b9e88d 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 _0x4fb4=['exten','description','Voice\x20Prefix\x20Extension','priority','prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','NoOp','goto','${EXTEN:','charAt','update','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','options','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','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','then','destroy','get','VoicePrefixes','UserProfileResource','name','send','VoicePrefix','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','describe','sequelize','transaction','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','context'];(function(_0x438685,_0x4ec0c0){var _0x41cca2=function(_0x532003){while(--_0x532003){_0x438685['push'](_0x438685['shift']());}};_0x41cca2(++_0x4ec0c0);}(_0x4fb4,0x190));var _0x44fb=function(_0x27b52c,_0x15dd0c){_0x27b52c=_0x27b52c-0x0;var _0x34699a=_0x4fb4[_0x27b52c];return _0x34699a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x44fb('0x0'));var rimraf=require(_0x44fb('0x1'));var zipdir=require(_0x44fb('0x2'));var jsonpatch=require(_0x44fb('0x3'));var rp=require(_0x44fb('0x4'));var moment=require(_0x44fb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x44fb('0x6'));var util=require(_0x44fb('0x7'));var path=require(_0x44fb('0x8'));var sox=require(_0x44fb('0x9'));var csv=require(_0x44fb('0xa'));var ejs=require(_0x44fb('0xb'));var fs=require('fs');var _=require(_0x44fb('0xc'));var squel=require(_0x44fb('0xd'));var crypto=require('crypto');var jsforce=require(_0x44fb('0xe'));var deskjs=require(_0x44fb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x44fb('0x10'));var Papa=require(_0x44fb('0x11'));var Redis=require(_0x44fb('0x12'));var authService=require(_0x44fb('0x13'));var qs=require(_0x44fb('0x14'));var as=require(_0x44fb('0x15'));var hardwareService=require(_0x44fb('0x16'));var logger=require(_0x44fb('0x17'))(_0x44fb('0x18'));var utils=require(_0x44fb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x44fb('0x1a'));var db=require(_0x44fb('0x1b'))['db'];config[_0x44fb('0x1c')]=_[_0x44fb('0x1d')](config[_0x44fb('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x44fb('0x1e'))(new Redis(config[_0x44fb('0x1c')]));require(_0x44fb('0x1f'))[_0x44fb('0x20')](socket);function respondWithStatusCode(_0x9a367d,_0x4985ce){_0x4985ce=_0x4985ce||0xcc;return function(_0xbc84db){if(_0xbc84db){return _0x9a367d[_0x44fb('0x21')](_0x4985ce);}return _0x9a367d[_0x44fb('0x22')](_0x4985ce)[_0x44fb('0x23')]();};}function respondWithResult(_0x550b32,_0x43ce3){_0x43ce3=_0x43ce3||0xc8;return function(_0x19b828){if(_0x19b828){return _0x550b32['status'](_0x43ce3)[_0x44fb('0x24')](_0x19b828);}};}function respondWithFilteredResult(_0x21886d,_0x2e0efd){return function(_0x13cf75){if(_0x13cf75){var _0x65f887=_0x13cf75[_0x44fb('0x25')],_0x22c2eb=_0x2e0efd[_0x44fb('0x26')],_0x19409a=_0x2e0efd['offset']+_0x2e0efd['limit'],_0x1074cd;if(_0x19409a>=_0x65f887){_0x19409a=_0x65f887;_0x1074cd=0xc8;}else{_0x1074cd=0xce;}_0x21886d['status'](_0x1074cd);return _0x21886d[_0x44fb('0x27')](_0x44fb('0x28'),_0x22c2eb+'-'+_0x19409a+'/'+_0x65f887)[_0x44fb('0x24')](_0x13cf75);}return null;};}function patchUpdates(_0x544647){return function(_0x52507a){try{jsonpatch[_0x44fb('0x29')](_0x52507a,_0x544647,!![]);}catch(_0x3394e2){return BPromise['reject'](_0x3394e2);}return _0x52507a['save']();};}function saveUpdates(_0x38e834,_0x5cf7ec){return function(_0x441d79){if(_0x441d79){return _0x441d79['update'](_0x38e834)[_0x44fb('0x2a')](function(_0x3563a6){return _0x3563a6;});}return null;};}function removeEntity(_0x1f3d5c,_0x4a27b6){return function(_0x5cd889){if(_0x5cd889){return _0x5cd889[_0x44fb('0x2b')]()[_0x44fb('0x2a')](function(){var _0x1c831e=_0x5cd889[_0x44fb('0x2c')]({'plain':!![]});var _0x5e7116=_0x44fb('0x2d');return db[_0x44fb('0x2e')]['destroy']({'where':{'type':_0x5e7116,'resourceId':_0x1c831e['id']}})['then'](function(){return _0x5cd889;});})[_0x44fb('0x2a')](function(){_0x1f3d5c[_0x44fb('0x22')](0xcc)[_0x44fb('0x23')]();});}};}function handleEntityNotFound(_0x1f5d4c,_0xb7e5e8){return function(_0x15e748){if(!_0x15e748){_0x1f5d4c[_0x44fb('0x21')](0x194);}return _0x15e748;};}function handleError(_0x35652e,_0x6bd0b4){_0x6bd0b4=_0x6bd0b4||0x1f4;return function(_0x4f079d){logger['error'](_0x4f079d['stack']);if(_0x4f079d[_0x44fb('0x2f')]){delete _0x4f079d['name'];}_0x35652e[_0x44fb('0x22')](_0x6bd0b4)[_0x44fb('0x30')](_0x4f079d);};}exports['index']=function(_0x212b10,_0x262aa1){var _0xca9051={},_0x1b13bb={},_0x6fa74e={'count':0x0,'rows':[]};var _0x4c0d7e=_['map'](db[_0x44fb('0x31')]['rawAttributes'],function(_0x14fb90){return{'name':_0x14fb90[_0x44fb('0x32')],'type':_0x14fb90[_0x44fb('0x33')][_0x44fb('0x34')]};});_0x1b13bb[_0x44fb('0x35')]=_[_0x44fb('0x36')](_0x4c0d7e,_0x44fb('0x2f'));_0x1b13bb[_0x44fb('0x37')]=_[_0x44fb('0x38')](_0x212b10[_0x44fb('0x37')]);_0x1b13bb[_0x44fb('0x39')]=_[_0x44fb('0x3a')](_0x1b13bb[_0x44fb('0x35')],_0x1b13bb[_0x44fb('0x37')]);_0xca9051[_0x44fb('0x3b')]=_['intersection'](_0x1b13bb['model'],qs['fields'](_0x212b10[_0x44fb('0x37')][_0x44fb('0x3c')]));_0xca9051[_0x44fb('0x3b')]=_0xca9051[_0x44fb('0x3b')]['length']?_0xca9051[_0x44fb('0x3b')]:_0x1b13bb[_0x44fb('0x35')];if(!_0x212b10['query'][_0x44fb('0x3d')]('nolimit')){_0xca9051[_0x44fb('0x3e')]=qs['limit'](_0x212b10[_0x44fb('0x37')]['limit']);_0xca9051[_0x44fb('0x26')]=qs['offset'](_0x212b10['query'][_0x44fb('0x26')]);}_0xca9051[_0x44fb('0x3f')]=qs[_0x44fb('0x40')](_0x212b10[_0x44fb('0x37')][_0x44fb('0x40')]);_0xca9051[_0x44fb('0x41')]=qs[_0x44fb('0x39')](_[_0x44fb('0x42')](_0x212b10[_0x44fb('0x37')],_0x1b13bb[_0x44fb('0x39')]),_0x4c0d7e);if(_0x212b10['query'][_0x44fb('0x43')]){_0xca9051[_0x44fb('0x41')]=_[_0x44fb('0x44')](_0xca9051[_0x44fb('0x41')],{'$or':_[_0x44fb('0x36')](_0x4c0d7e,function(_0x546d25){if(_0x546d25[_0x44fb('0x33')]!==_0x44fb('0x45')){var _0x53d958={};_0x53d958[_0x546d25['name']]={'$like':'%'+_0x212b10[_0x44fb('0x37')][_0x44fb('0x43')]+'%'};return _0x53d958;}})});}_0xca9051=_[_0x44fb('0x44')]({},_0xca9051,_0x212b10['options']);var _0xd22d2b={'where':_0xca9051[_0x44fb('0x41')]};return db[_0x44fb('0x31')][_0x44fb('0x25')](_0xd22d2b)[_0x44fb('0x2a')](function(_0x2129a9){_0x6fa74e['count']=_0x2129a9;if(_0x212b10[_0x44fb('0x37')]['includeAll']){_0xca9051[_0x44fb('0x46')]=[{'all':!![]}];}return db[_0x44fb('0x31')][_0x44fb('0x47')](_0xca9051);})[_0x44fb('0x2a')](function(_0x51b0d8){_0x6fa74e[_0x44fb('0x48')]=_0x51b0d8;return _0x6fa74e;})[_0x44fb('0x2a')](respondWithFilteredResult(_0x262aa1,_0xca9051))[_0x44fb('0x49')](handleError(_0x262aa1,null));};exports[_0x44fb('0x4a')]=function(_0x120649,_0x5b38e0){var _0x27d233={'raw':![],'where':{'id':_0x120649[_0x44fb('0x4b')]['id']}},_0x1df108={};_0x1df108[_0x44fb('0x35')]=_['keys'](db['VoicePrefix'][_0x44fb('0x4c')]);_0x1df108[_0x44fb('0x37')]=_['keys'](_0x120649[_0x44fb('0x37')]);_0x1df108['filters']=_['intersection'](_0x1df108['model'],_0x1df108['query']);_0x27d233[_0x44fb('0x3b')]=_[_0x44fb('0x3a')](_0x1df108[_0x44fb('0x35')],qs[_0x44fb('0x3c')](_0x120649['query'][_0x44fb('0x3c')]));_0x27d233[_0x44fb('0x3b')]=_0x27d233[_0x44fb('0x3b')][_0x44fb('0x4d')]?_0x27d233[_0x44fb('0x3b')]:_0x1df108[_0x44fb('0x35')];if(_0x120649[_0x44fb('0x37')][_0x44fb('0x4e')]){_0x27d233['include']=[{'all':!![]}];}_0x27d233=_[_0x44fb('0x44')]({},_0x27d233,_0x120649['options']);return db['VoicePrefix'][_0x44fb('0x4f')](_0x27d233)[_0x44fb('0x2a')](handleEntityNotFound(_0x5b38e0,null))[_0x44fb('0x2a')](respondWithResult(_0x5b38e0,null))['catch'](handleError(_0x5b38e0,null));};exports[_0x44fb('0x2b')]=function(_0x326931,_0x3ff985){return db[_0x44fb('0x31')][_0x44fb('0x4f')]({'where':{'id':_0x326931[_0x44fb('0x4b')]['id']}})[_0x44fb('0x2a')](handleEntityNotFound(_0x3ff985,null))['then'](removeEntity(_0x3ff985,null))[_0x44fb('0x49')](handleError(_0x3ff985,null));};exports['describe']=function(_0x13e77b,_0x5d3e8d){return db[_0x44fb('0x31')][_0x44fb('0x50')]()[_0x44fb('0x2a')](respondWithResult(_0x5d3e8d,null))[_0x44fb('0x49')](handleError(_0x5d3e8d,null));};exports['create']=function(_0x3aa6fd,_0x33e6cc){var _0x247266;return db[_0x44fb('0x51')][_0x44fb('0x52')](function(_0x32b166){return db[_0x44fb('0x31')][_0x44fb('0x53')](_0x3aa6fd[_0x44fb('0x54')],{'transaction':_0x32b166})[_0x44fb('0x2a')](function(_0x12775c){_0x247266=_0x12775c[_0x44fb('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0x44fb('0x4f')]({'where':{'id':_0x247266['VoiceExtensionId']},'raw':!![]})[_0x44fb('0x2a')](function(_0x309730){return createVoicePrefixExtensions(_0x247266,_0x309730,_0x32b166);});});})['then'](function(){var _0x59345a=_0x3aa6fd['user'][_0x44fb('0x2c')]({'plain':!![]});if(!_0x59345a)throw new Error(_0x44fb('0x55'));if(_0x59345a[_0x44fb('0x56')]===_0x44fb('0x57')){var _0x380e22=_0x247266;return db[_0x44fb('0x58')][_0x44fb('0x4f')]({'where':{'name':_0x44fb('0x2d'),'userProfileId':_0x59345a[_0x44fb('0x59')]},'raw':!![]})[_0x44fb('0x2a')](function(_0x291f61){if(_0x291f61&&_0x291f61[_0x44fb('0x5a')]===0x0){return db[_0x44fb('0x2e')][_0x44fb('0x53')]({'name':_0x380e22[_0x44fb('0x2f')],'resourceId':_0x380e22['id'],'type':_0x291f61[_0x44fb('0x2f')],'sectionId':_0x291f61['id']},{})[_0x44fb('0x2a')](function(){return _0x247266;});}else{return _0x247266;}})[_0x44fb('0x49')](function(_0x351cbc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x351cbc);throw _0x351cbc;});}return _0x247266;})[_0x44fb('0x2a')](respondWithResult(_0x33e6cc,null))['catch'](handleError(_0x33e6cc,null));};function Extension(_0x57ef23,_0x56952d,_0x3e1989,_0x399586){this[_0x44fb('0x5b')]='from-sip';this[_0x44fb('0x5c')]=_0x57ef23;this['app']=_0x3e1989;this[_0x44fb('0x33')]='system';this[_0x44fb('0x5d')]=_0x44fb('0x5e');this[_0x44fb('0x5f')]=_0x56952d;this['appdata']=_0x399586;}function createVoicePrefixExtensions(_0x2f9b8b,_0x14cfc4,_0x9a88fe){return new BPromise(function(_0x5844d1,_0x646b2d){var _0x2e633c=new Extension(formatPrefixName(_0x2f9b8b[_0x44fb('0x60')]),0x1,'NoOp','Voice\x20Prefix');_0x2e633c[_0x44fb('0x61')]=_0x2f9b8b['id'];return db[_0x44fb('0x62')][_0x44fb('0x53')](_0x2e633c,{'transaction':_0x9a88fe})[_0x44fb('0x2a')](function(_0x5b3532){var _0x5683d9=_0x5b3532[_0x44fb('0x2c')]({'plain':!![]});var _0xc81529=_[_0x44fb('0x36')](addVoicePrefixExtensions(_0x2f9b8b,_0x14cfc4),function(_0x4233ad){_0x4233ad[_0x44fb('0x63')]=_0x5683d9['id'];_0x4233ad[_0x44fb('0x61')]=_0x2f9b8b['id'];return _0x4233ad;});return db['VoiceExtension'][_0x44fb('0x64')](_0xc81529,{'transaction':_0x9a88fe})[_0x44fb('0x2a')](function(_0x1b575f){if(!_0x1b575f){return _0x646b2d(_0x44fb('0x65'));}else{return _0x5844d1(_0x1b575f);}})['catch'](function(_0x4f0bb1){return _0x646b2d(_0x4f0bb1);});});;});};function addVoicePrefixExtensions(_0x23670c,_0xf0c095){var _0x3a56d1=[];var _0x5edbb9=formatPrefixName(_0x23670c[_0x44fb('0x60')]);_0x3a56d1['push'](new Extension(_0x5edbb9,0x2,_0x44fb('0x66'),_0x44fb('0x67')+_0x23670c[_0x44fb('0x2f')]));if(_0x23670c[_0x44fb('0x68')]){_0x3a56d1[_0x44fb('0x69')](new Extension(_0x5edbb9,0x3,'Set',_0x44fb('0x6a')+_0x23670c[_0x44fb('0x68')]));}else{_0x3a56d1[_0x44fb('0x69')](new Extension(_0x5edbb9,0x3,_0x44fb('0x6b'),'No\x20callerid\x20available'));}_0x3a56d1[_0x44fb('0x69')](new Extension(_0x5edbb9,0x4,_0x44fb('0x6c'),_0xf0c095[_0x44fb('0x5b')]+','+_0x44fb('0x6d')+(0x8+_0x23670c[_0x44fb('0x2f')][_0x44fb('0x4d')])+'}'+','+0x1));return _0x3a56d1;}function formatPrefixName(_0xf4a402){var _0x2db278='_';for(var _0x3d6286=0x0;_0x3d6286<_0xf4a402[_0x44fb('0x4d')];_0x3d6286++){if(_0xf4a402[_0x44fb('0x6e')](_0x3d6286)=='-'){_0x2db278+=_0xf4a402[_0x44fb('0x6e')](_0x3d6286);}else{_0x2db278+='['+_0xf4a402[_0x44fb('0x6e')](_0x3d6286)+']';}}_0x2db278+='.';return _0x2db278;}exports[_0x44fb('0x6f')]=function(_0x3903a6,_0x2a7b90,_0x2b57f3){var _0x3d421e=_0x3903a6[_0x44fb('0x54')];_0x3d421e['prefix']='system-'+_0x3d421e[_0x44fb('0x2f')]+'-';return db[_0x44fb('0x51')][_0x44fb('0x52')](function(_0x1feabd){return db[_0x44fb('0x31')][_0x44fb('0x6f')](_0x3d421e,{'where':{'id':_0x3d421e['id']},'transaction':_0x1feabd})['then'](function(){return db['VoiceExtension'][_0x44fb('0x2b')]({'where':{'VoicePrefixId':_0x3d421e['id']},'transaction':_0x1feabd})[_0x44fb('0x2a')](function(){return db[_0x44fb('0x62')][_0x44fb('0x4f')]({'where':{'id':_0x3d421e['VoiceExtensionId']},'raw':!![]})[_0x44fb('0x2a')](function(_0x335f8c){return createVoicePrefixExtensions(_0x3d421e,_0x335f8c,_0x1feabd);});});});})[_0x44fb('0x2a')](function(){return db[_0x44fb('0x31')][_0x44fb('0x70')](_0x3d421e['id']);})[_0x44fb('0x2a')](respondWithResult(_0x2a7b90,null))[_0x44fb('0x49')](handleError(_0x2a7b90,null));};exports[_0x44fb('0x71')]=function(_0x2d8489,_0x2ac0a5,_0x5231ac){return db[_0x44fb('0x31')][_0x44fb('0x4f')]({'where':{'id':_0x2d8489['params']['id']}})[_0x44fb('0x2a')](handleEntityNotFound(_0x2ac0a5,null))[_0x44fb('0x2a')](function(_0x4ce4c6){if(_0x4ce4c6){return _0x4ce4c6[_0x44fb('0x71')](_0x2d8489[_0x44fb('0x54')][_0x44fb('0x72')],_['omit'](_0x2d8489['body'],['ids','id'])||{})[_0x44fb('0x73')](function(_0x3d0574){for(var _0x42f3c8=0x0;_0x42f3c8<_0x2d8489[_0x44fb('0x54')][_0x44fb('0x72')][_0x44fb('0x4d')];_0x42f3c8+=0x1){socket[_0x44fb('0x74')](_0x44fb('0x75'),{'UserId':_0x2d8489['body'][_0x44fb('0x72')][_0x42f3c8],'VoicePrefixId':_0x2d8489[_0x44fb('0x4b')]['id']});}return _0x3d0574;});}})[_0x44fb('0x2a')](respondWithResult(_0x2ac0a5,null))[_0x44fb('0x49')](handleError(_0x2ac0a5,null));};exports[_0x44fb('0x76')]=function(_0x4d4e97,_0x271d10,_0x21785b){return db[_0x44fb('0x31')]['find']({'where':{'id':_0x4d4e97[_0x44fb('0x4b')]['id']}})[_0x44fb('0x2a')](handleEntityNotFound(_0x271d10,null))[_0x44fb('0x2a')](function(_0x3bfc06){if(_0x3bfc06){return _0x3bfc06[_0x44fb('0x76')](_0x4d4e97[_0x44fb('0x37')][_0x44fb('0x72')])[_0x44fb('0x2a')](function(){if(_[_0x44fb('0x77')](_0x4d4e97[_0x44fb('0x37')][_0x44fb('0x72')])){for(var _0x9bf083=0x0;_0x9bf083<_0x4d4e97[_0x44fb('0x37')][_0x44fb('0x72')]['length'];_0x9bf083+=0x1){socket[_0x44fb('0x74')](_0x44fb('0x78'),{'UserId':Number(_0x4d4e97[_0x44fb('0x37')][_0x44fb('0x72')][_0x9bf083]),'VoicePrefixId':Number(_0x4d4e97[_0x44fb('0x4b')]['id'])});}}else{socket[_0x44fb('0x74')](_0x44fb('0x78'),{'UserId':Number(_0x4d4e97[_0x44fb('0x37')][_0x44fb('0x72')]),'VoicePrefixId':Number(_0x4d4e97['params']['id'])});}});}})[_0x44fb('0x2a')](respondWithStatusCode(_0x271d10,null))['catch'](handleError(_0x271d10,null));};exports[_0x44fb('0x79')]=function(_0x23567c,_0x592c09,_0x4fb5eb){var _0x358042={};var _0x420980={};var _0x542408;var _0x8c0a5b;return db['VoicePrefix']['findOne']({'where':{'id':_0x23567c[_0x44fb('0x4b')]['id']}})[_0x44fb('0x2a')](handleEntityNotFound(_0x592c09,null))[_0x44fb('0x2a')](function(_0x2cd2e8){if(_0x2cd2e8){_0x542408=_0x2cd2e8;_0x420980[_0x44fb('0x35')]=_['keys'](db['User']['rawAttributes']);_0x420980[_0x44fb('0x37')]=_[_0x44fb('0x38')](_0x23567c[_0x44fb('0x37')]);_0x420980[_0x44fb('0x39')]=_[_0x44fb('0x3a')](_0x420980[_0x44fb('0x35')],_0x420980[_0x44fb('0x37')]);_0x358042[_0x44fb('0x3b')]=_[_0x44fb('0x3a')](_0x420980[_0x44fb('0x35')],qs[_0x44fb('0x3c')](_0x23567c[_0x44fb('0x37')][_0x44fb('0x3c')]));_0x358042[_0x44fb('0x3b')]=_0x358042['attributes'][_0x44fb('0x4d')]?_0x358042['attributes']:_0x420980[_0x44fb('0x35')];_0x358042[_0x44fb('0x3f')]=qs[_0x44fb('0x40')](_0x23567c[_0x44fb('0x37')][_0x44fb('0x40')]);_0x358042[_0x44fb('0x41')]=qs[_0x44fb('0x39')](_['pick'](_0x23567c['query'],_0x420980[_0x44fb('0x39')]));if(_0x23567c[_0x44fb('0x37')]['filter']){_0x358042[_0x44fb('0x41')]=_[_0x44fb('0x44')](_0x358042[_0x44fb('0x41')],{'$or':_[_0x44fb('0x36')](_0x358042[_0x44fb('0x3b')],function(_0x37db10){var _0x1e7329={};_0x1e7329[_0x37db10]={'$like':'%'+_0x23567c['query']['filter']+'%'};return _0x1e7329;})});}_0x358042=_['merge']({},_0x358042,_0x23567c[_0x44fb('0x7a')]);return _0x542408['getAgents'](_0x358042);}})[_0x44fb('0x2a')](function(_0x2f677f){if(_0x2f677f){_0x8c0a5b=_0x2f677f[_0x44fb('0x4d')];if(!_0x23567c[_0x44fb('0x37')][_0x44fb('0x3d')]('nolimit')){_0x358042['limit']=qs['limit'](_0x23567c[_0x44fb('0x37')][_0x44fb('0x3e')]);_0x358042['offset']=qs[_0x44fb('0x26')](_0x23567c['query']['offset']);}return _0x542408[_0x44fb('0x79')](_0x358042);}})[_0x44fb('0x2a')](function(_0x4c4843){if(_0x4c4843){return _0x4c4843?{'count':_0x8c0a5b,'rows':_0x4c4843}:null;}})[_0x44fb('0x2a')](respondWithResult(_0x592c09,null))[_0x44fb('0x49')](handleError(_0x592c09,null));}; \ No newline at end of file +var _0xf1c6=['transaction','findById','addAgents','ids','omit','userVoicePrefix:remove','getAgents','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./voicePrefix.socket','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','get','VoicePrefixes','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','VoicePrefix','findAll','catch','show','params','options','find','describe','create','sequelize','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','context','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','callerIdAll','push','Set','NoOp','goto','charAt','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf1c6,0xf4));var _0x6f1c=function(_0xfe00bd,_0x4c9578){_0xfe00bd=_0xfe00bd-0x0;var _0x50e3ee=_0xf1c6[_0xfe00bd];return _0x50e3ee;};'use strict';var pdf=require(_0x6f1c('0x0'));var emlformat=require(_0x6f1c('0x1'));var rimraf=require(_0x6f1c('0x2'));var zipdir=require(_0x6f1c('0x3'));var jsonpatch=require(_0x6f1c('0x4'));var rp=require(_0x6f1c('0x5'));var moment=require(_0x6f1c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6f1c('0x7'));var util=require(_0x6f1c('0x8'));var path=require(_0x6f1c('0x9'));var sox=require(_0x6f1c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f1c('0xb'));var squel=require(_0x6f1c('0xc'));var crypto=require(_0x6f1c('0xd'));var jsforce=require(_0x6f1c('0xe'));var deskjs=require(_0x6f1c('0xf'));var toCsv=require(_0x6f1c('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f1c('0x11'));var authService=require(_0x6f1c('0x12'));var qs=require(_0x6f1c('0x13'));var as=require(_0x6f1c('0x14'));var hardwareService=require(_0x6f1c('0x15'));var logger=require(_0x6f1c('0x16'))('api');var utils=require(_0x6f1c('0x17'));var config=require(_0x6f1c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f1c('0x19'))['db'];config['redis']=_['defaults'](config[_0x6f1c('0x1a')],{'host':_0x6f1c('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6f1c('0x1c'))['register'](socket);function respondWithStatusCode(_0x206ed5,_0xb36b41){_0xb36b41=_0xb36b41||0xcc;return function(_0x14c412){if(_0x14c412){return _0x206ed5[_0x6f1c('0x1d')](_0xb36b41);}return _0x206ed5[_0x6f1c('0x1e')](_0xb36b41)[_0x6f1c('0x1f')]();};}function respondWithResult(_0xbac2ee,_0x5e953f){_0x5e953f=_0x5e953f||0xc8;return function(_0x2ca612){if(_0x2ca612){return _0xbac2ee['status'](_0x5e953f)[_0x6f1c('0x20')](_0x2ca612);}};}function respondWithFilteredResult(_0x5a0a2d,_0x1d968f){return function(_0x66103a){if(_0x66103a){var _0x5b11ea=_0x66103a[_0x6f1c('0x21')],_0x5475d6=_0x1d968f['offset'],_0x317686=_0x1d968f[_0x6f1c('0x22')]+_0x1d968f[_0x6f1c('0x23')],_0x842773;if(_0x317686>=_0x5b11ea){_0x317686=_0x5b11ea;_0x842773=0xc8;}else{_0x842773=0xce;}_0x5a0a2d[_0x6f1c('0x1e')](_0x842773);return _0x5a0a2d['set'](_0x6f1c('0x24'),_0x5475d6+'-'+_0x317686+'/'+_0x5b11ea)[_0x6f1c('0x20')](_0x66103a);}return null;};}function patchUpdates(_0x27a351){return function(_0x539d59){try{jsonpatch[_0x6f1c('0x25')](_0x539d59,_0x27a351,!![]);}catch(_0xebf430){return BPromise['reject'](_0xebf430);}return _0x539d59[_0x6f1c('0x26')]();};}function saveUpdates(_0x1f7ac2,_0x3fe23a){return function(_0x25e460){if(_0x25e460){return _0x25e460['update'](_0x1f7ac2)[_0x6f1c('0x27')](function(_0xd19a62){return _0xd19a62;});}return null;};}function removeEntity(_0x235773,_0x241ee7){return function(_0xa9c80d){if(_0xa9c80d){return _0xa9c80d[_0x6f1c('0x28')]()['then'](function(){var _0x1ac41=_0xa9c80d[_0x6f1c('0x29')]({'plain':!![]});var _0x2d4236=_0x6f1c('0x2a');return db[_0x6f1c('0x2b')]['destroy']({'where':{'type':_0x2d4236,'resourceId':_0x1ac41['id']}})[_0x6f1c('0x27')](function(){return _0xa9c80d;});})[_0x6f1c('0x27')](function(){_0x235773[_0x6f1c('0x1e')](0xcc)[_0x6f1c('0x1f')]();});}};}function handleEntityNotFound(_0x31e829,_0x145ae9){return function(_0x4d120d){if(!_0x4d120d){_0x31e829['sendStatus'](0x194);}return _0x4d120d;};}function handleError(_0x30ba57,_0x2b3732){_0x2b3732=_0x2b3732||0x1f4;return function(_0x1b5c9a){logger['error'](_0x1b5c9a[_0x6f1c('0x2c')]);if(_0x1b5c9a[_0x6f1c('0x2d')]){delete _0x1b5c9a[_0x6f1c('0x2d')];}_0x30ba57[_0x6f1c('0x1e')](_0x2b3732)['send'](_0x1b5c9a);};}exports[_0x6f1c('0x2e')]=function(_0x11f1f6,_0x5c09ba){var _0x11ac4b={},_0x346c4a={},_0x182f99={'count':0x0,'rows':[]};var _0x5a25ec=_[_0x6f1c('0x2f')](db['VoicePrefix'][_0x6f1c('0x30')],function(_0x2ee3e7){return{'name':_0x2ee3e7[_0x6f1c('0x31')],'type':_0x2ee3e7['type']['key']};});_0x346c4a[_0x6f1c('0x32')]=_[_0x6f1c('0x2f')](_0x5a25ec,_0x6f1c('0x2d'));_0x346c4a[_0x6f1c('0x33')]=_[_0x6f1c('0x34')](_0x11f1f6[_0x6f1c('0x33')]);_0x346c4a[_0x6f1c('0x35')]=_[_0x6f1c('0x36')](_0x346c4a[_0x6f1c('0x32')],_0x346c4a[_0x6f1c('0x33')]);_0x11ac4b[_0x6f1c('0x37')]=_[_0x6f1c('0x36')](_0x346c4a[_0x6f1c('0x32')],qs[_0x6f1c('0x38')](_0x11f1f6[_0x6f1c('0x33')]['fields']));_0x11ac4b[_0x6f1c('0x37')]=_0x11ac4b[_0x6f1c('0x37')][_0x6f1c('0x39')]?_0x11ac4b[_0x6f1c('0x37')]:_0x346c4a['model'];if(!_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x3a')](_0x6f1c('0x3b'))){_0x11ac4b[_0x6f1c('0x23')]=qs[_0x6f1c('0x23')](_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x23')]);_0x11ac4b['offset']=qs[_0x6f1c('0x22')](_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x22')]);}_0x11ac4b[_0x6f1c('0x3c')]=qs[_0x6f1c('0x3d')](_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x3d')]);_0x11ac4b[_0x6f1c('0x3e')]=qs[_0x6f1c('0x35')](_[_0x6f1c('0x3f')](_0x11f1f6['query'],_0x346c4a[_0x6f1c('0x35')]),_0x5a25ec);if(_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x40')]){_0x11ac4b[_0x6f1c('0x3e')]=_[_0x6f1c('0x41')](_0x11ac4b[_0x6f1c('0x3e')],{'$or':_[_0x6f1c('0x2f')](_0x5a25ec,function(_0x248fc4){if(_0x248fc4[_0x6f1c('0x42')]!==_0x6f1c('0x43')){var _0xcd112e={};_0xcd112e[_0x248fc4['name']]={'$like':'%'+_0x11f1f6[_0x6f1c('0x33')][_0x6f1c('0x40')]+'%'};return _0xcd112e;}})});}_0x11ac4b=_[_0x6f1c('0x41')]({},_0x11ac4b,_0x11f1f6['options']);var _0x4e2754={'where':_0x11ac4b[_0x6f1c('0x3e')]};return db['VoicePrefix']['count'](_0x4e2754)[_0x6f1c('0x27')](function(_0x4f58a7){_0x182f99[_0x6f1c('0x21')]=_0x4f58a7;if(_0x11f1f6['query'][_0x6f1c('0x44')]){_0x11ac4b[_0x6f1c('0x45')]=[{'all':!![]}];}return db[_0x6f1c('0x46')][_0x6f1c('0x47')](_0x11ac4b);})[_0x6f1c('0x27')](function(_0x35203e){_0x182f99['rows']=_0x35203e;return _0x182f99;})[_0x6f1c('0x27')](respondWithFilteredResult(_0x5c09ba,_0x11ac4b))[_0x6f1c('0x48')](handleError(_0x5c09ba,null));};exports[_0x6f1c('0x49')]=function(_0x234d79,_0x1a506b){var _0x307e7e={'raw':![],'where':{'id':_0x234d79[_0x6f1c('0x4a')]['id']}},_0xd61e73={};_0xd61e73[_0x6f1c('0x32')]=_[_0x6f1c('0x34')](db[_0x6f1c('0x46')][_0x6f1c('0x30')]);_0xd61e73['query']=_['keys'](_0x234d79[_0x6f1c('0x33')]);_0xd61e73['filters']=_[_0x6f1c('0x36')](_0xd61e73[_0x6f1c('0x32')],_0xd61e73['query']);_0x307e7e[_0x6f1c('0x37')]=_[_0x6f1c('0x36')](_0xd61e73[_0x6f1c('0x32')],qs['fields'](_0x234d79['query'][_0x6f1c('0x38')]));_0x307e7e[_0x6f1c('0x37')]=_0x307e7e[_0x6f1c('0x37')][_0x6f1c('0x39')]?_0x307e7e['attributes']:_0xd61e73[_0x6f1c('0x32')];if(_0x234d79[_0x6f1c('0x33')][_0x6f1c('0x44')]){_0x307e7e[_0x6f1c('0x45')]=[{'all':!![]}];}_0x307e7e=_[_0x6f1c('0x41')]({},_0x307e7e,_0x234d79[_0x6f1c('0x4b')]);return db['VoicePrefix'][_0x6f1c('0x4c')](_0x307e7e)['then'](handleEntityNotFound(_0x1a506b,null))['then'](respondWithResult(_0x1a506b,null))[_0x6f1c('0x48')](handleError(_0x1a506b,null));};exports['destroy']=function(_0x256ca1,_0x79498){return db[_0x6f1c('0x46')][_0x6f1c('0x4c')]({'where':{'id':_0x256ca1[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x27')](handleEntityNotFound(_0x79498,null))[_0x6f1c('0x27')](removeEntity(_0x79498,null))[_0x6f1c('0x48')](handleError(_0x79498,null));};exports[_0x6f1c('0x4d')]=function(_0x374bf6,_0x530b9f){return db['VoicePrefix'][_0x6f1c('0x4d')]()[_0x6f1c('0x27')](respondWithResult(_0x530b9f,null))[_0x6f1c('0x48')](handleError(_0x530b9f,null));};exports[_0x6f1c('0x4e')]=function(_0xe29b0c,_0x70c654){var _0x353b50;return db[_0x6f1c('0x4f')]['transaction'](function(_0x2878e7){return db['VoicePrefix']['create'](_0xe29b0c[_0x6f1c('0x50')],{'transaction':_0x2878e7})[_0x6f1c('0x27')](function(_0x4a7244){_0x353b50=_0x4a7244[_0x6f1c('0x29')]({'plain':!![]});return db['VoiceExtension'][_0x6f1c('0x4c')]({'where':{'id':_0x353b50['VoiceExtensionId']},'raw':!![]})[_0x6f1c('0x27')](function(_0x546f05){return createVoicePrefixExtensions(_0x353b50,_0x546f05,_0x2878e7);});});})[_0x6f1c('0x27')](function(){var _0x40c1a7=_0xe29b0c[_0x6f1c('0x51')][_0x6f1c('0x29')]({'plain':!![]});if(!_0x40c1a7)throw new Error(_0x6f1c('0x52'));if(_0x40c1a7[_0x6f1c('0x53')]===_0x6f1c('0x51')){var _0x2397c2=_0x353b50;return db[_0x6f1c('0x54')][_0x6f1c('0x4c')]({'where':{'name':_0x6f1c('0x2a'),'userProfileId':_0x40c1a7[_0x6f1c('0x55')]},'raw':!![]})[_0x6f1c('0x27')](function(_0x567d50){if(_0x567d50&&_0x567d50[_0x6f1c('0x56')]===0x0){return db[_0x6f1c('0x2b')][_0x6f1c('0x4e')]({'name':_0x2397c2[_0x6f1c('0x2d')],'resourceId':_0x2397c2['id'],'type':_0x567d50['name'],'sectionId':_0x567d50['id']},{})[_0x6f1c('0x27')](function(){return _0x353b50;});}else{return _0x353b50;}})['catch'](function(_0x199aad){logger[_0x6f1c('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x199aad);throw _0x199aad;});}return _0x353b50;})[_0x6f1c('0x27')](respondWithResult(_0x70c654,null))['catch'](handleError(_0x70c654,null));};function Extension(_0xd9e2a2,_0x43b6c1,_0x5ce94a,_0x12d3c9){this[_0x6f1c('0x58')]=_0x6f1c('0x59');this[_0x6f1c('0x5a')]=_0xd9e2a2;this[_0x6f1c('0x5b')]=_0x5ce94a;this['type']=_0x6f1c('0x5c');this['description']=_0x6f1c('0x5d');this['priority']=_0x43b6c1;this[_0x6f1c('0x5e')]=_0x12d3c9;}function createVoicePrefixExtensions(_0x8c47e0,_0x4556a6,_0x2ef7ce){return new BPromise(function(_0x471664,_0x712a6b){var _0x57ebea=new Extension(formatPrefixName(_0x8c47e0[_0x6f1c('0x5f')]),0x1,'NoOp',_0x6f1c('0x60'));_0x57ebea[_0x6f1c('0x61')]=_0x8c47e0['id'];return db[_0x6f1c('0x62')][_0x6f1c('0x4e')](_0x57ebea,{'transaction':_0x2ef7ce})[_0x6f1c('0x27')](function(_0x7baff3){var _0x4694f3=_0x7baff3[_0x6f1c('0x29')]({'plain':!![]});var _0x518bbc=_[_0x6f1c('0x2f')](addVoicePrefixExtensions(_0x8c47e0,_0x4556a6),function(_0x291a3f){_0x291a3f[_0x6f1c('0x63')]=_0x4694f3['id'];_0x291a3f[_0x6f1c('0x61')]=_0x8c47e0['id'];return _0x291a3f;});return db[_0x6f1c('0x62')][_0x6f1c('0x64')](_0x518bbc,{'transaction':_0x2ef7ce})[_0x6f1c('0x27')](function(_0x3f2cea){if(!_0x3f2cea){return _0x712a6b(_0x6f1c('0x65'));}else{return _0x471664(_0x3f2cea);}})[_0x6f1c('0x48')](function(_0x4ee324){return _0x712a6b(_0x4ee324);});});;});};function addVoicePrefixExtensions(_0x49c6ad,_0x23e0e5){var _0x3ed2f0=[];var _0xd36d97=formatPrefixName(_0x49c6ad[_0x6f1c('0x5f')]);_0x3ed2f0['push'](new Extension(_0xd36d97,0x2,'Set',_0x6f1c('0x66')+_0x49c6ad['name']));if(_0x49c6ad[_0x6f1c('0x67')]){_0x3ed2f0[_0x6f1c('0x68')](new Extension(_0xd36d97,0x3,_0x6f1c('0x69'),'PREFIX-CALLERIDALL='+_0x49c6ad[_0x6f1c('0x67')]));}else{_0x3ed2f0[_0x6f1c('0x68')](new Extension(_0xd36d97,0x3,_0x6f1c('0x6a'),'No\x20callerid\x20available'));}_0x3ed2f0['push'](new Extension(_0xd36d97,0x4,_0x6f1c('0x6b'),_0x23e0e5[_0x6f1c('0x58')]+','+'${EXTEN:'+(0x8+_0x49c6ad[_0x6f1c('0x2d')][_0x6f1c('0x39')])+'}'+','+0x1));return _0x3ed2f0;}function formatPrefixName(_0x515374){var _0x5f219a='_';for(var _0x24d863=0x0;_0x24d863<_0x515374[_0x6f1c('0x39')];_0x24d863++){if(_0x515374[_0x6f1c('0x6c')](_0x24d863)=='-'){_0x5f219a+=_0x515374[_0x6f1c('0x6c')](_0x24d863);}else{_0x5f219a+='['+_0x515374[_0x6f1c('0x6c')](_0x24d863)+']';}}_0x5f219a+='.';return _0x5f219a;}exports[_0x6f1c('0x6d')]=function(_0x27490c,_0x2c6752,_0x68c121){var _0x2e4743=_0x27490c[_0x6f1c('0x50')];_0x2e4743[_0x6f1c('0x5f')]='system-'+_0x2e4743[_0x6f1c('0x2d')]+'-';return db['sequelize'][_0x6f1c('0x6e')](function(_0x46bbc3){return db[_0x6f1c('0x46')][_0x6f1c('0x6d')](_0x2e4743,{'where':{'id':_0x2e4743['id']},'transaction':_0x46bbc3})[_0x6f1c('0x27')](function(){return db['VoiceExtension'][_0x6f1c('0x28')]({'where':{'VoicePrefixId':_0x2e4743['id']},'transaction':_0x46bbc3})[_0x6f1c('0x27')](function(){return db[_0x6f1c('0x62')][_0x6f1c('0x4c')]({'where':{'id':_0x2e4743[_0x6f1c('0x63')]},'raw':!![]})['then'](function(_0x5324e4){return createVoicePrefixExtensions(_0x2e4743,_0x5324e4,_0x46bbc3);});});});})[_0x6f1c('0x27')](function(){return db[_0x6f1c('0x46')][_0x6f1c('0x6f')](_0x2e4743['id']);})[_0x6f1c('0x27')](respondWithResult(_0x2c6752,null))[_0x6f1c('0x48')](handleError(_0x2c6752,null));};exports['addAgents']=function(_0x251baf,_0x32aa2f,_0x220d83){return db[_0x6f1c('0x46')]['find']({'where':{'id':_0x251baf[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x27')](handleEntityNotFound(_0x32aa2f,null))[_0x6f1c('0x27')](function(_0xe4ea3c){if(_0xe4ea3c){return _0xe4ea3c[_0x6f1c('0x70')](_0x251baf['body'][_0x6f1c('0x71')],_[_0x6f1c('0x72')](_0x251baf[_0x6f1c('0x50')],[_0x6f1c('0x71'),'id'])||{})['spread'](function(_0x565708){for(var _0xf82c2f=0x0;_0xf82c2f<_0x251baf['body'][_0x6f1c('0x71')][_0x6f1c('0x39')];_0xf82c2f+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x251baf[_0x6f1c('0x50')][_0x6f1c('0x71')][_0xf82c2f],'VoicePrefixId':_0x251baf[_0x6f1c('0x4a')]['id']});}return _0x565708;});}})[_0x6f1c('0x27')](respondWithResult(_0x32aa2f,null))[_0x6f1c('0x48')](handleError(_0x32aa2f,null));};exports['removeAgents']=function(_0x34927a,_0x4e666a,_0x2391d7){return db['VoicePrefix']['find']({'where':{'id':_0x34927a[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x27')](handleEntityNotFound(_0x4e666a,null))['then'](function(_0x4770f0){if(_0x4770f0){return _0x4770f0['removeAgents'](_0x34927a['query']['ids'])[_0x6f1c('0x27')](function(){if(_['isArray'](_0x34927a[_0x6f1c('0x33')][_0x6f1c('0x71')])){for(var _0x256bab=0x0;_0x256bab<_0x34927a[_0x6f1c('0x33')][_0x6f1c('0x71')][_0x6f1c('0x39')];_0x256bab+=0x1){socket['emit'](_0x6f1c('0x73'),{'UserId':Number(_0x34927a[_0x6f1c('0x33')]['ids'][_0x256bab]),'VoicePrefixId':Number(_0x34927a[_0x6f1c('0x4a')]['id'])});}}else{socket['emit'](_0x6f1c('0x73'),{'UserId':Number(_0x34927a[_0x6f1c('0x33')][_0x6f1c('0x71')]),'VoicePrefixId':Number(_0x34927a[_0x6f1c('0x4a')]['id'])});}});}})[_0x6f1c('0x27')](respondWithStatusCode(_0x4e666a,null))[_0x6f1c('0x48')](handleError(_0x4e666a,null));};exports[_0x6f1c('0x74')]=function(_0x281c4d,_0x2907cb,_0x2195ea){var _0x5d54ec={};var _0x4f4161={};var _0x12f48b;var _0x5d6858;return db['VoicePrefix']['findOne']({'where':{'id':_0x281c4d[_0x6f1c('0x4a')]['id']}})[_0x6f1c('0x27')](handleEntityNotFound(_0x2907cb,null))[_0x6f1c('0x27')](function(_0x37ccb3){if(_0x37ccb3){_0x12f48b=_0x37ccb3;_0x4f4161['model']=_[_0x6f1c('0x34')](db[_0x6f1c('0x75')]['rawAttributes']);_0x4f4161[_0x6f1c('0x33')]=_[_0x6f1c('0x34')](_0x281c4d[_0x6f1c('0x33')]);_0x4f4161[_0x6f1c('0x35')]=_[_0x6f1c('0x36')](_0x4f4161[_0x6f1c('0x32')],_0x4f4161[_0x6f1c('0x33')]);_0x5d54ec[_0x6f1c('0x37')]=_[_0x6f1c('0x36')](_0x4f4161['model'],qs[_0x6f1c('0x38')](_0x281c4d['query']['fields']));_0x5d54ec[_0x6f1c('0x37')]=_0x5d54ec[_0x6f1c('0x37')][_0x6f1c('0x39')]?_0x5d54ec[_0x6f1c('0x37')]:_0x4f4161[_0x6f1c('0x32')];_0x5d54ec[_0x6f1c('0x3c')]=qs[_0x6f1c('0x3d')](_0x281c4d['query']['sort']);_0x5d54ec[_0x6f1c('0x3e')]=qs[_0x6f1c('0x35')](_[_0x6f1c('0x3f')](_0x281c4d[_0x6f1c('0x33')],_0x4f4161['filters']));if(_0x281c4d[_0x6f1c('0x33')][_0x6f1c('0x40')]){_0x5d54ec[_0x6f1c('0x3e')]=_[_0x6f1c('0x41')](_0x5d54ec['where'],{'$or':_['map'](_0x5d54ec[_0x6f1c('0x37')],function(_0x282d6b){var _0x3695d9={};_0x3695d9[_0x282d6b]={'$like':'%'+_0x281c4d[_0x6f1c('0x33')]['filter']+'%'};return _0x3695d9;})});}_0x5d54ec=_[_0x6f1c('0x41')]({},_0x5d54ec,_0x281c4d[_0x6f1c('0x4b')]);return _0x12f48b['getAgents'](_0x5d54ec);}})['then'](function(_0x2deebb){if(_0x2deebb){_0x5d6858=_0x2deebb[_0x6f1c('0x39')];if(!_0x281c4d[_0x6f1c('0x33')][_0x6f1c('0x3a')](_0x6f1c('0x3b'))){_0x5d54ec['limit']=qs[_0x6f1c('0x23')](_0x281c4d['query']['limit']);_0x5d54ec[_0x6f1c('0x22')]=qs[_0x6f1c('0x22')](_0x281c4d[_0x6f1c('0x33')]['offset']);}return _0x12f48b[_0x6f1c('0x74')](_0x5d54ec);}})['then'](function(_0x39939b){if(_0x39939b){return _0x39939b?{'count':_0x5d6858,'rows':_0x39939b}:null;}})['then'](respondWithResult(_0x2907cb,null))[_0x6f1c('0x48')](handleError(_0x2907cb,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 35d0a8b..94318ec 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x3fb598,_0x228001){var _0x11b991=function(_0x304539){while(--_0x304539){_0x3fb598['push'](_0x3fb598['shift']());}};_0x11b991(++_0x228001);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x70e0=['emit','events','../../mysqldb','VoicePrefix','update','remove'];(function(_0x1f64d0,_0x39c1e5){var _0x4962f2=function(_0x2170a0){while(--_0x2170a0){_0x1f64d0['push'](_0x1f64d0['shift']());}};_0x4962f2(++_0x39c1e5);}(_0x70e0,0x17b));var _0x070e=function(_0x195a2c,_0x4e7409){_0x195a2c=_0x195a2c-0x0;var _0xfdd2ba=_0x70e0[_0x195a2c];return _0xfdd2ba;};'use strict';var EventEmitter=require(_0x070e('0x0'));var VoicePrefix=require(_0x070e('0x1'))['db'][_0x070e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x070e('0x3'),'afterDestroy':_0x070e('0x4')};function emitEvent(_0x277d32){return function(_0x2593e5,_0x5c90fc,_0x7bce9b){VoicePrefixEvents['emit'](_0x277d32+':'+_0x2593e5['id'],_0x2593e5);VoicePrefixEvents[_0x070e('0x5')](_0x277d32,_0x2593e5);_0x7bce9b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index df04bca..8161547 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 _0x8a57=['VoicePrefix','voice_prefixes','util','api','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x39e7ae,_0x35d76b){var _0x74c4d7=function(_0x3e38d2){while(--_0x3e38d2){_0x39e7ae['push'](_0x39e7ae['shift']());}};_0x74c4d7(++_0x35d76b);}(_0x8a57,0x14c));var _0x78a5=function(_0x248c63,_0x3fb167){_0x248c63=_0x248c63-0x0;var _0x22ada6=_0x8a57[_0x248c63];return _0x22ada6;};'use strict';var _=require('lodash');var util=require(_0x78a5('0x0'));var logger=require('../../config/logger')(_0x78a5('0x1'));var moment=require('moment');var BPromise=require(_0x78a5('0x2'));var rp=require(_0x78a5('0x3'));var fs=require('fs');var path=require(_0x78a5('0x4'));var rimraf=require('rimraf');var config=require(_0x78a5('0x5'));var attributes=require(_0x78a5('0x6'));module[_0x78a5('0x7')]=function(_0x2e47d2,_0x139c4d){return _0x2e47d2[_0x78a5('0x8')](_0x78a5('0x9'),attributes,{'tableName':_0x78a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8d2=['path','exports','VoicePrefix','lodash','util','../../config/logger','api','request-promise'];(function(_0x271d24,_0x26b059){var _0x8f31e2=function(_0x151b44){while(--_0x151b44){_0x271d24['push'](_0x271d24['shift']());}};_0x8f31e2(++_0x26b059);}(_0xd8d2,0x133));var _0x2d8d=function(_0x11a890,_0x59b390){_0x11a890=_0x11a890-0x0;var _0x220a4c=_0xd8d2[_0x11a890];return _0x220a4c;};'use strict';var _=require(_0x2d8d('0x0'));var util=require(_0x2d8d('0x1'));var logger=require(_0x2d8d('0x2'))(_0x2d8d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2d8d('0x4'));var fs=require('fs');var path=require(_0x2d8d('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voicePrefix.attributes');module[_0x2d8d('0x6')]=function(_0x13547f,_0x3efd66){return _0x13547f['define'](_0x2d8d('0x7'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 4af3b22..8eada55 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 _0x4e56=['catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x32e311,_0x443536){var _0x3b0230=function(_0x5191c1){while(--_0x5191c1){_0x32e311['push'](_0x32e311['shift']());}};_0x3b0230(++_0x443536);}(_0x4e56,0xb0));var _0x64e5=function(_0x53378b,_0x5083df){_0x53378b=_0x53378b-0x0;var _0x364ad2=_0x4e56[_0x53378b];return _0x364ad2;};'use strict';var _=require('lodash');var util=require(_0x64e5('0x0'));var moment=require(_0x64e5('0x1'));var BPromise=require(_0x64e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x64e5('0x3'))['db'];var utils=require(_0x64e5('0x4'));var logger=require('../../config/logger')(_0x64e5('0x5'));var config=require('../../config/environment');var jayson=require(_0x64e5('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x64e5('0x7')]=_[_0x64e5('0x8')](config[_0x64e5('0x7')],{'host':_0x64e5('0x9'),'port':0x18eb});var socket=require(_0x64e5('0xa'))(new Redis(config[_0x64e5('0x7')]));require(_0x64e5('0xb'))[_0x64e5('0xc')](socket);function respondWithRpcPromise(_0x4211d5,_0x456e65,_0x13b911){return new BPromise(function(_0x4430d9,_0x1bba41){return client[_0x64e5('0xd')](_0x4211d5,_0x13b911)['then'](function(_0x2b2d5f){logger[_0x64e5('0xe')](_0x64e5('0xf'),_0x456e65,_0x64e5('0x10'));logger[_0x64e5('0x11')](_0x64e5('0x12'),_0x456e65,_0x64e5('0x10'),JSON[_0x64e5('0x13')](_0x2b2d5f));if(_0x2b2d5f[_0x64e5('0x14')]){if(_0x2b2d5f[_0x64e5('0x14')][_0x64e5('0x15')]===0x1f4){logger[_0x64e5('0x14')](_0x64e5('0xf'),_0x456e65,_0x2b2d5f[_0x64e5('0x14')][_0x64e5('0x16')]);return _0x1bba41(_0x2b2d5f['error'][_0x64e5('0x16')]);}logger[_0x64e5('0x14')](_0x64e5('0xf'),_0x456e65,_0x2b2d5f[_0x64e5('0x14')][_0x64e5('0x16')]);return _0x4430d9(_0x2b2d5f[_0x64e5('0x14')][_0x64e5('0x16')]);}else{logger[_0x64e5('0xe')](_0x64e5('0xf'),_0x456e65,_0x64e5('0x10'));_0x4430d9(_0x2b2d5f[_0x64e5('0x17')][_0x64e5('0x16')]);}})[_0x64e5('0x18')](function(_0xd8d6d){logger[_0x64e5('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x456e65,_0xd8d6d);_0x1bba41(_0xd8d6d);});});} \ No newline at end of file +var _0xd7c3=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','redis'];(function(_0x495d4b,_0x517ef4){var _0x200ef4=function(_0x5e8010){while(--_0x5e8010){_0x495d4b['push'](_0x495d4b['shift']());}};_0x200ef4(++_0x517ef4);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x51c81f,_0x3908eb){_0x51c81f=_0x51c81f-0x0;var _0x2cf182=_0xd7c3[_0x51c81f];return _0x2cf182;};'use strict';var _=require(_0x3d7c('0x0'));var util=require(_0x3d7c('0x1'));var moment=require(_0x3d7c('0x2'));var BPromise=require(_0x3d7c('0x3'));var rs=require(_0x3d7c('0x4'));var fs=require('fs');var Redis=require(_0x3d7c('0x5'));var db=require(_0x3d7c('0x6'))['db'];var utils=require(_0x3d7c('0x7'));var logger=require(_0x3d7c('0x8'))('rpc');var config=require(_0x3d7c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x3d7c('0xa')]=_[_0x3d7c('0xb')](config[_0x3d7c('0xa')],{'host':_0x3d7c('0xc'),'port':0x18eb});var socket=require(_0x3d7c('0xd'))(new Redis(config[_0x3d7c('0xa')]));require(_0x3d7c('0xe'))[_0x3d7c('0xf')](socket);function respondWithRpcPromise(_0x2e387e,_0x3a2d6c,_0x222e27){return new BPromise(function(_0x1aec45,_0x295fbb){return client[_0x3d7c('0x10')](_0x2e387e,_0x222e27)[_0x3d7c('0x11')](function(_0x25e2f9){logger[_0x3d7c('0x12')](_0x3d7c('0x13'),_0x3a2d6c,'request\x20sent');logger[_0x3d7c('0x14')](_0x3d7c('0x15'),_0x3a2d6c,_0x3d7c('0x16'),JSON[_0x3d7c('0x17')](_0x25e2f9));if(_0x25e2f9[_0x3d7c('0x18')]){if(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x19')]===0x1f4){logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);return _0x295fbb(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);}logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x25e2f9[_0x3d7c('0x18')]['message']);return _0x1aec45(_0x25e2f9[_0x3d7c('0x18')][_0x3d7c('0x1a')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x3a2d6c,_0x3d7c('0x16'));_0x1aec45(_0x25e2f9[_0x3d7c('0x1b')][_0x3d7c('0x1a')]);}})[_0x3d7c('0x1c')](function(_0x591455){logger[_0x3d7c('0x18')](_0x3d7c('0x13'),_0x3a2d6c,_0x591455);_0x295fbb(_0x591455);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 1e9ca20..cd6af52 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 _0x2b82=['save','update','emit','register','voicePrefix:','./voicePrefix.events'];(function(_0x2cdff1,_0x1b246a){var _0x56f3b4=function(_0x428fb9){while(--_0x428fb9){_0x2cdff1['push'](_0x2cdff1['shift']());}};_0x56f3b4(++_0x1b246a);}(_0x2b82,0x13d));var _0x22b8=function(_0x2745d5,_0x12c8f1){_0x2745d5=_0x2745d5-0x0;var _0x326973=_0x2b82[_0x2745d5];return _0x326973;};'use strict';var VoicePrefixEvents=require(_0x22b8('0x0'));var events=[_0x22b8('0x1'),'remove',_0x22b8('0x2')];function createListener(_0x8addf4,_0xb8e226){return function(_0x35d5b4){_0xb8e226[_0x22b8('0x3')](_0x8addf4,_0x35d5b4);};}function removeListener(_0x1af491,_0x5835a9){return function(){VoicePrefixEvents['removeListener'](_0x1af491,_0x5835a9);};}exports[_0x22b8('0x4')]=function(_0x5d2560){for(var _0x33e5d3=0x0,_0x145705=events['length'];_0x33e5d3<_0x145705;_0x33e5d3++){var _0x4a7c18=events[_0x33e5d3];var _0x173a6c=createListener(_0x22b8('0x5')+_0x4a7c18,_0x5d2560);VoicePrefixEvents['on'](_0x4a7c18,_0x173a6c);}}; \ No newline at end of file +var _0xec4a=['removeListener','length','voicePrefix:','remove','emit'];(function(_0x3f1ad8,_0x43d4f1){var _0x232498=function(_0x2b62dd){while(--_0x2b62dd){_0x3f1ad8['push'](_0x3f1ad8['shift']());}};_0x232498(++_0x43d4f1);}(_0xec4a,0x1bb));var _0xaec4=function(_0x4f0e48,_0x565c25){_0x4f0e48=_0x4f0e48-0x0;var _0x76c22d=_0xec4a[_0x4f0e48];return _0x76c22d;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0xaec4('0x0'),'update'];function createListener(_0x41b2c9,_0x402eef){return function(_0x43cba){_0x402eef[_0xaec4('0x1')](_0x41b2c9,_0x43cba);};}function removeListener(_0x25f95a,_0x27132b){return function(){VoicePrefixEvents[_0xaec4('0x2')](_0x25f95a,_0x27132b);};}exports['register']=function(_0x2aabb7){for(var _0x19bea5=0x0,_0x31fd78=events[_0xaec4('0x3')];_0x19bea5<_0x31fd78;_0x19bea5++){var _0x508cd6=events[_0x19bea5];var _0x39ee03=createListener(_0xaec4('0x4')+_0x508cd6,_0x2aabb7);VoicePrefixEvents['on'](_0x508cd6,_0x39ee03);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8213789..47be8eb 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 _0x73c7=['destroy','delete','removeTeams','removeBlackLists','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','show','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','post','create','clone','addTeams','/:id/users','addAgents','addLists','addBlackLists','put','/:id','update'];(function(_0xd62e7a,_0xac4f19){var _0x1bf0c8=function(_0x5f6f96){while(--_0x5f6f96){_0xd62e7a['push'](_0xd62e7a['shift']());}};_0x1bf0c8(++_0xac4f19);}(_0x73c7,0xa4));var _0x773c=function(_0x1da113,_0x29a868){_0x1da113=_0x1da113-0x0;var _0x32352a=_0x73c7[_0x1da113];return _0x32352a;};'use strict';var multer=require('multer');var util=require(_0x773c('0x0'));var path=require(_0x773c('0x1'));var timeout=require(_0x773c('0x2'));var express=require('express');var router=express[_0x773c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x773c('0x4'));var config=require(_0x773c('0x5'));var controller=require(_0x773c('0x6'));router[_0x773c('0x7')]('/',auth[_0x773c('0x8')](),controller[_0x773c('0x9')]);router[_0x773c('0x7')]('/:id',auth[_0x773c('0x8')](),controller[_0x773c('0xa')]);router[_0x773c('0x7')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x773c('0xb')]);router[_0x773c('0x7')](_0x773c('0xc'),auth[_0x773c('0x8')](),controller[_0x773c('0xd')]);router[_0x773c('0x7')]('/:id/hopper_finals',auth[_0x773c('0x8')](),controller[_0x773c('0xe')]);router['get'](_0x773c('0xf'),auth['isAuthenticated'](),controller[_0x773c('0x10')]);router[_0x773c('0x7')](_0x773c('0x11'),auth['isAuthenticated'](),controller[_0x773c('0x12')]);router[_0x773c('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x773c('0x13')]);router[_0x773c('0x7')](_0x773c('0x14'),auth[_0x773c('0x8')](),controller[_0x773c('0x15')]);router[_0x773c('0x7')](_0x773c('0x16'),auth[_0x773c('0x8')](),controller[_0x773c('0x17')]);router[_0x773c('0x7')](_0x773c('0x18'),auth[_0x773c('0x8')](),controller['getBlackLists']);router[_0x773c('0x19')]('/',auth[_0x773c('0x8')](),controller[_0x773c('0x1a')]);router[_0x773c('0x19')]('/:id/clone',auth[_0x773c('0x8')](),controller[_0x773c('0x1b')]);router[_0x773c('0x19')]('/:id/teams',auth[_0x773c('0x8')](),controller[_0x773c('0x1c')]);router[_0x773c('0x19')](_0x773c('0x1d'),auth[_0x773c('0x8')](),controller[_0x773c('0x1e')]);router[_0x773c('0x19')]('/:id/lists',auth['isAuthenticated'](),controller[_0x773c('0x1f')]);router[_0x773c('0x19')](_0x773c('0x18'),auth['isAuthenticated'](),controller[_0x773c('0x20')]);router[_0x773c('0x21')](_0x773c('0x22'),auth[_0x773c('0x8')](),controller[_0x773c('0x23')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x773c('0x24')]);router[_0x773c('0x25')]('/:id/teams',auth[_0x773c('0x8')](),controller[_0x773c('0x26')]);router[_0x773c('0x25')](_0x773c('0x1d'),auth[_0x773c('0x8')](),controller['removeAgents']);router[_0x773c('0x25')](_0x773c('0x16'),auth['isAuthenticated'](),controller['removeLists']);router['delete'](_0x773c('0x18'),auth[_0x773c('0x8')](),controller[_0x773c('0x27')]);module['exports']=router; \ No newline at end of file +var _0x5c6e=['create','/:id/clone','addTeams','addAgents','/:id/lists','addLists','addBlackLists','update','delete','destroy','removeAgents','removeLists','removeBlackLists','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','/:id/blacklists','getBlackLists','post'];(function(_0x1c16ba,_0x28fb56){var _0x2dc853=function(_0x5b8586){while(--_0x5b8586){_0x1c16ba['push'](_0x1c16ba['shift']());}};_0x2dc853(++_0x28fb56);}(_0x5c6e,0x1a4));var _0xe5c6=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0x5c6e[_0x547456];return _0xc1fd7b;};'use strict';var multer=require(_0xe5c6('0x0'));var util=require('util');var path=require(_0xe5c6('0x1'));var timeout=require(_0xe5c6('0x2'));var express=require('express');var router=express[_0xe5c6('0x3')]();var auth=require(_0xe5c6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe5c6('0x5'));var controller=require(_0xe5c6('0x6'));router[_0xe5c6('0x7')]('/',auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x9')]);router[_0xe5c6('0x7')](_0xe5c6('0xa'),auth['isAuthenticated'](),controller[_0xe5c6('0xb')]);router['get']('/:id/hoppers',auth[_0xe5c6('0x8')](),controller[_0xe5c6('0xc')]);router['get'](_0xe5c6('0xd'),auth[_0xe5c6('0x8')](),controller['getHopperHistories']);router[_0xe5c6('0x7')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xe5c6('0xe')]);router[_0xe5c6('0x7')](_0xe5c6('0xf'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x10')]);router['get'](_0xe5c6('0x11'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x12')]);router[_0xe5c6('0x7')](_0xe5c6('0x13'),auth[_0xe5c6('0x8')](),controller['getAgents']);router[_0xe5c6('0x7')](_0xe5c6('0x14'),auth[_0xe5c6('0x8')](),controller['getMembers']);router['get']('/:id/lists',auth[_0xe5c6('0x8')](),controller['getLists']);router[_0xe5c6('0x7')](_0xe5c6('0x15'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x16')]);router[_0xe5c6('0x17')]('/',auth['isAuthenticated'](),controller[_0xe5c6('0x18')]);router['post'](_0xe5c6('0x19'),auth[_0xe5c6('0x8')](),controller['clone']);router[_0xe5c6('0x17')](_0xe5c6('0x11'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x1a')]);router[_0xe5c6('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xe5c6('0x1b')]);router[_0xe5c6('0x17')](_0xe5c6('0x1c'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x1d')]);router[_0xe5c6('0x17')](_0xe5c6('0x15'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x1e')]);router['put'](_0xe5c6('0xa'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x1f')]);router[_0xe5c6('0x20')](_0xe5c6('0xa'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x21')]);router[_0xe5c6('0x20')]('/:id/teams',auth[_0xe5c6('0x8')](),controller['removeTeams']);router[_0xe5c6('0x20')](_0xe5c6('0x13'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x22')]);router[_0xe5c6('0x20')](_0xe5c6('0x1c'),auth['isAuthenticated'](),controller[_0xe5c6('0x23')]);router['delete'](_0xe5c6('0x15'),auth[_0xe5c6('0x8')](),controller[_0xe5c6('0x24')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 98266ad..4b7d75e 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 _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','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)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x2ac1ca,_0x1e47d4){var _0x596155=function(_0x374f16){while(--_0x374f16){_0x2ac1ca['push'](_0x2ac1ca['shift']());}};_0x596155(++_0x1e47d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','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)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x2317af,_0x1332d3){var _0x3cb58d=function(_0x4e75a0){while(--_0x4e75a0){_0x2317af['push'](_0x2317af['shift']());}};_0x3cb58d(++_0x1332d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 56b838e..9ce9da8 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 _0x42a5=['VoiceQueues','outbound','filter','ignore','map','value','includes','type','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','VoiceQueue','includeAll','include','rows','show','params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','omit','createdAt','updatedAt','update','getHoppers','CmHopper','pick','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','forEach','penalty','transaction','each','interface','format','SIP/%s','voicePause','emit','userVoiceQueue:save','ids','select','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','all','compact','removeTeams','removeAgents','addAgents','spread','online','isEmpty','UserVoiceQueueRt','upsert','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','phone','ContactId','ListId','field','NOW()','scheduledAt','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','insert','fromQuery','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','get'];(function(_0x7611ce,_0x4a4441){var _0x67d3ab=function(_0x1456d8){while(--_0x1456d8){_0x7611ce['push'](_0x7611ce['shift']());}};_0x67d3ab(++_0x4a4441);}(_0x42a5,0x8c));var _0x542a=function(_0x55451f,_0xf8207){_0x55451f=_0x55451f-0x0;var _0x59bd27=_0x42a5[_0x55451f];return _0x59bd27;};'use strict';var pdf=require(_0x542a('0x0'));var emlformat=require(_0x542a('0x1'));var rimraf=require(_0x542a('0x2'));var zipdir=require(_0x542a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x542a('0x4'));var moment=require('moment');var BPromise=require(_0x542a('0x5'));var Mustache=require(_0x542a('0x6'));var util=require(_0x542a('0x7'));var path=require(_0x542a('0x8'));var sox=require('sox');var csv=require(_0x542a('0x9'));var ejs=require(_0x542a('0xa'));var fs=require('fs');var _=require(_0x542a('0xb'));var squel=require(_0x542a('0xc'));var crypto=require(_0x542a('0xd'));var jsforce=require(_0x542a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x542a('0xf'));var Papa=require(_0x542a('0x10'));var Redis=require('ioredis');var authService=require(_0x542a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x542a('0x12'));var hardwareService=require(_0x542a('0x13'));var logger=require('../../config/logger')(_0x542a('0x14'));var utils=require(_0x542a('0x15'));var config=require(_0x542a('0x16'));var licenseUtil=require(_0x542a('0x17'));var db=require(_0x542a('0x18'))['db'];config[_0x542a('0x19')]=_[_0x542a('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x542a('0x19')]));require(_0x542a('0x1b'))[_0x542a('0x1c')](socket);function respondWithStatusCode(_0x344a43,_0x580945){_0x580945=_0x580945||0xcc;return function(_0x1f72d4){if(_0x1f72d4){return _0x344a43[_0x542a('0x1d')](_0x580945);}return _0x344a43[_0x542a('0x1e')](_0x580945)[_0x542a('0x1f')]();};}function respondWithResult(_0x4200a2,_0x3551e6){_0x3551e6=_0x3551e6||0xc8;return function(_0x5f266f){if(_0x5f266f){return _0x4200a2['status'](_0x3551e6)[_0x542a('0x20')](_0x5f266f);}};}function respondWithFilteredResult(_0x283e81,_0xed02fc){return function(_0x2fb115){if(_0x2fb115){var _0x406a80=_0x2fb115[_0x542a('0x21')],_0x50548b=_0xed02fc[_0x542a('0x22')],_0x2c3fe4=_0xed02fc[_0x542a('0x22')]+_0xed02fc[_0x542a('0x23')],_0x2a1d53;if(_0x2c3fe4>=_0x406a80){_0x2c3fe4=_0x406a80;_0x2a1d53=0xc8;}else{_0x2a1d53=0xce;}_0x283e81[_0x542a('0x1e')](_0x2a1d53);return _0x283e81[_0x542a('0x24')](_0x542a('0x25'),_0x50548b+'-'+_0x2c3fe4+'/'+_0x406a80)['json'](_0x2fb115);}return null;};}function patchUpdates(_0xc2878){return function(_0x44a871){try{jsonpatch['apply'](_0x44a871,_0xc2878,!![]);}catch(_0x5d7ad9){return BPromise[_0x542a('0x26')](_0x5d7ad9);}return _0x44a871[_0x542a('0x27')]();};}function saveUpdates(_0x5986fe,_0x501600){return function(_0x1da851){if(_0x1da851){return _0x1da851['update'](_0x5986fe)[_0x542a('0x28')](function(_0x5b08b6){return _0x5b08b6;});}return null;};}function removeEntity(_0x2fecd1,_0x13c93b){return function(_0x2bd3ad){if(_0x2bd3ad){return _0x2bd3ad['destroy']()[_0x542a('0x28')](function(){var _0x46b36d=_0x2bd3ad[_0x542a('0x29')]({'plain':!![]});var _0xf86634=[{'name':_0x542a('0x2a'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x542a('0x2b'),'ignore':![]}];var _0x911e76=_(_0xf86634)[_0x542a('0x2c')](_0x542a('0x2d'))[_0x542a('0x2e')]('value')[_0x542a('0x2f')]();if(_[_0x542a('0x30')](_0x911e76,_0x46b36d['type'])){return;}var _0x55d3a9=_['find'](_0xf86634,['value',_0x46b36d[_0x542a('0x31')]])['name'];return db[_0x542a('0x32')][_0x542a('0x33')]({'where':{'type':_0x55d3a9,'resourceId':_0x46b36d['id']}})[_0x542a('0x28')](function(){return _0x2bd3ad;});})['then'](function(){_0x2fecd1[_0x542a('0x1e')](0xcc)[_0x542a('0x1f')]();});}};}function handleEntityNotFound(_0x30595e,_0x4e64bc){return function(_0x9ba8f9){if(!_0x9ba8f9){_0x30595e[_0x542a('0x1d')](0x194);}return _0x9ba8f9;};}function handleError(_0x4f8e9c,_0x509f38){_0x509f38=_0x509f38||0x1f4;return function(_0x326d62){logger[_0x542a('0x34')](_0x326d62[_0x542a('0x35')]);if(_0x326d62[_0x542a('0x36')]){delete _0x326d62[_0x542a('0x36')];}_0x4f8e9c[_0x542a('0x1e')](_0x509f38)[_0x542a('0x37')](_0x326d62);};}exports['index']=function(_0x266ab7,_0x53be5c){var _0x3a4b7e={},_0x3ce3f8={},_0x19f13e={'count':0x0,'rows':[]};var _0x2814f4=_[_0x542a('0x2e')](db['VoiceQueue'][_0x542a('0x38')],function(_0x5a6dba){return{'name':_0x5a6dba[_0x542a('0x39')],'type':_0x5a6dba[_0x542a('0x31')][_0x542a('0x3a')]};});_0x3ce3f8['model']=_[_0x542a('0x2e')](_0x2814f4,_0x542a('0x36'));_0x3ce3f8[_0x542a('0x3b')]=_[_0x542a('0x3c')](_0x266ab7[_0x542a('0x3b')]);_0x3ce3f8[_0x542a('0x3d')]=_[_0x542a('0x3e')](_0x3ce3f8[_0x542a('0x3f')],_0x3ce3f8[_0x542a('0x3b')]);_0x3a4b7e['attributes']=_[_0x542a('0x3e')](_0x3ce3f8[_0x542a('0x3f')],qs['fields'](_0x266ab7['query'][_0x542a('0x40')]));_0x3a4b7e['attributes']=_0x3a4b7e[_0x542a('0x41')][_0x542a('0x42')]?_0x3a4b7e[_0x542a('0x41')]:_0x3ce3f8[_0x542a('0x3f')];if(!_0x266ab7[_0x542a('0x3b')][_0x542a('0x43')](_0x542a('0x44'))){_0x3a4b7e[_0x542a('0x23')]=qs[_0x542a('0x23')](_0x266ab7[_0x542a('0x3b')][_0x542a('0x23')]);_0x3a4b7e[_0x542a('0x22')]=qs['offset'](_0x266ab7[_0x542a('0x3b')]['offset']);}_0x3a4b7e[_0x542a('0x45')]=qs['sort'](_0x266ab7[_0x542a('0x3b')][_0x542a('0x46')]);_0x3a4b7e[_0x542a('0x47')]=qs[_0x542a('0x3d')](_['pick'](_0x266ab7['query'],_0x3ce3f8['filters']),_0x2814f4);if(_0x266ab7['query'][_0x542a('0x2c')]){_0x3a4b7e[_0x542a('0x47')]=_[_0x542a('0x48')](_0x3a4b7e[_0x542a('0x47')],{'$or':_[_0x542a('0x2e')](_0x2814f4,function(_0x592b47){if(_0x592b47[_0x542a('0x31')]!==_0x542a('0x49')){var _0xa59111={};_0xa59111[_0x592b47[_0x542a('0x36')]]={'$like':'%'+_0x266ab7[_0x542a('0x3b')][_0x542a('0x2c')]+'%'};return _0xa59111;}})});}_0x3a4b7e=_[_0x542a('0x48')]({},_0x3a4b7e,_0x266ab7['options']);var _0xd18b79={'where':_0x3a4b7e['where']};return db[_0x542a('0x4a')][_0x542a('0x21')](_0xd18b79)[_0x542a('0x28')](function(_0x537e0f){_0x19f13e['count']=_0x537e0f;if(_0x266ab7[_0x542a('0x3b')][_0x542a('0x4b')]){_0x3a4b7e[_0x542a('0x4c')]=[{'all':!![]}];}return db[_0x542a('0x4a')]['findAll'](_0x3a4b7e);})[_0x542a('0x28')](function(_0x47fa1f){_0x19f13e[_0x542a('0x4d')]=_0x47fa1f;return _0x19f13e;})[_0x542a('0x28')](respondWithFilteredResult(_0x53be5c,_0x3a4b7e))['catch'](handleError(_0x53be5c,null));};exports[_0x542a('0x4e')]=function(_0x5383f5,_0x2690c5){var _0x4654d7={'raw':![],'where':{'id':_0x5383f5[_0x542a('0x4f')]['id']}},_0x4878ac={};_0x4878ac['model']=_['keys'](db[_0x542a('0x4a')][_0x542a('0x38')]);_0x4878ac['query']=_[_0x542a('0x3c')](_0x5383f5['query']);_0x4878ac[_0x542a('0x3d')]=_[_0x542a('0x3e')](_0x4878ac['model'],_0x4878ac['query']);_0x4654d7[_0x542a('0x41')]=_[_0x542a('0x3e')](_0x4878ac['model'],qs['fields'](_0x5383f5[_0x542a('0x3b')][_0x542a('0x40')]));_0x4654d7[_0x542a('0x41')]=_0x4654d7[_0x542a('0x41')]['length']?_0x4654d7[_0x542a('0x41')]:_0x4878ac[_0x542a('0x3f')];if(_0x5383f5[_0x542a('0x3b')]['includeAll']){_0x4654d7['include']=[{'all':!![]}];}_0x4654d7=_['merge']({},_0x4654d7,_0x5383f5[_0x542a('0x50')]);return db[_0x542a('0x4a')][_0x542a('0x51')](_0x4654d7)[_0x542a('0x28')](handleEntityNotFound(_0x2690c5,null))[_0x542a('0x28')](respondWithResult(_0x2690c5,null))[_0x542a('0x52')](handleError(_0x2690c5,null));};exports[_0x542a('0x53')]=function(_0x2e8917,_0x30a81e){return db['VoiceQueue'][_0x542a('0x53')](_0x2e8917[_0x542a('0x54')],{})[_0x542a('0x28')](function(_0x538956){var _0xbdfdd2=_0x2e8917[_0x542a('0x55')][_0x542a('0x29')]({'plain':!![]});if(!_0xbdfdd2)throw new Error(_0x542a('0x56'));if(_0xbdfdd2[_0x542a('0x57')]===_0x542a('0x55')){var _0x4a5dea=_0x538956[_0x542a('0x29')]({'plain':!![]});var _0x305281=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x542a('0x58'),'value':_0x542a('0x2b')}];var _0x5984b1=_['find'](_0x305281,[_0x542a('0x2f'),_0x4a5dea[_0x542a('0x31')]])['name'];return db[_0x542a('0x59')][_0x542a('0x51')]({'where':{'name':_0x5984b1,'userProfileId':_0xbdfdd2[_0x542a('0x5a')]},'raw':!![]})[_0x542a('0x28')](function(_0x1cc5a1){if(_0x1cc5a1&&_0x1cc5a1[_0x542a('0x5b')]===0x0){return db[_0x542a('0x32')]['create']({'name':_0x4a5dea[_0x542a('0x36')],'resourceId':_0x4a5dea['id'],'type':_0x1cc5a1[_0x542a('0x36')],'sectionId':_0x1cc5a1['id']},{})[_0x542a('0x28')](function(){return _0x538956;});}else{return _0x538956;}})[_0x542a('0x52')](function(_0xec5153){logger[_0x542a('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xec5153);throw _0xec5153;});}return _0x538956;})['then'](respondWithResult(_0x30a81e,0xc9))[_0x542a('0x52')](handleError(_0x30a81e,null));};exports['clone']=function(_0x5b1b47,_0x189221){var _0x33e23f={'where':{'id':_0x5b1b47[_0x542a('0x4f')]['id']}},_0x11314d={};_0x11314d[_0x542a('0x3f')]=_[_0x542a('0x3c')](db['VoiceQueue'][_0x542a('0x38')]);_0x33e23f[_0x542a('0x41')]=_[_0x542a('0x3e')](_0x11314d[_0x542a('0x3f')],qs[_0x542a('0x40')](_0x5b1b47[_0x542a('0x3b')][_0x542a('0x40')]));_0x33e23f[_0x542a('0x41')]=_0x33e23f[_0x542a('0x41')][_0x542a('0x42')]?_0x33e23f[_0x542a('0x41')]:_0x11314d[_0x542a('0x3f')];if(_0x5b1b47['query']['includeAll']){_0x33e23f[_0x542a('0x4c')]=[{'all':!![]}];}_0x33e23f=_['merge']({},_0x33e23f,_0x5b1b47[_0x542a('0x50')]);return db[_0x542a('0x4a')][_0x542a('0x51')](_0x33e23f)[_0x542a('0x28')](handleEntityNotFound(_0x189221,null))[_0x542a('0x28')](function(_0x27a6b8){if(_0x27a6b8){var _0x516f4d=_0x27a6b8[_0x542a('0x29')]({'plain':!![]});_0x516f4d=qs[_0x542a('0x5c')](_0x516f4d,['id','createdAt','updatedAt']);_0x5b1b47[_0x542a('0x54')]=_[_0x542a('0x5c')](_0x5b1b47[_0x542a('0x54')],['id',_0x542a('0x5d'),_0x542a('0x5e')]);return db[_0x542a('0x4a')][_0x542a('0x53')](_['merge'](_0x516f4d,_0x5b1b47[_0x542a('0x54')]),{'include':_0x5b1b47['query'][_0x542a('0x4b')]?[{'all':!![]}]:undefined})[_0x542a('0x28')](function(_0x374f97){var _0x287725=_0x5b1b47[_0x542a('0x55')][_0x542a('0x29')]({'plain':!![]});if(!_0x287725)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x287725[_0x542a('0x57')]===_0x542a('0x55')){var _0x495dfb=_0x374f97[_0x542a('0x29')]({'plain':!![]});var _0x2697c7=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x542a('0x58'),'value':_0x542a('0x2b')}];var _0x795d56=_['find'](_0x2697c7,[_0x542a('0x2f'),_0x495dfb[_0x542a('0x31')]])[_0x542a('0x36')];return db[_0x542a('0x59')]['find']({'where':{'name':_0x795d56,'userProfileId':_0x287725[_0x542a('0x5a')]},'raw':!![]})[_0x542a('0x28')](function(_0x487de6){if(_0x487de6&&_0x487de6[_0x542a('0x5b')]===0x0){return db['UserProfileResource'][_0x542a('0x53')]({'name':_0x495dfb[_0x542a('0x36')],'resourceId':_0x495dfb['id'],'type':_0x487de6['name'],'sectionId':_0x487de6['id']},{})[_0x542a('0x28')](function(){return _0x374f97;});}else{return _0x374f97;}})[_0x542a('0x52')](function(_0x40dc2e){logger[_0x542a('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40dc2e);throw _0x40dc2e;});}return _0x374f97;});}})[_0x542a('0x28')](respondWithResult(_0x189221,0xc9))[_0x542a('0x52')](handleError(_0x189221,null));};exports[_0x542a('0x5f')]=function(_0x3d46fa,_0x480a77){if(_0x3d46fa[_0x542a('0x54')]['id']){delete _0x3d46fa[_0x542a('0x54')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x3d46fa[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x480a77,null))['then'](saveUpdates(_0x3d46fa[_0x542a('0x54')],null))['then'](respondWithResult(_0x480a77,null))[_0x542a('0x52')](handleError(_0x480a77,null));};exports[_0x542a('0x33')]=function(_0x130f27,_0x249f5f){return db[_0x542a('0x4a')]['find']({'where':{'id':_0x130f27[_0x542a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x249f5f,null))[_0x542a('0x28')](removeEntity(_0x249f5f,null))['catch'](handleError(_0x249f5f,null));};exports[_0x542a('0x60')]=function(_0x5f20ff,_0x5d000d,_0x44e062){var _0x1ae58e={'raw':![],'where':{}};var _0x2fd341={};var _0x587c6e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x5f20ff[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x5d000d,null))['then'](function(_0x132f78){if(_0x132f78){_0x2fd341['model']=_[_0x542a('0x3c')](db[_0x542a('0x61')]['rawAttributes']);_0x2fd341['query']=_[_0x542a('0x3c')](_0x5f20ff[_0x542a('0x3b')]);_0x2fd341[_0x542a('0x3d')]=_['intersection'](_0x2fd341['model'],_0x2fd341[_0x542a('0x3b')]);_0x1ae58e[_0x542a('0x41')]=_[_0x542a('0x3e')](_0x2fd341['model'],qs[_0x542a('0x40')](_0x5f20ff[_0x542a('0x3b')][_0x542a('0x40')]));_0x1ae58e[_0x542a('0x41')]=_0x1ae58e['attributes'][_0x542a('0x42')]?_0x1ae58e[_0x542a('0x41')]:_0x2fd341['model'];if(!_0x5f20ff[_0x542a('0x3b')][_0x542a('0x43')](_0x542a('0x44'))){_0x1ae58e[_0x542a('0x23')]=qs['limit'](_0x5f20ff[_0x542a('0x3b')][_0x542a('0x23')]);_0x1ae58e[_0x542a('0x22')]=qs[_0x542a('0x22')](_0x5f20ff[_0x542a('0x3b')][_0x542a('0x22')]);}_0x1ae58e['order']=qs[_0x542a('0x46')](_0x5f20ff[_0x542a('0x3b')][_0x542a('0x46')]);_0x1ae58e[_0x542a('0x47')]=qs[_0x542a('0x3d')](_[_0x542a('0x62')](_0x5f20ff[_0x542a('0x3b')],_0x2fd341[_0x542a('0x3d')]));_0x1ae58e[_0x542a('0x47')][_0x542a('0x63')]=_0x132f78['id'];if(_0x5f20ff[_0x542a('0x3b')][_0x542a('0x2c')]){_0x1ae58e[_0x542a('0x47')]=_[_0x542a('0x48')](_0x1ae58e[_0x542a('0x47')],{'$or':_[_0x542a('0x2e')](_0x1ae58e[_0x542a('0x41')],function(_0x3334d9){var _0x51f13e={};_0x51f13e[_0x3334d9]={'$like':'%'+_0x5f20ff[_0x542a('0x3b')][_0x542a('0x2c')]+'%'};return _0x51f13e;})});}_0x1ae58e=_['merge']({},_0x1ae58e,_0x5f20ff[_0x542a('0x50')]);return db[_0x542a('0x61')][_0x542a('0x21')]({'where':_0x1ae58e['where']})[_0x542a('0x28')](function(_0x49cff6){_0x587c6e[_0x542a('0x21')]=_0x49cff6;if(_0x5f20ff['query'][_0x542a('0x4b')]){_0x1ae58e[_0x542a('0x4c')]=[{'all':!![]}];}return db[_0x542a('0x61')][_0x542a('0x64')](_0x1ae58e);})['then'](function(_0x1849b8){_0x587c6e[_0x542a('0x4d')]=_0x1849b8;return _0x587c6e;});}})[_0x542a('0x28')](respondWithFilteredResult(_0x5d000d,_0x1ae58e))[_0x542a('0x52')](handleError(_0x5d000d,null));};exports[_0x542a('0x65')]=function(_0x3b441a,_0x3c2a5c,_0x434069){var _0x23bfb0={'raw':!![],'where':{}};var _0x417705={};var _0xa781f3={'count':0x0,'rows':[]};return db[_0x542a('0x4a')]['findOne']({'where':{'id':_0x3b441a['params']['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x3c2a5c,null))['then'](function(_0x2a4efd){if(_0x2a4efd){_0x417705['model']=_[_0x542a('0x3c')](db[_0x542a('0x66')][_0x542a('0x38')]);_0x417705[_0x542a('0x3b')]=_['keys'](_0x3b441a[_0x542a('0x3b')]);_0x417705[_0x542a('0x3d')]=_['intersection'](_0x417705[_0x542a('0x3f')],_0x417705[_0x542a('0x3b')]);_0x23bfb0[_0x542a('0x41')]=_['intersection'](_0x417705[_0x542a('0x3f')],qs['fields'](_0x3b441a['query']['fields']));_0x23bfb0['attributes']=_0x23bfb0[_0x542a('0x41')][_0x542a('0x42')]?_0x23bfb0[_0x542a('0x41')]:_0x417705[_0x542a('0x3f')];if(!_0x3b441a[_0x542a('0x3b')][_0x542a('0x43')](_0x542a('0x44'))){_0x23bfb0['limit']=qs['limit'](_0x3b441a['query'][_0x542a('0x23')]);_0x23bfb0['offset']=qs[_0x542a('0x22')](_0x3b441a[_0x542a('0x3b')][_0x542a('0x22')]);}_0x23bfb0[_0x542a('0x45')]=qs[_0x542a('0x46')](_0x3b441a[_0x542a('0x3b')][_0x542a('0x46')]);_0x23bfb0[_0x542a('0x47')]=qs[_0x542a('0x3d')](_[_0x542a('0x62')](_0x3b441a[_0x542a('0x3b')],_0x417705['filters']));_0x23bfb0[_0x542a('0x47')]['VoiceQueueId']=_0x2a4efd['id'];if(_0x3b441a[_0x542a('0x3b')][_0x542a('0x2c')]){_0x23bfb0[_0x542a('0x47')]=_[_0x542a('0x48')](_0x23bfb0['where'],{'$or':_['map'](_0x23bfb0[_0x542a('0x41')],function(_0x4b4bd7){var _0x48699a={};_0x48699a[_0x4b4bd7]={'$like':'%'+_0x3b441a['query']['filter']+'%'};return _0x48699a;})});}_0x23bfb0=_[_0x542a('0x48')]({},_0x23bfb0,_0x3b441a[_0x542a('0x50')]);return db[_0x542a('0x66')]['count']({'where':_0x23bfb0[_0x542a('0x47')]})[_0x542a('0x28')](function(_0x55a31e){_0xa781f3[_0x542a('0x21')]=_0x55a31e;if(_0x3b441a[_0x542a('0x3b')][_0x542a('0x4b')]){_0x23bfb0[_0x542a('0x4c')]=[{'all':!![]}];}return db[_0x542a('0x66')][_0x542a('0x64')](_0x23bfb0);})[_0x542a('0x28')](function(_0x41e2a6){_0xa781f3['rows']=_0x41e2a6;return _0xa781f3;});}})[_0x542a('0x28')](respondWithFilteredResult(_0x3c2a5c,_0x23bfb0))[_0x542a('0x52')](handleError(_0x3c2a5c,null));};exports[_0x542a('0x67')]=function(_0x27ea8e,_0x18cb94,_0x142ef2){var _0x1bc26f={'raw':!![],'where':{}};var _0x57ce31={};var _0x53b28e={'count':0x0,'rows':[]};return db[_0x542a('0x4a')][_0x542a('0x68')]({'where':{'id':_0x27ea8e['params']['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x18cb94,null))[_0x542a('0x28')](function(_0x59a6ab){if(_0x59a6ab){_0x57ce31['model']=_[_0x542a('0x3c')](db[_0x542a('0x69')][_0x542a('0x38')]);_0x57ce31[_0x542a('0x3b')]=_[_0x542a('0x3c')](_0x27ea8e['query']);_0x57ce31[_0x542a('0x3d')]=_['intersection'](_0x57ce31[_0x542a('0x3f')],_0x57ce31[_0x542a('0x3b')]);_0x1bc26f[_0x542a('0x41')]=_[_0x542a('0x3e')](_0x57ce31[_0x542a('0x3f')],qs[_0x542a('0x40')](_0x27ea8e['query'][_0x542a('0x40')]));_0x1bc26f[_0x542a('0x41')]=_0x1bc26f['attributes'][_0x542a('0x42')]?_0x1bc26f['attributes']:_0x57ce31['model'];if(!_0x27ea8e['query']['hasOwnProperty'](_0x542a('0x44'))){_0x1bc26f['limit']=qs[_0x542a('0x23')](_0x27ea8e[_0x542a('0x3b')][_0x542a('0x23')]);_0x1bc26f[_0x542a('0x22')]=qs[_0x542a('0x22')](_0x27ea8e[_0x542a('0x3b')][_0x542a('0x22')]);}_0x1bc26f[_0x542a('0x45')]=qs[_0x542a('0x46')](_0x27ea8e['query'][_0x542a('0x46')]);_0x1bc26f[_0x542a('0x47')]=qs[_0x542a('0x3d')](_[_0x542a('0x62')](_0x27ea8e[_0x542a('0x3b')],_0x57ce31[_0x542a('0x3d')]));_0x1bc26f[_0x542a('0x47')][_0x542a('0x63')]=_0x59a6ab['id'];if(_0x27ea8e['query']['filter']){_0x1bc26f[_0x542a('0x47')]=_[_0x542a('0x48')](_0x1bc26f[_0x542a('0x47')],{'$or':_[_0x542a('0x2e')](_0x1bc26f[_0x542a('0x41')],function(_0x164c7e){var _0x1d9870={};_0x1d9870[_0x164c7e]={'$like':'%'+_0x27ea8e[_0x542a('0x3b')][_0x542a('0x2c')]+'%'};return _0x1d9870;})});}_0x1bc26f=_[_0x542a('0x48')]({},_0x1bc26f,_0x27ea8e[_0x542a('0x50')]);return db[_0x542a('0x69')][_0x542a('0x21')]({'where':_0x1bc26f[_0x542a('0x47')]})[_0x542a('0x28')](function(_0x107c20){_0x53b28e[_0x542a('0x21')]=_0x107c20;if(_0x27ea8e[_0x542a('0x3b')][_0x542a('0x4b')]){_0x1bc26f[_0x542a('0x4c')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x542a('0x64')](_0x1bc26f);})[_0x542a('0x28')](function(_0x5da76a){_0x53b28e['rows']=_0x5da76a;return _0x53b28e;});}})[_0x542a('0x28')](respondWithFilteredResult(_0x18cb94,_0x1bc26f))[_0x542a('0x52')](handleError(_0x18cb94,null));};exports[_0x542a('0x6a')]=function(_0x169ffa,_0x4d8ca8,_0x1d47a5){var _0x32e432={'raw':!![],'where':{}};var _0x3b65df={};var _0x5b6339={'count':0x0,'rows':[]};return db[_0x542a('0x4a')][_0x542a('0x68')]({'where':{'id':_0x169ffa[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x4d8ca8,null))['then'](function(_0x111442){if(_0x111442){_0x3b65df['model']=_['keys'](db[_0x542a('0x6b')]['rawAttributes']);_0x3b65df[_0x542a('0x3b')]=_[_0x542a('0x3c')](_0x169ffa[_0x542a('0x3b')]);_0x3b65df['filters']=_[_0x542a('0x3e')](_0x3b65df[_0x542a('0x3f')],_0x3b65df['query']);_0x32e432[_0x542a('0x41')]=_[_0x542a('0x3e')](_0x3b65df['model'],qs['fields'](_0x169ffa[_0x542a('0x3b')]['fields']));_0x32e432['attributes']=_0x32e432['attributes'][_0x542a('0x42')]?_0x32e432['attributes']:_0x3b65df['model'];if(!_0x169ffa[_0x542a('0x3b')][_0x542a('0x43')](_0x542a('0x44'))){_0x32e432[_0x542a('0x23')]=qs['limit'](_0x169ffa[_0x542a('0x3b')][_0x542a('0x23')]);_0x32e432[_0x542a('0x22')]=qs[_0x542a('0x22')](_0x169ffa[_0x542a('0x3b')]['offset']);}_0x32e432['order']=qs[_0x542a('0x46')](_0x169ffa[_0x542a('0x3b')]['sort']);_0x32e432['where']=qs[_0x542a('0x3d')](_[_0x542a('0x62')](_0x169ffa[_0x542a('0x3b')],_0x3b65df[_0x542a('0x3d')]));_0x32e432[_0x542a('0x47')][_0x542a('0x63')]=_0x111442['id'];if(_0x169ffa[_0x542a('0x3b')][_0x542a('0x2c')]){_0x32e432['where']=_[_0x542a('0x48')](_0x32e432[_0x542a('0x47')],{'$or':_[_0x542a('0x2e')](_0x32e432[_0x542a('0x41')],function(_0x61a67d){var _0x5689e8={};_0x5689e8[_0x61a67d]={'$like':'%'+_0x169ffa[_0x542a('0x3b')][_0x542a('0x2c')]+'%'};return _0x5689e8;})});}_0x32e432=_[_0x542a('0x48')]({},_0x32e432,_0x169ffa[_0x542a('0x50')]);return db[_0x542a('0x6b')][_0x542a('0x21')]({'where':_0x32e432[_0x542a('0x47')]})['then'](function(_0x39ea1d){_0x5b6339[_0x542a('0x21')]=_0x39ea1d;if(_0x169ffa['query'][_0x542a('0x4b')]){_0x32e432['include']=[{'all':!![]}];}return db[_0x542a('0x6b')][_0x542a('0x64')](_0x32e432);})[_0x542a('0x28')](function(_0x332f85){_0x5b6339[_0x542a('0x4d')]=_0x332f85;return _0x5b6339;});}})[_0x542a('0x28')](respondWithFilteredResult(_0x4d8ca8,_0x32e432))['catch'](handleError(_0x4d8ca8,null));};exports[_0x542a('0x6c')]=function(_0x114670,_0x584d7b,_0x45ce5d){var _0x2420eb={};var _0x22dd69={};var _0x22522c;var _0x146e80;return db[_0x542a('0x4a')][_0x542a('0x68')]({'where':{'id':_0x114670[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x584d7b,null))[_0x542a('0x28')](function(_0x3774da){if(_0x3774da){_0x22522c=_0x3774da;_0x22dd69[_0x542a('0x3f')]=_[_0x542a('0x3c')](db[_0x542a('0x6d')][_0x542a('0x38')]);_0x22dd69[_0x542a('0x3b')]=_['keys'](_0x114670['query']);_0x22dd69[_0x542a('0x3d')]=_[_0x542a('0x3e')](_0x22dd69[_0x542a('0x3f')],_0x22dd69[_0x542a('0x3b')]);_0x2420eb[_0x542a('0x41')]=_[_0x542a('0x3e')](_0x22dd69[_0x542a('0x3f')],qs['fields'](_0x114670['query'][_0x542a('0x40')]));_0x2420eb['attributes']=_0x2420eb['attributes']['length']?_0x2420eb[_0x542a('0x41')]:_0x22dd69['model'];_0x2420eb[_0x542a('0x45')]=qs[_0x542a('0x46')](_0x114670[_0x542a('0x3b')]['sort']);_0x2420eb[_0x542a('0x47')]=qs[_0x542a('0x3d')](_[_0x542a('0x62')](_0x114670[_0x542a('0x3b')],_0x22dd69[_0x542a('0x3d')]));if(_0x114670[_0x542a('0x3b')]['filter']){_0x2420eb[_0x542a('0x47')]=_[_0x542a('0x48')](_0x2420eb['where'],{'$or':_['map'](_0x2420eb['attributes'],function(_0x2a3162){var _0x147f7d={};_0x147f7d[_0x2a3162]={'$like':'%'+_0x114670[_0x542a('0x3b')][_0x542a('0x2c')]+'%'};return _0x147f7d;})});}_0x2420eb=_[_0x542a('0x48')]({},_0x2420eb,_0x114670['options']);return _0x22522c[_0x542a('0x6c')](_0x2420eb);}})[_0x542a('0x28')](function(_0x48f8ad){if(_0x48f8ad){_0x146e80=_0x48f8ad[_0x542a('0x42')];if(!_0x114670['query'][_0x542a('0x43')](_0x542a('0x44'))){_0x2420eb[_0x542a('0x23')]=qs[_0x542a('0x23')](_0x114670[_0x542a('0x3b')][_0x542a('0x23')]);_0x2420eb[_0x542a('0x22')]=qs[_0x542a('0x22')](_0x114670[_0x542a('0x3b')][_0x542a('0x22')]);}return _0x22522c['getTeams'](_0x2420eb);}})[_0x542a('0x28')](function(_0x576563){if(_0x576563){return _0x576563?{'count':_0x146e80,'rows':_0x576563}:null;}})['then'](respondWithResult(_0x584d7b,null))[_0x542a('0x52')](handleError(_0x584d7b,null));};exports[_0x542a('0x6e')]=function(_0x411f99,_0x33aa15,_0x556fc4){var _0x423b1d=_0x411f99[_0x542a('0x54')][_0x542a('0x6f')];var _0x250e1f=_['map'](_0x423b1d,'id');return db[_0x542a('0x6d')][_0x542a('0x64')]({'where':{'id':_0x250e1f},'attributes':['id'],'include':[{'model':db[_0x542a('0x70')],'as':_0x542a('0x71'),'attributes':['id',_0x542a('0x36'),'online','voicePause','interface'],'raw':!![]}]})[_0x542a('0x28')](function(_0x54469d){if(_0x54469d){var _0x9dbf3a=_['flatMap'](_0x54469d,function(_0x58e464){var _0x51dc8d=_0x58e464[_0x542a('0x29')]({'plain':!![]});_0x51dc8d[_0x542a('0x71')][_0x542a('0x72')](function(_0x5a8ef5){_0x5a8ef5['penalty']=_[_0x542a('0x51')](_0x423b1d,{'id':_0x51dc8d['id']})[_0x542a('0x73')];});return _0x51dc8d['Agents'];});return db[_0x542a('0x4a')]['find']({'where':{'id':_0x411f99[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](function(_0xc6946f){return db['sequelize'][_0x542a('0x74')](function(_0x134d6c){return _0xc6946f[_0x542a('0x6e')](_0x250e1f,{'transaction':_0x134d6c})[_0x542a('0x28')](function(){return BPromise[_0x542a('0x75')](_0x9dbf3a,function(_0x19df56){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x19df56['id'],'VoiceQueueId':_0x411f99['params']['id']},'defaults':{'penalty':_0x19df56[_0x542a('0x73')]},'transaction':_0x134d6c});});})[_0x542a('0x28')](function(){return BPromise[_0x542a('0x75')](_[_0x542a('0x2c')](_0x9dbf3a,{'online':!![]}),function(_0x45512b){return db['UserVoiceQueueRt']['upsert']({'membername':_0x45512b[_0x542a('0x36')],'UserId':_0x45512b['id'],'queue_name':_0xc6946f[_0x542a('0x36')],'VoiceQueueId':_0xc6946f['id'],'interface':_['isNil'](_0x45512b[_0x542a('0x76')])?util[_0x542a('0x77')](_0x542a('0x78'),_0x45512b['name']):_0x45512b[_0x542a('0x76')],'paused':_0x45512b[_0x542a('0x79')]||![],'penalty':_0x45512b[_0x542a('0x73')]},{'transaction':_0x134d6c});});})['then'](function(){_0x9dbf3a[_0x542a('0x72')](function(_0x19d430){socket[_0x542a('0x7a')](_0x542a('0x7b'),{'UserId':_0x19d430['id'],'VoiceQueueId':_0xc6946f['id']});});});});});}})['then'](respondWithStatusCode(_0x33aa15,null))[_0x542a('0x52')](handleError(_0x33aa15,null));};exports['removeTeams']=function(_0x5bbf04,_0x3defc3,_0x25501c){return db['Team'][_0x542a('0x64')]({'where':{'id':_0x5bbf04['query'][_0x542a('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x542a('0x70')],'as':_0x542a('0x71'),'attributes':['id'],'raw':!![]}]})[_0x542a('0x28')](handleEntityNotFound(_0x3defc3,null))['then'](function(_0xbe6432){var _0x3c356b=_[_0x542a('0x2e')](_0xbe6432,'id');var _0x4ab6f4=[];var _0x5d25a7=[];var _0x3591f9=squel[_0x542a('0x7d')]();_0x3591f9['field']('tq.TeamId')[_0x542a('0x7e')](_0x542a('0x7f'),'tq')[_0x542a('0x80')]('user_has_teams','ut',_0x542a('0x81'))[_0x542a('0x47')](_0x542a('0x82'),_0x5bbf04[_0x542a('0x4f')]['id']);for(var _0x551463=0x0;_0x551463<_0xbe6432[_0x542a('0x42')];_0x551463+=0x1){let _0x1bad81=_0xbe6432[_0x551463];for(var _0x31e2da=0x0;_0x31e2da<_0x1bad81[_0x542a('0x71')]['length'];_0x31e2da+=0x1){let _0x48995d=_0x1bad81[_0x542a('0x71')][_0x31e2da];var _0x3b0e62=_0x3591f9[_0x542a('0x83')]();_0x3b0e62['where'](_0x542a('0x84'),_0x48995d['id']);_0x5d25a7[_0x542a('0x85')](db['sequelize'][_0x542a('0x3b')](_0x3b0e62['toString'](),{'type':db[_0x542a('0x86')][_0x542a('0x87')][_0x542a('0x88')]})['then'](function(_0x3a593d){if(_0x3a593d[_0x542a('0x42')]===0x1){return _0x48995d['id'];}else{var _0x304776=_[_0x542a('0x89')](_[_0x542a('0x2e')](_0x3a593d,'TeamId'),function(_0x179b1f){return _[_0x542a('0x30')](_0x3c356b,_0x179b1f);});if(_0x304776){return _0x48995d['id'];}}}));}}return BPromise[_0x542a('0x8a')](_0x5d25a7)[_0x542a('0x28')](function(_0x306ca7){_0x4ab6f4=_(_0x4ab6f4)['union'](_0x306ca7)[_0x542a('0x8b')]()[_0x542a('0x2f')]();return db[_0x542a('0x4a')][_0x542a('0x51')]({'where':{'id':_0x5bbf04[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](function(_0x1085dd){return db['sequelize']['transaction'](function(_0x3263de){return _0x1085dd[_0x542a('0x8c')](_0x5bbf04['query'][_0x542a('0x7c')],{'transaction':_0x3263de})[_0x542a('0x28')](function(){if(!_['isEmpty'](_0x4ab6f4)){return _0x1085dd[_0x542a('0x8d')](_0x4ab6f4,{'transaction':_0x3263de})[_0x542a('0x28')](function(){return db['UserVoiceQueueRt'][_0x542a('0x33')]({'where':{'VoiceQueueId':_0x5bbf04[_0x542a('0x4f')]['id'],'UserId':_0x4ab6f4},'transaction':_0x3263de});});}})[_0x542a('0x28')](function(){_0x4ab6f4[_0x542a('0x72')](function(_0x3b9509){socket['emit']('userVoiceQueue:remove',{'UserId':_0x3b9509,'VoiceQueueId':_0x1085dd['id']});});});});});});})[_0x542a('0x28')](respondWithStatusCode(_0x3defc3,null))[_0x542a('0x52')](handleError(_0x3defc3,null));};exports[_0x542a('0x8e')]=function(_0x40adce,_0x5d0d60,_0x2426a8){var _0x3d2a04,_0x4cf049;return db['VoiceQueue'][_0x542a('0x51')]({'where':{'id':_0x40adce['params']['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x5d0d60,null))['then'](function(_0x362be8){if(_0x362be8){_0x4cf049=_0x362be8;return _0x362be8[_0x542a('0x8e')](_0x40adce[_0x542a('0x54')][_0x542a('0x7c')],_['omit'](_0x40adce['body'],[_0x542a('0x7c'),'id'])||{})[_0x542a('0x8f')](function(_0x2f6e13){for(var _0x1b8c29=0x0;_0x1b8c29<_0x40adce[_0x542a('0x54')][_0x542a('0x7c')][_0x542a('0x42')];_0x1b8c29+=0x1){socket['emit'](_0x542a('0x7b'),{'UserId':_0x40adce[_0x542a('0x54')][_0x542a('0x7c')][_0x1b8c29],'VoiceQueueId':_0x40adce[_0x542a('0x4f')]['id']});}return _0x2f6e13;});}})[_0x542a('0x28')](function(_0x6d435f){_0x3d2a04=_0x6d435f||[];if(_0x4cf049){return db[_0x542a('0x70')][_0x542a('0x64')]({'where':{'id':_0x40adce[_0x542a('0x54')][_0x542a('0x7c')]},'attributes':['id',_0x542a('0x36'),_0x542a('0x90'),_0x542a('0x79'),_0x542a('0x76')],'raw':!![]});}})[_0x542a('0x28')](function(_0x423e0c){if(!_[_0x542a('0x91')](_0x423e0c)){var _0x1d2699=[];for(var _0xb4ae69=0x0;_0xb4ae69<_0x423e0c[_0x542a('0x42')];_0xb4ae69++){if(_0x423e0c[_0xb4ae69][_0x542a('0x90')]){_0x1d2699[_0x542a('0x85')](db[_0x542a('0x92')][_0x542a('0x93')]({'membername':_0x423e0c[_0xb4ae69][_0x542a('0x36')],'UserId':_0x423e0c[_0xb4ae69]['id'],'queue_name':_0x4cf049['name'],'VoiceQueueId':_0x4cf049['id'],'interface':_[_0x542a('0x94')](_0x423e0c[_0xb4ae69][_0x542a('0x76')])?util[_0x542a('0x77')]('SIP/%s',_0x423e0c[_0xb4ae69][_0x542a('0x36')]):_0x423e0c[_0xb4ae69][_0x542a('0x76')],'paused':_0x423e0c[_0xb4ae69]['voicePause']||![],'penalty':_0x40adce['body'][_0x542a('0x73')]||0x0}));}}return BPromise[_0x542a('0x8a')](_0x1d2699);}})['then'](function(){return _0x3d2a04;})[_0x542a('0x28')](respondWithResult(_0x5d0d60,null))['catch'](handleError(_0x5d0d60,null));};exports[_0x542a('0x8d')]=function(_0x4a565f,_0x146732,_0x5efef8){return db[_0x542a('0x4a')][_0x542a('0x51')]({'where':{'id':_0x4a565f[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x146732,null))['then'](function(_0x41634){if(_0x41634){return _0x41634[_0x542a('0x8d')](_0x4a565f['query'][_0x542a('0x7c')])[_0x542a('0x28')](function(){if(_[_0x542a('0x95')](_0x4a565f[_0x542a('0x3b')][_0x542a('0x7c')])){for(var _0x1f78fa=0x0;_0x1f78fa<_0x4a565f[_0x542a('0x3b')][_0x542a('0x7c')][_0x542a('0x42')];_0x1f78fa+=0x1){socket[_0x542a('0x7a')](_0x542a('0x96'),{'UserId':Number(_0x4a565f[_0x542a('0x3b')][_0x542a('0x7c')][_0x1f78fa]),'VoiceQueueId':Number(_0x4a565f[_0x542a('0x4f')]['id'])});}}else{socket['emit'](_0x542a('0x96'),{'UserId':Number(_0x4a565f['query'][_0x542a('0x7c')]),'VoiceQueueId':Number(_0x4a565f['params']['id'])});}});}})[_0x542a('0x28')](function(_0x252bb5){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4a565f[_0x542a('0x4f')]['id'],'UserId':_0x4a565f[_0x542a('0x3b')][_0x542a('0x7c')]}})[_0x542a('0x28')](function(){return _0x252bb5;});})['then'](respondWithStatusCode(_0x146732,null))[_0x542a('0x52')](handleError(_0x146732,null));};exports[_0x542a('0x97')]=function(_0x2058ee,_0x37a1a8,_0x4ab2b3){var _0x4c994c={};var _0x5ea82e={};var _0x2f2da8;var _0x447aeb;return db['VoiceQueue'][_0x542a('0x68')]({'where':{'id':_0x2058ee[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x37a1a8,null))[_0x542a('0x28')](function(_0x41c7c5){if(_0x41c7c5){_0x2f2da8=_0x41c7c5;_0x5ea82e['model']=_[_0x542a('0x3c')](db[_0x542a('0x70')]['rawAttributes']);_0x5ea82e[_0x542a('0x3b')]=_[_0x542a('0x3c')](_0x2058ee['query']);_0x5ea82e['filters']=_['intersection'](_0x5ea82e[_0x542a('0x3f')],_0x5ea82e['query']);_0x4c994c[_0x542a('0x41')]=_['intersection'](_0x5ea82e[_0x542a('0x3f')],qs['fields'](_0x2058ee[_0x542a('0x3b')]['fields']));_0x4c994c[_0x542a('0x41')]=_0x4c994c[_0x542a('0x41')][_0x542a('0x42')]?_0x4c994c['attributes']:_0x5ea82e[_0x542a('0x3f')];_0x4c994c[_0x542a('0x45')]=qs[_0x542a('0x46')](_0x2058ee[_0x542a('0x3b')][_0x542a('0x46')]);_0x4c994c[_0x542a('0x47')]=qs['filters'](_['pick'](_0x2058ee[_0x542a('0x3b')],_0x5ea82e[_0x542a('0x3d')]));if(_0x2058ee[_0x542a('0x3b')][_0x542a('0x2c')]){_0x4c994c[_0x542a('0x47')]=_[_0x542a('0x48')](_0x4c994c['where'],{'$or':_[_0x542a('0x2e')](_0x4c994c[_0x542a('0x41')],function(_0x408d26){var _0x1dc8a1={};_0x1dc8a1[_0x408d26]={'$like':'%'+_0x2058ee[_0x542a('0x3b')][_0x542a('0x2c')]+'%'};return _0x1dc8a1;})});}_0x4c994c=_[_0x542a('0x48')]({},_0x4c994c,_0x2058ee['options']);return _0x2f2da8[_0x542a('0x97')](_0x4c994c);}})[_0x542a('0x28')](function(_0x2b2a2f){if(_0x2b2a2f){_0x447aeb=_0x2b2a2f['length'];if(!_0x2058ee[_0x542a('0x3b')]['hasOwnProperty'](_0x542a('0x44'))){_0x4c994c[_0x542a('0x23')]=qs[_0x542a('0x23')](_0x2058ee['query'][_0x542a('0x23')]);_0x4c994c[_0x542a('0x22')]=qs[_0x542a('0x22')](_0x2058ee[_0x542a('0x3b')][_0x542a('0x22')]);}return _0x2f2da8[_0x542a('0x97')](_0x4c994c);}})['then'](function(_0x11e643){if(_0x11e643){return _0x11e643?{'count':_0x447aeb,'rows':_0x11e643}:null;}})[_0x542a('0x28')](respondWithResult(_0x37a1a8,null))[_0x542a('0x52')](handleError(_0x37a1a8,null));};exports[_0x542a('0x98')]=function(_0x5e25d0,_0xe1da8a,_0x2383dd){var _0x43821e={};var _0x10fbb6={};var _0x3237a9;var _0x16d961;return db[_0x542a('0x4a')][_0x542a('0x68')]({'where':{'id':_0x5e25d0[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0xe1da8a,null))['then'](function(_0x40553e){if(_0x40553e){_0x3237a9=_0x40553e;_0x10fbb6[_0x542a('0x3f')]=_[_0x542a('0x3c')](db['UserVoiceQueueRt']['rawAttributes']);_0x10fbb6[_0x542a('0x3b')]=_['keys'](_0x5e25d0[_0x542a('0x3b')]);_0x10fbb6[_0x542a('0x3d')]=_[_0x542a('0x3e')](_0x10fbb6['model'],_0x10fbb6[_0x542a('0x3b')]);_0x43821e[_0x542a('0x41')]=_[_0x542a('0x3e')](_0x10fbb6[_0x542a('0x3f')],qs[_0x542a('0x40')](_0x5e25d0[_0x542a('0x3b')][_0x542a('0x40')]));_0x43821e[_0x542a('0x41')]=_0x43821e[_0x542a('0x41')][_0x542a('0x42')]?_0x43821e[_0x542a('0x41')]:_0x10fbb6[_0x542a('0x3f')];_0x43821e[_0x542a('0x45')]=qs[_0x542a('0x46')](_0x5e25d0[_0x542a('0x3b')][_0x542a('0x46')]);_0x43821e[_0x542a('0x47')]=qs['filters'](_['pick'](_0x5e25d0[_0x542a('0x3b')],_0x10fbb6['filters']));if(_0x5e25d0['query'][_0x542a('0x2c')]){_0x43821e['where']=_[_0x542a('0x48')](_0x43821e['where'],{'$or':_[_0x542a('0x2e')](_0x43821e[_0x542a('0x41')],function(_0x25421b){var _0x46d771={};_0x46d771[_0x25421b]={'$like':'%'+_0x5e25d0[_0x542a('0x3b')][_0x542a('0x2c')]+'%'};return _0x46d771;})});}_0x43821e=_[_0x542a('0x48')]({},_0x43821e,_0x5e25d0[_0x542a('0x50')]);return _0x3237a9[_0x542a('0x98')](_0x43821e);}})[_0x542a('0x28')](function(_0x307cb2){if(_0x307cb2){_0x16d961=_0x307cb2[_0x542a('0x42')];if(!_0x5e25d0[_0x542a('0x3b')]['hasOwnProperty']('nolimit')){_0x43821e[_0x542a('0x23')]=qs['limit'](_0x5e25d0[_0x542a('0x3b')][_0x542a('0x23')]);_0x43821e[_0x542a('0x22')]=qs[_0x542a('0x22')](_0x5e25d0[_0x542a('0x3b')][_0x542a('0x22')]);}return _0x3237a9['getMembers'](_0x43821e);}})[_0x542a('0x28')](function(_0x4ece73){return _0x4ece73?{'count':_0x16d961,'rows':_0x4ece73}:null;})[_0x542a('0x28')](respondWithResult(_0xe1da8a,null))[_0x542a('0x52')](handleError(_0xe1da8a,null));};exports[_0x542a('0x99')]=function(_0xfae6c4,_0x334980,_0x26301f){var _0x173825={};var _0x264136={};var _0x3fee85;var _0x1a81fd;return db['VoiceQueue'][_0x542a('0x68')]({'where':{'id':_0xfae6c4[_0x542a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x334980,null))[_0x542a('0x28')](function(_0x25473c){if(_0x25473c){_0x3fee85=_0x25473c;_0x264136['model']=_[_0x542a('0x3c')](db[_0x542a('0x9a')]['rawAttributes']);_0x264136[_0x542a('0x3b')]=_[_0x542a('0x3c')](_0xfae6c4[_0x542a('0x3b')]);_0x264136['filters']=_[_0x542a('0x3e')](_0x264136[_0x542a('0x3f')],_0x264136[_0x542a('0x3b')]);_0x173825[_0x542a('0x41')]=_[_0x542a('0x3e')](_0x264136['model'],qs[_0x542a('0x40')](_0xfae6c4['query'][_0x542a('0x40')]));_0x173825[_0x542a('0x41')]=_0x173825[_0x542a('0x41')][_0x542a('0x42')]?_0x173825[_0x542a('0x41')]:_0x264136[_0x542a('0x3f')];_0x173825[_0x542a('0x45')]=qs[_0x542a('0x46')](_0xfae6c4[_0x542a('0x3b')][_0x542a('0x46')]);_0x173825[_0x542a('0x47')]=qs['filters'](_['pick'](_0xfae6c4[_0x542a('0x3b')],_0x264136['filters']));if(_0xfae6c4['query'][_0x542a('0x2c')]){_0x173825[_0x542a('0x47')]=_[_0x542a('0x48')](_0x173825['where'],{'$or':_[_0x542a('0x2e')](_0x173825['attributes'],function(_0x293f6d){var _0xe3779f={};_0xe3779f[_0x293f6d]={'$like':'%'+_0xfae6c4[_0x542a('0x3b')][_0x542a('0x2c')]+'%'};return _0xe3779f;})});}_0x173825=_['merge']({},_0x173825,_0xfae6c4[_0x542a('0x50')]);return _0x3fee85[_0x542a('0x99')](_0x173825);}})['then'](function(_0x11cc84){if(_0x11cc84){_0x1a81fd=_0x11cc84[_0x542a('0x42')];if(!_0xfae6c4[_0x542a('0x3b')][_0x542a('0x43')]('nolimit')){_0x173825[_0x542a('0x23')]=qs[_0x542a('0x23')](_0xfae6c4['query'][_0x542a('0x23')]);_0x173825[_0x542a('0x22')]=qs[_0x542a('0x22')](_0xfae6c4[_0x542a('0x3b')][_0x542a('0x22')]);}return _0x3fee85[_0x542a('0x99')](_0x173825);}})[_0x542a('0x28')](function(_0x1b7bb5){if(_0x1b7bb5){return _0x1b7bb5?{'count':_0x1a81fd,'rows':_0x1b7bb5}:null;}})[_0x542a('0x28')](respondWithResult(_0x334980,null))['catch'](handleError(_0x334980,null));};exports[_0x542a('0x9b')]=function(_0x310533,_0x1f2fde,_0x5be8b5){var _0x1801aa,_0x36f151;return db[_0x542a('0x4a')][_0x542a('0x51')]({'where':{'id':_0x310533[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x1f2fde,null))[_0x542a('0x28')](function(_0x3f10bb){if(_0x3f10bb){_0x36f151=_0x3f10bb;return _0x3f10bb[_0x542a('0x9b')](_0x310533['body'][_0x542a('0x7c')],_[_0x542a('0x5c')](_0x310533[_0x542a('0x54')],[_0x542a('0x7c'),'id'])||{});}return null;})[_0x542a('0x8f')](function(_0x425beb){var _0x5290dd;_0x1801aa=_0x425beb||[];var _0x49782f=[];if(_0x425beb){for(var _0x1c2f48=0x0;_0x1c2f48<_0x425beb[_0x542a('0x42')];_0x1c2f48+=0x1){var _0x5d835d=_0x425beb[_0x1c2f48][_0x542a('0x29')]({'plain':!![]});_0x36f151['dialCheckDuplicateType']=_0x310533[_0x542a('0x54')]['dialCheckDuplicateType']?_0x310533[_0x542a('0x54')][_0x542a('0x9c')]:_0x36f151[_0x542a('0x9c')];switch(_0x36f151[_0x542a('0x9c')]){case _0x542a('0x9d'):_0x5290dd=squel['insert']()[_0x542a('0x9e')](_0x542a('0x9f'))['fromQuery']([_0x542a('0xa0'),'scheduledAt',_0x542a('0xa1'),_0x542a('0xa2'),'VoiceQueueId',_0x542a('0x5d'),_0x542a('0x5e')],squel[_0x542a('0x7d')]()[_0x542a('0xa3')](_0x542a('0xa0'),'phone')[_0x542a('0xa3')](_0x542a('0xa4'),_0x542a('0xa5'))[_0x542a('0xa3')]('id',_0x542a('0xa1'))[_0x542a('0xa3')](_0x5d835d[_0x542a('0xa6')]['toString'](),_0x542a('0xa2'))[_0x542a('0xa3')](_0x310533[_0x542a('0x4f')]['id'][_0x542a('0xa7')](),_0x542a('0x63'))[_0x542a('0xa3')](_0x542a('0xa4'),_0x542a('0x5d'))['field']('NOW()',_0x542a('0x5e'))[_0x542a('0x7e')](_0x542a('0xa8'))[_0x542a('0x47')]('deletedAt\x20IS\x20NULL')[_0x542a('0x47')](_0x542a('0xa9'),_0x5d835d['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x542a('0x47')](_0x542a('0xaa'),squel['select']()[_0x542a('0xa3')]('COALESCE(calleridnum,\x27\x27)')[_0x542a('0x7e')](_0x542a('0xab'))[_0x542a('0x47')]('VoiceQueueId\x20=\x20?',_0x310533[_0x542a('0x4f')]['id'][_0x542a('0xa7')]()))[_0x542a('0x47')](_0x542a('0xaa'),squel[_0x542a('0x7d')]()[_0x542a('0xa3')](_0x542a('0xac'))[_0x542a('0x7e')](_0x542a('0x9f'))[_0x542a('0x47')](_0x542a('0x82'),_0x310533['params']['id'][_0x542a('0xa7')]())))[_0x542a('0xa7')]();break;case'onlyIfOpen':_0x5290dd=squel[_0x542a('0xad')]()[_0x542a('0x9e')](_0x542a('0x9f'))[_0x542a('0xae')]([_0x542a('0xa0'),_0x542a('0xa5'),_0x542a('0xa1'),_0x542a('0xa2'),_0x542a('0x63'),_0x542a('0x5d'),_0x542a('0x5e')],squel[_0x542a('0x7d')]()[_0x542a('0xa3')](_0x542a('0xa0'),'phone')[_0x542a('0xa3')]('NOW()',_0x542a('0xa5'))['field']('id','ContactId')[_0x542a('0xa3')](_0x5d835d['CmListId']['toString'](),_0x542a('0xa2'))[_0x542a('0xa3')](_0x310533[_0x542a('0x4f')]['id'][_0x542a('0xa7')](),_0x542a('0x63'))[_0x542a('0xa3')]('NOW()',_0x542a('0x5d'))[_0x542a('0xa3')](_0x542a('0xa4'),'updatedAt')['from'](_0x542a('0xa8'))[_0x542a('0x47')]('deletedAt\x20IS\x20NULL')[_0x542a('0x47')](_0x542a('0xa9'),_0x5d835d[_0x542a('0xa6')]['toString']())[_0x542a('0x47')](_0x542a('0xaf'))[_0x542a('0x47')](_0x542a('0xaa'),squel[_0x542a('0x7d')]()[_0x542a('0xa3')](_0x542a('0xac'))[_0x542a('0x7e')](_0x542a('0x9f'))[_0x542a('0x47')](_0x542a('0x82'),_0x310533[_0x542a('0x4f')]['id'][_0x542a('0xa7')]())))['toString']();break;default:_0x5290dd=squel[_0x542a('0xad')]()[_0x542a('0x9e')](_0x542a('0x9f'))[_0x542a('0xae')]([_0x542a('0xa0'),'scheduledAt',_0x542a('0xa1'),_0x542a('0xa2'),_0x542a('0x63'),'createdAt',_0x542a('0x5e')],squel['select']()[_0x542a('0xa3')](_0x542a('0xa0'),_0x542a('0xa0'))['field']('NOW()','scheduledAt')[_0x542a('0xa3')]('id',_0x542a('0xa1'))[_0x542a('0xa3')](_0x5d835d[_0x542a('0xa6')]['toString'](),_0x542a('0xa2'))[_0x542a('0xa3')](_0x310533[_0x542a('0x4f')]['id'][_0x542a('0xa7')](),'VoiceQueueId')[_0x542a('0xa3')](_0x542a('0xa4'),_0x542a('0x5d'))[_0x542a('0xa3')](_0x542a('0xa4'),_0x542a('0x5e'))[_0x542a('0x7e')](_0x542a('0xa8'))[_0x542a('0x47')](_0x542a('0xb0'))[_0x542a('0x47')](_0x542a('0xa9'),_0x5d835d['CmListId'][_0x542a('0xa7')]())[_0x542a('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0x542a('0xa7')]();}_0x49782f[_0x542a('0x85')](db[_0x542a('0x86')]['query'](_0x5290dd));}return BPromise[_0x542a('0x8a')](_0x49782f);}})[_0x542a('0x28')](function(){return _0x1801aa;})[_0x542a('0x28')](respondWithResult(_0x1f2fde,null))['catch'](handleError(_0x1f2fde,null));};exports[_0x542a('0xb1')]=function(_0x4114f9,_0x378429,_0x4fb6e0){return db[_0x542a('0x4a')][_0x542a('0x51')]({'where':{'id':_0x4114f9[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x378429,null))[_0x542a('0x28')](function(_0x5a3368){if(_0x5a3368){return _0x5a3368['removeLists'](_0x4114f9[_0x542a('0x3b')][_0x542a('0x7c')]);}})[_0x542a('0x28')](function(_0x4bc2d6){if(_0x4bc2d6){return db[_0x542a('0x61')]['destroy']({'where':{'ListId':_0x4114f9[_0x542a('0x3b')]['ids'],'VoiceQueueId':_0x4114f9[_0x542a('0x4f')]['id']}})['then'](function(){return _0x4bc2d6;});}})[_0x542a('0x28')](respondWithStatusCode(_0x378429,null))[_0x542a('0x52')](handleError(_0x378429,null));};exports[_0x542a('0xb2')]=function(_0x108328,_0x528d0f,_0x3ff4b2){var _0x44389c={};var _0x5b85cc={};var _0x3e74e4;var _0x98545b;return db[_0x542a('0x4a')][_0x542a('0x68')]({'where':{'id':_0x108328[_0x542a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x528d0f,null))[_0x542a('0x28')](function(_0x4a26cc){if(_0x4a26cc){_0x3e74e4=_0x4a26cc;_0x5b85cc[_0x542a('0x3f')]=_[_0x542a('0x3c')](db[_0x542a('0x9a')][_0x542a('0x38')]);_0x5b85cc[_0x542a('0x3b')]=_[_0x542a('0x3c')](_0x108328[_0x542a('0x3b')]);_0x5b85cc['filters']=_['intersection'](_0x5b85cc[_0x542a('0x3f')],_0x5b85cc[_0x542a('0x3b')]);_0x44389c[_0x542a('0x41')]=_['intersection'](_0x5b85cc['model'],qs['fields'](_0x108328[_0x542a('0x3b')][_0x542a('0x40')]));_0x44389c[_0x542a('0x41')]=_0x44389c[_0x542a('0x41')][_0x542a('0x42')]?_0x44389c[_0x542a('0x41')]:_0x5b85cc[_0x542a('0x3f')];_0x44389c[_0x542a('0x45')]=qs[_0x542a('0x46')](_0x108328[_0x542a('0x3b')][_0x542a('0x46')]);_0x44389c['where']=qs[_0x542a('0x3d')](_['pick'](_0x108328[_0x542a('0x3b')],_0x5b85cc[_0x542a('0x3d')]));if(_0x108328['query']['filter']){_0x44389c[_0x542a('0x47')]=_[_0x542a('0x48')](_0x44389c['where'],{'$or':_[_0x542a('0x2e')](_0x44389c[_0x542a('0x41')],function(_0x35cf9f){var _0x2098b6={};_0x2098b6[_0x35cf9f]={'$like':'%'+_0x108328[_0x542a('0x3b')][_0x542a('0x2c')]+'%'};return _0x2098b6;})});}_0x44389c=_[_0x542a('0x48')]({},_0x44389c,_0x108328[_0x542a('0x50')]);return _0x3e74e4[_0x542a('0xb2')](_0x44389c);}})[_0x542a('0x28')](function(_0x21eaba){if(_0x21eaba){_0x98545b=_0x21eaba[_0x542a('0x42')];if(!_0x108328['query'][_0x542a('0x43')](_0x542a('0x44'))){_0x44389c[_0x542a('0x23')]=qs[_0x542a('0x23')](_0x108328[_0x542a('0x3b')]['limit']);_0x44389c[_0x542a('0x22')]=qs[_0x542a('0x22')](_0x108328['query'][_0x542a('0x22')]);}return _0x3e74e4['getBlackLists'](_0x44389c);}})[_0x542a('0x28')](function(_0x4c3cba){if(_0x4c3cba){return _0x4c3cba?{'count':_0x98545b,'rows':_0x4c3cba}:null;}})[_0x542a('0x28')](respondWithResult(_0x528d0f,null))[_0x542a('0x52')](handleError(_0x528d0f,null));};exports[_0x542a('0xb3')]=function(_0x2e603e,_0x28b469,_0x193dda){var _0x19b6fb,_0x9b3c8b;return db[_0x542a('0x4a')][_0x542a('0x51')]({'where':{'id':_0x2e603e[_0x542a('0x4f')]['id']}})[_0x542a('0x28')](handleEntityNotFound(_0x28b469,null))[_0x542a('0x28')](function(_0x2ada45){if(_0x2ada45){_0x9b3c8b=_0x2ada45;return _0x2ada45['addBlackLists'](_0x2e603e[_0x542a('0x54')]['ids'],_[_0x542a('0x5c')](_0x2e603e[_0x542a('0x54')],[_0x542a('0x7c'),'id'])||{});}return null;})[_0x542a('0x8f')](function(_0x230909){var _0x3fb106;_0x19b6fb=_0x230909||[];var _0x5dfe6c=[];if(_0x230909){for(var _0x1c4adf=0x0;_0x1c4adf<_0x230909[_0x542a('0x42')];_0x1c4adf+=0x1){var _0x552345=_0x230909[_0x1c4adf][_0x542a('0x29')]({'plain':!![]});_0x3fb106=squel[_0x542a('0xad')]()[_0x542a('0x9e')](_0x542a('0xb4'))[_0x542a('0xae')]([_0x542a('0xa0'),_0x542a('0xa1'),_0x542a('0xa2'),_0x542a('0x63'),_0x542a('0x5d'),_0x542a('0x5e')],squel[_0x542a('0x7d')]()['field'](_0x542a('0xa0'),_0x542a('0xa0'))['field']('id',_0x542a('0xa1'))[_0x542a('0xa3')](_0x552345['CmListId'][_0x542a('0xa7')](),_0x542a('0xa2'))[_0x542a('0xa3')](_0x2e603e[_0x542a('0x4f')]['id'][_0x542a('0xa7')](),_0x542a('0x63'))['field'](_0x542a('0xa4'),_0x542a('0x5d'))['field'](_0x542a('0xa4'),_0x542a('0x5e'))['from'](_0x542a('0xa8'))[_0x542a('0x47')](_0x542a('0xb0'))['where'](_0x542a('0xa9'),_0x552345[_0x542a('0xa6')][_0x542a('0xa7')]())[_0x542a('0x47')](_0x542a('0xaf')))[_0x542a('0xa7')]();_0x5dfe6c['push'](db[_0x542a('0x86')][_0x542a('0x3b')](_0x3fb106));}return BPromise[_0x542a('0x8a')](_0x5dfe6c);}})[_0x542a('0x28')](function(){return _0x19b6fb;})[_0x542a('0x28')](respondWithResult(_0x28b469,null))[_0x542a('0x52')](handleError(_0x28b469,null));};exports[_0x542a('0xb5')]=function(_0x273f2f,_0x5346ab,_0x1cc0c9){return db[_0x542a('0x4a')][_0x542a('0x51')]({'where':{'id':_0x273f2f[_0x542a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5346ab,null))[_0x542a('0x28')](function(_0x5997c8){if(_0x5997c8){return _0x5997c8[_0x542a('0xb5')](_0x273f2f['query'][_0x542a('0x7c')]);}})['then'](function(_0x161cba){if(_0x161cba){return db[_0x542a('0x6b')]['destroy']({'where':{'ListId':_0x273f2f['query'][_0x542a('0x7c')],'VoiceQueueId':_0x273f2f[_0x542a('0x4f')]['id']}})['then'](function(){return _0x161cba;});}})['then'](respondWithStatusCode(_0x5346ab,null))['catch'](handleError(_0x5346ab,null));}; \ No newline at end of file +var _0x0d86=['removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','mustache','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','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','VoiceQueues','inbound','QueueCampaigns','filter','ignore','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','merge','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','outbound','autoAssociation','getHoppers','findOne','CmHopper','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','User','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','each','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','voicePause','isArray','getAgents','getMembers','CmList','getLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','ContactId','ListId','select','phone','scheduledAt','CmListId','toString','NOW()','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','phone\x20NOT\x20IN\x20(?)','onlyIfOpen','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(phone,\x27\x27)','into'];(function(_0x1eab75,_0x2d0dd4){var _0x5a48c8=function(_0x7d9cc0){while(--_0x7d9cc0){_0x1eab75['push'](_0x1eab75['shift']());}};_0x5a48c8(++_0x2d0dd4);}(_0x0d86,0x17b));var _0x60d8=function(_0x10c89e,_0x457e5e){_0x10c89e=_0x10c89e-0x0;var _0xe328a1=_0x0d86[_0x10c89e];return _0xe328a1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x60d8('0x0'));var rimraf=require(_0x60d8('0x1'));var zipdir=require(_0x60d8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x60d8('0x3'));var moment=require(_0x60d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x60d8('0x5'));var util=require('util');var path=require(_0x60d8('0x6'));var sox=require(_0x60d8('0x7'));var csv=require(_0x60d8('0x8'));var ejs=require(_0x60d8('0x9'));var fs=require('fs');var _=require(_0x60d8('0xa'));var squel=require(_0x60d8('0xb'));var crypto=require('crypto');var jsforce=require(_0x60d8('0xc'));var deskjs=require(_0x60d8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x60d8('0xe'));var Papa=require(_0x60d8('0xf'));var Redis=require(_0x60d8('0x10'));var authService=require(_0x60d8('0x11'));var qs=require(_0x60d8('0x12'));var as=require(_0x60d8('0x13'));var hardwareService=require(_0x60d8('0x14'));var logger=require(_0x60d8('0x15'))('api');var utils=require(_0x60d8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x60d8('0x17'));var db=require(_0x60d8('0x18'))['db'];config[_0x60d8('0x19')]=_['defaults'](config[_0x60d8('0x19')],{'host':_0x60d8('0x1a'),'port':0x18eb});var socket=require(_0x60d8('0x1b'))(new Redis(config[_0x60d8('0x19')]));require(_0x60d8('0x1c'))['register'](socket);function respondWithStatusCode(_0x448cde,_0x36a6d2){_0x36a6d2=_0x36a6d2||0xcc;return function(_0x5bba00){if(_0x5bba00){return _0x448cde[_0x60d8('0x1d')](_0x36a6d2);}return _0x448cde[_0x60d8('0x1e')](_0x36a6d2)[_0x60d8('0x1f')]();};}function respondWithResult(_0x5e8284,_0x5ad237){_0x5ad237=_0x5ad237||0xc8;return function(_0x2c5193){if(_0x2c5193){return _0x5e8284[_0x60d8('0x1e')](_0x5ad237)['json'](_0x2c5193);}};}function respondWithFilteredResult(_0x4618f8,_0x44fef4){return function(_0x469158){if(_0x469158){var _0x159694=_0x469158[_0x60d8('0x20')],_0x51ca23=_0x44fef4[_0x60d8('0x21')],_0x3eea5f=_0x44fef4[_0x60d8('0x21')]+_0x44fef4[_0x60d8('0x22')],_0x288ff9;if(_0x3eea5f>=_0x159694){_0x3eea5f=_0x159694;_0x288ff9=0xc8;}else{_0x288ff9=0xce;}_0x4618f8[_0x60d8('0x1e')](_0x288ff9);return _0x4618f8[_0x60d8('0x23')](_0x60d8('0x24'),_0x51ca23+'-'+_0x3eea5f+'/'+_0x159694)['json'](_0x469158);}return null;};}function patchUpdates(_0x579b60){return function(_0x5870b4){try{jsonpatch[_0x60d8('0x25')](_0x5870b4,_0x579b60,!![]);}catch(_0x17beee){return BPromise[_0x60d8('0x26')](_0x17beee);}return _0x5870b4['save']();};}function saveUpdates(_0xdc3d4f,_0x36cb66){return function(_0x579730){if(_0x579730){return _0x579730[_0x60d8('0x27')](_0xdc3d4f)['then'](function(_0x22cb17){return _0x22cb17;});}return null;};}function removeEntity(_0x19972a,_0xe13102){return function(_0x387d65){if(_0x387d65){return _0x387d65[_0x60d8('0x28')]()[_0x60d8('0x29')](function(){var _0x5cca40=_0x387d65['get']({'plain':!![]});var _0x503050=[{'name':_0x60d8('0x2a'),'value':_0x60d8('0x2b'),'ignore':![]},{'name':_0x60d8('0x2c'),'value':'outbound','ignore':![]}];var _0x55904b=_(_0x503050)[_0x60d8('0x2d')](_0x60d8('0x2e'))['map'](_0x60d8('0x2f'))[_0x60d8('0x2f')]();if(_[_0x60d8('0x30')](_0x55904b,_0x5cca40['type'])){return;}var _0x3f8fc1=_['find'](_0x503050,[_0x60d8('0x2f'),_0x5cca40[_0x60d8('0x31')]])[_0x60d8('0x32')];return db[_0x60d8('0x33')][_0x60d8('0x28')]({'where':{'type':_0x3f8fc1,'resourceId':_0x5cca40['id']}})[_0x60d8('0x29')](function(){return _0x387d65;});})[_0x60d8('0x29')](function(){_0x19972a[_0x60d8('0x1e')](0xcc)[_0x60d8('0x1f')]();});}};}function handleEntityNotFound(_0x4300a9,_0x2a9121){return function(_0x59c8cf){if(!_0x59c8cf){_0x4300a9[_0x60d8('0x1d')](0x194);}return _0x59c8cf;};}function handleError(_0x77e020,_0x47943e){_0x47943e=_0x47943e||0x1f4;return function(_0x463dec){logger[_0x60d8('0x34')](_0x463dec[_0x60d8('0x35')]);if(_0x463dec['name']){delete _0x463dec[_0x60d8('0x32')];}_0x77e020['status'](_0x47943e)[_0x60d8('0x36')](_0x463dec);};}exports[_0x60d8('0x37')]=function(_0x35da64,_0x54031e){var _0x31c46e={},_0x54f70c={},_0x392b28={'count':0x0,'rows':[]};var _0x1b2953=_['map'](db[_0x60d8('0x38')]['rawAttributes'],function(_0x4664c5){return{'name':_0x4664c5[_0x60d8('0x39')],'type':_0x4664c5[_0x60d8('0x31')][_0x60d8('0x3a')]};});_0x54f70c[_0x60d8('0x3b')]=_[_0x60d8('0x3c')](_0x1b2953,_0x60d8('0x32'));_0x54f70c[_0x60d8('0x3d')]=_[_0x60d8('0x3e')](_0x35da64[_0x60d8('0x3d')]);_0x54f70c[_0x60d8('0x3f')]=_[_0x60d8('0x40')](_0x54f70c[_0x60d8('0x3b')],_0x54f70c[_0x60d8('0x3d')]);_0x31c46e[_0x60d8('0x41')]=_[_0x60d8('0x40')](_0x54f70c['model'],qs[_0x60d8('0x42')](_0x35da64[_0x60d8('0x3d')]['fields']));_0x31c46e[_0x60d8('0x41')]=_0x31c46e[_0x60d8('0x41')][_0x60d8('0x43')]?_0x31c46e[_0x60d8('0x41')]:_0x54f70c[_0x60d8('0x3b')];if(!_0x35da64[_0x60d8('0x3d')][_0x60d8('0x44')](_0x60d8('0x45'))){_0x31c46e[_0x60d8('0x22')]=qs['limit'](_0x35da64[_0x60d8('0x3d')][_0x60d8('0x22')]);_0x31c46e[_0x60d8('0x21')]=qs['offset'](_0x35da64['query'][_0x60d8('0x21')]);}_0x31c46e[_0x60d8('0x46')]=qs[_0x60d8('0x47')](_0x35da64[_0x60d8('0x3d')][_0x60d8('0x47')]);_0x31c46e[_0x60d8('0x48')]=qs[_0x60d8('0x3f')](_[_0x60d8('0x49')](_0x35da64[_0x60d8('0x3d')],_0x54f70c[_0x60d8('0x3f')]),_0x1b2953);if(_0x35da64[_0x60d8('0x3d')][_0x60d8('0x2d')]){_0x31c46e[_0x60d8('0x48')]=_['merge'](_0x31c46e[_0x60d8('0x48')],{'$or':_['map'](_0x1b2953,function(_0x367a9b){if(_0x367a9b['type']!==_0x60d8('0x4a')){var _0x348df6={};_0x348df6[_0x367a9b[_0x60d8('0x32')]]={'$like':'%'+_0x35da64[_0x60d8('0x3d')][_0x60d8('0x2d')]+'%'};return _0x348df6;}})});}_0x31c46e=_['merge']({},_0x31c46e,_0x35da64[_0x60d8('0x4b')]);var _0x29b801={'where':_0x31c46e[_0x60d8('0x48')]};return db[_0x60d8('0x38')]['count'](_0x29b801)[_0x60d8('0x29')](function(_0x216039){_0x392b28[_0x60d8('0x20')]=_0x216039;if(_0x35da64[_0x60d8('0x3d')][_0x60d8('0x4c')]){_0x31c46e[_0x60d8('0x4d')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x31c46e);})['then'](function(_0x2a56cb){_0x392b28[_0x60d8('0x4e')]=_0x2a56cb;return _0x392b28;})['then'](respondWithFilteredResult(_0x54031e,_0x31c46e))['catch'](handleError(_0x54031e,null));};exports[_0x60d8('0x4f')]=function(_0x18fdb4,_0x5bb6aa){var _0x1861ae={'raw':![],'where':{'id':_0x18fdb4[_0x60d8('0x50')]['id']}},_0x1552c6={};_0x1552c6['model']=_[_0x60d8('0x3e')](db[_0x60d8('0x38')][_0x60d8('0x51')]);_0x1552c6[_0x60d8('0x3d')]=_['keys'](_0x18fdb4[_0x60d8('0x3d')]);_0x1552c6[_0x60d8('0x3f')]=_[_0x60d8('0x40')](_0x1552c6['model'],_0x1552c6['query']);_0x1861ae[_0x60d8('0x41')]=_[_0x60d8('0x40')](_0x1552c6[_0x60d8('0x3b')],qs[_0x60d8('0x42')](_0x18fdb4[_0x60d8('0x3d')]['fields']));_0x1861ae[_0x60d8('0x41')]=_0x1861ae[_0x60d8('0x41')][_0x60d8('0x43')]?_0x1861ae[_0x60d8('0x41')]:_0x1552c6[_0x60d8('0x3b')];if(_0x18fdb4['query'][_0x60d8('0x4c')]){_0x1861ae['include']=[{'all':!![]}];}_0x1861ae=_[_0x60d8('0x52')]({},_0x1861ae,_0x18fdb4['options']);return db[_0x60d8('0x38')][_0x60d8('0x53')](_0x1861ae)[_0x60d8('0x29')](handleEntityNotFound(_0x5bb6aa,null))[_0x60d8('0x29')](respondWithResult(_0x5bb6aa,null))[_0x60d8('0x54')](handleError(_0x5bb6aa,null));};exports['create']=function(_0x16d50a,_0x41c580){return db[_0x60d8('0x38')][_0x60d8('0x55')](_0x16d50a['body'],{})[_0x60d8('0x29')](function(_0x246b16){var _0x11f9d1=_0x16d50a[_0x60d8('0x56')]['get']({'plain':!![]});if(!_0x11f9d1)throw new Error(_0x60d8('0x57'));if(_0x11f9d1[_0x60d8('0x58')]===_0x60d8('0x56')){var _0xf08b0a=_0x246b16[_0x60d8('0x59')]({'plain':!![]});var _0x476a39=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x60d8('0x2c'),'value':'outbound'}];var _0xfe1bc=_['find'](_0x476a39,[_0x60d8('0x2f'),_0xf08b0a[_0x60d8('0x31')]])['name'];return db[_0x60d8('0x5a')][_0x60d8('0x53')]({'where':{'name':_0xfe1bc,'userProfileId':_0x11f9d1[_0x60d8('0x5b')]},'raw':!![]})[_0x60d8('0x29')](function(_0x4e923a){if(_0x4e923a&&_0x4e923a['autoAssociation']===0x0){return db[_0x60d8('0x33')][_0x60d8('0x55')]({'name':_0xf08b0a['name'],'resourceId':_0xf08b0a['id'],'type':_0x4e923a[_0x60d8('0x32')],'sectionId':_0x4e923a['id']},{})[_0x60d8('0x29')](function(){return _0x246b16;});}else{return _0x246b16;}})[_0x60d8('0x54')](function(_0x5795b3){logger['error'](_0x60d8('0x5c'),_0x5795b3);throw _0x5795b3;});}return _0x246b16;})[_0x60d8('0x29')](respondWithResult(_0x41c580,0xc9))[_0x60d8('0x54')](handleError(_0x41c580,null));};exports['clone']=function(_0xc26109,_0x4f1567){var _0x3b51e2={'where':{'id':_0xc26109[_0x60d8('0x50')]['id']}},_0x167e2e={};_0x167e2e['model']=_[_0x60d8('0x3e')](db[_0x60d8('0x38')][_0x60d8('0x51')]);_0x3b51e2[_0x60d8('0x41')]=_[_0x60d8('0x40')](_0x167e2e[_0x60d8('0x3b')],qs[_0x60d8('0x42')](_0xc26109[_0x60d8('0x3d')][_0x60d8('0x42')]));_0x3b51e2[_0x60d8('0x41')]=_0x3b51e2[_0x60d8('0x41')][_0x60d8('0x43')]?_0x3b51e2['attributes']:_0x167e2e['model'];if(_0xc26109[_0x60d8('0x3d')][_0x60d8('0x4c')]){_0x3b51e2[_0x60d8('0x4d')]=[{'all':!![]}];}_0x3b51e2=_['merge']({},_0x3b51e2,_0xc26109['options']);return db[_0x60d8('0x38')]['find'](_0x3b51e2)[_0x60d8('0x29')](handleEntityNotFound(_0x4f1567,null))[_0x60d8('0x29')](function(_0x22a5eb){if(_0x22a5eb){var _0x23b5a4=_0x22a5eb[_0x60d8('0x59')]({'plain':!![]});_0x23b5a4=qs[_0x60d8('0x5d')](_0x23b5a4,['id',_0x60d8('0x5e'),_0x60d8('0x5f')]);_0xc26109[_0x60d8('0x60')]=_[_0x60d8('0x5d')](_0xc26109[_0x60d8('0x60')],['id','createdAt','updatedAt']);return db['VoiceQueue'][_0x60d8('0x55')](_[_0x60d8('0x52')](_0x23b5a4,_0xc26109[_0x60d8('0x60')]),{'include':_0xc26109[_0x60d8('0x3d')][_0x60d8('0x4c')]?[{'all':!![]}]:undefined})[_0x60d8('0x29')](function(_0x5a3bf0){var _0x10be8e=_0xc26109[_0x60d8('0x56')]['get']({'plain':!![]});if(!_0x10be8e)throw new Error(_0x60d8('0x57'));if(_0x10be8e[_0x60d8('0x58')]===_0x60d8('0x56')){var _0x359664=_0x5a3bf0[_0x60d8('0x59')]({'plain':!![]});var _0xcd5063=[{'name':_0x60d8('0x2a'),'value':_0x60d8('0x2b')},{'name':_0x60d8('0x2c'),'value':_0x60d8('0x61')}];var _0x3b0098=_[_0x60d8('0x53')](_0xcd5063,[_0x60d8('0x2f'),_0x359664[_0x60d8('0x31')]])[_0x60d8('0x32')];return db[_0x60d8('0x5a')][_0x60d8('0x53')]({'where':{'name':_0x3b0098,'userProfileId':_0x10be8e['userProfileId']},'raw':!![]})['then'](function(_0x49a766){if(_0x49a766&&_0x49a766[_0x60d8('0x62')]===0x0){return db[_0x60d8('0x33')][_0x60d8('0x55')]({'name':_0x359664['name'],'resourceId':_0x359664['id'],'type':_0x49a766[_0x60d8('0x32')],'sectionId':_0x49a766['id']},{})[_0x60d8('0x29')](function(){return _0x5a3bf0;});}else{return _0x5a3bf0;}})['catch'](function(_0x316a70){logger['error'](_0x60d8('0x5c'),_0x316a70);throw _0x316a70;});}return _0x5a3bf0;});}})['then'](respondWithResult(_0x4f1567,0xc9))[_0x60d8('0x54')](handleError(_0x4f1567,null));};exports[_0x60d8('0x27')]=function(_0xab5847,_0x49e582){if(_0xab5847[_0x60d8('0x60')]['id']){delete _0xab5847['body']['id'];}return db['VoiceQueue'][_0x60d8('0x53')]({'where':{'id':_0xab5847[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x49e582,null))[_0x60d8('0x29')](saveUpdates(_0xab5847['body'],null))[_0x60d8('0x29')](respondWithResult(_0x49e582,null))[_0x60d8('0x54')](handleError(_0x49e582,null));};exports['destroy']=function(_0x46dd28,_0x3f19e5){return db['VoiceQueue']['find']({'where':{'id':_0x46dd28[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x3f19e5,null))[_0x60d8('0x29')](removeEntity(_0x3f19e5,null))[_0x60d8('0x54')](handleError(_0x3f19e5,null));};exports[_0x60d8('0x63')]=function(_0x8439ff,_0x57b8ae,_0x36c690){var _0x233995={'raw':![],'where':{}};var _0x4230ac={};var _0x1aa6ac={'count':0x0,'rows':[]};return db[_0x60d8('0x38')][_0x60d8('0x64')]({'where':{'id':_0x8439ff['params']['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x57b8ae,null))[_0x60d8('0x29')](function(_0x406202){if(_0x406202){_0x4230ac[_0x60d8('0x3b')]=_[_0x60d8('0x3e')](db[_0x60d8('0x65')][_0x60d8('0x51')]);_0x4230ac[_0x60d8('0x3d')]=_[_0x60d8('0x3e')](_0x8439ff[_0x60d8('0x3d')]);_0x4230ac[_0x60d8('0x3f')]=_['intersection'](_0x4230ac[_0x60d8('0x3b')],_0x4230ac[_0x60d8('0x3d')]);_0x233995[_0x60d8('0x41')]=_['intersection'](_0x4230ac[_0x60d8('0x3b')],qs[_0x60d8('0x42')](_0x8439ff[_0x60d8('0x3d')][_0x60d8('0x42')]));_0x233995[_0x60d8('0x41')]=_0x233995[_0x60d8('0x41')][_0x60d8('0x43')]?_0x233995[_0x60d8('0x41')]:_0x4230ac[_0x60d8('0x3b')];if(!_0x8439ff[_0x60d8('0x3d')][_0x60d8('0x44')](_0x60d8('0x45'))){_0x233995[_0x60d8('0x22')]=qs[_0x60d8('0x22')](_0x8439ff[_0x60d8('0x3d')][_0x60d8('0x22')]);_0x233995[_0x60d8('0x21')]=qs['offset'](_0x8439ff[_0x60d8('0x3d')]['offset']);}_0x233995[_0x60d8('0x46')]=qs[_0x60d8('0x47')](_0x8439ff[_0x60d8('0x3d')]['sort']);_0x233995[_0x60d8('0x48')]=qs[_0x60d8('0x3f')](_[_0x60d8('0x49')](_0x8439ff['query'],_0x4230ac[_0x60d8('0x3f')]));_0x233995[_0x60d8('0x48')][_0x60d8('0x66')]=_0x406202['id'];if(_0x8439ff['query']['filter']){_0x233995[_0x60d8('0x48')]=_[_0x60d8('0x52')](_0x233995[_0x60d8('0x48')],{'$or':_[_0x60d8('0x3c')](_0x233995[_0x60d8('0x41')],function(_0x46da1f){var _0x131ced={};_0x131ced[_0x46da1f]={'$like':'%'+_0x8439ff[_0x60d8('0x3d')]['filter']+'%'};return _0x131ced;})});}_0x233995=_['merge']({},_0x233995,_0x8439ff['options']);return db[_0x60d8('0x65')][_0x60d8('0x20')]({'where':_0x233995['where']})[_0x60d8('0x29')](function(_0x53d873){_0x1aa6ac[_0x60d8('0x20')]=_0x53d873;if(_0x8439ff[_0x60d8('0x3d')]['includeAll']){_0x233995[_0x60d8('0x4d')]=[{'all':!![]}];}return db['CmHopper'][_0x60d8('0x67')](_0x233995);})[_0x60d8('0x29')](function(_0x231e97){_0x1aa6ac[_0x60d8('0x4e')]=_0x231e97;return _0x1aa6ac;});}})['then'](respondWithFilteredResult(_0x57b8ae,_0x233995))[_0x60d8('0x54')](handleError(_0x57b8ae,null));};exports[_0x60d8('0x68')]=function(_0x18dc5a,_0x4eaa10,_0x4e1b53){var _0x4709f1={'raw':!![],'where':{}};var _0x534e43={};var _0x42894f={'count':0x0,'rows':[]};return db[_0x60d8('0x38')][_0x60d8('0x64')]({'where':{'id':_0x18dc5a[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x4eaa10,null))[_0x60d8('0x29')](function(_0xf064b2){if(_0xf064b2){_0x534e43[_0x60d8('0x3b')]=_['keys'](db[_0x60d8('0x69')][_0x60d8('0x51')]);_0x534e43[_0x60d8('0x3d')]=_[_0x60d8('0x3e')](_0x18dc5a[_0x60d8('0x3d')]);_0x534e43[_0x60d8('0x3f')]=_[_0x60d8('0x40')](_0x534e43[_0x60d8('0x3b')],_0x534e43['query']);_0x4709f1[_0x60d8('0x41')]=_[_0x60d8('0x40')](_0x534e43['model'],qs['fields'](_0x18dc5a[_0x60d8('0x3d')][_0x60d8('0x42')]));_0x4709f1[_0x60d8('0x41')]=_0x4709f1[_0x60d8('0x41')][_0x60d8('0x43')]?_0x4709f1[_0x60d8('0x41')]:_0x534e43[_0x60d8('0x3b')];if(!_0x18dc5a['query'][_0x60d8('0x44')](_0x60d8('0x45'))){_0x4709f1[_0x60d8('0x22')]=qs[_0x60d8('0x22')](_0x18dc5a[_0x60d8('0x3d')][_0x60d8('0x22')]);_0x4709f1[_0x60d8('0x21')]=qs[_0x60d8('0x21')](_0x18dc5a[_0x60d8('0x3d')]['offset']);}_0x4709f1[_0x60d8('0x46')]=qs[_0x60d8('0x47')](_0x18dc5a[_0x60d8('0x3d')][_0x60d8('0x47')]);_0x4709f1[_0x60d8('0x48')]=qs['filters'](_[_0x60d8('0x49')](_0x18dc5a[_0x60d8('0x3d')],_0x534e43[_0x60d8('0x3f')]));_0x4709f1[_0x60d8('0x48')][_0x60d8('0x66')]=_0xf064b2['id'];if(_0x18dc5a[_0x60d8('0x3d')][_0x60d8('0x2d')]){_0x4709f1['where']=_['merge'](_0x4709f1[_0x60d8('0x48')],{'$or':_[_0x60d8('0x3c')](_0x4709f1[_0x60d8('0x41')],function(_0x33b518){var _0x81671c={};_0x81671c[_0x33b518]={'$like':'%'+_0x18dc5a['query'][_0x60d8('0x2d')]+'%'};return _0x81671c;})});}_0x4709f1=_[_0x60d8('0x52')]({},_0x4709f1,_0x18dc5a[_0x60d8('0x4b')]);return db['CmHopperHistory'][_0x60d8('0x20')]({'where':_0x4709f1['where']})['then'](function(_0x2fbf82){_0x42894f[_0x60d8('0x20')]=_0x2fbf82;if(_0x18dc5a['query'][_0x60d8('0x4c')]){_0x4709f1[_0x60d8('0x4d')]=[{'all':!![]}];}return db[_0x60d8('0x69')][_0x60d8('0x67')](_0x4709f1);})[_0x60d8('0x29')](function(_0x469060){_0x42894f[_0x60d8('0x4e')]=_0x469060;return _0x42894f;});}})['then'](respondWithFilteredResult(_0x4eaa10,_0x4709f1))[_0x60d8('0x54')](handleError(_0x4eaa10,null));};exports[_0x60d8('0x6a')]=function(_0x12518c,_0x32d604,_0x4eef42){var _0x1c5455={'raw':!![],'where':{}};var _0x3b5ad0={};var _0x558633={'count':0x0,'rows':[]};return db[_0x60d8('0x38')][_0x60d8('0x64')]({'where':{'id':_0x12518c['params']['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x32d604,null))[_0x60d8('0x29')](function(_0x3eccfd){if(_0x3eccfd){_0x3b5ad0['model']=_[_0x60d8('0x3e')](db[_0x60d8('0x6b')][_0x60d8('0x51')]);_0x3b5ad0[_0x60d8('0x3d')]=_['keys'](_0x12518c[_0x60d8('0x3d')]);_0x3b5ad0['filters']=_['intersection'](_0x3b5ad0[_0x60d8('0x3b')],_0x3b5ad0['query']);_0x1c5455[_0x60d8('0x41')]=_[_0x60d8('0x40')](_0x3b5ad0[_0x60d8('0x3b')],qs[_0x60d8('0x42')](_0x12518c[_0x60d8('0x3d')][_0x60d8('0x42')]));_0x1c5455[_0x60d8('0x41')]=_0x1c5455[_0x60d8('0x41')]['length']?_0x1c5455['attributes']:_0x3b5ad0[_0x60d8('0x3b')];if(!_0x12518c['query']['hasOwnProperty'](_0x60d8('0x45'))){_0x1c5455['limit']=qs[_0x60d8('0x22')](_0x12518c[_0x60d8('0x3d')][_0x60d8('0x22')]);_0x1c5455[_0x60d8('0x21')]=qs[_0x60d8('0x21')](_0x12518c[_0x60d8('0x3d')][_0x60d8('0x21')]);}_0x1c5455[_0x60d8('0x46')]=qs[_0x60d8('0x47')](_0x12518c[_0x60d8('0x3d')][_0x60d8('0x47')]);_0x1c5455[_0x60d8('0x48')]=qs[_0x60d8('0x3f')](_['pick'](_0x12518c[_0x60d8('0x3d')],_0x3b5ad0[_0x60d8('0x3f')]));_0x1c5455[_0x60d8('0x48')][_0x60d8('0x66')]=_0x3eccfd['id'];if(_0x12518c['query'][_0x60d8('0x2d')]){_0x1c5455['where']=_[_0x60d8('0x52')](_0x1c5455[_0x60d8('0x48')],{'$or':_['map'](_0x1c5455[_0x60d8('0x41')],function(_0x3c94dd){var _0x500907={};_0x500907[_0x3c94dd]={'$like':'%'+_0x12518c['query']['filter']+'%'};return _0x500907;})});}_0x1c5455=_[_0x60d8('0x52')]({},_0x1c5455,_0x12518c[_0x60d8('0x4b')]);return db[_0x60d8('0x6b')][_0x60d8('0x20')]({'where':_0x1c5455[_0x60d8('0x48')]})['then'](function(_0x38e4d5){_0x558633[_0x60d8('0x20')]=_0x38e4d5;if(_0x12518c[_0x60d8('0x3d')][_0x60d8('0x4c')]){_0x1c5455['include']=[{'all':!![]}];}return db[_0x60d8('0x6b')][_0x60d8('0x67')](_0x1c5455);})[_0x60d8('0x29')](function(_0x1293f1){_0x558633[_0x60d8('0x4e')]=_0x1293f1;return _0x558633;});}})['then'](respondWithFilteredResult(_0x32d604,_0x1c5455))[_0x60d8('0x54')](handleError(_0x32d604,null));};exports[_0x60d8('0x6c')]=function(_0x31aa95,_0x3baf63,_0x3030e){var _0x5738f7={'raw':!![],'where':{}};var _0x3aa741={};var _0x6d4e90={'count':0x0,'rows':[]};return db[_0x60d8('0x38')][_0x60d8('0x64')]({'where':{'id':_0x31aa95[_0x60d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x3baf63,null))[_0x60d8('0x29')](function(_0x2c0c8b){if(_0x2c0c8b){_0x3aa741[_0x60d8('0x3b')]=_[_0x60d8('0x3e')](db[_0x60d8('0x6d')][_0x60d8('0x51')]);_0x3aa741[_0x60d8('0x3d')]=_[_0x60d8('0x3e')](_0x31aa95[_0x60d8('0x3d')]);_0x3aa741[_0x60d8('0x3f')]=_[_0x60d8('0x40')](_0x3aa741[_0x60d8('0x3b')],_0x3aa741[_0x60d8('0x3d')]);_0x5738f7[_0x60d8('0x41')]=_['intersection'](_0x3aa741[_0x60d8('0x3b')],qs[_0x60d8('0x42')](_0x31aa95[_0x60d8('0x3d')]['fields']));_0x5738f7[_0x60d8('0x41')]=_0x5738f7['attributes'][_0x60d8('0x43')]?_0x5738f7[_0x60d8('0x41')]:_0x3aa741['model'];if(!_0x31aa95[_0x60d8('0x3d')][_0x60d8('0x44')](_0x60d8('0x45'))){_0x5738f7[_0x60d8('0x22')]=qs['limit'](_0x31aa95['query']['limit']);_0x5738f7[_0x60d8('0x21')]=qs['offset'](_0x31aa95[_0x60d8('0x3d')][_0x60d8('0x21')]);}_0x5738f7[_0x60d8('0x46')]=qs[_0x60d8('0x47')](_0x31aa95['query']['sort']);_0x5738f7[_0x60d8('0x48')]=qs[_0x60d8('0x3f')](_[_0x60d8('0x49')](_0x31aa95[_0x60d8('0x3d')],_0x3aa741[_0x60d8('0x3f')]));_0x5738f7[_0x60d8('0x48')][_0x60d8('0x66')]=_0x2c0c8b['id'];if(_0x31aa95[_0x60d8('0x3d')][_0x60d8('0x2d')]){_0x5738f7[_0x60d8('0x48')]=_[_0x60d8('0x52')](_0x5738f7[_0x60d8('0x48')],{'$or':_[_0x60d8('0x3c')](_0x5738f7[_0x60d8('0x41')],function(_0xd0061f){var _0x4bba22={};_0x4bba22[_0xd0061f]={'$like':'%'+_0x31aa95[_0x60d8('0x3d')][_0x60d8('0x2d')]+'%'};return _0x4bba22;})});}_0x5738f7=_['merge']({},_0x5738f7,_0x31aa95['options']);return db['CmHopperBlack'][_0x60d8('0x20')]({'where':_0x5738f7[_0x60d8('0x48')]})[_0x60d8('0x29')](function(_0x15613f){_0x6d4e90[_0x60d8('0x20')]=_0x15613f;if(_0x31aa95[_0x60d8('0x3d')]['includeAll']){_0x5738f7[_0x60d8('0x4d')]=[{'all':!![]}];}return db[_0x60d8('0x6d')][_0x60d8('0x67')](_0x5738f7);})[_0x60d8('0x29')](function(_0x16b01c){_0x6d4e90[_0x60d8('0x4e')]=_0x16b01c;return _0x6d4e90;});}})[_0x60d8('0x29')](respondWithFilteredResult(_0x3baf63,_0x5738f7))['catch'](handleError(_0x3baf63,null));};exports[_0x60d8('0x6e')]=function(_0x24233b,_0x595fab,_0x111565){var _0x370d6b={};var _0x13f3bd={};var _0x14a813;var _0x2509ce;return db[_0x60d8('0x38')][_0x60d8('0x64')]({'where':{'id':_0x24233b[_0x60d8('0x50')]['id']}})['then'](handleEntityNotFound(_0x595fab,null))[_0x60d8('0x29')](function(_0x4c0f9c){if(_0x4c0f9c){_0x14a813=_0x4c0f9c;_0x13f3bd[_0x60d8('0x3b')]=_[_0x60d8('0x3e')](db[_0x60d8('0x6f')]['rawAttributes']);_0x13f3bd['query']=_[_0x60d8('0x3e')](_0x24233b['query']);_0x13f3bd[_0x60d8('0x3f')]=_['intersection'](_0x13f3bd['model'],_0x13f3bd[_0x60d8('0x3d')]);_0x370d6b[_0x60d8('0x41')]=_[_0x60d8('0x40')](_0x13f3bd[_0x60d8('0x3b')],qs[_0x60d8('0x42')](_0x24233b['query'][_0x60d8('0x42')]));_0x370d6b['attributes']=_0x370d6b[_0x60d8('0x41')][_0x60d8('0x43')]?_0x370d6b['attributes']:_0x13f3bd['model'];_0x370d6b[_0x60d8('0x46')]=qs['sort'](_0x24233b[_0x60d8('0x3d')][_0x60d8('0x47')]);_0x370d6b['where']=qs['filters'](_['pick'](_0x24233b[_0x60d8('0x3d')],_0x13f3bd[_0x60d8('0x3f')]));if(_0x24233b[_0x60d8('0x3d')][_0x60d8('0x2d')]){_0x370d6b[_0x60d8('0x48')]=_['merge'](_0x370d6b[_0x60d8('0x48')],{'$or':_[_0x60d8('0x3c')](_0x370d6b['attributes'],function(_0x37e20b){var _0x4de537={};_0x4de537[_0x37e20b]={'$like':'%'+_0x24233b[_0x60d8('0x3d')][_0x60d8('0x2d')]+'%'};return _0x4de537;})});}_0x370d6b=_['merge']({},_0x370d6b,_0x24233b['options']);return _0x14a813[_0x60d8('0x6e')](_0x370d6b);}})[_0x60d8('0x29')](function(_0x42e884){if(_0x42e884){_0x2509ce=_0x42e884[_0x60d8('0x43')];if(!_0x24233b[_0x60d8('0x3d')][_0x60d8('0x44')](_0x60d8('0x45'))){_0x370d6b[_0x60d8('0x22')]=qs[_0x60d8('0x22')](_0x24233b[_0x60d8('0x3d')]['limit']);_0x370d6b[_0x60d8('0x21')]=qs[_0x60d8('0x21')](_0x24233b[_0x60d8('0x3d')]['offset']);}return _0x14a813[_0x60d8('0x6e')](_0x370d6b);}})[_0x60d8('0x29')](function(_0x24d37c){if(_0x24d37c){return _0x24d37c?{'count':_0x2509ce,'rows':_0x24d37c}:null;}})[_0x60d8('0x29')](respondWithResult(_0x595fab,null))[_0x60d8('0x54')](handleError(_0x595fab,null));};exports['addTeams']=function(_0xd55df7,_0x3b28de,_0x207955){var _0x5783e3=_0xd55df7[_0x60d8('0x60')][_0x60d8('0x70')];var _0x488d18=_[_0x60d8('0x3c')](_0x5783e3,'id');return db[_0x60d8('0x6f')]['findAll']({'where':{'id':_0x488d18},'attributes':['id'],'include':[{'model':db[_0x60d8('0x71')],'as':_0x60d8('0x72'),'attributes':['id','name',_0x60d8('0x73'),'voicePause',_0x60d8('0x74')],'raw':!![]}]})[_0x60d8('0x29')](function(_0x29bf9c){if(_0x29bf9c){var _0x5815ed=_[_0x60d8('0x75')](_0x29bf9c,function(_0x38b8ef){var _0x8fa729=_0x38b8ef[_0x60d8('0x59')]({'plain':!![]});_0x8fa729[_0x60d8('0x72')][_0x60d8('0x76')](function(_0x9c6c57){_0x9c6c57['penalty']=_[_0x60d8('0x53')](_0x5783e3,{'id':_0x8fa729['id']})[_0x60d8('0x77')];});return _0x8fa729['Agents'];});return db[_0x60d8('0x38')][_0x60d8('0x53')]({'where':{'id':_0xd55df7[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](function(_0x469417){return db[_0x60d8('0x78')][_0x60d8('0x79')](function(_0x5f51de){return _0x469417['addTeams'](_0x488d18,{'transaction':_0x5f51de})[_0x60d8('0x29')](function(){return BPromise[_0x60d8('0x7a')](_0x5815ed,function(_0x31df6a){return db['UserVoiceQueue'][_0x60d8('0x7b')]({'where':{'UserId':_0x31df6a['id'],'VoiceQueueId':_0xd55df7[_0x60d8('0x50')]['id']},'defaults':{'penalty':_0x31df6a['penalty']},'transaction':_0x5f51de});});})['then'](function(){return BPromise['each'](_['filter'](_0x5815ed,{'online':!![]}),function(_0x34ad3a){return db[_0x60d8('0x7c')][_0x60d8('0x7d')]({'membername':_0x34ad3a[_0x60d8('0x32')],'UserId':_0x34ad3a['id'],'queue_name':_0x469417[_0x60d8('0x32')],'VoiceQueueId':_0x469417['id'],'interface':_[_0x60d8('0x7e')](_0x34ad3a[_0x60d8('0x74')])?util[_0x60d8('0x7f')](_0x60d8('0x80'),_0x34ad3a['name']):_0x34ad3a['interface'],'paused':_0x34ad3a['voicePause']||![],'penalty':_0x34ad3a[_0x60d8('0x77')]},{'transaction':_0x5f51de});});})[_0x60d8('0x29')](function(){_0x5815ed[_0x60d8('0x76')](function(_0x5450b1){socket[_0x60d8('0x81')](_0x60d8('0x82'),{'UserId':_0x5450b1['id'],'VoiceQueueId':_0x469417['id']});});});});});}})[_0x60d8('0x29')](respondWithStatusCode(_0x3b28de,null))[_0x60d8('0x54')](handleError(_0x3b28de,null));};exports[_0x60d8('0x83')]=function(_0x3e046a,_0x5a6cf9,_0x4712aa){return db[_0x60d8('0x6f')]['findAll']({'where':{'id':_0x3e046a[_0x60d8('0x3d')][_0x60d8('0x84')]},'attributes':['id'],'include':[{'model':db[_0x60d8('0x71')],'as':_0x60d8('0x72'),'attributes':['id'],'raw':!![]}]})[_0x60d8('0x29')](handleEntityNotFound(_0x5a6cf9,null))[_0x60d8('0x29')](function(_0x58cfb0){var _0x2bbf55=_[_0x60d8('0x3c')](_0x58cfb0,'id');var _0x4cc6ea=[];var _0x39dbf2=[];var _0x3cc60b=squel['select']();_0x3cc60b[_0x60d8('0x85')](_0x60d8('0x86'))[_0x60d8('0x87')](_0x60d8('0x88'),'tq')[_0x60d8('0x89')]('user_has_teams','ut',_0x60d8('0x8a'))[_0x60d8('0x48')](_0x60d8('0x8b'),_0x3e046a['params']['id']);for(var _0x16394d=0x0;_0x16394d<_0x58cfb0[_0x60d8('0x43')];_0x16394d+=0x1){let _0x670ed0=_0x58cfb0[_0x16394d];for(var _0x114da1=0x0;_0x114da1<_0x670ed0[_0x60d8('0x72')]['length'];_0x114da1+=0x1){let _0x590d03=_0x670ed0[_0x60d8('0x72')][_0x114da1];var _0x4d7fbd=_0x3cc60b[_0x60d8('0x8c')]();_0x4d7fbd[_0x60d8('0x48')](_0x60d8('0x8d'),_0x590d03['id']);_0x39dbf2[_0x60d8('0x8e')](db[_0x60d8('0x78')][_0x60d8('0x3d')](_0x4d7fbd['toString'](),{'type':db[_0x60d8('0x78')][_0x60d8('0x8f')][_0x60d8('0x90')]})[_0x60d8('0x29')](function(_0x546452){if(_0x546452[_0x60d8('0x43')]===0x1){return _0x590d03['id'];}else{var _0x436c52=_['every'](_[_0x60d8('0x3c')](_0x546452,_0x60d8('0x91')),function(_0x3e9704){return _[_0x60d8('0x30')](_0x2bbf55,_0x3e9704);});if(_0x436c52){return _0x590d03['id'];}}}));}}return BPromise[_0x60d8('0x92')](_0x39dbf2)[_0x60d8('0x29')](function(_0x447b5a){_0x4cc6ea=_(_0x4cc6ea)[_0x60d8('0x93')](_0x447b5a)[_0x60d8('0x94')]()[_0x60d8('0x2f')]();return db[_0x60d8('0x38')][_0x60d8('0x53')]({'where':{'id':_0x3e046a['params']['id']}})[_0x60d8('0x29')](function(_0x2e81de){return db[_0x60d8('0x78')][_0x60d8('0x79')](function(_0x34702){return _0x2e81de[_0x60d8('0x83')](_0x3e046a[_0x60d8('0x3d')][_0x60d8('0x84')],{'transaction':_0x34702})['then'](function(){if(!_[_0x60d8('0x95')](_0x4cc6ea)){return _0x2e81de[_0x60d8('0x96')](_0x4cc6ea,{'transaction':_0x34702})[_0x60d8('0x29')](function(){return db[_0x60d8('0x7c')][_0x60d8('0x28')]({'where':{'VoiceQueueId':_0x3e046a[_0x60d8('0x50')]['id'],'UserId':_0x4cc6ea},'transaction':_0x34702});});}})[_0x60d8('0x29')](function(){_0x4cc6ea[_0x60d8('0x76')](function(_0x4ccd9e){socket[_0x60d8('0x81')](_0x60d8('0x97'),{'UserId':_0x4ccd9e,'VoiceQueueId':_0x2e81de['id']});});});});});});})[_0x60d8('0x29')](respondWithStatusCode(_0x5a6cf9,null))[_0x60d8('0x54')](handleError(_0x5a6cf9,null));};exports['addAgents']=function(_0x35c878,_0x4c8e14,_0x448c75){var _0x423549,_0x28c0a5;return db[_0x60d8('0x38')][_0x60d8('0x53')]({'where':{'id':_0x35c878['params']['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x4c8e14,null))['then'](function(_0x48c35d){if(_0x48c35d){_0x28c0a5=_0x48c35d;return _0x48c35d[_0x60d8('0x98')](_0x35c878[_0x60d8('0x60')][_0x60d8('0x84')],_[_0x60d8('0x5d')](_0x35c878[_0x60d8('0x60')],[_0x60d8('0x84'),'id'])||{})[_0x60d8('0x99')](function(_0x278a96){for(var _0x4d4598=0x0;_0x4d4598<_0x35c878[_0x60d8('0x60')][_0x60d8('0x84')][_0x60d8('0x43')];_0x4d4598+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x35c878[_0x60d8('0x60')][_0x60d8('0x84')][_0x4d4598],'VoiceQueueId':_0x35c878[_0x60d8('0x50')]['id']});}return _0x278a96;});}})[_0x60d8('0x29')](function(_0x32958c){_0x423549=_0x32958c||[];if(_0x28c0a5){return db['User'][_0x60d8('0x67')]({'where':{'id':_0x35c878['body'][_0x60d8('0x84')]},'attributes':['id',_0x60d8('0x32'),_0x60d8('0x73'),_0x60d8('0x9a'),_0x60d8('0x74')],'raw':!![]});}})[_0x60d8('0x29')](function(_0x4be4fa){if(!_['isEmpty'](_0x4be4fa)){var _0x1ccb33=[];for(var _0x57e3aa=0x0;_0x57e3aa<_0x4be4fa['length'];_0x57e3aa++){if(_0x4be4fa[_0x57e3aa][_0x60d8('0x73')]){_0x1ccb33['push'](db[_0x60d8('0x7c')][_0x60d8('0x7d')]({'membername':_0x4be4fa[_0x57e3aa][_0x60d8('0x32')],'UserId':_0x4be4fa[_0x57e3aa]['id'],'queue_name':_0x28c0a5[_0x60d8('0x32')],'VoiceQueueId':_0x28c0a5['id'],'interface':_[_0x60d8('0x7e')](_0x4be4fa[_0x57e3aa][_0x60d8('0x74')])?util[_0x60d8('0x7f')]('SIP/%s',_0x4be4fa[_0x57e3aa][_0x60d8('0x32')]):_0x4be4fa[_0x57e3aa][_0x60d8('0x74')],'paused':_0x4be4fa[_0x57e3aa][_0x60d8('0x9a')]||![],'penalty':_0x35c878[_0x60d8('0x60')]['penalty']||0x0}));}}return BPromise['all'](_0x1ccb33);}})['then'](function(){return _0x423549;})[_0x60d8('0x29')](respondWithResult(_0x4c8e14,null))[_0x60d8('0x54')](handleError(_0x4c8e14,null));};exports[_0x60d8('0x96')]=function(_0x124baf,_0x1c3530,_0x4d91e3){return db[_0x60d8('0x38')][_0x60d8('0x53')]({'where':{'id':_0x124baf[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x1c3530,null))[_0x60d8('0x29')](function(_0x30f6a6){if(_0x30f6a6){return _0x30f6a6[_0x60d8('0x96')](_0x124baf[_0x60d8('0x3d')][_0x60d8('0x84')])[_0x60d8('0x29')](function(){if(_[_0x60d8('0x9b')](_0x124baf[_0x60d8('0x3d')][_0x60d8('0x84')])){for(var _0xf37c68=0x0;_0xf37c68<_0x124baf[_0x60d8('0x3d')][_0x60d8('0x84')][_0x60d8('0x43')];_0xf37c68+=0x1){socket[_0x60d8('0x81')](_0x60d8('0x97'),{'UserId':Number(_0x124baf[_0x60d8('0x3d')][_0x60d8('0x84')][_0xf37c68]),'VoiceQueueId':Number(_0x124baf[_0x60d8('0x50')]['id'])});}}else{socket[_0x60d8('0x81')](_0x60d8('0x97'),{'UserId':Number(_0x124baf[_0x60d8('0x3d')][_0x60d8('0x84')]),'VoiceQueueId':Number(_0x124baf[_0x60d8('0x50')]['id'])});}});}})[_0x60d8('0x29')](function(_0x16e032){return db[_0x60d8('0x7c')][_0x60d8('0x28')]({'where':{'VoiceQueueId':_0x124baf[_0x60d8('0x50')]['id'],'UserId':_0x124baf['query'][_0x60d8('0x84')]}})['then'](function(){return _0x16e032;});})[_0x60d8('0x29')](respondWithStatusCode(_0x1c3530,null))[_0x60d8('0x54')](handleError(_0x1c3530,null));};exports['getAgents']=function(_0x2e1d58,_0x1d5849,_0x49bdf9){var _0x430287={};var _0x1fcc7d={};var _0x2caf47;var _0x95daaa;return db[_0x60d8('0x38')][_0x60d8('0x64')]({'where':{'id':_0x2e1d58['params']['id']}})['then'](handleEntityNotFound(_0x1d5849,null))[_0x60d8('0x29')](function(_0x2f5531){if(_0x2f5531){_0x2caf47=_0x2f5531;_0x1fcc7d[_0x60d8('0x3b')]=_['keys'](db[_0x60d8('0x71')][_0x60d8('0x51')]);_0x1fcc7d[_0x60d8('0x3d')]=_[_0x60d8('0x3e')](_0x2e1d58[_0x60d8('0x3d')]);_0x1fcc7d[_0x60d8('0x3f')]=_[_0x60d8('0x40')](_0x1fcc7d[_0x60d8('0x3b')],_0x1fcc7d[_0x60d8('0x3d')]);_0x430287[_0x60d8('0x41')]=_[_0x60d8('0x40')](_0x1fcc7d[_0x60d8('0x3b')],qs['fields'](_0x2e1d58['query'][_0x60d8('0x42')]));_0x430287[_0x60d8('0x41')]=_0x430287['attributes'][_0x60d8('0x43')]?_0x430287[_0x60d8('0x41')]:_0x1fcc7d[_0x60d8('0x3b')];_0x430287[_0x60d8('0x46')]=qs[_0x60d8('0x47')](_0x2e1d58[_0x60d8('0x3d')]['sort']);_0x430287[_0x60d8('0x48')]=qs['filters'](_[_0x60d8('0x49')](_0x2e1d58[_0x60d8('0x3d')],_0x1fcc7d[_0x60d8('0x3f')]));if(_0x2e1d58['query'][_0x60d8('0x2d')]){_0x430287[_0x60d8('0x48')]=_[_0x60d8('0x52')](_0x430287[_0x60d8('0x48')],{'$or':_[_0x60d8('0x3c')](_0x430287[_0x60d8('0x41')],function(_0x4f19e0){var _0x196ec2={};_0x196ec2[_0x4f19e0]={'$like':'%'+_0x2e1d58[_0x60d8('0x3d')][_0x60d8('0x2d')]+'%'};return _0x196ec2;})});}_0x430287=_[_0x60d8('0x52')]({},_0x430287,_0x2e1d58['options']);return _0x2caf47[_0x60d8('0x9c')](_0x430287);}})[_0x60d8('0x29')](function(_0x4234cd){if(_0x4234cd){_0x95daaa=_0x4234cd[_0x60d8('0x43')];if(!_0x2e1d58['query'][_0x60d8('0x44')](_0x60d8('0x45'))){_0x430287[_0x60d8('0x22')]=qs[_0x60d8('0x22')](_0x2e1d58[_0x60d8('0x3d')][_0x60d8('0x22')]);_0x430287[_0x60d8('0x21')]=qs[_0x60d8('0x21')](_0x2e1d58['query']['offset']);}return _0x2caf47[_0x60d8('0x9c')](_0x430287);}})[_0x60d8('0x29')](function(_0x2d8090){if(_0x2d8090){return _0x2d8090?{'count':_0x95daaa,'rows':_0x2d8090}:null;}})[_0x60d8('0x29')](respondWithResult(_0x1d5849,null))[_0x60d8('0x54')](handleError(_0x1d5849,null));};exports[_0x60d8('0x9d')]=function(_0x36304e,_0xc0566e,_0x275fec){var _0xb80470={};var _0x40bf53={};var _0x5eb386;var _0x2da54f;return db[_0x60d8('0x38')][_0x60d8('0x64')]({'where':{'id':_0x36304e[_0x60d8('0x50')]['id']}})['then'](handleEntityNotFound(_0xc0566e,null))['then'](function(_0x111469){if(_0x111469){_0x5eb386=_0x111469;_0x40bf53[_0x60d8('0x3b')]=_['keys'](db[_0x60d8('0x7c')][_0x60d8('0x51')]);_0x40bf53[_0x60d8('0x3d')]=_[_0x60d8('0x3e')](_0x36304e[_0x60d8('0x3d')]);_0x40bf53[_0x60d8('0x3f')]=_['intersection'](_0x40bf53[_0x60d8('0x3b')],_0x40bf53['query']);_0xb80470[_0x60d8('0x41')]=_[_0x60d8('0x40')](_0x40bf53['model'],qs['fields'](_0x36304e[_0x60d8('0x3d')][_0x60d8('0x42')]));_0xb80470[_0x60d8('0x41')]=_0xb80470[_0x60d8('0x41')][_0x60d8('0x43')]?_0xb80470[_0x60d8('0x41')]:_0x40bf53[_0x60d8('0x3b')];_0xb80470[_0x60d8('0x46')]=qs[_0x60d8('0x47')](_0x36304e[_0x60d8('0x3d')]['sort']);_0xb80470[_0x60d8('0x48')]=qs[_0x60d8('0x3f')](_[_0x60d8('0x49')](_0x36304e[_0x60d8('0x3d')],_0x40bf53[_0x60d8('0x3f')]));if(_0x36304e[_0x60d8('0x3d')]['filter']){_0xb80470[_0x60d8('0x48')]=_['merge'](_0xb80470[_0x60d8('0x48')],{'$or':_[_0x60d8('0x3c')](_0xb80470[_0x60d8('0x41')],function(_0x41900b){var _0x1761e9={};_0x1761e9[_0x41900b]={'$like':'%'+_0x36304e[_0x60d8('0x3d')][_0x60d8('0x2d')]+'%'};return _0x1761e9;})});}_0xb80470=_[_0x60d8('0x52')]({},_0xb80470,_0x36304e[_0x60d8('0x4b')]);return _0x5eb386[_0x60d8('0x9d')](_0xb80470);}})['then'](function(_0x9960b6){if(_0x9960b6){_0x2da54f=_0x9960b6['length'];if(!_0x36304e['query'][_0x60d8('0x44')]('nolimit')){_0xb80470[_0x60d8('0x22')]=qs[_0x60d8('0x22')](_0x36304e[_0x60d8('0x3d')][_0x60d8('0x22')]);_0xb80470['offset']=qs[_0x60d8('0x21')](_0x36304e[_0x60d8('0x3d')][_0x60d8('0x21')]);}return _0x5eb386[_0x60d8('0x9d')](_0xb80470);}})[_0x60d8('0x29')](function(_0x1f422a){return _0x1f422a?{'count':_0x2da54f,'rows':_0x1f422a}:null;})[_0x60d8('0x29')](respondWithResult(_0xc0566e,null))[_0x60d8('0x54')](handleError(_0xc0566e,null));};exports['getLists']=function(_0x245b5a,_0x55cc91,_0x1e5995){var _0x3f9eb4={};var _0x15458c={};var _0x2f734b;var _0x502da8;return db[_0x60d8('0x38')][_0x60d8('0x64')]({'where':{'id':_0x245b5a[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x55cc91,null))['then'](function(_0x42f922){if(_0x42f922){_0x2f734b=_0x42f922;_0x15458c[_0x60d8('0x3b')]=_[_0x60d8('0x3e')](db[_0x60d8('0x9e')][_0x60d8('0x51')]);_0x15458c[_0x60d8('0x3d')]=_['keys'](_0x245b5a[_0x60d8('0x3d')]);_0x15458c[_0x60d8('0x3f')]=_['intersection'](_0x15458c[_0x60d8('0x3b')],_0x15458c[_0x60d8('0x3d')]);_0x3f9eb4[_0x60d8('0x41')]=_['intersection'](_0x15458c[_0x60d8('0x3b')],qs[_0x60d8('0x42')](_0x245b5a[_0x60d8('0x3d')][_0x60d8('0x42')]));_0x3f9eb4[_0x60d8('0x41')]=_0x3f9eb4[_0x60d8('0x41')][_0x60d8('0x43')]?_0x3f9eb4[_0x60d8('0x41')]:_0x15458c['model'];_0x3f9eb4[_0x60d8('0x46')]=qs[_0x60d8('0x47')](_0x245b5a[_0x60d8('0x3d')][_0x60d8('0x47')]);_0x3f9eb4[_0x60d8('0x48')]=qs[_0x60d8('0x3f')](_[_0x60d8('0x49')](_0x245b5a[_0x60d8('0x3d')],_0x15458c['filters']));if(_0x245b5a[_0x60d8('0x3d')][_0x60d8('0x2d')]){_0x3f9eb4[_0x60d8('0x48')]=_[_0x60d8('0x52')](_0x3f9eb4['where'],{'$or':_[_0x60d8('0x3c')](_0x3f9eb4[_0x60d8('0x41')],function(_0x46d2db){var _0x3a2b67={};_0x3a2b67[_0x46d2db]={'$like':'%'+_0x245b5a[_0x60d8('0x3d')]['filter']+'%'};return _0x3a2b67;})});}_0x3f9eb4=_[_0x60d8('0x52')]({},_0x3f9eb4,_0x245b5a[_0x60d8('0x4b')]);return _0x2f734b[_0x60d8('0x9f')](_0x3f9eb4);}})['then'](function(_0x2aa924){if(_0x2aa924){_0x502da8=_0x2aa924[_0x60d8('0x43')];if(!_0x245b5a[_0x60d8('0x3d')]['hasOwnProperty'](_0x60d8('0x45'))){_0x3f9eb4['limit']=qs['limit'](_0x245b5a['query'][_0x60d8('0x22')]);_0x3f9eb4[_0x60d8('0x21')]=qs[_0x60d8('0x21')](_0x245b5a['query'][_0x60d8('0x21')]);}return _0x2f734b['getLists'](_0x3f9eb4);}})[_0x60d8('0x29')](function(_0xf7e795){if(_0xf7e795){return _0xf7e795?{'count':_0x502da8,'rows':_0xf7e795}:null;}})[_0x60d8('0x29')](respondWithResult(_0x55cc91,null))[_0x60d8('0x54')](handleError(_0x55cc91,null));};exports['addLists']=function(_0xc63d07,_0x37676f,_0x1aa243){var _0x376d33,_0x2a2f35;return db['VoiceQueue'][_0x60d8('0x53')]({'where':{'id':_0xc63d07['params']['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x37676f,null))[_0x60d8('0x29')](function(_0x2e85cc){if(_0x2e85cc){_0x2a2f35=_0x2e85cc;return _0x2e85cc['addLists'](_0xc63d07[_0x60d8('0x60')][_0x60d8('0x84')],_[_0x60d8('0x5d')](_0xc63d07[_0x60d8('0x60')],['ids','id'])||{});}return null;})[_0x60d8('0x99')](function(_0x21acb9){var _0x53f09d;_0x376d33=_0x21acb9||[];var _0x2ec6df=[];if(_0x21acb9){for(var _0x3e58b3=0x0;_0x3e58b3<_0x21acb9[_0x60d8('0x43')];_0x3e58b3+=0x1){var _0x4f5218=_0x21acb9[_0x3e58b3]['get']({'plain':!![]});_0x2a2f35['dialCheckDuplicateType']=_0xc63d07[_0x60d8('0x60')]['dialCheckDuplicateType']?_0xc63d07[_0x60d8('0x60')][_0x60d8('0xa0')]:_0x2a2f35[_0x60d8('0xa0')];switch(_0x2a2f35[_0x60d8('0xa0')]){case _0x60d8('0xa1'):_0x53f09d=squel[_0x60d8('0xa2')]()['into'](_0x60d8('0xa3'))[_0x60d8('0xa4')](['phone','scheduledAt',_0x60d8('0xa5'),_0x60d8('0xa6'),'VoiceQueueId',_0x60d8('0x5e'),'updatedAt'],squel[_0x60d8('0xa7')]()[_0x60d8('0x85')](_0x60d8('0xa8'),_0x60d8('0xa8'))['field']('NOW()',_0x60d8('0xa9'))[_0x60d8('0x85')]('id',_0x60d8('0xa5'))[_0x60d8('0x85')](_0x4f5218[_0x60d8('0xaa')][_0x60d8('0xab')](),_0x60d8('0xa6'))[_0x60d8('0x85')](_0xc63d07['params']['id'][_0x60d8('0xab')](),_0x60d8('0x66'))[_0x60d8('0x85')](_0x60d8('0xac'),_0x60d8('0x5e'))['field'](_0x60d8('0xac'),_0x60d8('0x5f'))['from'](_0x60d8('0xad'))['where']('deletedAt\x20IS\x20NULL')[_0x60d8('0x48')]('ListId\x20=\x20?',_0x4f5218[_0x60d8('0xaa')][_0x60d8('0xab')]())[_0x60d8('0x48')](_0x60d8('0xae'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x60d8('0xa7')]()[_0x60d8('0x85')](_0x60d8('0xaf'))[_0x60d8('0x87')]('cm_hopper_final')[_0x60d8('0x48')](_0x60d8('0x8b'),_0xc63d07[_0x60d8('0x50')]['id']['toString']()))['where'](_0x60d8('0xb0'),squel[_0x60d8('0xa7')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x60d8('0xa3'))[_0x60d8('0x48')](_0x60d8('0x8b'),_0xc63d07[_0x60d8('0x50')]['id'][_0x60d8('0xab')]())))[_0x60d8('0xab')]();break;case _0x60d8('0xb1'):_0x53f09d=squel[_0x60d8('0xa2')]()['into']('cm_hopper')[_0x60d8('0xa4')]([_0x60d8('0xa8'),_0x60d8('0xa9'),_0x60d8('0xa5'),_0x60d8('0xa6'),_0x60d8('0x66'),_0x60d8('0x5e'),_0x60d8('0x5f')],squel['select']()['field'](_0x60d8('0xa8'),'phone')[_0x60d8('0x85')](_0x60d8('0xac'),_0x60d8('0xa9'))[_0x60d8('0x85')]('id','ContactId')[_0x60d8('0x85')](_0x4f5218['CmListId'][_0x60d8('0xab')](),'ListId')[_0x60d8('0x85')](_0xc63d07['params']['id'][_0x60d8('0xab')](),_0x60d8('0x66'))['field'](_0x60d8('0xac'),_0x60d8('0x5e'))['field']('NOW()',_0x60d8('0x5f'))[_0x60d8('0x87')](_0x60d8('0xad'))['where'](_0x60d8('0xb2'))[_0x60d8('0x48')](_0x60d8('0xb3'),_0x4f5218[_0x60d8('0xaa')][_0x60d8('0xab')]())[_0x60d8('0x48')](_0x60d8('0xae'))[_0x60d8('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x60d8('0x85')](_0x60d8('0xb4'))[_0x60d8('0x87')]('cm_hopper')[_0x60d8('0x48')]('VoiceQueueId\x20=\x20?',_0xc63d07[_0x60d8('0x50')]['id'][_0x60d8('0xab')]())))['toString']();break;default:_0x53f09d=squel[_0x60d8('0xa2')]()[_0x60d8('0xb5')](_0x60d8('0xa3'))['fromQuery']([_0x60d8('0xa8'),'scheduledAt','ContactId',_0x60d8('0xa6'),_0x60d8('0x66'),_0x60d8('0x5e'),_0x60d8('0x5f')],squel[_0x60d8('0xa7')]()[_0x60d8('0x85')](_0x60d8('0xa8'),_0x60d8('0xa8'))['field'](_0x60d8('0xac'),_0x60d8('0xa9'))[_0x60d8('0x85')]('id',_0x60d8('0xa5'))[_0x60d8('0x85')](_0x4f5218[_0x60d8('0xaa')][_0x60d8('0xab')](),_0x60d8('0xa6'))['field'](_0xc63d07[_0x60d8('0x50')]['id'][_0x60d8('0xab')](),_0x60d8('0x66'))['field'](_0x60d8('0xac'),'createdAt')[_0x60d8('0x85')]('NOW()','updatedAt')[_0x60d8('0x87')](_0x60d8('0xad'))[_0x60d8('0x48')]('deletedAt\x20IS\x20NULL')[_0x60d8('0x48')](_0x60d8('0xb3'),_0x4f5218['CmListId'][_0x60d8('0xab')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x60d8('0xab')]();}_0x2ec6df['push'](db[_0x60d8('0x78')][_0x60d8('0x3d')](_0x53f09d));}return BPromise[_0x60d8('0x92')](_0x2ec6df);}})['then'](function(){return _0x376d33;})['then'](respondWithResult(_0x37676f,null))['catch'](handleError(_0x37676f,null));};exports[_0x60d8('0xb6')]=function(_0x2ab260,_0x4a7d1f,_0x1b5bb1){return db[_0x60d8('0x38')][_0x60d8('0x53')]({'where':{'id':_0x2ab260[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x4a7d1f,null))[_0x60d8('0x29')](function(_0x4b22bd){if(_0x4b22bd){return _0x4b22bd[_0x60d8('0xb6')](_0x2ab260['query']['ids']);}})[_0x60d8('0x29')](function(_0x3e89a2){if(_0x3e89a2){return db[_0x60d8('0x65')][_0x60d8('0x28')]({'where':{'ListId':_0x2ab260['query']['ids'],'VoiceQueueId':_0x2ab260[_0x60d8('0x50')]['id']}})['then'](function(){return _0x3e89a2;});}})[_0x60d8('0x29')](respondWithStatusCode(_0x4a7d1f,null))['catch'](handleError(_0x4a7d1f,null));};exports[_0x60d8('0xb7')]=function(_0x52ad96,_0x51e5db,_0x4e0a0e){var _0x54c457={};var _0x4d0e97={};var _0x771553;var _0x34deb1;return db['VoiceQueue']['findOne']({'where':{'id':_0x52ad96[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x51e5db,null))[_0x60d8('0x29')](function(_0x5b9c8b){if(_0x5b9c8b){_0x771553=_0x5b9c8b;_0x4d0e97['model']=_[_0x60d8('0x3e')](db['CmList'][_0x60d8('0x51')]);_0x4d0e97['query']=_[_0x60d8('0x3e')](_0x52ad96[_0x60d8('0x3d')]);_0x4d0e97[_0x60d8('0x3f')]=_['intersection'](_0x4d0e97['model'],_0x4d0e97['query']);_0x54c457['attributes']=_['intersection'](_0x4d0e97[_0x60d8('0x3b')],qs[_0x60d8('0x42')](_0x52ad96['query']['fields']));_0x54c457[_0x60d8('0x41')]=_0x54c457[_0x60d8('0x41')][_0x60d8('0x43')]?_0x54c457[_0x60d8('0x41')]:_0x4d0e97[_0x60d8('0x3b')];_0x54c457['order']=qs[_0x60d8('0x47')](_0x52ad96[_0x60d8('0x3d')][_0x60d8('0x47')]);_0x54c457[_0x60d8('0x48')]=qs['filters'](_[_0x60d8('0x49')](_0x52ad96['query'],_0x4d0e97[_0x60d8('0x3f')]));if(_0x52ad96[_0x60d8('0x3d')][_0x60d8('0x2d')]){_0x54c457['where']=_[_0x60d8('0x52')](_0x54c457['where'],{'$or':_[_0x60d8('0x3c')](_0x54c457[_0x60d8('0x41')],function(_0x5f212b){var _0x341a1e={};_0x341a1e[_0x5f212b]={'$like':'%'+_0x52ad96[_0x60d8('0x3d')]['filter']+'%'};return _0x341a1e;})});}_0x54c457=_[_0x60d8('0x52')]({},_0x54c457,_0x52ad96[_0x60d8('0x4b')]);return _0x771553[_0x60d8('0xb7')](_0x54c457);}})[_0x60d8('0x29')](function(_0x288515){if(_0x288515){_0x34deb1=_0x288515[_0x60d8('0x43')];if(!_0x52ad96['query'][_0x60d8('0x44')](_0x60d8('0x45'))){_0x54c457[_0x60d8('0x22')]=qs[_0x60d8('0x22')](_0x52ad96[_0x60d8('0x3d')][_0x60d8('0x22')]);_0x54c457['offset']=qs[_0x60d8('0x21')](_0x52ad96['query'][_0x60d8('0x21')]);}return _0x771553[_0x60d8('0xb7')](_0x54c457);}})['then'](function(_0x25798a){if(_0x25798a){return _0x25798a?{'count':_0x34deb1,'rows':_0x25798a}:null;}})[_0x60d8('0x29')](respondWithResult(_0x51e5db,null))[_0x60d8('0x54')](handleError(_0x51e5db,null));};exports[_0x60d8('0xb8')]=function(_0x498b06,_0x47ba4f,_0x2bea78){var _0x1d2c22,_0x105c47;return db['VoiceQueue'][_0x60d8('0x53')]({'where':{'id':_0x498b06[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x47ba4f,null))[_0x60d8('0x29')](function(_0x282e51){if(_0x282e51){_0x105c47=_0x282e51;return _0x282e51[_0x60d8('0xb8')](_0x498b06[_0x60d8('0x60')][_0x60d8('0x84')],_[_0x60d8('0x5d')](_0x498b06[_0x60d8('0x60')],[_0x60d8('0x84'),'id'])||{});}return null;})[_0x60d8('0x99')](function(_0x3e7f6c){var _0x11c367;_0x1d2c22=_0x3e7f6c||[];var _0x3f44a1=[];if(_0x3e7f6c){for(var _0x3d23b4=0x0;_0x3d23b4<_0x3e7f6c[_0x60d8('0x43')];_0x3d23b4+=0x1){var _0x19fbb0=_0x3e7f6c[_0x3d23b4][_0x60d8('0x59')]({'plain':!![]});_0x11c367=squel[_0x60d8('0xa2')]()[_0x60d8('0xb5')](_0x60d8('0xb9'))[_0x60d8('0xa4')]([_0x60d8('0xa8'),_0x60d8('0xa5'),_0x60d8('0xa6'),_0x60d8('0x66'),_0x60d8('0x5e'),_0x60d8('0x5f')],squel[_0x60d8('0xa7')]()[_0x60d8('0x85')](_0x60d8('0xa8'),_0x60d8('0xa8'))[_0x60d8('0x85')]('id',_0x60d8('0xa5'))['field'](_0x19fbb0[_0x60d8('0xaa')]['toString'](),_0x60d8('0xa6'))[_0x60d8('0x85')](_0x498b06['params']['id']['toString'](),'VoiceQueueId')[_0x60d8('0x85')](_0x60d8('0xac'),_0x60d8('0x5e'))[_0x60d8('0x85')](_0x60d8('0xac'),_0x60d8('0x5f'))[_0x60d8('0x87')](_0x60d8('0xad'))[_0x60d8('0x48')](_0x60d8('0xb2'))[_0x60d8('0x48')](_0x60d8('0xb3'),_0x19fbb0['CmListId'][_0x60d8('0xab')]())[_0x60d8('0x48')]('phone\x20IS\x20NOT\x20NULL'))[_0x60d8('0xab')]();_0x3f44a1[_0x60d8('0x8e')](db[_0x60d8('0x78')][_0x60d8('0x3d')](_0x11c367));}return BPromise['all'](_0x3f44a1);}})[_0x60d8('0x29')](function(){return _0x1d2c22;})[_0x60d8('0x29')](respondWithResult(_0x47ba4f,null))['catch'](handleError(_0x47ba4f,null));};exports[_0x60d8('0xba')]=function(_0x51e1e3,_0x327d87,_0x3f7346){return db[_0x60d8('0x38')]['find']({'where':{'id':_0x51e1e3[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](handleEntityNotFound(_0x327d87,null))[_0x60d8('0x29')](function(_0x5a93dd){if(_0x5a93dd){return _0x5a93dd['removeBlackLists'](_0x51e1e3[_0x60d8('0x3d')][_0x60d8('0x84')]);}})[_0x60d8('0x29')](function(_0xb33aa4){if(_0xb33aa4){return db[_0x60d8('0x6d')][_0x60d8('0x28')]({'where':{'ListId':_0x51e1e3[_0x60d8('0x3d')][_0x60d8('0x84')],'VoiceQueueId':_0x51e1e3[_0x60d8('0x50')]['id']}})[_0x60d8('0x29')](function(){return _0xb33aa4;});}})[_0x60d8('0x29')](respondWithStatusCode(_0x327d87,null))[_0x60d8('0x54')](handleError(_0x327d87,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 1cf0fa8..92da5db 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 _0x2dea=['remove','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x10d44a,_0x4a421a){var _0x199e2b=function(_0x411637){while(--_0x411637){_0x10d44a['push'](_0x10d44a['shift']());}};_0x199e2b(++_0x4a421a);}(_0x2dea,0x1b3));var _0xa2de=function(_0x1b0452,_0x3c69a5){_0x1b0452=_0x1b0452-0x0;var _0x140bb1=_0x2dea[_0x1b0452];return _0x140bb1;};'use strict';var EventEmitter=require(_0xa2de('0x0'));var VoiceQueue=require(_0xa2de('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa2de('0x2')](0x0);var events={'afterCreate':_0xa2de('0x3'),'afterUpdate':_0xa2de('0x4'),'afterDestroy':_0xa2de('0x5')};function emitEvent(_0x2caffe){return function(_0x2617fa,_0xfd2849,_0x5ad14a){VoiceQueueEvents['emit'](_0x2caffe+':'+_0x2617fa['id'],_0x2617fa);VoiceQueueEvents['emit'](_0x2caffe,_0x2617fa);_0x5ad14a(null);};}for(var e in events){if(events[_0xa2de('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xa2de('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x321c=['emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners','update'];(function(_0x297cf3,_0x26abfa){var _0x31935a=function(_0x26e727){while(--_0x26e727){_0x297cf3['push'](_0x297cf3['shift']());}};_0x31935a(++_0x26abfa);}(_0x321c,0x84));var _0xc321=function(_0x3dbac1,_0xfd99f4){_0x3dbac1=_0x3dbac1-0x0;var _0x2bdce1=_0x321c[_0x3dbac1];return _0x2bdce1;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0xc321('0x0'))['db'][_0xc321('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xc321('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc321('0x3'),'afterDestroy':'remove'};function emitEvent(_0xb4a404){return function(_0x1022e9,_0x1720f8,_0x536a0a){VoiceQueueEvents[_0xc321('0x4')](_0xb4a404+':'+_0x1022e9['id'],_0x1022e9);VoiceQueueEvents[_0xc321('0x4')](_0xb4a404,_0x1022e9);_0x536a0a(null);};}for(var e in events){if(events[_0xc321('0x5')](e)){var event=events[e];VoiceQueue[_0xc321('0x6')](e,emitEvent(event));}}module[_0xc321('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 5c421ac..d45fa0c 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 _0xa9ee=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','define','VoiceQueue','lodash','util'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0xa9ee,0x136));var _0xea9e=function(_0x2fa8a3,_0x3f88d4){_0x2fa8a3=_0x2fa8a3-0x0;var _0x5e1508=_0xa9ee[_0x2fa8a3];return _0x5e1508;};'use strict';var _=require(_0xea9e('0x0'));var util=require(_0xea9e('0x1'));var logger=require(_0xea9e('0x2'))(_0xea9e('0x3'));var moment=require(_0xea9e('0x4'));var BPromise=require(_0xea9e('0x5'));var rp=require(_0xea9e('0x6'));var fs=require('fs');var path=require(_0xea9e('0x7'));var rimraf=require(_0xea9e('0x8'));var config=require(_0xea9e('0x9'));var attributes=require(_0xea9e('0xa'));module['exports']=function(_0x1befe5,_0xc86d90){return _0x1befe5[_0xea9e('0xb')](_0xea9e('0xc'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e9c=['voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceQueue.attributes','exports','define'];(function(_0x201b1d,_0x1b05ff){var _0xdcf59a=function(_0x223347){while(--_0x223347){_0x201b1d['push'](_0x201b1d['shift']());}};_0xdcf59a(++_0x1b05ff);}(_0x3e9c,0x109));var _0xc3e9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3e9c[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xc3e9('0x0'));var util=require(_0xc3e9('0x1'));var logger=require(_0xc3e9('0x2'))(_0xc3e9('0x3'));var moment=require(_0xc3e9('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3e9('0x5'));var fs=require('fs');var path=require(_0xc3e9('0x6'));var rimraf=require('rimraf');var config=require(_0xc3e9('0x7'));var attributes=require(_0xc3e9('0x8'));module[_0xc3e9('0x9')]=function(_0x25bab5,_0x4b8b61){return _0x25bab5[_0xc3e9('0xa')]('VoiceQueue',attributes,{'tableName':_0xc3e9('0xb'),'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 f7131f5..ce4de56 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 _0xc0fd=['./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowVoiceQueue','VoiceQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x312558,_0x5cfc98){var _0x56118f=function(_0x226953){while(--_0x226953){_0x312558['push'](_0x312558['shift']());}};_0x56118f(++_0x5cfc98);}(_0xc0fd,0x1c6));var _0xdc0f=function(_0x5d9d8e,_0x2c160f){_0x5d9d8e=_0x5d9d8e-0x0;var _0x26f31d=_0xc0fd[_0x5d9d8e];return _0x26f31d;};'use strict';var _=require(_0xdc0f('0x0'));var util=require('util');var moment=require(_0xdc0f('0x1'));var BPromise=require(_0xdc0f('0x2'));var rs=require(_0xdc0f('0x3'));var fs=require('fs');var Redis=require(_0xdc0f('0x4'));var db=require(_0xdc0f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdc0f('0x6'))(_0xdc0f('0x7'));var config=require(_0xdc0f('0x8'));var jayson=require(_0xdc0f('0x9'));var client=jayson['client'][_0xdc0f('0xa')]({'port':0x232a});config[_0xdc0f('0xb')]=_[_0xdc0f('0xc')](config['redis'],{'host':_0xdc0f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc0f('0xb')]));require(_0xdc0f('0xe'))[_0xdc0f('0xf')](socket);function respondWithRpcPromise(_0x58df65,_0x4d54c8,_0x426590){return new BPromise(function(_0x39e89d,_0x2ffc80){return client['request'](_0x58df65,_0x426590)[_0xdc0f('0x10')](function(_0x2e73f2){logger[_0xdc0f('0x11')](_0xdc0f('0x12'),_0x4d54c8,_0xdc0f('0x13'));logger[_0xdc0f('0x14')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x4d54c8,_0xdc0f('0x13'),JSON[_0xdc0f('0x15')](_0x2e73f2));if(_0x2e73f2[_0xdc0f('0x16')]){if(_0x2e73f2[_0xdc0f('0x16')]['code']===0x1f4){logger[_0xdc0f('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x4d54c8,_0x2e73f2[_0xdc0f('0x16')][_0xdc0f('0x17')]);return _0x2ffc80(_0x2e73f2[_0xdc0f('0x16')]['message']);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x4d54c8,_0x2e73f2['error'][_0xdc0f('0x17')]);return _0x39e89d(_0x2e73f2['error'][_0xdc0f('0x17')]);}else{logger[_0xdc0f('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x4d54c8,'request\x20sent');_0x39e89d(_0x2e73f2[_0xdc0f('0x18')][_0xdc0f('0x17')]);}})[_0xdc0f('0x19')](function(_0x392bd0){logger[_0xdc0f('0x16')](_0xdc0f('0x12'),_0x4d54c8,_0x392bd0);_0x2ffc80(_0x392bd0);});});}exports[_0xdc0f('0x1a')]=function(_0x4344bb){var _0x9be67f=this;return new Promise(function(_0x5e410c,_0x2874cd){return db['VoiceQueue'][_0xdc0f('0x1b')]({'raw':_0x4344bb['options']?_0x4344bb[_0xdc0f('0x1c')][_0xdc0f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4344bb[_0xdc0f('0x1c')]?_0x4344bb['options'][_0xdc0f('0x1e')]||null:null,'attributes':_0x4344bb[_0xdc0f('0x1c')]?_0x4344bb[_0xdc0f('0x1c')][_0xdc0f('0x1f')]||null:null,'limit':_0x4344bb[_0xdc0f('0x1c')]?_0x4344bb[_0xdc0f('0x1c')][_0xdc0f('0x20')]||null:null,'include':_0x4344bb[_0xdc0f('0x1c')]?_0x4344bb[_0xdc0f('0x1c')][_0xdc0f('0x21')]?_['map'](_0x4344bb[_0xdc0f('0x1c')][_0xdc0f('0x21')],function(_0x203564){return{'model':db[_0x203564[_0xdc0f('0x22')]],'as':_0x203564['as'],'attributes':_0x203564[_0xdc0f('0x1f')],'include':_0x203564[_0xdc0f('0x21')]?_[_0xdc0f('0x23')](_0x203564[_0xdc0f('0x21')],function(_0x5da288){return{'model':db[_0x5da288['model']],'as':_0x5da288['as'],'attributes':_0x5da288['attributes'],'include':_0x5da288['include']?_['map'](_0x5da288[_0xdc0f('0x21')],function(_0x190dbf){return{'model':db[_0x190dbf[_0xdc0f('0x22')]],'as':_0x190dbf['as'],'attributes':_0x190dbf['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc0f('0x10')](function(_0xb0e13a){logger[_0xdc0f('0x11')](_0xdc0f('0x1a'),_0x4344bb);logger['debug']('GetVoiceQueue',_0x4344bb,JSON[_0xdc0f('0x15')](_0xb0e13a));_0x5e410c(_0xb0e13a);})[_0xdc0f('0x19')](function(_0x1a2499){logger[_0xdc0f('0x16')](_0xdc0f('0x1a'),_0x1a2499[_0xdc0f('0x17')],_0x4344bb);_0x2874cd(_0x9be67f[_0xdc0f('0x16')](0x1f4,_0x1a2499['message']));});});};exports[_0xdc0f('0x24')]=function(_0x5a7a20){var _0x350014=this;return new Promise(function(_0x5c857b,_0x19dde3){return db[_0xdc0f('0x25')][_0xdc0f('0x26')]({'raw':_0x5a7a20[_0xdc0f('0x1c')]?_0x5a7a20[_0xdc0f('0x1c')][_0xdc0f('0x1d')]===undefined?!![]:![]:!![],'where':_0x5a7a20['options']?_0x5a7a20['options'][_0xdc0f('0x1e')]||null:null,'attributes':_0x5a7a20[_0xdc0f('0x1c')]?_0x5a7a20[_0xdc0f('0x1c')][_0xdc0f('0x1f')]||null:null,'include':_0x5a7a20[_0xdc0f('0x1c')]?_0x5a7a20[_0xdc0f('0x1c')][_0xdc0f('0x21')]?_['map'](_0x5a7a20[_0xdc0f('0x1c')][_0xdc0f('0x21')],function(_0x410c8c){return{'model':db[_0x410c8c['model']],'as':_0x410c8c['as'],'attributes':_0x410c8c[_0xdc0f('0x1f')],'include':_0x410c8c[_0xdc0f('0x21')]?_[_0xdc0f('0x23')](_0x410c8c[_0xdc0f('0x21')],function(_0x31d8f1){return{'model':db[_0x31d8f1[_0xdc0f('0x22')]],'as':_0x31d8f1['as'],'attributes':_0x31d8f1[_0xdc0f('0x1f')],'include':_0x31d8f1[_0xdc0f('0x21')]?_[_0xdc0f('0x23')](_0x31d8f1[_0xdc0f('0x21')],function(_0x49e2ee){return{'model':db[_0x49e2ee['model']],'as':_0x49e2ee['as'],'attributes':_0x49e2ee[_0xdc0f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdc0f('0x10')](function(_0x17df86){logger[_0xdc0f('0x11')](_0xdc0f('0x24'),_0x5a7a20);logger[_0xdc0f('0x14')](_0xdc0f('0x24'),_0x5a7a20,JSON[_0xdc0f('0x15')](_0x17df86));_0x5c857b(_0x17df86);})[_0xdc0f('0x19')](function(_0x482e50){logger['error'](_0xdc0f('0x24'),_0x482e50[_0xdc0f('0x17')],_0x5a7a20);_0x19dde3(_0x350014['error'](0x1f4,_0x482e50[_0xdc0f('0x17')]));});});}; \ No newline at end of file +var _0x274f=['socket.io-emitter','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceQueue','findAll','options','raw','include','map','model','attributes','debug','GetVoiceQueue','catch','ShowVoiceQueue','find','where','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost'];(function(_0x19cf1f,_0x4105e3){var _0x234028=function(_0x24748c){while(--_0x24748c){_0x19cf1f['push'](_0x19cf1f['shift']());}};_0x234028(++_0x4105e3);}(_0x274f,0x1ef));var _0xf274=function(_0x18ed68,_0x2db4da){_0x18ed68=_0x18ed68-0x0;var _0x2df85b=_0x274f[_0x18ed68];return _0x2df85b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf274('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf274('0x1'));var logger=require(_0xf274('0x2'))('rpc');var config=require(_0xf274('0x3'));var jayson=require('jayson/promise');var client=jayson[_0xf274('0x4')][_0xf274('0x5')]({'port':0x232a});config['redis']=_[_0xf274('0x6')](config[_0xf274('0x7')],{'host':_0xf274('0x8'),'port':0x18eb});var socket=require(_0xf274('0x9'))(new Redis(config[_0xf274('0x7')]));require('./voiceQueue.socket')[_0xf274('0xa')](socket);function respondWithRpcPromise(_0x16c076,_0x5cacee,_0x572ca5){return new BPromise(function(_0x12d951,_0x5abeec){return client[_0xf274('0xb')](_0x16c076,_0x572ca5)[_0xf274('0xc')](function(_0x1b9d16){logger[_0xf274('0xd')](_0xf274('0xe'),_0x5cacee,_0xf274('0xf'));logger['debug'](_0xf274('0x10'),_0x5cacee,_0xf274('0xf'),JSON[_0xf274('0x11')](_0x1b9d16));if(_0x1b9d16[_0xf274('0x12')]){if(_0x1b9d16['error'][_0xf274('0x13')]===0x1f4){logger[_0xf274('0x12')](_0xf274('0xe'),_0x5cacee,_0x1b9d16['error'][_0xf274('0x14')]);return _0x5abeec(_0x1b9d16[_0xf274('0x12')][_0xf274('0x14')]);}logger[_0xf274('0x12')](_0xf274('0xe'),_0x5cacee,_0x1b9d16[_0xf274('0x12')][_0xf274('0x14')]);return _0x12d951(_0x1b9d16[_0xf274('0x12')][_0xf274('0x14')]);}else{logger[_0xf274('0xd')](_0xf274('0xe'),_0x5cacee,_0xf274('0xf'));_0x12d951(_0x1b9d16[_0xf274('0x15')][_0xf274('0x14')]);}})['catch'](function(_0x312dbc){logger[_0xf274('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x5cacee,_0x312dbc);_0x5abeec(_0x312dbc);});});}exports['GetVoiceQueue']=function(_0x32e3cd){var _0x171f0e=this;return new Promise(function(_0x24bab4,_0x45734b){return db[_0xf274('0x16')][_0xf274('0x17')]({'raw':_0x32e3cd[_0xf274('0x18')]?_0x32e3cd[_0xf274('0x18')][_0xf274('0x19')]===undefined?!![]:![]:!![],'where':_0x32e3cd[_0xf274('0x18')]?_0x32e3cd[_0xf274('0x18')]['where']||null:null,'attributes':_0x32e3cd[_0xf274('0x18')]?_0x32e3cd['options']['attributes']||null:null,'limit':_0x32e3cd[_0xf274('0x18')]?_0x32e3cd['options']['limit']||null:null,'include':_0x32e3cd[_0xf274('0x18')]?_0x32e3cd[_0xf274('0x18')][_0xf274('0x1a')]?_[_0xf274('0x1b')](_0x32e3cd[_0xf274('0x18')]['include'],function(_0x33c443){return{'model':db[_0x33c443[_0xf274('0x1c')]],'as':_0x33c443['as'],'attributes':_0x33c443['attributes'],'include':_0x33c443['include']?_[_0xf274('0x1b')](_0x33c443[_0xf274('0x1a')],function(_0x1bddb5){return{'model':db[_0x1bddb5[_0xf274('0x1c')]],'as':_0x1bddb5['as'],'attributes':_0x1bddb5['attributes'],'include':_0x1bddb5['include']?_[_0xf274('0x1b')](_0x1bddb5[_0xf274('0x1a')],function(_0x51d554){return{'model':db[_0x51d554[_0xf274('0x1c')]],'as':_0x51d554['as'],'attributes':_0x51d554[_0xf274('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf274('0xc')](function(_0x1eec34){logger['info']('GetVoiceQueue',_0x32e3cd);logger[_0xf274('0x1e')](_0xf274('0x1f'),_0x32e3cd,JSON[_0xf274('0x11')](_0x1eec34));_0x24bab4(_0x1eec34);})[_0xf274('0x20')](function(_0x46374a){logger[_0xf274('0x12')](_0xf274('0x1f'),_0x46374a[_0xf274('0x14')],_0x32e3cd);_0x45734b(_0x171f0e['error'](0x1f4,_0x46374a[_0xf274('0x14')]));});});};exports[_0xf274('0x21')]=function(_0x1de2d5){var _0x234a04=this;return new Promise(function(_0x2078f8,_0x3426dc){return db['VoiceQueue'][_0xf274('0x22')]({'raw':_0x1de2d5[_0xf274('0x18')]?_0x1de2d5[_0xf274('0x18')][_0xf274('0x19')]===undefined?!![]:![]:!![],'where':_0x1de2d5['options']?_0x1de2d5[_0xf274('0x18')][_0xf274('0x23')]||null:null,'attributes':_0x1de2d5[_0xf274('0x18')]?_0x1de2d5[_0xf274('0x18')][_0xf274('0x1d')]||null:null,'include':_0x1de2d5['options']?_0x1de2d5[_0xf274('0x18')][_0xf274('0x1a')]?_[_0xf274('0x1b')](_0x1de2d5['options'][_0xf274('0x1a')],function(_0x39e2ac){return{'model':db[_0x39e2ac[_0xf274('0x1c')]],'as':_0x39e2ac['as'],'attributes':_0x39e2ac[_0xf274('0x1d')],'include':_0x39e2ac[_0xf274('0x1a')]?_[_0xf274('0x1b')](_0x39e2ac['include'],function(_0x15e86e){return{'model':db[_0x15e86e[_0xf274('0x1c')]],'as':_0x15e86e['as'],'attributes':_0x15e86e[_0xf274('0x1d')],'include':_0x15e86e[_0xf274('0x1a')]?_['map'](_0x15e86e[_0xf274('0x1a')],function(_0x24a2d9){return{'model':db[_0x24a2d9[_0xf274('0x1c')]],'as':_0x24a2d9['as'],'attributes':_0x24a2d9['attributes']};}):[]};}):[]};}):[]:[]})[_0xf274('0xc')](function(_0x316844){logger[_0xf274('0xd')](_0xf274('0x21'),_0x1de2d5);logger[_0xf274('0x1e')](_0xf274('0x21'),_0x1de2d5,JSON[_0xf274('0x11')](_0x316844));_0x2078f8(_0x316844);})[_0xf274('0x20')](function(_0x3ee69b){logger['error'](_0xf274('0x21'),_0x3ee69b[_0xf274('0x14')],_0x1de2d5);_0x3426dc(_0x234a04['error'](0x1f4,_0x3ee69b[_0xf274('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3701e08..3f2bd61 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 _0x01bb=['remove','update','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01bb,0x171));var _0xb01b=function(_0x3b0380,_0x1fa3d9){_0x3b0380=_0x3b0380-0x0;var _0x307d69=_0x01bb[_0x3b0380];return _0x307d69;};'use strict';var VoiceQueueEvents=require(_0xb01b('0x0'));var events=[_0xb01b('0x1'),_0xb01b('0x2'),_0xb01b('0x3')];function createListener(_0x8590b,_0x55e29f){return function(_0x164b39){_0x55e29f['emit'](_0x8590b,_0x164b39);};}function removeListener(_0x157a52,_0x4aee05){return function(){VoiceQueueEvents['removeListener'](_0x157a52,_0x4aee05);};}exports[_0xb01b('0x4')]=function(_0x13afdd){for(var _0x3e3360=0x0,_0xc9f593=events[_0xb01b('0x5')];_0x3e3360<_0xc9f593;_0x3e3360++){var _0x197515=events[_0x3e3360];var _0xb32053=createListener(_0xb01b('0x6')+_0x197515,_0x13afdd);VoiceQueueEvents['on'](_0x197515,_0xb32053);}}; \ No newline at end of file +var _0x36ab=['remove','update','emit','removeListener','register','length','voiceQueue:','save'];(function(_0x315027,_0x49bc90){var _0x532db9=function(_0x3a5919){while(--_0x3a5919){_0x315027['push'](_0x315027['shift']());}};_0x532db9(++_0x49bc90);}(_0x36ab,0x157));var _0xb36a=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x36ab[_0x3c8e9a];return _0x2d4c57;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xb36a('0x0'),_0xb36a('0x1'),_0xb36a('0x2')];function createListener(_0x59a847,_0x57b5d2){return function(_0x217bd6){_0x57b5d2[_0xb36a('0x3')](_0x59a847,_0x217bd6);};}function removeListener(_0x41b8c4,_0x28e4a2){return function(){VoiceQueueEvents[_0xb36a('0x4')](_0x41b8c4,_0x28e4a2);};}exports[_0xb36a('0x5')]=function(_0x94a38a){for(var _0x41356f=0x0,_0x232a47=events[_0xb36a('0x6')];_0x41356f<_0x232a47;_0x41356f++){var _0x54a5f8=events[_0x41356f];var _0x3b5c61=createListener(_0xb36a('0x7')+_0x54a5f8,_0x94a38a);VoiceQueueEvents['on'](_0x54a5f8,_0x3b5c61);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index aaa394f..33843ca 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 _0x71ab=['../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','create','put','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x513574,_0x29676c){var _0x4850dc=function(_0x4d07b3){while(--_0x4d07b3){_0x513574['push'](_0x513574['shift']());}};_0x4850dc(++_0x29676c);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var auth=require(_0xb71a('0x3'));var interaction=require(_0xb71a('0x4'));var config=require(_0xb71a('0x5'));var controller=require(_0xb71a('0x6'));router[_0xb71a('0x7')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0x9')]);router[_0xb71a('0x7')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller[_0xb71a('0xb')]);router[_0xb71a('0x7')](_0xb71a('0xc'),auth[_0xb71a('0x8')](),controller[_0xb71a('0xd')]);router[_0xb71a('0x7')](_0xb71a('0xe'),auth['isAuthenticated'](),controller[_0xb71a('0xf')]);router['post']('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0x10')]);router[_0xb71a('0x11')]('/:id',auth[_0xb71a('0x8')](),controller['update']);router[_0xb71a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb71a('0x13')]);module[_0xb71a('0x14')]=router; \ No newline at end of file +var _0xffd6=['/describe','describe','/index','getVoiceQueuesReport','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x27ad9b,_0x46e3f6){var _0x57cc87=function(_0x46b6fb){while(--_0x46b6fb){_0x27ad9b['push'](_0x27ad9b['shift']());}};_0x57cc87(++_0x46e3f6);}(_0xffd6,0x97));var _0x6ffd=function(_0x2074db,_0x10b81b){_0x2074db=_0x2074db-0x0;var _0x27324c=_0xffd6[_0x2074db];return _0x27324c;};'use strict';var multer=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var path=require(_0x6ffd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ffd('0x3')]();var auth=require(_0x6ffd('0x4'));var interaction=require(_0x6ffd('0x5'));var config=require('../../config/environment');var controller=require(_0x6ffd('0x6'));router[_0x6ffd('0x7')]('/',auth[_0x6ffd('0x8')](),controller[_0x6ffd('0x9')]);router['get'](_0x6ffd('0xa'),auth[_0x6ffd('0x8')](),controller[_0x6ffd('0xb')]);router[_0x6ffd('0x7')](_0x6ffd('0xc'),auth['isAuthenticated'](),controller[_0x6ffd('0xd')]);router[_0x6ffd('0x7')]('/:id',auth[_0x6ffd('0x8')](),controller[_0x6ffd('0xe')]);router[_0x6ffd('0xf')]('/',auth[_0x6ffd('0x8')](),controller[_0x6ffd('0x10')]);router[_0x6ffd('0x11')](_0x6ffd('0x12'),auth['isAuthenticated'](),controller[_0x6ffd('0x13')]);router[_0x6ffd('0x14')]('/:id',auth[_0x6ffd('0x8')](),controller[_0x6ffd('0x15')]);module[_0x6ffd('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 e664026..34690b2 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 _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x487b72,_0x121d37){var _0x4d7eb6=function(_0x4419fe){while(--_0x4419fe){_0x487b72['push'](_0x487b72['shift']());}};_0x4d7eb6(++_0x121d37);}(_0xb7e7,0x121));var _0x7b7e=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xb7e7[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x579fa4,_0x1911e0){var _0x514fa2=function(_0x31dd24){while(--_0x31dd24){_0x579fa4['push'](_0x579fa4['shift']());}};_0x514fa2(++_0x1911e0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'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 81cb4a1..b9b4a48 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 _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x2e4653,_0x5f1901){var _0x21742d=function(_0x2309e0){while(--_0x2309e0){_0x2e4653['push'](_0x2e4653['shift']());}};_0x21742d(++_0x5f1901);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x227b67,_0x5c4075){var _0x16f616=function(_0x46e857){while(--_0x46e857){_0x227b67['push'](_0x227b67['shift']());}};_0x16f616(++_0x5c4075);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 6bcac9b..c2ca654 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 _0x1021=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x4c2f30,_0xa91340){var _0xb8854d=function(_0x5ddf3d){while(--_0x5ddf3d){_0x4c2f30['push'](_0x4c2f30['shift']());}};_0xb8854d(++_0xa91340);}(_0x1021,0xaf));var _0x1102=function(_0x4a0ecf,_0x49d5bc){_0x4a0ecf=_0x4a0ecf-0x0;var _0x24057e=_0x1021[_0x4a0ecf];return _0x24057e;};'use strict';var EventEmitter=require(_0x1102('0x0'));var VoiceQueueReport=require(_0x1102('0x1'))['db'][_0x1102('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1102('0x3'),'afterUpdate':_0x1102('0x4'),'afterDestroy':_0x1102('0x5')};function emitEvent(_0x1ca946){return function(_0x2626f9,_0x5afe50,_0x192fa4){VoiceQueueReportEvents[_0x1102('0x6')](_0x1ca946+':'+_0x2626f9['id'],_0x2626f9);VoiceQueueReportEvents['emit'](_0x1ca946,_0x2626f9);_0x192fa4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x1102('0x7')](e,emitEvent(event));}}module[_0x1102('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xf052=['hook','events','VoiceQueueReport','save','update','remove','emit','hasOwnProperty'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xf052,0x141));var _0x2f05=function(_0x3d7022,_0x59dfd5){_0x3d7022=_0x3d7022-0x0;var _0x40870b=_0xf052[_0x3d7022];return _0x40870b;};'use strict';var EventEmitter=require(_0x2f05('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x2f05('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2f05('0x2'),'afterUpdate':_0x2f05('0x3'),'afterDestroy':_0x2f05('0x4')};function emitEvent(_0x14e04a){return function(_0x4c40fd,_0x37f0a2,_0x4dd586){VoiceQueueReportEvents[_0x2f05('0x5')](_0x14e04a+':'+_0x4c40fd['id'],_0x4c40fd);VoiceQueueReportEvents[_0x2f05('0x5')](_0x14e04a,_0x4c40fd);_0x4dd586(null);};}for(var e in events){if(events[_0x2f05('0x6')](e)){var event=events[e];VoiceQueueReport[_0x2f05('0x7')](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 ad4fbad..c171857 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 _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xb10b,0x12a));var _0xbb10=function(_0x36fa31,_0x33ddeb){_0x36fa31=_0x36fa31-0x0;var _0x191e7d=_0xb10b[_0x36fa31];return _0x191e7d;};'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')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_0x3ba527,_0x446a5e){var _0x5ee6ad=function(_0x5978c7){while(--_0x5978c7){_0x3ba527['push'](_0x3ba527['shift']());}};_0x5ee6ad(++_0x446a5e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x320ce7,_0x10e9ea){_0x320ce7=_0x320ce7-0x0;var _0x3c34d0=_0x5f2f[_0x320ce7];return _0x3c34d0;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xf5f2('0xc')]},{'fields':[_0xf5f2('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 8df9b37..43cb6bb 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 _0x0231=['body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueueReport','create'];(function(_0x284e85,_0x1bfec9){var _0x59ba3d=function(_0x559559){while(--_0x559559){_0x284e85['push'](_0x284e85['shift']());}};_0x59ba3d(++_0x1bfec9);}(_0x0231,0x107));var _0x1023=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x0231[_0x432682];return _0x463d05;};'use strict';var _=require(_0x1023('0x0'));var util=require(_0x1023('0x1'));var moment=require(_0x1023('0x2'));var BPromise=require(_0x1023('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1023('0x4'))['db'];var utils=require(_0x1023('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1023('0x6'));var jayson=require(_0x1023('0x7'));var client=jayson[_0x1023('0x8')][_0x1023('0x9')]({'port':0x232a});config[_0x1023('0xa')]=_['defaults'](config[_0x1023('0xa')],{'host':_0x1023('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1023('0xa')]));require(_0x1023('0xc'))[_0x1023('0xd')](socket);function respondWithRpcPromise(_0x1a2993,_0x4a3f82,_0x4debaf){return new BPromise(function(_0x5aba67,_0x477f33){return client[_0x1023('0xe')](_0x1a2993,_0x4debaf)[_0x1023('0xf')](function(_0xfe4cb5){logger[_0x1023('0x10')](_0x1023('0x11'),_0x4a3f82,_0x1023('0x12'));logger[_0x1023('0x13')](_0x1023('0x14'),_0x4a3f82,_0x1023('0x12'),JSON[_0x1023('0x15')](_0xfe4cb5));if(_0xfe4cb5[_0x1023('0x16')]){if(_0xfe4cb5[_0x1023('0x16')][_0x1023('0x17')]===0x1f4){logger[_0x1023('0x16')](_0x1023('0x11'),_0x4a3f82,_0xfe4cb5[_0x1023('0x16')]['message']);return _0x477f33(_0xfe4cb5['error'][_0x1023('0x18')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x4a3f82,_0xfe4cb5[_0x1023('0x16')][_0x1023('0x18')]);return _0x5aba67(_0xfe4cb5[_0x1023('0x16')][_0x1023('0x18')]);}else{logger[_0x1023('0x10')](_0x1023('0x11'),_0x4a3f82,_0x1023('0x12'));_0x5aba67(_0xfe4cb5[_0x1023('0x19')][_0x1023('0x18')]);}})[_0x1023('0x1a')](function(_0x176fe8){logger[_0x1023('0x16')](_0x1023('0x11'),_0x4a3f82,_0x176fe8);_0x477f33(_0x176fe8);});});}exports['GetVoiceQueueReport']=function(_0x1264c7){var _0x350d57=this;return new Promise(function(_0x1e2ede,_0x229b36){return db[_0x1023('0x1b')][_0x1023('0x1c')]({'raw':_0x1264c7['options']?_0x1264c7[_0x1023('0x1d')][_0x1023('0x1e')]===undefined?!![]:![]:!![],'where':_0x1264c7[_0x1023('0x1d')]?_0x1264c7[_0x1023('0x1d')][_0x1023('0x1f')]||null:null,'attributes':_0x1264c7['options']?_0x1264c7[_0x1023('0x1d')][_0x1023('0x20')]||null:null,'limit':_0x1264c7[_0x1023('0x1d')]?_0x1264c7[_0x1023('0x1d')]['limit']||null:null,'include':_0x1264c7[_0x1023('0x1d')]?_0x1264c7[_0x1023('0x1d')][_0x1023('0x21')]?_[_0x1023('0x22')](_0x1264c7[_0x1023('0x1d')]['include'],function(_0x56d5d1){return{'model':db[_0x56d5d1[_0x1023('0x23')]],'as':_0x56d5d1['as'],'attributes':_0x56d5d1[_0x1023('0x20')],'include':_0x56d5d1[_0x1023('0x21')]?_['map'](_0x56d5d1[_0x1023('0x21')],function(_0x1d75b5){return{'model':db[_0x1d75b5[_0x1023('0x23')]],'as':_0x1d75b5['as'],'attributes':_0x1d75b5[_0x1023('0x20')],'include':_0x1d75b5[_0x1023('0x21')]?_['map'](_0x1d75b5[_0x1023('0x21')],function(_0x4119cb){return{'model':db[_0x4119cb[_0x1023('0x23')]],'as':_0x4119cb['as'],'attributes':_0x4119cb[_0x1023('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1023('0xf')](function(_0x5bbad9){logger[_0x1023('0x10')](_0x1023('0x24'),_0x1264c7);logger[_0x1023('0x13')](_0x1023('0x24'),_0x1264c7,JSON[_0x1023('0x15')](_0x5bbad9));_0x1e2ede(_0x5bbad9);})['catch'](function(_0x4c6cb7){logger[_0x1023('0x16')](_0x1023('0x24'),_0x4c6cb7['message'],_0x1264c7);_0x229b36(_0x350d57[_0x1023('0x16')](0x1f4,_0x4c6cb7[_0x1023('0x18')]));});});};exports['CreateVoiceQueueReport']=function(_0x226423){var _0xb42377=this;return new Promise(function(_0x36fa7a,_0x51057c){return db[_0x1023('0x1b')][_0x1023('0x25')](_0x226423[_0x1023('0x26')],{'raw':_0x226423[_0x1023('0x1d')]?_0x226423[_0x1023('0x1d')][_0x1023('0x1e')]===undefined?!![]:![]:!![]})[_0x1023('0xf')](function(_0x2f0edb){logger[_0x1023('0x10')]('CreateVoiceQueueReport',_0x226423);logger['debug'](_0x1023('0x27'),_0x226423,JSON[_0x1023('0x15')](_0x2f0edb));_0x36fa7a(_0x2f0edb);})[_0x1023('0x1a')](function(_0x4c8aaa){logger[_0x1023('0x16')](_0x1023('0x27'),_0x4c8aaa['message'],_0x226423);_0x51057c(_0xb42377[_0x1023('0x16')](0x1f4,_0x4c8aaa[_0x1023('0x18')]));});});};exports[_0x1023('0x28')]=function(_0x2a2335){var _0x446a63=this;return new Promise(function(_0x3a4367,_0x2c227a){return db[_0x1023('0x1b')][_0x1023('0x29')](_0x2a2335['body'],{'raw':_0x2a2335[_0x1023('0x1d')]?_0x2a2335[_0x1023('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a2335[_0x1023('0x1d')]?_0x2a2335[_0x1023('0x1d')]['where']||null:null,'attributes':_0x2a2335['options']?_0x2a2335[_0x1023('0x1d')][_0x1023('0x20')]||null:null,'limit':_0x2a2335[_0x1023('0x1d')]?_0x2a2335['options'][_0x1023('0x2a')]||null:null})[_0x1023('0xf')](function(_0x397b9a){logger['info'](_0x1023('0x28'),_0x2a2335);logger[_0x1023('0x13')](_0x1023('0x28'),_0x2a2335,JSON[_0x1023('0x15')](_0x397b9a));_0x3a4367(_0x397b9a);})[_0x1023('0x1a')](function(_0x29a907){logger[_0x1023('0x16')](_0x1023('0x28'),_0x29a907[_0x1023('0x18')],_0x2a2335);_0x2c227a(_0x446a63[_0x1023('0x16')](0x1f4,_0x29a907[_0x1023('0x18')]));});});}; \ No newline at end of file +var _0x8001=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceQueueReport','options','raw','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0x8001,0xac));var _0x1800=function(_0x1dcd67,_0x1f57f5){_0x1dcd67=_0x1dcd67-0x0;var _0x273658=_0x8001[_0x1dcd67];return _0x273658;};'use strict';var _=require(_0x1800('0x0'));var util=require(_0x1800('0x1'));var moment=require(_0x1800('0x2'));var BPromise=require(_0x1800('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1800('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1800('0x5'));var logger=require(_0x1800('0x6'))(_0x1800('0x7'));var config=require(_0x1800('0x8'));var jayson=require(_0x1800('0x9'));var client=jayson[_0x1800('0xa')][_0x1800('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1800('0xc')],{'host':_0x1800('0xd'),'port':0x18eb});var socket=require(_0x1800('0xe'))(new Redis(config[_0x1800('0xc')]));require('./voiceQueueReport.socket')[_0x1800('0xf')](socket);function respondWithRpcPromise(_0x3b0ac3,_0x453aa5,_0x3adb78){return new BPromise(function(_0x201b01,_0x4f6c05){return client['request'](_0x3b0ac3,_0x3adb78)[_0x1800('0x10')](function(_0x2f9c68){logger[_0x1800('0x11')](_0x1800('0x12'),_0x453aa5,'request\x20sent');logger[_0x1800('0x13')](_0x1800('0x14'),_0x453aa5,_0x1800('0x15'),JSON[_0x1800('0x16')](_0x2f9c68));if(_0x2f9c68[_0x1800('0x17')]){if(_0x2f9c68[_0x1800('0x17')][_0x1800('0x18')]===0x1f4){logger[_0x1800('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x453aa5,_0x2f9c68[_0x1800('0x17')][_0x1800('0x19')]);return _0x4f6c05(_0x2f9c68['error'][_0x1800('0x19')]);}logger[_0x1800('0x17')](_0x1800('0x12'),_0x453aa5,_0x2f9c68['error'][_0x1800('0x19')]);return _0x201b01(_0x2f9c68['error'][_0x1800('0x19')]);}else{logger[_0x1800('0x11')](_0x1800('0x12'),_0x453aa5,'request\x20sent');_0x201b01(_0x2f9c68[_0x1800('0x1a')][_0x1800('0x19')]);}})[_0x1800('0x1b')](function(_0x21a586){logger['error'](_0x1800('0x12'),_0x453aa5,_0x21a586);_0x4f6c05(_0x21a586);});});}exports['GetVoiceQueueReport']=function(_0xc59744){var _0x599379=this;return new Promise(function(_0x3a0f24,_0x524ce0){return db[_0x1800('0x1c')]['findAll']({'raw':_0xc59744[_0x1800('0x1d')]?_0xc59744['options'][_0x1800('0x1e')]===undefined?!![]:![]:!![],'where':_0xc59744[_0x1800('0x1d')]?_0xc59744[_0x1800('0x1d')]['where']||null:null,'attributes':_0xc59744[_0x1800('0x1d')]?_0xc59744[_0x1800('0x1d')][_0x1800('0x1f')]||null:null,'limit':_0xc59744['options']?_0xc59744[_0x1800('0x1d')][_0x1800('0x20')]||null:null,'include':_0xc59744['options']?_0xc59744[_0x1800('0x1d')][_0x1800('0x21')]?_[_0x1800('0x22')](_0xc59744[_0x1800('0x1d')][_0x1800('0x21')],function(_0x2d0ad9){return{'model':db[_0x2d0ad9[_0x1800('0x23')]],'as':_0x2d0ad9['as'],'attributes':_0x2d0ad9[_0x1800('0x1f')],'include':_0x2d0ad9['include']?_[_0x1800('0x22')](_0x2d0ad9['include'],function(_0x3a16df){return{'model':db[_0x3a16df[_0x1800('0x23')]],'as':_0x3a16df['as'],'attributes':_0x3a16df['attributes'],'include':_0x3a16df['include']?_[_0x1800('0x22')](_0x3a16df[_0x1800('0x21')],function(_0x2f07d3){return{'model':db[_0x2f07d3[_0x1800('0x23')]],'as':_0x2f07d3['as'],'attributes':_0x2f07d3[_0x1800('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x252dad){logger[_0x1800('0x11')]('GetVoiceQueueReport',_0xc59744);logger[_0x1800('0x13')](_0x1800('0x24'),_0xc59744,JSON[_0x1800('0x16')](_0x252dad));_0x3a0f24(_0x252dad);})[_0x1800('0x1b')](function(_0x4c9a58){logger['error']('GetVoiceQueueReport',_0x4c9a58[_0x1800('0x19')],_0xc59744);_0x524ce0(_0x599379['error'](0x1f4,_0x4c9a58[_0x1800('0x19')]));});});};exports[_0x1800('0x25')]=function(_0xc74fcc){var _0x1228a4=this;return new Promise(function(_0x5e765b,_0x52ecb8){return db['VoiceQueueReport'][_0x1800('0x26')](_0xc74fcc[_0x1800('0x27')],{'raw':_0xc74fcc[_0x1800('0x1d')]?_0xc74fcc['options'][_0x1800('0x1e')]===undefined?!![]:![]:!![]})[_0x1800('0x10')](function(_0x634b1e){logger[_0x1800('0x11')](_0x1800('0x25'),_0xc74fcc);logger[_0x1800('0x13')]('CreateVoiceQueueReport',_0xc74fcc,JSON[_0x1800('0x16')](_0x634b1e));_0x5e765b(_0x634b1e);})[_0x1800('0x1b')](function(_0x53c602){logger[_0x1800('0x17')]('CreateVoiceQueueReport',_0x53c602[_0x1800('0x19')],_0xc74fcc);_0x52ecb8(_0x1228a4[_0x1800('0x17')](0x1f4,_0x53c602['message']));});});};exports[_0x1800('0x28')]=function(_0x153667){var _0x439bf8=this;return new Promise(function(_0x101c17,_0x214744){return db[_0x1800('0x1c')][_0x1800('0x29')](_0x153667['body'],{'raw':_0x153667[_0x1800('0x1d')]?_0x153667['options'][_0x1800('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153667['options']?_0x153667[_0x1800('0x1d')][_0x1800('0x2a')]||null:null,'attributes':_0x153667[_0x1800('0x1d')]?_0x153667[_0x1800('0x1d')][_0x1800('0x1f')]||null:null,'limit':_0x153667['options']?_0x153667['options']['limit']||null:null})['then'](function(_0x3b9171){logger[_0x1800('0x11')](_0x1800('0x28'),_0x153667);logger[_0x1800('0x13')](_0x1800('0x28'),_0x153667,JSON[_0x1800('0x16')](_0x3b9171));_0x101c17(_0x3b9171);})[_0x1800('0x1b')](function(_0x261425){logger[_0x1800('0x17')](_0x1800('0x28'),_0x261425[_0x1800('0x19')],_0x153667);_0x214744(_0x439bf8['error'](0x1f4,_0x261425[_0x1800('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 84b3357..0dd430e 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 _0x3512=['removeListener','register','length','voiceQueueReport:','save','remove','update','emit'];(function(_0x3abd18,_0x356e7b){var _0x14d4e8=function(_0x42aa78){while(--_0x42aa78){_0x3abd18['push'](_0x3abd18['shift']());}};_0x14d4e8(++_0x356e7b);}(_0x3512,0x84));var _0x2351=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3512[_0x122ef9];return _0x42fba0;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x2351('0x0'),_0x2351('0x1'),_0x2351('0x2')];function createListener(_0x39cd3b,_0x3ce06e){return function(_0x275d58){_0x3ce06e[_0x2351('0x3')](_0x39cd3b,_0x275d58);};}function removeListener(_0x15c654,_0x4f30e0){return function(){VoiceQueueReportEvents[_0x2351('0x4')](_0x15c654,_0x4f30e0);};}exports[_0x2351('0x5')]=function(_0x453836){for(var _0x134777=0x0,_0x431564=events[_0x2351('0x6')];_0x134777<_0x431564;_0x134777++){var _0x1988fe=events[_0x134777];var _0xe9242a=createListener(_0x2351('0x7')+_0x1988fe,_0x453836);VoiceQueueReportEvents['on'](_0x1988fe,_0xe9242a);}}; \ No newline at end of file +var _0x0356=['save','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x0356,0x1b2));var _0x6035=function(_0x4df662,_0x87849b){_0x4df662=_0x4df662-0x0;var _0x1675ea=_0x0356[_0x4df662];return _0x1675ea;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x6035('0x0'),'remove',_0x6035('0x1')];function createListener(_0x2d6cab,_0x31304f){return function(_0x16a9fd){_0x31304f[_0x6035('0x2')](_0x2d6cab,_0x16a9fd);};}function removeListener(_0x4793d9,_0x3040c1){return function(){VoiceQueueReportEvents[_0x6035('0x3')](_0x4793d9,_0x3040c1);};}exports[_0x6035('0x4')]=function(_0x1debb9){for(var _0x4b729c=0x0,_0xbe4898=events[_0x6035('0x5')];_0x4b729c<_0xbe4898;_0x4b729c++){var _0x188d76=events[_0x4b729c];var _0x48f143=createListener(_0x6035('0x6')+_0x188d76,_0x1debb9);VoiceQueueReportEvents['on'](_0x188d76,_0x48f143);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index edca0c3..7ac3e93 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 _0xd62b=['../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','path'];(function(_0x5d58ad,_0x405cca){var _0x2870ff=function(_0x117511){while(--_0x117511){_0x5d58ad['push'](_0x5d58ad['shift']());}};_0x2870ff(++_0x405cca);}(_0xd62b,0xdd));var _0xbd62=function(_0x57cb4f,_0x541f57){_0x57cb4f=_0x57cb4f-0x0;var _0x29bb45=_0xd62b[_0x57cb4f];return _0x29bb45;};'use strict';var multer=require(_0xbd62('0x0'));var util=require(_0xbd62('0x1'));var path=require(_0xbd62('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xbd62('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbd62('0x4'));var controller=require(_0xbd62('0x5'));router[_0xbd62('0x6')]('/',auth[_0xbd62('0x7')](),controller[_0xbd62('0x8')]);router[_0xbd62('0x6')](_0xbd62('0x9'),auth[_0xbd62('0x7')](),controller[_0xbd62('0xa')]);router[_0xbd62('0xb')]('/',auth[_0xbd62('0x7')](),controller['create']);router[_0xbd62('0xc')](_0xbd62('0x9'),auth[_0xbd62('0x7')](),controller[_0xbd62('0xd')]);router[_0xbd62('0xe')](_0xbd62('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xbd62('0xf')]=router; \ No newline at end of file +var _0xf3b0=['index','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x128d68,_0x555a32){var _0x24ad4d=function(_0x101a3a){while(--_0x101a3a){_0x128d68['push'](_0x128d68['shift']());}};_0x24ad4d(++_0x555a32);}(_0xf3b0,0x15d));var _0x0f3b=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0xf3b0[_0xa3fadc];return _0x23ecb8;};'use strict';var multer=require('multer');var util=require(_0x0f3b('0x0'));var path=require(_0x0f3b('0x1'));var timeout=require(_0x0f3b('0x2'));var express=require('express');var router=express[_0x0f3b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0f3b('0x4'));var config=require(_0x0f3b('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0x0f3b('0x6')]('/',auth[_0x0f3b('0x7')](),controller[_0x0f3b('0x8')]);router['get'](_0x0f3b('0x9'),auth[_0x0f3b('0x7')](),controller[_0x0f3b('0xa')]);router[_0x0f3b('0xb')]('/',auth['isAuthenticated'](),controller[_0x0f3b('0xc')]);router[_0x0f3b('0xd')](_0x0f3b('0x9'),auth[_0x0f3b('0x7')](),controller[_0x0f3b('0xe')]);router[_0x0f3b('0xf')](_0x0f3b('0x9'),auth[_0x0f3b('0x7')](),controller['destroy']);module[_0x0f3b('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index fc6bd68..c687520 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 _0xcc68=['exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5b2a83,_0x14c2f4){var _0x326dfa=function(_0x1c7e04){while(--_0x1c7e04){_0x5b2a83['push'](_0x5b2a83['shift']());}};_0x326dfa(++_0x14c2f4);}(_0xcc68,0xf4));var _0x8cc6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcc68[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8cc6('0x0'));module[_0x8cc6('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x8cc6('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x8cc6('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x8cc6('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x8cc6('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x8cc6('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x8cc6('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x8cc6('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x8cc6('0x3')](_0x8cc6('0x4'))}}; \ No newline at end of file +var _0x7375=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','exports','STRING'];(function(_0xdae8e5,_0x532e71){var _0x118dc3=function(_0x5aaf86){while(--_0x5aaf86){_0xdae8e5['push'](_0xdae8e5['shift']());}};_0x118dc3(++_0x532e71);}(_0x7375,0x12a));var _0x5737=function(_0x4bcc31,_0x2b92a0){_0x4bcc31=_0x4bcc31-0x0;var _0x3b3065=_0x7375[_0x4bcc31];return _0x3b3065;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x5737('0x0')]={'time':{'type':Sequelize[_0x5737('0x1')]},'callid':{'type':Sequelize[_0x5737('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x5737('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5737('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5737('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x5737('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5737('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5737('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x5737('0x2')],'allowNull':![],'defaultValue':moment()[_0x5737('0x3')](_0x5737('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index aace7aa..12d9a29 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 _0x8177=['mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','VoiceQueuesLog','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8177,0x8d));var _0x7817=function(_0x5a442d,_0x5c7379){_0x5a442d=_0x5a442d-0x0;var _0xbe91f1=_0x8177[_0x5a442d];return _0xbe91f1;};'use strict';var pdf=require(_0x7817('0x0'));var emlformat=require(_0x7817('0x1'));var rimraf=require(_0x7817('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7817('0x3'));var rp=require(_0x7817('0x4'));var moment=require(_0x7817('0x5'));var BPromise=require(_0x7817('0x6'));var Mustache=require(_0x7817('0x7'));var util=require(_0x7817('0x8'));var path=require(_0x7817('0x9'));var sox=require('sox');var csv=require(_0x7817('0xa'));var ejs=require(_0x7817('0xb'));var fs=require('fs');var _=require(_0x7817('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7817('0xd'));var deskjs=require(_0x7817('0xe'));var toCsv=require(_0x7817('0xa'));var querystring=require('querystring');var Papa=require(_0x7817('0xf'));var Redis=require(_0x7817('0x10'));var authService=require(_0x7817('0x11'));var qs=require(_0x7817('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7817('0x13'))('api');var utils=require(_0x7817('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7817('0x15'));var db=require(_0x7817('0x16'))['db'];function respondWithStatusCode(_0x31003b,_0x5f0cf1){_0x5f0cf1=_0x5f0cf1||0xcc;return function(_0x2990a3){if(_0x2990a3){return _0x31003b[_0x7817('0x17')](_0x5f0cf1);}return _0x31003b[_0x7817('0x18')](_0x5f0cf1)[_0x7817('0x19')]();};}function respondWithResult(_0x5a2e8a,_0x261f1b){_0x261f1b=_0x261f1b||0xc8;return function(_0x56fc44){if(_0x56fc44){return _0x5a2e8a[_0x7817('0x18')](_0x261f1b)[_0x7817('0x1a')](_0x56fc44);}};}function respondWithFilteredResult(_0x2645ca,_0x5a330d){return function(_0x2acd08){if(_0x2acd08){var _0x2fd7dc=_0x2acd08[_0x7817('0x1b')],_0x266b68=_0x5a330d[_0x7817('0x1c')],_0x113860=_0x5a330d[_0x7817('0x1c')]+_0x5a330d[_0x7817('0x1d')],_0x5d2141;if(_0x113860>=_0x2fd7dc){_0x113860=_0x2fd7dc;_0x5d2141=0xc8;}else{_0x5d2141=0xce;}_0x2645ca[_0x7817('0x18')](_0x5d2141);return _0x2645ca[_0x7817('0x1e')](_0x7817('0x1f'),_0x266b68+'-'+_0x113860+'/'+_0x2fd7dc)[_0x7817('0x1a')](_0x2acd08);}return null;};}function patchUpdates(_0x5ce8c7){return function(_0xc00dcb){try{jsonpatch['apply'](_0xc00dcb,_0x5ce8c7,!![]);}catch(_0x126827){return BPromise[_0x7817('0x20')](_0x126827);}return _0xc00dcb[_0x7817('0x21')]();};}function saveUpdates(_0x5cd9ef,_0x2090b2){return function(_0x6481ee){if(_0x6481ee){return _0x6481ee[_0x7817('0x22')](_0x5cd9ef)['then'](function(_0x34c7a2){return _0x34c7a2;});}return null;};}function removeEntity(_0x3c19a8,_0x4e93da){return function(_0x2187aa){if(_0x2187aa){return _0x2187aa[_0x7817('0x23')]()[_0x7817('0x24')](function(){_0x3c19a8[_0x7817('0x18')](0xcc)[_0x7817('0x19')]();});}};}function handleEntityNotFound(_0x5bb1be,_0x229899){return function(_0x261bc6){if(!_0x261bc6){_0x5bb1be[_0x7817('0x17')](0x194);}return _0x261bc6;};}function handleError(_0x5a2ba7,_0xf724c4){_0xf724c4=_0xf724c4||0x1f4;return function(_0x4a339a){logger[_0x7817('0x25')](_0x4a339a[_0x7817('0x26')]);if(_0x4a339a[_0x7817('0x27')]){delete _0x4a339a[_0x7817('0x27')];}_0x5a2ba7['status'](_0xf724c4)[_0x7817('0x28')](_0x4a339a);};}exports['index']=function(_0x107e14,_0x52fc27){var _0x2f0283={},_0x58054f={},_0x45e800={'count':0x0,'rows':[]};var _0x2d5726=_[_0x7817('0x29')](db[_0x7817('0x2a')]['rawAttributes'],function(_0x1a14cb){return{'name':_0x1a14cb[_0x7817('0x2b')],'type':_0x1a14cb[_0x7817('0x2c')][_0x7817('0x2d')]};});_0x58054f[_0x7817('0x2e')]=_['map'](_0x2d5726,'name');_0x58054f[_0x7817('0x2f')]=_['keys'](_0x107e14[_0x7817('0x2f')]);_0x58054f[_0x7817('0x30')]=_[_0x7817('0x31')](_0x58054f['model'],_0x58054f[_0x7817('0x2f')]);_0x2f0283[_0x7817('0x32')]=_[_0x7817('0x31')](_0x58054f[_0x7817('0x2e')],qs[_0x7817('0x33')](_0x107e14[_0x7817('0x2f')][_0x7817('0x33')]));_0x2f0283['attributes']=_0x2f0283[_0x7817('0x32')][_0x7817('0x34')]?_0x2f0283[_0x7817('0x32')]:_0x58054f[_0x7817('0x2e')];if(!_0x107e14[_0x7817('0x2f')][_0x7817('0x35')](_0x7817('0x36'))){_0x2f0283[_0x7817('0x1d')]=qs[_0x7817('0x1d')](_0x107e14[_0x7817('0x2f')]['limit']);_0x2f0283[_0x7817('0x1c')]=qs[_0x7817('0x1c')](_0x107e14[_0x7817('0x2f')][_0x7817('0x1c')]);}_0x2f0283[_0x7817('0x37')]=qs[_0x7817('0x38')](_0x107e14['query'][_0x7817('0x38')]);_0x2f0283[_0x7817('0x39')]=qs[_0x7817('0x30')](_['pick'](_0x107e14['query'],_0x58054f[_0x7817('0x30')]),_0x2d5726);if(_0x107e14[_0x7817('0x2f')][_0x7817('0x3a')]){_0x2f0283['where']=_[_0x7817('0x3b')](_0x2f0283[_0x7817('0x39')],{'$or':_[_0x7817('0x29')](_0x2d5726,function(_0x13878d){if(_0x13878d[_0x7817('0x2c')]!==_0x7817('0x3c')){var _0x15f951={};_0x15f951[_0x13878d[_0x7817('0x27')]]={'$like':'%'+_0x107e14['query'][_0x7817('0x3a')]+'%'};return _0x15f951;}})});}_0x2f0283=_[_0x7817('0x3b')]({},_0x2f0283,_0x107e14[_0x7817('0x3d')]);var _0x53ae76={'where':_0x2f0283[_0x7817('0x39')]};return db[_0x7817('0x2a')]['count'](_0x53ae76)[_0x7817('0x24')](function(_0x2e5604){_0x45e800['count']=_0x2e5604;if(_0x107e14['query'][_0x7817('0x3e')]){_0x2f0283[_0x7817('0x3f')]=[{'all':!![]}];}return db[_0x7817('0x2a')][_0x7817('0x40')](_0x2f0283);})[_0x7817('0x24')](function(_0x824fbe){_0x45e800[_0x7817('0x41')]=_0x824fbe;return _0x45e800;})[_0x7817('0x24')](respondWithFilteredResult(_0x52fc27,_0x2f0283))[_0x7817('0x42')](handleError(_0x52fc27,null));};exports[_0x7817('0x43')]=function(_0x491db5,_0x1ed206){var _0x1dae15={'raw':!![],'where':{'id':_0x491db5[_0x7817('0x44')]['id']}},_0x2bfb4e={};_0x2bfb4e[_0x7817('0x2e')]=_[_0x7817('0x45')](db[_0x7817('0x2a')][_0x7817('0x46')]);_0x2bfb4e[_0x7817('0x2f')]=_[_0x7817('0x45')](_0x491db5[_0x7817('0x2f')]);_0x2bfb4e[_0x7817('0x30')]=_['intersection'](_0x2bfb4e['model'],_0x2bfb4e[_0x7817('0x2f')]);_0x1dae15[_0x7817('0x32')]=_[_0x7817('0x31')](_0x2bfb4e[_0x7817('0x2e')],qs['fields'](_0x491db5['query'][_0x7817('0x33')]));_0x1dae15[_0x7817('0x32')]=_0x1dae15[_0x7817('0x32')]['length']?_0x1dae15[_0x7817('0x32')]:_0x2bfb4e[_0x7817('0x2e')];if(_0x491db5['query'][_0x7817('0x3e')]){_0x1dae15[_0x7817('0x3f')]=[{'all':!![]}];}_0x1dae15=_[_0x7817('0x3b')]({},_0x1dae15,_0x491db5[_0x7817('0x3d')]);return db[_0x7817('0x2a')][_0x7817('0x47')](_0x1dae15)['then'](handleEntityNotFound(_0x1ed206,null))[_0x7817('0x24')](respondWithResult(_0x1ed206,null))['catch'](handleError(_0x1ed206,null));};exports[_0x7817('0x48')]=function(_0x4c967b,_0x23a970){return db[_0x7817('0x2a')][_0x7817('0x48')](_0x4c967b[_0x7817('0x49')],{})[_0x7817('0x24')](respondWithResult(_0x23a970,0xc9))[_0x7817('0x42')](handleError(_0x23a970,null));};exports[_0x7817('0x22')]=function(_0x521515,_0x27c63e){if(_0x521515['body']['id']){delete _0x521515[_0x7817('0x49')]['id'];}return db[_0x7817('0x2a')][_0x7817('0x47')]({'where':{'id':_0x521515[_0x7817('0x44')]['id']}})[_0x7817('0x24')](handleEntityNotFound(_0x27c63e,null))['then'](saveUpdates(_0x521515[_0x7817('0x49')],null))['then'](respondWithResult(_0x27c63e,null))[_0x7817('0x42')](handleError(_0x27c63e,null));};exports[_0x7817('0x23')]=function(_0x22cae0,_0x132c85){return db[_0x7817('0x2a')][_0x7817('0x47')]({'where':{'id':_0x22cae0[_0x7817('0x44')]['id']}})['then'](handleEntityNotFound(_0x132c85,null))[_0x7817('0x24')](removeEntity(_0x132c85,null))['catch'](handleError(_0x132c85,null));}; \ No newline at end of file +var _0x7871=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','update','then','destroy','error','stack','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','rows','catch','show','params','keys','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xf31c60,_0x22978b){var _0x29f6f1=function(_0x1551ec){while(--_0x1551ec){_0xf31c60['push'](_0xf31c60['shift']());}};_0x29f6f1(++_0x22978b);}(_0x7871,0xca));var _0x1787=function(_0x4a3c84,_0x4453b1){_0x4a3c84=_0x4a3c84-0x0;var _0x3dbd1f=_0x7871[_0x4a3c84];return _0x3dbd1f;};'use strict';var pdf=require(_0x1787('0x0'));var emlformat=require(_0x1787('0x1'));var rimraf=require(_0x1787('0x2'));var zipdir=require(_0x1787('0x3'));var jsonpatch=require(_0x1787('0x4'));var rp=require(_0x1787('0x5'));var moment=require(_0x1787('0x6'));var BPromise=require(_0x1787('0x7'));var Mustache=require(_0x1787('0x8'));var util=require(_0x1787('0x9'));var path=require(_0x1787('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1787('0xb'));var fs=require('fs');var _=require(_0x1787('0xc'));var squel=require(_0x1787('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1787('0xe'));var toCsv=require(_0x1787('0xf'));var querystring=require(_0x1787('0x10'));var Papa=require('papaparse');var Redis=require(_0x1787('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1787('0x12'));var as=require(_0x1787('0x13'));var hardwareService=require(_0x1787('0x14'));var logger=require(_0x1787('0x15'))(_0x1787('0x16'));var utils=require(_0x1787('0x17'));var config=require(_0x1787('0x18'));var licenseUtil=require(_0x1787('0x19'));var db=require(_0x1787('0x1a'))['db'];function respondWithStatusCode(_0x2ed671,_0x154180){_0x154180=_0x154180||0xcc;return function(_0x4804b9){if(_0x4804b9){return _0x2ed671[_0x1787('0x1b')](_0x154180);}return _0x2ed671[_0x1787('0x1c')](_0x154180)[_0x1787('0x1d')]();};}function respondWithResult(_0x14e71c,_0x13ad68){_0x13ad68=_0x13ad68||0xc8;return function(_0x370ac4){if(_0x370ac4){return _0x14e71c['status'](_0x13ad68)['json'](_0x370ac4);}};}function respondWithFilteredResult(_0x41fdbb,_0x2a05e0){return function(_0x92a9c7){if(_0x92a9c7){var _0x51511c=_0x92a9c7['count'],_0xd6a754=_0x2a05e0['offset'],_0x299a4b=_0x2a05e0[_0x1787('0x1e')]+_0x2a05e0[_0x1787('0x1f')],_0x58ad4f;if(_0x299a4b>=_0x51511c){_0x299a4b=_0x51511c;_0x58ad4f=0xc8;}else{_0x58ad4f=0xce;}_0x41fdbb[_0x1787('0x1c')](_0x58ad4f);return _0x41fdbb['set'](_0x1787('0x20'),_0xd6a754+'-'+_0x299a4b+'/'+_0x51511c)[_0x1787('0x21')](_0x92a9c7);}return null;};}function patchUpdates(_0x3ab056){return function(_0xdc1b97){try{jsonpatch[_0x1787('0x22')](_0xdc1b97,_0x3ab056,!![]);}catch(_0x15918b){return BPromise['reject'](_0x15918b);}return _0xdc1b97['save']();};}function saveUpdates(_0x57c9d5,_0x4b60e5){return function(_0x5ecdfe){if(_0x5ecdfe){return _0x5ecdfe[_0x1787('0x23')](_0x57c9d5)[_0x1787('0x24')](function(_0xf900ee){return _0xf900ee;});}return null;};}function removeEntity(_0x47244a,_0x11ad37){return function(_0xd6edbc){if(_0xd6edbc){return _0xd6edbc[_0x1787('0x25')]()['then'](function(){_0x47244a[_0x1787('0x1c')](0xcc)[_0x1787('0x1d')]();});}};}function handleEntityNotFound(_0x1b6a85,_0x365c60){return function(_0x35a17d){if(!_0x35a17d){_0x1b6a85['sendStatus'](0x194);}return _0x35a17d;};}function handleError(_0x4bbe7a,_0x2175ad){_0x2175ad=_0x2175ad||0x1f4;return function(_0x4b240a){logger[_0x1787('0x26')](_0x4b240a[_0x1787('0x27')]);if(_0x4b240a['name']){delete _0x4b240a['name'];}_0x4bbe7a[_0x1787('0x1c')](_0x2175ad)['send'](_0x4b240a);};}exports[_0x1787('0x28')]=function(_0x145f73,_0x40b0c7){var _0x11a900={},_0x547e18={},_0x1567d0={'count':0x0,'rows':[]};var _0x297266=_[_0x1787('0x29')](db[_0x1787('0x2a')][_0x1787('0x2b')],function(_0x51a4e7){return{'name':_0x51a4e7[_0x1787('0x2c')],'type':_0x51a4e7[_0x1787('0x2d')][_0x1787('0x2e')]};});_0x547e18[_0x1787('0x2f')]=_[_0x1787('0x29')](_0x297266,_0x1787('0x30'));_0x547e18[_0x1787('0x31')]=_['keys'](_0x145f73[_0x1787('0x31')]);_0x547e18[_0x1787('0x32')]=_[_0x1787('0x33')](_0x547e18[_0x1787('0x2f')],_0x547e18[_0x1787('0x31')]);_0x11a900[_0x1787('0x34')]=_[_0x1787('0x33')](_0x547e18[_0x1787('0x2f')],qs[_0x1787('0x35')](_0x145f73[_0x1787('0x31')][_0x1787('0x35')]));_0x11a900['attributes']=_0x11a900[_0x1787('0x34')][_0x1787('0x36')]?_0x11a900[_0x1787('0x34')]:_0x547e18['model'];if(!_0x145f73[_0x1787('0x31')]['hasOwnProperty'](_0x1787('0x37'))){_0x11a900[_0x1787('0x1f')]=qs['limit'](_0x145f73[_0x1787('0x31')]['limit']);_0x11a900[_0x1787('0x1e')]=qs[_0x1787('0x1e')](_0x145f73[_0x1787('0x31')][_0x1787('0x1e')]);}_0x11a900[_0x1787('0x38')]=qs[_0x1787('0x39')](_0x145f73['query'][_0x1787('0x39')]);_0x11a900[_0x1787('0x3a')]=qs[_0x1787('0x32')](_['pick'](_0x145f73[_0x1787('0x31')],_0x547e18[_0x1787('0x32')]),_0x297266);if(_0x145f73[_0x1787('0x31')][_0x1787('0x3b')]){_0x11a900['where']=_['merge'](_0x11a900['where'],{'$or':_[_0x1787('0x29')](_0x297266,function(_0x1e5ff5){if(_0x1e5ff5['type']!==_0x1787('0x3c')){var _0x5bd411={};_0x5bd411[_0x1e5ff5[_0x1787('0x30')]]={'$like':'%'+_0x145f73[_0x1787('0x31')][_0x1787('0x3b')]+'%'};return _0x5bd411;}})});}_0x11a900=_[_0x1787('0x3d')]({},_0x11a900,_0x145f73['options']);var _0x48bfa1={'where':_0x11a900[_0x1787('0x3a')]};return db[_0x1787('0x2a')][_0x1787('0x3e')](_0x48bfa1)[_0x1787('0x24')](function(_0x54b312){_0x1567d0[_0x1787('0x3e')]=_0x54b312;if(_0x145f73[_0x1787('0x31')][_0x1787('0x3f')]){_0x11a900[_0x1787('0x40')]=[{'all':!![]}];}return db[_0x1787('0x2a')]['findAll'](_0x11a900);})[_0x1787('0x24')](function(_0x50e19f){_0x1567d0[_0x1787('0x41')]=_0x50e19f;return _0x1567d0;})[_0x1787('0x24')](respondWithFilteredResult(_0x40b0c7,_0x11a900))[_0x1787('0x42')](handleError(_0x40b0c7,null));};exports[_0x1787('0x43')]=function(_0x32fa03,_0x29a1a5){var _0x33563b={'raw':!![],'where':{'id':_0x32fa03[_0x1787('0x44')]['id']}},_0x3f5328={};_0x3f5328[_0x1787('0x2f')]=_[_0x1787('0x45')](db[_0x1787('0x2a')][_0x1787('0x2b')]);_0x3f5328['query']=_[_0x1787('0x45')](_0x32fa03[_0x1787('0x31')]);_0x3f5328[_0x1787('0x32')]=_[_0x1787('0x33')](_0x3f5328[_0x1787('0x2f')],_0x3f5328[_0x1787('0x31')]);_0x33563b[_0x1787('0x34')]=_[_0x1787('0x33')](_0x3f5328[_0x1787('0x2f')],qs[_0x1787('0x35')](_0x32fa03['query'][_0x1787('0x35')]));_0x33563b['attributes']=_0x33563b[_0x1787('0x34')][_0x1787('0x36')]?_0x33563b['attributes']:_0x3f5328[_0x1787('0x2f')];if(_0x32fa03[_0x1787('0x31')][_0x1787('0x3f')]){_0x33563b[_0x1787('0x40')]=[{'all':!![]}];}_0x33563b=_[_0x1787('0x3d')]({},_0x33563b,_0x32fa03[_0x1787('0x46')]);return db[_0x1787('0x2a')][_0x1787('0x47')](_0x33563b)[_0x1787('0x24')](handleEntityNotFound(_0x29a1a5,null))[_0x1787('0x24')](respondWithResult(_0x29a1a5,null))['catch'](handleError(_0x29a1a5,null));};exports['create']=function(_0x46446c,_0x247577){return db[_0x1787('0x2a')][_0x1787('0x48')](_0x46446c[_0x1787('0x49')],{})[_0x1787('0x24')](respondWithResult(_0x247577,0xc9))['catch'](handleError(_0x247577,null));};exports[_0x1787('0x23')]=function(_0x42cb5e,_0x20bb3a){if(_0x42cb5e['body']['id']){delete _0x42cb5e[_0x1787('0x49')]['id'];}return db[_0x1787('0x2a')][_0x1787('0x47')]({'where':{'id':_0x42cb5e[_0x1787('0x44')]['id']}})[_0x1787('0x24')](handleEntityNotFound(_0x20bb3a,null))[_0x1787('0x24')](saveUpdates(_0x42cb5e[_0x1787('0x49')],null))[_0x1787('0x24')](respondWithResult(_0x20bb3a,null))[_0x1787('0x42')](handleError(_0x20bb3a,null));};exports['destroy']=function(_0x58219a,_0x212e86){return db[_0x1787('0x2a')][_0x1787('0x47')]({'where':{'id':_0x58219a[_0x1787('0x44')]['id']}})[_0x1787('0x24')](handleEntityNotFound(_0x212e86,null))[_0x1787('0x24')](removeEntity(_0x212e86,null))['catch'](handleError(_0x212e86,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 0d51b88..bbf5ba1 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 _0x7700=['event_dtm','event','dtm','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7700,0xf3));var _0x0770=function(_0x3a023f,_0x3a0789){_0x3a023f=_0x3a023f-0x0;var _0x1de363=_0x7700[_0x3a023f];return _0x1de363;};'use strict';var _=require(_0x0770('0x0'));var util=require(_0x0770('0x1'));var logger=require(_0x0770('0x2'))('api');var moment=require(_0x0770('0x3'));var BPromise=require(_0x0770('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0770('0x5'));var rimraf=require('rimraf');var config=require(_0x0770('0x6'));var attributes=require(_0x0770('0x7'));module[_0x0770('0x8')]=function(_0x44ff60,_0x476dd9){return _0x44ff60[_0x0770('0x9')](_0x0770('0xa'),attributes,{'tableName':_0x0770('0xb'),'paranoid':![],'indexes':[{'name':_0x0770('0xc'),'fields':[_0x0770('0xd'),_0x0770('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe29d=['bluebird','request-promise','path','rimraf','../../config/environment','define','event_dtm','util','../../config/logger'];(function(_0x571610,_0x594568){var _0xdec4c3=function(_0x48ee7d){while(--_0x48ee7d){_0x571610['push'](_0x571610['shift']());}};_0xdec4c3(++_0x594568);}(_0xe29d,0x15d));var _0xde29=function(_0x3bfd35,_0x2a4c16){_0x3bfd35=_0x3bfd35-0x0;var _0x2f3caa=_0xe29d[_0x3bfd35];return _0x2f3caa;};'use strict';var _=require('lodash');var util=require(_0xde29('0x0'));var logger=require(_0xde29('0x1'))('api');var moment=require('moment');var BPromise=require(_0xde29('0x2'));var rp=require(_0xde29('0x3'));var fs=require('fs');var path=require(_0xde29('0x4'));var rimraf=require(_0xde29('0x5'));var config=require(_0xde29('0x6'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x1775b9,_0xa1e379){return _0x1775b9[_0xde29('0x7')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xde29('0x8'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ca860be..15a02b1 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 _0x0abf=['catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0abf,0xe8));var _0xf0ab=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x0abf[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});} \ No newline at end of file +var _0x0833=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12df0c,_0x3828a2){var _0x56f30b=function(_0x1821e9){while(--_0x1821e9){_0x12df0c['push'](_0x12df0c['shift']());}};_0x56f30b(++_0x3828a2);}(_0x0833,0x1bd));var _0x3083=function(_0x493280,_0x3c43d1){_0x493280=_0x493280-0x0;var _0xa08c5c=_0x0833[_0x493280];return _0xa08c5c;};'use strict';var _=require(_0x3083('0x0'));var util=require(_0x3083('0x1'));var moment=require(_0x3083('0x2'));var BPromise=require(_0x3083('0x3'));var rs=require(_0x3083('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3083('0x5'))('rpc');var config=require(_0x3083('0x6'));var jayson=require(_0x3083('0x7'));var client=jayson[_0x3083('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f9c3a,_0x1378a5,_0x529df1){return new BPromise(function(_0x5591b0,_0x4f51da){return client[_0x3083('0x9')](_0x2f9c3a,_0x529df1)['then'](function(_0x5cce3c){logger[_0x3083('0xa')](_0x3083('0xb'),_0x1378a5,_0x3083('0xc'));logger[_0x3083('0xd')](_0x3083('0xe'),_0x1378a5,_0x3083('0xc'),JSON[_0x3083('0xf')](_0x5cce3c));if(_0x5cce3c[_0x3083('0x10')]){if(_0x5cce3c[_0x3083('0x10')][_0x3083('0x11')]===0x1f4){logger[_0x3083('0x10')](_0x3083('0xb'),_0x1378a5,_0x5cce3c[_0x3083('0x10')][_0x3083('0x12')]);return _0x4f51da(_0x5cce3c[_0x3083('0x10')]['message']);}logger[_0x3083('0x10')](_0x3083('0xb'),_0x1378a5,_0x5cce3c['error'][_0x3083('0x12')]);return _0x5591b0(_0x5cce3c[_0x3083('0x10')]['message']);}else{logger[_0x3083('0xa')](_0x3083('0xb'),_0x1378a5,_0x3083('0xc'));_0x5591b0(_0x5cce3c[_0x3083('0x13')][_0x3083('0x12')]);}})[_0x3083('0x14')](function(_0xecb368){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1378a5,_0xecb368);_0x4f51da(_0xecb368);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index c0616b8..274d933 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 _0x60cb=['../../config/environment','./voiceRecording.controller','isAuthenticated','index','/describe','describe','/:id','show','get','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x339a04,_0x43074d){var _0x5a1416=function(_0x458012){while(--_0x458012){_0x339a04['push'](_0x339a04['shift']());}};_0x5a1416(++_0x43074d);}(_0x60cb,0x165));var _0xb60c=function(_0xcc8fc7,_0x456862){_0xcc8fc7=_0xcc8fc7-0x0;var _0x524433=_0x60cb[_0xcc8fc7];return _0x524433;};'use strict';var multer=require(_0xb60c('0x0'));var util=require('util');var path=require(_0xb60c('0x1'));var timeout=require(_0xb60c('0x2'));var express=require(_0xb60c('0x3'));var router=express[_0xb60c('0x4')]();var auth=require(_0xb60c('0x5'));var interaction=require(_0xb60c('0x6'));var config=require(_0xb60c('0x7'));var controller=require(_0xb60c('0x8'));router['get']('/',auth[_0xb60c('0x9')](),controller[_0xb60c('0xa')]);router['get'](_0xb60c('0xb'),auth['isAuthenticated'](),controller[_0xb60c('0xc')]);router['get'](_0xb60c('0xd'),auth['isAuthenticated'](),controller[_0xb60c('0xe')]);router[_0xb60c('0xf')](_0xb60c('0x10'),auth[_0xb60c('0x9')](),controller[_0xb60c('0x11')]);router[_0xb60c('0xf')](_0xb60c('0x12'),controller[_0xb60c('0x13')]);router['get'](_0xb60c('0x14'),auth[_0xb60c('0x9')](),controller[_0xb60c('0x15')]);router[_0xb60c('0x16')]('/',auth[_0xb60c('0x9')](),controller['create']);router[_0xb60c('0x16')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0xb60c('0x17')]);router[_0xb60c('0x18')]('/:id',auth[_0xb60c('0x9')](),controller[_0xb60c('0x19')]);router[_0xb60c('0x1a')](_0xb60c('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xb60c('0x1b')]=router; \ No newline at end of file +var _0xca61=['path','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','delete','multer','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca61,0x94));var _0x1ca6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xca61[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1ca6('0x0'));var util=require(_0x1ca6('0x1'));var path=require(_0x1ca6('0x2'));var timeout=require('connect-timeout');var express=require(_0x1ca6('0x3'));var router=express[_0x1ca6('0x4')]();var auth=require(_0x1ca6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1ca6('0x6'));var controller=require(_0x1ca6('0x7'));router[_0x1ca6('0x8')]('/',auth['isAuthenticated'](),controller[_0x1ca6('0x9')]);router['get'](_0x1ca6('0xa'),auth[_0x1ca6('0xb')](),controller[_0x1ca6('0xc')]);router[_0x1ca6('0x8')](_0x1ca6('0xd'),auth[_0x1ca6('0xb')](),controller[_0x1ca6('0xe')]);router[_0x1ca6('0x8')](_0x1ca6('0xf'),auth[_0x1ca6('0xb')](),controller['download']);router[_0x1ca6('0x8')](_0x1ca6('0x10'),controller[_0x1ca6('0x11')]);router[_0x1ca6('0x8')](_0x1ca6('0x12'),auth[_0x1ca6('0xb')](),controller[_0x1ca6('0x13')]);router[_0x1ca6('0x14')]('/',auth[_0x1ca6('0xb')](),controller[_0x1ca6('0x15')]);router[_0x1ca6('0x14')](_0x1ca6('0x12'),auth[_0x1ca6('0xb')](),controller[_0x1ca6('0x16')]);router['put'](_0x1ca6('0xd'),auth[_0x1ca6('0xb')](),controller[_0x1ca6('0x17')]);router[_0x1ca6('0x18')](_0x1ca6('0xd'),auth[_0x1ca6('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5d1d789..320df91 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 _0x6b48=['sequelize','moment','path','VIRTUAL','getDataValue','value','extname','STRING','channel','membername','INTEGER','NEW','TEXT','FLOAT','DATE','createdAt','MM-DD-YYYY\x20HH:mm','toString','updatedAt','format'];(function(_0x72f26e,_0x45b6ac){var _0x3b45e6=function(_0x2d302e){while(--_0x2d302e){_0x72f26e['push'](_0x72f26e['shift']());}};_0x3b45e6(++_0x45b6ac);}(_0x6b48,0x154));var _0x86b4=function(_0x1234e5,_0x51726b){_0x1234e5=_0x1234e5-0x0;var _0x57dc0c=_0x6b48[_0x1234e5];return _0x57dc0c;};'use strict';var Sequelize=require(_0x86b4('0x0'));var moment=require(_0x86b4('0x1'));var path=require(_0x86b4('0x2'));module['exports']={'format':{'type':Sequelize[_0x86b4('0x3')],'get':function(){return this[_0x86b4('0x4')](_0x86b4('0x5'))?path[_0x86b4('0x6')](this[_0x86b4('0x4')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0x86b4('0x7')]},'channel':{'type':Sequelize[_0x86b4('0x7')],'set':function(_0x5218e5){if(_0x5218e5){this['setDataValue'](_0x86b4('0x8'),_0x5218e5);this['setDataValue'](_0x86b4('0x9'),_0x5218e5['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x86b4('0x7')]},'calleridnum':{'type':Sequelize[_0x86b4('0x7')]},'calleridname':{'type':Sequelize[_0x86b4('0x7')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x86b4('0x7')]},'accountcode':{'type':Sequelize[_0x86b4('0x7')]},'context':{'type':Sequelize[_0x86b4('0x7')]},'exten':{'type':Sequelize[_0x86b4('0x7')]},'value':{'type':Sequelize[_0x86b4('0x7')]},'type':{'type':Sequelize[_0x86b4('0x7')]},'rating':{'type':Sequelize[_0x86b4('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x86b4('0x7')]},'userDisposition':{'type':Sequelize[_0x86b4('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x86b4('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0x86b4('0x7')]},'transcribeStatus':{'type':Sequelize[_0x86b4('0x7')],'defaultValue':_0x86b4('0xb')},'fileUri':{'type':Sequelize[_0x86b4('0xc')]},'fileText':{'type':Sequelize[_0x86b4('0xc')]},'failureReason':{'type':Sequelize[_0x86b4('0xc')]},'sentiment':{'type':Sequelize[_0x86b4('0x7')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x86b4('0xd')]},'sNeutral':{'type':Sequelize[_0x86b4('0xd')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x86b4('0xe')],'get':function(){return moment(this[_0x86b4('0x4')](_0x86b4('0xf')))['format'](_0x86b4('0x10'))[_0x86b4('0x11')]();}},'updatedAt':{'type':Sequelize[_0x86b4('0xe')],'get':function(){return moment(this[_0x86b4('0x4')](_0x86b4('0x12')))[_0x86b4('0x13')](_0x86b4('0x10'))['toString']();}}}; \ No newline at end of file +var _0xf98b=['INTEGER','TEXT','FLOAT','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','sequelize','moment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','membername','split'];(function(_0x39772f,_0x5605cb){var _0xc9edbf=function(_0x106a39){while(--_0x106a39){_0x39772f['push'](_0x39772f['shift']());}};_0xc9edbf(++_0x5605cb);}(_0xf98b,0xec));var _0xbf98=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf98b[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0xbf98('0x0'));var moment=require(_0xbf98('0x1'));var path=require('path');module[_0xbf98('0x2')]={'format':{'type':Sequelize[_0xbf98('0x3')],'get':function(){return this[_0xbf98('0x4')](_0xbf98('0x5'))?path[_0xbf98('0x6')](this['getDataValue'](_0xbf98('0x5'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xbf98('0x7')],'set':function(_0x466337){if(_0x466337){this['setDataValue']('channel',_0x466337);this[_0xbf98('0x8')](_0xbf98('0x9'),_0x466337[_0xbf98('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xbf98('0x7')]},'calleridnum':{'type':Sequelize[_0xbf98('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xbf98('0x7')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xbf98('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xbf98('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xbf98('0x7')]},'userDisposition':{'type':Sequelize[_0xbf98('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xbf98('0x7')]},'userThirdDisposition':{'type':Sequelize[_0xbf98('0x7')]},'location':{'type':Sequelize[_0xbf98('0xc')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0xbf98('0x7')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0xbf98('0xc')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize[_0xbf98('0xc')]},'sentiment':{'type':Sequelize[_0xbf98('0x7')]},'sPositive':{'type':Sequelize[_0xbf98('0xd')]},'sNegative':{'type':Sequelize[_0xbf98('0xd')]},'sNeutral':{'type':Sequelize[_0xbf98('0xd')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xbf98('0x4')]('createdAt'))[_0xbf98('0xe')](_0xbf98('0xf'))[_0xbf98('0x10')]();}},'updatedAt':{'type':Sequelize[_0xbf98('0x11')],'get':function(){return moment(this['getDataValue'](_0xbf98('0x12')))['format']('MM-DD-YYYY\x20HH:mm')[_0xbf98('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 8d87b2f..dfbadc5 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 _0xa099=['util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','index','map','VoiceRecording','rawAttributes','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','nolimit','limit','where','pick','type','VIRTUAL','merge','options','include','rows','catch','show','params','find','create','update','body','describe','download','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','ValidationError','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Setting','transcribe','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','transcribeAccountId','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5cb7a8,_0x269783){var _0x2a26df=function(_0x5e6d31){while(--_0x5e6d31){_0x5cb7a8['push'](_0x5cb7a8['shift']());}};_0x2a26df(++_0x269783);}(_0xa099,0x1b8));var _0x9a09=function(_0x3a887c,_0xf08d66){_0x3a887c=_0x3a887c-0x0;var _0x11730b=_0xa099[_0x3a887c];return _0x11730b;};'use strict';var pdf=require(_0x9a09('0x0'));var emlformat=require(_0x9a09('0x1'));var rimraf=require(_0x9a09('0x2'));var zipdir=require(_0x9a09('0x3'));var jsonpatch=require(_0x9a09('0x4'));var rp=require(_0x9a09('0x5'));var moment=require(_0x9a09('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9a09('0x7'));var path=require('path');var sox=require(_0x9a09('0x8'));var csv=require(_0x9a09('0x9'));var ejs=require(_0x9a09('0xa'));var fs=require('fs');var _=require(_0x9a09('0xb'));var squel=require(_0x9a09('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a09('0xd'));var deskjs=require(_0x9a09('0xe'));var toCsv=require(_0x9a09('0x9'));var querystring=require(_0x9a09('0xf'));var Papa=require(_0x9a09('0x10'));var AWS=require(_0x9a09('0x11'));var uuidv4=require('uuid/v4');var Redis=require(_0x9a09('0x12'));var authService=require(_0x9a09('0x13'));var qs=require(_0x9a09('0x14'));var as=require(_0x9a09('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a09('0x16'))(_0x9a09('0x17'));var utils=require('../../config/utils');var config=require(_0x9a09('0x18'));var licenseUtil=require(_0x9a09('0x19'));var db=require(_0x9a09('0x1a'))['db'];function respondWithStatusCode(_0x118467,_0x465cfd){_0x465cfd=_0x465cfd||0xcc;return function(_0x4315c5){if(_0x4315c5){return _0x118467['sendStatus'](_0x465cfd);}return _0x118467[_0x9a09('0x1b')](_0x465cfd)['end']();};}function respondWithResult(_0x51b9a7,_0x3d88aa){_0x3d88aa=_0x3d88aa||0xc8;return function(_0x99edb5){if(_0x99edb5){return _0x51b9a7[_0x9a09('0x1b')](_0x3d88aa)[_0x9a09('0x1c')](_0x99edb5);}};}function respondWithFilteredResult(_0x4c7551,_0x27ddc2){return function(_0x357e43){if(_0x357e43){var _0x555e53=_0x357e43[_0x9a09('0x1d')],_0x2ba867=_0x27ddc2[_0x9a09('0x1e')],_0x580ad4=_0x27ddc2[_0x9a09('0x1e')]+_0x27ddc2['limit'],_0x202ca0;if(_0x580ad4>=_0x555e53){_0x580ad4=_0x555e53;_0x202ca0=0xc8;}else{_0x202ca0=0xce;}_0x4c7551[_0x9a09('0x1b')](_0x202ca0);return _0x4c7551[_0x9a09('0x1f')](_0x9a09('0x20'),_0x2ba867+'-'+_0x580ad4+'/'+_0x555e53)['json'](_0x357e43);}return null;};}function patchUpdates(_0x43ec08){return function(_0xaae245){try{jsonpatch[_0x9a09('0x21')](_0xaae245,_0x43ec08,!![]);}catch(_0x50bace){return BPromise[_0x9a09('0x22')](_0x50bace);}return _0xaae245['save']();};}function saveUpdates(_0x9a108,_0x141f76){return function(_0x3256c2){if(_0x3256c2){return _0x3256c2['update'](_0x9a108)[_0x9a09('0x23')](function(_0x2acf57){return _0x2acf57;});}return null;};}function removeEntity(_0x11fe0f,_0xe41180){return function(_0x5c82da){if(_0x5c82da){return _0x5c82da[_0x9a09('0x24')]()[_0x9a09('0x23')](function(){_0x11fe0f[_0x9a09('0x1b')](0xcc)[_0x9a09('0x25')]();});}};}function handleEntityNotFound(_0x5e8208,_0x3c3af3){return function(_0x4767c2){if(!_0x4767c2){_0x5e8208['sendStatus'](0x194);}return _0x4767c2;};}function handleError(_0x4586fd,_0x343688){_0x343688=_0x343688||0x1f4;return function(_0x4e8970){logger['error'](_0x4e8970[_0x9a09('0x26')]);if(_0x4e8970[_0x9a09('0x27')]){delete _0x4e8970['name'];}_0x4586fd[_0x9a09('0x1b')](_0x343688)[_0x9a09('0x28')](_0x4e8970);};}exports[_0x9a09('0x29')]=function(_0x4e02f3,_0x5ef1cd){var _0x4230b9={},_0x209422={},_0x12cb0d={'count':0x0,'rows':[]};var _0x18f424=_[_0x9a09('0x2a')](db[_0x9a09('0x2b')][_0x9a09('0x2c')],function(_0x5c0f2b){return{'name':_0x5c0f2b['fieldName'],'type':_0x5c0f2b['type']['key']};});_0x209422[_0x9a09('0x2d')]=_[_0x9a09('0x2e')](_[_0x9a09('0x2a')](_0x18f424,_0x9a09('0x27')),[_0x9a09('0x2f')]);_0x209422[_0x9a09('0x30')]=_[_0x9a09('0x31')](_0x4e02f3['query']);_0x209422[_0x9a09('0x32')]=_['intersection'](_0x209422[_0x9a09('0x2d')],_0x209422['query']);_0x4230b9['attributes']=_[_0x9a09('0x33')](_0x209422[_0x9a09('0x2d')],qs[_0x9a09('0x34')](_0x4e02f3[_0x9a09('0x30')]['fields']));_0x4230b9[_0x9a09('0x35')]=_0x4230b9[_0x9a09('0x35')][_0x9a09('0x36')]?_0x4230b9[_0x9a09('0x35')]:_0x209422['model'];if(!_0x4e02f3['query']['hasOwnProperty'](_0x9a09('0x37'))){_0x4230b9[_0x9a09('0x38')]=qs[_0x9a09('0x38')](_0x4e02f3['query'][_0x9a09('0x38')]);_0x4230b9['offset']=qs[_0x9a09('0x1e')](_0x4e02f3[_0x9a09('0x30')]['offset']);}_0x4230b9['order']=qs['sort'](_0x4e02f3[_0x9a09('0x30')]['sort']);_0x4230b9[_0x9a09('0x39')]=qs[_0x9a09('0x32')](_[_0x9a09('0x3a')](_0x4e02f3[_0x9a09('0x30')],_0x209422['filters']),_0x18f424);if(_0x4e02f3[_0x9a09('0x30')]['filter']){_0x4230b9[_0x9a09('0x39')]=_['merge'](_0x4230b9['where'],{'$or':_[_0x9a09('0x2a')](_0x18f424,function(_0xd7f1a3){if(_0xd7f1a3[_0x9a09('0x3b')]!==_0x9a09('0x3c')){var _0x162cf3={};_0x162cf3[_0xd7f1a3['name']]={'$like':'%'+_0x4e02f3[_0x9a09('0x30')]['filter']+'%'};return _0x162cf3;}})});}_0x4230b9=_[_0x9a09('0x3d')]({},_0x4230b9,_0x4e02f3[_0x9a09('0x3e')]);var _0x43c52d={'where':_0x4230b9['where']};return db['VoiceRecording'][_0x9a09('0x1d')](_0x43c52d)[_0x9a09('0x23')](function(_0xecdd73){_0x12cb0d[_0x9a09('0x1d')]=_0xecdd73;if(_0x4e02f3['query']['includeAll']){_0x4230b9[_0x9a09('0x3f')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x4230b9);})[_0x9a09('0x23')](function(_0x55f395){_0x12cb0d[_0x9a09('0x40')]=_0x55f395;return _0x12cb0d;})[_0x9a09('0x23')](respondWithFilteredResult(_0x5ef1cd,_0x4230b9))[_0x9a09('0x41')](handleError(_0x5ef1cd,null));};exports[_0x9a09('0x42')]=function(_0x45783d,_0x5384a8){var _0x1156de={'raw':![],'where':{'id':_0x45783d[_0x9a09('0x43')]['id']}},_0x4ff9b5={};_0x4ff9b5['model']=_['keys'](db[_0x9a09('0x2b')][_0x9a09('0x2c')]);_0x4ff9b5[_0x9a09('0x30')]=_['keys'](_0x45783d[_0x9a09('0x30')]);_0x4ff9b5[_0x9a09('0x32')]=_[_0x9a09('0x33')](_0x4ff9b5['model'],_0x4ff9b5[_0x9a09('0x30')]);_0x1156de[_0x9a09('0x35')]=_[_0x9a09('0x33')](_0x4ff9b5[_0x9a09('0x2d')],qs[_0x9a09('0x34')](_0x45783d[_0x9a09('0x30')][_0x9a09('0x34')]));_0x1156de[_0x9a09('0x35')]=_0x1156de[_0x9a09('0x35')][_0x9a09('0x36')]?_0x1156de[_0x9a09('0x35')]:_0x4ff9b5[_0x9a09('0x2d')];if(_0x45783d[_0x9a09('0x30')]['includeAll']){_0x1156de[_0x9a09('0x3f')]=[{'all':!![]}];}_0x1156de=_[_0x9a09('0x3d')]({},_0x1156de,_0x45783d[_0x9a09('0x3e')]);return db[_0x9a09('0x2b')][_0x9a09('0x44')](_0x1156de)[_0x9a09('0x23')](handleEntityNotFound(_0x5384a8,null))[_0x9a09('0x23')](respondWithResult(_0x5384a8,null))[_0x9a09('0x41')](handleError(_0x5384a8,null));};exports[_0x9a09('0x45')]=function(_0x2a0157,_0x33b675){return db[_0x9a09('0x2b')][_0x9a09('0x45')](_0x2a0157['body'],{})['then'](respondWithResult(_0x33b675,0xc9))[_0x9a09('0x41')](handleError(_0x33b675,null));};exports[_0x9a09('0x46')]=function(_0x374d53,_0x4e68f1){if(_0x374d53[_0x9a09('0x47')]['id']){delete _0x374d53[_0x9a09('0x47')]['id'];}return db[_0x9a09('0x2b')][_0x9a09('0x44')]({'where':{'id':_0x374d53[_0x9a09('0x43')]['id']}})[_0x9a09('0x23')](handleEntityNotFound(_0x4e68f1,null))[_0x9a09('0x23')](saveUpdates(_0x374d53[_0x9a09('0x47')],null))['then'](respondWithResult(_0x4e68f1,null))[_0x9a09('0x41')](handleError(_0x4e68f1,null));};exports[_0x9a09('0x48')]=function(_0x3c6e49,_0x7d5190){return db[_0x9a09('0x2b')][_0x9a09('0x48')]()[_0x9a09('0x23')](respondWithResult(_0x7d5190,null))[_0x9a09('0x41')](handleError(_0x7d5190,null));};exports[_0x9a09('0x49')]=function(_0xf56cb3,_0x3b357f,_0x4aae2b){var _0x371b05=require('../../components/encryptor');var _0x4b9eb1=![];var _0x126035={};if(_0xf56cb3[_0x9a09('0x30')]['type']&&_0xf56cb3[_0x9a09('0x30')][_0x9a09('0x3b')]===_0x9a09('0x4a')){_0x126035['uniqueid']=_0xf56cb3['params']['id'];}else{_0x126035['id']=_0xf56cb3['params']['id'];}return db['VoiceRecording'][_0x9a09('0x44')]({'where':_0x126035,'attributes':['id',_0x9a09('0x4b')],'raw':!![]})[_0x9a09('0x23')](handleEntityNotFound(_0x3b357f,null))[_0x9a09('0x23')](function(_0x530c0a){if(_0x530c0a){var _0x27e137=_0x530c0a['value'];var _0x433b59=util[_0x9a09('0x2f')]('%s.cypher',_0x27e137);if(fs[_0x9a09('0x4c')](_0x433b59)){_0x4b9eb1=!![];return _0x371b05[_0x9a09('0x4d')](_0x433b59,_0x27e137,config[_0x9a09('0x4e')][_0x9a09('0x4f')])[_0x9a09('0x23')](function(){return _0x530c0a;});}return _0x530c0a;}})[_0x9a09('0x23')](function(_0x1f7ffe){if(_0x1f7ffe){var _0x285c9c=_0x1f7ffe[_0x9a09('0x4b')];if(!fs[_0x9a09('0x4c')](_0x285c9c)){throw new db[(_0x9a09('0x50'))]['ValidationError'](_0x9a09('0x51'));}if(_0x1f7ffe[_0x9a09('0x52')]){return _0x3b357f['download'](_0x285c9c,_0x1f7ffe[_0x9a09('0x52')]+path[_0x9a09('0x53')](_0x285c9c),function(){if(_0x4b9eb1){fs[_0x9a09('0x54')](_0x285c9c);}});}else{return _0x3b357f[_0x9a09('0x49')](_0x285c9c,function(_0xbed79f){if(_0x4b9eb1){fs[_0x9a09('0x54')](_0x285c9c);}});}}})[_0x9a09('0x41')](function(_0x264c9d){if(_0x264c9d[_0x9a09('0x55')]===_0x9a09('0x51')){_0x3b357f[_0x9a09('0x1b')](0x194)['send'](_0x9a09('0x56'));}else{return handleError(_0x3b357f,null);}});};exports[_0x9a09('0x57')]=function(_0x11d33b,_0x2655f7,_0x5dda10){var _0x2dfd54=require(_0x9a09('0x58'));var _0x4967cd=![];var _0x5ed61b={'$and':[db[_0x9a09('0x59')]['where'](db[_0x9a09('0x59')]['fn'](_0x9a09('0x5a'),db[_0x9a09('0x59')][_0x9a09('0x5b')](_0x9a09('0x4a'))),_0x11d33b[_0x9a09('0x30')][_0x9a09('0x5c')])]};if(_0x11d33b[_0x9a09('0x30')][_0x9a09('0x3b')]&&_0x11d33b[_0x9a09('0x30')]['type']==='uniqueid'){_0x5ed61b[_0x9a09('0x5d')][_0x9a09('0x5e')]({'uniqueid':_0x11d33b[_0x9a09('0x43')]['id']});}else{_0x5ed61b[_0x9a09('0x5d')][_0x9a09('0x5e')]({'id':_0x11d33b[_0x9a09('0x43')]['id']});}return db[_0x9a09('0x2b')][_0x9a09('0x44')]({'where':_0x5ed61b,'attributes':['id','value'],'raw':!![]})[_0x9a09('0x23')](handleEntityNotFound(_0x2655f7,null))[_0x9a09('0x23')](function(_0x36fd7a){if(_0x36fd7a){var _0x45f7ca=util[_0x9a09('0x2f')]('%s.cypher',_0x36fd7a[_0x9a09('0x4b')]);if(fs[_0x9a09('0x4c')](_0x45f7ca)){_0x4967cd=!![];return _0x2dfd54[_0x9a09('0x4d')](_0x45f7ca,_0x36fd7a[_0x9a09('0x4b')],config[_0x9a09('0x4e')]['recording'])[_0x9a09('0x23')](function(){return _0x36fd7a;});}return _0x36fd7a;}})[_0x9a09('0x23')](function(_0x75c644){if(_0x75c644){if(!fs[_0x9a09('0x4c')](_0x75c644['value'])){throw new db['Sequelize'][(_0x9a09('0x5f'))](_0x9a09('0x51'));}if(_0x75c644[_0x9a09('0x52')]){return _0x2655f7[_0x9a09('0x49')](_0x75c644['value'],_0x75c644[_0x9a09('0x52')]+path[_0x9a09('0x53')](_0x75c644[_0x9a09('0x4b')]),function(){if(_0x4967cd){fs[_0x9a09('0x54')](_0x75c644[_0x9a09('0x4b')]);}});}else{return _0x2655f7['download'](_0x75c644[_0x9a09('0x4b')],function(_0x2ef62f){if(_0x4967cd){fs[_0x9a09('0x54')](_0x75c644[_0x9a09('0x4b')]);}});}}})[_0x9a09('0x41')](handleError(_0x2655f7,null));};exports[_0x9a09('0x24')]=function(_0x2252f7,_0x272059){return db['VoiceRecording'][_0x9a09('0x44')]({'where':{'id':_0x2252f7[_0x9a09('0x43')]['id']}})[_0x9a09('0x23')](function(_0x5df322){if(!_0x5df322)throw new ReferenceError('Entity\x20not\x20found');return _0x5df322;})[_0x9a09('0x23')](function(_0x20b6c8){var _0x439b10=_0x20b6c8[_0x9a09('0x4b')];logger[_0x9a09('0x60')](_0x9a09('0x61'),_0x439b10);if(!_[_0x9a09('0x62')](_0x20b6c8[_0x9a09('0x4b')])&&fs[_0x9a09('0x4c')](_0x439b10)){logger[_0x9a09('0x60')]('File:\x20\x22'+_0x439b10+_0x9a09('0x63'));fs[_0x9a09('0x64')](_0x439b10);}_0x439b10=_0x439b10+_0x9a09('0x65');if(!_[_0x9a09('0x62')](_0x20b6c8['value'])&&fs['existsSync'](_0x439b10)){logger[_0x9a09('0x60')]('File:\x20\x22'+_0x439b10+_0x9a09('0x63'));fs[_0x9a09('0x64')](_0x439b10);}return _0x20b6c8;})[_0x9a09('0x23')](function(_0x252e1f){if(!_0x252e1f)throw new InternalError();return _0x252e1f[_0x9a09('0x24')]();})[_0x9a09('0x23')](function(){_0x272059['status'](0xcc)[_0x9a09('0x25')]();})[_0x9a09('0x41')](handleError(_0x272059,null));};function getBucketslist(_0x139a38,_0x463c41,_0x295048){return new Promise(function(_0x340384,_0x398f1e){var _0x205766=new AWS['S3']({'accessKeyId':_0x463c41,'secretAccessKey':_0x139a38,'region':_0x295048});_0x205766[_0x9a09('0x66')]({},function(_0xcbd4d1,_0x12f165){if(_0xcbd4d1){return _0x398f1e(_0xcbd4d1);}else{return _0x340384(_0x12f165);}});});}function createBucket(_0x3d237,_0x32b19a,_0x373bb1,_0x22874d){return new Promise(function(_0x300fd9,_0x53cafc){var _0x21bddb=new AWS['S3']({'accessKeyId':_0x32b19a,'secretAccessKey':_0x3d237,'region':_0x373bb1});_0x21bddb[_0x9a09('0x67')]({'Bucket':_0x22874d},function(_0x514f53,_0x3b158a){if(_0x514f53){return _0x53cafc(_0x514f53);}else{return _0x300fd9(_0x3b158a);}});});}function uploadFile(_0x1be35b,_0x5153f0,_0x2d491d,_0x242a55,_0x5f2717,_0x23c3f1){return new Promise(function(_0x21384b,_0x103ff1){var _0x427fc6=new AWS['S3']({'accessKeyId':_0x5153f0,'secretAccessKey':_0x1be35b,'region':_0x2d491d});_0x427fc6[_0x9a09('0x68')]({'Bucket':_0x242a55,'Key':_0x5f2717,'Body':_0x23c3f1},function(_0xec187c,_0x3836fb){if(_0xec187c){return _0x103ff1(_0xec187c);}else{return _0x21384b(_0x3836fb);}});});}function startTranscribe(_0x2ca723,_0xfbd5fe,_0x4bb437,_0x4801bd,_0x2ebc14,_0x87c9d9){return new Promise(function(_0x15a054,_0x446815){var _0x8dc86a=new AWS[(_0x9a09('0x69'))]({'accessKeyId':_0xfbd5fe,'secretAccessKey':_0x2ca723,'region':_0x4bb437});_0x8dc86a[_0x9a09('0x6a')]({'TranscriptionJobName':_0x4801bd,'LanguageCode':_0x2ebc14,'Media':{'MediaFileUri':_0x87c9d9}},function(_0x4443ce,_0x15483c){if(_0x4443ce){return _0x446815(_0x4443ce);}else{return _0x15a054(_0x15483c);}});});}function transcribe(_0x4a8002,_0x5cd247,_0x2094ca,_0x5f4a70,_0x5e8e96,_0x384507,_0x411203){return new Promise(function(_0x578510,_0x509c33){var _0x1e3dc2={};logger[_0x9a09('0x60')](util[_0x9a09('0x2f')](_0x9a09('0x6b'),_0x4a8002,_0x5e8e96));return uploadFile(_0x5cd247,_0x2094ca,_0x5f4a70,_0x5e8e96,path[_0x9a09('0x6c')](_0x384507),fs[_0x9a09('0x6d')](_0x384507))[_0x9a09('0x23')](function(_0x28678d){logger[_0x9a09('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4a8002,_0x5e8e96,_0x28678d['Location']));_0x1e3dc2[_0x9a09('0x6e')]=_0x28678d[_0x9a09('0x6f')];_0x1e3dc2[_0x9a09('0x70')]=_0x28678d[_0x9a09('0x71')];logger[_0x9a09('0x60')](util[_0x9a09('0x2f')](_0x9a09('0x72'),_0x4a8002));return startTranscribe(_0x5cd247,_0x2094ca,_0x5f4a70,uuidv4(),_0x411203,_0x28678d[_0x9a09('0x71')]);})[_0x9a09('0x23')](function(_0x3d15e7){logger[_0x9a09('0x60')](util[_0x9a09('0x2f')](_0x9a09('0x73'),_0x4a8002,_0x3d15e7[_0x9a09('0x74')][_0x9a09('0x75')]));_0x1e3dc2[_0x9a09('0x76')]=_0x3d15e7[_0x9a09('0x74')][_0x9a09('0x75')];_0x1e3dc2[_0x9a09('0x77')]=_0x3d15e7[_0x9a09('0x74')][_0x9a09('0x78')];return _0x578510(_0x1e3dc2);})['catch'](function(_0x582921){return _0x509c33(_0x582921);});});}exports[_0x9a09('0x79')]=function(_0x1cdee9,_0x536d0b,_0x3b4030){var _0x31e2bd;var _0x5e5ef3;var _0x3fee42;var _0x270886=require(_0x9a09('0x58'));return db[_0x9a09('0x2b')][_0x9a09('0x7a')]({'where':{'id':_0x1cdee9[_0x9a09('0x43')]['id']}})['then'](function(_0x52178f){if(_0x52178f){var _0x18979f=util['format'](_0x9a09('0x7b'),_0x52178f[_0x9a09('0x4b')]);if(fs[_0x9a09('0x4c')](_0x18979f)){cypher=!![];return _0x270886['decryptFile'](_0x18979f,_0x52178f['value'],config[_0x9a09('0x4e')]['recording'])[_0x9a09('0x23')](function(){return _0x52178f;});}return _0x52178f;}})[_0x9a09('0x23')](function(_0x1c41a4){if(!_0x1c41a4){throw new db['Sequelize']['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x5e5ef3=_0x1c41a4;return db[_0x9a09('0x7c')][_0x9a09('0x7a')]({'where':{'id':0x1}});})[_0x9a09('0x23')](handleEntityNotFound(_0x536d0b,null))[_0x9a09('0x23')](function(_0x1c583f){if(_0x1c583f){_0x31e2bd=_0x1c583f;if(!_0x31e2bd[_0x9a09('0x7d')]||!_0x31e2bd['transcribeAccountId']||!_0x31e2bd[_0x9a09('0x7e')]||!_0x31e2bd[_0x9a09('0x7f')]||!_0x31e2bd[_0x9a09('0x6e')]){throw new db['Sequelize'][(_0x9a09('0x5f'))](_0x9a09('0x80'));}if(_0x1cdee9[_0x9a09('0x47')]['runSentiment']&&(!_0x31e2bd[_0x9a09('0x81')]||!_0x31e2bd[_0x9a09('0x82')]||!_0x31e2bd[_0x9a09('0x83')]||!_0x31e2bd[_0x9a09('0x7f')]||!_0x31e2bd[_0x9a09('0x6e')])){throw new db[(_0x9a09('0x50'))][(_0x9a09('0x5f'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x9a09('0x7a')]({'where':{'id':_0x31e2bd[_0x9a09('0x84')]}});}})['then'](function(_0x5ac875){if(!_0x5ac875){throw new db[(_0x9a09('0x50'))][(_0x9a09('0x5f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5ac875[_0x9a09('0x85')]||!_0x5ac875[_0x9a09('0x86')]){throw new db[(_0x9a09('0x50'))][(_0x9a09('0x5f'))]('Cloud\x20Provider\x20not\x20configured');}_0x3fee42=_0x5ac875;return getBucketslist(_0x3fee42[_0x9a09('0x85')],_0x3fee42[_0x9a09('0x86')],_0x31e2bd[_0x9a09('0x7e')]);})[_0x9a09('0x23')](function(_0x4e5f58){if(_0x4e5f58&&_0x4e5f58[_0x9a09('0x87')]){var _0x200fdc=_['find'](_0x4e5f58[_0x9a09('0x87')],function(_0x590e82){return _0x590e82['Name']===_0x31e2bd[_0x9a09('0x6e')];});if(!_0x200fdc){logger[_0x9a09('0x60')](util[_0x9a09('0x2f')](_0x9a09('0x88'),_0x1cdee9[_0x9a09('0x43')]['id'],_0x31e2bd['bucket']));return createBucket(_0x3fee42[_0x9a09('0x85')],_0x3fee42['data2'],_0x31e2bd['transcribeRegion'],_0x31e2bd['bucket']);}logger[_0x9a09('0x60')](util[_0x9a09('0x2f')](_0x9a09('0x89'),_0x1cdee9[_0x9a09('0x43')]['id'],_0x31e2bd[_0x9a09('0x6e')]));return;}})[_0x9a09('0x23')](function(_0x56c5bd){if(_0x5e5ef3[_0x9a09('0x77')]===_0x9a09('0x8a')){return transcribe(_0x1cdee9[_0x9a09('0x43')]['id'],_0x3fee42[_0x9a09('0x85')],_0x3fee42[_0x9a09('0x86')],_0x31e2bd['transcribeRegion'],_0x31e2bd[_0x9a09('0x6e')],_0x5e5ef3['value'],_0x31e2bd[_0x9a09('0x7f')]);}else{logger[_0x9a09('0x60')](util[_0x9a09('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x1cdee9[_0x9a09('0x43')]['id']));return{'transcribeStatus':_0x9a09('0x8b')};}})[_0x9a09('0x23')](function(_0xa5f8f5){if(_0xa5f8f5){_0xa5f8f5[_0x9a09('0x8c')]=_0x1cdee9[_0x9a09('0x47')][_0x9a09('0x8d')];return _0x5e5ef3[_0x9a09('0x8e')](_0xa5f8f5);}})[_0x9a09('0x23')](respondWithResult(_0x536d0b,null))[_0x9a09('0x41')](handleError(_0x536d0b,null));};function writeFile(_0x4ada6a,_0x4bd4c1){return new Promise(function(_0x4d263b,_0x44ecd7){fs['writeFile'](_0x4bd4c1,_0x4ada6a,function(_0x2614a5,_0x1e01cb){if(_0x2614a5){return _0x44ecd7(_0x2614a5);}else{return _0x4d263b(_0x1e01cb);}});});}exports[_0x9a09('0x8f')]=function(_0x3b9a57,_0x4c7dd2,_0x571ae5){return db[_0x9a09('0x2b')][_0x9a09('0x7a')]({'where':{'id':_0x3b9a57[_0x9a09('0x43')]['id']}})[_0x9a09('0x23')](handleEntityNotFound(_0x4c7dd2))['then'](function(_0x51c472){if(_0x51c472&&_0x51c472[_0x9a09('0x90')]){var _0x55d9f2=_0x51c472[_0x9a09('0x90')];var _0x1ca456=config[_0x9a09('0x91')]+_0x9a09('0x92')+_0x51c472['id']+_0x9a09('0x93');if(fs[_0x9a09('0x4c')](_0x1ca456)){return _0x1ca456;}return writeFile(_0x55d9f2,_0x1ca456)[_0x9a09('0x23')](function(){return _0x1ca456;});}else{throw new db['Sequelize'][(_0x9a09('0x5f'))](_0x9a09('0x94'));}})[_0x9a09('0x23')](function(_0x542d4d){return _0x4c7dd2[_0x9a09('0x49')](_0x542d4d);})[_0x9a09('0x41')](handleError(_0x4c7dd2));}; \ No newline at end of file +var _0x4334=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','name','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','count','then','includeAll','include','rows','catch','keys','length','options','find','create','body','params','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','VoiceRecording\x20not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','sentiment','sentimentRegion','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','data1','Buckets','Name','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4334,0x88));var _0x4433=function(_0x3ae885,_0x30a66c){_0x3ae885=_0x3ae885-0x0;var _0x47571e=_0x4334[_0x3ae885];return _0x47571e;};'use strict';var pdf=require(_0x4433('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4433('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4433('0x2'));var rp=require(_0x4433('0x3'));var moment=require(_0x4433('0x4'));var BPromise=require(_0x4433('0x5'));var Mustache=require('mustache');var util=require(_0x4433('0x6'));var path=require(_0x4433('0x7'));var sox=require('sox');var csv=require(_0x4433('0x8'));var ejs=require(_0x4433('0x9'));var fs=require('fs');var _=require(_0x4433('0xa'));var squel=require(_0x4433('0xb'));var crypto=require(_0x4433('0xc'));var jsforce=require(_0x4433('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4433('0x8'));var querystring=require(_0x4433('0xe'));var Papa=require(_0x4433('0xf'));var AWS=require(_0x4433('0x10'));var uuidv4=require(_0x4433('0x11'));var Redis=require(_0x4433('0x12'));var authService=require(_0x4433('0x13'));var qs=require(_0x4433('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4433('0x15'));var logger=require(_0x4433('0x16'))(_0x4433('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4433('0x18'));var db=require(_0x4433('0x19'))['db'];function respondWithStatusCode(_0x5504c0,_0x1a0a79){_0x1a0a79=_0x1a0a79||0xcc;return function(_0x5b74dc){if(_0x5b74dc){return _0x5504c0['sendStatus'](_0x1a0a79);}return _0x5504c0[_0x4433('0x1a')](_0x1a0a79)[_0x4433('0x1b')]();};}function respondWithResult(_0x169506,_0x2dff87){_0x2dff87=_0x2dff87||0xc8;return function(_0x4c36f9){if(_0x4c36f9){return _0x169506[_0x4433('0x1a')](_0x2dff87)[_0x4433('0x1c')](_0x4c36f9);}};}function respondWithFilteredResult(_0x166da8,_0x36c10b){return function(_0x5391a7){if(_0x5391a7){var _0xaa9b1b=_0x5391a7['count'],_0xc70f1d=_0x36c10b['offset'],_0xe061d0=_0x36c10b[_0x4433('0x1d')]+_0x36c10b[_0x4433('0x1e')],_0x403928;if(_0xe061d0>=_0xaa9b1b){_0xe061d0=_0xaa9b1b;_0x403928=0xc8;}else{_0x403928=0xce;}_0x166da8[_0x4433('0x1a')](_0x403928);return _0x166da8[_0x4433('0x1f')](_0x4433('0x20'),_0xc70f1d+'-'+_0xe061d0+'/'+_0xaa9b1b)[_0x4433('0x1c')](_0x5391a7);}return null;};}function patchUpdates(_0x242b53){return function(_0x5da19e){try{jsonpatch[_0x4433('0x21')](_0x5da19e,_0x242b53,!![]);}catch(_0x31c695){return BPromise[_0x4433('0x22')](_0x31c695);}return _0x5da19e['save']();};}function saveUpdates(_0x3ecbb9,_0x5d5c71){return function(_0x3f43cf){if(_0x3f43cf){return _0x3f43cf[_0x4433('0x23')](_0x3ecbb9)['then'](function(_0x371ee9){return _0x371ee9;});}return null;};}function removeEntity(_0x5ab86a,_0x2ec11e){return function(_0x1f33e4){if(_0x1f33e4){return _0x1f33e4[_0x4433('0x24')]()['then'](function(){_0x5ab86a[_0x4433('0x1a')](0xcc)[_0x4433('0x1b')]();});}};}function handleEntityNotFound(_0x26e143,_0x46f751){return function(_0x32d6fe){if(!_0x32d6fe){_0x26e143[_0x4433('0x25')](0x194);}return _0x32d6fe;};}function handleError(_0x2fdade,_0x52724a){_0x52724a=_0x52724a||0x1f4;return function(_0x4ad75f){logger['error'](_0x4ad75f['stack']);if(_0x4ad75f['name']){delete _0x4ad75f[_0x4433('0x26')];}_0x2fdade[_0x4433('0x1a')](_0x52724a)['send'](_0x4ad75f);};}exports['index']=function(_0x31a006,_0xdb3ae8){var _0x4a922a={},_0x367dda={},_0x215da6={'count':0x0,'rows':[]};var _0x575bf9=_[_0x4433('0x27')](db[_0x4433('0x28')][_0x4433('0x29')],function(_0x4f8d7d){return{'name':_0x4f8d7d[_0x4433('0x2a')],'type':_0x4f8d7d[_0x4433('0x2b')]['key']};});_0x367dda[_0x4433('0x2c')]=_[_0x4433('0x2d')](_[_0x4433('0x27')](_0x575bf9,_0x4433('0x26')),[_0x4433('0x2e')]);_0x367dda[_0x4433('0x2f')]=_['keys'](_0x31a006[_0x4433('0x2f')]);_0x367dda[_0x4433('0x30')]=_[_0x4433('0x31')](_0x367dda[_0x4433('0x2c')],_0x367dda['query']);_0x4a922a[_0x4433('0x32')]=_[_0x4433('0x31')](_0x367dda[_0x4433('0x2c')],qs[_0x4433('0x33')](_0x31a006[_0x4433('0x2f')][_0x4433('0x33')]));_0x4a922a[_0x4433('0x32')]=_0x4a922a[_0x4433('0x32')]['length']?_0x4a922a[_0x4433('0x32')]:_0x367dda[_0x4433('0x2c')];if(!_0x31a006['query'][_0x4433('0x34')](_0x4433('0x35'))){_0x4a922a[_0x4433('0x1e')]=qs[_0x4433('0x1e')](_0x31a006[_0x4433('0x2f')][_0x4433('0x1e')]);_0x4a922a['offset']=qs[_0x4433('0x1d')](_0x31a006['query'][_0x4433('0x1d')]);}_0x4a922a['order']=qs['sort'](_0x31a006['query'][_0x4433('0x36')]);_0x4a922a[_0x4433('0x37')]=qs[_0x4433('0x30')](_[_0x4433('0x38')](_0x31a006[_0x4433('0x2f')],_0x367dda[_0x4433('0x30')]),_0x575bf9);if(_0x31a006[_0x4433('0x2f')][_0x4433('0x39')]){_0x4a922a[_0x4433('0x37')]=_[_0x4433('0x3a')](_0x4a922a['where'],{'$or':_[_0x4433('0x27')](_0x575bf9,function(_0x639c6){if(_0x639c6['type']!==_0x4433('0x3b')){var _0x391803={};_0x391803[_0x639c6[_0x4433('0x26')]]={'$like':'%'+_0x31a006[_0x4433('0x2f')][_0x4433('0x39')]+'%'};return _0x391803;}})});}_0x4a922a=_[_0x4433('0x3a')]({},_0x4a922a,_0x31a006['options']);var _0x68c297={'where':_0x4a922a[_0x4433('0x37')]};return db[_0x4433('0x28')][_0x4433('0x3c')](_0x68c297)[_0x4433('0x3d')](function(_0x17e99d){_0x215da6['count']=_0x17e99d;if(_0x31a006['query'][_0x4433('0x3e')]){_0x4a922a[_0x4433('0x3f')]=[{'all':!![]}];}return db[_0x4433('0x28')]['findAll'](_0x4a922a);})[_0x4433('0x3d')](function(_0x4bc39d){_0x215da6[_0x4433('0x40')]=_0x4bc39d;return _0x215da6;})['then'](respondWithFilteredResult(_0xdb3ae8,_0x4a922a))[_0x4433('0x41')](handleError(_0xdb3ae8,null));};exports['show']=function(_0x5a9c6e,_0x52496e){var _0x5a9f7c={'raw':![],'where':{'id':_0x5a9c6e['params']['id']}},_0x1f4e22={};_0x1f4e22['model']=_['keys'](db[_0x4433('0x28')][_0x4433('0x29')]);_0x1f4e22[_0x4433('0x2f')]=_[_0x4433('0x42')](_0x5a9c6e[_0x4433('0x2f')]);_0x1f4e22['filters']=_[_0x4433('0x31')](_0x1f4e22[_0x4433('0x2c')],_0x1f4e22['query']);_0x5a9f7c[_0x4433('0x32')]=_['intersection'](_0x1f4e22[_0x4433('0x2c')],qs[_0x4433('0x33')](_0x5a9c6e[_0x4433('0x2f')]['fields']));_0x5a9f7c[_0x4433('0x32')]=_0x5a9f7c[_0x4433('0x32')][_0x4433('0x43')]?_0x5a9f7c[_0x4433('0x32')]:_0x1f4e22[_0x4433('0x2c')];if(_0x5a9c6e[_0x4433('0x2f')]['includeAll']){_0x5a9f7c[_0x4433('0x3f')]=[{'all':!![]}];}_0x5a9f7c=_[_0x4433('0x3a')]({},_0x5a9f7c,_0x5a9c6e[_0x4433('0x44')]);return db[_0x4433('0x28')][_0x4433('0x45')](_0x5a9f7c)[_0x4433('0x3d')](handleEntityNotFound(_0x52496e,null))[_0x4433('0x3d')](respondWithResult(_0x52496e,null))[_0x4433('0x41')](handleError(_0x52496e,null));};exports['create']=function(_0x4779a3,_0x442238){return db[_0x4433('0x28')][_0x4433('0x46')](_0x4779a3['body'],{})[_0x4433('0x3d')](respondWithResult(_0x442238,0xc9))['catch'](handleError(_0x442238,null));};exports[_0x4433('0x23')]=function(_0x5cfc44,_0x5d1368){if(_0x5cfc44[_0x4433('0x47')]['id']){delete _0x5cfc44[_0x4433('0x47')]['id'];}return db['VoiceRecording'][_0x4433('0x45')]({'where':{'id':_0x5cfc44[_0x4433('0x48')]['id']}})['then'](handleEntityNotFound(_0x5d1368,null))[_0x4433('0x3d')](saveUpdates(_0x5cfc44[_0x4433('0x47')],null))[_0x4433('0x3d')](respondWithResult(_0x5d1368,null))[_0x4433('0x41')](handleError(_0x5d1368,null));};exports[_0x4433('0x49')]=function(_0x44d284,_0x4e31de){return db[_0x4433('0x28')][_0x4433('0x49')]()['then'](respondWithResult(_0x4e31de,null))['catch'](handleError(_0x4e31de,null));};exports[_0x4433('0x4a')]=function(_0x44816f,_0x14d02e,_0x21939b){var _0x253735=require(_0x4433('0x4b'));var _0x2f8c17=![];var _0x24a9a3={};if(_0x44816f[_0x4433('0x2f')][_0x4433('0x2b')]&&_0x44816f[_0x4433('0x2f')][_0x4433('0x2b')]===_0x4433('0x4c')){_0x24a9a3[_0x4433('0x4c')]=_0x44816f[_0x4433('0x48')]['id'];}else{_0x24a9a3['id']=_0x44816f['params']['id'];}return db[_0x4433('0x28')][_0x4433('0x45')]({'where':_0x24a9a3,'attributes':['id',_0x4433('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x14d02e,null))['then'](function(_0x331863){if(_0x331863){var _0x1e051a=_0x331863[_0x4433('0x4d')];var _0x348c1f=util[_0x4433('0x2e')]('%s.cypher',_0x1e051a);if(fs[_0x4433('0x4e')](_0x348c1f)){_0x2f8c17=!![];return _0x253735[_0x4433('0x4f')](_0x348c1f,_0x1e051a,config[_0x4433('0x50')][_0x4433('0x51')])[_0x4433('0x3d')](function(){return _0x331863;});}return _0x331863;}})[_0x4433('0x3d')](function(_0x2d772d){if(_0x2d772d){var _0x13ffc5=_0x2d772d[_0x4433('0x4d')];if(!fs['existsSync'](_0x13ffc5)){throw new db[(_0x4433('0x52'))][(_0x4433('0x53'))]('VoiceRecording\x20not\x20found');}if(_0x2d772d['filename']){return _0x14d02e['download'](_0x13ffc5,_0x2d772d[_0x4433('0x54')]+path[_0x4433('0x55')](_0x13ffc5),function(){if(_0x2f8c17){fs[_0x4433('0x56')](_0x13ffc5);}});}else{return _0x14d02e['download'](_0x13ffc5,function(_0x17f427){if(_0x2f8c17){fs[_0x4433('0x56')](_0x13ffc5);}});}}})[_0x4433('0x41')](function(_0x334c8f){if(_0x334c8f[_0x4433('0x57')]==='VoiceRecording\x20not\x20found'){_0x14d02e[_0x4433('0x1a')](0x194)[_0x4433('0x58')](_0x4433('0x59'));}else{return handleError(_0x14d02e,null);}});};exports[_0x4433('0x5a')]=function(_0x4bcbaa,_0x172ea8,_0x4e0658){var _0x4f436f=require(_0x4433('0x4b'));var _0x3e40c6=![];var _0x10aa4a={'$and':[db[_0x4433('0x5b')][_0x4433('0x37')](db['sequelize']['fn'](_0x4433('0x5c'),db['sequelize'][_0x4433('0x5d')](_0x4433('0x4c'))),_0x4bcbaa['query'][_0x4433('0x5e')])]};if(_0x4bcbaa['query'][_0x4433('0x2b')]&&_0x4bcbaa[_0x4433('0x2f')][_0x4433('0x2b')]==='uniqueid'){_0x10aa4a[_0x4433('0x5f')]['push']({'uniqueid':_0x4bcbaa[_0x4433('0x48')]['id']});}else{_0x10aa4a['$and'][_0x4433('0x60')]({'id':_0x4bcbaa[_0x4433('0x48')]['id']});}return db[_0x4433('0x28')][_0x4433('0x45')]({'where':_0x10aa4a,'attributes':['id',_0x4433('0x4d')],'raw':!![]})[_0x4433('0x3d')](handleEntityNotFound(_0x172ea8,null))[_0x4433('0x3d')](function(_0x202ab9){if(_0x202ab9){var _0x4ea1fa=util[_0x4433('0x2e')](_0x4433('0x61'),_0x202ab9[_0x4433('0x4d')]);if(fs['existsSync'](_0x4ea1fa)){_0x3e40c6=!![];return _0x4f436f[_0x4433('0x4f')](_0x4ea1fa,_0x202ab9[_0x4433('0x4d')],config[_0x4433('0x50')][_0x4433('0x51')])[_0x4433('0x3d')](function(){return _0x202ab9;});}return _0x202ab9;}})['then'](function(_0x34e7c7){if(_0x34e7c7){if(!fs['existsSync'](_0x34e7c7[_0x4433('0x4d')])){throw new db[(_0x4433('0x52'))][(_0x4433('0x53'))](_0x4433('0x62'));}if(_0x34e7c7['filename']){return _0x172ea8[_0x4433('0x4a')](_0x34e7c7[_0x4433('0x4d')],_0x34e7c7['filename']+path[_0x4433('0x55')](_0x34e7c7[_0x4433('0x4d')]),function(){if(_0x3e40c6){fs['unlink'](_0x34e7c7[_0x4433('0x4d')]);}});}else{return _0x172ea8[_0x4433('0x4a')](_0x34e7c7[_0x4433('0x4d')],function(_0x1f51fc){if(_0x3e40c6){fs['unlink'](_0x34e7c7['value']);}});}}})['catch'](handleError(_0x172ea8,null));};exports['destroy']=function(_0x4d7eb2,_0x4e143d){return db['VoiceRecording']['find']({'where':{'id':_0x4d7eb2['params']['id']}})[_0x4433('0x3d')](function(_0x568f5e){if(!_0x568f5e)throw new ReferenceError(_0x4433('0x63'));return _0x568f5e;})['then'](function(_0x22d94a){var _0x3d7377=_0x22d94a[_0x4433('0x4d')];logger['info'](_0x4433('0x64'),_0x3d7377);if(!_[_0x4433('0x65')](_0x22d94a[_0x4433('0x4d')])&&fs['existsSync'](_0x3d7377)){logger[_0x4433('0x66')](_0x4433('0x67')+_0x3d7377+_0x4433('0x68'));fs[_0x4433('0x69')](_0x3d7377);}_0x3d7377=_0x3d7377+_0x4433('0x6a');if(!_[_0x4433('0x65')](_0x22d94a[_0x4433('0x4d')])&&fs[_0x4433('0x4e')](_0x3d7377)){logger[_0x4433('0x66')](_0x4433('0x67')+_0x3d7377+_0x4433('0x68'));fs['unlinkSync'](_0x3d7377);}return _0x22d94a;})['then'](function(_0x19c909){if(!_0x19c909)throw new InternalError();return _0x19c909[_0x4433('0x24')]();})[_0x4433('0x3d')](function(){_0x4e143d['status'](0xcc)['end']();})[_0x4433('0x41')](handleError(_0x4e143d,null));};function getBucketslist(_0xcb540c,_0x21aae7,_0x378ad8){return new Promise(function(_0xde377e,_0xaf1467){var _0x360874=new AWS['S3']({'accessKeyId':_0x21aae7,'secretAccessKey':_0xcb540c,'region':_0x378ad8});_0x360874[_0x4433('0x6b')]({},function(_0x252c62,_0xf4d255){if(_0x252c62){return _0xaf1467(_0x252c62);}else{return _0xde377e(_0xf4d255);}});});}function createBucket(_0x4d3fa6,_0x3df669,_0x844dc0,_0x29507a){return new Promise(function(_0x1098bc,_0x567b03){var _0x118bdb=new AWS['S3']({'accessKeyId':_0x3df669,'secretAccessKey':_0x4d3fa6,'region':_0x844dc0});_0x118bdb[_0x4433('0x6c')]({'Bucket':_0x29507a},function(_0x1b5f48,_0x47f5f4){if(_0x1b5f48){return _0x567b03(_0x1b5f48);}else{return _0x1098bc(_0x47f5f4);}});});}function uploadFile(_0x5e1bff,_0x10cc35,_0x516a2e,_0x21f6dd,_0x3038d1,_0x680d5d){return new Promise(function(_0x3a3c64,_0x2e1606){var _0x4a3b5a=new AWS['S3']({'accessKeyId':_0x10cc35,'secretAccessKey':_0x5e1bff,'region':_0x516a2e});_0x4a3b5a[_0x4433('0x6d')]({'Bucket':_0x21f6dd,'Key':_0x3038d1,'Body':_0x680d5d},function(_0x5a6e6e,_0xc50e14){if(_0x5a6e6e){return _0x2e1606(_0x5a6e6e);}else{return _0x3a3c64(_0xc50e14);}});});}function startTranscribe(_0x33da92,_0xf375cf,_0x449098,_0x1f657c,_0x44911b,_0x4a2133){return new Promise(function(_0x3cd489,_0x967064){var _0x572ed9=new AWS[(_0x4433('0x6e'))]({'accessKeyId':_0xf375cf,'secretAccessKey':_0x33da92,'region':_0x449098});_0x572ed9[_0x4433('0x6f')]({'TranscriptionJobName':_0x1f657c,'LanguageCode':_0x44911b,'Media':{'MediaFileUri':_0x4a2133}},function(_0x2b0ba0,_0x34df06){if(_0x2b0ba0){return _0x967064(_0x2b0ba0);}else{return _0x3cd489(_0x34df06);}});});}function transcribe(_0x4e3c9d,_0x535f1d,_0x4e24ae,_0xd4f10f,_0xc55038,_0x53fb0a,_0x5afd1f){return new Promise(function(_0x24e251,_0x1fde29){var _0x25ebdb={};logger[_0x4433('0x66')](util['format'](_0x4433('0x70'),_0x4e3c9d,_0xc55038));return uploadFile(_0x535f1d,_0x4e24ae,_0xd4f10f,_0xc55038,path[_0x4433('0x71')](_0x53fb0a),fs[_0x4433('0x72')](_0x53fb0a))[_0x4433('0x3d')](function(_0x337954){logger[_0x4433('0x66')](util[_0x4433('0x2e')](_0x4433('0x73'),_0x4e3c9d,_0xc55038,_0x337954[_0x4433('0x74')]));_0x25ebdb[_0x4433('0x75')]=_0x337954[_0x4433('0x76')];_0x25ebdb[_0x4433('0x77')]=_0x337954[_0x4433('0x74')];logger[_0x4433('0x66')](util['format'](_0x4433('0x78'),_0x4e3c9d));return startTranscribe(_0x535f1d,_0x4e24ae,_0xd4f10f,uuidv4(),_0x5afd1f,_0x337954[_0x4433('0x74')]);})[_0x4433('0x3d')](function(_0xe64345){logger[_0x4433('0x66')](util[_0x4433('0x2e')](_0x4433('0x79'),_0x4e3c9d,_0xe64345[_0x4433('0x7a')][_0x4433('0x7b')]));_0x25ebdb[_0x4433('0x7c')]=_0xe64345[_0x4433('0x7a')][_0x4433('0x7b')];_0x25ebdb[_0x4433('0x7d')]=_0xe64345[_0x4433('0x7a')][_0x4433('0x7e')];return _0x24e251(_0x25ebdb);})['catch'](function(_0x91e041){return _0x1fde29(_0x91e041);});});}exports[_0x4433('0x7f')]=function(_0x3a2f69,_0x36d872,_0x224486){var _0x2e53ae;var _0x16b432;var _0x48c35b;var _0x43b25f=require(_0x4433('0x4b'));return db[_0x4433('0x28')][_0x4433('0x80')]({'where':{'id':_0x3a2f69[_0x4433('0x48')]['id']}})[_0x4433('0x3d')](function(_0x210326){if(_0x210326){var _0x20e94f=util[_0x4433('0x2e')](_0x4433('0x61'),_0x210326[_0x4433('0x4d')]);if(fs[_0x4433('0x4e')](_0x20e94f)){cypher=!![];return _0x43b25f[_0x4433('0x4f')](_0x20e94f,_0x210326[_0x4433('0x4d')],config[_0x4433('0x50')][_0x4433('0x51')])[_0x4433('0x3d')](function(){return _0x210326;});}return _0x210326;}})['then'](function(_0x78b3af){if(!_0x78b3af){throw new db[(_0x4433('0x52'))][(_0x4433('0x53'))]('Voice\x20Recording\x20not\x20found');}_0x16b432=_0x78b3af;return db[_0x4433('0x81')][_0x4433('0x80')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x36d872,null))['then'](function(_0x31c1c9){if(_0x31c1c9){_0x2e53ae=_0x31c1c9;if(!_0x2e53ae[_0x4433('0x82')]||!_0x2e53ae[_0x4433('0x83')]||!_0x2e53ae[_0x4433('0x84')]||!_0x2e53ae[_0x4433('0x85')]||!_0x2e53ae[_0x4433('0x75')]){throw new db[(_0x4433('0x52'))][(_0x4433('0x53'))]('Transcribe\x20not\x20configured');}if(_0x3a2f69['body']['runSentiment']&&(!_0x2e53ae[_0x4433('0x86')]||!_0x2e53ae['sentimentAccountId']||!_0x2e53ae[_0x4433('0x87')]||!_0x2e53ae[_0x4433('0x85')]||!_0x2e53ae['bucket'])){throw new db[(_0x4433('0x52'))][(_0x4433('0x53'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x4433('0x80')]({'where':{'id':_0x2e53ae[_0x4433('0x83')]}});}})[_0x4433('0x3d')](function(_0xdc500e){if(!_0xdc500e){throw new db[(_0x4433('0x52'))][(_0x4433('0x53'))](_0x4433('0x88'));}if(!_0xdc500e['data1']||!_0xdc500e[_0x4433('0x89')]){throw new db[(_0x4433('0x52'))][(_0x4433('0x53'))](_0x4433('0x8a'));}_0x48c35b=_0xdc500e;return getBucketslist(_0x48c35b[_0x4433('0x8b')],_0x48c35b[_0x4433('0x89')],_0x2e53ae[_0x4433('0x84')]);})[_0x4433('0x3d')](function(_0x3e225d){if(_0x3e225d&&_0x3e225d[_0x4433('0x8c')]){var _0x5deae6=_['find'](_0x3e225d[_0x4433('0x8c')],function(_0x3f36e9){return _0x3f36e9[_0x4433('0x8d')]===_0x2e53ae[_0x4433('0x75')];});if(!_0x5deae6){logger[_0x4433('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x3a2f69[_0x4433('0x48')]['id'],_0x2e53ae[_0x4433('0x75')]));return createBucket(_0x48c35b[_0x4433('0x8b')],_0x48c35b[_0x4433('0x89')],_0x2e53ae[_0x4433('0x84')],_0x2e53ae[_0x4433('0x75')]);}logger[_0x4433('0x66')](util[_0x4433('0x2e')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x3a2f69[_0x4433('0x48')]['id'],_0x2e53ae[_0x4433('0x75')]));return;}})['then'](function(_0x501b1c){if(_0x16b432[_0x4433('0x7d')]===_0x4433('0x8e')){return transcribe(_0x3a2f69[_0x4433('0x48')]['id'],_0x48c35b[_0x4433('0x8b')],_0x48c35b[_0x4433('0x89')],_0x2e53ae[_0x4433('0x84')],_0x2e53ae[_0x4433('0x75')],_0x16b432['value'],_0x2e53ae[_0x4433('0x85')]);}else{logger[_0x4433('0x66')](util[_0x4433('0x2e')](_0x4433('0x8f'),_0x3a2f69[_0x4433('0x48')]['id']));return{'transcribeStatus':_0x4433('0x90')};}})[_0x4433('0x3d')](function(_0x2c9800){if(_0x2c9800){_0x2c9800[_0x4433('0x91')]=_0x3a2f69[_0x4433('0x47')][_0x4433('0x92')];return _0x16b432[_0x4433('0x93')](_0x2c9800);}})[_0x4433('0x3d')](respondWithResult(_0x36d872,null))[_0x4433('0x41')](handleError(_0x36d872,null));};function writeFile(_0x4016b1,_0x55c066){return new Promise(function(_0x228d3a,_0x23a479){fs[_0x4433('0x94')](_0x55c066,_0x4016b1,function(_0x3f19fa,_0xfd23c7){if(_0x3f19fa){return _0x23a479(_0x3f19fa);}else{return _0x228d3a(_0xfd23c7);}});});}exports[_0x4433('0x95')]=function(_0x4eaad6,_0x11aea9,_0x164f58){return db['VoiceRecording']['findOne']({'where':{'id':_0x4eaad6[_0x4433('0x48')]['id']}})[_0x4433('0x3d')](handleEntityNotFound(_0x11aea9))['then'](function(_0x9b21ff){if(_0x9b21ff&&_0x9b21ff[_0x4433('0x96')]){var _0x5f028d=_0x9b21ff[_0x4433('0x96')];var _0x54bf6c=config[_0x4433('0x97')]+_0x4433('0x98')+_0x9b21ff['id']+_0x4433('0x99');if(fs['existsSync'](_0x54bf6c)){return _0x54bf6c;}return writeFile(_0x5f028d,_0x54bf6c)['then'](function(){return _0x54bf6c;});}else{throw new db[(_0x4433('0x52'))][(_0x4433('0x53'))]('Transcript\x20not\x20available');}})[_0x4433('0x3d')](function(_0x57c019){return _0x11aea9[_0x4433('0x4a')](_0x57c019);})[_0x4433('0x41')](handleError(_0x11aea9));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 00ebaf5..07bc70a 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 _0xf843=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger'];(function(_0x2badee,_0x3aa936){var _0xe71a7f=function(_0x4af5f0){while(--_0x4af5f0){_0x2badee['push'](_0x2badee['shift']());}};_0xe71a7f(++_0x3aa936);}(_0xf843,0x11b));var _0x3f84=function(_0x40297b,_0x5038da){_0x40297b=_0x40297b-0x0;var _0x1aad1a=_0xf843[_0x40297b];return _0x1aad1a;};'use strict';var _=require(_0x3f84('0x0'));var util=require('util');var logger=require(_0x3f84('0x1'))(_0x3f84('0x2'));var moment=require(_0x3f84('0x3'));var BPromise=require(_0x3f84('0x4'));var rp=require(_0x3f84('0x5'));var fs=require('fs');var path=require(_0x3f84('0x6'));var rimraf=require(_0x3f84('0x7'));var config=require(_0x3f84('0x8'));var attributes=require(_0x3f84('0x9'));module[_0x3f84('0xa')]=function(_0x2dd1e9,_0x468958){return _0x2dd1e9[_0x3f84('0xb')](_0x3f84('0xc'),attributes,{'tableName':_0x3f84('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3f84('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb4be=['uniqueid','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceRecording.attributes','define','voice_recordings'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb4be,0x7a));var _0xeb4b=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb4be[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0xeb4b('0x0'));var logger=require(_0xeb4b('0x1'))(_0xeb4b('0x2'));var moment=require('moment');var BPromise=require(_0xeb4b('0x3'));var rp=require(_0xeb4b('0x4'));var fs=require('fs');var path=require(_0xeb4b('0x5'));var rimraf=require('rimraf');var config=require(_0xeb4b('0x6'));var attributes=require(_0xeb4b('0x7'));module['exports']=function(_0x385b45,_0x266b99){return _0x385b45[_0xeb4b('0x8')]('VoiceRecording',attributes,{'tableName':_0xeb4b('0x9'),'paranoid':![],'indexes':[{'name':_0xeb4b('0xa'),'fields':[_0xeb4b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 2441da8..38bdb91 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 _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x544ec1,_0x2814eb){var _0x31e735=function(_0x45f226){while(--_0x45f226){_0x544ec1['push'](_0x544ec1['shift']());}};_0x31e735(++_0x2814eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x3ebb04,_0x1a63a6){var _0x535db0=function(_0x651fb4){while(--_0x651fb4){_0x3ebb04['push'](_0x3ebb04['shift']());}};_0x535db0(++_0x1a63a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 9fa6303..d92a046 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 _0x4819=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','isAuthenticated','show','post','create','/:id','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x1d9d4a,_0x4f86aa){var _0x51d425=function(_0x50b5ab){while(--_0x50b5ab){_0x1d9d4a['push'](_0x1d9d4a['shift']());}};_0x51d425(++_0x4f86aa);}(_0x4819,0xcd));var _0x9481=function(_0x4819e1,_0x44d88e){_0x4819e1=_0x4819e1-0x0;var _0xca4f58=_0x4819[_0x4819e1];return _0xca4f58;};'use strict';var multer=require('multer');var util=require(_0x9481('0x0'));var path=require(_0x9481('0x1'));var timeout=require(_0x9481('0x2'));var express=require(_0x9481('0x3'));var router=express[_0x9481('0x4')]();var auth=require(_0x9481('0x5'));var interaction=require(_0x9481('0x6'));var config=require(_0x9481('0x7'));var controller=require(_0x9481('0x8'));router[_0x9481('0x9')]('/',auth['isAuthenticated'](),controller[_0x9481('0xa')]);router['get']('/:id',auth[_0x9481('0xb')](),controller[_0x9481('0xc')]);router[_0x9481('0xd')]('/',auth[_0x9481('0xb')](),controller[_0x9481('0xe')]);router['put'](_0x9481('0xf'),auth['isAuthenticated'](),controller[_0x9481('0x10')]);router['delete'](_0x9481('0xf'),auth[_0x9481('0xb')](),controller[_0x9481('0x11')]);module[_0x9481('0x12')]=router; \ No newline at end of file +var _0x9536=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3a2e5a,_0x2e2899){var _0x2966f5=function(_0x400bdf){while(--_0x400bdf){_0x3a2e5a['push'](_0x3a2e5a['shift']());}};_0x2966f5(++_0x2e2899);}(_0x9536,0x179));var _0x6953=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0x9536[_0x3cea78];return _0x33b66b;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6953('0x5'));var config=require(_0x6953('0x6'));var controller=require(_0x6953('0x7'));router[_0x6953('0x8')]('/',auth[_0x6953('0x9')](),controller['index']);router[_0x6953('0x8')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0xb')]);router[_0x6953('0xc')]('/',auth['isAuthenticated'](),controller[_0x6953('0xd')]);router[_0x6953('0xe')](_0x6953('0xa'),auth['isAuthenticated'](),controller[_0x6953('0xf')]);router[_0x6953('0x10')](_0x6953('0xa'),auth[_0x6953('0x9')](),controller[_0x6953('0x11')]);module[_0x6953('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 3c5a7af..5b7aaa6 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 _0x37e1=['attended','STRING','Yes','exports','ENUM','blind'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x37e1,0x12f));var _0x137e=function(_0x395e5c,_0x2607ac){_0x395e5c=_0x395e5c-0x0;var _0x44ed7c=_0x37e1[_0x395e5c];return _0x44ed7c;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x137e('0x0')]={'type':{'type':Sequelize[_0x137e('0x1')](_0x137e('0x2'),_0x137e('0x3'))},'result':{'type':Sequelize[_0x137e('0x4')]},'transfererchannel':{'type':Sequelize[_0x137e('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x137e('0x4')]},'transferercalleridname':{'type':Sequelize[_0x137e('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x137e('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x137e('0x4')]},'transferercontext':{'type':Sequelize[_0x137e('0x4')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x137e('0x4')]},'transfereechannel':{'type':Sequelize[_0x137e('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x137e('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x137e('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x137e('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x137e('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x137e('0x4')]},'transfereecontext':{'type':Sequelize[_0x137e('0x4')]},'transfereeexten':{'type':Sequelize[_0x137e('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x137e('0x4')]},'isexternal':{'type':Sequelize[_0x137e('0x1')](_0x137e('0x5'),'No')},'context':{'type':Sequelize[_0x137e('0x4')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7afa=['Yes','sequelize','exports','ENUM','blind','attended','STRING'];(function(_0x57a165,_0x1f2795){var _0x164ced=function(_0x44c91b){while(--_0x44c91b){_0x57a165['push'](_0x57a165['shift']());}};_0x164ced(++_0x1f2795);}(_0x7afa,0x143));var _0xa7af=function(_0x34ebd9,_0xa28e33){_0x34ebd9=_0x34ebd9-0x0;var _0x82b80b=_0x7afa[_0x34ebd9];return _0x82b80b;};'use strict';var Sequelize=require(_0xa7af('0x0'));var moment=require('moment');module[_0xa7af('0x1')]={'type':{'type':Sequelize[_0xa7af('0x2')](_0xa7af('0x3'),_0xa7af('0x4'))},'result':{'type':Sequelize[_0xa7af('0x5')]},'transfererchannel':{'type':Sequelize[_0xa7af('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xa7af('0x5')]},'transferercalleridname':{'type':Sequelize[_0xa7af('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xa7af('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xa7af('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xa7af('0x5')]},'transferercontext':{'type':Sequelize[_0xa7af('0x5')]},'transfererexten':{'type':Sequelize[_0xa7af('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xa7af('0x5')]},'transfereechannel':{'type':Sequelize[_0xa7af('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xa7af('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xa7af('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xa7af('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xa7af('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xa7af('0x5')]},'isexternal':{'type':Sequelize[_0xa7af('0x2')](_0xa7af('0x6'),'No')},'context':{'type':Sequelize[_0xa7af('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ab8a1e9..d7919c2 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 _0xa23e=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','end','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','fields','attributes','length','nolimit','order','sort','where','filters','pick'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xa23e,0x17a));var _0xea23=function(_0x262968,_0x3f85ce){_0x262968=_0x262968-0x0;var _0x40b08b=_0xa23e[_0x262968];return _0x40b08b;};'use strict';var pdf=require(_0xea23('0x0'));var emlformat=require(_0xea23('0x1'));var rimraf=require(_0xea23('0x2'));var zipdir=require(_0xea23('0x3'));var jsonpatch=require(_0xea23('0x4'));var rp=require('request-promise');var moment=require(_0xea23('0x5'));var BPromise=require(_0xea23('0x6'));var Mustache=require(_0xea23('0x7'));var util=require('util');var path=require(_0xea23('0x8'));var sox=require(_0xea23('0x9'));var csv=require(_0xea23('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xea23('0xb'));var crypto=require(_0xea23('0xc'));var jsforce=require(_0xea23('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea23('0xa'));var querystring=require(_0xea23('0xe'));var Papa=require(_0xea23('0xf'));var Redis=require(_0xea23('0x10'));var authService=require(_0xea23('0x11'));var qs=require(_0xea23('0x12'));var as=require(_0xea23('0x13'));var hardwareService=require(_0xea23('0x14'));var logger=require(_0xea23('0x15'))(_0xea23('0x16'));var utils=require(_0xea23('0x17'));var config=require(_0xea23('0x18'));var licenseUtil=require(_0xea23('0x19'));var db=require(_0xea23('0x1a'))['db'];function respondWithStatusCode(_0x4e68f7,_0x1bef44){_0x1bef44=_0x1bef44||0xcc;return function(_0x594fb1){if(_0x594fb1){return _0x4e68f7['sendStatus'](_0x1bef44);}return _0x4e68f7[_0xea23('0x1b')](_0x1bef44)['end']();};}function respondWithResult(_0x57d806,_0xc5f8cb){_0xc5f8cb=_0xc5f8cb||0xc8;return function(_0x3260ab){if(_0x3260ab){return _0x57d806[_0xea23('0x1b')](_0xc5f8cb)[_0xea23('0x1c')](_0x3260ab);}};}function respondWithFilteredResult(_0xd91216,_0xb6d5c7){return function(_0x1f725c){if(_0x1f725c){var _0x459838=_0x1f725c[_0xea23('0x1d')],_0x2df8ac=_0xb6d5c7[_0xea23('0x1e')],_0x1b28ef=_0xb6d5c7[_0xea23('0x1e')]+_0xb6d5c7[_0xea23('0x1f')],_0x216d51;if(_0x1b28ef>=_0x459838){_0x1b28ef=_0x459838;_0x216d51=0xc8;}else{_0x216d51=0xce;}_0xd91216['status'](_0x216d51);return _0xd91216['set'](_0xea23('0x20'),_0x2df8ac+'-'+_0x1b28ef+'/'+_0x459838)[_0xea23('0x1c')](_0x1f725c);}return null;};}function patchUpdates(_0x3f975f){return function(_0x5bebde){try{jsonpatch[_0xea23('0x21')](_0x5bebde,_0x3f975f,!![]);}catch(_0x1d5ba3){return BPromise['reject'](_0x1d5ba3);}return _0x5bebde[_0xea23('0x22')]();};}function saveUpdates(_0x4ef00c,_0x169792){return function(_0x142511){if(_0x142511){return _0x142511[_0xea23('0x23')](_0x4ef00c)[_0xea23('0x24')](function(_0x2053b1){return _0x2053b1;});}return null;};}function removeEntity(_0x2fd7af,_0x24e10c){return function(_0x57c2c0){if(_0x57c2c0){return _0x57c2c0[_0xea23('0x25')]()[_0xea23('0x24')](function(){_0x2fd7af['status'](0xcc)[_0xea23('0x26')]();});}};}function handleEntityNotFound(_0x4ba97d,_0x158d6c){return function(_0x5ceef2){if(!_0x5ceef2){_0x4ba97d['sendStatus'](0x194);}return _0x5ceef2;};}function handleError(_0x5ac725,_0x4729fb){_0x4729fb=_0x4729fb||0x1f4;return function(_0x261ac2){logger['error'](_0x261ac2[_0xea23('0x27')]);if(_0x261ac2[_0xea23('0x28')]){delete _0x261ac2[_0xea23('0x28')];}_0x5ac725[_0xea23('0x1b')](_0x4729fb)['send'](_0x261ac2);};}exports[_0xea23('0x29')]=function(_0x379cdd,_0x420f35){var _0x1a3b06={},_0x4eca31={},_0xb0f49={'count':0x0,'rows':[]};var _0x2ce281=_[_0xea23('0x2a')](db[_0xea23('0x2b')][_0xea23('0x2c')],function(_0x4b7ec5){return{'name':_0x4b7ec5[_0xea23('0x2d')],'type':_0x4b7ec5[_0xea23('0x2e')][_0xea23('0x2f')]};});_0x4eca31[_0xea23('0x30')]=_['map'](_0x2ce281,_0xea23('0x28'));_0x4eca31[_0xea23('0x31')]=_[_0xea23('0x32')](_0x379cdd[_0xea23('0x31')]);_0x4eca31['filters']=_['intersection'](_0x4eca31[_0xea23('0x30')],_0x4eca31[_0xea23('0x31')]);_0x1a3b06['attributes']=_['intersection'](_0x4eca31[_0xea23('0x30')],qs[_0xea23('0x33')](_0x379cdd[_0xea23('0x31')][_0xea23('0x33')]));_0x1a3b06['attributes']=_0x1a3b06[_0xea23('0x34')][_0xea23('0x35')]?_0x1a3b06['attributes']:_0x4eca31['model'];if(!_0x379cdd[_0xea23('0x31')]['hasOwnProperty'](_0xea23('0x36'))){_0x1a3b06[_0xea23('0x1f')]=qs[_0xea23('0x1f')](_0x379cdd[_0xea23('0x31')][_0xea23('0x1f')]);_0x1a3b06['offset']=qs['offset'](_0x379cdd[_0xea23('0x31')][_0xea23('0x1e')]);}_0x1a3b06[_0xea23('0x37')]=qs[_0xea23('0x38')](_0x379cdd[_0xea23('0x31')][_0xea23('0x38')]);_0x1a3b06[_0xea23('0x39')]=qs[_0xea23('0x3a')](_[_0xea23('0x3b')](_0x379cdd['query'],_0x4eca31[_0xea23('0x3a')]),_0x2ce281);if(_0x379cdd[_0xea23('0x31')][_0xea23('0x3c')]){_0x1a3b06[_0xea23('0x39')]=_[_0xea23('0x3d')](_0x1a3b06[_0xea23('0x39')],{'$or':_['map'](_0x2ce281,function(_0x394576){if(_0x394576[_0xea23('0x2e')]!==_0xea23('0x3e')){var _0x16e0d3={};_0x16e0d3[_0x394576['name']]={'$like':'%'+_0x379cdd[_0xea23('0x31')][_0xea23('0x3c')]+'%'};return _0x16e0d3;}})});}_0x1a3b06=_[_0xea23('0x3d')]({},_0x1a3b06,_0x379cdd[_0xea23('0x3f')]);var _0x4793da={'where':_0x1a3b06['where']};return db[_0xea23('0x2b')][_0xea23('0x1d')](_0x4793da)[_0xea23('0x24')](function(_0x49f82a){_0xb0f49[_0xea23('0x1d')]=_0x49f82a;if(_0x379cdd['query'][_0xea23('0x40')]){_0x1a3b06[_0xea23('0x41')]=[{'all':!![]}];}return db[_0xea23('0x2b')][_0xea23('0x42')](_0x1a3b06);})[_0xea23('0x24')](function(_0xa3462e){_0xb0f49[_0xea23('0x43')]=_0xa3462e;return _0xb0f49;})[_0xea23('0x24')](respondWithFilteredResult(_0x420f35,_0x1a3b06))[_0xea23('0x44')](handleError(_0x420f35,null));};exports['show']=function(_0x334b3c,_0x12db05){var _0x33ae9f={'raw':!![],'where':{'id':_0x334b3c[_0xea23('0x45')]['id']}},_0x11c739={};_0x11c739[_0xea23('0x30')]=_[_0xea23('0x32')](db[_0xea23('0x2b')]['rawAttributes']);_0x11c739['query']=_['keys'](_0x334b3c[_0xea23('0x31')]);_0x11c739[_0xea23('0x3a')]=_[_0xea23('0x46')](_0x11c739[_0xea23('0x30')],_0x11c739[_0xea23('0x31')]);_0x33ae9f[_0xea23('0x34')]=_[_0xea23('0x46')](_0x11c739[_0xea23('0x30')],qs['fields'](_0x334b3c[_0xea23('0x31')][_0xea23('0x33')]));_0x33ae9f[_0xea23('0x34')]=_0x33ae9f[_0xea23('0x34')][_0xea23('0x35')]?_0x33ae9f[_0xea23('0x34')]:_0x11c739[_0xea23('0x30')];if(_0x334b3c[_0xea23('0x31')][_0xea23('0x40')]){_0x33ae9f['include']=[{'all':!![]}];}_0x33ae9f=_[_0xea23('0x3d')]({},_0x33ae9f,_0x334b3c[_0xea23('0x3f')]);return db['VoiceTransferReport'][_0xea23('0x47')](_0x33ae9f)[_0xea23('0x24')](handleEntityNotFound(_0x12db05,null))['then'](respondWithResult(_0x12db05,null))[_0xea23('0x44')](handleError(_0x12db05,null));};exports['create']=function(_0x54c4a6,_0x3b4342){return db[_0xea23('0x2b')]['create'](_0x54c4a6[_0xea23('0x48')],{})[_0xea23('0x24')](respondWithResult(_0x3b4342,0xc9))[_0xea23('0x44')](handleError(_0x3b4342,null));};exports[_0xea23('0x23')]=function(_0x555f2d,_0x5a6306){if(_0x555f2d[_0xea23('0x48')]['id']){delete _0x555f2d[_0xea23('0x48')]['id'];}return db[_0xea23('0x2b')][_0xea23('0x47')]({'where':{'id':_0x555f2d[_0xea23('0x45')]['id']}})[_0xea23('0x24')](handleEntityNotFound(_0x5a6306,null))[_0xea23('0x24')](saveUpdates(_0x555f2d['body'],null))['then'](respondWithResult(_0x5a6306,null))[_0xea23('0x44')](handleError(_0x5a6306,null));};exports[_0xea23('0x25')]=function(_0x25936b,_0x4fed05){return db[_0xea23('0x2b')][_0xea23('0x47')]({'where':{'id':_0x25936b[_0xea23('0x45')]['id']}})[_0xea23('0x24')](handleEntityNotFound(_0x4fed05,null))['then'](removeEntity(_0x4fed05,null))[_0xea23('0x44')](handleError(_0x4fed05,null));}; \ No newline at end of file +var _0x30fa=['hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceTransferReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x30fa,0xa4));var _0xa30f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x30fa[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xa30f('0x0'));var emlformat=require(_0xa30f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa30f('0x2'));var jsonpatch=require(_0xa30f('0x3'));var rp=require('request-promise');var moment=require(_0xa30f('0x4'));var BPromise=require(_0xa30f('0x5'));var Mustache=require(_0xa30f('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa30f('0x7'));var csv=require(_0xa30f('0x8'));var ejs=require(_0xa30f('0x9'));var fs=require('fs');var _=require(_0xa30f('0xa'));var squel=require(_0xa30f('0xb'));var crypto=require(_0xa30f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa30f('0xd'));var Papa=require('papaparse');var Redis=require(_0xa30f('0xe'));var authService=require(_0xa30f('0xf'));var qs=require(_0xa30f('0x10'));var as=require(_0xa30f('0x11'));var hardwareService=require(_0xa30f('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa30f('0x13'));var licenseUtil=require(_0xa30f('0x14'));var db=require(_0xa30f('0x15'))['db'];function respondWithStatusCode(_0x146a46,_0x3c18d7){_0x3c18d7=_0x3c18d7||0xcc;return function(_0x3297d6){if(_0x3297d6){return _0x146a46[_0xa30f('0x16')](_0x3c18d7);}return _0x146a46[_0xa30f('0x17')](_0x3c18d7)[_0xa30f('0x18')]();};}function respondWithResult(_0x11cd9b,_0x22f476){_0x22f476=_0x22f476||0xc8;return function(_0xbbc592){if(_0xbbc592){return _0x11cd9b['status'](_0x22f476)[_0xa30f('0x19')](_0xbbc592);}};}function respondWithFilteredResult(_0x50904a,_0x17008c){return function(_0x677092){if(_0x677092){var _0x459230=_0x677092[_0xa30f('0x1a')],_0x2c45c2=_0x17008c['offset'],_0x14aae9=_0x17008c[_0xa30f('0x1b')]+_0x17008c[_0xa30f('0x1c')],_0x47a372;if(_0x14aae9>=_0x459230){_0x14aae9=_0x459230;_0x47a372=0xc8;}else{_0x47a372=0xce;}_0x50904a[_0xa30f('0x17')](_0x47a372);return _0x50904a[_0xa30f('0x1d')](_0xa30f('0x1e'),_0x2c45c2+'-'+_0x14aae9+'/'+_0x459230)[_0xa30f('0x19')](_0x677092);}return null;};}function patchUpdates(_0x4ae819){return function(_0x3ea2b4){try{jsonpatch[_0xa30f('0x1f')](_0x3ea2b4,_0x4ae819,!![]);}catch(_0xc14ae6){return BPromise[_0xa30f('0x20')](_0xc14ae6);}return _0x3ea2b4[_0xa30f('0x21')]();};}function saveUpdates(_0x14ce2d,_0x2ed6f8){return function(_0x47581){if(_0x47581){return _0x47581[_0xa30f('0x22')](_0x14ce2d)[_0xa30f('0x23')](function(_0x52dde3){return _0x52dde3;});}return null;};}function removeEntity(_0x1bf399,_0x963ca1){return function(_0x564e2a){if(_0x564e2a){return _0x564e2a[_0xa30f('0x24')]()[_0xa30f('0x23')](function(){_0x1bf399[_0xa30f('0x17')](0xcc)[_0xa30f('0x18')]();});}};}function handleEntityNotFound(_0xe3ba0,_0x21499a){return function(_0x1960f4){if(!_0x1960f4){_0xe3ba0[_0xa30f('0x16')](0x194);}return _0x1960f4;};}function handleError(_0xd40096,_0x5b34b8){_0x5b34b8=_0x5b34b8||0x1f4;return function(_0x197427){logger[_0xa30f('0x25')](_0x197427[_0xa30f('0x26')]);if(_0x197427[_0xa30f('0x27')]){delete _0x197427[_0xa30f('0x27')];}_0xd40096[_0xa30f('0x17')](_0x5b34b8)[_0xa30f('0x28')](_0x197427);};}exports[_0xa30f('0x29')]=function(_0x1d99ad,_0x406883){var _0x4bbba9={},_0x26aecf={},_0x53f652={'count':0x0,'rows':[]};var _0xb4b436=_['map'](db[_0xa30f('0x2a')][_0xa30f('0x2b')],function(_0x3aed0f){return{'name':_0x3aed0f[_0xa30f('0x2c')],'type':_0x3aed0f[_0xa30f('0x2d')][_0xa30f('0x2e')]};});_0x26aecf[_0xa30f('0x2f')]=_[_0xa30f('0x30')](_0xb4b436,_0xa30f('0x27'));_0x26aecf['query']=_[_0xa30f('0x31')](_0x1d99ad[_0xa30f('0x32')]);_0x26aecf[_0xa30f('0x33')]=_[_0xa30f('0x34')](_0x26aecf['model'],_0x26aecf[_0xa30f('0x32')]);_0x4bbba9[_0xa30f('0x35')]=_[_0xa30f('0x34')](_0x26aecf[_0xa30f('0x2f')],qs[_0xa30f('0x36')](_0x1d99ad['query'][_0xa30f('0x36')]));_0x4bbba9[_0xa30f('0x35')]=_0x4bbba9[_0xa30f('0x35')]['length']?_0x4bbba9['attributes']:_0x26aecf[_0xa30f('0x2f')];if(!_0x1d99ad['query'][_0xa30f('0x37')]('nolimit')){_0x4bbba9[_0xa30f('0x1c')]=qs[_0xa30f('0x1c')](_0x1d99ad[_0xa30f('0x32')][_0xa30f('0x1c')]);_0x4bbba9[_0xa30f('0x1b')]=qs[_0xa30f('0x1b')](_0x1d99ad[_0xa30f('0x32')]['offset']);}_0x4bbba9[_0xa30f('0x38')]=qs[_0xa30f('0x39')](_0x1d99ad[_0xa30f('0x32')][_0xa30f('0x39')]);_0x4bbba9[_0xa30f('0x3a')]=qs[_0xa30f('0x33')](_[_0xa30f('0x3b')](_0x1d99ad[_0xa30f('0x32')],_0x26aecf[_0xa30f('0x33')]),_0xb4b436);if(_0x1d99ad['query'][_0xa30f('0x3c')]){_0x4bbba9[_0xa30f('0x3a')]=_[_0xa30f('0x3d')](_0x4bbba9['where'],{'$or':_[_0xa30f('0x30')](_0xb4b436,function(_0x3264e1){if(_0x3264e1[_0xa30f('0x2d')]!==_0xa30f('0x3e')){var _0x19bd35={};_0x19bd35[_0x3264e1[_0xa30f('0x27')]]={'$like':'%'+_0x1d99ad[_0xa30f('0x32')]['filter']+'%'};return _0x19bd35;}})});}_0x4bbba9=_[_0xa30f('0x3d')]({},_0x4bbba9,_0x1d99ad['options']);var _0x404409={'where':_0x4bbba9[_0xa30f('0x3a')]};return db[_0xa30f('0x2a')][_0xa30f('0x1a')](_0x404409)[_0xa30f('0x23')](function(_0x48d1ad){_0x53f652['count']=_0x48d1ad;if(_0x1d99ad[_0xa30f('0x32')][_0xa30f('0x3f')]){_0x4bbba9[_0xa30f('0x40')]=[{'all':!![]}];}return db[_0xa30f('0x2a')][_0xa30f('0x41')](_0x4bbba9);})[_0xa30f('0x23')](function(_0x142144){_0x53f652[_0xa30f('0x42')]=_0x142144;return _0x53f652;})[_0xa30f('0x23')](respondWithFilteredResult(_0x406883,_0x4bbba9))[_0xa30f('0x43')](handleError(_0x406883,null));};exports[_0xa30f('0x44')]=function(_0x3f791b,_0x14bd1d){var _0x10ca82={'raw':!![],'where':{'id':_0x3f791b[_0xa30f('0x45')]['id']}},_0x1f1326={};_0x1f1326[_0xa30f('0x2f')]=_[_0xa30f('0x31')](db['VoiceTransferReport'][_0xa30f('0x2b')]);_0x1f1326[_0xa30f('0x32')]=_[_0xa30f('0x31')](_0x3f791b['query']);_0x1f1326[_0xa30f('0x33')]=_[_0xa30f('0x34')](_0x1f1326['model'],_0x1f1326[_0xa30f('0x32')]);_0x10ca82[_0xa30f('0x35')]=_['intersection'](_0x1f1326[_0xa30f('0x2f')],qs[_0xa30f('0x36')](_0x3f791b['query'][_0xa30f('0x36')]));_0x10ca82[_0xa30f('0x35')]=_0x10ca82['attributes'][_0xa30f('0x46')]?_0x10ca82['attributes']:_0x1f1326[_0xa30f('0x2f')];if(_0x3f791b[_0xa30f('0x32')][_0xa30f('0x3f')]){_0x10ca82[_0xa30f('0x40')]=[{'all':!![]}];}_0x10ca82=_[_0xa30f('0x3d')]({},_0x10ca82,_0x3f791b['options']);return db[_0xa30f('0x2a')]['find'](_0x10ca82)[_0xa30f('0x23')](handleEntityNotFound(_0x14bd1d,null))[_0xa30f('0x23')](respondWithResult(_0x14bd1d,null))[_0xa30f('0x43')](handleError(_0x14bd1d,null));};exports[_0xa30f('0x47')]=function(_0x4c5e9b,_0x28e0cd){return db['VoiceTransferReport']['create'](_0x4c5e9b[_0xa30f('0x48')],{})['then'](respondWithResult(_0x28e0cd,0xc9))[_0xa30f('0x43')](handleError(_0x28e0cd,null));};exports[_0xa30f('0x22')]=function(_0x3c259d,_0x149647){if(_0x3c259d[_0xa30f('0x48')]['id']){delete _0x3c259d[_0xa30f('0x48')]['id'];}return db[_0xa30f('0x2a')]['find']({'where':{'id':_0x3c259d['params']['id']}})['then'](handleEntityNotFound(_0x149647,null))[_0xa30f('0x23')](saveUpdates(_0x3c259d[_0xa30f('0x48')],null))['then'](respondWithResult(_0x149647,null))['catch'](handleError(_0x149647,null));};exports['destroy']=function(_0x1fc69b,_0x2130ff){return db[_0xa30f('0x2a')]['find']({'where':{'id':_0x1fc69b[_0xa30f('0x45')]['id']}})[_0xa30f('0x23')](handleEntityNotFound(_0x2130ff,null))['then'](removeEntity(_0x2130ff,null))['catch'](handleError(_0x2130ff,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c719502..14f8b22 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 _0xed4a=['report_call_transfer','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceTransferReport'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xed4a,0xd2));var _0xaed4=function(_0x26fb6e,_0x57c48d){_0x26fb6e=_0x26fb6e-0x0;var _0x56bd4c=_0xed4a[_0x26fb6e];return _0x56bd4c;};'use strict';var _=require(_0xaed4('0x0'));var util=require(_0xaed4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xaed4('0x2'));var BPromise=require(_0xaed4('0x3'));var rp=require(_0xaed4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaed4('0x5'));var config=require(_0xaed4('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xaed4('0x7')]=function(_0x2e132b,_0x2ffc29){return _0x2e132b[_0xaed4('0x8')](_0xaed4('0x9'),attributes,{'tableName':_0xaed4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c8c=['rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','api','moment','bluebird','path'];(function(_0x35657a,_0x38795a){var _0x242ad=function(_0x4b9bfe){while(--_0x4b9bfe){_0x35657a['push'](_0x35657a['shift']());}};_0x242ad(++_0x38795a);}(_0x4c8c,0x1b3));var _0xc4c8=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x4c8c[_0x16629d];return _0x56ccee;};'use strict';var _=require(_0xc4c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc4c8('0x1'));var moment=require(_0xc4c8('0x2'));var BPromise=require(_0xc4c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4c8('0x4'));var rimraf=require(_0xc4c8('0x5'));var config=require('../../config/environment');var attributes=require(_0xc4c8('0x6'));module[_0xc4c8('0x7')]=function(_0x5caf0a,_0x17af8d){return _0x5caf0a[_0xc4c8('0x8')](_0xc4c8('0x9'),attributes,{'tableName':_0xc4c8('0xa'),'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 c29595d..a9b165c 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 _0xc1cb=['info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','create','body','options','then','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x292911,_0x279a2e){var _0x18dee9=function(_0x43ccf8){while(--_0x43ccf8){_0x292911['push'](_0x292911['shift']());}};_0x18dee9(++_0x279a2e);}(_0xc1cb,0xac));var _0xbc1c=function(_0x821b4f,_0x113ed4){_0x821b4f=_0x821b4f-0x0;var _0x2c6381=_0xc1cb[_0x821b4f];return _0x2c6381;};'use strict';var _=require(_0xbc1c('0x0'));var util=require(_0xbc1c('0x1'));var moment=require('moment');var BPromise=require(_0xbc1c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc1c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc1c('0x4'));var logger=require(_0xbc1c('0x5'))(_0xbc1c('0x6'));var config=require(_0xbc1c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbc1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x141462,_0x566dcf,_0x1520a0){return new BPromise(function(_0x1e8a2d,_0x5a46db){return client[_0xbc1c('0x9')](_0x141462,_0x1520a0)['then'](function(_0x585ea8){logger[_0xbc1c('0xa')](_0xbc1c('0xb'),_0x566dcf,_0xbc1c('0xc'));logger[_0xbc1c('0xd')](_0xbc1c('0xe'),_0x566dcf,_0xbc1c('0xc'),JSON[_0xbc1c('0xf')](_0x585ea8));if(_0x585ea8[_0xbc1c('0x10')]){if(_0x585ea8[_0xbc1c('0x10')][_0xbc1c('0x11')]===0x1f4){logger['error'](_0xbc1c('0xb'),_0x566dcf,_0x585ea8['error'][_0xbc1c('0x12')]);return _0x5a46db(_0x585ea8[_0xbc1c('0x10')]['message']);}logger[_0xbc1c('0x10')](_0xbc1c('0xb'),_0x566dcf,_0x585ea8[_0xbc1c('0x10')][_0xbc1c('0x12')]);return _0x1e8a2d(_0x585ea8[_0xbc1c('0x10')][_0xbc1c('0x12')]);}else{logger[_0xbc1c('0xa')](_0xbc1c('0xb'),_0x566dcf,_0xbc1c('0xc'));_0x1e8a2d(_0x585ea8[_0xbc1c('0x13')]['message']);}})['catch'](function(_0x2d0cd4){logger['error'](_0xbc1c('0xb'),_0x566dcf,_0x2d0cd4);_0x5a46db(_0x2d0cd4);});});}exports[_0xbc1c('0x14')]=function(_0x543b83){var _0x4df53a=this;return new Promise(function(_0x71530c,_0x37a0b1){return db['VoiceTransferReport'][_0xbc1c('0x15')](_0x543b83[_0xbc1c('0x16')],{'raw':_0x543b83[_0xbc1c('0x17')]?_0x543b83[_0xbc1c('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xbc1c('0x18')](function(_0x5dc6b9){logger[_0xbc1c('0xa')](_0xbc1c('0x14'),_0x543b83);logger[_0xbc1c('0xd')](_0xbc1c('0x14'),_0x543b83,JSON[_0xbc1c('0xf')](_0x5dc6b9));_0x71530c(_0x5dc6b9);})[_0xbc1c('0x19')](function(_0x49f42b){logger[_0xbc1c('0x10')](_0xbc1c('0x14'),_0x49f42b[_0xbc1c('0x12')],_0x543b83);_0x37a0b1(_0x4df53a[_0xbc1c('0x10')](0x1f4,_0x49f42b[_0xbc1c('0x12')]));});});}; \ No newline at end of file +var _0xd624=['code','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','debug','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3548eb,_0x1f9f39){var _0x15b85c=function(_0x385ce5){while(--_0x385ce5){_0x3548eb['push'](_0x3548eb['shift']());}};_0x15b85c(++_0x1f9f39);}(_0xd624,0x124));var _0x4d62=function(_0x3b5d44,_0x2aab40){_0x3b5d44=_0x3b5d44-0x0;var _0x146e22=_0xd624[_0x3b5d44];return _0x146e22;};'use strict';var _=require(_0x4d62('0x0'));var util=require(_0x4d62('0x1'));var moment=require('moment');var BPromise=require(_0x4d62('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4d62('0x3'));var logger=require(_0x4d62('0x4'))(_0x4d62('0x5'));var config=require(_0x4d62('0x6'));var jayson=require(_0x4d62('0x7'));var client=jayson[_0x4d62('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ba7a1,_0x133d24,_0x3d6f78){return new BPromise(function(_0x12bf3c,_0x1377c3){return client[_0x4d62('0x9')](_0x4ba7a1,_0x3d6f78)['then'](function(_0x19e6cb){logger[_0x4d62('0xa')](_0x4d62('0xb'),_0x133d24,_0x4d62('0xc'));logger['debug'](_0x4d62('0xd'),_0x133d24,_0x4d62('0xc'),JSON[_0x4d62('0xe')](_0x19e6cb));if(_0x19e6cb[_0x4d62('0xf')]){if(_0x19e6cb[_0x4d62('0xf')][_0x4d62('0x10')]===0x1f4){logger[_0x4d62('0xf')](_0x4d62('0xb'),_0x133d24,_0x19e6cb[_0x4d62('0xf')][_0x4d62('0x11')]);return _0x1377c3(_0x19e6cb[_0x4d62('0xf')][_0x4d62('0x11')]);}logger['error'](_0x4d62('0xb'),_0x133d24,_0x19e6cb[_0x4d62('0xf')][_0x4d62('0x11')]);return _0x12bf3c(_0x19e6cb['error'][_0x4d62('0x11')]);}else{logger[_0x4d62('0xa')](_0x4d62('0xb'),_0x133d24,_0x4d62('0xc'));_0x12bf3c(_0x19e6cb[_0x4d62('0x12')][_0x4d62('0x11')]);}})[_0x4d62('0x13')](function(_0x55060d){logger['error'](_0x4d62('0xb'),_0x133d24,_0x55060d);_0x1377c3(_0x55060d);});});}exports[_0x4d62('0x14')]=function(_0x54920b){var _0x17a0e6=this;return new Promise(function(_0x27ca77,_0x11ed47){return db[_0x4d62('0x15')][_0x4d62('0x16')](_0x54920b[_0x4d62('0x17')],{'raw':_0x54920b[_0x4d62('0x18')]?_0x54920b[_0x4d62('0x18')][_0x4d62('0x19')]===undefined?!![]:![]:!![]})[_0x4d62('0x1a')](function(_0x494a8f){logger['info']('CreateVoiceTransferReport',_0x54920b);logger[_0x4d62('0x1b')](_0x4d62('0x14'),_0x54920b,JSON[_0x4d62('0xe')](_0x494a8f));_0x27ca77(_0x494a8f);})['catch'](function(_0x3a5e4f){logger[_0x4d62('0xf')](_0x4d62('0x14'),_0x3a5e4f['message'],_0x54920b);_0x11ed47(_0x17a0e6[_0x4d62('0xf')](0x1f4,_0x3a5e4f[_0x4d62('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c1c79f6..658ba2b 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 _0xc997=['hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','canUpdate','originate','/hangup','isAuthenticated','hangup','answer','/hold'];(function(_0x1ffafa,_0x1d30a2){var _0x41ce4a=function(_0x527685){while(--_0x527685){_0x1ffafa['push'](_0x1ffafa['shift']());}};_0x41ce4a(++_0x1d30a2);}(_0xc997,0x1ac));var _0x7c99=function(_0x1154f3,_0x93c2e5){_0x1154f3=_0x1154f3-0x0;var _0x56a730=_0xc997[_0x1154f3];return _0x56a730;};'use strict';var express=require('express');var router=express[_0x7c99('0x0')]();var auth=require(_0x7c99('0x1'));var controller=require(_0x7c99('0x2'));router[_0x7c99('0x3')](_0x7c99('0x4'),auth['isAuthenticated'](),auth[_0x7c99('0x5')](),controller[_0x7c99('0x6')]);router[_0x7c99('0x3')](_0x7c99('0x7'),auth[_0x7c99('0x8')](),auth[_0x7c99('0x5')](),controller[_0x7c99('0x9')]);router[_0x7c99('0x3')]('/answer',auth[_0x7c99('0x8')](),auth[_0x7c99('0x5')](),controller[_0x7c99('0xa')]);router['post'](_0x7c99('0xb'),auth[_0x7c99('0x8')](),auth['canUpdate'](),controller[_0x7c99('0xc')]);router['post'](_0x7c99('0xd'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x7c99('0xe')]);router[_0x7c99('0x3')](_0x7c99('0xf'),auth[_0x7c99('0x8')](),auth[_0x7c99('0x5')](),controller[_0x7c99('0x10')]);router[_0x7c99('0x3')](_0x7c99('0x11'),auth[_0x7c99('0x8')](),auth[_0x7c99('0x5')](),controller[_0x7c99('0x12')]);module[_0x7c99('0x13')]=router; \ No newline at end of file +var _0x12cc=['/originate','originate','hangup','/answer','answer','/hold','canUpdate','hold','isAuthenticated','unhold','/calls','calls','/transfer','transfer','Router','../../components/auth/service','./webbar.controller','post'];(function(_0x17e721,_0x188768){var _0x13f7bc=function(_0x56c14b){while(--_0x56c14b){_0x17e721['push'](_0x17e721['shift']());}};_0x13f7bc(++_0x188768);}(_0x12cc,0xc2));var _0xc12c=function(_0x4c8d8d,_0x18e4a7){_0x4c8d8d=_0x4c8d8d-0x0;var _0x5422e3=_0x12cc[_0x4c8d8d];return _0x5422e3;};'use strict';var express=require('express');var router=express[_0xc12c('0x0')]();var auth=require(_0xc12c('0x1'));var controller=require(_0xc12c('0x2'));router[_0xc12c('0x3')](_0xc12c('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc12c('0x5')]);router[_0xc12c('0x3')]('/hangup',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc12c('0x6')]);router[_0xc12c('0x3')](_0xc12c('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc12c('0x8')]);router[_0xc12c('0x3')](_0xc12c('0x9'),auth['isAuthenticated'](),auth[_0xc12c('0xa')](),controller[_0xc12c('0xb')]);router[_0xc12c('0x3')]('/unhold',auth[_0xc12c('0xc')](),auth[_0xc12c('0xa')](),controller[_0xc12c('0xd')]);router[_0xc12c('0x3')](_0xc12c('0xe'),auth[_0xc12c('0xc')](),auth['canUpdate'](),controller[_0xc12c('0xf')]);router[_0xc12c('0x3')](_0xc12c('0x10'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc12c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 2e4e5bb..4752d8c 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 _0x4853=['bluebird','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','name','status','send','NotFound','then','error','code','message','result','catch','User','findOne','agent','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','json','userId','callNumber','callbackUrl','info','entityFound:','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','filter','UserId','conference\x20fired:','webbar:conference','conference\x20executed!','webbar:transfer','lodash','../../config/environment','util'];(function(_0x3e665d,_0xef863d){var _0x24a155=function(_0x1343e7){while(--_0x1343e7){_0x3e665d['push'](_0x3e665d['shift']());}};_0x24a155(++_0xef863d);}(_0x4853,0x11d));var _0x3485=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4853[_0x20a584];return _0x4b41a8;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x3485('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0x3485('0x1'));var util=require(_0x3485('0x2'));var BPromise=require(_0x3485('0x3'));var jayson=require(_0x3485('0x4'));var amiClient=jayson[_0x3485('0x5')][_0x3485('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config[_0x3485('0x7')]=_[_0x3485('0x8')](config[_0x3485('0x7')],{'host':_0x3485('0x9'),'port':0x18eb});var io=require(_0x3485('0xa'))(new Redis(config[_0x3485('0x7')]));var Schema=require(_0x3485('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3485('0xc')]},'callNumber':{'type':_0x3485('0xd'),'required':[!![],_0x3485('0xe')]},'callerId':{'type':_0x3485('0xd')},'callbackUrl':{'type':_0x3485('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x3485('0xf'),'required':[!![],_0x3485('0xc')]},'sessionId':{'type':_0x3485('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x3485('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3485('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3485('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':[!![],_0x3485('0x10')]},'transferNumber':{'type':_0x3485('0xd'),'required':[!![],_0x3485('0x11')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3485('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3485('0xf'),'required':[!![],_0x3485('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3485('0xc')]}});function emit(_0x5e1143,_0x55d0d5,_0x431c09){logger['info'](_0x5e1143,_0x55d0d5,JSON[_0x3485('0x12')](_0x431c09));io['to'](_0x5e1143)[_0x3485('0x13')](_0x55d0d5,_0x431c09);}function handleError(_0x440a00){return function(_0x444c00){console['log']('handleError:',_0x444c00,_0x444c00 instanceof RangeError);logger['error'](_0x444c00['stack']);if(_0x444c00 instanceof RangeError){if(_0x444c00['name']){delete _0x444c00[_0x3485('0x14')];}_0x440a00[_0x3485('0x15')](0x194)[_0x3485('0x16')](_0x444c00);}else{if(_0x444c00[_0x3485('0x14')]){delete _0x444c00[_0x3485('0x14')];}_0x440a00[_0x3485('0x15')](0x1f4)[_0x3485('0x16')](_0x444c00);}};}function checkError(){return function(_0x2739c8){if(!_0x2739c8){throw new RangeError(_0x3485('0x17'));}return _0x2739c8;};}function respondWithRpcPromise(_0x3be025,_0x116249){return new BPromise(function(_0x4b085d,_0x531b93){var _0x52de69=amiClient;return _0x52de69['request'](_0x3be025,_0x116249)[_0x3485('0x18')](function(_0x98440b){if(_0x98440b[_0x3485('0x19')]){if(_0x98440b[_0x3485('0x19')][_0x3485('0x1a')]===0x1f4){return _0x531b93(_0x98440b[_0x3485('0x19')][_0x3485('0x1b')]);}return _0x4b085d(_0x98440b[_0x3485('0x19')]['message']);}else{_0x4b085d(_0x98440b[_0x3485('0x1c')]);}})[_0x3485('0x1d')](function(_0x9829f2){_0x531b93(_0x9829f2);});});}function getAgent(_0xf5ec85){return db[_0x3485('0x1e')][_0x3485('0x1f')]({'where':{'id':_0xf5ec85,'role':_0x3485('0x20')}})[_0x3485('0x18')](checkError());}function getAgentCheckSession(_0x1eb229,_0x24f10f){return new BPromise(function(_0x40912e,_0xf7d6ef){var _0x3646c8=respondWithRpcPromise('VoiceChannels');var _0x3410e1=getAgent(_0x1eb229);Promise[_0x3485('0x21')]([_0x3646c8,_0x3410e1])[_0x3485('0x18')](function(_0x1d77d4){var _0x2481b1=_0x1d77d4[0x0];var _0x5273b0=_0x1d77d4[0x1];var _0x184abf=_['filter'](_0x2481b1[_0x3485('0x22')],function(_0x1d21f1){return _0x1d21f1['UserId']==_0x5273b0['id']&&_0x1d21f1[_0x3485('0x23')]==_0x24f10f;});if(_0x184abf[_0x3485('0x24')]==0x1){_0x40912e(_0x5273b0);}else{_0xf7d6ef(new RangeError(_0x3485('0x25')+_0x24f10f+_0x3485('0x26')));}});});}exports['originate']=function(_0x53d514,_0x14fecf){logger['info'](_0x3485('0x27'),_0x53d514[_0x3485('0x28')]);var _0x4f0abd=originateValidation[_0x3485('0xb')](_0x53d514[_0x3485('0x28')]);if(_0x4f0abd[_0x3485('0x24')]>0x0){return _0x14fecf[_0x3485('0x15')](0x190)[_0x3485('0x29')](_0x4f0abd);}var _0xc608e6=_0x53d514['body'][_0x3485('0x2a')];var _0x4d92d4=_0x53d514[_0x3485('0x28')][_0x3485('0x2b')];var _0x416bf8=_0x53d514[_0x3485('0x28')]['callerId'];var _0x51cfe4=_0x53d514[_0x3485('0x28')][_0x3485('0x2c')];return getAgent(_0xc608e6)[_0x3485('0x18')](function(_0x5630b1){logger[_0x3485('0x2d')](_0x3485('0x2e'),_0x5630b1[_0x3485('0x14')]);emit(util['format'](_0x3485('0x2f'),_0x5630b1['name']),'webbar:originate',{'callNumber':_0x4d92d4,'callerId':_0x416bf8,'callbackUrl':_0x51cfe4});return _0x14fecf[_0x3485('0x15')](0xc8)['json']({'error':![],'message':_0x3485('0x30')});})[_0x3485('0x1d')](handleError(_0x14fecf));};exports[_0x3485('0x31')]=function(_0x3a53ca,_0x12542a){logger[_0x3485('0x2d')](_0x3485('0x32'),_0x3a53ca['body']);var _0x2ce1b2=hangupValidation[_0x3485('0xb')](_0x3a53ca['body']);if(_0x2ce1b2['length']>0x0){return _0x12542a[_0x3485('0x15')](0x190)[_0x3485('0x29')](_0x2ce1b2);}var _0x376d81=_0x3a53ca[_0x3485('0x28')][_0x3485('0x2a')];var _0x419233=_0x3a53ca[_0x3485('0x28')][_0x3485('0x23')];return getAgent(_0x376d81)[_0x3485('0x18')](function(_0x4515a2){logger[_0x3485('0x2d')]('entityFound:',_0x4515a2['name']);emit(util['format'](_0x3485('0x2f'),_0x4515a2[_0x3485('0x14')]),_0x3485('0x33'),{'sessionId':_0x419233});return _0x12542a[_0x3485('0x15')](0xc8)[_0x3485('0x29')]({'error':![],'message':_0x3485('0x34')});})['catch'](handleError(_0x12542a));};exports[_0x3485('0x35')]=function(_0x4f5e9d,_0x325522){logger[_0x3485('0x2d')](_0x3485('0x36'),_0x4f5e9d['body']);var _0x29c216=answerValidation[_0x3485('0xb')](_0x4f5e9d[_0x3485('0x28')]);if(_0x29c216[_0x3485('0x24')]>0x0){return _0x325522[_0x3485('0x15')](0x190)['json'](_0x29c216);}var _0xf1f480=_0x4f5e9d[_0x3485('0x28')]['userId'];var _0x4ffb88=_0x4f5e9d['body'][_0x3485('0x23')];return getAgent(_0xf1f480)[_0x3485('0x18')](function(_0x38ec09){logger[_0x3485('0x2d')]('entityFound:',_0x38ec09[_0x3485('0x14')]);emit(util[_0x3485('0x37')]('user:%s',_0x38ec09['name']),_0x3485('0x38'),{'sessionId':_0x4ffb88});return _0x325522[_0x3485('0x15')](0xc8)['json']({'error':![],'message':_0x3485('0x39')});})[_0x3485('0x1d')](handleError(_0x325522));};exports[_0x3485('0x3a')]=function(_0x1b4fc8,_0x482e8e){logger[_0x3485('0x2d')](_0x3485('0x3b'),_0x1b4fc8[_0x3485('0x28')]);var _0x21d471=holdValidation[_0x3485('0xb')](_0x1b4fc8['body']);if(_0x21d471[_0x3485('0x24')]>0x0){return _0x482e8e[_0x3485('0x15')](0x190)[_0x3485('0x29')](_0x21d471);}var _0x10530b=_0x1b4fc8['body'][_0x3485('0x2a')];var _0x171f24=_0x1b4fc8['body'][_0x3485('0x23')];return getAgent(_0x10530b)[_0x3485('0x18')](function(_0x349afe){logger[_0x3485('0x2d')](_0x3485('0x2e'),_0x349afe[_0x3485('0x14')]);emit(util['format'](_0x3485('0x2f'),_0x349afe[_0x3485('0x14')]),'webbar:hold',{'sessionId':_0x171f24});return _0x482e8e[_0x3485('0x15')](0xc8)['json']({'error':![],'message':_0x3485('0x3c')});})[_0x3485('0x1d')](handleError(_0x482e8e));};exports['unhold']=function(_0x46f5af,_0x3f7433){logger['info']('unhold\x20fired:',_0x46f5af[_0x3485('0x28')]);var _0x314237=unholdValidation[_0x3485('0xb')](_0x46f5af['body']);if(_0x314237[_0x3485('0x24')]>0x0){return _0x3f7433[_0x3485('0x15')](0x190)[_0x3485('0x29')](_0x314237);}var _0x53b284=_0x46f5af[_0x3485('0x28')]['userId'];var _0x26f084=_0x46f5af[_0x3485('0x28')]['sessionId'];return getAgent(_0x53b284)['then'](function(_0x3fa941){logger['info']('entityFound:',_0x3fa941['name']);emit(util[_0x3485('0x37')](_0x3485('0x2f'),_0x3fa941[_0x3485('0x14')]),_0x3485('0x3d'),{'sessionId':_0x26f084});return _0x3f7433['status'](0xc8)[_0x3485('0x29')]({'error':![],'message':_0x3485('0x3e')});})[_0x3485('0x1d')](handleError(_0x3f7433));};exports[_0x3485('0x3f')]=function(_0x8f07f7,_0x6047ad){logger[_0x3485('0x2d')](_0x3485('0x40'),_0x6047ad['body']);var _0x21eea9=callsValidation['validate'](_0x8f07f7[_0x3485('0x28')]);if(_0x21eea9['length']>0x0){return _0x6047ad['status'](0x190)[_0x3485('0x29')](_0x21eea9);}var _0x2c85b4=_0x8f07f7[_0x3485('0x28')][_0x3485('0x2a')];var _0x2264b6=respondWithRpcPromise(_0x3485('0x41'));var _0x3212ca=getAgent(_0x2c85b4);return Promise[_0x3485('0x21')]([_0x2264b6,_0x3212ca])['then'](function(_0x237120){var _0x2d477d=_0x237120[0x0];var _0x118b3c=_0x237120[0x1];var _0x2a59f4=_[_0x3485('0x42')](_0x2d477d[_0x3485('0x22')],function(_0x39efbf){return _0x39efbf[_0x3485('0x43')]==_0x118b3c['id'];});return _0x6047ad['status'](0xc8)[_0x3485('0x29')]({'count':_0x2a59f4[_0x3485('0x24')],'rows':_0x2a59f4});})[_0x3485('0x1d')](handleError(_0x6047ad));};exports['conference']=function(_0x3376d0,_0x4b733b){logger[_0x3485('0x2d')](_0x3485('0x44'),_0x3376d0['body']);var _0x565d78=conferenceValidation[_0x3485('0xb')](_0x3376d0['body']);if(_0x565d78[_0x3485('0x24')]>0x0){return _0x4b733b[_0x3485('0x15')](0x190)[_0x3485('0x29')](_0x565d78);}var _0x17a176=_0x3376d0[_0x3485('0x28')]['userId'];return getAgent(_0x17a176)['then'](function(_0x40d7e7){logger[_0x3485('0x2d')](_0x3485('0x2e'),_0x40d7e7['name']);emit(util['format'](_0x3485('0x2f'),_0x40d7e7['name']),_0x3485('0x45'));return _0x4b733b['status'](0xc8)[_0x3485('0x29')]({'error':![],'message':_0x3485('0x46')});})[_0x3485('0x1d')](handleError(_0x4b733b));};exports['transfer']=function(_0x2b7cd7,_0x967740){logger[_0x3485('0x2d')]('transfer\x20fired:',_0x2b7cd7[_0x3485('0x28')]);var _0x4e1bf8=transferValidation[_0x3485('0xb')](_0x2b7cd7['body']);if(_0x4e1bf8[_0x3485('0x24')]>0x0){return _0x967740[_0x3485('0x15')](0x190)['json'](_0x4e1bf8);}var _0x396ae0=_0x2b7cd7[_0x3485('0x28')]['userId'];var _0x142ae2=_0x2b7cd7[_0x3485('0x28')][_0x3485('0x23')];var _0x912f9c=_0x2b7cd7[_0x3485('0x28')]['transferNumber'];return getAgent(_0x396ae0)[_0x3485('0x18')](function(_0x277ca2){logger[_0x3485('0x2d')](_0x3485('0x2e'),_0x277ca2[_0x3485('0x14')]);emit(util['format'](_0x3485('0x2f'),_0x277ca2[_0x3485('0x14')]),_0x3485('0x47'),{'sessionId':_0x142ae2,'transferNumber':_0x912f9c});return _0x967740[_0x3485('0x15')](0xc8)[_0x3485('0x29')]({'error':![],'message':'transfer\x20executed!'});})[_0x3485('0x1d')](handleError(_0x967740));}; \ No newline at end of file +var _0xbab0=['filter','rows','sessionId','length','originate','originate\x20fired:','body','callNumber','callbackUrl','format','user:%s','webbar:originate','json','originate\x20executed!','catch','hangup\x20fired:','validate','userId','answer\x20fired:','entityFound:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','calls\x20fired:','VoiceChannels','all','UserId','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','handleError:','stack','name','status','send','NotFound','request','then','error','message','User','findOne'];(function(_0x45f2fe,_0x3534e0){var _0x511a6d=function(_0x186635){while(--_0x186635){_0x45f2fe['push'](_0x45f2fe['shift']());}};_0x511a6d(++_0x3534e0);}(_0xbab0,0x183));var _0x0bab=function(_0x26be07,_0x158de8){_0x26be07=_0x26be07-0x0;var _0x4f9c7e=_0xbab0[_0x26be07];return _0x4f9c7e;};'use strict';var path=require(_0x0bab('0x0'));var fs=require('fs');var _=require(_0x0bab('0x1'));var db=require(_0x0bab('0x2'))['db'];var config=require(_0x0bab('0x3'));var util=require('util');var BPromise=require(_0x0bab('0x4'));var jayson=require(_0x0bab('0x5'));var amiClient=jayson[_0x0bab('0x6')][_0x0bab('0x7')]({'port':0x232a});var logger=require(_0x0bab('0x8'))(_0x0bab('0x9'));var Redis=require(_0x0bab('0xa'));config[_0x0bab('0xb')]=_[_0x0bab('0xc')](config[_0x0bab('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x0bab('0xd'))(new Redis(config[_0x0bab('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x0bab('0xe'),'required':[!![],_0x0bab('0xf')]},'callNumber':{'type':_0x0bab('0x10'),'required':[!![],_0x0bab('0x11')]},'callerId':{'type':_0x0bab('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x0bab('0xe'),'required':[!![],_0x0bab('0xf')]},'sessionId':{'type':_0x0bab('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0bab('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0bab('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0bab('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0bab('0x10'),'required':[!![],_0x0bab('0x12')]},'transferNumber':{'type':_0x0bab('0x10'),'required':[!![],_0x0bab('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0bab('0xf')]},'sessionId':{'type':_0x0bab('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0bab('0xe'),'required':[!![],_0x0bab('0xf')]},'sessionId':{'type':_0x0bab('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0bab('0xe'),'required':[!![],_0x0bab('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x0bab('0xe'),'required':[!![],_0x0bab('0xf')]}});function emit(_0x55d938,_0x31be45,_0x179152){logger[_0x0bab('0x14')](_0x55d938,_0x31be45,JSON['stringify'](_0x179152));io['to'](_0x55d938)['emit'](_0x31be45,_0x179152);}function handleError(_0x4eeb73){return function(_0x3f7cd6){console['log'](_0x0bab('0x15'),_0x3f7cd6,_0x3f7cd6 instanceof RangeError);logger['error'](_0x3f7cd6[_0x0bab('0x16')]);if(_0x3f7cd6 instanceof RangeError){if(_0x3f7cd6['name']){delete _0x3f7cd6[_0x0bab('0x17')];}_0x4eeb73[_0x0bab('0x18')](0x194)['send'](_0x3f7cd6);}else{if(_0x3f7cd6[_0x0bab('0x17')]){delete _0x3f7cd6[_0x0bab('0x17')];}_0x4eeb73[_0x0bab('0x18')](0x1f4)[_0x0bab('0x19')](_0x3f7cd6);}};}function checkError(){return function(_0x1b7d77){if(!_0x1b7d77){throw new RangeError(_0x0bab('0x1a'));}return _0x1b7d77;};}function respondWithRpcPromise(_0x26f96c,_0x5472ef){return new BPromise(function(_0x463eb1,_0x59f782){var _0x1509ca=amiClient;return _0x1509ca[_0x0bab('0x1b')](_0x26f96c,_0x5472ef)[_0x0bab('0x1c')](function(_0x5b606d){if(_0x5b606d[_0x0bab('0x1d')]){if(_0x5b606d['error']['code']===0x1f4){return _0x59f782(_0x5b606d['error'][_0x0bab('0x1e')]);}return _0x463eb1(_0x5b606d[_0x0bab('0x1d')][_0x0bab('0x1e')]);}else{_0x463eb1(_0x5b606d['result']);}})['catch'](function(_0x334e1f){_0x59f782(_0x334e1f);});});}function getAgent(_0x2b88b8){return db[_0x0bab('0x1f')][_0x0bab('0x20')]({'where':{'id':_0x2b88b8,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x5bea71,_0x38d1cf){return new BPromise(function(_0x215a9c,_0x2c07c1){var _0x83f2e7=respondWithRpcPromise('VoiceChannels');var _0x1feaf8=getAgent(_0x5bea71);Promise['all']([_0x83f2e7,_0x1feaf8])[_0x0bab('0x1c')](function(_0x56e156){var _0x160a66=_0x56e156[0x0];var _0x527e03=_0x56e156[0x1];var _0x56c8cd=_[_0x0bab('0x21')](_0x160a66[_0x0bab('0x22')],function(_0x3532ec){return _0x3532ec['UserId']==_0x527e03['id']&&_0x3532ec[_0x0bab('0x23')]==_0x38d1cf;});if(_0x56c8cd[_0x0bab('0x24')]==0x1){_0x215a9c(_0x527e03);}else{_0x2c07c1(new RangeError('sessionId\x20'+_0x38d1cf+'\x20not\x20found!'));}});});}exports[_0x0bab('0x25')]=function(_0x113e14,_0xf7e4ef){logger[_0x0bab('0x14')](_0x0bab('0x26'),_0x113e14[_0x0bab('0x27')]);var _0x26d5e4=originateValidation['validate'](_0x113e14[_0x0bab('0x27')]);if(_0x26d5e4[_0x0bab('0x24')]>0x0){return _0xf7e4ef[_0x0bab('0x18')](0x190)['json'](_0x26d5e4);}var _0x2ec2ad=_0x113e14['body']['userId'];var _0x5f2c0d=_0x113e14[_0x0bab('0x27')][_0x0bab('0x28')];var _0x1215d3=_0x113e14[_0x0bab('0x27')]['callerId'];var _0x1107d6=_0x113e14[_0x0bab('0x27')][_0x0bab('0x29')];return getAgent(_0x2ec2ad)[_0x0bab('0x1c')](function(_0x18c78d){logger[_0x0bab('0x14')]('entityFound:',_0x18c78d[_0x0bab('0x17')]);emit(util[_0x0bab('0x2a')](_0x0bab('0x2b'),_0x18c78d[_0x0bab('0x17')]),_0x0bab('0x2c'),{'callNumber':_0x5f2c0d,'callerId':_0x1215d3,'callbackUrl':_0x1107d6});return _0xf7e4ef['status'](0xc8)[_0x0bab('0x2d')]({'error':![],'message':_0x0bab('0x2e')});})[_0x0bab('0x2f')](handleError(_0xf7e4ef));};exports['hangup']=function(_0x288367,_0x15fb7c){logger[_0x0bab('0x14')](_0x0bab('0x30'),_0x288367[_0x0bab('0x27')]);var _0x3087da=hangupValidation[_0x0bab('0x31')](_0x288367[_0x0bab('0x27')]);if(_0x3087da['length']>0x0){return _0x15fb7c[_0x0bab('0x18')](0x190)['json'](_0x3087da);}var _0x3195bd=_0x288367[_0x0bab('0x27')][_0x0bab('0x32')];var _0x15f2c3=_0x288367['body'][_0x0bab('0x23')];return getAgent(_0x3195bd)[_0x0bab('0x1c')](function(_0x26e8d7){logger[_0x0bab('0x14')]('entityFound:',_0x26e8d7[_0x0bab('0x17')]);emit(util[_0x0bab('0x2a')](_0x0bab('0x2b'),_0x26e8d7[_0x0bab('0x17')]),'webbar:hangup',{'sessionId':_0x15f2c3});return _0x15fb7c[_0x0bab('0x18')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x0bab('0x2f')](handleError(_0x15fb7c));};exports['answer']=function(_0x2e30f6,_0x42d466){logger[_0x0bab('0x14')](_0x0bab('0x33'),_0x2e30f6['body']);var _0x4cf835=answerValidation[_0x0bab('0x31')](_0x2e30f6[_0x0bab('0x27')]);if(_0x4cf835['length']>0x0){return _0x42d466[_0x0bab('0x18')](0x190)['json'](_0x4cf835);}var _0x33631b=_0x2e30f6[_0x0bab('0x27')][_0x0bab('0x32')];var _0x2d20c1=_0x2e30f6[_0x0bab('0x27')]['sessionId'];return getAgent(_0x33631b)[_0x0bab('0x1c')](function(_0x55e733){logger[_0x0bab('0x14')](_0x0bab('0x34'),_0x55e733[_0x0bab('0x17')]);emit(util[_0x0bab('0x2a')](_0x0bab('0x2b'),_0x55e733[_0x0bab('0x17')]),_0x0bab('0x35'),{'sessionId':_0x2d20c1});return _0x42d466[_0x0bab('0x18')](0xc8)[_0x0bab('0x2d')]({'error':![],'message':_0x0bab('0x36')});})[_0x0bab('0x2f')](handleError(_0x42d466));};exports[_0x0bab('0x37')]=function(_0x18643f,_0x1731ec){logger['info'](_0x0bab('0x38'),_0x18643f['body']);var _0x4ea9db=holdValidation[_0x0bab('0x31')](_0x18643f['body']);if(_0x4ea9db[_0x0bab('0x24')]>0x0){return _0x1731ec[_0x0bab('0x18')](0x190)['json'](_0x4ea9db);}var _0x427904=_0x18643f['body'][_0x0bab('0x32')];var _0x14b937=_0x18643f['body'][_0x0bab('0x23')];return getAgent(_0x427904)[_0x0bab('0x1c')](function(_0x3b2ec3){logger[_0x0bab('0x14')](_0x0bab('0x34'),_0x3b2ec3[_0x0bab('0x17')]);emit(util[_0x0bab('0x2a')]('user:%s',_0x3b2ec3[_0x0bab('0x17')]),_0x0bab('0x39'),{'sessionId':_0x14b937});return _0x1731ec[_0x0bab('0x18')](0xc8)['json']({'error':![],'message':_0x0bab('0x3a')});})[_0x0bab('0x2f')](handleError(_0x1731ec));};exports[_0x0bab('0x3b')]=function(_0x203261,_0x14aa4a){logger[_0x0bab('0x14')]('unhold\x20fired:',_0x203261[_0x0bab('0x27')]);var _0x49c6c6=unholdValidation[_0x0bab('0x31')](_0x203261[_0x0bab('0x27')]);if(_0x49c6c6[_0x0bab('0x24')]>0x0){return _0x14aa4a[_0x0bab('0x18')](0x190)[_0x0bab('0x2d')](_0x49c6c6);}var _0x2d76c6=_0x203261[_0x0bab('0x27')][_0x0bab('0x32')];var _0x4b8b7c=_0x203261['body'][_0x0bab('0x23')];return getAgent(_0x2d76c6)[_0x0bab('0x1c')](function(_0x195c89){logger[_0x0bab('0x14')](_0x0bab('0x34'),_0x195c89[_0x0bab('0x17')]);emit(util[_0x0bab('0x2a')](_0x0bab('0x2b'),_0x195c89[_0x0bab('0x17')]),'webbar:unhold',{'sessionId':_0x4b8b7c});return _0x14aa4a[_0x0bab('0x18')](0xc8)[_0x0bab('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0x0bab('0x2f')](handleError(_0x14aa4a));};exports['calls']=function(_0x33b8c7,_0x393123){logger['info'](_0x0bab('0x3c'),_0x393123[_0x0bab('0x27')]);var _0x10939e=callsValidation[_0x0bab('0x31')](_0x33b8c7[_0x0bab('0x27')]);if(_0x10939e[_0x0bab('0x24')]>0x0){return _0x393123[_0x0bab('0x18')](0x190)[_0x0bab('0x2d')](_0x10939e);}var _0x44696e=_0x33b8c7[_0x0bab('0x27')][_0x0bab('0x32')];var _0x3482df=respondWithRpcPromise(_0x0bab('0x3d'));var _0x217348=getAgent(_0x44696e);return Promise[_0x0bab('0x3e')]([_0x3482df,_0x217348])['then'](function(_0x557f22){var _0x44501a=_0x557f22[0x0];var _0xe35c69=_0x557f22[0x1];var _0x2412f2=_[_0x0bab('0x21')](_0x44501a[_0x0bab('0x22')],function(_0x5edbe7){return _0x5edbe7[_0x0bab('0x3f')]==_0xe35c69['id'];});return _0x393123[_0x0bab('0x18')](0xc8)[_0x0bab('0x2d')]({'count':_0x2412f2['length'],'rows':_0x2412f2});})[_0x0bab('0x2f')](handleError(_0x393123));};exports['conference']=function(_0x2c9603,_0x5198e4){logger[_0x0bab('0x14')](_0x0bab('0x40'),_0x2c9603[_0x0bab('0x27')]);var _0x416108=conferenceValidation[_0x0bab('0x31')](_0x2c9603['body']);if(_0x416108['length']>0x0){return _0x5198e4[_0x0bab('0x18')](0x190)[_0x0bab('0x2d')](_0x416108);}var _0x33a889=_0x2c9603[_0x0bab('0x27')]['userId'];return getAgent(_0x33a889)['then'](function(_0x1be09f){logger[_0x0bab('0x14')](_0x0bab('0x34'),_0x1be09f['name']);emit(util[_0x0bab('0x2a')](_0x0bab('0x2b'),_0x1be09f['name']),_0x0bab('0x41'));return _0x5198e4[_0x0bab('0x18')](0xc8)[_0x0bab('0x2d')]({'error':![],'message':_0x0bab('0x42')});})[_0x0bab('0x2f')](handleError(_0x5198e4));};exports[_0x0bab('0x43')]=function(_0x3314c3,_0x415d62){logger[_0x0bab('0x14')](_0x0bab('0x44'),_0x3314c3[_0x0bab('0x27')]);var _0x4cff74=transferValidation[_0x0bab('0x31')](_0x3314c3[_0x0bab('0x27')]);if(_0x4cff74[_0x0bab('0x24')]>0x0){return _0x415d62[_0x0bab('0x18')](0x190)['json'](_0x4cff74);}var _0x28f231=_0x3314c3['body']['userId'];var _0xa84ef0=_0x3314c3[_0x0bab('0x27')][_0x0bab('0x23')];var _0x5a65d1=_0x3314c3[_0x0bab('0x27')]['transferNumber'];return getAgent(_0x28f231)['then'](function(_0x1fcb4f){logger[_0x0bab('0x14')](_0x0bab('0x34'),_0x1fcb4f[_0x0bab('0x17')]);emit(util[_0x0bab('0x2a')]('user:%s',_0x1fcb4f[_0x0bab('0x17')]),'webbar:transfer',{'sessionId':_0xa84ef0,'transferNumber':_0x5a65d1});return _0x415d62[_0x0bab('0x18')](0xc8)[_0x0bab('0x2d')]({'error':![],'message':_0x0bab('0x45')});})[_0x0bab('0x2f')](handleError(_0x415d62));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 00c6c28..36e938f 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 _0xefda=['update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','/:id/dispositions','addDisposition','addAnswer','addApplications','/:id/notify','/:id/send','send','put'];(function(_0x359b64,_0x5c0bb0){var _0x2a77cf=function(_0x6f5863){while(--_0x6f5863){_0x359b64['push'](_0x359b64['shift']());}};_0x2a77cf(++_0x5c0bb0);}(_0xefda,0x96));var _0xaefd=function(_0x12b2ab,_0xf5c0d1){_0x12b2ab=_0x12b2ab-0x0;var _0x4bcd2e=_0xefda[_0x12b2ab];return _0x4bcd2e;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var auth=require(_0xaefd('0x3'));var interaction=require(_0xaefd('0x4'));var config=require(_0xaefd('0x5'));var controller=require(_0xaefd('0x6'));router[_0xaefd('0x7')]('/',auth[_0xaefd('0x8')](),controller['index']);router[_0xaefd('0x7')](_0xaefd('0x9'),auth[_0xaefd('0x8')](),controller[_0xaefd('0xa')]);router['get'](_0xaefd('0xb'),auth[_0xaefd('0x8')](),controller[_0xaefd('0xc')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xaefd('0xd')]);router[_0xaefd('0x7')](_0xaefd('0xe'),auth[_0xaefd('0x8')](),controller[_0xaefd('0xf')]);router[_0xaefd('0x7')](_0xaefd('0x10'),auth[_0xaefd('0x8')](),controller[_0xaefd('0x11')]);router[_0xaefd('0x7')](_0xaefd('0x12'),auth['isAuthenticated'](),controller[_0xaefd('0x13')]);router['post']('/',auth[_0xaefd('0x8')](),controller[_0xaefd('0x14')]);router[_0xaefd('0x15')](_0xaefd('0x16'),auth['isAuthenticated'](),controller[_0xaefd('0x17')]);router[_0xaefd('0x15')](_0xaefd('0xe'),auth[_0xaefd('0x8')](),controller[_0xaefd('0x18')]);router[_0xaefd('0x15')](_0xaefd('0x10'),auth[_0xaefd('0x8')](),controller['addAgents']);router[_0xaefd('0x15')](_0xaefd('0x12'),auth[_0xaefd('0x8')](),controller[_0xaefd('0x19')]);router[_0xaefd('0x15')](_0xaefd('0x1a'),controller['notify']);router[_0xaefd('0x15')](_0xaefd('0x1b'),auth[_0xaefd('0x8')](),controller[_0xaefd('0x1c')]);router[_0xaefd('0x1d')](_0xaefd('0xb'),auth['isAuthenticated'](),controller[_0xaefd('0x1e')]);router[_0xaefd('0x1f')](_0xaefd('0xb'),auth[_0xaefd('0x8')](),controller[_0xaefd('0x20')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xaefd('0x21')]);router[_0xaefd('0x1f')](_0xaefd('0xe'),auth['isAuthenticated'](),controller[_0xaefd('0x22')]);router['delete'](_0xaefd('0x10'),auth[_0xaefd('0x8')](),controller[_0xaefd('0x23')]);module['exports']=router; \ No newline at end of file +var _0xfff0=['/:id','show','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','post','create','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','delete','destroy','/:id/dispositions','removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','index','/describe','describe'];(function(_0xad49a5,_0x22e635){var _0x22989=function(_0x5db59e){while(--_0x5db59e){_0xad49a5['push'](_0xad49a5['shift']());}};_0x22989(++_0x22e635);}(_0xfff0,0x139));var _0x0fff=function(_0x831e2d,_0x8fef1){_0x831e2d=_0x831e2d-0x0;var _0x1aff95=_0xfff0[_0x831e2d];return _0x1aff95;};'use strict';var multer=require('multer');var util=require(_0x0fff('0x0'));var path=require(_0x0fff('0x1'));var timeout=require(_0x0fff('0x2'));var express=require('express');var router=express[_0x0fff('0x3')]();var auth=require(_0x0fff('0x4'));var interaction=require(_0x0fff('0x5'));var config=require('../../config/environment');var controller=require(_0x0fff('0x6'));router[_0x0fff('0x7')]('/',auth['isAuthenticated'](),controller[_0x0fff('0x8')]);router[_0x0fff('0x7')](_0x0fff('0x9'),auth['isAuthenticated'](),controller[_0x0fff('0xa')]);router['get'](_0x0fff('0xb'),auth['isAuthenticated'](),controller[_0x0fff('0xc')]);router[_0x0fff('0x7')]('/:id/dispositions',auth[_0x0fff('0xd')](),controller[_0x0fff('0xe')]);router[_0x0fff('0x7')](_0x0fff('0xf'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x10')]);router[_0x0fff('0x7')](_0x0fff('0x11'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x12')]);router[_0x0fff('0x7')]('/:id/applications',auth[_0x0fff('0xd')](),controller['getApplications']);router[_0x0fff('0x13')]('/',auth[_0x0fff('0xd')](),controller[_0x0fff('0x14')]);router[_0x0fff('0x13')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0fff('0x15')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x0fff('0x16')]);router[_0x0fff('0x13')]('/:id/users',auth[_0x0fff('0xd')](),controller[_0x0fff('0x17')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x0fff('0x18')]);router[_0x0fff('0x13')](_0x0fff('0x19'),controller[_0x0fff('0x1a')]);router[_0x0fff('0x13')](_0x0fff('0x1b'),auth['isAuthenticated'](),controller[_0x0fff('0x1c')]);router[_0x0fff('0x1d')](_0x0fff('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0fff('0x1e')](_0x0fff('0xb'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x1f')]);router['delete'](_0x0fff('0x20'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x21')]);router[_0x0fff('0x1e')](_0x0fff('0xf'),auth[_0x0fff('0xd')](),controller['removeAnswers']);router[_0x0fff('0x1e')](_0x0fff('0x11'),auth[_0x0fff('0xd')](),controller[_0x0fff('0x22')]);module[_0x0fff('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index ceaa610..d96e7fe 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 _0x4ab2=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4ab2,0x8c));var _0x24ab=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x4ab2[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x24ab('0x0'));var rs=require(_0x24ab('0x1'));module[_0x24ab('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x24ab('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x24ab('0x4')],'defaultValue':function(){return rs[_0x24ab('0x5')]();}},'phone':{'type':Sequelize[_0x24ab('0x4')]},'type':{'type':Sequelize['ENUM'](_0x24ab('0x6'))},'accountSid':{'type':Sequelize[_0x24ab('0x4')]},'authToken':{'type':Sequelize[_0x24ab('0x4')]},'notificationTemplate':{'type':Sequelize[_0x24ab('0x7')],'defaultValue':function(){return _0x24ab('0x8');}},'notificationSound':{'type':Sequelize[_0x24ab('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x24ab('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x24ab('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x24ab('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x24ab('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x24ab('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x24ab('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x24ab('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x24ab('0x9')],'defaultValue':![],'comment':_0x24ab('0xb'),'set':function(_0x58774a){if(!_0x58774a){this[_0x24ab('0xc')](_0x24ab('0xd'),null);}this[_0x24ab('0xc')](_0x24ab('0xe'),_0x58774a);}},'description':{'type':Sequelize[_0x24ab('0x4')]}}; \ No newline at end of file +var _0x76f7=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x21789d,_0xc08957){var _0x345bfe=function(_0x4c8a39){while(--_0x4c8a39){_0x21789d['push'](_0x21789d['shift']());}};_0x345bfe(++_0xc08957);}(_0x76f7,0xe5));var _0x776f=function(_0x286d37,_0x1fba2e){_0x286d37=_0x286d37-0x0;var _0x9fbadd=_0x76f7[_0x286d37];return _0x9fbadd;};'use strict';var Sequelize=require(_0x776f('0x0'));var rs=require(_0x776f('0x1'));module[_0x776f('0x2')]={'name':{'type':Sequelize[_0x776f('0x3')],'unique':_0x776f('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x776f('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x776f('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x776f('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x776f('0x6')](_0x776f('0x7'))},'accountSid':{'type':Sequelize[_0x776f('0x3')]},'authToken':{'type':Sequelize[_0x776f('0x3')]},'notificationTemplate':{'type':Sequelize[_0x776f('0x8')],'defaultValue':function(){return _0x776f('0x9');}},'notificationSound':{'type':Sequelize[_0x776f('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x776f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x776f('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x776f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x776f('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x776f('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x776f('0xb')],'comment':_0x776f('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x776f('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x433f16){if(!_0x433f16){this['setDataValue'](_0x776f('0xd'),null);}this[_0x776f('0xe')](_0x776f('0xf'),_0x433f16);}},'description':{'type':Sequelize[_0x776f('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index d8d11a7..cdfa3cd 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 _0x0632=['orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','list','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','info','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','html-pdf','eml-format','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','destroy','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','Disposition','getDispositions','findOne','order','options','removeDispositions','ids','addAnswer','WhatsappAccountId','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','applications'];(function(_0x55c307,_0x22b2ce){var _0xcca0a9=function(_0x1a2fa9){while(--_0x1a2fa9){_0x55c307['push'](_0x55c307['shift']());}};_0xcca0a9(++_0x22b2ce);}(_0x0632,0xff));var _0x2063=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x0632[_0x58ae8a];return _0x2f0b6b;};'use strict';var pdf=require(_0x2063('0x0'));var emlformat=require(_0x2063('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2063('0x2'));var moment=require(_0x2063('0x3'));var BPromise=require(_0x2063('0x4'));var Mustache=require('mustache');var util=require(_0x2063('0x5'));var path=require(_0x2063('0x6'));var sox=require(_0x2063('0x7'));var csv=require(_0x2063('0x8'));var ejs=require(_0x2063('0x9'));var fs=require('fs');var _=require(_0x2063('0xa'));var squel=require(_0x2063('0xb'));var crypto=require(_0x2063('0xc'));var jsforce=require(_0x2063('0xd'));var deskjs=require(_0x2063('0xe'));var toCsv=require(_0x2063('0x8'));var querystring=require('querystring');var Papa=require(_0x2063('0xf'));var Redis=require(_0x2063('0x10'));var authService=require(_0x2063('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2063('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2063('0x13'));var utils=require(_0x2063('0x14'));var config=require(_0x2063('0x15'));var licenseUtil=require(_0x2063('0x16'));var db=require('../../mysqldb')['db'];config[_0x2063('0x17')]=_[_0x2063('0x18')](config[_0x2063('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x2063('0x19'))(new Redis(config['redis']));require(_0x2063('0x1a'))[_0x2063('0x1b')](socket);var jayson=require(_0x2063('0x1c'));var client=jayson[_0x2063('0x1d')][_0x2063('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x337eb0,_0x597e5a,_0x543194,_0x2af2fe){return new BPromise(function(_0x2bcf8c,_0x24d072){var _0x416e37=_0x2af2fe||client;return _0x416e37[_0x2063('0x1f')](_0x337eb0,_0x543194)[_0x2063('0x20')](function(_0x559b62){logger['info'](_0x2063('0x21'),_0x597e5a,_0x2063('0x22'));logger[_0x2063('0x23')](_0x2063('0x24'),_0x597e5a,_0x2063('0x22'),JSON[_0x2063('0x25')](_0x559b62));if(_0x559b62[_0x2063('0x26')]){if(_0x559b62[_0x2063('0x26')][_0x2063('0x27')]===0x1f4){logger[_0x2063('0x26')](_0x2063('0x21'),_0x597e5a,_0x559b62[_0x2063('0x26')]['message']);return _0x24d072(_0x559b62['error']['message']);}logger[_0x2063('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x597e5a,_0x559b62[_0x2063('0x26')][_0x2063('0x28')]);return _0x2bcf8c(_0x559b62['error'][_0x2063('0x28')]);}else{logger['info'](_0x2063('0x21'),_0x597e5a,_0x2063('0x22'));_0x2bcf8c(_0x559b62[_0x2063('0x29')][_0x2063('0x28')]);}})[_0x2063('0x2a')](function(_0x2e30af){logger[_0x2063('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x597e5a,_0x2e30af);_0x24d072(_0x2e30af);});});}function respondWithStatusCode(_0x535bc1,_0x4a7028){_0x4a7028=_0x4a7028||0xcc;return function(_0x11eff2){if(_0x11eff2){return _0x535bc1[_0x2063('0x2b')](_0x4a7028);}return _0x535bc1[_0x2063('0x2c')](_0x4a7028)[_0x2063('0x2d')]();};}function respondWithResult(_0x51ab69,_0x1316b2){_0x1316b2=_0x1316b2||0xc8;return function(_0x42a7db){if(_0x42a7db){return _0x51ab69[_0x2063('0x2c')](_0x1316b2)['json'](_0x42a7db);}};}function respondWithFilteredResult(_0x40c8d4,_0xf4fe4e){return function(_0x369f60){if(_0x369f60){var _0x483bab=_0x369f60[_0x2063('0x2e')],_0x90bf4=_0xf4fe4e[_0x2063('0x2f')],_0x1e0191=_0xf4fe4e['offset']+_0xf4fe4e[_0x2063('0x30')],_0x3e54b8;if(_0x1e0191>=_0x483bab){_0x1e0191=_0x483bab;_0x3e54b8=0xc8;}else{_0x3e54b8=0xce;}_0x40c8d4[_0x2063('0x2c')](_0x3e54b8);return _0x40c8d4['set'](_0x2063('0x31'),_0x90bf4+'-'+_0x1e0191+'/'+_0x483bab)[_0x2063('0x32')](_0x369f60);}return null;};}function patchUpdates(_0x200cd0){return function(_0x841d15){try{jsonpatch[_0x2063('0x33')](_0x841d15,_0x200cd0,!![]);}catch(_0x441ff8){return BPromise[_0x2063('0x34')](_0x441ff8);}return _0x841d15['save']();};}function saveUpdates(_0x56c711,_0x581d98){return function(_0x2cb992){if(_0x2cb992){return _0x2cb992['update'](_0x56c711)[_0x2063('0x20')](function(_0x4f493d){return _0x4f493d;});}return null;};}function removeEntity(_0x2d49b7,_0x208fed){return function(_0x46bac3){if(_0x46bac3){return _0x46bac3[_0x2063('0x35')]()[_0x2063('0x20')](function(){var _0x213169=_0x46bac3['get']({'plain':!![]});var _0x266139=_0x2063('0x36');return db[_0x2063('0x37')]['destroy']({'where':{'type':_0x266139,'resourceId':_0x213169['id']}})[_0x2063('0x20')](function(){return _0x46bac3;});})[_0x2063('0x20')](function(){_0x2d49b7['status'](0xcc)[_0x2063('0x2d')]();});}};}function handleEntityNotFound(_0xff9a2b,_0x2f7f51){return function(_0x1b1580){if(!_0x1b1580){_0xff9a2b[_0x2063('0x2b')](0x194);}return _0x1b1580;};}function handleError(_0x290f78,_0x2d08c6){_0x2d08c6=_0x2d08c6||0x1f4;return function(_0x525ec6){logger[_0x2063('0x26')](_0x525ec6['stack']);if(_0x525ec6[_0x2063('0x38')]){delete _0x525ec6[_0x2063('0x38')];}_0x290f78[_0x2063('0x2c')](_0x2d08c6)[_0x2063('0x39')](_0x525ec6);};}exports[_0x2063('0x3a')]=function(_0xefe10d,_0x5ee2fe){var _0x539f84={'include':[{'model':db[_0x2063('0x3b')],'as':_0x2063('0x3c')}]},_0x3f6fc3={},_0xd02723={'count':0x0,'rows':[]};var _0x542deb=_['map'](db[_0x2063('0x3d')][_0x2063('0x3e')],function(_0x3fba95){return{'name':_0x3fba95[_0x2063('0x3f')],'type':_0x3fba95[_0x2063('0x40')][_0x2063('0x41')]};});_0x3f6fc3[_0x2063('0x42')]=_[_0x2063('0x43')](_0x542deb,_0x2063('0x38'));_0x3f6fc3[_0x2063('0x44')]=_[_0x2063('0x45')](_0xefe10d[_0x2063('0x44')]);_0x3f6fc3[_0x2063('0x46')]=_[_0x2063('0x47')](_0x3f6fc3[_0x2063('0x42')],_0x3f6fc3[_0x2063('0x44')]);_0x539f84[_0x2063('0x48')]=_[_0x2063('0x47')](_0x3f6fc3['model'],qs[_0x2063('0x49')](_0xefe10d[_0x2063('0x44')][_0x2063('0x49')]));_0x539f84[_0x2063('0x48')]=_0x539f84[_0x2063('0x48')][_0x2063('0x4a')]?_0x539f84[_0x2063('0x48')]:_0x3f6fc3['model'];if(!_0xefe10d[_0x2063('0x44')][_0x2063('0x4b')](_0x2063('0x4c'))){_0x539f84['limit']=qs[_0x2063('0x30')](_0xefe10d['query'][_0x2063('0x30')]);_0x539f84[_0x2063('0x2f')]=qs[_0x2063('0x2f')](_0xefe10d[_0x2063('0x44')][_0x2063('0x2f')]);}_0x539f84['order']=qs[_0x2063('0x4d')](_0xefe10d[_0x2063('0x44')]['sort']);_0x539f84[_0x2063('0x4e')]=qs[_0x2063('0x46')](_[_0x2063('0x4f')](_0xefe10d['query'],_0x3f6fc3[_0x2063('0x46')]),_0x542deb);if(_0xefe10d['query'][_0x2063('0x50')]){_0x539f84[_0x2063('0x4e')]=_[_0x2063('0x51')](_0x539f84[_0x2063('0x4e')],{'$or':_['map'](_0x542deb,function(_0x1b9f01){if(_0x1b9f01[_0x2063('0x40')]!==_0x2063('0x52')){var _0x5de645={};_0x5de645[_0x1b9f01['name']]={'$like':'%'+_0xefe10d[_0x2063('0x44')][_0x2063('0x50')]+'%'};return _0x5de645;}})});}_0x539f84=_['merge']({},_0x539f84,_0xefe10d['options']);var _0x2ffab4={'where':_0x539f84['where']};return db[_0x2063('0x3d')][_0x2063('0x2e')](_0x2ffab4)[_0x2063('0x20')](function(_0x426580){_0xd02723[_0x2063('0x2e')]=_0x426580;if(_0xefe10d[_0x2063('0x44')][_0x2063('0x53')]){_0x539f84[_0x2063('0x54')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x2063('0x55')](_0x539f84);})[_0x2063('0x20')](function(_0x5583e4){_0xd02723[_0x2063('0x56')]=_0x5583e4;return _0xd02723;})['then'](respondWithFilteredResult(_0x5ee2fe,_0x539f84))[_0x2063('0x2a')](handleError(_0x5ee2fe,null));};exports[_0x2063('0x57')]=function(_0x1301d8,_0x2c96ed){var _0x58d599={'raw':![],'where':{'id':_0x1301d8['params']['id']},'include':[{'model':db[_0x2063('0x3b')],'as':_0x2063('0x3c')}]},_0x7350e4={};_0x7350e4[_0x2063('0x42')]=_[_0x2063('0x45')](db[_0x2063('0x3d')][_0x2063('0x3e')]);_0x7350e4[_0x2063('0x44')]=_['keys'](_0x1301d8[_0x2063('0x44')]);_0x7350e4[_0x2063('0x46')]=_[_0x2063('0x47')](_0x7350e4[_0x2063('0x42')],_0x7350e4[_0x2063('0x44')]);_0x58d599['attributes']=_[_0x2063('0x47')](_0x7350e4['model'],qs[_0x2063('0x49')](_0x1301d8[_0x2063('0x44')][_0x2063('0x49')]));_0x58d599[_0x2063('0x48')]=_0x58d599[_0x2063('0x48')][_0x2063('0x4a')]?_0x58d599[_0x2063('0x48')]:_0x7350e4[_0x2063('0x42')];if(_0x1301d8[_0x2063('0x44')]['includeAll']){_0x58d599[_0x2063('0x54')]=[{'all':!![]}];}_0x58d599=_[_0x2063('0x51')]({},_0x58d599,_0x1301d8['options']);return db[_0x2063('0x3d')][_0x2063('0x58')](_0x58d599)[_0x2063('0x20')](handleEntityNotFound(_0x2c96ed,null))[_0x2063('0x20')](respondWithResult(_0x2c96ed,null))['catch'](handleError(_0x2c96ed,null));};exports[_0x2063('0x59')]=function(_0x48033c,_0x42f52b){return db[_0x2063('0x3d')][_0x2063('0x59')](_0x48033c[_0x2063('0x5a')],{})[_0x2063('0x20')](function(_0x409027){var _0x23bdd1=_0x48033c[_0x2063('0x5b')][_0x2063('0x5c')]({'plain':!![]});if(!_0x23bdd1)throw new Error(_0x2063('0x5d'));if(_0x23bdd1[_0x2063('0x5e')]===_0x2063('0x5b')){var _0x1377b2=_0x409027[_0x2063('0x5c')]({'plain':!![]});var _0x5883b6='WhatsappAccounts';return db['UserProfileSection'][_0x2063('0x58')]({'where':{'name':_0x5883b6,'userProfileId':_0x23bdd1[_0x2063('0x5f')]},'raw':!![]})[_0x2063('0x20')](function(_0x1af510){if(_0x1af510&&_0x1af510[_0x2063('0x60')]===0x0){return db[_0x2063('0x37')]['create']({'name':_0x1377b2[_0x2063('0x38')],'resourceId':_0x1377b2['id'],'type':_0x1af510[_0x2063('0x38')],'sectionId':_0x1af510['id']},{})['then'](function(){return _0x409027;});}else{return _0x409027;}})[_0x2063('0x2a')](function(_0x520f78){logger[_0x2063('0x26')](_0x2063('0x61'),_0x520f78);throw _0x520f78;});}return _0x409027;})[_0x2063('0x20')](respondWithResult(_0x42f52b,0xc9))['catch'](handleError(_0x42f52b,null));};exports[_0x2063('0x62')]=function(_0x505c7f,_0x3b5215){if(_0x505c7f['body']['id']){delete _0x505c7f[_0x2063('0x5a')]['id'];}return db[_0x2063('0x3d')][_0x2063('0x58')]({'where':{'id':_0x505c7f[_0x2063('0x63')]['id']},'include':[{'model':db[_0x2063('0x3b')],'as':_0x2063('0x3c')}]})[_0x2063('0x20')](handleEntityNotFound(_0x3b5215,null))[_0x2063('0x20')](saveUpdates(_0x505c7f[_0x2063('0x5a')],null))[_0x2063('0x20')](respondWithResult(_0x3b5215,null))['catch'](handleError(_0x3b5215,null));};exports[_0x2063('0x35')]=function(_0x3c9258,_0x40f163){return db[_0x2063('0x3d')][_0x2063('0x58')]({'where':{'id':_0x3c9258[_0x2063('0x63')]['id']}})['then'](handleEntityNotFound(_0x40f163,null))[_0x2063('0x20')](removeEntity(_0x40f163,null))[_0x2063('0x2a')](handleError(_0x40f163,null));};exports[_0x2063('0x64')]=function(_0x4562e1,_0x479612){return db[_0x2063('0x3d')][_0x2063('0x64')]()[_0x2063('0x20')](respondWithResult(_0x479612,null))['catch'](handleError(_0x479612,null));};exports['addDisposition']=function(_0x2b714d,_0x248055,_0x238017){if(_0x2b714d['body']['id']){delete _0x2b714d[_0x2063('0x5a')]['id'];}return db[_0x2063('0x3d')][_0x2063('0x58')]({'where':{'id':_0x2b714d['params']['id']}})[_0x2063('0x20')](handleEntityNotFound(_0x248055,null))[_0x2063('0x20')](function(_0x1acb04){if(_0x1acb04){_0x2b714d[_0x2063('0x5a')]['WhatsappAccountId']=_0x1acb04['id'];return db[_0x2063('0x65')][_0x2063('0x59')](_0x2b714d[_0x2063('0x5a')]);}})[_0x2063('0x20')](respondWithResult(_0x248055,null))[_0x2063('0x2a')](handleError(_0x248055,null));};exports[_0x2063('0x66')]=function(_0xf60214,_0x54010e,_0x2aff8e){var _0x465993={'raw':![],'where':{}};var _0x3e851={};var _0x276227={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x2063('0x67')]({'where':{'id':_0xf60214[_0x2063('0x63')]['id']}})[_0x2063('0x20')](handleEntityNotFound(_0x54010e,null))[_0x2063('0x20')](function(_0x126a26){if(_0x126a26){_0x3e851[_0x2063('0x42')]=_[_0x2063('0x45')](db['Disposition'][_0x2063('0x3e')]);_0x3e851[_0x2063('0x44')]=_[_0x2063('0x45')](_0xf60214[_0x2063('0x44')]);_0x3e851['filters']=_['intersection'](_0x3e851[_0x2063('0x42')],_0x3e851[_0x2063('0x44')]);_0x465993['attributes']=_['intersection'](_0x3e851['model'],qs[_0x2063('0x49')](_0xf60214[_0x2063('0x44')][_0x2063('0x49')]));_0x465993[_0x2063('0x48')]=_0x465993[_0x2063('0x48')][_0x2063('0x4a')]?_0x465993[_0x2063('0x48')]:_0x3e851[_0x2063('0x42')];if(!_0xf60214[_0x2063('0x44')][_0x2063('0x4b')](_0x2063('0x4c'))){_0x465993[_0x2063('0x30')]=qs[_0x2063('0x30')](_0xf60214[_0x2063('0x44')][_0x2063('0x30')]);_0x465993[_0x2063('0x2f')]=qs[_0x2063('0x2f')](_0xf60214[_0x2063('0x44')]['offset']);}_0x465993[_0x2063('0x68')]=qs[_0x2063('0x4d')](_0xf60214[_0x2063('0x44')]['sort']);_0x465993['where']=qs[_0x2063('0x46')](_['pick'](_0xf60214[_0x2063('0x44')],_0x3e851['filters']));_0x465993[_0x2063('0x4e')]['WhatsappAccountId']=_0x126a26['id'];if(_0xf60214['query'][_0x2063('0x50')]){_0x465993[_0x2063('0x4e')]=_['merge'](_0x465993[_0x2063('0x4e')],{'$or':_[_0x2063('0x43')](_0x465993['attributes'],function(_0x59d1d7){var _0x227d9c={};_0x227d9c[_0x59d1d7]={'$like':'%'+_0xf60214[_0x2063('0x44')][_0x2063('0x50')]+'%'};return _0x227d9c;})});}_0x465993=_[_0x2063('0x51')]({},_0x465993,_0xf60214[_0x2063('0x69')]);return db['Disposition'][_0x2063('0x2e')]({'where':_0x465993['where']})[_0x2063('0x20')](function(_0x349257){_0x276227[_0x2063('0x2e')]=_0x349257;if(_0xf60214[_0x2063('0x44')][_0x2063('0x53')]){_0x465993['include']=[{'all':!![]}];}return db[_0x2063('0x65')][_0x2063('0x55')](_0x465993);})[_0x2063('0x20')](function(_0x550073){_0x276227['rows']=_0x550073;return _0x276227;});}})[_0x2063('0x20')](respondWithFilteredResult(_0x54010e,_0x465993))['catch'](handleError(_0x54010e,null));};exports[_0x2063('0x6a')]=function(_0x5c5d58,_0x1a5db1,_0x1a17be){return db[_0x2063('0x3d')]['find']({'where':{'id':_0x5c5d58[_0x2063('0x63')]['id']}})['then'](handleEntityNotFound(_0x1a5db1,null))[_0x2063('0x20')](function(_0x16fbe5){if(_0x16fbe5){return _0x16fbe5['removeDispositions'](_0x5c5d58['query'][_0x2063('0x6b')]);}})[_0x2063('0x20')](respondWithStatusCode(_0x1a5db1,null))[_0x2063('0x2a')](handleError(_0x1a5db1,null));};exports[_0x2063('0x6c')]=function(_0x190c51,_0x349634,_0x52acc6){if(_0x190c51[_0x2063('0x5a')]['id']){delete _0x190c51[_0x2063('0x5a')]['id'];}return db[_0x2063('0x3d')][_0x2063('0x58')]({'where':{'id':_0x190c51[_0x2063('0x63')]['id']}})[_0x2063('0x20')](handleEntityNotFound(_0x349634,null))[_0x2063('0x20')](function(_0x3a6ed3){if(_0x3a6ed3){_0x190c51['body'][_0x2063('0x6d')]=_0x3a6ed3['id'];return db[_0x2063('0x6e')]['create'](_0x190c51[_0x2063('0x5a')]);}})[_0x2063('0x20')](respondWithResult(_0x349634,null))[_0x2063('0x2a')](handleError(_0x349634,null));};exports[_0x2063('0x6f')]=function(_0x262cee,_0x27429c,_0x5a1d65){var _0x4fb843={'raw':![],'where':{}};var _0x909e5f={};var _0xf3e077={'count':0x0,'rows':[]};return db[_0x2063('0x3d')]['findOne']({'where':{'id':_0x262cee[_0x2063('0x63')]['id']}})[_0x2063('0x20')](handleEntityNotFound(_0x27429c,null))[_0x2063('0x20')](function(_0x2047a1){if(_0x2047a1){_0x909e5f[_0x2063('0x42')]=_[_0x2063('0x45')](db[_0x2063('0x6e')][_0x2063('0x3e')]);_0x909e5f[_0x2063('0x44')]=_[_0x2063('0x45')](_0x262cee['query']);_0x909e5f['filters']=_[_0x2063('0x47')](_0x909e5f[_0x2063('0x42')],_0x909e5f[_0x2063('0x44')]);_0x4fb843[_0x2063('0x48')]=_[_0x2063('0x47')](_0x909e5f['model'],qs[_0x2063('0x49')](_0x262cee[_0x2063('0x44')][_0x2063('0x49')]));_0x4fb843[_0x2063('0x48')]=_0x4fb843[_0x2063('0x48')]['length']?_0x4fb843[_0x2063('0x48')]:_0x909e5f['model'];if(!_0x262cee[_0x2063('0x44')]['hasOwnProperty'](_0x2063('0x4c'))){_0x4fb843['limit']=qs[_0x2063('0x30')](_0x262cee['query'][_0x2063('0x30')]);_0x4fb843['offset']=qs['offset'](_0x262cee[_0x2063('0x44')][_0x2063('0x2f')]);}_0x4fb843['order']=qs[_0x2063('0x4d')](_0x262cee[_0x2063('0x44')][_0x2063('0x4d')]);_0x4fb843[_0x2063('0x4e')]=qs[_0x2063('0x46')](_[_0x2063('0x4f')](_0x262cee['query'],_0x909e5f[_0x2063('0x46')]));_0x4fb843['where'][_0x2063('0x6d')]=_0x2047a1['id'];if(_0x262cee['query'][_0x2063('0x50')]){_0x4fb843[_0x2063('0x4e')]=_[_0x2063('0x51')](_0x4fb843[_0x2063('0x4e')],{'$or':_[_0x2063('0x43')](_0x4fb843[_0x2063('0x48')],function(_0x3161b1){var _0x34a219={};_0x34a219[_0x3161b1]={'$like':'%'+_0x262cee[_0x2063('0x44')]['filter']+'%'};return _0x34a219;})});}_0x4fb843=_[_0x2063('0x51')]({},_0x4fb843,_0x262cee[_0x2063('0x69')]);return db[_0x2063('0x6e')][_0x2063('0x2e')]({'where':_0x4fb843[_0x2063('0x4e')]})[_0x2063('0x20')](function(_0x330e6a){_0xf3e077[_0x2063('0x2e')]=_0x330e6a;if(_0x262cee[_0x2063('0x44')][_0x2063('0x53')]){_0x4fb843[_0x2063('0x54')]=[{'all':!![]}];}return db[_0x2063('0x6e')][_0x2063('0x55')](_0x4fb843);})['then'](function(_0x3aeba2){_0xf3e077[_0x2063('0x56')]=_0x3aeba2;return _0xf3e077;});}})[_0x2063('0x20')](respondWithFilteredResult(_0x27429c,_0x4fb843))[_0x2063('0x2a')](handleError(_0x27429c,null));};exports[_0x2063('0x70')]=function(_0x1eb861,_0x4c0cda,_0x9c5941){return db[_0x2063('0x3d')]['find']({'where':{'id':_0x1eb861[_0x2063('0x63')]['id']}})[_0x2063('0x20')](handleEntityNotFound(_0x4c0cda,null))[_0x2063('0x20')](function(_0x5626dd){if(_0x5626dd){return _0x5626dd[_0x2063('0x70')](_0x1eb861[_0x2063('0x44')]['ids']);}})[_0x2063('0x20')](respondWithStatusCode(_0x4c0cda,null))[_0x2063('0x2a')](handleError(_0x4c0cda,null));};exports[_0x2063('0x71')]=function(_0x4a095a,_0x5592bc,_0x5da313){return db[_0x2063('0x3d')][_0x2063('0x58')]({'where':{'id':_0x4a095a[_0x2063('0x63')]['id']}})[_0x2063('0x20')](handleEntityNotFound(_0x5592bc,null))[_0x2063('0x20')](function(_0x4753cf){if(_0x4753cf){return _0x4753cf[_0x2063('0x71')](_0x4a095a[_0x2063('0x5a')]['ids'],_[_0x2063('0x72')](_0x4a095a[_0x2063('0x5a')],[_0x2063('0x6b'),'id'])||{})[_0x2063('0x73')](function(_0x35eeac){for(var _0x3577ec=0x0;_0x3577ec<_0x4a095a[_0x2063('0x5a')][_0x2063('0x6b')]['length'];_0x3577ec+=0x1){socket[_0x2063('0x74')](_0x2063('0x75'),{'UserId':_0x4a095a['body']['ids'][_0x3577ec],'WhatsappAccountId':_0x4a095a[_0x2063('0x63')]['id']});}return _0x35eeac;});}})['then'](respondWithResult(_0x5592bc,null))['catch'](handleError(_0x5592bc,null));};exports['removeAgents']=function(_0x397780,_0xc94d45,_0x5bf481){return db[_0x2063('0x3d')]['find']({'where':{'id':_0x397780[_0x2063('0x63')]['id']}})[_0x2063('0x20')](handleEntityNotFound(_0xc94d45,null))[_0x2063('0x20')](function(_0x4558f0){if(_0x4558f0){return _0x4558f0[_0x2063('0x76')](_0x397780['query'][_0x2063('0x6b')])[_0x2063('0x20')](function(){if(_[_0x2063('0x77')](_0x397780[_0x2063('0x44')]['ids'])){for(var _0x19e09c=0x0;_0x19e09c<_0x397780[_0x2063('0x44')][_0x2063('0x6b')][_0x2063('0x4a')];_0x19e09c+=0x1){socket['emit'](_0x2063('0x78'),{'UserId':Number(_0x397780[_0x2063('0x44')][_0x2063('0x6b')][_0x19e09c]),'WhatsappAccountId':Number(_0x397780['params']['id'])});}}else{socket[_0x2063('0x74')](_0x2063('0x78'),{'UserId':Number(_0x397780[_0x2063('0x44')][_0x2063('0x6b')]),'WhatsappAccountId':Number(_0x397780['params']['id'])});}});}})[_0x2063('0x20')](respondWithStatusCode(_0xc94d45,null))['catch'](handleError(_0xc94d45,null));};exports[_0x2063('0x79')]=function(_0x13e6ce,_0x1cfe77,_0x223eff){var _0x1d6a2a={};var _0x14b55e={};var _0x3b6ca0;var _0xbdc3a7;return db[_0x2063('0x3d')][_0x2063('0x67')]({'where':{'id':_0x13e6ce[_0x2063('0x63')]['id']}})[_0x2063('0x20')](handleEntityNotFound(_0x1cfe77,null))[_0x2063('0x20')](function(_0x51a840){if(_0x51a840){_0x3b6ca0=_0x51a840;_0x14b55e['model']=_['keys'](db[_0x2063('0x7a')][_0x2063('0x3e')]);_0x14b55e[_0x2063('0x44')]=_[_0x2063('0x45')](_0x13e6ce['query']);_0x14b55e['filters']=_['intersection'](_0x14b55e[_0x2063('0x42')],_0x14b55e[_0x2063('0x44')]);_0x1d6a2a[_0x2063('0x48')]=_[_0x2063('0x47')](_0x14b55e[_0x2063('0x42')],qs[_0x2063('0x49')](_0x13e6ce[_0x2063('0x44')][_0x2063('0x49')]));_0x1d6a2a[_0x2063('0x48')]=_0x1d6a2a[_0x2063('0x48')]['length']?_0x1d6a2a[_0x2063('0x48')]:_0x14b55e[_0x2063('0x42')];_0x1d6a2a[_0x2063('0x68')]=qs[_0x2063('0x4d')](_0x13e6ce[_0x2063('0x44')][_0x2063('0x4d')]);_0x1d6a2a['where']=qs[_0x2063('0x46')](_[_0x2063('0x4f')](_0x13e6ce[_0x2063('0x44')],_0x14b55e['filters']));if(_0x13e6ce['query'][_0x2063('0x50')]){_0x1d6a2a[_0x2063('0x4e')]=_[_0x2063('0x51')](_0x1d6a2a['where'],{'$or':_[_0x2063('0x43')](_0x1d6a2a[_0x2063('0x48')],function(_0xb9ae39){var _0xcf502a={};_0xcf502a[_0xb9ae39]={'$like':'%'+_0x13e6ce[_0x2063('0x44')][_0x2063('0x50')]+'%'};return _0xcf502a;})});}_0x1d6a2a=_[_0x2063('0x51')]({},_0x1d6a2a,_0x13e6ce[_0x2063('0x69')]);return _0x3b6ca0[_0x2063('0x79')](_0x1d6a2a);}})[_0x2063('0x20')](function(_0x26d953){if(_0x26d953){_0xbdc3a7=_0x26d953[_0x2063('0x4a')];if(!_0x13e6ce[_0x2063('0x44')][_0x2063('0x4b')](_0x2063('0x4c'))){_0x1d6a2a['limit']=qs[_0x2063('0x30')](_0x13e6ce[_0x2063('0x44')][_0x2063('0x30')]);_0x1d6a2a[_0x2063('0x2f')]=qs[_0x2063('0x2f')](_0x13e6ce[_0x2063('0x44')][_0x2063('0x2f')]);}return _0x3b6ca0['getAgents'](_0x1d6a2a);}})[_0x2063('0x20')](function(_0x53354c){if(_0x53354c){return _0x53354c?{'count':_0xbdc3a7,'rows':_0x53354c}:null;}})['then'](respondWithResult(_0x1cfe77,null))[_0x2063('0x2a')](handleError(_0x1cfe77,null));};exports[_0x2063('0x7b')]=function(_0xadaebd,_0x52860f,_0x340e22){return db[_0x2063('0x3d')][_0x2063('0x67')]({'where':{'id':_0xadaebd['params']['id']}})['then'](handleEntityNotFound(_0x52860f,null))[_0x2063('0x20')](function(_0xf22e5f){if(_0xf22e5f){return db[_0x2063('0x7c')][_0x2063('0x7d')](function(_0xaa5079){return db[_0x2063('0x7e')][_0x2063('0x35')]({'where':{'WhatsappAccountId':_0xadaebd[_0x2063('0x63')]['id']},'transaction':_0xaa5079})['then'](function(_0x5b0873){var _0x59056a=_[_0x2063('0x43')](_0xadaebd[_0x2063('0x5a')],function(_0x22083b){_0x22083b[_0x2063('0x6d')]=_0xadaebd[_0x2063('0x63')]['id'];return _0x22083b;});return db[_0x2063('0x7e')][_0x2063('0x7f')](_0x59056a,{'transaction':_0xaa5079});});})['then'](function(){return db['WhatsappApplication'][_0x2063('0x80')]({'where':{'WhatsappAccountId':_0xadaebd[_0x2063('0x63')]['id']},'order':_0x2063('0x81')});});}})['then'](respondWithResult(_0x52860f,null))[_0x2063('0x2a')](handleError(_0x52860f,null));};exports[_0x2063('0x82')]=function(_0x239137,_0x2d684c,_0x566e51){var _0x51baa3={};var _0x4ed130={};var _0x244286;var _0xcaf0b2;return db['WhatsappAccount'][_0x2063('0x67')]({'where':{'id':_0x239137['params']['id']}})[_0x2063('0x20')](handleEntityNotFound(_0x2d684c,null))['then'](function(_0x194704){if(_0x194704){_0x244286=_0x194704;_0x4ed130[_0x2063('0x42')]=_['keys'](db[_0x2063('0x7e')]['rawAttributes']);_0x4ed130[_0x2063('0x44')]=_[_0x2063('0x45')](_0x239137[_0x2063('0x44')]);_0x4ed130[_0x2063('0x46')]=_[_0x2063('0x47')](_0x4ed130[_0x2063('0x42')],_0x4ed130[_0x2063('0x44')]);_0x51baa3[_0x2063('0x48')]=_[_0x2063('0x47')](_0x4ed130[_0x2063('0x42')],qs[_0x2063('0x49')](_0x239137['query'][_0x2063('0x49')]));_0x51baa3[_0x2063('0x48')]=_0x51baa3[_0x2063('0x48')][_0x2063('0x4a')]?_0x51baa3[_0x2063('0x48')]:_0x4ed130['model'];_0x51baa3[_0x2063('0x68')]=qs[_0x2063('0x4d')](_0x239137['query'][_0x2063('0x4d')]);_0x51baa3[_0x2063('0x4e')]=qs[_0x2063('0x46')](_['pick'](_0x239137[_0x2063('0x44')],_0x4ed130['filters']));if(_0x239137[_0x2063('0x44')][_0x2063('0x50')]){_0x51baa3[_0x2063('0x4e')]=_[_0x2063('0x51')](_0x51baa3[_0x2063('0x4e')],{'$or':_[_0x2063('0x43')](_0x51baa3['attributes'],function(_0x37fb14){var _0x3fce03={};_0x3fce03[_0x37fb14]={'$like':'%'+_0x239137[_0x2063('0x44')][_0x2063('0x50')]+'%'};return _0x3fce03;})});}_0x51baa3=_[_0x2063('0x51')]({},_0x51baa3,_0x239137[_0x2063('0x69')]);return _0x244286['getApplications'](_0x51baa3);}})[_0x2063('0x20')](function(_0x3df8ac){if(_0x3df8ac){_0xcaf0b2=_0x3df8ac[_0x2063('0x4a')];if(!_0x239137[_0x2063('0x44')][_0x2063('0x4b')](_0x2063('0x4c'))){_0x51baa3['limit']=qs[_0x2063('0x30')](_0x239137['query']['limit']);_0x51baa3[_0x2063('0x2f')]=qs['offset'](_0x239137['query']['offset']);}return _0x244286[_0x2063('0x82')](_0x51baa3);}})[_0x2063('0x20')](function(_0x11de2b){if(_0x11de2b){return _0x11de2b?{'count':_0xcaf0b2,'rows':_0x11de2b}:null;}})['then'](respondWithResult(_0x2d684c,null))['catch'](handleError(_0x2d684c,null));};exports[_0x2063('0x83')]=function(_0x418a39,_0x481891,_0x57e75c){var _0x5cf54c={'channel':'whatsapp'};var _0x1fc2b4=[];var _0x550b86=[];var _0x57384e={};return db[_0x2063('0x3d')][_0x2063('0x58')]({'where':{'id':_0x418a39['params']['id']},'include':[{'model':db[_0x2063('0x7e')],'as':_0x2063('0x84')}]})['then'](handleEntityNotFound(_0x481891,null))[_0x2063('0x20')](function(_0x46e09e){_0x5cf54c[_0x2063('0x85')]=_0x46e09e;_0x5cf54c[_0x2063('0x86')]=_[_0x2063('0x87')](_0x46e09e['Applications'],['priority'],[_0x2063('0x88')]);if(_0x5cf54c[_0x2063('0x85')]['Applications']){delete _0x5cf54c[_0x2063('0x85')][_0x2063('0x84')];}return db[_0x2063('0x89')]['describe']();})[_0x2063('0x20')](function(_0x899253){if(!_0x899253){throw new db['Sequelize'][(_0x2063('0x8a'))](_0x2063('0x8b'));}_0x1fc2b4=_['difference'](_['keys'](_0x899253),[_0x2063('0x8c'),'updatedAt']);_0x550b86=_[_0x2063('0x8d')](_['keys'](_0x899253),[_0x2063('0x8c'),_0x2063('0x8e'),_0x2063('0x8f'),'ListId']);_0x5cf54c[_0x2063('0x5a')]={'mapKey':'mobile'};if(_0x5cf54c[_0x2063('0x85')][_0x2063('0x40')]&&_0x5cf54c['account'][_0x2063('0x40')]===_0x2063('0x90')){_0x5cf54c[_0x2063('0x5a')][_0x2063('0x91')]=_0x418a39[_0x2063('0x5a')]['From'][_0x2063('0x92')](_0x2063('0x93'),'');_0x5cf54c['body'][_0x2063('0x5a')]=_0x418a39[_0x2063('0x5a')][_0x2063('0x94')];_0x5cf54c[_0x2063('0x5a')][_0x2063('0x95')]=_0x418a39[_0x2063('0x5a')][_0x2063('0x96')];}if(_0x5cf54c[_0x2063('0x5a')]['id']){delete _0x5cf54c[_0x2063('0x5a')]['id'];}if(_[_0x2063('0x97')](_0x5cf54c[_0x2063('0x5a')][_0x2063('0x91')])){throw new db[(_0x2063('0x98'))]['ValidationError'](_0x2063('0x99'));}if(_[_0x2063('0x97')](_0x5cf54c[_0x2063('0x5a')][_0x2063('0x5a')])||_0x5cf54c[_0x2063('0x5a')][_0x2063('0x5a')]===''){throw new db[(_0x2063('0x98'))][(_0x2063('0x8a'))](_0x2063('0x9a'));}if(_[_0x2063('0x97')](_0x5cf54c[_0x2063('0x5a')][_0x2063('0x9b')])){throw new db[(_0x2063('0x98'))]['ValidationError'](_0x2063('0x9c')+_0x550b86);}if(!_[_0x2063('0x9d')](_0x550b86,_0x5cf54c['body'][_0x2063('0x9b')])){throw new db[(_0x2063('0x98'))]['ValidationError'](_0x2063('0x9e')+_0x550b86);}_0x57384e[_0x5cf54c[_0x2063('0x5a')][_0x2063('0x9b')]]=_0x5cf54c[_0x2063('0x5a')][_0x2063('0x91')];return db[_0x2063('0x9f')]['find']({'where':{'id':_0x5cf54c[_0x2063('0x85')][_0x2063('0xa0')]},'include':[{'model':db['CmContact'],'as':_0x2063('0xa1'),'where':_0x57384e,'limit':0x1,'order':[[_0x2063('0x8e'),'DESC']]}]});})[_0x2063('0x20')](handleEntityNotFound(_0x481891,null))[_0x2063('0x20')](function(_0x1051e5){if(_0x1051e5){_0x5cf54c[_0x2063('0xa2')]=_[_0x2063('0x72')](_0x1051e5,['Contacts']);if(_0x1051e5[_0x2063('0xa1')][_0x2063('0x4a')]){return _0x1051e5['Contacts'][0x0];}var _0xc10a5e=_[_0x2063('0x18')](_0x5cf54c[_0x2063('0x5a')],{'firstName':_0x5cf54c[_0x2063('0x5a')]['from'],'ListId':_0x1051e5['id']});_0xc10a5e[_0x5cf54c['body'][_0x2063('0x9b')]]=_0x5cf54c[_0x2063('0x5a')][_0x2063('0x91')];return db['CmContact'][_0x2063('0x59')](_0xc10a5e,{'fields':_0x1fc2b4,'raw':!![]});}})[_0x2063('0x20')](handleEntityNotFound(_0x481891,null))[_0x2063('0x20')](function(_0x597904){if(_0x597904){_0x5cf54c[_0x2063('0xa3')]=_0x597904;var _0x31bf90={'ContactId':_0x597904['id'],'phone':_0x5cf54c['body']['from'],'WhatsappAccountId':_0x418a39[_0x2063('0x63')]['id']};var _0xae61fb={'ContactId':_0x597904['id'],'WhatsappAccountId':_0x418a39[_0x2063('0x63')]['id'],'closed':![]};return db[_0x2063('0xa4')][_0x2063('0x58')]({'where':_0xae61fb})['then'](function(_0x2e84cc){if(_0x2e84cc){return[_0x2e84cc,![]];}return db[_0x2063('0xa4')][_0x2063('0x59')](_0x31bf90)[_0x2063('0x20')](function(_0x16ec18){return[_0x16ec18,!![]];});});}})[_0x2063('0x73')](function(_0x307f29,_0x1627bf){_0x5cf54c['interaction']=_0x307f29['get']({'plain':!![]});_0x5cf54c[_0x2063('0xa5')][_0x2063('0xa6')]=![];if(_0x1627bf){if(_0x5cf54c[_0x2063('0x85')][_0x2063('0xa7')]){_0x5cf54c['applications'][_0x2063('0xa8')]({'id':0x0,'priority':_0x5cf54c[_0x2063('0x86')][_0x2063('0x4a')]+0x1,'app':_0x2063('0xa9'),'appdata':_0x2063('0xaa'),'interval':_0x2063('0xab')});}_0x5cf54c[_0x2063('0xa5')][_0x2063('0xa6')]=!![];}return db[_0x2063('0xac')]['create']({'phone':_0x5cf54c[_0x2063('0x5a')][_0x2063('0x91')],'messageId':_0x5cf54c[_0x2063('0x5a')][_0x2063('0x95')],'body':_0x5cf54c[_0x2063('0x5a')][_0x2063('0x5a')],'WhatsappAccountId':_0x418a39[_0x2063('0x63')]['id'],'WhatsappInteractionId':_0x307f29['id'],'direction':'in','ContactId':_0x307f29[_0x2063('0xad')],'AttachmentId':_0x5cf54c['body'][_0x2063('0xae')]});})['then'](function(_0x50ad71){_0x5cf54c[_0x2063('0x28')]=_0x50ad71;if(_0x5cf54c[_0x2063('0xa5')][_0x2063('0xaf')]){return db['User'][_0x2063('0x58')]({'attributes':['id',_0x2063('0x38')],'where':{'id':_0x5cf54c[_0x2063('0xa5')][_0x2063('0xaf')]}})[_0x2063('0x20')](function(_0x5d79a2){if(_0x5d79a2){_0x5cf54c[_0x2063('0x86')][_0x2063('0xb0')]({'id':0x0,'priority':0x0,'app':_0x2063('0xb1'),'appdata':_0x5d79a2[_0x2063('0x38')]+','+(_0x5cf54c[_0x2063('0x85')][_0x2063('0xb2')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2063('0xb3'),_0x2063('0xb4'),_0x5cf54c);});}return respondWithRpcPromise('Start',_0x2063('0xb4'),_0x5cf54c);})[_0x2063('0x20')](function(_0x1ca87e){if(_0x1ca87e){var _0x48f5e4=0xc8;var _0xe1415d=_0x2063('0xb5');logger[_0x2063('0xb6')](_0x2063('0x24'),_0xe1415d,_0x48f5e4,_0x2063('0xb7'));logger['debug'](_0x2063('0xb8'),_0xe1415d,_0x48f5e4,_0x2063('0xb7'),JSON[_0x2063('0x25')](_0x1ca87e));if(_0x5cf54c[_0x2063('0x85')][_0x2063('0x40')]==='twilio'){return _0x481891[_0x2063('0x2c')](_0x48f5e4)[_0x2063('0xb9')](_0x2063('0xba'),_0x2063('0xbb'))[_0x2063('0x39')](_0x2063('0xbc'));}else{return _0x481891[_0x2063('0x2c')](_0x48f5e4)[_0x2063('0x32')](_0x1ca87e);}}})[_0x2063('0x2a')](handleError(_0x481891,null));};exports[_0x2063('0x39')]=function(_0x44b42d,_0x48b0c2,_0x4a8f50){var _0x501954,_0x323b8c,_0x3481ed;if(_[_0x2063('0x97')](_0x44b42d['body'][_0x2063('0x5a')])||_0x44b42d[_0x2063('0x5a')]['body']===''){throw new db[(_0x2063('0x98'))][(_0x2063('0x8a'))](_0x2063('0x9a'));}if(_['isNil'](_0x44b42d[_0x2063('0x5a')]['to'])){throw new db[(_0x2063('0x98'))]['ValidationError'](_0x2063('0xbd'));}_0x501954=_0x44b42d[_0x2063('0x5a')]['to'];return db[_0x2063('0x3d')][_0x2063('0x58')]({'where':{'id':_0x44b42d[_0x2063('0x63')]['id']},'include':[{'model':db[_0x2063('0x9f')],'as':_0x2063('0xbe'),'include':[{'model':db['CmContact'],'as':_0x2063('0xa1'),'where':{'mobile':_0x501954},'limit':0x1,'order':[[_0x2063('0x8e'),_0x2063('0xbf')]]}]}]})[_0x2063('0x20')](handleEntityNotFound(_0x48b0c2,null))[_0x2063('0x20')](function(_0x3508f3){if(_0x3508f3&&_0x3508f3[_0x2063('0xbe')]){_0x323b8c=_0x3508f3[_0x2063('0x5c')]({'plain':!![]});if(_0x323b8c['List']&&_0x323b8c[_0x2063('0xbe')][_0x2063('0xa1')]['length']){return _0x323b8c['List']['Contacts'][0x0];}return db['CmContact'][_0x2063('0x59')](_[_0x2063('0x18')](_0x44b42d[_0x2063('0x5a')],{'firstName':_0x501954,'mobile':_0x501954,'phone':_0x501954,'ListId':_0x323b8c[_0x2063('0xa0')]}));}})[_0x2063('0x20')](handleEntityNotFound(_0x48b0c2,null))[_0x2063('0x20')](function(_0x49ee08){if(_0x49ee08){_0x3481ed=_0x49ee08;return db['WhatsappInteraction'][_0x2063('0x58')]({'where':{'ContactId':_0x3481ed['id'],'closed':![],'WhatsappAccountId':_0x323b8c['id']}})[_0x2063('0x20')](function(_0x5c9758){if(_0x5c9758){return[_0x5c9758,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x44b42d['user']['id'],'ContactId':_0x3481ed['id'],'WhatsappAccountId':_0x323b8c['id'],'phone':_0x501954,'firstMsgDirection':_0x2063('0xc0'),'Messages':[_[_0x2063('0x51')](_0x44b42d[_0x2063('0x5a')],{'read':![],'body':_0x44b42d[_0x2063('0x5a')]['body'],'phone':_0x501954,'WhatsappAccountId':_0x323b8c['id'],'UserId':_0x44b42d[_0x2063('0x5b')]['id'],'ContactId':_0x3481ed['id']})]},{'include':[{'model':db[_0x2063('0xac')],'as':_0x2063('0xc1')}]})['then'](function(_0x531aae){return[_0x531aae,!![]];});});}})[_0x2063('0x73')](function(_0x4bad9b,_0x1df7ae){if(_0x1df7ae){return _0x4bad9b;}return db[_0x2063('0xac')]['create'](_['merge'](_0x44b42d[_0x2063('0x5a')],{'read':![],'body':_0x44b42d[_0x2063('0x5a')]['body'],'phone':_0x501954,'WhatsappAccountId':_0x323b8c['id'],'WhatsappInteractionId':_0x4bad9b['id'],'UserId':_0x44b42d[_0x2063('0x5b')]['id'],'ContactId':_0x3481ed['id']}))[_0x2063('0x20')](function(_0x1cf699){_0x4bad9b[_0x2063('0xc2')][_0x2063('0xc1')]=[];_0x4bad9b['dataValues'][_0x2063('0xc1')][_0x2063('0xa8')](_0x1cf699[_0x2063('0xc2')]);return _0x4bad9b;});})['then'](respondWithResult(_0x48b0c2,null))['catch'](handleError(_0x48b0c2,null));}; \ No newline at end of file +var _0xbf61=['text/xml','to\x20is\x20mandatory','List','out','Messages','dataValues','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','params','addDisposition','Disposition','getDispositions','findOne','nolimit','WhatsappAccountId','removeDispositions','addAnswer','CannedAnswer','addAgents','spread','ids','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','WhatsappInteraction','interaction','created','applications','close','*,*,*,*','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','info','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type'];(function(_0x556926,_0x5eceb5){var _0x132dff=function(_0x4667c6){while(--_0x4667c6){_0x556926['push'](_0x556926['shift']());}};_0x132dff(++_0x5eceb5);}(_0xbf61,0x177));var _0x1bf6=function(_0xe2cb90,_0x1f81f5){_0xe2cb90=_0xe2cb90-0x0;var _0x4db6a2=_0xbf61[_0xe2cb90];return _0x4db6a2;};'use strict';var pdf=require(_0x1bf6('0x0'));var emlformat=require(_0x1bf6('0x1'));var rimraf=require(_0x1bf6('0x2'));var zipdir=require(_0x1bf6('0x3'));var jsonpatch=require(_0x1bf6('0x4'));var rp=require(_0x1bf6('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1bf6('0x6'));var path=require(_0x1bf6('0x7'));var sox=require(_0x1bf6('0x8'));var csv=require(_0x1bf6('0x9'));var ejs=require(_0x1bf6('0xa'));var fs=require('fs');var _=require(_0x1bf6('0xb'));var squel=require(_0x1bf6('0xc'));var crypto=require(_0x1bf6('0xd'));var jsforce=require(_0x1bf6('0xe'));var deskjs=require(_0x1bf6('0xf'));var toCsv=require(_0x1bf6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1bf6('0x10'));var authService=require(_0x1bf6('0x11'));var qs=require(_0x1bf6('0x12'));var as=require(_0x1bf6('0x13'));var hardwareService=require(_0x1bf6('0x14'));var logger=require(_0x1bf6('0x15'))(_0x1bf6('0x16'));var utils=require(_0x1bf6('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1bf6('0x18'))['db'];config[_0x1bf6('0x19')]=_[_0x1bf6('0x1a')](config[_0x1bf6('0x19')],{'host':_0x1bf6('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappAccount.socket')[_0x1bf6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1bf6('0x1d')][_0x1bf6('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x5435e5,_0x46916e,_0x10dedd,_0x425a88){return new BPromise(function(_0x138527,_0x14787d){var _0x36648a=_0x425a88||client;return _0x36648a[_0x1bf6('0x1f')](_0x5435e5,_0x10dedd)[_0x1bf6('0x20')](function(_0x270a73){logger['info'](_0x1bf6('0x21'),_0x46916e,_0x1bf6('0x22'));logger[_0x1bf6('0x23')](_0x1bf6('0x24'),_0x46916e,_0x1bf6('0x22'),JSON[_0x1bf6('0x25')](_0x270a73));if(_0x270a73[_0x1bf6('0x26')]){if(_0x270a73[_0x1bf6('0x26')]['code']===0x1f4){logger[_0x1bf6('0x26')](_0x1bf6('0x21'),_0x46916e,_0x270a73['error'][_0x1bf6('0x27')]);return _0x14787d(_0x270a73[_0x1bf6('0x26')][_0x1bf6('0x27')]);}logger['error'](_0x1bf6('0x21'),_0x46916e,_0x270a73[_0x1bf6('0x26')][_0x1bf6('0x27')]);return _0x138527(_0x270a73[_0x1bf6('0x26')][_0x1bf6('0x27')]);}else{logger['info'](_0x1bf6('0x21'),_0x46916e,'request\x20sent');_0x138527(_0x270a73['result'][_0x1bf6('0x27')]);}})[_0x1bf6('0x28')](function(_0x248103){logger['error'](_0x1bf6('0x21'),_0x46916e,_0x248103);_0x14787d(_0x248103);});});}function respondWithStatusCode(_0x14d54d,_0x19dc9a){_0x19dc9a=_0x19dc9a||0xcc;return function(_0x284506){if(_0x284506){return _0x14d54d[_0x1bf6('0x29')](_0x19dc9a);}return _0x14d54d[_0x1bf6('0x2a')](_0x19dc9a)[_0x1bf6('0x2b')]();};}function respondWithResult(_0x469ec4,_0x32ac48){_0x32ac48=_0x32ac48||0xc8;return function(_0x497b41){if(_0x497b41){return _0x469ec4[_0x1bf6('0x2a')](_0x32ac48)[_0x1bf6('0x2c')](_0x497b41);}};}function respondWithFilteredResult(_0x4302cb,_0x58edf2){return function(_0xa55e43){if(_0xa55e43){var _0x3994d3=_0xa55e43[_0x1bf6('0x2d')],_0x3608e4=_0x58edf2['offset'],_0x4f8ff3=_0x58edf2[_0x1bf6('0x2e')]+_0x58edf2[_0x1bf6('0x2f')],_0x1b12aa;if(_0x4f8ff3>=_0x3994d3){_0x4f8ff3=_0x3994d3;_0x1b12aa=0xc8;}else{_0x1b12aa=0xce;}_0x4302cb[_0x1bf6('0x2a')](_0x1b12aa);return _0x4302cb[_0x1bf6('0x30')](_0x1bf6('0x31'),_0x3608e4+'-'+_0x4f8ff3+'/'+_0x3994d3)[_0x1bf6('0x2c')](_0xa55e43);}return null;};}function patchUpdates(_0x4aae56){return function(_0x5bc0f4){try{jsonpatch[_0x1bf6('0x32')](_0x5bc0f4,_0x4aae56,!![]);}catch(_0x382084){return BPromise[_0x1bf6('0x33')](_0x382084);}return _0x5bc0f4[_0x1bf6('0x34')]();};}function saveUpdates(_0x235497,_0x2fec30){return function(_0x56cd91){if(_0x56cd91){return _0x56cd91[_0x1bf6('0x35')](_0x235497)['then'](function(_0x360458){return _0x360458;});}return null;};}function removeEntity(_0x2cbe91,_0x3281cb){return function(_0x13fb36){if(_0x13fb36){return _0x13fb36[_0x1bf6('0x36')]()[_0x1bf6('0x20')](function(){var _0x4e2075=_0x13fb36[_0x1bf6('0x37')]({'plain':!![]});var _0x4b7b8b=_0x1bf6('0x38');return db[_0x1bf6('0x39')][_0x1bf6('0x36')]({'where':{'type':_0x4b7b8b,'resourceId':_0x4e2075['id']}})['then'](function(){return _0x13fb36;});})['then'](function(){_0x2cbe91[_0x1bf6('0x2a')](0xcc)[_0x1bf6('0x2b')]();});}};}function handleEntityNotFound(_0x33d338,_0xbe2d13){return function(_0x3fcf5d){if(!_0x3fcf5d){_0x33d338[_0x1bf6('0x29')](0x194);}return _0x3fcf5d;};}function handleError(_0x48665d,_0xb9325f){_0xb9325f=_0xb9325f||0x1f4;return function(_0x42a866){logger[_0x1bf6('0x26')](_0x42a866[_0x1bf6('0x3a')]);if(_0x42a866[_0x1bf6('0x3b')]){delete _0x42a866[_0x1bf6('0x3b')];}_0x48665d[_0x1bf6('0x2a')](_0xb9325f)[_0x1bf6('0x3c')](_0x42a866);};}exports['index']=function(_0x51982e,_0x1ebd16){var _0x518bc0={'include':[{'model':db['Pause'],'as':_0x1bf6('0x3d')}]},_0xa00f7e={},_0x1c2477={'count':0x0,'rows':[]};var _0x139fdd=_['map'](db[_0x1bf6('0x3e')][_0x1bf6('0x3f')],function(_0x30e489){return{'name':_0x30e489[_0x1bf6('0x40')],'type':_0x30e489[_0x1bf6('0x41')][_0x1bf6('0x42')]};});_0xa00f7e[_0x1bf6('0x43')]=_[_0x1bf6('0x44')](_0x139fdd,_0x1bf6('0x3b'));_0xa00f7e[_0x1bf6('0x45')]=_[_0x1bf6('0x46')](_0x51982e[_0x1bf6('0x45')]);_0xa00f7e[_0x1bf6('0x47')]=_[_0x1bf6('0x48')](_0xa00f7e['model'],_0xa00f7e[_0x1bf6('0x45')]);_0x518bc0['attributes']=_[_0x1bf6('0x48')](_0xa00f7e['model'],qs['fields'](_0x51982e['query'][_0x1bf6('0x49')]));_0x518bc0['attributes']=_0x518bc0[_0x1bf6('0x4a')][_0x1bf6('0x4b')]?_0x518bc0[_0x1bf6('0x4a')]:_0xa00f7e[_0x1bf6('0x43')];if(!_0x51982e['query'][_0x1bf6('0x4c')]('nolimit')){_0x518bc0[_0x1bf6('0x2f')]=qs[_0x1bf6('0x2f')](_0x51982e['query'][_0x1bf6('0x2f')]);_0x518bc0['offset']=qs[_0x1bf6('0x2e')](_0x51982e['query']['offset']);}_0x518bc0[_0x1bf6('0x4d')]=qs[_0x1bf6('0x4e')](_0x51982e[_0x1bf6('0x45')][_0x1bf6('0x4e')]);_0x518bc0[_0x1bf6('0x4f')]=qs[_0x1bf6('0x47')](_[_0x1bf6('0x50')](_0x51982e['query'],_0xa00f7e[_0x1bf6('0x47')]),_0x139fdd);if(_0x51982e[_0x1bf6('0x45')][_0x1bf6('0x51')]){_0x518bc0[_0x1bf6('0x4f')]=_[_0x1bf6('0x52')](_0x518bc0[_0x1bf6('0x4f')],{'$or':_[_0x1bf6('0x44')](_0x139fdd,function(_0x74412f){if(_0x74412f['type']!==_0x1bf6('0x53')){var _0xcf528={};_0xcf528[_0x74412f[_0x1bf6('0x3b')]]={'$like':'%'+_0x51982e['query'][_0x1bf6('0x51')]+'%'};return _0xcf528;}})});}_0x518bc0=_[_0x1bf6('0x52')]({},_0x518bc0,_0x51982e[_0x1bf6('0x54')]);var _0x51d019={'where':_0x518bc0[_0x1bf6('0x4f')]};return db[_0x1bf6('0x3e')]['count'](_0x51d019)['then'](function(_0x52bc71){_0x1c2477[_0x1bf6('0x2d')]=_0x52bc71;if(_0x51982e['query'][_0x1bf6('0x55')]){_0x518bc0[_0x1bf6('0x56')]=[{'all':!![]}];}return db[_0x1bf6('0x3e')][_0x1bf6('0x57')](_0x518bc0);})[_0x1bf6('0x20')](function(_0x4d4f12){_0x1c2477[_0x1bf6('0x58')]=_0x4d4f12;return _0x1c2477;})[_0x1bf6('0x20')](respondWithFilteredResult(_0x1ebd16,_0x518bc0))[_0x1bf6('0x28')](handleError(_0x1ebd16,null));};exports[_0x1bf6('0x59')]=function(_0x31323c,_0x10b39f){var _0x127950={'raw':![],'where':{'id':_0x31323c['params']['id']},'include':[{'model':db['Pause'],'as':_0x1bf6('0x3d')}]},_0x35e20c={};_0x35e20c[_0x1bf6('0x43')]=_[_0x1bf6('0x46')](db[_0x1bf6('0x3e')]['rawAttributes']);_0x35e20c[_0x1bf6('0x45')]=_[_0x1bf6('0x46')](_0x31323c[_0x1bf6('0x45')]);_0x35e20c[_0x1bf6('0x47')]=_['intersection'](_0x35e20c[_0x1bf6('0x43')],_0x35e20c[_0x1bf6('0x45')]);_0x127950[_0x1bf6('0x4a')]=_['intersection'](_0x35e20c[_0x1bf6('0x43')],qs[_0x1bf6('0x49')](_0x31323c[_0x1bf6('0x45')][_0x1bf6('0x49')]));_0x127950[_0x1bf6('0x4a')]=_0x127950[_0x1bf6('0x4a')][_0x1bf6('0x4b')]?_0x127950['attributes']:_0x35e20c[_0x1bf6('0x43')];if(_0x31323c[_0x1bf6('0x45')][_0x1bf6('0x55')]){_0x127950[_0x1bf6('0x56')]=[{'all':!![]}];}_0x127950=_[_0x1bf6('0x52')]({},_0x127950,_0x31323c[_0x1bf6('0x54')]);return db[_0x1bf6('0x3e')][_0x1bf6('0x5a')](_0x127950)[_0x1bf6('0x20')](handleEntityNotFound(_0x10b39f,null))[_0x1bf6('0x20')](respondWithResult(_0x10b39f,null))['catch'](handleError(_0x10b39f,null));};exports['create']=function(_0x13832f,_0x293b72){return db['WhatsappAccount'][_0x1bf6('0x5b')](_0x13832f[_0x1bf6('0x5c')],{})[_0x1bf6('0x20')](function(_0x594fd6){var _0x1f5de0=_0x13832f[_0x1bf6('0x5d')][_0x1bf6('0x37')]({'plain':!![]});if(!_0x1f5de0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f5de0['role']===_0x1bf6('0x5d')){var _0x3da187=_0x594fd6[_0x1bf6('0x37')]({'plain':!![]});var _0x281ca9=_0x1bf6('0x38');return db[_0x1bf6('0x5e')][_0x1bf6('0x5a')]({'where':{'name':_0x281ca9,'userProfileId':_0x1f5de0[_0x1bf6('0x5f')]},'raw':!![]})[_0x1bf6('0x20')](function(_0x4ec88f){if(_0x4ec88f&&_0x4ec88f[_0x1bf6('0x60')]===0x0){return db['UserProfileResource'][_0x1bf6('0x5b')]({'name':_0x3da187['name'],'resourceId':_0x3da187['id'],'type':_0x4ec88f['name'],'sectionId':_0x4ec88f['id']},{})['then'](function(){return _0x594fd6;});}else{return _0x594fd6;}})[_0x1bf6('0x28')](function(_0x4db5da){logger[_0x1bf6('0x26')](_0x1bf6('0x61'),_0x4db5da);throw _0x4db5da;});}return _0x594fd6;})[_0x1bf6('0x20')](respondWithResult(_0x293b72,0xc9))[_0x1bf6('0x28')](handleError(_0x293b72,null));};exports[_0x1bf6('0x35')]=function(_0x89d8a3,_0x26a700){if(_0x89d8a3[_0x1bf6('0x5c')]['id']){delete _0x89d8a3[_0x1bf6('0x5c')]['id'];}return db[_0x1bf6('0x3e')][_0x1bf6('0x5a')]({'where':{'id':_0x89d8a3['params']['id']},'include':[{'model':db[_0x1bf6('0x62')],'as':_0x1bf6('0x3d')}]})[_0x1bf6('0x20')](handleEntityNotFound(_0x26a700,null))['then'](saveUpdates(_0x89d8a3[_0x1bf6('0x5c')],null))[_0x1bf6('0x20')](respondWithResult(_0x26a700,null))[_0x1bf6('0x28')](handleError(_0x26a700,null));};exports[_0x1bf6('0x36')]=function(_0x3162d8,_0x35cde0){return db[_0x1bf6('0x3e')]['find']({'where':{'id':_0x3162d8[_0x1bf6('0x63')]['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x35cde0,null))[_0x1bf6('0x20')](removeEntity(_0x35cde0,null))[_0x1bf6('0x28')](handleError(_0x35cde0,null));};exports['describe']=function(_0x1a7d97,_0x3367fe){return db[_0x1bf6('0x3e')]['describe']()[_0x1bf6('0x20')](respondWithResult(_0x3367fe,null))['catch'](handleError(_0x3367fe,null));};exports[_0x1bf6('0x64')]=function(_0x5aff0d,_0x219c23,_0xb3d3b5){if(_0x5aff0d[_0x1bf6('0x5c')]['id']){delete _0x5aff0d['body']['id'];}return db[_0x1bf6('0x3e')][_0x1bf6('0x5a')]({'where':{'id':_0x5aff0d[_0x1bf6('0x63')]['id']}})['then'](handleEntityNotFound(_0x219c23,null))[_0x1bf6('0x20')](function(_0x1dd665){if(_0x1dd665){_0x5aff0d[_0x1bf6('0x5c')]['WhatsappAccountId']=_0x1dd665['id'];return db[_0x1bf6('0x65')]['create'](_0x5aff0d[_0x1bf6('0x5c')]);}})[_0x1bf6('0x20')](respondWithResult(_0x219c23,null))[_0x1bf6('0x28')](handleError(_0x219c23,null));};exports[_0x1bf6('0x66')]=function(_0x340cc9,_0x10f88d,_0x24d9af){var _0x1274df={'raw':![],'where':{}};var _0x3a8d25={};var _0x4bd90d={'count':0x0,'rows':[]};return db[_0x1bf6('0x3e')][_0x1bf6('0x67')]({'where':{'id':_0x340cc9[_0x1bf6('0x63')]['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x10f88d,null))[_0x1bf6('0x20')](function(_0x22c678){if(_0x22c678){_0x3a8d25['model']=_[_0x1bf6('0x46')](db['Disposition'][_0x1bf6('0x3f')]);_0x3a8d25[_0x1bf6('0x45')]=_['keys'](_0x340cc9['query']);_0x3a8d25[_0x1bf6('0x47')]=_[_0x1bf6('0x48')](_0x3a8d25['model'],_0x3a8d25[_0x1bf6('0x45')]);_0x1274df[_0x1bf6('0x4a')]=_['intersection'](_0x3a8d25[_0x1bf6('0x43')],qs[_0x1bf6('0x49')](_0x340cc9[_0x1bf6('0x45')][_0x1bf6('0x49')]));_0x1274df[_0x1bf6('0x4a')]=_0x1274df[_0x1bf6('0x4a')][_0x1bf6('0x4b')]?_0x1274df[_0x1bf6('0x4a')]:_0x3a8d25[_0x1bf6('0x43')];if(!_0x340cc9[_0x1bf6('0x45')][_0x1bf6('0x4c')](_0x1bf6('0x68'))){_0x1274df[_0x1bf6('0x2f')]=qs[_0x1bf6('0x2f')](_0x340cc9[_0x1bf6('0x45')][_0x1bf6('0x2f')]);_0x1274df[_0x1bf6('0x2e')]=qs[_0x1bf6('0x2e')](_0x340cc9[_0x1bf6('0x45')]['offset']);}_0x1274df['order']=qs[_0x1bf6('0x4e')](_0x340cc9['query'][_0x1bf6('0x4e')]);_0x1274df[_0x1bf6('0x4f')]=qs['filters'](_[_0x1bf6('0x50')](_0x340cc9[_0x1bf6('0x45')],_0x3a8d25[_0x1bf6('0x47')]));_0x1274df['where'][_0x1bf6('0x69')]=_0x22c678['id'];if(_0x340cc9[_0x1bf6('0x45')][_0x1bf6('0x51')]){_0x1274df['where']=_['merge'](_0x1274df[_0x1bf6('0x4f')],{'$or':_['map'](_0x1274df[_0x1bf6('0x4a')],function(_0x255131){var _0x35c81f={};_0x35c81f[_0x255131]={'$like':'%'+_0x340cc9[_0x1bf6('0x45')][_0x1bf6('0x51')]+'%'};return _0x35c81f;})});}_0x1274df=_[_0x1bf6('0x52')]({},_0x1274df,_0x340cc9['options']);return db[_0x1bf6('0x65')]['count']({'where':_0x1274df[_0x1bf6('0x4f')]})[_0x1bf6('0x20')](function(_0x28767f){_0x4bd90d[_0x1bf6('0x2d')]=_0x28767f;if(_0x340cc9[_0x1bf6('0x45')]['includeAll']){_0x1274df[_0x1bf6('0x56')]=[{'all':!![]}];}return db[_0x1bf6('0x65')][_0x1bf6('0x57')](_0x1274df);})[_0x1bf6('0x20')](function(_0x536120){_0x4bd90d[_0x1bf6('0x58')]=_0x536120;return _0x4bd90d;});}})[_0x1bf6('0x20')](respondWithFilteredResult(_0x10f88d,_0x1274df))[_0x1bf6('0x28')](handleError(_0x10f88d,null));};exports[_0x1bf6('0x6a')]=function(_0x45f0d4,_0x24a28a,_0x1ea501){return db[_0x1bf6('0x3e')][_0x1bf6('0x5a')]({'where':{'id':_0x45f0d4[_0x1bf6('0x63')]['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x24a28a,null))[_0x1bf6('0x20')](function(_0x6e6e60){if(_0x6e6e60){return _0x6e6e60[_0x1bf6('0x6a')](_0x45f0d4[_0x1bf6('0x45')]['ids']);}})[_0x1bf6('0x20')](respondWithStatusCode(_0x24a28a,null))[_0x1bf6('0x28')](handleError(_0x24a28a,null));};exports[_0x1bf6('0x6b')]=function(_0x5e69bc,_0x3e81bc,_0x459227){if(_0x5e69bc[_0x1bf6('0x5c')]['id']){delete _0x5e69bc['body']['id'];}return db[_0x1bf6('0x3e')]['find']({'where':{'id':_0x5e69bc['params']['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x3e81bc,null))[_0x1bf6('0x20')](function(_0xc745b3){if(_0xc745b3){_0x5e69bc['body'][_0x1bf6('0x69')]=_0xc745b3['id'];return db[_0x1bf6('0x6c')][_0x1bf6('0x5b')](_0x5e69bc[_0x1bf6('0x5c')]);}})['then'](respondWithResult(_0x3e81bc,null))[_0x1bf6('0x28')](handleError(_0x3e81bc,null));};exports['getAnswers']=function(_0x373a7c,_0x4fb209,_0xac05d0){var _0x36dd4e={'raw':![],'where':{}};var _0x18b5cb={};var _0x474fa9={'count':0x0,'rows':[]};return db[_0x1bf6('0x3e')][_0x1bf6('0x67')]({'where':{'id':_0x373a7c[_0x1bf6('0x63')]['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x4fb209,null))[_0x1bf6('0x20')](function(_0x174edf){if(_0x174edf){_0x18b5cb[_0x1bf6('0x43')]=_[_0x1bf6('0x46')](db[_0x1bf6('0x6c')][_0x1bf6('0x3f')]);_0x18b5cb[_0x1bf6('0x45')]=_['keys'](_0x373a7c[_0x1bf6('0x45')]);_0x18b5cb['filters']=_[_0x1bf6('0x48')](_0x18b5cb['model'],_0x18b5cb[_0x1bf6('0x45')]);_0x36dd4e[_0x1bf6('0x4a')]=_[_0x1bf6('0x48')](_0x18b5cb[_0x1bf6('0x43')],qs[_0x1bf6('0x49')](_0x373a7c[_0x1bf6('0x45')]['fields']));_0x36dd4e[_0x1bf6('0x4a')]=_0x36dd4e[_0x1bf6('0x4a')][_0x1bf6('0x4b')]?_0x36dd4e[_0x1bf6('0x4a')]:_0x18b5cb[_0x1bf6('0x43')];if(!_0x373a7c[_0x1bf6('0x45')]['hasOwnProperty'](_0x1bf6('0x68'))){_0x36dd4e[_0x1bf6('0x2f')]=qs[_0x1bf6('0x2f')](_0x373a7c[_0x1bf6('0x45')][_0x1bf6('0x2f')]);_0x36dd4e[_0x1bf6('0x2e')]=qs[_0x1bf6('0x2e')](_0x373a7c[_0x1bf6('0x45')][_0x1bf6('0x2e')]);}_0x36dd4e[_0x1bf6('0x4d')]=qs[_0x1bf6('0x4e')](_0x373a7c[_0x1bf6('0x45')][_0x1bf6('0x4e')]);_0x36dd4e[_0x1bf6('0x4f')]=qs[_0x1bf6('0x47')](_[_0x1bf6('0x50')](_0x373a7c['query'],_0x18b5cb[_0x1bf6('0x47')]));_0x36dd4e[_0x1bf6('0x4f')][_0x1bf6('0x69')]=_0x174edf['id'];if(_0x373a7c['query'][_0x1bf6('0x51')]){_0x36dd4e['where']=_[_0x1bf6('0x52')](_0x36dd4e[_0x1bf6('0x4f')],{'$or':_[_0x1bf6('0x44')](_0x36dd4e[_0x1bf6('0x4a')],function(_0x4cd476){var _0x5244dd={};_0x5244dd[_0x4cd476]={'$like':'%'+_0x373a7c[_0x1bf6('0x45')][_0x1bf6('0x51')]+'%'};return _0x5244dd;})});}_0x36dd4e=_['merge']({},_0x36dd4e,_0x373a7c[_0x1bf6('0x54')]);return db[_0x1bf6('0x6c')]['count']({'where':_0x36dd4e[_0x1bf6('0x4f')]})[_0x1bf6('0x20')](function(_0x453185){_0x474fa9[_0x1bf6('0x2d')]=_0x453185;if(_0x373a7c[_0x1bf6('0x45')][_0x1bf6('0x55')]){_0x36dd4e['include']=[{'all':!![]}];}return db[_0x1bf6('0x6c')][_0x1bf6('0x57')](_0x36dd4e);})['then'](function(_0x18ab97){_0x474fa9[_0x1bf6('0x58')]=_0x18ab97;return _0x474fa9;});}})[_0x1bf6('0x20')](respondWithFilteredResult(_0x4fb209,_0x36dd4e))['catch'](handleError(_0x4fb209,null));};exports['removeAnswers']=function(_0x384451,_0x12d1be,_0x424ec0){return db[_0x1bf6('0x3e')][_0x1bf6('0x5a')]({'where':{'id':_0x384451[_0x1bf6('0x63')]['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x12d1be,null))[_0x1bf6('0x20')](function(_0x1e2bf8){if(_0x1e2bf8){return _0x1e2bf8['removeAnswers'](_0x384451[_0x1bf6('0x45')]['ids']);}})[_0x1bf6('0x20')](respondWithStatusCode(_0x12d1be,null))[_0x1bf6('0x28')](handleError(_0x12d1be,null));};exports['addAgents']=function(_0x541511,_0x527635,_0x2e4f59){return db[_0x1bf6('0x3e')][_0x1bf6('0x5a')]({'where':{'id':_0x541511[_0x1bf6('0x63')]['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x527635,null))[_0x1bf6('0x20')](function(_0x3983f0){if(_0x3983f0){return _0x3983f0[_0x1bf6('0x6d')](_0x541511[_0x1bf6('0x5c')]['ids'],_['omit'](_0x541511[_0x1bf6('0x5c')],['ids','id'])||{})[_0x1bf6('0x6e')](function(_0x409b6f){for(var _0x2eed29=0x0;_0x2eed29<_0x541511[_0x1bf6('0x5c')][_0x1bf6('0x6f')][_0x1bf6('0x4b')];_0x2eed29+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x541511[_0x1bf6('0x5c')]['ids'][_0x2eed29],'WhatsappAccountId':_0x541511[_0x1bf6('0x63')]['id']});}return _0x409b6f;});}})[_0x1bf6('0x20')](respondWithResult(_0x527635,null))['catch'](handleError(_0x527635,null));};exports[_0x1bf6('0x70')]=function(_0x55bfba,_0x39926d,_0x2249fd){return db[_0x1bf6('0x3e')][_0x1bf6('0x5a')]({'where':{'id':_0x55bfba[_0x1bf6('0x63')]['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x39926d,null))[_0x1bf6('0x20')](function(_0x4c6706){if(_0x4c6706){return _0x4c6706[_0x1bf6('0x70')](_0x55bfba['query'][_0x1bf6('0x6f')])[_0x1bf6('0x20')](function(){if(_[_0x1bf6('0x71')](_0x55bfba[_0x1bf6('0x45')][_0x1bf6('0x6f')])){for(var _0x10fb16=0x0;_0x10fb16<_0x55bfba['query'][_0x1bf6('0x6f')][_0x1bf6('0x4b')];_0x10fb16+=0x1){socket[_0x1bf6('0x72')](_0x1bf6('0x73'),{'UserId':Number(_0x55bfba['query'][_0x1bf6('0x6f')][_0x10fb16]),'WhatsappAccountId':Number(_0x55bfba[_0x1bf6('0x63')]['id'])});}}else{socket[_0x1bf6('0x72')](_0x1bf6('0x73'),{'UserId':Number(_0x55bfba[_0x1bf6('0x45')]['ids']),'WhatsappAccountId':Number(_0x55bfba[_0x1bf6('0x63')]['id'])});}});}})[_0x1bf6('0x20')](respondWithStatusCode(_0x39926d,null))[_0x1bf6('0x28')](handleError(_0x39926d,null));};exports[_0x1bf6('0x74')]=function(_0x1f8b4f,_0xd6f896,_0xc4619a){var _0x168e04={};var _0x40fdb5={};var _0x4b7d2c;var _0x4635cf;return db[_0x1bf6('0x3e')][_0x1bf6('0x67')]({'where':{'id':_0x1f8b4f['params']['id']}})['then'](handleEntityNotFound(_0xd6f896,null))[_0x1bf6('0x20')](function(_0x32b212){if(_0x32b212){_0x4b7d2c=_0x32b212;_0x40fdb5[_0x1bf6('0x43')]=_[_0x1bf6('0x46')](db[_0x1bf6('0x75')][_0x1bf6('0x3f')]);_0x40fdb5[_0x1bf6('0x45')]=_[_0x1bf6('0x46')](_0x1f8b4f[_0x1bf6('0x45')]);_0x40fdb5[_0x1bf6('0x47')]=_[_0x1bf6('0x48')](_0x40fdb5[_0x1bf6('0x43')],_0x40fdb5[_0x1bf6('0x45')]);_0x168e04[_0x1bf6('0x4a')]=_[_0x1bf6('0x48')](_0x40fdb5[_0x1bf6('0x43')],qs[_0x1bf6('0x49')](_0x1f8b4f[_0x1bf6('0x45')][_0x1bf6('0x49')]));_0x168e04[_0x1bf6('0x4a')]=_0x168e04[_0x1bf6('0x4a')][_0x1bf6('0x4b')]?_0x168e04[_0x1bf6('0x4a')]:_0x40fdb5[_0x1bf6('0x43')];_0x168e04[_0x1bf6('0x4d')]=qs[_0x1bf6('0x4e')](_0x1f8b4f[_0x1bf6('0x45')][_0x1bf6('0x4e')]);_0x168e04['where']=qs['filters'](_['pick'](_0x1f8b4f['query'],_0x40fdb5[_0x1bf6('0x47')]));if(_0x1f8b4f[_0x1bf6('0x45')][_0x1bf6('0x51')]){_0x168e04[_0x1bf6('0x4f')]=_['merge'](_0x168e04[_0x1bf6('0x4f')],{'$or':_['map'](_0x168e04['attributes'],function(_0x435e42){var _0x441828={};_0x441828[_0x435e42]={'$like':'%'+_0x1f8b4f[_0x1bf6('0x45')][_0x1bf6('0x51')]+'%'};return _0x441828;})});}_0x168e04=_['merge']({},_0x168e04,_0x1f8b4f[_0x1bf6('0x54')]);return _0x4b7d2c[_0x1bf6('0x74')](_0x168e04);}})[_0x1bf6('0x20')](function(_0x4cf579){if(_0x4cf579){_0x4635cf=_0x4cf579[_0x1bf6('0x4b')];if(!_0x1f8b4f[_0x1bf6('0x45')][_0x1bf6('0x4c')](_0x1bf6('0x68'))){_0x168e04[_0x1bf6('0x2f')]=qs['limit'](_0x1f8b4f[_0x1bf6('0x45')][_0x1bf6('0x2f')]);_0x168e04[_0x1bf6('0x2e')]=qs[_0x1bf6('0x2e')](_0x1f8b4f[_0x1bf6('0x45')]['offset']);}return _0x4b7d2c[_0x1bf6('0x74')](_0x168e04);}})['then'](function(_0x5a7ef7){if(_0x5a7ef7){return _0x5a7ef7?{'count':_0x4635cf,'rows':_0x5a7ef7}:null;}})[_0x1bf6('0x20')](respondWithResult(_0xd6f896,null))['catch'](handleError(_0xd6f896,null));};exports[_0x1bf6('0x76')]=function(_0x473252,_0x4c3741,_0x3b602a){return db[_0x1bf6('0x3e')][_0x1bf6('0x67')]({'where':{'id':_0x473252[_0x1bf6('0x63')]['id']}})[_0x1bf6('0x20')](handleEntityNotFound(_0x4c3741,null))[_0x1bf6('0x20')](function(_0x594921){if(_0x594921){return db[_0x1bf6('0x77')][_0x1bf6('0x78')](function(_0x37e877){return db[_0x1bf6('0x79')]['destroy']({'where':{'WhatsappAccountId':_0x473252[_0x1bf6('0x63')]['id']},'transaction':_0x37e877})[_0x1bf6('0x20')](function(_0x347bdf){var _0x3e5405=_['map'](_0x473252[_0x1bf6('0x5c')],function(_0x545605){_0x545605[_0x1bf6('0x69')]=_0x473252[_0x1bf6('0x63')]['id'];return _0x545605;});return db[_0x1bf6('0x79')][_0x1bf6('0x7a')](_0x3e5405,{'transaction':_0x37e877});});})[_0x1bf6('0x20')](function(){return db[_0x1bf6('0x79')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x473252['params']['id']},'order':_0x1bf6('0x7b')});});}})[_0x1bf6('0x20')](respondWithResult(_0x4c3741,null))[_0x1bf6('0x28')](handleError(_0x4c3741,null));};exports[_0x1bf6('0x7c')]=function(_0x4e3eb3,_0x1eef6b,_0x52d08a){var _0x22f12a={};var _0x49d20b={};var _0x48204d;var _0x233ca2;return db[_0x1bf6('0x3e')][_0x1bf6('0x67')]({'where':{'id':_0x4e3eb3[_0x1bf6('0x63')]['id']}})['then'](handleEntityNotFound(_0x1eef6b,null))[_0x1bf6('0x20')](function(_0x552911){if(_0x552911){_0x48204d=_0x552911;_0x49d20b[_0x1bf6('0x43')]=_[_0x1bf6('0x46')](db[_0x1bf6('0x79')]['rawAttributes']);_0x49d20b[_0x1bf6('0x45')]=_[_0x1bf6('0x46')](_0x4e3eb3[_0x1bf6('0x45')]);_0x49d20b[_0x1bf6('0x47')]=_[_0x1bf6('0x48')](_0x49d20b['model'],_0x49d20b[_0x1bf6('0x45')]);_0x22f12a[_0x1bf6('0x4a')]=_[_0x1bf6('0x48')](_0x49d20b[_0x1bf6('0x43')],qs[_0x1bf6('0x49')](_0x4e3eb3[_0x1bf6('0x45')][_0x1bf6('0x49')]));_0x22f12a[_0x1bf6('0x4a')]=_0x22f12a[_0x1bf6('0x4a')][_0x1bf6('0x4b')]?_0x22f12a[_0x1bf6('0x4a')]:_0x49d20b[_0x1bf6('0x43')];_0x22f12a[_0x1bf6('0x4d')]=qs[_0x1bf6('0x4e')](_0x4e3eb3[_0x1bf6('0x45')]['sort']);_0x22f12a[_0x1bf6('0x4f')]=qs[_0x1bf6('0x47')](_[_0x1bf6('0x50')](_0x4e3eb3[_0x1bf6('0x45')],_0x49d20b[_0x1bf6('0x47')]));if(_0x4e3eb3[_0x1bf6('0x45')][_0x1bf6('0x51')]){_0x22f12a[_0x1bf6('0x4f')]=_[_0x1bf6('0x52')](_0x22f12a['where'],{'$or':_['map'](_0x22f12a[_0x1bf6('0x4a')],function(_0x17f0d7){var _0x8c1137={};_0x8c1137[_0x17f0d7]={'$like':'%'+_0x4e3eb3['query'][_0x1bf6('0x51')]+'%'};return _0x8c1137;})});}_0x22f12a=_['merge']({},_0x22f12a,_0x4e3eb3[_0x1bf6('0x54')]);return _0x48204d['getApplications'](_0x22f12a);}})[_0x1bf6('0x20')](function(_0x1c943c){if(_0x1c943c){_0x233ca2=_0x1c943c[_0x1bf6('0x4b')];if(!_0x4e3eb3[_0x1bf6('0x45')][_0x1bf6('0x4c')]('nolimit')){_0x22f12a['limit']=qs['limit'](_0x4e3eb3[_0x1bf6('0x45')]['limit']);_0x22f12a[_0x1bf6('0x2e')]=qs[_0x1bf6('0x2e')](_0x4e3eb3[_0x1bf6('0x45')][_0x1bf6('0x2e')]);}return _0x48204d[_0x1bf6('0x7c')](_0x22f12a);}})[_0x1bf6('0x20')](function(_0x122c93){if(_0x122c93){return _0x122c93?{'count':_0x233ca2,'rows':_0x122c93}:null;}})['then'](respondWithResult(_0x1eef6b,null))['catch'](handleError(_0x1eef6b,null));};exports[_0x1bf6('0x7d')]=function(_0x52bf36,_0x27668e,_0x178511){var _0x26f2e6={'channel':_0x1bf6('0x7e')};var _0x3b4c05=[];var _0xb7babc=[];var _0x2cc1d8={};return db[_0x1bf6('0x3e')]['find']({'where':{'id':_0x52bf36[_0x1bf6('0x63')]['id']},'include':[{'model':db[_0x1bf6('0x79')],'as':_0x1bf6('0x7f')}]})['then'](handleEntityNotFound(_0x27668e,null))[_0x1bf6('0x20')](function(_0x2647f6){_0x26f2e6['account']=_0x2647f6;_0x26f2e6['applications']=_['orderBy'](_0x2647f6[_0x1bf6('0x7f')],[_0x1bf6('0x7b')],[_0x1bf6('0x80')]);if(_0x26f2e6[_0x1bf6('0x81')][_0x1bf6('0x7f')]){delete _0x26f2e6[_0x1bf6('0x81')][_0x1bf6('0x7f')];}return db[_0x1bf6('0x82')]['describe']();})['then'](function(_0x3fbef7){if(!_0x3fbef7){throw new db[(_0x1bf6('0x83'))][(_0x1bf6('0x84'))](_0x1bf6('0x85'));}_0x3b4c05=_[_0x1bf6('0x86')](_['keys'](_0x3fbef7),[_0x1bf6('0x87'),_0x1bf6('0x88')]);_0xb7babc=_[_0x1bf6('0x86')](_['keys'](_0x3fbef7),[_0x1bf6('0x87'),'updatedAt',_0x1bf6('0x89'),_0x1bf6('0x8a')]);_0x26f2e6[_0x1bf6('0x5c')]={'mapKey':_0x1bf6('0x8b')};if(_0x26f2e6[_0x1bf6('0x81')][_0x1bf6('0x41')]&&_0x26f2e6[_0x1bf6('0x81')]['type']===_0x1bf6('0x8c')){_0x26f2e6[_0x1bf6('0x5c')][_0x1bf6('0x8d')]=_0x52bf36[_0x1bf6('0x5c')][_0x1bf6('0x8e')][_0x1bf6('0x8f')](_0x1bf6('0x90'),'');_0x26f2e6['body'][_0x1bf6('0x5c')]=_0x52bf36[_0x1bf6('0x5c')][_0x1bf6('0x91')];_0x26f2e6['body'][_0x1bf6('0x92')]=_0x52bf36['body'][_0x1bf6('0x93')];}if(_0x26f2e6['body']['id']){delete _0x26f2e6[_0x1bf6('0x5c')]['id'];}if(_[_0x1bf6('0x94')](_0x26f2e6['body'][_0x1bf6('0x8d')])){throw new db[(_0x1bf6('0x83'))][(_0x1bf6('0x84'))](_0x1bf6('0x95'));}if(_[_0x1bf6('0x94')](_0x26f2e6['body']['body'])||_0x26f2e6[_0x1bf6('0x5c')]['body']===''){throw new db[(_0x1bf6('0x83'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1bf6('0x94')](_0x26f2e6[_0x1bf6('0x5c')][_0x1bf6('0x96')])){throw new db[(_0x1bf6('0x83'))][(_0x1bf6('0x84'))](_0x1bf6('0x97')+_0xb7babc);}if(!_[_0x1bf6('0x98')](_0xb7babc,_0x26f2e6[_0x1bf6('0x5c')][_0x1bf6('0x96')])){throw new db[(_0x1bf6('0x83'))][(_0x1bf6('0x84'))](_0x1bf6('0x99')+_0xb7babc);}_0x2cc1d8[_0x26f2e6[_0x1bf6('0x5c')][_0x1bf6('0x96')]]=_0x26f2e6[_0x1bf6('0x5c')][_0x1bf6('0x8d')];return db[_0x1bf6('0x9a')][_0x1bf6('0x5a')]({'where':{'id':_0x26f2e6['account'][_0x1bf6('0x8a')]},'include':[{'model':db[_0x1bf6('0x82')],'as':_0x1bf6('0x9b'),'where':_0x2cc1d8,'limit':0x1,'order':[['updatedAt',_0x1bf6('0x9c')]]}]});})['then'](handleEntityNotFound(_0x27668e,null))[_0x1bf6('0x20')](function(_0x5c6314){if(_0x5c6314){_0x26f2e6[_0x1bf6('0x9d')]=_[_0x1bf6('0x9e')](_0x5c6314,[_0x1bf6('0x9b')]);if(_0x5c6314[_0x1bf6('0x9b')][_0x1bf6('0x4b')]){return _0x5c6314[_0x1bf6('0x9b')][0x0];}var _0x1348df=_[_0x1bf6('0x1a')](_0x26f2e6[_0x1bf6('0x5c')],{'firstName':_0x26f2e6[_0x1bf6('0x5c')]['from'],'ListId':_0x5c6314['id']});_0x1348df[_0x26f2e6[_0x1bf6('0x5c')][_0x1bf6('0x96')]]=_0x26f2e6[_0x1bf6('0x5c')][_0x1bf6('0x8d')];return db[_0x1bf6('0x82')][_0x1bf6('0x5b')](_0x1348df,{'fields':_0x3b4c05,'raw':!![]});}})[_0x1bf6('0x20')](handleEntityNotFound(_0x27668e,null))[_0x1bf6('0x20')](function(_0x39b652){if(_0x39b652){_0x26f2e6['contact']=_0x39b652;var _0x536969={'ContactId':_0x39b652['id'],'phone':_0x26f2e6['body'][_0x1bf6('0x8d')],'WhatsappAccountId':_0x52bf36[_0x1bf6('0x63')]['id']};var _0x1614ea={'ContactId':_0x39b652['id'],'WhatsappAccountId':_0x52bf36[_0x1bf6('0x63')]['id'],'closed':![]};return db[_0x1bf6('0x9f')][_0x1bf6('0x5a')]({'where':_0x1614ea})[_0x1bf6('0x20')](function(_0x6530fd){if(_0x6530fd){return[_0x6530fd,![]];}return db['WhatsappInteraction']['create'](_0x536969)[_0x1bf6('0x20')](function(_0x576a3c){return[_0x576a3c,!![]];});});}})[_0x1bf6('0x6e')](function(_0x3eb903,_0x45fd04){_0x26f2e6[_0x1bf6('0xa0')]=_0x3eb903[_0x1bf6('0x37')]({'plain':!![]});_0x26f2e6[_0x1bf6('0xa0')][_0x1bf6('0xa1')]=![];if(_0x45fd04){if(_0x26f2e6[_0x1bf6('0x81')]['autoclose']){_0x26f2e6[_0x1bf6('0xa2')]['push']({'id':0x0,'priority':_0x26f2e6['applications']['length']+0x1,'app':_0x1bf6('0xa3'),'appdata':'unmanaged','interval':_0x1bf6('0xa4')});}_0x26f2e6['interaction'][_0x1bf6('0xa1')]=!![];}return db[_0x1bf6('0xa5')][_0x1bf6('0x5b')]({'phone':_0x26f2e6['body']['from'],'messageId':_0x26f2e6['body'][_0x1bf6('0x92')],'body':_0x26f2e6[_0x1bf6('0x5c')][_0x1bf6('0x5c')],'WhatsappAccountId':_0x52bf36['params']['id'],'WhatsappInteractionId':_0x3eb903['id'],'direction':'in','ContactId':_0x3eb903['ContactId'],'AttachmentId':_0x26f2e6['body']['AttachmentId']});})['then'](function(_0x23a3ac){_0x26f2e6['message']=_0x23a3ac;if(_0x26f2e6[_0x1bf6('0xa0')][_0x1bf6('0xa6')]){return db[_0x1bf6('0x75')][_0x1bf6('0x5a')]({'attributes':['id',_0x1bf6('0x3b')],'where':{'id':_0x26f2e6[_0x1bf6('0xa0')][_0x1bf6('0xa6')]}})['then'](function(_0x5e04dc){if(_0x5e04dc){_0x26f2e6[_0x1bf6('0xa2')][_0x1bf6('0xa7')]({'id':0x0,'priority':0x0,'app':_0x1bf6('0xa8'),'appdata':_0x5e04dc[_0x1bf6('0x3b')]+','+(_0x26f2e6['account'][_0x1bf6('0xa9')]||0xa),'interval':_0x1bf6('0xa4')});}return respondWithRpcPromise(_0x1bf6('0xaa'),_0x1bf6('0xab'),_0x26f2e6);});}return respondWithRpcPromise(_0x1bf6('0xaa'),_0x1bf6('0xab'),_0x26f2e6);})[_0x1bf6('0x20')](function(_0x41f06e){if(_0x41f06e){var _0x7fdd8=0xc8;var _0x553a25=_0x1bf6('0xac');logger[_0x1bf6('0xad')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x553a25,_0x7fdd8,_0x1bf6('0xae'));logger[_0x1bf6('0x23')](_0x1bf6('0xaf'),_0x553a25,_0x7fdd8,_0x1bf6('0xae'),JSON[_0x1bf6('0x25')](_0x41f06e));if(_0x26f2e6[_0x1bf6('0x81')][_0x1bf6('0x41')]===_0x1bf6('0x8c')){return _0x27668e[_0x1bf6('0x2a')](_0x7fdd8)[_0x1bf6('0x30')](_0x1bf6('0xb0'),_0x1bf6('0xb1'))[_0x1bf6('0x3c')]('\x0a');}else{return _0x27668e['status'](_0x7fdd8)['json'](_0x41f06e);}}})[_0x1bf6('0x28')](handleError(_0x27668e,null));};exports[_0x1bf6('0x3c')]=function(_0x5ccfcf,_0x802196,_0x170c2a){var _0x46c3e6,_0x35e24e,_0x18e4b0;if(_['isNil'](_0x5ccfcf[_0x1bf6('0x5c')][_0x1bf6('0x5c')])||_0x5ccfcf[_0x1bf6('0x5c')][_0x1bf6('0x5c')]===''){throw new db['Sequelize'][(_0x1bf6('0x84'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1bf6('0x94')](_0x5ccfcf[_0x1bf6('0x5c')]['to'])){throw new db[(_0x1bf6('0x83'))][(_0x1bf6('0x84'))](_0x1bf6('0xb2'));}_0x46c3e6=_0x5ccfcf[_0x1bf6('0x5c')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x5ccfcf['params']['id']},'include':[{'model':db[_0x1bf6('0x9a')],'as':_0x1bf6('0xb3'),'include':[{'model':db[_0x1bf6('0x82')],'as':_0x1bf6('0x9b'),'where':{'mobile':_0x46c3e6},'limit':0x1,'order':[[_0x1bf6('0x88'),'DESC']]}]}]})[_0x1bf6('0x20')](handleEntityNotFound(_0x802196,null))[_0x1bf6('0x20')](function(_0x3d2d2e){if(_0x3d2d2e&&_0x3d2d2e[_0x1bf6('0xb3')]){_0x35e24e=_0x3d2d2e['get']({'plain':!![]});if(_0x35e24e[_0x1bf6('0xb3')]&&_0x35e24e[_0x1bf6('0xb3')][_0x1bf6('0x9b')][_0x1bf6('0x4b')]){return _0x35e24e[_0x1bf6('0xb3')]['Contacts'][0x0];}return db[_0x1bf6('0x82')]['create'](_['defaults'](_0x5ccfcf[_0x1bf6('0x5c')],{'firstName':_0x46c3e6,'mobile':_0x46c3e6,'phone':_0x46c3e6,'ListId':_0x35e24e[_0x1bf6('0x8a')]}));}})['then'](handleEntityNotFound(_0x802196,null))[_0x1bf6('0x20')](function(_0x182d7e){if(_0x182d7e){_0x18e4b0=_0x182d7e;return db[_0x1bf6('0x9f')][_0x1bf6('0x5a')]({'where':{'ContactId':_0x18e4b0['id'],'closed':![],'WhatsappAccountId':_0x35e24e['id']}})[_0x1bf6('0x20')](function(_0x53a8cb){if(_0x53a8cb){return[_0x53a8cb,![]];}return db[_0x1bf6('0x9f')]['create']({'UserId':_0x5ccfcf[_0x1bf6('0x5d')]['id'],'ContactId':_0x18e4b0['id'],'WhatsappAccountId':_0x35e24e['id'],'phone':_0x46c3e6,'firstMsgDirection':_0x1bf6('0xb4'),'Messages':[_['merge'](_0x5ccfcf[_0x1bf6('0x5c')],{'read':![],'body':_0x5ccfcf[_0x1bf6('0x5c')][_0x1bf6('0x5c')],'phone':_0x46c3e6,'WhatsappAccountId':_0x35e24e['id'],'UserId':_0x5ccfcf['user']['id'],'ContactId':_0x18e4b0['id']})]},{'include':[{'model':db[_0x1bf6('0xa5')],'as':_0x1bf6('0xb5')}]})[_0x1bf6('0x20')](function(_0x37ccf3){return[_0x37ccf3,!![]];});});}})[_0x1bf6('0x6e')](function(_0x369c92,_0x536e81){if(_0x536e81){return _0x369c92;}return db[_0x1bf6('0xa5')]['create'](_[_0x1bf6('0x52')](_0x5ccfcf[_0x1bf6('0x5c')],{'read':![],'body':_0x5ccfcf[_0x1bf6('0x5c')][_0x1bf6('0x5c')],'phone':_0x46c3e6,'WhatsappAccountId':_0x35e24e['id'],'WhatsappInteractionId':_0x369c92['id'],'UserId':_0x5ccfcf['user']['id'],'ContactId':_0x18e4b0['id']}))[_0x1bf6('0x20')](function(_0x3b08ad){_0x369c92[_0x1bf6('0xb6')][_0x1bf6('0xb5')]=[];_0x369c92['dataValues']['Messages'][_0x1bf6('0xb7')](_0x3b08ad[_0x1bf6('0xb6')]);return _0x369c92;});})[_0x1bf6('0x20')](respondWithResult(_0x802196,null))[_0x1bf6('0x28')](handleError(_0x802196,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 063ee5f..68f9059 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 _0x6050=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','hasOwnProperty'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x6050,0x196));var _0x0605=function(_0x4c6206,_0xb61c58){_0x4c6206=_0x4c6206-0x0;var _0x24291c=_0x6050[_0x4c6206];return _0x24291c;};'use strict';var EventEmitter=require(_0x0605('0x0'));var WhatsappAccount=require(_0x0605('0x1'))['db'][_0x0605('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0605('0x3')](0x0);var events={'afterCreate':_0x0605('0x4'),'afterUpdate':_0x0605('0x5'),'afterDestroy':'remove'};function emitEvent(_0x22d595){return function(_0x4576f4,_0x43403d,_0x5797b0){WhatsappAccountEvents['emit'](_0x22d595+':'+_0x4576f4['id'],_0x4576f4);WhatsappAccountEvents['emit'](_0x22d595,_0x4576f4);_0x5797b0(null);};}for(var e in events){if(events[_0x0605('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xd9fb=['emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove'];(function(_0x92116d,_0xa6ee1b){var _0xfe4f60=function(_0x1f052d){while(--_0x1f052d){_0x92116d['push'](_0x92116d['shift']());}};_0xfe4f60(++_0xa6ee1b);}(_0xd9fb,0x189));var _0xbd9f=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xd9fb[_0x3054be];return _0x3df150;};'use strict';var EventEmitter=require(_0xbd9f('0x0'));var WhatsappAccount=require(_0xbd9f('0x1'))['db'][_0xbd9f('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xbd9f('0x3')](0x0);var events={'afterCreate':_0xbd9f('0x4'),'afterUpdate':_0xbd9f('0x5'),'afterDestroy':_0xbd9f('0x6')};function emitEvent(_0x56fe1b){return function(_0x2d4213,_0xf146bc,_0x4ce2e2){WhatsappAccountEvents[_0xbd9f('0x7')](_0x56fe1b+':'+_0x2d4213['id'],_0x2d4213);WhatsappAccountEvents['emit'](_0x56fe1b,_0x2d4213);_0x4ce2e2(null);};}for(var e in events){if(events[_0xbd9f('0x8')](e)){var event=events[e];WhatsappAccount[_0xbd9f('0x9')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 832efc3..d63daa4 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 _0xe948=['request-promise','path','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x396910,_0x397bda){var _0x217d81=function(_0x1e6ab9){while(--_0x1e6ab9){_0x396910['push'](_0x396910['shift']());}};_0x217d81(++_0x397bda);}(_0xe948,0x1db));var _0x8e94=function(_0x2fa21e,_0x49f072){_0x2fa21e=_0x2fa21e-0x0;var _0x19173a=_0xe948[_0x2fa21e];return _0x19173a;};'use strict';var _=require(_0x8e94('0x0'));var util=require('util');var logger=require(_0x8e94('0x1'))(_0x8e94('0x2'));var moment=require(_0x8e94('0x3'));var BPromise=require(_0x8e94('0x4'));var rp=require(_0x8e94('0x5'));var fs=require('fs');var path=require(_0x8e94('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8e94('0x7'));module[_0x8e94('0x8')]=function(_0x411f00,_0x246d68){return _0x411f00[_0x8e94('0x9')](_0x8e94('0xa'),attributes,{'tableName':_0x8e94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9163=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','whatsapp_accounts','lodash'];(function(_0x381be7,_0x2161c8){var _0x5f0446=function(_0x4be575){while(--_0x4be575){_0x381be7['push'](_0x381be7['shift']());}};_0x5f0446(++_0x2161c8);}(_0x9163,0xef));var _0x3916=function(_0x926cd7,_0x3227f9){_0x926cd7=_0x926cd7-0x0;var _0x23f1fa=_0x9163[_0x926cd7];return _0x23f1fa;};'use strict';var _=require(_0x3916('0x0'));var util=require(_0x3916('0x1'));var logger=require(_0x3916('0x2'))(_0x3916('0x3'));var moment=require(_0x3916('0x4'));var BPromise=require(_0x3916('0x5'));var rp=require(_0x3916('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3916('0x7'));var config=require(_0x3916('0x8'));var attributes=require(_0x3916('0x9'));module[_0x3916('0xa')]=function(_0x3de772,_0x40fef2){return _0x3de772['define']('WhatsappAccount',attributes,{'tableName':_0x3916('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index c7c00bb..8939b15 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 _0x3ee7=['error','message','result','catch','ShowWhatsappAccount','find','options','raw','where','include','map','attributes','model','then','info','debug','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','WhatsappAccount,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x565fed,_0xb85768){var _0x3e018f=function(_0x104d8e){while(--_0x104d8e){_0x565fed['push'](_0x565fed['shift']());}};_0x3e018f(++_0xb85768);}(_0x3ee7,0x98));var _0x73ee=function(_0x7d2f8e,_0x3c42b3){_0x7d2f8e=_0x7d2f8e-0x0;var _0x5ef202=_0x3ee7[_0x7d2f8e];return _0x5ef202;};'use strict';var _=require('lodash');var util=require(_0x73ee('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x73ee('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73ee('0x2'))['db'];var utils=require(_0x73ee('0x3'));var logger=require(_0x73ee('0x4'))(_0x73ee('0x5'));var config=require(_0x73ee('0x6'));var jayson=require(_0x73ee('0x7'));var client=jayson[_0x73ee('0x8')][_0x73ee('0x9')]({'port':0x232a});config['redis']=_[_0x73ee('0xa')](config[_0x73ee('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x73ee('0xc'))(new Redis(config['redis']));require(_0x73ee('0xd'))[_0x73ee('0xe')](socket);function respondWithRpcPromise(_0x8d1eb9,_0xb12d2e,_0x23b4f5){return new BPromise(function(_0x4d5bb7,_0xe75883){return client['request'](_0x8d1eb9,_0x23b4f5)['then'](function(_0x41727b){logger['info'](_0x73ee('0xf'),_0xb12d2e,_0x73ee('0x10'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xb12d2e,_0x73ee('0x10'),JSON[_0x73ee('0x11')](_0x41727b));if(_0x41727b['error']){if(_0x41727b[_0x73ee('0x12')]['code']===0x1f4){logger[_0x73ee('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0xb12d2e,_0x41727b[_0x73ee('0x12')][_0x73ee('0x13')]);return _0xe75883(_0x41727b[_0x73ee('0x12')]['message']);}logger['error'](_0x73ee('0xf'),_0xb12d2e,_0x41727b[_0x73ee('0x12')]['message']);return _0x4d5bb7(_0x41727b['error']['message']);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0xb12d2e,_0x73ee('0x10'));_0x4d5bb7(_0x41727b[_0x73ee('0x14')]['message']);}})[_0x73ee('0x15')](function(_0xd1a684){logger[_0x73ee('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0xb12d2e,_0xd1a684);_0xe75883(_0xd1a684);});});}exports[_0x73ee('0x16')]=function(_0x5b22e0){var _0x2ce7a1=this;return new Promise(function(_0x432c52,_0x1b4a19){return db['WhatsappAccount'][_0x73ee('0x17')]({'raw':_0x5b22e0[_0x73ee('0x18')]?_0x5b22e0[_0x73ee('0x18')][_0x73ee('0x19')]===undefined?!![]:![]:!![],'where':_0x5b22e0[_0x73ee('0x18')]?_0x5b22e0['options'][_0x73ee('0x1a')]||null:null,'attributes':_0x5b22e0[_0x73ee('0x18')]?_0x5b22e0[_0x73ee('0x18')]['attributes']||null:null,'include':_0x5b22e0['options']?_0x5b22e0[_0x73ee('0x18')][_0x73ee('0x1b')]?_[_0x73ee('0x1c')](_0x5b22e0[_0x73ee('0x18')][_0x73ee('0x1b')],function(_0x2c582f){return{'model':db[_0x2c582f['model']],'as':_0x2c582f['as'],'attributes':_0x2c582f[_0x73ee('0x1d')],'include':_0x2c582f[_0x73ee('0x1b')]?_[_0x73ee('0x1c')](_0x2c582f['include'],function(_0x5b9b5f){return{'model':db[_0x5b9b5f[_0x73ee('0x1e')]],'as':_0x5b9b5f['as'],'attributes':_0x5b9b5f[_0x73ee('0x1d')],'include':_0x5b9b5f['include']?_[_0x73ee('0x1c')](_0x5b9b5f['include'],function(_0x431f05){return{'model':db[_0x431f05[_0x73ee('0x1e')]],'as':_0x431f05['as'],'attributes':_0x431f05[_0x73ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x73ee('0x1f')](function(_0x47bf15){logger[_0x73ee('0x20')](_0x73ee('0x16'),_0x5b22e0);logger[_0x73ee('0x21')](_0x73ee('0x16'),_0x5b22e0,JSON[_0x73ee('0x11')](_0x47bf15));_0x432c52(_0x47bf15);})[_0x73ee('0x15')](function(_0x5cb803){logger[_0x73ee('0x12')](_0x73ee('0x16'),_0x5cb803[_0x73ee('0x13')],_0x5b22e0);_0x1b4a19(_0x2ce7a1['error'](0x1f4,_0x5cb803['message']));});});}; \ No newline at end of file +var _0x9124=['../../mysqldb','rpc','../../config/environment','http','defaults','socket.io-emitter','redis','./whatsappAccount.socket','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','include','map','attributes','model','debug','stringify','lodash','util','bluebird','randomstring','ioredis'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x9124,0x83));var _0x4912=function(_0x9b1b91,_0x528d09){_0x9b1b91=_0x9b1b91-0x0;var _0x2782d5=_0x9124[_0x9b1b91];return _0x2782d5;};'use strict';var _=require(_0x4912('0x0'));var util=require(_0x4912('0x1'));var moment=require('moment');var BPromise=require(_0x4912('0x2'));var rs=require(_0x4912('0x3'));var fs=require('fs');var Redis=require(_0x4912('0x4'));var db=require(_0x4912('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4912('0x6'));var config=require(_0x4912('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4912('0x8')]({'port':0x232a});config['redis']=_[_0x4912('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4912('0xa'))(new Redis(config[_0x4912('0xb')]));require(_0x4912('0xc'))['register'](socket);function respondWithRpcPromise(_0x227982,_0x2eaf21,_0x952b69){return new BPromise(function(_0x173088,_0x44ceeb){return client['request'](_0x227982,_0x952b69)[_0x4912('0xd')](function(_0xa11762){logger[_0x4912('0xe')](_0x4912('0xf'),_0x2eaf21,_0x4912('0x10'));logger['debug'](_0x4912('0x11'),_0x2eaf21,_0x4912('0x10'),JSON['stringify'](_0xa11762));if(_0xa11762['error']){if(_0xa11762[_0x4912('0x12')]['code']===0x1f4){logger[_0x4912('0x12')](_0x4912('0xf'),_0x2eaf21,_0xa11762[_0x4912('0x12')]['message']);return _0x44ceeb(_0xa11762[_0x4912('0x12')][_0x4912('0x13')]);}logger[_0x4912('0x12')](_0x4912('0xf'),_0x2eaf21,_0xa11762[_0x4912('0x12')][_0x4912('0x13')]);return _0x173088(_0xa11762[_0x4912('0x12')]['message']);}else{logger['info'](_0x4912('0xf'),_0x2eaf21,_0x4912('0x10'));_0x173088(_0xa11762[_0x4912('0x14')][_0x4912('0x13')]);}})[_0x4912('0x15')](function(_0x59e7da){logger[_0x4912('0x12')](_0x4912('0xf'),_0x2eaf21,_0x59e7da);_0x44ceeb(_0x59e7da);});});}exports[_0x4912('0x16')]=function(_0x4659b4){var _0x4cec9c=this;return new Promise(function(_0x1d6a9b,_0x498d19){return db[_0x4912('0x17')][_0x4912('0x18')]({'raw':_0x4659b4['options']?_0x4659b4[_0x4912('0x19')][_0x4912('0x1a')]===undefined?!![]:![]:!![],'where':_0x4659b4[_0x4912('0x19')]?_0x4659b4[_0x4912('0x19')][_0x4912('0x1b')]||null:null,'attributes':_0x4659b4['options']?_0x4659b4[_0x4912('0x19')]['attributes']||null:null,'include':_0x4659b4[_0x4912('0x19')]?_0x4659b4[_0x4912('0x19')][_0x4912('0x1c')]?_[_0x4912('0x1d')](_0x4659b4[_0x4912('0x19')][_0x4912('0x1c')],function(_0x9c5acd){return{'model':db[_0x9c5acd['model']],'as':_0x9c5acd['as'],'attributes':_0x9c5acd[_0x4912('0x1e')],'include':_0x9c5acd['include']?_[_0x4912('0x1d')](_0x9c5acd[_0x4912('0x1c')],function(_0x267764){return{'model':db[_0x267764[_0x4912('0x1f')]],'as':_0x267764['as'],'attributes':_0x267764[_0x4912('0x1e')],'include':_0x267764[_0x4912('0x1c')]?_[_0x4912('0x1d')](_0x267764[_0x4912('0x1c')],function(_0x326d9c){return{'model':db[_0x326d9c[_0x4912('0x1f')]],'as':_0x326d9c['as'],'attributes':_0x326d9c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4912('0xd')](function(_0x4caea1){logger['info'](_0x4912('0x16'),_0x4659b4);logger[_0x4912('0x20')]('ShowWhatsappAccount',_0x4659b4,JSON[_0x4912('0x21')](_0x4caea1));_0x1d6a9b(_0x4caea1);})[_0x4912('0x15')](function(_0x52f0a6){logger[_0x4912('0x12')](_0x4912('0x16'),_0x52f0a6['message'],_0x4659b4);_0x498d19(_0x4cec9c[_0x4912('0x12')](0x1f4,_0x52f0a6[_0x4912('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 59e08c0..77a99c0 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 _0x8b8b=['length','whatsappAccount:','./whatsappAccount.events','save','remove','emit','removeListener','register'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x8b8b,0x9a));var _0xb8b8=function(_0x3ef15d,_0x1667bb){_0x3ef15d=_0x3ef15d-0x0;var _0x306810=_0x8b8b[_0x3ef15d];return _0x306810;};'use strict';var WhatsappAccountEvents=require(_0xb8b8('0x0'));var events=[_0xb8b8('0x1'),_0xb8b8('0x2'),'update'];function createListener(_0x58bb9b,_0x288eb6){return function(_0x1e2fed){_0x288eb6[_0xb8b8('0x3')](_0x58bb9b,_0x1e2fed);};}function removeListener(_0x6747c4,_0x5264e2){return function(){WhatsappAccountEvents[_0xb8b8('0x4')](_0x6747c4,_0x5264e2);};}exports[_0xb8b8('0x5')]=function(_0x14633e){for(var _0x4c7a85=0x0,_0x291767=events[_0xb8b8('0x6')];_0x4c7a85<_0x291767;_0x4c7a85++){var _0x20e55a=events[_0x4c7a85];var _0x457857=createListener(_0xb8b8('0x7')+_0x20e55a,_0x14633e);WhatsappAccountEvents['on'](_0x20e55a,_0x457857);}}; \ No newline at end of file +var _0x3fe4=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0xb303d6,_0x2b0e0c){var _0x1bdc54=function(_0x26037a){while(--_0x26037a){_0xb303d6['push'](_0xb303d6['shift']());}};_0x1bdc54(++_0x2b0e0c);}(_0x3fe4,0x11c));var _0x43fe=function(_0x23cfa9,_0x4abc2a){_0x23cfa9=_0x23cfa9-0x0;var _0x2e627b=_0x3fe4[_0x23cfa9];return _0x2e627b;};'use strict';var WhatsappAccountEvents=require(_0x43fe('0x0'));var events=[_0x43fe('0x1'),_0x43fe('0x2'),_0x43fe('0x3')];function createListener(_0x178002,_0x1e7a8b){return function(_0x30408c){_0x1e7a8b[_0x43fe('0x4')](_0x178002,_0x30408c);};}function removeListener(_0x1b825a,_0xe1dc7b){return function(){WhatsappAccountEvents[_0x43fe('0x5')](_0x1b825a,_0xe1dc7b);};}exports[_0x43fe('0x6')]=function(_0x44e431){for(var _0x4d6b1b=0x0,_0x4bf176=events[_0x43fe('0x7')];_0x4d6b1b<_0x4bf176;_0x4d6b1b++){var _0x419293=events[_0x4d6b1b];var _0x58ed9a=createListener(_0x43fe('0x8')+_0x419293,_0x44e431);WhatsappAccountEvents['on'](_0x419293,_0x58ed9a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 4543302..e822e50 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 _0xac68=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0xe68c03,_0xe3159d){var _0x5c2527=function(_0x638992){while(--_0x638992){_0xe68c03['push'](_0xe68c03['shift']());}};_0x5c2527(++_0xe3159d);}(_0xac68,0x128));var _0x8ac6=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xac68[_0x3e44fa];return _0x2a0aba;};'use strict';var multer=require('multer');var util=require(_0x8ac6('0x0'));var path=require(_0x8ac6('0x1'));var timeout=require(_0x8ac6('0x2'));var express=require(_0x8ac6('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8ac6('0x4'));var config=require(_0x8ac6('0x5'));var controller=require(_0x8ac6('0x6'));router[_0x8ac6('0x7')]('/',auth[_0x8ac6('0x8')](),controller[_0x8ac6('0x9')]);router[_0x8ac6('0x7')](_0x8ac6('0xa'),auth[_0x8ac6('0x8')](),controller[_0x8ac6('0xb')]);router[_0x8ac6('0xc')]('/',auth['isAuthenticated'](),controller[_0x8ac6('0xd')]);router[_0x8ac6('0xe')](_0x8ac6('0xa'),auth[_0x8ac6('0x8')](),controller[_0x8ac6('0xf')]);router[_0x8ac6('0x10')](_0x8ac6('0xa'),auth['isAuthenticated'](),controller[_0x8ac6('0x11')]);module[_0x8ac6('0x12')]=router; \ No newline at end of file +var _0x0044=['./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3ec751,_0x3009cd){var _0x252150=function(_0x5091e8){while(--_0x5091e8){_0x3ec751['push'](_0x3ec751['shift']());}};_0x252150(++_0x3009cd);}(_0x0044,0x14e));var _0x4004=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x0044[_0x54a761];return _0x37d1da;};'use strict';var multer=require(_0x4004('0x0'));var util=require(_0x4004('0x1'));var path=require('path');var timeout=require(_0x4004('0x2'));var express=require(_0x4004('0x3'));var router=express[_0x4004('0x4')]();var auth=require(_0x4004('0x5'));var interaction=require(_0x4004('0x6'));var config=require(_0x4004('0x7'));var controller=require(_0x4004('0x8'));router[_0x4004('0x9')]('/',auth[_0x4004('0xa')](),controller[_0x4004('0xb')]);router['get'](_0x4004('0xc'),auth['isAuthenticated'](),controller[_0x4004('0xd')]);router[_0x4004('0xe')]('/',auth[_0x4004('0xa')](),controller['create']);router['put'](_0x4004('0xc'),auth[_0x4004('0xa')](),controller[_0x4004('0xf')]);router[_0x4004('0x10')]('/:id',auth[_0x4004('0xa')](),controller[_0x4004('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index fa877ed..6f5be4d 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 _0xec2b=['*,*,*,*','INTEGER','STRING','noop','TEXT'];(function(_0x3435f9,_0x120cd9){var _0x1de278=function(_0x30738d){while(--_0x30738d){_0x3435f9['push'](_0x3435f9['shift']());}};_0x1de278(++_0x120cd9);}(_0xec2b,0x1e6));var _0xbec2=function(_0x47f1fc,_0xebbfa5){_0x47f1fc=_0x47f1fc-0x0;var _0x4c0b41=_0xec2b[_0x47f1fc];return _0x4c0b41;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xbec2('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xbec2('0x1')],'allowNull':![],'defaultValue':_0xbec2('0x2')},'appdata':{'type':Sequelize[_0xbec2('0x3')]()},'description':{'type':Sequelize[_0xbec2('0x1')]},'interval':{'type':Sequelize[_0xbec2('0x1')],'defaultValue':_0xbec2('0x4')}}; \ No newline at end of file +var _0xdd88=['STRING','TEXT','exports','INTEGER'];(function(_0x57ea6d,_0x36a88e){var _0x2a3e35=function(_0xbd144a){while(--_0xbd144a){_0x57ea6d['push'](_0x57ea6d['shift']());}};_0x2a3e35(++_0x36a88e);}(_0xdd88,0xba));var _0x8dd8=function(_0x3d6924,_0x3f41e3){_0x3d6924=_0x3d6924-0x0;var _0x44c1c6=_0xdd88[_0x3d6924];return _0x44c1c6;};'use strict';var Sequelize=require('sequelize');module[_0x8dd8('0x0')]={'priority':{'type':Sequelize[_0x8dd8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8dd8('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8dd8('0x3')]()},'description':{'type':Sequelize[_0x8dd8('0x2')]},'interval':{'type':Sequelize[_0x8dd8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ad7cc25..1cc9098 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 _0x69a7=['rawAttributes','key','name','keys','filters','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','offset','order','sort','filter','where','merge','VIRTUAL','includeAll','include','WhatsappApplication','findAll','rows','catch','show','params','length','options','find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','send','map'];(function(_0x248ae8,_0x124050){var _0x415a6f=function(_0x46eba7){while(--_0x46eba7){_0x248ae8['push'](_0x248ae8['shift']());}};_0x415a6f(++_0x124050);}(_0x69a7,0x66));var _0x769a=function(_0x29e3ec,_0x138a18){_0x29e3ec=_0x29e3ec-0x0;var _0x25727e=_0x69a7[_0x29e3ec];return _0x25727e;};'use strict';var pdf=require(_0x769a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x769a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x769a('0x2'));var rp=require(_0x769a('0x3'));var moment=require(_0x769a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x769a('0x5'));var path=require(_0x769a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x769a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x769a('0x8'));var crypto=require(_0x769a('0x9'));var jsforce=require(_0x769a('0xa'));var deskjs=require(_0x769a('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x769a('0xc'));var Redis=require(_0x769a('0xd'));var authService=require(_0x769a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x769a('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x769a('0x10'))(_0x769a('0x11'));var utils=require(_0x769a('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x769a('0x13'))['db'];function respondWithStatusCode(_0x26fee6,_0x36abb0){_0x36abb0=_0x36abb0||0xcc;return function(_0xb0ec5e){if(_0xb0ec5e){return _0x26fee6[_0x769a('0x14')](_0x36abb0);}return _0x26fee6[_0x769a('0x15')](_0x36abb0)['end']();};}function respondWithResult(_0x49d7c0,_0x4ca1c7){_0x4ca1c7=_0x4ca1c7||0xc8;return function(_0x85ab29){if(_0x85ab29){return _0x49d7c0['status'](_0x4ca1c7)[_0x769a('0x16')](_0x85ab29);}};}function respondWithFilteredResult(_0x17a78e,_0x4ee5b0){return function(_0x697407){if(_0x697407){var _0x24f0bb=_0x697407[_0x769a('0x17')],_0x56ba5b=_0x4ee5b0['offset'],_0xd4e66=_0x4ee5b0['offset']+_0x4ee5b0[_0x769a('0x18')],_0x47505b;if(_0xd4e66>=_0x24f0bb){_0xd4e66=_0x24f0bb;_0x47505b=0xc8;}else{_0x47505b=0xce;}_0x17a78e[_0x769a('0x15')](_0x47505b);return _0x17a78e[_0x769a('0x19')](_0x769a('0x1a'),_0x56ba5b+'-'+_0xd4e66+'/'+_0x24f0bb)[_0x769a('0x16')](_0x697407);}return null;};}function patchUpdates(_0x25f9c5){return function(_0xfecf8c){try{jsonpatch[_0x769a('0x1b')](_0xfecf8c,_0x25f9c5,!![]);}catch(_0x401cde){return BPromise[_0x769a('0x1c')](_0x401cde);}return _0xfecf8c[_0x769a('0x1d')]();};}function saveUpdates(_0x4c0f50,_0x404fcc){return function(_0x18f7b7){if(_0x18f7b7){return _0x18f7b7[_0x769a('0x1e')](_0x4c0f50)[_0x769a('0x1f')](function(_0x5d42cc){return _0x5d42cc;});}return null;};}function removeEntity(_0x2e03f4,_0x38590c){return function(_0x236d0b){if(_0x236d0b){return _0x236d0b[_0x769a('0x20')]()[_0x769a('0x1f')](function(){_0x2e03f4[_0x769a('0x15')](0xcc)[_0x769a('0x21')]();});}};}function handleEntityNotFound(_0x2e1edb,_0x1f376f){return function(_0x348f45){if(!_0x348f45){_0x2e1edb[_0x769a('0x14')](0x194);}return _0x348f45;};}function handleError(_0x35ce5e,_0x236126){_0x236126=_0x236126||0x1f4;return function(_0x40ed29){logger[_0x769a('0x22')](_0x40ed29[_0x769a('0x23')]);if(_0x40ed29['name']){delete _0x40ed29['name'];}_0x35ce5e[_0x769a('0x15')](_0x236126)[_0x769a('0x24')](_0x40ed29);};}exports['index']=function(_0x279bc5,_0x27195f){var _0x1e994c={},_0x41f133={},_0x4fb4c7={'count':0x0,'rows':[]};var _0x10072e=_[_0x769a('0x25')](db['WhatsappApplication'][_0x769a('0x26')],function(_0x1fc694){return{'name':_0x1fc694['fieldName'],'type':_0x1fc694['type'][_0x769a('0x27')]};});_0x41f133['model']=_[_0x769a('0x25')](_0x10072e,_0x769a('0x28'));_0x41f133['query']=_[_0x769a('0x29')](_0x279bc5['query']);_0x41f133[_0x769a('0x2a')]=_[_0x769a('0x2b')](_0x41f133[_0x769a('0x2c')],_0x41f133['query']);_0x1e994c[_0x769a('0x2d')]=_[_0x769a('0x2b')](_0x41f133['model'],qs[_0x769a('0x2e')](_0x279bc5['query']['fields']));_0x1e994c['attributes']=_0x1e994c[_0x769a('0x2d')]['length']?_0x1e994c[_0x769a('0x2d')]:_0x41f133[_0x769a('0x2c')];if(!_0x279bc5[_0x769a('0x2f')][_0x769a('0x30')](_0x769a('0x31'))){_0x1e994c[_0x769a('0x18')]=qs[_0x769a('0x18')](_0x279bc5[_0x769a('0x2f')][_0x769a('0x18')]);_0x1e994c[_0x769a('0x32')]=qs[_0x769a('0x32')](_0x279bc5[_0x769a('0x2f')]['offset']);}_0x1e994c[_0x769a('0x33')]=qs[_0x769a('0x34')](_0x279bc5[_0x769a('0x2f')]['sort']);_0x1e994c['where']=qs['filters'](_['pick'](_0x279bc5[_0x769a('0x2f')],_0x41f133['filters']),_0x10072e);if(_0x279bc5[_0x769a('0x2f')][_0x769a('0x35')]){_0x1e994c[_0x769a('0x36')]=_[_0x769a('0x37')](_0x1e994c[_0x769a('0x36')],{'$or':_[_0x769a('0x25')](_0x10072e,function(_0x9e2503){if(_0x9e2503['type']!==_0x769a('0x38')){var _0x5ba98d={};_0x5ba98d[_0x9e2503[_0x769a('0x28')]]={'$like':'%'+_0x279bc5['query'][_0x769a('0x35')]+'%'};return _0x5ba98d;}})});}_0x1e994c=_[_0x769a('0x37')]({},_0x1e994c,_0x279bc5['options']);var _0x2b7700={'where':_0x1e994c['where']};return db['WhatsappApplication'][_0x769a('0x17')](_0x2b7700)[_0x769a('0x1f')](function(_0x5a3503){_0x4fb4c7[_0x769a('0x17')]=_0x5a3503;if(_0x279bc5[_0x769a('0x2f')][_0x769a('0x39')]){_0x1e994c[_0x769a('0x3a')]=[{'all':!![]}];}return db[_0x769a('0x3b')][_0x769a('0x3c')](_0x1e994c);})[_0x769a('0x1f')](function(_0x146955){_0x4fb4c7[_0x769a('0x3d')]=_0x146955;return _0x4fb4c7;})['then'](respondWithFilteredResult(_0x27195f,_0x1e994c))[_0x769a('0x3e')](handleError(_0x27195f,null));};exports[_0x769a('0x3f')]=function(_0x374045,_0x451a16){var _0x5518ba={'raw':!![],'where':{'id':_0x374045[_0x769a('0x40')]['id']}},_0x2112cd={};_0x2112cd[_0x769a('0x2c')]=_[_0x769a('0x29')](db[_0x769a('0x3b')][_0x769a('0x26')]);_0x2112cd[_0x769a('0x2f')]=_[_0x769a('0x29')](_0x374045[_0x769a('0x2f')]);_0x2112cd[_0x769a('0x2a')]=_[_0x769a('0x2b')](_0x2112cd[_0x769a('0x2c')],_0x2112cd[_0x769a('0x2f')]);_0x5518ba[_0x769a('0x2d')]=_[_0x769a('0x2b')](_0x2112cd[_0x769a('0x2c')],qs['fields'](_0x374045[_0x769a('0x2f')][_0x769a('0x2e')]));_0x5518ba[_0x769a('0x2d')]=_0x5518ba[_0x769a('0x2d')][_0x769a('0x41')]?_0x5518ba['attributes']:_0x2112cd[_0x769a('0x2c')];if(_0x374045[_0x769a('0x2f')][_0x769a('0x39')]){_0x5518ba['include']=[{'all':!![]}];}_0x5518ba=_[_0x769a('0x37')]({},_0x5518ba,_0x374045[_0x769a('0x42')]);return db[_0x769a('0x3b')][_0x769a('0x43')](_0x5518ba)[_0x769a('0x1f')](handleEntityNotFound(_0x451a16,null))[_0x769a('0x1f')](respondWithResult(_0x451a16,null))['catch'](handleError(_0x451a16,null));};exports[_0x769a('0x44')]=function(_0x33a2ef,_0x32be48){return db[_0x769a('0x3b')][_0x769a('0x44')](_0x33a2ef[_0x769a('0x45')],{})[_0x769a('0x1f')](respondWithResult(_0x32be48,0xc9))[_0x769a('0x3e')](handleError(_0x32be48,null));};exports[_0x769a('0x1e')]=function(_0x6a02a4,_0x3d84bb){if(_0x6a02a4[_0x769a('0x45')]['id']){delete _0x6a02a4['body']['id'];}return db['WhatsappApplication'][_0x769a('0x43')]({'where':{'id':_0x6a02a4['params']['id']}})['then'](handleEntityNotFound(_0x3d84bb,null))[_0x769a('0x1f')](saveUpdates(_0x6a02a4[_0x769a('0x45')],null))[_0x769a('0x1f')](respondWithResult(_0x3d84bb,null))[_0x769a('0x3e')](handleError(_0x3d84bb,null));};exports[_0x769a('0x20')]=function(_0x40ee34,_0x5ba701){return db[_0x769a('0x3b')]['find']({'where':{'id':_0x40ee34[_0x769a('0x40')]['id']}})[_0x769a('0x1f')](handleEntityNotFound(_0x5ba701,null))[_0x769a('0x1f')](removeEntity(_0x5ba701,null))[_0x769a('0x3e')](handleError(_0x5ba701,null));}; \ No newline at end of file +var _0xd66c=['destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','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','end','count','offset','limit','Content-Range','json','save','update','then'];(function(_0x3806e6,_0x2f55d1){var _0x43aea8=function(_0x3c9928){while(--_0x3c9928){_0x3806e6['push'](_0x3806e6['shift']());}};_0x43aea8(++_0x2f55d1);}(_0xd66c,0x73));var _0xcd66=function(_0x204885,_0x15903a){_0x204885=_0x204885-0x0;var _0x24c76b=_0xd66c[_0x204885];return _0x24c76b;};'use strict';var pdf=require(_0xcd66('0x0'));var emlformat=require(_0xcd66('0x1'));var rimraf=require(_0xcd66('0x2'));var zipdir=require(_0xcd66('0x3'));var jsonpatch=require(_0xcd66('0x4'));var rp=require(_0xcd66('0x5'));var moment=require('moment');var BPromise=require(_0xcd66('0x6'));var Mustache=require(_0xcd66('0x7'));var util=require(_0xcd66('0x8'));var path=require(_0xcd66('0x9'));var sox=require('sox');var csv=require(_0xcd66('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcd66('0xb'));var squel=require(_0xcd66('0xc'));var crypto=require(_0xcd66('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcd66('0xe'));var Papa=require('papaparse');var Redis=require(_0xcd66('0xf'));var authService=require(_0xcd66('0x10'));var qs=require(_0xcd66('0x11'));var as=require(_0xcd66('0x12'));var hardwareService=require(_0xcd66('0x13'));var logger=require(_0xcd66('0x14'))(_0xcd66('0x15'));var utils=require(_0xcd66('0x16'));var config=require(_0xcd66('0x17'));var licenseUtil=require(_0xcd66('0x18'));var db=require(_0xcd66('0x19'))['db'];function respondWithStatusCode(_0x54b796,_0x2299b9){_0x2299b9=_0x2299b9||0xcc;return function(_0x21390c){if(_0x21390c){return _0x54b796[_0xcd66('0x1a')](_0x2299b9);}return _0x54b796[_0xcd66('0x1b')](_0x2299b9)[_0xcd66('0x1c')]();};}function respondWithResult(_0x160ad3,_0x16b94f){_0x16b94f=_0x16b94f||0xc8;return function(_0x427c12){if(_0x427c12){return _0x160ad3['status'](_0x16b94f)['json'](_0x427c12);}};}function respondWithFilteredResult(_0x1f0b3e,_0x145f81){return function(_0xf26863){if(_0xf26863){var _0x1a4070=_0xf26863[_0xcd66('0x1d')],_0x5591b5=_0x145f81[_0xcd66('0x1e')],_0x193576=_0x145f81[_0xcd66('0x1e')]+_0x145f81[_0xcd66('0x1f')],_0x181451;if(_0x193576>=_0x1a4070){_0x193576=_0x1a4070;_0x181451=0xc8;}else{_0x181451=0xce;}_0x1f0b3e[_0xcd66('0x1b')](_0x181451);return _0x1f0b3e['set'](_0xcd66('0x20'),_0x5591b5+'-'+_0x193576+'/'+_0x1a4070)[_0xcd66('0x21')](_0xf26863);}return null;};}function patchUpdates(_0x55dc00){return function(_0x2272b0){try{jsonpatch['apply'](_0x2272b0,_0x55dc00,!![]);}catch(_0x57efef){return BPromise['reject'](_0x57efef);}return _0x2272b0[_0xcd66('0x22')]();};}function saveUpdates(_0x5a692e,_0x4e0f8e){return function(_0x31f48a){if(_0x31f48a){return _0x31f48a[_0xcd66('0x23')](_0x5a692e)[_0xcd66('0x24')](function(_0x297c17){return _0x297c17;});}return null;};}function removeEntity(_0x17a949,_0x35290e){return function(_0x3585cc){if(_0x3585cc){return _0x3585cc[_0xcd66('0x25')]()['then'](function(){_0x17a949['status'](0xcc)[_0xcd66('0x1c')]();});}};}function handleEntityNotFound(_0x46a77d,_0x9a48cd){return function(_0x2ab3c2){if(!_0x2ab3c2){_0x46a77d[_0xcd66('0x1a')](0x194);}return _0x2ab3c2;};}function handleError(_0x4d29bb,_0x264b25){_0x264b25=_0x264b25||0x1f4;return function(_0x35ae62){logger[_0xcd66('0x26')](_0x35ae62[_0xcd66('0x27')]);if(_0x35ae62[_0xcd66('0x28')]){delete _0x35ae62[_0xcd66('0x28')];}_0x4d29bb[_0xcd66('0x1b')](_0x264b25)[_0xcd66('0x29')](_0x35ae62);};}exports[_0xcd66('0x2a')]=function(_0x29cb85,_0x1ab052){var _0x98cac6={},_0x1e0b1b={},_0x3202d2={'count':0x0,'rows':[]};var _0x1feb5e=_[_0xcd66('0x2b')](db[_0xcd66('0x2c')][_0xcd66('0x2d')],function(_0x188c80){return{'name':_0x188c80[_0xcd66('0x2e')],'type':_0x188c80[_0xcd66('0x2f')][_0xcd66('0x30')]};});_0x1e0b1b['model']=_[_0xcd66('0x2b')](_0x1feb5e,_0xcd66('0x28'));_0x1e0b1b[_0xcd66('0x31')]=_['keys'](_0x29cb85[_0xcd66('0x31')]);_0x1e0b1b[_0xcd66('0x32')]=_[_0xcd66('0x33')](_0x1e0b1b['model'],_0x1e0b1b[_0xcd66('0x31')]);_0x98cac6['attributes']=_['intersection'](_0x1e0b1b[_0xcd66('0x34')],qs[_0xcd66('0x35')](_0x29cb85[_0xcd66('0x31')][_0xcd66('0x35')]));_0x98cac6[_0xcd66('0x36')]=_0x98cac6[_0xcd66('0x36')][_0xcd66('0x37')]?_0x98cac6[_0xcd66('0x36')]:_0x1e0b1b['model'];if(!_0x29cb85[_0xcd66('0x31')][_0xcd66('0x38')](_0xcd66('0x39'))){_0x98cac6[_0xcd66('0x1f')]=qs[_0xcd66('0x1f')](_0x29cb85[_0xcd66('0x31')]['limit']);_0x98cac6[_0xcd66('0x1e')]=qs['offset'](_0x29cb85['query'][_0xcd66('0x1e')]);}_0x98cac6['order']=qs[_0xcd66('0x3a')](_0x29cb85['query'][_0xcd66('0x3a')]);_0x98cac6[_0xcd66('0x3b')]=qs[_0xcd66('0x32')](_[_0xcd66('0x3c')](_0x29cb85['query'],_0x1e0b1b['filters']),_0x1feb5e);if(_0x29cb85[_0xcd66('0x31')]['filter']){_0x98cac6[_0xcd66('0x3b')]=_[_0xcd66('0x3d')](_0x98cac6[_0xcd66('0x3b')],{'$or':_[_0xcd66('0x2b')](_0x1feb5e,function(_0x4b645f){if(_0x4b645f[_0xcd66('0x2f')]!==_0xcd66('0x3e')){var _0x7020ee={};_0x7020ee[_0x4b645f[_0xcd66('0x28')]]={'$like':'%'+_0x29cb85[_0xcd66('0x31')][_0xcd66('0x3f')]+'%'};return _0x7020ee;}})});}_0x98cac6=_[_0xcd66('0x3d')]({},_0x98cac6,_0x29cb85['options']);var _0x16e050={'where':_0x98cac6[_0xcd66('0x3b')]};return db[_0xcd66('0x2c')]['count'](_0x16e050)[_0xcd66('0x24')](function(_0x42c942){_0x3202d2[_0xcd66('0x1d')]=_0x42c942;if(_0x29cb85[_0xcd66('0x31')][_0xcd66('0x40')]){_0x98cac6[_0xcd66('0x41')]=[{'all':!![]}];}return db[_0xcd66('0x2c')][_0xcd66('0x42')](_0x98cac6);})[_0xcd66('0x24')](function(_0x32563c){_0x3202d2[_0xcd66('0x43')]=_0x32563c;return _0x3202d2;})[_0xcd66('0x24')](respondWithFilteredResult(_0x1ab052,_0x98cac6))[_0xcd66('0x44')](handleError(_0x1ab052,null));};exports[_0xcd66('0x45')]=function(_0x16c435,_0x236e12){var _0x27bcb6={'raw':!![],'where':{'id':_0x16c435[_0xcd66('0x46')]['id']}},_0x20e7c6={};_0x20e7c6['model']=_[_0xcd66('0x47')](db[_0xcd66('0x2c')][_0xcd66('0x2d')]);_0x20e7c6[_0xcd66('0x31')]=_['keys'](_0x16c435[_0xcd66('0x31')]);_0x20e7c6[_0xcd66('0x32')]=_[_0xcd66('0x33')](_0x20e7c6[_0xcd66('0x34')],_0x20e7c6[_0xcd66('0x31')]);_0x27bcb6[_0xcd66('0x36')]=_['intersection'](_0x20e7c6['model'],qs[_0xcd66('0x35')](_0x16c435['query']['fields']));_0x27bcb6[_0xcd66('0x36')]=_0x27bcb6[_0xcd66('0x36')][_0xcd66('0x37')]?_0x27bcb6[_0xcd66('0x36')]:_0x20e7c6['model'];if(_0x16c435[_0xcd66('0x31')][_0xcd66('0x40')]){_0x27bcb6[_0xcd66('0x41')]=[{'all':!![]}];}_0x27bcb6=_[_0xcd66('0x3d')]({},_0x27bcb6,_0x16c435[_0xcd66('0x48')]);return db['WhatsappApplication'][_0xcd66('0x49')](_0x27bcb6)[_0xcd66('0x24')](handleEntityNotFound(_0x236e12,null))[_0xcd66('0x24')](respondWithResult(_0x236e12,null))[_0xcd66('0x44')](handleError(_0x236e12,null));};exports[_0xcd66('0x4a')]=function(_0x2f823d,_0xf6041a){return db[_0xcd66('0x2c')]['create'](_0x2f823d['body'],{})[_0xcd66('0x24')](respondWithResult(_0xf6041a,0xc9))[_0xcd66('0x44')](handleError(_0xf6041a,null));};exports['update']=function(_0x2d9f70,_0x1fd7ca){if(_0x2d9f70[_0xcd66('0x4b')]['id']){delete _0x2d9f70[_0xcd66('0x4b')]['id'];}return db[_0xcd66('0x2c')][_0xcd66('0x49')]({'where':{'id':_0x2d9f70[_0xcd66('0x46')]['id']}})[_0xcd66('0x24')](handleEntityNotFound(_0x1fd7ca,null))[_0xcd66('0x24')](saveUpdates(_0x2d9f70[_0xcd66('0x4b')],null))['then'](respondWithResult(_0x1fd7ca,null))[_0xcd66('0x44')](handleError(_0x1fd7ca,null));};exports['destroy']=function(_0x793719,_0x4d1449){return db[_0xcd66('0x2c')][_0xcd66('0x49')]({'where':{'id':_0x793719[_0xcd66('0x46')]['id']}})[_0xcd66('0x24')](handleEntityNotFound(_0x4d1449,null))[_0xcd66('0x24')](removeEntity(_0x4d1449,null))[_0xcd66('0x44')](handleError(_0x4d1449,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 96171e3..c058b6f 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 _0x76a5=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird'];(function(_0x1a8b2d,_0x3e430a){var _0x64034a=function(_0xbff193){while(--_0xbff193){_0x1a8b2d['push'](_0x1a8b2d['shift']());}};_0x64034a(++_0x3e430a);}(_0x76a5,0xf2));var _0x576a=function(_0x8567ae,_0x118fcf){_0x8567ae=_0x8567ae-0x0;var _0x2f9e9b=_0x76a5[_0x8567ae];return _0x2f9e9b;};'use strict';var _=require('lodash');var util=require(_0x576a('0x0'));var logger=require(_0x576a('0x1'))(_0x576a('0x2'));var moment=require(_0x576a('0x3'));var BPromise=require(_0x576a('0x4'));var rp=require(_0x576a('0x5'));var fs=require('fs');var path=require(_0x576a('0x6'));var rimraf=require(_0x576a('0x7'));var config=require(_0x576a('0x8'));var attributes=require(_0x576a('0x9'));module['exports']=function(_0x44eeeb,_0x22f8bc){return _0x44eeeb['define']('WhatsappApplication',attributes,{'tableName':_0x576a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x576a('0xb'),'collate':_0x576a('0xc')});}; \ No newline at end of file +var _0xb1b4=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','rimraf'];(function(_0x2d4926,_0x43a525){var _0x274c34=function(_0x21db2c){while(--_0x21db2c){_0x2d4926['push'](_0x2d4926['shift']());}};_0x274c34(++_0x43a525);}(_0xb1b4,0xc7));var _0x4b1b=function(_0x4c836d,_0x144891){_0x4c836d=_0x4c836d-0x0;var _0x299319=_0xb1b4[_0x4c836d];return _0x299319;};'use strict';var _=require('lodash');var util=require(_0x4b1b('0x0'));var logger=require('../../config/logger')(_0x4b1b('0x1'));var moment=require(_0x4b1b('0x2'));var BPromise=require(_0x4b1b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4b1b('0x4'));var config=require('../../config/environment');var attributes=require(_0x4b1b('0x5'));module[_0x4b1b('0x6')]=function(_0x55fa70,_0x2967e3){return _0x55fa70[_0x4b1b('0x7')](_0x4b1b('0x8'),attributes,{'tableName':_0x4b1b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4b1b('0xa'),'collate':_0x4b1b('0xb')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 015c8ed..30206ee 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 _0xc359=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xc359,0x1d9));var _0x9c35=function(_0x30cd7e,_0x4db10a){_0x30cd7e=_0x30cd7e-0x0;var _0x462a02=_0xc359[_0x30cd7e];return _0x462a02;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var moment=require('moment');var BPromise=require(_0x9c35('0x1'));var rs=require(_0x9c35('0x2'));var fs=require('fs');var Redis=require(_0x9c35('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c35('0x4'));var logger=require('../../config/logger')(_0x9c35('0x5'));var config=require('../../config/environment');var jayson=require(_0x9c35('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53d9d7,_0x4b61d6,_0x279ba9){return new BPromise(function(_0x2993da,_0x1ab745){return client[_0x9c35('0x7')](_0x53d9d7,_0x279ba9)[_0x9c35('0x8')](function(_0x2efae8){logger['info'](_0x9c35('0x9'),_0x4b61d6,_0x9c35('0xa'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4b61d6,'request\x20sent',JSON[_0x9c35('0xb')](_0x2efae8));if(_0x2efae8['error']){if(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xd')]===0x1f4){logger[_0x9c35('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x4b61d6,_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);return _0x1ab745(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);}logger[_0x9c35('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x4b61d6,_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);return _0x2993da(_0x2efae8[_0x9c35('0xc')][_0x9c35('0xe')]);}else{logger[_0x9c35('0xf')](_0x9c35('0x9'),_0x4b61d6,_0x9c35('0xa'));_0x2993da(_0x2efae8[_0x9c35('0x10')][_0x9c35('0xe')]);}})[_0x9c35('0x11')](function(_0x387dd7){logger[_0x9c35('0xc')](_0x9c35('0x9'),_0x4b61d6,_0x387dd7);_0x1ab745(_0x387dd7);});});} \ No newline at end of file +var _0x78d3=['../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x24a88a,_0x2dbf04){var _0x2985c6=function(_0x9aa72c){while(--_0x9aa72c){_0x24a88a['push'](_0x24a88a['shift']());}};_0x2985c6(++_0x2dbf04);}(_0x78d3,0x73));var _0x378d=function(_0x2d79eb,_0x3847c0){_0x2d79eb=_0x2d79eb-0x0;var _0x44ee4d=_0x78d3[_0x2d79eb];return _0x44ee4d;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var moment=require(_0x378d('0x2'));var BPromise=require(_0x378d('0x3'));var rs=require(_0x378d('0x4'));var fs=require('fs');var Redis=require(_0x378d('0x5'));var db=require(_0x378d('0x6'))['db'];var utils=require(_0x378d('0x7'));var logger=require(_0x378d('0x8'))(_0x378d('0x9'));var config=require(_0x378d('0xa'));var jayson=require(_0x378d('0xb'));var client=jayson[_0x378d('0xc')][_0x378d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x47a99f,_0x4fef30,_0x1c880e){return new BPromise(function(_0x4b3ef5,_0x14112d){return client[_0x378d('0xe')](_0x47a99f,_0x1c880e)[_0x378d('0xf')](function(_0x4698d9){logger[_0x378d('0x10')](_0x378d('0x11'),_0x4fef30,'request\x20sent');logger[_0x378d('0x12')](_0x378d('0x13'),_0x4fef30,_0x378d('0x14'),JSON['stringify'](_0x4698d9));if(_0x4698d9[_0x378d('0x15')]){if(_0x4698d9['error']['code']===0x1f4){logger[_0x378d('0x15')](_0x378d('0x11'),_0x4fef30,_0x4698d9['error'][_0x378d('0x16')]);return _0x14112d(_0x4698d9[_0x378d('0x15')][_0x378d('0x16')]);}logger['error'](_0x378d('0x11'),_0x4fef30,_0x4698d9['error'][_0x378d('0x16')]);return _0x4b3ef5(_0x4698d9[_0x378d('0x15')][_0x378d('0x16')]);}else{logger[_0x378d('0x10')](_0x378d('0x11'),_0x4fef30,'request\x20sent');_0x4b3ef5(_0x4698d9[_0x378d('0x17')]['message']);}})[_0x378d('0x18')](function(_0x1602f9){logger[_0x378d('0x15')](_0x378d('0x11'),_0x4fef30,_0x1602f9);_0x14112d(_0x1602f9);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index fe451d8..bd9eb93 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 _0x7221=['index','/describe','/:id','/:id/messages','/:id/download','create','post','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x7221,0x169));var _0x1722=function(_0x19b3ca,_0x24eb4a){_0x19b3ca=_0x19b3ca-0x0;var _0x123837=_0x7221[_0x19b3ca];return _0x123837;};'use strict';var multer=require(_0x1722('0x0'));var util=require(_0x1722('0x1'));var path=require('path');var timeout=require(_0x1722('0x2'));var express=require(_0x1722('0x3'));var router=express[_0x1722('0x4')]();var auth=require(_0x1722('0x5'));var interaction=require(_0x1722('0x6'));var config=require(_0x1722('0x7'));var controller=require(_0x1722('0x8'));router[_0x1722('0x9')]('/',auth[_0x1722('0xa')](),controller[_0x1722('0xb')]);router[_0x1722('0x9')](_0x1722('0xc'),auth[_0x1722('0xa')](),controller['describe']);router[_0x1722('0x9')](_0x1722('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x1722('0x9')](_0x1722('0xe'),auth['isAuthenticated'](),controller['getMessages']);router[_0x1722('0x9')](_0x1722('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x1722('0xa')](),controller[_0x1722('0x10')]);router[_0x1722('0x11')](_0x1722('0xe'),auth[_0x1722('0xa')](),controller['addMessage']);router[_0x1722('0x11')](_0x1722('0x12'),auth['isAuthenticated'](),interaction[_0x1722('0x13')](_0x1722('0x14'),_0x1722('0x15')),controller[_0x1722('0x16')]);router[_0x1722('0x17')](_0x1722('0xd'),auth[_0x1722('0xa')](),interaction[_0x1722('0x13')]('whatsapp',_0x1722('0x18')),controller[_0x1722('0x19')]);router[_0x1722('0x1a')](_0x1722('0xd'),auth[_0x1722('0xa')](),interaction[_0x1722('0x13')](_0x1722('0x14'),_0x1722('0x1b')),controller[_0x1722('0x1c')]);router[_0x1722('0x1a')](_0x1722('0x12'),auth[_0x1722('0xa')](),controller[_0x1722('0x1d')]);module[_0x1722('0x1e')]=router; \ No newline at end of file +var _0x808e=['whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x808e,0x126));var _0xe808=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x808e[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0xe808('0x0'));var util=require(_0xe808('0x1'));var path=require('path');var timeout=require(_0xe808('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xe808('0x3'));var interaction=require(_0xe808('0x4'));var config=require(_0xe808('0x5'));var controller=require(_0xe808('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe808('0x7')]);router[_0xe808('0x8')](_0xe808('0x9'),auth[_0xe808('0xa')](),controller[_0xe808('0xb')]);router['get'](_0xe808('0xc'),auth[_0xe808('0xa')](),controller[_0xe808('0xd')]);router[_0xe808('0x8')]('/:id/messages',auth[_0xe808('0xa')](),controller[_0xe808('0xe')]);router[_0xe808('0x8')](_0xe808('0xf'),auth[_0xe808('0xa')](),controller[_0xe808('0x10')]);router[_0xe808('0x11')]('/',auth[_0xe808('0xa')](),controller[_0xe808('0x12')]);router[_0xe808('0x11')](_0xe808('0x13'),auth[_0xe808('0xa')](),controller[_0xe808('0x14')]);router['post'](_0xe808('0x15'),auth['isAuthenticated'](),interaction[_0xe808('0x16')](_0xe808('0x17'),_0xe808('0x18')),controller[_0xe808('0x19')]);router['put']('/:id',auth[_0xe808('0xa')](),interaction[_0xe808('0x16')](_0xe808('0x17'),_0xe808('0x1a')),controller[_0xe808('0x1b')]);router[_0xe808('0x1c')](_0xe808('0xc'),auth[_0xe808('0xa')](),interaction['tracked'](_0xe808('0x17'),'whatsappinteraction:destroy'),controller[_0xe808('0x1d')]);router[_0xe808('0x1c')]('/:id/tags',auth[_0xe808('0xa')](),controller[_0xe808('0x1e')]);module[_0xe808('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 2f91191..25ca6bf 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 _0xbff2=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0xba96dc,_0x4d0e71){var _0xcd445=function(_0x450288){while(--_0x450288){_0xba96dc['push'](_0xba96dc['shift']());}};_0xcd445(++_0x4d0e71);}(_0xbff2,0x10e));var _0x2bff=function(_0x136b35,_0x53bd41){_0x136b35=_0x136b35-0x0;var _0x366227=_0xbff2[_0x136b35];return _0x366227;};'use strict';var Sequelize=require(_0x2bff('0x0'));var moment=require(_0x2bff('0x1'));module[_0x2bff('0x2')]={'closed':{'type':Sequelize[_0x2bff('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2bff('0x4')]},'disposition':{'type':Sequelize[_0x2bff('0x5')]},'secondDisposition':{'type':Sequelize[_0x2bff('0x5')]},'thirdDisposition':{'type':Sequelize[_0x2bff('0x5')]},'note':{'type':Sequelize[_0x2bff('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2bff('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2bff('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2bff('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x95af=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x19ad7b,_0x2ae8fa){var _0x8a0f00=function(_0x56781d){while(--_0x56781d){_0x19ad7b['push'](_0x19ad7b['shift']());}};_0x8a0f00(++_0x2ae8fa);}(_0x95af,0x173));var _0xf95a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x95af[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xf95a('0x0'));var moment=require(_0xf95a('0x1'));module['exports']={'closed':{'type':Sequelize[_0xf95a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf95a('0x3')]},'disposition':{'type':Sequelize[_0xf95a('0x4')]},'secondDisposition':{'type':Sequelize[_0xf95a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xf95a('0x4')]},'note':{'type':Sequelize[_0xf95a('0x4')]},'phone':{'type':Sequelize[_0xf95a('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf95a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf95a('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf95a('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b51e093..10ce96f 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 _0xb069=['downloadInteraction.html','toFile','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','stack','name','Users','fullname','TagIds','Tags','forEach','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','compact','isEmpty','WhatsappAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','contactName','DESC','t.id\x20IN\x20?','resolve','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','push','all','show','includeAll','include','catch','create','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Whatsapp','YYYY-MM-DD','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','System','out','renderFile','views'];(function(_0x561a62,_0x36bcbf){var _0x106b48=function(_0x1d2e6d){while(--_0x1d2e6d){_0x561a62['push'](_0x561a62['shift']());}};_0x106b48(++_0x36bcbf);}(_0xb069,0x1e7));var _0x9b06=function(_0x471d79,_0x1ef782){_0x471d79=_0x471d79-0x0;var _0x103442=_0xb069[_0x471d79];return _0x103442;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9b06('0x0'));var zipdir=require(_0x9b06('0x1'));var jsonpatch=require(_0x9b06('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9b06('0x3'));var Mustache=require(_0x9b06('0x4'));var util=require(_0x9b06('0x5'));var path=require(_0x9b06('0x6'));var sox=require('sox');var csv=require(_0x9b06('0x7'));var ejs=require(_0x9b06('0x8'));var fs=require('fs');var _=require(_0x9b06('0x9'));var squel=require('squel');var crypto=require(_0x9b06('0xa'));var jsforce=require(_0x9b06('0xb'));var deskjs=require(_0x9b06('0xc'));var toCsv=require(_0x9b06('0x7'));var querystring=require(_0x9b06('0xd'));var Papa=require(_0x9b06('0xe'));var Redis=require(_0x9b06('0xf'));var authService=require(_0x9b06('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9b06('0x11'));var hardwareService=require(_0x9b06('0x12'));var logger=require(_0x9b06('0x13'))('api');var utils=require(_0x9b06('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9b06('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9b06('0x16')](config['redis'],{'host':_0x9b06('0x17'),'port':0x18eb});var socket=require(_0x9b06('0x18'))(new Redis(config[_0x9b06('0x19')]));require(_0x9b06('0x1a'))[_0x9b06('0x1b')](socket);function respondWithStatusCode(_0x3b3c20,_0x3d31ae){_0x3d31ae=_0x3d31ae||0xcc;return function(_0xc3e53e){if(_0xc3e53e){return _0x3b3c20[_0x9b06('0x1c')](_0x3d31ae);}return _0x3b3c20[_0x9b06('0x1d')](_0x3d31ae)[_0x9b06('0x1e')]();};}function respondWithResult(_0x167063,_0x18e571){_0x18e571=_0x18e571||0xc8;return function(_0x42a741){if(_0x42a741){return _0x167063[_0x9b06('0x1d')](_0x18e571)['json'](_0x42a741);}};}function respondWithFilteredResult(_0x4ec199,_0x211f5d){return function(_0x358aaa){if(_0x358aaa){var _0x18174f=_0x358aaa[_0x9b06('0x1f')],_0x23a17a=_0x211f5d[_0x9b06('0x20')],_0x5f0dd4=_0x211f5d['offset']+_0x211f5d[_0x9b06('0x21')],_0xf4520e;if(_0x5f0dd4>=_0x18174f){_0x5f0dd4=_0x18174f;_0xf4520e=0xc8;}else{_0xf4520e=0xce;}_0x4ec199['status'](_0xf4520e);return _0x4ec199[_0x9b06('0x22')]('Content-Range',_0x23a17a+'-'+_0x5f0dd4+'/'+_0x18174f)[_0x9b06('0x23')](_0x358aaa);}return null;};}function patchUpdates(_0x38b471){return function(_0x2f4992){try{jsonpatch[_0x9b06('0x24')](_0x2f4992,_0x38b471,!![]);}catch(_0x4ffc32){return BPromise[_0x9b06('0x25')](_0x4ffc32);}return _0x2f4992[_0x9b06('0x26')]();};}function saveUpdates(_0x13774a,_0x12db7c){return function(_0x2d1752){if(_0x2d1752){return _0x2d1752[_0x9b06('0x27')](_0x13774a)[_0x9b06('0x28')](function(_0x4ee8f9){return _0x4ee8f9;});}return null;};}function removeEntity(_0x293175,_0x3dcf3b){return function(_0x133903){if(_0x133903){return _0x133903[_0x9b06('0x29')]()[_0x9b06('0x28')](function(){_0x293175[_0x9b06('0x1d')](0xcc)[_0x9b06('0x1e')]();});}};}function handleEntityNotFound(_0x4a7ff5,_0x13560b){return function(_0x13ddb3){if(!_0x13ddb3){_0x4a7ff5[_0x9b06('0x1c')](0x194);}return _0x13ddb3;};}function handleError(_0x3ee4ef,_0x12f321){_0x12f321=_0x12f321||0x1f4;return function(_0x25ba3f){logger['error'](_0x25ba3f[_0x9b06('0x2a')]);if(_0x25ba3f['name']){delete _0x25ba3f[_0x9b06('0x2b')];}_0x3ee4ef[_0x9b06('0x1d')](_0x12f321)['send'](_0x25ba3f);};}function getInteractionUsers(_0x5e5c17,_0x439c59){return new BPromise(function(_0x1aeca9,_0x47a80f){try{if(_0x439c59[_0x5e5c17['id']]){_0x5e5c17[_0x9b06('0x2c')]=_['map'](_0x439c59[_0x5e5c17['id']],function(_0x581bd3){return{'id':_0x581bd3['id'],'fullname':_0x581bd3[_0x9b06('0x2d')]};});}}catch(_0xea4484){_0x47a80f(_0xea4484);}_0x1aeca9(_0x5e5c17);});}function getInteractionTags(_0x14d510,_0xbb1b39){return new BPromise(function(_0x1ae67c,_0x4fb05a){try{if(_0x14d510[_0x9b06('0x2e')]){_0x14d510[_0x9b06('0x2f')]=[];_0x14d510[_0x9b06('0x2e')]['split'](',')[_0x9b06('0x30')](function(_0x5cc245){_0x14d510[_0x9b06('0x2f')]['push'](_0xbb1b39[_0x5cc245]);});}delete _0x14d510[_0x9b06('0x2e')];}catch(_0x5ea7f0){_0x4fb05a(_0x5ea7f0);}_0x1ae67c(_0x14d510);});}function updateWhatsappInteraction(_0x33fec6,_0x50b8e1,_0x4eca04){return new BPromise(function(_0x2b53a1,_0x32e73f){return getInteractionUsers(_0x33fec6,_0x4eca04)[_0x9b06('0x28')](function(_0x5225be){return getInteractionTags(_0x5225be,_0x50b8e1);})[_0x9b06('0x28')](function(_0x2e1df0){_0x2b53a1(_0x2e1df0);})['catch'](function(_0x38021b){_0x32e73f(_0x38021b);});});}exports[_0x9b06('0x31')]=function(_0x181cd9,_0xe2f520){var _0x1068b0={},_0x32659f={},_0x17790c={'count':0x0,'rows':[]};var _0x29a42c=_[_0x9b06('0x32')](db[_0x9b06('0x33')][_0x9b06('0x34')],function(_0x4f7d23){return{'name':_0x4f7d23[_0x9b06('0x35')],'type':_0x4f7d23[_0x9b06('0x36')][_0x9b06('0x37')]};});_0x32659f[_0x9b06('0x38')]=_['map'](_0x29a42c,'name');_0x32659f['query']=_[_0x9b06('0x39')](_0x181cd9[_0x9b06('0x3a')]);_0x32659f[_0x9b06('0x3b')]=_['intersection'](_0x32659f[_0x9b06('0x38')],_0x32659f['query']);_0x1068b0['attributes']=_[_0x9b06('0x3c')](_0x32659f[_0x9b06('0x38')],qs[_0x9b06('0x3d')](_0x181cd9[_0x9b06('0x3a')][_0x9b06('0x3d')]));_0x1068b0[_0x9b06('0x3e')]=_0x1068b0[_0x9b06('0x3e')][_0x9b06('0x3f')]?_0x1068b0['attributes']:_0x32659f[_0x9b06('0x38')];if(!_0x181cd9[_0x9b06('0x3a')]['hasOwnProperty'](_0x9b06('0x40'))){_0x1068b0['limit']=qs[_0x9b06('0x21')](_0x181cd9[_0x9b06('0x3a')]['limit']);_0x1068b0[_0x9b06('0x20')]=qs['offset'](_0x181cd9[_0x9b06('0x3a')][_0x9b06('0x20')]);}_0x1068b0[_0x9b06('0x41')]=qs[_0x9b06('0x42')](_0x181cd9[_0x9b06('0x3a')][_0x9b06('0x42')]);_0x1068b0[_0x9b06('0x43')]=qs['filters'](_[_0x9b06('0x44')](_0x181cd9[_0x9b06('0x3a')],_0x32659f['filters']),_0x29a42c);var _0x1427a0=[];var _0x1f1f51=squel[_0x9b06('0x45')]()[_0x9b06('0x46')]('id')[_0x9b06('0x46')](_0x9b06('0x2b'))[_0x9b06('0x46')](_0x9b06('0x47'))[_0x9b06('0x48')](_0x9b06('0x49'));var _0x3da1ea=squel['select']()['field'](_0x9b06('0x4a'))[_0x9b06('0x46')](_0x9b06('0x4b'))[_0x9b06('0x46')](_0x9b06('0x4c'))[_0x9b06('0x48')](_0x9b06('0x4d'),'ui')[_0x9b06('0x4e')](_0x9b06('0x4f'),'u',_0x9b06('0x50'));var _0x46ee82=squel['select']()[_0x9b06('0x48')](_0x9b06('0x51'),'i')[_0x9b06('0x4e')](_0x9b06('0x52'),'c',_0x9b06('0x53'))['left_join'](_0x9b06('0x4f'),'o',_0x9b06('0x54'))[_0x9b06('0x4e')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x9b06('0x4e')](_0x9b06('0x55'),'me',_0x9b06('0x56'))[_0x9b06('0x4e')](_0x9b06('0x57'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x9b06('0x4e')](_0x9b06('0x49'),'t','t.id\x20=\x20it.TagId');var _0x5cefce=squel[_0x9b06('0x58')]();var _0x207021=[];var _0x1c955c=squel[_0x9b06('0x58')]();var _0x1cc94d;if(_0x181cd9[_0x9b06('0x3a')]['search']){_0x1cc94d=as[_0x9b06('0x59')](_0x181cd9['query']['search']);var _0x258cd0=_0x1cc94d[_0x9b06('0x5a')];for(var _0x1104bd=0x0;_0x1104bd<_0x1cc94d[_0x9b06('0x5b')][_0x9b06('0x3f')];_0x1104bd++){var _0x4506f9=_0x1cc94d['conditions'][_0x1104bd];var _0x1f2610='i';var _0x45832a=_[_0x9b06('0x5c')](_0x29a42c,[_0x9b06('0x2b'),_0x4506f9['field']]);if(!_0x45832a){switch(_0x4506f9[_0x9b06('0x46')]){case _0x9b06('0x5d'):if(_0x4506f9[_0x9b06('0x5e')]==0x1){_0x46ee82[_0x9b06('0x5f')]('`'+_0x4506f9[_0x9b06('0x46')]+_0x9b06('0x60'));}else{_0x46ee82[_0x9b06('0x5f')]('`'+_0x4506f9[_0x9b06('0x46')]+_0x9b06('0x61'));}break;case _0x9b06('0x62'):if(_0x4506f9[_0x9b06('0x63')]==='$substring'){if(_0x4506f9['value'][_0x9b06('0x64')]('\x20')['length']>0x1){_0x5cefce[_0x258cd0](_0x9b06('0x65'),qs[_0x9b06('0x66')](_0x4506f9[_0x9b06('0x5e')]),null);}else{var _0x3088b9='%'+_0x4506f9[_0x9b06('0x5e')]+'%';_0x5cefce[_0x258cd0]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3088b9,_0x3088b9,_0x3088b9);}}else{_0x45832a=_[_0x9b06('0x5c')](_0x29a42c,[_0x9b06('0x2b'),_0x9b06('0x67')]);_0x4506f9[_0x9b06('0x46')]=_0x9b06('0x67');_0x10f90b=as['buildExpression'](_0x1f2610,_0x45832a[_0x9b06('0x36')],_0x4506f9);_0x5cefce[_0x258cd0](_0x10f90b[_0x9b06('0x68')],_0x10f90b['value'][_0x9b06('0x69')],_0x10f90b[_0x9b06('0x5e')][_0x9b06('0x1e')]);}break;case _0x9b06('0x6a'):var _0x1abbb4=_0x4506f9[_0x9b06('0x5e')][_0x9b06('0x64')](',')[_0x9b06('0x32')](function(_0xfee605){return Number(_0xfee605);});_0x1abbb4[_0x9b06('0x30')](function(_0x2590ea){_0x1c955c['or'](_0x9b06('0x6b'),'%,'+_0x2590ea+',%');});_0x207021=_['union'](_0x207021,_0x1abbb4);break;case _0x9b06('0x6c'):if(_0x4506f9[_0x9b06('0x63')]===_0x9b06('0x6d')){_0x5cefce[_0x258cd0](_0x9b06('0x6e'),'%'+_0x4506f9['value']+'%',null);}else{_0x45832a=_[_0x9b06('0x5c')](_0x29a42c,[_0x9b06('0x2b'),'UserId']);_0x4506f9['field']=_0x9b06('0x6f');_0x10f90b=as[_0x9b06('0x70')](_0x1f2610,_0x45832a[_0x9b06('0x36')],_0x4506f9);_0x5cefce[_0x258cd0](_0x10f90b[_0x9b06('0x68')],_0x10f90b[_0x9b06('0x5e')][_0x9b06('0x69')],_0x10f90b['value'][_0x9b06('0x1e')]);}break;case _0x9b06('0x71'):_0x10f90b=as[_0x9b06('0x70')]('me',null,_0x4506f9);_0x5cefce[_0x258cd0](_0x10f90b[_0x9b06('0x68')],_0x10f90b[_0x9b06('0x5e')][_0x9b06('0x69')],_0x10f90b['value'][_0x9b06('0x1e')]);break;}}else{var _0x10f90b=as['buildExpression'](_0x1f2610,_0x45832a[_0x9b06('0x36')],_0x4506f9);_0x5cefce[_0x258cd0](_0x10f90b[_0x9b06('0x68')],_0x10f90b[_0x9b06('0x5e')][_0x9b06('0x69')],_0x10f90b[_0x9b06('0x5e')][_0x9b06('0x1e')]);}}}else{var _0x2ec71a=_(_0x181cd9[_0x9b06('0x3a')])[_0x9b06('0x39')]()['map'](function(_0x1f6af0){return _['some'](_0x29a42c,[_0x9b06('0x2b'),_0x1f6af0])?_0x1f6af0:undefined;})[_0x9b06('0x72')]()[_0x9b06('0x5e')]();if(!_[_0x9b06('0x73')](_0x2ec71a)){_0x2ec71a['forEach'](function(_0x3926b4){if(_0x3926b4===_0x9b06('0x74')){_0x46ee82[_0x9b06('0x43')]('i.WhatsappAccountId\x20IN\x20?',[][_0x9b06('0x75')](_0x181cd9[_0x9b06('0x3a')][_0x3926b4]));}else if(_0x3926b4===_0x9b06('0x76')){var _0x3f88ac=JSON['parse'](_0x181cd9[_0x9b06('0x3a')][_0x3926b4])[_0x9b06('0x77')];var _0x34c689=JSON[_0x9b06('0x78')](_0x181cd9['query'][_0x3926b4])[_0x9b06('0x79')];_0x46ee82[_0x9b06('0x43')](_0x9b06('0x7a'),_0x3f88ac,_0x34c689);}else{if(_0x181cd9[_0x9b06('0x3a')][_0x3926b4]===_0x9b06('0x7b')){_0x46ee82[_0x9b06('0x43')]('i.'+_0x3926b4+_0x9b06('0x7c'));}else{_0x46ee82['where']('i.'+_0x3926b4+_0x9b06('0x7d'),_0x181cd9[_0x9b06('0x3a')][_0x3926b4]);}}});}if(_0x181cd9['query'][_0x9b06('0x7e')]){if(_0x181cd9['query']['read']==0x1){_0x46ee82[_0x9b06('0x5f')](_0x9b06('0x7f'));}else{_0x46ee82[_0x9b06('0x5f')](_0x9b06('0x80'));}}if(_0x181cd9['query'][_0x9b06('0x81')]){_0x207021=_['isArray'](_0x181cd9[_0x9b06('0x3a')]['tag'])?_0x181cd9['query'][_0x9b06('0x81')]:new Array(_0x181cd9[_0x9b06('0x3a')][_0x9b06('0x81')]);_0x207021[_0x9b06('0x30')](function(_0x1a42fb){_0x1c955c['or'](_0x9b06('0x6b'),'%,'+_0x1a42fb+',%');});}if(_0x181cd9[_0x9b06('0x3a')][_0x9b06('0x82')]){var _0x4f59cf=_0x181cd9[_0x9b06('0x3a')][_0x9b06('0x82')][_0x9b06('0x83')]('\x5c','\x5c\x5c')[_0x9b06('0x83')](/'/g,'\x27\x27');if(qs[_0x9b06('0x84')](_0x4f59cf)){_0x5cefce['or']('i.id\x20LIKE\x20?',_0x4f59cf+'%')['or'](_0x9b06('0x85'),_0x4f59cf+'%');}else{_0x5cefce['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9b06('0x66')](_0x4f59cf))['or'](_0x9b06('0x86'),_0x4f59cf+'%');}}}_0x46ee82['where'](_0x5cefce);_0x46ee82[_0x9b06('0x87')](_0x9b06('0x88'));var _0x826956={'type':db[_0x9b06('0x89')][_0x9b06('0x8a')][_0x9b06('0x8b')],'raw':!![]};var _0x398988=_0x46ee82['clone']();_0x398988[_0x9b06('0x46')](_0x9b06('0x88'));_0x398988[_0x9b06('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9b06('0x5d'));if(_0x1068b0[_0x9b06('0x41')]){_0x1068b0['order'][_0x9b06('0x30')](function(_0x2d1558){var _0x2c14e8=_0x2d1558[0x0]===_0x9b06('0x8c')?_0x2d1558[0x0]:'i.'+_0x2d1558[0x0];_0x46ee82[_0x9b06('0x41')](_0x2c14e8,_0x2d1558[0x1]===_0x9b06('0x8d')?![]:!![]);});}if(!_[_0x9b06('0x73')](_0x207021)){_0x46ee82[_0x9b06('0x5f')](_0x1c955c);_0x398988['where'](_0x9b06('0x8e'),_0x207021);}BPromise[_0x9b06('0x8f')]()['then'](function(){if(!_0x1cc94d){if(_0x181cd9[_0x9b06('0x3a')][_0x9b06('0x74')]||_0x181cd9[_0x9b06('0x3a')][_0x9b06('0x90')])return;_0x398988[_0x9b06('0x43')](_0x9b06('0x91'));_0x46ee82[_0x9b06('0x43')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x181cd9[_0x9b06('0x92')][_0x9b06('0x93')]!==_0x9b06('0x94'))return;return _0x181cd9['user']['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x9b06('0x28')](function(_0x2053c7){if(_[_0x9b06('0x73')](_0x2053c7)){_0x398988[_0x9b06('0x43')](_0x9b06('0x95'));_0x46ee82[_0x9b06('0x43')](_0x9b06('0x95'));}else{_0x398988[_0x9b06('0x43')]('i.WhatsappAccountId\x20IN\x20?',_[_0x9b06('0x32')](_0x2053c7,'id'));_0x46ee82['where'](_0x9b06('0x96'),_['map'](_0x2053c7,'id'));}});})[_0x9b06('0x28')](function(){if(_0x181cd9[_0x9b06('0x92')]['role']===_0x9b06('0x94')&&!_0x1cc94d&&!_0x181cd9[_0x9b06('0x3a')][_0x9b06('0x74')])return[];return db[_0x9b06('0x97')][_0x9b06('0x3a')](_0x398988[_0x9b06('0x98')](),_0x826956);})[_0x9b06('0x28')](function(_0x518da9){_0x17790c[_0x9b06('0x1f')]=_0x518da9[_0x9b06('0x3f')];if(_0x17790c[_0x9b06('0x1f')]===0x0)return[];return db[_0x9b06('0x97')][_0x9b06('0x3a')](_0x1f1f51[_0x9b06('0x98')](),_0x826956)[_0x9b06('0x28')](function(_0x46d4d7){_0x1427a0=_['keyBy'](_0x46d4d7,'id');_0x826956=_[_0x9b06('0x99')](_0x826956,{'model':db[_0x9b06('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x181cd9[_0x9b06('0x3a')]['fields']){_0x1068b0[_0x9b06('0x3e')][_0x9b06('0x30')](function(_0x5acb7d){_0x46ee82[_0x9b06('0x46')]('i.'+_0x5acb7d);});}else{_0x46ee82[_0x9b06('0x46')](_0x9b06('0x9a'),'unreadMessages');_0x46ee82[_0x9b06('0x46')]('a.key',_0x9b06('0x9b'));_0x46ee82[_0x9b06('0x46')](_0x9b06('0x9c'),'Account.mandatoryDisposition');_0x46ee82[_0x9b06('0x46')](_0x9b06('0x9d'),_0x9b06('0x8c'));_0x46ee82[_0x9b06('0x46')]('i.*');_0x46ee82[_0x9b06('0x46')](_0x9b06('0x9e'),_0x9b06('0x9f'));_0x46ee82[_0x9b06('0x46')](_0x9b06('0xa0'),_0x9b06('0xa1'));_0x46ee82[_0x9b06('0x46')](_0x9b06('0xa2'),_0x9b06('0xa3'));_0x46ee82[_0x9b06('0x46')](_0x9b06('0xa4'),_0x9b06('0xa5'));_0x46ee82['field'](_0x9b06('0xa6'),_0x9b06('0xa7'));_0x46ee82[_0x9b06('0x46')](_0x9b06('0xa8'),'Contact.fax');_0x46ee82[_0x9b06('0x46')](_0x9b06('0xa9'),_0x9b06('0xaa'));_0x46ee82[_0x9b06('0x46')]('o.internal',_0x9b06('0xab'));_0x46ee82[_0x9b06('0x46')](_0x9b06('0xac'),'TagIds');}if(_0x1068b0[_0x9b06('0x21')])_0x46ee82[_0x9b06('0x21')](_0x1068b0[_0x9b06('0x21')]);if(_0x1068b0[_0x9b06('0x20')])_0x46ee82[_0x9b06('0x20')](_0x1068b0[_0x9b06('0x20')]);return db[_0x9b06('0x97')][_0x9b06('0x3a')](_0x46ee82[_0x9b06('0x98')](),_0x826956);})[_0x9b06('0x28')](function(_0x4a3ce7){_0x3da1ea[_0x9b06('0x43')](_0x9b06('0xad'),_[_0x9b06('0x32')](_0x4a3ce7,'id'));return db['sequelize'][_0x9b06('0x3a')](_0x3da1ea[_0x9b06('0x98')](),_0x826956)[_0x9b06('0x28')](function(_0x34bc67){var _0x41415a=_['groupBy'](_0x34bc67,_0x9b06('0xae'));var _0x56bbfd=[];_0x4a3ce7[_0x9b06('0x30')](function(_0x189c17){_0x56bbfd[_0x9b06('0xaf')](updateWhatsappInteraction(_0x189c17,_0x1427a0,_0x41415a));});return BPromise[_0x9b06('0xb0')](_0x56bbfd);});});})['then'](function(_0x137812){_0x17790c['rows']=_0x137812;return _0x17790c;})[_0x9b06('0x28')](respondWithFilteredResult(_0xe2f520,_0x1068b0))['catch'](handleError(_0xe2f520,null));};exports[_0x9b06('0xb1')]=function(_0x51307b,_0x460c9f){var _0x57e53f={'raw':![],'where':{'id':_0x51307b['params']['id']}},_0x4bf55a={};_0x4bf55a[_0x9b06('0x38')]=_['keys'](db[_0x9b06('0x33')]['rawAttributes']);_0x4bf55a[_0x9b06('0x3a')]=_[_0x9b06('0x39')](_0x51307b['query']);_0x4bf55a[_0x9b06('0x3b')]=_[_0x9b06('0x3c')](_0x4bf55a[_0x9b06('0x38')],_0x4bf55a[_0x9b06('0x3a')]);_0x57e53f[_0x9b06('0x3e')]=_[_0x9b06('0x3c')](_0x4bf55a[_0x9b06('0x38')],qs[_0x9b06('0x3d')](_0x51307b[_0x9b06('0x3a')][_0x9b06('0x3d')]));_0x57e53f[_0x9b06('0x3e')]=_0x57e53f['attributes'][_0x9b06('0x3f')]?_0x57e53f['attributes']:_0x4bf55a['model'];if(_0x51307b[_0x9b06('0x3a')][_0x9b06('0xb2')]){_0x57e53f[_0x9b06('0xb3')]=[{'all':!![]}];}_0x57e53f=_[_0x9b06('0x99')]({},_0x57e53f,_0x51307b['options']);return db[_0x9b06('0x33')][_0x9b06('0x5c')](_0x57e53f)[_0x9b06('0x28')](handleEntityNotFound(_0x460c9f,null))[_0x9b06('0x28')](respondWithResult(_0x460c9f,null))[_0x9b06('0xb4')](handleError(_0x460c9f,null));};exports[_0x9b06('0xb5')]=function(_0x40e636,_0x557f1c){return db['WhatsappInteraction'][_0x9b06('0xb5')](_0x40e636[_0x9b06('0x71')],{})[_0x9b06('0x28')](respondWithResult(_0x557f1c,0xc9))[_0x9b06('0xb4')](handleError(_0x557f1c,null));};exports[_0x9b06('0x27')]=function(_0x23fe9c,_0x69e7af){if(_0x23fe9c['body']['id']){delete _0x23fe9c[_0x9b06('0x71')]['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x23fe9c[_0x9b06('0xb6')]['id']}})[_0x9b06('0x28')](handleEntityNotFound(_0x69e7af,null))[_0x9b06('0x28')](saveUpdates(_0x23fe9c[_0x9b06('0x71')],null))[_0x9b06('0x28')](respondWithResult(_0x69e7af,null))['catch'](handleError(_0x69e7af,null));};exports[_0x9b06('0x29')]=function(_0x314855,_0x95ae03){return db[_0x9b06('0x33')][_0x9b06('0x5c')]({'where':{'id':_0x314855[_0x9b06('0xb6')]['id']}})[_0x9b06('0x28')](handleEntityNotFound(_0x95ae03,null))['then'](removeEntity(_0x95ae03,null))[_0x9b06('0xb4')](handleError(_0x95ae03,null));};exports['describe']=function(_0x40ea4b,_0x379772){return db[_0x9b06('0x33')][_0x9b06('0xb7')]()[_0x9b06('0x28')](respondWithResult(_0x379772,null))[_0x9b06('0xb4')](handleError(_0x379772,null));};exports[_0x9b06('0xb8')]=function(_0x31c6ab,_0x5b1bbb,_0x285a82){return db[_0x9b06('0xb9')][_0x9b06('0x5c')]({'where':{'id':_0x31c6ab[_0x9b06('0xb6')]['id']}})[_0x9b06('0x28')](handleEntityNotFound(_0x5b1bbb,null))[_0x9b06('0x28')](function(_0x4335fe){if(_0x4335fe){return _0x4335fe[_0x9b06('0xb8')](_0x31c6ab[_0x9b06('0x71')][_0x9b06('0xba')],_[_0x9b06('0xbb')](_0x31c6ab['body'],[_0x9b06('0xba'),'id'])||{});}})[_0x9b06('0x28')](respondWithResult(_0x5b1bbb,null))['catch'](handleError(_0x5b1bbb,null));};exports[_0x9b06('0xbc')]=function(_0x13e849,_0x1f8802,_0x262137){var _0x55b71e={'raw':![],'where':{}};var _0x2d772e={};var _0x502a2f={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x9b06('0xbd')]({'where':{'id':_0x13e849[_0x9b06('0xb6')]['id']}})['then'](handleEntityNotFound(_0x1f8802,null))[_0x9b06('0x28')](function(_0x5c829a){if(_0x5c829a){_0x2d772e[_0x9b06('0x38')]=_[_0x9b06('0x39')](db[_0x9b06('0xb9')][_0x9b06('0x34')]);_0x2d772e[_0x9b06('0x3a')]=_[_0x9b06('0x39')](_0x13e849[_0x9b06('0x3a')]);_0x2d772e[_0x9b06('0x3b')]=_[_0x9b06('0x3c')](_0x2d772e[_0x9b06('0x38')],_0x2d772e[_0x9b06('0x3a')]);_0x55b71e[_0x9b06('0x3e')]=_[_0x9b06('0x3c')](_0x2d772e[_0x9b06('0x38')],qs[_0x9b06('0x3d')](_0x13e849[_0x9b06('0x3a')][_0x9b06('0x3d')]));_0x55b71e[_0x9b06('0x3e')]=_0x55b71e['attributes'][_0x9b06('0x3f')]?_0x55b71e[_0x9b06('0x3e')]:_0x2d772e[_0x9b06('0x38')];if(!_0x13e849[_0x9b06('0x3a')][_0x9b06('0xbe')](_0x9b06('0x40'))){_0x55b71e[_0x9b06('0x21')]=qs[_0x9b06('0x21')](_0x13e849[_0x9b06('0x3a')][_0x9b06('0x21')]);_0x55b71e['offset']=qs[_0x9b06('0x20')](_0x13e849[_0x9b06('0x3a')]['offset']);}_0x55b71e[_0x9b06('0x41')]=qs[_0x9b06('0x42')](_0x13e849[_0x9b06('0x3a')][_0x9b06('0x42')]);_0x55b71e['where']=qs[_0x9b06('0x3b')](_[_0x9b06('0x44')](_0x13e849[_0x9b06('0x3a')],_0x2d772e['filters']));_0x55b71e[_0x9b06('0x43')][_0x9b06('0xae')]=_0x5c829a['id'];if(_0x13e849[_0x9b06('0x3a')][_0x9b06('0x82')]){_0x55b71e[_0x9b06('0x43')]=_[_0x9b06('0x99')](_0x55b71e[_0x9b06('0x43')],{'$or':_['map'](_0x55b71e['attributes'],function(_0x1bd884){var _0x58eea5={};_0x58eea5[_0x1bd884]={'$like':'%'+_0x13e849['query']['filter']+'%'};return _0x58eea5;})});}if(_0x13e849[_0x9b06('0x3a')][_0x9b06('0x77')]){var _0x50914b=_0x13e849[_0x9b06('0x3a')][_0x9b06('0x77')][_0x9b06('0x64')](',');var _0x345d22={};_0x345d22[_0x50914b[0x0]]={'$gte':moment(_0x50914b[0x1])[_0x9b06('0xbf')](_0x9b06('0xc0'))};_0x55b71e[_0x9b06('0x43')]=_['merge'](_0x55b71e[_0x9b06('0x43')],_0x345d22);}_0x55b71e=_[_0x9b06('0x99')]({},_0x55b71e,_0x13e849['options']);return db['WhatsappMessage'][_0x9b06('0x1f')]({'where':_0x55b71e[_0x9b06('0x43')]})['then'](function(_0x74fa4e){_0x502a2f['count']=_0x74fa4e;if(_0x13e849[_0x9b06('0x3a')][_0x9b06('0xb2')]){_0x55b71e[_0x9b06('0xb3')]=[{'all':!![]}];}return db[_0x9b06('0xb9')][_0x9b06('0xc1')](_0x55b71e);})[_0x9b06('0x28')](function(_0x2ec993){_0x502a2f[_0x9b06('0xc2')]=_0x2ec993;return _0x502a2f;});}})[_0x9b06('0x28')](respondWithFilteredResult(_0x1f8802,_0x55b71e))[_0x9b06('0xb4')](handleError(_0x1f8802,null));};exports[_0x9b06('0xc3')]=function(_0x3fb4bd,_0x2c0bd5,_0x388bf2){return db[_0x9b06('0x33')][_0x9b06('0x5c')]({'where':{'id':_0x3fb4bd[_0x9b06('0xb6')]['id']}})[_0x9b06('0x28')](handleEntityNotFound(_0x2c0bd5,null))[_0x9b06('0x28')](function(_0x4826da){if(_0x4826da){return _0x4826da[_0x9b06('0xc4')](_0x3fb4bd['body'][_0x9b06('0xba')],_[_0x9b06('0xbb')](_0x3fb4bd[_0x9b06('0x71')],[_0x9b06('0xba'),'id'])||{})[_0x9b06('0xc5')](function(){return db['Tag'][_0x9b06('0xc1')]({'attributes':['id',_0x9b06('0x2b'),_0x9b06('0x47')],'where':{'id':_0x3fb4bd[_0x9b06('0x71')][_0x9b06('0xba')]}});})[_0x9b06('0x28')](function(_0x416693){socket[_0x9b06('0xc6')](_0x9b06('0xc7'),{'id':Number(_0x3fb4bd['params']['id']),'tags':_0x416693||[]});return{'id':Number(_0x3fb4bd[_0x9b06('0xb6')]['id']),'tags':_0x416693||[]};});}})[_0x9b06('0x28')](respondWithResult(_0x2c0bd5,null))[_0x9b06('0xb4')](handleError(_0x2c0bd5,null));};exports[_0x9b06('0xc8')]=function(_0x54d788,_0x1d8131,_0x131d41){return db[_0x9b06('0x33')][_0x9b06('0x5c')]({'where':{'id':_0x54d788['params']['id']}})[_0x9b06('0x28')](handleEntityNotFound(_0x1d8131,null))[_0x9b06('0x28')](function(_0x5163d8){if(_0x5163d8){return _0x5163d8[_0x9b06('0xc8')](_0x54d788[_0x9b06('0x3a')][_0x9b06('0xba')]);}})[_0x9b06('0x28')](respondWithStatusCode(_0x1d8131,null))[_0x9b06('0xb4')](handleError(_0x1d8131,null));};exports['download']=function(_0x1373a0,_0x596a5b){var _0x306408=moment()[_0x9b06('0xc9')]()[_0x9b06('0x98')]();var _0x181a56=path[_0x9b06('0xca')](config[_0x9b06('0xcb')],_0x9b06('0xcc'),_0x9b06('0xcd'),_0x9b06('0xce'));var _0x3b2d99=path['join'](config[_0x9b06('0xcb')],_0x9b06('0xcc'),_0x9b06('0xcd'),_0x9b06('0xcf'));var _0x9f843d=path[_0x9b06('0xca')](_0x181a56,_0x306408);var _0x2de9d1=util['format'](_0x9b06('0xd0'),_0x1373a0[_0x9b06('0xb6')]['id'],_0x306408);var _0x906b7c=path[_0x9b06('0xca')](_0x181a56,_0x2de9d1);var _0x474184=[];_0x474184[_0x9b06('0xaf')]({'model':db[_0x9b06('0x6c')],'as':'User','attributes':['id',_0x9b06('0x2d')],'raw':!![]});_0x474184[_0x9b06('0xaf')]({'model':db['CmContact'],'as':_0x9b06('0x62'),'attributes':['id','firstName',_0x9b06('0xd1')],'raw':!![]});if(_0x1373a0['query'][_0x9b06('0xcf')]){_0x474184[_0x9b06('0xaf')]({'model':db[_0x9b06('0xd2')],'as':_0x9b06('0xd2'),'raw':!![]});}var _0x8e9824=[{'model':db[_0x9b06('0xb9')],'as':_0x9b06('0xd3'),'attributes':['id',_0x9b06('0x71'),_0x9b06('0x76'),_0x9b06('0xd4'),_0x9b06('0xd5'),_0x9b06('0x7e')],'include':_0x474184}];_0x8e9824[_0x9b06('0xaf')]({'model':db[_0x9b06('0xd6')],'as':_0x9b06('0xd7'),'attributes':['id',_0x9b06('0x2b')]});_0x8e9824[_0x9b06('0xaf')]({'model':db['User'],'as':_0x9b06('0xd8'),'attributes':['id',_0x9b06('0x2d')]});return db[_0x9b06('0x33')][_0x9b06('0x5c')]({'where':{'id':_0x1373a0[_0x9b06('0xb6')]['id']},'include':_0x8e9824})[_0x9b06('0x28')](handleEntityNotFound(_0x596a5b,null))[_0x9b06('0x28')](function(_0x471cd2){if(_0x471cd2){var _0x46b47f=_0x471cd2[_0x9b06('0xd9')]({'plain':!![]});fs[_0x9b06('0xda')](_0x9f843d);var _0x3d95cb={'format':'A4','border':'10px','header':{'height':_0x9b06('0xdb'),'contents':{'first':_0x9b06('0xdc')}},'footer':{'height':_0x9b06('0xdd'),'contents':{'default':util[_0x9b06('0xbf')](_0x9b06('0xde'),util[_0x9b06('0xbf')]('%s\x20#%d',_0x9b06('0xdf'),_0x46b47f['id']),moment()[_0x9b06('0xbf')](_0x9b06('0xe0'))[_0x9b06('0x98')]())}}};var _0x51138a={'channel':_0x9b06('0xdf'),'account':_0x46b47f[_0x9b06('0xd7')][_0x9b06('0x2b')],'agent':_0x46b47f['Owner']?_0x46b47f[_0x9b06('0xd8')]['fullname']:_0x9b06('0xe1'),'createdAt':moment(_0x46b47f['createdAt'])[_0x9b06('0xbf')](_0x9b06('0xc0'))['toString'](),'closedAt':_0x46b47f[_0x9b06('0xe2')]?moment(_0x46b47f[_0x9b06('0xe3')])[_0x9b06('0xbf')](_0x9b06('0xc0'))[_0x9b06('0x98')]():'','disposition':_0x46b47f[_0x9b06('0xe4')],'messages':_(_0x46b47f[_0x9b06('0xd3')])[_0x9b06('0x82')]({'secret':![]})[_0x9b06('0x32')](function(_0x212981){if(_0x212981[_0x9b06('0xd2')]){var _0x517632=path[_0x9b06('0xca')](_0x3b2d99,_0x212981[_0x9b06('0xd2')][_0x9b06('0xe5')]);if(fs[_0x9b06('0xe6')](_0x517632)){fs[_0x9b06('0xe7')](_0x517632)['pipe'](fs['createWriteStream'](path[_0x9b06('0xca')](_0x9f843d,_0x212981[_0x9b06('0xd2')][_0x9b06('0xe5')])));}}return{'date':moment(_0x212981['createdAt'])[_0x9b06('0xbf')](_0x9b06('0xc0'))[_0x9b06('0x98')](),'sender':_0x212981[_0x9b06('0xd4')]==='out'?_0x212981['User']?_0x212981['User'][_0x9b06('0x2d')]:_0x9b06('0xe8'):_0x212981[_0x9b06('0x62')]['firstName']+(_0x212981[_0x9b06('0x62')][_0x9b06('0xd1')]?'\x20'+_0x212981[_0x9b06('0x62')][_0x9b06('0xd1')]:''),'body':_0x212981[_0x9b06('0xd2')]?_0x212981['Attachment'][_0x9b06('0xe5')]:_0x212981[_0x9b06('0x71')],'direction':_0x212981[_0x9b06('0xd4')]===_0x9b06('0xe9')?'A':'C','secret':_0x212981['secret'],'read':_0x212981[_0x9b06('0x7e')],'attachment':_0x212981[_0x9b06('0xd2')]};})[_0x9b06('0x5e')]()};return ejs[_0x9b06('0xea')](path['join'](config[_0x9b06('0xcb')],_0x9b06('0xcc'),_0x9b06('0xeb'),_0x9b06('0xec')),{'interaction':_0x51138a})[_0x9b06('0x28')](function(_0x39571a){return new BPromise(function(_0x215f09,_0x49ace4){pdf['create'](_0x39571a,_0x3d95cb)[_0x9b06('0xed')](path[_0x9b06('0xca')](_0x9f843d,'transcript-'+_0x46b47f['id']+'-'+_0x306408+'.pdf'),function(_0x219d65,_0x50d99e){if(_0x219d65)return _0x49ace4(_0x219d65);_0x215f09(_0x50d99e);});});})[_0x9b06('0x28')](function(){return new BPromise(function(_0x5dce1b,_0x5347c3){zipdir(_0x9f843d,{'saveTo':_0x906b7c},function(_0x29e54c,_0x3f85d2){if(_0x29e54c)return _0x5347c3(_0x29e54c);return _0x5dce1b(_0x3f85d2);});})['then'](function(){return new BPromise(function(_0x312831,_0x544d34){rimraf(_0x9f843d,function(_0x52a476){if(_0x52a476)_0x544d34(_0x52a476);return _0x312831();});});})['then'](function(){return _0x596a5b['download'](_0x906b7c,_0x2de9d1,function(_0x68c9d){if(_0x68c9d){console[_0x9b06('0xee')](_0x9b06('0xef'),_0x68c9d);}else{fs[_0x9b06('0xf0')](_0x906b7c);}});});});}else{return _0x596a5b[_0x9b06('0x1c')](0xc8);}})[_0x9b06('0xb4')](handleError(_0x596a5b,null));}; \ No newline at end of file +var _0xea44=['isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','journey','role','agent','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','rows','show','params','include','merge','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','findAll','addTags','spread','emit','whatsappInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','closed','closedAt','disposition','basename','createReadStream','out','System','views','downloadInteraction.html','toFile','transcript-','.pdf','download','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','count','offset','limit','json','reject','save','then','destroy','send','map','fullname','Tags','TagIds','split','forEach','catch','WhatsappInteraction','rawAttributes','fieldName','type','model','name','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','end','some','compact','isEmpty','WhatsappAccountId','where','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace'];(function(_0x32e029,_0x4cf6f6){var _0x494faa=function(_0x3987c3){while(--_0x3987c3){_0x32e029['push'](_0x32e029['shift']());}};_0x494faa(++_0x4cf6f6);}(_0xea44,0x165));var _0x4ea4=function(_0x433b8a,_0x1f8162){_0x433b8a=_0x433b8a-0x0;var _0x389232=_0xea44[_0x433b8a];return _0x389232;};'use strict';var pdf=require(_0x4ea4('0x0'));var emlformat=require(_0x4ea4('0x1'));var rimraf=require(_0x4ea4('0x2'));var zipdir=require(_0x4ea4('0x3'));var jsonpatch=require(_0x4ea4('0x4'));var rp=require(_0x4ea4('0x5'));var moment=require(_0x4ea4('0x6'));var BPromise=require(_0x4ea4('0x7'));var Mustache=require(_0x4ea4('0x8'));var util=require('util');var path=require(_0x4ea4('0x9'));var sox=require(_0x4ea4('0xa'));var csv=require(_0x4ea4('0xb'));var ejs=require(_0x4ea4('0xc'));var fs=require('fs');var _=require(_0x4ea4('0xd'));var squel=require('squel');var crypto=require(_0x4ea4('0xe'));var jsforce=require(_0x4ea4('0xf'));var deskjs=require(_0x4ea4('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4ea4('0x11'));var Papa=require('papaparse');var Redis=require(_0x4ea4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4ea4('0x13'));var as=require(_0x4ea4('0x14'));var hardwareService=require(_0x4ea4('0x15'));var logger=require(_0x4ea4('0x16'))(_0x4ea4('0x17'));var utils=require(_0x4ea4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4ea4('0x19'));var db=require(_0x4ea4('0x1a'))['db'];config['redis']=_[_0x4ea4('0x1b')](config['redis'],{'host':_0x4ea4('0x1c'),'port':0x18eb});var socket=require(_0x4ea4('0x1d'))(new Redis(config[_0x4ea4('0x1e')]));require(_0x4ea4('0x1f'))[_0x4ea4('0x20')](socket);function respondWithStatusCode(_0x4408aa,_0x20e95b){_0x20e95b=_0x20e95b||0xcc;return function(_0x582be1){if(_0x582be1){return _0x4408aa[_0x4ea4('0x21')](_0x20e95b);}return _0x4408aa['status'](_0x20e95b)['end']();};}function respondWithResult(_0x360add,_0x338fd5){_0x338fd5=_0x338fd5||0xc8;return function(_0x19b20a){if(_0x19b20a){return _0x360add[_0x4ea4('0x22')](_0x338fd5)['json'](_0x19b20a);}};}function respondWithFilteredResult(_0x16c3af,_0x1409e9){return function(_0x30203c){if(_0x30203c){var _0x22fdd3=_0x30203c[_0x4ea4('0x23')],_0x21678e=_0x1409e9[_0x4ea4('0x24')],_0x575460=_0x1409e9[_0x4ea4('0x24')]+_0x1409e9[_0x4ea4('0x25')],_0x2db0c1;if(_0x575460>=_0x22fdd3){_0x575460=_0x22fdd3;_0x2db0c1=0xc8;}else{_0x2db0c1=0xce;}_0x16c3af[_0x4ea4('0x22')](_0x2db0c1);return _0x16c3af['set']('Content-Range',_0x21678e+'-'+_0x575460+'/'+_0x22fdd3)[_0x4ea4('0x26')](_0x30203c);}return null;};}function patchUpdates(_0x4dc4f8){return function(_0x37956d){try{jsonpatch['apply'](_0x37956d,_0x4dc4f8,!![]);}catch(_0x461ed2){return BPromise[_0x4ea4('0x27')](_0x461ed2);}return _0x37956d[_0x4ea4('0x28')]();};}function saveUpdates(_0x268fc7,_0x3a8035){return function(_0x3d2757){if(_0x3d2757){return _0x3d2757['update'](_0x268fc7)[_0x4ea4('0x29')](function(_0x2bf81b){return _0x2bf81b;});}return null;};}function removeEntity(_0x37f99e,_0x581bee){return function(_0x11ba67){if(_0x11ba67){return _0x11ba67[_0x4ea4('0x2a')]()['then'](function(){_0x37f99e[_0x4ea4('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ecad,_0x451a80){return function(_0x579075){if(!_0x579075){_0x47ecad[_0x4ea4('0x21')](0x194);}return _0x579075;};}function handleError(_0xa4f708,_0x50e7a5){_0x50e7a5=_0x50e7a5||0x1f4;return function(_0x175ca4){logger['error'](_0x175ca4['stack']);if(_0x175ca4['name']){delete _0x175ca4['name'];}_0xa4f708[_0x4ea4('0x22')](_0x50e7a5)[_0x4ea4('0x2b')](_0x175ca4);};}function getInteractionUsers(_0x2c09e5,_0x3e005e){return new BPromise(function(_0x547eb1,_0x4f7e97){try{if(_0x3e005e[_0x2c09e5['id']]){_0x2c09e5['Users']=_[_0x4ea4('0x2c')](_0x3e005e[_0x2c09e5['id']],function(_0x1b947c){return{'id':_0x1b947c['id'],'fullname':_0x1b947c[_0x4ea4('0x2d')]};});}}catch(_0x652ebb){_0x4f7e97(_0x652ebb);}_0x547eb1(_0x2c09e5);});}function getInteractionTags(_0x3cd075,_0x12549c){return new BPromise(function(_0x3de035,_0x57022a){try{if(_0x3cd075['TagIds']){_0x3cd075[_0x4ea4('0x2e')]=[];_0x3cd075[_0x4ea4('0x2f')][_0x4ea4('0x30')](',')[_0x4ea4('0x31')](function(_0x1129fa){_0x3cd075[_0x4ea4('0x2e')]['push'](_0x12549c[_0x1129fa]);});}delete _0x3cd075['TagIds'];}catch(_0x431b04){_0x57022a(_0x431b04);}_0x3de035(_0x3cd075);});}function updateWhatsappInteraction(_0x83204c,_0x2ba669,_0xc0c34){return new BPromise(function(_0x33cf87,_0x392efb){return getInteractionUsers(_0x83204c,_0xc0c34)[_0x4ea4('0x29')](function(_0x3adf14){return getInteractionTags(_0x3adf14,_0x2ba669);})['then'](function(_0x46bf3c){_0x33cf87(_0x46bf3c);})[_0x4ea4('0x32')](function(_0x3006d2){_0x392efb(_0x3006d2);});});}exports['index']=function(_0x3a3847,_0x5f233e){var _0x1bb26f={},_0x244436={},_0x4abc46={'count':0x0,'rows':[]};var _0xd3469=_[_0x4ea4('0x2c')](db[_0x4ea4('0x33')][_0x4ea4('0x34')],function(_0x50480f){return{'name':_0x50480f[_0x4ea4('0x35')],'type':_0x50480f[_0x4ea4('0x36')]['key']};});_0x244436[_0x4ea4('0x37')]=_[_0x4ea4('0x2c')](_0xd3469,_0x4ea4('0x38'));_0x244436['query']=_[_0x4ea4('0x39')](_0x3a3847['query']);_0x244436['filters']=_['intersection'](_0x244436[_0x4ea4('0x37')],_0x244436[_0x4ea4('0x3a')]);_0x1bb26f[_0x4ea4('0x3b')]=_[_0x4ea4('0x3c')](_0x244436[_0x4ea4('0x37')],qs[_0x4ea4('0x3d')](_0x3a3847[_0x4ea4('0x3a')]['fields']));_0x1bb26f[_0x4ea4('0x3b')]=_0x1bb26f[_0x4ea4('0x3b')][_0x4ea4('0x3e')]?_0x1bb26f[_0x4ea4('0x3b')]:_0x244436[_0x4ea4('0x37')];if(!_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x3f')](_0x4ea4('0x40'))){_0x1bb26f['limit']=qs['limit'](_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x25')]);_0x1bb26f[_0x4ea4('0x24')]=qs[_0x4ea4('0x24')](_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x24')]);}_0x1bb26f[_0x4ea4('0x41')]=qs[_0x4ea4('0x42')](_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x42')]);_0x1bb26f['where']=qs[_0x4ea4('0x43')](_[_0x4ea4('0x44')](_0x3a3847[_0x4ea4('0x3a')],_0x244436[_0x4ea4('0x43')]),_0xd3469);var _0x5a5914=[];var _0x22b7d8=squel[_0x4ea4('0x45')]()[_0x4ea4('0x46')]('id')['field'](_0x4ea4('0x38'))[_0x4ea4('0x46')](_0x4ea4('0x47'))[_0x4ea4('0x48')]('tools_tags');var _0x4e743e=squel[_0x4ea4('0x45')]()[_0x4ea4('0x46')](_0x4ea4('0x49'))['field'](_0x4ea4('0x4a'))[_0x4ea4('0x46')](_0x4ea4('0x4b'))[_0x4ea4('0x48')]('user_has_whatsapp_interactions','ui')['left_join'](_0x4ea4('0x4c'),'u',_0x4ea4('0x4d'));var _0x5dc727=squel[_0x4ea4('0x45')]()['from'](_0x4ea4('0x4e'),'i')[_0x4ea4('0x4f')](_0x4ea4('0x50'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4ea4('0x4f')](_0x4ea4('0x4c'),'o','o.id\x20=\x20i.UserId')[_0x4ea4('0x4f')](_0x4ea4('0x51'),'a',_0x4ea4('0x52'))[_0x4ea4('0x4f')](_0x4ea4('0x53'),'me',_0x4ea4('0x54'))['left_join']('whatsapp_interaction_has_tags','it',_0x4ea4('0x55'))[_0x4ea4('0x4f')](_0x4ea4('0x56'),'t','t.id\x20=\x20it.TagId');var _0x3af10e=squel[_0x4ea4('0x57')]();var _0x3d390b=[];var _0x4cf1cc=squel[_0x4ea4('0x57')]();var _0x15319f;if(_0x3a3847[_0x4ea4('0x3a')]['search']){_0x15319f=as[_0x4ea4('0x58')](_0x3a3847['query'][_0x4ea4('0x59')]);var _0x3d31fb=_0x15319f['sqlOperator'];for(var _0x233ccc=0x0;_0x233ccc<_0x15319f[_0x4ea4('0x5a')][_0x4ea4('0x3e')];_0x233ccc++){var _0x5cf6b1=_0x15319f[_0x4ea4('0x5a')][_0x233ccc];var _0x542db6='i';var _0x2cf9d5=_['find'](_0xd3469,[_0x4ea4('0x38'),_0x5cf6b1[_0x4ea4('0x46')]]);if(!_0x2cf9d5){switch(_0x5cf6b1[_0x4ea4('0x46')]){case _0x4ea4('0x5b'):if(_0x5cf6b1[_0x4ea4('0x5c')]==0x1){_0x5dc727[_0x4ea4('0x5d')]('`'+_0x5cf6b1[_0x4ea4('0x46')]+_0x4ea4('0x5e'));}else{_0x5dc727[_0x4ea4('0x5d')]('`'+_0x5cf6b1[_0x4ea4('0x46')]+_0x4ea4('0x5f'));}break;case _0x4ea4('0x60'):if(_0x5cf6b1[_0x4ea4('0x61')]==='$substring'){if(_0x5cf6b1['value']['split']('\x20')[_0x4ea4('0x3e')]>0x1){_0x3af10e[_0x3d31fb]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4ea4('0x62')](_0x5cf6b1[_0x4ea4('0x5c')]),null);}else{var _0x11ab8a='%'+_0x5cf6b1[_0x4ea4('0x5c')]+'%';_0x3af10e[_0x3d31fb](_0x4ea4('0x63'),_0x11ab8a,_0x11ab8a,_0x11ab8a);}}else{_0x2cf9d5=_[_0x4ea4('0x64')](_0xd3469,[_0x4ea4('0x38'),_0x4ea4('0x65')]);_0x5cf6b1[_0x4ea4('0x46')]='ContactId';_0x1b6a18=as[_0x4ea4('0x66')](_0x542db6,_0x2cf9d5[_0x4ea4('0x36')],_0x5cf6b1);_0x3af10e[_0x3d31fb](_0x1b6a18[_0x4ea4('0x67')],_0x1b6a18[_0x4ea4('0x5c')][_0x4ea4('0x68')],_0x1b6a18[_0x4ea4('0x5c')]['end']);}break;case _0x4ea4('0x69'):var _0x176636=_0x5cf6b1[_0x4ea4('0x5c')]['split'](',')['map'](function(_0x4b3f15){return Number(_0x4b3f15);});_0x176636[_0x4ea4('0x31')](function(_0x152734){_0x4cf1cc['or'](_0x4ea4('0x6a'),'%,'+_0x152734+',%');});_0x3d390b=_[_0x4ea4('0x6b')](_0x3d390b,_0x176636);break;case _0x4ea4('0x6c'):if(_0x5cf6b1[_0x4ea4('0x61')]===_0x4ea4('0x6d')){_0x3af10e[_0x3d31fb](_0x4ea4('0x6e'),'%'+_0x5cf6b1[_0x4ea4('0x5c')]+'%',null);}else{_0x2cf9d5=_[_0x4ea4('0x64')](_0xd3469,['name',_0x4ea4('0x6f')]);_0x5cf6b1[_0x4ea4('0x46')]=_0x4ea4('0x6f');_0x1b6a18=as[_0x4ea4('0x66')](_0x542db6,_0x2cf9d5['type'],_0x5cf6b1);_0x3af10e[_0x3d31fb](_0x1b6a18[_0x4ea4('0x67')],_0x1b6a18['value']['start'],_0x1b6a18['value']['end']);}break;case'body':_0x1b6a18=as[_0x4ea4('0x66')]('me',null,_0x5cf6b1);_0x3af10e[_0x3d31fb](_0x1b6a18[_0x4ea4('0x67')],_0x1b6a18[_0x4ea4('0x5c')][_0x4ea4('0x68')],_0x1b6a18[_0x4ea4('0x5c')][_0x4ea4('0x70')]);break;}}else{var _0x1b6a18=as[_0x4ea4('0x66')](_0x542db6,_0x2cf9d5[_0x4ea4('0x36')],_0x5cf6b1);_0x3af10e[_0x3d31fb](_0x1b6a18[_0x4ea4('0x67')],_0x1b6a18[_0x4ea4('0x5c')][_0x4ea4('0x68')],_0x1b6a18[_0x4ea4('0x5c')][_0x4ea4('0x70')]);}}}else{var _0x31b326=_(_0x3a3847[_0x4ea4('0x3a')])[_0x4ea4('0x39')]()[_0x4ea4('0x2c')](function(_0x5d3355){return _[_0x4ea4('0x71')](_0xd3469,[_0x4ea4('0x38'),_0x5d3355])?_0x5d3355:undefined;})[_0x4ea4('0x72')]()[_0x4ea4('0x5c')]();if(!_[_0x4ea4('0x73')](_0x31b326)){_0x31b326['forEach'](function(_0x281894){if(_0x281894===_0x4ea4('0x74')){_0x5dc727[_0x4ea4('0x75')](_0x4ea4('0x76'),[][_0x4ea4('0x77')](_0x3a3847[_0x4ea4('0x3a')][_0x281894]));}else if(_0x281894===_0x4ea4('0x78')){var _0x107f54=JSON['parse'](_0x3a3847[_0x4ea4('0x3a')][_0x281894])[_0x4ea4('0x79')];var _0x575167=JSON[_0x4ea4('0x7a')](_0x3a3847[_0x4ea4('0x3a')][_0x281894])['$lte'];_0x5dc727[_0x4ea4('0x75')](_0x4ea4('0x7b'),_0x107f54,_0x575167);}else{if(_0x3a3847['query'][_0x281894]==='null'){_0x5dc727[_0x4ea4('0x75')]('i.'+_0x281894+_0x4ea4('0x7c'));}else{_0x5dc727[_0x4ea4('0x75')]('i.'+_0x281894+_0x4ea4('0x7d'),_0x3a3847[_0x4ea4('0x3a')][_0x281894]);}}});}if(_0x3a3847[_0x4ea4('0x3a')]['read']){if(_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x7e')]==0x1){_0x5dc727['having'](_0x4ea4('0x7f'));}else{_0x5dc727['having'](_0x4ea4('0x80'));}}if(_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x81')]){_0x3d390b=_[_0x4ea4('0x82')](_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x81')])?_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x81')]:new Array(_0x3a3847['query'][_0x4ea4('0x81')]);_0x3d390b[_0x4ea4('0x31')](function(_0x1fc633){_0x4cf1cc['or'](_0x4ea4('0x6a'),'%,'+_0x1fc633+',%');});}if(_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x83')]){var _0x3cf28e=_0x3a3847['query'][_0x4ea4('0x83')][_0x4ea4('0x84')]('\x5c','\x5c\x5c')[_0x4ea4('0x84')](/'/g,'\x27\x27');if(qs[_0x4ea4('0x85')](_0x3cf28e)){_0x3af10e['or'](_0x4ea4('0x86'),_0x3cf28e+'%')['or'](_0x4ea4('0x87'),_0x3cf28e+'%');}else{_0x3af10e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3cf28e))['or'](_0x4ea4('0x88'),_0x3cf28e+'%');}}}_0x5dc727[_0x4ea4('0x75')](_0x3af10e);_0x5dc727[_0x4ea4('0x89')](_0x4ea4('0x8a'));var _0x5aacbf={'type':db[_0x4ea4('0x8b')][_0x4ea4('0x8c')][_0x4ea4('0x8d')],'raw':!![]};var _0x138f4a=_0x5dc727[_0x4ea4('0x8e')]();_0x138f4a[_0x4ea4('0x46')](_0x4ea4('0x8a'));_0x138f4a[_0x4ea4('0x46')](_0x4ea4('0x8f'),_0x4ea4('0x5b'));if(_0x1bb26f[_0x4ea4('0x41')]){_0x1bb26f[_0x4ea4('0x41')][_0x4ea4('0x31')](function(_0x527953){var _0x475759=_0x527953[0x0]===_0x4ea4('0x90')?_0x527953[0x0]:'i.'+_0x527953[0x0];_0x5dc727[_0x4ea4('0x41')](_0x475759,_0x527953[0x1]===_0x4ea4('0x91')?![]:!![]);});}if(!_[_0x4ea4('0x73')](_0x3d390b)){_0x5dc727[_0x4ea4('0x5d')](_0x4cf1cc);_0x138f4a['where'](_0x4ea4('0x92'),_0x3d390b);}BPromise[_0x4ea4('0x93')]()['then'](function(){if(!_0x15319f){if(_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x74')]||_0x3a3847['query'][_0x4ea4('0x94')])return;_0x138f4a[_0x4ea4('0x75')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x5dc727[_0x4ea4('0x75')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3a3847['user'][_0x4ea4('0x95')]!==_0x4ea4('0x96'))return;return _0x3a3847[_0x4ea4('0x97')][_0x4ea4('0x98')]({'attributes':['id'],'raw':!![]})[_0x4ea4('0x29')](function(_0x5df295){if(_['isEmpty'](_0x5df295)){_0x138f4a[_0x4ea4('0x75')](_0x4ea4('0x99'));_0x5dc727[_0x4ea4('0x75')](_0x4ea4('0x99'));}else{_0x138f4a[_0x4ea4('0x75')](_0x4ea4('0x76'),_[_0x4ea4('0x2c')](_0x5df295,'id'));_0x5dc727[_0x4ea4('0x75')]('i.WhatsappAccountId\x20IN\x20?',_[_0x4ea4('0x2c')](_0x5df295,'id'));}});})[_0x4ea4('0x29')](function(){if(_0x3a3847[_0x4ea4('0x97')]['role']==='agent'&&!_0x15319f&&!_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x74')])return[];return db[_0x4ea4('0x9a')][_0x4ea4('0x3a')](_0x138f4a[_0x4ea4('0x9b')](),_0x5aacbf);})[_0x4ea4('0x29')](function(_0x442c96){_0x4abc46['count']=_0x442c96[_0x4ea4('0x3e')];if(_0x4abc46[_0x4ea4('0x23')]===0x0)return[];return db[_0x4ea4('0x9a')]['query'](_0x22b7d8['toString'](),_0x5aacbf)[_0x4ea4('0x29')](function(_0x212fd5){_0x5a5914=_[_0x4ea4('0x9c')](_0x212fd5,'id');_0x5aacbf=_['merge'](_0x5aacbf,{'model':db[_0x4ea4('0x33')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a3847[_0x4ea4('0x3a')][_0x4ea4('0x3d')]){_0x1bb26f[_0x4ea4('0x3b')][_0x4ea4('0x31')](function(_0x595861){_0x5dc727[_0x4ea4('0x46')]('i.'+_0x595861);});}else{_0x5dc727[_0x4ea4('0x46')](_0x4ea4('0x8f'),_0x4ea4('0x5b'));_0x5dc727[_0x4ea4('0x46')](_0x4ea4('0x9d'),_0x4ea4('0x9e'));_0x5dc727[_0x4ea4('0x46')](_0x4ea4('0x9f'),_0x4ea4('0xa0'));_0x5dc727['field'](_0x4ea4('0xa1'),_0x4ea4('0x90'));_0x5dc727['field'](_0x4ea4('0xa2'));_0x5dc727[_0x4ea4('0x46')](_0x4ea4('0xa3'),_0x4ea4('0xa4'));_0x5dc727[_0x4ea4('0x46')](_0x4ea4('0xa5'),_0x4ea4('0xa6'));_0x5dc727['field'](_0x4ea4('0xa7'),_0x4ea4('0xa8'));_0x5dc727[_0x4ea4('0x46')](_0x4ea4('0xa9'),_0x4ea4('0xaa'));_0x5dc727[_0x4ea4('0x46')](_0x4ea4('0xab'),_0x4ea4('0xac'));_0x5dc727[_0x4ea4('0x46')](_0x4ea4('0xad'),'Contact.fax');_0x5dc727['field'](_0x4ea4('0xae'),_0x4ea4('0xaf'));_0x5dc727[_0x4ea4('0x46')]('o.internal',_0x4ea4('0xb0'));_0x5dc727[_0x4ea4('0x46')](_0x4ea4('0xb1'),_0x4ea4('0x2f'));}if(_0x1bb26f[_0x4ea4('0x25')])_0x5dc727[_0x4ea4('0x25')](_0x1bb26f[_0x4ea4('0x25')]);if(_0x1bb26f[_0x4ea4('0x24')])_0x5dc727[_0x4ea4('0x24')](_0x1bb26f[_0x4ea4('0x24')]);return db[_0x4ea4('0x9a')]['query'](_0x5dc727[_0x4ea4('0x9b')](),_0x5aacbf);})[_0x4ea4('0x29')](function(_0x42ec97){_0x4e743e[_0x4ea4('0x75')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x4ea4('0x2c')](_0x42ec97,'id'));return db[_0x4ea4('0x9a')][_0x4ea4('0x3a')](_0x4e743e['toString'](),_0x5aacbf)[_0x4ea4('0x29')](function(_0x3bdf9e){var _0x23366e=_[_0x4ea4('0xb2')](_0x3bdf9e,_0x4ea4('0xb3'));var _0x245dca=[];_0x42ec97[_0x4ea4('0x31')](function(_0x11bf47){_0x245dca['push'](updateWhatsappInteraction(_0x11bf47,_0x5a5914,_0x23366e));});return BPromise['all'](_0x245dca);});});})[_0x4ea4('0x29')](function(_0x229948){_0x4abc46[_0x4ea4('0xb4')]=_0x229948;return _0x4abc46;})['then'](respondWithFilteredResult(_0x5f233e,_0x1bb26f))[_0x4ea4('0x32')](handleError(_0x5f233e,null));};exports[_0x4ea4('0xb5')]=function(_0x33da4f,_0x1a053f){var _0xf0317b={'raw':![],'where':{'id':_0x33da4f[_0x4ea4('0xb6')]['id']}},_0x53a015={};_0x53a015[_0x4ea4('0x37')]=_[_0x4ea4('0x39')](db[_0x4ea4('0x33')][_0x4ea4('0x34')]);_0x53a015[_0x4ea4('0x3a')]=_[_0x4ea4('0x39')](_0x33da4f[_0x4ea4('0x3a')]);_0x53a015['filters']=_[_0x4ea4('0x3c')](_0x53a015[_0x4ea4('0x37')],_0x53a015[_0x4ea4('0x3a')]);_0xf0317b[_0x4ea4('0x3b')]=_['intersection'](_0x53a015[_0x4ea4('0x37')],qs[_0x4ea4('0x3d')](_0x33da4f[_0x4ea4('0x3a')]['fields']));_0xf0317b[_0x4ea4('0x3b')]=_0xf0317b[_0x4ea4('0x3b')]['length']?_0xf0317b[_0x4ea4('0x3b')]:_0x53a015['model'];if(_0x33da4f[_0x4ea4('0x3a')]['includeAll']){_0xf0317b[_0x4ea4('0xb7')]=[{'all':!![]}];}_0xf0317b=_[_0x4ea4('0xb8')]({},_0xf0317b,_0x33da4f['options']);return db[_0x4ea4('0x33')][_0x4ea4('0x64')](_0xf0317b)[_0x4ea4('0x29')](handleEntityNotFound(_0x1a053f,null))[_0x4ea4('0x29')](respondWithResult(_0x1a053f,null))[_0x4ea4('0x32')](handleError(_0x1a053f,null));};exports[_0x4ea4('0xb9')]=function(_0x2e48b0,_0xe94821){return db[_0x4ea4('0x33')][_0x4ea4('0xb9')](_0x2e48b0[_0x4ea4('0xba')],{})[_0x4ea4('0x29')](respondWithResult(_0xe94821,0xc9))['catch'](handleError(_0xe94821,null));};exports['update']=function(_0x5929cf,_0x4a0e2c){if(_0x5929cf[_0x4ea4('0xba')]['id']){delete _0x5929cf['body']['id'];}return db['WhatsappInteraction'][_0x4ea4('0x64')]({'where':{'id':_0x5929cf[_0x4ea4('0xb6')]['id']}})['then'](handleEntityNotFound(_0x4a0e2c,null))[_0x4ea4('0x29')](saveUpdates(_0x5929cf[_0x4ea4('0xba')],null))[_0x4ea4('0x29')](respondWithResult(_0x4a0e2c,null))[_0x4ea4('0x32')](handleError(_0x4a0e2c,null));};exports[_0x4ea4('0x2a')]=function(_0x10c0b1,_0x23686a){return db[_0x4ea4('0x33')][_0x4ea4('0x64')]({'where':{'id':_0x10c0b1[_0x4ea4('0xb6')]['id']}})[_0x4ea4('0x29')](handleEntityNotFound(_0x23686a,null))[_0x4ea4('0x29')](removeEntity(_0x23686a,null))[_0x4ea4('0x32')](handleError(_0x23686a,null));};exports[_0x4ea4('0xbb')]=function(_0x16a364,_0x503d72){return db['WhatsappInteraction'][_0x4ea4('0xbb')]()[_0x4ea4('0x29')](respondWithResult(_0x503d72,null))[_0x4ea4('0x32')](handleError(_0x503d72,null));};exports[_0x4ea4('0xbc')]=function(_0x382c0a,_0x46fe0a,_0x3cf03b){return db[_0x4ea4('0xbd')][_0x4ea4('0x64')]({'where':{'id':_0x382c0a[_0x4ea4('0xb6')]['id']}})[_0x4ea4('0x29')](handleEntityNotFound(_0x46fe0a,null))[_0x4ea4('0x29')](function(_0x25c1ac){if(_0x25c1ac){return _0x25c1ac['addMessage'](_0x382c0a[_0x4ea4('0xba')][_0x4ea4('0xbe')],_[_0x4ea4('0xbf')](_0x382c0a['body'],[_0x4ea4('0xbe'),'id'])||{});}})[_0x4ea4('0x29')](respondWithResult(_0x46fe0a,null))['catch'](handleError(_0x46fe0a,null));};exports[_0x4ea4('0xc0')]=function(_0x252f5b,_0x182f2a,_0x1a6e0d){var _0x43a137={'raw':![],'where':{}};var _0x42092a={};var _0x23b1ee={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0x252f5b[_0x4ea4('0xb6')]['id']}})['then'](handleEntityNotFound(_0x182f2a,null))[_0x4ea4('0x29')](function(_0xac161f){if(_0xac161f){_0x42092a['model']=_['keys'](db[_0x4ea4('0xbd')][_0x4ea4('0x34')]);_0x42092a[_0x4ea4('0x3a')]=_[_0x4ea4('0x39')](_0x252f5b[_0x4ea4('0x3a')]);_0x42092a[_0x4ea4('0x43')]=_['intersection'](_0x42092a['model'],_0x42092a['query']);_0x43a137[_0x4ea4('0x3b')]=_['intersection'](_0x42092a[_0x4ea4('0x37')],qs['fields'](_0x252f5b[_0x4ea4('0x3a')][_0x4ea4('0x3d')]));_0x43a137[_0x4ea4('0x3b')]=_0x43a137[_0x4ea4('0x3b')]['length']?_0x43a137[_0x4ea4('0x3b')]:_0x42092a[_0x4ea4('0x37')];if(!_0x252f5b[_0x4ea4('0x3a')][_0x4ea4('0x3f')]('nolimit')){_0x43a137['limit']=qs['limit'](_0x252f5b['query'][_0x4ea4('0x25')]);_0x43a137['offset']=qs['offset'](_0x252f5b['query']['offset']);}_0x43a137['order']=qs[_0x4ea4('0x42')](_0x252f5b[_0x4ea4('0x3a')]['sort']);_0x43a137['where']=qs[_0x4ea4('0x43')](_['pick'](_0x252f5b['query'],_0x42092a[_0x4ea4('0x43')]));_0x43a137[_0x4ea4('0x75')][_0x4ea4('0xb3')]=_0xac161f['id'];if(_0x252f5b[_0x4ea4('0x3a')][_0x4ea4('0x83')]){_0x43a137['where']=_[_0x4ea4('0xb8')](_0x43a137['where'],{'$or':_[_0x4ea4('0x2c')](_0x43a137[_0x4ea4('0x3b')],function(_0x300b07){var _0x2520ff={};_0x2520ff[_0x300b07]={'$like':'%'+_0x252f5b['query'][_0x4ea4('0x83')]+'%'};return _0x2520ff;})});}if(_0x252f5b[_0x4ea4('0x3a')]['$gte']){var _0x2c934e=_0x252f5b['query'][_0x4ea4('0x79')][_0x4ea4('0x30')](',');var _0x1bcf67={};_0x1bcf67[_0x2c934e[0x0]]={'$gte':moment(_0x2c934e[0x1])['format'](_0x4ea4('0xc1'))};_0x43a137[_0x4ea4('0x75')]=_[_0x4ea4('0xb8')](_0x43a137[_0x4ea4('0x75')],_0x1bcf67);}_0x43a137=_[_0x4ea4('0xb8')]({},_0x43a137,_0x252f5b[_0x4ea4('0xc2')]);return db[_0x4ea4('0xbd')]['count']({'where':_0x43a137[_0x4ea4('0x75')]})[_0x4ea4('0x29')](function(_0x175b0d){_0x23b1ee[_0x4ea4('0x23')]=_0x175b0d;if(_0x252f5b[_0x4ea4('0x3a')][_0x4ea4('0xc3')]){_0x43a137['include']=[{'all':!![]}];}return db[_0x4ea4('0xbd')][_0x4ea4('0xc4')](_0x43a137);})['then'](function(_0xe1a3a8){_0x23b1ee[_0x4ea4('0xb4')]=_0xe1a3a8;return _0x23b1ee;});}})['then'](respondWithFilteredResult(_0x182f2a,_0x43a137))[_0x4ea4('0x32')](handleError(_0x182f2a,null));};exports[_0x4ea4('0xc5')]=function(_0x1d2370,_0x30721a,_0x1a73be){return db[_0x4ea4('0x33')][_0x4ea4('0x64')]({'where':{'id':_0x1d2370[_0x4ea4('0xb6')]['id']}})['then'](handleEntityNotFound(_0x30721a,null))['then'](function(_0xd9b60f){if(_0xd9b60f){return _0xd9b60f['setTags'](_0x1d2370['body'][_0x4ea4('0xbe')],_['omit'](_0x1d2370[_0x4ea4('0xba')],['ids','id'])||{})[_0x4ea4('0xc6')](function(){return db['Tag'][_0x4ea4('0xc4')]({'attributes':['id',_0x4ea4('0x38'),_0x4ea4('0x47')],'where':{'id':_0x1d2370['body']['ids']}});})[_0x4ea4('0x29')](function(_0xfcc01c){socket[_0x4ea4('0xc7')](_0x4ea4('0xc8'),{'id':Number(_0x1d2370[_0x4ea4('0xb6')]['id']),'tags':_0xfcc01c||[]});return{'id':Number(_0x1d2370[_0x4ea4('0xb6')]['id']),'tags':_0xfcc01c||[]};});}})[_0x4ea4('0x29')](respondWithResult(_0x30721a,null))[_0x4ea4('0x32')](handleError(_0x30721a,null));};exports[_0x4ea4('0xc9')]=function(_0x1b8a45,_0x1ecc55,_0x4a9643){return db[_0x4ea4('0x33')][_0x4ea4('0x64')]({'where':{'id':_0x1b8a45[_0x4ea4('0xb6')]['id']}})[_0x4ea4('0x29')](handleEntityNotFound(_0x1ecc55,null))['then'](function(_0x2d0963){if(_0x2d0963){return _0x2d0963[_0x4ea4('0xc9')](_0x1b8a45[_0x4ea4('0x3a')][_0x4ea4('0xbe')]);}})[_0x4ea4('0x29')](respondWithStatusCode(_0x1ecc55,null))[_0x4ea4('0x32')](handleError(_0x1ecc55,null));};exports['download']=function(_0x58260b,_0x1171cd){var _0x5e8e77=moment()['unix']()[_0x4ea4('0x9b')]();var _0x4c85a3=path[_0x4ea4('0xca')](config[_0x4ea4('0xcb')],_0x4ea4('0xcc'),_0x4ea4('0xcd'),_0x4ea4('0xce'));var _0x561c9f=path[_0x4ea4('0xca')](config[_0x4ea4('0xcb')],_0x4ea4('0xcc'),_0x4ea4('0xcd'),_0x4ea4('0xcf'));var _0x30e611=path[_0x4ea4('0xca')](_0x4c85a3,_0x5e8e77);var _0x48a5bd=util[_0x4ea4('0xd0')](_0x4ea4('0xd1'),_0x58260b[_0x4ea4('0xb6')]['id'],_0x5e8e77);var _0x1bfc90=path[_0x4ea4('0xca')](_0x4c85a3,_0x48a5bd);var _0x2719d1=[];_0x2719d1[_0x4ea4('0xd2')]({'model':db[_0x4ea4('0x6c')],'as':_0x4ea4('0x6c'),'attributes':['id',_0x4ea4('0x2d')],'raw':!![]});_0x2719d1[_0x4ea4('0xd2')]({'model':db[_0x4ea4('0xd3')],'as':_0x4ea4('0x60'),'attributes':['id',_0x4ea4('0xd4'),_0x4ea4('0xd5')],'raw':!![]});if(_0x58260b[_0x4ea4('0x3a')][_0x4ea4('0xcf')]){_0x2719d1[_0x4ea4('0xd2')]({'model':db[_0x4ea4('0xd6')],'as':_0x4ea4('0xd6'),'raw':!![]});}var _0x2a447a=[{'model':db[_0x4ea4('0xbd')],'as':_0x4ea4('0xd7'),'attributes':['id',_0x4ea4('0xba'),'createdAt',_0x4ea4('0xd8'),_0x4ea4('0xd9'),'read'],'include':_0x2719d1}];_0x2a447a['push']({'model':db[_0x4ea4('0xda')],'as':_0x4ea4('0xdb'),'attributes':['id','name']});_0x2a447a['push']({'model':db[_0x4ea4('0x6c')],'as':_0x4ea4('0xdc'),'attributes':['id',_0x4ea4('0x2d')]});return db[_0x4ea4('0x33')]['find']({'where':{'id':_0x58260b[_0x4ea4('0xb6')]['id']},'include':_0x2a447a})['then'](handleEntityNotFound(_0x1171cd,null))[_0x4ea4('0x29')](function(_0x3177ec){if(_0x3177ec){var _0x9bf286=_0x3177ec['get']({'plain':!![]});fs[_0x4ea4('0xdd')](_0x30e611);var _0x41ee0d={'format':'A4','border':'10px','header':{'height':_0x4ea4('0xde'),'contents':{'first':_0x4ea4('0xdf')}},'footer':{'height':_0x4ea4('0xe0'),'contents':{'default':util['format'](_0x4ea4('0xe1'),util[_0x4ea4('0xd0')](_0x4ea4('0xe2'),_0x4ea4('0xe3'),_0x9bf286['id']),moment()[_0x4ea4('0xd0')](_0x4ea4('0xe4'))[_0x4ea4('0x9b')]())}}};var _0x3eeae2={'channel':_0x4ea4('0xe3'),'account':_0x9bf286['Account'][_0x4ea4('0x38')],'agent':_0x9bf286[_0x4ea4('0xdc')]?_0x9bf286[_0x4ea4('0xdc')]['fullname']:_0x4ea4('0xe5'),'createdAt':moment(_0x9bf286[_0x4ea4('0x78')])[_0x4ea4('0xd0')](_0x4ea4('0xc1'))[_0x4ea4('0x9b')](),'closedAt':_0x9bf286[_0x4ea4('0xe6')]?moment(_0x9bf286[_0x4ea4('0xe7')])['format'](_0x4ea4('0xc1'))[_0x4ea4('0x9b')]():'','disposition':_0x9bf286[_0x4ea4('0xe8')],'messages':_(_0x9bf286[_0x4ea4('0xd7')])[_0x4ea4('0x83')]({'secret':![]})[_0x4ea4('0x2c')](function(_0xa247c9){if(_0xa247c9[_0x4ea4('0xd6')]){var _0x295195=path[_0x4ea4('0xca')](_0x561c9f,_0xa247c9[_0x4ea4('0xd6')][_0x4ea4('0xe9')]);if(fs['existsSync'](_0x295195)){fs[_0x4ea4('0xea')](_0x295195)['pipe'](fs['createWriteStream'](path[_0x4ea4('0xca')](_0x30e611,_0xa247c9['Attachment'][_0x4ea4('0xe9')])));}}return{'date':moment(_0xa247c9[_0x4ea4('0x78')])['format'](_0x4ea4('0xc1'))[_0x4ea4('0x9b')](),'sender':_0xa247c9[_0x4ea4('0xd8')]===_0x4ea4('0xeb')?_0xa247c9[_0x4ea4('0x6c')]?_0xa247c9[_0x4ea4('0x6c')][_0x4ea4('0x2d')]:_0x4ea4('0xec'):_0xa247c9[_0x4ea4('0x60')][_0x4ea4('0xd4')]+(_0xa247c9[_0x4ea4('0x60')][_0x4ea4('0xd5')]?'\x20'+_0xa247c9[_0x4ea4('0x60')][_0x4ea4('0xd5')]:''),'body':_0xa247c9[_0x4ea4('0xd6')]?_0xa247c9[_0x4ea4('0xd6')][_0x4ea4('0xe9')]:_0xa247c9['body'],'direction':_0xa247c9[_0x4ea4('0xd8')]===_0x4ea4('0xeb')?'A':'C','secret':_0xa247c9[_0x4ea4('0xd9')],'read':_0xa247c9[_0x4ea4('0x7e')],'attachment':_0xa247c9[_0x4ea4('0xd6')]};})['value']()};return ejs['renderFile'](path[_0x4ea4('0xca')](config[_0x4ea4('0xcb')],_0x4ea4('0xcc'),_0x4ea4('0xed'),_0x4ea4('0xee')),{'interaction':_0x3eeae2})[_0x4ea4('0x29')](function(_0x2afd36){return new BPromise(function(_0x1e1a41,_0x5b76ec){pdf[_0x4ea4('0xb9')](_0x2afd36,_0x41ee0d)[_0x4ea4('0xef')](path[_0x4ea4('0xca')](_0x30e611,_0x4ea4('0xf0')+_0x9bf286['id']+'-'+_0x5e8e77+_0x4ea4('0xf1')),function(_0x1e608a,_0x14922a){if(_0x1e608a)return _0x5b76ec(_0x1e608a);_0x1e1a41(_0x14922a);});});})[_0x4ea4('0x29')](function(){return new BPromise(function(_0x9bc55d,_0x21a99e){zipdir(_0x30e611,{'saveTo':_0x1bfc90},function(_0x5edea0,_0x2df344){if(_0x5edea0)return _0x21a99e(_0x5edea0);return _0x9bc55d(_0x2df344);});})[_0x4ea4('0x29')](function(){return new BPromise(function(_0x4f8bc8,_0x5521a9){rimraf(_0x30e611,function(_0x42ae7a){if(_0x42ae7a)_0x5521a9(_0x42ae7a);return _0x4f8bc8();});});})[_0x4ea4('0x29')](function(){return _0x1171cd[_0x4ea4('0xf2')](_0x1bfc90,_0x48a5bd,function(_0x28567d){if(_0x28567d){console['log'](_0x4ea4('0xf3'),_0x28567d);}else{fs[_0x4ea4('0xf4')](_0x1bfc90);}});});});}else{return _0x1171cd[_0x4ea4('0x21')](0xc8);}})[_0x4ea4('0x32')](handleError(_0x1171cd,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 009011e..ddb2892 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 _0xfc56=['unreadMessages','length','emit','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','Users'];(function(_0xcbb8db,_0x1f0a12){var _0x2fdcac=function(_0x2eedc9){while(--_0x2eedc9){_0xcbb8db['push'](_0xcbb8db['shift']());}};_0x2fdcac(++_0x1f0a12);}(_0xfc56,0xd7));var _0x6fc5=function(_0x549d39,_0x939965){_0x549d39=_0x549d39-0x0;var _0x2478e8=_0xfc56[_0x549d39];return _0x2478e8;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x6fc5('0x0'))['db'][_0x6fc5('0x1')];var WhatsappMessage=require(_0x6fc5('0x0'))['db'][_0x6fc5('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x6fc5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6fc5('0x4'),'afterDestroy':_0x6fc5('0x5')};function emitEvent(_0x2e3075){return function(_0x25d1da,_0x47ccb9,_0x519723){_0x25d1da[_0x6fc5('0x6')]({'attributes':['id'],'raw':!![]})[_0x6fc5('0x7')](function(_0x498547){_0x25d1da[_0x6fc5('0x8')](_0x6fc5('0x9'),_0x498547['map'](function(_0x4cc1b0){return{'id':_0x4cc1b0['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x25d1da['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6fc5('0x7')](function(_0x56f36d){_0x25d1da[_0x6fc5('0x8')](_0x6fc5('0xa'),_0x56f36d[_0x6fc5('0xb')]);WhatsappInteractionEvents[_0x6fc5('0xc')](_0x2e3075+':'+_0x25d1da['id'],_0x25d1da);WhatsappInteractionEvents[_0x6fc5('0xc')](_0x2e3075,_0x25d1da);_0x519723(null);})['catch'](_0x519723(null));};}for(var e in events){if(events[_0x6fc5('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x6fc5('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x5d6f=['emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','WhatsappMessage','save','update','getUsers','then','Users','map','findAll','setDataValue','unreadMessages'];(function(_0x4d6cde,_0x3fe6c2){var _0x19966d=function(_0x4782bf){while(--_0x4782bf){_0x4d6cde['push'](_0x4d6cde['shift']());}};_0x19966d(++_0x3fe6c2);}(_0x5d6f,0xd1));var _0xf5d6=function(_0x3f6ffe,_0xf64c5){_0x3f6ffe=_0x3f6ffe-0x0;var _0x7dd7ce=_0x5d6f[_0x3f6ffe];return _0x7dd7ce;};'use strict';var EventEmitter=require(_0xf5d6('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xf5d6('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xf5d6('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf5d6('0x3'),'afterUpdate':_0xf5d6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4a131b){return function(_0x28a3d1,_0x8e11b9,_0x3a354c){_0x28a3d1[_0xf5d6('0x5')]({'attributes':['id'],'raw':!![]})[_0xf5d6('0x6')](function(_0x47da84){_0x28a3d1['setDataValue'](_0xf5d6('0x7'),_0x47da84[_0xf5d6('0x8')](function(_0x1eded4){return{'id':_0x1eded4['id']};}));return WhatsappMessage[_0xf5d6('0x9')]({'where':{'WhatsappInteractionId':_0x28a3d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf5d6('0x6')](function(_0x485ec3){_0x28a3d1[_0xf5d6('0xa')](_0xf5d6('0xb'),_0x485ec3['length']);WhatsappInteractionEvents[_0xf5d6('0xc')](_0x4a131b+':'+_0x28a3d1['id'],_0x28a3d1);WhatsappInteractionEvents[_0xf5d6('0xc')](_0x4a131b,_0x28a3d1);_0x3a354c(null);})[_0xf5d6('0xd')](_0x3a354c(null));};}for(var e in events){if(events[_0xf5d6('0xe')](e)){var event=events[e];WhatsappInteraction[_0xf5d6('0xf')](e,emitEvent(event));}}module[_0xf5d6('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 071225c..82b47fb 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 _0xc618=['closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','whatsapp_interactions','changed'];(function(_0x32dfc3,_0x11e933){var _0x25cb3a=function(_0x5eb8dc){while(--_0x5eb8dc){_0x32dfc3['push'](_0x32dfc3['shift']());}};_0x25cb3a(++_0x11e933);}(_0xc618,0x13e));var _0x8c61=function(_0x328609,_0x159f03){_0x328609=_0x328609-0x0;var _0x40ca2b=_0xc618[_0x328609];return _0x40ca2b;};'use strict';var _=require(_0x8c61('0x0'));var util=require(_0x8c61('0x1'));var logger=require(_0x8c61('0x2'))('api');var moment=require(_0x8c61('0x3'));var BPromise=require(_0x8c61('0x4'));var rp=require(_0x8c61('0x5'));var fs=require('fs');var path=require(_0x8c61('0x6'));var rimraf=require(_0x8c61('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x8c61('0x8')]=function(_0x4a1b49,_0x13d847){return _0x4a1b49[_0x8c61('0x9')]('WhatsappInteraction',attributes,{'tableName':_0x8c61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2bf45f,_0x5dff5f,_0x3b7a6a){if(_0x2bf45f[_0x8c61('0xb')](_0x8c61('0xc'))){_0x2bf45f['closedAt']=moment()[_0x8c61('0xd')](_0x8c61('0xe'));}_0x3b7a6a(null,_0x2bf45f);}}});}; \ No newline at end of file +var _0x2b68=['request-promise','path','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','api','moment'];(function(_0x24ccc7,_0x4372ae){var _0x41c4bc=function(_0x4f972c){while(--_0x4f972c){_0x24ccc7['push'](_0x24ccc7['shift']());}};_0x41c4bc(++_0x4372ae);}(_0x2b68,0x194));var _0x82b6=function(_0x1715a2,_0x13d1d3){_0x1715a2=_0x1715a2-0x0;var _0x447fc1=_0x2b68[_0x1715a2];return _0x447fc1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x82b6('0x0'));var moment=require(_0x82b6('0x1'));var BPromise=require('bluebird');var rp=require(_0x82b6('0x2'));var fs=require('fs');var path=require(_0x82b6('0x3'));var rimraf=require(_0x82b6('0x4'));var config=require(_0x82b6('0x5'));var attributes=require('./whatsappInteraction.attributes');module[_0x82b6('0x6')]=function(_0x5cd7ab,_0x489e2b){return _0x5cd7ab[_0x82b6('0x7')](_0x82b6('0x8'),attributes,{'tableName':_0x82b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3acf82,_0x58e04b,_0x2b9e71){if(_0x3acf82[_0x82b6('0xa')](_0x82b6('0xb'))){_0x3acf82[_0x82b6('0xc')]=moment()['format'](_0x82b6('0xd'));}_0x2b9e71(null,_0x3acf82);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index ecb4593..28b85bf 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 _0x9826=['jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','WhatsappInteraction','body','options','raw','where','UpdateWhatsappInteraction','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x177e72,_0x28bf32){var _0x392698=function(_0x45a052){while(--_0x45a052){_0x177e72['push'](_0x177e72['shift']());}};_0x392698(++_0x28bf32);}(_0x9826,0xeb));var _0x6982=function(_0x569271,_0x2a06e7){_0x569271=_0x569271-0x0;var _0x3579ac=_0x9826[_0x569271];return _0x3579ac;};'use strict';var _=require(_0x6982('0x0'));var util=require(_0x6982('0x1'));var moment=require(_0x6982('0x2'));var BPromise=require(_0x6982('0x3'));var rs=require(_0x6982('0x4'));var fs=require('fs');var Redis=require(_0x6982('0x5'));var db=require(_0x6982('0x6'))['db'];var utils=require(_0x6982('0x7'));var logger=require(_0x6982('0x8'))(_0x6982('0x9'));var config=require(_0x6982('0xa'));var jayson=require(_0x6982('0xb'));var client=jayson[_0x6982('0xc')][_0x6982('0xd')]({'port':0x232a});config['redis']=_[_0x6982('0xe')](config[_0x6982('0xf')],{'host':_0x6982('0x10'),'port':0x18eb});var socket=require(_0x6982('0x11'))(new Redis(config['redis']));require(_0x6982('0x12'))[_0x6982('0x13')](socket);function respondWithRpcPromise(_0x1435ee,_0x1e14cb,_0xf38e68){return new BPromise(function(_0x2bec13,_0x12f31a){return client[_0x6982('0x14')](_0x1435ee,_0xf38e68)[_0x6982('0x15')](function(_0x4693ca){logger[_0x6982('0x16')](_0x6982('0x17'),_0x1e14cb,_0x6982('0x18'));logger[_0x6982('0x19')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x1e14cb,_0x6982('0x18'),JSON[_0x6982('0x1a')](_0x4693ca));if(_0x4693ca[_0x6982('0x1b')]){if(_0x4693ca[_0x6982('0x1b')]['code']===0x1f4){logger[_0x6982('0x1b')](_0x6982('0x17'),_0x1e14cb,_0x4693ca[_0x6982('0x1b')]['message']);return _0x12f31a(_0x4693ca[_0x6982('0x1b')]['message']);}logger[_0x6982('0x1b')](_0x6982('0x17'),_0x1e14cb,_0x4693ca[_0x6982('0x1b')][_0x6982('0x1c')]);return _0x2bec13(_0x4693ca['error']['message']);}else{logger[_0x6982('0x16')](_0x6982('0x17'),_0x1e14cb,_0x6982('0x18'));_0x2bec13(_0x4693ca[_0x6982('0x1d')][_0x6982('0x1c')]);}})[_0x6982('0x1e')](function(_0x3b832d){logger['error'](_0x6982('0x17'),_0x1e14cb,_0x3b832d);_0x12f31a(_0x3b832d);});});}exports['UpdateWhatsappInteraction']=function(_0x406335){var _0x17478d=this;return new Promise(function(_0x3d6612,_0x2e8415){return db[_0x6982('0x1f')]['update'](_0x406335[_0x6982('0x20')],{'raw':_0x406335['options']?_0x406335[_0x6982('0x21')][_0x6982('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x406335[_0x6982('0x21')]?_0x406335[_0x6982('0x21')][_0x6982('0x23')]||null:null,'attributes':_0x406335[_0x6982('0x21')]?_0x406335['options']['attributes']||null:null,'limit':_0x406335['options']?_0x406335['options']['limit']||null:null})[_0x6982('0x15')](function(_0x516312){logger['info']('UpdateWhatsappInteraction',_0x406335);logger[_0x6982('0x19')](_0x6982('0x24'),_0x406335,JSON[_0x6982('0x1a')](_0x516312));_0x3d6612(_0x516312);})[_0x6982('0x1e')](function(_0x3bc612){logger[_0x6982('0x1b')]('UpdateWhatsappInteraction',_0x3bc612[_0x6982('0x1c')],_0x406335);_0x2e8415(_0x17478d[_0x6982('0x1b')](0x1f4,_0x3bc612[_0x6982('0x1c')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4b86d9){return new Promise(function(_0x45f12b,_0x1375eb){return db['WhatsappInteraction']['find']({'where':_0x4b86d9[_0x6982('0x21')]?_0x4b86d9[_0x6982('0x21')][_0x6982('0x23')]||null:null})[_0x6982('0x15')](function(_0x270438){if(_0x270438){return _0x270438[_0x6982('0x25')](_0x4b86d9[_0x6982('0x20')]['ids'],_[_0x6982('0x26')](_0x4b86d9['body'],['ids','id'])||{});}})[_0x6982('0x27')](function(_0x5d4f16){logger[_0x6982('0x16')]('AddTags',_0x4b86d9);logger['debug'](_0x6982('0x28'),_0x4b86d9,JSON['stringify'](_0x5d4f16));_0x45f12b(_0x5d4f16);})[_0x6982('0x1e')](function(_0x24fc50){logger[_0x6982('0x1b')](_0x6982('0x28'),_0x24fc50[_0x6982('0x1c')],_0x4b86d9);_0x1375eb(_this[_0x6982('0x1b')](0x1f4,_0x24fc50[_0x6982('0x1c')]));});});}; \ No newline at end of file +var _0x12d5=['spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','update','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','ids','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12d5,0x1ee));var _0x512d=function(_0x18d699,_0x165e23){_0x18d699=_0x18d699-0x0;var _0x509f0c=_0x12d5[_0x18d699];return _0x509f0c;};'use strict';var _=require(_0x512d('0x0'));var util=require(_0x512d('0x1'));var moment=require(_0x512d('0x2'));var BPromise=require('bluebird');var rs=require(_0x512d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x512d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x512d('0x5'))(_0x512d('0x6'));var config=require(_0x512d('0x7'));var jayson=require(_0x512d('0x8'));var client=jayson[_0x512d('0x9')][_0x512d('0xa')]({'port':0x232a});config['redis']=_[_0x512d('0xb')](config[_0x512d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x512d('0xd'))(new Redis(config[_0x512d('0xc')]));require('./whatsappInteraction.socket')[_0x512d('0xe')](socket);function respondWithRpcPromise(_0x215a40,_0x3645b6,_0x367df3){return new BPromise(function(_0x3d2473,_0x339c25){return client[_0x512d('0xf')](_0x215a40,_0x367df3)[_0x512d('0x10')](function(_0x28b7d9){logger[_0x512d('0x11')](_0x512d('0x12'),_0x3645b6,_0x512d('0x13'));logger[_0x512d('0x14')](_0x512d('0x15'),_0x3645b6,_0x512d('0x13'),JSON[_0x512d('0x16')](_0x28b7d9));if(_0x28b7d9[_0x512d('0x17')]){if(_0x28b7d9[_0x512d('0x17')][_0x512d('0x18')]===0x1f4){logger[_0x512d('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x3645b6,_0x28b7d9['error'][_0x512d('0x19')]);return _0x339c25(_0x28b7d9[_0x512d('0x17')][_0x512d('0x19')]);}logger[_0x512d('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x3645b6,_0x28b7d9[_0x512d('0x17')][_0x512d('0x19')]);return _0x3d2473(_0x28b7d9['error'][_0x512d('0x19')]);}else{logger[_0x512d('0x11')](_0x512d('0x12'),_0x3645b6,_0x512d('0x13'));_0x3d2473(_0x28b7d9[_0x512d('0x1a')]['message']);}})[_0x512d('0x1b')](function(_0x266a30){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x3645b6,_0x266a30);_0x339c25(_0x266a30);});});}exports['UpdateWhatsappInteraction']=function(_0x1d0c66){var _0x1f70ab=this;return new Promise(function(_0x234ce5,_0x1ff63f){return db[_0x512d('0x1c')][_0x512d('0x1d')](_0x1d0c66['body'],{'raw':_0x1d0c66[_0x512d('0x1e')]?_0x1d0c66['options'][_0x512d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d0c66[_0x512d('0x1e')]?_0x1d0c66[_0x512d('0x1e')][_0x512d('0x20')]||null:null,'attributes':_0x1d0c66[_0x512d('0x1e')]?_0x1d0c66['options'][_0x512d('0x21')]||null:null,'limit':_0x1d0c66[_0x512d('0x1e')]?_0x1d0c66[_0x512d('0x1e')][_0x512d('0x22')]||null:null})[_0x512d('0x10')](function(_0x244561){logger[_0x512d('0x11')](_0x512d('0x23'),_0x1d0c66);logger['debug'](_0x512d('0x23'),_0x1d0c66,JSON['stringify'](_0x244561));_0x234ce5(_0x244561);})['catch'](function(_0x7ec5b4){logger['error']('UpdateWhatsappInteraction',_0x7ec5b4[_0x512d('0x19')],_0x1d0c66);_0x1ff63f(_0x1f70ab[_0x512d('0x17')](0x1f4,_0x7ec5b4['message']));});});};exports[_0x512d('0x24')]=function(_0xadd806){return new Promise(function(_0x5b82d8,_0x5ea6bf){return db[_0x512d('0x1c')]['find']({'where':_0xadd806[_0x512d('0x1e')]?_0xadd806[_0x512d('0x1e')][_0x512d('0x20')]||null:null})[_0x512d('0x10')](function(_0x1af194){if(_0x1af194){return _0x1af194['addTags'](_0xadd806['body'][_0x512d('0x25')],_['omit'](_0xadd806[_0x512d('0x26')],['ids','id'])||{});}})[_0x512d('0x27')](function(_0x35e4a5){logger[_0x512d('0x11')](_0x512d('0x28'),_0xadd806);logger['debug'](_0x512d('0x28'),_0xadd806,JSON[_0x512d('0x16')](_0x35e4a5));_0x5b82d8(_0x35e4a5);})['catch'](function(_0x4d12bf){logger[_0x512d('0x17')]('AddTags',_0x4d12bf[_0x512d('0x19')],_0xadd806);_0x5ea6bf(_this[_0x512d('0x17')](0x1f4,_0x4d12bf[_0x512d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 2a59277..1ae85a2 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 _0x0c52=['length','whatsappInteraction:','./whatsappInteraction.events','removeListener'];(function(_0x5c6a1a,_0x407cd9){var _0x3e2f16=function(_0x3eba39){while(--_0x3eba39){_0x5c6a1a['push'](_0x5c6a1a['shift']());}};_0x3e2f16(++_0x407cd9);}(_0x0c52,0x1d2));var _0x20c5=function(_0x5d99f8,_0x4bd840){_0x5d99f8=_0x5d99f8-0x0;var _0x4440c5=_0x0c52[_0x5d99f8];return _0x4440c5;};'use strict';var WhatsappInteractionEvents=require(_0x20c5('0x0'));var events=['save','remove','update'];function createListener(_0x42dc11,_0x50008b){return function(_0x4ffc7f){_0x50008b['emit'](_0x42dc11,_0x4ffc7f);};}function removeListener(_0x293629,_0x3caa56){return function(){WhatsappInteractionEvents[_0x20c5('0x1')](_0x293629,_0x3caa56);};}exports['register']=function(_0x34ee90){for(var _0x192631=0x0,_0x33bed6=events[_0x20c5('0x2')];_0x192631<_0x33bed6;_0x192631++){var _0x41fa08=events[_0x192631];var _0x4649ab=createListener(_0x20c5('0x3')+_0x41fa08,_0x34ee90);WhatsappInteractionEvents['on'](_0x41fa08,_0x4649ab);}}; \ No newline at end of file +var _0x0b5a=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener'];(function(_0x2962b4,_0x4b0786){var _0x411b7d=function(_0x363aad){while(--_0x363aad){_0x2962b4['push'](_0x2962b4['shift']());}};_0x411b7d(++_0x4b0786);}(_0x0b5a,0x1f3));var _0xa0b5=function(_0x3f6367,_0x5eef68){_0x3f6367=_0x3f6367-0x0;var _0x5d93ea=_0x0b5a[_0x3f6367];return _0x5d93ea;};'use strict';var WhatsappInteractionEvents=require(_0xa0b5('0x0'));var events=[_0xa0b5('0x1'),_0xa0b5('0x2'),'update'];function createListener(_0x5a5396,_0x28c91a){return function(_0x123a08){_0x28c91a[_0xa0b5('0x3')](_0x5a5396,_0x123a08);};}function removeListener(_0x4f891b,_0x45d650){return function(){WhatsappInteractionEvents[_0xa0b5('0x4')](_0x4f891b,_0x45d650);};}exports['register']=function(_0x3b5bc8){for(var _0x1cd6d2=0x0,_0x2a1049=events[_0xa0b5('0x5')];_0x1cd6d2<_0x2a1049;_0x1cd6d2++){var _0x40b9d6=events[_0x1cd6d2];var _0x4927e1=createListener(_0xa0b5('0x6')+_0x40b9d6,_0x3b5bc8);WhatsappInteractionEvents['on'](_0x40b9d6,_0x4927e1);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b976feb..a3215ce 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 _0xdbeb=['../../components/interaction/service','get','isAuthenticated','describe','show','post','tracked','whatsapp','create','/:id/status','status','put','/:id','update','/:id/reject','destroy','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdbeb,0x1c9));var _0xbdbe=function(_0x2969fe,_0x4e6f0d){_0x2969fe=_0x2969fe-0x0;var _0x563e49=_0xdbeb[_0x2969fe];return _0x563e49;};'use strict';var multer=require('multer');var util=require(_0xbdbe('0x0'));var path=require('path');var timeout=require(_0xbdbe('0x1'));var express=require(_0xbdbe('0x2'));var router=express[_0xbdbe('0x3')]();var auth=require(_0xbdbe('0x4'));var interaction=require(_0xbdbe('0x5'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xbdbe('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xbdbe('0x7')](),controller[_0xbdbe('0x8')]);router['get']('/:id',auth[_0xbdbe('0x7')](),controller[_0xbdbe('0x9')]);router[_0xbdbe('0xa')]('/',auth['isAuthenticated'](),interaction[_0xbdbe('0xb')](_0xbdbe('0xc'),'whatsappmessage:create'),controller[_0xbdbe('0xd')]);router[_0xbdbe('0xa')](_0xbdbe('0xe'),controller[_0xbdbe('0xf')]);router[_0xbdbe('0x10')](_0xbdbe('0x11'),auth['isAuthenticated'](),controller[_0xbdbe('0x12')]);router[_0xbdbe('0x10')]('/:id/accept',auth[_0xbdbe('0x7')](),controller['accept']);router['put'](_0xbdbe('0x13'),auth[_0xbdbe('0x7')](),controller['reject']);router['delete'](_0xbdbe('0x11'),auth[_0xbdbe('0x7')](),controller[_0xbdbe('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8d94=['../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x2f2af2,_0x512ad3){var _0x134c03=function(_0x75519a){while(--_0x75519a){_0x2f2af2['push'](_0x2f2af2['shift']());}};_0x134c03(++_0x512ad3);}(_0x8d94,0x6f));var _0x48d9=function(_0x3da575,_0x196a12){_0x3da575=_0x3da575-0x0;var _0x2ef46a=_0x8d94[_0x3da575];return _0x2ef46a;};'use strict';var multer=require(_0x48d9('0x0'));var util=require(_0x48d9('0x1'));var path=require('path');var timeout=require(_0x48d9('0x2'));var express=require('express');var router=express[_0x48d9('0x3')]();var auth=require(_0x48d9('0x4'));var interaction=require(_0x48d9('0x5'));var config=require(_0x48d9('0x6'));var controller=require(_0x48d9('0x7'));router[_0x48d9('0x8')]('/',auth['isAuthenticated'](),controller[_0x48d9('0x9')]);router[_0x48d9('0x8')](_0x48d9('0xa'),auth[_0x48d9('0xb')](),controller[_0x48d9('0xc')]);router['get'](_0x48d9('0xd'),auth[_0x48d9('0xb')](),controller[_0x48d9('0xe')]);router['post']('/',auth[_0x48d9('0xb')](),interaction[_0x48d9('0xf')](_0x48d9('0x10'),_0x48d9('0x11')),controller[_0x48d9('0x12')]);router[_0x48d9('0x13')](_0x48d9('0x14'),controller['status']);router[_0x48d9('0x15')](_0x48d9('0xd'),auth[_0x48d9('0xb')](),controller[_0x48d9('0x16')]);router[_0x48d9('0x15')](_0x48d9('0x17'),auth[_0x48d9('0xb')](),controller[_0x48d9('0x18')]);router[_0x48d9('0x15')](_0x48d9('0x19'),auth['isAuthenticated'](),controller[_0x48d9('0x1a')]);router[_0x48d9('0x1b')](_0x48d9('0xd'),auth[_0x48d9('0xb')](),controller['destroy']);module[_0x48d9('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 0cd4885..9a41e54 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 _0xf98c=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x13e3c4,_0xffbb23){var _0xfcd481=function(_0x43ec65){while(--_0x43ec65){_0x13e3c4['push'](_0x13e3c4['shift']());}};_0xfcd481(++_0xffbb23);}(_0xf98c,0xb1));var _0xcf98=function(_0x3e11ec,_0x935dff){_0x3e11ec=_0x3e11ec-0x0;var _0x511e65=_0xf98c[_0x3e11ec];return _0x511e65;};'use strict';var Sequelize=require(_0xcf98('0x0'));module['exports']={'body':{'type':Sequelize[_0xcf98('0x1')](_0xcf98('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcf98('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcf98('0x4')]('in',_0xcf98('0x5')),'defaultValue':_0xcf98('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcf98('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xcf98('0x7')]},'secret':{'type':Sequelize[_0xcf98('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xcf98('0x1')]}}; \ No newline at end of file +var _0xf0f1=['out','STRING','DATE','sequelize','BOOLEAN','ENUM'];(function(_0x465bf2,_0x336697){var _0x48b0df=function(_0x4e3059){while(--_0x4e3059){_0x465bf2['push'](_0x465bf2['shift']());}};_0x48b0df(++_0x336697);}(_0xf0f1,0x1cb));var _0x1f0f=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xf0f1[_0x12f688];return _0x59c3de;};'use strict';var Sequelize=require(_0x1f0f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1f0f('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f0f('0x2')]('in',_0x1f0f('0x3')),'defaultValue':_0x1f0f('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1f0f('0x4')](0xbe)},'phone':{'type':Sequelize[_0x1f0f('0x4')]},'readAt':{'type':Sequelize[_0x1f0f('0x5')]},'secret':{'type':Sequelize[_0x1f0f('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1f0f('0x4')]},'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 fbb9d3c..64f3213 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 _0x0295=['to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','acceptMessage','manual','interface','SIP/%s','channel','acceptmessage','../../config/logger','agent','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','update','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0x1affe9,_0x29666){var _0x3927f2=function(_0x1e0b67){while(--_0x1e0b67){_0x1affe9['push'](_0x1affe9['shift']());}};_0x3927f2(++_0x29666);}(_0x0295,0x1f0));var _0x5029=function(_0x4ae506,_0x5a97ed){_0x4ae506=_0x4ae506-0x0;var _0x18e3a1=_0x0295[_0x4ae506];return _0x18e3a1;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');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'];config[_0x5029('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5029('0x15')]));require(_0x5029('0x16'))[_0x5029('0x17')](socket);var jayson=require(_0x5029('0x18'));var client=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232c});var client9002=jayson[_0x5029('0x19')][_0x5029('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x10bf55,_0x326923,_0x457c73,_0x353cba){return new BPromise(function(_0x3786b5,_0x2c273c){var _0x343918=_0x353cba||client;return _0x343918['request'](_0x10bf55,_0x457c73)[_0x5029('0x1b')](function(_0x31a155){logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x326923,_0x5029('0x1e'));logger[_0x5029('0x1f')](_0x5029('0x20'),_0x326923,'request\x20sent',JSON[_0x5029('0x21')](_0x31a155));if(_0x31a155['error']){if(_0x31a155[_0x5029('0x22')][_0x5029('0x23')]===0x1f4){logger[_0x5029('0x22')](_0x5029('0x1d'),_0x326923,_0x31a155['error']['message']);return _0x2c273c(_0x31a155[_0x5029('0x22')]['message']);}logger[_0x5029('0x22')](_0x5029('0x1d'),_0x326923,_0x31a155[_0x5029('0x22')][_0x5029('0x24')]);return _0x3786b5(_0x31a155[_0x5029('0x22')][_0x5029('0x24')]);}else{logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x326923,_0x5029('0x1e'));_0x3786b5(_0x31a155['result']['message']);}})['catch'](function(_0x588d90){logger[_0x5029('0x22')]('WhatsappMessage,\x20%s,\x20%s',_0x326923,_0x588d90);_0x2c273c(_0x588d90);});});}function respondWithStatusCode(_0x5727e9,_0x181da0){_0x181da0=_0x181da0||0xcc;return function(_0x1e7e61){if(_0x1e7e61){return _0x5727e9[_0x5029('0x25')](_0x181da0);}return _0x5727e9['status'](_0x181da0)[_0x5029('0x26')]();};}function respondWithResult(_0xb14bc,_0x5e45c4){_0x5e45c4=_0x5e45c4||0xc8;return function(_0x2b6d99){if(_0x2b6d99){return _0xb14bc[_0x5029('0x27')](_0x5e45c4)[_0x5029('0x28')](_0x2b6d99);}};}function respondWithFilteredResult(_0x4a24b9,_0x32da06){return function(_0x251f99){if(_0x251f99){var _0xe5313e=_0x251f99['count'],_0x4b6f92=_0x32da06[_0x5029('0x29')],_0x2cedf6=_0x32da06[_0x5029('0x29')]+_0x32da06[_0x5029('0x2a')],_0x2bb398;if(_0x2cedf6>=_0xe5313e){_0x2cedf6=_0xe5313e;_0x2bb398=0xc8;}else{_0x2bb398=0xce;}_0x4a24b9[_0x5029('0x27')](_0x2bb398);return _0x4a24b9[_0x5029('0x2b')](_0x5029('0x2c'),_0x4b6f92+'-'+_0x2cedf6+'/'+_0xe5313e)[_0x5029('0x28')](_0x251f99);}return null;};}function patchUpdates(_0x465153){return function(_0x250156){try{jsonpatch[_0x5029('0x2d')](_0x250156,_0x465153,!![]);}catch(_0x358a2b){return BPromise[_0x5029('0x2e')](_0x358a2b);}return _0x250156['save']();};}function saveUpdates(_0x11ae38,_0x5cb04b){return function(_0x31c621){if(_0x31c621){return _0x31c621['update'](_0x11ae38)['then'](function(_0x2bc434){return _0x2bc434;});}return null;};}function removeEntity(_0x447680,_0x1f9173){return function(_0x4b7330){if(_0x4b7330){return _0x4b7330[_0x5029('0x2f')]()[_0x5029('0x1b')](function(){_0x447680[_0x5029('0x27')](0xcc)[_0x5029('0x26')]();});}};}function handleEntityNotFound(_0x1bb896,_0x4513b9){return function(_0x46ec59){if(!_0x46ec59){_0x1bb896[_0x5029('0x25')](0x194);}return _0x46ec59;};}function handleError(_0x456cfc,_0x5c9f10){_0x5c9f10=_0x5c9f10||0x1f4;return function(_0x1db45c){logger[_0x5029('0x22')](_0x1db45c[_0x5029('0x30')]);if(_0x1db45c[_0x5029('0x31')]){delete _0x1db45c['name'];}_0x456cfc[_0x5029('0x27')](_0x5c9f10)[_0x5029('0x32')](_0x1db45c);};}exports[_0x5029('0x33')]=function(_0x594549,_0x4904cc){var _0x2d1ccb={},_0x17756b={},_0x507443={'count':0x0,'rows':[]};var _0x57784c=_[_0x5029('0x34')](db[_0x5029('0x35')][_0x5029('0x36')],function(_0x3210cb){return{'name':_0x3210cb[_0x5029('0x37')],'type':_0x3210cb[_0x5029('0x38')][_0x5029('0x39')]};});_0x17756b[_0x5029('0x3a')]=_[_0x5029('0x34')](_0x57784c,_0x5029('0x31'));_0x17756b[_0x5029('0x3b')]=_[_0x5029('0x3c')](_0x594549[_0x5029('0x3b')]);_0x17756b[_0x5029('0x3d')]=_['intersection'](_0x17756b['model'],_0x17756b[_0x5029('0x3b')]);_0x2d1ccb[_0x5029('0x3e')]=_[_0x5029('0x3f')](_0x17756b['model'],qs[_0x5029('0x40')](_0x594549[_0x5029('0x3b')]['fields']));_0x2d1ccb[_0x5029('0x3e')]=_0x2d1ccb['attributes'][_0x5029('0x41')]?_0x2d1ccb['attributes']:_0x17756b[_0x5029('0x3a')];if(!_0x594549[_0x5029('0x3b')][_0x5029('0x42')](_0x5029('0x43'))){_0x2d1ccb[_0x5029('0x2a')]=qs[_0x5029('0x2a')](_0x594549[_0x5029('0x3b')][_0x5029('0x2a')]);_0x2d1ccb[_0x5029('0x29')]=qs['offset'](_0x594549[_0x5029('0x3b')][_0x5029('0x29')]);}_0x2d1ccb[_0x5029('0x44')]=qs[_0x5029('0x45')](_0x594549[_0x5029('0x3b')][_0x5029('0x45')]);_0x2d1ccb['where']=qs[_0x5029('0x3d')](_[_0x5029('0x46')](_0x594549[_0x5029('0x3b')],_0x17756b[_0x5029('0x3d')]),_0x57784c);if(_0x594549[_0x5029('0x3b')]['filter']){_0x2d1ccb[_0x5029('0x47')]=_[_0x5029('0x48')](_0x2d1ccb[_0x5029('0x47')],{'$or':_[_0x5029('0x34')](_0x57784c,function(_0xfbfbb2){if(_0xfbfbb2[_0x5029('0x38')]!==_0x5029('0x49')){var _0x37660b={};_0x37660b[_0xfbfbb2[_0x5029('0x31')]]={'$like':'%'+_0x594549['query'][_0x5029('0x4a')]+'%'};return _0x37660b;}})});}_0x2d1ccb=_[_0x5029('0x48')]({},_0x2d1ccb,_0x594549[_0x5029('0x4b')]);var _0xdb3e78={'where':_0x2d1ccb['where']};return db['WhatsappMessage'][_0x5029('0x4c')](_0xdb3e78)[_0x5029('0x1b')](function(_0x2a07d4){_0x507443[_0x5029('0x4c')]=_0x2a07d4;if(_0x594549[_0x5029('0x3b')][_0x5029('0x4d')]){_0x2d1ccb[_0x5029('0x4e')]=[{'all':!![]}];}return db[_0x5029('0x35')][_0x5029('0x4f')](_0x2d1ccb);})[_0x5029('0x1b')](function(_0x2c2e0e){_0x507443[_0x5029('0x50')]=_0x2c2e0e;return _0x507443;})[_0x5029('0x1b')](respondWithFilteredResult(_0x4904cc,_0x2d1ccb))[_0x5029('0x51')](handleError(_0x4904cc,null));};exports[_0x5029('0x52')]=function(_0x175cc0,_0x10fc07){var _0x149cf6={'raw':!![],'where':{'id':_0x175cc0[_0x5029('0x53')]['id']}},_0x274beb={};_0x274beb[_0x5029('0x3a')]=_['keys'](db[_0x5029('0x35')]['rawAttributes']);_0x274beb[_0x5029('0x3b')]=_[_0x5029('0x3c')](_0x175cc0['query']);_0x274beb['filters']=_[_0x5029('0x3f')](_0x274beb['model'],_0x274beb['query']);_0x149cf6[_0x5029('0x3e')]=_[_0x5029('0x3f')](_0x274beb[_0x5029('0x3a')],qs['fields'](_0x175cc0['query'][_0x5029('0x40')]));_0x149cf6[_0x5029('0x3e')]=_0x149cf6['attributes'][_0x5029('0x41')]?_0x149cf6['attributes']:_0x274beb[_0x5029('0x3a')];if(_0x175cc0['query'][_0x5029('0x4d')]){_0x149cf6[_0x5029('0x4e')]=[{'all':!![]}];}_0x149cf6=_[_0x5029('0x48')]({},_0x149cf6,_0x175cc0[_0x5029('0x4b')]);return db[_0x5029('0x35')][_0x5029('0x54')](_0x149cf6)[_0x5029('0x1b')](handleEntityNotFound(_0x10fc07,null))[_0x5029('0x1b')](respondWithResult(_0x10fc07,null))['catch'](handleError(_0x10fc07,null));};exports[_0x5029('0x55')]=function(_0x5dd466,_0xc8b556){return db[_0x5029('0x35')]['create'](_0x5dd466[_0x5029('0x56')],{})['then'](respondWithResult(_0xc8b556,0xc9))['catch'](handleError(_0xc8b556,null));};exports['update']=function(_0x34e93a,_0x4b0c5f){if(_0x34e93a[_0x5029('0x56')]['id']){delete _0x34e93a[_0x5029('0x56')]['id'];}return db[_0x5029('0x35')]['find']({'where':{'id':_0x34e93a[_0x5029('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b0c5f,null))['then'](saveUpdates(_0x34e93a[_0x5029('0x56')],null))[_0x5029('0x1b')](respondWithResult(_0x4b0c5f,null))[_0x5029('0x51')](handleError(_0x4b0c5f,null));};exports[_0x5029('0x2f')]=function(_0x164179,_0x4e8d9f){return db[_0x5029('0x35')][_0x5029('0x54')]({'where':{'id':_0x164179[_0x5029('0x53')]['id']}})[_0x5029('0x1b')](handleEntityNotFound(_0x4e8d9f,null))['then'](removeEntity(_0x4e8d9f,null))[_0x5029('0x51')](handleError(_0x4e8d9f,null));};exports[_0x5029('0x57')]=function(_0x4d4a2d,_0x512de9){return db[_0x5029('0x35')][_0x5029('0x57')]()[_0x5029('0x1b')](respondWithResult(_0x512de9,null))[_0x5029('0x51')](handleError(_0x512de9,null));};var interaction_log=require('../../config/logger')(_0x5029('0x58'));exports[_0x5029('0x59')]=function(_0x77d63d,_0x2aebb3,_0x3a82f7){var _0x26f56f={'channel':'whatsapp'};if(_0x77d63d['body']['id']){delete _0x77d63d[_0x5029('0x56')]['id'];}_0x77d63d[_0x5029('0x56')][_0x5029('0x5a')]=!![];_0x77d63d['body'][_0x5029('0x5b')]=moment()[_0x5029('0x5c')](_0x5029('0x5d'));_0x77d63d[_0x5029('0x56')][_0x5029('0x5e')]=_0x77d63d['body'][_0x5029('0x5e')]||_0x77d63d[_0x5029('0x5f')]['id'];return db[_0x5029('0x35')]['find']({'where':{'id':_0x77d63d[_0x5029('0x53')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x5029('0x60')}]})['then'](handleEntityNotFound(_0x2aebb3,null))[_0x5029('0x1b')](saveUpdates(_0x77d63d[_0x5029('0x56')],null))[_0x5029('0x1b')](function(_0x2f5301){if(_0x2f5301){_0x26f56f[_0x5029('0x24')]=_0x2f5301[_0x5029('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x5029('0x54')]({'where':{'id':_0x2f5301[_0x5029('0x62')]}});}return null;})[_0x5029('0x1b')](handleEntityNotFound(_0x2aebb3,null))[_0x5029('0x1b')](function(_0x389700){if(_0x389700){return _0x389700['update']({'UserId':_0x77d63d[_0x5029('0x56')]['UserId'],'read1stAt':_[_0x5029('0x63')](_0x389700['read1stAt'])?moment()[_0x5029('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5029('0x1b')](function(_0x54daf9){if(_0x54daf9){_0x26f56f['interaction']=_0x54daf9[_0x5029('0x61')]({'plain':!![]});interaction_log['info'](_0x5029('0x64'),_0x77d63d[_0x5029('0x5f')]['id'],_0x77d63d[_0x5029('0x5f')]['name'],_0x77d63d[_0x5029('0x5f')]['role'],_0x26f56f[_0x5029('0x65')]['id'],_0x77d63d[_0x5029('0x56')]?JSON[_0x5029('0x21')](_0x77d63d[_0x5029('0x56')]):_0x5029('0x66'));return respondWithRpcPromise('AcceptMessage',_0x5029('0x67'),_0x26f56f);}return null;})[_0x5029('0x1b')](function(_0x5890ac){if(_0x5890ac){if(_0x77d63d[_0x5029('0x56')][_0x5029('0x68')]){_0x26f56f[_0x5029('0x24')][_0x5029('0x69')]=util[_0x5029('0x5c')](_0x5029('0x6a'),_0x77d63d['user']['name']);_0x26f56f[_0x5029('0x24')]['channel']=_0x26f56f[_0x5029('0x6b')];_0x26f56f[_0x5029('0x24')]['event']=_0x5029('0x59');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x5029('0x6c'),'message':_0x26f56f[_0x5029('0x24')]},client9002)[_0x5029('0x1b')](function(){return _0x26f56f;});}return _0x26f56f;}return null;})[_0x5029('0x1b')](respondWithResult(_0x2aebb3,null))['catch'](handleError(_0x2aebb3,null));};var interaction_log=require(_0x5029('0x6d'))(_0x5029('0x58'));exports['reject']=function(_0x269406,_0x73c036,_0x49e198){var _0x5b25b8={'agent':{},'channel':'whatsapp'};if(_0x269406[_0x5029('0x56')]['id']){delete _0x269406[_0x5029('0x56')]['id'];}_0x269406[_0x5029('0x56')][_0x5029('0x5e')]=_0x269406[_0x5029('0x56')][_0x5029('0x5e')]||_0x269406[_0x5029('0x5f')]['id'];_0x5b25b8[_0x5029('0x6e')]['id']=_0x269406[_0x5029('0x56')]['UserId'];return db['WhatsappMessage'][_0x5029('0x54')]({'where':{'id':_0x269406[_0x5029('0x53')]['id'],'UserId':null}})[_0x5029('0x1b')](handleEntityNotFound(_0x73c036,null))[_0x5029('0x1b')](function(_0x2d8c9a){if(_0x2d8c9a){_0x5b25b8[_0x5029('0x24')]=_0x2d8c9a[_0x5029('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x5029('0x54')]({'where':{'id':_0x2d8c9a[_0x5029('0x62')]}});}return null;})[_0x5029('0x1b')](handleEntityNotFound(_0x73c036,null))['then'](function(_0x3bf700){if(_0x3bf700){_0x5b25b8[_0x5029('0x65')]=_0x3bf700[_0x5029('0x61')]({'plain':!![]});interaction_log['info'](_0x5029('0x6f'),_0x269406[_0x5029('0x5f')]['id'],_0x269406[_0x5029('0x5f')]['name'],_0x269406[_0x5029('0x5f')][_0x5029('0x70')],_0x5b25b8['interaction']['id'],_0x269406[_0x5029('0x56')]?JSON[_0x5029('0x21')](_0x269406[_0x5029('0x56')]):_0x5029('0x66'));return respondWithRpcPromise(_0x5029('0x71'),'rejectMessage',_0x5b25b8);}return null;})[_0x5029('0x1b')](function(_0x3b6833){if(_0x3b6833){_0x3b6833[_0x5029('0x24')][_0x5029('0x69')]=util[_0x5029('0x5c')]('SIP/%s',_0x269406[_0x5029('0x5f')][_0x5029('0x31')]);_0x3b6833[_0x5029('0x24')]['channel']=_0x5b25b8[_0x5029('0x6b')];_0x3b6833[_0x5029('0x24')][_0x5029('0x72')]=_0x5029('0x2e');respondWithRpcPromise(_0x5029('0x73'),_0x5029('0x73'),{'event':_0x5029('0x74'),'message':_0x3b6833['message']},client9002);return _0x5b25b8;}return null;})[_0x5029('0x1b')](respondWithResult(_0x73c036,null))[_0x5029('0x51')](handleError(_0x73c036,null));};exports[_0x5029('0x27')]=function(_0xde6006,_0x2dcfee,_0x4c40d1){if(_0xde6006[_0x5029('0x56')]['id']){delete _0xde6006[_0x5029('0x56')]['id'];}var _0x389931;return db['WhatsappMessage'][_0x5029('0x54')]({'where':{'id':_0xde6006[_0x5029('0x53')]['id']}})['then'](handleEntityNotFound(_0x2dcfee,null))['then'](function(_0x524825){if(_0x524825){_0x389931=_0x524825;return db[_0x5029('0x75')][_0x5029('0x54')]({'where':{'id':_0x524825[_0x5029('0x76')]}});}})[_0x5029('0x1b')](handleEntityNotFound(_0x2dcfee,null))[_0x5029('0x1b')](function(_0x4c742f){if(_0x4c742f){logger[_0x5029('0x1f')](_0x5029('0x77'),_0x5029('0x27'),'received\x20delivery\x20report\x20from',_0x4c742f['type'],util[_0x5029('0x78')](_0xde6006[_0x5029('0x56')],{'showHidden':![],'depth':null}));switch(_0x4c742f[_0x5029('0x38')]){case _0x5029('0x79'):if(_0xde6006['body'][_0x5029('0x7a')]&&_0xde6006[_0x5029('0x56')][_0x5029('0x7a')]===_0x389931[_0x5029('0x7b')]&&_0xde6006[_0x5029('0x56')][_0x5029('0x7c')]&&_0xde6006[_0x5029('0x56')][_0x5029('0x7c')]==='read'){return _0x389931[_0x5029('0x7d')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5029('0x27'),'twilio',util[_0x5029('0x78')](_0xde6006[_0x5029('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x389931;}})[_0x5029('0x1b')](respondWithResult(_0x2dcfee,null))[_0x5029('0x51')](handleError(_0x2dcfee,null));}; \ No newline at end of file +var _0xadb5=['create','body','update','find','params','describe','whatsapp-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','format','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','request','WhatsappMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','show'];(function(_0x716e63,_0x2271d5){var _0x255a53=function(_0x1567b2){while(--_0x1567b2){_0x716e63['push'](_0x716e63['shift']());}};_0x255a53(++_0x2271d5);}(_0xadb5,0xad));var _0x5adb=function(_0x12275a,_0x49d985){_0x12275a=_0x12275a-0x0;var _0x45a9ae=_0xadb5[_0x12275a];return _0x45a9ae;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5adb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5adb('0x1'));var jsonpatch=require(_0x5adb('0x2'));var rp=require(_0x5adb('0x3'));var moment=require('moment');var BPromise=require(_0x5adb('0x4'));var Mustache=require(_0x5adb('0x5'));var util=require(_0x5adb('0x6'));var path=require('path');var sox=require(_0x5adb('0x7'));var csv=require(_0x5adb('0x8'));var ejs=require(_0x5adb('0x9'));var fs=require('fs');var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x8'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];config[_0x5adb('0x18')]=_['defaults'](config[_0x5adb('0x18')],{'host':_0x5adb('0x19'),'port':0x18eb});var socket=require(_0x5adb('0x1a'))(new Redis(config['redis']));require(_0x5adb('0x1b'))[_0x5adb('0x1c')](socket);var jayson=require(_0x5adb('0x1d'));var client=jayson['client'][_0x5adb('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x5adb('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x42a482,_0x30614e,_0x304784,_0x1c0f97){return new BPromise(function(_0x39d24d,_0xa29dc){var _0x42f4c6=_0x1c0f97||client;return _0x42f4c6[_0x5adb('0x1f')](_0x42a482,_0x304784)['then'](function(_0x3fff62){logger['info'](_0x5adb('0x20'),_0x30614e,'request\x20sent');logger[_0x5adb('0x21')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x30614e,'request\x20sent',JSON[_0x5adb('0x22')](_0x3fff62));if(_0x3fff62[_0x5adb('0x23')]){if(_0x3fff62[_0x5adb('0x23')][_0x5adb('0x24')]===0x1f4){logger[_0x5adb('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x30614e,_0x3fff62[_0x5adb('0x23')]['message']);return _0xa29dc(_0x3fff62['error'][_0x5adb('0x25')]);}logger[_0x5adb('0x23')](_0x5adb('0x20'),_0x30614e,_0x3fff62[_0x5adb('0x23')][_0x5adb('0x25')]);return _0x39d24d(_0x3fff62[_0x5adb('0x23')][_0x5adb('0x25')]);}else{logger['info'](_0x5adb('0x20'),_0x30614e,_0x5adb('0x26'));_0x39d24d(_0x3fff62[_0x5adb('0x27')][_0x5adb('0x25')]);}})[_0x5adb('0x28')](function(_0x49f203){logger[_0x5adb('0x23')](_0x5adb('0x20'),_0x30614e,_0x49f203);_0xa29dc(_0x49f203);});});}function respondWithStatusCode(_0x5aed76,_0x1feecf){_0x1feecf=_0x1feecf||0xcc;return function(_0x1ded9f){if(_0x1ded9f){return _0x5aed76[_0x5adb('0x29')](_0x1feecf);}return _0x5aed76['status'](_0x1feecf)[_0x5adb('0x2a')]();};}function respondWithResult(_0xbe21b1,_0x3a4fca){_0x3a4fca=_0x3a4fca||0xc8;return function(_0x2c64a3){if(_0x2c64a3){return _0xbe21b1[_0x5adb('0x2b')](_0x3a4fca)[_0x5adb('0x2c')](_0x2c64a3);}};}function respondWithFilteredResult(_0x4a5d46,_0x49992e){return function(_0x5d457e){if(_0x5d457e){var _0x39bddd=_0x5d457e[_0x5adb('0x2d')],_0x1eac55=_0x49992e['offset'],_0x60a672=_0x49992e[_0x5adb('0x2e')]+_0x49992e[_0x5adb('0x2f')],_0x512bab;if(_0x60a672>=_0x39bddd){_0x60a672=_0x39bddd;_0x512bab=0xc8;}else{_0x512bab=0xce;}_0x4a5d46[_0x5adb('0x2b')](_0x512bab);return _0x4a5d46[_0x5adb('0x30')](_0x5adb('0x31'),_0x1eac55+'-'+_0x60a672+'/'+_0x39bddd)[_0x5adb('0x2c')](_0x5d457e);}return null;};}function patchUpdates(_0x28190d){return function(_0x28bf1f){try{jsonpatch[_0x5adb('0x32')](_0x28bf1f,_0x28190d,!![]);}catch(_0x260295){return BPromise['reject'](_0x260295);}return _0x28bf1f[_0x5adb('0x33')]();};}function saveUpdates(_0x4c8b2e,_0x12424d){return function(_0x20cde6){if(_0x20cde6){return _0x20cde6['update'](_0x4c8b2e)[_0x5adb('0x34')](function(_0xe389ca){return _0xe389ca;});}return null;};}function removeEntity(_0x461a39,_0x4a3661){return function(_0x173789){if(_0x173789){return _0x173789[_0x5adb('0x35')]()['then'](function(){_0x461a39['status'](0xcc)[_0x5adb('0x2a')]();});}};}function handleEntityNotFound(_0x49dd03,_0x663ea0){return function(_0x222568){if(!_0x222568){_0x49dd03[_0x5adb('0x29')](0x194);}return _0x222568;};}function handleError(_0x2da912,_0x9bdece){_0x9bdece=_0x9bdece||0x1f4;return function(_0x5ece39){logger[_0x5adb('0x23')](_0x5ece39[_0x5adb('0x36')]);if(_0x5ece39[_0x5adb('0x37')]){delete _0x5ece39['name'];}_0x2da912['status'](_0x9bdece)[_0x5adb('0x38')](_0x5ece39);};}exports[_0x5adb('0x39')]=function(_0x586820,_0x2355bc){var _0x4a4260={},_0x199d3b={},_0x58cc5d={'count':0x0,'rows':[]};var _0x11cb37=_['map'](db[_0x5adb('0x3a')][_0x5adb('0x3b')],function(_0x4ccb27){return{'name':_0x4ccb27[_0x5adb('0x3c')],'type':_0x4ccb27['type'][_0x5adb('0x3d')]};});_0x199d3b[_0x5adb('0x3e')]=_[_0x5adb('0x3f')](_0x11cb37,'name');_0x199d3b[_0x5adb('0x40')]=_[_0x5adb('0x41')](_0x586820[_0x5adb('0x40')]);_0x199d3b[_0x5adb('0x42')]=_[_0x5adb('0x43')](_0x199d3b['model'],_0x199d3b['query']);_0x4a4260['attributes']=_['intersection'](_0x199d3b[_0x5adb('0x3e')],qs[_0x5adb('0x44')](_0x586820[_0x5adb('0x40')][_0x5adb('0x44')]));_0x4a4260[_0x5adb('0x45')]=_0x4a4260[_0x5adb('0x45')][_0x5adb('0x46')]?_0x4a4260[_0x5adb('0x45')]:_0x199d3b['model'];if(!_0x586820['query'][_0x5adb('0x47')]('nolimit')){_0x4a4260[_0x5adb('0x2f')]=qs[_0x5adb('0x2f')](_0x586820[_0x5adb('0x40')][_0x5adb('0x2f')]);_0x4a4260[_0x5adb('0x2e')]=qs['offset'](_0x586820[_0x5adb('0x40')][_0x5adb('0x2e')]);}_0x4a4260['order']=qs[_0x5adb('0x48')](_0x586820[_0x5adb('0x40')]['sort']);_0x4a4260[_0x5adb('0x49')]=qs[_0x5adb('0x42')](_[_0x5adb('0x4a')](_0x586820[_0x5adb('0x40')],_0x199d3b[_0x5adb('0x42')]),_0x11cb37);if(_0x586820[_0x5adb('0x40')][_0x5adb('0x4b')]){_0x4a4260['where']=_['merge'](_0x4a4260[_0x5adb('0x49')],{'$or':_[_0x5adb('0x3f')](_0x11cb37,function(_0x1cd0a3){if(_0x1cd0a3[_0x5adb('0x4c')]!=='VIRTUAL'){var _0x507e48={};_0x507e48[_0x1cd0a3[_0x5adb('0x37')]]={'$like':'%'+_0x586820[_0x5adb('0x40')][_0x5adb('0x4b')]+'%'};return _0x507e48;}})});}_0x4a4260=_[_0x5adb('0x4d')]({},_0x4a4260,_0x586820[_0x5adb('0x4e')]);var _0x5358c0={'where':_0x4a4260[_0x5adb('0x49')]};return db[_0x5adb('0x3a')]['count'](_0x5358c0)[_0x5adb('0x34')](function(_0x251f45){_0x58cc5d[_0x5adb('0x2d')]=_0x251f45;if(_0x586820[_0x5adb('0x40')][_0x5adb('0x4f')]){_0x4a4260[_0x5adb('0x50')]=[{'all':!![]}];}return db[_0x5adb('0x3a')][_0x5adb('0x51')](_0x4a4260);})['then'](function(_0x3a925b){_0x58cc5d['rows']=_0x3a925b;return _0x58cc5d;})['then'](respondWithFilteredResult(_0x2355bc,_0x4a4260))['catch'](handleError(_0x2355bc,null));};exports[_0x5adb('0x52')]=function(_0x3fbac8,_0x207a81){var _0x4ba0b5={'raw':!![],'where':{'id':_0x3fbac8['params']['id']}},_0x2ad69d={};_0x2ad69d[_0x5adb('0x3e')]=_[_0x5adb('0x41')](db[_0x5adb('0x3a')]['rawAttributes']);_0x2ad69d[_0x5adb('0x40')]=_['keys'](_0x3fbac8[_0x5adb('0x40')]);_0x2ad69d[_0x5adb('0x42')]=_['intersection'](_0x2ad69d[_0x5adb('0x3e')],_0x2ad69d[_0x5adb('0x40')]);_0x4ba0b5[_0x5adb('0x45')]=_[_0x5adb('0x43')](_0x2ad69d[_0x5adb('0x3e')],qs['fields'](_0x3fbac8[_0x5adb('0x40')][_0x5adb('0x44')]));_0x4ba0b5[_0x5adb('0x45')]=_0x4ba0b5[_0x5adb('0x45')]['length']?_0x4ba0b5[_0x5adb('0x45')]:_0x2ad69d[_0x5adb('0x3e')];if(_0x3fbac8[_0x5adb('0x40')]['includeAll']){_0x4ba0b5[_0x5adb('0x50')]=[{'all':!![]}];}_0x4ba0b5=_[_0x5adb('0x4d')]({},_0x4ba0b5,_0x3fbac8[_0x5adb('0x4e')]);return db[_0x5adb('0x3a')]['find'](_0x4ba0b5)[_0x5adb('0x34')](handleEntityNotFound(_0x207a81,null))[_0x5adb('0x34')](respondWithResult(_0x207a81,null))[_0x5adb('0x28')](handleError(_0x207a81,null));};exports[_0x5adb('0x53')]=function(_0xa25ac3,_0x5c570b){return db[_0x5adb('0x3a')]['create'](_0xa25ac3[_0x5adb('0x54')],{})['then'](respondWithResult(_0x5c570b,0xc9))[_0x5adb('0x28')](handleError(_0x5c570b,null));};exports[_0x5adb('0x55')]=function(_0x1a9358,_0x42f6d9){if(_0x1a9358['body']['id']){delete _0x1a9358[_0x5adb('0x54')]['id'];}return db[_0x5adb('0x3a')][_0x5adb('0x56')]({'where':{'id':_0x1a9358['params']['id']}})['then'](handleEntityNotFound(_0x42f6d9,null))['then'](saveUpdates(_0x1a9358[_0x5adb('0x54')],null))[_0x5adb('0x34')](respondWithResult(_0x42f6d9,null))[_0x5adb('0x28')](handleError(_0x42f6d9,null));};exports[_0x5adb('0x35')]=function(_0xa833f4,_0xb06bee){return db[_0x5adb('0x3a')][_0x5adb('0x56')]({'where':{'id':_0xa833f4[_0x5adb('0x57')]['id']}})[_0x5adb('0x34')](handleEntityNotFound(_0xb06bee,null))[_0x5adb('0x34')](removeEntity(_0xb06bee,null))[_0x5adb('0x28')](handleError(_0xb06bee,null));};exports[_0x5adb('0x58')]=function(_0x511746,_0x49f4c8){return db[_0x5adb('0x3a')][_0x5adb('0x58')]()[_0x5adb('0x34')](respondWithResult(_0x49f4c8,null))[_0x5adb('0x28')](handleError(_0x49f4c8,null));};var interaction_log=require('../../config/logger')(_0x5adb('0x59'));exports[_0x5adb('0x5a')]=function(_0x5d2d2f,_0x5cb50e,_0x476e62){var _0x1505f7={'channel':'whatsapp'};if(_0x5d2d2f[_0x5adb('0x54')]['id']){delete _0x5d2d2f[_0x5adb('0x54')]['id'];}_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x5b')]=!![];_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x5c')]=moment()['format'](_0x5adb('0x5d'));_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x5e')]=_0x5d2d2f['body'][_0x5adb('0x5e')]||_0x5d2d2f[_0x5adb('0x5f')]['id'];return db[_0x5adb('0x3a')]['find']({'where':{'id':_0x5d2d2f[_0x5adb('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x5adb('0x60')}]})[_0x5adb('0x34')](handleEntityNotFound(_0x5cb50e,null))[_0x5adb('0x34')](saveUpdates(_0x5d2d2f['body'],null))[_0x5adb('0x34')](function(_0x3627d1){if(_0x3627d1){_0x1505f7['message']=_0x3627d1[_0x5adb('0x61')]({'plain':!![]});return db[_0x5adb('0x62')][_0x5adb('0x56')]({'where':{'id':_0x3627d1[_0x5adb('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x5cb50e,null))[_0x5adb('0x34')](function(_0x2b8298){if(_0x2b8298){return _0x2b8298[_0x5adb('0x55')]({'UserId':_0x5d2d2f[_0x5adb('0x54')]['UserId'],'read1stAt':_['isNil'](_0x2b8298[_0x5adb('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x174a83){if(_0x174a83){_0x1505f7[_0x5adb('0x65')]=_0x174a83['get']({'plain':!![]});interaction_log[_0x5adb('0x66')](_0x5adb('0x67'),_0x5d2d2f[_0x5adb('0x5f')]['id'],_0x5d2d2f[_0x5adb('0x5f')][_0x5adb('0x37')],_0x5d2d2f[_0x5adb('0x5f')][_0x5adb('0x68')],_0x1505f7[_0x5adb('0x65')]['id'],_0x5d2d2f['body']?JSON['stringify'](_0x5d2d2f['body']):_0x5adb('0x69'));return respondWithRpcPromise(_0x5adb('0x6a'),_0x5adb('0x6b'),_0x1505f7);}return null;})[_0x5adb('0x34')](function(_0x1f59bb){if(_0x1f59bb){if(_0x5d2d2f[_0x5adb('0x54')][_0x5adb('0x6c')]){_0x1505f7[_0x5adb('0x25')]['interface']=util['format'](_0x5adb('0x6d'),_0x5d2d2f[_0x5adb('0x5f')][_0x5adb('0x37')]);_0x1505f7[_0x5adb('0x25')][_0x5adb('0x6e')]=_0x1505f7[_0x5adb('0x6e')];_0x1505f7[_0x5adb('0x25')][_0x5adb('0x6f')]=_0x5adb('0x5a');return respondWithRpcPromise(_0x5adb('0x70'),'EventManager',{'event':_0x5adb('0x71'),'message':_0x1505f7[_0x5adb('0x25')]},client9002)[_0x5adb('0x34')](function(){return _0x1505f7;});}return _0x1505f7;}return null;})['then'](respondWithResult(_0x5cb50e,null))[_0x5adb('0x28')](handleError(_0x5cb50e,null));};var interaction_log=require(_0x5adb('0x14'))('whatsapp-interactions');exports[_0x5adb('0x72')]=function(_0x494526,_0x473538,_0x31555a){var _0x5ea16a={'agent':{},'channel':_0x5adb('0x73')};if(_0x494526[_0x5adb('0x54')]['id']){delete _0x494526[_0x5adb('0x54')]['id'];}_0x494526[_0x5adb('0x54')][_0x5adb('0x5e')]=_0x494526[_0x5adb('0x54')][_0x5adb('0x5e')]||_0x494526[_0x5adb('0x5f')]['id'];_0x5ea16a['agent']['id']=_0x494526[_0x5adb('0x54')][_0x5adb('0x5e')];return db[_0x5adb('0x3a')]['find']({'where':{'id':_0x494526['params']['id'],'UserId':null}})[_0x5adb('0x34')](handleEntityNotFound(_0x473538,null))['then'](function(_0x27d3d8){if(_0x27d3d8){_0x5ea16a[_0x5adb('0x25')]=_0x27d3d8[_0x5adb('0x61')]({'plain':!![]});return db['WhatsappInteraction'][_0x5adb('0x56')]({'where':{'id':_0x27d3d8[_0x5adb('0x63')]}});}return null;})[_0x5adb('0x34')](handleEntityNotFound(_0x473538,null))[_0x5adb('0x34')](function(_0x3ed654){if(_0x3ed654){_0x5ea16a['interaction']=_0x3ed654[_0x5adb('0x61')]({'plain':!![]});interaction_log[_0x5adb('0x66')](_0x5adb('0x74'),_0x494526[_0x5adb('0x5f')]['id'],_0x494526['user'][_0x5adb('0x37')],_0x494526[_0x5adb('0x5f')][_0x5adb('0x68')],_0x5ea16a[_0x5adb('0x65')]['id'],_0x494526[_0x5adb('0x54')]?JSON[_0x5adb('0x22')](_0x494526[_0x5adb('0x54')]):'null');return respondWithRpcPromise(_0x5adb('0x75'),_0x5adb('0x76'),_0x5ea16a);}return null;})['then'](function(_0x44f940){if(_0x44f940){_0x44f940[_0x5adb('0x25')]['interface']=util[_0x5adb('0x77')]('SIP/%s',_0x494526[_0x5adb('0x5f')][_0x5adb('0x37')]);_0x44f940['message'][_0x5adb('0x6e')]=_0x5ea16a['channel'];_0x44f940[_0x5adb('0x25')][_0x5adb('0x6f')]=_0x5adb('0x72');respondWithRpcPromise(_0x5adb('0x70'),_0x5adb('0x70'),{'event':'rejectmessage','message':_0x44f940[_0x5adb('0x25')]},client9002);return _0x5ea16a;}return null;})[_0x5adb('0x34')](respondWithResult(_0x473538,null))[_0x5adb('0x28')](handleError(_0x473538,null));};exports[_0x5adb('0x2b')]=function(_0x47c631,_0x5e875c,_0x3f3db9){if(_0x47c631[_0x5adb('0x54')]['id']){delete _0x47c631[_0x5adb('0x54')]['id'];}var _0xa1d7c8;return db[_0x5adb('0x3a')][_0x5adb('0x56')]({'where':{'id':_0x47c631[_0x5adb('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e875c,null))[_0x5adb('0x34')](function(_0x14bada){if(_0x14bada){_0xa1d7c8=_0x14bada;return db[_0x5adb('0x78')][_0x5adb('0x56')]({'where':{'id':_0x14bada['WhatsappAccountId']}});}})[_0x5adb('0x34')](handleEntityNotFound(_0x5e875c,null))[_0x5adb('0x34')](function(_0x243016){if(_0x243016){logger[_0x5adb('0x21')](_0x5adb('0x79'),_0x5adb('0x2b'),_0x5adb('0x7a'),_0x243016[_0x5adb('0x4c')],util[_0x5adb('0x7b')](_0x47c631['body'],{'showHidden':![],'depth':null}));switch(_0x243016[_0x5adb('0x4c')]){case _0x5adb('0x7c'):if(_0x47c631['body'][_0x5adb('0x7d')]&&_0x47c631[_0x5adb('0x54')][_0x5adb('0x7d')]===_0xa1d7c8[_0x5adb('0x7e')]&&_0x47c631[_0x5adb('0x54')][_0x5adb('0x7f')]&&_0x47c631[_0x5adb('0x54')][_0x5adb('0x7f')]==='read'){return _0xa1d7c8[_0x5adb('0x55')]({'read':!![]});}else{logger[_0x5adb('0x23')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x5adb('0x2b'),_0x5adb('0x7c'),util[_0x5adb('0x7b')](_0x47c631['body'],{'showHidden':![],'depth':null}));}break;}return _0xa1d7c8;}})['then'](respondWithResult(_0x5e875c,null))[_0x5adb('0x28')](handleError(_0x5e875c,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index a2f8585..cc99c28 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x5dbbe8,_0x1252bc){var _0x119d6a=function(_0xe3f52d){while(--_0xe3f52d){_0x5dbbe8['push'](_0x5dbbe8['shift']());}};_0x119d6a(++_0x1252bc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x252eb6,_0x46b986){_0x252eb6=_0x252eb6-0x0;var _0x224da7=_0x5f2f[_0x252eb6];return _0x224da7;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0x7a54=['WhatsappMessage','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x39e844,_0x12aa0d){var _0xded6a3=function(_0x361e43){while(--_0x361e43){_0x39e844['push'](_0x39e844['shift']());}};_0xded6a3(++_0x12aa0d);}(_0x7a54,0x106));var _0x47a5=function(_0x757aea,_0x3e2c8d){_0x757aea=_0x757aea-0x0;var _0x136165=_0x7a54[_0x757aea];return _0x136165;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var WhatsappMessage=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){WhatsappMessageEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);WhatsappMessageEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x47a5('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 886c8f9..9323161 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 _0xf6ab=['direction','toLowerCase','out','secret','UserId','findOne','WhatsappInteractionId','update','catch','error','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xf6ab,0x1b0));var _0xbf6a=function(_0x24eb78,_0x4e9768){_0x24eb78=_0x24eb78-0x0;var _0x2d1c8b=_0xf6ab[_0x24eb78];return _0x2d1c8b;};'use strict';var _=require(_0xbf6a('0x0'));var util=require(_0xbf6a('0x1'));var logger=require('../../config/logger')(_0xbf6a('0x2'));var moment=require(_0xbf6a('0x3'));var BPromise=require(_0xbf6a('0x4'));var rp=require(_0xbf6a('0x5'));var fs=require('fs');var path=require(_0xbf6a('0x6'));var rimraf=require(_0xbf6a('0x7'));var config=require(_0xbf6a('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0xbf6a('0x9')]=function(_0x4085eb,_0x2384db){return _0x4085eb[_0xbf6a('0xa')]('WhatsappMessage',attributes,{'tableName':_0xbf6a('0xb'),'paranoid':![],'indexes':[{'name':_0xbf6a('0xc'),'fields':[_0xbf6a('0xc')]},{'name':_0xbf6a('0xd'),'fields':[_0xbf6a('0xe')],'type':_0xbf6a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ec98a,_0x4996fc,_0x249cb0){var _0x3172bc=_0x4085eb[_0xbf6a('0x10')];var _0x5a546d=_0x3ec98a[_0xbf6a('0x11')]({'plain':!![]});if(_0x5a546d[_0xbf6a('0x12')][_0xbf6a('0x13')]()==='in'||_0x5a546d[_0xbf6a('0x12')][_0xbf6a('0x13')]()===_0xbf6a('0x14')&&!_0x5a546d[_0xbf6a('0x15')]&&!_['isNil'](_0x5a546d[_0xbf6a('0x16')])){_0x3172bc['WhatsappInteraction'][_0xbf6a('0x17')]({'where':{'id':_0x5a546d[_0xbf6a('0x18')]}})['then'](function(_0x4e0e80){if(_0x4e0e80){_0x4e0e80[_0xbf6a('0x19')]({'lastMsgAt':_0x5a546d['createdAt'],'lastMsgDirection':_0x5a546d[_0xbf6a('0x12')]['toLowerCase']()});}})[_0xbf6a('0x1a')](function(_0xe7feb3){console[_0xbf6a('0x1b')](_0xe7feb3);});}if(_0x5a546d[_0xbf6a('0x12')]===_0xbf6a('0x14')&&!_0x5a546d[_0xbf6a('0x15')]){var _0x5e3c92;_0x3172bc[_0xbf6a('0x1c')][_0xbf6a('0x1d')]({'where':{'id':_0x5a546d['WhatsappAccountId']},'raw':!![]})[_0xbf6a('0x1e')](function(_0x1d4e99){_0x5e3c92=_0x1d4e99;if(_0x5e3c92&&_0x5e3c92[_0xbf6a('0x1f')]){switch(_0x5e3c92[_0xbf6a('0x1f')]){case _0xbf6a('0x20'):var _0x5bfd7b=require(_0xbf6a('0x20'));if(_0x5e3c92[_0xbf6a('0x21')]&&_0x5e3c92[_0xbf6a('0x22')]&&_0x5e3c92[_0xbf6a('0x23')]){var _0x515a36=new _0x5bfd7b(_0x5e3c92[_0xbf6a('0x21')],_0x5e3c92[_0xbf6a('0x22')]);_0x515a36[_0xbf6a('0x24')][_0xbf6a('0x25')]({'body':_0x5a546d['body'],'to':_0xbf6a('0x26')+_0x5a546d[_0xbf6a('0x23')],'from':_0xbf6a('0x26')+_0x5e3c92['phone'],'statusCallback':_0x5e3c92[_0xbf6a('0x27')]+_0xbf6a('0x28')+_0x5a546d['id']+_0xbf6a('0x29')+_0x5e3c92['token']})['then'](function(_0x5b7f8c){if(_0x5b7f8c[_0xbf6a('0x2a')]){return _0x3ec98a[_0xbf6a('0x19')]({'messageId':_0x5b7f8c['sid']});}})[_0xbf6a('0x1a')](function(_0x49ed62){logger[_0xbf6a('0x1b')](_0xbf6a('0x2b'),_0xbf6a('0x2c'),_0xbf6a('0x20'),util[_0xbf6a('0x2d')](_0x49ed62,{'showHidden':![],'depth':null}));});}else{logger[_0xbf6a('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xbf6a('0x2c'),_0xbf6a('0x20'),_0xbf6a('0x2e'));}break;}}})[_0xbf6a('0x2f')](function(){_0x249cb0();});}else{_0x249cb0();}}},'charset':_0xbf6a('0x30'),'collate':_0xbf6a('0x31')});}; \ No newline at end of file +var _0x167b=['accountSid','authToken','phone','create','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','body','FULLTEXT','models','direction','out','secret','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x167b,0xbe));var _0xb167=function(_0x228c9a,_0x315247){_0x228c9a=_0x228c9a-0x0;var _0x35bc2e=_0x167b[_0x228c9a];return _0x35bc2e;};'use strict';var _=require(_0xb167('0x0'));var util=require(_0xb167('0x1'));var logger=require(_0xb167('0x2'))('api');var moment=require(_0xb167('0x3'));var BPromise=require(_0xb167('0x4'));var rp=require(_0xb167('0x5'));var fs=require('fs');var path=require(_0xb167('0x6'));var rimraf=require(_0xb167('0x7'));var config=require('../../config/environment');var attributes=require(_0xb167('0x8'));module[_0xb167('0x9')]=function(_0x225e42,_0x33a8bd){return _0x225e42['define']('WhatsappMessage',attributes,{'tableName':_0xb167('0xa'),'paranoid':![],'indexes':[{'name':_0xb167('0xb'),'fields':[_0xb167('0xb')]},{'name':'fti_whatsapp_messages','fields':[_0xb167('0xc')],'type':_0xb167('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52e0d3,_0x53429b,_0x5277ff){var _0x2da139=_0x225e42[_0xb167('0xe')];var _0xeb4c9a=_0x52e0d3['get']({'plain':!![]});if(_0xeb4c9a[_0xb167('0xf')]['toLowerCase']()==='in'||_0xeb4c9a[_0xb167('0xf')]['toLowerCase']()===_0xb167('0x10')&&!_0xeb4c9a[_0xb167('0x11')]&&!_['isNil'](_0xeb4c9a['UserId'])){_0x2da139[_0xb167('0x12')][_0xb167('0x13')]({'where':{'id':_0xeb4c9a[_0xb167('0x14')]}})[_0xb167('0x15')](function(_0x2770a6){if(_0x2770a6){_0x2770a6[_0xb167('0x16')]({'lastMsgAt':_0xeb4c9a[_0xb167('0x17')],'lastMsgDirection':_0xeb4c9a[_0xb167('0xf')]['toLowerCase']()});}})[_0xb167('0x18')](function(_0x5946a6){console['error'](_0x5946a6);});}if(_0xeb4c9a[_0xb167('0xf')]==='out'&&!_0xeb4c9a['secret']){var _0x1be940;_0x2da139[_0xb167('0x19')][_0xb167('0x1a')]({'where':{'id':_0xeb4c9a[_0xb167('0x1b')]},'raw':!![]})[_0xb167('0x15')](function(_0x1110a6){_0x1be940=_0x1110a6;if(_0x1be940&&_0x1be940['type']){switch(_0x1be940[_0xb167('0x1c')]){case'twilio':var _0x1bd6ed=require(_0xb167('0x1d'));if(_0x1be940[_0xb167('0x1e')]&&_0x1be940[_0xb167('0x1f')]&&_0x1be940[_0xb167('0x20')]){var _0x2a0d70=new _0x1bd6ed(_0x1be940[_0xb167('0x1e')],_0x1be940[_0xb167('0x1f')]);_0x2a0d70['messages'][_0xb167('0x21')]({'body':_0xeb4c9a['body'],'to':_0xb167('0x22')+_0xeb4c9a['phone'],'from':_0xb167('0x22')+_0x1be940[_0xb167('0x20')],'statusCallback':_0x1be940['remote']+_0xb167('0x23')+_0xeb4c9a['id']+_0xb167('0x24')+_0x1be940[_0xb167('0x25')]})[_0xb167('0x15')](function(_0x451c53){if(_0x451c53[_0xb167('0x26')]){return _0x52e0d3['update']({'messageId':_0x451c53['sid']});}})[_0xb167('0x18')](function(_0x47839f){logger[_0xb167('0x27')](_0xb167('0x28'),_0xb167('0x29'),_0xb167('0x1d'),util['inspect'](_0x47839f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb167('0x28'),_0xb167('0x29'),_0xb167('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0xb167('0x2a')](function(){_0x5277ff();});}else{_0x5277ff();}}},'charset':_0xb167('0x2b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 4645801..2656ae3 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 _0xc585=['http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateWhatsappMessage','create','body','options','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5dd7b5,_0x5ec269){var _0xf7238b=function(_0x5c75bc){while(--_0x5c75bc){_0x5dd7b5['push'](_0x5dd7b5['shift']());}};_0xf7238b(++_0x5ec269);}(_0xc585,0xd5));var _0x5c58=function(_0xbdf0c4,_0x245127){_0xbdf0c4=_0xbdf0c4-0x0;var _0x531deb=_0xc585[_0xbdf0c4];return _0x531deb;};'use strict';var _=require(_0x5c58('0x0'));var util=require('util');var moment=require(_0x5c58('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c58('0x2'));var fs=require('fs');var Redis=require(_0x5c58('0x3'));var db=require(_0x5c58('0x4'))['db'];var utils=require(_0x5c58('0x5'));var logger=require(_0x5c58('0x6'))(_0x5c58('0x7'));var config=require(_0x5c58('0x8'));var jayson=require(_0x5c58('0x9'));var client=jayson[_0x5c58('0xa')][_0x5c58('0xb')]({'port':0x232a});config[_0x5c58('0xc')]=_['defaults'](config['redis'],{'host':_0x5c58('0xd'),'port':0x18eb});var socket=require(_0x5c58('0xe'))(new Redis(config[_0x5c58('0xc')]));require(_0x5c58('0xf'))[_0x5c58('0x10')](socket);function respondWithRpcPromise(_0x4dc8a1,_0x1feacb,_0x5e0bd7){return new BPromise(function(_0x1acfb9,_0x35aed9){return client['request'](_0x4dc8a1,_0x5e0bd7)[_0x5c58('0x11')](function(_0x5b5e80){logger['info'](_0x5c58('0x12'),_0x1feacb,_0x5c58('0x13'));logger[_0x5c58('0x14')](_0x5c58('0x15'),_0x1feacb,_0x5c58('0x13'),JSON['stringify'](_0x5b5e80));if(_0x5b5e80['error']){if(_0x5b5e80[_0x5c58('0x16')]['code']===0x1f4){logger['error'](_0x5c58('0x12'),_0x1feacb,_0x5b5e80[_0x5c58('0x16')][_0x5c58('0x17')]);return _0x35aed9(_0x5b5e80['error'][_0x5c58('0x17')]);}logger['error'](_0x5c58('0x12'),_0x1feacb,_0x5b5e80['error'][_0x5c58('0x17')]);return _0x1acfb9(_0x5b5e80[_0x5c58('0x16')][_0x5c58('0x17')]);}else{logger[_0x5c58('0x18')](_0x5c58('0x12'),_0x1feacb,_0x5c58('0x13'));_0x1acfb9(_0x5b5e80[_0x5c58('0x19')][_0x5c58('0x17')]);}})[_0x5c58('0x1a')](function(_0x5b96bb){logger[_0x5c58('0x16')](_0x5c58('0x12'),_0x1feacb,_0x5b96bb);_0x35aed9(_0x5b96bb);});});}exports[_0x5c58('0x1b')]=function(_0x578ada){var _0x235981=this;return new Promise(function(_0x268039,_0x358996){return db['WhatsappMessage'][_0x5c58('0x1c')](_0x578ada[_0x5c58('0x1d')],{'raw':_0x578ada[_0x5c58('0x1e')]?_0x578ada[_0x5c58('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5c58('0x11')](function(_0x59f73e){logger[_0x5c58('0x18')]('CreateWhatsappMessage',_0x578ada);logger['debug'](_0x5c58('0x1b'),_0x578ada,JSON[_0x5c58('0x1f')](_0x59f73e));_0x268039(_0x59f73e);})[_0x5c58('0x1a')](function(_0x5739a9){logger[_0x5c58('0x16')](_0x5c58('0x1b'),_0x5739a9[_0x5c58('0x17')],_0x578ada);_0x358996(_0x235981[_0x5c58('0x16')](0x1f4,_0x5739a9['message']));});});}; \ No newline at end of file +var _0xd565=['options','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body'];(function(_0x198753,_0x519753){var _0x10423d=function(_0x41f281){while(--_0x41f281){_0x198753['push'](_0x198753['shift']());}};_0x10423d(++_0x519753);}(_0xd565,0x17a));var _0x5d56=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd565[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x5d56('0x0'));var util=require(_0x5d56('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d56('0x2'));var fs=require('fs');var Redis=require(_0x5d56('0x3'));var db=require(_0x5d56('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d56('0x5'))(_0x5d56('0x6'));var config=require(_0x5d56('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5d56('0x8')][_0x5d56('0x9')]({'port':0x232a});config[_0x5d56('0xa')]=_['defaults'](config[_0x5d56('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5d56('0xb'))(new Redis(config[_0x5d56('0xa')]));require(_0x5d56('0xc'))[_0x5d56('0xd')](socket);function respondWithRpcPromise(_0x31d851,_0x559b65,_0x57a3d3){return new BPromise(function(_0x12fa85,_0x1681e3){return client['request'](_0x31d851,_0x57a3d3)[_0x5d56('0xe')](function(_0x51cffb){logger[_0x5d56('0xf')](_0x5d56('0x10'),_0x559b65,_0x5d56('0x11'));logger[_0x5d56('0x12')](_0x5d56('0x13'),_0x559b65,'request\x20sent',JSON[_0x5d56('0x14')](_0x51cffb));if(_0x51cffb[_0x5d56('0x15')]){if(_0x51cffb[_0x5d56('0x15')]['code']===0x1f4){logger[_0x5d56('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x559b65,_0x51cffb[_0x5d56('0x15')][_0x5d56('0x16')]);return _0x1681e3(_0x51cffb[_0x5d56('0x15')]['message']);}logger[_0x5d56('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x559b65,_0x51cffb[_0x5d56('0x15')]['message']);return _0x12fa85(_0x51cffb['error'][_0x5d56('0x16')]);}else{logger[_0x5d56('0xf')](_0x5d56('0x10'),_0x559b65,'request\x20sent');_0x12fa85(_0x51cffb[_0x5d56('0x17')][_0x5d56('0x16')]);}})[_0x5d56('0x18')](function(_0x51ecc6){logger[_0x5d56('0x15')](_0x5d56('0x10'),_0x559b65,_0x51ecc6);_0x1681e3(_0x51ecc6);});});}exports[_0x5d56('0x19')]=function(_0x437f2c){var _0x1f44b4=this;return new Promise(function(_0x4cf916,_0x30c13d){return db[_0x5d56('0x1a')]['create'](_0x437f2c[_0x5d56('0x1b')],{'raw':_0x437f2c[_0x5d56('0x1c')]?_0x437f2c[_0x5d56('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x5d56('0xe')](function(_0x1a8569){logger[_0x5d56('0xf')]('CreateWhatsappMessage',_0x437f2c);logger[_0x5d56('0x12')](_0x5d56('0x19'),_0x437f2c,JSON[_0x5d56('0x14')](_0x1a8569));_0x4cf916(_0x1a8569);})[_0x5d56('0x18')](function(_0x21f811){logger['error'](_0x5d56('0x19'),_0x21f811[_0x5d56('0x16')],_0x437f2c);_0x30c13d(_0x1f44b4[_0x5d56('0x15')](0x1f4,_0x21f811[_0x5d56('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f5ba391..2cc70e9 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 _0xc84b=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','remove','emit'];(function(_0x436a6f,_0x29c566){var _0x59df48=function(_0x593d76){while(--_0x593d76){_0x436a6f['push'](_0x436a6f['shift']());}};_0x59df48(++_0x29c566);}(_0xc84b,0x18c));var _0xbc84=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xc84b[_0x383356];return _0x32ee5a;};'use strict';var WhatsappMessageEvents=require(_0xbc84('0x0'));var events=[_0xbc84('0x1'),_0xbc84('0x2'),'update'];function createListener(_0x5f12a0,_0x12d87f){return function(_0x49daee){_0x12d87f[_0xbc84('0x3')](_0x5f12a0,_0x49daee);};}function removeListener(_0x5dc581,_0xd80afa){return function(){WhatsappMessageEvents[_0xbc84('0x4')](_0x5dc581,_0xd80afa);};}exports[_0xbc84('0x5')]=function(_0x19f4fb){for(var _0x31711c=0x0,_0x4f972d=events[_0xbc84('0x6')];_0x31711c<_0x4f972d;_0x31711c++){var _0x24b95d=events[_0x31711c];var _0x393c82=createListener(_0xbc84('0x7')+_0x24b95d,_0x19f4fb);WhatsappMessageEvents['on'](_0x24b95d,_0x393c82);}}; \ No newline at end of file +var _0x0ab2=['length','whatsappMessage:','remove','removeListener'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0ab2,0x92));var _0x20ab=function(_0x6a9297,_0x5487ad){_0x6a9297=_0x6a9297-0x0;var _0x5ee147=_0x0ab2[_0x6a9297];return _0x5ee147;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x20ab('0x0'),'update'];function createListener(_0x226a0c,_0x1d5bee){return function(_0x4bdd70){_0x1d5bee['emit'](_0x226a0c,_0x4bdd70);};}function removeListener(_0x2aa2b9,_0x58f8d6){return function(){WhatsappMessageEvents[_0x20ab('0x1')](_0x2aa2b9,_0x58f8d6);};}exports['register']=function(_0x44fdb2){for(var _0x259548=0x0,_0x30e71e=events[_0x20ab('0x2')];_0x259548<_0x30e71e;_0x259548++){var _0xf14695=events[_0x259548];var _0x11d689=createListener(_0x20ab('0x3')+_0xf14695,_0x44fdb2);WhatsappMessageEvents['on'](_0xf14695,_0x11d689);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index bba6136..9d102a6 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 _0x9dd1=['/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','../../config/environment','get','isAuthenticated','show','/:id/members','getMembers'];(function(_0x10cd2f,_0xc9d9bd){var _0x409e99=function(_0x4d8a86){while(--_0x4d8a86){_0x10cd2f['push'](_0x10cd2f['shift']());}};_0x409e99(++_0xc9d9bd);}(_0x9dd1,0x73));var _0x19dd=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0x9dd1[_0x34c027];return _0x47bff0;};'use strict';var multer=require(_0x19dd('0x0'));var util=require(_0x19dd('0x1'));var path=require(_0x19dd('0x2'));var timeout=require(_0x19dd('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x19dd('0x4'));var controller=require('./whatsappQueue.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x19dd('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x19dd('0x5')]('/:id',auth[_0x19dd('0x6')](),controller[_0x19dd('0x7')]);router[_0x19dd('0x5')](_0x19dd('0x8'),auth[_0x19dd('0x6')](),controller[_0x19dd('0x9')]);router[_0x19dd('0x5')](_0x19dd('0xa'),auth[_0x19dd('0x6')](),controller[_0x19dd('0xb')]);router[_0x19dd('0x5')](_0x19dd('0xc'),auth[_0x19dd('0x6')](),controller[_0x19dd('0xd')]);router[_0x19dd('0xe')]('/',auth[_0x19dd('0x6')](),controller[_0x19dd('0xf')]);router['post'](_0x19dd('0xa'),auth[_0x19dd('0x6')](),controller[_0x19dd('0x10')]);router[_0x19dd('0xe')]('/:id/users',auth['isAuthenticated'](),controller[_0x19dd('0x11')]);router[_0x19dd('0x12')](_0x19dd('0x13'),auth[_0x19dd('0x6')](),controller['update']);router[_0x19dd('0x14')](_0x19dd('0x13'),auth['isAuthenticated'](),controller[_0x19dd('0x15')]);router[_0x19dd('0x14')](_0x19dd('0xa'),auth[_0x19dd('0x6')](),controller[_0x19dd('0x16')]);router['delete'](_0x19dd('0xc'),auth['isAuthenticated'](),controller[_0x19dd('0x17')]);module[_0x19dd('0x18')]=router; \ No newline at end of file +var _0x62ab=['getAgents','post','create','addTeams','destroy','delete','removeTeams','removeAgents','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users'];(function(_0x1f46c9,_0x1939c9){var _0x245822=function(_0x4bd1b9){while(--_0x4bd1b9){_0x1f46c9['push'](_0x1f46c9['shift']());}};_0x245822(++_0x1939c9);}(_0x62ab,0x18e));var _0xb62a=function(_0x8aa3f8,_0x5ca090){_0x8aa3f8=_0x8aa3f8-0x0;var _0x428e77=_0x62ab[_0x8aa3f8];return _0x428e77;};'use strict';var multer=require('multer');var util=require(_0xb62a('0x0'));var path=require(_0xb62a('0x1'));var timeout=require('connect-timeout');var express=require(_0xb62a('0x2'));var router=express[_0xb62a('0x3')]();var auth=require(_0xb62a('0x4'));var interaction=require(_0xb62a('0x5'));var config=require(_0xb62a('0x6'));var controller=require('./whatsappQueue.controller');router[_0xb62a('0x7')]('/',auth[_0xb62a('0x8')](),controller[_0xb62a('0x9')]);router[_0xb62a('0x7')](_0xb62a('0xa'),auth[_0xb62a('0x8')](),controller[_0xb62a('0xb')]);router[_0xb62a('0x7')](_0xb62a('0xc'),auth[_0xb62a('0x8')](),controller[_0xb62a('0xd')]);router['get'](_0xb62a('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xb62a('0x7')](_0xb62a('0xf'),auth[_0xb62a('0x8')](),controller[_0xb62a('0x10')]);router[_0xb62a('0x7')](_0xb62a('0x11'),auth[_0xb62a('0x8')](),controller[_0xb62a('0x12')]);router[_0xb62a('0x13')]('/',auth[_0xb62a('0x8')](),controller[_0xb62a('0x14')]);router[_0xb62a('0x13')]('/:id/teams',auth[_0xb62a('0x8')](),controller[_0xb62a('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0xb62a('0x8')](),controller['update']);router['delete'](_0xb62a('0xc'),auth[_0xb62a('0x8')](),controller[_0xb62a('0x16')]);router[_0xb62a('0x17')](_0xb62a('0xf'),auth['isAuthenticated'](),controller[_0xb62a('0x18')]);router[_0xb62a('0x17')](_0xb62a('0x11'),auth[_0xb62a('0x8')](),controller[_0xb62a('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 99103eb..5331e93 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 _0x7379=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0xbbcb36,_0x586383){var _0x4278ff=function(_0x35c9da){while(--_0x35c9da){_0xbbcb36['push'](_0xbbcb36['shift']());}};_0x4278ff(++_0x586383);}(_0x7379,0xb5));var _0x9737=function(_0x4b78cf,_0x542dc6){_0x4b78cf=_0x4b78cf-0x0;var _0x475323=_0x7379[_0x4b78cf];return _0x475323;};'use strict';var Sequelize=require(_0x9737('0x0'));module[_0x9737('0x1')]={'name':{'type':Sequelize[_0x9737('0x2')],'unique':_0x9737('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9737('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9737('0x5')]('rrmemory',_0x9737('0x6'),_0x9737('0x7'))},'description':{'type':Sequelize[_0x9737('0x2')]}}; \ No newline at end of file +var _0x41e2=['STRING','name','INTEGER','ENUM','roundrobin','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41e2,0x1c5));var _0x241e=function(_0x492884,_0x10355d){_0x492884=_0x492884-0x0;var _0x16d39c=_0x41e2[_0x492884];return _0x16d39c;};'use strict';var Sequelize=require(_0x241e('0x0'));module[_0x241e('0x1')]={'name':{'type':Sequelize[_0x241e('0x2')],'unique':_0x241e('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x241e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x241e('0x5')]('rrmemory','beepall',_0x241e('0x6'))},'description':{'type':Sequelize[_0x241e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index e5ae151..3d8a05c 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 _0x6c03=['addAgents','omit','userWhatsappQueue:remove','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','status','end','json','count','offset','limit','set','save','then','WhatsappQueues','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','rows','params','merge','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','update','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','findAll','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','SIP','createdAt','getTeams','Team','addTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','includes','all','union','value','isEmpty','removeAgents'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x6c03,0x8a));var _0x36c0=function(_0xff1e8d,_0x2439e8){_0xff1e8d=_0xff1e8d-0x0;var _0xe07823=_0x6c03[_0xff1e8d];return _0xe07823;};'use strict';var pdf=require(_0x36c0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x36c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x36c0('0x2'));var rp=require(_0x36c0('0x3'));var moment=require(_0x36c0('0x4'));var BPromise=require(_0x36c0('0x5'));var Mustache=require(_0x36c0('0x6'));var util=require('util');var path=require(_0x36c0('0x7'));var sox=require(_0x36c0('0x8'));var csv=require(_0x36c0('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x36c0('0xa'));var crypto=require('crypto');var jsforce=require(_0x36c0('0xb'));var deskjs=require(_0x36c0('0xc'));var toCsv=require(_0x36c0('0x9'));var querystring=require(_0x36c0('0xd'));var Papa=require('papaparse');var Redis=require(_0x36c0('0xe'));var authService=require(_0x36c0('0xf'));var qs=require(_0x36c0('0x10'));var as=require(_0x36c0('0x11'));var hardwareService=require(_0x36c0('0x12'));var logger=require('../../config/logger')(_0x36c0('0x13'));var utils=require(_0x36c0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x36c0('0x15'));var db=require('../../mysqldb')['db'];config[_0x36c0('0x16')]=_[_0x36c0('0x17')](config[_0x36c0('0x16')],{'host':_0x36c0('0x18'),'port':0x18eb});var socket=require(_0x36c0('0x19'))(new Redis(config[_0x36c0('0x16')]));require(_0x36c0('0x1a'))['register'](socket);function respondWithStatusCode(_0x1649a9,_0x323a52){_0x323a52=_0x323a52||0xcc;return function(_0x2903bf){if(_0x2903bf){return _0x1649a9['sendStatus'](_0x323a52);}return _0x1649a9[_0x36c0('0x1b')](_0x323a52)[_0x36c0('0x1c')]();};}function respondWithResult(_0x2a2977,_0x193984){_0x193984=_0x193984||0xc8;return function(_0x581087){if(_0x581087){return _0x2a2977[_0x36c0('0x1b')](_0x193984)[_0x36c0('0x1d')](_0x581087);}};}function respondWithFilteredResult(_0x4e1064,_0x2be426){return function(_0x12fd67){if(_0x12fd67){var _0xb6b642=_0x12fd67[_0x36c0('0x1e')],_0x127817=_0x2be426[_0x36c0('0x1f')],_0x5607a4=_0x2be426[_0x36c0('0x1f')]+_0x2be426[_0x36c0('0x20')],_0x2492ee;if(_0x5607a4>=_0xb6b642){_0x5607a4=_0xb6b642;_0x2492ee=0xc8;}else{_0x2492ee=0xce;}_0x4e1064['status'](_0x2492ee);return _0x4e1064[_0x36c0('0x21')]('Content-Range',_0x127817+'-'+_0x5607a4+'/'+_0xb6b642)[_0x36c0('0x1d')](_0x12fd67);}return null;};}function patchUpdates(_0x5803c4){return function(_0x2c5307){try{jsonpatch['apply'](_0x2c5307,_0x5803c4,!![]);}catch(_0x54895e){return BPromise['reject'](_0x54895e);}return _0x2c5307[_0x36c0('0x22')]();};}function saveUpdates(_0x3e9e3c,_0x43ae32){return function(_0x35c7f9){if(_0x35c7f9){return _0x35c7f9['update'](_0x3e9e3c)[_0x36c0('0x23')](function(_0x5b6db1){return _0x5b6db1;});}return null;};}function removeEntity(_0x55b161,_0xc70666){return function(_0x4212b1){if(_0x4212b1){return _0x4212b1['destroy']()[_0x36c0('0x23')](function(){var _0x103dfb=_0x4212b1['get']({'plain':!![]});var _0x45d0f7=_0x36c0('0x24');return db[_0x36c0('0x25')][_0x36c0('0x26')]({'where':{'type':_0x45d0f7,'resourceId':_0x103dfb['id']}})['then'](function(){return _0x4212b1;});})['then'](function(){_0x55b161['status'](0xcc)[_0x36c0('0x1c')]();});}};}function handleEntityNotFound(_0x37cda2,_0x389a32){return function(_0x5e66ba){if(!_0x5e66ba){_0x37cda2[_0x36c0('0x27')](0x194);}return _0x5e66ba;};}function handleError(_0x427be8,_0x2d4ff3){_0x2d4ff3=_0x2d4ff3||0x1f4;return function(_0xd6d4e){logger[_0x36c0('0x28')](_0xd6d4e[_0x36c0('0x29')]);if(_0xd6d4e[_0x36c0('0x2a')]){delete _0xd6d4e['name'];}_0x427be8[_0x36c0('0x1b')](_0x2d4ff3)['send'](_0xd6d4e);};}exports[_0x36c0('0x2b')]=function(_0xba1666,_0x38497f){var _0x4a0d3a={},_0x441964={},_0x3f53e9={'count':0x0,'rows':[]};var _0x7c0d4e=_[_0x36c0('0x2c')](db[_0x36c0('0x2d')][_0x36c0('0x2e')],function(_0x3fb8be){return{'name':_0x3fb8be[_0x36c0('0x2f')],'type':_0x3fb8be[_0x36c0('0x30')][_0x36c0('0x31')]};});_0x441964[_0x36c0('0x32')]=_[_0x36c0('0x2c')](_0x7c0d4e,_0x36c0('0x2a'));_0x441964[_0x36c0('0x33')]=_[_0x36c0('0x34')](_0xba1666[_0x36c0('0x33')]);_0x441964[_0x36c0('0x35')]=_[_0x36c0('0x36')](_0x441964[_0x36c0('0x32')],_0x441964[_0x36c0('0x33')]);_0x4a0d3a[_0x36c0('0x37')]=_[_0x36c0('0x36')](_0x441964[_0x36c0('0x32')],qs[_0x36c0('0x38')](_0xba1666[_0x36c0('0x33')][_0x36c0('0x38')]));_0x4a0d3a['attributes']=_0x4a0d3a[_0x36c0('0x37')][_0x36c0('0x39')]?_0x4a0d3a[_0x36c0('0x37')]:_0x441964[_0x36c0('0x32')];if(!_0xba1666[_0x36c0('0x33')]['hasOwnProperty'](_0x36c0('0x3a'))){_0x4a0d3a[_0x36c0('0x20')]=qs[_0x36c0('0x20')](_0xba1666[_0x36c0('0x33')][_0x36c0('0x20')]);_0x4a0d3a[_0x36c0('0x1f')]=qs[_0x36c0('0x1f')](_0xba1666[_0x36c0('0x33')][_0x36c0('0x1f')]);}_0x4a0d3a[_0x36c0('0x3b')]=qs[_0x36c0('0x3c')](_0xba1666['query']['sort']);_0x4a0d3a[_0x36c0('0x3d')]=qs['filters'](_[_0x36c0('0x3e')](_0xba1666[_0x36c0('0x33')],_0x441964[_0x36c0('0x35')]),_0x7c0d4e);if(_0xba1666[_0x36c0('0x33')]['filter']){_0x4a0d3a[_0x36c0('0x3d')]=_['merge'](_0x4a0d3a['where'],{'$or':_[_0x36c0('0x2c')](_0x7c0d4e,function(_0x26f599){if(_0x26f599[_0x36c0('0x30')]!==_0x36c0('0x3f')){var _0x33c826={};_0x33c826[_0x26f599[_0x36c0('0x2a')]]={'$like':'%'+_0xba1666[_0x36c0('0x33')][_0x36c0('0x40')]+'%'};return _0x33c826;}})});}_0x4a0d3a=_['merge']({},_0x4a0d3a,_0xba1666[_0x36c0('0x41')]);var _0x12b56c={'where':_0x4a0d3a[_0x36c0('0x3d')]};return db['WhatsappQueue'][_0x36c0('0x1e')](_0x12b56c)[_0x36c0('0x23')](function(_0xd3e3d8){_0x3f53e9['count']=_0xd3e3d8;if(_0xba1666[_0x36c0('0x33')][_0x36c0('0x42')]){_0x4a0d3a['include']=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x4a0d3a);})[_0x36c0('0x23')](function(_0x240340){_0x3f53e9[_0x36c0('0x43')]=_0x240340;return _0x3f53e9;})[_0x36c0('0x23')](respondWithFilteredResult(_0x38497f,_0x4a0d3a))['catch'](handleError(_0x38497f,null));};exports['show']=function(_0x3e49cb,_0x39c639){var _0xa8877e={'raw':!![],'where':{'id':_0x3e49cb[_0x36c0('0x44')]['id']}},_0x4bacbe={};_0x4bacbe['model']=_[_0x36c0('0x34')](db['WhatsappQueue'][_0x36c0('0x2e')]);_0x4bacbe[_0x36c0('0x33')]=_['keys'](_0x3e49cb[_0x36c0('0x33')]);_0x4bacbe[_0x36c0('0x35')]=_[_0x36c0('0x36')](_0x4bacbe[_0x36c0('0x32')],_0x4bacbe[_0x36c0('0x33')]);_0xa8877e['attributes']=_[_0x36c0('0x36')](_0x4bacbe[_0x36c0('0x32')],qs[_0x36c0('0x38')](_0x3e49cb[_0x36c0('0x33')][_0x36c0('0x38')]));_0xa8877e[_0x36c0('0x37')]=_0xa8877e['attributes'][_0x36c0('0x39')]?_0xa8877e[_0x36c0('0x37')]:_0x4bacbe[_0x36c0('0x32')];if(_0x3e49cb[_0x36c0('0x33')]['includeAll']){_0xa8877e['include']=[{'all':!![]}];}_0xa8877e=_[_0x36c0('0x45')]({},_0xa8877e,_0x3e49cb[_0x36c0('0x41')]);return db[_0x36c0('0x2d')]['find'](_0xa8877e)[_0x36c0('0x23')](handleEntityNotFound(_0x39c639,null))[_0x36c0('0x23')](respondWithResult(_0x39c639,null))[_0x36c0('0x46')](handleError(_0x39c639,null));};exports[_0x36c0('0x47')]=function(_0x53df9a,_0x25b4e9){return db[_0x36c0('0x2d')]['create'](_0x53df9a[_0x36c0('0x48')],{})[_0x36c0('0x23')](function(_0x1efffa){var _0x14e73a=_0x53df9a[_0x36c0('0x49')][_0x36c0('0x4a')]({'plain':!![]});if(!_0x14e73a)throw new Error(_0x36c0('0x4b'));if(_0x14e73a['role']===_0x36c0('0x49')){var _0x218c72=_0x1efffa[_0x36c0('0x4a')]({'plain':!![]});var _0x4c353a='WhatsappQueues';return db[_0x36c0('0x4c')][_0x36c0('0x4d')]({'where':{'name':_0x4c353a,'userProfileId':_0x14e73a[_0x36c0('0x4e')]},'raw':!![]})[_0x36c0('0x23')](function(_0x17713a){if(_0x17713a&&_0x17713a[_0x36c0('0x4f')]===0x0){return db[_0x36c0('0x25')][_0x36c0('0x47')]({'name':_0x218c72[_0x36c0('0x2a')],'resourceId':_0x218c72['id'],'type':_0x17713a[_0x36c0('0x2a')],'sectionId':_0x17713a['id']},{})[_0x36c0('0x23')](function(){return _0x1efffa;});}else{return _0x1efffa;}})[_0x36c0('0x46')](function(_0x19e380){logger[_0x36c0('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19e380);throw _0x19e380;});}return _0x1efffa;})[_0x36c0('0x23')](respondWithResult(_0x25b4e9,0xc9))[_0x36c0('0x46')](handleError(_0x25b4e9,null));};exports[_0x36c0('0x50')]=function(_0x18c059,_0x48a38c){if(_0x18c059[_0x36c0('0x48')]['id']){delete _0x18c059['body']['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x18c059[_0x36c0('0x44')]['id']}})[_0x36c0('0x23')](handleEntityNotFound(_0x48a38c,null))[_0x36c0('0x23')](saveUpdates(_0x18c059[_0x36c0('0x48')],null))['then'](respondWithResult(_0x48a38c,null))[_0x36c0('0x46')](handleError(_0x48a38c,null));};exports[_0x36c0('0x26')]=function(_0x217cd4,_0x2d7c5a){return db[_0x36c0('0x2d')][_0x36c0('0x4d')]({'where':{'id':_0x217cd4[_0x36c0('0x44')]['id']}})['then'](handleEntityNotFound(_0x2d7c5a,null))[_0x36c0('0x23')](removeEntity(_0x2d7c5a,null))[_0x36c0('0x46')](handleError(_0x2d7c5a,null));};exports['describe']=function(_0x3fff23,_0x49712c){return db[_0x36c0('0x2d')]['describe']()['then'](respondWithResult(_0x49712c,null))[_0x36c0('0x46')](handleError(_0x49712c,null));};exports[_0x36c0('0x51')]=function(_0x4e6454,_0x5ff3e0,_0xe1990c){var _0x3c88ae={'raw':!![],'where':{}},_0x589405={},_0x2f0758;return db[_0x36c0('0x2d')][_0x36c0('0x52')]({'where':{'id':_0x4e6454['params']['id']}})[_0x36c0('0x23')](handleEntityNotFound(_0x5ff3e0,null))[_0x36c0('0x23')](function(_0x330a7a){if(_0x330a7a){_0x2f0758=_0x330a7a[_0x36c0('0x4a')]({'plain':!![]});_0x589405[_0x36c0('0x32')]=_['keys'](db[_0x36c0('0x53')][_0x36c0('0x2e')]);_0x589405['query']=_[_0x36c0('0x34')](_0x4e6454['query']);_0x589405[_0x36c0('0x35')]=_[_0x36c0('0x36')](_0x589405['model'],_0x589405[_0x36c0('0x33')]);_0x3c88ae[_0x36c0('0x37')]=_[_0x36c0('0x36')](_0x589405[_0x36c0('0x32')],qs[_0x36c0('0x38')](_0x4e6454[_0x36c0('0x33')]['fields']));_0x3c88ae[_0x36c0('0x37')]=_0x3c88ae['attributes']['length']?_0x3c88ae[_0x36c0('0x37')]:_0x589405[_0x36c0('0x32')];if(!_0x4e6454[_0x36c0('0x33')][_0x36c0('0x54')](_0x36c0('0x3a'))){_0x3c88ae[_0x36c0('0x20')]=qs['limit'](_0x4e6454[_0x36c0('0x33')][_0x36c0('0x20')]);_0x3c88ae[_0x36c0('0x1f')]=qs[_0x36c0('0x1f')](_0x4e6454[_0x36c0('0x33')][_0x36c0('0x1f')]);}_0x3c88ae[_0x36c0('0x3b')]=qs['sort'](_0x4e6454['query']['sort']);_0x3c88ae['where']=qs[_0x36c0('0x35')](_[_0x36c0('0x3e')](_0x4e6454[_0x36c0('0x33')],_0x589405['filters']));_0x3c88ae[_0x36c0('0x3d')][_0x36c0('0x55')]=_0x330a7a['id'];if(_0x4e6454[_0x36c0('0x33')][_0x36c0('0x40')]){_0x3c88ae[_0x36c0('0x3d')]=_[_0x36c0('0x45')](_0x3c88ae[_0x36c0('0x3d')],{'$or':_[_0x36c0('0x2c')](_0x3c88ae[_0x36c0('0x37')],function(_0x332e5b){var _0xba79ef={};_0xba79ef[_0x332e5b]={'$like':'%'+_0x4e6454[_0x36c0('0x33')][_0x36c0('0x40')]+'%'};return _0xba79ef;})});}_0x3c88ae=_['merge']({},_0x3c88ae,_0x4e6454['options']);return db['UserWhatsappQueue'][_0x36c0('0x56')](_0x3c88ae);}})['then'](function(_0x4a461d){if(_0x4a461d){return db['User'][_0x36c0('0x57')]({'where':{'id':_[_0x36c0('0x2c')](_0x4a461d,_0x36c0('0x58')),'role':_0x36c0('0x59')},'attributes':['id','name',_0x36c0('0x5a'),_0x36c0('0x5b'),'createdAt']});}})[_0x36c0('0x23')](function(_0x3ef1fa){if(_0x3ef1fa){return{'count':_0x3ef1fa[_0x36c0('0x1e')],'rows':_[_0x36c0('0x2c')](_0x3ef1fa[_0x36c0('0x43')],function(_0xe1359c){return{'membername':_0xe1359c[_0x36c0('0x2a')],'UserId':_0xe1359c['id'],'queue_name':_0x2f0758[_0x36c0('0x2a')],'WhatsappQueueId':_0x2f0758['id'],'interface':util[_0x36c0('0x5c')]('%s/%s',_0x36c0('0x5d'),_0xe1359c[_0x36c0('0x2a')]),'penalty':0x0,'paused':_0xe1359c[_0x36c0('0x5a')],'createdAt':_0xe1359c[_0x36c0('0x5e')],'updatedAt':_0xe1359c[_0x36c0('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x36c0('0x23')](respondWithFilteredResult(_0x5ff3e0,_0x3c88ae))[_0x36c0('0x46')](handleError(_0x5ff3e0,null));};exports[_0x36c0('0x5f')]=function(_0x13b75f,_0x442138,_0x2f9b15){var _0x3c2726={};var _0x234449={};var _0x2368ba;var _0x574643;return db[_0x36c0('0x2d')][_0x36c0('0x52')]({'where':{'id':_0x13b75f[_0x36c0('0x44')]['id']}})['then'](handleEntityNotFound(_0x442138,null))[_0x36c0('0x23')](function(_0x48957d){if(_0x48957d){_0x2368ba=_0x48957d;_0x234449[_0x36c0('0x32')]=_['keys'](db[_0x36c0('0x60')][_0x36c0('0x2e')]);_0x234449[_0x36c0('0x33')]=_[_0x36c0('0x34')](_0x13b75f['query']);_0x234449['filters']=_[_0x36c0('0x36')](_0x234449[_0x36c0('0x32')],_0x234449[_0x36c0('0x33')]);_0x3c2726[_0x36c0('0x37')]=_[_0x36c0('0x36')](_0x234449[_0x36c0('0x32')],qs[_0x36c0('0x38')](_0x13b75f[_0x36c0('0x33')][_0x36c0('0x38')]));_0x3c2726['attributes']=_0x3c2726[_0x36c0('0x37')][_0x36c0('0x39')]?_0x3c2726['attributes']:_0x234449[_0x36c0('0x32')];_0x3c2726[_0x36c0('0x3b')]=qs[_0x36c0('0x3c')](_0x13b75f[_0x36c0('0x33')]['sort']);_0x3c2726[_0x36c0('0x3d')]=qs[_0x36c0('0x35')](_[_0x36c0('0x3e')](_0x13b75f[_0x36c0('0x33')],_0x234449[_0x36c0('0x35')]));if(_0x13b75f[_0x36c0('0x33')][_0x36c0('0x40')]){_0x3c2726[_0x36c0('0x3d')]=_[_0x36c0('0x45')](_0x3c2726[_0x36c0('0x3d')],{'$or':_['map'](_0x3c2726[_0x36c0('0x37')],function(_0x4cfa98){var _0x117c99={};_0x117c99[_0x4cfa98]={'$like':'%'+_0x13b75f[_0x36c0('0x33')][_0x36c0('0x40')]+'%'};return _0x117c99;})});}_0x3c2726=_['merge']({},_0x3c2726,_0x13b75f[_0x36c0('0x41')]);return _0x2368ba['getTeams'](_0x3c2726);}})['then'](function(_0xc5c964){if(_0xc5c964){_0x574643=_0xc5c964[_0x36c0('0x39')];if(!_0x13b75f[_0x36c0('0x33')][_0x36c0('0x54')]('nolimit')){_0x3c2726['limit']=qs[_0x36c0('0x20')](_0x13b75f[_0x36c0('0x33')]['limit']);_0x3c2726['offset']=qs[_0x36c0('0x1f')](_0x13b75f[_0x36c0('0x33')][_0x36c0('0x1f')]);}return _0x2368ba['getTeams'](_0x3c2726);}})[_0x36c0('0x23')](function(_0x4faee6){if(_0x4faee6){return _0x4faee6?{'count':_0x574643,'rows':_0x4faee6}:null;}})[_0x36c0('0x23')](respondWithResult(_0x442138,null))[_0x36c0('0x46')](handleError(_0x442138,null));};exports[_0x36c0('0x61')]=function(_0x4ff362,_0x3574fa,_0x403843){var _0x345092=_0x4ff362['body']['ids'];return db[_0x36c0('0x60')][_0x36c0('0x56')]({'where':{'id':_0x345092},'attributes':['id'],'include':[{'model':db[_0x36c0('0x62')],'as':_0x36c0('0x63'),'attributes':['id','name','online',_0x36c0('0x64'),_0x36c0('0x65')],'raw':!![]}]})[_0x36c0('0x23')](function(_0xe49f3){if(_0xe49f3){var _0x38b6ba=_[_0x36c0('0x66')](_0xe49f3,function(_0x1aabee){var _0x41a5a7=_0x1aabee['get']({'plain':!![]});return _0x41a5a7[_0x36c0('0x63')];});return db[_0x36c0('0x2d')][_0x36c0('0x4d')]({'where':{'id':_0x4ff362[_0x36c0('0x44')]['id']}})[_0x36c0('0x23')](function(_0x9de1c9){return db[_0x36c0('0x67')][_0x36c0('0x68')](function(_0x11a8f8){return _0x9de1c9[_0x36c0('0x61')](_0x345092,{'transaction':_0x11a8f8})[_0x36c0('0x23')](function(){return BPromise['each'](_0x38b6ba,function(_0x5d468d){return db[_0x36c0('0x53')][_0x36c0('0x69')]({'where':{'UserId':_0x5d468d['id'],'WhatsappQueueId':_0x4ff362[_0x36c0('0x44')]['id']},'transaction':_0x11a8f8});});})[_0x36c0('0x23')](function(){_0x38b6ba[_0x36c0('0x6a')](function(_0x6d28c7){socket[_0x36c0('0x6b')](_0x36c0('0x6c'),{'UserId':_0x6d28c7['id'],'WhatsappQueueId':_0x9de1c9['id']});});});});});}})[_0x36c0('0x23')](respondWithStatusCode(_0x3574fa,null))[_0x36c0('0x46')](handleError(_0x3574fa,null));};exports[_0x36c0('0x6d')]=function(_0x47bcd8,_0x470ec9,_0x5b208b){return db['Team'][_0x36c0('0x56')]({'where':{'id':_0x47bcd8[_0x36c0('0x33')][_0x36c0('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x36c0('0x62')],'as':_0x36c0('0x63'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x470ec9,null))[_0x36c0('0x23')](function(_0x3b82ac){var _0x3c9453=_['map'](_0x3b82ac,'id');var _0x3b6ea2=[];var _0xda4dd0=[];var _0x309781=squel[_0x36c0('0x6f')]();_0x309781['field'](_0x36c0('0x70'))[_0x36c0('0x71')](_0x36c0('0x72'),'tq')[_0x36c0('0x73')](_0x36c0('0x74'),'ut',_0x36c0('0x75'))[_0x36c0('0x3d')](_0x36c0('0x76'),_0x47bcd8['params']['id']);for(var _0x3279a2=0x0;_0x3279a2<_0x3b82ac['length'];_0x3279a2+=0x1){let _0x2f50a9=_0x3b82ac[_0x3279a2];for(var _0x222eb2=0x0;_0x222eb2<_0x2f50a9[_0x36c0('0x63')][_0x36c0('0x39')];_0x222eb2+=0x1){let _0x45f324=_0x2f50a9[_0x36c0('0x63')][_0x222eb2];var _0x46f6f2=_0x309781[_0x36c0('0x77')]();_0x46f6f2[_0x36c0('0x3d')](_0x36c0('0x78'),_0x45f324['id']);_0xda4dd0[_0x36c0('0x79')](db[_0x36c0('0x67')]['query'](_0x46f6f2[_0x36c0('0x7a')](),{'type':db[_0x36c0('0x67')]['QueryTypes'][_0x36c0('0x7b')]})[_0x36c0('0x23')](function(_0x18a895){if(_0x18a895[_0x36c0('0x39')]===0x1){return _0x45f324['id'];}else{var _0x267842=_['every'](_[_0x36c0('0x2c')](_0x18a895,'TeamId'),function(_0x25b9eb){return _[_0x36c0('0x7c')](_0x3c9453,_0x25b9eb);});if(_0x267842){return _0x45f324['id'];}}}));}}return BPromise[_0x36c0('0x7d')](_0xda4dd0)[_0x36c0('0x23')](function(_0x5b3f9c){_0x3b6ea2=_(_0x3b6ea2)[_0x36c0('0x7e')](_0x5b3f9c)['compact']()[_0x36c0('0x7f')]();return db[_0x36c0('0x2d')][_0x36c0('0x4d')]({'where':{'id':_0x47bcd8[_0x36c0('0x44')]['id']}})[_0x36c0('0x23')](function(_0x4c2244){return db[_0x36c0('0x67')][_0x36c0('0x68')](function(_0x144177){return _0x4c2244['removeTeams'](_0x47bcd8['query'][_0x36c0('0x6e')],{'transaction':_0x144177})['then'](function(){if(!_[_0x36c0('0x80')](_0x3b6ea2)){return _0x4c2244[_0x36c0('0x81')](_0x3b6ea2,{'transaction':_0x144177});}})[_0x36c0('0x23')](function(){_0x3b6ea2[_0x36c0('0x6a')](function(_0xaf2f78){socket[_0x36c0('0x6b')]('userWhatsappQueue:remove',{'UserId':_0xaf2f78,'WhatsappQueueId':_0x4c2244['id']});});});});});});})[_0x36c0('0x23')](respondWithStatusCode(_0x470ec9,null))[_0x36c0('0x46')](handleError(_0x470ec9,null));};exports[_0x36c0('0x82')]=function(_0x407ca4,_0xac8680,_0x145208){return db[_0x36c0('0x2d')][_0x36c0('0x4d')]({'where':{'id':_0x407ca4['params']['id']}})[_0x36c0('0x23')](handleEntityNotFound(_0xac8680,null))[_0x36c0('0x23')](function(_0x2a0256){if(_0x2a0256){return _0x2a0256[_0x36c0('0x82')](_0x407ca4[_0x36c0('0x48')][_0x36c0('0x6e')],_[_0x36c0('0x83')](_0x407ca4[_0x36c0('0x48')],[_0x36c0('0x6e'),'id'])||{})['spread'](function(_0x3ab61f){for(var _0x8ae3b1=0x0;_0x8ae3b1<_0x407ca4[_0x36c0('0x48')][_0x36c0('0x6e')][_0x36c0('0x39')];_0x8ae3b1+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':_0x407ca4['body'][_0x36c0('0x6e')][_0x8ae3b1],'WhatsappQueueId':_0x407ca4['params']['id']});}return _0x3ab61f;});}})[_0x36c0('0x23')](respondWithResult(_0xac8680,null))[_0x36c0('0x46')](handleError(_0xac8680,null));};exports['removeAgents']=function(_0x4de33b,_0xe58ffd,_0x4eeb6f){return db[_0x36c0('0x2d')]['find']({'where':{'id':_0x4de33b[_0x36c0('0x44')]['id']}})[_0x36c0('0x23')](handleEntityNotFound(_0xe58ffd,null))[_0x36c0('0x23')](function(_0x27e591){if(_0x27e591){return _0x27e591[_0x36c0('0x81')](_0x4de33b[_0x36c0('0x33')]['ids'])[_0x36c0('0x23')](function(){if(_['isArray'](_0x4de33b[_0x36c0('0x33')][_0x36c0('0x6e')])){for(var _0x1cc7e2=0x0;_0x1cc7e2<_0x4de33b[_0x36c0('0x33')][_0x36c0('0x6e')]['length'];_0x1cc7e2+=0x1){socket['emit'](_0x36c0('0x84'),{'UserId':Number(_0x4de33b[_0x36c0('0x33')][_0x36c0('0x6e')][_0x1cc7e2]),'WhatsappQueueId':Number(_0x4de33b[_0x36c0('0x44')]['id'])});}}else{socket[_0x36c0('0x6b')](_0x36c0('0x84'),{'UserId':Number(_0x4de33b['query'][_0x36c0('0x6e')]),'WhatsappQueueId':Number(_0x4de33b[_0x36c0('0x44')]['id'])});}});}})[_0x36c0('0x23')](respondWithStatusCode(_0xe58ffd,null))['catch'](handleError(_0xe58ffd,null));};exports[_0x36c0('0x85')]=function(_0x1f2be3,_0x441072,_0x208e91){var _0x2c2c6c={};var _0x53d352={};var _0x3e8374;var _0x377400;return db['WhatsappQueue'][_0x36c0('0x52')]({'where':{'id':_0x1f2be3[_0x36c0('0x44')]['id']}})['then'](handleEntityNotFound(_0x441072,null))['then'](function(_0x19e2a1){if(_0x19e2a1){_0x3e8374=_0x19e2a1;_0x53d352[_0x36c0('0x32')]=_[_0x36c0('0x34')](db[_0x36c0('0x62')]['rawAttributes']);_0x53d352[_0x36c0('0x33')]=_[_0x36c0('0x34')](_0x1f2be3[_0x36c0('0x33')]);_0x53d352[_0x36c0('0x35')]=_['intersection'](_0x53d352[_0x36c0('0x32')],_0x53d352['query']);_0x2c2c6c[_0x36c0('0x37')]=_['intersection'](_0x53d352[_0x36c0('0x32')],qs[_0x36c0('0x38')](_0x1f2be3[_0x36c0('0x33')][_0x36c0('0x38')]));_0x2c2c6c[_0x36c0('0x37')]=_0x2c2c6c[_0x36c0('0x37')][_0x36c0('0x39')]?_0x2c2c6c[_0x36c0('0x37')]:_0x53d352[_0x36c0('0x32')];_0x2c2c6c['order']=qs[_0x36c0('0x3c')](_0x1f2be3[_0x36c0('0x33')]['sort']);_0x2c2c6c[_0x36c0('0x3d')]=qs[_0x36c0('0x35')](_[_0x36c0('0x3e')](_0x1f2be3[_0x36c0('0x33')],_0x53d352[_0x36c0('0x35')]));if(_0x1f2be3[_0x36c0('0x33')]['filter']){_0x2c2c6c[_0x36c0('0x3d')]=_[_0x36c0('0x45')](_0x2c2c6c[_0x36c0('0x3d')],{'$or':_['map'](_0x2c2c6c[_0x36c0('0x37')],function(_0x8660ea){var _0x28ace4={};_0x28ace4[_0x8660ea]={'$like':'%'+_0x1f2be3[_0x36c0('0x33')][_0x36c0('0x40')]+'%'};return _0x28ace4;})});}_0x2c2c6c=_[_0x36c0('0x45')]({},_0x2c2c6c,_0x1f2be3['options']);return _0x3e8374[_0x36c0('0x85')](_0x2c2c6c);}})['then'](function(_0x2f70d5){if(_0x2f70d5){_0x377400=_0x2f70d5[_0x36c0('0x39')];if(!_0x1f2be3[_0x36c0('0x33')][_0x36c0('0x54')](_0x36c0('0x3a'))){_0x2c2c6c[_0x36c0('0x20')]=qs[_0x36c0('0x20')](_0x1f2be3['query'][_0x36c0('0x20')]);_0x2c2c6c['offset']=qs[_0x36c0('0x1f')](_0x1f2be3[_0x36c0('0x33')][_0x36c0('0x1f')]);}return _0x3e8374[_0x36c0('0x85')](_0x2c2c6c);}})[_0x36c0('0x23')](function(_0x58d40f){if(_0x58d40f){return _0x58d40f?{'count':_0x377400,'rows':_0x58d40f}:null;}})[_0x36c0('0x23')](respondWithResult(_0x441072,null))[_0x36c0('0x46')](handleError(_0x441072,null));}; \ No newline at end of file +var _0x4423=['autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','%s/%s','createdAt','updatedAt','Team','length','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','WhatsappQueues','end','name','send','map','WhatsappQueue','rawAttributes','fieldName','query','intersection','attributes','model','fields','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x59564a,_0x47b619){var _0x511773=function(_0x582f4d){while(--_0x582f4d){_0x59564a['push'](_0x59564a['shift']());}};_0x511773(++_0x47b619);}(_0x4423,0x15e));var _0x3442=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x4423[_0xf2628e];return _0x13863a;};'use strict';var pdf=require(_0x3442('0x0'));var emlformat=require(_0x3442('0x1'));var rimraf=require(_0x3442('0x2'));var zipdir=require(_0x3442('0x3'));var jsonpatch=require(_0x3442('0x4'));var rp=require(_0x3442('0x5'));var moment=require(_0x3442('0x6'));var BPromise=require(_0x3442('0x7'));var Mustache=require(_0x3442('0x8'));var util=require(_0x3442('0x9'));var path=require(_0x3442('0xa'));var sox=require('sox');var csv=require(_0x3442('0xb'));var ejs=require(_0x3442('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3442('0xd'));var crypto=require(_0x3442('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3442('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3442('0x10'));var Papa=require(_0x3442('0x11'));var Redis=require(_0x3442('0x12'));var authService=require(_0x3442('0x13'));var qs=require(_0x3442('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3442('0x15'));var logger=require(_0x3442('0x16'))(_0x3442('0x17'));var utils=require(_0x3442('0x18'));var config=require(_0x3442('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3442('0x1a'))['db'];config['redis']=_[_0x3442('0x1b')](config[_0x3442('0x1c')],{'host':_0x3442('0x1d'),'port':0x18eb});var socket=require(_0x3442('0x1e'))(new Redis(config[_0x3442('0x1c')]));require(_0x3442('0x1f'))['register'](socket);function respondWithStatusCode(_0x332529,_0x176d19){_0x176d19=_0x176d19||0xcc;return function(_0x332132){if(_0x332132){return _0x332529[_0x3442('0x20')](_0x176d19);}return _0x332529['status'](_0x176d19)['end']();};}function respondWithResult(_0x272758,_0x179c8e){_0x179c8e=_0x179c8e||0xc8;return function(_0x7851a9){if(_0x7851a9){return _0x272758[_0x3442('0x21')](_0x179c8e)[_0x3442('0x22')](_0x7851a9);}};}function respondWithFilteredResult(_0x2e3e4e,_0x39fd15){return function(_0x41da86){if(_0x41da86){var _0x710306=_0x41da86[_0x3442('0x23')],_0x83bddf=_0x39fd15[_0x3442('0x24')],_0x5874a1=_0x39fd15[_0x3442('0x24')]+_0x39fd15[_0x3442('0x25')],_0x636f83;if(_0x5874a1>=_0x710306){_0x5874a1=_0x710306;_0x636f83=0xc8;}else{_0x636f83=0xce;}_0x2e3e4e[_0x3442('0x21')](_0x636f83);return _0x2e3e4e[_0x3442('0x26')](_0x3442('0x27'),_0x83bddf+'-'+_0x5874a1+'/'+_0x710306)[_0x3442('0x22')](_0x41da86);}return null;};}function patchUpdates(_0x289f86){return function(_0x56abd5){try{jsonpatch['apply'](_0x56abd5,_0x289f86,!![]);}catch(_0x3ea551){return BPromise[_0x3442('0x28')](_0x3ea551);}return _0x56abd5[_0x3442('0x29')]();};}function saveUpdates(_0x5603f9,_0x1aa8b4){return function(_0x4b29e7){if(_0x4b29e7){return _0x4b29e7[_0x3442('0x2a')](_0x5603f9)[_0x3442('0x2b')](function(_0x2cceca){return _0x2cceca;});}return null;};}function removeEntity(_0x4e1110,_0x37034d){return function(_0x3dc95d){if(_0x3dc95d){return _0x3dc95d[_0x3442('0x2c')]()[_0x3442('0x2b')](function(){var _0xb754f5=_0x3dc95d['get']({'plain':!![]});var _0x4e965b=_0x3442('0x2d');return db['UserProfileResource'][_0x3442('0x2c')]({'where':{'type':_0x4e965b,'resourceId':_0xb754f5['id']}})[_0x3442('0x2b')](function(){return _0x3dc95d;});})[_0x3442('0x2b')](function(){_0x4e1110[_0x3442('0x21')](0xcc)[_0x3442('0x2e')]();});}};}function handleEntityNotFound(_0x5688fc,_0x208f9d){return function(_0x264b43){if(!_0x264b43){_0x5688fc[_0x3442('0x20')](0x194);}return _0x264b43;};}function handleError(_0x8468a7,_0x22f0bd){_0x22f0bd=_0x22f0bd||0x1f4;return function(_0x4dab2b){logger['error'](_0x4dab2b['stack']);if(_0x4dab2b['name']){delete _0x4dab2b[_0x3442('0x2f')];}_0x8468a7[_0x3442('0x21')](_0x22f0bd)[_0x3442('0x30')](_0x4dab2b);};}exports['index']=function(_0x5d010c,_0x5eccfc){var _0x173135={},_0x18022a={},_0x541768={'count':0x0,'rows':[]};var _0x552d5d=_[_0x3442('0x31')](db[_0x3442('0x32')][_0x3442('0x33')],function(_0x68843){return{'name':_0x68843[_0x3442('0x34')],'type':_0x68843['type']['key']};});_0x18022a['model']=_[_0x3442('0x31')](_0x552d5d,_0x3442('0x2f'));_0x18022a[_0x3442('0x35')]=_['keys'](_0x5d010c[_0x3442('0x35')]);_0x18022a['filters']=_[_0x3442('0x36')](_0x18022a['model'],_0x18022a[_0x3442('0x35')]);_0x173135[_0x3442('0x37')]=_[_0x3442('0x36')](_0x18022a[_0x3442('0x38')],qs[_0x3442('0x39')](_0x5d010c['query'][_0x3442('0x39')]));_0x173135['attributes']=_0x173135['attributes']['length']?_0x173135['attributes']:_0x18022a['model'];if(!_0x5d010c[_0x3442('0x35')]['hasOwnProperty'](_0x3442('0x3a'))){_0x173135[_0x3442('0x25')]=qs[_0x3442('0x25')](_0x5d010c[_0x3442('0x35')][_0x3442('0x25')]);_0x173135[_0x3442('0x24')]=qs[_0x3442('0x24')](_0x5d010c['query'][_0x3442('0x24')]);}_0x173135[_0x3442('0x3b')]=qs[_0x3442('0x3c')](_0x5d010c['query'][_0x3442('0x3c')]);_0x173135[_0x3442('0x3d')]=qs[_0x3442('0x3e')](_[_0x3442('0x3f')](_0x5d010c['query'],_0x18022a[_0x3442('0x3e')]),_0x552d5d);if(_0x5d010c['query'][_0x3442('0x40')]){_0x173135[_0x3442('0x3d')]=_[_0x3442('0x41')](_0x173135[_0x3442('0x3d')],{'$or':_[_0x3442('0x31')](_0x552d5d,function(_0x4917a8){if(_0x4917a8[_0x3442('0x42')]!==_0x3442('0x43')){var _0xc6c576={};_0xc6c576[_0x4917a8['name']]={'$like':'%'+_0x5d010c['query']['filter']+'%'};return _0xc6c576;}})});}_0x173135=_['merge']({},_0x173135,_0x5d010c[_0x3442('0x44')]);var _0x27455c={'where':_0x173135[_0x3442('0x3d')]};return db[_0x3442('0x32')][_0x3442('0x23')](_0x27455c)[_0x3442('0x2b')](function(_0x5201d8){_0x541768[_0x3442('0x23')]=_0x5201d8;if(_0x5d010c[_0x3442('0x35')][_0x3442('0x45')]){_0x173135[_0x3442('0x46')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x3442('0x47')](_0x173135);})[_0x3442('0x2b')](function(_0x579d0a){_0x541768[_0x3442('0x48')]=_0x579d0a;return _0x541768;})[_0x3442('0x2b')](respondWithFilteredResult(_0x5eccfc,_0x173135))['catch'](handleError(_0x5eccfc,null));};exports[_0x3442('0x49')]=function(_0x74919f,_0x2ffeb1){var _0x57971d={'raw':!![],'where':{'id':_0x74919f[_0x3442('0x4a')]['id']}},_0x3ff152={};_0x3ff152[_0x3442('0x38')]=_['keys'](db[_0x3442('0x32')][_0x3442('0x33')]);_0x3ff152[_0x3442('0x35')]=_[_0x3442('0x4b')](_0x74919f[_0x3442('0x35')]);_0x3ff152[_0x3442('0x3e')]=_[_0x3442('0x36')](_0x3ff152[_0x3442('0x38')],_0x3ff152[_0x3442('0x35')]);_0x57971d['attributes']=_[_0x3442('0x36')](_0x3ff152['model'],qs[_0x3442('0x39')](_0x74919f['query']['fields']));_0x57971d[_0x3442('0x37')]=_0x57971d[_0x3442('0x37')]['length']?_0x57971d[_0x3442('0x37')]:_0x3ff152[_0x3442('0x38')];if(_0x74919f[_0x3442('0x35')][_0x3442('0x45')]){_0x57971d[_0x3442('0x46')]=[{'all':!![]}];}_0x57971d=_[_0x3442('0x41')]({},_0x57971d,_0x74919f[_0x3442('0x44')]);return db[_0x3442('0x32')][_0x3442('0x4c')](_0x57971d)[_0x3442('0x2b')](handleEntityNotFound(_0x2ffeb1,null))[_0x3442('0x2b')](respondWithResult(_0x2ffeb1,null))[_0x3442('0x4d')](handleError(_0x2ffeb1,null));};exports[_0x3442('0x4e')]=function(_0x5f3b05,_0x545fb8){return db[_0x3442('0x32')]['create'](_0x5f3b05[_0x3442('0x4f')],{})['then'](function(_0x2e2412){var _0x2e2007=_0x5f3b05[_0x3442('0x50')][_0x3442('0x51')]({'plain':!![]});if(!_0x2e2007)throw new Error(_0x3442('0x52'));if(_0x2e2007[_0x3442('0x53')]===_0x3442('0x50')){var _0x44fca8=_0x2e2412['get']({'plain':!![]});var _0x19178b='WhatsappQueues';return db['UserProfileSection']['find']({'where':{'name':_0x19178b,'userProfileId':_0x2e2007[_0x3442('0x54')]},'raw':!![]})[_0x3442('0x2b')](function(_0x579a4d){if(_0x579a4d&&_0x579a4d[_0x3442('0x55')]===0x0){return db[_0x3442('0x56')][_0x3442('0x4e')]({'name':_0x44fca8[_0x3442('0x2f')],'resourceId':_0x44fca8['id'],'type':_0x579a4d[_0x3442('0x2f')],'sectionId':_0x579a4d['id']},{})[_0x3442('0x2b')](function(){return _0x2e2412;});}else{return _0x2e2412;}})['catch'](function(_0x154c9f){logger[_0x3442('0x57')](_0x3442('0x58'),_0x154c9f);throw _0x154c9f;});}return _0x2e2412;})['then'](respondWithResult(_0x545fb8,0xc9))['catch'](handleError(_0x545fb8,null));};exports[_0x3442('0x2a')]=function(_0x6f3fe5,_0x1b9bcc){if(_0x6f3fe5[_0x3442('0x4f')]['id']){delete _0x6f3fe5[_0x3442('0x4f')]['id'];}return db[_0x3442('0x32')][_0x3442('0x4c')]({'where':{'id':_0x6f3fe5[_0x3442('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b9bcc,null))['then'](saveUpdates(_0x6f3fe5['body'],null))['then'](respondWithResult(_0x1b9bcc,null))[_0x3442('0x4d')](handleError(_0x1b9bcc,null));};exports[_0x3442('0x2c')]=function(_0x3fc495,_0x510f92){return db['WhatsappQueue'][_0x3442('0x4c')]({'where':{'id':_0x3fc495['params']['id']}})['then'](handleEntityNotFound(_0x510f92,null))[_0x3442('0x2b')](removeEntity(_0x510f92,null))[_0x3442('0x4d')](handleError(_0x510f92,null));};exports[_0x3442('0x59')]=function(_0x5556e5,_0x3bff3a){return db[_0x3442('0x32')][_0x3442('0x59')]()[_0x3442('0x2b')](respondWithResult(_0x3bff3a,null))['catch'](handleError(_0x3bff3a,null));};exports[_0x3442('0x5a')]=function(_0x4af6a4,_0x1a42ef,_0x27302){var _0x3b2532={'raw':!![],'where':{}},_0x122198={},_0x3331d6;return db[_0x3442('0x32')][_0x3442('0x5b')]({'where':{'id':_0x4af6a4[_0x3442('0x4a')]['id']}})[_0x3442('0x2b')](handleEntityNotFound(_0x1a42ef,null))[_0x3442('0x2b')](function(_0xafcdb6){if(_0xafcdb6){_0x3331d6=_0xafcdb6[_0x3442('0x51')]({'plain':!![]});_0x122198[_0x3442('0x38')]=_['keys'](db[_0x3442('0x5c')][_0x3442('0x33')]);_0x122198[_0x3442('0x35')]=_[_0x3442('0x4b')](_0x4af6a4[_0x3442('0x35')]);_0x122198[_0x3442('0x3e')]=_[_0x3442('0x36')](_0x122198[_0x3442('0x38')],_0x122198[_0x3442('0x35')]);_0x3b2532[_0x3442('0x37')]=_['intersection'](_0x122198[_0x3442('0x38')],qs[_0x3442('0x39')](_0x4af6a4[_0x3442('0x35')]['fields']));_0x3b2532[_0x3442('0x37')]=_0x3b2532[_0x3442('0x37')]['length']?_0x3b2532['attributes']:_0x122198[_0x3442('0x38')];if(!_0x4af6a4[_0x3442('0x35')][_0x3442('0x5d')](_0x3442('0x3a'))){_0x3b2532[_0x3442('0x25')]=qs[_0x3442('0x25')](_0x4af6a4[_0x3442('0x35')][_0x3442('0x25')]);_0x3b2532[_0x3442('0x24')]=qs[_0x3442('0x24')](_0x4af6a4[_0x3442('0x35')][_0x3442('0x24')]);}_0x3b2532['order']=qs['sort'](_0x4af6a4[_0x3442('0x35')][_0x3442('0x3c')]);_0x3b2532[_0x3442('0x3d')]=qs[_0x3442('0x3e')](_[_0x3442('0x3f')](_0x4af6a4[_0x3442('0x35')],_0x122198[_0x3442('0x3e')]));_0x3b2532[_0x3442('0x3d')][_0x3442('0x5e')]=_0xafcdb6['id'];if(_0x4af6a4[_0x3442('0x35')]['filter']){_0x3b2532[_0x3442('0x3d')]=_[_0x3442('0x41')](_0x3b2532['where'],{'$or':_['map'](_0x3b2532[_0x3442('0x37')],function(_0x335e7f){var _0x523d3b={};_0x523d3b[_0x335e7f]={'$like':'%'+_0x4af6a4[_0x3442('0x35')][_0x3442('0x40')]+'%'};return _0x523d3b;})});}_0x3b2532=_[_0x3442('0x41')]({},_0x3b2532,_0x4af6a4[_0x3442('0x44')]);return db[_0x3442('0x5c')]['findAll'](_0x3b2532);}})[_0x3442('0x2b')](function(_0xa4e333){if(_0xa4e333){return db[_0x3442('0x5f')][_0x3442('0x60')]({'where':{'id':_[_0x3442('0x31')](_0xa4e333,_0x3442('0x61')),'role':_0x3442('0x62')},'attributes':['id',_0x3442('0x2f'),_0x3442('0x63'),'updatedAt','createdAt']});}})[_0x3442('0x2b')](function(_0x14575f){if(_0x14575f){return{'count':_0x14575f[_0x3442('0x23')],'rows':_[_0x3442('0x31')](_0x14575f[_0x3442('0x48')],function(_0x559425){return{'membername':_0x559425['name'],'UserId':_0x559425['id'],'queue_name':_0x3331d6[_0x3442('0x2f')],'WhatsappQueueId':_0x3331d6['id'],'interface':util['format'](_0x3442('0x64'),'SIP',_0x559425['name']),'penalty':0x0,'paused':_0x559425[_0x3442('0x63')],'createdAt':_0x559425[_0x3442('0x65')],'updatedAt':_0x559425[_0x3442('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3442('0x2b')](respondWithFilteredResult(_0x1a42ef,_0x3b2532))[_0x3442('0x4d')](handleError(_0x1a42ef,null));};exports['getTeams']=function(_0x1d6b87,_0x411e84,_0x2dc662){var _0x57cc79={};var _0x1fe37b={};var _0x15b005;var _0xa652f9;return db[_0x3442('0x32')][_0x3442('0x5b')]({'where':{'id':_0x1d6b87[_0x3442('0x4a')]['id']}})[_0x3442('0x2b')](handleEntityNotFound(_0x411e84,null))[_0x3442('0x2b')](function(_0x24fd19){if(_0x24fd19){_0x15b005=_0x24fd19;_0x1fe37b['model']=_[_0x3442('0x4b')](db[_0x3442('0x67')][_0x3442('0x33')]);_0x1fe37b[_0x3442('0x35')]=_[_0x3442('0x4b')](_0x1d6b87[_0x3442('0x35')]);_0x1fe37b['filters']=_['intersection'](_0x1fe37b[_0x3442('0x38')],_0x1fe37b[_0x3442('0x35')]);_0x57cc79[_0x3442('0x37')]=_[_0x3442('0x36')](_0x1fe37b[_0x3442('0x38')],qs[_0x3442('0x39')](_0x1d6b87['query'][_0x3442('0x39')]));_0x57cc79[_0x3442('0x37')]=_0x57cc79[_0x3442('0x37')][_0x3442('0x68')]?_0x57cc79[_0x3442('0x37')]:_0x1fe37b[_0x3442('0x38')];_0x57cc79[_0x3442('0x3b')]=qs[_0x3442('0x3c')](_0x1d6b87['query'][_0x3442('0x3c')]);_0x57cc79[_0x3442('0x3d')]=qs[_0x3442('0x3e')](_[_0x3442('0x3f')](_0x1d6b87['query'],_0x1fe37b[_0x3442('0x3e')]));if(_0x1d6b87[_0x3442('0x35')][_0x3442('0x40')]){_0x57cc79['where']=_[_0x3442('0x41')](_0x57cc79['where'],{'$or':_['map'](_0x57cc79[_0x3442('0x37')],function(_0x2fafd1){var _0x49e459={};_0x49e459[_0x2fafd1]={'$like':'%'+_0x1d6b87['query'][_0x3442('0x40')]+'%'};return _0x49e459;})});}_0x57cc79=_[_0x3442('0x41')]({},_0x57cc79,_0x1d6b87[_0x3442('0x44')]);return _0x15b005[_0x3442('0x69')](_0x57cc79);}})['then'](function(_0x487bb3){if(_0x487bb3){_0xa652f9=_0x487bb3[_0x3442('0x68')];if(!_0x1d6b87[_0x3442('0x35')][_0x3442('0x5d')]('nolimit')){_0x57cc79[_0x3442('0x25')]=qs['limit'](_0x1d6b87['query'][_0x3442('0x25')]);_0x57cc79[_0x3442('0x24')]=qs[_0x3442('0x24')](_0x1d6b87[_0x3442('0x35')]['offset']);}return _0x15b005[_0x3442('0x69')](_0x57cc79);}})[_0x3442('0x2b')](function(_0x4fe57e){if(_0x4fe57e){return _0x4fe57e?{'count':_0xa652f9,'rows':_0x4fe57e}:null;}})[_0x3442('0x2b')](respondWithResult(_0x411e84,null))[_0x3442('0x4d')](handleError(_0x411e84,null));};exports[_0x3442('0x6a')]=function(_0xfa4124,_0x129f49,_0x181088){var _0x1baa44=_0xfa4124[_0x3442('0x4f')][_0x3442('0x6b')];return db['Team'][_0x3442('0x47')]({'where':{'id':_0x1baa44},'attributes':['id'],'include':[{'model':db[_0x3442('0x5f')],'as':_0x3442('0x6c'),'attributes':['id','name',_0x3442('0x6d'),_0x3442('0x6e'),'interface'],'raw':!![]}]})[_0x3442('0x2b')](function(_0x19dfb5){if(_0x19dfb5){var _0x4694d2=_[_0x3442('0x6f')](_0x19dfb5,function(_0x4da35f){var _0x5d5ae4=_0x4da35f[_0x3442('0x51')]({'plain':!![]});return _0x5d5ae4['Agents'];});return db['WhatsappQueue'][_0x3442('0x4c')]({'where':{'id':_0xfa4124[_0x3442('0x4a')]['id']}})[_0x3442('0x2b')](function(_0xdb4a55){return db[_0x3442('0x70')][_0x3442('0x71')](function(_0x5783d7){return _0xdb4a55[_0x3442('0x6a')](_0x1baa44,{'transaction':_0x5783d7})['then'](function(){return BPromise[_0x3442('0x72')](_0x4694d2,function(_0x5dd4af){return db['UserWhatsappQueue'][_0x3442('0x73')]({'where':{'UserId':_0x5dd4af['id'],'WhatsappQueueId':_0xfa4124[_0x3442('0x4a')]['id']},'transaction':_0x5783d7});});})[_0x3442('0x2b')](function(){_0x4694d2['forEach'](function(_0x240457){socket[_0x3442('0x74')]('userWhatsappQueue:save',{'UserId':_0x240457['id'],'WhatsappQueueId':_0xdb4a55['id']});});});});});}})[_0x3442('0x2b')](respondWithStatusCode(_0x129f49,null))[_0x3442('0x4d')](handleError(_0x129f49,null));};exports[_0x3442('0x75')]=function(_0x4bd85a,_0x153daf,_0xa244f2){return db['Team'][_0x3442('0x47')]({'where':{'id':_0x4bd85a[_0x3442('0x35')][_0x3442('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x3442('0x2b')](handleEntityNotFound(_0x153daf,null))[_0x3442('0x2b')](function(_0x145429){var _0xa72e1e=_[_0x3442('0x31')](_0x145429,'id');var _0x13217b=[];var _0x1b0a27=[];var _0x56a44d=squel['select']();_0x56a44d['field'](_0x3442('0x76'))[_0x3442('0x77')](_0x3442('0x78'),'tq')[_0x3442('0x79')](_0x3442('0x7a'),'ut',_0x3442('0x7b'))[_0x3442('0x3d')](_0x3442('0x7c'),_0x4bd85a['params']['id']);for(var _0x4da21d=0x0;_0x4da21d<_0x145429[_0x3442('0x68')];_0x4da21d+=0x1){let _0x971598=_0x145429[_0x4da21d];for(var _0x21c378=0x0;_0x21c378<_0x971598[_0x3442('0x6c')][_0x3442('0x68')];_0x21c378+=0x1){let _0x22d10f=_0x971598[_0x3442('0x6c')][_0x21c378];var _0xb6e4a=_0x56a44d[_0x3442('0x7d')]();_0xb6e4a['where'](_0x3442('0x7e'),_0x22d10f['id']);_0x1b0a27[_0x3442('0x7f')](db[_0x3442('0x70')][_0x3442('0x35')](_0xb6e4a[_0x3442('0x80')](),{'type':db[_0x3442('0x70')][_0x3442('0x81')][_0x3442('0x82')]})[_0x3442('0x2b')](function(_0x46e770){if(_0x46e770[_0x3442('0x68')]===0x1){return _0x22d10f['id'];}else{var _0x539923=_['every'](_[_0x3442('0x31')](_0x46e770,_0x3442('0x83')),function(_0x2bcdf1){return _[_0x3442('0x84')](_0xa72e1e,_0x2bcdf1);});if(_0x539923){return _0x22d10f['id'];}}}));}}return BPromise[_0x3442('0x85')](_0x1b0a27)[_0x3442('0x2b')](function(_0x50969b){_0x13217b=_(_0x13217b)[_0x3442('0x86')](_0x50969b)['compact']()['value']();return db[_0x3442('0x32')]['find']({'where':{'id':_0x4bd85a[_0x3442('0x4a')]['id']}})[_0x3442('0x2b')](function(_0x22f23d){return db[_0x3442('0x70')][_0x3442('0x71')](function(_0x18704b){return _0x22f23d[_0x3442('0x75')](_0x4bd85a[_0x3442('0x35')][_0x3442('0x6b')],{'transaction':_0x18704b})[_0x3442('0x2b')](function(){if(!_[_0x3442('0x87')](_0x13217b)){return _0x22f23d[_0x3442('0x88')](_0x13217b,{'transaction':_0x18704b});}})[_0x3442('0x2b')](function(){_0x13217b[_0x3442('0x89')](function(_0x52e706){socket['emit'](_0x3442('0x8a'),{'UserId':_0x52e706,'WhatsappQueueId':_0x22f23d['id']});});});});});});})['then'](respondWithStatusCode(_0x153daf,null))['catch'](handleError(_0x153daf,null));};exports[_0x3442('0x8b')]=function(_0x3e7bcb,_0x633bf8,_0x21233d){return db[_0x3442('0x32')][_0x3442('0x4c')]({'where':{'id':_0x3e7bcb[_0x3442('0x4a')]['id']}})[_0x3442('0x2b')](handleEntityNotFound(_0x633bf8,null))[_0x3442('0x2b')](function(_0x3fd99d){if(_0x3fd99d){return _0x3fd99d[_0x3442('0x8b')](_0x3e7bcb[_0x3442('0x4f')][_0x3442('0x6b')],_[_0x3442('0x8c')](_0x3e7bcb[_0x3442('0x4f')],[_0x3442('0x6b'),'id'])||{})[_0x3442('0x8d')](function(_0x22877a){for(var _0x4c32b7=0x0;_0x4c32b7<_0x3e7bcb[_0x3442('0x4f')][_0x3442('0x6b')][_0x3442('0x68')];_0x4c32b7+=0x1){socket[_0x3442('0x74')](_0x3442('0x8e'),{'UserId':_0x3e7bcb[_0x3442('0x4f')]['ids'][_0x4c32b7],'WhatsappQueueId':_0x3e7bcb[_0x3442('0x4a')]['id']});}return _0x22877a;});}})['then'](respondWithResult(_0x633bf8,null))['catch'](handleError(_0x633bf8,null));};exports[_0x3442('0x88')]=function(_0x223edd,_0x4a8f03,_0x882138){return db[_0x3442('0x32')][_0x3442('0x4c')]({'where':{'id':_0x223edd[_0x3442('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a8f03,null))[_0x3442('0x2b')](function(_0x275d17){if(_0x275d17){return _0x275d17[_0x3442('0x88')](_0x223edd[_0x3442('0x35')][_0x3442('0x6b')])['then'](function(){if(_[_0x3442('0x8f')](_0x223edd[_0x3442('0x35')][_0x3442('0x6b')])){for(var _0x5dad77=0x0;_0x5dad77<_0x223edd[_0x3442('0x35')]['ids'][_0x3442('0x68')];_0x5dad77+=0x1){socket[_0x3442('0x74')](_0x3442('0x8a'),{'UserId':Number(_0x223edd['query'][_0x3442('0x6b')][_0x5dad77]),'WhatsappQueueId':Number(_0x223edd[_0x3442('0x4a')]['id'])});}}else{socket[_0x3442('0x74')](_0x3442('0x8a'),{'UserId':Number(_0x223edd[_0x3442('0x35')][_0x3442('0x6b')]),'WhatsappQueueId':Number(_0x223edd[_0x3442('0x4a')]['id'])});}});}})[_0x3442('0x2b')](respondWithStatusCode(_0x4a8f03,null))['catch'](handleError(_0x4a8f03,null));};exports[_0x3442('0x90')]=function(_0x181db8,_0x30e84b,_0x3806f6){var _0x859c0c={};var _0xf5929d={};var _0x4fbdfa;var _0x3e4181;return db[_0x3442('0x32')][_0x3442('0x5b')]({'where':{'id':_0x181db8['params']['id']}})['then'](handleEntityNotFound(_0x30e84b,null))['then'](function(_0x22b7aa){if(_0x22b7aa){_0x4fbdfa=_0x22b7aa;_0xf5929d[_0x3442('0x38')]=_['keys'](db[_0x3442('0x5f')][_0x3442('0x33')]);_0xf5929d['query']=_[_0x3442('0x4b')](_0x181db8[_0x3442('0x35')]);_0xf5929d['filters']=_[_0x3442('0x36')](_0xf5929d[_0x3442('0x38')],_0xf5929d[_0x3442('0x35')]);_0x859c0c[_0x3442('0x37')]=_[_0x3442('0x36')](_0xf5929d[_0x3442('0x38')],qs[_0x3442('0x39')](_0x181db8[_0x3442('0x35')][_0x3442('0x39')]));_0x859c0c[_0x3442('0x37')]=_0x859c0c[_0x3442('0x37')]['length']?_0x859c0c[_0x3442('0x37')]:_0xf5929d[_0x3442('0x38')];_0x859c0c[_0x3442('0x3b')]=qs[_0x3442('0x3c')](_0x181db8[_0x3442('0x35')]['sort']);_0x859c0c[_0x3442('0x3d')]=qs[_0x3442('0x3e')](_[_0x3442('0x3f')](_0x181db8['query'],_0xf5929d[_0x3442('0x3e')]));if(_0x181db8[_0x3442('0x35')][_0x3442('0x40')]){_0x859c0c[_0x3442('0x3d')]=_[_0x3442('0x41')](_0x859c0c[_0x3442('0x3d')],{'$or':_[_0x3442('0x31')](_0x859c0c[_0x3442('0x37')],function(_0x27f724){var _0x1116ad={};_0x1116ad[_0x27f724]={'$like':'%'+_0x181db8[_0x3442('0x35')]['filter']+'%'};return _0x1116ad;})});}_0x859c0c=_['merge']({},_0x859c0c,_0x181db8[_0x3442('0x44')]);return _0x4fbdfa[_0x3442('0x90')](_0x859c0c);}})[_0x3442('0x2b')](function(_0x2c14f0){if(_0x2c14f0){_0x3e4181=_0x2c14f0[_0x3442('0x68')];if(!_0x181db8[_0x3442('0x35')][_0x3442('0x5d')](_0x3442('0x3a'))){_0x859c0c[_0x3442('0x25')]=qs[_0x3442('0x25')](_0x181db8[_0x3442('0x35')][_0x3442('0x25')]);_0x859c0c[_0x3442('0x24')]=qs[_0x3442('0x24')](_0x181db8[_0x3442('0x35')][_0x3442('0x24')]);}return _0x4fbdfa[_0x3442('0x90')](_0x859c0c);}})[_0x3442('0x2b')](function(_0x1c395d){if(_0x1c395d){return _0x1c395d?{'count':_0x3e4181,'rows':_0x1c395d}:null;}})[_0x3442('0x2b')](respondWithResult(_0x30e84b,null))[_0x3442('0x4d')](handleError(_0x30e84b,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 77d2652..4fd791e 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 _0x5505=['setMaxListeners','save','update','emit','hook','events','../../mysqldb','WhatsappQueue'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x5505,0x105));var _0x5550=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5505[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x5550('0x0'));var WhatsappQueue=require(_0x5550('0x1'))['db'][_0x5550('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5550('0x3')](0x0);var events={'afterCreate':_0x5550('0x4'),'afterUpdate':_0x5550('0x5'),'afterDestroy':'remove'};function emitEvent(_0xc5f6d1){return function(_0x138e97,_0x342e60,_0x25bf07){WhatsappQueueEvents[_0x5550('0x6')](_0xc5f6d1+':'+_0x138e97['id'],_0x138e97);WhatsappQueueEvents['emit'](_0xc5f6d1,_0x138e97);_0x25bf07(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x5550('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x4f66=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb','WhatsappQueue'];(function(_0x2755fb,_0x5970f1){var _0x293f12=function(_0x4c629d){while(--_0x4c629d){_0x2755fb['push'](_0x2755fb['shift']());}};_0x293f12(++_0x5970f1);}(_0x4f66,0x138));var _0x64f6=function(_0x2f2aa9,_0x35c7a2){_0x2f2aa9=_0x2f2aa9-0x0;var _0x510c2a=_0x4f66[_0x2f2aa9];return _0x510c2a;};'use strict';var EventEmitter=require(_0x64f6('0x0'));var WhatsappQueue=require(_0x64f6('0x1'))['db'][_0x64f6('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x64f6('0x3')](0x0);var events={'afterCreate':_0x64f6('0x4'),'afterUpdate':_0x64f6('0x5'),'afterDestroy':_0x64f6('0x6')};function emitEvent(_0x444336){return function(_0x291614,_0x6e6901,_0x4bfe2e){WhatsappQueueEvents['emit'](_0x444336+':'+_0x291614['id'],_0x291614);WhatsappQueueEvents[_0x64f6('0x7')](_0x444336,_0x291614);_0x4bfe2e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x64f6('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 2e11fe2..8f17420 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 _0x3fc6=['./whatsappQueue.attributes','exports','define','WhatsappQueue','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ad704,_0x42496a){var _0x24a6ec=function(_0x374afb){while(--_0x374afb){_0x3ad704['push'](_0x3ad704['shift']());}};_0x24a6ec(++_0x42496a);}(_0x3fc6,0x19c));var _0x63fc=function(_0x2dcf41,_0x3f8c61){_0x2dcf41=_0x2dcf41-0x0;var _0x145403=_0x3fc6[_0x2dcf41];return _0x145403;};'use strict';var _=require('lodash');var util=require(_0x63fc('0x0'));var logger=require('../../config/logger')(_0x63fc('0x1'));var moment=require(_0x63fc('0x2'));var BPromise=require(_0x63fc('0x3'));var rp=require(_0x63fc('0x4'));var fs=require('fs');var path=require(_0x63fc('0x5'));var rimraf=require(_0x63fc('0x6'));var config=require(_0x63fc('0x7'));var attributes=require(_0x63fc('0x8'));module[_0x63fc('0x9')]=function(_0x9de09b,_0x39c583){return _0x9de09b[_0x63fc('0xa')](_0x63fc('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc706=['request-promise','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4f6afc,_0x4dfa88){var _0x256eeb=function(_0x216559){while(--_0x216559){_0x4f6afc['push'](_0x4f6afc['shift']());}};_0x256eeb(++_0x4dfa88);}(_0xc706,0x186));var _0x6c70=function(_0x546b26,_0x46e7e1){_0x546b26=_0x546b26-0x0;var _0x3c96ec=_0xc706[_0x546b26];return _0x3c96ec;};'use strict';var _=require(_0x6c70('0x0'));var util=require(_0x6c70('0x1'));var logger=require(_0x6c70('0x2'))(_0x6c70('0x3'));var moment=require(_0x6c70('0x4'));var BPromise=require(_0x6c70('0x5'));var rp=require(_0x6c70('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6c70('0x7'));var attributes=require(_0x6c70('0x8'));module[_0x6c70('0x9')]=function(_0x573346,_0xbc1f49){return _0x573346['define'](_0x6c70('0xa'),attributes,{'tableName':_0x6c70('0xb'),'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 331eee0..d1d3380 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 _0x7296=['register','request','then','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','options','raw','where','attributes','limit','include','map','model','info','catch','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x481be1,_0x2570c3){var _0x51d518=function(_0x4a82af){while(--_0x4a82af){_0x481be1['push'](_0x481be1['shift']());}};_0x51d518(++_0x2570c3);}(_0x7296,0x147));var _0x6729=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x7296[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x6729('0x0'));var util=require(_0x6729('0x1'));var moment=require(_0x6729('0x2'));var BPromise=require(_0x6729('0x3'));var rs=require(_0x6729('0x4'));var fs=require('fs');var Redis=require(_0x6729('0x5'));var db=require(_0x6729('0x6'))['db'];var utils=require(_0x6729('0x7'));var logger=require(_0x6729('0x8'))(_0x6729('0x9'));var config=require(_0x6729('0xa'));var jayson=require(_0x6729('0xb'));var client=jayson[_0x6729('0xc')]['http']({'port':0x232a});config['redis']=_[_0x6729('0xd')](config[_0x6729('0xe')],{'host':_0x6729('0xf'),'port':0x18eb});var socket=require(_0x6729('0x10'))(new Redis(config[_0x6729('0xe')]));require('./whatsappQueue.socket')[_0x6729('0x11')](socket);function respondWithRpcPromise(_0x56d28e,_0x4e3a3c,_0x47a51a){return new BPromise(function(_0x1b919b,_0x35be6e){return client[_0x6729('0x12')](_0x56d28e,_0x47a51a)[_0x6729('0x13')](function(_0x11e50f){logger['info'](_0x6729('0x14'),_0x4e3a3c,'request\x20sent');logger[_0x6729('0x15')](_0x6729('0x16'),_0x4e3a3c,_0x6729('0x17'),JSON[_0x6729('0x18')](_0x11e50f));if(_0x11e50f[_0x6729('0x19')]){if(_0x11e50f[_0x6729('0x19')][_0x6729('0x1a')]===0x1f4){logger[_0x6729('0x19')](_0x6729('0x14'),_0x4e3a3c,_0x11e50f['error'][_0x6729('0x1b')]);return _0x35be6e(_0x11e50f['error'][_0x6729('0x1b')]);}logger['error'](_0x6729('0x14'),_0x4e3a3c,_0x11e50f['error'][_0x6729('0x1b')]);return _0x1b919b(_0x11e50f[_0x6729('0x19')][_0x6729('0x1b')]);}else{logger['info'](_0x6729('0x14'),_0x4e3a3c,_0x6729('0x17'));_0x1b919b(_0x11e50f[_0x6729('0x1c')]['message']);}})['catch'](function(_0x35e715){logger[_0x6729('0x19')](_0x6729('0x14'),_0x4e3a3c,_0x35e715);_0x35be6e(_0x35e715);});});}exports[_0x6729('0x1d')]=function(_0x54cd2e){var _0x173b77=this;return new Promise(function(_0xc6d276,_0x29c151){return db[_0x6729('0x1e')]['findAll']({'raw':_0x54cd2e[_0x6729('0x1f')]?_0x54cd2e['options'][_0x6729('0x20')]===undefined?!![]:![]:!![],'where':_0x54cd2e[_0x6729('0x1f')]?_0x54cd2e[_0x6729('0x1f')][_0x6729('0x21')]||null:null,'attributes':_0x54cd2e['options']?_0x54cd2e['options'][_0x6729('0x22')]||null:null,'limit':_0x54cd2e['options']?_0x54cd2e[_0x6729('0x1f')][_0x6729('0x23')]||null:null,'include':_0x54cd2e['options']?_0x54cd2e[_0x6729('0x1f')][_0x6729('0x24')]?_[_0x6729('0x25')](_0x54cd2e[_0x6729('0x1f')]['include'],function(_0x4203ac){return{'model':db[_0x4203ac['model']],'as':_0x4203ac['as'],'attributes':_0x4203ac[_0x6729('0x22')],'include':_0x4203ac[_0x6729('0x24')]?_[_0x6729('0x25')](_0x4203ac['include'],function(_0x1c261c){return{'model':db[_0x1c261c[_0x6729('0x26')]],'as':_0x1c261c['as'],'attributes':_0x1c261c['attributes'],'include':_0x1c261c[_0x6729('0x24')]?_[_0x6729('0x25')](_0x1c261c[_0x6729('0x24')],function(_0x5507e9){return{'model':db[_0x5507e9['model']],'as':_0x5507e9['as'],'attributes':_0x5507e9[_0x6729('0x22')]};}):[]};}):[]};}):[]:[]})[_0x6729('0x13')](function(_0x1e1fd2){logger[_0x6729('0x27')](_0x6729('0x1d'),_0x54cd2e);logger[_0x6729('0x15')](_0x6729('0x1d'),_0x54cd2e,JSON['stringify'](_0x1e1fd2));_0xc6d276(_0x1e1fd2);})[_0x6729('0x28')](function(_0x2cc887){logger[_0x6729('0x19')](_0x6729('0x1d'),_0x2cc887[_0x6729('0x1b')],_0x54cd2e);_0x29c151(_0x173b77[_0x6729('0x19')](0x1f4,_0x2cc887[_0x6729('0x1b')]));});});};exports[_0x6729('0x29')]=function(_0x476e88){var _0x1c0ddd=this;return new Promise(function(_0x11f9e4,_0x1e911d){return db['WhatsappQueue'][_0x6729('0x2a')]({'raw':_0x476e88[_0x6729('0x1f')]?_0x476e88[_0x6729('0x1f')][_0x6729('0x20')]===undefined?!![]:![]:!![],'where':_0x476e88[_0x6729('0x1f')]?_0x476e88[_0x6729('0x1f')][_0x6729('0x21')]||null:null,'attributes':_0x476e88[_0x6729('0x1f')]?_0x476e88[_0x6729('0x1f')][_0x6729('0x22')]||null:null,'include':_0x476e88[_0x6729('0x1f')]?_0x476e88[_0x6729('0x1f')][_0x6729('0x24')]?_[_0x6729('0x25')](_0x476e88[_0x6729('0x1f')][_0x6729('0x24')],function(_0x4cb70a){return{'model':db[_0x4cb70a[_0x6729('0x26')]],'as':_0x4cb70a['as'],'attributes':_0x4cb70a[_0x6729('0x22')],'include':_0x4cb70a[_0x6729('0x24')]?_[_0x6729('0x25')](_0x4cb70a[_0x6729('0x24')],function(_0x16d820){return{'model':db[_0x16d820['model']],'as':_0x16d820['as'],'attributes':_0x16d820[_0x6729('0x22')],'include':_0x16d820[_0x6729('0x24')]?_[_0x6729('0x25')](_0x16d820[_0x6729('0x24')],function(_0x3648b8){return{'model':db[_0x3648b8[_0x6729('0x26')]],'as':_0x3648b8['as'],'attributes':_0x3648b8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x37d7b2){logger[_0x6729('0x27')](_0x6729('0x29'),_0x476e88);logger[_0x6729('0x15')]('ShowWhatsappQueue',_0x476e88,JSON[_0x6729('0x18')](_0x37d7b2));_0x11f9e4(_0x37d7b2);})[_0x6729('0x28')](function(_0x4264f7){logger['error'](_0x6729('0x29'),_0x4264f7[_0x6729('0x1b')],_0x476e88);_0x1e911d(_0x1c0ddd[_0x6729('0x19')](0x1f4,_0x4264f7[_0x6729('0x1b')]));});});}; \ No newline at end of file +var _0xf6d0=['./whatsappQueue.socket','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','WhatsappQueue','find','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x415332,_0x1663c8){var _0x39c980=function(_0x513eba){while(--_0x513eba){_0x415332['push'](_0x415332['shift']());}};_0x39c980(++_0x1663c8);}(_0xf6d0,0xbe));var _0x0f6d=function(_0x43d596,_0x3b673f){_0x43d596=_0x43d596-0x0;var _0x157017=_0xf6d0[_0x43d596];return _0x157017;};'use strict';var _=require(_0x0f6d('0x0'));var util=require(_0x0f6d('0x1'));var moment=require(_0x0f6d('0x2'));var BPromise=require(_0x0f6d('0x3'));var rs=require(_0x0f6d('0x4'));var fs=require('fs');var Redis=require(_0x0f6d('0x5'));var db=require(_0x0f6d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f6d('0x7'))('rpc');var config=require(_0x0f6d('0x8'));var jayson=require(_0x0f6d('0x9'));var client=jayson['client'][_0x0f6d('0xa')]({'port':0x232a});config[_0x0f6d('0xb')]=_[_0x0f6d('0xc')](config[_0x0f6d('0xb')],{'host':_0x0f6d('0xd'),'port':0x18eb});var socket=require(_0x0f6d('0xe'))(new Redis(config[_0x0f6d('0xb')]));require(_0x0f6d('0xf'))['register'](socket);function respondWithRpcPromise(_0x27fa46,_0x522999,_0xc29d3d){return new BPromise(function(_0x3f9a41,_0x3606b2){return client['request'](_0x27fa46,_0xc29d3d)[_0x0f6d('0x10')](function(_0x204765){logger[_0x0f6d('0x11')](_0x0f6d('0x12'),_0x522999,_0x0f6d('0x13'));logger[_0x0f6d('0x14')](_0x0f6d('0x15'),_0x522999,'request\x20sent',JSON[_0x0f6d('0x16')](_0x204765));if(_0x204765['error']){if(_0x204765[_0x0f6d('0x17')][_0x0f6d('0x18')]===0x1f4){logger[_0x0f6d('0x17')](_0x0f6d('0x12'),_0x522999,_0x204765[_0x0f6d('0x17')]['message']);return _0x3606b2(_0x204765[_0x0f6d('0x17')]['message']);}logger['error'](_0x0f6d('0x12'),_0x522999,_0x204765[_0x0f6d('0x17')][_0x0f6d('0x19')]);return _0x3f9a41(_0x204765[_0x0f6d('0x17')][_0x0f6d('0x19')]);}else{logger[_0x0f6d('0x11')](_0x0f6d('0x12'),_0x522999,_0x0f6d('0x13'));_0x3f9a41(_0x204765[_0x0f6d('0x1a')][_0x0f6d('0x19')]);}})[_0x0f6d('0x1b')](function(_0x25cf86){logger[_0x0f6d('0x17')](_0x0f6d('0x12'),_0x522999,_0x25cf86);_0x3606b2(_0x25cf86);});});}exports[_0x0f6d('0x1c')]=function(_0x7eb860){var _0x2e722f=this;return new Promise(function(_0x3a6703,_0x41cb44){return db['WhatsappQueue'][_0x0f6d('0x1d')]({'raw':_0x7eb860[_0x0f6d('0x1e')]?_0x7eb860[_0x0f6d('0x1e')][_0x0f6d('0x1f')]===undefined?!![]:![]:!![],'where':_0x7eb860[_0x0f6d('0x1e')]?_0x7eb860[_0x0f6d('0x1e')][_0x0f6d('0x20')]||null:null,'attributes':_0x7eb860['options']?_0x7eb860['options'][_0x0f6d('0x21')]||null:null,'limit':_0x7eb860[_0x0f6d('0x1e')]?_0x7eb860[_0x0f6d('0x1e')][_0x0f6d('0x22')]||null:null,'include':_0x7eb860[_0x0f6d('0x1e')]?_0x7eb860[_0x0f6d('0x1e')][_0x0f6d('0x23')]?_[_0x0f6d('0x24')](_0x7eb860[_0x0f6d('0x1e')]['include'],function(_0x25b899){return{'model':db[_0x25b899['model']],'as':_0x25b899['as'],'attributes':_0x25b899[_0x0f6d('0x21')],'include':_0x25b899[_0x0f6d('0x23')]?_[_0x0f6d('0x24')](_0x25b899[_0x0f6d('0x23')],function(_0x457ff1){return{'model':db[_0x457ff1[_0x0f6d('0x25')]],'as':_0x457ff1['as'],'attributes':_0x457ff1['attributes'],'include':_0x457ff1[_0x0f6d('0x23')]?_[_0x0f6d('0x24')](_0x457ff1[_0x0f6d('0x23')],function(_0x223b47){return{'model':db[_0x223b47[_0x0f6d('0x25')]],'as':_0x223b47['as'],'attributes':_0x223b47['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b4ca3){logger['info']('GetWhatsappQueue',_0x7eb860);logger['debug'](_0x0f6d('0x1c'),_0x7eb860,JSON[_0x0f6d('0x16')](_0x2b4ca3));_0x3a6703(_0x2b4ca3);})['catch'](function(_0x4f65d1){logger[_0x0f6d('0x17')](_0x0f6d('0x1c'),_0x4f65d1[_0x0f6d('0x19')],_0x7eb860);_0x41cb44(_0x2e722f[_0x0f6d('0x17')](0x1f4,_0x4f65d1['message']));});});};exports['ShowWhatsappQueue']=function(_0x490db2){var _0x28adf1=this;return new Promise(function(_0x65a45f,_0x5a80da){return db[_0x0f6d('0x26')][_0x0f6d('0x27')]({'raw':_0x490db2[_0x0f6d('0x1e')]?_0x490db2[_0x0f6d('0x1e')][_0x0f6d('0x1f')]===undefined?!![]:![]:!![],'where':_0x490db2[_0x0f6d('0x1e')]?_0x490db2[_0x0f6d('0x1e')][_0x0f6d('0x20')]||null:null,'attributes':_0x490db2[_0x0f6d('0x1e')]?_0x490db2[_0x0f6d('0x1e')][_0x0f6d('0x21')]||null:null,'include':_0x490db2['options']?_0x490db2[_0x0f6d('0x1e')][_0x0f6d('0x23')]?_['map'](_0x490db2[_0x0f6d('0x1e')][_0x0f6d('0x23')],function(_0x9e8089){return{'model':db[_0x9e8089[_0x0f6d('0x25')]],'as':_0x9e8089['as'],'attributes':_0x9e8089[_0x0f6d('0x21')],'include':_0x9e8089['include']?_[_0x0f6d('0x24')](_0x9e8089['include'],function(_0xbb28e8){return{'model':db[_0xbb28e8[_0x0f6d('0x25')]],'as':_0xbb28e8['as'],'attributes':_0xbb28e8[_0x0f6d('0x21')],'include':_0xbb28e8[_0x0f6d('0x23')]?_['map'](_0xbb28e8['include'],function(_0x1b8bce){return{'model':db[_0x1b8bce['model']],'as':_0x1b8bce['as'],'attributes':_0x1b8bce[_0x0f6d('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20a493){logger['info'](_0x0f6d('0x28'),_0x490db2);logger['debug'](_0x0f6d('0x28'),_0x490db2,JSON['stringify'](_0x20a493));_0x65a45f(_0x20a493);})[_0x0f6d('0x1b')](function(_0x3265c0){logger[_0x0f6d('0x17')](_0x0f6d('0x28'),_0x3265c0['message'],_0x490db2);_0x5a80da(_0x28adf1[_0x0f6d('0x17')](0x1f4,_0x3265c0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 7af8ada..62b84d3 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 _0x239c=['removeListener','register','whatsappQueue:','./whatsappQueue.events','save','remove','update','emit'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x239c,0x7b));var _0xc239=function(_0x2d1bc2,_0x1c1263){_0x2d1bc2=_0x2d1bc2-0x0;var _0x509693=_0x239c[_0x2d1bc2];return _0x509693;};'use strict';var WhatsappQueueEvents=require(_0xc239('0x0'));var events=[_0xc239('0x1'),_0xc239('0x2'),_0xc239('0x3')];function createListener(_0x94d644,_0x13f6fd){return function(_0x19b000){_0x13f6fd[_0xc239('0x4')](_0x94d644,_0x19b000);};}function removeListener(_0x58e01f,_0x5b098a){return function(){WhatsappQueueEvents[_0xc239('0x5')](_0x58e01f,_0x5b098a);};}exports[_0xc239('0x6')]=function(_0x989fc2){for(var _0x377452=0x0,_0x52c41f=events['length'];_0x377452<_0x52c41f;_0x377452++){var _0x53f8c4=events[_0x377452];var _0x58c5b7=createListener(_0xc239('0x7')+_0x53f8c4,_0x989fc2);WhatsappQueueEvents['on'](_0x53f8c4,_0x58c5b7);}}; \ No newline at end of file +var _0x599f=['update','emit','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x5ec634,_0xa835b9){var _0x5b94a9=function(_0x3a720e){while(--_0x3a720e){_0x5ec634['push'](_0x5ec634['shift']());}};_0x5b94a9(++_0xa835b9);}(_0x599f,0x74));var _0xf599=function(_0x2d38f2,_0x545682){_0x2d38f2=_0x2d38f2-0x0;var _0x25377c=_0x599f[_0x2d38f2];return _0x25377c;};'use strict';var WhatsappQueueEvents=require(_0xf599('0x0'));var events=[_0xf599('0x1'),_0xf599('0x2'),_0xf599('0x3')];function createListener(_0x15dc57,_0x4008b6){return function(_0x1e74e6){_0x4008b6[_0xf599('0x4')](_0x15dc57,_0x1e74e6);};}function removeListener(_0x43964c,_0x13316a){return function(){WhatsappQueueEvents['removeListener'](_0x43964c,_0x13316a);};}exports['register']=function(_0x47ffea){for(var _0x3afe75=0x0,_0x4b8cb1=events[_0xf599('0x5')];_0x3afe75<_0x4b8cb1;_0x3afe75++){var _0x45f97e=events[_0x3afe75];var _0x3c49e9=createListener(_0xf599('0x6')+_0x45f97e,_0x47ffea);WhatsappQueueEvents['on'](_0x45f97e,_0x3c49e9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 092a33f..439046a 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 _0x289e=['show','post','put','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x552993,_0x473186){var _0x58bf13=function(_0x19ae81){while(--_0x19ae81){_0x552993['push'](_0x552993['shift']());}};_0x58bf13(++_0x473186);}(_0x289e,0xea));var _0xe289=function(_0x31e97b,_0x5c503a){_0x31e97b=_0x31e97b-0x0;var _0x488a2c=_0x289e[_0x31e97b];return _0x488a2c;};'use strict';var multer=require(_0xe289('0x0'));var util=require(_0xe289('0x1'));var path=require('path');var timeout=require(_0xe289('0x2'));var express=require(_0xe289('0x3'));var router=express['Router']();var auth=require(_0xe289('0x4'));var interaction=require(_0xe289('0x5'));var config=require('../../config/environment');var controller=require(_0xe289('0x6'));router[_0xe289('0x7')]('/',auth[_0xe289('0x8')](),controller[_0xe289('0x9')]);router[_0xe289('0x7')](_0xe289('0xa'),auth[_0xe289('0x8')](),controller[_0xe289('0xb')]);router[_0xe289('0x7')](_0xe289('0xc'),auth['isAuthenticated'](),controller[_0xe289('0xd')]);router[_0xe289('0xe')]('/',auth[_0xe289('0x8')](),controller['create']);router[_0xe289('0xf')]('/:id',auth[_0xe289('0x8')](),controller[_0xe289('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe289('0x11')]);module[_0xe289('0x12')]=router; \ No newline at end of file +var _0x61f1=['express','Router','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout'];(function(_0x17c848,_0x42c722){var _0x1291c1=function(_0xb81806){while(--_0xb81806){_0x17c848['push'](_0x17c848['shift']());}};_0x1291c1(++_0x42c722);}(_0x61f1,0x18a));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x161f('0x0'));var path=require('path');var timeout=require(_0x161f('0x1'));var express=require(_0x161f('0x2'));var router=express[_0x161f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x161f('0x4'));var controller=require(_0x161f('0x5'));router['get']('/',auth[_0x161f('0x6')](),controller[_0x161f('0x7')]);router[_0x161f('0x8')](_0x161f('0x9'),auth[_0x161f('0x6')](),controller['describe']);router[_0x161f('0x8')](_0x161f('0xa'),auth[_0x161f('0x6')](),controller[_0x161f('0xb')]);router[_0x161f('0xc')]('/',auth[_0x161f('0x6')](),controller[_0x161f('0xd')]);router[_0x161f('0xe')](_0x161f('0xa'),auth[_0x161f('0x6')](),controller[_0x161f('0xf')]);router['delete'](_0x161f('0xa'),auth[_0x161f('0x6')](),controller[_0x161f('0x10')]);module[_0x161f('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index e6e9aa1..b39be33 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 _0x7fbe=['STRING','DATE'];(function(_0x4c40c8,_0x446c32){var _0x47231a=function(_0x281b70){while(--_0x281b70){_0x4c40c8['push'](_0x4c40c8['shift']());}};_0x47231a(++_0x446c32);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x34ea1e,_0x152007){_0x34ea1e=_0x34ea1e-0x0;var _0xcb6be2=_0x7fbe[_0x34ea1e];return _0xcb6be2;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xe7fb('0x0')]},'joinAt':{'type':Sequelize[_0xe7fb('0x1')]},'leaveAt':{'type':Sequelize[_0xe7fb('0x1')]},'acceptAt':{'type':Sequelize[_0xe7fb('0x1')]},'exitAt':{'type':Sequelize[_0xe7fb('0x1')]},'reason':{'type':Sequelize[_0xe7fb('0x0')]}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x3e74,0x175));var _0x43e7=function(_0x3377a6,_0x27e711){_0x3377a6=_0x3377a6-0x0;var _0x1a2cfa=_0x3e74[_0x3377a6];return _0x1a2cfa;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x43e7('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x43e7('0x1')]},'joinAt':{'type':Sequelize[_0x43e7('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x43e7('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 263f417..a3c240d 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 _0xe1d6=['limit','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe1d6,0x78));var _0x6e1d=function(_0x25db76,_0x42b5d3){_0x25db76=_0x25db76-0x0;var _0x42b540=_0xe1d6[_0x25db76];return _0x42b540;};'use strict';var pdf=require(_0x6e1d('0x0'));var emlformat=require(_0x6e1d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6e1d('0x2'));var jsonpatch=require(_0x6e1d('0x3'));var rp=require(_0x6e1d('0x4'));var moment=require(_0x6e1d('0x5'));var BPromise=require(_0x6e1d('0x6'));var Mustache=require(_0x6e1d('0x7'));var util=require('util');var path=require(_0x6e1d('0x8'));var sox=require(_0x6e1d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6e1d('0xa'));var squel=require(_0x6e1d('0xb'));var crypto=require('crypto');var jsforce=require(_0x6e1d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6e1d('0xd'));var querystring=require(_0x6e1d('0xe'));var Papa=require(_0x6e1d('0xf'));var Redis=require(_0x6e1d('0x10'));var authService=require(_0x6e1d('0x11'));var qs=require(_0x6e1d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e1d('0x13'));var logger=require('../../config/logger')(_0x6e1d('0x14'));var utils=require(_0x6e1d('0x15'));var config=require(_0x6e1d('0x16'));var licenseUtil=require(_0x6e1d('0x17'));var db=require(_0x6e1d('0x18'))['db'];function respondWithStatusCode(_0x3dac6c,_0x28f4ba){_0x28f4ba=_0x28f4ba||0xcc;return function(_0x14fce3){if(_0x14fce3){return _0x3dac6c['sendStatus'](_0x28f4ba);}return _0x3dac6c[_0x6e1d('0x19')](_0x28f4ba)[_0x6e1d('0x1a')]();};}function respondWithResult(_0x5ba66b,_0x29143b){_0x29143b=_0x29143b||0xc8;return function(_0x379c4c){if(_0x379c4c){return _0x5ba66b[_0x6e1d('0x19')](_0x29143b)['json'](_0x379c4c);}};}function respondWithFilteredResult(_0x1b6964,_0x3d4f4f){return function(_0x515fde){if(_0x515fde){var _0xe8edbf=_0x515fde['count'],_0x5774b7=_0x3d4f4f[_0x6e1d('0x1b')],_0x13a6ac=_0x3d4f4f[_0x6e1d('0x1b')]+_0x3d4f4f[_0x6e1d('0x1c')],_0xfdead3;if(_0x13a6ac>=_0xe8edbf){_0x13a6ac=_0xe8edbf;_0xfdead3=0xc8;}else{_0xfdead3=0xce;}_0x1b6964[_0x6e1d('0x19')](_0xfdead3);return _0x1b6964['set']('Content-Range',_0x5774b7+'-'+_0x13a6ac+'/'+_0xe8edbf)[_0x6e1d('0x1d')](_0x515fde);}return null;};}function patchUpdates(_0x5eba6c){return function(_0x54002c){try{jsonpatch[_0x6e1d('0x1e')](_0x54002c,_0x5eba6c,!![]);}catch(_0xbe08f3){return BPromise[_0x6e1d('0x1f')](_0xbe08f3);}return _0x54002c[_0x6e1d('0x20')]();};}function saveUpdates(_0x1cf42,_0x38509c){return function(_0x5bcd2a){if(_0x5bcd2a){return _0x5bcd2a[_0x6e1d('0x21')](_0x1cf42)[_0x6e1d('0x22')](function(_0x463fdd){return _0x463fdd;});}return null;};}function removeEntity(_0x1cf83c,_0x4392e0){return function(_0x5dfec7){if(_0x5dfec7){return _0x5dfec7[_0x6e1d('0x23')]()[_0x6e1d('0x22')](function(){_0x1cf83c[_0x6e1d('0x19')](0xcc)[_0x6e1d('0x1a')]();});}};}function handleEntityNotFound(_0x485a17,_0x3c5063){return function(_0xdc5315){if(!_0xdc5315){_0x485a17[_0x6e1d('0x24')](0x194);}return _0xdc5315;};}function handleError(_0x48b375,_0x3bb4f1){_0x3bb4f1=_0x3bb4f1||0x1f4;return function(_0x4a901b){logger['error'](_0x4a901b[_0x6e1d('0x25')]);if(_0x4a901b[_0x6e1d('0x26')]){delete _0x4a901b['name'];}_0x48b375[_0x6e1d('0x19')](_0x3bb4f1)[_0x6e1d('0x27')](_0x4a901b);};}exports[_0x6e1d('0x28')]=function(_0x465a51,_0x56726e){var _0x2d8bca={},_0x331aa8={},_0x4e0e53={'count':0x0,'rows':[]};var _0x25511d=_[_0x6e1d('0x29')](db[_0x6e1d('0x2a')][_0x6e1d('0x2b')],function(_0x3f79f6){return{'name':_0x3f79f6[_0x6e1d('0x2c')],'type':_0x3f79f6['type']['key']};});_0x331aa8[_0x6e1d('0x2d')]=_[_0x6e1d('0x29')](_0x25511d,'name');_0x331aa8[_0x6e1d('0x2e')]=_[_0x6e1d('0x2f')](_0x465a51['query']);_0x331aa8[_0x6e1d('0x30')]=_[_0x6e1d('0x31')](_0x331aa8[_0x6e1d('0x2d')],_0x331aa8[_0x6e1d('0x2e')]);_0x2d8bca[_0x6e1d('0x32')]=_[_0x6e1d('0x31')](_0x331aa8[_0x6e1d('0x2d')],qs[_0x6e1d('0x33')](_0x465a51[_0x6e1d('0x2e')][_0x6e1d('0x33')]));_0x2d8bca[_0x6e1d('0x32')]=_0x2d8bca[_0x6e1d('0x32')][_0x6e1d('0x34')]?_0x2d8bca[_0x6e1d('0x32')]:_0x331aa8[_0x6e1d('0x2d')];if(!_0x465a51['query'][_0x6e1d('0x35')]('nolimit')){_0x2d8bca['limit']=qs[_0x6e1d('0x1c')](_0x465a51[_0x6e1d('0x2e')][_0x6e1d('0x1c')]);_0x2d8bca[_0x6e1d('0x1b')]=qs[_0x6e1d('0x1b')](_0x465a51[_0x6e1d('0x2e')]['offset']);}_0x2d8bca[_0x6e1d('0x36')]=qs[_0x6e1d('0x37')](_0x465a51[_0x6e1d('0x2e')][_0x6e1d('0x37')]);_0x2d8bca[_0x6e1d('0x38')]=qs[_0x6e1d('0x30')](_[_0x6e1d('0x39')](_0x465a51['query'],_0x331aa8[_0x6e1d('0x30')]),_0x25511d);if(_0x465a51[_0x6e1d('0x2e')][_0x6e1d('0x3a')]){_0x2d8bca['where']=_[_0x6e1d('0x3b')](_0x2d8bca[_0x6e1d('0x38')],{'$or':_[_0x6e1d('0x29')](_0x25511d,function(_0x2ad0ec){if(_0x2ad0ec[_0x6e1d('0x3c')]!=='VIRTUAL'){var _0x431880={};_0x431880[_0x2ad0ec['name']]={'$like':'%'+_0x465a51[_0x6e1d('0x2e')][_0x6e1d('0x3a')]+'%'};return _0x431880;}})});}_0x2d8bca=_[_0x6e1d('0x3b')]({},_0x2d8bca,_0x465a51[_0x6e1d('0x3d')]);var _0x35f911={'where':_0x2d8bca['where']};return db[_0x6e1d('0x2a')]['count'](_0x35f911)[_0x6e1d('0x22')](function(_0x200501){_0x4e0e53[_0x6e1d('0x3e')]=_0x200501;if(_0x465a51[_0x6e1d('0x2e')][_0x6e1d('0x3f')]){_0x2d8bca[_0x6e1d('0x40')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x6e1d('0x41')](_0x2d8bca);})['then'](function(_0x2debba){_0x4e0e53[_0x6e1d('0x42')]=_0x2debba;return _0x4e0e53;})[_0x6e1d('0x22')](respondWithFilteredResult(_0x56726e,_0x2d8bca))['catch'](handleError(_0x56726e,null));};exports[_0x6e1d('0x43')]=function(_0x26c0ba,_0x28d1b3){var _0x1e7b09={'raw':!![],'where':{'id':_0x26c0ba['params']['id']}},_0x603f71={};_0x603f71[_0x6e1d('0x2d')]=_[_0x6e1d('0x2f')](db[_0x6e1d('0x2a')][_0x6e1d('0x2b')]);_0x603f71[_0x6e1d('0x2e')]=_[_0x6e1d('0x2f')](_0x26c0ba[_0x6e1d('0x2e')]);_0x603f71['filters']=_[_0x6e1d('0x31')](_0x603f71[_0x6e1d('0x2d')],_0x603f71[_0x6e1d('0x2e')]);_0x1e7b09[_0x6e1d('0x32')]=_[_0x6e1d('0x31')](_0x603f71[_0x6e1d('0x2d')],qs[_0x6e1d('0x33')](_0x26c0ba[_0x6e1d('0x2e')]['fields']));_0x1e7b09['attributes']=_0x1e7b09[_0x6e1d('0x32')][_0x6e1d('0x34')]?_0x1e7b09[_0x6e1d('0x32')]:_0x603f71['model'];if(_0x26c0ba['query'][_0x6e1d('0x3f')]){_0x1e7b09[_0x6e1d('0x40')]=[{'all':!![]}];}_0x1e7b09=_['merge']({},_0x1e7b09,_0x26c0ba['options']);return db[_0x6e1d('0x2a')][_0x6e1d('0x44')](_0x1e7b09)['then'](handleEntityNotFound(_0x28d1b3,null))[_0x6e1d('0x22')](respondWithResult(_0x28d1b3,null))[_0x6e1d('0x45')](handleError(_0x28d1b3,null));};exports[_0x6e1d('0x46')]=function(_0x48711d,_0x3229a7){return db[_0x6e1d('0x2a')][_0x6e1d('0x46')](_0x48711d[_0x6e1d('0x47')],{})[_0x6e1d('0x22')](respondWithResult(_0x3229a7,0xc9))[_0x6e1d('0x45')](handleError(_0x3229a7,null));};exports['update']=function(_0x30987e,_0x75dfdd){if(_0x30987e[_0x6e1d('0x47')]['id']){delete _0x30987e[_0x6e1d('0x47')]['id'];}return db['WhatsappQueueReport'][_0x6e1d('0x44')]({'where':{'id':_0x30987e[_0x6e1d('0x48')]['id']}})['then'](handleEntityNotFound(_0x75dfdd,null))['then'](saveUpdates(_0x30987e[_0x6e1d('0x47')],null))['then'](respondWithResult(_0x75dfdd,null))[_0x6e1d('0x45')](handleError(_0x75dfdd,null));};exports[_0x6e1d('0x23')]=function(_0x433747,_0x4190b7){return db[_0x6e1d('0x2a')][_0x6e1d('0x44')]({'where':{'id':_0x433747[_0x6e1d('0x48')]['id']}})[_0x6e1d('0x22')](handleEntityNotFound(_0x4190b7,null))[_0x6e1d('0x22')](removeEntity(_0x4190b7,null))[_0x6e1d('0x45')](handleError(_0x4190b7,null));};exports[_0x6e1d('0x49')]=function(_0x480218,_0x5f3e50){return db[_0x6e1d('0x2a')][_0x6e1d('0x49')]()['then'](respondWithResult(_0x5f3e50,null))[_0x6e1d('0x45')](handleError(_0x5f3e50,null));}; \ No newline at end of file +var _0xfb76=['key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type'];(function(_0xdcc8b6,_0x3f808e){var _0x5c4852=function(_0x3940e4){while(--_0x3940e4){_0xdcc8b6['push'](_0xdcc8b6['shift']());}};_0x5c4852(++_0x3f808e);}(_0xfb76,0xb5));var _0x6fb7=function(_0x2327d2,_0x49af73){_0x2327d2=_0x2327d2-0x0;var _0x20cef6=_0xfb76[_0x2327d2];return _0x20cef6;};'use strict';var pdf=require(_0x6fb7('0x0'));var emlformat=require(_0x6fb7('0x1'));var rimraf=require(_0x6fb7('0x2'));var zipdir=require(_0x6fb7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fb7('0x4'));var moment=require(_0x6fb7('0x5'));var BPromise=require(_0x6fb7('0x6'));var Mustache=require(_0x6fb7('0x7'));var util=require('util');var path=require(_0x6fb7('0x8'));var sox=require(_0x6fb7('0x9'));var csv=require('to-csv');var ejs=require(_0x6fb7('0xa'));var fs=require('fs');var _=require(_0x6fb7('0xb'));var squel=require(_0x6fb7('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6fb7('0xd'));var toCsv=require(_0x6fb7('0xe'));var querystring=require(_0x6fb7('0xf'));var Papa=require(_0x6fb7('0x10'));var Redis=require(_0x6fb7('0x11'));var authService=require(_0x6fb7('0x12'));var qs=require(_0x6fb7('0x13'));var as=require(_0x6fb7('0x14'));var hardwareService=require(_0x6fb7('0x15'));var logger=require(_0x6fb7('0x16'))(_0x6fb7('0x17'));var utils=require(_0x6fb7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6fb7('0x19'));var db=require(_0x6fb7('0x1a'))['db'];function respondWithStatusCode(_0xe733e8,_0x1fa6ae){_0x1fa6ae=_0x1fa6ae||0xcc;return function(_0x13966f){if(_0x13966f){return _0xe733e8[_0x6fb7('0x1b')](_0x1fa6ae);}return _0xe733e8[_0x6fb7('0x1c')](_0x1fa6ae)[_0x6fb7('0x1d')]();};}function respondWithResult(_0x497f6e,_0x4fa139){_0x4fa139=_0x4fa139||0xc8;return function(_0x56619e){if(_0x56619e){return _0x497f6e[_0x6fb7('0x1c')](_0x4fa139)[_0x6fb7('0x1e')](_0x56619e);}};}function respondWithFilteredResult(_0x2d99f4,_0x4da739){return function(_0x29cd50){if(_0x29cd50){var _0x56afe7=_0x29cd50[_0x6fb7('0x1f')],_0x2fe62a=_0x4da739[_0x6fb7('0x20')],_0x35d55a=_0x4da739[_0x6fb7('0x20')]+_0x4da739[_0x6fb7('0x21')],_0x3e3ba2;if(_0x35d55a>=_0x56afe7){_0x35d55a=_0x56afe7;_0x3e3ba2=0xc8;}else{_0x3e3ba2=0xce;}_0x2d99f4[_0x6fb7('0x1c')](_0x3e3ba2);return _0x2d99f4['set'](_0x6fb7('0x22'),_0x2fe62a+'-'+_0x35d55a+'/'+_0x56afe7)['json'](_0x29cd50);}return null;};}function patchUpdates(_0x3b82ad){return function(_0x585d63){try{jsonpatch[_0x6fb7('0x23')](_0x585d63,_0x3b82ad,!![]);}catch(_0x5d8e90){return BPromise[_0x6fb7('0x24')](_0x5d8e90);}return _0x585d63[_0x6fb7('0x25')]();};}function saveUpdates(_0x2a864c,_0x3a03fe){return function(_0x51fdbd){if(_0x51fdbd){return _0x51fdbd[_0x6fb7('0x26')](_0x2a864c)[_0x6fb7('0x27')](function(_0x304865){return _0x304865;});}return null;};}function removeEntity(_0x599376,_0x4bb635){return function(_0x4c804a){if(_0x4c804a){return _0x4c804a[_0x6fb7('0x28')]()[_0x6fb7('0x27')](function(){_0x599376[_0x6fb7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a5a0,_0x197b51){return function(_0x4906e8){if(!_0x4906e8){_0x39a5a0[_0x6fb7('0x1b')](0x194);}return _0x4906e8;};}function handleError(_0x4bb321,_0xcbeaf5){_0xcbeaf5=_0xcbeaf5||0x1f4;return function(_0x2f0b1e){logger[_0x6fb7('0x29')](_0x2f0b1e[_0x6fb7('0x2a')]);if(_0x2f0b1e[_0x6fb7('0x2b')]){delete _0x2f0b1e[_0x6fb7('0x2b')];}_0x4bb321[_0x6fb7('0x1c')](_0xcbeaf5)[_0x6fb7('0x2c')](_0x2f0b1e);};}exports[_0x6fb7('0x2d')]=function(_0x542db7,_0x15ed48){var _0x415396={},_0x5805cf={},_0x4d16fe={'count':0x0,'rows':[]};var _0x30f25a=_[_0x6fb7('0x2e')](db[_0x6fb7('0x2f')]['rawAttributes'],function(_0x265d7d){return{'name':_0x265d7d[_0x6fb7('0x30')],'type':_0x265d7d[_0x6fb7('0x31')][_0x6fb7('0x32')]};});_0x5805cf['model']=_[_0x6fb7('0x2e')](_0x30f25a,_0x6fb7('0x2b'));_0x5805cf[_0x6fb7('0x33')]=_[_0x6fb7('0x34')](_0x542db7[_0x6fb7('0x33')]);_0x5805cf['filters']=_[_0x6fb7('0x35')](_0x5805cf['model'],_0x5805cf[_0x6fb7('0x33')]);_0x415396[_0x6fb7('0x36')]=_[_0x6fb7('0x35')](_0x5805cf[_0x6fb7('0x37')],qs[_0x6fb7('0x38')](_0x542db7[_0x6fb7('0x33')][_0x6fb7('0x38')]));_0x415396['attributes']=_0x415396[_0x6fb7('0x36')][_0x6fb7('0x39')]?_0x415396[_0x6fb7('0x36')]:_0x5805cf[_0x6fb7('0x37')];if(!_0x542db7[_0x6fb7('0x33')][_0x6fb7('0x3a')](_0x6fb7('0x3b'))){_0x415396[_0x6fb7('0x21')]=qs[_0x6fb7('0x21')](_0x542db7[_0x6fb7('0x33')][_0x6fb7('0x21')]);_0x415396[_0x6fb7('0x20')]=qs[_0x6fb7('0x20')](_0x542db7['query'][_0x6fb7('0x20')]);}_0x415396['order']=qs['sort'](_0x542db7[_0x6fb7('0x33')][_0x6fb7('0x3c')]);_0x415396[_0x6fb7('0x3d')]=qs[_0x6fb7('0x3e')](_[_0x6fb7('0x3f')](_0x542db7[_0x6fb7('0x33')],_0x5805cf[_0x6fb7('0x3e')]),_0x30f25a);if(_0x542db7['query'][_0x6fb7('0x40')]){_0x415396[_0x6fb7('0x3d')]=_[_0x6fb7('0x41')](_0x415396[_0x6fb7('0x3d')],{'$or':_[_0x6fb7('0x2e')](_0x30f25a,function(_0x599da8){if(_0x599da8[_0x6fb7('0x31')]!=='VIRTUAL'){var _0x257a54={};_0x257a54[_0x599da8[_0x6fb7('0x2b')]]={'$like':'%'+_0x542db7['query']['filter']+'%'};return _0x257a54;}})});}_0x415396=_['merge']({},_0x415396,_0x542db7[_0x6fb7('0x42')]);var _0x32c4f={'where':_0x415396['where']};return db[_0x6fb7('0x2f')][_0x6fb7('0x1f')](_0x32c4f)[_0x6fb7('0x27')](function(_0x520538){_0x4d16fe['count']=_0x520538;if(_0x542db7[_0x6fb7('0x33')][_0x6fb7('0x43')]){_0x415396[_0x6fb7('0x44')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x415396);})[_0x6fb7('0x27')](function(_0x54703e){_0x4d16fe[_0x6fb7('0x45')]=_0x54703e;return _0x4d16fe;})[_0x6fb7('0x27')](respondWithFilteredResult(_0x15ed48,_0x415396))[_0x6fb7('0x46')](handleError(_0x15ed48,null));};exports[_0x6fb7('0x47')]=function(_0x1de354,_0x23fd3f){var _0x372784={'raw':!![],'where':{'id':_0x1de354['params']['id']}},_0x8d7912={};_0x8d7912[_0x6fb7('0x37')]=_[_0x6fb7('0x34')](db[_0x6fb7('0x2f')]['rawAttributes']);_0x8d7912[_0x6fb7('0x33')]=_['keys'](_0x1de354[_0x6fb7('0x33')]);_0x8d7912[_0x6fb7('0x3e')]=_[_0x6fb7('0x35')](_0x8d7912[_0x6fb7('0x37')],_0x8d7912[_0x6fb7('0x33')]);_0x372784[_0x6fb7('0x36')]=_['intersection'](_0x8d7912[_0x6fb7('0x37')],qs['fields'](_0x1de354['query']['fields']));_0x372784[_0x6fb7('0x36')]=_0x372784['attributes'][_0x6fb7('0x39')]?_0x372784['attributes']:_0x8d7912[_0x6fb7('0x37')];if(_0x1de354[_0x6fb7('0x33')][_0x6fb7('0x43')]){_0x372784[_0x6fb7('0x44')]=[{'all':!![]}];}_0x372784=_[_0x6fb7('0x41')]({},_0x372784,_0x1de354['options']);return db[_0x6fb7('0x2f')][_0x6fb7('0x48')](_0x372784)[_0x6fb7('0x27')](handleEntityNotFound(_0x23fd3f,null))[_0x6fb7('0x27')](respondWithResult(_0x23fd3f,null))[_0x6fb7('0x46')](handleError(_0x23fd3f,null));};exports[_0x6fb7('0x49')]=function(_0x378656,_0x36f710){return db[_0x6fb7('0x2f')][_0x6fb7('0x49')](_0x378656[_0x6fb7('0x4a')],{})[_0x6fb7('0x27')](respondWithResult(_0x36f710,0xc9))[_0x6fb7('0x46')](handleError(_0x36f710,null));};exports[_0x6fb7('0x26')]=function(_0x42df28,_0x51b2ac){if(_0x42df28[_0x6fb7('0x4a')]['id']){delete _0x42df28[_0x6fb7('0x4a')]['id'];}return db[_0x6fb7('0x2f')][_0x6fb7('0x48')]({'where':{'id':_0x42df28[_0x6fb7('0x4b')]['id']}})[_0x6fb7('0x27')](handleEntityNotFound(_0x51b2ac,null))['then'](saveUpdates(_0x42df28[_0x6fb7('0x4a')],null))[_0x6fb7('0x27')](respondWithResult(_0x51b2ac,null))[_0x6fb7('0x46')](handleError(_0x51b2ac,null));};exports[_0x6fb7('0x28')]=function(_0x328768,_0x7e9d74){return db[_0x6fb7('0x2f')][_0x6fb7('0x48')]({'where':{'id':_0x328768[_0x6fb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x7e9d74,null))[_0x6fb7('0x27')](removeEntity(_0x7e9d74,null))[_0x6fb7('0x46')](handleError(_0x7e9d74,null));};exports['describe']=function(_0x275fa3,_0x10fd32){return db[_0x6fb7('0x2f')][_0x6fb7('0x4c')]()[_0x6fb7('0x27')](respondWithResult(_0x10fd32,null))['catch'](handleError(_0x10fd32,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 040d5db..841cd38 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 _0xf011=['moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x288377,_0x5c3b04){var _0x12be42=function(_0x4bc48d){while(--_0x4bc48d){_0x288377['push'](_0x288377['shift']());}};_0x12be42(++_0x5c3b04);}(_0xf011,0x1ae));var _0x1f01=function(_0x485503,_0x3cbfd1){_0x485503=_0x485503-0x0;var _0x2d2085=_0xf011[_0x485503];return _0x2d2085;};'use strict';var _=require(_0x1f01('0x0'));var util=require(_0x1f01('0x1'));var logger=require(_0x1f01('0x2'))(_0x1f01('0x3'));var moment=require(_0x1f01('0x4'));var BPromise=require(_0x1f01('0x5'));var rp=require(_0x1f01('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1f01('0x7'));var attributes=require(_0x1f01('0x8'));module[_0x1f01('0x9')]=function(_0x3f2aa0,_0x23dafa){return _0x3f2aa0[_0x1f01('0xa')](_0x1f01('0xb'),attributes,{'tableName':_0x1f01('0xc'),'paranoid':![],'indexes':[{'name':_0x1f01('0xd'),'fields':[_0x1f01('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa136=['api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','../../config/logger'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa136,0x73));var _0x6a13=function(_0xeffd69,_0x3ab4f2){_0xeffd69=_0xeffd69-0x0;var _0x20b631=_0xa136[_0xeffd69];return _0x20b631;};'use strict';var _=require(_0x6a13('0x0'));var util=require('util');var logger=require(_0x6a13('0x1'))(_0x6a13('0x2'));var moment=require('moment');var BPromise=require(_0x6a13('0x3'));var rp=require(_0x6a13('0x4'));var fs=require('fs');var path=require(_0x6a13('0x5'));var rimraf=require(_0x6a13('0x6'));var config=require(_0x6a13('0x7'));var attributes=require(_0x6a13('0x8'));module['exports']=function(_0x128d77,_0xeaf198){return _0x128d77[_0x6a13('0x9')](_0x6a13('0xa'),attributes,{'tableName':_0x6a13('0xb'),'paranoid':![],'indexes':[{'name':_0x6a13('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 1999312..d1b1c6e 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 _0x6746=['request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','attributes','limit','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0xd168b5,_0x59219e){var _0x1e735f=function(_0x41207b){while(--_0x41207b){_0xd168b5['push'](_0xd168b5['shift']());}};_0x1e735f(++_0x59219e);}(_0x6746,0x1a0));var _0x6674=function(_0x57cbfb,_0x2de760){_0x57cbfb=_0x57cbfb-0x0;var _0x4cb933=_0x6746[_0x57cbfb];return _0x4cb933;};'use strict';var _=require(_0x6674('0x0'));var util=require(_0x6674('0x1'));var moment=require(_0x6674('0x2'));var BPromise=require(_0x6674('0x3'));var rs=require(_0x6674('0x4'));var fs=require('fs');var Redis=require(_0x6674('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6674('0x6'));var logger=require(_0x6674('0x7'))(_0x6674('0x8'));var config=require('../../config/environment');var jayson=require(_0x6674('0x9'));var client=jayson['client'][_0x6674('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48b3cf,_0xc2c04a,_0x8e0773){return new BPromise(function(_0xf7dbd7,_0x29fe79){return client[_0x6674('0xb')](_0x48b3cf,_0x8e0773)['then'](function(_0x10e741){logger['info'](_0x6674('0xc'),_0xc2c04a,_0x6674('0xd'));logger[_0x6674('0xe')](_0x6674('0xf'),_0xc2c04a,_0x6674('0xd'),JSON[_0x6674('0x10')](_0x10e741));if(_0x10e741[_0x6674('0x11')]){if(_0x10e741[_0x6674('0x11')][_0x6674('0x12')]===0x1f4){logger[_0x6674('0x11')](_0x6674('0xc'),_0xc2c04a,_0x10e741[_0x6674('0x11')]['message']);return _0x29fe79(_0x10e741[_0x6674('0x11')][_0x6674('0x13')]);}logger[_0x6674('0x11')](_0x6674('0xc'),_0xc2c04a,_0x10e741[_0x6674('0x11')][_0x6674('0x13')]);return _0xf7dbd7(_0x10e741[_0x6674('0x11')][_0x6674('0x13')]);}else{logger[_0x6674('0x14')](_0x6674('0xc'),_0xc2c04a,'request\x20sent');_0xf7dbd7(_0x10e741[_0x6674('0x15')][_0x6674('0x13')]);}})[_0x6674('0x16')](function(_0x27d2db){logger[_0x6674('0x11')](_0x6674('0xc'),_0xc2c04a,_0x27d2db);_0x29fe79(_0x27d2db);});});}exports[_0x6674('0x17')]=function(_0x997971){var _0x24e313=this;return new Promise(function(_0x1e3dc9,_0x52b5eb){return db[_0x6674('0x18')][_0x6674('0x19')](_0x997971[_0x6674('0x1a')],{'raw':_0x997971[_0x6674('0x1b')]?_0x997971[_0x6674('0x1b')][_0x6674('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x30b92b){logger[_0x6674('0x14')](_0x6674('0x17'),_0x997971);logger[_0x6674('0xe')]('CreateWhatsappQueueReport',_0x997971,JSON[_0x6674('0x10')](_0x30b92b));_0x1e3dc9(_0x30b92b);})[_0x6674('0x16')](function(_0x2e08e6){logger[_0x6674('0x11')]('CreateWhatsappQueueReport',_0x2e08e6[_0x6674('0x13')],_0x997971);_0x52b5eb(_0x24e313['error'](0x1f4,_0x2e08e6[_0x6674('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x1445c3){var _0x505925=this;return new Promise(function(_0x5db1ce,_0x3a4e9d){return db[_0x6674('0x18')][_0x6674('0x1d')](_0x1445c3[_0x6674('0x1a')],{'raw':_0x1445c3[_0x6674('0x1b')]?_0x1445c3[_0x6674('0x1b')][_0x6674('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1445c3['options']?_0x1445c3['options']['where']||null:null,'attributes':_0x1445c3[_0x6674('0x1b')]?_0x1445c3[_0x6674('0x1b')][_0x6674('0x1e')]||null:null,'limit':_0x1445c3[_0x6674('0x1b')]?_0x1445c3[_0x6674('0x1b')][_0x6674('0x1f')]||null:null})['then'](function(_0x17ad6e){logger[_0x6674('0x14')]('UpdateWhatsappQueueReport',_0x1445c3);logger[_0x6674('0xe')](_0x6674('0x20'),_0x1445c3,JSON[_0x6674('0x10')](_0x17ad6e));_0x5db1ce(_0x17ad6e);})[_0x6674('0x16')](function(_0x270c0f){logger[_0x6674('0x11')](_0x6674('0x20'),_0x270c0f['message'],_0x1445c3);_0x3a4e9d(_0x505925[_0x6674('0x11')](0x1f4,_0x270c0f[_0x6674('0x13')]));});});}; \ No newline at end of file +var _0x0f72=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x0f72,0xdb));var _0x20f7=function(_0x149f42,_0x3a689d){_0x149f42=_0x149f42-0x0;var _0x206421=_0x0f72[_0x149f42];return _0x206421;};'use strict';var _=require(_0x20f7('0x0'));var util=require('util');var moment=require(_0x20f7('0x1'));var BPromise=require(_0x20f7('0x2'));var rs=require(_0x20f7('0x3'));var fs=require('fs');var Redis=require(_0x20f7('0x4'));var db=require(_0x20f7('0x5'))['db'];var utils=require(_0x20f7('0x6'));var logger=require(_0x20f7('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x20f7('0x8')][_0x20f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43eae9,_0x7e22fd,_0x3a02ce){return new BPromise(function(_0x5bb8a1,_0x2ff4d2){return client[_0x20f7('0xa')](_0x43eae9,_0x3a02ce)[_0x20f7('0xb')](function(_0x191fa6){logger[_0x20f7('0xc')](_0x20f7('0xd'),_0x7e22fd,_0x20f7('0xe'));logger[_0x20f7('0xf')](_0x20f7('0x10'),_0x7e22fd,'request\x20sent',JSON[_0x20f7('0x11')](_0x191fa6));if(_0x191fa6['error']){if(_0x191fa6[_0x20f7('0x12')][_0x20f7('0x13')]===0x1f4){logger[_0x20f7('0x12')](_0x20f7('0xd'),_0x7e22fd,_0x191fa6[_0x20f7('0x12')]['message']);return _0x2ff4d2(_0x191fa6['error']['message']);}logger['error'](_0x20f7('0xd'),_0x7e22fd,_0x191fa6['error'][_0x20f7('0x14')]);return _0x5bb8a1(_0x191fa6['error'][_0x20f7('0x14')]);}else{logger[_0x20f7('0xc')](_0x20f7('0xd'),_0x7e22fd,'request\x20sent');_0x5bb8a1(_0x191fa6[_0x20f7('0x15')]['message']);}})[_0x20f7('0x16')](function(_0xe8c656){logger[_0x20f7('0x12')](_0x20f7('0xd'),_0x7e22fd,_0xe8c656);_0x2ff4d2(_0xe8c656);});});}exports[_0x20f7('0x17')]=function(_0x416bce){var _0x5937b7=this;return new Promise(function(_0x29240f,_0x48b415){return db[_0x20f7('0x18')]['create'](_0x416bce[_0x20f7('0x19')],{'raw':_0x416bce[_0x20f7('0x1a')]?_0x416bce[_0x20f7('0x1a')][_0x20f7('0x1b')]===undefined?!![]:![]:!![]})[_0x20f7('0xb')](function(_0x500ae8){logger[_0x20f7('0xc')](_0x20f7('0x17'),_0x416bce);logger[_0x20f7('0xf')](_0x20f7('0x17'),_0x416bce,JSON[_0x20f7('0x11')](_0x500ae8));_0x29240f(_0x500ae8);})['catch'](function(_0x148504){logger[_0x20f7('0x12')](_0x20f7('0x17'),_0x148504['message'],_0x416bce);_0x48b415(_0x5937b7[_0x20f7('0x12')](0x1f4,_0x148504[_0x20f7('0x14')]));});});};exports[_0x20f7('0x1c')]=function(_0x52bdda){var _0x4fb17b=this;return new Promise(function(_0x5ba8a9,_0x365218){return db['WhatsappQueueReport'][_0x20f7('0x1d')](_0x52bdda[_0x20f7('0x19')],{'raw':_0x52bdda['options']?_0x52bdda[_0x20f7('0x1a')][_0x20f7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52bdda[_0x20f7('0x1a')]?_0x52bdda['options'][_0x20f7('0x1e')]||null:null,'attributes':_0x52bdda[_0x20f7('0x1a')]?_0x52bdda[_0x20f7('0x1a')][_0x20f7('0x1f')]||null:null,'limit':_0x52bdda[_0x20f7('0x1a')]?_0x52bdda[_0x20f7('0x1a')][_0x20f7('0x20')]||null:null})[_0x20f7('0xb')](function(_0x399ae3){logger[_0x20f7('0xc')](_0x20f7('0x1c'),_0x52bdda);logger[_0x20f7('0xf')](_0x20f7('0x1c'),_0x52bdda,JSON[_0x20f7('0x11')](_0x399ae3));_0x5ba8a9(_0x399ae3);})[_0x20f7('0x16')](function(_0x23f30e){logger[_0x20f7('0x12')]('UpdateWhatsappQueueReport',_0x23f30e['message'],_0x52bdda);_0x365218(_0x4fb17b[_0x20f7('0x12')](0x1f4,_0x23f30e[_0x20f7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 7504640..2f731a0 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 _0x3625=['/describe','describe','/:id','show','put','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x3625,0x18d));var _0x5362=function(_0x1df27e,_0x162faa){_0x1df27e=_0x1df27e-0x0;var _0x1a329c=_0x3625[_0x1df27e];return _0x1a329c;};'use strict';var multer=require(_0x5362('0x0'));var util=require(_0x5362('0x1'));var path=require('path');var timeout=require(_0x5362('0x2'));var express=require(_0x5362('0x3'));var router=express[_0x5362('0x4')]();var auth=require(_0x5362('0x5'));var interaction=require(_0x5362('0x6'));var config=require('../../config/environment');var controller=require(_0x5362('0x7'));router[_0x5362('0x8')]('/',auth[_0x5362('0x9')](),controller[_0x5362('0xa')]);router[_0x5362('0x8')](_0x5362('0xb'),auth[_0x5362('0x9')](),controller[_0x5362('0xc')]);router[_0x5362('0x8')](_0x5362('0xd'),auth[_0x5362('0x9')](),controller[_0x5362('0xe')]);router['post']('/',auth[_0x5362('0x9')](),controller['create']);router[_0x5362('0xf')](_0x5362('0xd'),auth[_0x5362('0x9')](),controller['update']);router['delete']('/:id',auth[_0x5362('0x9')](),controller['destroy']);module[_0x5362('0x10')]=router; \ No newline at end of file +var _0x0b62=['../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','destroy','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x1504d6,_0xbbeedd){var _0x1add76=function(_0x26bfc6){while(--_0x26bfc6){_0x1504d6['push'](_0x1504d6['shift']());}};_0x1add76(++_0xbbeedd);}(_0x0b62,0x177));var _0x20b6=function(_0x1b21ff,_0x217fcb){_0x1b21ff=_0x1b21ff-0x0;var _0xd3cb46=_0x0b62[_0x1b21ff];return _0xd3cb46;};'use strict';var multer=require(_0x20b6('0x0'));var util=require(_0x20b6('0x1'));var path=require('path');var timeout=require(_0x20b6('0x2'));var express=require('express');var router=express[_0x20b6('0x3')]();var auth=require(_0x20b6('0x4'));var interaction=require(_0x20b6('0x5'));var config=require(_0x20b6('0x6'));var controller=require(_0x20b6('0x7'));router[_0x20b6('0x8')]('/',auth['isAuthenticated'](),controller[_0x20b6('0x9')]);router[_0x20b6('0x8')](_0x20b6('0xa'),auth[_0x20b6('0xb')](),controller[_0x20b6('0xc')]);router[_0x20b6('0x8')](_0x20b6('0xd'),auth[_0x20b6('0xb')](),controller[_0x20b6('0xe')]);router['post']('/',auth[_0x20b6('0xb')](),controller['create']);router[_0x20b6('0xf')](_0x20b6('0xd'),auth[_0x20b6('0xb')](),controller[_0x20b6('0x10')]);router[_0x20b6('0x11')](_0x20b6('0xd'),auth[_0x20b6('0xb')](),controller[_0x20b6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 0ae2fc1..8bd44bb 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 _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xb10b,0x12a));var _0xbb10=function(_0x17a28d,_0x48bda8){_0x17a28d=_0x17a28d-0x0;var _0x636d2d=_0xb10b[_0x17a28d];return _0x636d2d;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0x2032=['agent','queue','exports','STRING','ENUM'];(function(_0x885770,_0x33f00e){var _0x4543a2=function(_0xc49cdc){while(--_0xc49cdc){_0x885770['push'](_0x885770['shift']());}};_0x4543a2(++_0x33f00e);}(_0x2032,0xd9));var _0x2203=function(_0xe8367f,_0x10972b){_0xe8367f=_0xe8367f-0x0;var _0x8db806=_0x2032[_0xe8367f];return _0x8db806;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'uniqueid':{'type':Sequelize[_0x2203('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2203('0x2')]('account',_0x2203('0x3'),_0x2203('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 24bcc44..6f67df2 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 _0x1455=['mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','Content-Range','json','reject','save','update','destroy','then','error','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x1455,0x97));var _0x5145=function(_0x4871d0,_0x76fc1a){_0x4871d0=_0x4871d0-0x0;var _0x6e09da=_0x1455[_0x4871d0];return _0x6e09da;};'use strict';var pdf=require(_0x5145('0x0'));var emlformat=require(_0x5145('0x1'));var rimraf=require(_0x5145('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5145('0x3'));var rp=require(_0x5145('0x4'));var moment=require(_0x5145('0x5'));var BPromise=require(_0x5145('0x6'));var Mustache=require(_0x5145('0x7'));var util=require(_0x5145('0x8'));var path=require(_0x5145('0x9'));var sox=require('sox');var csv=require(_0x5145('0xa'));var ejs=require(_0x5145('0xb'));var fs=require('fs');var _=require(_0x5145('0xc'));var squel=require('squel');var crypto=require(_0x5145('0xd'));var jsforce=require(_0x5145('0xe'));var deskjs=require(_0x5145('0xf'));var toCsv=require(_0x5145('0xa'));var querystring=require('querystring');var Papa=require(_0x5145('0x10'));var Redis=require(_0x5145('0x11'));var authService=require(_0x5145('0x12'));var qs=require(_0x5145('0x13'));var as=require(_0x5145('0x14'));var hardwareService=require(_0x5145('0x15'));var logger=require(_0x5145('0x16'))(_0x5145('0x17'));var utils=require(_0x5145('0x18'));var config=require(_0x5145('0x19'));var licenseUtil=require(_0x5145('0x1a'));var db=require(_0x5145('0x1b'))['db'];function respondWithStatusCode(_0x34978f,_0x61723f){_0x61723f=_0x61723f||0xcc;return function(_0x4cb967){if(_0x4cb967){return _0x34978f[_0x5145('0x1c')](_0x61723f);}return _0x34978f['status'](_0x61723f)[_0x5145('0x1d')]();};}function respondWithResult(_0x4d593b,_0x14b79f){_0x14b79f=_0x14b79f||0xc8;return function(_0x174add){if(_0x174add){return _0x4d593b[_0x5145('0x1e')](_0x14b79f)['json'](_0x174add);}};}function respondWithFilteredResult(_0x3ec453,_0x1c3f0c){return function(_0x23ae7c){if(_0x23ae7c){var _0x3b8555=_0x23ae7c['count'],_0x3ed99e=_0x1c3f0c[_0x5145('0x1f')],_0x3bbac1=_0x1c3f0c[_0x5145('0x1f')]+_0x1c3f0c['limit'],_0x51a4f7;if(_0x3bbac1>=_0x3b8555){_0x3bbac1=_0x3b8555;_0x51a4f7=0xc8;}else{_0x51a4f7=0xce;}_0x3ec453[_0x5145('0x1e')](_0x51a4f7);return _0x3ec453['set'](_0x5145('0x20'),_0x3ed99e+'-'+_0x3bbac1+'/'+_0x3b8555)[_0x5145('0x21')](_0x23ae7c);}return null;};}function patchUpdates(_0x5830c4){return function(_0x3b1974){try{jsonpatch['apply'](_0x3b1974,_0x5830c4,!![]);}catch(_0x1c319f){return BPromise[_0x5145('0x22')](_0x1c319f);}return _0x3b1974[_0x5145('0x23')]();};}function saveUpdates(_0x292d10,_0x585bb4){return function(_0x526e1f){if(_0x526e1f){return _0x526e1f[_0x5145('0x24')](_0x292d10)['then'](function(_0x133e63){return _0x133e63;});}return null;};}function removeEntity(_0x51e6e5,_0x1f1714){return function(_0x2a1cf5){if(_0x2a1cf5){return _0x2a1cf5[_0x5145('0x25')]()[_0x5145('0x26')](function(){_0x51e6e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5abdf3,_0xea624){return function(_0x1f2649){if(!_0x1f2649){_0x5abdf3[_0x5145('0x1c')](0x194);}return _0x1f2649;};}function handleError(_0x5c6376,_0x1a5ccc){_0x1a5ccc=_0x1a5ccc||0x1f4;return function(_0x2d9c77){logger[_0x5145('0x27')](_0x2d9c77['stack']);if(_0x2d9c77['name']){delete _0x2d9c77[_0x5145('0x28')];}_0x5c6376[_0x5145('0x1e')](_0x1a5ccc)[_0x5145('0x29')](_0x2d9c77);};}exports[_0x5145('0x2a')]=function(_0x53769a,_0x50657e){var _0x58f3c7={},_0xb48a80={},_0xacc45e={'count':0x0,'rows':[]};var _0xd95131=_[_0x5145('0x2b')](db[_0x5145('0x2c')][_0x5145('0x2d')],function(_0x3addfd){return{'name':_0x3addfd[_0x5145('0x2e')],'type':_0x3addfd[_0x5145('0x2f')][_0x5145('0x30')]};});_0xb48a80[_0x5145('0x31')]=_[_0x5145('0x2b')](_0xd95131,_0x5145('0x28'));_0xb48a80[_0x5145('0x32')]=_[_0x5145('0x33')](_0x53769a['query']);_0xb48a80['filters']=_[_0x5145('0x34')](_0xb48a80[_0x5145('0x31')],_0xb48a80[_0x5145('0x32')]);_0x58f3c7[_0x5145('0x35')]=_['intersection'](_0xb48a80[_0x5145('0x31')],qs[_0x5145('0x36')](_0x53769a[_0x5145('0x32')][_0x5145('0x36')]));_0x58f3c7[_0x5145('0x35')]=_0x58f3c7[_0x5145('0x35')][_0x5145('0x37')]?_0x58f3c7[_0x5145('0x35')]:_0xb48a80[_0x5145('0x31')];if(!_0x53769a[_0x5145('0x32')]['hasOwnProperty'](_0x5145('0x38'))){_0x58f3c7[_0x5145('0x39')]=qs[_0x5145('0x39')](_0x53769a[_0x5145('0x32')]['limit']);_0x58f3c7[_0x5145('0x1f')]=qs[_0x5145('0x1f')](_0x53769a['query']['offset']);}_0x58f3c7[_0x5145('0x3a')]=qs[_0x5145('0x3b')](_0x53769a[_0x5145('0x32')][_0x5145('0x3b')]);_0x58f3c7[_0x5145('0x3c')]=qs[_0x5145('0x3d')](_[_0x5145('0x3e')](_0x53769a[_0x5145('0x32')],_0xb48a80[_0x5145('0x3d')]),_0xd95131);if(_0x53769a[_0x5145('0x32')][_0x5145('0x3f')]){_0x58f3c7[_0x5145('0x3c')]=_['merge'](_0x58f3c7['where'],{'$or':_[_0x5145('0x2b')](_0xd95131,function(_0x476cf5){if(_0x476cf5['type']!==_0x5145('0x40')){var _0x3d95d8={};_0x3d95d8[_0x476cf5[_0x5145('0x28')]]={'$like':'%'+_0x53769a[_0x5145('0x32')][_0x5145('0x3f')]+'%'};return _0x3d95d8;}})});}_0x58f3c7=_[_0x5145('0x41')]({},_0x58f3c7,_0x53769a['options']);var _0x3057a2={'where':_0x58f3c7[_0x5145('0x3c')]};return db[_0x5145('0x2c')][_0x5145('0x42')](_0x3057a2)[_0x5145('0x26')](function(_0x235bea){_0xacc45e[_0x5145('0x42')]=_0x235bea;if(_0x53769a[_0x5145('0x32')]['includeAll']){_0x58f3c7[_0x5145('0x43')]=[{'all':!![]}];}return db[_0x5145('0x2c')][_0x5145('0x44')](_0x58f3c7);})[_0x5145('0x26')](function(_0x2ef76c){_0xacc45e[_0x5145('0x45')]=_0x2ef76c;return _0xacc45e;})['then'](respondWithFilteredResult(_0x50657e,_0x58f3c7))[_0x5145('0x46')](handleError(_0x50657e,null));};exports[_0x5145('0x47')]=function(_0x46bcb8,_0x2367c4){var _0x14f06c={'raw':!![],'where':{'id':_0x46bcb8[_0x5145('0x48')]['id']}},_0xd4fa9f={};_0xd4fa9f[_0x5145('0x31')]=_['keys'](db['WhatsappTransferReport']['rawAttributes']);_0xd4fa9f['query']=_['keys'](_0x46bcb8['query']);_0xd4fa9f[_0x5145('0x3d')]=_[_0x5145('0x34')](_0xd4fa9f[_0x5145('0x31')],_0xd4fa9f[_0x5145('0x32')]);_0x14f06c[_0x5145('0x35')]=_[_0x5145('0x34')](_0xd4fa9f[_0x5145('0x31')],qs[_0x5145('0x36')](_0x46bcb8['query']['fields']));_0x14f06c[_0x5145('0x35')]=_0x14f06c[_0x5145('0x35')]['length']?_0x14f06c[_0x5145('0x35')]:_0xd4fa9f[_0x5145('0x31')];if(_0x46bcb8['query'][_0x5145('0x49')]){_0x14f06c[_0x5145('0x43')]=[{'all':!![]}];}_0x14f06c=_[_0x5145('0x41')]({},_0x14f06c,_0x46bcb8[_0x5145('0x4a')]);return db[_0x5145('0x2c')]['find'](_0x14f06c)[_0x5145('0x26')](handleEntityNotFound(_0x2367c4,null))[_0x5145('0x26')](respondWithResult(_0x2367c4,null))[_0x5145('0x46')](handleError(_0x2367c4,null));};exports[_0x5145('0x4b')]=function(_0x4f1c9f,_0x2ec84d){return db[_0x5145('0x2c')][_0x5145('0x4b')](_0x4f1c9f[_0x5145('0x4c')],{})[_0x5145('0x26')](respondWithResult(_0x2ec84d,0xc9))[_0x5145('0x46')](handleError(_0x2ec84d,null));};exports[_0x5145('0x24')]=function(_0x50432a,_0x270fda){if(_0x50432a[_0x5145('0x4c')]['id']){delete _0x50432a[_0x5145('0x4c')]['id'];}return db[_0x5145('0x2c')][_0x5145('0x4d')]({'where':{'id':_0x50432a[_0x5145('0x48')]['id']}})[_0x5145('0x26')](handleEntityNotFound(_0x270fda,null))[_0x5145('0x26')](saveUpdates(_0x50432a[_0x5145('0x4c')],null))[_0x5145('0x26')](respondWithResult(_0x270fda,null))[_0x5145('0x46')](handleError(_0x270fda,null));};exports['destroy']=function(_0x10e098,_0x430c3e){return db[_0x5145('0x2c')][_0x5145('0x4d')]({'where':{'id':_0x10e098['params']['id']}})[_0x5145('0x26')](handleEntityNotFound(_0x430c3e,null))['then'](removeEntity(_0x430c3e,null))[_0x5145('0x46')](handleError(_0x430c3e,null));};exports[_0x5145('0x4e')]=function(_0x2f0b77,_0x403f10){return db[_0x5145('0x2c')][_0x5145('0x4e')]()[_0x5145('0x26')](respondWithResult(_0x403f10,null))[_0x5145('0x46')](handleError(_0x403f10,null));}; \ No newline at end of file +var _0xb332=['find','create','body','params','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','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','count','save','update','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','include'];(function(_0x227622,_0x2d11fd){var _0x40823a=function(_0x46ebf9){while(--_0x46ebf9){_0x227622['push'](_0x227622['shift']());}};_0x40823a(++_0x2d11fd);}(_0xb332,0xd9));var _0x2b33=function(_0x61b3ab,_0x1fc298){_0x61b3ab=_0x61b3ab-0x0;var _0x57097f=_0xb332[_0x61b3ab];return _0x57097f;};'use strict';var pdf=require(_0x2b33('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2b33('0x1'));var zipdir=require(_0x2b33('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b33('0x3'));var moment=require('moment');var BPromise=require(_0x2b33('0x4'));var Mustache=require('mustache');var util=require(_0x2b33('0x5'));var path=require('path');var sox=require(_0x2b33('0x6'));var csv=require(_0x2b33('0x7'));var ejs=require(_0x2b33('0x8'));var fs=require('fs');var _=require(_0x2b33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b33('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2b33('0x7'));var querystring=require(_0x2b33('0xb'));var Papa=require(_0x2b33('0xc'));var Redis=require(_0x2b33('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x2b33('0xe'));var as=require(_0x2b33('0xf'));var hardwareService=require(_0x2b33('0x10'));var logger=require(_0x2b33('0x11'))(_0x2b33('0x12'));var utils=require(_0x2b33('0x13'));var config=require(_0x2b33('0x14'));var licenseUtil=require(_0x2b33('0x15'));var db=require(_0x2b33('0x16'))['db'];function respondWithStatusCode(_0x3969cb,_0xca2248){_0xca2248=_0xca2248||0xcc;return function(_0x4df129){if(_0x4df129){return _0x3969cb[_0x2b33('0x17')](_0xca2248);}return _0x3969cb[_0x2b33('0x18')](_0xca2248)[_0x2b33('0x19')]();};}function respondWithResult(_0x4ef886,_0x173c75){_0x173c75=_0x173c75||0xc8;return function(_0x4d39db){if(_0x4d39db){return _0x4ef886[_0x2b33('0x18')](_0x173c75)[_0x2b33('0x1a')](_0x4d39db);}};}function respondWithFilteredResult(_0x233cd9,_0x57aea7){return function(_0x52693f){if(_0x52693f){var _0x1d8e75=_0x52693f[_0x2b33('0x1b')],_0x1d50d0=_0x57aea7['offset'],_0x409428=_0x57aea7['offset']+_0x57aea7['limit'],_0x2f5119;if(_0x409428>=_0x1d8e75){_0x409428=_0x1d8e75;_0x2f5119=0xc8;}else{_0x2f5119=0xce;}_0x233cd9[_0x2b33('0x18')](_0x2f5119);return _0x233cd9['set']('Content-Range',_0x1d50d0+'-'+_0x409428+'/'+_0x1d8e75)[_0x2b33('0x1a')](_0x52693f);}return null;};}function patchUpdates(_0x90b215){return function(_0x205d8f){try{jsonpatch['apply'](_0x205d8f,_0x90b215,!![]);}catch(_0x42461e){return BPromise['reject'](_0x42461e);}return _0x205d8f[_0x2b33('0x1c')]();};}function saveUpdates(_0x2565be,_0x8c8dc2){return function(_0x2998dd){if(_0x2998dd){return _0x2998dd[_0x2b33('0x1d')](_0x2565be)[_0x2b33('0x1e')](function(_0x39567f){return _0x39567f;});}return null;};}function removeEntity(_0x4fb725,_0x23024c){return function(_0x1d9c98){if(_0x1d9c98){return _0x1d9c98[_0x2b33('0x1f')]()[_0x2b33('0x1e')](function(){_0x4fb725[_0x2b33('0x18')](0xcc)[_0x2b33('0x19')]();});}};}function handleEntityNotFound(_0x27f1b8,_0x2605e6){return function(_0x5e1cba){if(!_0x5e1cba){_0x27f1b8[_0x2b33('0x17')](0x194);}return _0x5e1cba;};}function handleError(_0x1b9a48,_0xc1b91d){_0xc1b91d=_0xc1b91d||0x1f4;return function(_0x32b835){logger['error'](_0x32b835[_0x2b33('0x20')]);if(_0x32b835['name']){delete _0x32b835[_0x2b33('0x21')];}_0x1b9a48['status'](_0xc1b91d)[_0x2b33('0x22')](_0x32b835);};}exports[_0x2b33('0x23')]=function(_0x5d8d05,_0x195aa2){var _0x53c2ad={},_0x267969={},_0x5b16a8={'count':0x0,'rows':[]};var _0x315ebd=_[_0x2b33('0x24')](db[_0x2b33('0x25')][_0x2b33('0x26')],function(_0xaa6643){return{'name':_0xaa6643[_0x2b33('0x27')],'type':_0xaa6643[_0x2b33('0x28')][_0x2b33('0x29')]};});_0x267969[_0x2b33('0x2a')]=_[_0x2b33('0x24')](_0x315ebd,'name');_0x267969['query']=_[_0x2b33('0x2b')](_0x5d8d05[_0x2b33('0x2c')]);_0x267969[_0x2b33('0x2d')]=_[_0x2b33('0x2e')](_0x267969[_0x2b33('0x2a')],_0x267969['query']);_0x53c2ad['attributes']=_[_0x2b33('0x2e')](_0x267969[_0x2b33('0x2a')],qs[_0x2b33('0x2f')](_0x5d8d05[_0x2b33('0x2c')][_0x2b33('0x2f')]));_0x53c2ad[_0x2b33('0x30')]=_0x53c2ad['attributes'][_0x2b33('0x31')]?_0x53c2ad['attributes']:_0x267969[_0x2b33('0x2a')];if(!_0x5d8d05[_0x2b33('0x2c')][_0x2b33('0x32')](_0x2b33('0x33'))){_0x53c2ad[_0x2b33('0x34')]=qs[_0x2b33('0x34')](_0x5d8d05[_0x2b33('0x2c')][_0x2b33('0x34')]);_0x53c2ad[_0x2b33('0x35')]=qs[_0x2b33('0x35')](_0x5d8d05[_0x2b33('0x2c')][_0x2b33('0x35')]);}_0x53c2ad[_0x2b33('0x36')]=qs[_0x2b33('0x37')](_0x5d8d05[_0x2b33('0x2c')][_0x2b33('0x37')]);_0x53c2ad['where']=qs['filters'](_['pick'](_0x5d8d05[_0x2b33('0x2c')],_0x267969[_0x2b33('0x2d')]),_0x315ebd);if(_0x5d8d05[_0x2b33('0x2c')][_0x2b33('0x38')]){_0x53c2ad[_0x2b33('0x39')]=_['merge'](_0x53c2ad['where'],{'$or':_[_0x2b33('0x24')](_0x315ebd,function(_0x4c3997){if(_0x4c3997[_0x2b33('0x28')]!==_0x2b33('0x3a')){var _0x1f7b14={};_0x1f7b14[_0x4c3997[_0x2b33('0x21')]]={'$like':'%'+_0x5d8d05[_0x2b33('0x2c')][_0x2b33('0x38')]+'%'};return _0x1f7b14;}})});}_0x53c2ad=_[_0x2b33('0x3b')]({},_0x53c2ad,_0x5d8d05[_0x2b33('0x3c')]);var _0x21557c={'where':_0x53c2ad[_0x2b33('0x39')]};return db['WhatsappTransferReport'][_0x2b33('0x1b')](_0x21557c)[_0x2b33('0x1e')](function(_0x1f0160){_0x5b16a8['count']=_0x1f0160;if(_0x5d8d05['query'][_0x2b33('0x3d')]){_0x53c2ad['include']=[{'all':!![]}];}return db[_0x2b33('0x25')][_0x2b33('0x3e')](_0x53c2ad);})['then'](function(_0x10147a){_0x5b16a8[_0x2b33('0x3f')]=_0x10147a;return _0x5b16a8;})['then'](respondWithFilteredResult(_0x195aa2,_0x53c2ad))[_0x2b33('0x40')](handleError(_0x195aa2,null));};exports[_0x2b33('0x41')]=function(_0x47d01f,_0x2168b6){var _0x1c7cb2={'raw':!![],'where':{'id':_0x47d01f['params']['id']}},_0x264e64={};_0x264e64[_0x2b33('0x2a')]=_[_0x2b33('0x2b')](db[_0x2b33('0x25')][_0x2b33('0x26')]);_0x264e64[_0x2b33('0x2c')]=_['keys'](_0x47d01f[_0x2b33('0x2c')]);_0x264e64[_0x2b33('0x2d')]=_[_0x2b33('0x2e')](_0x264e64['model'],_0x264e64[_0x2b33('0x2c')]);_0x1c7cb2[_0x2b33('0x30')]=_[_0x2b33('0x2e')](_0x264e64[_0x2b33('0x2a')],qs['fields'](_0x47d01f[_0x2b33('0x2c')][_0x2b33('0x2f')]));_0x1c7cb2['attributes']=_0x1c7cb2['attributes']['length']?_0x1c7cb2[_0x2b33('0x30')]:_0x264e64['model'];if(_0x47d01f[_0x2b33('0x2c')][_0x2b33('0x3d')]){_0x1c7cb2[_0x2b33('0x42')]=[{'all':!![]}];}_0x1c7cb2=_[_0x2b33('0x3b')]({},_0x1c7cb2,_0x47d01f[_0x2b33('0x3c')]);return db[_0x2b33('0x25')][_0x2b33('0x43')](_0x1c7cb2)[_0x2b33('0x1e')](handleEntityNotFound(_0x2168b6,null))['then'](respondWithResult(_0x2168b6,null))[_0x2b33('0x40')](handleError(_0x2168b6,null));};exports[_0x2b33('0x44')]=function(_0x186f65,_0x83de95){return db[_0x2b33('0x25')][_0x2b33('0x44')](_0x186f65['body'],{})['then'](respondWithResult(_0x83de95,0xc9))['catch'](handleError(_0x83de95,null));};exports['update']=function(_0x13a5d4,_0x5cdf5d){if(_0x13a5d4[_0x2b33('0x45')]['id']){delete _0x13a5d4['body']['id'];}return db['WhatsappTransferReport'][_0x2b33('0x43')]({'where':{'id':_0x13a5d4[_0x2b33('0x46')]['id']}})[_0x2b33('0x1e')](handleEntityNotFound(_0x5cdf5d,null))['then'](saveUpdates(_0x13a5d4[_0x2b33('0x45')],null))['then'](respondWithResult(_0x5cdf5d,null))[_0x2b33('0x40')](handleError(_0x5cdf5d,null));};exports[_0x2b33('0x1f')]=function(_0x2a20a4,_0x75833f){return db[_0x2b33('0x25')][_0x2b33('0x43')]({'where':{'id':_0x2a20a4['params']['id']}})[_0x2b33('0x1e')](handleEntityNotFound(_0x75833f,null))[_0x2b33('0x1e')](removeEntity(_0x75833f,null))[_0x2b33('0x40')](handleError(_0x75833f,null));};exports['describe']=function(_0x3a3065,_0x2084a4){return db[_0x2b33('0x25')]['describe']()[_0x2b33('0x1e')](respondWithResult(_0x2084a4,null))['catch'](handleError(_0x2084a4,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2d67ed5..db515a8 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 _0x0028=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x9bbb1f,_0x264857){var _0x51e8da=function(_0x226e20){while(--_0x226e20){_0x9bbb1f['push'](_0x9bbb1f['shift']());}};_0x51e8da(++_0x264857);}(_0x0028,0xef));var _0x8002=function(_0x16e824,_0x23ab90){_0x16e824=_0x16e824-0x0;var _0x1745ea=_0x0028[_0x16e824];return _0x1745ea;};'use strict';var _=require(_0x8002('0x0'));var util=require(_0x8002('0x1'));var logger=require(_0x8002('0x2'))(_0x8002('0x3'));var moment=require('moment');var BPromise=require(_0x8002('0x4'));var rp=require(_0x8002('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8002('0x6'));var config=require(_0x8002('0x7'));var attributes=require(_0x8002('0x8'));module[_0x8002('0x9')]=function(_0x1131d2,_0x4f9774){return _0x1131d2[_0x8002('0xa')](_0x8002('0xb'),attributes,{'tableName':_0x8002('0xc'),'paranoid':![],'indexes':[{'name':_0x8002('0xd'),'fields':[_0x8002('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2fbe=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x2fbe,0x159));var _0xe2fb=function(_0x4f903e,_0x133695){_0x4f903e=_0x4f903e-0x0;var _0x59888e=_0x2fbe[_0x4f903e];return _0x59888e;};'use strict';var _=require(_0xe2fb('0x0'));var util=require(_0xe2fb('0x1'));var logger=require(_0xe2fb('0x2'))('api');var moment=require(_0xe2fb('0x3'));var BPromise=require(_0xe2fb('0x4'));var rp=require(_0xe2fb('0x5'));var fs=require('fs');var path=require(_0xe2fb('0x6'));var rimraf=require(_0xe2fb('0x7'));var config=require(_0xe2fb('0x8'));var attributes=require(_0xe2fb('0x9'));module['exports']=function(_0x210060,_0x369ae8){return _0x210060[_0xe2fb('0xa')](_0xe2fb('0xb'),attributes,{'tableName':_0xe2fb('0xc'),'paranoid':![],'indexes':[{'name':_0xe2fb('0xd'),'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 42f7716..b9a8c26 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 _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x17725f,_0x553d23){var _0x4e2712=function(_0x53c53d){while(--_0x53c53d){_0x17725f['push'](_0x17725f['shift']());}};_0x4e2712(++_0x553d23);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x3ffd11,_0x12f4d3){var _0xc0367b=function(_0x2afb67){while(--_0x2afb67){_0x3ffd11['push'](_0x3ffd11['shift']());}};_0xc0367b(++_0x12f4d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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/app.js b/server/app.js index 99aef55..0e678d5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5232=['./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','filter','online','join','Offline\x20apps:','map','name','None','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule'];(function(_0x2bc74d,_0x3eb8e6){var _0x3ab575=function(_0x19286d){while(--_0x19286d){_0x2bc74d['push'](_0x2bc74d['shift']());}};_0x3ab575(++_0x3eb8e6);}(_0x5232,0x1c9));var _0x2523=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0x5232[_0x323419];return _0x4c0be7;};'use strict';var _=require(_0x2523('0x0'));var mysqldb=require(_0x2523('0x1'));var rpc=require(_0x2523('0x2'));var config=require(_0x2523('0x3'));var logger=require(_0x2523('0x4'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x2523('0x5'));var schedule=require(_0x2523('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x2523('0x7'));var transcribe=require(_0x2523('0x8'));function main(){return mysqldb['db'][_0x2523('0x9')][_0x2523('0xa')]()[_0x2523('0xb')](function(){return rpc[_0x2523('0xc')]();})[_0x2523('0xb')](function(_0x22440b){logger[_0x2523('0xd')](_0x22440b);return chat[_0x2523('0xe')]();})[_0x2523('0xb')](function(){return whatsapp[_0x2523('0xe')]();})['then'](function(){return schedule[_0x2523('0xe')]();})[_0x2523('0xb')](function(){return transcribe[_0x2523('0xe')]();})[_0x2523('0xb')](function(_0xef9db1){logger[_0x2523('0xd')](_0xef9db1);return pm2['start'](pm2Config);})[_0x2523('0xb')](function(_0x286480){logger[_0x2523('0xd')](_0x2523('0xf'),_['map'](_[_0x2523('0x10')](_0x286480,{'status':_0x2523('0x11')}),'name')[_0x2523('0x12')]());logger[_0x2523('0xd')](_0x2523('0x13'),_[_0x2523('0x14')](_['filter'](_0x286480,function(_0x211505){return _0x211505['status']!==_0x2523('0x11');}),_0x2523('0x15'))[_0x2523('0x12')]()||_0x2523('0x16'));config['seedDB']&&require(_0x2523('0x17'))[_0x2523('0x18')]();require(_0x2523('0x19'))[_0x2523('0x18')]();})[_0x2523('0x1a')](function(_0x2f3a96){logger['error'](_0x2523('0x1b'),_0x2f3a96);process[_0x2523('0x1c')](0x1);});}main(); \ No newline at end of file +var _0xcf2f=['filter','name','status','online','join','None','seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','listen','info','start','Online\x20apps:','map'];(function(_0x2c4aa5,_0x930b68){var _0xead5ca=function(_0x57b3ed){while(--_0x57b3ed){_0x2c4aa5['push'](_0x2c4aa5['shift']());}};_0xead5ca(++_0x930b68);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x5f298,_0x4fbab7){_0x5f298=_0x5f298-0x0;var _0x4d56c9=_0xcf2f[_0x5f298];return _0x4d56c9;};'use strict';var _=require(_0xfcf2('0x0'));var mysqldb=require(_0xfcf2('0x1'));var rpc=require(_0xfcf2('0x2'));var config=require(_0xfcf2('0x3'));var logger=require(_0xfcf2('0x4'))('app');var pm2=require(_0xfcf2('0x5'));var pm2Config=require(_0xfcf2('0x6'));var schedule=require(_0xfcf2('0x7'));var chat=require(_0xfcf2('0x8'));var whatsapp=require(_0xfcf2('0x9'));var transcribe=require(_0xfcf2('0xa'));function main(){return mysqldb['db'][_0xfcf2('0xb')][_0xfcf2('0xc')]()[_0xfcf2('0xd')](function(){return rpc[_0xfcf2('0xe')]();})[_0xfcf2('0xd')](function(_0x34f444){logger[_0xfcf2('0xf')](_0x34f444);return chat[_0xfcf2('0x10')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule[_0xfcf2('0x10')]();})[_0xfcf2('0xd')](function(){return transcribe['start']();})[_0xfcf2('0xd')](function(_0x34b948){logger[_0xfcf2('0xf')](_0x34b948);return pm2[_0xfcf2('0x10')](pm2Config);})['then'](function(_0x4bb3ca){logger[_0xfcf2('0xf')](_0xfcf2('0x11'),_[_0xfcf2('0x12')](_[_0xfcf2('0x13')](_0x4bb3ca,{'status':'online'}),_0xfcf2('0x14'))['join']());logger['info']('Offline\x20apps:',_[_0xfcf2('0x12')](_['filter'](_0x4bb3ca,function(_0x3aa6c0){return _0x3aa6c0[_0xfcf2('0x15')]!==_0xfcf2('0x16');}),_0xfcf2('0x14'))[_0xfcf2('0x17')]()||_0xfcf2('0x18'));config[_0xfcf2('0x19')]&&require('./config/seedDB')[_0xfcf2('0x1a')]();require(_0xfcf2('0x1b'))[_0xfcf2('0x1a')]();})['catch'](function(_0xd87472){logger[_0xfcf2('0x1c')](_0xfcf2('0x1d'),_0xd87472);process[_0xfcf2('0x1e')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index ae4d2b3..c1014ae 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 _0x9be4=['secret','secrets','payload','options','verify','toString','hex','now','HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','session','role','name','userpic','permissions','md5secret','faxPause','smsPause','openchannelPause','lastLoginAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','use','user','params','disposition','then','closed','status','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','pass','Bearer','apikey','getUuid','query','find','isEqual','Unknown\x20authorization\x20format','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','encryptString','join','promisify','sign'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x9be4,0x147));var _0x49be=function(_0x41693d,_0x56c364){_0x41693d=_0x41693d-0x0;var _0x591802=_0x9be4[_0x41693d];return _0x591802;};'use strict';var db=require(_0x49be('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x49be('0x1'));var licenseUtil=require(_0x49be('0x2'));var encryptor=require(_0x49be('0x3'));var _=require(_0x49be('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x49be('0x5'));var compose=require(_0x49be('0x6'));var basicAuth=require(_0x49be('0x7'));var crypto=require(_0x49be('0x8'));var BPromise=require(_0x49be('0x9'));var util=require(_0x49be('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0x49be('0xb')]});var userAttributes=['id',_0x49be('0xc'),'fullname',_0x49be('0xd'),'internal','email',_0x49be('0xe'),_0x49be('0xf'),_0x49be('0x10'),'voicePause','chatPause','mailPause',_0x49be('0x11'),_0x49be('0x12'),_0x49be('0x13'),'pauseType','showWebBar',_0x49be('0x14'),'lastPauseAt',_0x49be('0x15'),'allowmessenger','passwordResetAt',_0x49be('0x16'),_0x49be('0x17'),_0x49be('0x18'),_0x49be('0x19'),_0x49be('0x1a'),_0x49be('0x1b'),_0x49be('0x1c'),_0x49be('0x1d'),_0x49be('0x1e'),_0x49be('0x1f'),_0x49be('0x20'),_0x49be('0x21'),_0x49be('0x22'),_0x49be('0x23'),_0x49be('0x24')];exports[_0x49be('0x25')]=function(){return this[_0x49be('0x26')](!![])[_0x49be('0x27')](function(_0x9aa859,_0x55f24b,_0x23e426){if(_0x9aa859[_0x49be('0x28')]){_0x23e426();}else{return db['ChatInteraction']['findOne']({'where':{'id':_0x9aa859[_0x49be('0x29')]['id']},'attributes':['id','closed',_0x49be('0x2a')],'raw':!![]})[_0x49be('0x2b')](function(_0x180025){if(_0x180025&&_0x180025[_0x49be('0x2c')]){return _0x55f24b[_0x49be('0x2d')](_0x180025[_0x49be('0x2a')]===_0x49be('0x2e')?0x195:0x193)[_0x49be('0x2f')]({'message':_0x180025[_0x49be('0x2a')]===_0x49be('0x2e')?_0x49be('0x30'):_0x49be('0x31')});}else{_0x23e426();}})[_0x49be('0x32')](function(_0x563f84){_0x23e426(_0x563f84);});}});};exports[_0x49be('0x26')]=function isAuthenticated(_0x18c158){return compose()[_0x49be('0x27')](function(_0x3c8b33,_0xf9bc06,_0x346181){if(_0x3c8b33[_0x49be('0x33')][_0x49be('0x34')]){if(_[_0x49be('0x35')](_0x3c8b33['headers'][_0x49be('0x34')],_0x49be('0x36'))){var _0x370f4a=basicAuth(_0x3c8b33);db[_0x49be('0x37')]['find']({'where':{'name':_0x370f4a[_0x49be('0xd')]}})[_0x49be('0x2b')](function(_0x26e1f5){if(!_0x26e1f5||!_0x26e1f5['authenticate'](_0x370f4a[_0x49be('0x38')])){return _0xf9bc06['status'](0x191)[_0x49be('0x2f')]({'message':'Wrong\x20credentials.'});}_0x3c8b33[_0x49be('0x28')]={'id':_0x26e1f5['id']};_0x346181();})['catch'](function(_0x4cb1a1){_0x346181(_0x4cb1a1);});}else if(_[_0x49be('0x35')](_0x3c8b33[_0x49be('0x33')]['authorization'],_0x49be('0x39'))){validateJwt(_0x3c8b33,_0xf9bc06,_0x346181);}else{if(_0x18c158){_0x346181();}else{return _0xf9bc06['status'](0x193)[_0x49be('0x2f')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3c8b33['query'][_0x49be('0x3a')]){try{var _0x42c9ab={'audience':hardwareConf[_0x49be('0x3b')](),'issuer':hardwareConf[_0x49be('0x3b')]()};verifyJwt(_0x3c8b33[_0x49be('0x3c')][_0x49be('0x3a')],_0x42c9ab)['then'](function(_0x330bf5){return db[_0x49be('0x37')][_0x49be('0x3d')]({'where':{'id':_0x330bf5['sub']}})[_0x49be('0x2b')](function(_0x2c5835){if(!_0x2c5835||!_[_0x49be('0x3e')](_0x2c5835['apiKeyNonce'],_0x330bf5['nonce'])){return _0xf9bc06[_0x49be('0x2d')](0x191)[_0x49be('0x2f')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x3c8b33['user']={'id':_0x2c5835['id']};_0x346181();});})[_0x49be('0x32')](function(){return _0xf9bc06[_0x49be('0x2d')](0x191)[_0x49be('0x2f')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xa3c809){_0x346181(_0xa3c809);}}else if(_0x18c158){_0x346181();}else{return _0xf9bc06['status'](0x193)[_0x49be('0x2f')]({'message':_0x49be('0x3f')});}})[_0x49be('0x27')](function(_0x48c7ca,_0x5e359b,_0x1d43a7){if(_0x48c7ca[_0x49be('0x28')]){db[_0x49be('0x37')][_0x49be('0x3d')]({'where':{'id':_0x48c7ca[_0x49be('0x28')]['id']},'attributes':userAttributes})['then'](function(_0x11b9fe){if(!_0x11b9fe){return _0x5e359b[_0x49be('0x2d')](0x194)[_0x49be('0x2f')]({'message':_0x49be('0x40')});}_0x48c7ca['user']=_0x11b9fe;_0x1d43a7();})['catch'](function(_0x5d97c2){_0x1d43a7(_0x5d97c2);});}else if(_0x18c158){_0x1d43a7();}else{return _0x5e359b[_0x49be('0x2d')](0x194)[_0x49be('0x2f')]({'message':_0x49be('0x41')});}});};exports[_0x49be('0x42')]=function canUpdate(){return compose()['use'](function(_0x47ece5,_0x34deb0,_0x1532ae){return licenseUtil[_0x49be('0x43')]()[_0x49be('0x2b')](function(_0x4c3c7f){if(_0x4c3c7f[_0x49be('0x44')]){_0x1532ae();}else{return _0x34deb0[_0x49be('0x2d')](0x193)[_0x49be('0x2f')]({'message':_0x49be('0x45')});}})[_0x49be('0x32')](function(_0x390112){_0x1532ae(_0x390112);});});};exports[_0x49be('0x46')]=function(_0x268b6d,_0x5b0af7,_0x28c1c1){_0x268b6d[_0x49be('0x46')]=!![];return _0x28c1c1();};exports[_0x49be('0x47')]=function signToken(_0x4feaeb){return signJwt(_0x4feaeb);};exports[_0x49be('0x48')]=function(_0x5041d2,_0x63d227){if(!_0x5041d2['user']){return _0x63d227[_0x49be('0x2d')](0x194)[_0x49be('0x2f')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x285a80={'payload':{'id':_0x5041d2[_0x49be('0x28')]['id'],'role':_0x5041d2[_0x49be('0x28')][_0x49be('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x285a80)[_0x49be('0x2b')](function(_0x148af2){_0x63d227['cookie'](_0x49be('0x49'),_0x148af2);_0x63d227['redirect'](_0x49be('0x4a'));})[_0x49be('0x32')](function(_0x13a0b3){return _0x63d227[_0x49be('0x2d')](0x1f4)[_0x49be('0x4b')](_0x13a0b3);});};exports[_0x49be('0x4c')]=function(_0x1b3fa6){if(_[_0x49be('0x4d')](_0x1b3fa6[_0x49be('0x4e')])||_[_0x49be('0x4d')](_0x1b3fa6[_0x49be('0x4f')])){return null;}else{return createJwt(_0x1b3fa6);}};exports[_0x49be('0x50')]=function(_0x5a523b){_0x5a523b['apiKeyNonce']=generateNonce();_0x5a523b[_0x49be('0x4f')]=generateIssuedAt();return createJwt(_0x5a523b);};exports['regenerateApiKey']=function(_0x45d0b4,_0x43664b){var _0x55d245=_0x45d0b4['query']['apikey'];if(_0x55d245){var _0x12839f={'nonce':_0x43664b[_0x49be('0x4e')],'iat':_0x43664b[_0x49be('0x4f')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x49be('0x3b')]()};return verifyJwt(_0x55d245,_0x12839f)[_0x49be('0x2b')](function(){return generateApiKey(_0x43664b);});}else{throw{'message':_0x49be('0x51')};}};exports[_0x49be('0x52')]=function(_0x13bab0){var _0x93bbc3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x93bbc3['test'](_0x13bab0))throw new db[(_0x49be('0x53'))][(_0x49be('0x54'))]('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[_0x49be('0x55')]=function(_0x4c7a89,_0x3f6831,_0x10640a){var _0x27cc70=encryptor[_0x49be('0x56')](_0x3f6831)['split'](',');for(var _0x4be476=0x0;_0x4be476<_0x10640a;_0x4be476++){if(!_0x27cc70[_0x4be476])break;if(_0x4c7a89[_0x49be('0x57')]()===_0x27cc70[_0x4be476]['toLowerCase']()){var _0x48ddd7=util[_0x49be('0x58')](_0x49be('0x59'),_0x10640a);if(_0x10640a===0x1){_0x48ddd7='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x48ddd7);}}return;};exports[_0x49be('0x5a')]=function(_0x3bb2a2,_0xb7d780){var _0x3e79d2=_0xb7d780?encryptor[_0x49be('0x56')](_0xb7d780)[_0x49be('0x5b')](','):[];if(_0x3e79d2[_0x49be('0x5c')]===0x5){_0x3e79d2['splice'](-0x1,0x1);}_0x3e79d2['unshift'](_0x3bb2a2);return encryptor[_0x49be('0x5d')](_0x3e79d2[_0x49be('0x5e')](','));};function signJwt(_0x2601ce){var _0x3a7c85=BPromise[_0x49be('0x5f')](jwt[_0x49be('0x60')],{'context':jwt});var _0x143df3=_0x2601ce[_0x49be('0x61')]||config[_0x49be('0x62')][_0x49be('0xb')];return new BPromise(function(_0x405347,_0x25716a){_0x3a7c85(_0x2601ce[_0x49be('0x63')],_0x143df3,_0x2601ce[_0x49be('0x64')])['then'](function(_0x5571a6){_0x405347(_0x5571a6);})[_0x49be('0x32')](function(_0x32e63f){_0x25716a(_0x32e63f);});});}function verifyJwt(_0x9e7526,_0x42dd05,_0x84083c){var _0x26c3bb=BPromise['promisify'](jwt[_0x49be('0x65')],{'context':jwt});var _0x5863fd=_0x84083c||config[_0x49be('0x62')][_0x49be('0xb')];return new BPromise(function(_0x208a7a,_0x48c111){_0x26c3bb(_0x9e7526,_0x5863fd,_0x42dd05)[_0x49be('0x2b')](function(_0x308ed4){_0x208a7a(_0x308ed4);})['catch'](function(_0x56337c){_0x48c111(_0x56337c);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x49be('0x66')](_0x49be('0x67'));}function generateIssuedAt(){return Math['floor'](Date[_0x49be('0x68')]()/0x3e8)[_0x49be('0x66')]();}function createJwt(_0x50801e){var _0x59c254={'payload':{'iat':_0x50801e['apiKeyIat'],'nonce':_0x50801e['apiKeyNonce']},'options':{'algorithm':_0x49be('0x69'),'subject':_0x50801e['id'][_0x49be('0x66')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x49be('0x3b')]()}};return signJwt(_0x59c254)[_0x49be('0x2b')](function(_0x429fc8){return{'iat':_0x50801e['apiKeyIat'],'nonce':_0x50801e[_0x49be('0x4e')],'token':_0x429fc8};});} \ No newline at end of file +var _0x7082=['status','unmanaged','json','Forbidden.','catch','headers','authorization','startsWith','Basic','User','name','authenticate','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','getUuid','find','sub','isEqual','apiKeyNonce','canUpdate','getLicense','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','decryptString','length','splice','unshift','secret','payload','options','promisify','verify','randomBytes','toString','hex','now','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','secrets','session','fullname','internal','userpic','permissions','md5secret','voicePause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then'];(function(_0x223015,_0x1bbda2){var _0x44f516=function(_0x485918){while(--_0x485918){_0x223015['push'](_0x223015['shift']());}};_0x44f516(++_0x1bbda2);}(_0x7082,0x107));var _0x2708=function(_0x41f4a0,_0x59e659){_0x41f4a0=_0x41f4a0-0x0;var _0x395b4c=_0x7082[_0x41f4a0];return _0x395b4c;};'use strict';var db=require(_0x2708('0x0'))['db'];var config=require(_0x2708('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x2708('0x2'));var encryptor=require(_0x2708('0x3'));var _=require(_0x2708('0x4'));var jwt=require(_0x2708('0x5'));var expressJwt=require(_0x2708('0x6'));var compose=require(_0x2708('0x7'));var basicAuth=require(_0x2708('0x8'));var crypto=require(_0x2708('0x9'));var BPromise=require(_0x2708('0xa'));var util=require(_0x2708('0xb'));var validateJwt=expressJwt({'secret':config[_0x2708('0xc')][_0x2708('0xd')]});var userAttributes=['id','role',_0x2708('0xe'),'name',_0x2708('0xf'),'email',_0x2708('0x10'),_0x2708('0x11'),_0x2708('0x12'),_0x2708('0x13'),'chatPause',_0x2708('0x14'),'faxPause',_0x2708('0x15'),'openchannelPause',_0x2708('0x16'),_0x2708('0x17'),_0x2708('0x18'),_0x2708('0x19'),_0x2708('0x1a'),'allowmessenger',_0x2708('0x1b'),_0x2708('0x1c'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0x2708('0x1d'),'phoneBarEnableRecording',_0x2708('0x1e'),'phoneBarEnableSettings',_0x2708('0x1f'),'phoneBarPrefixRequired','phoneBarRemoteControl',_0x2708('0x20'),_0x2708('0x21'),_0x2708('0x22'),_0x2708('0x23'),_0x2708('0x24')];exports['isChatInteractionAuthorized']=function(){return this[_0x2708('0x25')](!![])[_0x2708('0x26')](function(_0x2361fb,_0x38c927,_0x20afc3){if(_0x2361fb[_0x2708('0x27')]){_0x20afc3();}else{return db[_0x2708('0x28')][_0x2708('0x29')]({'where':{'id':_0x2361fb[_0x2708('0x2a')]['id']},'attributes':['id',_0x2708('0x2b'),_0x2708('0x2c')],'raw':!![]})[_0x2708('0x2d')](function(_0x5caa4d){if(_0x5caa4d&&_0x5caa4d[_0x2708('0x2b')]){return _0x38c927[_0x2708('0x2e')](_0x5caa4d[_0x2708('0x2c')]===_0x2708('0x2f')?0x195:0x193)[_0x2708('0x30')]({'message':_0x5caa4d[_0x2708('0x2c')]===_0x2708('0x2f')?'Unmanaged.':_0x2708('0x31')});}else{_0x20afc3();}})[_0x2708('0x32')](function(_0x2899df){_0x20afc3(_0x2899df);});}});};exports[_0x2708('0x25')]=function isAuthenticated(_0x17f98b){return compose()[_0x2708('0x26')](function(_0x10a96f,_0x17d8a7,_0x2da7e1){if(_0x10a96f[_0x2708('0x33')][_0x2708('0x34')]){if(_[_0x2708('0x35')](_0x10a96f[_0x2708('0x33')]['authorization'],_0x2708('0x36'))){var _0x525288=basicAuth(_0x10a96f);db[_0x2708('0x37')]['find']({'where':{'name':_0x525288[_0x2708('0x38')]}})[_0x2708('0x2d')](function(_0x3cfa82){if(!_0x3cfa82||!_0x3cfa82[_0x2708('0x39')](_0x525288['pass'])){return _0x17d8a7[_0x2708('0x2e')](0x191)['json']({'message':_0x2708('0x3a')});}_0x10a96f[_0x2708('0x27')]={'id':_0x3cfa82['id']};_0x2da7e1();})[_0x2708('0x32')](function(_0x335b38){_0x2da7e1(_0x335b38);});}else if(_[_0x2708('0x35')](_0x10a96f[_0x2708('0x33')][_0x2708('0x34')],_0x2708('0x3b'))){validateJwt(_0x10a96f,_0x17d8a7,_0x2da7e1);}else{if(_0x17f98b){_0x2da7e1();}else{return _0x17d8a7[_0x2708('0x2e')](0x193)[_0x2708('0x30')]({'message':_0x2708('0x3c')});}}}else if(_0x10a96f[_0x2708('0x3d')]['apikey']){try{var _0x2efc70={'audience':hardwareConf[_0x2708('0x3e')](),'issuer':hardwareConf[_0x2708('0x3e')]()};verifyJwt(_0x10a96f[_0x2708('0x3d')]['apikey'],_0x2efc70)[_0x2708('0x2d')](function(_0x73caf7){return db[_0x2708('0x37')][_0x2708('0x3f')]({'where':{'id':_0x73caf7[_0x2708('0x40')]}})[_0x2708('0x2d')](function(_0x2ee937){if(!_0x2ee937||!_[_0x2708('0x41')](_0x2ee937[_0x2708('0x42')],_0x73caf7['nonce'])){return _0x17d8a7[_0x2708('0x2e')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x10a96f[_0x2708('0x27')]={'id':_0x2ee937['id']};_0x2da7e1();});})[_0x2708('0x32')](function(){return _0x17d8a7[_0x2708('0x2e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x29436b){_0x2da7e1(_0x29436b);}}else if(_0x17f98b){_0x2da7e1();}else{return _0x17d8a7[_0x2708('0x2e')](0x193)[_0x2708('0x30')]({'message':_0x2708('0x3c')});}})['use'](function(_0x561723,_0x3a55fa,_0x348cbd){if(_0x561723['user']){db[_0x2708('0x37')][_0x2708('0x3f')]({'where':{'id':_0x561723[_0x2708('0x27')]['id']},'attributes':userAttributes})['then'](function(_0x26628d){if(!_0x26628d){return _0x3a55fa[_0x2708('0x2e')](0x194)[_0x2708('0x30')]({'message':'User\x20not\x20found.'});}_0x561723[_0x2708('0x27')]=_0x26628d;_0x348cbd();})[_0x2708('0x32')](function(_0x43a15d){_0x348cbd(_0x43a15d);});}else if(_0x17f98b){_0x348cbd();}else{return _0x3a55fa[_0x2708('0x2e')](0x194)[_0x2708('0x30')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2708('0x43')]=function canUpdate(){return compose()[_0x2708('0x26')](function(_0x132564,_0x524495,_0x31b852){return licenseUtil[_0x2708('0x44')]()[_0x2708('0x2d')](function(_0x4b0412){if(_0x4b0412['update']){_0x31b852();}else{return _0x524495['status'](0x193)['json']({'message':_0x2708('0x45')});}})[_0x2708('0x32')](function(_0x58b4c9){_0x31b852(_0x58b4c9);});});};exports['isMiddleware']=function(_0x34bca8,_0x5e28d4,_0x28c622){_0x34bca8[_0x2708('0x46')]=!![];return _0x28c622();};exports['signToken']=function signToken(_0x47598e){return signJwt(_0x47598e);};exports[_0x2708('0x47')]=function(_0x3fe925,_0xe01e7f){if(!_0x3fe925['user']){return _0xe01e7f[_0x2708('0x2e')](0x194)['json']({'message':_0x2708('0x48')});}var _0x568bb9={'payload':{'id':_0x3fe925[_0x2708('0x27')]['id'],'role':_0x3fe925[_0x2708('0x27')][_0x2708('0x49')]},'options':{'expiresIn':0x15180}};return signJwt(_0x568bb9)[_0x2708('0x2d')](function(_0x4ec0cf){_0xe01e7f[_0x2708('0x4a')]('motion.token',_0x4ec0cf);_0xe01e7f['redirect'](_0x2708('0x4b'));})[_0x2708('0x32')](function(_0x7f6ca8){return _0xe01e7f[_0x2708('0x2e')](0x1f4)['send'](_0x7f6ca8);});};exports[_0x2708('0x4c')]=function(_0x3935cb){if(_[_0x2708('0x4d')](_0x3935cb[_0x2708('0x42')])||_[_0x2708('0x4d')](_0x3935cb[_0x2708('0x4e')])){return null;}else{return createJwt(_0x3935cb);}};exports[_0x2708('0x4f')]=function(_0x312e8a){_0x312e8a[_0x2708('0x42')]=generateNonce();_0x312e8a[_0x2708('0x4e')]=generateIssuedAt();return createJwt(_0x312e8a);};exports[_0x2708('0x50')]=function(_0x1e2bc7,_0x1f18f1){var _0x648a0f=_0x1e2bc7[_0x2708('0x3d')][_0x2708('0x51')];if(_0x648a0f){var _0x29b99f={'nonce':_0x1f18f1[_0x2708('0x42')],'iat':_0x1f18f1[_0x2708('0x4e')],'audience':hardwareConf[_0x2708('0x3e')](),'issuer':hardwareConf[_0x2708('0x3e')]()};return verifyJwt(_0x648a0f,_0x29b99f)[_0x2708('0x2d')](function(){return generateApiKey(_0x1f18f1);});}else{throw{'message':_0x2708('0x52')};}};exports['validatePasswordPattern']=function(_0x5934c4){var _0x5c2cc2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5c2cc2[_0x2708('0x53')](_0x5934c4))throw new db[(_0x2708('0x54'))]['ValidationError'](_0x2708('0x55'));return;};exports[_0x2708('0x56')]=function(_0x95c585,_0x48f10b,_0x22fe5e){var _0x2f4031=encryptor['decryptString'](_0x48f10b)[_0x2708('0x57')](',');for(var _0x341318=0x0;_0x341318<_0x22fe5e;_0x341318++){if(!_0x2f4031[_0x341318])break;if(_0x95c585['toLowerCase']()===_0x2f4031[_0x341318][_0x2708('0x58')]()){var _0x437b4b=util[_0x2708('0x59')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x22fe5e);if(_0x22fe5e===0x1){_0x437b4b='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x2708('0x54'))]['ValidationError'](_0x437b4b);}}return;};exports['updatePasswordsHistory']=function(_0x2d79c5,_0x514566){var _0x224f25=_0x514566?encryptor[_0x2708('0x5a')](_0x514566)[_0x2708('0x57')](','):[];if(_0x224f25[_0x2708('0x5b')]===0x5){_0x224f25[_0x2708('0x5c')](-0x1,0x1);}_0x224f25[_0x2708('0x5d')](_0x2d79c5);return encryptor['encryptString'](_0x224f25['join'](','));};function signJwt(_0x48f972){var _0x2db52e=BPromise['promisify'](jwt['sign'],{'context':jwt});var _0x12e7c5=_0x48f972[_0x2708('0x5e')]||config['secrets'][_0x2708('0xd')];return new BPromise(function(_0x434e96,_0x46ea61){_0x2db52e(_0x48f972[_0x2708('0x5f')],_0x12e7c5,_0x48f972[_0x2708('0x60')])[_0x2708('0x2d')](function(_0x46e7be){_0x434e96(_0x46e7be);})[_0x2708('0x32')](function(_0x9b5025){_0x46ea61(_0x9b5025);});});}function verifyJwt(_0x39eca0,_0x2bd6d2,_0x1b33aa){var _0x1f96a5=BPromise[_0x2708('0x61')](jwt[_0x2708('0x62')],{'context':jwt});var _0x45e07e=_0x1b33aa||config[_0x2708('0xc')][_0x2708('0xd')];return new BPromise(function(_0x1df6d8,_0x27f9cc){_0x1f96a5(_0x39eca0,_0x45e07e,_0x2bd6d2)[_0x2708('0x2d')](function(_0x2b5957){_0x1df6d8(_0x2b5957);})[_0x2708('0x32')](function(_0x2ebe9b){_0x27f9cc(_0x2ebe9b);});});}function generateNonce(){return crypto[_0x2708('0x63')](0x10)[_0x2708('0x64')](_0x2708('0x65'));}function generateIssuedAt(){return Math['floor'](Date[_0x2708('0x66')]()/0x3e8)[_0x2708('0x64')]();}function createJwt(_0x555694){var _0x1fae2f={'payload':{'iat':_0x555694['apiKeyIat'],'nonce':_0x555694[_0x2708('0x42')]},'options':{'algorithm':'HS512','subject':_0x555694['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x2708('0x3e')]()}};return signJwt(_0x1fae2f)[_0x2708('0x2d')](function(_0x498dcd){return{'iat':_0x555694[_0x2708('0x4e')],'nonce':_0x555694['apiKeyNonce'],'token':_0x498dcd};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 1664816..0020919 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 _0x44e8=['data','update','write','end','final','binary','close','unlink','decryptFile','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','secrets','session','aes-256-ctr','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm'];(function(_0x14282b,_0x36d885){var _0x41fe5b=function(_0xf78409){while(--_0xf78409){_0x14282b['push'](_0x14282b['shift']());}};_0x41fe5b(++_0x36d885);}(_0x44e8,0xd7));var _0x844e=function(_0x3a3f10,_0x3427a2){_0x3a3f10=_0x3a3f10-0x0;var _0x332186=_0x44e8[_0x3a3f10];return _0x332186;};'use strict';var crypto=require(_0x844e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require('../../config/environment');const stringOptions={'secret':config[_0x844e('0x1')][_0x844e('0x2')],'algorithm':_0x844e('0x3')};const fileOptions={'algorithm':_0x844e('0x4')};function combineOptions(_0x49ce1b){var _0x3a8b3c={};for(var _0x167368 in fileOptions){if(fileOptions[_0x844e('0x5')](_0x167368)){_0x3a8b3c[_0x167368]=fileOptions[_0x167368];}}if(_0x49ce1b){for(var _0x446f47 in _0x49ce1b){if(_0x49ce1b['hasOwnProperty'](_0x446f47)){_0x3a8b3c[_0x446f47]=_0x49ce1b[_0x446f47];}}}return _0x3a8b3c;}exports[_0x844e('0x6')]=function(_0x238796,_0x1706b3,_0x11cbd6,_0x571b91){return new BPromise(function(_0x31ab50,_0x7dff16){_0x571b91=combineOptions(_0x571b91);var _0x336881=new Buffer(_0x11cbd6);var _0x134672=fs[_0x844e('0x7')](_0x238796);var _0x1f9921=fs['createWriteStream'](_0x1706b3);var _0x39ef28=crypto[_0x844e('0x8')](_0x571b91[_0x844e('0x9')],_0x336881);_0x134672['on'](_0x844e('0xa'),function(_0x14909f){var _0x37b2a3=new Buffer(_0x39ef28[_0x844e('0xb')](_0x14909f),'binary');_0x1f9921[_0x844e('0xc')](_0x37b2a3);});_0x134672['on'](_0x844e('0xd'),function(){try{var _0x52ac76=new Buffer(_0x39ef28[_0x844e('0xe')](_0x844e('0xf')),'binary');_0x1f9921[_0x844e('0xc')](_0x52ac76);_0x1f9921[_0x844e('0xd')]();_0x1f9921['on'](_0x844e('0x10'),function(){return _0x31ab50(_0x1706b3);});}catch(_0x4ed3a4){fs[_0x844e('0x11')](_0x1706b3);return _0x7dff16(_0x4ed3a4);}});});};exports[_0x844e('0x12')]=function(_0x380eb4,_0x935134,_0x2588a3,_0x353be9){return new BPromise(function(_0x2227c6,_0x5506ef){_0x353be9=combineOptions(_0x353be9);var _0x4f14e9=new Buffer(_0x2588a3);var _0x36286c=fs['createReadStream'](_0x380eb4);var _0x3c307f=fs['createWriteStream'](_0x935134);var _0x315c50=crypto['createDecipher'](_0x353be9[_0x844e('0x9')],_0x4f14e9);_0x36286c['on'](_0x844e('0xa'),function(_0x2d6ba8){var _0x410325=new Buffer(_0x315c50[_0x844e('0xb')](_0x2d6ba8),_0x844e('0xf'));_0x3c307f[_0x844e('0xc')](_0x410325);});_0x36286c['on'](_0x844e('0xd'),function(){try{var _0x4ffb86=new Buffer(_0x315c50[_0x844e('0xe')]('binary'),'binary');_0x3c307f[_0x844e('0xc')](_0x4ffb86);_0x3c307f[_0x844e('0xd')]();_0x3c307f['on'](_0x844e('0x10'),function(){return _0x2227c6(_0x935134);});}catch(_0x286fdd){fs['unlink'](_0x935134);return _0x5506ef(_0x286fdd);}});});};exports[_0x844e('0x13')]=function(_0x3dde07,_0x571498,_0x2520f8){var _0x13489b=_0x2520f8||stringOptions[_0x844e('0x9')];var _0xdba48d=_0x571498||stringOptions[_0x844e('0x14')];var _0x3a65fc=crypto['createCipher'](_0x13489b,_0xdba48d);var _0x399a81=_0x3a65fc[_0x844e('0xb')](_0x3dde07,_0x844e('0x15'),_0x844e('0x16'));_0x399a81+=_0x3a65fc[_0x844e('0xe')]('base64');return _0x399a81;};exports[_0x844e('0x17')]=function(_0x5080c1,_0x57b2ef,_0x431a9c){var _0x130d87=_0x431a9c||stringOptions[_0x844e('0x9')];var _0x587613=_0x57b2ef||stringOptions[_0x844e('0x14')];var _0x2d4acd=crypto[_0x844e('0x18')](_0x130d87,_0x587613);var _0x54fd73=_0x2d4acd[_0x844e('0xb')](_0x5080c1,_0x844e('0x16'),_0x844e('0x15'));_0x54fd73+=_0x2d4acd[_0x844e('0xe')](_0x844e('0x15'));return _0x54fd73;}; \ No newline at end of file +var _0x814b=['createReadStream','createWriteStream','createCipher','algorithm','update','binary','write','end','final','close','unlink','decryptFile','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','bluebird','../../config/environment','secrets','session','aes-256-ctr','hasOwnProperty'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x814b,0x1a2));var _0xb814=function(_0x2a1b33,_0x409f50){_0x2a1b33=_0x2a1b33-0x0;var _0x4c50e7=_0x814b[_0x2a1b33];return _0x4c50e7;};'use strict';var crypto=require(_0xb814('0x0'));var fs=require('fs');var BPromise=require(_0xb814('0x1'));var config=require(_0xb814('0x2'));const stringOptions={'secret':config[_0xb814('0x3')][_0xb814('0x4')],'algorithm':_0xb814('0x5')};const fileOptions={'algorithm':'aes192'};function combineOptions(_0x38c21a){var _0x3e1e9={};for(var _0x258866 in fileOptions){if(fileOptions[_0xb814('0x6')](_0x258866)){_0x3e1e9[_0x258866]=fileOptions[_0x258866];}}if(_0x38c21a){for(var _0x44931c in _0x38c21a){if(_0x38c21a[_0xb814('0x6')](_0x44931c)){_0x3e1e9[_0x44931c]=_0x38c21a[_0x44931c];}}}return _0x3e1e9;}exports['encryptFile']=function(_0x3b0829,_0x2e6272,_0x5c8539,_0x271af9){return new BPromise(function(_0x2913a6,_0x186d5a){_0x271af9=combineOptions(_0x271af9);var _0x41166c=new Buffer(_0x5c8539);var _0x1fea33=fs[_0xb814('0x7')](_0x3b0829);var _0x1086f8=fs[_0xb814('0x8')](_0x2e6272);var _0x207dbc=crypto[_0xb814('0x9')](_0x271af9[_0xb814('0xa')],_0x41166c);_0x1fea33['on']('data',function(_0x43dfe6){var _0x56278f=new Buffer(_0x207dbc[_0xb814('0xb')](_0x43dfe6),_0xb814('0xc'));_0x1086f8[_0xb814('0xd')](_0x56278f);});_0x1fea33['on'](_0xb814('0xe'),function(){try{var _0x2ce718=new Buffer(_0x207dbc[_0xb814('0xf')](_0xb814('0xc')),_0xb814('0xc'));_0x1086f8[_0xb814('0xd')](_0x2ce718);_0x1086f8[_0xb814('0xe')]();_0x1086f8['on'](_0xb814('0x10'),function(){return _0x2913a6(_0x2e6272);});}catch(_0x44fb96){fs[_0xb814('0x11')](_0x2e6272);return _0x186d5a(_0x44fb96);}});});};exports[_0xb814('0x12')]=function(_0x303aca,_0x3a71d6,_0x45e0d0,_0x265a83){return new BPromise(function(_0x125ce2,_0x21b73f){_0x265a83=combineOptions(_0x265a83);var _0x7a21ef=new Buffer(_0x45e0d0);var _0x48c9df=fs[_0xb814('0x7')](_0x303aca);var _0x55ba16=fs[_0xb814('0x8')](_0x3a71d6);var _0xfac75b=crypto['createDecipher'](_0x265a83['algorithm'],_0x7a21ef);_0x48c9df['on']('data',function(_0x399b43){var _0x4d5276=new Buffer(_0xfac75b['update'](_0x399b43),_0xb814('0xc'));_0x55ba16[_0xb814('0xd')](_0x4d5276);});_0x48c9df['on'](_0xb814('0xe'),function(){try{var _0x4e139e=new Buffer(_0xfac75b[_0xb814('0xf')]('binary'),_0xb814('0xc'));_0x55ba16[_0xb814('0xd')](_0x4e139e);_0x55ba16[_0xb814('0xe')]();_0x55ba16['on'](_0xb814('0x10'),function(){return _0x125ce2(_0x3a71d6);});}catch(_0x27352e){fs[_0xb814('0x11')](_0x3a71d6);return _0x21b73f(_0x27352e);}});});};exports[_0xb814('0x13')]=function(_0x594470,_0x2ead86,_0x52b7a3){var _0x3f81d0=_0x52b7a3||stringOptions[_0xb814('0xa')];var _0x31c7ec=_0x2ead86||stringOptions[_0xb814('0x14')];var _0x1c8a2e=crypto[_0xb814('0x9')](_0x3f81d0,_0x31c7ec);var _0x3d836c=_0x1c8a2e['update'](_0x594470,_0xb814('0x15'),_0xb814('0x16'));_0x3d836c+=_0x1c8a2e[_0xb814('0xf')](_0xb814('0x16'));return _0x3d836c;};exports[_0xb814('0x17')]=function(_0x1d5965,_0x3f0150,_0x1e4e89){var _0x5a6291=_0x1e4e89||stringOptions[_0xb814('0xa')];var _0x328a08=_0x3f0150||stringOptions['secret'];var _0x9008b2=crypto[_0xb814('0x18')](_0x5a6291,_0x328a08);var _0x530744=_0x9008b2['update'](_0x1d5965,_0xb814('0x16'),_0xb814('0x15'));_0x530744+=_0x9008b2['final'](_0xb814('0x15'));return _0x530744;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index fc14d0a..8d9aea4 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 _0x70e0=['savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','SELECT','Empty','num','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','basename','.csv','length','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','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','Failed','util','path','lodash','zip-dir','rimraf','../../mysqldb','../../config/logger','argv'];(function(_0x4380e2,_0x4834fe){var _0x339df9=function(_0x3d3925){while(--_0x3d3925){_0x4380e2['push'](_0x4380e2['shift']());}};_0x339df9(++_0x4834fe);}(_0x70e0,0x17b));var _0x070e=function(_0x294655,_0x161262){_0x294655=_0x294655-0x0;var _0x251fa2=_0x70e0[_0x294655];return _0x251fa2;};'use strict';var util=require(_0x070e('0x0'));var path=require(_0x070e('0x1'));var _=require(_0x070e('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x070e('0x3'));var rimraf=require(_0x070e('0x4'));var db=require(_0x070e('0x5'))['db'];var dbH=require(_0x070e('0x5'))['dbH'];var logger=require(_0x070e('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x070e('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x5032e5,_0x35ab0c){var _0x1e11f0={'status':_0x5032e5};var _0x604664={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35ab0c){_0x1e11f0[_0x070e('0x8')]=_0x35ab0c;}return db[_0x070e('0x9')][_0x070e('0xa')](_0x1e11f0,_0x604664);}function main(){var _0x11ffa8=0x1388;var _0x4e99e6;logger['info'](util[_0x070e('0xb')](_0x070e('0xc'),EXTRACTED_REPORT_ID,_0x070e('0xd')));return db[_0x070e('0xe')][_0x070e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x070e('0x10'),_0x070e('0x11')]})[_0x070e('0x12')](function(_0x39d2b9){if(_0x39d2b9){_0x4e99e6=_0x39d2b9;_0x11ffa8=_0x4e99e6[_0x070e('0x11')]||0x1388;}})[_0x070e('0x12')](function(){return dbH['sequelize']['query'](util[_0x070e('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x070e('0x13')]});})[_0x070e('0x12')](function(_0x51d14d){if(!_0x51d14d[0x0]['num']){return analyticExtractedReport(_0x070e('0x14'));}var _0xeae1a5=[];var _0x180897=0x0;var _0x19d9da=!![];if(_0x51d14d&&_0x51d14d['length']){var _0x49861b=_0x51d14d[0x0][_0x070e('0x15')]%(_0x180897+_0x11ffa8);if(_0x4e99e6[_0x070e('0x10')]){for(;_0x19d9da;_0x180897+=_0x11ffa8,_0x49861b=_0x51d14d[0x0][_0x070e('0x15')]%(_0x180897+_0x11ffa8)){if(_0x49861b==0x0||_0x49861b==_0x51d14d[0x0][_0x070e('0x15')]){_0x19d9da=![];}_0xeae1a5[_0x070e('0x16')](dbH['sequelize'][_0x070e('0x17')](util[_0x070e('0xb')](_0x070e('0x18'),QUERY,_0x11ffa8,_0x180897),{'type':dbH[_0x070e('0x19')][_0x070e('0x1a')]['SELECT']}));}}else{_0xeae1a5['push'](dbH['sequelize'][_0x070e('0x17')](QUERY,{'type':dbH[_0x070e('0x19')][_0x070e('0x1a')]['SELECT']}));}}var _0x5b184=path['dirname'](PATH);var _0xf8dd5d=path[_0x070e('0x1b')](PATH,_0x070e('0x1c'));var _0x33e8c6=_0x4e99e6[_0x070e('0x10')]&&_0xeae1a5[_0x070e('0x1d')]>0x1;var _0xe405e=[];if(!fs[_0x070e('0x1e')](path['join'](_0x5b184,_0xf8dd5d))&&_0x33e8c6){fs[_0x070e('0x1f')](path[_0x070e('0x20')](_0x5b184,_0xf8dd5d));}return BPromise[_0x070e('0x21')](_0xeae1a5,function(_0x503f4d){_0xe405e[_0x070e('0x16')](_0x503f4d);})['then'](function(){for(var _0x4a2dbd=0x0;_0x4a2dbd<_0xe405e[_0x070e('0x1d')];_0x4a2dbd+=0x1){var _0x25f6e;var _0x41deb1=_0xe405e[_0x4a2dbd];if(_0x33e8c6){_0x25f6e=path[_0x070e('0x20')](_0x5b184,_0xf8dd5d,util[_0x070e('0xb')]('%s%d.%s',_0xf8dd5d,_0x4a2dbd,_0x070e('0x22')));}else{_0x25f6e=path[_0x070e('0x20')](_0x5b184,util[_0x070e('0xb')](_0x070e('0x23'),_0xf8dd5d,_0x070e('0x22')));}fs[_0x070e('0x24')](_0x25f6e,csv(_0x41deb1));}})[_0x070e('0x12')](function(){if(_0x33e8c6){zipdir(path[_0x070e('0x20')](_0x5b184,_0xf8dd5d),{'saveTo':path['join'](_0x5b184,util[_0x070e('0xb')](_0x070e('0x23'),_0xf8dd5d,_0x070e('0x25')))},function(_0x56fc12,_0x5c5f0d){});rimraf(path[_0x070e('0x20')](_0x5b184,_0xf8dd5d),function(){});}})[_0x070e('0x12')](function(){logger[_0x070e('0x26')](util['format'](_0x070e('0x27'),EXTRACTED_REPORT_ID,_0x070e('0xd')));return analyticExtractedReport(_0x070e('0x28'),_0x33e8c6?util[_0x070e('0xb')]('%s.%s',_0xf8dd5d,_0x33e8c6?'zip':'csv'):null);});})['catch'](function(_0xdf8945){logger['info'](util[_0x070e('0xb')](_0x070e('0x29'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0xdf8945,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x070e('0x2a'));});}main(); \ No newline at end of file +var _0x17ba=['then','sequelize','query','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','split','existsSync','join','each','push','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv'];(function(_0x1a3243,_0x201872){var _0x33f2ca=function(_0x59d32e){while(--_0x59d32e){_0x1a3243['push'](_0x1a3243['shift']());}};_0x33f2ca(++_0x201872);}(_0x17ba,0xab));var _0xa17b=function(_0x2f552,_0x4033f1){_0x2f552=_0x2f552-0x0;var _0x1bc126=_0x17ba[_0x2f552];return _0x1bc126;};'use strict';var util=require(_0xa17b('0x0'));var path=require(_0xa17b('0x1'));var _=require('lodash');var csv=require(_0xa17b('0x2'));var fs=require('fs');var BPromise=require(_0xa17b('0x3'));var zipdir=require(_0xa17b('0x4'));var rimraf=require(_0xa17b('0x5'));var db=require(_0xa17b('0x6'))['db'];var dbH=require(_0xa17b('0x6'))[_0xa17b('0x7')];var logger=require(_0xa17b('0x8'))(_0xa17b('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xa17b('0xa')][0x2]);var QUERY=process[_0xa17b('0xa')][0x3];var PATH=process[_0xa17b('0xa')][0x4];function analyticExtractedReport(_0x1957be,_0x57f9cd){var _0x2ca4d3={'status':_0x1957be};var _0x17d1d2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x57f9cd){_0x2ca4d3[_0xa17b('0xb')]=_0x57f9cd;}return db[_0xa17b('0xc')][_0xa17b('0xd')](_0x2ca4d3,_0x17d1d2);}function main(){var _0x578799=0x1388;var _0x2556c4;logger[_0xa17b('0xe')](util[_0xa17b('0xf')](_0xa17b('0x10'),EXTRACTED_REPORT_ID,_0xa17b('0x11')));return db[_0xa17b('0x12')][_0xa17b('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xa17b('0x14')]})[_0xa17b('0x15')](function(_0x3c3a8a){if(_0x3c3a8a){_0x2556c4=_0x3c3a8a;_0x578799=_0x2556c4['splitSizeCsv']||0x1388;}})[_0xa17b('0x15')](function(){return dbH[_0xa17b('0x16')][_0xa17b('0x17')](util[_0xa17b('0xf')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xa17b('0x16')]['QueryTypes'][_0xa17b('0x18')]});})[_0xa17b('0x15')](function(_0x5de138){if(!_0x5de138[0x0][_0xa17b('0x19')]){return analyticExtractedReport(_0xa17b('0x1a'));}var _0x1c0578=[];var _0x1f8141=0x0;var _0x4870fb=!![];if(_0x5de138&&_0x5de138[_0xa17b('0x1b')]){var _0x5e21c2=_0x5de138[0x0]['num']%(_0x1f8141+_0x578799);if(_0x2556c4['split']){for(;_0x4870fb;_0x1f8141+=_0x578799,_0x5e21c2=_0x5de138[0x0][_0xa17b('0x19')]%(_0x1f8141+_0x578799)){if(_0x5e21c2==0x0||_0x5e21c2==_0x5de138[0x0][_0xa17b('0x19')]){_0x4870fb=![];}_0x1c0578['push'](dbH[_0xa17b('0x16')][_0xa17b('0x17')](util[_0xa17b('0xf')](_0xa17b('0x1c'),QUERY,_0x578799,_0x1f8141),{'type':dbH[_0xa17b('0x16')][_0xa17b('0x1d')][_0xa17b('0x18')]}));}}else{_0x1c0578['push'](dbH[_0xa17b('0x16')][_0xa17b('0x17')](QUERY,{'type':dbH[_0xa17b('0x16')]['QueryTypes'][_0xa17b('0x18')]}));}}var _0x1a6471=path[_0xa17b('0x1e')](PATH);var _0xbbbb62=path[_0xa17b('0x1f')](PATH,_0xa17b('0x20'));var _0x52309c=_0x2556c4[_0xa17b('0x21')]&&_0x1c0578['length']>0x1;var _0xa34739=[];if(!fs[_0xa17b('0x22')](path['join'](_0x1a6471,_0xbbbb62))&&_0x52309c){fs['mkdirSync'](path[_0xa17b('0x23')](_0x1a6471,_0xbbbb62));}return BPromise[_0xa17b('0x24')](_0x1c0578,function(_0x4216ca){_0xa34739[_0xa17b('0x25')](_0x4216ca);})[_0xa17b('0x15')](function(){for(var _0x3a64f5=0x0;_0x3a64f5<_0xa34739['length'];_0x3a64f5+=0x1){var _0x47aff8;var _0x5c98fe=_0xa34739[_0x3a64f5];if(_0x52309c){_0x47aff8=path['join'](_0x1a6471,_0xbbbb62,util[_0xa17b('0xf')]('%s%d.%s',_0xbbbb62,_0x3a64f5,_0xa17b('0x26')));}else{_0x47aff8=path['join'](_0x1a6471,util[_0xa17b('0xf')](_0xa17b('0x27'),_0xbbbb62,_0xa17b('0x26')));}fs[_0xa17b('0x28')](_0x47aff8,csv(_0x5c98fe));}})[_0xa17b('0x15')](function(){if(_0x52309c){zipdir(path[_0xa17b('0x23')](_0x1a6471,_0xbbbb62),{'saveTo':path[_0xa17b('0x23')](_0x1a6471,util[_0xa17b('0xf')](_0xa17b('0x27'),_0xbbbb62,_0xa17b('0x29')))},function(_0xe84db5,_0x573585){});rimraf(path['join'](_0x1a6471,_0xbbbb62),function(){});}})['then'](function(){logger[_0xa17b('0xe')](util[_0xa17b('0xf')](_0xa17b('0x2a'),EXTRACTED_REPORT_ID,_0xa17b('0x11')));return analyticExtractedReport(_0xa17b('0x2b'),_0x52309c?util[_0xa17b('0xf')](_0xa17b('0x27'),_0xbbbb62,_0x52309c?_0xa17b('0x29'):'csv'):null);});})[_0xa17b('0x2c')](function(_0x4da126){logger[_0xa17b('0xe')](util[_0xa17b('0xf')](_0xa17b('0x2d'),EXTRACTED_REPORT_ID,_0xa17b('0x11')),util[_0xa17b('0x2e')](_0x4da126,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa17b('0x2f'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 662e2d9..b07fc3f 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 _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x816d7,_0x104aca){var _0xd0821d=function(_0x330b28){while(--_0x330b28){_0x816d7['push'](_0x816d7['shift']());}};_0xd0821d(++_0x104aca);}(_0xb10b,0x12a));var _0xbb10=function(_0x4df7be,_0x174cea){_0x4df7be=_0x4df7be-0x0;var _0x3c15a4=_0xb10b[_0x4df7be];return _0x3c15a4;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0xdfea02,_0x56e655){var _0xbb499e=function(_0x4db398){while(--_0x4db398){_0xdfea02['push'](_0xdfea02['shift']());}};_0xbb499e(++_0x56e655);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index cc5fece..201735b 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 _0xf39e=['split','splitSizeXlsx','then','query','sequelize','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','.xlsx','existsSync','join','each','xlsx','%s.%s','writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','bluebird','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xf39e,0x18b));var _0xef39=function(_0xe3c832,_0x4e54c0){_0xe3c832=_0xe3c832-0x0;var _0x4cbafc=_0xf39e[_0xe3c832];return _0x4cbafc;};'use strict';var util=require(_0xef39('0x0'));var path=require(_0xef39('0x1'));var _=require(_0xef39('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xef39('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xef39('0x4'));var db=require(_0xef39('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xef39('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xef39('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x35b910,_0x1780c7){var _0x21579d={'status':_0x35b910};var _0x3ea60e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1780c7){_0x21579d[_0xef39('0x8')]=_0x1780c7;}return db[_0xef39('0x9')][_0xef39('0xa')](_0x21579d,_0x3ea60e);}function main(){var _0x475324=0x1388;var _0x4f5bf0;logger[_0xef39('0xb')](util[_0xef39('0xc')](_0xef39('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0xef39('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xef39('0xf'),_0xef39('0x10')]})['then'](function(_0x57a6af){if(_0x57a6af){_0x4f5bf0=_0x57a6af;_0x475324=_0x4f5bf0[_0xef39('0x10')]||0x1388;}})[_0xef39('0x11')](function(){return dbH['sequelize'][_0xef39('0x12')](util[_0xef39('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xef39('0x13')][_0xef39('0x14')][_0xef39('0x15')]});})[_0xef39('0x11')](function(_0x433911){if(!_0x433911[0x0][_0xef39('0x16')]){return analyticExtractedReport(_0xef39('0x17'));}var _0x4da077=[];var _0x463a62=0x0;var _0x3d81a6=!![];if(_0x4f5bf0['split']){if(_0x433911&&_0x433911[_0xef39('0x18')]){var _0x51ccb6=_0x433911[0x0][_0xef39('0x16')]%(_0x463a62+_0x475324);for(;_0x3d81a6;_0x463a62+=_0x475324,_0x51ccb6=_0x433911[0x0][_0xef39('0x16')]%(_0x463a62+_0x475324)){if(_0x51ccb6==0x0||_0x51ccb6==_0x433911[0x0][_0xef39('0x16')]){_0x3d81a6=![];}_0x4da077[_0xef39('0x19')](dbH[_0xef39('0x13')]['query'](util[_0xef39('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x475324,_0x463a62),{'type':dbH[_0xef39('0x13')][_0xef39('0x14')][_0xef39('0x15')]}));}}}else{_0x4da077[_0xef39('0x19')](dbH[_0xef39('0x13')][_0xef39('0x12')](QUERY,{'type':dbH[_0xef39('0x13')]['QueryTypes'][_0xef39('0x15')]}));}var _0x59ec1e=path[_0xef39('0x1a')](PATH);var _0x3e879b=path[_0xef39('0x1b')](PATH,_0xef39('0x1c'));var _0x24c1c1=_0x4f5bf0[_0xef39('0xf')]&&_0x4da077[_0xef39('0x18')]>0x1;var _0x56bb62=[];if(!fs[_0xef39('0x1d')](path[_0xef39('0x1e')](_0x59ec1e,_0x3e879b))&&_0x24c1c1){fs['mkdirSync'](path[_0xef39('0x1e')](_0x59ec1e,_0x3e879b));}return BPromise[_0xef39('0x1f')](_0x4da077,function(_0x5a6b4e){_0x56bb62[_0xef39('0x19')](_0x5a6b4e);})[_0xef39('0x11')](function(){for(var _0x1d7416=0x0;_0x1d7416<_0x56bb62[_0xef39('0x18')];_0x1d7416+=0x1){var _0x22faf8;var _0x676ad=_0x56bb62[_0x1d7416];if(_0x24c1c1){_0x22faf8=path['join'](_0x59ec1e,_0x3e879b,util[_0xef39('0xc')]('%s%d.%s',_0x3e879b,_0x1d7416,_0xef39('0x20')));}else{_0x22faf8=path['join'](_0x59ec1e,util['format'](_0xef39('0x21'),_0x3e879b,_0xef39('0x20')));}fs[_0xef39('0x22')](_0x22faf8,json2xls(_0x676ad),_0xef39('0x23'));}})[_0xef39('0x11')](function(){if(_0x24c1c1){zipdir(path[_0xef39('0x1e')](_0x59ec1e,_0x3e879b),{'saveTo':path[_0xef39('0x1e')](_0x59ec1e,util['format']('%s.%s',_0x3e879b,'zip'))},function(_0x2a1a93,_0x8bc040){});rimraf(path[_0xef39('0x1e')](_0x59ec1e,_0x3e879b),function(){});}})[_0xef39('0x11')](function(){logger['info'](util[_0xef39('0xc')](_0xef39('0x24'),EXTRACTED_REPORT_ID,_0xef39('0x25')));return analyticExtractedReport(_0xef39('0x26'),_0x24c1c1?util[_0xef39('0xc')](_0xef39('0x21'),_0x3e879b,_0x24c1c1?'zip':_0xef39('0x20')):null);});})['catch'](function(_0x3b7b4e){logger[_0xef39('0xb')](util[_0xef39('0xc')](_0xef39('0x27'),EXTRACTED_REPORT_ID,_0xef39('0x25')),util['inspect'](_0x3b7b4e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xef39('0x28'));});}main(); \ No newline at end of file +var _0x783e=['Failed','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','mkdirSync','%s%d.%s','%s.%s','xlsx','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x783e,0xe2));var _0xe783=function(_0x3c234a,_0x4821dd){_0x3c234a=_0x3c234a-0x0;var _0x39821a=_0x783e[_0x3c234a];return _0x39821a;};'use strict';var util=require(_0xe783('0x0'));var path=require(_0xe783('0x1'));var _=require(_0xe783('0x2'));var fs=require('fs');var json2xls=require(_0xe783('0x3'));var BPromise=require('bluebird');var zipdir=require(_0xe783('0x4'));var rimraf=require(_0xe783('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xe783('0x6'))['dbH'];var logger=require(_0xe783('0x7'))(_0xe783('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xe783('0x9')][0x2]);var QUERY=process[_0xe783('0x9')][0x3];var PATH=process[_0xe783('0x9')][0x4];function analyticExtractedReport(_0x1639f5,_0x278465){var _0x14a956={'status':_0x1639f5};var _0x36d655={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x278465){_0x14a956['savename']=_0x278465;}return db[_0xe783('0xa')][_0xe783('0xb')](_0x14a956,_0x36d655);}function main(){var _0x1d2d39=0x1388;var _0x5f4768;logger[_0xe783('0xc')](util['format'](_0xe783('0xd'),EXTRACTED_REPORT_ID,_0xe783('0xe')));return db[_0xe783('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe783('0x10'),_0xe783('0x11')]})[_0xe783('0x12')](function(_0x56a370){if(_0x56a370){_0x5f4768=_0x56a370;_0x1d2d39=_0x5f4768['splitSizeXlsx']||0x1388;}})[_0xe783('0x12')](function(){return dbH['sequelize'][_0xe783('0x13')](util[_0xe783('0x14')](_0xe783('0x15'),QUERY),{'type':dbH[_0xe783('0x16')][_0xe783('0x17')][_0xe783('0x18')]});})[_0xe783('0x12')](function(_0x5db3b9){if(!_0x5db3b9[0x0][_0xe783('0x19')]){return analyticExtractedReport(_0xe783('0x1a'));}var _0x5cdb94=[];var _0x472b9f=0x0;var _0x521031=!![];if(_0x5f4768[_0xe783('0x10')]){if(_0x5db3b9&&_0x5db3b9[_0xe783('0x1b')]){var _0xbb39fc=_0x5db3b9[0x0][_0xe783('0x19')]%(_0x472b9f+_0x1d2d39);for(;_0x521031;_0x472b9f+=_0x1d2d39,_0xbb39fc=_0x5db3b9[0x0][_0xe783('0x19')]%(_0x472b9f+_0x1d2d39)){if(_0xbb39fc==0x0||_0xbb39fc==_0x5db3b9[0x0][_0xe783('0x19')]){_0x521031=![];}_0x5cdb94[_0xe783('0x1c')](dbH[_0xe783('0x16')][_0xe783('0x13')](util[_0xe783('0x14')](_0xe783('0x1d'),QUERY,_0x1d2d39,_0x472b9f),{'type':dbH['sequelize'][_0xe783('0x17')][_0xe783('0x18')]}));}}}else{_0x5cdb94['push'](dbH[_0xe783('0x16')][_0xe783('0x13')](QUERY,{'type':dbH['sequelize'][_0xe783('0x17')][_0xe783('0x18')]}));}var _0x4a232d=path['dirname'](PATH);var _0x487c92=path[_0xe783('0x1e')](PATH,_0xe783('0x1f'));var _0x5bebbe=_0x5f4768[_0xe783('0x10')]&&_0x5cdb94['length']>0x1;var _0x2ec8c1=[];if(!fs[_0xe783('0x20')](path[_0xe783('0x21')](_0x4a232d,_0x487c92))&&_0x5bebbe){fs[_0xe783('0x22')](path[_0xe783('0x21')](_0x4a232d,_0x487c92));}return BPromise['each'](_0x5cdb94,function(_0x33cd33){_0x2ec8c1['push'](_0x33cd33);})['then'](function(){for(var _0x557a18=0x0;_0x557a18<_0x2ec8c1[_0xe783('0x1b')];_0x557a18+=0x1){var _0x31addb;var _0x5202d3=_0x2ec8c1[_0x557a18];if(_0x5bebbe){_0x31addb=path[_0xe783('0x21')](_0x4a232d,_0x487c92,util[_0xe783('0x14')](_0xe783('0x23'),_0x487c92,_0x557a18,'xlsx'));}else{_0x31addb=path[_0xe783('0x21')](_0x4a232d,util[_0xe783('0x14')](_0xe783('0x24'),_0x487c92,_0xe783('0x25')));}fs['writeFileSync'](_0x31addb,json2xls(_0x5202d3),_0xe783('0x26'));}})[_0xe783('0x12')](function(){if(_0x5bebbe){zipdir(path[_0xe783('0x21')](_0x4a232d,_0x487c92),{'saveTo':path[_0xe783('0x21')](_0x4a232d,util[_0xe783('0x14')](_0xe783('0x24'),_0x487c92,_0xe783('0x27')))},function(_0x58efd9,_0x59d00d){});rimraf(path['join'](_0x4a232d,_0x487c92),function(){});}})[_0xe783('0x12')](function(){logger['info'](util['format'](_0xe783('0x28'),EXTRACTED_REPORT_ID,_0xe783('0xe')));return analyticExtractedReport(_0xe783('0x29'),_0x5bebbe?util['format'](_0xe783('0x24'),_0x487c92,_0x5bebbe?'zip':_0xe783('0x25')):null);});})[_0xe783('0x2a')](function(_0x21a0bd){logger[_0xe783('0xc')](util[_0xe783('0x14')](_0xe783('0x2b'),EXTRACTED_REPORT_ID,_0xe783('0xe')),util['inspect'](_0x21a0bd,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xe783('0x2c'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 28a54e4..90ea484 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 _0x3e9e=['CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','filter','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','util','models','findAll','intervals','IntervalId','VoiceExtension','uniq','map','then','groupBy','exten','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','CDR(type)=%s','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context'];(function(_0x138ecd,_0x19ee86){var _0x2d2331=function(_0x76be6c){while(--_0x76be6c){_0x138ecd['push'](_0x138ecd['shift']());}};_0x2d2331(++_0x19ee86);}(_0x3e9e,0x13d));var _0xe3e9=function(_0x2fcc0b,_0x4adca3){_0x2fcc0b=_0x2fcc0b-0x0;var _0x395e80=_0x3e9e[_0x2fcc0b];return _0x395e80;};'use strict';var _=require('lodash');var util=require(_0xe3e9('0x0'));function rewrite(_0x5f18b7,_0xca8454){var _0x57b28b=this;return _0x5f18b7[_0xe3e9('0x1')]['Interval'][_0xe3e9('0x2')]({'raw':!![]})['then'](function(_0x22b4b4){_0x57b28b[_0xe3e9('0x3')]=_0x22b4b4;return _0x5f18b7['models']['VoiceExtension']['findAll']({'where':{'IntervalId':_0xca8454[_0xe3e9('0x4')]},'raw':!![]});})['then'](function(_0x55cb83){return _0x5f18b7[_0xe3e9('0x1')][_0xe3e9('0x5')][_0xe3e9('0x2')]({'where':{'exten':{'$in':_[_0xe3e9('0x6')](_[_0xe3e9('0x7')](_0x55cb83,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xe3e9('0x8')](function(_0x5506cb){var _0xe5665f=_['filter'](_0x5506cb,{'priority':'1'});var _0x26075d=_['filter'](_0x5506cb,{'isApp':0x1});var _0x3a88a0=_[_0xe3e9('0x9')](_0x26075d,_0xe3e9('0xa'));var _0x2f0a87=['queue',_0xe3e9('0xb')];var _0x71a031=[];var _0x5107d9=[];for(var _0x480753 in _0x3a88a0){if(_0x3a88a0[_0xe3e9('0xc')](_0x480753)){_0x57b28b[_0xe3e9('0xd')]=0x2;_0x57b28b['extensions']=[];_0x57b28b[_0xe3e9('0xe')]=_[_0xe3e9('0xf')](_0xe5665f,{'exten':_0x3a88a0[_0x480753][0x0]['exten']});_0x57b28b[_0xe3e9('0x10')][_0xe3e9('0x11')]({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':_0xe3e9('0x13'),'appdata':util['format'](_0xe3e9('0x14'),_0x3a88a0[_0x480753][0x0]['type']),'context':_0x3a88a0[_0x480753][0x0]['context'],'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'priority':_0x57b28b[_0xe3e9('0xd')]++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});if(_0x3a88a0[_0x480753][0x0]['type']===_0xe3e9('0x16')){if(_0x57b28b[_0xe3e9('0xe')]){_0x57b28b[_0xe3e9('0x10')]['push']({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':'Set','appdata':_0xe3e9('0x17')+(_0x57b28b['extension'][_0xe3e9('0x18')]?_0xe3e9('0x19')+_0x57b28b[_0xe3e9('0xe')][_0xe3e9('0x18')]+'}':_0xe3e9('0x1a')),'context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'priority':_0x57b28b['priority']++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});}_0x57b28b[_0xe3e9('0x10')][_0xe3e9('0x11')]({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':_0xe3e9('0x13'),'appdata':_0xe3e9('0x1c')+_0x3a88a0[_0x480753][0x0]['VoiceExtensionId'],'context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'priority':_0x57b28b[_0xe3e9('0xd')]++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});var _0x400844=_0x57b28b[_0xe3e9('0xd')]++;_0x57b28b[_0xe3e9('0x10')][_0xe3e9('0x11')]({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':_0xe3e9('0x1d'),'appdata':_0xe3e9('0x1e')+(_0x400844+0x2)+'):Goto('+(_0x400844+0x1)+')','context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'priority':_0x400844,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});if(_0x57b28b['extension']){_0x57b28b['extensions'][_0xe3e9('0x11')]({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':_0xe3e9('0x13'),'appdata':_0x57b28b['extension'][_0xe3e9('0x18')]?_0xe3e9('0x1f')+_0x57b28b['extension'][_0xe3e9('0x18')]+'}':_0xe3e9('0x20'),'context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'priority':_0x57b28b[_0xe3e9('0xd')]++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});}_0x57b28b[_0xe3e9('0x10')][_0xe3e9('0x11')]({'type':_0x3a88a0[_0x480753][0x0]['type'],'app':_0xe3e9('0x13'),'appdata':'outboundrouteid='+_0x3a88a0[_0x480753][0x0]['VoiceExtensionId'],'context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'priority':_0x57b28b['priority']++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});if(_0x57b28b[_0xe3e9('0xe')]&&_0x57b28b[_0xe3e9('0xe')][_0xe3e9('0xc')](_0xe3e9('0x21'))&&_0x57b28b[_0xe3e9('0xe')][_0xe3e9('0x21')]!==_0xe3e9('0x22')){_0x57b28b['extensions'][_0xe3e9('0x11')]({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':_0xe3e9('0x13'),'appdata':_0xe3e9('0x23'),'context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'priority':_0x57b28b[_0xe3e9('0xd')]++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});_0x57b28b['extensions'][_0xe3e9('0x11')]({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':'Set','appdata':_0xe3e9('0x24')+_0x57b28b[_0xe3e9('0xe')][_0xe3e9('0x21')]||'wav','context':_0x3a88a0[_0x480753][0x0]['context'],'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'priority':_0x57b28b[_0xe3e9('0xd')]++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0]['VoiceExtensionId']});}}_0x57b28b[_0xe3e9('0x10')][_0xe3e9('0x11')]({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':_0xe3e9('0x13'),'appdata':_0xe3e9('0x25'),'context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'exten':_0x3a88a0[_0x480753][0x0]['exten'],'priority':_0x57b28b[_0xe3e9('0xd')]++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});_0x57b28b[_0xe3e9('0x10')]['push']({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':_0xe3e9('0x13'),'appdata':_0xe3e9('0x26'),'context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'priority':_0x57b28b['priority']++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});_0x57b28b[_0xe3e9('0x10')][_0xe3e9('0x11')]({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':_0xe3e9('0x13'),'appdata':_0xe3e9('0x27'),'context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'exten':_0x3a88a0[_0x480753][0x0]['exten'],'priority':_0x57b28b['priority']++,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});for(var _0x1a466d=0x0,_0x30d9fb=0x0;_0x1a466d<_0x3a88a0[_0x480753][_0xe3e9('0x28')];_0x1a466d+=0x1,_0x30d9fb=0x0){var _0x281701=_0x3a88a0[_0x480753][_0x1a466d];if(_0x281701[_0xe3e9('0x12')]){_0x281701[_0xe3e9('0x12')]=_0x281701['type'][_0xe3e9('0x29')]();}var _0x3bcf17=[];var _0x4514b8=[];delete _0x281701['id'];delete _0x281701[_0xe3e9('0x2a')];delete _0x281701[_0xe3e9('0x2b')];var _0x342a26=_0x281701[_0xe3e9('0x2c')]!=='*,*,*,*'?[_0x281701[_0xe3e9('0x2c')]]:_0x281701[_0xe3e9('0x4')]?_['map'](_[_0xe3e9('0x2d')](_0x57b28b[_0xe3e9('0x3')],{'IntervalId':_0x281701['IntervalId']}),'interval'):[];if(_0x281701[_0xe3e9('0xc')](_0xe3e9('0x2e'))){if(_0x281701['tag']&&_0x281701[_0xe3e9('0x2e')]!=='--'){_0x3bcf17[_0xe3e9('0x11')]({'type':_0x281701['type'],'app':'Set','appdata':_0xe3e9('0x2f')+_0x281701[_0xe3e9('0x2e')],'context':_0x281701[_0xe3e9('0x1b')],'exten':_0x281701['exten'],'priority':_0x342a26[_0xe3e9('0x28')]+_0x57b28b[_0xe3e9('0xd')]+_0x30d9fb++,'VoiceExtensionId':_0x281701['VoiceExtensionId']});}}if(_0x281701[_0xe3e9('0x12')]===_0xe3e9('0x16')&&_0x281701[_0xe3e9('0xc')]('callerID')){if(_0x281701[_0xe3e9('0x30')]){_0x3bcf17[_0xe3e9('0x11')]({'type':_0x281701[_0xe3e9('0x12')],'app':_0xe3e9('0x1d'),'appdata':_0xe3e9('0x31')+_0x281701[_0xe3e9('0x30')]+')','context':_0x281701[_0xe3e9('0x1b')],'exten':_0x281701[_0xe3e9('0xa')],'priority':_0x342a26[_0xe3e9('0x28')]+_0x57b28b[_0xe3e9('0xd')]+_0x30d9fb++,'VoiceExtensionId':_0x281701[_0xe3e9('0x15')]});}else{_0x3bcf17[_0xe3e9('0x11')]({'type':_0x281701[_0xe3e9('0x12')],'app':_0xe3e9('0x1d'),'appdata':_0xe3e9('0x32'),'context':_0x281701[_0xe3e9('0x1b')],'exten':_0x281701['exten'],'priority':_0x342a26[_0xe3e9('0x28')]+_0x57b28b['priority']+_0x30d9fb++,'VoiceExtensionId':_0x281701[_0xe3e9('0x15')]});}}if(_0x281701[_0xe3e9('0xc')](_0xe3e9('0x33'))){if(_0x2f0a87[_0xe3e9('0x34')](_0x281701['app'][_0xe3e9('0x29')]())>=0x0&&_0x281701['appType']!==_0xe3e9('0x35')){if(_0x281701[_0xe3e9('0x33')]){_0x3bcf17[_0xe3e9('0x11')]({'type':_0x281701[_0xe3e9('0x12')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x281701['context'],'exten':_0x281701[_0xe3e9('0xa')],'priority':_0x342a26['length']+_0x57b28b[_0xe3e9('0xd')]+_0x30d9fb++,'VoiceExtensionId':_0x281701[_0xe3e9('0x15')]});_0x3bcf17['push']({'type':_0x281701[_0xe3e9('0x12')],'app':'Set','appdata':_0xe3e9('0x36'),'context':_0x281701[_0xe3e9('0x1b')],'exten':_0x281701[_0xe3e9('0xa')],'priority':_0x342a26['length']+_0x57b28b['priority']+_0x30d9fb++,'VoiceExtensionId':_0x281701[_0xe3e9('0x15')]});}else{_0x3bcf17[_0xe3e9('0x11')]({'type':_0x281701[_0xe3e9('0x12')],'app':'ExecIf','appdata':_0xe3e9('0x37'),'context':_0x281701[_0xe3e9('0x1b')],'exten':_0x281701['exten'],'priority':_0x342a26[_0xe3e9('0x28')]+_0x57b28b['priority']+_0x30d9fb++,'VoiceExtensionId':_0x281701['VoiceExtensionId']});_0x3bcf17[_0xe3e9('0x11')]({'type':_0x281701['type'],'app':_0xe3e9('0x13'),'appdata':_0xe3e9('0x38'),'context':_0x281701[_0xe3e9('0x1b')],'exten':_0x281701[_0xe3e9('0xa')],'priority':_0x342a26[_0xe3e9('0x28')]+_0x57b28b['priority']+_0x30d9fb++,'VoiceExtensionId':_0x281701[_0xe3e9('0x15')]});}}}for(var _0x47b895=0x0;_0x47b895<_0x342a26[_0xe3e9('0x28')];_0x47b895+=0x1){var _0x29e844=_0x57b28b['priority']+_0x342a26[_0xe3e9('0x28')];var _0x2e69b3=_0x47b895===_0x342a26[_0xe3e9('0x28')]-0x1?_0x57b28b['priority']+_0x3bcf17['length']+_0x4514b8[_0xe3e9('0x28')]+0x2:_0x57b28b[_0xe3e9('0xd')]+_0x47b895+0x1;_0x3bcf17[_0xe3e9('0x39')](_0x47b895,0x0,{'type':_0x281701[_0xe3e9('0x12')],'app':_0xe3e9('0x3a'),'appdata':_0x342a26[_0x47b895]+'?'+_0x281701[_0xe3e9('0x1b')]+',${EXTEN},'+_0x29e844+':'+_0x281701[_0xe3e9('0x1b')]+_0xe3e9('0x3b')+_0x2e69b3,'exten':_0x281701[_0xe3e9('0xa')],'context':_0x281701[_0xe3e9('0x1b')],'priority':_0x57b28b[_0xe3e9('0xd')]+_0x47b895,'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});}_0x281701[_0xe3e9('0xd')]=_0x3bcf17['length']?_[_0xe3e9('0x3c')](_0x3bcf17)['priority']+0x1:_0x57b28b[_0xe3e9('0xd')];_0x57b28b[_0xe3e9('0xd')]=(_0x4514b8[_0xe3e9('0x28')]?_['last'](_0x4514b8)['priority']:_0x281701[_0xe3e9('0xd')])+0x1;_0x57b28b[_0xe3e9('0x10')]=_[_0xe3e9('0x3d')](_0x57b28b[_0xe3e9('0x10')],_0x3bcf17,[_0x281701],_0x4514b8);}_0x57b28b[_0xe3e9('0x10')]['push']({'type':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x12')],'app':_0xe3e9('0x3e'),'exten':_0x3a88a0[_0x480753][0x0][_0xe3e9('0xa')],'context':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x1b')],'priority':_0x57b28b['priority'],'VoiceExtensionId':_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]});_0x71a031['push'](_0x3a88a0[_0x480753][0x0][_0xe3e9('0x15')]);_0x5107d9=_[_0xe3e9('0x3d')](_0x5107d9,_0x57b28b['extensions']);}}return _0x5f18b7[_0xe3e9('0x3f')](function(_0x528a1e){return _0x5f18b7[_0xe3e9('0x1')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x71a031}},'transaction':_0x528a1e})[_0xe3e9('0x8')](function(_0x7851d9){return _0x5f18b7[_0xe3e9('0x1')][_0xe3e9('0x5')][_0xe3e9('0x40')](_[_0xe3e9('0x41')](_0x5107d9,_0xe3e9('0xd')),{'transaction':_0x528a1e});});});})[_0xe3e9('0x42')](function(_0x59658c){console[_0xe3e9('0x43')](_0x59658c);});}exports[_0xe3e9('0x44')]=rewrite; \ No newline at end of file +var _0xdb1a=['splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','util','models','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','Set','CDR(type)=%s','context','VoiceExtensionId','type','outbound','CDR(destination)=','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','cutdigits','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1'];(function(_0x4574b0,_0x3bd754){var _0x3d720c=function(_0x18a7da){while(--_0x18a7da){_0x4574b0['push'](_0x4574b0['shift']());}};_0x3d720c(++_0x3bd754);}(_0xdb1a,0x1bc));var _0xadb1=function(_0x54d84c,_0x484686){_0x54d84c=_0x54d84c-0x0;var _0x2f9c92=_0xdb1a[_0x54d84c];return _0x2f9c92;};'use strict';var _=require('lodash');var util=require(_0xadb1('0x0'));function rewrite(_0x2cca3d,_0x882891){var _0x47a6ad=this;return _0x2cca3d[_0xadb1('0x1')]['Interval'][_0xadb1('0x2')]({'raw':!![]})[_0xadb1('0x3')](function(_0x28fa91){_0x47a6ad[_0xadb1('0x4')]=_0x28fa91;return _0x2cca3d[_0xadb1('0x1')][_0xadb1('0x5')][_0xadb1('0x2')]({'where':{'IntervalId':_0x882891[_0xadb1('0x6')]},'raw':!![]});})['then'](function(_0x61f591){return _0x2cca3d[_0xadb1('0x1')]['VoiceExtension'][_0xadb1('0x2')]({'where':{'exten':{'$in':_[_0xadb1('0x7')](_[_0xadb1('0x8')](_0x61f591,_0xadb1('0x9')))}},'order':[{'raw':_0xadb1('0xa')}],'raw':!![]});})[_0xadb1('0x3')](function(_0xd2a333){var _0x32329e=_[_0xadb1('0xb')](_0xd2a333,{'priority':'1'});var _0x53e914=_[_0xadb1('0xb')](_0xd2a333,{'isApp':0x1});var _0x52ddeb=_[_0xadb1('0xc')](_0x53e914,'exten');var _0x9645d3=[_0xadb1('0xd'),_0xadb1('0xe')];var _0x36b63e=[];var _0x353fd3=[];for(var _0x5efc60 in _0x52ddeb){if(_0x52ddeb[_0xadb1('0xf')](_0x5efc60)){_0x47a6ad[_0xadb1('0x10')]=0x2;_0x47a6ad[_0xadb1('0x11')]=[];_0x47a6ad[_0xadb1('0x12')]=_['find'](_0x32329e,{'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')]});_0x47a6ad[_0xadb1('0x11')][_0xadb1('0x13')]({'type':_0x52ddeb[_0x5efc60][0x0]['type'],'app':_0xadb1('0x14'),'appdata':util['format'](_0xadb1('0x15'),_0x52ddeb[_0x5efc60][0x0]['type']),'context':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x16')],'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')],'priority':_0x47a6ad[_0xadb1('0x10')]++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});if(_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')]===_0xadb1('0x19')){if(_0x47a6ad[_0xadb1('0x12')]){_0x47a6ad[_0xadb1('0x11')]['push']({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':_0xadb1('0x14'),'appdata':_0xadb1('0x1a')+(_0x47a6ad[_0xadb1('0x12')]['cutdigits']?_0xadb1('0x1b')+_0x47a6ad[_0xadb1('0x12')]['cutdigits']+'}':_0xadb1('0x1c')),'context':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x16')],'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')],'priority':_0x47a6ad['priority']++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});}_0x47a6ad[_0xadb1('0x11')][_0xadb1('0x13')]({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':_0xadb1('0x14'),'appdata':_0xadb1('0x1d')+_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')],'context':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x16')],'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')],'priority':_0x47a6ad['priority']++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});var _0x5b4175=_0x47a6ad['priority']++;_0x47a6ad[_0xadb1('0x11')][_0xadb1('0x13')]({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':_0xadb1('0x1e'),'appdata':_0xadb1('0x1f')+(_0x5b4175+0x2)+_0xadb1('0x20')+(_0x5b4175+0x1)+')','context':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x16')],'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')],'priority':_0x5b4175,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0]['VoiceExtensionId']});if(_0x47a6ad['extension']){_0x47a6ad[_0xadb1('0x11')][_0xadb1('0x13')]({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':_0xadb1('0x14'),'appdata':_0x47a6ad[_0xadb1('0x12')]['cutdigits']?_0xadb1('0x21')+_0x47a6ad[_0xadb1('0x12')][_0xadb1('0x22')]+'}':_0xadb1('0x23'),'context':_0x52ddeb[_0x5efc60][0x0]['context'],'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')],'priority':_0x47a6ad[_0xadb1('0x10')]++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});}_0x47a6ad['extensions']['push']({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':_0xadb1('0x14'),'appdata':_0xadb1('0x24')+_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')],'context':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x16')],'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')],'priority':_0x47a6ad[_0xadb1('0x10')]++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});if(_0x47a6ad[_0xadb1('0x12')]&&_0x47a6ad[_0xadb1('0x12')][_0xadb1('0xf')](_0xadb1('0x25'))&&_0x47a6ad[_0xadb1('0x12')][_0xadb1('0x25')]!==_0xadb1('0x26')){_0x47a6ad['extensions'][_0xadb1('0x13')]({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x16')],'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')],'priority':_0x47a6ad[_0xadb1('0x10')]++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0]['VoiceExtensionId']});_0x47a6ad[_0xadb1('0x11')][_0xadb1('0x13')]({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':_0xadb1('0x14'),'appdata':_0xadb1('0x27')+_0x47a6ad[_0xadb1('0x12')]['recordingFormat']||_0xadb1('0x28'),'context':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x16')],'exten':_0x52ddeb[_0x5efc60][0x0]['exten'],'priority':_0x47a6ad[_0xadb1('0x10')]++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});}}_0x47a6ad[_0xadb1('0x11')][_0xadb1('0x13')]({'type':_0x52ddeb[_0x5efc60][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x52ddeb[_0x5efc60][0x0]['context'],'exten':_0x52ddeb[_0x5efc60][0x0]['exten'],'priority':_0x47a6ad[_0xadb1('0x10')]++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});_0x47a6ad[_0xadb1('0x11')]['push']({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':_0xadb1('0x14'),'appdata':_0xadb1('0x29'),'context':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x16')],'exten':_0x52ddeb[_0x5efc60][0x0]['exten'],'priority':_0x47a6ad['priority']++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});_0x47a6ad[_0xadb1('0x11')][_0xadb1('0x13')]({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':'Set','appdata':_0xadb1('0x2a'),'context':_0x52ddeb[_0x5efc60][0x0]['context'],'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')],'priority':_0x47a6ad[_0xadb1('0x10')]++,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});for(var _0x4c99bf=0x0,_0x40c666=0x0;_0x4c99bf<_0x52ddeb[_0x5efc60][_0xadb1('0x2b')];_0x4c99bf+=0x1,_0x40c666=0x0){var _0x22ad94=_0x52ddeb[_0x5efc60][_0x4c99bf];if(_0x22ad94[_0xadb1('0x18')]){_0x22ad94['type']=_0x22ad94[_0xadb1('0x18')][_0xadb1('0x2c')]();}var _0x395b0e=[];var _0x50c34c=[];delete _0x22ad94['id'];delete _0x22ad94['createdAt'];delete _0x22ad94[_0xadb1('0x2d')];var _0x4bcd4a=_0x22ad94[_0xadb1('0x2e')]!=='*,*,*,*'?[_0x22ad94[_0xadb1('0x2e')]]:_0x22ad94['IntervalId']?_[_0xadb1('0x8')](_[_0xadb1('0xb')](_0x47a6ad['intervals'],{'IntervalId':_0x22ad94['IntervalId']}),_0xadb1('0x2e')):[];if(_0x22ad94[_0xadb1('0xf')](_0xadb1('0x2f'))){if(_0x22ad94['tag']&&_0x22ad94[_0xadb1('0x2f')]!=='--'){_0x395b0e[_0xadb1('0x13')]({'type':_0x22ad94[_0xadb1('0x18')],'app':_0xadb1('0x14'),'appdata':_0xadb1('0x30')+_0x22ad94[_0xadb1('0x2f')],'context':_0x22ad94[_0xadb1('0x16')],'exten':_0x22ad94[_0xadb1('0x9')],'priority':_0x4bcd4a['length']+_0x47a6ad['priority']+_0x40c666++,'VoiceExtensionId':_0x22ad94[_0xadb1('0x17')]});}}if(_0x22ad94[_0xadb1('0x18')]===_0xadb1('0x19')&&_0x22ad94[_0xadb1('0xf')]('callerID')){if(_0x22ad94[_0xadb1('0x31')]){_0x395b0e['push']({'type':_0x22ad94[_0xadb1('0x18')],'app':_0xadb1('0x1e'),'appdata':_0xadb1('0x32')+_0x22ad94[_0xadb1('0x31')]+')','context':_0x22ad94[_0xadb1('0x16')],'exten':_0x22ad94[_0xadb1('0x9')],'priority':_0x4bcd4a['length']+_0x47a6ad['priority']+_0x40c666++,'VoiceExtensionId':_0x22ad94[_0xadb1('0x17')]});}else{_0x395b0e['push']({'type':_0x22ad94['type'],'app':_0xadb1('0x1e'),'appdata':_0xadb1('0x33'),'context':_0x22ad94[_0xadb1('0x16')],'exten':_0x22ad94[_0xadb1('0x9')],'priority':_0x4bcd4a[_0xadb1('0x2b')]+_0x47a6ad[_0xadb1('0x10')]+_0x40c666++,'VoiceExtensionId':_0x22ad94[_0xadb1('0x17')]});}}if(_0x22ad94[_0xadb1('0xf')]('answer')){if(_0x9645d3[_0xadb1('0x34')](_0x22ad94[_0xadb1('0x35')][_0xadb1('0x2c')]())>=0x0&&_0x22ad94[_0xadb1('0x36')]!==_0xadb1('0x37')){if(_0x22ad94[_0xadb1('0x38')]){_0x395b0e[_0xadb1('0x13')]({'type':_0x22ad94[_0xadb1('0x18')],'app':_0xadb1('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x22ad94['context'],'exten':_0x22ad94[_0xadb1('0x9')],'priority':_0x4bcd4a[_0xadb1('0x2b')]+_0x47a6ad['priority']+_0x40c666++,'VoiceExtensionId':_0x22ad94[_0xadb1('0x17')]});_0x395b0e[_0xadb1('0x13')]({'type':_0x22ad94[_0xadb1('0x18')],'app':_0xadb1('0x14'),'appdata':_0xadb1('0x39'),'context':_0x22ad94[_0xadb1('0x16')],'exten':_0x22ad94[_0xadb1('0x9')],'priority':_0x4bcd4a[_0xadb1('0x2b')]+_0x47a6ad[_0xadb1('0x10')]+_0x40c666++,'VoiceExtensionId':_0x22ad94[_0xadb1('0x17')]});}else{_0x395b0e[_0xadb1('0x13')]({'type':_0x22ad94[_0xadb1('0x18')],'app':_0xadb1('0x1e'),'appdata':_0xadb1('0x3a'),'context':_0x22ad94['context'],'exten':_0x22ad94[_0xadb1('0x9')],'priority':_0x4bcd4a[_0xadb1('0x2b')]+_0x47a6ad[_0xadb1('0x10')]+_0x40c666++,'VoiceExtensionId':_0x22ad94[_0xadb1('0x17')]});_0x395b0e[_0xadb1('0x13')]({'type':_0x22ad94[_0xadb1('0x18')],'app':_0xadb1('0x14'),'appdata':_0xadb1('0x3b'),'context':_0x22ad94[_0xadb1('0x16')],'exten':_0x22ad94[_0xadb1('0x9')],'priority':_0x4bcd4a[_0xadb1('0x2b')]+_0x47a6ad['priority']+_0x40c666++,'VoiceExtensionId':_0x22ad94[_0xadb1('0x17')]});}}}for(var _0x5ef8d5=0x0;_0x5ef8d5<_0x4bcd4a[_0xadb1('0x2b')];_0x5ef8d5+=0x1){var _0x433ffa=_0x47a6ad[_0xadb1('0x10')]+_0x4bcd4a[_0xadb1('0x2b')];var _0x3bbc19=_0x5ef8d5===_0x4bcd4a[_0xadb1('0x2b')]-0x1?_0x47a6ad[_0xadb1('0x10')]+_0x395b0e[_0xadb1('0x2b')]+_0x50c34c[_0xadb1('0x2b')]+0x2:_0x47a6ad[_0xadb1('0x10')]+_0x5ef8d5+0x1;_0x395b0e[_0xadb1('0x3c')](_0x5ef8d5,0x0,{'type':_0x22ad94['type'],'app':_0xadb1('0x3d'),'appdata':_0x4bcd4a[_0x5ef8d5]+'?'+_0x22ad94['context']+_0xadb1('0x3e')+_0x433ffa+':'+_0x22ad94[_0xadb1('0x16')]+_0xadb1('0x3e')+_0x3bbc19,'exten':_0x22ad94[_0xadb1('0x9')],'context':_0x22ad94[_0xadb1('0x16')],'priority':_0x47a6ad[_0xadb1('0x10')]+_0x5ef8d5,'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0]['VoiceExtensionId']});}_0x22ad94['priority']=_0x395b0e[_0xadb1('0x2b')]?_[_0xadb1('0x3f')](_0x395b0e)['priority']+0x1:_0x47a6ad[_0xadb1('0x10')];_0x47a6ad['priority']=(_0x50c34c['length']?_[_0xadb1('0x3f')](_0x50c34c)[_0xadb1('0x10')]:_0x22ad94[_0xadb1('0x10')])+0x1;_0x47a6ad[_0xadb1('0x11')]=_[_0xadb1('0x40')](_0x47a6ad[_0xadb1('0x11')],_0x395b0e,[_0x22ad94],_0x50c34c);}_0x47a6ad[_0xadb1('0x11')]['push']({'type':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x18')],'app':_0xadb1('0x41'),'exten':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x9')],'context':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x16')],'priority':_0x47a6ad['priority'],'VoiceExtensionId':_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]});_0x36b63e[_0xadb1('0x13')](_0x52ddeb[_0x5efc60][0x0][_0xadb1('0x17')]);_0x353fd3=_['concat'](_0x353fd3,_0x47a6ad[_0xadb1('0x11')]);}}return _0x2cca3d[_0xadb1('0x42')](function(_0xda21e){return _0x2cca3d['models'][_0xadb1('0x5')][_0xadb1('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x36b63e}},'transaction':_0xda21e})['then'](function(_0x501d81){return _0x2cca3d[_0xadb1('0x1')][_0xadb1('0x5')]['bulkCreate'](_[_0xadb1('0x44')](_0x353fd3,_0xadb1('0x10')),{'transaction':_0xda21e});});});})[_0xadb1('0x45')](function(_0x50d40e){console[_0xadb1('0x46')](_0x50d40e);});}exports[_0xadb1('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index bde4b59..f2d5db5 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 _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x253d02,_0x492642){var _0x243f21=function(_0x1bf84d){while(--_0x1bf84d){_0x253d02['push'](_0x253d02['shift']());}};_0x243f21(++_0x492642);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xcb91[_0x593564];return _0x211a89;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);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(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){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))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file +var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0xeaea0d,_0x4df422){var _0x5c4db2=function(_0x5ebda2){while(--_0x5ebda2){_0xeaea0d['push'](_0xeaea0d['shift']());}};_0x5c4db2(++_0x4df422);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);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(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){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))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index db6d22b..f36f515 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 _0x5b00=['DROP\x20TABLE\x20','voice_queues_has_cm_lists','VoiceQueueId','voice_queues','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','contact:import:','unlink','complete','argv','file\x20doesn\x27t\x20exists','parse','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','path','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','phone','join','.id\x20=\x20','\x20=\x20','where','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','UserId','select','fields','from','cm_contacts','.CmListId','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.ListId','updatedAt','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','keys','deletedAt\x20IS\x20NULL','id\x20IN\x20?','field','min_id','message','exit','errors','code','info','sequelize','spread','push','catch','error','stringify','start','binding','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','data','length','rows','trim','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','step','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','duplicates'];(function(_0x3f477c,_0x52b7ff){var _0x4c36b3=function(_0x3b47bb){while(--_0x3b47bb){_0x3f477c['push'](_0x3f477c['shift']());}};_0x4c36b3(++_0x52b7ff);}(_0x5b00,0x110));var _0x05b0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5b00[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require(_0x05b0('0x0'));var _=require('lodash');var Papa=require('papaparse');var util=require(_0x05b0('0x1'));var BPromise=require(_0x05b0('0x2'));var moment=require(_0x05b0('0x3'));var squel=require(_0x05b0('0x4'));var Redis=require('ioredis');var db=require(_0x05b0('0x5'))['db'];var config=require(_0x05b0('0x6'));var logger=require('../../../config/logger')(_0x05b0('0x7'));config[_0x05b0('0x8')]=_['defaults'](config[_0x05b0('0x8')],{'host':_0x05b0('0x9'),'port':0x18eb});var socket=require(_0x05b0('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x05b0('0xb')](_0x05b0('0xc'));function isEmail(_0x570d51){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))*$/[_0x05b0('0xd')](_0x570d51);}function selectNotIn(_0x57f01c,_0x2ab642,_0x50b06b,_0x256e1a,_0x44372d){return squel['select']()['field'](_0x05b0('0xe'))['from'](_0x256e1a)[_0x05b0('0xf')](_0x2ab642,null,_0x2ab642+_0x05b0('0x10')+_0x256e1a+'.'+_0x50b06b)['where'](_0x256e1a+'.'+_0x50b06b+_0x05b0('0x11')+_0x57f01c+'.'+_0x50b06b)[_0x05b0('0x12')](_0x2ab642+'.dialCheckDuplicateType\x20IN\x20('+_0x44372d['join']()+')');}function insertCmHopper(_0x2918bd,_0x5f2cc7,_0x3fb6a2,_0x238f38,_0x20d8c4){var _0x464948=[_0x05b0('0x13'),_0x05b0('0x14'),'cm_contacts.id','cm_contacts.ListId',_0x5f2cc7+'.'+_0x238f38,_0x05b0('0x15'),_0x05b0('0x16'),_0x05b0('0x17'),_0x05b0('0x18'),'\x22'+_0x20d8c4+'\x22'];return squel[_0x05b0('0x19')]()[_0x05b0('0x1a')](_0x05b0('0x1b'))[_0x05b0('0x1c')]([_0x05b0('0xe'),'scheduledat',_0x05b0('0x1d'),_0x05b0('0x1e'),_0x238f38,_0x05b0('0x1f'),'updatedAt','priority',_0x05b0('0x20'),'recallme'],squel[_0x05b0('0x21')]()[_0x05b0('0x22')](_0x464948)[_0x05b0('0x23')](_0x5f2cc7)[_0x05b0('0xf')](_0x05b0('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x5f2cc7+_0x05b0('0x25'))[_0x05b0('0xf')](_0x3fb6a2,null,_0x3fb6a2+_0x05b0('0x10')+_0x5f2cc7+'.'+_0x238f38)[_0x05b0('0x12')](_0x5f2cc7+_0x05b0('0x26'),_0x2918bd)[_0x05b0('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x05b0('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5f2cc7,_0x3fb6a2,_0x238f38,_0x05b0('0x1b'),[_0x05b0('0x27'),_0x05b0('0x28')]))[_0x05b0('0x12')](_0x05b0('0x29'),selectNotIn(_0x5f2cc7,_0x3fb6a2,_0x238f38,_0x05b0('0x1b'),[_0x05b0('0x27')])))[_0x05b0('0x2a')]();}function insertCmHopperBlack(_0x17f146,_0x4ae21f,_0x373d50,_0x492a73){var _0x5b17a2=[_0x05b0('0x13'),'cm_contacts.id',_0x05b0('0x2b'),_0x4ae21f+'.'+_0x492a73,_0x05b0('0x15'),_0x05b0('0x16')];return squel[_0x05b0('0x19')]()[_0x05b0('0x1a')]('cm_hopper_black')[_0x05b0('0x1c')]([_0x05b0('0xe'),'ContactId',_0x05b0('0x1e'),_0x492a73,_0x05b0('0x1f'),_0x05b0('0x2c')],squel[_0x05b0('0x21')]()[_0x05b0('0x22')](_0x5b17a2)[_0x05b0('0x23')](_0x4ae21f)[_0x05b0('0xf')]('cm_contacts',null,_0x05b0('0x2d')+_0x4ae21f+_0x05b0('0x25'))['join'](_0x373d50,null,_0x373d50+_0x05b0('0x10')+_0x4ae21f+'.'+_0x492a73)[_0x05b0('0x12')](_0x4ae21f+_0x05b0('0x26'),_0x17f146)['where'](_0x05b0('0x2e'),NOW)[_0x05b0('0x12')](_0x05b0('0x29'),squel[_0x05b0('0x21')]()['field']('phone')[_0x05b0('0x23')](_0x05b0('0x2f'))[_0x05b0('0x12')](_0x05b0('0x30'),_0x17f146)[_0x05b0('0x12')](_0x492a73+_0x05b0('0x31'),_0x4ae21f+'.'+_0x492a73)))['toString']();}function insertCmContact(_0x440f03,_0x419941,_0x805bb8,_0x3859b0){var _0x59470e=_['concat'](_[_0x05b0('0x32')](_0x3859b0),[_0x05b0('0x1e'),'CompanyId','createdAt',_0x05b0('0x2c')]);return squel[_0x05b0('0x19')]()[_0x05b0('0x1a')](_0x05b0('0x24'))['fromQuery'](_0x59470e,squel[_0x05b0('0x21')]()[_0x05b0('0x22')](_0x59470e)[_0x05b0('0x23')](_0x419941)['where']('('+_0x805bb8[_0x05b0('0xf')](',')+')\x20NOT\x20IN\x20?',squel[_0x05b0('0x21')]()['fields'](_0x805bb8)[_0x05b0('0x23')](_0x05b0('0x24'))['where'](_0x05b0('0x30'),_0x440f03)[_0x05b0('0x12')](_0x05b0('0x33')))['where'](_0x05b0('0x34'),squel[_0x05b0('0x21')]()[_0x05b0('0x35')]('MIN(id)',_0x05b0('0x36'))[_0x05b0('0x23')](_0x419941)['group'](_0x805bb8['join'](','))))[_0x05b0('0x2a')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5f512f){logger['error'](_0x5f512f[_0x05b0('0x37')]);process[_0x05b0('0x38')](0x1);}function handleError(_0x58f3bd,_0x444fd7){stats[_0x05b0('0x39')]['push']({'name':_0x444fd7[_0x05b0('0x3a')],'message':_0x444fd7['message'],'row':_0x58f3bd});}function handleQuery(_0x5d3900){logger[_0x05b0('0x3b')](_0x5d3900);return db[_0x05b0('0x3c')]['query'](_0x5d3900)[_0x05b0('0x3d')](function(_0x54bb2e){results[_0x05b0('0x3e')](_0x54bb2e);})[_0x05b0('0x3f')](function(_0x37c289){logger[_0x05b0('0x40')](_0x37c289[_0x05b0('0x37')]);});}function main(_0x260834,_0x3bb2b8,_0x396cfe,_0x2fdb98){logger[_0x05b0('0x3b')]('main',_0x260834,JSON[_0x05b0('0x41')](_0x3bb2b8));process['send'](_0x05b0('0x42'));var _0x180535=_0x3bb2b8[_0x05b0('0x43')];var _0x4b2495=_0x3bb2b8['socket_timestamp'];var _0x5720a2=path['join'](config[_0x05b0('0x44')],_0x05b0('0x45'),_0x4b2495+_0x05b0('0x46'));var _0x5ebd22=_[_0x05b0('0x32')](_0x180535)[_0x05b0('0xf')]();logger['info'](_0x05b0('0x47'),_0x5ebd22);fs[_0x05b0('0x48')](_0x5720a2,_0x5ebd22+'\x0a');Papa['parse'](fs[_0x05b0('0x49')](_0x260834),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2e2815,_0x377828){try{for(var _0xfdf510=0x0,_0x3ab9f4=[];_0xfdf510<_0x2e2815[_0x05b0('0x4a')][_0x05b0('0x4b')];_0xfdf510++){stats[_0x05b0('0x4c')]+=0x1;if(_0x2e2815['errors'][_0xfdf510]){handleError(_0x2e2815[_0x05b0('0x4a')][_0xfdf510],_0x2e2815[_0x05b0('0x39')][_0xfdf510]);}else{var _0x2581b3=[];for(var _0x35b31e in _0x180535){if(_0x180535['hasOwnProperty'](_0x35b31e)){if(_0x2e2815[_0x05b0('0x4a')][_0xfdf510][_0x180535[_0x35b31e]]){var _0x4d185c=_[_0x05b0('0x4d')](_0x2e2815['data'][_0xfdf510][_0x180535[_0x35b31e]]['replace'](/"/g,'\x27'));switch(_0x35b31e){case _0x05b0('0x4e'):var _0x1950b1=moment(_0x4d185c,_0x05b0('0xc'),!![]);if(_0x1950b1[_0x05b0('0x4f')]()){_0x3ab9f4[_0x05b0('0x3e')]('\x22'+_0x4d185c+'\x22');}else{_0x2581b3[_0x05b0('0x3e')](_0x05b0('0x50'));}break;case _0x05b0('0x51'):var _0x215bce=parseInt(_0x4d185c);_0x4d185c=_[_0x05b0('0x52')](_0x215bce)||_0x215bce<0x0||_0x215bce>0x4?_0x2fdb98?0x3:0x2:_0x215bce;_0x3ab9f4[_0x05b0('0x3e')]('\x22'+_0x4d185c+'\x22');break;case _0x05b0('0x20'):var _0x535c06=parseInt(_0x4d185c);if(_[_0x05b0('0x53')](_0x535c06)&&_['includes'](_0x396cfe,_0x535c06)){_0x3ab9f4['push']('\x22'+_0x535c06+'\x22');}else{_0x2581b3[_0x05b0('0x3e')]('agent\x20not\x20exists');}break;case _0x05b0('0x54'):if(isEmail(_0x4d185c)){_0x3ab9f4[_0x05b0('0x3e')]('\x22'+_0x4d185c+'\x22');}else{_0x2581b3['push'](_0x05b0('0x55'));}break;case'dateOfBirth':var _0x33535c=moment(_0x4d185c,'YYYY-MM-DD',!![]);if(_0x33535c[_0x05b0('0x4f')]()){_0x3ab9f4['push']('\x22'+_0x4d185c+'\x22');}else{_0x2581b3[_0x05b0('0x3e')](_0x05b0('0x56'));}break;default:_0x3ab9f4[_0x05b0('0x3e')]('\x22'+_0x4d185c+'\x22');}}else{switch(_0x35b31e){case _0x05b0('0x57'):case _0x05b0('0xe'):_0x2581b3[_0x05b0('0x3e')](_0x35b31e+'\x20not\x20specified');break;default:_0x3ab9f4[_0x05b0('0x3e')]('\x22\x22');}}}}if(_0x2581b3[_0x05b0('0x4b')]){handleError(_0x2e2815['data'][_0xfdf510],{'code':_0x05b0('0x58'),'message':_0x2581b3[_0x05b0('0xf')]()});}else{fs[_0x05b0('0x59')](_0x5720a2,_0x3ab9f4[_0x05b0('0xf')]()+'\x0a');}_0x3ab9f4=[];}if(!(stats[_0x05b0('0x4c')]%0xc8)){socket[_0x05b0('0x5a')]('contact:import:'+_0x4b2495,stats);stats['errors']=[];}}if(stopped){logger[_0x05b0('0x3b')](_0x05b0('0x5b'));_0x377828[_0x05b0('0x5c')]();}}catch(_0x548122){handleError(_0x2e2815[_0x05b0('0x4a')][_0xfdf510],{'code':_0x05b0('0x5d'),'message':_0x548122[_0x05b0('0x37')]});logger[_0x05b0('0x40')](_0x05b0('0x5e'),_0x548122[_0x05b0('0x37')]);}},'complete':function(){try{var _0x53d371=[];var _0x4ee060='cm_contacts';if(_0x3bb2b8['duplicates']&&_0x3bb2b8['duplicates']['length']){_0x4ee060=_0x05b0('0x5f')+_0x4b2495;_0x53d371[_0x05b0('0x3e')](_0x05b0('0x60')+_0x4ee060+_0x05b0('0x61'));}var _0x3ced8e=util[_0x05b0('0xb')](_0x05b0('0x62'),_0x5720a2,_0x4ee060,_0x5ebd22,_0x3bb2b8['ListId'],_0x3bb2b8[_0x05b0('0x63')]||null,NOW,NOW);if(_[_0x05b0('0x64')](_0x180535[_0x05b0('0x4e')])){_0x3ced8e+=_0x05b0('0x65');}_0x53d371[_0x05b0('0x3e')](_0x3ced8e);if(_0x3bb2b8[_0x05b0('0x66')]&&_0x3bb2b8['duplicates'][_0x05b0('0x4b')]){_0x53d371[_0x05b0('0x3e')](insertCmContact(_0x3bb2b8['ListId'],_0x4ee060,_0x3bb2b8[_0x05b0('0x66')],_0x180535));_0x53d371[_0x05b0('0x3e')](_0x05b0('0x67')+_0x4ee060+';');}_0x53d371[_0x05b0('0x3e')](insertCmHopper(_0x3bb2b8[_0x05b0('0x1e')],_0x05b0('0x68'),'voice_queues',_0x05b0('0x69'),_0x2fdb98));_0x53d371[_0x05b0('0x3e')](insertCmHopperBlack(_0x3bb2b8[_0x05b0('0x1e')],'voice_queues_has_cm_blacklists',_0x05b0('0x6a'),_0x05b0('0x69')));_0x53d371['push'](insertCmHopper(_0x3bb2b8[_0x05b0('0x1e')],'campaigns_has_cm_lists',_0x05b0('0x6b'),_0x05b0('0x6c'),_0x2fdb98));_0x53d371['push'](insertCmHopperBlack(_0x3bb2b8['ListId'],_0x05b0('0x6d'),_0x05b0('0x6b'),'CampaignId'));BPromise['each'](_0x53d371,handleQuery)[_0x05b0('0x6e')](function(_0x165ccc){stats[_0x05b0('0x6f')]=!![];stats[_0x05b0('0x70')]=_0x3bb2b8['duplicates']&&_0x3bb2b8[_0x05b0('0x66')][_0x05b0('0x4b')]?results[0x2][_0x05b0('0x70')]:results[0x0][_0x05b0('0x70')];socket[_0x05b0('0x5a')](_0x05b0('0x71')+_0x4b2495,stats);fs[_0x05b0('0x72')](_0x260834);fs['unlink'](_0x5720a2);process[_0x05b0('0x38')](0x0);})['catch'](function(_0x3f07b0){logger[_0x05b0('0x40')](_0x3f07b0[_0x05b0('0x37')]);process['exit'](0x1);});}catch(_0x27cb36){logger['error'](_0x05b0('0x73'),_0x27cb36[_0x05b0('0x37')]);process[_0x05b0('0x38')](0x1);}},'error':function(_0x2ad36d,_0x2c5b75,_0x10d239,_0x48abbe){throw new Error(_0x48abbe);}});}function validate(){if(process[_0x05b0('0x74')]&&process[_0x05b0('0x74')][_0x05b0('0x4b')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x540612=path[_0x05b0('0xf')](config[_0x05b0('0x44')],'server/files/tmp',process[_0x05b0('0x74')][0x2]);if(!fs['existsSync'](_0x540612)){throw new Error(_0x05b0('0x75'));}var _0x3db90d={};try{_0x3db90d=JSON[_0x05b0('0x76')](process['argv'][0x3]);if(!_0x3db90d['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x3db90d[_0x05b0('0x43')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x3db90d[_0x05b0('0x43')][_0x05b0('0x57')]){throw new Error(_0x05b0('0x77'));}var _0x3957d1=0x0;if(_0x3db90d[_0x05b0('0x43')]['UserId']){_0x3957d1=0x1;}if(!_0x3db90d['ListId']){throw new Error(_0x05b0('0x78'));}}catch(_0x44d878){throw new Error(_0x05b0('0x79'));}var _0x558e19=[];try{_0x558e19=_['map'](JSON[_0x05b0('0x76')](process[_0x05b0('0x74')][0x4]),'id');}catch(_0x5c6bf0){logger['info'](_0x05b0('0x7a'));}main(_0x540612,_0x3db90d,_0x558e19,_0x3957d1);}validate();process['on'](_0x05b0('0x7b'),handleStop);process['on'](_0x05b0('0x7c'),handleUncaughtException); \ No newline at end of file +var _0xf336=['cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22always\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.createdAt','fromQuery','fields','.CmListId\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','concat','keys','ListId','into',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','group','Received\x20SIGINT','error','exit','code','info','query','spread','push','catch','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','writeFileSync','parse','data','rows','hasOwnProperty','trim','replace','isValid','priority','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','length','SystemRow','appendFileSync','emit','contact:import:','errors','Abort\x20parser','abort','SystemError','message','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CompanyId','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','socket.io-emitter','format','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone'];(function(_0x1e82eb,_0x4581ec){var _0xca5a1a=function(_0x3aa4cd){while(--_0x3aa4cd){_0x1e82eb['push'](_0x1e82eb['shift']());}};_0xca5a1a(++_0x4581ec);}(_0xf336,0xed));var _0x6f33=function(_0x476ea3,_0x40584e){_0x476ea3=_0x476ea3-0x0;var _0x29d202=_0xf336[_0x476ea3];return _0x29d202;};'use strict';var fs=require('fs');var path=require(_0x6f33('0x0'));var _=require(_0x6f33('0x1'));var Papa=require(_0x6f33('0x2'));var util=require(_0x6f33('0x3'));var BPromise=require(_0x6f33('0x4'));var moment=require(_0x6f33('0x5'));var squel=require(_0x6f33('0x6'));var Redis=require(_0x6f33('0x7'));var db=require(_0x6f33('0x8'))['db'];var config=require(_0x6f33('0x9'));var logger=require(_0x6f33('0xa'))('import');config['redis']=_['defaults'](config[_0x6f33('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f33('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x6f33('0xd')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x141484){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))*$/[_0x6f33('0xe')](_0x141484);}function selectNotIn(_0x2b2cc6,_0x47879e,_0x3d778e,_0x33ab87,_0x1b73e7){return squel[_0x6f33('0xf')]()[_0x6f33('0x10')](_0x6f33('0x11'))[_0x6f33('0x12')](_0x33ab87)[_0x6f33('0x13')](_0x47879e,null,_0x47879e+_0x6f33('0x14')+_0x33ab87+'.'+_0x3d778e)[_0x6f33('0x15')](_0x33ab87+'.'+_0x3d778e+_0x6f33('0x16')+_0x2b2cc6+'.'+_0x3d778e)[_0x6f33('0x15')](_0x47879e+_0x6f33('0x17')+_0x1b73e7['join']()+')');}function insertCmHopper(_0x5b06fe,_0x1a9aba,_0x47ffb3,_0x1ba320,_0x35b944){var _0x4cca6b=[_0x6f33('0x18'),_0x6f33('0x19'),_0x6f33('0x1a'),_0x6f33('0x1b'),_0x1a9aba+'.'+_0x1ba320,'cm_contacts.createdAt',_0x6f33('0x1c'),_0x6f33('0x1d'),_0x6f33('0x1e'),'\x22'+_0x35b944+'\x22'];return squel['insert']()['into'](_0x6f33('0x1f'))['fromQuery'](['phone',_0x6f33('0x20'),_0x6f33('0x21'),'ListId',_0x1ba320,_0x6f33('0x22'),_0x6f33('0x23'),'priority',_0x6f33('0x24'),'recallme'],squel[_0x6f33('0xf')]()['fields'](_0x4cca6b)[_0x6f33('0x12')](_0x1a9aba)[_0x6f33('0x13')](_0x6f33('0x25'),null,_0x6f33('0x26')+_0x1a9aba+_0x6f33('0x27'))['join'](_0x47ffb3,null,_0x47ffb3+'.id\x20=\x20'+_0x1a9aba+'.'+_0x1ba320)[_0x6f33('0x15')](_0x1a9aba+'.CmListId\x20=\x20?',_0x5b06fe)[_0x6f33('0x15')](_0x6f33('0x28'),NOW)[_0x6f33('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1a9aba,_0x47ffb3,_0x1ba320,'cm_hopper',[_0x6f33('0x29'),'\x22onlyIfOpen\x22']))[_0x6f33('0x15')](_0x6f33('0x2a'),selectNotIn(_0x1a9aba,_0x47ffb3,_0x1ba320,_0x6f33('0x1f'),[_0x6f33('0x29')])))['toString']();}function insertCmHopperBlack(_0x5b0ff4,_0x42f886,_0x21d25e,_0x4559e7){var _0x2ca138=[_0x6f33('0x18'),_0x6f33('0x1a'),_0x6f33('0x1b'),_0x42f886+'.'+_0x4559e7,_0x6f33('0x2b'),_0x6f33('0x1c')];return squel['insert']()['into']('cm_hopper_black')[_0x6f33('0x2c')](['phone',_0x6f33('0x21'),'ListId',_0x4559e7,_0x6f33('0x22'),_0x6f33('0x23')],squel[_0x6f33('0xf')]()[_0x6f33('0x2d')](_0x2ca138)[_0x6f33('0x12')](_0x42f886)[_0x6f33('0x13')](_0x6f33('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x42f886+_0x6f33('0x27'))[_0x6f33('0x13')](_0x21d25e,null,_0x21d25e+_0x6f33('0x14')+_0x42f886+'.'+_0x4559e7)['where'](_0x42f886+_0x6f33('0x2e'),_0x5b0ff4)['where'](_0x6f33('0x28'),NOW)[_0x6f33('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x6f33('0xf')]()[_0x6f33('0x10')](_0x6f33('0x11'))[_0x6f33('0x12')]('cm_hopper_black')['where'](_0x6f33('0x2f'),_0x5b0ff4)[_0x6f33('0x15')](_0x4559e7+_0x6f33('0x30'),_0x42f886+'.'+_0x4559e7)))[_0x6f33('0x31')]();}function insertCmContact(_0x47fe9f,_0x56c4fc,_0x3222c3,_0x559048){var _0x7ca01b=_[_0x6f33('0x32')](_[_0x6f33('0x33')](_0x559048),[_0x6f33('0x34'),'CompanyId','createdAt',_0x6f33('0x23')]);return squel['insert']()[_0x6f33('0x35')](_0x6f33('0x25'))[_0x6f33('0x2c')](_0x7ca01b,squel[_0x6f33('0xf')]()[_0x6f33('0x2d')](_0x7ca01b)[_0x6f33('0x12')](_0x56c4fc)[_0x6f33('0x15')]('('+_0x3222c3[_0x6f33('0x13')](',')+_0x6f33('0x36'),squel[_0x6f33('0xf')]()['fields'](_0x3222c3)[_0x6f33('0x12')](_0x6f33('0x25'))['where'](_0x6f33('0x2f'),_0x47fe9f)[_0x6f33('0x15')](_0x6f33('0x37')))['where']('id\x20IN\x20?',squel['select']()[_0x6f33('0x10')](_0x6f33('0x38'),'min_id')[_0x6f33('0x12')](_0x56c4fc)[_0x6f33('0x39')](_0x3222c3['join'](','))))['toString']();}function handleStop(){logger['info'](_0x6f33('0x3a'));stopped=!![];}function handleUncaughtException(_0x239164){logger[_0x6f33('0x3b')](_0x239164['message']);process[_0x6f33('0x3c')](0x1);}function handleError(_0x5eb15c,_0x252304){stats['errors']['push']({'name':_0x252304[_0x6f33('0x3d')],'message':_0x252304['message'],'row':_0x5eb15c});}function handleQuery(_0x464708){logger[_0x6f33('0x3e')](_0x464708);return db['sequelize'][_0x6f33('0x3f')](_0x464708)[_0x6f33('0x40')](function(_0x357034){results[_0x6f33('0x41')](_0x357034);})[_0x6f33('0x42')](function(_0x168131){logger[_0x6f33('0x3b')](_0x168131['message']);});}function main(_0x17d3bc,_0x3088c2,_0x4c4203,_0x442d9f){logger[_0x6f33('0x3e')](_0x6f33('0x43'),_0x17d3bc,JSON[_0x6f33('0x44')](_0x3088c2));process[_0x6f33('0x45')](_0x6f33('0x46'));var _0x254ac3=_0x3088c2[_0x6f33('0x47')];var _0xa07580=_0x3088c2[_0x6f33('0x48')];var _0x100310=path[_0x6f33('0x13')](config[_0x6f33('0x49')],_0x6f33('0x4a'),_0xa07580+_0x6f33('0x4b'));var _0x4d1939=_[_0x6f33('0x33')](_0x254ac3)[_0x6f33('0x13')]();logger[_0x6f33('0x3e')]('header',_0x4d1939);fs[_0x6f33('0x4c')](_0x100310,_0x4d1939+'\x0a');Papa[_0x6f33('0x4d')](fs['createReadStream'](_0x17d3bc),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4e3314,_0x35cc91){try{for(var _0x37b118=0x0,_0x346e04=[];_0x37b118<_0x4e3314[_0x6f33('0x4e')]['length'];_0x37b118++){stats[_0x6f33('0x4f')]+=0x1;if(_0x4e3314['errors'][_0x37b118]){handleError(_0x4e3314[_0x6f33('0x4e')][_0x37b118],_0x4e3314['errors'][_0x37b118]);}else{var _0x284cfe=[];for(var _0x4455a8 in _0x254ac3){if(_0x254ac3[_0x6f33('0x50')](_0x4455a8)){if(_0x4e3314['data'][_0x37b118][_0x254ac3[_0x4455a8]]){var _0x29a115=_[_0x6f33('0x51')](_0x4e3314['data'][_0x37b118][_0x254ac3[_0x4455a8]][_0x6f33('0x52')](/"/g,'\x27'));switch(_0x4455a8){case'scheduledat':var _0x537013=moment(_0x29a115,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x537013[_0x6f33('0x53')]()){_0x346e04[_0x6f33('0x41')]('\x22'+_0x29a115+'\x22');}else{_0x284cfe['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x6f33('0x54'):var _0x225c75=parseInt(_0x29a115);_0x29a115=_['isNaN'](_0x225c75)||_0x225c75<0x0||_0x225c75>0x4?_0x442d9f?0x3:0x2:_0x225c75;_0x346e04[_0x6f33('0x41')]('\x22'+_0x29a115+'\x22');break;case'UserId':var _0x755ee3=parseInt(_0x29a115);if(_[_0x6f33('0x55')](_0x755ee3)&&_[_0x6f33('0x56')](_0x4c4203,_0x755ee3)){_0x346e04[_0x6f33('0x41')]('\x22'+_0x755ee3+'\x22');}else{_0x284cfe[_0x6f33('0x41')](_0x6f33('0x57'));}break;case _0x6f33('0x58'):if(isEmail(_0x29a115)){_0x346e04['push']('\x22'+_0x29a115+'\x22');}else{_0x284cfe[_0x6f33('0x41')](_0x6f33('0x59'));}break;case'dateOfBirth':var _0xf9fdaf=moment(_0x29a115,'YYYY-MM-DD',!![]);if(_0xf9fdaf[_0x6f33('0x53')]()){_0x346e04[_0x6f33('0x41')]('\x22'+_0x29a115+'\x22');}else{_0x284cfe[_0x6f33('0x41')](_0x6f33('0x5a'));}break;default:_0x346e04['push']('\x22'+_0x29a115+'\x22');}}else{switch(_0x4455a8){case'firstName':case _0x6f33('0x11'):_0x284cfe['push'](_0x4455a8+_0x6f33('0x5b'));break;default:_0x346e04[_0x6f33('0x41')]('\x22\x22');}}}}if(_0x284cfe[_0x6f33('0x5c')]){handleError(_0x4e3314['data'][_0x37b118],{'code':_0x6f33('0x5d'),'message':_0x284cfe[_0x6f33('0x13')]()});}else{fs[_0x6f33('0x5e')](_0x100310,_0x346e04[_0x6f33('0x13')]()+'\x0a');}_0x346e04=[];}if(!(stats[_0x6f33('0x4f')]%0xc8)){socket[_0x6f33('0x5f')](_0x6f33('0x60')+_0xa07580,stats);stats[_0x6f33('0x61')]=[];}}if(stopped){logger[_0x6f33('0x3e')](_0x6f33('0x62'));_0x35cc91[_0x6f33('0x63')]();}}catch(_0x2c9a18){handleError(_0x4e3314[_0x6f33('0x4e')][_0x37b118],{'code':_0x6f33('0x64'),'message':_0x2c9a18[_0x6f33('0x65')]});logger[_0x6f33('0x3b')]('step',_0x2c9a18[_0x6f33('0x65')]);}},'complete':function(){try{var _0x46fcc9=[];var _0x19eb18=_0x6f33('0x25');if(_0x3088c2[_0x6f33('0x66')]&&_0x3088c2[_0x6f33('0x66')]['length']){_0x19eb18='cm_contacts_'+_0xa07580;_0x46fcc9[_0x6f33('0x41')](_0x6f33('0x67')+_0x19eb18+_0x6f33('0x68'));}var _0x2fdb15=util[_0x6f33('0xd')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x100310,_0x19eb18,_0x4d1939,_0x3088c2[_0x6f33('0x34')],_0x3088c2[_0x6f33('0x69')]||null,NOW,NOW);if(_[_0x6f33('0x6a')](_0x254ac3[_0x6f33('0x20')])){_0x2fdb15+=',\x20scheduledAt\x20=\x20NOW()';}_0x46fcc9[_0x6f33('0x41')](_0x2fdb15);if(_0x3088c2[_0x6f33('0x66')]&&_0x3088c2['duplicates'][_0x6f33('0x5c')]){_0x46fcc9['push'](insertCmContact(_0x3088c2['ListId'],_0x19eb18,_0x3088c2[_0x6f33('0x66')],_0x254ac3));_0x46fcc9[_0x6f33('0x41')](_0x6f33('0x6b')+_0x19eb18+';');}_0x46fcc9[_0x6f33('0x41')](insertCmHopper(_0x3088c2['ListId'],_0x6f33('0x6c'),'voice_queues','VoiceQueueId',_0x442d9f));_0x46fcc9[_0x6f33('0x41')](insertCmHopperBlack(_0x3088c2['ListId'],_0x6f33('0x6d'),_0x6f33('0x6e'),'VoiceQueueId'));_0x46fcc9[_0x6f33('0x41')](insertCmHopper(_0x3088c2[_0x6f33('0x34')],_0x6f33('0x6f'),_0x6f33('0x70'),_0x6f33('0x71'),_0x442d9f));_0x46fcc9['push'](insertCmHopperBlack(_0x3088c2[_0x6f33('0x34')],_0x6f33('0x72'),_0x6f33('0x70'),_0x6f33('0x71')));BPromise[_0x6f33('0x73')](_0x46fcc9,handleQuery)[_0x6f33('0x74')](function(_0x296404){stats['finish']=!![];stats[_0x6f33('0x75')]=_0x3088c2[_0x6f33('0x66')]&&_0x3088c2[_0x6f33('0x66')][_0x6f33('0x5c')]?results[0x2][_0x6f33('0x75')]:results[0x0]['affectedRows'];socket['emit'](_0x6f33('0x60')+_0xa07580,stats);fs[_0x6f33('0x76')](_0x17d3bc);fs['unlink'](_0x100310);process['exit'](0x0);})[_0x6f33('0x42')](function(_0x131523){logger['error'](_0x131523[_0x6f33('0x65')]);process[_0x6f33('0x3c')](0x1);});}catch(_0x21011f){logger[_0x6f33('0x3b')](_0x6f33('0x77'),_0x21011f[_0x6f33('0x65')]);process[_0x6f33('0x3c')](0x1);}},'error':function(_0x35f8bc,_0x264df2,_0x4d00f8,_0x56c400){throw new Error(_0x56c400);}});}function validate(){if(process['argv']&&process[_0x6f33('0x78')]['length']<0x4){throw new Error(_0x6f33('0x79'));}var _0x170970=path[_0x6f33('0x13')](config[_0x6f33('0x49')],_0x6f33('0x4a'),process['argv'][0x2]);if(!fs[_0x6f33('0x7a')](_0x170970)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x18bc54={};try{_0x18bc54=JSON[_0x6f33('0x4d')](process[_0x6f33('0x78')][0x3]);if(!_0x18bc54['binding']){throw new Error(_0x6f33('0x7b'));}if(!_0x18bc54[_0x6f33('0x47')][_0x6f33('0x11')]){throw new Error(_0x6f33('0x7c'));}if(!_0x18bc54[_0x6f33('0x47')][_0x6f33('0x7d')]){throw new Error(_0x6f33('0x7e'));}var _0x3b0867=0x0;if(_0x18bc54[_0x6f33('0x47')][_0x6f33('0x24')]){_0x3b0867=0x1;}if(!_0x18bc54[_0x6f33('0x34')]){throw new Error(_0x6f33('0x7f'));}}catch(_0x45f3c9){throw new Error(_0x6f33('0x80'));}var _0x1ac62e=[];try{_0x1ac62e=_[_0x6f33('0x81')](JSON['parse'](process[_0x6f33('0x78')][0x4]),'id');}catch(_0x109a0d){logger[_0x6f33('0x3e')]('No\x20agent\x20available');}main(_0x170970,_0x18bc54,_0x1ac62e,_0x3b0867);}validate();process['on'](_0x6f33('0x82'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 5f566bd..08b9906 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 _0xb8a0=['Caller\x20Name','calleridname','destexten','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','UniqueId','uniqueid','Date','starttime','answertime','Complete\x20Time','Duration','duration','billableseconds','[xCALLY\x20Ticket]','push','variable','queue','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','toLowerCase','voice','inbound','keyValue','Caller\x20Number'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x305a7d,_0x405e67){_0x305a7d=_0x305a7d-0x0;var _0x468d30=_0xb8a0[_0x305a7d];return _0x468d30;};'use strict';exports['getSubjects']=function(_0x598029,_0x33f5c5){var _0x20741a=[{'type':'string','content':_0x0b8a('0x0'),'variableName':null}];switch(_0x598029['toLowerCase']()){case'voice':switch(_0x33f5c5['toLowerCase']()){case'inbound':_0x20741a[_0x0b8a('0x1')]({'type':_0x0b8a('0x2'),'content':'','variableName':_0x0b8a('0x3')});_0x20741a[_0x0b8a('0x1')]({'type':_0x0b8a('0x2'),'content':'','variableName':_0x0b8a('0x4')});break;case _0x0b8a('0x5'):_0x20741a[_0x0b8a('0x1')]({'type':_0x0b8a('0x6'),'content':_0x0b8a('0x7'),'variableName':null});_0x20741a[_0x0b8a('0x1')]({'type':_0x0b8a('0x2'),'content':'','variableName':_0x0b8a('0x8')});break;}}return _0x20741a;};exports[_0x0b8a('0x9')]=function(_0x22d769,_0x39d8b8){var _0x1b48c5=[];switch(_0x22d769[_0x0b8a('0xa')]()){case _0x0b8a('0xb'):switch(_0x39d8b8[_0x0b8a('0xa')]()){case _0x0b8a('0xc'):_0x1b48c5=[{'type':_0x0b8a('0x6'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0xe'),'keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x4')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0xf'),'keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x10')},{'type':_0x0b8a('0xd'),'content':'','key':'Call\x20To','keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x11')},{'type':_0x0b8a('0xd'),'content':'','key':'Queue','keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x3')},{'type':_0x0b8a('0xd'),'content':'','key':'UniqueId','keyType':'variable','variableName':'uniqueid'},{'type':_0x0b8a('0xd'),'content':'','key':'Date','keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x12')},{'type':_0x0b8a('0x6'),'content':_0x0b8a('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x14'),'keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x15')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x16'),'keyType':_0x0b8a('0x2'),'variableName':'destcalleridnum'},{'type':_0x0b8a('0x6'),'content':_0x0b8a('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x0b8a('0x18'),'keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x12')},{'type':_0x0b8a('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0x0b8a('0x2'),'variableName':'agentconnectAt'},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x19'),'keyType':'variable','variableName':_0x0b8a('0x1a')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x1b'),'keyType':'variable','variableName':_0x0b8a('0x1c')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x1d'),'keyType':'variable','variableName':_0x0b8a('0x1e')}];break;case'outbound':_0x1b48c5=[{'type':_0x0b8a('0x6'),'content':_0x0b8a('0x1f'),'variableName':null},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x20'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x8')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x21'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x22')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x23'),'keyType':'variable','keyContent':'','variableName':_0x0b8a('0x24')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x25'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x26')},{'type':'string','content':_0x0b8a('0x17')},{'type':_0x0b8a('0xd'),'content':'','key':'Answer\x20Time','keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x27')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x28'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':'endtime'},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x29'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x2a')},{'type':_0x0b8a('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x2b')}];break;}}return _0x1b48c5;}; \ No newline at end of file +var _0x94d2=['[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','Call\x20To','destexten','Queue','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','UniqueId','starttime','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','string'];(function(_0x43ad06,_0x4782a7){var _0x863fea=function(_0x1d4a8d){while(--_0x1d4a8d){_0x43ad06['push'](_0x43ad06['shift']());}};_0x863fea(++_0x4782a7);}(_0x94d2,0x1cd));var _0x294d=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x94d2[_0x32b542];return _0x554d54;};'use strict';exports['getSubjects']=function(_0x4dff5d,_0x30eae3){var _0x47eb33=[{'type':_0x294d('0x0'),'content':_0x294d('0x1'),'variableName':null}];switch(_0x4dff5d[_0x294d('0x2')]()){case'voice':switch(_0x30eae3['toLowerCase']()){case _0x294d('0x3'):_0x47eb33[_0x294d('0x4')]({'type':_0x294d('0x5'),'content':'','variableName':_0x294d('0x6')});_0x47eb33[_0x294d('0x4')]({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x294d('0x7'):_0x47eb33[_0x294d('0x4')]({'type':_0x294d('0x0'),'content':_0x294d('0x8'),'variableName':null});_0x47eb33[_0x294d('0x4')]({'type':'variable','content':'','variableName':_0x294d('0x9')});break;}}return _0x47eb33;};exports[_0x294d('0xa')]=function(_0x53d5f5,_0x20af48){var _0x18fde9=[];switch(_0x53d5f5['toLowerCase']()){case'voice':switch(_0x20af48[_0x294d('0x2')]()){case _0x294d('0x3'):_0x18fde9=[{'type':_0x294d('0x0'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0xc'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0xd')},{'type':'keyValue','content':'','key':_0x294d('0xe'),'keyType':'variable','variableName':'calleridname'},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0xf'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x10')},{'type':'keyValue','content':'','key':_0x294d('0x11'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x294d('0x5'),'variableName':_0x294d('0x12')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x13'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x14')},{'type':_0x294d('0x0'),'content':_0x294d('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x294d('0x16'),'keyType':_0x294d('0x5'),'variableName':'destcalleridname'},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x17'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x9')},{'type':_0x294d('0x0'),'content':_0x294d('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x19'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x14')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x1a'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x1b')},{'type':_0x294d('0xb'),'content':'','key':'Agent\x20Complete','keyType':'variable','variableName':_0x294d('0x1c')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x1d'),'keyType':_0x294d('0x5'),'variableName':_0x294d('0x1e')},{'type':_0x294d('0xb'),'content':'','key':'Talk\x20Time','keyType':_0x294d('0x5'),'variableName':'talktime'}];break;case _0x294d('0x7'):_0x18fde9=[{'type':_0x294d('0x0'),'content':_0x294d('0x1f'),'variableName':null},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x20'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x9')},{'type':'keyValue','content':'','key':_0x294d('0x21'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x22')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x23'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x12')},{'type':_0x294d('0xb'),'content':'','key':'Date','keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x24')},{'type':_0x294d('0x0'),'content':_0x294d('0x18')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x25')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x26'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':_0x294d('0x27')},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x28'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':'duration'},{'type':_0x294d('0xb'),'content':'','key':_0x294d('0x29'),'keyType':_0x294d('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x18fde9;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 04be4e2..a9ce439 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 _0xa671=['then','info','catch','error','tracked','user','query','clone','body','omit','html','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','Interaction'];(function(_0x115b55,_0x1c34fe){var _0x16b84d=function(_0x12c071){while(--_0x12c071){_0x115b55['push'](_0x115b55['shift']());}};_0x16b84d(++_0x1c34fe);}(_0xa671,0x1a4));var _0x1a67=function(_0x5a1f78,_0x16c0f0){_0x5a1f78=_0x5a1f78-0x0;var _0x25366e=_0xa671[_0x5a1f78];return _0x25366e;};'use strict';var _=require('lodash');var db=require(_0x1a67('0x0'))['db'];var loggers={'openchannel':require(_0x1a67('0x1'))(_0x1a67('0x2')),'mail':require(_0x1a67('0x1'))('mail-interactions'),'fax':require('../../config/logger')(_0x1a67('0x3')),'sms':require('../../config/logger')(_0x1a67('0x4')),'chat':require(_0x1a67('0x1'))(_0x1a67('0x5')),'whatsapp':require(_0x1a67('0x1'))(_0x1a67('0x6'))};function getInteractionId(_0x5a5821,_0x3f6181,_0x87e7b2){if(_0x5a5821&&_0x5a5821[_[_0x1a67('0x7')](_0x87e7b2)+_0x1a67('0x8')]){return _0x5a5821[_[_0x1a67('0x7')](_0x87e7b2)+_0x1a67('0x8')];}else if(_0x5a5821&&_0x5a5821['id']){return _0x5a5821['id'];}else if(_0x3f6181&&_0x3f6181['id']){return _0x3f6181['id'];}else{return _0x1a67('0x9');}}function log(_0x26f8b6,_0xdf1e5d,_0x91ef8d,_0x431b07,_0x2e49c3,_0x3a4a1f){loggers[_0x2e49c3[_0x1a67('0xa')]()][_0x26f8b6]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3a4a1f[_0x1a67('0xb')](),_0xdf1e5d?_0xdf1e5d['id']:null,_0xdf1e5d?_0xdf1e5d[_0x1a67('0xc')]:null,_0xdf1e5d?_0xdf1e5d[_0x1a67('0xd')]:null,getInteractionId(_0x91ef8d,_0x431b07,_0x2e49c3),_0x91ef8d?JSON['stringify'](_0x91ef8d):'null');}function updateUser(_0x35ae66,_0x5b4365,_0x162640,_0x4b985a,_0x28c5d0){db[_['upperFirst'](_0x4b985a)+_0x1a67('0xe')]['findOne']({'where':{'id':getInteractionId(_0x5b4365,_0x162640,_0x4b985a)}})[_0x1a67('0xf')](function(_0x3fdcf1){if(_0x3fdcf1){return _0x3fdcf1['update']({'UserId':_0x35ae66?_0x35ae66['id']:null});}})['then'](function(_0x534a03){if(_0x534a03){log(_0x1a67('0x10'),_0x35ae66,_0x5b4365,_0x162640,_0x4b985a,_0x28c5d0);}})[_0x1a67('0x11')](function(){log(_0x1a67('0x12'),_0x35ae66,_0x5b4365,_0x162640,_0x4b985a,_0x28c5d0);});}exports[_0x1a67('0x13')]=function(_0x55d3d9,_0x233fea){return function(_0x58d74e,_0x5eaeec,_0x1f6c56){var _0x3f5aa7=_0x58d74e[_0x1a67('0x14')];var _0x5a031c={};var _0x5db62f=_0x58d74e[_0x1a67('0x15')];if(_0x5a031c){_0x5a031c=_[_0x1a67('0x16')](_0x58d74e[_0x1a67('0x17')]);_0x5a031c=_[_0x1a67('0x18')](_0x5a031c,[_0x1a67('0x17'),_0x1a67('0x19'),_0x1a67('0x1a'),_0x1a67('0x1b'),_0x1a67('0x1c')]);}updateUser(_0x3f5aa7,_0x5a031c,_0x5db62f,_0x55d3d9,_0x233fea);_0x1f6c56(null);};}; \ No newline at end of file +var _0x0bde=['openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','name','role','null','Interaction','findOne','then','info','catch','error','tracked','user','query','clone','body','html','phone','mobile','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bde,0xe7));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var db=require(_0xe0bd('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xe0bd('0x1')),'mail':require(_0xe0bd('0x2'))(_0xe0bd('0x3')),'fax':require(_0xe0bd('0x2'))(_0xe0bd('0x4')),'sms':require('../../config/logger')(_0xe0bd('0x5')),'chat':require(_0xe0bd('0x2'))(_0xe0bd('0x6')),'whatsapp':require(_0xe0bd('0x2'))(_0xe0bd('0x7'))};function getInteractionId(_0x26393f,_0x217145,_0x491dc7){if(_0x26393f&&_0x26393f[_[_0xe0bd('0x8')](_0x491dc7)+_0xe0bd('0x9')]){return _0x26393f[_[_0xe0bd('0x8')](_0x491dc7)+_0xe0bd('0x9')];}else if(_0x26393f&&_0x26393f['id']){return _0x26393f['id'];}else if(_0x217145&&_0x217145['id']){return _0x217145['id'];}else{return _0xe0bd('0xa');}}function log(_0x3c47c4,_0x475265,_0x58d892,_0x561b74,_0x595dac,_0x47f96d){loggers[_0x595dac[_0xe0bd('0xb')]()][_0x3c47c4]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47f96d['toUpperCase'](),_0x475265?_0x475265['id']:null,_0x475265?_0x475265[_0xe0bd('0xc')]:null,_0x475265?_0x475265[_0xe0bd('0xd')]:null,getInteractionId(_0x58d892,_0x561b74,_0x595dac),_0x58d892?JSON['stringify'](_0x58d892):_0xe0bd('0xe'));}function updateUser(_0x5272ca,_0x1bf268,_0x436535,_0x3b2fb1,_0x20ab47){db[_[_0xe0bd('0x8')](_0x3b2fb1)+_0xe0bd('0xf')][_0xe0bd('0x10')]({'where':{'id':getInteractionId(_0x1bf268,_0x436535,_0x3b2fb1)}})[_0xe0bd('0x11')](function(_0x4f63fa){if(_0x4f63fa){return _0x4f63fa['update']({'UserId':_0x5272ca?_0x5272ca['id']:null});}})['then'](function(_0x2ff887){if(_0x2ff887){log(_0xe0bd('0x12'),_0x5272ca,_0x1bf268,_0x436535,_0x3b2fb1,_0x20ab47);}})[_0xe0bd('0x13')](function(){log(_0xe0bd('0x14'),_0x5272ca,_0x1bf268,_0x436535,_0x3b2fb1,_0x20ab47);});}exports[_0xe0bd('0x15')]=function(_0x55f304,_0x4ebe7a){return function(_0x1becc8,_0x4ac920,_0x4f36f7){var _0x418d64=_0x1becc8[_0xe0bd('0x16')];var _0x20157b={};var _0x5f22e2=_0x1becc8[_0xe0bd('0x17')];if(_0x20157b){_0x20157b=_[_0xe0bd('0x18')](_0x1becc8[_0xe0bd('0x19')]);_0x20157b=_['omit'](_0x20157b,[_0xe0bd('0x19'),_0xe0bd('0x1a'),_0xe0bd('0x1b'),'fax',_0xe0bd('0x1c')]);}updateUser(_0x418d64,_0x20157b,_0x5f22e2,_0x55f304,_0x4ebe7a);_0x4f36f7(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index a177ca4..7aa032a 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 _0x1e16=['format','%s:%s:%s','base64','final','utf8','parse','use','License','then','status','json','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','data1','license','split','createDecipher','aes-256-ctr'];(function(_0x1c5224,_0x53396d){var _0x44b338=function(_0x4a623a){while(--_0x4a623a){_0x1c5224['push'](_0x1c5224['shift']());}};_0x44b338(++_0x53396d);}(_0x1e16,0x1d9));var _0x61e1=function(_0x19d350,_0x3c843f){_0x19d350=_0x19d350-0x0;var _0x3bfc8d=_0x1e16[_0x19d350];return _0x3bfc8d;};'use strict';var crypto=require(_0x61e1('0x0'));var util=require('util');var compose=require(_0x61e1('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x5d6620,_0x295270){if(_0x5d6620&&_0x295270){if(_0x295270[_0x61e1('0x2')]&&_0x295270['license']){var _0x51c2c8=_0x295270[_0x61e1('0x2')];var _0x3b2048=_0x295270[_0x61e1('0x3')];var _0x33d892=_0x51c2c8[_0x61e1('0x4')]('-')[0x4];var _0x10b8f1=_0x51c2c8[_0x61e1('0x4')]('-')[0x0];var _0x6edd39=crypto[_0x61e1('0x5')](_0x61e1('0x6'),util[_0x61e1('0x7')](_0x61e1('0x8'),_0x33d892,_0x51c2c8,_0x10b8f1));var _0x5b52a6=_0x6edd39['update'](_0x3b2048,_0x61e1('0x9'),'utf8');_0x5b52a6+=_0x6edd39[_0x61e1('0xa')](_0x61e1('0xb'));var _0x2c3dbd=JSON[_0x61e1('0xc')](_0x5b52a6);return _0x2c3dbd['hasOwnProperty'](_0x5d6620)?_0x2c3dbd[_0x5d6620]:null;}}return null;}function isLimit(_0x4d9219,_0x2930a0,_0x532e3c,_0x5deeff){var _0x1fa779=_0x2930a0;return compose()[_0x61e1('0xd')](function(_0x383478,_0x52c5f9,_0x5aa210){return db[_0x61e1('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})['then'](function(_0x466f4c){var _0x1b94c0=getValueFromLicense(_0x4d9219,_0x466f4c);return _0x1b94c0?_0x1b94c0:_0x1fa779;})[_0x61e1('0xf')](function(_0x17ad10){_0x1fa779=_0x17ad10;return _0x532e3c['count'](_0x5deeff);})[_0x61e1('0xf')](function(_0x114538){if(_0x114538>=_0x1fa779){return _0x52c5f9[_0x61e1('0x10')](0x193)[_0x61e1('0x11')]({'message':util[_0x61e1('0x7')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x4d9219)});}_0x5aa210();})[_0x61e1('0x12')](function(_0x496ae3){_0x5aa210(_0x496ae3);});});}function isUserLimit(){return isLimit(_0x61e1('0x13'),0x1,db[_0x61e1('0x14')],{'where':{'$or':[{'role':_0x61e1('0x15')},{'role':_0x61e1('0x16')}]}});}exports[_0x61e1('0x17')]=isUserLimit; \ No newline at end of file +var _0xf3db=['utf8','final','parse','hasOwnProperty','use','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update'];(function(_0x53b1f1,_0x4b3c7b){var _0x1230cc=function(_0x25d6f3){while(--_0x25d6f3){_0x53b1f1['push'](_0x53b1f1['shift']());}};_0x1230cc(++_0x4b3c7b);}(_0xf3db,0x152));var _0xbf3d=function(_0x913ee,_0x1dcbff){_0x913ee=_0x913ee-0x0;var _0x19fbd9=_0xf3db[_0x913ee];return _0x19fbd9;};'use strict';var crypto=require(_0xbf3d('0x0'));var util=require(_0xbf3d('0x1'));var compose=require(_0xbf3d('0x2'));var db=require(_0xbf3d('0x3'))['db'];var config=require(_0xbf3d('0x4'));function getValueFromLicense(_0x3ab387,_0x297ad0){if(_0x3ab387&&_0x297ad0){if(_0x297ad0['data1']&&_0x297ad0[_0xbf3d('0x5')]){var _0x2701ed=_0x297ad0[_0xbf3d('0x6')];var _0x140a03=_0x297ad0[_0xbf3d('0x5')];var _0x10f054=_0x2701ed[_0xbf3d('0x7')]('-')[0x4];var _0x4dd166=_0x2701ed[_0xbf3d('0x7')]('-')[0x0];var _0x5231ee=crypto[_0xbf3d('0x8')](_0xbf3d('0x9'),util[_0xbf3d('0xa')](_0xbf3d('0xb'),_0x10f054,_0x2701ed,_0x4dd166));var _0xe1e5df=_0x5231ee[_0xbf3d('0xc')](_0x140a03,'base64',_0xbf3d('0xd'));_0xe1e5df+=_0x5231ee[_0xbf3d('0xe')](_0xbf3d('0xd'));var _0x3d43e7=JSON[_0xbf3d('0xf')](_0xe1e5df);return _0x3d43e7[_0xbf3d('0x10')](_0x3ab387)?_0x3d43e7[_0x3ab387]:null;}}return null;}function isLimit(_0x548e93,_0x57170d,_0x5a5e38,_0x40c099){var _0x28da90=_0x57170d;return compose()[_0xbf3d('0x11')](function(_0x5dcb1f,_0x35d022,_0x55855f){return db[_0xbf3d('0x12')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xbf3d('0x13')](function(_0x41df55){var _0x4c2658=getValueFromLicense(_0x548e93,_0x41df55);return _0x4c2658?_0x4c2658:_0x28da90;})['then'](function(_0x5427fd){_0x28da90=_0x5427fd;return _0x5a5e38[_0xbf3d('0x14')](_0x40c099);})['then'](function(_0x1edd9e){if(_0x1edd9e>=_0x28da90){return _0x35d022[_0xbf3d('0x15')](0x193)[_0xbf3d('0x16')]({'message':util[_0xbf3d('0xa')](_0xbf3d('0x17'),_0x548e93)});}_0x55855f();})[_0xbf3d('0x18')](function(_0x26ac1f){_0x55855f(_0x26ac1f);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0xbf3d('0x19')}]}});}exports[_0xbf3d('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 27a985c..22de148 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 _0x6725=['$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','DATE','utcOffset','hours','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','split','length','slice','forEach','shift','match','filter','indexOf','push','buildExpression','operator','$between','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$substring','$startsWith','LIKE\x20?','<\x20?','$lte','<=\x20?'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0x6725,0x1a9));var _0x5672=function(_0x598111,_0x2d5bdd){_0x598111=_0x598111-0x0;var _0x36298f=_0x6725[_0x598111];return _0x36298f;};'use strict';var _=require('lodash');var moment=require(_0x5672('0x0'));exports[_0x5672('0x1')]=function(_0x24b9a5){var _0x1bd808={'conditions':[]};_0x1bd808[_0x5672('0x2')]=_[_0x5672('0x3')](_0x24b9a5,_0x5672('0x4'))?'or':_0x5672('0x5');var _0x283b5e=_0x24b9a5[_0x5672('0x6')]('[$and]','')[_0x5672('0x6')]('[$or]','')[_0x5672('0x7')]('||');for(var _0x2b1316=0x0;_0x2b1316<_0x283b5e[_0x5672('0x8')];_0x2b1316++){var _0x98e714=_0x283b5e[_0x2b1316][_0x5672('0x7')](':=');var _0xb316=_0x98e714[0x0];var _0x322c64=_0x98e714[_0x5672('0x9')](0x1);_0x322c64[_0x5672('0xa')](function(_0x3cb167){var _0x72efa6=_0x3cb167[_0x5672('0x7')]('[')[_0x5672('0xb')]();var _0x2fc22e=_0x3cb167[_0x5672('0xc')](/\[(.*?)\]/g);_0x2fc22e[_0x5672('0xa')](function(_0x36375b){var _0x2a1aab=_0x36375b[_0x5672('0x7')]('[')[_0x5672('0xd')](function(_0x3faa60){return _0x3faa60[_0x5672('0xe')](']')>-0x1;})['map'](function(_0x30818d){return _0x30818d[_0x5672('0x7')](']')[0x0];})[0x0];_0x1bd808['conditions'][_0x5672('0xf')]({'field':_0xb316,'operator':_0x72efa6,'value':_0x2a1aab});});});}return _0x1bd808;};exports[_0x5672('0x10')]=function(_0x1efb4d,_0x1e2a43,_0xc8c73e){var _0x3ce8af={};if(_0x1e2a43==='DATE'){if(_0xc8c73e[_0x5672('0x11')]==='$eq'){_0xc8c73e[_0x5672('0x11')]=_0x5672('0x12');_0xc8c73e[_0x5672('0x13')]+=','+_0xc8c73e['value'];}else if(_[_0x5672('0x14')]([_0x5672('0x15'),'$lte'],_0xc8c73e['operator'])){_0xc8c73e[_0x5672('0x13')]=moment(_0xc8c73e['value'])[_0x5672('0x16')](0x1,_0x5672('0x17'))[_0x5672('0x18')](_0x5672('0x19'));}}if(_0xc8c73e[_0x5672('0x1a')]){_0x1e2a43=_0xc8c73e['castTo'];_0x3ce8af[_0x5672('0x1b')]=_0x5672('0x1c')+_0x1efb4d+'.'+_0xc8c73e['field']+_0x5672('0x1d')+_0xc8c73e[_0x5672('0x1a')]+')\x20'+parseOperator(_0xc8c73e['operator']);}else{_0x3ce8af[_0x5672('0x1b')]=_0x1efb4d+'.'+_0xc8c73e[_0x5672('0x1e')]+'\x20'+parseOperator(_0xc8c73e[_0x5672('0x11')]);}if(_[_0x5672('0x14')]([_0x5672('0x1f'),_0x5672('0x20')],_0xc8c73e[_0x5672('0x11')]))_0x3ce8af[_0x5672('0x1b')]='('+_0x3ce8af[_0x5672('0x1b')]+'\x20OR\x20'+_0x1efb4d+'.'+_0xc8c73e[_0x5672('0x1e')]+_0x5672('0x21');_0x3ce8af[_0x5672('0x13')]=parseValue(_0x1e2a43,_0xc8c73e[_0x5672('0x11')],_0xc8c73e['value']);return _0x3ce8af;};function parseOperator(_0x264711){var _0x26c371;switch(_0x264711){case _0x5672('0x22'):_0x26c371=_0x5672('0x23');break;case _0x5672('0x20'):_0x26c371='NOT\x20IN\x20?';break;case'$eq':_0x26c371=_0x5672('0x24');break;case _0x5672('0x1f'):_0x26c371='<>\x20?';break;case _0x5672('0x25'):case _0x5672('0x26'):case'$endsWith':_0x26c371=_0x5672('0x27');break;case'$lt':_0x26c371=_0x5672('0x28');break;case'$gt':_0x26c371='>\x20?';break;case _0x5672('0x29'):_0x26c371=_0x5672('0x2a');break;case _0x5672('0x2b'):_0x26c371=_0x5672('0x2c');break;case _0x5672('0x12'):_0x26c371=_0x5672('0x2d');break;}return _0x26c371;}function parseValue(_0x58bc99,_0x520d31,_0x14ca23){var _0x476458={'start':undefined,'end':undefined};switch(_0x520d31){case _0x5672('0x22'):case _0x5672('0x20'):_0x476458['start']=_0x14ca23['split'](',');break;case _0x5672('0x25'):_0x476458[_0x5672('0x2e')]='%'+_0x14ca23+'%';break;case _0x5672('0x26'):_0x476458['start']=_0x14ca23+'%';break;case'$endsWith':_0x476458[_0x5672('0x2e')]='%'+_0x14ca23;break;case _0x5672('0x12'):var _0x1a68b3=_0x14ca23[_0x5672('0x7')](',');var _0x14ca23=_0x1a68b3['shift']();var _0x668341=_0x1a68b3[_0x5672('0x2f')]();if(_0x58bc99===_0x5672('0x30')){_0x14ca23=moment(_0x14ca23)[_0x5672('0x31')](0x0,!![])[_0x5672('0x18')]();_0x668341=moment(_0x668341)[_0x5672('0x31')](0x0,!![])[_0x5672('0x16')](0x17,_0x5672('0x32'))[_0x5672('0x16')](0x3b,'minutes')[_0x5672('0x16')](0x3b,_0x5672('0x33'))['format']();}_0x476458={'start':_0x14ca23,'end':_0x668341};break;default:_0x476458[_0x5672('0x2e')]=_0x14ca23;break;}return _0x476458;} \ No newline at end of file +var _0x023a=['utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','add','days','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','format'];(function(_0xdca19e,_0x211c0a){var _0x5e3bb8=function(_0x2b57c4){while(--_0x2b57c4){_0xdca19e['push'](_0xdca19e['shift']());}};_0x5e3bb8(++_0x211c0a);}(_0x023a,0x142));var _0xa023=function(_0x11a3a4,_0x297554){_0x11a3a4=_0x11a3a4-0x0;var _0x46ccee=_0x023a[_0x11a3a4];return _0x46ccee;};'use strict';var _=require(_0xa023('0x0'));var moment=require(_0xa023('0x1'));exports['parseSearch']=function(_0x4fc5c6){var _0x1c2208={'conditions':[]};_0x1c2208[_0xa023('0x2')]=_[_0xa023('0x3')](_0x4fc5c6,_0xa023('0x4'))?'or':_0xa023('0x5');var _0x3b6a2d=_0x4fc5c6[_0xa023('0x6')](_0xa023('0x7'),'')['replace']('[$or]','')[_0xa023('0x8')]('||');for(var _0x54be3d=0x0;_0x54be3d<_0x3b6a2d[_0xa023('0x9')];_0x54be3d++){var _0x4c51e8=_0x3b6a2d[_0x54be3d][_0xa023('0x8')](':=');var _0x252db0=_0x4c51e8[0x0];var _0x1a5183=_0x4c51e8['slice'](0x1);_0x1a5183['forEach'](function(_0x223d43){var _0x5006ff=_0x223d43['split']('[')['shift']();var _0x4f12c6=_0x223d43['match'](/\[(.*?)\]/g);_0x4f12c6['forEach'](function(_0x428751){var _0x5e38c1=_0x428751['split']('[')['filter'](function(_0x53b0c7){return _0x53b0c7[_0xa023('0xa')](']')>-0x1;})['map'](function(_0x40bf16){return _0x40bf16[_0xa023('0x8')](']')[0x0];})[0x0];_0x1c2208[_0xa023('0xb')][_0xa023('0xc')]({'field':_0x252db0,'operator':_0x5006ff,'value':_0x5e38c1});});});}return _0x1c2208;};exports[_0xa023('0xd')]=function(_0xf2f36,_0x3b876a,_0xcaf345){var _0x1ba14f={};if(_0x3b876a===_0xa023('0xe')){if(_0xcaf345[_0xa023('0xf')]===_0xa023('0x10')){_0xcaf345[_0xa023('0xf')]=_0xa023('0x11');_0xcaf345[_0xa023('0x12')]+=','+_0xcaf345[_0xa023('0x12')];}else if(_[_0xa023('0x13')](['$gt',_0xa023('0x14')],_0xcaf345[_0xa023('0xf')])){_0xcaf345[_0xa023('0x12')]=moment(_0xcaf345['value'])[_0xa023('0x15')](0x1,_0xa023('0x16'))['format'](_0xa023('0x17'));}}if(_0xcaf345[_0xa023('0x18')]){_0x3b876a=_0xcaf345[_0xa023('0x18')];_0x1ba14f[_0xa023('0x19')]=_0xa023('0x1a')+_0xf2f36+'.'+_0xcaf345['field']+'\x20AS\x20'+_0xcaf345['castTo']+')\x20'+parseOperator(_0xcaf345[_0xa023('0xf')]);}else{_0x1ba14f[_0xa023('0x19')]=_0xf2f36+'.'+_0xcaf345[_0xa023('0x1b')]+'\x20'+parseOperator(_0xcaf345['operator']);}if(_['includes']([_0xa023('0x1c'),_0xa023('0x1d')],_0xcaf345['operator']))_0x1ba14f[_0xa023('0x19')]='('+_0x1ba14f[_0xa023('0x19')]+_0xa023('0x1e')+_0xf2f36+'.'+_0xcaf345['field']+_0xa023('0x1f');_0x1ba14f[_0xa023('0x12')]=parseValue(_0x3b876a,_0xcaf345[_0xa023('0xf')],_0xcaf345['value']);return _0x1ba14f;};function parseOperator(_0x4ccfb5){var _0x46799d;switch(_0x4ccfb5){case _0xa023('0x20'):_0x46799d='IN\x20?';break;case _0xa023('0x1d'):_0x46799d=_0xa023('0x21');break;case'$eq':_0x46799d=_0xa023('0x22');break;case _0xa023('0x1c'):_0x46799d=_0xa023('0x23');break;case _0xa023('0x24'):case'$startsWith':case _0xa023('0x25'):_0x46799d=_0xa023('0x26');break;case _0xa023('0x27'):_0x46799d=_0xa023('0x28');break;case _0xa023('0x29'):_0x46799d='>\x20?';break;case _0xa023('0x14'):_0x46799d=_0xa023('0x2a');break;case'$gte':_0x46799d=_0xa023('0x2b');break;case'$between':_0x46799d=_0xa023('0x2c');break;}return _0x46799d;}function parseValue(_0x16b045,_0x454610,_0x340c79){var _0xc2cb19={'start':undefined,'end':undefined};switch(_0x454610){case _0xa023('0x20'):case _0xa023('0x1d'):_0xc2cb19[_0xa023('0x2d')]=_0x340c79[_0xa023('0x8')](',');break;case'$substring':_0xc2cb19[_0xa023('0x2d')]='%'+_0x340c79+'%';break;case'$startsWith':_0xc2cb19[_0xa023('0x2d')]=_0x340c79+'%';break;case _0xa023('0x25'):_0xc2cb19['start']='%'+_0x340c79;break;case _0xa023('0x11'):var _0x3f06bc=_0x340c79[_0xa023('0x8')](',');var _0x340c79=_0x3f06bc[_0xa023('0x2e')]();var _0x46f29b=_0x3f06bc[_0xa023('0x2f')]();if(_0x16b045===_0xa023('0xe')){_0x340c79=moment(_0x340c79)['utcOffset'](0x0,!![])[_0xa023('0x30')]();_0x46f29b=moment(_0x46f29b)[_0xa023('0x31')](0x0,!![])[_0xa023('0x15')](0x17,_0xa023('0x32'))[_0xa023('0x15')](0x3b,_0xa023('0x33'))['add'](0x3b,_0xa023('0x34'))['format']();}_0xc2cb19={'start':_0x340c79,'end':_0x46f29b};break;default:_0xc2cb19['start']=_0x340c79;break;}return _0xc2cb19;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 554483e..dc07db3 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 _0x6644=['isEmpty','isObject','isString','length','unset','hasOwnProperty','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','lodash','sequelize','moment','fields','split','filters','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','isArray','parse','limit','offset','sort','priority','cast','col','unsigned','substr','ASC','omit'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0x6644,0xd4));var _0x4664=function(_0x3a160e,_0xa9391){_0x3a160e=_0x3a160e-0x0;var _0x2c5a43=_0x6644[_0x3a160e];return _0x2c5a43;};'use strict';var _=require(_0x4664('0x0'));var sequelize=require(_0x4664('0x1'));var moment=require(_0x4664('0x2'));var LIMIT_VALUE=0xfa;exports[_0x4664('0x3')]=function(_0x4ff359){var _0x3ccde4=null;if(_0x4ff359){_0x3ccde4=_0x4ff359[_0x4664('0x4')](',');}return _0x3ccde4;};exports[_0x4664('0x5')]=function(_0x170beb,_0x215caf){var _0x26536c={};if(!_['isEmpty'](_0x170beb)){_[_0x4664('0x6')](_0x170beb,function(_0x30ff47,_0x155016){try{if(_0x215caf){var _0xf094f1=_[_0x4664('0x7')](_0x215caf,{'name':_0x155016})||{};if(_0xf094f1[_0x4664('0x8')]===_0x4664('0x9')&&_['isPlainObject'](_0x30ff47)){var _0x5617a4=JSON['parse'](_0x30ff47);var _0xd3e00a={'$gte':moment(moment(_0x5617a4[_0x4664('0xa')])[_0x4664('0xb')](_0x4664('0xc')))[_0x4664('0xd')]()[_0x4664('0xb')](),'$lte':moment(moment(_0x5617a4[_0x4664('0xe')])[_0x4664('0xb')](_0x4664('0xc')))['utc']()[_0x4664('0xf')](0x1,'s')[_0x4664('0xb')]()};_0x26536c[_0x155016]=_0xd3e00a;}else{_0x26536c[_0x155016]=_[_0x4664('0x10')](_0x30ff47)?_0x30ff47:JSON[_0x4664('0x11')](_0x30ff47);}}else{_0x26536c[_0x155016]=_[_0x4664('0x10')](_0x30ff47)?_0x30ff47:JSON[_0x4664('0x11')](_0x30ff47);}}catch(_0x32463a){_0x26536c[_0x155016]=_0x30ff47[_0x4664('0x4')](',');}});}return _0x26536c;};exports[_0x4664('0x12')]=function(_0x1c9628){_0x1c9628=parseInt(_0x1c9628,0xa);if(!_0x1c9628||_0x1c9628<0x0){_0x1c9628=LIMIT_VALUE;}return _0x1c9628;};exports[_0x4664('0x13')]=function(_0x21bb8f){_0x21bb8f=parseInt(_0x21bb8f,0xa);if(!_0x21bb8f||_0x21bb8f<0x0){_0x21bb8f=0x0;}return _0x21bb8f;};exports[_0x4664('0x14')]=function(_0x43c55){var _0x2fea13,_0x278ba1=null;if(_0x43c55){_0x2fea13=_0x43c55[_0x4664('0x4')](',');_0x278ba1=_['map'](_0x2fea13,function(_0x18dc6c){if(_0x18dc6c['indexOf']('-')===0x0){return[_0x18dc6c===_0x4664('0x15')?sequelize[_0x4664('0x16')](sequelize[_0x4664('0x17')]('priority'),_0x4664('0x18')):_0x18dc6c[_0x4664('0x19')](0x1),'DESC'];}else{return[_0x18dc6c===_0x4664('0x15')?sequelize[_0x4664('0x16')](sequelize[_0x4664('0x17')]('priority'),_0x4664('0x18')):_0x18dc6c,_0x4664('0x1a')];}});}return _0x278ba1;};exports[_0x4664('0x1b')]=function(_0xa56958,_0x242d65){if(_[_0x4664('0x1c')](_0xa56958)){return _0xa56958;}if(_[_0x4664('0x10')](_0xa56958)){for(var _0x3045cc=0x0;_0x3045cc<_0xa56958['length'];_0x3045cc+=0x1){_0xa56958[_0x3045cc]=this[_0x4664('0x1b')](_0xa56958[_0x3045cc],_0x242d65);}return _0xa56958;}if(!_[_0x4664('0x1d')](_0xa56958)){return _0xa56958;}if(_[_0x4664('0x1e')](_0x242d65)){_0x242d65=[_0x242d65];}if(!_[_0x4664('0x10')](_0x242d65)){return _0xa56958;}for(var _0x57fdd0=0x0;_0x57fdd0<_0x242d65[_0x4664('0x1f')];_0x57fdd0+=0x1){_[_0x4664('0x20')](_0xa56958,_0x242d65[_0x57fdd0]);}for(var _0x346ccb in _0xa56958){if(_0xa56958[_0x4664('0x21')](_0x346ccb)){_0xa56958[_0x346ccb]=this['omit'](_0xa56958[_0x346ccb],_0x242d65);}}return _0xa56958;};exports['isNumeric']=function(_0x205380){return _0x205380['match'](RegExp(_0x4664('0x22')))?!![]:![];};exports[_0x4664('0x23')]=function(_0x3ade73){return _0x3ade73['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x4664('0x24')]=function(_0x12ff5f){var _0x25f7ea=[];_0x12ff5f[_0x4664('0x4')](/[ ,]+/)[_0x4664('0x25')](function(_0x1710df){_0x1710df=_0x1710df[_0x4664('0x26')](/([^:]")"+/g,'$1');_0x1710df='+'+_0x1710df+'*';if(_0x1710df['includes']('@'))_0x1710df='\x22'+_0x1710df+'\x22';_0x25f7ea[_0x4664('0x27')](_0x1710df);});return _0x25f7ea['join']('\x20');}; \ No newline at end of file +var _0x8c40=['cast','col','unsigned','substr','DESC','ASC','omit','isArray','length','isObject','isString','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach','push','join','fields','filters','isEmpty','forOwn','find','type','parse','format','YYYY-MM-DD','utc','$lte','split','limit','offset','sort','map','indexOf','priority'];(function(_0x2d829d,_0x718ef3){var _0x489deb=function(_0xa5d3a){while(--_0xa5d3a){_0x2d829d['push'](_0x2d829d['shift']());}};_0x489deb(++_0x718ef3);}(_0x8c40,0x116));var _0x08c4=function(_0xe32d36,_0x3114e0){_0xe32d36=_0xe32d36-0x0;var _0x255a5f=_0x8c40[_0xe32d36];return _0x255a5f;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x08c4('0x0')]=function(_0x5140cd){var _0x745ce6=null;if(_0x5140cd){_0x745ce6=_0x5140cd['split'](',');}return _0x745ce6;};exports[_0x08c4('0x1')]=function(_0x5083d8,_0x276304){var _0x2519d0={};if(!_[_0x08c4('0x2')](_0x5083d8)){_[_0x08c4('0x3')](_0x5083d8,function(_0x47cc67,_0x20cdc3){try{if(_0x276304){var _0x5d6821=_[_0x08c4('0x4')](_0x276304,{'name':_0x20cdc3})||{};if(_0x5d6821[_0x08c4('0x5')]==='DATE'&&_['isPlainObject'](_0x47cc67)){var _0x242761=JSON[_0x08c4('0x6')](_0x47cc67);var _0x5b1097={'$gte':moment(moment(_0x242761['$gte'])[_0x08c4('0x7')](_0x08c4('0x8')))[_0x08c4('0x9')]()['format'](),'$lte':moment(moment(_0x242761[_0x08c4('0xa')])[_0x08c4('0x7')](_0x08c4('0x8')))['utc']()['subtract'](0x1,'s')['format']()};_0x2519d0[_0x20cdc3]=_0x5b1097;}else{_0x2519d0[_0x20cdc3]=_['isArray'](_0x47cc67)?_0x47cc67:JSON[_0x08c4('0x6')](_0x47cc67);}}else{_0x2519d0[_0x20cdc3]=_['isArray'](_0x47cc67)?_0x47cc67:JSON[_0x08c4('0x6')](_0x47cc67);}}catch(_0x194340){_0x2519d0[_0x20cdc3]=_0x47cc67[_0x08c4('0xb')](',');}});}return _0x2519d0;};exports[_0x08c4('0xc')]=function(_0x3e5dc2){_0x3e5dc2=parseInt(_0x3e5dc2,0xa);if(!_0x3e5dc2||_0x3e5dc2<0x0){_0x3e5dc2=LIMIT_VALUE;}return _0x3e5dc2;};exports[_0x08c4('0xd')]=function(_0x504118){_0x504118=parseInt(_0x504118,0xa);if(!_0x504118||_0x504118<0x0){_0x504118=0x0;}return _0x504118;};exports[_0x08c4('0xe')]=function(_0x2d68a3){var _0x4a0467,_0x398528=null;if(_0x2d68a3){_0x4a0467=_0x2d68a3[_0x08c4('0xb')](',');_0x398528=_[_0x08c4('0xf')](_0x4a0467,function(_0x246a8b){if(_0x246a8b[_0x08c4('0x10')]('-')===0x0){return[_0x246a8b===_0x08c4('0x11')?sequelize[_0x08c4('0x12')](sequelize[_0x08c4('0x13')]('priority'),_0x08c4('0x14')):_0x246a8b[_0x08c4('0x15')](0x1),_0x08c4('0x16')];}else{return[_0x246a8b==='priority'?sequelize[_0x08c4('0x12')](sequelize[_0x08c4('0x13')](_0x08c4('0x11')),_0x08c4('0x14')):_0x246a8b,_0x08c4('0x17')];}});}return _0x398528;};exports[_0x08c4('0x18')]=function(_0x1e412a,_0x338274){if(_[_0x08c4('0x2')](_0x1e412a)){return _0x1e412a;}if(_[_0x08c4('0x19')](_0x1e412a)){for(var _0x415b07=0x0;_0x415b07<_0x1e412a[_0x08c4('0x1a')];_0x415b07+=0x1){_0x1e412a[_0x415b07]=this['omit'](_0x1e412a[_0x415b07],_0x338274);}return _0x1e412a;}if(!_[_0x08c4('0x1b')](_0x1e412a)){return _0x1e412a;}if(_[_0x08c4('0x1c')](_0x338274)){_0x338274=[_0x338274];}if(!_[_0x08c4('0x19')](_0x338274)){return _0x1e412a;}for(var _0x1ea3ab=0x0;_0x1ea3ab<_0x338274[_0x08c4('0x1a')];_0x1ea3ab+=0x1){_['unset'](_0x1e412a,_0x338274[_0x1ea3ab]);}for(var _0x362e26 in _0x1e412a){if(_0x1e412a[_0x08c4('0x1d')](_0x362e26)){_0x1e412a[_0x362e26]=this[_0x08c4('0x18')](_0x1e412a[_0x362e26],_0x338274);}}return _0x1e412a;};exports['isNumeric']=function(_0x30403d){return _0x30403d['match'](RegExp(_0x08c4('0x1e')))?!![]:![];};exports[_0x08c4('0x1f')]=function(_0x1f2aa9){return _0x1f2aa9[_0x08c4('0x20')](/^\S+@\S+$/)?!![]:![];};exports[_0x08c4('0x21')]=function(_0x5aa174){var _0x4ebbec=[];_0x5aa174['split'](/[ ,]+/)[_0x08c4('0x22')](function(_0x2139f2){_0x2139f2=_0x2139f2['replace'](/([^:]")"+/g,'$1');_0x2139f2='+'+_0x2139f2+'*';if(_0x2139f2['includes']('@'))_0x2139f2='\x22'+_0x2139f2+'\x22';_0x4ebbec[_0x08c4('0x23')](_0x2139f2);});return _0x4ebbec[_0x08c4('0x24')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 0b37345..d04f5d4 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26ad=['renderFile','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','path','passport','cors','moment','./environment','../mysqldb','default','env','production','set','appPath','root','public','development','test','join','client','use','toISOString','split','static','views','/server/views','engine','html','ejs'];(function(_0x11b1c5,_0x5a3952){var _0x2cfe1f=function(_0x4225a7){while(--_0x4225a7){_0x11b1c5['push'](_0x11b1c5['shift']());}};_0x2cfe1f(++_0x5a3952);}(_0x26ad,0x16d));var _0xd26a=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0x26ad[_0x5538d5];return _0x323b1a;};'use strict';var express=require(_0xd26a('0x0'));var favicon=require(_0xd26a('0x1'));var bodyParser=require(_0xd26a('0x2'));var methodOverride=require(_0xd26a('0x3'));var cookieParser=require(_0xd26a('0x4'));var errorHandler=require('errorhandler');var path=require(_0xd26a('0x5'));var passport=require(_0xd26a('0x6'));var cors=require(_0xd26a('0x7'));var moment=require(_0xd26a('0x8'));var config=require(_0xd26a('0x9'));var db=require(_0xd26a('0xa'))['db'];exports[_0xd26a('0xb')]=function(_0x315a8a){var _0x55502c=_0x315a8a['get'](_0xd26a('0xc'));if(_0x55502c===_0xd26a('0xd')){_0x315a8a[_0xd26a('0xe')](_0xd26a('0xf'),path['join'](config[_0xd26a('0x10')],_0xd26a('0x11')));}if(_0x55502c===_0xd26a('0x12')||_0x55502c===_0xd26a('0x13')){_0x315a8a[_0xd26a('0xe')](_0xd26a('0xf'),path[_0xd26a('0x14')](config['root'],_0xd26a('0x15')));_0x315a8a[_0xd26a('0x16')](errorHandler());}_0x315a8a['set']('json\x20replacer',function(_0x30bcd8,_0x79323a){if(this[_0x30bcd8]instanceof Date){_0x79323a=this[_0x30bcd8][_0xd26a('0x17')]()[_0xd26a('0x18')]('.')[0x0]+'Z';}return _0x79323a;});_0x315a8a['use'](express[_0xd26a('0x19')](_0x315a8a['get'](_0xd26a('0xf'))));_0x315a8a['set'](_0xd26a('0x1a'),config['root']+_0xd26a('0x1b'));_0x315a8a[_0xd26a('0x1c')](_0xd26a('0x1d'),require(_0xd26a('0x1e'))[_0xd26a('0x1f')]);_0x315a8a['set']('view\x20engine',_0xd26a('0x1d'));_0x315a8a[_0xd26a('0x16')](bodyParser[_0xd26a('0x20')]({'limit':_0xd26a('0x21'),'extended':!![]}));_0x315a8a[_0xd26a('0x16')](bodyParser[_0xd26a('0x22')]({'limit':_0xd26a('0x21')}));_0x315a8a[_0xd26a('0x16')](cors());_0x315a8a[_0xd26a('0x16')](methodOverride());_0x315a8a[_0xd26a('0x16')](cookieParser());_0x315a8a[_0xd26a('0x16')](passport[_0xd26a('0x23')]());}; \ No newline at end of file +var _0x8d47=['views','/server/views','engine','html','ejs','renderFile','view\x20engine','50mb','initialize','express','serve-favicon','body-parser','passport','cors','default','get','set','appPath','join','test','root','client','use','json\x20replacer','toISOString','split','static'];(function(_0x2c34e9,_0x6da87f){var _0x5028b4=function(_0x1679a1){while(--_0x1679a1){_0x2c34e9['push'](_0x2c34e9['shift']());}};_0x5028b4(++_0x6da87f);}(_0x8d47,0x168));var _0x78d4=function(_0x576a15,_0xaaf955){_0x576a15=_0x576a15-0x0;var _0x117068=_0x8d47[_0x576a15];return _0x117068;};'use strict';var express=require(_0x78d4('0x0'));var favicon=require(_0x78d4('0x1'));var bodyParser=require(_0x78d4('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x78d4('0x3'));var cors=require(_0x78d4('0x4'));var moment=require('moment');var config=require('./environment');var db=require('../mysqldb')['db'];exports[_0x78d4('0x5')]=function(_0x489089){var _0x5dc141=_0x489089[_0x78d4('0x6')]('env');if(_0x5dc141==='production'){_0x489089[_0x78d4('0x7')](_0x78d4('0x8'),path[_0x78d4('0x9')](config['root'],'public'));}if(_0x5dc141==='development'||_0x5dc141===_0x78d4('0xa')){_0x489089['set'](_0x78d4('0x8'),path['join'](config[_0x78d4('0xb')],_0x78d4('0xc')));_0x489089[_0x78d4('0xd')](errorHandler());}_0x489089[_0x78d4('0x7')](_0x78d4('0xe'),function(_0xebb5db,_0x1aa019){if(this[_0xebb5db]instanceof Date){_0x1aa019=this[_0xebb5db][_0x78d4('0xf')]()[_0x78d4('0x10')]('.')[0x0]+'Z';}return _0x1aa019;});_0x489089[_0x78d4('0xd')](express[_0x78d4('0x11')](_0x489089[_0x78d4('0x6')](_0x78d4('0x8'))));_0x489089[_0x78d4('0x7')](_0x78d4('0x12'),config[_0x78d4('0xb')]+_0x78d4('0x13'));_0x489089[_0x78d4('0x14')](_0x78d4('0x15'),require(_0x78d4('0x16'))[_0x78d4('0x17')]);_0x489089['set'](_0x78d4('0x18'),_0x78d4('0x15'));_0x489089['use'](bodyParser['urlencoded']({'limit':_0x78d4('0x19'),'extended':!![]}));_0x489089[_0x78d4('0xd')](bodyParser['json']({'limit':_0x78d4('0x19')}));_0x489089['use'](cors());_0x489089[_0x78d4('0xd')](methodOverride());_0x489089[_0x78d4('0xd')](cookieParser());_0x489089[_0x78d4('0xd')](passport[_0x78d4('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 1c6206a..6b07e5c 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 _0xff2a=['networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','map','model','createHash','md5','digest','getUuid','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','update','hex','substring','crypto','bimedia-machine-uuid','execSync'];(function(_0x5876d2,_0x176e16){var _0x1762e6=function(_0x4c950b){while(--_0x4c950b){_0x5876d2['push'](_0x5876d2['shift']());}};_0x1762e6(++_0x176e16);}(_0xff2a,0x93));var _0xaff2=function(_0x378487,_0x1fdc2c){_0x378487=_0x378487-0x0;var _0x3bb63b=_0xff2a[_0x378487];return _0x3bb63b;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xaff2('0x0'));var machine=require(_0xaff2('0x1'));var exec=require('child_process')[_0xaff2('0x2')];function getInterfaces(){var _0x25db80=[];var _0x5bb7dd=os[_0xaff2('0x3')]();var _0x5c7c1c=_[_0xaff2('0x4')](_[_0xaff2('0x5')](_0x5bb7dd));for(var _0x5a704c=0x0;_0x5a704c<_0x5c7c1c[_0xaff2('0x6')];_0x5a704c++){var _0x8313e5=_0x5bb7dd[_0x5c7c1c[_0x5a704c]][_0xaff2('0x7')](function(_0x3498b7){return _0x3498b7[_0xaff2('0x8')]===_0xaff2('0x9')&&_0x3498b7[_0xaff2('0xa')]===![];});_0x25db80=_0x25db80[_0xaff2('0xb')](_0x8313e5);}return _0x25db80;}function getFirstInterface(){var _0x289563=_[_0xaff2('0xc')](getInterfaces());return{'macAddress':_0x289563&&_0x289563['mac']?_0x289563[_0xaff2('0xd')]:'00:00:00:00:00:00','ipAddress':_0x289563&&_0x289563['address']?_0x289563[_0xaff2('0xe')]:_0xaff2('0xf')};}exports[_0xaff2('0x10')]=getFirstInterface;function getCPUhash(){var _0x26de0d=_[_0xaff2('0x4')](os['cpus']()[_0xaff2('0x11')](function(_0x175f2c){return _0x175f2c[_0xaff2('0x12')];}))['join'](':');return crypto[_0xaff2('0x13')](_0xaff2('0x14'))['update'](_0x26de0d)[_0xaff2('0x15')]('hex');}exports[_0xaff2('0x16')]=function(){switch(os['platform']()){case'win32':return exec(_0xaff2('0x17'),{'encoding':'utf8'})[_0xaff2('0x18')]('\x0d\x0a','');default:var _0x19029b=getFirstInterface();var _0x3d4d8c=getCPUhash();var _0x155e64=_0x3d4d8c+'|'+os[_0xaff2('0x19')]()+'|'+_0x19029b['macAddress']+'|'+_0x19029b[_0xaff2('0x1a')];var _0x439803=crypto[_0xaff2('0x13')](_0xaff2('0x14'))[_0xaff2('0x1b')](_0x155e64)[_0xaff2('0x15')](_0xaff2('0x1c'));return _0x439803['substring'](0x0,0x8)+'-'+_0x439803[_0xaff2('0x1d')](0x8,0xc)+'-'+_0x439803['substring'](0xc,0x10)+'-'+_0x439803[_0xaff2('0x1d')](0x10,0x14)+'-'+_0x439803['substring'](0x14);}}; \ No newline at end of file +var _0xcea5=['crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','IPv4','internal','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','lodash'];(function(_0x57a50d,_0x2871f8){var _0x1b25b3=function(_0x45691e){while(--_0x45691e){_0x57a50d['push'](_0x57a50d['shift']());}};_0x1b25b3(++_0x2871f8);}(_0xcea5,0xed));var _0x5cea=function(_0x153faa,_0x75f2a){_0x153faa=_0x153faa-0x0;var _0x43c32a=_0xcea5[_0x153faa];return _0x43c32a;};'use strict';var _=require(_0x5cea('0x0'));var os=require('os');var crypto=require(_0x5cea('0x1'));var machine=require(_0x5cea('0x2'));var exec=require(_0x5cea('0x3'))[_0x5cea('0x4')];function getInterfaces(){var _0x52a9b8=[];var _0x20a2d9=os[_0x5cea('0x5')]();var _0x382c21=_[_0x5cea('0x6')](_['keys'](_0x20a2d9));for(var _0x59dfa4=0x0;_0x59dfa4<_0x382c21[_0x5cea('0x7')];_0x59dfa4++){var _0x599bc5=_0x20a2d9[_0x382c21[_0x59dfa4]]['filter'](function(_0x59f337){return _0x59f337['family']===_0x5cea('0x8')&&_0x59f337[_0x5cea('0x9')]===![];});_0x52a9b8=_0x52a9b8['concat'](_0x599bc5);}return _0x52a9b8;}function getFirstInterface(){var _0x429558=_['head'](getInterfaces());return{'macAddress':_0x429558&&_0x429558[_0x5cea('0xa')]?_0x429558[_0x5cea('0xa')]:_0x5cea('0xb'),'ipAddress':_0x429558&&_0x429558[_0x5cea('0xc')]?_0x429558[_0x5cea('0xc')]:_0x5cea('0xd')};}exports[_0x5cea('0xe')]=getFirstInterface;function getCPUhash(){var _0x9f846=_['orderBy'](os[_0x5cea('0xf')]()[_0x5cea('0x10')](function(_0x2ee323){return _0x2ee323[_0x5cea('0x11')];}))[_0x5cea('0x12')](':');return crypto[_0x5cea('0x13')](_0x5cea('0x14'))[_0x5cea('0x15')](_0x9f846)[_0x5cea('0x16')](_0x5cea('0x17'));}exports[_0x5cea('0x18')]=function(){switch(os[_0x5cea('0x19')]()){case _0x5cea('0x1a'):return exec(_0x5cea('0x1b'),{'encoding':_0x5cea('0x1c')})[_0x5cea('0x1d')]('\x0d\x0a','');default:var _0x1c9a30=getFirstInterface();var _0x209046=getCPUhash();var _0x44f9c0=_0x209046+'|'+os[_0x5cea('0x1e')]()+'|'+_0x1c9a30[_0x5cea('0x1f')]+'|'+_0x1c9a30[_0x5cea('0x20')];var _0x22bc4f=crypto[_0x5cea('0x13')](_0x5cea('0x14'))[_0x5cea('0x15')](_0x44f9c0)[_0x5cea('0x16')](_0x5cea('0x17'));return _0x22bc4f[_0x5cea('0x21')](0x0,0x8)+'-'+_0x22bc4f[_0x5cea('0x21')](0x8,0xc)+'-'+_0x22bc4f['substring'](0xc,0x10)+'-'+_0x22bc4f[_0x5cea('0x21')](0x10,0x14)+'-'+_0x22bc4f['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 96010d3..5caadc0 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 _0xf3d1=['Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','update','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','message','default','moment','request-promise','pkginfo','./hardware','../logger','license','../../api/jira/jira.controller','process','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','version','exports','GET','then','catch','||FIELD||VALUE||\x0a','findOne','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf3d1,0x1e3));var _0x1f3d=function(_0x328d36,_0x2a4efa){_0x328d36=_0x328d36-0x0;var _0x28c729=_0xf3d1[_0x328d36];return _0x28c729;};'use strict';var util=require('util');var moment=require(_0x1f3d('0x0'));var rp=require(_0x1f3d('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0x1f3d('0x2'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x1f3d('0x3'));var logger=require(_0x1f3d('0x4'))(_0x1f3d('0x5'));var jira=require(_0x1f3d('0x6'));const {config}=require(_0x1f3d('0x7'));var HOST=_0x1f3d('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x435c6d){return new BPromise(function(_0x2f0cf3,_0x226078){var _0x19e977=util[_0x1f3d('0x9')](_0x1f3d('0xa'),HOST,_0x435c6d,module['exports'][_0x1f3d('0xb')]);if(oldToken){_0x19e977=util[_0x1f3d('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x435c6d,module[_0x1f3d('0xc')]['version'],oldToken);}var _0x2b32c2={'uri':_0x19e977,'method':_0x1f3d('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2b32c2)[_0x1f3d('0xe')](function(_0x5a5cff){_0x2f0cf3(_0x5a5cff);})[_0x1f3d('0xf')](function(_0x894884){_0x226078(_0x894884);});});}function sendJiraAlert(_0x5249d5,_0x1f7204,_0x39a8f8){var _0x8b5dd9=_0x1f3d('0x10');return db['User'][_0x1f3d('0x11')]({'where':{'role':'admin'},'attributes':[_0x1f3d('0x12'),_0x1f3d('0x13')],'raw':!![]})[_0x1f3d('0xe')](function(_0x4b531e){ADMIN=_0x4b531e;_0x8b5dd9+=_0x1f3d('0x14')+_0x39a8f8+'|\x0a';_0x8b5dd9+=_0x1f3d('0x15')+_0x5249d5+'|\x0a';_0x8b5dd9+=_0x1f3d('0x16')+_0x1f7204+'|\x0a';_0x8b5dd9+=_0x1f3d('0x17')+ADMIN['fullname']+'|\x0a';_0x8b5dd9+=_0x1f3d('0x18')+ADMIN[_0x1f3d('0x13')]+'|\x0a';return _0x8b5dd9;})[_0x1f3d('0xe')](function(_0x3da8c1){var _0x54723a=hardware[_0x1f3d('0x19')]()[_0x1f3d('0x1a')];return jira[_0x1f3d('0x1b')]({'key':_0x1f3d('0x1c'),'summary':_0x1f3d('0x1d'),'description':_0x3da8c1,'issuetype':_0x1f3d('0x1e'),'oldToken':_0x5249d5,'newToken':_0x1f7204,'email':ADMIN[_0x1f3d('0x13')],'name':ADMIN[_0x1f3d('0x12')],'reason':GRAY_PERIOD_REASON,'ip':_0x54723a});});}function manageLicense(_0x55cc66,_0x511fbe){var _0x821c93=_0x511fbe[_0x1f3d('0x1f')]({'plain':!![]});httpRequest(_0x55cc66)[_0x1f3d('0xe')](function(_0x2cbb83){if(oldToken){oldToken=undefined;}if(_0x2cbb83['active']){if(!_0x821c93[_0x1f3d('0x5')]&&_0x821c93['license']!=_0x2cbb83[_0x1f3d('0x5')]||_0x821c93['license']&&_0x821c93[_0x1f3d('0x20')]){logger['info'](_0x1f3d('0x21'));}if(_0x821c93[_0x1f3d('0x5')]&&!_0x821c93[_0x1f3d('0x20')]&&_0x821c93[_0x1f3d('0x5')]!=_0x2cbb83[_0x1f3d('0x5')]){logger[_0x1f3d('0x22')](_0x1f3d('0x23'));}if(_0x821c93['license']&&!_0x821c93['data2']&&_0x821c93['license']==_0x2cbb83['license']){return _0x511fbe;}return _0x511fbe['update']({'data1':_0x55cc66,'data2':null,'license':_0x2cbb83['license']});}else{if(_0x2cbb83['license']||_0x821c93['license']){if(!_0x821c93['data2']){if(_0x821c93[_0x1f3d('0x24')]==_0x55cc66){GRAY_PERIOD_REASON=_0x1f3d('0x25');logger[_0x1f3d('0x22')](_0x1f3d('0x26'));}else{GRAY_PERIOD_REASON=_0x1f3d('0x27');oldToken=_0x821c93[_0x1f3d('0x24')];logger[_0x1f3d('0x22')](_0x1f3d('0x28'),_0x821c93[_0x1f3d('0x24')],_0x55cc66);}sendJiraAlert(_0x821c93[_0x1f3d('0x24')],_0x2cbb83[_0x1f3d('0x29')],GRAY_PERIOD_REASON);logger[_0x1f3d('0x22')](_0x1f3d('0x2a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x1f3d('0x9')](_0x1f3d('0x2b')));return _0x511fbe[_0x1f3d('0x2c')]({'data2':encryptor['encryptString'](moment()[_0x1f3d('0x9')](_0x1f3d('0x2b')))});}else{if(moment()[_0x1f3d('0x2d')](encryptor[_0x1f3d('0x2e')](_0x821c93[_0x1f3d('0x20')]),_0x1f3d('0x2f'))>DAYS){logger[_0x1f3d('0x22')](_0x1f3d('0x30'),moment()[_0x1f3d('0x9')](_0x1f3d('0x2b')));return _0x511fbe[_0x1f3d('0x2c')]({'data1':_0x55cc66,'data2':null,'license':null});}}}else{if(_0x821c93[_0x1f3d('0x24')]!=_0x55cc66){logger[_0x1f3d('0x22')](_0x1f3d('0x28'),_0x821c93[_0x1f3d('0x24')],_0x55cc66);return _0x511fbe[_0x1f3d('0x2c')]({'data1':_0x55cc66,'data2':null,'license':null});}}}return _0x511fbe;})['then'](function(_0x2404aa){_0x511fbe=_0x2404aa;})['catch'](function(_0x52de4e){logger['error'](_0x52de4e['message']);})[_0x1f3d('0x31')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x511fbe);},TIME);});}function defaultLicense(){var _0x345db5=hardware[_0x1f3d('0x32')]();if(_0x345db5){return db[_0x1f3d('0x33')][_0x1f3d('0x34')]({'where':{'id':0x1},'defaults':{'data1':_0x345db5}})[_0x1f3d('0x35')](function(_0x59015b,_0x5101ae){logger['info'](_0x1f3d('0x36'),_0x345db5);manageLicense(_0x345db5,_0x59015b);})['catch'](function(_0x37a5e8){logger[_0x1f3d('0x37')](_0x37a5e8[_0x1f3d('0x38')]);});}}exports[_0x1f3d('0x39')]=defaultLicense; \ No newline at end of file +var _0x2ea2=['encryptString','decryptString','error','message','getUuid','findOrCreate','spread','catch','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','||FIELD||VALUE||\x0a','User','findOne','fullname','|machineUuid|','|name|','email','getFirstInterface','ipAddress','openIssue','MOTLICENSE','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','Disabled','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm'];(function(_0x1f0988,_0x299c68){var _0x3caf61=function(_0x454981){while(--_0x454981){_0x1f0988['push'](_0x1f0988['shift']());}};_0x3caf61(++_0x299c68);}(_0x2ea2,0xc5));var _0x22ea=function(_0x6f79dd,_0xeaae7c){_0x6f79dd=_0x6f79dd-0x0;var _0x1279b8=_0x2ea2[_0x6f79dd];return _0x1279b8;};'use strict';var util=require(_0x22ea('0x0'));var moment=require(_0x22ea('0x1'));var rp=require(_0x22ea('0x2'));var BPromise=require(_0x22ea('0x3'));var pkginfo=require(_0x22ea('0x4'))(module,_0x22ea('0x5'));var db=require(_0x22ea('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x22ea('0x7'));var logger=require(_0x22ea('0x8'))(_0x22ea('0x9'));var jira=require('../../api/jira/jira.controller');const {config}=require('process');var HOST=_0x22ea('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x18acfc){return new BPromise(function(_0x3dc6d4,_0x127cc3){var _0x15c1cb=util[_0x22ea('0xb')](_0x22ea('0xc'),HOST,_0x18acfc,module[_0x22ea('0xd')]['version']);if(oldToken){_0x15c1cb=util[_0x22ea('0xb')](_0x22ea('0xe'),HOST,_0x18acfc,module['exports'][_0x22ea('0x5')],oldToken);}var _0x499a22={'uri':_0x15c1cb,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x499a22)[_0x22ea('0xf')](function(_0x45531f){_0x3dc6d4(_0x45531f);})['catch'](function(_0x4b89d6){_0x127cc3(_0x4b89d6);});});}function sendJiraAlert(_0x54150a,_0x3e19a5,_0x3da559){var _0x58ecbb=_0x22ea('0x10');return db[_0x22ea('0x11')][_0x22ea('0x12')]({'where':{'role':'admin'},'attributes':[_0x22ea('0x13'),'email'],'raw':!![]})[_0x22ea('0xf')](function(_0x68daba){ADMIN=_0x68daba;_0x58ecbb+='|reason|'+_0x3da559+'|\x0a';_0x58ecbb+='|uuid|'+_0x54150a+'|\x0a';_0x58ecbb+=_0x22ea('0x14')+_0x3e19a5+'|\x0a';_0x58ecbb+=_0x22ea('0x15')+ADMIN[_0x22ea('0x13')]+'|\x0a';_0x58ecbb+='|email|'+ADMIN[_0x22ea('0x16')]+'|\x0a';return _0x58ecbb;})[_0x22ea('0xf')](function(_0x5198a2){var _0x12dc0d=hardware[_0x22ea('0x17')]()[_0x22ea('0x18')];return jira[_0x22ea('0x19')]({'key':_0x22ea('0x1a'),'summary':'Motion\x20License\x20Alert','description':_0x5198a2,'issuetype':'Alert','oldToken':_0x54150a,'newToken':_0x3e19a5,'email':ADMIN[_0x22ea('0x16')],'name':ADMIN[_0x22ea('0x13')],'reason':GRAY_PERIOD_REASON,'ip':_0x12dc0d});});}function manageLicense(_0x369e69,_0x4e76f4){var _0xcdab27=_0x4e76f4[_0x22ea('0x1b')]({'plain':!![]});httpRequest(_0x369e69)[_0x22ea('0xf')](function(_0x45241b){if(oldToken){oldToken=undefined;}if(_0x45241b[_0x22ea('0x1c')]){if(!_0xcdab27[_0x22ea('0x9')]&&_0xcdab27[_0x22ea('0x9')]!=_0x45241b[_0x22ea('0x9')]||_0xcdab27[_0x22ea('0x9')]&&_0xcdab27[_0x22ea('0x1d')]){logger[_0x22ea('0x1e')](_0x22ea('0x1f'));}if(_0xcdab27[_0x22ea('0x9')]&&!_0xcdab27['data2']&&_0xcdab27[_0x22ea('0x9')]!=_0x45241b[_0x22ea('0x9')]){logger[_0x22ea('0x1e')](_0x22ea('0x20'));}if(_0xcdab27['license']&&!_0xcdab27['data2']&&_0xcdab27['license']==_0x45241b[_0x22ea('0x9')]){return _0x4e76f4;}return _0x4e76f4[_0x22ea('0x21')]({'data1':_0x369e69,'data2':null,'license':_0x45241b[_0x22ea('0x9')]});}else{if(_0x45241b['license']||_0xcdab27[_0x22ea('0x9')]){if(!_0xcdab27[_0x22ea('0x1d')]){if(_0xcdab27[_0x22ea('0x22')]==_0x369e69){GRAY_PERIOD_REASON=_0x22ea('0x23');logger[_0x22ea('0x1e')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';oldToken=_0xcdab27[_0x22ea('0x22')];logger['info'](_0x22ea('0x24'),_0xcdab27[_0x22ea('0x22')],_0x369e69);}sendJiraAlert(_0xcdab27[_0x22ea('0x22')],_0x45241b['uuid'],GRAY_PERIOD_REASON);logger[_0x22ea('0x1e')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x22ea('0xb')](_0x22ea('0x25')));return _0x4e76f4[_0x22ea('0x21')]({'data2':encryptor[_0x22ea('0x26')](moment()[_0x22ea('0xb')](_0x22ea('0x25')))});}else{if(moment()['diff'](encryptor[_0x22ea('0x27')](_0xcdab27[_0x22ea('0x1d')]),'days')>DAYS){logger[_0x22ea('0x1e')]('DEMO\x20START\x20AT\x20%s',moment()[_0x22ea('0xb')](_0x22ea('0x25')));return _0x4e76f4[_0x22ea('0x21')]({'data1':_0x369e69,'data2':null,'license':null});}}}else{if(_0xcdab27['data1']!=_0x369e69){logger[_0x22ea('0x1e')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xcdab27[_0x22ea('0x22')],_0x369e69);return _0x4e76f4['update']({'data1':_0x369e69,'data2':null,'license':null});}}}return _0x4e76f4;})[_0x22ea('0xf')](function(_0x279660){_0x4e76f4=_0x279660;})['catch'](function(_0x5bda38){logger[_0x22ea('0x28')](_0x5bda38[_0x22ea('0x29')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x22ea('0x2a')](),_0x4e76f4);},TIME);});}function defaultLicense(){var _0x57015b=hardware[_0x22ea('0x2a')]();if(_0x57015b){return db['License'][_0x22ea('0x2b')]({'where':{'id':0x1},'defaults':{'data1':_0x57015b}})[_0x22ea('0x2c')](function(_0x1a075e,_0x3bb4b3){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x57015b);manageLicense(_0x57015b,_0x1a075e);})[_0x22ea('0x2d')](function(_0x11097d){logger[_0x22ea('0x28')](_0x11097d[_0x22ea('0x29')]);});}}exports[_0x22ea('0x2e')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ee8ecee..739c3c6 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 _0x3b2d=['role','sequelize','COUNT','col','admin','user','users','telephones','forEach','count','pick','countBy','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','machineUuid','decryptString','add','days','changed','disabled','message','User','findAll'];(function(_0x442368,_0x25e3c0){var _0x303fa1=function(_0x11494b){while(--_0x11494b){_0x442368['push'](_0x442368['shift']());}};_0x303fa1(++_0x25e3c0);}(_0x3b2d,0x166));var _0xd3b2=function(_0x5b3c4d,_0x49519d){_0x5b3c4d=_0x5b3c4d-0x0;var _0x296d70=_0x3b2d[_0x5b3c4d];return _0x296d70;};'use strict';var util=require(_0xd3b2('0x0'));var _=require(_0xd3b2('0x1'));var moment=require(_0xd3b2('0x2'));var BPromise=require('bluebird');var hardware=require(_0xd3b2('0x3'));var encryptor=require(_0xd3b2('0x4'));var db=require(_0xd3b2('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd3b2('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd3b2('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd3b2('0x8'),'machineUuid':hardware[_0xd3b2('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4cbcbf){return new BPromise(function(_0x3052a9,_0x4f3316){return db[_0xd3b2('0xa')][_0xd3b2('0xb')](_[_0xd3b2('0xc')](_0x4cbcbf,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0xdd404f){return checkLicense(_0xdd404f,null);})[_0xd3b2('0xd')](function(_0x370c62){_0x3052a9(_0x370c62);return;})[_0xd3b2('0xe')](function(_0x11bb96){_0x4f3316(_0x11bb96);});});}function checkLicense(_0x5de13e,_0x41026a){if(!_0x5de13e){demoLicense[_0xd3b2('0xf')]=_0x5de13e[_0xd3b2('0x10')];return demoLicense;}try{var _0x428eea=_0x41026a||_0x5de13e[_0xd3b2('0x11')];if(_[_0xd3b2('0x12')](_0x428eea)){throw new Error(_0xd3b2('0x13'));}var _0x4ded23=_0x5de13e[_0xd3b2('0x10')];var _0x50a9b4=_0x5de13e[_0xd3b2('0x14')];var _0x203544=_0x4ded23[_0xd3b2('0x15')]('-')[0x4];var _0x3c5b9c=_0x4ded23[_0xd3b2('0x15')]('-')[0x0];var _0x5813c7=encryptor['decryptString'](_0x428eea,util[_0xd3b2('0x16')](_0xd3b2('0x17'),_0x203544,_0x4ded23,_0x3c5b9c));var _0x4b9b2a=JSON[_0xd3b2('0x18')](_0x5813c7);_0x4b9b2a['demo']=![];_0x4b9b2a[_0xd3b2('0xf')]=_0x4ded23;_0x4b9b2a[_0xd3b2('0x19')]=hardware['getUuid']();if(_0x50a9b4){var _0x5cf4cc=encryptor[_0xd3b2('0x1a')](_0x50a9b4);_0x4b9b2a['gray']=_0x5cf4cc;_0x4b9b2a['deadline']=moment(_0x5cf4cc)[_0xd3b2('0x1b')](0x7,_0xd3b2('0x1c'))[_0xd3b2('0x16')]();_0x4b9b2a['grayReason']=_0x4b9b2a[_0xd3b2('0xf')]!=_0x4b9b2a[_0xd3b2('0x19')]?_0xd3b2('0x1d'):_0xd3b2('0x1e');}return _0x4b9b2a;}catch(_0x510b80){breakingLicense[_0xd3b2('0xf')]=_0x5de13e['data1'];breakingLicense[_0xd3b2('0x1f')]=_0x510b80[_0xd3b2('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5336d6,_0x257df7){getLicense()[_0xd3b2('0xd')](function(_0x196363){return db[_0xd3b2('0x20')][_0xd3b2('0x21')]({'attributes':[_0xd3b2('0x22'),[db[_0xd3b2('0x23')]['fn'](_0xd3b2('0x24'),db[_0xd3b2('0x23')][_0xd3b2('0x25')]('role')),'count']],'group':_0xd3b2('0x22'),'where':{'role':{'$or':[_0xd3b2('0x26'),_0xd3b2('0x27'),'telephone']}},'raw':!![]})['then'](function(_0x6cde30){var _0x2e73be={'user':_0x196363[_0xd3b2('0x28')]||0x0,'telephone':_0x196363[_0xd3b2('0x29')]||0x0};_0x6cde30[_0xd3b2('0x2a')](function(_0x21e397){var _0x58f043=_0x21e397[_0xd3b2('0x22')]===_0xd3b2('0x26')?'user':_0x21e397[_0xd3b2('0x22')];_0x2e73be[_0x58f043]-=_0x21e397[_0xd3b2('0x2b')];if(_0x2e73be[_0x58f043]<0x0)_0x2e73be[_0x58f043]=0x0;});_0x5336d6(_0x2e73be);return;});})[_0xd3b2('0xe')](function(_0x38df0b){_0x257df7(_0x38df0b);});});}function checkUserLimits(_0x345a02){return new BPromise(function(_0x437448,_0x25c809){getLimits()[_0xd3b2('0xd')](function(_0x3b1fb8){var _0x594cd5=_[_0xd3b2('0x2c')](_[_0xd3b2('0x2d')](_0x345a02,'role'),['admin','user','telephone']);var _0xa42120=(_0x594cd5[_0xd3b2('0x26')]||0x0)+(_0x594cd5['user']||0x0);var _0x1a0175=_0x594cd5[_0xd3b2('0x2e')]||0x0;if(_0xa42120>_0x3b1fb8[_0xd3b2('0x27')])return _0x25c809(_0xd3b2('0x2f'));if(_0x1a0175>_0x3b1fb8[_0xd3b2('0x2e')])return _0x25c809(_0xd3b2('0x30'));return _0x437448();})['catch'](function(_0x3855e0){_0x25c809(_0x3855e0);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0163=['moment','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','deadline','add','days','grayReason','message','User','role','COUNT','sequelize','col','count','admin','user','telephone','users','telephones','forEach','pick','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash'];(function(_0x35ff4b,_0x278c8b){var _0x18a9af=function(_0x286721){while(--_0x286721){_0x35ff4b['push'](_0x35ff4b['shift']());}};_0x18a9af(++_0x278c8b);}(_0x0163,0x1ca));var _0x3016=function(_0x1e964e,_0x41781c){_0x1e964e=_0x1e964e-0x0;var _0x23ad3c=_0x0163[_0x1e964e];return _0x23ad3c;};'use strict';var util=require(_0x3016('0x0'));var _=require(_0x3016('0x1'));var moment=require(_0x3016('0x2'));var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0x3016('0x3'));var db=require(_0x3016('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3016('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3016('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3016('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3016('0x7'),'machineUuid':hardware[_0x3016('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x1a70c7){return new BPromise(function(_0xb8415f,_0x1edb40){return db[_0x3016('0x9')][_0x3016('0xa')](_[_0x3016('0xb')](_0x1a70c7,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1b2a5a){return checkLicense(_0x1b2a5a,null);})[_0x3016('0xc')](function(_0x51dcbc){_0xb8415f(_0x51dcbc);return;})[_0x3016('0xd')](function(_0x440fa7){_0x1edb40(_0x440fa7);});});}function checkLicense(_0x78b504,_0x528177){if(!_0x78b504){demoLicense[_0x3016('0xe')]=_0x78b504[_0x3016('0xf')];return demoLicense;}try{var _0x13eb6f=_0x528177||_0x78b504['license'];if(_[_0x3016('0x10')](_0x13eb6f)){throw new Error(_0x3016('0x11'));}var _0xd4438=_0x78b504[_0x3016('0xf')];var _0x3cce51=_0x78b504[_0x3016('0x12')];var _0x240e76=_0xd4438[_0x3016('0x13')]('-')[0x4];var _0x35d4ce=_0xd4438[_0x3016('0x13')]('-')[0x0];var _0x688a57=encryptor[_0x3016('0x14')](_0x13eb6f,util[_0x3016('0x15')](_0x3016('0x16'),_0x240e76,_0xd4438,_0x35d4ce));var _0x43b16a=JSON[_0x3016('0x17')](_0x688a57);_0x43b16a[_0x3016('0x18')]=![];_0x43b16a[_0x3016('0xe')]=_0xd4438;_0x43b16a[_0x3016('0x19')]=hardware[_0x3016('0x8')]();if(_0x3cce51){var _0x4ab757=encryptor[_0x3016('0x14')](_0x3cce51);_0x43b16a['gray']=_0x4ab757;_0x43b16a[_0x3016('0x1a')]=moment(_0x4ab757)[_0x3016('0x1b')](0x7,_0x3016('0x1c'))[_0x3016('0x15')]();_0x43b16a[_0x3016('0x1d')]=_0x43b16a[_0x3016('0xe')]!=_0x43b16a[_0x3016('0x19')]?'changed':'disabled';}return _0x43b16a;}catch(_0x45b9f8){breakingLicense[_0x3016('0xe')]=_0x78b504[_0x3016('0xf')];breakingLicense[_0x3016('0x1e')]=_0x45b9f8[_0x3016('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x33b72d,_0x4bff62){getLicense()[_0x3016('0xc')](function(_0x26fbf6){return db[_0x3016('0x1f')]['findAll']({'attributes':[_0x3016('0x20'),[db['sequelize']['fn'](_0x3016('0x21'),db[_0x3016('0x22')][_0x3016('0x23')](_0x3016('0x20'))),_0x3016('0x24')]],'group':_0x3016('0x20'),'where':{'role':{'$or':[_0x3016('0x25'),_0x3016('0x26'),_0x3016('0x27')]}},'raw':!![]})[_0x3016('0xc')](function(_0x123ae5){var _0x57fe60={'user':_0x26fbf6[_0x3016('0x28')]||0x0,'telephone':_0x26fbf6[_0x3016('0x29')]||0x0};_0x123ae5[_0x3016('0x2a')](function(_0x364470){var _0x4525b7=_0x364470[_0x3016('0x20')]===_0x3016('0x25')?_0x3016('0x26'):_0x364470[_0x3016('0x20')];_0x57fe60[_0x4525b7]-=_0x364470['count'];if(_0x57fe60[_0x4525b7]<0x0)_0x57fe60[_0x4525b7]=0x0;});_0x33b72d(_0x57fe60);return;});})[_0x3016('0xd')](function(_0x521cd3){_0x4bff62(_0x521cd3);});});}function checkUserLimits(_0x4f11d5){return new BPromise(function(_0x174124,_0x119d74){getLimits()['then'](function(_0x31251e){var _0x492c0c=_[_0x3016('0x2b')](_['countBy'](_0x4f11d5,_0x3016('0x20')),[_0x3016('0x25'),'user',_0x3016('0x27')]);var _0x3acbdf=(_0x492c0c[_0x3016('0x25')]||0x0)+(_0x492c0c[_0x3016('0x26')]||0x0);var _0xff4990=_0x492c0c[_0x3016('0x27')]||0x0;if(_0x3acbdf>_0x31251e[_0x3016('0x26')])return _0x119d74('License\x20limit\x20reached\x20for\x20users');if(_0xff4990>_0x31251e[_0x3016('0x27')])return _0x119d74(_0x3016('0x2c'));return _0x174124();})[_0x3016('0xd')](function(_0x5b7aba){_0x119d74(_0x5b7aba);});});}module[_0x3016('0x2d')]={'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 f304972..8480237 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 _0xd679=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x26bceb,_0x124ed3){var _0xcb6fef=function(_0x22acf7){while(--_0x22acf7){_0x26bceb['push'](_0x26bceb['shift']());}};_0xcb6fef(++_0x124ed3);}(_0xd679,0xcc));var _0x9d67=function(_0x5d002d,_0x41861d){_0x5d002d=_0x5d002d-0x0;var _0x442d54=_0xd679[_0x5d002d];return _0x442d54;};'use strict';module['exports']={'DOMAIN':_0x9d67('0x0'),'SESSION_SECRET':_0x9d67('0x1'),'GOOGLE_ID':_0x9d67('0x2'),'GOOGLE_SECRET':_0x9d67('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xc0bf=['http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x141a4b,_0x366790){var _0x2a4b86=function(_0x311a61){while(--_0x311a61){_0x141a4b['push'](_0x141a4b['shift']());}};_0x2a4b86(++_0x366790);}(_0xc0bf,0x8c));var _0xfc0b=function(_0x181682,_0x180171){_0x181682=_0x181682-0x0;var _0x1e6952=_0xc0bf[_0x181682];return _0x1e6952;};'use strict';module['exports']={'DOMAIN':_0xfc0b('0x0'),'SESSION_SECRET':_0xfc0b('0x1'),'GOOGLE_ID':_0xfc0b('0x2'),'GOOGLE_SECRET':_0xfc0b('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 4a4c783..589662f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89e6=['util','path','INFO','log','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','info','debugLevel','moment','winston'];(function(_0x5e5c68,_0x466a41){var _0x39c83e=function(_0x1c79e0){while(--_0x1c79e0){_0x5e5c68['push'](_0x5e5c68['shift']());}};_0x39c83e(++_0x466a41);}(_0x89e6,0x1ae));var _0x689e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x89e6[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x689e('0x0'));var winston=require(_0x689e('0x1'));var util=require(_0x689e('0x2'));var path=require(_0x689e('0x3'));var debugLevel=_0x689e('0x4');function filename(_0x47e023,_0x5e5d0b){return path['join']('/var',_0x689e('0x5'),'xcally',util[_0x689e('0x6')](_0x689e('0x7'),_0x47e023,_0x5e5d0b));}function formatter(_0x5b5f11,_0x151727){_0x151727[_0x689e('0x8')]=_0x151727[_0x689e('0x8')][_0x689e('0x9')](/@@{/g,_0x689e('0xa'))['replace'](/}@@/g,_0x689e('0xb'))['replace'](/@{/g,'{{')[_0x689e('0x9')](/}@/g,'}}');return util[_0x689e('0x6')](_0x689e('0xc'),moment()[_0x689e('0x6')](_0x689e('0xd')),_0x151727[_0x689e('0xe')][_0x689e('0xf')](),_0x5b5f11,_0x151727['message']);}module[_0x689e('0x10')]=function(_0x1f1390){return new winston[(_0x689e('0x11'))]({'transports':[new winston[(_0x689e('0x12'))][(_0x689e('0x13'))]({'name':util[_0x689e('0x6')](_0x689e('0x14'),_0x1f1390,_0x689e('0x15')),'filename':filename(_0x1f1390,_0x689e('0x15')),'level':_0x689e('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x34b228){return formatter(_0x1f1390,_0x34b228);}}),new winston[(_0x689e('0x12'))][(_0x689e('0x13'))]({'name':util[_0x689e('0x6')](_0x689e('0x14'),_0x1f1390,_0x689e('0x16')),'filename':filename(_0x1f1390,_0x689e('0x16')),'level':_0x689e('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2d219a){return formatter(_0x1f1390,_0x2d219a);}}),new winston[(_0x689e('0x12'))]['Console']({'level':process['env'][_0x689e('0x17')]||debugLevel,'json':![],'formatter':function(_0x1c9571){return formatter(_0x1f1390,_0x1c9571);}})]});}; \ No newline at end of file +var _0x6ef7=['Logger','transports','File','error','%s-%s','info','env','debugLevel','moment','winston','util','path','INFO','join','/var','log','xcally','format','message','{{{','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x6ef7,0x1e3));var _0x76ef=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6ef7[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x76ef('0x0'));var winston=require(_0x76ef('0x1'));var util=require(_0x76ef('0x2'));var path=require(_0x76ef('0x3'));var debugLevel=_0x76ef('0x4');function filename(_0x15ea9c,_0x115fde){return path[_0x76ef('0x5')](_0x76ef('0x6'),_0x76ef('0x7'),_0x76ef('0x8'),util[_0x76ef('0x9')]('%s-%s.log',_0x15ea9c,_0x115fde));}function formatter(_0x5556a7,_0x5f497d){_0x5f497d['message']=_0x5f497d[_0x76ef('0xa')]['replace'](/@@{/g,_0x76ef('0xb'))[_0x76ef('0xc')](/}@@/g,'}}}')[_0x76ef('0xc')](/@{/g,'{{')[_0x76ef('0xc')](/}@/g,'}}');return util[_0x76ef('0x9')](_0x76ef('0xd'),moment()[_0x76ef('0x9')](_0x76ef('0xe')),_0x5f497d[_0x76ef('0xf')][_0x76ef('0x10')](),_0x5556a7,_0x5f497d['message']);}module['exports']=function(_0x23a26a){return new winston[(_0x76ef('0x11'))]({'transports':[new winston[(_0x76ef('0x12'))][(_0x76ef('0x13'))]({'name':util[_0x76ef('0x9')]('%s-%s',_0x23a26a,'error'),'filename':filename(_0x23a26a,'error'),'level':_0x76ef('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x119ab5){return formatter(_0x23a26a,_0x119ab5);}}),new winston[(_0x76ef('0x12'))][(_0x76ef('0x13'))]({'name':util[_0x76ef('0x9')](_0x76ef('0x15'),_0x23a26a,_0x76ef('0x16')),'filename':filename(_0x23a26a,_0x76ef('0x16')),'level':_0x76ef('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5a1450){return formatter(_0x23a26a,_0x5a1450);}}),new winston[(_0x76ef('0x12'))]['Console']({'level':process[_0x76ef('0x17')][_0x76ef('0x18')]||debugLevel,'json':![],'formatter':function(_0x3cfd3f){return formatter(_0x23a26a,_0x3cfd3f);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f7667cb..0c6c1a4 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 _0xec9a=['xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js'];(function(_0x1910dc,_0x2318bd){var _0x320a47=function(_0x2ec73e){while(--_0x2ec73e){_0x1910dc['push'](_0x1910dc['shift']());}};_0x320a47(++_0x2318bd);}(_0xec9a,0x196));var _0xaec9=function(_0x48c8ab,_0x5af680){_0x48c8ab=_0x48c8ab-0x0;var _0x246963=_0xec9a[_0x48c8ab];return _0x246963;};'use strict';var path=require(_0xaec9('0x0'));var os=require('os');var config={'apps':[{'name':_0xaec9('0x1'),'script':path['join'](__dirname,_0xaec9('0x2'))},{'name':'ami','script':path[_0xaec9('0x3')](__dirname,_0xaec9('0x4'))},{'name':_0xaec9('0x5'),'script':path[_0xaec9('0x3')](__dirname,_0xaec9('0x6'))},{'name':_0xaec9('0x7'),'script':path[_0xaec9('0x3')](__dirname,_0xaec9('0x8'))},{'name':'routing','script':path[_0xaec9('0x3')](__dirname,_0xaec9('0x9'))},{'name':_0xaec9('0xa'),'script':path[_0xaec9('0x3')](__dirname,_0xaec9('0xb'))}]};module[_0xaec9('0xc')]=config; \ No newline at end of file +var _0xad7c=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join'];(function(_0x3cf9c5,_0x2f8f6a){var _0x577aee=function(_0x38203a){while(--_0x38203a){_0x3cf9c5['push'](_0x3cf9c5['shift']());}};_0x577aee(++_0x2f8f6a);}(_0xad7c,0x8c));var _0xcad7=function(_0x36015e,_0x5e16ce){_0x36015e=_0x36015e-0x0;var _0x28b2e3=_0xad7c[_0x36015e];return _0x28b2e3;};'use strict';var path=require(_0xcad7('0x0'));var os=require('os');var config={'apps':[{'name':_0xcad7('0x1'),'script':path[_0xcad7('0x2')](__dirname,_0xcad7('0x3'))},{'name':_0xcad7('0x4'),'script':path['join'](__dirname,_0xcad7('0x5'))},{'name':_0xcad7('0x6'),'script':path[_0xcad7('0x2')](__dirname,_0xcad7('0x7'))},{'name':_0xcad7('0x8'),'script':path[_0xcad7('0x2')](__dirname,_0xcad7('0x9'))},{'name':'routing','script':path[_0xcad7('0x2')](__dirname,_0xcad7('0xa'))},{'name':'xdr','script':path[_0xcad7('0x2')](__dirname,_0xcad7('0xb'))}]};module[_0xcad7('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 9fd68a0..e2e0855 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 _0x004c=['disconnect','stop','restart','list','describe','delete','saved','pm2','bluebird','./config','connect','connected','start','then'];(function(_0x305db9,_0x18812a){var _0x1c927d=function(_0x1f267c){while(--_0x1f267c){_0x305db9['push'](_0x305db9['shift']());}};_0x1c927d(++_0x18812a);}(_0x004c,0x85));var _0xc004=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x004c[_0x3e44fa];return _0x2a0aba;};'use strict';var pm2=require(_0xc004('0x0'));var BPromise=require(_0xc004('0x1'));var config=require(_0xc004('0x2'));function connect(){return new BPromise(function(_0x2cf6a8,_0x4c7289){return pm2[_0xc004('0x3')](function(_0x4016c5){if(_0x4016c5){return _0x4c7289(_0x4016c5);}return _0x2cf6a8(_0xc004('0x4'));});});};exports[_0xc004('0x5')]=function(_0x571646){return connect()[_0xc004('0x6')](function(){return new BPromise(function(_0x5413ec,_0x2c7142){return pm2[_0xc004('0x5')](_0x571646,function(_0x5ef023,_0x4c12db){if(_0x5ef023){return _0x2c7142(_0x5ef023);}pm2[_0xc004('0x7')]();return _0x5413ec(_0x4c12db);});});});};exports[_0xc004('0x8')]=function(_0x40ad0c){return connect()[_0xc004('0x6')](function(){return new BPromise(function(_0x4dc7bc,_0x13f5c7){return pm2[_0xc004('0x8')](_0x40ad0c,function(_0xf67998,_0x9a540e){if(_0xf67998){return _0x13f5c7(_0xf67998);}pm2[_0xc004('0x7')]();return _0x4dc7bc(_0x9a540e);});});});};exports[_0xc004('0x9')]=function(_0x227616){return connect()[_0xc004('0x6')](function(){return new BPromise(function(_0x46850d,_0x1d39a7){return pm2['restart'](_0x227616,function(_0x1f7493,_0x2adc41){if(_0x1f7493){return _0x1d39a7(_0x1f7493);}pm2[_0xc004('0x7')]();return _0x46850d(_0x2adc41);});});});};exports[_0xc004('0xa')]=function(){return connect()[_0xc004('0x6')](function(){return new BPromise(function(_0x2c985a,_0x3ffc0f){return pm2[_0xc004('0xa')](function(_0x208fa5,_0x428679){if(_0x208fa5){return _0x3ffc0f(_0x208fa5);}pm2[_0xc004('0x7')]();return _0x2c985a(_0x428679);});});});};exports[_0xc004('0xb')]=function(_0x21d31b){return connect()[_0xc004('0x6')](function(){return new BPromise(function(_0x5acb38,_0x388f5a){return pm2[_0xc004('0xb')](_0x21d31b,function(_0x1112d9,_0x2795bb){if(_0x1112d9){return _0x388f5a(_0x1112d9);}pm2[_0xc004('0x7')]();return _0x5acb38(_0x2795bb);});});});};exports['delete']=function(_0x7368ae){return connect()[_0xc004('0x6')](function(){return new BPromise(function(_0x275951,_0xf89a45){return pm2[_0xc004('0xc')](_0x7368ae,function(_0x2aeea2,_0x36885e){if(_0x2aeea2){return _0xf89a45(_0x2aeea2);}pm2['disconnect']();return _0x275951(_0x36885e);});});});};exports['dump']=function(){return connect()[_0xc004('0x6')](function(){return new BPromise(function(_0x3cc9f4,_0x43fbbe){return pm2['dump'](function(_0x195c23){if(_0x195c23){return _0x43fbbe(_0x195c23);}return _0x3cc9f4(_0xc004('0xd'));});});});}; \ No newline at end of file +var _0x744c=['restart','then','list','describe','dump','saved','pm2','bluebird','./config','connect','connected','start','stop','disconnect'];(function(_0x29bcb6,_0x5e9420){var _0x3b9a9f=function(_0x15def6){while(--_0x15def6){_0x29bcb6['push'](_0x29bcb6['shift']());}};_0x3b9a9f(++_0x5e9420);}(_0x744c,0xa0));var _0xc744=function(_0x49fa01,_0x37f0bd){_0x49fa01=_0x49fa01-0x0;var _0x1362ca=_0x744c[_0x49fa01];return _0x1362ca;};'use strict';var pm2=require(_0xc744('0x0'));var BPromise=require(_0xc744('0x1'));var config=require(_0xc744('0x2'));function connect(){return new BPromise(function(_0x3a53cf,_0x4b6a83){return pm2[_0xc744('0x3')](function(_0x423eac){if(_0x423eac){return _0x4b6a83(_0x423eac);}return _0x3a53cf(_0xc744('0x4'));});});};exports[_0xc744('0x5')]=function(_0x4f1c94){return connect()['then'](function(){return new BPromise(function(_0x4722a6,_0x1cc521){return pm2[_0xc744('0x5')](_0x4f1c94,function(_0x5d5009,_0x5625a5){if(_0x5d5009){return _0x1cc521(_0x5d5009);}pm2['disconnect']();return _0x4722a6(_0x5625a5);});});});};exports[_0xc744('0x6')]=function(_0xf1fc2f){return connect()['then'](function(){return new BPromise(function(_0x150f9e,_0x24a8d3){return pm2[_0xc744('0x6')](_0xf1fc2f,function(_0x40030e,_0x43e0fe){if(_0x40030e){return _0x24a8d3(_0x40030e);}pm2[_0xc744('0x7')]();return _0x150f9e(_0x43e0fe);});});});};exports[_0xc744('0x8')]=function(_0x525fe7){return connect()[_0xc744('0x9')](function(){return new BPromise(function(_0x14cd23,_0x1ffe53){return pm2[_0xc744('0x8')](_0x525fe7,function(_0x26ae9a,_0x1d850c){if(_0x26ae9a){return _0x1ffe53(_0x26ae9a);}pm2['disconnect']();return _0x14cd23(_0x1d850c);});});});};exports[_0xc744('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x8d5a96,_0x3c84f4){return pm2[_0xc744('0xa')](function(_0x53ed35,_0x5d75bf){if(_0x53ed35){return _0x3c84f4(_0x53ed35);}pm2['disconnect']();return _0x8d5a96(_0x5d75bf);});});});};exports['describe']=function(_0x46d1f6){return connect()[_0xc744('0x9')](function(){return new BPromise(function(_0x5ad488,_0x5742c0){return pm2[_0xc744('0xb')](_0x46d1f6,function(_0x3d728e,_0x36f42f){if(_0x3d728e){return _0x5742c0(_0x3d728e);}pm2[_0xc744('0x7')]();return _0x5ad488(_0x36f42f);});});});};exports['delete']=function(_0x2a857d){return connect()[_0xc744('0x9')](function(){return new BPromise(function(_0x37c9f4,_0x431103){return pm2['delete'](_0x2a857d,function(_0xc55f24,_0x19f2cc){if(_0xc55f24){return _0x431103(_0xc55f24);}pm2[_0xc744('0x7')]();return _0x37c9f4(_0x19f2cc);});});});};exports[_0xc744('0xc')]=function(){return connect()[_0xc744('0x9')](function(){return new BPromise(function(_0x3eb6b3,_0x31cc32){return pm2[_0xc744('0xc')](function(_0x41eeae){if(_0x41eeae){return _0x31cc32(_0x41eeae);}return _0x3eb6b3(_0xc744('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 31f1225..93762c7 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 _0xaf20=['ioredis','../../config/environment','../../mysqldb','../logger','redis','localhost','Setting','find','chatTimeout','then','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment'];(function(_0x143368,_0x5d0b64){var _0x44c10a=function(_0x30c90c){while(--_0x30c90c){_0x143368['push'](_0x143368['shift']());}};_0x44c10a(++_0x5d0b64);}(_0xaf20,0xee));var _0x0af2=function(_0x559c92,_0x5e82a9){_0x559c92=_0x559c92-0x0;var _0x1f32db=_0xaf20[_0x559c92];return _0x1f32db;};'use strict';var _=require(_0x0af2('0x0'));var moment=require(_0x0af2('0x1'));var Redis=require(_0x0af2('0x2'));var util=require('util');var config=require(_0x0af2('0x3'));var db=require(_0x0af2('0x4'))['db'];var logger=require(_0x0af2('0x5'))('schedule');config[_0x0af2('0x6')]=_['defaults'](config['redis'],{'host':_0x0af2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0af2('0x6')]));function closeInteractions(){var _0x348aa1=0x0;var _0x21c891=[];return db[_0x0af2('0x8')][_0x0af2('0x9')]({'raw':!![],'attributes':['id',_0x0af2('0xa')],'where':{'id':0x1}})[_0x0af2('0xb')](function(_0xaa05d2){_0x348aa1=_0xaa05d2['chatTimeout'];if(_0x348aa1){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0af2('0xc')](_0xaa05d2[_0x0af2('0xa')],_0x0af2('0xd'))}}});}else{return[];}})[_0x0af2('0xb')](function(_0x789ff4){if(_0x789ff4&&_0x789ff4[_0x0af2('0xe')]){_0x21c891=_[_0x0af2('0xf')](_0x789ff4||[],'id');logger[_0x0af2('0x10')](_0x0af2('0x11'),_0x21c891[_0x0af2('0x12')]());return db[_0x0af2('0x13')][_0x0af2('0x14')]({'closeReason':_0x0af2('0x15'),'disposition':_0x0af2('0x16'),'closed':!![],'closedAt':moment()[_0x0af2('0x17')](_0x0af2('0x18'))},{'where':{'id':_0x21c891}});}})[_0x0af2('0xb')](function(){if(_0x21c891&&_0x21c891[_0x0af2('0xe')]){logger[_0x0af2('0x10')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x21c891['join']());for(var _0xf4b4c2=0x0;_0xf4b4c2<_0x21c891[_0x0af2('0xe')];_0xf4b4c2++){io[_0x0af2('0x19')](_0x0af2('0x1a'),{'id':_0x21c891[_0xf4b4c2],'closed':!![]});}}})['catch'](function(_0x3b6511){logger[_0x0af2('0x1b')](_0x0af2('0x1c'),_0x3b6511?util['inspect'](_0x3b6511,{'showHidden':![],'depth':null}):'');});}exports[_0x0af2('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x45d7=['start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x45d7,0x1dd));var _0x745d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x45d7[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x745d('0x0'));var moment=require(_0x745d('0x1'));var Redis=require(_0x745d('0x2'));var util=require(_0x745d('0x3'));var config=require(_0x745d('0x4'));var db=require(_0x745d('0x5'))['db'];var logger=require(_0x745d('0x6'))(_0x745d('0x7'));config[_0x745d('0x8')]=_[_0x745d('0x9')](config[_0x745d('0x8')],{'host':_0x745d('0xa'),'port':0x18eb});var io=require(_0x745d('0xb'))(new Redis(config[_0x745d('0x8')]));function closeInteractions(){var _0x190357=0x0;var _0x3621f0=[];return db[_0x745d('0xc')][_0x745d('0xd')]({'raw':!![],'attributes':['id',_0x745d('0xe')],'where':{'id':0x1}})[_0x745d('0xf')](function(_0x1ea3ec){_0x190357=_0x1ea3ec[_0x745d('0xe')];if(_0x190357){return db[_0x745d('0x10')]['findAll']({'raw':!![],'attributes':['id',_0x745d('0x11')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x745d('0x12')](_0x1ea3ec[_0x745d('0xe')],'minutes')}}});}else{return[];}})[_0x745d('0xf')](function(_0x1a2dff){if(_0x1a2dff&&_0x1a2dff[_0x745d('0x13')]){_0x3621f0=_['map'](_0x1a2dff||[],'id');logger[_0x745d('0x14')](_0x745d('0x15'),_0x3621f0[_0x745d('0x16')]());return db[_0x745d('0x10')][_0x745d('0x17')]({'closeReason':'system','disposition':_0x745d('0x18'),'closed':!![],'closedAt':moment()[_0x745d('0x19')](_0x745d('0x1a'))},{'where':{'id':_0x3621f0}});}})[_0x745d('0xf')](function(){if(_0x3621f0&&_0x3621f0['length']){logger[_0x745d('0x14')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3621f0['join']());for(var _0x15cb39=0x0;_0x15cb39<_0x3621f0[_0x745d('0x13')];_0x15cb39++){io[_0x745d('0x1b')](_0x745d('0x1c'),{'id':_0x3621f0[_0x15cb39],'closed':!![]});}}})[_0x745d('0x1d')](function(_0x562ea1){logger[_0x745d('0x1e')](_0x745d('0x1f'),_0x562ea1?util[_0x745d('0x20')](_0x562ea1,{'showHidden':![],'depth':null}):'');});}exports[_0x745d('0x21')]=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 3f9a57a..d95a6f1 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 _0x4fe7=['stop','delete\x20cron','toRun','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update','update\x20cron','run','path','lodash','bluebird','../logger','../../mysqldb','client','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','email','bcc','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','stringify','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','name','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','jobs','map','toString','difference','length','exists'];(function(_0x5004e8,_0xdcd96b){var _0x27987a=function(_0x111a43){while(--_0x111a43){_0x5004e8['push'](_0x5004e8['shift']());}};_0x27987a(++_0xdcd96b);}(_0x4fe7,0xbe));var _0x74fe=function(_0x15545f,_0x232f3a){_0x15545f=_0x15545f-0x0;var _0xf1f93c=_0x4fe7[_0x15545f];return _0xf1f93c;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x74fe('0x0'));var _=require(_0x74fe('0x1'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require(_0x74fe('0x2'));var logger=require(_0x74fe('0x3'))('schedule');var db=require(_0x74fe('0x4'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x74fe('0x5')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4b3f93,_0x59d65a){return function(){logger[_0x74fe('0x6')](_0x74fe('0x7'),_0x4b3f93['email']);var _0x527a9e=!![];var _0x5e1caf={'tls':{'rejectUnauthorized':![]}};if(_0x4b3f93[_0x74fe('0x8')][_0x74fe('0x9')]['service']){_0x5e1caf['service']=_0x4b3f93[_0x74fe('0x8')][_0x74fe('0x9')][_0x74fe('0xa')];}else{_0x5e1caf[_0x74fe('0xb')]=_0x4b3f93[_0x74fe('0x8')]['Smtp'][_0x74fe('0xb')];_0x5e1caf[_0x74fe('0xc')]=_0x4b3f93[_0x74fe('0x8')][_0x74fe('0x9')][_0x74fe('0xc')];_0x5e1caf['secure']=_0x4b3f93[_0x74fe('0x8')][_0x74fe('0x9')][_0x74fe('0xd')];}if(_0x4b3f93[_0x74fe('0x8')]['Smtp'][_0x74fe('0xe')]){_0x5e1caf[_0x74fe('0xf')]={'user':_0x4b3f93[_0x74fe('0x8')][_0x74fe('0x9')][_0x74fe('0x10')],'pass':_0x4b3f93[_0x74fe('0x8')][_0x74fe('0x9')]['pass']};}var _0x51ebb9={'account':_0x5e1caf,'message':{'from':util[_0x74fe('0x11')](_0x74fe('0x12'),_0x4b3f93[_0x74fe('0x8')]['name'],_0x4b3f93['MailAccount'][_0x74fe('0x13')]||_0x4b3f93['MailAccount'][_0x74fe('0x9')][_0x74fe('0x10')]),'to':_0x4b3f93['email'],'cc':_0x4b3f93['cc'],'bcc':_0x4b3f93[_0x74fe('0x14')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x59d65a['name'],_0x4b3f93['subtractNumber'],_0x4b3f93[_0x74fe('0x15')])}};var _0x1512f0=path[_0x74fe('0x16')](__dirname,_0x74fe('0x17'));var _0x6be0dd=_0x59d65a[_0x74fe('0x18')];var _0x55204e=util[_0x74fe('0x11')](_0x74fe('0x19'),path[_0x74fe('0x1a')](_0x59d65a[_0x74fe('0x18')],path[_0x74fe('0x1b')](_0x59d65a[_0x74fe('0x18')])),_0x74fe('0x1c'));var _0x420536=path['join'](_0x1512f0,_0x6be0dd);var _0x183fd9=path[_0x74fe('0x16')](_0x1512f0,_0x55204e);if(fs[_0x74fe('0x1d')](_0x420536)){_0x59d65a[_0x74fe('0x1e')]=_0x74fe('0x1f');_0x51ebb9[_0x74fe('0x20')][_0x74fe('0x21')]=[{'filename':_0x6be0dd,'path':_0x420536}];_0x51ebb9[_0x74fe('0x20')][_0x74fe('0x22')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0x59d65a,null,0x2));}else if(fs[_0x74fe('0x1d')](_0x183fd9)){_0x59d65a['status']=_0x74fe('0x1f');_0x51ebb9[_0x74fe('0x20')][_0x74fe('0x21')]=[{'filename':_0x55204e,'path':_0x183fd9}];}else{_0x51ebb9['message']['text']=_0x74fe('0x23');if(!_0x4b3f93[_0x74fe('0x24')]){_0x527a9e=![];logger[_0x74fe('0x6')](_0x74fe('0x25'));}}if(_0x527a9e){return client[_0x74fe('0x26')](_0x74fe('0x27'),_0x51ebb9)[_0x74fe('0x28')](function(_0xd94dd7){if(_0xd94dd7[_0x74fe('0x29')]){return logger[_0x74fe('0x29')](_0x74fe('0x2a'),JSON['stringify'](_0xd94dd7));}return logger['info'](_0x74fe('0x2b'));})[_0x74fe('0x2c')](function(_0x3c99af){return logger[_0x74fe('0x29')](_0x74fe('0x2a'),JSON[_0x74fe('0x2d')](_0x3c99af));});}};}function handleError(){return function(_0x2f9d55){return logger[_0x74fe('0x29')](JSON[_0x74fe('0x2d')](_0x2f9d55));};}function handleResult(_0x3e66b1){return function(_0x26a62d){logger[_0x74fe('0x6')]('data',JSON[_0x74fe('0x2d')](_0x26a62d));if(_0x3e66b1['MailAccount']&&_0x3e66b1[_0x74fe('0x8')][_0x74fe('0x9')]&&!_[_0x74fe('0x2e')](_0x3e66b1[_0x74fe('0x13')])){setTimeout(handleSendEmail(_0x3e66b1,_0x26a62d),0x3c*0x3e8);}};}function handleJob(_0x5efbe7){return function(){try{if(_[_0x74fe('0x2e')](_0x5efbe7[_0x74fe('0x2f')])){return logger['info'](_0x74fe('0x30'));}if(_[_0x74fe('0x2e')](_0x5efbe7[_0x74fe('0x15')])){return logger['info'](_0x74fe('0x31'));}var _0x10a96c={'startDate':moment()[_0x74fe('0x32')](_0x5efbe7[_0x74fe('0x2f')],_0x5efbe7[_0x74fe('0x15')])[_0x74fe('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x74fe('0x33')),'type':_0x74fe('0x34'),'output':_0x5efbe7[_0x74fe('0x35')],'name':_0x5efbe7[_0x74fe('0x36')]};if(!_[_0x74fe('0x2e')](_0x5efbe7['DefaultReportId'])){logger[_0x74fe('0x6')]('exec\x20defaul\x20report\x20id:%s',_0x5efbe7[_0x74fe('0x37')]);return analyticDefaultReportController[_0x74fe('0x38')]({'id':_0x5efbe7[_0x74fe('0x37')]},_0x10a96c)['then'](handleResult(_0x5efbe7))['catch'](handleError());}if(!_[_0x74fe('0x2e')](_0x5efbe7['CustomReportId'])){logger['info'](_0x74fe('0x39'),_0x5efbe7[_0x74fe('0x3a')]);return analyticCustomReportController[_0x74fe('0x38')]({'id':_0x5efbe7['CustomReportId']},_0x10a96c)[_0x74fe('0x28')](handleResult(_0x5efbe7))[_0x74fe('0x2c')](handleError());}}catch(_0x40939c){logger['error'](JSON['stringify'](_0x40939c));}return logger[_0x74fe('0x6')](_0x74fe('0x3b'));};}function getJobs(_0x1064b0){var _0xe26504={};if(_0x1064b0){_0xe26504['id']=_0x1064b0;}return db[_0x74fe('0x3c')][_0x74fe('0x3d')]({'where':_0xe26504,'include':[{'model':db['MailAccount'],'attributes':['id',_0x74fe('0x36'),_0x74fe('0x13')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0x74fe('0x28')](function(_0x51c149){var _0x1ace3c=_['keys'](manager[_0x74fe('0x3e')]);var _0x23932c=_[_0x74fe('0x3f')](_0x51c149,function(_0x2c66d7){return _0x2c66d7['id'][_0x74fe('0x40')]();});var _0x2108c6=_['keyBy'](_0x51c149,function(_0x1fd0f6){return _0x1fd0f6['id']['toString']();});var _0x226b42=_0x1064b0?_0x23932c:_['difference'](_0x23932c,_0x1ace3c);var _0x2d77d0=_['intersection'](_0x23932c,_0x1ace3c);var _0x23c841=_[_0x74fe('0x41')](_0x1ace3c,_0x23932c);var _0x5dfd6f;var _0x44cf44;for(_0x5dfd6f=0x0;_0x5dfd6f<_0x23c841[_0x74fe('0x42')]&&!_0x1064b0;_0x5dfd6f+=0x1){_0x44cf44=_0x23c841[_0x5dfd6f][_0x74fe('0x40')]();if(manager[_0x74fe('0x43')](_0x44cf44)){manager[_0x74fe('0x44')](_0x44cf44);manager['deleteJob'](_0x44cf44);logger[_0x74fe('0x6')](_0x74fe('0x45'),_0x44cf44);}}logger['info'](_0x74fe('0x46'),JSON[_0x74fe('0x2d')](_0x226b42));for(_0x5dfd6f=0x0;_0x5dfd6f<_0x226b42['length'];_0x5dfd6f+=0x1){_0x44cf44=_0x226b42[_0x5dfd6f][_0x74fe('0x40')]();logger[_0x74fe('0x6')]('index',_0x44cf44);if(_0x1064b0){logger[_0x74fe('0x6')]('my\x20id',_0x1064b0);logger[_0x74fe('0x6')](JSON[_0x74fe('0x2d')](_0x2108c6[_0x44cf44]));BPromise[_0x74fe('0x47')]()[_0x74fe('0x28')](handleJob(_0x2108c6[_0x44cf44]));logger[_0x74fe('0x6')](_0x74fe('0x48'),_0x2108c6[_0x44cf44][_0x74fe('0x36')],_0x2108c6[_0x44cf44][_0x74fe('0x49')]);}else if(_0x2108c6[_0x44cf44][_0x74fe('0x49')]&&_0x2108c6[_0x44cf44][_0x74fe('0x4a')]&&moment()[_0x74fe('0x4b')](_0x2108c6[_0x44cf44][_0x74fe('0x4c')],_0x2108c6[_0x44cf44][_0x74fe('0x4d')])){manager[_0x74fe('0x4e')](_0x44cf44,_0x2108c6[_0x44cf44][_0x74fe('0x49')],handleJob(_0x2108c6[_0x44cf44]));manager[_0x74fe('0x4f')](_0x44cf44);logger[_0x74fe('0x6')](_0x74fe('0x50'),_0x2108c6[_0x44cf44][_0x74fe('0x36')],_0x2108c6[_0x44cf44]['cron']);}else if(manager[_0x74fe('0x43')](_0x44cf44)){manager[_0x74fe('0x44')](_0x44cf44);manager[_0x74fe('0x51')](_0x44cf44);logger['info'](_0x74fe('0x52'),_0x2108c6[_0x44cf44][_0x74fe('0x36')],_0x2108c6[_0x44cf44][_0x74fe('0x49')]);}}for(_0x5dfd6f=0x0,_0x44cf44;_0x5dfd6f<_0x2d77d0['length']&&!_0x1064b0;_0x5dfd6f+=0x1){_0x44cf44=_0x2d77d0[_0x5dfd6f][_0x74fe('0x40')]();if(manager[_0x74fe('0x43')](_0x44cf44)){if(_0x2108c6[_0x44cf44]['cron']&&_0x2108c6[_0x44cf44]['active']&&moment()[_0x74fe('0x4b')](_0x2108c6[_0x44cf44][_0x74fe('0x4c')],_0x2108c6[_0x44cf44][_0x74fe('0x4d')])){manager[_0x74fe('0x53')](_0x44cf44,_0x2108c6[_0x44cf44][_0x74fe('0x49')],handleJob(_0x2108c6[_0x44cf44]));logger[_0x74fe('0x6')](_0x74fe('0x54'),_0x2108c6[_0x44cf44]['name'],_0x2108c6[_0x44cf44][_0x74fe('0x49')]);}else{manager[_0x74fe('0x44')](_0x44cf44);manager['deleteJob'](_0x44cf44);logger['info'](_0x74fe('0x52'),_0x2108c6[_0x44cf44]['name'],_0x2108c6[_0x44cf44][_0x74fe('0x49')]);}}}})[_0x74fe('0x2c')](function(_0x1729e4){logger[_0x74fe('0x29')](JSON[_0x74fe('0x2d')](_0x1729e4));});}exports[_0x74fe('0x55')]=function(_0x3aca96){return getJobs(_0x3aca96);};exports[_0x74fe('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x7a07=['CustomReportId','catch','no\x20report\x20id','Schedule','MailServerOut','jobs','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','start','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','message','text','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','stringify','email\x20sent','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport'];(function(_0x45e3c2,_0x2d00bb){var _0x162fed=function(_0x5886f1){while(--_0x5886f1){_0x45e3c2['push'](_0x45e3c2['shift']());}};_0x162fed(++_0x2d00bb);}(_0x7a07,0x18c));var _0x77a0=function(_0x248cf7,_0x5c2fa8){_0x248cf7=_0x248cf7-0x0;var _0x46b3f5=_0x7a07[_0x248cf7];return _0x46b3f5;};'use strict';var fs=require('fs');var util=require(_0x77a0('0x0'));var path=require('path');var _=require(_0x77a0('0x1'));var moment=require(_0x77a0('0x2'));var CronJobManager=require(_0x77a0('0x3'));var jayson=require(_0x77a0('0x4'));var BPromise=require(_0x77a0('0x5'));var logger=require('../logger')('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x77a0('0x6'));var analyticDefaultReportController=require(_0x77a0('0x7'));var client=jayson[_0x77a0('0x8')][_0x77a0('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x68f532,_0xe58e7e){return function(){logger['info'](_0x77a0('0xa'),_0x68f532[_0x77a0('0xb')]);var _0x35993e=!![];var _0x498f2a={'tls':{'rejectUnauthorized':![]}};if(_0x68f532[_0x77a0('0xc')][_0x77a0('0xd')][_0x77a0('0xe')]){_0x498f2a[_0x77a0('0xe')]=_0x68f532[_0x77a0('0xc')][_0x77a0('0xd')]['service'];}else{_0x498f2a[_0x77a0('0xf')]=_0x68f532[_0x77a0('0xc')][_0x77a0('0xd')]['host'];_0x498f2a[_0x77a0('0x10')]=_0x68f532[_0x77a0('0xc')][_0x77a0('0xd')]['port'];_0x498f2a[_0x77a0('0x11')]=_0x68f532[_0x77a0('0xc')]['Smtp'][_0x77a0('0x11')];}if(_0x68f532[_0x77a0('0xc')][_0x77a0('0xd')][_0x77a0('0x12')]){_0x498f2a[_0x77a0('0x13')]={'user':_0x68f532[_0x77a0('0xc')]['Smtp'][_0x77a0('0x14')],'pass':_0x68f532[_0x77a0('0xc')]['Smtp']['pass']};}var _0x394dc2={'account':_0x498f2a,'message':{'from':util[_0x77a0('0x15')](_0x77a0('0x16'),_0x68f532['MailAccount'][_0x77a0('0x17')],_0x68f532['MailAccount'][_0x77a0('0xb')]||_0x68f532[_0x77a0('0xc')][_0x77a0('0xd')][_0x77a0('0x14')]),'to':_0x68f532[_0x77a0('0xb')],'cc':_0x68f532['cc'],'bcc':_0x68f532[_0x77a0('0x18')],'subject':util[_0x77a0('0x15')](_0x77a0('0x19'),_0xe58e7e[_0x77a0('0x17')],_0x68f532[_0x77a0('0x1a')],_0x68f532[_0x77a0('0x1b')])}};var _0x1e0573=path[_0x77a0('0x1c')](__dirname,_0x77a0('0x1d'));var _0x358033=_0xe58e7e[_0x77a0('0x1e')];var _0xa6c3d5=util[_0x77a0('0x15')](_0x77a0('0x1f'),path[_0x77a0('0x20')](_0xe58e7e[_0x77a0('0x1e')],path[_0x77a0('0x21')](_0xe58e7e[_0x77a0('0x1e')])),_0x77a0('0x22'));var _0x36d241=path['join'](_0x1e0573,_0x358033);var _0x2ce149=path[_0x77a0('0x1c')](_0x1e0573,_0xa6c3d5);if(fs[_0x77a0('0x23')](_0x36d241)){_0xe58e7e['status']='Sent';_0x394dc2['message']['attachments']=[{'filename':_0x358033,'path':_0x36d241}];_0x394dc2[_0x77a0('0x24')][_0x77a0('0x25')]=util[_0x77a0('0x15')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON['stringify'](_0xe58e7e,null,0x2));}else if(fs[_0x77a0('0x23')](_0x2ce149)){_0xe58e7e[_0x77a0('0x26')]='Sent';_0x394dc2[_0x77a0('0x24')][_0x77a0('0x27')]=[{'filename':_0xa6c3d5,'path':_0x2ce149}];}else{_0x394dc2[_0x77a0('0x24')]['text']=_0x77a0('0x28');if(!_0x68f532[_0x77a0('0x29')]){_0x35993e=![];logger[_0x77a0('0x2a')](_0x77a0('0x2b'));}}if(_0x35993e){return client['request'](_0x77a0('0x2c'),_0x394dc2)[_0x77a0('0x2d')](function(_0x1b6e6c){if(_0x1b6e6c[_0x77a0('0x2e')]){return logger[_0x77a0('0x2e')](_0x77a0('0x2f'),JSON[_0x77a0('0x30')](_0x1b6e6c));}return logger[_0x77a0('0x2a')](_0x77a0('0x31'));})['catch'](function(_0x249897){return logger[_0x77a0('0x2e')](_0x77a0('0x2f'),JSON['stringify'](_0x249897));});}};}function handleError(){return function(_0x27dc27){return logger[_0x77a0('0x2e')](JSON['stringify'](_0x27dc27));};}function handleResult(_0x56aa05){return function(_0x23871d){logger[_0x77a0('0x2a')]('data',JSON['stringify'](_0x23871d));if(_0x56aa05['MailAccount']&&_0x56aa05['MailAccount'][_0x77a0('0xd')]&&!_[_0x77a0('0x32')](_0x56aa05['email'])){setTimeout(handleSendEmail(_0x56aa05,_0x23871d),0x3c*0x3e8);}};}function handleJob(_0x5aca5d){return function(){try{if(_[_0x77a0('0x32')](_0x5aca5d[_0x77a0('0x1a')])){return logger[_0x77a0('0x2a')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x77a0('0x32')](_0x5aca5d['subtractUnit'])){return logger['info'](_0x77a0('0x33'));}var _0x161d27={'startDate':moment()[_0x77a0('0x34')](_0x5aca5d['subtractNumber'],_0x5aca5d[_0x77a0('0x1b')])[_0x77a0('0x15')](_0x77a0('0x35')),'endDate':moment()[_0x77a0('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x77a0('0x36'),'output':_0x5aca5d[_0x77a0('0x37')],'name':_0x5aca5d['name']};if(!_[_0x77a0('0x32')](_0x5aca5d[_0x77a0('0x38')])){logger[_0x77a0('0x2a')](_0x77a0('0x39'),_0x5aca5d[_0x77a0('0x38')]);return analyticDefaultReportController[_0x77a0('0x3a')]({'id':_0x5aca5d[_0x77a0('0x38')]},_0x161d27)[_0x77a0('0x2d')](handleResult(_0x5aca5d))['catch'](handleError());}if(!_[_0x77a0('0x32')](_0x5aca5d['CustomReportId'])){logger[_0x77a0('0x2a')]('exec\x20custom\x20report\x20id:%s',_0x5aca5d['CustomReportId']);return analyticCustomReportController[_0x77a0('0x3a')]({'id':_0x5aca5d[_0x77a0('0x3b')]},_0x161d27)[_0x77a0('0x2d')](handleResult(_0x5aca5d))[_0x77a0('0x3c')](handleError());}}catch(_0x422ae0){logger['error'](JSON['stringify'](_0x422ae0));}return logger[_0x77a0('0x2a')](_0x77a0('0x3d'));};}function getJobs(_0x2ed1bc){var _0x198197={};if(_0x2ed1bc){_0x198197['id']=_0x2ed1bc;}return db[_0x77a0('0x3e')]['findAll']({'where':_0x198197,'include':[{'model':db['MailAccount'],'attributes':['id',_0x77a0('0x17'),_0x77a0('0xb')],'include':[{'model':db[_0x77a0('0x3f')],'as':_0x77a0('0xd')}]}]})[_0x77a0('0x2d')](function(_0x379493){var _0x279d7c=_['keys'](manager[_0x77a0('0x40')]);var _0x1ab615=_[_0x77a0('0x41')](_0x379493,function(_0x15537d){return _0x15537d['id'][_0x77a0('0x42')]();});var _0x2e507a=_[_0x77a0('0x43')](_0x379493,function(_0x768bfc){return _0x768bfc['id'][_0x77a0('0x42')]();});var _0x4dfafc=_0x2ed1bc?_0x1ab615:_[_0x77a0('0x44')](_0x1ab615,_0x279d7c);var _0x32ace2=_[_0x77a0('0x45')](_0x1ab615,_0x279d7c);var _0x23f68e=_[_0x77a0('0x44')](_0x279d7c,_0x1ab615);var _0xfac426;var _0xf2c5e2;for(_0xfac426=0x0;_0xfac426<_0x23f68e[_0x77a0('0x46')]&&!_0x2ed1bc;_0xfac426+=0x1){_0xf2c5e2=_0x23f68e[_0xfac426][_0x77a0('0x42')]();if(manager['exists'](_0xf2c5e2)){manager[_0x77a0('0x47')](_0xf2c5e2);manager[_0x77a0('0x48')](_0xf2c5e2);logger[_0x77a0('0x2a')](_0x77a0('0x49'),_0xf2c5e2);}}logger[_0x77a0('0x2a')](_0x77a0('0x4a'),JSON[_0x77a0('0x30')](_0x4dfafc));for(_0xfac426=0x0;_0xfac426<_0x4dfafc[_0x77a0('0x46')];_0xfac426+=0x1){_0xf2c5e2=_0x4dfafc[_0xfac426][_0x77a0('0x42')]();logger[_0x77a0('0x2a')](_0x77a0('0x4b'),_0xf2c5e2);if(_0x2ed1bc){logger[_0x77a0('0x2a')]('my\x20id',_0x2ed1bc);logger[_0x77a0('0x2a')](JSON[_0x77a0('0x30')](_0x2e507a[_0xf2c5e2]));BPromise[_0x77a0('0x4c')]()[_0x77a0('0x2d')](handleJob(_0x2e507a[_0xf2c5e2]));logger[_0x77a0('0x2a')](_0x77a0('0x4d'),_0x2e507a[_0xf2c5e2][_0x77a0('0x17')],_0x2e507a[_0xf2c5e2][_0x77a0('0x4e')]);}else if(_0x2e507a[_0xf2c5e2][_0x77a0('0x4e')]&&_0x2e507a[_0xf2c5e2][_0x77a0('0x4f')]&&moment()[_0x77a0('0x50')](_0x2e507a[_0xf2c5e2][_0x77a0('0x51')],_0x2e507a[_0xf2c5e2][_0x77a0('0x52')])){manager[_0x77a0('0x53')](_0xf2c5e2,_0x2e507a[_0xf2c5e2][_0x77a0('0x4e')],handleJob(_0x2e507a[_0xf2c5e2]));manager['start'](_0xf2c5e2);logger[_0x77a0('0x2a')](_0x77a0('0x54'),_0x2e507a[_0xf2c5e2][_0x77a0('0x17')],_0x2e507a[_0xf2c5e2][_0x77a0('0x4e')]);}else if(manager[_0x77a0('0x55')](_0xf2c5e2)){manager['stop'](_0xf2c5e2);manager[_0x77a0('0x48')](_0xf2c5e2);logger[_0x77a0('0x2a')](_0x77a0('0x56'),_0x2e507a[_0xf2c5e2]['name'],_0x2e507a[_0xf2c5e2][_0x77a0('0x4e')]);}}for(_0xfac426=0x0,_0xf2c5e2;_0xfac426<_0x32ace2[_0x77a0('0x46')]&&!_0x2ed1bc;_0xfac426+=0x1){_0xf2c5e2=_0x32ace2[_0xfac426][_0x77a0('0x42')]();if(manager[_0x77a0('0x55')](_0xf2c5e2)){if(_0x2e507a[_0xf2c5e2][_0x77a0('0x4e')]&&_0x2e507a[_0xf2c5e2]['active']&&moment()['isBetween'](_0x2e507a[_0xf2c5e2][_0x77a0('0x51')],_0x2e507a[_0xf2c5e2]['endAt'])){manager[_0x77a0('0x57')](_0xf2c5e2,_0x2e507a[_0xf2c5e2][_0x77a0('0x4e')],handleJob(_0x2e507a[_0xf2c5e2]));logger[_0x77a0('0x2a')](_0x77a0('0x58'),_0x2e507a[_0xf2c5e2][_0x77a0('0x17')],_0x2e507a[_0xf2c5e2][_0x77a0('0x4e')]);}else{manager[_0x77a0('0x47')](_0xf2c5e2);manager[_0x77a0('0x48')](_0xf2c5e2);logger[_0x77a0('0x2a')](_0x77a0('0x56'),_0x2e507a[_0xf2c5e2][_0x77a0('0x17')],_0x2e507a[_0xf2c5e2][_0x77a0('0x4e')]);}}}})['catch'](function(_0x60f35a){logger[_0x77a0('0x2e')](JSON['stringify'](_0x60f35a));});}exports[_0x77a0('0x59')]=function(_0x413d3a){return getJobs(_0x413d3a);};exports[_0x77a0('0x5a')]=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 bc623ea..ca20e7c 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 _0x6035=['forEach','push','all','catch','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','bucket','Cloud\x20Provider\x20not\x20configured','Negative','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured'];(function(_0x3fe55e,_0xbc5d21){var _0x2a3f3f=function(_0x1a5939){while(--_0x1a5939){_0x3fe55e['push'](_0x3fe55e['shift']());}};_0x2a3f3f(++_0xbc5d21);}(_0x6035,0xef));var _0x5603=function(_0x13fbd6,_0x33957e){_0x13fbd6=_0x13fbd6-0x0;var _0x5a9d7d=_0x6035[_0x13fbd6];return _0x5a9d7d;};var _=require(_0x5603('0x0'));var AWS=require(_0x5603('0x1'));var rp=require(_0x5603('0x2'));var util=require(_0x5603('0x3'));var BPromise=require(_0x5603('0x4'));var db=require(_0x5603('0x5'))['db'];var logger=require(_0x5603('0x6'))(_0x5603('0x7'));function getTranscriptionJob(_0x2820a4,_0x53cb97,_0x3cc093,_0x4ec163){return new Promise(function(_0x4509cc,_0x140ccf){var _0x5c2bd8=new AWS[(_0x5603('0x8'))]({'accessKeyId':_0x53cb97,'secretAccessKey':_0x2820a4,'region':_0x3cc093});_0x5c2bd8[_0x5603('0x9')]({'TranscriptionJobName':_0x4ec163},function(_0x526c2d,_0x46c7f9){if(_0x526c2d){return _0x140ccf(_0x526c2d);}else{return _0x4509cc(_0x46c7f9);}});});}function sentiment(_0x56059d,_0x385247,_0x34e0f6,_0x2e083f,_0x4b55c5){return new Promise(function(_0x4ee132,_0x288cb0){var _0x265a1c=new AWS[(_0x5603('0xa'))]({'accessKeyId':_0x385247,'secretAccessKey':_0x56059d,'region':_0x34e0f6});_0x265a1c[_0x5603('0xb')]({'Text':_0x2e083f,'LanguageCode':_0x4b55c5[_0x5603('0xc')](0x0,0x2)},function(_0x1ec7f1,_0x13c903){if(_0x1ec7f1){return _0x288cb0(_0x1ec7f1);}else{return _0x4ee132(_0x13c903);}});});}function checkTranscribeJob(_0x35ecfa,_0xe73b1d,_0x4eaf0c){var _0x2bcc49;return new BPromise(function(_0x3581e2,_0x36411b){logger[_0x5603('0xd')](util['format'](_0x5603('0xe'),_0x35ecfa['id'],_0x35ecfa[_0x5603('0xf')]));return getTranscriptionJob(_0x4eaf0c[_0x5603('0x10')],_0x4eaf0c[_0x5603('0x11')],_0xe73b1d[_0x5603('0x12')],_0x35ecfa[_0x5603('0xf')])[_0x5603('0x13')](function(_0x278382){logger[_0x5603('0xd')](util[_0x5603('0x14')](_0x5603('0x15'),_0x35ecfa['id'],_0x35ecfa[_0x5603('0xf')],_0x278382['TranscriptionJob'][_0x5603('0x16')]));if(!_0x35ecfa[_0x5603('0x17')]){switch(_0x278382[_0x5603('0x18')][_0x5603('0x16')]){case _0x5603('0x19'):var _0x39bfc1={'transcribeStatus':_0x278382[_0x5603('0x18')][_0x5603('0x16')],'fileUri':_0x278382[_0x5603('0x18')][_0x5603('0x1a')][_0x5603('0x1b')]};logger['info'](util[_0x5603('0x14')]('[RECORDING:%d]\x20Get\x20transcript',_0x35ecfa['id']));return rp({'uri':_0x278382[_0x5603('0x18')]['Transcript'][_0x5603('0x1b')],'json':!![]})['then'](function(_0x1c8040){logger[_0x5603('0xd')](util[_0x5603('0x14')](_0x5603('0x1c'),_0x35ecfa['id']));if(_0x1c8040&&_0x1c8040['results']&&_0x1c8040[_0x5603('0x1d')][_0x5603('0x1e')]&&_0x1c8040[_0x5603('0x1d')][_0x5603('0x1e')]['length']){_0x39bfc1['fileText']='';for(var _0x148c28=0x0;_0x148c28<_0x1c8040[_0x5603('0x1d')]['transcripts'][_0x5603('0x1f')];_0x148c28++){_0x39bfc1[_0x5603('0x17')]+=_0x1c8040['results'][_0x5603('0x1e')][_0x148c28]['transcript']+'';}}return _0x35ecfa[_0x5603('0x20')](_0x39bfc1);})['then'](function(){logger[_0x5603('0xd')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x35ecfa['id']));if(!_0x35ecfa[_0x5603('0x21')]){throw new db['Sequelize'][(_0x5603('0x22'))](_0x5603('0x23'));}if(!_0xe73b1d['sentiment']||!_0xe73b1d[_0x5603('0x24')]||!_0xe73b1d[_0x5603('0x25')]||!_0xe73b1d[_0x5603('0x26')]||!_0xe73b1d['bucket']){throw new db[(_0x5603('0x27'))][(_0x5603('0x22'))](_0x5603('0x28'));}if(!_0x39bfc1[_0x5603('0x17')]){throw new Error(_0x5603('0x29'));}if(_0xe73b1d[_0x5603('0x24')]===_0x4eaf0c['id']){return _0x4eaf0c;}else{return db[_0x5603('0x2a')][_0x5603('0x2b')]({'where':{'id':_settings[_0x5603('0x24')]}});}})['then'](function(_0x5c9e8e){if(!_0x5c9e8e){throw new db[(_0x5603('0x27'))][(_0x5603('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5c9e8e['data1']||!_0x5c9e8e[_0x5603('0x11')]){throw new db[(_0x5603('0x27'))][(_0x5603('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x2bcc49=_0x5c9e8e;logger['info'](util[_0x5603('0x14')](_0x5603('0x2c'),_0x35ecfa['id']));return sentiment(_0x2bcc49[_0x5603('0x10')],_0x2bcc49['data2'],_0xe73b1d[_0x5603('0x25')],_0x39bfc1[_0x5603('0x17')],_0xe73b1d['language']);})[_0x5603('0x13')](function(_0x1489a2){logger[_0x5603('0xd')](util[_0x5603('0x14')](_0x5603('0x2d'),_0x35ecfa['id']));return _0x35ecfa[_0x5603('0x20')]({'sentiment':_0x1489a2[_0x5603('0x2e')],'sPositive':_0x1489a2['SentimentScore'][_0x5603('0x2f')],'sNegative':_0x1489a2[_0x5603('0x30')]['Negative'],'sMixed':_0x1489a2[_0x5603('0x30')][_0x5603('0x31')],'sNeutral':_0x1489a2[_0x5603('0x30')][_0x5603('0x32')]});})[_0x5603('0x13')](function(){logger[_0x5603('0xd')](util['format'](_0x5603('0x33'),_0x35ecfa['id']));_0x3581e2();});case _0x5603('0x34'):return _0x35ecfa[_0x5603('0x20')]({'transcribeStatus':'FAILED','failureReason':_0x278382[_0x5603('0x18')][_0x5603('0x35')]})['then'](function(){logger[_0x5603('0xd')](util[_0x5603('0x14')](_0x5603('0x33'),_0x35ecfa['id']));_0x3581e2();});default:logger['info'](util[_0x5603('0x14')](_0x5603('0x36'),_0x35ecfa['id']));break;}}else{return BPromise[_0x5603('0x37')]()['then'](function(){if(!_0x35ecfa['tempSentiment']){throw new db['Sequelize'][(_0x5603('0x22'))](_0x5603('0x23'));}if(!_0xe73b1d[_0x5603('0x38')]||!_0xe73b1d['sentimentAccountId']||!_0xe73b1d[_0x5603('0x25')]||!_0xe73b1d['language']||!_0xe73b1d[_0x5603('0x39')]){throw new db[(_0x5603('0x27'))][(_0x5603('0x22'))](_0x5603('0x28'));}if(!_0x35ecfa[_0x5603('0x17')]){throw new Error(_0x5603('0x29'));}if(_0xe73b1d[_0x5603('0x24')]===_0x4eaf0c['id']){return _0x4eaf0c;}else{return db[_0x5603('0x2a')]['findOne']({'where':{'id':_settings[_0x5603('0x24')]}});}})['then'](function(_0x4e1c02){if(!_0x4e1c02){throw new db[(_0x5603('0x27'))][(_0x5603('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4e1c02['data1']||!_0x4e1c02[_0x5603('0x11')]){throw new db['Sequelize'][(_0x5603('0x22'))](_0x5603('0x3a'));}_0x2bcc49=_0x4e1c02;logger['info'](util[_0x5603('0x14')](_0x5603('0x2c'),_0x35ecfa['id']));return sentiment(_0x2bcc49['data1'],_0x2bcc49[_0x5603('0x11')],_0xe73b1d[_0x5603('0x25')],_0x35ecfa[_0x5603('0x17')],_0xe73b1d[_0x5603('0x26')]);})[_0x5603('0x13')](function(_0x5dd5f8){logger[_0x5603('0xd')](util[_0x5603('0x14')](_0x5603('0x2d'),_0x35ecfa['id']));return _0x35ecfa[_0x5603('0x20')]({'sentiment':_0x5dd5f8[_0x5603('0x2e')],'sPositive':_0x5dd5f8[_0x5603('0x30')]['Positive'],'sNegative':_0x5dd5f8[_0x5603('0x30')][_0x5603('0x3b')],'sMixed':_0x5dd5f8[_0x5603('0x30')][_0x5603('0x31')],'sNeutral':_0x5dd5f8[_0x5603('0x30')][_0x5603('0x32')],'transcribeStatus':_0x5603('0x19')});})[_0x5603('0x13')](function(){logger['info'](util[_0x5603('0x14')](_0x5603('0x33'),_0x35ecfa['id']));_0x3581e2();});}})['catch'](function(_0x56c710){if(_0x56c710){if(!_0x56c710[_0x5603('0x3c')]||_0x56c710[_0x5603('0x3c')]!==_0x5603('0x3d')){logger[_0x5603('0x3e')](util['format'](_0x5603('0x3f'),_0x35ecfa['id']),util[_0x5603('0x40')](_0x56c710,{'showHidden':![],'depth':null}));}}_0x3581e2();});});}function checkTranscribe(){var _0x399c2a;var _0x2a39f3;var _0x3625c7;return db[_0x5603('0x41')][_0x5603('0x42')]({'where':{'transcribeStatus':_0x5603('0x43')}})['then'](function(_0x480124){if(!_0x480124||!_0x480124['length']){throw new db[(_0x5603('0x27'))][(_0x5603('0x22'))](_0x5603('0x44'));}_0x399c2a=_0x480124;return db[_0x5603('0x45')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x13df90){if(!_0x13df90){throw new db[(_0x5603('0x27'))]['ValidationError'](_0x5603('0x46'));}_0x2a39f3=_0x13df90;if(!_0x2a39f3['transcribe']||!_0x2a39f3[_0x5603('0x47')]||!_0x2a39f3[_0x5603('0x12')]||!_0x2a39f3[_0x5603('0x26')]||!_0x2a39f3['bucket']){throw new db['Sequelize']['ValidationError'](_0x5603('0x48'));}return db['CloudProvider']['findOne']({'where':{'id':_0x2a39f3[_0x5603('0x47')]}});})[_0x5603('0x13')](function(_0x46864c){if(!_0x46864c){throw new db[(_0x5603('0x27'))][(_0x5603('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x46864c[_0x5603('0x10')]||!_0x46864c['data2']){throw new db[(_0x5603('0x27'))][(_0x5603('0x22'))](_0x5603('0x3a'));}_0x3625c7=_0x46864c;var _0x150594=[];_0x399c2a[_0x5603('0x49')](function(_0x35c7b2){_0x150594[_0x5603('0x4a')](checkTranscribeJob(_0x35c7b2,_0x2a39f3,_0x3625c7));});return BPromise[_0x5603('0x4b')](_0x150594);})[_0x5603('0x4c')](function(_0x14ce17){if(_0x14ce17){if(!_0x14ce17[_0x5603('0x3c')]||_0x14ce17[_0x5603('0x3c')]!==_0x5603('0x3d')){logger[_0x5603('0x3e')](util[_0x5603('0x40')](_0x14ce17,{'showHidden':![],'depth':null}));}}});}exports[_0x5603('0x4d')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xedcb=['TranscriptionJobStatus','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','COMPLETED','catch','SequelizeValidationError','error','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','all','name','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xedcb,0xcd));var _0xbedc=function(_0x53b3bb,_0x38dc9e){_0x53b3bb=_0x53b3bb-0x0;var _0x276440=_0xedcb[_0x53b3bb];return _0x276440;};var _=require(_0xbedc('0x0'));var AWS=require(_0xbedc('0x1'));var rp=require(_0xbedc('0x2'));var util=require(_0xbedc('0x3'));var BPromise=require(_0xbedc('0x4'));var db=require(_0xbedc('0x5'))['db'];var logger=require(_0xbedc('0x6'))(_0xbedc('0x7'));function getTranscriptionJob(_0x850926,_0xe70ea8,_0x17643e,_0x142897){return new Promise(function(_0xd28c66,_0x44f4f2){var _0x20ff26=new AWS['TranscribeService']({'accessKeyId':_0xe70ea8,'secretAccessKey':_0x850926,'region':_0x17643e});_0x20ff26['getTranscriptionJob']({'TranscriptionJobName':_0x142897},function(_0x5430ae,_0x377b0b){if(_0x5430ae){return _0x44f4f2(_0x5430ae);}else{return _0xd28c66(_0x377b0b);}});});}function sentiment(_0x3c9fdb,_0x3bd814,_0x50ccd4,_0x3123b3,_0x16a285){return new Promise(function(_0x2be6af,_0x5e0c3c){var _0x3cbe34=new AWS[(_0xbedc('0x8'))]({'accessKeyId':_0x3bd814,'secretAccessKey':_0x3c9fdb,'region':_0x50ccd4});_0x3cbe34[_0xbedc('0x9')]({'Text':_0x3123b3,'LanguageCode':_0x16a285[_0xbedc('0xa')](0x0,0x2)},function(_0x1e3e28,_0x47a210){if(_0x1e3e28){return _0x5e0c3c(_0x1e3e28);}else{return _0x2be6af(_0x47a210);}});});}function checkTranscribeJob(_0x6d7996,_0x3040ea,_0xe17d01){var _0x8372af;return new BPromise(function(_0x449a34,_0x21ad19){logger[_0xbedc('0xb')](util[_0xbedc('0xc')](_0xbedc('0xd'),_0x6d7996['id'],_0x6d7996[_0xbedc('0xe')]));return getTranscriptionJob(_0xe17d01['data1'],_0xe17d01['data2'],_0x3040ea[_0xbedc('0xf')],_0x6d7996['transcribeName'])[_0xbedc('0x10')](function(_0x3a5850){logger[_0xbedc('0xb')](util[_0xbedc('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x6d7996['id'],_0x6d7996[_0xbedc('0xe')],_0x3a5850['TranscriptionJob'][_0xbedc('0x11')]));if(!_0x6d7996['fileText']){switch(_0x3a5850[_0xbedc('0x12')][_0xbedc('0x11')]){case'COMPLETED':var _0x2dd031={'transcribeStatus':_0x3a5850[_0xbedc('0x12')][_0xbedc('0x11')],'fileUri':_0x3a5850[_0xbedc('0x12')][_0xbedc('0x13')][_0xbedc('0x14')]};logger[_0xbedc('0xb')](util[_0xbedc('0xc')](_0xbedc('0x15'),_0x6d7996['id']));return rp({'uri':_0x3a5850[_0xbedc('0x12')][_0xbedc('0x13')][_0xbedc('0x14')],'json':!![]})[_0xbedc('0x10')](function(_0x321880){logger['info'](util[_0xbedc('0xc')](_0xbedc('0x16'),_0x6d7996['id']));if(_0x321880&&_0x321880['results']&&_0x321880[_0xbedc('0x17')][_0xbedc('0x18')]&&_0x321880[_0xbedc('0x17')][_0xbedc('0x18')][_0xbedc('0x19')]){_0x2dd031[_0xbedc('0x1a')]='';for(var _0x569374=0x0;_0x569374<_0x321880[_0xbedc('0x17')][_0xbedc('0x18')]['length'];_0x569374++){_0x2dd031['fileText']+=_0x321880['results']['transcripts'][_0x569374][_0xbedc('0x1b')]+'';}}return _0x6d7996[_0xbedc('0x1c')](_0x2dd031);})[_0xbedc('0x10')](function(){logger[_0xbedc('0xb')](util[_0xbedc('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x6d7996['id']));if(!_0x6d7996['tempSentiment']){throw new db['Sequelize']['ValidationError'](_0xbedc('0x1d'));}if(!_0x3040ea[_0xbedc('0x1e')]||!_0x3040ea[_0xbedc('0x1f')]||!_0x3040ea['sentimentRegion']||!_0x3040ea[_0xbedc('0x20')]||!_0x3040ea[_0xbedc('0x21')]){throw new db[(_0xbedc('0x22'))]['ValidationError'](_0xbedc('0x23'));}if(!_0x2dd031[_0xbedc('0x1a')]){throw new Error(_0xbedc('0x24'));}if(_0x3040ea[_0xbedc('0x1f')]===_0xe17d01['id']){return _0xe17d01;}else{return db[_0xbedc('0x25')][_0xbedc('0x26')]({'where':{'id':_settings[_0xbedc('0x1f')]}});}})[_0xbedc('0x10')](function(_0x5c3c51){if(!_0x5c3c51){throw new db[(_0xbedc('0x22'))][(_0xbedc('0x27'))](_0xbedc('0x28'));}if(!_0x5c3c51[_0xbedc('0x29')]||!_0x5c3c51[_0xbedc('0x2a')]){throw new db[(_0xbedc('0x22'))]['ValidationError'](_0xbedc('0x2b'));}_0x8372af=_0x5c3c51;logger[_0xbedc('0xb')](util[_0xbedc('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x6d7996['id']));return sentiment(_0x8372af[_0xbedc('0x29')],_0x8372af[_0xbedc('0x2a')],_0x3040ea[_0xbedc('0x2c')],_0x2dd031[_0xbedc('0x1a')],_0x3040ea['language']);})[_0xbedc('0x10')](function(_0x59eed3){logger[_0xbedc('0xb')](util[_0xbedc('0xc')](_0xbedc('0x2d'),_0x6d7996['id']));return _0x6d7996['update']({'sentiment':_0x59eed3[_0xbedc('0x2e')],'sPositive':_0x59eed3[_0xbedc('0x2f')][_0xbedc('0x30')],'sNegative':_0x59eed3[_0xbedc('0x2f')][_0xbedc('0x31')],'sMixed':_0x59eed3[_0xbedc('0x2f')][_0xbedc('0x32')],'sNeutral':_0x59eed3['SentimentScore'][_0xbedc('0x33')]});})[_0xbedc('0x10')](function(){logger[_0xbedc('0xb')](util[_0xbedc('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x6d7996['id']));_0x449a34();});case'FAILED':return _0x6d7996[_0xbedc('0x1c')]({'transcribeStatus':_0xbedc('0x34'),'failureReason':_0x3a5850[_0xbedc('0x12')][_0xbedc('0x35')]})[_0xbedc('0x10')](function(){logger[_0xbedc('0xb')](util[_0xbedc('0xc')](_0xbedc('0x36'),_0x6d7996['id']));_0x449a34();});default:logger[_0xbedc('0xb')](util[_0xbedc('0xc')](_0xbedc('0x37'),_0x6d7996['id']));break;}}else{return BPromise[_0xbedc('0x38')]()['then'](function(){if(!_0x6d7996[_0xbedc('0x39')]){throw new db[(_0xbedc('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x3040ea[_0xbedc('0x1e')]||!_0x3040ea[_0xbedc('0x1f')]||!_0x3040ea['sentimentRegion']||!_0x3040ea[_0xbedc('0x20')]||!_0x3040ea[_0xbedc('0x21')]){throw new db[(_0xbedc('0x22'))][(_0xbedc('0x27'))](_0xbedc('0x23'));}if(!_0x6d7996[_0xbedc('0x1a')]){throw new Error(_0xbedc('0x24'));}if(_0x3040ea[_0xbedc('0x1f')]===_0xe17d01['id']){return _0xe17d01;}else{return db[_0xbedc('0x25')][_0xbedc('0x26')]({'where':{'id':_settings[_0xbedc('0x1f')]}});}})[_0xbedc('0x10')](function(_0x277c4d){if(!_0x277c4d){throw new db[(_0xbedc('0x22'))][(_0xbedc('0x27'))](_0xbedc('0x28'));}if(!_0x277c4d[_0xbedc('0x29')]||!_0x277c4d[_0xbedc('0x2a')]){throw new db[(_0xbedc('0x22'))]['ValidationError'](_0xbedc('0x2b'));}_0x8372af=_0x277c4d;logger[_0xbedc('0xb')](util[_0xbedc('0xc')](_0xbedc('0x3a'),_0x6d7996['id']));return sentiment(_0x8372af[_0xbedc('0x29')],_0x8372af[_0xbedc('0x2a')],_0x3040ea[_0xbedc('0x2c')],_0x6d7996[_0xbedc('0x1a')],_0x3040ea[_0xbedc('0x20')]);})[_0xbedc('0x10')](function(_0x190399){logger[_0xbedc('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x6d7996['id']));return _0x6d7996[_0xbedc('0x1c')]({'sentiment':_0x190399['Sentiment'],'sPositive':_0x190399['SentimentScore'][_0xbedc('0x30')],'sNegative':_0x190399[_0xbedc('0x2f')][_0xbedc('0x31')],'sMixed':_0x190399[_0xbedc('0x2f')][_0xbedc('0x32')],'sNeutral':_0x190399[_0xbedc('0x2f')]['Neutral'],'transcribeStatus':_0xbedc('0x3b')});})[_0xbedc('0x10')](function(){logger[_0xbedc('0xb')](util['format'](_0xbedc('0x36'),_0x6d7996['id']));_0x449a34();});}})[_0xbedc('0x3c')](function(_0x378054){if(_0x378054){if(!_0x378054['name']||_0x378054['name']!==_0xbedc('0x3d')){logger[_0xbedc('0x3e')](util[_0xbedc('0xc')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x6d7996['id']),util[_0xbedc('0x3f')](_0x378054,{'showHidden':![],'depth':null}));}}_0x449a34();});});}function checkTranscribe(){var _0x80ef29;var _0x12b1e6;var _0x59082a;return db[_0xbedc('0x40')][_0xbedc('0x41')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xbedc('0x10')](function(_0x59cac9){if(!_0x59cac9||!_0x59cac9[_0xbedc('0x19')]){throw new db[(_0xbedc('0x22'))][(_0xbedc('0x27'))](_0xbedc('0x42'));}_0x80ef29=_0x59cac9;return db[_0xbedc('0x43')][_0xbedc('0x26')]({'where':{'id':0x1}});})[_0xbedc('0x10')](function(_0xc00f42){if(!_0xc00f42){throw new db['Sequelize'][(_0xbedc('0x27'))](_0xbedc('0x44'));}_0x12b1e6=_0xc00f42;if(!_0x12b1e6[_0xbedc('0x7')]||!_0x12b1e6[_0xbedc('0x45')]||!_0x12b1e6[_0xbedc('0xf')]||!_0x12b1e6[_0xbedc('0x20')]||!_0x12b1e6['bucket']){throw new db[(_0xbedc('0x22'))]['ValidationError'](_0xbedc('0x46'));}return db[_0xbedc('0x25')][_0xbedc('0x26')]({'where':{'id':_0x12b1e6[_0xbedc('0x45')]}});})[_0xbedc('0x10')](function(_0x5c6e7b){if(!_0x5c6e7b){throw new db[(_0xbedc('0x22'))][(_0xbedc('0x27'))](_0xbedc('0x28'));}if(!_0x5c6e7b['data1']||!_0x5c6e7b['data2']){throw new db['Sequelize'][(_0xbedc('0x27'))]('Cloud\x20Provider\x20not\x20configured');}_0x59082a=_0x5c6e7b;var _0x477eb8=[];_0x80ef29['forEach'](function(_0xd80516){_0x477eb8[_0xbedc('0x47')](checkTranscribeJob(_0xd80516,_0x12b1e6,_0x59082a));});return BPromise[_0xbedc('0x48')](_0x477eb8);})['catch'](function(_0x2fd833){if(_0x2fd833){if(!_0x2fd833[_0xbedc('0x49')]||_0x2fd833['name']!=='SequelizeValidationError'){logger[_0xbedc('0x3e')](util[_0xbedc('0x3f')](_0x2fd833,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 632a38d..00bf0ca 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 _0x1eb3=['ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','lastMsgAt','hours','then','length','map','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x1eb3,0x137));var _0x31eb=function(_0x57627f,_0x300525){_0x57627f=_0x57627f-0x0;var _0x238f09=_0x1eb3[_0x57627f];return _0x238f09;};'use strict';var _=require(_0x31eb('0x0'));var moment=require('moment');var Redis=require(_0x31eb('0x1'));var util=require(_0x31eb('0x2'));var config=require('../../config/environment');var db=require(_0x31eb('0x3'))['db'];var logger=require(_0x31eb('0x4'))(_0x31eb('0x5'));config[_0x31eb('0x6')]=_[_0x31eb('0x7')](config[_0x31eb('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x31eb('0x8'))(new Redis(config[_0x31eb('0x6')]));function closeInteractions(){var _0x2dc04c=[];return db[_0x31eb('0x9')]['findAll']({'raw':!![],'attributes':['id',_0x31eb('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x31eb('0xb'))}}})[_0x31eb('0xc')](function(_0x3da01a){if(_0x3da01a&&_0x3da01a[_0x31eb('0xd')]){_0x2dc04c=_[_0x31eb('0xe')](_0x3da01a||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2dc04c['join']());return db[_0x31eb('0x9')][_0x31eb('0xf')]({'closeReason':_0x31eb('0x10'),'disposition':_0x31eb('0x11'),'closed':!![],'closedAt':moment()['format'](_0x31eb('0x12'))},{'where':{'id':_0x2dc04c}});}})['then'](function(){if(_0x2dc04c&&_0x2dc04c[_0x31eb('0xd')]){logger[_0x31eb('0x13')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2dc04c['join']());for(var _0x62c8fe=0x0;_0x62c8fe<_0x2dc04c[_0x31eb('0xd')];_0x62c8fe++){io[_0x31eb('0x14')](_0x31eb('0x15'),{'id':_0x2dc04c[_0x62c8fe],'closed':!![]});}}})[_0x31eb('0x16')](function(_0x546ed3){logger[_0x31eb('0x17')](_0x31eb('0x18'),_0x546ed3?util[_0x31eb('0x19')](_0x546ed3,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xca0e=['catch','[WHATSAPP]\x20Error\x20closing\x20interactions','moment','ioredis','../../config/environment','../../mysqldb','schedule','defaults','redis','localhost','WhatsappInteraction','lastMsgAt','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','whatsappInteraction:update'];(function(_0x590a23,_0x511936){var _0x15f083=function(_0x3c0307){while(--_0x3c0307){_0x590a23['push'](_0x590a23['shift']());}};_0x15f083(++_0x511936);}(_0xca0e,0x15b));var _0xeca0=function(_0x122b35,_0x303a67){_0x122b35=_0x122b35-0x0;var _0x564541=_0xca0e[_0x122b35];return _0x564541;};'use strict';var _=require('lodash');var moment=require(_0xeca0('0x0'));var Redis=require(_0xeca0('0x1'));var util=require('util');var config=require(_0xeca0('0x2'));var db=require(_0xeca0('0x3'))['db'];var logger=require('../logger')(_0xeca0('0x4'));config['redis']=_[_0xeca0('0x5')](config[_0xeca0('0x6')],{'host':_0xeca0('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xeca0('0x6')]));function closeInteractions(){var _0xd333d3=[];return db[_0xeca0('0x8')]['findAll']({'raw':!![],'attributes':['id',_0xeca0('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xeca0('0xa')](function(_0x5e4257){if(_0x5e4257&&_0x5e4257['length']){_0xd333d3=_[_0xeca0('0xb')](_0x5e4257||[],'id');logger[_0xeca0('0xc')](_0xeca0('0xd'),_0xd333d3['join']());return db['WhatsappInteraction']['update']({'closeReason':'system','disposition':_0xeca0('0xe'),'closed':!![],'closedAt':moment()[_0xeca0('0xf')](_0xeca0('0x10'))},{'where':{'id':_0xd333d3}});}})[_0xeca0('0xa')](function(){if(_0xd333d3&&_0xd333d3[_0xeca0('0x11')]){logger[_0xeca0('0xc')](_0xeca0('0x12'),_0xd333d3[_0xeca0('0x13')]());for(var _0x47efaa=0x0;_0x47efaa<_0xd333d3['length'];_0x47efaa++){io['emit'](_0xeca0('0x14'),{'id':_0xd333d3[_0x47efaa],'closed':!![]});}}})[_0xeca0('0x15')](function(_0x27df25){logger['error'](_0xeca0('0x16'),_0x27df25?util['inspect'](_0x27df25,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 7fe3bbc..5b37084 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ac=['catch','util','../mysqldb','innocenzo.biondo','@xcally.com','now','push','Innocenzo','then','CmContact','log','finished\x20populating','contacts1','destroy','CmHopper','hopper1','bulkCreate','hopper2'];(function(_0x368590,_0x48ad74){var _0x5ceb60=function(_0x322b8e){while(--_0x322b8e){_0x368590['push'](_0x368590['shift']());}};_0x5ceb60(++_0x48ad74);}(_0x54ac,0x1c3));var _0xc54a=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0x54ac[_0xb7a459];return _0x104ab5;};'use strict';var util=require(_0xc54a('0x0'));var db=require(_0xc54a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xc54a('0x2')+i+_0xc54a('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xc54a('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc54a('0x4')](),'updatedAt':Date[_0xc54a('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc54a('0x5')]({'id':i,'firstName':_0xc54a('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xc54a('0x2')+i+_0xc54a('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc54a('0x4')](),'updatedAt':Date[_0xc54a('0x4')]()});}db['CmContact']['destroy']({'where':{}})[_0xc54a('0x7')](function(){return db[_0xc54a('0x8')]['bulkCreate'](contacts);})[_0xc54a('0x7')](function(){console[_0xc54a('0x9')](_0xc54a('0xa'),_0xc54a('0xb'));return db['CmHopper'][_0xc54a('0xc')]({'where':{}});})['then'](function(){return db[_0xc54a('0xd')]['bulkCreate'](hopper);})[_0xc54a('0x7')](function(){console[_0xc54a('0x9')](_0xc54a('0xa'),_0xc54a('0xe'));return db[_0xc54a('0x8')][_0xc54a('0xf')](contacts2);})[_0xc54a('0x7')](function(){console[_0xc54a('0x9')](_0xc54a('0xa'),'contacts2');return db[_0xc54a('0xd')][_0xc54a('0xf')](hopper2);})[_0xc54a('0x7')](function(){console[_0xc54a('0x9')]('finished\x20populating',_0xc54a('0x10'));})[_0xc54a('0x11')](function(_0x3f71fb){console['log'](_0x3f71fb);}); \ No newline at end of file +var _0xc4ea=['bulkCreate','finished\x20populating','CmHopper','log','contacts2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','then'];(function(_0x4858bc,_0x176641){var _0x5f2e11=function(_0x45866b){while(--_0x45866b){_0x4858bc['push'](_0x4858bc['shift']());}};_0x5f2e11(++_0x176641);}(_0xc4ea,0x9f));var _0xac4e=function(_0x471b7f,_0x597519){_0x471b7f=_0x471b7f-0x0;var _0x4b9a15=_0xc4ea[_0x471b7f];return _0x4b9a15;};'use strict';var util=require(_0xac4e('0x0'));var db=require(_0xac4e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xac4e('0x2')]({'id':i,'firstName':_0xac4e('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xac4e('0x4')+i+_0xac4e('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xac4e('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xac4e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xac4e('0x6')](),'updatedAt':Date[_0xac4e('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xac4e('0x2')]({'id':i,'firstName':_0xac4e('0x3')+i,'lastName':_0xac4e('0x7')+i,'phone':0xf879fb460+i,'email':_0xac4e('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xac4e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xac4e('0x6')](),'updatedAt':Date['now']()});}db[_0xac4e('0x8')][_0xac4e('0x9')]({'where':{}})[_0xac4e('0xa')](function(){return db[_0xac4e('0x8')][_0xac4e('0xb')](contacts);})['then'](function(){console['log'](_0xac4e('0xc'),'contacts1');return db[_0xac4e('0xd')][_0xac4e('0x9')]({'where':{}});})[_0xac4e('0xa')](function(){return db['CmHopper']['bulkCreate'](hopper);})['then'](function(){console[_0xac4e('0xe')]('finished\x20populating','hopper1');return db[_0xac4e('0x8')][_0xac4e('0xb')](contacts2);})[_0xac4e('0xa')](function(){console[_0xac4e('0xe')]('finished\x20populating',_0xac4e('0xf'));return db[_0xac4e('0xd')][_0xac4e('0xb')](hopper2);})[_0xac4e('0xa')](function(){console[_0xac4e('0xe')](_0xac4e('0xc'),'hopper2');})[_0xac4e('0x10')](function(_0x1d4083){console['log'](_0x1d4083);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 4517949..fe00a4f 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c03=['udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','%s%s@xcally.com','agent','password','friend'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5c03,0xdd));var _0x35c0=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x5c03[_0x16d10f];return _0x50c823;};'use strict';var util=require(_0x35c0('0x0'));var db=require(_0x35c0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x35c0('0x2')]({'name':util[_0x35c0('0x3')]('%s%s','agent',i),'fullname':util[_0x35c0('0x3')](_0x35c0('0x4'),'agent',i),'email':util[_0x35c0('0x3')](_0x35c0('0x5'),_0x35c0('0x6'),i),'role':_0x35c0('0x6'),'password':_0x35c0('0x7'),'internal':0xfa0+i,'type':_0x35c0('0x8'),'transport':[_0x35c0('0x9'),'ws',_0x35c0('0xa')],'disallow':[_0x35c0('0xb')],'allow':[_0x35c0('0xc')],'defaultuser':util[_0x35c0('0x3')](_0x35c0('0x4'),'agent',i),'encryption':_0x35c0('0xd'),'avpf':_0x35c0('0xd'),'force_avp':_0x35c0('0xd'),'icesupport':_0x35c0('0xd'),'dtlsenable':_0x35c0('0xd'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x35c0('0xe'),'dtlssetup':_0x35c0('0xf'),'callerid':util[_0x35c0('0x3')](_0x35c0('0x10'),util[_0x35c0('0x3')](_0x35c0('0x4'),_0x35c0('0x6'),i),0xfa0+i)});}db[_0x35c0('0x11')][_0x35c0('0x12')](users)[_0x35c0('0x13')](function(){console[_0x35c0('0x14')](_0x35c0('0x15'));})[_0x35c0('0x16')](function(_0x2be920){console['log'](_0x2be920);}); \ No newline at end of file +var _0xc311=['log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then'];(function(_0xcfe9f,_0x1ef873){var _0x30b0b0=function(_0x1ff2b0){while(--_0x1ff2b0){_0xcfe9f['push'](_0xcfe9f['shift']());}};_0x30b0b0(++_0x1ef873);}(_0xc311,0x15c));var _0x1c31=function(_0x1a10d4,_0x3161d9){_0x1a10d4=_0x1a10d4-0x0;var _0x5d0cec=_0xc311[_0x1a10d4];return _0x5d0cec;};'use strict';var util=require(_0x1c31('0x0'));var db=require(_0x1c31('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1c31('0x2')]({'name':util[_0x1c31('0x3')](_0x1c31('0x4'),_0x1c31('0x5'),i),'fullname':util[_0x1c31('0x3')](_0x1c31('0x4'),_0x1c31('0x5'),i),'email':util['format']('%s%s@xcally.com',_0x1c31('0x5'),i),'role':_0x1c31('0x5'),'password':_0x1c31('0x6'),'internal':0xfa0+i,'type':_0x1c31('0x7'),'transport':[_0x1c31('0x8'),'ws',_0x1c31('0x9')],'disallow':[_0x1c31('0xa')],'allow':[_0x1c31('0xb')],'defaultuser':util[_0x1c31('0x3')](_0x1c31('0x4'),_0x1c31('0x5'),i),'encryption':_0x1c31('0xc'),'avpf':_0x1c31('0xc'),'force_avp':_0x1c31('0xc'),'icesupport':_0x1c31('0xc'),'dtlsenable':_0x1c31('0xc'),'dtlsverify':'no','dtlscertfile':_0x1c31('0xd'),'dtlsprivatekey':_0x1c31('0xe'),'dtlssetup':_0x1c31('0xf'),'callerid':util[_0x1c31('0x3')](_0x1c31('0x10'),util[_0x1c31('0x3')]('%s%s',_0x1c31('0x5'),i),0xfa0+i)});}db[_0x1c31('0x11')][_0x1c31('0x12')](users)[_0x1c31('0x13')](function(){console[_0x1c31('0x14')](_0x1c31('0x15'));})[_0x1c31('0x16')](function(_0x1326fc){console['log'](_0x1326fc);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index d5861f6..57e831f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d15=['remotePort','connectedAt','log','SocketIO\x20','address','disconnect','CONNECTED','util','bluebird','./environment','name','Agents','role','agent','telephone','type','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','User','where','Campaign','ivr','format','length','user:%s','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','WhatsappQueue','user','ChatQueue','OpenchannelQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','map','ChatInteractions','removeMailInteractions','emit','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','connection','setMaxListeners','request'];(function(_0x584448,_0x441cc5){var _0x2be23d=function(_0x1f479d){while(--_0x1f479d){_0x584448['push'](_0x584448['shift']());}};_0x2be23d(++_0x441cc5);}(_0x3d15,0x127));var _0x53d1=function(_0x4fcce9,_0x34391a){_0x4fcce9=_0x4fcce9-0x0;var _0x1d5a34=_0x3d15[_0x4fcce9];return _0x1d5a34;};'use strict';var _=require('lodash');var util=require(_0x53d1('0x0'));var BPromise=require(_0x53d1('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x53d1('0x2'));var queryQueues={'attributes':['id',_0x53d1('0x3')],'include':[{'as':_0x53d1('0x4'),'model':db['User'],'attributes':['id',_0x53d1('0x3'),_0x53d1('0x5')],'raw':!![],'where':{'role':_0x53d1('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x53d1('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x53d1('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x53d1('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x53d1('0x3'),_0x53d1('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x328eb3,_0x38a208,_0x59f965){return db['UserProfileSection'][_0x53d1('0x9')]({'where':{'name':_0x328eb3,'userProfileId':_0x38a208},'raw':!![]})['then'](function(_0x110035){if(_0x110035){if(_0x110035[_0x53d1('0xa')]){switch(_0x328eb3){case _0x53d1('0xb'):case _0x53d1('0xc'):case _0x53d1('0xd'):case _0x53d1('0xe'):case _0x53d1('0xf'):case _0x53d1('0x10'):case'WhatsappQueues':return db[_0x59f965][_0x53d1('0x11')](queryQueues);case _0x53d1('0x12'):return db[_0x59f965][_0x53d1('0x11')](queryTelephones);case _0x53d1('0x13'):return db[_0x59f965][_0x53d1('0x11')](queryTrunks);case _0x53d1('0x14'):return db[_0x59f965][_0x53d1('0x11')](queryCampaigns);}}else{return db[_0x53d1('0x15')][_0x53d1('0x11')]({'attributes':[_0x53d1('0x16')],'where':{'sectionId':_0x110035['id']},'raw':!![]})[_0x53d1('0x17')](function(_0xcb529b){if(_0xcb529b){var _0x1b94f3={'where':{'id':_['map'](_0xcb529b,_0x53d1('0x16'))},'raw':!![]};switch(_0x59f965){case _0x53d1('0x18'):_0x1b94f3[_0x53d1('0x19')]['role']=_0x53d1('0x7');break;case _0x53d1('0x1a'):_0x1b94f3[_0x53d1('0x19')][_0x53d1('0x8')]=_0x53d1('0x1b');break;}return db[_0x59f965][_0x53d1('0x11')](_0x1b94f3);}else{return[];}});}}else{return[];}})[_0x53d1('0x17')](function(_0x395ea8){return _0x395ea8;});}function joinOrLeaveQueues(_0x52095a,_0x42fe5c,_0x3d158e,_0x26c1b4){_0x52095a[_0x42fe5c](util[_0x53d1('0x1c')]('%s:queue:%s',_0x3d158e,_0x26c1b4[_0x53d1('0x3')]));if(_0x26c1b4[_0x53d1('0x4')]){for(var _0x25323b=0x0;_0x25323b<_0x26c1b4[_0x53d1('0x4')][_0x53d1('0x1d')];_0x25323b+=0x1){_0x52095a[_0x42fe5c](util['format'](_0x53d1('0x1e'),_0x26c1b4['Agents'][_0x25323b]['name']));}}}function joinOrLeave(_0x40f7cf,_0x57afd8,_0x31adde){var _0x56c15f;if(_0x40f7cf['handshake'][_0x53d1('0x1f')]['id']){db['User']['find']({'attributes':['id','name',_0x53d1('0x5'),_0x53d1('0x20')],'where':{'id':_0x40f7cf['handshake'][_0x53d1('0x1f')]['id']},'include':[{'model':db[_0x53d1('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x53d1('0x22')],'as':_0x53d1('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x53d1('0x24')],'as':_0x53d1('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x53d1('0x26')],'as':_0x53d1('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x53d1('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x53d1('0x29')],'as':_0x53d1('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x53d1('0x17')](function(_0x421306){if(_0x421306){_0x56c15f=_0x421306;_0x40f7cf[_0x57afd8](util['format'](_0x53d1('0x1e'),_0x421306[_0x53d1('0x3')]));var _0xb38127=[];switch(_0x421306[_0x53d1('0x5')]){case _0x53d1('0x2b'):_0x40f7cf[_0x57afd8](_0x53d1('0x2c'));_0x40f7cf[_0x57afd8](_0x53d1('0x2d'));if(queryQueues[_0x53d1('0x2e')](_0x53d1('0x2f'))){delete queryQueues['include'];}_0xb38127[_0x53d1('0x30')](db[_0x53d1('0x31')][_0x53d1('0x11')](queryQueues));_0xb38127[_0x53d1('0x30')](db['ChatQueue'][_0x53d1('0x11')](queryQueues));_0xb38127[_0x53d1('0x30')](db[_0x53d1('0x32')]['findAll'](queryQueues));_0xb38127[_0x53d1('0x30')](db[_0x53d1('0x33')][_0x53d1('0x11')](queryQueues));_0xb38127[_0x53d1('0x30')](db[_0x53d1('0x34')][_0x53d1('0x11')](queryQueues));_0xb38127[_0x53d1('0x30')](db['OpenchannelQueue'][_0x53d1('0x11')](queryQueues));_0xb38127['push'](db[_0x53d1('0x35')][_0x53d1('0x11')](queryQueues));_0xb38127[_0x53d1('0x30')](db[_0x53d1('0x18')][_0x53d1('0x11')](queryTelephones));_0xb38127['push'](db['Trunk'][_0x53d1('0x11')](queryTrunks));_0xb38127['push'](db[_0x53d1('0x1a')][_0x53d1('0x11')](queryCampaigns));_0xb38127['push'](db['User'][_0x53d1('0x11')](queryAgents));break;case _0x53d1('0x36'):_0x40f7cf[_0x57afd8](_0x53d1('0x2c'));_0x40f7cf[_0x57afd8](_0x53d1('0x2d'));_0xb38127[_0x53d1('0x30')](getAssociatedResources(_0x53d1('0xb'),_0x421306['userProfileId'],'VoiceQueue'));_0xb38127['push'](getAssociatedResources('ChatQueues',_0x421306[_0x53d1('0x20')],_0x53d1('0x37')));_0xb38127[_0x53d1('0x30')](getAssociatedResources(_0x53d1('0xd'),_0x421306['userProfileId'],_0x53d1('0x32')));_0xb38127[_0x53d1('0x30')](getAssociatedResources(_0x53d1('0xe'),_0x421306[_0x53d1('0x20')],_0x53d1('0x33')));_0xb38127[_0x53d1('0x30')](getAssociatedResources(_0x53d1('0xf'),_0x421306[_0x53d1('0x20')],_0x53d1('0x34')));_0xb38127[_0x53d1('0x30')](getAssociatedResources(_0x53d1('0x10'),_0x421306[_0x53d1('0x20')],_0x53d1('0x38')));_0xb38127[_0x53d1('0x30')](getAssociatedResources('WhatsappQueues',_0x421306['userProfileId'],_0x53d1('0x35')));_0xb38127[_0x53d1('0x30')](getAssociatedResources('Telephones',_0x421306[_0x53d1('0x20')],_0x53d1('0x18')));_0xb38127['push'](getAssociatedResources(_0x53d1('0x13'),_0x421306[_0x53d1('0x20')],_0x53d1('0x39')));_0xb38127[_0x53d1('0x30')](getAssociatedResources(_0x53d1('0x14'),_0x421306['userProfileId'],_0x53d1('0x1a')));_0xb38127[_0x53d1('0x30')](db[_0x53d1('0x18')][_0x53d1('0x11')](queryAgents));break;case _0x53d1('0x6'):_0x40f7cf[_0x57afd8]('voice:inbound');_0x40f7cf[_0x57afd8](_0x53d1('0x2d'));_0xb38127[_0x53d1('0x30')](_0x421306[_0x53d1('0x3a')]({'attributes':['id',_0x53d1('0x3')]}));_0xb38127[_0x53d1('0x30')](_0x421306[_0x53d1('0x3b')]({'attributes':['id',_0x53d1('0x3')]}));_0xb38127[_0x53d1('0x30')](_0x421306[_0x53d1('0x3c')]({'attributes':['id',_0x53d1('0x3')]}));_0xb38127[_0x53d1('0x30')](_0x421306[_0x53d1('0x3d')]({'attributes':['id',_0x53d1('0x3')]}));_0xb38127[_0x53d1('0x30')](_0x421306[_0x53d1('0x3e')]({'attributes':['id',_0x53d1('0x3')]}));_0xb38127['push'](_0x421306[_0x53d1('0x3f')]({'attributes':['id',_0x53d1('0x3')]}));_0xb38127[_0x53d1('0x30')](_0x421306[_0x53d1('0x40')]({'attributes':['id',_0x53d1('0x3')]}));break;}return BPromise[_0x53d1('0x41')](_0xb38127);}})[_0x53d1('0x17')](function(_0x3d1e2e){if(_0x3d1e2e&&_0x3d1e2e['length']){for(var _0x577924=0x0;_0x577924<_0x3d1e2e[_0x53d1('0x1d')];_0x577924+=0x1){for(var _0x491cf5=0x0;_0x491cf5<_0x3d1e2e[_0x577924][_0x53d1('0x1d')];_0x491cf5+=0x1){switch(_0x577924){case 0x0:joinOrLeaveQueues(_0x40f7cf,_0x57afd8,'voice',_0x3d1e2e[_0x577924][_0x491cf5]);break;case 0x1:joinOrLeaveQueues(_0x40f7cf,_0x57afd8,_0x53d1('0x42'),_0x3d1e2e[_0x577924][_0x491cf5]);break;case 0x2:joinOrLeaveQueues(_0x40f7cf,_0x57afd8,_0x53d1('0x43'),_0x3d1e2e[_0x577924][_0x491cf5]);break;case 0x3:joinOrLeaveQueues(_0x40f7cf,_0x57afd8,'sms',_0x3d1e2e[_0x577924][_0x491cf5]);break;case 0x4:joinOrLeaveQueues(_0x40f7cf,_0x57afd8,_0x53d1('0x44'),_0x3d1e2e[_0x577924][_0x491cf5]);break;case 0x5:joinOrLeaveQueues(_0x40f7cf,_0x57afd8,_0x53d1('0x45'),_0x3d1e2e[_0x577924][_0x491cf5]);break;case 0x6:joinOrLeaveQueues(_0x40f7cf,_0x57afd8,_0x53d1('0x46'),_0x3d1e2e[_0x577924][_0x491cf5]);break;case 0x7:_0x40f7cf[_0x57afd8](util[_0x53d1('0x1c')]('telephone:%s',_0x3d1e2e[_0x577924][_0x491cf5][_0x53d1('0x3')]));break;case 0x8:_0x40f7cf[_0x57afd8](util[_0x53d1('0x1c')](_0x53d1('0x47'),_0x3d1e2e[_0x577924][_0x491cf5]['name']));break;case 0x9:_0x40f7cf[_0x57afd8](util[_0x53d1('0x1c')](_0x53d1('0x48'),_0x3d1e2e[_0x577924][_0x491cf5][_0x53d1('0x8')],_0x3d1e2e[_0x577924][_0x491cf5][_0x53d1('0x3')]));break;case 0xa:_0x40f7cf[_0x57afd8](util[_0x53d1('0x1c')](_0x53d1('0x1e'),_0x3d1e2e[_0x577924][_0x491cf5][_0x53d1('0x3')]));break;}}}}})[_0x53d1('0x17')](function(){if(_0x57afd8===_0x53d1('0x49')){var _0x42b355=_[_0x53d1('0x4a')](_0x56c15f[_0x53d1('0x4b')],'id');return _0x56c15f['removeChatInteractions'](_0x42b355)[_0x53d1('0x17')](function(){for(var _0x13d966=0x0;_0x13d966<_0x42b355[_0x53d1('0x1d')];_0x13d966+=0x1){_0x31adde['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x42b355[_0x13d966]),'UserId':Number(_0x56c15f['id'])});}});}})[_0x53d1('0x17')](function(){if(_0x57afd8===_0x53d1('0x49')){var _0x45f4fa=_['map'](_0x56c15f[_0x53d1('0x23')],'id');return _0x56c15f[_0x53d1('0x4c')](_0x45f4fa)[_0x53d1('0x17')](function(){for(var _0x3b9682=0x0;_0x3b9682<_0x45f4fa[_0x53d1('0x1d')];_0x3b9682+=0x1){_0x31adde[_0x53d1('0x4d')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x45f4fa[_0x3b9682]),'UserId':Number(_0x56c15f['id'])});}});}})[_0x53d1('0x17')](function(){if(_0x57afd8==='leave'){var _0x53dd33=_[_0x53d1('0x4a')](_0x56c15f[_0x53d1('0x25')],'id');return _0x56c15f['removeFaxInteractions'](_0x53dd33)[_0x53d1('0x17')](function(){for(var _0x30061d=0x0;_0x30061d<_0x53dd33[_0x53d1('0x1d')];_0x30061d+=0x1){_0x31adde[_0x53d1('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x53dd33[_0x30061d]),'UserId':Number(_0x56c15f['id'])});}});}})['then'](function(){if(_0x57afd8===_0x53d1('0x49')){var _0x4200cb=_[_0x53d1('0x4a')](_0x56c15f[_0x53d1('0x27')],'id');return _0x56c15f[_0x53d1('0x4e')](_0x4200cb)[_0x53d1('0x17')](function(){for(var _0x554a89=0x0;_0x554a89<_0x4200cb[_0x53d1('0x1d')];_0x554a89+=0x1){_0x31adde[_0x53d1('0x4d')](_0x53d1('0x4f'),{'SmsInteractionId':Number(_0x4200cb[_0x554a89]),'UserId':Number(_0x56c15f['id'])});}});}})[_0x53d1('0x17')](function(){if(_0x57afd8===_0x53d1('0x49')){var _0x3aa5b1=_['map'](_0x56c15f[_0x53d1('0x28')],'id');return _0x56c15f[_0x53d1('0x50')](_0x3aa5b1)['then'](function(){for(var _0x5b9b9d=0x0;_0x5b9b9d<_0x3aa5b1['length'];_0x5b9b9d+=0x1){_0x31adde[_0x53d1('0x4d')](_0x53d1('0x51'),{'OpenchannelInteractionId':Number(_0x3aa5b1[_0x5b9b9d]),'UserId':Number(_0x56c15f['id'])});}});}})[_0x53d1('0x17')](function(){if(_0x57afd8==='leave'){var _0x331414=_['map'](_0x56c15f[_0x53d1('0x2a')],'id');return _0x56c15f[_0x53d1('0x52')](_0x331414)[_0x53d1('0x17')](function(){for(var _0x48f2bc=0x0;_0x48f2bc<_0x331414['length'];_0x48f2bc+=0x1){_0x31adde['emit'](_0x53d1('0x53'),{'WhatsappInteractionId':Number(_0x331414[_0x48f2bc]),'UserId':Number(_0x56c15f['id'])});}});}})['catch'](function(_0x340a41){_0x40f7cf['log'](_0x340a41);});}}function onDisconnect(_0x3722e1,_0x3420a5){joinOrLeave(_0x3722e1,_0x53d1('0x49'),_0x3420a5);}function onConnect(_0x1316aa){joinOrLeave(_0x1316aa,_0x53d1('0x54'));}exports[_0x53d1('0x55')]=function(_0x5dbb51){_0x5dbb51['on'](_0x53d1('0x56'),function(_0x4fcd88){_0x4fcd88[_0x53d1('0x57')](0x0);_0x4fcd88['address']=_0x4fcd88['request'][_0x53d1('0x56')]['remoteAddress']+':'+_0x4fcd88[_0x53d1('0x58')][_0x53d1('0x56')][_0x53d1('0x59')];_0x4fcd88[_0x53d1('0x5a')]=new Date();_0x4fcd88[_0x53d1('0x5b')]=function(_0x204500){console[_0x53d1('0x5b')](_0x53d1('0x5c')+_0x4fcd88['nsp'][_0x53d1('0x3')]+'['+_0x4fcd88[_0x53d1('0x5d')]+']',_0x204500);};_0x4fcd88['on'](_0x53d1('0x5e'),function(){onDisconnect(_0x4fcd88,_0x5dbb51);_0x4fcd88[_0x53d1('0x5b')]('DISCONNECTED');});onConnect(_0x4fcd88);_0x4fcd88[_0x53d1('0x5b')](_0x53d1('0x5f'));});}; \ No newline at end of file +var _0x1113=['Trunks','UserProfileResource','resourceId','where','%s:queue:%s','length','format','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','admin','voice:outbound','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','voice:inbound','WhatsappQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','openchannel','whatsapp','campaign:%s:%s','map','user_has_chat_interactions:remove','leave','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','Agents','User','name','role','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Telephones'];(function(_0x5f5b74,_0x575f37){var _0x45f1fd=function(_0x503ce0){while(--_0x503ce0){_0x5f5b74['push'](_0x5f5b74['shift']());}};_0x45f1fd(++_0x575f37);}(_0x1113,0x16f));var _0x3111=function(_0x11bd81,_0x11fa4c){_0x11bd81=_0x11bd81-0x0;var _0x158de0=_0x1113[_0x11bd81];return _0x158de0;};'use strict';var _=require('lodash');var util=require(_0x3111('0x0'));var BPromise=require(_0x3111('0x1'));var db=require(_0x3111('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x3111('0x3'),'model':db[_0x3111('0x4')],'attributes':['id',_0x3111('0x5'),_0x3111('0x6')],'raw':!![],'where':{'role':_0x3111('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3111('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x3111('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x3111('0x5')],'where':{'role':_0x3111('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3111('0x5'),_0x3111('0x8')],'where':{'type':_0x3111('0x9')}};function getAssociatedResources(_0x4ad8df,_0x5639a1,_0x250ed7){return db[_0x3111('0xa')][_0x3111('0xb')]({'where':{'name':_0x4ad8df,'userProfileId':_0x5639a1},'raw':!![]})[_0x3111('0xc')](function(_0x50d909){if(_0x50d909){if(_0x50d909[_0x3111('0xd')]){switch(_0x4ad8df){case _0x3111('0xe'):case _0x3111('0xf'):case _0x3111('0x10'):case _0x3111('0x11'):case'MailQueues':case _0x3111('0x12'):case'WhatsappQueues':return db[_0x250ed7][_0x3111('0x13')](queryQueues);case _0x3111('0x14'):return db[_0x250ed7][_0x3111('0x13')](queryTelephones);case _0x3111('0x15'):return db[_0x250ed7][_0x3111('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x250ed7][_0x3111('0x13')](queryCampaigns);}}else{return db[_0x3111('0x16')][_0x3111('0x13')]({'attributes':[_0x3111('0x17')],'where':{'sectionId':_0x50d909['id']},'raw':!![]})[_0x3111('0xc')](function(_0x3bab1f){if(_0x3bab1f){var _0x341fbd={'where':{'id':_['map'](_0x3bab1f,_0x3111('0x17'))},'raw':!![]};switch(_0x250ed7){case _0x3111('0x4'):_0x341fbd[_0x3111('0x18')][_0x3111('0x6')]='telephone';break;case'Campaign':_0x341fbd[_0x3111('0x18')]['type']=_0x3111('0x9');break;}return db[_0x250ed7][_0x3111('0x13')](_0x341fbd);}else{return[];}});}}else{return[];}})['then'](function(_0x453e6a){return _0x453e6a;});}function joinOrLeaveQueues(_0x3030fb,_0x3dd324,_0x43f2ac,_0x734894){_0x3030fb[_0x3dd324](util['format'](_0x3111('0x19'),_0x43f2ac,_0x734894[_0x3111('0x5')]));if(_0x734894[_0x3111('0x3')]){for(var _0x5a5177=0x0;_0x5a5177<_0x734894['Agents'][_0x3111('0x1a')];_0x5a5177+=0x1){_0x3030fb[_0x3dd324](util[_0x3111('0x1b')](_0x3111('0x1c'),_0x734894[_0x3111('0x3')][_0x5a5177][_0x3111('0x5')]));}}}function joinOrLeave(_0x33fadd,_0x1deaf3,_0x5a8f9d){var _0x5266ab;if(_0x33fadd[_0x3111('0x1d')][_0x3111('0x1e')]['id']){db[_0x3111('0x4')]['find']({'attributes':['id','name',_0x3111('0x6'),_0x3111('0x1f')],'where':{'id':_0x33fadd[_0x3111('0x1d')]['query']['id']},'include':[{'model':db[_0x3111('0x20')],'as':_0x3111('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x3111('0x22')],'as':_0x3111('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x3111('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x3111('0x25')],'as':_0x3111('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x3111('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x3111('0x28')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x3111('0xc')](function(_0x1c2c25){if(_0x1c2c25){_0x5266ab=_0x1c2c25;_0x33fadd[_0x1deaf3](util['format']('user:%s',_0x1c2c25[_0x3111('0x5')]));var _0x3a92e8=[];switch(_0x1c2c25[_0x3111('0x6')]){case _0x3111('0x29'):_0x33fadd[_0x1deaf3]('voice:inbound');_0x33fadd[_0x1deaf3](_0x3111('0x2a'));if(queryQueues['hasOwnProperty'](_0x3111('0x2b'))){delete queryQueues[_0x3111('0x2b')];}_0x3a92e8['push'](db[_0x3111('0x2c')][_0x3111('0x13')](queryQueues));_0x3a92e8[_0x3111('0x2d')](db[_0x3111('0x2e')][_0x3111('0x13')](queryQueues));_0x3a92e8['push'](db[_0x3111('0x2f')][_0x3111('0x13')](queryQueues));_0x3a92e8['push'](db[_0x3111('0x30')][_0x3111('0x13')](queryQueues));_0x3a92e8['push'](db[_0x3111('0x31')][_0x3111('0x13')](queryQueues));_0x3a92e8[_0x3111('0x2d')](db[_0x3111('0x32')][_0x3111('0x13')](queryQueues));_0x3a92e8[_0x3111('0x2d')](db[_0x3111('0x33')][_0x3111('0x13')](queryQueues));_0x3a92e8[_0x3111('0x2d')](db[_0x3111('0x4')]['findAll'](queryTelephones));_0x3a92e8[_0x3111('0x2d')](db[_0x3111('0x34')]['findAll'](queryTrunks));_0x3a92e8[_0x3111('0x2d')](db[_0x3111('0x35')][_0x3111('0x13')](queryCampaigns));_0x3a92e8[_0x3111('0x2d')](db['User'][_0x3111('0x13')](queryAgents));break;case'user':_0x33fadd[_0x1deaf3](_0x3111('0x36'));_0x33fadd[_0x1deaf3](_0x3111('0x2a'));_0x3a92e8['push'](getAssociatedResources(_0x3111('0xe'),_0x1c2c25[_0x3111('0x1f')],_0x3111('0x2c')));_0x3a92e8[_0x3111('0x2d')](getAssociatedResources(_0x3111('0xf'),_0x1c2c25[_0x3111('0x1f')],_0x3111('0x2e')));_0x3a92e8[_0x3111('0x2d')](getAssociatedResources(_0x3111('0x10'),_0x1c2c25['userProfileId'],_0x3111('0x2f')));_0x3a92e8['push'](getAssociatedResources(_0x3111('0x11'),_0x1c2c25[_0x3111('0x1f')],_0x3111('0x30')));_0x3a92e8[_0x3111('0x2d')](getAssociatedResources('MailQueues',_0x1c2c25[_0x3111('0x1f')],_0x3111('0x31')));_0x3a92e8[_0x3111('0x2d')](getAssociatedResources(_0x3111('0x12'),_0x1c2c25[_0x3111('0x1f')],_0x3111('0x32')));_0x3a92e8['push'](getAssociatedResources(_0x3111('0x37'),_0x1c2c25[_0x3111('0x1f')],_0x3111('0x33')));_0x3a92e8[_0x3111('0x2d')](getAssociatedResources(_0x3111('0x14'),_0x1c2c25['userProfileId'],_0x3111('0x4')));_0x3a92e8[_0x3111('0x2d')](getAssociatedResources(_0x3111('0x15'),_0x1c2c25[_0x3111('0x1f')],'Trunk'));_0x3a92e8['push'](getAssociatedResources(_0x3111('0x38'),_0x1c2c25[_0x3111('0x1f')],'Campaign'));_0x3a92e8[_0x3111('0x2d')](db[_0x3111('0x4')][_0x3111('0x13')](queryAgents));break;case _0x3111('0x7'):_0x33fadd[_0x1deaf3](_0x3111('0x36'));_0x33fadd[_0x1deaf3](_0x3111('0x2a'));_0x3a92e8[_0x3111('0x2d')](_0x1c2c25[_0x3111('0x39')]({'attributes':['id',_0x3111('0x5')]}));_0x3a92e8[_0x3111('0x2d')](_0x1c2c25[_0x3111('0x3a')]({'attributes':['id',_0x3111('0x5')]}));_0x3a92e8[_0x3111('0x2d')](_0x1c2c25[_0x3111('0x3b')]({'attributes':['id',_0x3111('0x5')]}));_0x3a92e8[_0x3111('0x2d')](_0x1c2c25[_0x3111('0x3c')]({'attributes':['id','name']}));_0x3a92e8[_0x3111('0x2d')](_0x1c2c25[_0x3111('0x3d')]({'attributes':['id',_0x3111('0x5')]}));_0x3a92e8[_0x3111('0x2d')](_0x1c2c25[_0x3111('0x3e')]({'attributes':['id',_0x3111('0x5')]}));_0x3a92e8[_0x3111('0x2d')](_0x1c2c25['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x3111('0x3f')](_0x3a92e8);}})[_0x3111('0xc')](function(_0x227105){if(_0x227105&&_0x227105[_0x3111('0x1a')]){for(var _0xc7fee4=0x0;_0xc7fee4<_0x227105[_0x3111('0x1a')];_0xc7fee4+=0x1){for(var _0x5306b6=0x0;_0x5306b6<_0x227105[_0xc7fee4][_0x3111('0x1a')];_0x5306b6+=0x1){switch(_0xc7fee4){case 0x0:joinOrLeaveQueues(_0x33fadd,_0x1deaf3,_0x3111('0x40'),_0x227105[_0xc7fee4][_0x5306b6]);break;case 0x1:joinOrLeaveQueues(_0x33fadd,_0x1deaf3,_0x3111('0x41'),_0x227105[_0xc7fee4][_0x5306b6]);break;case 0x2:joinOrLeaveQueues(_0x33fadd,_0x1deaf3,_0x3111('0x42'),_0x227105[_0xc7fee4][_0x5306b6]);break;case 0x3:joinOrLeaveQueues(_0x33fadd,_0x1deaf3,'sms',_0x227105[_0xc7fee4][_0x5306b6]);break;case 0x4:joinOrLeaveQueues(_0x33fadd,_0x1deaf3,'mail',_0x227105[_0xc7fee4][_0x5306b6]);break;case 0x5:joinOrLeaveQueues(_0x33fadd,_0x1deaf3,_0x3111('0x43'),_0x227105[_0xc7fee4][_0x5306b6]);break;case 0x6:joinOrLeaveQueues(_0x33fadd,_0x1deaf3,_0x3111('0x44'),_0x227105[_0xc7fee4][_0x5306b6]);break;case 0x7:_0x33fadd[_0x1deaf3](util[_0x3111('0x1b')]('telephone:%s',_0x227105[_0xc7fee4][_0x5306b6][_0x3111('0x5')]));break;case 0x8:_0x33fadd[_0x1deaf3](util[_0x3111('0x1b')]('trunk:%s',_0x227105[_0xc7fee4][_0x5306b6][_0x3111('0x5')]));break;case 0x9:_0x33fadd[_0x1deaf3](util[_0x3111('0x1b')](_0x3111('0x45'),_0x227105[_0xc7fee4][_0x5306b6]['type'],_0x227105[_0xc7fee4][_0x5306b6]['name']));break;case 0xa:_0x33fadd[_0x1deaf3](util[_0x3111('0x1b')](_0x3111('0x1c'),_0x227105[_0xc7fee4][_0x5306b6][_0x3111('0x5')]));break;}}}}})[_0x3111('0xc')](function(){if(_0x1deaf3==='leave'){var _0x1d925c=_[_0x3111('0x46')](_0x5266ab[_0x3111('0x21')],'id');return _0x5266ab['removeChatInteractions'](_0x1d925c)['then'](function(){for(var _0x53fa31=0x0;_0x53fa31<_0x1d925c[_0x3111('0x1a')];_0x53fa31+=0x1){_0x5a8f9d['emit'](_0x3111('0x47'),{'ChatInteractionId':Number(_0x1d925c[_0x53fa31]),'UserId':Number(_0x5266ab['id'])});}});}})['then'](function(){if(_0x1deaf3===_0x3111('0x48')){var _0x396394=_[_0x3111('0x46')](_0x5266ab[_0x3111('0x23')],'id');return _0x5266ab[_0x3111('0x49')](_0x396394)[_0x3111('0xc')](function(){for(var _0x1b04c1=0x0;_0x1b04c1<_0x396394[_0x3111('0x1a')];_0x1b04c1+=0x1){_0x5a8f9d[_0x3111('0x4a')](_0x3111('0x4b'),{'MailInteractionId':Number(_0x396394[_0x1b04c1]),'UserId':Number(_0x5266ab['id'])});}});}})[_0x3111('0xc')](function(){if(_0x1deaf3==='leave'){var _0x4efb9e=_[_0x3111('0x46')](_0x5266ab[_0x3111('0x24')],'id');return _0x5266ab[_0x3111('0x4c')](_0x4efb9e)[_0x3111('0xc')](function(){for(var _0x52b275=0x0;_0x52b275<_0x4efb9e['length'];_0x52b275+=0x1){_0x5a8f9d[_0x3111('0x4a')](_0x3111('0x4d'),{'FaxInteractionId':Number(_0x4efb9e[_0x52b275]),'UserId':Number(_0x5266ab['id'])});}});}})[_0x3111('0xc')](function(){if(_0x1deaf3===_0x3111('0x48')){var _0x285292=_[_0x3111('0x46')](_0x5266ab[_0x3111('0x26')],'id');return _0x5266ab['removeSmsInteractions'](_0x285292)[_0x3111('0xc')](function(){for(var _0x729e4f=0x0;_0x729e4f<_0x285292['length'];_0x729e4f+=0x1){_0x5a8f9d[_0x3111('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x285292[_0x729e4f]),'UserId':Number(_0x5266ab['id'])});}});}})[_0x3111('0xc')](function(){if(_0x1deaf3==='leave'){var _0x29c015=_['map'](_0x5266ab['OpenchannelInteractions'],'id');return _0x5266ab[_0x3111('0x4e')](_0x29c015)[_0x3111('0xc')](function(){for(var _0x33642e=0x0;_0x33642e<_0x29c015[_0x3111('0x1a')];_0x33642e+=0x1){_0x5a8f9d['emit'](_0x3111('0x4f'),{'OpenchannelInteractionId':Number(_0x29c015[_0x33642e]),'UserId':Number(_0x5266ab['id'])});}});}})['then'](function(){if(_0x1deaf3===_0x3111('0x48')){var _0x13b322=_[_0x3111('0x46')](_0x5266ab[_0x3111('0x50')],'id');return _0x5266ab[_0x3111('0x51')](_0x13b322)[_0x3111('0xc')](function(){for(var _0x1f4e83=0x0;_0x1f4e83<_0x13b322['length'];_0x1f4e83+=0x1){_0x5a8f9d['emit'](_0x3111('0x52'),{'WhatsappInteractionId':Number(_0x13b322[_0x1f4e83]),'UserId':Number(_0x5266ab['id'])});}});}})['catch'](function(_0x3d3c14){_0x33fadd[_0x3111('0x53')](_0x3d3c14);});}}function onDisconnect(_0x353b44,_0x43d873){joinOrLeave(_0x353b44,_0x3111('0x48'),_0x43d873);}function onConnect(_0x156861){joinOrLeave(_0x156861,_0x3111('0x54'));}exports[_0x3111('0x55')]=function(_0x5de978){_0x5de978['on'](_0x3111('0x56'),function(_0x24ccb2){_0x24ccb2[_0x3111('0x57')](0x0);_0x24ccb2[_0x3111('0x58')]=_0x24ccb2[_0x3111('0x59')][_0x3111('0x56')]['remoteAddress']+':'+_0x24ccb2['request'][_0x3111('0x56')][_0x3111('0x5a')];_0x24ccb2[_0x3111('0x5b')]=new Date();_0x24ccb2['log']=function(_0x28cc81){console[_0x3111('0x53')](_0x3111('0x5c')+_0x24ccb2[_0x3111('0x5d')][_0x3111('0x5')]+'['+_0x24ccb2[_0x3111('0x58')]+']',_0x28cc81);};_0x24ccb2['on'](_0x3111('0x5e'),function(){onDisconnect(_0x24ccb2,_0x5de978);_0x24ccb2[_0x3111('0x53')](_0x3111('0x5f'));});onConnect(_0x24ccb2);_0x24ccb2[_0x3111('0x53')](_0x3111('0x60'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f488bd2..77cf2dc 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 _0x23b4=['FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','get','channel','event','direction','User','find','UserId','interface','format','name','incomingmessage','catch','outgoingmessage','opened','closed','SIP/%s','length','hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','Chat','ChatInteraction','newinteraction','afterUpdate','ChatMessage','afterCreate','newmessage','Sms','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax'];(function(_0x469be6,_0x54adf4){var _0x42ff6b=function(_0x34bce0){while(--_0x34bce0){_0x469be6['push'](_0x469be6['shift']());}};_0x42ff6b(++_0x54adf4);}(_0x23b4,0x1ac));var _0x423b=function(_0xb8f8ba,_0x56a48f){_0xb8f8ba=_0xb8f8ba-0x0;var _0x426419=_0x23b4[_0xb8f8ba];return _0x426419;};'use strict';var util=require(_0x423b('0x0'));var db=require(_0x423b('0x1'))['db'];var jayson=require(_0x423b('0x2'));var logger=require(_0x423b('0x3'))(_0x423b('0x4'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':_0x423b('0x5'),'model':_0x423b('0x6'),'event':'afterCreate','condition':_0x423b('0x7'),'callback':afterCreate},{'channel':_0x423b('0x5'),'model':'ChatInteraction','event':_0x423b('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x423b('0x5'),'model':_0x423b('0x9'),'event':_0x423b('0xa'),'condition':_0x423b('0xb'),'callback':afterCreateMessage},{'channel':_0x423b('0xc'),'model':_0x423b('0xd'),'event':_0x423b('0xa'),'condition':_0x423b('0x7'),'callback':afterCreate},{'channel':_0x423b('0xc'),'model':_0x423b('0xd'),'event':_0x423b('0x8'),'condition':_0x423b('0xe'),'callback':afterUpdate},{'channel':_0x423b('0xc'),'model':_0x423b('0xf'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0x423b('0x10'),'model':_0x423b('0x11'),'event':_0x423b('0xa'),'condition':_0x423b('0x7'),'callback':afterCreate},{'channel':_0x423b('0x10'),'model':_0x423b('0x11'),'event':_0x423b('0x8'),'condition':_0x423b('0xe'),'callback':afterUpdate},{'channel':_0x423b('0x10'),'model':_0x423b('0x12'),'event':_0x423b('0xa'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x423b('0x13'),'model':'FaxInteraction','event':'afterCreate','condition':_0x423b('0x7'),'callback':afterCreate},{'channel':'Fax','model':_0x423b('0x14'),'event':_0x423b('0x8'),'condition':_0x423b('0xe'),'callback':afterUpdate},{'channel':_0x423b('0x13'),'model':_0x423b('0x15'),'event':_0x423b('0xa'),'condition':_0x423b('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':'MailInteraction','event':_0x423b('0xa'),'condition':_0x423b('0x7'),'callback':afterCreate},{'channel':_0x423b('0x16'),'model':_0x423b('0x17'),'event':_0x423b('0x8'),'condition':_0x423b('0xe'),'callback':afterUpdate},{'channel':_0x423b('0x16'),'model':_0x423b('0x18'),'event':_0x423b('0xa'),'condition':_0x423b('0xb'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x423b('0x19'),'event':_0x423b('0xa'),'condition':_0x423b('0x7'),'callback':afterCreate},{'channel':_0x423b('0x1a'),'model':_0x423b('0x19'),'event':_0x423b('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x423b('0x1a'),'model':_0x423b('0x1b'),'event':_0x423b('0xa'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x184a9f){return client[_0x423b('0x1c')](_0x423b('0x1d'),_0x184a9f)[_0x423b('0x1e')](function(_0x47e73e){logger[_0x423b('0x1f')](_0x423b('0x20'),_0x423b('0x1d'),_0x47e73e);if(_0x47e73e[_0x423b('0x21')]){if(_0x47e73e[_0x423b('0x21')]['code']===0x1f4){logger[_0x423b('0x21')](_0x423b('0x20'),_0x423b('0x1d'),_0x47e73e[_0x423b('0x21')]);}}})['catch'](function(_0x2889d3){logger[_0x423b('0x21')]('Trigger,\x20%s',_0x423b('0x1d'),_0x2889d3);});}function afterCreateMessage(_0x4d7f8e,_0x63d44c){return function(_0x1765d7,_0x1a97ae){_0x1765d7=_0x1765d7[_0x423b('0x22')]({'plain':!![]});_0x1765d7[_0x423b('0x23')]=_0x4d7f8e;_0x1765d7[_0x423b('0x24')]=_0x1765d7[_0x423b('0x25')];if(_0x1765d7['UserId']){return db[_0x423b('0x26')][_0x423b('0x27')]({'where':{'id':_0x1765d7[_0x423b('0x28')]},'attributes':['id','name'],'raw':!![]})[_0x423b('0x1e')](function(_0x225847){_0x1765d7[_0x423b('0x29')]=util[_0x423b('0x2a')]('SIP/%s',_0x225847[_0x423b('0x2b')]);_0x1765d7[_0x423b('0x23')]=_0x4d7f8e;return request({'event':_0x423b('0x2c'),'message':_0x1765d7});})[_0x423b('0x2d')](function(_0x515529){console[_0x423b('0x21')](_0x515529);});}else{return request({'event':_0x423b('0x2e'),'message':_0x1765d7});}};}function afterCreate(_0x5dd274,_0x4c0131){return function(_0x3ebddf,_0x5f36fe){_0x3ebddf=_0x3ebddf['get']({'plain':!![]});_0x3ebddf[_0x423b('0x23')]=_0x5dd274;_0x3ebddf[_0x423b('0x24')]=_0x423b('0x2f');return request({'event':_0x4c0131,'message':_0x3ebddf});};}function afterUpdate(_0x157583,_0x215e4d){return function(_0xa3d23f,_0x817998){if(_0xa3d23f['changed'](_0x423b('0x30'))&&_0xa3d23f[_0x423b('0x30')]){_0xa3d23f=_0xa3d23f[_0x423b('0x22')]({'plain':!![]});_0xa3d23f[_0x423b('0x23')]=_0x157583;_0xa3d23f[_0x423b('0x24')]=_0x423b('0x30');if(_0xa3d23f['UserId']){return db[_0x423b('0x26')][_0x423b('0x27')]({'where':{'id':_0xa3d23f[_0x423b('0x28')]},'attributes':['id','name'],'raw':!![]})[_0x423b('0x1e')](function(_0x5248df){_0xa3d23f[_0x423b('0x29')]=util['format'](_0x423b('0x31'),_0x5248df['name']);return request({'event':_0x215e4d,'message':_0xa3d23f});})[_0x423b('0x2d')](function(_0x9bb7a8){console[_0x423b('0x21')](_0x9bb7a8);});}else{return request({'event':_0x215e4d,'message':_0xa3d23f});}}};}exports['default']=function(){for(var _0x2efbf9=0x0;_0x2efbf9=_0xc0296[_0xe97a('0x11')]){throw Error(_0xe97a('0x12'));}_0x21af77(_0x5861e3);})['catch'](function(_0x9f4e54){_0x260fb6(_0x9f4e54);});});}; \ No newline at end of file +var _0xc64a=['../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','includes','clearBlockUser','isUndefined','updateAttributes','role','agent','User','getLicense','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','bluebird'];(function(_0xbaeba7,_0x578dfa){var _0x4b42e7=function(_0x23bd26){while(--_0x23bd26){_0xbaeba7['push'](_0xbaeba7['shift']());}};_0x4b42e7(++_0x578dfa);}(_0xc64a,0xc5));var _0xac64=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xc64a[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var BPromise=require(_0xac64('0x0'));var db=require(_0xac64('0x1'))['db'];var util=require(_0xac64('0x2'));var channels=[_0xac64('0x3'),_0xac64('0x4'),_0xac64('0x5'),_0xac64('0x6'),_0xac64('0x7'),_0xac64('0x8'),_0xac64('0x9')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x34e660){_0x34e660=_0x34e660['toLowerCase']();return _[_0xac64('0xa')](channels,_0x34e660);};exports[_0xac64('0xb')]=function(_0x2782e5,_0x6851f,_0x38edde,_0xa6b6a5){var _0x152395={'loginAttempts':_0x6851f,'blocked':_0x38edde};if(!_[_0xac64('0xc')](_0xa6b6a5)){_0x152395['blockedAt']=_0xa6b6a5;}return _0x2782e5[_0xac64('0xd')](_0x152395);};exports['getLicense']=function(_0x47a4ba){return new BPromise(function(_0x34e03a,_0x5f213e){var _0x3650bc=0x0;if(_0x47a4ba[_0xac64('0xe')]!==_0xac64('0xf')){_0x34e03a(_0x47a4ba);}db[_0xac64('0x10')]['count']({'where':{'role':_0xac64('0xf'),'online':!![],'id':{'$ne':_0x47a4ba['id']}}})['then'](function(_0x2354a9){_0x3650bc=_0x2354a9;return util[_0xac64('0x11')]();})[_0xac64('0x12')](function(_0x5b83e4){if(_0x5b83e4&&_0x5b83e4[_0xac64('0x13')]&&_0x3650bc>=_0x5b83e4['agents']){throw Error(_0xac64('0x14'));}_0x34e03a(_0x47a4ba);})[_0xac64('0x15')](function(_0x5a1dce){_0x5f213e(_0x5a1dce);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 78b020a..6454bd6 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3cba=['exports','404','status','json','send'];(function(_0x4e4c05,_0x919149){var _0x9cffe=function(_0x3e9e39){while(--_0x3e9e39){_0x4e4c05['push'](_0x4e4c05['shift']());}};_0x9cffe(++_0x919149);}(_0x3cba,0x131));var _0xa3cb=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0x3cba[_0x1ac77b];return _0x161584;};'use strict';module[_0xa3cb('0x0')][0x194]=function pageNotFound(_0x22ce34,_0x4378f1){var _0x4a94ca=_0xa3cb('0x1');var _0x3341f5=0x194;var _0x2788bc={'status':_0x3341f5};_0x4378f1[_0xa3cb('0x2')](_0x2788bc[_0xa3cb('0x2')]);_0x4378f1['render'](_0x4a94ca,{},function(_0x42b747,_0x29fd24){if(_0x42b747){return _0x4378f1[_0xa3cb('0x2')](_0x2788bc[_0xa3cb('0x2')])[_0xa3cb('0x3')](_0x2788bc);}_0x4378f1[_0xa3cb('0x4')](_0x29fd24);});}; \ No newline at end of file +var _0xb26b=['404','status','render','json','exports'];(function(_0x3614d8,_0x5740b4){var _0x506802=function(_0x28ba78){while(--_0x28ba78){_0x3614d8['push'](_0x3614d8['shift']());}};_0x506802(++_0x5740b4);}(_0xb26b,0x7c));var _0xbb26=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb26b[_0x20a584];return _0x4b41a8;};'use strict';module[_0xbb26('0x0')][0x194]=function pageNotFound(_0x2818e2,_0x1ca5f6){var _0x14dce7=_0xbb26('0x1');var _0x48ad0f=0x194;var _0x5fa12c={'status':_0x48ad0f};_0x1ca5f6[_0xbb26('0x2')](_0x5fa12c[_0xbb26('0x2')]);_0x1ca5f6[_0xbb26('0x3')](_0x14dce7,{},function(_0x3cea67,_0x3ba750){if(_0x3cea67){return _0x1ca5f6[_0xbb26('0x2')](_0x5fa12c[_0xbb26('0x2')])[_0xbb26('0x4')](_0x5fa12c);}_0x1ca5f6['send'](_0x3ba750);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 39ad47b..3d6b3a5 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x25ba=['mailbox','VoiceCallReport','uniqueid','AgentReports','Contact','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachment','Attachments','Interaction','restrict','IntervalId','TagId','Items','FaxAccountId','FaxInteractionId','ContactId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','chat_group_has_users','Contacts','CompanyId','Company','cm_contact_has_tags','Agent','Queue','Campaign','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Sound','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','DescriptionId','FieldId','Subject','Field','VariableId','Descriptions','int_desk_configuration_has_tags','ZohoAccount','Description','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerField','FreshsalesAccount','FromId','ToId','SessionId','ProjectId','JscriptyQuestionReport','user_has_teams','team_has_voice_queues','MailQueues','TrunkBackupId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToSmsAccountId','CustomFields','Queues','sectionId','WhatsappAccount','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','user_has_whatsapp_interactions','WhatsappQueueReport','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','License','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','User','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','Notifications','SenderId','belongsTo','UserProfile','userProfileId','Groups','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','OpenchannelInteractions','user_has_openchannel_interactions','VoiceQueues','ChatQueues','SmsQueue','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','JscriptySessions','TrunkId','TrunkBackup','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser'];(function(_0x387cf5,_0x4814db){var _0x14f0a8=function(_0xdfac47){while(--_0xdfac47){_0x387cf5['push'](_0x387cf5['shift']());}};_0x14f0a8(++_0x4814db);}(_0x25ba,0x94));var _0xa25b=function(_0x4968f9,_0x3099ff){_0x4968f9=_0x4968f9-0x0;var _0x215da2=_0x25ba[_0x4968f9];return _0x215da2;};'use strict';var path=require(_0xa25b('0x0'));var config=require(_0xa25b('0x1'));var Sequelize=require(_0xa25b('0x2'));var _=require(_0xa25b('0x3'));var jstz=require(_0xa25b('0x4'));var timezone=jstz[_0xa25b('0x5')]();config['sequelize']=_[_0xa25b('0x6')](config[_0xa25b('0x2')],{'database':_0xa25b('0x7'),'username':_0xa25b('0x8'),'password':_0xa25b('0x9'),'options':{'host':_0xa25b('0xa'),'port':0xcea,'dialect':_0xa25b('0xb'),'dialectOptions':{'charset':_0xa25b('0xc')},'logging':![],'timezone':timezone[_0xa25b('0xd')](),'define':{'charset':_0xa25b('0xe'),'collate':_0xa25b('0xf')}}});config[_0xa25b('0x10')]=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0xa25b('0x7'),'username':'xcall','password':_0xa25b('0x9'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xa25b('0xc')},'logging':![],'timezone':timezone[_0xa25b('0xd')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa25b('0x2')][_0xa25b('0x11')],config[_0xa25b('0x2')][_0xa25b('0x12')],config[_0xa25b('0x2')][_0xa25b('0x13')],config[_0xa25b('0x2')][_0xa25b('0x14')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa25b('0x10')][_0xa25b('0x11')],config['sequelizeHistory'][_0xa25b('0x12')],config['sequelizeHistory'][_0xa25b('0x13')],config[_0xa25b('0x10')][_0xa25b('0x14')])};db['User']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x16'));db[_0xa25b('0x17')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x18'));db[_0xa25b('0x19')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x1a'));db[_0xa25b('0x1b')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x1c'));db['VoiceMusicOnHold']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x1d'));db[_0xa25b('0x1e')]=db['sequelize']['import']('../api/voiceQueue/voiceQueue.model');db[_0xa25b('0x1f')]=db[_0xa25b('0x2')]['import']('../api/voiceRecording/voiceRecording.model');db[_0xa25b('0x20')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x21'));db[_0xa25b('0x22')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x23'));db[_0xa25b('0x24')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x25'));db['VoiceDialReport']=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x26'));db[_0xa25b('0x27')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x28'));db[_0xa25b('0x29')]=db['sequelize']['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0xa25b('0x2a')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x2b'));db[_0xa25b('0x2c')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x2d'));db[_0xa25b('0x2e')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x2f'));db[_0xa25b('0x30')]=db[_0xa25b('0x2')]['import']('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xa25b('0x31')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x32'));db[_0xa25b('0x33')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x34'));db[_0xa25b('0x35')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x36'));db[_0xa25b('0x37')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x38'));db['UserSmsQueue']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x39'));db[_0xa25b('0x3a')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x3b'));db[_0xa25b('0x3c')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x3d'));db[_0xa25b('0x3e')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x3f'));db[_0xa25b('0x40')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0xa25b('0x41')]=db[_0xa25b('0x2')]['import']('../api/mailAccount/mailAccount.model');db[_0xa25b('0x42')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x43'));db['MailSubstatus']=db[_0xa25b('0x2')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0xa25b('0x44')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x45'));db[_0xa25b('0x46')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x47'));db[_0xa25b('0x48')]=db['sequelize'][_0xa25b('0x15')]('../api/mailApplication/mailApplication.model');db[_0xa25b('0x49')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x4a'));db[_0xa25b('0x4b')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x4c'));db[_0xa25b('0x4d')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x4e'));db[_0xa25b('0x4f')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/faxAccount/faxAccount.model');db[_0xa25b('0x50')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x51'));db[_0xa25b('0x52')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x53'));db[_0xa25b('0x54')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x55'));db[_0xa25b('0x56')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x57'));db[_0xa25b('0x58')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/faxQueueReport/faxQueueReport.model');db[_0xa25b('0x59')]=db['sequelize']['import'](_0xa25b('0x5a'));db[_0xa25b('0x5b')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x5c'));db[_0xa25b('0x5d')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x5e'));db['SmsQueue']=db[_0xa25b('0x2')]['import'](_0xa25b('0x5f'));db[_0xa25b('0x60')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0xa25b('0x61')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/openchannelApplication/openchannelApplication.model');db[_0xa25b('0x62')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x63'));db['OpenchannelMessage']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x64'));db[_0xa25b('0x65')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x66'));db[_0xa25b('0x67')]=db['sequelize']['import'](_0xa25b('0x68'));db['OpenchannelQueueReport']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x69'));db[_0xa25b('0x6a')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x6b'));db[_0xa25b('0x6c')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x6d'));db[_0xa25b('0x6e')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x6f'));db[_0xa25b('0x70')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xa25b('0x71')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x72'));db[_0xa25b('0x73')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x74'));db[_0xa25b('0x75')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x76'));db[_0xa25b('0x77')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x78'));db[_0xa25b('0x79')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x7a'));db[_0xa25b('0x7b')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db['sequelize'][_0xa25b('0x15')](_0xa25b('0x7c'));db[_0xa25b('0x7d')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x7e'));db[_0xa25b('0x7f')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x80'));db[_0xa25b('0x81')]=db['sequelize']['import'](_0xa25b('0x82'));db[_0xa25b('0x83')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x84'));db[_0xa25b('0x85')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x86'));db[_0xa25b('0x87')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x88'));db[_0xa25b('0x89')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x8a'));db[_0xa25b('0x8b')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x8c'));db[_0xa25b('0x8d')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x8e'));db[_0xa25b('0x8f')]=db[_0xa25b('0x2')]['import']('../api/cdr/cdr.model');db[_0xa25b('0x90')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x91'));db[_0xa25b('0x92')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x93'));db['Sound']=db[_0xa25b('0x2')]['import'](_0xa25b('0x94'));db[_0xa25b('0x95')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x96'));db[_0xa25b('0x97')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x98'));db[_0xa25b('0x99')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x9a'));db[_0xa25b('0x9b')]=db[_0xa25b('0x2')]['import']('../api/variable/variable.model');db[_0xa25b('0x9c')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x9d'));db[_0xa25b('0x9e')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/integrationReport/integrationReport.model');db[_0xa25b('0x9f')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xa0'));db[_0xa25b('0xa1')]=db['sequelize']['import'](_0xa25b('0xa2'));db[_0xa25b('0xa3')]=db[_0xa25b('0x2')]['import'](_0xa25b('0xa4'));db[_0xa25b('0xa5')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xa6'));db[_0xa25b('0xa7')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xa8'));db[_0xa25b('0xa9')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xaa'));db[_0xa25b('0xab')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xa25b('0xac')]=db[_0xa25b('0x2')]['import'](_0xa25b('0xad'));db['SalesforceField']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xae'));db[_0xa25b('0xaf')]=db['sequelize'][_0xa25b('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xa25b('0xb0')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xa25b('0xb1')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xb2'));db['DeskAccount']=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/intDeskAccount/intDeskAccount.model');db[_0xa25b('0xb3')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xb4'));db[_0xa25b('0xb5')]=db[_0xa25b('0x2')]['import'](_0xa25b('0xb6'));db['ZohoAccount']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xb7'));db[_0xa25b('0xb8')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xb9'));db[_0xa25b('0xba')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xbb'));db[_0xa25b('0xbc')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xbd'));db[_0xa25b('0xbe')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xbf'));db['FreshdeskAccount']=db[_0xa25b('0x2')]['import'](_0xa25b('0xc0'));db[_0xa25b('0xc1')]=db[_0xa25b('0x2')]['import'](_0xa25b('0xc2'));db[_0xa25b('0xc3')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xc4'));db[_0xa25b('0xc5')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xc6'));db[_0xa25b('0xc7')]=db['sequelize']['import'](_0xa25b('0xc8'));db['VtigerField']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xc9'));db[_0xa25b('0xca')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xcb'));db[_0xa25b('0xcc')]=db['sequelize'][_0xa25b('0x15')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xa25b('0xcd')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xce'));db[_0xa25b('0xcf')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xd0'));db[_0xa25b('0xd1')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xd2'));db[_0xa25b('0xd3')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/intDynamics365Field/intDynamics365Field.model');db['FreshsalesAccount']=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xd4'));db[_0xa25b('0xd5')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xd6'));db[_0xa25b('0xd7')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0xa25b('0x9c')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x9d'));db[_0xa25b('0xd8')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xd9'));db[_0xa25b('0xda')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xdb'));db[_0xa25b('0xdc')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xdd'));db['JscriptyAnswerReport']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xde'));db['JscriptyQuestionReport']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xdf'));db[_0xa25b('0xe0')]=db['sequelize']['import']('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xa25b('0xe1')]=db[_0xa25b('0x2')]['import'](_0xa25b('0xe2'));db['SquareReport']=db[_0xa25b('0x2')]['import']('../api/squareReport/squareReport.model');db[_0xa25b('0xe3')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xe4'));db[_0xa25b('0xe5')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xe6'));db[_0xa25b('0xe7')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xe8'));db[_0xa25b('0xe9')]=db[_0xa25b('0x2')]['import'](_0xa25b('0xea'));db[_0xa25b('0xeb')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xec'));db[_0xa25b('0xed')]=db[_0xa25b('0x2')]['import']('../api/squareMessage/squareMessage.model');db[_0xa25b('0xee')]=db[_0xa25b('0x2')]['import']('../api/team/team.model');db[_0xa25b('0xef')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xf0'));db['Campaign']=db[_0xa25b('0x2')]['import'](_0xa25b('0xf1'));db[_0xa25b('0xf2')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xf3'));db['Attachment']=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/attachment/attachment.model');db[_0xa25b('0xf4')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xf5'));db['MailTransferReport']=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/mailTransferReport/mailTransferReport.model');db[_0xa25b('0xf6')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xf7'));db[_0xa25b('0xf8')]=db[_0xa25b('0x2')]['import']('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db['sequelize']['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xa25b('0xf9')]=db['sequelize'][_0xa25b('0x15')](_0xa25b('0xfa'));db[_0xa25b('0xfb')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xfc'));db[_0xa25b('0xfd')]=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0xfe'));db[_0xa25b('0xff')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x100'));db[_0xa25b('0x101')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x102'));db[_0xa25b('0x103')]=db[_0xa25b('0x2')]['import'](_0xa25b('0x104'));db['WhatsappAccount']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x105'));db[_0xa25b('0x106')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x107'));db[_0xa25b('0x108')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x109'));db['WhatsappMessage']=db[_0xa25b('0x2')]['import'](_0xa25b('0x10a'));db['WhatsappQueueReport']=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x10b'));db[_0xa25b('0x10c')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x10d'));db[_0xa25b('0x10e')]=db[_0xa25b('0x2')][_0xa25b('0x15')](_0xa25b('0x10f'));db['CloudProvider']=db[_0xa25b('0x2')][_0xa25b('0x15')]('../api/cloudProvider/cloudProvider.model');db[_0xa25b('0x110')][_0xa25b('0x111')](db[_0xa25b('0x22')],{'as':'VoiceMail','onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x110')][_0xa25b('0x114')](db[_0xa25b('0x1f')],{'as':_0xa25b('0x115'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x110')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xa25b('0x116'),'foreignKey':_0xa25b('0x113')});db['User'][_0xa25b('0x114')](db[_0xa25b('0x1b')],{'as':_0xa25b('0x117'),'onDelete':_0xa25b('0x112'),'hooks':!![]});db[_0xa25b('0x110')][_0xa25b('0x114')](db['CmHopperFinal'],{'as':_0xa25b('0x118'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x110')]['hasMany'](db[_0xa25b('0x119')],{'as':_0xa25b('0x11a'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x110')][_0xa25b('0x114')](db[_0xa25b('0x11b')],{'as':'ReportAgentPreview','foreignKey':'UserId'});db[_0xa25b('0x110')][_0xa25b('0x114')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0xa25b('0x113')});db[_0xa25b('0x110')][_0xa25b('0x114')](db['ChatInteraction'],{'as':_0xa25b('0x11c'),'foreignKey':'UserId'});db[_0xa25b('0x110')][_0xa25b('0x114')](db['SmsInteraction'],{'as':_0xa25b('0x11d'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x110')][_0xa25b('0x114')](db['FaxInteraction'],{'as':_0xa25b('0x11e'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x110')][_0xa25b('0x114')](db[_0xa25b('0x44')],{'as':_0xa25b('0x11f'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x110')][_0xa25b('0x114')](db[_0xa25b('0x108')],{'as':_0xa25b('0x120'),'foreignKey':_0xa25b('0x113')});db['User'][_0xa25b('0x114')](db[_0xa25b('0x103')],{'as':_0xa25b('0x121'),'foreignKey':_0xa25b('0x122')});db['User'][_0xa25b('0x123')](db[_0xa25b('0x124')],{'as':_0xa25b('0x124'),'foreignKey':_0xa25b('0x125')});db[_0xa25b('0x110')]['belongsToMany'](db['ChatGroup'],{'as':_0xa25b('0x126'),'through':'chat_group_has_users'});db[_0xa25b('0x110')][_0xa25b('0x127')](db['CmContact'],{'as':'Contacts','through':_0xa25b('0x128')});db[_0xa25b('0x110')][_0xa25b('0x127')](db['CmList'],{'as':_0xa25b('0x129'),'through':_0xa25b('0x12a')});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0xee')],{'through':'user_has_teams'});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x44')],{'as':_0xa25b('0x11f'),'through':_0xa25b('0x12b')});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x6c')],{'as':_0xa25b('0x11c'),'through':_0xa25b('0x12c')});db[_0xa25b('0x110')][_0xa25b('0x127')](db['FaxInteraction'],{'as':'FaxInteractions','through':_0xa25b('0x12d')});db['User'][_0xa25b('0x127')](db[_0xa25b('0x5d')],{'as':_0xa25b('0x11d'),'through':'user_has_sms_interactions'});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x62')],{'as':_0xa25b('0x12e'),'through':_0xa25b('0x12f')});db[_0xa25b('0x110')]['belongsToMany'](db[_0xa25b('0x108')],{'as':_0xa25b('0x120'),'through':'user_has_whatsapp_interactions'});db[_0xa25b('0x110')]['belongsToMany'](db[_0xa25b('0x1e')],{'as':_0xa25b('0x130'),'through':_0xa25b('0x31'),'required':![]});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x42')],{'as':'MailQueues','through':_0xa25b('0x35'),'required':![]});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x71')],{'as':_0xa25b('0x131'),'through':_0xa25b('0x33'),'required':![],'hooks':!![]});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x56')],{'as':'FaxQueues','through':_0xa25b('0x37'),'required':![]});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x132')],{'as':_0xa25b('0x133'),'through':_0xa25b('0x134'),'required':![]});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x65')],{'as':_0xa25b('0x135'),'through':_0xa25b('0x3a'),'required':![]});db['User']['belongsToMany'](db[_0xa25b('0x10e')],{'as':_0xa25b('0x136'),'through':_0xa25b('0x3c'),'required':![]});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0xfb')],{'through':_0xa25b('0x12a')});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0xfd')],{'as':_0xa25b('0x137'),'through':_0xa25b('0x138'),'required':![]});db[_0xa25b('0x110')][_0xa25b('0x127')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0xa25b('0x139')});db['User'][_0xa25b('0x127')](db[_0xa25b('0x4f')],{'as':_0xa25b('0x13a'),'through':_0xa25b('0x13b')});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x41')],{'as':'MailAccounts','through':_0xa25b('0x13c')});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0x60')],{'as':_0xa25b('0x13d'),'through':_0xa25b('0x13e')});db['User'][_0xa25b('0x127')](db['SmsAccount'],{'as':'SmsAccounts','through':_0xa25b('0x13f')});db[_0xa25b('0x110')]['belongsToMany'](db['WhatsappAccount'],{'as':_0xa25b('0x140'),'through':_0xa25b('0x141')});db[_0xa25b('0x110')][_0xa25b('0x127')](db[_0xa25b('0xe9')],{'as':_0xa25b('0x142'),'through':_0xa25b('0x143')});db['VoiceChanSpy'][_0xa25b('0x114')](db[_0xa25b('0x1b')],{'as':'SpiedAgents','onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x144')});db[_0xa25b('0x19')][_0xa25b('0x114')](db[_0xa25b('0x1b')],{'onDelete':_0xa25b('0x112')});db[_0xa25b('0x1b')][_0xa25b('0x114')](db[_0xa25b('0x1b')],{'as':_0xa25b('0x145'),'onDelete':_0xa25b('0x112')});db[_0xa25b('0x146')][_0xa25b('0x127')](db['Sound'],{'as':_0xa25b('0x147'),'through':_0xa25b('0x148')});db[_0xa25b('0x1e')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0xa25b('0x149'),'foreignKey':_0xa25b('0x14a')});db[_0xa25b('0x1e')]['hasMany'](db[_0xa25b('0x7b')],{'as':_0xa25b('0x14b'),'foreignKey':_0xa25b('0x14a')});db[_0xa25b('0x1e')][_0xa25b('0x114')](db[_0xa25b('0x7d')],{'as':_0xa25b('0x118'),'foreignKey':_0xa25b('0x14a')});db[_0xa25b('0x1e')][_0xa25b('0x114')](db[_0xa25b('0x119')],{'as':_0xa25b('0x14c'),'foreignKey':'VoiceQueueId'});db[_0xa25b('0x1e')][_0xa25b('0x114')](db[_0xa25b('0x11b')],{'as':'ReportAgentPreview','foreignKey':_0xa25b('0x14a')});db[_0xa25b('0x1e')][_0xa25b('0x114')](db[_0xa25b('0x14d')],{'as':'HopperBlacks','foreignKey':_0xa25b('0x14a')});db[_0xa25b('0x1e')][_0xa25b('0x114')](db[_0xa25b('0xe0')],{'as':_0xa25b('0x14e'),'foreignKey':_0xa25b('0x14a')});db[_0xa25b('0x1e')][_0xa25b('0x123')](db[_0xa25b('0x2c')],{'as':_0xa25b('0x2c'),'foreignKey':_0xa25b('0x14f')});db['VoiceQueue'][_0xa25b('0x123')](db[_0xa25b('0x2c')],{'as':_0xa25b('0x150'),'foreignKey':'TrunkBackupId'});db[_0xa25b('0x1e')]['belongsTo'](db[_0xa25b('0x8b')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xa25b('0x1e')][_0xa25b('0x123')](db[_0xa25b('0x8d')],{'as':_0xa25b('0x151'),'foreignKey':_0xa25b('0x152')});db[_0xa25b('0x1e')][_0xa25b('0x127')](db[_0xa25b('0xfb')],{'as':_0xa25b('0x129'),'through':_0xa25b('0x153')});db[_0xa25b('0x1e')]['belongsToMany'](db['User'],{'as':_0xa25b('0x154'),'through':'UserVoiceQueue'});db[_0xa25b('0x1e')][_0xa25b('0x127')](db['Team'],{'as':_0xa25b('0x155'),'through':'team_has_voice_queues'});db[_0xa25b('0x1e')]['belongsToMany'](db[_0xa25b('0xfb')],{'as':_0xa25b('0x156'),'through':_0xa25b('0x157')});db[_0xa25b('0x1f')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'as':_0xa25b('0x110'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x20')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'as':_0xa25b('0x110'),'foreignKey':'UserId'});db['VoiceMail'][_0xa25b('0x114')](db[_0xa25b('0x24')],{'as':_0xa25b('0x158'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x159'),'sourceKey':_0xa25b('0x15a')});db[_0xa25b('0x24')][_0xa25b('0x123')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xa25b('0x15a')});db[_0xa25b('0x15b')]['hasMany'](db[_0xa25b('0x29')],{'as':'QueueCalls','foreignKey':_0xa25b('0x15c'),'constraints':![]});db[_0xa25b('0x15b')][_0xa25b('0x114')](db[_0xa25b('0x27')],{'as':_0xa25b('0x15d'),'foreignKey':_0xa25b('0x15c'),'constraints':![]});db[_0xa25b('0x15b')][_0xa25b('0x123')](db['User'],{'as':_0xa25b('0x110'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x15b')][_0xa25b('0x123')](db[_0xa25b('0x79')],{'as':_0xa25b('0x15e'),'foreignKey':'ContactId'});db['MailServerIn'][_0xa25b('0x123')](db[_0xa25b('0x41')],{'as':_0xa25b('0x41'),'foreignKey':'MailAccountId'});db[_0xa25b('0x40')][_0xa25b('0x123')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xa25b('0x15f')});db[_0xa25b('0x41')][_0xa25b('0x111')](db['MailServerIn'],{'as':_0xa25b('0x160'),'onDelete':'cascade'});db['MailAccount'][_0xa25b('0x111')](db['MailServerOut'],{'as':_0xa25b('0x161'),'onDelete':'cascade'});db[_0xa25b('0x41')][_0xa25b('0x114')](db[_0xa25b('0x87')],{'as':_0xa25b('0x162'),'foreignKey':_0xa25b('0x15f')});db[_0xa25b('0x41')][_0xa25b('0x114')](db[_0xa25b('0x85')],{'as':_0xa25b('0x163'),'foreignKey':_0xa25b('0x15f')});db[_0xa25b('0x41')][_0xa25b('0x114')](db[_0xa25b('0x46')],{'as':_0xa25b('0x158'),'foreignKey':_0xa25b('0x15f')});db[_0xa25b('0x41')][_0xa25b('0x114')](db['MailInteraction'],{'as':_0xa25b('0x164')});db[_0xa25b('0x41')][_0xa25b('0x114')](db['MailApplication'],{'as':'Applications'});db[_0xa25b('0x41')]['belongsTo'](db[_0xa25b('0xfb')],{'as':_0xa25b('0x165'),'foreignKey':_0xa25b('0x166')});db[_0xa25b('0x41')]['belongsTo'](db[_0xa25b('0x97')],{'as':_0xa25b('0x97'),'foreignKey':'TemplateId'});db['MailAccount'][_0xa25b('0x123')](db[_0xa25b('0x8d')],{'as':_0xa25b('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue'][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':_0xa25b('0x35')});db[_0xa25b('0x42')][_0xa25b('0x127')](db['Team'],{'through':_0xa25b('0x167'),'as':'Teams'});db[_0xa25b('0x44')]['hasMany'](db['MailMessage'],{'as':'Messages','onDelete':_0xa25b('0x112'),'foreignKey':'MailInteractionId'});db[_0xa25b('0x44')][_0xa25b('0x123')](db[_0xa25b('0x41')],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x15f')});db[_0xa25b('0x44')]['belongsTo'](db[_0xa25b('0x79')],{'as':_0xa25b('0x15e'),'foreignKey':'ContactId'});db[_0xa25b('0x44')]['belongsTo'](db[_0xa25b('0x110')],{'as':_0xa25b('0x169'),'foreignKey':'UserId'});db['MailInteraction'][_0xa25b('0x127')](db['Tag'],{'through':_0xa25b('0x16a'),'as':_0xa25b('0x16b')});db['MailInteraction']['belongsToMany'](db[_0xa25b('0x95')],{'through':_0xa25b('0x16a'),'as':_0xa25b('0x16c')});db[_0xa25b('0x44')]['belongsToMany'](db[_0xa25b('0x110')],{'as':_0xa25b('0x16d'),'through':_0xa25b('0x12b'),'foreignKey':_0xa25b('0x16e')});db[_0xa25b('0x46')][_0xa25b('0x114')](db[_0xa25b('0x16f')],{'as':_0xa25b('0x170'),'onDelete':'cascade'});db['MailMessage'][_0xa25b('0x123')](db[_0xa25b('0x110')],{'as':_0xa25b('0x110')});db[_0xa25b('0x46')]['belongsTo'](db[_0xa25b('0x79')],{'onDelete':_0xa25b('0x112'),'as':_0xa25b('0x15e')});db['MailMessage']['belongsTo'](db[_0xa25b('0x44')],{'as':_0xa25b('0x171'),'foreignKey':_0xa25b('0x16e')});db[_0xa25b('0x46')][_0xa25b('0x123')](db[_0xa25b('0x41')],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x15f')});db[_0xa25b('0x48')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'onDelete':_0xa25b('0x172')});db[_0xa25b('0x48')][_0xa25b('0x123')](db[_0xa25b('0x42')],{'onDelete':_0xa25b('0x172')});db[_0xa25b('0x48')][_0xa25b('0x123')](db[_0xa25b('0x41')],{'onDelete':'restrict'});db['MailApplication'][_0xa25b('0x123')](db[_0xa25b('0x8b')],{'onDelete':_0xa25b('0x172'),'foreignKey':_0xa25b('0x173')});db['MailApplication'][_0xa25b('0x123')](db['Tag'],{'onDelete':_0xa25b('0x172'),'foreignKey':_0xa25b('0x174')});db[_0xa25b('0x49')][_0xa25b('0x123')](db['MailAccount'],{});db[_0xa25b('0x49')][_0xa25b('0x123')](db['CmList'],{'as':_0xa25b('0x165'),'foreignKey':_0xa25b('0x166')});db[_0xa25b('0x49')][_0xa25b('0x123')](db[_0xa25b('0x79')],{'as':_0xa25b('0x15e'),'foreignKey':'ContactId'});db['MailQueueReport']['belongsTo'](db[_0xa25b('0x44')],{});db[_0xa25b('0x49')]['belongsTo'](db[_0xa25b('0x46')],{});db[_0xa25b('0x49')]['belongsTo'](db[_0xa25b('0x110')],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db[_0xa25b('0x4b')][_0xa25b('0x114')](db[_0xa25b('0x4d')],{'as':_0xa25b('0x175'),'onDelete':_0xa25b('0x112')});db[_0xa25b('0x4f')]['hasMany'](db[_0xa25b('0x87')],{'as':_0xa25b('0x162'),'foreignKey':_0xa25b('0x176')});db[_0xa25b('0x4f')][_0xa25b('0x114')](db[_0xa25b('0x85')],{'as':_0xa25b('0x163'),'foreignKey':_0xa25b('0x176')});db[_0xa25b('0x4f')][_0xa25b('0x114')](db['FaxInteraction'],{'as':_0xa25b('0x164')});db[_0xa25b('0x4f')][_0xa25b('0x114')](db['FaxApplication'],{'as':_0xa25b('0x145')});db['FaxAccount'][_0xa25b('0x114')](db[_0xa25b('0x1b')],{'as':'Exntensions','onDelete':'cascade'});db['FaxAccount'][_0xa25b('0x114')](db[_0xa25b('0x54')],{'as':'Messages'});db[_0xa25b('0x4f')][_0xa25b('0x123')](db[_0xa25b('0x2c')],{'as':_0xa25b('0x2c')});db[_0xa25b('0x4f')][_0xa25b('0x123')](db['CmList'],{'as':_0xa25b('0x165'),'foreignKey':_0xa25b('0x166')});db[_0xa25b('0x4f')][_0xa25b('0x123')](db[_0xa25b('0x8d')],{'as':_0xa25b('0x151'),'foreignKey':_0xa25b('0x152')});db[_0xa25b('0x4f')][_0xa25b('0x127')](db['User'],{'as':_0xa25b('0x154'),'through':'user_has_fax_accounts'});db[_0xa25b('0x50')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'onDelete':_0xa25b('0x172')});db[_0xa25b('0x50')][_0xa25b('0x123')](db[_0xa25b('0x56')],{'onDelete':_0xa25b('0x172')});db['FaxApplication']['belongsTo'](db[_0xa25b('0x4f')],{'onDelete':_0xa25b('0x172')});db[_0xa25b('0x50')][_0xa25b('0x123')](db['Tag'],{'onDelete':_0xa25b('0x172'),'foreignKey':_0xa25b('0x174')});db[_0xa25b('0x52')][_0xa25b('0x114')](db[_0xa25b('0x54')],{'as':_0xa25b('0x158'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x177')});db[_0xa25b('0x52')]['belongsTo'](db[_0xa25b('0x4f')],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x176')});db[_0xa25b('0x52')][_0xa25b('0x123')](db['CmContact'],{'as':_0xa25b('0x15e'),'foreignKey':_0xa25b('0x178')});db[_0xa25b('0x52')]['belongsTo'](db[_0xa25b('0x110')],{'as':_0xa25b('0x169'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x52')][_0xa25b('0x127')](db[_0xa25b('0x95')],{'through':_0xa25b('0x179'),'as':'Tags'});db[_0xa25b('0x52')][_0xa25b('0x127')](db['Tag'],{'through':_0xa25b('0x179'),'as':'ThroughTags'});db[_0xa25b('0x52')]['belongsToMany'](db[_0xa25b('0x110')],{'as':'Users','through':_0xa25b('0x12d'),'foreignKey':'FaxInteractionId'});db[_0xa25b('0x54')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'onDelete':_0xa25b('0x112'),'as':'User'});db[_0xa25b('0x54')][_0xa25b('0x123')](db['FaxInteraction'],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0xa25b('0x54')]['belongsTo'](db[_0xa25b('0x79')],{'onDelete':_0xa25b('0x112'),'as':'Contact'});db['FaxMessage'][_0xa25b('0x123')](db[_0xa25b('0x16f')],{'as':'Attachment','foreignKey':_0xa25b('0x17a')});db[_0xa25b('0x54')][_0xa25b('0x123')](db['FaxAccount'],{'as':_0xa25b('0x168'),'foreignKey':'FaxAccountId'});db['FaxQueue'][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':_0xa25b('0x37')});db[_0xa25b('0x56')][_0xa25b('0x127')](db[_0xa25b('0xee')],{'through':_0xa25b('0x17b'),'as':_0xa25b('0x155')});db[_0xa25b('0x58')]['belongsTo'](db['FaxAccount'],{});db[_0xa25b('0x58')][_0xa25b('0x123')](db[_0xa25b('0xfb')],{'as':_0xa25b('0x165'),'foreignKey':_0xa25b('0x166')});db[_0xa25b('0x58')][_0xa25b('0x123')](db[_0xa25b('0x79')],{'as':'Contact','foreignKey':_0xa25b('0x178')});db[_0xa25b('0x58')]['belongsTo'](db['FaxInteraction'],{});db[_0xa25b('0x58')][_0xa25b('0x123')](db[_0xa25b('0x54')],{});db[_0xa25b('0x58')]['belongsTo'](db[_0xa25b('0x110')],{});db[_0xa25b('0x58')][_0xa25b('0x123')](db[_0xa25b('0x56')],{});db[_0xa25b('0x59')][_0xa25b('0x114')](db['Disposition'],{'as':_0xa25b('0x162'),'foreignKey':'SmsAccountId'});db[_0xa25b('0x59')][_0xa25b('0x114')](db['CannedAnswer'],{'as':_0xa25b('0x163'),'foreignKey':_0xa25b('0x17c')});db[_0xa25b('0x59')][_0xa25b('0x114')](db[_0xa25b('0x17d')],{'as':_0xa25b('0x158'),'foreignKey':_0xa25b('0x17c')});db['SmsAccount']['hasMany'](db[_0xa25b('0x5d')],{'as':'Interactions'});db[_0xa25b('0x59')]['hasMany'](db[_0xa25b('0x5b')],{'as':'Applications'});db[_0xa25b('0x59')][_0xa25b('0x123')](db['CmList'],{'as':'List','foreignKey':_0xa25b('0x166')});db['SmsAccount']['belongsTo'](db[_0xa25b('0x8d')],{'as':_0xa25b('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db['SmsAccount']['belongsToMany'](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':_0xa25b('0x13f')});db[_0xa25b('0x5b')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'onDelete':_0xa25b('0x172')});db[_0xa25b('0x5b')][_0xa25b('0x123')](db[_0xa25b('0x132')],{'onDelete':_0xa25b('0x172')});db[_0xa25b('0x5b')][_0xa25b('0x123')](db['SmsAccount'],{'onDelete':'restrict'});db[_0xa25b('0x5b')][_0xa25b('0x123')](db[_0xa25b('0x8b')],{'onDelete':_0xa25b('0x172'),'foreignKey':_0xa25b('0x173')});db[_0xa25b('0x5b')][_0xa25b('0x123')](db[_0xa25b('0x95')],{'onDelete':_0xa25b('0x172'),'foreignKey':_0xa25b('0x174')});db[_0xa25b('0x5d')][_0xa25b('0x114')](db[_0xa25b('0x17d')],{'as':_0xa25b('0x158'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x17e')});db[_0xa25b('0x5d')][_0xa25b('0x123')](db[_0xa25b('0x59')],{'as':'Account','foreignKey':_0xa25b('0x17c')});db[_0xa25b('0x5d')]['belongsTo'](db[_0xa25b('0x79')],{'as':'Contact','foreignKey':'ContactId'});db[_0xa25b('0x5d')][_0xa25b('0x123')](db['User'],{'as':'Owner','foreignKey':_0xa25b('0x113')});db[_0xa25b('0x5d')][_0xa25b('0x127')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xa25b('0x16b')});db[_0xa25b('0x5d')][_0xa25b('0x127')](db[_0xa25b('0x95')],{'through':'sms_interaction_has_tags','as':_0xa25b('0x16c')});db[_0xa25b('0x5d')][_0xa25b('0x127')](db['User'],{'as':_0xa25b('0x16d'),'through':_0xa25b('0x17f'),'foreignKey':_0xa25b('0x17e')});db['SmsMessage'][_0xa25b('0x123')](db[_0xa25b('0x110')],{'as':_0xa25b('0x110')});db[_0xa25b('0x17d')][_0xa25b('0x123')](db['CmContact'],{'onDelete':'cascade','as':_0xa25b('0x15e')});db['SmsMessage'][_0xa25b('0x123')](db[_0xa25b('0x5d')],{'onDelete':_0xa25b('0x112'),'as':_0xa25b('0x171'),'foreignKey':_0xa25b('0x17e')});db['SmsMessage'][_0xa25b('0x123')](db[_0xa25b('0x59')],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x17c')});db['SmsQueue'][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':'UserSmsQueue','foreignKey':_0xa25b('0x180')});db[_0xa25b('0x132')][_0xa25b('0x127')](db[_0xa25b('0xee')],{'through':_0xa25b('0x181'),'as':_0xa25b('0x155')});db[_0xa25b('0x60')]['hasMany'](db[_0xa25b('0x87')],{'as':'Dispositions','foreignKey':_0xa25b('0x182')});db[_0xa25b('0x60')]['hasMany'](db[_0xa25b('0x85')],{'as':_0xa25b('0x163'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xa25b('0x114')](db[_0xa25b('0x62')],{'as':_0xa25b('0x164'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xa25b('0x114')](db[_0xa25b('0x183')],{'as':'Messages','foreignKey':_0xa25b('0x182')});db['OpenchannelAccount'][_0xa25b('0x114')](db[_0xa25b('0x61')],{'as':_0xa25b('0x145'),'foreignKey':'OpenchannelAccountId'});db[_0xa25b('0x60')][_0xa25b('0x123')](db['CmList'],{'as':_0xa25b('0x165'),'foreignKey':'ListId'});db[_0xa25b('0x60')][_0xa25b('0x123')](db[_0xa25b('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0xa25b('0x152')});db[_0xa25b('0x60')][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':_0xa25b('0x13e')});db[_0xa25b('0x61')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'onDelete':_0xa25b('0x172')});db[_0xa25b('0x61')][_0xa25b('0x123')](db[_0xa25b('0x65')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0xa25b('0x61')][_0xa25b('0x123')](db[_0xa25b('0x60')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xa25b('0x61')][_0xa25b('0x123')](db[_0xa25b('0x8b')],{'onDelete':_0xa25b('0x172'),'foreignKey':_0xa25b('0x173')});db[_0xa25b('0x61')][_0xa25b('0x123')](db[_0xa25b('0x95')],{'onDelete':_0xa25b('0x172'),'foreignKey':_0xa25b('0x174')});db['OpenchannelInteraction'][_0xa25b('0x114')](db['OpenchannelMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0xa25b('0x184')});db[_0xa25b('0x62')][_0xa25b('0x123')](db[_0xa25b('0x60')],{'as':_0xa25b('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0xa25b('0x62')]['belongsTo'](db[_0xa25b('0x79')],{'as':_0xa25b('0x15e'),'foreignKey':'ContactId'});db['OpenchannelInteraction'][_0xa25b('0x123')](db[_0xa25b('0x110')],{'as':_0xa25b('0x169'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x62')][_0xa25b('0x127')](db['Tag'],{'through':_0xa25b('0x185'),'as':_0xa25b('0x16b')});db[_0xa25b('0x62')]['belongsToMany'](db[_0xa25b('0x95')],{'through':'openchannel_interaction_has_tags','as':_0xa25b('0x16c')});db[_0xa25b('0x62')][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':_0xa25b('0x16d'),'through':'user_has_openchannel_interactions','foreignKey':_0xa25b('0x184')});db[_0xa25b('0x183')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'onDelete':_0xa25b('0x112'),'as':_0xa25b('0x110')});db['OpenchannelMessage'][_0xa25b('0x123')](db[_0xa25b('0x79')],{'onDelete':_0xa25b('0x112'),'as':'Contact'});db[_0xa25b('0x183')][_0xa25b('0x123')](db[_0xa25b('0x62')],{'onDelete':_0xa25b('0x112'),'as':_0xa25b('0x171'),'foreignKey':_0xa25b('0x184')});db[_0xa25b('0x183')]['belongsTo'](db[_0xa25b('0x16f')],{'as':_0xa25b('0x16f'),'foreignKey':_0xa25b('0x17a')});db[_0xa25b('0x183')][_0xa25b('0x123')](db['OpenchannelAccount'],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x182')});db['OpenchannelQueue']['belongsToMany'](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0xa25b('0x65')][_0xa25b('0x127')](db['Team'],{'through':_0xa25b('0x186'),'as':_0xa25b('0x155')});db[_0xa25b('0x67')][_0xa25b('0x114')](db[_0xa25b('0x87')],{'as':'Dispositions','foreignKey':_0xa25b('0x187')});db[_0xa25b('0x67')][_0xa25b('0x114')](db[_0xa25b('0x85')],{'as':_0xa25b('0x163'),'foreignKey':_0xa25b('0x187')});db[_0xa25b('0x67')][_0xa25b('0x114')](db['ChatProactiveAction'],{'as':_0xa25b('0x188')});db[_0xa25b('0x67')]['hasMany'](db[_0xa25b('0x6c')],{'as':_0xa25b('0x164')});db[_0xa25b('0x67')][_0xa25b('0x114')](db[_0xa25b('0x6a')],{'as':_0xa25b('0x145')});db[_0xa25b('0x67')][_0xa25b('0x114')](db[_0xa25b('0x6e')],{'as':_0xa25b('0x158')});db[_0xa25b('0x67')]['belongsTo'](db[_0xa25b('0xfb')],{'as':'List','foreignKey':_0xa25b('0x166')});db[_0xa25b('0x67')][_0xa25b('0x123')](db[_0xa25b('0x8b')],{'as':_0xa25b('0x8b'),'foreignKey':_0xa25b('0x173')});db['ChatWebsite']['belongsTo'](db[_0xa25b('0x8d')],{'as':_0xa25b('0x151'),'foreignKey':_0xa25b('0x152')});db[_0xa25b('0x67')]['belongsToMany'](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':'user_has_chat_websites'});db[_0xa25b('0x189')][_0xa25b('0x123')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0xa25b('0x123')](db[_0xa25b('0xfb')],{'as':_0xa25b('0x165'),'foreignKey':_0xa25b('0x166')});db[_0xa25b('0x189')][_0xa25b('0x123')](db['CmContact'],{'as':_0xa25b('0x15e'),'foreignKey':'ContactId'});db[_0xa25b('0x189')][_0xa25b('0x123')](db[_0xa25b('0x62')],{});db[_0xa25b('0x189')][_0xa25b('0x123')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0xa25b('0x123')](db['User'],{});db[_0xa25b('0x189')]['belongsTo'](db[_0xa25b('0x65')],{});db[_0xa25b('0x6a')][_0xa25b('0x123')](db['User'],{'as':'Agent','foreignKey':_0xa25b('0x113'),'onDelete':_0xa25b('0x172')});db[_0xa25b('0x6a')][_0xa25b('0x123')](db[_0xa25b('0x71')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xa25b('0x172')});db[_0xa25b('0x6a')][_0xa25b('0x123')](db['ChatWebsite'],{'as':_0xa25b('0x18a'),'foreignKey':'ChatWebsiteId','onDelete':_0xa25b('0x172')});db[_0xa25b('0x6a')][_0xa25b('0x123')](db['Tag'],{'onDelete':_0xa25b('0x172'),'foreignKey':'TagId'});db[_0xa25b('0x6c')][_0xa25b('0x114')](db[_0xa25b('0x6e')],{'as':_0xa25b('0x158'),'onDelete':_0xa25b('0x112'),'foreignKey':'ChatInteractionId'});db[_0xa25b('0x6c')][_0xa25b('0x123')](db[_0xa25b('0x67')],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x187')});db[_0xa25b('0x6c')][_0xa25b('0x123')](db['CmContact'],{'as':_0xa25b('0x15e'),'foreignKey':_0xa25b('0x178')});db[_0xa25b('0x6c')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'as':_0xa25b('0x169'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x6c')][_0xa25b('0x127')](db['Tag'],{'through':_0xa25b('0x18b'),'as':_0xa25b('0x16b')});db['ChatInteraction'][_0xa25b('0x127')](db[_0xa25b('0x95')],{'through':_0xa25b('0x18b'),'as':_0xa25b('0x16c')});db[_0xa25b('0x6c')][_0xa25b('0x127')](db['User'],{'as':_0xa25b('0x16d'),'through':_0xa25b('0x12c'),'foreignKey':_0xa25b('0x18c')});db[_0xa25b('0x6e')][_0xa25b('0x123')](db['User'],{'onDelete':_0xa25b('0x112'),'as':'User'});db[_0xa25b('0x6e')][_0xa25b('0x123')](db[_0xa25b('0x79')],{'onDelete':_0xa25b('0x112'),'as':_0xa25b('0x15e'),'foreignKey':_0xa25b('0x178')});db[_0xa25b('0x6e')][_0xa25b('0x123')](db[_0xa25b('0x6c')],{'onDelete':'cascade','as':_0xa25b('0x171'),'foreignKey':_0xa25b('0x18c')});db[_0xa25b('0x6e')][_0xa25b('0x123')](db[_0xa25b('0x16f')],{'as':'Attachment','foreignKey':_0xa25b('0x17a')});db[_0xa25b('0x6e')][_0xa25b('0x123')](db[_0xa25b('0x67')],{'as':_0xa25b('0x168'),'foreignKey':'ChatWebsiteId'});db[_0xa25b('0x70')][_0xa25b('0x123')](db['CmContact'],{'onDelete':_0xa25b('0x112'),'as':_0xa25b('0x15e'),'foreignKey':_0xa25b('0x178')});db[_0xa25b('0x70')]['belongsTo'](db['ChatWebsite'],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x187')});db[_0xa25b('0x71')][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':_0xa25b('0x33'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db['Team'],{'through':_0xa25b('0x18d'),'as':'Teams'});db[_0xa25b('0x73')]['hasMany'](db[_0xa25b('0xdc')],{'as':_0xa25b('0x158'),'foreignKey':_0xa25b('0x18e'),'onDelete':'cascade'});db[_0xa25b('0x73')][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':_0xa25b('0x149'),'through':_0xa25b('0x18f')});db[_0xa25b('0x75')][_0xa25b('0x123')](db[_0xa25b('0x67')],{'as':_0xa25b('0x18a'),'foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db[_0xa25b('0x79')],{'as':_0xa25b('0x190'),'foreignKey':_0xa25b('0x191')});db[_0xa25b('0x79')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xa25b('0x178')});db[_0xa25b('0x79')]['hasMany'](db[_0xa25b('0x7d')],{'as':_0xa25b('0x118'),'foreignKey':'ContactId'});db['CmContact'][_0xa25b('0x114')](db[_0xa25b('0x119')],{'as':'HopperHistories','foreignKey':_0xa25b('0x178')});db[_0xa25b('0x79')][_0xa25b('0x114')](db[_0xa25b('0x11b')],{'as':_0xa25b('0x11b'),'foreignKey':_0xa25b('0x178')});db['CmContact'][_0xa25b('0x114')](db[_0xa25b('0xe0')],{'as':_0xa25b('0x14e'),'foreignKey':'ContactId'});db[_0xa25b('0x79')][_0xa25b('0x114')](db['OpenchannelInteraction'],{'as':_0xa25b('0x12e'),'foreignKey':_0xa25b('0x178'),'onDelete':'restrict'});db[_0xa25b('0x79')][_0xa25b('0x114')](db[_0xa25b('0x6c')],{'as':_0xa25b('0x11c'),'foreignKey':_0xa25b('0x178'),'onDelete':_0xa25b('0x172')});db['CmContact'][_0xa25b('0x114')](db[_0xa25b('0x5d')],{'as':_0xa25b('0x11d'),'foreignKey':_0xa25b('0x178'),'onDelete':_0xa25b('0x172')});db['CmContact'][_0xa25b('0x114')](db['FaxInteraction'],{'as':_0xa25b('0x11e'),'foreignKey':_0xa25b('0x178'),'onDelete':_0xa25b('0x172')});db['CmContact']['hasMany'](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xa25b('0x178'),'onDelete':_0xa25b('0x172')});db[_0xa25b('0x79')][_0xa25b('0x123')](db[_0xa25b('0x77')],{'as':_0xa25b('0x192'),'foreignKey':_0xa25b('0x191')});db[_0xa25b('0x79')]['belongsTo'](db[_0xa25b('0xfb')],{'as':_0xa25b('0x165'),'foreignKey':_0xa25b('0x166'),'onDelete':_0xa25b('0x112')});db['CmContact'][_0xa25b('0x127')](db['User'],{'as':_0xa25b('0x16d'),'through':_0xa25b('0x128')});db[_0xa25b('0x79')][_0xa25b('0x127')](db[_0xa25b('0x95')],{'as':'Tags','through':_0xa25b('0x193')});db['CmContact'][_0xa25b('0x127')](db[_0xa25b('0x95')],{'through':_0xa25b('0x193'),'as':_0xa25b('0x16c')});db['CmHopper']['belongsTo'](db[_0xa25b('0x79')],{'as':'Contact','foreignKey':_0xa25b('0x178'),'onDelete':_0xa25b('0x112')});db[_0xa25b('0x7b')][_0xa25b('0x123')](db['CmList'],{'as':_0xa25b('0x165'),'foreignKey':_0xa25b('0x166'),'onDelete':_0xa25b('0x112')});db[_0xa25b('0x7b')]['belongsTo'](db[_0xa25b('0x110')],{'as':_0xa25b('0x194'),'foreignKey':_0xa25b('0x113')});db[_0xa25b('0x7b')][_0xa25b('0x123')](db[_0xa25b('0x1e')],{'as':_0xa25b('0x195'),'foreignKey':'VoiceQueueId','onDelete':_0xa25b('0x112')});db[_0xa25b('0x7b')][_0xa25b('0x123')](db['Campaign'],{'as':_0xa25b('0x196'),'foreignKey':_0xa25b('0x197'),'onDelete':_0xa25b('0x112')});db[_0xa25b('0x7b')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'as':_0xa25b('0x169'),'foreignKey':_0xa25b('0x198')});db[_0xa25b('0x14d')][_0xa25b('0x123')](db[_0xa25b('0x79')],{'as':_0xa25b('0x15e'),'foreignKey':_0xa25b('0x178'),'onDelete':_0xa25b('0x112')});db['CmHopperBlack'][_0xa25b('0x123')](db[_0xa25b('0xfb')],{'as':'List','foreignKey':_0xa25b('0x166'),'onDelete':'cascade'});db['CmHopperBlack'][_0xa25b('0x123')](db[_0xa25b('0x1e')],{'as':_0xa25b('0x195'),'foreignKey':_0xa25b('0x14a'),'onDelete':_0xa25b('0x112')});db[_0xa25b('0x14d')][_0xa25b('0x123')](db[_0xa25b('0x196')],{'as':_0xa25b('0x196'),'foreignKey':_0xa25b('0x197'),'onDelete':_0xa25b('0x112')});db[_0xa25b('0x83')]['hasMany'](db[_0xa25b('0x89')],{'as':{'plural':_0xa25b('0x199'),'singular':_0xa25b('0x19a')},'foreignKey':_0xa25b('0x19b'),'onDelete':_0xa25b('0x112'),'hooks':!![]});db['Automation'][_0xa25b('0x114')](db['Condition'],{'as':{'plural':'Any','singular':_0xa25b('0x19c')},'foreignKey':_0xa25b('0x19d'),'onDelete':_0xa25b('0x112'),'hooks':!![]});db[_0xa25b('0x83')]['hasMany'](db[_0xa25b('0x81')],{'as':_0xa25b('0x19e'),'foreignKey':_0xa25b('0x19f'),'onDelete':_0xa25b('0x112'),'hooks':!![]});db[_0xa25b('0x87')][_0xa25b('0x114')](db[_0xa25b('0x87')],{'as':_0xa25b('0x162'),'foreignKey':'ParentId','onDelete':_0xa25b('0x112')});db[_0xa25b('0x8b')][_0xa25b('0x114')](db[_0xa25b('0x8b')],{'as':'Intervals','foreignKey':_0xa25b('0x173'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xa25b('0x8b')][_0xa25b('0x114')](db[_0xa25b('0x1b')],{'as':'Extensions','foreignKey':_0xa25b('0x173'),'onDelete':_0xa25b('0x172')});db[_0xa25b('0x8b')]['hasMany'](db['MailApplication'],{'as':_0xa25b('0x1a0'),'foreignKey':'IntervalId'});db[_0xa25b('0x8b')][_0xa25b('0x114')](db['ChatApplication'],{'as':_0xa25b('0x1a1'),'foreignKey':_0xa25b('0x173')});db[_0xa25b('0x8b')]['hasMany'](db[_0xa25b('0x50')],{'as':_0xa25b('0x1a2'),'foreignKey':_0xa25b('0x173')});db[_0xa25b('0x8b')]['hasMany'](db[_0xa25b('0x5b')],{'as':_0xa25b('0x1a3'),'foreignKey':_0xa25b('0x173')});db[_0xa25b('0x92')][_0xa25b('0x123')](db[_0xa25b('0x41')],{});db[_0xa25b('0x92')][_0xa25b('0x123')](db['AnalyticDefaultReport'],{'foreignKey':_0xa25b('0x1a4')});db[_0xa25b('0x92')][_0xa25b('0x123')](db[_0xa25b('0x9f')],{'foreignKey':_0xa25b('0x1a5')});db[_0xa25b('0x1a6')][_0xa25b('0x127')](db[_0xa25b('0x146')],{'as':_0xa25b('0x1a7'),'through':_0xa25b('0x148'),'onDelete':_0xa25b('0x172')});db['Tag'][_0xa25b('0x127')](db[_0xa25b('0x79')],{'through':_0xa25b('0x193')});db[_0xa25b('0x95')][_0xa25b('0x127')](db[_0xa25b('0x6c')],{'through':'chat_interaction_has_tags'});db[_0xa25b('0x95')][_0xa25b('0x127')](db[_0xa25b('0x44')],{'through':'mail_interaction_has_tags'});db[_0xa25b('0x95')][_0xa25b('0x127')](db[_0xa25b('0x5d')],{'through':_0xa25b('0x1a8')});db[_0xa25b('0x95')][_0xa25b('0x127')](db[_0xa25b('0x52')],{'through':_0xa25b('0x179')});db['Tag'][_0xa25b('0x127')](db[_0xa25b('0x62')],{'through':_0xa25b('0x185')});db[_0xa25b('0x95')][_0xa25b('0x127')](db['WhatsappInteraction'],{'through':_0xa25b('0x1a9')});db[_0xa25b('0x99')][_0xa25b('0x114')](db[_0xa25b('0x89')],{'as':{'plural':_0xa25b('0x1aa'),'singular':'AllCondition'},'foreignKey':_0xa25b('0x1ab'),'onDelete':_0xa25b('0x112'),'hooks':!![]});db[_0xa25b('0x99')]['hasMany'](db[_0xa25b('0x89')],{'as':{'plural':_0xa25b('0x1ac'),'singular':'AnyCondition'},'foreignKey':_0xa25b('0x1ad'),'onDelete':_0xa25b('0x112'),'hooks':!![]});db[_0xa25b('0x99')][_0xa25b('0x114')](db[_0xa25b('0x81')],{'as':_0xa25b('0x19e'),'foreignKey':_0xa25b('0x1ae'),'onDelete':_0xa25b('0x112'),'hooks':!![]});db[_0xa25b('0x9f')]['hasMany'](db[_0xa25b('0xa7')],{'as':_0xa25b('0x1af'),'onDelete':'cascade','foreignKey':_0xa25b('0x1a5'),'hooks':!![]});db[_0xa25b('0xa1')][_0xa25b('0x114')](db['AnalyticFieldReport'],{'as':_0xa25b('0x1af'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1a4')});db[_0xa25b('0xa5')]['hasMany'](db[_0xa25b('0xa7')],{'as':_0xa25b('0x1af'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b0')});db[_0xa25b('0xa7')][_0xa25b('0x123')](db[_0xa25b('0xa5')],{'foreignKey':_0xa25b('0x1b0')});db[_0xa25b('0xab')][_0xa25b('0x114')](db['SalesforceConfiguration'],{'as':_0xa25b('0x1b1'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xac')][_0xa25b('0x114')](db[_0xa25b('0x1b3')],{'as':_0xa25b('0x1b4'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0xac')][_0xa25b('0x114')](db[_0xa25b('0x1b3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xa25b('0x1b6')});db[_0xa25b('0xac')][_0xa25b('0x114')](db[_0xa25b('0x1b3')],{'as':_0xa25b('0x1af'),'onDelete':'cascade','foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xac')][_0xa25b('0x123')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0x1b3')][_0xa25b('0x114')](db['SalesforceField'],{'as':_0xa25b('0x1b8'),'foreignKey':'SubjectId'});db[_0xa25b('0x1b3')][_0xa25b('0x114')](db['SalesforceField'],{'as':'Description','foreignKey':_0xa25b('0x1b6')});db['SalesforceField'][_0xa25b('0x114')](db[_0xa25b('0x1b3')],{'as':_0xa25b('0x1b9'),'foreignKey':'FieldId'});db['SalesforceField'][_0xa25b('0x123')](db[_0xa25b('0x9b')],{'as':_0xa25b('0x9b'),'foreignKey':_0xa25b('0x1ba')});db[_0xa25b('0xaf')][_0xa25b('0x114')](db[_0xa25b('0xb0')],{'as':'Configurations','onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xb0')]['hasMany'](db[_0xa25b('0xb1')],{'as':_0xa25b('0x1b4'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b5')});db['SugarcrmConfiguration'][_0xa25b('0x114')](db[_0xa25b('0xb1')],{'as':'Descriptions','onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b6')});db[_0xa25b('0xb0')][_0xa25b('0x114')](db['SugarcrmField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xb0')]['belongsTo'](db[_0xa25b('0xaf')],{'as':_0xa25b('0x168'),'foreignKey':'AccountId'});db[_0xa25b('0xb1')][_0xa25b('0x114')](db[_0xa25b('0xb1')],{'as':_0xa25b('0x1b8'),'foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0xb1')]['hasMany'](db['SugarcrmField'],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0xa25b('0x114')](db[_0xa25b('0xb1')],{'as':_0xa25b('0x1b9'),'foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xb1')][_0xa25b('0x123')](db['Variable'],{'as':_0xa25b('0x9b'),'foreignKey':_0xa25b('0x1ba')});db['DeskAccount'][_0xa25b('0x114')](db[_0xa25b('0xb3')],{'as':_0xa25b('0x1b1'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xb3')][_0xa25b('0x114')](db[_0xa25b('0xb5')],{'as':_0xa25b('0x1b4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xa25b('0xb3')]['hasMany'](db['DeskField'],{'as':_0xa25b('0x1bb'),'onDelete':_0xa25b('0x112'),'foreignKey':'DescriptionId'});db[_0xa25b('0xb3')]['hasMany'](db[_0xa25b('0xb5')],{'as':_0xa25b('0x1af'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xb3')]['belongsTo'](db['DeskAccount'],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xb3')][_0xa25b('0x127')](db[_0xa25b('0x95')],{'through':_0xa25b('0x1bc')});db[_0xa25b('0xb5')][_0xa25b('0x114')](db['DeskField'],{'as':_0xa25b('0x1b8'),'foreignKey':_0xa25b('0x1b5')});db['DeskField']['hasMany'](db['DeskField'],{'as':'Description','foreignKey':_0xa25b('0x1b6')});db[_0xa25b('0xb5')]['hasMany'](db[_0xa25b('0xb5')],{'as':_0xa25b('0x1b9'),'foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xb5')]['belongsTo'](db[_0xa25b('0x9b')],{'as':_0xa25b('0x9b'),'foreignKey':_0xa25b('0x1ba')});db[_0xa25b('0x1bd')][_0xa25b('0x114')](db['ZohoConfiguration'],{'as':_0xa25b('0x1b1'),'onDelete':_0xa25b('0x112'),'foreignKey':'AccountId'});db[_0xa25b('0xb8')][_0xa25b('0x114')](db['ZohoField'],{'as':_0xa25b('0x1b4'),'onDelete':_0xa25b('0x112'),'foreignKey':'SubjectId'});db['ZohoConfiguration'][_0xa25b('0x114')](db[_0xa25b('0xba')],{'as':_0xa25b('0x1bb'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b6')});db['ZohoConfiguration'][_0xa25b('0x114')](db[_0xa25b('0xba')],{'as':'Fields','onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xb8')]['belongsTo'](db[_0xa25b('0x1bd')],{'as':_0xa25b('0x168'),'foreignKey':'AccountId'});db[_0xa25b('0xba')][_0xa25b('0x114')](db['ZohoField'],{'as':_0xa25b('0x1b8'),'foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0xba')][_0xa25b('0x114')](db[_0xa25b('0xba')],{'as':_0xa25b('0x1be'),'foreignKey':_0xa25b('0x1b6')});db['ZohoField'][_0xa25b('0x114')](db[_0xa25b('0xba')],{'as':_0xa25b('0x1b9'),'foreignKey':'FieldId'});db[_0xa25b('0xba')]['belongsTo'](db[_0xa25b('0x9b')],{'as':'Variable','foreignKey':'VariableId'});db[_0xa25b('0xbc')][_0xa25b('0x114')](db[_0xa25b('0xbe')],{'as':_0xa25b('0x1b1'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xbe')]['hasMany'](db[_0xa25b('0x1bf')],{'as':_0xa25b('0x1b4'),'foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0xbe')]['hasMany'](db[_0xa25b('0x1bf')],{'as':_0xa25b('0x1bb'),'foreignKey':_0xa25b('0x1b6')});db[_0xa25b('0xbe')][_0xa25b('0x114')](db['ZendeskField'],{'as':_0xa25b('0x1af'),'foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xbe')][_0xa25b('0x123')](db[_0xa25b('0xbc')],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x1b2')});db['ZendeskConfiguration'][_0xa25b('0x127')](db[_0xa25b('0x95')],{'through':_0xa25b('0x1c0')});db[_0xa25b('0x1bf')][_0xa25b('0x114')](db[_0xa25b('0x1bf')],{'as':_0xa25b('0x1b8'),'foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0x1bf')][_0xa25b('0x114')](db[_0xa25b('0x1bf')],{'as':'Description','foreignKey':'DescriptionId'});db['ZendeskField'][_0xa25b('0x114')](db['ZendeskField'],{'as':_0xa25b('0x1b9'),'foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0x1bf')][_0xa25b('0x123')](db[_0xa25b('0x9b')],{'as':_0xa25b('0x9b'),'foreignKey':_0xa25b('0x1ba')});db[_0xa25b('0x1c1')]['hasMany'](db[_0xa25b('0xc1')],{'as':_0xa25b('0x1b1'),'onDelete':'cascade','foreignKey':_0xa25b('0x1b2')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xa25b('0x1b4'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0xc1')][_0xa25b('0x114')](db[_0xa25b('0xc3')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xa25b('0x1b6')});db[_0xa25b('0xc1')]['hasMany'](db[_0xa25b('0xc3')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xc1')][_0xa25b('0x123')](db[_0xa25b('0x1c1')],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xc1')][_0xa25b('0x127')](db['Tag'],{'through':_0xa25b('0x1c2')});db[_0xa25b('0xc3')][_0xa25b('0x114')](db[_0xa25b('0xc3')],{'as':_0xa25b('0x1b8'),'foreignKey':'SubjectId'});db[_0xa25b('0xc3')][_0xa25b('0x114')](db[_0xa25b('0xc3')],{'as':_0xa25b('0x1be'),'foreignKey':'DescriptionId'});db[_0xa25b('0xc3')][_0xa25b('0x114')](db[_0xa25b('0xc3')],{'as':_0xa25b('0x1b9'),'foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xc3')][_0xa25b('0x123')](db[_0xa25b('0x9b')],{'as':_0xa25b('0x9b'),'foreignKey':_0xa25b('0x1ba')});db[_0xa25b('0xc5')][_0xa25b('0x114')](db['VtigerConfiguration'],{'as':_0xa25b('0x1b1'),'onDelete':_0xa25b('0x112'),'foreignKey':'AccountId'});db[_0xa25b('0xc7')][_0xa25b('0x114')](db[_0xa25b('0x1c3')],{'as':'Subjects','foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0xc7')]['hasMany'](db[_0xa25b('0x1c3')],{'as':_0xa25b('0x1bb'),'foreignKey':_0xa25b('0x1b6')});db['VtigerConfiguration'][_0xa25b('0x114')](db[_0xa25b('0x1c3')],{'as':_0xa25b('0x1af'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0xa25b('0x123')](db[_0xa25b('0xc5')],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0x1c3')][_0xa25b('0x114')](db['VtigerField'],{'as':_0xa25b('0x1b8'),'foreignKey':'SubjectId'});db[_0xa25b('0x1c3')][_0xa25b('0x114')](db['VtigerField'],{'as':_0xa25b('0x1be'),'foreignKey':_0xa25b('0x1b6')});db[_0xa25b('0x1c3')][_0xa25b('0x114')](db['VtigerField'],{'as':'Field','foreignKey':'FieldId'});db[_0xa25b('0x1c3')][_0xa25b('0x123')](db[_0xa25b('0x9b')],{'as':_0xa25b('0x9b'),'foreignKey':_0xa25b('0x1ba')});db[_0xa25b('0xca')]['hasMany'](db[_0xa25b('0xcc')],{'as':_0xa25b('0x1b1'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xcc')]['hasMany'](db[_0xa25b('0xcd')],{'as':_0xa25b('0x1b4'),'foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0xcc')][_0xa25b('0x114')](db[_0xa25b('0xcd')],{'as':_0xa25b('0x1bb'),'foreignKey':_0xa25b('0x1b6')});db['ServicenowConfiguration'][_0xa25b('0x114')](db[_0xa25b('0xcd')],{'as':_0xa25b('0x1af'),'foreignKey':_0xa25b('0x1b7')});db['ServicenowConfiguration'][_0xa25b('0x123')](db['ServicenowAccount'],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xcd')]['hasMany'](db['ServicenowField'],{'as':_0xa25b('0x1b8'),'foreignKey':_0xa25b('0x1b5')});db['ServicenowField'][_0xa25b('0x114')](db['ServicenowField'],{'as':_0xa25b('0x1be'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0xa25b('0x114')](db[_0xa25b('0xcd')],{'as':_0xa25b('0x1b9'),'foreignKey':_0xa25b('0x1b7')});db['ServicenowField']['belongsTo'](db[_0xa25b('0x9b')],{'as':_0xa25b('0x9b'),'foreignKey':'VariableId'});db[_0xa25b('0xcf')][_0xa25b('0x114')](db[_0xa25b('0xd1')],{'as':'Configurations','onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xd1')][_0xa25b('0x114')](db['Dynamics365Field'],{'as':_0xa25b('0x1b4'),'onDelete':_0xa25b('0x112'),'foreignKey':'SubjectId'});db[_0xa25b('0xd1')][_0xa25b('0x114')](db[_0xa25b('0xd3')],{'as':_0xa25b('0x1bb'),'onDelete':'cascade','foreignKey':_0xa25b('0x1b6')});db[_0xa25b('0xd1')][_0xa25b('0x114')](db['Dynamics365Field'],{'as':_0xa25b('0x1af'),'onDelete':'cascade','foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xd1')][_0xa25b('0x123')](db['Dynamics365Account'],{'as':_0xa25b('0x168'),'foreignKey':'AccountId'});db[_0xa25b('0xd3')][_0xa25b('0x114')](db[_0xa25b('0xd3')],{'as':_0xa25b('0x1b8'),'foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0xd3')][_0xa25b('0x114')](db[_0xa25b('0xd3')],{'as':_0xa25b('0x1be'),'foreignKey':'DescriptionId'});db[_0xa25b('0xd3')][_0xa25b('0x114')](db[_0xa25b('0xd3')],{'as':_0xa25b('0x1b9'),'foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xd3')][_0xa25b('0x123')](db[_0xa25b('0x9b')],{'as':_0xa25b('0x9b'),'foreignKey':_0xa25b('0x1ba')});db[_0xa25b('0x1c4')][_0xa25b('0x114')](db[_0xa25b('0xd5')],{'as':'Configurations','onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1b2')});db[_0xa25b('0xd5')][_0xa25b('0x114')](db[_0xa25b('0xd7')],{'as':_0xa25b('0x1b4'),'foreignKey':_0xa25b('0x1b5')});db[_0xa25b('0xd5')][_0xa25b('0x114')](db[_0xa25b('0xd7')],{'as':'Descriptions','foreignKey':_0xa25b('0x1b6')});db['FreshsalesConfiguration'][_0xa25b('0x114')](db['FreshsalesField'],{'as':_0xa25b('0x1af'),'foreignKey':_0xa25b('0x1b7')});db['FreshsalesConfiguration'][_0xa25b('0x123')](db['FreshsalesAccount'],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x1b2')});db['FreshsalesField'][_0xa25b('0x114')](db[_0xa25b('0xd7')],{'as':_0xa25b('0x1b8'),'foreignKey':_0xa25b('0x1b5')});db['FreshsalesField'][_0xa25b('0x114')](db[_0xa25b('0xd7')],{'as':_0xa25b('0x1be'),'foreignKey':_0xa25b('0x1b6')});db[_0xa25b('0xd7')]['hasMany'](db[_0xa25b('0xd7')],{'as':_0xa25b('0x1b9'),'foreignKey':_0xa25b('0x1b7')});db[_0xa25b('0xd7')]['belongsTo'](db[_0xa25b('0x9b')],{'as':'Variable','foreignKey':_0xa25b('0x1ba')});db['ChatQueueReport']['belongsTo'](db[_0xa25b('0x67')],{});db[_0xa25b('0xda')]['belongsTo'](db[_0xa25b('0xfb')],{'as':_0xa25b('0x165'),'foreignKey':_0xa25b('0x166')});db[_0xa25b('0xda')][_0xa25b('0x123')](db['CmContact'],{'as':'Contact','foreignKey':_0xa25b('0x178')});db[_0xa25b('0xda')][_0xa25b('0x123')](db['ChatInteraction'],{});db[_0xa25b('0xda')][_0xa25b('0x123')](db['ChatMessage'],{});db[_0xa25b('0xda')][_0xa25b('0x123')](db[_0xa25b('0x110')],{});db[_0xa25b('0xda')]['belongsTo'](db[_0xa25b('0x71')],{});db['ChatInternalMessage'][_0xa25b('0x123')](db[_0xa25b('0x110')],{'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1c5')});db[_0xa25b('0xdc')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1c6')});db[_0xa25b('0xe0')][_0xa25b('0x114')](db['JscriptyQuestionReport'],{'foreignKey':_0xa25b('0x1c7'),'onDelete':_0xa25b('0x112')});db[_0xa25b('0xe0')][_0xa25b('0x114')](db['JscriptyAnswerReport'],{'foreignKey':_0xa25b('0x1c7'),'onDelete':_0xa25b('0x112')});db['SmsQueueReport']['belongsTo'](db[_0xa25b('0x59')],{});db['SmsQueueReport'][_0xa25b('0x123')](db[_0xa25b('0xfb')],{'as':'List','foreignKey':_0xa25b('0x166')});db[_0xa25b('0xe1')][_0xa25b('0x123')](db[_0xa25b('0x79')],{'as':'Contact','foreignKey':_0xa25b('0x178')});db[_0xa25b('0xe1')][_0xa25b('0x123')](db[_0xa25b('0x5d')],{});db['SmsQueueReport'][_0xa25b('0x123')](db['SmsMessage'],{});db['SmsQueueReport'][_0xa25b('0x123')](db[_0xa25b('0x110')],{});db[_0xa25b('0xe1')][_0xa25b('0x123')](db[_0xa25b('0x132')],{});db[_0xa25b('0xe5')]['hasMany'](db[_0xa25b('0xe0')],{'foreignKey':_0xa25b('0x1c8')});db[_0xa25b('0xe5')]['hasMany'](db[_0xa25b('0x1c9')],{'foreignKey':_0xa25b('0x1c8')});db[_0xa25b('0xe5')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xa25b('0x1c8')});db[_0xa25b('0xe9')]['belongsToMany'](db['User'],{'as':'Users','through':_0xa25b('0x143')});db[_0xa25b('0xee')]['belongsToMany'](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':_0xa25b('0x1ca')});db[_0xa25b('0xee')][_0xa25b('0x127')](db[_0xa25b('0x1e')],{'through':_0xa25b('0x1cb'),'as':_0xa25b('0x130')});db[_0xa25b('0xee')][_0xa25b('0x127')](db[_0xa25b('0x42')],{'through':_0xa25b('0x167'),'as':_0xa25b('0x1cc')});db[_0xa25b('0xee')][_0xa25b('0x127')](db[_0xa25b('0x71')],{'through':_0xa25b('0x18d'),'as':'ChatQueues'});db[_0xa25b('0xee')][_0xa25b('0x127')](db[_0xa25b('0x56')],{'through':_0xa25b('0x17b'),'as':'FaxQueues'});db[_0xa25b('0xee')]['belongsToMany'](db[_0xa25b('0x132')],{'through':_0xa25b('0x181'),'as':_0xa25b('0x133')});db[_0xa25b('0xee')]['belongsToMany'](db[_0xa25b('0x65')],{'through':_0xa25b('0x186'),'as':_0xa25b('0x135')});db[_0xa25b('0xee')][_0xa25b('0x127')](db[_0xa25b('0x10e')],{'through':'team_has_whatsapp_queues','as':_0xa25b('0x136')});db['Campaign'][_0xa25b('0x114')](db[_0xa25b('0x7b')],{'as':_0xa25b('0x14b'),'foreignKey':_0xa25b('0x197')});db[_0xa25b('0x196')][_0xa25b('0x114')](db[_0xa25b('0x7d')],{'as':_0xa25b('0x118'),'foreignKey':_0xa25b('0x197')});db[_0xa25b('0x196')][_0xa25b('0x114')](db[_0xa25b('0x119')],{'as':_0xa25b('0x14c'),'foreignKey':_0xa25b('0x197')});db['Campaign'][_0xa25b('0x114')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':_0xa25b('0x197')});db[_0xa25b('0x196')][_0xa25b('0x123')](db[_0xa25b('0x2c')],{'as':'Trunk','foreignKey':_0xa25b('0x14f')});db[_0xa25b('0x196')]['belongsTo'](db[_0xa25b('0x2c')],{'as':'TrunkBackup','foreignKey':_0xa25b('0x1cd')});db['Campaign'][_0xa25b('0x123')](db[_0xa25b('0x8b')],{'as':_0xa25b('0x8b'),'foreignKey':_0xa25b('0x173')});db[_0xa25b('0x196')][_0xa25b('0x123')](db[_0xa25b('0xe9')],{'as':_0xa25b('0xe9'),'foreignKey':'SquareProjectId'});db[_0xa25b('0x196')][_0xa25b('0x127')](db['CmList'],{'as':_0xa25b('0x129'),'through':_0xa25b('0x1ce')});db['Campaign'][_0xa25b('0x127')](db[_0xa25b('0xfb')],{'as':_0xa25b('0x156'),'through':_0xa25b('0x1cf')});db[_0xa25b('0x1d0')][_0xa25b('0x123')](db[_0xa25b('0x46')],{});db[_0xa25b('0x1d0')][_0xa25b('0x123')](db[_0xa25b('0x44')],{});db[_0xa25b('0x1d0')][_0xa25b('0x123')](db[_0xa25b('0x41')],{'foreignKey':_0xa25b('0x1d1'),'as':_0xa25b('0x1d2')});db[_0xa25b('0x1d0')][_0xa25b('0x123')](db['User'],{'foreignKey':_0xa25b('0x1d3'),'as':_0xa25b('0x1d4')});db[_0xa25b('0x1d0')]['belongsTo'](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d5'),'as':_0xa25b('0x1d6')});db[_0xa25b('0x1d0')][_0xa25b('0x123')](db[_0xa25b('0x42')],{'foreignKey':_0xa25b('0x1d7'),'as':_0xa25b('0x1d8')});db['MailTransferReport'][_0xa25b('0x123')](db[_0xa25b('0x41')],{'foreignKey':'ToMailAccountId','as':_0xa25b('0x1d9')});db['ChatTransferReport'][_0xa25b('0x123')](db[_0xa25b('0x6e')],{});db['ChatTransferReport'][_0xa25b('0x123')](db[_0xa25b('0x6c')],{});db[_0xa25b('0xf6')][_0xa25b('0x123')](db[_0xa25b('0x67')],{'foreignKey':_0xa25b('0x1da'),'as':_0xa25b('0x1d2')});db[_0xa25b('0xf6')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d3'),'as':_0xa25b('0x1d4')});db['ChatTransferReport']['belongsTo'](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d5'),'as':_0xa25b('0x1d6')});db[_0xa25b('0xf6')][_0xa25b('0x123')](db[_0xa25b('0x71')],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xa25b('0xf6')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0xa25b('0x1d9')});db[_0xa25b('0xf8')][_0xa25b('0x123')](db[_0xa25b('0x54')],{});db[_0xa25b('0xf8')]['belongsTo'](db['FaxInteraction'],{});db['FaxTransferReport'][_0xa25b('0x123')](db[_0xa25b('0x4f')],{'foreignKey':'FromFaxAccountId','as':_0xa25b('0x1d2')});db[_0xa25b('0xf8')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d3'),'as':_0xa25b('0x1d4')});db[_0xa25b('0xf8')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d5'),'as':_0xa25b('0x1d6')});db[_0xa25b('0xf8')][_0xa25b('0x123')](db[_0xa25b('0x56')],{'foreignKey':_0xa25b('0x1db'),'as':'ToQueue'});db[_0xa25b('0xf8')][_0xa25b('0x123')](db[_0xa25b('0x4f')],{'foreignKey':_0xa25b('0x1dc'),'as':_0xa25b('0x1d9')});db[_0xa25b('0x1dd')][_0xa25b('0x123')](db[_0xa25b('0x183')],{});db['OpenchannelTransferReport'][_0xa25b('0x123')](db[_0xa25b('0x62')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xa25b('0x1de'),'as':_0xa25b('0x1d2')});db[_0xa25b('0x1dd')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d3'),'as':'FromAgent'});db[_0xa25b('0x1dd')]['belongsTo'](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d5'),'as':_0xa25b('0x1d6')});db['OpenchannelTransferReport'][_0xa25b('0x123')](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0xa25b('0x1d8')});db[_0xa25b('0x1dd')][_0xa25b('0x123')](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db[_0xa25b('0xf9')]['belongsTo'](db['SmsMessage'],{});db[_0xa25b('0xf9')][_0xa25b('0x123')](db['SmsInteraction'],{});db[_0xa25b('0xf9')][_0xa25b('0x123')](db[_0xa25b('0x59')],{'foreignKey':'FromSmsAccountId','as':_0xa25b('0x1d2')});db[_0xa25b('0xf9')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d3'),'as':_0xa25b('0x1d4')});db['SmsTransferReport'][_0xa25b('0x123')](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d5'),'as':_0xa25b('0x1d6')});db[_0xa25b('0xf9')][_0xa25b('0x123')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0xa25b('0x1d8')});db[_0xa25b('0xf9')][_0xa25b('0x123')](db[_0xa25b('0x59')],{'foreignKey':_0xa25b('0x1df'),'as':_0xa25b('0x1d9')});db['CmList'][_0xa25b('0x114')](db[_0xa25b('0x87')],{'as':_0xa25b('0x162'),'foreignKey':_0xa25b('0x166')});db[_0xa25b('0xfb')][_0xa25b('0x114')](db[_0xa25b('0x7f')],{'as':_0xa25b('0x1e0'),'foreignKey':_0xa25b('0x166')});db[_0xa25b('0xfb')]['hasMany'](db[_0xa25b('0x79')],{'as':_0xa25b('0x190'),'onDelete':_0xa25b('0x112'),'foreignKey':'ListId'});db[_0xa25b('0xfb')][_0xa25b('0x114')](db[_0xa25b('0x7d')],{'as':'HopperFinals','foreignKey':_0xa25b('0x166')});db['CmList'][_0xa25b('0x114')](db[_0xa25b('0x119')],{'as':_0xa25b('0x11a'),'foreignKey':_0xa25b('0x166')});db[_0xa25b('0xfb')]['hasMany'](db[_0xa25b('0x11b')],{'as':_0xa25b('0x11b'),'foreignKey':'ListId'});db[_0xa25b('0xfb')][_0xa25b('0x127')](db[_0xa25b('0x1e')],{'as':_0xa25b('0x1e1'),'through':_0xa25b('0x153')});db[_0xa25b('0xfb')][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':_0xa25b('0x12a')});db[_0xa25b('0xfd')][_0xa25b('0x114')](db[_0xa25b('0x1b')],{'as':_0xa25b('0x117'),'onDelete':_0xa25b('0x112')});db[_0xa25b('0xfd')][_0xa25b('0x127')](db['User'],{'as':_0xa25b('0x154'),'through':_0xa25b('0x138')});db[_0xa25b('0x124')][_0xa25b('0x114')](db[_0xa25b('0x110')],{'as':_0xa25b('0x16d'),'foreignKey':'userProfileId'});db[_0xa25b('0x124')][_0xa25b('0x114')](db[_0xa25b('0xff')],{'as':'UserProfileSections','foreignKey':_0xa25b('0x125'),'onDelete':'cascade'});db['UserProfileSection'][_0xa25b('0x114')](db[_0xa25b('0x101')],{'as':'Resources','foreignKey':_0xa25b('0x1e2'),'onDelete':'cascade'});db[_0xa25b('0x1e3')][_0xa25b('0x114')](db[_0xa25b('0x87')],{'as':'Dispositions','foreignKey':_0xa25b('0x1e4')});db[_0xa25b('0x1e3')][_0xa25b('0x114')](db[_0xa25b('0x85')],{'as':'Answers','foreignKey':_0xa25b('0x1e4')});db[_0xa25b('0x1e3')][_0xa25b('0x114')](db['WhatsappMessage'],{'as':_0xa25b('0x158'),'foreignKey':'WhatsappAccountId'});db[_0xa25b('0x1e3')][_0xa25b('0x114')](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount'][_0xa25b('0x114')](db[_0xa25b('0x106')],{'as':'Applications'});db[_0xa25b('0x1e3')][_0xa25b('0x123')](db[_0xa25b('0xfb')],{'as':'List','foreignKey':_0xa25b('0x166')});db['WhatsappAccount'][_0xa25b('0x123')](db[_0xa25b('0x8d')],{'as':_0xa25b('0x151'),'foreignKey':_0xa25b('0x152')});db['WhatsappAccount']['belongsToMany'](db[_0xa25b('0x110')],{'as':'Agents','through':_0xa25b('0x141')});db[_0xa25b('0x106')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'onDelete':_0xa25b('0x172')});db[_0xa25b('0x106')]['belongsTo'](db[_0xa25b('0x10e')],{'onDelete':_0xa25b('0x172')});db['WhatsappApplication'][_0xa25b('0x123')](db['WhatsappAccount'],{'onDelete':_0xa25b('0x172')});db[_0xa25b('0x106')][_0xa25b('0x123')](db[_0xa25b('0x8b')],{'onDelete':_0xa25b('0x172'),'foreignKey':_0xa25b('0x173')});db[_0xa25b('0x106')]['belongsTo'](db[_0xa25b('0x95')],{'onDelete':_0xa25b('0x172'),'foreignKey':_0xa25b('0x174')});db[_0xa25b('0x108')][_0xa25b('0x114')](db[_0xa25b('0x1e5')],{'as':_0xa25b('0x158'),'onDelete':_0xa25b('0x112'),'foreignKey':_0xa25b('0x1e6')});db[_0xa25b('0x108')][_0xa25b('0x123')](db[_0xa25b('0x1e3')],{'as':_0xa25b('0x168'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0xa25b('0x123')](db[_0xa25b('0x79')],{'as':_0xa25b('0x15e'),'foreignKey':'ContactId'});db[_0xa25b('0x108')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'as':_0xa25b('0x169'),'foreignKey':'UserId'});db[_0xa25b('0x108')]['belongsToMany'](db[_0xa25b('0x95')],{'through':_0xa25b('0x1a9'),'as':_0xa25b('0x16b')});db[_0xa25b('0x108')][_0xa25b('0x127')](db[_0xa25b('0x95')],{'through':_0xa25b('0x1a9'),'as':'ThroughTags'});db['WhatsappInteraction'][_0xa25b('0x127')](db['User'],{'as':_0xa25b('0x16d'),'through':_0xa25b('0x1e7'),'foreignKey':'WhatsappInteractionId'});db[_0xa25b('0x1e5')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'as':_0xa25b('0x110')});db[_0xa25b('0x1e5')][_0xa25b('0x123')](db[_0xa25b('0x79')],{'onDelete':'cascade','as':_0xa25b('0x15e')});db[_0xa25b('0x1e5')][_0xa25b('0x123')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0xa25b('0x171'),'foreignKey':_0xa25b('0x1e6')});db['WhatsappMessage'][_0xa25b('0x123')](db[_0xa25b('0x1e3')],{'as':_0xa25b('0x168'),'foreignKey':_0xa25b('0x1e4')});db[_0xa25b('0x1e8')][_0xa25b('0x123')](db['WhatsappAccount'],{});db[_0xa25b('0x1e8')][_0xa25b('0x123')](db[_0xa25b('0xfb')],{'as':'List','foreignKey':_0xa25b('0x166')});db[_0xa25b('0x1e8')]['belongsTo'](db[_0xa25b('0x79')],{'as':_0xa25b('0x15e'),'foreignKey':_0xa25b('0x178')});db[_0xa25b('0x1e8')][_0xa25b('0x123')](db[_0xa25b('0x108')],{});db[_0xa25b('0x1e8')]['belongsTo'](db['WhatsappQueue'],{});db[_0xa25b('0x1e8')][_0xa25b('0x123')](db[_0xa25b('0x1e5')],{});db['WhatsappQueueReport'][_0xa25b('0x123')](db[_0xa25b('0x110')],{});db[_0xa25b('0x10c')]['belongsTo'](db[_0xa25b('0x1e5')],{});db[_0xa25b('0x10c')]['belongsTo'](db[_0xa25b('0x108')],{});db[_0xa25b('0x10c')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xa25b('0x1d2')});db['WhatsappTransferReport']['belongsTo'](db[_0xa25b('0x1e3')],{'foreignKey':_0xa25b('0x1e9'),'as':_0xa25b('0x1d9')});db[_0xa25b('0x10c')][_0xa25b('0x123')](db[_0xa25b('0x10e')],{'foreignKey':_0xa25b('0x1ea'),'as':_0xa25b('0x1d8')});db[_0xa25b('0x10c')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d3'),'as':_0xa25b('0x1d4')});db[_0xa25b('0x10c')][_0xa25b('0x123')](db[_0xa25b('0x110')],{'foreignKey':_0xa25b('0x1d5'),'as':_0xa25b('0x1d6')});db[_0xa25b('0x10e')][_0xa25b('0x127')](db[_0xa25b('0x110')],{'as':_0xa25b('0x154'),'through':_0xa25b('0x3c'),'foreignKey':_0xa25b('0x1eb')});db[_0xa25b('0x10e')][_0xa25b('0x127')](db[_0xa25b('0xee')],{'through':_0xa25b('0x1ec'),'as':_0xa25b('0x155')});module[_0xa25b('0x1ed')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x96b4=['IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','uniqueid','AgentReports','Contact','ContactId','MailAccountId','hasOne','Smtp','Dispositions','Answers','Interactions','MailApplication','TemplateId','team_has_mail_queues','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','restrict','ListId','Items','Disposition','FaxAccountId','Exntensions','FaxMessage','List','user_has_fax_accounts','TagId','FaxInteractionId','Owner','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','UserOpenchannelQueue','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','team_has_chat_queues','ChatGroupId','Members','chat_group_has_users','Company','CompanyId','cm_contact_has_tags','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','Trigger','AllConditions','TriggerAllId','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','SalesforceAccount','Subject','Description','Field','VariableId','DeskConfiguration','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Field','FromId','ToId','SessionId','ProjectId','FaxQueues','team_has_sms_queues','SmsQueues','Hoppers','CampaignId','TrunkId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','Queues','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','WhatsappAccount','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','exports','../config/environment','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','utf8_general_ci','database','username','options','User','import','../api/user/user.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../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/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','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','../api/variable/variable.model','Integration','../api/integration/integration.model','AnalyticCustomReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','Notification','../api/notification/notification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','WhatsappInteraction','Notifications','SenderId','belongsTo','UserProfile','userProfileId','Groups','belongsToMany','Contacts','cm_user_has_contacts','Lists','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','UserFaxQueue','SmsQueue','UserSmsQueue','OpenchannelQueues','cm_user_has_lists','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','OpenchannelAccount','OpenchannelAccounts','SmsAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkBackup','TrunkBackupId'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x96b4,0xa1));var _0x496b=function(_0x1875e2,_0x2e58a3){_0x1875e2=_0x1875e2-0x0;var _0x24a241=_0x96b4[_0x1875e2];return _0x24a241;};'use strict';var path=require('path');var config=require(_0x496b('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require('jstz');var timezone=jstz['determine']();config['sequelize']=_[_0x496b('0x1')](config[_0x496b('0x2')],{'database':_0x496b('0x3'),'username':_0x496b('0x4'),'password':_0x496b('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x496b('0x6'),'dialectOptions':{'charset':_0x496b('0x7')},'logging':![],'timezone':timezone[_0x496b('0x8')](),'define':{'charset':_0x496b('0x9'),'collate':'utf8_general_ci'}}});config[_0x496b('0xa')]=_['defaultsDeep'](config[_0x496b('0xa')],{'database':_0x496b('0x3'),'username':'xcall','password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x496b('0x6'),'dialectOptions':{'charset':_0x496b('0x7')},'logging':![],'timezone':timezone[_0x496b('0x8')](),'define':{'charset':'utf8','collate':_0x496b('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x496b('0xc')],config['sequelize'][_0x496b('0xd')],config[_0x496b('0x2')]['password'],config[_0x496b('0x2')][_0x496b('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x496b('0xa')]['database'],config['sequelizeHistory'][_0x496b('0xd')],config['sequelizeHistory']['password'],config[_0x496b('0xa')][_0x496b('0xe')])};db[_0x496b('0xf')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x11'));db['VoiceChanSpy']=db[_0x496b('0x2')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db[_0x496b('0x12')]=db[_0x496b('0x2')]['import'](_0x496b('0x13'));db[_0x496b('0x14')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x15'));db[_0x496b('0x16')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x17'));db[_0x496b('0x18')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/voiceQueue/voiceQueue.model');db[_0x496b('0x19')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x1a'));db[_0x496b('0x1b')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x1c'));db[_0x496b('0x1d')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x1e'));db[_0x496b('0x1f')]=db[_0x496b('0x2')]['import'](_0x496b('0x20'));db[_0x496b('0x21')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x22'));db[_0x496b('0x23')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/voiceDialReport/voiceDialReport.model');db[_0x496b('0x24')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x496b('0x25')]=db['sequelize']['import']('../api/voiceQueueReport/voiceQueueReport.model');db[_0x496b('0x26')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x27'));db['Trunk']=db[_0x496b('0x2')]['import'](_0x496b('0x28'));db[_0x496b('0x29')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x2a'));db[_0x496b('0x2b')]=db[_0x496b('0x2')]['import'](_0x496b('0x2c'));db[_0x496b('0x2d')]=db['sequelize']['import'](_0x496b('0x2e'));db[_0x496b('0x2f')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x30'));db[_0x496b('0x31')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x32'));db['UserFaxQueue']=db[_0x496b('0x2')][_0x496b('0x10')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db['sequelize']['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x33'));db[_0x496b('0x34')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x496b('0x35')]=db['sequelize'][_0x496b('0x10')](_0x496b('0x36'));db[_0x496b('0x37')]=db['sequelize'][_0x496b('0x10')]('../api/mailServerOut/mailServerOut.model');db[_0x496b('0x38')]=db['sequelize'][_0x496b('0x10')](_0x496b('0x39'));db[_0x496b('0x3a')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x3b'));db[_0x496b('0x3c')]=db['sequelize']['import'](_0x496b('0x3d'));db[_0x496b('0x3e')]=db[_0x496b('0x2')]['import'](_0x496b('0x3f'));db['MailApplication']=db['sequelize']['import'](_0x496b('0x40'));db[_0x496b('0x41')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x42'));db[_0x496b('0x43')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x44'));db[_0x496b('0x45')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/dashboardItem/dashboardItem.model');db[_0x496b('0x46')]=db['sequelize'][_0x496b('0x10')]('../api/faxAccount/faxAccount.model');db[_0x496b('0x47')]=db[_0x496b('0x2')]['import'](_0x496b('0x48'));db[_0x496b('0x49')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x4a'));db['FaxMessage']=db['sequelize'][_0x496b('0x10')](_0x496b('0x4b'));db[_0x496b('0x4c')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x4d'));db[_0x496b('0x4e')]=db['sequelize'][_0x496b('0x10')](_0x496b('0x4f'));db['SmsAccount']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x50'));db[_0x496b('0x51')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x52'));db[_0x496b('0x53')]=db[_0x496b('0x2')]['import'](_0x496b('0x54'));db[_0x496b('0x55')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0x496b('0x2')][_0x496b('0x10')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x56'));db[_0x496b('0x57')]=db['sequelize']['import']('../api/openchannelApplication/openchannelApplication.model');db[_0x496b('0x58')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x59'));db[_0x496b('0x5a')]=db['sequelize'][_0x496b('0x10')](_0x496b('0x5b'));db[_0x496b('0x5c')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x5d'));db[_0x496b('0x5e')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x5f'));db[_0x496b('0x60')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x61'));db[_0x496b('0x62')]=db[_0x496b('0x2')]['import']('../api/chatApplication/chatApplication.model');db[_0x496b('0x63')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x64'));db[_0x496b('0x65')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x66'));db[_0x496b('0x67')]=db['sequelize'][_0x496b('0x10')](_0x496b('0x68'));db[_0x496b('0x69')]=db['sequelize']['import'](_0x496b('0x6a'));db[_0x496b('0x6b')]=db['sequelize']['import'](_0x496b('0x6c'));db[_0x496b('0x6d')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x6e'));db[_0x496b('0x6f')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x70'));db[_0x496b('0x71')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x72'));db[_0x496b('0x73')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/cmHopper/cmHopper.model');db[_0x496b('0x74')]=db[_0x496b('0x2')]['import'](_0x496b('0x75'));db[_0x496b('0x76')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x77'));db['CmHopperHistory']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x78'));db[_0x496b('0x79')]=db['sequelize'][_0x496b('0x10')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x496b('0x2')]['import'](_0x496b('0x7a'));db[_0x496b('0x7b')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x7c'));db[_0x496b('0x7d')]=db['sequelize'][_0x496b('0x10')](_0x496b('0x7e'));db[_0x496b('0x7f')]=db[_0x496b('0x2')]['import'](_0x496b('0x80'));db['Disposition']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x81'));db[_0x496b('0x82')]=db['sequelize'][_0x496b('0x10')](_0x496b('0x83'));db[_0x496b('0x84')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/interval/interval.model');db[_0x496b('0x85')]=db['sequelize'][_0x496b('0x10')](_0x496b('0x86'));db[_0x496b('0x87')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x88'));db[_0x496b('0x89')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x8a'));db[_0x496b('0x8b')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x8c'));db[_0x496b('0x8d')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x8e'));db[_0x496b('0x8f')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x90'));db[_0x496b('0x91')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x92'));db['Trigger']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x93'));db[_0x496b('0x94')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x95'));db[_0x496b('0x96')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x97'));db['IntegrationReport']=db[_0x496b('0x2')][_0x496b('0x10')]('../api/integrationReport/integrationReport.model');db[_0x496b('0x98')]=db[_0x496b('0x2')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x99'));db[_0x496b('0x9a')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x9b'));db['AnalyticMetric']=db[_0x496b('0x2')][_0x496b('0x10')]('../api/analyticMetric/analyticMetric.model');db[_0x496b('0x9c')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x9d'));db[_0x496b('0x9e')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x9f'));db['SalesforceAccount']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xa0'));db[_0x496b('0xa1')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xa2'));db['SalesforceField']=db[_0x496b('0x2')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0x496b('0xa3')]=db[_0x496b('0x2')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x496b('0xa4')]=db['sequelize']['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x496b('0xa5')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xa6'));db[_0x496b('0xa7')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xa8'));db['DeskConfiguration']=db[_0x496b('0x2')]['import'](_0x496b('0xa9'));db[_0x496b('0xaa')]=db['sequelize'][_0x496b('0x10')]('../api/intDeskField/intDeskField.model');db[_0x496b('0xab')]=db[_0x496b('0x2')]['import'](_0x496b('0xac'));db[_0x496b('0xad')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xae'));db[_0x496b('0xaf')]=db['sequelize']['import'](_0x496b('0xb0'));db[_0x496b('0xb1')]=db['sequelize'][_0x496b('0x10')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x496b('0xb2')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0x496b('0xb3')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xb4'));db[_0x496b('0xb5')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xb6'));db['FreshdeskConfiguration']=db[_0x496b('0x2')][_0x496b('0x10')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x496b('0xb7')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xb8'));db[_0x496b('0xb9')]=db['sequelize']['import'](_0x496b('0xba'));db[_0x496b('0xbb')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xbc'));db[_0x496b('0xbd')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0x496b('0x2')]['import']('../api/intServicenowAccount/intServicenowAccount.model');db[_0x496b('0xbe')]=db['sequelize'][_0x496b('0x10')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x496b('0xbf')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xc0'));db[_0x496b('0xc1')]=db['sequelize'][_0x496b('0x10')](_0x496b('0xc2'));db[_0x496b('0xc3')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xc4'));db['Dynamics365Field']=db['sequelize'][_0x496b('0x10')](_0x496b('0xc5'));db[_0x496b('0xc6')]=db[_0x496b('0x2')]['import'](_0x496b('0xc7'));db[_0x496b('0xc8')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xc9'));db[_0x496b('0xca')]=db['sequelize'][_0x496b('0x10')](_0x496b('0xcb'));db[_0x496b('0x96')]=db[_0x496b('0x2')]['import'](_0x496b('0x97'));db[_0x496b('0xcc')]=db[_0x496b('0x2')]['import']('../api/network/network.model');db[_0x496b('0xcd')]=db['sequelize'][_0x496b('0x10')](_0x496b('0xce'));db[_0x496b('0xcf')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xd0'));db[_0x496b('0xd1')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x496b('0xd2')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xd3'));db[_0x496b('0xd4')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xd5'));db[_0x496b('0xd6')]=db[_0x496b('0x2')]['import'](_0x496b('0xd7'));db[_0x496b('0xd8')]=db['sequelize'][_0x496b('0x10')](_0x496b('0xd9'));db[_0x496b('0xda')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xdb'));db[_0x496b('0xdc')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xdd'));db[_0x496b('0xde')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xdf'));db['SquareOdbc']=db[_0x496b('0x2')][_0x496b('0x10')]('../api/squareOdbc/squareOdbc.model');db[_0x496b('0xe0')]=db['sequelize'][_0x496b('0x10')](_0x496b('0xe1'));db[_0x496b('0xe2')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xe3'));db[_0x496b('0xe4')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xe5'));db[_0x496b('0xe6')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xe7'));db[_0x496b('0xe8')]=db['sequelize']['import'](_0x496b('0xe9'));db[_0x496b('0xea')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xeb'));db[_0x496b('0xec')]=db['sequelize']['import'](_0x496b('0xed'));db[_0x496b('0xee')]=db['sequelize'][_0x496b('0x10')](_0x496b('0xef'));db[_0x496b('0xf0')]=db['sequelize']['import']('../api/plugin/plugin.model');db[_0x496b('0xf1')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xf2'));db[_0x496b('0xf3')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xf4'));db[_0x496b('0xf5')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xf6'));db[_0x496b('0xf7')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xf8'));db[_0x496b('0xf9')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0xfa'));db[_0x496b('0xfb')]=db['sequelize'][_0x496b('0x10')](_0x496b('0xfc'));db[_0x496b('0xfd')]=db[_0x496b('0x2')][_0x496b('0x10')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0x496b('0x2')][_0x496b('0x10')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0x496b('0x2')]['import'](_0x496b('0xfe'));db[_0x496b('0xff')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x100'));db[_0x496b('0x101')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x102'));db['WhatsappAccount']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x103'));db[_0x496b('0x104')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x105'));db['WhatsappInteraction']=db['sequelize']['import'](_0x496b('0x106'));db['WhatsappMessage']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x107'));db['WhatsappQueueReport']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x108'));db['WhatsappTransferReport']=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x109'));db[_0x496b('0x10a')]=db['sequelize']['import']('../api/whatsappQueue/whatsappQueue.model');db[_0x496b('0x10b')]=db[_0x496b('0x2')][_0x496b('0x10')](_0x496b('0x10c'));db[_0x496b('0xf')]['hasOne'](db[_0x496b('0x1d')],{'as':'VoiceMail','onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x10e')});db['User'][_0x496b('0x10f')](db[_0x496b('0x19')],{'as':_0x496b('0x110'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0xf')][_0x496b('0x10f')](db[_0x496b('0x2b')],{'as':_0x496b('0x111'),'foreignKey':'UserId'});db[_0x496b('0xf')][_0x496b('0x10f')](db[_0x496b('0x14')],{'as':_0x496b('0x112'),'onDelete':'cascade','hooks':!![]});db[_0x496b('0xf')][_0x496b('0x10f')](db[_0x496b('0x76')],{'as':_0x496b('0x113'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0xf')][_0x496b('0x10f')](db[_0x496b('0x114')],{'as':_0x496b('0x115'),'foreignKey':'UserId'});db['User'][_0x496b('0x10f')](db[_0x496b('0x79')],{'as':_0x496b('0x79'),'foreignKey':_0x496b('0x10e')});db['User']['hasMany'](db[_0x496b('0x58')],{'as':_0x496b('0x116'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0xf')][_0x496b('0x10f')](db[_0x496b('0x63')],{'as':_0x496b('0x117'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0xf')]['hasMany'](db[_0x496b('0x53')],{'as':_0x496b('0x118'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0xf')]['hasMany'](db[_0x496b('0x49')],{'as':_0x496b('0x119'),'foreignKey':'UserId'});db[_0x496b('0xf')][_0x496b('0x10f')](db[_0x496b('0x3c')],{'as':'MailInteractions','foreignKey':_0x496b('0x10e')});db['User']['hasMany'](db[_0x496b('0x11a')],{'as':'WhatsappInteractions','foreignKey':_0x496b('0x10e')});db['User'][_0x496b('0x10f')](db['Notification'],{'as':_0x496b('0x11b'),'foreignKey':_0x496b('0x11c')});db[_0x496b('0xf')][_0x496b('0x11d')](db[_0x496b('0x11e')],{'as':_0x496b('0x11e'),'foreignKey':_0x496b('0x11f')});db['User']['belongsToMany'](db['ChatGroup'],{'as':_0x496b('0x120'),'through':'chat_group_has_users'});db['User'][_0x496b('0x121')](db[_0x496b('0x71')],{'as':_0x496b('0x122'),'through':_0x496b('0x123')});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0xfb')],{'as':_0x496b('0x124'),'through':'cm_user_has_lists'});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0xe6')],{'through':_0x496b('0x125')});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x3c')],{'as':_0x496b('0x126'),'through':_0x496b('0x127')});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x63')],{'as':_0x496b('0x117'),'through':'user_has_chat_interactions'});db[_0x496b('0xf')]['belongsToMany'](db[_0x496b('0x49')],{'as':_0x496b('0x119'),'through':_0x496b('0x128')});db[_0x496b('0xf')][_0x496b('0x121')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x496b('0x129')});db[_0x496b('0xf')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0x496b('0x116'),'through':_0x496b('0x12a')});db[_0x496b('0xf')][_0x496b('0x121')](db['WhatsappInteraction'],{'as':_0x496b('0x12b'),'through':_0x496b('0x12c')});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x18')],{'as':_0x496b('0x12d'),'through':'UserVoiceQueue','required':![]});db['User'][_0x496b('0x121')](db['MailQueue'],{'as':_0x496b('0x12e'),'through':_0x496b('0x31'),'required':![]});db['User'][_0x496b('0x121')](db['ChatQueue'],{'as':_0x496b('0x12f'),'through':_0x496b('0x2f'),'required':![],'hooks':!![]});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x4c')],{'as':'FaxQueues','through':_0x496b('0x130'),'required':![]});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x131')],{'as':'SmsQueues','through':_0x496b('0x132'),'required':![]});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x5c')],{'as':_0x496b('0x133'),'through':'UserOpenchannelQueue','required':![]});db[_0x496b('0xf')][_0x496b('0x121')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0x496b('0x34'),'required':![]});db['User'][_0x496b('0x121')](db[_0x496b('0xfb')],{'through':_0x496b('0x134')});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0xfd')],{'as':_0x496b('0x135'),'through':_0x496b('0x136'),'required':![]});db['User'][_0x496b('0x121')](db[_0x496b('0x5e')],{'as':_0x496b('0x137'),'through':_0x496b('0x138')});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x46')],{'as':_0x496b('0x139'),'through':'user_has_fax_accounts'});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x38')],{'as':_0x496b('0x13a'),'through':'user_has_mail_accounts'});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x13b')],{'as':_0x496b('0x13c'),'through':'user_has_openchannel_accounts'});db[_0x496b('0xf')][_0x496b('0x121')](db[_0x496b('0x13d')],{'as':'SmsAccounts','through':'user_has_sms_accounts'});db['User'][_0x496b('0x121')](db['WhatsappAccount'],{'as':_0x496b('0x13e'),'through':_0x496b('0x13f')});db[_0x496b('0xf')]['belongsToMany'](db['SquareProject'],{'as':_0x496b('0x140'),'through':_0x496b('0x141')});db[_0x496b('0x142')][_0x496b('0x10f')](db[_0x496b('0x14')],{'as':_0x496b('0x143'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x144')});db[_0x496b('0x12')][_0x496b('0x10f')](db[_0x496b('0x14')],{'onDelete':_0x496b('0x10d')});db[_0x496b('0x14')][_0x496b('0x10f')](db[_0x496b('0x14')],{'as':_0x496b('0x145'),'onDelete':'cascade'});db[_0x496b('0x16')]['belongsToMany'](db[_0x496b('0x8d')],{'as':'Sounds','through':_0x496b('0x146')});db[_0x496b('0x18')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x496b('0x147')});db[_0x496b('0x18')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x496b('0x147')});db[_0x496b('0x18')][_0x496b('0x10f')](db[_0x496b('0x76')],{'as':_0x496b('0x113'),'foreignKey':_0x496b('0x147')});db[_0x496b('0x18')][_0x496b('0x10f')](db[_0x496b('0x114')],{'as':_0x496b('0x148'),'foreignKey':'VoiceQueueId'});db[_0x496b('0x18')][_0x496b('0x10f')](db[_0x496b('0x79')],{'as':_0x496b('0x79'),'foreignKey':_0x496b('0x147')});db[_0x496b('0x18')][_0x496b('0x10f')](db['CmHopperBlack'],{'as':_0x496b('0x149'),'foreignKey':'VoiceQueueId'});db[_0x496b('0x18')][_0x496b('0x10f')](db[_0x496b('0xd4')],{'as':_0x496b('0x14a'),'foreignKey':_0x496b('0x147')});db[_0x496b('0x18')][_0x496b('0x11d')](db[_0x496b('0x14b')],{'as':_0x496b('0x14b'),'foreignKey':'TrunkId'});db[_0x496b('0x18')][_0x496b('0x11d')](db[_0x496b('0x14b')],{'as':_0x496b('0x14c'),'foreignKey':_0x496b('0x14d')});db[_0x496b('0x18')][_0x496b('0x11d')](db[_0x496b('0x84')],{'as':_0x496b('0x84'),'foreignKey':_0x496b('0x14e')});db[_0x496b('0x18')]['belongsTo'](db[_0x496b('0x85')],{'as':_0x496b('0x14f'),'foreignKey':_0x496b('0x150')});db[_0x496b('0x18')]['belongsToMany'](db[_0x496b('0xfb')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':'UserVoiceQueue'});db[_0x496b('0x18')][_0x496b('0x121')](db[_0x496b('0xe6')],{'as':_0x496b('0x152'),'through':_0x496b('0x153')});db[_0x496b('0x18')][_0x496b('0x121')](db['CmList'],{'as':_0x496b('0x154'),'through':_0x496b('0x155')});db[_0x496b('0x19')][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':_0x496b('0xf'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0x1b')][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':'User','foreignKey':'UserId'});db['VoiceMail'][_0x496b('0x10f')](db[_0x496b('0x1f')],{'as':_0x496b('0x156'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage'][_0x496b('0x11d')](db[_0x496b('0x1d')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0x496b('0x21')][_0x496b('0x10f')](db[_0x496b('0x25')],{'as':'QueueCalls','foreignKey':_0x496b('0x157'),'constraints':![]});db[_0x496b('0x21')][_0x496b('0x10f')](db[_0x496b('0x24')],{'as':_0x496b('0x158'),'foreignKey':_0x496b('0x157'),'constraints':![]});db[_0x496b('0x21')][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':_0x496b('0xf'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0x21')]['belongsTo'](db[_0x496b('0x71')],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a')});db[_0x496b('0x35')][_0x496b('0x11d')](db[_0x496b('0x38')],{'as':_0x496b('0x38'),'foreignKey':'MailAccountId'});db[_0x496b('0x37')][_0x496b('0x11d')](db[_0x496b('0x38')],{'as':'MailAccount','foreignKey':_0x496b('0x15b')});db[_0x496b('0x38')]['hasOne'](db[_0x496b('0x35')],{'as':'Imap','onDelete':_0x496b('0x10d')});db[_0x496b('0x38')][_0x496b('0x15c')](db['MailServerOut'],{'as':_0x496b('0x15d'),'onDelete':_0x496b('0x10d')});db[_0x496b('0x38')][_0x496b('0x10f')](db['Disposition'],{'as':_0x496b('0x15e'),'foreignKey':_0x496b('0x15b')});db['MailAccount'][_0x496b('0x10f')](db[_0x496b('0x7f')],{'as':_0x496b('0x15f'),'foreignKey':_0x496b('0x15b')});db[_0x496b('0x38')][_0x496b('0x10f')](db[_0x496b('0x3e')],{'as':_0x496b('0x156'),'foreignKey':'MailAccountId'});db[_0x496b('0x38')][_0x496b('0x10f')](db['MailInteraction'],{'as':_0x496b('0x160')});db[_0x496b('0x38')][_0x496b('0x10f')](db[_0x496b('0x161')],{'as':'Applications'});db[_0x496b('0x38')]['belongsTo'](db[_0x496b('0xfb')],{'as':'List','foreignKey':'ListId'});db[_0x496b('0x38')][_0x496b('0x11d')](db[_0x496b('0x91')],{'as':_0x496b('0x91'),'foreignKey':_0x496b('0x162')});db['MailAccount'][_0x496b('0x11d')](db[_0x496b('0x85')],{'as':_0x496b('0x14f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x496b('0x38')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':_0x496b('0x31')});db[_0x496b('0x3a')][_0x496b('0x121')](db[_0x496b('0xe6')],{'through':_0x496b('0x163'),'as':_0x496b('0x152')});db[_0x496b('0x3c')][_0x496b('0x10f')](db[_0x496b('0x3e')],{'as':'Messages','onDelete':_0x496b('0x10d'),'foreignKey':'MailInteractionId'});db[_0x496b('0x3c')]['belongsTo'](db[_0x496b('0x38')],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x15b')});db[_0x496b('0x3c')][_0x496b('0x11d')](db['CmContact'],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a')});db['MailInteraction'][_0x496b('0x11d')](db['User'],{'as':'Owner','foreignKey':_0x496b('0x10e')});db[_0x496b('0x3c')][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':_0x496b('0x165'),'as':_0x496b('0x166')});db[_0x496b('0x3c')][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':'mail_interaction_has_tags','as':_0x496b('0x167')});db[_0x496b('0x3c')]['belongsToMany'](db[_0x496b('0xf')],{'as':_0x496b('0x168'),'through':_0x496b('0x127'),'foreignKey':_0x496b('0x169')});db[_0x496b('0x3e')][_0x496b('0x10f')](db[_0x496b('0xee')],{'as':_0x496b('0x16a'),'onDelete':_0x496b('0x10d')});db['MailMessage'][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':_0x496b('0xf')});db['MailMessage'][_0x496b('0x11d')](db[_0x496b('0x71')],{'onDelete':_0x496b('0x10d'),'as':'Contact'});db[_0x496b('0x3e')]['belongsTo'](db[_0x496b('0x3c')],{'as':_0x496b('0x16b'),'foreignKey':_0x496b('0x169')});db[_0x496b('0x3e')][_0x496b('0x11d')](db[_0x496b('0x38')],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x15b')});db[_0x496b('0x161')][_0x496b('0x11d')](db['User'],{'onDelete':_0x496b('0x16c')});db[_0x496b('0x161')][_0x496b('0x11d')](db[_0x496b('0x3a')],{'onDelete':'restrict'});db[_0x496b('0x161')][_0x496b('0x11d')](db[_0x496b('0x38')],{'onDelete':'restrict'});db[_0x496b('0x161')][_0x496b('0x11d')](db[_0x496b('0x84')],{'onDelete':_0x496b('0x16c'),'foreignKey':'IntervalId'});db['MailApplication'][_0x496b('0x11d')](db['Tag'],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x496b('0x41')][_0x496b('0x11d')](db[_0x496b('0x38')],{});db[_0x496b('0x41')][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':'List','foreignKey':_0x496b('0x16d')});db['MailQueueReport'][_0x496b('0x11d')](db[_0x496b('0x71')],{'as':'Contact','foreignKey':_0x496b('0x15a')});db[_0x496b('0x41')][_0x496b('0x11d')](db[_0x496b('0x3c')],{});db[_0x496b('0x41')]['belongsTo'](db[_0x496b('0x3e')],{});db[_0x496b('0x41')][_0x496b('0x11d')](db[_0x496b('0xf')],{});db[_0x496b('0x41')][_0x496b('0x11d')](db[_0x496b('0x3a')],{});db[_0x496b('0x43')][_0x496b('0x10f')](db[_0x496b('0x45')],{'as':_0x496b('0x16e'),'onDelete':_0x496b('0x10d')});db[_0x496b('0x46')][_0x496b('0x10f')](db[_0x496b('0x16f')],{'as':_0x496b('0x15e'),'foreignKey':_0x496b('0x170')});db[_0x496b('0x46')]['hasMany'](db['CannedAnswer'],{'as':_0x496b('0x15f'),'foreignKey':_0x496b('0x170')});db[_0x496b('0x46')][_0x496b('0x10f')](db[_0x496b('0x49')],{'as':_0x496b('0x160')});db['FaxAccount'][_0x496b('0x10f')](db[_0x496b('0x47')],{'as':_0x496b('0x145')});db['FaxAccount'][_0x496b('0x10f')](db[_0x496b('0x14')],{'as':_0x496b('0x171'),'onDelete':_0x496b('0x10d')});db[_0x496b('0x46')][_0x496b('0x10f')](db[_0x496b('0x172')],{'as':_0x496b('0x156')});db[_0x496b('0x46')][_0x496b('0x11d')](db[_0x496b('0x14b')],{'as':_0x496b('0x14b')});db['FaxAccount'][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':_0x496b('0x173'),'foreignKey':'ListId'});db[_0x496b('0x46')][_0x496b('0x11d')](db[_0x496b('0x85')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x496b('0x46')]['belongsToMany'](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':_0x496b('0x174')});db[_0x496b('0x47')][_0x496b('0x11d')](db[_0x496b('0xf')],{'onDelete':_0x496b('0x16c')});db[_0x496b('0x47')][_0x496b('0x11d')](db[_0x496b('0x4c')],{'onDelete':_0x496b('0x16c')});db[_0x496b('0x47')][_0x496b('0x11d')](db[_0x496b('0x46')],{'onDelete':_0x496b('0x16c')});db['FaxApplication'][_0x496b('0x11d')](db[_0x496b('0x8f')],{'onDelete':'restrict','foreignKey':_0x496b('0x175')});db[_0x496b('0x49')]['hasMany'](db[_0x496b('0x172')],{'as':_0x496b('0x156'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x176')});db[_0x496b('0x49')][_0x496b('0x11d')](db[_0x496b('0x46')],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x170')});db[_0x496b('0x49')][_0x496b('0x11d')](db[_0x496b('0x71')],{'as':_0x496b('0x159'),'foreignKey':'ContactId'});db['FaxInteraction'][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':_0x496b('0x177'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0x49')][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':'fax_interaction_has_tags','as':_0x496b('0x166')});db[_0x496b('0x49')][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':_0x496b('0x178'),'as':'ThroughTags'});db['FaxInteraction']['belongsToMany'](db[_0x496b('0xf')],{'as':_0x496b('0x168'),'through':_0x496b('0x128'),'foreignKey':_0x496b('0x176')});db['FaxMessage'][_0x496b('0x11d')](db[_0x496b('0xf')],{'onDelete':_0x496b('0x10d'),'as':_0x496b('0xf')});db['FaxMessage'][_0x496b('0x11d')](db[_0x496b('0x49')],{'as':_0x496b('0x16b'),'foreignKey':_0x496b('0x176')});db[_0x496b('0x172')]['belongsTo'](db[_0x496b('0x71')],{'onDelete':'cascade','as':_0x496b('0x159')});db[_0x496b('0x172')][_0x496b('0x11d')](db['Attachment'],{'as':_0x496b('0xee'),'foreignKey':'AttachmentId'});db[_0x496b('0x172')][_0x496b('0x11d')](db[_0x496b('0x46')],{'as':_0x496b('0x164'),'foreignKey':'FaxAccountId'});db[_0x496b('0x4c')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':_0x496b('0x130')});db['FaxQueue']['belongsToMany'](db[_0x496b('0xe6')],{'through':_0x496b('0x179'),'as':_0x496b('0x152')});db[_0x496b('0x4e')][_0x496b('0x11d')](db[_0x496b('0x46')],{});db[_0x496b('0x4e')][_0x496b('0x11d')](db['CmList'],{'as':_0x496b('0x173'),'foreignKey':_0x496b('0x16d')});db[_0x496b('0x4e')][_0x496b('0x11d')](db[_0x496b('0x71')],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a')});db['FaxQueueReport'][_0x496b('0x11d')](db[_0x496b('0x49')],{});db[_0x496b('0x4e')]['belongsTo'](db[_0x496b('0x172')],{});db[_0x496b('0x4e')][_0x496b('0x11d')](db[_0x496b('0xf')],{});db[_0x496b('0x4e')]['belongsTo'](db[_0x496b('0x4c')],{});db[_0x496b('0x13d')]['hasMany'](db['Disposition'],{'as':_0x496b('0x15e'),'foreignKey':_0x496b('0x17a')});db[_0x496b('0x13d')][_0x496b('0x10f')](db['CannedAnswer'],{'as':_0x496b('0x15f'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0x496b('0x55')],{'as':_0x496b('0x156'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0x496b('0x53')],{'as':'Interactions'});db[_0x496b('0x13d')][_0x496b('0x10f')](db[_0x496b('0x51')],{'as':_0x496b('0x145')});db['SmsAccount'][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':_0x496b('0x173'),'foreignKey':_0x496b('0x16d')});db[_0x496b('0x13d')][_0x496b('0x11d')](db[_0x496b('0x85')],{'as':_0x496b('0x14f'),'foreignKey':_0x496b('0x150')});db['SmsAccount']['belongsToMany'](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':_0x496b('0x17b')});db[_0x496b('0x51')][_0x496b('0x11d')](db[_0x496b('0xf')],{'onDelete':'restrict'});db[_0x496b('0x51')][_0x496b('0x11d')](db[_0x496b('0x131')],{'onDelete':_0x496b('0x16c')});db[_0x496b('0x51')][_0x496b('0x11d')](db['SmsAccount'],{'onDelete':_0x496b('0x16c')});db[_0x496b('0x51')][_0x496b('0x11d')](db['Interval'],{'onDelete':_0x496b('0x16c'),'foreignKey':_0x496b('0x14e')});db['SmsApplication']['belongsTo'](db[_0x496b('0x8f')],{'onDelete':_0x496b('0x16c'),'foreignKey':_0x496b('0x175')});db[_0x496b('0x53')]['hasMany'](db['SmsMessage'],{'as':_0x496b('0x156'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x17c')});db[_0x496b('0x53')][_0x496b('0x11d')](db[_0x496b('0x13d')],{'as':'Account','foreignKey':_0x496b('0x17a')});db['SmsInteraction']['belongsTo'](db[_0x496b('0x71')],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a')});db[_0x496b('0x53')][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':_0x496b('0x177'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0x53')][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':_0x496b('0x17d'),'as':_0x496b('0x166')});db[_0x496b('0x53')]['belongsToMany'](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x496b('0x167')});db[_0x496b('0x53')][_0x496b('0x121')](db['User'],{'as':_0x496b('0x168'),'through':_0x496b('0x129'),'foreignKey':_0x496b('0x17c')});db[_0x496b('0x55')][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':_0x496b('0xf')});db['SmsMessage'][_0x496b('0x11d')](db[_0x496b('0x71')],{'onDelete':_0x496b('0x10d'),'as':_0x496b('0x159')});db[_0x496b('0x55')][_0x496b('0x11d')](db[_0x496b('0x53')],{'onDelete':_0x496b('0x10d'),'as':'Interaction','foreignKey':_0x496b('0x17c')});db[_0x496b('0x55')][_0x496b('0x11d')](db[_0x496b('0x13d')],{'as':'Account','foreignKey':_0x496b('0x17a')});db[_0x496b('0x131')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':_0x496b('0x132'),'foreignKey':_0x496b('0x17e')});db[_0x496b('0x131')][_0x496b('0x121')](db[_0x496b('0xe6')],{'through':'team_has_sms_queues','as':_0x496b('0x152')});db[_0x496b('0x13b')][_0x496b('0x10f')](db[_0x496b('0x16f')],{'as':_0x496b('0x15e'),'foreignKey':_0x496b('0x17f')});db[_0x496b('0x13b')][_0x496b('0x10f')](db[_0x496b('0x7f')],{'as':_0x496b('0x15f'),'foreignKey':'OpenchannelAccountId'});db[_0x496b('0x13b')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x496b('0x160'),'foreignKey':_0x496b('0x17f')});db[_0x496b('0x13b')]['hasMany'](db[_0x496b('0x5a')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x496b('0x13b')]['hasMany'](db[_0x496b('0x57')],{'as':_0x496b('0x145'),'foreignKey':_0x496b('0x17f')});db[_0x496b('0x13b')][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':_0x496b('0x173'),'foreignKey':_0x496b('0x16d')});db[_0x496b('0x13b')]['belongsTo'](db['Pause'],{'as':_0x496b('0x14f'),'foreignKey':_0x496b('0x150')});db[_0x496b('0x13b')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':_0x496b('0x180')});db[_0x496b('0x57')][_0x496b('0x11d')](db[_0x496b('0xf')],{'onDelete':_0x496b('0x16c')});db[_0x496b('0x57')]['belongsTo'](db[_0x496b('0x5c')],{'onDelete':_0x496b('0x16c'),'foreignKey':_0x496b('0x181')});db['OpenchannelApplication'][_0x496b('0x11d')](db[_0x496b('0x13b')],{'onDelete':_0x496b('0x16c'),'foreignKey':_0x496b('0x17f')});db[_0x496b('0x57')][_0x496b('0x11d')](db['Interval'],{'onDelete':_0x496b('0x16c'),'foreignKey':_0x496b('0x14e')});db[_0x496b('0x57')][_0x496b('0x11d')](db[_0x496b('0x8f')],{'onDelete':_0x496b('0x16c'),'foreignKey':_0x496b('0x175')});db[_0x496b('0x58')][_0x496b('0x10f')](db['OpenchannelMessage'],{'as':_0x496b('0x156'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x182')});db['OpenchannelInteraction']['belongsTo'](db[_0x496b('0x13b')],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x17f')});db[_0x496b('0x58')]['belongsTo'](db[_0x496b('0x71')],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a')});db[_0x496b('0x58')][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':_0x496b('0x177'),'foreignKey':_0x496b('0x10e')});db[_0x496b('0x58')][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':_0x496b('0x183'),'as':_0x496b('0x166')});db[_0x496b('0x58')]['belongsToMany'](db[_0x496b('0x8f')],{'through':_0x496b('0x183'),'as':_0x496b('0x167')});db[_0x496b('0x58')]['belongsToMany'](db[_0x496b('0xf')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0x496b('0x182')});db['OpenchannelMessage'][_0x496b('0x11d')](db[_0x496b('0xf')],{'onDelete':_0x496b('0x10d'),'as':_0x496b('0xf')});db[_0x496b('0x5a')][_0x496b('0x11d')](db[_0x496b('0x71')],{'onDelete':'cascade','as':_0x496b('0x159')});db[_0x496b('0x5a')][_0x496b('0x11d')](db[_0x496b('0x58')],{'onDelete':'cascade','as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0x496b('0x5a')][_0x496b('0x11d')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x496b('0x5a')][_0x496b('0x11d')](db['OpenchannelAccount'],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x17f')});db[_0x496b('0x5c')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':_0x496b('0x184'),'foreignKey':_0x496b('0x181')});db[_0x496b('0x5c')][_0x496b('0x121')](db[_0x496b('0xe6')],{'through':_0x496b('0x185'),'as':'Teams'});db['ChatWebsite']['hasMany'](db[_0x496b('0x16f')],{'as':'Dispositions','foreignKey':_0x496b('0x186')});db[_0x496b('0x5e')][_0x496b('0x10f')](db[_0x496b('0x7f')],{'as':_0x496b('0x15f'),'foreignKey':_0x496b('0x186')});db[_0x496b('0x5e')][_0x496b('0x10f')](db[_0x496b('0x6d')],{'as':_0x496b('0x187')});db[_0x496b('0x5e')][_0x496b('0x10f')](db[_0x496b('0x63')],{'as':_0x496b('0x160')});db[_0x496b('0x5e')][_0x496b('0x10f')](db['ChatApplication'],{'as':_0x496b('0x145')});db[_0x496b('0x5e')][_0x496b('0x10f')](db['ChatMessage'],{'as':'Messages'});db[_0x496b('0x5e')][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':_0x496b('0x173'),'foreignKey':_0x496b('0x16d')});db['ChatWebsite'][_0x496b('0x11d')](db['Interval'],{'as':_0x496b('0x84'),'foreignKey':_0x496b('0x14e')});db[_0x496b('0x5e')]['belongsTo'](db['Pause'],{'as':_0x496b('0x14f'),'foreignKey':_0x496b('0x150')});db[_0x496b('0x5e')]['belongsToMany'](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':'user_has_chat_websites'});db[_0x496b('0x60')]['belongsTo'](db[_0x496b('0x13b')],{});db['OpenchannelQueueReport'][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':_0x496b('0x173'),'foreignKey':_0x496b('0x16d')});db[_0x496b('0x60')][_0x496b('0x11d')](db[_0x496b('0x71')],{'as':'Contact','foreignKey':_0x496b('0x15a')});db[_0x496b('0x60')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x496b('0x60')][_0x496b('0x11d')](db[_0x496b('0x5a')],{});db[_0x496b('0x60')][_0x496b('0x11d')](db[_0x496b('0xf')],{});db[_0x496b('0x60')][_0x496b('0x11d')](db[_0x496b('0x5c')],{});db[_0x496b('0x62')][_0x496b('0x11d')](db['User'],{'as':_0x496b('0x188'),'foreignKey':_0x496b('0x10e'),'onDelete':_0x496b('0x16c')});db[_0x496b('0x62')][_0x496b('0x11d')](db[_0x496b('0x69')],{'as':_0x496b('0x189'),'foreignKey':'ChatQueueId','onDelete':_0x496b('0x16c')});db[_0x496b('0x62')][_0x496b('0x11d')](db[_0x496b('0x5e')],{'as':_0x496b('0x18a'),'foreignKey':_0x496b('0x186'),'onDelete':_0x496b('0x16c')});db[_0x496b('0x62')][_0x496b('0x11d')](db['Tag'],{'onDelete':_0x496b('0x16c'),'foreignKey':_0x496b('0x175')});db[_0x496b('0x63')][_0x496b('0x10f')](db[_0x496b('0x65')],{'as':_0x496b('0x156'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x18b')});db['ChatInteraction']['belongsTo'](db['ChatWebsite'],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x186')});db[_0x496b('0x63')][_0x496b('0x11d')](db[_0x496b('0x71')],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a')});db[_0x496b('0x63')][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':'Owner','foreignKey':'UserId'});db[_0x496b('0x63')]['belongsToMany'](db['Tag'],{'through':_0x496b('0x18c'),'as':_0x496b('0x166')});db['ChatInteraction']['belongsToMany'](db[_0x496b('0x8f')],{'through':_0x496b('0x18c'),'as':_0x496b('0x167')});db[_0x496b('0x63')]['belongsToMany'](db[_0x496b('0xf')],{'as':_0x496b('0x168'),'through':_0x496b('0x18d'),'foreignKey':'ChatInteractionId'});db[_0x496b('0x65')][_0x496b('0x11d')](db['User'],{'onDelete':'cascade','as':'User'});db[_0x496b('0x65')]['belongsTo'](db[_0x496b('0x71')],{'onDelete':_0x496b('0x10d'),'as':_0x496b('0x159'),'foreignKey':'ContactId'});db[_0x496b('0x65')]['belongsTo'](db[_0x496b('0x63')],{'onDelete':_0x496b('0x10d'),'as':_0x496b('0x16b'),'foreignKey':_0x496b('0x18b')});db[_0x496b('0x65')][_0x496b('0x11d')](db[_0x496b('0xee')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x496b('0x65')][_0x496b('0x11d')](db[_0x496b('0x5e')],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x186')});db[_0x496b('0x67')][_0x496b('0x11d')](db[_0x496b('0x71')],{'onDelete':'cascade','as':_0x496b('0x159'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0x496b('0x11d')](db['ChatWebsite'],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x186')});db['ChatQueue']['belongsToMany'](db['User'],{'as':_0x496b('0x151'),'through':_0x496b('0x2f'),'hooks':!![]});db[_0x496b('0x69')][_0x496b('0x121')](db[_0x496b('0xe6')],{'through':_0x496b('0x18e'),'as':_0x496b('0x152')});db[_0x496b('0x6b')][_0x496b('0x10f')](db[_0x496b('0xcf')],{'as':_0x496b('0x156'),'foreignKey':_0x496b('0x18f'),'onDelete':'cascade'});db[_0x496b('0x6b')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x190'),'through':_0x496b('0x191')});db[_0x496b('0x6d')][_0x496b('0x11d')](db[_0x496b('0x5e')],{'as':'Website','foreignKey':_0x496b('0x186')});db[_0x496b('0x6f')]['hasMany'](db[_0x496b('0x71')],{'as':_0x496b('0x122'),'foreignKey':'CompanyId'});db[_0x496b('0x71')][_0x496b('0x10f')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x496b('0x71')][_0x496b('0x10f')](db[_0x496b('0x76')],{'as':_0x496b('0x113'),'foreignKey':_0x496b('0x15a')});db[_0x496b('0x71')][_0x496b('0x10f')](db[_0x496b('0x114')],{'as':_0x496b('0x148'),'foreignKey':'ContactId'});db['CmContact'][_0x496b('0x10f')](db[_0x496b('0x79')],{'as':_0x496b('0x79'),'foreignKey':_0x496b('0x15a')});db[_0x496b('0x71')][_0x496b('0x10f')](db[_0x496b('0xd4')],{'as':_0x496b('0x14a'),'foreignKey':'ContactId'});db[_0x496b('0x71')]['hasMany'](db[_0x496b('0x58')],{'as':_0x496b('0x116'),'foreignKey':_0x496b('0x15a'),'onDelete':'restrict'});db['CmContact'][_0x496b('0x10f')](db['ChatInteraction'],{'as':_0x496b('0x117'),'foreignKey':'ContactId','onDelete':_0x496b('0x16c')});db[_0x496b('0x71')]['hasMany'](db[_0x496b('0x53')],{'as':_0x496b('0x118'),'foreignKey':_0x496b('0x15a'),'onDelete':_0x496b('0x16c')});db[_0x496b('0x71')][_0x496b('0x10f')](db[_0x496b('0x49')],{'as':_0x496b('0x119'),'foreignKey':_0x496b('0x15a'),'onDelete':_0x496b('0x16c')});db[_0x496b('0x71')][_0x496b('0x10f')](db['MailInteraction'],{'as':_0x496b('0x126'),'foreignKey':'ContactId','onDelete':_0x496b('0x16c')});db[_0x496b('0x71')]['belongsTo'](db[_0x496b('0x6f')],{'as':_0x496b('0x192'),'foreignKey':_0x496b('0x193')});db[_0x496b('0x71')][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':_0x496b('0x173'),'foreignKey':_0x496b('0x16d'),'onDelete':_0x496b('0x10d')});db[_0x496b('0x71')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x168'),'through':_0x496b('0x123')});db[_0x496b('0x71')][_0x496b('0x121')](db[_0x496b('0x8f')],{'as':'Tags','through':'cm_contact_has_tags'});db['CmContact'][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':_0x496b('0x194'),'as':_0x496b('0x167')});db[_0x496b('0x73')]['belongsTo'](db['CmContact'],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a'),'onDelete':_0x496b('0x10d')});db['CmHopper'][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':'List','foreignKey':_0x496b('0x16d'),'onDelete':_0x496b('0x10d')});db['CmHopper'][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':_0x496b('0x188'),'foreignKey':_0x496b('0x10e')});db['CmHopper'][_0x496b('0x11d')](db[_0x496b('0x18')],{'as':'Queue','foreignKey':_0x496b('0x147'),'onDelete':'cascade'});db[_0x496b('0x73')]['belongsTo'](db[_0x496b('0xea')],{'as':_0x496b('0xea'),'foreignKey':'CampaignId','onDelete':_0x496b('0x10d')});db[_0x496b('0x73')][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':_0x496b('0x177'),'foreignKey':_0x496b('0x195')});db['CmHopperBlack'][_0x496b('0x11d')](db['CmContact'],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a'),'onDelete':_0x496b('0x10d')});db['CmHopperBlack'][_0x496b('0x11d')](db['CmList'],{'as':_0x496b('0x173'),'foreignKey':_0x496b('0x16d'),'onDelete':_0x496b('0x10d')});db[_0x496b('0x74')][_0x496b('0x11d')](db[_0x496b('0x18')],{'as':_0x496b('0x189'),'foreignKey':_0x496b('0x147'),'onDelete':_0x496b('0x10d')});db['CmHopperBlack'][_0x496b('0x11d')](db[_0x496b('0xea')],{'as':_0x496b('0xea'),'foreignKey':'CampaignId','onDelete':_0x496b('0x10d')});db['Automation'][_0x496b('0x10f')](db[_0x496b('0x82')],{'as':{'plural':_0x496b('0x196'),'singular':_0x496b('0x197')},'foreignKey':_0x496b('0x198'),'onDelete':_0x496b('0x10d'),'hooks':!![]});db['Automation'][_0x496b('0x10f')](db['Condition'],{'as':{'plural':_0x496b('0x199'),'singular':_0x496b('0x19a')},'foreignKey':_0x496b('0x19b'),'onDelete':_0x496b('0x10d'),'hooks':!![]});db[_0x496b('0x7d')][_0x496b('0x10f')](db[_0x496b('0x7b')],{'as':'Actions','foreignKey':_0x496b('0x19c'),'onDelete':'cascade','hooks':!![]});db[_0x496b('0x16f')][_0x496b('0x10f')](db[_0x496b('0x16f')],{'as':_0x496b('0x15e'),'foreignKey':'ParentId','onDelete':_0x496b('0x10d')});db['Interval'][_0x496b('0x10f')](db[_0x496b('0x84')],{'as':'Intervals','foreignKey':_0x496b('0x14e'),'onDelete':_0x496b('0x10d'),'hooks':!![],'required':![]});db[_0x496b('0x84')]['hasMany'](db[_0x496b('0x14')],{'as':_0x496b('0x112'),'foreignKey':_0x496b('0x14e'),'onDelete':_0x496b('0x16c')});db[_0x496b('0x84')][_0x496b('0x10f')](db['MailApplication'],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0x496b('0x84')][_0x496b('0x10f')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x496b('0x14e')});db[_0x496b('0x84')][_0x496b('0x10f')](db[_0x496b('0x47')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x496b('0x84')][_0x496b('0x10f')](db[_0x496b('0x51')],{'as':_0x496b('0x19d'),'foreignKey':'IntervalId'});db[_0x496b('0x8b')]['belongsTo'](db[_0x496b('0x38')],{});db[_0x496b('0x8b')][_0x496b('0x11d')](db[_0x496b('0x19e')],{'foreignKey':_0x496b('0x19f')});db[_0x496b('0x8b')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x496b('0x1a0')});db[_0x496b('0x8d')][_0x496b('0x121')](db[_0x496b('0x16')],{'as':_0x496b('0x1a1'),'through':_0x496b('0x146'),'onDelete':_0x496b('0x16c')});db[_0x496b('0x8f')][_0x496b('0x121')](db[_0x496b('0x71')],{'through':'cm_contact_has_tags'});db['Tag'][_0x496b('0x121')](db['ChatInteraction'],{'through':_0x496b('0x18c')});db['Tag']['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x496b('0x8f')][_0x496b('0x121')](db[_0x496b('0x53')],{'through':'sms_interaction_has_tags'});db[_0x496b('0x8f')]['belongsToMany'](db['FaxInteraction'],{'through':_0x496b('0x178')});db['Tag'][_0x496b('0x121')](db[_0x496b('0x58')],{'through':_0x496b('0x183')});db[_0x496b('0x8f')][_0x496b('0x121')](db[_0x496b('0x11a')],{'through':_0x496b('0x1a2')});db[_0x496b('0x1a3')][_0x496b('0x10f')](db[_0x496b('0x82')],{'as':{'plural':_0x496b('0x1a4'),'singular':'AllCondition'},'foreignKey':_0x496b('0x1a5'),'onDelete':'cascade','hooks':!![]});db[_0x496b('0x1a3')][_0x496b('0x10f')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0x496b('0x1a6')},'foreignKey':_0x496b('0x1a7'),'onDelete':_0x496b('0x10d'),'hooks':!![]});db['Trigger'][_0x496b('0x10f')](db[_0x496b('0x7b')],{'as':_0x496b('0x1a8'),'foreignKey':_0x496b('0x1a9'),'onDelete':_0x496b('0x10d'),'hooks':!![]});db[_0x496b('0x98')][_0x496b('0x10f')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x496b('0x10d'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x496b('0x10f')](db['AnalyticFieldReport'],{'as':_0x496b('0x1aa'),'onDelete':_0x496b('0x10d'),'foreignKey':'DefaultReportId'});db[_0x496b('0x1ab')][_0x496b('0x10f')](db[_0x496b('0x9c')],{'as':_0x496b('0x1aa'),'onDelete':_0x496b('0x10d'),'foreignKey':'MetricId'});db[_0x496b('0x9c')][_0x496b('0x11d')](db[_0x496b('0x1ab')],{'foreignKey':_0x496b('0x1ac')});db['SalesforceAccount'][_0x496b('0x10f')](db[_0x496b('0xa1')],{'as':_0x496b('0x1ad'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1ae')});db[_0x496b('0xa1')]['hasMany'](db[_0x496b('0x1af')],{'as':_0x496b('0x1b0'),'onDelete':'cascade','foreignKey':_0x496b('0x1b1')});db[_0x496b('0xa1')]['hasMany'](db['SalesforceField'],{'as':_0x496b('0x1b2'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b3')});db[_0x496b('0xa1')][_0x496b('0x10f')](db[_0x496b('0x1af')],{'as':_0x496b('0x1aa'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0xa1')]['belongsTo'](db[_0x496b('0x1b5')],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x1ae')});db[_0x496b('0x1af')][_0x496b('0x10f')](db['SalesforceField'],{'as':_0x496b('0x1b6'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0x1af')][_0x496b('0x10f')](db[_0x496b('0x1af')],{'as':_0x496b('0x1b7'),'foreignKey':_0x496b('0x1b3')});db[_0x496b('0x1af')][_0x496b('0x10f')](db[_0x496b('0x1af')],{'as':_0x496b('0x1b8'),'foreignKey':_0x496b('0x1b4')});db['SalesforceField'][_0x496b('0x11d')](db[_0x496b('0x94')],{'as':_0x496b('0x94'),'foreignKey':_0x496b('0x1b9')});db[_0x496b('0xa3')][_0x496b('0x10f')](db[_0x496b('0xa4')],{'as':_0x496b('0x1ad'),'onDelete':'cascade','foreignKey':_0x496b('0x1ae')});db[_0x496b('0xa4')][_0x496b('0x10f')](db['SugarcrmField'],{'as':_0x496b('0x1b0'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0xa4')][_0x496b('0x10f')](db[_0x496b('0xa5')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x496b('0xa4')]['hasMany'](db[_0x496b('0xa5')],{'as':_0x496b('0x1aa'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0xa4')]['belongsTo'](db['SugarcrmAccount'],{'as':_0x496b('0x164'),'foreignKey':'AccountId'});db[_0x496b('0xa5')]['hasMany'](db[_0x496b('0xa5')],{'as':_0x496b('0x1b6'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0xa5')][_0x496b('0x10f')](db[_0x496b('0xa5')],{'as':_0x496b('0x1b7'),'foreignKey':_0x496b('0x1b3')});db['SugarcrmField'][_0x496b('0x10f')](db[_0x496b('0xa5')],{'as':'Field','foreignKey':_0x496b('0x1b4')});db[_0x496b('0xa5')][_0x496b('0x11d')](db['Variable'],{'as':_0x496b('0x94'),'foreignKey':_0x496b('0x1b9')});db[_0x496b('0xa7')][_0x496b('0x10f')](db['DeskConfiguration'],{'as':_0x496b('0x1ad'),'onDelete':'cascade','foreignKey':'AccountId'});db['DeskConfiguration'][_0x496b('0x10f')](db['DeskField'],{'as':_0x496b('0x1b0'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0x1ba')]['hasMany'](db['DeskField'],{'as':_0x496b('0x1b2'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b3')});db['DeskConfiguration'][_0x496b('0x10f')](db[_0x496b('0xaa')],{'as':_0x496b('0x1aa'),'onDelete':'cascade','foreignKey':_0x496b('0x1b4')});db[_0x496b('0x1ba')][_0x496b('0x11d')](db[_0x496b('0xa7')],{'as':'Account','foreignKey':_0x496b('0x1ae')});db[_0x496b('0x1ba')][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':_0x496b('0x1bb')});db['DeskField'][_0x496b('0x10f')](db[_0x496b('0xaa')],{'as':_0x496b('0x1b6'),'foreignKey':_0x496b('0x1b1')});db['DeskField']['hasMany'](db[_0x496b('0xaa')],{'as':_0x496b('0x1b7'),'foreignKey':_0x496b('0x1b3')});db[_0x496b('0xaa')][_0x496b('0x10f')](db['DeskField'],{'as':'Field','foreignKey':_0x496b('0x1b4')});db[_0x496b('0xaa')][_0x496b('0x11d')](db[_0x496b('0x94')],{'as':_0x496b('0x94'),'foreignKey':_0x496b('0x1b9')});db[_0x496b('0xab')][_0x496b('0x10f')](db[_0x496b('0xad')],{'as':_0x496b('0x1ad'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1ae')});db[_0x496b('0xad')][_0x496b('0x10f')](db['ZohoField'],{'as':_0x496b('0x1b0'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0xad')][_0x496b('0x10f')](db[_0x496b('0xaf')],{'as':'Descriptions','onDelete':_0x496b('0x10d'),'foreignKey':'DescriptionId'});db[_0x496b('0xad')][_0x496b('0x10f')](db[_0x496b('0xaf')],{'as':_0x496b('0x1aa'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0xad')][_0x496b('0x11d')](db[_0x496b('0xab')],{'as':'Account','foreignKey':_0x496b('0x1ae')});db[_0x496b('0xaf')][_0x496b('0x10f')](db['ZohoField'],{'as':_0x496b('0x1b6'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0xaf')]['hasMany'](db[_0x496b('0xaf')],{'as':_0x496b('0x1b7'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x496b('0x10f')](db[_0x496b('0xaf')],{'as':_0x496b('0x1b8'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0xaf')][_0x496b('0x11d')](db[_0x496b('0x94')],{'as':'Variable','foreignKey':_0x496b('0x1b9')});db['ZendeskAccount']['hasMany'](db[_0x496b('0xb2')],{'as':'Configurations','onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1ae')});db[_0x496b('0xb2')]['hasMany'](db[_0x496b('0xb3')],{'as':_0x496b('0x1b0'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0xb2')][_0x496b('0x10f')](db['ZendeskField'],{'as':_0x496b('0x1b2'),'foreignKey':_0x496b('0x1b3')});db[_0x496b('0xb2')][_0x496b('0x10f')](db[_0x496b('0xb3')],{'as':'Fields','foreignKey':_0x496b('0x1b4')});db['ZendeskConfiguration'][_0x496b('0x11d')](db[_0x496b('0xb1')],{'as':'Account','foreignKey':_0x496b('0x1ae')});db[_0x496b('0xb2')][_0x496b('0x121')](db['Tag'],{'through':_0x496b('0x1bc')});db[_0x496b('0xb3')][_0x496b('0x10f')](db[_0x496b('0xb3')],{'as':_0x496b('0x1b6'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0xb3')][_0x496b('0x10f')](db[_0x496b('0xb3')],{'as':'Description','foreignKey':_0x496b('0x1b3')});db[_0x496b('0xb3')][_0x496b('0x10f')](db['ZendeskField'],{'as':_0x496b('0x1b8'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0xb3')][_0x496b('0x11d')](db[_0x496b('0x94')],{'as':_0x496b('0x94'),'foreignKey':_0x496b('0x1b9')});db[_0x496b('0xb5')][_0x496b('0x10f')](db[_0x496b('0x1bd')],{'as':_0x496b('0x1ad'),'onDelete':'cascade','foreignKey':_0x496b('0x1ae')});db[_0x496b('0x1bd')][_0x496b('0x10f')](db[_0x496b('0xb7')],{'as':_0x496b('0x1b0'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0x1bd')]['hasMany'](db['FreshdeskField'],{'as':_0x496b('0x1b2'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b3')});db['FreshdeskConfiguration'][_0x496b('0x10f')](db[_0x496b('0xb7')],{'as':_0x496b('0x1aa'),'onDelete':'cascade','foreignKey':_0x496b('0x1b4')});db[_0x496b('0x1bd')][_0x496b('0x11d')](db[_0x496b('0xb5')],{'as':'Account','foreignKey':_0x496b('0x1ae')});db['FreshdeskConfiguration'][_0x496b('0x121')](db['Tag'],{'through':_0x496b('0x1be')});db['FreshdeskField'][_0x496b('0x10f')](db[_0x496b('0xb7')],{'as':_0x496b('0x1b6'),'foreignKey':'SubjectId'});db[_0x496b('0xb7')]['hasMany'](db[_0x496b('0xb7')],{'as':_0x496b('0x1b7'),'foreignKey':_0x496b('0x1b3')});db['FreshdeskField'][_0x496b('0x10f')](db[_0x496b('0xb7')],{'as':_0x496b('0x1b8'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0xb7')][_0x496b('0x11d')](db[_0x496b('0x94')],{'as':'Variable','foreignKey':'VariableId'});db[_0x496b('0xb9')][_0x496b('0x10f')](db['VtigerConfiguration'],{'as':_0x496b('0x1ad'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1ae')});db[_0x496b('0xbb')][_0x496b('0x10f')](db[_0x496b('0xbd')],{'as':'Subjects','foreignKey':_0x496b('0x1b1')});db['VtigerConfiguration'][_0x496b('0x10f')](db[_0x496b('0xbd')],{'as':'Descriptions','foreignKey':_0x496b('0x1b3')});db[_0x496b('0xbb')]['hasMany'](db[_0x496b('0xbd')],{'as':'Fields','foreignKey':_0x496b('0x1b4')});db[_0x496b('0xbb')][_0x496b('0x11d')](db['VtigerAccount'],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x1ae')});db[_0x496b('0xbd')][_0x496b('0x10f')](db['VtigerField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x496b('0xbd')]['hasMany'](db[_0x496b('0xbd')],{'as':_0x496b('0x1b7'),'foreignKey':_0x496b('0x1b3')});db[_0x496b('0xbd')][_0x496b('0x10f')](db[_0x496b('0xbd')],{'as':_0x496b('0x1b8'),'foreignKey':'FieldId'});db[_0x496b('0xbd')]['belongsTo'](db[_0x496b('0x94')],{'as':'Variable','foreignKey':'VariableId'});db[_0x496b('0x1bf')][_0x496b('0x10f')](db['ServicenowConfiguration'],{'as':_0x496b('0x1ad'),'onDelete':'cascade','foreignKey':_0x496b('0x1ae')});db[_0x496b('0xbe')][_0x496b('0x10f')](db[_0x496b('0xbf')],{'as':_0x496b('0x1b0'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0xbe')][_0x496b('0x10f')](db['ServicenowField'],{'as':_0x496b('0x1b2'),'foreignKey':_0x496b('0x1b3')});db[_0x496b('0xbe')][_0x496b('0x10f')](db[_0x496b('0xbf')],{'as':_0x496b('0x1aa'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0xbe')][_0x496b('0x11d')](db[_0x496b('0x1bf')],{'as':_0x496b('0x164'),'foreignKey':'AccountId'});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':'Subject','foreignKey':_0x496b('0x1b1')});db[_0x496b('0xbf')][_0x496b('0x10f')](db['ServicenowField'],{'as':_0x496b('0x1b7'),'foreignKey':_0x496b('0x1b3')});db[_0x496b('0xbf')][_0x496b('0x10f')](db[_0x496b('0xbf')],{'as':_0x496b('0x1b8'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0xbf')][_0x496b('0x11d')](db[_0x496b('0x94')],{'as':_0x496b('0x94'),'foreignKey':_0x496b('0x1b9')});db[_0x496b('0xc1')][_0x496b('0x10f')](db[_0x496b('0xc3')],{'as':_0x496b('0x1ad'),'onDelete':'cascade','foreignKey':_0x496b('0x1ae')});db[_0x496b('0xc3')]['hasMany'](db[_0x496b('0x1c0')],{'as':_0x496b('0x1b0'),'onDelete':'cascade','foreignKey':_0x496b('0x1b1')});db[_0x496b('0xc3')][_0x496b('0x10f')](db[_0x496b('0x1c0')],{'as':_0x496b('0x1b2'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1b3')});db[_0x496b('0xc3')][_0x496b('0x10f')](db[_0x496b('0x1c0')],{'as':_0x496b('0x1aa'),'onDelete':_0x496b('0x10d'),'foreignKey':'FieldId'});db[_0x496b('0xc3')][_0x496b('0x11d')](db[_0x496b('0xc1')],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x1ae')});db[_0x496b('0x1c0')][_0x496b('0x10f')](db[_0x496b('0x1c0')],{'as':_0x496b('0x1b6'),'foreignKey':_0x496b('0x1b1')});db[_0x496b('0x1c0')][_0x496b('0x10f')](db[_0x496b('0x1c0')],{'as':_0x496b('0x1b7'),'foreignKey':_0x496b('0x1b3')});db['Dynamics365Field'][_0x496b('0x10f')](db[_0x496b('0x1c0')],{'as':_0x496b('0x1b8'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0x1c0')][_0x496b('0x11d')](db[_0x496b('0x94')],{'as':_0x496b('0x94'),'foreignKey':_0x496b('0x1b9')});db[_0x496b('0xc6')][_0x496b('0x10f')](db[_0x496b('0xc8')],{'as':_0x496b('0x1ad'),'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1ae')});db[_0x496b('0xc8')]['hasMany'](db[_0x496b('0xca')],{'as':'Subjects','foreignKey':_0x496b('0x1b1')});db[_0x496b('0xc8')][_0x496b('0x10f')](db[_0x496b('0xca')],{'as':_0x496b('0x1b2'),'foreignKey':_0x496b('0x1b3')});db['FreshsalesConfiguration'][_0x496b('0x10f')](db[_0x496b('0xca')],{'as':_0x496b('0x1aa'),'foreignKey':_0x496b('0x1b4')});db[_0x496b('0xc8')][_0x496b('0x11d')](db[_0x496b('0xc6')],{'as':'Account','foreignKey':_0x496b('0x1ae')});db[_0x496b('0xca')][_0x496b('0x10f')](db['FreshsalesField'],{'as':_0x496b('0x1b6'),'foreignKey':_0x496b('0x1b1')});db['FreshsalesField'][_0x496b('0x10f')](db['FreshsalesField'],{'as':_0x496b('0x1b7'),'foreignKey':_0x496b('0x1b3')});db[_0x496b('0xca')]['hasMany'](db[_0x496b('0xca')],{'as':'Field','foreignKey':_0x496b('0x1b4')});db[_0x496b('0xca')][_0x496b('0x11d')](db[_0x496b('0x94')],{'as':_0x496b('0x94'),'foreignKey':'VariableId'});db[_0x496b('0xcd')][_0x496b('0x11d')](db[_0x496b('0x5e')],{});db[_0x496b('0xcd')]['belongsTo'](db[_0x496b('0xfb')],{'as':'List','foreignKey':'ListId'});db['ChatQueueReport'][_0x496b('0x11d')](db['CmContact'],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a')});db[_0x496b('0xcd')]['belongsTo'](db[_0x496b('0x63')],{});db[_0x496b('0xcd')][_0x496b('0x11d')](db[_0x496b('0x65')],{});db[_0x496b('0xcd')][_0x496b('0x11d')](db[_0x496b('0xf')],{});db[_0x496b('0xcd')][_0x496b('0x11d')](db[_0x496b('0x69')],{});db['ChatInternalMessage'][_0x496b('0x11d')](db['User'],{'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1c1')});db[_0x496b('0xcf')]['belongsTo'](db[_0x496b('0xf')],{'onDelete':_0x496b('0x10d'),'foreignKey':_0x496b('0x1c2')});db['JscriptySessionReport'][_0x496b('0x10f')](db[_0x496b('0xd2')],{'foreignKey':_0x496b('0x1c3'),'onDelete':_0x496b('0x10d')});db[_0x496b('0xd4')][_0x496b('0x10f')](db[_0x496b('0xd1')],{'foreignKey':_0x496b('0x1c3'),'onDelete':_0x496b('0x10d')});db[_0x496b('0xd6')][_0x496b('0x11d')](db[_0x496b('0x13d')],{});db['SmsQueueReport'][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':_0x496b('0x173'),'foreignKey':_0x496b('0x16d')});db['SmsQueueReport'][_0x496b('0x11d')](db[_0x496b('0x71')],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a')});db['SmsQueueReport'][_0x496b('0x11d')](db[_0x496b('0x53')],{});db['SmsQueueReport'][_0x496b('0x11d')](db[_0x496b('0x55')],{});db['SmsQueueReport']['belongsTo'](db['User'],{});db[_0x496b('0xd6')][_0x496b('0x11d')](db[_0x496b('0x131')],{});db[_0x496b('0xdc')][_0x496b('0x10f')](db[_0x496b('0xd4')],{'foreignKey':_0x496b('0x1c4')});db[_0x496b('0xdc')][_0x496b('0x10f')](db[_0x496b('0xd2')],{'foreignKey':'ProjectId'});db[_0x496b('0xdc')][_0x496b('0x10f')](db['JscriptyAnswerReport'],{'foreignKey':_0x496b('0x1c4')});db[_0x496b('0xe0')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x168'),'through':_0x496b('0x141')});db[_0x496b('0xe6')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':_0x496b('0x125')});db[_0x496b('0xe6')][_0x496b('0x121')](db['VoiceQueue'],{'through':_0x496b('0x153'),'as':_0x496b('0x12d')});db[_0x496b('0xe6')]['belongsToMany'](db[_0x496b('0x3a')],{'through':_0x496b('0x163'),'as':'MailQueues'});db['Team'][_0x496b('0x121')](db[_0x496b('0x69')],{'through':_0x496b('0x18e'),'as':_0x496b('0x12f')});db[_0x496b('0xe6')]['belongsToMany'](db[_0x496b('0x4c')],{'through':'team_has_fax_queues','as':_0x496b('0x1c5')});db['Team'][_0x496b('0x121')](db[_0x496b('0x131')],{'through':_0x496b('0x1c6'),'as':_0x496b('0x1c7')});db[_0x496b('0xe6')][_0x496b('0x121')](db[_0x496b('0x5c')],{'through':_0x496b('0x185'),'as':'OpenchannelQueues'});db[_0x496b('0xe6')][_0x496b('0x121')](db[_0x496b('0x10a')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x496b('0xea')][_0x496b('0x10f')](db[_0x496b('0x73')],{'as':_0x496b('0x1c8'),'foreignKey':_0x496b('0x1c9')});db['Campaign']['hasMany'](db[_0x496b('0x76')],{'as':'HopperFinals','foreignKey':_0x496b('0x1c9')});db[_0x496b('0xea')][_0x496b('0x10f')](db[_0x496b('0x114')],{'as':_0x496b('0x148'),'foreignKey':_0x496b('0x1c9')});db['Campaign']['hasMany'](db[_0x496b('0x74')],{'as':_0x496b('0x149'),'foreignKey':_0x496b('0x1c9')});db[_0x496b('0xea')][_0x496b('0x11d')](db['Trunk'],{'as':_0x496b('0x14b'),'foreignKey':_0x496b('0x1ca')});db['Campaign'][_0x496b('0x11d')](db[_0x496b('0x14b')],{'as':_0x496b('0x14c'),'foreignKey':_0x496b('0x14d')});db['Campaign'][_0x496b('0x11d')](db[_0x496b('0x84')],{'as':'Interval','foreignKey':_0x496b('0x14e')});db[_0x496b('0xea')][_0x496b('0x11d')](db[_0x496b('0xe0')],{'as':_0x496b('0xe0'),'foreignKey':_0x496b('0x1cb')});db[_0x496b('0xea')][_0x496b('0x121')](db[_0x496b('0xfb')],{'as':_0x496b('0x124'),'through':'campaigns_has_cm_lists'});db[_0x496b('0xea')][_0x496b('0x121')](db[_0x496b('0xfb')],{'as':'BlackLists','through':_0x496b('0x1cc')});db[_0x496b('0xf1')]['belongsTo'](db[_0x496b('0x3e')],{});db[_0x496b('0xf1')][_0x496b('0x11d')](db[_0x496b('0x3c')],{});db[_0x496b('0xf1')][_0x496b('0x11d')](db[_0x496b('0x38')],{'foreignKey':_0x496b('0x1cd'),'as':_0x496b('0x1ce')});db['MailTransferReport'][_0x496b('0x11d')](db[_0x496b('0xf')],{'foreignKey':_0x496b('0x1cf'),'as':_0x496b('0x1d0')});db[_0x496b('0xf1')][_0x496b('0x11d')](db[_0x496b('0xf')],{'foreignKey':'ToUserId','as':_0x496b('0x1d1')});db[_0x496b('0xf1')][_0x496b('0x11d')](db[_0x496b('0x3a')],{'foreignKey':_0x496b('0x1d2'),'as':_0x496b('0x1d3')});db['MailTransferReport'][_0x496b('0x11d')](db[_0x496b('0x38')],{'foreignKey':_0x496b('0x1d4'),'as':_0x496b('0x1d5')});db[_0x496b('0xf3')]['belongsTo'](db[_0x496b('0x65')],{});db[_0x496b('0xf3')][_0x496b('0x11d')](db['ChatInteraction'],{});db['ChatTransferReport'][_0x496b('0x11d')](db[_0x496b('0x5e')],{'foreignKey':_0x496b('0x1d6'),'as':'FromAccount'});db[_0x496b('0xf3')]['belongsTo'](db[_0x496b('0xf')],{'foreignKey':_0x496b('0x1cf'),'as':'FromAgent'});db['ChatTransferReport'][_0x496b('0x11d')](db['User'],{'foreignKey':_0x496b('0x1d7'),'as':_0x496b('0x1d1')});db['ChatTransferReport'][_0x496b('0x11d')](db[_0x496b('0x69')],{'foreignKey':_0x496b('0x1d8'),'as':_0x496b('0x1d3')});db[_0x496b('0xf3')][_0x496b('0x11d')](db[_0x496b('0x5e')],{'foreignKey':'ToChatWebsiteId','as':_0x496b('0x1d5')});db[_0x496b('0xf5')]['belongsTo'](db[_0x496b('0x172')],{});db[_0x496b('0xf5')][_0x496b('0x11d')](db[_0x496b('0x49')],{});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':_0x496b('0x1d9'),'as':_0x496b('0x1ce')});db[_0x496b('0xf5')][_0x496b('0x11d')](db[_0x496b('0xf')],{'foreignKey':_0x496b('0x1cf'),'as':_0x496b('0x1d0')});db['FaxTransferReport'][_0x496b('0x11d')](db[_0x496b('0xf')],{'foreignKey':_0x496b('0x1d7'),'as':'ToAgent'});db[_0x496b('0xf5')][_0x496b('0x11d')](db[_0x496b('0x4c')],{'foreignKey':_0x496b('0x1da'),'as':'ToQueue'});db['FaxTransferReport'][_0x496b('0x11d')](db[_0x496b('0x46')],{'foreignKey':_0x496b('0x1db'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0x496b('0x11d')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x496b('0x11d')](db[_0x496b('0x58')],{});db[_0x496b('0xf7')][_0x496b('0x11d')](db['OpenchannelAccount'],{'foreignKey':_0x496b('0x1dc'),'as':_0x496b('0x1ce')});db[_0x496b('0xf7')][_0x496b('0x11d')](db[_0x496b('0xf')],{'foreignKey':_0x496b('0x1cf'),'as':_0x496b('0x1d0')});db['OpenchannelTransferReport'][_0x496b('0x11d')](db[_0x496b('0xf')],{'foreignKey':_0x496b('0x1d7'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x496b('0x11d')](db[_0x496b('0x5c')],{'foreignKey':'ToOpenchannelQueueId','as':_0x496b('0x1d3')});db[_0x496b('0xf7')][_0x496b('0x11d')](db['OpenchannelAccount'],{'foreignKey':_0x496b('0x1dd'),'as':_0x496b('0x1d5')});db[_0x496b('0xf9')]['belongsTo'](db[_0x496b('0x55')],{});db[_0x496b('0xf9')]['belongsTo'](db[_0x496b('0x53')],{});db[_0x496b('0xf9')][_0x496b('0x11d')](db['SmsAccount'],{'foreignKey':_0x496b('0x1de'),'as':'FromAccount'});db[_0x496b('0xf9')][_0x496b('0x11d')](db['User'],{'foreignKey':_0x496b('0x1cf'),'as':'FromAgent'});db[_0x496b('0xf9')][_0x496b('0x11d')](db[_0x496b('0xf')],{'foreignKey':_0x496b('0x1d7'),'as':_0x496b('0x1d1')});db[_0x496b('0xf9')][_0x496b('0x11d')](db[_0x496b('0x131')],{'foreignKey':_0x496b('0x1df'),'as':'ToQueue'});db['SmsTransferReport'][_0x496b('0x11d')](db['SmsAccount'],{'foreignKey':_0x496b('0x1e0'),'as':_0x496b('0x1d5')});db[_0x496b('0xfb')][_0x496b('0x10f')](db[_0x496b('0x16f')],{'as':_0x496b('0x15e'),'foreignKey':_0x496b('0x16d')});db['CmList'][_0x496b('0x10f')](db[_0x496b('0x1e1')],{'as':'CustomFields','foreignKey':_0x496b('0x16d')});db[_0x496b('0xfb')]['hasMany'](db[_0x496b('0x71')],{'as':_0x496b('0x122'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x496b('0xfb')][_0x496b('0x10f')](db[_0x496b('0x76')],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList'][_0x496b('0x10f')](db[_0x496b('0x114')],{'as':'HopperHistory','foreignKey':_0x496b('0x16d')});db['CmList'][_0x496b('0x10f')](db['ReportAgentPreview'],{'as':_0x496b('0x79'),'foreignKey':'ListId'});db[_0x496b('0xfb')]['belongsToMany'](db[_0x496b('0x18')],{'as':_0x496b('0x1e2'),'through':_0x496b('0x1e3')});db[_0x496b('0xfb')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':'cm_user_has_lists'});db[_0x496b('0xfd')][_0x496b('0x10f')](db[_0x496b('0x14')],{'as':'Extensions','onDelete':'cascade'});db['VoicePrefix'][_0x496b('0x121')](db['User'],{'as':_0x496b('0x151'),'through':'user_has_voice_prefixes'});db[_0x496b('0x11e')]['hasMany'](db['User'],{'as':_0x496b('0x168'),'foreignKey':'userProfileId'});db['UserProfile'][_0x496b('0x10f')](db[_0x496b('0x1e4')],{'as':_0x496b('0x1e5'),'foreignKey':_0x496b('0x11f'),'onDelete':_0x496b('0x10d')});db[_0x496b('0x1e4')][_0x496b('0x10f')](db[_0x496b('0xff')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x496b('0x10d')});db[_0x496b('0x1e6')]['hasMany'](db[_0x496b('0x16f')],{'as':_0x496b('0x15e'),'foreignKey':_0x496b('0x1e7')});db['WhatsappAccount'][_0x496b('0x10f')](db[_0x496b('0x7f')],{'as':_0x496b('0x15f'),'foreignKey':'WhatsappAccountId'});db[_0x496b('0x1e6')]['hasMany'](db[_0x496b('0x1e8')],{'as':_0x496b('0x156'),'foreignKey':_0x496b('0x1e7')});db[_0x496b('0x1e6')]['hasMany'](db['WhatsappInteraction'],{'as':_0x496b('0x160')});db[_0x496b('0x1e6')][_0x496b('0x10f')](db['WhatsappApplication'],{'as':_0x496b('0x145')});db[_0x496b('0x1e6')][_0x496b('0x11d')](db['CmList'],{'as':_0x496b('0x173'),'foreignKey':_0x496b('0x16d')});db[_0x496b('0x1e6')]['belongsTo'](db[_0x496b('0x85')],{'as':_0x496b('0x14f'),'foreignKey':_0x496b('0x150')});db['WhatsappAccount'][_0x496b('0x121')](db['User'],{'as':_0x496b('0x151'),'through':_0x496b('0x13f')});db['WhatsappApplication'][_0x496b('0x11d')](db[_0x496b('0xf')],{'onDelete':_0x496b('0x16c')});db[_0x496b('0x104')]['belongsTo'](db[_0x496b('0x10a')],{'onDelete':_0x496b('0x16c')});db['WhatsappApplication'][_0x496b('0x11d')](db['WhatsappAccount'],{'onDelete':'restrict'});db[_0x496b('0x104')][_0x496b('0x11d')](db[_0x496b('0x84')],{'onDelete':_0x496b('0x16c'),'foreignKey':_0x496b('0x14e')});db['WhatsappApplication'][_0x496b('0x11d')](db['Tag'],{'onDelete':_0x496b('0x16c'),'foreignKey':_0x496b('0x175')});db[_0x496b('0x11a')][_0x496b('0x10f')](db['WhatsappMessage'],{'as':'Messages','onDelete':_0x496b('0x10d'),'foreignKey':'WhatsappInteractionId'});db[_0x496b('0x11a')][_0x496b('0x11d')](db[_0x496b('0x1e6')],{'as':_0x496b('0x164'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x496b('0x11d')](db[_0x496b('0x71')],{'as':'Contact','foreignKey':'ContactId'});db[_0x496b('0x11a')][_0x496b('0x11d')](db[_0x496b('0xf')],{'as':'Owner','foreignKey':_0x496b('0x10e')});db['WhatsappInteraction'][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':_0x496b('0x1a2'),'as':_0x496b('0x166')});db['WhatsappInteraction'][_0x496b('0x121')](db[_0x496b('0x8f')],{'through':'whatsapp_interaction_has_tags','as':_0x496b('0x167')});db[_0x496b('0x11a')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x168'),'through':'user_has_whatsapp_interactions','foreignKey':_0x496b('0x1e9')});db[_0x496b('0x1e8')][_0x496b('0x11d')](db['User'],{'as':_0x496b('0xf')});db['WhatsappMessage']['belongsTo'](db[_0x496b('0x71')],{'onDelete':_0x496b('0x10d'),'as':_0x496b('0x159')});db[_0x496b('0x1e8')][_0x496b('0x11d')](db[_0x496b('0x11a')],{'onDelete':_0x496b('0x10d'),'as':'Interaction','foreignKey':_0x496b('0x1e9')});db[_0x496b('0x1e8')][_0x496b('0x11d')](db[_0x496b('0x1e6')],{'as':_0x496b('0x164'),'foreignKey':_0x496b('0x1e7')});db[_0x496b('0x1ea')][_0x496b('0x11d')](db[_0x496b('0x1e6')],{});db[_0x496b('0x1ea')][_0x496b('0x11d')](db[_0x496b('0xfb')],{'as':_0x496b('0x173'),'foreignKey':'ListId'});db['WhatsappQueueReport']['belongsTo'](db[_0x496b('0x71')],{'as':_0x496b('0x159'),'foreignKey':_0x496b('0x15a')});db['WhatsappQueueReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x496b('0x1ea')]['belongsTo'](db['WhatsappQueue'],{});db[_0x496b('0x1ea')][_0x496b('0x11d')](db['WhatsappMessage'],{});db[_0x496b('0x1ea')][_0x496b('0x11d')](db['User'],{});db[_0x496b('0x1eb')][_0x496b('0x11d')](db[_0x496b('0x1e8')],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappInteraction'],{});db[_0x496b('0x1eb')]['belongsTo'](db[_0x496b('0x1e6')],{'foreignKey':'FromWhatsappAccountId','as':_0x496b('0x1ce')});db[_0x496b('0x1eb')]['belongsTo'](db[_0x496b('0x1e6')],{'foreignKey':_0x496b('0x1ec'),'as':'ToAccount'});db[_0x496b('0x1eb')][_0x496b('0x11d')](db[_0x496b('0x10a')],{'foreignKey':_0x496b('0x1ed'),'as':'ToQueue'});db[_0x496b('0x1eb')]['belongsTo'](db[_0x496b('0xf')],{'foreignKey':_0x496b('0x1cf'),'as':_0x496b('0x1d0')});db[_0x496b('0x1eb')][_0x496b('0x11d')](db[_0x496b('0xf')],{'foreignKey':_0x496b('0x1d7'),'as':_0x496b('0x1d1')});db[_0x496b('0x10a')][_0x496b('0x121')](db[_0x496b('0xf')],{'as':_0x496b('0x151'),'through':_0x496b('0x34'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0x496b('0x121')](db['Team'],{'through':'team_has_whatsapp_queues','as':_0x496b('0x152')});module[_0x496b('0x1ee')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f29f992..a7148ce 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/actions','./api/action','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/tag','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','./api/whatsappQueue','./api/cloudProvider','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','./api/webbar','static','join','/apidoc','root','/www','/demo','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','password','apiKey','firstName','lastName','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isArray','length','isPlainObject','isString','replace','@@{','}@@','lodash','express','util','./config/environment','api','./config/logger','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','responseTime','name','agent_name','test','/api/voice/chanspy','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','/api/screen/recordings'];(function(_0x4d286d,_0x49cd15){var _0x32b5bc=function(_0x577ace){while(--_0x577ace){_0x4d286d['push'](_0x4d286d['shift']());}};_0x32b5bc(++_0x49cd15);}(_0xb7e7,0x121));var _0x7b7e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xb7e7[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0x7b7e('0x0'));var path=require('path');var express=require(_0x7b7e('0x1'));var ewinston=require('express-winston');var util=require(_0x7b7e('0x2'));var errors=require('./errors');var config=require(_0x7b7e('0x3'));var logger=require('./config/logger')(_0x7b7e('0x4'));var authLogger=require(_0x7b7e('0x5'))(_0x7b7e('0x6'));exports['default']=function(_0x53ed64){_0x53ed64[_0x7b7e('0x7')](ewinston[_0x7b7e('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x7f87e0,_0x55ce81){var _0x42b871=_0x7b7e('0x9');if(!_[_0x7b7e('0xa')](_0x7f87e0[_0x7b7e('0xb')])){_0x42b871+=_0x7b7e('0xc');var _0x26bb8d=_0x7f87e0[_0x7b7e('0xb')];maskSensitiveData(_0x26bb8d);}return util['format'](_0x42b871,_0x7f87e0[_0x7b7e('0xd')],_0x7f87e0[_0x7b7e('0xe')][_0x7b7e('0xf')]?_0x7f87e0[_0x7b7e('0xe')][_0x7b7e('0xf')]:_0x7f87e0[_0x7b7e('0x10')][_0x7b7e('0x11')]||_0x7f87e0['ip'],_0x7f87e0[_0x7b7e('0x12')],_0x55ce81[_0x7b7e('0x13')],_0x55ce81['responseTime'],_0x7f87e0[_0x7b7e('0x14')]?_0x7f87e0[_0x7b7e('0x14')]['id']:null,_0x7f87e0['user']?_0x7f87e0[_0x7b7e('0x14')]['name']:null,_0x7f87e0['user']?_0x7f87e0[_0x7b7e('0x14')][_0x7b7e('0x15')]:null,_0x26bb8d?util[_0x7b7e('0x16')](_0x26bb8d,![],null):'');}}));_0x53ed64[_0x7b7e('0x7')](ewinston[_0x7b7e('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5703fd,_0x51baf6){var _0xc7f087=_0x7b7e('0x17');if(_0x5703fd[_0x7b7e('0xb')]&&_0x5703fd[_0x7b7e('0xb')][_0x7b7e('0x18')]&&_0x5703fd[_0x7b7e('0xb')][_0x7b7e('0x19')]){_0xc7f087=_0x7b7e('0x1a');}return util[_0x7b7e('0x1b')](_0xc7f087,_0x5703fd[_0x7b7e('0xd')],_0x5703fd[_0x7b7e('0xe')][_0x7b7e('0xf')]?_0x5703fd[_0x7b7e('0xe')][_0x7b7e('0xf')]:_0x5703fd[_0x7b7e('0x10')][_0x7b7e('0x11')]||_0x5703fd['ip'],_0x5703fd[_0x7b7e('0x12')],_0x51baf6['statusCode'],_0x51baf6[_0x7b7e('0x1c')],_0x5703fd[_0x7b7e('0x14')]?_0x5703fd[_0x7b7e('0x14')]['id']:null,_0x5703fd['user']?_0x5703fd[_0x7b7e('0x14')][_0x7b7e('0x1d')]:null,_0x5703fd[_0x7b7e('0x14')]?_0x5703fd[_0x7b7e('0x14')][_0x7b7e('0x15')]:null,_0x5703fd[_0x7b7e('0xb')]&&_0x5703fd[_0x7b7e('0xb')][_0x7b7e('0x18')]?_0x5703fd['body']['device']:'other',_0x5703fd[_0x7b7e('0xb')]&&_0x5703fd[_0x7b7e('0xb')][_0x7b7e('0x19')]?_0x5703fd['body']['agent_id']:'',_0x5703fd['body']&&_0x5703fd[_0x7b7e('0xb')][_0x7b7e('0x1e')]?_0x5703fd[_0x7b7e('0xb')][_0x7b7e('0x1e')]:'');},'ignoreRoute':function(_0x3ceaf5){var _0x48fad1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x48fad1[_0x7b7e('0x1f')](_0x3ceaf5[_0x7b7e('0x12')]);}}));_0x53ed64['use']('/api/users',require('./api/user'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x20'),require('./api/voiceChanSpy'));_0x53ed64[_0x7b7e('0x7')]('/api/voice/contexts',require(_0x7b7e('0x21')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x22'),require('./api/voiceExtension'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x23'),require(_0x7b7e('0x24')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x25'),require('./api/voiceQueue'));_0x53ed64[_0x7b7e('0x7')]('/api/voice/recordings',require(_0x7b7e('0x26')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x27'),require(_0x7b7e('0x28')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x29'),require(_0x7b7e('0x2a')));_0x53ed64['use']('/api/voice/mails/messages',require(_0x7b7e('0x2b')));_0x53ed64[_0x7b7e('0x7')]('/api/voice/calls/reports',require(_0x7b7e('0x2c')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x2d'),require('./api/voiceDialReport'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x2e'),require(_0x7b7e('0x2f')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x30'),require(_0x7b7e('0x31')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x32'),require(_0x7b7e('0x33')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x34'),require(_0x7b7e('0x35')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x36'),require(_0x7b7e('0x37')));_0x53ed64[_0x7b7e('0x7')]('/api/mail/out_servers',require(_0x7b7e('0x38')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x39'),require(_0x7b7e('0x3a')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x3b'),require(_0x7b7e('0x3c')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x3d'),require(_0x7b7e('0x3e')));_0x53ed64['use'](_0x7b7e('0x3f'),require(_0x7b7e('0x40')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x41'),require('./api/mailMessage'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x42'),require(_0x7b7e('0x43')));_0x53ed64['use']('/api/mail/reports/queue',require(_0x7b7e('0x44')));_0x53ed64['use'](_0x7b7e('0x45'),require(_0x7b7e('0x46')));_0x53ed64['use'](_0x7b7e('0x47'),require(_0x7b7e('0x48')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x49'),require(_0x7b7e('0x4a')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x4b'),require(_0x7b7e('0x4c')));_0x53ed64[_0x7b7e('0x7')]('/api/fax/interactions',require('./api/faxInteraction'));_0x53ed64[_0x7b7e('0x7')]('/api/fax/messages',require(_0x7b7e('0x4d')));_0x53ed64['use']('/api/fax/queues',require(_0x7b7e('0x4e')));_0x53ed64['use'](_0x7b7e('0x4f'),require('./api/faxQueueReport'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x50'),require(_0x7b7e('0x51')));_0x53ed64[_0x7b7e('0x7')]('/api/sms/applications',require(_0x7b7e('0x52')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x53'),require(_0x7b7e('0x54')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x55'),require('./api/smsMessage'));_0x53ed64['use']('/api/sms/queues',require(_0x7b7e('0x56')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x57'),require(_0x7b7e('0x58')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x59'),require('./api/openchannelApplication'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x5a'),require('./api/openchannelInteraction'));_0x53ed64['use'](_0x7b7e('0x5b'),require(_0x7b7e('0x5c')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x5d'),require(_0x7b7e('0x5e')));_0x53ed64[_0x7b7e('0x7')]('/api/chat/websites',require(_0x7b7e('0x5f')));_0x53ed64['use'](_0x7b7e('0x60'),require(_0x7b7e('0x61')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x62'),require('./api/chatApplication'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x63'),require(_0x7b7e('0x64')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x65'),require('./api/chatMessage'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x66'),require(_0x7b7e('0x67')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x68'),require('./api/chatQueue'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x69'),require(_0x7b7e('0x6a')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x6b'),require(_0x7b7e('0x6c')));_0x53ed64[_0x7b7e('0x7')]('/api/cm/companies',require(_0x7b7e('0x6d')));_0x53ed64['use'](_0x7b7e('0x6e'),require(_0x7b7e('0x6f')));_0x53ed64['use'](_0x7b7e('0x70'),require(_0x7b7e('0x71')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x72'),require(_0x7b7e('0x73')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x74'),require('./api/cmHopperFinal'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x75'),require(_0x7b7e('0x76')));_0x53ed64[_0x7b7e('0x7')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x53ed64['use'](_0x7b7e('0x77'),require(_0x7b7e('0x78')));_0x53ed64[_0x7b7e('0x7')]('/api/automations',require('./api/automation'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x79'),require('./api/cannedAnswer'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x7a'),require(_0x7b7e('0x7b')));_0x53ed64['use'](_0x7b7e('0x7c'),require(_0x7b7e('0x7d')));_0x53ed64['use'](_0x7b7e('0x7e'),require(_0x7b7e('0x7f')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x80'),require(_0x7b7e('0x81')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x82'),require(_0x7b7e('0x83')));_0x53ed64[_0x7b7e('0x7')]('/api/voiceQueuesLog',require(_0x7b7e('0x84')));_0x53ed64[_0x7b7e('0x7')]('/api/schedules',require(_0x7b7e('0x85')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x86'),require('./api/sound'));_0x53ed64[_0x7b7e('0x7')]('/api/tags',require(_0x7b7e('0x87')));_0x53ed64[_0x7b7e('0x7')]('/api/templates',require(_0x7b7e('0x88')));_0x53ed64[_0x7b7e('0x7')]('/api/triggers',require(_0x7b7e('0x89')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8a'),require(_0x7b7e('0x8b')));_0x53ed64['use'](_0x7b7e('0x8c'),require(_0x7b7e('0x8d')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8e'),require(_0x7b7e('0x8f')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x90'),require(_0x7b7e('0x91')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x92'),require('./api/analyticDefaultReport'));_0x53ed64[_0x7b7e('0x7')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x93'),require(_0x7b7e('0x94')));_0x53ed64[_0x7b7e('0x7')]('/api/analytics/field_reports',require(_0x7b7e('0x95')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x96'),require(_0x7b7e('0x97')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x98'),require('./api/intSalesforceAccount'));_0x53ed64[_0x7b7e('0x7')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x53ed64[_0x7b7e('0x7')]('/api/integrations/salesforce/fields',require(_0x7b7e('0x99')));_0x53ed64['use'](_0x7b7e('0x9a'),require(_0x7b7e('0x9b')));_0x53ed64['use'](_0x7b7e('0x9c'),require(_0x7b7e('0x9d')));_0x53ed64['use'](_0x7b7e('0x9e'),require(_0x7b7e('0x9f')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xa0'),require(_0x7b7e('0xa1')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xa2'),require(_0x7b7e('0xa3')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xa4'),require('./api/intDeskField'));_0x53ed64['use'](_0x7b7e('0xa5'),require(_0x7b7e('0xa6')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xa7'),require(_0x7b7e('0xa8')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xa9'),require('./api/intZohoField'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xaa'),require('./api/intZendeskAccount'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xab'),require(_0x7b7e('0xac')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xad'),require(_0x7b7e('0xae')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xaf'),require(_0x7b7e('0xb0')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xb1'),require('./api/intFreshdeskConfiguration'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xb2'),require(_0x7b7e('0xb3')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xb4'),require(_0x7b7e('0xb5')));_0x53ed64[_0x7b7e('0x7')]('/api/integrations/vtiger/configurations',require(_0x7b7e('0xb6')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xb7'),require('./api/intVtigerField'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xb8'),require(_0x7b7e('0xb9')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xba'),require('./api/intServicenowConfiguration'));_0x53ed64['use']('/api/integrations/servicenow/fields',require(_0x7b7e('0xbb')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xbc'),require('./api/intDynamics365Account'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xbd'),require(_0x7b7e('0xbe')));_0x53ed64['use'](_0x7b7e('0xbf'),require(_0x7b7e('0xc0')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xc1'),require('./api/intFreshsalesAccount'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xc2'),require(_0x7b7e('0xc3')));_0x53ed64[_0x7b7e('0x7')]('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x53ed64[_0x7b7e('0x7')]('/api/networks',require(_0x7b7e('0xc4')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xc5'),require(_0x7b7e('0xc6')));_0x53ed64['use'](_0x7b7e('0xc7'),require(_0x7b7e('0xc8')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xc9'),require(_0x7b7e('0xca')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xcb'),require(_0x7b7e('0xcc')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xcd'),require(_0x7b7e('0xce')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xcf'),require(_0x7b7e('0xd0')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xd1'),require('./api/squareReport'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xd2'),require(_0x7b7e('0xd3')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xd4'),require(_0x7b7e('0xd5')));_0x53ed64[_0x7b7e('0x7')]('/api/settings',require(_0x7b7e('0xd6')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xd7'),require(_0x7b7e('0xd8')));_0x53ed64[_0x7b7e('0x7')]('/api/square/projects',require('./api/squareProject'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xd9'),require(_0x7b7e('0xda')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xdb'),require(_0x7b7e('0xdc')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xdd'),require(_0x7b7e('0xde')));_0x53ed64[_0x7b7e('0x7')]('/api/license',require(_0x7b7e('0xdf')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xe0'),require(_0x7b7e('0xe1')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xe2'),require(_0x7b7e('0xe3')));_0x53ed64['use'](_0x7b7e('0xe4'),require('./api/attachment'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xe5'),require('./api/plugin'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xe6'),require(_0x7b7e('0xe7')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xe8'),require('./api/chatTransferReport'));_0x53ed64[_0x7b7e('0x7')]('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xe9'),require(_0x7b7e('0xea')));_0x53ed64[_0x7b7e('0x7')]('/api/sms/reports/transfer',require(_0x7b7e('0xeb')));_0x53ed64['use'](_0x7b7e('0xec'),require(_0x7b7e('0xed')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xee'),require(_0x7b7e('0xef')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xf0'),require('./api/userProfile'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xf1'),require('./api/userProfileSection'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xf2'),require(_0x7b7e('0xf3')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xf4'),require(_0x7b7e('0xf5')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xf6'),require(_0x7b7e('0xf7')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xf8'),require(_0x7b7e('0xf9')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xfa'),require(_0x7b7e('0xfb')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xfc'),require(_0x7b7e('0xfd')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0xfe'),require(_0x7b7e('0xff')));_0x53ed64[_0x7b7e('0x7')]('/api/whatsapp/reports/transfer',require(_0x7b7e('0x100')));_0x53ed64[_0x7b7e('0x7')]('/api/whatsapp/queues',require(_0x7b7e('0x101')));_0x53ed64['use']('/api/cloudProviders',require(_0x7b7e('0x102')));_0x53ed64['use']('/api/auth/local',require(_0x7b7e('0x103')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x104'),require('./api/authGoogle'));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x105'),require(_0x7b7e('0x106')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x107'),require(_0x7b7e('0x108')));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x109'),require(_0x7b7e('0x10a')));_0x53ed64['use'](_0x7b7e('0x10b'),require(_0x7b7e('0x10c')));_0x53ed64[_0x7b7e('0x7')]('/api/pm2',require(_0x7b7e('0x10d')));_0x53ed64[_0x7b7e('0x7')]('/api/webbar',require(_0x7b7e('0x10e')));_0x53ed64['use']('/apidoc',express[_0x7b7e('0x10f')](path[_0x7b7e('0x110')](config['root'],_0x7b7e('0x111'))));_0x53ed64['use']('/www',express[_0x7b7e('0x10f')](path[_0x7b7e('0x110')](config[_0x7b7e('0x112')],_0x7b7e('0x113'))));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x114'),express[_0x7b7e('0x10f')](path[_0x7b7e('0x110')](config['root'],_0x7b7e('0x114'))));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x115'),express[_0x7b7e('0x10f')](path[_0x7b7e('0x110')](config[_0x7b7e('0x112')],_0x7b7e('0x116'),_0x7b7e('0x117'))));_0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x118'),express[_0x7b7e('0x10f')](path[_0x7b7e('0x110')](config['root'],'/server/files/plugins')));_0x53ed64[_0x7b7e('0x119')](_0x7b7e('0x11a'))[_0x7b7e('0x11b')](errors[0x194]);_0x53ed64[_0x7b7e('0x119')]('/*')[_0x7b7e('0x11b')](function(_0x420199,_0x2d885c){_0x2d885c[_0x7b7e('0x11c')](path[_0x7b7e('0x11d')](_0x53ed64[_0x7b7e('0x11b')](_0x7b7e('0x11e'))+_0x7b7e('0x11f')));});};var sensitiveFields=['username',_0x7b7e('0x120'),'newPassword',_0x7b7e('0x121'),_0x7b7e('0x122'),_0x7b7e('0x123'),'street','phone','mobile',_0x7b7e('0x124'),_0x7b7e('0x125'),_0x7b7e('0x126'),_0x7b7e('0x127'),_0x7b7e('0x128'),_0x7b7e('0x129'),_0x7b7e('0x12a'),_0x7b7e('0x12b'),_0x7b7e('0x12c'),_0x7b7e('0x12d'),_0x7b7e('0x12e'),'accessTokenSecret',_0x7b7e('0x12f'),_0x7b7e('0x130'),_0x7b7e('0x131'),_0x7b7e('0x132'),'calleridname',_0x7b7e('0x133'),_0x7b7e('0x134'),_0x7b7e('0x135'),_0x7b7e('0x136'),_0x7b7e('0x137'),_0x7b7e('0x138'),_0x7b7e('0x139'),_0x7b7e('0x13a'),_0x7b7e('0x14'),_0x7b7e('0x13b'),_0x7b7e('0x13c'),_0x7b7e('0x13d'),_0x7b7e('0x13e'),_0x7b7e('0x13f'),_0x7b7e('0x140'),_0x7b7e('0x141')];function maskSensitiveData(_0x33243c){var _0x451862=/(?!^)[\s\S](?!$)/g;for(var _0x1ba63b in _0x33243c){if(_[_0x7b7e('0x142')](_0x33243c[_0x1ba63b])){for(var _0x32e2ee=0x0;_0x32e2ee<_0x33243c[_0x1ba63b][_0x7b7e('0x143')];_0x32e2ee++){maskSensitiveData(_0x33243c[_0x1ba63b][_0x32e2ee]);}}else if(_[_0x7b7e('0x144')](_0x33243c[_0x1ba63b])){maskSensitiveData(_0x33243c[_0x1ba63b]);}else if(_[_0x7b7e('0x145')](_0x33243c[_0x1ba63b])){_0x33243c[_0x1ba63b]=_0x33243c[_0x1ba63b][_0x7b7e('0x146')](/{{{/g,_0x7b7e('0x147'))[_0x7b7e('0x146')](/}}}/g,_0x7b7e('0x148'))['replace'](/{{/g,'@{')[_0x7b7e('0x146')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1ba63b)){_0x33243c[_0x1ba63b]=_0x33243c[_0x1ba63b]['replace'](_0x451862,'*');}}}} \ No newline at end of file +var _0x0713=['/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/notifications','./api/notification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','root','/www','join','/demo','/snippet','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','password','newPassword','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','exten','vidaooApiKey','clientEmail','privateKey','secretaccesskey','key','secret','registry','isArray','isPlainObject','isString','replace','@@{','}@@','includes','express','express-winston','util','./errors','./config/environment','api','./config/logger','auth','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','remoteAddress','url','user','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','name','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./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/mailAccount','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field'];(function(_0x3b08de,_0x63ddd0){var _0x53fbe4=function(_0x16eea2){while(--_0x16eea2){_0x3b08de['push'](_0x3b08de['shift']());}};_0x53fbe4(++_0x63ddd0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var path=require('path');var express=require(_0x3071('0x0'));var ewinston=require(_0x3071('0x1'));var util=require(_0x3071('0x2'));var errors=require(_0x3071('0x3'));var config=require(_0x3071('0x4'));var logger=require('./config/logger')(_0x3071('0x5'));var authLogger=require(_0x3071('0x6'))(_0x3071('0x7'));exports[_0x3071('0x8')]=function(_0xabd7b6){_0xabd7b6[_0x3071('0x9')](ewinston[_0x3071('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2f1e87,_0xbd737f){var _0x22274c=_0x3071('0xb');if(!_[_0x3071('0xc')](_0x2f1e87[_0x3071('0xd')])){_0x22274c+='\x20body=%s';var _0x3457cd=_0x2f1e87[_0x3071('0xd')];maskSensitiveData(_0x3457cd);}return util[_0x3071('0xe')](_0x22274c,_0x2f1e87[_0x3071('0xf')],_0x2f1e87[_0x3071('0x10')]['x-forwarded-for']?_0x2f1e87[_0x3071('0x10')][_0x3071('0x11')]:_0x2f1e87[_0x3071('0x12')][_0x3071('0x13')]||_0x2f1e87['ip'],_0x2f1e87[_0x3071('0x14')],_0xbd737f['statusCode'],_0xbd737f['responseTime'],_0x2f1e87[_0x3071('0x15')]?_0x2f1e87['user']['id']:null,_0x2f1e87[_0x3071('0x15')]?_0x2f1e87[_0x3071('0x15')]['name']:null,_0x2f1e87[_0x3071('0x15')]?_0x2f1e87['user'][_0x3071('0x16')]:null,_0x3457cd?util[_0x3071('0x17')](_0x3457cd,![],null):'');}}));_0xabd7b6[_0x3071('0x9')](ewinston[_0x3071('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1caa5d,_0x2a6a4b){var _0x157a47=_0x3071('0x18');if(_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d[_0x3071('0xd')]['device']&&_0x1caa5d[_0x3071('0xd')][_0x3071('0x19')]){_0x157a47=_0x3071('0x1a');}return util[_0x3071('0xe')](_0x157a47,_0x1caa5d[_0x3071('0xf')],_0x1caa5d[_0x3071('0x10')][_0x3071('0x11')]?_0x1caa5d[_0x3071('0x10')]['x-forwarded-for']:_0x1caa5d[_0x3071('0x12')][_0x3071('0x13')]||_0x1caa5d['ip'],_0x1caa5d[_0x3071('0x14')],_0x2a6a4b['statusCode'],_0x2a6a4b[_0x3071('0x1b')],_0x1caa5d['user']?_0x1caa5d[_0x3071('0x15')]['id']:null,_0x1caa5d[_0x3071('0x15')]?_0x1caa5d[_0x3071('0x15')][_0x3071('0x1c')]:null,_0x1caa5d[_0x3071('0x15')]?_0x1caa5d[_0x3071('0x15')][_0x3071('0x16')]:null,_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d['body']['device']?_0x1caa5d[_0x3071('0xd')][_0x3071('0x1d')]:_0x3071('0x1e'),_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d[_0x3071('0xd')][_0x3071('0x19')]?_0x1caa5d[_0x3071('0xd')][_0x3071('0x19')]:'',_0x1caa5d[_0x3071('0xd')]&&_0x1caa5d['body'][_0x3071('0x1f')]?_0x1caa5d[_0x3071('0xd')][_0x3071('0x1f')]:'');},'ignoreRoute':function(_0x4d5c4b){var _0x4fb1ca=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4fb1ca[_0x3071('0x20')](_0x4d5c4b[_0x3071('0x14')]);}}));_0xabd7b6[_0x3071('0x9')](_0x3071('0x21'),require(_0x3071('0x22')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x23'),require(_0x3071('0x24')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x25'),require('./api/voiceContext'));_0xabd7b6['use'](_0x3071('0x26'),require(_0x3071('0x27')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x28'),require(_0x3071('0x29')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x2a'),require(_0x3071('0x2b')));_0xabd7b6['use']('/api/voice/recordings',require('./api/voiceRecording'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x2c'),require('./api/screenRecording'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x2d'),require(_0x3071('0x2e')));_0xabd7b6[_0x3071('0x9')]('/api/voice/mails/messages',require(_0x3071('0x2f')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x30'),require(_0x3071('0x31')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x32'),require(_0x3071('0x33')));_0xabd7b6[_0x3071('0x9')]('/api/voice/agents/reports',require(_0x3071('0x34')));_0xabd7b6['use']('/api/voice/queues/reports',require(_0x3071('0x35')));_0xabd7b6[_0x3071('0x9')]('/api/members/reports',require(_0x3071('0x36')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x37'),require(_0x3071('0x38')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x39'),require('./api/voiceTransferReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x3a'),require('./api/mailServerOut'));_0xabd7b6[_0x3071('0x9')]('/api/mail/accounts',require(_0x3071('0x3b')));_0xabd7b6[_0x3071('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x3c'),require(_0x3071('0x3d')));_0xabd7b6['use'](_0x3071('0x3e'),require('./api/mailInteraction'));_0xabd7b6[_0x3071('0x9')]('/api/mail/messages',require(_0x3071('0x3f')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x40'),require(_0x3071('0x41')));_0xabd7b6[_0x3071('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x42'),require(_0x3071('0x43')));_0xabd7b6[_0x3071('0x9')]('/api/dashboards/items',require(_0x3071('0x44')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x45'),require(_0x3071('0x46')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x47'),require('./api/faxApplication'));_0xabd7b6[_0x3071('0x9')]('/api/fax/interactions',require('./api/faxInteraction'));_0xabd7b6['use']('/api/fax/messages',require(_0x3071('0x48')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x49'),require(_0x3071('0x4a')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x4b'),require(_0x3071('0x4c')));_0xabd7b6[_0x3071('0x9')]('/api/sms/accounts',require(_0x3071('0x4d')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x4e'),require(_0x3071('0x4f')));_0xabd7b6[_0x3071('0x9')]('/api/sms/interactions',require('./api/smsInteraction'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x50'),require(_0x3071('0x51')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x52'),require('./api/smsQueue'));_0xabd7b6[_0x3071('0x9')]('/api/openchannel/accounts',require(_0x3071('0x53')));_0xabd7b6['use']('/api/openchannel/applications',require(_0x3071('0x54')));_0xabd7b6['use'](_0x3071('0x55'),require('./api/openchannelInteraction'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x56'),require(_0x3071('0x57')));_0xabd7b6[_0x3071('0x9')]('/api/openchannel/queues',require(_0x3071('0x58')));_0xabd7b6['use'](_0x3071('0x59'),require('./api/chatWebsite'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x5a'),require('./api/openchannelQueueReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x5b'),require(_0x3071('0x5c')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x5d'),require(_0x3071('0x5e')));_0xabd7b6[_0x3071('0x9')]('/api/chat/messages',require(_0x3071('0x5f')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x60'),require(_0x3071('0x61')));_0xabd7b6['use'](_0x3071('0x62'),require(_0x3071('0x63')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x64'),require(_0x3071('0x65')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x66'),require(_0x3071('0x67')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x68'),require(_0x3071('0x69')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x6a'),require(_0x3071('0x6b')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x6c'),require('./api/cmHopper'));_0xabd7b6['use'](_0x3071('0x6d'),require('./api/cmHopperBlack'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x6e'),require(_0x3071('0x6f')));_0xabd7b6['use'](_0x3071('0x70'),require(_0x3071('0x71')));_0xabd7b6['use']('/api/cm/custom_fields',require(_0x3071('0x72')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x73'),require(_0x3071('0x74')));_0xabd7b6['use'](_0x3071('0x75'),require(_0x3071('0x76')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x77'),require(_0x3071('0x78')));_0xabd7b6['use'](_0x3071('0x79'),require(_0x3071('0x7a')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x7b'),require(_0x3071('0x7c')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x7d'),require('./api/interval'));_0xabd7b6['use'](_0x3071('0x7e'),require('./api/pause'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x7f'),require('./api/cdr'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x80'),require('./api/voiceQueuesLog'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x81'),require(_0x3071('0x82')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x83'),require('./api/sound'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x84'),require(_0x3071('0x85')));_0xabd7b6['use'](_0x3071('0x86'),require(_0x3071('0x87')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x88'),require(_0x3071('0x89')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x8a'),require(_0x3071('0x8b')));_0xabd7b6[_0x3071('0x9')]('/api/integrations',require(_0x3071('0x8c')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x8d'),require(_0x3071('0x8e')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x8f'),require(_0x3071('0x90')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x91'),require(_0x3071('0x92')));_0xabd7b6[_0x3071('0x9')]('/api/analytics/extracted_reports',require(_0x3071('0x93')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x94'),require(_0x3071('0x95')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x96'),require(_0x3071('0x97')));_0xabd7b6[_0x3071('0x9')]('/api/analytics/tree_reports',require(_0x3071('0x98')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x99'),require(_0x3071('0x9a')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0xabd7b6[_0x3071('0x9')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0xabd7b6['use']('/api/integrations/sugarcrm/configurations',require(_0x3071('0x9b')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x9c'),require('./api/intSugarcrmField'));_0xabd7b6[_0x3071('0x9')](_0x3071('0x9d'),require(_0x3071('0x9e')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/desk/configurations',require(_0x3071('0x9f')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/desk/fields',require(_0x3071('0xa0')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa1'),require(_0x3071('0xa2')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa3'),require(_0x3071('0xa4')));_0xabd7b6['use']('/api/integrations/zoho/fields',require(_0x3071('0xa5')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa6'),require('./api/intZendeskAccount'));_0xabd7b6['use'](_0x3071('0xa7'),require(_0x3071('0xa8')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xa9'),require(_0x3071('0xaa')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xab'),require(_0x3071('0xac')));_0xabd7b6['use'](_0x3071('0xad'),require('./api/intFreshdeskConfiguration'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xae'),require(_0x3071('0xaf')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb0'),require(_0x3071('0xb1')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb2'),require('./api/intVtigerConfiguration'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb3'),require(_0x3071('0xb4')));_0xabd7b6['use'](_0x3071('0xb5'),require(_0x3071('0xb6')));_0xabd7b6[_0x3071('0x9')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0xabd7b6[_0x3071('0x9')]('/api/integrations/servicenow/fields',require(_0x3071('0xb7')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xb8'),require(_0x3071('0xb9')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xba'),require(_0x3071('0xbb')));_0xabd7b6['use'](_0x3071('0xbc'),require(_0x3071('0xbd')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xbe'),require(_0x3071('0xbf')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc0'),require(_0x3071('0xc1')));_0xabd7b6['use'](_0x3071('0xc2'),require('./api/intFreshsalesField'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc3'),require(_0x3071('0xc4')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc5'),require(_0x3071('0xc6')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xc7'),require(_0x3071('0xc8')));_0xabd7b6[_0x3071('0x9')]('/api/jscripty/answers/reports',require(_0x3071('0xc9')));_0xabd7b6[_0x3071('0x9')]('/api/jscripty/questions/reports',require(_0x3071('0xca')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xcb'),require(_0x3071('0xcc')));_0xabd7b6[_0x3071('0x9')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0xabd7b6[_0x3071('0x9')]('/api/square/reports',require(_0x3071('0xcd')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xce'),require(_0x3071('0xcf')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xd0'),require('./api/jscriptyProject'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xd1'),require(_0x3071('0xd2')));_0xabd7b6[_0x3071('0x9')]('/api/square/odbc',require(_0x3071('0xd3')));_0xabd7b6[_0x3071('0x9')]('/api/square/projects',require(_0x3071('0xd4')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xd5'),require(_0x3071('0xd6')));_0xabd7b6[_0x3071('0x9')]('/api/square/messages',require(_0x3071('0xd7')));_0xabd7b6['use'](_0x3071('0xd8'),require(_0x3071('0xd9')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xda'),require(_0x3071('0xdb')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xdc'),require(_0x3071('0xdd')));_0xabd7b6['use'](_0x3071('0xde'),require(_0x3071('0xdf')));_0xabd7b6[_0x3071('0x9')]('/api/attachments',require(_0x3071('0xe0')));_0xabd7b6['use'](_0x3071('0xe1'),require(_0x3071('0xe2')));_0xabd7b6[_0x3071('0x9')]('/api/mail/reports/transfer',require(_0x3071('0xe3')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe4'),require(_0x3071('0xe5')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe6'),require(_0x3071('0xe7')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe8'),require('./api/openchannelTransferReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xe9'),require(_0x3071('0xea')));_0xabd7b6['use']('/api/cm/lists',require('./api/cmList'));_0xabd7b6['use']('/api/voice/prefixes',require(_0x3071('0xeb')));_0xabd7b6[_0x3071('0x9')]('/api/userProfiles',require(_0x3071('0xec')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xed'),require('./api/userProfileSection'));_0xabd7b6['use'](_0x3071('0xee'),require(_0x3071('0xef')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf0'),require(_0x3071('0xf1')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf2'),require('./api/whatsappAccount'));_0xabd7b6['use'](_0x3071('0xf3'),require(_0x3071('0xf4')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf5'),require('./api/whatsappInteraction'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf6'),require(_0x3071('0xf7')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xf8'),require(_0x3071('0xf9')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfa'),require('./api/whatsappTransferReport'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfb'),require(_0x3071('0xfc')));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfd'),require('./api/cloudProvider'));_0xabd7b6[_0x3071('0x9')]('/api/auth/local',require('./api/authLocal'));_0xabd7b6[_0x3071('0x9')](_0x3071('0xfe'),require(_0x3071('0xff')));_0xabd7b6['use'](_0x3071('0x100'),require(_0x3071('0x101')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x102'),require(_0x3071('0x103')));_0xabd7b6['use']('/api/version',require(_0x3071('0x104')));_0xabd7b6[_0x3071('0x9')]('/api/system',require(_0x3071('0x105')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x106'),require(_0x3071('0x107')));_0xabd7b6[_0x3071('0x9')]('/api/webbar',require(_0x3071('0x108')));_0xabd7b6['use'](_0x3071('0x109'),express[_0x3071('0x10a')](path['join'](config[_0x3071('0x10b')],'/apidoc')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x10c'),express[_0x3071('0x10a')](path[_0x3071('0x10d')](config['root'],_0x3071('0x10c'))));_0xabd7b6['use'](_0x3071('0x10e'),express['static'](path[_0x3071('0x10d')](config[_0x3071('0x10b')],'/demo')));_0xabd7b6[_0x3071('0x9')](_0x3071('0x10f'),express['static'](path[_0x3071('0x10d')](config[_0x3071('0x10b')],_0x3071('0x110'),_0x3071('0x111'))));_0xabd7b6[_0x3071('0x9')](_0x3071('0x112'),express[_0x3071('0x10a')](path[_0x3071('0x10d')](config[_0x3071('0x10b')],_0x3071('0x113'))));_0xabd7b6[_0x3071('0x114')](_0x3071('0x115'))[_0x3071('0x116')](errors[0x194]);_0xabd7b6[_0x3071('0x114')]('/*')[_0x3071('0x116')](function(_0x5128a5,_0x1aff4e){_0x1aff4e[_0x3071('0x117')](path[_0x3071('0x118')](_0xabd7b6[_0x3071('0x116')](_0x3071('0x119'))+'/index.html'));});};var sensitiveFields=['username',_0x3071('0x11a'),_0x3071('0x11b'),'apiKey',_0x3071('0x11c'),_0x3071('0x11d'),'street',_0x3071('0x11e'),_0x3071('0x11f'),_0x3071('0x120'),_0x3071('0x121'),_0x3071('0x122'),_0x3071('0x123'),_0x3071('0x124'),_0x3071('0x125'),_0x3071('0x126'),_0x3071('0x127'),'token',_0x3071('0x128'),'accessToken',_0x3071('0x129'),_0x3071('0x12a'),_0x3071('0x12b'),_0x3071('0x12c'),'membername','calleridname','calleridnum',_0x3071('0x12d'),_0x3071('0x12e'),_0x3071('0x12f'),_0x3071('0x130'),'accesskeyid',_0x3071('0x131'),_0x3071('0x132'),_0x3071('0x15'),'pass','accountSid','localstationid','dsn',_0x3071('0x133'),_0x3071('0x134'),'oldPassword'];function maskSensitiveData(_0x2750c5){var _0x2a2b9d=/(?!^)[\s\S](?!$)/g;for(var _0x22c625 in _0x2750c5){if(_[_0x3071('0x135')](_0x2750c5[_0x22c625])){for(var _0x17186c=0x0;_0x17186c<_0x2750c5[_0x22c625]['length'];_0x17186c++){maskSensitiveData(_0x2750c5[_0x22c625][_0x17186c]);}}else if(_[_0x3071('0x136')](_0x2750c5[_0x22c625])){maskSensitiveData(_0x2750c5[_0x22c625]);}else if(_[_0x3071('0x137')](_0x2750c5[_0x22c625])){_0x2750c5[_0x22c625]=_0x2750c5[_0x22c625][_0x3071('0x138')](/{{{/g,_0x3071('0x139'))['replace'](/}}}/g,_0x3071('0x13a'))['replace'](/{{/g,'@{')[_0x3071('0x138')](/}}/g,'}@');if(_[_0x3071('0x13b')](sensitiveFields,_0x22c625)){_0x2750c5[_0x22c625]=_0x2750c5[_0x22c625][_0x3071('0x138')](_0x2a2b9d,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 02ba3ef..45c982d 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1a3=['../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc'];(function(_0x56ea3c,_0x46dbdc){var _0x15c1a4=function(_0x399c60){while(--_0x399c60){_0x56ea3c['push'](_0x56ea3c['shift']());}};_0x15c1a4(++_0x46dbdc);}(_0xf1a3,0xdd));var _0x3f1a=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0xf1a3[_0x5e2cb4];return _0x282902;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x3f1a('0x0'));var _=require(_0x3f1a('0x1'));var config=require(_0x3f1a('0x2'));exports[_0x3f1a('0x3')]=function(){return new BPromise(function(_0x5dcf20,_0x51f786){var _0x4daf76={};_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x5')));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x6')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x7')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/voiceRecording/voiceRecording.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x8')));_0x4daf76=_['merge'](_0x4daf76,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x9')));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0xa')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/memberReport/memberReport.rpc'));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0xb')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0xc')));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0xd')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0xe')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0xf')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x10')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x11')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x12')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x13')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x14')));_0x4daf76=_['merge'](_0x4daf76,require('../api/faxApplication/faxApplication.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x15')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/faxMessage/faxMessage.rpc'));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x16')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x17')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/smsAccount/smsAccount.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x18')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x19')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x1a')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x1b')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x1c')));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x1d')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x1e')));_0x4daf76=_['merge'](_0x4daf76,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x1f')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/chatMessage/chatMessage.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/chatQueue/chatQueue.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x20')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/cmHopper/cmHopper.rpc'));_0x4daf76=_['merge'](_0x4daf76,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x21')));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x22')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x23')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/pause/pause.rpc'));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x24')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/template/template.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x25')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x26')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x27')));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x28')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x29')));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x2a')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x2b')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x2c')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x2d')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x2e')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x2f')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x30')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x31')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x32')));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x33')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x34')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x35')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x36')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x37')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x38')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/plugin/plugin.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x39')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x3a')));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x4daf76=_[_0x3f1a('0x4')](_0x4daf76,require(_0x3f1a('0x3b')));_0x4daf76=_['merge'](_0x4daf76,require(_0x3f1a('0x3c')));var _0xbfb427=jayson[_0x3f1a('0x3d')](_0x4daf76)['http']();var _0x1957f1=config[_0x3f1a('0x3e')][_0x3f1a('0x3f')]||config[_0x3f1a('0x3f')]+0x1;var _0x5e7562=config[_0x3f1a('0x3e')]['ip']||_0x3f1a('0x40');_0xbfb427['on'](_0x3f1a('0x41'),function(_0x470888){return _0x51f786(_0x470888);});_0xbfb427[_0x3f1a('0x3')](_0x1957f1,_0x5e7562,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5e7562,_0x1957f1);require('../config/triggers')['default']();return _0x5dcf20('RPC\x20listening\x20on\x20'+_0x5e7562+':'+_0x1957f1);});});}; \ No newline at end of file +var _0xa66f=['../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/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/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xa66f,0x85));var _0xfa66=function(_0x1a4d99,_0x506ad4){_0x1a4d99=_0x1a4d99-0x0;var _0x49619a=_0xa66f[_0x1a4d99];return _0x49619a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xfa66('0x0'));var _=require('lodash');var config=require(_0xfa66('0x1'));exports[_0xfa66('0x2')]=function(){return new BPromise(function(_0x3df3cb,_0x271b40){var _0x458dc2={};_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x4')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x5')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x6')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x7')));_0x458dc2=_['merge'](_0x458dc2,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x8')));_0x458dc2=_['merge'](_0x458dc2,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x9')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0xa')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0xb')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0xc')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0xd')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require('../api/mailServerIn/mailServerIn.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require('../api/mailAccount/mailAccount.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0xe')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0xf')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x10')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x11')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x12')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require('../api/faxApplication/faxApplication.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x13')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x14')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x15')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x16')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x17')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x18')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x19')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require('../api/smsQueue/smsQueue.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x1a')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x1b')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x1c')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x1d')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x1e')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require('../api/chatMessage/chatMessage.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x1f')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x20')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x21')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x22')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x23')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x24')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x25')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x26')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x27')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x28')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x29')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x2a')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x2b')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x2c')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x2d')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x2e')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x2f')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x30')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x31')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x32')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x33')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x34')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x35')));_0x458dc2=_['merge'](_0x458dc2,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require('../api/squareReport/squareReport.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x36')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x37')));_0x458dc2=_['merge'](_0x458dc2,require(_0xfa66('0x38')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x39')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x3a')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x3b')));_0x458dc2=_['merge'](_0x458dc2,require('../api/attachment/attachment.rpc'));_0x458dc2=_['merge'](_0x458dc2,require('../api/plugin/plugin.rpc'));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x3c')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x3d')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x3e')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x3f')));_0x458dc2=_[_0xfa66('0x3')](_0x458dc2,require(_0xfa66('0x40')));var _0x846574=jayson['server'](_0x458dc2)[_0xfa66('0x41')]();var _0x38ce85=config[_0xfa66('0x42')][_0xfa66('0x43')]||config[_0xfa66('0x43')]+0x1;var _0x455ada=config['rpc']['ip']||'localhost';_0x846574['on'](_0xfa66('0x44'),function(_0x197ca0){return _0x271b40(_0x197ca0);});_0x846574[_0xfa66('0x2')](_0x38ce85,_0x455ada,function(){console[_0xfa66('0x45')](_0xfa66('0x46'),_0x455ada,_0x38ce85);require(_0xfa66('0x47'))['default']();return _0x3df3cb('RPC\x20listening\x20on\x20'+_0x455ada+':'+_0x38ce85);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index ee6fd2f..ba4df8d 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 _0xcb91=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','utf8','setTimeout','headers','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','destroy','sendRequest','sync','prototype','answer','getData','beep','format'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xcb91[_0x377a6e];return _0x37f751;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x1cb9('0x0'))[_0x1cb9('0x1')];var AGIReply=require(_0x1cb9('0x2'));var AGIError=require(_0x1cb9('0x3'));function AGIChannel(_0x4c37e8){var _0x8c392f=this,_0x2c17b8=new AGIReply(),_0x545a34=![],_0x13d5fd={};EventEmitter[_0x1cb9('0x4')](_0x8c392f);_0x4c37e8['setEncoding'](_0x1cb9('0x5'));_0x4c37e8[_0x1cb9('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2c17b8['setEncoding'](_0x1cb9('0x5'));_0x2c17b8['on'](_0x1cb9('0x7'),function(_0x59d1be){for(var _0x3ae0f1 in _0x59d1be){_0x8c392f[_0x3ae0f1]=_0x59d1be[_0x3ae0f1];}_0x8c392f['emit']('ready');});_0x2c17b8['on'](_0x1cb9('0x8'),function(_0x2fa15c){if(_0x2fa15c[_0x1cb9('0x9')]()==_0x1cb9('0xa')){_0x8c392f[_0x1cb9('0xb')]('hangup');return;}if(_0x2fa15c[_0x1cb9('0xc')](0x0,0xb)==_0x1cb9('0xd')){_0x545a34=!![];}if(_0x545a34){_0x13d5fd['rx']+=_0x2fa15c+'\x0a';if(_0x2fa15c[_0x1cb9('0xe')](_0x1cb9('0xf'))!=-0x1){_0x545a34=![];}}else{_0x13d5fd['rx']=_0x2fa15c;}if(_0x545a34){return;}if(typeof _0x13d5fd['cb']==_0x1cb9('0x10')){var _0x5445e1=_0x13d5fd['rx'][_0x1cb9('0xc')](0x0,0x3),_0x5e3c19=null,_0x59dec3=null;_0x5445e1=parseInt(_0x5445e1);if(isNaN(_0x5445e1)){_0x13d5fd['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1cb9('0x11')});return;}if(_0x5445e1!=0xc8){_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':-0x1,'extra':'KO'});return;}_0x5e3c19=_0x13d5fd['rx'][_0x1cb9('0xc')](0x4)[_0x1cb9('0x12')]('result=','');if(_0x5e3c19[_0x1cb9('0x13')]('\x20')!=-0x1){_0x5e3c19=_0x5e3c19[_0x1cb9('0x14')](0x0,_0x5e3c19[_0x1cb9('0x13')]('\x20'));}if(_[_0x1cb9('0x15')](_0x5e3c19,'-1')){_0x5e3c19=parseInt(_0x5e3c19);}_0x59dec3=_0x13d5fd['rx'][_0x1cb9('0x16')]('\x20');if(_0x59dec3['length']==0x3){_0x59dec3=_0x59dec3[0x2]['substring'](0x1,_0x59dec3[0x2][_0x1cb9('0x17')]-0x1);}else if(_0x59dec3[_0x1cb9('0x17')]>0x3){var _0x3904b7=/\((.+)\)/;var _0x3f1376=_0x13d5fd['rx'][_0x1cb9('0x18')](_0x3904b7);if(_0x3f1376){_0x59dec3=_0x3f1376[0x1];}else{_0x59dec3=null;}}else{_0x59dec3=null;}_0x13d5fd['cb'](null,{'code':_0x5445e1,'result':_0x5e3c19,'extra':_0x59dec3});}});_0x4c37e8['on'](_0x1cb9('0x19'),function(_0x23d3a9){_0x8c392f['emit']('error',new AGIError(_0x1cb9('0x1a'),_0x23d3a9[_0x1cb9('0x1b')]));});_0x4c37e8['on'](_0x1cb9('0x1c'),function(){_0x8c392f[_0x1cb9('0xb')](_0x1cb9('0x1c'),new AGIError(_0x1cb9('0x1d')));});_0x4c37e8['on'](_0x1cb9('0x1e'),function(){_0x8c392f['emit']('timeout',new AGIError(_0x1cb9('0x1f')));_0x4c37e8['destroy']();});_0x4c37e8[_0x1cb9('0x20')](_0x2c17b8);this[_0x1cb9('0x21')]=function(_0x523b26,_0x599275){var _0x523b26=_0x523b26||'',_0x599275=typeof _0x599275==_0x1cb9('0x10')?_0x599275:new Function();_0x13d5fd={'tx':_0x523b26,'rx':'','cb':_0x599275};_0x4c37e8[_0x1cb9('0x22')](_0x523b26+'\x0a');},this[_0x1cb9('0x1c')]=function(){_0x4c37e8[_0x1cb9('0x23')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x1cb9('0x24')]=function(_0x557199){return this[_0x1cb9('0x21')][_0x1cb9('0x25')](this,_0x557199);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x27')]=function(){return this[_0x1cb9('0x24')]('ANSWER');};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x28')]=function(_0x4c8d76,_0xd6891c,_0x21effa){_0x4c8d76=_0x4c8d76===undefined?_0x1cb9('0x29'):_0x4c8d76;_0xd6891c=_0xd6891c===undefined?'5':_0xd6891c;_0x21effa=_0x21effa===undefined?'1':_0x21effa;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2b'),_0x4c8d76,_0xd6891c*0x3e8,_0x21effa));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x2c')]=function(_0x41e5c2){_0x41e5c2=_0x41e5c2||_0x1cb9('0x2d');return this['sendRequest'](util[_0x1cb9('0x2a')]('VERBOSE\x20\x22%s\x22',_0x41e5c2));};AGIChannel[_0x1cb9('0x26')]['exec']=function(_0x278327,_0x41011c){if(_[_0x1cb9('0x2e')](_0x41011c)){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x2f'),_0x278327,_0x41011c['join'](',')));}return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x2f'),_0x278327,_0x41011c));};AGIChannel['prototype'][_0x1cb9('0x30')]=function(_0x5e84fd){return this[_0x1cb9('0x24')](util['format'](_0x1cb9('0x31'),_0x5e84fd));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x32')]=function(_0xae910){return this['sendRequest'](util[_0x1cb9('0x2a')](_0x1cb9('0x33'),_0xae910));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x34')]=function(_0xc6784c){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x35'),_0xc6784c));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0xa')]=function(){return this[_0x1cb9('0x24')](_0x1cb9('0x36'));};AGIChannel[_0x1cb9('0x26')]['setVariable']=function(_0x54c6e6,_0x299ff8){var _0x30f7e4=_[_0x1cb9('0x37')](_0x299ff8)||_[_0x1cb9('0x38')](_0x299ff8)?_0x299ff8[_0x1cb9('0x39')]():_0x299ff8;return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3a'),_0x54c6e6,_0x30f7e4?_0x30f7e4['toString']()[_0x1cb9('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3b')]=function(_0x5350f9,_0x2a5aac){return this['sendRequest'](util[_0x1cb9('0x2a')]('SAY\x20NUMBER\x20%s\x20%s',_0x5350f9,_0x2a5aac));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3c')]=function(_0x289b73,_0x2bcacd){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3d'),_0x289b73,_0x2bcacd));};AGIChannel['prototype']['sayPhonetic']=function(_0x4111b8,_0x1d2723){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x3e'),_0x4111b8,_0x1d2723));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x3f')]=function(_0x4a670c,_0xbcaa32,_0x47edad){_0xbcaa32=_0xbcaa32||this['extension'];_0x47edad=_0x47edad||0x1;this['setContext'](_0x4a670c);this[_0x1cb9('0x32')](_0xbcaa32);this[_0x1cb9('0x34')](_0x47edad);return this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x40'),_0x4a670c,_0xbcaa32,_0x47edad));};AGIChannel['prototype'][_0x1cb9('0x41')]=function(_0x523866){return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x42'),_0x523866));};AGIChannel['prototype'][_0x1cb9('0x43')]=function(_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x5839aa,_0x24c643){_0xda1a44=_0xda1a44||_0x1cb9('0x44');_0xbc36fc=_0xbc36fc||'';_0x51a898=_0x51a898===undefined?-0x1:_0x51a898==='-1'?-0x1:_0x51a898*0x3e8;_0x5839aa=_0x5839aa===undefined?'':'s='+_0x5839aa;_0x24c643=_0x24c643?_0x1cb9('0x45'):'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x522283,_0xda1a44,_0xbc36fc,_0x51a898,_0x24c643,_0x5839aa));};AGIChannel[_0x1cb9('0x26')]['streamFile']=function(_0x4c59e7,_0x495335){_0x495335=_0x495335||'';return this[_0x1cb9('0x24')](util[_0x1cb9('0x2a')](_0x1cb9('0x46'),_0x4c59e7,_0x495335));};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x47')]=function(_0x2a8b7f){return this[_0x1cb9('0x48')](_0x1cb9('0x49'),_0x2a8b7f);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x4a')]=function(_0x3ea88c){return this['exec'](_0x1cb9('0x4b'),_0x3ea88c);};AGIChannel[_0x1cb9('0x26')][_0x1cb9('0x19')]=function(_0x55255c,_0x179e81){this[_0x1cb9('0x2c')](util[_0x1cb9('0x2a')](_0x1cb9('0x4c'),_0x55255c['id'],_0x55255c[_0x1cb9('0x4d')],_0x179e81));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x70e0=['format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','./error','setEncoding','utf8','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','substr','indexOf','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','sendRequest'];(function(_0x54e7f5,_0x1de1e2){var _0x1c3155=function(_0x342d75){while(--_0x342d75){_0x54e7f5['push'](_0x54e7f5['shift']());}};_0x1c3155(++_0x1de1e2);}(_0x70e0,0x17b));var _0x070e=function(_0xa6f90c,_0x1d315b){_0xa6f90c=_0xa6f90c-0x0;var _0x2b19c8=_0x70e0[_0xa6f90c];return _0x2b19c8;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var EventEmitter=require(_0x070e('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0x070e('0x3'));function AGIChannel(_0xee173){var _0x277d32=this,_0x2593e5=new AGIReply(),_0x5c90fc=![],_0x7bce9b={};EventEmitter['call'](_0x277d32);_0xee173[_0x070e('0x4')]('utf8');_0xee173['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x2593e5['setEncoding'](_0x070e('0x5'));_0x2593e5['on'](_0x070e('0x6'),function(_0x604664){for(var _0x2611e6 in _0x604664){_0x277d32[_0x2611e6]=_0x604664[_0x2611e6];}_0x277d32[_0x070e('0x7')](_0x070e('0x8'));});_0x2593e5['on'](_0x070e('0x9'),function(_0x4e99e6){if(_0x4e99e6['toLowerCase']()==_0x070e('0xa')){_0x277d32[_0x070e('0x7')](_0x070e('0xa'));return;}if(_0x4e99e6[_0x070e('0xb')](0x0,0xb)==_0x070e('0xc')){_0x5c90fc=!![];}if(_0x5c90fc){_0x7bce9b['rx']+=_0x4e99e6+'\x0a';if(_0x4e99e6[_0x070e('0xd')](_0x070e('0xe'))!=-0x1){_0x5c90fc=![];}}else{_0x7bce9b['rx']=_0x4e99e6;}if(_0x5c90fc){return;}if(typeof _0x7bce9b['cb']==_0x070e('0xf')){var _0x39d2b9=_0x7bce9b['rx']['substring'](0x0,0x3),_0x5bf079=null,_0x2930b8=null;_0x39d2b9=parseInt(_0x39d2b9);if(isNaN(_0x39d2b9)){_0x7bce9b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x39d2b9!=0xc8){_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':-0x1,'extra':'KO'});return;}_0x5bf079=_0x7bce9b['rx'][_0x070e('0xb')](0x4)['replace']('result=','');if(_0x5bf079['indexOf']('\x20')!=-0x1){_0x5bf079=_0x5bf079[_0x070e('0x10')](0x0,_0x5bf079[_0x070e('0x11')]('\x20'));}if(_['startsWith'](_0x5bf079,'-1')){_0x5bf079=parseInt(_0x5bf079);}_0x2930b8=_0x7bce9b['rx']['split']('\x20');if(_0x2930b8[_0x070e('0x12')]==0x3){_0x2930b8=_0x2930b8[0x2][_0x070e('0xb')](0x1,_0x2930b8[0x2][_0x070e('0x12')]-0x1);}else if(_0x2930b8[_0x070e('0x12')]>0x3){var _0x5bc71e=/\((.+)\)/;var _0x49861b=_0x7bce9b['rx'][_0x070e('0x13')](_0x5bc71e);if(_0x49861b){_0x2930b8=_0x49861b[0x1];}else{_0x2930b8=null;}}else{_0x2930b8=null;}_0x7bce9b['cb'](null,{'code':_0x39d2b9,'result':_0x5bf079,'extra':_0x2930b8});}});_0xee173['on'](_0x070e('0x14'),function(_0x38f6e6){_0x277d32[_0x070e('0x7')](_0x070e('0x14'),new AGIError('E_AGI_SOCKET_ERROR',_0x38f6e6[_0x070e('0x15')]));});_0xee173['on'](_0x070e('0x16'),function(){_0x277d32[_0x070e('0x7')](_0x070e('0x16'),new AGIError(_0x070e('0x17')));});_0xee173['on']('timeout',function(){_0x277d32['emit']('timeout',new AGIError(_0x070e('0x18')));_0xee173[_0x070e('0x19')]();});_0xee173[_0x070e('0x1a')](_0x2593e5);this['command']=function(_0x5b184,_0x5dc5d2){var _0x5b184=_0x5b184||'',_0x5dc5d2=typeof _0x5dc5d2==_0x070e('0xf')?_0x5dc5d2:new Function();_0x7bce9b={'tx':_0x5b184,'rx':'','cb':_0x5dc5d2};_0xee173[_0x070e('0x1b')](_0x5b184+'\x0a');},this[_0x070e('0x16')]=function(){_0xee173[_0x070e('0x19')]();};}util[_0x070e('0x1c')](AGIChannel,EventEmitter);AGIChannel[_0x070e('0x1d')]['sendRequest']=function(_0x2f8055){return this[_0x070e('0x1e')][_0x070e('0x1f')](this,_0x2f8055);};AGIChannel['prototype'][_0x070e('0x20')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x070e('0x1d')][_0x070e('0x21')]=function(_0x41deb1,_0x1743cc,_0x4763c6){_0x41deb1=_0x41deb1===undefined?'beep':_0x41deb1;_0x1743cc=_0x1743cc===undefined?'5':_0x1743cc;_0x4763c6=_0x4763c6===undefined?'1':_0x4763c6;return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x24'),_0x41deb1,_0x1743cc*0x3e8,_0x4763c6));};AGIChannel[_0x070e('0x1d')][_0x070e('0x25')]=function(_0x28d7f2){_0x28d7f2=_0x28d7f2||_0x070e('0x26');return this[_0x070e('0x22')](util['format'](_0x070e('0x27'),_0x28d7f2));};AGIChannel[_0x070e('0x1d')][_0x070e('0x28')]=function(_0x56fc12,_0x5c5f0d){if(_[_0x070e('0x29')](_0x5c5f0d)){return this[_0x070e('0x22')](util[_0x070e('0x23')]('EXEC\x20%s\x20%s',_0x56fc12,_0x5c5f0d[_0x070e('0x2a')](',')));}return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2b'),_0x56fc12,_0x5c5f0d));};AGIChannel['prototype']['setContext']=function(_0x523b75){return this['sendRequest'](util[_0x070e('0x23')]('SET\x20CONTEXT\x20%s',_0x523b75));};AGIChannel[_0x070e('0x1d')][_0x070e('0x2c')]=function(_0x4f8130){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x2d'),_0x4f8130));};AGIChannel['prototype']['setPriority']=function(_0x41ade4){return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x2e'),_0x41ade4));};AGIChannel[_0x070e('0x1d')]['hangup']=function(){return this['sendRequest'](_0x070e('0x2f'));};AGIChannel[_0x070e('0x1d')][_0x070e('0x30')]=function(_0xf57ed,_0xf11439){var _0x4deaf8=_[_0x070e('0x31')](_0xf11439)||_[_0x070e('0x32')](_0xf11439)?_0xf11439['toString']():_0xf11439;return this[_0x070e('0x22')](util[_0x070e('0x23')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xf57ed,_0x4deaf8?_0x4deaf8['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x070e('0x1d')][_0x070e('0x33')]=function(_0x39dfaa,_0x334733){return this[_0x070e('0x22')](util['format'](_0x070e('0x34'),_0x39dfaa,_0x334733));};AGIChannel[_0x070e('0x1d')][_0x070e('0x35')]=function(_0x487276,_0x268c5d){return this[_0x070e('0x22')](util[_0x070e('0x23')]('SAY\x20DIGITS\x20%s\x20%s',_0x487276,_0x268c5d));};AGIChannel[_0x070e('0x1d')][_0x070e('0x36')]=function(_0x4800a9,_0x173602){return this['sendRequest'](util[_0x070e('0x23')](_0x070e('0x37'),_0x4800a9,_0x173602));};AGIChannel[_0x070e('0x1d')][_0x070e('0x38')]=function(_0xd03404,_0x47b929,_0xd18220){_0x47b929=_0x47b929||this['extension'];_0xd18220=_0xd18220||0x1;this['setContext'](_0xd03404);this[_0x070e('0x2c')](_0x47b929);this[_0x070e('0x39')](_0xd18220);return this[_0x070e('0x25')](util['format'](_0x070e('0x3a'),_0xd03404,_0x47b929,_0xd18220));};AGIChannel[_0x070e('0x1d')][_0x070e('0x3b')]=function(_0x7dc240){return this['sendRequest'](util[_0x070e('0x23')]('GET\x20VARIABLE\x20\x22%s\x22',_0x7dc240));};AGIChannel['prototype']['recordFile']=function(_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x34f23e,_0x562aa4){_0x926533=_0x926533||_0x070e('0x3c');_0x26b3e2=_0x26b3e2||'';_0x29dccd=_0x29dccd===undefined?-0x1:_0x29dccd==='-1'?-0x1:_0x29dccd*0x3e8;_0x34f23e=_0x34f23e===undefined?'':'s='+_0x34f23e;_0x562aa4=_0x562aa4?'BEEP':'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3d'),_0x3feb83,_0x926533,_0x26b3e2,_0x29dccd,_0x562aa4,_0x34f23e));};AGIChannel['prototype']['streamFile']=function(_0x261a27,_0x5ee4b8){_0x5ee4b8=_0x5ee4b8||'';return this[_0x070e('0x22')](util[_0x070e('0x23')](_0x070e('0x3e'),_0x261a27,_0x5ee4b8));};AGIChannel['prototype'][_0x070e('0x3f')]=function(_0x20a1ee){return this['exec']('AGI',_0x20a1ee);};AGIChannel[_0x070e('0x1d')][_0x070e('0x40')]=function(_0x2d43ce){return this[_0x070e('0x28')](_0x070e('0x41'),_0x2d43ce);};AGIChannel['prototype'][_0x070e('0x14')]=function(_0x3f6c64,_0x427fa7){this[_0x070e('0x25')](util[_0x070e('0x23')](_0x070e('0x42'),_0x3f6c64['id'],_0x3f6c64[_0x070e('0x43')],_0x427fa7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x070e('0x44')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 196346d..4ebeee4 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 _0x865d=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x865d,0x1d9));var _0xd865=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x865d[_0x21549c];return _0x426cbd;};'use strict';var util=require(_0xd865('0x0'));var error={'E_AGI_UNDEFINED':_0xd865('0x1'),'E_AGI_ARGUMENT_PORT':_0xd865('0x2'),'E_AGI_SERVER_ERROR':_0xd865('0x3'),'E_AGI_SERVER_CLOSE':_0xd865('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xd865('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xd865('0x6'),'E_AGI_SOCKET_ERROR':_0xd865('0x7'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xd865('0x8'),'E_AGI_COMMAND_EMPTY':_0xd865('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd865('0xa'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x490365){var _0x490365=_0x490365||null,_0xe06e4c=_0xe06e4c||[],_0x3a351d=0x1,_0x352b95='';if(!error[_0x490365]){_0x490365=_0xd865('0xb');}_0xe06e4c[_0xd865('0xc')](error[_0x490365]);while(arguments[_0x3a351d]){_0xe06e4c['push'](arguments[_0x3a351d]);_0x3a351d++;}_0x352b95=util[_0xd865('0xd')][_0xd865('0xe')](util,_0xe06e4c);this[_0xd865('0xf')]=_0x352b95;this['name']=_0x490365;}module[_0xd865('0x10')]=AGIError; \ No newline at end of file +var _0x10d8=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','apply','message','name','exports'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x10d8,0xee));var _0x810d=function(_0x15a2fb,_0x287d02){_0x15a2fb=_0x15a2fb-0x0;var _0x4f9c24=_0x10d8[_0x15a2fb];return _0x4f9c24;};'use strict';var util=require(_0x810d('0x0'));var error={'E_AGI_UNDEFINED':_0x810d('0x1'),'E_AGI_ARGUMENT_PORT':_0x810d('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x810d('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x810d('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x810d('0x5'),'E_AGI_SOCKET_ERROR':_0x810d('0x6'),'E_AGI_SOCKET_CLOSE':_0x810d('0x7'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x810d('0x8'),'E_AGI_IVR_ENTRY':_0x810d('0x9')};function AGIError(_0xeebfbe){var _0xeebfbe=_0xeebfbe||null,_0x18af64=_0x18af64||[],_0x3740af=0x1,_0x3b0e88='';if(!error[_0xeebfbe]){_0xeebfbe='E_AGI_UNDEFINED';}_0x18af64['push'](error[_0xeebfbe]);while(arguments[_0x3740af]){_0x18af64['push'](arguments[_0x3740af]);_0x3740af++;}_0x3b0e88=util['format'][_0x810d('0xa')](util,_0x18af64);this[_0x810d('0xb')]=_0x3b0e88;this[_0x810d('0xc')]=_0xeebfbe;}module[_0x810d('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 6b83d82..8880565 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 _0x1775=['no\x20edge/s\x20available','condition','split','vswitch','target','default','agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','relations','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length'];(function(_0x2cd5cd,_0x4489ec){var _0x225ebb=function(_0xda7972){while(--_0xda7972){_0x2cd5cd['push'](_0x2cd5cd['shift']());}};_0x225ebb(++_0x4489ec);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var logger=require(_0x5177('0x0'))(_0x5177('0x1'));var verticesWithRetry=[_0x5177('0x2'),_0x5177('0x3'),_0x5177('0x4')];var Graph=function(){this[_0x5177('0x5')]={};this[_0x5177('0x6')]={};this[_0x5177('0x7')]=0x0;};Graph[_0x5177('0x8')][_0x5177('0x9')]=function(_0x159a20){this[_0x5177('0x5')][_0x159a20['id']]=_0x159a20;this[_0x5177('0x6')][_0x159a20['id']]=[];};Graph[_0x5177('0x8')][_0x5177('0xa')]=function(_0x245c12,_0x363611,_0x3ce288){this[_0x5177('0x6')][_0x245c12][_0x5177('0xb')]({'target':_0x363611,'condition':_0x3ce288});this[_0x5177('0x7')]+=0x1;};Graph[_0x5177('0x8')]['size']=function(){return _['size'](this[_0x5177('0x5')]);};Graph[_0x5177('0x8')][_0x5177('0xc')]=function(){return this[_0x5177('0x7')];};Graph[_0x5177('0x8')]['getVertex']=function(_0x18f567){return this[_0x5177('0x5')][_0x18f567];};Graph[_0x5177('0x8')][_0x5177('0xd')]=function(_0x111e99,_0x299eba){if(!this[_0x5177('0x5')][_0x111e99]){return logger[_0x5177('0xe')](_0x5177('0xf'));}var _0x1eb9dd=_0x299eba(this[_0x5177('0x5')][_0x111e99]);if(!_0x1eb9dd){return logger[_0x5177('0xe')](_0x5177('0x10'));}if(this[_0x5177('0x6')][_0x111e99][_0x5177('0x11')]===0x0){return logger[_0x5177('0xe')](_0x5177('0x12'));}for(var _0x7dba6f=0x0,_0xe6dcf6=[],_0x50ce2c=![];_0x7dba6f\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','hasOwnProperty','retry','omit','mxCell','isArray','length','source','target','value','then','createSquareReport','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s'];(function(_0x60a935,_0x4fae24){var _0x4e22a0=function(_0x395a0a){while(--_0x395a0a){_0x60a935['push'](_0x60a935['shift']());}};_0x4e22a0(++_0x4fae24);}(_0x98d3,0x173));var _0x398d=function(_0x1b39cc,_0x44ff1a){_0x1b39cc=_0x1b39cc-0x0;var _0x59e836=_0x98d3[_0x1b39cc];return _0x59e836;};'use strict';var parser=require(_0x398d('0x0'));var _=require(_0x398d('0x1'));var syncho=require('syncho');var util=require(_0x398d('0x2'));var moment=require('moment');var config=require(_0x398d('0x3'));var logger=require('../../config/logger')(_0x398d('0x4'));var utilLicense=require(_0x398d('0x5'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x398d('0x6'));var Vertices=require(_0x398d('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x398d('0x4')]=_['defaults'](config[_0x398d('0x4')],{'ip':_0x398d('0x8'),'port':0x11dd});function connectionHandler(_0x3029f3){process[_0x398d('0x9')](function(){syncho(function(){try{setChannelVariables(_0x3029f3);agiHandler(_0x3029f3);}catch(_0x2f654c){logger['error'](_0x2f654c[_0x398d('0xa')]);}});});}function listeningHandler(){console[_0x398d('0xb')](_0x398d('0xc'),config[_0x398d('0x4')][_0x398d('0xd')]);logger[_0x398d('0xe')](util[_0x398d('0xf')](_0x398d('0x10'),config['agi']['ip'],config[_0x398d('0x4')][_0x398d('0xd')]));}function errorHandler(_0x3b5b81){if(_0x3b5b81&&_0x3b5b81[_0x398d('0x11')]&&_0x3b5b81[_0x398d('0x12')]){logger[_0x398d('0x13')](util[_0x398d('0xf')](_0x398d('0x14'),_0x3b5b81[_0x398d('0x11')],_0x3b5b81[_0x398d('0x12')]));}else{logger[_0x398d('0x13')](util['format']('[ERROR]\x20%s',_0x3b5b81[_0x398d('0xa')]));}}function closeHandler(){logger[_0x398d('0xe')](util[_0x398d('0xf')](_0x398d('0x15'),this[_0x398d('0x16')],this[_0x398d('0x17')],this[_0x398d('0x18')],this[_0x398d('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x26b9a0){logger['error'](_0x26b9a0[_0x398d('0xa')]);}}function timeoutHandler(){logger[_0x398d('0xe')](util[_0x398d('0xf')]('[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[_0x398d('0x18')],this[_0x398d('0x19')],this[_0x398d('0x1a')]));}function hangupHandler(){logger[_0x398d('0xe')](util[_0x398d('0xf')](_0x398d('0x1b'),this[_0x398d('0x16')],this['calleridname'],this['callerid'],this['dnid'],this[_0x398d('0x1a')]));this[_0x398d('0x1c')]=!![];}function getRoot(_0x1ea5f9){return parser[_0x398d('0x1d')](_0x1ea5f9,{'object':!![]})[_0x398d('0x1e')]['root'];}function addVertex(_0x5c4c70,_0x31e87d,_0x497ad1){_0x31e87d['agicommand']=_0x497ad1;if(_0x31e87d[_0x398d('0x1f')](_0x398d('0x20'))){_0x31e87d['maxRetry']=parseInt(_0x31e87d['retry'],0xa);}_0x5c4c70['addVertex'](_[_0x398d('0x21')](_0x31e87d,_0x398d('0x22')));}function initGraph(_0x24fa2c,_0x248555){var _0x2a1f4d=new Graph();for(var _0xd614bf in _0x24fa2c){if(_0x24fa2c[_0x398d('0x1f')](_0xd614bf)){if(_[_0x398d('0x23')](_0x24fa2c[_0xd614bf])){for(var _0x4f4466=0x0;_0x4f4466<_0x24fa2c[_0xd614bf][_0x398d('0x24')];_0x4f4466+=0x1){addVertex(_0x2a1f4d,_0x24fa2c[_0xd614bf][_0x4f4466],_0xd614bf);}}else{addVertex(_0x2a1f4d,_0x24fa2c[_0xd614bf],_0xd614bf);}}}for(var _0x557dce=0x0;_0x557dce<_0x248555['length'];_0x557dce+=0x1){if(_0x248555[_0x557dce][_0x398d('0x25')]&&_0x248555[_0x557dce][_0x398d('0x26')]){_0x2a1f4d['addEdge'](_0x248555[_0x557dce][_0x398d('0x25')],_0x248555[_0x557dce]['target'],_0x248555[_0x557dce][_0x398d('0x27')]);}}return _0x2a1f4d;}function getSquareProject(_0x8abf30,_0x582d16){rpc['getSquareProject'](_0x8abf30)[_0x398d('0x28')](function(_0x2ca780){_0x582d16(null,_0x2ca780);})['catch'](function(_0x397f07){_0x582d16(null,_0x397f07);});}function createSquareReport(_0x2fbcce,_0x204b27){rpc[_0x398d('0x29')](_0x2fbcce)[_0x398d('0x28')](function(_0x3bcc5e){if(_0x204b27){_0x204b27(null,_0x3bcc5e);}})['catch'](function(_0x5a9f61){if(_0x204b27){_0x204b27(null,_0x5a9f61);}});}function setChannelVariables(_0x347c8a){for(var _0xe6a05 in _0x347c8a){if(_0x347c8a[_0x398d('0x1f')](_0xe6a05)){if(_0xe6a05[_0x398d('0x2a')](_0x398d('0x2b'))===0x0){_0x347c8a[_0xe6a05[_0x398d('0x2c')](0x4)]=_0x347c8a[_0xe6a05];delete _0x347c8a[_0xe6a05];}}}}function getLogFromObject(_0xd8dc6c){return util[_0x398d('0x2d')](_0xd8dc6c,{'showHidden':![],'depth':null});}function agiHandler(_0x1827be){var _0x5411c5,_0x6dac9f,_0x3807f0,_0x182650,_0x557f83;logger['debug'](_0x398d('0x2e'),JSON[_0x398d('0x2f')](_0x1827be,null,0x2));logger[_0x398d('0xe')](util[_0x398d('0xf')](_0x398d('0x30'),_0x1827be[_0x398d('0x16')],_0x1827be[_0x398d('0x17')],_0x1827be[_0x398d('0x18')],_0x1827be[_0x398d('0x19')],_0x1827be[_0x398d('0x1a')]));_0x1827be['on'](_0x398d('0x13'),errorHandler);_0x1827be['on'](_0x398d('0x31'),closeHandler);_0x1827be['on'](_0x398d('0x32'),timeoutHandler);_0x1827be[_0x398d('0x1c')]=![];_0x1827be['on'](_0x398d('0x33'),hangupHandler);var _0x302314=getSquareProject[_0x398d('0x34')](null,_0x1827be[_0x398d('0x16')]);if(_0x302314){if(_0x302314[_0x398d('0x35')]){_0x5411c5=getRoot(_0x302314['production']);if(_0x5411c5&&_0x5411c5[_0x398d('0x36')]){logger[_0x398d('0x37')](_0x398d('0x38'),JSON[_0x398d('0x2f')](_0x5411c5,null,0x2));_0x1827be[_0x398d('0x39')]=moment()[_0x398d('0xf')](_0x398d('0x3a'));_0x6dac9f=initGraph(_['omit'](_0x5411c5,_0x398d('0x22')),_0x5411c5[_0x398d('0x22')]);_0x3807f0=new Vertices(_0x1827be,rpc,mailRpc);logger[_0x398d('0xe')](util[_0x398d('0xf')](_0x398d('0x3b'),_0x1827be[_0x398d('0x16')],_0x1827be[_0x398d('0x17')],_0x1827be[_0x398d('0x18')],_0x1827be['dnid'],_0x1827be[_0x398d('0x1a')]));_0x6dac9f[_0x398d('0x3c')](_0x5411c5[_0x398d('0x36')]['id'],function(_0x2d0a82){try{_0x2d0a82=_0x3807f0[_0x398d('0x3d')](_0x2d0a82);logger['debug'](_0x398d('0x3e'),JSON[_0x398d('0x2f')](_0x2d0a82,null,0x2));if(_0x2d0a82['agicommand']===_0x398d('0x3f')){logger[_0x398d('0xe')](_0x398d('0x40'));_0x1827be[_0x398d('0x41')]=_0x2d0a82[_0x398d('0x41')]||_0x1827be[_0x398d('0x41')];_0x1827be[_0x398d('0x42')]=_0x2d0a82[_0x398d('0x42')];_0x1827be[_0x398d('0x43')]=_0x2d0a82['priority']?_0x2d0a82[_0x398d('0x43')]-0x1:0x1;return null;}else if(_0x2d0a82&&_0x3807f0[_0x2d0a82[_0x398d('0x44')]]){_0x557f83=_0x3807f0[_0x2d0a82[_0x398d('0x44')]](_0x2d0a82);logger[_0x398d('0xe')](_0x398d('0x45'),JSON[_0x398d('0x2f')](_0x557f83,null,0x2));if(_0x557f83&&_0x557f83['code']===AGI_CODE_SUCCESS&&_0x557f83[_0x398d('0x46')]!==AGI_RESULT_ERROR&&!_0x1827be[_0x398d('0x1c')]){logger['debug'](_0x398d('0x45'),getLogFromObject(_0x557f83));return _[_0x398d('0x47')](_0x557f83[_0x398d('0x46')])?null:_0x557f83['result'][_0x398d('0x48')]();}else{logger[_0x398d('0x13')](_0x398d('0x45'),getLogFromObject(_0x557f83));return null;}}else{logger[_0x398d('0x13')](_0x398d('0x49'));return null;}}catch(_0x4a024a){logger[_0x398d('0x13')](_0x4a024a[_0x398d('0xa')]);return null;}});if(_0x5411c5[_0x398d('0x4a')]){logger['info'](util[_0x398d('0xf')](_0x398d('0x4b'),_0x1827be['arg_1'],_0x1827be[_0x398d('0x17')],_0x1827be[_0x398d('0x18')],_0x1827be[_0x398d('0x19')],_0x1827be[_0x398d('0x1a')]));_0x6dac9f[_0x398d('0x3c')](_0x5411c5[_0x398d('0x4a')]['id'],function(_0x4b60be){try{_0x4b60be=_0x3807f0[_0x398d('0x3d')](_0x4b60be);logger['debug'](_0x398d('0x3e'),JSON[_0x398d('0x2f')](_0x4b60be,null,0x2));if(_0x4b60be&&_0x3807f0[_0x4b60be['agicommand']]){_0x557f83=_0x3807f0[_0x4b60be['agicommand']](_0x4b60be);if(_0x557f83){logger[_0x398d('0x37')](_0x398d('0x45'),getLogFromObject(_0x557f83));return _[_0x398d('0x47')](_0x557f83[_0x398d('0x46')])?null:_0x557f83['result'][_0x398d('0x48')]();}else{logger['error'](_0x398d('0x45'),getLogFromObject(_0x557f83));return null;}}else{logger['error'](_0x398d('0x49'));return null;}}catch(_0x588548){logger['error'](_0x588548['stack']);return null;}});}logger[_0x398d('0xe')](util[_0x398d('0xf')](_0x398d('0x4c'),_0x1827be[_0x398d('0x16')],_0x1827be['calleridname'],_0x1827be['callerid'],_0x1827be[_0x398d('0x19')],_0x1827be[_0x398d('0x1a')]));logger[_0x398d('0xe')](util['format'](_0x398d('0x4d'),_0x1827be[_0x398d('0x41')],_0x1827be[_0x398d('0x42')],parseInt(_0x1827be[_0x398d('0x43')],0xa)+0x1));_0x1827be[_0x398d('0x4e')](_0x1827be[_0x398d('0x41')],_0x1827be['extension'],parseInt(_0x1827be[_0x398d('0x43')],0xa)+0x1);_0x1827be[_0x398d('0x31')]();}}else{logger[_0x398d('0x13')](util[_0x398d('0xf')]('Project\x20%s\x20not\x20published',_0x1827be[_0x398d('0x16')]));_0x1827be[_0x398d('0x4e')](_0x1827be[_0x398d('0x41')],_0x1827be[_0x398d('0x42')],parseInt(_0x1827be['priority'],0xa)+0x1);_0x1827be['close']();}}else{logger[_0x398d('0x13')](util['format'](_0x398d('0x4f'),_0x1827be[_0x398d('0x16')]));_0x1827be['continueAt'](_0x1827be[_0x398d('0x41')],_0x1827be['extension'],parseInt(_0x1827be[_0x398d('0x43')],0xa)+0x1);_0x1827be[_0x398d('0x31')]();}}function main(){var _0x35a73c;return utilLicense[_0x398d('0x50')]()[_0x398d('0x28')](function(_0x3aed8b){if(_0x3aed8b){if(_0x3aed8b[_0x398d('0x51')]){if(_0x3aed8b[_0x398d('0x52')]&&_0x3aed8b[_0x398d('0x52')]>0x0){logger[_0x398d('0xe')](util[_0x398d('0xf')](_0x398d('0x53'),_0x3aed8b[_0x398d('0x52')]));_0x35a73c=_0x3aed8b[_0x398d('0x52')];}else{logger[_0x398d('0xe')](_0x398d('0x54'));}}else{logger[_0x398d('0xe')](_0x398d('0x55'));_0x35a73c=-0x1;}}})[_0x398d('0x56')](function(_0xb25709){logger[_0x398d('0x13')](_0x398d('0x57'),_0xb25709['stack']);})[_0x398d('0x4a')](function(){var _0x26d6f8=require(_0x398d('0x58'))(config[_0x398d('0x4')][_0x398d('0xd')],config[_0x398d('0x4')]['ip'],_0x35a73c);_0x26d6f8['on'](_0x398d('0x13'),errorHandler);_0x26d6f8['on'](_0x398d('0x59'),listeningHandler);_0x26d6f8['on'](_0x398d('0x5a'),connectionHandler);_0x26d6f8['on'](_0x398d('0x31'),closeHandler);});}main(); \ No newline at end of file +var _0xcb99=['addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','getSquareProject','catch','createSquareReport','indexOf','agi_','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','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','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]','./server','listening','connection','xml2json','syncho','../../config/environment','../../config/logger','agi','./rpc','./mailRpc','./vertices','defaults','127.0.0.1','nextTick','error','stack','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','format','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry'];(function(_0x179a44,_0x559b80){var _0xcb3b65=function(_0x21b40f){while(--_0x21b40f){_0x179a44['push'](_0x179a44['shift']());}};_0xcb3b65(++_0x559b80);}(_0xcb99,0x8b));var _0x9cb9=function(_0xce44ee,_0x387d70){_0xce44ee=_0xce44ee-0x0;var _0xf97a49=_0xcb99[_0xce44ee];return _0xf97a49;};'use strict';var parser=require(_0x9cb9('0x0'));var _=require('lodash');var syncho=require(_0x9cb9('0x1'));var util=require('util');var moment=require('moment');var config=require(_0x9cb9('0x2'));var logger=require(_0x9cb9('0x3'))(_0x9cb9('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x9cb9('0x5'));var mailRpc=require(_0x9cb9('0x6'));var Graph=require('./graph');var Vertices=require(_0x9cb9('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x9cb9('0x8')](config[_0x9cb9('0x4')],{'ip':_0x9cb9('0x9'),'port':0x11dd});function connectionHandler(_0x1dd62f){process[_0x9cb9('0xa')](function(){syncho(function(){try{setChannelVariables(_0x1dd62f);agiHandler(_0x1dd62f);}catch(_0x124bd0){logger[_0x9cb9('0xb')](_0x124bd0[_0x9cb9('0xc')]);}});});}function listeningHandler(){console['log']('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9cb9('0x4')][_0x9cb9('0xd')]);logger[_0x9cb9('0xe')](util['format'](_0x9cb9('0xf'),config[_0x9cb9('0x4')]['ip'],config['agi']['port']));}function errorHandler(_0x227d49){if(_0x227d49&&_0x227d49[_0x9cb9('0x10')]&&_0x227d49[_0x9cb9('0x11')]){logger[_0x9cb9('0xb')](util['format'](_0x9cb9('0x12'),_0x227d49[_0x9cb9('0x10')],_0x227d49[_0x9cb9('0x11')]));}else{logger[_0x9cb9('0xb')](util[_0x9cb9('0x13')](_0x9cb9('0x14'),_0x227d49[_0x9cb9('0xc')]));}}function closeHandler(){logger[_0x9cb9('0xe')](util[_0x9cb9('0x13')](_0x9cb9('0x15'),this[_0x9cb9('0x16')],this[_0x9cb9('0x17')],this[_0x9cb9('0x18')],this[_0x9cb9('0x19')],this[_0x9cb9('0x1a')]));try{createSquareReport(this);}catch(_0x4244b3){logger[_0x9cb9('0xb')](_0x4244b3[_0x9cb9('0xc')]);}}function timeoutHandler(){logger['info'](util['format'](_0x9cb9('0x1b'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x9cb9('0x19')],this['uniqueid']));}function hangupHandler(){logger[_0x9cb9('0xe')](util[_0x9cb9('0x13')](_0x9cb9('0x1c'),this[_0x9cb9('0x16')],this[_0x9cb9('0x17')],this[_0x9cb9('0x18')],this[_0x9cb9('0x19')],this[_0x9cb9('0x1a')]));this[_0x9cb9('0x1d')]=!![];}function getRoot(_0x169948){return parser[_0x9cb9('0x1e')](_0x169948,{'object':!![]})[_0x9cb9('0x1f')][_0x9cb9('0x20')];}function addVertex(_0x1a464f,_0x4cc235,_0x57fc41){_0x4cc235[_0x9cb9('0x21')]=_0x57fc41;if(_0x4cc235[_0x9cb9('0x22')](_0x9cb9('0x23'))){_0x4cc235[_0x9cb9('0x24')]=parseInt(_0x4cc235[_0x9cb9('0x23')],0xa);}_0x1a464f[_0x9cb9('0x25')](_[_0x9cb9('0x26')](_0x4cc235,_0x9cb9('0x27')));}function initGraph(_0x10d09a,_0x4e036a){var _0x1f42b3=new Graph();for(var _0x2d32ee in _0x10d09a){if(_0x10d09a[_0x9cb9('0x22')](_0x2d32ee)){if(_[_0x9cb9('0x28')](_0x10d09a[_0x2d32ee])){for(var _0x4db8a4=0x0;_0x4db8a4<_0x10d09a[_0x2d32ee][_0x9cb9('0x29')];_0x4db8a4+=0x1){addVertex(_0x1f42b3,_0x10d09a[_0x2d32ee][_0x4db8a4],_0x2d32ee);}}else{addVertex(_0x1f42b3,_0x10d09a[_0x2d32ee],_0x2d32ee);}}}for(var _0x567e9b=0x0;_0x567e9b<_0x4e036a[_0x9cb9('0x29')];_0x567e9b+=0x1){if(_0x4e036a[_0x567e9b][_0x9cb9('0x2a')]&&_0x4e036a[_0x567e9b][_0x9cb9('0x2b')]){_0x1f42b3[_0x9cb9('0x2c')](_0x4e036a[_0x567e9b]['source'],_0x4e036a[_0x567e9b][_0x9cb9('0x2b')],_0x4e036a[_0x567e9b][_0x9cb9('0x2d')]);}}return _0x1f42b3;}function getSquareProject(_0x39f9dd,_0x53ad7b){rpc[_0x9cb9('0x2e')](_0x39f9dd)['then'](function(_0x45fab7){_0x53ad7b(null,_0x45fab7);})[_0x9cb9('0x2f')](function(_0x146fe7){_0x53ad7b(null,_0x146fe7);});}function createSquareReport(_0x2ed362,_0x22ed67){rpc[_0x9cb9('0x30')](_0x2ed362)['then'](function(_0x164074){if(_0x22ed67){_0x22ed67(null,_0x164074);}})[_0x9cb9('0x2f')](function(_0x123ada){if(_0x22ed67){_0x22ed67(null,_0x123ada);}});}function setChannelVariables(_0x547ee8){for(var _0x5f3aac in _0x547ee8){if(_0x547ee8[_0x9cb9('0x22')](_0x5f3aac)){if(_0x5f3aac[_0x9cb9('0x31')](_0x9cb9('0x32'))===0x0){_0x547ee8[_0x5f3aac['substring'](0x4)]=_0x547ee8[_0x5f3aac];delete _0x547ee8[_0x5f3aac];}}}}function getLogFromObject(_0x4a913b){return util[_0x9cb9('0x33')](_0x4a913b,{'showHidden':![],'depth':null});}function agiHandler(_0x395dae){var _0x59a521,_0x39156f,_0x1a4cb5,_0x8a17d1,_0x354c0f;logger[_0x9cb9('0x34')]('variables',JSON[_0x9cb9('0x35')](_0x395dae,null,0x2));logger[_0x9cb9('0xe')](util['format'](_0x9cb9('0x36'),_0x395dae['arg_1'],_0x395dae[_0x9cb9('0x17')],_0x395dae[_0x9cb9('0x18')],_0x395dae['dnid'],_0x395dae['uniqueid']));_0x395dae['on'](_0x9cb9('0xb'),errorHandler);_0x395dae['on'](_0x9cb9('0x37'),closeHandler);_0x395dae['on'](_0x9cb9('0x38'),timeoutHandler);_0x395dae[_0x9cb9('0x1d')]=![];_0x395dae['on'](_0x9cb9('0x39'),hangupHandler);var _0x2dd463=getSquareProject[_0x9cb9('0x3a')](null,_0x395dae['arg_1']);if(_0x2dd463){if(_0x2dd463[_0x9cb9('0x3b')]){_0x59a521=getRoot(_0x2dd463[_0x9cb9('0x3b')]);if(_0x59a521&&_0x59a521[_0x9cb9('0x3c')]){logger[_0x9cb9('0x34')](_0x9cb9('0x20'),JSON[_0x9cb9('0x35')](_0x59a521,null,0x2));_0x395dae['joinAt']=moment()[_0x9cb9('0x13')](_0x9cb9('0x3d'));_0x39156f=initGraph(_[_0x9cb9('0x26')](_0x59a521,_0x9cb9('0x27')),_0x59a521[_0x9cb9('0x27')]);_0x1a4cb5=new Vertices(_0x395dae,rpc,mailRpc);logger[_0x9cb9('0xe')](util[_0x9cb9('0x13')](_0x9cb9('0x3e'),_0x395dae[_0x9cb9('0x16')],_0x395dae['calleridname'],_0x395dae[_0x9cb9('0x18')],_0x395dae['dnid'],_0x395dae[_0x9cb9('0x1a')]));_0x39156f['traverseBFS'](_0x59a521[_0x9cb9('0x3c')]['id'],function(_0x2f8c06){try{_0x2f8c06=_0x1a4cb5[_0x9cb9('0x3f')](_0x2f8c06);logger[_0x9cb9('0x34')]('vertex',JSON[_0x9cb9('0x35')](_0x2f8c06,null,0x2));if(_0x2f8c06['agicommand']===_0x9cb9('0x40')){logger[_0x9cb9('0xe')](_0x9cb9('0x41'));_0x395dae[_0x9cb9('0x42')]=_0x2f8c06[_0x9cb9('0x42')]||_0x395dae['context'];_0x395dae[_0x9cb9('0x43')]=_0x2f8c06[_0x9cb9('0x43')];_0x395dae[_0x9cb9('0x44')]=_0x2f8c06[_0x9cb9('0x44')]?_0x2f8c06[_0x9cb9('0x44')]-0x1:0x1;return null;}else if(_0x2f8c06&&_0x1a4cb5[_0x2f8c06[_0x9cb9('0x21')]]){_0x354c0f=_0x1a4cb5[_0x2f8c06[_0x9cb9('0x21')]](_0x2f8c06);logger[_0x9cb9('0xe')](_0x9cb9('0x45'),JSON['stringify'](_0x354c0f,null,0x2));if(_0x354c0f&&_0x354c0f[_0x9cb9('0x46')]===AGI_CODE_SUCCESS&&_0x354c0f[_0x9cb9('0x47')]!==AGI_RESULT_ERROR&&!_0x395dae[_0x9cb9('0x1d')]){logger[_0x9cb9('0x34')](_0x9cb9('0x45'),getLogFromObject(_0x354c0f));return _['isUndefined'](_0x354c0f[_0x9cb9('0x47')])?null:_0x354c0f[_0x9cb9('0x47')][_0x9cb9('0x48')]();}else{logger['error'](_0x9cb9('0x45'),getLogFromObject(_0x354c0f));return null;}}else{logger[_0x9cb9('0xb')](_0x9cb9('0x49'));return null;}}catch(_0x4a6dc9){logger[_0x9cb9('0xb')](_0x4a6dc9[_0x9cb9('0xc')]);return null;}});if(_0x59a521[_0x9cb9('0x4a')]){logger[_0x9cb9('0xe')](util[_0x9cb9('0x13')](_0x9cb9('0x4b'),_0x395dae['arg_1'],_0x395dae[_0x9cb9('0x17')],_0x395dae[_0x9cb9('0x18')],_0x395dae[_0x9cb9('0x19')],_0x395dae[_0x9cb9('0x1a')]));_0x39156f[_0x9cb9('0x4c')](_0x59a521[_0x9cb9('0x4a')]['id'],function(_0x1799fd){try{_0x1799fd=_0x1a4cb5[_0x9cb9('0x3f')](_0x1799fd);logger[_0x9cb9('0x34')](_0x9cb9('0x4d'),JSON[_0x9cb9('0x35')](_0x1799fd,null,0x2));if(_0x1799fd&&_0x1a4cb5[_0x1799fd[_0x9cb9('0x21')]]){_0x354c0f=_0x1a4cb5[_0x1799fd[_0x9cb9('0x21')]](_0x1799fd);if(_0x354c0f){logger['debug'](_0x9cb9('0x45'),getLogFromObject(_0x354c0f));return _['isUndefined'](_0x354c0f[_0x9cb9('0x47')])?null:_0x354c0f[_0x9cb9('0x47')][_0x9cb9('0x48')]();}else{logger['error'](_0x9cb9('0x45'),getLogFromObject(_0x354c0f));return null;}}else{logger[_0x9cb9('0xb')](_0x9cb9('0x49'));return null;}}catch(_0x9da13e){logger['error'](_0x9da13e['stack']);return null;}});}logger['info'](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x395dae['arg_1'],_0x395dae[_0x9cb9('0x17')],_0x395dae[_0x9cb9('0x18')],_0x395dae[_0x9cb9('0x19')],_0x395dae['uniqueid']));logger[_0x9cb9('0xe')](util[_0x9cb9('0x13')](_0x9cb9('0x4e'),_0x395dae[_0x9cb9('0x42')],_0x395dae[_0x9cb9('0x43')],parseInt(_0x395dae[_0x9cb9('0x44')],0xa)+0x1));_0x395dae[_0x9cb9('0x4f')](_0x395dae[_0x9cb9('0x42')],_0x395dae['extension'],parseInt(_0x395dae[_0x9cb9('0x44')],0xa)+0x1);_0x395dae['close']();}}else{logger[_0x9cb9('0xb')](util[_0x9cb9('0x13')](_0x9cb9('0x50'),_0x395dae[_0x9cb9('0x16')]));_0x395dae['continueAt'](_0x395dae['context'],_0x395dae[_0x9cb9('0x43')],parseInt(_0x395dae[_0x9cb9('0x44')],0xa)+0x1);_0x395dae[_0x9cb9('0x37')]();}}else{logger['error'](util[_0x9cb9('0x13')]('Project\x20%s\x20not\x20found',_0x395dae[_0x9cb9('0x16')]));_0x395dae[_0x9cb9('0x4f')](_0x395dae[_0x9cb9('0x42')],_0x395dae[_0x9cb9('0x43')],parseInt(_0x395dae['priority'],0xa)+0x1);_0x395dae[_0x9cb9('0x37')]();}}function main(){var _0x3ce2dd;return utilLicense['getLicense']()['then'](function(_0x50b115){if(_0x50b115){if(_0x50b115[_0x9cb9('0x51')]){if(_0x50b115[_0x9cb9('0x52')]&&_0x50b115['callysquare']>0x0){logger['info'](util[_0x9cb9('0x13')](_0x9cb9('0x53'),_0x50b115[_0x9cb9('0x52')]));_0x3ce2dd=_0x50b115[_0x9cb9('0x52')];}else{logger[_0x9cb9('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x9cb9('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3ce2dd=-0x1;}}})['catch'](function(_0x32e651){logger[_0x9cb9('0xb')](_0x9cb9('0x54'),_0x32e651['stack']);})[_0x9cb9('0x4a')](function(){var _0x17a1d5=require(_0x9cb9('0x55'))(config[_0x9cb9('0x4')][_0x9cb9('0xd')],config[_0x9cb9('0x4')]['ip'],_0x3ce2dd);_0x17a1d5['on'](_0x9cb9('0xb'),errorHandler);_0x17a1d5['on'](_0x9cb9('0x56'),listeningHandler);_0x17a1d5['on'](_0x9cb9('0x57'),connectionHandler);_0x17a1d5['on'](_0x9cb9('0x37'),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 b388879..8008f25 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 _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0xd64445,_0x585baf){var _0x4fa15f=function(_0x3fef75){while(--_0x3fef75){_0xd64445['push'](_0xd64445['shift']());}};_0x4fa15f(++_0x585baf);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x46442f,_0x1f57f7){var _0x16db50=function(_0x4c2f2e){while(--_0x4c2f2e){_0x46442f['push'](_0x46442f['shift']());}};_0x16db50(++_0x1f57f7);}(_0x814b,0x1a2));var _0xb814=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0x814b[_0x2bc1fe];return _0x1a47a5;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 21e0664..8714e9b 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x1f5974,_0x11540c){var _0x5cb353=function(_0x24a523){while(--_0x24a523){_0x1f5974['push'](_0x1f5974['shift']());}};_0x5cb353(++_0x11540c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x160178,_0x17b211){_0x160178=_0x160178-0x0;var _0x9d42b6=_0x5f2f[_0x160178];return _0x9d42b6;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x4927dc,_0x54b3f6){var _0x45e1c3=function(_0x45f4f7){while(--_0x45f4f7){_0x4927dc['push'](_0x4927dc['shift']());}};_0x45e1c3(++_0x54b3f6);}(_0xb10b,0x12a));var _0xbb10=function(_0x485e0b,_0x5eb3e3){_0x485e0b=_0x485e0b-0x0;var _0x12283c=_0xb10b[_0x485e0b];return _0x12283c;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('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 d45e5cb..c4a1b45 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 _0x2be0=['message','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','name','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','http','request','then','error'];(function(_0xb68772,_0x5253ac){var _0x4189bb=function(_0x1b0cf3){while(--_0x1b0cf3){_0xb68772['push'](_0xb68772['shift']());}};_0x4189bb(++_0x5253ac);}(_0x2be0,0x128));var _0x02be=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x2be0[_0x2dea24];return _0x309d58;};'use strict';var BPromise=require(_0x02be('0x0'));var moment=require(_0x02be('0x1'));var _=require(_0x02be('0x2'));var util=require(_0x02be('0x3'));var jayson=require(_0x02be('0x4'));var client=jayson['client'][_0x02be('0x5')]({'port':0x2329});function request(_0x1d55b1,_0xb18781){return new BPromise(function(_0x5e05a0,_0x4723fa){return client[_0x02be('0x6')](_0x1d55b1,_0xb18781)[_0x02be('0x7')](function(_0x184bf6){if(_0x184bf6['error']){return _0x4723fa(_0x184bf6[_0x02be('0x8')][_0x02be('0x9')]);}else{return _0x5e05a0(_0x184bf6[_0x02be('0xa')]);}})[_0x02be('0xb')](function(_0xf9803){return _0x4723fa(_0xf9803);});});}exports[_0x02be('0xc')]=function(_0x3e701d){return request(_0x02be('0xd'),{'options':{'raw':![],'where':{'name':_0x3e701d},'attributes':[_0x02be('0xe')]}});};exports[_0x02be('0xf')]=function(_0x27c9a6){return request(_0x02be('0x10'),{'options':{'raw':![],'where':{'id':_0x27c9a6},'include':[{'model':_0x02be('0x11'),'as':_0x02be('0x12')}],'attributes':['id','name',_0x02be('0x13')]}});};exports[_0x02be('0x14')]=function(_0x16aa5d){return request(_0x02be('0xd'),{'options':{'where':{'id':_0x16aa5d},'attributes':['name']}});};exports[_0x02be('0x15')]=function(_0x519b91){return request(_0x02be('0x16'),{'options':{'where':{'id':_0x519b91},'attributes':[_0x02be('0x17')]}});};exports[_0x02be('0x18')]=function(_0x3179b3){return request(_0x02be('0x19'),{'options':{'where':{'id':_0x3179b3},'attributes':[_0x02be('0x17')]}});};exports[_0x02be('0x1a')]=function(_0x2fa179){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x2fa179},'attributes':[_0x02be('0x1b')]}});};exports[_0x02be('0x1c')]=function(_0x5ed522){return request('ShowUser',{'options':{'where':{'id':_0x5ed522},'attributes':[_0x02be('0x17')]}});};exports['getTrunkById']=function(_0x578d38){return request(_0x02be('0x1d'),{'options':{'where':{'id':_0x578d38},'attributes':['name']}});};exports[_0x02be('0x1e')]=function(_0x1eadc5){return request(_0x02be('0x1f'),{'options':{'where':{'id':_0x1eadc5},'attributes':[_0x02be('0x20')]}});};exports[_0x02be('0x21')]=function(_0x100e73){return request(_0x02be('0x22'),{'options':{'raw':![],'where':{'id':_0x100e73},'include':[{'model':'Interval','as':_0x02be('0x23')}]}});};exports[_0x02be('0x24')]=function(_0x7cbdae){return request(_0x02be('0x25'),{'options':{'where':{'id':_0x7cbdae},'attributes':['id',_0x02be('0x17')]}});};exports[_0x02be('0x26')]=function(_0x114b79){return request(_0x02be('0x27'),{'body':_0x114b79});};exports[_0x02be('0x28')]=function(_0x26a8ec){return request(_0x02be('0x29'),{'body':_0x26a8ec});};exports['createSquareReport']=function(_0x2a25a7){return request('CreateSquareReport',{'body':_[_0x02be('0x2a')](_0x2a25a7,{'project_name':_0x2a25a7[_0x02be('0x2b')],'prev_project_name':_0x2a25a7[_0x02be('0x2c')]||'','is_subproject':_0x2a25a7[_0x02be('0x2c')]?!![]:![],'leaveAt':moment()[_0x02be('0x2d')](_0x02be('0x2e'))})});};exports['createSquareRecording']=function(_0x39016d){return request(_0x02be('0x2f'),{'body':_0x39016d});};exports['createSquareMessage']=function(_0x4a1bcb){return request(_0x02be('0x30'),{'body':_0x4a1bcb});};exports[_0x02be('0x31')]=function(_0x283cd0){return request(_0x02be('0x32'),{'options':{'raw':![],'where':{'phone':_0x283cd0[_0x02be('0x33')],'ListId':_0x283cd0['ListId']}}})[_0x02be('0x7')](function(_0x9d8baa){if(_0x9d8baa){return _0x9d8baa;}return request(_0x02be('0x34'),{'body':_0x283cd0});});};exports[_0x02be('0x35')]=function(_0x3a59e0){return request(_0x02be('0x36'),{'options':{'where':{'id':_0x3a59e0},'attributes':[_0x02be('0x17')]}});};exports[_0x02be('0x37')]=function(_0x3a7e53,_0x59a04d){return request(_0x02be('0x38'),{'body':{'interface':_0x59a04d},'options':{'where':_0x3a7e53}});};exports[_0x02be('0x39')]=function(_0x503e68,_0x261655,_0x5117ed){return request(_0x02be('0x3a'),{'body':{'type':_0x261655,'uniqueid':_0x5117ed},'options':{'where':_0x503e68}});};exports['agentUnpause']=function(_0x4841eb){return request(_0x02be('0x3b'),{'body':{},'options':{'where':_0x4841eb}});};exports['agentLogout']=function(_0x5f4122){return request(_0x02be('0x3c'),{'body':{},'options':{'where':_0x5f4122}});}; \ No newline at end of file +var _0x7887=['ShowMailAccount','MailServerOut','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','util','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject'];(function(_0x3a7d09,_0x75f92f){var _0x2a4163=function(_0x47217e){while(--_0x47217e){_0x3a7d09['push'](_0x3a7d09['shift']());}};_0x2a4163(++_0x75f92f);}(_0x7887,0x1b3));var _0x7788=function(_0x209b4c,_0x46897b){_0x209b4c=_0x209b4c-0x0;var _0x3d06a7=_0x7887[_0x209b4c];return _0x3d06a7;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x7788('0x0'));var util=require(_0x7788('0x1'));var jayson=require(_0x7788('0x2'));var client=jayson[_0x7788('0x3')][_0x7788('0x4')]({'port':0x2329});function request(_0x16c799,_0x4ef5c6){return new BPromise(function(_0x210be8,_0x4abd89){return client[_0x7788('0x5')](_0x16c799,_0x4ef5c6)[_0x7788('0x6')](function(_0x4a4160){if(_0x4a4160[_0x7788('0x7')]){return _0x4abd89(_0x4a4160[_0x7788('0x7')][_0x7788('0x8')]);}else{return _0x210be8(_0x4a4160[_0x7788('0x9')]);}})[_0x7788('0xa')](function(_0x3a8ede){return _0x4abd89(_0x3a8ede);});});}exports[_0x7788('0xb')]=function(_0x2a27db){return request(_0x7788('0xc'),{'options':{'raw':![],'where':{'name':_0x2a27db},'attributes':['production']}});};exports['getMailAccountById']=function(_0x43cb9e){return request(_0x7788('0xd'),{'options':{'raw':![],'where':{'id':_0x43cb9e},'include':[{'model':_0x7788('0xe'),'as':_0x7788('0xf')}],'attributes':['id',_0x7788('0x10'),_0x7788('0x11')]}});};exports['getSquareProjectById']=function(_0x1bf1d4){return request(_0x7788('0xc'),{'options':{'where':{'id':_0x1bf1d4},'attributes':[_0x7788('0x10')]}});};exports[_0x7788('0x12')]=function(_0x3a0570){return request(_0x7788('0x13'),{'options':{'where':{'id':_0x3a0570},'attributes':[_0x7788('0x10')]}});};exports['getVariableById']=function(_0x192b66){return request(_0x7788('0x14'),{'options':{'where':{'id':_0x192b66},'attributes':[_0x7788('0x10')]}});};exports['getSquareOdbcById']=function(_0x32fea6){return request(_0x7788('0x15'),{'options':{'where':{'id':_0x32fea6},'attributes':[_0x7788('0x16')]}});};exports[_0x7788('0x17')]=function(_0x2f2c3f){return request(_0x7788('0x18'),{'options':{'where':{'id':_0x2f2c3f},'attributes':[_0x7788('0x10')]}});};exports[_0x7788('0x19')]=function(_0x20b59b){return request(_0x7788('0x1a'),{'options':{'where':{'id':_0x20b59b},'attributes':[_0x7788('0x10')]}});};exports[_0x7788('0x1b')]=function(_0x31d00c){return request(_0x7788('0x1c'),{'options':{'where':{'id':_0x31d00c},'attributes':['save_name']}});};exports[_0x7788('0x1d')]=function(_0x4abd68){return request(_0x7788('0x1e'),{'options':{'raw':![],'where':{'id':_0x4abd68},'include':[{'model':_0x7788('0x1f'),'as':_0x7788('0x20')}]}});};exports['getSmsAccountById']=function(_0x5ea7cc){return request(_0x7788('0x21'),{'options':{'where':{'id':_0x5ea7cc},'attributes':['id',_0x7788('0x10')]}});};exports[_0x7788('0x22')]=function(_0xeed0e9){return request('CreateSmsMessage',{'body':_0xeed0e9});};exports[_0x7788('0x23')]=function(_0x34483c){return request(_0x7788('0x24'),{'body':_0x34483c});};exports[_0x7788('0x25')]=function(_0x289c23){return request(_0x7788('0x26'),{'body':_[_0x7788('0x27')](_0x289c23,{'project_name':_0x289c23[_0x7788('0x28')],'prev_project_name':_0x289c23['arg_2']||'','is_subproject':_0x289c23[_0x7788('0x29')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x7788('0x2a')]=function(_0x669a8d){return request('CreateSquareRecording',{'body':_0x669a8d});};exports[_0x7788('0x2b')]=function(_0x10e039){return request(_0x7788('0x2c'),{'body':_0x10e039});};exports[_0x7788('0x2d')]=function(_0x4aa7d1){return request(_0x7788('0x2e'),{'options':{'raw':![],'where':{'phone':_0x4aa7d1[_0x7788('0x2f')],'ListId':_0x4aa7d1['ListId']}}})[_0x7788('0x6')](function(_0x9d80f5){if(_0x9d80f5){return _0x9d80f5;}return request('CreateCmContact',{'body':_0x4aa7d1});});};exports[_0x7788('0x30')]=function(_0xa1a5fa){return request(_0x7788('0x31'),{'options':{'where':{'id':_0xa1a5fa},'attributes':[_0x7788('0x10')]}});};exports[_0x7788('0x32')]=function(_0x3621f3,_0x3abb10){return request(_0x7788('0x33'),{'body':{'interface':_0x3abb10},'options':{'where':_0x3621f3}});};exports['agentPause']=function(_0x573ae6,_0x5b597d,_0x36c11f){return request(_0x7788('0x34'),{'body':{'type':_0x5b597d,'uniqueid':_0x36c11f},'options':{'where':_0x573ae6}});};exports[_0x7788('0x35')]=function(_0x302a48){return request('UnpauseUser',{'body':{},'options':{'where':_0x302a48}});};exports[_0x7788('0x36')]=function(_0xcb178b){return request(_0x7788('0x37'),{'body':{},'options':{'where':_0xcb178b}});}; \ 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 1e59eb0..d2465e2 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 _0xa37e=['exports'];(function(_0x45275b,_0x3de843){var _0x1a169f=function(_0x22ef6c){while(--_0x22ef6c){_0x45275b['push'](_0x45275b['shift']());}};_0x1a169f(++_0x3de843);}(_0xa37e,0x97));var _0xea37=function(_0x54be22,_0x414bbb){_0x54be22=_0x54be22-0x0;var _0x323eb9=_0xa37e[_0x54be22];return _0x323eb9;};var polly=require('./polly');var lex=require('./lex');module[_0xea37('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x5db8=['exports','./polly','./lex'];(function(_0x8186b1,_0x27ed54){var _0x176006=function(_0x6181f7){while(--_0x6181f7){_0x8186b1['push'](_0x8186b1['shift']());}};_0x176006(++_0x27ed54);}(_0x5db8,0xbb));var _0x85db=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0x5db8[_0x1dd532];return _0x3732aa;};var polly=require(_0x85db('0x0'));var lex=require(_0x85db('0x1'));module[_0x85db('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 66bfc19..a2f7b2d 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 _0xa5ca=['exports','./lib/api'];(function(_0x2ceedb,_0x3d4af3){var _0x1eef5c=function(_0xee38c1){while(--_0xee38c1){_0x2ceedb['push'](_0x2ceedb['shift']());}};_0x1eef5c(++_0x3d4af3);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x271060,_0x3f86b1){_0x271060=_0x271060-0x0;var _0x40540b=_0xa5ca[_0x271060];return _0x40540b;};'use strict';var lex=require(_0xaa5c('0x0'));module[_0xaa5c('0x1')]=function(_0x3d7bfc,_0x50cffe,_0x547df0,_0x2b5bb2,_0x410764,_0x2757fe){return lex(_0x3d7bfc,_0x50cffe,_0x547df0,_0x2b5bb2,_0x410764,_0x2757fe);}; \ No newline at end of file +var _0x2e35=['./lib/api','exports'];(function(_0x6985a8,_0x5c5b0c){var _0x3158c4=function(_0x283e0d){while(--_0x283e0d){_0x6985a8['push'](_0x6985a8['shift']());}};_0x3158c4(++_0x5c5b0c);}(_0x2e35,0x1d0));var _0x52e3=function(_0x5f3f6c,_0x3e164a){_0x5f3f6c=_0x5f3f6c-0x0;var _0x8b8f0=_0x2e35[_0x5f3f6c];return _0x8b8f0;};'use strict';var lex=require(_0x52e3('0x0'));module[_0x52e3('0x1')]=function(_0x1dc2a2,_0x5b86c0,_0x145ad0,_0xcbe6c5,_0x16d807,_0x3dc244){return lex(_0x1dc2a2,_0x5b86c0,_0x145ad0,_0xcbe6c5,_0x16d807,_0x3dc244);}; \ 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 8762039..9effa3d 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 _0xa168=['exports','LexRuntime','$LATEST','aws-sdk','postText','slots','hasOwnProperty','slot_'];(function(_0x1e3977,_0x667490){var _0x2dbaa4=function(_0x41589c){while(--_0x41589c){_0x1e3977['push'](_0x1e3977['shift']());}};_0x2dbaa4(++_0x667490);}(_0xa168,0xf3));var _0x8a16=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xa168[_0x349367];return _0x14179b;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x8a16('0x0'));function lexResult(_0x36ee42,_0xff5863){return new BPromise(function(_0x2fe577,_0x2390cd){_0x36ee42[_0x8a16('0x1')](_0xff5863,function(_0x451908,_0x296bda){if(_0x451908){_0x2390cd(_0x451908);}if(_0x296bda[_0x8a16('0x2')]){for(const _0x2a2a46 in _0x296bda[_0x8a16('0x2')]){if(_0x296bda[_0x8a16('0x2')][_0x8a16('0x3')](_0x2a2a46)){var _0x27339c=_0x296bda['slots'][_0x2a2a46];_0x296bda[_0x8a16('0x4')+_0x2a2a46]=_0x27339c;}}}_0x2fe577(_0x296bda);});});}module[_0x8a16('0x5')]=function(_0x29c129,_0x453a7e,_0x1a3944,_0x21ae85,_0xca412b,_0x5606c8){var _0xa4f737=new AWS[(_0x8a16('0x6'))]({'accessKeyId':_0x453a7e,'secretAccessKey':_0x1a3944,'region':_0x21ae85});var _0x37f191={'botAlias':_0x8a16('0x7'),'botName':_0x5606c8,'inputText':_0xca412b,'userId':_0x29c129};return lexResult(_0xa4f737,_0x37f191);}; \ No newline at end of file +var _0xe95d=['exports','$LATEST','bluebird','aws-sdk','slots','hasOwnProperty','slot_'];(function(_0x4b7253,_0x40f708){var _0x29f09a=function(_0x18d91c){while(--_0x18d91c){_0x4b7253['push'](_0x4b7253['shift']());}};_0x29f09a(++_0x40f708);}(_0xe95d,0x10c));var _0xde95=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0xe95d[_0x3c7d53];return _0x2c8387;};'use strict';var BPromise=require(_0xde95('0x0'));var AWS=require(_0xde95('0x1'));function lexResult(_0x252f8d,_0x58bd10){return new BPromise(function(_0x5ec1f5,_0x58f3e5){_0x252f8d['postText'](_0x58bd10,function(_0x5231df,_0x2fbf9d){if(_0x5231df){_0x58f3e5(_0x5231df);}if(_0x2fbf9d['slots']){for(const _0x324b01 in _0x2fbf9d[_0xde95('0x2')]){if(_0x2fbf9d[_0xde95('0x2')][_0xde95('0x3')](_0x324b01)){var _0x3da40c=_0x2fbf9d[_0xde95('0x2')][_0x324b01];_0x2fbf9d[_0xde95('0x4')+_0x324b01]=_0x3da40c;}}}_0x5ec1f5(_0x2fbf9d);});});}module[_0xde95('0x5')]=function(_0x329a76,_0x3873d6,_0x2811ed,_0x13cbd2,_0x4bc954,_0x49cf63){var _0x3dd728=new AWS['LexRuntime']({'accessKeyId':_0x3873d6,'secretAccessKey':_0x2811ed,'region':_0x13cbd2});var _0xd62d5d={'botAlias':_0xde95('0x6'),'botName':_0x49cf63,'inputText':_0x4bc954,'userId':_0x329a76};return lexResult(_0x3dd728,_0xd62d5d);}; \ 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 8856301..28784c1 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 _0xffed=['./lib/api','exports'];(function(_0x95942,_0x85da80){var _0x6d7f81=function(_0x510549){while(--_0x510549){_0x95942['push'](_0x95942['shift']());}};_0x6d7f81(++_0x85da80);}(_0xffed,0x1ee));var _0xdffe=function(_0x4418bf,_0x26e1d8){_0x4418bf=_0x4418bf-0x0;var _0x2dce26=_0xffed[_0x4418bf];return _0x2dce26;};'use strict';var polly=require(_0xdffe('0x0'));module[_0xdffe('0x1')]=function(_0x46fc96,_0x2545d9,_0x5c7443,_0x205e77,_0x3d0721,_0x380d83,_0xcc9097){return polly(_0x46fc96,_0x2545d9,_0x5c7443,_0x205e77,_0x3d0721,_0x380d83,_0xcc9097);}; \ No newline at end of file +var _0x46ba=['exports','./lib/api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x46ba,0x19b));var _0xa46b=function(_0x300c63,_0x45e59b){_0x300c63=_0x300c63-0x0;var _0x259373=_0x46ba[_0x300c63];return _0x259373;};'use strict';var polly=require(_0xa46b('0x0'));module[_0xa46b('0x1')]=function(_0x21458e,_0x3cdc21,_0x14deaf,_0x4780af,_0x1d97eb,_0x21ea04,_0x771829){return polly(_0x21458e,_0x3cdc21,_0x14deaf,_0x4780af,_0x1d97eb,_0x21ea04,_0x771829);}; \ 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 825c319..fcc1a1d 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 _0xda73=['Polly','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0xcb82d4,_0x2740a7){var _0x5e2491=function(_0x195e6a){while(--_0x195e6a){_0xcb82d4['push'](_0xcb82d4['shift']());}};_0x5e2491(++_0x2740a7);}(_0xda73,0x162));var _0x3da7=function(_0x2d36cb,_0x47ed76){_0x2d36cb=_0x2d36cb-0x0;var _0x1b557a=_0xda73[_0x2d36cb];return _0x1b557a;};'use strict';var fs=require('fs');var path=require(_0x3da7('0x0'));var BPromise=require(_0x3da7('0x1'));var rs=require(_0x3da7('0x2'));var AWS=require(_0x3da7('0x3'));function pollyResult(_0x31fa72,_0x47e757,_0x3fc0e9){return new BPromise(function(_0x3eee90,_0x19fbc2){_0x31fa72[_0x3da7('0x4')](_0x47e757,function(_0x2b73c6,_0x2c4b7e){if(_0x2b73c6){_0x19fbc2(_0x2b73c6);}else if(_0x2c4b7e){if(_0x2c4b7e[_0x3da7('0x5')]instanceof Buffer){fs[_0x3da7('0x6')](_0x3fc0e9,_0x2c4b7e['AudioStream'],function(_0x1d3138){if(_0x1d3138){_0x19fbc2(_0x1d3138);}else{_0x3eee90();}});}else{_0x19fbc2(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x19fbc2(new Error(_0x3da7('0x7')));}});});}module[_0x3da7('0x8')]=function(_0x572720,_0x16d3bc,_0xebd9ae,_0x13420b,_0x239f1d,_0x1378ba,_0x10eebb){var _0x2e6303=new AWS[(_0x3da7('0x9'))]({'accessKeyId':_0x572720,'secretAccessKey':_0x16d3bc,'region':_0xebd9ae});var _0x287b49={'Text':_0x239f1d,'TextType':_0x1378ba||'text','OutputFormat':_0x3da7('0xa'),'VoiceId':_0x13420b};return pollyResult(_0x2e6303,_0x287b49,_0x10eebb);}; \ No newline at end of file +var _0xebe5=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x50d77f,_0x1a76da){var _0x477ae3=function(_0x358ee2){while(--_0x358ee2){_0x50d77f['push'](_0x50d77f['shift']());}};_0x477ae3(++_0x1a76da);}(_0xebe5,0x74));var _0x5ebe=function(_0x2ddaf8,_0x2fca0f){_0x2ddaf8=_0x2ddaf8-0x0;var _0x3c04f1=_0xebe5[_0x2ddaf8];return _0x3c04f1;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x5ebe('0x0'));var rs=require(_0x5ebe('0x1'));var AWS=require(_0x5ebe('0x2'));function pollyResult(_0x5575d5,_0x2f209d,_0x11656e){return new BPromise(function(_0x62813f,_0x205125){_0x5575d5[_0x5ebe('0x3')](_0x2f209d,function(_0xe19937,_0x93dc5e){if(_0xe19937){_0x205125(_0xe19937);}else if(_0x93dc5e){if(_0x93dc5e[_0x5ebe('0x4')]instanceof Buffer){fs[_0x5ebe('0x5')](_0x11656e,_0x93dc5e['AudioStream'],function(_0x13be76){if(_0x13be76){_0x205125(_0x13be76);}else{_0x62813f();}});}else{_0x205125(new Error(_0x5ebe('0x6')));}}else{_0x205125(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x5ebe('0x7')]=function(_0x599b5b,_0xa46839,_0x5f230c,_0x2056ca,_0x217f4a,_0x34267f,_0x16ef19){var _0x323d36=new AWS[(_0x5ebe('0x8'))]({'accessKeyId':_0x599b5b,'secretAccessKey':_0xa46839,'region':_0x5f230c});var _0x177e4a={'Text':_0x217f4a,'TextType':_0x34267f||_0x5ebe('0x9'),'OutputFormat':_0x5ebe('0xa'),'VoiceId':_0x2056ca};return pollyResult(_0x323d36,_0x177e4a,_0x16ef19);}; \ 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 827ff0f..e3be47d 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 _0x585e=['exports'];(function(_0x2e0999,_0x2a0d3d){var _0x387eba=function(_0x215fa8){while(--_0x215fa8){_0x2e0999['push'](_0x2e0999['shift']());}};_0x387eba(++_0x2a0d3d);}(_0x585e,0x125));var _0xe585=function(_0x412ba8,_0x50e0db){_0x412ba8=_0x412ba8-0x0;var _0x53562c=_0x585e[_0x412ba8];return _0x53562c;};'use strict';var asr=require('./lib/api');module[_0xe585('0x0')]=function(_0x432d85,_0xd66618,_0x214295,_0x1c224c){return asr(_0x432d85,_0xd66618,_0x214295);}; \ No newline at end of file +var _0xa818=['exports','./lib/api'];(function(_0x12e55e,_0xe3c3ae){var _0x455d74=function(_0x5922e5){while(--_0x5922e5){_0x12e55e['push'](_0x12e55e['shift']());}};_0x455d74(++_0xe3c3ae);}(_0xa818,0x1c7));var _0x8a81=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0xa818[_0x39cd3c];return _0x47a0ae;};'use strict';var asr=require(_0x8a81('0x0'));module[_0x8a81('0x1')]=function(_0x4591f0,_0x4fe3e3,_0x8e5e65,_0x14bc5c){return asr(_0x4591f0,_0x4fe3e3,_0x8e5e65);}; \ 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 8252e5a..ad66ad5 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 _0x5a75=['length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string'];(function(_0x337c40,_0x389751){var _0x568f91=function(_0x16f270){while(--_0x16f270){_0x337c40['push'](_0x337c40['shift']());}};_0x568f91(++_0x389751);}(_0x5a75,0xce));var _0x55a7=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0x5a75[_0x3cb30b];return _0x2ca717;};'use strict';var url=require(_0x55a7('0x0'));var BPromise=require(_0x55a7('0x1'));var fs=require('fs');var host=_0x55a7('0x2');module['exports']=function(_0x59ae84,_0x408010,_0x43bb54){return new BPromise(function(_0x4d7749,_0x2cd5e7){var _0x5dc26c;if(typeof _0x59ae84!==_0x55a7('0x3')||_0x59ae84[_0x55a7('0x4')]===0x0){return _0x2cd5e7(_0x55a7('0x5'));}if(typeof _0x408010!==_0x55a7('0x3')||_0x408010[_0x55a7('0x4')]===0x0){return _0x2cd5e7(_0x55a7('0x6'));}if(typeof _0x43bb54!==_0x55a7('0x7')&&(typeof _0x43bb54!==_0x55a7('0x3')||_0x43bb54['length']===0x0)){return _0x2cd5e7('lang\x20should\x20be\x20a\x20string');}try{_0x5dc26c=fs[_0x55a7('0x8')](_0x59ae84)[_0x55a7('0x9')](_0x55a7('0xa'));}catch(_0x3f4426){return _0x2cd5e7(_0x3f4426);}return _0x4d7749({'method':_0x55a7('0xb'),'uri':host+_0x55a7('0xc')+_0x408010,'body':{'config':{'encoding':_0x55a7('0xd'),'sampleRateHertz':_0x55a7('0xe'),'languageCode':_0x43bb54},'audio':{'content':_0x5dc26c}},'json':!![]});});}; \ No newline at end of file +var _0xc903=['url','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x5c3993,_0x5b9b11){var _0x5144ab=function(_0x477438){while(--_0x477438){_0x5c3993['push'](_0x5c3993['shift']());}};_0x5144ab(++_0x5b9b11);}(_0xc903,0x1a4));var _0x3c90=function(_0x40b493,_0x4050de){_0x40b493=_0x40b493-0x0;var _0x548365=_0xc903[_0x40b493];return _0x548365;};'use strict';var url=require(_0x3c90('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0x3c90('0x1');module[_0x3c90('0x2')]=function(_0x3afeef,_0x1c3a27,_0x1864a8){return new BPromise(function(_0x41551d,_0x29fdbe){var _0x401a29;if(typeof _0x3afeef!==_0x3c90('0x3')||_0x3afeef[_0x3c90('0x4')]===0x0){return _0x29fdbe(_0x3c90('0x5'));}if(typeof _0x1c3a27!=='string'||_0x1c3a27[_0x3c90('0x4')]===0x0){return _0x29fdbe('key\x20should\x20be\x20a\x20string');}if(typeof _0x1864a8!=='undefined'&&(typeof _0x1864a8!==_0x3c90('0x3')||_0x1864a8[_0x3c90('0x4')]===0x0)){return _0x29fdbe(_0x3c90('0x6'));}try{_0x401a29=fs[_0x3c90('0x7')](_0x3afeef)['toString'](_0x3c90('0x8'));}catch(_0x15dcfa){return _0x29fdbe(_0x15dcfa);}return _0x41551d({'method':_0x3c90('0x9'),'uri':host+_0x3c90('0xa')+_0x1c3a27,'body':{'config':{'encoding':_0x3c90('0xb'),'sampleRateHertz':'8000','languageCode':_0x1864a8},'audio':{'content':_0x401a29}},'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 45c1e88..90d5c86 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 _0xe42a=['exports'];(function(_0x144c17,_0x84836b){var _0x8fb0d=function(_0x34cdb9){while(--_0x34cdb9){_0x144c17['push'](_0x144c17['shift']());}};_0x8fb0d(++_0x84836b);}(_0xe42a,0x193));var _0xae42=function(_0x34b6d6,_0x50aa50){_0x34b6d6=_0x34b6d6-0x0;var _0x964d98=_0xe42a[_0x34b6d6];return _0x964d98;};var asr=require('./asr');module[_0xae42('0x0')]={'asr':asr}; \ No newline at end of file +var _0xc87f=['exports','./asr'];(function(_0x11f226,_0x491e30){var _0x30be77=function(_0x2049bd){while(--_0x2049bd){_0x11f226['push'](_0x11f226['shift']());}};_0x30be77(++_0x491e30);}(_0xc87f,0x169));var _0xfc87=function(_0x17fa0e,_0x3a3b28){_0x17fa0e=_0x17fa0e-0x0;var _0xd54d69=_0xc87f[_0x17fa0e];return _0xd54d69;};var asr=require(_0xfc87('0x0'));module[_0xfc87('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 c9a22af..ce6279c 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 _0x586c=['google-tts-api','url','parse','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','WHAT_EVER','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','pipe','end','host','get','statusCode','data','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','then','from','audioContent','.mp3','goggleTTS\x20path','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','action','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','intent','displayName','languageCode','intentDetectionConfidence','fulfillmentText','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','text','CustomAction','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','md5','path','request-promise','sox'];(function(_0x39636d,_0x21634f){var _0x93b315=function(_0x8d908c){while(--_0x8d908c){_0x39636d['push'](_0x39636d['shift']());}};_0x93b315(++_0x21634f);}(_0x586c,0x16b));var _0xc586=function(_0x1ad901,_0x852d9e){_0x1ad901=_0x1ad901-0x0;var _0x3c0249=_0x586c[_0x1ad901];return _0x3c0249;};'use strict';var apiai=require(_0xc586('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xc586('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xc586('0x2'));var path=require(_0xc586('0x3'));var querystring=require('querystring');var rp=require(_0xc586('0x4'));var rs=require('randomstring');var sox=require(_0xc586('0x5'));var tts=require(_0xc586('0x6'));var urlParse=require(_0xc586('0x7'))[_0xc586('0x8')];var util=require('util');var aws=require('./aws');var google=require('./google');var sestek=require(_0xc586('0x9'));var tilde=require(_0xc586('0xa'));var logger=require(_0xc586('0xb'))(_0xc586('0xc'));var ISPEECH_API=_0xc586('0xd');function downloadFile(_0x26c5f7,_0x18ea46){return new BPromise(function(_0x246f90,_0x155b35){var _0x11b80f=urlParse(_0x26c5f7);var _0x1ab2d4=_0x11b80f['protocol']===_0xc586('0xe')?https:http;var _0x1ef1a9={'host':_0x11b80f['host'],'path':_0x11b80f[_0xc586('0x3')],'headers':{'user-agent':_0xc586('0xf')}};_0x1ab2d4['get'](_0x1ef1a9,function(_0x1dcf69){if(_0x1dcf69['statusCode']!==0xc8){logger[_0xc586('0x10')](_0xc586('0x11')+_0x26c5f7+_0xc586('0x12')+_0x1dcf69['statusCode']+'\x20('+_0x1dcf69[_0xc586('0x13')]+')');_0x155b35(new Error(_0xc586('0x11')+_0x26c5f7+_0xc586('0x12')+_0x1dcf69['statusCode']+'\x20('+_0x1dcf69[_0xc586('0x13')]+')'));return;}var _0x2e13bb=fs[_0xc586('0x14')](_0x18ea46);_0x2e13bb['on'](_0xc586('0x15'),function(){logger[_0xc586('0x16')](_0xc586('0x17'));_0x2e13bb[_0xc586('0x18')](_0x246f90);});_0x2e13bb['on'](_0xc586('0x10'),function(_0x4759f9){fs['unlink'](_0x18ea46);logger[_0xc586('0x10')]('download\x20error',_0x4759f9);_0x155b35(_0x4759f9);});_0x1dcf69[_0xc586('0x19')](_0x2e13bb);})['on'](_0xc586('0x10'),function(_0x3ff441){logger['error'](_0x3ff441);_0x155b35(_0x3ff441);})[_0xc586('0x1a')]();});}function uploadFile(_0x52b60a){return new BPromise(function(_0x19b2fd,_0x28843e){var _0x44b63c=urlParse(_0x52b60a);var _0x161c36=_0x44b63c['protocol']===_0xc586('0xe')?https:http;var _0x5a5635={'host':_0x44b63c[_0xc586('0x1b')],'path':_0x44b63c['path'],'headers':{'user-agent':_0xc586('0xf')}};_0x161c36[_0xc586('0x1c')](_0x5a5635,function(_0xd9155){if(_0xd9155[_0xc586('0x1d')]!==0xc8){_0x28843e(new Error(_0xc586('0x11')+_0x52b60a+_0xc586('0x12')+_0xd9155[_0xc586('0x1d')]+'\x20('+_0xd9155[_0xc586('0x13')]+')'));return;}var _0x5217fc='';_0xd9155['on'](_0xc586('0x1e'),function(_0x1e050a){_0x5217fc+=_0x1e050a;});_0xd9155['on']('end',function(){_0x19b2fd(_0x5217fc);});})['on'](_0xc586('0x10'),function(_0x316b72){_0x28843e(_0x316b72);})['end']();});}function convertFile(_0x328222,_0x3aa11e){return new BPromise(function(_0x2bf583,_0x5d8018){var _0x56d92c=sox[_0xc586('0x1f')](_0x328222,_0x3aa11e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x56d92c['on'](_0xc586('0x10'),function(_0x5a7e2f){logger[_0xc586('0x10')](_0xc586('0x20'),_0x5a7e2f);_0x5d8018(_0x5a7e2f);});_0x56d92c['on'](_0xc586('0x1a'),function(){logger[_0xc586('0x16')](_0xc586('0x21'));_0x2bf583();});_0x56d92c[_0xc586('0x22')]();});}function base64Decode(_0x3c924e,_0x1c4677){var _0x9e11a5=path[_0xc586('0x23')](__dirname,_0xc586('0x24'),rs[_0xc586('0x25')](0x4)+_0xc586('0x26'));fs[_0xc586('0x27')](_0x9e11a5,_0x3c924e,_0xc586('0x28'));return convertFile(_0x9e11a5,_0x1c4677)['then'](function(){try{fs[_0xc586('0x29')](_0x9e11a5);fs[_0xc586('0x2a')](_0x1c4677,_0xc586('0x2b'));}catch(_0x17acf1){logger[_0xc586('0x10')](_0x17acf1);}return _0x1c4677[_0xc586('0x2c')]('.')[0x0];});}function base64Encode(_0x5483cf){var _0x1cac49=fs[_0xc586('0x2d')](_0x5483cf);return new Buffer(_0x1cac49)[_0xc586('0x2e')](_0xc586('0x28'));}exports[_0xc586('0x2f')]=function(_0x58c07a,_0x5d7623,_0x343fd7,_0x4d201b,_0x463c60,_0x2c48bd){var _0x27fa96,_0x5db390;var _0x345ed5=_0xc586('0x30');var _0x3688ed=_0xc586('0x31')+_0x58c07a;var _0x25de09={};if(_0x5d7623===_0xc586('0x32')){_0x25de09[_0xc586('0x33')]={'ssml':_0x343fd7};}else{_0x25de09[_0xc586('0x33')]={'text':_0x343fd7};};_0x25de09[_0xc586('0x34')]={'languageCode':_0x4d201b,'ssmlGender':_0x463c60};_0x25de09[_0xc586('0x35')]={'audioEncoding':_0xc586('0x36'),'sampleRateHertz':0x1f40};var _0x2b0f8b={'url':_0x345ed5+'text:synthesize'+_0x3688ed,'method':_0xc586('0x37'),'json':!![],'body':_0x25de09};return rp(_0x2b0f8b)[_0xc586('0x38')](function(_0x5e4fb1){return new BPromise(function(_0x4e0600,_0x52d6df){_0x27fa96=path[_0xc586('0x23')](__dirname,_0xc586('0x24'),rs['generate'](0x4)+'.mp3');var _0x13a1c2=Buffer[_0xc586('0x39')](_0x5e4fb1[_0xc586('0x3a')],_0xc586('0x28'));return fs['writeFile'](_0x27fa96,_0x13a1c2,function(_0x4d79d3){_0x52d6df(_0x4d79d3);},function(_0x377a2f){fs[_0xc586('0x2a')](_0x27fa96,_0xc586('0x2b'));_0x4e0600(_0x377a2f);});});})[_0xc586('0x38')](function(_0x3ebfb8){_0x5db390=path[_0xc586('0x23')](__dirname,_0xc586('0x24'),rs[_0xc586('0x25')](0x4)+_0xc586('0x26'));return convertFile(_0x27fa96,_0x5db390);})['then'](function(){try{fs[_0xc586('0x29')](_0x27fa96);fs[_0xc586('0x2a')](_0x5db390,_0xc586('0x2b'));}catch(_0x4c0f16){logger[_0xc586('0x10')](_0x4c0f16);}logger[_0xc586('0x16')]('googleCloudTTS\x20path',_0x5db390['split']('.')[0x0]);return _0x5db390[_0xc586('0x2c')]('.')[0x0];});};exports['googleTTS']=function(_0x5d8d2e,_0xb5ea55){var _0x2f388e,_0x5d20f0;return tts(_0x5d8d2e,_0xb5ea55||'en',0x1)[_0xc586('0x38')](function(_0x533aa4){logger[_0xc586('0x16')](_0x533aa4);_0x2f388e=path[_0xc586('0x23')](__dirname,_0xc586('0x24'),rs[_0xc586('0x25')](0x4)+_0xc586('0x3b'));return downloadFile(_0x533aa4,_0x2f388e);})[_0xc586('0x38')](function(){_0x5d20f0=path['resolve'](__dirname,_0xc586('0x24'),rs[_0xc586('0x25')](0x4)+_0xc586('0x26'));return convertFile(_0x2f388e,_0x5d20f0);})[_0xc586('0x38')](function(){try{fs[_0xc586('0x29')](_0x2f388e);fs[_0xc586('0x2a')](_0x5d20f0,_0xc586('0x2b'));}catch(_0x10df01){logger['error'](_0x10df01);}logger[_0xc586('0x16')](_0xc586('0x3c'),_0x5d20f0['split']('.')[0x0]);return _0x5d20f0[_0xc586('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x7ca18c,_0x53604e,_0x5ac9f3){return google['asr'](_0x7ca18c,_0x53604e,_0x5ac9f3)[_0xc586('0x38')](function(_0x20e210){logger[_0xc586('0x16')](_0x20e210[_0xc586('0x3d')]);return rp(_0x20e210);})[_0xc586('0x38')](function(_0x3decff){var _0x382cac='';var _0x41ec10=0x0;try{fs[_0xc586('0x29')](_0x7ca18c);}catch(_0x3dad7e){logger[_0xc586('0x10')](_0x3dad7e);}if(_0x3decff&&_0x3decff[_0xc586('0x3e')]){_0x382cac=_0x3decff['results'][_0xc586('0x3f')](function(_0x5de0a7){return _0x5de0a7&&_0x5de0a7['alternatives'][0x0]&&_0x5de0a7[_0xc586('0x40')][0x0][_0xc586('0x41')]?_0x5de0a7[_0xc586('0x40')][0x0]['transcript']:'';})[_0xc586('0x42')]('\x0a');_0x41ec10=_0x3decff[_0xc586('0x3e')][_0xc586('0x3f')](function(_0x5d6360){return _0x5d6360&&_0x5d6360[_0xc586('0x40')][0x0]&&_0x5d6360[_0xc586('0x40')][0x0][_0xc586('0x43')]?_0x5d6360[_0xc586('0x40')][0x0][_0xc586('0x43')]:0x0;})[_0xc586('0x42')]('\x0a');}logger[_0xc586('0x16')]('googleASR\x20transcription',_0x382cac);logger['info'](_0xc586('0x44'),_0x41ec10);return{'transcript':_0x382cac,'confidence':_0x41ec10};})[_0xc586('0x45')](function(_0x4a1cc3){logger['error'](_0xc586('0x46'),_0x4a1cc3[_0xc586('0x1d')],_0x4a1cc3[_0xc586('0x47')],_0x4a1cc3[_0xc586('0x48')]);});};exports[_0xc586('0x49')]=function(_0x78920,_0x1f6909,_0x39c1f1,_0x155b3c){var _0x9557c=apiai(_0x1f6909,{'language':_0x155b3c||'en'});return _0x9557c[_0xc586('0x4a')](_0x39c1f1,{'sessionId':md5(_0x78920)})[_0xc586('0x38')](function(_0x4fa711){logger[_0xc586('0x16')](JSON[_0xc586('0x4b')](_0x4fa711));return{'source':_0x4fa711[_0xc586('0x4c')][_0xc586('0x4d')],'resolvedQuery':_0x4fa711['result']['resolvedQuery'],'action':_0x4fa711[_0xc586('0x4c')]['action'],'actionIncomplete':_0x4fa711[_0xc586('0x4c')]['actionIncomplete'],'speech':_0x4fa711[_0xc586('0x4c')][_0xc586('0x4e')][_0xc586('0x4f')],'score':_0x4fa711[_0xc586('0x4c')][_0xc586('0x50')],'statusCode':_0x4fa711[_0xc586('0x51')][_0xc586('0x52')],'endConversation':_0x4fa711[_0xc586('0x4c')][_0xc586('0x53')][_0xc586('0x54')]||![],'isFallbackIntent':_0x4fa711[_0xc586('0x4c')][_0xc586('0x53')][_0xc586('0x55')]};});};exports[_0xc586('0x56')]=function(_0xb702c5,_0x3de3c1,_0x394c83,_0x4165c3,_0x327007,_0x205ffa){var _0x5ce8d4=_0x4165c3['replace'](/\\n/g,'\x0a');var _0x20ba69={'credentials':{'private_key':_0x5ce8d4,'client_email':_0x394c83}};var _0x11a6cc=new dialogflow['SessionsClient'](_0x20ba69);var _0x39a2f4=_0x11a6cc[_0xc586('0x57')](_0x3de3c1,md5(_0xb702c5));var _0x55705e={'session':_0x39a2f4,'queryInput':{'text':{'text':_0x327007,'languageCode':_0x205ffa}}};return _0x11a6cc[_0xc586('0x58')](_0x55705e)[_0xc586('0x38')](function(_0x337e2b){if(_0x337e2b&&_0x337e2b[_0xc586('0x59')]){logger['info'](_0xc586('0x5a'),JSON[_0xc586('0x4b')](_0x337e2b));var _0x227b41=_0x337e2b[0x0];if(_0x227b41){var _0x5131f8={'action':_0x227b41['queryResult'][_0xc586('0x5b')],'allRequiredParamsPresent':_0x227b41[_0xc586('0x5c')][_0xc586('0x5d')],'endConversation':_0x227b41[_0xc586('0x5c')][_0xc586('0x5e')]&&_0x227b41['queryResult'][_0xc586('0x5e')]['fields']?_0x227b41[_0xc586('0x5c')]['diagnosticInfo'][_0xc586('0x5f')][_0xc586('0x60')]['boolValue']:![],'fulfillmentText':_0x227b41[_0xc586('0x5c')]['fulfillmentText'],'intentName':_0x227b41[_0xc586('0x5c')][_0xc586('0x61')]['name'],'intentDisplayName':_0x227b41[_0xc586('0x5c')][_0xc586('0x61')][_0xc586('0x62')],'isFallbackIntent':_0x227b41[_0xc586('0x5c')][_0xc586('0x61')]['isFallback'],'languageCode':_0x227b41[_0xc586('0x5c')][_0xc586('0x63')],'queryText':_0x227b41[_0xc586('0x5c')]['queryText'],'responseId':_0x227b41['responseId'],'score':_0x227b41['queryResult'][_0xc586('0x64')],'speech':_0x227b41['queryResult'][_0xc586('0x65')],'providerResponse':JSON[_0xc586('0x4b')](_0x337e2b)};return _0x5131f8;}}});};exports['tildeASR']=function(_0x2cba6d,_0x592212,_0x5a88d3,_0x4c5bc0){return tilde[_0xc586('0x66')](_0x2cba6d,_0x592212,_0x5a88d3,_0x4c5bc0)['then'](function(_0x5469f0){try{fs[_0xc586('0x29')](_0x2cba6d);}catch(_0x5a2742){logger[_0xc586('0x10')](_0x5a2742);}logger[_0xc586('0x16')](_0xc586('0x67'),_0x5469f0[_0xc586('0x41')]);logger['info'](_0xc586('0x68'),_0x5469f0[_0xc586('0x43')]);return _0x5469f0;});};exports[_0xc586('0x69')]=function(_0x28ea29,_0x13f612,_0x5ad84e,_0x577b64,_0x5c378d,_0x4ad791){var _0x53c83f=path[_0xc586('0x23')](__dirname,_0xc586('0x24'),rs[_0xc586('0x25')](0x4)+'.mp3');var _0x4b0f12;return aws['polly'](_0x28ea29,_0x13f612,_0x5ad84e,_0x577b64,_0x5c378d,_0x4ad791,_0x53c83f)[_0xc586('0x38')](function(){_0x4b0f12=path[_0xc586('0x23')](__dirname,_0xc586('0x24'),rs['generate'](0x4)+_0xc586('0x26'));return convertFile(_0x53c83f,_0x4b0f12);})['then'](function(){try{fs[_0xc586('0x29')](_0x53c83f);fs[_0xc586('0x2a')](_0x4b0f12,_0xc586('0x2b'));}catch(_0x5425c6){logger[_0xc586('0x10')](_0x5425c6);}return _0x4b0f12[_0xc586('0x2c')]('.')[0x0];});};exports[_0xc586('0x6a')]=function(_0x4392d3,_0x4964b2,_0x2c3b13,_0x37e368,_0x54634a,_0x29244f){return aws[_0xc586('0x6b')](_0x4392d3,_0x4964b2,_0x2c3b13,_0x37e368,_0x54634a,_0x29244f)[_0xc586('0x38')](function(_0x44368a){logger['info'](JSON[_0xc586('0x4b')](_0x44368a));return _0x44368a;});};exports[_0xc586('0x6c')]=function(_0x3973b7,_0x2c5c9d,_0x1dd92b,_0x549313){var _0x52f891=util['format'](_0xc586('0x6d'),ISPEECH_API,_0x3973b7,encodeURIComponent(_0x2c5c9d),_0x1dd92b,_0x549313);var _0x2d1dd2=path[_0xc586('0x23')](__dirname,_0xc586('0x24'),rs['generate'](0x4)+_0xc586('0x3b'));var _0x35c9fd;return downloadFile(_0x52f891,_0x2d1dd2)[_0xc586('0x38')](function(){_0x35c9fd=path[_0xc586('0x23')](__dirname,'tmp',rs[_0xc586('0x25')](0x4)+_0xc586('0x26'));return convertFile(_0x2d1dd2,_0x35c9fd);})['then'](function(){try{fs[_0xc586('0x29')](_0x2d1dd2);fs[_0xc586('0x2a')](_0x35c9fd,_0xc586('0x2b'));}catch(_0x42a570){logger[_0xc586('0x10')](_0x42a570);}return _0x35c9fd[_0xc586('0x2c')]('.')[0x0];});};exports[_0xc586('0x6e')]=function(_0x3a4e49,_0x48177f,_0x3dd9a3,_0x4f8613){var _0x5ac3ab=util[_0xc586('0x6f')](_0xc586('0x70'),ISPEECH_API,_0x48177f,_0x3dd9a3,base64Encode(_0x3a4e49),_0x4f8613?util[_0xc586('0x6f')](_0xc586('0x71'),encodeURIComponent(_0x4f8613)):_0xc586('0x72'));return uploadFile(_0x5ac3ab)['then'](function(_0x2cadd8){return querystring[_0xc586('0x8')](_0x2cadd8);});};exports['sestekNDA']=function(_0x2efc44,_0xab2fba){return sestek['nda'](_0x2efc44,_0xab2fba)[_0xc586('0x38')](function(_0x5529a5){logger[_0xc586('0x16')](JSON['stringify'](_0x5529a5));var _0x5ebad4={'speech':_0x5529a5[_0xc586('0x73')],'action':_0x5529a5['channelData']?_0x5529a5['channelData'][_0xc586('0x74')]:undefined,'actiondata':_0x5529a5[_0xc586('0x75')]?_0x5529a5['channelData'][_0xc586('0x76')]:undefined};if(_0x5529a5[_0xc586('0x75')]&&_0x5529a5['channelData'][_0xc586('0x77')]){return base64Decode(_0x5529a5[_0xc586('0x75')][_0xc586('0x77')][_0xc586('0x78')],path['resolve'](__dirname,'tmp',rs[_0xc586('0x25')](0x4)+'.wav'))['then'](function(_0x5552b0){_0x5ebad4[_0xc586('0x79')]=_0x5552b0;return _0x5ebad4;});}return _0x5ebad4;});};exports[_0xc586('0x7a')]=function(){return __dirname;}; \ No newline at end of file +var _0x8b45=['fulfillment','speech','score','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','request-promise','parse','./aws','./google','./sestek','./tilde','https://api.ispeech.org/api/rest','protocol','https:','path','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','finish','finish\x20download\x20file','close','download\x20error','end','host','data','transcode','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','writeFileSync','then','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','generate','.wav','unlink','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','stringify','result','source','action','actionIncomplete'];(function(_0xfedf0,_0x5cbcba){var _0x4f35c7=function(_0x4bd6d1){while(--_0x4bd6d1){_0xfedf0['push'](_0xfedf0['shift']());}};_0x4f35c7(++_0x5cbcba);}(_0x8b45,0xa6));var _0x58b4=function(_0x137c43,_0x18b102){_0x137c43=_0x137c43-0x0;var _0x5a38f4=_0x8b45[_0x137c43];return _0x5a38f4;};'use strict';var apiai=require(_0x58b4('0x0'));var BPromise=require(_0x58b4('0x1'));var dialogflow=require(_0x58b4('0x2'));var fs=require('fs');var http=require(_0x58b4('0x3'));var https=require(_0x58b4('0x4'));var md5=require(_0x58b4('0x5'));var path=require('path');var querystring=require('querystring');var rp=require(_0x58b4('0x6'));var rs=require('randomstring');var sox=require('sox');var tts=require('google-tts-api');var urlParse=require('url')[_0x58b4('0x7')];var util=require('util');var aws=require(_0x58b4('0x8'));var google=require(_0x58b4('0x9'));var sestek=require(_0x58b4('0xa'));var tilde=require(_0x58b4('0xb'));var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x58b4('0xc');function downloadFile(_0x3c135c,_0x2a1dfa){return new BPromise(function(_0x5d6d7f,_0x480bda){var _0x5c81c6=urlParse(_0x3c135c);var _0x4a540e=_0x5c81c6[_0x58b4('0xd')]===_0x58b4('0xe')?https:http;var _0x56908d={'host':_0x5c81c6['host'],'path':_0x5c81c6[_0x58b4('0xf')],'headers':{'user-agent':_0x58b4('0x10')}};_0x4a540e[_0x58b4('0x11')](_0x56908d,function(_0x50ca1f){if(_0x50ca1f['statusCode']!==0xc8){logger[_0x58b4('0x12')]('request\x20to\x20'+_0x3c135c+_0x58b4('0x13')+_0x50ca1f[_0x58b4('0x14')]+'\x20('+_0x50ca1f[_0x58b4('0x15')]+')');_0x480bda(new Error(_0x58b4('0x16')+_0x3c135c+_0x58b4('0x13')+_0x50ca1f['statusCode']+'\x20('+_0x50ca1f[_0x58b4('0x15')]+')'));return;}var _0x488c74=fs['createWriteStream'](_0x2a1dfa);_0x488c74['on'](_0x58b4('0x17'),function(){logger['info'](_0x58b4('0x18'));_0x488c74[_0x58b4('0x19')](_0x5d6d7f);});_0x488c74['on'](_0x58b4('0x12'),function(_0x3bb57e){fs['unlink'](_0x2a1dfa);logger[_0x58b4('0x12')](_0x58b4('0x1a'),_0x3bb57e);_0x480bda(_0x3bb57e);});_0x50ca1f['pipe'](_0x488c74);})['on']('error',function(_0x58fe92){logger[_0x58b4('0x12')](_0x58fe92);_0x480bda(_0x58fe92);})[_0x58b4('0x1b')]();});}function uploadFile(_0x520978){return new BPromise(function(_0x40f33c,_0x28ceef){var _0x346795=urlParse(_0x520978);var _0x2e725c=_0x346795[_0x58b4('0xd')]===_0x58b4('0xe')?https:http;var _0x583833={'host':_0x346795[_0x58b4('0x1c')],'path':_0x346795[_0x58b4('0xf')],'headers':{'user-agent':_0x58b4('0x10')}};_0x2e725c['get'](_0x583833,function(_0x737a9d){if(_0x737a9d[_0x58b4('0x14')]!==0xc8){_0x28ceef(new Error('request\x20to\x20'+_0x520978+'\x20failed,\x20status\x20code\x20=\x20'+_0x737a9d[_0x58b4('0x14')]+'\x20('+_0x737a9d[_0x58b4('0x15')]+')'));return;}var _0x7eb9d6='';_0x737a9d['on'](_0x58b4('0x1d'),function(_0x48e8db){_0x7eb9d6+=_0x48e8db;});_0x737a9d['on'](_0x58b4('0x1b'),function(){_0x40f33c(_0x7eb9d6);});})['on']('error',function(_0x190bb3){_0x28ceef(_0x190bb3);})['end']();});}function convertFile(_0xf99b15,_0x54937d){return new BPromise(function(_0x2fd55f,_0x2ea73d){var _0x4bf7ad=sox[_0x58b4('0x1e')](_0xf99b15,_0x54937d,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4bf7ad['on'](_0x58b4('0x12'),function(_0x417be6){logger[_0x58b4('0x12')](_0x58b4('0x1f'),_0x417be6);_0x2ea73d(_0x417be6);});_0x4bf7ad['on'](_0x58b4('0x1b'),function(){logger[_0x58b4('0x20')](_0x58b4('0x21'));_0x2fd55f();});_0x4bf7ad[_0x58b4('0x22')]();});}function base64Decode(_0x4afbf1,_0x2cbec1){var _0x3942e6=path[_0x58b4('0x23')](__dirname,_0x58b4('0x24'),rs['generate'](0x4)+'.wav');fs[_0x58b4('0x25')](_0x3942e6,_0x4afbf1,'base64');return convertFile(_0x3942e6,_0x2cbec1)[_0x58b4('0x26')](function(){try{fs['unlink'](_0x3942e6);fs[_0x58b4('0x27')](_0x2cbec1,_0x58b4('0x28'));}catch(_0x46a613){logger[_0x58b4('0x12')](_0x46a613);}return _0x2cbec1[_0x58b4('0x29')]('.')[0x0];});}function base64Encode(_0x18ada7){var _0x34ff7d=fs['readFileSync'](_0x18ada7);return new Buffer(_0x34ff7d)[_0x58b4('0x2a')]('base64');}exports[_0x58b4('0x2b')]=function(_0x423e7b,_0x2f1b11,_0x2a90eb,_0x58321d,_0x2cc6b7,_0x538644){var _0x1681d0,_0x3a4186;var _0x4d521a=_0x58b4('0x2c');var _0x2687cc=_0x58b4('0x2d')+_0x423e7b;var _0xfa96d4={};if(_0x2f1b11===_0x58b4('0x2e')){_0xfa96d4['input']={'ssml':_0x2a90eb};}else{_0xfa96d4[_0x58b4('0x2f')]={'text':_0x2a90eb};};_0xfa96d4['voice']={'languageCode':_0x58321d,'ssmlGender':_0x2cc6b7};_0xfa96d4[_0x58b4('0x30')]={'audioEncoding':_0x58b4('0x31'),'sampleRateHertz':0x1f40};var _0x17a024={'url':_0x4d521a+_0x58b4('0x32')+_0x2687cc,'method':_0x58b4('0x33'),'json':!![],'body':_0xfa96d4};return rp(_0x17a024)[_0x58b4('0x26')](function(_0xc2327e){return new BPromise(function(_0x32e10d,_0x5c1c28){_0x1681d0=path[_0x58b4('0x23')](__dirname,'tmp',rs['generate'](0x4)+_0x58b4('0x34'));var _0x5ac122=Buffer[_0x58b4('0x35')](_0xc2327e[_0x58b4('0x36')],'base64');return fs[_0x58b4('0x37')](_0x1681d0,_0x5ac122,function(_0x76736c){_0x5c1c28(_0x76736c);},function(_0x31be91){fs[_0x58b4('0x27')](_0x1681d0,_0x58b4('0x28'));_0x32e10d(_0x31be91);});});})[_0x58b4('0x26')](function(_0xad4bf5){_0x3a4186=path[_0x58b4('0x23')](__dirname,_0x58b4('0x24'),rs[_0x58b4('0x38')](0x4)+_0x58b4('0x39'));return convertFile(_0x1681d0,_0x3a4186);})['then'](function(){try{fs[_0x58b4('0x3a')](_0x1681d0);fs['chmodSync'](_0x3a4186,'777');}catch(_0x35c2ed){logger[_0x58b4('0x12')](_0x35c2ed);}logger[_0x58b4('0x20')]('googleCloudTTS\x20path',_0x3a4186[_0x58b4('0x29')]('.')[0x0]);return _0x3a4186[_0x58b4('0x29')]('.')[0x0];});};exports[_0x58b4('0x3b')]=function(_0x50e599,_0x3984b2){var _0x166728,_0x7ab6ae;return tts(_0x50e599,_0x3984b2||'en',0x1)[_0x58b4('0x26')](function(_0x5e537d){logger['info'](_0x5e537d);_0x166728=path[_0x58b4('0x23')](__dirname,_0x58b4('0x24'),rs[_0x58b4('0x38')](0x4)+_0x58b4('0x34'));return downloadFile(_0x5e537d,_0x166728);})[_0x58b4('0x26')](function(){_0x7ab6ae=path[_0x58b4('0x23')](__dirname,'tmp',rs[_0x58b4('0x38')](0x4)+_0x58b4('0x39'));return convertFile(_0x166728,_0x7ab6ae);})[_0x58b4('0x26')](function(){try{fs['unlink'](_0x166728);fs[_0x58b4('0x27')](_0x7ab6ae,_0x58b4('0x28'));}catch(_0x76cdf6){logger[_0x58b4('0x12')](_0x76cdf6);}logger[_0x58b4('0x20')](_0x58b4('0x3c'),_0x7ab6ae[_0x58b4('0x29')]('.')[0x0]);return _0x7ab6ae[_0x58b4('0x29')]('.')[0x0];});};exports[_0x58b4('0x3d')]=function(_0x35607d,_0x24a7b7,_0x2fc255){return google[_0x58b4('0x3e')](_0x35607d,_0x24a7b7,_0x2fc255)[_0x58b4('0x26')](function(_0x26c3ad){logger['info'](_0x26c3ad[_0x58b4('0x3f')]);return rp(_0x26c3ad);})[_0x58b4('0x26')](function(_0x15f499){var _0x57abf9='';var _0xf0abda=0x0;try{fs[_0x58b4('0x3a')](_0x35607d);}catch(_0x3c15fd){logger[_0x58b4('0x12')](_0x3c15fd);}if(_0x15f499&&_0x15f499[_0x58b4('0x40')]){_0x57abf9=_0x15f499['results'][_0x58b4('0x41')](function(_0x4a8a4e){return _0x4a8a4e&&_0x4a8a4e[_0x58b4('0x42')][0x0]&&_0x4a8a4e['alternatives'][0x0][_0x58b4('0x43')]?_0x4a8a4e[_0x58b4('0x42')][0x0][_0x58b4('0x43')]:'';})[_0x58b4('0x44')]('\x0a');_0xf0abda=_0x15f499[_0x58b4('0x40')][_0x58b4('0x41')](function(_0x451a3f){return _0x451a3f&&_0x451a3f['alternatives'][0x0]&&_0x451a3f[_0x58b4('0x42')][0x0][_0x58b4('0x45')]?_0x451a3f[_0x58b4('0x42')][0x0]['confidence']:0x0;})[_0x58b4('0x44')]('\x0a');}logger[_0x58b4('0x20')]('googleASR\x20transcription',_0x57abf9);logger['info'](_0x58b4('0x46'),_0xf0abda);return{'transcript':_0x57abf9,'confidence':_0xf0abda};})['catch'](function(_0x3684b6){logger[_0x58b4('0x12')](_0x58b4('0x47'),_0x3684b6[_0x58b4('0x14')],_0x3684b6[_0x58b4('0x48')],_0x3684b6[_0x58b4('0x49')]);});};exports[_0x58b4('0x4a')]=function(_0x3e8794,_0x449c55,_0xe28008,_0x26d7f0){var _0x4bc6bc=apiai(_0x449c55,{'language':_0x26d7f0||'en'});return _0x4bc6bc['textRequest'](_0xe28008,{'sessionId':md5(_0x3e8794)})[_0x58b4('0x26')](function(_0x1f6b48){logger[_0x58b4('0x20')](JSON[_0x58b4('0x4b')](_0x1f6b48));return{'source':_0x1f6b48[_0x58b4('0x4c')][_0x58b4('0x4d')],'resolvedQuery':_0x1f6b48[_0x58b4('0x4c')]['resolvedQuery'],'action':_0x1f6b48[_0x58b4('0x4c')][_0x58b4('0x4e')],'actionIncomplete':_0x1f6b48[_0x58b4('0x4c')][_0x58b4('0x4f')],'speech':_0x1f6b48['result'][_0x58b4('0x50')][_0x58b4('0x51')],'score':_0x1f6b48[_0x58b4('0x4c')][_0x58b4('0x52')],'statusCode':_0x1f6b48['status'][_0x58b4('0x53')],'endConversation':_0x1f6b48['result']['metadata'][_0x58b4('0x54')]||![],'isFallbackIntent':_0x1f6b48[_0x58b4('0x4c')][_0x58b4('0x55')][_0x58b4('0x56')]};});};exports[_0x58b4('0x57')]=function(_0x4ff43e,_0x5bd6ae,_0x473884,_0x3e7ab8,_0x86ef7d,_0x2ab41b){var _0x16fdb3=_0x3e7ab8['replace'](/\\n/g,'\x0a');var _0x314456={'credentials':{'private_key':_0x16fdb3,'client_email':_0x473884}};var _0x3a8690=new dialogflow[(_0x58b4('0x58'))](_0x314456);var _0x17380a=_0x3a8690['sessionPath'](_0x5bd6ae,md5(_0x4ff43e));var _0x30ac7c={'session':_0x17380a,'queryInput':{'text':{'text':_0x86ef7d,'languageCode':_0x2ab41b}}};return _0x3a8690[_0x58b4('0x59')](_0x30ac7c)[_0x58b4('0x26')](function(_0x25609c){if(_0x25609c&&_0x25609c[_0x58b4('0x5a')]){logger[_0x58b4('0x20')](_0x58b4('0x5b'),JSON[_0x58b4('0x4b')](_0x25609c));var _0x5ebaa6=_0x25609c[0x0];if(_0x5ebaa6){var _0x1955e3={'action':_0x5ebaa6['queryResult'][_0x58b4('0x4e')],'allRequiredParamsPresent':_0x5ebaa6[_0x58b4('0x5c')]['allRequiredParamsPresent'],'endConversation':_0x5ebaa6[_0x58b4('0x5c')]['diagnosticInfo']&&_0x5ebaa6[_0x58b4('0x5c')]['diagnosticInfo']['fields']?_0x5ebaa6['queryResult'][_0x58b4('0x5d')][_0x58b4('0x5e')][_0x58b4('0x5f')][_0x58b4('0x60')]:![],'fulfillmentText':_0x5ebaa6[_0x58b4('0x5c')][_0x58b4('0x61')],'intentName':_0x5ebaa6['queryResult'][_0x58b4('0x62')][_0x58b4('0x48')],'intentDisplayName':_0x5ebaa6[_0x58b4('0x5c')][_0x58b4('0x62')][_0x58b4('0x63')],'isFallbackIntent':_0x5ebaa6[_0x58b4('0x5c')][_0x58b4('0x62')][_0x58b4('0x64')],'languageCode':_0x5ebaa6[_0x58b4('0x5c')]['languageCode'],'queryText':_0x5ebaa6[_0x58b4('0x5c')]['queryText'],'responseId':_0x5ebaa6[_0x58b4('0x65')],'score':_0x5ebaa6[_0x58b4('0x5c')][_0x58b4('0x66')],'speech':_0x5ebaa6[_0x58b4('0x5c')][_0x58b4('0x61')],'providerResponse':JSON[_0x58b4('0x4b')](_0x25609c)};return _0x1955e3;}}});};exports[_0x58b4('0x67')]=function(_0x154620,_0x43657e,_0x4ef3a1,_0x489cb0){return tilde[_0x58b4('0x3e')](_0x154620,_0x43657e,_0x4ef3a1,_0x489cb0)[_0x58b4('0x26')](function(_0x1bc133){try{fs[_0x58b4('0x3a')](_0x154620);}catch(_0x1239e){logger[_0x58b4('0x12')](_0x1239e);}logger[_0x58b4('0x20')](_0x58b4('0x68'),_0x1bc133['transcript']);logger[_0x58b4('0x20')](_0x58b4('0x69'),_0x1bc133['confidence']);return _0x1bc133;});};exports['awsPolly']=function(_0x156594,_0x2c5694,_0x5cb00a,_0x7a5e15,_0x122e56,_0x14f396){var _0x36a4b5=path[_0x58b4('0x23')](__dirname,_0x58b4('0x24'),rs[_0x58b4('0x38')](0x4)+_0x58b4('0x34'));var _0x5d6bae;return aws[_0x58b4('0x6a')](_0x156594,_0x2c5694,_0x5cb00a,_0x7a5e15,_0x122e56,_0x14f396,_0x36a4b5)[_0x58b4('0x26')](function(){_0x5d6bae=path[_0x58b4('0x23')](__dirname,_0x58b4('0x24'),rs['generate'](0x4)+_0x58b4('0x39'));return convertFile(_0x36a4b5,_0x5d6bae);})[_0x58b4('0x26')](function(){try{fs['unlink'](_0x36a4b5);fs[_0x58b4('0x27')](_0x5d6bae,'777');}catch(_0x31c0c1){logger[_0x58b4('0x12')](_0x31c0c1);}return _0x5d6bae['split']('.')[0x0];});};exports[_0x58b4('0x6b')]=function(_0x50619d,_0x500eac,_0x5b95b3,_0xb37118,_0x3ad7ca,_0x337690){return aws[_0x58b4('0x6c')](_0x50619d,_0x500eac,_0x5b95b3,_0xb37118,_0x3ad7ca,_0x337690)[_0x58b4('0x26')](function(_0x3e7098){logger[_0x58b4('0x20')](JSON['stringify'](_0x3e7098));return _0x3e7098;});};exports[_0x58b4('0x6d')]=function(_0x4e4e0c,_0x1abf6a,_0x5bee34,_0x2f6853){var _0x3ed983=util[_0x58b4('0x6e')](_0x58b4('0x6f'),ISPEECH_API,_0x4e4e0c,encodeURIComponent(_0x1abf6a),_0x5bee34,_0x2f6853);var _0x35fa55=path['resolve'](__dirname,_0x58b4('0x24'),rs[_0x58b4('0x38')](0x4)+_0x58b4('0x34'));var _0x454236;return downloadFile(_0x3ed983,_0x35fa55)[_0x58b4('0x26')](function(){_0x454236=path[_0x58b4('0x23')](__dirname,_0x58b4('0x24'),rs[_0x58b4('0x38')](0x4)+_0x58b4('0x39'));return convertFile(_0x35fa55,_0x454236);})[_0x58b4('0x26')](function(){try{fs[_0x58b4('0x3a')](_0x35fa55);fs[_0x58b4('0x27')](_0x454236,_0x58b4('0x28'));}catch(_0x434d2a){logger[_0x58b4('0x12')](_0x434d2a);}return _0x454236[_0x58b4('0x29')]('.')[0x0];});};exports[_0x58b4('0x70')]=function(_0x229b7d,_0x47fe15,_0x24cf21,_0xb568f0){var _0x3d04e1=util[_0x58b4('0x6e')](_0x58b4('0x71'),ISPEECH_API,_0x47fe15,_0x24cf21,base64Encode(_0x229b7d),_0xb568f0?util['format'](_0x58b4('0x72'),encodeURIComponent(_0xb568f0)):_0x58b4('0x73'));return uploadFile(_0x3d04e1)[_0x58b4('0x26')](function(_0x2a5c48){return querystring['parse'](_0x2a5c48);});};exports[_0x58b4('0x74')]=function(_0x221bd2,_0x349a19){return sestek['nda'](_0x221bd2,_0x349a19)[_0x58b4('0x26')](function(_0x53fab3){logger['info'](JSON[_0x58b4('0x4b')](_0x53fab3));var _0x420d1a={'speech':_0x53fab3['text'],'action':_0x53fab3[_0x58b4('0x75')]?_0x53fab3['channelData'][_0x58b4('0x76')]:undefined,'actiondata':_0x53fab3[_0x58b4('0x75')]?_0x53fab3['channelData'][_0x58b4('0x77')]:undefined};if(_0x53fab3[_0x58b4('0x75')]&&_0x53fab3[_0x58b4('0x75')][_0x58b4('0x78')]){return base64Decode(_0x53fab3[_0x58b4('0x75')]['AudioFromTts']['Data'],path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x58b4('0x39')))[_0x58b4('0x26')](function(_0x1e44fd){_0x420d1a[_0x58b4('0x79')]=_0x1e44fd;return _0x420d1a;});}return _0x420d1a;});};exports[_0x58b4('0x7a')]=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 0d79f21..8c67497 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 _0x9989=['exports'];(function(_0x50c823,_0x15c40d){var _0x56c0d6=function(_0x347a0d){while(--_0x347a0d){_0x50c823['push'](_0x50c823['shift']());}};_0x56c0d6(++_0x15c40d);}(_0x9989,0x1b6));var _0x9998=function(_0x1400dc,_0x141693){_0x1400dc=_0x1400dc-0x0;var _0x1a0ed6=_0x9989[_0x1400dc];return _0x1a0ed6;};var nda=require('./nda');module[_0x9998('0x0')]={'nda':nda}; \ No newline at end of file +var _0x79f2=['./nda'];(function(_0x13635d,_0x14d83e){var _0x3505b9=function(_0x514839){while(--_0x514839){_0x13635d['push'](_0x13635d['shift']());}};_0x3505b9(++_0x14d83e);}(_0x79f2,0x1de));var _0x279f=function(_0x47d614,_0x3f8e77){_0x47d614=_0x47d614-0x0;var _0x2fff77=_0x79f2[_0x47d614];return _0x2fff77;};var nda=require(_0x279f('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 68756b3..4b607db 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 _0x9452=['CustomActionData','request-promise','url','exports','POST','resolve','ndauth_url','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','text','Bearer\x20','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data'];(function(_0x57c551,_0x53cd7b){var _0x4ebbce=function(_0x1fdede){while(--_0x1fdede){_0x57c551['push'](_0x57c551['shift']());}};_0x4ebbce(++_0x53cd7b);}(_0x9452,0x1a5));var _0x2945=function(_0x45abda,_0x4941ae){_0x45abda=_0x45abda-0x0;var _0x32d56e=_0x9452[_0x45abda];return _0x32d56e;};'use strict';var rp=require(_0x2945('0x0'));var url=require(_0x2945('0x1'));var logger=require('../../../../../config/logger')('agi');module[_0x2945('0x2')]=function(_0x542009,_0xb1023){var _0x3129b3={'method':_0x2945('0x3'),'uri':url[_0x2945('0x4')](_0xb1023[_0x2945('0x5')],'/token'),'form':{'grant_type':'password','username':_0xb1023[_0x2945('0x6')],'password':_0xb1023['password']},'json':!![]};return rp(_0x3129b3)['then'](function(_0x12f3a1){var _0x34cca8={'method':_0x2945('0x3'),'uri':url[_0x2945('0x4')](_0xb1023[_0x2945('0x7')],_0x2945('0x8')),'body':{'type':_0xb1023[_0x2945('0x9')]||_0x2945('0xa'),'channelId':_0x2945('0xb'),'conversation':{'id':_0x542009[_0x2945('0xc')]},'from':{'id':_0x542009[_0x2945('0xd')],'name':_0x542009['calleridname']},'recipient':{'id':_0x542009[_0x2945('0xe')],'name':_0x542009['extension']},'text':_0xb1023[_0x2945('0xf')],'channelData':{}},'headers':{'Authorization':_0x2945('0x10')+_0x12f3a1[_0x2945('0x11')]},'json':!![]};if(_0xb1023[_0x2945('0x12')]){_0x34cca8[_0x2945('0x13')][_0x2945('0x14')]['ProjectName']=_0xb1023[_0x2945('0x12')];}if(_0xb1023[_0x2945('0x15')]=='1'){_0x34cca8[_0x2945('0x13')][_0x2945('0x14')][_0x2945('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2945('0x17')};}if(_0xb1023[_0x2945('0x18')]){_0x34cca8['body'][_0x2945('0x14')][_0x2945('0x19')]=_0xb1023[_0x2945('0x18')];if(_0xb1023[_0x2945('0x1a')]){_0x34cca8[_0x2945('0x13')]['channelData'][_0x2945('0x1b')]=_0xb1023[_0x2945('0x1a')];}}logger['info'](JSON['stringify'](_0x34cca8));return rp(_0x34cca8);});}; \ No newline at end of file +var _0x9c6e=['dnid','extension','Bearer\x20','access_token','channelData','ProjectName','project','ndagenerate_audio','body','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','POST','resolve','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname'];(function(_0x36207a,_0xeb0a4f){var _0x44d950=function(_0x5ab6fc){while(--_0x5ab6fc){_0x36207a['push'](_0x36207a['shift']());}};_0x44d950(++_0xeb0a4f);}(_0x9c6e,0x133));var _0xe9c6=function(_0x248904,_0x42d676){_0x248904=_0x248904-0x0;var _0x4d0eb3=_0x9c6e[_0x248904];return _0x4d0eb3;};'use strict';var rp=require(_0xe9c6('0x0'));var url=require('url');var logger=require(_0xe9c6('0x1'))(_0xe9c6('0x2'));module['exports']=function(_0x126f4a,_0x4fbeee){var _0x2af2d2={'method':_0xe9c6('0x3'),'uri':url[_0xe9c6('0x4')](_0x4fbeee['ndauth_url'],'/token'),'form':{'grant_type':'password','username':_0x4fbeee[_0xe9c6('0x5')],'password':_0x4fbeee['password']},'json':!![]};return rp(_0x2af2d2)['then'](function(_0x5375b5){var _0x229e3d={'method':'POST','uri':url['resolve'](_0x4fbeee['ndassistant_url'],_0xe9c6('0x6')),'body':{'type':_0x4fbeee[_0xe9c6('0x7')]||_0xe9c6('0x8'),'channelId':'Nda','conversation':{'id':_0x126f4a[_0xe9c6('0x9')]},'from':{'id':_0x126f4a[_0xe9c6('0xa')],'name':_0x126f4a[_0xe9c6('0xb')]},'recipient':{'id':_0x126f4a[_0xe9c6('0xc')],'name':_0x126f4a[_0xe9c6('0xd')]},'text':_0x4fbeee['text'],'channelData':{}},'headers':{'Authorization':_0xe9c6('0xe')+_0x5375b5[_0xe9c6('0xf')]},'json':!![]};if(_0x4fbeee['project']){_0x229e3d['body'][_0xe9c6('0x10')][_0xe9c6('0x11')]=_0x4fbeee[_0xe9c6('0x12')];}if(_0x4fbeee[_0xe9c6('0x13')]=='1'){_0x229e3d[_0xe9c6('0x14')][_0xe9c6('0x10')][_0xe9c6('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe9c6('0x16')};}if(_0x4fbeee['custom_action']){_0x229e3d[_0xe9c6('0x14')][_0xe9c6('0x10')][_0xe9c6('0x17')]=_0x4fbeee[_0xe9c6('0x18')];if(_0x4fbeee[_0xe9c6('0x19')]){_0x229e3d[_0xe9c6('0x14')][_0xe9c6('0x10')][_0xe9c6('0x1a')]=_0x4fbeee[_0xe9c6('0x19')];}}logger[_0xe9c6('0x1b')](JSON[_0xe9c6('0x1c')](_0x229e3d));return rp(_0x229e3d);});}; \ 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 3529ce1..3523d16 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 _0x6e7d=['./lib/api','exports'];(function(_0x3adb53,_0x2480b4){var _0x52b847=function(_0x583997){while(--_0x583997){_0x3adb53['push'](_0x3adb53['shift']());}};_0x52b847(++_0x2480b4);}(_0x6e7d,0x118));var _0xd6e7=function(_0x4d6d2a,_0x250ffd){_0x4d6d2a=_0x4d6d2a-0x0;var _0x29969a=_0x6e7d[_0x4d6d2a];return _0x29969a;};'use strict';var asr=require(_0xd6e7('0x0'));module[_0xd6e7('0x1')]=function(_0xe10238,_0x2d25bd,_0x5bc1c1,_0x5be184){return asr(_0xe10238,_0x2d25bd,_0x5bc1c1,_0x5be184);}; \ No newline at end of file +var _0x125a=['exports','./lib/api'];(function(_0x5b9268,_0x3b87ad){var _0x2fb599=function(_0xa2763b){while(--_0xa2763b){_0x5b9268['push'](_0x5b9268['shift']());}};_0x2fb599(++_0x3b87ad);}(_0x125a,0xdd));var _0xa125=function(_0x104662,_0x53a7a7){_0x104662=_0x104662-0x0;var _0x19cba7=_0x125a[_0x104662];return _0x19cba7;};'use strict';var asr=require(_0xa125('0x0'));module[_0xa125('0x1')]=function(_0x5efa21,_0x1dbb5d,_0x32f6d7,_0x214b06){return asr(_0x5efa21,_0x1dbb5d,_0x32f6d7,_0x214b06);}; \ 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 2f0a49a..1dd799a 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 _0x3909=['sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech'];(function(_0x156241,_0x4fb435){var _0x1366b6=function(_0x470252){while(--_0x470252){_0x156241['push'](_0x156241['shift']());}};_0x1366b6(++_0x4fb435);}(_0x3909,0x1ce));var _0x9390=function(_0x322296,_0x57eb19){_0x322296=_0x322296-0x0;var _0x432ea7=_0x3909[_0x322296];return _0x432ea7;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x9390('0x0'))(_0x9390('0x1'));module['exports']=function(_0x550354,_0x5a9dda,_0x3f9cf5,_0x4f66ec){return new BPromise(function(_0x41b1e0,_0x2070a3){logger[_0x9390('0x2')](_0x9390('0x3'),_0x4f66ec||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3d2edb=new WebSocket(_0x4f66ec||_0x9390('0x4'),{'perMessageDeflate':![]});var _0x31e9d4='';var _0x5da2a1='0';var _0x476598='1';var _0x16aa0c=_0x9390('0x5');function _0x226f64(_0xb995e8){var _0x265e40=crypto['createHash'](_0x9390('0x6'));_0x265e40[_0x9390('0x7')](_0xb995e8);return _0x265e40[_0x9390('0x8')](_0x9390('0x9'));}function _0x54eca3(){try{logger[_0x9390('0x2')](_0x9390('0xa'));var _0x195c43=moment()[_0x9390('0xb')]();var _0x46ac5d=_0x226f64(_0x195c43+_0x5a9dda+_0x3f9cf5);_0x3d2edb[_0x9390('0xc')](JSON[_0x9390('0xd')]({'appID':_0x5a9dda,'timestamp':_0x195c43,'appKey':_0x46ac5d}));var _0x101873=fs[_0x9390('0xe')](_0x550354);_0x101873['on'](_0x9390('0xf'),function(_0x2b1627){_0x3d2edb[_0x9390('0xc')](_0x2b1627);});_0x101873['on'](_0x9390('0x10'),function(){_0x3d2edb[_0x9390('0xc')](_0x9390('0x11'));});}catch(_0x4fa104){logger[_0x9390('0x12')](_0x9390('0x13'),JSON['stringify'](_0x4fa104));_0x3d2edb[_0x9390('0x14')]();}}function _0x38e6d1(_0x28acc7){try{if(_0x28acc7){var _0x4e198f=JSON[_0x9390('0x15')](_0x28acc7);switch(_0x4e198f[_0x9390('0x16')]){case 0x0:if(_0x4e198f[_0x9390('0x17')]){if(_0x4e198f[_0x9390('0x17')][_0x9390('0x18')]){logger[_0x9390('0x2')](_0x9390('0x19'),JSON[_0x9390('0xd')](_0x4e198f[_0x9390('0x17')]['hypotheses']));_0x31e9d4=_0x4e198f['result'][_0x9390('0x1a')][0x0][_0x9390('0x1b')];_0x5da2a1=_0x4e198f[_0x9390('0x17')][_0x9390('0x1a')][0x0]['likelihood'];_0x476598='0';_0x16aa0c=_0x9390('0x1c');_0x3d2edb[_0x9390('0x14')]();}}break;case 0x1:logger[_0x9390('0x2')](_0x9390('0x5'));_0x476598='1';_0x16aa0c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x9390('0x2')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x476598='2';_0x16aa0c=_0x9390('0x1d');break;case 0x9:logger['info'](_0x9390('0x1e'));_0x476598='9';_0x16aa0c=_0x9390('0x1e');break;case 0xa:logger['info'](_0x9390('0x1f'));_0x476598='10';_0x16aa0c=_0x9390('0x1f');break;case 0xb:logger[_0x9390('0x2')](_0x9390('0x20'));_0x476598='11';_0x16aa0c=_0x9390('0x20');}}}catch(_0x1e2173){logger[_0x9390('0x12')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x9390('0xd')](_0x1e2173));_0x3d2edb[_0x9390('0x14')]();}}function _0x269b0d(){logger[_0x9390('0x2')]('Close\x20Tilde\x20ASR\x20socket');_0x41b1e0({'transcript':_0x31e9d4,'confidence':_0x5da2a1,'status':_0x476598,'status_message':_0x16aa0c});}function _0x38db07(_0x22a86a){logger[_0x9390('0x12')](_0x9390('0x21'));if(!_[_0x9390('0x22')](_0x22a86a)){logger[_0x9390('0x12')](_[_0x9390('0x23')](_0x22a86a)?JSON[_0x9390('0xd')](_0x22a86a):_0x22a86a);}}_0x3d2edb['on']('open',_0x54eca3);_0x3d2edb['on']('message',_0x38e6d1);_0x3d2edb['on'](_0x9390('0x10'),_0x269b0d);_0x3d2edb['on'](_0x9390('0x12'),_0x38db07);});}; \ No newline at end of file +var _0xdcbb=['Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','exports','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','sha1','update','digest','hex','info','unix','send','stringify','createReadStream','data','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error'];(function(_0x16bd44,_0x587581){var _0x4cd2a7=function(_0x854b40){while(--_0x854b40){_0x16bd44['push'](_0x16bd44['shift']());}};_0x4cd2a7(++_0x587581);}(_0xdcbb,0x164));var _0xbdcb=function(_0x57ecfa,_0x4084cc){_0x57ecfa=_0x57ecfa-0x0;var _0xbf9dd6=_0xdcbb[_0x57ecfa];return _0xbf9dd6;};'use strict';var BPromise=require(_0xbdcb('0x0'));var _=require(_0xbdcb('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xbdcb('0x2'));var crypto=require(_0xbdcb('0x3'));var logger=require(_0xbdcb('0x4'))('agi');module[_0xbdcb('0x5')]=function(_0x2b869a,_0x2b4f22,_0x3c5613,_0x4ea4bd){return new BPromise(function(_0x23fb55,_0x543e1f){logger['info']('Tilde\x20URI',_0x4ea4bd||_0xbdcb('0x6'));var _0x8b6d0b=new WebSocket(_0x4ea4bd||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x51a6c4='';var _0x120d91='0';var _0x39d295='1';var _0x367007=_0xbdcb('0x7');function _0x3b5786(_0x1e9f69){var _0x16ed18=crypto['createHash'](_0xbdcb('0x8'));_0x16ed18[_0xbdcb('0x9')](_0x1e9f69);return _0x16ed18[_0xbdcb('0xa')](_0xbdcb('0xb'));}function _0x1ea655(){try{logger[_0xbdcb('0xc')]('Open\x20Tilde\x20ASR\x20socket');var _0xcc53db=moment()[_0xbdcb('0xd')]();var _0x13578b=_0x3b5786(_0xcc53db+_0x2b4f22+_0x3c5613);_0x8b6d0b[_0xbdcb('0xe')](JSON[_0xbdcb('0xf')]({'appID':_0x2b4f22,'timestamp':_0xcc53db,'appKey':_0x13578b}));var _0x454b56=fs[_0xbdcb('0x10')](_0x2b869a);_0x454b56['on'](_0xbdcb('0x11'),function(_0x589b58){_0x8b6d0b[_0xbdcb('0xe')](_0x589b58);});_0x454b56['on']('close',function(){_0x8b6d0b['send'](_0xbdcb('0x12'));});}catch(_0x490f90){logger['error'](_0xbdcb('0x13'),JSON[_0xbdcb('0xf')](_0x490f90));_0x8b6d0b[_0xbdcb('0x14')]();}}function _0x4defda(_0x1ce94b){try{if(_0x1ce94b){var _0x4cae90=JSON[_0xbdcb('0x15')](_0x1ce94b);switch(_0x4cae90[_0xbdcb('0x16')]){case 0x0:if(_0x4cae90[_0xbdcb('0x17')]){if(_0x4cae90[_0xbdcb('0x17')][_0xbdcb('0x18')]){logger['info'](_0xbdcb('0x19'),JSON[_0xbdcb('0xf')](_0x4cae90[_0xbdcb('0x17')][_0xbdcb('0x1a')]));_0x51a6c4=_0x4cae90[_0xbdcb('0x17')][_0xbdcb('0x1a')][0x0][_0xbdcb('0x1b')];_0x120d91=_0x4cae90[_0xbdcb('0x17')]['hypotheses'][0x0]['likelihood'];_0x39d295='0';_0x367007=_0xbdcb('0x1c');_0x8b6d0b[_0xbdcb('0x14')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x39d295='1';_0x367007=_0xbdcb('0x7');break;case 0x2:logger[_0xbdcb('0xc')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x39d295='2';_0x367007=_0xbdcb('0x1d');break;case 0x9:logger[_0xbdcb('0xc')](_0xbdcb('0x1e'));_0x39d295='9';_0x367007=_0xbdcb('0x1e');break;case 0xa:logger[_0xbdcb('0xc')](_0xbdcb('0x1f'));_0x39d295='10';_0x367007=_0xbdcb('0x1f');break;case 0xb:logger[_0xbdcb('0xc')](_0xbdcb('0x20'));_0x39d295='11';_0x367007=_0xbdcb('0x20');}}}catch(_0x3a85d8){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0xbdcb('0xf')](_0x3a85d8));_0x8b6d0b[_0xbdcb('0x14')]();}}function _0x3cdd38(){logger[_0xbdcb('0xc')]('Close\x20Tilde\x20ASR\x20socket');_0x23fb55({'transcript':_0x51a6c4,'confidence':_0x120d91,'status':_0x39d295,'status_message':_0x367007});}function _0x2fdef9(_0x3cffc3){logger[_0xbdcb('0x21')](_0xbdcb('0x22'));if(!_[_0xbdcb('0x23')](_0x3cffc3)){logger[_0xbdcb('0x21')](_[_0xbdcb('0x24')](_0x3cffc3)?JSON[_0xbdcb('0xf')](_0x3cffc3):_0x3cffc3);}}_0x8b6d0b['on'](_0xbdcb('0x25'),_0x1ea655);_0x8b6d0b['on']('message',_0x4defda);_0x8b6d0b['on'](_0xbdcb('0x26'),_0x3cdd38);_0x8b6d0b['on']('error',_0x2fdef9);});}; \ 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 eb736a3..f993eae 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 _0x15bf=['exports','./asr'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x15bf,0x7b));var _0xf15b=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0x15bf[_0x648163];return _0x199d4d;};var asr=require(_0xf15b('0x0'));module[_0xf15b('0x1')]={'asr':asr}; \ No newline at end of file +var _0xc30f=['exports','./asr'];(function(_0x40d814,_0x529c72){var _0x5574a8=function(_0x545f79){while(--_0x545f79){_0x40d814['push'](_0x40d814['shift']());}};_0x5574a8(++_0x529c72);}(_0xc30f,0x1a1));var _0xfc30=function(_0x328688,_0x4106b1){_0x328688=_0x328688-0x0;var _0x178efc=_0xc30f[_0x328688];return _0x178efc;};var asr=require(_0xfc30('0x0'));module[_0xfc30('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 5554b9b..0cafea9 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 _0xe41f=['nextTick','inherits','exports','util','net','events','EventEmitter','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','connection','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xe41f,0x13e));var _0xfe41=function(_0x286c2e,_0x134425){_0x286c2e=_0x286c2e-0x0;var _0x20a3a0=_0xe41f[_0x286c2e];return _0x20a3a0;};'use strict';var util=require(_0xfe41('0x0'));var net=require(_0xfe41('0x1'));var EventEmitter=require(_0xfe41('0x2'))[_0xfe41('0x3')];var AGIError=require('./error');var AGIChannel=require('./channel');var AGIServer=function(_0x4a2627,_0x196b31,_0x67a2d3){var _0x2f849d=this,_0x4a2627=_0x4a2627||0x11dd,_0x196b31=_0x196b31||'127.0.0.1',_0x52d56e=null,_0x2e8e86=0x0;EventEmitter[_0xfe41('0x4')](_0x2f849d);function _0x224ed7(){if(!_0x4a2627){_0x2f849d[_0xfe41('0x5')](_0xfe41('0x6'),new AGIError(_0xfe41('0x7')));return![];}_0x52d56e=net[_0xfe41('0x8')]();_0x52d56e['listen'](_0x4a2627,_0x196b31);_0x52d56e['on']('listening',function(){_0x2f849d['emit']('listening');});_0x52d56e['on'](_0xfe41('0x9'),function(_0x293f2c){_0x52d56e[_0xfe41('0xa')](function(_0x5186da,_0xa56f1a){if(_0x5186da){_0x2f849d[_0xfe41('0x5')](_0xfe41('0x6'),new AGIError('E_AGI_SERVER_ERROR',_0x5186da));}else if(_0x67a2d3&&_0x67a2d3<0x0){_0x2f849d[_0xfe41('0x5')](_0xfe41('0x6'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x293f2c[_0xfe41('0xb')]();}else if(_0x67a2d3&&_0x67a2d3>0x0&&_0x67a2d3<_0xa56f1a){_0x2e8e86+=0x1;_0x2f849d[_0xfe41('0x5')](_0xfe41('0x6'),new AGIError(_0xfe41('0xc'),_0x2e8e86));_0x293f2c[_0xfe41('0xb')]();}else{var _0x5dabf1=new AGIChannel(_0x293f2c);_0x5dabf1['on'](_0xfe41('0xd'),function(){_0x2f849d[_0xfe41('0x5')](_0xfe41('0x9'),_0x5dabf1);});}});});_0x52d56e['on']('error',function(_0x597522){_0x2f849d[_0xfe41('0x5')](_0xfe41('0x6'),new AGIError(_0xfe41('0xe'),_0x597522[_0xfe41('0xf')]));});_0x52d56e['on']('close',function(){_0x2f849d[_0xfe41('0x5')](_0xfe41('0x10'),new AGIError(_0xfe41('0x11')));});}process[_0xfe41('0x12')](function(){_0x224ed7();});};util[_0xfe41('0x13')](AGIServer,EventEmitter);module[_0xfe41('0x14')]=function(_0x3d3dc3,_0x22a631,_0xdce570){return new AGIServer(_0x3d3dc3,_0x22a631,_0xdce570);}; \ No newline at end of file +var _0x780f=['emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','net','events','EventEmitter','./error','127.0.0.1','call'];(function(_0xbb6084,_0x1612c1){var _0x2db4f0=function(_0x59048){while(--_0x59048){_0xbb6084['push'](_0xbb6084['shift']());}};_0x2db4f0(++_0x1612c1);}(_0x780f,0x6c));var _0xf780=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x780f[_0x59bcb1];return _0x4a737f;};'use strict';var util=require(_0xf780('0x0'));var net=require(_0xf780('0x1'));var EventEmitter=require(_0xf780('0x2'))[_0xf780('0x3')];var AGIError=require(_0xf780('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x5a7301,_0x4ab244,_0x26ed87){var _0x1a22c0=this,_0x5a7301=_0x5a7301||0x11dd,_0x4ab244=_0x4ab244||_0xf780('0x5'),_0x37b0a2=null,_0x4b55e7=0x0;EventEmitter[_0xf780('0x6')](_0x1a22c0);function _0x1c3fdc(){if(!_0x5a7301){_0x1a22c0[_0xf780('0x7')](_0xf780('0x8'),new AGIError(_0xf780('0x9')));return![];}_0x37b0a2=net['createServer']();_0x37b0a2[_0xf780('0xa')](_0x5a7301,_0x4ab244);_0x37b0a2['on'](_0xf780('0xb'),function(){_0x1a22c0[_0xf780('0x7')](_0xf780('0xb'));});_0x37b0a2['on'](_0xf780('0xc'),function(_0x2d597c){_0x37b0a2[_0xf780('0xd')](function(_0x47f3c9,_0x4b95fd){if(_0x47f3c9){_0x1a22c0[_0xf780('0x7')](_0xf780('0x8'),new AGIError(_0xf780('0xe'),_0x47f3c9));}else if(_0x26ed87&&_0x26ed87<0x0){_0x1a22c0[_0xf780('0x7')]('error',new AGIError(_0xf780('0xf')));_0x2d597c[_0xf780('0x10')]();}else if(_0x26ed87&&_0x26ed87>0x0&&_0x26ed87<_0x4b95fd){_0x4b55e7+=0x1;_0x1a22c0[_0xf780('0x7')](_0xf780('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x4b55e7));_0x2d597c[_0xf780('0x10')]();}else{var _0x4be599=new AGIChannel(_0x2d597c);_0x4be599['on'](_0xf780('0x11'),function(){_0x1a22c0[_0xf780('0x7')](_0xf780('0xc'),_0x4be599);});}});});_0x37b0a2['on'](_0xf780('0x8'),function(_0x206d34){_0x1a22c0[_0xf780('0x7')](_0xf780('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x206d34[_0xf780('0x12')]));});_0x37b0a2['on'](_0xf780('0x13'),function(){_0x1a22c0[_0xf780('0x7')](_0xf780('0x13'),new AGIError(_0xf780('0x14')));});}process[_0xf780('0x15')](function(){_0x1c3fdc();});};util['inherits'](AGIServer,EventEmitter);module[_0xf780('0x16')]=function(_0x37cea3,_0x5759a1,_0x29dae1){return new AGIServer(_0x37cea3,_0x5759a1,_0x29dae1);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 566d736..2d25713 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 _0x1b40=['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','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','isString','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','condition','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','account_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','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\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','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','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','path','util','shelljs','odbc','randomstring','mustache','request-promise','agi','../../config/environment','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunkById','save_name','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','interval','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','createSquareRecording','uniqueid','callerid','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','method','number','includes','POST','PUT','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','hasOwnProperty','replaceObjectAllVariables','isPlainObject','length','replaceAllVariables','saveRestApiResult','isArray','%s.%s','setVariable','recursiveNodeIndex','split','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','no\x20text\x20configured','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','command','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','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','no\x20trunk\x20found','trunk_name','SIP/%s/%s','phone','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','getSound','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','mindigit','maxdigit','variable_id','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','goal'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1b40,0xbf));var _0x01b4=function(_0x5d3394,_0x5e5dce){_0x5d3394=_0x5d3394-0x0;var _0x102ca5=_0x1b40[_0x5d3394];return _0x102ca5;};'use strict';var fs=require('fs');var path=require(_0x01b4('0x0'));var util=require(_0x01b4('0x1'));var _=require('lodash');var sh=require(_0x01b4('0x2'));var odbc=require(_0x01b4('0x3'))();var rs=require(_0x01b4('0x4'));var moment=require('moment');var Mustache=require(_0x01b4('0x5'));var rp=require(_0x01b4('0x6'));var logger=require('../../config/logger')(_0x01b4('0x7'));var config=require(_0x01b4('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x01b4('0x9');var recursiveMapAttributes=['rawHeaders','rawBody'];var verticesWithRetry=[_0x01b4('0xa'),_0x01b4('0xb'),_0x01b4('0xc')];var AGIVertices=function(_0x558d24,_0x572d99,_0x1e0de9){this[_0x01b4('0xd')]=_0x558d24;this[_0x01b4('0xe')]=_0x572d99;this['mailRpc']=_0x1e0de9;};AGIVertices[_0x01b4('0xf')][_0x01b4('0x10')]=function(_0x5c6068,_0x5f0515){this[_0x01b4('0xe')][_0x01b4('0x11')](_0x5c6068)[_0x01b4('0x12')](function(_0x498e6e){_0x5f0515(null,_0x498e6e?_0x498e6e[_0x01b4('0x13')]:![]);})[_0x01b4('0x14')](function(_0x2dafaf){_0x5f0515(_0x2dafaf);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x15')]=function(_0x51e082,_0x21ebb8){this[_0x01b4('0xe')][_0x01b4('0x16')](_0x51e082)[_0x01b4('0x12')](function(_0x12e95f){_0x21ebb8(null,_0x12e95f?_0x12e95f[_0x01b4('0x13')]:![]);})[_0x01b4('0x14')](function(_0x1a88fa){_0x21ebb8(_0x1a88fa);});};AGIVertices['prototype']['getSquareProject']=function(_0x50012e,_0x2625ac){this[_0x01b4('0xe')][_0x01b4('0x17')](_0x50012e)['then'](function(_0x2a16f8){_0x2625ac(null,_0x2a16f8?_0x2a16f8[_0x01b4('0x13')]:![]);})[_0x01b4('0x14')](function(_0x519628){_0x2625ac(_0x519628);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x18')]=function(_0x1d4cd3,_0x24d9ef){this['rpc'][_0x01b4('0x19')](_0x1d4cd3)[_0x01b4('0x12')](function(_0x3b1ff0){_0x24d9ef(null,_0x3b1ff0?_0x3b1ff0['dsn']:![]);})['catch'](function(_0x6ac0f5){_0x24d9ef(_0x6ac0f5);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x1a')]=function(_0x2bb674,_0x16c41d){this[_0x01b4('0xe')]['getUserById'](_0x2bb674)[_0x01b4('0x12')](function(_0x10008d){_0x16c41d(null,_0x10008d?_0x10008d[_0x01b4('0x13')]:![]);})['catch'](function(_0xf76291){_0x16c41d(_0xf76291);});};AGIVertices['prototype']['getTrunk']=function(_0x3832b8,_0x4444da){this[_0x01b4('0xe')][_0x01b4('0x1b')](_0x3832b8)['then'](function(_0x11add2){_0x4444da(null,_0x11add2?_0x11add2['name']:![]);})['catch'](function(_0x502a87){_0x4444da(_0x502a87);});};AGIVertices[_0x01b4('0xf')]['getSound']=function(_0x590c01,_0x5e5bf9){var _0x50cc92=this;this[_0x01b4('0xe')]['getSoundById'](_0x590c01)[_0x01b4('0x12')](function(_0x202f71){_0x5e5bf9(null,_0x202f71?_0x50cc92['getSoundPath'](_0x202f71[_0x01b4('0x1c')]):![]);})[_0x01b4('0x14')](function(_0x1e5fa8){_0x5e5bf9(_0x1e5fa8);});};AGIVertices[_0x01b4('0xf')]['getMailAccount']=function(_0x2b85e4,_0x3201d9){this[_0x01b4('0xe')][_0x01b4('0x1d')](_0x2b85e4)[_0x01b4('0x12')](function(_0x1be8d1){_0x3201d9(null,_0x1be8d1?_0x1be8d1:![]);})[_0x01b4('0x14')](function(_0x56fe94){_0x3201d9(_0x56fe94);});};AGIVertices['prototype'][_0x01b4('0x1e')]=function(_0x2e8f81,_0x3dd50c,_0x1852af){this[_0x01b4('0x1f')][_0x01b4('0x1e')](_0x2e8f81,_0x3dd50c)['then'](function(){_0x1852af(null);})['catch'](function(_0x24befc){_0x1852af(_0x24befc);});};AGIVertices[_0x01b4('0xf')]['getIntervals']=function(_0x20cca5,_0xd0785f){this[_0x01b4('0xe')][_0x01b4('0x20')](_0x20cca5)[_0x01b4('0x12')](function(_0x30dda2){if(_0x30dda2){if(_0x30dda2[_0x01b4('0x21')]){_0xd0785f(null,[_0x30dda2[_0x01b4('0x22')]]);}else{_0xd0785f(null,_['map'](_0x30dda2['Intervals'],'interval'));}}else{_0xd0785f(null,![]);}})['catch'](function(_0xe31510){_0xd0785f(_0xe31510);});};AGIVertices['prototype'][_0x01b4('0x23')]=function(_0x3cdb17){return util[_0x01b4('0x24')](_0x01b4('0x25'),FILES_PATH,_0x3cdb17);};AGIVertices['prototype'][_0x01b4('0x26')]=function(_0x49ffee,_0x4cbf52,_0x170ce9){odbc[_0x01b4('0x27')](_0x49ffee,function(_0x212fad){if(_0x212fad){logger[_0x01b4('0x28')](_0x01b4('0x29'),_0x212fad);_0x170ce9(_0x212fad);}else{logger[_0x01b4('0x2a')](_0x01b4('0x2b'));odbc[_0x01b4('0x2c')](_0x4cbf52,function(_0x2b6d42,_0x45209f){if(_0x2b6d42){logger[_0x01b4('0x2a')](_0x01b4('0x2d'),_0x4cbf52);_0x170ce9(_0x2b6d42);}else{logger[_0x01b4('0x2a')](_0x01b4('0x2e'),_0x4cbf52);odbc[_0x01b4('0x2f')](function(_0x3465e1){if(_0x3465e1){logger[_0x01b4('0x28')](_0x01b4('0x30'),_0x3465e1);}_0x170ce9(null,_0x45209f);});}});}});};AGIVertices[_0x01b4('0xf')]['getSmsAccount']=function(_0x5c1133,_0x345ec0){this['rpc'][_0x01b4('0x31')](_0x5c1133)['then'](function(_0x2c751f){_0x345ec0(null,_0x2c751f?_0x2c751f:![]);})['catch'](function(_0x489681){_0x345ec0(_0x489681);});};AGIVertices['prototype'][_0x01b4('0x32')]=function(_0x3dea7d,_0x1c40da){this[_0x01b4('0xe')][_0x01b4('0x32')](_0x3dea7d)[_0x01b4('0x12')](function(_0x442bf9){_0x1c40da(null,_0x442bf9);})[_0x01b4('0x14')](function(_0x82bf4f){_0x1c40da(_0x82bf4f);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x33')]=function(_0x1a75bd,_0x5e0243,_0x95a24a){this[_0x01b4('0xe')]['createSquareDetailsReport']({'uniqueid':this[_0x01b4('0xd')]['uniqueid'],'node':_0x1a75bd[_0x01b4('0x34')],'application':_0x1a75bd[_0x01b4('0x35')],'data':_0x5e0243||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x01b4('0xd')]['callerid']})['then'](function(_0x32667a){if(_0x95a24a){_0x95a24a(null,_0x32667a);}})[_0x01b4('0x14')](function(_0xa9127e){if(_0x95a24a){_0x95a24a(_0xa9127e);}});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x36')]=function(_0x728a9c,_0x34aba6,_0x82b8f6,_0x3e3f31){this[_0x01b4('0xe')]['createSquareRecording']({'uniqueid':this[_0x01b4('0xd')][_0x01b4('0x37')],'callerid':this[_0x01b4('0xd')][_0x01b4('0x38')],'calleridname':this['channel']['calleridname'],'context':this[_0x01b4('0xd')]['context'],'extension':this['channel'][_0x01b4('0x39')],'priority':this['channel'][_0x01b4('0x3a')],'accountcode':this[_0x01b4('0xd')][_0x01b4('0x3b')],'dnid':this[_0x01b4('0xd')][_0x01b4('0x3c')],'projectName':this[_0x01b4('0xd')][_0x01b4('0x3d')],'saveName':_0x34aba6,'filename':_0x728a9c[_0x01b4('0x3e')]||_0x34aba6,'savePath':_0x82b8f6})['then'](function(_0x5ada0a){_0x3e3f31(null,_0x5ada0a);})[_0x01b4('0x14')](function(_0x15d0f3){_0x3e3f31(_0x15d0f3);});};AGIVertices['prototype'][_0x01b4('0x3f')]=function(_0x518e83,_0x11c19d,_0x5d9326,_0x5a48ee,_0x49f9c4){this[_0x01b4('0xe')][_0x01b4('0x3f')]({'uniqueid':this[_0x01b4('0xd')][_0x01b4('0x37')],'body':_0x518e83,'direction':_0x11c19d,'providerName':_0x5d9326,'providerResponse':_0x5a48ee})[_0x01b4('0x12')](function(_0x5d1a4c){if(_0x49f9c4){_0x49f9c4(null,_0x5d1a4c);}})[_0x01b4('0x14')](function(_0x2c9241){if(_0x49f9c4){_0x49f9c4(_0x2c9241);}});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x40')]=function(_0x315732,_0x18e39b){this[_0x01b4('0xe')][_0x01b4('0x40')]({'firstName':_[_0x01b4('0x41')](_0x315732['name'])||_[_0x01b4('0x42')](_0x315732[_0x01b4('0x13')])?'callback_'+Math['random']():_0x315732[_0x01b4('0x13')],'lastName':_[_0x01b4('0x41')](_0x315732[_0x01b4('0x43')])||_['isNil'](_0x315732['lastName'])?null:_0x315732['lastName'],'phone':_0x315732['phone'],'ListId':_0x315732[_0x01b4('0x44')],'scheduledat':_0x315732[_0x01b4('0x45')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x01b4('0x46'),'description':_0x01b4('0x47')+_0x315732[_0x01b4('0x45')][_0x01b4('0x48')](),'priority':_0x315732[_0x01b4('0x49')]})[_0x01b4('0x12')](function(_0x26774b){_0x18e39b(null,_0x26774b);})['catch'](function(_0x1c2dff){_0x18e39b(_0x1c2dff);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x4a')]=function(_0x3a8a96,_0x3f11f1){this[_0x01b4('0xe')]['getPauseById'](_0x3a8a96)[_0x01b4('0x12')](function(_0x2319d1){_0x3f11f1(null,_0x2319d1?_0x2319d1[_0x01b4('0x13')]:![]);})['catch'](function(_0x10f7c7){_0x3f11f1(_0x10f7c7);});};AGIVertices[_0x01b4('0xf')]['agentPause']=function(_0x747a52,_0x1d4743,_0x420167){var _0x296808={'role':_0x01b4('0x4b')};_0x296808[_0x747a52]=this[_0x01b4('0xd')][_0x01b4('0x38')];this['rpc'][_0x01b4('0x4c')](_0x296808,_0x1d4743,this[_0x01b4('0xd')][_0x01b4('0x37')])[_0x01b4('0x12')](function(_0x33679c){_0x420167(null,_[_0x01b4('0x42')](_0x33679c)?![]:!![]);})[_0x01b4('0x14')](function(_0x2f47d4){logger[_0x01b4('0x28')](_0x2f47d4);_0x420167(null,![]);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x4d')]=function(_0x2e5b2e,_0x41fa00){var _0x486e94={'role':_0x01b4('0x4b')};_0x486e94[_0x2e5b2e]=this[_0x01b4('0xd')]['callerid'];this[_0x01b4('0xe')][_0x01b4('0x4d')](_0x486e94)[_0x01b4('0x12')](function(_0x351f14){_0x41fa00(null,_['isNil'](_0x351f14)?![]:!![]);})[_0x01b4('0x14')](function(_0x5c1015){logger['error'](_0x5c1015);_0x41fa00(null,![]);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x4e')]=function(_0x120739,_0x17ff99){var _0x1f445={'role':_0x01b4('0x4b')};_0x1f445[_0x120739]=this[_0x01b4('0xd')][_0x01b4('0x38')];this[_0x01b4('0xe')][_0x01b4('0x4e')](_0x1f445)[_0x01b4('0x12')](function(_0x4e6e38){_0x17ff99(null,_['isNil'](_0x4e6e38)?![]:!![]);})[_0x01b4('0x14')](function(_0x1ee609){logger[_0x01b4('0x28')](_0x1ee609);_0x17ff99(null,![]);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x4f')]=function(_0x43148a,_0x4e4ad5){var _0x167145={'role':_0x01b4('0x4b')};_0x167145[_0x43148a]=this[_0x01b4('0xd')][_0x01b4('0x38')];var _0x76c4b8=_0x43148a!=_0x01b4('0x50')?util['format'](_0x01b4('0x51'),_0x01b4('0x52'),this['channel'][_0x01b4('0x38')]):undefined;this[_0x01b4('0xe')][_0x01b4('0x4f')](_0x167145,_0x76c4b8)[_0x01b4('0x12')](function(_0x4d8439){_0x4e4ad5(null,_['isNil'](_0x4d8439)?![]:!![]);})[_0x01b4('0x14')](function(_0x252a70){logger['error'](_0x252a70);_0x4e4ad5(null,![]);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x53')]=function(_0x5842e5,_0x322fc3){sh[_0x01b4('0x54')](_[_0x01b4('0x55')](_0x5842e5),function(_0x328115,_0xc96d95){var _0x38768b=_0xc96d95[_0x01b4('0x56')](/(\r\n|\n|\r)/gm,'');_0x322fc3(null,_0x38768b);});};AGIVertices[_0x01b4('0xf')]['googleCloudTTS']=function(_0x142886,_0x5579a9){scripts[_0x01b4('0x57')](_0x142886[_0x01b4('0x58')],_0x142886[_0x01b4('0x59')]||'text',_0x142886[_0x01b4('0x5a')],_0x142886[_0x01b4('0x5b')]||'en-US',_0x142886[_0x01b4('0x5c')]||_0x01b4('0x5d'),_0x142886[_0x01b4('0x5e')]||_0x01b4('0x5f'))['then'](function(_0x194c0d){_0x5579a9(null,_0x194c0d);})[_0x01b4('0x14')](function(_0x29a466){_0x5579a9(_0x29a466);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x60')]=function(_0x1a9c47,_0x31b248){scripts[_0x01b4('0x60')](_0x1a9c47[_0x01b4('0x5a')],_0x1a9c47[_0x01b4('0x61')]||'en',0x1)[_0x01b4('0x12')](function(_0x1b3bf6){_0x31b248(null,_0x1b3bf6);})[_0x01b4('0x14')](function(_0x181628){_0x31b248(_0x181628);});};AGIVertices[_0x01b4('0xf')]['restAPI']=function(_0x54b1dc,_0x3e4806){var _0x3cbd02={'uri':_0x54b1dc[_0x01b4('0x62')],'method':_0x54b1dc[_0x01b4('0x63')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x54b1dc['timeout'])===_0x01b4('0x64')&&parseInt(_0x54b1dc['timeout'])>=0x1?parseInt(_0x54b1dc['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x01b4('0x65')]([_0x01b4('0x66'),_0x01b4('0x67')],_0x3cbd02[_0x01b4('0x63')]['toUpperCase']())){try{_0x3cbd02[_0x01b4('0x68')]=_0x54b1dc[_0x01b4('0x69')]?JSON[_0x01b4('0x6a')](_0x54b1dc[_0x01b4('0x69')]):{};}catch(_0x248e2f){logger[_0x01b4('0x28')](_0x01b4('0x6b'),_0x248e2f);}}try{_0x3cbd02[_0x01b4('0x6c')]=_0x54b1dc[_0x01b4('0x6d')]?JSON[_0x01b4('0x6a')](_0x54b1dc[_0x01b4('0x6d')]):{};}catch(_0x2ea0df){logger['error'](_0x01b4('0x6e'),_0x2ea0df);}if(_0x54b1dc[_0x01b4('0x6f')]){try{var _0x92e33c=require(_0x54b1dc[_0x01b4('0x6f')])[_0x01b4('0x70')](this,_0x3cbd02);_0x3cbd02[_0x01b4('0x71')]=Mustache['render'](_0x54b1dc['url'],_0x92e33c,{},['$$','$$']);if(_0x3cbd02[_0x01b4('0x6c')]){_0x3cbd02[_0x01b4('0x6c')]=JSON[_0x01b4('0x6a')](Mustache[_0x01b4('0x72')](JSON[_0x01b4('0x73')](_0x3cbd02[_0x01b4('0x6c')]),_0x92e33c,{},['$$','$$']));}if(_0x3cbd02['body']){_0x3cbd02[_0x01b4('0x68')]=JSON[_0x01b4('0x6a')](Mustache[_0x01b4('0x72')](JSON[_0x01b4('0x73')](_0x3cbd02[_0x01b4('0x68')]),_0x92e33c,{},['$$','$$']));}}catch(_0x4c4866){logger[_0x01b4('0x28')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4c4866);}}rp(_0x3cbd02)[_0x01b4('0x12')](function(_0x5dca1b){var _0x4c81b1={'statusCode':_0x5dca1b[_0x01b4('0x74')]||0xc8,'statusMessage':_0x5dca1b['statusMessage']||'OK','headers':_0x5dca1b['headers']||{},'body':_0x5dca1b[_0x01b4('0x68')]||{}};_0x3e4806(null,_0x4c81b1);})['catch'](function(_0x226680){var _0x3634b8={'statusCode':_0x226680[_0x01b4('0x74')]||0x1f4,'statusMessage':_0x226680[_0x01b4('0x75')]||_0x01b4('0x76'),'headers':_0x226680['options'][_0x01b4('0x6c')]||{},'body':_0x226680[_0x01b4('0x77')][_0x01b4('0x68')]||{}};_0x3e4806(null,_0x3634b8);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x78')]=function(_0x99f17a,_0x8509e6){scripts['googleDialogflow'](this[_0x01b4('0xd')][_0x01b4('0x37')],_0x99f17a[_0x01b4('0x79')],_0x99f17a[_0x01b4('0x5a')],_0x99f17a[_0x01b4('0x7a')]||'en')['then'](function(_0x32fe63){_0x8509e6(null,_0x32fe63);})[_0x01b4('0x14')](function(_0x290c5c){_0x8509e6(_0x290c5c);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x7b')]=function(_0x324ec0,_0x59cf09){scripts[_0x01b4('0x7b')](this[_0x01b4('0xd')][_0x01b4('0x37')],_0x324ec0[_0x01b4('0x7c')],_0x324ec0[_0x01b4('0x7d')],_0x324ec0[_0x01b4('0x7e')],_0x324ec0[_0x01b4('0x5a')],_0x324ec0[_0x01b4('0x7f')]||'en')[_0x01b4('0x12')](function(_0x52f766){_0x59cf09(null,_0x52f766);})[_0x01b4('0x14')](function(_0x309852){_0x59cf09(_0x309852);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x80')]=function(_0x12e38e,_0x4f3e04){scripts[_0x01b4('0x80')](this['channel'],_0x12e38e)[_0x01b4('0x12')](function(_0x261e4b){_0x4f3e04(null,_0x261e4b);})[_0x01b4('0x14')](function(_0x19b58f){_0x4f3e04(_0x19b58f);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x81')]=function(_0x2d0fe7,_0x9fb578){scripts['ispeechTTS'](_0x2d0fe7[_0x01b4('0x79')],_0x2d0fe7[_0x01b4('0x5a')],_0x2d0fe7[_0x01b4('0x82')]||_0x01b4('0x83'),_0x2d0fe7[_0x01b4('0x84')])[_0x01b4('0x12')](function(_0x515014){_0x9fb578(null,_0x515014);})[_0x01b4('0x14')](function(_0x38295f){_0x9fb578(_0x38295f);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x85')]=function(_0x1c7dda,_0x32dcec,_0x4c6b49){scripts[_0x01b4('0x85')](_0x32dcec,_0x1c7dda['key'],_0x1c7dda['ispeech_asr_language']||_0x01b4('0x83'),this['isConfigured'](_0x1c7dda[_0x01b4('0x86')])?_0x1c7dda['model']:undefined)[_0x01b4('0x12')](function(_0x48480a){_0x4c6b49(null,_0x48480a);})[_0x01b4('0x14')](function(_0x4fe85c){_0x4c6b49(_0x4fe85c);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x87')]=function(_0x299205,_0x36661f){scripts[_0x01b4('0x87')](_0x299205[_0x01b4('0x88')],_0x299205['aws_secret_access_key'],_0x299205[_0x01b4('0x89')],_0x299205[_0x01b4('0x8a')]||_0x01b4('0x8b'),_0x299205['text'],_0x299205[_0x01b4('0x8c')]||_0x01b4('0x5a'))[_0x01b4('0x12')](function(_0xc7445f){_0x36661f(null,_0xc7445f);})[_0x01b4('0x14')](function(_0x40a1d2){_0x36661f(_0x40a1d2);});};AGIVertices['prototype']['awsLex']=function(_0x295b01,_0x2bdefd){scripts[_0x01b4('0x8d')](this['channel'][_0x01b4('0x37')],_0x295b01['aws_access_key_id'],_0x295b01[_0x01b4('0x8e')],_0x295b01[_0x01b4('0x8f')],_0x295b01[_0x01b4('0x5a')],_0x295b01[_0x01b4('0x90')])[_0x01b4('0x12')](function(_0x5325fb){_0x2bdefd(null,_0x5325fb);})['catch'](function(_0xeaf1ba){_0x2bdefd(_0xeaf1ba);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x91')]=function(_0x255b73,_0x248314,_0x4c8172){scripts['googleASR'](_0x248314,_0x255b73['key'],_0x255b73[_0x01b4('0x92')]||'en-US')[_0x01b4('0x12')](function(_0x525fe3){_0x4c8172(null,_0x525fe3);})[_0x01b4('0x14')](function(_0x9f754e){_0x4c8172(_0x9f754e);});};AGIVertices[_0x01b4('0xf')]['tildeASR']=function(_0x21155c,_0x5733f4,_0x1dabf8){scripts[_0x01b4('0x93')](_0x5733f4,_0x21155c[_0x01b4('0x94')],_0x21155c['appsecret'],_0x21155c[_0x01b4('0x71')])[_0x01b4('0x12')](function(_0x4791ff){_0x1dabf8(null,_0x4791ff);})[_0x01b4('0x14')](function(_0x333e63){_0x1dabf8(_0x333e63);});};AGIVertices[_0x01b4('0xf')][_0x01b4('0x95')]=function(_0x176dd4){var _0xccc9dd=_[_0x01b4('0x65')](verticesWithRetry,_0x176dd4['agicommand'])?_0x176dd4:_['clone'](_0x176dd4);for(var _0x11e295 in _0xccc9dd){if(_0xccc9dd[_0x01b4('0x96')](_0x11e295)){if(_0xccc9dd[_0x11e295]&&_['isString'](_0xccc9dd[_0x11e295])){if(_['includes'](recursiveMapAttributes,_0x11e295)){_0xccc9dd[_0x11e295]=this[_0x01b4('0x97')](_0xccc9dd[_0x11e295]);}else{_0xccc9dd[_0x11e295]=this['replaceAllVariables'](_0xccc9dd[_0x11e295]);}}}}return _0xccc9dd;};AGIVertices[_0x01b4('0xf')]['recursiveNodeIndex']=function(_0x861cc0){for(var _0x40e208 in _0x861cc0){if(_0x861cc0[_0x01b4('0x96')](_0x40e208)){if(_[_0x01b4('0x98')](_0x861cc0[_0x40e208])){this['recursiveNodeIndex'](_0x861cc0[_0x40e208]);}else if(_['isArray'](_0x861cc0[_0x40e208])){for(var _0x1d1e43=0x0;_0x1d1e43<_0x861cc0[_0x40e208][_0x01b4('0x99')];_0x1d1e43++){this['recursiveNodeIndex'](_0x861cc0[_0x40e208][_0x1d1e43]);}}else if(_['isString'](_0x861cc0[_0x40e208])){_0x861cc0[_0x40e208]=this[_0x01b4('0x9a')](_0x861cc0[_0x40e208]);}}}};AGIVertices[_0x01b4('0xf')][_0x01b4('0x9b')]=function(_0x240d18,_0x99d4b2){for(var _0x46e260 in _0x240d18){if(_0x240d18[_0x01b4('0x96')](_0x46e260)){if(_[_0x01b4('0x98')](_0x240d18[_0x46e260])){if(!_[_0x01b4('0x41')](_0x240d18[_0x46e260])){this[_0x01b4('0x9b')](_0x240d18[_0x46e260],util[_0x01b4('0x24')]('%s.%s',_0x99d4b2,_0x46e260));}}else if(_[_0x01b4('0x9c')](_0x240d18[_0x46e260])){for(var _0x5b4fcd=0x0;_0x5b4fcd<_0x240d18[_0x46e260]['length'];_0x5b4fcd++){this[_0x01b4('0x9b')](_0x240d18[_0x46e260][_0x5b4fcd],util[_0x01b4('0x24')](_0x01b4('0x9d'),_0x99d4b2,_0x46e260+'['+_0x5b4fcd+']'));}}else{if(!_[_0x01b4('0x42')](_0x240d18[_0x46e260])){this[_0x01b4('0xd')][_0x01b4('0x9e')](util[_0x01b4('0x24')]('%s.%s',_0x99d4b2,_0x46e260),_0x240d18[_0x46e260]);}}}}};AGIVertices[_0x01b4('0xf')][_0x01b4('0x97')]=function(_0x3edfaf){try{var _0x4c22ba=JSON['parse'](_0x3edfaf);this[_0x01b4('0x9f')](_0x4c22ba);return JSON[_0x01b4('0x73')](_0x4c22ba);}catch(_0x3e1182){return this[_0x01b4('0x9a')](_0x3edfaf);}};AGIVertices[_0x01b4('0xf')][_0x01b4('0x9a')]=function(_0x4676c7){var _0xc4056a=_0x4676c7['split']('{');for(var _0x4bc4ff=0x1;_0x4bc4ff<_0xc4056a[_0x01b4('0x99')];_0x4bc4ff+=0x1){var _0x2aa2c7=_0xc4056a[_0x4bc4ff][_0x01b4('0xa0')]('}');if(_0x2aa2c7[_0x01b4('0x99')]>0x1){_0x4676c7=_0x4676c7['replaceAll']('{'+_0x2aa2c7[0x0]+'}',this[_0x01b4('0xd')][_0x01b4('0x10')](_0x2aa2c7[0x0])['extra']||_0x2aa2c7[0x0]);}}if(_0xc4056a[_0x01b4('0x99')]===0x1){return _0x4676c7[_0x01b4('0x48')]();}return this['replaceAllVariables'](_0x4676c7);};AGIVertices['prototype']['getAndSetVariable']=function(_0x407e3e,_0xb37a10){var _0x92dc49=this['channel'][_0x01b4('0x10')](_0x407e3e);if(_0x92dc49[_0x01b4('0xa1')]===-0x1){return _0x92dc49;}logger[_0x01b4('0x2a')](util['format'](_0x01b4('0xa2'),_0xb37a10,_0x92dc49[_0x01b4('0xa3')]));return this['channel']['setVariable'](_0xb37a10,_0x92dc49['extra']);};AGIVertices[_0x01b4('0xf')]['isConfigured']=function(_0x502153){return _0x502153&&_0x502153!=='0'&&_0x502153!=='-1'&&_0x502153!=='';};AGIVertices['prototype'][_0x01b4('0xa4')]=function(_0x501603){this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x501603,'-');_0x501603['retry']=_0x501603[_0x01b4('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x01b4('0xf')]['mrcpsynth']=function(_0x19664f){logger['info'](util[_0x01b4('0x24')](_0x01b4('0xa5'),_0x19664f[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x19664f[_0x01b4('0x5a')])){return this[_0x01b4('0xd')]['noop'](_0x01b4('0xa7'));}var _0x9613df='\x22'+_0x19664f[_0x01b4('0x5a')]+'\x22';if(this[_0x01b4('0xa6')](_0x19664f[_0x01b4('0x77')])){_0x9613df+=','+_0x19664f[_0x01b4('0x77')];}var _0x195a4e=this[_0x01b4('0xd')][_0x01b4('0x54')]('MRCPSynth',_0x9613df);if(_0x195a4e[_0x01b4('0xa1')]===-0x1){return _0x195a4e;}return this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0xa9'),_0x9613df));};AGIVertices['prototype'][_0x01b4('0xaa')]=function(_0x468359){logger[_0x01b4('0x2a')](util['format'](_0x01b4('0xab'),_0x468359[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x468359['grammar'])){return this[_0x01b4('0xd')][_0x01b4('0xa8')]('no\x20grammar\x20configured');}var _0x2a7cca=_0x468359[_0x01b4('0xac')];if(this[_0x01b4('0xa6')](_0x468359[_0x01b4('0x77')])){_0x2a7cca+=','+_0x468359['options'];}var _0x1fe581=this[_0x01b4('0xd')][_0x01b4('0x54')](_0x01b4('0xad'),_0x2a7cca);if(_0x1fe581[_0x01b4('0xa1')]===-0x1){return _0x1fe581;}var _0x1bf8e8=this[_0x01b4('0xae')](_0x01b4('0xaf'),_0x01b4('0xb0'));if(_0x1bf8e8['result']===-0x1){return _0x1bf8e8;}var _0xca192e=this[_0x01b4('0xae')](_0x01b4('0xb1'),_0x01b4('0xb2'));if(_0xca192e['result']===-0x1){return _0xca192e;}var _0x54a06e=this[_0x01b4('0xae')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x54a06e[_0x01b4('0xa1')]===-0x1){return _0x54a06e;}return this[_0x01b4('0xd')]['noop'](util[_0x01b4('0x24')](_0x01b4('0xb3'),_0x2a7cca));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x7')]=function(_0x4ea5a1){logger['info'](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x4ea5a1['label']));return this[_0x01b4('0xd')][_0x01b4('0x7')]([_0x4ea5a1[_0x01b4('0xb4')],_0x4ea5a1['args']]);};AGIVertices[_0x01b4('0xf')]['answer']=function(_0x42a6b3){logger['info'](util[_0x01b4('0x24')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x42a6b3[_0x01b4('0x34')]));if(this[_0x01b4('0xa6')](_0x42a6b3[_0x01b4('0xb5')])){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0xb6'),_0x42a6b3[_0x01b4('0xb5')]));var _0x4107f3=this['channel'][_0x01b4('0xb7')](_0x42a6b3[_0x01b4('0xb5')]);if(_0x4107f3[_0x01b4('0xa1')]===-0x1){return _0x4107f3;}}return this[_0x01b4('0xd')]['answer']();};AGIVertices['prototype'][_0x01b4('0x46')]=function(_0x1c94c1){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0xb8'),_0x1c94c1['label']));if(!this[_0x01b4('0xa6')](_0x1c94c1[_0x01b4('0x44')])){return this['channel'][_0x01b4('0x28')](_0x1c94c1,_0x01b4('0xb9'));}_0x1c94c1[_0x01b4('0x45')]=moment();if(this[_0x01b4('0xa6')](_0x1c94c1[_0x01b4('0xba')])){_0x1c94c1[_0x01b4('0x45')]=moment()[_0x01b4('0xbb')](_0x1c94c1[_0x01b4('0xba')],_0x01b4('0xbc'));}if(!this[_0x01b4('0xa6')](_0x1c94c1['callback_priority'])){_0x1c94c1[_0x01b4('0x49')]=0x2;}this[_0x01b4('0x40')]['sync'](this,_0x1c94c1);return this[_0x01b4('0xd')]['noop'](util[_0x01b4('0x24')](_0x01b4('0xbd'),_0x1c94c1['phone'],_0x1c94c1[_0x01b4('0x44')],_0x1c94c1['scheduledAt']));};AGIVertices[_0x01b4('0xf')][_0x01b4('0xbe')]=function(_0x50d507){logger['info'](util['format'](_0x01b4('0xbf'),_0x50d507[_0x01b4('0x34')]));var _0x5d1448=this[_0x01b4('0xd')]['exec'](_0x50d507[_0x01b4('0xc0')],_0x50d507[_0x01b4('0x77')]);if(_0x5d1448[_0x01b4('0xa1')]===-0x1){return _0x5d1448;}return this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0xc1'),_0x50d507[_0x01b4('0xc0')],_0x50d507['options']));};AGIVertices['prototype'][_0x01b4('0xc2')]=function(_0x12c701){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0xc3'),_0x12c701[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x12c701['text'])){return this['channel']['noop'](_0x01b4('0xa7'));}var _0x173346='\x22'+_0x12c701[_0x01b4('0x5a')]+'\x22';if(this[_0x01b4('0xa6')](_0x12c701[_0x01b4('0x77')])){_0x173346+=','+_0x12c701[_0x01b4('0x77')];}var _0x405f06=this[_0x01b4('0xd')][_0x01b4('0x54')](_0x01b4('0xc4'),_0x173346);if(_0x405f06[_0x01b4('0xa1')]===-0x1){return _0x405f06;}return this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x173346));};AGIVertices[_0x01b4('0xf')][_0x01b4('0xc5')]=function(_0xee0662){logger['info'](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xee0662['label']));if(!this[_0x01b4('0xa6')](_0xee0662['text'])){return this['channel'][_0x01b4('0xa8')]('no\x20text\x20configured');}var _0x233880='\x22'+_0xee0662['text']+'\x22';if(this[_0x01b4('0xa6')](_0xee0662[_0x01b4('0x77')])){_0x233880+=','+_0xee0662[_0x01b4('0x77')];}var _0x23c54b=this[_0x01b4('0xd')][_0x01b4('0x54')](_0x01b4('0xc4'),_0x233880);if(_0x23c54b[_0x01b4('0xa1')]===-0x1){return _0x23c54b;}return this[_0x01b4('0xd')]['noop'](util[_0x01b4('0x24')]('Executed\x20command\x20MRCPSynth\x20%s',_0x233880));};AGIVertices[_0x01b4('0xf')][_0x01b4('0xc6')]=function(_0x2db171){logger[_0x01b4('0x2a')](util['format'](_0x01b4('0xc7'),_0x2db171[_0x01b4('0x34')]));if(!this['isConfigured'](_0x2db171['grammar'])){return this['channel'][_0x01b4('0xa8')](_0x01b4('0xc8'));}var _0x413471=_0x2db171['grammar'];if(this[_0x01b4('0xa6')](_0x2db171[_0x01b4('0x77')])){_0x413471+=','+_0x2db171[_0x01b4('0x77')];}var _0x1c757e=this[_0x01b4('0xd')][_0x01b4('0x54')]('MRCPRecog',_0x413471);if(_0x1c757e['result']===-0x1){return _0x1c757e;}var _0x5ee300=this[_0x01b4('0xae')](_0x01b4('0xaf'),_0x01b4('0xc9'));if(_0x5ee300[_0x01b4('0xa1')]===-0x1){return _0x5ee300;}var _0x32ed94=this['getAndSetVariable'](_0x01b4('0xb1'),_0x01b4('0xca'));if(_0x32ed94[_0x01b4('0xa1')]===-0x1){return _0x32ed94;}var _0x106561=this[_0x01b4('0xae')](_0x01b4('0xcb'),_0x01b4('0xcc'));if(_0x106561['result']===-0x1){return _0x106561;}return this[_0x01b4('0xd')]['noop'](util[_0x01b4('0x24')](_0x01b4('0xb3'),_0x413471));};AGIVertices[_0x01b4('0xf')][_0x01b4('0xcd')]=function(_0x97caed){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0xce'),_0x97caed[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x97caed[_0x01b4('0xac')])){return this[_0x01b4('0xd')]['noop'](_0x01b4('0xc8'));}var _0x79ac7f=_0x97caed[_0x01b4('0xac')];if(this[_0x01b4('0xa6')](_0x97caed[_0x01b4('0x77')])){_0x79ac7f+=','+_0x97caed['options'];}var _0x48ec8d=this[_0x01b4('0xd')]['exec']('MRCPRecog',_0x79ac7f);if(_0x48ec8d['result']===-0x1){return _0x48ec8d;}var _0x10f2cb=this[_0x01b4('0xae')]('RECOG_CONFIDENCE()',_0x01b4('0xcf'));if(_0x10f2cb['result']===-0x1){return _0x10f2cb;}var _0xd8dc68=this['getAndSetVariable']('RECOG_INPUT()',_0x01b4('0xd0'));if(_0xd8dc68[_0x01b4('0xa1')]===-0x1){return _0xd8dc68;}var _0x2f9418=this['getAndSetVariable'](_0x01b4('0xcb'),_0x01b4('0xd1'));if(_0x2f9418[_0x01b4('0xa1')]===-0x1){return _0x2f9418;}return this[_0x01b4('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x79ac7f));};AGIVertices[_0x01b4('0xf')]['database']=function(_0x1ea8e3){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0xd2'),_0x1ea8e3[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x1ea8e3[_0x01b4('0xd3')])){return this['channel'][_0x01b4('0x28')](_0x1ea8e3,_0x01b4('0xd4'));}var _0x5b0348=this[_0x01b4('0x18')]['sync'](this,_0x1ea8e3[_0x01b4('0xd3')]);if(!_0x5b0348){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x1ea8e3,_0x01b4('0xd5'));}if(!this[_0x01b4('0xa6')](_0x1ea8e3[_0x01b4('0x2c')])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x1ea8e3,_0x01b4('0xd6'));}var _0x1ca9fd=_0x1ea8e3[_0x01b4('0x2c')][_0x01b4('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0xd7'),_0x1ca9fd));var _0x5a5249=this[_0x01b4('0x26')][_0x01b4('0x70')](this,_0x5b0348,_0x1ca9fd);this['createSquareDetailsReport'][_0x01b4('0x70')](this,_0x1ea8e3,_0x1ca9fd);if(!this[_0x01b4('0xa6')](_0x1ea8e3['variable_id'])){return this[_0x01b4('0xd')][_0x01b4('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2654bb=this['getVariable'][_0x01b4('0x70')](this,_0x1ea8e3['variable_id']);if(!_0x2654bb){return this['channel'][_0x01b4('0x28')](_0x1ea8e3,'no\x20variable\x20found');}var _0x25a667=this;_0x5a5249[_0x01b4('0xd8')](function(_0x2bf285,_0x35cc72){Object[_0x01b4('0xd9')](_0x2bf285)[_0x01b4('0xd8')](function(_0x5c1411){_0x25a667[_0x01b4('0xd')][_0x01b4('0x9e')](util[_0x01b4('0x24')](_0x01b4('0xda'),_0x2654bb,_0x35cc72,_0x5c1411),_0x2bf285[_0x5c1411]);});});this[_0x01b4('0xd')][_0x01b4('0x9e')](util[_0x01b4('0x24')](_0x01b4('0xdb'),_0x2654bb),_0x5a5249[_0x01b4('0x99')]);return this['channel'][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0xdc'),_0x2654bb));};AGIVertices[_0x01b4('0xf')][_0x01b4('0xdd')]=function(_0x5707cd){logger[_0x01b4('0xde')](util[_0x01b4('0x24')](_0x01b4('0xdf'),_0x5707cd[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x5707cd[_0x01b4('0xe0')])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x5707cd,'no\x20user\x20selected');}var _0x5cce66=this[_0x01b4('0x1a')][_0x01b4('0x70')](this,_0x5707cd[_0x01b4('0xe0')]);if(!_0x5cce66){return this['channel'][_0x01b4('0x28')](_0x5707cd,_0x01b4('0xe1'));}var _0x39c809=this[_0x01b4('0xd')][_0x01b4('0x54')](_0x01b4('0xe2'),[util[_0x01b4('0x24')](_0x01b4('0xe3'),_0x5cce66),_0x5707cd[_0x01b4('0xb5')],_0x5707cd[_0x01b4('0xe4')],_0x5707cd[_0x01b4('0x62')]]);if(_0x39c809[_0x01b4('0xa1')]===-0x1){return _0x39c809;}return this['channel']['noop'](util[_0x01b4('0x24')](_0x01b4('0xe5'),_0x01b4('0xe2')));};AGIVertices[_0x01b4('0xf')][_0x01b4('0xe6')]=function(_0x34198b){logger[_0x01b4('0x2a')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x34198b[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x34198b['key'])){return this[_0x01b4('0xd')][_0x01b4('0xa8')]('no\x20key\x20configured');}if(!this[_0x01b4('0xa6')](_0x34198b[_0x01b4('0x5a')])){return this['channel'][_0x01b4('0xa8')](_0x01b4('0xa7'));}this[_0x01b4('0xd')][_0x01b4('0xe7')]=!![];this['createSquareDetailsReport'](_0x34198b);this['createSquareMessage'](_0x34198b['text'],'in','','');this[_0x01b4('0xd')][_0x01b4('0xa8')](util['format'](_0x01b4('0xe8'),_0x34198b[_0x01b4('0x5a')]));var _0x2822a9=this['googleDialogflow']['sync'](this,_0x34198b);if(_0x2822a9){for(var _0xb95606 in _0x2822a9){if(_0x2822a9[_0x01b4('0x96')](_0xb95606)){this[_0x01b4('0xd')]['setVariable'](util[_0x01b4('0x24')](_0x01b4('0xe9'),_0xb95606[_0x01b4('0xea')]()),_0x2822a9[_0xb95606]);}}this[_0x01b4('0x3f')](_0x2822a9[_0x01b4('0xeb')],'out','dialogflow','');return this[_0x01b4('0xd')][_0x01b4('0xa8')](util['format'](_0x01b4('0xec'),_0x2822a9[_0x01b4('0xeb')]));}return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x34198b,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x01b4('0xf')][_0x01b4('0xed')]=function(_0x2e01b1){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0xee'),_0x2e01b1[_0x01b4('0x34')]));if(!this['isConfigured'](_0x2e01b1[_0x01b4('0x7c')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0xef'));}if(!this[_0x01b4('0xa6')](_0x2e01b1[_0x01b4('0x7d')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0xf0'));}if(!this[_0x01b4('0xa6')](_0x2e01b1[_0x01b4('0x7e')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0xf1'));}if(!this[_0x01b4('0xa6')](_0x2e01b1['dialogflowV2_language'])){return this['channel'][_0x01b4('0xa8')](_0x01b4('0xf2'));}if(!this[_0x01b4('0xa6')](_0x2e01b1['text'])){return this['channel'][_0x01b4('0xa8')](_0x01b4('0xa7'));}this[_0x01b4('0xd')][_0x01b4('0xe7')]=!![];this[_0x01b4('0x33')](_0x2e01b1);this[_0x01b4('0x3f')](_0x2e01b1[_0x01b4('0x5a')],'in','','');this[_0x01b4('0xd')]['noop'](util[_0x01b4('0x24')](_0x01b4('0xf3'),_0x2e01b1[_0x01b4('0x5a')]));var _0x129341=this[_0x01b4('0x7b')][_0x01b4('0x70')](this,_0x2e01b1);if(_0x129341){for(var _0xad0cd2 in _0x129341){if(_0x129341[_0x01b4('0x96')](_0xad0cd2)){if(_0xad0cd2!==_0x01b4('0xf4')){this[_0x01b4('0xd')][_0x01b4('0x9e')](util[_0x01b4('0x24')]('DIALOGFLOW_%s',_0xad0cd2[_0x01b4('0xea')]()),_0x129341[_0xad0cd2]);}}}this[_0x01b4('0x3f')](_0x129341[_0x01b4('0xeb')],_0x01b4('0xf5'),_0x01b4('0xed'),_0x129341[_0x01b4('0xf4')]);return this['channel'][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0xf6'),_0x129341[_0x01b4('0xeb')]));}return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x2e01b1,_0x01b4('0xf7'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0xf8')]=function(_0x41f77f){logger[_0x01b4('0x2a')](util['format'](_0x01b4('0xf9'),_0x41f77f[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x41f77f[_0x01b4('0xfa')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0xfb'));}if(!this[_0x01b4('0xa6')](_0x41f77f['username'])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0xfc'));}if(!this['isConfigured'](_0x41f77f['password'])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0xfd'));}if(!this[_0x01b4('0xa6')](_0x41f77f[_0x01b4('0xfe')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0xa7'));}this[_0x01b4('0xd')][_0x01b4('0xe7')]=!![];this['createSquareDetailsReport'](_0x41f77f);this[_0x01b4('0x3f')](_0x41f77f[_0x01b4('0x5a')],'in','','');this['channel'][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0xff'),_0x41f77f[_0x01b4('0x5a')]));var _0x5ad656=this['sestekNDA'][_0x01b4('0x70')](this,_0x41f77f);if(_0x5ad656){for(var _0x207ab6 in _0x5ad656){if(_0x5ad656[_0x01b4('0x96')](_0x207ab6)){this['channel']['setVariable'](util[_0x01b4('0x24')](_0x01b4('0x100'),_0x207ab6[_0x01b4('0xea')]()),_0x5ad656[_0x207ab6]);}}this[_0x01b4('0x3f')](_0x5ad656[_0x01b4('0xeb')],_0x01b4('0xf5'),_0x01b4('0xf8'),'');if(_0x5ad656[_0x01b4('0x101')]){this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x102'),_0x5ad656['audiofile']));var _0x31f5bf=this[_0x01b4('0xd')][_0x01b4('0x103')](_0x5ad656[_0x01b4('0x101')]);try{fs['unlink'](_0x5ad656['audiofile']+_0x01b4('0x104'));}catch(_0x12df8c){logger[_0x01b4('0x28')](_0x12df8c);}return _0x31f5bf;}else{return this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x105'),_0x5ad656[_0x01b4('0xeb')]));}}return this['channel']['error'](_0x41f77f,_0x01b4('0x106'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x107')]=function(_0x467482){logger[_0x01b4('0x2a')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x467482['label']));return this['channel']['noop']('end');};AGIVertices[_0x01b4('0xf')][_0x01b4('0x108')]=function(_0x15db94){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x109'),_0x15db94['label']));var _0x3b5035='';if(_0x15db94[_0x01b4('0x10a')]){if(!this[_0x01b4('0xa6')](_0x15db94[_0x01b4('0x10a')])){return this['channel']['error'](_0x15db94,_0x01b4('0x10b'));}else{var _0x63f0ad=parseInt(_0x15db94[_0x01b4('0x10a')],0xa);if(isNaN(_0x63f0ad)){_0x3b5035=_0x15db94[_0x01b4('0x10a')];}else{_0x3b5035=this['getTrunk'][_0x01b4('0x70')](this,_0x15db94[_0x01b4('0x10a')]);if(!_0x3b5035){return this['channel'][_0x01b4('0x28')](_0x15db94,_0x01b4('0x10c'));}}}}else if(_0x15db94[_0x01b4('0x10d')]){_0x3b5035=_0x15db94[_0x01b4('0x10d')];}else{return this['channel'][_0x01b4('0x28')](_0x15db94,_0x01b4('0x10b'));}var _0x40af96=this[_0x01b4('0xd')][_0x01b4('0x54')](_0x01b4('0xe2'),[util[_0x01b4('0x24')](_0x01b4('0x10e'),_0x3b5035,_0x15db94[_0x01b4('0x10f')]),_0x15db94[_0x01b4('0xb5')],_0x15db94[_0x01b4('0xe4')],_0x15db94['url']]);if(_0x40af96[_0x01b4('0xa1')]===-0x1){return _0x40af96;}return this[_0x01b4('0xd')]['noop'](util[_0x01b4('0x24')](_0x01b4('0xe5'),'DIAL'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x110')]=function(_0x53effa){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x111'),_0x53effa[_0x01b4('0x34')]));return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0x110'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0xb')]=function(_0x3ad8c4){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x112'),_0x3ad8c4['label']));if(_0x3ad8c4['retry']===0x0){return this[_0x01b4('0xa4')](_0x3ad8c4);}_0x3ad8c4[_0x01b4('0x113')]-=0x1;if(!this[_0x01b4('0xa6')](_0x3ad8c4[_0x01b4('0x114')])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x3ad8c4,'no\x20file\x20audio\x20selected');}var _0x151d25=this[_0x01b4('0x115')][_0x01b4('0x70')](this,_0x3ad8c4[_0x01b4('0x114')]);if(!_0x151d25){return this[_0x01b4('0xd')]['error'](_0x3ad8c4,'no\x20file\x20audio\x20found');}if(!this[_0x01b4('0xa6')](_0x3ad8c4['variable_id'])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x01b4('0x116'));}var _0x2d63a1=this['channel'][_0x01b4('0x117')](_0x151d25,_0x3ad8c4[_0x01b4('0x118')],_0x3ad8c4['maxdigit']);var _0x5144d2=_0x2d63a1[_0x01b4('0xa1')]?_0x2d63a1[_0x01b4('0xa1')][_0x01b4('0x48')]():'';logger[_0x01b4('0x2a')]('test',JSON[_0x01b4('0x73')](_0x2d63a1));if(_0x2d63a1[_0x01b4('0xa1')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x3ad8c4,_0x5144d2);return _0x2d63a1;}else if(_0x2d63a1[_0x01b4('0xa3')]===_0x01b4('0xb5')){_0x2d63a1[_0x01b4('0xa1')]=_0x5144d2['length']>=parseInt(_0x3ad8c4['mindigit'])?'x':'i';}else{_0x2d63a1[_0x01b4('0xa1')]=_0x5144d2['length']>=parseInt(_0x3ad8c4[_0x01b4('0x119')])&&_0x5144d2[_0x01b4('0x99')]<=parseInt(_0x3ad8c4[_0x01b4('0x11a')])?'x':'i';}var _0x47dd66=this['getVariable'][_0x01b4('0x70')](this,_0x3ad8c4[_0x01b4('0x11b')]);if(!_0x47dd66){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x3ad8c4,_0x01b4('0x11c'));}this[_0x01b4('0xd')][_0x01b4('0x9e')](_0x47dd66,_0x5144d2);if(this['isConfigured'](_0x3ad8c4[_0x01b4('0x11d')])){var _0x1f09a9=parseInt(_0x3ad8c4[_0x01b4('0x11d')],0xa);var _0x5f9aa1=rs['generate']({'charset':'*','length':_0x1f09a9});var _0x25991f=_0x5144d2[_0x01b4('0x99')];if(_0x25991f>0x0){if(_0x25991f>_0x1f09a9){this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x3ad8c4,_0x3ad8c4[_0x01b4('0x11e')]===_0x01b4('0x11f')?_0x5f9aa1+_0x5144d2['substr'](_0x1f09a9):_0x5144d2[_0x01b4('0x120')](0x0,_0x25991f-_0x1f09a9)+_0x5f9aa1);}else{this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x3ad8c4,rs[_0x01b4('0x121')]({'charset':'*','length':_0x25991f}));}}else{this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x3ad8c4,'');}}else{this['createSquareDetailsReport']['sync'](this,_0x3ad8c4,_0x5144d2);}return _0x2d63a1;};AGIVertices['prototype'][_0x01b4('0xc')]=function(_0x10a73d){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x10a73d[_0x01b4('0x34')]));return this[_0x01b4('0xb')](_0x10a73d);};AGIVertices[_0x01b4('0xf')][_0x01b4('0x122')]=function(_0x3eb5f6){logger['info'](util[_0x01b4('0x24')](_0x01b4('0x123'),_0x3eb5f6[_0x01b4('0x34')]));this[_0x01b4('0x33')]['sync'](this,_0x3eb5f6,_0x3eb5f6[_0x01b4('0x124')]);return this[_0x01b4('0xd')][_0x01b4('0xa8')](util['format'](_0x01b4('0x125'),_0x3eb5f6[_0x01b4('0x124')]));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x126')]=function(_0x790ec7){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x127'),_0x790ec7[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x790ec7[_0x01b4('0x88')])||!this[_0x01b4('0xa6')](_0x790ec7[_0x01b4('0x8e')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0x128'));}if(!this['isConfigured'](_0x790ec7[_0x01b4('0x5a')])){return this['channel'][_0x01b4('0xa8')](_0x01b4('0xa7'));}this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x129'),_0x790ec7[_0x01b4('0x5a')]));var _0x30784e=this[_0x01b4('0x87')][_0x01b4('0x70')](this,_0x790ec7);if(_0x30784e){this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x12a'),_0x30784e));var _0x33f4fa=this[_0x01b4('0xd')][_0x01b4('0x103')](_0x30784e);try{fs[_0x01b4('0x12b')](_0x30784e+_0x01b4('0x104'));}catch(_0x506395){logger['error'](_0x506395);}return _0x33f4fa;}return this['channel'][_0x01b4('0x28')](_0x790ec7,_0x01b4('0x12c'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x12d')]=function(_0x252ab7){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x12e'),_0x252ab7[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x252ab7[_0x01b4('0x88')])||!this[_0x01b4('0xa6')](_0x252ab7['aws_secret_access_key'])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0x128'));}if(!this['isConfigured'](_0x252ab7[_0x01b4('0x90')])){return this[_0x01b4('0xd')]['noop'](_0x01b4('0x12f'));}if(!this[_0x01b4('0xa6')](_0x252ab7[_0x01b4('0x5a')])){return this['channel']['noop'](_0x01b4('0xa7'));}this[_0x01b4('0xd')]['bot']=!![];this[_0x01b4('0x33')](_0x252ab7);this[_0x01b4('0x3f')](_0x252ab7['text'],'in','','');this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x130'),_0x252ab7[_0x01b4('0x5a')]));var _0x1eb91a=this['awsLex']['sync'](this,_0x252ab7);if(_0x1eb91a){for(var _0x51fd02 in _0x1eb91a){if(_0x1eb91a['hasOwnProperty'](_0x51fd02)&&_[_0x01b4('0x131')](_0x1eb91a[_0x51fd02])){this[_0x01b4('0xd')]['setVariable'](util[_0x01b4('0x24')]('AWS_LEX_%s',_0x51fd02[_0x01b4('0xea')]()),_0x1eb91a[_0x51fd02]);}}if(_[_0x01b4('0x42')](_0x1eb91a[_0x01b4('0x75')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x1eb91a[_0x01b4('0x75')],_0x01b4('0xf5'),'amazonlex','');return this['channel']['noop'](util[_0x01b4('0x24')](_0x01b4('0x132'),_0x1eb91a[_0x01b4('0x75')]));}}return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x252ab7,_0x01b4('0x133'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x134')]=function(_0x23deac){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x135'),_0x23deac['label'],_0x23deac[_0x01b4('0xb5')]));if(!this[_0x01b4('0xa6')](_0x23deac['key'])){return this[_0x01b4('0xd')]['noop'](_0x01b4('0x136'));}var _0x4450b5=_0x01b4('0x137');var _0x105237=util[_0x01b4('0x24')](_0x01b4('0x138'),FILES_PATH,rs[_0x01b4('0x121')](0x4));var _0x3e8bff=util['format'](_0x01b4('0x9d'),_0x105237,_0x4450b5);var _0x4d6a19=!![];if(_0x23deac[_0x01b4('0x139')]===_0x01b4('0x13a')){_0x4d6a19=![];}var _0x2d98bf=this[_0x01b4('0xd')][_0x01b4('0x13b')](_0x105237,_0x4450b5,_0x23deac[_0x01b4('0x13c')],_0x23deac['timeout'],undefined,_0x4d6a19);if(_0x2d98bf['result']!==-0x1){this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x13d'),_0x3e8bff));var _0x2302ec=this[_0x01b4('0x91')][_0x01b4('0x70')](this,_0x23deac,_0x3e8bff);if(_0x2302ec){for(var _0x20bab8 in _0x2302ec){if(_0x2302ec[_0x01b4('0x96')](_0x20bab8)){this[_0x01b4('0xd')][_0x01b4('0x9e')](util['format'](_0x01b4('0x13e'),_0x20bab8[_0x01b4('0xea')]()),_0x2302ec[_0x20bab8]);}}return this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x13f'),JSON['stringify'](_0x2302ec)));}}return _0x2d98bf;};AGIVertices[_0x01b4('0xf')][_0x01b4('0x140')]=function(_0x2bef06){logger[_0x01b4('0x2a')](util['format'](_0x01b4('0x141'),_0x2bef06['label']));if(!this[_0x01b4('0xa6')](_0x2bef06[_0x01b4('0x94')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0x142'));}if(!this['isConfigured'](_0x2bef06[_0x01b4('0x143')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0x144'));}var _0x2398a1='wav';var _0x4a03c6=util[_0x01b4('0x24')](_0x01b4('0x138'),FILES_PATH,rs[_0x01b4('0x121')](0x4));var _0x2b263b=util[_0x01b4('0x24')]('%s.%s',_0x4a03c6,_0x2398a1);var _0xe72667=!![];if(_0x2bef06[_0x01b4('0x139')]===_0x01b4('0x13a')){_0xe72667=![];}var _0x42d959=this['channel'][_0x01b4('0x13b')](_0x4a03c6,_0x2398a1,_0x2bef06[_0x01b4('0x13c')],_0x2bef06[_0x01b4('0xb5')],undefined,_0xe72667);if(_0x42d959[_0x01b4('0xa1')]!==-0x1){this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x145'),_0x2b263b));var _0x4b429a=this[_0x01b4('0x93')][_0x01b4('0x70')](this,_0x2bef06,_0x2b263b);if(_0x4b429a){for(var _0x4263a9 in _0x4b429a){if(_0x4b429a[_0x01b4('0x96')](_0x4263a9)){this[_0x01b4('0xd')][_0x01b4('0x9e')](util[_0x01b4('0x24')](_0x01b4('0x146'),_0x4263a9['toUpperCase']()),_0x4b429a[_0x4263a9]);}}return this[_0x01b4('0xd')]['noop'](util[_0x01b4('0x24')](_0x01b4('0x147'),JSON['stringify'](_0x4b429a)));}}return _0x42d959;};AGIVertices[_0x01b4('0xf')][_0x01b4('0x148')]=function(_0x324729){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x149'),_0x324729[_0x01b4('0x34')]));return this['channel'][_0x01b4('0x14a')](_0x324729[_0x01b4('0x14b')],_0x324729[_0x01b4('0x39')],_0x324729[_0x01b4('0x3a')]);};AGIVertices[_0x01b4('0xf')][_0x01b4('0x14c')]=function(_0x4ce625){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x14d'),_0x4ce625[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x4ce625['condition'])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x4ce625,_0x01b4('0x14e'));}try{var _0x4cf151=eval(_0x4ce625['condition'])?'true':'false';this[_0x01b4('0xd')]['noop'](util['format'](_0x01b4('0x14f'),_0x4ce625[_0x01b4('0x150')],_0x4cf151));return{'code':0xc8,'result':_0x4cf151};}catch(_0x2480c4){return{'code':0xc8,'result':_0x01b4('0x151')};}};AGIVertices[_0x01b4('0xf')][_0x01b4('0x152')]=function(_0x13ab62){logger['info'](util[_0x01b4('0x24')](_0x01b4('0x153'),_0x13ab62['label']));if(!this[_0x01b4('0xa6')](_0x13ab62[_0x01b4('0x154')])){return this['channel'][_0x01b4('0x28')](_0x13ab62,_0x01b4('0x155'));}var _0x42edee=this[_0x01b4('0x156')][_0x01b4('0x70')](this,_0x13ab62[_0x01b4('0x154')]);if(!_0x42edee){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x13ab62,_0x01b4('0x157'));}for(var _0x3e3f46=0x0;_0x3e3f46<_0x42edee['length'];_0x3e3f46+=0x1){var _0x1c0851=this[_0x01b4('0xd')][_0x01b4('0x10')](util[_0x01b4('0x24')](_0x01b4('0x158'),_0x42edee[_0x3e3f46]));if(_0x1c0851[_0x01b4('0xa1')]===-0x1){return _0x1c0851;}logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x159'),_0x42edee[_0x3e3f46],_0x1c0851[_0x01b4('0xa3')]));if(_0x1c0851[_0x01b4('0xa3')]==='true'){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x159'),_0x42edee[_0x3e3f46],_0x01b4('0x15a')));this[_0x01b4('0xd')][_0x01b4('0xa8')](util['format'](_0x01b4('0x159'),_0x42edee[_0x3e3f46],'true'));return{'code':0xc8,'result':_0x01b4('0x15a')};}else{logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x159'),_0x42edee[_0x3e3f46],'false'));this['channel'][_0x01b4('0xa8')](util[_0x01b4('0x24')]('IFTIME\x20%s\x20%s',_0x42edee[_0x3e3f46],'false'));}}return{'code':0xc8,'result':_0x01b4('0x151')};};AGIVertices['prototype'][_0x01b4('0x15b')]=function(_0x2fef16){logger['info'](util[_0x01b4('0x24')](_0x01b4('0x15c'),_0x2fef16[_0x01b4('0x34')]));return this[_0x01b4('0xd')][_0x01b4('0x15b')]();};AGIVertices[_0x01b4('0xf')][_0x01b4('0x15d')]=function(_0x3bc711){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x3bc711[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x3bc711[_0x01b4('0x79')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')]('no\x20key\x20configured');}var _0x197366=_0x01b4('0x137');var _0xf75b0c=util['format'](_0x01b4('0x138'),FILES_PATH,rs[_0x01b4('0x121')](0x4));var _0x3fe1ff=util['format'](_0x01b4('0x9d'),_0xf75b0c,_0x197366);var _0x2e201b=!![];if(_0x3bc711['beep']===_0x01b4('0x13a')){_0x2e201b=![];}var _0x1b5cd2=this['channel']['recordFile'](_0xf75b0c,_0x197366,_0x3bc711['intKey'],_0x3bc711['timeout'],undefined,_0x2e201b);if(_0x1b5cd2[_0x01b4('0xa1')]!==-0x1){this['channel'][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x15e'),_0x3fe1ff));var _0x162e0a=this['ispeechASR'][_0x01b4('0x70')](this,_0x3bc711,_0x3fe1ff);if(_0x162e0a){for(var _0x9fd517 in _0x162e0a){if(_0x162e0a[_0x01b4('0x96')](_0x9fd517)){this[_0x01b4('0xd')][_0x01b4('0x9e')](util[_0x01b4('0x24')]('ISPEECH_ASR_%s',_0x9fd517['toUpperCase']()),_0x162e0a[_0x9fd517]);}}return this['channel'][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x15f'),JSON[_0x01b4('0x73')](_0x162e0a)));}}return _0x1b5cd2;};AGIVertices[_0x01b4('0xf')][_0x01b4('0x160')]=function(_0x2e67d5){logger['info'](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x2e67d5[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x2e67d5[_0x01b4('0x79')])){return this[_0x01b4('0xd')]['noop'](_0x01b4('0x136'));}if(!this[_0x01b4('0xa6')](_0x2e67d5[_0x01b4('0x5a')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0xa7'));}this[_0x01b4('0xd')]['noop'](util[_0x01b4('0x24')](_0x01b4('0x161'),_0x2e67d5[_0x01b4('0x5a')]));var _0x26b68e=this[_0x01b4('0x81')][_0x01b4('0x70')](this,_0x2e67d5);if(_0x26b68e){this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')]('ispeech\x20%s\x20file\x20created',_0x26b68e));var _0x3ab6ad=this['channel']['streamFile'](_0x26b68e,_0x2e67d5[_0x01b4('0x13c')]);try{fs[_0x01b4('0x12b')](_0x26b68e+_0x01b4('0x104'));}catch(_0x5a17b9){logger[_0x01b4('0x28')](_0x5a17b9);}return _0x3ab6ad;}return this[_0x01b4('0xd')]['error'](_0x2e67d5,_0x01b4('0x162'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x163')]=function(_0x16708b){logger['info'](util[_0x01b4('0x24')](_0x01b4('0x164'),_0x16708b[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x16708b[_0x01b4('0x165')])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x16708b,_0x01b4('0x166'));}logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x167'),this[_0x01b4('0xd')]['callerid'],_0x16708b[_0x01b4('0x165')]));var _0x424fbd=this['agentLogin'][_0x01b4('0x70')](this,_0x16708b[_0x01b4('0x165')]);if(_0x424fbd){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x168'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x16708b[_0x01b4('0x165')]));this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x168'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x16708b[_0x01b4('0x165')]));return{'code':0xc8,'result':_0x01b4('0x169')};}else{logger['info'](util[_0x01b4('0x24')](_0x01b4('0x16a'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x16708b[_0x01b4('0x165')]));this['channel'][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x16a'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x16708b['findBy']));return{'code':0xc8,'result':_0x01b4('0x16b')};}};AGIVertices['prototype'][_0x01b4('0x16c')]=function(_0x3ee5cf){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x16d'),_0x3ee5cf[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x3ee5cf['findBy'])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x3ee5cf,_0x01b4('0x166'));}logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x167'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x3ee5cf['findBy']));var _0x284185=this[_0x01b4('0x4e')][_0x01b4('0x70')](this,_0x3ee5cf[_0x01b4('0x165')]);if(_0x284185){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x168'),this['channel']['callerid'],_0x3ee5cf[_0x01b4('0x165')]));this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x168'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x3ee5cf[_0x01b4('0x165')]));return{'code':0xc8,'result':_0x01b4('0x169')};}else{logger[_0x01b4('0x2a')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x01b4('0x38')],_0x3ee5cf[_0x01b4('0x165')]));this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x16a'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x3ee5cf['findBy']));return{'code':0xc8,'result':_0x01b4('0x16b')};}};AGIVertices[_0x01b4('0xf')][_0x01b4('0x16e')]=function(_0x13c499){logger['info'](util[_0x01b4('0x24')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x13c499[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x13c499[_0x01b4('0x16f')])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x13c499,'no\x20operation\x20configured');}this[_0x01b4('0xd')]['noop'](util[_0x01b4('0x24')]('math\x20%s',_0x13c499[_0x01b4('0x16f')]));var _0x1e9471=eval(_0x13c499[_0x01b4('0x16f')]);if(!this[_0x01b4('0xa6')](_0x13c499[_0x01b4('0x11b')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0x116'));}var _0x2a1a0e=this[_0x01b4('0x10')][_0x01b4('0x70')](this,_0x13c499[_0x01b4('0x11b')]);if(!_0x2a1a0e){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x13c499,_0x01b4('0x11c'));}if(_[_0x01b4('0x9c')](_0x1e9471)){var _0x23afaa=this;_0x1e9471[_0x01b4('0xd8')](function(_0x17473f,_0x330853){_0x23afaa['channel']['setVariable'](util[_0x01b4('0x24')]('%s[%s]',_0x2a1a0e,_0x330853),_0x17473f);});return this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')]('variable\x20%s[key]\x20set',_0x2a1a0e));}else{return this[_0x01b4('0xd')][_0x01b4('0x9e')](_0x2a1a0e,_0x1e9471);}};AGIVertices['prototype']['menu']=function(_0x2b33a8){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x170'),_0x2b33a8['label']));if(_0x2b33a8[_0x01b4('0x113')]===0x0){return this[_0x01b4('0xa4')](_0x2b33a8);}_0x2b33a8[_0x01b4('0x113')]-=0x1;if(!this['isConfigured'](_0x2b33a8[_0x01b4('0x114')])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x2b33a8,_0x01b4('0x171'));}var _0x57185e=this[_0x01b4('0x115')][_0x01b4('0x70')](this,_0x2b33a8['file_id']);if(!_0x57185e){return this['channel'][_0x01b4('0x28')](_0x2b33a8,'no\x20file\x20audio\x20found');}var _0x141a64=this[_0x01b4('0xd')][_0x01b4('0x117')](_0x57185e,_0x2b33a8[_0x01b4('0x118')],_0x2b33a8[_0x01b4('0x172')]);var _0x59a415=_0x141a64[_0x01b4('0xa1')];if(_0x141a64['result']===-0x1){this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x2b33a8,'-1');return _0x141a64;}else if(_0x141a64[_0x01b4('0xa3')]===_0x01b4('0xb5')){_0x141a64[_0x01b4('0xa1')]=_0x141a64[_0x01b4('0xa1')][_0x01b4('0x99')]>0x0?_0x141a64[_0x01b4('0xa1')]:'t';}else if(_['isEmpty'](_0x141a64['result'])){_0x141a64[_0x01b4('0xa1')]='#';_0x59a415='#';}if(!this[_0x01b4('0xa6')](_0x2b33a8[_0x01b4('0x11b')])){this[_0x01b4('0xd')]['noop'](_0x01b4('0x116'));}else{var _0x3605aa=this[_0x01b4('0x10')][_0x01b4('0x70')](this,_0x2b33a8[_0x01b4('0x11b')]);if(!_0x3605aa){return this['channel'][_0x01b4('0x28')](_0x2b33a8,_0x01b4('0x11c'));}this[_0x01b4('0xd')][_0x01b4('0x9e')](_0x3605aa,_0x59a415);}this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x2b33a8,_0x59a415);return _0x141a64;};AGIVertices[_0x01b4('0xf')][_0x01b4('0xa8')]=function(_0x3fd17d){logger[_0x01b4('0x2a')](util['format'](_0x01b4('0x173'),_0x3fd17d[_0x01b4('0x34')]));return this['channel'][_0x01b4('0xa8')](_0x3fd17d['output']||_0x3fd17d[_0x01b4('0x34')]);};AGIVertices[_0x01b4('0xf')][_0x01b4('0x174')]=function(_0x4b353f){logger['info'](util['format'](_0x01b4('0x175'),_0x4b353f[_0x01b4('0x34')]));if(!this['isConfigured'](_0x4b353f[_0x01b4('0x165')])){return this[_0x01b4('0xd')]['error'](_0x4b353f,'no\x20find\x20by\x20configured');}logger['info'](util[_0x01b4('0x24')](_0x01b4('0x167'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x4b353f[_0x01b4('0x165')]));var _0x4175e7=this['getPause'][_0x01b4('0x70')](this,_0x4b353f[_0x01b4('0x176')]);var _0x2b00f1=this[_0x01b4('0x4c')][_0x01b4('0x70')](this,_0x4b353f[_0x01b4('0x165')],_0x4175e7);if(_0x2b00f1){logger[_0x01b4('0x2a')](util['format'](_0x01b4('0x168'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x4b353f[_0x01b4('0x165')]));this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x168'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x4b353f[_0x01b4('0x165')]));return{'code':0xc8,'result':'success'};}else{logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x16a'),this[_0x01b4('0xd')]['callerid'],_0x4b353f[_0x01b4('0x165')]));this[_0x01b4('0xd')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x01b4('0xd')][_0x01b4('0x38')],_0x4b353f[_0x01b4('0x165')]));return{'code':0xc8,'result':_0x01b4('0x16b')};}};AGIVertices[_0x01b4('0xf')][_0x01b4('0x177')]=function(_0x23f9d6){logger[_0x01b4('0x2a')](util['format'](_0x01b4('0x178'),_0x23f9d6[_0x01b4('0x34')]));if(!this['isConfigured'](_0x23f9d6[_0x01b4('0x114')])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x23f9d6,_0x01b4('0x171'));}var _0x5683d8=this[_0x01b4('0x115')][_0x01b4('0x70')](this,_0x23f9d6[_0x01b4('0x114')]);if(!_0x5683d8){return this['channel'][_0x01b4('0x28')](_0x23f9d6,'no\x20file\x20audio\x20found');}var _0x37cded=this['channel'][_0x01b4('0x54')](_0x01b4('0x179'),[_0x5683d8,_0x23f9d6[_0x01b4('0xe4')]]);if(_0x37cded['result']===-0x1){return _0x37cded;}return this[_0x01b4('0xd')][_0x01b4('0xa8')](util['format'](_0x01b4('0xc1'),_0x01b4('0x179'),_0x5683d8));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x17a')]=function(_0x5d9ab2){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x17b'),_0x5d9ab2['label']));if(!this['isConfigured'](_0x5d9ab2[_0x01b4('0x17c')])){return this['channel'][_0x01b4('0x28')](_0x5d9ab2,_0x01b4('0x17d'));}var _0x9cec60='';var _0x12d5db=parseInt(_0x5d9ab2['queue_id'],0xa);if(isNaN(_0x12d5db)){_0x9cec60=_0x5d9ab2['queue_id'];}else{_0x9cec60=this['getVoiceQueue']['sync'](this,_0x5d9ab2[_0x01b4('0x17c')]);if(!_0x9cec60){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x5d9ab2,_0x01b4('0x17e'));}}var _0x16aaa3='';if(this['isConfigured'](_0x5d9ab2[_0x01b4('0x114')])){var _0x2cb79c=this[_0x01b4('0x115')]['sync'](this,_0x5d9ab2['file_id']);if(_0x2cb79c){_0x16aaa3=_0x2cb79c;}}this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x5d9ab2,_0x9cec60);if(_0x5d9ab2[_0x01b4('0xe4')]['indexOf']('x')<0x0){_0x5d9ab2['opts']+='x';}if(_0x5d9ab2['opts'][_0x01b4('0x17f')]('X')<0x0){_0x5d9ab2[_0x01b4('0xe4')]+='X';}this[_0x01b4('0xd')]['setVariable'](_0x01b4('0x180'),_0x9cec60?_0x9cec60['toLowerCase']():'');var _0x2eb28=this[_0x01b4('0xd')]['exec']('QUEUE',[_0x9cec60,_0x5d9ab2['opts'],_0x5d9ab2[_0x01b4('0x62')],_0x16aaa3,_0x5d9ab2[_0x01b4('0xb5')],_0x5d9ab2[_0x01b4('0x7')],_0x5d9ab2['macro'],_0x5d9ab2[_0x01b4('0x181')],'',_0x5d9ab2['position']]);if(_0x2eb28[_0x01b4('0xa1')]===-0x1){return _0x2eb28;}return this[_0x01b4('0xd')]['noop'](util['format'](_0x01b4('0xc1'),_0x01b4('0x182'),_0x9cec60));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x183')]=function(_0x5ebbcb){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x184'),_0x5ebbcb[_0x01b4('0x34')]));var _0x404ff7=_0x5ebbcb[_0x01b4('0x185')]||'wav';var _0x42e3dd=util[_0x01b4('0x24')](_0x01b4('0x186'),this[_0x01b4('0xd')][_0x01b4('0x37')],rs['generate'](0x5));var _0xa36ae6=util[_0x01b4('0x24')]('%s/recordings/%s.%s',FILES_PATH,_0x42e3dd,_0x404ff7);var _0x562594=util['format']('%s/recordings/%s',FILES_PATH,_0x42e3dd);this[_0x01b4('0x36')][_0x01b4('0x70')](this,_0x5ebbcb,_0x42e3dd,_0xa36ae6);this[_0x01b4('0xd')][_0x01b4('0x9e')](_0x01b4('0x187'),_0x42e3dd);logger[_0x01b4('0x2a')](_0x01b4('0x188'),_0x562594,_0x404ff7,_0x5ebbcb[_0x01b4('0x189')],_0x5ebbcb[_0x01b4('0xb5')]);return this[_0x01b4('0xd')][_0x01b4('0x13b')](_0x562594,_0x404ff7,_0x5ebbcb[_0x01b4('0x189')],_0x5ebbcb[_0x01b4('0xb5')],undefined,!![]);};AGIVertices[_0x01b4('0xf')][_0x01b4('0x18a')]=function(_0x1f06c1){logger[_0x01b4('0x2a')](util['format'](_0x01b4('0x18b'),_0x1f06c1[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x1f06c1[_0x01b4('0x62')])){return this[_0x01b4('0xd')]['noop'](_0x01b4('0x18c'));}var _0x42e6e9=this[_0x01b4('0x18d')]['sync'](this,_0x1f06c1);logger['info'](util['format'](_0x01b4('0x18e'),util[_0x01b4('0x18f')](_0x42e6e9,{'showHidden':![],'depth':null})));if(!this[_0x01b4('0xa6')](_0x1f06c1[_0x01b4('0x11b')])){return this[_0x01b4('0xd')]['noop'](_0x01b4('0x190'));}var _0x12de8b=this[_0x01b4('0x10')][_0x01b4('0x70')](this,_0x1f06c1[_0x01b4('0x11b')]);if(!_0x12de8b){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x1f06c1,_0x01b4('0x11c'));}this['channel'][_0x01b4('0x9e')](util[_0x01b4('0x24')](_0x01b4('0x191'),_0x12de8b),_0x42e6e9[_0x01b4('0x74')]?_0x42e6e9[_0x01b4('0x74')]:'200');this[_0x01b4('0xd')]['setVariable'](util[_0x01b4('0x24')](_0x01b4('0x192'),_0x12de8b),_0x42e6e9[_0x01b4('0x193')]?_0x42e6e9[_0x01b4('0x193')]:'OK');if(_0x42e6e9[_0x01b4('0x68')]){try{this[_0x01b4('0x9b')](_0x42e6e9['body'],_0x12de8b);}catch(_0x507e96){logger[_0x01b4('0x28')](util[_0x01b4('0x24')](_0x01b4('0x194'),_0x12de8b));}}return this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0xdc'),_0x12de8b));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x195')]=function(_0x4f1690){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x196'),_0x4f1690[_0x01b4('0x34')]));return this[_0x01b4('0xd')][_0x01b4('0x197')](_0x4f1690[_0x01b4('0x198')][_0x01b4('0x56')](/\s+/g,''),_0x4f1690[_0x01b4('0x189')]);};AGIVertices[_0x01b4('0xf')][_0x01b4('0x199')]=function(_0x53f33f){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x19a'),_0x53f33f[_0x01b4('0x34')]));return this[_0x01b4('0xd')][_0x01b4('0x19b')](_0x53f33f[_0x01b4('0x64')][_0x01b4('0x56')](/\s+/g,''),_0x53f33f[_0x01b4('0x189')]);};AGIVertices['prototype'][_0x01b4('0x19c')]=function(_0x32d2f5){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x32d2f5[_0x01b4('0x34')]));return this[_0x01b4('0xd')][_0x01b4('0x19d')](_0x32d2f5[_0x01b4('0x5a')],_0x32d2f5[_0x01b4('0x189')]);};AGIVertices[_0x01b4('0xf')][_0x01b4('0x19e')]=function(_0x3971cd){logger['info'](util[_0x01b4('0x24')](_0x01b4('0x19f'),_0x3971cd[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x3971cd['account_id'])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0x1a0'));}var _0x2900b2=this['getMailAccount']['sync'](this,_0x3971cd['account_id']);if(!_0x2900b2||!_0x2900b2[_0x01b4('0x1a1')]){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x3971cd,_0x01b4('0x1a2'));}var _0x25c284={'from':util['format'](_0x01b4('0x1a3'),_0x2900b2[_0x01b4('0x13')],_0x2900b2[_0x01b4('0x1a4')]||_0x2900b2['Smtp'][_0x01b4('0x1a5')]),'to':_0x3971cd['to']||'','cc':_0x3971cd['cc']||'','bcc':_0x3971cd[_0x01b4('0x1a6')]||'','subject':_0x3971cd[_0x01b4('0x1a7')],'html':_0x3971cd[_0x01b4('0x5a')],'text':_0x3971cd[_0x01b4('0x5a')]};var _0x2128ca={'tls':{'rejectUnauthorized':![]}};if(_0x2900b2[_0x01b4('0x1a1')]['service']){_0x2128ca['service']=_0x2900b2[_0x01b4('0x1a1')]['service'];}else{_0x2128ca[_0x01b4('0x1a8')]=_0x2900b2[_0x01b4('0x1a1')][_0x01b4('0x1a8')];_0x2128ca[_0x01b4('0x1a9')]=_0x2900b2[_0x01b4('0x1a1')][_0x01b4('0x1a9')];_0x2128ca[_0x01b4('0x1aa')]=_0x2900b2[_0x01b4('0x1a1')][_0x01b4('0x1aa')];}if(_0x2900b2[_0x01b4('0x1a1')][_0x01b4('0x1ab')]){_0x2128ca[_0x01b4('0x1ac')]={'user':_0x2900b2[_0x01b4('0x1a1')][_0x01b4('0x1a5')],'pass':_0x2900b2[_0x01b4('0x1a1')][_0x01b4('0x1ad')]};}if(this['isConfigured'](_0x3971cd[_0x01b4('0x1ae')])){}logger[_0x01b4('0xde')](_0x01b4('0x1af'),JSON[_0x01b4('0x73')](_0x25c284));this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x3971cd,_0x3971cd[_0x01b4('0x1b0')]);this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x2900b2['name']));this['sendMailMessage']['sync'](this,_0x2128ca,_0x25c284);return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0x1b1'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x1b2')]=function(_0x4cdb89){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x1b3'),_0x4cdb89[_0x01b4('0x34')]));return this['channel'][_0x01b4('0xa8')](_0x01b4('0x1b4'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x1b5')]=function(_0x460da7){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x1b6'),_0x460da7['label']));if(!this[_0x01b4('0xa6')](_0x460da7[_0x01b4('0x1b7')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0x1b8'));}var _0x8e58a4=this['getSmsAccount'][_0x01b4('0x70')](this,_0x460da7[_0x01b4('0x1b7')]);if(!_0x8e58a4){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x460da7,_0x01b4('0x1b9'));}var _0x37a2ba={'body':_0x460da7[_0x01b4('0x1ba')],'phone':_0x460da7['to']||'','SmsAccountId':_0x8e58a4['id']};logger[_0x01b4('0xde')]('sendSMS\x20message',JSON['stringify'](_0x37a2ba));this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x460da7,_0x460da7[_0x01b4('0x1b7')]);this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x8e58a4[_0x01b4('0x13')]));this[_0x01b4('0x32')]['sync'](this,_0x37a2ba);return this['channel'][_0x01b4('0xa8')](_0x01b4('0x1bb'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x1bc')]=function(_0x4f46d5){logger[_0x01b4('0x2a')](util['format'](_0x01b4('0x1bd'),_0x4f46d5[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x4f46d5[_0x01b4('0x11b')])){return this['channel'][_0x01b4('0x28')](_0x4f46d5,_0x01b4('0x1be'));}var _0x3ac791=this['getVariable']['sync'](this,_0x4f46d5[_0x01b4('0x11b')]);if(!_0x3ac791){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x4f46d5,_0x01b4('0x11c'));}return this[_0x01b4('0xd')][_0x01b4('0x9e')](_0x3ac791,_0x4f46d5[_0x01b4('0x1bf')]);};AGIVertices[_0x01b4('0xf')]['start']=function(_0x44a00b){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x1c0'),_0x44a00b[_0x01b4('0x34')]));this[_0x01b4('0xd')]['noop']('START\x20CALLY\x20SQUARE');if(_0x44a00b[_0x01b4('0x1c1')]==='yes'){this[_0x01b4('0xd')]['noop']('Answer');return this[_0x01b4('0xd')][_0x01b4('0x1c1')]();}return this[_0x01b4('0xd')][_0x01b4('0xa8')]('Skipped\x20Answer');};AGIVertices['prototype'][_0x01b4('0x1c2')]=function(_0x32a681){logger['info'](util[_0x01b4('0x24')](_0x01b4('0x1c3'),_0x32a681[_0x01b4('0x34')]));if(!this['isConfigured'](_0x32a681[_0x01b4('0x1c4')])){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x32a681,_0x01b4('0x1c5'));}var _0x3fc1db=this[_0x01b4('0x1c6')]['sync'](this,_0x32a681[_0x01b4('0x1c4')]);if(!this[_0x01b4('0xa6')](_0x3fc1db)){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x32a681,util['format'](_0x01b4('0x1c7'),_0x32a681['project_id']));}if(_0x3fc1db===this[_0x01b4('0xd')]['arg_1']){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x32a681,_0x01b4('0x1c8'));}this[_0x01b4('0x33')][_0x01b4('0x70')](this,_0x32a681,_0x3fc1db);var _0x11a747=this['channel'][_0x01b4('0x54')](_0x01b4('0x1c9'),util[_0x01b4('0x24')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x01b4('0x7')]['host']||_0x01b4('0x1ca'),_0x3fc1db,this[_0x01b4('0xd')][_0x01b4('0x3d')]));if(_0x11a747['result']===-0x1){return _0x11a747;}return this[_0x01b4('0xd')][_0x01b4('0xa8')](util['format'](_0x01b4('0xc1'),'AGI',_0x3fc1db));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x1cb')]=function(_0xe647e5){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x1cc'),_0xe647e5[_0x01b4('0x34')]));var _0x3fc6cf=this[_0x01b4('0x53')][_0x01b4('0x70')](this,_0xe647e5['command']);this['createSquareDetailsReport'][_0x01b4('0x70')](this,_0xe647e5,_0xe647e5[_0x01b4('0xb4')]);if(this[_0x01b4('0xa6')](_0xe647e5['variable_id'])){var _0x202afe=this['getVariable'][_0x01b4('0x70')](this,_0xe647e5[_0x01b4('0x11b')]);if(_0x202afe){this[_0x01b4('0xd')]['setVariable'](_0x202afe,_0x3fc6cf);return this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x1cd'),_0xe647e5[_0x01b4('0xb4')],_0x202afe));}}return this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0xe647e5[_0x01b4('0xb4')]));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x1ce')]=function(_0x5d263e){logger['info'](util[_0x01b4('0x24')](_0x01b4('0x1cf'),_0x5d263e[_0x01b4('0x34')]));_0x5d263e[_0x01b4('0x5a')]=_0x5d263e[_0x01b4('0x5a')][_0x01b4('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5d263e['apiKey'])){return this['channel'][_0x01b4('0xa8')](_0x01b4('0x1d0'));}if(!this[_0x01b4('0xa6')](_0x5d263e[_0x01b4('0x5a')])){return this[_0x01b4('0xd')]['noop']('no\x20text\x20configured');}this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x1d1'),_0x5d263e[_0x01b4('0x5a')]));var _0x49365d=this[_0x01b4('0x57')][_0x01b4('0x70')](this,_0x5d263e);if(_0x49365d){this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x49365d));var _0x223019=this[_0x01b4('0xd')][_0x01b4('0x103')](_0x49365d);try{fs[_0x01b4('0x12b')](_0x49365d+_0x01b4('0x104'));}catch(_0x3ab7f7){logger[_0x01b4('0x28')](_0x3ab7f7);}return _0x223019;}return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x5d263e,_0x01b4('0x1d2'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x1d3')]=function(_0xf56df1){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x1d4'),_0xf56df1['label']));_0xf56df1[_0x01b4('0x5a')]=_0xf56df1[_0x01b4('0x5a')][_0x01b4('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x01b4('0xa6')](_0xf56df1[_0x01b4('0x5a')])){return this[_0x01b4('0xd')][_0x01b4('0xa8')](_0x01b4('0xa7'));}this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x1d5'),_0xf56df1[_0x01b4('0x5a')]));var _0x57b383=this[_0x01b4('0x60')][_0x01b4('0x70')](this,_0xf56df1);if(_0x57b383){this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x1d6'),_0x57b383));var _0x2c88f8=this[_0x01b4('0xd')]['streamFile'](_0x57b383);try{fs['unlink'](_0x57b383+_0x01b4('0x104'));}catch(_0x6150f1){logger[_0x01b4('0x28')](_0x6150f1);}return _0x2c88f8;}return this[_0x01b4('0xd')]['error'](_0xf56df1,_0x01b4('0x1d7'));};AGIVertices[_0x01b4('0xf')][_0x01b4('0x1d8')]=function(_0x41c0ec){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x1d9'),_0x41c0ec[_0x01b4('0x34')]));if(!this[_0x01b4('0xa6')](_0x41c0ec[_0x01b4('0x165')])){return this[_0x01b4('0xd')]['error'](_0x41c0ec,_0x01b4('0x166'));}logger[_0x01b4('0x2a')](util['format'](_0x01b4('0x167'),this['channel'][_0x01b4('0x38')],_0x41c0ec[_0x01b4('0x165')]));var _0x2ee7ff=this[_0x01b4('0x4d')][_0x01b4('0x70')](this,_0x41c0ec[_0x01b4('0x165')]);if(_0x2ee7ff){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x01b4('0xd')][_0x01b4('0x38')],_0x41c0ec['findBy']));this['channel'][_0x01b4('0xa8')](util[_0x01b4('0x24')](_0x01b4('0x168'),this[_0x01b4('0xd')][_0x01b4('0x38')],_0x41c0ec[_0x01b4('0x165')]));return{'code':0xc8,'result':_0x01b4('0x169')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x01b4('0xd')]['callerid'],_0x41c0ec[_0x01b4('0x165')]));this[_0x01b4('0xd')][_0x01b4('0xa8')](util[_0x01b4('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x01b4('0x38')],_0x41c0ec['findBy']));return{'code':0xc8,'result':_0x01b4('0x16b')};}};AGIVertices[_0x01b4('0xf')][_0x01b4('0x1da')]=function(_0x4fe7e0){logger[_0x01b4('0x2a')](util[_0x01b4('0x24')](_0x01b4('0x1db'),_0x4fe7e0[_0x01b4('0x34')]));var _0x2b36bb=this['channel'][_0x01b4('0x54')](_0x01b4('0x1dc'),[_0x4fe7e0[_0x01b4('0x1dd')],_0x4fe7e0[_0x01b4('0x77')]]);if(_0x2b36bb[_0x01b4('0xa1')]===-0x1){return _0x2b36bb;}return this[_0x01b4('0xd')]['noop'](util['format'](_0x01b4('0xc1'),_0x01b4('0x1dc'),_0x4fe7e0[_0x01b4('0x1dd')]));};AGIVertices[_0x01b4('0xf')]['vswitch']=function(_0x2f3732){logger['info'](util[_0x01b4('0x24')](_0x01b4('0x1de'),_0x2f3732['label']));if(!this[_0x01b4('0xa6')](_0x2f3732[_0x01b4('0x11b')])){return this[_0x01b4('0xd')]['error'](_0x2f3732,_0x01b4('0x1be'));}var _0x57ef37=this['getVariable'][_0x01b4('0x70')](this,_0x2f3732[_0x01b4('0x11b')]);if(!_0x57ef37){return this[_0x01b4('0xd')][_0x01b4('0x28')](_0x2f3732,_0x01b4('0x11c'));}var _0x243f5d=this[_0x01b4('0xd')][_0x01b4('0x10')](_0x57ef37);return{'code':0xc8,'result':_0x243f5d[_0x01b4('0xa3')]?_0x243f5d[_0x01b4('0xa3')]:'-'};};String[_0x01b4('0xf')][_0x01b4('0x1df')]=function(_0x583e91,_0x13a12d){return this[_0x01b4('0xa0')](_0x583e91)[_0x01b4('0x1e0')](_0x13a12d);};module[_0x01b4('0x1e1')]=AGIVertices; \ No newline at end of file +var _0xad58=['Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','getSound','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','condition','true','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','agentLogin','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','no\x20variable\x20selected\x20for\x20the\x20result','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','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','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','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','\x22%s\x22\x20<%s>','email','bcc','service','host','port','secure','authentication','auth','pass','template_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','catch','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','callback_priority','getPause','getPauseById','agentPause','agent','callerid','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','MALE','MP3','googleTTS','google_tts_language','url','method','timeout','POST','PUT','toUpperCase','body','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','%s.%s','isArray','saveRestApiResult','setVariable','length','split','replaceAll','extra','toString','result','isConfigured','maxRetry','sync','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','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','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr'];(function(_0x2ab0f8,_0x6d7031){var _0x2358ae=function(_0x55d130){while(--_0x55d130){_0x2ab0f8['push'](_0x2ab0f8['shift']());}};_0x2358ae(++_0x6d7031);}(_0xad58,0x10b));var _0x8ad5=function(_0x12a57d,_0x738bd1){_0x12a57d=_0x12a57d-0x0;var _0x4b26f6=_0xad58[_0x12a57d];return _0x4b26f6;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x8ad5('0x0'));var _=require(_0x8ad5('0x1'));var sh=require(_0x8ad5('0x2'));var odbc=require('odbc')();var rs=require('randomstring');var moment=require(_0x8ad5('0x3'));var Mustache=require(_0x8ad5('0x4'));var rp=require(_0x8ad5('0x5'));var logger=require(_0x8ad5('0x6'))(_0x8ad5('0x7'));var config=require(_0x8ad5('0x8'));var scripts=require(_0x8ad5('0x9'));var FILES_PATH=_0x8ad5('0xa');var recursiveMapAttributes=[_0x8ad5('0xb'),'rawBody'];var verticesWithRetry=['menu',_0x8ad5('0xc'),_0x8ad5('0xd')];var AGIVertices=function(_0x2de890,_0x1f012d,_0x1a81c9){this[_0x8ad5('0xe')]=_0x2de890;this[_0x8ad5('0xf')]=_0x1f012d;this[_0x8ad5('0x10')]=_0x1a81c9;};AGIVertices['prototype'][_0x8ad5('0x11')]=function(_0x142909,_0x112494){this[_0x8ad5('0xf')][_0x8ad5('0x12')](_0x142909)[_0x8ad5('0x13')](function(_0xd4b674){_0x112494(null,_0xd4b674?_0xd4b674[_0x8ad5('0x14')]:![]);})['catch'](function(_0x303814){_0x112494(_0x303814);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x16')]=function(_0x39399e,_0x3a7204){this['rpc'][_0x8ad5('0x17')](_0x39399e)[_0x8ad5('0x13')](function(_0x523a88){_0x3a7204(null,_0x523a88?_0x523a88['name']:![]);})['catch'](function(_0x2bb6fc){_0x3a7204(_0x2bb6fc);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x18')]=function(_0x184705,_0x129476){this[_0x8ad5('0xf')]['getSquareProjectById'](_0x184705)[_0x8ad5('0x13')](function(_0x281a4d){_0x129476(null,_0x281a4d?_0x281a4d[_0x8ad5('0x14')]:![]);})[_0x8ad5('0x19')](function(_0x33a10d){_0x129476(_0x33a10d);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x1a')]=function(_0x4279df,_0x195230){this[_0x8ad5('0xf')][_0x8ad5('0x1b')](_0x4279df)[_0x8ad5('0x13')](function(_0x7575e1){_0x195230(null,_0x7575e1?_0x7575e1['dsn']:![]);})[_0x8ad5('0x19')](function(_0x2df584){_0x195230(_0x2df584);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x1c')]=function(_0x15da9c,_0x4af8bb){this[_0x8ad5('0xf')][_0x8ad5('0x1d')](_0x15da9c)[_0x8ad5('0x13')](function(_0x50f698){_0x4af8bb(null,_0x50f698?_0x50f698[_0x8ad5('0x14')]:![]);})[_0x8ad5('0x19')](function(_0x1a67ba){_0x4af8bb(_0x1a67ba);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x1e')]=function(_0x4ae348,_0x58e8dd){this[_0x8ad5('0xf')]['getTrunkById'](_0x4ae348)['then'](function(_0x4e342d){_0x58e8dd(null,_0x4e342d?_0x4e342d[_0x8ad5('0x14')]:![]);})['catch'](function(_0x429fdc){_0x58e8dd(_0x429fdc);});};AGIVertices['prototype']['getSound']=function(_0x344654,_0x4c4b61){var _0x101e61=this;this[_0x8ad5('0xf')]['getSoundById'](_0x344654)[_0x8ad5('0x13')](function(_0x5bdbb0){_0x4c4b61(null,_0x5bdbb0?_0x101e61[_0x8ad5('0x1f')](_0x5bdbb0['save_name']):![]);})['catch'](function(_0x19862e){_0x4c4b61(_0x19862e);});};AGIVertices['prototype'][_0x8ad5('0x20')]=function(_0x48fa98,_0x464c8c){this[_0x8ad5('0xf')][_0x8ad5('0x21')](_0x48fa98)[_0x8ad5('0x13')](function(_0x4fdaee){_0x464c8c(null,_0x4fdaee?_0x4fdaee:![]);})[_0x8ad5('0x19')](function(_0x31cdf4){_0x464c8c(_0x31cdf4);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x22')]=function(_0x527bbc,_0x1c8d8a,_0x52d13c){this[_0x8ad5('0x10')][_0x8ad5('0x22')](_0x527bbc,_0x1c8d8a)['then'](function(){_0x52d13c(null);})[_0x8ad5('0x19')](function(_0x1fada0){_0x52d13c(_0x1fada0);});};AGIVertices['prototype'][_0x8ad5('0x23')]=function(_0x312c3e,_0x1271c6){this[_0x8ad5('0xf')][_0x8ad5('0x24')](_0x312c3e)[_0x8ad5('0x13')](function(_0x388c05){if(_0x388c05){if(_0x388c05[_0x8ad5('0x25')]){_0x1271c6(null,[_0x388c05[_0x8ad5('0x26')]]);}else{_0x1271c6(null,_['map'](_0x388c05[_0x8ad5('0x27')],_0x8ad5('0x26')));}}else{_0x1271c6(null,![]);}})[_0x8ad5('0x19')](function(_0x91e750){_0x1271c6(_0x91e750);});};AGIVertices['prototype']['getSoundPath']=function(_0x5e7b01){return util[_0x8ad5('0x28')]('%s/sounds/converted/%s',FILES_PATH,_0x5e7b01);};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x29')]=function(_0x216d4e,_0x14dd0c,_0x45fdc6){odbc[_0x8ad5('0x2a')](_0x216d4e,function(_0x3cc153){if(_0x3cc153){logger[_0x8ad5('0x2b')](_0x8ad5('0x2c'),_0x3cc153);_0x45fdc6(_0x3cc153);}else{logger[_0x8ad5('0x2d')](_0x8ad5('0x2e'));odbc[_0x8ad5('0x2f')](_0x14dd0c,function(_0x18d2a2,_0x3ebf42){if(_0x18d2a2){logger[_0x8ad5('0x2d')](_0x8ad5('0x30'),_0x14dd0c);_0x45fdc6(_0x18d2a2);}else{logger['info'](_0x8ad5('0x31'),_0x14dd0c);odbc[_0x8ad5('0x32')](function(_0x447511){if(_0x447511){logger[_0x8ad5('0x2b')](_0x8ad5('0x33'),_0x447511);}_0x45fdc6(null,_0x3ebf42);});}});}});};AGIVertices['prototype'][_0x8ad5('0x34')]=function(_0x3b7b23,_0x1222af){this['rpc']['getSmsAccountById'](_0x3b7b23)['then'](function(_0x1fac7e){_0x1222af(null,_0x1fac7e?_0x1fac7e:![]);})['catch'](function(_0x44512a){_0x1222af(_0x44512a);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x35')]=function(_0x325a41,_0x5c2f8c){this[_0x8ad5('0xf')][_0x8ad5('0x35')](_0x325a41)[_0x8ad5('0x13')](function(_0x2a8a40){_0x5c2f8c(null,_0x2a8a40);})[_0x8ad5('0x19')](function(_0x3bf87e){_0x5c2f8c(_0x3bf87e);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x36')]=function(_0x34f018,_0x15e5c3,_0x2d013e){this[_0x8ad5('0xf')][_0x8ad5('0x36')]({'uniqueid':this[_0x8ad5('0xe')][_0x8ad5('0x37')],'node':_0x34f018[_0x8ad5('0x38')],'application':_0x34f018[_0x8ad5('0x39')],'data':_0x15e5c3||null,'project_name':this[_0x8ad5('0xe')][_0x8ad5('0x3a')],'callerid':this[_0x8ad5('0xe')]['callerid']})['then'](function(_0x191c51){if(_0x2d013e){_0x2d013e(null,_0x191c51);}})[_0x8ad5('0x19')](function(_0x156452){if(_0x2d013e){_0x2d013e(_0x156452);}});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x3b')]=function(_0x216965,_0x4477ac,_0x19a54c,_0x4d9164){this[_0x8ad5('0xf')]['createSquareRecording']({'uniqueid':this[_0x8ad5('0xe')][_0x8ad5('0x37')],'callerid':this[_0x8ad5('0xe')]['callerid'],'calleridname':this[_0x8ad5('0xe')]['calleridname'],'context':this['channel'][_0x8ad5('0x3c')],'extension':this[_0x8ad5('0xe')][_0x8ad5('0x3d')],'priority':this[_0x8ad5('0xe')][_0x8ad5('0x3e')],'accountcode':this[_0x8ad5('0xe')][_0x8ad5('0x3f')],'dnid':this[_0x8ad5('0xe')]['dnid'],'projectName':this[_0x8ad5('0xe')]['arg_1'],'saveName':_0x4477ac,'filename':_0x216965[_0x8ad5('0x40')]||_0x4477ac,'savePath':_0x19a54c})[_0x8ad5('0x13')](function(_0x5e7208){_0x4d9164(null,_0x5e7208);})[_0x8ad5('0x19')](function(_0x47814b){_0x4d9164(_0x47814b);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x41')]=function(_0x477a8d,_0x345707,_0x11df03,_0x4e5cfa,_0xa70be5){this[_0x8ad5('0xf')][_0x8ad5('0x41')]({'uniqueid':this['channel'][_0x8ad5('0x37')],'body':_0x477a8d,'direction':_0x345707,'providerName':_0x11df03,'providerResponse':_0x4e5cfa})['then'](function(_0x3c3685){if(_0xa70be5){_0xa70be5(null,_0x3c3685);}})[_0x8ad5('0x19')](function(_0x22f92d){if(_0xa70be5){_0xa70be5(_0x22f92d);}});};AGIVertices['prototype'][_0x8ad5('0x42')]=function(_0x5b25e3,_0x44758a){this['rpc'][_0x8ad5('0x42')]({'firstName':_[_0x8ad5('0x43')](_0x5b25e3[_0x8ad5('0x14')])||_[_0x8ad5('0x44')](_0x5b25e3[_0x8ad5('0x14')])?'callback_'+Math['random']():_0x5b25e3[_0x8ad5('0x14')],'lastName':_['isEmpty'](_0x5b25e3[_0x8ad5('0x45')])||_[_0x8ad5('0x44')](_0x5b25e3['lastName'])?null:_0x5b25e3[_0x8ad5('0x45')],'phone':_0x5b25e3[_0x8ad5('0x46')],'ListId':_0x5b25e3[_0x8ad5('0x47')],'scheduledat':_0x5b25e3['scheduledAt'],'callbackUniqueid':this[_0x8ad5('0xe')][_0x8ad5('0x37')],'tags':'callback','description':_0x8ad5('0x48')+_0x5b25e3[_0x8ad5('0x49')]['toString'](),'priority':_0x5b25e3[_0x8ad5('0x4a')]})[_0x8ad5('0x13')](function(_0x839152){_0x44758a(null,_0x839152);})['catch'](function(_0x4f87c3){_0x44758a(_0x4f87c3);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x4b')]=function(_0x1cdd02,_0x423a58){this[_0x8ad5('0xf')][_0x8ad5('0x4c')](_0x1cdd02)['then'](function(_0xf59821){_0x423a58(null,_0xf59821?_0xf59821[_0x8ad5('0x14')]:![]);})[_0x8ad5('0x19')](function(_0x1c5a8f){_0x423a58(_0x1c5a8f);});};AGIVertices['prototype'][_0x8ad5('0x4d')]=function(_0x952dc2,_0x225cc5,_0x4fb10c){var _0xfb13dc={'role':_0x8ad5('0x4e')};_0xfb13dc[_0x952dc2]=this[_0x8ad5('0xe')][_0x8ad5('0x4f')];this[_0x8ad5('0xf')]['agentPause'](_0xfb13dc,_0x225cc5,this[_0x8ad5('0xe')][_0x8ad5('0x37')])[_0x8ad5('0x13')](function(_0x1b9846){_0x4fb10c(null,_[_0x8ad5('0x44')](_0x1b9846)?![]:!![]);})[_0x8ad5('0x19')](function(_0x536a40){logger['error'](_0x536a40);_0x4fb10c(null,![]);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x50')]=function(_0x26ea8f,_0x5959cc){var _0x26be98={'role':_0x8ad5('0x4e')};_0x26be98[_0x26ea8f]=this['channel'][_0x8ad5('0x4f')];this[_0x8ad5('0xf')]['agentUnpause'](_0x26be98)[_0x8ad5('0x13')](function(_0x3d31dc){_0x5959cc(null,_['isNil'](_0x3d31dc)?![]:!![]);})[_0x8ad5('0x19')](function(_0x529504){logger[_0x8ad5('0x2b')](_0x529504);_0x5959cc(null,![]);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x51')]=function(_0x2ad779,_0x43301d){var _0x30e94a={'role':_0x8ad5('0x4e')};_0x30e94a[_0x2ad779]=this['channel'][_0x8ad5('0x4f')];this[_0x8ad5('0xf')][_0x8ad5('0x51')](_0x30e94a)[_0x8ad5('0x13')](function(_0x3aa233){_0x43301d(null,_['isNil'](_0x3aa233)?![]:!![]);})[_0x8ad5('0x19')](function(_0x35abbf){logger['error'](_0x35abbf);_0x43301d(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x3e28b2,_0x4c5cab){var _0x2cfc0e={'role':_0x8ad5('0x4e')};_0x2cfc0e[_0x3e28b2]=this[_0x8ad5('0xe')]['callerid'];var _0x47b395=_0x3e28b2!=_0x8ad5('0x52')?util[_0x8ad5('0x28')](_0x8ad5('0x53'),'LOCAL',this[_0x8ad5('0xe')]['callerid']):undefined;this[_0x8ad5('0xf')]['agentLogin'](_0x2cfc0e,_0x47b395)[_0x8ad5('0x13')](function(_0x225aca){_0x4c5cab(null,_[_0x8ad5('0x44')](_0x225aca)?![]:!![]);})[_0x8ad5('0x19')](function(_0x45242a){logger[_0x8ad5('0x2b')](_0x45242a);_0x4c5cab(null,![]);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x54')]=function(_0x3afd8d,_0x369157){sh[_0x8ad5('0x55')](_['trim'](_0x3afd8d),function(_0x52f698,_0x41df46){var _0x5883a5=_0x41df46[_0x8ad5('0x56')](/(\r\n|\n|\r)/gm,'');_0x369157(null,_0x5883a5);});};AGIVertices[_0x8ad5('0x15')]['googleCloudTTS']=function(_0x3629ed,_0x61316a){scripts[_0x8ad5('0x57')](_0x3629ed[_0x8ad5('0x58')],_0x3629ed[_0x8ad5('0x59')]||_0x8ad5('0x5a'),_0x3629ed[_0x8ad5('0x5a')],_0x3629ed['languageCode']||'en-US',_0x3629ed['ssmlGender']||_0x8ad5('0x5b'),_0x3629ed['audioEncoding']||_0x8ad5('0x5c'))['then'](function(_0x574f55){_0x61316a(null,_0x574f55);})[_0x8ad5('0x19')](function(_0x20ba41){_0x61316a(_0x20ba41);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x5d')]=function(_0x261c0d,_0x38efce){scripts[_0x8ad5('0x5d')](_0x261c0d['text'],_0x261c0d[_0x8ad5('0x5e')]||'en',0x1)[_0x8ad5('0x13')](function(_0x2dc05f){_0x38efce(null,_0x2dc05f);})[_0x8ad5('0x19')](function(_0xc104e3){_0x38efce(_0xc104e3);});};AGIVertices[_0x8ad5('0x15')]['restAPI']=function(_0x1c0b5b,_0x2ba9af){var _0xa31f5c={'uri':_0x1c0b5b[_0x8ad5('0x5f')],'method':_0x1c0b5b[_0x8ad5('0x60')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1c0b5b['timeout'])==='number'&&parseInt(_0x1c0b5b[_0x8ad5('0x61')])>=0x1?parseInt(_0x1c0b5b[_0x8ad5('0x61')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x8ad5('0x62'),_0x8ad5('0x63')],_0xa31f5c[_0x8ad5('0x60')][_0x8ad5('0x64')]())){try{_0xa31f5c[_0x8ad5('0x65')]=_0x1c0b5b['rawBody']?JSON[_0x8ad5('0x66')](_0x1c0b5b[_0x8ad5('0x67')]):{};}catch(_0x5b493d){logger[_0x8ad5('0x2b')](_0x8ad5('0x68'),_0x5b493d);}}try{_0xa31f5c['headers']=_0x1c0b5b[_0x8ad5('0xb')]?JSON[_0x8ad5('0x66')](_0x1c0b5b[_0x8ad5('0xb')]):{};}catch(_0x5e13db){logger[_0x8ad5('0x2b')](_0x8ad5('0x69'),_0x5e13db);}if(_0x1c0b5b[_0x8ad5('0x6a')]){try{var _0x5a52bf=require(_0x1c0b5b[_0x8ad5('0x6a')])['sync'](this,_0xa31f5c);_0xa31f5c[_0x8ad5('0x6b')]=Mustache['render'](_0x1c0b5b['url'],_0x5a52bf,{},['$$','$$']);if(_0xa31f5c[_0x8ad5('0x6c')]){_0xa31f5c[_0x8ad5('0x6c')]=JSON[_0x8ad5('0x66')](Mustache[_0x8ad5('0x6d')](JSON[_0x8ad5('0x6e')](_0xa31f5c[_0x8ad5('0x6c')]),_0x5a52bf,{},['$$','$$']));}if(_0xa31f5c[_0x8ad5('0x65')]){_0xa31f5c[_0x8ad5('0x65')]=JSON['parse'](Mustache[_0x8ad5('0x6d')](JSON[_0x8ad5('0x6e')](_0xa31f5c[_0x8ad5('0x65')]),_0x5a52bf,{},['$$','$$']));}}catch(_0xf98d75){logger[_0x8ad5('0x2b')](_0x8ad5('0x6f'),_0xf98d75);}}rp(_0xa31f5c)[_0x8ad5('0x13')](function(_0x395810){var _0x45fcfc={'statusCode':_0x395810[_0x8ad5('0x70')]||0xc8,'statusMessage':_0x395810['statusMessage']||'OK','headers':_0x395810[_0x8ad5('0x6c')]||{},'body':_0x395810['body']||{}};_0x2ba9af(null,_0x45fcfc);})[_0x8ad5('0x19')](function(_0x373136){var _0x24e1de={'statusCode':_0x373136['statusCode']||0x1f4,'statusMessage':_0x373136[_0x8ad5('0x71')]||_0x8ad5('0x72'),'headers':_0x373136['options'][_0x8ad5('0x6c')]||{},'body':_0x373136[_0x8ad5('0x73')][_0x8ad5('0x65')]||{}};_0x2ba9af(null,_0x24e1de);});};AGIVertices[_0x8ad5('0x15')]['googleDialogflow']=function(_0x135098,_0x1717a0){scripts[_0x8ad5('0x74')](this[_0x8ad5('0xe')]['uniqueid'],_0x135098[_0x8ad5('0x75')],_0x135098['text'],_0x135098[_0x8ad5('0x76')]||'en')[_0x8ad5('0x13')](function(_0x44490e){_0x1717a0(null,_0x44490e);})[_0x8ad5('0x19')](function(_0x4af4c3){_0x1717a0(_0x4af4c3);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x77')]=function(_0x6d4df2,_0x345ffb){scripts[_0x8ad5('0x77')](this['channel'][_0x8ad5('0x37')],_0x6d4df2[_0x8ad5('0x78')],_0x6d4df2[_0x8ad5('0x79')],_0x6d4df2[_0x8ad5('0x7a')],_0x6d4df2[_0x8ad5('0x5a')],_0x6d4df2[_0x8ad5('0x7b')]||'en')[_0x8ad5('0x13')](function(_0x4ead7a){_0x345ffb(null,_0x4ead7a);})[_0x8ad5('0x19')](function(_0x489acb){_0x345ffb(_0x489acb);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x7c')]=function(_0x3797b3,_0x554fb2){scripts[_0x8ad5('0x7c')](this['channel'],_0x3797b3)[_0x8ad5('0x13')](function(_0x2f7ca3){_0x554fb2(null,_0x2f7ca3);})[_0x8ad5('0x19')](function(_0x14f2b2){_0x554fb2(_0x14f2b2);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x7d')]=function(_0x2d6e7f,_0x547194){scripts['ispeechTTS'](_0x2d6e7f['key'],_0x2d6e7f[_0x8ad5('0x5a')],_0x2d6e7f[_0x8ad5('0x7e')]||_0x8ad5('0x7f'),_0x2d6e7f['speed'])[_0x8ad5('0x13')](function(_0x2e21bc){_0x547194(null,_0x2e21bc);})[_0x8ad5('0x19')](function(_0xdb0015){_0x547194(_0xdb0015);});};AGIVertices['prototype'][_0x8ad5('0x80')]=function(_0x5b87d8,_0x5e7ed5,_0x56e535){scripts[_0x8ad5('0x80')](_0x5e7ed5,_0x5b87d8[_0x8ad5('0x75')],_0x5b87d8['ispeech_asr_language']||'en-US',this['isConfigured'](_0x5b87d8[_0x8ad5('0x81')])?_0x5b87d8['model']:undefined)['then'](function(_0x2142c3){_0x56e535(null,_0x2142c3);})['catch'](function(_0x169c26){_0x56e535(_0x169c26);});};AGIVertices[_0x8ad5('0x15')]['awsPolly']=function(_0x44d839,_0x120885){scripts[_0x8ad5('0x82')](_0x44d839[_0x8ad5('0x83')],_0x44d839['aws_secret_access_key'],_0x44d839[_0x8ad5('0x84')],_0x44d839[_0x8ad5('0x85')]||_0x8ad5('0x86'),_0x44d839[_0x8ad5('0x5a')],_0x44d839[_0x8ad5('0x87')]||_0x8ad5('0x5a'))[_0x8ad5('0x13')](function(_0x5c3e4c){_0x120885(null,_0x5c3e4c);})[_0x8ad5('0x19')](function(_0x2453e2){_0x120885(_0x2453e2);});};AGIVertices['prototype'][_0x8ad5('0x88')]=function(_0x4d715e,_0x178095){scripts[_0x8ad5('0x88')](this[_0x8ad5('0xe')]['uniqueid'],_0x4d715e['aws_access_key_id'],_0x4d715e[_0x8ad5('0x89')],_0x4d715e[_0x8ad5('0x8a')],_0x4d715e[_0x8ad5('0x5a')],_0x4d715e[_0x8ad5('0x8b')])['then'](function(_0x1e2d7e){_0x178095(null,_0x1e2d7e);})[_0x8ad5('0x19')](function(_0x7630d5){_0x178095(_0x7630d5);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x8c')]=function(_0x4d2ab3,_0xd951ae,_0x56bba6){scripts['googleASR'](_0xd951ae,_0x4d2ab3[_0x8ad5('0x75')],_0x4d2ab3['google_asr_language']||'en-US')[_0x8ad5('0x13')](function(_0x17295c){_0x56bba6(null,_0x17295c);})['catch'](function(_0x2d4e26){_0x56bba6(_0x2d4e26);});};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x8d')]=function(_0x265273,_0x301617,_0x268a7c){scripts[_0x8ad5('0x8d')](_0x301617,_0x265273[_0x8ad5('0x8e')],_0x265273[_0x8ad5('0x8f')],_0x265273[_0x8ad5('0x6b')])[_0x8ad5('0x13')](function(_0x463fb8){_0x268a7c(null,_0x463fb8);})[_0x8ad5('0x19')](function(_0x3a3c9a){_0x268a7c(_0x3a3c9a);});};AGIVertices[_0x8ad5('0x15')]['clear']=function(_0x591c24){var _0x5e0536=_[_0x8ad5('0x90')](verticesWithRetry,_0x591c24[_0x8ad5('0x39')])?_0x591c24:_[_0x8ad5('0x91')](_0x591c24);for(var _0x206f7f in _0x5e0536){if(_0x5e0536[_0x8ad5('0x92')](_0x206f7f)){if(_0x5e0536[_0x206f7f]&&_[_0x8ad5('0x93')](_0x5e0536[_0x206f7f])){if(_[_0x8ad5('0x90')](recursiveMapAttributes,_0x206f7f)){_0x5e0536[_0x206f7f]=this['replaceObjectAllVariables'](_0x5e0536[_0x206f7f]);}else{_0x5e0536[_0x206f7f]=this[_0x8ad5('0x94')](_0x5e0536[_0x206f7f]);}}}}return _0x5e0536;};AGIVertices['prototype'][_0x8ad5('0x95')]=function(_0x216d0c){for(var _0x57f718 in _0x216d0c){if(_0x216d0c[_0x8ad5('0x92')](_0x57f718)){if(_[_0x8ad5('0x96')](_0x216d0c[_0x57f718])){this['recursiveNodeIndex'](_0x216d0c[_0x57f718]);}else if(_['isArray'](_0x216d0c[_0x57f718])){for(var _0xd3ad65=0x0;_0xd3ad65<_0x216d0c[_0x57f718]['length'];_0xd3ad65++){this[_0x8ad5('0x95')](_0x216d0c[_0x57f718][_0xd3ad65]);}}else if(_['isString'](_0x216d0c[_0x57f718])){_0x216d0c[_0x57f718]=this['replaceAllVariables'](_0x216d0c[_0x57f718]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x5a7bb6,_0x2e91cd){for(var _0x4a470c in _0x5a7bb6){if(_0x5a7bb6[_0x8ad5('0x92')](_0x4a470c)){if(_['isPlainObject'](_0x5a7bb6[_0x4a470c])){if(!_[_0x8ad5('0x43')](_0x5a7bb6[_0x4a470c])){this['saveRestApiResult'](_0x5a7bb6[_0x4a470c],util['format'](_0x8ad5('0x97'),_0x2e91cd,_0x4a470c));}}else if(_[_0x8ad5('0x98')](_0x5a7bb6[_0x4a470c])){for(var _0x558efb=0x0;_0x558efb<_0x5a7bb6[_0x4a470c]['length'];_0x558efb++){this[_0x8ad5('0x99')](_0x5a7bb6[_0x4a470c][_0x558efb],util[_0x8ad5('0x28')](_0x8ad5('0x97'),_0x2e91cd,_0x4a470c+'['+_0x558efb+']'));}}else{if(!_[_0x8ad5('0x44')](_0x5a7bb6[_0x4a470c])){this[_0x8ad5('0xe')][_0x8ad5('0x9a')](util[_0x8ad5('0x28')]('%s.%s',_0x2e91cd,_0x4a470c),_0x5a7bb6[_0x4a470c]);}}}}};AGIVertices[_0x8ad5('0x15')]['replaceObjectAllVariables']=function(_0x31aaba){try{var _0x236b3a=JSON[_0x8ad5('0x66')](_0x31aaba);this[_0x8ad5('0x95')](_0x236b3a);return JSON[_0x8ad5('0x6e')](_0x236b3a);}catch(_0x57701e){return this[_0x8ad5('0x94')](_0x31aaba);}};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x94')]=function(_0x29a0e8){var _0x6f300c=_0x29a0e8['split']('{');for(var _0x506474=0x1;_0x506474<_0x6f300c[_0x8ad5('0x9b')];_0x506474+=0x1){var _0x86dc2a=_0x6f300c[_0x506474][_0x8ad5('0x9c')]('}');if(_0x86dc2a['length']>0x1){_0x29a0e8=_0x29a0e8[_0x8ad5('0x9d')]('{'+_0x86dc2a[0x0]+'}',this[_0x8ad5('0xe')]['getVariable'](_0x86dc2a[0x0])[_0x8ad5('0x9e')]||_0x86dc2a[0x0]);}}if(_0x6f300c['length']===0x1){return _0x29a0e8[_0x8ad5('0x9f')]();}return this[_0x8ad5('0x94')](_0x29a0e8);};AGIVertices['prototype']['getAndSetVariable']=function(_0x4f80b9,_0x4984b1){var _0x2cea57=this['channel'][_0x8ad5('0x11')](_0x4f80b9);if(_0x2cea57[_0x8ad5('0xa0')]===-0x1){return _0x2cea57;}logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4984b1,_0x2cea57[_0x8ad5('0x9e')]));return this[_0x8ad5('0xe')][_0x8ad5('0x9a')](_0x4984b1,_0x2cea57[_0x8ad5('0x9e')]);};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0xa1')]=function(_0x1fad54){return _0x1fad54&&_0x1fad54!=='0'&&_0x1fad54!=='-1'&&_0x1fad54!=='';};AGIVertices['prototype'][_0x8ad5('0xa2')]=function(_0x540a6e){this[_0x8ad5('0x36')][_0x8ad5('0xa3')](this,_0x540a6e,'-');_0x540a6e[_0x8ad5('0xa4')]=_0x540a6e[_0x8ad5('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8ad5('0x15')]['mrcpsynth']=function(_0x3453ba){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0xa5'),_0x3453ba['label']));if(!this[_0x8ad5('0xa1')](_0x3453ba[_0x8ad5('0x5a')])){return this[_0x8ad5('0xe')]['noop']('no\x20text\x20configured');}var _0x2f72bc='\x22'+_0x3453ba[_0x8ad5('0x5a')]+'\x22';if(this[_0x8ad5('0xa1')](_0x3453ba[_0x8ad5('0x73')])){_0x2f72bc+=','+_0x3453ba[_0x8ad5('0x73')];}var _0x4dadc8=this['channel']['exec']('MRCPSynth',_0x2f72bc);if(_0x4dadc8['result']===-0x1){return _0x4dadc8;}return this['channel'][_0x8ad5('0xa6')](util['format'](_0x8ad5('0xa7'),_0x2f72bc));};AGIVertices['prototype'][_0x8ad5('0xa8')]=function(_0x5e2c07){logger['info'](util['format'](_0x8ad5('0xa9'),_0x5e2c07[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x5e2c07[_0x8ad5('0xaa')])){return this['channel'][_0x8ad5('0xa6')]('no\x20grammar\x20configured');}var _0x257c80=_0x5e2c07['grammar'];if(this[_0x8ad5('0xa1')](_0x5e2c07[_0x8ad5('0x73')])){_0x257c80+=','+_0x5e2c07[_0x8ad5('0x73')];}var _0x1ed2fa=this['channel']['exec'](_0x8ad5('0xab'),_0x257c80);if(_0x1ed2fa['result']===-0x1){return _0x1ed2fa;}var _0x26990c=this[_0x8ad5('0xac')](_0x8ad5('0xad'),_0x8ad5('0xae'));if(_0x26990c[_0x8ad5('0xa0')]===-0x1){return _0x26990c;}var _0x2fe363=this[_0x8ad5('0xac')](_0x8ad5('0xaf'),_0x8ad5('0xb0'));if(_0x2fe363[_0x8ad5('0xa0')]===-0x1){return _0x2fe363;}var _0x517724=this['getAndSetVariable'](_0x8ad5('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x517724['result']===-0x1){return _0x517724;}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x257c80));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x7')]=function(_0x22f7a8){logger[_0x8ad5('0x2d')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x22f7a8['label']));return this[_0x8ad5('0xe')]['agi']([_0x22f7a8[_0x8ad5('0xb2')],_0x22f7a8[_0x8ad5('0xb3')]]);};AGIVertices['prototype'][_0x8ad5('0xb4')]=function(_0x35854b){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0xb5'),_0x35854b['label']));if(this[_0x8ad5('0xa1')](_0x35854b['timeout'])){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0xb6'),_0x35854b[_0x8ad5('0x61')]));var _0x5ce6d0=this[_0x8ad5('0xe')][_0x8ad5('0xb7')](_0x35854b[_0x8ad5('0x61')]);if(_0x5ce6d0[_0x8ad5('0xa0')]===-0x1){return _0x5ce6d0;}}return this[_0x8ad5('0xe')][_0x8ad5('0xb4')]();};AGIVertices['prototype'][_0x8ad5('0xb8')]=function(_0x2be4c8){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0xb9'),_0x2be4c8[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x2be4c8[_0x8ad5('0x47')])){return this['channel'][_0x8ad5('0x2b')](_0x2be4c8,_0x8ad5('0xba'));}_0x2be4c8[_0x8ad5('0x49')]=moment();if(this[_0x8ad5('0xa1')](_0x2be4c8[_0x8ad5('0xbb')])){_0x2be4c8[_0x8ad5('0x49')]=moment()[_0x8ad5('0xbc')](_0x2be4c8['delay'],_0x8ad5('0xbd'));}if(!this[_0x8ad5('0xa1')](_0x2be4c8[_0x8ad5('0x4a')])){_0x2be4c8[_0x8ad5('0x4a')]=0x2;}this[_0x8ad5('0x42')]['sync'](this,_0x2be4c8);return this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')](_0x8ad5('0xbe'),_0x2be4c8[_0x8ad5('0x46')],_0x2be4c8[_0x8ad5('0x47')],_0x2be4c8[_0x8ad5('0x49')]));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0xbf')]=function(_0x15330a){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0xc0'),_0x15330a[_0x8ad5('0x38')]));var _0x50fec6=this[_0x8ad5('0xe')][_0x8ad5('0x55')](_0x15330a[_0x8ad5('0xc1')],_0x15330a[_0x8ad5('0x73')]);if(_0x50fec6[_0x8ad5('0xa0')]===-0x1){return _0x50fec6;}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util['format'](_0x8ad5('0xc2'),_0x15330a[_0x8ad5('0xc1')],_0x15330a[_0x8ad5('0x73')]));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0xc3')]=function(_0x14d2de){logger['info'](util['format'](_0x8ad5('0xc4'),_0x14d2de[_0x8ad5('0x38')]));if(!this['isConfigured'](_0x14d2de['text'])){return this['channel'][_0x8ad5('0xa6')](_0x8ad5('0xc5'));}var _0x456166='\x22'+_0x14d2de[_0x8ad5('0x5a')]+'\x22';if(this[_0x8ad5('0xa1')](_0x14d2de[_0x8ad5('0x73')])){_0x456166+=','+_0x14d2de[_0x8ad5('0x73')];}var _0x5daea7=this[_0x8ad5('0xe')][_0x8ad5('0x55')]('MRCPSynth',_0x456166);if(_0x5daea7['result']===-0x1){return _0x5daea7;}return this['channel'][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xa7'),_0x456166));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0xc6')]=function(_0x294d24){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0xc7'),_0x294d24[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x294d24[_0x8ad5('0x5a')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20text\x20configured');}var _0x4dc51a='\x22'+_0x294d24[_0x8ad5('0x5a')]+'\x22';if(this[_0x8ad5('0xa1')](_0x294d24[_0x8ad5('0x73')])){_0x4dc51a+=','+_0x294d24[_0x8ad5('0x73')];}var _0xbd2865=this['channel'][_0x8ad5('0x55')](_0x8ad5('0xc8'),_0x4dc51a);if(_0xbd2865[_0x8ad5('0xa0')]===-0x1){return _0xbd2865;}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xa7'),_0x4dc51a));};AGIVertices['prototype'][_0x8ad5('0xc9')]=function(_0x38b6d3){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0xca'),_0x38b6d3['label']));if(!this[_0x8ad5('0xa1')](_0x38b6d3[_0x8ad5('0xaa')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0xcb'));}var _0x9890d6=_0x38b6d3[_0x8ad5('0xaa')];if(this[_0x8ad5('0xa1')](_0x38b6d3[_0x8ad5('0x73')])){_0x9890d6+=','+_0x38b6d3['options'];}var _0x1806a2=this['channel'][_0x8ad5('0x55')](_0x8ad5('0xab'),_0x9890d6);if(_0x1806a2['result']===-0x1){return _0x1806a2;}var _0x2f85c3=this[_0x8ad5('0xac')](_0x8ad5('0xad'),_0x8ad5('0xcc'));if(_0x2f85c3[_0x8ad5('0xa0')]===-0x1){return _0x2f85c3;}var _0x3de493=this[_0x8ad5('0xac')](_0x8ad5('0xaf'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3de493[_0x8ad5('0xa0')]===-0x1){return _0x3de493;}var _0x5cc903=this[_0x8ad5('0xac')](_0x8ad5('0xb1'),'LUMENVOX_ASR_INSTANCE');if(_0x5cc903[_0x8ad5('0xa0')]===-0x1){return _0x5cc903;}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xcd'),_0x9890d6));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0xce')]=function(_0x15aa74){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0xcf'),_0x15aa74[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x15aa74['grammar'])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0xcb'));}var _0xeda6dd=_0x15aa74[_0x8ad5('0xaa')];if(this[_0x8ad5('0xa1')](_0x15aa74[_0x8ad5('0x73')])){_0xeda6dd+=','+_0x15aa74['options'];}var _0xc75a05=this[_0x8ad5('0xe')]['exec'](_0x8ad5('0xab'),_0xeda6dd);if(_0xc75a05[_0x8ad5('0xa0')]===-0x1){return _0xc75a05;}var _0x2c878f=this[_0x8ad5('0xac')](_0x8ad5('0xad'),_0x8ad5('0xd0'));if(_0x2c878f[_0x8ad5('0xa0')]===-0x1){return _0x2c878f;}var _0x3c0a4e=this[_0x8ad5('0xac')](_0x8ad5('0xaf'),_0x8ad5('0xd1'));if(_0x3c0a4e[_0x8ad5('0xa0')]===-0x1){return _0x3c0a4e;}var _0x48e589=this[_0x8ad5('0xac')](_0x8ad5('0xb1'),_0x8ad5('0xd2'));if(_0x48e589[_0x8ad5('0xa0')]===-0x1){return _0x48e589;}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0xeda6dd));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0xd3')]=function(_0x32a31e){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0xd4'),_0x32a31e['label']));if(!this[_0x8ad5('0xa1')](_0x32a31e[_0x8ad5('0xd5')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x32a31e,'no\x20database\x20selected');}var _0x3740be=this[_0x8ad5('0x1a')][_0x8ad5('0xa3')](this,_0x32a31e[_0x8ad5('0xd5')]);if(!_0x3740be){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x32a31e,_0x8ad5('0xd6'));}if(!this[_0x8ad5('0xa1')](_0x32a31e['query'])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x32a31e,'no\x20query\x20configured');}var _0x44073f=_0x32a31e[_0x8ad5('0x2f')][_0x8ad5('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')](_0x8ad5('0xd7'),_0x44073f));var _0x3e432a=this[_0x8ad5('0x29')][_0x8ad5('0xa3')](this,_0x3740be,_0x44073f);this['createSquareDetailsReport'][_0x8ad5('0xa3')](this,_0x32a31e,_0x44073f);if(!this[_0x8ad5('0xa1')](_0x32a31e[_0x8ad5('0xd8')])){return this['channel'][_0x8ad5('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x232eec=this[_0x8ad5('0x11')][_0x8ad5('0xa3')](this,_0x32a31e[_0x8ad5('0xd8')]);if(!_0x232eec){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x32a31e,_0x8ad5('0xd9'));}var _0x2f2f43=this;_0x3e432a[_0x8ad5('0xda')](function(_0x58ed74,_0x242d7b){Object['keys'](_0x58ed74)[_0x8ad5('0xda')](function(_0x73ebee){_0x2f2f43[_0x8ad5('0xe')][_0x8ad5('0x9a')](util[_0x8ad5('0x28')](_0x8ad5('0xdb'),_0x232eec,_0x242d7b,_0x73ebee),_0x58ed74[_0x73ebee]);});});this['channel'][_0x8ad5('0x9a')](util[_0x8ad5('0x28')](_0x8ad5('0xdc'),_0x232eec),_0x3e432a[_0x8ad5('0x9b')]);return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xdd'),_0x232eec));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0xde')]=function(_0x5713a6){logger[_0x8ad5('0xdf')](util[_0x8ad5('0x28')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x5713a6[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x5713a6[_0x8ad5('0xe0')])){return this['channel'][_0x8ad5('0x2b')](_0x5713a6,_0x8ad5('0xe1'));}var _0x73ec48=this[_0x8ad5('0x1c')][_0x8ad5('0xa3')](this,_0x5713a6[_0x8ad5('0xe0')]);if(!_0x73ec48){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x5713a6,_0x8ad5('0xe2'));}var _0x174d67=this[_0x8ad5('0xe')][_0x8ad5('0x55')](_0x8ad5('0xe3'),[util['format'](_0x8ad5('0xe4'),_0x73ec48),_0x5713a6[_0x8ad5('0x61')],_0x5713a6[_0x8ad5('0xe5')],_0x5713a6[_0x8ad5('0x5f')]]);if(_0x174d67[_0x8ad5('0xa0')]===-0x1){return _0x174d67;}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xe6'),'DIAL'));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0xe7')]=function(_0x2db197){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0xe8'),_0x2db197[_0x8ad5('0x38')]));if(!this['isConfigured'](_0x2db197[_0x8ad5('0x75')])){return this['channel'][_0x8ad5('0xa6')]('no\x20key\x20configured');}if(!this[_0x8ad5('0xa1')](_0x2db197[_0x8ad5('0x5a')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0xc5'));}this[_0x8ad5('0xe')][_0x8ad5('0xe9')]=!![];this[_0x8ad5('0x36')](_0x2db197);this[_0x8ad5('0x41')](_0x2db197[_0x8ad5('0x5a')],'in','','');this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util['format'](_0x8ad5('0xea'),_0x2db197[_0x8ad5('0x5a')]));var _0x222f5a=this[_0x8ad5('0x74')][_0x8ad5('0xa3')](this,_0x2db197);if(_0x222f5a){for(var _0x1a5191 in _0x222f5a){if(_0x222f5a[_0x8ad5('0x92')](_0x1a5191)){this[_0x8ad5('0xe')][_0x8ad5('0x9a')](util[_0x8ad5('0x28')](_0x8ad5('0xeb'),_0x1a5191['toUpperCase']()),_0x222f5a[_0x1a5191]);}}this[_0x8ad5('0x41')](_0x222f5a[_0x8ad5('0xec')],'out',_0x8ad5('0xe7'),'');return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')]('Dialogflow\x20Result\x20%s',_0x222f5a[_0x8ad5('0xec')]));}return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x2db197,_0x8ad5('0xed'));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0xee')]=function(_0x39cd2e){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0xef'),_0x39cd2e[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x39cd2e[_0x8ad5('0x78')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20project_id\x20configured');}if(!this[_0x8ad5('0xa1')](_0x39cd2e[_0x8ad5('0x79')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0xf0'));}if(!this[_0x8ad5('0xa1')](_0x39cd2e[_0x8ad5('0x7a')])){return this[_0x8ad5('0xe')]['noop'](_0x8ad5('0xf1'));}if(!this[_0x8ad5('0xa1')](_0x39cd2e[_0x8ad5('0x7b')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20anguage\x20configured');}if(!this[_0x8ad5('0xa1')](_0x39cd2e[_0x8ad5('0x5a')])){return this['channel']['noop'](_0x8ad5('0xc5'));}this['channel']['bot']=!![];this[_0x8ad5('0x36')](_0x39cd2e);this[_0x8ad5('0x41')](_0x39cd2e[_0x8ad5('0x5a')],'in','','');this['channel'][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xf2'),_0x39cd2e[_0x8ad5('0x5a')]));var _0x1df5e6=this[_0x8ad5('0x77')][_0x8ad5('0xa3')](this,_0x39cd2e);if(_0x1df5e6){for(var _0x5af414 in _0x1df5e6){if(_0x1df5e6[_0x8ad5('0x92')](_0x5af414)){if(_0x5af414!==_0x8ad5('0xf3')){this[_0x8ad5('0xe')][_0x8ad5('0x9a')](util[_0x8ad5('0x28')](_0x8ad5('0xeb'),_0x5af414[_0x8ad5('0x64')]()),_0x1df5e6[_0x5af414]);}}}this[_0x8ad5('0x41')](_0x1df5e6['speech'],_0x8ad5('0xf4'),_0x8ad5('0xee'),_0x1df5e6[_0x8ad5('0xf3')]);return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xf5'),_0x1df5e6['speech']));}return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x39cd2e,_0x8ad5('0xf6'));};AGIVertices['prototype']['sesteknda']=function(_0x1a6ccc){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0xf7'),_0x1a6ccc[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x1a6ccc[_0x8ad5('0xf8')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x8ad5('0xa1')](_0x1a6ccc[_0x8ad5('0xf9')])){return this[_0x8ad5('0xe')]['noop']('no\x20username\x20configured');}if(!this[_0x8ad5('0xa1')](_0x1a6ccc[_0x8ad5('0xfa')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20password\x20configured');}if(!this[_0x8ad5('0xa1')](_0x1a6ccc[_0x8ad5('0xfb')])){return this['channel'][_0x8ad5('0xa6')](_0x8ad5('0xc5'));}this['channel']['bot']=!![];this[_0x8ad5('0x36')](_0x1a6ccc);this[_0x8ad5('0x41')](_0x1a6ccc['text'],'in','','');this['channel']['noop'](util[_0x8ad5('0x28')](_0x8ad5('0xfc'),_0x1a6ccc[_0x8ad5('0x5a')]));var _0x4916fd=this[_0x8ad5('0x7c')][_0x8ad5('0xa3')](this,_0x1a6ccc);if(_0x4916fd){for(var _0x5425c0 in _0x4916fd){if(_0x4916fd['hasOwnProperty'](_0x5425c0)){this[_0x8ad5('0xe')][_0x8ad5('0x9a')](util[_0x8ad5('0x28')](_0x8ad5('0xfd'),_0x5425c0[_0x8ad5('0x64')]()),_0x4916fd[_0x5425c0]);}}this[_0x8ad5('0x41')](_0x4916fd[_0x8ad5('0xec')],_0x8ad5('0xf4'),_0x8ad5('0xfe'),'');if(_0x4916fd['audiofile']){this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xff'),_0x4916fd[_0x8ad5('0x100')]));var _0x51bf8e=this[_0x8ad5('0xe')][_0x8ad5('0x101')](_0x4916fd[_0x8ad5('0x100')]);try{fs[_0x8ad5('0x102')](_0x4916fd[_0x8ad5('0x100')]+_0x8ad5('0x103'));}catch(_0x2b7309){logger['error'](_0x2b7309);}return _0x51bf8e;}else{return this['channel'][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x104'),_0x4916fd['speech']));}}return this[_0x8ad5('0xe')]['error'](_0x1a6ccc,_0x8ad5('0x105'));};AGIVertices[_0x8ad5('0x15')]['end']=function(_0x10f47e){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x106'),_0x10f47e['label']));return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x107'));};AGIVertices[_0x8ad5('0x15')]['ext_dial']=function(_0x4aa13e){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x108'),_0x4aa13e[_0x8ad5('0x38')]));var _0x7ffb75='';if(_0x4aa13e[_0x8ad5('0x109')]){if(!this['isConfigured'](_0x4aa13e[_0x8ad5('0x109')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x4aa13e,_0x8ad5('0x10a'));}else{var _0x315e3a=parseInt(_0x4aa13e[_0x8ad5('0x109')],0xa);if(isNaN(_0x315e3a)){_0x7ffb75=_0x4aa13e['trunk_id'];}else{_0x7ffb75=this[_0x8ad5('0x1e')][_0x8ad5('0xa3')](this,_0x4aa13e[_0x8ad5('0x109')]);if(!_0x7ffb75){return this[_0x8ad5('0xe')]['error'](_0x4aa13e,_0x8ad5('0x10b'));}}}}else if(_0x4aa13e[_0x8ad5('0x10c')]){_0x7ffb75=_0x4aa13e[_0x8ad5('0x10c')];}else{return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x4aa13e,_0x8ad5('0x10a'));}var _0x2a9b9f=this[_0x8ad5('0xe')][_0x8ad5('0x55')](_0x8ad5('0xe3'),[util['format'](_0x8ad5('0x10d'),_0x7ffb75,_0x4aa13e['phone']),_0x4aa13e['timeout'],_0x4aa13e[_0x8ad5('0xe5')],_0x4aa13e[_0x8ad5('0x5f')]]);if(_0x2a9b9f[_0x8ad5('0xa0')]===-0x1){return _0x2a9b9f;}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xe6'),'DIAL'));};AGIVertices[_0x8ad5('0x15')]['finally']=function(_0x2b0a51){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x10e'),_0x2b0a51[_0x8ad5('0x38')]));return this['channel']['noop'](_0x8ad5('0x10f'));};AGIVertices[_0x8ad5('0x15')]['getdigits']=function(_0xb700d3){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x110'),_0xb700d3['label']));if(_0xb700d3[_0x8ad5('0xa4')]===0x0){return this['maxRetry'](_0xb700d3);}_0xb700d3['retry']-=0x1;if(!this[_0x8ad5('0xa1')](_0xb700d3[_0x8ad5('0x111')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0xb700d3,'no\x20file\x20audio\x20selected');}var _0x355d9d=this[_0x8ad5('0x112')]['sync'](this,_0xb700d3['file_id']);if(!_0x355d9d){return this['channel'][_0x8ad5('0x2b')](_0xb700d3,_0x8ad5('0x113'));}if(!this[_0x8ad5('0xa1')](_0xb700d3[_0x8ad5('0xd8')])){return this['channel'][_0x8ad5('0x2b')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1775dc=this[_0x8ad5('0xe')][_0x8ad5('0x114')](_0x355d9d,_0xb700d3['response'],_0xb700d3[_0x8ad5('0x115')]);var _0x348210=_0x1775dc[_0x8ad5('0xa0')]?_0x1775dc[_0x8ad5('0xa0')][_0x8ad5('0x9f')]():'';logger[_0x8ad5('0x2d')](_0x8ad5('0x116'),JSON[_0x8ad5('0x6e')](_0x1775dc));if(_0x1775dc[_0x8ad5('0xa0')]===-0x1){this[_0x8ad5('0x36')][_0x8ad5('0xa3')](this,_0xb700d3,_0x348210);return _0x1775dc;}else if(_0x1775dc[_0x8ad5('0x9e')]===_0x8ad5('0x61')){_0x1775dc['result']=_0x348210[_0x8ad5('0x9b')]>=parseInt(_0xb700d3[_0x8ad5('0x117')])?'x':'i';}else{_0x1775dc[_0x8ad5('0xa0')]=_0x348210[_0x8ad5('0x9b')]>=parseInt(_0xb700d3[_0x8ad5('0x117')])&&_0x348210[_0x8ad5('0x9b')]<=parseInt(_0xb700d3['maxdigit'])?'x':'i';}var _0x30c325=this[_0x8ad5('0x11')][_0x8ad5('0xa3')](this,_0xb700d3[_0x8ad5('0xd8')]);if(!_0x30c325){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0xb700d3,_0x8ad5('0xd9'));}this[_0x8ad5('0xe')][_0x8ad5('0x9a')](_0x30c325,_0x348210);if(this['isConfigured'](_0xb700d3[_0x8ad5('0x118')])){var _0x26cf7a=parseInt(_0xb700d3[_0x8ad5('0x118')],0xa);var _0x3c8053=rs['generate']({'charset':'*','length':_0x26cf7a});var _0x3295e4=_0x348210[_0x8ad5('0x9b')];if(_0x3295e4>0x0){if(_0x3295e4>_0x26cf7a){this[_0x8ad5('0x36')]['sync'](this,_0xb700d3,_0xb700d3[_0x8ad5('0x119')]===_0x8ad5('0x11a')?_0x3c8053+_0x348210[_0x8ad5('0x11b')](_0x26cf7a):_0x348210[_0x8ad5('0x11b')](0x0,_0x3295e4-_0x26cf7a)+_0x3c8053);}else{this[_0x8ad5('0x36')][_0x8ad5('0xa3')](this,_0xb700d3,rs[_0x8ad5('0x11c')]({'charset':'*','length':_0x3295e4}));}}else{this['createSquareDetailsReport'][_0x8ad5('0xa3')](this,_0xb700d3,'');}}else{this['createSquareDetailsReport']['sync'](this,_0xb700d3,_0x348210);}return _0x1775dc;};AGIVertices[_0x8ad5('0x15')]['getsecretdigits']=function(_0x4717c5){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x11d'),_0x4717c5['label']));return this[_0x8ad5('0xc')](_0x4717c5);};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x11e')]=function(_0x526f2c){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x11f'),_0x526f2c[_0x8ad5('0x38')]));this[_0x8ad5('0x36')][_0x8ad5('0xa3')](this,_0x526f2c,_0x526f2c['goalname']);return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x120'),_0x526f2c[_0x8ad5('0x121')]));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x122')]=function(_0x2918f9){logger[_0x8ad5('0x2d')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x2918f9[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x2918f9[_0x8ad5('0x83')])||!this[_0x8ad5('0xa1')](_0x2918f9[_0x8ad5('0x89')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x123'));}if(!this['isConfigured'](_0x2918f9['text'])){return this['channel'][_0x8ad5('0xa6')](_0x8ad5('0xc5'));}this['channel'][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x124'),_0x2918f9[_0x8ad5('0x5a')]));var _0x2f6a2f=this['awsPolly'][_0x8ad5('0xa3')](this,_0x2918f9);if(_0x2f6a2f){this['channel'][_0x8ad5('0xa6')](util[_0x8ad5('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x2f6a2f));var _0x51d422=this['channel'][_0x8ad5('0x101')](_0x2f6a2f);try{fs[_0x8ad5('0x102')](_0x2f6a2f+_0x8ad5('0x103'));}catch(_0xa5c042){logger[_0x8ad5('0x2b')](_0xa5c042);}return _0x51d422;}return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x2918f9,_0x8ad5('0x125'));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x126')]=function(_0x51d160){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0x127'),_0x51d160[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x51d160[_0x8ad5('0x83')])||!this[_0x8ad5('0xa1')](_0x51d160[_0x8ad5('0x89')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x51d160[_0x8ad5('0x8b')])){return this[_0x8ad5('0xe')]['noop'](_0x8ad5('0x128'));}if(!this[_0x8ad5('0xa1')](_0x51d160[_0x8ad5('0x5a')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0xc5'));}this['channel'][_0x8ad5('0xe9')]=!![];this['createSquareDetailsReport'](_0x51d160);this[_0x8ad5('0x41')](_0x51d160[_0x8ad5('0x5a')],'in','','');this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util['format'](_0x8ad5('0x129'),_0x51d160[_0x8ad5('0x5a')]));var _0x532204=this['awsLex'][_0x8ad5('0xa3')](this,_0x51d160);if(_0x532204){for(var _0x35ebec in _0x532204){if(_0x532204[_0x8ad5('0x92')](_0x35ebec)&&_[_0x8ad5('0x93')](_0x532204[_0x35ebec])){this['channel'][_0x8ad5('0x9a')](util[_0x8ad5('0x28')]('AWS_LEX_%s',_0x35ebec[_0x8ad5('0x64')]()),_0x532204[_0x35ebec]);}}if(_[_0x8ad5('0x44')](_0x532204[_0x8ad5('0x71')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x12a'));}else{this[_0x8ad5('0x41')](_0x532204['message'],'out',_0x8ad5('0x12b'),'');return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x12c'),_0x532204[_0x8ad5('0x71')]));}}return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x51d160,_0x8ad5('0x12d'));};AGIVertices['prototype'][_0x8ad5('0x12e')]=function(_0x45607b){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0x12f'),_0x45607b['label'],_0x45607b[_0x8ad5('0x61')]));if(!this[_0x8ad5('0xa1')](_0x45607b[_0x8ad5('0x75')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x130'));}var _0x4ec8fd=_0x8ad5('0x131');var _0x12da39=util[_0x8ad5('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x8ad5('0x11c')](0x4));var _0x3b6f59=util['format'](_0x8ad5('0x97'),_0x12da39,_0x4ec8fd);var _0x451fe3=!![];if(_0x45607b[_0x8ad5('0x132')]===_0x8ad5('0x133')){_0x451fe3=![];}var _0x695d10=this[_0x8ad5('0xe')][_0x8ad5('0x134')](_0x12da39,_0x4ec8fd,_0x45607b[_0x8ad5('0x135')],_0x45607b[_0x8ad5('0x61')],undefined,_0x451fe3);if(_0x695d10[_0x8ad5('0xa0')]!==-0x1){this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x136'),_0x3b6f59));var _0x5891b9=this['googleASR'][_0x8ad5('0xa3')](this,_0x45607b,_0x3b6f59);if(_0x5891b9){for(var _0x4d0d11 in _0x5891b9){if(_0x5891b9[_0x8ad5('0x92')](_0x4d0d11)){this[_0x8ad5('0xe')][_0x8ad5('0x9a')](util[_0x8ad5('0x28')](_0x8ad5('0x137'),_0x4d0d11[_0x8ad5('0x64')]()),_0x5891b9[_0x4d0d11]);}}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util['format'](_0x8ad5('0x138'),JSON[_0x8ad5('0x6e')](_0x5891b9)));}}return _0x695d10;};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x139')]=function(_0x40343e){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x13a'),_0x40343e[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x40343e[_0x8ad5('0x8e')])){return this['channel']['noop'](_0x8ad5('0x13b'));}if(!this['isConfigured'](_0x40343e[_0x8ad5('0x8f')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20appsecret\x20configured');}var _0x19e3cc=_0x8ad5('0x131');var _0x13d8cb=util[_0x8ad5('0x28')](_0x8ad5('0x13c'),FILES_PATH,rs['generate'](0x4));var _0x8ac2ae=util['format'](_0x8ad5('0x97'),_0x13d8cb,_0x19e3cc);var _0x4d2c66=!![];if(_0x40343e[_0x8ad5('0x132')]===_0x8ad5('0x133')){_0x4d2c66=![];}var _0x34d44d=this[_0x8ad5('0xe')][_0x8ad5('0x134')](_0x13d8cb,_0x19e3cc,_0x40343e[_0x8ad5('0x135')],_0x40343e[_0x8ad5('0x61')],undefined,_0x4d2c66);if(_0x34d44d['result']!==-0x1){this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x13d'),_0x8ac2ae));var _0x1b2f02=this['tildeASR'][_0x8ad5('0xa3')](this,_0x40343e,_0x8ac2ae);if(_0x1b2f02){for(var _0x510ae5 in _0x1b2f02){if(_0x1b2f02[_0x8ad5('0x92')](_0x510ae5)){this['channel'][_0x8ad5('0x9a')](util['format']('TILDE_ASR_%s',_0x510ae5[_0x8ad5('0x64')]()),_0x1b2f02[_0x510ae5]);}}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x13e'),JSON['stringify'](_0x1b2f02)));}}return _0x34d44d;};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x13f')]=function(_0x3db785){logger[_0x8ad5('0x2d')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3db785['label']));return this[_0x8ad5('0xe')][_0x8ad5('0x140')](_0x3db785[_0x8ad5('0x3c')],_0x3db785[_0x8ad5('0x3d')],_0x3db785['priority']);};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x141')]=function(_0x5dd5c2){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x5dd5c2[_0x8ad5('0x38')]));if(!this['isConfigured'](_0x5dd5c2[_0x8ad5('0x142')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x5dd5c2,'no\x20condition\x20configured');}try{var _0x4c3d53=eval(_0x5dd5c2[_0x8ad5('0x142')])?_0x8ad5('0x143'):'false';this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x144'),_0x5dd5c2[_0x8ad5('0x142')],_0x4c3d53));return{'code':0xc8,'result':_0x4c3d53};}catch(_0x3618e6){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0x8ad5('0x145')]=function(_0x43a953){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x146'),_0x43a953['label']));if(!this[_0x8ad5('0xa1')](_0x43a953[_0x8ad5('0x147')])){return this['channel']['error'](_0x43a953,_0x8ad5('0x148'));}var _0x3d44ab=this[_0x8ad5('0x23')][_0x8ad5('0xa3')](this,_0x43a953[_0x8ad5('0x147')]);if(!_0x3d44ab){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x43a953,_0x8ad5('0x149'));}for(var _0x1a378f=0x0;_0x1a378f<_0x3d44ab[_0x8ad5('0x9b')];_0x1a378f+=0x1){var _0x2a6214=this[_0x8ad5('0xe')][_0x8ad5('0x11')](util[_0x8ad5('0x28')](_0x8ad5('0x14a'),_0x3d44ab[_0x1a378f]));if(_0x2a6214[_0x8ad5('0xa0')]===-0x1){return _0x2a6214;}logger[_0x8ad5('0x2d')](util['format']('IFTIME\x20%s\x20%s',_0x3d44ab[_0x1a378f],_0x2a6214[_0x8ad5('0x9e')]));if(_0x2a6214[_0x8ad5('0x9e')]===_0x8ad5('0x143')){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x14b'),_0x3d44ab[_0x1a378f],_0x8ad5('0x143')));this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x14b'),_0x3d44ab[_0x1a378f],'true'));return{'code':0xc8,'result':_0x8ad5('0x143')};}else{logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x14b'),_0x3d44ab[_0x1a378f],_0x8ad5('0x14c')));this['channel']['noop'](util[_0x8ad5('0x28')](_0x8ad5('0x14b'),_0x3d44ab[_0x1a378f],'false'));}}return{'code':0xc8,'result':_0x8ad5('0x14c')};};AGIVertices['prototype'][_0x8ad5('0x14d')]=function(_0x463522){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x14e'),_0x463522[_0x8ad5('0x38')]));return this[_0x8ad5('0xe')][_0x8ad5('0x14d')]();};AGIVertices[_0x8ad5('0x15')]['ispeechasr']=function(_0x4e9e92){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4e9e92[_0x8ad5('0x38')]));if(!this['isConfigured'](_0x4e9e92[_0x8ad5('0x75')])){return this['channel']['noop'](_0x8ad5('0x130'));}var _0x57583f=_0x8ad5('0x131');var _0x3a060c=util[_0x8ad5('0x28')](_0x8ad5('0x13c'),FILES_PATH,rs[_0x8ad5('0x11c')](0x4));var _0x49d549=util[_0x8ad5('0x28')](_0x8ad5('0x97'),_0x3a060c,_0x57583f);var _0x41059c=!![];if(_0x4e9e92[_0x8ad5('0x132')]==='NOBEEP'){_0x41059c=![];}var _0x4f8601=this['channel'][_0x8ad5('0x134')](_0x3a060c,_0x57583f,_0x4e9e92[_0x8ad5('0x135')],_0x4e9e92[_0x8ad5('0x61')],undefined,_0x41059c);if(_0x4f8601['result']!==-0x1){this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')]('ispeech\x20%s\x20file\x20created',_0x49d549));var _0x5d69c0=this[_0x8ad5('0x80')][_0x8ad5('0xa3')](this,_0x4e9e92,_0x49d549);if(_0x5d69c0){for(var _0x2a3098 in _0x5d69c0){if(_0x5d69c0[_0x8ad5('0x92')](_0x2a3098)){this['channel'][_0x8ad5('0x9a')](util[_0x8ad5('0x28')](_0x8ad5('0x14f'),_0x2a3098[_0x8ad5('0x64')]()),_0x5d69c0[_0x2a3098]);}}return this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x5d69c0)));}}return _0x4f8601;};AGIVertices['prototype'][_0x8ad5('0x150')]=function(_0x3b7198){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3b7198[_0x8ad5('0x38')]));if(!this['isConfigured'](_0x3b7198[_0x8ad5('0x75')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x130'));}if(!this[_0x8ad5('0xa1')](_0x3b7198[_0x8ad5('0x5a')])){return this['channel']['noop'](_0x8ad5('0xc5'));}this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util['format'](_0x8ad5('0x151'),_0x3b7198[_0x8ad5('0x5a')]));var _0x4f6793=this[_0x8ad5('0x7d')][_0x8ad5('0xa3')](this,_0x3b7198);if(_0x4f6793){this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')](_0x8ad5('0x152'),_0x4f6793));var _0x38c50f=this['channel']['streamFile'](_0x4f6793,_0x3b7198['intKey']);try{fs['unlink'](_0x4f6793+_0x8ad5('0x103'));}catch(_0x32fa47){logger['error'](_0x32fa47);}return _0x38c50f;}return this[_0x8ad5('0xe')]['error'](_0x3b7198,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x8ad5('0x153')]=function(_0x3c9e89){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0x154'),_0x3c9e89[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x3c9e89[_0x8ad5('0x155')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x3c9e89,_0x8ad5('0x156'));}logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x157'),this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x3c9e89[_0x8ad5('0x155')]));var _0x2fa1f5=this[_0x8ad5('0x158')][_0x8ad5('0xa3')](this,_0x3c9e89[_0x8ad5('0x155')]);if(_0x2fa1f5){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x3c9e89[_0x8ad5('0x155')]));this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x159'),this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x3c9e89[_0x8ad5('0x155')]));return{'code':0xc8,'result':_0x8ad5('0x15a')};}else{logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0x15b'),this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x3c9e89[_0x8ad5('0x155')]));this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x15b'),this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x3c9e89[_0x8ad5('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x15c')]=function(_0x51eeff){logger['info'](util['format'](_0x8ad5('0x15d'),_0x51eeff['label']));if(!this[_0x8ad5('0xa1')](_0x51eeff[_0x8ad5('0x155')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x51eeff,_0x8ad5('0x156'));}logger[_0x8ad5('0x2d')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8ad5('0xe')]['callerid'],_0x51eeff['findBy']));var _0x12879a=this[_0x8ad5('0x51')][_0x8ad5('0xa3')](this,_0x51eeff[_0x8ad5('0x155')]);if(_0x12879a){logger[_0x8ad5('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x51eeff[_0x8ad5('0x155')]));this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x159'),this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x51eeff[_0x8ad5('0x155')]));return{'code':0xc8,'result':_0x8ad5('0x15a')};}else{logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0x15b'),this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x51eeff[_0x8ad5('0x155')]));this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util['format'](_0x8ad5('0x15b'),this['channel']['callerid'],_0x51eeff['findBy']));return{'code':0xc8,'result':_0x8ad5('0x15e')};}};AGIVertices[_0x8ad5('0x15')]['math']=function(_0xf6569a){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x15f'),_0xf6569a[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0xf6569a[_0x8ad5('0x160')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0xf6569a,_0x8ad5('0x161'));}this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x162'),_0xf6569a[_0x8ad5('0x160')]));var _0x4f187b=eval(_0xf6569a['operation']);if(!this[_0x8ad5('0xa1')](_0xf6569a[_0x8ad5('0xd8')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x47c760=this[_0x8ad5('0x11')][_0x8ad5('0xa3')](this,_0xf6569a[_0x8ad5('0xd8')]);if(!_0x47c760){return this['channel']['error'](_0xf6569a,_0x8ad5('0xd9'));}if(_['isArray'](_0x4f187b)){var _0x31c855=this;_0x4f187b['forEach'](function(_0x3c730b,_0xcde85a){_0x31c855[_0x8ad5('0xe')][_0x8ad5('0x9a')](util[_0x8ad5('0x28')](_0x8ad5('0x163'),_0x47c760,_0xcde85a),_0x3c730b);});return this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')](_0x8ad5('0x164'),_0x47c760));}else{return this['channel'][_0x8ad5('0x9a')](_0x47c760,_0x4f187b);}};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x165')]=function(_0x4b4705){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0x166'),_0x4b4705[_0x8ad5('0x38')]));if(_0x4b4705['retry']===0x0){return this[_0x8ad5('0xa2')](_0x4b4705);}_0x4b4705[_0x8ad5('0xa4')]-=0x1;if(!this[_0x8ad5('0xa1')](_0x4b4705['file_id'])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x4b4705,'no\x20file\x20audio\x20selected');}var _0x579066=this['getSound']['sync'](this,_0x4b4705[_0x8ad5('0x111')]);if(!_0x579066){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x4b4705,_0x8ad5('0x113'));}var _0xddd9f0=this['channel'][_0x8ad5('0x114')](_0x579066,_0x4b4705[_0x8ad5('0x167')],_0x4b4705[_0x8ad5('0x168')]);var _0x24dfae=_0xddd9f0[_0x8ad5('0xa0')];if(_0xddd9f0[_0x8ad5('0xa0')]===-0x1){this[_0x8ad5('0x36')][_0x8ad5('0xa3')](this,_0x4b4705,'-1');return _0xddd9f0;}else if(_0xddd9f0[_0x8ad5('0x9e')]===_0x8ad5('0x61')){_0xddd9f0['result']=_0xddd9f0[_0x8ad5('0xa0')][_0x8ad5('0x9b')]>0x0?_0xddd9f0[_0x8ad5('0xa0')]:'t';}else if(_[_0x8ad5('0x43')](_0xddd9f0[_0x8ad5('0xa0')])){_0xddd9f0['result']='#';_0x24dfae='#';}if(!this[_0x8ad5('0xa1')](_0x4b4705[_0x8ad5('0xd8')])){this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x169'));}else{var _0x35ea97=this[_0x8ad5('0x11')][_0x8ad5('0xa3')](this,_0x4b4705['variable_id']);if(!_0x35ea97){return this[_0x8ad5('0xe')]['error'](_0x4b4705,'no\x20variable\x20found');}this['channel'][_0x8ad5('0x9a')](_0x35ea97,_0x24dfae);}this['createSquareDetailsReport'][_0x8ad5('0xa3')](this,_0x4b4705,_0x24dfae);return _0xddd9f0;};AGIVertices['prototype'][_0x8ad5('0xa6')]=function(_0x2b06b0){logger[_0x8ad5('0x2d')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x2b06b0[_0x8ad5('0x38')]));return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x2b06b0[_0x8ad5('0x16a')]||_0x2b06b0[_0x8ad5('0x38')]);};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x16b')]=function(_0xbc55c6){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x16c'),_0xbc55c6[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0xbc55c6[_0x8ad5('0x155')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0xbc55c6,'no\x20find\x20by\x20configured');}logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x157'),this[_0x8ad5('0xe')]['callerid'],_0xbc55c6[_0x8ad5('0x155')]));var _0x24bbdf=this[_0x8ad5('0x4b')][_0x8ad5('0xa3')](this,_0xbc55c6[_0x8ad5('0x16d')]);var _0x221edf=this[_0x8ad5('0x4d')]['sync'](this,_0xbc55c6[_0x8ad5('0x155')],_0x24bbdf);if(_0x221edf){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x8ad5('0x4f')],_0xbc55c6['findBy']));this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x159'),this[_0x8ad5('0xe')]['callerid'],_0xbc55c6[_0x8ad5('0x155')]));return{'code':0xc8,'result':_0x8ad5('0x15a')};}else{logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x15b'),this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0xbc55c6[_0x8ad5('0x155')]));this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x159'),this[_0x8ad5('0xe')]['callerid'],_0xbc55c6[_0x8ad5('0x155')]));return{'code':0xc8,'result':_0x8ad5('0x15e')};}};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x16e')]=function(_0x474dfc){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0x16f'),_0x474dfc[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x474dfc[_0x8ad5('0x111')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x474dfc,_0x8ad5('0x170'));}var _0xcc1f74=this[_0x8ad5('0x112')][_0x8ad5('0xa3')](this,_0x474dfc[_0x8ad5('0x111')]);if(!_0xcc1f74){return this[_0x8ad5('0xe')]['error'](_0x474dfc,_0x8ad5('0x113'));}var _0x2bf8a0=this[_0x8ad5('0xe')][_0x8ad5('0x55')](_0x8ad5('0x171'),[_0xcc1f74,_0x474dfc[_0x8ad5('0xe5')]]);if(_0x2bf8a0['result']===-0x1){return _0x2bf8a0;}return this['channel'][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xc2'),_0x8ad5('0x171'),_0xcc1f74));};AGIVertices[_0x8ad5('0x15')]['queue']=function(_0x23546d){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x172'),_0x23546d['label']));if(!this[_0x8ad5('0xa1')](_0x23546d['queue_id'])){return this['channel'][_0x8ad5('0x2b')](_0x23546d,_0x8ad5('0x173'));}var _0x354434='';var _0x178d50=parseInt(_0x23546d[_0x8ad5('0x174')],0xa);if(isNaN(_0x178d50)){_0x354434=_0x23546d[_0x8ad5('0x174')];}else{_0x354434=this['getVoiceQueue']['sync'](this,_0x23546d['queue_id']);if(!_0x354434){return this['channel']['error'](_0x23546d,_0x8ad5('0x175'));}}var _0x137f30='';if(this['isConfigured'](_0x23546d[_0x8ad5('0x111')])){var _0xe726d9=this['getSound'][_0x8ad5('0xa3')](this,_0x23546d['file_id']);if(_0xe726d9){_0x137f30=_0xe726d9;}}this[_0x8ad5('0x36')][_0x8ad5('0xa3')](this,_0x23546d,_0x354434);if(_0x23546d[_0x8ad5('0xe5')]['indexOf']('x')<0x0){_0x23546d['opts']+='x';}if(_0x23546d['opts'][_0x8ad5('0x176')]('X')<0x0){_0x23546d[_0x8ad5('0xe5')]+='X';}this[_0x8ad5('0xe')][_0x8ad5('0x9a')](_0x8ad5('0x177'),_0x354434?_0x354434[_0x8ad5('0x178')]():'');var _0x5a6c35=this[_0x8ad5('0xe')][_0x8ad5('0x55')]('QUEUE',[_0x354434,_0x23546d[_0x8ad5('0xe5')],_0x23546d[_0x8ad5('0x5f')],_0x137f30,_0x23546d[_0x8ad5('0x61')],_0x23546d[_0x8ad5('0x7')],_0x23546d[_0x8ad5('0x179')],_0x23546d[_0x8ad5('0x17a')],'',_0x23546d['position']]);if(_0x5a6c35[_0x8ad5('0xa0')]===-0x1){return _0x5a6c35;}return this['channel'][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xc2'),'QUEUE',_0x354434));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x17b')]=function(_0x86ec28){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x17c'),_0x86ec28[_0x8ad5('0x38')]));var _0x573fd9=_0x86ec28[_0x8ad5('0x17d')]||_0x8ad5('0x131');var _0x41ef56=util[_0x8ad5('0x28')](_0x8ad5('0x17e'),this[_0x8ad5('0xe')][_0x8ad5('0x37')],rs['generate'](0x5));var _0x21e895=util[_0x8ad5('0x28')](_0x8ad5('0x17f'),FILES_PATH,_0x41ef56,_0x573fd9);var _0x53eb2e=util[_0x8ad5('0x28')](_0x8ad5('0x13c'),FILES_PATH,_0x41ef56);this[_0x8ad5('0x3b')][_0x8ad5('0xa3')](this,_0x86ec28,_0x41ef56,_0x21e895);this[_0x8ad5('0xe')][_0x8ad5('0x9a')](_0x8ad5('0x180'),_0x41ef56);logger['info'](_0x8ad5('0x181'),_0x53eb2e,_0x573fd9,_0x86ec28['escape_digits'],_0x86ec28[_0x8ad5('0x61')]);return this[_0x8ad5('0xe')][_0x8ad5('0x134')](_0x53eb2e,_0x573fd9,_0x86ec28[_0x8ad5('0x182')],_0x86ec28[_0x8ad5('0x61')],undefined,!![]);};AGIVertices[_0x8ad5('0x15')]['restapi']=function(_0x1a6403){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0x183'),_0x1a6403[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x1a6403[_0x8ad5('0x5f')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x184'));}var _0x5c3569=this[_0x8ad5('0x185')][_0x8ad5('0xa3')](this,_0x1a6403);logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x186'),util['inspect'](_0x5c3569,{'showHidden':![],'depth':null})));if(!this[_0x8ad5('0xa1')](_0x1a6403[_0x8ad5('0xd8')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x187'));}var _0x3c6ea8=this[_0x8ad5('0x11')][_0x8ad5('0xa3')](this,_0x1a6403[_0x8ad5('0xd8')]);if(!_0x3c6ea8){return this['channel'][_0x8ad5('0x2b')](_0x1a6403,_0x8ad5('0xd9'));}this[_0x8ad5('0xe')][_0x8ad5('0x9a')](util['format'](_0x8ad5('0x188'),_0x3c6ea8),_0x5c3569['statusCode']?_0x5c3569[_0x8ad5('0x70')]:_0x8ad5('0x189'));this[_0x8ad5('0xe')][_0x8ad5('0x9a')](util[_0x8ad5('0x28')](_0x8ad5('0x18a'),_0x3c6ea8),_0x5c3569[_0x8ad5('0x18b')]?_0x5c3569['statusMessage']:'OK');if(_0x5c3569[_0x8ad5('0x65')]){try{this[_0x8ad5('0x99')](_0x5c3569[_0x8ad5('0x65')],_0x3c6ea8);}catch(_0x29758b){logger[_0x8ad5('0x2b')](util['format'](_0x8ad5('0x18c'),_0x3c6ea8));}}return this['channel']['noop'](util[_0x8ad5('0x28')](_0x8ad5('0xdd'),_0x3c6ea8));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x18d')]=function(_0x2961bf){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2961bf[_0x8ad5('0x38')]));return this['channel']['sayDigits'](_0x2961bf[_0x8ad5('0x18e')][_0x8ad5('0x56')](/\s+/g,''),_0x2961bf[_0x8ad5('0x182')]);};AGIVertices['prototype'][_0x8ad5('0x18f')]=function(_0x42cb8c){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x190'),_0x42cb8c[_0x8ad5('0x38')]));return this[_0x8ad5('0xe')][_0x8ad5('0x191')](_0x42cb8c[_0x8ad5('0x192')]['replace'](/\s+/g,''),_0x42cb8c[_0x8ad5('0x182')]);};AGIVertices[_0x8ad5('0x15')]['sayphonetic']=function(_0xe5a61){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x193'),_0xe5a61[_0x8ad5('0x38')]));return this['channel'][_0x8ad5('0x194')](_0xe5a61[_0x8ad5('0x5a')],_0xe5a61['escape_digits']);};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x195')]=function(_0x181f1d){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0x196'),_0x181f1d['label']));if(!this[_0x8ad5('0xa1')](_0x181f1d[_0x8ad5('0x197')])){return this[_0x8ad5('0xe')]['noop'](_0x8ad5('0x198'));}var _0x256e27=this[_0x8ad5('0x20')][_0x8ad5('0xa3')](this,_0x181f1d['account_id']);if(!_0x256e27||!_0x256e27[_0x8ad5('0x199')]){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x181f1d,_0x8ad5('0x19a'));}var _0x3a5ea0={'from':util[_0x8ad5('0x28')](_0x8ad5('0x19b'),_0x256e27[_0x8ad5('0x14')],_0x256e27[_0x8ad5('0x19c')]||_0x256e27['Smtp']['user']),'to':_0x181f1d['to']||'','cc':_0x181f1d['cc']||'','bcc':_0x181f1d[_0x8ad5('0x19d')]||'','subject':_0x181f1d['subject'],'html':_0x181f1d[_0x8ad5('0x5a')],'text':_0x181f1d['text']};var _0x52d971={'tls':{'rejectUnauthorized':![]}};if(_0x256e27[_0x8ad5('0x199')][_0x8ad5('0x19e')]){_0x52d971['service']=_0x256e27[_0x8ad5('0x199')][_0x8ad5('0x19e')];}else{_0x52d971[_0x8ad5('0x19f')]=_0x256e27[_0x8ad5('0x199')][_0x8ad5('0x19f')];_0x52d971['port']=_0x256e27[_0x8ad5('0x199')][_0x8ad5('0x1a0')];_0x52d971[_0x8ad5('0x1a1')]=_0x256e27['Smtp']['secure'];}if(_0x256e27[_0x8ad5('0x199')][_0x8ad5('0x1a2')]){_0x52d971[_0x8ad5('0x1a3')]={'user':_0x256e27[_0x8ad5('0x199')]['user'],'pass':_0x256e27[_0x8ad5('0x199')][_0x8ad5('0x1a4')]};}if(this[_0x8ad5('0xa1')](_0x181f1d[_0x8ad5('0x1a5')])){}logger[_0x8ad5('0xdf')]('sendMail\x20message',JSON[_0x8ad5('0x6e')](_0x3a5ea0));this[_0x8ad5('0x36')][_0x8ad5('0xa3')](this,_0x181f1d,_0x181f1d[_0x8ad5('0x197')]);this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x256e27[_0x8ad5('0x14')]));this[_0x8ad5('0x22')][_0x8ad5('0xa3')](this,_0x52d971,_0x3a5ea0);return this['channel'][_0x8ad5('0xa6')](_0x8ad5('0x1a6'));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x1a7')]=function(_0x436d97){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0x1a8'),_0x436d97['label']));return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x1a9'));};AGIVertices[_0x8ad5('0x15')]['sendSMS']=function(_0xfd04ed){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0x1aa'),_0xfd04ed[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0xfd04ed[_0x8ad5('0x1ab')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20sms\x20account\x20configured');}var _0x12afc8=this[_0x8ad5('0x34')][_0x8ad5('0xa3')](this,_0xfd04ed[_0x8ad5('0x1ab')]);if(!_0x12afc8){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0xfd04ed,_0x8ad5('0x1ac'));}var _0x3194a8={'body':_0xfd04ed[_0x8ad5('0x1ad')],'phone':_0xfd04ed['to']||'','SmsAccountId':_0x12afc8['id']};logger[_0x8ad5('0xdf')]('sendSMS\x20message',JSON[_0x8ad5('0x6e')](_0x3194a8));this['createSquareDetailsReport'][_0x8ad5('0xa3')](this,_0xfd04ed,_0xfd04ed[_0x8ad5('0x1ab')]);this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')](_0x8ad5('0x1ae'),_0x12afc8[_0x8ad5('0x14')]));this[_0x8ad5('0x35')]['sync'](this,_0x3194a8);return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x1af'));};AGIVertices['prototype'][_0x8ad5('0x1b0')]=function(_0x3b6125){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x1b1'),_0x3b6125[_0x8ad5('0x38')]));if(!this['isConfigured'](_0x3b6125['variable_id'])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x3b6125,_0x8ad5('0x1b2'));}var _0x2254e6=this[_0x8ad5('0x11')]['sync'](this,_0x3b6125[_0x8ad5('0xd8')]);if(!_0x2254e6){return this['channel'][_0x8ad5('0x2b')](_0x3b6125,_0x8ad5('0xd9'));}return this['channel'][_0x8ad5('0x9a')](_0x2254e6,_0x3b6125['variable_value']);};AGIVertices['prototype'][_0x8ad5('0x1b3')]=function(_0x48e2ff){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x48e2ff[_0x8ad5('0x38')]));this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x1b4'));if(_0x48e2ff[_0x8ad5('0xb4')]===_0x8ad5('0x1b5')){this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('Answer');return this['channel'][_0x8ad5('0xb4')]();}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x1b6'));};AGIVertices[_0x8ad5('0x15')]['subproject']=function(_0x1adb5d){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0x1b7'),_0x1adb5d['label']));if(!this[_0x8ad5('0xa1')](_0x1adb5d[_0x8ad5('0x1b8')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x1adb5d,_0x8ad5('0x1b9'));}var _0x22804c=this[_0x8ad5('0x18')][_0x8ad5('0xa3')](this,_0x1adb5d['project_id']);if(!this[_0x8ad5('0xa1')](_0x22804c)){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x1adb5d,util['format'](_0x8ad5('0x1ba'),_0x1adb5d[_0x8ad5('0x1b8')]));}if(_0x22804c===this[_0x8ad5('0xe')]['arg_1']){return this[_0x8ad5('0xe')]['error'](_0x1adb5d,_0x8ad5('0x1bb'));}this[_0x8ad5('0x36')][_0x8ad5('0xa3')](this,_0x1adb5d,_0x22804c);var _0x3d64e3=this['channel']['exec'](_0x8ad5('0x1bc'),util[_0x8ad5('0x28')](_0x8ad5('0x1bd'),config[_0x8ad5('0x7')][_0x8ad5('0x19f')]||_0x8ad5('0x1be'),_0x22804c,this[_0x8ad5('0xe')][_0x8ad5('0x3a')]));if(_0x3d64e3[_0x8ad5('0xa0')]===-0x1){return _0x3d64e3;}return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0xc2'),'AGI',_0x22804c));};AGIVertices['prototype']['system']=function(_0x428e47){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0x1bf'),_0x428e47[_0x8ad5('0x38')]));var _0x2c1f5e=this[_0x8ad5('0x54')][_0x8ad5('0xa3')](this,_0x428e47[_0x8ad5('0xb2')]);this['createSquareDetailsReport'][_0x8ad5('0xa3')](this,_0x428e47,_0x428e47[_0x8ad5('0xb2')]);if(this[_0x8ad5('0xa1')](_0x428e47[_0x8ad5('0xd8')])){var _0x3f88d5=this['getVariable'][_0x8ad5('0xa3')](this,_0x428e47[_0x8ad5('0xd8')]);if(_0x3f88d5){this['channel'][_0x8ad5('0x9a')](_0x3f88d5,_0x2c1f5e);return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')](_0x8ad5('0x1c0'),_0x428e47['command'],_0x3f88d5));}}return this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')](_0x8ad5('0x1c1'),_0x428e47['command']));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x1c2')]=function(_0x15a5f7){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0x1c3'),_0x15a5f7[_0x8ad5('0x38')]));_0x15a5f7[_0x8ad5('0x5a')]=_0x15a5f7['text'][_0x8ad5('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8ad5('0xa1')](_0x15a5f7[_0x8ad5('0x58')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')](_0x8ad5('0x1c4'));}if(!this[_0x8ad5('0xa1')](_0x15a5f7[_0x8ad5('0x5a')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util['format'](_0x8ad5('0x1c5'),_0x15a5f7[_0x8ad5('0x5a')]));var _0x6849ac=this[_0x8ad5('0x57')][_0x8ad5('0xa3')](this,_0x15a5f7);if(_0x6849ac){this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')](_0x8ad5('0x1c6'),_0x6849ac));var _0xd97ef6=this['channel'][_0x8ad5('0x101')](_0x6849ac);try{fs['unlink'](_0x6849ac+_0x8ad5('0x103'));}catch(_0x3d699f){logger[_0x8ad5('0x2b')](_0x3d699f);}return _0xd97ef6;}return this['channel'][_0x8ad5('0x2b')](_0x15a5f7,_0x8ad5('0x1c7'));};AGIVertices[_0x8ad5('0x15')]['tts']=function(_0x452e2b){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0x1c8'),_0x452e2b[_0x8ad5('0x38')]));_0x452e2b['text']=_0x452e2b[_0x8ad5('0x5a')][_0x8ad5('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8ad5('0xa1')](_0x452e2b[_0x8ad5('0x5a')])){return this[_0x8ad5('0xe')][_0x8ad5('0xa6')]('no\x20text\x20configured');}this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')](_0x8ad5('0x1c9'),_0x452e2b[_0x8ad5('0x5a')]));var _0x38ae5c=this[_0x8ad5('0x5d')]['sync'](this,_0x452e2b);if(_0x38ae5c){this[_0x8ad5('0xe')][_0x8ad5('0xa6')](util[_0x8ad5('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x38ae5c));var _0x5f5b70=this[_0x8ad5('0xe')]['streamFile'](_0x38ae5c);try{fs['unlink'](_0x38ae5c+_0x8ad5('0x103'));}catch(_0x13ee2b){logger[_0x8ad5('0x2b')](_0x13ee2b);}return _0x5f5b70;}return this[_0x8ad5('0xe')]['error'](_0x452e2b,_0x8ad5('0x1ca'));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x1cb')]=function(_0x4f5bad){logger['info'](util[_0x8ad5('0x28')](_0x8ad5('0x1cc'),_0x4f5bad[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x4f5bad[_0x8ad5('0x155')])){return this[_0x8ad5('0xe')][_0x8ad5('0x2b')](_0x4f5bad,_0x8ad5('0x156'));}logger['info'](util['format'](_0x8ad5('0x157'),this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x4f5bad['findBy']));var _0x3f2bbd=this[_0x8ad5('0x50')][_0x8ad5('0xa3')](this,_0x4f5bad[_0x8ad5('0x155')]);if(_0x3f2bbd){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x4f5bad[_0x8ad5('0x155')]));this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x4f5bad['findBy']));return{'code':0xc8,'result':_0x8ad5('0x15a')};}else{logger['info'](util[_0x8ad5('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8ad5('0x4f')],_0x4f5bad[_0x8ad5('0x155')]));this['channel']['noop'](util[_0x8ad5('0x28')](_0x8ad5('0x15b'),this[_0x8ad5('0xe')][_0x8ad5('0x4f')],_0x4f5bad[_0x8ad5('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x8ad5('0x1cd')]=function(_0x43c73d){logger[_0x8ad5('0x2d')](util['format'](_0x8ad5('0x1ce'),_0x43c73d[_0x8ad5('0x38')]));var _0x2f3dc2=this[_0x8ad5('0xe')][_0x8ad5('0x55')](_0x8ad5('0x1cf'),[_0x43c73d[_0x8ad5('0x1d0')],_0x43c73d[_0x8ad5('0x73')]]);if(_0x2f3dc2[_0x8ad5('0xa0')]===-0x1){return _0x2f3dc2;}return this[_0x8ad5('0xe')]['noop'](util[_0x8ad5('0x28')](_0x8ad5('0xc2'),'VOICEMAIL',_0x43c73d[_0x8ad5('0x1d0')]));};AGIVertices[_0x8ad5('0x15')][_0x8ad5('0x1d1')]=function(_0x4e41e8){logger[_0x8ad5('0x2d')](util[_0x8ad5('0x28')](_0x8ad5('0x1d2'),_0x4e41e8[_0x8ad5('0x38')]));if(!this[_0x8ad5('0xa1')](_0x4e41e8[_0x8ad5('0xd8')])){return this['channel'][_0x8ad5('0x2b')](_0x4e41e8,_0x8ad5('0x1b2'));}var _0x40aab9=this[_0x8ad5('0x11')]['sync'](this,_0x4e41e8[_0x8ad5('0xd8')]);if(!_0x40aab9){return this[_0x8ad5('0xe')]['error'](_0x4e41e8,_0x8ad5('0xd9'));}var _0xda5c98=this[_0x8ad5('0xe')]['getVariable'](_0x40aab9);return{'code':0xc8,'result':_0xda5c98[_0x8ad5('0x9e')]?_0xda5c98[_0x8ad5('0x9e')]:'-'};};String[_0x8ad5('0x15')][_0x8ad5('0x9d')]=function(_0x1906b7,_0x2f5840){return this['split'](_0x1906b7)[_0x8ad5('0x1d3')](_0x2f5840);};module[_0x8ad5('0x1d4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3bd0135..3f20fd7 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 _0x6aa7=['[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','catch','error','finally','[ACW][START]\x20%s','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','message','syncAgentConnect','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s'];(function(_0x4b37e2,_0x1012f7){var _0x1d3b06=function(_0x168bcd){while(--_0x168bcd){_0x4b37e2['push'](_0x4b37e2['shift']());}};_0x1d3b06(++_0x1012f7);}(_0x6aa7,0x178));var _0x76aa=function(_0x5944ae,_0x1cc543){_0x5944ae=_0x5944ae-0x0;var _0x1dbe43=_0x6aa7[_0x5944ae];return _0x1dbe43;};'use strict';var util=require(_0x76aa('0x0'));var _=require('lodash');var moment=require(_0x76aa('0x1'));var ami=require(_0x76aa('0x2'));var logger=require(_0x76aa('0x3'))(_0x76aa('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x76aa('0x5'));function Acw(_0xef15ef){this[_0x76aa('0x6')]=_0xef15ef['voiceQueues'];this['agents']=_0xef15ef[_0x76aa('0x7')];this['timers']=_0xef15ef[_0x76aa('0x8')];this[_0x76aa('0x9')]={};ami['on'](_0x76aa('0xa'),this['syncAgentConnect'][_0x76aa('0xb')](this));ami['on'](_0x76aa('0xc'),this[_0x76aa('0xd')]['bind'](this));ami['on'](_0x76aa('0xe'),this[_0x76aa('0xf')][_0x76aa('0xb')](this));ami['on'](_0x76aa('0x10'),this[_0x76aa('0x11')][_0x76aa('0xb')](this));ami['on'](_0x76aa('0x12'),this[_0x76aa('0x13')][_0x76aa('0xb')](this));ami['on'](_0x76aa('0x14'),this['syncBlindTransfer'][_0x76aa('0xb')](this));ami['on']('custom:agentConnectPreview',this[_0x76aa('0x15')][_0x76aa('0xb')](this));}function getDiff(_0x3f8f6b){var _0x8e44ed=moment()[_0x76aa('0x16')](0x0);var _0x4e309f=moment(_0x3f8f6b)['milliseconds'](0x0);return _0x8e44ed[_0x76aa('0x17')](_0x4e309f,'seconds');}Acw[_0x76aa('0x18')][_0x76aa('0x19')]=function(_0x5cf594){try{var _0x2111c7=this;var _0x550d9a=this[_0x76aa('0x9')][_0x5cf594]['interface'];var _0x1515e9=this[_0x76aa('0x9')][_0x5cf594][_0x76aa('0x1a')];var _0x21c16d=this[_0x76aa('0x6')][_0x1515e9];var _0x3ead3f=![];var _0x496902='ACW';if(_0x21c16d[_0x76aa('0x1b')]){if(_0x21c16d[_0x76aa('0x1c')][_0x76aa('0x1d')]){_0x3ead3f=!![];_0x496902=_0x21c16d[_0x76aa('0x1c')][_0x76aa('0x1d')];}}ami[_0x76aa('0x1e')]({'action':_0x76aa('0x1f'),'interface':_0x550d9a,'paused':!![],'reason':_0x496902})[_0x76aa('0x20')](function(_0x385157){if(_0x2111c7['agents'][_0x550d9a]){return RpcUser[_0x76aa('0x21')](_0x2111c7[_0x76aa('0x7')][_0x550d9a]['id'])[_0x76aa('0x20')](function(_0x5b3f55){if(_0x5b3f55&&!_0x5b3f55[_0x76aa('0x22')]){logger[_0x76aa('0x23')](_0x76aa('0x24'),_0x5cf594,_0x550d9a,_0x1515e9);var _0x2bd2c6=_0x2111c7[_0x76aa('0x9')][_0x5cf594][_0x76aa('0x25')]&&_0x2111c7[_0x76aa('0x9')][_0x5cf594][_0x76aa('0x26')]?_0x2111c7[_0x76aa('0x9')][_0x5cf594][_0x76aa('0x26')]:_0x5cf594;return RpcUser[_0x76aa('0x27')](_0x2111c7[_0x76aa('0x7')][_0x550d9a],_0x496902,_0x2bd2c6)[_0x76aa('0x20')](function(_0x4ef9b0){if(!_0x3ead3f){_0x2111c7[_0x76aa('0x8')][_0x550d9a]={};logger[_0x76aa('0x23')](_0x76aa('0x28'),_0x5cf594,_0x2111c7[_0x76aa('0x6')][_0x1515e9][_0x76aa('0x29')],_0x550d9a,_0x1515e9);_0x2111c7[_0x76aa('0x8')][_0x550d9a][_0x76aa('0x2a')]=setTimeout(_0x2111c7[_0x76aa('0x2b')][_0x76aa('0xb')](_0x2111c7,_0x550d9a),_0x2111c7[_0x76aa('0x6')][_0x1515e9]['acwTimeout']*0x3e8);_0x2111c7[_0x76aa('0x8')][_0x550d9a]['lastPauseAt']=moment()[_0x76aa('0x2c')](_0x76aa('0x2d'));_0x2111c7[_0x76aa('0x8')][_0x550d9a][_0x76aa('0x2e')]=_0x5cf594;_0x2111c7[_0x76aa('0x8')][_0x550d9a][_0x76aa('0x1a')]=_0x1515e9;_0x2111c7[_0x76aa('0x8')][_0x550d9a][_0x76aa('0x2f')]=function(){var _0x19fd4f=getDiff(_0x2111c7[_0x76aa('0x8')][_0x550d9a]['lastPauseAt']);clearTimeout(_0x2111c7[_0x76aa('0x8')][_0x550d9a][_0x76aa('0x2a')]);_0x2111c7[_0x76aa('0x8')][_0x550d9a][_0x76aa('0x2a')]=![];RpcVoiceAgentReport[_0x76aa('0x30')]({'acwtime':_0x19fd4f},_0x2111c7[_0x76aa('0x8')][_0x550d9a][_0x76aa('0x2e')],_0x550d9a)['then'](function(_0x258624){logger[_0x76aa('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x5cf594,_0x19fd4f,_0x258624);})[_0x76aa('0x31')](function(_0x58d860){logger[_0x76aa('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x5cf594,_0x58d860);});delete _0x2111c7[_0x76aa('0x8')][_0x550d9a];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x5cf594,_0x550d9a,_0x1515e9);}});}})[_0x76aa('0x31')](function(_0x282c56){logger[_0x76aa('0x32')](_0x76aa('0x28'),_0x5cf594,_0x2111c7['voiceQueues'][_0x1515e9]['acwTimeout'],_0x550d9a,_0x1515e9);})[_0x76aa('0x33')](function(){delete _0x2111c7[_0x76aa('0x9')][_0x5cf594];});}catch(_0x58127c){logger[_0x76aa('0x32')](_0x76aa('0x34'),_0x58127c['message']);}};Acw[_0x76aa('0x18')]['stopAcw']=function(_0x5086f5){try{var _0x4fdbde=this;if(_0x4fdbde[_0x76aa('0x8')][_0x5086f5]){_0x4fdbde[_0x76aa('0x8')][_0x5086f5][_0x76aa('0x2a')]=![];var _0x48cf51=_0x4fdbde[_0x76aa('0x8')][_0x5086f5][_0x76aa('0x2e')];var _0x2eea79=_0x4fdbde['timers'][_0x5086f5][_0x76aa('0x1a')];var _0x1638db=_0x4fdbde[_0x76aa('0x6')][_0x2eea79][_0x76aa('0x29')];logger[_0x76aa('0x23')](_0x76aa('0x35'),_0x5086f5);RpcUser[_0x76aa('0x36')](this[_0x76aa('0x7')][_0x5086f5]);RpcVoiceAgentReport[_0x76aa('0x30')]({'acwtime':_0x1638db,'agentacw':!![]},_0x48cf51,_0x5086f5)['then'](function(_0x1525cb){logger[_0x76aa('0x23')](_0x76aa('0x37'),_0x48cf51,_0x1638db,_0x1525cb);})[_0x76aa('0x31')](function(_0x64612e){logger[_0x76aa('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x48cf51,_0x64612e);});}else{logger['error'](_0x76aa('0x38'),_0x5086f5);if(_0x4fdbde[_0x76aa('0x8')]){logger[_0x76aa('0x23')](_0x76aa('0x39'),JSON['stringify'](_0x4fdbde[_0x76aa('0x8')]));}}}catch(_0x403084){logger[_0x76aa('0x32')](_0x76aa('0x3a'),_0x403084[_0x76aa('0x3b')]);}};Acw['prototype'][_0x76aa('0x3c')]=function(_0x556f59){try{if(this[_0x76aa('0x6')][_0x556f59['queue']]&&(this['voiceQueues'][_0x556f59['queue']][_0x76aa('0x4')]||this['voiceQueues'][_0x556f59['queue']]['mandatoryDisposition'])){if(this[_0x76aa('0x7')][_0x556f59[_0x76aa('0x3d')]]){this[_0x76aa('0x9')][_0x556f59[_0x76aa('0x2e')]]={'queue':_0x556f59[_0x76aa('0x1a')],'interface':_0x556f59['interface'],'destlinkedid':_0x556f59[_0x76aa('0x26')]};}}}catch(_0x14df8c){logger[_0x76aa('0x32')](_0x76aa('0x3e'),_0x14df8c[_0x76aa('0x3b')]);}};Acw['prototype'][_0x76aa('0x15')]=function(_0x1c62a9){try{if(this['voiceQueues'][_0x1c62a9[_0x76aa('0x1a')]]&&(this['voiceQueues'][_0x1c62a9[_0x76aa('0x1a')]][_0x76aa('0x4')]||this[_0x76aa('0x6')][_0x1c62a9[_0x76aa('0x1a')]][_0x76aa('0x1b')])){if(this[_0x76aa('0x7')][_0x1c62a9[_0x76aa('0x3d')]]){this[_0x76aa('0x9')][_0x1c62a9[_0x76aa('0x2e')]]={'queue':_0x1c62a9[_0x76aa('0x1a')],'interface':_0x1c62a9['interface']};}}}catch(_0xbbd734){logger['error'](_0x76aa('0x3f'),_0xbbd734[_0x76aa('0x3b')]);}};Acw[_0x76aa('0x18')][_0x76aa('0xd')]=function(_0x5ca721){try{if(this['channels'][_0x5ca721[_0x76aa('0x2e')]]&&_['isUndefined'](this[_0x76aa('0x9')][_0x5ca721[_0x76aa('0x2e')]][_0x76aa('0x25')])){logger[_0x76aa('0x23')](_0x76aa('0x40'),_0x5ca721[_0x76aa('0x2e')]);this['startAcw'](_0x5ca721['uniqueid']);}else if(this[_0x76aa('0x9')][_0x5ca721[_0x76aa('0x41')]]&&_[_0x76aa('0x42')](this[_0x76aa('0x9')][_0x5ca721[_0x76aa('0x41')]][_0x76aa('0x25')])){logger['info'](_0x76aa('0x43'),_0x5ca721[_0x76aa('0x41')]);this[_0x76aa('0x19')](_0x5ca721['linkedid']);}}catch(_0x30d930){logger['error'](_0x76aa('0x44'),_0x30d930['message']);}};Acw[_0x76aa('0x18')][_0x76aa('0xf')]=function(_0x3c63e5){try{if(this[_0x76aa('0x9')][_0x3c63e5[_0x76aa('0x2e')]]&&this[_0x76aa('0x9')][_0x3c63e5[_0x76aa('0x2e')]]['attended']){logger[_0x76aa('0x23')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3c63e5[_0x76aa('0x2e')]);this[_0x76aa('0x19')](_0x3c63e5[_0x76aa('0x2e')]);}else if(this[_0x76aa('0x9')][_0x3c63e5[_0x76aa('0x41')]]&&this[_0x76aa('0x9')][_0x3c63e5[_0x76aa('0x41')]]['attended']){logger[_0x76aa('0x23')](_0x76aa('0x45'),_0x3c63e5[_0x76aa('0x41')]);this[_0x76aa('0x19')](_0x3c63e5['linkedid']);}}catch(_0xb9401b){logger[_0x76aa('0x32')](_0x76aa('0x46'),_0xb9401b[_0x76aa('0x3b')]);}};Acw[_0x76aa('0x18')][_0x76aa('0x13')]=function(_0x4e6c09){try{if(!_[_0x76aa('0x47')](this[_0x76aa('0x9')][_0x4e6c09[_0x76aa('0x48')]])){this[_0x76aa('0x19')](_0x4e6c09[_0x76aa('0x48')]);if(this[_0x76aa('0x9')][_0x4e6c09[_0x76aa('0x49')]]){this['channels'][_0x4e6c09['secondtransfereruniqueid']][_0x76aa('0x25')]=!![];this[_0x76aa('0x9')][_0x4e6c09['transfertargetuniqueid']]=this[_0x76aa('0x9')][_0x4e6c09[_0x76aa('0x49')]];delete this['channels'][_0x4e6c09[_0x76aa('0x49')]];}}else if(!_[_0x76aa('0x47')](this[_0x76aa('0x9')][_0x4e6c09[_0x76aa('0x4a')]])){this[_0x76aa('0x19')](_0x4e6c09[_0x76aa('0x4a')]);if(this[_0x76aa('0x9')][_0x4e6c09[_0x76aa('0x4b')]]){this[_0x76aa('0x9')][_0x4e6c09['origtransfereruniqueid']][_0x76aa('0x25')]=!![];this['channels'][_0x4e6c09[_0x76aa('0x48')]]=this[_0x76aa('0x9')][_0x4e6c09[_0x76aa('0x4b')]];delete this[_0x76aa('0x9')][_0x4e6c09[_0x76aa('0x4b')]];}}}catch(_0x260ad2){logger[_0x76aa('0x32')](_0x76aa('0x4c'),_0x260ad2[_0x76aa('0x3b')]);}};Acw['prototype'][_0x76aa('0x4d')]=function(_0x3d4025){try{if(this[_0x76aa('0x9')][_0x3d4025[_0x76aa('0x4e')]]){logger[_0x76aa('0x23')](_0x76aa('0x4f'),JSON[_0x76aa('0x50')](_0x3d4025[_0x76aa('0x4e')]));this['startAcw'](_0x3d4025[_0x76aa('0x4e')]);}else if(this['channels'][_0x3d4025[_0x76aa('0x51')]]){logger[_0x76aa('0x23')](_0x76aa('0x52'),JSON[_0x76aa('0x50')](_0x3d4025[_0x76aa('0x51')]));this[_0x76aa('0x19')](_0x3d4025[_0x76aa('0x51')]);}}catch(_0x4a37f1){logger[_0x76aa('0x32')](_0x76aa('0x53'),_0x4a37f1['message']);}};Acw['prototype'][_0x76aa('0x11')]=function(_0x13389d){try{if(this['voiceQueues'][_0x13389d[_0x76aa('0x1a')]]&&this[_0x76aa('0x6')][_0x13389d[_0x76aa('0x1a')]]['autopause']===_0x76aa('0x54')){if(this['agents'][_0x13389d[_0x76aa('0x3d')]]){logger[_0x76aa('0x23')](_0x76aa('0x55'),_0x13389d[_0x76aa('0x2e')],_0x13389d['interface'],_0x13389d['queue']);return RpcUser[_0x76aa('0x27')](this['agents'][_0x13389d[_0x76aa('0x3d')]],_0x76aa('0x56'),_0x13389d[_0x76aa('0x2e')]);}}}catch(_0x43a2af){logger[_0x76aa('0x32')](_0x76aa('0x57'),_0x43a2af[_0x76aa('0x3b')]);}};module[_0x76aa('0x58')]=Acw; \ No newline at end of file +var _0x3e74=['acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','message','attended','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','exports','util','moment','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','agentringnoanswer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer'];(function(_0x576d8a,_0x2d7bde){var _0x3dc3ef=function(_0xc76758){while(--_0xc76758){_0x576d8a['push'](_0x576d8a['shift']());}};_0x3dc3ef(++_0x2d7bde);}(_0x3e74,0x175));var _0x43e7=function(_0x1dfb9b,_0x287c3c){_0x1dfb9b=_0x1dfb9b-0x0;var _0x580a36=_0x3e74[_0x1dfb9b];return _0x580a36;};'use strict';var util=require(_0x43e7('0x0'));var _=require('lodash');var moment=require(_0x43e7('0x1'));var ami=require(_0x43e7('0x2'));var logger=require(_0x43e7('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x43e7('0x4'));function Acw(_0x4f9bbe){this[_0x43e7('0x5')]=_0x4f9bbe[_0x43e7('0x5')];this[_0x43e7('0x6')]=_0x4f9bbe[_0x43e7('0x6')];this[_0x43e7('0x7')]=_0x4f9bbe['timers'];this[_0x43e7('0x8')]={};ami['on'](_0x43e7('0x9'),this[_0x43e7('0xa')][_0x43e7('0xb')](this));ami['on'](_0x43e7('0xc'),this['syncHangupRequest'][_0x43e7('0xb')](this));ami['on']('hangup',this['syncHangup'][_0x43e7('0xb')](this));ami['on'](_0x43e7('0xd'),this['syncAgentRingNoAnswer'][_0x43e7('0xb')](this));ami['on']('attendedtransfer',this[_0x43e7('0xe')][_0x43e7('0xb')](this));ami['on']('blindtransfer',this[_0x43e7('0xf')][_0x43e7('0xb')](this));ami['on'](_0x43e7('0x10'),this[_0x43e7('0x11')]['bind'](this));}function getDiff(_0x583d85){var _0x2fcb36=moment()[_0x43e7('0x12')](0x0);var _0x44b0bd=moment(_0x583d85)['milliseconds'](0x0);return _0x2fcb36['diff'](_0x44b0bd,_0x43e7('0x13'));}Acw[_0x43e7('0x14')][_0x43e7('0x15')]=function(_0x328445){try{var _0x4de324=this;var _0x5c4eaa=this[_0x43e7('0x8')][_0x328445][_0x43e7('0x16')];var _0x273a32=this['channels'][_0x328445]['queue'];var _0x446986=this[_0x43e7('0x5')][_0x273a32];var _0x9037d3=![];var _0x140657=_0x43e7('0x17');if(_0x446986[_0x43e7('0x18')]){if(_0x446986[_0x43e7('0x19')][_0x43e7('0x1a')]){_0x9037d3=!![];_0x140657=_0x446986[_0x43e7('0x19')][_0x43e7('0x1a')];}}ami[_0x43e7('0x1b')]({'action':_0x43e7('0x1c'),'interface':_0x5c4eaa,'paused':!![],'reason':_0x140657})['then'](function(_0xef1a5a){if(_0x4de324[_0x43e7('0x6')][_0x5c4eaa]){return RpcUser['getAgent'](_0x4de324[_0x43e7('0x6')][_0x5c4eaa]['id'])[_0x43e7('0x1d')](function(_0x3945bb){if(_0x3945bb&&!_0x3945bb[_0x43e7('0x1e')]){logger[_0x43e7('0x1f')](_0x43e7('0x20'),_0x328445,_0x5c4eaa,_0x273a32);var _0x54a9e7=_0x4de324[_0x43e7('0x8')][_0x328445]['attended']&&_0x4de324['channels'][_0x328445][_0x43e7('0x21')]?_0x4de324[_0x43e7('0x8')][_0x328445]['destlinkedid']:_0x328445;return RpcUser[_0x43e7('0x22')](_0x4de324['agents'][_0x5c4eaa],_0x140657,_0x54a9e7)[_0x43e7('0x1d')](function(_0x5c5e67){if(!_0x9037d3){_0x4de324[_0x43e7('0x7')][_0x5c4eaa]={};logger[_0x43e7('0x1f')](_0x43e7('0x23'),_0x328445,_0x4de324[_0x43e7('0x5')][_0x273a32]['acwTimeout'],_0x5c4eaa,_0x273a32);_0x4de324['timers'][_0x5c4eaa][_0x43e7('0x24')]=setTimeout(_0x4de324['stopAcw'][_0x43e7('0xb')](_0x4de324,_0x5c4eaa),_0x4de324[_0x43e7('0x5')][_0x273a32][_0x43e7('0x25')]*0x3e8);_0x4de324[_0x43e7('0x7')][_0x5c4eaa]['lastPauseAt']=moment()[_0x43e7('0x26')](_0x43e7('0x27'));_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x28')]=_0x328445;_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x29')]=_0x273a32;_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x2a')]=function(){var _0x3bf475=getDiff(_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x2b')]);clearTimeout(_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x24')]);_0x4de324[_0x43e7('0x7')][_0x5c4eaa]['timer']=![];RpcVoiceAgentReport[_0x43e7('0x2c')]({'acwtime':_0x3bf475},_0x4de324[_0x43e7('0x7')][_0x5c4eaa][_0x43e7('0x28')],_0x5c4eaa)[_0x43e7('0x1d')](function(_0x4251c8){logger['info'](_0x43e7('0x2d'),_0x328445,_0x3bf475,_0x4251c8);})[_0x43e7('0x2e')](function(_0x30d47e){logger[_0x43e7('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x328445,_0x30d47e);});delete _0x4de324['timers'][_0x5c4eaa];};}});}else{logger['info'](_0x43e7('0x30'),_0x328445,_0x5c4eaa,_0x273a32);}});}})[_0x43e7('0x2e')](function(_0x117c07){logger[_0x43e7('0x2f')](_0x43e7('0x23'),_0x328445,_0x4de324[_0x43e7('0x5')][_0x273a32]['acwTimeout'],_0x5c4eaa,_0x273a32);})['finally'](function(){delete _0x4de324['channels'][_0x328445];});}catch(_0x59e5b2){logger['error']('[ACW][START]\x20%s',_0x59e5b2['message']);}};Acw[_0x43e7('0x14')]['stopAcw']=function(_0x2b4bfd){try{var _0x8e9f40=this;if(_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd]){_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd][_0x43e7('0x24')]=![];var _0x449803=_0x8e9f40[_0x43e7('0x7')][_0x2b4bfd]['uniqueid'];var _0x5332d9=_0x8e9f40['timers'][_0x2b4bfd][_0x43e7('0x29')];var _0xfe70e9=_0x8e9f40[_0x43e7('0x5')][_0x5332d9][_0x43e7('0x25')];logger[_0x43e7('0x1f')](_0x43e7('0x31'),_0x2b4bfd);RpcUser[_0x43e7('0x32')](this[_0x43e7('0x6')][_0x2b4bfd]);RpcVoiceAgentReport['update']({'acwtime':_0xfe70e9,'agentacw':!![]},_0x449803,_0x2b4bfd)[_0x43e7('0x1d')](function(_0x2b0ffe){logger['info'](_0x43e7('0x2d'),_0x449803,_0xfe70e9,_0x2b0ffe);})['catch'](function(_0x44d8e4){logger[_0x43e7('0x2f')](_0x43e7('0x33'),_0x449803,_0x44d8e4);});}else{logger[_0x43e7('0x2f')](_0x43e7('0x34'),_0x2b4bfd);if(_0x8e9f40[_0x43e7('0x7')]){logger['info']('[ACW][TIMERS]',JSON[_0x43e7('0x35')](_0x8e9f40[_0x43e7('0x7')]));}}}catch(_0x44b6ae){logger[_0x43e7('0x2f')](_0x43e7('0x36'),_0x44b6ae['message']);}};Acw[_0x43e7('0x14')][_0x43e7('0xa')]=function(_0x575439){try{if(this[_0x43e7('0x5')][_0x575439['queue']]&&(this[_0x43e7('0x5')][_0x575439['queue']][_0x43e7('0x37')]||this[_0x43e7('0x5')][_0x575439[_0x43e7('0x29')]][_0x43e7('0x18')])){if(this['agents'][_0x575439['interface']]){this[_0x43e7('0x8')][_0x575439[_0x43e7('0x28')]]={'queue':_0x575439[_0x43e7('0x29')],'interface':_0x575439[_0x43e7('0x16')],'destlinkedid':_0x575439['destlinkedid']};}}}catch(_0x583047){logger['error'](_0x43e7('0x38'),_0x583047['message']);}};Acw[_0x43e7('0x14')]['syncAgentConnectPreview']=function(_0x5b28db){try{if(this[_0x43e7('0x5')][_0x5b28db['queue']]&&(this[_0x43e7('0x5')][_0x5b28db[_0x43e7('0x29')]][_0x43e7('0x37')]||this[_0x43e7('0x5')][_0x5b28db['queue']][_0x43e7('0x18')])){if(this[_0x43e7('0x6')][_0x5b28db[_0x43e7('0x16')]]){this[_0x43e7('0x8')][_0x5b28db[_0x43e7('0x28')]]={'queue':_0x5b28db[_0x43e7('0x29')],'interface':_0x5b28db['interface']};}}}catch(_0x4930a2){logger[_0x43e7('0x2f')](_0x43e7('0x39'),_0x4930a2[_0x43e7('0x3a')]);}};Acw['prototype']['syncHangupRequest']=function(_0x56489b){try{if(this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x28')]]&&_['isUndefined'](this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x28')]][_0x43e7('0x3b')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x56489b['uniqueid']);this['startAcw'](_0x56489b[_0x43e7('0x28')]);}else if(this[_0x43e7('0x8')][_0x56489b['linkedid']]&&_[_0x43e7('0x3c')](this[_0x43e7('0x8')][_0x56489b[_0x43e7('0x3d')]][_0x43e7('0x3b')])){logger['info'](_0x43e7('0x3e'),_0x56489b['linkedid']);this['startAcw'](_0x56489b[_0x43e7('0x3d')]);}}catch(_0x12f9ba){logger[_0x43e7('0x2f')](_0x43e7('0x3f'),_0x12f9ba[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0x40')]=function(_0x256ddd){try{if(this[_0x43e7('0x8')][_0x256ddd[_0x43e7('0x28')]]&&this['channels'][_0x256ddd[_0x43e7('0x28')]][_0x43e7('0x3b')]){logger['info'](_0x43e7('0x41'),_0x256ddd['uniqueid']);this[_0x43e7('0x15')](_0x256ddd[_0x43e7('0x28')]);}else if(this[_0x43e7('0x8')][_0x256ddd[_0x43e7('0x3d')]]&&this[_0x43e7('0x8')][_0x256ddd['linkedid']]['attended']){logger[_0x43e7('0x1f')](_0x43e7('0x42'),_0x256ddd[_0x43e7('0x3d')]);this[_0x43e7('0x15')](_0x256ddd[_0x43e7('0x3d')]);}}catch(_0x25bb44){logger[_0x43e7('0x2f')](_0x43e7('0x43'),_0x25bb44[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0xe')]=function(_0x4ace49){try{if(!_[_0x43e7('0x44')](this[_0x43e7('0x8')][_0x4ace49['transfereeuniqueid']])){this[_0x43e7('0x15')](_0x4ace49[_0x43e7('0x45')]);if(this[_0x43e7('0x8')][_0x4ace49['secondtransfereruniqueid']]){this['channels'][_0x4ace49[_0x43e7('0x46')]][_0x43e7('0x3b')]=!![];this['channels'][_0x4ace49[_0x43e7('0x47')]]=this['channels'][_0x4ace49['secondtransfereruniqueid']];delete this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x46')]];}}else if(!_[_0x43e7('0x44')](this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x47')]])){this['startAcw'](_0x4ace49[_0x43e7('0x47')]);if(this[_0x43e7('0x8')][_0x4ace49['origtransfereruniqueid']]){this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x48')]][_0x43e7('0x3b')]=!![];this['channels'][_0x4ace49['transfereeuniqueid']]=this['channels'][_0x4ace49[_0x43e7('0x48')]];delete this[_0x43e7('0x8')][_0x4ace49[_0x43e7('0x48')]];}}}catch(_0x3a6404){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x3a6404[_0x43e7('0x3a')]);}};Acw[_0x43e7('0x14')][_0x43e7('0xf')]=function(_0x5dd349){try{if(this['channels'][_0x5dd349[_0x43e7('0x49')]]){logger[_0x43e7('0x1f')](_0x43e7('0x4a'),JSON[_0x43e7('0x35')](_0x5dd349[_0x43e7('0x49')]));this[_0x43e7('0x15')](_0x5dd349[_0x43e7('0x49')]);}else if(this[_0x43e7('0x8')][_0x5dd349[_0x43e7('0x4b')]]){logger[_0x43e7('0x1f')](_0x43e7('0x4c'),JSON['stringify'](_0x5dd349['transfererlinkedid']));this[_0x43e7('0x15')](_0x5dd349['transfererlinkedid']);}}catch(_0x501616){logger['error'](_0x43e7('0x4d'),_0x501616[_0x43e7('0x3a')]);}};Acw['prototype'][_0x43e7('0x4e')]=function(_0x135791){try{if(this[_0x43e7('0x5')][_0x135791['queue']]&&this[_0x43e7('0x5')][_0x135791[_0x43e7('0x29')]][_0x43e7('0x4f')]===_0x43e7('0x50')){if(this[_0x43e7('0x6')][_0x135791[_0x43e7('0x16')]]){logger[_0x43e7('0x1f')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x135791[_0x43e7('0x28')],_0x135791[_0x43e7('0x16')],_0x135791[_0x43e7('0x29')]);return RpcUser['savePause'](this['agents'][_0x135791[_0x43e7('0x16')]],'Auto-Pause',_0x135791['uniqueid']);}}}catch(_0x1b793d){logger[_0x43e7('0x2f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1b793d[_0x43e7('0x3a')]);}};module[_0x43e7('0x51')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cab11f6..c354450 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 _0xca02=['action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','Action','actionSipPeerStatus','sippeerstatus','queuesummary','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','inspect','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionDeviceStateList','actionQueueSummary','actionCoreShowChannels','catch','log','asterisk-manager','bluebird','lodash','ami','port','asterisk','password','keepConnected','promisify'];(function(_0x2e9c91,_0x2ed7d1){var _0x15fa90=function(_0x4bcc28){while(--_0x4bcc28){_0x2e9c91['push'](_0x2e9c91['shift']());}};_0x15fa90(++_0x2ed7d1);}(_0xca02,0xc9));var _0x2ca0=function(_0x54cedc,_0x2b1773){_0x54cedc=_0x54cedc-0x0;var _0x2f4e0f=_0xca02[_0x54cedc];return _0x2f4e0f;};'use strict';var Manager=require(_0x2ca0('0x0'));var BPromise=require(_0x2ca0('0x1'));var moment=require('moment');var util=require('util');var _=require(_0x2ca0('0x2'));var logger=require('../../config/logger')(_0x2ca0('0x3'));var config=require('../../config/environment');var ami=new Manager(config['asterisk'][_0x2ca0('0x4')],config[_0x2ca0('0x5')]['ip'],config[_0x2ca0('0x5')]['username'],config['asterisk'][_0x2ca0('0x6')],!![]);ami[_0x2ca0('0x7')]();ami['Action']=BPromise[_0x2ca0('0x8')](ami[_0x2ca0('0x9')]);function error(_0x33b0c5){logger[_0x2ca0('0xa')](util[_0x2ca0('0xb')](_0x2ca0('0xc'),config[_0x2ca0('0x5')][_0x2ca0('0xd')],config[_0x2ca0('0x5')]['ip'],config[_0x2ca0('0x5')][_0x2ca0('0x4')],util['inspect'](_0x33b0c5,![],null)));}function close(){logger[_0x2ca0('0xa')](util[_0x2ca0('0xb')](_0x2ca0('0xe'),config['asterisk'][_0x2ca0('0xd')],config['asterisk']['ip'],config[_0x2ca0('0x5')][_0x2ca0('0x4')]));}ami[_0x2ca0('0xf')]=function(){return function(){return ami['Action']({'action':_0x2ca0('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2ca0('0x11')]({'action':'devicestatelist'});};};ami[_0x2ca0('0x12')]=function(){return function(){return ami['Action']({'action':_0x2ca0('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x2ca0('0x11')]({'action':_0x2ca0('0x14')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x2ca0('0x11')]({'action':_0x2ca0('0x15')});};};function connect(_0xec1c76){logger['info'](util[_0x2ca0('0xb')](_0x2ca0('0x16'),config[_0x2ca0('0x5')][_0x2ca0('0xd')],config[_0x2ca0('0x5')]['ip'],config[_0x2ca0('0x5')]['port']));ami[_0x2ca0('0x17')](_0x2ca0('0xa'),error);ami[_0x2ca0('0x17')](_0x2ca0('0x18'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x3bb4b6){logger['info'](util[_0x2ca0('0xb')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2ca0('0x5')][_0x2ca0('0xd')],config[_0x2ca0('0x5')]['ip'],config[_0x2ca0('0x5')][_0x2ca0('0x4')],util[_0x2ca0('0x19')](_0x3bb4b6,![],null)));});ami['on'](_0x2ca0('0x1a'),function(_0x3fe51c){logger[_0x2ca0('0x1b')](util[_0x2ca0('0xb')](_0x2ca0('0x1c'),config[_0x2ca0('0x5')][_0x2ca0('0xd')],config[_0x2ca0('0x5')]['ip'],config[_0x2ca0('0x5')]['port']));return BPromise['resolve']()[_0x2ca0('0x1d')](ami[_0x2ca0('0xf')]())[_0x2ca0('0x1d')](ami[_0x2ca0('0x1e')]())[_0x2ca0('0x1d')](ami[_0x2ca0('0x12')]())[_0x2ca0('0x1d')](ami[_0x2ca0('0x1f')]())['then'](ami[_0x2ca0('0x20')]())[_0x2ca0('0x21')](function(_0x1922cd){console[_0x2ca0('0x22')](_0x1922cd);});});ami[_0x2ca0('0x17')](_0x2ca0('0xa'),error);ami[_0x2ca0('0x17')](_0x2ca0('0x18'),close);module['exports']=ami; \ No newline at end of file +var _0x43e7=['../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','asterisk-manager','bluebird','moment','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43e7,0x134));var _0x743e=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x43e7[_0x38b14f];return _0x22a324;};'use strict';var Manager=require(_0x743e('0x0'));var BPromise=require(_0x743e('0x1'));var moment=require(_0x743e('0x2'));var util=require(_0x743e('0x3'));var _=require('lodash');var logger=require(_0x743e('0x4'))('ami');var config=require(_0x743e('0x5'));var ami=new Manager(config[_0x743e('0x6')][_0x743e('0x7')],config[_0x743e('0x6')]['ip'],config[_0x743e('0x6')][_0x743e('0x8')],config['asterisk'][_0x743e('0x9')],!![]);ami[_0x743e('0xa')]();ami[_0x743e('0xb')]=BPromise['promisify'](ami[_0x743e('0xc')]);function error(_0x477422){logger[_0x743e('0xd')](util[_0x743e('0xe')](_0x743e('0xf'),config['asterisk'][_0x743e('0x8')],config[_0x743e('0x6')]['ip'],config[_0x743e('0x6')][_0x743e('0x7')],util[_0x743e('0x10')](_0x477422,![],null)));}function close(){logger[_0x743e('0xd')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x743e('0x6')][_0x743e('0x8')],config[_0x743e('0x6')]['ip'],config['asterisk']['port']));}ami[_0x743e('0x11')]=function(){return function(){return ami[_0x743e('0xb')]({'action':_0x743e('0x12')});};};ami[_0x743e('0x13')]=function(){return function(){return ami[_0x743e('0xb')]({'action':_0x743e('0x14')});};};ami[_0x743e('0x15')]=function(){return function(){return ami[_0x743e('0xb')]({'action':_0x743e('0x16')});};};ami[_0x743e('0x17')]=function(){return function(){return ami['Action']({'action':_0x743e('0x18')});};};ami[_0x743e('0x19')]=function(){return function(){return ami[_0x743e('0xb')]({'action':_0x743e('0x1a')});};};function connect(_0x2a8d61){logger['info'](util[_0x743e('0xe')](_0x743e('0x1b'),config['asterisk'][_0x743e('0x8')],config[_0x743e('0x6')]['ip'],config['asterisk'][_0x743e('0x7')]));ami[_0x743e('0x1c')](_0x743e('0xd'),error);ami[_0x743e('0x1c')](_0x743e('0x1d'),close);}ami['on'](_0x743e('0x1e'),connect);ami['on']('shutdown',function(_0x38ea23){logger['info'](util[_0x743e('0xe')](_0x743e('0x1f'),config[_0x743e('0x6')][_0x743e('0x8')],config[_0x743e('0x6')]['ip'],config['asterisk']['port'],util[_0x743e('0x10')](_0x38ea23,![],null)));});ami['on'](_0x743e('0x20'),function(_0x28fb79){logger[_0x743e('0x21')](util[_0x743e('0xe')](_0x743e('0x22'),config[_0x743e('0x6')]['username'],config['asterisk']['ip'],config[_0x743e('0x6')][_0x743e('0x7')]));return BPromise[_0x743e('0x23')]()[_0x743e('0x24')](ami[_0x743e('0x11')]())[_0x743e('0x24')](ami[_0x743e('0x13')]())[_0x743e('0x24')](ami[_0x743e('0x15')]())[_0x743e('0x24')](ami[_0x743e('0x17')]())[_0x743e('0x24')](ami[_0x743e('0x19')]())[_0x743e('0x25')](function(_0x16c2ab){console[_0x743e('0x26')](_0x16c2ab);});});ami['once'](_0x743e('0xd'),error);ami[_0x743e('0x1c')](_0x743e('0x1d'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 7ed7cdf..fa3782b 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 _0xb743=['message','result','exports','jayson/promise','bluebird','ami','request','then','debug','error','rpc'];(function(_0x56c852,_0x62d64f){var _0x3baa00=function(_0xf753b2){while(--_0xf753b2){_0x56c852['push'](_0x56c852['shift']());}};_0x3baa00(++_0x62d64f);}(_0xb743,0x116));var _0x3b74=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb743[_0x1cc8fe];return _0x230054;};'use strict';var jayson=require(_0x3b74('0x0'));var BPromise=require(_0x3b74('0x1'));var logger=require('../../config/logger')(_0x3b74('0x2'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x20c8e0,_0x277fa4){return new BPromise(function(_0x1828d2,_0x5f5bfc){return client[_0x3b74('0x3')](_0x20c8e0,_0x277fa4)[_0x3b74('0x4')](function(_0xb96c1d){logger[_0x3b74('0x5')]('rpc','memberReport',_0x20c8e0,_0x277fa4,_0xb96c1d);if(_0xb96c1d[_0x3b74('0x6')]){logger[_0x3b74('0x6')](_0x3b74('0x7'),'memberReport',_0x20c8e0,_0xb96c1d[_0x3b74('0x6')][_0x3b74('0x8')],_0x277fa4);return _0x5f5bfc(_0xb96c1d[_0x3b74('0x6')][_0x3b74('0x8')]);}else{return _0x1828d2(_0xb96c1d[_0x3b74('0x9')]);}})['catch'](function(_0x5c8125){logger[_0x3b74('0x6')](_0x3b74('0x7'),'memberReport',_0x20c8e0,_0x5c8125,_0x277fa4);return _0x5f5bfc(_0x5c8125);});});};module[_0x3b74('0xa')]=client; \ No newline at end of file +var _0xd596=['message','result','catch','rpc','exports','jayson/promise','../../config/logger','client','http','Request','request','debug','memberReport','error'];(function(_0x125b03,_0x39b7a3){var _0xf0b03b=function(_0x92a8fc){while(--_0x92a8fc){_0x125b03['push'](_0x125b03['shift']());}};_0xf0b03b(++_0x39b7a3);}(_0xd596,0x83));var _0x6d59=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xd596[_0x33032e];return _0x13316b;};'use strict';var jayson=require(_0x6d59('0x0'));var BPromise=require('bluebird');var logger=require(_0x6d59('0x1'))('ami');var client=jayson[_0x6d59('0x2')][_0x6d59('0x3')]({'port':0x2329});client[_0x6d59('0x4')]=function(_0x48f0d9,_0x3ff583){return new BPromise(function(_0x13b797,_0xc04169){return client[_0x6d59('0x5')](_0x48f0d9,_0x3ff583)['then'](function(_0x2ff6b1){logger[_0x6d59('0x6')]('rpc',_0x6d59('0x7'),_0x48f0d9,_0x3ff583,_0x2ff6b1);if(_0x2ff6b1[_0x6d59('0x8')]){logger[_0x6d59('0x8')]('rpc',_0x6d59('0x7'),_0x48f0d9,_0x2ff6b1[_0x6d59('0x8')][_0x6d59('0x9')],_0x3ff583);return _0xc04169(_0x2ff6b1[_0x6d59('0x8')][_0x6d59('0x9')]);}else{return _0x13b797(_0x2ff6b1[_0x6d59('0xa')]);}})[_0x6d59('0xb')](function(_0x1973eb){logger[_0x6d59('0x8')](_0x6d59('0xc'),'memberReport',_0x48f0d9,_0x1973eb,_0x3ff583);return _0xc04169(_0x1973eb);});});};module[_0x6d59('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 81fdd31..ea545a3 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 _0x0b63=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','exports','util','string','isNil','uniqueid','Contact','firstName','lastName','number','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x4d9b24,_0x395fb2){var _0x866807=function(_0x55c48c){while(--_0x55c48c){_0x4d9b24['push'](_0x4d9b24['shift']());}};_0x866807(++_0x395fb2);}(_0x0b63,0xe7));var _0x30b6=function(_0x15a468,_0x454963){_0x15a468=_0x15a468-0x0;var _0x43cd09=_0x0b63[_0x15a468];return _0x43cd09;};'use strict';var util=require(_0x30b6('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x430051,_0x862463,_0x4023ed){var _0x13ecc9='';if(!_['isNil'](_0x862463)&&_0x30b6('0x1')===typeof _0x862463){_0x13ecc9+=_0x862463;}if(!_[_0x30b6('0x2')](_0x4023ed)&&_0x30b6('0x1')===typeof _0x4023ed){_0x13ecc9+='\x20'+_0x4023ed;}if(_0x13ecc9!==''){return _0x13ecc9;}return _0x430051;}function Action(_0x37b7be,_0x2670c6,_0x2fddeb){this['voiceQueue']=_0x37b7be;this[_0x30b6('0x3')]=_0x2fddeb||undefined;this['name']=checkNameSurname(_0x2670c6[_0x30b6('0x4')]['phone'],_0x2670c6[_0x30b6('0x4')][_0x30b6('0x5')],_0x2670c6['Contact'][_0x30b6('0x6')]);this[_0x30b6('0x7')]=_0x2670c6['Contact'][_0x30b6('0x8')];this[_0x30b6('0x9')]=_0x37b7be[_0x30b6('0xa')];this[_0x30b6('0xb')]=_0x2670c6[_0x30b6('0xb')]||![];this[_0x30b6('0xc')]=_0x37b7be['type'];this[_0x30b6('0xd')]=_0x37b7be[_0x30b6('0xd')]||0x3;this[_0x30b6('0xe')]=_0x2670c6[_0x30b6('0xe')];this['countbusyretry']=_0x2670c6[_0x30b6('0xf')];this['countcongestionretry']=_0x2670c6['countcongestionretry'];this[_0x30b6('0x10')]=_0x2670c6[_0x30b6('0x10')];this[_0x30b6('0x11')]=_0x2670c6['countnosuchnumberretry'];this['countdropretry']=_0x2670c6[_0x30b6('0x12')];this[_0x30b6('0x13')]=_0x2670c6['countabandonedretry'];this[_0x30b6('0x14')]=_0x2670c6['countmachineretry'];this[_0x30b6('0x15')]=_0x2670c6[_0x30b6('0x15')];this[_0x30b6('0x16')]=_0x2670c6[_0x30b6('0x16')];this[_0x30b6('0x17')]=_0x2670c6['ListId'];this[_0x30b6('0x18')]=_0x2670c6[_0x30b6('0x18')];this[_0x30b6('0x19')]=_0x2670c6[_0x30b6('0x19')];this[_0x30b6('0x1a')]=_0x2670c6[_0x30b6('0x1a')];this[_0x30b6('0x1b')]=_0x2670c6['id'];this['ContactFirstName']=_0x2670c6[_0x30b6('0x4')][_0x30b6('0x5')]||'';this[_0x30b6('0x1c')]=moment()[_0x30b6('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x30b6('0x1e')]=_0x2670c6[_0x30b6('0x1e')];this['callbackuniqueid']=_0x2670c6[_0x30b6('0x1f')];this[_0x30b6('0x20')]=_0x2670c6[_0x30b6('0x20')];this[_0x30b6('0x21')]=_0x2670c6['recallme'];this[_0x30b6('0x22')]='';this['originatecalleridname']='';}Action[_0x30b6('0x23')][_0x30b6('0x24')]=function(){return util[_0x30b6('0x1d')](_0x30b6('0x25'),this['name'],this[_0x30b6('0x26')][_0x30b6('0x27')]>0x0?this['number'][_0x30b6('0x28')](this['voiceQueue'][_0x30b6('0x27')]):this[_0x30b6('0x7')]);};Action[_0x30b6('0x23')]['getQueue']=function(){return this[_0x30b6('0x9')];};module[_0x30b6('0x29')]=Action; \ No newline at end of file +var _0x73f5=['isNil','string','uniqueid','Contact','firstName','number','phone','queue','name','active','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','exports','util','lodash','moment'];(function(_0x403545,_0x3a61d0){var _0x906588=function(_0x3a43c6){while(--_0x3a43c6){_0x403545['push'](_0x403545['shift']());}};_0x906588(++_0x3a61d0);}(_0x73f5,0x1cb));var _0x573f=function(_0x1998bc,_0x35d740){_0x1998bc=_0x1998bc-0x0;var _0x10f3ac=_0x73f5[_0x1998bc];return _0x10f3ac;};'use strict';var util=require(_0x573f('0x0'));var _=require(_0x573f('0x1'));var moment=require(_0x573f('0x2'));function checkNameSurname(_0xbdae92,_0x5b09cc,_0x1c1744){var _0x367cf0='';if(!_[_0x573f('0x3')](_0x5b09cc)&&_0x573f('0x4')===typeof _0x5b09cc){_0x367cf0+=_0x5b09cc;}if(!_[_0x573f('0x3')](_0x1c1744)&&_0x573f('0x4')===typeof _0x1c1744){_0x367cf0+='\x20'+_0x1c1744;}if(_0x367cf0!==''){return _0x367cf0;}return _0xbdae92;}function Action(_0x242662,_0x511645,_0x2e7512){this['voiceQueue']=_0x242662;this[_0x573f('0x5')]=_0x2e7512||undefined;this['name']=checkNameSurname(_0x511645[_0x573f('0x6')]['phone'],_0x511645[_0x573f('0x6')][_0x573f('0x7')],_0x511645[_0x573f('0x6')]['lastName']);this[_0x573f('0x8')]=_0x511645['Contact'][_0x573f('0x9')];this[_0x573f('0xa')]=_0x242662[_0x573f('0xb')];this[_0x573f('0xc')]=_0x511645['active']||![];this['type']=_0x242662['type'];this[_0x573f('0xd')]=_0x242662[_0x573f('0xd')]||0x3;this[_0x573f('0xe')]=_0x511645[_0x573f('0xe')];this[_0x573f('0xf')]=_0x511645['countbusyretry'];this['countcongestionretry']=_0x511645['countcongestionretry'];this[_0x573f('0x10')]=_0x511645[_0x573f('0x10')];this[_0x573f('0x11')]=_0x511645['countnosuchnumberretry'];this[_0x573f('0x12')]=_0x511645['countdropretry'];this['countabandonedretry']=_0x511645['countabandonedretry'];this[_0x573f('0x13')]=_0x511645[_0x573f('0x13')];this[_0x573f('0x14')]=_0x511645[_0x573f('0x14')];this[_0x573f('0x15')]=_0x511645['ContactId'];this['ListId']=_0x511645[_0x573f('0x16')];this[_0x573f('0x17')]=_0x511645[_0x573f('0x17')];this['VoiceQueueId']=_0x511645[_0x573f('0x18')];this[_0x573f('0x19')]=_0x511645[_0x573f('0x19')];this[_0x573f('0x1a')]=_0x511645['id'];this[_0x573f('0x1b')]=_0x511645[_0x573f('0x6')]['firstName']||'';this[_0x573f('0x1c')]=moment()[_0x573f('0x1d')](_0x573f('0x1e'));this[_0x573f('0x1f')]=_0x511645[_0x573f('0x1f')];this[_0x573f('0x20')]=_0x511645[_0x573f('0x20')];this[_0x573f('0x21')]=_0x511645[_0x573f('0x21')];this[_0x573f('0x22')]=_0x511645[_0x573f('0x22')];this[_0x573f('0x23')]='';this[_0x573f('0x24')]='';}Action[_0x573f('0x25')][_0x573f('0x26')]=function(){return util[_0x573f('0x1d')](_0x573f('0x27'),this['name'],this['voiceQueue'][_0x573f('0x28')]>0x0?this[_0x573f('0x8')]['substring'](this['voiceQueue'][_0x573f('0x28')]):this[_0x573f('0x8')]);};Action[_0x573f('0x25')]['getQueue']=function(){return this[_0x573f('0xa')];};module[_0x573f('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 2a7597c..3f683cd 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 _0xa15a=['countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','uniqueid','calleridname','calleridnum','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','state','Answer','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x18d79e,_0x374e4a){var _0x30a1ef=function(_0x2fd8ab){while(--_0x2fd8ab){_0x18d79e['push'](_0x18d79e['shift']());}};_0x30a1ef(++_0x374e4a);}(_0xa15a,0x17e));var _0xaa15=function(_0x43cf72,_0x28f147){_0x43cf72=_0x43cf72-0x0;var _0x269afc=_0xa15a[_0x43cf72];return _0x269afc;};'use strict';var util=require(_0xaa15('0x0'));var _=require('lodash');var moment=require(_0xaa15('0x1'));function getSeconds(_0x45c1ce,_0x40c77e){var _0x23e2c0=moment(_0x45c1ce)[_0xaa15('0x2')](0x0);var _0x2ef377=moment(_0x40c77e)['milliseconds'](0x0);return _0x23e2c0[_0xaa15('0x3')](_0x2ef377,_0xaa15('0x4'));}function AgentComplete(_0x57bd66,_0x5868b2){this[_0xaa15('0x5')]=0x4;this['statedesc']=_0xaa15('0x6');this[_0xaa15('0x7')]=_0x57bd66[_0xaa15('0x7')];this['type']=_0x57bd66['type'];this[_0xaa15('0x8')]=_0x57bd66[_0xaa15('0x9')]===_0xaa15('0xa')?_0xaa15('0xb'):_0x57bd66[_0xaa15('0x9')];this[_0xaa15('0xc')]=_0x57bd66['countbusyretry'];this[_0xaa15('0xd')]=_0x57bd66[_0xaa15('0xd')];this[_0xaa15('0xe')]=_0x57bd66[_0xaa15('0xe')];this['countglobal']=_0x57bd66[_0xaa15('0xc')]+_0x57bd66[_0xaa15('0xd')]+_0x57bd66[_0xaa15('0xe')]+_0x57bd66['countnosuchnumberretry']+_0x57bd66['countdropretry']+_0x57bd66[_0xaa15('0xf')]+_0x57bd66[_0xaa15('0x10')]+_0x57bd66[_0xaa15('0x11')];this[_0xaa15('0x12')]=_0x57bd66[_0xaa15('0x12')];this['countdropretry']=_0x57bd66[_0xaa15('0x13')];this[_0xaa15('0xf')]=_0x57bd66[_0xaa15('0xf')];this['countmachineretry']=_0x57bd66['countmachineretry'];this[_0xaa15('0x11')]=_0x57bd66[_0xaa15('0x11')];this[_0xaa15('0x14')]=_0x5868b2[_0xaa15('0x14')];this[_0xaa15('0x15')]=_0x57bd66['name'];this[_0xaa15('0x16')]=_0x57bd66['number'];this['starttime']=_0x57bd66['starttime'];this[_0xaa15('0x17')]=_0x57bd66[_0xaa15('0x17')];this[_0xaa15('0x18')]=_0x57bd66['answertime'];this[_0xaa15('0x19')]=moment()[_0xaa15('0x1a')](_0xaa15('0x1b'));this[_0xaa15('0x1c')]=getSeconds(_0x57bd66[_0xaa15('0x17')],_0x57bd66['starttime']);this[_0xaa15('0x1d')]=getSeconds(_0x57bd66[_0xaa15('0x18')],_0x57bd66[_0xaa15('0x17')]);this[_0xaa15('0x1e')]=getSeconds(this['endtime'],_0x57bd66['answertime']);this['queue']=_0x5868b2[_0xaa15('0xb')];this['membername']=_0x5868b2[_0xaa15('0x1f')];this['reason']=_0x5868b2[_0xaa15('0x20')];this['callback']=_0x57bd66[_0xaa15('0x21')];this[_0xaa15('0x22')]=_0x57bd66['callbackuniqueid'];this[_0xaa15('0x23')]=_0x57bd66[_0xaa15('0x23')];this['recallme']=_0x57bd66[_0xaa15('0x24')];this[_0xaa15('0x25')]=_0x57bd66[_0xaa15('0x25')];this['ListId']=_0x57bd66['ListId'];this[_0xaa15('0x26')]=_0x57bd66[_0xaa15('0x26')];this[_0xaa15('0x27')]=_0x57bd66[_0xaa15('0x27')];this[_0xaa15('0x28')]=_0x57bd66[_0xaa15('0x28')];this['originatecalleridnum']=_0x57bd66[_0xaa15('0x29')]||'';this[_0xaa15('0x2a')]=_0x57bd66[_0xaa15('0x2a')]||'';}module[_0xaa15('0x2b')]=AgentComplete; \ No newline at end of file +var _0x981b=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','format','ringtime','holdtime','talktime','membername','reason'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x981b,0xec));var _0xb981=function(_0x5439f1,_0x2cdbcf){_0x5439f1=_0x5439f1-0x0;var _0x402b35=_0x981b[_0x5439f1];return _0x402b35;};'use strict';var util=require(_0xb981('0x0'));var _=require(_0xb981('0x1'));var moment=require(_0xb981('0x2'));function getSeconds(_0x2105d3,_0xcf48ba){var _0x2db6ca=moment(_0x2105d3)[_0xb981('0x3')](0x0);var _0x29339e=moment(_0xcf48ba)[_0xb981('0x3')](0x0);return _0x2db6ca[_0xb981('0x4')](_0x29339e,'seconds');}function AgentComplete(_0x3e8ccb,_0x33763f){this[_0xb981('0x5')]=0x4;this['statedesc']=_0xb981('0x6');this['scheduledat']=_0x3e8ccb[_0xb981('0x7')];this[_0xb981('0x8')]=_0x3e8ccb[_0xb981('0x8')];this[_0xb981('0x9')]=_0x3e8ccb[_0xb981('0x8')]===_0xb981('0xa')?_0xb981('0xb'):_0x3e8ccb[_0xb981('0x8')];this['countbusyretry']=_0x3e8ccb[_0xb981('0xc')];this['countcongestionretry']=_0x3e8ccb[_0xb981('0xd')];this['countnoanswerretry']=_0x3e8ccb[_0xb981('0xe')];this['countglobal']=_0x3e8ccb[_0xb981('0xc')]+_0x3e8ccb[_0xb981('0xd')]+_0x3e8ccb[_0xb981('0xe')]+_0x3e8ccb[_0xb981('0xf')]+_0x3e8ccb[_0xb981('0x10')]+_0x3e8ccb[_0xb981('0x11')]+_0x3e8ccb[_0xb981('0x12')]+_0x3e8ccb[_0xb981('0x13')];this[_0xb981('0xf')]=_0x3e8ccb[_0xb981('0xf')];this[_0xb981('0x10')]=_0x3e8ccb[_0xb981('0x10')];this[_0xb981('0x11')]=_0x3e8ccb['countabandonedretry'];this[_0xb981('0x12')]=_0x3e8ccb['countmachineretry'];this['countagentrejectretry']=_0x3e8ccb['countagentrejectretry'];this['uniqueid']=_0x33763f[_0xb981('0x14')];this[_0xb981('0x15')]=_0x3e8ccb[_0xb981('0x16')];this[_0xb981('0x17')]=_0x3e8ccb[_0xb981('0x18')];this[_0xb981('0x19')]=_0x3e8ccb[_0xb981('0x19')];this[_0xb981('0x1a')]=_0x3e8ccb[_0xb981('0x1a')];this[_0xb981('0x1b')]=_0x3e8ccb['answertime'];this['endtime']=moment()[_0xb981('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb981('0x1d')]=getSeconds(_0x3e8ccb[_0xb981('0x1a')],_0x3e8ccb[_0xb981('0x19')]);this[_0xb981('0x1e')]=getSeconds(_0x3e8ccb[_0xb981('0x1b')],_0x3e8ccb[_0xb981('0x1a')]);this[_0xb981('0x1f')]=getSeconds(this['endtime'],_0x3e8ccb[_0xb981('0x1b')]);this[_0xb981('0xb')]=_0x33763f['queue'];this[_0xb981('0x20')]=_0x33763f[_0xb981('0x20')];this['reason']=_0x33763f[_0xb981('0x21')];this['callback']=_0x3e8ccb[_0xb981('0x22')];this[_0xb981('0x23')]=_0x3e8ccb['callbackuniqueid'];this[_0xb981('0x24')]=_0x3e8ccb[_0xb981('0x24')];this[_0xb981('0x25')]=_0x3e8ccb[_0xb981('0x25')];this[_0xb981('0x26')]=_0x3e8ccb[_0xb981('0x26')];this['ListId']=_0x3e8ccb[_0xb981('0x27')];this['UserId']=_0x3e8ccb[_0xb981('0x28')];this['VoiceQueueId']=_0x3e8ccb['VoiceQueueId'];this[_0xb981('0x29')]=_0x3e8ccb[_0xb981('0x29')];this[_0xb981('0x2a')]=_0x3e8ccb[_0xb981('0x2a')]||'';this[_0xb981('0x2b')]=_0x3e8ccb[_0xb981('0x2b')]||'';}module[_0xb981('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e0764f7..aa35170 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 _0xcfef=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','milliseconds','diff','seconds','uniqueid','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry'];(function(_0x3b14b5,_0x2e8c68){var _0x43baed=function(_0xc90128){while(--_0xc90128){_0x3b14b5['push'](_0x3b14b5['shift']());}};_0x43baed(++_0x2e8c68);}(_0xcfef,0xf7));var _0xfcfe=function(_0x513801,_0x4426bf){_0x513801=_0x513801-0x0;var _0x5c560c=_0xcfef[_0x513801];return _0x5c560c;};'use strict';var util=require(_0xfcfe('0x0'));var _=require(_0xfcfe('0x1'));var moment=require('moment');function getSeconds(_0x1fa93a,_0x4e4e0c){var _0x36a018=moment(_0x1fa93a)[_0xfcfe('0x2')](0x0);var _0x27b5a3=moment(_0x4e4e0c)[_0xfcfe('0x2')](0x0);return _0x36a018[_0xfcfe('0x3')](_0x27b5a3,_0xfcfe('0x4'));}function Final(_0x3c96ff){this[_0xfcfe('0x5')]=_0x3c96ff[_0xfcfe('0x5')];this[_0xfcfe('0x6')]=_0x3c96ff[_0xfcfe('0x6')];this['type']=_0x3c96ff['type'];this[_0xfcfe('0x7')]=_0x3c96ff[_0xfcfe('0x8')]===_0xfcfe('0x9')?_0xfcfe('0xa'):_0x3c96ff[_0xfcfe('0x8')];this[_0xfcfe('0xb')]=_0x3c96ff[_0xfcfe('0xb')];this[_0xfcfe('0xc')]=_0x3c96ff[_0xfcfe('0xc')];this[_0xfcfe('0xd')]=_0x3c96ff['countnoanswerretry'];this[_0xfcfe('0xe')]=_0x3c96ff[_0xfcfe('0xb')]+_0x3c96ff[_0xfcfe('0xc')]+_0x3c96ff[_0xfcfe('0xd')]+_0x3c96ff['countnosuchnumberretry']+_0x3c96ff[_0xfcfe('0xf')]+_0x3c96ff['countabandonedretry']+_0x3c96ff[_0xfcfe('0x10')]+_0x3c96ff[_0xfcfe('0x11')];this['countnosuchnumberretry']=_0x3c96ff['countnosuchnumberretry'];this[_0xfcfe('0xf')]=_0x3c96ff['countdropretry'];this['countabandonedretry']=_0x3c96ff[_0xfcfe('0x12')];this[_0xfcfe('0x10')]=_0x3c96ff[_0xfcfe('0x10')];this['countagentrejectretry']=_0x3c96ff[_0xfcfe('0x11')];this[_0xfcfe('0xa')]=_0x3c96ff['queue'];this[_0xfcfe('0x13')]=_0x3c96ff[_0xfcfe('0x13')];this[_0xfcfe('0x14')]=_0x3c96ff[_0xfcfe('0x14')];this[_0xfcfe('0x15')]=_0x3c96ff[_0xfcfe('0x15')];this['responsetime']=_0x3c96ff[_0xfcfe('0x16')];this[_0xfcfe('0x17')]=_0x3c96ff[_0xfcfe('0x16')];this['ringtime']=_0x3c96ff[_0xfcfe('0x18')]||0x0;this[_0xfcfe('0x19')]=_0x3c96ff['holdtime']||0x0;this[_0xfcfe('0x1a')]=_0x3c96ff['talktime']||0x0;this[_0xfcfe('0x1b')]=_0x3c96ff[_0xfcfe('0x1b')];this['callbackuniqueid']=_0x3c96ff[_0xfcfe('0x1c')];this[_0xfcfe('0x1d')]=_0x3c96ff[_0xfcfe('0x1d')];this[_0xfcfe('0x1e')]=_0x3c96ff['recallme'];this[_0xfcfe('0x1f')]=_0x3c96ff['ContactId'];this[_0xfcfe('0x20')]=_0x3c96ff[_0xfcfe('0x20')];this[_0xfcfe('0x21')]=_0x3c96ff[_0xfcfe('0x21')];this['VoiceQueueId']=_0x3c96ff[_0xfcfe('0x22')];this[_0xfcfe('0x23')]=_0x3c96ff[_0xfcfe('0x23')];this[_0xfcfe('0x24')]=_0x3c96ff[_0xfcfe('0x24')]||'';this[_0xfcfe('0x25')]=_0x3c96ff[_0xfcfe('0x25')]||'';}module['exports']=Final; \ No newline at end of file +var _0x7892=['calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','moment','diff','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','queue','calleridname'];(function(_0x5cc01e,_0x4fdda6){var _0x38899c=function(_0x38ad6a){while(--_0x38ad6a){_0x5cc01e['push'](_0x5cc01e['shift']());}};_0x38899c(++_0x4fdda6);}(_0x7892,0x1f3));var _0x2789=function(_0x49436c,_0x1a7242){_0x49436c=_0x49436c-0x0;var _0x46f704=_0x7892[_0x49436c];return _0x46f704;};'use strict';var util=require(_0x2789('0x0'));var _=require(_0x2789('0x1'));var moment=require(_0x2789('0x2'));function getSeconds(_0x94e3eb,_0x45cc05){var _0x2673f2=moment(_0x94e3eb)['milliseconds'](0x0);var _0x6e7bd6=moment(_0x45cc05)['milliseconds'](0x0);return _0x2673f2[_0x2789('0x3')](_0x6e7bd6,'seconds');}function Final(_0x4e3f5c){this[_0x2789('0x4')]=_0x4e3f5c[_0x2789('0x4')];this[_0x2789('0x5')]=_0x4e3f5c[_0x2789('0x5')];this[_0x2789('0x6')]=_0x4e3f5c[_0x2789('0x6')];this[_0x2789('0x7')]=_0x4e3f5c['type']===_0x2789('0x8')?'queue':_0x4e3f5c[_0x2789('0x6')];this['countbusyretry']=_0x4e3f5c[_0x2789('0x9')];this[_0x2789('0xa')]=_0x4e3f5c[_0x2789('0xa')];this[_0x2789('0xb')]=_0x4e3f5c[_0x2789('0xb')];this[_0x2789('0xc')]=_0x4e3f5c['countbusyretry']+_0x4e3f5c[_0x2789('0xa')]+_0x4e3f5c['countnoanswerretry']+_0x4e3f5c['countnosuchnumberretry']+_0x4e3f5c['countdropretry']+_0x4e3f5c['countabandonedretry']+_0x4e3f5c['countmachineretry']+_0x4e3f5c[_0x2789('0xd')];this[_0x2789('0xe')]=_0x4e3f5c[_0x2789('0xe')];this[_0x2789('0xf')]=_0x4e3f5c['countdropretry'];this['countabandonedretry']=_0x4e3f5c['countabandonedretry'];this[_0x2789('0x10')]=_0x4e3f5c[_0x2789('0x10')];this[_0x2789('0xd')]=_0x4e3f5c[_0x2789('0xd')];this[_0x2789('0x11')]=_0x4e3f5c[_0x2789('0x11')];this[_0x2789('0x12')]=_0x4e3f5c[_0x2789('0x12')];this[_0x2789('0x13')]=_0x4e3f5c[_0x2789('0x13')];this[_0x2789('0x14')]=_0x4e3f5c[_0x2789('0x14')];this[_0x2789('0x15')]=_0x4e3f5c[_0x2789('0x15')];this[_0x2789('0x16')]=_0x4e3f5c[_0x2789('0x15')];this[_0x2789('0x17')]=_0x4e3f5c[_0x2789('0x17')]||0x0;this['holdtime']=_0x4e3f5c[_0x2789('0x18')]||0x0;this[_0x2789('0x19')]=_0x4e3f5c[_0x2789('0x19')]||0x0;this[_0x2789('0x1a')]=_0x4e3f5c[_0x2789('0x1a')];this[_0x2789('0x1b')]=_0x4e3f5c['callbackuniqueid'];this[_0x2789('0x1c')]=_0x4e3f5c[_0x2789('0x1c')];this[_0x2789('0x1d')]=_0x4e3f5c[_0x2789('0x1d')];this[_0x2789('0x1e')]=_0x4e3f5c[_0x2789('0x1e')];this[_0x2789('0x1f')]=_0x4e3f5c[_0x2789('0x1f')];this['UserId']=_0x4e3f5c[_0x2789('0x20')];this[_0x2789('0x21')]=_0x4e3f5c[_0x2789('0x21')];this['CampaignId']=_0x4e3f5c[_0x2789('0x22')];this['originatecalleridnum']=_0x4e3f5c['originatecalleridnum']||'';this[_0x2789('0x23')]=_0x4e3f5c[_0x2789('0x23')]||'';}module[_0x2789('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 3ff87d8..df5b605 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 _0x1ede=['milliseconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','endtime','membername','IVR','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment'];(function(_0x41d89e,_0x4d13ec){var _0x5cd698=function(_0x1e9207){while(--_0x1e9207){_0x41d89e['push'](_0x41d89e['shift']());}};_0x5cd698(++_0x4d13ec);}(_0x1ede,0x9d));var _0xe1ed=function(_0x41c717,_0x3a7ee3){_0x41c717=_0x41c717-0x0;var _0x55128c=_0x1ede[_0x41c717];return _0x55128c;};'use strict';var util=require(_0xe1ed('0x0'));var _=require(_0xe1ed('0x1'));var moment=require(_0xe1ed('0x2'));function getSeconds(_0x493022,_0x35ffa1){var _0x14cf01=moment(_0x493022)[_0xe1ed('0x3')](0x0);var _0xccb697=moment(_0x35ffa1)[_0xe1ed('0x3')](0x0);return _0x14cf01['diff'](_0xccb697,'seconds');}function Hangup(_0xe159e,_0x23166d){this[_0xe1ed('0x4')]=0x4;this[_0xe1ed('0x5')]='Answer';this[_0xe1ed('0x6')]=_0xe159e[_0xe1ed('0x6')];this[_0xe1ed('0x7')]=_0xe159e[_0xe1ed('0x7')];this[_0xe1ed('0x8')]=_0xe159e['type']===_0xe1ed('0x9')?_0xe1ed('0xa'):_0xe159e[_0xe1ed('0x7')];this['countbusyretry']=_0xe159e[_0xe1ed('0xb')];this[_0xe1ed('0xc')]=_0xe159e[_0xe1ed('0xc')];this[_0xe1ed('0xd')]=_0xe159e[_0xe1ed('0xd')];this[_0xe1ed('0xe')]=_0xe159e[_0xe1ed('0xb')]+_0xe159e[_0xe1ed('0xc')]+_0xe159e[_0xe1ed('0xd')]+_0xe159e['countnosuchnumberretry']+_0xe159e[_0xe1ed('0xf')]+_0xe159e['countabandonedretry']+_0xe159e[_0xe1ed('0x10')]+_0xe159e[_0xe1ed('0x11')];this['countnosuchnumberretry']=_0xe159e['countnosuchnumberretry'];this[_0xe1ed('0xf')]=_0xe159e[_0xe1ed('0xf')];this['countabandonedretry']=_0xe159e[_0xe1ed('0x12')];this[_0xe1ed('0x10')]=_0xe159e['countmachineretry'];this['countagentrejectretry']=_0xe159e['countagentrejectretry'];this['uniqueid']=_0x23166d[_0xe1ed('0x13')];this[_0xe1ed('0x14')]=_0xe159e['name'];this[_0xe1ed('0x15')]=_0xe159e['number'];this['starttime']=_0xe159e[_0xe1ed('0x16')];this[_0xe1ed('0x17')]=_0xe159e[_0xe1ed('0x17')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xe1ed('0x18')]=getSeconds(_0xe159e['responsetime'],_0xe159e[_0xe1ed('0x16')]);this[_0xe1ed('0x19')]=0x0;this[_0xe1ed('0x1a')]=getSeconds(this[_0xe1ed('0x1b')],_0xe159e[_0xe1ed('0x17')]);this[_0xe1ed('0xa')]=_0xe159e[_0xe1ed('0xa')];this[_0xe1ed('0x1c')]=_0xe1ed('0x1d');this['reason']=_0x23166d[_0xe1ed('0x1e')];this[_0xe1ed('0x1f')]=_0xe159e[_0xe1ed('0x1f')];this['callbackuniqueid']=_0xe159e[_0xe1ed('0x20')];this['callbackat']=_0xe159e['callbackat'];this[_0xe1ed('0x21')]=_0xe159e[_0xe1ed('0x21')];this[_0xe1ed('0x22')]=_0xe159e[_0xe1ed('0x22')];this[_0xe1ed('0x23')]=_0xe159e['ListId'];this[_0xe1ed('0x24')]=_0xe159e[_0xe1ed('0x24')];this[_0xe1ed('0x25')]=_0xe159e['VoiceQueueId'];this[_0xe1ed('0x26')]=_0xe159e['CampaignId'];}module[_0xe1ed('0x27')]=Hangup; \ No newline at end of file +var _0x030f=['responsetime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','number','starttime'];(function(_0x230f1b,_0x4476e4){var _0xb49d87=function(_0x32db7a){while(--_0x32db7a){_0x230f1b['push'](_0x230f1b['shift']());}};_0xb49d87(++_0x4476e4);}(_0x030f,0xe9));var _0xf030=function(_0x2f4767,_0x4f317b){_0x2f4767=_0x2f4767-0x0;var _0x3d8aae=_0x030f[_0x2f4767];return _0x3d8aae;};'use strict';var util=require(_0xf030('0x0'));var _=require(_0xf030('0x1'));var moment=require(_0xf030('0x2'));function getSeconds(_0x30cb6f,_0x23a12f){var _0x2f91e5=moment(_0x30cb6f)['milliseconds'](0x0);var _0x3f088f=moment(_0x23a12f)[_0xf030('0x3')](0x0);return _0x2f91e5[_0xf030('0x4')](_0x3f088f,'seconds');}function Hangup(_0x494070,_0x1781d2){this[_0xf030('0x5')]=0x4;this[_0xf030('0x6')]='Answer';this[_0xf030('0x7')]=_0x494070[_0xf030('0x7')];this[_0xf030('0x8')]=_0x494070[_0xf030('0x8')];this[_0xf030('0x9')]=_0x494070[_0xf030('0x8')]===_0xf030('0xa')?_0xf030('0xb'):_0x494070['type'];this['countbusyretry']=_0x494070[_0xf030('0xc')];this['countcongestionretry']=_0x494070[_0xf030('0xd')];this[_0xf030('0xe')]=_0x494070[_0xf030('0xe')];this[_0xf030('0xf')]=_0x494070[_0xf030('0xc')]+_0x494070[_0xf030('0xd')]+_0x494070[_0xf030('0xe')]+_0x494070[_0xf030('0x10')]+_0x494070['countdropretry']+_0x494070[_0xf030('0x11')]+_0x494070[_0xf030('0x12')]+_0x494070[_0xf030('0x13')];this['countnosuchnumberretry']=_0x494070[_0xf030('0x10')];this[_0xf030('0x14')]=_0x494070['countdropretry'];this['countabandonedretry']=_0x494070[_0xf030('0x11')];this[_0xf030('0x12')]=_0x494070[_0xf030('0x12')];this[_0xf030('0x13')]=_0x494070[_0xf030('0x13')];this['uniqueid']=_0x1781d2['uniqueid'];this[_0xf030('0x15')]=_0x494070['name'];this[_0xf030('0x16')]=_0x494070[_0xf030('0x17')];this[_0xf030('0x18')]=_0x494070[_0xf030('0x18')];this[_0xf030('0x19')]=_0x494070[_0xf030('0x19')];this['endtime']=moment()[_0xf030('0x1a')](_0xf030('0x1b'));this['ringtime']=getSeconds(_0x494070['responsetime'],_0x494070[_0xf030('0x18')]);this[_0xf030('0x1c')]=0x0;this['talktime']=getSeconds(this[_0xf030('0x1d')],_0x494070[_0xf030('0x19')]);this[_0xf030('0xb')]=_0x494070['queue'];this[_0xf030('0x1e')]=_0xf030('0x1f');this[_0xf030('0x20')]=_0x1781d2[_0xf030('0x21')];this['callback']=_0x494070[_0xf030('0x22')];this[_0xf030('0x23')]=_0x494070[_0xf030('0x23')];this[_0xf030('0x24')]=_0x494070['callbackat'];this['recallme']=_0x494070[_0xf030('0x25')];this['ContactId']=_0x494070['ContactId'];this[_0xf030('0x26')]=_0x494070[_0xf030('0x26')];this[_0xf030('0x27')]=_0x494070[_0xf030('0x27')];this[_0xf030('0x28')]=_0x494070[_0xf030('0x28')];this[_0xf030('0x29')]=_0x494070[_0xf030('0x29')];}module[_0xf030('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 3ce0b05..bcf8453 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 _0x0e18=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','number','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x5a6644,_0x45d612){var _0x3a2a5d=function(_0x54159e){while(--_0x54159e){_0x5a6644['push'](_0x5a6644['shift']());}};_0x3a2a5d(++_0x45d612);}(_0x0e18,0x1c2));var _0x80e1=function(_0x202dcc,_0x4a9414){_0x202dcc=_0x202dcc-0x0;var _0x4f318a=_0x0e18[_0x202dcc];return _0x4f318a;};'use strict';var util=require(_0x80e1('0x0'));var _=require(_0x80e1('0x1'));var moment=require(_0x80e1('0x2'));function getSeconds(_0x31e62d,_0x372bab){var _0x1c075f=moment(_0x31e62d)[_0x80e1('0x3')](0x0);var _0x40c176=moment(_0x372bab)[_0x80e1('0x3')](0x0);return _0x1c075f[_0x80e1('0x4')](_0x40c176,_0x80e1('0x5'));}function History(_0x5c1a1a){this['uniqueid']=_0x5c1a1a[_0x80e1('0x6')];this[_0x80e1('0x7')]=_0x5c1a1a[_0x80e1('0x7')]||undefined;this[_0x80e1('0x8')]=_0x5c1a1a[_0x80e1('0x8')];this['campaigntype']=_0x5c1a1a[_0x80e1('0x8')]===_0x80e1('0x9')?_0x80e1('0xa'):_0x5c1a1a[_0x80e1('0x8')];this['countbusyretry']=_0x5c1a1a[_0x80e1('0xb')];this[_0x80e1('0xc')]=_0x5c1a1a[_0x80e1('0xc')];this['countnoanswerretry']=_0x5c1a1a['countnoanswerretry'];this[_0x80e1('0xd')]=_0x5c1a1a[_0x80e1('0xb')]+_0x5c1a1a[_0x80e1('0xc')]+_0x5c1a1a[_0x80e1('0xe')]+_0x5c1a1a['countnosuchnumberretry']+_0x5c1a1a[_0x80e1('0xf')]+_0x5c1a1a[_0x80e1('0x10')]+_0x5c1a1a[_0x80e1('0x11')]+_0x5c1a1a[_0x80e1('0x12')];this[_0x80e1('0x13')]=_0x5c1a1a[_0x80e1('0x13')];this['countdropretry']=_0x5c1a1a[_0x80e1('0xf')];this['countabandonedretry']=_0x5c1a1a[_0x80e1('0x10')];this[_0x80e1('0x11')]=_0x5c1a1a['countmachineretry'];this[_0x80e1('0x12')]=_0x5c1a1a[_0x80e1('0x12')];this['queue']=_0x5c1a1a[_0x80e1('0xa')];this['calleridname']=_0x5c1a1a['name'];this['calleridnum']=_0x5c1a1a[_0x80e1('0x14')];this['starttime']=_0x5c1a1a[_0x80e1('0x15')];this[_0x80e1('0x16')]=_0x5c1a1a[_0x80e1('0x16')];this['endtime']=_0x5c1a1a[_0x80e1('0x16')];this['ringtime']=getSeconds(_0x5c1a1a['responsetime'],_0x5c1a1a['starttime']);this[_0x80e1('0x17')]=0x0;this[_0x80e1('0x18')]=0x0;this[_0x80e1('0x19')]=_0x5c1a1a[_0x80e1('0x19')];this[_0x80e1('0x1a')]=_0x5c1a1a[_0x80e1('0x1a')];this[_0x80e1('0x1b')]=_0x5c1a1a[_0x80e1('0x1b')];this[_0x80e1('0x1c')]=_0x5c1a1a['recallme'];this['ContactId']=_0x5c1a1a[_0x80e1('0x1d')];this[_0x80e1('0x1e')]=_0x5c1a1a[_0x80e1('0x1e')];this['UserId']=_0x5c1a1a[_0x80e1('0x1f')];this[_0x80e1('0x20')]=_0x5c1a1a['VoiceQueueId'];this['CampaignId']=_0x5c1a1a[_0x80e1('0x21')];this[_0x80e1('0x22')]=_0x5c1a1a[_0x80e1('0x22')]||'';this[_0x80e1('0x23')]=_0x5c1a1a[_0x80e1('0x23')]||'';}module[_0x80e1('0x24')]=History; \ No newline at end of file +var _0xed1c=['name','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x32d990,_0x342025){var _0xab0933=function(_0x18280c){while(--_0x18280c){_0x32d990['push'](_0x32d990['shift']());}};_0xab0933(++_0x342025);}(_0xed1c,0x7f));var _0xced1=function(_0x4e52b9,_0x3b39b2){_0x4e52b9=_0x4e52b9-0x0;var _0xca4e2a=_0xed1c[_0x4e52b9];return _0xca4e2a;};'use strict';var util=require(_0xced1('0x0'));var _=require(_0xced1('0x1'));var moment=require('moment');function getSeconds(_0x28d91e,_0x1ef0bd){var _0x23be6f=moment(_0x28d91e)[_0xced1('0x2')](0x0);var _0x3ff8a2=moment(_0x1ef0bd)['milliseconds'](0x0);return _0x23be6f['diff'](_0x3ff8a2,'seconds');}function History(_0x3c8b44){this['uniqueid']=_0x3c8b44[_0xced1('0x3')];this['scheduledat']=_0x3c8b44[_0xced1('0x4')]||undefined;this[_0xced1('0x5')]=_0x3c8b44['type'];this[_0xced1('0x6')]=_0x3c8b44[_0xced1('0x5')]===_0xced1('0x7')?_0xced1('0x8'):_0x3c8b44['type'];this['countbusyretry']=_0x3c8b44[_0xced1('0x9')];this[_0xced1('0xa')]=_0x3c8b44[_0xced1('0xa')];this['countnoanswerretry']=_0x3c8b44[_0xced1('0xb')];this['countglobal']=_0x3c8b44[_0xced1('0x9')]+_0x3c8b44[_0xced1('0xa')]+_0x3c8b44[_0xced1('0xb')]+_0x3c8b44[_0xced1('0xc')]+_0x3c8b44[_0xced1('0xd')]+_0x3c8b44[_0xced1('0xe')]+_0x3c8b44[_0xced1('0xf')]+_0x3c8b44[_0xced1('0x10')];this[_0xced1('0xc')]=_0x3c8b44['countnosuchnumberretry'];this['countdropretry']=_0x3c8b44[_0xced1('0xd')];this['countabandonedretry']=_0x3c8b44[_0xced1('0xe')];this[_0xced1('0xf')]=_0x3c8b44[_0xced1('0xf')];this[_0xced1('0x10')]=_0x3c8b44[_0xced1('0x10')];this['queue']=_0x3c8b44[_0xced1('0x8')];this['calleridname']=_0x3c8b44[_0xced1('0x11')];this[_0xced1('0x12')]=_0x3c8b44[_0xced1('0x13')];this[_0xced1('0x14')]=_0x3c8b44[_0xced1('0x14')];this[_0xced1('0x15')]=_0x3c8b44['responsetime'];this['endtime']=_0x3c8b44[_0xced1('0x15')];this[_0xced1('0x16')]=getSeconds(_0x3c8b44['responsetime'],_0x3c8b44[_0xced1('0x14')]);this[_0xced1('0x17')]=0x0;this[_0xced1('0x18')]=0x0;this[_0xced1('0x19')]=_0x3c8b44[_0xced1('0x19')];this[_0xced1('0x1a')]=_0x3c8b44['callbackuniqueid'];this['callbackat']=_0x3c8b44['callbackat'];this[_0xced1('0x1b')]=_0x3c8b44[_0xced1('0x1b')];this[_0xced1('0x1c')]=_0x3c8b44[_0xced1('0x1c')];this[_0xced1('0x1d')]=_0x3c8b44[_0xced1('0x1d')];this[_0xced1('0x1e')]=_0x3c8b44[_0xced1('0x1e')];this['VoiceQueueId']=_0x3c8b44[_0xced1('0x1f')];this[_0xced1('0x20')]=_0x3c8b44[_0xced1('0x20')];this[_0xced1('0x21')]=_0x3c8b44[_0xced1('0x21')]||'';this[_0xced1('0x22')]=_0x3c8b44[_0xced1('0x22')]||'';}module[_0xced1('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index d0f8bba..54a8055 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 _0xf17f=['AGI','cause-txt','Unknow','syncAgentComplete','reason','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[syncAgentComplete][createHistory][11]','actions','channel','actionid','locked','stateinterface','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','finally','[booked][RR][finaly]','[booked][unlock]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','indexOf','true','content','all','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','dialPowerLevel','predictive','booked','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','originate','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','isSuccess','response','callProgressDetecting','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','buildObj','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','preview','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][historyBlacklist]','limitCalls','temp','getContactDialerIvr','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','exports','util','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','strategy','answered','available','loggedIn','sumBillable','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','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','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','RESCHEDULED_CONTACTS','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','clearZombieChannels','[actions]','sequence','isNil','Action','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','UserId','CampaignId','[emptyContact][createHistory]','Success','isTrunkReachable','SIP/%s','status','reachable','uniqueid','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','statedesc','HangupInAMD','membername','[syncHangupInAMD][createHistory]','value','MACHINE','outboundAnswerAgiCallsDay','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','rescheduleContact','add','dialMachineRetryFrequency','minutes','ContactId','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countglobal','countcongestionretry','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf17f,0x118));var _0xff17=function(_0x5e06a1,_0x340f61){_0x5e06a1=_0x5e06a1-0x0;var _0x5b3253=_0xf17f[_0x5e06a1];return _0x5b3253;};'use strict';var util=require(_0xff17('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xff17('0x1'));var moment=require(_0xff17('0x2'));var rr=require('rr');var md5=require(_0xff17('0x3'));var Redis=require(_0xff17('0x4'));var ut=require(_0xff17('0x5'));var config=require('../../../config/environment/');var logger=require(_0xff17('0x6'))('dialer');var loggerBooked=require(_0xff17('0x6'))('booked');var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0xff17('0x6'))(_0xff17('0x7'));var loggerSyncQueueSummary=require(_0xff17('0x6'))(_0xff17('0x8'));var ami=require(_0xff17('0x9'));config[_0xff17('0xa')]=_[_0xff17('0xb')](config[_0xff17('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xff17('0xa')]));var cmHopper=require(_0xff17('0xc'));var cmHopperFinal=require(_0xff17('0xd'));var cmHopperHistory=require(_0xff17('0xe'));var cmHopperBlack=require(_0xff17('0xf'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xff17('0x10'));var History=require(_0xff17('0x11'));var Final=require('./final');var AgentComplete=require(_0xff17('0x12'));var QueueCallerAbandon=require(_0xff17('0x13'));var Hangup=require(_0xff17('0x14'));var ipAgi=process[_0xff17('0x15')][_0xff17('0x16')]||'127.0.0.1';var strategy={'rrmemory':_0xff17('0x17'),'roundrobin':_0xff17('0x18')};var Sequence=function(){};Sequence[_0xff17('0x19')][_0xff17('0x1a')]=function(_0x1f9c08){this['tail']=this['tail']?this[_0xff17('0x1b')]['finally'](_0x1f9c08):_0x1f9c08();};function Dialer(_0x5db758,_0x34023e){this['sequence']=new Sequence();this['preview']=_0x34023e;this[_0xff17('0x1c')]=_0x5db758['voiceQueues'];this['campaigns']=_0x5db758[_0xff17('0x1d')];this[_0xff17('0x1e')]=_0x5db758['agents'];this[_0xff17('0x1f')]=_0x5db758['trunks'];this[_0xff17('0x20')]=config[_0xff17('0x20')]||0x2;this[_0xff17('0x21')]={};this['actions']={};this[_0xff17('0x22')]={};this[_0xff17('0x23')]={};this['optionPredictive']={};this[_0xff17('0x24')]={};this[_0xff17('0x25')]={};this['ivrOriginated']={};this[_0xff17('0x26')]={};this[_0xff17('0x27')]={};ami['on'](_0xff17('0x28'),this[_0xff17('0x29')]['bind'](this));ami['on'](_0xff17('0x2a'),this['syncQueueCallerAbandon'][_0xff17('0x2b')](this));ami['on'](_0xff17('0x2c'),this['syncOriginateResponse'][_0xff17('0x2b')](this));ami['on'](_0xff17('0x2d'),this['syncAgentComplete']['bind'](this));ami['on'](_0xff17('0x2e'),this[_0xff17('0x8')]['bind'](this));ami['on'](_0xff17('0x2f'),this[_0xff17('0x30')][_0xff17('0x2b')](this));ami['on'](_0xff17('0x31'),this[_0xff17('0x32')][_0xff17('0x2b')](this));ami['on'](_0xff17('0x33'),this[_0xff17('0x34')][_0xff17('0x2b')](this));ami['on'](_0xff17('0x35'),this[_0xff17('0x36')][_0xff17('0x2b')](this));ami['on'](_0xff17('0x37'),this[_0xff17('0x38')][_0xff17('0x2b')](this));this[_0xff17('0x39')]();this[_0xff17('0x3a')]();}function isNotNull(_0x1e0a3d){return _0x1e0a3d!==null&&!_[_0xff17('0x3b')](_0x1e0a3d);}function checkIsLoggedIn(_0x181454,_0x5c5131){return function(){if(_0x5c5131<=0x0){_0x181454[_0xff17('0x3c')]=_0xff17('0x3d');throw _0x181454[_0xff17('0x3e')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x2f704d){return _0x2f704d;}function checkIsActive(_0x3b6405,_0x400aec){return function(){if(!isActive(_0x400aec)){_0x3b6405['message']=_0xff17('0x3f');throw _0x3b6405['name']+_0xff17('0x40');}};}function checkInterval(_0x3f5979){return function(){if(!isNotNull(_0x3f5979[_0xff17('0x41')])){_0x3f5979[_0xff17('0x3c')]=_0xff17('0x42');throw _0x3f5979[_0xff17('0x3e')]+_0xff17('0x43');}if(!isNotNull(_0x3f5979[_0xff17('0x41')][_0xff17('0x44')])){_0x3f5979['message']=_0xff17('0x42');throw _0x3f5979[_0xff17('0x3e')]+_0xff17('0x43');}if(!isNotNull(_[_0xff17('0x45')](_0x3f5979[_0xff17('0x41')]['Intervals']))){_0x3f5979[_0xff17('0x3c')]=_0xff17('0x42');throw _0x3f5979[_0xff17('0x3e')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x44431f,_0x1fff86,_0x2b7390){return{'action':_0x44431f,'response':_0x1fff86,'message':_0x2b7390,'stack':_0x2b7390};}function myreject(_0x484a63){return function(_0x54d05a){return _0x484a63(msgResponse(_0xff17('0x46'),_0xff17('0x47'),JSON[_0xff17('0x48')](_0x54d05a)));};}function getSeconds(_0x55871c,_0x3be59c){var _0x3db961=moment(_0x55871c)[_0xff17('0x49')](0x0);var _0x4908b8=moment(_0x3be59c)[_0xff17('0x49')](0x0);return _0x3db961[_0xff17('0x4a')](_0x4908b8,_0xff17('0x4b'));}function emit(_0x1108b8,_0xa7fec3,_0x12c8fa){io['to'](_0x1108b8)[_0xff17('0x4c')](_0xa7fec3,_0x12c8fa);}function emitVoiceQueueSummary(_0x584447){if(_0x584447[_0xff17('0x4d')]==='outbound'){var _0x32b00c={'id':_0x584447['id'],'name':_0x584447[_0xff17('0x3e')],'strategy':_0x584447[_0xff17('0x4e')],'answered':_0x584447[_0xff17('0x4f')],'available':_0x584447[_0xff17('0x50')],'loggedIn':_0x584447[_0xff17('0x51')],'pTalking':_0x584447['pTalking'],'sumBillable':_0x584447[_0xff17('0x52')],'sumDuration':_0x584447['sumDuration'],'sumHoldTime':_0x584447['sumHoldTime']||0x0,'talking':_0x584447[_0xff17('0x53')],'total':_0x584447[_0xff17('0x54')],'type':_0x584447[_0xff17('0x4d')],'unmanaged':_0x584447['unmanaged'],'abandoned':_0x584447[_0xff17('0x55')],'waiting':_0x584447[_0xff17('0x56')],'loggedInDb':_0x584447[_0xff17('0x57')],'dialActive':_0x584447[_0xff17('0x58')],'dialMethod':_0x584447[_0xff17('0x59')],'dialOriginateCallerIdName':_0x584447[_0xff17('0x5a')],'dialOriginateCallerIdNumber':_0x584447[_0xff17('0x5b')],'dialOriginateTimeout':_0x584447['dialOriginateTimeout'],'dialPrefix':_0x584447[_0xff17('0x5c')],'outboundAnswerAgiCallsDay':_0x584447['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x584447[_0xff17('0x5d')],'outboundBlacklistCallsDay':_0x584447[_0xff17('0x5e')],'outboundBusyCallsDay':_0x584447['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x584447[_0xff17('0x5f')],'outboundDropCallsDayACS':_0x584447[_0xff17('0x60')],'outboundDropCallsDayCallersExit':_0x584447['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x584447[_0xff17('0x61')],'outboundNoAnswerCallsDay':_0x584447[_0xff17('0x62')],'outboundNoSuchCallsDay':_0x584447[_0xff17('0x63')],'outboundOriginateFailureCallsDay':_0x584447[_0xff17('0x64')],'outboundReCallsDay':_0x584447[_0xff17('0x65')],'outboundRejectCallsDay':_0x584447[_0xff17('0x66')],'outboundUnknownCallsDay':_0x584447[_0xff17('0x67')],'predictiveIntervalAnsweredCalls':_0x584447['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x584447[_0xff17('0x68')],'predictiveIntervalAvgTalktime':_0x584447[_0xff17('0x69')],'predictiveIntervalDroppedCallsCallersExit':_0x584447[_0xff17('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x584447[_0xff17('0x6b')],'predictiveIntervalErlangCalls':_0x584447[_0xff17('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x584447[_0xff17('0x6d')],'predictiveIntervalHitRate':_0x584447[_0xff17('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x584447[_0xff17('0x6f')],'predictiveIntervalPauses':_0x584447['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x584447['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x584447[_0xff17('0x70')],'message':_0x584447['message'],'originated':_0x584447[_0xff17('0x71')],'erlangCalls':_0x584447[_0xff17('0x72')],'erlangCallToSecond':_0x584447[_0xff17('0x73')],'erlangAbandonmentRate':_0x584447['erlangAbandonmentRate'],'erlangBusyFactor':_0x584447[_0xff17('0x74')],'startPredictive':_0x584447['startPredictive'],'startProgressive':_0x584447[_0xff17('0x25')]};if(_0x584447[_0xff17('0x75')]){_0x32b00c[_0xff17('0x75')]={'id':_0x584447[_0xff17('0x75')]['id'],'name':_0x584447['Trunk']['name'],'active':_0x584447[_0xff17('0x75')][_0xff17('0x76')],'callerid':_0x584447['Trunk'][_0xff17('0x77')]};}if(_0x584447['Interval']){_0x32b00c[_0xff17('0x41')]={'id':_0x584447[_0xff17('0x41')]['id'],'name':_0x584447['Interval'][_0xff17('0x3e')]};}var _0x81bfe0=md5(JSON[_0xff17('0x48')](_0x32b00c));if(_0x584447[_0xff17('0x3')]!==_0x81bfe0){_0x584447['md5']=_0x81bfe0;emit(util[_0xff17('0x78')](_0xff17('0x79'),_0x32b00c[_0xff17('0x3e')]),'voice_queue:save',_0x32b00c);}}}function emitCampaignSummary(_0x2a42f2){if(_0x2a42f2[_0xff17('0x4d')]===_0xff17('0x7a')){emit(util[_0xff17('0x78')](_0xff17('0x7b'),_0x2a42f2[_0xff17('0x3e')]),_0xff17('0x7c'),_0x2a42f2);}}function checkGetDataPredictive(_0x37757b){if(isNotNull(_0x37757b)){if(!_[_0xff17('0x45')](_0x37757b)){loggerPredictive[_0xff17('0x7d')](_0xff17('0x7e'));loggerPredictive[_0xff17('0x7d')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37757b[_0xff17('0x70')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x7f'),_0x37757b[_0xff17('0x80')]);loggerPredictive['info'](_0xff17('0x81'),_0x37757b[_0xff17('0x6b')]);loggerPredictive[_0xff17('0x7d')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x37757b[_0xff17('0x6a')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x82'),_0x37757b[_0xff17('0x68')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x83'),_0x37757b[_0xff17('0x69')]);loggerPredictive['info'](_0xff17('0x84'));if(_0x37757b[_0xff17('0x70')]>0x0){if(!_[_0xff17('0x3b')](_0x37757b[_0xff17('0x69')])&&_0x37757b[_0xff17('0x69')]>0x0){return!![];}else{loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_['isUndefined'](_0x37757b['predictiveIntervalAvgHoldtime'])&&_0x37757b[_0xff17('0x68')]>0x0){return!![];}else{loggerPredictive['info'](_0xff17('0x85'));}}else{loggerPredictive[_0xff17('0x7d')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xff17('0x7d')](_0xff17('0x86'));}}else{loggerPredictive[_0xff17('0x7d')](_0xff17('0x86'));}return![];}function mergeDataErlangB(_0x16de07){return function(_0x3b4bc8){loggerPredictive[_0xff17('0x7d')](_0xff17('0x87'));loggerPredictive[_0xff17('0x7d')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3b4bc8[_0xff17('0x72')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x88'),_0x3b4bc8[_0xff17('0x73')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x89'),_0x3b4bc8['erlangAbandonmentRate']);loggerPredictive[_0xff17('0x7d')](_0xff17('0x8a'),_0x3b4bc8['erlangBusyFactor']);loggerPredictive[_0xff17('0x7d')](_0xff17('0x89'),_0x3b4bc8[_0xff17('0x8b')]);loggerPredictive['info']('---------------------------');_[_0xff17('0x8c')](_0x16de07,_0x3b4bc8);};}function getDiff(_0x3a5a26){var _0x3d469c=moment()[_0xff17('0x49')](0x0);var _0x9edd79=moment(_0x3a5a26)[_0xff17('0x49')](0x0);return _0x3d469c['diff'](_0x9edd79,_0xff17('0x4b'));}function ifInterval(_0x5ee8d2,_0x55256f){if(_[_0xff17('0x3b')](_0x55256f)){return![];}if(getDiff(_0x55256f)<_0x5ee8d2*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x275978){if(isNotNull(_0x275978)){if(!_['isUndefined'](_0x275978['startProgressive'])){_0x275978[_0xff17('0x25')]=undefined;loggerPredictive[_0xff17('0x7d')](_0x275978[_0xff17('0x3e')],_0xff17('0x8d'));}if(!_[_0xff17('0x3b')](_0x275978[_0xff17('0x24')])){_0x275978[_0xff17('0x24')]=undefined;loggerPredictive['info'](_0x275978[_0xff17('0x3e')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x275978[_0xff17('0x8e')])){clearInterval(_0x275978[_0xff17('0x8e')]);_0x275978[_0xff17('0x8e')]=undefined;loggerPredictive[_0xff17('0x7d')](_0x275978['name'],_0xff17('0x8f'));}}}function erlangb(_0x470d71,_0x52cbd1){if(_0x52cbd1===0x0){return 0x0;}var _0x3dc09d=0x1;for(var _0x46dea5=0x1;_0x46dea5<=_0x52cbd1;_0x46dea5+=0x1){_0x3dc09d=0x1+_0x3dc09d*_0x46dea5/_0x470d71;}return 0x1/_0x3dc09d;}function isVoiceQueueOutbound(_0x45f876){return _0x45f876===_0xff17('0x90');}function isNotPreview(_0x2df5){return _0x2df5!=='preview';}function isCampaignIvr(_0x2df29e){return _0x2df29e===_0xff17('0x7a');}function getCallerId(_0x2114b9,_0x4d6607,_0x106430){if(!_['isUndefined'](_0x106430)&&_0xff17('0x91')===typeof _0x106430&&!_[_0xff17('0x45')](_0x106430)){if(!_['isUndefined'](_0x4d6607)&&'string'===typeof _0x4d6607&&!_[_0xff17('0x45')](_0x4d6607)){return util[_0xff17('0x78')](_0xff17('0x92'),_0x4d6607,_0x106430);}return util[_0xff17('0x78')](_0xff17('0x92'),_0x106430,_0x106430);}if(!_['isUndefined'](_0x2114b9)&&_0xff17('0x91')===typeof _0x2114b9&&!_[_0xff17('0x45')](_0x2114b9)){return _0x2114b9;}return _0xff17('0x93');}function loggerCatchQueueSummary(_0x342aa5,_0x538bbc){return function(_0x4b7632){freeVariablesPredictive(_0x538bbc);emitVoiceQueueSummary(_0x538bbc);emitCampaignSummary(_0x538bbc);loggerSyncQueueSummary[_0xff17('0x94')](_0x342aa5,util[_0xff17('0x95')](_0x4b7632,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x458e78,_0x460eb2){return function(_0xc56183){loggerPredictive[_0xff17('0x94')](_0x460eb2[_0xff17('0x3e')],_0x458e78);loggerPredictive[_0xff17('0x94')](_0xc56183[_0xff17('0x96')]);freeVariablesPredictive(_0x460eb2);};}function loggerCatch(_0x3a613f){return function(_0x4f357b){logger[_0xff17('0x94')](_0x3a613f,util[_0xff17('0x95')](_0x4f357b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x20b329){return _0x20b329&&!_[_0xff17('0x3b')](_0x20b329)&&_0x20b329[_0xff17('0x97')]>0x0;}function decremetOriginate(_0x1d8fdf){if(!_[_0xff17('0x3b')](_0x1d8fdf)&&_0x1d8fdf!==null){if(_0x1d8fdf[_0xff17('0x98')](_0xff17('0x71'))){if(_0x1d8fdf[_0xff17('0x71')]>0x0){_0x1d8fdf[_0xff17('0x71')]-=0x1;}else{logger[_0xff17('0x94')](_0xff17('0x99'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4a4988,_0x40e43e,_0x1c7d19){if(_0x40e43e>_0x1c7d19){for(var _0x2cdb95=0x0;_0x2cdb95<_0x40e43e-_0x1c7d19;_0x2cdb95+=0x1){decremetOriginate(_0x4a4988);}}}function loggerGetContactDialer(_0xc69cc8,_0x59f275,_0x107013){return function(_0x175e01){checkContactLowerLimitOriginate(_0x59f275,_0x107013,0x0);logger['error'](_0xc69cc8,util[_0xff17('0x95')](_0x175e01,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2f9483){return function(_0x4ccd6d){if(isNotNull(_0x4ccd6d)&&isNotNull(_0x4ccd6d[0x0])){if(_0x4ccd6d[0x0]['contactsRescheduled']>0x0){_0x2f9483[_0xff17('0x3c')]=_0xff17('0x9a');logger['info']('[getContactDialer2][ReScheduled]'+_0x2f9483[_0xff17('0x3e')],_0x4ccd6d[0x0][_0xff17('0x9b')],_0xff17('0x9c'));}else{_0x2f9483[_0xff17('0x3c')]=_0xff17('0x9d');logger[_0xff17('0x7d')](_0xff17('0x9e')+_0x2f9483[_0xff17('0x3e')]);}}};}function notSendMessagesQueue(_0x5f9c37){if(_0x5f9c37[_0xff17('0x9f')]){freeVariablesPredictive(_0x5f9c37);if(_0x5f9c37[_0xff17('0x71')]===0x0&&_0x5f9c37[_0xff17('0x53')]===0x0&&_0x5f9c37[_0xff17('0x56')]===0x0&&(_0x5f9c37[_0xff17('0xa0')]||0x0)===0x0){_0x5f9c37[_0xff17('0x9f')]=![];_0x5f9c37[_0xff17('0x50')]=0x0;_0x5f9c37[_0xff17('0x3c')]='NOT_ACTIVE';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x5f9c37[_0xff17('0x3e')],_0xff17('0xa1'));}else{_0x5f9c37[_0xff17('0x3c')]=_0xff17('0xa2');loggerSyncQueueSummary[_0xff17('0x94')](_0xff17('0xa3'),_0x5f9c37[_0xff17('0x3e')],_0xff17('0xa4'));}emitVoiceQueueSummary(_0x5f9c37);}}function notSendMessagesCampaign(_0xe688b2){if(_0xe688b2[_0xff17('0x9f')]){if(_0xe688b2[_0xff17('0x71')]===0x0){_0xe688b2[_0xff17('0x9f')]=![];_0xe688b2[_0xff17('0x3c')]=_0xff17('0x3f');loggerSyncQueueSummary['error'](_0xff17('0xa5'),_0xe688b2['name'],'is\x20not\x20active');}else{_0xe688b2[_0xff17('0x3c')]=_0xff17('0xa2');loggerSyncQueueSummary[_0xff17('0x94')](_0xff17('0xa5'),_0xe688b2[_0xff17('0x3e')],_0xff17('0xa4'));}emitCampaignSummary(_0xe688b2);}}function createObjHistory(_0x27cade,_0x40deaa,_0x11cfa5,_0x3dc0a4,_0xe49400){_0x27cade[_0xff17('0x3c')]=_0x11cfa5;var _0x26b831=new Action(_0x27cade,_0x40deaa);var _0x24f710=new History(_0x26b831);_0x24f710[_0xff17('0xa6')]=_0x3dc0a4;_0x24f710['statedesc']=_0xe49400;_0x24f710[_0xff17('0xa7')]=_0x26b831[_0xff17('0xa8')];return _0x24f710;}Dialer[_0xff17('0x19')][_0xff17('0x3a')]=function(){var _0x1bba90=this;setInterval(function(){_0x1bba90[_0xff17('0xa9')](_0x1bba90['uniqueId'],'[uniqueid]');_0x1bba90[_0xff17('0xa9')](_0x1bba90['actions'],_0xff17('0xaa'));},0x32c8);};Dialer[_0xff17('0x19')]['clearZombieChannels']=function(_0x265b58,_0xd629f2){var _0x47836a=this;for(var _0x3c1d15 in _0x265b58){if(_0x265b58[_0xff17('0x98')](_0x3c1d15)){this[_0xff17('0xab')][_0xff17('0x1a')](function(){if(!_[_0xff17('0xac')](_0x265b58[_0x3c1d15])){return ami[_0xff17('0xad')]({'action':'status','channel':_0x265b58[_0x3c1d15]['channel']})[_0xff17('0xae')](function(_0x1c7758){if(_0x1c7758['message']===_0xff17('0xaf')){setTimeout(function(){if(_0x265b58[_0x3c1d15]&&_0x265b58[_0x3c1d15][_0xff17('0x4d')]!==_0xff17('0x7a')){_0x47836a['updateOriginated'](_0x47836a[_0xff17('0x1c')][_0x265b58[_0x3c1d15][_0xff17('0xb0')]]);logger[_0xff17('0x94')](_0xff17('0xb1'),_0xd629f2,_0x3c1d15,_0x265b58[_0x3c1d15][_0xff17('0xb0')]);delete _0x265b58[_0x3c1d15];}if(_0x265b58[_0x3c1d15]&&_0x265b58[_0x3c1d15][_0xff17('0x4d')]==='ivr'){_0x47836a[_0xff17('0xb2')](_0x47836a[_0xff17('0x1d')][_0x265b58[_0x3c1d15][_0xff17('0xb0')]]);logger[_0xff17('0x94')]('[Dialer][checkChannel][ivr]',_0xd629f2,_0x3c1d15,_0x265b58[_0x3c1d15][_0xff17('0xb0')]);delete _0x265b58[_0x3c1d15];}},0x2328);}});}});}}};Dialer[_0xff17('0x19')][_0xff17('0xb3')]=function(_0x354e22){return BPromise[_0xff17('0xb4')]()[_0xff17('0xb5')](cmHopper[_0xff17('0xb3')](_0x354e22))[_0xff17('0xae')](loggerCatch(_0xff17('0xb6')));};Dialer['prototype'][_0xff17('0xb7')]=function(_0xab9bd5){return BPromise[_0xff17('0xb4')]()[_0xff17('0xb5')](cmHopperBlack[_0xff17('0xb7')](_0xab9bd5))[_0xff17('0xae')](loggerCatch(_0xff17('0xb8')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x40cb2f){return BPromise[_0xff17('0xb4')]()[_0xff17('0xb5')](cmHopperBlack[_0xff17('0xb9')](_0x40cb2f))['catch'](loggerCatch(_0xff17('0xba')));};Dialer[_0xff17('0x19')][_0xff17('0xbb')]=function(_0x55ec43){return BPromise[_0xff17('0xb4')]()['then'](cmHopperHistory[_0xff17('0xbc')](_0x55ec43))[_0xff17('0xae')](loggerCatch(_0xff17('0xbd')));};Dialer[_0xff17('0x19')]['rescheduleContact']=function(_0x2c0852){return BPromise[_0xff17('0xb4')]()[_0xff17('0xb5')](cmHopper['rescheduleContact'](_0x2c0852))[_0xff17('0xae')](loggerCatch(_0xff17('0xbe')));};Dialer[_0xff17('0x19')][_0xff17('0xbf')]=function(_0x56ba68,_0x3506bc,_0x1dae11){return BPromise[_0xff17('0xb4')]()[_0xff17('0xb5')](cmHopper[_0xff17('0xbf')](_0x56ba68,_0x3506bc,_0x1dae11))['catch'](loggerCatch(_0xff17('0xc0')));};Dialer[_0xff17('0x19')][_0xff17('0xc1')]=function(_0xfe83de,_0x495a3a,_0x542de8,_0x588d55){return BPromise[_0xff17('0xb4')]()['then'](cmHopper[_0xff17('0xc1')](_0xfe83de,_0x495a3a,_0x542de8,_0x588d55))[_0xff17('0xae')](loggerCatch(_0xff17('0xc2')));};Dialer['prototype']['getContactDialerIvr']=function(_0x2b5912,_0x1ab040,_0x3fb337){return BPromise['resolve']()[_0xff17('0xb5')](cmHopper['getContactDialerIvr'](_0x2b5912,_0x1ab040,_0x3fb337))[_0xff17('0xae')](loggerCatch(_0xff17('0xc2')));};Dialer[_0xff17('0x19')][_0xff17('0xc3')]=function(_0x2e1035){return BPromise[_0xff17('0xb4')]()[_0xff17('0xb5')](voiceQueueRt[_0xff17('0xc3')](_0x2e1035))[_0xff17('0xae')](loggerCatch(_0xff17('0xc4')));};Dialer[_0xff17('0x19')][_0xff17('0xc5')]=function(_0xad1112){return BPromise[_0xff17('0xb4')]()['then'](cmHopper[_0xff17('0xc5')](_0xad1112))['catch'](loggerCatch(_0xff17('0xc6')));};Dialer[_0xff17('0x19')][_0xff17('0xc7')]=function(_0x552868){return BPromise['resolve']()[_0xff17('0xb5')](cmHopperHistory[_0xff17('0xc7')](_0x552868))['catch'](loggerCatch(_0xff17('0xc8')));};Dialer[_0xff17('0x19')]['updateOriginated']=function(_0x1e97bc){if(!_[_0xff17('0x3b')](_0x1e97bc)&&_0x1e97bc!==null){if(_0x1e97bc[_0xff17('0x98')](_0xff17('0x71'))){if(_0x1e97bc[_0xff17('0x71')]>0x0){_0x1e97bc[_0xff17('0x71')]-=0x1;}else{logger[_0xff17('0x94')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xff17('0x94')](_0xff17('0xc9'));}};Dialer['prototype'][_0xff17('0xca')]=function(_0x56d313,_0x1dcc49){var _0x46ea0a=this;return function(_0x834bf6){_0x46ea0a['updateOriginated'](_0x1dcc49);logger['error'](_0x56d313,util[_0xff17('0x95')](_0x834bf6,{'showHidden':![],'depth':null}));};};Dialer[_0xff17('0x19')][_0xff17('0xcb')]=function(_0x1f6403,_0x92e8bf,_0x3369d0){var _0x2cd476={'state':0x19,'statedesc':_0xff17('0xcc')};this[_0xff17('0xb2')](_0x92e8bf);this[_0xff17('0xcd')](_[_0xff17('0x8c')](_0x2cd476,_[_0xff17('0xce')](_0x3369d0,['ContactId',_0xff17('0xcf'),_0xff17('0xd0'),'VoiceQueueId',_0xff17('0xd1')])),_0xff17('0xd2'),'[emptyContact]');logger[_0xff17('0x94')](_0x1f6403);};Dialer['prototype']['isSuccess']=function(_0x2ebab3){return _0x2ebab3===_0xff17('0xd3');};Dialer[_0xff17('0x19')][_0xff17('0xd4')]=function(_0x2ca9e4){return!_[_0xff17('0x3b')](_0x2ca9e4)&&_0x2ca9e4&&!_[_0xff17('0x3b')](_0x2ca9e4[_0xff17('0x3e')])&&!_[_0xff17('0x3b')](_0x2ca9e4[_0xff17('0x76')])&&_0x2ca9e4['active']&&(this[_0xff17('0x1f')][util['format'](_0xff17('0xd5'),_0x2ca9e4[_0xff17('0x3e')])][_0xff17('0xd6')]===_0xff17('0xd7')||this[_0xff17('0x1f')][util[_0xff17('0x78')]('SIP/%s',_0x2ca9e4[_0xff17('0x3e')])][_0xff17('0xd6')]==='unmonitored');};Dialer[_0xff17('0x19')][_0xff17('0xcd')]=function(_0x309edd,_0x4fcaf2,_0x437909){this['createHistory'](_0x309edd)[_0xff17('0xae')](loggerCatch(_0x4fcaf2));this[_0xff17('0xc5')](_0x309edd)['catch'](loggerCatch(_0x437909));};Dialer[_0xff17('0x19')][_0xff17('0x34')]=function(_0x784472){var _0x266f57=this['uniqueId'][_0x784472[_0xff17('0xd8')]];var _0x335b3e;if(!_[_0xff17('0xac')](_0x784472)&&!_[_0xff17('0xac')](_0x784472['variable'])&&!_[_0xff17('0xac')](_0x784472['variable'][_0xff17('0xd9')])&&_0x784472[_0xff17('0xda')]===_0xff17('0xdb')&&_0x266f57){if(_0x266f57[_0xff17('0x4d')]!==_0xff17('0x7a')&&this['voiceQueues'][_0x266f57['queue']][_0xff17('0xdc')]&&_0x784472['value']===_0xff17('0xdd')){delete this[_0xff17('0x23')][_0x784472[_0xff17('0xd8')]];this['updateOriginated'](this[_0xff17('0x1c')][_0x266f57[_0xff17('0xb0')]]);this['voiceQueues'][_0x266f57[_0xff17('0xb0')]][_0xff17('0x5d')]+=0x1;this[_0xff17('0x1c')][_0x266f57[_0xff17('0xb0')]]['outboundAnswerAgiCallsDay']+=0x1;_0x335b3e=new Hangup(_0x266f57,_0x784472);_0x335b3e['state']=0x12;_0x335b3e[_0xff17('0xde')]=_0xff17('0xdf');_0x335b3e[_0xff17('0xe0')]='AMD';this[_0xff17('0xcd')](_0x335b3e,_0xff17('0xe1'),'[syncHangupInAMD]');}if(_0x266f57[_0xff17('0x4d')]!==_0xff17('0x7a')&&this['voiceQueues'][_0x266f57[_0xff17('0xb0')]][_0xff17('0xdc')]&&_0x784472[_0xff17('0xe2')]===_0xff17('0xe3')){var _0x1340e8=this;return new BPromise(function(_0x5d656f,_0x9a874f){delete _0x1340e8[_0xff17('0x23')][_0x784472[_0xff17('0xd8')]];_0x1340e8[_0xff17('0xb2')](_0x1340e8[_0xff17('0x1c')][_0x266f57[_0xff17('0xb0')]]);_0x1340e8['voiceQueues'][_0x266f57['queue']]['outboundAnswerCallsDay']+=0x1;_0x1340e8[_0xff17('0x1c')][_0x266f57[_0xff17('0xb0')]][_0xff17('0xe4')]+=0x1;var _0x689be3=_0x1340e8[_0xff17('0x1c')][_0x266f57['queue']];var _0x5777b6=new Hangup(_0x266f57,_0x784472);_0x5777b6[_0xff17('0xa6')]=0x13;_0x5777b6[_0xff17('0xde')]='Machine';_0x5777b6[_0xff17('0xe0')]='AMD';_0x5777b6['countmachineretry']+=0x1;_0x5777b6['countglobal']+=0x1;_0x5777b6[_0xff17('0xe5')]=!![];_0x1340e8[_0xff17('0xc7')](_0x5777b6)[_0xff17('0xae')](loggerCatch(_0xff17('0xe6')));if(_0x5777b6[_0xff17('0xe7')]+_0x5777b6['countcongestionretry']+_0x5777b6[_0xff17('0xe8')]+_0x5777b6[_0xff17('0xe9')]+_0x5777b6[_0xff17('0xea')]+_0x5777b6[_0xff17('0xeb')]+_0x5777b6[_0xff17('0xec')]+_0x5777b6[_0xff17('0xed')]>=_0x689be3[_0xff17('0xee')]){_0x1340e8[_0xff17('0xef')](_0x5777b6,_0x5d656f,_0x9a874f,_0xff17('0xf0'));}else{if(_0x5777b6[_0xff17('0xec')]>=_0x689be3[_0xff17('0xf1')]){_0x1340e8[_0xff17('0xf2')](_0x5777b6,_0x5d656f,_0x9a874f,_0xff17('0xf3'));}else{_0x1340e8[_0xff17('0xf4')]({'active':![],'countmachineretry':_0x5777b6[_0xff17('0xec')],'scheduledat':moment()[_0xff17('0xf5')](_0x689be3[_0xff17('0xf6')],_0xff17('0xf7'))[_0xff17('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5777b6[_0xff17('0xf8')],'ListId':_0x5777b6['ListId'],'VoiceQueueId':_0x5777b6[_0xff17('0xf9')]||undefined,'CampaignId':_0x5777b6[_0xff17('0xd1')]||undefined})['catch'](loggerCatch(_0xff17('0xfa')));_0x5d656f({'reschedule':0x1});}}});}if(_0x266f57['type']==='ivr'&&this[_0xff17('0x1d')][_0x266f57['queue']][_0xff17('0xdc')]&&_0x784472[_0xff17('0xe2')]===_0xff17('0xdd')){delete this[_0xff17('0x23')][_0x784472[_0xff17('0xd8')]];this[_0xff17('0xb2')](this[_0xff17('0x1d')][_0x266f57['queue']]);_0x335b3e=new Hangup(_0x266f57,_0x784472);_0x335b3e[_0xff17('0xa6')]=0x12;_0x335b3e[_0xff17('0xde')]='HangupInAMD';_0x335b3e[_0xff17('0xe0')]='AMD';this['saveInDb'](_0x335b3e,_0xff17('0xfb'),_0xff17('0xfc'));}if(_0x266f57[_0xff17('0x4d')]==='ivr'&&this[_0xff17('0x1d')][_0x266f57[_0xff17('0xb0')]][_0xff17('0xdc')]&&_0x784472['value']===_0xff17('0xe3')){var _0x1340e8=this;return new BPromise(function(_0x3422c5,_0x39e4ba){delete _0x1340e8[_0xff17('0x23')][_0x784472[_0xff17('0xd8')]];_0x1340e8[_0xff17('0xb2')](_0x1340e8[_0xff17('0x1d')][_0x266f57[_0xff17('0xb0')]]);_0x1340e8[_0xff17('0x1d')][_0x266f57[_0xff17('0xb0')]][_0xff17('0x5d')]+=0x1;_0x1340e8[_0xff17('0x1d')][_0x266f57[_0xff17('0xb0')]][_0xff17('0xe4')]+=0x1;var _0x37cbcd=_0x1340e8[_0xff17('0x1d')][_0x266f57[_0xff17('0xb0')]];var _0x912b8e=new Hangup(_0x266f57,_0x784472);_0x912b8e[_0xff17('0xa6')]=0x13;_0x912b8e['statedesc']=_0xff17('0xfd');_0x912b8e[_0xff17('0xe0')]='AMD';_0x912b8e[_0xff17('0xec')]+=0x1;_0x912b8e[_0xff17('0xfe')]+=0x1;_0x912b8e[_0xff17('0xe5')]=!![];_0x1340e8['createHistory'](_0x912b8e)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x912b8e[_0xff17('0xe7')]+_0x912b8e[_0xff17('0xff')]+_0x912b8e[_0xff17('0xe8')]+_0x912b8e['countnosuchnumberretry']+_0x912b8e[_0xff17('0xea')]+_0x912b8e['countabandonedretry']+_0x912b8e[_0xff17('0xec')]+_0x912b8e['countagentrejectretry']>=_0x37cbcd[_0xff17('0xee')]){_0x1340e8[_0xff17('0xef')](_0x912b8e,_0x3422c5,_0x39e4ba,_0xff17('0xf0'));}else{if(_0x912b8e[_0xff17('0xec')]>=_0x37cbcd[_0xff17('0xf1')]){_0x1340e8[_0xff17('0xf2')](_0x912b8e,_0x3422c5,_0x39e4ba,_0xff17('0xf3'));}else{_0x1340e8['rescheduleContact']({'active':![],'countmachineretry':_0x912b8e['countmachineretry'],'scheduledat':moment()[_0xff17('0xf5')](_0x37cbcd[_0xff17('0xf6')],'minutes')[_0xff17('0x78')](_0xff17('0x100')),'ContactId':_0x912b8e['ContactId'],'ListId':_0x912b8e['ListId'],'VoiceQueueId':_0x912b8e[_0xff17('0xf9')]||undefined,'CampaignId':_0x912b8e[_0xff17('0xd1')]||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0xfa')));_0x3422c5({'reschedule':0x1});}}});}}};Dialer[_0xff17('0x19')]['syncHangup']=function(_0x432d46){var _0x1f158d=this[_0xff17('0x23')][_0x432d46['uniqueid']];var _0x827e87=this;var _0x441155;if(_0x1f158d&&_0x1f158d['type']===_0xff17('0x7a')){delete this[_0xff17('0x23')][_0x432d46[_0xff17('0xd8')]];this['updateOriginated'](this[_0xff17('0x1d')][_0x1f158d[_0xff17('0xb0')]]);this[_0xff17('0x1d')][_0x1f158d['queue']][_0xff17('0x101')]+=0x1;_0x441155=new Hangup(_0x1f158d,_0x432d46);this[_0xff17('0xc7')](_0x441155)[_0xff17('0xae')](loggerCatch(_0xff17('0x102')));this[_0xff17('0xc5')](_0x441155)['catch'](loggerCatch(_0xff17('0x103')));}if(_0x1f158d&&_0x1f158d[_0xff17('0x4d')]!==_0xff17('0x7a')&&isNotNull(this['voiceQueues'][_0x1f158d[_0xff17('0xb0')]][_0xff17('0x104')])){delete this['uniqueId'][_0x432d46[_0xff17('0xd8')]];this['updateOriginated'](this[_0xff17('0x1c')][_0x1f158d[_0xff17('0xb0')]]);this[_0xff17('0x1c')][_0x1f158d[_0xff17('0xb0')]]['outboundAnswerCallsDay']+=0x1;this[_0xff17('0x1c')][_0x1f158d[_0xff17('0xb0')]][_0xff17('0xe4')]+=0x1;_0x441155=new Hangup(_0x1f158d,_0x432d46);_0x441155[_0xff17('0xa6')]=0x10;_0x441155[_0xff17('0xde')]=_0xff17('0x105');_0x441155[_0xff17('0xe0')]=_0xff17('0x106');this['createHistory'](_0x441155)['catch'](loggerCatch(_0xff17('0x102')));this[_0xff17('0xc5')](_0x441155)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x1f158d&&_0x1f158d[_0xff17('0x4d')]!==_0xff17('0x7a')&&!isNotNull(this[_0xff17('0x1c')][_0x1f158d[_0xff17('0xb0')]][_0xff17('0x104')])){delete this['uniqueId'][_0x432d46['uniqueid']];this[_0xff17('0xb2')](this[_0xff17('0x1c')][_0x1f158d[_0xff17('0xb0')]]);this['voiceQueues'][_0x1f158d['queue']]['outboundUnknownCallsDay']+=0x1;_0x441155=new Hangup(_0x1f158d,_0x432d46);_0x441155['state']=0xc;_0x441155[_0xff17('0xde')]=_0x432d46[_0xff17('0x107')];_0x441155[_0xff17('0xe0')]=_0xff17('0x108');this[_0xff17('0xc7')](_0x441155)[_0xff17('0xae')](loggerCatch(_0xff17('0x102')));this[_0xff17('0xc5')](_0x441155)[_0xff17('0xae')](loggerCatch(_0xff17('0x103')));}};Dialer[_0xff17('0x19')][_0xff17('0x109')]=function(_0x1b0ac0){var _0x5e3ed2=this[_0xff17('0x23')][_0x1b0ac0[_0xff17('0xd8')]];var _0x30f935=this;if(this[_0xff17('0x1c')][_0x1b0ac0[_0xff17('0xb0')]]){if(_0x5e3ed2&&_0x5e3ed2[_0xff17('0x4d')]!==_0xff17('0x7a')){delete this[_0xff17('0x23')][_0x1b0ac0[_0xff17('0xd8')]];this[_0xff17('0x1c')][_0x1b0ac0[_0xff17('0xb0')]][_0xff17('0x5d')]+=0x1;var _0x3205d0=new AgentComplete(_0x5e3ed2,_0x1b0ac0);if(_0x1b0ac0[_0xff17('0x10a')]==='agent'){_0x3205d0[_0xff17('0x10b')]=this['voiceQueues'][_0x1b0ac0[_0xff17('0xb0')]]['dialQueueProject2']&&this['voiceQueues'][_0x1b0ac0[_0xff17('0xb0')]][_0xff17('0x10c')]?moment()[_0xff17('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0xff17('0xc7')](_0x3205d0)[_0xff17('0xae')](loggerCatch('[syncAgentComplete][createHistory]'));this[_0xff17('0xc5')](_0x3205d0)[_0xff17('0xae')](loggerCatch(_0xff17('0x10d')));}}};Dialer[_0xff17('0x19')]['syncAgentConnect']=function(_0x3b14ee){if(this[_0xff17('0x1c')][_0x3b14ee['queue']]){if(this[_0xff17('0x23')][_0x3b14ee[_0xff17('0xd8')]]&&this['uniqueId'][_0x3b14ee[_0xff17('0xd8')]][_0xff17('0x4d')]!==_0xff17('0x7a')){this[_0xff17('0xb2')](this[_0xff17('0x1c')][_0x3b14ee[_0xff17('0xb0')]]);this[_0xff17('0x23')][_0x3b14ee['uniqueid']][_0xff17('0x10e')]=moment()[_0xff17('0x78')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xff17('0x19')][_0xff17('0x10f')]=function(_0xd8f441){this[_0xff17('0xc7')](_0xd8f441)['catch'](loggerCatch(_0xff17('0x110')));this[_0xff17('0xc5')](_0xd8f441)[_0xff17('0xae')](loggerCatch(_0xff17('0x111')));};Dialer['prototype'][_0xff17('0x112')]=function(_0x10c1c9){var _0x50a1d8=this['uniqueId'][_0x10c1c9[_0xff17('0xd8')]];var _0x30b279=this;if(this[_0xff17('0x1c')][_0x10c1c9['queue']]){if(_0x50a1d8&&_0x50a1d8[_0xff17('0x4d')]!==_0xff17('0x7a')){delete this['uniqueId'][_0x10c1c9[_0xff17('0xd8')]];this[_0xff17('0xb2')](this['voiceQueues'][_0x10c1c9[_0xff17('0xb0')]]);_0x50a1d8[_0xff17('0x113')]=moment()['format'](_0xff17('0x100'));var _0x5dcf90=new QueueCallerAbandon(_0x50a1d8,_0x10c1c9);if(getSeconds(_0x50a1d8['droptime'],_0x50a1d8[_0xff17('0x114')])>=_0x50a1d8[_0xff17('0x115')]){this['voiceQueues'][_0x10c1c9[_0xff17('0xb0')]][_0xff17('0x6b')]+=0x1;this['voiceQueues'][_0x10c1c9['queue']][_0xff17('0x61')]+=0x1;this['voiceQueues'][_0x10c1c9['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x5dcf90['state']=0xa;_0x5dcf90[_0xff17('0xde')]=_0xff17('0x116');_0x5dcf90[_0xff17('0x117')]=_0xff17('0x118');_0x5dcf90[_0xff17('0x10b')]=this[_0xff17('0x1c')][_0x10c1c9[_0xff17('0xb0')]]['dialQueueProject2']?moment()[_0xff17('0x78')](_0xff17('0x100')):undefined;_0x5dcf90['countdropretry']+=0x1;_0x5dcf90[_0xff17('0xfe')]+=0x1;if(_0x5dcf90[_0xff17('0xea')]>=this[_0xff17('0x1c')][_0x10c1c9[_0xff17('0xb0')]][_0xff17('0x119')]){this[_0xff17('0x10f')](_0x5dcf90);}else{this[_0xff17('0xf4')]({'active':![],'countdropretry':_0x5dcf90[_0xff17('0xea')],'scheduledat':moment()[_0xff17('0xf5')](this[_0xff17('0x1c')][_0x10c1c9[_0xff17('0xb0')]]['dialDropRetryFrequency'],_0xff17('0xf7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x50a1d8[_0xff17('0xf8')],'ListId':_0x50a1d8[_0xff17('0xcf')],'VoiceQueueId':_0x50a1d8[_0xff17('0xf9')]||undefined,'CampaignId':_0x50a1d8[_0xff17('0xd1')]||undefined})['catch'](loggerCatch(_0xff17('0x11a')));var _0x33776d=new History(_0x5dcf90);_0x33776d[_0xff17('0xa6')]=0xa;_0x33776d[_0xff17('0xde')]=_0xff17('0x116');_0x33776d[_0xff17('0xa8')]=moment()[_0xff17('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x33776d[_0xff17('0xa7')]=_0x33776d[_0xff17('0xa8')];_0x33776d[_0xff17('0x11b')]=_0x5dcf90['calleridname'];_0x33776d[_0xff17('0x11c')]=_0x5dcf90[_0xff17('0x11c')];this['createHistory'](_0x33776d)[_0xff17('0xae')](loggerCatch(_0xff17('0x11d')));}}else{this[_0xff17('0x1c')][_0x10c1c9[_0xff17('0xb0')]][_0xff17('0x6a')]+=0x1;this[_0xff17('0x1c')][_0x10c1c9[_0xff17('0xb0')]][_0xff17('0x11e')]+=0x1;_0x5dcf90[_0xff17('0xa6')]=0xb;_0x5dcf90[_0xff17('0xde')]=_0xff17('0x11f');_0x5dcf90['dropreason']=_0xff17('0x120');_0x5dcf90[_0xff17('0xeb')]+=0x1;_0x5dcf90[_0xff17('0xfe')]+=0x1;if(_0x5dcf90['countabandonedretry']>=this[_0xff17('0x1c')][_0x10c1c9[_0xff17('0xb0')]][_0xff17('0x121')]){this[_0xff17('0x10f')](_0x5dcf90);}else{this[_0xff17('0xf4')]({'active':![],'countabandonedretry':_0x5dcf90[_0xff17('0xeb')],'scheduledat':moment()[_0xff17('0xf5')](this['voiceQueues'][_0x10c1c9[_0xff17('0xb0')]]['dialAbandonedRetryFrequency'],_0xff17('0xf7'))[_0xff17('0x78')](_0xff17('0x100')),'ContactId':_0x50a1d8['ContactId'],'ListId':_0x50a1d8[_0xff17('0xcf')],'VoiceQueueId':_0x50a1d8['VoiceQueueId']||undefined,'CampaignId':_0x50a1d8['CampaignId']||undefined})[_0xff17('0xae')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x33776d=new History(_0x5dcf90);_0x33776d[_0xff17('0xa6')]=0xb;_0x33776d[_0xff17('0xde')]=_0xff17('0x11f');_0x33776d[_0xff17('0xa8')]=moment()[_0xff17('0x78')](_0xff17('0x100'));_0x33776d['endtime']=_0x33776d['starttime'];_0x33776d['calleridname']=_0x5dcf90[_0xff17('0x11b')];_0x33776d[_0xff17('0x11c')]=_0x5dcf90[_0xff17('0x11c')];this[_0xff17('0xc7')](_0x33776d)['catch'](loggerCatch(_0xff17('0x122')));}}}}};Dialer[_0xff17('0x19')]['syncNewExten']=function(_0x4459d0){if(this[_0xff17('0x123')][_0x4459d0[_0xff17('0xd8')]]){this[_0xff17('0x123')][_0x4459d0['uniqueid']][_0xff17('0x124')]=_0x4459d0['channel'];}if(this[_0xff17('0x23')][_0x4459d0[_0xff17('0xd8')]]){this[_0xff17('0x23')][_0x4459d0['uniqueid']]['channel']=_0x4459d0[_0xff17('0x124')];}};Dialer[_0xff17('0x19')][_0xff17('0x36')]=function(_0x453fe9){if(strategy[this[_0xff17('0x1c')][this[_0xff17('0x123')][_0x453fe9[_0xff17('0x125')]][_0xff17('0xb0')]]['strategy']]==='roundrobin'){if(this['actions'][_0x453fe9[_0xff17('0x125')]]&&_[_0xff17('0xac')](this[_0xff17('0x123')][_0x453fe9[_0xff17('0x125')]][_0xff17('0x126')])&&_0x453fe9[_0xff17('0xd6')]==='1'&&_0x453fe9['paused']==='0'){if(this[_0xff17('0x1e')][_0x453fe9[_0xff17('0x127')]]){if(!this[_0xff17('0x1e')][_0x453fe9[_0xff17('0x127')]][_0xff17('0x126')]){this['agents'][_0x453fe9['stateinterface']]['locked']=!![];this[_0xff17('0x123')][_0x453fe9['actionid']][_0xff17('0x126')]=!![];this['actions'][_0x453fe9[_0xff17('0x125')]][_0xff17('0x127')]=_0x453fe9['stateinterface'];}}}}else if((strategy[this['voiceQueues'][this[_0xff17('0x123')][_0x453fe9[_0xff17('0x125')]][_0xff17('0xb0')]][_0xff17('0x4e')]]||_0xff17('0x17'))==='rrmemory'){if(this[_0xff17('0x123')][_0x453fe9[_0xff17('0x125')]]){if(this[_0xff17('0x1e')][_0x453fe9[_0xff17('0x127')]]){this['actions'][_0x453fe9[_0xff17('0x125')]][_0xff17('0x127')]=_0x453fe9[_0xff17('0x127')];if(_['isNil'](this[_0xff17('0x26')][this[_0xff17('0x123')][_0x453fe9[_0xff17('0x125')]]['queue']])){this['queueBooked'][this['actions'][_0x453fe9[_0xff17('0x125')]][_0xff17('0xb0')]]=[];}this[_0xff17('0x26')][this[_0xff17('0x123')][_0x453fe9[_0xff17('0x125')]][_0xff17('0xb0')]][_0xff17('0x128')](_[_0xff17('0x8c')](_[_0xff17('0xce')](this['actions'][_0x453fe9[_0xff17('0x125')]],[_0xff17('0x129'),'stateinterface']),{'status':_0x453fe9[_0xff17('0xd6')],'paused':_0x453fe9[_0xff17('0x12a')]}));}}}};function unlockQueueStatus(_0x5d5387,_0x5600c5){setTimeout(function(){if(_[_0xff17('0x3b')](_0x5d5387[_0xff17('0x12b')])){loggerBooked[_0xff17('0x94')](_0xff17('0x12c'),_0x5600c5);}_0x5d5387[_0xff17('0x12b')]=!![];loggerBooked[_0xff17('0x7d')](_0xff17('0x12d'),_0x5600c5,JSON[_0xff17('0x48')](_['pick'](_0x5d5387,[_0xff17('0x3e'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xff17('0x19')][_0xff17('0x38')]=function(_0x783ad1){var _0x389f42=this;var _0x17bda2=_0x389f42['voiceQueues'][_0x389f42['actions'][_0x783ad1['actionid']][_0xff17('0xb0')]];if(strategy[this['voiceQueues'][this[_0xff17('0x123')][_0x783ad1['actionid']]['queue']]['strategy']]===_0xff17('0x18')){if(this[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]]&&this[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]][_0xff17('0x127')]){this['preview']['run'](this[_0xff17('0x123')][_0x783ad1['actionid']][_0xff17('0x129')],this[_0xff17('0x123')][_0x783ad1['actionid']][_0xff17('0x127')])[_0xff17('0xae')](function(_0x369bfe){logger['error'](_0xff17('0x12e'),util[_0xff17('0x95')](_0x369bfe,{'showHidden':![],'depth':null}));})['finally'](function(){_0x389f42[_0xff17('0xb2')](_0x389f42[_0xff17('0x1c')][_0x389f42[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]]['queue']]);_0x389f42[_0xff17('0x1e')][_0x389f42['actions'][_0x783ad1[_0xff17('0x125')]][_0xff17('0x127')]][_0xff17('0x126')]=![];delete _0x389f42[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]];unlockQueueStatus(_0x17bda2);});}else{this[_0xff17('0xb2')](this['voiceQueues'][this[_0xff17('0x123')][_0x783ad1['actionid']][_0xff17('0xb0')]]);this[_0xff17('0xf4')]({'active':![],'ContactId':this[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]][_0xff17('0xf8')],'ListId':this['actions'][_0x783ad1[_0xff17('0x125')]][_0xff17('0xcf')],'VoiceQueueId':this['actions'][_0x783ad1[_0xff17('0x125')]][_0xff17('0xf9')]||undefined,'CampaignId':this['actions'][_0x783ad1[_0xff17('0x125')]][_0xff17('0xd1')]||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0x12f')));delete this[_0xff17('0x123')][_0x783ad1['actionid']];unlockQueueStatus(_0x17bda2);}}else if((strategy[this[_0xff17('0x1c')][this['actions'][_0x783ad1[_0xff17('0x125')]][_0xff17('0xb0')]]['strategy']]||_0xff17('0x17'))==='rrmemory'){var _0x7e25e;if(this[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]]&&!_[_0xff17('0x45')](this[_0xff17('0x26')][this[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]]['queue']])){if(this[_0xff17('0x27')][_0x389f42[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]][_0xff17('0xb0')]]){this[_0xff17('0x27')][_0x389f42['actions'][_0x783ad1[_0xff17('0x125')]][_0xff17('0xb0')]]=this[_0xff17('0x27')][this['actions'][_0x783ad1[_0xff17('0x125')]][_0xff17('0xb0')]]?this[_0xff17('0x27')][this[_0xff17('0x123')][_0x783ad1['actionid']][_0xff17('0xb0')]]:this['queueBooked'][this['actions'][_0x783ad1[_0xff17('0x125')]][_0xff17('0xb0')]]?this[_0xff17('0x26')][this[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]][_0xff17('0xb0')]][_0xff17('0x130')]||0x0:0x0;}this[_0xff17('0x26')][this[_0xff17('0x123')][_0x783ad1[_0xff17('0x125')]][_0xff17('0xb0')]]['_rr']=this['queueBookedRR'][this[_0xff17('0x123')][_0x783ad1['actionid']]['queue']];for(var _0x2d850e=0x0;_0x2d850e=0x0?!![]:![];})['catch'](myreject(_0x26cd33)));}}else{_0x1b0ddf[_0xff17('0x128')](ami[_0xff17('0xad')]({'action':_0xff17('0x146'),'command':util[_0xff17('0x78')]('iftime\x20%s,%s',_0xef8dee,!_['isUndefined'](config[_0xff17('0x143')][_0x994124])?_0x994124:'')})[_0xff17('0xb5')](function(_0x29f10f){return _0x29f10f[_0xff17('0x14b')][_0xff17('0x149')](_0xff17('0x14a'))>=0x0?!![]:![];})[_0xff17('0xae')](myreject(_0x26cd33)));}BPromise[_0xff17('0x14c')](_0x1b0ddf)[_0xff17('0xb5')](function(_0x550cb0){var _0x155777=_['some'](_0x550cb0);if(_0x155777){return _0x296eb0(_0x155777);}else{_0x5eca46[_0xff17('0x3c')]=_0x535fed?_0xff17('0x14d'):'INTERVAL_IS_OVERTIME';return _0x26cd33(msgResponse(_0xff17('0x14e'),_0xff17('0x140'),_0xff17('0x14f')+_0x535fed+'\x20'+_0xf24c23+'\x20Interval\x20is\x20overtime:\x20'+util[_0xff17('0x95')](_0xef8dee,{'showHidden':![],'depth':null})+_0xff17('0x150')+_0x994124));}})[_0xff17('0xae')](function(_0x4f9a4c){return _0x26cd33(msgResponse(_0xff17('0x13f'),_0xff17('0x140'),JSON['stringify'](_0x4f9a4c)));});});};Dialer['prototype'][_0xff17('0x151')]=function(_0x126c8f){var _0x22e90d=this;return function(){switch(_0x126c8f[_0xff17('0x59')]){case _0xff17('0x152'):freeVariablesPredictive(_0x126c8f);_0x22e90d['handlePower'](_0x126c8f,0x1);break;case _0xff17('0x153'):freeVariablesPredictive(_0x126c8f);_0x22e90d[_0xff17('0x154')](_0x126c8f,_0x126c8f[_0xff17('0x155')]);break;case'predictive':_0x22e90d[_0xff17('0x156')](_0x126c8f);break;case _0xff17('0x157'):freeVariablesPredictive(_0x126c8f);_0x22e90d[_0xff17('0x154')](_0x126c8f,0x1);break;default:freeVariablesPredictive(_0x126c8f);logger['error']('Queue',_0x126c8f[_0xff17('0x3e')],_0xff17('0x158'));}};};Dialer[_0xff17('0x19')][_0xff17('0x159')]=function(_0x504c16){var _0x1ec754=this;return function(){_0x1ec754[_0xff17('0x15a')](_0x504c16);};};Dialer[_0xff17('0x19')][_0xff17('0x8')]=function(_0x5004a0){var _0x188152=this;if(isNotPreview(_0x5004a0[_0xff17('0x59')])){if(isVoiceQueueOutbound(_0x5004a0[_0xff17('0x4d')])&&isActive(_0x5004a0[_0xff17('0x58')])){_0x5004a0[_0xff17('0x9f')]=!![];BPromise['resolve']()[_0xff17('0xb5')](checkIsLoggedIn(_0x5004a0,_0x5004a0[_0xff17('0x51')]))[_0xff17('0xb5')](checkIsActive(_0x5004a0,_0x5004a0['dialActive']))[_0xff17('0xb5')](checkInterval(_0x5004a0))[_0xff17('0xb5')](_0x188152[_0xff17('0x139')](_0x5004a0))[_0xff17('0xb5')](_0x188152[_0xff17('0x13d')](_0x5004a0['dialGlobalInterval'],_0x5004a0['dialTimezone'],_0x5004a0['name'],_0x5004a0))[_0xff17('0xb5')](_0x188152['checkIfTimeIntervals'](_0x5004a0['Interval'],_0x5004a0[_0xff17('0x15b')],_0x5004a0[_0xff17('0x3e')],_0x5004a0))[_0xff17('0xb5')](_0x188152[_0xff17('0x151')](_0x5004a0))[_0xff17('0xae')](loggerCatchQueueSummary(_0xff17('0x15c'),_0x5004a0));}else{notSendMessagesQueue(_0x5004a0);}}else{freeVariablesPredictive(_0x5004a0);}};Dialer[_0xff17('0x19')]['syncCampaigns']=function(){var _0x87b453=this;var _0x534cec;for(var _0x508b57 in this['campaigns']){if(this['campaigns'][_0xff17('0x98')](_0x508b57)){_0x534cec=this[_0xff17('0x1d')][_0x508b57];if(isCampaignIvr(_0x534cec[_0xff17('0x4d')])&&isActive(_0x534cec[_0xff17('0x76')])){_0x534cec[_0xff17('0x9f')]=!![];BPromise[_0xff17('0xb4')]()['then'](checkIsActive(_0x534cec,_0x534cec[_0xff17('0x76')]))[_0xff17('0xb5')](checkInterval(_0x534cec))[_0xff17('0xb5')](_0x87b453[_0xff17('0x139')](_0x534cec))['then'](_0x87b453[_0xff17('0x13d')](_0x534cec[_0xff17('0x15d')],_0x534cec[_0xff17('0x15b')],_0x534cec['name'],_0x534cec))[_0xff17('0xb5')](_0x87b453[_0xff17('0x13e')](_0x534cec[_0xff17('0x41')],_0x534cec[_0xff17('0x15b')],_0x534cec[_0xff17('0x3e')],_0x534cec))[_0xff17('0xb5')](_0x87b453[_0xff17('0x159')](_0x534cec))[_0xff17('0xae')](loggerCatchQueueSummary(_0xff17('0x15e'),_0x534cec));}else{notSendMessagesCampaign(_0x534cec);}}}};function getCallerIdRandom(_0x4d9a59,_0x12785b){var _0x285930,_0x32593b,_0x347c77;if(_0x12785b<=0x0){_0x12785b=0x1;}_0x285930=new RegExp(_0xff17('0x15f')+_0x12785b+'}$');_0x32593b=Math[_0xff17('0x160')](0xa,_0x12785b-0x1);_0x347c77=Math['pow'](0xa,_0x12785b)-0x1;return util[_0xff17('0x78')]('%s',_[_0xff17('0x161')](_0x4d9a59,_0x285930,_[_0xff17('0x162')](_0x32593b,_0x347c77)));}function extractCalleridName(_0x2ae739){var _0x4c4478=_0x2ae739['match'](/"(.*?)"/);return _0x4c4478?_0x4c4478[0x1]:_0x2ae739;}function extractCalleridNumber(_0x4d73fc){var _0x4a822a=_0x4d73fc['match'](/<(.*?)>/);return _0x4a822a?_0x4a822a[0x1]:_0x4d73fc;}Dialer[_0xff17('0x19')][_0xff17('0x163')]=function(_0x15b26a,_0x446c51){var _0x52fcda=this;var _0x324cdc=uuid['v4']();this[_0xff17('0x123')][_0x324cdc]=new Action(_0x15b26a,_0x446c51,_0x324cdc);return new BPromise(function(_0xb3233a,_0x17b8fe){if(_['isUndefined'](_0x15b26a)&&'object'!==typeof _0x15b26a){return _0x17b8fe(msgResponse(_0xff17('0x164'),_0xff17('0x140'),'voiceQueue\x20is\x20undefine'));}if(_[_0xff17('0x3b')](_0x446c51[_0xff17('0x165')][_0xff17('0x166')])||_0x446c51[_0xff17('0x165')][_0xff17('0x166')]===null){return _0x17b8fe(msgResponse(_0xff17('0x164'),_0xff17('0x140'),_0xff17('0x167')));}var _0x3cdca0={'XMD-CALLERID':_0x52fcda['actions'][_0x324cdc]['getCaller'](),'XMD-AGI':_0x15b26a['dialQueueProject']?util[_0xff17('0x78')](_0xff17('0x168'),ipAgi,_0x15b26a['dialQueueProject']):_0xff17('0x169'),'XMD-AGIAFTER':_0x15b26a[_0xff17('0x16a')]?util[_0xff17('0x78')](_0xff17('0x168'),ipAgi,_0x15b26a[_0xff17('0x16a')]):_0xff17('0x169'),'XMD-QUEUE':_0x15b26a['type']===_0xff17('0x90')?util[_0xff17('0x78')](_0xff17('0x16b'),_0x15b26a[_0xff17('0x3e')],_0x15b26a[_0xff17('0x16c')]||'',_0x15b26a[_0xff17('0x10c')]?'c':'',_0x15b26a[_0xff17('0x115')]||0x3):'NONE','XMD-CONTACTID':_0x446c51[_0xff17('0xf8')],'XMD-CDRTYPE':_0xff17('0x16d'),'CALLERID(all)':_0x52fcda[_0xff17('0x123')][_0x324cdc]['getCaller'](),'XMD-AMD':_0x15b26a[_0xff17('0xdc')]?'ACTIVE':_0xff17('0x169'),'XMD-DESTINATION':_0xff17('0xdb')};if(_0x15b26a[_0xff17('0xdc')]){_0x3cdca0[_0xff17('0x16e')]=_0x15b26a[_0xff17('0x16f')]||0x9c4;_0x3cdca0[_0xff17('0x170')]=_0x15b26a[_0xff17('0x171')]||0x5dc;_0x3cdca0[_0xff17('0x172')]=_0x15b26a[_0xff17('0x173')]||0x320;_0x3cdca0[_0xff17('0x174')]=_0x15b26a['dialAMDTotalAnalysisTime']||0x1388;_0x3cdca0[_0xff17('0x175')]=_0x15b26a['dialAMDMinWordLength']||0x64;_0x3cdca0[_0xff17('0x176')]=_0x15b26a[_0xff17('0x177')]||0x32;_0x3cdca0[_0xff17('0x178')]=_0x15b26a[_0xff17('0x179')]||0x3;_0x3cdca0['XMD-AMDSILENCETHRESHOLD']=_0x15b26a[_0xff17('0x17a')]||0x100;_0x3cdca0['XMD-AMDMAXIMUMWORDLENGTH']=_0x15b26a[_0xff17('0x17b')]||0x1388;}if(_0x15b26a['type']==='outbound'){_0x3cdca0[_0xff17('0x17c')]=_0x446c51['VoiceQueueId'];}else{_0x3cdca0[_0xff17('0x17d')]=_0x446c51[_0xff17('0xd1')];}for(var _0x52a149 in _0x446c51[_0xff17('0x165')]){if(_0x446c51[_0xff17('0x165')]['hasOwnProperty'](_0x52a149)){if(isNotNull(_0x446c51[_0xff17('0x165')][_0x52a149])&&_0x52a149!=='id'&&_0x52a149!==_0xff17('0x17e')&&_0x52a149!=='createdAt'&&_0x52a149!=='updatedAt'){_0x3cdca0[util[_0xff17('0x78')](_0xff17('0x17f'),_0xff17('0x180'),_[_0xff17('0x181')](_0x52a149))]=_0x446c51[_0xff17('0x165')][_0x52a149];}}}var _0xc1a0b5=_0x52fcda[_0xff17('0xd4')](_0x15b26a[_0xff17('0x75')])?getCallerId(_0x15b26a['Trunk'][_0xff17('0x77')],_0x15b26a[_0xff17('0x5a')],_0x15b26a[_0xff17('0x182')]>0x0?getCallerIdRandom(_0x15b26a[_0xff17('0x5b')],_0x15b26a[_0xff17('0x182')]):_0x15b26a[_0xff17('0x5b')]):getCallerId(_[_0xff17('0xac')](_0x15b26a['TrunkBackup'])?_0x15b26a[_0xff17('0x75')][_0xff17('0x77')]:_0x15b26a[_0xff17('0x13a')]['callerid'],_0x15b26a['dialOriginateCallerIdName'],_0x15b26a[_0xff17('0x182')]>0x0?getCallerIdRandom(_0x15b26a[_0xff17('0x5b')],_0x15b26a['dialRandomLastDigitCallerIdNumber']):_0x15b26a[_0xff17('0x5b')]);if(_0xc1a0b5){_0x3cdca0['XMD-ORIGINATECALLERIDNAME']=_0x52fcda['actions'][_0x324cdc][_0xff17('0x183')]=extractCalleridName(_0xc1a0b5);_0x3cdca0['XMD-ORIGINATECALLERIDNUM']=_0x52fcda[_0xff17('0x123')][_0x324cdc][_0xff17('0x184')]=extractCalleridNumber(_0xc1a0b5);}return ami[_0xff17('0xad')]({'actionid':_0x324cdc,'action':'originate','channel':_0x52fcda[_0xff17('0xd4')](_0x15b26a['Trunk'])?util[_0xff17('0x78')](_0xff17('0x185'),_0x15b26a[_0xff17('0x75')]['name'],isNotNull(_0x15b26a[_0xff17('0x5c')])?_0x15b26a['dialPrefix'][_0xff17('0x186')]()||'':'',_0x15b26a[_0xff17('0x187')]>0x0?_0x446c51[_0xff17('0x165')][_0xff17('0x166')][_0xff17('0x188')](_0x15b26a[_0xff17('0x187')]):_0x446c51[_0xff17('0x165')][_0xff17('0x166')]):util[_0xff17('0x78')]('SIP/%s/%s%s',_[_0xff17('0xac')](_0x15b26a[_0xff17('0x13a')])?_0x15b26a[_0xff17('0x75')][_0xff17('0x3e')]:_0x15b26a[_0xff17('0x13a')]['name'],isNotNull(_0x15b26a[_0xff17('0x5c')])?_0x15b26a[_0xff17('0x5c')]['trim']()||'':'',_0x15b26a[_0xff17('0x187')]>0x0?_0x446c51['Contact'][_0xff17('0x166')][_0xff17('0x188')](_0x15b26a[_0xff17('0x187')]):_0x446c51[_0xff17('0x165')][_0xff17('0x166')]),'callerid':_0xc1a0b5,'Exten':_0xff17('0xdb'),'Context':_0xff17('0x189'),'Priority':'1','variable':_0x3cdca0,'timeout':(_0x15b26a[_0xff17('0x18a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x324cdc})[_0xff17('0xb5')](function(_0xd30736){return _0xb3233a(_0xd30736);})[_0xff17('0xae')](function(_0x58a718){_0x15b26a[_0xff17('0x64')]+=0x1;var _0x1d6ead=new History(_0x52fcda[_0xff17('0x123')][_0x324cdc]);logger[_0xff17('0x94')](util[_0xff17('0x78')]('[originateError]:\x20%s',JSON['stringify'](_0x58a718)));_0x1d6ead[_0xff17('0xa6')]=0xe;_0x1d6ead[_0xff17('0xde')]='OriginateError';_0x1d6ead[_0xff17('0xa8')]=moment()[_0xff17('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d6ead[_0xff17('0xa7')]=_0x1d6ead['starttime'];_0x52fcda['createHistory'](_0x1d6ead)[_0xff17('0xae')](loggerCatch(_0xff17('0x18b')));_0x52fcda[_0xff17('0xc5')](_0x1d6ead)['catch'](loggerCatch(_0xff17('0x18b')))['finally'](function(){delete _0x52fcda['actions'][_0x324cdc];return _0x17b8fe(msgResponse(_0xff17('0x164'),_0xff17('0x47'),_0xff17('0x18c')));});});});};Dialer[_0xff17('0x19')][_0xff17('0x18d')]=function(_0x3f39e0){var _0x5cb8ac=this[_0xff17('0x123')][_0x3f39e0[_0xff17('0x125')]];var _0x35fb83=this;if(_0x5cb8ac){delete this['actions'][_0x3f39e0['actionid']];_0x5cb8ac['responsetime']=moment()[_0xff17('0x78')]('YYYY-MM-DD\x20HH:mm:ss');var _0x556c8e=_0x5cb8ac['type']===_0xff17('0x7a')?this[_0xff17('0x1d')][_0x5cb8ac['queue']]:this[_0xff17('0x1c')][_0x5cb8ac[_0xff17('0x18e')]()];if(!this[_0xff17('0x18f')](_0x3f39e0[_0xff17('0x190')])){this['updateOriginated'](_0x556c8e);return this[_0xff17('0x191')](_0x5cb8ac,_0x556c8e,_0x3f39e0)[_0xff17('0xb5')](function(_0x3f3b0c){})[_0xff17('0xae')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0xff17('0x23')][_0x3f39e0[_0xff17('0xd8')]]=_0x5cb8ac;}}};Dialer[_0xff17('0x19')][_0xff17('0x192')]=function(_0x79609b,_0x2c797f,_0x502b01){var _0x3c00de=new History(_0x2c797f);if(_0x3c00de[_0xff17('0xe7')]+_0x3c00de[_0xff17('0xff')]+_0x3c00de[_0xff17('0xe8')]+_0x3c00de[_0xff17('0xe9')]+_0x3c00de['countdropretry']+_0x3c00de[_0xff17('0xeb')]+_0x3c00de[_0xff17('0xec')]+_0x3c00de[_0xff17('0xed')]>=_0x502b01[_0xff17('0xee')]-0x1){return!![];}switch(_0x79609b){case 0x3:if(_0x3c00de['countnoanswerretry']>=_0x502b01['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0xff17('0xf4')]({'active':![],'countnoanswerretry':_0x3c00de['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xff17('0xf5')](_0x502b01[_0xff17('0x193')],'minutes')[_0xff17('0x78')](_0xff17('0x100')),'ContactId':_0x3c00de[_0xff17('0xf8')],'ListId':_0x3c00de[_0xff17('0xcf')],'VoiceQueueId':_0x3c00de[_0xff17('0xf9')]||undefined,'CampaignId':_0x3c00de['CampaignId']||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0x194')));}break;case 0x5:if(_0x3c00de[_0xff17('0xe7')]>=_0x502b01[_0xff17('0x195')]-0x1){return!![];}else{this[_0xff17('0xf4')]({'active':![],'countbusyretry':_0x3c00de[_0xff17('0xe7')]+=0x1,'scheduledat':moment()[_0xff17('0xf5')](_0x502b01[_0xff17('0x196')],_0xff17('0xf7'))[_0xff17('0x78')](_0xff17('0x100')),'ContactId':_0x3c00de[_0xff17('0xf8')],'ListId':_0x3c00de['ListId'],'VoiceQueueId':_0x3c00de[_0xff17('0xf9')]||undefined,'CampaignId':_0x3c00de['CampaignId']||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0x197')));}break;case 0x8:if(_0x3c00de[_0xff17('0xff')]>=_0x502b01[_0xff17('0x198')]-0x1){return!![];}else{this[_0xff17('0xf4')]({'active':![],'countcongestionretry':_0x3c00de[_0xff17('0xff')]+=0x1,'scheduledat':moment()[_0xff17('0xf5')](_0x502b01[_0xff17('0x199')],_0xff17('0xf7'))[_0xff17('0x78')](_0xff17('0x100')),'ContactId':_0x3c00de[_0xff17('0xf8')],'ListId':_0x3c00de[_0xff17('0xcf')],'VoiceQueueId':_0x3c00de[_0xff17('0xf9')]||undefined,'CampaignId':_0x3c00de[_0xff17('0xd1')]||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0x19a')));}break;case 0x0:if(_0x3c00de[_0xff17('0xe9')]>=_0x502b01[_0xff17('0x19b')]-0x1){return!![];}else{this[_0xff17('0xf4')]({'active':![],'countnosuchnumberretry':_0x3c00de[_0xff17('0xe9')]+=0x1,'scheduledat':moment()[_0xff17('0xf5')](_0x502b01[_0xff17('0x19c')],'minutes')[_0xff17('0x78')](_0xff17('0x100')),'ContactId':_0x3c00de[_0xff17('0xf8')],'ListId':_0x3c00de[_0xff17('0xcf')],'VoiceQueueId':_0x3c00de['VoiceQueueId']||undefined,'CampaignId':_0x3c00de[_0xff17('0xd1')]||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0x19d')));}break;case 0xa:if(_0x3c00de[_0xff17('0xea')]>=_0x502b01[_0xff17('0x119')]-0x1){return!![];}else{this[_0xff17('0xf4')]({'active':![],'countdropretry':_0x3c00de[_0xff17('0xea')]+=0x1,'scheduledat':moment()[_0xff17('0xf5')](_0x502b01[_0xff17('0x19e')],_0xff17('0xf7'))[_0xff17('0x78')](_0xff17('0x100')),'ContactId':_0x3c00de[_0xff17('0xf8')],'ListId':_0x3c00de[_0xff17('0xcf')],'VoiceQueueId':_0x3c00de[_0xff17('0xf9')]||undefined,'CampaignId':_0x3c00de[_0xff17('0xd1')]||undefined})['catch'](loggerCatch(_0xff17('0x11a')));}break;case 0xb:if(_0x3c00de['countabandonedretry']>=_0x502b01[_0xff17('0x121')]-0x1){return!![];}else{this[_0xff17('0xf4')]({'active':![],'countabandonedretry':_0x3c00de['countabandonedretry']+=0x1,'scheduledat':moment()[_0xff17('0xf5')](_0x502b01['dialAbandonedRetryFrequency'],_0xff17('0xf7'))['format'](_0xff17('0x100')),'ContactId':_0x3c00de['ContactId'],'ListId':_0x3c00de[_0xff17('0xcf')],'VoiceQueueId':_0x3c00de['VoiceQueueId']||undefined,'CampaignId':_0x3c00de[_0xff17('0xd1')]||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0x19f')));}break;case 0x13:if(_0x3c00de[_0xff17('0xec')]>=_0x502b01['dialMachineMaxRetry']-0x1){return!![];}else{this[_0xff17('0xf4')]({'active':![],'countmachineretry':_0x3c00de[_0xff17('0xec')]+=0x1,'scheduledat':moment()['add'](_0x502b01[_0xff17('0xf6')],_0xff17('0xf7'))['format'](_0xff17('0x100')),'ContactId':_0x3c00de['ContactId'],'ListId':_0x3c00de['ListId'],'VoiceQueueId':_0x3c00de[_0xff17('0xf9')]||undefined,'CampaignId':_0x3c00de['CampaignId']||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0xfa')));}break;case 0x14:if(_0x3c00de[_0xff17('0xed')]>=_0x502b01[_0xff17('0x1a0')]-0x1){return!![];}else{this[_0xff17('0xf4')]({'active':![],'countagentrejectretry':_0x3c00de['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xff17('0xf5')](_0x502b01[_0xff17('0x1a1')],_0xff17('0xf7'))[_0xff17('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c00de[_0xff17('0xf8')],'ListId':_0x3c00de['ListId'],'VoiceQueueId':_0x3c00de['VoiceQueueId']||undefined,'CampaignId':_0x3c00de[_0xff17('0xd1')]||undefined})['catch'](loggerCatch(_0xff17('0x1a2')));}break;default:return!![];}};Dialer[_0xff17('0x19')][_0xff17('0x191')]=function(_0x228606,_0x2eef69,_0x3f314b){var _0x523772=this;var _0x463954=new History(_0x228606);return new BPromise(function(_0x28b49e,_0x2e5eb2){if(_[_0xff17('0x3b')](_0x2eef69)&&_0xff17('0x1a3')!==typeof _0x2eef69){return _0x2e5eb2(msgResponse(_0xff17('0x1a4'),_0xff17('0x140'),'entity\x20is\x20undefine'));}if(_[_0xff17('0x3b')](_0x3f314b)&&_0xff17('0x1a3')!==typeof _0x3f314b){return _0x2e5eb2(msgResponse(_0xff17('0x1a4'),_0xff17('0x140'),'evt\x20is\x20undefine'));}switch(_0x3f314b[_0xff17('0x10a')]){case'0':_0x2eef69['outboundNoSuchCallsDay']+=0x1;_0x463954[_0xff17('0xa6')]=0x0;_0x463954[_0xff17('0xde')]=_0xff17('0x1a5');_0x463954[_0xff17('0xe9')]+=0x1;_0x463954['countglobal']+=0x1;ami['emit'](_0xff17('0x1a6'),ut['buildObj'](_0x228606,_0xff17('0x1a7')));_0x523772[_0xff17('0xc7')](_0x463954)[_0xff17('0xae')](loggerCatch(_0xff17('0xe6')));if(_0x523772[_0xff17('0x192')](0x0,_0x228606,_0x2eef69)){if(_0x463954[_0xff17('0xe9')]>=_0x2eef69[_0xff17('0x19b')]){_0x523772[_0xff17('0xf2')](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1a8'));}else{_0x523772[_0xff17('0xef')](_0x463954,_0x28b49e,_0x2e5eb2,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2eef69[_0xff17('0x62')]+=0x1;_0x463954['state']=0x3;_0x463954[_0xff17('0xde')]=_0xff17('0x1a9');_0x463954[_0xff17('0xe8')]+=0x1;_0x463954['countglobal']+=0x1;ami[_0xff17('0x4c')](_0xff17('0x1aa'),ut[_0xff17('0x1ab')](_0x228606,_0xff17('0x1ac')));_0x523772[_0xff17('0xc7')](_0x463954)['catch'](loggerCatch(_0xff17('0x1ad')));if(_0x523772[_0xff17('0x192')](0x3,_0x228606,_0x2eef69)){if(_0x463954[_0xff17('0xe8')]>=_0x2eef69[_0xff17('0x1ae')]){_0x523772[_0xff17('0xf2')](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1af'));}else{_0x523772['stateGlobal'](_0x463954,_0x28b49e,_0x2e5eb2,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2eef69[_0xff17('0x1b0')]+=0x1;_0x463954['state']=0x5;_0x463954['statedesc']=_0xff17('0x1b1');_0x463954['countbusyretry']+=0x1;_0x463954[_0xff17('0xfe')]+=0x1;ami[_0xff17('0x4c')](_0xff17('0x1b2'),ut['buildObj'](_0x228606,_0xff17('0x1b3')));_0x523772[_0xff17('0xc7')](_0x463954)[_0xff17('0xae')](loggerCatch(_0xff17('0x1b4')));if(_0x523772[_0xff17('0x192')](0x5,_0x228606,_0x2eef69)){if(_0x463954[_0xff17('0xe7')]>=_0x2eef69['dialBusyMaxRetry']){_0x523772[_0xff17('0xf2')](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1b5'));}else{_0x523772[_0xff17('0xef')](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1b5'));}}break;case'8':_0x2eef69[_0xff17('0x5f')]+=0x1;_0x463954[_0xff17('0xa6')]=0x8;_0x463954['statedesc']=_0xff17('0x1b6');_0x463954[_0xff17('0xff')]+=0x1;_0x463954[_0xff17('0xfe')]+=0x1;ami['emit'](_0xff17('0x1b7'),ut[_0xff17('0x1ab')](_0x228606,_0xff17('0x1b8')));_0x523772[_0xff17('0xc7')](_0x463954)[_0xff17('0xae')](loggerCatch(_0xff17('0x1b9')));if(_0x523772[_0xff17('0x192')](0x8,_0x228606,_0x2eef69)){if(_0x463954['countcongestionretry']>=_0x2eef69[_0xff17('0x198')]){_0x523772[_0xff17('0xf2')](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1ba'));}else{_0x523772[_0xff17('0xef')](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1ba'));}}break;case'11':_0x2eef69[_0xff17('0x1bb')]+=0x1;_0x463954[_0xff17('0xa6')]=0xb;_0x463954[_0xff17('0xde')]=_0xff17('0x11f');_0x463954[_0xff17('0xeb')]+=0x1;_0x463954[_0xff17('0xfe')]+=0x1;_0x523772[_0xff17('0xc7')](_0x463954)[_0xff17('0xae')](loggerCatch(_0xff17('0x122')));if(_0x523772['checkRetriveMax'](0xb,_0x228606,_0x2eef69)){if(_0x463954['countabandonedretry']>=_0x2eef69[_0xff17('0x121')]){_0x523772[_0xff17('0xf2')](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1bc'));}else{_0x523772['stateGlobal'](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1bc'));}}break;case'20':_0x2eef69[_0xff17('0x66')]+=0x1;_0x463954[_0xff17('0xa6')]=0x14;_0x463954[_0xff17('0xde')]=_0xff17('0x1bd');_0x463954[_0xff17('0xed')]+=0x1;_0x463954[_0xff17('0xfe')]+=0x1;ami[_0xff17('0x4c')](_0xff17('0x1be'),ut[_0xff17('0x1ab')](_0x228606,_0xff17('0x1bf')));_0x523772['createHistory'](_0x463954)[_0xff17('0xae')](loggerCatch(_0xff17('0x1c0')));if(_0x523772[_0xff17('0x192')](0x14,_0x228606,_0x2eef69)){if(_0x463954['countagentrejectretry']>=_0x2eef69[_0xff17('0x1a0')]){_0x523772['createStateFinal'](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1c1'));}else{_0x523772[_0xff17('0xef')](_0x463954,_0x28b49e,_0x2e5eb2,_0xff17('0x1c1'));}}break;default:_0x2eef69[_0xff17('0x67')]+=0x1;_0x463954[_0xff17('0xa6')]=0xc;_0x463954[_0xff17('0xde')]=_0x3f314b[_0xff17('0x10a')];_0x523772[_0xff17('0xc7')](_0x463954)[_0xff17('0xae')](loggerCatch(_0xff17('0x1c2')));if(_0x523772[_0xff17('0x192')](_0x3f314b[_0xff17('0x10a')],_0x228606,_0x2eef69)){if(_0x463954[_0xff17('0xe7')]+_0x463954['countcongestionretry']+_0x463954[_0xff17('0xe8')]+_0x463954[_0xff17('0xe9')]+_0x463954['countdropretry']+_0x463954[_0xff17('0xeb')]+_0x463954[_0xff17('0xec')]+_0x463954['countagentrejectretry']>=_0x2eef69[_0xff17('0xee')]){_0x523772[_0xff17('0xef')](_0x463954,_0x28b49e,_0x2e5eb2,_0x3f314b[_0xff17('0x10a')]);}else{_0x523772[_0xff17('0xf2')](_0x463954,_0x28b49e,_0x2e5eb2,_0x3f314b[_0xff17('0x10a')]);}}}});};Dialer[_0xff17('0x19')][_0xff17('0xef')]=function(_0x4bf343,_0x5648b2,_0x2893e3,_0x57c0c4){var _0x57a67d=new Final(_0x4bf343);_0x57a67d[_0xff17('0xa6')]=0xf;_0x57a67d['statedesc']='Global';this[_0xff17('0xf2')](_0x57a67d,_0x5648b2,_0x2893e3,_0x57c0c4);};Dialer[_0xff17('0x19')][_0xff17('0xf2')]=function(_0x3337fa,_0x1d48ba,_0x1f4948,_0x5d582f){this['moveContactManagedDialer'](_0x3337fa)[_0xff17('0xb5')](function(_0x497cd0){return _0x1d48ba(msgResponse(_0xff17('0x1a4'),_0xff17('0xd3'),_0x5d582f));})[_0xff17('0xae')](function(_0x2e068a){return _0x1f4948(msgResponse(_0xff17('0x1c3'),_0xff17('0x140'),_0xff17('0x1c4')));});};Dialer['prototype'][_0xff17('0x156')]=function(_0x57afde){var _0x382def=this;var _0x2f6776=_0x57afde['dialPredictiveOptimizationPercentage']/0x64;var _0x562aee=_0x57afde[_0xff17('0x61')]/(_0x57afde['outboundDropCallsDayTimeout']+_0x57afde[_0xff17('0x5d')]);var _0x6750fd=Math[_0xff17('0x1c5')](_0x57afde[_0xff17('0x1c6')]*(_0x57afde['predictiveIntervalMaxThreshold']/0x64));var _0x4a3f4e=Math[_0xff17('0x1c5')](_0x57afde[_0xff17('0x1c6')]*(_0x57afde[_0xff17('0x1c7')]/0x64));var _0x201e94=_0x57afde['available']+_0x57afde[_0xff17('0x53')];var _0x5a21c4=Math[_0xff17('0x1c8')](_0x57afde[_0xff17('0x72')]*_0x57afde['erlangAbandonmentRate']*_0x57afde['predictiveIntervalHitRate']*_0x57afde[_0xff17('0x6f')]);if(_['isUndefined'](_0x57afde[_0xff17('0x25')])){if(!_[_0xff17('0x3b')](_0x57afde[_0xff17('0x24')])){_0x57afde['startPredictive']=undefined;loggerPredictive[_0xff17('0x94')](_0xff17('0x1c9'),_0xff17('0x1ca'));}if(!_[_0xff17('0x3b')](_0x57afde['handlePredictive'])){loggerPredictive[_0xff17('0x94')](_0xff17('0x1c9'),_0xff17('0x1cb'));clearInterval(_0x57afde[_0xff17('0x8e')]);_0x57afde[_0xff17('0x8e')]=undefined;}_0x57afde['startProgressive']=moment()[_0xff17('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xff17('0x7d')](_0x57afde[_0xff17('0x3e')],'collection\x20data\x20in\x20progressive\x20at',_0x57afde[_0xff17('0x25')]);this[_0xff17('0x154')](_0x57afde,0x1);}else if(ifInterval(_0x57afde['dialPredictiveInterval'],_0x57afde[_0xff17('0x25')])){this[_0xff17('0x154')](_0x57afde,0x1);loggerPredictiveCalls[_0xff17('0x7d')](_0xff17('0x1cc'),_0x57afde[_0xff17('0x25')],_0x57afde[_0xff17('0x3e')]);_0x57afde[_0xff17('0x72')]=0x0;_0x57afde[_0xff17('0x6d')]=0x0;}else if(_0x2f6776<_0x562aee&&_0x57afde[_0xff17('0x1cd')]==='dropRate'){freeVariablesPredictive(_0x57afde);loggerPredictive[_0xff17('0x7d')](_0xff17('0x1ce'),_0xff17('0x1cf'),_0x562aee,_0xff17('0x25'),_0x57afde['name']);}else if(_0x5a21c4<_0x57afde[_0xff17('0x6d')]&&_0x57afde[_0xff17('0x1cd')]===_0xff17('0x1d0')){freeVariablesPredictive(_0x57afde);loggerPredictive['info'](_0xff17('0x1d1'),'Max\x20Drop\x20',_0x5a21c4,_0xff17('0x1d2'),_0x57afde['predictiveIntervalErlangCallsDroppedCalls'],_0xff17('0x25'),_0x57afde[_0xff17('0x3e')]);}else if(!ifInterval(_0x57afde[_0xff17('0x1d3')],_0x57afde[_0xff17('0x25')])&&_[_0xff17('0x3b')](_0x57afde[_0xff17('0x24')])&&!_[_0xff17('0x3b')](_0x57afde[_0xff17('0x25')])){_0x57afde['startPredictive']=moment()[_0xff17('0x78')](_0xff17('0x100'));loggerPredictive[_0xff17('0x7d')](_0x57afde[_0xff17('0x3e')],_0xff17('0x1d4'),_0x57afde[_0xff17('0x24')]);this[_0xff17('0xbb')](_0x57afde[_0xff17('0x1d3')])[_0xff17('0xb5')](this[_0xff17('0x1d5')](_0x57afde))[_0xff17('0xb5')](mergeDataErlangB(_0x57afde))[_0xff17('0xb5')](this[_0xff17('0x1d6')](_0x57afde))['catch'](loggerCatchPredictive(_0xff17('0x1d7'),_0x57afde));}else if(!ifInterval(_0x57afde[_0xff17('0x1d3')],_0x57afde[_0xff17('0x24')])){_0x57afde[_0xff17('0x6d')]=0x0;_0x57afde[_0xff17('0x24')]=moment()[_0xff17('0x78')](_0xff17('0x100'));loggerPredictive['info'](_0x57afde['name'],_0xff17('0x1d8'),_0x57afde[_0xff17('0x24')]);clearInterval(_0x57afde['handlePredictive']);_0x57afde['handlePredictive']=undefined;this[_0xff17('0xbb')](_0x57afde['dialPredictiveInterval'])[_0xff17('0xb5')](this[_0xff17('0x1d5')](_0x57afde))[_0xff17('0xb5')](mergeDataErlangB(_0x57afde))[_0xff17('0xb5')](this[_0xff17('0x1d6')](_0x57afde))[_0xff17('0xae')](loggerCatchPredictive(_0xff17('0x1d9'),_0x57afde));}else if(_0x57afde[_0xff17('0x1c6')]&&_0x201e94<_0x57afde['predictiveIntervalAvailable']-_0x4a3f4e){freeVariablesPredictive(_0x57afde);loggerPredictive[_0xff17('0x7d')](_0x57afde[_0xff17('0x3e')],_0xff17('0x1da'),_0x201e94,_0xff17('0x1db'),_0x57afde[_0xff17('0x1c6')],'-',_0x4a3f4e,'=',_0x57afde[_0xff17('0x1c6')]-_0x4a3f4e,')');}else if(_0x57afde[_0xff17('0x1c6')]&&_0x201e94>_0x57afde[_0xff17('0x1c6')]+_0x6750fd){freeVariablesPredictive(_0x57afde);loggerPredictive['info'](_0x57afde[_0xff17('0x3e')],_0xff17('0x1da'),_0x201e94,_0xff17('0x1dc'),_0x57afde[_0xff17('0x1c6')],'+',_0x6750fd,'=',_0x57afde['predictiveIntervalAvailable']+_0x6750fd,')');}};Dialer[_0xff17('0x19')][_0xff17('0x1d5')]=function(_0x3dabdf){var _0x79fc59=this;return function(_0xc54e33){return new BPromise(function(_0x294236,_0x245774){_[_0xff17('0x8c')](_0x3dabdf,_0xc54e33[0x0]);if(checkGetDataPredictive(_0xc54e33[0x0])){var _0x285999=_0x3dabdf[_0xff17('0x1c6')]=_0x3dabdf['talking']+_0x3dabdf[_0xff17('0x50')];var _0x592cea=_0x3dabdf[_0xff17('0x1d3')]*0x3c;var _0x55e264=_0xc54e33[0x0][_0xff17('0x69')]+_0xc54e33[0x0][_0xff17('0x68')];var _0xdf026f=(_0xc54e33[0x0]['predictiveIntervalAnsweredCalls']+_0xc54e33[0x0][_0xff17('0x6b')]+_0xc54e33[0x0][_0xff17('0x6a')])/_0xc54e33[0x0][_0xff17('0x70')];_0x3dabdf[_0xff17('0x6e')]=_0xdf026f>0x0?_0xdf026f:0x1;switch(_0x3dabdf[_0xff17('0x1cd')]){case _0xff17('0x1d0'):var _0x2caea7=_0x3dabdf['dialPredictiveOptimizationPercentage']/0x64;return _0x79fc59[_0xff17('0x1dd')](_0x285999,_0x592cea,_0x55e264,_0xdf026f,_0x2caea7)[_0xff17('0xb5')](function(_0x5de41d){return _0x294236(_0x5de41d);});case _0xff17('0x1de'):var _0x493c73=_0x3dabdf[_0xff17('0x1df')]/0x64;return _0x79fc59[_0xff17('0x1e0')](_0x285999,_0x592cea,_0x55e264,_0xdf026f,_0x493c73)[_0xff17('0xb5')](function(_0xde127d){return _0x294236(_0xde127d);});default:return _0x245774(msgResponse(_0xff17('0x1e1'),_0xff17('0x140'),_0xff17('0x1e2')));}}else{return _0x245774(msgResponse(_0xff17('0x1e1'),_0xff17('0x140'),_0xff17('0x1e3')));}});};};Dialer[_0xff17('0x19')][_0xff17('0x1e4')]=function(_0x5998b6){var _0x310de5=this;return function(_0x459790){return new BPromise(function(_0x333867,_0x277c41){_[_0xff17('0x8c')](_0x5998b6,_0x459790[0x0]);if(checkGetDataPredictive(_0x459790[0x0])){loggerPredictive[_0xff17('0x7d')](JSON['stringify'](_0x459790[0x0]));if(_0x5998b6[_0xff17('0x1cd')]===_0xff17('0x1d0')){return _0x310de5[_0xff17('0xc3')](_0x5998b6['id'])[_0xff17('0xb5')](function(_0x5bc0fb){var _0x4cb540=_0x5998b6['loggedIn']-_0x5bc0fb[0x0][_0xff17('0x1e5')];var _0x36e746=_0x5998b6[_0xff17('0x1d3')]*0x3c;var _0x11cf97=_0x459790[0x0][_0xff17('0x69')]+_0x459790[0x0][_0xff17('0x68')];var _0x39c6c2=(_0x459790[0x0][_0xff17('0x80')]+_0x459790[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x459790[0x0][_0xff17('0x6a')])/_0x459790[0x0][_0xff17('0x70')];var _0x395b9a=_0x5998b6['dialPredictiveOptimizationPercentage']/0x64;_0x5998b6[_0xff17('0x1e6')]=_0x5bc0fb[0x0][_0xff17('0x1e5')]||0x0;_0x5998b6['predictiveIntervalHitRate']=_0x39c6c2>0x0?_0x39c6c2:0x1;return _0x310de5[_0xff17('0x1dd')](_0x4cb540,_0x36e746,_0x11cf97,_0x39c6c2,_0x395b9a);})[_0xff17('0xb5')](function(_0x37e51d){return _0x333867(_0x37e51d);})[_0xff17('0xae')](function(_0xa94df){return _0x277c41(msgResponse('[CatchErlangB]',_0xff17('0x140'),JSON[_0xff17('0x48')](_0xa94df)));});}if(_0x5998b6[_0xff17('0x1cd')]===_0xff17('0x1de')){return _0x310de5[_0xff17('0xc3')](_0x5998b6['id'])[_0xff17('0xb5')](function(_0x62f3ba){var _0x2a3365=_0x5998b6[_0xff17('0x51')]-_0x62f3ba[0x0][_0xff17('0x1e5')];var _0x1ab69f=_0x5998b6['dialPredictiveInterval']*0x3c;var _0x31bc38=_0x459790[0x0][_0xff17('0x69')]+_0x459790[0x0][_0xff17('0x68')];var _0x5a15c9=(_0x459790[0x0][_0xff17('0x80')]+_0x459790[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x459790[0x0][_0xff17('0x6a')])/_0x459790[0x0][_0xff17('0x70')];var _0x403ea0=_0x5998b6[_0xff17('0x1df')]/0x64;_0x5998b6['predictiveIntervalPauses']=_0x62f3ba[0x0]['outboundQueuePauses']||0x0;_0x5998b6[_0xff17('0x6e')]=_0x5a15c9>0x0?_0x5a15c9:0x1;return _0x310de5[_0xff17('0x1e0')](_0x2a3365,_0x1ab69f,_0x31bc38,_0x5a15c9,_0x403ea0);})[_0xff17('0xb5')](function(_0x44dab0){return _0x333867(_0x44dab0);})[_0xff17('0xae')](function(_0x484d2d){return _0x277c41(msgResponse(_0xff17('0x1e7'),'Failure',JSON[_0xff17('0x48')](_0x484d2d)));});}}else{return _0x277c41(msgResponse('[getDataPredictive]',_0xff17('0x140'),_0xff17('0x1e3')));}});};};Dialer['prototype'][_0xff17('0x1d6')]=function(_0x3d529a){var _0xca6d9b=this;return function(){var _0x9155ff=0x0;var _0xdb8918=Math['floor'](_0x3d529a[_0xff17('0x73')]*0x3e8);if(_0xdb8918>0x0){_0xdb8918=_0xdb8918<0x64?0x64:_0xdb8918;loggerPredictive[_0xff17('0x7d')](_0x3d529a[_0xff17('0x3e')],_0xff17('0x1e8'),_0xdb8918,'milliseconds');_0x3d529a[_0xff17('0x8e')]=setInterval(function(){_0xca6d9b[_0xff17('0x8e')](_0x3d529a);loggerPredictiveCalls[_0xff17('0x7d')](_0xff17('0x1e9'),_0x9155ff+=0x1);},_0xdb8918);}else{loggerPredictive[_0xff17('0x7d')](_0x3d529a[_0xff17('0x3e')],_0xff17('0x1ea'));}};};Dialer[_0xff17('0x19')][_0xff17('0x1eb')]=function(_0x4fee6d,_0x48e32c){var _0x56d378=this;return function(_0x3b0738){if(_[_0xff17('0x45')](_0x3b0738)){if(_[_0xff17('0xac')](_0x48e32c[_0xff17('0xd0')])||!_0x48e32c[_0xff17('0x1ec')]){if(_0x4fee6d[_0xff17('0x59')]===_0xff17('0x157')){_0x4fee6d[_0xff17('0x12b')]=_[_0xff17('0x3b')](_0x4fee6d[_0xff17('0x12b')])?!![]:_0x4fee6d[_0xff17('0x12b')];var _0x20669a=uuid['v4']();_0x56d378[_0xff17('0x123')][_0x20669a]=new Action(_0x4fee6d,_0x48e32c,_0x20669a);loggerBooked[_0xff17('0x7d')](_0xff17('0x1ed'),_0x20669a,_0xff17('0x1ee'),JSON[_0xff17('0x48')](_0x4fee6d[_0xff17('0x12b')]),_0xff17('0x1ef'),_0x4fee6d[_0xff17('0x3e')]);if(_0x4fee6d[_0xff17('0x12b')]){_0x4fee6d[_0xff17('0x12b')]=![];_0x56d378[_0xff17('0x26')][_0x56d378['actions'][_0x20669a][_0xff17('0xb0')]]=[];ami['Action']({'actionid':_0x20669a,'action':_0xff17('0x1f0'),'queue':_0x4fee6d['name']})['catch'](function(_0x3644b8){_0x56d378[_0xff17('0xb2')](_0x4fee6d);_0x56d378[_0xff17('0xf4')]({'active':![],'ContactId':_0x56d378['actions'][_0x20669a]['ContactId'],'ListId':_0x56d378[_0xff17('0x123')][_0x20669a][_0xff17('0xcf')],'VoiceQueueId':_0x56d378[_0xff17('0x123')][_0x20669a][_0xff17('0xf9')]||undefined,'CampaignId':_0x56d378[_0xff17('0x123')][_0x20669a][_0xff17('0xd1')]||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0x1f1')));delete _0x56d378[_0xff17('0x123')][_0x20669a];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xff17('0x48')](_0x4fee6d[_0xff17('0x12b')]),'Queue:\x20',_0x4fee6d[_0xff17('0x3e')]);_0x56d378[_0xff17('0xb2')](_0x4fee6d);_0x56d378['rescheduleContact']({'active':![],'ContactId':_0x56d378[_0xff17('0x123')][_0x20669a][_0xff17('0xf8')],'ListId':_0x56d378['actions'][_0x20669a][_0xff17('0xcf')],'VoiceQueueId':_0x56d378[_0xff17('0x123')][_0x20669a][_0xff17('0xf9')]||undefined,'CampaignId':_0x56d378[_0xff17('0x123')][_0x20669a][_0xff17('0xd1')]||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0x1f1')));delete _0x56d378['actions'][_0x20669a];}}else{return _0x56d378['actionOriginate'](_0x4fee6d,_0x48e32c);}}else{if(getDiff(_0x48e32c[_0xff17('0x1f2')])<_0x4fee6d['dialRecallMeTimeout']*0x3c){if(_0x48e32c['Agent']&&!_0x48e32c[_0xff17('0x1f3')][_0xff17('0x1f4')]){_0x56d378[_0xff17('0x1f5')]['run'](_0x48e32c['id'])[_0xff17('0x135')](function(){_0x56d378[_0xff17('0xb2')](_0x4fee6d);});}else{_0x56d378['unlockContact']({'active':![]},_0x48e32c['id'],0x1)[_0xff17('0x135')](function(){console[_0xff17('0x1f6')](_0xff17('0x1f7'));_0x56d378[_0xff17('0xb2')](_0x4fee6d);});}}else{_0x4fee6d['outboundReCallsDay']+=0x1;_0x56d378[_0xff17('0xb2')](_0x4fee6d);if(_0x4fee6d[_0xff17('0x1f8')]){_0x56d378['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x48e32c[_0xff17('0xf8')],'ListId':_0x48e32c[_0xff17('0xcf')],'VoiceQueueId':_0x48e32c[_0xff17('0xf9')]||undefined,'CampaignId':_0x48e32c[_0xff17('0xd1')]||undefined})[_0xff17('0xae')](loggerCatch(_0xff17('0x1f9')));_0x56d378['createHistory'](createObjHistory(_0x4fee6d,_0x48e32c,_0xff17('0x1fa'),0x17,_0xff17('0x1fb')))['catch'](loggerCatch(_0xff17('0x1fc')));}else{_0x56d378[_0xff17('0xcd')](createObjHistory(_0x4fee6d,_0x48e32c,'RECALLFAILEDTIMEOUT',0x16,_0xff17('0x1fd')),'[Originate][HistoryRecallClose][historyCatch]',_0xff17('0x1fe'));}}}}else{_0x4fee6d[_0xff17('0x5e')]+=0x1;_0x56d378[_0xff17('0xcd')](createObjHistory(_0x4fee6d,_0x48e32c,_0xff17('0x1ff'),0xd,'Blacklist'),_0xff17('0x200'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xff17('0x19')]['handleIvr']=function(_0x1de847){var _0x14a602=this;var _0x4df6e5=[];var _0x390ee2=_0x1de847[_0xff17('0x201')]-_0x1de847[_0xff17('0x71')]-_0x1de847[_0xff17('0x202')];emitCampaignSummary(_0x1de847);if(_0x390ee2>0x0){if(_0x390ee2>this[_0xff17('0x20')]){_0x390ee2=this[_0xff17('0x20')];}_0x1de847['temp']+=_0x390ee2;this[_0xff17('0x203')](_0x1de847['id'],_0x390ee2,_0x1de847[_0xff17('0x204')])[_0xff17('0xb5')](function(_0x4e4c46){_0x1de847['temp']-=_0x390ee2;_0x1de847[_0xff17('0x202')]=_0x1de847[_0xff17('0x202')]>0x0?_0x1de847[_0xff17('0x202')]:0x0;if(!checkContactEmpty(_0x4e4c46)){_0x1de847[_0xff17('0x3c')]=_0xff17('0x9d');logger[_0xff17('0x7d')]('[getContactCampaign2][Empty]'+_0x1de847[_0xff17('0x3e')]);}else{_0x1de847['originated']+=_0x4e4c46[_0xff17('0x97')];_0x1de847[_0xff17('0x3c')]=_0xff17('0x205');for(var _0x18539a=0x0;_0x18539a<_0x4e4c46['length'];_0x18539a+=0x1){_0x1de847[_0xff17('0x206')]+=0x1;if(_['isNil'](_0x4e4c46[_0x18539a])||_[_0xff17('0xac')](_0x4e4c46[_0x18539a][_0xff17('0x165')])||_[_0xff17('0xac')](_0x4e4c46[_0x18539a][_0xff17('0x165')][_0xff17('0x166')])){_0x14a602[_0xff17('0xcb')](_0xff17('0x207'),_0x1de847,_0x4e4c46[_0x18539a]);}else{_0x14a602[_0xff17('0xb9')](_['pick'](_0x4e4c46[_0x18539a],[_0xff17('0xd1'),_0xff17('0x208')]))[_0xff17('0xb5')](_0x14a602['checkContactBlack'](_0x1de847,_0x4e4c46[_0x18539a]))[_0xff17('0xae')](_0x14a602[_0xff17('0xca')](_0xff17('0x209'),_0x1de847));}}}})[_0xff17('0xae')](loggerGetContactDialer(_0xff17('0x20a'),_0x1de847,_0x390ee2));}};Dialer[_0xff17('0x19')][_0xff17('0x154')]=function(_0x89b754,_0x3d9ae4){var _0x32ed1c=this;var _0x5452a9=[];var _0x5ad16d=_0x3d9ae4>=0x1?_0x3d9ae4:0x1;var _0x138c53=[];if(_0x89b754[_0xff17('0x59')]==='booked'){_0x5ad16d=0x1;}var _0x437f20=Math['floor'](_0x89b754['available']*_0x5ad16d)-_0x89b754['originated']-_0x89b754[_0xff17('0x202')];emitVoiceQueueSummary(_0x89b754);if(_0x89b754[_0xff17('0x20b')]>0x0){var _0x5502d1=_0x89b754[_0xff17('0x20b')]-_0x89b754[_0xff17('0x71')]-_0x89b754[_0xff17('0x53')]-_0x89b754[_0xff17('0x202')]-_0x89b754[_0xff17('0xa0')];if(_0x437f20>_0x5502d1){_0x437f20=_0x5502d1;}}if(_0x437f20>0x0){if(_0x89b754[_0xff17('0x59')]===_0xff17('0x157')){_0x437f20=0x1;}if(_0x437f20>this['maxNumberOriginate']){_0x437f20=this[_0xff17('0x20')];}_0x89b754['temp']+=_0x437f20;for(var _0x58cbba in this[_0xff17('0x1e')]){if(this[_0xff17('0x1e')][_0xff17('0x98')](_0x58cbba)){if(this[_0xff17('0x1e')][_0x58cbba][_0xff17('0xa6')]===_0xff17('0x20c')&&this[_0xff17('0x1e')][_0x58cbba][_0xff17('0xd6')]==='reachable'){_0x5452a9['push'](this[_0xff17('0x1e')][_0x58cbba]['id']);}}}this[_0xff17('0xc1')](_0x89b754['id'],_0x5452a9,_0x437f20,_0x89b754[_0xff17('0x204')])['then'](function(_0xa3b90a){_0x89b754[_0xff17('0x202')]-=_0x437f20;_0x89b754[_0xff17('0x202')]=_0x89b754['temp']>0x0?_0x89b754['temp']:0x0;if(!checkContactEmpty(_0xa3b90a)){_0x32ed1c[_0xff17('0xb3')](_0x89b754)[_0xff17('0xb5')](sendMessageReschedule(_0x89b754))['catch'](loggerCatch(_0xff17('0xb6')));}else{_0x89b754['originated']+=_0xa3b90a[_0xff17('0x97')];_0x89b754[_0xff17('0x3c')]=_0x89b754[_0xff17('0x59')]==='booked'?_0xff17('0x20d'):'RUNNING';for(var _0x78da0f=0x0;_0x78da0f<_0xa3b90a[_0xff17('0x97')];_0x78da0f+=0x1){if(_[_0xff17('0xac')](_0xa3b90a[_0x78da0f])||_[_0xff17('0xac')](_0xa3b90a[_0x78da0f][_0xff17('0x165')])||_[_0xff17('0xac')](_0xa3b90a[_0x78da0f][_0xff17('0x165')][_0xff17('0x166')])){_0x32ed1c[_0xff17('0xcb')]('[actionOriginate]\x20',_0x89b754,_0xa3b90a[_0x78da0f]);}else{_0x32ed1c[_0xff17('0xb7')](_[_0xff17('0xce')](_0xa3b90a[_0x78da0f],[_0xff17('0xf9'),_0xff17('0x208')]))[_0xff17('0xb5')](_0x32ed1c[_0xff17('0x1eb')](_0x89b754,_0xa3b90a[_0x78da0f]))['catch'](_0x32ed1c[_0xff17('0xca')](_0xff17('0x207'),_0x89b754));}}}})[_0xff17('0xae')](loggerGetContactDialer(_0xff17('0x20e'),_0x89b754,_0x437f20));}};Dialer[_0xff17('0x19')][_0xff17('0x8e')]=function(_0x205c8a){var _0x17f44f=this;if(_0x205c8a['dialLimitQueue']>0x0){var _0x8e218d=_0x205c8a[_0xff17('0x20b')]-_0x205c8a[_0xff17('0x71')]-_0x205c8a[_0xff17('0x53')];if(_0x8e218d>0x0){this[_0xff17('0x20f')](_0x205c8a);}else{loggerPredictiveCalls[_0xff17('0x7d')]('[handlePredictive][limitChannel]');}}else{this[_0xff17('0x20f')](_0x205c8a);}};Dialer[_0xff17('0x19')][_0xff17('0x20f')]=function(_0x2a7288){var _0xf56ae0=this;var _0x554dae=[];_0x2a7288[_0xff17('0x71')]+=0x1;for(var _0x3ed8ab in this[_0xff17('0x1e')]){if(this[_0xff17('0x1e')][_0xff17('0x98')](_0x3ed8ab)){if(this[_0xff17('0x1e')][_0x3ed8ab][_0xff17('0xa6')]===_0xff17('0x20c')&&this['agents'][_0x3ed8ab][_0xff17('0xd6')]===_0xff17('0xd7')){_0x554dae['push'](this[_0xff17('0x1e')][_0x3ed8ab]['id']);}}}this[_0xff17('0xc1')](_0x2a7288['id'],_0x554dae,0x1,_0x2a7288[_0xff17('0x204')])['then'](function(_0x597f82){if(!checkContactEmpty(_0x597f82)){checkContactLowerLimitOriginate(_0x2a7288,0x1,0x0);_0xf56ae0[_0xff17('0xb3')](_0x2a7288)[_0xff17('0xb5')](sendMessageReschedule(_0x2a7288))[_0xff17('0xae')](loggerCatch(_0xff17('0xb6')));}else{_0x2a7288[_0xff17('0x3c')]=_0xff17('0x205');if(_['isNil'](_0x597f82[0x0])||_[_0xff17('0xac')](_0x597f82[0x0][_0xff17('0x165')])||_[_0xff17('0xac')](_0x597f82[0x0][_0xff17('0x165')][_0xff17('0x166')])){_0xf56ae0[_0xff17('0xcb')](_0xff17('0x207'),_0x2a7288,_0x597f82[0x0]);}else{_0xf56ae0['checkIsBlackList'](_[_0xff17('0xce')](_0x597f82[0x0],['VoiceQueueId',_0xff17('0x208')]))[_0xff17('0xb5')](_0xf56ae0[_0xff17('0x1eb')](_0x2a7288,_0x597f82[0x0]))[_0xff17('0xae')](_0xf56ae0[_0xff17('0xca')]('[actionOriginatePredictive]\x20',_0x2a7288));}}})[_0xff17('0xae')](loggerGetContactDialer(_0xff17('0x210'),_0x2a7288,0x1));emitVoiceQueueSummary(_0x2a7288);};Dialer[_0xff17('0x19')][_0xff17('0x1dd')]=function(_0x303c7a,_0x488dd6,_0xe22ffd,_0xf9fee2,_0x1a1ff8,_0x108b1b){loggerPredictive[_0xff17('0x7d')](_0xff17('0x211'));loggerPredictive[_0xff17('0x7d')](_0xff17('0x212'),_0x303c7a);loggerPredictive[_0xff17('0x7d')](_0xff17('0x213'),_0x488dd6);loggerPredictive[_0xff17('0x7d')]('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',_0xe22ffd);loggerPredictive['info'](_0xff17('0x214'),_0xf9fee2);loggerPredictive[_0xff17('0x7d')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1a1ff8);loggerPredictive[_0xff17('0x7d')]('---------------------------');return new BPromise(function(_0x337c87,_0x147411){if(_0x303c7a<=0x0||isNaN(_0x303c7a)){return _0x147411(msgResponse(_0xff17('0x215'),_0xff17('0x47'),_0xff17('0x216')+_0x303c7a));}if(_0xe22ffd<=0x0||isNaN(_0xe22ffd)){return _0x147411(msgResponse('[abandonmentRate]',_0xff17('0x47'),_0xff17('0x217')+_0xe22ffd));}if(_0xf9fee2<=0x0||isNaN(_0xf9fee2)){return _0x147411(msgResponse(_0xff17('0x215'),_0xff17('0x47'),_0xff17('0x218')+_0xf9fee2));}if(_0x488dd6<=0x0||isNaN(_0x488dd6)){return _0x147411(msgResponse(_0xff17('0x215'),'Error','interval\x20=\x20'+_0x488dd6));}if(_0x1a1ff8<=0x0||isNaN(_0x1a1ff8)){return _0x147411(msgResponse(_0xff17('0x215'),_0xff17('0x47'),'Amax\x20=\x20'+_0x1a1ff8));}_0x108b1b=_0x108b1b||0x0;var _0x1f6de7=0x1/_0xe22ffd;var _0x49afd2=0x0;var _0x28c449=0x0;var _0x2f8bc3=0x0;var _0x3f9515=0x0;for(var _0x313468=0x0;_0x2f8bc3<_0x1a1ff8;_0x313468+=0x1){_0x28c449=_0x313468/_0x488dd6;_0x49afd2=(_0xf9fee2*_0x28c449+_0x108b1b)/_0x1f6de7;_0x2f8bc3=erlangb(_0x49afd2,_0x303c7a);_0x3f9515=_0x49afd2/_0x303c7a*(0x1-erlangb(_0x49afd2,_0x303c7a));}return _0x337c87({'erlangCalls':_0x313468,'erlangCallToSecond':_0x488dd6/_0x313468,'erlangAbandonmentRate':_0x2f8bc3,'erlangBusyFactor':_0x3f9515});});};Dialer['prototype'][_0xff17('0x1e0')]=function(_0x4707fd,_0x434380,_0x36388f,_0x44f462,_0x21c8f1,_0x3560e4){loggerPredictive[_0xff17('0x7d')](_0xff17('0x219'));loggerPredictive[_0xff17('0x7d')]('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',_0x4707fd);loggerPredictive['info'](_0xff17('0x213'),_0x434380);loggerPredictive[_0xff17('0x7d')](_0xff17('0x21a'),_0x36388f);loggerPredictive[_0xff17('0x7d')]('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',_0x44f462);loggerPredictive[_0xff17('0x7d')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x21c8f1);loggerPredictive[_0xff17('0x7d')](_0xff17('0x84'));return new BPromise(function(_0x161c6a,_0x303043){if(_0x4707fd<=0x0||isNaN(_0x4707fd)){return _0x303043(msgResponse('[busyFactor]','Error',_0xff17('0x216')+_0x4707fd));}if(_0x36388f<=0x0||isNaN(_0x36388f)){return _0x303043(msgResponse(_0xff17('0x21b'),_0xff17('0x47'),'Ts\x20=\x20'+_0x36388f));}if(_0x44f462<=0x0||isNaN(_0x44f462)){return _0x303043(msgResponse(_0xff17('0x21b'),_0xff17('0x47'),_0xff17('0x218')+_0x44f462));}if(_0x434380<=0x0||isNaN(_0x434380)){return _0x303043(msgResponse(_0xff17('0x21b'),_0xff17('0x47'),_0xff17('0x21c')+_0x434380));}if(_0x21c8f1<=0x0||isNaN(_0x21c8f1)){return _0x303043(msgResponse(_0xff17('0x21b'),_0xff17('0x47'),'Umin\x20=\x20'+_0x21c8f1));}_0x3560e4=_0x3560e4||0x0;var _0x3e7a11=0x1/_0x36388f;var _0x43f986=0x0;var _0x41a937=0x0;var _0x5d156a=0x0;var _0x4fcea2=0x0;for(var _0x33659f=0x0;_0x4fcea2<_0x21c8f1;_0x33659f+=0x1){_0x41a937=_0x33659f/_0x434380;_0x43f986=(_0x44f462*_0x41a937+_0x3560e4)/_0x3e7a11;_0x5d156a=erlangb(_0x43f986,_0x4707fd);_0x4fcea2=_0x43f986/_0x4707fd*(0x1-erlangb(_0x43f986,_0x4707fd));}return _0x161c6a({'erlangCalls':_0x33659f,'erlangCallToSecond':_0x434380/_0x33659f,'erlangAbandonmentRate':_0x5d156a,'erlangBusyFactor':_0x4fcea2});});};module[_0xff17('0x21d')]=Dialer; \ No newline at end of file +var _0x4ae4=['dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','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','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','endtime','clearZombieChannels','actions','[actions]','isNil','Action','status','channel','No\x20such\x20channel','[Dialer][checkChannel]','queue','updateOriginated','campaigns','countReScheduled','resolve','catch','[countReScheduled]\x20','checkIsBlackList','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','saveInDb','syncVarSet','uniqueId','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countglobal','amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','countmachineretry','dialMachineMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','ListId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countabandonedretry','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','AnswerAGI','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','roundrobin','locked','paused','stateinterface','push','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','run','idHopper','[booked][RR][finaly]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','predictive','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originate][error]','Error','originate\x20action\x20Error','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','[handlePredictive]','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','checkContactBlack','tryOriginatePredictive','reachable','[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','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','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./action','./history','./final','./queueCallerAbandon','./hangup','env','rrmemory','prototype','enqueue','tail','sequence','preview','voiceQueues','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','queuecallerabandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','hangup','syncHangup','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','Interval','name','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod'];(function(_0x535d83,_0x16d2fc){var _0x4da204=function(_0x5809b9){while(--_0x5809b9){_0x535d83['push'](_0x535d83['shift']());}};_0x4da204(++_0x16d2fc);}(_0x4ae4,0x1c0));var _0x44ae=function(_0x34bfd8,_0x24eaa3){_0x34bfd8=_0x34bfd8-0x0;var _0x122c91=_0x4ae4[_0x34bfd8];return _0x122c91;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x44ae('0x0'));var uuid=require(_0x44ae('0x1'));var moment=require(_0x44ae('0x2'));var rr=require('rr');var md5=require(_0x44ae('0x3'));var Redis=require(_0x44ae('0x4'));var ut=require(_0x44ae('0x5'));var config=require('../../../config/environment/');var logger=require(_0x44ae('0x6'))('dialer');var loggerBooked=require(_0x44ae('0x6'))('booked');var loggerPredictive=require(_0x44ae('0x6'))('predictive');var loggerPredictiveCalls=require(_0x44ae('0x6'))(_0x44ae('0x7'));var loggerSyncQueueSummary=require(_0x44ae('0x6'))('syncQueueSummary');var ami=require('../ami');config[_0x44ae('0x8')]=_[_0x44ae('0x9')](config[_0x44ae('0x8')],{'host':_0x44ae('0xa'),'port':0x18eb});var io=require(_0x44ae('0xb'))(new Redis(config['redis']));var cmHopper=require(_0x44ae('0xc'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x44ae('0xd'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x44ae('0xe'));var Action=require(_0x44ae('0xf'));var History=require(_0x44ae('0x10'));var Final=require(_0x44ae('0x11'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x44ae('0x12'));var Hangup=require(_0x44ae('0x13'));var ipAgi=process[_0x44ae('0x14')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0x44ae('0x15'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x44ae('0x16')][_0x44ae('0x17')]=function(_0x7ffdc8){this['tail']=this[_0x44ae('0x18')]?this[_0x44ae('0x18')]['finally'](_0x7ffdc8):_0x7ffdc8();};function Dialer(_0x335862,_0x24735e){this[_0x44ae('0x19')]=new Sequence();this[_0x44ae('0x1a')]=_0x24735e;this[_0x44ae('0x1b')]=_0x335862[_0x44ae('0x1b')];this['campaigns']=_0x335862['campaigns'];this[_0x44ae('0x1c')]=_0x335862[_0x44ae('0x1c')];this[_0x44ae('0x1d')]=_0x335862[_0x44ae('0x1d')];this[_0x44ae('0x1e')]=config[_0x44ae('0x1e')]||0x2;this[_0x44ae('0x1f')]={};this['actions']={};this[_0x44ae('0x20')]={};this['uniqueId']={};this[_0x44ae('0x21')]={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this[_0x44ae('0x22')]={};this[_0x44ae('0x23')]={};ami['on'](_0x44ae('0x24'),this[_0x44ae('0x25')]['bind'](this));ami['on'](_0x44ae('0x26'),this['syncQueueCallerAbandon'][_0x44ae('0x27')](this));ami['on'](_0x44ae('0x28'),this[_0x44ae('0x29')]['bind'](this));ami['on'](_0x44ae('0x2a'),this[_0x44ae('0x2b')]['bind'](this));ami['on'](_0x44ae('0x2c'),this[_0x44ae('0x2d')][_0x44ae('0x27')](this));ami['on'](_0x44ae('0x2e'),this[_0x44ae('0x2f')][_0x44ae('0x27')](this));ami['on']('newexten',this['syncNewExten'][_0x44ae('0x27')](this));ami['on'](_0x44ae('0x30'),this['syncVarSet'][_0x44ae('0x27')](this));ami['on'](_0x44ae('0x31'),this[_0x44ae('0x32')][_0x44ae('0x27')](this));ami['on']('queuestatuscomplete',this[_0x44ae('0x33')][_0x44ae('0x27')](this));this[_0x44ae('0x34')]();this[_0x44ae('0x35')]();}function isNotNull(_0x307226){return _0x307226!==null&&!_[_0x44ae('0x36')](_0x307226);}function checkIsLoggedIn(_0x3447fa,_0x26f4d4){return function(){if(_0x26f4d4<=0x0){_0x3447fa['message']=_0x44ae('0x37');throw _0x3447fa['name']+_0x44ae('0x38');}};}function isActive(_0x562959){return _0x562959;}function checkIsActive(_0x483e11,_0x28a842){return function(){if(!isActive(_0x28a842)){_0x483e11[_0x44ae('0x39')]=_0x44ae('0x3a');throw _0x483e11['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x56c07e){return function(){if(!isNotNull(_0x56c07e[_0x44ae('0x3b')])){_0x56c07e[_0x44ae('0x39')]='INTERVAL_IS_NULL';throw _0x56c07e[_0x44ae('0x3c')]+_0x44ae('0x3d');}if(!isNotNull(_0x56c07e[_0x44ae('0x3b')][_0x44ae('0x3e')])){_0x56c07e[_0x44ae('0x39')]=_0x44ae('0x3f');throw _0x56c07e['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x56c07e[_0x44ae('0x3b')][_0x44ae('0x3e')]))){_0x56c07e[_0x44ae('0x39')]=_0x44ae('0x3f');throw _0x56c07e[_0x44ae('0x3c')]+_0x44ae('0x3d');}};}function msgResponse(_0x1b30e8,_0x3b06fe,_0x1645d7){return{'action':_0x1b30e8,'response':_0x3b06fe,'message':_0x1645d7,'stack':_0x1645d7};}function myreject(_0x437f46){return function(_0x34de37){return _0x437f46(msgResponse('[ifTime][Action]','Error',JSON[_0x44ae('0x40')](_0x34de37)));};}function getSeconds(_0x341c7a,_0x326914){var _0x157836=moment(_0x341c7a)['milliseconds'](0x0);var _0x117728=moment(_0x326914)[_0x44ae('0x41')](0x0);return _0x157836[_0x44ae('0x42')](_0x117728,_0x44ae('0x43'));}function emit(_0x39e47d,_0x44c5f6,_0x521ced){io['to'](_0x39e47d)[_0x44ae('0x44')](_0x44c5f6,_0x521ced);}function emitVoiceQueueSummary(_0xd39668){if(_0xd39668[_0x44ae('0x45')]===_0x44ae('0x46')){var _0x56fd24={'id':_0xd39668['id'],'name':_0xd39668[_0x44ae('0x3c')],'strategy':_0xd39668[_0x44ae('0x47')],'answered':_0xd39668[_0x44ae('0x48')],'available':_0xd39668[_0x44ae('0x49')],'loggedIn':_0xd39668['loggedIn'],'pTalking':_0xd39668['pTalking'],'sumBillable':_0xd39668['sumBillable'],'sumDuration':_0xd39668[_0x44ae('0x4a')],'sumHoldTime':_0xd39668[_0x44ae('0x4b')]||0x0,'talking':_0xd39668[_0x44ae('0x4c')],'total':_0xd39668[_0x44ae('0x4d')],'type':_0xd39668[_0x44ae('0x45')],'unmanaged':_0xd39668[_0x44ae('0x4e')],'abandoned':_0xd39668['abandoned'],'waiting':_0xd39668[_0x44ae('0x4f')],'loggedInDb':_0xd39668[_0x44ae('0x50')],'dialActive':_0xd39668[_0x44ae('0x51')],'dialMethod':_0xd39668[_0x44ae('0x52')],'dialOriginateCallerIdName':_0xd39668[_0x44ae('0x53')],'dialOriginateCallerIdNumber':_0xd39668[_0x44ae('0x54')],'dialOriginateTimeout':_0xd39668[_0x44ae('0x55')],'dialPrefix':_0xd39668[_0x44ae('0x56')],'outboundAnswerAgiCallsDay':_0xd39668[_0x44ae('0x57')],'outboundAnswerCallsDay':_0xd39668[_0x44ae('0x58')],'outboundBlacklistCallsDay':_0xd39668[_0x44ae('0x59')],'outboundBusyCallsDay':_0xd39668[_0x44ae('0x5a')],'outboundCongestionCallsDay':_0xd39668[_0x44ae('0x5b')],'outboundDropCallsDayACS':_0xd39668['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0xd39668[_0x44ae('0x5c')],'outboundDropCallsDayTimeout':_0xd39668['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0xd39668[_0x44ae('0x5d')],'outboundNoSuchCallsDay':_0xd39668[_0x44ae('0x5e')],'outboundOriginateFailureCallsDay':_0xd39668[_0x44ae('0x5f')],'outboundReCallsDay':_0xd39668[_0x44ae('0x60')],'outboundRejectCallsDay':_0xd39668[_0x44ae('0x61')],'outboundUnknownCallsDay':_0xd39668[_0x44ae('0x62')],'predictiveIntervalAnsweredCalls':_0xd39668['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xd39668[_0x44ae('0x63')],'predictiveIntervalAvgTalktime':_0xd39668[_0x44ae('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0xd39668[_0x44ae('0x65')],'predictiveIntervalDroppedCallsTimeout':_0xd39668[_0x44ae('0x66')],'predictiveIntervalErlangCalls':_0xd39668[_0x44ae('0x67')],'predictiveIntervalErlangCallsDroppedCalls':_0xd39668['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xd39668['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xd39668['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xd39668['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xd39668[_0x44ae('0x68')],'predictiveIntervalTotalCalls':_0xd39668[_0x44ae('0x69')],'message':_0xd39668['message'],'originated':_0xd39668[_0x44ae('0x6a')],'erlangCalls':_0xd39668[_0x44ae('0x6b')],'erlangCallToSecond':_0xd39668['erlangCallToSecond'],'erlangAbandonmentRate':_0xd39668[_0x44ae('0x6c')],'erlangBusyFactor':_0xd39668[_0x44ae('0x6d')],'startPredictive':_0xd39668[_0x44ae('0x6e')],'startProgressive':_0xd39668[_0x44ae('0x6f')]};if(_0xd39668[_0x44ae('0x70')]){_0x56fd24[_0x44ae('0x70')]={'id':_0xd39668[_0x44ae('0x70')]['id'],'name':_0xd39668['Trunk'][_0x44ae('0x3c')],'active':_0xd39668[_0x44ae('0x70')][_0x44ae('0x71')],'callerid':_0xd39668[_0x44ae('0x70')][_0x44ae('0x72')]};}if(_0xd39668[_0x44ae('0x3b')]){_0x56fd24[_0x44ae('0x3b')]={'id':_0xd39668[_0x44ae('0x3b')]['id'],'name':_0xd39668['Interval']['name']};}var _0x294e25=md5(JSON[_0x44ae('0x40')](_0x56fd24));if(_0xd39668[_0x44ae('0x3')]!==_0x294e25){_0xd39668['md5']=_0x294e25;emit(util[_0x44ae('0x73')](_0x44ae('0x74'),_0x56fd24['name']),_0x44ae('0x75'),_0x56fd24);}}}function emitCampaignSummary(_0x2bca18){if(_0x2bca18[_0x44ae('0x45')]===_0x44ae('0x76')){emit(util[_0x44ae('0x73')]('campaign:ivr:%s',_0x2bca18[_0x44ae('0x3c')]),_0x44ae('0x77'),_0x2bca18);}}function checkGetDataPredictive(_0x1bf808){if(isNotNull(_0x1bf808)){if(!_[_0x44ae('0x78')](_0x1bf808)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x44ae('0x79')](_0x44ae('0x7a'),_0x1bf808[_0x44ae('0x69')]);loggerPredictive['info'](_0x44ae('0x7b'),_0x1bf808[_0x44ae('0x7c')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1bf808[_0x44ae('0x66')]);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x7d'),_0x1bf808[_0x44ae('0x65')]);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x7e'),_0x1bf808[_0x44ae('0x63')]);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x7f'),_0x1bf808[_0x44ae('0x64')]);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x80'));if(_0x1bf808['predictiveIntervalTotalCalls']>0x0){if(!_[_0x44ae('0x36')](_0x1bf808[_0x44ae('0x64')])&&_0x1bf808['predictiveIntervalAvgTalktime']>0x0){return!![];}else{loggerPredictive[_0x44ae('0x79')](_0x44ae('0x81'));}if(!_['isUndefined'](_0x1bf808[_0x44ae('0x63')])&&_0x1bf808['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x44ae('0x79')](_0x44ae('0x82'));}}else{loggerPredictive[_0x44ae('0x79')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x44ae('0x79')](_0x44ae('0x83'));}return![];}function mergeDataErlangB(_0x2c71ff){return function(_0x3c5cda){loggerPredictive[_0x44ae('0x79')](_0x44ae('0x84'));loggerPredictive[_0x44ae('0x79')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c5cda['erlangCalls']);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x85'),_0x3c5cda[_0x44ae('0x86')]);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x87'),_0x3c5cda[_0x44ae('0x6c')]);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x88'),_0x3c5cda[_0x44ae('0x6d')]);loggerPredictive[_0x44ae('0x79')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3c5cda[_0x44ae('0x6c')]);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x80'));_[_0x44ae('0x89')](_0x2c71ff,_0x3c5cda);};}function getDiff(_0x119f57){var _0xc31aaa=moment()[_0x44ae('0x41')](0x0);var _0x354cd5=moment(_0x119f57)[_0x44ae('0x41')](0x0);return _0xc31aaa['diff'](_0x354cd5,_0x44ae('0x43'));}function ifInterval(_0x5439a2,_0x179cc4){if(_[_0x44ae('0x36')](_0x179cc4)){return![];}if(getDiff(_0x179cc4)<_0x5439a2*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x36ca19){if(isNotNull(_0x36ca19)){if(!_[_0x44ae('0x36')](_0x36ca19[_0x44ae('0x6f')])){_0x36ca19['startProgressive']=undefined;loggerPredictive[_0x44ae('0x79')](_0x36ca19[_0x44ae('0x3c')],_0x44ae('0x8a'));}if(!_[_0x44ae('0x36')](_0x36ca19['startPredictive'])){_0x36ca19[_0x44ae('0x6e')]=undefined;loggerPredictive[_0x44ae('0x79')](_0x36ca19[_0x44ae('0x3c')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x44ae('0x36')](_0x36ca19[_0x44ae('0x8b')])){clearInterval(_0x36ca19[_0x44ae('0x8b')]);_0x36ca19['handlePredictive']=undefined;loggerPredictive[_0x44ae('0x79')](_0x36ca19[_0x44ae('0x3c')],_0x44ae('0x8c'));}}}function erlangb(_0x3c1aa9,_0x1ca559){if(_0x1ca559===0x0){return 0x0;}var _0x1ccebe=0x1;for(var _0x16dbf5=0x1;_0x16dbf5<=_0x1ca559;_0x16dbf5+=0x1){_0x1ccebe=0x1+_0x1ccebe*_0x16dbf5/_0x3c1aa9;}return 0x1/_0x1ccebe;}function isVoiceQueueOutbound(_0x3ecebc){return _0x3ecebc==='outbound';}function isNotPreview(_0x1b9fe1){return _0x1b9fe1!==_0x44ae('0x1a');}function isCampaignIvr(_0x21da78){return _0x21da78===_0x44ae('0x76');}function getCallerId(_0x186740,_0x1dca87,_0x1aad49){if(!_[_0x44ae('0x36')](_0x1aad49)&&_0x44ae('0x8d')===typeof _0x1aad49&&!_[_0x44ae('0x78')](_0x1aad49)){if(!_[_0x44ae('0x36')](_0x1dca87)&&_0x44ae('0x8d')===typeof _0x1dca87&&!_[_0x44ae('0x78')](_0x1dca87)){return util['format']('\x22%s\x22\x20<%s>',_0x1dca87,_0x1aad49);}return util[_0x44ae('0x73')](_0x44ae('0x8e'),_0x1aad49,_0x1aad49);}if(!_[_0x44ae('0x36')](_0x186740)&&_0x44ae('0x8d')===typeof _0x186740&&!_['isEmpty'](_0x186740)){return _0x186740;}return _0x44ae('0x8f');}function loggerCatchQueueSummary(_0x24cc67,_0x5e5e29){return function(_0x448f63){freeVariablesPredictive(_0x5e5e29);emitVoiceQueueSummary(_0x5e5e29);emitCampaignSummary(_0x5e5e29);loggerSyncQueueSummary[_0x44ae('0x90')](_0x24cc67,util[_0x44ae('0x91')](_0x448f63,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x336ca8,_0x5e65a9){return function(_0x13ca01){loggerPredictive[_0x44ae('0x90')](_0x5e65a9['name'],_0x336ca8);loggerPredictive[_0x44ae('0x90')](_0x13ca01[_0x44ae('0x92')]);freeVariablesPredictive(_0x5e65a9);};}function loggerCatch(_0x45cb2b){return function(_0x316bd5){logger[_0x44ae('0x90')](_0x45cb2b,util['inspect'](_0x316bd5,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x593717){return _0x593717&&!_[_0x44ae('0x36')](_0x593717)&&_0x593717[_0x44ae('0x93')]>0x0;}function decremetOriginate(_0x322ae0){if(!_[_0x44ae('0x36')](_0x322ae0)&&_0x322ae0!==null){if(_0x322ae0[_0x44ae('0x94')]('originated')){if(_0x322ae0['originated']>0x0){_0x322ae0[_0x44ae('0x6a')]-=0x1;}else{logger['error'](_0x44ae('0x95'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x23a3e5,_0x228914,_0x16d8f7){if(_0x228914>_0x16d8f7){for(var _0x27b9c3=0x0;_0x27b9c3<_0x228914-_0x16d8f7;_0x27b9c3+=0x1){decremetOriginate(_0x23a3e5);}}}function loggerGetContactDialer(_0xedbfee,_0x17ee9b,_0x556260){return function(_0x306f6a){checkContactLowerLimitOriginate(_0x17ee9b,_0x556260,0x0);logger[_0x44ae('0x90')](_0xedbfee,util['inspect'](_0x306f6a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x54fe1a){return function(_0x3b7243){if(isNotNull(_0x3b7243)&&isNotNull(_0x3b7243[0x0])){if(_0x3b7243[0x0][_0x44ae('0x96')]>0x0){_0x54fe1a[_0x44ae('0x39')]=_0x44ae('0x97');logger[_0x44ae('0x79')](_0x44ae('0x98')+_0x54fe1a[_0x44ae('0x3c')],_0x3b7243[0x0][_0x44ae('0x96')],_0x44ae('0x99'));}else{_0x54fe1a['message']=_0x44ae('0x9a');logger['info'](_0x44ae('0x9b')+_0x54fe1a[_0x44ae('0x3c')]);}}};}function notSendMessagesQueue(_0x50a73f){if(_0x50a73f[_0x44ae('0x9c')]){freeVariablesPredictive(_0x50a73f);if(_0x50a73f[_0x44ae('0x6a')]===0x0&&_0x50a73f['talking']===0x0&&_0x50a73f[_0x44ae('0x4f')]===0x0&&(_0x50a73f[_0x44ae('0x9d')]||0x0)===0x0){_0x50a73f[_0x44ae('0x9c')]=![];_0x50a73f[_0x44ae('0x49')]=0x0;_0x50a73f[_0x44ae('0x39')]=_0x44ae('0x3a');loggerSyncQueueSummary[_0x44ae('0x90')](_0x44ae('0x9e'),_0x50a73f['name'],_0x44ae('0x9f'));}else{_0x50a73f['message']=_0x44ae('0xa0');loggerSyncQueueSummary[_0x44ae('0x90')](_0x44ae('0x9e'),_0x50a73f['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x50a73f);}}function notSendMessagesCampaign(_0x50f416){if(_0x50f416[_0x44ae('0x9c')]){if(_0x50f416[_0x44ae('0x6a')]===0x0){_0x50f416[_0x44ae('0x9c')]=![];_0x50f416[_0x44ae('0x39')]=_0x44ae('0x3a');loggerSyncQueueSummary[_0x44ae('0x90')](_0x44ae('0xa1'),_0x50f416['name'],_0x44ae('0x9f'));}else{_0x50f416['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x44ae('0x90')](_0x44ae('0xa1'),_0x50f416['name'],_0x44ae('0xa2'));}emitCampaignSummary(_0x50f416);}}function createObjHistory(_0x101be8,_0x3ac7b5,_0x14edda,_0x59d7ab,_0x4b4547){_0x101be8[_0x44ae('0x39')]=_0x14edda;var _0xe86749=new Action(_0x101be8,_0x3ac7b5);var _0x295ff9=new History(_0xe86749);_0x295ff9[_0x44ae('0xa3')]=_0x59d7ab;_0x295ff9[_0x44ae('0xa4')]=_0x4b4547;_0x295ff9[_0x44ae('0xa5')]=_0xe86749['starttime'];return _0x295ff9;}Dialer['prototype'][_0x44ae('0x35')]=function(){var _0x312192=this;setInterval(function(){_0x312192[_0x44ae('0xa6')](_0x312192['uniqueId'],'[uniqueid]');_0x312192[_0x44ae('0xa6')](_0x312192[_0x44ae('0xa7')],_0x44ae('0xa8'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x34721c,_0x54d0fc){var _0x22adea=this;for(var _0xd89009 in _0x34721c){if(_0x34721c[_0x44ae('0x94')](_0xd89009)){this['sequence']['enqueue'](function(){if(!_[_0x44ae('0xa9')](_0x34721c[_0xd89009])){return ami[_0x44ae('0xaa')]({'action':_0x44ae('0xab'),'channel':_0x34721c[_0xd89009][_0x44ae('0xac')]})['catch'](function(_0x2fef1f){if(_0x2fef1f[_0x44ae('0x39')]===_0x44ae('0xad')){setTimeout(function(){if(_0x34721c[_0xd89009]&&_0x34721c[_0xd89009][_0x44ae('0x45')]!==_0x44ae('0x76')){_0x22adea['updateOriginated'](_0x22adea[_0x44ae('0x1b')][_0x34721c[_0xd89009]['queue']]);logger[_0x44ae('0x90')](_0x44ae('0xae'),_0x54d0fc,_0xd89009,_0x34721c[_0xd89009][_0x44ae('0xaf')]);delete _0x34721c[_0xd89009];}if(_0x34721c[_0xd89009]&&_0x34721c[_0xd89009]['type']===_0x44ae('0x76')){_0x22adea[_0x44ae('0xb0')](_0x22adea[_0x44ae('0xb1')][_0x34721c[_0xd89009][_0x44ae('0xaf')]]);logger[_0x44ae('0x90')]('[Dialer][checkChannel][ivr]',_0x54d0fc,_0xd89009,_0x34721c[_0xd89009][_0x44ae('0xaf')]);delete _0x34721c[_0xd89009];}},0x2328);}});}});}}};Dialer['prototype'][_0x44ae('0xb2')]=function(_0x13dd51){return BPromise[_0x44ae('0xb3')]()['then'](cmHopper[_0x44ae('0xb2')](_0x13dd51))[_0x44ae('0xb4')](loggerCatch(_0x44ae('0xb5')));};Dialer[_0x44ae('0x16')][_0x44ae('0xb6')]=function(_0x24d728){return BPromise['resolve']()[_0x44ae('0xb7')](cmHopperBlack['checkIsBlackList'](_0x24d728))[_0x44ae('0xb4')](loggerCatch(_0x44ae('0xb8')));};Dialer[_0x44ae('0x16')][_0x44ae('0xb9')]=function(_0x35af31){return BPromise[_0x44ae('0xb3')]()[_0x44ae('0xb7')](cmHopperBlack[_0x44ae('0xb9')](_0x35af31))[_0x44ae('0xb4')](loggerCatch(_0x44ae('0xba')));};Dialer['prototype'][_0x44ae('0xbb')]=function(_0x16f98b){return BPromise[_0x44ae('0xb3')]()[_0x44ae('0xb7')](cmHopperHistory[_0x44ae('0xbc')](_0x16f98b))[_0x44ae('0xb4')](loggerCatch(_0x44ae('0xbd')));};Dialer[_0x44ae('0x16')][_0x44ae('0xbe')]=function(_0x1d12df){return BPromise[_0x44ae('0xb3')]()[_0x44ae('0xb7')](cmHopper[_0x44ae('0xbe')](_0x1d12df))[_0x44ae('0xb4')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x44ae('0x16')][_0x44ae('0xbf')]=function(_0x55cb98,_0x50a512,_0x3c7946){return BPromise[_0x44ae('0xb3')]()['then'](cmHopper['unlockContact'](_0x55cb98,_0x50a512,_0x3c7946))[_0x44ae('0xb4')](loggerCatch(_0x44ae('0xc0')));};Dialer[_0x44ae('0x16')][_0x44ae('0xc1')]=function(_0x54cd7e,_0x1206bd,_0x51017c,_0xf8948f){return BPromise['resolve']()['then'](cmHopper[_0x44ae('0xc1')](_0x54cd7e,_0x1206bd,_0x51017c,_0xf8948f))[_0x44ae('0xb4')](loggerCatch(_0x44ae('0xc2')));};Dialer[_0x44ae('0x16')][_0x44ae('0xc3')]=function(_0x2c6e1a,_0xada961,_0x2c4006){return BPromise[_0x44ae('0xb3')]()[_0x44ae('0xb7')](cmHopper[_0x44ae('0xc3')](_0x2c6e1a,_0xada961,_0x2c4006))['catch'](loggerCatch(_0x44ae('0xc2')));};Dialer[_0x44ae('0x16')][_0x44ae('0xc4')]=function(_0x501c91){return BPromise[_0x44ae('0xb3')]()[_0x44ae('0xb7')](voiceQueueRt[_0x44ae('0xc4')](_0x501c91))['catch'](loggerCatch(_0x44ae('0xc5')));};Dialer[_0x44ae('0x16')]['moveContactManagedDialer']=function(_0x539340){return BPromise[_0x44ae('0xb3')]()['then'](cmHopper[_0x44ae('0xc6')](_0x539340))['catch'](loggerCatch(_0x44ae('0xc7')));};Dialer['prototype'][_0x44ae('0xc8')]=function(_0x68d7a8){return BPromise[_0x44ae('0xb3')]()[_0x44ae('0xb7')](cmHopperHistory['createHistory'](_0x68d7a8))[_0x44ae('0xb4')](loggerCatch('[createHistory]\x20'));};Dialer[_0x44ae('0x16')][_0x44ae('0xb0')]=function(_0xbec78e){if(!_[_0x44ae('0x36')](_0xbec78e)&&_0xbec78e!==null){if(_0xbec78e[_0x44ae('0x94')](_0x44ae('0x6a'))){if(_0xbec78e[_0x44ae('0x6a')]>0x0){_0xbec78e['originated']-=0x1;}else{logger[_0x44ae('0x90')](_0x44ae('0xc9'));}}}else{logger[_0x44ae('0x90')](_0x44ae('0xca'));}};Dialer[_0x44ae('0x16')][_0x44ae('0xcb')]=function(_0x3e164f,_0x174895){var _0x34343=this;return function(_0x8bf13a){_0x34343['updateOriginated'](_0x174895);logger[_0x44ae('0x90')](_0x3e164f,util[_0x44ae('0x91')](_0x8bf13a,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x44ae('0xcc')]=function(_0x330a65,_0x136832,_0x3c08cb){var _0x29175c={'state':0x19,'statedesc':'notFound'};this[_0x44ae('0xb0')](_0x136832);this['saveInDb'](_[_0x44ae('0x89')](_0x29175c,_[_0x44ae('0xcd')](_0x3c08cb,[_0x44ae('0xce'),'ListId',_0x44ae('0xcf'),_0x44ae('0xd0'),_0x44ae('0xd1')])),_0x44ae('0xd2'),_0x44ae('0xd3'));logger[_0x44ae('0x90')](_0x330a65);};Dialer[_0x44ae('0x16')][_0x44ae('0xd4')]=function(_0x2c2495){return _0x2c2495===_0x44ae('0xd5');};Dialer[_0x44ae('0x16')][_0x44ae('0xd6')]=function(_0x44ddb5){return!_[_0x44ae('0x36')](_0x44ddb5)&&_0x44ddb5&&!_[_0x44ae('0x36')](_0x44ddb5[_0x44ae('0x3c')])&&!_[_0x44ae('0x36')](_0x44ddb5[_0x44ae('0x71')])&&_0x44ddb5[_0x44ae('0x71')]&&(this[_0x44ae('0x1d')][util[_0x44ae('0x73')](_0x44ae('0xd7'),_0x44ddb5[_0x44ae('0x3c')])][_0x44ae('0xab')]==='reachable'||this[_0x44ae('0x1d')][util[_0x44ae('0x73')](_0x44ae('0xd7'),_0x44ddb5[_0x44ae('0x3c')])]['status']==='unmonitored');};Dialer[_0x44ae('0x16')][_0x44ae('0xd8')]=function(_0x1ba3fb,_0x206702,_0x4d387f){this['createHistory'](_0x1ba3fb)['catch'](loggerCatch(_0x206702));this[_0x44ae('0xc6')](_0x1ba3fb)[_0x44ae('0xb4')](loggerCatch(_0x4d387f));};Dialer[_0x44ae('0x16')][_0x44ae('0xd9')]=function(_0x36bde8){var _0xb398bb=this[_0x44ae('0xda')][_0x36bde8['uniqueid']];var _0x128302;if(!_[_0x44ae('0xa9')](_0x36bde8)&&!_[_0x44ae('0xa9')](_0x36bde8[_0x44ae('0xdb')])&&!_[_0x44ae('0xa9')](_0x36bde8[_0x44ae('0xdb')][_0x44ae('0xdc')])&&_0x36bde8['exten']===_0x44ae('0xdd')&&_0xb398bb){if(_0xb398bb[_0x44ae('0x45')]!=='ivr'&&this[_0x44ae('0x1b')][_0xb398bb[_0x44ae('0xaf')]][_0x44ae('0xde')]&&_0x36bde8[_0x44ae('0xdf')]===_0x44ae('0xe0')){delete this[_0x44ae('0xda')][_0x36bde8[_0x44ae('0xe1')]];this[_0x44ae('0xb0')](this[_0x44ae('0x1b')][_0xb398bb[_0x44ae('0xaf')]]);this[_0x44ae('0x1b')][_0xb398bb[_0x44ae('0xaf')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0xb398bb[_0x44ae('0xaf')]][_0x44ae('0x57')]+=0x1;_0x128302=new Hangup(_0xb398bb,_0x36bde8);_0x128302[_0x44ae('0xa3')]=0x12;_0x128302[_0x44ae('0xa4')]='HangupInAMD';_0x128302[_0x44ae('0xe2')]=_0x44ae('0xe3');this[_0x44ae('0xd8')](_0x128302,_0x44ae('0xe4'),_0x44ae('0xe5'));}if(_0xb398bb[_0x44ae('0x45')]!=='ivr'&&this['voiceQueues'][_0xb398bb[_0x44ae('0xaf')]]['dialAMDActive']&&_0x36bde8[_0x44ae('0xdf')]===_0x44ae('0xe6')){var _0x16a8df=this;return new BPromise(function(_0x15019c,_0x3be823){delete _0x16a8df[_0x44ae('0xda')][_0x36bde8['uniqueid']];_0x16a8df['updateOriginated'](_0x16a8df[_0x44ae('0x1b')][_0xb398bb['queue']]);_0x16a8df[_0x44ae('0x1b')][_0xb398bb[_0x44ae('0xaf')]][_0x44ae('0x58')]+=0x1;_0x16a8df[_0x44ae('0x1b')][_0xb398bb[_0x44ae('0xaf')]][_0x44ae('0x57')]+=0x1;var _0x16bffd=_0x16a8df[_0x44ae('0x1b')][_0xb398bb[_0x44ae('0xaf')]];var _0x33354a=new Hangup(_0xb398bb,_0x36bde8);_0x33354a[_0x44ae('0xa3')]=0x13;_0x33354a[_0x44ae('0xa4')]=_0x44ae('0xe7');_0x33354a[_0x44ae('0xe2')]='AMD';_0x33354a['countmachineretry']+=0x1;_0x33354a[_0x44ae('0xe8')]+=0x1;_0x33354a[_0x44ae('0xe9')]=!![];_0x16a8df['createHistory'](_0x33354a)[_0x44ae('0xb4')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x33354a[_0x44ae('0xea')]+_0x33354a[_0x44ae('0xeb')]+_0x33354a['countnoanswerretry']+_0x33354a[_0x44ae('0xec')]+_0x33354a[_0x44ae('0xed')]+_0x33354a['countabandonedretry']+_0x33354a['countmachineretry']+_0x33354a[_0x44ae('0xee')]>=_0x16bffd[_0x44ae('0xef')]){_0x16a8df[_0x44ae('0xf0')](_0x33354a,_0x15019c,_0x3be823,_0x44ae('0xf1'));}else{if(_0x33354a[_0x44ae('0xf2')]>=_0x16bffd[_0x44ae('0xf3')]){_0x16a8df[_0x44ae('0xf4')](_0x33354a,_0x15019c,_0x3be823,'reason\x2019\x20machine....');}else{_0x16a8df[_0x44ae('0xbe')]({'active':![],'countmachineretry':_0x33354a['countmachineretry'],'scheduledat':moment()[_0x44ae('0xf5')](_0x16bffd[_0x44ae('0xf6')],_0x44ae('0xf7'))[_0x44ae('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x33354a[_0x44ae('0xce')],'ListId':_0x33354a[_0x44ae('0xf8')],'VoiceQueueId':_0x33354a[_0x44ae('0xd0')]||undefined,'CampaignId':_0x33354a['CampaignId']||undefined})['catch'](loggerCatch(_0x44ae('0xf9')));_0x15019c({'reschedule':0x1});}}});}if(_0xb398bb[_0x44ae('0x45')]===_0x44ae('0x76')&&this[_0x44ae('0xb1')][_0xb398bb[_0x44ae('0xaf')]]['dialAMDActive']&&_0x36bde8['value']===_0x44ae('0xe0')){delete this['uniqueId'][_0x36bde8[_0x44ae('0xe1')]];this[_0x44ae('0xb0')](this['campaigns'][_0xb398bb['queue']]);_0x128302=new Hangup(_0xb398bb,_0x36bde8);_0x128302['state']=0x12;_0x128302[_0x44ae('0xa4')]=_0x44ae('0xfa');_0x128302[_0x44ae('0xe2')]=_0x44ae('0xe3');this['saveInDb'](_0x128302,_0x44ae('0xfb'),_0x44ae('0xfc'));}if(_0xb398bb['type']===_0x44ae('0x76')&&this[_0x44ae('0xb1')][_0xb398bb[_0x44ae('0xaf')]][_0x44ae('0xde')]&&_0x36bde8[_0x44ae('0xdf')]===_0x44ae('0xe6')){var _0x16a8df=this;return new BPromise(function(_0x173342,_0x2eab8d){delete _0x16a8df[_0x44ae('0xda')][_0x36bde8[_0x44ae('0xe1')]];_0x16a8df['updateOriginated'](_0x16a8df[_0x44ae('0xb1')][_0xb398bb[_0x44ae('0xaf')]]);_0x16a8df[_0x44ae('0xb1')][_0xb398bb[_0x44ae('0xaf')]][_0x44ae('0x58')]+=0x1;_0x16a8df['campaigns'][_0xb398bb['queue']][_0x44ae('0x57')]+=0x1;var _0x559d30=_0x16a8df[_0x44ae('0xb1')][_0xb398bb[_0x44ae('0xaf')]];var _0x451a1a=new Hangup(_0xb398bb,_0x36bde8);_0x451a1a[_0x44ae('0xa3')]=0x13;_0x451a1a[_0x44ae('0xa4')]=_0x44ae('0xe7');_0x451a1a[_0x44ae('0xe2')]=_0x44ae('0xe3');_0x451a1a['countmachineretry']+=0x1;_0x451a1a['countglobal']+=0x1;_0x451a1a[_0x44ae('0xe9')]=!![];_0x16a8df['createHistory'](_0x451a1a)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0xfd')));if(_0x451a1a[_0x44ae('0xea')]+_0x451a1a[_0x44ae('0xeb')]+_0x451a1a['countnoanswerretry']+_0x451a1a[_0x44ae('0xec')]+_0x451a1a[_0x44ae('0xed')]+_0x451a1a[_0x44ae('0xfe')]+_0x451a1a[_0x44ae('0xf2')]+_0x451a1a[_0x44ae('0xee')]>=_0x559d30['dialGlobalMaxRetry']){_0x16a8df['stateGlobal'](_0x451a1a,_0x173342,_0x2eab8d,'reason19\x20machine....');}else{if(_0x451a1a[_0x44ae('0xf2')]>=_0x559d30['dialMachineMaxRetry']){_0x16a8df['createStateFinal'](_0x451a1a,_0x173342,_0x2eab8d,_0x44ae('0xff'));}else{_0x16a8df[_0x44ae('0xbe')]({'active':![],'countmachineretry':_0x451a1a['countmachineretry'],'scheduledat':moment()[_0x44ae('0xf5')](_0x559d30[_0x44ae('0xf6')],'minutes')[_0x44ae('0x73')](_0x44ae('0x100')),'ContactId':_0x451a1a[_0x44ae('0xce')],'ListId':_0x451a1a[_0x44ae('0xf8')],'VoiceQueueId':_0x451a1a['VoiceQueueId']||undefined,'CampaignId':_0x451a1a[_0x44ae('0xd1')]||undefined})['catch'](loggerCatch(_0x44ae('0xf9')));_0x173342({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x44ae('0x2f')]=function(_0x488f92){var _0x46c5ff=this[_0x44ae('0xda')][_0x488f92[_0x44ae('0xe1')]];var _0x455f4c=this;var _0x5be7a4;if(_0x46c5ff&&_0x46c5ff[_0x44ae('0x45')]===_0x44ae('0x76')){delete this['uniqueId'][_0x488f92['uniqueid']];this[_0x44ae('0xb0')](this[_0x44ae('0xb1')][_0x46c5ff[_0x44ae('0xaf')]]);this['campaigns'][_0x46c5ff[_0x44ae('0xaf')]][_0x44ae('0x101')]+=0x1;_0x5be7a4=new Hangup(_0x46c5ff,_0x488f92);this[_0x44ae('0xc8')](_0x5be7a4)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x102')));this[_0x44ae('0xc6')](_0x5be7a4)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x46c5ff&&_0x46c5ff['type']!==_0x44ae('0x76')&&isNotNull(this[_0x44ae('0x1b')][_0x46c5ff[_0x44ae('0xaf')]]['dialQueueProject'])){delete this[_0x44ae('0xda')][_0x488f92[_0x44ae('0xe1')]];this[_0x44ae('0xb0')](this[_0x44ae('0x1b')][_0x46c5ff[_0x44ae('0xaf')]]);this[_0x44ae('0x1b')][_0x46c5ff[_0x44ae('0xaf')]][_0x44ae('0x58')]+=0x1;this[_0x44ae('0x1b')][_0x46c5ff[_0x44ae('0xaf')]][_0x44ae('0x57')]+=0x1;_0x5be7a4=new Hangup(_0x46c5ff,_0x488f92);_0x5be7a4[_0x44ae('0xa3')]=0x10;_0x5be7a4[_0x44ae('0xa4')]=_0x44ae('0x103');_0x5be7a4[_0x44ae('0xe2')]='AGI';this[_0x44ae('0xc8')](_0x5be7a4)[_0x44ae('0xb4')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x44ae('0xc6')](_0x5be7a4)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x104')));}if(_0x46c5ff&&_0x46c5ff[_0x44ae('0x45')]!==_0x44ae('0x76')&&!isNotNull(this[_0x44ae('0x1b')][_0x46c5ff[_0x44ae('0xaf')]][_0x44ae('0x105')])){delete this[_0x44ae('0xda')][_0x488f92['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0x46c5ff['queue']]);this['voiceQueues'][_0x46c5ff['queue']][_0x44ae('0x62')]+=0x1;_0x5be7a4=new Hangup(_0x46c5ff,_0x488f92);_0x5be7a4['state']=0xc;_0x5be7a4[_0x44ae('0xa4')]=_0x488f92[_0x44ae('0x106')];_0x5be7a4[_0x44ae('0xe2')]=_0x44ae('0x107');this['createHistory'](_0x5be7a4)[_0x44ae('0xb4')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x44ae('0xc6')](_0x5be7a4)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x104')));}};Dialer[_0x44ae('0x16')][_0x44ae('0x2b')]=function(_0x5e6756){var _0x45ca27=this[_0x44ae('0xda')][_0x5e6756[_0x44ae('0xe1')]];var _0xfb174e=this;if(this[_0x44ae('0x1b')][_0x5e6756[_0x44ae('0xaf')]]){if(_0x45ca27&&_0x45ca27[_0x44ae('0x45')]!==_0x44ae('0x76')){delete this['uniqueId'][_0x5e6756[_0x44ae('0xe1')]];this[_0x44ae('0x1b')][_0x5e6756[_0x44ae('0xaf')]][_0x44ae('0x58')]+=0x1;var _0x3fe281=new AgentComplete(_0x45ca27,_0x5e6756);if(_0x5e6756['reason']==='agent'){_0x3fe281['agiafterat']=this[_0x44ae('0x1b')][_0x5e6756[_0x44ae('0xaf')]][_0x44ae('0x108')]&&this[_0x44ae('0x1b')][_0x5e6756[_0x44ae('0xaf')]][_0x44ae('0x109')]?moment()[_0x44ae('0x73')](_0x44ae('0x100')):undefined;}this[_0x44ae('0xc8')](_0x3fe281)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x10a')));this['moveContactManagedDialer'](_0x3fe281)['catch'](loggerCatch(_0x44ae('0x10b')));}}};Dialer[_0x44ae('0x16')][_0x44ae('0x25')]=function(_0x4334ee){if(this[_0x44ae('0x1b')][_0x4334ee[_0x44ae('0xaf')]]){if(this[_0x44ae('0xda')][_0x4334ee[_0x44ae('0xe1')]]&&this[_0x44ae('0xda')][_0x4334ee['uniqueid']][_0x44ae('0x45')]!==_0x44ae('0x76')){this[_0x44ae('0xb0')](this[_0x44ae('0x1b')][_0x4334ee[_0x44ae('0xaf')]]);this[_0x44ae('0xda')][_0x4334ee[_0x44ae('0xe1')]][_0x44ae('0x10c')]=moment()[_0x44ae('0x73')](_0x44ae('0x100'));}}};Dialer[_0x44ae('0x16')][_0x44ae('0x10d')]=function(_0x42f364){this[_0x44ae('0xc8')](_0x42f364)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x10a')));this[_0x44ae('0xc6')](_0x42f364)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x10e')));};Dialer[_0x44ae('0x16')]['syncQueueCallerAbandon']=function(_0x2d4b69){var _0x22c305=this[_0x44ae('0xda')][_0x2d4b69[_0x44ae('0xe1')]];var _0x438a6e=this;if(this[_0x44ae('0x1b')][_0x2d4b69['queue']]){if(_0x22c305&&_0x22c305['type']!==_0x44ae('0x76')){delete this['uniqueId'][_0x2d4b69['uniqueid']];this[_0x44ae('0xb0')](this[_0x44ae('0x1b')][_0x2d4b69[_0x44ae('0xaf')]]);_0x22c305[_0x44ae('0x10f')]=moment()[_0x44ae('0x73')]('YYYY-MM-DD\x20HH:mm:ss');var _0x54f707=new QueueCallerAbandon(_0x22c305,_0x2d4b69);if(getSeconds(_0x22c305['droptime'],_0x22c305['responsetime'])>=_0x22c305['dialQueueTimeout']){this['voiceQueues'][_0x2d4b69[_0x44ae('0xaf')]][_0x44ae('0x66')]+=0x1;this[_0x44ae('0x1b')][_0x2d4b69[_0x44ae('0xaf')]][_0x44ae('0x110')]+=0x1;this[_0x44ae('0x1b')][_0x2d4b69[_0x44ae('0xaf')]][_0x44ae('0x111')]+=0x1;_0x54f707[_0x44ae('0xa3')]=0xa;_0x54f707[_0x44ae('0xa4')]=_0x44ae('0x112');_0x54f707[_0x44ae('0x113')]=_0x44ae('0x114');_0x54f707[_0x44ae('0x115')]=this[_0x44ae('0x1b')][_0x2d4b69['queue']][_0x44ae('0x108')]?moment()[_0x44ae('0x73')](_0x44ae('0x100')):undefined;_0x54f707['countdropretry']+=0x1;_0x54f707[_0x44ae('0xe8')]+=0x1;if(_0x54f707[_0x44ae('0xed')]>=this[_0x44ae('0x1b')][_0x2d4b69['queue']][_0x44ae('0x116')]){this[_0x44ae('0x10d')](_0x54f707);}else{this[_0x44ae('0xbe')]({'active':![],'countdropretry':_0x54f707[_0x44ae('0xed')],'scheduledat':moment()['add'](this['voiceQueues'][_0x2d4b69[_0x44ae('0xaf')]][_0x44ae('0x117')],'minutes')['format'](_0x44ae('0x100')),'ContactId':_0x22c305['ContactId'],'ListId':_0x22c305[_0x44ae('0xf8')],'VoiceQueueId':_0x22c305['VoiceQueueId']||undefined,'CampaignId':_0x22c305[_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch('[rescheduleContact][Drop]'));var _0x63b7a3=new History(_0x54f707);_0x63b7a3['state']=0xa;_0x63b7a3['statedesc']='Drop';_0x63b7a3[_0x44ae('0x118')]=moment()[_0x44ae('0x73')](_0x44ae('0x100'));_0x63b7a3[_0x44ae('0xa5')]=_0x63b7a3[_0x44ae('0x118')];_0x63b7a3[_0x44ae('0x119')]=_0x54f707[_0x44ae('0x119')];_0x63b7a3[_0x44ae('0x11a')]=_0x54f707[_0x44ae('0x11a')];this[_0x44ae('0xc8')](_0x63b7a3)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x11b')));}}else{this[_0x44ae('0x1b')][_0x2d4b69['queue']][_0x44ae('0x65')]+=0x1;this['voiceQueues'][_0x2d4b69[_0x44ae('0xaf')]]['outboundDropCallsDayCallersExit']+=0x1;_0x54f707[_0x44ae('0xa3')]=0xb;_0x54f707[_0x44ae('0xa4')]=_0x44ae('0x11c');_0x54f707[_0x44ae('0x113')]=_0x44ae('0x11d');_0x54f707[_0x44ae('0xfe')]+=0x1;_0x54f707[_0x44ae('0xe8')]+=0x1;if(_0x54f707['countabandonedretry']>=this[_0x44ae('0x1b')][_0x2d4b69[_0x44ae('0xaf')]][_0x44ae('0x11e')]){this[_0x44ae('0x10d')](_0x54f707);}else{this[_0x44ae('0xbe')]({'active':![],'countabandonedretry':_0x54f707[_0x44ae('0xfe')],'scheduledat':moment()[_0x44ae('0xf5')](this[_0x44ae('0x1b')][_0x2d4b69[_0x44ae('0xaf')]][_0x44ae('0x11f')],_0x44ae('0xf7'))[_0x44ae('0x73')](_0x44ae('0x100')),'ContactId':_0x22c305['ContactId'],'ListId':_0x22c305['ListId'],'VoiceQueueId':_0x22c305[_0x44ae('0xd0')]||undefined,'CampaignId':_0x22c305[_0x44ae('0xd1')]||undefined})['catch'](loggerCatch(_0x44ae('0x120')));var _0x63b7a3=new History(_0x54f707);_0x63b7a3['state']=0xb;_0x63b7a3[_0x44ae('0xa4')]=_0x44ae('0x11c');_0x63b7a3[_0x44ae('0x118')]=moment()[_0x44ae('0x73')](_0x44ae('0x100'));_0x63b7a3['endtime']=_0x63b7a3[_0x44ae('0x118')];_0x63b7a3['calleridname']=_0x54f707[_0x44ae('0x119')];_0x63b7a3[_0x44ae('0x11a')]=_0x54f707[_0x44ae('0x11a')];this[_0x44ae('0xc8')](_0x63b7a3)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x121')));}}}}};Dialer['prototype']['syncNewExten']=function(_0x5d0e8a){if(this[_0x44ae('0xa7')][_0x5d0e8a['uniqueid']]){this['actions'][_0x5d0e8a[_0x44ae('0xe1')]][_0x44ae('0xac')]=_0x5d0e8a[_0x44ae('0xac')];}if(this[_0x44ae('0xda')][_0x5d0e8a['uniqueid']]){this[_0x44ae('0xda')][_0x5d0e8a[_0x44ae('0xe1')]][_0x44ae('0xac')]=_0x5d0e8a[_0x44ae('0xac')];}};Dialer[_0x44ae('0x16')][_0x44ae('0x32')]=function(_0x3d10a7){if(strategy[this['voiceQueues'][this['actions'][_0x3d10a7[_0x44ae('0x122')]][_0x44ae('0xaf')]][_0x44ae('0x47')]]===_0x44ae('0x123')){if(this['actions'][_0x3d10a7[_0x44ae('0x122')]]&&_[_0x44ae('0xa9')](this[_0x44ae('0xa7')][_0x3d10a7[_0x44ae('0x122')]][_0x44ae('0x124')])&&_0x3d10a7[_0x44ae('0xab')]==='1'&&_0x3d10a7[_0x44ae('0x125')]==='0'){if(this[_0x44ae('0x1c')][_0x3d10a7[_0x44ae('0x126')]]){if(!this['agents'][_0x3d10a7[_0x44ae('0x126')]][_0x44ae('0x124')]){this[_0x44ae('0x1c')][_0x3d10a7[_0x44ae('0x126')]][_0x44ae('0x124')]=!![];this[_0x44ae('0xa7')][_0x3d10a7[_0x44ae('0x122')]][_0x44ae('0x124')]=!![];this[_0x44ae('0xa7')][_0x3d10a7['actionid']][_0x44ae('0x126')]=_0x3d10a7[_0x44ae('0x126')];}}}}else if((strategy[this[_0x44ae('0x1b')][this[_0x44ae('0xa7')][_0x3d10a7[_0x44ae('0x122')]][_0x44ae('0xaf')]][_0x44ae('0x47')]]||_0x44ae('0x15'))==='rrmemory'){if(this[_0x44ae('0xa7')][_0x3d10a7['actionid']]){if(this['agents'][_0x3d10a7[_0x44ae('0x126')]]){this[_0x44ae('0xa7')][_0x3d10a7[_0x44ae('0x122')]][_0x44ae('0x126')]=_0x3d10a7['stateinterface'];if(_[_0x44ae('0xa9')](this[_0x44ae('0x22')][this[_0x44ae('0xa7')][_0x3d10a7['actionid']][_0x44ae('0xaf')]])){this['queueBooked'][this[_0x44ae('0xa7')][_0x3d10a7[_0x44ae('0x122')]][_0x44ae('0xaf')]]=[];}this[_0x44ae('0x22')][this['actions'][_0x3d10a7[_0x44ae('0x122')]][_0x44ae('0xaf')]][_0x44ae('0x127')](_['merge'](_[_0x44ae('0xcd')](this['actions'][_0x3d10a7[_0x44ae('0x122')]],['idHopper',_0x44ae('0x126')]),{'status':_0x3d10a7[_0x44ae('0xab')],'paused':_0x3d10a7[_0x44ae('0x125')]}));}}}};function unlockQueueStatus(_0x3f7f68,_0x23b794){setTimeout(function(){if(_[_0x44ae('0x36')](_0x3f7f68['queueStatusComplete'])){loggerBooked[_0x44ae('0x90')](_0x44ae('0x128'),_0x23b794);}_0x3f7f68[_0x44ae('0x129')]=!![];loggerBooked[_0x44ae('0x79')](_0x44ae('0x12a'),_0x23b794,JSON[_0x44ae('0x40')](_[_0x44ae('0xcd')](_0x3f7f68,[_0x44ae('0x3c'),_0x44ae('0x129')])));},0x1f3);}Dialer[_0x44ae('0x16')][_0x44ae('0x33')]=function(_0xe66309){var _0x40b023=this;var _0x106280=_0x40b023[_0x44ae('0x1b')][_0x40b023[_0x44ae('0xa7')][_0xe66309['actionid']][_0x44ae('0xaf')]];if(strategy[this['voiceQueues'][this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xaf')]][_0x44ae('0x47')]]===_0x44ae('0x123')){if(this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]]&&this['actions'][_0xe66309[_0x44ae('0x122')]][_0x44ae('0x126')]){this['preview']['run'](this['actions'][_0xe66309[_0x44ae('0x122')]]['idHopper'],this['actions'][_0xe66309['actionid']][_0x44ae('0x126')])[_0x44ae('0xb4')](function(_0x5d3eef){logger[_0x44ae('0x90')](_0x44ae('0x12b'),util[_0x44ae('0x91')](_0x5d3eef,{'showHidden':![],'depth':null}));})[_0x44ae('0x12c')](function(){_0x40b023[_0x44ae('0xb0')](_0x40b023[_0x44ae('0x1b')][_0x40b023[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xaf')]]);_0x40b023[_0x44ae('0x1c')][_0x40b023['actions'][_0xe66309[_0x44ae('0x122')]][_0x44ae('0x126')]][_0x44ae('0x124')]=![];delete _0x40b023['actions'][_0xe66309[_0x44ae('0x122')]];unlockQueueStatus(_0x106280);});}else{this['updateOriginated'](this['voiceQueues'][this['actions'][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xaf')]]);this[_0x44ae('0xbe')]({'active':![],'ContactId':this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xce')],'ListId':this[_0x44ae('0xa7')][_0xe66309['actionid']][_0x44ae('0xf8')],'VoiceQueueId':this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xd0')]||undefined,'CampaignId':this[_0x44ae('0xa7')][_0xe66309['actionid']][_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x12d')));delete this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]];unlockQueueStatus(_0x106280);}}else if((strategy[this['voiceQueues'][this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xaf')]][_0x44ae('0x47')]]||_0x44ae('0x15'))===_0x44ae('0x15')){var _0x1504fc;if(this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]]&&!_[_0x44ae('0x78')](this['queueBooked'][this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xaf')]])){if(this[_0x44ae('0x23')][_0x40b023['actions'][_0xe66309[_0x44ae('0x122')]]['queue']]){this[_0x44ae('0x23')][_0x40b023[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xaf')]]=this[_0x44ae('0x23')][this['actions'][_0xe66309['actionid']][_0x44ae('0xaf')]]?this['queueBookedRR'][this['actions'][_0xe66309['actionid']][_0x44ae('0xaf')]]:this[_0x44ae('0x22')][this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xaf')]]?this[_0x44ae('0x22')][this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]]['queue']][_0x44ae('0x12e')]||0x0:0x0;}this[_0x44ae('0x22')][this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]]['queue']]['_rr']=this[_0x44ae('0x23')][this[_0x44ae('0xa7')][_0xe66309[_0x44ae('0x122')]][_0x44ae('0xaf')]];for(var _0x2a673f=0x0;_0x2a673f=0x0?!![]:![];})[_0x44ae('0xb4')](myreject(_0x3689bb)));}}else{_0x2070bb[_0x44ae('0x127')](ami[_0x44ae('0xaa')]({'action':_0x44ae('0x143'),'command':util[_0x44ae('0x73')]('iftime\x20%s,%s',_0x302ea4,!_[_0x44ae('0x36')](config[_0x44ae('0x13f')][_0x5daf86])?_0x5daf86:'')})[_0x44ae('0xb7')](function(_0x105a85){return _0x105a85[_0x44ae('0x146')]['indexOf'](_0x44ae('0x148'))>=0x0?!![]:![];})['catch'](myreject(_0x3689bb)));}BPromise[_0x44ae('0x149')](_0x2070bb)['then'](function(_0x2cf369){var _0x3dbe4f=_[_0x44ae('0x14a')](_0x2cf369);if(_0x3dbe4f){return _0x182376(_0x3dbe4f);}else{_0x4c2ed4[_0x44ae('0x39')]=_0x2f2c3b?_0x44ae('0x14b'):'INTERVAL_IS_OVERTIME';return _0x3689bb(msgResponse(_0x44ae('0x14c'),_0x44ae('0x13c'),'Global:\x20'+_0x2f2c3b+'\x20'+_0x494c1c+_0x44ae('0x14d')+util['inspect'](_0x302ea4,{'showHidden':![],'depth':null})+_0x44ae('0x14e')+_0x5daf86));}})['catch'](function(_0x7ea650){return _0x3689bb(msgResponse(_0x44ae('0x13a'),_0x44ae('0x13c'),JSON[_0x44ae('0x40')](_0x7ea650)));});});};Dialer[_0x44ae('0x16')][_0x44ae('0x14f')]=function(_0x1d1926){var _0x777e7=this;return function(){switch(_0x1d1926[_0x44ae('0x52')]){case'progressive':freeVariablesPredictive(_0x1d1926);_0x777e7['handlePower'](_0x1d1926,0x1);break;case'power':freeVariablesPredictive(_0x1d1926);_0x777e7[_0x44ae('0x150')](_0x1d1926,_0x1d1926['dialPowerLevel']);break;case _0x44ae('0x151'):_0x777e7['predictive'](_0x1d1926);break;case _0x44ae('0x152'):freeVariablesPredictive(_0x1d1926);_0x777e7[_0x44ae('0x150')](_0x1d1926,0x1);break;default:freeVariablesPredictive(_0x1d1926);logger[_0x44ae('0x90')](_0x44ae('0x153'),_0x1d1926[_0x44ae('0x3c')],_0x44ae('0x154'));}};};Dialer[_0x44ae('0x16')][_0x44ae('0x155')]=function(_0x3721b8){var _0x230904=this;return function(){_0x230904[_0x44ae('0x156')](_0x3721b8);};};Dialer[_0x44ae('0x16')][_0x44ae('0x2d')]=function(_0x55e1b3){var _0x43599a=this;if(isNotPreview(_0x55e1b3[_0x44ae('0x52')])){if(isVoiceQueueOutbound(_0x55e1b3[_0x44ae('0x45')])&&isActive(_0x55e1b3[_0x44ae('0x51')])){_0x55e1b3[_0x44ae('0x9c')]=!![];BPromise[_0x44ae('0xb3')]()[_0x44ae('0xb7')](checkIsLoggedIn(_0x55e1b3,_0x55e1b3[_0x44ae('0x157')]))[_0x44ae('0xb7')](checkIsActive(_0x55e1b3,_0x55e1b3[_0x44ae('0x51')]))[_0x44ae('0xb7')](checkInterval(_0x55e1b3))[_0x44ae('0xb7')](_0x43599a[_0x44ae('0x137')](_0x55e1b3))[_0x44ae('0xb7')](_0x43599a['checkIfTime'](_0x55e1b3[_0x44ae('0x158')],_0x55e1b3['dialTimezone'],_0x55e1b3[_0x44ae('0x3c')],_0x55e1b3))[_0x44ae('0xb7')](_0x43599a['checkIfTimeIntervals'](_0x55e1b3[_0x44ae('0x3b')],_0x55e1b3[_0x44ae('0x159')],_0x55e1b3[_0x44ae('0x3c')],_0x55e1b3))[_0x44ae('0xb7')](_0x43599a[_0x44ae('0x14f')](_0x55e1b3))[_0x44ae('0xb4')](loggerCatchQueueSummary(_0x44ae('0x15a'),_0x55e1b3));}else{notSendMessagesQueue(_0x55e1b3);}}else{freeVariablesPredictive(_0x55e1b3);}};Dialer[_0x44ae('0x16')][_0x44ae('0x136')]=function(){var _0x2a827f=this;var _0x1a32dd;for(var _0x25fb54 in this[_0x44ae('0xb1')]){if(this[_0x44ae('0xb1')]['hasOwnProperty'](_0x25fb54)){_0x1a32dd=this[_0x44ae('0xb1')][_0x25fb54];if(isCampaignIvr(_0x1a32dd[_0x44ae('0x45')])&&isActive(_0x1a32dd[_0x44ae('0x71')])){_0x1a32dd[_0x44ae('0x9c')]=!![];BPromise[_0x44ae('0xb3')]()['then'](checkIsActive(_0x1a32dd,_0x1a32dd[_0x44ae('0x71')]))['then'](checkInterval(_0x1a32dd))[_0x44ae('0xb7')](_0x2a827f[_0x44ae('0x137')](_0x1a32dd))['then'](_0x2a827f[_0x44ae('0x139')](_0x1a32dd['dialGlobalInterval'],_0x1a32dd['dialTimezone'],_0x1a32dd[_0x44ae('0x3c')],_0x1a32dd))[_0x44ae('0xb7')](_0x2a827f[_0x44ae('0x13b')](_0x1a32dd['Interval'],_0x1a32dd['dialTimezone'],_0x1a32dd[_0x44ae('0x3c')],_0x1a32dd))['then'](_0x2a827f['launchHandleIvr'](_0x1a32dd))[_0x44ae('0xb4')](loggerCatchQueueSummary('[syncCampaigns]',_0x1a32dd));}else{notSendMessagesCampaign(_0x1a32dd);}}}};function getCallerIdRandom(_0x4fccbc,_0x151634){var _0x32e83a,_0x535fdc,_0x343234;if(_0x151634<=0x0){_0x151634=0x1;}_0x32e83a=new RegExp(_0x44ae('0x15b')+_0x151634+'}$');_0x535fdc=Math[_0x44ae('0x15c')](0xa,_0x151634-0x1);_0x343234=Math[_0x44ae('0x15c')](0xa,_0x151634)-0x1;return util[_0x44ae('0x73')]('%s',_[_0x44ae('0x15d')](_0x4fccbc,_0x32e83a,_[_0x44ae('0x15e')](_0x535fdc,_0x343234)));}function extractCalleridName(_0x1da41a){var _0x7fb02d=_0x1da41a[_0x44ae('0x15f')](/"(.*?)"/);return _0x7fb02d?_0x7fb02d[0x1]:_0x1da41a;}function extractCalleridNumber(_0x5242db){var _0x231b82=_0x5242db['match'](/<(.*?)>/);return _0x231b82?_0x231b82[0x1]:_0x5242db;}Dialer[_0x44ae('0x16')][_0x44ae('0x160')]=function(_0x4ba87b,_0x58ff83){var _0x522b42=this;var _0x252648=uuid['v4']();this[_0x44ae('0xa7')][_0x252648]=new Action(_0x4ba87b,_0x58ff83,_0x252648);return new BPromise(function(_0x1d960a,_0x23953a){if(_['isUndefined'](_0x4ba87b)&&_0x44ae('0x161')!==typeof _0x4ba87b){return _0x23953a(msgResponse(_0x44ae('0x162'),_0x44ae('0x13c'),_0x44ae('0x163')));}if(_['isUndefined'](_0x58ff83[_0x44ae('0x164')][_0x44ae('0x165')])||_0x58ff83[_0x44ae('0x164')][_0x44ae('0x165')]===null){return _0x23953a(msgResponse('originate',_0x44ae('0x13c'),_0x44ae('0x166')));}var _0x4f2a92={'XMD-CALLERID':_0x522b42[_0x44ae('0xa7')][_0x252648]['getCaller'](),'XMD-AGI':_0x4ba87b[_0x44ae('0x105')]?util[_0x44ae('0x73')](_0x44ae('0x167'),ipAgi,_0x4ba87b[_0x44ae('0x105')]):_0x44ae('0x168'),'XMD-AGIAFTER':_0x4ba87b[_0x44ae('0x108')]?util['format'](_0x44ae('0x167'),ipAgi,_0x4ba87b[_0x44ae('0x108')]):_0x44ae('0x168'),'XMD-QUEUE':_0x4ba87b[_0x44ae('0x45')]==='outbound'?util['format'](_0x44ae('0x169'),_0x4ba87b[_0x44ae('0x3c')],_0x4ba87b['dialQueueOptions']||'',_0x4ba87b[_0x44ae('0x109')]?'c':'',_0x4ba87b['dialQueueTimeout']||0x3):_0x44ae('0x168'),'XMD-CONTACTID':_0x58ff83['ContactId'],'XMD-CDRTYPE':_0x44ae('0x16a'),'CALLERID(all)':_0x522b42['actions'][_0x252648]['getCaller'](),'XMD-AMD':_0x4ba87b[_0x44ae('0xde')]?_0x44ae('0x16b'):_0x44ae('0x168'),'XMD-DESTINATION':_0x44ae('0xdd')};if(_0x4ba87b[_0x44ae('0xde')]){_0x4f2a92[_0x44ae('0x16c')]=_0x4ba87b[_0x44ae('0x16d')]||0x9c4;_0x4f2a92[_0x44ae('0x16e')]=_0x4ba87b[_0x44ae('0x16f')]||0x5dc;_0x4f2a92[_0x44ae('0x170')]=_0x4ba87b[_0x44ae('0x171')]||0x320;_0x4f2a92[_0x44ae('0x172')]=_0x4ba87b[_0x44ae('0x173')]||0x1388;_0x4f2a92[_0x44ae('0x174')]=_0x4ba87b['dialAMDMinWordLength']||0x64;_0x4f2a92['XMD-AMDBETWEENWORDSSILENCE']=_0x4ba87b[_0x44ae('0x175')]||0x32;_0x4f2a92[_0x44ae('0x176')]=_0x4ba87b[_0x44ae('0x177')]||0x3;_0x4f2a92[_0x44ae('0x178')]=_0x4ba87b[_0x44ae('0x179')]||0x100;_0x4f2a92[_0x44ae('0x17a')]=_0x4ba87b[_0x44ae('0x17b')]||0x1388;}if(_0x4ba87b[_0x44ae('0x45')]==='outbound'){_0x4f2a92[_0x44ae('0x17c')]=_0x58ff83[_0x44ae('0xd0')];}else{_0x4f2a92['XMD-CAMPAIGNID']=_0x58ff83['CampaignId'];}for(var _0x3f20e5 in _0x58ff83[_0x44ae('0x164')]){if(_0x58ff83[_0x44ae('0x164')][_0x44ae('0x94')](_0x3f20e5)){if(isNotNull(_0x58ff83['Contact'][_0x3f20e5])&&_0x3f20e5!=='id'&&_0x3f20e5!==_0x44ae('0x17d')&&_0x3f20e5!==_0x44ae('0x17e')&&_0x3f20e5!==_0x44ae('0x17f')){_0x4f2a92[util[_0x44ae('0x73')](_0x44ae('0x180'),_0x44ae('0x181'),_[_0x44ae('0x182')](_0x3f20e5))]=_0x58ff83['Contact'][_0x3f20e5];}}}var _0x195d96=_0x522b42['isTrunkReachable'](_0x4ba87b['Trunk'])?getCallerId(_0x4ba87b[_0x44ae('0x70')][_0x44ae('0x72')],_0x4ba87b[_0x44ae('0x53')],_0x4ba87b[_0x44ae('0x183')]>0x0?getCallerIdRandom(_0x4ba87b[_0x44ae('0x54')],_0x4ba87b[_0x44ae('0x183')]):_0x4ba87b[_0x44ae('0x54')]):getCallerId(_[_0x44ae('0xa9')](_0x4ba87b['TrunkBackup'])?_0x4ba87b[_0x44ae('0x70')]['callerid']:_0x4ba87b[_0x44ae('0x138')]['callerid'],_0x4ba87b[_0x44ae('0x53')],_0x4ba87b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4ba87b[_0x44ae('0x54')],_0x4ba87b[_0x44ae('0x183')]):_0x4ba87b[_0x44ae('0x54')]);if(_0x195d96){_0x4f2a92[_0x44ae('0x184')]=_0x522b42[_0x44ae('0xa7')][_0x252648][_0x44ae('0x185')]=extractCalleridName(_0x195d96);_0x4f2a92[_0x44ae('0x186')]=_0x522b42[_0x44ae('0xa7')][_0x252648][_0x44ae('0x187')]=extractCalleridNumber(_0x195d96);}return ami[_0x44ae('0xaa')]({'actionid':_0x252648,'action':_0x44ae('0x162'),'channel':_0x522b42[_0x44ae('0xd6')](_0x4ba87b['Trunk'])?util[_0x44ae('0x73')](_0x44ae('0x188'),_0x4ba87b['Trunk'][_0x44ae('0x3c')],isNotNull(_0x4ba87b[_0x44ae('0x56')])?_0x4ba87b['dialPrefix'][_0x44ae('0x189')]()||'':'',_0x4ba87b[_0x44ae('0x18a')]>0x0?_0x58ff83['Contact'][_0x44ae('0x165')][_0x44ae('0x18b')](_0x4ba87b[_0x44ae('0x18a')]):_0x58ff83[_0x44ae('0x164')]['phone']):util[_0x44ae('0x73')](_0x44ae('0x188'),_[_0x44ae('0xa9')](_0x4ba87b[_0x44ae('0x138')])?_0x4ba87b['Trunk']['name']:_0x4ba87b[_0x44ae('0x138')][_0x44ae('0x3c')],isNotNull(_0x4ba87b[_0x44ae('0x56')])?_0x4ba87b[_0x44ae('0x56')][_0x44ae('0x189')]()||'':'',_0x4ba87b[_0x44ae('0x18a')]>0x0?_0x58ff83[_0x44ae('0x164')][_0x44ae('0x165')][_0x44ae('0x18b')](_0x4ba87b[_0x44ae('0x18a')]):_0x58ff83[_0x44ae('0x164')][_0x44ae('0x165')]),'callerid':_0x195d96,'Exten':_0x44ae('0xdd'),'Context':_0x44ae('0x18c'),'Priority':'1','variable':_0x4f2a92,'timeout':(_0x4ba87b['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x252648})[_0x44ae('0xb7')](function(_0x370d9f){return _0x1d960a(_0x370d9f);})[_0x44ae('0xb4')](function(_0x2976bd){_0x4ba87b[_0x44ae('0x5f')]+=0x1;var _0x3a57a7=new History(_0x522b42[_0x44ae('0xa7')][_0x252648]);logger[_0x44ae('0x90')](util[_0x44ae('0x73')]('[originateError]:\x20%s',JSON[_0x44ae('0x40')](_0x2976bd)));_0x3a57a7[_0x44ae('0xa3')]=0xe;_0x3a57a7['statedesc']='OriginateError';_0x3a57a7[_0x44ae('0x118')]=moment()[_0x44ae('0x73')](_0x44ae('0x100'));_0x3a57a7[_0x44ae('0xa5')]=_0x3a57a7[_0x44ae('0x118')];_0x522b42['createHistory'](_0x3a57a7)['catch'](loggerCatch('[originate][error]'));_0x522b42[_0x44ae('0xc6')](_0x3a57a7)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x18d')))['finally'](function(){delete _0x522b42[_0x44ae('0xa7')][_0x252648];return _0x23953a(msgResponse('originate',_0x44ae('0x18e'),_0x44ae('0x18f')));});});});};Dialer[_0x44ae('0x16')][_0x44ae('0x29')]=function(_0x192011){var _0x2a12fc=this[_0x44ae('0xa7')][_0x192011[_0x44ae('0x122')]];var _0x12caf2=this;if(_0x2a12fc){delete this[_0x44ae('0xa7')][_0x192011[_0x44ae('0x122')]];_0x2a12fc['responsetime']=moment()[_0x44ae('0x73')](_0x44ae('0x100'));var _0x12b639=_0x2a12fc[_0x44ae('0x45')]==='ivr'?this[_0x44ae('0xb1')][_0x2a12fc['queue']]:this['voiceQueues'][_0x2a12fc['getQueue']()];if(!this[_0x44ae('0xd4')](_0x192011['response'])){this[_0x44ae('0xb0')](_0x12b639);return this[_0x44ae('0x190')](_0x2a12fc,_0x12b639,_0x192011)[_0x44ae('0xb7')](function(_0x5e6150){})[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x191')));}else{this[_0x44ae('0xda')][_0x192011['uniqueid']]=_0x2a12fc;}}};Dialer[_0x44ae('0x16')][_0x44ae('0x192')]=function(_0x15c452,_0x48aadd,_0x344c6c){var _0x4a23da=new History(_0x48aadd);if(_0x4a23da[_0x44ae('0xea')]+_0x4a23da[_0x44ae('0xeb')]+_0x4a23da[_0x44ae('0x193')]+_0x4a23da[_0x44ae('0xec')]+_0x4a23da[_0x44ae('0xed')]+_0x4a23da[_0x44ae('0xfe')]+_0x4a23da[_0x44ae('0xf2')]+_0x4a23da[_0x44ae('0xee')]>=_0x344c6c['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x15c452){case 0x3:if(_0x4a23da[_0x44ae('0x193')]>=_0x344c6c[_0x44ae('0x194')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x4a23da[_0x44ae('0x193')]+=0x1,'scheduledat':moment()[_0x44ae('0xf5')](_0x344c6c['dialNoAnswerRetryFrequency'],_0x44ae('0xf7'))[_0x44ae('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a23da[_0x44ae('0xce')],'ListId':_0x4a23da[_0x44ae('0xf8')],'VoiceQueueId':_0x4a23da[_0x44ae('0xd0')]||undefined,'CampaignId':_0x4a23da[_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x195')));}break;case 0x5:if(_0x4a23da['countbusyretry']>=_0x344c6c[_0x44ae('0x196')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x4a23da[_0x44ae('0xea')]+=0x1,'scheduledat':moment()[_0x44ae('0xf5')](_0x344c6c[_0x44ae('0x197')],'minutes')[_0x44ae('0x73')](_0x44ae('0x100')),'ContactId':_0x4a23da['ContactId'],'ListId':_0x4a23da[_0x44ae('0xf8')],'VoiceQueueId':_0x4a23da['VoiceQueueId']||undefined,'CampaignId':_0x4a23da[_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x198')));}break;case 0x8:if(_0x4a23da[_0x44ae('0xeb')]>=_0x344c6c[_0x44ae('0x199')]-0x1){return!![];}else{this[_0x44ae('0xbe')]({'active':![],'countcongestionretry':_0x4a23da['countcongestionretry']+=0x1,'scheduledat':moment()[_0x44ae('0xf5')](_0x344c6c['dialCongestionRetryFrequency'],_0x44ae('0xf7'))['format'](_0x44ae('0x100')),'ContactId':_0x4a23da[_0x44ae('0xce')],'ListId':_0x4a23da[_0x44ae('0xf8')],'VoiceQueueId':_0x4a23da[_0x44ae('0xd0')]||undefined,'CampaignId':_0x4a23da[_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x19a')));}break;case 0x0:if(_0x4a23da['countnosuchnumberretry']>=_0x344c6c[_0x44ae('0x19b')]-0x1){return!![];}else{this[_0x44ae('0xbe')]({'active':![],'countnosuchnumberretry':_0x4a23da['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x44ae('0xf5')](_0x344c6c[_0x44ae('0x19c')],_0x44ae('0xf7'))['format'](_0x44ae('0x100')),'ContactId':_0x4a23da[_0x44ae('0xce')],'ListId':_0x4a23da['ListId'],'VoiceQueueId':_0x4a23da[_0x44ae('0xd0')]||undefined,'CampaignId':_0x4a23da[_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x19d')));}break;case 0xa:if(_0x4a23da[_0x44ae('0xed')]>=_0x344c6c[_0x44ae('0x116')]-0x1){return!![];}else{this[_0x44ae('0xbe')]({'active':![],'countdropretry':_0x4a23da[_0x44ae('0xed')]+=0x1,'scheduledat':moment()['add'](_0x344c6c[_0x44ae('0x117')],_0x44ae('0xf7'))[_0x44ae('0x73')](_0x44ae('0x100')),'ContactId':_0x4a23da['ContactId'],'ListId':_0x4a23da[_0x44ae('0xf8')],'VoiceQueueId':_0x4a23da['VoiceQueueId']||undefined,'CampaignId':_0x4a23da[_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x4a23da['countabandonedretry']>=_0x344c6c[_0x44ae('0x11e')]-0x1){return!![];}else{this[_0x44ae('0xbe')]({'active':![],'countabandonedretry':_0x4a23da[_0x44ae('0xfe')]+=0x1,'scheduledat':moment()[_0x44ae('0xf5')](_0x344c6c[_0x44ae('0x11f')],_0x44ae('0xf7'))['format'](_0x44ae('0x100')),'ContactId':_0x4a23da[_0x44ae('0xce')],'ListId':_0x4a23da[_0x44ae('0xf8')],'VoiceQueueId':_0x4a23da[_0x44ae('0xd0')]||undefined,'CampaignId':_0x4a23da[_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x120')));}break;case 0x13:if(_0x4a23da[_0x44ae('0xf2')]>=_0x344c6c[_0x44ae('0xf3')]-0x1){return!![];}else{this[_0x44ae('0xbe')]({'active':![],'countmachineretry':_0x4a23da[_0x44ae('0xf2')]+=0x1,'scheduledat':moment()['add'](_0x344c6c['dialMachineRetryFrequency'],'minutes')[_0x44ae('0x73')](_0x44ae('0x100')),'ContactId':_0x4a23da[_0x44ae('0xce')],'ListId':_0x4a23da[_0x44ae('0xf8')],'VoiceQueueId':_0x4a23da['VoiceQueueId']||undefined,'CampaignId':_0x4a23da['CampaignId']||undefined})[_0x44ae('0xb4')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x4a23da['countagentrejectretry']>=_0x344c6c[_0x44ae('0x19e')]-0x1){return!![];}else{this[_0x44ae('0xbe')]({'active':![],'countagentrejectretry':_0x4a23da[_0x44ae('0xee')]+=0x1,'scheduledat':moment()[_0x44ae('0xf5')](_0x344c6c[_0x44ae('0x19f')],'minutes')[_0x44ae('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4a23da[_0x44ae('0xce')],'ListId':_0x4a23da[_0x44ae('0xf8')],'VoiceQueueId':_0x4a23da['VoiceQueueId']||undefined,'CampaignId':_0x4a23da['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x245813,_0xc5190e,_0x412a7c){var _0x484f40=this;var _0x39f990=new History(_0x245813);return new BPromise(function(_0x3587f4,_0xae23d7){if(_[_0x44ae('0x36')](_0xc5190e)&&'object'!==typeof _0xc5190e){return _0xae23d7(msgResponse(_0x44ae('0x1a0'),_0x44ae('0x13c'),_0x44ae('0x1a1')));}if(_['isUndefined'](_0x412a7c)&&'object'!==typeof _0x412a7c){return _0xae23d7(msgResponse(_0x44ae('0x1a0'),_0x44ae('0x13c'),'evt\x20is\x20undefine'));}switch(_0x412a7c[_0x44ae('0x1a2')]){case'0':_0xc5190e[_0x44ae('0x5e')]+=0x1;_0x39f990[_0x44ae('0xa3')]=0x0;_0x39f990[_0x44ae('0xa4')]=_0x44ae('0x1a3');_0x39f990[_0x44ae('0xec')]+=0x1;_0x39f990['countglobal']+=0x1;ami[_0x44ae('0x44')](_0x44ae('0x1a4'),ut[_0x44ae('0x1a5')](_0x245813,_0x44ae('0x1a6')));_0x484f40['createHistory'](_0x39f990)['catch'](loggerCatch(_0x44ae('0xfd')));if(_0x484f40[_0x44ae('0x192')](0x0,_0x245813,_0xc5190e)){if(_0x39f990[_0x44ae('0xec')]>=_0xc5190e[_0x44ae('0x19b')]){_0x484f40[_0x44ae('0xf4')](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1a7'));}else{_0x484f40[_0x44ae('0xf0')](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1a7'));}}break;case'3':_0xc5190e[_0x44ae('0x5d')]+=0x1;_0x39f990[_0x44ae('0xa3')]=0x3;_0x39f990[_0x44ae('0xa4')]=_0x44ae('0x1a8');_0x39f990[_0x44ae('0x193')]+=0x1;_0x39f990[_0x44ae('0xe8')]+=0x1;ami['emit']('custom:agentnoanswer',ut['buildObj'](_0x245813,'noanswer'));_0x484f40[_0x44ae('0xc8')](_0x39f990)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x1a9')));if(_0x484f40[_0x44ae('0x192')](0x3,_0x245813,_0xc5190e)){if(_0x39f990[_0x44ae('0x193')]>=_0xc5190e[_0x44ae('0x194')]){_0x484f40[_0x44ae('0xf4')](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1aa'));}else{_0x484f40['stateGlobal'](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1aa'));}}break;case'5':_0xc5190e[_0x44ae('0x5a')]+=0x1;_0x39f990['state']=0x5;_0x39f990[_0x44ae('0xa4')]='Busy';_0x39f990[_0x44ae('0xea')]+=0x1;_0x39f990[_0x44ae('0xe8')]+=0x1;ami[_0x44ae('0x44')]('custom:agentbusy',ut[_0x44ae('0x1a5')](_0x245813,_0x44ae('0x1ab')));_0x484f40[_0x44ae('0xc8')](_0x39f990)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x1ac')));if(_0x484f40['checkRetriveMax'](0x5,_0x245813,_0xc5190e)){if(_0x39f990[_0x44ae('0xea')]>=_0xc5190e[_0x44ae('0x196')]){_0x484f40[_0x44ae('0xf4')](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1ad'));}else{_0x484f40[_0x44ae('0xf0')](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1ad'));}}break;case'8':_0xc5190e[_0x44ae('0x5b')]+=0x1;_0x39f990['state']=0x8;_0x39f990[_0x44ae('0xa4')]=_0x44ae('0x1ae');_0x39f990[_0x44ae('0xeb')]+=0x1;_0x39f990[_0x44ae('0xe8')]+=0x1;ami['emit'](_0x44ae('0x1af'),ut[_0x44ae('0x1a5')](_0x245813,_0x44ae('0x1b0')));_0x484f40[_0x44ae('0xc8')](_0x39f990)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x1b1')));if(_0x484f40[_0x44ae('0x192')](0x8,_0x245813,_0xc5190e)){if(_0x39f990['countcongestionretry']>=_0xc5190e[_0x44ae('0x199')]){_0x484f40[_0x44ae('0xf4')](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1b2'));}else{_0x484f40[_0x44ae('0xf0')](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1b2'));}}break;case'11':_0xc5190e[_0x44ae('0x1b3')]+=0x1;_0x39f990[_0x44ae('0xa3')]=0xb;_0x39f990['statedesc']='Abandoned';_0x39f990[_0x44ae('0xfe')]+=0x1;_0x39f990[_0x44ae('0xe8')]+=0x1;_0x484f40[_0x44ae('0xc8')](_0x39f990)['catch'](loggerCatch(_0x44ae('0x121')));if(_0x484f40[_0x44ae('0x192')](0xb,_0x245813,_0xc5190e)){if(_0x39f990[_0x44ae('0xfe')]>=_0xc5190e['dialAbandonedMaxRetry']){_0x484f40[_0x44ae('0xf4')](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1b4'));}else{_0x484f40['stateGlobal'](_0x39f990,_0x3587f4,_0xae23d7,'reason\x2011\x20abandoned');}}break;case'20':_0xc5190e[_0x44ae('0x61')]+=0x1;_0x39f990[_0x44ae('0xa3')]=0x14;_0x39f990[_0x44ae('0xa4')]=_0x44ae('0x1b5');_0x39f990[_0x44ae('0xee')]+=0x1;_0x39f990['countglobal']+=0x1;ami[_0x44ae('0x44')](_0x44ae('0x1b6'),ut[_0x44ae('0x1a5')](_0x245813,_0x44ae('0x1b7')));_0x484f40[_0x44ae('0xc8')](_0x39f990)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x1b8')));if(_0x484f40[_0x44ae('0x192')](0x14,_0x245813,_0xc5190e)){if(_0x39f990['countagentrejectretry']>=_0xc5190e[_0x44ae('0x19e')]){_0x484f40[_0x44ae('0xf4')](_0x39f990,_0x3587f4,_0xae23d7,'reason\x2020\x20agentreject');}else{_0x484f40[_0x44ae('0xf0')](_0x39f990,_0x3587f4,_0xae23d7,_0x44ae('0x1b9'));}}break;default:_0xc5190e['outboundUnknownCallsDay']+=0x1;_0x39f990['state']=0xc;_0x39f990[_0x44ae('0xa4')]=_0x412a7c[_0x44ae('0x1a2')];_0x484f40['createHistory'](_0x39f990)[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x1ba')));if(_0x484f40[_0x44ae('0x192')](_0x412a7c[_0x44ae('0x1a2')],_0x245813,_0xc5190e)){if(_0x39f990[_0x44ae('0xea')]+_0x39f990[_0x44ae('0xeb')]+_0x39f990[_0x44ae('0x193')]+_0x39f990[_0x44ae('0xec')]+_0x39f990[_0x44ae('0xed')]+_0x39f990[_0x44ae('0xfe')]+_0x39f990[_0x44ae('0xf2')]+_0x39f990[_0x44ae('0xee')]>=_0xc5190e[_0x44ae('0xef')]){_0x484f40[_0x44ae('0xf0')](_0x39f990,_0x3587f4,_0xae23d7,_0x412a7c[_0x44ae('0x1a2')]);}else{_0x484f40[_0x44ae('0xf4')](_0x39f990,_0x3587f4,_0xae23d7,_0x412a7c[_0x44ae('0x1a2')]);}}}});};Dialer[_0x44ae('0x16')][_0x44ae('0xf0')]=function(_0x309a7f,_0x4c9c74,_0x32e999,_0x3ada43){var _0x3126cd=new Final(_0x309a7f);_0x3126cd[_0x44ae('0xa3')]=0xf;_0x3126cd[_0x44ae('0xa4')]=_0x44ae('0x1bb');this[_0x44ae('0xf4')](_0x3126cd,_0x4c9c74,_0x32e999,_0x3ada43);};Dialer[_0x44ae('0x16')][_0x44ae('0xf4')]=function(_0x3b365e,_0x424b8f,_0x1d3df3,_0x10d500){this[_0x44ae('0xc6')](_0x3b365e)['then'](function(_0x35e2b6){return _0x424b8f(msgResponse(_0x44ae('0x1a0'),_0x44ae('0xd5'),_0x10d500));})['catch'](function(_0x5c041e){return _0x1d3df3(msgResponse(_0x44ae('0x1bc'),_0x44ae('0x13c'),'contact\x20not\x20moved'));});};Dialer[_0x44ae('0x16')][_0x44ae('0x151')]=function(_0xf35533){var _0x3e589a=this;var _0x20eb0c=_0xf35533['dialPredictiveOptimizationPercentage']/0x64;var _0x57d2ed=_0xf35533[_0x44ae('0x110')]/(_0xf35533[_0x44ae('0x110')]+_0xf35533['outboundAnswerCallsDay']);var _0x22d153=Math[_0x44ae('0x1bd')](_0xf35533[_0x44ae('0x68')]*(_0xf35533[_0x44ae('0x1be')]/0x64));var _0x13e93b=Math[_0x44ae('0x1bd')](_0xf35533['predictiveIntervalAvailable']*(_0xf35533[_0x44ae('0x1bf')]/0x64));var _0x16eb86=_0xf35533[_0x44ae('0x49')]+_0xf35533[_0x44ae('0x4c')];var _0x5ec4a1=Math['floor'](_0xf35533['erlangCalls']*_0xf35533[_0x44ae('0x6c')]*_0xf35533[_0x44ae('0x1c0')]*_0xf35533[_0x44ae('0x1c1')]);if(_['isUndefined'](_0xf35533['startProgressive'])){if(!_[_0x44ae('0x36')](_0xf35533[_0x44ae('0x6e')])){_0xf35533[_0x44ae('0x6e')]=undefined;loggerPredictive[_0x44ae('0x90')](_0x44ae('0x1c2'),_0x44ae('0x1c3'));}if(!_['isUndefined'](_0xf35533[_0x44ae('0x8b')])){loggerPredictive[_0x44ae('0x90')](_0x44ae('0x1c2'),_0x44ae('0x1c4'));clearInterval(_0xf35533['handlePredictive']);_0xf35533[_0x44ae('0x8b')]=undefined;}_0xf35533[_0x44ae('0x6f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x44ae('0x79')](_0xf35533[_0x44ae('0x3c')],_0x44ae('0x1c5'),_0xf35533[_0x44ae('0x6f')]);this[_0x44ae('0x150')](_0xf35533,0x1);}else if(ifInterval(_0xf35533[_0x44ae('0x1c6')],_0xf35533[_0x44ae('0x6f')])){this['handlePower'](_0xf35533,0x1);loggerPredictiveCalls[_0x44ae('0x79')](_0x44ae('0x1c7'),_0xf35533[_0x44ae('0x6f')],_0xf35533[_0x44ae('0x3c')]);_0xf35533['erlangCalls']=0x0;_0xf35533[_0x44ae('0x111')]=0x0;}else if(_0x20eb0c<_0x57d2ed&&_0xf35533[_0x44ae('0x1c8')]==='dropRate'){freeVariablesPredictive(_0xf35533);loggerPredictive[_0x44ae('0x79')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x44ae('0x1c9'),_0x57d2ed,_0x44ae('0x6f'),_0xf35533[_0x44ae('0x3c')]);}else if(_0x5ec4a1<_0xf35533[_0x44ae('0x111')]&&_0xf35533['dialPredictiveOptimization']===_0x44ae('0x1ca')){freeVariablesPredictive(_0xf35533);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x1cb'),_0x44ae('0x1cc'),_0x5ec4a1,'Drop\x20in\x20this\x20interval',_0xf35533[_0x44ae('0x111')],_0x44ae('0x6f'),_0xf35533[_0x44ae('0x3c')]);}else if(!ifInterval(_0xf35533[_0x44ae('0x1c6')],_0xf35533['startProgressive'])&&_[_0x44ae('0x36')](_0xf35533[_0x44ae('0x6e')])&&!_[_0x44ae('0x36')](_0xf35533[_0x44ae('0x6f')])){_0xf35533[_0x44ae('0x6e')]=moment()['format'](_0x44ae('0x100'));loggerPredictive[_0x44ae('0x79')](_0xf35533[_0x44ae('0x3c')],'started\x20in\x20predictive\x20at',_0xf35533['startPredictive']);this[_0x44ae('0xbb')](_0xf35533[_0x44ae('0x1c6')])['then'](this[_0x44ae('0x1cd')](_0xf35533))[_0x44ae('0xb7')](mergeDataErlangB(_0xf35533))['then'](this[_0x44ae('0x1ce')](_0xf35533))[_0x44ae('0xb4')](loggerCatchPredictive(_0x44ae('0x1cf'),_0xf35533));}else if(!ifInterval(_0xf35533[_0x44ae('0x1c6')],_0xf35533[_0x44ae('0x6e')])){_0xf35533[_0x44ae('0x111')]=0x0;_0xf35533[_0x44ae('0x6e')]=moment()[_0x44ae('0x73')](_0x44ae('0x100'));loggerPredictive[_0x44ae('0x79')](_0xf35533[_0x44ae('0x3c')],_0x44ae('0x1d0'),_0xf35533['startPredictive']);clearInterval(_0xf35533[_0x44ae('0x8b')]);_0xf35533['handlePredictive']=undefined;this[_0x44ae('0xbb')](_0xf35533[_0x44ae('0x1c6')])['then'](this[_0x44ae('0x1cd')](_0xf35533))[_0x44ae('0xb7')](mergeDataErlangB(_0xf35533))[_0x44ae('0xb7')](this[_0x44ae('0x1ce')](_0xf35533))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0xf35533));}else if(_0xf35533[_0x44ae('0x68')]&&_0x16eb86<_0xf35533['predictiveIntervalAvailable']-_0x13e93b){freeVariablesPredictive(_0xf35533);loggerPredictive[_0x44ae('0x79')](_0xf35533[_0x44ae('0x3c')],_0x44ae('0x1d1'),_0x16eb86,_0x44ae('0x1d2'),_0xf35533[_0x44ae('0x68')],'-',_0x13e93b,'=',_0xf35533['predictiveIntervalAvailable']-_0x13e93b,')');}else if(_0xf35533[_0x44ae('0x68')]&&_0x16eb86>_0xf35533[_0x44ae('0x68')]+_0x22d153){freeVariablesPredictive(_0xf35533);loggerPredictive[_0x44ae('0x79')](_0xf35533[_0x44ae('0x3c')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x16eb86,_0x44ae('0x1d3'),_0xf35533[_0x44ae('0x68')],'+',_0x22d153,'=',_0xf35533[_0x44ae('0x68')]+_0x22d153,')');}};Dialer['prototype'][_0x44ae('0x1cd')]=function(_0x2f61b5){var _0x3e399b=this;return function(_0x37d363){return new BPromise(function(_0x256950,_0x1d1467){_['merge'](_0x2f61b5,_0x37d363[0x0]);if(checkGetDataPredictive(_0x37d363[0x0])){var _0x2ea406=_0x2f61b5[_0x44ae('0x68')]=_0x2f61b5[_0x44ae('0x4c')]+_0x2f61b5['available'];var _0x3d31d2=_0x2f61b5['dialPredictiveInterval']*0x3c;var _0x400a1a=_0x37d363[0x0][_0x44ae('0x64')]+_0x37d363[0x0][_0x44ae('0x63')];var _0xcc907d=(_0x37d363[0x0][_0x44ae('0x7c')]+_0x37d363[0x0][_0x44ae('0x66')]+_0x37d363[0x0][_0x44ae('0x65')])/_0x37d363[0x0][_0x44ae('0x69')];_0x2f61b5[_0x44ae('0x1c0')]=_0xcc907d>0x0?_0xcc907d:0x1;switch(_0x2f61b5[_0x44ae('0x1c8')]){case _0x44ae('0x1ca'):var _0x35d04e=_0x2f61b5[_0x44ae('0x1d4')]/0x64;return _0x3e399b[_0x44ae('0x1d5')](_0x2ea406,_0x3d31d2,_0x400a1a,_0xcc907d,_0x35d04e)['then'](function(_0x49561c){return _0x256950(_0x49561c);});case _0x44ae('0x1d6'):var _0x43807f=_0x2f61b5[_0x44ae('0x1d4')]/0x64;return _0x3e399b[_0x44ae('0x1d7')](_0x2ea406,_0x3d31d2,_0x400a1a,_0xcc907d,_0x43807f)[_0x44ae('0xb7')](function(_0x3c5dbf){return _0x256950(_0x3c5dbf);});default:return _0x1d1467(msgResponse(_0x44ae('0x1d8'),_0x44ae('0x13c'),'Unknown\x20Predictive'));}}else{return _0x1d1467(msgResponse(_0x44ae('0x1d8'),'Failure',_0x44ae('0x1d9')));}});};};Dialer[_0x44ae('0x16')][_0x44ae('0x1da')]=function(_0x226459){var _0x130163=this;return function(_0x4ff5a3){return new BPromise(function(_0x4b5dc5,_0x30a5c5){_['merge'](_0x226459,_0x4ff5a3[0x0]);if(checkGetDataPredictive(_0x4ff5a3[0x0])){loggerPredictive[_0x44ae('0x79')](JSON[_0x44ae('0x40')](_0x4ff5a3[0x0]));if(_0x226459[_0x44ae('0x1c8')]==='dropRate'){return _0x130163[_0x44ae('0xc4')](_0x226459['id'])[_0x44ae('0xb7')](function(_0x18f05e){var _0x57f033=_0x226459[_0x44ae('0x157')]-_0x18f05e[0x0][_0x44ae('0x1db')];var _0x3901a6=_0x226459[_0x44ae('0x1c6')]*0x3c;var _0x16c1b6=_0x4ff5a3[0x0]['predictiveIntervalAvgTalktime']+_0x4ff5a3[0x0]['predictiveIntervalAvgHoldtime'];var _0x31f37d=(_0x4ff5a3[0x0]['predictiveIntervalAnsweredCalls']+_0x4ff5a3[0x0][_0x44ae('0x66')]+_0x4ff5a3[0x0][_0x44ae('0x65')])/_0x4ff5a3[0x0][_0x44ae('0x69')];var _0x3aec88=_0x226459[_0x44ae('0x1d4')]/0x64;_0x226459[_0x44ae('0x1dc')]=_0x18f05e[0x0][_0x44ae('0x1db')]||0x0;_0x226459[_0x44ae('0x1c0')]=_0x31f37d>0x0?_0x31f37d:0x1;return _0x130163[_0x44ae('0x1d5')](_0x57f033,_0x3901a6,_0x16c1b6,_0x31f37d,_0x3aec88);})[_0x44ae('0xb7')](function(_0x2fc359){return _0x4b5dc5(_0x2fc359);})[_0x44ae('0xb4')](function(_0x1ef75a){return _0x30a5c5(msgResponse(_0x44ae('0x1dd'),_0x44ae('0x13c'),JSON['stringify'](_0x1ef75a)));});}if(_0x226459[_0x44ae('0x1c8')]===_0x44ae('0x1d6')){return _0x130163[_0x44ae('0xc4')](_0x226459['id'])[_0x44ae('0xb7')](function(_0x238517){var _0x3403ed=_0x226459['loggedIn']-_0x238517[0x0][_0x44ae('0x1db')];var _0x4b50c9=_0x226459[_0x44ae('0x1c6')]*0x3c;var _0x6ed1e2=_0x4ff5a3[0x0][_0x44ae('0x64')]+_0x4ff5a3[0x0][_0x44ae('0x63')];var _0x1f3feb=(_0x4ff5a3[0x0][_0x44ae('0x7c')]+_0x4ff5a3[0x0][_0x44ae('0x66')]+_0x4ff5a3[0x0][_0x44ae('0x65')])/_0x4ff5a3[0x0][_0x44ae('0x69')];var _0xea26b7=_0x226459[_0x44ae('0x1d4')]/0x64;_0x226459[_0x44ae('0x1dc')]=_0x238517[0x0][_0x44ae('0x1db')]||0x0;_0x226459[_0x44ae('0x1c0')]=_0x1f3feb>0x0?_0x1f3feb:0x1;return _0x130163[_0x44ae('0x1d7')](_0x3403ed,_0x4b50c9,_0x6ed1e2,_0x1f3feb,_0xea26b7);})[_0x44ae('0xb7')](function(_0x4ae183){return _0x4b5dc5(_0x4ae183);})[_0x44ae('0xb4')](function(_0x528083){return _0x30a5c5(msgResponse(_0x44ae('0x1dd'),_0x44ae('0x13c'),JSON[_0x44ae('0x40')](_0x528083)));});}}else{return _0x30a5c5(msgResponse(_0x44ae('0x1d8'),'Failure','check\x20failure'));}});};};Dialer[_0x44ae('0x16')][_0x44ae('0x1ce')]=function(_0x34e814){var _0x30d89b=this;return function(){var _0x5ab539=0x0;var _0x35cd05=Math['floor'](_0x34e814[_0x44ae('0x86')]*0x3e8);if(_0x35cd05>0x0){_0x35cd05=_0x35cd05<0x64?0x64:_0x35cd05;loggerPredictive[_0x44ae('0x79')](_0x34e814[_0x44ae('0x3c')],'one\x20call\x20every:',_0x35cd05,_0x44ae('0x41'));_0x34e814[_0x44ae('0x8b')]=setInterval(function(){_0x30d89b[_0x44ae('0x8b')](_0x34e814);loggerPredictiveCalls[_0x44ae('0x79')](_0x44ae('0x1de'),_0x5ab539+=0x1);},_0x35cd05);}else{loggerPredictive[_0x44ae('0x79')](_0x34e814[_0x44ae('0x3c')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype']['checkContactBlack']=function(_0x54346b,_0x1b6387){var _0xd27bfd=this;return function(_0x3754ba){if(_['isEmpty'](_0x3754ba)){if(_[_0x44ae('0xa9')](_0x1b6387[_0x44ae('0xcf')])||!_0x1b6387[_0x44ae('0x1df')]){if(_0x54346b[_0x44ae('0x52')]===_0x44ae('0x152')){_0x54346b[_0x44ae('0x129')]=_['isUndefined'](_0x54346b[_0x44ae('0x129')])?!![]:_0x54346b['queueStatusComplete'];var _0x3f2719=uuid['v4']();_0xd27bfd['actions'][_0x3f2719]=new Action(_0x54346b,_0x1b6387,_0x3f2719);loggerBooked['info'](_0x44ae('0x1e0'),_0x3f2719,_0x44ae('0x1e1'),JSON[_0x44ae('0x40')](_0x54346b['queueStatusComplete']),_0x44ae('0x1e2'),_0x54346b['name']);if(_0x54346b[_0x44ae('0x129')]){_0x54346b[_0x44ae('0x129')]=![];_0xd27bfd[_0x44ae('0x22')][_0xd27bfd[_0x44ae('0xa7')][_0x3f2719][_0x44ae('0xaf')]]=[];ami[_0x44ae('0xaa')]({'actionid':_0x3f2719,'action':_0x44ae('0x1e3'),'queue':_0x54346b[_0x44ae('0x3c')]})[_0x44ae('0xb4')](function(_0xb0253c){_0xd27bfd[_0x44ae('0xb0')](_0x54346b);_0xd27bfd[_0x44ae('0xbe')]({'active':![],'ContactId':_0xd27bfd[_0x44ae('0xa7')][_0x3f2719][_0x44ae('0xce')],'ListId':_0xd27bfd['actions'][_0x3f2719]['ListId'],'VoiceQueueId':_0xd27bfd[_0x44ae('0xa7')][_0x3f2719][_0x44ae('0xd0')]||undefined,'CampaignId':_0xd27bfd[_0x44ae('0xa7')][_0x3f2719][_0x44ae('0xd1')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0xd27bfd[_0x44ae('0xa7')][_0x3f2719];});}else{loggerBooked[_0x44ae('0x79')](_0x44ae('0x1e4'),JSON[_0x44ae('0x40')](_0x54346b[_0x44ae('0x129')]),'Queue:\x20',_0x54346b['name']);_0xd27bfd[_0x44ae('0xb0')](_0x54346b);_0xd27bfd['rescheduleContact']({'active':![],'ContactId':_0xd27bfd[_0x44ae('0xa7')][_0x3f2719][_0x44ae('0xce')],'ListId':_0xd27bfd[_0x44ae('0xa7')][_0x3f2719][_0x44ae('0xf8')],'VoiceQueueId':_0xd27bfd[_0x44ae('0xa7')][_0x3f2719][_0x44ae('0xd0')]||undefined,'CampaignId':_0xd27bfd['actions'][_0x3f2719][_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch(_0x44ae('0x1e5')));delete _0xd27bfd['actions'][_0x3f2719];}}else{return _0xd27bfd[_0x44ae('0x160')](_0x54346b,_0x1b6387);}}else{if(getDiff(_0x1b6387['scheduledat'])<_0x54346b[_0x44ae('0x1e6')]*0x3c){if(_0x1b6387[_0x44ae('0x1e7')]&&!_0x1b6387[_0x44ae('0x1e7')][_0x44ae('0x1e8')]){_0xd27bfd[_0x44ae('0x1a')]['run'](_0x1b6387['id'])[_0x44ae('0x12c')](function(){_0xd27bfd[_0x44ae('0xb0')](_0x54346b);});}else{_0xd27bfd[_0x44ae('0xbf')]({'active':![]},_0x1b6387['id'],0x1)[_0x44ae('0x12c')](function(){console['log']('Contact\x20updated');_0xd27bfd['updateOriginated'](_0x54346b);});}}else{_0x54346b[_0x44ae('0x60')]+=0x1;_0xd27bfd[_0x44ae('0xb0')](_0x54346b);if(_0x54346b[_0x44ae('0x1e9')]){_0xd27bfd[_0x44ae('0xbe')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1b6387[_0x44ae('0xce')],'ListId':_0x1b6387[_0x44ae('0xf8')],'VoiceQueueId':_0x1b6387[_0x44ae('0xd0')]||undefined,'CampaignId':_0x1b6387[_0x44ae('0xd1')]||undefined})[_0x44ae('0xb4')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0xd27bfd[_0x44ae('0xc8')](createObjHistory(_0x54346b,_0x1b6387,'RECALLINQUEUE',0x17,'RecallInQueue'))[_0x44ae('0xb4')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0xd27bfd[_0x44ae('0xd8')](createObjHistory(_0x54346b,_0x1b6387,'RECALLFAILEDTIMEOUT',0x16,_0x44ae('0x1ea')),_0x44ae('0x1eb'),_0x44ae('0x1ec'));}}}}else{_0x54346b[_0x44ae('0x59')]+=0x1;_0xd27bfd[_0x44ae('0xd8')](createObjHistory(_0x54346b,_0x1b6387,_0x44ae('0x1ed'),0xd,_0x44ae('0x1ee')),_0x44ae('0x1ef'),'[Originate][MoveBlacklist]');throw _0x44ae('0x1f0');}};};Dialer[_0x44ae('0x16')][_0x44ae('0x156')]=function(_0xe995f9){var _0xafbe0b=this;var _0x48765b=[];var _0x5ea9ca=_0xe995f9[_0x44ae('0x1f1')]-_0xe995f9[_0x44ae('0x6a')]-_0xe995f9['temp'];emitCampaignSummary(_0xe995f9);if(_0x5ea9ca>0x0){if(_0x5ea9ca>this[_0x44ae('0x1e')]){_0x5ea9ca=this[_0x44ae('0x1e')];}_0xe995f9[_0x44ae('0x1f2')]+=_0x5ea9ca;this[_0x44ae('0xc3')](_0xe995f9['id'],_0x5ea9ca,_0xe995f9[_0x44ae('0x1f3')])['then'](function(_0x1be6bd){_0xe995f9['temp']-=_0x5ea9ca;_0xe995f9[_0x44ae('0x1f2')]=_0xe995f9[_0x44ae('0x1f2')]>0x0?_0xe995f9[_0x44ae('0x1f2')]:0x0;if(!checkContactEmpty(_0x1be6bd)){_0xe995f9[_0x44ae('0x39')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x44ae('0x79')](_0x44ae('0x1f4')+_0xe995f9[_0x44ae('0x3c')]);}else{_0xe995f9[_0x44ae('0x6a')]+=_0x1be6bd[_0x44ae('0x93')];_0xe995f9[_0x44ae('0x39')]=_0x44ae('0x1f5');for(var _0x3849b3=0x0;_0x3849b3<_0x1be6bd[_0x44ae('0x93')];_0x3849b3+=0x1){_0xe995f9[_0x44ae('0x1f6')]+=0x1;if(_[_0x44ae('0xa9')](_0x1be6bd[_0x3849b3])||_['isNil'](_0x1be6bd[_0x3849b3][_0x44ae('0x164')])||_[_0x44ae('0xa9')](_0x1be6bd[_0x3849b3][_0x44ae('0x164')]['phone'])){_0xafbe0b[_0x44ae('0xcc')](_0x44ae('0x1f7'),_0xe995f9,_0x1be6bd[_0x3849b3]);}else{_0xafbe0b[_0x44ae('0xb9')](_[_0x44ae('0xcd')](_0x1be6bd[_0x3849b3],[_0x44ae('0xd1'),_0x44ae('0x1f8')]))[_0x44ae('0xb7')](_0xafbe0b['checkContactBlack'](_0xe995f9,_0x1be6bd[_0x3849b3]))[_0x44ae('0xb4')](_0xafbe0b['loggerHandler'](_0x44ae('0x1f9'),_0xe995f9));}}}})[_0x44ae('0xb4')](loggerGetContactDialer(_0x44ae('0x1fa'),_0xe995f9,_0x5ea9ca));}};Dialer[_0x44ae('0x16')][_0x44ae('0x150')]=function(_0x2f5240,_0x578ad8){var _0x3f6243=this;var _0x5b6c8c=[];var _0x17a2fc=_0x578ad8>=0x1?_0x578ad8:0x1;var _0x2d9338=[];if(_0x2f5240[_0x44ae('0x52')]===_0x44ae('0x152')){_0x17a2fc=0x1;}var _0x7d52f4=Math[_0x44ae('0x1fb')](_0x2f5240[_0x44ae('0x49')]*_0x17a2fc)-_0x2f5240[_0x44ae('0x6a')]-_0x2f5240[_0x44ae('0x1f2')];emitVoiceQueueSummary(_0x2f5240);if(_0x2f5240[_0x44ae('0x1fc')]>0x0){var _0x34befb=_0x2f5240[_0x44ae('0x1fc')]-_0x2f5240[_0x44ae('0x6a')]-_0x2f5240[_0x44ae('0x4c')]-_0x2f5240['temp']-_0x2f5240[_0x44ae('0x9d')];if(_0x7d52f4>_0x34befb){_0x7d52f4=_0x34befb;}}if(_0x7d52f4>0x0){if(_0x2f5240[_0x44ae('0x52')]===_0x44ae('0x152')){_0x7d52f4=0x1;}if(_0x7d52f4>this['maxNumberOriginate']){_0x7d52f4=this['maxNumberOriginate'];}_0x2f5240[_0x44ae('0x1f2')]+=_0x7d52f4;for(var _0x5b03ff in this[_0x44ae('0x1c')]){if(this[_0x44ae('0x1c')]['hasOwnProperty'](_0x5b03ff)){if(this[_0x44ae('0x1c')][_0x5b03ff]['state']===_0x44ae('0x1fd')&&this[_0x44ae('0x1c')][_0x5b03ff][_0x44ae('0xab')]==='reachable'){_0x5b6c8c[_0x44ae('0x127')](this['agents'][_0x5b03ff]['id']);}}}this[_0x44ae('0xc1')](_0x2f5240['id'],_0x5b6c8c,_0x7d52f4,_0x2f5240[_0x44ae('0x1f3')])[_0x44ae('0xb7')](function(_0x328b1b){_0x2f5240[_0x44ae('0x1f2')]-=_0x7d52f4;_0x2f5240[_0x44ae('0x1f2')]=_0x2f5240['temp']>0x0?_0x2f5240[_0x44ae('0x1f2')]:0x0;if(!checkContactEmpty(_0x328b1b)){_0x3f6243[_0x44ae('0xb2')](_0x2f5240)[_0x44ae('0xb7')](sendMessageReschedule(_0x2f5240))[_0x44ae('0xb4')](loggerCatch(_0x44ae('0xb5')));}else{_0x2f5240[_0x44ae('0x6a')]+=_0x328b1b['length'];_0x2f5240['message']=_0x2f5240[_0x44ae('0x52')]===_0x44ae('0x152')?_0x44ae('0x16b'):'RUNNING';for(var _0x40ce06=0x0;_0x40ce06<_0x328b1b[_0x44ae('0x93')];_0x40ce06+=0x1){if(_[_0x44ae('0xa9')](_0x328b1b[_0x40ce06])||_[_0x44ae('0xa9')](_0x328b1b[_0x40ce06][_0x44ae('0x164')])||_[_0x44ae('0xa9')](_0x328b1b[_0x40ce06][_0x44ae('0x164')][_0x44ae('0x165')])){_0x3f6243['emptyContact'](_0x44ae('0x1f7'),_0x2f5240,_0x328b1b[_0x40ce06]);}else{_0x3f6243[_0x44ae('0xb6')](_[_0x44ae('0xcd')](_0x328b1b[_0x40ce06],[_0x44ae('0xd0'),_0x44ae('0x1f8')]))[_0x44ae('0xb7')](_0x3f6243[_0x44ae('0x1fe')](_0x2f5240,_0x328b1b[_0x40ce06]))[_0x44ae('0xb4')](_0x3f6243[_0x44ae('0xcb')](_0x44ae('0x1f7'),_0x2f5240));}}}})[_0x44ae('0xb4')](loggerGetContactDialer('[getContactDialer2]',_0x2f5240,_0x7d52f4));}};Dialer[_0x44ae('0x16')][_0x44ae('0x8b')]=function(_0x660411){var _0x6cc73e=this;if(_0x660411[_0x44ae('0x1fc')]>0x0){var _0x4031fc=_0x660411[_0x44ae('0x1fc')]-_0x660411[_0x44ae('0x6a')]-_0x660411[_0x44ae('0x4c')];if(_0x4031fc>0x0){this[_0x44ae('0x1ff')](_0x660411);}else{loggerPredictiveCalls[_0x44ae('0x79')]('[handlePredictive][limitChannel]');}}else{this[_0x44ae('0x1ff')](_0x660411);}};Dialer[_0x44ae('0x16')][_0x44ae('0x1ff')]=function(_0x7bcc58){var _0x30c9a3=this;var _0x14eb61=[];_0x7bcc58[_0x44ae('0x6a')]+=0x1;for(var _0x14a15e in this['agents']){if(this['agents'][_0x44ae('0x94')](_0x14a15e)){if(this['agents'][_0x14a15e][_0x44ae('0xa3')]===_0x44ae('0x1fd')&&this[_0x44ae('0x1c')][_0x14a15e][_0x44ae('0xab')]===_0x44ae('0x200')){_0x14eb61[_0x44ae('0x127')](this['agents'][_0x14a15e]['id']);}}}this[_0x44ae('0xc1')](_0x7bcc58['id'],_0x14eb61,0x1,_0x7bcc58[_0x44ae('0x1f3')])[_0x44ae('0xb7')](function(_0x2090ac){if(!checkContactEmpty(_0x2090ac)){checkContactLowerLimitOriginate(_0x7bcc58,0x1,0x0);_0x30c9a3[_0x44ae('0xb2')](_0x7bcc58)[_0x44ae('0xb7')](sendMessageReschedule(_0x7bcc58))[_0x44ae('0xb4')](loggerCatch('[countReScheduled]\x20'));}else{_0x7bcc58[_0x44ae('0x39')]=_0x44ae('0x1f5');if(_['isNil'](_0x2090ac[0x0])||_[_0x44ae('0xa9')](_0x2090ac[0x0]['Contact'])||_[_0x44ae('0xa9')](_0x2090ac[0x0][_0x44ae('0x164')]['phone'])){_0x30c9a3[_0x44ae('0xcc')](_0x44ae('0x1f7'),_0x7bcc58,_0x2090ac[0x0]);}else{_0x30c9a3['checkIsBlackList'](_[_0x44ae('0xcd')](_0x2090ac[0x0],[_0x44ae('0xd0'),_0x44ae('0x1f8')]))[_0x44ae('0xb7')](_0x30c9a3[_0x44ae('0x1fe')](_0x7bcc58,_0x2090ac[0x0]))[_0x44ae('0xb4')](_0x30c9a3[_0x44ae('0xcb')](_0x44ae('0x201'),_0x7bcc58));}}})['catch'](loggerGetContactDialer(_0x44ae('0x202'),_0x7bcc58,0x1));emitVoiceQueueSummary(_0x7bcc58);};Dialer[_0x44ae('0x16')][_0x44ae('0x1d5')]=function(_0x26c6f7,_0x265786,_0x4dd18c,_0x4908ac,_0x32d8c2,_0x35604f){loggerPredictive[_0x44ae('0x79')](_0x44ae('0x203'));loggerPredictive['info'](_0x44ae('0x204'),_0x26c6f7);loggerPredictive[_0x44ae('0x79')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x265786);loggerPredictive[_0x44ae('0x79')]('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',_0x4dd18c);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x205'),_0x4908ac);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x206'),_0x32d8c2);loggerPredictive['info'](_0x44ae('0x80'));return new BPromise(function(_0x104efd,_0x4d0cbb){if(_0x26c6f7<=0x0||isNaN(_0x26c6f7)){return _0x4d0cbb(msgResponse(_0x44ae('0x207'),_0x44ae('0x18e'),_0x44ae('0x208')+_0x26c6f7));}if(_0x4dd18c<=0x0||isNaN(_0x4dd18c)){return _0x4d0cbb(msgResponse(_0x44ae('0x207'),'Error','Ts\x20=\x20'+_0x4dd18c));}if(_0x4908ac<=0x0||isNaN(_0x4908ac)){return _0x4d0cbb(msgResponse(_0x44ae('0x207'),_0x44ae('0x18e'),'p\x20=\x20'+_0x4908ac));}if(_0x265786<=0x0||isNaN(_0x265786)){return _0x4d0cbb(msgResponse(_0x44ae('0x207'),_0x44ae('0x18e'),'interval\x20=\x20'+_0x265786));}if(_0x32d8c2<=0x0||isNaN(_0x32d8c2)){return _0x4d0cbb(msgResponse(_0x44ae('0x207'),_0x44ae('0x18e'),'Amax\x20=\x20'+_0x32d8c2));}_0x35604f=_0x35604f||0x0;var _0x477a21=0x1/_0x4dd18c;var _0x3f1822=0x0;var _0x281879=0x0;var _0x4f11e8=0x0;var _0x3b77e4=0x0;for(var _0x3600be=0x0;_0x4f11e8<_0x32d8c2;_0x3600be+=0x1){_0x281879=_0x3600be/_0x265786;_0x3f1822=(_0x4908ac*_0x281879+_0x35604f)/_0x477a21;_0x4f11e8=erlangb(_0x3f1822,_0x26c6f7);_0x3b77e4=_0x3f1822/_0x26c6f7*(0x1-erlangb(_0x3f1822,_0x26c6f7));}return _0x104efd({'erlangCalls':_0x3600be,'erlangCallToSecond':_0x265786/_0x3600be,'erlangAbandonmentRate':_0x4f11e8,'erlangBusyFactor':_0x3b77e4});});};Dialer[_0x44ae('0x16')][_0x44ae('0x1d7')]=function(_0x2b1130,_0x52c96f,_0x5abab3,_0xa578b2,_0x151808,_0xf786a8){loggerPredictive[_0x44ae('0x79')](_0x44ae('0x209'));loggerPredictive[_0x44ae('0x79')](_0x44ae('0x204'),_0x2b1130);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x20a'),_0x52c96f);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x20b'),_0x5abab3);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x205'),_0xa578b2);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x20c'),_0x151808);loggerPredictive[_0x44ae('0x79')](_0x44ae('0x80'));return new BPromise(function(_0x38e6dd,_0x1e32da){if(_0x2b1130<=0x0||isNaN(_0x2b1130)){return _0x1e32da(msgResponse(_0x44ae('0x20d'),_0x44ae('0x18e'),'m\x20=\x20'+_0x2b1130));}if(_0x5abab3<=0x0||isNaN(_0x5abab3)){return _0x1e32da(msgResponse(_0x44ae('0x20d'),_0x44ae('0x18e'),_0x44ae('0x20e')+_0x5abab3));}if(_0xa578b2<=0x0||isNaN(_0xa578b2)){return _0x1e32da(msgResponse('[busyFactor]',_0x44ae('0x18e'),_0x44ae('0x20f')+_0xa578b2));}if(_0x52c96f<=0x0||isNaN(_0x52c96f)){return _0x1e32da(msgResponse(_0x44ae('0x20d'),'Error',_0x44ae('0x210')+_0x52c96f));}if(_0x151808<=0x0||isNaN(_0x151808)){return _0x1e32da(msgResponse(_0x44ae('0x20d'),_0x44ae('0x18e'),_0x44ae('0x211')+_0x151808));}_0xf786a8=_0xf786a8||0x0;var _0xe7750b=0x1/_0x5abab3;var _0x4c3d5b=0x0;var _0x3290ac=0x0;var _0xd11c31=0x0;var _0x3b0f41=0x0;for(var _0x3b8abe=0x0;_0x3b0f41<_0x151808;_0x3b8abe+=0x1){_0x3290ac=_0x3b8abe/_0x52c96f;_0x4c3d5b=(_0xa578b2*_0x3290ac+_0xf786a8)/_0xe7750b;_0xd11c31=erlangb(_0x4c3d5b,_0x2b1130);_0x3b0f41=_0x4c3d5b/_0x2b1130*(0x1-erlangb(_0x4c3d5b,_0x2b1130));}return _0x38e6dd({'erlangCalls':_0x3b8abe,'erlangCallToSecond':_0x52c96f/_0x3b8abe,'erlangAbandonmentRate':_0xd11c31,'erlangBusyFactor':_0x3b0f41});});};module[_0x44ae('0x212')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index ad503b9..69c4145 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 _0xd93b=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x3710a4,_0x411b57){var _0x470675=function(_0x27892d){while(--_0x27892d){_0x3710a4['push'](_0x3710a4['shift']());}};_0x470675(++_0x411b57);}(_0xd93b,0x114));var _0xbd93=function(_0x26b5aa,_0x2bbac5){_0x26b5aa=_0x26b5aa-0x0;var _0x3171f6=_0xd93b[_0x26b5aa];return _0x3171f6;};'use strict';var util=require(_0xbd93('0x0'));var _=require(_0xbd93('0x1'));var moment=require(_0xbd93('0x2'));function getSeconds(_0x4e3c7a,_0x1a7fee){var _0x1dce21=moment(_0x4e3c7a)[_0xbd93('0x3')](0x0);var _0x6a0a10=moment(_0x1a7fee)['milliseconds'](0x0);return _0x1dce21['diff'](_0x6a0a10,_0xbd93('0x4'));}function QueueCallerAbandon(_0x2c57bf,_0x29ecc6){this[_0xbd93('0x5')]=_0x2c57bf[_0xbd93('0x5')];this[_0xbd93('0x6')]=_0x2c57bf[_0xbd93('0x6')];this[_0xbd93('0x7')]=_0x2c57bf[_0xbd93('0x6')]===_0xbd93('0x8')?_0xbd93('0x9'):_0x2c57bf[_0xbd93('0x6')];this[_0xbd93('0xa')]=_0x2c57bf['countbusyretry'];this['countcongestionretry']=_0x2c57bf['countcongestionretry'];this['countnoanswerretry']=_0x2c57bf['countnoanswerretry'];this[_0xbd93('0xb')]=_0x2c57bf[_0xbd93('0xa')]+_0x2c57bf['countcongestionretry']+_0x2c57bf[_0xbd93('0xc')]+_0x2c57bf[_0xbd93('0xd')]+_0x2c57bf[_0xbd93('0xe')]+_0x2c57bf[_0xbd93('0xf')]+_0x2c57bf[_0xbd93('0x10')]+_0x2c57bf[_0xbd93('0x11')];this[_0xbd93('0xd')]=_0x2c57bf[_0xbd93('0xd')];this[_0xbd93('0xe')]=_0x2c57bf[_0xbd93('0xe')];this['countabandonedretry']=_0x2c57bf['countabandonedretry'];this[_0xbd93('0x10')]=_0x2c57bf[_0xbd93('0x10')];this[_0xbd93('0x11')]=_0x2c57bf[_0xbd93('0x11')];this[_0xbd93('0x12')]=_0x29ecc6[_0xbd93('0x12')];this[_0xbd93('0x13')]=_0x2c57bf[_0xbd93('0x14')];this[_0xbd93('0x15')]=_0x2c57bf[_0xbd93('0x16')];this[_0xbd93('0x17')]=_0x2c57bf[_0xbd93('0x17')];this['responsetime']=_0x2c57bf[_0xbd93('0x18')];this[_0xbd93('0x19')]=_0x2c57bf[_0xbd93('0x19')];this[_0xbd93('0x1a')]=this[_0xbd93('0x19')];this[_0xbd93('0x1b')]=getSeconds(_0x2c57bf[_0xbd93('0x18')],_0x2c57bf[_0xbd93('0x17')]);this[_0xbd93('0x1c')]=getSeconds(this[_0xbd93('0x19')],_0x2c57bf['responsetime']);this[_0xbd93('0x1d')]=0x0;this[_0xbd93('0x9')]=_0x29ecc6[_0xbd93('0x9')];this[_0xbd93('0x1e')]=_0x29ecc6['connectedlinename'];this[_0xbd93('0x1f')]=_0x29ecc6['reason'];this[_0xbd93('0x20')]=_0x2c57bf[_0xbd93('0x20')];this[_0xbd93('0x21')]=_0x2c57bf[_0xbd93('0x21')];this[_0xbd93('0x22')]=_0x2c57bf[_0xbd93('0x22')];this['recallme']=_0x2c57bf[_0xbd93('0x23')];this[_0xbd93('0x24')]=_0x2c57bf[_0xbd93('0x24')];this['ListId']=_0x2c57bf[_0xbd93('0x25')];this[_0xbd93('0x26')]=_0x2c57bf[_0xbd93('0x26')];this[_0xbd93('0x27')]=_0x2c57bf['VoiceQueueId'];this[_0xbd93('0x28')]=_0x2c57bf[_0xbd93('0x28')];this['originatecalleridnum']=_0x2c57bf['originatecalleridnum']||'';this[_0xbd93('0x29')]=_0x2c57bf[_0xbd93('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x2496=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound'];(function(_0x2cbae3,_0x4eaf49){var _0x2697d0=function(_0x2481c0){while(--_0x2481c0){_0x2cbae3['push'](_0x2cbae3['shift']());}};_0x2697d0(++_0x4eaf49);}(_0x2496,0x70));var _0x6249=function(_0x4de9b1,_0x4495a3){_0x4de9b1=_0x4de9b1-0x0;var _0x22115c=_0x2496[_0x4de9b1];return _0x22115c;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x6249('0x0'));function getSeconds(_0x27bc32,_0x513d24){var _0x2914ab=moment(_0x27bc32)[_0x6249('0x1')](0x0);var _0x3cc9ef=moment(_0x513d24)[_0x6249('0x1')](0x0);return _0x2914ab[_0x6249('0x2')](_0x3cc9ef,_0x6249('0x3'));}function QueueCallerAbandon(_0x3fd2fc,_0x5f666d){this['scheduledat']=_0x3fd2fc[_0x6249('0x4')];this[_0x6249('0x5')]=_0x3fd2fc['type'];this[_0x6249('0x6')]=_0x3fd2fc[_0x6249('0x5')]===_0x6249('0x7')?_0x6249('0x8'):_0x3fd2fc[_0x6249('0x5')];this[_0x6249('0x9')]=_0x3fd2fc[_0x6249('0x9')];this['countcongestionretry']=_0x3fd2fc[_0x6249('0xa')];this['countnoanswerretry']=_0x3fd2fc['countnoanswerretry'];this['countglobal']=_0x3fd2fc[_0x6249('0x9')]+_0x3fd2fc[_0x6249('0xa')]+_0x3fd2fc[_0x6249('0xb')]+_0x3fd2fc[_0x6249('0xc')]+_0x3fd2fc[_0x6249('0xd')]+_0x3fd2fc['countabandonedretry']+_0x3fd2fc[_0x6249('0xe')]+_0x3fd2fc[_0x6249('0xf')];this[_0x6249('0xc')]=_0x3fd2fc[_0x6249('0xc')];this[_0x6249('0xd')]=_0x3fd2fc[_0x6249('0xd')];this[_0x6249('0x10')]=_0x3fd2fc['countabandonedretry'];this['countmachineretry']=_0x3fd2fc[_0x6249('0xe')];this[_0x6249('0xf')]=_0x3fd2fc[_0x6249('0xf')];this[_0x6249('0x11')]=_0x5f666d[_0x6249('0x11')];this[_0x6249('0x12')]=_0x3fd2fc[_0x6249('0x13')];this[_0x6249('0x14')]=_0x3fd2fc[_0x6249('0x15')];this[_0x6249('0x16')]=_0x3fd2fc[_0x6249('0x16')];this[_0x6249('0x17')]=_0x3fd2fc[_0x6249('0x17')];this[_0x6249('0x18')]=_0x3fd2fc[_0x6249('0x18')];this[_0x6249('0x19')]=this[_0x6249('0x18')];this['ringtime']=getSeconds(_0x3fd2fc[_0x6249('0x17')],_0x3fd2fc[_0x6249('0x16')]);this[_0x6249('0x1a')]=getSeconds(this[_0x6249('0x18')],_0x3fd2fc[_0x6249('0x17')]);this['talktime']=0x0;this[_0x6249('0x8')]=_0x5f666d[_0x6249('0x8')];this['membername']=_0x5f666d[_0x6249('0x1b')];this[_0x6249('0x1c')]=_0x5f666d[_0x6249('0x1c')];this['callback']=_0x3fd2fc[_0x6249('0x1d')];this[_0x6249('0x1e')]=_0x3fd2fc[_0x6249('0x1e')];this['callbackat']=_0x3fd2fc[_0x6249('0x1f')];this[_0x6249('0x20')]=_0x3fd2fc['recallme'];this['ContactId']=_0x3fd2fc[_0x6249('0x21')];this[_0x6249('0x22')]=_0x3fd2fc[_0x6249('0x22')];this[_0x6249('0x23')]=_0x3fd2fc[_0x6249('0x23')];this[_0x6249('0x24')]=_0x3fd2fc[_0x6249('0x24')];this[_0x6249('0x25')]=_0x3fd2fc[_0x6249('0x25')];this[_0x6249('0x26')]=_0x3fd2fc[_0x6249('0x26')]||'';this['originatecalleridname']=_0x3fd2fc['originatecalleridname']||'';}module[_0x6249('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 66e314e..16de7c7 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 _0xae63=['headerinfo','path','AttachmentId','lodash','moment','uniqueid','channel','format','tech','Trunk','name','fax','localstationid'];(function(_0x49df3c,_0x48d544){var _0x428c6f=function(_0x3659fd){while(--_0x3659fd){_0x49df3c['push'](_0x49df3c['shift']());}};_0x428c6f(++_0x48d544);}(_0xae63,0x92));var _0x3ae6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae63[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x3ae6('0x0'));var moment=require(_0x3ae6('0x1'));function Action(_0x55a1da,_0x1012db,_0x26fa93){this[_0x3ae6('0x2')]=_0x55a1da||undefined;this[_0x3ae6('0x3')]=util[_0x3ae6('0x4')]('%s/%s/%s',_0x1012db[_0x3ae6('0x5')],_0x1012db[_0x3ae6('0x6')][_0x3ae6('0x7')],_0x26fa93[_0x3ae6('0x8')]);this[_0x3ae6('0x9')]=_0x1012db['localstationid'];this[_0x3ae6('0xa')]=_0x1012db[_0x3ae6('0xa')];this[_0x3ae6('0xb')]=_0x26fa93['path'];this['AttachmentId']=_0x26fa93[_0x3ae6('0xc')];}module['exports']=Action; \ No newline at end of file +var _0xeceb=['%s/%s/%s','name','fax','localstationid','path','AttachmentId','util','moment','uniqueid','channel','format'];(function(_0x577649,_0x212255){var _0xd465c0=function(_0x42a47f){while(--_0x42a47f){_0x577649['push'](_0x577649['shift']());}};_0xd465c0(++_0x212255);}(_0xeceb,0xa0));var _0xbece=function(_0x541985,_0x5daf2a){_0x541985=_0x541985-0x0;var _0xccd330=_0xeceb[_0x541985];return _0xccd330;};'use strict';var util=require(_0xbece('0x0'));var _=require('lodash');var moment=require(_0xbece('0x1'));function Action(_0x3f80cc,_0x1690c8,_0x124f68){this[_0xbece('0x2')]=_0x3f80cc||undefined;this[_0xbece('0x3')]=util[_0xbece('0x4')](_0xbece('0x5'),_0x1690c8['tech'],_0x1690c8['Trunk'][_0xbece('0x6')],_0x124f68[_0xbece('0x7')]);this['localstationid']=_0x1690c8[_0xbece('0x8')];this['headerinfo']=_0x1690c8['headerinfo'];this[_0xbece('0x9')]=_0x124f68[_0xbece('0x9')];this[_0xbece('0xa')]=_0x124f68[_0xbece('0xa')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 76e1335..5eff204 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 _0x2557=['filename','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','dir','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','bluebird','uuid','moment','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status'];(function(_0x2f81b9,_0x2022ff){var _0x572165=function(_0x3c2d53){while(--_0x3c2d53){_0x2f81b9['push'](_0x2f81b9['shift']());}};_0x572165(++_0x2022ff);}(_0x2557,0x1b5));var _0x7255=function(_0x528820,_0x4748ee){_0x528820=_0x528820-0x0;var _0x309f12=_0x2557[_0x528820];return _0x309f12;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x7255('0x0'));var uuid=require(_0x7255('0x1'));var moment=require(_0x7255('0x2'));var path=require(_0x7255('0x3'));var tiff2pdf=require(_0x7255('0x4'));var gs=require('./util/gs');var logger=require(_0x7255('0x5'))(_0x7255('0x6'));var ami=require(_0x7255('0x7'));var rpcDb=require(_0x7255('0x8'));var Channel=require(_0x7255('0x9'));var ut=require(_0x7255('0xa'));var Action=require(_0x7255('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x7255('0xc'));var faxMessage=require(_0x7255('0xd'));function Fax(_0x9cfe68){this[_0x7255('0xe')]={};this['faxAccounts']=_0x9cfe68[_0x7255('0xf')];this[_0x7255('0x10')]=_0x9cfe68[_0x7255('0x10')];this[_0x7255('0x11')]={};ami['on']('newchannel',this['syncNewchannel'][_0x7255('0x12')](this));ami['on'](_0x7255('0x13'),this[_0x7255('0x14')][_0x7255('0x12')](this));ami['on'](_0x7255('0x15'),this[_0x7255('0x16')][_0x7255('0x12')](this));ami['on'](_0x7255('0x17'),this[_0x7255('0x18')][_0x7255('0x12')](this));ami['on'](_0x7255('0x19'),this[_0x7255('0x1a')][_0x7255('0x12')](this));ami['on'](_0x7255('0x1b'),this['syncReceiveFax'][_0x7255('0x12')](this));ami['on'](_0x7255('0x1c'),this['syncHangup'][_0x7255('0x12')](this));ami['on'](_0x7255('0x1d'),this[_0x7255('0x1e')]['bind'](this));}Fax[_0x7255('0x1f')]['syncNewchannel']=function(_0x332b85){if(_0x332b85[_0x7255('0x20')]===_0x7255('0x21')){for(var _0xa70121 in this[_0x7255('0xf')]){if(this[_0x7255('0xf')]['hasOwnProperty'](_0xa70121)){if(_0x332b85['exten']===this[_0x7255('0xf')][_0xa70121][_0x7255('0x22')]){this['channels'][_0x332b85['uniqueid']]={};this[_0x7255('0xe')][_0x332b85[_0x7255('0x23')]]['channel']=_0x332b85[_0x7255('0x24')];this['channels'][_0x332b85[_0x7255('0x23')]]['id']=this[_0x7255('0xf')][_0xa70121]['id'];this['channels'][_0x332b85[_0x7255('0x23')]][_0x7255('0x25')]=this[_0x7255('0xf')][_0xa70121][_0x7255('0x25')];logger['info'](_0x332b85[_0x7255('0x23')],_0x7255('0x26'));}}}}if(this[_0x7255('0x11')][_0x332b85[_0x7255('0x23')]]){this['channels'][_0x332b85[_0x7255('0x23')]]={};this[_0x7255('0xe')][_0x332b85['uniqueid']][_0x7255('0x24')]=_0x332b85[_0x7255('0x24')];logger[_0x7255('0x27')](_0x332b85[_0x7255('0x23')],_0x7255('0x26'));}};Fax[_0x7255('0x1f')]['syncVarSet']=function(_0x554cce){if(this[_0x7255('0xe')][_0x554cce[_0x7255('0x23')]]){for(var _0x1ae9d4 in _0x554cce[_0x7255('0x28')]){if(_0x554cce[_0x7255('0x28')][_0x7255('0x29')](_0x1ae9d4)){this[_0x7255('0xe')][_0x554cce[_0x7255('0x23')]][_0x1ae9d4]=_0x554cce[_0x7255('0x2a')];}}}};Fax[_0x7255('0x1f')]['syncNewState']=function(_0x468616){if(this[_0x7255('0xe')][_0x468616[_0x7255('0x23')]]){this['channels'][_0x468616['uniqueid']][_0x7255('0x2b')]=_0x468616['channelstate'];this[_0x7255('0xe')][_0x468616[_0x7255('0x23')]][_0x7255('0x2c')]=_0x468616['channelstatedesc'];}};Fax[_0x7255('0x1f')][_0x7255('0x18')]=function(_0xd57087){if(this[_0x7255('0xe')][_0xd57087[_0x7255('0x23')]]){for(var _0x1a0fe2 in _0xd57087[_0x7255('0x28')]){if(_0xd57087[_0x7255('0x28')][_0x7255('0x29')](_0x1a0fe2)){this[_0x7255('0xe')][_0xd57087[_0x7255('0x23')]][_0x1a0fe2]=_0xd57087[_0x7255('0x2a')];}}}};Fax[_0x7255('0x1f')]['syncFaxStatus']=function(_0x44bf6c){if(this[_0x7255('0xe')][_0x44bf6c['uniqueid']]){this[_0x7255('0xe')][_0x44bf6c[_0x7255('0x23')]][_0x7255('0x2d')]=_0x44bf6c[_0x7255('0x2d')];this[_0x7255('0xe')][_0x44bf6c[_0x7255('0x23')]][_0x7255('0x2e')]=_0x44bf6c[_0x7255('0x2e')];this[_0x7255('0xe')][_0x44bf6c['uniqueid']][_0x7255('0x22')]=_0x44bf6c[_0x7255('0x22')];this[_0x7255('0xe')][_0x44bf6c[_0x7255('0x23')]]['filename']=_0x44bf6c[_0x7255('0x2f')];logger[_0x7255('0x27')](_0x44bf6c[_0x7255('0x23')],'\x20syncFaxStatus\x20');}};Fax[_0x7255('0x1f')][_0x7255('0x30')]=function(_0x46a48e){var _0x7b4d30=this;if(this[_0x7255('0xe')][_0x46a48e[_0x7255('0x23')]]){var _0x46a3ae=this[_0x7255('0xe')][_0x46a48e[_0x7255('0x23')]]['id'];this[_0x7255('0xe')][_0x46a48e[_0x7255('0x23')]]['remotestationid']=_0x46a48e[_0x7255('0x31')];this['channels'][_0x46a48e[_0x7255('0x23')]][_0x7255('0x32')]=_0x46a48e['pagestransferred'];this[_0x7255('0xe')][_0x46a48e['uniqueid']][_0x7255('0x22')]=_0x46a48e[_0x7255('0x22')];this[_0x7255('0xe')][_0x46a48e['uniqueid']]['resolution']=_0x46a48e[_0x7255('0x33')];this[_0x7255('0xe')][_0x46a48e[_0x7255('0x23')]]['transferrate']=_0x46a48e[_0x7255('0x34')];this[_0x7255('0xe')][_0x46a48e[_0x7255('0x23')]][_0x7255('0x2f')]=_0x46a48e['filename'];this[_0x7255('0xe')][_0x46a48e[_0x7255('0x23')]][_0x7255('0x35')]=_0x46a48e['calleridnum'];if(this['channels'][_0x46a48e[_0x7255('0x23')]][_0x7255('0x32')]>0x0){tiff2pdf(_0x46a48e['filename'],_0x7255('0x36'),function(_0x28cd41){logger[_0x7255('0x27')](_0x46a48e[_0x7255('0x23')],_0x7255('0x37'),_0x28cd41[_0x7255('0x38')]);attachment['create']({'name':path[_0x7255('0x39')](_0x46a48e[_0x7255('0x2f')])[_0x7255('0x25')],'basename':path['parse'](_0x46a48e[_0x7255('0x2f')])['name']+_0x7255('0x3a'),'type':_0x7255('0x3b')})[_0x7255('0x3c')](function(_0xbb409){faxAccount[_0x7255('0x3d')](_0x46a3ae,{'from':_0x46a48e[_0x7255('0x35')],'mapKey':'fax','body':path[_0x7255('0x39')](_0x46a48e[_0x7255('0x2f')])['name']+_0x7255('0x3a'),'AttachmentId':_0xbb409['id']})[_0x7255('0x3e')](function(_0x20a158){logger[_0x7255('0x3f')](_0x46a48e[_0x7255('0x23')],'\x20notify\x20',JSON[_0x7255('0x40')](_0x20a158));});})['catch'](function(_0x5e17d3){logger[_0x7255('0x3f')](_0x46a48e['uniqueid'],_0x7255('0x41'),JSON[_0x7255('0x40')](_0x5e17d3));});});}logger[_0x7255('0x27')](_0x46a48e[_0x7255('0x23')],_0x7255('0x41'));}};Fax['prototype'][_0x7255('0x1e')]=function(_0x176cdd){if(this[_0x7255('0x11')][_0x176cdd[_0x7255('0x23')]]){_[_0x7255('0x42')](this['channels'][_0x176cdd[_0x7255('0x23')]],_[_0x7255('0x43')](_0x176cdd,[_0x7255('0x44'),_0x7255('0x45')]));}};function updateStatus(_0x43846c){if(_0x43846c['AttachmentId']){faxMessage[_0x7255('0x46')](_0x43846c[_0x7255('0x47')],{'failMessage':_0x7255('0x48')})[_0x7255('0x3c')](function(_0x57981b){ut[_0x7255('0x49')](_0x7255('0x4a'),_0x57981b);})[_0x7255('0x3e')](function(_0x281854){ut['logger'](_0x7255('0x4b'),_0x281854);});}else{ut[_0x7255('0x49')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x7255('0x1f')][_0x7255('0x4c')]=function(_0x1e85a3,_0x300339,_0x3cbb61){var _0x7d73e9=this;var _0x5952e6={};if(_0x300339){_0x5952e6={'read':_0x300339};}else{_0x5952e6={'failMessage':_0x3cbb61};}if(this[_0x7255('0x11')][_0x1e85a3][_0x7255('0x47')]){faxMessage[_0x7255('0x46')](this[_0x7255('0x11')][_0x1e85a3][_0x7255('0x47')],_0x5952e6)[_0x7255('0x3c')](function(_0x4f3c2f){ut[_0x7255('0x49')]('[Fax][Message][Updated]',_0x4f3c2f);})[_0x7255('0x3e')](function(_0x16dabd){ut[_0x7255('0x49')](_0x7255('0x4d'),_0x16dabd);})[_0x7255('0x4e')](function(){delete _0x7d73e9[_0x7255('0xe')][_0x1e85a3];delete _0x7d73e9[_0x7255('0x11')][_0x1e85a3];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x7255('0xe')][_0x1e85a3];delete this['actions'][_0x1e85a3];}};Fax[_0x7255('0x1f')][_0x7255('0x4f')]=function(_0x224842){var _0x5907ab=this;if(this[_0x7255('0xe')][_0x224842[_0x7255('0x23')]]){if(this[_0x7255('0x11')][_0x224842['uniqueid']]){this[_0x7255('0xe')][_0x224842['uniqueid']]['id']=this['actions'][_0x224842[_0x7255('0x23')]]['id'];this['channels'][_0x224842[_0x7255('0x23')]]['name']=this['actions'][_0x224842[_0x7255('0x23')]][_0x7255('0x25')];}logger[_0x7255('0x27')](_0x224842[_0x7255('0x23')],this[_0x7255('0x11')][_0x224842[_0x7255('0x23')]]?_0x7255('0x50'):_0x7255('0x51'),JSON[_0x7255('0x40')](this[_0x7255('0xe')][_0x224842[_0x7255('0x23')]]));if(this[_0x7255('0x11')][_0x224842[_0x7255('0x23')]]){if(this['channels'][_0x224842[_0x7255('0x23')]][_0x7255('0x52')]>0x0&&this[_0x7255('0xe')][_0x224842[_0x7255('0x23')]][_0x7255('0x19')]===_0x7255('0x53')){this[_0x7255('0x4c')](_0x224842[_0x7255('0x23')],!![]);}else{this[_0x7255('0x4c')](_0x224842['uniqueid'],![],this[_0x7255('0xe')][_0x224842[_0x7255('0x23')]][_0x7255('0x54')]?_0x7255('0x55')+this[_0x7255('0xe')][_0x224842['uniqueid']][_0x7255('0x54')]:_0x7255('0x56'));}}}};Fax[_0x7255('0x1f')][_0x7255('0x57')]=function(_0x4bf545){var _0x3ad466=this;return new BPromise(function(_0x9db396,_0x25064a){_0x3ad466[_0x7255('0x58')](_0x4bf545,_0x3ad466[_0x7255('0xf')][_0x4bf545[_0x7255('0x59')]])[_0x7255('0x3c')](function(_0x5064a9){ut['logger'](_0x7255('0x5a'),_0x5064a9);_0x9db396(ut[_0x7255('0x38')](_0x7255('0x5b')));})[_0x7255('0x3e')](function(_0x34298d){ut[_0x7255('0x49')](_0x7255('0x5c'),_0x34298d);updateStatus(_0x4bf545);_0x25064a(ut[_0x7255('0x38')](_0x7255('0x5d')));});});};Fax['prototype'][_0x7255('0x5e')]=function(_0x12001a){var _0x166ca4=this;return new BPromise(function(_0x59580f,_0x5740e5){var _0x244689=_0x166ca4[_0x7255('0x5f')](_0x166ca4[_0x7255('0xf')][_0x12001a[_0x7255('0x59')]][_0x7255('0x60')],_0x12001a);if(_0x244689[_0x7255('0x61')]){_0x59580f(ut[_0x7255('0x38')](_0x7255('0x62')));}else{_0x5740e5(ut[_0x7255('0x38')](_0x244689['message']));}});};function originate(_0x3dbfea,_0x5f2718,_0x2ca8d6){return new BPromise(function(_0x4046a1,_0x1f8d1f){if(_0x2ca8d6){var _0x41a10c=util[_0x7255('0x63')](_0x7255('0x64'),path[_0x7255('0x39')](_0x3dbfea['path'])[_0x7255('0x25')],_0x3dbfea['path']);gs[_0x7255('0x65')](_0x41a10c)['then'](function(){_0x3dbfea[_0x7255('0x3')]=util[_0x7255('0x63')]('%s/%s.tif',path['parse'](_0x3dbfea[_0x7255('0x3')])[_0x7255('0x66')],path[_0x7255('0x39')](_0x3dbfea[_0x7255('0x3')])[_0x7255('0x25')]);_0x5f2718['XMF-PATH']=_0x3dbfea[_0x7255('0x3')];ut[_0x7255('0x49')](_0x7255('0x67'),'');ami['Action'](ut[_0x7255('0x68')](_0x3dbfea,_0x5f2718))[_0x7255('0x3c')](function(_0x597004){_0x4046a1(_0x597004);})['catch'](function(_0x536e60){_0x1f8d1f(_0x536e60);});})[_0x7255('0x3e')](function(_0x1564bb){_0x1f8d1f(_0x1564bb);});}else{ami['Action'](ut[_0x7255('0x68')](_0x3dbfea,_0x5f2718))[_0x7255('0x3c')](function(_0x114a05){_0x4046a1(_0x114a05);})[_0x7255('0x3e')](function(_0x43d54c){_0x1f8d1f(_0x43d54c);});}});}Fax[_0x7255('0x1f')][_0x7255('0x58')]=function(_0x3684c4,_0x43e2f4){var _0x360b58=this;return new BPromise(function(_0x40ba67,_0x5320b5){var _0x1ed3b4=uuid['v4']();var _0x4bdcc9=ut[_0x7255('0x69')](_0x3684c4,_0x43e2f4);_0x360b58[_0x7255('0x11')][_0x1ed3b4]=new Action(_0x1ed3b4,_0x43e2f4,_0x3684c4);var _0x27701a=_0x360b58[_0x7255('0x11')][_0x1ed3b4];if(path[_0x7255('0x39')](_0x3684c4[_0x7255('0x3')])[_0x7255('0x6a')]===_0x7255('0x3a')){originate(_0x27701a,_0x4bdcc9,!![])['then'](function(_0x1034ff){_0x40ba67(_0x1034ff);})[_0x7255('0x3e')](function(_0x2e1239){_0x5320b5(_0x2e1239);});}else{originate(_0x27701a,_0x4bdcc9,![])[_0x7255('0x3c')](function(_0x29ac56){_0x40ba67(_0x29ac56);})[_0x7255('0x3e')](function(_0x4658a6){_0x5320b5(_0x4658a6);});}});};Fax[_0x7255('0x1f')]['isTrunkReachable']=function(_0x1071cb){return!_[_0x7255('0x6b')](_0x1071cb)&&!_['isNil'](_0x1071cb['name'])&&!_[_0x7255('0x6b')](_0x1071cb[_0x7255('0x6c')])&&_0x1071cb[_0x7255('0x6c')]&&!_[_0x7255('0x6b')](this['trunks'][util[_0x7255('0x63')](_0x7255('0x6d'),_0x1071cb[_0x7255('0x25')])])&&!_['isNil'](this[_0x7255('0x10')][util[_0x7255('0x63')]('SIP/%s',_0x1071cb[_0x7255('0x25')])][_0x7255('0x2e')])&&(this[_0x7255('0x10')][util[_0x7255('0x63')](_0x7255('0x6d'),_0x1071cb[_0x7255('0x25')])][_0x7255('0x2e')]===_0x7255('0x6e')||this['trunks'][util[_0x7255('0x63')](_0x7255('0x6d'),_0x1071cb[_0x7255('0x25')])][_0x7255('0x2e')]===_0x7255('0x6f'));};Fax['prototype'][_0x7255('0x5f')]=function(_0x7c3a31,_0x5cd0f4){if(!this[_0x7255('0x70')](_0x7c3a31)){ut['logger'](_0x7255('0x71'),_[_0x7255('0x6b')](_0x7c3a31)?'':_0x7c3a31[_0x7255('0x25')]+_0x7255('0x72'));return{'isValid':![],'message':_0x7255('0x73')};}if(_[_0x7255('0x6b')](_0x5cd0f4[_0x7255('0x6')])){ut[_0x7255('0x49')](_0x7255('0x74'),JSON['stringify'](_0x5cd0f4));return{'isValid':![],'message':_0x7255('0x75')};}if(_[_0x7255('0x6b')](_0x5cd0f4[_0x7255('0x3')])){ut[_0x7255('0x49')](_0x7255('0x76'),JSON[_0x7255('0x40')](_0x5cd0f4));return{'isValid':![],'message':_0x7255('0x77')};}return{'isValid':!![],'message':_0x7255('0x78')};};module['exports']=Fax; \ No newline at end of file +var _0x2f66=['syncNewExten','faxstatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','parse','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','.pdf','isTrunkReachable','isNil','trunks','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten'];(function(_0x59d018,_0x3f1f4d){var _0x35be72=function(_0x58158c){while(--_0x58158c){_0x59d018['push'](_0x59d018['shift']());}};_0x35be72(++_0x3f1f4d);}(_0x2f66,0x143));var _0x62f6=function(_0x3aa640,_0x430b73){_0x3aa640=_0x3aa640-0x0;var _0x1cabbc=_0x2f66[_0x3aa640];return _0x1cabbc;};'use strict';var util=require('util');var _=require(_0x62f6('0x0'));var BPromise=require(_0x62f6('0x1'));var uuid=require(_0x62f6('0x2'));var moment=require(_0x62f6('0x3'));var path=require('path');var tiff2pdf=require(_0x62f6('0x4'));var gs=require(_0x62f6('0x5'));var logger=require(_0x62f6('0x6'))(_0x62f6('0x7'));var ami=require(_0x62f6('0x8'));var rpcDb=require(_0x62f6('0x9'));var Channel=require(_0x62f6('0xa'));var ut=require('./util/util');var Action=require(_0x62f6('0xb'));var faxAccount=require(_0x62f6('0xc'));var attachment=require(_0x62f6('0xd'));var faxMessage=require(_0x62f6('0xe'));function Fax(_0x2bba01){this[_0x62f6('0xf')]={};this[_0x62f6('0x10')]=_0x2bba01[_0x62f6('0x10')];this['trunks']=_0x2bba01['trunks'];this[_0x62f6('0x11')]={};ami['on'](_0x62f6('0x12'),this[_0x62f6('0x13')][_0x62f6('0x14')](this));ami['on'](_0x62f6('0x15'),this[_0x62f6('0x16')][_0x62f6('0x14')](this));ami['on'](_0x62f6('0x17'),this['syncNewState'][_0x62f6('0x14')](this));ami['on'](_0x62f6('0x18'),this[_0x62f6('0x19')][_0x62f6('0x14')](this));ami['on'](_0x62f6('0x1a'),this['syncFaxStatus'][_0x62f6('0x14')](this));ami['on'](_0x62f6('0x1b'),this[_0x62f6('0x1c')]['bind'](this));ami['on']('hangup',this[_0x62f6('0x1d')][_0x62f6('0x14')](this));ami['on']('originateresponse',this[_0x62f6('0x1e')]['bind'](this));}Fax[_0x62f6('0x1f')][_0x62f6('0x13')]=function(_0x2603eb){if(_0x2603eb['context']==='from-voip-provider'){for(var _0x5a7914 in this[_0x62f6('0x10')]){if(this[_0x62f6('0x10')][_0x62f6('0x20')](_0x5a7914)){if(_0x2603eb[_0x62f6('0x21')]===this[_0x62f6('0x10')][_0x5a7914][_0x62f6('0x22')]){this['channels'][_0x2603eb[_0x62f6('0x23')]]={};this['channels'][_0x2603eb[_0x62f6('0x23')]]['channel']=_0x2603eb[_0x62f6('0x24')];this['channels'][_0x2603eb[_0x62f6('0x23')]]['id']=this[_0x62f6('0x10')][_0x5a7914]['id'];this[_0x62f6('0xf')][_0x2603eb['uniqueid']]['name']=this[_0x62f6('0x10')][_0x5a7914][_0x62f6('0x25')];logger[_0x62f6('0x26')](_0x2603eb['uniqueid'],_0x62f6('0x27'));}}}}if(this[_0x62f6('0x11')][_0x2603eb[_0x62f6('0x23')]]){this[_0x62f6('0xf')][_0x2603eb[_0x62f6('0x23')]]={};this[_0x62f6('0xf')][_0x2603eb[_0x62f6('0x23')]][_0x62f6('0x24')]=_0x2603eb['channel'];logger[_0x62f6('0x26')](_0x2603eb[_0x62f6('0x23')],_0x62f6('0x27'));}};Fax[_0x62f6('0x1f')][_0x62f6('0x16')]=function(_0x4cea21){if(this[_0x62f6('0xf')][_0x4cea21[_0x62f6('0x23')]]){for(var _0x4a2335 in _0x4cea21[_0x62f6('0x28')]){if(_0x4cea21[_0x62f6('0x28')][_0x62f6('0x20')](_0x4a2335)){this[_0x62f6('0xf')][_0x4cea21[_0x62f6('0x23')]][_0x4a2335]=_0x4cea21[_0x62f6('0x29')];}}}};Fax[_0x62f6('0x1f')][_0x62f6('0x2a')]=function(_0x2f86ae){if(this['channels'][_0x2f86ae[_0x62f6('0x23')]]){this[_0x62f6('0xf')][_0x2f86ae[_0x62f6('0x23')]][_0x62f6('0x2b')]=_0x2f86ae[_0x62f6('0x2b')];this['channels'][_0x2f86ae[_0x62f6('0x23')]][_0x62f6('0x2c')]=_0x2f86ae[_0x62f6('0x2c')];}};Fax[_0x62f6('0x1f')][_0x62f6('0x19')]=function(_0x2f50ee){if(this['channels'][_0x2f50ee[_0x62f6('0x23')]]){for(var _0x3257ce in _0x2f50ee[_0x62f6('0x28')]){if(_0x2f50ee['variable'][_0x62f6('0x20')](_0x3257ce)){this[_0x62f6('0xf')][_0x2f50ee['uniqueid']][_0x3257ce]=_0x2f50ee[_0x62f6('0x29')];}}}};Fax[_0x62f6('0x1f')][_0x62f6('0x2d')]=function(_0xbef9f0){if(this[_0x62f6('0xf')][_0xbef9f0[_0x62f6('0x23')]]){this[_0x62f6('0xf')][_0xbef9f0['uniqueid']]['operation']=_0xbef9f0[_0x62f6('0x2e')];this[_0x62f6('0xf')][_0xbef9f0['uniqueid']][_0x62f6('0x2f')]=_0xbef9f0[_0x62f6('0x2f')];this[_0x62f6('0xf')][_0xbef9f0[_0x62f6('0x23')]][_0x62f6('0x22')]=_0xbef9f0[_0x62f6('0x22')];this[_0x62f6('0xf')][_0xbef9f0['uniqueid']]['filename']=_0xbef9f0[_0x62f6('0x30')];logger[_0x62f6('0x26')](_0xbef9f0['uniqueid'],_0x62f6('0x31'));}};Fax[_0x62f6('0x1f')][_0x62f6('0x1c')]=function(_0x75c0b9){var _0xaa229f=this;if(this[_0x62f6('0xf')][_0x75c0b9[_0x62f6('0x23')]]){var _0x3b7941=this[_0x62f6('0xf')][_0x75c0b9[_0x62f6('0x23')]]['id'];this[_0x62f6('0xf')][_0x75c0b9[_0x62f6('0x23')]][_0x62f6('0x32')]=_0x75c0b9[_0x62f6('0x32')];this['channels'][_0x75c0b9[_0x62f6('0x23')]]['pagestransferred']=_0x75c0b9[_0x62f6('0x33')];this[_0x62f6('0xf')][_0x75c0b9[_0x62f6('0x23')]][_0x62f6('0x22')]=_0x75c0b9['localstationid'];this[_0x62f6('0xf')][_0x75c0b9[_0x62f6('0x23')]][_0x62f6('0x34')]=_0x75c0b9[_0x62f6('0x34')];this['channels'][_0x75c0b9['uniqueid']]['transferrate']=_0x75c0b9[_0x62f6('0x35')];this[_0x62f6('0xf')][_0x75c0b9[_0x62f6('0x23')]][_0x62f6('0x30')]=_0x75c0b9[_0x62f6('0x30')];this[_0x62f6('0xf')][_0x75c0b9[_0x62f6('0x23')]][_0x62f6('0x36')]=_0x75c0b9['calleridnum'];if(this['channels'][_0x75c0b9[_0x62f6('0x23')]][_0x62f6('0x33')]>0x0){tiff2pdf(_0x75c0b9[_0x62f6('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x31bf63){logger['info'](_0x75c0b9[_0x62f6('0x23')],'\x20result\x20conversion\x20file\x20',_0x31bf63['message']);attachment['create']({'name':path[_0x62f6('0x37')](_0x75c0b9[_0x62f6('0x30')])[_0x62f6('0x25')],'basename':path[_0x62f6('0x37')](_0x75c0b9[_0x62f6('0x30')])[_0x62f6('0x25')]+'.pdf','type':_0x62f6('0x38')})[_0x62f6('0x39')](function(_0x538f67){faxAccount['notify'](_0x3b7941,{'from':_0x75c0b9[_0x62f6('0x36')],'mapKey':_0x62f6('0x7'),'body':path['parse'](_0x75c0b9[_0x62f6('0x30')])['name']+'.pdf','AttachmentId':_0x538f67['id']})[_0x62f6('0x3a')](function(_0x569f2c){logger[_0x62f6('0x3b')](_0x75c0b9[_0x62f6('0x23')],_0x62f6('0x3c'),JSON[_0x62f6('0x3d')](_0x569f2c));});})[_0x62f6('0x3a')](function(_0x66cd7a){logger[_0x62f6('0x3b')](_0x75c0b9[_0x62f6('0x23')],_0x62f6('0x3e'),JSON[_0x62f6('0x3d')](_0x66cd7a));});});}logger[_0x62f6('0x26')](_0x75c0b9[_0x62f6('0x23')],_0x62f6('0x3e'));}};Fax[_0x62f6('0x1f')][_0x62f6('0x1e')]=function(_0x31388d){if(this[_0x62f6('0x11')][_0x31388d[_0x62f6('0x23')]]){_[_0x62f6('0x3f')](this['channels'][_0x31388d[_0x62f6('0x23')]],_['pick'](_0x31388d,[_0x62f6('0x40'),'reason']));}};function updateStatus(_0x48cf3c){if(_0x48cf3c[_0x62f6('0x41')]){faxMessage[_0x62f6('0x42')](_0x48cf3c[_0x62f6('0x41')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x2688e2){ut[_0x62f6('0x43')](_0x62f6('0x44'),_0x2688e2);})[_0x62f6('0x3a')](function(_0x1f2bd8){ut[_0x62f6('0x43')](_0x62f6('0x45'),_0x1f2bd8);});}else{ut['logger'](_0x62f6('0x46'));}}Fax[_0x62f6('0x1f')][_0x62f6('0x47')]=function(_0xe16b55,_0x2899f3,_0x1d29e4){var _0x19e8b6=this;var _0x38c59b={};if(_0x2899f3){_0x38c59b={'read':_0x2899f3};}else{_0x38c59b={'failMessage':_0x1d29e4};}if(this[_0x62f6('0x11')][_0xe16b55][_0x62f6('0x41')]){faxMessage[_0x62f6('0x42')](this[_0x62f6('0x11')][_0xe16b55][_0x62f6('0x41')],_0x38c59b)['then'](function(_0x35561e){ut['logger']('[Fax][Message][Updated]',_0x35561e);})[_0x62f6('0x3a')](function(_0x1940e9){ut[_0x62f6('0x43')](_0x62f6('0x48'),_0x1940e9);})['finally'](function(){delete _0x19e8b6['channels'][_0xe16b55];delete _0x19e8b6[_0x62f6('0x11')][_0xe16b55];});}else{ut['logger'](_0x62f6('0x49'));delete this[_0x62f6('0xf')][_0xe16b55];delete this[_0x62f6('0x11')][_0xe16b55];}};Fax[_0x62f6('0x1f')][_0x62f6('0x1d')]=function(_0x749764){var _0x10a752=this;if(this[_0x62f6('0xf')][_0x749764[_0x62f6('0x23')]]){if(this[_0x62f6('0x11')][_0x749764[_0x62f6('0x23')]]){this[_0x62f6('0xf')][_0x749764[_0x62f6('0x23')]]['id']=this[_0x62f6('0x11')][_0x749764[_0x62f6('0x23')]]['id'];this[_0x62f6('0xf')][_0x749764[_0x62f6('0x23')]]['name']=this[_0x62f6('0x11')][_0x749764['uniqueid']][_0x62f6('0x25')];}logger[_0x62f6('0x26')](_0x749764[_0x62f6('0x23')],this['actions'][_0x749764[_0x62f6('0x23')]]?_0x62f6('0x4a'):'\x20hangup\x20faxRiceive\x20',JSON[_0x62f6('0x3d')](this[_0x62f6('0xf')][_0x749764['uniqueid']]));if(this['actions'][_0x749764[_0x62f6('0x23')]]){if(this[_0x62f6('0xf')][_0x749764[_0x62f6('0x23')]][_0x62f6('0x4b')]>0x0&&this[_0x62f6('0xf')][_0x749764[_0x62f6('0x23')]][_0x62f6('0x1a')]===_0x62f6('0x4c')){this[_0x62f6('0x47')](_0x749764[_0x62f6('0x23')],!![]);}else{this[_0x62f6('0x47')](_0x749764[_0x62f6('0x23')],![],this[_0x62f6('0xf')][_0x749764[_0x62f6('0x23')]][_0x62f6('0x4d')]?_0x62f6('0x4e')+this['channels'][_0x749764['uniqueid']]['faxstatusstring']:_0x62f6('0x4f'));}}}};Fax[_0x62f6('0x1f')][_0x62f6('0x50')]=function(_0x2c95e6){var _0x4474be=this;return new BPromise(function(_0x3465d9,_0xfe22bf){_0x4474be[_0x62f6('0x51')](_0x2c95e6,_0x4474be['faxAccounts'][_0x2c95e6['FaxAccountId']])[_0x62f6('0x39')](function(_0x163418){ut[_0x62f6('0x43')]('[Fax][execOriginate][success]',_0x163418);_0x3465d9(ut[_0x62f6('0x52')](_0x62f6('0x53')));})[_0x62f6('0x3a')](function(_0x581095){ut[_0x62f6('0x43')](_0x62f6('0x54'),_0x581095);updateStatus(_0x2c95e6);_0xfe22bf(ut[_0x62f6('0x52')](_0x62f6('0x55')));});});};Fax[_0x62f6('0x1f')][_0x62f6('0x56')]=function(_0x206420){var _0x54b43b=this;return new BPromise(function(_0x35530e,_0x2759c7){var _0xb8cbc3=_0x54b43b[_0x62f6('0x57')](_0x54b43b['faxAccounts'][_0x206420['FaxAccountId']][_0x62f6('0x58')],_0x206420);if(_0xb8cbc3[_0x62f6('0x59')]){_0x35530e(ut[_0x62f6('0x52')](_0x62f6('0x5a')));}else{_0x2759c7(ut['message'](_0xb8cbc3[_0x62f6('0x52')]));}});};function originate(_0x1614bc,_0x1ce733,_0x226b83){return new BPromise(function(_0x2bf10c,_0x2b8b55){if(_0x226b83){var _0x343592=util[_0x62f6('0x5b')](_0x62f6('0x5c'),path['parse'](_0x1614bc[_0x62f6('0x5d')])[_0x62f6('0x25')],_0x1614bc[_0x62f6('0x5d')]);gs[_0x62f6('0x5e')](_0x343592)[_0x62f6('0x39')](function(){_0x1614bc['path']=util[_0x62f6('0x5b')](_0x62f6('0x5f'),path[_0x62f6('0x37')](_0x1614bc[_0x62f6('0x5d')])[_0x62f6('0x60')],path[_0x62f6('0x37')](_0x1614bc['path'])[_0x62f6('0x25')]);_0x1ce733[_0x62f6('0x61')]=_0x1614bc[_0x62f6('0x5d')];ut[_0x62f6('0x43')](_0x62f6('0x62'),'');ami[_0x62f6('0x63')](ut[_0x62f6('0x64')](_0x1614bc,_0x1ce733))[_0x62f6('0x39')](function(_0x3015f4){_0x2bf10c(_0x3015f4);})[_0x62f6('0x3a')](function(_0x5b43d9){_0x2b8b55(_0x5b43d9);});})[_0x62f6('0x3a')](function(_0x55ab7d){_0x2b8b55(_0x55ab7d);});}else{ami['Action'](ut[_0x62f6('0x64')](_0x1614bc,_0x1ce733))['then'](function(_0x2bb670){_0x2bf10c(_0x2bb670);})[_0x62f6('0x3a')](function(_0xfb0d8c){_0x2b8b55(_0xfb0d8c);});}});}Fax[_0x62f6('0x1f')][_0x62f6('0x51')]=function(_0x50084e,_0x77e348){var _0x27832d=this;return new BPromise(function(_0x3e4b6c,_0x4bf3c4){var _0x277ba3=uuid['v4']();var _0x59f3cd=ut[_0x62f6('0x65')](_0x50084e,_0x77e348);_0x27832d[_0x62f6('0x11')][_0x277ba3]=new Action(_0x277ba3,_0x77e348,_0x50084e);var _0x5e1023=_0x27832d[_0x62f6('0x11')][_0x277ba3];if(path[_0x62f6('0x37')](_0x50084e[_0x62f6('0x5d')])['ext']===_0x62f6('0x66')){originate(_0x5e1023,_0x59f3cd,!![])[_0x62f6('0x39')](function(_0xc82f33){_0x3e4b6c(_0xc82f33);})[_0x62f6('0x3a')](function(_0x2e7e99){_0x4bf3c4(_0x2e7e99);});}else{originate(_0x5e1023,_0x59f3cd,![])[_0x62f6('0x39')](function(_0x8c4796){_0x3e4b6c(_0x8c4796);})['catch'](function(_0x62821){_0x4bf3c4(_0x62821);});}});};Fax[_0x62f6('0x1f')][_0x62f6('0x67')]=function(_0x1fe43b){return!_[_0x62f6('0x68')](_0x1fe43b)&&!_[_0x62f6('0x68')](_0x1fe43b[_0x62f6('0x25')])&&!_['isNil'](_0x1fe43b['active'])&&_0x1fe43b['active']&&!_['isNil'](this[_0x62f6('0x69')][util[_0x62f6('0x5b')](_0x62f6('0x6a'),_0x1fe43b[_0x62f6('0x25')])])&&!_[_0x62f6('0x68')](this[_0x62f6('0x69')][util['format'](_0x62f6('0x6a'),_0x1fe43b[_0x62f6('0x25')])][_0x62f6('0x2f')])&&(this['trunks'][util[_0x62f6('0x5b')]('SIP/%s',_0x1fe43b['name'])][_0x62f6('0x2f')]==='reachable'||this[_0x62f6('0x69')][util[_0x62f6('0x5b')](_0x62f6('0x6a'),_0x1fe43b['name'])]['status']===_0x62f6('0x6b'));};Fax[_0x62f6('0x1f')][_0x62f6('0x57')]=function(_0x2a9b55,_0x24702c){if(!this[_0x62f6('0x67')](_0x2a9b55)){ut[_0x62f6('0x43')](_0x62f6('0x6c'),_['isNil'](_0x2a9b55)?'':_0x2a9b55[_0x62f6('0x25')]+_0x62f6('0x6d'));return{'isValid':![],'message':_0x62f6('0x6e')};}if(_[_0x62f6('0x68')](_0x24702c[_0x62f6('0x7')])){ut[_0x62f6('0x43')](_0x62f6('0x6f'),JSON[_0x62f6('0x3d')](_0x24702c));return{'isValid':![],'message':_0x62f6('0x70')};}if(_[_0x62f6('0x68')](_0x24702c[_0x62f6('0x5d')])){ut['logger'](_0x62f6('0x71'),JSON[_0x62f6('0x3d')](_0x24702c));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x62f6('0x72')};};module[_0x62f6('0x73')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0ab3b0f..a1210df 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 _0x0438=['error','inspect','notify','resolve','[Notify]\x20','util','bluebird'];(function(_0x55c2d2,_0xb70689){var _0x477f06=function(_0x4fceba){while(--_0x4fceba){_0x55c2d2['push'](_0x55c2d2['shift']());}};_0x477f06(++_0xb70689);}(_0x0438,0xfa));var _0x8043=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x0438[_0x346737];return _0x1ade2e;};'use strict';var util=require(_0x8043('0x0'));var BPromise=require(_0x8043('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x430126){return function(_0x361147){logger[_0x8043('0x2')](_0x430126,util[_0x8043('0x3')](_0x361147,{'showHidden':![],'depth':null}));};}exports[_0x8043('0x4')]=function(_0x5b11dd,_0x1bb6d0){return BPromise[_0x8043('0x5')]()['then'](faxAccount[_0x8043('0x4')](_0x5b11dd,_0x1bb6d0))['catch'](loggerCatch(_0x8043('0x6')));}; \ No newline at end of file +var _0xbc9e=['[Notify]\x20','util','bluebird','../../../config/logger','lodash','error','inspect','resolve','then','notify'];(function(_0x4cc271,_0x13824d){var _0x2e0e8b=function(_0x5ad955){while(--_0x5ad955){_0x4cc271['push'](_0x4cc271['shift']());}};_0x2e0e8b(++_0x13824d);}(_0xbc9e,0x8d));var _0xebc9=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xbc9e[_0x4fde08];return _0x12e725;};'use strict';var util=require(_0xebc9('0x0'));var BPromise=require(_0xebc9('0x1'));var logger=require(_0xebc9('0x2'))('preview');var _=require(_0xebc9('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x4e4557){return function(_0xcd8971){logger[_0xebc9('0x4')](_0x4e4557,util[_0xebc9('0x5')](_0xcd8971,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x2ee701,_0x4c69df){return BPromise[_0xebc9('0x6')]()[_0xebc9('0x7')](faxAccount[_0xebc9('0x8')](_0x2ee701,_0x4c69df))['catch'](loggerCatch(_0xebc9('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 34ec1fb..55781b7 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 _0xa8db=['inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa8db,0xd2));var _0xba8d=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0xa8db[_0x329d13];return _0x33efd9;};'use strict';var util=require(_0xba8d('0x0'));var logger=require(_0xba8d('0x1'))(_0xba8d('0x2'));var BPromise=require(_0xba8d('0x3'));var exec=require(_0xba8d('0x4'))[_0xba8d('0x5')];exports[_0xba8d('0x6')]=function(_0x3170b7){return new BPromise(function(_0x9a11c,_0x51aa23){exec(_0x3170b7,function(_0x420522,_0x14115e,_0x3b089b){logger[_0xba8d('0x7')](_0xba8d('0x8'),_0x14115e);if(_0x420522){logger[_0xba8d('0x7')](_0xba8d('0x8'),_0xba8d('0x9'),util[_0xba8d('0xa')](_0x420522,{'showHidden':![],'depth':null}),_0x14115e,_0x3b089b);_0x51aa23(_0x420522);}_0x9a11c(_0x14115e);});});}; \ No newline at end of file +var _0xd189=['\x20Error\x20:','inspect','../../../../config/logger','fax','child_process','execute','info','Exec\x20gs'];(function(_0x45f575,_0x3ae51c){var _0xd8e1a1=function(_0x34867b){while(--_0x34867b){_0x45f575['push'](_0x45f575['shift']());}};_0xd8e1a1(++_0x3ae51c);}(_0xd189,0x16a));var _0x9d18=function(_0x33fd17,_0x500292){_0x33fd17=_0x33fd17-0x0;var _0x351001=_0xd189[_0x33fd17];return _0x351001;};'use strict';var util=require('util');var logger=require(_0x9d18('0x0'))(_0x9d18('0x1'));var BPromise=require('bluebird');var exec=require(_0x9d18('0x2'))['exec'];exports[_0x9d18('0x3')]=function(_0x1fad18){return new BPromise(function(_0xe4cc0a,_0xe89cce){exec(_0x1fad18,function(_0x15ddd0,_0x26547c,_0x159ffc){logger[_0x9d18('0x4')]('Exec\x20gs',_0x26547c);if(_0x15ddd0){logger[_0x9d18('0x4')](_0x9d18('0x5'),_0x9d18('0x6'),util[_0x9d18('0x7')](_0x15ddd0,{'showHidden':![],'depth':null}),_0x26547c,_0x159ffc);_0xe89cce(_0x15ddd0);}_0xe4cc0a(_0x26547c);});});}; \ 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 b849912..afec49b 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 _0xb821=['format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','lodash','moment','message','info','inspect','ecm','headerinfo','minrate','maxrate'];(function(_0x19527a,_0x1857f6){var _0x95df0a=function(_0x518ae8){while(--_0x518ae8){_0x19527a['push'](_0x19527a['shift']());}};_0x95df0a(++_0x1857f6);}(_0xb821,0xa7));var _0x1b82=function(_0x33d9a2,_0x1d635){_0x33d9a2=_0x33d9a2-0x0;var _0x328cc8=_0xb821[_0x33d9a2];return _0x328cc8;};'use strict';var util=require('util');var _=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var logger=require('../../../../config/logger')('fax');exports[_0x1b82('0x2')]=function(_0x578a10){return{'message':_0x578a10};};exports['logger']=function(_0x3b1d14,_0x1403ab){logger[_0x1b82('0x3')](_0x3b1d14,util[_0x1b82('0x4')](_0x1403ab,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3e27c4,_0x192434){var _0x202a5f={'XMF-ECM':_0x192434[_0x1b82('0x5')],'XMF-HEADERINFO':_0x192434[_0x1b82('0x6')],'XMF-MINRATE':_0x192434[_0x1b82('0x7')],'XMF-MAXRATE':_0x192434[_0x1b82('0x8')],'XMF-MODEM':util[_0x1b82('0x9')](_0x1b82('0xa'),_0x192434['modem']),'XMF-GATEWAY':_0x192434[_0x1b82('0xb')],'XMF-FAXDETECT':_0x192434[_0x1b82('0xc')],'XMF-T38TIMEOUT':_0x192434[_0x1b82('0xd')],'XMF-LOCALSTATIONID':_0x192434[_0x1b82('0xe')],'XMF-PATH':_0x3e27c4[_0x1b82('0xf')]};return _0x202a5f;};exports[_0x1b82('0x10')]=function(_0x739f99,_0x1ce719){return{'actionid':_0x739f99['uniqueid'],'action':_0x1b82('0x11'),'channel':_0x739f99[_0x1b82('0x12')],'Exten':_0x1b82('0x13'),'Context':_0x1b82('0x14'),'Priority':'1','callerid':util['format'](_0x1b82('0x15'),_0x739f99['headerinfo']?_0x739f99['headerinfo']:'',_0x739f99[_0x1b82('0xe')]),'variable':_0x1ce719,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x739f99['uniqueid']};}; \ No newline at end of file +var _0xd2ea=['variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','minrate','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid'];(function(_0x1ca49a,_0x2d6c70){var _0x13fee8=function(_0x774157){while(--_0x774157){_0x1ca49a['push'](_0x1ca49a['shift']());}};_0x13fee8(++_0x2d6c70);}(_0xd2ea,0x15f));var _0xad2e=function(_0x16662b,_0xaffc92){_0x16662b=_0x16662b-0x0;var _0x60ccec=_0xd2ea[_0x16662b];return _0x60ccec;};'use strict';var util=require(_0xad2e('0x0'));var _=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var logger=require(_0xad2e('0x3'))(_0xad2e('0x4'));exports['message']=function(_0x3a9d11){return{'message':_0x3a9d11};};exports[_0xad2e('0x5')]=function(_0xcba7cb,_0x3e0741){logger[_0xad2e('0x6')](_0xcba7cb,util[_0xad2e('0x7')](_0x3e0741,{'showHidden':![],'depth':null}));};exports[_0xad2e('0x8')]=function(_0x592e8b,_0x3b5170){var _0x3e3d1f={'XMF-ECM':_0x3b5170[_0xad2e('0x9')],'XMF-HEADERINFO':_0x3b5170['headerinfo'],'XMF-MINRATE':_0x3b5170[_0xad2e('0xa')],'XMF-MAXRATE':_0x3b5170[_0xad2e('0xb')],'XMF-MODEM':util['format'](_0xad2e('0xc'),_0x3b5170['modem']),'XMF-GATEWAY':_0x3b5170[_0xad2e('0xd')],'XMF-FAXDETECT':_0x3b5170[_0xad2e('0xe')],'XMF-T38TIMEOUT':_0x3b5170[_0xad2e('0xf')],'XMF-LOCALSTATIONID':_0x3b5170[_0xad2e('0x10')],'XMF-PATH':_0x592e8b['path']};return _0x3e3d1f;};exports[_0xad2e('0x11')]=function(_0x5707a5,_0x42d2ac){return{'actionid':_0x5707a5[_0xad2e('0x12')],'action':_0xad2e('0x13'),'channel':_0x5707a5[_0xad2e('0x14')],'Exten':'xcally-motion-fax','Context':_0xad2e('0x15'),'Priority':'1','callerid':util['format'](_0xad2e('0x16'),_0x5707a5['headerinfo']?_0x5707a5['headerinfo']:'',_0x5707a5['localstationid']),'variable':_0x42d2ac,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5707a5['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 120c7c6..fdf1014 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 _0xb546=['initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','bluebird','util','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','getAgents','initAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0xb546,0x97));var _0x6b54=function(_0x214d54,_0x133c72){_0x214d54=_0x214d54-0x0;var _0x44ca46=_0xb546[_0x214d54];return _0x44ca46;};'use strict';var BPromise=require(_0x6b54('0x0'));var util=require(_0x6b54('0x1'));var moment=require('moment');var server=require(_0x6b54('0x2'));var Realtime=require(_0x6b54('0x3'));var Report=require(_0x6b54('0x4'));var Acw=require(_0x6b54('0x5'));var Trigger=require(_0x6b54('0x6'));var Dialer=require(_0x6b54('0x7'));var Preview=require(_0x6b54('0x8'));var Fax=require(_0x6b54('0x9'));var user=require(_0x6b54('0xa'));var voiceQueue=require(_0x6b54('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x6b54('0xc'));var trunk=require(_0x6b54('0xd'));var trigger=require(_0x6b54('0xe'));var template=require(_0x6b54('0xf'));var cmHopperHistory=require(_0x6b54('0x10'));var campaign=require(_0x6b54('0x11'));var voiceExtension=require(_0x6b54('0x12'));var faxAccount=require(_0x6b54('0x13'));var zendesk=require(_0x6b54('0x14'));var salesforce=require(_0x6b54('0x15'));var sugarcrm=require(_0x6b54('0x16'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x6b54('0x17'));var zoho=require(_0x6b54('0x18'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x6b54('0x19'));var dynamics365=require(_0x6b54('0x1a'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6b54('0x1b')](_0x6b54('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6b54('0x1b')](_0x6b54('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()['then'](user[_0x6b54('0x1d')]())['then'](realtime[_0x6b54('0x1e')]())[_0x6b54('0x1f')](user[_0x6b54('0x20')]())[_0x6b54('0x1f')](realtime[_0x6b54('0x21')]())['then'](trunk[_0x6b54('0x22')]())[_0x6b54('0x1f')](realtime[_0x6b54('0x23')]())[_0x6b54('0x1f')](voiceQueue[_0x6b54('0x24')]())[_0x6b54('0x1f')](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())[_0x6b54('0x1f')](realtime['initTriggers']())[_0x6b54('0x1f')](template[_0x6b54('0x25')]())[_0x6b54('0x1f')](realtime[_0x6b54('0x26')]())[_0x6b54('0x1f')](zendesk[_0x6b54('0x27')]())[_0x6b54('0x1f')](realtime['initZendeskAccounts']())[_0x6b54('0x1f')](salesforce[_0x6b54('0x28')]())[_0x6b54('0x1f')](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0x6b54('0x29')]())[_0x6b54('0x1f')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x6b54('0x2a')]())[_0x6b54('0x1f')](realtime['initFreshdeskAccounts']())[_0x6b54('0x1f')](desk['getDeskAccounts']())[_0x6b54('0x1f')](realtime[_0x6b54('0x2b')]())[_0x6b54('0x1f')](zoho[_0x6b54('0x2c')]())[_0x6b54('0x1f')](realtime['initZohoAccounts']())['then'](vtiger[_0x6b54('0x2d')]())[_0x6b54('0x1f')](realtime[_0x6b54('0x2e')]())[_0x6b54('0x1f')](freshsales[_0x6b54('0x2f')]())[_0x6b54('0x1f')](realtime['initFreshsalesAccounts']())[_0x6b54('0x1f')](servicenow[_0x6b54('0x30')]())[_0x6b54('0x1f')](realtime[_0x6b54('0x31')]())[_0x6b54('0x1f')](dynamics365[_0x6b54('0x32')]())[_0x6b54('0x1f')](realtime[_0x6b54('0x33')]())['then'](campaign[_0x6b54('0x34')]())[_0x6b54('0x1f')](realtime[_0x6b54('0x35')]())[_0x6b54('0x1f')](voiceExtension[_0x6b54('0x36')]())[_0x6b54('0x1f')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x6b54('0x37')]())['then'](realtime[_0x6b54('0x38')]())[_0x6b54('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0x6b54('0x39')]()[_0x6b54('0x1f')](voiceQueueReport[_0x6b54('0x3a')]())[_0x6b54('0x1f')](realtime[_0x6b54('0x3b')]())[_0x6b54('0x1f')](cmHopperHistory[_0x6b54('0x3c')]())['then'](realtime[_0x6b54('0x3d')]())[_0x6b54('0x1f')](cmHopperHistory[_0x6b54('0x3e')]())[_0x6b54('0x1f')](realtime['initCampaignHopperHistory']())[_0x6b54('0x1f')](voiceCallReport[_0x6b54('0x3f')]())[_0x6b54('0x1f')](realtime[_0x6b54('0x40')]())[_0x6b54('0x1f')](function(_0xc0fb4f){})[_0x6b54('0x41')](function(_0x3936c6){console[_0x6b54('0x42')](_0x3936c6);});}function main(){return server[_0x6b54('0x43')](realtime,preview,fax)[_0x6b54('0x1f')](function(_0x12bb12){return initRealtime();})[_0x6b54('0x1f')](function(){return initParams();})[_0x6b54('0x1f')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x6b54('0x41')](function(_0x234493){console['log'](_0x234493);});}main(); \ No newline at end of file +var _0xabfb=['getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xabfb,0x146));var _0xbabf=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0xabfb[_0x2118ad];return _0x4b5715;};'use strict';var BPromise=require(_0xbabf('0x0'));var util=require('util');var moment=require(_0xbabf('0x1'));var server=require('./server');var Realtime=require(_0xbabf('0x2'));var Report=require(_0xbabf('0x3'));var Acw=require(_0xbabf('0x4'));var Trigger=require(_0xbabf('0x5'));var Dialer=require(_0xbabf('0x6'));var Preview=require(_0xbabf('0x7'));var Fax=require(_0xbabf('0x8'));var user=require(_0xbabf('0x9'));var voiceQueue=require(_0xbabf('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xbabf('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0xbabf('0xc'));var template=require(_0xbabf('0xd'));var cmHopperHistory=require(_0xbabf('0xe'));var campaign=require(_0xbabf('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xbabf('0x10'));var zendesk=require(_0xbabf('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xbabf('0x12'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xbabf('0x13'));var zoho=require(_0xbabf('0x14'));var vtiger=require(_0xbabf('0x15'));var freshsales=require(_0xbabf('0x16'));var servicenow=require(_0xbabf('0x17'));var dynamics365=require(_0xbabf('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xbabf('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xbabf('0x1a')](_0xbabf('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xbabf('0x1b')]()[_0xbabf('0x1c')](user['getAgents']())['then'](realtime[_0xbabf('0x1d')]())[_0xbabf('0x1c')](user[_0xbabf('0x1e')]())[_0xbabf('0x1c')](realtime[_0xbabf('0x1f')]())[_0xbabf('0x1c')](trunk[_0xbabf('0x20')]())[_0xbabf('0x1c')](realtime[_0xbabf('0x21')]())['then'](voiceQueue['getVoiceQueues']())[_0xbabf('0x1c')](realtime[_0xbabf('0x22')]())[_0xbabf('0x1c')](trigger['getTriggers']())[_0xbabf('0x1c')](realtime[_0xbabf('0x23')]())[_0xbabf('0x1c')](template['getTemplates']())[_0xbabf('0x1c')](realtime[_0xbabf('0x24')]())[_0xbabf('0x1c')](zendesk[_0xbabf('0x25')]())[_0xbabf('0x1c')](realtime['initZendeskAccounts']())[_0xbabf('0x1c')](salesforce[_0xbabf('0x26')]())['then'](realtime[_0xbabf('0x27')]())[_0xbabf('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0xbabf('0x1c')](realtime[_0xbabf('0x28')]())[_0xbabf('0x1c')](freshdesk['getFreshdeskAccounts']())[_0xbabf('0x1c')](realtime['initFreshdeskAccounts']())['then'](desk['getDeskAccounts']())[_0xbabf('0x1c')](realtime[_0xbabf('0x29')]())['then'](zoho[_0xbabf('0x2a')]())[_0xbabf('0x1c')](realtime[_0xbabf('0x2b')]())[_0xbabf('0x1c')](vtiger[_0xbabf('0x2c')]())[_0xbabf('0x1c')](realtime[_0xbabf('0x2d')]())[_0xbabf('0x1c')](freshsales[_0xbabf('0x2e')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0xbabf('0x2f')]())[_0xbabf('0x1c')](realtime[_0xbabf('0x30')]())[_0xbabf('0x1c')](dynamics365['getDynamics365Accounts']())[_0xbabf('0x1c')](realtime[_0xbabf('0x31')]())['then'](campaign['getCampaigns']())[_0xbabf('0x1c')](realtime[_0xbabf('0x32')]())['then'](voiceExtension[_0xbabf('0x33')]())[_0xbabf('0x1c')](realtime['initVoiceExtensions']())[_0xbabf('0x1c')](faxAccount[_0xbabf('0x34')]())[_0xbabf('0x1c')](realtime[_0xbabf('0x35')]())[_0xbabf('0x1c')](function(){return realtime;});}function initParams(){return BPromise['resolve']()['then'](voiceQueueReport['getVoiceQueueReports']())[_0xbabf('0x1c')](realtime[_0xbabf('0x36')]())[_0xbabf('0x1c')](cmHopperHistory[_0xbabf('0x37')]())[_0xbabf('0x1c')](realtime[_0xbabf('0x38')]())[_0xbabf('0x1c')](cmHopperHistory['getCampaignHopperHistory']())[_0xbabf('0x1c')](realtime[_0xbabf('0x39')]())['then'](voiceCallReport[_0xbabf('0x3a')]())[_0xbabf('0x1c')](realtime[_0xbabf('0x3b')]())[_0xbabf('0x1c')](function(_0xe3064e){})[_0xbabf('0x3c')](function(_0x1f8093){console[_0xbabf('0x3d')](_0x1f8093);});}function main(){return server[_0xbabf('0x3e')](realtime,preview,fax)[_0xbabf('0x1c')](function(_0x1696c9){return initRealtime();})[_0xbabf('0x1c')](function(){return initParams();})[_0xbabf('0x1c')](function(){report[_0xbabf('0x3f')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x5b7745){console[_0xbabf('0x3d')](_0x5b7745);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index d0ed0ff..4f510c2 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 _0xa3db=['fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','inuse','statePause','format','stringify','user:%s','emit','user:save','exports','util','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode'];(function(_0x1c2aeb,_0x48433c){var _0x783379=function(_0x3e8820){while(--_0x3e8820){_0x1c2aeb['push'](_0x1c2aeb['shift']());}};_0x783379(++_0x48433c);}(_0xa3db,0xb8));var _0xba3d=function(_0x33ff94,_0x7de121){_0x33ff94=_0x33ff94-0x0;var _0x17f6ab=_0xa3db[_0x33ff94];return _0x17f6ab;};'use strict';var _=require('lodash');var util=require(_0xba3d('0x0'));var moment=require('moment');var md5=require(_0xba3d('0x1'));var Redis=require(_0xba3d('0x2'));var config=require(_0xba3d('0x3'));config['redis']=_[_0xba3d('0x4')](config[_0xba3d('0x5')],{'host':_0xba3d('0x6'),'port':0x18eb});var io=require(_0xba3d('0x7'))(new Redis(config['redis']));function Agent(_0x4d02ec){this['id']=_0x4d02ec['id']||0x0;this[_0xba3d('0x8')]=_0x4d02ec['name']||'';this[_0xba3d('0x9')]=_0x4d02ec[_0xba3d('0x9')]||'';this[_0xba3d('0xa')]=_0x4d02ec[_0xba3d('0xa')]||'';this[_0xba3d('0xb')]=_0x4d02ec[_0xba3d('0xb')]||'';this[_0xba3d('0xc')]=_0xba3d('0xd');this[_0xba3d('0xe')]=0x0;this[_0xba3d('0xf')]=_0xba3d('0xd');this[_0xba3d('0x10')]='';this[_0xba3d('0x11')]='';this[_0xba3d('0x12')]='';this[_0xba3d('0x13')]='';this[_0xba3d('0x14')]=_0x4d02ec[_0xba3d('0x14')]||![];this[_0xba3d('0x15')]=_0xba3d('0xd');this[_0xba3d('0x16')]=0x0;this[_0xba3d('0x17')]='';this[_0xba3d('0x18')]='';this[_0xba3d('0x19')]=![];this[_0xba3d('0x1a')]=![];this[_0xba3d('0x1')]='';}Agent[_0xba3d('0x1b')][_0xba3d('0x1c')]=function(_0x3f52f3){var _0x540b82;if(_0x3f52f3&&_0x3f52f3[_0xba3d('0xc')]){_0x540b82=_0x3f52f3[_0xba3d('0xc')][_0xba3d('0x1d')]();switch(_0x540b82){case _0xba3d('0x1e'):_0x540b82='idle';break;case _0xba3d('0x1f'):_0x540b82='talking';break;}}if(_0x540b82&&this['voiceStatus']!==_0x540b82||_0x3f52f3[_0xba3d('0x20')]){this[_0xba3d('0x16')]=_['toNumber'](moment()[_0xba3d('0x21')]('x'));}if(_0x540b82){this['voiceStatus']=_0x540b82;}var _0x3b9c5f={'id':this['id'],'name':this['name'],'email':this[_0xba3d('0x9')],'accountcode':this[_0xba3d('0xa')],'fullname':this[_0xba3d('0xb')],'state':this[_0xba3d('0xc')],'stateTime':this['stateTime'],'status':this[_0xba3d('0xf')],'address':this[_0xba3d('0x10')],'online':this[_0xba3d('0x14')],'voiceStatus':this[_0xba3d('0x15')],'voiceStatusTime':this[_0xba3d('0x16')],'voiceStatusCallerIdNumber':this[_0xba3d('0x17')],'voiceStatusQueue':this[_0xba3d('0x18')],'interface':this['interface'],'onhold':this[_0xba3d('0x19')]};var _0xec22f5=md5(JSON[_0xba3d('0x22')](_0x3b9c5f));if(this[_0xba3d('0x1')]!==_0xec22f5){this[_0xba3d('0x1')]=_0xec22f5;io['to'](util[_0xba3d('0x21')](_0xba3d('0x23'),_0x3b9c5f['name']))[_0xba3d('0x24')](_0xba3d('0x25'),_0x3b9c5f);}};module[_0xba3d('0x26')]=Agent; \ No newline at end of file +var _0xbb61=['updateStatusRealtime','toLowerCase','not_inuse','idle','talking','statePause','format','voiceStatus','stateTime','status','online','user:%s','user:save','lodash','util','moment','md5','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','state','address','phone','mobile','interface','unknown','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype'];(function(_0x66b9f9,_0x32d667){var _0x241ce9=function(_0x2b3426){while(--_0x2b3426){_0x66b9f9['push'](_0x66b9f9['shift']());}};_0x241ce9(++_0x32d667);}(_0xbb61,0x16c));var _0x1bb6=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xbb61[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x1bb6('0x0'));var util=require(_0x1bb6('0x1'));var moment=require(_0x1bb6('0x2'));var md5=require(_0x1bb6('0x3'));var Redis=require(_0x1bb6('0x4'));var config=require(_0x1bb6('0x5'));config['redis']=_[_0x1bb6('0x6')](config['redis'],{'host':_0x1bb6('0x7'),'port':0x18eb});var io=require(_0x1bb6('0x8'))(new Redis(config[_0x1bb6('0x9')]));function Agent(_0x1b25a8){this['id']=_0x1b25a8['id']||0x0;this[_0x1bb6('0xa')]=_0x1b25a8[_0x1bb6('0xa')]||'';this[_0x1bb6('0xb')]=_0x1b25a8[_0x1bb6('0xb')]||'';this['accountcode']=_0x1b25a8[_0x1bb6('0xc')]||'';this['fullname']=_0x1b25a8[_0x1bb6('0xd')]||'';this[_0x1bb6('0xe')]='unknown';this['stateTime']=0x0;this['status']='unknown';this[_0x1bb6('0xf')]='';this[_0x1bb6('0x10')]='';this[_0x1bb6('0x11')]='';this[_0x1bb6('0x12')]='';this['online']=_0x1b25a8['online']||![];this['voiceStatus']=_0x1bb6('0x13');this[_0x1bb6('0x14')]=0x0;this[_0x1bb6('0x15')]='';this[_0x1bb6('0x16')]='';this[_0x1bb6('0x17')]=![];this[_0x1bb6('0x18')]=![];this['md5']='';}Agent[_0x1bb6('0x19')][_0x1bb6('0x1a')]=function(_0x49d53f){var _0x3b148d;if(_0x49d53f&&_0x49d53f['state']){_0x3b148d=_0x49d53f[_0x1bb6('0xe')][_0x1bb6('0x1b')]();switch(_0x3b148d){case _0x1bb6('0x1c'):_0x3b148d=_0x1bb6('0x1d');break;case'inuse':_0x3b148d=_0x1bb6('0x1e');break;}}if(_0x3b148d&&this['voiceStatus']!==_0x3b148d||_0x49d53f[_0x1bb6('0x1f')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x1bb6('0x20')]('x'));}if(_0x3b148d){this[_0x1bb6('0x21')]=_0x3b148d;}var _0x25b7a4={'id':this['id'],'name':this['name'],'email':this[_0x1bb6('0xb')],'accountcode':this['accountcode'],'fullname':this[_0x1bb6('0xd')],'state':this[_0x1bb6('0xe')],'stateTime':this[_0x1bb6('0x22')],'status':this[_0x1bb6('0x23')],'address':this[_0x1bb6('0xf')],'online':this[_0x1bb6('0x24')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1bb6('0x14')],'voiceStatusCallerIdNumber':this[_0x1bb6('0x15')],'voiceStatusQueue':this[_0x1bb6('0x16')],'interface':this[_0x1bb6('0x12')],'onhold':this[_0x1bb6('0x17')]};var _0x30a17f=md5(JSON['stringify'](_0x25b7a4));if(this[_0x1bb6('0x3')]!==_0x30a17f){this['md5']=_0x30a17f;io['to'](util[_0x1bb6('0x20')](_0x1bb6('0x25'),_0x25b7a4['name']))['emit'](_0x1bb6('0x26'),_0x25b7a4);}};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 c31bf95..f8b8057 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 _0x5c58=['DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','campaign','originated','temp','ivrTotalCallsDays','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt'];(function(_0x403ad4,_0x3a3ac4){var _0xb4426=function(_0x561c60){while(--_0x561c60){_0x403ad4['push'](_0x403ad4['shift']());}};_0xb4426(++_0x3a3ac4);}(_0x5c58,0x154));var _0x85c5=function(_0x1205e7,_0x192efe){_0x1205e7=_0x1205e7-0x0;var _0x364392=_0x5c58[_0x1205e7];return _0x364392;};'use strict';function Campaign(_0x3d2684){this['id']=_0x3d2684['id']||0x0;this[_0x85c5('0x0')]=_0x3d2684[_0x85c5('0x0')]||'';this['type']=_0x3d2684['type']||_0x85c5('0x1');this[_0x85c5('0x2')]=0x0;this[_0x85c5('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x85c5('0x4')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x85c5('0x5')]=_0x3d2684['active'];this[_0x85c5('0x6')]=_0x3d2684['limitCalls'];this['dialTimezone']=_0x3d2684['dialTimezone']||null;this[_0x85c5('0x7')]=_0x3d2684[_0x85c5('0x7')]?_0x3d2684['dialGlobalInterval']:null;this[_0x85c5('0x8')]=_0x3d2684['dialOriginateCallerIdName'];this[_0x85c5('0x9')]=_0x3d2684[_0x85c5('0x9')];this[_0x85c5('0xa')]=_0x3d2684[_0x85c5('0xa')]||0x1e;this['dialCongestionMaxRetry']=_0x3d2684[_0x85c5('0xb')];this[_0x85c5('0xc')]=_0x3d2684[_0x85c5('0xc')];this[_0x85c5('0xd')]=_0x3d2684[_0x85c5('0xd')];this['dialBusyRetryFrequency']=_0x3d2684[_0x85c5('0xe')];this[_0x85c5('0xf')]=_0x3d2684[_0x85c5('0xf')];this[_0x85c5('0x10')]=_0x3d2684[_0x85c5('0x10')];this['dialGlobalMaxRetry']=_0x3d2684[_0x85c5('0x11')];this['dialNoSuchNumberMaxRetry']=_0x3d2684[_0x85c5('0x12')]||0x3;this[_0x85c5('0x13')]=_0x3d2684['dialNoSuchNumberRetryFrequency']||0x96;this[_0x85c5('0x14')]=_0x3d2684[_0x85c5('0x14')]||0x3;this['dialDropRetryFrequency']=_0x3d2684['dialDropRetryFrequency']||0x96;this[_0x85c5('0x15')]=_0x3d2684['dialAbandonedMaxRetry']||0x3;this[_0x85c5('0x16')]=_0x3d2684[_0x85c5('0x16')]||0x96;this[_0x85c5('0x17')]=_0x3d2684[_0x85c5('0x17')]||0x3;this['dialMachineRetryFrequency']=_0x3d2684[_0x85c5('0x18')]||0x96;this[_0x85c5('0x19')]=_0x3d2684[_0x85c5('0x19')]||0x3;this[_0x85c5('0x1a')]=_0x3d2684[_0x85c5('0x1a')]||0x96;this[_0x85c5('0x1b')]=_0x3d2684['dialOrderByScheduledAt']||_0x85c5('0x1c');this[_0x85c5('0x1d')]=_0x3d2684[_0x85c5('0x1d')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x3d2684[_0x85c5('0x1e')]||undefined;this['dialCutDigit']=_0x3d2684[_0x85c5('0x1f')]||undefined;this[_0x85c5('0x20')]=_0x3d2684[_0x85c5('0x20')]?_0x3d2684[_0x85c5('0x20')]:undefined;this[_0x85c5('0x21')]=_0x3d2684['Trunk']?_0x3d2684['Trunk']:undefined;this[_0x85c5('0x22')]=_0x3d2684[_0x85c5('0x22')]?_0x3d2684[_0x85c5('0x22')]:undefined;this[_0x85c5('0x23')]=_0x3d2684['SquareProject']?_0x3d2684[_0x85c5('0x23')]:undefined;this[_0x85c5('0x24')]=_0x3d2684[_0x85c5('0x23')]?_0x3d2684[_0x85c5('0x23')][_0x85c5('0x0')]:undefined;this[_0x85c5('0x25')]=_0x3d2684[_0x85c5('0x25')]||![];this['dialAMDInitialSilence']=_0x3d2684['dialAMDInitialSilence'];this[_0x85c5('0x26')]=_0x3d2684[_0x85c5('0x26')];this[_0x85c5('0x27')]=_0x3d2684[_0x85c5('0x27')];this[_0x85c5('0x28')]=_0x3d2684[_0x85c5('0x28')];this[_0x85c5('0x29')]=_0x3d2684[_0x85c5('0x29')];this[_0x85c5('0x2a')]=_0x3d2684[_0x85c5('0x2a')];this['dialAMDMaximumNumberOfWords']=_0x3d2684[_0x85c5('0x2b')];this['dialAMDSilenceThreshold']=_0x3d2684['dialAMDSilenceThreshold'];this[_0x85c5('0x2c')]=_0x3d2684[_0x85c5('0x2c')];}module[_0x85c5('0x2d')]=Campaign; \ No newline at end of file +var _0xf4cd=['dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency'];(function(_0x3336aa,_0x1949a0){var _0x198bbe=function(_0x5b0e86){while(--_0x5b0e86){_0x3336aa['push'](_0x3336aa['shift']());}};_0x198bbe(++_0x1949a0);}(_0xf4cd,0x18c));var _0xdf4c=function(_0xcd3647,_0x5182d6){_0xcd3647=_0xcd3647-0x0;var _0x4bad77=_0xf4cd[_0xcd3647];return _0x4bad77;};'use strict';function Campaign(_0x162b04){this['id']=_0x162b04['id']||0x0;this[_0xdf4c('0x0')]=_0x162b04[_0xdf4c('0x0')]||'';this['type']=_0x162b04[_0xdf4c('0x1')]||_0xdf4c('0x2');this[_0xdf4c('0x3')]=0x0;this[_0xdf4c('0x4')]=0x0;this[_0xdf4c('0x5')]=0x0;this[_0xdf4c('0x6')]=0x0;this[_0xdf4c('0x7')]='';this[_0xdf4c('0x8')]=!![];this[_0xdf4c('0x9')]=_0x162b04[_0xdf4c('0x9')];this[_0xdf4c('0xa')]=_0x162b04[_0xdf4c('0xa')];this[_0xdf4c('0xb')]=_0x162b04[_0xdf4c('0xb')]||null;this[_0xdf4c('0xc')]=_0x162b04['dialGlobalInterval']?_0x162b04[_0xdf4c('0xc')]:null;this[_0xdf4c('0xd')]=_0x162b04['dialOriginateCallerIdName'];this[_0xdf4c('0xe')]=_0x162b04[_0xdf4c('0xe')];this['dialOriginateTimeout']=_0x162b04[_0xdf4c('0xf')]||0x1e;this[_0xdf4c('0x10')]=_0x162b04[_0xdf4c('0x10')];this['dialCongestionRetryFrequency']=_0x162b04[_0xdf4c('0x11')];this['dialBusyMaxRetry']=_0x162b04['dialBusyMaxRetry'];this[_0xdf4c('0x12')]=_0x162b04[_0xdf4c('0x12')];this['dialNoAnswerMaxRetry']=_0x162b04[_0xdf4c('0x13')];this[_0xdf4c('0x14')]=_0x162b04[_0xdf4c('0x14')];this['dialGlobalMaxRetry']=_0x162b04[_0xdf4c('0x15')];this[_0xdf4c('0x16')]=_0x162b04[_0xdf4c('0x16')]||0x3;this[_0xdf4c('0x17')]=_0x162b04[_0xdf4c('0x17')]||0x96;this[_0xdf4c('0x18')]=_0x162b04[_0xdf4c('0x18')]||0x3;this['dialDropRetryFrequency']=_0x162b04['dialDropRetryFrequency']||0x96;this[_0xdf4c('0x19')]=_0x162b04[_0xdf4c('0x19')]||0x3;this[_0xdf4c('0x1a')]=_0x162b04['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x162b04['dialMachineMaxRetry']||0x3;this[_0xdf4c('0x1b')]=_0x162b04['dialMachineRetryFrequency']||0x96;this[_0xdf4c('0x1c')]=_0x162b04[_0xdf4c('0x1c')]||0x3;this[_0xdf4c('0x1d')]=_0x162b04[_0xdf4c('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x162b04['dialOrderByScheduledAt']||'DESC';this['dialPrefix']=_0x162b04['dialPrefix']||undefined;this[_0xdf4c('0x1e')]=_0x162b04[_0xdf4c('0x1e')]||undefined;this[_0xdf4c('0x1f')]=_0x162b04[_0xdf4c('0x1f')]||undefined;this[_0xdf4c('0x20')]=_0x162b04['TrunkBackup']?_0x162b04['TrunkBackup']:undefined;this['Trunk']=_0x162b04[_0xdf4c('0x21')]?_0x162b04['Trunk']:undefined;this[_0xdf4c('0x22')]=_0x162b04[_0xdf4c('0x22')]?_0x162b04[_0xdf4c('0x22')]:undefined;this[_0xdf4c('0x23')]=_0x162b04[_0xdf4c('0x23')]?_0x162b04[_0xdf4c('0x23')]:undefined;this['dialQueueProject']=_0x162b04[_0xdf4c('0x23')]?_0x162b04[_0xdf4c('0x23')][_0xdf4c('0x0')]:undefined;this[_0xdf4c('0x24')]=_0x162b04[_0xdf4c('0x24')]||![];this[_0xdf4c('0x25')]=_0x162b04[_0xdf4c('0x25')];this[_0xdf4c('0x26')]=_0x162b04['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x162b04[_0xdf4c('0x27')];this[_0xdf4c('0x28')]=_0x162b04[_0xdf4c('0x28')];this[_0xdf4c('0x29')]=_0x162b04['dialAMDMinWordLength'];this[_0xdf4c('0x2a')]=_0x162b04[_0xdf4c('0x2a')];this[_0xdf4c('0x2b')]=_0x162b04['dialAMDMaximumNumberOfWords'];this[_0xdf4c('0x2c')]=_0x162b04[_0xdf4c('0x2c')];this[_0xdf4c('0x2d')]=_0x162b04[_0xdf4c('0x2d')];}module[_0xdf4c('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 72eb7a1..5d9b971 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 _0x6d0c=['queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','linkedid','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6d0c,0x8c));var _0xc6d0=function(_0x16651d,_0x2cf0ec){_0x16651d=_0x16651d-0x0;var _0x8883b1=_0x6d0c[_0x16651d];return _0x8883b1;};'use strict';function Channel(){this[_0xc6d0('0x0')]=null;this[_0xc6d0('0x1')]='';this[_0xc6d0('0x2')]='';this[_0xc6d0('0x3')]=0x0;this[_0xc6d0('0x4')]='';this[_0xc6d0('0x5')]=undefined;this['connectedlinename']=undefined;this[_0xc6d0('0x6')]=0x0;this['context']='';this['uniqueid']=0x0;this[_0xc6d0('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this[_0xc6d0('0x8')]=null;this[_0xc6d0('0x9')]=null;this[_0xc6d0('0xa')]=![];this[_0xc6d0('0xb')]=![];this[_0xc6d0('0xc')]='';this[_0xc6d0('0xd')]='';this[_0xc6d0('0xe')]=0x0;this[_0xc6d0('0xf')]=0x0;this[_0xc6d0('0x10')]=0x0;this[_0xc6d0('0x11')]=null;this[_0xc6d0('0x12')]=null;this[_0xc6d0('0x13')]=null;this[_0xc6d0('0x14')]=![];this[_0xc6d0('0x15')]=null;this[_0xc6d0('0x16')]=null;this[_0xc6d0('0x17')]=[];this[_0xc6d0('0x18')]=undefined;this[_0xc6d0('0x19')]=undefined;this[_0xc6d0('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x8227=['exports','channel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','duration','billableseconds','holdtime','type','tag','disposition','queue','transfercalleridnum','transferconnectedlinenum','mohtime'];(function(_0x4af586,_0x478c02){var _0x498330=function(_0x4e2a90){while(--_0x4e2a90){_0x4af586['push'](_0x4af586['shift']());}};_0x498330(++_0x478c02);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';function Channel(){this['starttime']=null;this[_0x7822('0x0')]='';this['destinationchannel']='';this[_0x7822('0x1')]=0x0;this[_0x7822('0x2')]='';this[_0x7822('0x3')]=undefined;this[_0x7822('0x4')]=undefined;this['accountcode']=0x0;this[_0x7822('0x5')]='';this[_0x7822('0x6')]=0x0;this[_0x7822('0x7')]=0x0;this[_0x7822('0x8')]=0x0;this[_0x7822('0x9')]=![];this[_0x7822('0xa')]=null;this[_0x7822('0xb')]=null;this[_0x7822('0xc')]=![];this['abandoned']=![];this[_0x7822('0xd')]='';this['lastdata']='';this[_0x7822('0xe')]=0x0;this[_0x7822('0xf')]=0x0;this[_0x7822('0x10')]=0x0;this[_0x7822('0x11')]=null;this[_0x7822('0x12')]=null;this[_0x7822('0x13')]=null;this['monitor']=![];this['monitorFilename']=null;this[_0x7822('0x14')]=null;this['monitors']=[];this[_0x7822('0x15')]=undefined;this[_0x7822('0x16')]=undefined;this[_0x7822('0x17')]=0x0;}module[_0x7822('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 64970db..ba63d42 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 _0xb38e=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb38e,0xa7));var _0xeb38=function(_0x2267b7,_0x12081c){_0x2267b7=_0x2267b7-0x0;var _0x440974=_0xb38e[_0x2267b7];return _0x440974;};'use strict';function DeskAccount(_0x52c245){this['id']=_0x52c245['id']||0x0;this[_0xeb38('0x0')]=_0x52c245[_0xeb38('0x0')]||'';this[_0xeb38('0x1')]=_0x52c245[_0xeb38('0x1')]||'';this[_0xeb38('0x2')]=_0x52c245[_0xeb38('0x2')]||'';this['authType']=_0x52c245[_0xeb38('0x3')]||'';this[_0xeb38('0x4')]=_0x52c245['password']||'';this[_0xeb38('0x5')]=_0x52c245[_0xeb38('0x5')]||'';this[_0xeb38('0x6')]=_0x52c245[_0xeb38('0x6')]||'';this['token']=_0x52c245[_0xeb38('0x7')]||'';this[_0xeb38('0x8')]=_0x52c245[_0xeb38('0x8')]||'';this[_0xeb38('0x9')]=_0x52c245['type']||'';this[_0xeb38('0xa')]=_0x52c245[_0xeb38('0xa')]||'';this[_0xeb38('0xb')]=_0x52c245[_0xeb38('0xb')]||{};}module[_0xeb38('0xc')]=DeskAccount; \ No newline at end of file +var _0x44ae=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x1536ec,_0x11c8b8){var _0x562f11=function(_0x42b780){while(--_0x42b780){_0x1536ec['push'](_0x1536ec['shift']());}};_0x562f11(++_0x11c8b8);}(_0x44ae,0x17d));var _0xe44a=function(_0x395a03,_0x362943){_0x395a03=_0x395a03-0x0;var _0x8de6f=_0x44ae[_0x395a03];return _0x8de6f;};'use strict';function DeskAccount(_0xd41ca6){this['id']=_0xd41ca6['id']||0x0;this[_0xe44a('0x0')]=_0xd41ca6[_0xe44a('0x0')]||'';this[_0xe44a('0x1')]=_0xd41ca6['username']||'';this[_0xe44a('0x2')]=_0xd41ca6['remoteUri']||'';this[_0xe44a('0x3')]=_0xd41ca6[_0xe44a('0x3')]||'';this[_0xe44a('0x4')]=_0xd41ca6[_0xe44a('0x4')]||'';this[_0xe44a('0x5')]=_0xd41ca6[_0xe44a('0x5')]||'';this['consumerSecret']=_0xd41ca6[_0xe44a('0x6')]||'';this[_0xe44a('0x7')]=_0xd41ca6[_0xe44a('0x7')]||'';this[_0xe44a('0x8')]=_0xd41ca6['tokenSecret']||'';this[_0xe44a('0x9')]=_0xd41ca6[_0xe44a('0x9')]||'';this[_0xe44a('0xa')]=_0xd41ca6[_0xe44a('0xa')]||'';this['Configurations']=_0xd41ca6[_0xe44a('0xb')]||{};}module[_0xe44a('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index a9613f5..f21dc5e 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 _0x4d90=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0x248082,_0x3e204c){var _0x1398d7=function(_0x278054){while(--_0x278054){_0x248082['push'](_0x248082['shift']());}};_0x1398d7(++_0x3e204c);}(_0x4d90,0x1d1));var _0x04d9=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4d90[_0x2b4411];return _0x8e41ef;};'use strict';function Dynamics365Account(_0x240b5f){this['id']=_0x240b5f['id']||0x0;this['name']=_0x240b5f[_0x04d9('0x0')]||'';this[_0x04d9('0x1')]=_0x240b5f[_0x04d9('0x1')]||'';this['password']=_0x240b5f[_0x04d9('0x2')]||'';this[_0x04d9('0x3')]=_0x240b5f[_0x04d9('0x3')]||'';this[_0x04d9('0x4')]=_0x240b5f['tenantId']||'';this[_0x04d9('0x5')]=_0x240b5f['clientId']||'';this[_0x04d9('0x6')]=_0x240b5f[_0x04d9('0x6')]||{};this[_0x04d9('0x7')]=_0x240b5f[_0x04d9('0x7')]||'';this[_0x04d9('0x8')]=_0x240b5f['Configurations']||{};}module[_0x04d9('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xe18d=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name','username'];(function(_0x47af77,_0x52f9f2){var _0xd9994c=function(_0x5e414e){while(--_0x5e414e){_0x47af77['push'](_0x47af77['shift']());}};_0xd9994c(++_0x52f9f2);}(_0xe18d,0x1a5));var _0xde18=function(_0x50e27e,_0x5ebd0d){_0x50e27e=_0x50e27e-0x0;var _0x4082f5=_0xe18d[_0x50e27e];return _0x4082f5;};'use strict';function Dynamics365Account(_0x2796f3){this['id']=_0x2796f3['id']||0x0;this[_0xde18('0x0')]=_0x2796f3[_0xde18('0x0')]||'';this[_0xde18('0x1')]=_0x2796f3[_0xde18('0x1')]||'';this[_0xde18('0x2')]=_0x2796f3[_0xde18('0x2')]||'';this[_0xde18('0x3')]=_0x2796f3[_0xde18('0x3')]||'';this[_0xde18('0x4')]=_0x2796f3[_0xde18('0x4')]||'';this[_0xde18('0x5')]=_0x2796f3[_0xde18('0x5')]||'';this[_0xde18('0x6')]=_0x2796f3[_0xde18('0x6')]||{};this[_0xde18('0x7')]=_0x2796f3[_0xde18('0x7')]||'';this[_0xde18('0x8')]=_0x2796f3[_0xde18('0x8')]||{};}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 cc9652c..5b64154 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 _0x5a14=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5a14,0x73));var _0x45a1=function(_0x4f77e4,_0x28b8d1){_0x4f77e4=_0x4f77e4-0x0;var _0x134870=_0x5a14[_0x4f77e4];return _0x134870;};'use strict';function FaxAccount(_0x2912fa){this['id']=_0x2912fa['id']||0x0;this[_0x45a1('0x0')]=_0x2912fa['name']||'';this[_0x45a1('0x1')]=_0x2912fa['description'];this[_0x45a1('0x2')]=_0x2912fa[_0x45a1('0x2')];this[_0x45a1('0x3')]=_0x2912fa['headerinfo'];this['localstationid']=_0x2912fa[_0x45a1('0x4')];this[_0x45a1('0x5')]=_0x2912fa['minrate']||0x960;this[_0x45a1('0x6')]=_0x2912fa[_0x45a1('0x6')]||0x3840;this['modem']=_0x2912fa[_0x45a1('0x7')]||_0x45a1('0x8');this[_0x45a1('0x9')]=_0x2912fa['gateway']||'no';this[_0x45a1('0xa')]=_0x2912fa[_0x45a1('0xa')]||'no';this[_0x45a1('0xb')]=_0x2912fa['t38timeout']||0x1388;this[_0x45a1('0xc')]=_0x2912fa[_0x45a1('0xc')]||_0x45a1('0xd');this[_0x45a1('0xe')]=_0x2912fa[_0x45a1('0xe')]?_0x2912fa[_0x45a1('0xe')]:undefined;this[_0x45a1('0xf')]=_0x2912fa[_0x45a1('0xf')];this[_0x45a1('0x10')]=_0x2912fa[_0x45a1('0x10')];}module[_0x45a1('0x11')]=FaxAccount; \ No newline at end of file +var _0xcb0e=['name','description','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports'];(function(_0x2c74e5,_0x2f9a66){var _0x3ea53c=function(_0x5bf845){while(--_0x5bf845){_0x2c74e5['push'](_0x2c74e5['shift']());}};_0x3ea53c(++_0x2f9a66);}(_0xcb0e,0x1c0));var _0xecb0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb0e[_0x3dd15e];return _0x231fd0;};'use strict';function FaxAccount(_0x20d490){this['id']=_0x20d490['id']||0x0;this[_0xecb0('0x0')]=_0x20d490[_0xecb0('0x0')]||'';this[_0xecb0('0x1')]=_0x20d490[_0xecb0('0x1')];this['ecm']=_0x20d490['ecm'];this[_0xecb0('0x2')]=_0x20d490['headerinfo'];this[_0xecb0('0x3')]=_0x20d490[_0xecb0('0x3')];this[_0xecb0('0x4')]=_0x20d490[_0xecb0('0x4')]||0x960;this[_0xecb0('0x5')]=_0x20d490['maxrate']||0x3840;this['modem']=_0x20d490[_0xecb0('0x6')]||'v17,v27,v29';this['gateway']=_0x20d490[_0xecb0('0x7')]||'no';this[_0xecb0('0x8')]=_0x20d490[_0xecb0('0x8')]||'no';this['t38timeout']=_0x20d490[_0xecb0('0x9')]||0x1388;this[_0xecb0('0xa')]=_0x20d490['tech']||_0xecb0('0xb');this['Trunk']=_0x20d490[_0xecb0('0xc')]?_0x20d490['Trunk']:undefined;this['ListId']=_0x20d490[_0xecb0('0xd')];this[_0xecb0('0xe')]=_0x20d490[_0xecb0('0xe')];}module[_0xecb0('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 10f4286..289fcdf 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 _0x7afa=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x57dd0e,_0x3045f6){var _0x4eb3e8=function(_0x1c65d2){while(--_0x1c65d2){_0x57dd0e['push'](_0x57dd0e['shift']());}};_0x4eb3e8(++_0x3045f6);}(_0x7afa,0xe4));var _0xa7af=function(_0x49948c,_0x5b0dcd){_0x49948c=_0x49948c-0x0;var _0x30d81e=_0x7afa[_0x49948c];return _0x30d81e;};'use strict';function FreshdeskAccount(_0x2b5372){this['id']=_0x2b5372['id']||0x0;this[_0xa7af('0x0')]=_0x2b5372['name']||'';this[_0xa7af('0x1')]=_0x2b5372[_0xa7af('0x1')]||'';this[_0xa7af('0x2')]=_0x2b5372[_0xa7af('0x3')]||'';this[_0xa7af('0x4')]=_0x2b5372[_0xa7af('0x4')]||'';this[_0xa7af('0x5')]=_0x2b5372['serverUrl']||'';this[_0xa7af('0x6')]=_0x2b5372['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x0ca0=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x20d1a4,_0x9513e8){var _0xe61c7=function(_0x22c15e){while(--_0x22c15e){_0x20d1a4['push'](_0x20d1a4['shift']());}};_0xe61c7(++_0x9513e8);}(_0x0ca0,0x18e));var _0x00ca=function(_0xa38152,_0x33fb6c){_0xa38152=_0xa38152-0x0;var _0x271fe3=_0x0ca0[_0xa38152];return _0x271fe3;};'use strict';function FreshdeskAccount(_0x39a263){this['id']=_0x39a263['id']||0x0;this[_0x00ca('0x0')]=_0x39a263[_0x00ca('0x0')]||'';this[_0x00ca('0x1')]=_0x39a263[_0x00ca('0x1')]||'';this[_0x00ca('0x2')]=_0x39a263[_0x00ca('0x3')]||'';this[_0x00ca('0x4')]=_0x39a263[_0x00ca('0x4')]||'';this['serverUrl']=_0x39a263[_0x00ca('0x5')]||'';this[_0x00ca('0x6')]=_0x39a263['Configurations']||{};}module[_0x00ca('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index fbfe2d0..4f7ed5c 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 _0x05de=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x328534,_0x33b41e){var _0x2796c0=function(_0x1ba8ad){while(--_0x1ba8ad){_0x328534['push'](_0x328534['shift']());}};_0x2796c0(++_0x33b41e);}(_0x05de,0xe3));var _0xe05d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x05de[_0xa464c9];return _0x3d73c4;};'use strict';function FreshsalesAccount(_0x2e32a1){this['id']=_0x2e32a1['id']||0x0;this[_0xe05d('0x0')]=_0x2e32a1[_0xe05d('0x0')]||'';this[_0xe05d('0x1')]=_0x2e32a1[_0xe05d('0x1')]||'';this['apiKey']=_0x2e32a1[_0xe05d('0x2')]||'';this[_0xe05d('0x3')]=_0x2e32a1['remoteUri']||'';this[_0xe05d('0x4')]=_0x2e32a1[_0xe05d('0x4')]||'';this['Configurations']=_0x2e32a1[_0xe05d('0x5')]||{};}module[_0xe05d('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x16e8=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0x16e8,0x106));var _0x816e=function(_0x8c8a65,_0x57584d){_0x8c8a65=_0x8c8a65-0x0;var _0x4a7113=_0x16e8[_0x8c8a65];return _0x4a7113;};'use strict';function FreshsalesAccount(_0x4e2125){this['id']=_0x4e2125['id']||0x0;this[_0x816e('0x0')]=_0x4e2125[_0x816e('0x0')]||'';this[_0x816e('0x1')]=_0x4e2125['username']||'';this[_0x816e('0x2')]=_0x4e2125[_0x816e('0x3')]||'';this[_0x816e('0x4')]=_0x4e2125['remoteUri']||'';this[_0x816e('0x5')]=_0x4e2125['serverUrl']||'';this[_0x816e('0x6')]=_0x4e2125['Configurations']||{};}module[_0x816e('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5d860c2..d195273 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 _0xd2b5=['queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','mohtime','variables','type','inbound','uniqueid','calleridname','queuecallerjoinAt','position','count'];(function(_0x11e7c4,_0x3b74b2){var _0x19d60a=function(_0xbbcdbd){while(--_0xbbcdbd){_0x11e7c4['push'](_0x11e7c4['shift']());}};_0x19d60a(++_0x3b74b2);}(_0xd2b5,0x10d));var _0x5d2b=function(_0x42fa2c,_0x5a70c7){_0x42fa2c=_0x42fa2c-0x0;var _0x1ba982=_0xd2b5[_0x42fa2c];return _0x1ba982;};'use strict';function QueueReport(){this[_0x5d2b('0x0')]=_0x5d2b('0x1');this[_0x5d2b('0x2')]='';this['calleridnum']='';this[_0x5d2b('0x3')]='';this['queue']='';this[_0x5d2b('0x4')]=null;this['queuecallerleaveAt']=null;this[_0x5d2b('0x5')]=0x1;this[_0x5d2b('0x6')]=0x1;this[_0x5d2b('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x5d2b('0x8')]=![];this[_0x5d2b('0x9')]=null;this[_0x5d2b('0xa')]=![];this[_0x5d2b('0xb')]=null;this['originalposition']=0x1;this[_0x5d2b('0xc')]='';this[_0x5d2b('0xd')]='';this[_0x5d2b('0xe')]='';this[_0x5d2b('0xf')]='';this[_0x5d2b('0x10')]='';this[_0x5d2b('0x11')]='';this[_0x5d2b('0x12')]='';this[_0x5d2b('0x13')]=0x0;this[_0x5d2b('0x14')]=![];this['lastAssignedTo']='';this[_0x5d2b('0x15')]=0x0;this[_0x5d2b('0x16')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x85ad=['priority','assigned','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten'];(function(_0x5eda5a,_0x12b2e3){var _0x506ae5=function(_0x4921b7){while(--_0x4921b7){_0x5eda5a['push'](_0x5eda5a['shift']());}};_0x506ae5(++_0x12b2e3);}(_0x85ad,0x154));var _0xd85a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x85ad[_0x3ab51d];return _0x29a04e;};'use strict';function QueueReport(){this[_0xd85a('0x0')]='inbound';this[_0xd85a('0x1')]='';this[_0xd85a('0x2')]='';this[_0xd85a('0x3')]='';this[_0xd85a('0x4')]='';this[_0xd85a('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xd85a('0x6')]=0x1;this[_0xd85a('0x7')]=0x1;this[_0xd85a('0x8')]=![];this[_0xd85a('0x9')]=null;this[_0xd85a('0xa')]=![];this[_0xd85a('0xb')]=null;this[_0xd85a('0xc')]=![];this[_0xd85a('0xd')]=null;this[_0xd85a('0xe')]=0x1;this['channel']='';this[_0xd85a('0xf')]='';this[_0xd85a('0x10')]='';this[_0xd85a('0x11')]='';this[_0xd85a('0x12')]='';this[_0xd85a('0x13')]='';this[_0xd85a('0x14')]='';this['holdtime']=0x0;this[_0xd85a('0x15')]=![];this['lastAssignedTo']='';this[_0xd85a('0x16')]=0x0;this[_0xd85a('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c4ee2de..b74ca4f 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 _0xb091=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x4690f2,_0xab1e32){var _0x5306db=function(_0xfa018b){while(--_0xfa018b){_0x4690f2['push'](_0x4690f2['shift']());}};_0x5306db(++_0xab1e32);}(_0xb091,0x1af));var _0x1b09=function(_0x32fdbc,_0x18bd88){_0x32fdbc=_0x32fdbc-0x0;var _0x373981=_0xb091[_0x32fdbc];return _0x373981;};'use strict';function SalesforceAccount(_0x531bc8){this['id']=_0x531bc8['id']||0x0;this['name']=_0x531bc8[_0x1b09('0x0')]||'';this[_0x1b09('0x1')]=_0x531bc8['username']||'';this[_0x1b09('0x2')]=_0x531bc8['remoteUri']||'';this[_0x1b09('0x3')]=_0x531bc8[_0x1b09('0x3')]||'';this[_0x1b09('0x4')]=_0x531bc8[_0x1b09('0x4')]||'';this[_0x1b09('0x5')]=_0x531bc8['clientSecret']||'';this[_0x1b09('0x6')]=_0x531bc8['securityToken']||'';this[_0x1b09('0x7')]=_0x531bc8[_0x1b09('0x7')]||_0x1b09('0x8');this[_0x1b09('0x9')]=_0x531bc8['serverUrl']||'';this[_0x1b09('0xa')]=_0x531bc8[_0x1b09('0xa')]||{};}module[_0x1b09('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x00ca=['clientSecret','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00ca,0x1a8));var _0xa00c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x00ca[_0x19e35c];return _0x3e1fe8;};'use strict';function SalesforceAccount(_0x494dcd){this['id']=_0x494dcd['id']||0x0;this['name']=_0x494dcd[_0xa00c('0x0')]||'';this[_0xa00c('0x1')]=_0x494dcd['username']||'';this[_0xa00c('0x2')]=_0x494dcd['remoteUri']||'';this['password']=_0x494dcd[_0xa00c('0x3')]||'';this[_0xa00c('0x4')]=_0x494dcd[_0xa00c('0x4')]||'';this[_0xa00c('0x5')]=_0x494dcd['clientSecret']||'';this['securityToken']=_0x494dcd['securityToken']||'';this['type']=_0x494dcd[_0xa00c('0x6')]||_0xa00c('0x7');this['serverUrl']=_0x494dcd[_0xa00c('0x8')]||'';this['Configurations']=_0x494dcd[_0xa00c('0x9')]||{};}module[_0xa00c('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index f3f7414..b900688 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 _0x2fbe=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x2680a8,_0x3d4ceb){var _0x287733=function(_0x4092a3){while(--_0x4092a3){_0x2680a8['push'](_0x2680a8['shift']());}};_0x287733(++_0x3d4ceb);}(_0x2fbe,0x187));var _0xe2fb=function(_0x205c5d,_0x588d30){_0x205c5d=_0x205c5d-0x0;var _0x59df2a=_0x2fbe[_0x205c5d];return _0x59df2a;};'use strict';function ServicenowAccount(_0x332401){this['id']=_0x332401['id']||0x0;this[_0xe2fb('0x0')]=_0x332401['name']||'';this[_0xe2fb('0x1')]=_0x332401[_0xe2fb('0x1')]||'';this['password']=_0x332401[_0xe2fb('0x2')]||'';this['remoteUri']=_0x332401[_0xe2fb('0x3')]||'';this[_0xe2fb('0x4')]=_0x332401['serverUrl']||'';this['Configurations']=_0x332401[_0xe2fb('0x5')]||{};}module[_0xe2fb('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x82cf=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0xc1ca27,_0x47dd84){var _0x4857b6=function(_0x3cf7ee){while(--_0x3cf7ee){_0xc1ca27['push'](_0xc1ca27['shift']());}};_0x4857b6(++_0x47dd84);}(_0x82cf,0x18c));var _0xf82c=function(_0x319cb9,_0x4b8d35){_0x319cb9=_0x319cb9-0x0;var _0x1735fc=_0x82cf[_0x319cb9];return _0x1735fc;};'use strict';function ServicenowAccount(_0x3f59ed){this['id']=_0x3f59ed['id']||0x0;this['name']=_0x3f59ed[_0xf82c('0x0')]||'';this[_0xf82c('0x1')]=_0x3f59ed[_0xf82c('0x1')]||'';this[_0xf82c('0x2')]=_0x3f59ed[_0xf82c('0x2')]||'';this[_0xf82c('0x3')]=_0x3f59ed['remoteUri']||'';this[_0xf82c('0x4')]=_0x3f59ed[_0xf82c('0x4')]||'';this[_0xf82c('0x5')]=_0x3f59ed[_0xf82c('0x5')]||{};}module[_0xf82c('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 985e640..d594320 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 _0x88d4=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5dc5e4,_0x3dbd25){var _0x5132d9=function(_0x3c8f08){while(--_0x3c8f08){_0x5dc5e4['push'](_0x5dc5e4['shift']());}};_0x5132d9(++_0x3dbd25);}(_0x88d4,0xf0));var _0x488d=function(_0x44e2b3,_0x26e7be){_0x44e2b3=_0x44e2b3-0x0;var _0x17f62b=_0x88d4[_0x44e2b3];return _0x17f62b;};'use strict';function SugarcrmAccount(_0x516b8b){this['id']=_0x516b8b['id']||0x0;this[_0x488d('0x0')]=_0x516b8b[_0x488d('0x0')]||'';this[_0x488d('0x1')]=_0x516b8b['username']||'';this[_0x488d('0x2')]=_0x516b8b[_0x488d('0x2')]||'';this[_0x488d('0x3')]=_0x516b8b[_0x488d('0x3')]||'';this[_0x488d('0x4')]=_0x516b8b[_0x488d('0x4')]||'';this[_0x488d('0x5')]=_0x516b8b['Configurations']||{};}module[_0x488d('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x81fb=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xf67f45,_0x36e087){var _0xd9ab5=function(_0x594070){while(--_0x594070){_0xf67f45['push'](_0xf67f45['shift']());}};_0xd9ab5(++_0x36e087);}(_0x81fb,0xef));var _0xb81f=function(_0x13b059,_0x3d3e9f){_0x13b059=_0x13b059-0x0;var _0x8daff3=_0x81fb[_0x13b059];return _0x8daff3;};'use strict';function SugarcrmAccount(_0x295055){this['id']=_0x295055['id']||0x0;this[_0xb81f('0x0')]=_0x295055['name']||'';this[_0xb81f('0x1')]=_0x295055[_0xb81f('0x1')]||'';this[_0xb81f('0x2')]=_0x295055[_0xb81f('0x2')]||'';this[_0xb81f('0x3')]=_0x295055[_0xb81f('0x3')]||'';this['serverUrl']=_0x295055[_0xb81f('0x4')]||'';this[_0xb81f('0x5')]=_0x295055[_0xb81f('0x5')]||{};}module[_0xb81f('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 a83d67c..4b1f9e1 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 _0xe606=['exports','name','accountcode','stateTime','status','unknown','address'];(function(_0x197f1e,_0x1f25ef){var _0x353b04=function(_0x26b6d3){while(--_0x26b6d3){_0x197f1e['push'](_0x197f1e['shift']());}};_0x353b04(++_0x1f25ef);}(_0xe606,0x16d));var _0x6e60=function(_0x45943c,_0x292e90){_0x45943c=_0x45943c-0x0;var _0xe1cf98=_0xe606[_0x45943c];return _0xe1cf98;};'use strict';function Telephone(_0xde3d24){this['id']=_0xde3d24['id']||0x0;this[_0x6e60('0x0')]=_0xde3d24[_0x6e60('0x0')]||'';this[_0x6e60('0x1')]=_0xde3d24[_0x6e60('0x1')]||'';this['state']='unknown';this[_0x6e60('0x2')]=0x0;this[_0x6e60('0x3')]=_0x6e60('0x4');this[_0x6e60('0x5')]='';}module[_0x6e60('0x6')]=Telephone; \ No newline at end of file +var _0xdd73=['status','address','exports','name','accountcode','unknown','stateTime'];(function(_0x4e6eb2,_0x16a451){var _0x4e0c1c=function(_0x59f144){while(--_0x59f144){_0x4e6eb2['push'](_0x4e6eb2['shift']());}};_0x4e0c1c(++_0x16a451);}(_0xdd73,0xc7));var _0x3dd7=function(_0xa5fdf4,_0x553bc8){_0xa5fdf4=_0xa5fdf4-0x0;var _0x45a73d=_0xdd73[_0xa5fdf4];return _0x45a73d;};'use strict';function Telephone(_0x1fc481){this['id']=_0x1fc481['id']||0x0;this[_0x3dd7('0x0')]=_0x1fc481[_0x3dd7('0x0')]||'';this[_0x3dd7('0x1')]=_0x1fc481[_0x3dd7('0x1')]||'';this['state']=_0x3dd7('0x2');this[_0x3dd7('0x3')]=0x0;this[_0x3dd7('0x4')]='unknown';this[_0x3dd7('0x5')]='';}module[_0x3dd7('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 4e5090e..4d099f6 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 _0x41d7=['name','html','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x41d7,0x186));var _0x741d=function(_0x3b1f04,_0x43531a){_0x3b1f04=_0x3b1f04-0x0;var _0x5edf29=_0x41d7[_0x3b1f04];return _0x5edf29;};'use strict';function template(_0x76ab98){this['id']=_0x76ab98['id']||0x0;this[_0x741d('0x0')]=_0x76ab98[_0x741d('0x0')]||'';this[_0x741d('0x1')]=_0x76ab98[_0x741d('0x1')]||'';}module[_0x741d('0x2')]=template; \ No newline at end of file +var _0x98d5=['exports','html'];(function(_0x11684c,_0x35ce18){var _0x4f8463=function(_0x4679f2){while(--_0x4679f2){_0x11684c['push'](_0x11684c['shift']());}};_0x4f8463(++_0x35ce18);}(_0x98d5,0xfb));var _0x598d=function(_0x41b696,_0x604c78){_0x41b696=_0x41b696-0x0;var _0x2e9400=_0x98d5[_0x41b696];return _0x2e9400;};'use strict';function template(_0x2f0149){this['id']=_0x2f0149['id']||0x0;this['name']=_0x2f0149['name']||'';this[_0x598d('0x0')]=_0x2f0149[_0x598d('0x0')]||'';}module[_0x598d('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 6b1861d..b94138f 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 _0x9c44=['voice','status','AnyConditions','Actions','exports','name','channel'];(function(_0x1da9d1,_0x346769){var _0x40ec6a=function(_0x400833){while(--_0x400833){_0x1da9d1['push'](_0x1da9d1['shift']());}};_0x40ec6a(++_0x346769);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';function Trigger(_0x2fa01d){this['id']=_0x2fa01d['id']||0x0;this['name']=_0x2fa01d[_0x49c4('0x0')]||'';this[_0x49c4('0x1')]=_0x2fa01d[_0x49c4('0x1')]||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x2fa01d[_0x49c4('0x3')]||![];this['AllConditions']=_0x2fa01d['AllConditions']||[];this[_0x49c4('0x4')]=_0x2fa01d['AnyConditions']||[];this[_0x49c4('0x5')]=_0x2fa01d[_0x49c4('0x5')]||[];}module[_0x49c4('0x6')]=Trigger; \ No newline at end of file +var _0xedd9=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x53f647,_0x3bd010){var _0x5a34b2=function(_0x4979c7){while(--_0x4979c7){_0x53f647['push'](_0x53f647['shift']());}};_0x5a34b2(++_0x3bd010);}(_0xedd9,0xfc));var _0x9edd=function(_0x46b1b6,_0x4dbb67){_0x46b1b6=_0x46b1b6-0x0;var _0xe9e02b=_0xedd9[_0x46b1b6];return _0xe9e02b;};'use strict';function Trigger(_0x265eb8){this['id']=_0x265eb8['id']||0x0;this[_0x9edd('0x0')]=_0x265eb8[_0x9edd('0x0')]||'';this[_0x9edd('0x1')]=_0x265eb8[_0x9edd('0x1')]||_0x9edd('0x2');this[_0x9edd('0x3')]=_0x265eb8[_0x9edd('0x3')]||![];this[_0x9edd('0x4')]=_0x265eb8['AllConditions']||[];this[_0x9edd('0x5')]=_0x265eb8[_0x9edd('0x5')]||[];this[_0x9edd('0x6')]=_0x265eb8[_0x9edd('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 53f67f6..d5dbb0d 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 _0xabc0=['stateTime','status','registry','indexOf','split','host','port','domain','domainport','stateRegistry','registrationtime','address','exports','active','name','unknown'];(function(_0x3ceb54,_0x5bddfd){var _0x26d8a6=function(_0x32e484){while(--_0x32e484){_0x3ceb54['push'](_0x3ceb54['shift']());}};_0x26d8a6(++_0x5bddfd);}(_0xabc0,0x16d));var _0x0abc=function(_0x50432f,_0x4afa0e){_0x50432f=_0x50432f-0x0;var _0x53d9c0=_0xabc0[_0x50432f];return _0x53d9c0;};'use strict';function Trunk(_0x42f767){this['id']=_0x42f767['id']||0x0;this[_0x0abc('0x0')]=_0x42f767[_0x0abc('0x0')]||![];this[_0x0abc('0x1')]=_0x42f767[_0x0abc('0x1')]||'';this['state']=_0x0abc('0x2');this[_0x0abc('0x3')]=0x0;this[_0x0abc('0x4')]=_0x0abc('0x2');this['registry']=_0x42f767[_0x0abc('0x5')]&&_0x42f767[_0x0abc('0x5')][_0x0abc('0x6')](':')?_0x42f767['registry'][_0x0abc('0x7')](':')[0x0]:'';this[_0x0abc('0x8')]='';this[_0x0abc('0x9')]='';this[_0x0abc('0xa')]='';this[_0x0abc('0xb')]='';this['refresh']='';this[_0x0abc('0xc')]='unknown';this[_0x0abc('0xd')]='';this[_0x0abc('0xe')]='';}module[_0x0abc('0xf')]=Trunk; \ No newline at end of file +var _0xa583=['status','registry','split','port','domain','domainport','refresh','stateRegistry','exports','active','name','state','unknown'];(function(_0x568478,_0x2557a7){var _0x11edbb=function(_0x23f9e0){while(--_0x23f9e0){_0x568478['push'](_0x568478['shift']());}};_0x11edbb(++_0x2557a7);}(_0xa583,0x127));var _0x3a58=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xa583[_0x42cae2];return _0x5f256f;};'use strict';function Trunk(_0xce84de){this['id']=_0xce84de['id']||0x0;this[_0x3a58('0x0')]=_0xce84de['active']||![];this[_0x3a58('0x1')]=_0xce84de[_0x3a58('0x1')]||'';this[_0x3a58('0x2')]=_0x3a58('0x3');this['stateTime']=0x0;this[_0x3a58('0x4')]=_0x3a58('0x3');this[_0x3a58('0x5')]=_0xce84de[_0x3a58('0x5')]&&_0xce84de['registry']['indexOf'](':')?_0xce84de['registry'][_0x3a58('0x6')](':')[0x0]:'';this['host']='';this[_0x3a58('0x7')]='';this[_0x3a58('0x8')]='';this[_0x3a58('0x9')]='';this[_0x3a58('0xa')]='';this[_0x3a58('0xb')]=_0x3a58('0x3');this['registrationtime']='';this['address']='';}module[_0x3a58('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 96d564d..b484521 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 _0xe654=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x203867,_0x49ac1e){var _0x1a39e6=function(_0x172876){while(--_0x172876){_0x203867['push'](_0x203867['shift']());}};_0x1a39e6(++_0x49ac1e);}(_0xe654,0xd3));var _0x4e65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe654[_0x3dd15e];return _0x231fd0;};'use strict';function voiceExtension(_0x33d155){this['id']=_0x33d155['id']||0x0;this['exten']=_0x33d155[_0x4e65('0x0')]||'';this['recordingFormat']=_0x33d155[_0x4e65('0x1')]||_0x4e65('0x2');this[_0x4e65('0x3')]=_0x33d155[_0x4e65('0x3')]||![];}module[_0x4e65('0x4')]=voiceExtension; \ No newline at end of file +var _0xb35c=['none','exports','exten','recordingFormat'];(function(_0x28b734,_0x3b3693){var _0xa5033e=function(_0x1fa4b2){while(--_0x1fa4b2){_0x28b734['push'](_0x28b734['shift']());}};_0xa5033e(++_0x3b3693);}(_0xb35c,0x1d6));var _0xcb35=function(_0x145a52,_0x56c3f4){_0x145a52=_0x145a52-0x0;var _0xacce5c=_0xb35c[_0x145a52];return _0xacce5c;};'use strict';function voiceExtension(_0x4d1cc8){this['id']=_0x4d1cc8['id']||0x0;this['exten']=_0x4d1cc8[_0xcb35('0x0')]||'';this[_0xcb35('0x1')]=_0x4d1cc8[_0xcb35('0x1')]||_0xcb35('0x2');this['mandatoryDisposition']=_0x4d1cc8['mandatoryDisposition']||![];}module[_0xcb35('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 110d96d..c98dcf2 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 _0x7b4e=['Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry'];(function(_0x4ac48d,_0x171a68){var _0x7537af=function(_0x1c6ca6){while(--_0x1c6ca6){_0x4ac48d['push'](_0x4ac48d['shift']());}};_0x7537af(++_0x171a68);}(_0x7b4e,0x132));var _0xe7b4=function(_0x1dad70,_0x156649){_0x1dad70=_0x1dad70-0x0;var _0x14771d=_0x7b4e[_0x1dad70];return _0x14771d;};'use strict';var statusDesc=[_0xe7b4('0x0'),_0xe7b4('0x1'),_0xe7b4('0x2'),_0xe7b4('0x3'),'invalid',_0xe7b4('0x4'),_0xe7b4('0x5'),_0xe7b4('0x6'),_0xe7b4('0x7')];var monitorFormat={'wav':'wav','wav49':_0xe7b4('0x8'),'gsm':_0xe7b4('0x9')};var strategy={'rrmemory':_0xe7b4('0xa'),'roundrobin':_0xe7b4('0xb')};function VoiceQueue(_0x4dbb70){this['id']=_0x4dbb70['id']||0x0;this[_0xe7b4('0xc')]=_0x4dbb70[_0xe7b4('0xc')]||'';this[_0xe7b4('0xd')]=_0x4dbb70[_0xe7b4('0xd')]||'';this[_0xe7b4('0xe')]=_0x4dbb70['type']||_0xe7b4('0xf');this[_0xe7b4('0x10')]=0x0;this[_0xe7b4('0x11')]=0x0;this['total']=0x0;this[_0xe7b4('0x12')]=0x0;this[_0xe7b4('0x13')]=0x0;this['sumHoldTime']=0x0;this[_0xe7b4('0x14')]=0x0;this[_0xe7b4('0x15')]=0x0;this[_0xe7b4('0x16')]=0x0;this[_0xe7b4('0x17')]=0x0;this[_0xe7b4('0x18')]=0x0;this[_0xe7b4('0x19')]=_0x4dbb70[_0xe7b4('0x19')]||![];this[_0xe7b4('0x1a')]=_0x4dbb70[_0xe7b4('0x1a')]||0xa;this[_0xe7b4('0x1b')]=_0x4dbb70[_0xe7b4('0x1b')]||'no';this[_0xe7b4('0x1c')]=!![];this[_0xe7b4('0x1d')]='';this['originated']=0x0;this[_0xe7b4('0x1e')]=0x0;this[_0xe7b4('0x1f')]=_0x4dbb70[_0xe7b4('0x1f')]||null;this[_0xe7b4('0x20')]=_0x4dbb70[_0xe7b4('0x20')]?_0x4dbb70['dialGlobalInterval']:null;this[_0xe7b4('0x21')]=_0x4dbb70['dialActive'];this[_0xe7b4('0x22')]=_0x4dbb70[_0xe7b4('0x22')]||'progressive';this[_0xe7b4('0x23')]=_0x4dbb70[_0xe7b4('0x23')]||0x0;this[_0xe7b4('0x24')]=_0x4dbb70['dialLimitQueue']||0x0;this[_0xe7b4('0x25')]=_0x4dbb70['dialPowerLevel']||0x1;this[_0xe7b4('0x26')]=_0x4dbb70[_0xe7b4('0x26')]||_0xe7b4('0x27');this[_0xe7b4('0x28')]=_0x4dbb70[_0xe7b4('0x28')]||0.03;this[_0xe7b4('0x29')]=_0x4dbb70['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x4dbb70['dialOriginateCallerIdName']||_0xe7b4('0x2a');this[_0xe7b4('0x2b')]=_0x4dbb70['dialOriginateCallerIdNumber']||_0xe7b4('0x2a');this[_0xe7b4('0x2c')]=_0x4dbb70[_0xe7b4('0x2c')]||0x1e;this['dialQueueOptions']=_0x4dbb70[_0xe7b4('0x2d')]||_0xe7b4('0x2e');this[_0xe7b4('0x2f')]=_0x4dbb70[_0xe7b4('0x2f')]||0x3;this[_0xe7b4('0x30')]=_0x4dbb70[_0xe7b4('0x30')]||undefined;this['dialCongestionMaxRetry']=_0x4dbb70[_0xe7b4('0x31')]||0x3;this[_0xe7b4('0x32')]=_0x4dbb70[_0xe7b4('0x32')]||0x96;this[_0xe7b4('0x33')]=_0x4dbb70[_0xe7b4('0x33')]||0x3;this[_0xe7b4('0x34')]=_0x4dbb70[_0xe7b4('0x34')]||0x96;this[_0xe7b4('0x35')]=_0x4dbb70[_0xe7b4('0x35')]||0x3;this[_0xe7b4('0x36')]=_0x4dbb70[_0xe7b4('0x36')]||0x96;this[_0xe7b4('0x37')]=_0x4dbb70[_0xe7b4('0x37')]||0x3;this[_0xe7b4('0x38')]=_0x4dbb70[_0xe7b4('0x38')]||0x96;this[_0xe7b4('0x39')]=_0x4dbb70['dialDropMaxRetry']||0x3;this[_0xe7b4('0x3a')]=_0x4dbb70[_0xe7b4('0x3a')]||0x96;this[_0xe7b4('0x3b')]=_0x4dbb70[_0xe7b4('0x3b')]||0x3;this[_0xe7b4('0x3c')]=_0x4dbb70[_0xe7b4('0x3c')]||0x96;this[_0xe7b4('0x3d')]=_0x4dbb70[_0xe7b4('0x3d')]||0x3;this[_0xe7b4('0x3e')]=_0x4dbb70[_0xe7b4('0x3e')]||0x96;this['dialAgentRejectMaxRetry']=_0x4dbb70[_0xe7b4('0x3f')]||0x3;this[_0xe7b4('0x40')]=_0x4dbb70['dialAgentRejectRetryFrequency']||0x96;this[_0xe7b4('0x41')]=_0x4dbb70['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x4dbb70[_0xe7b4('0x42')]?_0x4dbb70[_0xe7b4('0x42')]:undefined;this[_0xe7b4('0x43')]=_0x4dbb70['TrunkBackup']?_0x4dbb70[_0xe7b4('0x43')]:undefined;this['dialPrefix']=_0x4dbb70[_0xe7b4('0x44')]||undefined;this[_0xe7b4('0x45')]=_0x4dbb70[_0xe7b4('0x45')]?_0x4dbb70['Interval']:undefined;this[_0xe7b4('0x46')]=_0x4dbb70['dialOrderByScheduledAt']||_0xe7b4('0x47');this['dialRandomLastDigitCallerIdNumber']=_0x4dbb70[_0xe7b4('0x48')]||undefined;this[_0xe7b4('0x49')]=_0x4dbb70[_0xe7b4('0x49')]||undefined;this['strategy']=strategy[_0x4dbb70[_0xe7b4('0x4a')]]||_0xe7b4('0xa');this[_0xe7b4('0x4b')]=!![];this[_0xe7b4('0x4c')]=_0x4dbb70[_0xe7b4('0x4c')]||![];this[_0xe7b4('0x4d')]=_0x4dbb70[_0xe7b4('0x4d')];this[_0xe7b4('0x4e')]=_0x4dbb70[_0xe7b4('0x4e')];this[_0xe7b4('0x4f')]=_0x4dbb70[_0xe7b4('0x4f')];this[_0xe7b4('0x50')]=_0x4dbb70[_0xe7b4('0x50')];this[_0xe7b4('0x51')]=_0x4dbb70[_0xe7b4('0x51')];this[_0xe7b4('0x52')]=_0x4dbb70['dialAMDBetweenWordsSilence'];this[_0xe7b4('0x53')]=_0x4dbb70[_0xe7b4('0x53')];this[_0xe7b4('0x54')]=_0x4dbb70[_0xe7b4('0x54')];this[_0xe7b4('0x55')]=_0x4dbb70[_0xe7b4('0x55')];this[_0xe7b4('0x56')]=0x0;this[_0xe7b4('0x57')]=0x0;this[_0xe7b4('0x58')]=_0x4dbb70['timeout'];this[_0xe7b4('0x59')]=0x0;this[_0xe7b4('0x5a')]=0x0;this[_0xe7b4('0x5b')]=0x0;this[_0xe7b4('0x5c')]=0x0;this[_0xe7b4('0x5d')]=0x0;this[_0xe7b4('0x5e')]=0x0;this[_0xe7b4('0x5f')]=0x0;this[_0xe7b4('0x60')]=0x0;this[_0xe7b4('0x61')]=0x0;this[_0xe7b4('0x62')]=0x0;this[_0xe7b4('0x63')]=0x0;this[_0xe7b4('0x64')]=0x0;this[_0xe7b4('0x65')]=0x0;this[_0xe7b4('0x66')]=0x0;this[_0xe7b4('0x67')]=undefined;this[_0xe7b4('0x68')]=undefined;this['handlePredictive']=undefined;this[_0xe7b4('0x69')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xe7b4('0x6a')]=0x0;this[_0xe7b4('0x6b')]=0x0;this[_0xe7b4('0x6c')]=0x0;this[_0xe7b4('0x6d')]=_0x4dbb70[_0xe7b4('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x4dbb70[_0xe7b4('0x6e')]||0xa;this[_0xe7b4('0x6f')]=0x0;this[_0xe7b4('0x70')]=0x0;this[_0xe7b4('0x71')]=0x1;this['erlangCalls']=0x0;this[_0xe7b4('0x72')]=0x0;this[_0xe7b4('0x73')]=0x0;this['erlangBusyFactor']=0x0;this[_0xe7b4('0x74')]=_0x4dbb70[_0xe7b4('0x74')]||0x1e;this['dialRecallInQueue']=_0x4dbb70[_0xe7b4('0x75')]||![];this[_0xe7b4('0x76')]=_0x4dbb70['dialQueueProject2']||undefined;this[_0xe7b4('0x77')]=_0x4dbb70['dialAgiAfterHangupClient']||![];this[_0xe7b4('0x78')]=_0x4dbb70[_0xe7b4('0x78')]||![];this[_0xe7b4('0xd')]=monitorFormat[_0x4dbb70[_0xe7b4('0xd')]]?monitorFormat[_0x4dbb70[_0xe7b4('0xd')]]:undefined;this['mandatoryDisposition']=_0x4dbb70[_0xe7b4('0x79')]||![];this['mandatoryDispositionPause']=_0x4dbb70[_0xe7b4('0x7a')]?_0x4dbb70['mandatoryDispositionPause']:undefined;}module[_0xe7b4('0x7b')]=VoiceQueue; \ No newline at end of file +var _0x617d=['inbound','waiting','talking','total','sumDuration','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav49','gsm','rrmemory','roundrobin','monitor_format','type'];(function(_0x2b79fd,_0x460ee5){var _0x4af9f9=function(_0x23e750){while(--_0x23e750){_0x2b79fd['push'](_0x2b79fd['shift']());}};_0x4af9f9(++_0x460ee5);}(_0x617d,0xe4));var _0xd617=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x617d[_0xbca1b1];return _0x4e1686;};'use strict';var statusDesc=[_0xd617('0x0'),'not_inuse',_0xd617('0x1'),_0xd617('0x2'),_0xd617('0x3'),_0xd617('0x4'),_0xd617('0x5'),_0xd617('0x6'),_0xd617('0x7')];var monitorFormat={'wav':'wav','wav49':_0xd617('0x8'),'gsm':_0xd617('0x9')};var strategy={'rrmemory':_0xd617('0xa'),'roundrobin':_0xd617('0xb')};function VoiceQueue(_0x238036){this['id']=_0x238036['id']||0x0;this['name']=_0x238036['name']||'';this['monitor_format']=_0x238036[_0xd617('0xc')]||'';this[_0xd617('0xd')]=_0x238036['type']||_0xd617('0xe');this[_0xd617('0xf')]=0x0;this[_0xd617('0x10')]=0x0;this[_0xd617('0x11')]=0x0;this['answered']=0x0;this[_0xd617('0x12')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0xd617('0x13')]=0x0;this['loggedIn']=0x0;this[_0xd617('0x14')]=0x0;this[_0xd617('0x15')]=_0x238036[_0xd617('0x15')]||![];this[_0xd617('0x16')]=_0x238036[_0xd617('0x16')]||0xa;this[_0xd617('0x17')]=_0x238036['autopause']||'no';this[_0xd617('0x18')]=!![];this['message']='';this[_0xd617('0x19')]=0x0;this[_0xd617('0x1a')]=0x0;this[_0xd617('0x1b')]=_0x238036[_0xd617('0x1b')]||null;this[_0xd617('0x1c')]=_0x238036[_0xd617('0x1c')]?_0x238036[_0xd617('0x1c')]:null;this[_0xd617('0x1d')]=_0x238036[_0xd617('0x1d')];this['dialMethod']=_0x238036[_0xd617('0x1e')]||_0xd617('0x1f');this[_0xd617('0x20')]=_0x238036['dialLimitChannel']||0x0;this[_0xd617('0x21')]=_0x238036[_0xd617('0x21')]||0x0;this[_0xd617('0x22')]=_0x238036[_0xd617('0x22')]||0x1;this[_0xd617('0x23')]=_0x238036[_0xd617('0x23')]||'dropRate';this[_0xd617('0x24')]=_0x238036['dialPredictiveOptimizationPercentage']||0.03;this[_0xd617('0x25')]=_0x238036[_0xd617('0x25')]||0x258;this[_0xd617('0x26')]=_0x238036['dialOriginateCallerIdName']||_0xd617('0x27');this[_0xd617('0x28')]=_0x238036[_0xd617('0x28')]||_0xd617('0x27');this[_0xd617('0x29')]=_0x238036[_0xd617('0x29')]||0x1e;this[_0xd617('0x2a')]=_0x238036[_0xd617('0x2a')]||'tTxX';this[_0xd617('0x2b')]=_0x238036[_0xd617('0x2b')]||0x3;this['dialQueueProject']=_0x238036[_0xd617('0x2c')]||undefined;this[_0xd617('0x2d')]=_0x238036[_0xd617('0x2d')]||0x3;this['dialCongestionRetryFrequency']=_0x238036[_0xd617('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x238036[_0xd617('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x238036[_0xd617('0x30')]||0x96;this['dialNoAnswerMaxRetry']=_0x238036[_0xd617('0x31')]||0x3;this[_0xd617('0x32')]=_0x238036['dialNoAnswerRetryFrequency']||0x96;this[_0xd617('0x33')]=_0x238036[_0xd617('0x33')]||0x3;this[_0xd617('0x34')]=_0x238036[_0xd617('0x34')]||0x96;this[_0xd617('0x35')]=_0x238036['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x238036['dialDropRetryFrequency']||0x96;this[_0xd617('0x36')]=_0x238036[_0xd617('0x36')]||0x3;this[_0xd617('0x37')]=_0x238036[_0xd617('0x37')]||0x96;this['dialMachineMaxRetry']=_0x238036[_0xd617('0x38')]||0x3;this[_0xd617('0x39')]=_0x238036[_0xd617('0x39')]||0x96;this['dialAgentRejectMaxRetry']=_0x238036['dialAgentRejectMaxRetry']||0x3;this[_0xd617('0x3a')]=_0x238036[_0xd617('0x3a')]||0x96;this[_0xd617('0x3b')]=_0x238036[_0xd617('0x3b')]||0x4;this[_0xd617('0x3c')]=_0x238036['Trunk']?_0x238036[_0xd617('0x3c')]:undefined;this[_0xd617('0x3d')]=_0x238036[_0xd617('0x3d')]?_0x238036['TrunkBackup']:undefined;this['dialPrefix']=_0x238036[_0xd617('0x3e')]||undefined;this['Interval']=_0x238036[_0xd617('0x3f')]?_0x238036[_0xd617('0x3f')]:undefined;this[_0xd617('0x40')]=_0x238036[_0xd617('0x40')]||_0xd617('0x41');this[_0xd617('0x42')]=_0x238036['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xd617('0x43')]=_0x238036[_0xd617('0x43')]||undefined;this[_0xd617('0x44')]=strategy[_0x238036['strategy']]||_0xd617('0xa');this[_0xd617('0x45')]=!![];this['dialAMDActive']=_0x238036[_0xd617('0x46')]||![];this[_0xd617('0x47')]=_0x238036[_0xd617('0x47')];this[_0xd617('0x48')]=_0x238036['dialAMDGreeting'];this[_0xd617('0x49')]=_0x238036[_0xd617('0x49')];this['dialAMDTotalAnalysisTime']=_0x238036['dialAMDTotalAnalysisTime'];this[_0xd617('0x4a')]=_0x238036[_0xd617('0x4a')];this['dialAMDBetweenWordsSilence']=_0x238036[_0xd617('0x4b')];this[_0xd617('0x4c')]=_0x238036['dialAMDMaximumNumberOfWords'];this[_0xd617('0x4d')]=_0x238036[_0xd617('0x4d')];this[_0xd617('0x4e')]=_0x238036[_0xd617('0x4e')];this[_0xd617('0x4f')]=0x0;this['pTalking']=0x0;this[_0xd617('0x50')]=_0x238036[_0xd617('0x50')];this[_0xd617('0x51')]=0x0;this[_0xd617('0x52')]=0x0;this[_0xd617('0x53')]=0x0;this[_0xd617('0x54')]=0x0;this[_0xd617('0x55')]=0x0;this[_0xd617('0x56')]=0x0;this[_0xd617('0x57')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xd617('0x58')]=0x0;this[_0xd617('0x59')]=0x0;this[_0xd617('0x5a')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xd617('0x5b')]=0x0;this[_0xd617('0x5c')]=0x0;this[_0xd617('0x5d')]=undefined;this[_0xd617('0x5e')]=undefined;this[_0xd617('0x5f')]=undefined;this[_0xd617('0x60')]=1.05;this[_0xd617('0x61')]=0x0;this[_0xd617('0x62')]=0x0;this[_0xd617('0x63')]=0x0;this[_0xd617('0x64')]=0x0;this[_0xd617('0x65')]=0x0;this[_0xd617('0x66')]=0x0;this[_0xd617('0x67')]=0x0;this[_0xd617('0x68')]=0x0;this[_0xd617('0x69')]=_0x238036['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xd617('0x6a')]=_0x238036[_0xd617('0x6b')]||0xa;this[_0xd617('0x6c')]=0x0;this[_0xd617('0x6d')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xd617('0x6e')]=0x0;this['erlangCallToSecond']=0x0;this[_0xd617('0x6f')]=0x0;this[_0xd617('0x70')]=0x0;this[_0xd617('0x71')]=_0x238036[_0xd617('0x71')]||0x1e;this[_0xd617('0x72')]=_0x238036[_0xd617('0x72')]||![];this[_0xd617('0x73')]=_0x238036['dialQueueProject2']||undefined;this[_0xd617('0x74')]=_0x238036['dialAgiAfterHangupClient']||![];this[_0xd617('0x75')]=_0x238036[_0xd617('0x75')]||![];this['monitor_format']=monitorFormat[_0x238036[_0xd617('0xc')]]?monitorFormat[_0x238036[_0xd617('0xc')]]:undefined;this[_0xd617('0x76')]=_0x238036[_0xd617('0x76')]||![];this[_0xd617('0x77')]=_0x238036[_0xd617('0x77')]?_0x238036[_0xd617('0x77')]:undefined;}module[_0xd617('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 7a0e7eb..e675878 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 _0x6c77=['username','accessKey','remoteUri','Configurations','exports','name'];(function(_0x50d673,_0x229c9b){var _0xe848d9=function(_0x473d00){while(--_0x473d00){_0x50d673['push'](_0x50d673['shift']());}};_0xe848d9(++_0x229c9b);}(_0x6c77,0x143));var _0x76c7=function(_0x4aaff3,_0x18b012){_0x4aaff3=_0x4aaff3-0x0;var _0x3a20f3=_0x6c77[_0x4aaff3];return _0x3a20f3;};'use strict';function VtigerAccount(_0x5dc89b){this['id']=_0x5dc89b['id']||0x0;this[_0x76c7('0x0')]=_0x5dc89b[_0x76c7('0x0')]||'';this[_0x76c7('0x1')]=_0x5dc89b[_0x76c7('0x1')]||'';this['accessKey']=_0x5dc89b[_0x76c7('0x2')]||'';this[_0x76c7('0x3')]=_0x5dc89b[_0x76c7('0x3')]||'';this['serverUrl']=_0x5dc89b['serverUrl']||'';this[_0x76c7('0x4')]=_0x5dc89b[_0x76c7('0x4')]||{};}module[_0x76c7('0x5')]=VtigerAccount; \ No newline at end of file +var _0x1a27=['serverUrl','Configurations','exports','username','accessKey','remoteUri'];(function(_0x54ab92,_0x4c3af0){var _0xacad3d=function(_0x21b3fa){while(--_0x21b3fa){_0x54ab92['push'](_0x54ab92['shift']());}};_0xacad3d(++_0x4c3af0);}(_0x1a27,0x129));var _0x71a2=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x1a27[_0x138f59];return _0x3d114d;};'use strict';function VtigerAccount(_0x2e81dc){this['id']=_0x2e81dc['id']||0x0;this['name']=_0x2e81dc['name']||'';this[_0x71a2('0x0')]=_0x2e81dc['username']||'';this[_0x71a2('0x1')]=_0x2e81dc[_0x71a2('0x1')]||'';this['remoteUri']=_0x2e81dc[_0x71a2('0x2')]||'';this['serverUrl']=_0x2e81dc[_0x71a2('0x3')]||'';this[_0x71a2('0x4')]=_0x2e81dc['Configurations']||{};}module[_0x71a2('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 eba3592..b526284 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 _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x175fed,_0x164e34){_0x175fed=_0x175fed-0x0;var _0x531fd7=_0xdb28[_0x175fed];return _0x531fd7;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x2032=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username','password'];(function(_0x44b794,_0xf128b1){var _0x14200b=function(_0x46c143){while(--_0x46c143){_0x44b794['push'](_0x44b794['shift']());}};_0x14200b(++_0xf128b1);}(_0x2032,0xd9));var _0x2203=function(_0x50b835,_0x592657){_0x50b835=_0x50b835-0x0;var _0x1ee3e0=_0x2032[_0x50b835];return _0x1ee3e0;};'use strict';function ZendeskAccount(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['username']||'';this[_0x2203('0x2')]=_0x4d6c97[_0x2203('0x2')]||'';this['token']=_0x4d6c97[_0x2203('0x3')]||'';this[_0x2203('0x4')]=_0x4d6c97[_0x2203('0x4')]||'';this[_0x2203('0x5')]=_0x4d6c97[_0x2203('0x5')]||'';this[_0x2203('0x6')]=_0x4d6c97[_0x2203('0x6')]||_0x2203('0x7');this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')]||'';this[_0x2203('0x9')]=_0x4d6c97['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index f24f08c..63b4556 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 _0x4fc2=['code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x1c7b6f,_0x2cc63a){var _0xab6f=function(_0x2862f1){while(--_0x2862f1){_0x1c7b6f['push'](_0x1c7b6f['shift']());}};_0xab6f(++_0x2cc63a);}(_0x4fc2,0x111));var _0x24fc=function(_0x2d566b,_0x47c52d){_0x2d566b=_0x2d566b-0x0;var _0xd90686=_0x4fc2[_0x2d566b];return _0xd90686;};'use strict';function ZohoAccount(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['description']||'';this[_0x24fc('0x2')]=_0x5ea3ab[_0x24fc('0x2')]||'';this[_0x24fc('0x3')]=_0x5ea3ab['zone']||'';this[_0x24fc('0x4')]=_0x5ea3ab[_0x24fc('0x4')]||'';this['clientSecret']=_0x5ea3ab[_0x24fc('0x5')]||'';this[_0x24fc('0x6')]=_0x5ea3ab['serverUrl']||'';this[_0x24fc('0x7')]=_0x5ea3ab[_0x24fc('0x7')]||'';this[_0x24fc('0x8')]=_0x5ea3ab[_0x24fc('0x8')]||'';this[_0x24fc('0x9')]=_0x5ea3ab[_0x24fc('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xe820=['name','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x4db370,_0x4fbe6c){var _0x4d702b=function(_0x3a978c){while(--_0x3a978c){_0x4db370['push'](_0x4db370['shift']());}};_0x4d702b(++_0x4fbe6c);}(_0xe820,0xd2));var _0x0e82=function(_0x2056bd,_0x5b9028){_0x2056bd=_0x2056bd-0x0;var _0x24fec0=_0xe820[_0x2056bd];return _0x24fec0;};'use strict';function ZohoAccount(_0x4920a9){this['id']=_0x4920a9['id']||0x0;this['name']=_0x4920a9[_0x0e82('0x0')]||'';this['description']=_0x4920a9['description']||'';this[_0x0e82('0x1')]=_0x4920a9[_0x0e82('0x1')]||'';this[_0x0e82('0x2')]=_0x4920a9['zone']||'';this[_0x0e82('0x3')]=_0x4920a9['clientId']||'';this[_0x0e82('0x4')]=_0x4920a9[_0x0e82('0x4')]||'';this[_0x0e82('0x5')]=_0x4920a9[_0x0e82('0x5')]||'';this[_0x0e82('0x6')]=_0x4920a9['code']||'';this[_0x0e82('0x7')]=_0x4920a9[_0x0e82('0x7')]||'';this[_0x0e82('0x8')]=_0x4920a9[_0x0e82('0x8')]||{};}module[_0x0e82('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 1d7de64..fbbaf6d 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 _0xc04e=['countnosuchnumberretry','countdropretry','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','uniqueid','queue','campaigntype','dialAnswer','Agent','name','channelAgent','format','SIP/%s','membername','calleridname','Contact','phone','firstName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0xc04e,0x135));var _0xec04=function(_0x220a17,_0x2fe83f){_0x220a17=_0x220a17-0x0;var _0x24caee=_0xc04e[_0x220a17];return _0x24caee;};'use strict';var util=require('util');var _=require(_0xec04('0x0'));var moment=require(_0xec04('0x1'));function checkNameSurname(_0x44ceb4,_0x5bbe04,_0x96ca1e){var _0x44023b='';if(!_['isNil'](_0x5bbe04)&&'string'===typeof _0x5bbe04){_0x44023b+=_0x5bbe04;}if(!_[_0xec04('0x2')](_0x96ca1e)&&_0xec04('0x3')===typeof _0x96ca1e){_0x44023b+='\x20'+_0x96ca1e;}if(_0x44023b!==''){return _0x44023b;}return _0x44ceb4;}function Action(_0x14529d,_0x32c5bb,_0x4188c5,_0x340f2e,_0x40ce9c){this[_0xec04('0x4')]=_0x4188c5||undefined;this['idContact']=_0x14529d['id'];this[_0xec04('0x5')]=_0x32c5bb['name'];this['type']=_0x32c5bb['type'];this[_0xec04('0x6')]=_0xec04('0x5');this[_0xec04('0x7')]=![];this['membername']=_[_0xec04('0x2')](_0x14529d['Agent'])?undefined:_0x14529d[_0xec04('0x8')][_0xec04('0x9')];this[_0xec04('0xa')]=this['membername']?util[_0xec04('0xb')](_0xec04('0xc'),this[_0xec04('0xd')]):_0x340f2e||undefined;this[_0xec04('0xe')]=checkNameSurname(_0x14529d[_0xec04('0xf')][_0xec04('0x10')],_0x14529d[_0xec04('0xf')][_0xec04('0x11')],_0x14529d[_0xec04('0xf')]['lastName']);this[_0xec04('0x12')]=_0x14529d[_0xec04('0x12')]||![];this['calleridnum']=_0x14529d[_0xec04('0xf')]['phone'];this['scheduledat']=_0x14529d[_0xec04('0x13')];this[_0xec04('0x14')]=_0x14529d[_0xec04('0x14')]||0x0;this[_0xec04('0x15')]=_0x14529d['countcongestionretry']||0x0;this[_0xec04('0x16')]=_0x14529d['countnoanswerretry']||0x0;this[_0xec04('0x17')]=(_0x14529d[_0xec04('0x14')]||0x0)+(_0x14529d[_0xec04('0x15')]||0x0)+(_0x14529d[_0xec04('0x16')]||0x0)+(_0x14529d['countnosuchnumberretry']||0x0)+(_0x14529d['countdropretry']||0x0)+(_0x14529d[_0xec04('0x18')]||0x0)+(_0x14529d[_0xec04('0x19')]||0x0)+(_0x14529d[_0xec04('0x1a')]||0x0);this[_0xec04('0x1b')]=_0x14529d[_0xec04('0x1b')]||0x0;this[_0xec04('0x1c')]=_0x14529d[_0xec04('0x1c')]||0x0;this[_0xec04('0x18')]=_0x14529d[_0xec04('0x18')]||0x0;this[_0xec04('0x19')]=_0x14529d['countmachineretry']||0x0;this[_0xec04('0x1a')]=_0x14529d[_0xec04('0x1a')]||0x0;this[_0xec04('0x1d')]=_0x14529d[_0xec04('0x1d')];this[_0xec04('0x1e')]=_0x14529d['callbackuniqueid'];this['callbackat']=_0x14529d['callbackat'];this['recallme']=_0x14529d[_0xec04('0x1f')];this[_0xec04('0x20')]=_0x14529d[_0xec04('0x20')];this['ListId']=_0x14529d[_0xec04('0x21')];this['UserId']=_[_0xec04('0x2')](_0x14529d[_0xec04('0x8')])?_0x14529d[_0xec04('0x22')]:_0x14529d[_0xec04('0x8')]['id'];this[_0xec04('0x23')]=_0x14529d[_0xec04('0x23')];this[_0xec04('0x24')]='';this[_0xec04('0x25')]='';}Action['prototype'][_0xec04('0x26')]=function(){return util[_0xec04('0xb')](_0xec04('0x27'),this[_0xec04('0xe')],this[_0xec04('0x28')]);};module[_0xec04('0x29')]=Action; \ No newline at end of file +var _0xd43f=['lodash','moment','isNil','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent','name','channelAgent','format','calleridname','Contact','phone','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','number','util'];(function(_0x29aa99,_0x5c018a){var _0x33e005=function(_0x3d06d3){while(--_0x3d06d3){_0x29aa99['push'](_0x29aa99['shift']());}};_0x33e005(++_0x5c018a);}(_0xd43f,0xc7));var _0xfd43=function(_0x21cc45,_0x22eff2){_0x21cc45=_0x21cc45-0x0;var _0x169c76=_0xd43f[_0x21cc45];return _0x169c76;};'use strict';var util=require(_0xfd43('0x0'));var _=require(_0xfd43('0x1'));var moment=require(_0xfd43('0x2'));function checkNameSurname(_0x1b8020,_0x13abc7,_0x424ec2){var _0x91c3f3='';if(!_[_0xfd43('0x3')](_0x13abc7)&&'string'===typeof _0x13abc7){_0x91c3f3+=_0x13abc7;}if(!_['isNil'](_0x424ec2)&&'string'===typeof _0x424ec2){_0x91c3f3+='\x20'+_0x424ec2;}if(_0x91c3f3!==''){return _0x91c3f3;}return _0x1b8020;}function Action(_0x1eb6cf,_0x179bcf,_0x4ea968,_0x4394fe,_0x510a62){this[_0xfd43('0x4')]=_0x4ea968||undefined;this[_0xfd43('0x5')]=_0x1eb6cf['id'];this[_0xfd43('0x6')]=_0x179bcf['name'];this['type']=_0x179bcf[_0xfd43('0x7')];this[_0xfd43('0x8')]=_0xfd43('0x6');this[_0xfd43('0x9')]=![];this[_0xfd43('0xa')]=_[_0xfd43('0x3')](_0x1eb6cf[_0xfd43('0xb')])?undefined:_0x1eb6cf[_0xfd43('0xb')][_0xfd43('0xc')];this[_0xfd43('0xd')]=this[_0xfd43('0xa')]?util[_0xfd43('0xe')]('SIP/%s',this[_0xfd43('0xa')]):_0x4394fe||undefined;this[_0xfd43('0xf')]=checkNameSurname(_0x1eb6cf[_0xfd43('0x10')][_0xfd43('0x11')],_0x1eb6cf['Contact']['firstName'],_0x1eb6cf[_0xfd43('0x10')]['lastName']);this[_0xfd43('0x12')]=_0x1eb6cf[_0xfd43('0x12')]||![];this[_0xfd43('0x13')]=_0x1eb6cf[_0xfd43('0x10')][_0xfd43('0x11')];this['scheduledat']=_0x1eb6cf['scheduledat'];this[_0xfd43('0x14')]=_0x1eb6cf[_0xfd43('0x14')]||0x0;this[_0xfd43('0x15')]=_0x1eb6cf[_0xfd43('0x15')]||0x0;this[_0xfd43('0x16')]=_0x1eb6cf[_0xfd43('0x16')]||0x0;this[_0xfd43('0x17')]=(_0x1eb6cf['countbusyretry']||0x0)+(_0x1eb6cf['countcongestionretry']||0x0)+(_0x1eb6cf[_0xfd43('0x16')]||0x0)+(_0x1eb6cf['countnosuchnumberretry']||0x0)+(_0x1eb6cf['countdropretry']||0x0)+(_0x1eb6cf['countabandonedretry']||0x0)+(_0x1eb6cf[_0xfd43('0x18')]||0x0)+(_0x1eb6cf[_0xfd43('0x19')]||0x0);this[_0xfd43('0x1a')]=_0x1eb6cf['countnosuchnumberretry']||0x0;this[_0xfd43('0x1b')]=_0x1eb6cf[_0xfd43('0x1b')]||0x0;this[_0xfd43('0x1c')]=_0x1eb6cf[_0xfd43('0x1c')]||0x0;this[_0xfd43('0x18')]=_0x1eb6cf[_0xfd43('0x18')]||0x0;this['countagentrejectretry']=_0x1eb6cf[_0xfd43('0x19')]||0x0;this['callback']=_0x1eb6cf['callback'];this[_0xfd43('0x1d')]=_0x1eb6cf['callbackuniqueid'];this[_0xfd43('0x1e')]=_0x1eb6cf[_0xfd43('0x1e')];this['recallme']=_0x1eb6cf['recallme'];this[_0xfd43('0x1f')]=_0x1eb6cf[_0xfd43('0x1f')];this[_0xfd43('0x20')]=_0x1eb6cf[_0xfd43('0x20')];this[_0xfd43('0x21')]=_['isNil'](_0x1eb6cf[_0xfd43('0xb')])?_0x1eb6cf[_0xfd43('0x21')]:_0x1eb6cf[_0xfd43('0xb')]['id'];this[_0xfd43('0x22')]=_0x1eb6cf[_0xfd43('0x22')];this[_0xfd43('0x23')]='';this[_0xfd43('0x24')]='';}Action[_0xfd43('0x25')]['getCaller']=function(){return util[_0xfd43('0xe')](_0xfd43('0x26'),this['calleridname'],this[_0xfd43('0x27')]);};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 bfec3e3..8547491 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 _0xe706=['uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','BUSY','outboundBusyCallsDay','countglobal','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','cause-txt','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','starttime','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','responsetime','isFailure','response','idContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','dialstatus','variables','filterKey','keys','addVariable','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','bind','hanguprequest','syncDialEnd','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','pTalking','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','name','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','sendMessageOneNotActive','originated','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','logger2','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','totalGlobal','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','[syncHangup][talking][increment]'];(function(_0x4330ab,_0x141abd){var _0x1d764d=function(_0x187d84){while(--_0x187d84){_0x4330ab['push'](_0x4330ab['shift']());}};_0x1d764d(++_0x141abd);}(_0xe706,0xa3));var _0x6e70=function(_0x53b50e,_0xc49361){_0x53b50e=_0x53b50e-0x0;var _0x3f8625=_0xe706[_0x53b50e];return _0x3f8625;};'use strict';var util=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var uuid=require('uuid');var moment=require(_0x6e70('0x3'));var md5=require(_0x6e70('0x4'));var Redis=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var loggerAction=require(_0x6e70('0x7'))(_0x6e70('0x9'));var ami=require(_0x6e70('0xa'));var rpcDb=require(_0x6e70('0xb'));var Action=require(_0x6e70('0xc'));var ut=require(_0x6e70('0xd'));config[_0x6e70('0xe')]=_[_0x6e70('0xf')](config[_0x6e70('0xe')],{'host':_0x6e70('0x10'),'port':0x18eb});var io=require(_0x6e70('0x11'))(new Redis(config[_0x6e70('0xe')]));var Sequence=function(){};Sequence[_0x6e70('0x12')][_0x6e70('0x13')]=function(_0x743eb5){this[_0x6e70('0x14')]=this[_0x6e70('0x14')]?this[_0x6e70('0x14')]['finally'](_0x743eb5):_0x743eb5();};function Preview(_0x47f6b2){this[_0x6e70('0x15')]=new Sequence();this[_0x6e70('0x16')]=_0x47f6b2[_0x6e70('0x17')];this[_0x6e70('0x18')]=_0x47f6b2[_0x6e70('0x18')];this[_0x6e70('0x19')]={};this[_0x6e70('0x1a')]=_0x47f6b2[_0x6e70('0x1a')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x6e70('0x1b')](this));ami['on']('hangup',this['syncHangup'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1c'),this['syncHangupRequest'][_0x6e70('0x1b')](this));ami['on']('dialend',this[_0x6e70('0x1d')][_0x6e70('0x1b')](this));ami['on']('newexten',this['syncNewExten'][_0x6e70('0x1b')](this));ami['on']('varset',this[_0x6e70('0x1e')][_0x6e70('0x1b')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x6e70('0x1b')](this));ami['on'](_0x6e70('0x1f'),this[_0x6e70('0x20')][_0x6e70('0x1b')](this));this[_0x6e70('0x21')](this[_0x6e70('0x16')]);}function emit(_0x1b2453,_0x44a49f,_0x29326f){io['to'](_0x1b2453)[_0x6e70('0x22')](_0x44a49f,_0x29326f);}function emitCampaignPreview(_0x4a0cfe){if(_0x4a0cfe[_0x6e70('0x23')]===_0x6e70('0x24')){var _0x27b294={'id':_0x4a0cfe['id'],'name':_0x4a0cfe['name'],'strategy':_0x4a0cfe[_0x6e70('0x25')],'answered':_0x4a0cfe[_0x6e70('0x26')],'available':_0x4a0cfe[_0x6e70('0x27')],'loggedIn':_0x4a0cfe['loggedIn'],'pTalking':_0x4a0cfe[_0x6e70('0x28')],'sumBillable':_0x4a0cfe['sumBillable'],'sumDuration':_0x4a0cfe['sumDuration'],'sumHoldTime':_0x4a0cfe['sumHoldTime']||0x0,'talking':_0x4a0cfe[_0x6e70('0x29')],'total':_0x4a0cfe[_0x6e70('0x2a')],'type':_0x4a0cfe['type'],'unmanaged':_0x4a0cfe[_0x6e70('0x2b')],'abandoned':_0x4a0cfe[_0x6e70('0x2c')],'waiting':_0x4a0cfe['waiting'],'loggedInDb':_0x4a0cfe[_0x6e70('0x2d')],'dialActive':_0x4a0cfe[_0x6e70('0x2e')],'dialMethod':_0x4a0cfe[_0x6e70('0x2f')],'dialOriginateCallerIdName':_0x4a0cfe['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4a0cfe['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4a0cfe[_0x6e70('0x30')],'dialPrefix':_0x4a0cfe[_0x6e70('0x31')],'outboundAnswerAgiCallsDay':_0x4a0cfe[_0x6e70('0x32')],'outboundAnswerCallsDay':_0x4a0cfe[_0x6e70('0x33')],'outboundBlacklistCallsDay':_0x4a0cfe[_0x6e70('0x34')],'outboundBusyCallsDay':_0x4a0cfe['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4a0cfe[_0x6e70('0x35')],'outboundDropCallsDayACS':_0x4a0cfe[_0x6e70('0x36')],'outboundDropCallsDayCallersExit':_0x4a0cfe[_0x6e70('0x37')],'outboundDropCallsDayTimeout':_0x4a0cfe[_0x6e70('0x38')],'outboundNoAnswerCallsDay':_0x4a0cfe[_0x6e70('0x39')],'outboundNoSuchCallsDay':_0x4a0cfe[_0x6e70('0x3a')],'outboundOriginateFailureCallsDay':_0x4a0cfe[_0x6e70('0x3b')],'outboundReCallsDay':_0x4a0cfe[_0x6e70('0x3c')],'outboundRejectCallsDay':_0x4a0cfe[_0x6e70('0x3d')],'outboundUnknownCallsDay':_0x4a0cfe[_0x6e70('0x3e')],'outboundAbandonedCallsDay':_0x4a0cfe['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x4a0cfe[_0x6e70('0x3f')],'predictiveIntervalAvgHoldtime':_0x4a0cfe['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4a0cfe[_0x6e70('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x4a0cfe['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4a0cfe[_0x6e70('0x41')],'predictiveIntervalErlangCalls':_0x4a0cfe[_0x6e70('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x4a0cfe[_0x6e70('0x43')],'predictiveIntervalHitRate':_0x4a0cfe['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4a0cfe[_0x6e70('0x44')],'predictiveIntervalPauses':_0x4a0cfe[_0x6e70('0x45')],'predictiveIntervalAvailable':_0x4a0cfe['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4a0cfe[_0x6e70('0x46')],'message':_0x4a0cfe[_0x6e70('0x47')],'originated':_0x4a0cfe['originated'],'erlangCalls':_0x4a0cfe[_0x6e70('0x48')],'erlangCallToSecond':_0x4a0cfe[_0x6e70('0x49')],'erlangAbandonmentRate':_0x4a0cfe[_0x6e70('0x4a')],'erlangBusyFactor':_0x4a0cfe[_0x6e70('0x4b')],'startPredictive':_0x4a0cfe[_0x6e70('0x4c')],'startProgressive':_0x4a0cfe[_0x6e70('0x4d')]};if(_0x4a0cfe[_0x6e70('0x4e')]){_0x27b294[_0x6e70('0x4e')]={'id':_0x4a0cfe[_0x6e70('0x4e')]['id'],'name':_0x4a0cfe[_0x6e70('0x4e')]['name'],'active':_0x4a0cfe[_0x6e70('0x4e')]['active'],'callerid':_0x4a0cfe[_0x6e70('0x4e')][_0x6e70('0x4f')]};}if(_0x4a0cfe[_0x6e70('0x50')]){_0x27b294[_0x6e70('0x50')]={'id':_0x4a0cfe[_0x6e70('0x50')]['id'],'name':_0x4a0cfe[_0x6e70('0x50')][_0x6e70('0x51')]};}var _0xdd0bee=md5(JSON[_0x6e70('0x52')](_0x27b294));if(_0x4a0cfe[_0x6e70('0x4')]!==_0xdd0bee){_0x4a0cfe[_0x6e70('0x4')]=_0xdd0bee;emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x27b294['name']),'voice_queue:save',_0x27b294);}}}function emitVoiceQueueChannelRemove(_0x5424eb){logger[_0x6e70('0x55')](_0x6e70('0x56'),JSON[_0x6e70('0x52')](_0x5424eb));emit(util[_0x6e70('0x53')](_0x6e70('0x54'),_0x5424eb[_0x6e70('0x51')]),'voice_queue_channel:remove',_0x5424eb);}function notSendMessagesQueue(_0x3b508c){if(_0x3b508c[_0x6e70('0x57')]){if(_0x3b508c[_0x6e70('0x58')]===0x0&&_0x3b508c[_0x6e70('0x28')]===0x0){_0x3b508c[_0x6e70('0x57')]=![];_0x3b508c[_0x6e70('0x27')]=0x0;_0x3b508c[_0x6e70('0x59')]=0x0;_0x3b508c[_0x6e70('0x47')]='NOT_ACTIVE';ut[_0x6e70('0x5a')](_0x6e70('0x5b'),_0x3b508c[_0x6e70('0x51')]+_0x6e70('0x5c'));}else{_0x3b508c[_0x6e70('0x47')]=_0x6e70('0x5d');ut[_0x6e70('0x5a')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x3b508c['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x3b508c);}}Preview[_0x6e70('0x12')][_0x6e70('0x21')]=function(){var _0x83847b=this;setInterval(function(){_0x83847b[_0x6e70('0x5e')]();},0x7cf);};Preview[_0x6e70('0x12')]['syncCampaigns']=function(){var _0x225d44=this[_0x6e70('0x16')];this[_0x6e70('0x5f')]+=0x1;for(var _0x52b197 in _0x225d44){if(_0x225d44['hasOwnProperty'](_0x52b197)&&(_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x8')||_0x225d44[_0x52b197]['dialMethod']===_0x6e70('0x60'))&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(this[_0x6e70('0x5f')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x6e70('0x61')]();}}if(_0x225d44['hasOwnProperty'](_0x52b197)&&_0x225d44[_0x52b197][_0x6e70('0x2f')]===_0x6e70('0x8')&&_0x225d44[_0x52b197][_0x6e70('0x23')]===_0x6e70('0x24')){if(_0x225d44[_0x52b197]['dialActive']){this[_0x6e70('0x62')](_0x225d44[_0x52b197]);this[_0x6e70('0x63')](_0x225d44[_0x52b197]);}else{notSendMessagesQueue(_0x225d44[_0x52b197]);}}}};Preview[_0x6e70('0x12')][_0x6e70('0x64')]=function(_0x8f243d){var _0x3fcb2d=this;this[_0x6e70('0x15')]['enqueue'](function(){if(!_[_0x6e70('0x65')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d])){loggerAction[_0x6e70('0x55')](_0x6e70('0x66'),_0x8f243d,_0x6e70('0x67'),_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')],'originated:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d['campaignsPreview'][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]]['originated']),'pTalking:\x20',JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']]['pTalking']),JSON[_0x6e70('0x52')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x69')]),JSON[_0x6e70('0x52')](_[_0x6e70('0x6a')](_0x3fcb2d[_0x6e70('0x19')][_0x8f243d],['contactId',_0x6e70('0x6b'),_0x6e70('0x6c'),_0x6e70('0x6d')])));return ami[_0x6e70('0x6e')]({'action':_0x6e70('0x6f'),'channel':_0x3fcb2d['actions'][_0x8f243d]['channel']})[_0x6e70('0x70')](function(_0x2e3ea6){if(_0x2e3ea6[_0x6e70('0x47')]===_0x6e70('0x71')){setTimeout(function(){if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]){ut['updateOriginated'](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));if(_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['dialAnswer']===!![]){ut[_0x6e70('0x73')](_0x3fcb2d[_0x6e70('0x16')][_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]],_0x6e70('0x72'));ut[_0x6e70('0x74')]('[Dialer][checkChannel][pTalking][Preview]'+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d][_0x6e70('0x68')]);}ut['loggerError'](_0x6e70('0x75')+_0x8f243d,_0x3fcb2d[_0x6e70('0x19')][_0x8f243d]['queue']);delete _0x3fcb2d[_0x6e70('0x19')][_0x8f243d];}},0x2328);}});}});};Preview[_0x6e70('0x12')][_0x6e70('0x61')]=function(){var _0x46d536=this;loggerAction[_0x6e70('0x55')]('[action]',_[_0x6e70('0x76')](this[_0x6e70('0x19')]));for(var _0x10d655 in this[_0x6e70('0x19')]){if(_0x46d536[_0x6e70('0x19')][_0x6e70('0x77')](_0x10d655)){_0x46d536[_0x6e70('0x64')](_0x10d655);}}};Preview[_0x6e70('0x12')][_0x6e70('0x63')]=function(_0x344676){var _0x13dd17=this;rpcDb[_0x6e70('0x78')](_0x344676['id'],ut[_0x6e70('0x79')](this[_0x6e70('0x1a')]))[_0x6e70('0x7a')](function(_0x2240a1){if(!_[_0x6e70('0x65')](_0x2240a1)){for(var _0x4329a6=0x0;_0x4329a6<_0x2240a1[_0x6e70('0x7b')];_0x4329a6+=0x1){if(ut[_0x6e70('0x7c')](_0x2240a1[_0x4329a6]['scheduledat'])<_0x344676[_0x6e70('0x7d')]*0x3c){if(_0x2240a1[_0x4329a6][_0x6e70('0x7e')]&&!_0x2240a1[_0x4329a6][_0x6e70('0x7e')][_0x6e70('0x7f')]){_0x13dd17[_0x6e70('0x80')](_0x2240a1[_0x4329a6]['id'])[_0x6e70('0x7a')](ut['logger2'](_0x6e70('0x81')))[_0x6e70('0x70')](ut['logger2'](_0x6e70('0x81')));}else{rpcDb[_0x6e70('0x82')](_0x2240a1[_0x4329a6]['id']);}}else{var _0x459a30=new Action(_0x2240a1[_0x4329a6],_0x344676);_0x459a30['starttime']=moment()['format'](_0x6e70('0x83'));_0x344676[_0x6e70('0x3c')]+=0x1;ut[_0x6e70('0x84')](_0x459a30,0x17,_0x6e70('0x85'));if(_0x344676[_0x6e70('0x86')]){rpcDb[_0x6e70('0x87')](ut[_0x6e70('0x88')](_0x2240a1[_0x4329a6]));rpcDb['createCustomerHistory'](_0x459a30,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x6e70('0x84')](_0x459a30,0x16,_0x6e70('0x89'));rpcDb[_0x6e70('0x8a')](_0x459a30,_0x6e70('0x8b'));rpcDb['createCustomerFinal'](_0x459a30,'[HistoryRecallClose]');}}}}})[_0x6e70('0x70')](ut[_0x6e70('0x8c')]('[getContactRecallMe]'));};Preview['prototype'][_0x6e70('0x62')]=function(_0x47fbed){_0x47fbed[_0x6e70('0x57')]=!![];if(ut[_0x6e70('0x8d')](_0x47fbed[_0x6e70('0x8e')])){_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x8f');}else if(!ut[_0x6e70('0x90')](_0x47fbed[_0x6e70('0x2e')])){_0x47fbed[_0x6e70('0x47')]='NOT_ACTIVE';}else if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x4e')])){if(!this[_0x6e70('0x91')](_0x47fbed[_0x6e70('0x92')])){_0x47fbed[_0x6e70('0x47')]='TRUNK_IS_NOT_REACHABLE';}else{_0x47fbed['message']='ACTIVE';}}else{_0x47fbed[_0x6e70('0x47')]=_0x6e70('0x93');}emitCampaignPreview(_0x47fbed);};Preview[_0x6e70('0x12')]['callProgressDetectingCustomer']=function(_0x58cf1c,_0x2fc2a2,_0x3dae08){var _0x3c2830=this;var _0x195166=this[_0x6e70('0x19')][_0x2fc2a2];var _0x32b884=this['campaignsPreview'][_0x195166[_0x6e70('0x68')]];var _0x3f5896;if(_0x32b884){switch(_0x3dae08){case'1':_0x32b884[_0x6e70('0x3a')]+=0x1;_0x195166[_0x6e70('0x94')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x0,'NoSuchNumber');ami[_0x6e70('0x22')](_0x6e70('0x96'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0x98')));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0x99'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0x9e'));}else{if(_0x195166[_0x6e70('0x94')]>=_0x32b884[_0x6e70('0x9f')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0x9e'));}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0x94'),_0x32b884[_0x6e70('0xa1')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xa4'):var _0x25e685=moment()[_0x6e70('0x53')](_0x6e70('0x83'));_0x195166['responsetime']=_0x25e685;_0x195166['answertime']=_0x25e685;_0x195166[_0x6e70('0x69')]=!![];_0x32b884[_0x6e70('0x28')]+=0x1;logger['info'](_0x6e70('0xa5'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);ami[_0x6e70('0x22')](_0x6e70('0xa9'),ut[_0x6e70('0x97')](_0x195166,_0x6e70('0xaa'),this[_0x6e70('0x16')][_0x195166[_0x6e70('0x68')]]));if(_0x32b884[_0x6e70('0xab')]){ami[_0x6e70('0x22')]('custom:agentConnectPreview',ut['buildAcw'](_0x195166));}break;case'16':ami[_0x6e70('0x22')]('custom:agentcomplete',ut[_0x6e70('0x97')](_0x195166,'complete',this['campaignsPreview'][_0x195166[_0x6e70('0x68')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x195166,'complete'));_0x32b884[_0x6e70('0x33')]+=0x1;_0x32b884[_0x6e70('0x2a')]+=0x1;_0x32b884[_0x6e70('0x26')]+=0x1;ut['decrementTalkink'](_0x32b884,'[16]');_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xad'));rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xae'));rpcDb[_0x6e70('0xaf')](_0x195166);_0x32b884[_0x6e70('0xb0')]+=_0x195166['talktime'];_0x32b884[_0x6e70('0xb1')]+=_0x195166[_0x6e70('0xb2')];logger[_0x6e70('0x55')]('[syncHangup][talking][decrement]',_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884[_0x6e70('0x51')],_0x6e70('0xa8'),_0x32b884[_0x6e70('0x28')]);delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];break;case _0x6e70('0xb3'):_0x32b884[_0x6e70('0xb4')]+=0x1;_0x195166['countbusyretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0x5,_0x6e70('0xb6'));ami[_0x6e70('0x22')]('custom:agentbusy',ut['buildObj'](_0x195166,_0x6e70('0xb7')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xb8'));if(ut['totalGlobal'](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xb9'));}else{if(_0x195166[_0x6e70('0xba')]>=_0x32b884[_0x6e70('0xbb')]){rpcDb['createCustomerFinal'](_0x195166,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x6e70('0xa0')](ut['scheduledAt'](_0x195166,_0x6e70('0xba'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case'NOANSWER':_0x32b884[_0x6e70('0x39')]+=0x1;_0x195166['countnoanswerretry']+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x3,_0x6e70('0xbe'));ami[_0x6e70('0x22')](_0x6e70('0xbf'),ut[_0x6e70('0x97')](_0x195166,'noanswer'));rpcDb[_0x6e70('0x8a')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884['dialGlobalMaxRetry']){_0x3f5896=ut['cloneAction'](_0x195166,0xf,'Global');rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xc0'));}else{if(_0x195166[_0x6e70('0xc1')]>=_0x32b884[_0x6e70('0xc2')]){rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countnoanswerretry',_0x32b884[_0x6e70('0xc4')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case'CONGESTION':_0x32b884['outboundCongestionCallsDay']+=0x1;_0x195166[_0x6e70('0xc5')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x8,_0x6e70('0xc6'));ami[_0x6e70('0x22')](_0x6e70('0xc7'),ut['buildObj'](_0x195166,_0x6e70('0xc8')));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xc9'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xca'));}else{if(_0x195166['countcongestionretry']>=_0x32b884[_0x6e70('0xcb')]){rpcDb['createCustomerFinal'](_0x195166,_0x6e70('0xc9'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xc5'),_0x32b884[_0x6e70('0xbc')]),_0x195166[_0x6e70('0xa2')],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xcc'):_0x32b884[_0x6e70('0x3d')]+=0x1;_0x195166[_0x6e70('0xcd')]+=0x1;_0x195166['countglobal']=ut[_0x6e70('0x95')](_0x195166);ut[_0x6e70('0x84')](_0x195166,0x14,_0x6e70('0xce'));ami[_0x6e70('0x22')](_0x6e70('0xcf'),ut['buildObj'](_0x195166,'agentreject'));rpcDb['createCustomerHistory'](_0x195166,_0x6e70('0xd0'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0x14,_0x6e70('0xce'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xd1'));}else{if(_0x195166[_0x6e70('0xcd')]>=_0x32b884[_0x6e70('0xd2')]){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd1'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,_0x6e70('0xcd'),_0x32b884[_0x6e70('0xd3')]),_0x195166['unlockAgent'],_0x195166[_0x6e70('0xbd')]);}}break;case _0x6e70('0xd4'):_0x32b884[_0x6e70('0xd5')]+=0x1;_0x195166[_0x6e70('0xd6')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut[_0x6e70('0x95')](_0x195166);ut['logCustomer'](_0x195166,0xb,'Abandoned');rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xd7'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x195166[_0x6e70('0xd8')]>=_0x32b884['dialAbandonedMaxRety']){rpcDb[_0x6e70('0x9d')](_0x195166,_0x6e70('0xd7'));}else{rpcDb[_0x6e70('0xa0')](ut[_0x6e70('0xc3')](_0x195166,'countabandonedretry',_0x32b884[_0x6e70('0xd9')]),_0x195166[_0x6e70('0xa2')],_0x195166['activeContact']);}}break;default:if(_0x195166[_0x6e70('0x69')]){ut['decrementTalkink'](_0x32b884,_0x6e70('0xda'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x32b884[_0x6e70('0x51')],_0x58cf1c);}_0x32b884[_0x6e70('0x3e')]+=0x1;_0x195166[_0x6e70('0xb5')]=ut['totalGlobal'](_0x195166);ut[_0x6e70('0x84')](_0x195166,0xc,_0x58cf1c[_0x6e70('0xdb')]||_0x58cf1c['dialstatus']);rpcDb[_0x6e70('0x8a')](_0x195166,_0x6e70('0xdc'));if(ut[_0x6e70('0x95')](_0x195166)>=_0x32b884[_0x6e70('0x9a')]){_0x3f5896=ut[_0x6e70('0x9b')](_0x195166,0xf,_0x6e70('0x9c'));rpcDb[_0x6e70('0x9d')](_0x3f5896,_0x6e70('0xdd'));}else{rpcDb[_0x6e70('0x9d')](_0x195166,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x58cf1c[_0x6e70('0xa3')]];}if(!(_0x195166['dialAnswer']&&_0x3dae08==='16')){ut[_0x6e70('0xde')](_0x32b884,_0x6e70('0xdf'));logger['info'](_0x6e70('0xe0'),_0x195166[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x32b884['name'],_0x6e70('0xe1'),_0x32b884[_0x6e70('0x58')]);}if(_0x3dae08!==_0x6e70('0xa4')){delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xa3')]];delete this[_0x6e70('0x19')][_0x58cf1c[_0x6e70('0xe2')]];}}};Preview[_0x6e70('0x12')][_0x6e70('0xe3')]=function(_0x33a93c,_0x273ed6,_0x41b70a){if(_[_0x6e70('0xe4')](_0x273ed6)&&'object'!==typeof _0x273ed6){return;}if(_[_0x6e70('0xe4')](_0x41b70a)&&_0x6e70('0xe5')!==typeof _0x41b70a){return;}switch(_0x41b70a[_0x6e70('0xe6')]){case'0':ut[_0x6e70('0xe7')](_0x33a93c,0x0,_0x6e70('0xe8'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xe9'));break;case'3':ut[_0x6e70('0xe7')](_0x33a93c,0x3,_0x6e70('0xbe'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xea'));break;case'5':ut['logAgent'](_0x33a93c,0x5,'Busy');rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xec'));break;case'8':ut[_0x6e70('0xe7')](_0x33a93c,0x8,_0x6e70('0xc6'));rpcDb['createAgentHistory'](_0x33a93c,_0x6e70('0xed'));break;case'22':ut[_0x6e70('0xe7')](_0x33a93c,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x33a93c,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x6e70('0xe7')](_0x33a93c,0xc,_0x41b70a[_0x6e70('0xe6')]);rpcDb[_0x6e70('0xeb')](_0x33a93c,_0x6e70('0xed'));}ut[_0x6e70('0xde')](_0x273ed6,_0x6e70('0xee'));logger[_0x6e70('0x55')]('[originated][decrement][callProgressDetectingAgent]',_0x33a93c[_0x6e70('0xa6')],_0x6e70('0xa7'),_0x273ed6[_0x6e70('0x51')],_0x6e70('0xe1'),_0x273ed6[_0x6e70('0x58')]);delete this[_0x6e70('0x19')][_0x33a93c[_0x6e70('0xa6')]];};Preview[_0x6e70('0x12')][_0x6e70('0xef')]=function(_0x541c25,_0x1a2a44,_0x321da8,_0x5b4a66,_0x2a1205){var _0x1f1b96=this;return new BPromise(function(_0x397289,_0x551c7e){if(_[_0x6e70('0x65')](_0x1a2a44)||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')])||_[_0x6e70('0x65')](_0x1a2a44[_0x6e70('0xf0')][_0x6e70('0xf1')])||_['isNil'](_0x1a2a44['VoiceQueueId'])){_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0xf2'),_0x5b4a66,_0x2a1205));return;}var _0xc93d60=uuid['v4']();var _0x432794=_0x1f1b96[_0x6e70('0x16')][_0x1a2a44[_0x6e70('0x67')]['name']];var _0x3df7bd=_0x321da8?_0x1f1b96[_0x6e70('0x1a')][_0x321da8]['id']:undefined;_0x1f1b96[_0x6e70('0x19')][_0xc93d60]=new Action(_0x1a2a44,_0x432794,_0xc93d60,_0x321da8,_0x3df7bd);var _0x154697=_0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x154697[_0x6e70('0xa2')]=_0x5b4a66;_0x154697[_0x6e70('0xbd')]=_0x2a1205;_0x154697[_0x6e70('0xf3')]=_0x321da8;if(_[_0x6e70('0xf4')](_0x541c25)){_0x1f1b96[_0x6e70('0xf5')](_0x154697,_0x432794,_0x1a2a44,_0x321da8)[_0x6e70('0x7a')](function(_0x8b237a){logger[_0x6e70('0x55')](_0x6e70('0xf6'),_0x6e70('0xf7')+_0x154697[_0x6e70('0x68')]+_0x6e70('0xf8')+_0x154697['idContact'],JSON['stringify'](_0x8b237a));ami[_0x6e70('0x22')](_0x6e70('0xf9'),ut[_0x6e70('0x97')](_0x154697,_0x6e70('0xfa'),_0x1f1b96[_0x6e70('0x16')][_0x154697[_0x6e70('0x68')]]));_0x397289(ut['message'](_0x6e70('0xfb')));})['catch'](function(_0x2f05b2){ut['logger'](_0x6e70('0xfc'),_0x2f05b2);_0x551c7e(ut['message'](_0x6e70('0xfd'),_0x5b4a66,_0x2a1205));});}else{_0x432794[_0x6e70('0x34')]+=0x1;ut[_0x6e70('0xfe')](_0x154697);rpcDb['createHistory'](_0x154697,_0x6e70('0xff'));delete _0x1f1b96[_0x6e70('0x19')][_0xc93d60];_0x551c7e(ut[_0x6e70('0x47')](_0x6e70('0x100'),_0x5b4a66,_0x2a1205));}});};Preview[_0x6e70('0x12')][_0x6e70('0x91')]=function(_0x1e8bfd){return!_['isNil'](_0x1e8bfd)&&!_[_0x6e70('0x65')](_0x1e8bfd[_0x6e70('0x51')])&&!_['isNil'](_0x1e8bfd[_0x6e70('0x101')])&&_0x1e8bfd[_0x6e70('0x101')]&&!_['isNil'](this['trunks'][util[_0x6e70('0x53')]('SIP/%s',_0x1e8bfd[_0x6e70('0x51')])])&&!_[_0x6e70('0x65')](this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')])&&(this[_0x6e70('0x18')][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x103')||this['trunks'][util[_0x6e70('0x53')](_0x6e70('0x102'),_0x1e8bfd[_0x6e70('0x51')])][_0x6e70('0x6f')]===_0x6e70('0x104'));};Preview[_0x6e70('0x12')][_0x6e70('0x80')]=function(_0xac161,_0x44ebd6){var _0x568799=this;return new BPromise(function(_0x4bdcc,_0xa512d1){_0x568799[_0x6e70('0x105')](_0xac161,_0x44ebd6)['then'](function(_0x88522){_0x4bdcc(_[_0x6e70('0x6a')](_0x88522,[_0x6e70('0x47')]));})[_0x6e70('0x70')](function(_0x4af0bc){if(_0x4af0bc['unlock']){rpcDb[_0x6e70('0x106')](_0xac161);}if(_0x4af0bc['active']){rpcDb['disableContact'](_0xac161);}_0xa512d1(_[_0x6e70('0x6a')](_0x4af0bc,[_0x6e70('0x47')]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x105')]=function(_0x3bc12b,_0x22827){var _0xf7e813=this;return new BPromise(function(_0x3fef9d,_0x20fe70){var _0x41df1b,_0x484806;rpcDb[_0x6e70('0x107')](_0x3bc12b)[_0x6e70('0x7a')](function(_0xad1b46){if(!_[_0x6e70('0x65')](_0xad1b46[0x0])){_0x484806=_0xad1b46[0x0][_0x6e70('0x108')]?![]:!![];_0x41df1b=_0xad1b46[0x0][_0x6e70('0x108')]?!![]:![];_0x41df1b=_0x22827?!![]:_0x41df1b;}var _0x2033fa=_0xf7e813[_0x6e70('0x109')](_0xad1b46);if(_0x2033fa[_0x6e70('0x10a')]){rpcDb[_0x6e70('0x10b')](_['pick'](_0xad1b46[0x0],['VoiceQueueId','Contact.phone']))['then'](function(_0x2198fa){_0xf7e813[_0x6e70('0xef')](_0x2198fa,_0xad1b46[0x0],_0x22827,_0x484806,_0x41df1b)[_0x6e70('0x7a')](function(_0x596bbd){_0x3fef9d(_0x596bbd);})[_0x6e70('0x70')](function(_0x5c8b78){_0x20fe70(_0x5c8b78);});})[_0x6e70('0x70')](function(_0x59e8bf){ut['logger'](_0x6e70('0x10c'),_0x59e8bf);_0x20fe70(ut[_0x6e70('0x47')](_0x6e70('0x10d'),_0x484806,_0x41df1b));});}else{_0x20fe70(ut[_0x6e70('0x47')](_0x2033fa[_0x6e70('0x47')],_0x484806,_0x41df1b));}})[_0x6e70('0x70')](function(_0x2cfb23){ut['logger'](_0x6e70('0x10e'),_0x2cfb23);_0x20fe70(ut[_0x6e70('0x47')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x6e70('0x12')][_0x6e70('0x109')]=function(_0x151c30){if(_['isNil'](_0x151c30)||_[_0x6e70('0xf4')](_0x151c30)||!_[_0x6e70('0x65')](_0x151c30[0x0]['Agent'])&&_['isNil'](_0x151c30[0x0][_0x6e70('0x7e')][_0x6e70('0x51')])){ut[_0x6e70('0x5a')](_0x6e70('0x10f'),_0x151c30);return{'isValid':![],'message':_0x6e70('0x110')};}var _0x48556b=this['campaignsPreview'][_0x151c30[0x0][_0x6e70('0x67')][_0x6e70('0x51')]];_0x48556b[_0x6e70('0x47')]='ACTIVE';if(_[_0x6e70('0x65')](_0x48556b)){ut[_0x6e70('0x5a')](_0x6e70('0x111'),_0x48556b);return{'isValid':![],'message':_0x6e70('0x112')};}if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x4e')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x6e70('0x114')+_0x48556b[_0x6e70('0x51')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x6e70('0x91')](_0x48556b[_0x6e70('0x92')])){ut[_0x6e70('0x5a')](_0x6e70('0x113'),_0x48556b['name']+_0x6e70('0x115'));return{'isValid':![],'message':_0x6e70('0x116')};}}if(!ut[_0x6e70('0x90')](_0x48556b['dialActive'])){ut[_0x6e70('0x5a')](_0x6e70('0x117'),_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x48556b[_0x6e70('0x51')]+_0x6e70('0x118')};}return{'isValid':!![],'message':_0x6e70('0x119')};};Preview[_0x6e70('0x12')][_0x6e70('0xf5')]=function(_0x24ebf4,_0xa08f5,_0x28bc96,_0x2eb49f){var _0x46a4c2=this;return new BPromise(function(_0x4e0788,_0x53f283){var _0x11b784=_0x24ebf4[_0x6e70('0xa6')];var _0x323887=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?util[_0x6e70('0x53')](_0x6e70('0x11a'),_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x31')])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')]['phone'][_0x6e70('0x11d')](_0xa08f5[_0x6e70('0x11c')]):_0x28bc96[_0x6e70('0xf0')]['phone']):util[_0x6e70('0x53')](_0x6e70('0x11a'),_[_0x6e70('0x65')](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x51')]:_0xa08f5['TrunkBackup'][_0x6e70('0x51')],_[_0x6e70('0x65')](_0xa08f5['dialPrefix'])?'':_0xa08f5[_0x6e70('0x31')][_0x6e70('0x11b')]()||'',_0xa08f5[_0x6e70('0x11c')]>0x0?_0x28bc96[_0x6e70('0xf0')][_0x6e70('0xf1')]['substring'](_0xa08f5['dialCutDigit']):_0x28bc96[_0x6e70('0xf0')]['phone']);var _0x337b18=_0x46a4c2[_0x6e70('0x91')](_0xa08f5[_0x6e70('0x4e')])?ut[_0x6e70('0x11e')](_0xa08f5[_0x6e70('0x4e')]['callerid'],_0xa08f5[_0x6e70('0x11f')],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5[_0x6e70('0x122')],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]):ut['getCallerId'](_['isNil'](_0xa08f5[_0x6e70('0x92')])?_0xa08f5[_0x6e70('0x4e')][_0x6e70('0x4f')]:_0xa08f5[_0x6e70('0x92')]['callerid'],_0xa08f5['dialOriginateCallerIdName'],_0xa08f5[_0x6e70('0x120')]>0x0?ut[_0x6e70('0x121')](_0xa08f5['dialOriginateCallerIdNumber'],_0xa08f5[_0x6e70('0x120')]):_0xa08f5[_0x6e70('0x122')]);if(_0x337b18){_0x24ebf4[_0x6e70('0x123')]=ut['extractCalleridName'](_0x337b18);_0x24ebf4[_0x6e70('0x124')]=ut[_0x6e70('0x125')](_0x337b18);}var _0x4b28d2=ut[_0x6e70('0x126')](_0xa08f5,_0x28bc96,_0x323887,_0x337b18,_0x11b784,_0x24ebf4);_['merge'](_0x24ebf4,ut[_0x6e70('0x127')](_0x4b28d2));_0x24ebf4[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x6e70('0x6e')](ut[_0x6e70('0x129')](_0x24ebf4,_0xa08f5,_0x4b28d2,_0x24ebf4[_0x6e70('0xbd')],_0x2eb49f))[_0x6e70('0x7a')](function(_0x1da95e){_0xa08f5['originated']+=0x1;logger[_0x6e70('0x55')]('[originated][increment]',_0x11b784,_0x6e70('0xa7'),_0xa08f5[_0x6e70('0x51')],_0x6e70('0xe1'),_0xa08f5[_0x6e70('0x58')]);_0x4e0788(_0x1da95e);})[_0x6e70('0x70')](function(_0x26a56c){ut[_0x6e70('0xe7')](_0x24ebf4,0xe,_0x6e70('0x12a'));rpcDb['createAgentHistory'](_0x24ebf4,_0x6e70('0x12b'));_0x53f283(_0x26a56c);});});};Preview['prototype'][_0x6e70('0x12c')]=function(_0x35e889){if(this[_0x6e70('0x19')][_0x35e889[_0x6e70('0xa3')]]){this['actions'][_0x35e889[_0x6e70('0xa3')]]['channel']=_0x35e889['channel'];}};Preview[_0x6e70('0x12')]['syncOriginateResponse']=function(_0x114df8){var _0x19cc83=this;var _0x14bdfb=this['actions'][_0x114df8['actionid']];if(_0x14bdfb){if(_0x14bdfb[_0x6e70('0xf3')]&&this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]){ut[_0x6e70('0x12d')](_0x14bdfb,this[_0x6e70('0x1a')][_0x14bdfb[_0x6e70('0xf3')]]['name'],this[_0x6e70('0x1a')][_0x14bdfb['lookAgent']]['id']);}var _0x5771e5=_['clone'](_0x14bdfb);_0x5771e5[_0x6e70('0x12e')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e479d=_0x19cc83['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]];if(ut[_0x6e70('0x12f')](_0x114df8[_0x6e70('0x130')])){if(_0x14bdfb[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x14bdfb[_0x6e70('0x131')]);}if(_0x14bdfb[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x14bdfb[_0x6e70('0x131')]);}ami[_0x6e70('0x22')](_0x6e70('0x132'),ut[_0x6e70('0x97')](_0x14bdfb,'rejected',this['campaignsPreview'][_0x14bdfb[_0x6e70('0x68')]]));this[_0x6e70('0xe3')](_0x5771e5,_0x1e479d,_0x114df8);}else{_0x14bdfb[_0x6e70('0x128')]=moment()[_0x6e70('0x53')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x5771e5,0x4,_0x6e70('0xac'));rpcDb[_0x6e70('0xeb')](_0x5771e5,_0x6e70('0x133'));}}};Preview[_0x6e70('0x12')]['syncHangup']=function(_0x25b5ce){var _0x4a7ce3=this;var _0x44799d=this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]];var _0x4605e5;if(_0x44799d){_0x4605e5=this[_0x6e70('0x16')][_0x44799d['queue']];logger[_0x6e70('0x55')](_0x6e70('0x134'),_0x25b5ce[_0x6e70('0xa3')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);}if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]&&_0x25b5ce[_0x6e70('0xa3')]!==_0x25b5ce[_0x6e70('0xa6')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){this[_0x6e70('0x136')](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')],'\x20Queue',_0x4605e5[_0x6e70('0x51')],'pTalking:\x20',_0x4605e5['pTalking']);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}}else if(_0x44799d&&_[_0x6e70('0x65')](_0x44799d[_0x6e70('0x138')])&&_0x4605e5[_0x6e70('0x139')]&&_0x25b5ce[_0x6e70('0xa3')]===_0x25b5ce[_0x6e70('0xa6')]&&_[_0x6e70('0x65')](_0x25b5ce['reason'])&&_0x25b5ce[_0x6e70('0x135')]==='16'&&_0x25b5ce[_0x6e70('0x13a')]==='6'&&_['isUndefined'](_0x44799d['transfer'])){if(_0x44799d[_0x6e70('0xa2')]){rpcDb[_0x6e70('0x106')](_0x44799d[_0x6e70('0x131')]);}if(_0x44799d[_0x6e70('0xbd')]){rpcDb[_0x6e70('0x82')](_0x44799d['idContact']);}_0x25b5ce['reason']='22';this[_0x6e70('0xe3')](_0x44799d,_0x4605e5,_0x25b5ce);}else if(_0x44799d&&_0x44799d[_0x6e70('0x13b')]){if(_0x25b5ce[_0x6e70('0x135')]==='16'&&this['actions'][_0x25b5ce[_0x6e70('0xa3')]][_0x6e70('0x69')]){logger[_0x6e70('0x55')]('[syncHangup][talking][transfer]',_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')],_0x6e70('0xa7'),_0x4605e5[_0x6e70('0x51')],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce['linkedid'],_0x25b5ce[_0x6e70('0x135')]);}else if(this[_0x6e70('0x19')][_0x25b5ce[_0x6e70('0xa3')]]['dialAnswer']){logger[_0x6e70('0x55')](_0x6e70('0x137'),_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce['cause'],_0x6e70('0xa7'),_0x4605e5['name'],_0x6e70('0xa8'),_0x4605e5[_0x6e70('0x28')]);this['callProgressDetectingCustomer'](_0x25b5ce,_0x25b5ce[_0x6e70('0xa3')],_0x25b5ce[_0x6e70('0x135')]);}}};Preview['prototype'][_0x6e70('0x1d')]=function(_0x2e8a43){if(this[_0x6e70('0x19')][_0x2e8a43[_0x6e70('0xe2')]]&&_0x2e8a43[_0x6e70('0xe2')]!==_0x2e8a43[_0x6e70('0x13c')]){this[_0x6e70('0x136')](_0x2e8a43,_0x2e8a43[_0x6e70('0xe2')],_0x2e8a43[_0x6e70('0x13d')]);}};Preview[_0x6e70('0x12')]['syncHangupRequest']=function(_0x52ce1a){if(this[_0x6e70('0x19')][_0x52ce1a['linkedid']]&&_0x52ce1a[_0x6e70('0xa3')]!==_0x52ce1a[_0x6e70('0xa6')]&&!this[_0x6e70('0x19')][_0x52ce1a[_0x6e70('0xa3')]][_0x6e70('0x69')]){if(_0x52ce1a[_0x6e70('0x135')]==='1'){this[_0x6e70('0x136')](_0x52ce1a,_0x52ce1a[_0x6e70('0xa3')],_0x52ce1a[_0x6e70('0x135')]);}}};Preview['prototype']['addVariable']=function(_0x4f8e39,_0x2bab68,_0x5f208c){if(this[_0x6e70('0x19')][_0x4f8e39]){if(_[_0x6e70('0x65')](this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')])){this[_0x6e70('0x19')][_0x4f8e39][_0x6e70('0x13e')]={};}this['actions'][_0x4f8e39][_0x6e70('0x13e')][_0x2bab68]=_0x5f208c;}};Preview[_0x6e70('0x12')][_0x6e70('0x1e')]=function(_0x2bafad){try{if(!_[_0x6e70('0x65')](_0x2bafad)){if(ut[_0x6e70('0x13f')](_[_0x6e70('0x140')](_0x2bafad['variable'])[0x0])){this[_0x6e70('0x141')](_0x2bafad[_0x6e70('0xa6')],_['keys'](_0x2bafad[_0x6e70('0x142')])[0x0],_0x2bafad[_0x6e70('0x143')]);}}}catch(_0x5734d6){logger['error'](_0x6e70('0x144'),util[_0x6e70('0x145')](_0x5734d6,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x6e70('0x146')]=function(_0x1bc156){if(_0x1bc156){if(this[_0x6e70('0x19')][_0x1bc156[_0x6e70('0x147')]]){this[_0x6e70('0x19')][_0x1bc156['transfertargetlinkedid']][_0x6e70('0x13b')]=!![];}}};Preview[_0x6e70('0x12')]['syncBlindTransfer']=function(_0x2e7e4a){if(_0x2e7e4a){if(this['actions'][_0x2e7e4a['transfererlinkedid']]){this['actions'][_0x2e7e4a[_0x6e70('0x148')]][_0x6e70('0x13b')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xd8b0=['[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','countglobal','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','decrementTalkink','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','ANSWER','isUndefined','object','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','execRun','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','originatecalleridname','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','channel','actionid','logLookAgent','clone','isFailure','unlockContact','idContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','Answer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','Trunk','name','active','callerid','Interval','stringify','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','outbound','hasOwnProperty','setMessage','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','ListId','Action','status','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','size','recallMe','agentReadyId','then','isNil','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','totalGlobal','NoSuchNumber','emit','custom:agentnosuchnumber','buildObj','nosuchnumber'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require('moment');var md5=require(_0x0d8b('0x2'));var Redis=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0x0d8b('0x7'));var rpcDb=require(_0x0d8b('0x8'));var Action=require(_0x0d8b('0x9'));var ut=require('./util/util');config[_0x0d8b('0xa')]=_[_0x0d8b('0xb')](config['redis'],{'host':_0x0d8b('0xc'),'port':0x18eb});var io=require(_0x0d8b('0xd'))(new Redis(config[_0x0d8b('0xa')]));var Sequence=function(){};Sequence[_0x0d8b('0xe')][_0x0d8b('0xf')]=function(_0x1cac62){this[_0x0d8b('0x10')]=this[_0x0d8b('0x10')]?this['tail'][_0x0d8b('0x11')](_0x1cac62):_0x1cac62();};function Preview(_0x4e0269){this[_0x0d8b('0x12')]=new Sequence();this[_0x0d8b('0x13')]=_0x4e0269[_0x0d8b('0x14')];this[_0x0d8b('0x15')]=_0x4e0269[_0x0d8b('0x15')];this[_0x0d8b('0x16')]={};this[_0x0d8b('0x17')]=_0x4e0269[_0x0d8b('0x17')];this[_0x0d8b('0x18')]=0x0;ami['on'](_0x0d8b('0x19'),this[_0x0d8b('0x1a')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x1c'),this[_0x0d8b('0x1d')]['bind'](this));ami['on'](_0x0d8b('0x1e'),this[_0x0d8b('0x1f')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x20'),this[_0x0d8b('0x21')]['bind'](this));ami['on'](_0x0d8b('0x22'),this[_0x0d8b('0x23')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x24'),this[_0x0d8b('0x25')][_0x0d8b('0x1b')](this));ami['on'](_0x0d8b('0x26'),this[_0x0d8b('0x27')]['bind'](this));ami['on'](_0x0d8b('0x28'),this[_0x0d8b('0x29')][_0x0d8b('0x1b')](this));this[_0x0d8b('0x2a')](this[_0x0d8b('0x13')]);}function emit(_0x5b709c,_0x393beb,_0x352c17){io['to'](_0x5b709c)['emit'](_0x393beb,_0x352c17);}function emitCampaignPreview(_0x4f0a1a){if(_0x4f0a1a[_0x0d8b('0x2b')]==='outbound'){var _0x56c729={'id':_0x4f0a1a['id'],'name':_0x4f0a1a['name'],'strategy':_0x4f0a1a[_0x0d8b('0x2c')],'answered':_0x4f0a1a[_0x0d8b('0x2d')],'available':_0x4f0a1a[_0x0d8b('0x2e')],'loggedIn':_0x4f0a1a[_0x0d8b('0x2f')],'pTalking':_0x4f0a1a[_0x0d8b('0x30')],'sumBillable':_0x4f0a1a[_0x0d8b('0x31')],'sumDuration':_0x4f0a1a[_0x0d8b('0x32')],'sumHoldTime':_0x4f0a1a[_0x0d8b('0x33')]||0x0,'talking':_0x4f0a1a[_0x0d8b('0x34')],'total':_0x4f0a1a['total'],'type':_0x4f0a1a[_0x0d8b('0x2b')],'unmanaged':_0x4f0a1a[_0x0d8b('0x35')],'abandoned':_0x4f0a1a['abandoned'],'waiting':_0x4f0a1a[_0x0d8b('0x36')],'loggedInDb':_0x4f0a1a['loggedInDb'],'dialActive':_0x4f0a1a[_0x0d8b('0x37')],'dialMethod':_0x4f0a1a[_0x0d8b('0x38')],'dialOriginateCallerIdName':_0x4f0a1a[_0x0d8b('0x39')],'dialOriginateCallerIdNumber':_0x4f0a1a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4f0a1a['dialOriginateTimeout'],'dialPrefix':_0x4f0a1a[_0x0d8b('0x3a')],'outboundAnswerAgiCallsDay':_0x4f0a1a[_0x0d8b('0x3b')],'outboundAnswerCallsDay':_0x4f0a1a['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x4f0a1a[_0x0d8b('0x3c')],'outboundBusyCallsDay':_0x4f0a1a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4f0a1a[_0x0d8b('0x3d')],'outboundDropCallsDayACS':_0x4f0a1a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4f0a1a[_0x0d8b('0x3e')],'outboundDropCallsDayTimeout':_0x4f0a1a['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4f0a1a[_0x0d8b('0x3f')],'outboundNoSuchCallsDay':_0x4f0a1a['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4f0a1a[_0x0d8b('0x40')],'outboundReCallsDay':_0x4f0a1a['outboundReCallsDay'],'outboundRejectCallsDay':_0x4f0a1a[_0x0d8b('0x41')],'outboundUnknownCallsDay':_0x4f0a1a[_0x0d8b('0x42')],'outboundAbandonedCallsDay':_0x4f0a1a[_0x0d8b('0x43')],'predictiveIntervalAnsweredCalls':_0x4f0a1a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4f0a1a['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x4f0a1a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4f0a1a[_0x0d8b('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x4f0a1a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4f0a1a[_0x0d8b('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x4f0a1a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4f0a1a['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4f0a1a[_0x0d8b('0x46')],'predictiveIntervalPauses':_0x4f0a1a[_0x0d8b('0x47')],'predictiveIntervalAvailable':_0x4f0a1a[_0x0d8b('0x48')],'predictiveIntervalTotalCalls':_0x4f0a1a[_0x0d8b('0x49')],'message':_0x4f0a1a[_0x0d8b('0x4a')],'originated':_0x4f0a1a[_0x0d8b('0x4b')],'erlangCalls':_0x4f0a1a[_0x0d8b('0x4c')],'erlangCallToSecond':_0x4f0a1a[_0x0d8b('0x4d')],'erlangAbandonmentRate':_0x4f0a1a['erlangAbandonmentRate'],'erlangBusyFactor':_0x4f0a1a[_0x0d8b('0x4e')],'startPredictive':_0x4f0a1a[_0x0d8b('0x4f')],'startProgressive':_0x4f0a1a['startProgressive']};if(_0x4f0a1a[_0x0d8b('0x50')]){_0x56c729[_0x0d8b('0x50')]={'id':_0x4f0a1a[_0x0d8b('0x50')]['id'],'name':_0x4f0a1a['Trunk'][_0x0d8b('0x51')],'active':_0x4f0a1a[_0x0d8b('0x50')][_0x0d8b('0x52')],'callerid':_0x4f0a1a[_0x0d8b('0x50')][_0x0d8b('0x53')]};}if(_0x4f0a1a['Interval']){_0x56c729[_0x0d8b('0x54')]={'id':_0x4f0a1a[_0x0d8b('0x54')]['id'],'name':_0x4f0a1a['Interval'][_0x0d8b('0x51')]};}var _0x3cc3ee=md5(JSON[_0x0d8b('0x55')](_0x56c729));if(_0x4f0a1a[_0x0d8b('0x2')]!==_0x3cc3ee){_0x4f0a1a[_0x0d8b('0x2')]=_0x3cc3ee;emit(util['format']('voice:queue:%s',_0x56c729[_0x0d8b('0x51')]),'voice_queue:save',_0x56c729);}}}function emitVoiceQueueChannelRemove(_0x531c55){logger[_0x0d8b('0x56')](_0x0d8b('0x57'),JSON[_0x0d8b('0x55')](_0x531c55));emit(util[_0x0d8b('0x58')](_0x0d8b('0x59'),_0x531c55[_0x0d8b('0x51')]),'voice_queue_channel:remove',_0x531c55);}function notSendMessagesQueue(_0x6e5bab){if(_0x6e5bab[_0x0d8b('0x5a')]){if(_0x6e5bab[_0x0d8b('0x4b')]===0x0&&_0x6e5bab[_0x0d8b('0x30')]===0x0){_0x6e5bab[_0x0d8b('0x5a')]=![];_0x6e5bab[_0x0d8b('0x2e')]=0x0;_0x6e5bab[_0x0d8b('0x5b')]=0x0;_0x6e5bab['message']=_0x0d8b('0x5c');ut[_0x0d8b('0x5d')](_0x0d8b('0x5e'),_0x6e5bab[_0x0d8b('0x51')]+'\x20is\x20not\x20active');}else{_0x6e5bab[_0x0d8b('0x4a')]='IS_DISACTIVED';ut[_0x0d8b('0x5d')](_0x0d8b('0x5e'),_0x6e5bab[_0x0d8b('0x51')]+_0x0d8b('0x5f'));}emitCampaignPreview(_0x6e5bab);}}Preview[_0x0d8b('0xe')][_0x0d8b('0x2a')]=function(){var _0x1ff17d=this;setInterval(function(){_0x1ff17d[_0x0d8b('0x60')]();},0x7cf);};Preview[_0x0d8b('0xe')][_0x0d8b('0x60')]=function(){var _0x482069=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x4d0811 in _0x482069){if(_0x482069['hasOwnProperty'](_0x4d0811)&&(_0x482069[_0x4d0811][_0x0d8b('0x38')]===_0x0d8b('0x6')||_0x482069[_0x4d0811][_0x0d8b('0x38')]==='booked')&&_0x482069[_0x4d0811]['type']===_0x0d8b('0x61')){if(this[_0x0d8b('0x18')]>0x7){this[_0x0d8b('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x482069[_0x0d8b('0x62')](_0x4d0811)&&_0x482069[_0x4d0811][_0x0d8b('0x38')]==='preview'&&_0x482069[_0x4d0811]['type']===_0x0d8b('0x61')){if(_0x482069[_0x4d0811]['dialActive']){this[_0x0d8b('0x63')](_0x482069[_0x4d0811]);this['recallMe'](_0x482069[_0x4d0811]);}else{notSendMessagesQueue(_0x482069[_0x4d0811]);}}}};Preview['prototype'][_0x0d8b('0x64')]=function(_0x194f17){var _0x5a75c7=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x5a75c7[_0x0d8b('0x16')][_0x194f17])){loggerAction[_0x0d8b('0x56')](_0x0d8b('0x65'),_0x194f17,'Queue',_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')],_0x0d8b('0x67'),JSON[_0x0d8b('0x55')](_0x5a75c7[_0x0d8b('0x13')][_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]][_0x0d8b('0x4b')]),_0x0d8b('0x68'),JSON[_0x0d8b('0x55')](_0x5a75c7[_0x0d8b('0x13')][_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]][_0x0d8b('0x30')]),JSON[_0x0d8b('0x55')](_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x69')]),JSON[_0x0d8b('0x55')](_[_0x0d8b('0x6a')](_0x5a75c7['actions'][_0x194f17],[_0x0d8b('0x6b'),'UserId','VoiceQueueId',_0x0d8b('0x6c')])));return ami[_0x0d8b('0x6d')]({'action':_0x0d8b('0x6e'),'channel':_0x5a75c7[_0x0d8b('0x16')][_0x194f17]['channel']})[_0x0d8b('0x6f')](function(_0x1106d6){if(_0x1106d6[_0x0d8b('0x4a')]===_0x0d8b('0x70')){setTimeout(function(){if(_0x5a75c7[_0x0d8b('0x16')][_0x194f17]){ut['updateOriginated'](_0x5a75c7['campaignsPreview'][_0x5a75c7['actions'][_0x194f17]['queue']],_0x0d8b('0x71'));if(_0x5a75c7[_0x0d8b('0x16')][_0x194f17]['dialAnswer']===!![]){ut['decrementTalkink'](_0x5a75c7[_0x0d8b('0x13')][_0x5a75c7[_0x0d8b('0x16')][_0x194f17]['queue']],'[clearZombieChannel]');ut[_0x0d8b('0x72')](_0x0d8b('0x73')+_0x194f17,_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]);}ut[_0x0d8b('0x72')]('[Dialer][checkChannel][Preview]'+_0x194f17,_0x5a75c7[_0x0d8b('0x16')][_0x194f17][_0x0d8b('0x66')]);delete _0x5a75c7['actions'][_0x194f17];}},0x2328);}});}});};Preview['prototype'][_0x0d8b('0x74')]=function(){var _0x3f2d95=this;loggerAction['info']('[action]',_[_0x0d8b('0x75')](this[_0x0d8b('0x16')]));for(var _0x377027 in this[_0x0d8b('0x16')]){if(_0x3f2d95['actions'][_0x0d8b('0x62')](_0x377027)){_0x3f2d95['clearZombieChannel'](_0x377027);}}};Preview['prototype'][_0x0d8b('0x76')]=function(_0x44043b){var _0x54aa03=this;rpcDb['getContactRecallMe'](_0x44043b['id'],ut[_0x0d8b('0x77')](this[_0x0d8b('0x17')]))[_0x0d8b('0x78')](function(_0x2c1eb0){if(!_[_0x0d8b('0x79')](_0x2c1eb0)){for(var _0xb66e76=0x0;_0xb66e76<_0x2c1eb0[_0x0d8b('0x7a')];_0xb66e76+=0x1){if(ut[_0x0d8b('0x7b')](_0x2c1eb0[_0xb66e76]['scheduledat'])<_0x44043b[_0x0d8b('0x7c')]*0x3c){if(_0x2c1eb0[_0xb66e76][_0x0d8b('0x7d')]&&!_0x2c1eb0[_0xb66e76][_0x0d8b('0x7d')][_0x0d8b('0x7e')]){_0x54aa03[_0x0d8b('0x7f')](_0x2c1eb0[_0xb66e76]['id'])[_0x0d8b('0x78')](ut[_0x0d8b('0x80')](_0x0d8b('0x81')))[_0x0d8b('0x6f')](ut['logger2'](_0x0d8b('0x81')));}else{rpcDb[_0x0d8b('0x82')](_0x2c1eb0[_0xb66e76]['id']);}}else{var _0x180b7b=new Action(_0x2c1eb0[_0xb66e76],_0x44043b);_0x180b7b[_0x0d8b('0x83')]=moment()[_0x0d8b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x44043b[_0x0d8b('0x84')]+=0x1;ut[_0x0d8b('0x85')](_0x180b7b,0x17,_0x0d8b('0x86'));if(_0x44043b[_0x0d8b('0x87')]){rpcDb[_0x0d8b('0x88')](ut['createBody'](_0x2c1eb0[_0xb66e76]));rpcDb['createCustomerHistory'](_0x180b7b,_0x0d8b('0x89'));}else{ut[_0x0d8b('0x85')](_0x180b7b,0x16,_0x0d8b('0x8a'));rpcDb[_0x0d8b('0x8b')](_0x180b7b,'[HistoryRecallClose]');rpcDb[_0x0d8b('0x8c')](_0x180b7b,_0x0d8b('0x8d'));}}}}})[_0x0d8b('0x6f')](ut['logger2'](_0x0d8b('0x8e')));};Preview['prototype'][_0x0d8b('0x63')]=function(_0x3ed63e){_0x3ed63e[_0x0d8b('0x5a')]=!![];if(ut[_0x0d8b('0x8f')](_0x3ed63e[_0x0d8b('0x2f')])){_0x3ed63e[_0x0d8b('0x4a')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0d8b('0x90')](_0x3ed63e['dialActive'])){_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x5c');}else if(!this[_0x0d8b('0x91')](_0x3ed63e[_0x0d8b('0x50')])){if(!this['isTrunkReachable'](_0x3ed63e[_0x0d8b('0x92')])){_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x93');}else{_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x94');}}else{_0x3ed63e[_0x0d8b('0x4a')]=_0x0d8b('0x94');}emitCampaignPreview(_0x3ed63e);};Preview[_0x0d8b('0xe')][_0x0d8b('0x95')]=function(_0x34affb,_0x57e39a,_0x4ee1e8){var _0x6388ae=this;var _0x3eb647=this['actions'][_0x57e39a];var _0xb1aa96=this['campaignsPreview'][_0x3eb647['queue']];var _0x22ee20;if(_0xb1aa96){switch(_0x4ee1e8){case'1':_0xb1aa96[_0x0d8b('0x96')]+=0x1;_0x3eb647['countnosuchnumberretry']+=0x1;_0x3eb647['countglobal']=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x0,_0x0d8b('0x98'));ami[_0x0d8b('0x99')](_0x0d8b('0x9a'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0x9c')));rpcDb['createCustomerHistory'](_0x3eb647,_0x0d8b('0x9d'));if(ut['totalGlobal'](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,_0x0d8b('0xa0'));rpcDb[_0x0d8b('0x8c')](_0x22ee20,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3eb647[_0x0d8b('0xa1')]>=_0xb1aa96['dialNoSuchNumberMaxRetry']){rpcDb[_0x0d8b('0x8c')](_0x3eb647,_0x0d8b('0xa2'));}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xa1'),_0xb1aa96[_0x0d8b('0xa5')]),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}delete this[_0x0d8b('0x16')][_0x34affb[_0x0d8b('0xa8')]];break;case'ANSWER':var _0x1436b3=moment()['format'](_0x0d8b('0xa9'));_0x3eb647[_0x0d8b('0xaa')]=_0x1436b3;_0x3eb647['answertime']=_0x1436b3;_0x3eb647[_0x0d8b('0x69')]=!![];_0xb1aa96['pTalking']+=0x1;logger[_0x0d8b('0x56')](_0x0d8b('0xab'),_0x3eb647[_0x0d8b('0xac')],_0x0d8b('0xad'),_0xb1aa96[_0x0d8b('0x51')],_0x0d8b('0x68'),_0xb1aa96[_0x0d8b('0x30')]);ami[_0x0d8b('0x99')]('custom:agentconnect',ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xae'),this['campaignsPreview'][_0x3eb647[_0x0d8b('0x66')]]));if(_0xb1aa96[_0x0d8b('0xaf')]){ami[_0x0d8b('0x99')](_0x0d8b('0xb0'),ut[_0x0d8b('0xb1')](_0x3eb647));}break;case'16':ami[_0x0d8b('0x99')](_0x0d8b('0xb2'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xb3'),this[_0x0d8b('0x13')][_0x3eb647[_0x0d8b('0x66')]]));emitVoiceQueueChannelRemove(ut[_0x0d8b('0x9b')](_0x3eb647,'complete'));_0xb1aa96[_0x0d8b('0xb4')]+=0x1;_0xb1aa96[_0x0d8b('0xb5')]+=0x1;_0xb1aa96[_0x0d8b('0x2d')]+=0x1;ut['decrementTalkink'](_0xb1aa96,'[16]');_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x4,'Answer');rpcDb['createCustomerHistory'](_0x3eb647,_0x0d8b('0xb7'));rpcDb[_0x0d8b('0x8c')](_0x3eb647,_0x0d8b('0xb8'));rpcDb[_0x0d8b('0xb9')](_0x3eb647);_0xb1aa96[_0x0d8b('0x32')]+=_0x3eb647[_0x0d8b('0xba')];_0xb1aa96[_0x0d8b('0x31')]+=_0x3eb647[_0x0d8b('0xba')];logger[_0x0d8b('0x56')](_0x0d8b('0xbb'),_0x3eb647[_0x0d8b('0xac')],_0x0d8b('0xad'),_0xb1aa96[_0x0d8b('0x51')],'pTalking:\x20',_0xb1aa96[_0x0d8b('0x30')]);delete this[_0x0d8b('0x16')][_0x34affb['linkedid']];break;case'BUSY':_0xb1aa96[_0x0d8b('0xbc')]+=0x1;_0x3eb647[_0x0d8b('0xbd')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x5,_0x0d8b('0xbe'));ami['emit']('custom:agentbusy',ut['buildObj'](_0x3eb647,_0x0d8b('0xbf')));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xc0'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,'Global');rpcDb[_0x0d8b('0x8c')](_0x22ee20,_0x0d8b('0xc1'));}else{if(_0x3eb647['countbusyretry']>=_0xb1aa96[_0x0d8b('0xc2')]){rpcDb['createCustomerFinal'](_0x3eb647,_0x0d8b('0xc0'));}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xbd'),_0xb1aa96[_0x0d8b('0xc3')]),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xc4'):_0xb1aa96[_0x0d8b('0x3f')]+=0x1;_0x3eb647[_0x0d8b('0xc5')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut['logCustomer'](_0x3eb647,0x3,'NoAnswer');ami[_0x0d8b('0x99')](_0x0d8b('0xc6'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xc7')));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xc8'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96['dialGlobalMaxRetry']){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,'Global');rpcDb[_0x0d8b('0x8c')](_0x22ee20,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x3eb647['countnoanswerretry']>=_0xb1aa96[_0x0d8b('0xc9')]){rpcDb[_0x0d8b('0x8c')](_0x3eb647,_0x0d8b('0xc8'));}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xc5'),_0xb1aa96[_0x0d8b('0xca')]),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xcb'):_0xb1aa96[_0x0d8b('0x3d')]+=0x1;_0x3eb647[_0x0d8b('0xcc')]+=0x1;_0x3eb647['countglobal']=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x8,_0x0d8b('0xcd'));ami['emit']('custom:agentcongestion',ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xce')));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xcf'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut['cloneAction'](_0x3eb647,0xf,_0x0d8b('0xa0'));rpcDb[_0x0d8b('0x8c')](_0x22ee20,_0x0d8b('0xd0'));}else{if(_0x3eb647[_0x0d8b('0xcc')]>=_0xb1aa96[_0x0d8b('0xd1')]){rpcDb['createCustomerFinal'](_0x3eb647,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xcc'),_0xb1aa96['dialBusyRetryFrequency']),_0x3eb647[_0x0d8b('0xa6')],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xd2'):_0xb1aa96['outboundRejectCallsDay']+=0x1;_0x3eb647[_0x0d8b('0xd3')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0x14,_0x0d8b('0xd4'));ami[_0x0d8b('0x99')](_0x0d8b('0xd5'),ut[_0x0d8b('0x9b')](_0x3eb647,_0x0d8b('0xd6')));rpcDb['createCustomerHistory'](_0x3eb647,_0x0d8b('0xd7'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0x14,_0x0d8b('0xd4'));rpcDb[_0x0d8b('0x8c')](_0x22ee20,_0x0d8b('0xd8'));}else{if(_0x3eb647[_0x0d8b('0xd3')]>=_0xb1aa96[_0x0d8b('0xd9')]){rpcDb['createCustomerFinal'](_0x3eb647,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0d8b('0xa3')](ut[_0x0d8b('0xa4')](_0x3eb647,_0x0d8b('0xd3'),_0xb1aa96[_0x0d8b('0xda')]),_0x3eb647['unlockAgent'],_0x3eb647[_0x0d8b('0xa7')]);}}break;case _0x0d8b('0xdb'):_0xb1aa96['outboundAbandonedCallsDay']+=0x1;_0x3eb647[_0x0d8b('0xdc')]+=0x1;_0x3eb647['countglobal']=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0xb,_0x0d8b('0xdd'));rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xde'));if(ut[_0x0d8b('0x97')](_0x3eb647)>=_0xb1aa96[_0x0d8b('0x9e')]){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,'Global');rpcDb[_0x0d8b('0x8c')](_0x22ee20,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3eb647['countabandonedetry']>=_0xb1aa96[_0x0d8b('0xdf')]){rpcDb['createCustomerFinal'](_0x3eb647,_0x0d8b('0xde'));}else{rpcDb[_0x0d8b('0xa3')](ut['scheduledAt'](_0x3eb647,_0x0d8b('0xdc'),_0xb1aa96['dialAbandonedRetryFrequency']),_0x3eb647['unlockAgent'],_0x3eb647[_0x0d8b('0xa7')]);}}break;default:if(_0x3eb647[_0x0d8b('0x69')]){ut[_0x0d8b('0xe0')](_0xb1aa96,_0x0d8b('0xe1'));ut[_0x0d8b('0x72')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0xb1aa96['name'],_0x34affb);}_0xb1aa96[_0x0d8b('0x42')]+=0x1;_0x3eb647[_0x0d8b('0xb6')]=ut[_0x0d8b('0x97')](_0x3eb647);ut[_0x0d8b('0x85')](_0x3eb647,0xc,_0x34affb[_0x0d8b('0xe2')]||_0x34affb[_0x0d8b('0xe3')]);rpcDb[_0x0d8b('0x8b')](_0x3eb647,_0x0d8b('0xe4'));if(ut['totalGlobal'](_0x3eb647)>=_0xb1aa96['dialGlobalMaxRetry']){_0x22ee20=ut[_0x0d8b('0x9f')](_0x3eb647,0xf,_0x0d8b('0xa0'));rpcDb['createCustomerFinal'](_0x22ee20,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x3eb647,_0x0d8b('0xe5'));}delete this[_0x0d8b('0x16')][_0x34affb[_0x0d8b('0xa8')]];}if(!(_0x3eb647['dialAnswer']&&_0x4ee1e8==='16')){ut[_0x0d8b('0xe6')](_0xb1aa96,_0x0d8b('0xe7'));logger[_0x0d8b('0x56')]('[originated][decrement][callProgressDetectingCustomer]',_0x3eb647[_0x0d8b('0xac')],'\x20Queue',_0xb1aa96[_0x0d8b('0x51')],'originated:\x20',_0xb1aa96[_0x0d8b('0x4b')]);}if(_0x4ee1e8!==_0x0d8b('0xe8')){delete this[_0x0d8b('0x16')][_0x34affb[_0x0d8b('0xa8')]];delete this[_0x0d8b('0x16')][_0x34affb['destlinkedid']];}}};Preview[_0x0d8b('0xe')]['callProgressDetectingAgent']=function(_0x2d010e,_0x4bd01c,_0x165baa){if(_['isUndefined'](_0x4bd01c)&&'object'!==typeof _0x4bd01c){return;}if(_[_0x0d8b('0xe9')](_0x165baa)&&_0x0d8b('0xea')!==typeof _0x165baa){return;}switch(_0x165baa['reason']){case'0':ut[_0x0d8b('0xeb')](_0x2d010e,0x0,_0x0d8b('0x98'));rpcDb[_0x0d8b('0xec')](_0x2d010e,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x2d010e,0x3,'NoAnswer');rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xed'));break;case'5':ut[_0x0d8b('0xeb')](_0x2d010e,0x5,_0x0d8b('0xbe'));rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xee'));break;case'8':ut[_0x0d8b('0xeb')](_0x2d010e,0x8,_0x0d8b('0xcd'));rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xef'));break;case'22':ut['logAgent'](_0x2d010e,0x16,_0x0d8b('0xf0'));rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xf1'));break;default:ut['logAgent'](_0x2d010e,0xc,_0x165baa[_0x0d8b('0xf2')]);rpcDb[_0x0d8b('0xec')](_0x2d010e,_0x0d8b('0xef'));}ut[_0x0d8b('0xe6')](_0x4bd01c,_0x0d8b('0xf3'));logger[_0x0d8b('0x56')](_0x0d8b('0xf4'),_0x2d010e[_0x0d8b('0xac')],_0x0d8b('0xad'),_0x4bd01c[_0x0d8b('0x51')],_0x0d8b('0x67'),_0x4bd01c[_0x0d8b('0x4b')]);delete this['actions'][_0x2d010e[_0x0d8b('0xac')]];};Preview[_0x0d8b('0xe')][_0x0d8b('0xf5')]=function(_0x31baaf,_0x590889,_0x55215b,_0x11e5c2,_0x853bee){var _0x222deb=this;return new BPromise(function(_0x59698d,_0x4e2323){if(_['isNil'](_0x590889)||_[_0x0d8b('0x79')](_0x590889['Contact'])||_[_0x0d8b('0x79')](_0x590889[_0x0d8b('0xf6')][_0x0d8b('0xf7')])||_[_0x0d8b('0x79')](_0x590889[_0x0d8b('0xf8')])){_0x4e2323(ut[_0x0d8b('0x4a')](_0x0d8b('0xf9'),_0x11e5c2,_0x853bee));return;}var _0x16994f=uuid['v4']();var _0x5dbe4c=_0x222deb[_0x0d8b('0x13')][_0x590889[_0x0d8b('0xfa')][_0x0d8b('0x51')]];var _0x6b4a65=_0x55215b?_0x222deb['agents'][_0x55215b]['id']:undefined;_0x222deb[_0x0d8b('0x16')][_0x16994f]=new Action(_0x590889,_0x5dbe4c,_0x16994f,_0x55215b,_0x6b4a65);var _0x62fedf=_0x222deb[_0x0d8b('0x16')][_0x16994f];_0x62fedf[_0x0d8b('0xa6')]=_0x11e5c2;_0x62fedf['activeContact']=_0x853bee;_0x62fedf[_0x0d8b('0xfb')]=_0x55215b;if(_[_0x0d8b('0xfc')](_0x31baaf)){_0x222deb[_0x0d8b('0xfd')](_0x62fedf,_0x5dbe4c,_0x590889,_0x55215b)[_0x0d8b('0x78')](function(_0x572329){logger[_0x0d8b('0x56')]('[Preview][execCall][success]',_0x0d8b('0xfe')+_0x62fedf['queue']+_0x0d8b('0xff')+_0x62fedf['idContact'],JSON[_0x0d8b('0x55')](_0x572329));ami['emit'](_0x0d8b('0x100'),ut['buildObj'](_0x62fedf,_0x0d8b('0x101'),_0x222deb['campaignsPreview'][_0x62fedf[_0x0d8b('0x66')]]));_0x59698d(ut['message'](_0x0d8b('0x102')));})[_0x0d8b('0x6f')](function(_0x507587){ut['logger']('[Preview][execCall][failure]',_0x507587);_0x4e2323(ut[_0x0d8b('0x4a')]('Call\x20failed',_0x11e5c2,_0x853bee));});}else{_0x5dbe4c[_0x0d8b('0x3c')]+=0x1;ut['logBlacklist'](_0x62fedf);rpcDb[_0x0d8b('0x103')](_0x62fedf,_0x0d8b('0x104'));delete _0x222deb[_0x0d8b('0x16')][_0x16994f];_0x4e2323(ut[_0x0d8b('0x4a')](_0x0d8b('0x105'),_0x11e5c2,_0x853bee));}});};Preview[_0x0d8b('0xe')]['isTrunkReachable']=function(_0x58d013){return!_[_0x0d8b('0x79')](_0x58d013)&&!_['isNil'](_0x58d013[_0x0d8b('0x51')])&&!_[_0x0d8b('0x79')](_0x58d013[_0x0d8b('0x52')])&&_0x58d013['active']&&!_[_0x0d8b('0x79')](this['trunks'][util[_0x0d8b('0x58')](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])])&&!_[_0x0d8b('0x79')](this['trunks'][util[_0x0d8b('0x58')](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])]['status'])&&(this[_0x0d8b('0x15')][util['format'](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])][_0x0d8b('0x6e')]===_0x0d8b('0x107')||this[_0x0d8b('0x15')][util[_0x0d8b('0x58')](_0x0d8b('0x106'),_0x58d013[_0x0d8b('0x51')])][_0x0d8b('0x6e')]===_0x0d8b('0x108'));};Preview[_0x0d8b('0xe')][_0x0d8b('0x7f')]=function(_0x50b987,_0x3c2fb9){var _0xb816d7=this;return new BPromise(function(_0x4f5d39,_0x2cc63a){_0xb816d7['execRun'](_0x50b987,_0x3c2fb9)[_0x0d8b('0x78')](function(_0x4a04c6){_0x4f5d39(_[_0x0d8b('0x6a')](_0x4a04c6,['message']));})['catch'](function(_0x124219){if(_0x124219[_0x0d8b('0x109')]){rpcDb['unlockContact'](_0x50b987);}if(_0x124219['active']){rpcDb['disableContact'](_0x50b987);}_0x2cc63a(_['pick'](_0x124219,[_0x0d8b('0x4a')]));});});};Preview[_0x0d8b('0xe')][_0x0d8b('0x10a')]=function(_0x29e8e6,_0x233ff0){var _0x21329f=this;return new BPromise(function(_0x3d8a14,_0x44ac53){var _0x53de32,_0x19e8d4;rpcDb['getContactPreview'](_0x29e8e6)[_0x0d8b('0x78')](function(_0x4e1f1a){if(!_[_0x0d8b('0x79')](_0x4e1f1a[0x0])){_0x19e8d4=_0x4e1f1a[0x0][_0x0d8b('0x10b')]?![]:!![];_0x53de32=_0x4e1f1a[0x0][_0x0d8b('0x10b')]?!![]:![];_0x53de32=_0x233ff0?!![]:_0x53de32;}var _0x2d90af=_0x21329f[_0x0d8b('0x10c')](_0x4e1f1a);if(_0x2d90af[_0x0d8b('0x10d')]){rpcDb[_0x0d8b('0x10e')](_[_0x0d8b('0x6a')](_0x4e1f1a[0x0],[_0x0d8b('0xf8'),_0x0d8b('0x10f')]))[_0x0d8b('0x78')](function(_0x36527c){_0x21329f[_0x0d8b('0xf5')](_0x36527c,_0x4e1f1a[0x0],_0x233ff0,_0x19e8d4,_0x53de32)['then'](function(_0x479d59){_0x3d8a14(_0x479d59);})['catch'](function(_0x4111e6){_0x44ac53(_0x4111e6);});})[_0x0d8b('0x6f')](function(_0x4c69a3){ut[_0x0d8b('0x5d')]('[Preview][checkIsBlackList]',_0x4c69a3);_0x44ac53(ut[_0x0d8b('0x4a')]('Call\x20unsuccessful',_0x19e8d4,_0x53de32));});}else{_0x44ac53(ut[_0x0d8b('0x4a')](_0x2d90af[_0x0d8b('0x4a')],_0x19e8d4,_0x53de32));}})[_0x0d8b('0x6f')](function(_0x3e7cc7){ut[_0x0d8b('0x5d')](_0x0d8b('0x110'),_0x3e7cc7);_0x44ac53(ut['message'](_0x0d8b('0x111'),![],!![]));});});};Preview['prototype'][_0x0d8b('0x10c')]=function(_0x66040){if(_[_0x0d8b('0x79')](_0x66040)||_[_0x0d8b('0xfc')](_0x66040)||!_[_0x0d8b('0x79')](_0x66040[0x0]['Agent'])&&_[_0x0d8b('0x79')](_0x66040[0x0][_0x0d8b('0x7d')]['name'])){ut[_0x0d8b('0x5d')](_0x0d8b('0x112'),_0x66040);return{'isValid':![],'message':_0x0d8b('0x113')};}var _0x2f90e0=this['campaignsPreview'][_0x66040[0x0][_0x0d8b('0xfa')]['name']];_0x2f90e0[_0x0d8b('0x4a')]='ACTIVE';if(_[_0x0d8b('0x79')](_0x2f90e0)){ut[_0x0d8b('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f90e0);return{'isValid':![],'message':_0x0d8b('0x114')};}if(!this[_0x0d8b('0x91')](_0x2f90e0[_0x0d8b('0x50')])){ut[_0x0d8b('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x0d8b('0x115')+_0x2f90e0['name']+_0x0d8b('0x116'));if(!this[_0x0d8b('0x91')](_0x2f90e0['TrunkBackup'])){ut[_0x0d8b('0x5d')](_0x0d8b('0x117'),_0x2f90e0[_0x0d8b('0x51')]+_0x0d8b('0x118'));return{'isValid':![],'message':_0x0d8b('0x119')};}}if(!ut[_0x0d8b('0x90')](_0x2f90e0[_0x0d8b('0x37')])){ut[_0x0d8b('0x5d')]('[Preview][validateContact][Campaign\x20Active]',_0x2f90e0[_0x0d8b('0x51')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x0d8b('0x115')+_0x2f90e0[_0x0d8b('0x51')]+_0x0d8b('0x11a')};}return{'isValid':!![],'message':_0x0d8b('0x11b')};};Preview[_0x0d8b('0xe')][_0x0d8b('0xfd')]=function(_0x331bc5,_0x1660d5,_0x1a987a,_0x53bfe5){var _0x2f8682=this;return new BPromise(function(_0x3106e9,_0x4cd83e){var _0x2703f1=_0x331bc5[_0x0d8b('0xac')];var _0x4aa208=_0x2f8682[_0x0d8b('0x91')](_0x1660d5[_0x0d8b('0x50')])?util[_0x0d8b('0x58')](_0x0d8b('0x11c'),_0x1660d5[_0x0d8b('0x50')][_0x0d8b('0x51')],_[_0x0d8b('0x79')](_0x1660d5[_0x0d8b('0x3a')])?'':_0x1660d5['dialPrefix'][_0x0d8b('0x11d')]()||'',_0x1660d5[_0x0d8b('0x11e')]>0x0?_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')][_0x0d8b('0x11f')](_0x1660d5[_0x0d8b('0x11e')]):_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')]):util[_0x0d8b('0x58')](_0x0d8b('0x11c'),_[_0x0d8b('0x79')](_0x1660d5['TrunkBackup'])?_0x1660d5['Trunk']['name']:_0x1660d5['TrunkBackup']['name'],_['isNil'](_0x1660d5[_0x0d8b('0x3a')])?'':_0x1660d5['dialPrefix'][_0x0d8b('0x11d')]()||'',_0x1660d5[_0x0d8b('0x11e')]>0x0?_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')][_0x0d8b('0x11f')](_0x1660d5[_0x0d8b('0x11e')]):_0x1a987a[_0x0d8b('0xf6')][_0x0d8b('0xf7')]);var _0x352485=_0x2f8682[_0x0d8b('0x91')](_0x1660d5[_0x0d8b('0x50')])?ut[_0x0d8b('0x120')](_0x1660d5['Trunk'][_0x0d8b('0x53')],_0x1660d5['dialOriginateCallerIdName'],_0x1660d5[_0x0d8b('0x121')]>0x0?ut['getCallerIdRandom'](_0x1660d5[_0x0d8b('0x122')],_0x1660d5[_0x0d8b('0x121')]):_0x1660d5[_0x0d8b('0x122')]):ut[_0x0d8b('0x120')](_[_0x0d8b('0x79')](_0x1660d5['TrunkBackup'])?_0x1660d5[_0x0d8b('0x50')][_0x0d8b('0x53')]:_0x1660d5['TrunkBackup'][_0x0d8b('0x53')],_0x1660d5['dialOriginateCallerIdName'],_0x1660d5['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0d8b('0x123')](_0x1660d5[_0x0d8b('0x122')],_0x1660d5[_0x0d8b('0x121')]):_0x1660d5[_0x0d8b('0x122')]);if(_0x352485){_0x331bc5[_0x0d8b('0x124')]=ut['extractCalleridName'](_0x352485);_0x331bc5['originatecalleridnum']=ut['extractCalleridNumber'](_0x352485);}var _0x18e6be=ut[_0x0d8b('0x125')](_0x1660d5,_0x1a987a,_0x4aa208,_0x352485,_0x2703f1,_0x331bc5);_[_0x0d8b('0x126')](_0x331bc5,ut[_0x0d8b('0x127')](_0x18e6be));_0x331bc5[_0x0d8b('0x83')]=moment()[_0x0d8b('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x0d8b('0x6d')](ut[_0x0d8b('0x128')](_0x331bc5,_0x1660d5,_0x18e6be,_0x331bc5['activeContact'],_0x53bfe5))[_0x0d8b('0x78')](function(_0x28fa83){_0x1660d5[_0x0d8b('0x4b')]+=0x1;logger[_0x0d8b('0x56')](_0x0d8b('0x129'),_0x2703f1,'\x20Queue',_0x1660d5['name'],_0x0d8b('0x67'),_0x1660d5[_0x0d8b('0x4b')]);_0x3106e9(_0x28fa83);})['catch'](function(_0x3c5a61){ut[_0x0d8b('0xeb')](_0x331bc5,0xe,_0x0d8b('0x12a'));rpcDb['createAgentHistory'](_0x331bc5,'[originateFailure][logOriginateFailure]');_0x4cd83e(_0x3c5a61);});});};Preview[_0x0d8b('0xe')][_0x0d8b('0x23')]=function(_0x598e67){if(this['actions'][_0x598e67[_0x0d8b('0xa8')]]){this['actions'][_0x598e67[_0x0d8b('0xa8')]]['channel']=_0x598e67[_0x0d8b('0x12b')];}};Preview[_0x0d8b('0xe')]['syncOriginateResponse']=function(_0x3411d9){var _0x5d9ab5=this;var _0x31d9fb=this[_0x0d8b('0x16')][_0x3411d9[_0x0d8b('0x12c')]];if(_0x31d9fb){if(_0x31d9fb[_0x0d8b('0xfb')]&&this[_0x0d8b('0x17')][_0x31d9fb['lookAgent']]){ut[_0x0d8b('0x12d')](_0x31d9fb,this[_0x0d8b('0x17')][_0x31d9fb[_0x0d8b('0xfb')]]['name'],this[_0x0d8b('0x17')][_0x31d9fb['lookAgent']]['id']);}var _0x270338=_[_0x0d8b('0x12e')](_0x31d9fb);_0x270338['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x24705e=_0x5d9ab5[_0x0d8b('0x13')][_0x31d9fb['queue']];if(ut[_0x0d8b('0x12f')](_0x3411d9['response'])){if(_0x31d9fb[_0x0d8b('0xa6')]){rpcDb[_0x0d8b('0x130')](_0x31d9fb[_0x0d8b('0x131')]);}if(_0x31d9fb[_0x0d8b('0xa7')]){rpcDb[_0x0d8b('0x82')](_0x31d9fb[_0x0d8b('0x131')]);}ami[_0x0d8b('0x99')](_0x0d8b('0x132'),ut['buildObj'](_0x31d9fb,_0x0d8b('0x133'),this['campaignsPreview'][_0x31d9fb['queue']]));this[_0x0d8b('0x134')](_0x270338,_0x24705e,_0x3411d9);}else{_0x31d9fb[_0x0d8b('0x83')]=moment()[_0x0d8b('0x58')](_0x0d8b('0xa9'));ut[_0x0d8b('0xeb')](_0x270338,0x4,_0x0d8b('0x135'));rpcDb[_0x0d8b('0xec')](_0x270338,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x0d8b('0xe')]['syncHangup']=function(_0x5d3cd5){var _0x3bdb03=this;var _0x5f4e06=this[_0x0d8b('0x16')][_0x5d3cd5['linkedid']];var _0x4a9bc0;if(_0x5f4e06){_0x4a9bc0=this[_0x0d8b('0x13')][_0x5f4e06[_0x0d8b('0x66')]];logger[_0x0d8b('0x56')](_0x0d8b('0x136'),_0x5d3cd5[_0x0d8b('0xa8')],_0x0d8b('0xad'),_0x4a9bc0['name'],'pTalking:\x20',_0x4a9bc0[_0x0d8b('0x30')]);}if(this[_0x0d8b('0x16')][_0x5d3cd5[_0x0d8b('0xa8')]]&&_0x5d3cd5[_0x0d8b('0xa8')]!==_0x5d3cd5[_0x0d8b('0xac')]){if(_0x5d3cd5[_0x0d8b('0x137')]==='16'&&this[_0x0d8b('0x16')][_0x5d3cd5[_0x0d8b('0xa8')]][_0x0d8b('0x69')]){this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')]);}else if(this[_0x0d8b('0x16')][_0x5d3cd5['linkedid']]['dialAnswer']){logger['info'](_0x0d8b('0x138'),_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')],_0x0d8b('0xad'),_0x4a9bc0[_0x0d8b('0x51')],_0x0d8b('0x68'),_0x4a9bc0[_0x0d8b('0x30')]);this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')]);}}else if(_0x5f4e06&&_[_0x0d8b('0x79')](_0x5f4e06[_0x0d8b('0x139')])&&_0x4a9bc0[_0x0d8b('0x13a')]&&_0x5d3cd5[_0x0d8b('0xa8')]===_0x5d3cd5[_0x0d8b('0xac')]&&_[_0x0d8b('0x79')](_0x5d3cd5[_0x0d8b('0xf2')])&&_0x5d3cd5['cause']==='16'&&_0x5d3cd5['channelstate']==='6'&&_[_0x0d8b('0xe9')](_0x5f4e06['transfer'])){if(_0x5f4e06['unlockAgent']){rpcDb['unlockContact'](_0x5f4e06[_0x0d8b('0x131')]);}if(_0x5f4e06[_0x0d8b('0xa7')]){rpcDb[_0x0d8b('0x82')](_0x5f4e06[_0x0d8b('0x131')]);}_0x5d3cd5[_0x0d8b('0xf2')]='22';this['callProgressDetectingAgent'](_0x5f4e06,_0x4a9bc0,_0x5d3cd5);}else if(_0x5f4e06&&_0x5f4e06[_0x0d8b('0x13b')]){if(_0x5d3cd5[_0x0d8b('0x137')]==='16'&&this[_0x0d8b('0x16')][_0x5d3cd5[_0x0d8b('0xa8')]]['dialAnswer']){logger['info'](_0x0d8b('0x13c'),_0x5d3cd5['linkedid'],_0x5d3cd5[_0x0d8b('0x137')],_0x0d8b('0xad'),_0x4a9bc0[_0x0d8b('0x51')],_0x0d8b('0x68'),_0x4a9bc0[_0x0d8b('0x30')]);this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5['linkedid'],_0x5d3cd5[_0x0d8b('0x137')]);}else if(this['actions'][_0x5d3cd5[_0x0d8b('0xa8')]][_0x0d8b('0x69')]){logger[_0x0d8b('0x56')](_0x0d8b('0x138'),_0x5d3cd5['linkedid'],_0x5d3cd5['cause'],'\x20Queue',_0x4a9bc0['name'],_0x0d8b('0x68'),_0x4a9bc0[_0x0d8b('0x30')]);this[_0x0d8b('0x95')](_0x5d3cd5,_0x5d3cd5[_0x0d8b('0xa8')],_0x5d3cd5[_0x0d8b('0x137')]);}}};Preview[_0x0d8b('0xe')]['syncDialEnd']=function(_0x495456){if(this['actions'][_0x495456['destlinkedid']]&&_0x495456[_0x0d8b('0x13d')]!==_0x495456[_0x0d8b('0x13e')]){this['callProgressDetectingCustomer'](_0x495456,_0x495456[_0x0d8b('0x13d')],_0x495456[_0x0d8b('0xe3')]);}};Preview[_0x0d8b('0xe')][_0x0d8b('0x1f')]=function(_0x289b7e){if(this[_0x0d8b('0x16')][_0x289b7e[_0x0d8b('0xa8')]]&&_0x289b7e['linkedid']!==_0x289b7e[_0x0d8b('0xac')]&&!this[_0x0d8b('0x16')][_0x289b7e[_0x0d8b('0xa8')]]['dialAnswer']){if(_0x289b7e[_0x0d8b('0x137')]==='1'){this[_0x0d8b('0x95')](_0x289b7e,_0x289b7e[_0x0d8b('0xa8')],_0x289b7e[_0x0d8b('0x137')]);}}};Preview[_0x0d8b('0xe')][_0x0d8b('0x13f')]=function(_0x2e3310,_0x1742bd,_0x843725){if(this['actions'][_0x2e3310]){if(_['isNil'](this['actions'][_0x2e3310][_0x0d8b('0x140')])){this[_0x0d8b('0x16')][_0x2e3310][_0x0d8b('0x140')]={};}this[_0x0d8b('0x16')][_0x2e3310][_0x0d8b('0x140')][_0x1742bd]=_0x843725;}};Preview[_0x0d8b('0xe')][_0x0d8b('0x25')]=function(_0x1c88ce){try{if(!_[_0x0d8b('0x79')](_0x1c88ce)){if(ut[_0x0d8b('0x141')](_['keys'](_0x1c88ce['variable'])[0x0])){this[_0x0d8b('0x13f')](_0x1c88ce[_0x0d8b('0xac')],_[_0x0d8b('0x142')](_0x1c88ce[_0x0d8b('0x143')])[0x0],_0x1c88ce['value']);}}}catch(_0x5f467e){logger[_0x0d8b('0x144')](_0x0d8b('0x145'),util[_0x0d8b('0x146')](_0x5f467e,{'showHidden':![],'depth':null}));}};Preview[_0x0d8b('0xe')][_0x0d8b('0x27')]=function(_0x51240b){if(_0x51240b){if(this['actions'][_0x51240b[_0x0d8b('0x147')]]){this[_0x0d8b('0x16')][_0x51240b[_0x0d8b('0x147')]][_0x0d8b('0x13b')]=!![];}}};Preview['prototype'][_0x0d8b('0x29')]=function(_0x22e3aa){if(_0x22e3aa){if(this[_0x0d8b('0x16')][_0x22e3aa[_0x0d8b('0x148')]]){this[_0x0d8b('0x16')][_0x22e3aa[_0x0d8b('0x148')]]['transfer']=!![];}}};module[_0x0d8b('0x149')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 5f7ef19..464fca4 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 _0x2bd8=['preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','createHistory','catch','then','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','xcally-motion-preview','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','../../../config/logger'];(function(_0x2c1ce7,_0x407f97){var _0x2b8957=function(_0x4cccc5){while(--_0x4cccc5){_0x2c1ce7['push'](_0x2c1ce7['shift']());}};_0x2b8957(++_0x407f97);}(_0x2bd8,0x130));var _0x82bd=function(_0x30ab36,_0xf101af){_0x30ab36=_0x30ab36-0x0;var _0x20ee37=_0x2bd8[_0x30ab36];return _0x20ee37;};'use strict';var util=require(_0x82bd('0x0'));var BPromise=require('bluebird');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var _=require(_0x82bd('0x3'));var cmHopper=require(_0x82bd('0x4'));var cmHopperFinal=require(_0x82bd('0x5'));var cmHopperHistory=require(_0x82bd('0x6'));var cmHopperBlack=require(_0x82bd('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x82bd('0x8'));var voiceQueueReport=require(_0x82bd('0x9'));function loggerCatch(_0x3bf810){return function(_0x5ceb60){logger[_0x82bd('0xa')](_0x3bf810,util[_0x82bd('0xb')](_0x5ceb60,{'showHidden':![],'depth':null}));};}function create(_0x226f60){return BPromise[_0x82bd('0xc')]()['then'](cmHopperHistory[_0x82bd('0xd')](_0x226f60))['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x51c6ea){return BPromise[_0x82bd('0xc')]()['then'](agentReportPreview['createHistory'](_0x51c6ea))[_0x82bd('0xe')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x4e50da){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper['moveContactManagedDialer'](_0x4e50da,!![]))[_0x82bd('0xe')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x82bd('0x10')]=function(_0x51e17e){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopperBlack[_0x82bd('0x10')](_0x51e17e))[_0x82bd('0xe')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x82bd('0x11')]=function(_0xd43e79){return BPromise['resolve']()[_0x82bd('0xf')](cmHopper['getContactPreview'](_0xd43e79))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x12')));};exports[_0x82bd('0xd')]=function(_0x300982,_0x209081){create(_0x300982)[_0x82bd('0xe')](loggerCatch(_0x209081));moveContact(_0x300982)[_0x82bd('0xe')](loggerCatch(_0x209081));};exports[_0x82bd('0x13')]=function(_0x31a350,_0xf180aa){createAgent(_0x31a350)[_0x82bd('0xe')](loggerCatch(_0xf180aa));};exports[_0x82bd('0x14')]=function(_0x1c3779,_0x253741){create(_0x1c3779)['catch'](loggerCatch(_0x253741));};exports['createCustomerFinal']=function(_0x283ce7,_0x3eb844){moveContact(_0x283ce7)[_0x82bd('0xe')](loggerCatch(_0x3eb844));};exports[_0x82bd('0x15')]=function(_0x34899b,_0x28a706,_0x2c1810){if(_0x28a706){_0x34899b[_0x82bd('0x16')]=null;}if(_0x2c1810){_0x34899b[_0x82bd('0x17')]=![];}return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper[_0x82bd('0x15')](_0x34899b))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x18')));};exports[_0x82bd('0x19')]=function(_0x2d9d95){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper[_0x82bd('0x19')](_0x2d9d95))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x82bd('0x1a')]=function(_0x436ecd){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper[_0x82bd('0x1a')]({'UserId':null},_0x436ecd,0x1))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x1b')));};exports[_0x82bd('0x1c')]=function(_0x2f0bb6){return BPromise[_0x82bd('0xc')]()['then'](cmHopper['unlockContact']({'active':![]},_0x2f0bb6,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x82bd('0x1d')]=function(_0x52bcd8){var _0x351d3d={};_0x351d3d[_0x82bd('0x1e')]=_0x52bcd8[_0x82bd('0x1e')];_0x351d3d['uniqueid']=_0x52bcd8['uniqueid'];_0x351d3d['calleridnum']=_0x52bcd8[_0x82bd('0x1f')];_0x351d3d[_0x82bd('0x20')]=_0x52bcd8[_0x82bd('0x20')];_0x351d3d['queue']=_0x52bcd8[_0x82bd('0x21')];_0x351d3d['queuecallerjoinAt']=_0x52bcd8[_0x82bd('0x22')];_0x351d3d[_0x82bd('0x23')]=_0x52bcd8[_0x82bd('0x22')];_0x351d3d[_0x82bd('0x24')]=0x1;_0x351d3d[_0x82bd('0x25')]=_0x52bcd8[_0x82bd('0x26')];_0x351d3d['connectedlinename']=_0x52bcd8[_0x82bd('0x27')];_0x351d3d[_0x82bd('0x28')]=_0x82bd('0x29');_0x351d3d['exten']=_0x82bd('0x2a');_0x351d3d['holdtime']=0x0;_0x351d3d['assigned']=0x1;_0x351d3d[_0x82bd('0x2b')]=_0x52bcd8[_0x82bd('0x27')];_0x351d3d[_0x82bd('0x2c')]=_0x82bd('0x2d');return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](voiceQueueReport[_0x82bd('0x2e')](_0x351d3d))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x2f')));};exports[_0x82bd('0x30')]=function(_0x1ebf6f,_0xe666bd){return BPromise[_0x82bd('0xc')]()[_0x82bd('0xf')](cmHopper[_0x82bd('0x30')](_0x1ebf6f,_0xe666bd))[_0x82bd('0xe')](loggerCatch(_0x82bd('0x31')));};exports['rescheduleContactInQueue']=function(_0x59b7ca){return BPromise['resolve']()[_0x82bd('0xf')](cmHopper[_0x82bd('0x15')](_0x59b7ca,!![],!![]))['catch'](loggerCatch(_0x82bd('0x32')));}; \ No newline at end of file +var _0x31f0=['calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','../../../config/logger','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x31f0,0xb7));var _0x031f=function(_0x4123a5,_0x4d1eea){_0x4123a5=_0x4123a5-0x0;var _0x4b5803=_0x31f0[_0x4123a5];return _0x4b5803;};'use strict';var util=require(_0x031f('0x0'));var BPromise=require('bluebird');var logger=require(_0x031f('0x1'))('preview');var _=require(_0x031f('0x2'));var cmHopper=require(_0x031f('0x3'));var cmHopperFinal=require(_0x031f('0x4'));var cmHopperHistory=require(_0x031f('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x031f('0x6'));var agentReportPreview=require(_0x031f('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x4c0f94){return function(_0x56328c){logger[_0x031f('0x8')](_0x4c0f94,util['inspect'](_0x56328c,{'showHidden':![],'depth':null}));};}function create(_0x365f59){return BPromise[_0x031f('0x9')]()[_0x031f('0xa')](cmHopperHistory[_0x031f('0xb')](_0x365f59))['catch'](loggerCatch(_0x031f('0xc')));}function createAgent(_0x24145f){return BPromise[_0x031f('0x9')]()[_0x031f('0xa')](agentReportPreview[_0x031f('0xb')](_0x24145f))[_0x031f('0xd')](loggerCatch(_0x031f('0xc')));}function moveContact(_0x3fd541){return BPromise['resolve']()[_0x031f('0xa')](cmHopper[_0x031f('0xe')](_0x3fd541,!![]))[_0x031f('0xd')](loggerCatch(_0x031f('0xf')));}exports[_0x031f('0x10')]=function(_0x405896){return BPromise[_0x031f('0x9')]()['then'](cmHopperBlack[_0x031f('0x10')](_0x405896))[_0x031f('0xd')](loggerCatch(_0x031f('0x11')));};exports[_0x031f('0x12')]=function(_0x2ea549){return BPromise['resolve']()['then'](cmHopper[_0x031f('0x12')](_0x2ea549))[_0x031f('0xd')](loggerCatch(_0x031f('0x13')));};exports[_0x031f('0xb')]=function(_0x5196b1,_0x1dc4a7){create(_0x5196b1)[_0x031f('0xd')](loggerCatch(_0x1dc4a7));moveContact(_0x5196b1)['catch'](loggerCatch(_0x1dc4a7));};exports[_0x031f('0x14')]=function(_0x535e70,_0x421f75){createAgent(_0x535e70)[_0x031f('0xd')](loggerCatch(_0x421f75));};exports[_0x031f('0x15')]=function(_0xaa155,_0x1ceddc){create(_0xaa155)[_0x031f('0xd')](loggerCatch(_0x1ceddc));};exports[_0x031f('0x16')]=function(_0x2825ef,_0xf76f1b){moveContact(_0x2825ef)[_0x031f('0xd')](loggerCatch(_0xf76f1b));};exports[_0x031f('0x17')]=function(_0x48a76e,_0xf72793,_0x33926c){if(_0xf72793){_0x48a76e[_0x031f('0x18')]=null;}if(_0x33926c){_0x48a76e['active']=![];}return BPromise['resolve']()[_0x031f('0xa')](cmHopper['rescheduleContact'](_0x48a76e))[_0x031f('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x47d639){return BPromise[_0x031f('0x9')]()[_0x031f('0xa')](cmHopper[_0x031f('0x19')](_0x47d639))[_0x031f('0xd')](loggerCatch('[countReScheduled]\x20'));};exports[_0x031f('0x1a')]=function(_0x5a64c0){return BPromise[_0x031f('0x9')]()[_0x031f('0xa')](cmHopper[_0x031f('0x1a')]({'UserId':null},_0x5a64c0,0x1))['catch'](loggerCatch(_0x031f('0x1b')));};exports[_0x031f('0x1c')]=function(_0x54b44e){return BPromise[_0x031f('0x9')]()[_0x031f('0xa')](cmHopper[_0x031f('0x1a')]({'active':![]},_0x54b44e,0x1))['catch'](loggerCatch(_0x031f('0x1d')));};exports[_0x031f('0x1e')]=function(_0xb6ed6c){var _0xaf5bea={};_0xaf5bea[_0x031f('0x1f')]=_0xb6ed6c[_0x031f('0x1f')];_0xaf5bea['uniqueid']=_0xb6ed6c[_0x031f('0x20')];_0xaf5bea[_0x031f('0x21')]=_0xb6ed6c[_0x031f('0x21')];_0xaf5bea[_0x031f('0x22')]=_0xb6ed6c[_0x031f('0x22')];_0xaf5bea[_0x031f('0x23')]=_0xb6ed6c[_0x031f('0x23')];_0xaf5bea[_0x031f('0x24')]=_0xb6ed6c[_0x031f('0x25')];_0xaf5bea[_0x031f('0x26')]=_0xb6ed6c[_0x031f('0x25')];_0xaf5bea['queuecallercomplete']=0x1;_0xaf5bea[_0x031f('0x27')]=_0xb6ed6c[_0x031f('0x28')];_0xaf5bea[_0x031f('0x29')]=_0xb6ed6c[_0x031f('0x2a')];_0xaf5bea[_0x031f('0x2b')]=_0x031f('0x2c');_0xaf5bea[_0x031f('0x2d')]=_0x031f('0x2e');_0xaf5bea[_0x031f('0x2f')]=0x0;_0xaf5bea[_0x031f('0x30')]=0x1;_0xaf5bea[_0x031f('0x31')]=_0xb6ed6c[_0x031f('0x2a')];_0xaf5bea[_0x031f('0x32')]='COMPLETED';return BPromise[_0x031f('0x9')]()[_0x031f('0xa')](voiceQueueReport['create'](_0xaf5bea))[_0x031f('0xd')](loggerCatch(_0x031f('0x33')));};exports['getContactRecallMe']=function(_0x17b93c,_0x22e486){return BPromise[_0x031f('0x9')]()[_0x031f('0xa')](cmHopper['getContactRecallMe'](_0x17b93c,_0x22e486))['catch'](loggerCatch(_0x031f('0x34')));};exports['rescheduleContactInQueue']=function(_0x43ab76){return BPromise[_0x031f('0x9')]()[_0x031f('0xa')](cmHopper['rescheduleContact'](_0x43ab76,!![],!![]))['catch'](loggerCatch(_0x031f('0x35')));}; \ 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 5299c83..0389b41 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 _0x4643=['loggerCatch','error','logger','info','loggerError','inspect','logger2','message','getCallerId','isUndefined','isEmpty','\x22%s\x22\x20<%s>','format','string','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','responsetime','logLookAgent','ringtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','channelAgent','xcally-motion-preview','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','buildObj','name','queue','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','push','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','callback','callbackuniqueid','callbackat','UserId','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','util','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds'];(function(_0x5511a4,_0xb62bf3){var _0x8563aa=function(_0x5104bf){while(--_0x5104bf){_0x5511a4['push'](_0x5511a4['shift']());}};_0x8563aa(++_0xb62bf3);}(_0x4643,0x10a));var _0x3464=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x4643[_0x51020b];return _0x371e47;};'use strict';var util=require(_0x3464('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x3464('0x1'))(_0x3464('0x2'));var ipAgi=process['env'][_0x3464('0x3')]||_0x3464('0x4');function getSeconds(_0x36b67e,_0x21bf34){var _0x475dd7=moment(_0x36b67e)[_0x3464('0x5')](0x0);var _0x132c98=moment(_0x21bf34)[_0x3464('0x5')](0x0);return _0x475dd7[_0x3464('0x6')](_0x132c98,_0x3464('0x7'));}exports[_0x3464('0x8')]=function(_0x7d543f){return function(_0x4bafb0){logger[_0x3464('0x9')](_0x7d543f,util['inspect'](_0x4bafb0,{'showHidden':![],'depth':null}));};};exports[_0x3464('0xa')]=function(_0x2d62eb,_0x297efe){logger[_0x3464('0xb')](_0x2d62eb,util['inspect'](_0x297efe,{'showHidden':![],'depth':null}));};exports[_0x3464('0xc')]=function(_0xfc7797,_0x13fcc5){logger[_0x3464('0x9')](_0xfc7797,util[_0x3464('0xd')](_0x13fcc5,{'showHidden':![],'depth':null}));};exports[_0x3464('0xe')]=function(_0xcf7409){return function(_0x1ec329){logger[_0x3464('0xb')](_0xcf7409,util['inspect'](_0x1ec329,{'showHidden':![],'depth':null}));};};exports[_0x3464('0xf')]=function(_0x1db374,_0x5beb82,_0x5730f9){return{'message':_0x1db374,'unlock':_0x5beb82,'active':_0x5730f9};};exports[_0x3464('0x10')]=function(_0x15aef9,_0x321a6c,_0x7d05e0){if(!_[_0x3464('0x11')](_0x7d05e0)&&'string'===typeof _0x7d05e0&&!_[_0x3464('0x12')](_0x7d05e0)){if(!_[_0x3464('0x11')](_0x321a6c)&&'string'===typeof _0x321a6c&&!_[_0x3464('0x12')](_0x321a6c)){return util['format'](_0x3464('0x13'),_0x321a6c,_0x7d05e0);}return util[_0x3464('0x14')](_0x3464('0x13'),_0x7d05e0,_0x7d05e0);}if(!_[_0x3464('0x11')](_0x15aef9)&&_0x3464('0x15')===typeof _0x15aef9&&!_[_0x3464('0x12')](_0x15aef9)){return _0x15aef9;}return _0x3464('0x16');};exports[_0x3464('0x17')]=function(_0x1b3ed5){if(_[_0x3464('0x18')](_0x1b3ed5)){return![];}return _0x1b3ed5;};exports[_0x3464('0x19')]=function(_0xc6a699,_0x373cd3,_0x2119f3,_0x457a4a,_0x502873,_0x2fd518){var _0x2a1d5a={'XMD-QUEUE':_0x373cd3[_0x3464('0x1a')]?_0x373cd3[_0x3464('0x1a')]['name']:'','XMD-CALLERID':_0x457a4a,'XMD-CALLERID-PREVIEW':_0x2fd518?util[_0x3464('0x14')](_0x3464('0x13'),_0x2fd518[_0x3464('0x1b')],_0x2fd518[_0x3464('0x1c')]):_0x457a4a,'XMD-DIALID':_0x502873,'XMD-CONTACTID':_0x373cd3[_0x3464('0x1d')],'XMD-CDRTYPE':_0x3464('0x1e'),'CALLERID(all)':_0x457a4a,'XMD-VOICEQUEUEID':_0x373cd3[_0x3464('0x1f')],'XMD-DIALCHANNEL':_0x2119f3,'XMD-DIALTIMEOUT':_0xc6a699[_0x3464('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x3464('0x14')](_0x3464('0x21'),_0xc6a699[_0x3464('0x22')]?'g':'',_[_0x3464('0x12')](_0xc6a699[_0x3464('0x23')])?'':_0x3464('0x24')),'XMD-DIALURL':_0xc6a699[_0x3464('0x25')]||'','XMD-AGI':_0xc6a699[_0x3464('0x26')]?util[_0x3464('0x14')](_0x3464('0x27'),ipAgi,_0xc6a699[_0x3464('0x26')]):'NONE','XMD-AGIAFTER':_0xc6a699['dialQueueProject2']?util[_0x3464('0x14')](_0x3464('0x27'),ipAgi,_0xc6a699['dialQueueProject2']):_0x3464('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x2fd518?_0x2fd518[_0x3464('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x2fd518?_0x2fd518['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x3464('0x12')](_0xc6a699['monitor_format'])){_0x2a1d5a[util[_0x3464('0x14')]('%s',_0x3464('0x2a'))]=_0xc6a699['monitor_format'];_0x2a1d5a[util[_0x3464('0x14')]('%s',_0x3464('0x2b'))]=_0x502873;}if(_0x373cd3&&_0x373cd3[_0x3464('0x2c')]){for(var _0x112100 in _0x373cd3[_0x3464('0x2c')]){if(_0x373cd3[_0x3464('0x2c')][_0x3464('0x2d')](_0x112100)){if(!_[_0x3464('0x18')](_0x373cd3[_0x3464('0x2c')][_0x112100])&&_0x112100!=='id'&&_0x112100!=='tags'&&_0x112100!=='createdAt'&&_0x112100!==_0x3464('0x2e')){_0x2a1d5a[util[_0x3464('0x14')](_0x3464('0x2f'),_0x3464('0x30'),_[_0x3464('0x31')](_0x112100))]=_0x373cd3[_0x3464('0x2c')][_0x112100];}}}}return _0x2a1d5a;};exports['toLowerVariables']=function(_0x1ccb53){var _0x578a3d={};for(var _0x4e91e6 in _0x1ccb53){if(_0x1ccb53['hasOwnProperty'](_0x4e91e6)){_0x578a3d[util[_0x3464('0x14')]('%s',_[_0x3464('0x32')](_0x4e91e6))]=_0x1ccb53[_0x4e91e6];}}return{'variables':_0x578a3d};};exports['updateOriginated']=function(_0xc00212,_0x6674dd){if(!_[_0x3464('0x18')](_0xc00212)){if(_0xc00212[_0x3464('0x2d')]('originated')){if(_0xc00212[_0x3464('0x33')]>0x0){_0xc00212[_0x3464('0x33')]-=0x1;}else{logger[_0x3464('0x9')](_0x3464('0x34'),_0x6674dd);}}}else{logger[_0x3464('0x9')](_0x3464('0x35'),_0x6674dd);}};exports[_0x3464('0x36')]=function(_0x1faec6){var _0x13f416=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1faec6[_0x3464('0x37')]=0xd;_0x1faec6[_0x3464('0x38')]='Blacklist';_0x1faec6[_0x3464('0x39')]=_0x13f416;_0x1faec6['responsetime']=_0x13f416;_0x1faec6[_0x3464('0x3a')]=_0x13f416;};exports['logAgent']=function(_0x15aedf,_0xca8288,_0x485e25){var _0x1a662b=moment()[_0x3464('0x14')](_0x3464('0x3b'));_0x15aedf['state']=_0xca8288;_0x15aedf[_0x3464('0x38')]=_0x485e25;_0x15aedf[_0x3464('0x3c')]=_0x1a662b;_0x15aedf['ringtime']=getSeconds(_0x15aedf[_0x3464('0x3c')],_0x15aedf[_0x3464('0x39')]);};exports[_0x3464('0x3d')]=function(_0x2cb02a,_0x29d4e4,_0x5727b8){_0x2cb02a['membername']=_0x29d4e4;_0x2cb02a['UserId']=_0x5727b8;};exports['logCustomer']=function(_0x256765,_0x58374a,_0x4cdf1d){var _0x1fdfff=moment()[_0x3464('0x14')](_0x3464('0x3b'));_0x256765['state']=_0x58374a;_0x256765[_0x3464('0x38')]=_0x4cdf1d;_0x256765['responsetime']=_0x256765[_0x3464('0x3c')]?_0x256765[_0x3464('0x3c')]:_0x1fdfff;_0x256765[_0x3464('0x3a')]=_0x256765[_0x3464('0x3a')]?_0x256765[_0x3464('0x3a')]:_0x1fdfff;_0x256765[_0x3464('0x3e')]=getSeconds(_0x256765[_0x3464('0x3c')]||0x0,_0x256765[_0x3464('0x39')]||0x0);_0x256765[_0x3464('0x3f')]=_0x256765[_0x3464('0x40')]?getSeconds(_0x256765[_0x3464('0x3a')],_0x256765[_0x3464('0x40')]):0x0;};exports[_0x3464('0x41')]=function(_0x19b651){return _0x19b651===_0x3464('0x42');};exports[_0x3464('0x43')]=function(_0x380223,_0x3e518e,_0x33dba2,_0x19568a,_0x502763){var _0x53f184=_0x19568a?_0x3464('0x44'):_0x380223['calleridname'];_0x53f184=_0x502763?_0x3464('0x45'):_0x53f184;return{'actionid':_0x380223[_0x3464('0x46')],'action':'originate','channel':_0x380223[_0x3464('0x47')],'callerid':util['format'](_0x3464('0x13'),_0x53f184,_0x380223[_0x3464('0x1c')]),'Exten':_0x3464('0x48'),'Context':_0x3464('0x49'),'Priority':'1','variable':_0x33dba2,'timeout':(_0x3e518e['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x380223[_0x3464('0x46')]};};exports['totalGlobal']=function(_0x428bcf){return _0x428bcf[_0x3464('0x4a')]+_0x428bcf[_0x3464('0x4b')]+_0x428bcf[_0x3464('0x4c')]+_0x428bcf['countagentrejectretry']+_0x428bcf[_0x3464('0x4d')];};exports['cloneAction']=function(_0x1f4509){var _0x2c7931=_[_0x3464('0x4e')](_0x1f4509);_0x2c7931[_0x3464('0x37')]=0xf;_0x2c7931[_0x3464('0x38')]=_0x3464('0x4f');return _0x2c7931;};exports['scheduledAt']=function(_0x253751,_0x42eab5,_0xb081cc){var _0x2c481e={};_0x2c481e[_0x42eab5]=_0x253751[_0x42eab5];_0x2c481e[_0x3464('0x50')]=![];_0x2c481e[_0x3464('0x51')]=moment()[_0x3464('0x52')](_0xb081cc,_0x3464('0x53'))['format'](_0x3464('0x3b'));_0x2c481e[_0x3464('0x1d')]=_0x253751[_0x3464('0x1d')];_0x2c481e[_0x3464('0x54')]=_0x253751['ListId'];_0x2c481e[_0x3464('0x1f')]=_0x253751[_0x3464('0x1f')]||undefined;return _0x2c481e;};exports[_0x3464('0x55')]=function(_0x440b98,_0x4c9cdf){if(!_[_0x3464('0x18')](_0x440b98)){if(_0x440b98['pTalking']>0x0){_0x440b98[_0x3464('0x56')]-=0x1;}else{logger['error'](_0x4c9cdf,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x3464('0x9')](_0x4c9cdf,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x1c3c3d){if(_0x1c3c3d<=0x0){return!![];}return![];};exports[_0x3464('0x57')]=function(_0x4309c3,_0x48e636,_0x45fa60){_0x4309c3['lastevent']=_0x48e636;_0x4309c3[_0x3464('0x58')]=_0x4309c3[_0x3464('0x59')];_0x4309c3['interface']=_0x4309c3[_0x3464('0x47')];if(_0x45fa60){_0x4309c3[_0x3464('0x5a')]=_0x45fa60[_0x3464('0x5a')];}return _0x4309c3;};exports[_0x3464('0x5b')]=function(_0x37a82d){var _0x4160ba={};_0x4160ba[_0x3464('0x59')]=_0x37a82d[_0x3464('0x59')];_0x4160ba[_0x3464('0x5c')]=_0x37a82d[_0x3464('0x47')];_0x4160ba[_0x3464('0x46')]=_0x37a82d['uniqueid'];return _0x4160ba;};exports[_0x3464('0x5d')]=function(_0x1e3c9c){var _0x3ff84f=[];for(var _0x13028c in _0x1e3c9c){if(_0x1e3c9c[_0x3464('0x2d')](_0x13028c)){if(!_[_0x3464('0x18')](_0x1e3c9c[_0x13028c])&&_0x1e3c9c[_0x13028c][_0x3464('0x37')]===_0x3464('0x5e')&&_0x1e3c9c[_0x13028c][_0x3464('0x5f')]==='reachable'){_0x3ff84f[_0x3464('0x60')](_0x1e3c9c[_0x13028c]['id']);}}}return _0x3ff84f;};exports['getDiff']=function(_0x4f351c){var _0x193b63=moment()[_0x3464('0x5')](0x0);var _0x52691f=moment(_0x4f351c)['milliseconds'](0x0);return _0x193b63['diff'](_0x52691f,'seconds');};exports[_0x3464('0x61')]=function(_0x5b7158){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5b7158[_0x3464('0x1d')],'ListId':_0x5b7158[_0x3464('0x54')],'VoiceQueueId':_0x5b7158['VoiceQueueId']||undefined,'CampaignId':_0x5b7158[_0x3464('0x62')]||undefined};};exports[_0x3464('0x63')]=function(_0x36f934){if(_0x36f934===_0x3464('0x46')||_0x36f934===_0x3464('0x64')||_0x36f934===_0x3464('0x59')||_0x36f934===_0x3464('0x65')||_0x36f934===_0x3464('0x66')||_0x36f934===_0x3464('0x67')||_0x36f934===_0x3464('0x68')||_0x36f934===_0x3464('0x47')||_0x36f934===_0x3464('0x1b')||_0x36f934===_0x3464('0x50')||_0x36f934===_0x3464('0x1c')||_0x36f934===_0x3464('0x51')||_0x36f934==='countbusyretry'||_0x36f934===_0x3464('0x4b')||_0x36f934===_0x3464('0x4c')||_0x36f934==='countglobal'||_0x36f934===_0x3464('0x69')||_0x36f934===_0x3464('0x6a')||_0x36f934===_0x3464('0x6b')||_0x36f934==='recallme'||_0x36f934===_0x3464('0x1d')||_0x36f934===_0x3464('0x54')||_0x36f934===_0x3464('0x6c')||_0x36f934==='VoiceQueueId'||_0x36f934===_0x3464('0x6d')||_0x36f934==='xmd-voicequeueid'||_0x36f934==='xmd-queue'||_0x36f934===_0x3464('0x6e')||_0x36f934===_0x3464('0x6f')||_0x36f934===_0x3464('0x70')||_0x36f934===_0x3464('0x71')||_0x36f934===_0x3464('0x72')||_0x36f934==='xmd-dialid'||_0x36f934===_0x3464('0x73')||_0x36f934==='xmd-contactid'||_0x36f934===_0x3464('0x74')||_0x36f934===_0x3464('0x75')||_0x36f934===_0x3464('0x76')||_0x36f934===_0x3464('0x77')||_0x36f934==='rtpaudioqos'||_0x36f934===_0x3464('0x78')||_0x36f934===_0x3464('0x79')||_0x36f934===_0x3464('0x7a')||_0x36f934===_0x3464('0x7b')||_0x36f934===_0x3464('0x7c')||_0x36f934===_0x3464('0x7d')||_0x36f934===_0x3464('0x7e')||_0x36f934===_0x3464('0x7f')||_0x36f934===_0x3464('0x78')||_0x36f934==='rtpaudioqosjitter'||_0x36f934==='rtpaudioqosjitterbridged'||_0x36f934===_0x3464('0x7b')||_0x36f934===_0x3464('0x7c')||_0x36f934==='rtpaudioqosrtt'||_0x36f934==='rtpaudioqosrttbridged'||_0x36f934===_0x3464('0x80')||_0x36f934===_0x3464('0x81')||_0x36f934===_0x3464('0x37')||_0x36f934===_0x3464('0x38')){return![];}return!![];};exports[_0x3464('0x82')]=function(_0x3ea6e0,_0xf71188){var _0x3e974c,_0x40083a,_0x2293d3;if(_0xf71188<=0x0){_0xf71188=0x1;}_0x3e974c=new RegExp(_0x3464('0x83')+_0xf71188+'}$');_0x40083a=Math[_0x3464('0x84')](0xa,_0xf71188-0x1);_0x2293d3=Math[_0x3464('0x84')](0xa,_0xf71188)-0x1;return util[_0x3464('0x14')]('%s',_[_0x3464('0x85')](_0x3ea6e0,_0x3e974c,_['random'](_0x40083a,_0x2293d3)));};exports[_0x3464('0x86')]=function(_0x41d53e){var _0x50349c=_0x41d53e[_0x3464('0x87')](/"(.*?)"/);return _0x50349c?_0x50349c[0x1]:_0x41d53e;};exports[_0x3464('0x88')]=function(_0x4cca05){var _0x2e497d=_0x4cca05[_0x3464('0x87')](/<(.*?)>/);return _0x2e497d?_0x2e497d[0x1]:_0x4cca05;}; \ No newline at end of file +var _0x1c35=['dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','variablesAction','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','not_inuse','reachable','push','getDiff','diff','CampaignId','idContact','type','dialAnswer','membername','callback','callbackat','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','error','inspect','logger','loggerError','logger2','info','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','monitor_format','U(xcally-mixmonitor-context)'];(function(_0x480e70,_0xa26e89){var _0x5a8d51=function(_0xbe61c){while(--_0xbe61c){_0x480e70['push'](_0x480e70['shift']());}};_0x5a8d51(++_0xa26e89);}(_0x1c35,0x66));var _0x51c3=function(_0x36af45,_0x168bdd){_0x36af45=_0x36af45-0x0;var _0x1b42fb=_0x1c35[_0x36af45];return _0x1b42fb;};'use strict';var util=require('util');var _=require(_0x51c3('0x0'));var moment=require(_0x51c3('0x1'));var logger=require(_0x51c3('0x2'))(_0x51c3('0x3'));var ipAgi=process[_0x51c3('0x4')][_0x51c3('0x5')]||_0x51c3('0x6');function getSeconds(_0x1e216e,_0x19d0cc){var _0x5ba193=moment(_0x1e216e)[_0x51c3('0x7')](0x0);var _0x16ee3c=moment(_0x19d0cc)['milliseconds'](0x0);return _0x5ba193['diff'](_0x16ee3c,'seconds');}exports['loggerCatch']=function(_0x394c11){return function(_0xd9cf3c){logger[_0x51c3('0x8')](_0x394c11,util[_0x51c3('0x9')](_0xd9cf3c,{'showHidden':![],'depth':null}));};};exports[_0x51c3('0xa')]=function(_0x5178a1,_0x6568fd){logger['info'](_0x5178a1,util[_0x51c3('0x9')](_0x6568fd,{'showHidden':![],'depth':null}));};exports[_0x51c3('0xb')]=function(_0x332b7b,_0x3a5de8){logger[_0x51c3('0x8')](_0x332b7b,util[_0x51c3('0x9')](_0x3a5de8,{'showHidden':![],'depth':null}));};exports[_0x51c3('0xc')]=function(_0x58a01d){return function(_0x21c77b){logger[_0x51c3('0xd')](_0x58a01d,util[_0x51c3('0x9')](_0x21c77b,{'showHidden':![],'depth':null}));};};exports[_0x51c3('0xe')]=function(_0x1f5bd7,_0xebc24,_0x1511c4){return{'message':_0x1f5bd7,'unlock':_0xebc24,'active':_0x1511c4};};exports[_0x51c3('0xf')]=function(_0x5d9889,_0x1a5eae,_0x3083f5){if(!_[_0x51c3('0x10')](_0x3083f5)&&'string'===typeof _0x3083f5&&!_[_0x51c3('0x11')](_0x3083f5)){if(!_[_0x51c3('0x10')](_0x1a5eae)&&_0x51c3('0x12')===typeof _0x1a5eae&&!_[_0x51c3('0x11')](_0x1a5eae)){return util[_0x51c3('0x13')]('\x22%s\x22\x20<%s>',_0x1a5eae,_0x3083f5);}return util[_0x51c3('0x13')](_0x51c3('0x14'),_0x3083f5,_0x3083f5);}if(!_['isUndefined'](_0x5d9889)&&_0x51c3('0x12')===typeof _0x5d9889&&!_[_0x51c3('0x11')](_0x5d9889)){return _0x5d9889;}return _0x51c3('0x15');};exports[_0x51c3('0x16')]=function(_0x411f01){if(_[_0x51c3('0x17')](_0x411f01)){return![];}return _0x411f01;};exports['addVariables']=function(_0x239cb7,_0x53a6b9,_0x3829d9,_0x2a6ce1,_0x88439e,_0xe04d93){var _0x3c60d9={'XMD-QUEUE':_0x53a6b9['Queue']?_0x53a6b9[_0x51c3('0x18')][_0x51c3('0x19')]:'','XMD-CALLERID':_0x2a6ce1,'XMD-CALLERID-PREVIEW':_0xe04d93?util[_0x51c3('0x13')]('\x22%s\x22\x20<%s>',_0xe04d93[_0x51c3('0x1a')],_0xe04d93[_0x51c3('0x1b')]):_0x2a6ce1,'XMD-DIALID':_0x88439e,'XMD-CONTACTID':_0x53a6b9[_0x51c3('0x1c')],'XMD-CDRTYPE':_0x51c3('0x1d'),'CALLERID(all)':_0x2a6ce1,'XMD-VOICEQUEUEID':_0x53a6b9[_0x51c3('0x1e')],'XMD-DIALCHANNEL':_0x3829d9,'XMD-DIALTIMEOUT':_0x239cb7['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x51c3('0x13')]('\x22rtTxX%s%s\x22',_0x239cb7['dialQueueProject2']?'g':'',_[_0x51c3('0x11')](_0x239cb7[_0x51c3('0x1f')])?'':_0x51c3('0x20')),'XMD-DIALURL':_0x239cb7[_0x51c3('0x21')]||'','XMD-AGI':_0x239cb7[_0x51c3('0x22')]?util['format'](_0x51c3('0x23'),ipAgi,_0x239cb7[_0x51c3('0x22')]):_0x51c3('0x24'),'XMD-AGIAFTER':_0x239cb7['dialQueueProject2']?util[_0x51c3('0x13')](_0x51c3('0x23'),ipAgi,_0x239cb7[_0x51c3('0x25')]):_0x51c3('0x24'),'XMD-ORIGINATECALLERIDNUM':_0xe04d93?_0xe04d93[_0x51c3('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0xe04d93?_0xe04d93[_0x51c3('0x27')]:'','XMD-DESTINATION':_0x51c3('0x28')};if(!_[_0x51c3('0x11')](_0x239cb7[_0x51c3('0x1f')])){_0x3c60d9[util['format']('%s',_0x51c3('0x29'))]=_0x239cb7[_0x51c3('0x1f')];_0x3c60d9[util['format']('%s',_0x51c3('0x2a'))]=_0x88439e;}if(_0x53a6b9&&_0x53a6b9['Contact']){for(var _0x2ea266 in _0x53a6b9[_0x51c3('0x2b')]){if(_0x53a6b9[_0x51c3('0x2b')][_0x51c3('0x2c')](_0x2ea266)){if(!_['isNil'](_0x53a6b9[_0x51c3('0x2b')][_0x2ea266])&&_0x2ea266!=='id'&&_0x2ea266!=='tags'&&_0x2ea266!==_0x51c3('0x2d')&&_0x2ea266!==_0x51c3('0x2e')){_0x3c60d9[util[_0x51c3('0x13')](_0x51c3('0x2f'),_0x51c3('0x30'),_['toUpper'](_0x2ea266))]=_0x53a6b9['Contact'][_0x2ea266];}}}}return _0x3c60d9;};exports[_0x51c3('0x31')]=function(_0x2d8065){var _0xa96cc={};for(var _0x3dfef1 in _0x2d8065){if(_0x2d8065[_0x51c3('0x2c')](_0x3dfef1)){_0xa96cc[util[_0x51c3('0x13')]('%s',_[_0x51c3('0x32')](_0x3dfef1))]=_0x2d8065[_0x3dfef1];}}return{'variables':_0xa96cc};};exports[_0x51c3('0x33')]=function(_0x207f7d,_0x2bc30c){if(!_[_0x51c3('0x17')](_0x207f7d)){if(_0x207f7d[_0x51c3('0x2c')](_0x51c3('0x34'))){if(_0x207f7d['originated']>0x0){_0x207f7d[_0x51c3('0x34')]-=0x1;}else{logger[_0x51c3('0x8')](_0x51c3('0x35'),_0x2bc30c);}}}else{logger[_0x51c3('0x8')](_0x51c3('0x36'),_0x2bc30c);}};exports[_0x51c3('0x37')]=function(_0x1a9574){var _0x5470bb=moment()[_0x51c3('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a9574[_0x51c3('0x38')]=0xd;_0x1a9574[_0x51c3('0x39')]=_0x51c3('0x3a');_0x1a9574[_0x51c3('0x3b')]=_0x5470bb;_0x1a9574[_0x51c3('0x3c')]=_0x5470bb;_0x1a9574[_0x51c3('0x3d')]=_0x5470bb;};exports['logAgent']=function(_0x429487,_0x1c8ca8,_0x230f2a){var _0x27d289=moment()[_0x51c3('0x13')](_0x51c3('0x3e'));_0x429487[_0x51c3('0x38')]=_0x1c8ca8;_0x429487[_0x51c3('0x39')]=_0x230f2a;_0x429487[_0x51c3('0x3c')]=_0x27d289;_0x429487[_0x51c3('0x3f')]=getSeconds(_0x429487[_0x51c3('0x3c')],_0x429487['starttime']);};exports[_0x51c3('0x40')]=function(_0x50d259,_0x56c824,_0x5ed25a){_0x50d259['membername']=_0x56c824;_0x50d259[_0x51c3('0x41')]=_0x5ed25a;};exports[_0x51c3('0x42')]=function(_0xb45815,_0xc69450,_0x288ba4){var _0x383507=moment()[_0x51c3('0x13')](_0x51c3('0x3e'));_0xb45815[_0x51c3('0x38')]=_0xc69450;_0xb45815[_0x51c3('0x39')]=_0x288ba4;_0xb45815[_0x51c3('0x3c')]=_0xb45815['responsetime']?_0xb45815[_0x51c3('0x3c')]:_0x383507;_0xb45815[_0x51c3('0x3d')]=_0xb45815[_0x51c3('0x3d')]?_0xb45815[_0x51c3('0x3d')]:_0x383507;_0xb45815[_0x51c3('0x3f')]=getSeconds(_0xb45815[_0x51c3('0x3c')]||0x0,_0xb45815[_0x51c3('0x3b')]||0x0);_0xb45815[_0x51c3('0x43')]=_0xb45815['answertime']?getSeconds(_0xb45815[_0x51c3('0x3d')],_0xb45815[_0x51c3('0x44')]):0x0;};exports[_0x51c3('0x45')]=function(_0xe81fba){return _0xe81fba==='Failure';};exports[_0x51c3('0x46')]=function(_0x3f1af8,_0xed10cc,_0x5a6778,_0x36dc27,_0x571899){var _0x821a6c=_0x36dc27?'RECALL':_0x3f1af8[_0x51c3('0x1a')];_0x821a6c=_0x571899?'BOOKED':_0x821a6c;return{'actionid':_0x3f1af8[_0x51c3('0x47')],'action':_0x51c3('0x48'),'channel':_0x3f1af8[_0x51c3('0x49')],'callerid':util[_0x51c3('0x13')](_0x51c3('0x14'),_0x821a6c,_0x3f1af8[_0x51c3('0x1b')]),'Exten':_0x51c3('0x28'),'Context':_0x51c3('0x4a'),'Priority':'1','variable':_0x5a6778,'timeout':(_0xed10cc[_0x51c3('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f1af8[_0x51c3('0x47')]};};exports['totalGlobal']=function(_0x90f20d){return _0x90f20d[_0x51c3('0x4c')]+_0x90f20d[_0x51c3('0x4d')]+_0x90f20d[_0x51c3('0x4e')]+_0x90f20d[_0x51c3('0x4f')]+_0x90f20d[_0x51c3('0x50')];};exports['cloneAction']=function(_0x326426){var _0x5e24e7=_['clone'](_0x326426);_0x5e24e7[_0x51c3('0x38')]=0xf;_0x5e24e7['statedesc']=_0x51c3('0x51');return _0x5e24e7;};exports[_0x51c3('0x52')]=function(_0x115c36,_0x1eb2ea,_0x32c568){var _0x3b5b76={};_0x3b5b76[_0x1eb2ea]=_0x115c36[_0x1eb2ea];_0x3b5b76[_0x51c3('0x53')]=![];_0x3b5b76[_0x51c3('0x54')]=moment()[_0x51c3('0x55')](_0x32c568,_0x51c3('0x56'))[_0x51c3('0x13')](_0x51c3('0x3e'));_0x3b5b76[_0x51c3('0x1c')]=_0x115c36[_0x51c3('0x1c')];_0x3b5b76[_0x51c3('0x57')]=_0x115c36[_0x51c3('0x57')];_0x3b5b76[_0x51c3('0x1e')]=_0x115c36[_0x51c3('0x1e')]||undefined;return _0x3b5b76;};exports[_0x51c3('0x58')]=function(_0x24f9cd,_0x3a5375){if(!_[_0x51c3('0x17')](_0x24f9cd)){if(_0x24f9cd['pTalking']>0x0){_0x24f9cd[_0x51c3('0x59')]-=0x1;}else{logger[_0x51c3('0x8')](_0x3a5375,_0x51c3('0x5a'));}}else{logger[_0x51c3('0x8')](_0x3a5375,_0x51c3('0x5b'));}};exports[_0x51c3('0x5c')]=function(_0x9e1902){if(_0x9e1902<=0x0){return!![];}return![];};exports[_0x51c3('0x5d')]=function(_0x1184aa,_0x22d4e9,_0x2fa6d4){_0x1184aa[_0x51c3('0x5e')]=_0x22d4e9;_0x1184aa[_0x51c3('0x19')]=_0x1184aa[_0x51c3('0x5f')];_0x1184aa[_0x51c3('0x60')]=_0x1184aa[_0x51c3('0x49')];if(_0x2fa6d4){_0x1184aa['mandatoryDisposition']=_0x2fa6d4[_0x51c3('0x61')];}return _0x1184aa;};exports[_0x51c3('0x62')]=function(_0x3ac0d1){var _0x4a7c93={};_0x4a7c93[_0x51c3('0x5f')]=_0x3ac0d1[_0x51c3('0x5f')];_0x4a7c93[_0x51c3('0x60')]=_0x3ac0d1[_0x51c3('0x49')];_0x4a7c93[_0x51c3('0x47')]=_0x3ac0d1[_0x51c3('0x47')];return _0x4a7c93;};exports['agentReadyId']=function(_0x24f1e3){var _0x5cc4f5=[];for(var _0x2763db in _0x24f1e3){if(_0x24f1e3[_0x51c3('0x2c')](_0x2763db)){if(!_['isNil'](_0x24f1e3[_0x2763db])&&_0x24f1e3[_0x2763db][_0x51c3('0x38')]===_0x51c3('0x63')&&_0x24f1e3[_0x2763db]['status']===_0x51c3('0x64')){_0x5cc4f5[_0x51c3('0x65')](_0x24f1e3[_0x2763db]['id']);}}}return _0x5cc4f5;};exports[_0x51c3('0x66')]=function(_0x67a67){var _0x57b794=moment()['milliseconds'](0x0);var _0x7271a3=moment(_0x67a67)[_0x51c3('0x7')](0x0);return _0x57b794[_0x51c3('0x67')](_0x7271a3,'seconds');};exports['createBody']=function(_0x22bceb){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x22bceb[_0x51c3('0x1c')],'ListId':_0x22bceb['ListId'],'VoiceQueueId':_0x22bceb[_0x51c3('0x1e')]||undefined,'CampaignId':_0x22bceb[_0x51c3('0x68')]||undefined};};exports['filterKey']=function(_0x421eae){if(_0x421eae===_0x51c3('0x47')||_0x421eae===_0x51c3('0x69')||_0x421eae===_0x51c3('0x5f')||_0x421eae===_0x51c3('0x6a')||_0x421eae==='campaigntype'||_0x421eae===_0x51c3('0x6b')||_0x421eae===_0x51c3('0x6c')||_0x421eae==='channelAgent'||_0x421eae===_0x51c3('0x1a')||_0x421eae==='active'||_0x421eae===_0x51c3('0x1b')||_0x421eae===_0x51c3('0x54')||_0x421eae==='countbusyretry'||_0x421eae==='countcongestionretry'||_0x421eae==='countnoanswerretry'||_0x421eae==='countglobal'||_0x421eae===_0x51c3('0x6d')||_0x421eae==='callbackuniqueid'||_0x421eae===_0x51c3('0x6e')||_0x421eae==='recallme'||_0x421eae===_0x51c3('0x1c')||_0x421eae===_0x51c3('0x57')||_0x421eae===_0x51c3('0x41')||_0x421eae==='VoiceQueueId'||_0x421eae===_0x51c3('0x6f')||_0x421eae===_0x51c3('0x70')||_0x421eae===_0x51c3('0x71')||_0x421eae===_0x51c3('0x72')||_0x421eae===_0x51c3('0x73')||_0x421eae===_0x51c3('0x74')||_0x421eae===_0x51c3('0x75')||_0x421eae==='xmd-dialoptions'||_0x421eae==='xmd-dialid'||_0x421eae===_0x51c3('0x76')||_0x421eae==='xmd-contactid'||_0x421eae===_0x51c3('0x77')||_0x421eae===_0x51c3('0x78')||_0x421eae===_0x51c3('0x79')||_0x421eae===_0x51c3('0x7a')||_0x421eae==='rtpaudioqos'||_0x421eae===_0x51c3('0x7b')||_0x421eae===_0x51c3('0x7c')||_0x421eae===_0x51c3('0x7d')||_0x421eae===_0x51c3('0x7e')||_0x421eae===_0x51c3('0x7f')||_0x421eae===_0x51c3('0x80')||_0x421eae==='rtpaudioqosrttbridged'||_0x421eae==='rtpaudioqos'||_0x421eae===_0x51c3('0x7b')||_0x421eae==='rtpaudioqosjitter'||_0x421eae===_0x51c3('0x7d')||_0x421eae===_0x51c3('0x7e')||_0x421eae===_0x51c3('0x7f')||_0x421eae===_0x51c3('0x80')||_0x421eae===_0x51c3('0x81')||_0x421eae==='bridgepeer'||_0x421eae===_0x51c3('0x82')||_0x421eae===_0x51c3('0x38')||_0x421eae===_0x51c3('0x39')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x2a600c,_0x3e3685){var _0xf2c34a,_0x4802fb,_0x5d6a8a;if(_0x3e3685<=0x0){_0x3e3685=0x1;}_0xf2c34a=new RegExp(_0x51c3('0x83')+_0x3e3685+'}$');_0x4802fb=Math[_0x51c3('0x84')](0xa,_0x3e3685-0x1);_0x5d6a8a=Math['pow'](0xa,_0x3e3685)-0x1;return util[_0x51c3('0x13')]('%s',_[_0x51c3('0x85')](_0x2a600c,_0xf2c34a,_['random'](_0x4802fb,_0x5d6a8a)));};exports[_0x51c3('0x86')]=function(_0x3d56ff){var _0x2c16f9=_0x3d56ff['match'](/"(.*?)"/);return _0x2c16f9?_0x2c16f9[0x1]:_0x3d56ff;};exports['extractCalleridNumber']=function(_0x4ad7cf){var _0x3f0146=_0x4ad7cf['match'](/<(.*?)>/);return _0x3f0146?_0x3f0146[0x1]:_0x4ad7cf;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 9e3fade..2ce8105 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 _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x5821e9,_0x1b8161){var _0x1fe8ab=function(_0x2ab406){while(--_0x2ab406){_0x5821e9['push'](_0x5821e9['shift']());}};_0x1fe8ab(++_0x1b8161);}(_0xb10b,0x12a));var _0xbb10=function(_0x3374fd,_0x59a9bc){_0x3374fd=_0x3374fd-0x0;var _0xb10792=_0xb10b[_0x3374fd];return _0xb10792;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x4ca99e,_0x243705){var _0xd9dd70=function(_0x344a8c){while(--_0x344a8c){_0x4ca99e['push'](_0x4ca99e['shift']());}};_0xd9dd70(++_0x243705);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2df272,_0xfc095a){_0x2df272=_0x2df272-0x0;var _0xa451f4=_0x5f2f[_0x2df272];return _0xa451f4;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 1edb441..747b722 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 _0x2d8c=['../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','agents','telephones','trunks','triggers','voiceExtensions','channels','queueChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','name','interface','format','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTrunks','initVoiceQueues','voiceQueues','initTemplates','templates','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','unmanaged','queuecallerabandon','queuecallerleaveAt','seconds','queuecallerabandonAt','queuecallerexitAt','diff','queuecallerjoinAt','queuecallercomplete','outbound','disposition','ANSWERED','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','exports','bluebird','util','lodash','../model/telephone','../model/trunk'];(function(_0x1dd3b3,_0x54db4c){var _0xab5e42=function(_0x1574fb){while(--_0x1574fb){_0x1dd3b3['push'](_0x1dd3b3['shift']());}};_0xab5e42(++_0x54db4c);}(_0x2d8c,0xc3));var _0xc2d8=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x2d8c[_0x3ff085];return _0x2b68c3;};'use strict';var BPromise=require(_0xc2d8('0x0'));var util=require(_0xc2d8('0x1'));var _=require(_0xc2d8('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0xc2d8('0x3'));var Trunk=require(_0xc2d8('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0xc2d8('0x5'));var Template=require(_0xc2d8('0x6'));var Campaign=require(_0xc2d8('0x7'));var VoiceExtension=require(_0xc2d8('0x8'));var ZendeskAccount=require(_0xc2d8('0x9'));var SalesforceAccount=require(_0xc2d8('0xa'));var FreshdeskAccount=require(_0xc2d8('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xc2d8('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xc2d8('0xd'));var Dynamics365Account=require(_0xc2d8('0xe'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xc2d8('0xf')]={};this[_0xc2d8('0x10')]={};this[_0xc2d8('0x11')]={};this['voiceQueues']={};this[_0xc2d8('0x12')]={};this['campaigns']={};this['templates']={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc2d8('0x13')]={};this[_0xc2d8('0x14')]={};this[_0xc2d8('0x15')]={};this['outboundChannels']={};this['timers']={};this[_0xc2d8('0x16')]={};this[_0xc2d8('0x17')]={};this[_0xc2d8('0x18')]={};this[_0xc2d8('0x19')]={};this['zohoAccounts']={};this[_0xc2d8('0x1a')]={};this['vtigerAccounts']={};this[_0xc2d8('0x1b')]={};this['dynamics365Accounts']={};this[_0xc2d8('0x1c')]={};this[_0xc2d8('0x1d')]={};};function freeIsNotKey(_0x91bcc6,_0x57953f,_0x20c809){var _0xb3e625=_[_0xc2d8('0x1e')](_0x91bcc6,function(_0x594afe,_0x4cb6f1){return _0x594afe[_0x20c809];});for(var _0x93e9d3 in _0x57953f){if(_0x57953f[_0xc2d8('0x1f')](_0x93e9d3)){if(!_0xb3e625[_0x93e9d3]){delete _0x57953f[_0x93e9d3];}}}}function freeIsNotKeySip(_0xc2fe96,_0x4c2607){var _0xf3ef4=_[_0xc2d8('0x1e')](_0xc2fe96,function(_0x4852f2,_0x5a3d20){return util['format']('SIP/%s',_0x4852f2[_0xc2d8('0x20')]);});for(var _0x4d0682 in _0x4c2607){if(_0x4c2607['hasOwnProperty'](_0x4d0682)){if(!_0xf3ef4[_0x4d0682]){delete _0x4c2607[_0x4d0682];}}}}function freeIsNotKeyAgent(_0x455450,_0x2b06b3){var _0x5a3014=_['mapKeys'](_0x455450,function(_0x4ee83e,_0x168d31){var _0x1577e8=_['isNil'](_0x4ee83e[_0xc2d8('0x21')])?util[_0xc2d8('0x22')]('SIP/%s',_0x4ee83e['name']):_0x4ee83e[_0xc2d8('0x21')];return _0x1577e8;});for(var _0x21f38c in _0x2b06b3){if(_0x2b06b3[_0xc2d8('0x1f')](_0x21f38c)){if(!_0x5a3014[_0x21f38c]){delete _0x2b06b3[_0x21f38c];}}}}function clearVoiceCallReports(_0x507925){_0x507925[_0xc2d8('0x23')]=0x0;_0x507925[_0xc2d8('0x24')]=0x0;_0x507925[_0xc2d8('0x25')]=0x0;_0x507925[_0xc2d8('0x26')]=0x0;_0x507925[_0xc2d8('0x27')]=0x0;}function clearCampaigns(_0x4db430){if(!_[_0xc2d8('0x28')](_0x4db430)){for(var _0x194a2e in _0x4db430){if(_0x4db430[_0xc2d8('0x1f')](_0x194a2e)){_0x4db430[_0x194a2e]['ivrTotalCallsDays']=0x0;_0x4db430[_0x194a2e][_0xc2d8('0x29')]=0x0;}}}}function clearVoiceQueues(_0x777a9a){if(!_['isEmpty'](_0x777a9a)){for(var _0x505c63 in _0x777a9a){if(_0x777a9a[_0xc2d8('0x1f')](_0x505c63)){_0x777a9a[_0x505c63][_0xc2d8('0x23')]=0x0;_0x777a9a[_0x505c63]['answered']=0x0;_0x777a9a[_0x505c63]['unmanaged']=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x2a')]=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x25')]=0x0;_0x777a9a[_0x505c63]['sumDuration']=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x27')]=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x2b')]=0x0;_0x777a9a[_0x505c63]['outboundNoAnswerCallsDay']=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x2c')]=0x0;_0x777a9a[_0x505c63]['outboundCongestionCallsDay']=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x2d')]=0x0;_0x777a9a[_0x505c63]['outboundUnknownCallsDay']=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x2e')]=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x2f')]=0x0;_0x777a9a[_0x505c63]['outboundBlacklistCallsDay']=0x0;_0x777a9a[_0x505c63]['outboundOriginateFailureCallsDay']=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x30')]=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x31')]=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x2b')]=0x0;_0x777a9a[_0x505c63]['outboundAnswerCallsDay']=0x0;_0x777a9a[_0x505c63][_0xc2d8('0x32')]=!![];}}}}Realtime['prototype'][_0xc2d8('0x33')]=function(_0xec5b73,_0x4a3e41){for(var _0x388132 in _0x4a3e41){if(_0xec5b73['hasOwnProperty'](_0x388132)){_0xec5b73[_0x388132]=_0x4a3e41[_0x388132];}}};Realtime['prototype'][_0xc2d8('0x34')]=function(){var _0x28e06e=this;return function(_0x9f9bba){if(_0x9f9bba){freeIsNotKeyAgent(_0x9f9bba,_0x28e06e[_0xc2d8('0xf')]);for(var _0x2255ca=0x0,_0x25bd43={},_0x164b20={};_0x2255ca<_0x9f9bba[_0xc2d8('0x35')];_0x2255ca+=0x1){_0x25bd43=_0x9f9bba[_0x2255ca];var _0x485029=_[_0xc2d8('0x36')](_0x25bd43[_0xc2d8('0x21')])?util[_0xc2d8('0x22')](_0xc2d8('0x37'),_0x25bd43['name']):_0x25bd43[_0xc2d8('0x21')];if(_[_0xc2d8('0x38')](_0x28e06e['agents'][_0x485029])){_0x28e06e['agents'][_0x485029]=new Agent(_0x25bd43);}else{_0x28e06e[_0xc2d8('0x33')](_0x28e06e[_0xc2d8('0xf')][_0x485029],_0x25bd43);}}}return _0x28e06e[_0xc2d8('0xf')];};};Realtime[_0xc2d8('0x39')]['initTelephones']=function(){var _0x35eedd=this;return function(_0x5c8a55){if(_0x5c8a55){freeIsNotKeySip(_0x5c8a55,_0x35eedd[_0xc2d8('0x10')]);for(var _0x5633bb=0x0,_0x6749aa={},_0x4d02d3={};_0x5633bb<_0x5c8a55['length'];_0x5633bb+=0x1){_0x6749aa=_0x5c8a55[_0x5633bb];if(_[_0xc2d8('0x38')](_0x35eedd['telephones'][util['format']('SIP/%s',_0x6749aa[_0xc2d8('0x20')])])){_0x35eedd[_0xc2d8('0x10')][util[_0xc2d8('0x22')]('SIP/%s',_0x6749aa[_0xc2d8('0x20')])]=new Telephone(_0x6749aa);}else{_0x35eedd[_0xc2d8('0x33')](_0x35eedd[_0xc2d8('0x10')][util[_0xc2d8('0x22')](_0xc2d8('0x37'),_0x6749aa[_0xc2d8('0x20')])],_0x6749aa);}}}return _0x35eedd[_0xc2d8('0x10')];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x3a')]=function(){var _0x222f52=this;return function(_0x237a5e){if(_0x237a5e){freeIsNotKeySip(_0x237a5e,_0x222f52[_0xc2d8('0x11')]);for(var _0x4b34a7=0x0,_0x49aa6b={},_0x454064={};_0x4b34a7<_0x237a5e[_0xc2d8('0x35')];_0x4b34a7+=0x1){_0x49aa6b=_0x237a5e[_0x4b34a7];if(_[_0xc2d8('0x38')](_0x222f52[_0xc2d8('0x11')][util[_0xc2d8('0x22')](_0xc2d8('0x37'),_0x49aa6b['name'])])){_0x222f52[_0xc2d8('0x11')][util[_0xc2d8('0x22')](_0xc2d8('0x37'),_0x49aa6b[_0xc2d8('0x20')])]=new Trunk(_0x49aa6b);}else{_0x222f52[_0xc2d8('0x33')](_0x222f52[_0xc2d8('0x11')][util[_0xc2d8('0x22')](_0xc2d8('0x37'),_0x49aa6b['name'])],_0x49aa6b);}}}return _0x222f52[_0xc2d8('0x11')];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x3b')]=function(){var _0x17674d=this;return function(_0x114a5f){if(_0x114a5f){freeIsNotKey(_0x114a5f,_0x17674d[_0xc2d8('0x3c')],_0xc2d8('0x20'));for(var _0x32604e=0x0,_0x32a362={},_0x311673={};_0x32604e<_0x114a5f[_0xc2d8('0x35')];_0x32604e+=0x1){_0x32a362=_0x114a5f[_0x32604e];if(_[_0xc2d8('0x38')](_0x17674d[_0xc2d8('0x3c')][_0x32a362['name']])){_0x17674d[_0xc2d8('0x3c')][_0x32a362['name']]=new VoiceQueue(_0x32a362);}else{_0x17674d[_0xc2d8('0x33')](_0x17674d[_0xc2d8('0x3c')][_0x32a362[_0xc2d8('0x20')]],_0x32a362);}}}return _0x17674d['voiceQueues'];};};Realtime['prototype']['initTriggers']=function(){var _0x4a9076=this;return function(_0x49e747){if(_0x49e747){freeIsNotKey(_0x49e747,_0x4a9076[_0xc2d8('0x12')],'id');for(var _0xded9f8=0x0,_0x3f0ead={},_0x4689f7={};_0xded9f8<_0x49e747[_0xc2d8('0x35')];_0xded9f8+=0x1){_0x3f0ead=_0x49e747[_0xded9f8];if(_[_0xc2d8('0x38')](_0x4a9076[_0xc2d8('0x12')][_0x3f0ead['id']])){_0x4a9076[_0xc2d8('0x12')][_0x3f0ead['id']]=new Trigger(_0x3f0ead);}else{_0x4a9076[_0xc2d8('0x33')](_0x4a9076[_0xc2d8('0x12')][_0x3f0ead['id']],_0x3f0ead);}}}return _0x4a9076['triggers'];};};Realtime['prototype'][_0xc2d8('0x3d')]=function(){var _0xeb4dac=this;return function(_0x2fa6e8){if(_0x2fa6e8){freeIsNotKey(_0x2fa6e8,_0xeb4dac[_0xc2d8('0x3e')],'id');for(var _0x135d78=0x0,_0x4dad52={},_0x46de31={};_0x135d78<_0x2fa6e8['length'];_0x135d78+=0x1){_0x4dad52=_0x2fa6e8[_0x135d78];if(_['isUndefined'](_0xeb4dac[_0xc2d8('0x3e')][_0x4dad52['id']])){_0xeb4dac[_0xc2d8('0x3e')][_0x4dad52['id']]=new Template(_0x4dad52);}else{_0xeb4dac[_0xc2d8('0x33')](_0xeb4dac[_0xc2d8('0x3e')][_0x4dad52['id']],_0x4dad52);}}}return _0xeb4dac[_0xc2d8('0x3e')];};};Realtime[_0xc2d8('0x39')]['initZendeskAccounts']=function(){var _0x10d269=this;return function(_0x300fdc){if(_0x300fdc){freeIsNotKey(_0x300fdc,_0x10d269[_0xc2d8('0x16')],'id');for(var _0x2e8ebf=0x0,_0x35dc72={},_0x3e19b7={};_0x2e8ebf<_0x300fdc['length'];_0x2e8ebf+=0x1){_0x35dc72=_0x300fdc[_0x2e8ebf];if(_[_0xc2d8('0x38')](_0x10d269[_0xc2d8('0x16')][_0x35dc72['id']])){_0x10d269['zendeskAccounts'][_0x35dc72['id']]=new ZendeskAccount(_0x35dc72);}else{_0x10d269[_0xc2d8('0x33')](_0x10d269[_0xc2d8('0x16')][_0x35dc72['id']],_0x35dc72);}}}return _0x10d269[_0xc2d8('0x16')];};};Realtime['prototype'][_0xc2d8('0x3f')]=function(){var _0x4927d7=this;return function(_0x7f6eb5){if(_0x7f6eb5){freeIsNotKey(_0x7f6eb5,_0x4927d7[_0xc2d8('0x17')],'id');for(var _0x5b5f31=0x0,_0x4e02bc={},_0x137342={};_0x5b5f31<_0x7f6eb5[_0xc2d8('0x35')];_0x5b5f31+=0x1){_0x4e02bc=_0x7f6eb5[_0x5b5f31];if(_[_0xc2d8('0x38')](_0x4927d7[_0xc2d8('0x17')][_0x4e02bc['id']])){_0x4927d7[_0xc2d8('0x17')][_0x4e02bc['id']]=new SalesforceAccount(_0x4e02bc);}else{_0x4927d7[_0xc2d8('0x33')](_0x4927d7['salesforceAccounts'][_0x4e02bc['id']],_0x4e02bc);}}}return _0x4927d7[_0xc2d8('0x17')];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x40')]=function(){var _0x239cec=this;return function(_0x150ca5){if(_0x150ca5){freeIsNotKey(_0x150ca5,_0x239cec[_0xc2d8('0x19')],'id');for(var _0x2e2163=0x0,_0x276942={},_0x378e19={};_0x2e2163<_0x150ca5['length'];_0x2e2163+=0x1){_0x276942=_0x150ca5[_0x2e2163];if(_[_0xc2d8('0x38')](_0x239cec[_0xc2d8('0x19')][_0x276942['id']])){_0x239cec['freshdeskAccounts'][_0x276942['id']]=new FreshdeskAccount(_0x276942);}else{_0x239cec['mergeFromDatabase'](_0x239cec[_0xc2d8('0x19')][_0x276942['id']],_0x276942);}}}return _0x239cec['freshdeskAccounts'];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x41')]=function(){var _0x22062d=this;return function(_0x138039){if(_0x138039){freeIsNotKey(_0x138039,_0x22062d[_0xc2d8('0x42')],'id');for(var _0x4b42fb=0x0,_0x4f3341={},_0x5341f0={};_0x4b42fb<_0x138039['length'];_0x4b42fb+=0x1){_0x4f3341=_0x138039[_0x4b42fb];if(_['isUndefined'](_0x22062d[_0xc2d8('0x42')][_0x4f3341['id']])){_0x22062d[_0xc2d8('0x42')][_0x4f3341['id']]=new ZohoAccount(_0x4f3341);}else{_0x22062d[_0xc2d8('0x33')](_0x22062d[_0xc2d8('0x42')][_0x4f3341['id']],_0x4f3341);}}}return _0x22062d[_0xc2d8('0x42')];};};Realtime['prototype'][_0xc2d8('0x43')]=function(){var _0xe16d5=this;return function(_0x3791bc){if(_0x3791bc){freeIsNotKey(_0x3791bc,_0xe16d5[_0xc2d8('0x1a')],'id');for(var _0x10e7f9=0x0,_0x5c1398={},_0x358b9f={};_0x10e7f9<_0x3791bc[_0xc2d8('0x35')];_0x10e7f9+=0x1){_0x5c1398=_0x3791bc[_0x10e7f9];if(_[_0xc2d8('0x38')](_0xe16d5[_0xc2d8('0x1a')][_0x5c1398['id']])){_0xe16d5['deskAccounts'][_0x5c1398['id']]=new DeskAccount(_0x5c1398);}else{_0xe16d5[_0xc2d8('0x33')](_0xe16d5[_0xc2d8('0x1a')][_0x5c1398['id']],_0x5c1398);}}}return _0xe16d5[_0xc2d8('0x1a')];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x44')]=function(){var _0x16a67b=this;return function(_0x2f7702){if(_0x2f7702){freeIsNotKey(_0x2f7702,_0x16a67b[_0xc2d8('0x18')],'id');for(var _0x1652bd=0x0,_0x5bef57={},_0x868898={};_0x1652bd<_0x2f7702['length'];_0x1652bd+=0x1){_0x5bef57=_0x2f7702[_0x1652bd];if(_[_0xc2d8('0x38')](_0x16a67b[_0xc2d8('0x18')][_0x5bef57['id']])){_0x16a67b['sugarcrmAccounts'][_0x5bef57['id']]=new SugarcrmAccount(_0x5bef57);}else{_0x16a67b['mergeFromDatabase'](_0x16a67b[_0xc2d8('0x18')][_0x5bef57['id']],_0x5bef57);}}}return _0x16a67b[_0xc2d8('0x18')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x465c26=this;return function(_0x34b96b){if(_0x34b96b){freeIsNotKey(_0x34b96b,_0x465c26[_0xc2d8('0x45')],'id');for(var _0x377577=0x0,_0x30a08f={},_0xc8adc={};_0x377577<_0x34b96b['length'];_0x377577+=0x1){_0x30a08f=_0x34b96b[_0x377577];if(_[_0xc2d8('0x38')](_0x465c26[_0xc2d8('0x45')][_0x30a08f['id']])){_0x465c26['vtigerAccounts'][_0x30a08f['id']]=new VtigerAccount(_0x30a08f);}else{_0x465c26[_0xc2d8('0x33')](_0x465c26[_0xc2d8('0x45')][_0x30a08f['id']],_0x30a08f);}}}return _0x465c26[_0xc2d8('0x45')];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x46')]=function(){var _0x1847d5=this;return function(_0x3dff46){if(_0x3dff46){freeIsNotKey(_0x3dff46,_0x1847d5[_0xc2d8('0x1b')],'id');for(var _0x37b361=0x0,_0x25eb5b={},_0x25e7a0={};_0x37b361<_0x3dff46[_0xc2d8('0x35')];_0x37b361+=0x1){_0x25eb5b=_0x3dff46[_0x37b361];if(_[_0xc2d8('0x38')](_0x1847d5[_0xc2d8('0x1b')][_0x25eb5b['id']])){_0x1847d5[_0xc2d8('0x1b')][_0x25eb5b['id']]=new ServicenowAccount(_0x25eb5b);}else{_0x1847d5[_0xc2d8('0x33')](_0x1847d5[_0xc2d8('0x1b')][_0x25eb5b['id']],_0x25eb5b);}}}return _0x1847d5[_0xc2d8('0x1b')];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x47')]=function(){var _0x2ed6d3=this;return function(_0x239995){if(_0x239995){freeIsNotKey(_0x239995,_0x2ed6d3['dynamics365Accounts'],'id');for(var _0x26e1d9=0x0,_0x11d96d={},_0x5ae8d5={};_0x26e1d9<_0x239995['length'];_0x26e1d9+=0x1){_0x11d96d=_0x239995[_0x26e1d9];if(_['isUndefined'](_0x2ed6d3[_0xc2d8('0x48')][_0x11d96d['id']])){_0x2ed6d3[_0xc2d8('0x48')][_0x11d96d['id']]=new Dynamics365Account(_0x11d96d);}else{_0x2ed6d3[_0xc2d8('0x33')](_0x2ed6d3['dynamics365Accounts'][_0x11d96d['id']],_0x11d96d);}}}return _0x2ed6d3[_0xc2d8('0x48')];};};Realtime['prototype'][_0xc2d8('0x49')]=function(){var _0x4e95cc=this;return function(_0x2678e7){if(_0x2678e7){freeIsNotKey(_0x2678e7,_0x4e95cc[_0xc2d8('0x1c')],'id');for(var _0x52a51c=0x0,_0x5bc3db={},_0x253254={};_0x52a51c<_0x2678e7[_0xc2d8('0x35')];_0x52a51c+=0x1){_0x5bc3db=_0x2678e7[_0x52a51c];if(_['isUndefined'](_0x4e95cc[_0xc2d8('0x1c')][_0x5bc3db['id']])){_0x4e95cc[_0xc2d8('0x1c')][_0x5bc3db['id']]=new FreshsalesAccount(_0x5bc3db);}else{_0x4e95cc[_0xc2d8('0x33')](_0x4e95cc[_0xc2d8('0x1c')][_0x5bc3db['id']],_0x5bc3db);}}}return _0x4e95cc[_0xc2d8('0x1c')];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x4a')]=function(){var _0x501fd6=this;return function(_0x4392c1){for(var _0x15503e=0x0;_0x15503e<_0x4392c1[_0xc2d8('0x35')];_0x15503e+=0x1){_[_0xc2d8('0x4b')](_0x501fd6['voiceQueues'][_0x4392c1[_0x15503e][_0xc2d8('0x20')]],_0x4392c1[_0x15503e]);}return _0x501fd6[_0xc2d8('0x3c')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x38e67b=this;return function(_0x135bc8){clearVoiceQueues(_0x38e67b[_0xc2d8('0x3c')]);if(_0x135bc8){_0x135bc8=_[_0xc2d8('0x4c')](_0x135bc8,_0xc2d8('0x4d'));for(var _0x31f710 in _0x135bc8){if(_0x135bc8[_0xc2d8('0x1f')](_0x31f710)){var _0x305326={};for(var _0x4911b3=0x0;_0x4911b3<_0x135bc8[_0x31f710]['length'];_0x4911b3+=0x1){var _0x38cfed=_0x135bc8[_0x31f710][_0x4911b3][_0xc2d8('0x4e')];if(_0x38e67b[_0xc2d8('0x3c')][_0x38cfed]){if(_0x135bc8[_0x31f710][_0x4911b3]['queuecallerexit']){_0x38e67b[_0xc2d8('0x3c')][_0x38cfed][_0xc2d8('0x4f')]+=0x1;}if(_0x135bc8[_0x31f710][_0x4911b3][_0xc2d8('0x50')]){_0x38e67b[_0xc2d8('0x3c')][_0x38cfed][_0xc2d8('0x2a')]+=0x1;}_0x38e67b[_0xc2d8('0x3c')][_0x38cfed][_0xc2d8('0x25')]+=moment(_0x135bc8[_0x31f710][_0x4911b3][_0xc2d8('0x51')])['diff'](moment(_0x135bc8[_0x31f710][_0x4911b3]['queuecallerjoinAt']),_0xc2d8('0x52'))||0x0;if(_0x4911b3===_0x135bc8[_0x31f710][_0xc2d8('0x35')]-0x1){_0x38e67b[_0xc2d8('0x3c')][_0x38cfed]['sumDuration']+=moment(_0x135bc8[_0x31f710][_0x4911b3]['queuecallercompleteAt']||_0x135bc8[_0x31f710][_0x4911b3][_0xc2d8('0x53')]||_0x135bc8[_0x31f710][_0x4911b3][_0xc2d8('0x54')])[_0xc2d8('0x55')](moment(_0x135bc8[_0x31f710][_0x4911b3][_0xc2d8('0x56')]),_0xc2d8('0x52'))||0x0;_0x38e67b['voiceQueues'][_0x38cfed][_0xc2d8('0x23')]+=0x1;if(_0x135bc8[_0x31f710][_0x4911b3][_0xc2d8('0x57')]){_0x38e67b['voiceQueues'][_0x38cfed]['answered']+=0x1;_0x38e67b[_0xc2d8('0x3c')][_0x38cfed]['sumBillable']+=moment(_0x135bc8[_0x31f710][_0x4911b3]['queuecallercompleteAt'])[_0xc2d8('0x55')](moment(_0x135bc8[_0x31f710][_0x4911b3][_0xc2d8('0x51')]),_0xc2d8('0x52'))||0x0;}}else{_0x38e67b[_0xc2d8('0x3c')][_0x38cfed][_0xc2d8('0x26')]+=_0x38e67b[_0xc2d8('0x3c')][_0x38cfed]['sumHoldTime']||0x0;}}}}}}return _0x38e67b['voiceQueues'];};};Realtime[_0xc2d8('0x39')]['initVoiceCallReports']=function(){var _0x2dcb09=this;return function(_0x4a5d18){clearVoiceCallReports(_0x2dcb09[_0xc2d8('0x58')]);if(_0x4a5d18){for(var _0x29119e=0x0;_0x29119e<_0x4a5d18[_0xc2d8('0x35')];_0x29119e+=0x1){_0x2dcb09[_0xc2d8('0x58')][_0xc2d8('0x23')]+=0x1;_0x2dcb09[_0xc2d8('0x58')][_0xc2d8('0x26')]+=_0x4a5d18[_0x29119e]['duration'];if(_0x4a5d18[_0x29119e][_0xc2d8('0x59')]===_0xc2d8('0x5a')){_0x2dcb09[_0xc2d8('0x58')][_0xc2d8('0x24')]+=0x1;_0x2dcb09[_0xc2d8('0x58')][_0xc2d8('0x25')]+=_0x4a5d18[_0x29119e][_0xc2d8('0x5b')]-_0x4a5d18[_0x29119e][_0xc2d8('0x5c')]||0x0;_0x2dcb09[_0xc2d8('0x58')]['sumBillable']+=_0x4a5d18[_0x29119e][_0xc2d8('0x5c')];}}}return _0x2dcb09[_0xc2d8('0x58')];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x5d')]=function(){var _0x56ad65=this;return function(_0x18067d){if(_0x18067d){freeIsNotKey(_0x18067d,_0x56ad65[_0xc2d8('0x5e')],_0xc2d8('0x20'));for(var _0x29dd3c=0x0,_0x55c34c={};_0x29dd3c<_0x18067d[_0xc2d8('0x35')];_0x29dd3c+=0x1){_0x55c34c=_0x18067d[_0x29dd3c];if(_['isUndefined'](_0x56ad65[_0xc2d8('0x5e')][_0x55c34c[_0xc2d8('0x20')]])){_0x56ad65[_0xc2d8('0x5e')][_0x55c34c[_0xc2d8('0x20')]]=new Campaign(_0x55c34c);}else{_0x56ad65['mergeFromDatabase'](_0x56ad65['campaigns'][_0x55c34c[_0xc2d8('0x20')]],_0x55c34c);_0x56ad65[_0xc2d8('0x5e')][_0x55c34c['name']][_0xc2d8('0x5f')]=_0x55c34c[_0xc2d8('0x60')]?_0x55c34c[_0xc2d8('0x60')][_0xc2d8('0x20')]:undefined;}}}return _0x56ad65[_0xc2d8('0x5e')];};};Realtime['prototype'][_0xc2d8('0x61')]=function(){var _0x1665d1=this;return function(_0x4ad42c){if(_0x4ad42c){freeIsNotKey(_0x4ad42c,_0x1665d1['voiceExtensions'],'id');for(var _0x5e3da7=0x0,_0x41dc76={};_0x5e3da7<_0x4ad42c[_0xc2d8('0x35')];_0x5e3da7+=0x1){_0x41dc76=_0x4ad42c[_0x5e3da7];if(_[_0xc2d8('0x38')](_0x1665d1[_0xc2d8('0x13')][_0x41dc76['id']])){_0x1665d1[_0xc2d8('0x13')][_0x41dc76['id']]=new VoiceExtension(_0x41dc76);}else{_0x1665d1['mergeFromDatabase'](_0x1665d1[_0xc2d8('0x13')][_0x41dc76['id']],_0x41dc76);}}}return _0x1665d1[_0xc2d8('0x13')];};};Realtime[_0xc2d8('0x39')]['initCampaignHopperHistory']=function(){var _0x1a439c=this;return function(_0x1932f1){clearCampaigns(_0x1a439c[_0xc2d8('0x5e')]);for(var _0x148a17=0x0;_0x148a17<_0x1932f1['length'];_0x148a17+=0x1){_[_0xc2d8('0x4b')](_0x1a439c[_0xc2d8('0x5e')][_0x1932f1[_0x148a17][_0xc2d8('0x20')]],_0x1932f1[_0x148a17]);}return _0x1a439c[_0xc2d8('0x5e')];};};Realtime[_0xc2d8('0x39')][_0xc2d8('0x62')]=function(){var _0x24ebc1=this;return function(_0x5c2f24){if(_0x5c2f24){freeIsNotKey(_0x5c2f24,_0x24ebc1[_0xc2d8('0x1d')],'id');for(var _0x1f3275=0x0,_0x1532ac={},_0x230d6f={};_0x1f3275<_0x5c2f24[_0xc2d8('0x35')];_0x1f3275+=0x1){_0x1532ac=_0x5c2f24[_0x1f3275];if(_[_0xc2d8('0x38')](_0x24ebc1[_0xc2d8('0x1d')][_0x1532ac['id']])){_0x24ebc1['faxAccounts'][_0x1532ac['id']]=new FaxAccount(_0x1532ac);}else{_0x24ebc1['mergeFromDatabase'](_0x24ebc1[_0xc2d8('0x1d')][_0x1532ac['id']],_0x1532ac);}}}return _0x24ebc1[_0xc2d8('0x1d')];};};module[_0xc2d8('0x63')]=Realtime; \ No newline at end of file +var _0x7ef8=['sugarcrmAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','initTrunks','initVoiceQueues','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7ef8,0xb9));var _0x87ef=function(_0x386132,_0x5646dd){_0x386132=_0x386132-0x0;var _0x3ba4da=_0x7ef8[_0x386132];return _0x3ba4da;};'use strict';var BPromise=require('bluebird');var util=require(_0x87ef('0x0'));var _=require(_0x87ef('0x1'));var moment=require(_0x87ef('0x2'));var Agent=require(_0x87ef('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x87ef('0x4'));var VoiceQueue=require(_0x87ef('0x5'));var Trigger=require(_0x87ef('0x6'));var Template=require(_0x87ef('0x7'));var Campaign=require(_0x87ef('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x87ef('0x9'));var SalesforceAccount=require(_0x87ef('0xa'));var FreshdeskAccount=require(_0x87ef('0xb'));var SugarcrmAccount=require(_0x87ef('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x87ef('0xd'));var Dynamics365Account=require(_0x87ef('0xe'));var FreshsalesAccount=require(_0x87ef('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x87ef('0x10')]={};this[_0x87ef('0x11')]={};this[_0x87ef('0x12')]={};this[_0x87ef('0x13')]={};this[_0x87ef('0x14')]={};this[_0x87ef('0x15')]={};this[_0x87ef('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x87ef('0x17')]={};this[_0x87ef('0x18')]={};this[_0x87ef('0x19')]={};this[_0x87ef('0x1a')]={};this[_0x87ef('0x1b')]={};this[_0x87ef('0x1c')]={};this['salesforceAccounts']={};this[_0x87ef('0x1d')]={};this[_0x87ef('0x1e')]={};this[_0x87ef('0x1f')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x87ef('0x20')]={};this['dynamics365Accounts']={};this[_0x87ef('0x21')]={};this[_0x87ef('0x22')]={};};function freeIsNotKey(_0x290480,_0x495b85,_0x18a745){var _0x4b527a=_[_0x87ef('0x23')](_0x290480,function(_0xded096,_0x5a2847){return _0xded096[_0x18a745];});for(var _0x4cb977 in _0x495b85){if(_0x495b85[_0x87ef('0x24')](_0x4cb977)){if(!_0x4b527a[_0x4cb977]){delete _0x495b85[_0x4cb977];}}}}function freeIsNotKeySip(_0x5685a8,_0x565abe){var _0x55a017=_[_0x87ef('0x23')](_0x5685a8,function(_0x297ef6,_0x3b3416){return util['format'](_0x87ef('0x25'),_0x297ef6[_0x87ef('0x26')]);});for(var _0x5cea32 in _0x565abe){if(_0x565abe[_0x87ef('0x24')](_0x5cea32)){if(!_0x55a017[_0x5cea32]){delete _0x565abe[_0x5cea32];}}}}function freeIsNotKeyAgent(_0x5af595,_0xe7d92c){var _0x343fda=_[_0x87ef('0x23')](_0x5af595,function(_0x10eaff,_0x5c9f3c){var _0xc78b6b=_['isNil'](_0x10eaff[_0x87ef('0x27')])?util[_0x87ef('0x28')](_0x87ef('0x25'),_0x10eaff[_0x87ef('0x26')]):_0x10eaff[_0x87ef('0x27')];return _0xc78b6b;});for(var _0x500d05 in _0xe7d92c){if(_0xe7d92c[_0x87ef('0x24')](_0x500d05)){if(!_0x343fda[_0x500d05]){delete _0xe7d92c[_0x500d05];}}}}function clearVoiceCallReports(_0xa9caaa){_0xa9caaa[_0x87ef('0x29')]=0x0;_0xa9caaa[_0x87ef('0x2a')]=0x0;_0xa9caaa[_0x87ef('0x2b')]=0x0;_0xa9caaa[_0x87ef('0x2c')]=0x0;_0xa9caaa[_0x87ef('0x2d')]=0x0;}function clearCampaigns(_0x58cc2e){if(!_[_0x87ef('0x2e')](_0x58cc2e)){for(var _0xc0150a in _0x58cc2e){if(_0x58cc2e[_0x87ef('0x24')](_0xc0150a)){_0x58cc2e[_0xc0150a]['ivrTotalCallsDays']=0x0;_0x58cc2e[_0xc0150a]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2042da){if(!_[_0x87ef('0x2e')](_0x2042da)){for(var _0x47f5e3 in _0x2042da){if(_0x2042da[_0x87ef('0x24')](_0x47f5e3)){_0x2042da[_0x47f5e3][_0x87ef('0x29')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x2a')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x2f')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x30')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x2b')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x2c')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x2d')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x31')]=0x0;_0x2042da[_0x47f5e3]['outboundNoAnswerCallsDay']=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x32')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x33')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x34')]=0x0;_0x2042da[_0x47f5e3]['outboundUnknownCallsDay']=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x35')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x36')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x37')]=0x0;_0x2042da[_0x47f5e3]['outboundOriginateFailureCallsDay']=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x38')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x39')]=0x0;_0x2042da[_0x47f5e3]['outboundAnswerAgiCallsDay']=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x3a')]=0x0;_0x2042da[_0x47f5e3][_0x87ef('0x3b')]=!![];}}}}Realtime[_0x87ef('0x3c')][_0x87ef('0x3d')]=function(_0x18c852,_0x1275e2){for(var _0x55dcdb in _0x1275e2){if(_0x18c852['hasOwnProperty'](_0x55dcdb)){_0x18c852[_0x55dcdb]=_0x1275e2[_0x55dcdb];}}};Realtime['prototype'][_0x87ef('0x3e')]=function(){var _0x557b45=this;return function(_0x4cc690){if(_0x4cc690){freeIsNotKeyAgent(_0x4cc690,_0x557b45[_0x87ef('0x10')]);for(var _0x201455=0x0,_0x4902c3={},_0x1fae57={};_0x201455<_0x4cc690[_0x87ef('0x3f')];_0x201455+=0x1){_0x4902c3=_0x4cc690[_0x201455];var _0x4bead2=_[_0x87ef('0x40')](_0x4902c3[_0x87ef('0x27')])?util[_0x87ef('0x28')](_0x87ef('0x25'),_0x4902c3[_0x87ef('0x26')]):_0x4902c3[_0x87ef('0x27')];if(_[_0x87ef('0x41')](_0x557b45[_0x87ef('0x10')][_0x4bead2])){_0x557b45['agents'][_0x4bead2]=new Agent(_0x4902c3);}else{_0x557b45[_0x87ef('0x3d')](_0x557b45['agents'][_0x4bead2],_0x4902c3);}}}return _0x557b45[_0x87ef('0x10')];};};Realtime[_0x87ef('0x3c')]['initTelephones']=function(){var _0x1c2b58=this;return function(_0xbe0bcd){if(_0xbe0bcd){freeIsNotKeySip(_0xbe0bcd,_0x1c2b58['telephones']);for(var _0x31d6a7=0x0,_0x11cf90={},_0x2cdd51={};_0x31d6a7<_0xbe0bcd['length'];_0x31d6a7+=0x1){_0x11cf90=_0xbe0bcd[_0x31d6a7];if(_[_0x87ef('0x41')](_0x1c2b58[_0x87ef('0x11')][util[_0x87ef('0x28')](_0x87ef('0x25'),_0x11cf90['name'])])){_0x1c2b58[_0x87ef('0x11')][util[_0x87ef('0x28')](_0x87ef('0x25'),_0x11cf90[_0x87ef('0x26')])]=new Telephone(_0x11cf90);}else{_0x1c2b58[_0x87ef('0x3d')](_0x1c2b58[_0x87ef('0x11')][util[_0x87ef('0x28')]('SIP/%s',_0x11cf90['name'])],_0x11cf90);}}}return _0x1c2b58['telephones'];};};Realtime['prototype'][_0x87ef('0x42')]=function(){var _0x36d5f2=this;return function(_0xa2a06d){if(_0xa2a06d){freeIsNotKeySip(_0xa2a06d,_0x36d5f2[_0x87ef('0x12')]);for(var _0x44c401=0x0,_0x27aa9d={},_0x5d610f={};_0x44c401<_0xa2a06d[_0x87ef('0x3f')];_0x44c401+=0x1){_0x27aa9d=_0xa2a06d[_0x44c401];if(_[_0x87ef('0x41')](_0x36d5f2['trunks'][util[_0x87ef('0x28')](_0x87ef('0x25'),_0x27aa9d['name'])])){_0x36d5f2['trunks'][util['format'](_0x87ef('0x25'),_0x27aa9d['name'])]=new Trunk(_0x27aa9d);}else{_0x36d5f2['mergeFromDatabase'](_0x36d5f2[_0x87ef('0x12')][util['format'](_0x87ef('0x25'),_0x27aa9d[_0x87ef('0x26')])],_0x27aa9d);}}}return _0x36d5f2['trunks'];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x43')]=function(){var _0x7c40c0=this;return function(_0x1b0843){if(_0x1b0843){freeIsNotKey(_0x1b0843,_0x7c40c0[_0x87ef('0x13')],_0x87ef('0x26'));for(var _0x4338a7=0x0,_0x4e72e1={},_0x319862={};_0x4338a7<_0x1b0843[_0x87ef('0x3f')];_0x4338a7+=0x1){_0x4e72e1=_0x1b0843[_0x4338a7];if(_['isUndefined'](_0x7c40c0[_0x87ef('0x13')][_0x4e72e1[_0x87ef('0x26')]])){_0x7c40c0[_0x87ef('0x13')][_0x4e72e1[_0x87ef('0x26')]]=new VoiceQueue(_0x4e72e1);}else{_0x7c40c0[_0x87ef('0x3d')](_0x7c40c0[_0x87ef('0x13')][_0x4e72e1['name']],_0x4e72e1);}}}return _0x7c40c0[_0x87ef('0x13')];};};Realtime[_0x87ef('0x3c')]['initTriggers']=function(){var _0x160949=this;return function(_0x33e52a){if(_0x33e52a){freeIsNotKey(_0x33e52a,_0x160949['triggers'],'id');for(var _0x1b908a=0x0,_0x5b35b6={},_0x4ad22f={};_0x1b908a<_0x33e52a[_0x87ef('0x3f')];_0x1b908a+=0x1){_0x5b35b6=_0x33e52a[_0x1b908a];if(_[_0x87ef('0x41')](_0x160949[_0x87ef('0x14')][_0x5b35b6['id']])){_0x160949[_0x87ef('0x14')][_0x5b35b6['id']]=new Trigger(_0x5b35b6);}else{_0x160949[_0x87ef('0x3d')](_0x160949[_0x87ef('0x14')][_0x5b35b6['id']],_0x5b35b6);}}}return _0x160949['triggers'];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x44')]=function(){var _0x3e466f=this;return function(_0x1c8373){if(_0x1c8373){freeIsNotKey(_0x1c8373,_0x3e466f[_0x87ef('0x16')],'id');for(var _0xe49ae9=0x0,_0x322e12={},_0x12daa1={};_0xe49ae9<_0x1c8373[_0x87ef('0x3f')];_0xe49ae9+=0x1){_0x322e12=_0x1c8373[_0xe49ae9];if(_['isUndefined'](_0x3e466f[_0x87ef('0x16')][_0x322e12['id']])){_0x3e466f['templates'][_0x322e12['id']]=new Template(_0x322e12);}else{_0x3e466f['mergeFromDatabase'](_0x3e466f[_0x87ef('0x16')][_0x322e12['id']],_0x322e12);}}}return _0x3e466f['templates'];};};Realtime['prototype'][_0x87ef('0x45')]=function(){var _0x24c296=this;return function(_0x1363bd){if(_0x1363bd){freeIsNotKey(_0x1363bd,_0x24c296[_0x87ef('0x1c')],'id');for(var _0x1b108b=0x0,_0x59b665={},_0x16fb64={};_0x1b108b<_0x1363bd[_0x87ef('0x3f')];_0x1b108b+=0x1){_0x59b665=_0x1363bd[_0x1b108b];if(_['isUndefined'](_0x24c296[_0x87ef('0x1c')][_0x59b665['id']])){_0x24c296[_0x87ef('0x1c')][_0x59b665['id']]=new ZendeskAccount(_0x59b665);}else{_0x24c296[_0x87ef('0x3d')](_0x24c296[_0x87ef('0x1c')][_0x59b665['id']],_0x59b665);}}}return _0x24c296['zendeskAccounts'];};};Realtime['prototype'][_0x87ef('0x46')]=function(){var _0x2e2844=this;return function(_0x4fbacf){if(_0x4fbacf){freeIsNotKey(_0x4fbacf,_0x2e2844[_0x87ef('0x47')],'id');for(var _0x44eab0=0x0,_0x1f0994={},_0x47a302={};_0x44eab0<_0x4fbacf['length'];_0x44eab0+=0x1){_0x1f0994=_0x4fbacf[_0x44eab0];if(_[_0x87ef('0x41')](_0x2e2844[_0x87ef('0x47')][_0x1f0994['id']])){_0x2e2844[_0x87ef('0x47')][_0x1f0994['id']]=new SalesforceAccount(_0x1f0994);}else{_0x2e2844[_0x87ef('0x3d')](_0x2e2844[_0x87ef('0x47')][_0x1f0994['id']],_0x1f0994);}}}return _0x2e2844[_0x87ef('0x47')];};};Realtime['prototype'][_0x87ef('0x48')]=function(){var _0x520f50=this;return function(_0x37862b){if(_0x37862b){freeIsNotKey(_0x37862b,_0x520f50[_0x87ef('0x1e')],'id');for(var _0x1f9b29=0x0,_0x3c8705={},_0x43dbda={};_0x1f9b29<_0x37862b['length'];_0x1f9b29+=0x1){_0x3c8705=_0x37862b[_0x1f9b29];if(_[_0x87ef('0x41')](_0x520f50[_0x87ef('0x1e')][_0x3c8705['id']])){_0x520f50['freshdeskAccounts'][_0x3c8705['id']]=new FreshdeskAccount(_0x3c8705);}else{_0x520f50[_0x87ef('0x3d')](_0x520f50[_0x87ef('0x1e')][_0x3c8705['id']],_0x3c8705);}}}return _0x520f50['freshdeskAccounts'];};};Realtime['prototype'][_0x87ef('0x49')]=function(){var _0x40df29=this;return function(_0x26cf2a){if(_0x26cf2a){freeIsNotKey(_0x26cf2a,_0x40df29[_0x87ef('0x1f')],'id');for(var _0x4c8472=0x0,_0x261b3d={},_0x2a2c96={};_0x4c8472<_0x26cf2a[_0x87ef('0x3f')];_0x4c8472+=0x1){_0x261b3d=_0x26cf2a[_0x4c8472];if(_[_0x87ef('0x41')](_0x40df29[_0x87ef('0x1f')][_0x261b3d['id']])){_0x40df29[_0x87ef('0x1f')][_0x261b3d['id']]=new ZohoAccount(_0x261b3d);}else{_0x40df29[_0x87ef('0x3d')](_0x40df29['zohoAccounts'][_0x261b3d['id']],_0x261b3d);}}}return _0x40df29['zohoAccounts'];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x4a')]=function(){var _0x1ed646=this;return function(_0xa7ae98){if(_0xa7ae98){freeIsNotKey(_0xa7ae98,_0x1ed646['deskAccounts'],'id');for(var _0x7126c8=0x0,_0x123a6e={},_0x54f612={};_0x7126c8<_0xa7ae98[_0x87ef('0x3f')];_0x7126c8+=0x1){_0x123a6e=_0xa7ae98[_0x7126c8];if(_[_0x87ef('0x41')](_0x1ed646['deskAccounts'][_0x123a6e['id']])){_0x1ed646['deskAccounts'][_0x123a6e['id']]=new DeskAccount(_0x123a6e);}else{_0x1ed646[_0x87ef('0x3d')](_0x1ed646[_0x87ef('0x4b')][_0x123a6e['id']],_0x123a6e);}}}return _0x1ed646[_0x87ef('0x4b')];};};Realtime['prototype'][_0x87ef('0x4c')]=function(){var _0x480e37=this;return function(_0x390c50){if(_0x390c50){freeIsNotKey(_0x390c50,_0x480e37[_0x87ef('0x1d')],'id');for(var _0x448c17=0x0,_0x5a1e0d={},_0x2f4a99={};_0x448c17<_0x390c50['length'];_0x448c17+=0x1){_0x5a1e0d=_0x390c50[_0x448c17];if(_[_0x87ef('0x41')](_0x480e37['sugarcrmAccounts'][_0x5a1e0d['id']])){_0x480e37[_0x87ef('0x1d')][_0x5a1e0d['id']]=new SugarcrmAccount(_0x5a1e0d);}else{_0x480e37[_0x87ef('0x3d')](_0x480e37[_0x87ef('0x1d')][_0x5a1e0d['id']],_0x5a1e0d);}}}return _0x480e37[_0x87ef('0x1d')];};};Realtime['prototype'][_0x87ef('0x4d')]=function(){var _0x4618f5=this;return function(_0x5132a2){if(_0x5132a2){freeIsNotKey(_0x5132a2,_0x4618f5[_0x87ef('0x4e')],'id');for(var _0x121f59=0x0,_0x300b6b={},_0x3c4f28={};_0x121f59<_0x5132a2['length'];_0x121f59+=0x1){_0x300b6b=_0x5132a2[_0x121f59];if(_[_0x87ef('0x41')](_0x4618f5[_0x87ef('0x4e')][_0x300b6b['id']])){_0x4618f5[_0x87ef('0x4e')][_0x300b6b['id']]=new VtigerAccount(_0x300b6b);}else{_0x4618f5[_0x87ef('0x3d')](_0x4618f5[_0x87ef('0x4e')][_0x300b6b['id']],_0x300b6b);}}}return _0x4618f5['vtigerAccounts'];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x4f')]=function(){var _0x189b3d=this;return function(_0x272f1b){if(_0x272f1b){freeIsNotKey(_0x272f1b,_0x189b3d['servicenowAccounts'],'id');for(var _0x16d066=0x0,_0x3e3149={},_0x262304={};_0x16d066<_0x272f1b['length'];_0x16d066+=0x1){_0x3e3149=_0x272f1b[_0x16d066];if(_['isUndefined'](_0x189b3d[_0x87ef('0x20')][_0x3e3149['id']])){_0x189b3d[_0x87ef('0x20')][_0x3e3149['id']]=new ServicenowAccount(_0x3e3149);}else{_0x189b3d[_0x87ef('0x3d')](_0x189b3d[_0x87ef('0x20')][_0x3e3149['id']],_0x3e3149);}}}return _0x189b3d[_0x87ef('0x20')];};};Realtime[_0x87ef('0x3c')]['initDynamics365Accounts']=function(){var _0x47df5f=this;return function(_0x5c1f62){if(_0x5c1f62){freeIsNotKey(_0x5c1f62,_0x47df5f['dynamics365Accounts'],'id');for(var _0x374e8c=0x0,_0x121c72={},_0xa678f1={};_0x374e8c<_0x5c1f62[_0x87ef('0x3f')];_0x374e8c+=0x1){_0x121c72=_0x5c1f62[_0x374e8c];if(_[_0x87ef('0x41')](_0x47df5f[_0x87ef('0x50')][_0x121c72['id']])){_0x47df5f[_0x87ef('0x50')][_0x121c72['id']]=new Dynamics365Account(_0x121c72);}else{_0x47df5f[_0x87ef('0x3d')](_0x47df5f[_0x87ef('0x50')][_0x121c72['id']],_0x121c72);}}}return _0x47df5f[_0x87ef('0x50')];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x51')]=function(){var _0x1ab1af=this;return function(_0x313d28){if(_0x313d28){freeIsNotKey(_0x313d28,_0x1ab1af[_0x87ef('0x21')],'id');for(var _0x652a08=0x0,_0x45796a={},_0x2b9a16={};_0x652a08<_0x313d28['length'];_0x652a08+=0x1){_0x45796a=_0x313d28[_0x652a08];if(_[_0x87ef('0x41')](_0x1ab1af['freshsalesAccounts'][_0x45796a['id']])){_0x1ab1af[_0x87ef('0x21')][_0x45796a['id']]=new FreshsalesAccount(_0x45796a);}else{_0x1ab1af[_0x87ef('0x3d')](_0x1ab1af[_0x87ef('0x21')][_0x45796a['id']],_0x45796a);}}}return _0x1ab1af[_0x87ef('0x21')];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x52')]=function(){var _0x11218e=this;return function(_0x22c29f){for(var _0x5de566=0x0;_0x5de566<_0x22c29f[_0x87ef('0x3f')];_0x5de566+=0x1){_['merge'](_0x11218e[_0x87ef('0x13')][_0x22c29f[_0x5de566]['name']],_0x22c29f[_0x5de566]);}return _0x11218e[_0x87ef('0x13')];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x53')]=function(){var _0x2dba81=this;return function(_0xd3724b){clearVoiceQueues(_0x2dba81['voiceQueues']);if(_0xd3724b){_0xd3724b=_['groupBy'](_0xd3724b,_0x87ef('0x54'));for(var _0x22cb57 in _0xd3724b){if(_0xd3724b['hasOwnProperty'](_0x22cb57)){var _0x4116c4={};for(var _0x7284cd=0x0;_0x7284cd<_0xd3724b[_0x22cb57][_0x87ef('0x3f')];_0x7284cd+=0x1){var _0x46731b=_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x55')];if(_0x2dba81[_0x87ef('0x13')][_0x46731b]){if(_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x56')]){_0x2dba81['voiceQueues'][_0x46731b][_0x87ef('0x2f')]+=0x1;}if(_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x57')]){_0x2dba81['voiceQueues'][_0x46731b][_0x87ef('0x30')]+=0x1;}_0x2dba81[_0x87ef('0x13')][_0x46731b][_0x87ef('0x2b')]+=moment(_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x58')])[_0x87ef('0x59')](moment(_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x5a')]),'seconds')||0x0;if(_0x7284cd===_0xd3724b[_0x22cb57]['length']-0x1){_0x2dba81[_0x87ef('0x13')][_0x46731b][_0x87ef('0x2c')]+=moment(_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x5b')]||_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x5c')]||_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x5d')])['diff'](moment(_0xd3724b[_0x22cb57][_0x7284cd]['queuecallerjoinAt']),_0x87ef('0x5e'))||0x0;_0x2dba81[_0x87ef('0x13')][_0x46731b][_0x87ef('0x29')]+=0x1;if(_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x5f')]){_0x2dba81[_0x87ef('0x13')][_0x46731b][_0x87ef('0x2a')]+=0x1;_0x2dba81[_0x87ef('0x13')][_0x46731b][_0x87ef('0x2d')]+=moment(_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x5b')])[_0x87ef('0x59')](moment(_0xd3724b[_0x22cb57][_0x7284cd][_0x87ef('0x58')]),'seconds')||0x0;}}else{_0x2dba81['voiceQueues'][_0x46731b][_0x87ef('0x2c')]+=_0x2dba81[_0x87ef('0x13')][_0x46731b][_0x87ef('0x2b')]||0x0;}}}}}}return _0x2dba81[_0x87ef('0x13')];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x60')]=function(){var _0x89bb13=this;return function(_0x2aa9c4){clearVoiceCallReports(_0x89bb13[_0x87ef('0x61')]);if(_0x2aa9c4){for(var _0x15f05b=0x0;_0x15f05b<_0x2aa9c4['length'];_0x15f05b+=0x1){_0x89bb13[_0x87ef('0x61')][_0x87ef('0x29')]+=0x1;_0x89bb13[_0x87ef('0x61')][_0x87ef('0x2c')]+=_0x2aa9c4[_0x15f05b][_0x87ef('0x62')];if(_0x2aa9c4[_0x15f05b][_0x87ef('0x63')]===_0x87ef('0x64')){_0x89bb13[_0x87ef('0x61')][_0x87ef('0x2a')]+=0x1;_0x89bb13[_0x87ef('0x61')][_0x87ef('0x2b')]+=_0x2aa9c4[_0x15f05b][_0x87ef('0x62')]-_0x2aa9c4[_0x15f05b]['billableseconds']||0x0;_0x89bb13[_0x87ef('0x61')][_0x87ef('0x2d')]+=_0x2aa9c4[_0x15f05b][_0x87ef('0x65')];}}}return _0x89bb13['outbound'];};};Realtime[_0x87ef('0x3c')]['initCampaigns']=function(){var _0x84f0dd=this;return function(_0x24dfc4){if(_0x24dfc4){freeIsNotKey(_0x24dfc4,_0x84f0dd[_0x87ef('0x15')],_0x87ef('0x26'));for(var _0x431350=0x0,_0x272d3d={};_0x431350<_0x24dfc4[_0x87ef('0x3f')];_0x431350+=0x1){_0x272d3d=_0x24dfc4[_0x431350];if(_[_0x87ef('0x41')](_0x84f0dd[_0x87ef('0x15')][_0x272d3d[_0x87ef('0x26')]])){_0x84f0dd['campaigns'][_0x272d3d[_0x87ef('0x26')]]=new Campaign(_0x272d3d);}else{_0x84f0dd[_0x87ef('0x3d')](_0x84f0dd[_0x87ef('0x15')][_0x272d3d[_0x87ef('0x26')]],_0x272d3d);_0x84f0dd[_0x87ef('0x15')][_0x272d3d[_0x87ef('0x26')]][_0x87ef('0x66')]=_0x272d3d['SquareProject']?_0x272d3d[_0x87ef('0x67')][_0x87ef('0x26')]:undefined;}}}return _0x84f0dd['campaigns'];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x68')]=function(){var _0xf9905d=this;return function(_0x481e45){if(_0x481e45){freeIsNotKey(_0x481e45,_0xf9905d[_0x87ef('0x17')],'id');for(var _0xae2fd8=0x0,_0x1490b7={};_0xae2fd8<_0x481e45[_0x87ef('0x3f')];_0xae2fd8+=0x1){_0x1490b7=_0x481e45[_0xae2fd8];if(_[_0x87ef('0x41')](_0xf9905d[_0x87ef('0x17')][_0x1490b7['id']])){_0xf9905d[_0x87ef('0x17')][_0x1490b7['id']]=new VoiceExtension(_0x1490b7);}else{_0xf9905d[_0x87ef('0x3d')](_0xf9905d[_0x87ef('0x17')][_0x1490b7['id']],_0x1490b7);}}}return _0xf9905d[_0x87ef('0x17')];};};Realtime[_0x87ef('0x3c')][_0x87ef('0x69')]=function(){var _0x5da95e=this;return function(_0x232ef7){clearCampaigns(_0x5da95e[_0x87ef('0x15')]);for(var _0x274b13=0x0;_0x274b13<_0x232ef7['length'];_0x274b13+=0x1){_[_0x87ef('0x6a')](_0x5da95e['campaigns'][_0x232ef7[_0x274b13][_0x87ef('0x26')]],_0x232ef7[_0x274b13]);}return _0x5da95e[_0x87ef('0x15')];};};Realtime[_0x87ef('0x3c')]['initFaxAccounts']=function(){var _0x551b59=this;return function(_0x4cb25d){if(_0x4cb25d){freeIsNotKey(_0x4cb25d,_0x551b59[_0x87ef('0x22')],'id');for(var _0x443d88=0x0,_0x1fb6da={},_0x4c6be9={};_0x443d88<_0x4cb25d[_0x87ef('0x3f')];_0x443d88+=0x1){_0x1fb6da=_0x4cb25d[_0x443d88];if(_[_0x87ef('0x41')](_0x551b59[_0x87ef('0x22')][_0x1fb6da['id']])){_0x551b59['faxAccounts'][_0x1fb6da['id']]=new FaxAccount(_0x1fb6da);}else{_0x551b59[_0x87ef('0x3d')](_0x551b59[_0x87ef('0x22')][_0x1fb6da['id']],_0x1fb6da);}}}return _0x551b59[_0x87ef('0x22')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 812ff5f..d3b36e2 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 _0x0caa=['uniqueid','monitor','monitors','monitorFilename','filename','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','attendedTransfer','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid'];(function(_0x53d709,_0x1906f6){var _0xc1f741=function(_0x5a6643){while(--_0x5a6643){_0x53d709['push'](_0x53d709['shift']());}};_0xc1f741(++_0x1906f6);}(_0x0caa,0x105));var _0xa0ca=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x0caa[_0x9307ea];return _0x295554;};'use strict';var _=require(_0xa0ca('0x0'));var moment=require(_0xa0ca('0x1'));var util=require(_0xa0ca('0x2'));var config=require('../../../config/environment');var ami=require(_0xa0ca('0x3'));var RpcVoiceAgentReport=require(_0xa0ca('0x4'));var RpcVoiceCallReport=require(_0xa0ca('0x5'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xa0ca('0x6'));var RpcVoiceRecording=require(_0xa0ca('0x7'));var RpcVoiceTransferReport=require(_0xa0ca('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xa0ca('0x9'));var VoiceAgentReport=require(_0xa0ca('0xa'));var VoiceDialReport=require(_0xa0ca('0xb'));var UserReport=require('./userReport');function Report(_0x116c6a){this[_0xa0ca('0xc')]=_0x116c6a;this['agents']=_0x116c6a[_0xa0ca('0xd')];this[_0xa0ca('0xe')]=_0x116c6a['telephones'];}Report[_0xa0ca('0xf')][_0xa0ca('0x10')]=function(_0x492a52){var _0x35d4f0=new VoiceQueueReport(this['realtime']);var _0x1a4017=new VoiceAgentReport(this[_0xa0ca('0xc')]);var _0x3b3c5d=new VoiceDialReport(this['realtime']);var _0x353080=new VoiceCallReport(this[_0xa0ca('0xc')]);var _0x52d064=new UserReport(this[_0xa0ca('0xc')]);if(config['xdr']&&config[_0xa0ca('0x11')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0xa0ca('0x12')][_0xa0ca('0x13')](this));ami['on'](_0xa0ca('0x14'),this[_0xa0ca('0x15')][_0xa0ca('0x13')](this));ami['on'](_0xa0ca('0x16'),this[_0xa0ca('0x17')][_0xa0ca('0x13')](this));ami['on']('custom:voiceDialReport',this[_0xa0ca('0x18')][_0xa0ca('0x13')](this));ami['on']('blindtransfer',this[_0xa0ca('0x19')][_0xa0ca('0x13')](this));ami['on'](_0xa0ca('0x1a'),this['attendedTransfer']['bind'](this));}};Report[_0xa0ca('0xf')][_0xa0ca('0x1b')]=function(_0x423be3){var _0x5ccd58;_0x5ccd58=_[_0xa0ca('0x1c')](this[_0xa0ca('0xd')],function(_0x7d5a5c){return _0x7d5a5c[_0xa0ca('0x1d')]==_0x423be3||_0x7d5a5c[_0xa0ca('0x1e')]==_0x423be3;});if(_[_0xa0ca('0x1f')](_0x5ccd58)){var _0x5ae36a=_[_0xa0ca('0x1c')](this[_0xa0ca('0xe')],function(_0x4b9cc1){return _0x4b9cc1[_0xa0ca('0x1d')]==_0x423be3||_0x4b9cc1[_0xa0ca('0x1e')]==_0x423be3;});if(_0x5ae36a){_0x5ccd58=_[_0xa0ca('0x1c')](this[_0xa0ca('0xd')],function(_0x7b26e1){return _0x7b26e1[_0xa0ca('0x20')]==util[_0xa0ca('0x21')](_0xa0ca('0x22'),_0x5ae36a[_0xa0ca('0x1e')]);});}}return _0x5ccd58;};Report[_0xa0ca('0xf')]['voiceQueueReport']=function(_0xf1bca1){for(var _0x381ee2=0x0;_0x381ee2<_0xf1bca1[_0xa0ca('0x23')];_0x381ee2+=0x1){var _0x57200d=this['findAgent'](_0xf1bca1[_0x381ee2][_0xa0ca('0x24')]);if(_0x57200d){_0xf1bca1[_0x381ee2][_0xa0ca('0x1d')]=_0x57200d[_0xa0ca('0x1d')];_0xf1bca1[_0x381ee2][_0xa0ca('0x25')]=!![];_0xf1bca1[_0x381ee2]['lastAssignedTo']=_0x57200d['name'];_0xf1bca1[_0x381ee2][_0xa0ca('0x20')]=_['isNil'](_0x57200d[_0xa0ca('0x20')])?util[_0xa0ca('0x21')](_0xa0ca('0x22'),_0x57200d['name']):_0x57200d[_0xa0ca('0x20')];if(_0xf1bca1[_0x381ee2]['queuecallercomplete']){_0xf1bca1[_0x381ee2]['queuecallercompleteAt']=moment()[_0xa0ca('0x21')](_0xa0ca('0x26'));}if(_0xf1bca1[_0x381ee2][_0xa0ca('0x27')]){_0xf1bca1[_0x381ee2][_0xa0ca('0x28')]=moment()[_0xa0ca('0x21')](_0xa0ca('0x26'));}RpcMemberReport[_0xa0ca('0x12')](_0xf1bca1[_0x381ee2]);}RpcVoiceQueueReport[_0xa0ca('0x29')](_0xf1bca1[_0x381ee2]);}};function extractCalleridNumber(_0x107778){var _0x5ccf5c=_0x107778[_0xa0ca('0x2a')](/<(.*?)>/);return _0x5ccf5c?_0x5ccf5c[0x1]:_0x107778;}Report[_0xa0ca('0xf')]['voiceCallReport']=function(_0x5250ef){_0x5250ef[_0xa0ca('0x2b')]=_0x5250ef[_0xa0ca('0x2b')]||_0x5250ef[_0xa0ca('0x2c')];if(_0x5250ef[_0xa0ca('0x2d')]=='dialer'){_0x5250ef['lastapplication']='queue';_0x5250ef['lastdata']=_0x5250ef[_0xa0ca('0x2e')];if(_0x5250ef[_0xa0ca('0x2f')]==_0xa0ca('0x30')){_0x5250ef[_0xa0ca('0x1d')]='';_0x5250ef['destination']=extractCalleridNumber(_0x5250ef[_0xa0ca('0x31')]);}else if(_0x5250ef[_0xa0ca('0x2f')]==_0xa0ca('0x32')){if(_0x5250ef[_0xa0ca('0x2b')]==_0xa0ca('0x33')){_0x5250ef['destination']=extractCalleridNumber(_0x5250ef[_0xa0ca('0x34')]);_0x5250ef[_0xa0ca('0x35')]=_0x5250ef[_0xa0ca('0x36')];_0x5250ef[_0xa0ca('0x37')]=[_0x5250ef[_0xa0ca('0x38')],_0x5250ef[_0xa0ca('0x38')]=_0x5250ef[_0xa0ca('0x37')]][0x0];_0x5250ef['callerid']=_0x5250ef['calleridpreview'];}else{_0x5250ef[_0xa0ca('0x2b')]=_0x5250ef[_0xa0ca('0x35')];_0x5250ef['calleridnum']=_0x5250ef[_0xa0ca('0x36')];if(_0x5250ef['disposition']==_0xa0ca('0x39')){_0x5250ef[_0xa0ca('0x1d')]=_0x5250ef[_0xa0ca('0x24')];}else{_0x5250ef['accountcode']='';}}}}else{_0x5250ef[_0xa0ca('0x31')]=util[_0xa0ca('0x21')](_0xa0ca('0x3a'),_0x5250ef[_0xa0ca('0x3b')],_0x5250ef['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x5250ef[_0xa0ca('0x3c')]]){var _0x167317=RpcVoiceTransferReport[_0xa0ca('0x3d')][_0x5250ef['linkedid']];_0x167317[_0xa0ca('0x3e')]=_0x5250ef[_0xa0ca('0x3f')];RpcVoiceTransferReport['blindTransfer'](_0x167317);delete RpcVoiceTransferReport[_0xa0ca('0x3d')][_0x5250ef[_0xa0ca('0x3c')]];}RpcVoiceCallReport['create'](_0x5250ef);if(_0x5250ef[_0xa0ca('0x40')]){for(var _0x3fbb0c=0x0;_0x3fbb0c<_0x5250ef[_0xa0ca('0x41')][_0xa0ca('0x23')];_0x3fbb0c+=0x1){_0x5250ef[_0xa0ca('0x42')]=_0x5250ef['monitors'][_0x3fbb0c][_0xa0ca('0x43')];_0x5250ef['createdAt']=_0x5250ef[_0xa0ca('0x41')][_0x3fbb0c]['createdAt'];if(_0x5250ef['exten']=='xcally-motion-preview'){_0x5250ef[_0xa0ca('0x35')]=_0x5250ef[_0xa0ca('0x24')];_0x5250ef[_0xa0ca('0x3b')]=_0x5250ef[_0xa0ca('0x44')];_0x5250ef[_0xa0ca('0x24')]=_0x5250ef[_0xa0ca('0x1d')];_0x5250ef[_0xa0ca('0x44')]=_0x5250ef['membername'];_0x5250ef['exten']=_0x5250ef[_0xa0ca('0x36')];}else if(_0x5250ef['exten']==_0xa0ca('0x45')){_0x5250ef['calleridnum']=_0x5250ef['destination'];_0x5250ef[_0xa0ca('0x2c')]=_0x5250ef['originatecalleridnum'];}RpcVoiceRecording[_0xa0ca('0x29')](_0x5250ef);}}};Report[_0xa0ca('0xf')][_0xa0ca('0x17')]=function(_0x24b101){if(_[_0xa0ca('0x46')](_0x24b101)){_0x24b101[_0xa0ca('0x47')](function(_0x51ef10){RpcVoiceAgentReport['create'](_0x51ef10);});}else{RpcVoiceAgentReport[_0xa0ca('0x29')](_0x24b101);}};Report[_0xa0ca('0xf')][_0xa0ca('0x18')]=function(_0x5ecd61){RpcVoiceDialReport[_0xa0ca('0x29')](_0x5ecd61);var _0x1fd18f;var _0x3fa005;var _0x20e363=_0x5ecd61[_0xa0ca('0x38')];if(_[_0xa0ca('0x48')](_0x20e363,_0xa0ca('0x49'))){_0x3fa005=_0x20e363[_0xa0ca('0x4a')](_0x20e363['indexOf']('/')+0x1,_0x20e363[_0xa0ca('0x4b')]('@'));_0x1fd18f=_[_0xa0ca('0x1c')](this[_0xa0ca('0xd')],function(_0x31b716){return _0x31b716[_0xa0ca('0x4c')]==_0x3fa005||_0x31b716[_0xa0ca('0x4d')]==_0x3fa005||_0x31b716['accountcode']==_0x3fa005;});}else{_0x3fa005=_0x20e363[_0xa0ca('0x4a')](_0x20e363[_0xa0ca('0x4b')]('/')+0x1,_0x20e363[_0xa0ca('0x4e')]('-'));_0x1fd18f=this[_0xa0ca('0x1b')](_0x3fa005);}if(_0x1fd18f){_0x5ecd61['interface']=_[_0xa0ca('0x1f')](_0x1fd18f[_0xa0ca('0x20')])?util[_0xa0ca('0x21')](_0xa0ca('0x22'),_0x1fd18f[_0xa0ca('0x1e')]):_0x1fd18f[_0xa0ca('0x20')];_0x5ecd61[_0xa0ca('0x4f')]=_0x1fd18f[_0xa0ca('0x1e')];_0x5ecd61[_0xa0ca('0x1d')]=_0x1fd18f[_0xa0ca('0x1d')];RpcMemberReport[_0xa0ca('0x18')](_0x5ecd61);}};Report[_0xa0ca('0xf')]['blindTransfer']=function(_0x4d00ba){RpcVoiceTransferReport[_0xa0ca('0x3d')][_0x4d00ba['transfererlinkedid']]=_0x4d00ba;};Report[_0xa0ca('0xf')][_0xa0ca('0x50')]=function(_0x444656){RpcVoiceTransferReport[_0xa0ca('0x50')](_0x444656);};module['exports']=Report; \ No newline at end of file +var _0xadae=['length','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','isArray','forEach','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','lodash','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format'];(function(_0x24413f,_0xc92728){var _0x4067d8=function(_0x1439c6){while(--_0x1439c6){_0x24413f['push'](_0x24413f['shift']());}};_0x4067d8(++_0xc92728);}(_0xadae,0x137));var _0xeada=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xadae[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xeada('0x0'));var moment=require('moment');var util=require(_0xeada('0x1'));var config=require(_0xeada('0x2'));var ami=require(_0xeada('0x3'));var RpcVoiceAgentReport=require(_0xeada('0x4'));var RpcVoiceCallReport=require(_0xeada('0x5'));var RpcVoiceDialReport=require(_0xeada('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xeada('0x7'));var RpcVoiceRecording=require(_0xeada('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xeada('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xeada('0xa'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xeada('0xb'));function Report(_0x159050){this[_0xeada('0xc')]=_0x159050;this[_0xeada('0xd')]=_0x159050[_0xeada('0xd')];this[_0xeada('0xe')]=_0x159050[_0xeada('0xe')];}Report[_0xeada('0xf')][_0xeada('0x10')]=function(_0x382014){var _0x21a928=new VoiceQueueReport(this[_0xeada('0xc')]);var _0xaa5caf=new VoiceAgentReport(this[_0xeada('0xc')]);var _0x5f0e01=new VoiceDialReport(this[_0xeada('0xc')]);var _0xf6d0bd=new VoiceCallReport(this[_0xeada('0xc')]);var _0x82c712=new UserReport(this[_0xeada('0xc')]);if(config[_0xeada('0x11')]&&config[_0xeada('0x11')][_0xeada('0x12')]){ami['on'](_0xeada('0x13'),this[_0xeada('0x14')][_0xeada('0x15')](this));ami['on'](_0xeada('0x16'),this['voiceCallReport']['bind'](this));ami['on'](_0xeada('0x17'),this[_0xeada('0x18')][_0xeada('0x15')](this));ami['on']('custom:voiceDialReport',this[_0xeada('0x19')][_0xeada('0x15')](this));ami['on'](_0xeada('0x1a'),this[_0xeada('0x1b')][_0xeada('0x15')](this));ami['on'](_0xeada('0x1c'),this[_0xeada('0x1d')][_0xeada('0x15')](this));}};Report[_0xeada('0xf')][_0xeada('0x1e')]=function(_0x3b82e9){var _0x38d75a;_0x38d75a=_['find'](this[_0xeada('0xd')],function(_0x585afa){return _0x585afa[_0xeada('0x1f')]==_0x3b82e9||_0x585afa[_0xeada('0x20')]==_0x3b82e9;});if(_[_0xeada('0x21')](_0x38d75a)){var _0x1ce8c3=_[_0xeada('0x22')](this[_0xeada('0xe')],function(_0x15a61d){return _0x15a61d[_0xeada('0x1f')]==_0x3b82e9||_0x15a61d[_0xeada('0x20')]==_0x3b82e9;});if(_0x1ce8c3){_0x38d75a=_[_0xeada('0x22')](this[_0xeada('0xd')],function(_0x49e7de){return _0x49e7de[_0xeada('0x23')]==util[_0xeada('0x24')]('SIP/%s',_0x1ce8c3[_0xeada('0x20')]);});}}return _0x38d75a;};Report[_0xeada('0xf')][_0xeada('0x14')]=function(_0x40736c){for(var _0x54ddec=0x0;_0x54ddec<_0x40736c[_0xeada('0x25')];_0x54ddec+=0x1){var _0x52d211=this[_0xeada('0x1e')](_0x40736c[_0x54ddec][_0xeada('0x26')]);if(_0x52d211){_0x40736c[_0x54ddec][_0xeada('0x1f')]=_0x52d211[_0xeada('0x1f')];_0x40736c[_0x54ddec][_0xeada('0x27')]=!![];_0x40736c[_0x54ddec][_0xeada('0x28')]=_0x52d211[_0xeada('0x20')];_0x40736c[_0x54ddec][_0xeada('0x23')]=_['isNil'](_0x52d211['interface'])?util[_0xeada('0x24')](_0xeada('0x29'),_0x52d211[_0xeada('0x20')]):_0x52d211['interface'];if(_0x40736c[_0x54ddec]['queuecallercomplete']){_0x40736c[_0x54ddec][_0xeada('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x40736c[_0x54ddec][_0xeada('0x2b')]){_0x40736c[_0x54ddec][_0xeada('0x2c')]=moment()[_0xeada('0x24')](_0xeada('0x2d'));}RpcMemberReport[_0xeada('0x14')](_0x40736c[_0x54ddec]);}RpcVoiceQueueReport[_0xeada('0x2e')](_0x40736c[_0x54ddec]);}};function extractCalleridNumber(_0x4fc327){var _0x3829ff=_0x4fc327[_0xeada('0x2f')](/<(.*?)>/);return _0x3829ff?_0x3829ff[0x1]:_0x4fc327;}Report[_0xeada('0xf')][_0xeada('0x30')]=function(_0x2b4db0){_0x2b4db0[_0xeada('0x31')]=_0x2b4db0[_0xeada('0x31')]||_0x2b4db0[_0xeada('0x32')];if(_0x2b4db0[_0xeada('0x33')]==_0xeada('0x34')){_0x2b4db0[_0xeada('0x35')]=_0xeada('0x36');_0x2b4db0[_0xeada('0x37')]=_0x2b4db0[_0xeada('0x36')];if(_0x2b4db0[_0xeada('0x38')]=='from-voip-provider'){_0x2b4db0[_0xeada('0x1f')]='';_0x2b4db0[_0xeada('0x31')]=extractCalleridNumber(_0x2b4db0[_0xeada('0x39')]);}else if(_0x2b4db0[_0xeada('0x38')]==_0xeada('0x3a')){if(_0x2b4db0['destination']==_0xeada('0x3b')){_0x2b4db0[_0xeada('0x31')]=extractCalleridNumber(_0x2b4db0[_0xeada('0x3c')]);_0x2b4db0[_0xeada('0x3d')]=_0x2b4db0[_0xeada('0x3e')];_0x2b4db0['destinationchannel']=[_0x2b4db0['channel'],_0x2b4db0[_0xeada('0x3f')]=_0x2b4db0[_0xeada('0x40')]][0x0];_0x2b4db0[_0xeada('0x39')]=_0x2b4db0['calleridpreview'];}else{_0x2b4db0[_0xeada('0x31')]=_0x2b4db0[_0xeada('0x3d')];_0x2b4db0[_0xeada('0x3d')]=_0x2b4db0[_0xeada('0x3e')];if(_0x2b4db0[_0xeada('0x41')]==_0xeada('0x42')){_0x2b4db0[_0xeada('0x1f')]=_0x2b4db0[_0xeada('0x26')];}else{_0x2b4db0[_0xeada('0x1f')]='';}}}}else{_0x2b4db0[_0xeada('0x39')]=util[_0xeada('0x24')](_0xeada('0x43'),_0x2b4db0[_0xeada('0x44')],_0x2b4db0[_0xeada('0x3d')]);}if(RpcVoiceTransferReport['transfers'][_0x2b4db0['linkedid']]){var _0x395e7e=RpcVoiceTransferReport['transfers'][_0x2b4db0[_0xeada('0x45')]];_0x395e7e[_0xeada('0x46')]=_0x2b4db0[_0xeada('0x47')];RpcVoiceTransferReport[_0xeada('0x1b')](_0x395e7e);delete RpcVoiceTransferReport[_0xeada('0x48')][_0x2b4db0['linkedid']];}RpcVoiceCallReport['create'](_0x2b4db0);if(_0x2b4db0['monitor']){for(var _0x4441ec=0x0;_0x4441ec<_0x2b4db0[_0xeada('0x49')]['length'];_0x4441ec+=0x1){_0x2b4db0[_0xeada('0x4a')]=_0x2b4db0[_0xeada('0x49')][_0x4441ec][_0xeada('0x4b')];_0x2b4db0[_0xeada('0x4c')]=_0x2b4db0[_0xeada('0x49')][_0x4441ec][_0xeada('0x4c')];if(_0x2b4db0[_0xeada('0x32')]==_0xeada('0x3b')){_0x2b4db0[_0xeada('0x3d')]=_0x2b4db0['connectedlinenum'];_0x2b4db0['calleridname']=_0x2b4db0[_0xeada('0x4d')];_0x2b4db0[_0xeada('0x26')]=_0x2b4db0['accountcode'];_0x2b4db0[_0xeada('0x4d')]=_0x2b4db0[_0xeada('0x4e')];_0x2b4db0['exten']=_0x2b4db0[_0xeada('0x3e')];}else if(_0x2b4db0[_0xeada('0x32')]=='xcally-motion-dialer'){_0x2b4db0[_0xeada('0x3d')]=_0x2b4db0[_0xeada('0x31')];_0x2b4db0['exten']=_0x2b4db0[_0xeada('0x3e')];}RpcVoiceRecording[_0xeada('0x2e')](_0x2b4db0);}}};Report[_0xeada('0xf')][_0xeada('0x18')]=function(_0xbb417d){if(_[_0xeada('0x4f')](_0xbb417d)){_0xbb417d[_0xeada('0x50')](function(_0x57aa6f){RpcVoiceAgentReport['create'](_0x57aa6f);});}else{RpcVoiceAgentReport[_0xeada('0x2e')](_0xbb417d);}};Report['prototype'][_0xeada('0x19')]=function(_0x31302d){RpcVoiceDialReport['create'](_0x31302d);var _0x1ec648;var _0x50c2aa;var _0x5290ab=_0x31302d[_0xeada('0x3f')];if(_['startsWith'](_0x5290ab,'Local')){_0x50c2aa=_0x5290ab['substring'](_0x5290ab[_0xeada('0x51')]('/')+0x1,_0x5290ab[_0xeada('0x51')]('@'));_0x1ec648=_[_0xeada('0x22')](this['agents'],function(_0x186a26){return _0x186a26[_0xeada('0x52')]==_0x50c2aa||_0x186a26[_0xeada('0x53')]==_0x50c2aa||_0x186a26[_0xeada('0x1f')]==_0x50c2aa;});}else{_0x50c2aa=_0x5290ab[_0xeada('0x54')](_0x5290ab['indexOf']('/')+0x1,_0x5290ab[_0xeada('0x55')]('-'));_0x1ec648=this[_0xeada('0x1e')](_0x50c2aa);}if(_0x1ec648){_0x31302d[_0xeada('0x23')]=_[_0xeada('0x21')](_0x1ec648[_0xeada('0x23')])?util[_0xeada('0x24')](_0xeada('0x29'),_0x1ec648[_0xeada('0x20')]):_0x1ec648[_0xeada('0x23')];_0x31302d['membername']=_0x1ec648[_0xeada('0x20')];_0x31302d[_0xeada('0x1f')]=_0x1ec648[_0xeada('0x1f')];RpcMemberReport[_0xeada('0x19')](_0x31302d);}};Report['prototype'][_0xeada('0x1b')]=function(_0x4f3646){RpcVoiceTransferReport['transfers'][_0x4f3646[_0xeada('0x56')]]=_0x4f3646;};Report[_0xeada('0xf')][_0xeada('0x1d')]=function(_0xd96c25){RpcVoiceTransferReport[_0xeada('0x1d')](_0xd96c25);};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 c2fd0b1..c8797de 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 _0x222a=['format','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','name','trunk:%s','trunk:save','Local','substring','indexOf','mobile','phone','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','telephone:save','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','catch','[userReport][sippeerstatus]','prototype','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','actionid','username','[userReport][registry]\x20sending\x20trunk:save\x20event:','[userReport][devicestatechange]','device','local','inuse','toLowerCase','stateTime','toNumber'];(function(_0x5c59fa,_0x56598b){var _0x3aa507=function(_0x51c46c){while(--_0x51c46c){_0x5c59fa['push'](_0x5c59fa['shift']());}};_0x3aa507(++_0x56598b);}(_0x222a,0xb3));var _0xa222=function(_0x5af1e2,_0x6924a8){_0x5af1e2=_0x5af1e2-0x0;var _0x2fd771=_0x222a[_0x5af1e2];return _0x2fd771;};'use strict';var _=require(_0xa222('0x0'));var moment=require(_0xa222('0x1'));var util=require(_0xa222('0x2'));var Redis=require(_0xa222('0x3'));var BPromise=require(_0xa222('0x4'));var config=require('../../../config/environment');var logger=require(_0xa222('0x5'))(_0xa222('0x6'));var ami=require(_0xa222('0x7'));config['redis']=_[_0xa222('0x8')](config[_0xa222('0x9')],{'host':_0xa222('0xa'),'port':0x18eb});var io=require(_0xa222('0xb'))(new Redis(config['redis']));function UserReport(_0x54319c){this[_0xa222('0xc')]=_0x54319c[_0xa222('0xc')];this[_0xa222('0xd')]=_0x54319c[_0xa222('0xd')];this[_0xa222('0xe')]=_0x54319c['telephones'];ami['on'](_0xa222('0xf'),this['syncRegistry'][_0xa222('0x10')](this));ami['on'](_0xa222('0x11'),this['syncRegistry']['bind'](this));ami['on'](_0xa222('0x12'),this[_0xa222('0x13')][_0xa222('0x10')](this));ami['on'](_0xa222('0x14'),this['syncPeerStatus']['bind'](this));return this[_0xa222('0x15')]();}function showSipRegistrations(){Promise[_0xa222('0x16')]()[_0xa222('0x17')](ami[_0xa222('0x18')]())['catch'](function(_0x357568){logger[_0xa222('0x19')](_0xa222('0x1a'),util[_0xa222('0x1b')](_0x357568,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xa222('0x16')]()[_0xa222('0x17')](ami[_0xa222('0x1c')]())['catch'](function(_0x14d52c){logger[_0xa222('0x19')](_0xa222('0x1d'),util[_0xa222('0x1b')](_0x14d52c,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0xa222('0x17')](ami['actionSipPeerStatus']())[_0xa222('0x1e')](function(_0x43f94a){logger['error'](_0xa222('0x1f'),util['inspect'](_0x43f94a,{'showHidden':![],'depth':null}));});}UserReport[_0xa222('0x20')][_0xa222('0x15')]=function(){setInterval(function(){BPromise['resolve']()['then'](showSipRegistrations())[_0xa222('0x17')](listDeviceStates())[_0xa222('0x17')](showPeersStatus());},0x32c8);};UserReport[_0xa222('0x20')]['isNotNull']=function(_0x291308){return _0x291308!==null&&!_['isUndefined'](_0x291308);};UserReport[_0xa222('0x20')][_0xa222('0x21')]=function(_0x50b6ba,_0x43ec5c,_0x5c40de){io['to'](_0x50b6ba)['emit'](_0x43ec5c,_0x5c40de);};UserReport['prototype']['syncRegistry']=function(_0x18f9f3){try{if(this[_0xa222('0x22')](_0x18f9f3)){logger[_0xa222('0x23')](_0xa222('0x24'),_0x18f9f3['username'],_0x18f9f3[_0xa222('0x25')]);logger[_0xa222('0x26')](_0xa222('0x27'),util['inspect'](_0x18f9f3,{'showHidden':![],'depth':null}));var _0x345317=_[_0xa222('0x28')](this['trunks'],{'registry':_0x18f9f3['username']});if(_0x345317){_0x18f9f3[_0xa222('0x29')]=_0x18f9f3[_0xa222('0x25')];_[_0xa222('0x2a')](_0x345317,_[_0xa222('0x2b')](_0x18f9f3,[_0xa222('0x2c'),_0xa222('0x2d'),_0xa222('0x2e'),_0xa222('0x25')]));logger[_0xa222('0x26')](_0xa222('0x2f'),util[_0xa222('0x1b')](_0x345317,{'showHidden':![],'depth':null}));this[_0xa222('0x21')](util['format']('trunk:%s',_0x345317['name']),'trunk:save',_0x345317);}}}catch(_0x441a27){logger[_0xa222('0x19')](_0xa222('0x27'),util[_0xa222('0x1b')](_0x441a27,{'showHidden':![],'depth':null}));}};UserReport[_0xa222('0x20')]['syncDeviceState']=function(_0x4a2cf7){try{if(this[_0xa222('0x22')](_0x4a2cf7)){logger[_0xa222('0x23')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x4a2cf7['device'],_0x4a2cf7['state']);logger['debug'](_0xa222('0x30'),util[_0xa222('0x1b')](_0x4a2cf7,{'showHidden':![],'depth':null}));if(this[_0xa222('0xd')][_0x4a2cf7[_0xa222('0x31')]]){if(!this[_0xa222('0xd')][_0x4a2cf7[_0xa222('0x31')]][_0xa222('0x32')]||_0x4a2cf7['state']['toLowerCase']()==_0xa222('0x33')){this['agents'][_0x4a2cf7[_0xa222('0x31')]][_0xa222('0x32')]=![];if(this['agents'][_0x4a2cf7[_0xa222('0x31')]][_0xa222('0x25')]!==_0x4a2cf7[_0xa222('0x25')][_0xa222('0x34')]()){this[_0xa222('0xd')][_0x4a2cf7['device']][_0xa222('0x35')]=_[_0xa222('0x36')](moment()[_0xa222('0x37')]('x'));}this[_0xa222('0xd')][_0x4a2cf7[_0xa222('0x31')]][_0xa222('0x25')]=_0x4a2cf7[_0xa222('0x25')]['toLowerCase']();this[_0xa222('0xd')][_0x4a2cf7['device']][_0xa222('0x38')](_0x4a2cf7);}}else if(this[_0xa222('0xe')][_0x4a2cf7['device']]){if(this['telephones'][_0x4a2cf7['device']][_0xa222('0x25')]!==_0x4a2cf7[_0xa222('0x25')][_0xa222('0x34')]()){this['telephones'][_0x4a2cf7[_0xa222('0x31')]][_0xa222('0x35')]=_[_0xa222('0x36')](moment()[_0xa222('0x37')]('x'));}this['telephones'][_0x4a2cf7[_0xa222('0x31')]]['state']=_0x4a2cf7[_0xa222('0x25')][_0xa222('0x34')]();logger[_0xa222('0x26')](_0xa222('0x39'),util['inspect'](this[_0xa222('0xe')][_0x4a2cf7['device']],{'showHidden':![],'depth':null}));this[_0xa222('0x21')](util[_0xa222('0x37')](_0xa222('0x3a'),this[_0xa222('0xe')][_0x4a2cf7[_0xa222('0x31')]][_0xa222('0x3b')]),'telephone:save',this['telephones'][_0x4a2cf7[_0xa222('0x31')]]);}else if(this['trunks'][_0x4a2cf7[_0xa222('0x31')]]){if(this[_0xa222('0xc')][_0x4a2cf7[_0xa222('0x31')]][_0xa222('0x25')]!==_0x4a2cf7[_0xa222('0x25')][_0xa222('0x34')]()){this[_0xa222('0xc')][_0x4a2cf7[_0xa222('0x31')]]['stateTime']=_[_0xa222('0x36')](moment()['format']('x'));}this[_0xa222('0xc')][_0x4a2cf7[_0xa222('0x31')]][_0xa222('0x25')]=_0x4a2cf7[_0xa222('0x25')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0xa222('0x1b')](this[_0xa222('0xc')][_0x4a2cf7[_0xa222('0x31')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xa222('0x3c'),this['trunks'][_0x4a2cf7[_0xa222('0x31')]][_0xa222('0x3b')]),_0xa222('0x3d'),this[_0xa222('0xc')][_0x4a2cf7[_0xa222('0x31')]]);}else if(_['startsWith'](_0x4a2cf7[_0xa222('0x31')],_0xa222('0x3e'))){var _0x45942f=_0x4a2cf7[_0xa222('0x31')];var _0x8af2a0=_0x45942f[_0xa222('0x3f')](_0x45942f['indexOf']('/')+0x1,_0x45942f[_0xa222('0x40')]('@'));var _0x31168a=_[_0xa222('0x28')](this[_0xa222('0xd')],function(_0x3f5b96){return _0x3f5b96[_0xa222('0x41')]==_0x8af2a0||_0x3f5b96[_0xa222('0x42')]==_0x8af2a0||_0x3f5b96[_0xa222('0x43')]==_0x8af2a0;});if(_0x31168a){if(_0x31168a[_0xa222('0x25')]!==_0x4a2cf7[_0xa222('0x25')][_0xa222('0x34')]()){_0x31168a['stateTime']=_[_0xa222('0x36')](moment()[_0xa222('0x37')]('x'));}_0x31168a[_0xa222('0x25')]=_0x4a2cf7[_0xa222('0x25')][_0xa222('0x34')]();_0x31168a['local']=!![];_0x31168a['updateStatusRealtime'](_0x4a2cf7);}}}}catch(_0x2e6f6a){logger[_0xa222('0x19')]('[userReport][devicestatechange]',util[_0xa222('0x1b')](_0x2e6f6a,{'showHidden':![],'depth':null}));}};UserReport[_0xa222('0x20')][_0xa222('0x44')]=function(_0x523601){try{if(this[_0xa222('0x22')](_0x523601)&&this[_0xa222('0x22')](_0x523601[_0xa222('0x14')])){logger['info'](_0xa222('0x45'),_0x523601[_0xa222('0x46')],_0x523601['address'],_0x523601[_0xa222('0x14')]);logger['debug'](_0xa222('0x47'),util[_0xa222('0x1b')](_0x523601,{'showHidden':![],'depth':null}));if(this[_0xa222('0xd')][_0x523601['peer']]){if(!this[_0xa222('0xd')][_0x523601['peer']]['local']||_0x523601[_0xa222('0x14')]['toLowerCase']()==_0xa222('0x48')){this['agents'][_0x523601[_0xa222('0x46')]][_0xa222('0x32')]=![];this[_0xa222('0xd')][_0x523601[_0xa222('0x46')]][_0xa222('0x49')]=_0x523601['peerstatus'][_0xa222('0x34')]();this['agents'][_0x523601['peer']][_0xa222('0x4a')]=_0x523601['address'];this['agents'][_0x523601[_0xa222('0x46')]][_0xa222('0x38')](_0x523601);}}else if(this['telephones'][_0x523601['peer']]){this['telephones'][_0x523601['peer']][_0xa222('0x49')]=_0x523601[_0xa222('0x14')]['toLowerCase']();this[_0xa222('0xe')][_0x523601[_0xa222('0x46')]]['address']=_0x523601[_0xa222('0x4a')];logger[_0xa222('0x26')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x523601[_0xa222('0x46')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xa222('0x3a'),this[_0xa222('0xe')][_0x523601[_0xa222('0x46')]][_0xa222('0x3b')]),_0xa222('0x4b'),this[_0xa222('0xe')][_0x523601[_0xa222('0x46')]]);}else if(this[_0xa222('0xc')][_0x523601[_0xa222('0x46')]]){this[_0xa222('0xc')][_0x523601['peer']][_0xa222('0x49')]=_0x523601[_0xa222('0x14')][_0xa222('0x34')]();this[_0xa222('0xc')][_0x523601['peer']]['address']=_0x523601[_0xa222('0x4a')];logger['debug'](_0xa222('0x4c'),util[_0xa222('0x1b')](this[_0xa222('0xc')][_0x523601['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0xa222('0x37')](_0xa222('0x3c'),this['trunks'][_0x523601[_0xa222('0x46')]][_0xa222('0x3b')]),_0xa222('0x3d'),this[_0xa222('0xc')][_0x523601[_0xa222('0x46')]]);}}}catch(_0x1d7810){logger[_0xa222('0x19')](_0xa222('0x47'),util[_0xa222('0x1b')](_0x1d7810,{'showHidden':![],'depth':null}));}};module[_0xa222('0x4d')]=UserReport; \ No newline at end of file +var _0x8acc=['[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','peerstatus','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','format','trunk:%s','name','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','inuse','toLowerCase','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','substring','indexOf','phone','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address'];(function(_0x514277,_0x507443){var _0x6e681c=function(_0x53dbfc){while(--_0x53dbfc){_0x514277['push'](_0x514277['shift']());}};_0x6e681c(++_0x507443);}(_0x8acc,0xdb));var _0xc8ac=function(_0x477f82,_0x57e90a){_0x477f82=_0x477f82-0x0;var _0x429f00=_0x8acc[_0x477f82];return _0x429f00;};'use strict';var _=require('lodash');var moment=require(_0xc8ac('0x0'));var util=require(_0xc8ac('0x1'));var Redis=require(_0xc8ac('0x2'));var BPromise=require('bluebird');var config=require(_0xc8ac('0x3'));var logger=require(_0xc8ac('0x4'))('ami');var ami=require(_0xc8ac('0x5'));config[_0xc8ac('0x6')]=_['defaults'](config[_0xc8ac('0x6')],{'host':_0xc8ac('0x7'),'port':0x18eb});var io=require(_0xc8ac('0x8'))(new Redis(config[_0xc8ac('0x6')]));function UserReport(_0x201f12){this[_0xc8ac('0x9')]=_0x201f12['trunks'];this[_0xc8ac('0xa')]=_0x201f12[_0xc8ac('0xa')];this[_0xc8ac('0xb')]=_0x201f12['telephones'];ami['on']('registryentry',this[_0xc8ac('0xc')][_0xc8ac('0xd')](this));ami['on']('registry',this['syncRegistry']['bind'](this));ami['on'](_0xc8ac('0xe'),this['syncDeviceState']['bind'](this));ami['on'](_0xc8ac('0xf'),this['syncPeerStatus'][_0xc8ac('0xd')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xc8ac('0x10')]()[_0xc8ac('0x11')](ami[_0xc8ac('0x12')]())[_0xc8ac('0x13')](function(_0x2a9ddf){logger[_0xc8ac('0x14')](_0xc8ac('0x15'),util[_0xc8ac('0x16')](_0x2a9ddf,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xc8ac('0x10')]()[_0xc8ac('0x11')](ami[_0xc8ac('0x17')]())[_0xc8ac('0x13')](function(_0x22db0a){logger[_0xc8ac('0x14')](_0xc8ac('0x18'),util[_0xc8ac('0x16')](_0x22db0a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc8ac('0x10')]()[_0xc8ac('0x11')](ami[_0xc8ac('0x19')]())[_0xc8ac('0x13')](function(_0xae037){logger[_0xc8ac('0x14')](_0xc8ac('0x1a'),util[_0xc8ac('0x16')](_0xae037,{'showHidden':![],'depth':null}));});}UserReport[_0xc8ac('0x1b')][_0xc8ac('0x1c')]=function(){setInterval(function(){BPromise['resolve']()[_0xc8ac('0x11')](showSipRegistrations())[_0xc8ac('0x11')](listDeviceStates())[_0xc8ac('0x11')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0xc8ac('0x1d')]=function(_0x488da2){return _0x488da2!==null&&!_['isUndefined'](_0x488da2);};UserReport[_0xc8ac('0x1b')][_0xc8ac('0x1e')]=function(_0x276047,_0xbd7ae3,_0x3d19e4){io['to'](_0x276047)[_0xc8ac('0x1e')](_0xbd7ae3,_0x3d19e4);};UserReport['prototype'][_0xc8ac('0xc')]=function(_0x2032e9){try{if(this[_0xc8ac('0x1d')](_0x2032e9)){logger['info'](_0xc8ac('0x1f'),_0x2032e9[_0xc8ac('0x20')],_0x2032e9[_0xc8ac('0x21')]);logger[_0xc8ac('0x22')](_0xc8ac('0x23'),util[_0xc8ac('0x16')](_0x2032e9,{'showHidden':![],'depth':null}));var _0x469221=_[_0xc8ac('0x24')](this['trunks'],{'registry':_0x2032e9['username']});if(_0x469221){_0x2032e9[_0xc8ac('0x25')]=_0x2032e9[_0xc8ac('0x21')];_[_0xc8ac('0x26')](_0x469221,_[_0xc8ac('0x27')](_0x2032e9,[_0xc8ac('0x28'),'actionid',_0xc8ac('0x20'),_0xc8ac('0x21')]));logger[_0xc8ac('0x22')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x469221,{'showHidden':![],'depth':null}));this[_0xc8ac('0x1e')](util[_0xc8ac('0x29')](_0xc8ac('0x2a'),_0x469221[_0xc8ac('0x2b')]),'trunk:save',_0x469221);}}}catch(_0x33b53a){logger[_0xc8ac('0x14')](_0xc8ac('0x23'),util[_0xc8ac('0x16')](_0x33b53a,{'showHidden':![],'depth':null}));}};UserReport[_0xc8ac('0x1b')]['syncDeviceState']=function(_0x3d6405){try{if(this[_0xc8ac('0x1d')](_0x3d6405)){logger[_0xc8ac('0x2c')](_0xc8ac('0x2d'),_0x3d6405['device'],_0x3d6405['state']);logger[_0xc8ac('0x22')](_0xc8ac('0x2e'),util[_0xc8ac('0x16')](_0x3d6405,{'showHidden':![],'depth':null}));if(this[_0xc8ac('0xa')][_0x3d6405[_0xc8ac('0x2f')]]){if(!this[_0xc8ac('0xa')][_0x3d6405[_0xc8ac('0x2f')]][_0xc8ac('0x30')]||_0x3d6405[_0xc8ac('0x21')]['toLowerCase']()==_0xc8ac('0x31')){this[_0xc8ac('0xa')][_0x3d6405[_0xc8ac('0x2f')]][_0xc8ac('0x30')]=![];if(this[_0xc8ac('0xa')][_0x3d6405[_0xc8ac('0x2f')]]['state']!==_0x3d6405[_0xc8ac('0x21')][_0xc8ac('0x32')]()){this[_0xc8ac('0xa')][_0x3d6405[_0xc8ac('0x2f')]][_0xc8ac('0x33')]=_[_0xc8ac('0x34')](moment()[_0xc8ac('0x29')]('x'));}this[_0xc8ac('0xa')][_0x3d6405[_0xc8ac('0x2f')]]['state']=_0x3d6405[_0xc8ac('0x21')][_0xc8ac('0x32')]();this['agents'][_0x3d6405[_0xc8ac('0x2f')]]['updateStatusRealtime'](_0x3d6405);}}else if(this[_0xc8ac('0xb')][_0x3d6405[_0xc8ac('0x2f')]]){if(this['telephones'][_0x3d6405[_0xc8ac('0x2f')]]['state']!==_0x3d6405[_0xc8ac('0x21')][_0xc8ac('0x32')]()){this['telephones'][_0x3d6405[_0xc8ac('0x2f')]][_0xc8ac('0x33')]=_['toNumber'](moment()[_0xc8ac('0x29')]('x'));}this[_0xc8ac('0xb')][_0x3d6405[_0xc8ac('0x2f')]]['state']=_0x3d6405['state'][_0xc8ac('0x32')]();logger[_0xc8ac('0x22')](_0xc8ac('0x35'),util[_0xc8ac('0x16')](this[_0xc8ac('0xb')][_0x3d6405[_0xc8ac('0x2f')]],{'showHidden':![],'depth':null}));this[_0xc8ac('0x1e')](util['format']('telephone:%s',this[_0xc8ac('0xb')][_0x3d6405[_0xc8ac('0x2f')]][_0xc8ac('0x2b')]),_0xc8ac('0x36'),this[_0xc8ac('0xb')][_0x3d6405['device']]);}else if(this[_0xc8ac('0x9')][_0x3d6405['device']]){if(this[_0xc8ac('0x9')][_0x3d6405[_0xc8ac('0x2f')]][_0xc8ac('0x21')]!==_0x3d6405[_0xc8ac('0x21')][_0xc8ac('0x32')]()){this['trunks'][_0x3d6405[_0xc8ac('0x2f')]]['stateTime']=_[_0xc8ac('0x34')](moment()[_0xc8ac('0x29')]('x'));}this[_0xc8ac('0x9')][_0x3d6405[_0xc8ac('0x2f')]][_0xc8ac('0x21')]=_0x3d6405[_0xc8ac('0x21')][_0xc8ac('0x32')]();logger[_0xc8ac('0x22')](_0xc8ac('0x37'),util['inspect'](this[_0xc8ac('0x9')][_0x3d6405[_0xc8ac('0x2f')]],{'showHidden':![],'depth':null}));this[_0xc8ac('0x1e')](util[_0xc8ac('0x29')](_0xc8ac('0x2a'),this[_0xc8ac('0x9')][_0x3d6405[_0xc8ac('0x2f')]][_0xc8ac('0x2b')]),_0xc8ac('0x38'),this[_0xc8ac('0x9')][_0x3d6405['device']]);}else if(_[_0xc8ac('0x39')](_0x3d6405[_0xc8ac('0x2f')],'Local')){var _0x11c226=_0x3d6405[_0xc8ac('0x2f')];var _0x3567f2=_0x11c226[_0xc8ac('0x3a')](_0x11c226[_0xc8ac('0x3b')]('/')+0x1,_0x11c226[_0xc8ac('0x3b')]('@'));var _0x32d839=_[_0xc8ac('0x24')](this[_0xc8ac('0xa')],function(_0x523862){return _0x523862['mobile']==_0x3567f2||_0x523862[_0xc8ac('0x3c')]==_0x3567f2||_0x523862['accountcode']==_0x3567f2;});if(_0x32d839){if(_0x32d839[_0xc8ac('0x21')]!==_0x3d6405[_0xc8ac('0x21')][_0xc8ac('0x32')]()){_0x32d839[_0xc8ac('0x33')]=_[_0xc8ac('0x34')](moment()[_0xc8ac('0x29')]('x'));}_0x32d839[_0xc8ac('0x21')]=_0x3d6405[_0xc8ac('0x21')][_0xc8ac('0x32')]();_0x32d839[_0xc8ac('0x30')]=!![];_0x32d839['updateStatusRealtime'](_0x3d6405);}}}}catch(_0x150c98){logger['error'](_0xc8ac('0x2e'),util[_0xc8ac('0x16')](_0x150c98,{'showHidden':![],'depth':null}));}};UserReport[_0xc8ac('0x1b')][_0xc8ac('0x3d')]=function(_0xc5b268){try{if(this[_0xc8ac('0x1d')](_0xc5b268)&&this[_0xc8ac('0x1d')](_0xc5b268[_0xc8ac('0xf')])){logger['info'](_0xc8ac('0x3e'),_0xc5b268[_0xc8ac('0x3f')],_0xc5b268[_0xc8ac('0x40')],_0xc5b268['peerstatus']);logger[_0xc8ac('0x22')](_0xc8ac('0x41'),util[_0xc8ac('0x16')](_0xc5b268,{'showHidden':![],'depth':null}));if(this['agents'][_0xc5b268[_0xc8ac('0x3f')]]){if(!this['agents'][_0xc5b268[_0xc8ac('0x3f')]][_0xc8ac('0x30')]||_0xc5b268[_0xc8ac('0xf')]['toLowerCase']()=='registered'){this['agents'][_0xc5b268[_0xc8ac('0x3f')]][_0xc8ac('0x30')]=![];this[_0xc8ac('0xa')][_0xc5b268['peer']][_0xc8ac('0x42')]=_0xc5b268['peerstatus']['toLowerCase']();this[_0xc8ac('0xa')][_0xc5b268['peer']][_0xc8ac('0x40')]=_0xc5b268[_0xc8ac('0x40')];this[_0xc8ac('0xa')][_0xc5b268[_0xc8ac('0x3f')]]['updateStatusRealtime'](_0xc5b268);}}else if(this['telephones'][_0xc5b268[_0xc8ac('0x3f')]]){this['telephones'][_0xc5b268['peer']][_0xc8ac('0x42')]=_0xc5b268[_0xc8ac('0xf')]['toLowerCase']();this['telephones'][_0xc5b268['peer']]['address']=_0xc5b268[_0xc8ac('0x40')];logger[_0xc8ac('0x22')](_0xc8ac('0x43'),util[_0xc8ac('0x16')](this[_0xc8ac('0xb')][_0xc5b268[_0xc8ac('0x3f')]],{'showHidden':![],'depth':null}));this[_0xc8ac('0x1e')](util[_0xc8ac('0x29')](_0xc8ac('0x44'),this['telephones'][_0xc5b268['peer']]['name']),_0xc8ac('0x36'),this[_0xc8ac('0xb')][_0xc5b268[_0xc8ac('0x3f')]]);}else if(this[_0xc8ac('0x9')][_0xc5b268[_0xc8ac('0x3f')]]){this['trunks'][_0xc5b268[_0xc8ac('0x3f')]][_0xc8ac('0x42')]=_0xc5b268[_0xc8ac('0xf')]['toLowerCase']();this['trunks'][_0xc5b268['peer']][_0xc8ac('0x40')]=_0xc5b268[_0xc8ac('0x40')];logger[_0xc8ac('0x22')](_0xc8ac('0x45'),util[_0xc8ac('0x16')](this[_0xc8ac('0x9')][_0xc5b268[_0xc8ac('0x3f')]],{'showHidden':![],'depth':null}));this[_0xc8ac('0x1e')](util[_0xc8ac('0x29')]('trunk:%s',this[_0xc8ac('0x9')][_0xc5b268[_0xc8ac('0x3f')]][_0xc8ac('0x2b')]),_0xc8ac('0x38'),this[_0xc8ac('0x9')][_0xc5b268[_0xc8ac('0x3f')]]);}}}catch(_0x3cf100){logger[_0xc8ac('0x14')](_0xc8ac('0x41'),util['inspect'](_0x3cf100,{'showHidden':![],'depth':null}));}};module[_0xc8ac('0x46')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 3672204..c3487e3 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 _0xbd49=['[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','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:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','isUndefined','called','queue','mandatoryDisposition','type','inbound','merge','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','custom:agentqueuecallerabandon'];(function(_0x28baa3,_0x4f7c5a){var _0x1db879=function(_0x1eca44){while(--_0x1eca44){_0x28baa3['push'](_0x28baa3['shift']());}};_0x1db879(++_0x4f7c5a);}(_0xbd49,0xe1));var _0x9bd4=function(_0x14b926,_0x2eefcd){_0x14b926=_0x14b926-0x0;var _0xf2b3bf=_0xbd49[_0x14b926];return _0xf2b3bf;};'use strict';var _=require(_0x9bd4('0x0'));var moment=require('moment');var util=require(_0x9bd4('0x1'));var Redis=require('ioredis');var config=require(_0x9bd4('0x2'));var logger=require(_0x9bd4('0x3'))(_0x9bd4('0x4'));var ami=require(_0x9bd4('0x5'));config[_0x9bd4('0x6')]=_['defaults'](config[_0x9bd4('0x6')],{'host':_0x9bd4('0x7'),'port':0x18eb});var io=require(_0x9bd4('0x8'))(new Redis(config[_0x9bd4('0x6')]));function VoiceAgentReport(_0x952a38){this[_0x9bd4('0x9')]={};this[_0x9bd4('0xa')]=_0x952a38['voiceQueues'];this[_0x9bd4('0xb')]=_0x952a38['agents'];this[_0x9bd4('0xc')]={};ami['on'](_0x9bd4('0xd'),this[_0x9bd4('0xe')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x10'),this[_0x9bd4('0x11')]['bind'](this));ami['on'](_0x9bd4('0x12'),this[_0x9bd4('0x13')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x14'),this[_0x9bd4('0x15')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x16'),this[_0x9bd4('0x17')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x18'),this[_0x9bd4('0x19')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x1a'),this[_0x9bd4('0x1b')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x1c'),this['syncMusicOnHoldStart'][_0x9bd4('0xf')](this));ami['on']('musiconholdstop',this[_0x9bd4('0x1d')][_0x9bd4('0xf')](this));ami['on'](_0x9bd4('0x1e'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x9bd4('0x1f'),this[_0x9bd4('0x20')]['bind'](this));}VoiceAgentReport['prototype']['emit']=function(_0x211f02,_0x44195f,_0x4c4886){io['to'](_0x211f02)[_0x9bd4('0x21')](_0x44195f,_0x4c4886);};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x23')]=function(_0x2e740f){return _0x2e740f!==null&&!_['isUndefined'](_0x2e740f);};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0xe')]=function(_0x314245){try{if(this[_0x9bd4('0x23')](_0x314245)){logger[_0x9bd4('0x24')](_0x9bd4('0x25'),_0x314245[_0x9bd4('0x26')],_0x314245[_0x9bd4('0x27')],_0x314245[_0x9bd4('0x28')]);logger[_0x9bd4('0x29')](_0x9bd4('0x2a'),_0x314245[_0x9bd4('0x26')],util['inspect'](_0x314245,{'showHidden':![],'depth':null}));if(_[_0x9bd4('0x2b')](this[_0x9bd4('0x9')][_0x314245[_0x9bd4('0x26')]])){this[_0x9bd4('0x9')][_0x314245[_0x9bd4('0x26')]]={};}if(_[_0x9bd4('0x2b')](this[_0x9bd4('0x9')][_0x314245['uniqueid']][_0x314245[_0x9bd4('0x28')]])){this['channels'][_0x314245['uniqueid']][_0x314245['destuniqueid']]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x9bd4('0x2c'),'mandatoryDisposition':this[_0x9bd4('0xa')][_0x314245[_0x9bd4('0x2d')]]?this['voiceQueues'][_0x314245[_0x9bd4('0x2d')]][_0x9bd4('0x2e')]||![]:![],'type':this['voiceQueues'][_0x314245[_0x9bd4('0x2d')]]?this[_0x9bd4('0xa')][_0x314245[_0x9bd4('0x2d')]][_0x9bd4('0x2f')]||_0x9bd4('0x30'):_0x9bd4('0x30'),'variables':this[_0x9bd4('0xc')][_0x314245[_0x9bd4('0x26')]]};}_[_0x9bd4('0x31')](this[_0x9bd4('0x9')][_0x314245['uniqueid']][_0x314245[_0x9bd4('0x28')]],_[_0x9bd4('0x32')](_0x314245,['event',_0x9bd4('0x33')]));logger[_0x9bd4('0x29')](_0x9bd4('0x34'),_0x314245[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this['channels'][_0x314245[_0x9bd4('0x26')]][_0x314245['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x9bd4('0x36'),this[_0x9bd4('0x9')][_0x314245['uniqueid']][_0x314245['destuniqueid']]);logger[_0x9bd4('0x29')](_0x9bd4('0x37'),_0x314245[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0x314245[_0x9bd4('0x26')]][_0x314245['destuniqueid']],{'showHidden':![],'depth':null}));this['emit'](util[_0x9bd4('0x38')](_0x9bd4('0x39'),_0x314245[_0x9bd4('0x27')]),_0x9bd4('0x3a'),this['channels'][_0x314245[_0x9bd4('0x26')]][_0x314245[_0x9bd4('0x28')]]);}}catch(_0x4647f2){logger[_0x9bd4('0x3b')](_0x9bd4('0x3c'),_0x314245[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x4647f2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x11')]=function(_0x2ee336){try{if(this[_0x9bd4('0x23')](_0x2ee336)){if(this[_0x9bd4('0x9')][_0x2ee336['uniqueid']]){logger[_0x9bd4('0x29')](_0x9bd4('0x3d'),_0x2ee336[_0x9bd4('0x26')],util['inspect'](_0x2ee336,{'showHidden':![],'depth':null}));for(var _0xa684bf in this[_0x9bd4('0x9')][_0x2ee336['uniqueid']]){if(this[_0x9bd4('0x9')][_0x2ee336['uniqueid']][_0x9bd4('0x3e')](_0xa684bf)){if(_0x2ee336[_0x9bd4('0x28')]===_0xa684bf){logger[_0x9bd4('0x24')](_0x9bd4('0x3f'),_0x2ee336['uniqueid'],_0x2ee336['membername'],_0x2ee336['destuniqueid']);this[_0x9bd4('0x9')][_0x2ee336['uniqueid']][_0xa684bf]['agentconnectAt']=moment()['format'](_0x9bd4('0x40'));this[_0x9bd4('0x9')][_0x2ee336['uniqueid']][_0xa684bf][_0x9bd4('0x41')]=_0x2ee336[_0x9bd4('0x41')];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x42')]=_0x2ee336[_0x9bd4('0x42')];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x43')]=_0x2ee336[_0x9bd4('0x43')];this['channels'][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x44')]=_0x2ee336['destchannelstatedesc'];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x45')]=_0x2ee336[_0x9bd4('0x45')];this['channels'][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x46')]=_0x9bd4('0x47');_[_0x9bd4('0x31')](this[_0x9bd4('0xb')][_0x2ee336[_0x9bd4('0x48')]],_[_0x9bd4('0x49')](_0x2ee336,[_0x9bd4('0x2d'),_0x9bd4('0x4a')]));logger[_0x9bd4('0x29')](_0x9bd4('0x4b'),_0x2ee336[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0x2ee336['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x4c'),this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0x2ee336[_0x9bd4('0x28')]]);logger[_0x9bd4('0x29')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x2ee336[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this['channels'][_0x2ee336[_0x9bd4('0x26')]][_0x2ee336[_0x9bd4('0x28')]],{'showHidden':![],'depth':null}));this[_0x9bd4('0x21')](util['format'](_0x9bd4('0x39'),_0x2ee336[_0x9bd4('0x27')]),_0x9bd4('0x4d'),this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0x2ee336['destuniqueid']]);}else if(!this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x12')]&&!this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x16')]){logger[_0x9bd4('0x24')](_0x9bd4('0x4e'),_0x2ee336[_0x9bd4('0x26')],this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x27')],_0xa684bf);this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf]['agentringnoanswer']=!![];this['channels'][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x4f')]=moment()['format'](_0x9bd4('0x40'));this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf]['answeredelsewheredestinationuniqueid']=_0x2ee336[_0x9bd4('0x28')];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf]['answeredelsewheremembername']=_0x2ee336[_0x9bd4('0x27')];this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x46')]=_0x9bd4('0x50');this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf][_0x9bd4('0x51')]=_0x9bd4('0x50');logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x2ee336['uniqueid'],util['inspect'](this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf],{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x52'),this[_0x9bd4('0x9')][_0x2ee336[_0x9bd4('0x26')]][_0xa684bf]);}}}}}}catch(_0x1adec8){logger['error'](_0x9bd4('0x53'),_0x2ee336[_0x9bd4('0x26')],util['inspect'](_0x1adec8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')]['syncAgentRingNoAnswer']=function(_0xcf9977){try{if(this[_0x9bd4('0x23')](_0xcf9977)){logger[_0x9bd4('0x29')](_0x9bd4('0x54'),_0xcf9977[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0xcf9977,{'showHidden':![],'depth':null}));if(this[_0x9bd4('0x9')][_0xcf9977['uniqueid']]&&this[_0x9bd4('0x9')][_0xcf9977['uniqueid']][_0xcf9977[_0x9bd4('0x28')]]){logger[_0x9bd4('0x24')](_0x9bd4('0x55'),_0xcf9977[_0x9bd4('0x26')],_0xcf9977[_0x9bd4('0x27')],_0xcf9977[_0x9bd4('0x28')]);this[_0x9bd4('0x9')][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]]['agentringnoanswer']=!![];this['channels'][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977['destuniqueid']][_0x9bd4('0x4f')]=moment()[_0x9bd4('0x38')](_0x9bd4('0x40'));this['channels'][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]][_0x9bd4('0x46')]='rejected';this[_0x9bd4('0x9')][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]][_0x9bd4('0x51')]=_0x9bd4('0x56');logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0xcf9977[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]],{'showHidden':![],'depth':null}));ami['emit'](_0x9bd4('0x57'),this[_0x9bd4('0x9')][_0xcf9977[_0x9bd4('0x26')]][_0xcf9977[_0x9bd4('0x28')]]);}}}catch(_0x27ea21){logger[_0x9bd4('0x3b')](_0x9bd4('0x58'),_0xcf9977[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x27ea21,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x15')]=function(_0x16f52c){try{if(this[_0x9bd4('0x23')](_0x16f52c)){logger[_0x9bd4('0x29')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x16f52c[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x16f52c,{'showHidden':![],'depth':null}));if(this['channels'][_0x16f52c[_0x9bd4('0x26')]]){for(var _0x14aa1d in this['channels'][_0x16f52c[_0x9bd4('0x26')]]){if(this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]]['hasOwnProperty'](_0x14aa1d)&&!this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d][_0x9bd4('0x12')]&&!this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d]['agentcomplete']){logger[_0x9bd4('0x24')](_0x9bd4('0x59'),_0x16f52c[_0x9bd4('0x26')],this['channels'][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d][_0x9bd4('0x27')],_0x14aa1d);this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d][_0x9bd4('0x12')]=!![];this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d][_0x9bd4('0x4f')]=moment()[_0x9bd4('0x38')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x16f52c['uniqueid']][_0x14aa1d][_0x9bd4('0x46')]='abandoned';this[_0x9bd4('0x9')][_0x16f52c['uniqueid']][_0x14aa1d]['reason']='abandoned';logger[_0x9bd4('0x29')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x16f52c[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d],{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x5a'),this['channels'][_0x16f52c[_0x9bd4('0x26')]][_0x14aa1d]);}}}}}catch(_0x5aeb94){logger[_0x9bd4('0x3b')](_0x9bd4('0x5b'),_0x16f52c['uniqueid'],util[_0x9bd4('0x35')](_0x5aeb94,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9bd4('0x17')]=function(_0x4f10f0){try{if(this[_0x9bd4('0x23')](_0x4f10f0)){logger['debug'](_0x9bd4('0x5c'),_0x4f10f0[_0x9bd4('0x26')],util['inspect'](_0x4f10f0,{'showHidden':![],'depth':null}));if(this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]]){for(var _0x163b87 in this['channels'][_0x4f10f0[_0x9bd4('0x26')]]){if(this[_0x9bd4('0x9')][_0x4f10f0['uniqueid']][_0x9bd4('0x3e')](_0x163b87)){if(this[_0x9bd4('0x9')][_0x4f10f0['uniqueid']][_0x163b87][_0x9bd4('0x5d')]&&!this['channels'][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x16')]){logger[_0x9bd4('0x24')](_0x9bd4('0x5e'),_0x4f10f0[_0x9bd4('0x26')],this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x27')],_0x163b87);this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87]['agentcomplete']=!![];this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x5f')]=moment()[_0x9bd4('0x38')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x9bd4('0x9')][_0x4f10f0['uniqueid']][_0x163b87][_0x9bd4('0x46')]=_0x9bd4('0x60');this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x51')]=_0x4f10f0[_0x9bd4('0x51')]==_0x9bd4('0x61')?'agent':_0x4f10f0['reason'];this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x62')]=_0x4f10f0['talktime'];if(this[_0x9bd4('0xa')][_0x4f10f0[_0x9bd4('0x2d')]]&&this[_0x9bd4('0xa')][_0x4f10f0[_0x9bd4('0x2d')]][_0x9bd4('0x63')]){this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87][_0x9bd4('0x64')]=this[_0x9bd4('0xa')][_0x4f10f0['queue']][_0x9bd4('0x65')];this[_0x9bd4('0x9')][_0x4f10f0['uniqueid']][_0x163b87][_0x9bd4('0x66')]=!![];}this['agents'][_0x4f10f0[_0x9bd4('0x48')]]=_[_0x9bd4('0x32')](this[_0x9bd4('0xb')][_0x4f10f0['interface']],[_0x9bd4('0x2d'),_0x9bd4('0x4a')]);logger[_0x9bd4('0x29')](_0x9bd4('0x67'),_0x4f10f0[_0x9bd4('0x26')],util[_0x9bd4('0x35')](this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87],{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x68'),this[_0x9bd4('0x9')][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87]);logger[_0x9bd4('0x29')](_0x9bd4('0x69'),_0x4f10f0[_0x9bd4('0x26')],util['inspect'](this['channels'][_0x4f10f0['uniqueid']][_0x163b87],{'showHidden':![],'depth':null}));this[_0x9bd4('0x21')](util['format']('user:%s',_0x4f10f0[_0x9bd4('0x27')]),_0x9bd4('0x6a'),this['channels'][_0x4f10f0[_0x9bd4('0x26')]][_0x163b87]);}}}}}}catch(_0x6fec0b){logger[_0x9bd4('0x3b')](_0x9bd4('0x6b'),_0x4f10f0[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x6fec0b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')]['syncVarSet']=function(_0x5e8280){try{if(this[_0x9bd4('0x23')](_0x5e8280)){logger['debug'](_0x9bd4('0x6c'),_0x5e8280['uniqueid'],util[_0x9bd4('0x35')](_0x5e8280,{'showHidden':![],'depth':null}));this[_0x9bd4('0x6d')](_0x5e8280[_0x9bd4('0x26')],_[_0x9bd4('0x6e')](_0x5e8280['variable'])[0x0],_0x5e8280[_0x9bd4('0x6f')]);if(this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]]){for(var _0x3bd3c7 in this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]]){if(this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]]['hasOwnProperty'](_0x3bd3c7)){logger[_0x9bd4('0x24')](_0x9bd4('0x70'),_0x5e8280['uniqueid'],_0x3bd3c7,_[_0x9bd4('0x6e')](_0x5e8280[_0x9bd4('0x71')])[0x0],_0x5e8280[_0x9bd4('0x6f')]);if(_[_0x9bd4('0x2b')](this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]][_0x3bd3c7]['variables'])){this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]][_0x3bd3c7]['variables']={};}this[_0x9bd4('0x9')][_0x5e8280[_0x9bd4('0x26')]][_0x3bd3c7][_0x9bd4('0xc')]=this['variables'][_0x5e8280[_0x9bd4('0x26')]];}}}}}catch(_0x5b0d25){logger[_0x9bd4('0x3b')](_0x9bd4('0x72'),_0x5e8280[_0x9bd4('0x26')],util['inspect'](_0x5b0d25,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9bd4('0x6d')]=function(_0x413cb0,_0x6e4149,_0x3cbadb){var _0x247c5a=['rtpaudioqos',_0x9bd4('0x73'),_0x9bd4('0x74'),_0x9bd4('0x75'),'rtpaudioqosloss',_0x9bd4('0x76'),_0x9bd4('0x77'),_0x9bd4('0x78'),_0x9bd4('0x79'),_0x9bd4('0x7a'),_0x9bd4('0x7b'),_0x9bd4('0x7c'),_0x9bd4('0x7d'),_0x9bd4('0x7e'),'memberinterface',_0x9bd4('0x7f'),_0x9bd4('0x27'),_0x9bd4('0x80'),_0x9bd4('0x81')];if(!_[_0x9bd4('0x82')](_0x6e4149)&&!_[_0x9bd4('0x83')](_0x247c5a,_0x6e4149)){if(_[_0x9bd4('0x2b')](this[_0x9bd4('0xc')][_0x413cb0])){this[_0x9bd4('0xc')][_0x413cb0]={};}this[_0x9bd4('0xc')][_0x413cb0][_0x6e4149]=_0x3cbadb;}};VoiceAgentReport[_0x9bd4('0x22')]['syncHangup']=function(_0x4e3868){try{if(this[_0x9bd4('0x23')](_0x4e3868)){logger[_0x9bd4('0x29')]('[%s][voiceAgentReport][hangup]\x20event:',_0x4e3868[_0x9bd4('0x26')],util['inspect'](_0x4e3868,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e3868['uniqueid']]){for(var _0x169568 in this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]]){if(this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]][_0x9bd4('0x3e')](_0x169568)){if(this[_0x9bd4('0x9')][_0x4e3868['uniqueid']][_0x169568]['reason']==_0x9bd4('0x61')&&this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]][_0x169568][_0x9bd4('0x16')]){logger[_0x9bd4('0x24')](_0x9bd4('0x84'),_0x4e3868['uniqueid'],_0x169568);this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]][_0x169568][_0x9bd4('0x5f')]=moment()[_0x9bd4('0x38')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x9bd4('0x29')](_0x9bd4('0x85'),_0x4e3868[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_[_0x9bd4('0x86')](this[_0x9bd4('0x9')][_0x4e3868['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x9bd4('0x21')](_0x9bd4('0x87'),_[_0x9bd4('0x86')](this[_0x9bd4('0x9')][_0x4e3868[_0x9bd4('0x26')]]));delete this['channels'][_0x4e3868[_0x9bd4('0x26')]];}if(this[_0x9bd4('0xc')][_0x4e3868[_0x9bd4('0x26')]]){delete this[_0x9bd4('0xc')][_0x4e3868[_0x9bd4('0x26')]];}}}catch(_0x282ec4){logger[_0x9bd4('0x3b')](_0x9bd4('0x88'),_0x4e3868[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x282ec4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x89')]=function(_0xd0cdc3){try{if(this['isNotNull'](_0xd0cdc3)){logger[_0x9bd4('0x29')](_0x9bd4('0x8a'),_0xd0cdc3[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0xd0cdc3,{'showHidden':![],'depth':null}));if(this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]]){for(var _0x2b83e9 in this[_0x9bd4('0x9')][_0xd0cdc3['transfereeuniqueid']]){if(this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]]['hasOwnProperty'](_0x2b83e9)){if(_0xd0cdc3[_0x9bd4('0x8c')]===_0x2b83e9){logger[_0x9bd4('0x24')](_0x9bd4('0x8d'),_0xd0cdc3[_0x9bd4('0x26')],this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9][_0x9bd4('0x27')],_0x2b83e9);var _0x1afd0f=moment();this['channels'][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9][_0x9bd4('0x16')]=!![];this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9]['agentcompleteAt']=moment()['format'](_0x9bd4('0x40'));this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9][_0x9bd4('0x46')]=_0x9bd4('0x60');this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9][_0x9bd4('0x51')]='transfer';this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]][_0x2b83e9]['talktime']=_0x1afd0f[_0x9bd4('0x8e')](this[_0x9bd4('0x9')][_0xd0cdc3['transfereeuniqueid']][_0x2b83e9][_0x9bd4('0x5d')],_0x9bd4('0x8f'));}}}}if(this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x90')]]){var _0x253f33=this[_0x9bd4('0x9')][_0xd0cdc3['secondtransfereruniqueid']];this[_0x9bd4('0x9')][_0xd0cdc3['secondtransfereruniqueid']]=this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]];this[_0x9bd4('0x9')][_0xd0cdc3[_0x9bd4('0x8b')]]=_0x253f33;}}}catch(_0x4abba5){logger['error'](_0x9bd4('0x91'),_0xd0cdc3[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x4abba5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x9bd4('0x22')][_0x9bd4('0x20')]=function(_0x5cac87){try{if(this[_0x9bd4('0x23')](_0x5cac87)){logger[_0x9bd4('0x29')](_0x9bd4('0x92'),_0x5cac87['uniqueid'],util[_0x9bd4('0x35')](_0x5cac87,{'showHidden':![],'depth':null}));if(this[_0x9bd4('0x9')][_0x5cac87['transfereeuniqueid']]){for(var _0x10ed22 in this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]]){if(this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x9bd4('0x3e')](_0x10ed22)){if(_0x5cac87[_0x9bd4('0x93')]===_0x10ed22){logger['info'](_0x9bd4('0x94'),_0x5cac87[_0x9bd4('0x26')],this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22]['membername'],_0x10ed22);var _0x50f20a=moment();this['channels'][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22][_0x9bd4('0x16')]=!![];this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22][_0x9bd4('0x5f')]=_0x50f20a;this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22]['lastevent']=_0x9bd4('0x60');this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22][_0x9bd4('0x51')]=_0x9bd4('0x61');this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22][_0x9bd4('0x62')]=_0x50f20a['diff'](this[_0x9bd4('0x9')][_0x5cac87[_0x9bd4('0x8b')]][_0x10ed22]['agentconnectAt'],_0x9bd4('0x8f'));}}}}}}catch(_0x10d1a3){logger['error']('[%s][voiceAgentReport][blindtransfer]',_0x5cac87[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x10d1a3,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x2ba1de){var _0x4d140d='';try{if(this[_0x9bd4('0x23')](_0x2ba1de)){logger['debug']('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x2ba1de[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0x2ba1de,{'showHidden':![],'depth':null}));if(_0x2ba1de[_0x9bd4('0x95')]){_0x4d140d=_0x2ba1de[_0x9bd4('0x95')]['substring'](0x0,_0x2ba1de['channel']['lastIndexOf']('-'));if(this[_0x9bd4('0xb')][_0x4d140d]){logger['info'](_0x9bd4('0x96'),_0x2ba1de[_0x9bd4('0x26')],_0x4d140d);this['agents'][_0x4d140d][_0x9bd4('0x97')]=!![];}}}}catch(_0xb22ad7){logger[_0x9bd4('0x3b')](_0x9bd4('0x98'),_0x2ba1de[_0x9bd4('0x26')],util[_0x9bd4('0x35')](_0xb22ad7,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x9bd4('0x1d')]=function(_0x122e5a){var _0xee9104='';try{if(this['isNotNull'](_0x122e5a)){logger[_0x9bd4('0x29')](_0x9bd4('0x99'),_0x122e5a['uniqueid'],util[_0x9bd4('0x35')](_0x122e5a,{'showHidden':![],'depth':null}));if(_0x122e5a[_0x9bd4('0x95')]){_0xee9104=_0x122e5a[_0x9bd4('0x95')][_0x9bd4('0x9a')](0x0,_0x122e5a[_0x9bd4('0x95')]['lastIndexOf']('-'));if(this[_0x9bd4('0xb')][_0xee9104]){logger[_0x9bd4('0x24')](_0x9bd4('0x9b'),_0x122e5a[_0x9bd4('0x26')],_0xee9104);this[_0x9bd4('0xb')][_0xee9104][_0x9bd4('0x97')]=![];}}}}catch(_0x2db14c){logger[_0x9bd4('0x3b')](_0x9bd4('0x9c'),_0x122e5a[_0x9bd4('0x26')],util['inspect'](_0x2db14c,{'showHidden':![],'depth':null}));}};module[_0x9bd4('0x9d')]=VoiceAgentReport; \ No newline at end of file +var _0x0d0e=['variables','merge','destuniqueid','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','holdtime','lastevent','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','transfer','acw','acwtime','acwTimeout','agentacw','interface','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','talktime','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','ioredis','../../../config/environment','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound'];(function(_0x38dcf9,_0x236797){var _0x246b3c=function(_0x217e6b){while(--_0x217e6b){_0x38dcf9['push'](_0x38dcf9['shift']());}};_0x246b3c(++_0x236797);}(_0x0d0e,0x6a));var _0xe0d0=function(_0x2fb5e2,_0xc07179){_0x2fb5e2=_0x2fb5e2-0x0;var _0x9608a6=_0x0d0e[_0x2fb5e2];return _0x9608a6;};'use strict';var _=require(_0xe0d0('0x0'));var moment=require(_0xe0d0('0x1'));var util=require('util');var Redis=require(_0xe0d0('0x2'));var config=require(_0xe0d0('0x3'));var logger=require('../../../config/logger')('ami');var ami=require(_0xe0d0('0x4'));config['redis']=_[_0xe0d0('0x5')](config[_0xe0d0('0x6')],{'host':_0xe0d0('0x7'),'port':0x18eb});var io=require(_0xe0d0('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x22efb6){this[_0xe0d0('0x9')]={};this[_0xe0d0('0xa')]=_0x22efb6[_0xe0d0('0xa')];this['agents']=_0x22efb6[_0xe0d0('0xb')];this['variables']={};ami['on'](_0xe0d0('0xc'),this['syncAgentCalled']['bind'](this));ami['on']('agentconnect',this[_0xe0d0('0xd')][_0xe0d0('0xe')](this));ami['on'](_0xe0d0('0xf'),this[_0xe0d0('0x10')][_0xe0d0('0xe')](this));ami['on'](_0xe0d0('0x11'),this[_0xe0d0('0x12')][_0xe0d0('0xe')](this));ami['on']('agentcomplete',this[_0xe0d0('0x13')][_0xe0d0('0xe')](this));ami['on'](_0xe0d0('0x14'),this[_0xe0d0('0x15')][_0xe0d0('0xe')](this));ami['on'](_0xe0d0('0x16'),this['syncHangup'][_0xe0d0('0xe')](this));ami['on'](_0xe0d0('0x17'),this[_0xe0d0('0x18')][_0xe0d0('0xe')](this));ami['on'](_0xe0d0('0x19'),this[_0xe0d0('0x1a')][_0xe0d0('0xe')](this));ami['on'](_0xe0d0('0x1b'),this[_0xe0d0('0x1c')][_0xe0d0('0xe')](this));ami['on'](_0xe0d0('0x1d'),this[_0xe0d0('0x1e')]['bind'](this));}VoiceAgentReport[_0xe0d0('0x1f')][_0xe0d0('0x20')]=function(_0x17ea2c,_0x409751,_0x17fa40){io['to'](_0x17ea2c)['emit'](_0x409751,_0x17fa40);};VoiceAgentReport[_0xe0d0('0x1f')]['isNotNull']=function(_0x30359d){return _0x30359d!==null&&!_[_0xe0d0('0x21')](_0x30359d);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x313a82){try{if(this[_0xe0d0('0x22')](_0x313a82)){logger[_0xe0d0('0x23')](_0xe0d0('0x24'),_0x313a82[_0xe0d0('0x25')],_0x313a82[_0xe0d0('0x26')],_0x313a82['destuniqueid']);logger[_0xe0d0('0x27')](_0xe0d0('0x28'),_0x313a82[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x313a82,{'showHidden':![],'depth':null}));if(_[_0xe0d0('0x21')](this[_0xe0d0('0x9')][_0x313a82[_0xe0d0('0x25')]])){this[_0xe0d0('0x9')][_0x313a82[_0xe0d0('0x25')]]={};}if(_[_0xe0d0('0x21')](this[_0xe0d0('0x9')][_0x313a82[_0xe0d0('0x25')]][_0x313a82['destuniqueid']])){this['channels'][_0x313a82[_0xe0d0('0x25')]][_0x313a82['destuniqueid']]={'agentcalledAt':moment()[_0xe0d0('0x2a')](_0xe0d0('0x2b')),'lastevent':_0xe0d0('0x2c'),'mandatoryDisposition':this[_0xe0d0('0xa')][_0x313a82[_0xe0d0('0x2d')]]?this['voiceQueues'][_0x313a82[_0xe0d0('0x2d')]][_0xe0d0('0x2e')]||![]:![],'type':this[_0xe0d0('0xa')][_0x313a82[_0xe0d0('0x2d')]]?this[_0xe0d0('0xa')][_0x313a82[_0xe0d0('0x2d')]][_0xe0d0('0x2f')]||_0xe0d0('0x30'):'inbound','variables':this[_0xe0d0('0x31')][_0x313a82[_0xe0d0('0x25')]]};}_[_0xe0d0('0x32')](this['channels'][_0x313a82['uniqueid']][_0x313a82[_0xe0d0('0x33')]],_[_0xe0d0('0x34')](_0x313a82,['event',_0xe0d0('0x35')]));logger[_0xe0d0('0x27')](_0xe0d0('0x36'),_0x313a82[_0xe0d0('0x25')],util[_0xe0d0('0x29')](this[_0xe0d0('0x9')][_0x313a82[_0xe0d0('0x25')]][_0x313a82[_0xe0d0('0x33')]],{'showHidden':![],'depth':null}));ami[_0xe0d0('0x20')]('custom:agentcalled',this[_0xe0d0('0x9')][_0x313a82[_0xe0d0('0x25')]][_0x313a82[_0xe0d0('0x33')]]);logger[_0xe0d0('0x27')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x313a82[_0xe0d0('0x25')],util[_0xe0d0('0x29')](this['channels'][_0x313a82[_0xe0d0('0x25')]][_0x313a82[_0xe0d0('0x33')]],{'showHidden':![],'depth':null}));this[_0xe0d0('0x20')](util[_0xe0d0('0x2a')](_0xe0d0('0x37'),_0x313a82[_0xe0d0('0x26')]),_0xe0d0('0x38'),this[_0xe0d0('0x9')][_0x313a82[_0xe0d0('0x25')]][_0x313a82[_0xe0d0('0x33')]]);}}catch(_0xde71b7){logger['error'](_0xe0d0('0x39'),_0x313a82[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0xde71b7,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe0d0('0x1f')][_0xe0d0('0xd')]=function(_0x3a651e){try{if(this[_0xe0d0('0x22')](_0x3a651e)){if(this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]]){logger[_0xe0d0('0x27')](_0xe0d0('0x3a'),_0x3a651e['uniqueid'],util[_0xe0d0('0x29')](_0x3a651e,{'showHidden':![],'depth':null}));for(var _0x4894c8 in this['channels'][_0x3a651e['uniqueid']]){if(this['channels'][_0x3a651e[_0xe0d0('0x25')]]['hasOwnProperty'](_0x4894c8)){if(_0x3a651e[_0xe0d0('0x33')]===_0x4894c8){logger[_0xe0d0('0x23')](_0xe0d0('0x3b'),_0x3a651e['uniqueid'],_0x3a651e[_0xe0d0('0x26')],_0x3a651e['destuniqueid']);this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0x3c')]=moment()[_0xe0d0('0x2a')](_0xe0d0('0x2b'));this[_0xe0d0('0x9')][_0x3a651e['uniqueid']][_0x4894c8]['connectedlinename']=_0x3a651e[_0xe0d0('0x3d')];this[_0xe0d0('0x9')][_0x3a651e['uniqueid']][_0x4894c8][_0xe0d0('0x3e')]=_0x3a651e[_0xe0d0('0x3e')];this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0x3f')]=_0x3a651e['destchannelstate'];this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8]['destchannelstatedesc']=_0x3a651e['destchannelstatedesc'];this[_0xe0d0('0x9')][_0x3a651e['uniqueid']][_0x4894c8]['holdtime']=_0x3a651e[_0xe0d0('0x40')];this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0x41')]='connect';_[_0xe0d0('0x32')](this[_0xe0d0('0xb')][_0x3a651e['interface']],_[_0xe0d0('0x42')](_0x3a651e,[_0xe0d0('0x2d'),_0xe0d0('0x43')]));logger['debug'](_0xe0d0('0x44'),_0x3a651e[_0xe0d0('0x25')],util[_0xe0d0('0x29')](this[_0xe0d0('0x9')][_0x3a651e['uniqueid']][_0x3a651e['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xe0d0('0x45'),this[_0xe0d0('0x9')][_0x3a651e['uniqueid']][_0x3a651e['destuniqueid']]);logger[_0xe0d0('0x27')](_0xe0d0('0x46'),_0x3a651e[_0xe0d0('0x25')],util[_0xe0d0('0x29')](this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x3a651e[_0xe0d0('0x33')]],{'showHidden':![],'depth':null}));this[_0xe0d0('0x20')](util['format']('user:%s',_0x3a651e[_0xe0d0('0x26')]),_0xe0d0('0x47'),this['channels'][_0x3a651e[_0xe0d0('0x25')]][_0x3a651e[_0xe0d0('0x33')]]);}else if(!this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0xf')]&&!this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0x48')]){logger['info'](_0xe0d0('0x49'),_0x3a651e[_0xe0d0('0x25')],this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0x26')],_0x4894c8);this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0xf')]=!![];this[_0xe0d0('0x9')][_0x3a651e['uniqueid']][_0x4894c8][_0xe0d0('0x4a')]=moment()[_0xe0d0('0x2a')](_0xe0d0('0x2b'));this['channels'][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0x4b')]=_0x3a651e[_0xe0d0('0x33')];this['channels'][_0x3a651e['uniqueid']][_0x4894c8][_0xe0d0('0x4c')]=_0x3a651e[_0xe0d0('0x26')];this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0x41')]=_0xe0d0('0x4d');this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8][_0xe0d0('0x4e')]='answered_elsewhere';logger[_0xe0d0('0x27')](_0xe0d0('0x4f'),_0x3a651e[_0xe0d0('0x25')],util['inspect'](this['channels'][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8],{'showHidden':![],'depth':null}));ami[_0xe0d0('0x20')](_0xe0d0('0x50'),this[_0xe0d0('0x9')][_0x3a651e[_0xe0d0('0x25')]][_0x4894c8]);}}}}}}catch(_0x591672){logger[_0xe0d0('0x51')]('[%s][voiceAgentReport][agentconnect]',_0x3a651e['uniqueid'],util[_0xe0d0('0x29')](_0x591672,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe0d0('0x1f')][_0xe0d0('0x10')]=function(_0x3c6444){try{if(this[_0xe0d0('0x22')](_0x3c6444)){logger['debug'](_0xe0d0('0x52'),_0x3c6444[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x3c6444,{'showHidden':![],'depth':null}));if(this['channels'][_0x3c6444['uniqueid']]&&this[_0xe0d0('0x9')][_0x3c6444[_0xe0d0('0x25')]][_0x3c6444[_0xe0d0('0x33')]]){logger[_0xe0d0('0x23')](_0xe0d0('0x53'),_0x3c6444[_0xe0d0('0x25')],_0x3c6444[_0xe0d0('0x26')],_0x3c6444[_0xe0d0('0x33')]);this[_0xe0d0('0x9')][_0x3c6444[_0xe0d0('0x25')]][_0x3c6444[_0xe0d0('0x33')]][_0xe0d0('0xf')]=!![];this[_0xe0d0('0x9')][_0x3c6444['uniqueid']][_0x3c6444[_0xe0d0('0x33')]]['agentringnoanswerAt']=moment()['format'](_0xe0d0('0x2b'));this[_0xe0d0('0x9')][_0x3c6444['uniqueid']][_0x3c6444[_0xe0d0('0x33')]][_0xe0d0('0x41')]=_0xe0d0('0x54');this[_0xe0d0('0x9')][_0x3c6444[_0xe0d0('0x25')]][_0x3c6444[_0xe0d0('0x33')]][_0xe0d0('0x4e')]=_0xe0d0('0x54');logger[_0xe0d0('0x27')](_0xe0d0('0x55'),_0x3c6444[_0xe0d0('0x25')],util['inspect'](this['channels'][_0x3c6444['uniqueid']][_0x3c6444['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xe0d0('0x20')](_0xe0d0('0x56'),this[_0xe0d0('0x9')][_0x3c6444[_0xe0d0('0x25')]][_0x3c6444[_0xe0d0('0x33')]]);}}}catch(_0xc608dc){logger[_0xe0d0('0x51')](_0xe0d0('0x57'),_0x3c6444[_0xe0d0('0x25')],util['inspect'](_0xc608dc,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe0d0('0x12')]=function(_0x50b858){try{if(this[_0xe0d0('0x22')](_0x50b858)){logger[_0xe0d0('0x27')](_0xe0d0('0x58'),_0x50b858[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x50b858,{'showHidden':![],'depth':null}));if(this[_0xe0d0('0x9')][_0x50b858[_0xe0d0('0x25')]]){for(var _0x2ef7f4 in this['channels'][_0x50b858[_0xe0d0('0x25')]]){if(this[_0xe0d0('0x9')][_0x50b858['uniqueid']][_0xe0d0('0x59')](_0x2ef7f4)&&!this[_0xe0d0('0x9')][_0x50b858[_0xe0d0('0x25')]][_0x2ef7f4][_0xe0d0('0xf')]&&!this[_0xe0d0('0x9')][_0x50b858[_0xe0d0('0x25')]][_0x2ef7f4][_0xe0d0('0x48')]){logger[_0xe0d0('0x23')](_0xe0d0('0x5a'),_0x50b858[_0xe0d0('0x25')],this[_0xe0d0('0x9')][_0x50b858[_0xe0d0('0x25')]][_0x2ef7f4]['membername'],_0x2ef7f4);this['channels'][_0x50b858[_0xe0d0('0x25')]][_0x2ef7f4][_0xe0d0('0xf')]=!![];this['channels'][_0x50b858[_0xe0d0('0x25')]][_0x2ef7f4][_0xe0d0('0x4a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xe0d0('0x9')][_0x50b858[_0xe0d0('0x25')]][_0x2ef7f4][_0xe0d0('0x41')]=_0xe0d0('0x5b');this[_0xe0d0('0x9')][_0x50b858[_0xe0d0('0x25')]][_0x2ef7f4]['reason']=_0xe0d0('0x5b');logger[_0xe0d0('0x27')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x50b858[_0xe0d0('0x25')],util[_0xe0d0('0x29')](this['channels'][_0x50b858[_0xe0d0('0x25')]][_0x2ef7f4],{'showHidden':![],'depth':null}));ami['emit'](_0xe0d0('0x5c'),this[_0xe0d0('0x9')][_0x50b858[_0xe0d0('0x25')]][_0x2ef7f4]);}}}}}catch(_0x2653d6){logger[_0xe0d0('0x51')](_0xe0d0('0x5d'),_0x50b858['uniqueid'],util['inspect'](_0x2653d6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe0d0('0x1f')]['syncAgentComplete']=function(_0xeb9fe5){try{if(this[_0xe0d0('0x22')](_0xeb9fe5)){logger[_0xe0d0('0x27')](_0xe0d0('0x5e'),_0xeb9fe5[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0xeb9fe5,{'showHidden':![],'depth':null}));if(this[_0xe0d0('0x9')][_0xeb9fe5[_0xe0d0('0x25')]]){for(var _0x490e8e in this[_0xe0d0('0x9')][_0xeb9fe5[_0xe0d0('0x25')]]){if(this['channels'][_0xeb9fe5[_0xe0d0('0x25')]][_0xe0d0('0x59')](_0x490e8e)){if(this[_0xe0d0('0x9')][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e][_0xe0d0('0x3c')]&&!this[_0xe0d0('0x9')][_0xeb9fe5['uniqueid']][_0x490e8e][_0xe0d0('0x48')]){logger[_0xe0d0('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0xeb9fe5[_0xe0d0('0x25')],this['channels'][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e][_0xe0d0('0x26')],_0x490e8e);this[_0xe0d0('0x9')][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e][_0xe0d0('0x48')]=!![];this[_0xe0d0('0x9')][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e][_0xe0d0('0x5f')]=moment()[_0xe0d0('0x2a')](_0xe0d0('0x2b'));this[_0xe0d0('0x9')][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e]['lastevent']='complete';this['channels'][_0xeb9fe5['uniqueid']][_0x490e8e][_0xe0d0('0x4e')]=_0xeb9fe5[_0xe0d0('0x4e')]==_0xe0d0('0x60')?'agent':_0xeb9fe5[_0xe0d0('0x4e')];this['channels'][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e]['talktime']=_0xeb9fe5['talktime'];if(this[_0xe0d0('0xa')][_0xeb9fe5[_0xe0d0('0x2d')]]&&this[_0xe0d0('0xa')][_0xeb9fe5[_0xe0d0('0x2d')]][_0xe0d0('0x61')]){this['channels'][_0xeb9fe5['uniqueid']][_0x490e8e][_0xe0d0('0x62')]=this['voiceQueues'][_0xeb9fe5[_0xe0d0('0x2d')]][_0xe0d0('0x63')];this[_0xe0d0('0x9')][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e][_0xe0d0('0x64')]=!![];}this[_0xe0d0('0xb')][_0xeb9fe5[_0xe0d0('0x65')]]=_[_0xe0d0('0x34')](this['agents'][_0xeb9fe5[_0xe0d0('0x65')]],['queue','destconnectedlinenum']);logger[_0xe0d0('0x27')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0xeb9fe5[_0xe0d0('0x25')],util[_0xe0d0('0x29')](this['channels'][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e],{'showHidden':![],'depth':null}));ami[_0xe0d0('0x20')]('custom:agentcomplete',this[_0xe0d0('0x9')][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e]);logger[_0xe0d0('0x27')](_0xe0d0('0x66'),_0xeb9fe5[_0xe0d0('0x25')],util['inspect'](this['channels'][_0xeb9fe5['uniqueid']][_0x490e8e],{'showHidden':![],'depth':null}));this['emit'](util[_0xe0d0('0x2a')]('user:%s',_0xeb9fe5['membername']),_0xe0d0('0x67'),this[_0xe0d0('0x9')][_0xeb9fe5[_0xe0d0('0x25')]][_0x490e8e]);}}}}}}catch(_0x5c5839){logger[_0xe0d0('0x51')](_0xe0d0('0x68'),_0xeb9fe5[_0xe0d0('0x25')],util['inspect'](_0x5c5839,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe0d0('0x1f')]['syncVarSet']=function(_0x2ccfab){try{if(this[_0xe0d0('0x22')](_0x2ccfab)){logger[_0xe0d0('0x27')](_0xe0d0('0x69'),_0x2ccfab[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x2ccfab,{'showHidden':![],'depth':null}));this['addVariable'](_0x2ccfab[_0xe0d0('0x25')],_[_0xe0d0('0x6a')](_0x2ccfab[_0xe0d0('0x6b')])[0x0],_0x2ccfab[_0xe0d0('0x6c')]);if(this[_0xe0d0('0x9')][_0x2ccfab[_0xe0d0('0x25')]]){for(var _0x334f66 in this[_0xe0d0('0x9')][_0x2ccfab[_0xe0d0('0x25')]]){if(this[_0xe0d0('0x9')][_0x2ccfab[_0xe0d0('0x25')]]['hasOwnProperty'](_0x334f66)){logger[_0xe0d0('0x23')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x2ccfab[_0xe0d0('0x25')],_0x334f66,_['keys'](_0x2ccfab[_0xe0d0('0x6b')])[0x0],_0x2ccfab[_0xe0d0('0x6c')]);if(_[_0xe0d0('0x21')](this[_0xe0d0('0x9')][_0x2ccfab[_0xe0d0('0x25')]][_0x334f66][_0xe0d0('0x31')])){this['channels'][_0x2ccfab['uniqueid']][_0x334f66][_0xe0d0('0x31')]={};}this[_0xe0d0('0x9')][_0x2ccfab[_0xe0d0('0x25')]][_0x334f66][_0xe0d0('0x31')]=this[_0xe0d0('0x31')][_0x2ccfab['uniqueid']];}}}}}catch(_0x449451){logger['error'](_0xe0d0('0x6d'),_0x2ccfab['uniqueid'],util['inspect'](_0x449451,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe0d0('0x1f')][_0xe0d0('0x6e')]=function(_0x43596e,_0xc691d1,_0x3c879a){var _0x589e5a=[_0xe0d0('0x6f'),'rtpaudioqosbridged',_0xe0d0('0x70'),_0xe0d0('0x71'),_0xe0d0('0x72'),_0xe0d0('0x73'),_0xe0d0('0x74'),_0xe0d0('0x75'),_0xe0d0('0x76'),'sipuri','bridgepeer',_0xe0d0('0x77'),_0xe0d0('0x78'),_0xe0d0('0x79'),_0xe0d0('0x7a'),'memberlastcall',_0xe0d0('0x26'),_0xe0d0('0x7b'),_0xe0d0('0x7c')];if(!_[_0xe0d0('0x7d')](_0xc691d1)&&!_['includes'](_0x589e5a,_0xc691d1)){if(_[_0xe0d0('0x21')](this[_0xe0d0('0x31')][_0x43596e])){this['variables'][_0x43596e]={};}this[_0xe0d0('0x31')][_0x43596e][_0xc691d1]=_0x3c879a;}};VoiceAgentReport[_0xe0d0('0x1f')][_0xe0d0('0x7e')]=function(_0x47749e){try{if(this[_0xe0d0('0x22')](_0x47749e)){logger['debug'](_0xe0d0('0x7f'),_0x47749e[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x47749e,{'showHidden':![],'depth':null}));if(this[_0xe0d0('0x9')][_0x47749e[_0xe0d0('0x25')]]){for(var _0x5b53d5 in this[_0xe0d0('0x9')][_0x47749e[_0xe0d0('0x25')]]){if(this[_0xe0d0('0x9')][_0x47749e[_0xe0d0('0x25')]]['hasOwnProperty'](_0x5b53d5)){if(this[_0xe0d0('0x9')][_0x47749e[_0xe0d0('0x25')]][_0x5b53d5]['reason']=='transfer'&&this[_0xe0d0('0x9')][_0x47749e[_0xe0d0('0x25')]][_0x5b53d5]['agentcomplete']){logger[_0xe0d0('0x23')](_0xe0d0('0x80'),_0x47749e[_0xe0d0('0x25')],_0x5b53d5);this[_0xe0d0('0x9')][_0x47749e[_0xe0d0('0x25')]][_0x5b53d5][_0xe0d0('0x5f')]=moment()['format'](_0xe0d0('0x2b'));}}}logger['debug'](_0xe0d0('0x81'),_0x47749e[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_[_0xe0d0('0x82')](this[_0xe0d0('0x9')][_0x47749e[_0xe0d0('0x25')]]),{'showHidden':![],'depth':null}));ami[_0xe0d0('0x20')](_0xe0d0('0x83'),_[_0xe0d0('0x82')](this['channels'][_0x47749e['uniqueid']]));delete this[_0xe0d0('0x9')][_0x47749e[_0xe0d0('0x25')]];}if(this[_0xe0d0('0x31')][_0x47749e[_0xe0d0('0x25')]]){delete this[_0xe0d0('0x31')][_0x47749e['uniqueid']];}}}catch(_0x380206){logger[_0xe0d0('0x51')]('[%s][voiceAgentReport][hangup]',_0x47749e[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x380206,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe0d0('0x1c')]=function(_0x5e46b9){try{if(this[_0xe0d0('0x22')](_0x5e46b9)){logger[_0xe0d0('0x27')](_0xe0d0('0x84'),_0x5e46b9[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x5e46b9,{'showHidden':![],'depth':null}));if(this[_0xe0d0('0x9')][_0x5e46b9[_0xe0d0('0x85')]]){for(var _0x81be41 in this[_0xe0d0('0x9')][_0x5e46b9['transfereeuniqueid']]){if(this[_0xe0d0('0x9')][_0x5e46b9[_0xe0d0('0x85')]][_0xe0d0('0x59')](_0x81be41)){if(_0x5e46b9[_0xe0d0('0x86')]===_0x81be41){logger[_0xe0d0('0x23')](_0xe0d0('0x87'),_0x5e46b9['uniqueid'],this[_0xe0d0('0x9')][_0x5e46b9[_0xe0d0('0x85')]][_0x81be41][_0xe0d0('0x26')],_0x81be41);var _0x1dc3b1=moment();this[_0xe0d0('0x9')][_0x5e46b9[_0xe0d0('0x85')]][_0x81be41][_0xe0d0('0x48')]=!![];this[_0xe0d0('0x9')][_0x5e46b9[_0xe0d0('0x85')]][_0x81be41]['agentcompleteAt']=moment()[_0xe0d0('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5e46b9['transfereeuniqueid']][_0x81be41][_0xe0d0('0x41')]=_0xe0d0('0x88');this[_0xe0d0('0x9')][_0x5e46b9['transfereeuniqueid']][_0x81be41][_0xe0d0('0x4e')]='transfer';this[_0xe0d0('0x9')][_0x5e46b9[_0xe0d0('0x85')]][_0x81be41][_0xe0d0('0x89')]=_0x1dc3b1[_0xe0d0('0x8a')](this['channels'][_0x5e46b9[_0xe0d0('0x85')]][_0x81be41][_0xe0d0('0x3c')],_0xe0d0('0x8b'));}}}}if(this['channels'][_0x5e46b9[_0xe0d0('0x8c')]]){var _0x483138=this[_0xe0d0('0x9')][_0x5e46b9[_0xe0d0('0x8c')]];this[_0xe0d0('0x9')][_0x5e46b9['secondtransfereruniqueid']]=this[_0xe0d0('0x9')][_0x5e46b9[_0xe0d0('0x85')]];this['channels'][_0x5e46b9[_0xe0d0('0x85')]]=_0x483138;}}}catch(_0x5b1572){logger[_0xe0d0('0x51')]('[%s][voiceAgentReport][attendedtransfer]',_0x5e46b9['uniqueid'],util['inspect'](_0x5b1572,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe0d0('0x1f')]['syncBlindTransfer']=function(_0x4eb696){try{if(this['isNotNull'](_0x4eb696)){logger[_0xe0d0('0x27')](_0xe0d0('0x8d'),_0x4eb696[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x4eb696,{'showHidden':![],'depth':null}));if(this['channels'][_0x4eb696[_0xe0d0('0x85')]]){for(var _0x3e26bf in this[_0xe0d0('0x9')][_0x4eb696['transfereeuniqueid']]){if(this[_0xe0d0('0x9')][_0x4eb696[_0xe0d0('0x85')]]['hasOwnProperty'](_0x3e26bf)){if(_0x4eb696[_0xe0d0('0x8e')]===_0x3e26bf){logger[_0xe0d0('0x23')](_0xe0d0('0x8f'),_0x4eb696[_0xe0d0('0x25')],this[_0xe0d0('0x9')][_0x4eb696[_0xe0d0('0x85')]][_0x3e26bf][_0xe0d0('0x26')],_0x3e26bf);var _0x1a4548=moment();this[_0xe0d0('0x9')][_0x4eb696[_0xe0d0('0x85')]][_0x3e26bf][_0xe0d0('0x48')]=!![];this[_0xe0d0('0x9')][_0x4eb696[_0xe0d0('0x85')]][_0x3e26bf][_0xe0d0('0x5f')]=_0x1a4548;this['channels'][_0x4eb696['transfereeuniqueid']][_0x3e26bf][_0xe0d0('0x41')]=_0xe0d0('0x88');this[_0xe0d0('0x9')][_0x4eb696[_0xe0d0('0x85')]][_0x3e26bf]['reason']='transfer';this[_0xe0d0('0x9')][_0x4eb696[_0xe0d0('0x85')]][_0x3e26bf][_0xe0d0('0x89')]=_0x1a4548['diff'](this[_0xe0d0('0x9')][_0x4eb696['transfereeuniqueid']][_0x3e26bf]['agentconnectAt'],_0xe0d0('0x8b'));}}}}}}catch(_0x4f9aad){logger[_0xe0d0('0x51')](_0xe0d0('0x90'),_0x4eb696[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x4f9aad,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe0d0('0x1f')]['syncMusicOnHoldStart']=function(_0x552e34){var _0xb6c073='';try{if(this[_0xe0d0('0x22')](_0x552e34)){logger[_0xe0d0('0x27')](_0xe0d0('0x91'),_0x552e34[_0xe0d0('0x25')],util['inspect'](_0x552e34,{'showHidden':![],'depth':null}));if(_0x552e34[_0xe0d0('0x92')]){_0xb6c073=_0x552e34[_0xe0d0('0x92')][_0xe0d0('0x93')](0x0,_0x552e34['channel'][_0xe0d0('0x94')]('-'));if(this[_0xe0d0('0xb')][_0xb6c073]){logger[_0xe0d0('0x23')](_0xe0d0('0x95'),_0x552e34['uniqueid'],_0xb6c073);this[_0xe0d0('0xb')][_0xb6c073][_0xe0d0('0x96')]=!![];}}}}catch(_0x108973){logger['error'](_0xe0d0('0x97'),_0x552e34[_0xe0d0('0x25')],util['inspect'](_0x108973,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe0d0('0x1a')]=function(_0x2e061d){var _0x307630='';try{if(this[_0xe0d0('0x22')](_0x2e061d)){logger[_0xe0d0('0x27')](_0xe0d0('0x98'),_0x2e061d[_0xe0d0('0x25')],util['inspect'](_0x2e061d,{'showHidden':![],'depth':null}));if(_0x2e061d[_0xe0d0('0x92')]){_0x307630=_0x2e061d[_0xe0d0('0x92')][_0xe0d0('0x93')](0x0,_0x2e061d[_0xe0d0('0x92')][_0xe0d0('0x94')]('-'));if(this['agents'][_0x307630]){logger[_0xe0d0('0x23')](_0xe0d0('0x99'),_0x2e061d[_0xe0d0('0x25')],_0x307630);this[_0xe0d0('0xb')][_0x307630][_0xe0d0('0x96')]=![];}}}}catch(_0x430074){logger[_0xe0d0('0x51')]('[%s][voiceAgentReport][musiconholdstop]',_0x2e061d[_0xe0d0('0x25')],util[_0xe0d0('0x29')](_0x430074,{'showHidden':![],'depth':null}));}};module[_0xe0d0('0x9a')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 1eec1ff..5f5b402 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 _0x26d3=['[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','isNil','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','agi','dial','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','syncNewExten','bind','newexten','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','split','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','includes','startsWith','cdr(','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','seconds','connectedlinenum','connectedlinename','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','replace','.wav49','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','sipcalllinkedid','cause-txt','endtime','diff','billableseconds','omit','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','event','BlindTransfer','type','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum'];(function(_0x9ed916,_0x559a29){var _0x57b7a5=function(_0x463707){while(--_0x463707){_0x9ed916['push'](_0x9ed916['shift']());}};_0x57b7a5(++_0x559a29);}(_0x26d3,0xd3));var _0x326d=function(_0x5b57d9,_0x16eceb){_0x5b57d9=_0x5b57d9-0x0;var _0x49e4e8=_0x26d3[_0x5b57d9];return _0x49e4e8;};'use strict';var BPromise=require(_0x326d('0x0'));var _=require(_0x326d('0x1'));var moment=require(_0x326d('0x2'));var util=require('util');var path=require(_0x326d('0x3'));var Redis=require(_0x326d('0x4'));var config=require(_0x326d('0x5'));var logger=require(_0x326d('0x6'))('ami');var ami=require(_0x326d('0x7'));var Channel=require(_0x326d('0x8'));var statusDesc=[_0x326d('0x9'),_0x326d('0xa'),_0x326d('0xb'),_0x326d('0xc'),_0x326d('0xd'),'unavailable',_0x326d('0xe'),_0x326d('0xf'),_0x326d('0x10')];var applications=[_0x326d('0x11'),'queue',_0x326d('0x12'),_0x326d('0x13'),'playback','voicemail'];var dispositions=['NO\x20ANSWER',_0x326d('0x14'),_0x326d('0x14'),'NO\x20ANSWER',_0x326d('0x15'),_0x326d('0x15'),_0x326d('0x16'),'BUSY',_0x326d('0x14'),_0x326d('0x14'),_0x326d('0x14')];var actions={};config[_0x326d('0x17')]=_[_0x326d('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x326d('0x19'))(new Redis(config['redis']));function VoiceCallReport(_0x12acc2){this[_0x326d('0x1a')]=_0x12acc2['channels'];this['agents']=_0x12acc2[_0x326d('0x1b')];this[_0x326d('0x1c')]={};ami['on']('coreshowchannel',this[_0x326d('0x1d')][_0x326d('0x1e')](this));ami['on'](_0x326d('0x1f'),this['syncNewExten'][_0x326d('0x1e')](this));ami['on']('newchannel',this['syncNewChannel'][_0x326d('0x1e')](this));ami['on']('newstate',this[_0x326d('0x20')][_0x326d('0x1e')](this));ami['on'](_0x326d('0x21'),this[_0x326d('0x22')][_0x326d('0x1e')](this));ami['on'](_0x326d('0x23'),this[_0x326d('0x24')]['bind'](this));ami['on'](_0x326d('0x25'),this['syncNewCallerId'][_0x326d('0x1e')](this));ami['on'](_0x326d('0x26'),this[_0x326d('0x27')][_0x326d('0x1e')](this));ami['on'](_0x326d('0x28'),this[_0x326d('0x29')][_0x326d('0x1e')](this));ami['on'](_0x326d('0x2a'),this['syncMusicOnHoldStart'][_0x326d('0x1e')](this));ami['on'](_0x326d('0x2b'),this['syncMusicOnHoldStop'][_0x326d('0x1e')](this));try{logger[_0x326d('0x2c')](_0x326d('0x2d'));ami['actionCoreShowChannels']();}catch(_0x17f939){logger[_0x326d('0x2e')](_0x326d('0x2f'),util[_0x326d('0x30')](_0x17f939,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x326d('0x31')]=function(_0x163e33){return _0x163e33!==null&&!_[_0x326d('0x32')](_0x163e33);};VoiceCallReport[_0x326d('0x33')][_0x326d('0x34')]=function(_0x20fac8,_0x40d10e,_0x44eea7){io['to'](_0x20fac8)[_0x326d('0x34')](_0x40d10e,_0x44eea7);};VoiceCallReport[_0x326d('0x33')][_0x326d('0x35')]=function(_0x19e01d){try{if(this[_0x326d('0x31')](_0x19e01d)){logger[_0x326d('0x2c')](_0x326d('0x36'),_0x19e01d[_0x326d('0x37')],_0x19e01d['calleridname'],_0x19e01d[_0x326d('0x38')]);logger[_0x326d('0x39')](_0x326d('0x3a'),_0x19e01d[_0x326d('0x37')],util['inspect'](_0x19e01d,{'showHidden':![],'depth':null}));if(_0x19e01d[_0x326d('0x37')]===_0x19e01d[_0x326d('0x3b')]){if(!_['isUndefined'](this['channels'][_0x19e01d[_0x326d('0x37')]])){_[_0x326d('0x3c')](this[_0x326d('0x1a')][_0x19e01d[_0x326d('0x37')]],_[_0x326d('0x3d')](_0x19e01d,_[_0x326d('0x3e')](this[_0x326d('0x1a')][_0x19e01d['uniqueid']])));}}}}catch(_0x52c6bf){logger[_0x326d('0x2e')]('[%s][voiceCallReport][newcallerid]',_0x19e01d[_0x326d('0x37')],util[_0x326d('0x30')](_0x52c6bf,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x326d('0x3f')]=function(_0x27a1e3){try{if(this['isNotNull'](_0x27a1e3)){logger[_0x326d('0x39')](_0x326d('0x40'),_0x27a1e3['uniqueid'],util[_0x326d('0x30')](_0x27a1e3,{'showHidden':![],'depth':null}));if(_0x27a1e3[_0x326d('0x37')]===_0x27a1e3[_0x326d('0x3b')]&&_0x27a1e3[_0x326d('0x41')]!=_0x326d('0x42')){if(_[_0x326d('0x32')](this[_0x326d('0x1a')][_0x27a1e3[_0x326d('0x37')]])){logger['info'](_0x326d('0x43'),_0x27a1e3[_0x326d('0x37')],_0x27a1e3[_0x326d('0x44')],_0x27a1e3[_0x326d('0x45')]);this[_0x326d('0x1a')][_0x27a1e3[_0x326d('0x37')]]=new Channel();this[_0x326d('0x1a')][_0x27a1e3[_0x326d('0x37')]]['starttime']=moment()[_0x326d('0x46')](_0x326d('0x47'));this[_0x326d('0x1a')][_0x27a1e3[_0x326d('0x37')]][_0x326d('0x48')]=dispositions[_[_0x326d('0x49')](_0x27a1e3[_0x326d('0x4a')])];_[_0x326d('0x3c')](this[_0x326d('0x1a')][_0x27a1e3[_0x326d('0x37')]],_[_0x326d('0x3d')](_0x27a1e3,_['keys'](this[_0x326d('0x1a')][_0x27a1e3[_0x326d('0x37')]])));if(_0x27a1e3[_0x326d('0x44')]===_0x326d('0x4b')){if(this['agents'][_0x27a1e3[_0x326d('0x41')]['split']('-')[0x0]]){this[_0x326d('0x1b')][_0x27a1e3['channel']['split']('-')[0x0]]['destconnectedlinenum']=_0x27a1e3['exten'];logger[_0x326d('0x39')](_0x326d('0x4c'),_0x27a1e3[_0x326d('0x37')],util['inspect']({'destaccountcode':this[_0x326d('0x1b')][_0x27a1e3[_0x326d('0x41')][_0x326d('0x4d')]('-')[0x0]][_0x326d('0x4e')],'destconnectedlinenum':_0x27a1e3[_0x326d('0x45')]},{'showHidden':![],'depth':null}));this[_0x326d('0x34')](util[_0x326d('0x46')](_0x326d('0x4f'),this[_0x326d('0x1b')][_0x27a1e3[_0x326d('0x41')]['split']('-')[0x0]][_0x326d('0x50')]),_0x326d('0x51'),{'destaccountcode':this['agents'][_0x27a1e3[_0x326d('0x41')]['split']('-')[0x0]][_0x326d('0x4e')],'destconnectedlinenum':_0x27a1e3[_0x326d('0x45')]});}}}}}}catch(_0x3f7830){logger[_0x326d('0x2e')](_0x326d('0x52'),_0x27a1e3[_0x326d('0x37')],util[_0x326d('0x30')](_0x3f7830,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x37bc04){try{if(this['isNotNull'](_0x37bc04)){logger[_0x326d('0x39')](_0x326d('0x53'),_0x37bc04[_0x326d('0x37')],util['inspect'](_0x37bc04,{'showHidden':![],'depth':null}));if(_0x37bc04['uniqueid']===_0x37bc04[_0x326d('0x3b')]&&_0x37bc04[_0x326d('0x45')]!='h'&&_0x37bc04[_0x326d('0x41')]!=_0x326d('0x42')){_0x37bc04[_0x326d('0x54')]=_0x37bc04['application']['toLowerCase']();_0x37bc04[_0x326d('0x55')]=(_0x37bc04['appdata']||_0x37bc04['applicationdata'])[_0x326d('0x56')]();logger[_0x326d('0x2c')](_0x326d('0x57'),_0x37bc04['uniqueid'],_0x37bc04[_0x326d('0x54')],_0x37bc04['applicationdata']);if(_[_0x326d('0x32')](this[_0x326d('0x1a')][_0x37bc04['uniqueid']])){this['channels'][_0x37bc04['uniqueid']]=new Channel();this[_0x326d('0x1a')][_0x37bc04[_0x326d('0x37')]][_0x326d('0x58')]=_0x37bc04[_0x326d('0x59')]?moment()[_0x326d('0x5a')](moment[_0x326d('0x59')](_0x37bc04['duration'])['seconds'](),'seconds')[_0x326d('0x46')](_0x326d('0x47')):moment()[_0x326d('0x46')](_0x326d('0x47'));this[_0x326d('0x1a')][_0x37bc04[_0x326d('0x37')]]['disposition']=_0x326d('0x15');}_[_0x326d('0x3c')](this[_0x326d('0x1a')][_0x37bc04[_0x326d('0x37')]],_[_0x326d('0x3d')](_0x37bc04,_[_0x326d('0x3e')](this['channels'][_0x37bc04['uniqueid']])));if(_[_0x326d('0x5b')](applications,_0x37bc04['application'])){this['channels'][_0x37bc04[_0x326d('0x37')]]['lastapplication']=_0x37bc04[_0x326d('0x54')];this[_0x326d('0x1a')][_0x37bc04[_0x326d('0x37')]]['lastdata']=_0x37bc04[_0x326d('0x55')];if(_0x37bc04[_0x326d('0x54')]==='set'&&_[_0x326d('0x5c')](_0x37bc04[_0x326d('0x55')],_0x326d('0x5d'))){var _0x494f1f=_0x37bc04[_0x326d('0x55')][_0x326d('0x4d')]('=');var _0x3e8bf3=_0x494f1f[0x0][_0x326d('0x5e')](/cdr\((.*)\)/);if(_0x3e8bf3){this[_0x326d('0x1a')][_0x37bc04[_0x326d('0x37')]][_0x3e8bf3[0x1]]=_0x494f1f[0x1];}}else if(_0x37bc04[_0x326d('0x54')]===_0x326d('0x5f')){this[_0x326d('0x1a')][_0x37bc04[_0x326d('0x37')]][_0x326d('0x5f')]=_0x37bc04['applicationdata']['split'](',')[0x0];}}}}}catch(_0x5c9477){logger['error'](_0x326d('0x60'),_0x37bc04['uniqueid'],util[_0x326d('0x30')](_0x5c9477,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x326d('0x33')][_0x326d('0x20')]=function(_0x1499af){try{if(this[_0x326d('0x31')](_0x1499af)){logger['info'](_0x326d('0x61'),_0x1499af[_0x326d('0x37')],_0x1499af[_0x326d('0x3b')],_0x1499af[_0x326d('0x62')],_0x1499af[_0x326d('0x38')]);logger['debug'](_0x326d('0x63'),_0x1499af['uniqueid'],util[_0x326d('0x30')](_0x1499af,{'showHidden':![],'depth':null}));if(_0x1499af[_0x326d('0x37')]!==_0x1499af[_0x326d('0x3b')]){if(this['channels'][_0x1499af[_0x326d('0x3b')]]){if(_0x1499af[_0x326d('0x4a')]==='6'){if(!this[_0x326d('0x1a')][_0x1499af[_0x326d('0x3b')]][_0x326d('0x64')]){var _0x55f62e=moment();this[_0x326d('0x1a')][_0x1499af['linkedid']][_0x326d('0x64')]=!![];this[_0x326d('0x1a')][_0x1499af[_0x326d('0x3b')]][_0x326d('0x65')]=_0x55f62e[_0x326d('0x46')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x326d('0x1a')][_0x1499af[_0x326d('0x3b')]]['starttime']){this[_0x326d('0x1a')][_0x1499af[_0x326d('0x3b')]][_0x326d('0x66')]=_0x55f62e['diff'](this['channels'][_0x1499af['linkedid']][_0x326d('0x58')],_0x326d('0x67'));}}this[_0x326d('0x1a')][_0x1499af[_0x326d('0x3b')]]['linkedid']=_0x1499af['uniqueid'];if(_0x1499af['calleridnum']!=='xcally-motion-preview'){this['channels'][_0x1499af[_0x326d('0x3b')]][_0x326d('0x68')]=_0x1499af['calleridnum'];}this[_0x326d('0x1a')][_0x1499af['linkedid']][_0x326d('0x69')]=_0x1499af['calleridname'];this['channels'][_0x1499af[_0x326d('0x3b')]][_0x326d('0x6a')]=_0x1499af[_0x326d('0x41')];this[_0x326d('0x1a')][_0x1499af[_0x326d('0x3b')]]['disposition']=dispositions[_[_0x326d('0x49')](_0x1499af[_0x326d('0x4a')])];if(this['agents'][_0x1499af[_0x326d('0x41')]['split']('-')[0x0]]){this[_0x326d('0x1a')][_0x1499af['linkedid']]['UserId']=this[_0x326d('0x1b')][_0x1499af[_0x326d('0x41')][_0x326d('0x4d')]('-')[0x0]]['id'];this[_0x326d('0x1a')][_0x1499af[_0x326d('0x3b')]]['membername']=this[_0x326d('0x1b')][_0x1499af[_0x326d('0x41')][_0x326d('0x4d')]('-')[0x0]][_0x326d('0x50')];}}}}else{if(this['channels'][_0x1499af[_0x326d('0x37')]]){if(_0x1499af[_0x326d('0x4a')]==='6'){if(this[_0x326d('0x1b')][_0x1499af[_0x326d('0x41')][_0x326d('0x4d')]('-')[0x0]]){this['channels'][_0x1499af[_0x326d('0x37')]][_0x326d('0x6b')]=this['agents'][_0x1499af['channel'][_0x326d('0x4d')]('-')[0x0]]['id'];this[_0x326d('0x1a')][_0x1499af['uniqueid']][_0x326d('0x6c')]=this[_0x326d('0x1b')][_0x1499af['channel']['split']('-')[0x0]][_0x326d('0x50')];}}}}}}catch(_0x294191){logger[_0x326d('0x2e')](_0x326d('0x6d'),_0x1499af['uniqueid'],util[_0x326d('0x30')](_0x294191,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x326d('0x33')][_0x326d('0x6e')]=function(_0x490165,_0x44a707){try{if(this[_0x326d('0x1a')][_0x490165]){logger[_0x326d('0x2c')](_0x326d('0x6f'),_0x490165,_0x44a707);this[_0x326d('0x1a')][_0x490165]['monitor']=!![];if(_[_0x326d('0x70')](_0x44a707,'.wav49')){_0x44a707=_0x44a707[_0x326d('0x71')](_0x326d('0x72'),_0x326d('0x73'));}this[_0x326d('0x1a')][_0x490165][_0x326d('0x74')]=_0x44a707;var _0x12fb24=_['find'](this['channels'][_0x490165][_0x326d('0x75')],{'filename':_0x44a707});if(_['isNil'](_0x12fb24)){this[_0x326d('0x1a')][_0x490165][_0x326d('0x75')][_0x326d('0x76')]({'filename':_0x44a707,'createdAt':moment()[_0x326d('0x46')](_0x326d('0x47')),'mixmonitorid':'','status':_0x326d('0x77')});}}}catch(_0x1b7db){logger[_0x326d('0x2e')](_0x326d('0x78'),_0x490165,util[_0x326d('0x30')](_0x1b7db,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x326d('0x33')][_0x326d('0x22')]=function(_0xfff5c5){try{if(this['isNotNull'](_0xfff5c5)){logger['debug'](_0x326d('0x79'),_0xfff5c5[_0x326d('0x37')],util['inspect'](_0xfff5c5,{'showHidden':![],'depth':null}));if(this[_0x326d('0x1a')][_0xfff5c5[_0x326d('0x37')]]&&_0xfff5c5['channel']!=_0x326d('0x42')){if(this[_0x326d('0x31')](_0xfff5c5[_0x326d('0x7a')])){if(this['isNotNull'](_0xfff5c5[_0x326d('0x7a')][_0x326d('0x7b')])){logger[_0x326d('0x2c')](_0x326d('0x7c'),_0xfff5c5[_0x326d('0x37')],_0xfff5c5[_0x326d('0x7d')]);this[_0x326d('0x6e')](_0xfff5c5[_0x326d('0x37')],_0xfff5c5[_0x326d('0x7d')]);}else if(this['isNotNull'](_0xfff5c5['variable']['xmd-phone'])){logger[_0x326d('0x2c')](_0x326d('0x7e'),_0xfff5c5[_0x326d('0x37')],_0xfff5c5[_0x326d('0x7d')]);this[_0x326d('0x1a')][_0xfff5c5['uniqueid']]['calleridnum']=_0xfff5c5[_0x326d('0x7d')];}else if(this[_0x326d('0x31')](_0xfff5c5[_0x326d('0x7a')]['xmd-callerid'])){logger[_0x326d('0x2c')](_0x326d('0x7f'),_0xfff5c5[_0x326d('0x37')],_0xfff5c5[_0x326d('0x7d')]);this['channels'][_0xfff5c5['uniqueid']]['callerid']=_0xfff5c5[_0x326d('0x7d')];}else if(this[_0x326d('0x31')](_0xfff5c5['variable'][_0x326d('0x80')])){logger[_0x326d('0x2c')](_0x326d('0x81'),_0xfff5c5[_0x326d('0x37')],_0xfff5c5[_0x326d('0x7d')]);this[_0x326d('0x1a')][_0xfff5c5[_0x326d('0x37')]]['type']=_0xfff5c5['value'];}else if(this[_0x326d('0x31')](_0xfff5c5['variable']['xmd-queue'])){logger[_0x326d('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0xfff5c5[_0x326d('0x37')],_0xfff5c5['value'][_0x326d('0x4d')](',')[0x0]);this['channels'][_0xfff5c5[_0x326d('0x37')]][_0x326d('0x5f')]=_0xfff5c5[_0x326d('0x7d')][_0x326d('0x4d')](',')[0x0];}else if(this[_0x326d('0x31')](_0xfff5c5[_0x326d('0x7a')][_0x326d('0x82')])){logger[_0x326d('0x2c')](_0x326d('0x83'),_0xfff5c5[_0x326d('0x37')],_0xfff5c5[_0x326d('0x7d')]);this[_0x326d('0x1a')][_0xfff5c5[_0x326d('0x37')]][_0x326d('0x84')]=_0xfff5c5[_0x326d('0x7d')];}else if(this[_0x326d('0x31')](_0xfff5c5[_0x326d('0x7a')][_0x326d('0x85')])){logger[_0x326d('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0xfff5c5[_0x326d('0x37')],_0xfff5c5[_0x326d('0x7d')]);this[_0x326d('0x1a')][_0xfff5c5[_0x326d('0x37')]][_0x326d('0x86')]=_0xfff5c5[_0x326d('0x7d')];}else if(this['isNotNull'](_0xfff5c5[_0x326d('0x7a')][_0x326d('0x87')])){logger[_0x326d('0x2c')](_0x326d('0x88'),_0xfff5c5[_0x326d('0x37')],_0xfff5c5[_0x326d('0x7d')]);this['channels'][_0xfff5c5[_0x326d('0x37')]]['calleridpreview']=_0xfff5c5[_0x326d('0x7d')];}else if(this[_0x326d('0x31')](_0xfff5c5['variable'][_0x326d('0x89')])){logger[_0x326d('0x2c')](_0x326d('0x8a'),_0xfff5c5['uniqueid'],_0xfff5c5[_0x326d('0x7d')]);this[_0x326d('0x1a')][_0xfff5c5[_0x326d('0x37')]]['queue']=_0xfff5c5[_0x326d('0x7d')];}else if(this[_0x326d('0x31')](_0xfff5c5[_0x326d('0x7a')][_0x326d('0x8b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0xfff5c5[_0x326d('0x37')],_0xfff5c5[_0x326d('0x7d')]);this[_0x326d('0x1a')][_0xfff5c5['uniqueid']][_0x326d('0x8c')]=_0xfff5c5[_0x326d('0x7d')];}}}else if(this[_0x326d('0x31')](_0xfff5c5[_0x326d('0x7a')][_0x326d('0x7b')])){if(_0xfff5c5[_0x326d('0x7d')]){var _0x2c9e82=path['parse'](_0xfff5c5[_0x326d('0x7d')])['name'];logger[_0x326d('0x2c')](_0x326d('0x7c'),_0x2c9e82,_0xfff5c5[_0x326d('0x7d')]);this['syncMixMonitorFilename'](_0x2c9e82,_0xfff5c5['value']);}}else if(this[_0x326d('0x1a')][_0xfff5c5[_0x326d('0x3b')]]){if(this[_0x326d('0x31')](_0xfff5c5[_0x326d('0x7a')])){if(this[_0x326d('0x31')](_0xfff5c5[_0x326d('0x7a')][_0x326d('0x8b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0xfff5c5[_0x326d('0x3b')],_0xfff5c5[_0x326d('0x7d')]);this['channels'][_0xfff5c5['linkedid']][_0x326d('0x8d')]=_0xfff5c5[_0x326d('0x7d')];}}}}}catch(_0x47735a){logger[_0x326d('0x2e')]('[%s][voiceCallReport][varset]',_0xfff5c5[_0x326d('0x37')],util['inspect'](_0x47735a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x326d('0x33')][_0x326d('0x24')]=function(_0x140db2){try{if(this[_0x326d('0x31')](_0x140db2)){logger[_0x326d('0x39')]('[%s][voiceCallReport][hangup]\x20event:',_0x140db2[_0x326d('0x37')],util[_0x326d('0x30')](_0x140db2,{'showHidden':![],'depth':null}));if(this['channels'][_0x140db2[_0x326d('0x37')]]){logger[_0x326d('0x2c')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x140db2[_0x326d('0x37')],_0x140db2[_0x326d('0x8e')]);var _0x1ab4e7=moment();this[_0x326d('0x1a')][_0x140db2[_0x326d('0x37')]][_0x326d('0x8f')]=_0x1ab4e7[_0x326d('0x46')](_0x326d('0x47'));this[_0x326d('0x1a')][_0x140db2[_0x326d('0x37')]][_0x326d('0x59')]=_0x1ab4e7[_0x326d('0x90')](this[_0x326d('0x1a')][_0x140db2[_0x326d('0x37')]][_0x326d('0x58')],'seconds');if(this[_0x326d('0x1a')][_0x140db2['uniqueid']][_0x326d('0x64')]){this[_0x326d('0x1a')][_0x140db2['uniqueid']][_0x326d('0x91')]=_0x1ab4e7[_0x326d('0x90')](this['channels'][_0x140db2['uniqueid']][_0x326d('0x65')],_0x326d('0x67'));this[_0x326d('0x1a')][_0x140db2[_0x326d('0x37')]][_0x326d('0x66')]=this['channels'][_0x140db2[_0x326d('0x37')]][_0x326d('0x59')]-this[_0x326d('0x1a')][_0x140db2[_0x326d('0x37')]][_0x326d('0x91')];}if(_0x140db2[_0x326d('0x44')]===_0x326d('0x4b')){if(this[_0x326d('0x1b')][_0x140db2[_0x326d('0x41')][_0x326d('0x4d')]('-')[0x0]]){this[_0x326d('0x1b')][_0x140db2[_0x326d('0x41')][_0x326d('0x4d')]('-')[0x0]]=_[_0x326d('0x92')](this[_0x326d('0x1b')][_0x140db2[_0x326d('0x41')][_0x326d('0x4d')]('-')[0x0]],[_0x326d('0x93')]);logger['debug'](_0x326d('0x94'),_0x140db2[_0x326d('0x37')],util['inspect']({'destaccountcode':this[_0x326d('0x1b')][_0x140db2[_0x326d('0x41')][_0x326d('0x4d')]('-')[0x0]][_0x326d('0x4e')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x326d('0x46')](_0x326d('0x4f'),this[_0x326d('0x1b')][_0x140db2[_0x326d('0x41')][_0x326d('0x4d')]('-')[0x0]][_0x326d('0x50')]),_0x326d('0x95'),{'destaccountcode':this[_0x326d('0x1b')][_0x140db2['channel'][_0x326d('0x4d')]('-')[0x0]]['accountcode']});}}if(_0x140db2[_0x326d('0x96')]===_0x326d('0x97')){this['blindTransfers'][_0x140db2['uniqueid']]=this[_0x326d('0x1a')][_0x140db2[_0x326d('0x37')]];}else{if(this[_0x326d('0x1a')][_0x140db2[_0x326d('0x37')]][_0x326d('0x98')]===_0x326d('0x99')&&this[_0x326d('0x1c')][_0x140db2[_0x326d('0x37')]]){this[_0x326d('0x1a')][_0x140db2[_0x326d('0x37')]][_0x326d('0x37')]=[this['channels'][_0x140db2[_0x326d('0x37')]][_0x326d('0x3b')],this[_0x326d('0x1a')][_0x140db2['uniqueid']]['linkedid']=this['channels'][_0x140db2[_0x326d('0x37')]][_0x326d('0x37')]][0x0];delete this[_0x326d('0x1c')][_0x140db2['uniqueid']];}}logger[_0x326d('0x39')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x140db2[_0x326d('0x37')],util[_0x326d('0x30')](this['channels'][_0x140db2['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x326d('0x34')](_0x326d('0x9a'),this['channels'][_0x140db2[_0x326d('0x37')]]);delete this[_0x326d('0x1a')][_0x140db2[_0x326d('0x37')]];}}}catch(_0x2a494e){logger[_0x326d('0x2e')](_0x326d('0x9b'),_0x140db2[_0x326d('0x37')],util[_0x326d('0x30')](_0x2a494e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x326d('0x33')][_0x326d('0x27')]=function(_0x30c528){try{if(this[_0x326d('0x31')](_0x30c528)){logger['info'](_0x326d('0x9c'),_0x30c528[_0x326d('0x37')],_0x30c528[_0x326d('0x9d')],_0x30c528[_0x326d('0x9e')]);logger['debug'](_0x326d('0x9f'),_0x30c528['uniqueid'],util[_0x326d('0x30')](_0x30c528,{'showHidden':![],'depth':null}));if(this[_0x326d('0x1a')][_0x30c528[_0x326d('0xa0')]]){this[_0x326d('0x1a')][_0x30c528['transfereeuniqueid']][_0x326d('0xa1')]=_0x30c528['origtransferercalleridnum'];this[_0x326d('0x1a')][_0x30c528[_0x326d('0xa0')]][_0x326d('0xa2')]=_0x30c528[_0x326d('0x9e')];if(this[_0x326d('0x1a')][_0x30c528[_0x326d('0xa3')]]){var _0x46a535=this[_0x326d('0x1a')][_0x30c528[_0x326d('0xa3')]];this[_0x326d('0x1a')][_0x30c528['secondtransfereruniqueid']]=this[_0x326d('0x1a')][_0x30c528['transfereeuniqueid']];this[_0x326d('0x1a')][_0x30c528['transfereeuniqueid']]=_0x46a535;}}else if(this['channels'][_0x30c528[_0x326d('0xa4')]]){this['channels'][_0x30c528[_0x326d('0xa4')]][_0x326d('0xa1')]=_0x30c528[_0x326d('0x9d')];this['channels'][_0x30c528[_0x326d('0xa4')]][_0x326d('0xa2')]=_0x30c528[_0x326d('0x9e')];if(this[_0x326d('0x1a')][_0x30c528[_0x326d('0xa5')]]){var _0x46a535=this[_0x326d('0x1a')][_0x30c528[_0x326d('0xa5')]];this[_0x326d('0x1a')][_0x30c528[_0x326d('0xa5')]]=this['channels'][_0x30c528[_0x326d('0xa4')]];this[_0x326d('0x1a')][_0x30c528[_0x326d('0xa4')]]=_0x46a535;}}}}catch(_0x3a31e5){logger[_0x326d('0x2e')](_0x326d('0xa6'),_0x30c528[_0x326d('0x37')],util[_0x326d('0x30')](_0x3a31e5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x326d('0x33')]['syncBlindTransfer']=function(_0x933e60){try{if(this[_0x326d('0x31')](_0x933e60)){logger[_0x326d('0x2c')](_0x326d('0xa7'),_0x933e60['uniqueid'],_0x933e60[_0x326d('0xa8')],_0x933e60[_0x326d('0xa9')]);logger['debug'](_0x326d('0xaa'),_0x933e60[_0x326d('0x37')],util[_0x326d('0x30')](_0x933e60,{'showHidden':![],'depth':null}));if(this['channels'][_0x933e60[_0x326d('0xa0')]]){this[_0x326d('0x1a')][_0x933e60[_0x326d('0xa0')]]['transfercalleridnum']=_0x933e60[_0x326d('0xa8')];this[_0x326d('0x1a')][_0x933e60['transfereeuniqueid']][_0x326d('0xa2')]=_0x933e60[_0x326d('0xa9')];this[_0x326d('0x24')]({'event':_0x326d('0x97'),'uniqueid':_0x933e60[_0x326d('0xa0')],'context':_0x933e60[_0x326d('0x44')],'channel':_0x933e60[_0x326d('0xab')]});}}}catch(_0x482fda){logger[_0x326d('0x2e')](_0x326d('0xac'),_0x933e60[_0x326d('0x37')],util[_0x326d('0x30')](_0x482fda,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x326d('0x33')][_0x326d('0xad')]=function(_0x46407d){try{if(this[_0x326d('0x31')](_0x46407d)){logger[_0x326d('0x39')](_0x326d('0xae'),_0x46407d[_0x326d('0x37')],util[_0x326d('0x30')](_0x46407d,{'showHidden':![],'depth':null}));if(this[_0x326d('0x1a')][_0x46407d[_0x326d('0x37')]]){if(!_['isNil'](this[_0x326d('0x1a')][_0x46407d[_0x326d('0x37')]][_0x326d('0x65')])){this[_0x326d('0x1a')][_0x46407d['uniqueid']][_0x326d('0xaf')]=moment()[_0x326d('0x46')](_0x326d('0x47'));logger[_0x326d('0x2c')](_0x326d('0xb0'),_0x46407d[_0x326d('0x37')],this[_0x326d('0x1a')][_0x46407d['uniqueid']]['mohstarttime']);}}}}catch(_0x287ff8){logger[_0x326d('0x2e')](_0x326d('0xb1'),_0x46407d[_0x326d('0x37')],util['inspect'](_0x287ff8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x326d('0xb2')]=function(_0x46d3db){try{if(this[_0x326d('0x31')](_0x46d3db)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x46d3db['uniqueid'],util['inspect'](_0x46d3db,{'showHidden':![],'depth':null}));if(this[_0x326d('0x1a')][_0x46d3db[_0x326d('0x37')]]){if(!_[_0x326d('0xb3')](this[_0x326d('0x1a')][_0x46d3db[_0x326d('0x37')]][_0x326d('0xaf')])){this[_0x326d('0x1a')][_0x46d3db['uniqueid']][_0x326d('0xb4')]+=moment()[_0x326d('0xb5')](0x0)[_0x326d('0x90')](this[_0x326d('0x1a')][_0x46d3db[_0x326d('0x37')]][_0x326d('0xaf')],'seconds');logger[_0x326d('0x2c')](_0x326d('0xb6'),_0x46d3db['uniqueid'],this[_0x326d('0x1a')][_0x46d3db[_0x326d('0x37')]][_0x326d('0xb4')]);delete this['channels'][_0x46d3db[_0x326d('0x37')]][_0x326d('0xaf')];}}}}catch(_0x5d3775){logger[_0x326d('0x2e')](_0x326d('0xb7'),_0x46d3db[_0x326d('0x37')],util['inspect'](_0x5d3775,{'showHidden':![],'depth':null}));}};module[_0x326d('0xb8')]=VoiceCallReport; \ No newline at end of file +var _0xfab3=['[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BlindTransfer','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ami','../ami','../model/channel','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','defaults','localhost','socket.io-emitter','agents','blindTransfers','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','channels','pick','keys','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','disposition','toNumber','channelstate','from-sip','split','destconnectedlinenum','exten','accountcode','format','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','startsWith','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','find','monitors','isNil','push','rec','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','xmd-cdrtype','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','answertime','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:%s','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfereeuniqueid','transfertargetuniqueid','origtransfereruniqueid'];(function(_0x146778,_0x52b117){var _0x189913=function(_0x2918cd){while(--_0x2918cd){_0x146778['push'](_0x146778['shift']());}};_0x189913(++_0x52b117);}(_0xfab3,0xc7));var _0x3fab=function(_0x49fe8d,_0x44ab0f){_0x49fe8d=_0x49fe8d-0x0;var _0x23e887=_0xfab3[_0x49fe8d];return _0x23e887;};'use strict';var BPromise=require('bluebird');var _=require(_0x3fab('0x0'));var moment=require(_0x3fab('0x1'));var util=require(_0x3fab('0x2'));var path=require(_0x3fab('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x3fab('0x4'));var ami=require(_0x3fab('0x5'));var Channel=require(_0x3fab('0x6'));var statusDesc=[_0x3fab('0x7'),'not_inuse',_0x3fab('0x8'),_0x3fab('0x9'),_0x3fab('0xa'),_0x3fab('0xb'),_0x3fab('0xc'),_0x3fab('0xd'),_0x3fab('0xe')];var applications=[_0x3fab('0xf'),_0x3fab('0x10'),_0x3fab('0x11'),'dial','playback',_0x3fab('0x12')];var dispositions=['NO\x20ANSWER',_0x3fab('0x13'),_0x3fab('0x13'),_0x3fab('0x14'),_0x3fab('0x14'),'NO\x20ANSWER','ANSWERED',_0x3fab('0x15'),'FAILED',_0x3fab('0x13'),_0x3fab('0x13')];var actions={};config[_0x3fab('0x16')]=_[_0x3fab('0x17')](config[_0x3fab('0x16')],{'host':_0x3fab('0x18'),'port':0x18eb});var io=require(_0x3fab('0x19'))(new Redis(config[_0x3fab('0x16')]));function VoiceCallReport(_0x3df091){this['channels']=_0x3df091['channels'];this[_0x3fab('0x1a')]=_0x3df091[_0x3fab('0x1a')];this[_0x3fab('0x1b')]={};ami['on'](_0x3fab('0x1c'),this[_0x3fab('0x1d')][_0x3fab('0x1e')](this));ami['on'](_0x3fab('0x1f'),this[_0x3fab('0x1d')]['bind'](this));ami['on'](_0x3fab('0x20'),this[_0x3fab('0x21')][_0x3fab('0x1e')](this));ami['on'](_0x3fab('0x22'),this[_0x3fab('0x23')][_0x3fab('0x1e')](this));ami['on'](_0x3fab('0x24'),this[_0x3fab('0x25')][_0x3fab('0x1e')](this));ami['on'](_0x3fab('0x26'),this[_0x3fab('0x27')]['bind'](this));ami['on'](_0x3fab('0x28'),this['syncNewCallerId'][_0x3fab('0x1e')](this));ami['on'](_0x3fab('0x29'),this[_0x3fab('0x2a')][_0x3fab('0x1e')](this));ami['on'](_0x3fab('0x2b'),this[_0x3fab('0x2c')][_0x3fab('0x1e')](this));ami['on'](_0x3fab('0x2d'),this[_0x3fab('0x2e')][_0x3fab('0x1e')](this));ami['on'](_0x3fab('0x2f'),this[_0x3fab('0x30')][_0x3fab('0x1e')](this));try{logger[_0x3fab('0x31')](_0x3fab('0x32'));ami[_0x3fab('0x33')]();}catch(_0x41856f){logger[_0x3fab('0x34')](_0x3fab('0x35'),util[_0x3fab('0x36')](_0x41856f,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x3fab('0x37')]['isNotNull']=function(_0x13c5a5){return _0x13c5a5!==null&&!_[_0x3fab('0x38')](_0x13c5a5);};VoiceCallReport[_0x3fab('0x37')][_0x3fab('0x39')]=function(_0xc9bb1c,_0x10f19c,_0xc5b317){io['to'](_0xc9bb1c)['emit'](_0x10f19c,_0xc5b317);};VoiceCallReport[_0x3fab('0x37')]['syncNewCallerId']=function(_0x4899ad){try{if(this['isNotNull'](_0x4899ad)){logger[_0x3fab('0x31')](_0x3fab('0x3a'),_0x4899ad[_0x3fab('0x3b')],_0x4899ad[_0x3fab('0x3c')],_0x4899ad[_0x3fab('0x3d')]);logger[_0x3fab('0x3e')](_0x3fab('0x3f'),_0x4899ad[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x4899ad,{'showHidden':![],'depth':null}));if(_0x4899ad['uniqueid']===_0x4899ad[_0x3fab('0x40')]){if(!_[_0x3fab('0x38')](this['channels'][_0x4899ad[_0x3fab('0x3b')]])){_[_0x3fab('0x41')](this[_0x3fab('0x42')][_0x4899ad[_0x3fab('0x3b')]],_[_0x3fab('0x43')](_0x4899ad,_[_0x3fab('0x44')](this[_0x3fab('0x42')][_0x4899ad[_0x3fab('0x3b')]])));}}}}catch(_0x2e93ae){logger[_0x3fab('0x34')]('[%s][voiceCallReport][newcallerid]',_0x4899ad[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x2e93ae,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fab('0x37')][_0x3fab('0x21')]=function(_0x49586e){try{if(this[_0x3fab('0x45')](_0x49586e)){logger['debug'](_0x3fab('0x46'),_0x49586e[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x49586e,{'showHidden':![],'depth':null}));if(_0x49586e[_0x3fab('0x3b')]===_0x49586e['linkedid']&&_0x49586e[_0x3fab('0x47')]!=_0x3fab('0x48')){if(_[_0x3fab('0x38')](this[_0x3fab('0x42')][_0x49586e[_0x3fab('0x3b')]])){logger[_0x3fab('0x31')](_0x3fab('0x49'),_0x49586e[_0x3fab('0x3b')],_0x49586e[_0x3fab('0x4a')],_0x49586e['exten']);this[_0x3fab('0x42')][_0x49586e[_0x3fab('0x3b')]]=new Channel();this[_0x3fab('0x42')][_0x49586e['uniqueid']]['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3fab('0x42')][_0x49586e[_0x3fab('0x3b')]][_0x3fab('0x4b')]=dispositions[_[_0x3fab('0x4c')](_0x49586e[_0x3fab('0x4d')])];_[_0x3fab('0x41')](this[_0x3fab('0x42')][_0x49586e[_0x3fab('0x3b')]],_['pick'](_0x49586e,_[_0x3fab('0x44')](this[_0x3fab('0x42')][_0x49586e[_0x3fab('0x3b')]])));if(_0x49586e[_0x3fab('0x4a')]===_0x3fab('0x4e')){if(this['agents'][_0x49586e['channel'][_0x3fab('0x4f')]('-')[0x0]]){this['agents'][_0x49586e[_0x3fab('0x47')][_0x3fab('0x4f')]('-')[0x0]][_0x3fab('0x50')]=_0x49586e[_0x3fab('0x51')];logger[_0x3fab('0x3e')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x49586e[_0x3fab('0x3b')],util['inspect']({'destaccountcode':this[_0x3fab('0x1a')][_0x49586e[_0x3fab('0x47')]['split']('-')[0x0]][_0x3fab('0x52')],'destconnectedlinenum':_0x49586e[_0x3fab('0x51')]},{'showHidden':![],'depth':null}));this[_0x3fab('0x39')](util[_0x3fab('0x53')]('user:%s',this['agents'][_0x49586e[_0x3fab('0x47')]['split']('-')[0x0]][_0x3fab('0x54')]),_0x3fab('0x55'),{'destaccountcode':this['agents'][_0x49586e['channel'][_0x3fab('0x4f')]('-')[0x0]][_0x3fab('0x52')],'destconnectedlinenum':_0x49586e[_0x3fab('0x51')]});}}}}}}catch(_0xdb8edb){logger['error']('[%s][voiceCallReport][newchannel]',_0x49586e[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0xdb8edb,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3fab('0x1d')]=function(_0x2d4ffd){try{if(this[_0x3fab('0x45')](_0x2d4ffd)){logger[_0x3fab('0x3e')](_0x3fab('0x56'),_0x2d4ffd['uniqueid'],util[_0x3fab('0x36')](_0x2d4ffd,{'showHidden':![],'depth':null}));if(_0x2d4ffd[_0x3fab('0x3b')]===_0x2d4ffd[_0x3fab('0x40')]&&_0x2d4ffd[_0x3fab('0x51')]!='h'&&_0x2d4ffd[_0x3fab('0x47')]!=_0x3fab('0x48')){_0x2d4ffd[_0x3fab('0x57')]=_0x2d4ffd['application'][_0x3fab('0x58')]();_0x2d4ffd[_0x3fab('0x59')]=(_0x2d4ffd[_0x3fab('0x5a')]||_0x2d4ffd[_0x3fab('0x59')])[_0x3fab('0x58')]();logger[_0x3fab('0x31')](_0x3fab('0x5b'),_0x2d4ffd[_0x3fab('0x3b')],_0x2d4ffd[_0x3fab('0x57')],_0x2d4ffd[_0x3fab('0x59')]);if(_[_0x3fab('0x38')](this[_0x3fab('0x42')][_0x2d4ffd[_0x3fab('0x3b')]])){this['channels'][_0x2d4ffd[_0x3fab('0x3b')]]=new Channel();this[_0x3fab('0x42')][_0x2d4ffd[_0x3fab('0x3b')]][_0x3fab('0x5c')]=_0x2d4ffd[_0x3fab('0x5d')]?moment()[_0x3fab('0x5e')](moment[_0x3fab('0x5d')](_0x2d4ffd[_0x3fab('0x5d')])['seconds'](),_0x3fab('0x5f'))[_0x3fab('0x53')](_0x3fab('0x60')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3fab('0x42')][_0x2d4ffd[_0x3fab('0x3b')]]['disposition']=_0x3fab('0x14');}_[_0x3fab('0x41')](this[_0x3fab('0x42')][_0x2d4ffd['uniqueid']],_[_0x3fab('0x43')](_0x2d4ffd,_[_0x3fab('0x44')](this[_0x3fab('0x42')][_0x2d4ffd[_0x3fab('0x3b')]])));if(_[_0x3fab('0x61')](applications,_0x2d4ffd[_0x3fab('0x57')])){this[_0x3fab('0x42')][_0x2d4ffd[_0x3fab('0x3b')]][_0x3fab('0x62')]=_0x2d4ffd[_0x3fab('0x57')];this[_0x3fab('0x42')][_0x2d4ffd[_0x3fab('0x3b')]][_0x3fab('0x63')]=_0x2d4ffd[_0x3fab('0x59')];if(_0x2d4ffd[_0x3fab('0x57')]===_0x3fab('0xf')&&_[_0x3fab('0x64')](_0x2d4ffd[_0x3fab('0x59')],_0x3fab('0x65'))){var _0xfc4487=_0x2d4ffd['applicationdata'][_0x3fab('0x4f')]('=');var _0x1a9285=_0xfc4487[0x0]['match'](/cdr\((.*)\)/);if(_0x1a9285){this[_0x3fab('0x42')][_0x2d4ffd[_0x3fab('0x3b')]][_0x1a9285[0x1]]=_0xfc4487[0x1];}}else if(_0x2d4ffd[_0x3fab('0x57')]===_0x3fab('0x10')){this[_0x3fab('0x42')][_0x2d4ffd[_0x3fab('0x3b')]][_0x3fab('0x10')]=_0x2d4ffd[_0x3fab('0x59')]['split'](',')[0x0];}}}}}catch(_0x588974){logger[_0x3fab('0x34')](_0x3fab('0x66'),_0x2d4ffd['uniqueid'],util[_0x3fab('0x36')](_0x588974,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fab('0x37')]['syncNewState']=function(_0x4ab33d){try{if(this[_0x3fab('0x45')](_0x4ab33d)){logger[_0x3fab('0x31')](_0x3fab('0x67'),_0x4ab33d['uniqueid'],_0x4ab33d[_0x3fab('0x40')],_0x4ab33d[_0x3fab('0x3c')],_0x4ab33d[_0x3fab('0x3d')]);logger[_0x3fab('0x3e')](_0x3fab('0x68'),_0x4ab33d[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x4ab33d,{'showHidden':![],'depth':null}));if(_0x4ab33d[_0x3fab('0x3b')]!==_0x4ab33d[_0x3fab('0x40')]){if(this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x40')]]){if(_0x4ab33d[_0x3fab('0x4d')]==='6'){if(!this['channels'][_0x4ab33d[_0x3fab('0x40')]][_0x3fab('0x69')]){var _0x15a4e3=moment();this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x40')]][_0x3fab('0x69')]=!![];this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x40')]]['answertime']=_0x15a4e3['format'](_0x3fab('0x60'));if(this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x40')]]['starttime']){this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x40')]][_0x3fab('0x6a')]=_0x15a4e3[_0x3fab('0x6b')](this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x40')]]['starttime'],_0x3fab('0x5f'));}}this[_0x3fab('0x42')][_0x4ab33d['linkedid']][_0x3fab('0x40')]=_0x4ab33d['uniqueid'];if(_0x4ab33d[_0x3fab('0x3d')]!==_0x3fab('0x6c')){this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x40')]]['connectedlinenum']=_0x4ab33d[_0x3fab('0x3d')];}this[_0x3fab('0x42')][_0x4ab33d['linkedid']][_0x3fab('0x6d')]=_0x4ab33d[_0x3fab('0x3c')];this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x40')]][_0x3fab('0x6e')]=_0x4ab33d['channel'];this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x40')]][_0x3fab('0x4b')]=dispositions[_[_0x3fab('0x4c')](_0x4ab33d['channelstate'])];if(this[_0x3fab('0x1a')][_0x4ab33d[_0x3fab('0x47')]['split']('-')[0x0]]){this['channels'][_0x4ab33d[_0x3fab('0x40')]]['UserId']=this[_0x3fab('0x1a')][_0x4ab33d['channel'][_0x3fab('0x4f')]('-')[0x0]]['id'];this[_0x3fab('0x42')][_0x4ab33d['linkedid']][_0x3fab('0x6f')]=this['agents'][_0x4ab33d[_0x3fab('0x47')]['split']('-')[0x0]]['name'];}}}}else{if(this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x3b')]]){if(_0x4ab33d[_0x3fab('0x4d')]==='6'){if(this['agents'][_0x4ab33d[_0x3fab('0x47')][_0x3fab('0x4f')]('-')[0x0]]){this[_0x3fab('0x42')][_0x4ab33d['uniqueid']]['UserId']=this['agents'][_0x4ab33d['channel']['split']('-')[0x0]]['id'];this[_0x3fab('0x42')][_0x4ab33d[_0x3fab('0x3b')]][_0x3fab('0x6f')]=this[_0x3fab('0x1a')][_0x4ab33d[_0x3fab('0x47')][_0x3fab('0x4f')]('-')[0x0]]['name'];}}}}}}catch(_0x56673b){logger['error'](_0x3fab('0x70'),_0x4ab33d[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x56673b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fab('0x37')][_0x3fab('0x71')]=function(_0x116b5d,_0x1d48e3){try{if(this[_0x3fab('0x42')][_0x116b5d]){logger['info'](_0x3fab('0x72'),_0x116b5d,_0x1d48e3);this['channels'][_0x116b5d][_0x3fab('0x73')]=!![];if(_['endsWith'](_0x1d48e3,_0x3fab('0x74'))){_0x1d48e3=_0x1d48e3[_0x3fab('0x75')](_0x3fab('0x74'),_0x3fab('0x76'));}this[_0x3fab('0x42')][_0x116b5d]['monitorFilename']=_0x1d48e3;var _0x3083b7=_[_0x3fab('0x77')](this['channels'][_0x116b5d][_0x3fab('0x78')],{'filename':_0x1d48e3});if(_[_0x3fab('0x79')](_0x3083b7)){this['channels'][_0x116b5d]['monitors'][_0x3fab('0x7a')]({'filename':_0x1d48e3,'createdAt':moment()[_0x3fab('0x53')](_0x3fab('0x60')),'mixmonitorid':'','status':_0x3fab('0x7b')});}}}catch(_0x43bf37){logger[_0x3fab('0x34')]('[%s][voiceCallReport][mixMonitorFilename]',_0x116b5d,util[_0x3fab('0x36')](_0x43bf37,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fab('0x37')]['syncVarSet']=function(_0x4c8baf){try{if(this['isNotNull'](_0x4c8baf)){logger[_0x3fab('0x3e')]('[%s][voiceCallReport][varset]\x20event:',_0x4c8baf[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x4c8baf,{'showHidden':![],'depth':null}));if(this[_0x3fab('0x42')][_0x4c8baf[_0x3fab('0x3b')]]&&_0x4c8baf[_0x3fab('0x47')]!=_0x3fab('0x48')){if(this[_0x3fab('0x45')](_0x4c8baf[_0x3fab('0x7c')])){if(this[_0x3fab('0x45')](_0x4c8baf[_0x3fab('0x7c')][_0x3fab('0x7d')])){logger[_0x3fab('0x31')](_0x3fab('0x7e'),_0x4c8baf[_0x3fab('0x3b')],_0x4c8baf[_0x3fab('0x7f')]);this[_0x3fab('0x71')](_0x4c8baf[_0x3fab('0x3b')],_0x4c8baf[_0x3fab('0x7f')]);}else if(this['isNotNull'](_0x4c8baf['variable'][_0x3fab('0x80')])){logger[_0x3fab('0x31')](_0x3fab('0x81'),_0x4c8baf[_0x3fab('0x3b')],_0x4c8baf[_0x3fab('0x7f')]);this[_0x3fab('0x42')][_0x4c8baf[_0x3fab('0x3b')]][_0x3fab('0x3d')]=_0x4c8baf['value'];}else if(this[_0x3fab('0x45')](_0x4c8baf[_0x3fab('0x7c')][_0x3fab('0x82')])){logger[_0x3fab('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x4c8baf[_0x3fab('0x3b')],_0x4c8baf[_0x3fab('0x7f')]);this['channels'][_0x4c8baf[_0x3fab('0x3b')]]['callerid']=_0x4c8baf[_0x3fab('0x7f')];}else if(this[_0x3fab('0x45')](_0x4c8baf[_0x3fab('0x7c')][_0x3fab('0x83')])){logger[_0x3fab('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4c8baf[_0x3fab('0x3b')],_0x4c8baf['value']);this[_0x3fab('0x42')][_0x4c8baf['uniqueid']][_0x3fab('0x84')]=_0x4c8baf[_0x3fab('0x7f')];}else if(this[_0x3fab('0x45')](_0x4c8baf['variable'][_0x3fab('0x85')])){logger[_0x3fab('0x31')](_0x3fab('0x86'),_0x4c8baf['uniqueid'],_0x4c8baf[_0x3fab('0x7f')][_0x3fab('0x4f')](',')[0x0]);this[_0x3fab('0x42')][_0x4c8baf['uniqueid']][_0x3fab('0x10')]=_0x4c8baf[_0x3fab('0x7f')]['split'](',')[0x0];}else if(this[_0x3fab('0x45')](_0x4c8baf[_0x3fab('0x7c')][_0x3fab('0x87')])){logger[_0x3fab('0x31')](_0x3fab('0x88'),_0x4c8baf['uniqueid'],_0x4c8baf['value']);this['channels'][_0x4c8baf[_0x3fab('0x3b')]][_0x3fab('0x89')]=_0x4c8baf['value'];}else if(this['isNotNull'](_0x4c8baf[_0x3fab('0x7c')][_0x3fab('0x8a')])){logger['info'](_0x3fab('0x8b'),_0x4c8baf[_0x3fab('0x3b')],_0x4c8baf[_0x3fab('0x7f')]);this[_0x3fab('0x42')][_0x4c8baf[_0x3fab('0x3b')]]['destination']=_0x4c8baf[_0x3fab('0x7f')];}else if(this['isNotNull'](_0x4c8baf[_0x3fab('0x7c')][_0x3fab('0x8c')])){logger[_0x3fab('0x31')](_0x3fab('0x8d'),_0x4c8baf['uniqueid'],_0x4c8baf['value']);this[_0x3fab('0x42')][_0x4c8baf[_0x3fab('0x3b')]][_0x3fab('0x8e')]=_0x4c8baf[_0x3fab('0x7f')];}else if(this[_0x3fab('0x45')](_0x4c8baf['variable']['xmcs-queue'])){logger['info'](_0x3fab('0x8f'),_0x4c8baf[_0x3fab('0x3b')],_0x4c8baf['value']);this[_0x3fab('0x42')][_0x4c8baf[_0x3fab('0x3b')]][_0x3fab('0x10')]=_0x4c8baf[_0x3fab('0x7f')];}else if(this['isNotNull'](_0x4c8baf[_0x3fab('0x7c')]['sipcallid'])){logger[_0x3fab('0x31')](_0x3fab('0x90'),_0x4c8baf[_0x3fab('0x3b')],_0x4c8baf[_0x3fab('0x7f')]);this['channels'][_0x4c8baf[_0x3fab('0x3b')]][_0x3fab('0x91')]=_0x4c8baf[_0x3fab('0x7f')];}}}else if(this[_0x3fab('0x45')](_0x4c8baf[_0x3fab('0x7c')][_0x3fab('0x7d')])){if(_0x4c8baf[_0x3fab('0x7f')]){var _0x40ea50=path[_0x3fab('0x92')](_0x4c8baf['value'])[_0x3fab('0x54')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x40ea50,_0x4c8baf['value']);this['syncMixMonitorFilename'](_0x40ea50,_0x4c8baf[_0x3fab('0x7f')]);}}else if(this[_0x3fab('0x42')][_0x4c8baf[_0x3fab('0x40')]]){if(this['isNotNull'](_0x4c8baf[_0x3fab('0x7c')])){if(this[_0x3fab('0x45')](_0x4c8baf[_0x3fab('0x7c')][_0x3fab('0x93')])){logger[_0x3fab('0x31')](_0x3fab('0x90'),_0x4c8baf[_0x3fab('0x40')],_0x4c8baf[_0x3fab('0x7f')]);this['channels'][_0x4c8baf[_0x3fab('0x40')]][_0x3fab('0x94')]=_0x4c8baf[_0x3fab('0x7f')];}}}}}catch(_0xf4d49f){logger[_0x3fab('0x34')](_0x3fab('0x95'),_0x4c8baf[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0xf4d49f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fab('0x37')]['syncHangup']=function(_0x3fc6b0){try{if(this[_0x3fab('0x45')](_0x3fc6b0)){logger['debug'](_0x3fab('0x96'),_0x3fc6b0[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x3fc6b0,{'showHidden':![],'depth':null}));if(this['channels'][_0x3fc6b0[_0x3fab('0x3b')]]){logger['info'](_0x3fab('0x97'),_0x3fc6b0[_0x3fab('0x3b')],_0x3fc6b0['cause-txt']);var _0xaecf9f=moment();this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]]['endtime']=_0xaecf9f[_0x3fab('0x53')](_0x3fab('0x60'));this['channels'][_0x3fc6b0[_0x3fab('0x3b')]][_0x3fab('0x5d')]=_0xaecf9f['diff'](this['channels'][_0x3fc6b0['uniqueid']][_0x3fab('0x5c')],_0x3fab('0x5f'));if(this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]][_0x3fab('0x69')]){this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]]['billableseconds']=_0xaecf9f[_0x3fab('0x6b')](this['channels'][_0x3fc6b0['uniqueid']][_0x3fab('0x98')],_0x3fab('0x5f'));this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]]['holdtime']=this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]][_0x3fab('0x5d')]-this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]]['billableseconds'];}if(_0x3fc6b0[_0x3fab('0x4a')]===_0x3fab('0x4e')){if(this['agents'][_0x3fc6b0['channel'][_0x3fab('0x4f')]('-')[0x0]]){this[_0x3fab('0x1a')][_0x3fc6b0[_0x3fab('0x47')][_0x3fab('0x4f')]('-')[0x0]]=_['omit'](this['agents'][_0x3fc6b0[_0x3fab('0x47')]['split']('-')[0x0]],[_0x3fab('0x50')]);logger[_0x3fab('0x3e')](_0x3fab('0x99'),_0x3fc6b0[_0x3fab('0x3b')],util[_0x3fab('0x36')]({'destaccountcode':this[_0x3fab('0x1a')][_0x3fc6b0[_0x3fab('0x47')][_0x3fab('0x4f')]('-')[0x0]][_0x3fab('0x52')]},{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x3fab('0x9a'),this[_0x3fab('0x1a')][_0x3fc6b0[_0x3fab('0x47')][_0x3fab('0x4f')]('-')[0x0]][_0x3fab('0x54')]),'user:agentcomplete',{'destaccountcode':this['agents'][_0x3fc6b0[_0x3fab('0x47')][_0x3fab('0x4f')]('-')[0x0]]['accountcode']});}}if(_0x3fc6b0[_0x3fab('0x9b')]==='BlindTransfer'){this[_0x3fab('0x1b')][_0x3fc6b0['uniqueid']]=this[_0x3fab('0x42')][_0x3fc6b0['uniqueid']];}else{if(this['channels'][_0x3fc6b0[_0x3fab('0x3b')]][_0x3fab('0x84')]===_0x3fab('0x9c')&&this['blindTransfers'][_0x3fc6b0[_0x3fab('0x3b')]]){this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]][_0x3fab('0x3b')]=[this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]][_0x3fab('0x40')],this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]][_0x3fab('0x40')]=this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]][_0x3fab('0x3b')]][0x0];delete this['blindTransfers'][_0x3fc6b0['uniqueid']];}}logger[_0x3fab('0x3e')](_0x3fab('0x9d'),_0x3fc6b0[_0x3fab('0x3b')],util[_0x3fab('0x36')](this[_0x3fab('0x42')][_0x3fc6b0['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x3fab('0x39')](_0x3fab('0x9e'),this[_0x3fab('0x42')][_0x3fc6b0['uniqueid']]);delete this[_0x3fab('0x42')][_0x3fc6b0[_0x3fab('0x3b')]];}}}catch(_0x326a99){logger[_0x3fab('0x34')]('[%s][voiceCallReport][hangup]',_0x3fc6b0[_0x3fab('0x3b')],util['inspect'](_0x326a99,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x3fab('0x2a')]=function(_0x5969c5){try{if(this[_0x3fab('0x45')](_0x5969c5)){logger[_0x3fab('0x31')](_0x3fab('0x9f'),_0x5969c5[_0x3fab('0x3b')],_0x5969c5[_0x3fab('0xa0')],_0x5969c5[_0x3fab('0xa1')]);logger['debug'](_0x3fab('0xa2'),_0x5969c5[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x5969c5,{'showHidden':![],'depth':null}));if(this[_0x3fab('0x42')][_0x5969c5['transfereeuniqueid']]){this[_0x3fab('0x42')][_0x5969c5['transfereeuniqueid']][_0x3fab('0xa3')]=_0x5969c5[_0x3fab('0xa0')];this[_0x3fab('0x42')][_0x5969c5['transfereeuniqueid']][_0x3fab('0xa4')]=_0x5969c5['transfertargetcalleridnum'];if(this['channels'][_0x5969c5[_0x3fab('0xa5')]]){var _0x69e6ba=this['channels'][_0x5969c5[_0x3fab('0xa5')]];this[_0x3fab('0x42')][_0x5969c5[_0x3fab('0xa5')]]=this['channels'][_0x5969c5[_0x3fab('0xa6')]];this[_0x3fab('0x42')][_0x5969c5[_0x3fab('0xa6')]]=_0x69e6ba;}}else if(this[_0x3fab('0x42')][_0x5969c5[_0x3fab('0xa7')]]){this[_0x3fab('0x42')][_0x5969c5[_0x3fab('0xa7')]][_0x3fab('0xa3')]=_0x5969c5[_0x3fab('0xa0')];this[_0x3fab('0x42')][_0x5969c5[_0x3fab('0xa7')]][_0x3fab('0xa4')]=_0x5969c5[_0x3fab('0xa1')];if(this[_0x3fab('0x42')][_0x5969c5[_0x3fab('0xa8')]]){var _0x69e6ba=this[_0x3fab('0x42')][_0x5969c5[_0x3fab('0xa8')]];this[_0x3fab('0x42')][_0x5969c5['origtransfereruniqueid']]=this['channels'][_0x5969c5['transfertargetuniqueid']];this[_0x3fab('0x42')][_0x5969c5[_0x3fab('0xa7')]]=_0x69e6ba;}}}}catch(_0x3d354f){logger['error'](_0x3fab('0xa9'),_0x5969c5['uniqueid'],util[_0x3fab('0x36')](_0x3d354f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fab('0x37')][_0x3fab('0x2c')]=function(_0x17be18){try{if(this[_0x3fab('0x45')](_0x17be18)){logger[_0x3fab('0x31')](_0x3fab('0xaa'),_0x17be18[_0x3fab('0x3b')],_0x17be18[_0x3fab('0xab')],_0x17be18[_0x3fab('0xac')]);logger['debug'](_0x3fab('0xad'),_0x17be18[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x17be18,{'showHidden':![],'depth':null}));if(this[_0x3fab('0x42')][_0x17be18['transfereeuniqueid']]){this['channels'][_0x17be18[_0x3fab('0xa6')]][_0x3fab('0xa3')]=_0x17be18[_0x3fab('0xab')];this[_0x3fab('0x42')][_0x17be18[_0x3fab('0xa6')]][_0x3fab('0xa4')]=_0x17be18[_0x3fab('0xac')];this[_0x3fab('0x27')]({'event':_0x3fab('0xae'),'uniqueid':_0x17be18[_0x3fab('0xa6')],'context':_0x17be18[_0x3fab('0x4a')],'channel':_0x17be18[_0x3fab('0xaf')]});}}}catch(_0x14a5d3){logger[_0x3fab('0x34')](_0x3fab('0xb0'),_0x17be18[_0x3fab('0x3b')],util['inspect'](_0x14a5d3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x3fab('0x37')][_0x3fab('0x2e')]=function(_0x4c8beb){try{if(this[_0x3fab('0x45')](_0x4c8beb)){logger[_0x3fab('0x3e')](_0x3fab('0xb1'),_0x4c8beb[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x4c8beb,{'showHidden':![],'depth':null}));if(this[_0x3fab('0x42')][_0x4c8beb[_0x3fab('0x3b')]]){if(!_[_0x3fab('0x79')](this[_0x3fab('0x42')][_0x4c8beb[_0x3fab('0x3b')]][_0x3fab('0x98')])){this[_0x3fab('0x42')][_0x4c8beb[_0x3fab('0x3b')]][_0x3fab('0xb2')]=moment()[_0x3fab('0x53')](_0x3fab('0x60'));logger['info']('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x4c8beb[_0x3fab('0x3b')],this[_0x3fab('0x42')][_0x4c8beb[_0x3fab('0x3b')]][_0x3fab('0xb2')]);}}}}catch(_0x50e671){logger[_0x3fab('0x34')]('[%s][voiceCallReport][musiconholdstart]',_0x4c8beb['uniqueid'],util['inspect'](_0x50e671,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x9c15d9){try{if(this[_0x3fab('0x45')](_0x9c15d9)){logger[_0x3fab('0x3e')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x9c15d9[_0x3fab('0x3b')],util[_0x3fab('0x36')](_0x9c15d9,{'showHidden':![],'depth':null}));if(this['channels'][_0x9c15d9['uniqueid']]){if(!_['isNil'](this[_0x3fab('0x42')][_0x9c15d9[_0x3fab('0x3b')]][_0x3fab('0xb2')])){this[_0x3fab('0x42')][_0x9c15d9[_0x3fab('0x3b')]][_0x3fab('0xb3')]+=moment()[_0x3fab('0xb4')](0x0)['diff'](this[_0x3fab('0x42')][_0x9c15d9[_0x3fab('0x3b')]][_0x3fab('0xb2')],_0x3fab('0x5f'));logger[_0x3fab('0x31')](_0x3fab('0xb5'),_0x9c15d9[_0x3fab('0x3b')],this[_0x3fab('0x42')][_0x9c15d9[_0x3fab('0x3b')]][_0x3fab('0xb3')]);delete this['channels'][_0x9c15d9['uniqueid']]['mohstarttime'];}}}}catch(_0x5bd0da){logger[_0x3fab('0x34')](_0x3fab('0xb6'),_0x9c15d9[_0x3fab('0x3b')],util['inspect'](_0x5bd0da,{'showHidden':![],'depth':null}));}};module[_0x3fab('0xb7')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 8d58447..9e795a8 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x383b=['connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','diff','starttime','seconds','lastevent','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','linkedid','destuniqueid','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','bind','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','syncDialBegin','debug','[%s][voiceDialReport][dialbegin]\x20event:','inspect','merge','uniqueid','format','called','channel','substring','lastIndexOf','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum'];(function(_0xe9a92e,_0x29486a){var _0x15ecc8=function(_0x21a6c7){while(--_0x21a6c7){_0xe9a92e['push'](_0xe9a92e['shift']());}};_0x15ecc8(++_0x29486a);}(_0x383b,0x1d6));var _0xb383=function(_0x36e45f,_0x28a431){_0x36e45f=_0x36e45f-0x0;var _0x163ae9=_0x383b[_0x36e45f];return _0x163ae9;};'use strict';var _=require(_0xb383('0x0'));var moment=require(_0xb383('0x1'));var util=require('util');var Redis=require(_0xb383('0x2'));var config=require(_0xb383('0x3'));var logger=require(_0xb383('0x4'))(_0xb383('0x5'));var ami=require(_0xb383('0x6'));config[_0xb383('0x7')]=_['defaults'](config[_0xb383('0x7')],{'host':_0xb383('0x8'),'port':0x18eb});var io=require(_0xb383('0x9'))(new Redis(config[_0xb383('0x7')]));function VoiceDialReport(_0x15347d){this[_0xb383('0xa')]=_0x15347d[_0xb383('0xb')];this[_0xb383('0xc')]=_0x15347d[_0xb383('0xc')];this[_0xb383('0xd')]={};ami['on'](_0xb383('0xe'),this['syncDialBegin'][_0xb383('0xf')](this));ami['on']('dialend',this[_0xb383('0x10')][_0xb383('0xf')](this));ami['on']('varset',this[_0xb383('0x11')][_0xb383('0xf')](this));ami['on'](_0xb383('0x12'),this[_0xb383('0x13')][_0xb383('0xf')](this));}VoiceDialReport[_0xb383('0x14')][_0xb383('0x15')]=function(_0x49d4bd){return _0x49d4bd!==null&&!_[_0xb383('0x16')](_0x49d4bd);};VoiceDialReport['prototype'][_0xb383('0x17')]=function(_0x266cbe,_0x3e4f48,_0x37224f){io['to'](_0x266cbe)['emit'](_0x3e4f48,_0x37224f);};VoiceDialReport[_0xb383('0x14')][_0xb383('0x18')]=function(_0x4e0fec){try{if(this[_0xb383('0x15')](_0x4e0fec)){logger[_0xb383('0x19')](_0xb383('0x1a'),_0x4e0fec['uniqueid'],util[_0xb383('0x1b')](_0x4e0fec,{'showHidden':![],'depth':null}));if(this['channels'][_0x4e0fec['uniqueid']]){_[_0xb383('0x1c')](this[_0xb383('0xa')][_0x4e0fec[_0xb383('0x1d')]],{'starttime':moment()[_0xb383('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xb383('0x1f'),'interface':_0x4e0fec[_0xb383('0x20')][_0xb383('0x21')](0x0,_0x4e0fec[_0xb383('0x20')][_0xb383('0x22')]('-')),'membername':_0x4e0fec[_0xb383('0x20')][_0xb383('0x21')](_0x4e0fec[_0xb383('0x20')]['lastIndexOf']('/')+0x1,_0x4e0fec[_0xb383('0x20')][_0xb383('0x22')]('-'))},_['omit'](_0x4e0fec,[_0xb383('0x23'),_0xb383('0x24')]));logger['info'](_0xb383('0x25'),_0x4e0fec[_0xb383('0x1d')],this['channels'][_0x4e0fec['uniqueid']][_0xb383('0x26')],this['channels'][_0x4e0fec[_0xb383('0x1d')]][_0xb383('0x27')]);logger['debug'](_0xb383('0x28'),_0x4e0fec[_0xb383('0x1d')],util[_0xb383('0x1b')](this[_0xb383('0xa')][_0x4e0fec[_0xb383('0x1d')]],{'showHidden':![],'depth':null}));this[_0xb383('0x17')](_0xb383('0x29'),_0xb383('0x2a'),this[_0xb383('0xa')][_0x4e0fec[_0xb383('0x1d')]]);logger[_0xb383('0x19')](_0xb383('0x2b'),_0x4e0fec[_0xb383('0x1d')],util[_0xb383('0x1b')](this[_0xb383('0xa')][_0x4e0fec[_0xb383('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xb383('0x17')](_0xb383('0x2c'),this[_0xb383('0xa')][_0x4e0fec['uniqueid']]);}}}catch(_0x1e8d94){logger[_0xb383('0x2d')](_0xb383('0x2e'),_0x4e0fec[_0xb383('0x1d')],util[_0xb383('0x1b')](_0x1e8d94,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb383('0x14')][_0xb383('0x10')]=function(_0x39dc43){try{if(this[_0xb383('0x15')](_0x39dc43)){logger[_0xb383('0x19')]('[%s][voiceDialReport][dialend]\x20event:',_0x39dc43[_0xb383('0x1d')],util[_0xb383('0x1b')](_0x39dc43,{'showHidden':![],'depth':null}));if(this[_0xb383('0xa')][_0x39dc43['uniqueid']]){this[_0xb383('0xa')][_0x39dc43[_0xb383('0x1d')]]['dialstatus']=_0x39dc43['dialstatus'];if(_0x39dc43[_0xb383('0x2f')]===_0xb383('0x30')){this[_0xb383('0xa')][_0x39dc43[_0xb383('0x1d')]]['connectedlinenum']=_0x39dc43[_0xb383('0x31')];this[_0xb383('0xa')][_0x39dc43['uniqueid']][_0xb383('0x32')]=_0x39dc43[_0xb383('0x32')];this[_0xb383('0xa')][_0x39dc43[_0xb383('0x1d')]][_0xb383('0x33')]=moment()[_0xb383('0x1e')](_0xb383('0x34'));this['channels'][_0x39dc43['uniqueid']]['lastevent']='connect';logger[_0xb383('0x35')](_0xb383('0x36'),_0x39dc43[_0xb383('0x1d')],_0x39dc43[_0xb383('0x20')][_0xb383('0x21')](_0x39dc43['channel'][_0xb383('0x22')]('/')+0x1,_0x39dc43[_0xb383('0x20')][_0xb383('0x22')]('-')));logger[_0xb383('0x19')](_0xb383('0x37'),_0x39dc43[_0xb383('0x1d')],util[_0xb383('0x1b')](this[_0xb383('0xa')][_0x39dc43[_0xb383('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xb383('0x17')](_0xb383('0x38'),this[_0xb383('0xa')][_0x39dc43['uniqueid']]);}logger[_0xb383('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x39dc43[_0xb383('0x1d')],util[_0xb383('0x1b')](this[_0xb383('0xa')][_0x39dc43[_0xb383('0x1d')]],{'showHidden':![],'depth':null}));this[_0xb383('0x17')](_0xb383('0x29'),_0xb383('0x2a'),this[_0xb383('0xa')][_0x39dc43['uniqueid']]);}}}catch(_0x1167ae){logger['error'](_0xb383('0x39'),_0x39dc43['uniqueid'],util[_0xb383('0x1b')](_0x1167ae,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb383('0x14')]['syncVarSet']=function(_0x2272da){try{if(this[_0xb383('0x15')](_0x2272da)){logger[_0xb383('0x19')](_0xb383('0x3a'),_0x2272da['uniqueid'],util['inspect'](_0x2272da,{'showHidden':![],'depth':null}));this[_0xb383('0x3b')](_0x2272da[_0xb383('0x1d')],_[_0xb383('0x3c')](_0x2272da[_0xb383('0x3d')])[0x0],_0x2272da[_0xb383('0x3e')]);if(this[_0xb383('0x15')](_0x2272da['variable'])&&this[_0xb383('0x15')](_0x2272da['variable'][_0xb383('0x3f')])){if(_[_0xb383('0x16')](this[_0xb383('0xa')][_0x2272da['uniqueid']])){this['channels'][_0x2272da[_0xb383('0x1d')]]={'routeId':_0x2272da['value'],'variables':this['variables'][_0x2272da[_0xb383('0x1d')]]};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x2272da[_0xb383('0x1d')],_0x2272da[_0xb383('0x3d')][_0xb383('0x3f')],_[_0xb383('0x3c')](_0x2272da['variable'])[0x0],_0x2272da[_0xb383('0x3e')]);logger[_0xb383('0x19')](_0xb383('0x40'),_0x2272da['uniqueid'],util[_0xb383('0x1b')](this[_0xb383('0xa')][_0x2272da[_0xb383('0x1d')]],{'showHidden':![],'depth':null}));this[_0xb383('0x17')](_0xb383('0x29'),_0xb383('0x2a'),this['channels'][_0x2272da['uniqueid']]);}}}}catch(_0x562237){logger['error'](_0xb383('0x41'),_0x2272da[_0xb383('0x1d')],util[_0xb383('0x1b')](_0x562237,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb383('0x14')][_0xb383('0x3b')]=function(_0x5e43cb,_0x26e7b9,_0x49c5f2){var _0x250935=[_0xb383('0x42'),_0xb383('0x43'),_0xb383('0x44'),_0xb383('0x45'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0xb383('0x46'),_0xb383('0x47'),_0xb383('0x48'),_0xb383('0x49'),'bridgepeer','bridgepvtcallid',_0xb383('0x4a'),_0xb383('0x4b'),_0xb383('0x4c'),_0xb383('0x4d'),_0xb383('0x26'),_0xb383('0x4e'),'memberrealtime'];if(!_[_0xb383('0x4f')](_0x26e7b9)&&!_[_0xb383('0x50')](_0x250935,_0x26e7b9)){if(_[_0xb383('0x16')](this['variables'][_0x5e43cb])){this[_0xb383('0xd')][_0x5e43cb]={};}this[_0xb383('0xd')][_0x5e43cb][_0x26e7b9]=_0x49c5f2;}};VoiceDialReport[_0xb383('0x14')][_0xb383('0x13')]=function(_0x4628b6){try{if(this['isNotNull'](_0x4628b6)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x4628b6[_0xb383('0x1d')],util['inspect'](_0x4628b6,{'showHidden':![],'depth':null}));if(this[_0xb383('0xa')][_0x4628b6['uniqueid']]){logger[_0xb383('0x35')](_0xb383('0x51'),_0x4628b6[_0xb383('0x1d')],_0x4628b6['cause-txt']);this['channels'][_0x4628b6['uniqueid']]['endtime']=moment()[_0xb383('0x1e')](_0xb383('0x34'));this['channels'][_0x4628b6['uniqueid']]['duration']=moment(this['channels'][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x52')])[_0xb383('0x53')](this['channels'][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x54')],_0xb383('0x55'));this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x56')]=_0xb383('0x57');this[_0xb383('0xc')][_0xb383('0x58')]+=0x1;if(this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x33')]){this[_0xb383('0xc')][_0xb383('0x59')]+=0x1;this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x5a')]=moment(this['channels'][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x33')])['diff'](this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x54')],'seconds');this['channels'][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x5b')]=moment(this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x52')])[_0xb383('0x53')](this['channels'][_0x4628b6['uniqueid']][_0xb383('0x33')],_0xb383('0x55'));this[_0xb383('0xc')][_0xb383('0x5c')]+=this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x5a')]||0x0;this[_0xb383('0xc')][_0xb383('0x5d')]+=this['channels'][_0x4628b6[_0xb383('0x1d')]][_0xb383('0x5b')];}this[_0xb383('0xc')][_0xb383('0x5e')]+=this[_0xb383('0xa')][_0x4628b6['uniqueid']]['duration'];logger['debug'](_0xb383('0x5f'),_0x4628b6[_0xb383('0x1d')],util['inspect'](this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xb383('0x17')](_0xb383('0x60'),this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]]);logger[_0xb383('0x19')](_0xb383('0x61'),_0x4628b6['uniqueid'],util[_0xb383('0x1b')](this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xb383('0x17')](_0xb383('0x62'),this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]]);logger[_0xb383('0x19')](_0xb383('0x63'),_0x4628b6['uniqueid'],util[_0xb383('0x1b')](this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]],{'showHidden':![],'depth':null}));this['emit'](_0xb383('0x29'),'voice_outbound:save',this['outbound']);logger[_0xb383('0x35')](_0xb383('0x64'),JSON[_0xb383('0x65')](this['channels'][_0x4628b6[_0xb383('0x1d')]]));logger[_0xb383('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x4628b6[_0xb383('0x1d')],util[_0xb383('0x1b')](this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]],{'showHidden':![],'depth':null}));this[_0xb383('0x17')](_0xb383('0x29'),'voice_outbound_channel:remove',this[_0xb383('0xa')][_0x4628b6[_0xb383('0x1d')]]);delete this[_0xb383('0xa')][_0x4628b6['uniqueid']];}else if(this[_0xb383('0xa')][_0x4628b6[_0xb383('0x66')]]){this['channels'][_0x4628b6[_0xb383('0x66')]][_0xb383('0x1d')]=this[_0xb383('0xa')][_0x4628b6[_0xb383('0x66')]][_0xb383('0x67')];}if(this[_0xb383('0xd')][_0x4628b6[_0xb383('0x1d')]]){delete this[_0xb383('0xd')][_0x4628b6[_0xb383('0x1d')]];}}}catch(_0x1b01dc){logger['error']('[%s][voiceDialReport][hangup]',_0x4628b6[_0xb383('0x1d')],util[_0xb383('0x1b')](_0x1b01dc,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x42d3=['redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','called','channel','substring','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','YYYY-MM-DD\x20HH:mm:ss','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','variable','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','membername','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','diff','starttime','seconds','lastevent','complete','total','holdtime','billableseconds','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami'];(function(_0x74e78f,_0x1175c2){var _0x2d2012=function(_0x26b9da){while(--_0x26b9da){_0x74e78f['push'](_0x74e78f['shift']());}};_0x2d2012(++_0x1175c2);}(_0x42d3,0x12e));var _0x342d=function(_0x5e03ad,_0x2eb620){_0x5e03ad=_0x5e03ad-0x0;var _0x4fea1a=_0x42d3[_0x5e03ad];return _0x4fea1a;};'use strict';var _=require(_0x342d('0x0'));var moment=require(_0x342d('0x1'));var util=require(_0x342d('0x2'));var Redis=require(_0x342d('0x3'));var config=require(_0x342d('0x4'));var logger=require(_0x342d('0x5'))(_0x342d('0x6'));var ami=require('../ami');config[_0x342d('0x7')]=_['defaults'](config[_0x342d('0x7')],{'host':_0x342d('0x8'),'port':0x18eb});var io=require(_0x342d('0x9'))(new Redis(config['redis']));function VoiceDialReport(_0x3cca73){this[_0x342d('0xa')]=_0x3cca73[_0x342d('0xb')];this[_0x342d('0xc')]=_0x3cca73[_0x342d('0xc')];this[_0x342d('0xd')]={};ami['on']('dialbegin',this[_0x342d('0xe')][_0x342d('0xf')](this));ami['on'](_0x342d('0x10'),this[_0x342d('0x11')][_0x342d('0xf')](this));ami['on'](_0x342d('0x12'),this['syncVarSet'][_0x342d('0xf')](this));ami['on'](_0x342d('0x13'),this[_0x342d('0x14')]['bind'](this));}VoiceDialReport[_0x342d('0x15')][_0x342d('0x16')]=function(_0x3b78e2){return _0x3b78e2!==null&&!_[_0x342d('0x17')](_0x3b78e2);};VoiceDialReport[_0x342d('0x15')]['emit']=function(_0xe7a35a,_0x50632f,_0x575039){io['to'](_0xe7a35a)[_0x342d('0x18')](_0x50632f,_0x575039);};VoiceDialReport[_0x342d('0x15')][_0x342d('0xe')]=function(_0x19d48a){try{if(this[_0x342d('0x16')](_0x19d48a)){logger[_0x342d('0x19')](_0x342d('0x1a'),_0x19d48a[_0x342d('0x1b')],util['inspect'](_0x19d48a,{'showHidden':![],'depth':null}));if(this[_0x342d('0xa')][_0x19d48a[_0x342d('0x1b')]]){_[_0x342d('0x1c')](this[_0x342d('0xa')][_0x19d48a[_0x342d('0x1b')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x342d('0x1d'),'interface':_0x19d48a[_0x342d('0x1e')][_0x342d('0x1f')](0x0,_0x19d48a['channel'][_0x342d('0x20')]('-')),'membername':_0x19d48a[_0x342d('0x1e')]['substring'](_0x19d48a[_0x342d('0x1e')][_0x342d('0x20')]('/')+0x1,_0x19d48a['channel'][_0x342d('0x20')]('-'))},_[_0x342d('0x21')](_0x19d48a,['event',_0x342d('0x22')]));logger[_0x342d('0x23')](_0x342d('0x24'),_0x19d48a[_0x342d('0x1b')],this[_0x342d('0xa')][_0x19d48a[_0x342d('0x1b')]]['membername'],this[_0x342d('0xa')][_0x19d48a[_0x342d('0x1b')]][_0x342d('0x25')]);logger[_0x342d('0x19')](_0x342d('0x26'),_0x19d48a[_0x342d('0x1b')],util[_0x342d('0x27')](this[_0x342d('0xa')][_0x19d48a[_0x342d('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x342d('0x28'),'voice_outbound_channel:save',this[_0x342d('0xa')][_0x19d48a[_0x342d('0x1b')]]);logger['debug'](_0x342d('0x29'),_0x19d48a[_0x342d('0x1b')],util[_0x342d('0x27')](this[_0x342d('0xa')][_0x19d48a[_0x342d('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x342d('0x18')](_0x342d('0x2a'),this[_0x342d('0xa')][_0x19d48a['uniqueid']]);}}}catch(_0x502fc4){logger[_0x342d('0x2b')](_0x342d('0x2c'),_0x19d48a[_0x342d('0x1b')],util[_0x342d('0x27')](_0x502fc4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x342d('0x15')]['syncDialEnd']=function(_0x5d9c82){try{if(this[_0x342d('0x16')](_0x5d9c82)){logger[_0x342d('0x19')](_0x342d('0x2d'),_0x5d9c82['uniqueid'],util['inspect'](_0x5d9c82,{'showHidden':![],'depth':null}));if(this['channels'][_0x5d9c82[_0x342d('0x1b')]]){this[_0x342d('0xa')][_0x5d9c82[_0x342d('0x1b')]]['dialstatus']=_0x5d9c82[_0x342d('0x2e')];if(_0x5d9c82[_0x342d('0x2e')]===_0x342d('0x2f')){this['channels'][_0x5d9c82[_0x342d('0x1b')]][_0x342d('0x30')]=_0x5d9c82[_0x342d('0x30')];this[_0x342d('0xa')][_0x5d9c82[_0x342d('0x1b')]][_0x342d('0x31')]=_0x5d9c82[_0x342d('0x31')];this['channels'][_0x5d9c82['uniqueid']][_0x342d('0x32')]=moment()[_0x342d('0x33')](_0x342d('0x34'));this[_0x342d('0xa')][_0x5d9c82[_0x342d('0x1b')]]['lastevent']=_0x342d('0x35');logger[_0x342d('0x23')](_0x342d('0x36'),_0x5d9c82[_0x342d('0x1b')],_0x5d9c82['channel'][_0x342d('0x1f')](_0x5d9c82['channel'][_0x342d('0x20')]('/')+0x1,_0x5d9c82[_0x342d('0x1e')][_0x342d('0x20')]('-')));logger[_0x342d('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x5d9c82[_0x342d('0x1b')],util[_0x342d('0x27')](this[_0x342d('0xa')][_0x5d9c82['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x342d('0x37'),this[_0x342d('0xa')][_0x5d9c82[_0x342d('0x1b')]]);}logger['debug'](_0x342d('0x38'),_0x5d9c82['uniqueid'],util[_0x342d('0x27')](this[_0x342d('0xa')][_0x5d9c82['uniqueid']],{'showHidden':![],'depth':null}));this[_0x342d('0x18')](_0x342d('0x28'),'voice_outbound_channel:save',this['channels'][_0x5d9c82[_0x342d('0x1b')]]);}}}catch(_0x18f5f5){logger['error']('[%s][voiceDialReport][dialend]',_0x5d9c82['uniqueid'],util['inspect'](_0x18f5f5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x342d('0x15')][_0x342d('0x39')]=function(_0x3f488a){try{if(this[_0x342d('0x16')](_0x3f488a)){logger[_0x342d('0x19')](_0x342d('0x3a'),_0x3f488a[_0x342d('0x1b')],util['inspect'](_0x3f488a,{'showHidden':![],'depth':null}));this['addVariable'](_0x3f488a[_0x342d('0x1b')],_[_0x342d('0x3b')](_0x3f488a['variable'])[0x0],_0x3f488a[_0x342d('0x3c')]);if(this[_0x342d('0x16')](_0x3f488a['variable'])&&this[_0x342d('0x16')](_0x3f488a['variable']['outboundrouteid'])){if(_[_0x342d('0x17')](this[_0x342d('0xa')][_0x3f488a[_0x342d('0x1b')]])){this[_0x342d('0xa')][_0x3f488a[_0x342d('0x1b')]]={'routeId':_0x3f488a['value'],'variables':this[_0x342d('0xd')][_0x3f488a['uniqueid']]};logger[_0x342d('0x23')](_0x342d('0x3d'),_0x3f488a[_0x342d('0x1b')],_0x3f488a[_0x342d('0x3e')][_0x342d('0x3f')],_['keys'](_0x3f488a['variable'])[0x0],_0x3f488a[_0x342d('0x3c')]);logger['debug'](_0x342d('0x40'),_0x3f488a['uniqueid'],util['inspect'](this[_0x342d('0xa')][_0x3f488a[_0x342d('0x1b')]],{'showHidden':![],'depth':null}));this[_0x342d('0x18')](_0x342d('0x28'),_0x342d('0x41'),this[_0x342d('0xa')][_0x3f488a[_0x342d('0x1b')]]);}}}}catch(_0x2defdc){logger['error'](_0x342d('0x42'),_0x3f488a[_0x342d('0x1b')],util[_0x342d('0x27')](_0x2defdc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x342d('0x15')][_0x342d('0x43')]=function(_0x4b3b38,_0x1f4f4e,_0x4aa51a){var _0x167bb3=[_0x342d('0x44'),_0x342d('0x45'),_0x342d('0x46'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x342d('0x47'),_0x342d('0x48'),_0x342d('0x49'),_0x342d('0x4a'),'bridgepvtcallid','membercalls',_0x342d('0x4b'),_0x342d('0x4c'),_0x342d('0x4d'),_0x342d('0x4e'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x1f4f4e)&&!_[_0x342d('0x4f')](_0x167bb3,_0x1f4f4e)){if(_[_0x342d('0x17')](this['variables'][_0x4b3b38])){this[_0x342d('0xd')][_0x4b3b38]={};}this[_0x342d('0xd')][_0x4b3b38][_0x1f4f4e]=_0x4aa51a;}};VoiceDialReport[_0x342d('0x15')][_0x342d('0x14')]=function(_0x5bd281){try{if(this[_0x342d('0x16')](_0x5bd281)){logger[_0x342d('0x19')]('[%s][voiceDialReport][hangup]\x20event:',_0x5bd281[_0x342d('0x1b')],util[_0x342d('0x27')](_0x5bd281,{'showHidden':![],'depth':null}));if(this['channels'][_0x5bd281[_0x342d('0x1b')]]){logger['info'](_0x342d('0x50'),_0x5bd281['uniqueid'],_0x5bd281[_0x342d('0x51')]);this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]]['endtime']=moment()['format'](_0x342d('0x34'));this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]][_0x342d('0x52')]=moment(this[_0x342d('0xa')][_0x5bd281['uniqueid']][_0x342d('0x53')])[_0x342d('0x54')](this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]][_0x342d('0x55')],_0x342d('0x56'));this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]][_0x342d('0x57')]=_0x342d('0x58');this[_0x342d('0xc')][_0x342d('0x59')]+=0x1;if(this['channels'][_0x5bd281[_0x342d('0x1b')]][_0x342d('0x32')]){this[_0x342d('0xc')]['answered']+=0x1;this['channels'][_0x5bd281[_0x342d('0x1b')]][_0x342d('0x5a')]=moment(this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]][_0x342d('0x32')])[_0x342d('0x54')](this[_0x342d('0xa')][_0x5bd281['uniqueid']][_0x342d('0x55')],_0x342d('0x56'));this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]][_0x342d('0x5b')]=moment(this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]]['endtime'])[_0x342d('0x54')](this['channels'][_0x5bd281[_0x342d('0x1b')]][_0x342d('0x32')],_0x342d('0x56'));this[_0x342d('0xc')]['sumHoldTime']+=this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]]['holdtime']||0x0;this[_0x342d('0xc')][_0x342d('0x5c')]+=this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]]['billableseconds'];}this[_0x342d('0xc')][_0x342d('0x5d')]+=this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]][_0x342d('0x52')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x5bd281[_0x342d('0x1b')],util[_0x342d('0x27')](this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x342d('0x18')]('custom:voiceDialReport',this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]]);logger[_0x342d('0x19')](_0x342d('0x5e'),_0x5bd281['uniqueid'],util[_0x342d('0x27')](this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x342d('0x18')](_0x342d('0x5f'),this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]]);logger[_0x342d('0x19')](_0x342d('0x60'),_0x5bd281[_0x342d('0x1b')],util[_0x342d('0x27')](this['channels'][_0x5bd281[_0x342d('0x1b')]],{'showHidden':![],'depth':null}));this[_0x342d('0x18')](_0x342d('0x28'),'voice_outbound:save',this[_0x342d('0xc')]);logger[_0x342d('0x23')](_0x342d('0x61'),JSON[_0x342d('0x62')](this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]]));logger[_0x342d('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x5bd281[_0x342d('0x1b')],util[_0x342d('0x27')](this[_0x342d('0xa')][_0x5bd281['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x342d('0x28'),_0x342d('0x63'),this[_0x342d('0xa')][_0x5bd281['uniqueid']]);delete this[_0x342d('0xa')][_0x5bd281[_0x342d('0x1b')]];}else if(this[_0x342d('0xa')][_0x5bd281[_0x342d('0x64')]]){this[_0x342d('0xa')][_0x5bd281[_0x342d('0x64')]][_0x342d('0x1b')]=this[_0x342d('0xa')][_0x5bd281['linkedid']][_0x342d('0x65')];}if(this[_0x342d('0xd')][_0x5bd281[_0x342d('0x1b')]]){delete this[_0x342d('0xd')][_0x5bd281['uniqueid']];}}}catch(_0x383d05){logger[_0x342d('0x2b')]('[%s][voiceDialReport][hangup]',_0x5bd281['uniqueid'],util[_0x342d('0x27')](_0x383d05,{'showHidden':![],'depth':null}));}};module[_0x342d('0x66')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 906adab..4135d6d 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa866=['position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','YYYY-MM-DD\x20HH:mm:ss','ABANDONED','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','lastAssignedTo','queuecallerexitAt','reason','transfer','queuecallerexitreason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexit','add','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[%s][voiceQueueReport][varset]','addVariable','value','variable','queuestatus','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','syncHangup','[%s][voiceQueueReport][hangup]','length','diff','seconds','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','emitVoiceQueueSummary','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfereruniqueid','ATTENDEDTRANSFER','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','syncMusicOnHoldStop','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','lodash','moment','util','md5','ioredis','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','unlockRR','clearZombieChannels','switch','isNil','status','catch','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','format','name','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','emit','voice:queue:%s','inbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','total','type','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','Action','queues','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','voiceQueues','toNumber','loggedin','debug','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','syncQueueSummaryComplete','syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt'];(function(_0x1b0370,_0x5ddd48){var _0x2fa235=function(_0xfe3bc1){while(--_0xfe3bc1){_0x1b0370['push'](_0x1b0370['shift']());}};_0x2fa235(++_0x5ddd48);}(_0xa866,0x6a));var _0x6a86=function(_0x3b6046,_0x467fb8){_0x3b6046=_0x3b6046-0x0;var _0x267b01=_0xa866[_0x3b6046];return _0x267b01;};'use strict';var _=require(_0x6a86('0x0'));var moment=require(_0x6a86('0x1'));var util=require(_0x6a86('0x2'));var md5=require(_0x6a86('0x3'));var Redis=require(_0x6a86('0x4'));var config=require('../../../config/environment');var logger=require(_0x6a86('0x5'))(_0x6a86('0x6'));var ami=require(_0x6a86('0x7'));var QueueReport=require('../model/queueReport');config[_0x6a86('0x8')]=_[_0x6a86('0x9')](config[_0x6a86('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x6a86('0xa'))(new Redis(config[_0x6a86('0x8')]));var Sequence=function(){};Sequence[_0x6a86('0xb')][_0x6a86('0xc')]=function(_0x37e3ee){this[_0x6a86('0xd')]=this[_0x6a86('0xd')]?this[_0x6a86('0xd')][_0x6a86('0xe')](_0x37e3ee):_0x37e3ee();};function VoiceQueueReport(_0x5355b7){this[_0x6a86('0xf')]=new Sequence();this[_0x6a86('0x10')]={};this[_0x6a86('0x11')]=_0x5355b7['agents'];this[_0x6a86('0x12')]=_0x5355b7[_0x6a86('0x13')];this['voiceQueues']=_0x5355b7['voiceQueues'];this[_0x6a86('0x14')]=!![];this[_0x6a86('0x15')]=_0x5355b7[_0x6a86('0x15')];this[_0x6a86('0x16')]={};ami['on'](_0x6a86('0x17'),this[_0x6a86('0x18')][_0x6a86('0x19')](this));ami['on'](_0x6a86('0x1a'),this['syncQueueSummaryComplete'][_0x6a86('0x19')](this));ami['on'](_0x6a86('0x1b'),this['syncQueueCallerJoin'][_0x6a86('0x19')](this));ami['on'](_0x6a86('0x1c'),this[_0x6a86('0x1d')][_0x6a86('0x19')](this));ami['on'](_0x6a86('0x1e'),this[_0x6a86('0x1f')]['bind'](this));ami['on'](_0x6a86('0x20'),this[_0x6a86('0x21')]['bind'](this));ami['on']('agentconnect',this[_0x6a86('0x22')]['bind'](this));ami['on']('varset',this[_0x6a86('0x23')][_0x6a86('0x19')](this));ami['on'](_0x6a86('0x24'),this['syncHangup'][_0x6a86('0x19')](this));ami['on'](_0x6a86('0x25'),this[_0x6a86('0x26')][_0x6a86('0x19')](this));ami['on'](_0x6a86('0x27'),this[_0x6a86('0x28')]['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0x6a86('0x19')](this));ami['on'](_0x6a86('0x29'),this[_0x6a86('0x2a')][_0x6a86('0x19')](this));ami['on']('blindtransfer',this[_0x6a86('0x2b')][_0x6a86('0x19')](this));this[_0x6a86('0x2c')]();this[_0x6a86('0x2d')]();}function clearChannels(_0x19382d){if(!_[_0x6a86('0x2e')](_0x19382d)){for(var _0x46f6c7 in _0x19382d){if(_0x19382d[_0x6a86('0x2f')](_0x46f6c7)){delete _0x19382d[_0x46f6c7];}}}}function clearCampaigns(_0x40e616){if(!_['isEmpty'](_0x40e616)){for(var _0x5190c9 in _0x40e616){if(_0x40e616[_0x6a86('0x2f')](_0x5190c9)){_0x40e616[_0x5190c9]['originated']=0x0;}}}}function clearVoiceQueues(_0x5415e9){if(!_[_0x6a86('0x2e')](_0x5415e9)){for(var _0x481f99 in _0x5415e9){if(_0x5415e9[_0x6a86('0x2f')](_0x481f99)){_0x5415e9[_0x481f99][_0x6a86('0x30')]=0x0;_0x5415e9[_0x481f99][_0x6a86('0x31')]=0x0;_0x5415e9[_0x481f99]['pTalking']=0x0;_0x5415e9[_0x481f99][_0x6a86('0x32')]=0x0;_0x5415e9[_0x481f99]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x5a77e6){if(!_['isEmpty'](_0x5a77e6)){for(var _0xeefb79 in _0x5a77e6){if(_0x5a77e6[_0x6a86('0x2f')](_0xeefb79)){_0x5a77e6[_0xeefb79][_0x6a86('0x33')]=!![];}}}}VoiceQueueReport['prototype'][_0x6a86('0x34')]=function(){var _0x3d1f52=this;for(var _0x1bb745 in this[_0x6a86('0x12')]){if(this['channels'][_0x6a86('0x2f')](_0x1bb745)&&!this['channels'][_0x1bb745][_0x6a86('0x35')]){this[_0x6a86('0xf')][_0x6a86('0xc')](function(){if(!_[_0x6a86('0x36')](_0x3d1f52[_0x6a86('0x12')][_0x1bb745])){return ami['Action']({'action':_0x6a86('0x37'),'channel':_0x3d1f52[_0x6a86('0x12')][_0x1bb745]['channel']})[_0x6a86('0x38')](function(_0x295de0){if(_0x295de0['message']===_0x6a86('0x39')){setTimeout(function(){if(_0x3d1f52[_0x6a86('0x12')][_0x1bb745]){delete _0x3d1f52['channels'][_0x1bb745];logger['error'](_0x6a86('0x3a'),_0x1bb745,util[_0x6a86('0x3b')](_0x295de0,{'showHidden':![],'depth':null}));}if(_0x3d1f52['queueReports'][_0x1bb745]){delete _0x3d1f52['queueReports'][_0x1bb745];logger[_0x6a86('0x3c')]('[%s][voiceQueueReport][checkQueueReport]',_0x1bb745,util[_0x6a86('0x3b')](_0x295de0,{'showHidden':![],'depth':null}));}if(_0x3d1f52['variables'][_0x1bb745]){delete _0x3d1f52[_0x6a86('0x16')][_0x1bb745];logger['error'](_0x6a86('0x3d'),_0x1bb745,util['inspect'](_0x295de0,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0x26')]=function(){logger[_0x6a86('0x3c')](_0x6a86('0x3e'));clearChannels(this['channels']);this[_0x6a86('0x3f')](this[_0x6a86('0x10')]);clearAgentBooked(this[_0x6a86('0x11')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x6a86('0x15')]);};VoiceQueueReport[_0x6a86('0xb')]['clearQueueReport']=function(_0x355bc0){var _0xf7c7e8=this;if(!_['isEmpty'](_0x355bc0)){for(var _0x2ceca3 in _0x355bc0){if(_0x355bc0['hasOwnProperty'](_0x2ceca3)){_0xf7c7e8['emitVoiceQueueChannelRemove'](_0x355bc0[_0x2ceca3],_0x6a86('0x40'));delete _0x355bc0[_0x2ceca3];}}}};VoiceQueueReport['prototype']['emit']=function(_0x518742,_0x1d65d9,_0x372e16){io['to'](_0x518742)['emit'](_0x1d65d9,_0x372e16);};VoiceQueueReport['prototype'][_0x6a86('0x41')]=function(_0x51c55c,_0x39b5a1){logger['debug'](_0x6a86('0x42')+_0x39b5a1+_0x6a86('0x43'),_0x51c55c['uniqueid'],util['inspect'](_0x51c55c,{'showHidden':![],'depth':null}));this['emit'](util[_0x6a86('0x44')]('voice:queue:%s',_0x51c55c[_0x6a86('0x45')]),'voice_queue_channel:save',_0x51c55c);};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0x46')]=function(_0x414b5b,_0x26483a){logger['debug'](_0x6a86('0x42')+_0x26483a+_0x6a86('0x47'),_0x414b5b['uniqueid'],util[_0x6a86('0x3b')](_0x414b5b,{'showHidden':![],'depth':null}));this[_0x6a86('0x48')](util[_0x6a86('0x44')](_0x6a86('0x49'),_0x414b5b[_0x6a86('0x45')]),'voice_queue_channel:remove',_0x414b5b);};VoiceQueueReport['prototype']['emitVoiceQueueSummary']=function(_0x592914,_0x9d5b23){if(_0x592914['type']===_0x6a86('0x4a')){var _0x539dfa={'id':_0x592914['id'],'name':_0x592914[_0x6a86('0x45')],'strategy':_0x592914[_0x6a86('0x4b')],'answered':_0x592914[_0x6a86('0x4c')],'available':_0x592914[_0x6a86('0x4d')],'loggedIn':_0x592914[_0x6a86('0x4e')],'pTalking':_0x592914['pTalking'],'sumBillable':_0x592914[_0x6a86('0x4f')],'sumDuration':_0x592914[_0x6a86('0x50')],'sumHoldTime':_0x592914['sumHoldTime']||0x0,'talking':_0x592914['talking'],'total':_0x592914[_0x6a86('0x51')],'type':_0x592914[_0x6a86('0x52')],'unmanaged':_0x592914[_0x6a86('0x53')],'abandoned':_0x592914[_0x6a86('0x54')],'waiting':_0x592914[_0x6a86('0x32')]};if(_0x592914[_0x6a86('0x55')]){_0x539dfa[_0x6a86('0x55')]={'id':_0x592914[_0x6a86('0x55')]['id'],'name':_0x592914['Trunk']['name'],'active':_0x592914['Trunk'][_0x6a86('0x56')],'callerid':_0x592914[_0x6a86('0x55')][_0x6a86('0x57')]};}if(_0x592914[_0x6a86('0x58')]){_0x539dfa[_0x6a86('0x58')]={'id':_0x592914[_0x6a86('0x58')]['id'],'name':_0x592914[_0x6a86('0x58')][_0x6a86('0x45')]};}var _0x2debfe=md5(JSON[_0x6a86('0x59')](_0x539dfa));if(_0x592914[_0x6a86('0x3')]!==_0x2debfe){_0x592914[_0x6a86('0x3')]=_0x2debfe;logger['debug'](_0x6a86('0x5a')+_0x9d5b23+_0x6a86('0x5b'),util[_0x6a86('0x3b')](_0x539dfa,{'showHidden':![],'depth':null}));this[_0x6a86('0x48')](util[_0x6a86('0x44')](_0x6a86('0x49'),_0x539dfa[_0x6a86('0x45')]),_0x6a86('0x5c'),_0x539dfa);}}};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0x5d')]=function(_0x4efed6){return _0x4efed6!==null&&!_[_0x6a86('0x5e')](_0x4efed6);};VoiceQueueReport['prototype'][_0x6a86('0x2d')]=function(){var _0x3b7df4=this;setInterval(function(){_0x3b7df4[_0x6a86('0x34')]();ami[_0x6a86('0x5f')]({'action':_0x6a86('0x60')})[_0x6a86('0x38')](function(_0x2a457f){logger[_0x6a86('0x3c')](_0x6a86('0x61'),util[_0x6a86('0x3b')](_0x2a457f,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0x2c')]=function(){var _0x49e0cf=this;setInterval(function(){if(_0x49e0cf[_0x6a86('0x14')]){return ami['Action']({'action':'queuesummary'})[_0x6a86('0x62')](function(_0x30c713){_0x49e0cf[_0x6a86('0x14')]=![];})['catch'](function(_0x2e6271){logger[_0x6a86('0x3c')](_0x6a86('0x63'),util[_0x6a86('0x3b')](_0x2e6271,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x6a86('0x18')]=function(_0x2cbb5a){try{if(this[_0x6a86('0x5d')](_0x2cbb5a)&&this['isNotNull'](_0x2cbb5a[_0x6a86('0x64')])){logger['debug'](_0x6a86('0x65'),util[_0x6a86('0x3b')](_0x2cbb5a,{'showHidden':![],'depth':null}));if(this['voiceQueues'][_0x2cbb5a[_0x6a86('0x64')]]){logger[_0x6a86('0x66')](_0x6a86('0x67'),_0x2cbb5a['queue']);var _0x2574f5=_[_0x6a86('0x68')](this[_0x6a86('0x12')],_0x6a86('0x64'))[_0x2cbb5a[_0x6a86('0x64')]]||0x0;var _0x38f987=_0x2574f5-_0x2cbb5a[_0x6a86('0x69')];if(this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]][_0x6a86('0x32')]!==_[_0x6a86('0x6b')](_0x2cbb5a[_0x6a86('0x69')])||this[_0x6a86('0x6a')][_0x2cbb5a['queue']][_0x6a86('0x4e')]!==_[_0x6a86('0x6b')](_0x2cbb5a['loggedin'])||this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]][_0x6a86('0x4d')]!==_[_0x6a86('0x6b')](_0x2cbb5a[_0x6a86('0x4d')])||this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]][_0x6a86('0x31')]!==_0x38f987){this['voiceQueues'][_0x2cbb5a[_0x6a86('0x64')]][_0x6a86('0x32')]=_[_0x6a86('0x6b')](_0x2cbb5a[_0x6a86('0x69')]);this[_0x6a86('0x6a')][_0x2cbb5a['queue']][_0x6a86('0x4e')]=_[_0x6a86('0x6b')](_0x2cbb5a[_0x6a86('0x6c')]);this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]][_0x6a86('0x4d')]=_[_0x6a86('0x6b')](_0x2cbb5a[_0x6a86('0x4d')]);this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]]['talking']=_0x38f987>0x0?_0x38f987:0x0;this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]]['talking']=this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]]['talking']>_[_0x6a86('0x6b')](_0x2cbb5a[_0x6a86('0x6c')])?_[_0x6a86('0x6b')](_0x2cbb5a[_0x6a86('0x6c')]):this['voiceQueues'][_0x2cbb5a[_0x6a86('0x64')]]['talking'];this['emitVoiceQueueSummary'](this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]],_0x6a86('0x17'));}logger[_0x6a86('0x6d')](_0x6a86('0x6e'),util[_0x6a86('0x3b')](this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6a86('0x6f'),this[_0x6a86('0x6a')][_0x2cbb5a[_0x6a86('0x64')]]);}}}catch(_0x3d137b){logger[_0x6a86('0x3c')](_0x6a86('0x63'),util[_0x6a86('0x3b')](_0x3d137b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0x70')]=function(_0x4b8cc4){logger[_0x6a86('0x6d')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x6a86('0x3b')](_0x4b8cc4,{'showHidden':![],'depth':null}));this[_0x6a86('0x14')]=!![];};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0x71')]=function(_0x441fe9){try{if(this[_0x6a86('0x5d')](_0x441fe9)){logger['debug'](_0x6a86('0x72'),_0x441fe9[_0x6a86('0x73')],util[_0x6a86('0x3b')](_0x441fe9,{'showHidden':![],'depth':null}));if(_[_0x6a86('0x5e')](this[_0x6a86('0x10')][_0x441fe9[_0x6a86('0x73')]])){this[_0x6a86('0x10')][_0x441fe9[_0x6a86('0x73')]]=[];this[_0x6a86('0x12')][_0x441fe9[_0x6a86('0x73')]]={};}var _0xf4e5c9=new QueueReport();_0xf4e5c9[_0x6a86('0x45')]=_0x441fe9[_0x6a86('0x64')];_0xf4e5c9['type']=this['voiceQueues'][_0xf4e5c9['name']]&&this[_0x6a86('0x6a')][_0xf4e5c9[_0x6a86('0x45')]][_0x6a86('0x52')]?this['voiceQueues'][_0xf4e5c9[_0x6a86('0x45')]][_0x6a86('0x52')]||_0x6a86('0x4a'):_0x6a86('0x4a');_0xf4e5c9[_0x6a86('0x64')]=_0x441fe9[_0x6a86('0x64')];_0xf4e5c9[_0x6a86('0x74')]=moment()[_0x6a86('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0xf4e5c9[_0x6a86('0x75')]=_0x441fe9['position'];_0xf4e5c9['count']=_0x441fe9[_0x6a86('0x76')];_0xf4e5c9[_0x6a86('0x73')]=_0x441fe9['uniqueid'];logger[_0x6a86('0x66')](_0x6a86('0x77'),_0xf4e5c9[_0x6a86('0x45')],_0xf4e5c9[_0x6a86('0x52')]);_[_0x6a86('0x78')](_0xf4e5c9,_[_0x6a86('0x79')](_0x441fe9,_[_0x6a86('0x7a')](_0xf4e5c9)));this[_0x6a86('0x10')][_0x441fe9[_0x6a86('0x73')]][_0x6a86('0x7b')](_0xf4e5c9);this[_0x6a86('0x12')][_0x441fe9[_0x6a86('0x73')]]=_0xf4e5c9;this[_0x6a86('0x41')](_0xf4e5c9,'queuecallerjoin');}}catch(_0x507422){logger[_0x6a86('0x3c')](_0x6a86('0x72'),_0x441fe9[_0x6a86('0x73')],util['inspect'](_0x507422,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0x1d')]=function(_0x3da7eb){try{if(this[_0x6a86('0x5d')](_0x3da7eb)){logger[_0x6a86('0x6d')](_0x6a86('0x7c'),_0x3da7eb[_0x6a86('0x73')],util[_0x6a86('0x3b')](_0x3da7eb,{'showHidden':![],'depth':null}));if(this[_0x6a86('0x10')][_0x3da7eb[_0x6a86('0x73')]]){var _0x2ce9a7=_[_0x6a86('0x7d')](this[_0x6a86('0x10')][_0x3da7eb['uniqueid']]);_0x2ce9a7[_0x6a86('0x7e')]=![];_0x2ce9a7[_0x6a86('0x7f')]=null;_0x2ce9a7[_0x6a86('0x80')]=_0x3da7eb[_0x6a86('0x80')];_0x2ce9a7[_0x6a86('0x81')]=_0x3da7eb[_0x6a86('0x81')];_0x2ce9a7[_0x6a86('0x1c')]=!![];_0x2ce9a7[_0x6a86('0x82')]=moment()[_0x6a86('0x44')](_0x6a86('0x83'));_0x2ce9a7['queuecallerexitreason']=_0x6a86('0x84');_0x2ce9a7['lastAssignedTo']=null;logger[_0x6a86('0x66')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2ce9a7[_0x6a86('0x45')],_0x2ce9a7[_0x6a86('0x52')]);this['channels'][_0x3da7eb[_0x6a86('0x73')]]=_0x2ce9a7;this[_0x6a86('0x46')](_0x2ce9a7,'queuecallerabandon');}}}catch(_0x2693a2){logger[_0x6a86('0x3c')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3da7eb['uniqueid'],util['inspect'](_0x2693a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0x1f')]=function(_0x13cde9){try{if(this[_0x6a86('0x5d')](_0x13cde9)){logger[_0x6a86('0x6d')](_0x6a86('0x85'),_0x13cde9['uniqueid'],util[_0x6a86('0x3b')](_0x13cde9,{'showHidden':![],'depth':null}));if(this[_0x6a86('0x10')][_0x13cde9[_0x6a86('0x73')]]){var _0x14dd0f=_[_0x6a86('0x7d')](this[_0x6a86('0x10')][_0x13cde9[_0x6a86('0x73')]]);_0x14dd0f[_0x6a86('0x86')]=moment()['format'](_0x6a86('0x83'));_0x14dd0f[_0x6a86('0x87')]=_0x13cde9[_0x6a86('0x87')];_0x14dd0f['connectedlinename']=_0x13cde9[_0x6a86('0x88')];logger[_0x6a86('0x66')](_0x6a86('0x89'),_0x14dd0f[_0x6a86('0x45')],_0x14dd0f[_0x6a86('0x52')],_0x13cde9[_0x6a86('0x87')],_0x13cde9[_0x6a86('0x88')]);this[_0x6a86('0x12')][_0x13cde9[_0x6a86('0x73')]]=_0x14dd0f;this['emitVoiceQueueChannelSave'](_0x14dd0f,_0x6a86('0x1e'));}}}catch(_0x56fb18){logger[_0x6a86('0x3c')]('[%s][voiceQueueReport][queuecallerleave]',_0x13cde9[_0x6a86('0x73')],util['inspect'](_0x56fb18,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a86('0xb')]['syncAgentConnect']=function(_0x404372){try{if(this[_0x6a86('0x5d')](_0x404372)){logger[_0x6a86('0x6d')](_0x6a86('0x8a'),_0x404372['uniqueid'],util[_0x6a86('0x3b')](_0x404372,{'showHidden':![],'depth':null}));if(this[_0x6a86('0x10')][_0x404372['uniqueid']]){var _0x4b647c=_['last'](this[_0x6a86('0x10')][_0x404372['uniqueid']]);_0x4b647c[_0x6a86('0x7e')]=!![];_0x4b647c['queuecallerexitreason']='COMPLETEDBYAGENT';logger['info'](_0x6a86('0x8b'),_0x4b647c['name'],_0x4b647c[_0x6a86('0x52')]);}}}catch(_0x3bff9c){logger[_0x6a86('0x3c')](_0x6a86('0x8a'),_0x404372['uniqueid'],util[_0x6a86('0x3b')](_0x3bff9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0x21')]=function(_0x341284){try{if(this['isNotNull'](_0x341284)){logger[_0x6a86('0x6d')](_0x6a86('0x8c'),_0x341284[_0x6a86('0x73')],util['inspect'](_0x341284,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x341284[_0x6a86('0x73')]]){var _0x16d9c1=_['last'](this[_0x6a86('0x10')][_0x341284[_0x6a86('0x73')]]);_0x16d9c1[_0x6a86('0x1c')]=![];_0x16d9c1[_0x6a86('0x82')]=null;_0x16d9c1['assigned']=!![];_0x16d9c1[_0x6a86('0x8d')]=_0x341284['membername'];_0x16d9c1[_0x6a86('0x80')]=_0x341284[_0x6a86('0x80')];_0x16d9c1[_0x6a86('0x7e')]=!![];_0x16d9c1['queuecallerexit']=![];_0x16d9c1[_0x6a86('0x8e')]=null;if(!_0x16d9c1['transfer']){if(_0x341284[_0x6a86('0x8f')]==_0x6a86('0x90')){_0x16d9c1[_0x6a86('0x91')]=_0x6a86('0x92');logger[_0x6a86('0x66')](_0x6a86('0x93'),_0x16d9c1[_0x6a86('0x45')],_0x16d9c1[_0x6a86('0x52')]);}else{if(_[_0x6a86('0x94')](_0x341284['channel'][_0x6a86('0x95')](),_0x6a86('0x96'))){if(this[_0x6a86('0x10')][_0x341284[_0x6a86('0x97')]]){var _0x40ec5a=_[_0x6a86('0x7d')](this[_0x6a86('0x10')][_0x341284['linkedid']]);_0x40ec5a['queuecallercomplete']=![];_0x40ec5a[_0x6a86('0x98')]=!![];_0x40ec5a['queuecallerexitAt']=moment(_0x16d9c1[_0x6a86('0x74')])[_0x6a86('0x99')](_0x341284[_0x6a86('0x80')],'seconds')[_0x6a86('0x44')](_0x6a86('0x83'));_0x40ec5a[_0x6a86('0x91')]=_0x6a86('0x9a');_0x40ec5a[_0x6a86('0x90')]=!![];_0x40ec5a[_0x6a86('0x9b')]=_0x6a86('0x9c');_0x40ec5a['transferexten']=_0x341284[_0x6a86('0x9d')];_0x40ec5a[_0x6a86('0x9e')]=_0x341284[_0x6a86('0x73')];logger[_0x6a86('0x66')](_0x6a86('0x9f'),_0x40ec5a[_0x6a86('0x45')],_0x40ec5a[_0x6a86('0x52')]);var _0x11244c=this['queueReports'][_0x341284[_0x6a86('0x97')]];this['queueReports'][_0x341284['linkedid']]=this['queueReports'][_0x341284[_0x6a86('0x73')]];this[_0x6a86('0x10')][_0x341284['uniqueid']]=_0x11244c;}}else{_0x16d9c1[_0x6a86('0x91')]=_0x6a86('0xa0')+_0x341284[_0x6a86('0x8f')][_0x6a86('0xa1')]();logger[_0x6a86('0x66')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x16d9c1[_0x6a86('0x45')],_0x16d9c1[_0x6a86('0x52')],_0x16d9c1[_0x6a86('0x91')]);}}}this['channels'][_0x341284[_0x6a86('0x73')]]=_0x16d9c1;this[_0x6a86('0x46')](_0x16d9c1,_0x6a86('0x20'));}}}catch(_0x34cc40){logger['error'](_0x6a86('0x8c'),_0x341284[_0x6a86('0x73')],util[_0x6a86('0x3b')](_0x34cc40,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6a86('0x23')]=function(_0x46275c){try{if(this[_0x6a86('0x5d')](_0x46275c)){logger[_0x6a86('0x6d')](_0x6a86('0xa2'),_0x46275c[_0x6a86('0x73')],util[_0x6a86('0x3b')](_0x46275c,{'showHidden':![],'depth':null}));this[_0x6a86('0xa3')](_0x46275c[_0x6a86('0x73')],_[_0x6a86('0x7a')](_0x46275c['variable'])[0x0],_0x46275c[_0x6a86('0xa4')]);if(this[_0x6a86('0x10')][_0x46275c[_0x6a86('0x73')]]){var _0x267682=_[_0x6a86('0x7d')](this[_0x6a86('0x10')][_0x46275c[_0x6a86('0x73')]]);if(_0x267682){if(this[_0x6a86('0x5d')](_0x46275c['variable'])&&this[_0x6a86('0x5d')](_0x46275c[_0x6a86('0xa5')][_0x6a86('0xa6')])){switch(_0x46275c[_0x6a86('0xa4')]){case _0x6a86('0xa7'):_0x267682[_0x6a86('0x98')]=![];_0x267682[_0x6a86('0x8e')]=null;break;case'TIMEOUT':_0x267682[_0x6a86('0xa8')]=_0x6a86('0xa9');_0x267682[_0x6a86('0x98')]=!![];_0x267682[_0x6a86('0x8e')]=moment()[_0x6a86('0x44')](_0x6a86('0x83'));_0x267682[_0x6a86('0x86')]=moment()[_0x6a86('0x44')](_0x6a86('0x83'));logger[_0x6a86('0x6d')](_0x6a86('0xaa'),_0x46275c[_0x6a86('0x73')],util[_0x6a86('0x3b')](_0x267682,{'showHidden':![],'depth':null}));ami[_0x6a86('0x48')]('custom:timeout',_0x267682);break;default:_0x267682[_0x6a86('0x98')]=!![];_0x267682[_0x6a86('0x8e')]=moment()['format'](_0x6a86('0x83'));_0x267682[_0x6a86('0x86')]=moment()[_0x6a86('0x44')](_0x6a86('0x83'));}_0x267682[_0x6a86('0x1c')]=![];_0x267682[_0x6a86('0x82')]=null;_0x267682[_0x6a86('0x91')]=_0x46275c[_0x6a86('0xa4')];this[_0x6a86('0x12')][_0x46275c[_0x6a86('0x73')]]=_0x267682;this['emitVoiceQueueChannelRemove'](_0x267682,_0x6a86('0xab'));}else if(this[_0x6a86('0x5d')](_0x46275c[_0x6a86('0xa5')])&&this[_0x6a86('0x5d')](_0x46275c[_0x6a86('0xa5')][_0x6a86('0xac')])){if(!_0x267682[_0x6a86('0x1c')]){_0x267682[_0x6a86('0x98')]=!![];_0x267682['queuecallerexitAt']=moment()[_0x6a86('0x44')](_0x6a86('0x83'));_0x267682[_0x6a86('0x91')]=_0x6a86('0xad');_0x267682['queuecallerleaveAt']=moment()[_0x6a86('0x44')](_0x6a86('0x83'));this[_0x6a86('0x12')][_0x46275c[_0x6a86('0x73')]]=_0x267682;}}logger[_0x6a86('0x66')](_0x6a86('0xae'),_0x46275c[_0x6a86('0x73')],_0x267682['name'],_0x267682[_0x6a86('0x52')],_[_0x6a86('0x7a')](_0x46275c[_0x6a86('0xa5')])[0x0],_0x46275c[_0x6a86('0xa4')]);_0x267682[_0x6a86('0x16')]=this[_0x6a86('0x16')][_0x46275c[_0x6a86('0x73')]];}}}}catch(_0x32f727){logger['error'](_0x6a86('0xa2'),_0x46275c[_0x6a86('0x73')],util['inspect'](_0x32f727,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6a86('0xa3')]=function(_0x1160b2,_0x645545,_0x46176c){var _0x551ebe=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x6a86('0xaf'),_0x6a86('0xb0'),_0x6a86('0xb1'),_0x6a86('0xb2'),'sipcallid','sipuri','bridgepeer','bridgepvtcallid',_0x6a86('0xb3'),_0x6a86('0xb4'),_0x6a86('0xb5'),_0x6a86('0xb6'),'membername',_0x6a86('0xb7'),'memberrealtime'];if(!_[_0x6a86('0x36')](_0x645545)&&!_[_0x6a86('0xb8')](_0x551ebe,_0x645545)){if(_['isUndefined'](this[_0x6a86('0x16')][_0x1160b2])){this['variables'][_0x1160b2]={};}this[_0x6a86('0x16')][_0x1160b2][_0x645545]=_0x46176c;}};VoiceQueueReport[_0x6a86('0xb')][_0x6a86('0xb9')]=function(_0x29fab4){try{if(this[_0x6a86('0x5d')](_0x29fab4)){logger['debug'](_0x6a86('0xba'),_0x29fab4[_0x6a86('0x73')],util[_0x6a86('0x3b')](_0x29fab4,{'showHidden':![],'depth':null}));if(this[_0x6a86('0x10')][_0x29fab4['uniqueid']]){for(var _0x520085=0x0,_0x3af902={};_0x5200850x0?_0x1725cb:0x0;this[_0xb056('0x15')][_0x3a1386['queue']][_0xb056('0x31')]=this[_0xb056('0x15')][_0x3a1386[_0xb056('0x66')]]['talking']>_[_0xb056('0x6b')](_0x3a1386[_0xb056('0x6d')])?_[_0xb056('0x6b')](_0x3a1386['loggedin']):this[_0xb056('0x15')][_0x3a1386['queue']][_0xb056('0x31')];this[_0xb056('0x4f')](this[_0xb056('0x15')][_0x3a1386['queue']],_0xb056('0x18'));}logger[_0xb056('0x46')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0xb056('0x3c')](this[_0xb056('0x15')][_0x3a1386[_0xb056('0x66')]],{'showHidden':![],'depth':null}));ami[_0xb056('0x44')](_0xb056('0x6e'),this['voiceQueues'][_0x3a1386['queue']]);}}}catch(_0xca55f9){logger['error'](_0xb056('0x6f'),util['inspect'](_0xca55f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb056('0xd')][_0xb056('0x1b')]=function(_0x315b44){logger[_0xb056('0x46')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x315b44,{'showHidden':![],'depth':null}));this[_0xb056('0x16')]=!![];};VoiceQueueReport[_0xb056('0xd')][_0xb056('0x1d')]=function(_0x21e16a){try{if(this['isNotNull'](_0x21e16a)){logger[_0xb056('0x46')]('[%s][voiceQueueReport][queuecallerjoin]',_0x21e16a[_0xb056('0x48')],util['inspect'](_0x21e16a,{'showHidden':![],'depth':null}));if(_[_0xb056('0x5f')](this['queueReports'][_0x21e16a[_0xb056('0x48')]])){this[_0xb056('0x40')][_0x21e16a[_0xb056('0x48')]]=[];this[_0xb056('0x13')][_0x21e16a['uniqueid']]={};}var _0x272534=new QueueReport();_0x272534['name']=_0x21e16a[_0xb056('0x66')];_0x272534[_0xb056('0x70')]=this[_0xb056('0x15')][_0x272534[_0xb056('0x4d')]]&&this[_0xb056('0x15')][_0x272534[_0xb056('0x4d')]][_0xb056('0x70')]?this[_0xb056('0x15')][_0x272534[_0xb056('0x4d')]][_0xb056('0x70')]||_0xb056('0x50'):_0xb056('0x50');_0x272534['queue']=_0x21e16a['queue'];_0x272534[_0xb056('0x71')]=moment()['format'](_0xb056('0x72'));_0x272534['position']=_0x21e16a[_0xb056('0x73')];_0x272534['count']=_0x21e16a['count'];_0x272534['uniqueid']=_0x21e16a[_0xb056('0x48')];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x272534[_0xb056('0x4d')],_0x272534[_0xb056('0x70')]);_[_0xb056('0x74')](_0x272534,_['pick'](_0x21e16a,_['keys'](_0x272534)));this['queueReports'][_0x21e16a[_0xb056('0x48')]][_0xb056('0x75')](_0x272534);this[_0xb056('0x13')][_0x21e16a[_0xb056('0x48')]]=_0x272534;this[_0xb056('0x45')](_0x272534,_0xb056('0x1c'));}}catch(_0x627a5e){logger[_0xb056('0x3b')](_0xb056('0x76'),_0x21e16a[_0xb056('0x48')],util[_0xb056('0x3c')](_0x627a5e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb056('0xd')][_0xb056('0x1e')]=function(_0x19243d){try{if(this['isNotNull'](_0x19243d)){logger['debug'](_0xb056('0x77'),_0x19243d['uniqueid'],util[_0xb056('0x3c')](_0x19243d,{'showHidden':![],'depth':null}));if(this[_0xb056('0x40')][_0x19243d[_0xb056('0x48')]]){var _0xc2833b=_['last'](this['queueReports'][_0x19243d[_0xb056('0x48')]]);_0xc2833b[_0xb056('0x78')]=![];_0xc2833b[_0xb056('0x79')]=null;_0xc2833b['holdtime']=_0x19243d['holdtime'];_0xc2833b[_0xb056('0x7a')]=_0x19243d[_0xb056('0x7a')];_0xc2833b['queuecallerabandon']=!![];_0xc2833b[_0xb056('0x7b')]=moment()[_0xb056('0x49')](_0xb056('0x72'));_0xc2833b[_0xb056('0x7c')]=_0xb056('0x7d');_0xc2833b[_0xb056('0x7e')]=null;logger[_0xb056('0x68')](_0xb056('0x7f'),_0xc2833b[_0xb056('0x4d')],_0xc2833b[_0xb056('0x70')]);this[_0xb056('0x13')][_0x19243d['uniqueid']]=_0xc2833b;this[_0xb056('0x42')](_0xc2833b,_0xb056('0x80'));}}}catch(_0x397617){logger['error'](_0xb056('0x77'),_0x19243d['uniqueid'],util['inspect'](_0x397617,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb056('0xd')][_0xb056('0x20')]=function(_0x2d7c96){try{if(this['isNotNull'](_0x2d7c96)){logger['debug'](_0xb056('0x81'),_0x2d7c96[_0xb056('0x48')],util['inspect'](_0x2d7c96,{'showHidden':![],'depth':null}));if(this[_0xb056('0x40')][_0x2d7c96['uniqueid']]){var _0x3b0f93=_[_0xb056('0x82')](this['queueReports'][_0x2d7c96['uniqueid']]);_0x3b0f93[_0xb056('0x83')]=moment()[_0xb056('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b0f93[_0xb056('0x84')]=_0x2d7c96['connectedlinenum'];_0x3b0f93['connectedlinename']=_0x2d7c96[_0xb056('0x85')];logger[_0xb056('0x68')](_0xb056('0x86'),_0x3b0f93[_0xb056('0x4d')],_0x3b0f93[_0xb056('0x70')],_0x2d7c96[_0xb056('0x84')],_0x2d7c96['connectedlinename']);this[_0xb056('0x13')][_0x2d7c96['uniqueid']]=_0x3b0f93;this[_0xb056('0x45')](_0x3b0f93,_0xb056('0x1f'));}}}catch(_0x4b3a43){logger[_0xb056('0x3b')](_0xb056('0x81'),_0x2d7c96['uniqueid'],util[_0xb056('0x3c')](_0x4b3a43,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xb056('0x87')]=function(_0x4fdcbd){try{if(this[_0xb056('0x5e')](_0x4fdcbd)){logger[_0xb056('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x4fdcbd[_0xb056('0x48')],util['inspect'](_0x4fdcbd,{'showHidden':![],'depth':null}));if(this[_0xb056('0x40')][_0x4fdcbd[_0xb056('0x48')]]){var _0x4bb337=_[_0xb056('0x82')](this[_0xb056('0x40')][_0x4fdcbd[_0xb056('0x48')]]);_0x4bb337[_0xb056('0x78')]=!![];_0x4bb337[_0xb056('0x7c')]='COMPLETEDBYAGENT';logger[_0xb056('0x68')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4bb337['name'],_0x4bb337['type']);}}}catch(_0x2ea984){logger[_0xb056('0x3b')](_0xb056('0x88'),_0x4fdcbd[_0xb056('0x48')],util['inspect'](_0x2ea984,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb056('0xd')][_0xb056('0x89')]=function(_0x7d93d0){try{if(this[_0xb056('0x5e')](_0x7d93d0)){logger[_0xb056('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x7d93d0[_0xb056('0x48')],util[_0xb056('0x3c')](_0x7d93d0,{'showHidden':![],'depth':null}));if(this[_0xb056('0x40')][_0x7d93d0['uniqueid']]){var _0x526035=_['last'](this['queueReports'][_0x7d93d0['uniqueid']]);_0x526035['queuecallerabandon']=![];_0x526035[_0xb056('0x7b')]=null;_0x526035[_0xb056('0x8a')]=!![];_0x526035[_0xb056('0x7e')]=_0x7d93d0[_0xb056('0x8b')];_0x526035[_0xb056('0x8c')]=_0x7d93d0[_0xb056('0x8c')];_0x526035['queuecallercomplete']=!![];_0x526035[_0xb056('0x8d')]=![];_0x526035[_0xb056('0x8e')]=null;if(!_0x526035[_0xb056('0x8f')]){if(_0x7d93d0[_0xb056('0x90')]==_0xb056('0x8f')){_0x526035[_0xb056('0x7c')]=_0xb056('0x91');logger[_0xb056('0x68')](_0xb056('0x92'),_0x526035[_0xb056('0x4d')],_0x526035['type']);}else{if(_['startsWith'](_0x7d93d0['channel'][_0xb056('0x93')](),'local/')){if(this[_0xb056('0x40')][_0x7d93d0[_0xb056('0x94')]]){var _0x397b6b=_[_0xb056('0x82')](this[_0xb056('0x40')][_0x7d93d0[_0xb056('0x94')]]);_0x397b6b[_0xb056('0x78')]=![];_0x397b6b[_0xb056('0x8d')]=!![];_0x397b6b[_0xb056('0x8e')]=moment(_0x526035['queuecallerjoinAt'])[_0xb056('0x95')](_0x7d93d0[_0xb056('0x8c')],_0xb056('0x96'))[_0xb056('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x397b6b['queuecallerexitreason']=_0xb056('0x97');_0x397b6b[_0xb056('0x8f')]=!![];_0x397b6b[_0xb056('0x98')]=_0xb056('0x99');_0x397b6b[_0xb056('0x9a')]=_0x7d93d0[_0xb056('0x9b')];_0x397b6b[_0xb056('0x9c')]=_0x7d93d0['uniqueid'];logger[_0xb056('0x68')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x397b6b[_0xb056('0x4d')],_0x397b6b[_0xb056('0x70')]);var _0x5ba4b4=this[_0xb056('0x40')][_0x7d93d0['linkedid']];this[_0xb056('0x40')][_0x7d93d0[_0xb056('0x94')]]=this[_0xb056('0x40')][_0x7d93d0[_0xb056('0x48')]];this[_0xb056('0x40')][_0x7d93d0['uniqueid']]=_0x5ba4b4;}}else{_0x526035[_0xb056('0x7c')]=_0xb056('0x9d')+_0x7d93d0[_0xb056('0x90')][_0xb056('0x9e')]();logger[_0xb056('0x68')](_0xb056('0x9f'),_0x526035[_0xb056('0x4d')],_0x526035[_0xb056('0x70')],_0x526035[_0xb056('0x7c')]);}}}this[_0xb056('0x13')][_0x7d93d0[_0xb056('0x48')]]=_0x526035;this[_0xb056('0x42')](_0x526035,_0xb056('0x21'));}}}catch(_0x19990d){logger[_0xb056('0x3b')](_0xb056('0xa0'),_0x7d93d0[_0xb056('0x48')],util[_0xb056('0x3c')](_0x19990d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb056('0xd')][_0xb056('0x23')]=function(_0x506e61){try{if(this[_0xb056('0x5e')](_0x506e61)){logger[_0xb056('0x46')](_0xb056('0xa1'),_0x506e61[_0xb056('0x48')],util[_0xb056('0x3c')](_0x506e61,{'showHidden':![],'depth':null}));this[_0xb056('0xa2')](_0x506e61[_0xb056('0x48')],_[_0xb056('0xa3')](_0x506e61[_0xb056('0xa4')])[0x0],_0x506e61[_0xb056('0xa5')]);if(this[_0xb056('0x40')][_0x506e61['uniqueid']]){var _0x559de5=_[_0xb056('0x82')](this['queueReports'][_0x506e61[_0xb056('0x48')]]);if(_0x559de5){if(this[_0xb056('0x5e')](_0x506e61[_0xb056('0xa4')])&&this['isNotNull'](_0x506e61[_0xb056('0xa4')][_0xb056('0xa6')])){switch(_0x506e61['value']){case'CONTINUE':_0x559de5[_0xb056('0x8d')]=![];_0x559de5[_0xb056('0x8e')]=null;break;case _0xb056('0xa7'):_0x559de5[_0xb056('0xa8')]=_0xb056('0xa9');_0x559de5['queuecallerexit']=!![];_0x559de5['queuecallerexitAt']=moment()[_0xb056('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x559de5[_0xb056('0x83')]=moment()[_0xb056('0x49')](_0xb056('0x72'));logger[_0xb056('0x46')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x506e61[_0xb056('0x48')],util[_0xb056('0x3c')](_0x559de5,{'showHidden':![],'depth':null}));ami[_0xb056('0x44')](_0xb056('0xaa'),_0x559de5);break;default:_0x559de5[_0xb056('0x8d')]=!![];_0x559de5[_0xb056('0x8e')]=moment()[_0xb056('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x559de5[_0xb056('0x83')]=moment()[_0xb056('0x49')](_0xb056('0x72'));}_0x559de5[_0xb056('0x80')]=![];_0x559de5[_0xb056('0x7b')]=null;_0x559de5[_0xb056('0x7c')]=_0x506e61[_0xb056('0xa5')];this['channels'][_0x506e61[_0xb056('0x48')]]=_0x559de5;this[_0xb056('0x42')](_0x559de5,_0xb056('0xab'));}else if(this['isNotNull'](_0x506e61['variable'])&&this[_0xb056('0x5e')](_0x506e61['variable']['queueposition'])){if(!_0x559de5[_0xb056('0x80')]){_0x559de5[_0xb056('0x8d')]=!![];_0x559de5[_0xb056('0x8e')]=moment()[_0xb056('0x49')](_0xb056('0x72'));_0x559de5[_0xb056('0x7c')]=_0xb056('0xac');_0x559de5[_0xb056('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb056('0x13')][_0x506e61[_0xb056('0x48')]]=_0x559de5;}}logger[_0xb056('0x68')](_0xb056('0xad'),_0x506e61[_0xb056('0x48')],_0x559de5[_0xb056('0x4d')],_0x559de5['type'],_['keys'](_0x506e61['variable'])[0x0],_0x506e61[_0xb056('0xa5')]);_0x559de5['variables']=this[_0xb056('0x17')][_0x506e61['uniqueid']];}}}}catch(_0x5edbc2){logger[_0xb056('0x3b')](_0xb056('0xa1'),_0x506e61[_0xb056('0x48')],util[_0xb056('0x3c')](_0x5edbc2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb056('0xd')][_0xb056('0xa2')]=function(_0x5729b7,_0x3b52c4,_0x15fa8a){var _0x3b9a6a=[_0xb056('0xae'),_0xb056('0xaf'),'rtpaudioqosjitter',_0xb056('0xb0'),_0xb056('0xb1'),_0xb056('0xb2'),_0xb056('0xb3'),_0xb056('0xb4'),_0xb056('0xb5'),_0xb056('0xb6'),_0xb056('0xb7'),_0xb056('0xb8'),_0xb056('0xb9'),_0xb056('0xba'),'memberinterface',_0xb056('0xbb'),_0xb056('0x8b'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x3b52c4)&&!_['includes'](_0x3b9a6a,_0x3b52c4)){if(_[_0xb056('0x5f')](this[_0xb056('0x17')][_0x5729b7])){this[_0xb056('0x17')][_0x5729b7]={};}this[_0xb056('0x17')][_0x5729b7][_0x3b52c4]=_0x15fa8a;}};VoiceQueueReport[_0xb056('0xd')][_0xb056('0x24')]=function(_0x311a23){try{if(this['isNotNull'](_0x311a23)){logger[_0xb056('0x46')]('[%s][voiceQueueReport][hangup]',_0x311a23['uniqueid'],util[_0xb056('0x3c')](_0x311a23,{'showHidden':![],'depth':null}));if(this[_0xb056('0x40')][_0x311a23[_0xb056('0x48')]]){for(var _0x3bbb69=0x0,_0x363eb4={};_0x3bbb69=0x0?moment(_0xc8fa9[_0x8c1b('0x18')])[_0x8c1b('0xe')](_0xc8fa9[_0x8c1b('0x19')],_0x8c1b('0xf')):null,'data1':_0x8c1b('0x1a'),'data2':_0xc8fa9['accountcode'],'data3':_0xc8fa9[_0x8c1b('0x12')],'data4':_0xc8fa9[_0x8c1b('0x1b')]||null,'role':_0x8c1b('0x14'),'internal':_0xc8fa9[_0x8c1b('0x15')]?_[_0x8c1b('0x1c')](_0xc8fa9['accountcode']):undefined,'uniqueid':_0xc8fa9[_0x8c1b('0x16')]},'log':_0x8c1b('0x1d')});}; \ No newline at end of file +var _0xe31f=['voice','lastAssignedTo','interface','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','accountcode','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','outbound','dialstring','agent','toNumber','moment','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport'];(function(_0x51308d,_0x42cf02){var _0x37cde8=function(_0x527de4){while(--_0x527de4){_0x51308d['push'](_0x51308d['shift']());}};_0x37cde8(++_0x42cf02);}(_0xe31f,0xfe));var _0xfe31=function(_0x7c96dc,_0x32d2b8){_0x7c96dc=_0x7c96dc-0x0;var _0x585fea=_0xe31f[_0x7c96dc];return _0x585fea;};'use strict';var moment=require(_0xfe31('0x0'));var _=require('lodash');var util=require('util');var client=require(_0xfe31('0x1'));exports[_0xfe31('0x2')]=function(_0x262517){var _0x16a007=_0x262517['queuecallercompleteAt']||_0x262517[_0xfe31('0x3')];return client[_0xfe31('0x4')](_0xfe31('0x5'),{'body':{'channel':_0xfe31('0x6'),'membername':_0x262517[_0xfe31('0x7')],'interface':_['isNil'](_0x262517[_0xfe31('0x8')])?util['format']('SIP/%s',_0x262517['lastAssignedTo']):_0x262517['interface'],'type':'TALKING','enterAt':_0x262517[_0xfe31('0x9')],'exitAt':_0x16a007,'duration':moment(_0x16a007)[_0xfe31('0xa')](_0x262517[_0xfe31('0x9')],_0xfe31('0xb')),'data1':_0xfe31('0xc'),'data2':_0x262517[_0xfe31('0xd')],'data3':_0x262517[_0xfe31('0xe')],'data4':null,'data5':_0x262517['queue'],'role':'agent','internal':_0x262517[_0xfe31('0xf')]?_['toNumber'](_0x262517[_0xfe31('0xf')]):undefined,'uniqueid':_0x262517[_0xfe31('0x10')]},'log':_0xfe31('0x5')});};exports[_0xfe31('0x11')]=function(_0x2f953b){return client[_0xfe31('0x4')](_0xfe31('0x5'),{'body':{'channel':_0xfe31('0x6'),'membername':_0x2f953b[_0xfe31('0x12')],'interface':_0x2f953b['interface'],'type':_0xfe31('0x13'),'enterAt':_0x2f953b[_0xfe31('0x14')],'exitAt':_0x2f953b['endtime'],'duration':moment(_0x2f953b[_0xfe31('0x15')])[_0xfe31('0xa')](_0x2f953b['starttime'],'seconds')>=0x0?moment(_0x2f953b[_0xfe31('0x15')])[_0xfe31('0xa')](_0x2f953b[_0xfe31('0x14')],_0xfe31('0xb')):null,'data1':_0xfe31('0x16'),'data2':_0x2f953b[_0xfe31('0xf')],'data3':_0x2f953b['exten'],'data4':_0x2f953b[_0xfe31('0x17')]||null,'role':_0xfe31('0x18'),'internal':_0x2f953b[_0xfe31('0xf')]?_[_0xfe31('0x19')](_0x2f953b['accountcode']):undefined,'uniqueid':_0x2f953b['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 1da25f9..d3b7f4d 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 _0xf290=['name','html','getTemplates','GetTemplate'];(function(_0x4a5101,_0x2a6f87){var _0x28b52b=function(_0x41d05e){while(--_0x41d05e){_0x4a5101['push'](_0x4a5101['shift']());}};_0x28b52b(++_0x2a6f87);}(_0xf290,0xde));var _0x0f29=function(_0xcfc44,_0x179bc1){_0xcfc44=_0xcfc44-0x0;var _0x307a25=_0xf290[_0xcfc44];return _0x307a25;};'use strict';var client=require('../client');exports[_0x0f29('0x0')]=function(_0x550692){return function(_0x1d35f0){return client['Request'](_0x0f29('0x1'),{'options':{'raw':!![],'attributes':['id',_0x0f29('0x2'),_0x0f29('0x3')]},'log':_0x0f29('0x1')});};}; \ No newline at end of file +var _0xd64b=['GetTemplate','name','html','../client','Request'];(function(_0x337203,_0x59288d){var _0x2afa35=function(_0x332984){while(--_0x332984){_0x337203['push'](_0x337203['shift']());}};_0x2afa35(++_0x59288d);}(_0xd64b,0xc1));var _0xbd64=function(_0x3909fb,_0x441482){_0x3909fb=_0x3909fb-0x0;var _0x202835=_0xd64b[_0x3909fb];return _0x202835;};'use strict';var client=require(_0xbd64('0x0'));exports['getTemplates']=function(_0xf0de04){return function(_0x4bfb7c){return client[_0xbd64('0x1')](_0xbd64('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbd64('0x3'),_0xbd64('0x4')]},'log':_0xbd64('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 24c0481..e0e7bcf 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 _0xdb53=['data4','data7','GetTrigger','../client','getTriggers','Request','name','channel','AllConditions','field','operator','AnyConditions','value','Action','data2','data3'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb53,0x183));var _0x3db5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdb53[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3db5('0x0'));exports[_0x3db5('0x1')]=function(_0x4e8bb5){return function(_0x2ee2b2){return client[_0x3db5('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x3db5('0x3'),_0x3db5('0x4'),'status'],'include':[{'model':'Condition','as':_0x3db5('0x5'),'attributes':['id',_0x3db5('0x6'),_0x3db5('0x7'),'value']},{'model':'Condition','as':_0x3db5('0x8'),'attributes':['id','field',_0x3db5('0x7'),_0x3db5('0x9')]},{'model':_0x3db5('0xa'),'as':'Actions','attributes':['id','action','data1',_0x3db5('0xb'),_0x3db5('0xc'),_0x3db5('0xd'),'data5','data6',_0x3db5('0xe')]}]},'log':_0x3db5('0xf')});};}; \ No newline at end of file +var _0x7919=['GetTrigger','name','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','data1','data2','data3','data5','data6','../client','getTriggers','Request'];(function(_0x24b62d,_0xd49554){var _0x1b6142=function(_0x117952){while(--_0x117952){_0x24b62d['push'](_0x24b62d['shift']());}};_0x1b6142(++_0xd49554);}(_0x7919,0x75));var _0x9791=function(_0x2dc10b,_0x146928){_0x2dc10b=_0x2dc10b-0x0;var _0x254511=_0x7919[_0x2dc10b];return _0x254511;};'use strict';var client=require(_0x9791('0x0'));exports[_0x9791('0x1')]=function(_0x15ca28){return function(_0x5a1ab1){return client[_0x9791('0x2')](_0x9791('0x3'),{'options':{'raw':![],'attributes':['id',_0x9791('0x4'),_0x9791('0x5'),_0x9791('0x6')],'include':[{'model':'Condition','as':_0x9791('0x7'),'attributes':['id',_0x9791('0x8'),_0x9791('0x9'),_0x9791('0xa')]},{'model':_0x9791('0xb'),'as':_0x9791('0xc'),'attributes':['id',_0x9791('0x8'),_0x9791('0x9'),_0x9791('0xa')]},{'model':_0x9791('0xd'),'as':_0x9791('0xe'),'attributes':['id','action',_0x9791('0xf'),_0x9791('0x10'),_0x9791('0x11'),'data4',_0x9791('0x12'),_0x9791('0x13'),'data7']}]},'log':_0x9791('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 119a7f2..0092949 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 _0x98d0=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x98d0,0x1cf));var _0x098d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x98d0[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x098d('0x0'));exports[_0x098d('0x1')]=function(_0x3dfe90){return function(_0xbe9356){return client[_0x098d('0x2')](_0x098d('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x098d('0x4'),_0x098d('0x5')]},'log':_0x098d('0x3')});};}; \ No newline at end of file +var _0xa4a3=['name','../client','getTrunks','GetTrunk'];(function(_0x15affd,_0x32f20c){var _0x2f36b3=function(_0x3496f6){while(--_0x3496f6){_0x15affd['push'](_0x15affd['shift']());}};_0x2f36b3(++_0x32f20c);}(_0xa4a3,0x185));var _0x3a4a=function(_0x5a2db8,_0x409f2a){_0x5a2db8=_0x5a2db8-0x0;var _0x28b4f8=_0xa4a3[_0x5a2db8];return _0x28b4f8;};'use strict';var client=require(_0x3a4a('0x0'));exports[_0x3a4a('0x1')]=function(_0x15a906){return function(_0x2816d5){return client['Request'](_0x3a4a('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3a4a('0x3'),'registry']},'log':_0x3a4a('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 58c77f8..658ef4c 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 _0x8b56=['../client','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','online','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','lastLoginAt'];(function(_0x4f067e,_0x406536){var _0x3930d1=function(_0x326249){while(--_0x326249){_0x4f067e['push'](_0x4f067e['shift']());}};_0x3930d1(++_0x406536);}(_0x8b56,0x152));var _0x68b5=function(_0x27855,_0x3caf49){_0x27855=_0x27855-0x0;var _0x24c6f4=_0x8b56[_0x27855];return _0x24c6f4;};'use strict';var client=require(_0x68b5('0x0'));exports[_0x68b5('0x1')]=function(){return function(){return client[_0x68b5('0x2')](_0x68b5('0x3'),{'options':{'raw':![],'where':{'role':_0x68b5('0x4')},'attributes':['id',_0x68b5('0x5'),_0x68b5('0x6'),_0x68b5('0x7'),_0x68b5('0x8'),_0x68b5('0x9'),'lastLoginAt',_0x68b5('0xa'),_0x68b5('0xb'),_0x68b5('0xc'),_0x68b5('0xd'),_0x68b5('0xe'),_0x68b5('0xf')]},'log':_0x68b5('0x1')});};};exports[_0x68b5('0x10')]=function(){return function(){return client['Request'](_0x68b5('0x3'),{'options':{'raw':!![],'where':{'role':_0x68b5('0x11')},'attributes':['id',_0x68b5('0x5'),_0x68b5('0x7'),_0x68b5('0x12')]},'log':'getTelephones'});};};exports['savePause']=function(_0x50279a,_0x590cba,_0x19f635){return client[_0x68b5('0x2')](_0x68b5('0x13'),{'body':{'type':_0x590cba,'uniqueid':_0x19f635},'options':{'where':{'id':_0x50279a['id']}},'log':_0x68b5('0x14')});};exports[_0x68b5('0x15')]=function(_0x595bf1){return client[_0x68b5('0x2')](_0x68b5('0x16'),{'body':{},'options':{'where':{'id':_0x595bf1['id']}},'log':_0x68b5('0x14')});};exports[_0x68b5('0x17')]=function(_0x326d4f){return client[_0x68b5('0x2')](_0x68b5('0x18'),{'options':{'raw':![],'where':{'role':_0x68b5('0x4'),'id':_0x326d4f},'attributes':['id',_0x68b5('0x5'),_0x68b5('0x6'),'accountcode',_0x68b5('0x8'),_0x68b5('0x9'),_0x68b5('0x19'),_0x68b5('0xa'),'lastPauseAt','voicePause',_0x68b5('0xf')]},'log':_0x68b5('0x17')});}; \ No newline at end of file +var _0x8217=['getTelephones','Request','GetUser','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','agent','fullname','lastLoginAt','../client','getAgents','name','email','accountcode','online','pauseType','lastPauseAt','voicePause','phone','mobile','interface'];(function(_0x444c49,_0x1a80eb){var _0x128494=function(_0x4c8df7){while(--_0x4c8df7){_0x444c49['push'](_0x444c49['shift']());}};_0x128494(++_0x1a80eb);}(_0x8217,0x120));var _0x7821=function(_0x2c27ed,_0x5c50f0){_0x2c27ed=_0x2c27ed-0x0;var _0x597bd1=_0x8217[_0x2c27ed];return _0x597bd1;};'use strict';var client=require(_0x7821('0x0'));exports[_0x7821('0x1')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x7821('0x2'),_0x7821('0x3'),_0x7821('0x4'),'fullname',_0x7821('0x5'),'lastLoginAt',_0x7821('0x6'),_0x7821('0x7'),_0x7821('0x8'),_0x7821('0x9'),_0x7821('0xa'),_0x7821('0xb')]},'log':_0x7821('0x1')});};};exports[_0x7821('0xc')]=function(){return function(){return client[_0x7821('0xd')](_0x7821('0xe'),{'options':{'raw':!![],'where':{'role':_0x7821('0xf')},'attributes':['id',_0x7821('0x2'),_0x7821('0x4'),_0x7821('0x10')]},'log':_0x7821('0xc')});};};exports[_0x7821('0x11')]=function(_0x5c427b,_0x4ebbc8,_0x445f0a){return client[_0x7821('0xd')](_0x7821('0x12'),{'body':{'type':_0x4ebbc8,'uniqueid':_0x445f0a},'options':{'where':{'id':_0x5c427b['id']}},'log':'savePause'});};exports[_0x7821('0x13')]=function(_0x4c01a5){return client[_0x7821('0xd')](_0x7821('0x14'),{'body':{},'options':{'where':{'id':_0x4c01a5['id']}},'log':_0x7821('0x11')});};exports[_0x7821('0x15')]=function(_0x53f5bf){return client[_0x7821('0xd')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x7821('0x16'),'id':_0x53f5bf},'attributes':['id',_0x7821('0x2'),_0x7821('0x3'),_0x7821('0x4'),_0x7821('0x17'),_0x7821('0x5'),_0x7821('0x18'),'pauseType',_0x7821('0x7'),_0x7821('0x8'),_0x7821('0xb')]},'log':_0x7821('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 96a2022..d199b61 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 _0x1502=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x32e1df,_0x446aba){var _0x3a43d2=function(_0x242b1a){while(--_0x242b1a){_0x32e1df['push'](_0x32e1df['shift']());}};_0x3a43d2(++_0x446aba);}(_0x1502,0x1c3));var _0x2150=function(_0x699c07,_0x32e2fd){_0x699c07=_0x699c07-0x0;var _0x555417=_0x1502[_0x699c07];return _0x555417;};'use strict';var client=require(_0x2150('0x0'));exports[_0x2150('0x1')]=function(_0x3edf3f){return client[_0x2150('0x2')](_0x2150('0x3'),{'body':_0x3edf3f,'log':_0x2150('0x3')});};exports['update']=function(_0x36f495,_0x36d4c1,_0x42536d){return client[_0x2150('0x2')]('UpdateVoiceAgentReport',{'body':_0x36f495,'options':{'where':{'uniqueid':_0x36d4c1,'interface':_0x42536d,'agentcomplete':!![]}},'log':_0x2150('0x4')});}; \ No newline at end of file +var _0xf0dc=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x1ff4c6,_0x3384d6){var _0x104cf4=function(_0x459fd0){while(--_0x459fd0){_0x1ff4c6['push'](_0x1ff4c6['shift']());}};_0x104cf4(++_0x3384d6);}(_0xf0dc,0x1f3));var _0xcf0d=function(_0x30fc4f,_0x553a2b){_0x30fc4f=_0x30fc4f-0x0;var _0x55a51e=_0xf0dc[_0x30fc4f];return _0x55a51e;};'use strict';var client=require('../client');exports[_0xcf0d('0x0')]=function(_0x3dff4e){return client[_0xcf0d('0x1')](_0xcf0d('0x2'),{'body':_0x3dff4e,'log':'CreateVoiceAgentReport'});};exports[_0xcf0d('0x3')]=function(_0x3d38fa,_0x18e206,_0x3aa2e7){return client[_0xcf0d('0x1')](_0xcf0d('0x4'),{'body':_0x3d38fa,'options':{'where':{'uniqueid':_0x18e206,'interface':_0x3aa2e7,'agentcomplete':!![]}},'log':_0xcf0d('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 375ab6d..db84c13 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 _0x0247=['duration','billableseconds','GetVoiceCallReports','moment','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type'];(function(_0x453323,_0x495f1d){var _0x108773=function(_0x1d9070){while(--_0x1d9070){_0x453323['push'](_0x453323['shift']());}};_0x108773(++_0x495f1d);}(_0x0247,0x1a1));var _0x7024=function(_0x106732,_0x43a593){_0x106732=_0x106732-0x0;var _0x60c65c=_0x0247[_0x106732];return _0x60c65c;};'use strict';var moment=require(_0x7024('0x0'));var util=require('util');var _=require(_0x7024('0x1'));var client=require(_0x7024('0x2'));exports[_0x7024('0x3')]=function(_0x4b9da6){return client[_0x7024('0x4')](_0x7024('0x5'),{'body':_[_0x7024('0x6')](_0x4b9da6,{'source':_0x4b9da6[_0x7024('0x7')],'destinationcontext':_0x4b9da6[_0x7024('0x8')],'callerid':_0x4b9da6[_0x7024('0x9')],'amaflags':_0x7024('0xa')}),'log':'CreateVoiceCallReport'});};exports[_0x7024('0xb')]=function(){return function(){return client[_0x7024('0x4')](_0x7024('0xc'),{'options':{'where':{'type':[_0x7024('0xd')],'createdAt':{'$between':[moment()[_0x7024('0xe')](_0x7024('0xf'))[_0x7024('0x10')](_0x7024('0x11')),moment()[_0x7024('0x12')](_0x7024('0xf'))[_0x7024('0x10')](_0x7024('0x11'))]}},'attributes':[_0x7024('0x13'),'disposition',_0x7024('0x14'),_0x7024('0x15')]},'log':_0x7024('0x16')});};}; \ No newline at end of file +var _0x9802=['calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','disposition','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge'];(function(_0xc153db,_0x516c10){var _0x4dc97d=function(_0x10fc05){while(--_0x10fc05){_0xc153db['push'](_0xc153db['shift']());}};_0x4dc97d(++_0x516c10);}(_0x9802,0x125));var _0x2980=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9802[_0x2e4aa2];return _0x5e6092;};'use strict';var moment=require('moment');var util=require(_0x2980('0x0'));var _=require(_0x2980('0x1'));var client=require(_0x2980('0x2'));exports[_0x2980('0x3')]=function(_0x2482fc){return client[_0x2980('0x4')](_0x2980('0x5'),{'body':_[_0x2980('0x6')](_0x2482fc,{'source':_0x2482fc[_0x2980('0x7')],'destinationcontext':_0x2482fc[_0x2980('0x8')],'callerid':_0x2482fc['callerid'],'amaflags':_0x2980('0x9')}),'log':_0x2980('0x5')});};exports[_0x2980('0xa')]=function(){return function(){return client[_0x2980('0x4')](_0x2980('0xb'),{'options':{'where':{'type':[_0x2980('0xc')],'createdAt':{'$between':[moment()[_0x2980('0xd')](_0x2980('0xe'))['format'](_0x2980('0xf')),moment()[_0x2980('0x10')](_0x2980('0xe'))[_0x2980('0x11')](_0x2980('0xf'))]}},'attributes':['type',_0x2980('0x12'),'duration','billableseconds']},'log':_0x2980('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 5e95618..89e7a92 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 _0x58a1=['../client','CreateVoiceDialReport'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x58a1,0x98));var _0x158a=function(_0x16dbab,_0x3ac1e1){_0x16dbab=_0x16dbab-0x0;var _0x59b0b2=_0x58a1[_0x16dbab];return _0x59b0b2;};'use strict';var client=require(_0x158a('0x0'));exports['create']=function(_0x349c50){return client['Request'](_0x158a('0x1'),{'body':_0x349c50,'log':_0x158a('0x1')});}; \ No newline at end of file +var _0x6127=['../client','create','CreateVoiceDialReport'];(function(_0x19a251,_0x3c3a97){var _0x1b08d0=function(_0x5f4083){while(--_0x5f4083){_0x19a251['push'](_0x19a251['shift']());}};_0x1b08d0(++_0x3c3a97);}(_0x6127,0xf3));var _0x7612=function(_0x4e5ee5,_0x1acb8a){_0x4e5ee5=_0x4e5ee5-0x0;var _0x3e5776=_0x6127[_0x4e5ee5];return _0x3e5776;};'use strict';var client=require(_0x7612('0x0'));exports[_0x7612('0x1')]=function(_0x152779){return client['Request']('CreateVoiceDialReport',{'body':_0x152779,'log':_0x7612('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 429c4a4..8a98ed2 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 _0x4639=['recordingFormat','getVoiceExtensions','../client','GetVoiceExtension','exten'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4639,0x115));var _0x9463=function(_0x255be9,_0x3345d9){_0x255be9=_0x255be9-0x0;var _0x34fedf=_0x4639[_0x255be9];return _0x34fedf;};'use strict';var client=require(_0x9463('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x9463('0x1'),{'options':{'raw':!![],'attributes':['id',_0x9463('0x2'),_0x9463('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x9463('0x4')});};}; \ No newline at end of file +var _0x6351=['GetVoiceExtension','exten','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x201842,_0x2be55e){var _0x2f3a07=function(_0x159592){while(--_0x159592){_0x201842['push'](_0x201842['shift']());}};_0x2f3a07(++_0x2be55e);}(_0x6351,0x12f));var _0x1635=function(_0x73e726,_0x5a9c29){_0x73e726=_0x73e726-0x0;var _0x261d0c=_0x6351[_0x73e726];return _0x261d0c;};'use strict';var client=require(_0x1635('0x0'));exports[_0x1635('0x1')]=function(){return function(){return client[_0x1635('0x2')](_0x1635('0x3'),{'options':{'raw':!![],'attributes':['id',_0x1635('0x4'),_0x1635('0x5')],'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 2b24a62..7e0d51c 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 _0x5f0d=['mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause'];(function(_0x5b7030,_0x387b0b){var _0x198515=function(_0x1d7987){while(--_0x1d7987){_0x5b7030['push'](_0x5b7030['shift']());}};_0x198515(++_0x387b0b);}(_0x5f0d,0x1dd));var _0xd5f0=function(_0x39942c,_0x4f77ee){_0x39942c=_0x39942c-0x0;var _0x57f8c9=_0x5f0d[_0x39942c];return _0x57f8c9;};'use strict';var client=require(_0xd5f0('0x0'));exports[_0xd5f0('0x1')]=function(){return function(){return client[_0xd5f0('0x2')](_0xd5f0('0x3'),{'options':{'raw':![],'attributes':['id',_0xd5f0('0x4'),_0xd5f0('0x5'),_0xd5f0('0x6'),'autopause',_0xd5f0('0x7'),_0xd5f0('0x8'),_0xd5f0('0x9'),_0xd5f0('0xa'),'dialLimitChannel',_0xd5f0('0xb'),_0xd5f0('0xc'),'dialPredictiveOptimization',_0xd5f0('0xd'),'dialPredictiveInterval',_0xd5f0('0xe'),_0xd5f0('0xf'),'dialOriginateTimeout','dialQueueOptions','dialQueueTimeout',_0xd5f0('0x10'),_0xd5f0('0x11'),_0xd5f0('0x12'),_0xd5f0('0x13'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0xd5f0('0x14'),_0xd5f0('0x15'),_0xd5f0('0x16'),_0xd5f0('0x17'),_0xd5f0('0x18'),_0xd5f0('0x19'),_0xd5f0('0x1a'),_0xd5f0('0x1b'),_0xd5f0('0x1c'),_0xd5f0('0x1d'),'dialAMDMinWordLength',_0xd5f0('0x1e'),_0xd5f0('0x1f'),_0xd5f0('0x20'),_0xd5f0('0x21'),_0xd5f0('0x22'),_0xd5f0('0x23'),_0xd5f0('0x24'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0xd5f0('0x25'),_0xd5f0('0x26'),_0xd5f0('0x7'),_0xd5f0('0x27'),_0xd5f0('0x28'),'dialCutDigit',_0xd5f0('0x29'),'dialNoSuchNumberRetryFrequency',_0xd5f0('0x2a'),'dialDropRetryFrequency',_0xd5f0('0x2b'),_0xd5f0('0x2c'),'dialMachineMaxRetry',_0xd5f0('0x2d'),'dialAgentRejectMaxRetry',_0xd5f0('0x2e'),_0xd5f0('0x2f'),_0xd5f0('0x30'),_0xd5f0('0x31')],'include':[{'model':_0xd5f0('0x32'),'as':_0xd5f0('0x32'),'attributes':['id',_0xd5f0('0x4'),_0xd5f0('0x33'),_0xd5f0('0x34')]},{'model':_0xd5f0('0x35'),'as':_0xd5f0('0x36'),'attributes':['id',_0xd5f0('0x4')]},{'model':'Trunk','as':_0xd5f0('0x37'),'attributes':['id',_0xd5f0('0x4'),'callerid',_0xd5f0('0x34')]},{'model':_0xd5f0('0x38'),'as':_0xd5f0('0x38'),'attributes':['id',_0xd5f0('0x4')],'include':[{'model':_0xd5f0('0x38'),'as':_0xd5f0('0x39'),'attributes':['id',_0xd5f0('0x4'),_0xd5f0('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x4f23=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','getVoiceQueues','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x5d04af,_0x11f556){var _0x4cd1d9=function(_0x2879d4){while(--_0x2879d4){_0x5d04af['push'](_0x5d04af['shift']());}};_0x4cd1d9(++_0x11f556);}(_0x4f23,0x198));var _0x34f2=function(_0x11d39b,_0x512cf1){_0x11d39b=_0x11d39b-0x0;var _0x3fd8b3=_0x4f23[_0x11d39b];return _0x3fd8b3;};'use strict';var client=require('../client');exports[_0x34f2('0x0')]=function(){return function(){return client['Request'](_0x34f2('0x1'),{'options':{'raw':![],'attributes':['id',_0x34f2('0x2'),'acw',_0x34f2('0x3'),_0x34f2('0x4'),_0x34f2('0x5'),_0x34f2('0x6'),_0x34f2('0x7'),'dialMethod',_0x34f2('0x8'),'dialLimitQueue',_0x34f2('0x9'),_0x34f2('0xa'),_0x34f2('0xb'),_0x34f2('0xc'),_0x34f2('0xd'),_0x34f2('0xe'),_0x34f2('0xf'),_0x34f2('0x10'),_0x34f2('0x11'),_0x34f2('0x12'),_0x34f2('0x13'),_0x34f2('0x14'),'dialBusyMaxRetry',_0x34f2('0x15'),_0x34f2('0x16'),_0x34f2('0x17'),_0x34f2('0x18'),_0x34f2('0x19'),_0x34f2('0x1a'),_0x34f2('0x1b'),_0x34f2('0x1c'),_0x34f2('0x1d'),_0x34f2('0x1e'),'dialAMDGreeting',_0x34f2('0x1f'),_0x34f2('0x20'),_0x34f2('0x21'),_0x34f2('0x22'),_0x34f2('0x23'),_0x34f2('0x24'),'dialAMDMaximumWordLength',_0x34f2('0x25'),_0x34f2('0x26'),'dialRecallInQueue',_0x34f2('0x27'),_0x34f2('0x28'),_0x34f2('0x29'),_0x34f2('0x2a'),'monitor_format',_0x34f2('0x2b'),'dialRandomLastDigitCallerIdNumber',_0x34f2('0x2c'),'dialNoSuchNumberMaxRetry',_0x34f2('0x2d'),_0x34f2('0x2e'),_0x34f2('0x2f'),_0x34f2('0x30'),_0x34f2('0x31'),'dialMachineMaxRetry',_0x34f2('0x32'),_0x34f2('0x33'),_0x34f2('0x34'),_0x34f2('0x35'),_0x34f2('0x36'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x34f2('0x37'),'as':_0x34f2('0x37'),'attributes':['id','name',_0x34f2('0x38'),_0x34f2('0x39')]},{'model':_0x34f2('0x3a'),'as':_0x34f2('0x3b'),'attributes':['id','name']},{'model':_0x34f2('0x37'),'as':_0x34f2('0x3c'),'attributes':['id',_0x34f2('0x2'),_0x34f2('0x38'),_0x34f2('0x39')]},{'model':_0x34f2('0x3d'),'as':_0x34f2('0x3d'),'attributes':['id',_0x34f2('0x2')],'include':[{'model':_0x34f2('0x3d'),'as':'Intervals','attributes':['id',_0x34f2('0x2'),_0x34f2('0x3e')]}]}]},'log':_0x34f2('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index dde51cb..da6727e 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 _0xa1ae=['queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','moment','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','day','YYYY-MM-DD\x20HH:mm:ss','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x368d18,_0x48787a){var _0x81e6c9=function(_0x1a18fb){while(--_0x1a18fb){_0x368d18['push'](_0x368d18['shift']());}};_0x81e6c9(++_0x48787a);}(_0xa1ae,0x134));var _0xea1a=function(_0x55ba45,_0x2d7694){_0x55ba45=_0x55ba45-0x0;var _0x59d7ab=_0xa1ae[_0x55ba45];return _0x59d7ab;};'use strict';var moment=require(_0xea1a('0x0'));var _=require('lodash');var client=require(_0xea1a('0x1'));exports[_0xea1a('0x2')]=function(_0x4cbe33){return client[_0xea1a('0x3')](_0xea1a('0x4'),{'body':_0x4cbe33,'log':_0xea1a('0x4')});};exports[_0xea1a('0x5')]=function(){return function(){return client['Request'](_0xea1a('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xea1a('0x7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf'](_0xea1a('0x7'))['format'](_0xea1a('0x8'))]}},'attributes':[_0xea1a('0x9'),_0xea1a('0xa'),_0xea1a('0xb'),_0xea1a('0xc'),_0xea1a('0xd'),_0xea1a('0xe'),_0xea1a('0xf'),_0xea1a('0x10'),_0xea1a('0x11'),_0xea1a('0x12')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x63b5=['queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','queuecallerjoinAt','queuecallercomplete'];(function(_0xf3ae64,_0x372a33){var _0x1dac25=function(_0x317180){while(--_0x317180){_0xf3ae64['push'](_0xf3ae64['shift']());}};_0x1dac25(++_0x372a33);}(_0x63b5,0x125));var _0x563b=function(_0x2a6f41,_0x1f96d2){_0x2a6f41=_0x2a6f41-0x0;var _0x4c2955=_0x63b5[_0x2a6f41];return _0x4c2955;};'use strict';var moment=require(_0x563b('0x0'));var _=require('lodash');var client=require(_0x563b('0x1'));exports[_0x563b('0x2')]=function(_0x1c8b67){return client[_0x563b('0x3')](_0x563b('0x4'),{'body':_0x1c8b67,'log':_0x563b('0x4')});};exports[_0x563b('0x5')]=function(){return function(){return client[_0x563b('0x3')](_0x563b('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0x563b('0x7')](_0x563b('0x8')),moment()[_0x563b('0x9')](_0x563b('0xa'))[_0x563b('0x7')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid','queue',_0x563b('0xb'),'queuecallerleaveAt',_0x563b('0xc'),'queuecallercompleteAt',_0x563b('0xd'),_0x563b('0xe'),_0x563b('0xf'),_0x563b('0x10')]},'log':_0x563b('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 19ba20e..c3757e8 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 _0x6647=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x346256,_0x57ede0){var _0x274603=function(_0x5f2e98){while(--_0x5f2e98){_0x346256['push'](_0x346256['shift']());}};_0x274603(++_0x57ede0);}(_0x6647,0xfc));var _0x7664=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6647[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x7664('0x0'));exports[_0x7664('0x1')]=function(_0x1d2a9f){return function(){return client[_0x7664('0x2')](_0x7664('0x3'),{'options':{'where':{'VoiceQueueId':_0x1d2a9f,'paused':!![]},'raw':!![]},'log':_0x7664('0x1')});};}; \ No newline at end of file +var _0x8c21=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x478c71,_0x256526){var _0x50c512=function(_0x358f69){while(--_0x358f69){_0x478c71['push'](_0x478c71['shift']());}};_0x50c512(++_0x256526);}(_0x8c21,0x18b));var _0x18c2=function(_0x3e7fad,_0x193eab){_0x3e7fad=_0x3e7fad-0x0;var _0x25010a=_0x8c21[_0x3e7fad];return _0x25010a;};'use strict';var client=require(_0x18c2('0x0'));exports[_0x18c2('0x1')]=function(_0xa63de3){return function(){return client[_0x18c2('0x2')](_0x18c2('0x3'),{'options':{'where':{'VoiceQueueId':_0xa63de3,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 1747d0e..c1f5c85 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 _0x4b41=['monitorFilename','../client','create','Request','merge'];(function(_0x67af21,_0x8aa464){var _0x3fd88b=function(_0x32d580){while(--_0x32d580){_0x67af21['push'](_0x67af21['shift']());}};_0x3fd88b(++_0x8aa464);}(_0x4b41,0x173));var _0x14b4=function(_0x177957,_0x4fd702){_0x177957=_0x177957-0x0;var _0xf39ecd=_0x4b41[_0x177957];return _0xf39ecd;};'use strict';var _=require('lodash');var client=require(_0x14b4('0x0'));exports[_0x14b4('0x1')]=function(_0x27bc57){return client[_0x14b4('0x2')]('CreateVoiceRecording',{'body':_[_0x14b4('0x3')](_0x27bc57,{'value':_0x27bc57[_0x14b4('0x4')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0x9d17=['../client','create','Request','CreateVoiceRecording','monitorFilename','lodash'];(function(_0x2f2d20,_0x90e312){var _0x5ebd25=function(_0x1b1824){while(--_0x1b1824){_0x2f2d20['push'](_0x2f2d20['shift']());}};_0x5ebd25(++_0x90e312);}(_0x9d17,0x11f));var _0x79d1=function(_0x540c78,_0x2127ab){_0x540c78=_0x540c78-0x0;var _0x28c0e2=_0x9d17[_0x540c78];return _0x28c0e2;};'use strict';var _=require(_0x79d1('0x0'));var client=require(_0x79d1('0x1'));exports[_0x79d1('0x2')]=function(_0x4db27a){return client[_0x79d1('0x3')](_0x79d1('0x4'),{'body':_['merge'](_0x4db27a,{'value':_0x4db27a[_0x79d1('0x5')]}),'log':_0x79d1('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 0016dba..cb3e4ed 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 _0x6b2a=['transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client'];(function(_0x4581f7,_0x89ddf8){var _0x18686c=function(_0x21d74e){while(--_0x21d74e){_0x4581f7['push'](_0x4581f7['shift']());}};_0x18686c(++_0x89ddf8);}(_0x6b2a,0xe3));var _0xa6b2=function(_0x38646c,_0xc6ec4b){_0x38646c=_0x38646c-0x0;var _0x356872=_0x6b2a[_0x38646c];return _0x356872;};'use strict';var client=require(_0xa6b2('0x0'));exports[_0xa6b2('0x1')]={};exports[_0xa6b2('0x2')]=function(_0x3ab7e8){return client['Request'](_0xa6b2('0x3'),{'body':{'result':_0x3ab7e8[_0xa6b2('0x4')],'transfererchannel':_0x3ab7e8['transfererchannel'],'transferercalleridnum':_0x3ab7e8['transferercalleridnum'],'transferercalleridname':_0x3ab7e8[_0xa6b2('0x5')],'transfererconnectedlinenum':_0x3ab7e8[_0xa6b2('0x6')],'transfererconnectedlinename':_0x3ab7e8[_0xa6b2('0x7')],'transfereraccountcode':_0x3ab7e8['transfereraccountcode'],'transferercontext':_0x3ab7e8['transferercontext'],'transfererexten':_0x3ab7e8[_0xa6b2('0x8')],'transfererlinkedid':_0x3ab7e8[_0xa6b2('0x9')],'transfereechannel':_0x3ab7e8[_0xa6b2('0xa')],'transfereecalleridnum':_0x3ab7e8[_0xa6b2('0xb')],'transfereecalleridname':_0x3ab7e8['transfereecalleridname'],'transfereeconnectedlinenum':_0x3ab7e8[_0xa6b2('0xc')],'transfereeconnectedlinename':_0x3ab7e8['transfereeconnectedlinename'],'transfereeaccountcode':_0x3ab7e8[_0xa6b2('0xd')],'transfereecontext':_0x3ab7e8[_0xa6b2('0xe')],'transfereeexten':_0x3ab7e8['transfereeexten'],'transfereelinkedid':_0x3ab7e8['transfereelinkedid'],'isexternal':_0x3ab7e8[_0xa6b2('0xf')],'context':_0x3ab7e8[_0xa6b2('0x10')],'extension':_0x3ab7e8[_0xa6b2('0x11')],'type':_0xa6b2('0x12')},'log':'CreateVoiceTransferReport'});};exports[_0xa6b2('0x13')]=function(_0x2e0e56){return client['Request'](_0xa6b2('0x3'),{'body':{'result':_0x2e0e56[_0xa6b2('0x4')],'transfererchannel':_0x2e0e56[_0xa6b2('0x14')],'transferercalleridnum':_0x2e0e56[_0xa6b2('0x15')],'transferercalleridname':_0x2e0e56[_0xa6b2('0x16')],'transfererconnectedlinenum':_0x2e0e56['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2e0e56['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2e0e56[_0xa6b2('0x17')],'transferercontext':_0x2e0e56[_0xa6b2('0x18')],'transfererexten':_0x2e0e56[_0xa6b2('0x19')],'transfererlinkedid':_0x2e0e56[_0xa6b2('0x1a')],'transfereechannel':_0x2e0e56[_0xa6b2('0x1b')],'transfereecalleridnum':_0x2e0e56[_0xa6b2('0x1c')],'transfereecalleridname':_0x2e0e56[_0xa6b2('0x1d')],'transfereeconnectedlinenum':_0x2e0e56[_0xa6b2('0x1e')],'transfereeconnectedlinename':_0x2e0e56['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2e0e56[_0xa6b2('0x1f')],'transfereecontext':_0x2e0e56[_0xa6b2('0x20')],'transfereeexten':_0x2e0e56[_0xa6b2('0x21')],'transfereelinkedid':_0x2e0e56[_0xa6b2('0x22')],'isexternal':_0x2e0e56[_0xa6b2('0xf')],'context':_0x2e0e56[_0xa6b2('0x23')],'extension':_0x2e0e56[_0xa6b2('0x24')],'type':_0xa6b2('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xec38=['transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xec38,0xda));var _0x8ec3=function(_0xd4601b,_0xe664e5){_0xd4601b=_0xd4601b-0x0;var _0x5b149a=_0xec38[_0xd4601b];return _0x5b149a;};'use strict';var client=require(_0x8ec3('0x0'));exports[_0x8ec3('0x1')]={};exports[_0x8ec3('0x2')]=function(_0x1aa98a){return client[_0x8ec3('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x1aa98a[_0x8ec3('0x4')],'transfererchannel':_0x1aa98a[_0x8ec3('0x5')],'transferercalleridnum':_0x1aa98a[_0x8ec3('0x6')],'transferercalleridname':_0x1aa98a[_0x8ec3('0x7')],'transfererconnectedlinenum':_0x1aa98a['transfererconnectedlinenum'],'transfererconnectedlinename':_0x1aa98a[_0x8ec3('0x8')],'transfereraccountcode':_0x1aa98a[_0x8ec3('0x9')],'transferercontext':_0x1aa98a[_0x8ec3('0xa')],'transfererexten':_0x1aa98a[_0x8ec3('0xb')],'transfererlinkedid':_0x1aa98a[_0x8ec3('0xc')],'transfereechannel':_0x1aa98a[_0x8ec3('0xd')],'transfereecalleridnum':_0x1aa98a[_0x8ec3('0xe')],'transfereecalleridname':_0x1aa98a[_0x8ec3('0xf')],'transfereeconnectedlinenum':_0x1aa98a[_0x8ec3('0x10')],'transfereeconnectedlinename':_0x1aa98a['transfereeconnectedlinename'],'transfereeaccountcode':_0x1aa98a[_0x8ec3('0x11')],'transfereecontext':_0x1aa98a['transfereecontext'],'transfereeexten':_0x1aa98a[_0x8ec3('0x12')],'transfereelinkedid':_0x1aa98a[_0x8ec3('0x13')],'isexternal':_0x1aa98a[_0x8ec3('0x14')],'context':_0x1aa98a[_0x8ec3('0x15')],'extension':_0x1aa98a[_0x8ec3('0x16')],'type':_0x8ec3('0x17')},'log':'CreateVoiceTransferReport'});};exports[_0x8ec3('0x18')]=function(_0x284e1b){return client[_0x8ec3('0x3')](_0x8ec3('0x19'),{'body':{'result':_0x284e1b[_0x8ec3('0x4')],'transfererchannel':_0x284e1b['origtransfererchannel'],'transferercalleridnum':_0x284e1b['origtransferercalleridnum'],'transferercalleridname':_0x284e1b[_0x8ec3('0x1a')],'transfererconnectedlinenum':_0x284e1b[_0x8ec3('0x1b')],'transfererconnectedlinename':_0x284e1b[_0x8ec3('0x1c')],'transfereraccountcode':_0x284e1b[_0x8ec3('0x1d')],'transferercontext':_0x284e1b[_0x8ec3('0x1e')],'transfererexten':_0x284e1b[_0x8ec3('0x1f')],'transfererlinkedid':_0x284e1b[_0x8ec3('0x20')],'transfereechannel':_0x284e1b[_0x8ec3('0x21')],'transfereecalleridnum':_0x284e1b[_0x8ec3('0x22')],'transfereecalleridname':_0x284e1b[_0x8ec3('0x23')],'transfereeconnectedlinenum':_0x284e1b[_0x8ec3('0x24')],'transfereeconnectedlinename':_0x284e1b[_0x8ec3('0x25')],'transfereeaccountcode':_0x284e1b['transfertargetaccountcode'],'transfereecontext':_0x284e1b[_0x8ec3('0x26')],'transfereeexten':_0x284e1b['transfertargetexten'],'transfereelinkedid':_0x284e1b[_0x8ec3('0x27')],'isexternal':_0x284e1b[_0x8ec3('0x14')],'context':_0x284e1b[_0x8ec3('0x28')],'extension':_0x284e1b[_0x8ec3('0x29')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 817b7a0..6e8d82c 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 _0x20c9=['action','Command','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','push','values','channels','length','voicechannel','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','faxAccounts','checkAfterSend','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','Action','then','message','catch','pick'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0x20c9,0x183));var _0x920c=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0x20c9[_0x836465];return _0x2150ea;};'use strict';var _=require(_0x920c('0x0'));var util=require(_0x920c('0x1'));var jayson=require(_0x920c('0x2'));var schema=require(_0x920c('0x3'));var BPromise=require(_0x920c('0x4'));var moment=require(_0x920c('0x5'));var config=require(_0x920c('0x6'));var properties=require(_0x920c('0x7'));var ami=require(_0x920c('0x8'));exports[_0x920c('0x9')]=function(_0x46a517,_0x9cca9d,_0x7f0412){return new BPromise(function(_0x13eba8,_0x25723a){var _0x33bfc={'QueuePause':function(_0x297518){return new Promise(function(_0x68f544,_0x1b75ad){var _0x545794=util[_0x920c('0xa')](_0x920c('0xb'),_0x920c('0xc'),_0x297518['name']);if(_0x46a517['timers']&&_0x46a517['timers'][_0x545794]&&_0x46a517[_0x920c('0xd')][_0x545794][_0x920c('0xe')]){_0x46a517[_0x920c('0xd')][_0x545794][_0x920c('0xf')]();}if(_0x46a517[_0x920c('0x10')][_0x545794]){_0x46a517[_0x920c('0x10')][_0x545794][_0x920c('0x11')]({'statePause':_0x297518['pause']?!![]:![]});}_0x68f544({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x69f31c){var _0x57f572=this;return new Promise(function(_0x479047,_0x481120){if(ami[_0x920c('0x12')]()==![]){return _0x481120(_0x57f572[_0x920c('0x13')](0x1f4,[config[_0x920c('0x14')]['ip'],config[_0x920c('0x14')][_0x920c('0x15')],_0x920c('0x16')][_0x920c('0x17')]('\x20')));}_0x69f31c=_['pick'](_0x69f31c,_[_0x920c('0x18')](properties['module']));_0x69f31c['action']='Reload';return ami[_0x920c('0x19')](_0x69f31c)[_0x920c('0x1a')](function(_0x17183c){_0x479047({'code':0xc8,'message':_0x17183c[_0x920c('0x1b')]});})[_0x920c('0x1c')](function(_0x3921ab){_0x481120(_0x57f572[_0x920c('0x13')](0x1f5,_0x3921ab[_0x920c('0x1b')]));});});},'Command':function(_0x8bac4a){var _0x3055fe=this;return new Promise(function(_0x51a926,_0x46e8e1){if(ami[_0x920c('0x12')]()==![]){return _0x46e8e1(_0x3055fe[_0x920c('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x920c('0x14')][_0x920c('0x15')],'ami\x20disconnected'][_0x920c('0x17')]('\x20')));}_0x8bac4a=_[_0x920c('0x1d')](_0x8bac4a,'command');_0x8bac4a[_0x920c('0x1e')]=_0x920c('0x1f');return ami[_0x920c('0x19')](_0x8bac4a)[_0x920c('0x1a')](function(_0x55b725){_0x51a926({'code':0xc8,'message':_0x55b725['content']});})['catch'](function(_0x41ce20){_0x46e8e1(_0x3055fe['error'](0x1f5,_0x41ce20[_0x920c('0x1b')]));});});},'VoiceQueues':function(_0x18b3ef){return new Promise(function(_0x2e7d58,_0x4f4860){var _0x4c17f6=[];for(var _0x180a31 in _0x46a517[_0x920c('0x20')]){if(_0x46a517[_0x920c('0x20')][_0x920c('0x21')](_0x180a31)){var _0x342368=_0x46a517[_0x920c('0x20')][_0x180a31];var _0x1097d3={'id':_0x342368['id'],'name':_0x342368['name'],'strategy':_0x342368[_0x920c('0x22')],'answered':_0x342368[_0x920c('0x23')],'available':_0x342368['available'],'loggedIn':_0x342368[_0x920c('0x24')],'pTalking':_0x342368[_0x920c('0x25')],'sumBillable':_0x342368[_0x920c('0x26')],'sumDuration':_0x342368[_0x920c('0x27')],'sumHoldTime':_0x342368[_0x920c('0x28')]||0x0,'talking':_0x342368[_0x920c('0x29')],'total':_0x342368[_0x920c('0x2a')],'type':_0x342368[_0x920c('0x2b')],'unmanaged':_0x342368[_0x920c('0x2c')],'abandoned':_0x342368[_0x920c('0x2d')],'waiting':_0x342368[_0x920c('0x2e')],'loggedInDb':_0x342368[_0x920c('0x2f')]};if(_0x342368[_0x920c('0x2b')]===_0x920c('0x30')){_0x1097d3[_0x920c('0x31')]=_0x342368[_0x920c('0x31')];_0x1097d3['dialMethod']=_0x342368[_0x920c('0x32')];_0x1097d3['dialOriginateCallerIdName']=_0x342368['dialOriginateCallerIdName'];_0x1097d3['dialOriginateCallerIdNumber']=_0x342368['dialOriginateCallerIdNumber'];_0x1097d3[_0x920c('0x33')]=_0x342368[_0x920c('0x33')];_0x1097d3['dialPrefix']=_0x342368[_0x920c('0x34')];_0x1097d3[_0x920c('0x35')]=_0x342368[_0x920c('0x35')];_0x1097d3[_0x920c('0x36')]=_0x342368[_0x920c('0x36')];_0x1097d3[_0x920c('0x37')]=_0x342368[_0x920c('0x37')];_0x1097d3[_0x920c('0x38')]=_0x342368[_0x920c('0x38')];_0x1097d3[_0x920c('0x39')]=_0x342368[_0x920c('0x39')];_0x1097d3['outboundDropCallsDayACS']=_0x342368[_0x920c('0x3a')];_0x1097d3['outboundDropCallsDayCallersExit']=_0x342368[_0x920c('0x3b')];_0x1097d3[_0x920c('0x3c')]=_0x342368['outboundDropCallsDayTimeout'];_0x1097d3['outboundNoAnswerCallsDay']=_0x342368[_0x920c('0x3d')];_0x1097d3[_0x920c('0x3e')]=_0x342368['outboundNoSuchCallsDay'];_0x1097d3['outboundOriginateFailureCallsDay']=_0x342368[_0x920c('0x3f')];_0x1097d3[_0x920c('0x40')]=_0x342368[_0x920c('0x40')];_0x1097d3[_0x920c('0x41')]=_0x342368[_0x920c('0x41')];_0x1097d3[_0x920c('0x42')]=_0x342368[_0x920c('0x42')];_0x1097d3[_0x920c('0x43')]=_0x342368[_0x920c('0x43')];_0x1097d3['predictiveIntervalAvgHoldtime']=_0x342368[_0x920c('0x44')];_0x1097d3[_0x920c('0x45')]=_0x342368['predictiveIntervalAvgTalktime'];_0x1097d3[_0x920c('0x46')]=_0x342368['predictiveIntervalDroppedCallsCallersExit'];_0x1097d3[_0x920c('0x47')]=_0x342368[_0x920c('0x47')];_0x1097d3[_0x920c('0x48')]=_0x342368[_0x920c('0x48')];_0x1097d3['predictiveIntervalErlangCallsDroppedCalls']=_0x342368[_0x920c('0x49')];_0x1097d3[_0x920c('0x4a')]=_0x342368[_0x920c('0x4a')];_0x1097d3[_0x920c('0x4b')]=_0x342368['predictiveIntervalMultiplicativeFactor'];_0x1097d3[_0x920c('0x4c')]=_0x342368[_0x920c('0x4c')];_0x1097d3[_0x920c('0x4d')]=_0x342368['predictiveIntervalAvailable'];_0x1097d3[_0x920c('0x4e')]=_0x342368[_0x920c('0x4e')];_0x1097d3[_0x920c('0x1b')]=_0x342368['message'];_0x1097d3['originated']=_0x342368[_0x920c('0x4f')];_0x1097d3['erlangCalls']=_0x342368['erlangCalls'];_0x1097d3[_0x920c('0x50')]=_0x342368[_0x920c('0x50')];_0x1097d3[_0x920c('0x51')]=_0x342368[_0x920c('0x51')];_0x1097d3[_0x920c('0x52')]=_0x342368[_0x920c('0x52')];_0x1097d3[_0x920c('0x53')]=_0x342368[_0x920c('0x53')];_0x1097d3[_0x920c('0x54')]=_0x342368[_0x920c('0x54')];}if(_0x342368[_0x920c('0x55')]){_0x1097d3[_0x920c('0x55')]={'id':_0x342368[_0x920c('0x55')]['id'],'name':_0x342368['Trunk'][_0x920c('0x56')],'active':_0x342368[_0x920c('0x55')][_0x920c('0x57')],'callerid':_0x342368[_0x920c('0x55')][_0x920c('0x58')]};}if(_0x342368[_0x920c('0x59')]){_0x1097d3[_0x920c('0x59')]={'id':_0x342368[_0x920c('0x59')]['id'],'name':_0x342368[_0x920c('0x59')][_0x920c('0x56')]};}_0x4c17f6[_0x920c('0x5a')](_0x1097d3);}}_0x2e7d58({'count':_0x4c17f6['length'],'rows':_0x4c17f6});});},'VoiceChannels':function(_0x5173d3){return new Promise(function(_0x183282,_0x398015){var _0x55c49f=_[_0x920c('0x5b')](_0x46a517[_0x920c('0x5c')]);_0x183282({'count':_0x55c49f[_0x920c('0x5d')],'rows':_0x55c49f});});},'VoiceChannelMixMonitor':function(_0x946696){var _0x474aab=this;return new Promise(function(_0x39a12f,_0x545180){if(ami[_0x920c('0x12')]()==![]){return _0x545180(_0x474aab[_0x920c('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x920c('0x14')][_0x920c('0x15')],_0x920c('0x16')][_0x920c('0x17')]('\x20')));}var _0xff2d2f=schema(properties[_0x920c('0x5e')])[_0x920c('0x3')](_0x946696);if(_0xff2d2f[_0x920c('0x5d')]>0x0){return _0x545180(_0x474aab['error'](0x1f4,_[_0x920c('0x5f')](_0xff2d2f,'message')['join'](',\x20')));}var _0x3a3fec=_[_0x920c('0x60')](_0x46a517['channels'],{'uniqueid':_0x946696[_0x920c('0x61')]});if(_0x3a3fec&&_0x3a3fec[_0x920c('0x62')]){var _0x5c77a5=util[_0x920c('0xa')](_0x920c('0x63'),_0x946696[_0x920c('0x64')]||_0x946696[_0x920c('0x61')],_0x946696[_0x920c('0xa')]||_0x920c('0x65'));return ami[_0x920c('0x19')]({'action':_0x920c('0x66'),'channel':_0x3a3fec[_0x920c('0x62')],'file':_0x5c77a5,'options':_0x920c('0x67')})[_0x920c('0x1a')](function(_0x2ced65){var _0x1b2266=_['find'](_0x3a3fec[_0x920c('0x68')],{'filename':_0x920c('0x69')+_0x5c77a5[_0x920c('0x6a')]()});if(_['isNil'](_0x1b2266)){_0x3a3fec[_0x920c('0x68')]['push']({'filename':_0x920c('0x69')+_0x5c77a5[_0x920c('0x6a')](),'createdAt':moment()[_0x920c('0xa')](_0x920c('0x6b')),'mixmonitorid':_0x2ced65[_0x920c('0x6c')],'status':_0x920c('0x6d')});}else{_0x1b2266['mixmonitorid']=_0x2ced65['mixmonitorid'];_0x1b2266[_0x920c('0x6e')]='rec';}_0x39a12f({'code':0xc8,'message':[_0x946696['uniqueid'],_0x920c('0x6f'),_0x2ced65[_0x920c('0x6c')]][_0x920c('0x17')]('\x20'),'mixmonitorid':_0x2ced65[_0x920c('0x6c')]});})[_0x920c('0x1c')](function(_0x499971){_0x545180(_0x474aab[_0x920c('0x13')](0x1f5,[_0x946696['uniqueid'],_0x499971['message'][_0x920c('0x6a')]()]['join']('\x20')));});}else{return _0x545180(_0x474aab[_0x920c('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x45f67b){var _0x3cc8e4=this;return new Promise(function(_0x2bdc4b,_0x269dba){if(ami[_0x920c('0x12')]()==![]){return _0x269dba(_0x3cc8e4[_0x920c('0x13')](0x1f4,[config[_0x920c('0x14')]['ip'],config[_0x920c('0x14')]['username'],_0x920c('0x16')][_0x920c('0x17')]('\x20')));}var _0x30ed88=schema(properties['voicechannel'])[_0x920c('0x3')](_0x45f67b);if(_0x30ed88[_0x920c('0x5d')]>0x0){return _0x269dba(_0x3cc8e4[_0x920c('0x13')](0x1f4,_[_0x920c('0x5f')](_0x30ed88,'message')['join'](',\x20')));}var _0x220183=_[_0x920c('0x60')](_0x46a517[_0x920c('0x5c')],{'uniqueid':_0x45f67b[_0x920c('0x61')]});if(_0x220183){return BPromise[_0x920c('0x70')]()[_0x920c('0x1a')](function(){if(_0x220183[_0x920c('0x62')]){return ami[_0x920c('0x19')]({'action':_0x920c('0x71'),'channel':_0x220183[_0x920c('0x62')],'mixmonitorid':_0x45f67b[_0x920c('0x6c')]})[_0x920c('0x1c')](function(_0x4e478f){});}})[_0x920c('0x1a')](function(){if(_0x220183[_0x920c('0x72')]){return ami[_0x920c('0x19')]({'action':_0x920c('0x71'),'channel':_0x220183[_0x920c('0x72')],'mixmonitorid':_0x45f67b[_0x920c('0x6c')]})[_0x920c('0x1c')](function(_0x3880fe){});}})['then'](function(_0x5eb0d6){var _0x10d9d8=_[_0x920c('0x60')](_0x220183[_0x920c('0x68')],{'mixmonitorid':_0x45f67b[_0x920c('0x6c')]});if(_0x10d9d8){_0x10d9d8[_0x920c('0x6e')]=_0x920c('0x73');}})['then'](function(){var _0x3231af=util[_0x920c('0xa')](_0x920c('0x63'),_0x45f67b['filename']||_0x45f67b[_0x920c('0x61')],_0x45f67b['format']||'wav');var _0x9a0a5d=_[_0x920c('0x60')](_0x220183['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x3231af[_0x920c('0x6a')]()});if(_0x9a0a5d){_0x9a0a5d[_0x920c('0x6e')]=_0x920c('0x73');}})[_0x920c('0x1a')](function(){_0x2bdc4b({'code':0xc8,'message':[_0x45f67b[_0x920c('0x61')],_0x920c('0x74')][_0x920c('0x17')]('\x20')});})[_0x920c('0x1c')](function(_0x4fddce){_0x269dba(_0x3cc8e4[_0x920c('0x13')](0x1f5,[_0x45f67b[_0x920c('0x61')],_0x4fddce[_0x920c('0x1b')]['toLowerCase']()][_0x920c('0x17')]('\x20')));});}else{return _0x269dba(_0x3cc8e4[_0x920c('0x13')](0x1f5,_0x920c('0x75')));}});},'VoiceQueuesChannels':function(_0x46b000){return new Promise(function(_0x564cdd,_0x380163){var _0x346a7b=_[_0x920c('0x5b')](_0x46a517[_0x920c('0x76')]);_0x564cdd({'count':_0x346a7b['length'],'rows':_0x346a7b});});},'VoiceQueuesChannel':function(_0x1f640e){var _0x5e9a52=this;return new Promise(function(_0x1cc876,_0x5e75e9){var _0x135a29=schema(properties[_0x920c('0x77')])[_0x920c('0x3')](_0x1f640e);if(_0x135a29[_0x920c('0x5d')]>0x0){return _0x5e75e9(_0x5e9a52[_0x920c('0x13')](0x1f4,_[_0x920c('0x5f')](_0x135a29,_0x920c('0x1b'))[_0x920c('0x17')](',\x20')));}var _0x5da132=_['find'](_0x46a517['queueChannels'],{'uniqueid':_0x1f640e[_0x920c('0x61')]});if(_0x5da132){_0x1cc876(_0x5da132);}else{return _0x5e75e9(_0x5e9a52[_0x920c('0x13')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x177ee9){var _0x42e3a1=this;return new Promise(function(_0x2fd885,_0x5902f9){if(ami[_0x920c('0x12')]()==![]){return _0x5902f9(_0x42e3a1['error'](0x1f4,[config['asterisk']['ip'],config[_0x920c('0x14')][_0x920c('0x15')],_0x920c('0x16')][_0x920c('0x17')]('\x20')));}var _0x53e257=schema(properties[_0x920c('0x78')])[_0x920c('0x3')](_0x177ee9);if(_0x53e257[_0x920c('0x5d')]>0x0){return _0x5902f9(_0x42e3a1[_0x920c('0x13')](0x1f4,_[_0x920c('0x5f')](_0x53e257,'message')['join'](',\x20')));}var _0x205c57=_[_0x920c('0x60')](_0x46a517['queueChannels'],{'uniqueid':_0x177ee9[_0x920c('0x61')]});if(_0x205c57&&_0x205c57['channel']){return ami[_0x920c('0x19')]({'action':_0x920c('0x79'),'channel':_0x205c57[_0x920c('0x62')]})[_0x920c('0x1a')](function(_0x30beb8){_0x2fd885({'code':0xc8,'message':[_0x177ee9[_0x920c('0x61')],_0x30beb8[_0x920c('0x1b')][_0x920c('0x6a')]()][_0x920c('0x17')]('\x20')});})[_0x920c('0x1c')](function(_0xfd7f9a){_0x5902f9(_0x42e3a1[_0x920c('0x13')](0x1f5,[_0x177ee9['uniqueid'],_0xfd7f9a[_0x920c('0x1b')][_0x920c('0x6a')]()][_0x920c('0x17')]('\x20')));});}else{return _0x5902f9(_0x42e3a1[_0x920c('0x13')](0x1f5,_0x920c('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x470c37){var _0x1ef077=this;return new Promise(function(_0x2fb83e,_0x4fca45){if(ami[_0x920c('0x12')]()==![]){return _0x4fca45(_0x1ef077[_0x920c('0x13')](0x1f4,[config[_0x920c('0x14')]['ip'],config[_0x920c('0x14')][_0x920c('0x15')],'ami\x20disconnected'][_0x920c('0x17')]('\x20')));}var _0x42784c=schema(properties[_0x920c('0x7a')])[_0x920c('0x3')](_0x470c37);if(_0x42784c[_0x920c('0x5d')]>0x0){return _0x4fca45(_0x1ef077[_0x920c('0x13')](0x1f4,_['map'](_0x42784c,_0x920c('0x1b'))[_0x920c('0x17')](',\x20')));}var _0x140841=_[_0x920c('0x60')](_0x46a517[_0x920c('0x76')],{'uniqueid':_0x470c37[_0x920c('0x61')]});if(_0x140841&&_0x140841[_0x920c('0x62')]){return ami['Action']({'action':_0x920c('0x7b'),'channel':_0x140841[_0x920c('0x62')],'exten':_0x470c37[_0x920c('0x7c')],'context':_0x470c37[_0x920c('0x7d')]||_0x140841[_0x920c('0x7d')],'priority':0x1})[_0x920c('0x1a')](function(_0x3879df){_0x2fb83e({'code':0xc8,'message':[_0x470c37[_0x920c('0x61')],_0x3879df['message']['toLowerCase']()][_0x920c('0x17')]('\x20')});})[_0x920c('0x1c')](function(_0x55418a){_0x4fca45(_0x1ef077['error'](0x1f5,[_0x470c37[_0x920c('0x61')],_0x55418a[_0x920c('0x1b')][_0x920c('0x6a')]()][_0x920c('0x17')]('\x20')));});}else{return _0x4fca45(_0x1ef077[_0x920c('0x13')](0x1f5,_0x920c('0x75')));}});},'Agents':function(_0x272397){return new Promise(function(_0x4b5b96,_0x48d55d){var _0x5cfb0f=_['values'](_0x46a517['agents']);_0x4b5b96({'count':_0x5cfb0f[_0x920c('0x5d')],'rows':_0x5cfb0f});});},'Telephones':function(_0x3cc7e8){return new Promise(function(_0x1d9435,_0x9e3c3a){var _0x3add79=_[_0x920c('0x5b')](_0x46a517[_0x920c('0x7e')]);_0x1d9435({'count':_0x3add79[_0x920c('0x5d')],'rows':_0x3add79});});},'Trunks':function(_0x170295){return new Promise(function(_0x429ec2,_0x595e5b){var _0x45b652=_[_0x920c('0x5b')](_0x46a517[_0x920c('0x7f')]);_0x429ec2({'count':_0x45b652[_0x920c('0x5d')],'rows':_0x45b652});});},'OutboundChannels':function(_0xe21eee){return new Promise(function(_0x57ebfe,_0x5ca5ba){var _0x3cb3a9=_[_0x920c('0x5b')](_0x46a517[_0x920c('0x80')]);_0x57ebfe({'count':_0x3cb3a9[_0x920c('0x5d')],'rows':_0x3cb3a9});});},'Outbound':function(_0x2c7687){return new Promise(function(_0x275f5d,_0x15bdfb){_0x275f5d(_0x46a517[_0x920c('0x30')]);});},'Campaigns':function(_0x5f3993){return new Promise(function(_0x35b637,_0x14e11d){var _0x4e8860=_[_0x920c('0x5b')](_0x46a517[_0x920c('0x81')]);_0x35b637({'count':_0x4e8860[_0x920c('0x5d')],'rows':_0x4e8860});});},'VoiceQueuesPreview':function(_0x349dfc){var _0x2f965c=this;return new Promise(function(_0xfc98f3,_0x2dc822){_0x9cca9d[_0x920c('0x82')](_0x349dfc['id'])[_0x920c('0x1a')](function(_0x16f945){_0xfc98f3({'code':0xc8,'message':_0x16f945[_0x920c('0x1b')]});})[_0x920c('0x1c')](function(_0x568093){_0x2dc822(_0x2f965c[_0x920c('0x13')](0x1f4,_0x568093[_0x920c('0x1b')]));});});},'EventManager':function(_0x403c22){var _0x517f7d=this;return new Promise(function(_0x5d50ec,_0x2c48a1){if(!_0x403c22['event']){return _0x2c48a1(_0x517f7d[_0x920c('0x13')](0x1f4,'Event\x20name\x20mandatory'));}ami['emit']('custom:'+_0x403c22[_0x920c('0x83')],_0x403c22[_0x920c('0x1b')]);_0x5d50ec({'code':0xc8,'message':_0x403c22});});},'FaxAccounts':function(_0x36693f){return new Promise(function(_0x37b078,_0x4c52ed){var _0x5f0133=_[_0x920c('0x5b')](_0x46a517[_0x920c('0x84')]);_0x37b078({'count':_0x5f0133[_0x920c('0x5d')],'rows':_0x5f0133});});},'SendFax':function(_0x188288){var _0x37df08=this;return new Promise(function(_0x16da62,_0x1ff21c){_0x7f0412['send'](_0x188288)['then'](function(_0x3b9858){_0x16da62({'code':0xc8,'message':_0x3b9858[_0x920c('0x1b')]});})['catch'](function(_0x557226){_0x1ff21c(_0x37df08[_0x920c('0x13')](0x1f4,_0x557226[_0x920c('0x1b')]));});});},'CheckAfterSend':function(_0x39fe01){var _0x39df76=this;return new Promise(function(_0x4d5143,_0x4c84e7){_0x7f0412[_0x920c('0x85')](_0x39fe01)[_0x920c('0x1a')](function(_0x421a48){_0x4d5143({'code':0xc8,'message':_0x421a48[_0x920c('0x1b')]});})[_0x920c('0x1c')](function(_0x120973){_0x4c84e7(_0x39df76['error'](0x1f4,_0x120973[_0x920c('0x1b')]));});});}};var _0x372081=jayson[_0x920c('0x86')](_0x33bfc)[_0x920c('0x87')]();_0x372081['on']('error',function(_0x2e9912){return _0x25723a(_0x2e9912);});_0x372081[_0x920c('0x9')](0x232a,'127.0.0.1',function(){console[_0x920c('0x88')](_0x920c('0x89'),0x232a);return _0x13eba8(_0x920c('0x8a')+0x232a);});});}; \ No newline at end of file +var _0x8869=['predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','length','values','channels','voicechannel','map','find','uniqueid','channel','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','stop','%s.%s','StopMixMonitor\x20Success','voicequeuechannel','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','validate','moment','../properties','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','Command','content','voiceQueues','hasOwnProperty','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay'];(function(_0x54be69,_0x48f88c){var _0x2755fc=function(_0x48b467){while(--_0x48b467){_0x54be69['push'](_0x54be69['shift']());}};_0x2755fc(++_0x48f88c);}(_0x8869,0xd5));var _0x9886=function(_0x435962,_0x22a734){_0x435962=_0x435962-0x0;var _0x1aef9b=_0x8869[_0x435962];return _0x1aef9b;};'use strict';var _=require(_0x9886('0x0'));var util=require(_0x9886('0x1'));var jayson=require('jayson/promise');var schema=require(_0x9886('0x2'));var BPromise=require('bluebird');var moment=require(_0x9886('0x3'));var config=require('../../../config/environment');var properties=require(_0x9886('0x4'));var ami=require('../ami');exports[_0x9886('0x5')]=function(_0x4207dd,_0x1fe475,_0x4bba51){return new BPromise(function(_0x1a31fe,_0x8fa768){var _0x5c8c48={'QueuePause':function(_0x11835d){return new Promise(function(_0x51c532,_0x4dc489){var _0x29b03e=util[_0x9886('0x6')](_0x9886('0x7'),_0x9886('0x8'),_0x11835d[_0x9886('0x9')]);if(_0x4207dd[_0x9886('0xa')]&&_0x4207dd[_0x9886('0xa')][_0x29b03e]&&_0x4207dd[_0x9886('0xa')][_0x29b03e]['timer']){_0x4207dd[_0x9886('0xa')][_0x29b03e][_0x9886('0xb')]();}if(_0x4207dd[_0x9886('0xc')][_0x29b03e]){_0x4207dd[_0x9886('0xc')][_0x29b03e][_0x9886('0xd')]({'statePause':_0x11835d[_0x9886('0xe')]?!![]:![]});}_0x51c532({'code':0xc8,'message':_0x9886('0xf')});});},'Reload':function(_0x2c01c2){var _0x3253ee=this;return new Promise(function(_0x584a14,_0x133f47){if(ami[_0x9886('0x10')]()==![]){return _0x133f47(_0x3253ee[_0x9886('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x9886('0x12')][_0x9886('0x13')],_0x9886('0x14')][_0x9886('0x15')]('\x20')));}_0x2c01c2=_[_0x9886('0x16')](_0x2c01c2,_[_0x9886('0x17')](properties[_0x9886('0x18')]));_0x2c01c2[_0x9886('0x19')]=_0x9886('0x1a');return ami[_0x9886('0x1b')](_0x2c01c2)[_0x9886('0x1c')](function(_0x380b45){_0x584a14({'code':0xc8,'message':_0x380b45[_0x9886('0x1d')]});})[_0x9886('0x1e')](function(_0x42f3dd){_0x133f47(_0x3253ee[_0x9886('0x11')](0x1f5,_0x42f3dd[_0x9886('0x1d')]));});});},'Command':function(_0x43312d){var _0x542b79=this;return new Promise(function(_0x5f417a,_0x1ef186){if(ami[_0x9886('0x10')]()==![]){return _0x1ef186(_0x542b79[_0x9886('0x11')](0x1f4,[config[_0x9886('0x12')]['ip'],config[_0x9886('0x12')][_0x9886('0x13')],_0x9886('0x14')]['join']('\x20')));}_0x43312d=_[_0x9886('0x16')](_0x43312d,'command');_0x43312d[_0x9886('0x19')]=_0x9886('0x1f');return ami[_0x9886('0x1b')](_0x43312d)[_0x9886('0x1c')](function(_0x3ee73d){_0x5f417a({'code':0xc8,'message':_0x3ee73d[_0x9886('0x20')]});})['catch'](function(_0x3ca6df){_0x1ef186(_0x542b79[_0x9886('0x11')](0x1f5,_0x3ca6df[_0x9886('0x1d')]));});});},'VoiceQueues':function(_0x1d938f){return new Promise(function(_0x5e7c79,_0x89389b){var _0x37b707=[];for(var _0x5798cb in _0x4207dd['voiceQueues']){if(_0x4207dd[_0x9886('0x21')][_0x9886('0x22')](_0x5798cb)){var _0x243bc6=_0x4207dd[_0x9886('0x21')][_0x5798cb];var _0x55d61b={'id':_0x243bc6['id'],'name':_0x243bc6[_0x9886('0x9')],'strategy':_0x243bc6['strategy'],'answered':_0x243bc6[_0x9886('0x23')],'available':_0x243bc6['available'],'loggedIn':_0x243bc6[_0x9886('0x24')],'pTalking':_0x243bc6[_0x9886('0x25')],'sumBillable':_0x243bc6[_0x9886('0x26')],'sumDuration':_0x243bc6[_0x9886('0x27')],'sumHoldTime':_0x243bc6[_0x9886('0x28')]||0x0,'talking':_0x243bc6[_0x9886('0x29')],'total':_0x243bc6[_0x9886('0x2a')],'type':_0x243bc6[_0x9886('0x2b')],'unmanaged':_0x243bc6[_0x9886('0x2c')],'abandoned':_0x243bc6['abandoned'],'waiting':_0x243bc6['waiting'],'loggedInDb':_0x243bc6['loggedInDb']};if(_0x243bc6[_0x9886('0x2b')]==='outbound'){_0x55d61b[_0x9886('0x2d')]=_0x243bc6[_0x9886('0x2d')];_0x55d61b['dialMethod']=_0x243bc6[_0x9886('0x2e')];_0x55d61b[_0x9886('0x2f')]=_0x243bc6[_0x9886('0x2f')];_0x55d61b['dialOriginateCallerIdNumber']=_0x243bc6[_0x9886('0x30')];_0x55d61b[_0x9886('0x31')]=_0x243bc6[_0x9886('0x31')];_0x55d61b['dialPrefix']=_0x243bc6[_0x9886('0x32')];_0x55d61b[_0x9886('0x33')]=_0x243bc6['outboundAnswerAgiCallsDay'];_0x55d61b[_0x9886('0x34')]=_0x243bc6['outboundAnswerCallsDay'];_0x55d61b[_0x9886('0x35')]=_0x243bc6[_0x9886('0x35')];_0x55d61b[_0x9886('0x36')]=_0x243bc6['outboundBusyCallsDay'];_0x55d61b[_0x9886('0x37')]=_0x243bc6['outboundCongestionCallsDay'];_0x55d61b[_0x9886('0x38')]=_0x243bc6['outboundDropCallsDayACS'];_0x55d61b[_0x9886('0x39')]=_0x243bc6[_0x9886('0x39')];_0x55d61b[_0x9886('0x3a')]=_0x243bc6[_0x9886('0x3a')];_0x55d61b[_0x9886('0x3b')]=_0x243bc6[_0x9886('0x3b')];_0x55d61b[_0x9886('0x3c')]=_0x243bc6[_0x9886('0x3c')];_0x55d61b[_0x9886('0x3d')]=_0x243bc6[_0x9886('0x3d')];_0x55d61b['outboundReCallsDay']=_0x243bc6[_0x9886('0x3e')];_0x55d61b['outboundRejectCallsDay']=_0x243bc6[_0x9886('0x3f')];_0x55d61b['outboundUnknownCallsDay']=_0x243bc6[_0x9886('0x40')];_0x55d61b[_0x9886('0x41')]=_0x243bc6['predictiveIntervalAnsweredCalls'];_0x55d61b[_0x9886('0x42')]=_0x243bc6[_0x9886('0x42')];_0x55d61b[_0x9886('0x43')]=_0x243bc6[_0x9886('0x43')];_0x55d61b['predictiveIntervalDroppedCallsCallersExit']=_0x243bc6[_0x9886('0x44')];_0x55d61b['predictiveIntervalDroppedCallsTimeout']=_0x243bc6[_0x9886('0x45')];_0x55d61b['predictiveIntervalErlangCalls']=_0x243bc6[_0x9886('0x46')];_0x55d61b['predictiveIntervalErlangCallsDroppedCalls']=_0x243bc6[_0x9886('0x47')];_0x55d61b[_0x9886('0x48')]=_0x243bc6[_0x9886('0x48')];_0x55d61b[_0x9886('0x49')]=_0x243bc6[_0x9886('0x49')];_0x55d61b[_0x9886('0x4a')]=_0x243bc6['predictiveIntervalPauses'];_0x55d61b[_0x9886('0x4b')]=_0x243bc6[_0x9886('0x4b')];_0x55d61b[_0x9886('0x4c')]=_0x243bc6[_0x9886('0x4c')];_0x55d61b[_0x9886('0x1d')]=_0x243bc6[_0x9886('0x1d')];_0x55d61b['originated']=_0x243bc6[_0x9886('0x4d')];_0x55d61b[_0x9886('0x4e')]=_0x243bc6['erlangCalls'];_0x55d61b['erlangCallToSecond']=_0x243bc6[_0x9886('0x4f')];_0x55d61b[_0x9886('0x50')]=_0x243bc6[_0x9886('0x50')];_0x55d61b[_0x9886('0x51')]=_0x243bc6[_0x9886('0x51')];_0x55d61b['startPredictive']=_0x243bc6[_0x9886('0x52')];_0x55d61b['startProgressive']=_0x243bc6['startProgressive'];}if(_0x243bc6[_0x9886('0x53')]){_0x55d61b[_0x9886('0x53')]={'id':_0x243bc6[_0x9886('0x53')]['id'],'name':_0x243bc6[_0x9886('0x53')][_0x9886('0x9')],'active':_0x243bc6['Trunk'][_0x9886('0x54')],'callerid':_0x243bc6[_0x9886('0x53')][_0x9886('0x55')]};}if(_0x243bc6[_0x9886('0x56')]){_0x55d61b[_0x9886('0x56')]={'id':_0x243bc6[_0x9886('0x56')]['id'],'name':_0x243bc6['Interval'][_0x9886('0x9')]};}_0x37b707['push'](_0x55d61b);}}_0x5e7c79({'count':_0x37b707[_0x9886('0x57')],'rows':_0x37b707});});},'VoiceChannels':function(_0x372587){return new Promise(function(_0x2f66c6,_0x2fa61f){var _0x2a5317=_[_0x9886('0x58')](_0x4207dd[_0x9886('0x59')]);_0x2f66c6({'count':_0x2a5317[_0x9886('0x57')],'rows':_0x2a5317});});},'VoiceChannelMixMonitor':function(_0x4d25ea){var _0x5c88bb=this;return new Promise(function(_0x5c4688,_0x1cffd3){if(ami[_0x9886('0x10')]()==![]){return _0x1cffd3(_0x5c88bb[_0x9886('0x11')](0x1f4,[config[_0x9886('0x12')]['ip'],config[_0x9886('0x12')][_0x9886('0x13')],_0x9886('0x14')]['join']('\x20')));}var _0x3795e0=schema(properties[_0x9886('0x5a')])[_0x9886('0x2')](_0x4d25ea);if(_0x3795e0[_0x9886('0x57')]>0x0){return _0x1cffd3(_0x5c88bb[_0x9886('0x11')](0x1f4,_[_0x9886('0x5b')](_0x3795e0,'message')[_0x9886('0x15')](',\x20')));}var _0x59e125=_[_0x9886('0x5c')](_0x4207dd[_0x9886('0x59')],{'uniqueid':_0x4d25ea[_0x9886('0x5d')]});if(_0x59e125&&_0x59e125[_0x9886('0x5e')]){var _0x3b4558=util[_0x9886('0x6')]('%s.%s',_0x4d25ea[_0x9886('0x5f')]||_0x4d25ea[_0x9886('0x5d')],_0x4d25ea[_0x9886('0x6')]||_0x9886('0x60'));return ami[_0x9886('0x1b')]({'action':_0x9886('0x61'),'channel':_0x59e125[_0x9886('0x5e')],'file':_0x3b4558,'options':'ai(mixmonitorid)'})['then'](function(_0x28d0a6){var _0x1768bd=_[_0x9886('0x5c')](_0x59e125[_0x9886('0x62')],{'filename':_0x9886('0x63')+_0x3b4558[_0x9886('0x64')]()});if(_[_0x9886('0x65')](_0x1768bd)){_0x59e125['monitors'][_0x9886('0x66')]({'filename':_0x9886('0x63')+_0x3b4558[_0x9886('0x64')](),'createdAt':moment()[_0x9886('0x6')](_0x9886('0x67')),'mixmonitorid':_0x28d0a6[_0x9886('0x68')],'status':_0x9886('0x69')});}else{_0x1768bd[_0x9886('0x68')]=_0x28d0a6[_0x9886('0x68')];_0x1768bd[_0x9886('0x6a')]=_0x9886('0x69');}_0x5c4688({'code':0xc8,'message':[_0x4d25ea[_0x9886('0x5d')],_0x9886('0x6b'),_0x28d0a6[_0x9886('0x68')]][_0x9886('0x15')]('\x20'),'mixmonitorid':_0x28d0a6[_0x9886('0x68')]});})[_0x9886('0x1e')](function(_0x4cd8ed){_0x1cffd3(_0x5c88bb['error'](0x1f5,[_0x4d25ea[_0x9886('0x5d')],_0x4cd8ed[_0x9886('0x1d')][_0x9886('0x64')]()][_0x9886('0x15')]('\x20')));});}else{return _0x1cffd3(_0x5c88bb[_0x9886('0x11')](0x1f5,_0x9886('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x10b64f){var _0xcd5680=this;return new Promise(function(_0x11b88a,_0x4cae95){if(ami['isConnected']()==![]){return _0x4cae95(_0xcd5680[_0x9886('0x11')](0x1f4,[config[_0x9886('0x12')]['ip'],config[_0x9886('0x12')]['username'],'ami\x20disconnected'][_0x9886('0x15')]('\x20')));}var _0x52521c=schema(properties['voicechannel'])['validate'](_0x10b64f);if(_0x52521c[_0x9886('0x57')]>0x0){return _0x4cae95(_0xcd5680[_0x9886('0x11')](0x1f4,_['map'](_0x52521c,_0x9886('0x1d'))[_0x9886('0x15')](',\x20')));}var _0x279c7b=_[_0x9886('0x5c')](_0x4207dd[_0x9886('0x59')],{'uniqueid':_0x10b64f[_0x9886('0x5d')]});if(_0x279c7b){return BPromise[_0x9886('0x6d')]()[_0x9886('0x1c')](function(){if(_0x279c7b[_0x9886('0x5e')]){return ami[_0x9886('0x1b')]({'action':'StopMixMonitor','channel':_0x279c7b['channel'],'mixmonitorid':_0x10b64f[_0x9886('0x68')]})[_0x9886('0x1e')](function(_0x332bd6){});}})['then'](function(){if(_0x279c7b['destinationchannel']){return ami[_0x9886('0x1b')]({'action':_0x9886('0x6e'),'channel':_0x279c7b['destinationchannel'],'mixmonitorid':_0x10b64f[_0x9886('0x68')]})[_0x9886('0x1e')](function(_0x3ee3d7){});}})[_0x9886('0x1c')](function(_0x5a1ac6){var _0x36d25f=_[_0x9886('0x5c')](_0x279c7b[_0x9886('0x62')],{'mixmonitorid':_0x10b64f[_0x9886('0x68')]});if(_0x36d25f){_0x36d25f[_0x9886('0x6a')]=_0x9886('0x6f');}})[_0x9886('0x1c')](function(){var _0x9c7983=util[_0x9886('0x6')](_0x9886('0x70'),_0x10b64f['filename']||_0x10b64f['uniqueid'],_0x10b64f[_0x9886('0x6')]||_0x9886('0x60'));var _0x3f0aeb=_[_0x9886('0x5c')](_0x279c7b[_0x9886('0x62')],{'filename':'/var/spool/asterisk/monitor/'+_0x9c7983[_0x9886('0x64')]()});if(_0x3f0aeb){_0x3f0aeb[_0x9886('0x6a')]=_0x9886('0x6f');}})[_0x9886('0x1c')](function(){_0x11b88a({'code':0xc8,'message':[_0x10b64f[_0x9886('0x5d')],_0x9886('0x71')][_0x9886('0x15')]('\x20')});})[_0x9886('0x1e')](function(_0x3f249b){_0x4cae95(_0xcd5680['error'](0x1f5,[_0x10b64f[_0x9886('0x5d')],_0x3f249b['message'][_0x9886('0x64')]()][_0x9886('0x15')]('\x20')));});}else{return _0x4cae95(_0xcd5680['error'](0x1f5,_0x9886('0x6c')));}});},'VoiceQueuesChannels':function(_0x4c8152){return new Promise(function(_0x361a90,_0xe2dcc1){var _0x5cd909=_[_0x9886('0x58')](_0x4207dd['queueChannels']);_0x361a90({'count':_0x5cd909[_0x9886('0x57')],'rows':_0x5cd909});});},'VoiceQueuesChannel':function(_0x132820){var _0x36a2a4=this;return new Promise(function(_0x338266,_0x4838f5){var _0x413b0b=schema(properties[_0x9886('0x72')])[_0x9886('0x2')](_0x132820);if(_0x413b0b['length']>0x0){return _0x4838f5(_0x36a2a4[_0x9886('0x11')](0x1f4,_[_0x9886('0x5b')](_0x413b0b,_0x9886('0x1d'))['join'](',\x20')));}var _0x587e8a=_[_0x9886('0x5c')](_0x4207dd[_0x9886('0x73')],{'uniqueid':_0x132820[_0x9886('0x5d')]});if(_0x587e8a){_0x338266(_0x587e8a);}else{return _0x4838f5(_0x36a2a4[_0x9886('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x3e0402){var _0x37d933=this;return new Promise(function(_0x246087,_0x4ef535){if(ami[_0x9886('0x10')]()==![]){return _0x4ef535(_0x37d933[_0x9886('0x11')](0x1f4,[config[_0x9886('0x12')]['ip'],config[_0x9886('0x12')][_0x9886('0x13')],'ami\x20disconnected'][_0x9886('0x15')]('\x20')));}var _0x2b3419=schema(properties[_0x9886('0x74')])[_0x9886('0x2')](_0x3e0402);if(_0x2b3419['length']>0x0){return _0x4ef535(_0x37d933['error'](0x1f4,_[_0x9886('0x5b')](_0x2b3419,_0x9886('0x1d'))[_0x9886('0x15')](',\x20')));}var _0x48419c=_['find'](_0x4207dd[_0x9886('0x73')],{'uniqueid':_0x3e0402[_0x9886('0x5d')]});if(_0x48419c&&_0x48419c[_0x9886('0x5e')]){return ami[_0x9886('0x1b')]({'action':_0x9886('0x75'),'channel':_0x48419c[_0x9886('0x5e')]})[_0x9886('0x1c')](function(_0x119a54){_0x246087({'code':0xc8,'message':[_0x3e0402[_0x9886('0x5d')],_0x119a54[_0x9886('0x1d')][_0x9886('0x64')]()]['join']('\x20')});})[_0x9886('0x1e')](function(_0x46b42c){_0x4ef535(_0x37d933['error'](0x1f5,[_0x3e0402[_0x9886('0x5d')],_0x46b42c[_0x9886('0x1d')][_0x9886('0x64')]()][_0x9886('0x15')]('\x20')));});}else{return _0x4ef535(_0x37d933[_0x9886('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x53e639){var _0x4aac08=this;return new Promise(function(_0x4bfda6,_0x504461){if(ami['isConnected']()==![]){return _0x504461(_0x4aac08[_0x9886('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x9886('0x12')][_0x9886('0x13')],_0x9886('0x14')][_0x9886('0x15')]('\x20')));}var _0x58c05a=schema(properties[_0x9886('0x76')])[_0x9886('0x2')](_0x53e639);if(_0x58c05a['length']>0x0){return _0x504461(_0x4aac08[_0x9886('0x11')](0x1f4,_[_0x9886('0x5b')](_0x58c05a,_0x9886('0x1d'))[_0x9886('0x15')](',\x20')));}var _0x2a7a62=_['find'](_0x4207dd['queueChannels'],{'uniqueid':_0x53e639[_0x9886('0x5d')]});if(_0x2a7a62&&_0x2a7a62[_0x9886('0x5e')]){return ami[_0x9886('0x1b')]({'action':'Redirect','channel':_0x2a7a62[_0x9886('0x5e')],'exten':_0x53e639[_0x9886('0x77')],'context':_0x53e639['context']||_0x2a7a62[_0x9886('0x78')],'priority':0x1})[_0x9886('0x1c')](function(_0x3166a2){_0x4bfda6({'code':0xc8,'message':[_0x53e639[_0x9886('0x5d')],_0x3166a2['message'][_0x9886('0x64')]()][_0x9886('0x15')]('\x20')});})[_0x9886('0x1e')](function(_0x366d7f){_0x504461(_0x4aac08[_0x9886('0x11')](0x1f5,[_0x53e639[_0x9886('0x5d')],_0x366d7f[_0x9886('0x1d')]['toLowerCase']()][_0x9886('0x15')]('\x20')));});}else{return _0x504461(_0x4aac08[_0x9886('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2d2410){return new Promise(function(_0xfae567,_0x54de93){var _0x59d3d2=_[_0x9886('0x58')](_0x4207dd[_0x9886('0xc')]);_0xfae567({'count':_0x59d3d2[_0x9886('0x57')],'rows':_0x59d3d2});});},'Telephones':function(_0xf4c770){return new Promise(function(_0x2aee7e,_0x33f6c6){var _0x5d292c=_[_0x9886('0x58')](_0x4207dd[_0x9886('0x79')]);_0x2aee7e({'count':_0x5d292c[_0x9886('0x57')],'rows':_0x5d292c});});},'Trunks':function(_0x1a883d){return new Promise(function(_0x3fdb63,_0x3cddd7){var _0x976e8a=_[_0x9886('0x58')](_0x4207dd[_0x9886('0x7a')]);_0x3fdb63({'count':_0x976e8a['length'],'rows':_0x976e8a});});},'OutboundChannels':function(_0x5b3f4d){return new Promise(function(_0x28d0aa,_0x40a2c9){var _0x281e50=_[_0x9886('0x58')](_0x4207dd[_0x9886('0x7b')]);_0x28d0aa({'count':_0x281e50[_0x9886('0x57')],'rows':_0x281e50});});},'Outbound':function(_0x2ef25c){return new Promise(function(_0x20dc39,_0xf4e4cb){_0x20dc39(_0x4207dd[_0x9886('0x7c')]);});},'Campaigns':function(_0x11d36b){return new Promise(function(_0x22b204,_0x5d781b){var _0x2b1ead=_[_0x9886('0x58')](_0x4207dd[_0x9886('0x7d')]);_0x22b204({'count':_0x2b1ead['length'],'rows':_0x2b1ead});});},'VoiceQueuesPreview':function(_0x31574d){var _0x4ee17d=this;return new Promise(function(_0x54dadb,_0x28c4bd){_0x1fe475[_0x9886('0x7e')](_0x31574d['id'])[_0x9886('0x1c')](function(_0x54a94e){_0x54dadb({'code':0xc8,'message':_0x54a94e[_0x9886('0x1d')]});})['catch'](function(_0x4f2719){_0x28c4bd(_0x4ee17d[_0x9886('0x11')](0x1f4,_0x4f2719[_0x9886('0x1d')]));});});},'EventManager':function(_0x246cd1){var _0x21b78a=this;return new Promise(function(_0x5bbacd,_0x3b0fa5){if(!_0x246cd1[_0x9886('0x7f')]){return _0x3b0fa5(_0x21b78a[_0x9886('0x11')](0x1f4,_0x9886('0x80')));}ami[_0x9886('0x81')](_0x9886('0x82')+_0x246cd1['event'],_0x246cd1[_0x9886('0x1d')]);_0x5bbacd({'code':0xc8,'message':_0x246cd1});});},'FaxAccounts':function(_0x29b7ca){return new Promise(function(_0x28ba10,_0x14b903){var _0x36754e=_[_0x9886('0x58')](_0x4207dd[_0x9886('0x83')]);_0x28ba10({'count':_0x36754e[_0x9886('0x57')],'rows':_0x36754e});});},'SendFax':function(_0x5ea757){var _0x3b1f08=this;return new Promise(function(_0xb04a7b,_0x4d041b){_0x4bba51[_0x9886('0x84')](_0x5ea757)[_0x9886('0x1c')](function(_0x518f5c){_0xb04a7b({'code':0xc8,'message':_0x518f5c[_0x9886('0x1d')]});})[_0x9886('0x1e')](function(_0x193e8){_0x4d041b(_0x3b1f08[_0x9886('0x11')](0x1f4,_0x193e8[_0x9886('0x1d')]));});});},'CheckAfterSend':function(_0xcd7bbd){var _0x5b9ff4=this;return new Promise(function(_0x157524,_0x1693b5){_0x4bba51[_0x9886('0x85')](_0xcd7bbd)[_0x9886('0x1c')](function(_0x5c9fbe){_0x157524({'code':0xc8,'message':_0x5c9fbe[_0x9886('0x1d')]});})[_0x9886('0x1e')](function(_0x533bc0){_0x1693b5(_0x5b9ff4[_0x9886('0x11')](0x1f4,_0x533bc0[_0x9886('0x1d')]));});});}};var _0x439e42=jayson[_0x9886('0x86')](_0x5c8c48)['http']();_0x439e42['on']('error',function(_0x10f51a){return _0x8fa768(_0x10f51a);});_0x439e42[_0x9886('0x5')](0x232a,_0x9886('0x87'),function(){console[_0x9886('0x88')](_0x9886('0x89'),0x232a);return _0x1a31fe(_0x9886('0x8a')+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 191dc6d..48d693d 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 _0x5562=['union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','firstName','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','merge','lodash','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','stringify','emit','data1','data2','xmd-contactid','data3','phone','$or','routeId','destcalleridnum','calleridnum','lastName','mobile','fax','ListId','createdAt','scheduledAt'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0x5562,0xef));var _0x2556=function(_0x92713a,_0x68f8b0){_0x92713a=_0x92713a-0x0;var _0x1893e1=_0x5562[_0x92713a];return _0x1893e1;};'use strict';var _=require(_0x2556('0x0'));var BPromise=require('bluebird');var Redis=require('ioredis');var util=require(_0x2556('0x1'));var config=require(_0x2556('0x2'));var logger=require(_0x2556('0x3'))('trigger');var cmContactRpc=require(_0x2556('0x4'));config[_0x2556('0x5')]=_['defaults'](config[_0x2556('0x5')],{'host':_0x2556('0x6'),'port':0x18eb});var io=require(_0x2556('0x7'))(new Redis(config['redis']));function emit(_0x550f72,_0x3050e4,_0x35b345,_0x353a6a,_0x42edc3){logger[_0x2556('0x8')]('[CM][%s][%s]',_0x550f72,_0x3050e4['id'],_0x35b345,_0x353a6a,JSON[_0x2556('0x9')](_0x42edc3));io['to'](_0x35b345)[_0x2556('0xa')](_0x353a6a,_0x42edc3);}exports['exec']=function(_0x1a6e67,_0xcdb4ed,_0x59374e,_0x1bff75){var _0x3cf976,_0x24735a;var _0x141e61={};var _0x4fa862=Number(_0x59374e[_0x2556('0xb')]);var _0x2ac247=_0x59374e[_0x2556('0xc')]?Boolean(Number(_0x59374e[_0x2556('0xc')])):![];var _0x31bc23;if(_0x1bff75[_0x2556('0xd')]){_0x141e61['id']=_0x1bff75[_0x2556('0xd')];}if(!_0x141e61['id']){_0x141e61['ListId']=_0x4fa862;_0x31bc23=_0x59374e[_0x2556('0xe')]&&_0x59374e[_0x2556('0xe')]!=='0'?_0x59374e['data3']['split'](','):[_0x2556('0xf')];_0x141e61[_0x2556('0x10')]=_['map'](_0x31bc23,function(_0x532ff9){var _0x1171f3={};_0x1171f3[_0x532ff9]=_0x1bff75[_0x2556('0x11')]?_0x1bff75[_0x2556('0x12')]:_0x1bff75[_0x2556('0x13')];return _0x1171f3;});}var _0x1f88a7=['id','firstName',_0x2556('0x14'),_0x2556('0xf'),_0x2556('0x15'),_0x2556('0x16'),_0x2556('0x17'),_0x2556('0x18'),_0x2556('0x19'),'updatedAt'];var _0xc4cffa=_[_0x2556('0x1a')](_0x1f88a7,_0x31bc23);BPromise[_0x2556('0x1b')]()[_0x2556('0x1c')](cmContactRpc['getContacts']({'attributes':_0xc4cffa,'where':_0x141e61}))[_0x2556('0x1c')](function(_0x40e3a2){_0x24735a=_0x40e3a2;if(!_[_0x2556('0x1d')](_0x24735a)){if(_0x24735a[_0x2556('0x1e')]===0x1){_0x3cf976=_0x24735a[0x0];logger[_0x2556('0x8')](_0x2556('0x1f'),_0x1bff75[_0x2556('0x20')],_0xcdb4ed['id'],_0x3cf976['id']);}else{logger['info'](_0x2556('0x21'),_0x1bff75[_0x2556('0x20')],_0xcdb4ed['id'],_['map'](_0x24735a,'id')[_0x2556('0x22')](','));}return;}else{logger['info'](_0x2556('0x23'),_0x1bff75[_0x2556('0x20')],_0xcdb4ed['id']);var _0x4c3a06={'ListId':_0x4fa862};var _0x7643e0=_0x59374e['data4']&&_0x59374e[_0x2556('0x24')]!=='0'?_0x59374e[_0x2556('0x24')]:'phone';if(_0x2ac247){logger[_0x2556('0x8')](_0x2556('0x25'),_0x1bff75[_0x2556('0x20')],_0xcdb4ed['id']);_0x4c3a06[_0x7643e0]=_[_0x2556('0x26')](_0x1bff75[_0x2556('0x11')])?_0x1bff75[_0x2556('0x13')]:_0x1bff75[_0x2556('0x12')];if(_['isNil'](_0x1bff75['routeId'])){_0x4c3a06[_0x2556('0x27')]=_0x1bff75[_0x2556('0x28')]&&_0x1bff75[_0x2556('0x28')]!==_0x2556('0x29')?_0x1bff75[_0x2556('0x28')]:_0x2556('0x2a');}else{_0x4c3a06[_0x2556('0x27')]=_0x1bff75[_0x2556('0x2b')]&&_0x1bff75[_0x2556('0x2b')]!==''?_0x1bff75[_0x2556('0x2b')]:_0x2556('0x2a');}return BPromise[_0x2556('0x1b')]()[_0x2556('0x1c')](cmContactRpc[_0x2556('0x2c')](_0x4c3a06))[_0x2556('0x1c')](function(_0x246ba4){_0x3cf976=_0x246ba4;_0x24735a['push'](_0x246ba4);if(_0x3cf976){logger[_0x2556('0x8')](_0x2556('0x2d'),_0x1bff75['uniqueid'],_0xcdb4ed['id'],_0x3cf976['id']);}return;});}else{logger[_0x2556('0x8')](_0x2556('0x2e'),_0x1bff75[_0x2556('0x20')],_0xcdb4ed['id']);_0x4c3a06[_0x7643e0]=_[_0x2556('0x26')](_0x1bff75[_0x2556('0x11')])?_0x1bff75[_0x2556('0x13')]:_0x1bff75['destcalleridnum'];if(_['isNil'](_0x1bff75[_0x2556('0x11')])){_0x4c3a06[_0x2556('0x27')]=_0x1bff75[_0x2556('0x28')]&&_0x1bff75['calleridname']!==_0x2556('0x29')?_0x1bff75[_0x2556('0x28')]:'Unknown';}else{_0x4c3a06[_0x2556('0x27')]=_0x1bff75[_0x2556('0x2b')]&&_0x1bff75[_0x2556('0x2b')]!==_0x2556('0x29')?_0x1bff75[_0x2556('0x2b')]:'Unknown';}_0x3cf976=_0x4c3a06;_0x24735a['push'](_0x4c3a06);return;}}})['then'](function(){if(_0x1a6e67){emit(_0x1bff75[_0x2556('0x20')],_0xcdb4ed,util[_0x2556('0x2f')]('user:%s',_0x1a6e67[_0x2556('0x30')]),util[_0x2556('0x2f')](_0x2556('0x31'),_0x59374e[_0x2556('0x32')][_0x2556('0x33')]()),{'evt':_[_0x2556('0x34')](_0x1bff75,{'autoCreate':_0x2ac247}),'contact':_0x3cf976===undefined?{}:_0x3cf976,'contacts':_0x24735a['length']===0x0?undefined:_0x24735a});}});}; \ No newline at end of file +var _0x29c3=['getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','destcalleridname','Unknown','resolve','push','[CM][%s][%s]\x20Contact\x20created:%s','routeId','format','trigger:%s','action','merge','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data2','xmd-contactid','ListId','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','updatedAt','union','then'];(function(_0x209d9b,_0x224737){var _0x11b39b=function(_0xd8298f){while(--_0xd8298f){_0x209d9b['push'](_0x209d9b['shift']());}};_0x11b39b(++_0x224737);}(_0x29c3,0x80));var _0x329c=function(_0x536459,_0x3047a1){_0x536459=_0x536459-0x0;var _0x310c6=_0x29c3[_0x536459];return _0x310c6;};'use strict';var _=require('lodash');var BPromise=require(_0x329c('0x0'));var Redis=require(_0x329c('0x1'));var util=require(_0x329c('0x2'));var config=require(_0x329c('0x3'));var logger=require('../../../../config/logger')(_0x329c('0x4'));var cmContactRpc=require(_0x329c('0x5'));config[_0x329c('0x6')]=_[_0x329c('0x7')](config['redis'],{'host':_0x329c('0x8'),'port':0x18eb});var io=require(_0x329c('0x9'))(new Redis(config[_0x329c('0x6')]));function emit(_0x1fe889,_0x7ca221,_0x29baa5,_0x2da725,_0x3b116d){logger[_0x329c('0xa')]('[CM][%s][%s]',_0x1fe889,_0x7ca221['id'],_0x29baa5,_0x2da725,JSON[_0x329c('0xb')](_0x3b116d));io['to'](_0x29baa5)[_0x329c('0xc')](_0x2da725,_0x3b116d);}exports[_0x329c('0xd')]=function(_0x2069a5,_0x5897b9,_0x49ba5c,_0x2e4200){var _0x304905,_0x11f236;var _0x5c9656={};var _0x47d604=Number(_0x49ba5c['data1']);var _0x151644=_0x49ba5c[_0x329c('0xe')]?Boolean(Number(_0x49ba5c[_0x329c('0xe')])):![];var _0x3eec5b;if(_0x2e4200[_0x329c('0xf')]){_0x5c9656['id']=_0x2e4200[_0x329c('0xf')];}if(!_0x5c9656['id']){_0x5c9656[_0x329c('0x10')]=_0x47d604;_0x3eec5b=_0x49ba5c[_0x329c('0x11')]&&_0x49ba5c[_0x329c('0x11')]!=='0'?_0x49ba5c[_0x329c('0x11')][_0x329c('0x12')](','):[_0x329c('0x13')];_0x5c9656[_0x329c('0x14')]=_[_0x329c('0x15')](_0x3eec5b,function(_0x3f102a){var _0x397c16={};_0x397c16[_0x3f102a]=_0x2e4200['routeId']?_0x2e4200[_0x329c('0x16')]:_0x2e4200[_0x329c('0x17')];return _0x397c16;});}var _0x5b68c7=['id',_0x329c('0x18'),_0x329c('0x19'),_0x329c('0x13'),_0x329c('0x1a'),'fax',_0x329c('0x10'),_0x329c('0x1b'),'scheduledAt',_0x329c('0x1c')];var _0x148848=_[_0x329c('0x1d')](_0x5b68c7,_0x3eec5b);BPromise['resolve']()[_0x329c('0x1e')](cmContactRpc[_0x329c('0x1f')]({'attributes':_0x148848,'where':_0x5c9656}))['then'](function(_0x46d278){_0x11f236=_0x46d278;if(!_[_0x329c('0x20')](_0x11f236)){if(_0x11f236['length']===0x1){_0x304905=_0x11f236[0x0];logger[_0x329c('0xa')](_0x329c('0x21'),_0x2e4200['uniqueid'],_0x5897b9['id'],_0x304905['id']);}else{logger[_0x329c('0xa')](_0x329c('0x22'),_0x2e4200[_0x329c('0x23')],_0x5897b9['id'],_['map'](_0x11f236,'id')[_0x329c('0x24')](','));}return;}else{logger[_0x329c('0xa')](_0x329c('0x25'),_0x2e4200[_0x329c('0x23')],_0x5897b9['id']);var _0x423d2f={'ListId':_0x47d604};var _0x6982fd=_0x49ba5c['data4']&&_0x49ba5c['data4']!=='0'?_0x49ba5c[_0x329c('0x26')]:_0x329c('0x13');if(_0x151644){logger['info'](_0x329c('0x27'),_0x2e4200['uniqueid'],_0x5897b9['id']);_0x423d2f[_0x6982fd]=_[_0x329c('0x28')](_0x2e4200['routeId'])?_0x2e4200[_0x329c('0x17')]:_0x2e4200['destcalleridnum'];if(_[_0x329c('0x28')](_0x2e4200['routeId'])){_0x423d2f[_0x329c('0x18')]=_0x2e4200['calleridname']&&_0x2e4200[_0x329c('0x29')]!==_0x329c('0x2a')?_0x2e4200[_0x329c('0x29')]:'Unknown';}else{_0x423d2f[_0x329c('0x18')]=_0x2e4200['destcalleridname']&&_0x2e4200[_0x329c('0x2b')]!==''?_0x2e4200[_0x329c('0x2b')]:_0x329c('0x2c');}return BPromise[_0x329c('0x2d')]()['then'](cmContactRpc['createContact'](_0x423d2f))['then'](function(_0x26a2ce){_0x304905=_0x26a2ce;_0x11f236[_0x329c('0x2e')](_0x26a2ce);if(_0x304905){logger[_0x329c('0xa')](_0x329c('0x2f'),_0x2e4200[_0x329c('0x23')],_0x5897b9['id'],_0x304905['id']);}return;});}else{logger[_0x329c('0xa')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2e4200[_0x329c('0x23')],_0x5897b9['id']);_0x423d2f[_0x6982fd]=_[_0x329c('0x28')](_0x2e4200[_0x329c('0x30')])?_0x2e4200[_0x329c('0x17')]:_0x2e4200[_0x329c('0x16')];if(_[_0x329c('0x28')](_0x2e4200[_0x329c('0x30')])){_0x423d2f[_0x329c('0x18')]=_0x2e4200['calleridname']&&_0x2e4200[_0x329c('0x29')]!==_0x329c('0x2a')?_0x2e4200[_0x329c('0x29')]:_0x329c('0x2c');}else{_0x423d2f['firstName']=_0x2e4200[_0x329c('0x2b')]&&_0x2e4200[_0x329c('0x2b')]!==_0x329c('0x2a')?_0x2e4200[_0x329c('0x2b')]:_0x329c('0x2c');}_0x304905=_0x423d2f;_0x11f236['push'](_0x423d2f);return;}}})[_0x329c('0x1e')](function(){if(_0x2069a5){emit(_0x2e4200[_0x329c('0x23')],_0x5897b9,util['format']('user:%s',_0x2069a5['name']),util[_0x329c('0x31')](_0x329c('0x32'),_0x49ba5c[_0x329c('0x33')]['toLowerCase']()),{'evt':_[_0x329c('0x34')](_0x2e4200,{'autoCreate':_0x151644}),'contact':_0x304905===undefined?{}:_0x304905,'contacts':_0x11f236['length']===0x0?undefined:_0x11f236});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 316036b..fd8c8db 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 _0x27c5=['checkConditions','AnyConditions','some','channel','field','chat','value','ChatWebsiteId','upperFirst','AccountId','interaction','message','operator','event','agent','membername','lastevent','util','lodash','url','mustache','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:dialconnect','custom:dialend','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','checkTriggers','interface','hasOwnProperty','status','merge','variables','length','Actions','toLowerCase','contactmanager','browser','data1','TemplateId','data2','html','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','windowHeight','600','data6','winArguments','render','format','user:%s','name','action','trigger:%s','exec','integration','queue','routeId','urlforward','script','parse','search','replace','checkTrigger','AllConditions'];(function(_0x3ed909,_0x3b9d4e){var _0x45dacb=function(_0x43bba7){while(--_0x43bba7){_0x3ed909['push'](_0x3ed909['shift']());}};_0x45dacb(++_0x3b9d4e);}(_0x27c5,0xf7));var _0x527c=function(_0x274f14,_0x27dd7f){_0x274f14=_0x274f14-0x0;var _0x13b97e=_0x27c5[_0x274f14];return _0x13b97e;};'use strict';var util=require(_0x527c('0x0'));var _=require(_0x527c('0x1'));var url=require(_0x527c('0x2'));var Mustache=require(_0x527c('0x3'));var Redis=require(_0x527c('0x4'));var urlforward=require(_0x527c('0x5'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0x527c('0x6'));var config=require(_0x527c('0x7'));var logger=require(_0x527c('0x8'))(_0x527c('0x9'));var ami=require(_0x527c('0xa'));config[_0x527c('0xb')]=_[_0x527c('0xc')](config[_0x527c('0xb')],{'host':_0x527c('0xd'),'port':0x18eb});var io=require(_0x527c('0xe'))(new Redis(config[_0x527c('0xb')]));var operators={'equals':function(_0x83e273,_0x22999a){return _0x83e273==_0x22999a;},'not_equals':function(_0x384080,_0x108b81){return _0x384080!=_0x108b81;}};var barAndWebActions=[_0x527c('0xf'),'url',_0x527c('0x10')];function Trigger(_0x417915){this[_0x527c('0x11')]=_0x417915['triggers'];this['agents']=_0x417915[_0x527c('0x12')];this[_0x527c('0x13')]=_0x417915[_0x527c('0x13')];this[_0x527c('0x14')]=_0x417915[_0x527c('0x14')];this['voiceExtensions']=_0x417915[_0x527c('0x15')];this['zendeskAccounts']=_0x417915[_0x527c('0x16')];this[_0x527c('0x17')]=_0x417915[_0x527c('0x17')];this[_0x527c('0x18')]=_0x417915['salesforceAccounts'];this[_0x527c('0x19')]=_0x417915['sugarcrmAccounts'];this[_0x527c('0x1a')]=_0x417915[_0x527c('0x1a')];this['deskAccounts']=_0x417915[_0x527c('0x1b')];this[_0x527c('0x1c')]=_0x417915['vtigerAccounts'];this[_0x527c('0x1d')]=_0x417915[_0x527c('0x1d')];this[_0x527c('0x1e')]=_0x417915['dynamics365Accounts'];this[_0x527c('0x1f')]=_0x417915[_0x527c('0x1f')];this['accounts']={'zendesk':this[_0x527c('0x16')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x527c('0x17')],'sugarcrm':this[_0x527c('0x19')],'zoho':this[_0x527c('0x1a')],'desk':this[_0x527c('0x1b')],'vtiger':this[_0x527c('0x1c')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x527c('0x1f')],'servicenow':this[_0x527c('0x1d')]};ami['on']('custom:agentcalled',this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on']('custom:agentconnect',this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on'](_0x527c('0x22'),this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on'](_0x527c('0x23'),this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on'](_0x527c('0x24'),this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on'](_0x527c('0x25'),this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on'](_0x527c('0x26'),this[_0x527c('0x20')]['bind'](this));ami['on'](_0x527c('0x27'),this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on'](_0x527c('0x28'),this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x527c('0x21')](this));ami['on']('custom:timeout',this[_0x527c('0x20')]['bind'](this));ami['on']('custom:dialbegin',this['syncAgentDial']['bind'](this));ami['on'](_0x527c('0x29'),this['syncAgentDial'][_0x527c('0x21')](this));ami['on'](_0x527c('0x2a'),this[_0x527c('0x2b')]['bind'](this));ami['on'](_0x527c('0x2c'),this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on'](_0x527c('0x2d'),this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on'](_0x527c('0x2e'),this[_0x527c('0x20')]['bind'](this));ami['on'](_0x527c('0x2f'),this['syncCustomEvent'][_0x527c('0x21')](this));ami['on'](_0x527c('0x30'),this[_0x527c('0x20')][_0x527c('0x21')](this));ami['on'](_0x527c('0x31'),this[_0x527c('0x20')][_0x527c('0x21')](this));}Trigger[_0x527c('0x32')][_0x527c('0x33')]=function(_0x3e718f,_0x1fa39c,_0x1cc64c){logger['info'](_0x3e718f,_0x1fa39c,JSON[_0x527c('0x34')](_0x1cc64c));io['to'](_0x3e718f)[_0x527c('0x33')](_0x1fa39c,_0x1cc64c);};Trigger[_0x527c('0x32')][_0x527c('0x20')]=function(_0x579424){var _0x3f2712=_['clone'](_0x579424);this[_0x527c('0x35')](_0x3f2712);};Trigger['prototype'][_0x527c('0x2b')]=function(_0x118903){if(this[_0x527c('0x12')][_0x118903[_0x527c('0x36')]]){this['syncCustomEvent'](_0x118903);}};Trigger[_0x527c('0x32')][_0x527c('0x35')]=function(_0x429da9){var _0x2a5e09;for(var _0xd49a68 in this[_0x527c('0x11')]){if(this[_0x527c('0x11')][_0x527c('0x37')](_0xd49a68)){if(this[_0x527c('0x11')][_0xd49a68][_0x527c('0x38')]){_0x2a5e09=this['checkTrigger'](this[_0x527c('0x11')][_0xd49a68],_0x429da9);if(_0x2a5e09){_[_0x527c('0x39')](_0x429da9,_0x429da9[_0x527c('0x3a')]);for(var _0x599f72=0x0,_0x4ed325,_0x12bc2d,_0x558f1d;_0x599f720x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ 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 ad82441..2d63bed 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 _0x9f8c=['indexOf','content','ticketType','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','assign','callDirection','queue','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%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','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','userEmail',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','POST','remoteUri','password','then','access_token','error',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','validateEmail','email','length','info',']\x20Agent\x20found\x20','userId','systemuserid','toUpperCase','username','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','catch','GET','contacts?$select=telephone1','4.0','value','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','string','nameField','idField'];(function(_0x386192,_0x4ef3b4){var _0x316c98=function(_0x4ac021){while(--_0x4ac021){_0x386192['push'](_0x386192['shift']());}};_0x316c98(++_0x4ef3b4);}(_0x9f8c,0x1a1));var _0xc9f8=function(_0x4eec00,_0x584ab7){_0x4eec00=_0x4eec00-0x0;var _0x5dfbe5=_0x9f8c[_0x4eec00];return _0x5dfbe5;};'use strict';var _=require(_0xc9f8('0x0'));var BPromise=require(_0xc9f8('0x1'));var rp=require(_0xc9f8('0x2'));var util=require(_0xc9f8('0x3'));var intUtil=require(_0xc9f8('0x4'));var md5=require('md5');var Redis=require(_0xc9f8('0x5'));var logger=require(_0xc9f8('0x6'))('dynamics365');var config=require(_0xc9f8('0x7'));config[_0xc9f8('0x8')]=_[_0xc9f8('0x9')](config[_0xc9f8('0x8')],{'host':_0xc9f8('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x1cac49,_0x455c91,_0x31379){var _0x458073={'method':_0xc9f8('0xb'),'uri':_0x455c91,'form':{'client_id':_0x1cac49['clientId'],'resource':_0x1cac49[_0xc9f8('0xc')],'username':_0x1cac49['username'],'password':_0x1cac49[_0xc9f8('0xd')],'grant_type':_0xc9f8('0xd'),'client_secret':_0x1cac49['clientSecret']},'json':!![]};return rp(_0x458073)[_0xc9f8('0xe')](function(_0x4816ec){return _0x4816ec[_0xc9f8('0xf')];})['catch'](function(_0x2f5938){logger[_0xc9f8('0x10')]('['+[_0x31379['toUpperCase']()]+_0xc9f8('0x11'));return _0x2f5938[_0xc9f8('0x12')];});}function getUser(_0xb426da,_0x557a74,_0x280627,_0x450aaf,_0x1ced43,_0x2cf02b){return new BPromise(function(_0x5b150e,_0x57aa1b){return getAuthToken(_0x557a74,_0x450aaf,_0x2cf02b)[_0xc9f8('0xe')](function(_0xde07de){var _0xf60bbd={'method':'GET','uri':_0x1ced43+_0xc9f8('0x13'),'headers':{'Authorization':_0xc9f8('0x14')+_0xde07de,'OData-Version':'4.0'},'json':!![]};return rp(_0xf60bbd);})['then'](function(_0x29ab2d){var _0x1ccd20=_0x29ab2d['value'];var _0x3cec9b=![];var _0x4f99d2=null;if(!_['isNil'](_0x280627)){if(intUtil[_0xc9f8('0x15')](_0x280627[_0xc9f8('0x16')])){_0xb426da['userEmail']=_0x280627[_0xc9f8('0x16')];for(_0x4f99d2=0x0;_0x4f99d2<_0x1ccd20[_0xc9f8('0x17')];_0x4f99d2++){if(_0x1ccd20[_0x4f99d2]['internalemailaddress']===_0x280627[_0xc9f8('0x16')]&&!_0x1ccd20[_0x4f99d2]['isdisabled']){_0x3cec9b=!![];logger[_0xc9f8('0x18')]('['+[_0x2cf02b['toUpperCase']()]+_0xc9f8('0x19')+_0x1ccd20[_0x4f99d2]['systemuserid']+'!');_0xb426da[_0xc9f8('0x1a')]=_0x1ccd20[_0x4f99d2][_0xc9f8('0x1b')];}}}}if(!_0x3cec9b){logger[_0xc9f8('0x18')]('['+[_0x2cf02b[_0xc9f8('0x1c')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xb426da['userEmail']=_0x557a74[_0xc9f8('0x1d')];for(_0x4f99d2=0x0;_0x4f99d2<_0x1ccd20[_0xc9f8('0x17')];_0x4f99d2++){if(_0x1ccd20[_0x4f99d2]['internalemailaddress']===_0x557a74[_0xc9f8('0x1d')]){_0xb426da[_0xc9f8('0x1a')]=_0x1ccd20[_0x4f99d2][_0xc9f8('0x1b')];}}}_0x5b150e(_0xb426da);})['catch'](function(_0x2a959f){_0x57aa1b(_0x2a959f['message']);});});}function createEndUser(_0x41cfc9,_0x4070d7,_0x4b0189,_0x29ef5d,_0x5c599d,_0x529ec6){return new BPromise(function(_0x4bd14d,_0x3dbc86){return getAuthToken(_0x4070d7,_0x4b0189,_0x529ec6)[_0xc9f8('0xe')](function(_0x9a5fde){var _0x2d1723=_0x529ec6[_0xc9f8('0x1e')]()===_0xc9f8('0x1f')?_0x5c599d[_0xc9f8('0x20')]:_0x5c599d[_0xc9f8('0x21')];var _0x58661e={'method':_0xc9f8('0xb'),'uri':_0x29ef5d+_0xc9f8('0x22'),'body':{'telephone1':_0x2d1723,'fullname':_0x2d1723,'firstname':_0x2d1723,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc9f8('0x23')+_0x41cfc9[_0xc9f8('0x1a')]+')'},'headers':{'Authorization':_0xc9f8('0x14')+_0x9a5fde,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x58661e);})[_0xc9f8('0xe')](function(_0x53024d){var _0x32e60b=_0x53024d[_0xc9f8('0x24')][_0xc9f8('0x25')];var _0x2b6233=_0x32e60b[_0xc9f8('0x26')](_0x32e60b[_0xc9f8('0x27')]('(')+0x1,_0x32e60b['lastIndexOf'](')'));_0x41cfc9[_0xc9f8('0x28')]=_0x2b6233;_0x4bd14d(_0x41cfc9);})[_0xc9f8('0x29')](function(_0x16eced){_0x3dbc86(_0x16eced[_0xc9f8('0x12')]);});});}function getEndUser(_0x2530b6,_0x50a25e,_0x3a23dd,_0x1a6aa0,_0x4d967c,_0xf037b8){return new BPromise(function(_0x52c1ed,_0x33f955){return getAuthToken(_0x50a25e,_0x3a23dd,_0xf037b8)[_0xc9f8('0xe')](function(_0x1f07e6){var _0x14a424={'method':_0xc9f8('0x2a'),'uri':_0x1a6aa0+_0xc9f8('0x2b'),'headers':{'Authorization':_0xc9f8('0x14')+_0x1f07e6,'If-None-Match':null,'OData-Version':_0xc9f8('0x2c')},'json':!![]};return rp(_0x14a424);})[_0xc9f8('0xe')](function(_0x3d5a84){var _0x490071=null;if(_0x3d5a84){var _0x52c640=_0x3d5a84[_0xc9f8('0x2d')];var _0x45d10c=![];for(_0x490071=0x0;_0x490071<_0x52c640[_0xc9f8('0x17')];_0x490071++){var _0x5dd6ce=_0xf037b8[_0xc9f8('0x1e')]()==='outbound'?_0x4d967c[_0xc9f8('0x20')]:_0x4d967c[_0xc9f8('0x21')];if(_0x52c640[_0x490071]['telephone1']===_0x5dd6ce){_0x45d10c=!![];_0x2530b6[_0xc9f8('0x28')]=_0x52c640[_0x490071][_0xc9f8('0x2e')];}}if(_0x45d10c){_0x52c1ed(_0x2530b6);}else{return createEndUser(_0x2530b6,_0x50a25e,_0x3a23dd,_0x1a6aa0,_0x4d967c,_0xf037b8)[_0xc9f8('0xe')](function(_0x1a1b82){logger[_0xc9f8('0x18')]('['+[_0xf037b8[_0xc9f8('0x1c')]()]+_0xc9f8('0x2f'),_0x1a1b82['enduserId']);_0x52c1ed(_0x1a1b82);});}}else{return createEndUser(_0x2530b6,_0x50a25e,_0x3a23dd,_0x1a6aa0,_0x4d967c,_0xf037b8)[_0xc9f8('0xe')](function(_0x11b6e7){logger[_0xc9f8('0x18')]('['+[_0xf037b8[_0xc9f8('0x1c')]()]+_0xc9f8('0x30'),_0x11b6e7['enduserId']);_0x52c1ed(_0x11b6e7);});}});});}function getCustomFields(_0x55a5a0,_0x3f49ed,_0x48aca9){var _0x49acfa={};if(_0x55a5a0[_0xc9f8('0x17')]>0x0){_[_0xc9f8('0x31')](_0x55a5a0,function(_0x457f06){if(_0x457f06['type']===_0xc9f8('0x32')&&_0x457f06[_0xc9f8('0x33')]&&!_0x457f06['customField']){var _0x179ad5=_0x457f06[_0xc9f8('0x34')]['toLowerCase']();var _0x4c799c=_0x179ad5[_0xc9f8('0x26')](0x0,_0x179ad5['indexOf']('_'));var _0x5c7a5d=_0x179ad5[_0xc9f8('0x26')](_0x179ad5[_0xc9f8('0x35')]('_')+0x1);if(_0x4c799c===_0x48aca9){_0x49acfa[_0x5c7a5d]=_0x457f06[_0xc9f8('0x36')];}}});}return _0x49acfa;}function getTicket(_0x11a685,_0x449be5,_0x511352,_0x54c882,_0x2bfff2,_0x1bc3e8,_0x39e390){return new BPromise(function(_0x3ad2db,_0x4683cb){var _0x19797d;return getAuthToken(_0x449be5,_0x511352,_0x39e390)['then'](function(_0x392663){if(_0x1bc3e8[_0xc9f8('0x37')]==='incident'){_0x19797d={'method':_0xc9f8('0xb'),'uri':_0x54c882+'incidents','body':Object['assign']({},{'title':intUtil[_0xc9f8('0x38')](_0x1bc3e8[_0xc9f8('0x39')],_0x2bfff2,'\x20'),'description':intUtil['getString'](_0x1bc3e8[_0xc9f8('0x3a')],_0x2bfff2,'\x0a'),'customerid_contact@odata.bind':_0xc9f8('0x3b')+_0x11a685[_0xc9f8('0x28')]+')','ownerid@odata.bind':_0xc9f8('0x23')+_0x11a685[_0xc9f8('0x1a')]+')','caseorigincode':'1'},getCustomFields(_0x1bc3e8[_0xc9f8('0x3c')],_0x2bfff2,_0x1bc3e8['ticketType'])),'headers':{'Authorization':_0xc9f8('0x14')+_0x392663,'OData-Version':_0xc9f8('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1bc3e8[_0xc9f8('0x37')]===_0xc9f8('0x3d')){_0x19797d={'method':_0xc9f8('0xb'),'uri':_0x54c882+_0xc9f8('0x3e'),'body':Object[_0xc9f8('0x3f')]({},{'subject':intUtil[_0xc9f8('0x38')](_0x1bc3e8[_0xc9f8('0x39')],_0x2bfff2,'\x20'),'phonenumber':String(_0x2bfff2[_0xc9f8('0x21')]),'description':intUtil[_0xc9f8('0x38')](_0x1bc3e8['Descriptions'],_0x2bfff2,'\x0a'),'regardingobjectid_contact@odata.bind':_0xc9f8('0x3b')+_0x11a685['enduserId']+')','ownerid@odata.bind':_0xc9f8('0x23')+_0x11a685[_0xc9f8('0x1a')]+')','directioncode':_0x11a685[_0xc9f8('0x40')]===_0xc9f8('0x41')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xc9f8('0x23')+_0x11a685[_0xc9f8('0x1a')]+')','participationtypemask':_0x11a685[_0xc9f8('0x40')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xc9f8('0x3b')+_0x11a685[_0xc9f8('0x28')]+')','participationtypemask':_0x11a685[_0xc9f8('0x40')]===_0xc9f8('0x41')?0x1:0x2}]},getCustomFields(_0x1bc3e8['Fields'],_0x2bfff2,_0x1bc3e8[_0xc9f8('0x37')])),'headers':{'Authorization':_0xc9f8('0x14')+_0x392663,'OData-Version':_0xc9f8('0x2c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x19797d);})[_0xc9f8('0xe')](function(_0x17f754){var _0xb11c92=_0x17f754[_0xc9f8('0x24')][_0xc9f8('0x25')];var _0x8bd927=_0xb11c92['substring'](_0xb11c92['lastIndexOf']('(')+0x1,_0xb11c92['lastIndexOf'](')'));_0x11a685[_0xc9f8('0x42')]=_0x8bd927;_0x3ad2db(_0x11a685);})['catch'](function(_0x220a50){_0x4683cb(_0x220a50[_0xc9f8('0x12')]);});});}function emit(_0x243382,_0x54f6d4,_0x19185a,_0x41f886){var _0x118c0a={'uri':util[_0xc9f8('0x43')](_0xc9f8('0x44'),_0x243382,_0x19185a,_0x41f886)};io['to'](util[_0xc9f8('0x43')](_0xc9f8('0x45'),_0x54f6d4))['emit'](_0xc9f8('0x46'),_0x118c0a);}exports['cs']=function(_0xc2ff18,_0x17879e,_0x42aa5e,_0x11dcdf,_0x103265,_0x3f4f37,_0x24985c,_0x4cf581){var _0x489f4b={};_0x3f4f37[_0xc9f8('0xc')]=intUtil[_0xc9f8('0x47')](_0x3f4f37[_0xc9f8('0xc')]);_0x3f4f37[_0xc9f8('0x48')]=intUtil[_0xc9f8('0x47')](_0x3f4f37['serverUrl']);_0x489f4b['callDirection']=_0x4cf581===_0xc9f8('0x41')||_0x4cf581===_0xc9f8('0x49')?'queue':_0xc9f8('0x1f');var _0x388505=util[_0xc9f8('0x43')](_0xc9f8('0x4a'),_0x3f4f37[_0xc9f8('0xc')]);var _0x52cc22=util[_0xc9f8('0x43')](_0xc9f8('0x4b'),_0x3f4f37[_0xc9f8('0x4c')]);var _0x5b1f19=util[_0xc9f8('0x43')](_0xc9f8('0x4d'),_0x3f4f37[_0xc9f8('0x48')],_0x17879e['uniqueid'],md5(_0x17879e['uniqueid']));if(_0x103265&&_0x103265[_0xc9f8('0x4e')]){logger['info'](_0xc9f8('0x4f'),_0xc9f8('0x50'));_0x17879e['recordingURL']=_0x5b1f19;}else if(_0x24985c&&_0x24985c['recordingFormat']&&_0x24985c[_0xc9f8('0x51')]!==_0xc9f8('0x52')){logger['info']('[OUTBOUND]',_0xc9f8('0x50'));_0x17879e[_0xc9f8('0x53')]=_0x5b1f19;}else{_0x17879e[_0xc9f8('0x53')]='';}return getUser(_0x489f4b,_0x3f4f37,_0x11dcdf,_0x52cc22,_0x388505,_0x4cf581)[_0xc9f8('0xe')](function(_0x200245){logger[_0xc9f8('0x18')]('['+_0x4cf581[_0xc9f8('0x1c')]()+_0xc9f8('0x54'),_0x200245[_0xc9f8('0x1a')]);logger['info']('['+_0x4cf581[_0xc9f8('0x1c')]()+_0xc9f8('0x55'),_0x200245[_0xc9f8('0x56')]);return getEndUser(_0x200245,_0x3f4f37,_0x52cc22,_0x388505,_0x17879e,_0x4cf581);})[_0xc9f8('0xe')](function(_0x23593b){logger[_0xc9f8('0x18')]('['+_0x4cf581['toUpperCase']()+_0xc9f8('0x57'),_0x23593b['enduserId']);logger['info']('['+_0x4cf581[_0xc9f8('0x1c')]()+_0xc9f8('0x58'),_0x17879e[_0xc9f8('0x21')]);return getTicket(_0x23593b,_0x3f4f37,_0x52cc22,_0x388505,_0x17879e,_0x42aa5e,_0x4cf581);})['then'](function(_0x1063be){logger[_0xc9f8('0x18')](util[_0xc9f8('0x43')]('['+_0x4cf581[_0xc9f8('0x1c')]()+_0xc9f8('0x59'),_0x42aa5e['ticketType'],_0x1063be['ticketId']));logger[_0xc9f8('0x18')](util[_0xc9f8('0x43')]('['+_0x4cf581[_0xc9f8('0x1c')]()+_0xc9f8('0x5a'),_0x4cf581));if(_0x4cf581!==_0xc9f8('0x49')){logger[_0xc9f8('0x18')]('['+_0x4cf581[_0xc9f8('0x1c')]()+']',_0xc9f8('0x5b'));emit(_0x3f4f37[_0xc9f8('0xc')],_0x11dcdf['name'],_0x42aa5e[_0xc9f8('0x37')],_0x1063be['ticketId']);}})['catch'](function(_0x3d111a){logger[_0xc9f8('0x10')]('['+_0x4cf581[_0xc9f8('0x1c')]()+_0xc9f8('0x5c'),util[_0xc9f8('0x5d')](_0x3d111a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x62d6=['util','md5','../../../../config/logger','dynamics365','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','then','access_token','toUpperCase',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress',']\x20Agent\x20found\x20','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','string','nameField','idField','indexOf','substring','content','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','ticketId','message','format','user:%s','emit','trigger:browser:url','serverUrl','stripTrailingSlash','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0x62d6,0x17d));var _0x662d=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x62d6[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x662d('0x0'));var BPromise=require(_0x662d('0x1'));var rp=require(_0x662d('0x2'));var util=require(_0x662d('0x3'));var intUtil=require('./util');var md5=require(_0x662d('0x4'));var Redis=require('ioredis');var logger=require(_0x662d('0x5'))(_0x662d('0x6'));var config=require(_0x662d('0x7'));config['redis']=_[_0x662d('0x8')](config[_0x662d('0x9')],{'host':_0x662d('0xa'),'port':0x18eb});var io=require(_0x662d('0xb'))(new Redis(config[_0x662d('0x9')]));function getAuthToken(_0x430799,_0x13fc98,_0x3b9fcb){var _0x508860={'method':_0x662d('0xc'),'uri':_0x13fc98,'form':{'client_id':_0x430799[_0x662d('0xd')],'resource':_0x430799[_0x662d('0xe')],'username':_0x430799[_0x662d('0xf')],'password':_0x430799[_0x662d('0x10')],'grant_type':_0x662d('0x10'),'client_secret':_0x430799['clientSecret']},'json':!![]};return rp(_0x508860)[_0x662d('0x11')](function(_0x1ddc29){return _0x1ddc29[_0x662d('0x12')];})['catch'](function(_0x90101f){logger['error']('['+[_0x3b9fcb[_0x662d('0x13')]()]+_0x662d('0x14'));return _0x90101f['message'];});}function getUser(_0x4cf9e9,_0x9c362b,_0x153797,_0x540473,_0x170251,_0x4cbd89){return new BPromise(function(_0x4b7732,_0x1bda3f){return getAuthToken(_0x9c362b,_0x540473,_0x4cbd89)[_0x662d('0x11')](function(_0x1625a0){var _0x44c4a4={'method':_0x662d('0x15'),'uri':_0x170251+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x662d('0x16')+_0x1625a0,'OData-Version':_0x662d('0x17')},'json':!![]};return rp(_0x44c4a4);})[_0x662d('0x11')](function(_0x5e2d5b){var _0x1d4ae3=_0x5e2d5b[_0x662d('0x18')];var _0x549639=![];var _0x2d0265=null;if(!_[_0x662d('0x19')](_0x153797)){if(intUtil[_0x662d('0x1a')](_0x153797[_0x662d('0x1b')])){_0x4cf9e9[_0x662d('0x1c')]=_0x153797[_0x662d('0x1b')];for(_0x2d0265=0x0;_0x2d0265<_0x1d4ae3['length'];_0x2d0265++){if(_0x1d4ae3[_0x2d0265][_0x662d('0x1d')]===_0x153797[_0x662d('0x1b')]&&!_0x1d4ae3[_0x2d0265]['isdisabled']){_0x549639=!![];logger['info']('['+[_0x4cbd89[_0x662d('0x13')]()]+_0x662d('0x1e')+_0x1d4ae3[_0x2d0265][_0x662d('0x1f')]+'!');_0x4cf9e9[_0x662d('0x20')]=_0x1d4ae3[_0x2d0265][_0x662d('0x1f')];}}}}if(!_0x549639){logger[_0x662d('0x21')]('['+[_0x4cbd89[_0x662d('0x13')]()]+_0x662d('0x22'));_0x4cf9e9[_0x662d('0x1c')]=_0x9c362b[_0x662d('0xf')];for(_0x2d0265=0x0;_0x2d0265<_0x1d4ae3[_0x662d('0x23')];_0x2d0265++){if(_0x1d4ae3[_0x2d0265]['internalemailaddress']===_0x9c362b[_0x662d('0xf')]){_0x4cf9e9[_0x662d('0x20')]=_0x1d4ae3[_0x2d0265][_0x662d('0x1f')];}}}_0x4b7732(_0x4cf9e9);})[_0x662d('0x24')](function(_0x3c3cc2){_0x1bda3f(_0x3c3cc2['message']);});});}function createEndUser(_0x507a1c,_0x78aa3f,_0x6bed6b,_0x49c59d,_0x7781a0,_0x3ea20f){return new BPromise(function(_0x3daccb,_0x5aef56){return getAuthToken(_0x78aa3f,_0x6bed6b,_0x3ea20f)['then'](function(_0x5379f6){var _0x56e450=_0x3ea20f[_0x662d('0x25')]()===_0x662d('0x26')?_0x7781a0[_0x662d('0x27')]:_0x7781a0[_0x662d('0x28')];var _0x360d05={'method':_0x662d('0xc'),'uri':_0x49c59d+_0x662d('0x29'),'body':{'telephone1':_0x56e450,'fullname':_0x56e450,'firstname':_0x56e450,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x662d('0x2a')+_0x507a1c[_0x662d('0x20')]+')'},'headers':{'Authorization':_0x662d('0x16')+_0x5379f6,'OData-Version':_0x662d('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x360d05);})[_0x662d('0x11')](function(_0xe0fc70){var _0x9eaff6=_0xe0fc70[_0x662d('0x2b')][_0x662d('0x2c')];var _0x1cff02=_0x9eaff6['substring'](_0x9eaff6[_0x662d('0x2d')]('(')+0x1,_0x9eaff6[_0x662d('0x2d')](')'));_0x507a1c[_0x662d('0x2e')]=_0x1cff02;_0x3daccb(_0x507a1c);})[_0x662d('0x24')](function(_0x2057a0){_0x5aef56(_0x2057a0['message']);});});}function getEndUser(_0xeeb6c4,_0x451af4,_0x72a872,_0x4ae012,_0x27d780,_0x238869){return new BPromise(function(_0x19d4de,_0x19f946){return getAuthToken(_0x451af4,_0x72a872,_0x238869)[_0x662d('0x11')](function(_0x73c463){var _0x331b95={'method':_0x662d('0x15'),'uri':_0x4ae012+_0x662d('0x2f'),'headers':{'Authorization':_0x662d('0x16')+_0x73c463,'If-None-Match':null,'OData-Version':_0x662d('0x17')},'json':!![]};return rp(_0x331b95);})[_0x662d('0x11')](function(_0x3662e6){var _0x42f715=null;if(_0x3662e6){var _0x5bb83b=_0x3662e6[_0x662d('0x18')];var _0xe38045=![];for(_0x42f715=0x0;_0x42f715<_0x5bb83b[_0x662d('0x23')];_0x42f715++){var _0x5b0a0f=_0x238869[_0x662d('0x25')]()===_0x662d('0x26')?_0x27d780['destcalleridnum']:_0x27d780[_0x662d('0x28')];if(_0x5bb83b[_0x42f715][_0x662d('0x30')]===_0x5b0a0f){_0xe38045=!![];_0xeeb6c4[_0x662d('0x2e')]=_0x5bb83b[_0x42f715][_0x662d('0x31')];}}if(_0xe38045){_0x19d4de(_0xeeb6c4);}else{return createEndUser(_0xeeb6c4,_0x451af4,_0x72a872,_0x4ae012,_0x27d780,_0x238869)[_0x662d('0x11')](function(_0x3dc41f){logger[_0x662d('0x21')]('['+[_0x238869['toUpperCase']()]+_0x662d('0x32'),_0x3dc41f[_0x662d('0x2e')]);_0x19d4de(_0x3dc41f);});}}else{return createEndUser(_0xeeb6c4,_0x451af4,_0x72a872,_0x4ae012,_0x27d780,_0x238869)[_0x662d('0x11')](function(_0x5a0b5a){logger[_0x662d('0x21')]('['+[_0x238869[_0x662d('0x13')]()]+_0x662d('0x33'),_0x5a0b5a[_0x662d('0x2e')]);_0x19d4de(_0x5a0b5a);});}});});}function getCustomFields(_0x44fc4b,_0x489193,_0x4fed65){var _0x342b21={};if(_0x44fc4b['length']>0x0){_[_0x662d('0x34')](_0x44fc4b,function(_0x244602){if(_0x244602[_0x662d('0x35')]===_0x662d('0x36')&&_0x244602[_0x662d('0x37')]&&!_0x244602['customField']){var _0x41ddfc=_0x244602[_0x662d('0x38')]['toLowerCase']();var _0x1988d3=_0x41ddfc['substring'](0x0,_0x41ddfc[_0x662d('0x39')]('_'));var _0x114901=_0x41ddfc[_0x662d('0x3a')](_0x41ddfc[_0x662d('0x39')]('_')+0x1);if(_0x1988d3===_0x4fed65){_0x342b21[_0x114901]=_0x244602[_0x662d('0x3b')];}}});}return _0x342b21;}function getTicket(_0x476c84,_0x2e5d8b,_0x3cbcef,_0x1ffa3c,_0x316667,_0x2edaa4,_0x29c66b){return new BPromise(function(_0x4629cb,_0xeac2fe){var _0xd8d265;return getAuthToken(_0x2e5d8b,_0x3cbcef,_0x29c66b)['then'](function(_0x5a61c3){if(_0x2edaa4[_0x662d('0x3c')]==='incident'){_0xd8d265={'method':'POST','uri':_0x1ffa3c+_0x662d('0x3d'),'body':Object[_0x662d('0x3e')]({},{'title':intUtil[_0x662d('0x3f')](_0x2edaa4[_0x662d('0x40')],_0x316667,'\x20'),'description':intUtil[_0x662d('0x3f')](_0x2edaa4[_0x662d('0x41')],_0x316667,'\x0a'),'customerid_contact@odata.bind':_0x662d('0x42')+_0x476c84[_0x662d('0x2e')]+')','ownerid@odata.bind':_0x662d('0x2a')+_0x476c84[_0x662d('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x2edaa4[_0x662d('0x43')],_0x316667,_0x2edaa4[_0x662d('0x3c')])),'headers':{'Authorization':_0x662d('0x16')+_0x5a61c3,'OData-Version':_0x662d('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2edaa4[_0x662d('0x3c')]===_0x662d('0x44')){_0xd8d265={'method':_0x662d('0xc'),'uri':_0x1ffa3c+'phonecalls','body':Object[_0x662d('0x3e')]({},{'subject':intUtil[_0x662d('0x3f')](_0x2edaa4['Subjects'],_0x316667,'\x20'),'phonenumber':String(_0x316667[_0x662d('0x28')]),'description':intUtil[_0x662d('0x3f')](_0x2edaa4[_0x662d('0x41')],_0x316667,'\x0a'),'regardingobjectid_contact@odata.bind':_0x662d('0x42')+_0x476c84[_0x662d('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x476c84[_0x662d('0x20')]+')','directioncode':_0x476c84[_0x662d('0x45')]===_0x662d('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x662d('0x2a')+_0x476c84[_0x662d('0x20')]+')','participationtypemask':_0x476c84['callDirection']===_0x662d('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x662d('0x42')+_0x476c84[_0x662d('0x2e')]+')','participationtypemask':_0x476c84[_0x662d('0x45')]===_0x662d('0x46')?0x1:0x2}]},getCustomFields(_0x2edaa4[_0x662d('0x43')],_0x316667,_0x2edaa4[_0x662d('0x3c')])),'headers':{'Authorization':_0x662d('0x16')+_0x5a61c3,'OData-Version':_0x662d('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xd8d265);})[_0x662d('0x11')](function(_0x2e1eb6){var _0x59bc11=_0x2e1eb6[_0x662d('0x2b')][_0x662d('0x2c')];var _0x858a88=_0x59bc11[_0x662d('0x3a')](_0x59bc11[_0x662d('0x2d')]('(')+0x1,_0x59bc11[_0x662d('0x2d')](')'));_0x476c84[_0x662d('0x47')]=_0x858a88;_0x4629cb(_0x476c84);})[_0x662d('0x24')](function(_0x58e025){_0xeac2fe(_0x58e025[_0x662d('0x48')]);});});}function emit(_0x56add7,_0x197706,_0x5d124f,_0x50bfe1){var _0x266f1f={'uri':util[_0x662d('0x49')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x56add7,_0x5d124f,_0x50bfe1)};io['to'](util[_0x662d('0x49')](_0x662d('0x4a'),_0x197706))[_0x662d('0x4b')](_0x662d('0x4c'),_0x266f1f);}exports['cs']=function(_0xe40c2a,_0x1b4ddf,_0x3de312,_0x490774,_0x2e399d,_0x47164f,_0x1674c3,_0xdbdc1a){var _0x10adea={};_0x47164f[_0x662d('0xe')]=intUtil['stripTrailingSlash'](_0x47164f['remoteUri']);_0x47164f[_0x662d('0x4d')]=intUtil[_0x662d('0x4e')](_0x47164f[_0x662d('0x4d')]);_0x10adea[_0x662d('0x45')]=_0xdbdc1a==='queue'||_0xdbdc1a===_0x662d('0x4f')?_0x662d('0x46'):_0x662d('0x26');var _0x4abaa9=util[_0x662d('0x49')]('%s/api/data/v9.0/',_0x47164f[_0x662d('0xe')]);var _0x5e1fae=util['format'](_0x662d('0x50'),_0x47164f[_0x662d('0x51')]);var _0x2e987b=util[_0x662d('0x49')](_0x662d('0x52'),_0x47164f[_0x662d('0x4d')],_0x1b4ddf[_0x662d('0x53')],md5(_0x1b4ddf[_0x662d('0x53')]));if(_0x2e399d&&_0x2e399d[_0x662d('0x54')]){logger[_0x662d('0x21')](_0x662d('0x55'),_0x662d('0x56'));_0x1b4ddf['recordingURL']=_0x2e987b;}else if(_0x1674c3&&_0x1674c3[_0x662d('0x57')]&&_0x1674c3[_0x662d('0x57')]!=='none'){logger[_0x662d('0x21')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1b4ddf['recordingURL']=_0x2e987b;}else{_0x1b4ddf['recordingURL']='';}return getUser(_0x10adea,_0x47164f,_0x490774,_0x5e1fae,_0x4abaa9,_0xdbdc1a)['then'](function(_0xfad72){logger[_0x662d('0x21')]('['+_0xdbdc1a[_0x662d('0x13')]()+_0x662d('0x58'),_0xfad72[_0x662d('0x20')]);logger[_0x662d('0x21')]('['+_0xdbdc1a[_0x662d('0x13')]()+_0x662d('0x59'),_0xfad72[_0x662d('0x1c')]);return getEndUser(_0xfad72,_0x47164f,_0x5e1fae,_0x4abaa9,_0x1b4ddf,_0xdbdc1a);})[_0x662d('0x11')](function(_0x516139){logger['info']('['+_0xdbdc1a[_0x662d('0x13')]()+_0x662d('0x5a'),_0x516139['enduserId']);logger['info']('['+_0xdbdc1a[_0x662d('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1b4ddf[_0x662d('0x28')]);return getTicket(_0x516139,_0x47164f,_0x5e1fae,_0x4abaa9,_0x1b4ddf,_0x3de312,_0xdbdc1a);})[_0x662d('0x11')](function(_0xff78a0){logger[_0x662d('0x21')](util[_0x662d('0x49')]('['+_0xdbdc1a[_0x662d('0x13')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3de312[_0x662d('0x3c')],_0xff78a0[_0x662d('0x47')]));logger[_0x662d('0x21')](util[_0x662d('0x49')]('['+_0xdbdc1a[_0x662d('0x13')]()+_0x662d('0x5b'),_0xdbdc1a));if(_0xdbdc1a!==_0x662d('0x4f')){logger[_0x662d('0x21')]('['+_0xdbdc1a['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x47164f[_0x662d('0xe')],_0x490774[_0x662d('0x5c')],_0x3de312[_0x662d('0x3c')],_0xff78a0['ticketId']);}})[_0x662d('0x24')](function(_0x34f0a7){logger[_0x662d('0x5d')]('['+_0xdbdc1a[_0x662d('0x13')]()+_0x662d('0x5e'),util[_0x662d('0x5f')](_0x34f0a7,{'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 4e1c8c2..3e2a35a 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 _0x6220=['Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','toLowerCase','content','string','idField','customField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','catch','unmanaged','The\x20Ticket\x20ID\x20is:','lastevent','toUpperCase','lodash','md5','util','./util','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!'];(function(_0x26b2db,_0x46dcb4){var _0x5eb8ed=function(_0x2a9ef8){while(--_0x2a9ef8){_0x26b2db['push'](_0x26b2db['shift']());}};_0x5eb8ed(++_0x46dcb4);}(_0x6220,0xeb));var _0x0622=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6220[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x0622('0x0'));var rp=require('request-promise');var md5=require(_0x0622('0x1'));var util=require(_0x0622('0x2'));var Redis=require('ioredis');var intUtil=require(_0x0622('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x0622('0x4'));config[_0x0622('0x5')]=_[_0x0622('0x6')](config[_0x0622('0x5')],{'host':_0x0622('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0622('0x5')]));var headers={'Content-Type':_0x0622('0x8'),'Accept':'application/json'};function emit(_0x26776b,_0x285b90,_0x11246d){io['to'](_0x26776b)[_0x0622('0x9')](_0x285b90,_0x11246d);}function getTicket(_0x33ab0b,_0x350006,_0x47d273,_0x51bad4,_0x18d43d){logger[_0x0622('0xa')](_0x0622('0xb'));var _0x409151=_[_0x0622('0xc')]({'responder_id':_0x350006['id'],'requester_id':_0x47d273['id'],'name':util[_0x0622('0xd')](_0x0622('0xe'),_0x18d43d[_0x0622('0xf')]),'phone':_0x18d43d[_0x0622('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x0622('0x11')](_0x51bad4[_0x0622('0x12')],_0x18d43d,'\x20'),'description':intUtil[_0x0622('0x11')](_0x51bad4[_0x0622('0x13')],_0x18d43d,_0x0622('0x14')),'tags':getTags(_0x51bad4[_0x0622('0x15')],_0x0622('0x16'))},getCustomFields(_0x51bad4[_0x0622('0x17')],_0x18d43d));_0x409151['custom_fields']=_[_0x0622('0x18')](_[_0x0622('0x19')](_0x409151[_0x0622('0x1a')],'id'),_0x0622('0x1b'));return request({'uri':util[_0x0622('0xd')](_0x0622('0x1c'),_0x33ab0b[_0x0622('0x1d')]),'method':_0x0622('0x1e'),'body':_0x409151})['then'](function(_0x245f56){logger[_0x0622('0xa')](_0x0622('0x1f'));return _0x245f56;});}function getUser(_0x2a7696,_0x349416){if(intUtil[_0x0622('0x20')](_0x349416)){return request({'uri':util['format'](_0x0622('0x21'),_0x2a7696['remoteUri']),'qs':{'email':_0x349416}})[_0x0622('0x22')](function(_0x4a1c54){if(_0x4a1c54[_0x0622('0x23')]){logger[_0x0622('0xa')](_0x0622('0x24'));return _[_0x0622('0x25')](_0x4a1c54,function(_0x14b39e){return _0x14b39e[_0x0622('0x26')][_0x0622('0x27')]===_0x349416;});}else{logger[_0x0622('0xa')](_0x0622('0x28'));return request({'uri':util[_0x0622('0xd')](_0x0622('0x29'),_0x2a7696[_0x0622('0x1d')])})[_0x0622('0x22')](function(_0x411c46){logger['info']('Admin\x20account\x20selected.');return _0x411c46;});}});}else{logger[_0x0622('0xa')](_0x0622('0x2a'));return request({'uri':util[_0x0622('0xd')]('%s/api/v2/agents/me',_0x2a7696[_0x0622('0x1d')])})[_0x0622('0x22')](function(_0x475ceb){logger[_0x0622('0xa')](_0x0622('0x2b'));return _0x475ceb;});}}function getEndUser(_0x507811,_0x442593,_0x4aae0d){logger[_0x0622('0xa')](_0x0622('0x2c'),_0x4aae0d);return request({'uri':util[_0x0622('0xd')](_0x0622('0x2d'),_0x507811[_0x0622('0x1d')]),'qs':{'phone':_0x4aae0d}})[_0x0622('0x22')](function(_0x49e43e){if(_0x49e43e[_0x0622('0x23')]){logger['info'](_0x0622('0x2e'));return _[_0x0622('0x25')](_0x49e43e,{'phone':_0x4aae0d});}else{logger[_0x0622('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x0622('0xd')](_0x0622('0x2d'),_0x507811['remoteUri']),'method':_0x0622('0x1e'),'body':{'name':_0x442593,'phone':_0x4aae0d}})[_0x0622('0x22')](function(_0x26acb4){logger[_0x0622('0xa')](_0x0622('0x2f'));return _0x26acb4;});}});}function getAuth(_0x55c772){return util[_0x0622('0xd')](_0x0622('0x30'),new Buffer(_0x55c772[_0x0622('0x31')]+':X')[_0x0622('0x32')](_0x0622('0x33')));}function request(_0x50be1d){logger[_0x0622('0x34')](_0x0622('0x35'),JSON[_0x0622('0x36')](_0x50be1d));return rp(_[_0x0622('0x6')](_0x50be1d,{'method':_0x0622('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1d1231,_0xdb90de){var _0x285b60=[];if(_0x1d1231&&_0x1d1231[_0x0622('0x23')]>0x0){_0x285b60=_[_0x0622('0x38')](_0x1d1231,_0xdb90de);}return _0x285b60;}function getCustomFields(_0x401639,_0x1f4f70){var _0x53de13=[];var _0x48dd0c={'custom_fields':[]};if(_0x401639[_0x0622('0x23')]>0x0){_[_0x0622('0x39')](_0x401639,function(_0x30cc54){if(_0x30cc54[_0x0622('0x3a')]==='string'&&_0x30cc54['nameField']&&!_0x30cc54['customField']){_0x48dd0c[_0x30cc54['nameField'][_0x0622('0x3b')]()]=_0x30cc54[_0x0622('0x3c')][_0x0622('0x32')]();}else if(_0x30cc54[_0x0622('0x3a')]===_0x0622('0x3d')&&_0x30cc54[_0x0622('0x3e')]&&_0x30cc54[_0x0622('0x3f')]){_0x48dd0c['custom_fields'][_0x0622('0x40')]({'id':_0x30cc54[_0x0622('0x3e')],'value':_0x30cc54[_0x0622('0x3c')][_0x0622('0x32')]()});}else if(_0x30cc54[_0x0622('0x3a')]==='variable'&&_0x30cc54[_0x0622('0x41')]&&_0x30cc54[_0x0622('0x3e')]&&_0x30cc54['customField']){_0x1f4f70[_0x30cc54['variableName']]&&_0x48dd0c[_0x0622('0x1a')][_0x0622('0x40')]({'id':_0x30cc54[_0x0622('0x3e')],'value':_0x1f4f70[_0x30cc54[_0x0622('0x41')]]['toString']()});}else if(_0x30cc54[_0x0622('0x3a')]===_0x0622('0x42')&&_0x30cc54[_0x0622('0x43')]&&_0x30cc54[_0x0622('0x43')][_0x0622('0x16')]&&_0x30cc54[_0x0622('0x3e')]&&_0x30cc54[_0x0622('0x3f')]){_0x1f4f70[_0x30cc54[_0x0622('0x43')][_0x0622('0x16')][_0x0622('0x3b')]()]&&_0x48dd0c[_0x0622('0x1a')]['push']({'id':_0x30cc54[_0x0622('0x3e')],'value':_0x1f4f70[_0x30cc54[_0x0622('0x43')][_0x0622('0x16')][_0x0622('0x3b')]()]['toString']()});}});}return _0x48dd0c;}exports[_0x0622('0x44')]=function(_0x9ba031,_0xbfba7e,_0x1e8963,_0xb18b57,_0x471a0e,_0x58e2e6){var _0x3b4727,_0x23aa78;_0x58e2e6['remoteUri']=intUtil[_0x0622('0x45')](_0x58e2e6[_0x0622('0x1d')]);_0x58e2e6[_0x0622('0x46')]=intUtil[_0x0622('0x45')](_0x58e2e6['serverUrl']);if(_0x471a0e&&_0x471a0e['monitor_format']){logger[_0x0622('0xa')](_0x0622('0x47'),_0x0622('0x48'));_0xbfba7e[_0x0622('0x49')]=util[_0x0622('0xd')](_0x0622('0x4a'),_0x58e2e6[_0x0622('0x46')],_0xbfba7e[_0x0622('0x4b')],md5(_0xbfba7e[_0x0622('0x4b')]));}else{_0xbfba7e[_0x0622('0x49')]='';}headers[_0x0622('0x4c')]=getAuth(_0x58e2e6);return getUser(_0x58e2e6,_0xb18b57[_0x0622('0x27')])[_0x0622('0x22')](function(_0x328c20){_0x3b4727=_0x328c20;logger[_0x0622('0xa')](_0x0622('0x4d'),_0x3b4727['id']);return getEndUser(_0x58e2e6,_0xbfba7e[_0x0622('0xf')],_0xbfba7e['calleridnum']);})[_0x0622('0x22')](function(_0x4ef3ad){_0x23aa78=_0x4ef3ad;logger[_0x0622('0xa')](_0x0622('0x4e'),_0x23aa78['id']);return getTicket(_0x58e2e6,_0x3b4727,_0x23aa78,_0x1e8963,_0xbfba7e);})[_0x0622('0x22')](function(_0x402a44){if(_0x402a44&&_0x402a44['id']){logger[_0x0622('0xa')](_0x0622('0x1f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x402a44['id']);logger[_0x0622('0xa')](_0x0622('0x47'),_0x0622('0x4f'));emit(util['format'](_0x0622('0x50'),_0xb18b57[_0x0622('0x16')]),_0x0622('0x51'),{'uri':util[_0x0622('0xd')]('%s/helpdesk/tickets/%d',_0x58e2e6[_0x0622('0x1d')],_0x402a44['id'])});}})['catch'](function(_0x3b51ec){logger[_0x0622('0x52')](_0x0622('0x47'),JSON[_0x0622('0x36')](_0x3b51ec));});};exports['outbound']=function(_0xd46858,_0x458d12,_0x38a636,_0x1ac0c1,_0x41f0fc,_0x5422cf,_0x2b7a50){var _0x374b06,_0xe9df63;_0x5422cf[_0x0622('0x1d')]=intUtil[_0x0622('0x45')](_0x5422cf[_0x0622('0x1d')]);_0x5422cf[_0x0622('0x46')]=intUtil[_0x0622('0x45')](_0x5422cf[_0x0622('0x46')]);if(_0x2b7a50&&_0x2b7a50[_0x0622('0x53')]&&_0x2b7a50[_0x0622('0x53')]!==_0x0622('0x54')){logger[_0x0622('0xa')](_0x0622('0x55'),_0x0622('0x48'));_0x458d12[_0x0622('0x49')]=util[_0x0622('0xd')](_0x0622('0x4a'),_0x5422cf['serverUrl'],_0x458d12['uniqueid'],md5(_0x458d12[_0x0622('0x4b')]));}headers['Authorization']=getAuth(_0x5422cf);return getUser(_0x5422cf,_0x1ac0c1['email'])[_0x0622('0x22')](function(_0x197a66){_0x374b06=_0x197a66;logger[_0x0622('0xa')](_0x0622('0x4d'),_0x374b06['id']);return getEndUser(_0x5422cf,_0x458d12[_0x0622('0x56')],_0x458d12[_0x0622('0x57')]);})[_0x0622('0x22')](function(_0x133e61){_0xe9df63=_0x133e61;logger[_0x0622('0xa')]('The\x20Enduser\x20ID\x20is:',_0xe9df63['id']);return getTicket(_0x5422cf,_0x374b06,_0xe9df63,_0x38a636,_0x458d12);})[_0x0622('0x22')](function(_0x3674a9){if(_0x3674a9&&_0x3674a9['id']){logger[_0x0622('0xa')](_0x0622('0x1f'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x3674a9['id']);logger[_0x0622('0xa')](_0x0622('0x55'),_0x0622('0x4f'));emit(util[_0x0622('0xd')](_0x0622('0x50'),_0x1ac0c1['name']),'trigger:browser:url',{'uri':util[_0x0622('0xd')](_0x0622('0x58'),_0x5422cf[_0x0622('0x1d')],_0x3674a9['id'])});}})[_0x0622('0x59')](function(_0x4e834c){logger[_0x0622('0x52')]('[OUTBOUND]',JSON[_0x0622('0x36')](_0x4e834c));});};exports[_0x0622('0x5a')]=function(_0x4c9642,_0x4d6ef8,_0x211b63,_0x391001,_0x2ea07,_0x1497de){var _0x4bdd41,_0x5e697c;_0x1497de[_0x0622('0x1d')]=intUtil[_0x0622('0x45')](_0x1497de[_0x0622('0x1d')]);_0x1497de[_0x0622('0x46')]=intUtil[_0x0622('0x45')](_0x1497de['serverUrl']);if(_0x2ea07&&_0x2ea07['monitor_format']){logger[_0x0622('0xa')]('['+_0x4d6ef8['lastevent']['toUpperCase']()+']',_0x0622('0x48'));_0x4d6ef8['recordingURL']=util[_0x0622('0xd')](_0x0622('0x4a'),_0x1497de[_0x0622('0x46')],_0x4d6ef8[_0x0622('0x4b')],md5(_0x4d6ef8[_0x0622('0x4b')]));}else{_0x4d6ef8[_0x0622('0x49')]='';}headers[_0x0622('0x4c')]=getAuth(_0x1497de);return getUser(_0x1497de,'')['then'](function(_0x19eff6){_0x4bdd41=_0x19eff6;logger[_0x0622('0xa')](_0x0622('0x4d'),_0x4bdd41['id']);return getEndUser(_0x1497de,_0x4d6ef8[_0x0622('0xf')],_0x4d6ef8[_0x0622('0x10')]);})[_0x0622('0x22')](function(_0x63f90f){_0x5e697c=_0x63f90f;logger[_0x0622('0xa')](_0x0622('0x4e'),_0x5e697c['id']);return getTicket(_0x1497de,_0x4bdd41,_0x5e697c,_0x211b63,_0x4d6ef8);})[_0x0622('0x22')](function(_0x2990b1){if(_0x2990b1){logger['info'](_0x0622('0x1f'));logger[_0x0622('0xa')](_0x0622('0x5b'),_0x2990b1['id']);}})['catch'](function(_0x209a6d){logger[_0x0622('0x52')]('['+_0x4d6ef8[_0x0622('0x5c')][_0x0622('0x5d')]()+']',JSON[_0x0622('0x36')](_0x209a6d));});}; \ No newline at end of file +var _0x5c9e=['Variable','toLowerCase','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','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','error','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','catch','lastevent','toUpperCase','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','then','Ticket\x20created!','validateEmail','remoteUri','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Admin\x20account\x20selected.','Enduser\x20found!','%s/api/v2/contacts','POST','Enduser\x20created.','apiKey','toString','debug','stringify','GET','map','forEach','string','customField','content','type','idField','push','variable','variableName'];(function(_0x8f6927,_0x4c623c){var _0x233281=function(_0x36d311){while(--_0x36d311){_0x8f6927['push'](_0x8f6927['shift']());}};_0x233281(++_0x4c623c);}(_0x5c9e,0x1cf));var _0xe5c9=function(_0x2a4e92,_0x2c4a4a){_0x2a4e92=_0x2a4e92-0x0;var _0x1dee75=_0x5c9e[_0x2a4e92];return _0x1dee75;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xe5c9('0x0'));var Redis=require('ioredis');var intUtil=require(_0xe5c9('0x1'));var config=require(_0xe5c9('0x2'));var logger=require(_0xe5c9('0x3'))(_0xe5c9('0x4'));config[_0xe5c9('0x5')]=_[_0xe5c9('0x6')](config['redis'],{'host':_0xe5c9('0x7'),'port':0x18eb});var io=require(_0xe5c9('0x8'))(new Redis(config[_0xe5c9('0x5')]));var headers={'Content-Type':'application/json','Accept':_0xe5c9('0x9')};function emit(_0x306f40,_0x1bf441,_0x335fb0){io['to'](_0x306f40)[_0xe5c9('0xa')](_0x1bf441,_0x335fb0);}function getTicket(_0x4f7cd5,_0x540da6,_0x3aca59,_0x11662e,_0x2477ea){logger[_0xe5c9('0xb')](_0xe5c9('0xc'));var _0x536e7f=_[_0xe5c9('0xd')]({'responder_id':_0x540da6['id'],'requester_id':_0x3aca59['id'],'name':util[_0xe5c9('0xe')](_0xe5c9('0xf'),_0x2477ea[_0xe5c9('0x10')]),'phone':_0x2477ea[_0xe5c9('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe5c9('0x12')](_0x11662e[_0xe5c9('0x13')],_0x2477ea,'\x20'),'description':intUtil[_0xe5c9('0x12')](_0x11662e[_0xe5c9('0x14')],_0x2477ea,_0xe5c9('0x15')),'tags':getTags(_0x11662e[_0xe5c9('0x16')],_0xe5c9('0x17'))},getCustomFields(_0x11662e[_0xe5c9('0x18')],_0x2477ea));_0x536e7f[_0xe5c9('0x19')]=_[_0xe5c9('0x1a')](_[_0xe5c9('0x1b')](_0x536e7f[_0xe5c9('0x19')],'id'),_0xe5c9('0x1c'));return request({'uri':util['format'](_0xe5c9('0x1d'),_0x4f7cd5['remoteUri']),'method':'POST','body':_0x536e7f})[_0xe5c9('0x1e')](function(_0x10bdc2){logger['info'](_0xe5c9('0x1f'));return _0x10bdc2;});}function getUser(_0x46303a,_0x2478ec){if(intUtil[_0xe5c9('0x20')](_0x2478ec)){return request({'uri':util[_0xe5c9('0xe')]('%s/api/v2/agents',_0x46303a[_0xe5c9('0x21')]),'qs':{'email':_0x2478ec}})[_0xe5c9('0x1e')](function(_0x3362fb){if(_0x3362fb[_0xe5c9('0x22')]){logger[_0xe5c9('0xb')](_0xe5c9('0x23'));return _[_0xe5c9('0x24')](_0x3362fb,function(_0x2d46f0){return _0x2d46f0[_0xe5c9('0x25')]['email']===_0x2478ec;});}else{logger[_0xe5c9('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xe5c9('0x26'),_0x46303a[_0xe5c9('0x21')])})['then'](function(_0x22f0ee){logger[_0xe5c9('0xb')]('Admin\x20account\x20selected.');return _0x22f0ee;});}});}else{logger[_0xe5c9('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe5c9('0xe')](_0xe5c9('0x26'),_0x46303a[_0xe5c9('0x21')])})[_0xe5c9('0x1e')](function(_0x1225ee){logger[_0xe5c9('0xb')](_0xe5c9('0x27'));return _0x1225ee;});}}function getEndUser(_0x2d44ff,_0x29ebbd,_0x1f8aac){logger[_0xe5c9('0xb')]('Searching\x20enduser\x20with\x20phone',_0x1f8aac);return request({'uri':util[_0xe5c9('0xe')]('%s/api/v2/contacts',_0x2d44ff[_0xe5c9('0x21')]),'qs':{'phone':_0x1f8aac}})[_0xe5c9('0x1e')](function(_0x15e319){if(_0x15e319[_0xe5c9('0x22')]){logger[_0xe5c9('0xb')](_0xe5c9('0x28'));return _['find'](_0x15e319,{'phone':_0x1f8aac});}else{logger[_0xe5c9('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xe5c9('0xe')](_0xe5c9('0x29'),_0x2d44ff['remoteUri']),'method':_0xe5c9('0x2a'),'body':{'name':_0x29ebbd,'phone':_0x1f8aac}})[_0xe5c9('0x1e')](function(_0x388353){logger[_0xe5c9('0xb')](_0xe5c9('0x2b'));return _0x388353;});}});}function getAuth(_0x1b0231){return util[_0xe5c9('0xe')]('Basic\x20%s',new Buffer(_0x1b0231[_0xe5c9('0x2c')]+':X')[_0xe5c9('0x2d')]('base64'));}function request(_0x29e07a){logger[_0xe5c9('0x2e')]('[HTTP]',JSON[_0xe5c9('0x2f')](_0x29e07a));return rp(_[_0xe5c9('0x6')](_0x29e07a,{'method':_0xe5c9('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x5294a2,_0x357984){var _0x5f01dc=[];if(_0x5294a2&&_0x5294a2[_0xe5c9('0x22')]>0x0){_0x5f01dc=_[_0xe5c9('0x31')](_0x5294a2,_0x357984);}return _0x5f01dc;}function getCustomFields(_0x17b974,_0x430a21){var _0x5d92b3=[];var _0x401d5f={'custom_fields':[]};if(_0x17b974[_0xe5c9('0x22')]>0x0){_[_0xe5c9('0x32')](_0x17b974,function(_0x1c48b5){if(_0x1c48b5['type']===_0xe5c9('0x33')&&_0x1c48b5['nameField']&&!_0x1c48b5[_0xe5c9('0x34')]){_0x401d5f[_0x1c48b5['nameField']['toLowerCase']()]=_0x1c48b5[_0xe5c9('0x35')]['toString']();}else if(_0x1c48b5[_0xe5c9('0x36')]===_0xe5c9('0x33')&&_0x1c48b5[_0xe5c9('0x37')]&&_0x1c48b5['customField']){_0x401d5f[_0xe5c9('0x19')][_0xe5c9('0x38')]({'id':_0x1c48b5[_0xe5c9('0x37')],'value':_0x1c48b5[_0xe5c9('0x35')][_0xe5c9('0x2d')]()});}else if(_0x1c48b5[_0xe5c9('0x36')]===_0xe5c9('0x39')&&_0x1c48b5['variableName']&&_0x1c48b5[_0xe5c9('0x37')]&&_0x1c48b5[_0xe5c9('0x34')]){_0x430a21[_0x1c48b5[_0xe5c9('0x3a')]]&&_0x401d5f['custom_fields'][_0xe5c9('0x38')]({'id':_0x1c48b5[_0xe5c9('0x37')],'value':_0x430a21[_0x1c48b5[_0xe5c9('0x3a')]][_0xe5c9('0x2d')]()});}else if(_0x1c48b5[_0xe5c9('0x36')]==='customVariable'&&_0x1c48b5[_0xe5c9('0x3b')]&&_0x1c48b5['Variable'][_0xe5c9('0x17')]&&_0x1c48b5[_0xe5c9('0x37')]&&_0x1c48b5[_0xe5c9('0x34')]){_0x430a21[_0x1c48b5['Variable'][_0xe5c9('0x17')][_0xe5c9('0x3c')]()]&&_0x401d5f['custom_fields'][_0xe5c9('0x38')]({'id':_0x1c48b5['idField'],'value':_0x430a21[_0x1c48b5[_0xe5c9('0x3b')][_0xe5c9('0x17')][_0xe5c9('0x3c')]()][_0xe5c9('0x2d')]()});}});}return _0x401d5f;}exports['queue']=function(_0x52fc22,_0x2e709c,_0x527cdc,_0x4b33a3,_0xba4a51,_0x6aec14){var _0x285bf8,_0x255d5d;_0x6aec14[_0xe5c9('0x21')]=intUtil['stripTrailingSlash'](_0x6aec14[_0xe5c9('0x21')]);_0x6aec14[_0xe5c9('0x3d')]=intUtil[_0xe5c9('0x3e')](_0x6aec14[_0xe5c9('0x3d')]);if(_0xba4a51&&_0xba4a51[_0xe5c9('0x3f')]){logger[_0xe5c9('0xb')](_0xe5c9('0x40'),_0xe5c9('0x41'));_0x2e709c[_0xe5c9('0x42')]=util[_0xe5c9('0xe')](_0xe5c9('0x43'),_0x6aec14[_0xe5c9('0x3d')],_0x2e709c[_0xe5c9('0x44')],md5(_0x2e709c['uniqueid']));}else{_0x2e709c[_0xe5c9('0x42')]='';}headers[_0xe5c9('0x45')]=getAuth(_0x6aec14);return getUser(_0x6aec14,_0x4b33a3[_0xe5c9('0x46')])[_0xe5c9('0x1e')](function(_0x38ab5e){_0x285bf8=_0x38ab5e;logger[_0xe5c9('0xb')]('The\x20User\x20ID\x20is:',_0x285bf8['id']);return getEndUser(_0x6aec14,_0x2e709c[_0xe5c9('0x10')],_0x2e709c[_0xe5c9('0x11')]);})[_0xe5c9('0x1e')](function(_0x2013a1){_0x255d5d=_0x2013a1;logger[_0xe5c9('0xb')](_0xe5c9('0x47'),_0x255d5d['id']);return getTicket(_0x6aec14,_0x285bf8,_0x255d5d,_0x527cdc,_0x2e709c);})['then'](function(_0x5357ba){if(_0x5357ba&&_0x5357ba['id']){logger[_0xe5c9('0xb')](_0xe5c9('0x1f'));logger[_0xe5c9('0xb')](_0xe5c9('0x48'),_0x5357ba['id']);logger[_0xe5c9('0xb')](_0xe5c9('0x40'),_0xe5c9('0x49'));emit(util['format'](_0xe5c9('0x4a'),_0x4b33a3['name']),_0xe5c9('0x4b'),{'uri':util[_0xe5c9('0xe')](_0xe5c9('0x4c'),_0x6aec14['remoteUri'],_0x5357ba['id'])});}})['catch'](function(_0x2a5b67){logger[_0xe5c9('0x4d')](_0xe5c9('0x40'),JSON[_0xe5c9('0x2f')](_0x2a5b67));});};exports[_0xe5c9('0x4e')]=function(_0x294f11,_0x47c7c5,_0x592851,_0x1a1cc9,_0x22755b,_0x4215e7,_0x115e9c){var _0x176297,_0x22c639;_0x4215e7[_0xe5c9('0x21')]=intUtil[_0xe5c9('0x3e')](_0x4215e7[_0xe5c9('0x21')]);_0x4215e7['serverUrl']=intUtil[_0xe5c9('0x3e')](_0x4215e7[_0xe5c9('0x3d')]);if(_0x115e9c&&_0x115e9c[_0xe5c9('0x4f')]&&_0x115e9c[_0xe5c9('0x4f')]!=='none'){logger['info'](_0xe5c9('0x50'),_0xe5c9('0x41'));_0x47c7c5[_0xe5c9('0x42')]=util[_0xe5c9('0xe')](_0xe5c9('0x43'),_0x4215e7[_0xe5c9('0x3d')],_0x47c7c5[_0xe5c9('0x44')],md5(_0x47c7c5[_0xe5c9('0x44')]));}headers['Authorization']=getAuth(_0x4215e7);return getUser(_0x4215e7,_0x1a1cc9['email'])[_0xe5c9('0x1e')](function(_0x3db557){_0x176297=_0x3db557;logger[_0xe5c9('0xb')](_0xe5c9('0x51'),_0x176297['id']);return getEndUser(_0x4215e7,_0x47c7c5[_0xe5c9('0x52')],_0x47c7c5[_0xe5c9('0x53')]);})[_0xe5c9('0x1e')](function(_0x208fb3){_0x22c639=_0x208fb3;logger['info'](_0xe5c9('0x47'),_0x22c639['id']);return getTicket(_0x4215e7,_0x176297,_0x22c639,_0x592851,_0x47c7c5);})['then'](function(_0x4680f4){if(_0x4680f4&&_0x4680f4['id']){logger[_0xe5c9('0xb')](_0xe5c9('0x1f'));logger['info'](_0xe5c9('0x48'),_0x4680f4['id']);logger[_0xe5c9('0xb')](_0xe5c9('0x50'),_0xe5c9('0x49'));emit(util[_0xe5c9('0xe')]('user:%s',_0x1a1cc9['name']),_0xe5c9('0x4b'),{'uri':util[_0xe5c9('0xe')]('%s/helpdesk/tickets/%d',_0x4215e7[_0xe5c9('0x21')],_0x4680f4['id'])});}})[_0xe5c9('0x54')](function(_0x3ed16d){logger['error']('[OUTBOUND]',JSON['stringify'](_0x3ed16d));});};exports['unmanaged']=function(_0x223ab5,_0xdad5e5,_0xa4f402,_0x939162,_0x279694,_0x25117f){var _0x4962bb,_0x42ae68;_0x25117f[_0xe5c9('0x21')]=intUtil[_0xe5c9('0x3e')](_0x25117f[_0xe5c9('0x21')]);_0x25117f['serverUrl']=intUtil['stripTrailingSlash'](_0x25117f[_0xe5c9('0x3d')]);if(_0x279694&&_0x279694[_0xe5c9('0x3f')]){logger[_0xe5c9('0xb')]('['+_0xdad5e5['lastevent']['toUpperCase']()+']',_0xe5c9('0x41'));_0xdad5e5[_0xe5c9('0x42')]=util[_0xe5c9('0xe')](_0xe5c9('0x43'),_0x25117f[_0xe5c9('0x3d')],_0xdad5e5[_0xe5c9('0x44')],md5(_0xdad5e5[_0xe5c9('0x44')]));}else{_0xdad5e5[_0xe5c9('0x42')]='';}headers[_0xe5c9('0x45')]=getAuth(_0x25117f);return getUser(_0x25117f,'')[_0xe5c9('0x1e')](function(_0x25c8a2){_0x4962bb=_0x25c8a2;logger['info'](_0xe5c9('0x51'),_0x4962bb['id']);return getEndUser(_0x25117f,_0xdad5e5[_0xe5c9('0x10')],_0xdad5e5[_0xe5c9('0x11')]);})['then'](function(_0x5ca753){_0x42ae68=_0x5ca753;logger[_0xe5c9('0xb')](_0xe5c9('0x47'),_0x42ae68['id']);return getTicket(_0x25117f,_0x4962bb,_0x42ae68,_0xa4f402,_0xdad5e5);})['then'](function(_0x973e47){if(_0x973e47){logger['info'](_0xe5c9('0x1f'));logger[_0xe5c9('0xb')](_0xe5c9('0x48'),_0x973e47['id']);}})[_0xe5c9('0x54')](function(_0x23c52e){logger[_0xe5c9('0x4d')]('['+_0xdad5e5[_0xe5c9('0x55')][_0xe5c9('0x56')]()+']',JSON[_0xe5c9('0x2f')](_0x23c52e));});}; \ 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 5bc02b5..0f131e2 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 _0x96aa=['serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','/api/lookup?q=','find','contacts','catch','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','/api/tasks','getString','Subjects','Descriptions','Contact','ticketId','Task\x20created:','error','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash'];(function(_0x170462,_0x41f4f3){var _0x4d867f=function(_0x474be5){while(--_0x474be5){_0x170462['push'](_0x170462['shift']());}};_0x4d867f(++_0x41f4f3);}(_0x96aa,0x67));var _0xa96a=function(_0x2dfee,_0x187b28){_0x2dfee=_0x2dfee-0x0;var _0x2c2ba6=_0x96aa[_0x2dfee];return _0x2c2ba6;};'use strict';var _=require(_0xa96a('0x0'));var rp=require(_0xa96a('0x1'));var md5=require('md5');var util=require(_0xa96a('0x2'));var moment=require(_0xa96a('0x3'));var Promise=require(_0xa96a('0x4'));var Redis=require(_0xa96a('0x5'));var intUtil=require(_0xa96a('0x6'));var config=require('../../../../config/environment');var logger=require(_0xa96a('0x7'))(_0xa96a('0x8'));config['redis']=_[_0xa96a('0x9')](config[_0xa96a('0xa')],{'host':_0xa96a('0xb'),'port':0x18eb});var io=require(_0xa96a('0xc'))(new Redis(config[_0xa96a('0xa')]));function getAdminId(_0x3c7329,_0x160c16,_0x28e554,_0x3fad90){return new Promise(function(_0x134f9c,_0x13321e){var _0x4825fc=![];var _0x33b786={'method':'GET','uri':_0x3fad90+_0xa96a('0xd'),'json':!![]};_0x33b786[_0xa96a('0xe')]=_0x28e554;logger['info'](_0xa96a('0xf'));return rp(_0x33b786)[_0xa96a('0x10')](function(_0x192554){if(_0x192554){var _0x19af3d=_0x192554[_0xa96a('0x11')];var _0x3f0f9e=null;for(_0x3f0f9e=0x0;_0x3f0f9e<_0x19af3d[_0xa96a('0x12')];_0x3f0f9e++){if(_0x19af3d[_0x3f0f9e][_0xa96a('0x13')]===_0x3c7329[_0xa96a('0x14')]){_0x3c7329[_0xa96a('0x15')]=_0x19af3d[_0x3f0f9e]['id'];_0x4825fc=!![];}}if(_0x4825fc){logger[_0xa96a('0x16')](_0xa96a('0x17'),_0x3c7329['adminId']);_0x134f9c(_0x3c7329);}else{_0x13321e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x13321e({'statusCode':0x194,'message':_0xa96a('0x18')});}})['catch'](function(_0x14927b){logger['error']('['+[_0x160c16[_0xa96a('0x19')]()]+']',_0x14927b[_0xa96a('0x1a')]);_0x13321e(_0x14927b);});});}function getUser(_0x1f623e,_0x3372f9,_0x11503){return function(_0x16257d){return new Promise(function(_0x5013f8,_0x8d32c0){var _0xbcc80a={'method':'GET','uri':_0x11503+_0xa96a('0xd'),'json':!![]};_0xbcc80a[_0xa96a('0xe')]=_0x3372f9;logger[_0xa96a('0x16')](_0xa96a('0x1b'));return rp(_0xbcc80a)[_0xa96a('0x10')](function(_0x14c8e5){if(_0x14c8e5){var _0x4e3f58=_0x14c8e5[_0xa96a('0x11')];var _0x3f41ad=![];var _0x5ee7ba=null;if(_0x16257d[_0xa96a('0x1c')]!==null){logger['info'](_0xa96a('0x1d'),_0x16257d['agentEmail']);_0x16257d[_0xa96a('0x1e')]=_0x16257d[_0xa96a('0x1c')];for(_0x5ee7ba=0x0;_0x5ee7ba<_0x4e3f58['length'];_0x5ee7ba++){if(_0x4e3f58[_0x5ee7ba]['email']===_0x16257d[_0xa96a('0x1c')]){_0x3f41ad=!![];_0x16257d[_0xa96a('0x1f')]=_0x4e3f58[_0x5ee7ba]['id'];logger[_0xa96a('0x16')](_0xa96a('0x20'),_0x16257d[_0xa96a('0x1f')]);}}}if(!_0x3f41ad){logger[_0xa96a('0x16')]('Admin\x20selected');_0x16257d['userEmail']=_0x16257d[_0xa96a('0x14')];_0x16257d['userId']=_0x16257d[_0xa96a('0x15')];_0x3f41ad=!![];}if(_0x3f41ad){_0x5013f8(_0x16257d);}else{_0x8d32c0({'statusCode':0x194,'message':_0xa96a('0x18')});}}else{_0x8d32c0({'statusCode':0x194,'message':_0xa96a('0x18')});}})['catch'](function(_0x171450){logger['error']('['+[_0x1f623e['toUpperCase']()]+']',_0x171450[_0xa96a('0x1a')]);_0x8d32c0(_0x171450);});});};}function searchContact(_0x4f76e0,_0xf259a9,_0x436420,_0x3c1690){return new Promise(function(_0x481663,_0x1bb965){var _0x5256cb={'method':'GET','headers':_0xf259a9,'uri':_0x4f76e0+_0xa96a('0x21')+_0x3c1690+'&f='+_0x436420+'&entities=contact','json':!![]};rp(_0x5256cb)[_0xa96a('0x10')](function(_0x4643a1){var _0x4c69f3=_[_0xa96a('0x22')](_0x4643a1[_0xa96a('0x23')][_0xa96a('0x23')],[_0x436420,_0x3c1690]);_0x481663(_0x4c69f3);})[_0xa96a('0x24')](function(_0x45e3b5){_0x1bb965(_0x45e3b5);});});}function getEndUser(_0x4eb4ab,_0x835c6c,_0x17b6e9){return function(_0x5eb8f5){return new Promise(function(_0x3947fc,_0x233ce1){logger[_0xa96a('0x16')](util[_0xa96a('0x25')](_0xa96a('0x26'),_0x5eb8f5[_0xa96a('0x27')]));searchContact(_0x17b6e9,_0x835c6c,_0xa96a('0x28'),_0x5eb8f5['contactNumber'])[_0xa96a('0x10')](function(_0x267fcf){if(_0x267fcf){_0x5eb8f5[_0xa96a('0x29')]=_0x267fcf['id'];logger[_0xa96a('0x16')](_0xa96a('0x2a'),_0x5eb8f5[_0xa96a('0x29')]);return _0x3947fc(_0x5eb8f5);}searchContact(_0x17b6e9,_0x835c6c,'work_number',_0x5eb8f5['contactNumber'])['then'](function(_0x509eee){if(_0x509eee){_0x5eb8f5[_0xa96a('0x29')]=_0x509eee['id'];logger[_0xa96a('0x16')](_0xa96a('0x2b'),_0x5eb8f5[_0xa96a('0x29')]);return _0x3947fc(_0x5eb8f5);}createEndUser(_0x5eb8f5,_0x4eb4ab,_0x835c6c,_0x17b6e9)[_0xa96a('0x10')](function(_0x122539){logger[_0xa96a('0x16')](_0xa96a('0x2c'),_0x122539[_0xa96a('0x29')]);return _0x3947fc(_0x122539);});});})[_0xa96a('0x24')](function(_0x233a64){_0x233ce1(_0x233a64);});});};}function createEndUser(_0x39ee3f,_0x54fdb1,_0x4fe1df,_0x21f2b6){return new Promise(function(_0x3966da,_0x49fd6e){var _0xf86b6b=moment();var _0x535019={'method':'POST','uri':_0x21f2b6+_0xa96a('0x2d'),'body':{'contact':{'last_name':_0x39ee3f[_0xa96a('0x27')],'work_number':_0x39ee3f[_0xa96a('0x27')],'mobile_number':_0x39ee3f[_0xa96a('0x27')],'owner_id':_0x39ee3f[_0xa96a('0x1f')],'created_at':_0xf86b6b[_0xa96a('0x25')](_0xa96a('0x2e'))}},'json':!![]};_0x535019[_0xa96a('0xe')]=_0x4fe1df;logger[_0xa96a('0x16')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x535019)[_0xa96a('0x10')](function(_0xc02bee){_0x39ee3f[_0xa96a('0x29')]=_0xc02bee['contact']['id'];_0x3966da(_0x39ee3f);})['catch'](function(_0x557f9a){logger['error']('['+[_0x54fdb1[_0xa96a('0x19')]()]+']',_0x557f9a[_0xa96a('0x1a')]);_0x49fd6e(_0x557f9a['message']);});});}function getTicket(_0x157ade,_0x11cf9b,_0x223016,_0xc5f689,_0x930376){return function(_0x1b3458){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x5b78f1,_0xf2a45b){var _0x29d09f=moment();var _0x231ff2={'method':'POST','uri':_0x223016+_0xa96a('0x2f'),'body':{'title':intUtil[_0xa96a('0x30')](_0xc5f689[_0xa96a('0x31')],_0x930376,'\x20'),'description':intUtil['getString'](_0xc5f689[_0xa96a('0x32')],_0x930376,'\x0a'),'owner_id':_0x1b3458[_0xa96a('0x1f')],'creater_id':_0x1b3458[_0xa96a('0x15')],'targetable_id':_0x1b3458[_0xa96a('0x29')],'targetable_type':_0xa96a('0x33'),'created_at':_0x29d09f[_0xa96a('0x25')](_0xa96a('0x2e')),'due_date':_0x29d09f['add'](0x1e,'m')[_0xa96a('0x25')](_0xa96a('0x2e'))},'json':!![]};_0x231ff2['headers']=_0x11cf9b;return rp(_0x231ff2)['then'](function(_0x10f6bf){_0x1b3458[_0xa96a('0x34')]=_0x10f6bf['task']['id'];logger['info'](_0xa96a('0x35'),_0x1b3458[_0xa96a('0x34')]);_0x5b78f1(_0x1b3458);})[_0xa96a('0x24')](function(_0x399aef){logger[_0xa96a('0x36')]('['+[_0x157ade['toUpperCase']()]+']',_0x399aef[_0xa96a('0x1a')]);_0xf2a45b(_0x399aef[_0xa96a('0x1a')]);});});};}function emit(_0x28444a,_0x590509,_0x4d2457){var _0x346f02={'uri':_0x28444a+_0xa96a('0x37')+_0x4d2457};io['to'](util[_0xa96a('0x25')]('user:%s',_0x590509))['emit'](_0xa96a('0x38'),_0x346f02);}exports['cs']=function(_0x2bd9e2,_0xd7ee10,_0x10b62e,_0x2e0c0d,_0x4b8a06,_0x1bf6f3,_0x4727a8,_0x193042){var _0x2afe5b={};var _0x1e2cdb={'Authorization':_0xa96a('0x39')+_0x1bf6f3[_0xa96a('0x3a')]};_0x1bf6f3[_0xa96a('0x3b')]=intUtil[_0xa96a('0x3c')](_0x1bf6f3['remoteUri']);_0x1bf6f3[_0xa96a('0x3d')]=intUtil['stripTrailingSlash'](_0x1bf6f3['serverUrl']);var _0xa772d6=_0x1bf6f3['remoteUri'];_0x2afe5b[_0xa96a('0x14')]=_0x1bf6f3[_0xa96a('0x3e')];_0x2afe5b[_0xa96a('0x27')]=_0x193042[_0xa96a('0x3f')]()===_0xa96a('0x40')?_0xd7ee10[_0xa96a('0x41')]:_0xd7ee10[_0xa96a('0x42')];_0x2afe5b[_0xa96a('0x43')]=_0x193042===_0xa96a('0x44')||_0x193042===_0xa96a('0x45')?_0xa96a('0x44'):'outbound';if(_0x2e0c0d){_0x2afe5b[_0xa96a('0x1c')]=_0x2e0c0d[_0xa96a('0x13')];}var _0x59497c=util[_0xa96a('0x25')](_0xa96a('0x46'),_0x1bf6f3['serverUrl'],_0xd7ee10[_0xa96a('0x47')],md5(_0xd7ee10['uniqueid']));if(_0x4b8a06&&_0x4b8a06[_0xa96a('0x48')]){logger[_0xa96a('0x16')](_0xa96a('0x49'),_0xa96a('0x4a'));_0xd7ee10['recordingURL']=_0x59497c;}else if(_0x4727a8&&_0x4727a8[_0xa96a('0x4b')]&&_0x4727a8[_0xa96a('0x4b')]!=='none'){logger[_0xa96a('0x16')](_0xa96a('0x4c'),_0xa96a('0x4a'));_0xd7ee10[_0xa96a('0x4d')]=_0x59497c;}else{_0xd7ee10[_0xa96a('0x4d')]='';}return getAdminId(_0x2afe5b,_0x193042,_0x1e2cdb,_0xa772d6)[_0xa96a('0x10')](getUser(_0x193042,_0x1e2cdb,_0xa772d6))[_0xa96a('0x10')](getEndUser(_0x193042,_0x1e2cdb,_0xa772d6))[_0xa96a('0x10')](getTicket(_0x193042,_0x1e2cdb,_0xa772d6,_0x10b62e,_0xd7ee10))[_0xa96a('0x10')](function(_0x7f461a){logger['info'](util[_0xa96a('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x7f461a[_0xa96a('0x34')]));if(_0x193042!==_0xa96a('0x45')){logger['info']('['+[_0x193042['toUpperCase']()]+']',_0xa96a('0x4e'));emit(_0xa772d6,_0x2e0c0d[_0xa96a('0x4f')],_0x7f461a[_0xa96a('0x29')]);}})['catch'](function(_0x288b13){logger['error']('['+[_0x193042[_0xa96a('0x19')]()]+_0xa96a('0x50'),util[_0xa96a('0x51')](_0x288b13,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xafc4=['queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','moment','bluebird','ioredis','./util','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','message','GET','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','catch','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','contactNumber','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','callDirection'];(function(_0x1ea034,_0x476985){var _0x2a16c1=function(_0x2d8a2c){while(--_0x2d8a2c){_0x1ea034['push'](_0x1ea034['shift']());}};_0x2a16c1(++_0x476985);}(_0xafc4,0x69));var _0x4afc=function(_0x2177ae,_0x2e9815){_0x2177ae=_0x2177ae-0x0;var _0x31e38f=_0xafc4[_0x2177ae];return _0x31e38f;};'use strict';var _=require(_0x4afc('0x0'));var rp=require('request-promise');var md5=require(_0x4afc('0x1'));var util=require('util');var moment=require(_0x4afc('0x2'));var Promise=require(_0x4afc('0x3'));var Redis=require(_0x4afc('0x4'));var intUtil=require(_0x4afc('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0x4afc('0x6')]=_[_0x4afc('0x7')](config[_0x4afc('0x6')],{'host':_0x4afc('0x8'),'port':0x18eb});var io=require(_0x4afc('0x9'))(new Redis(config[_0x4afc('0x6')]));function getAdminId(_0x5e1e29,_0x31e165,_0x1c740c,_0x134aad){return new Promise(function(_0x1e6bf5,_0x1b8981){var _0x458fde=![];var _0x5542ec={'method':'GET','uri':_0x134aad+_0x4afc('0xa'),'json':!![]};_0x5542ec['headers']=_0x1c740c;logger[_0x4afc('0xb')](_0x4afc('0xc'));return rp(_0x5542ec)['then'](function(_0x38b322){if(_0x38b322){var _0x3fb54a=_0x38b322[_0x4afc('0xd')];var _0x2768bf=null;for(_0x2768bf=0x0;_0x2768bf<_0x3fb54a[_0x4afc('0xe')];_0x2768bf++){if(_0x3fb54a[_0x2768bf][_0x4afc('0xf')]===_0x5e1e29[_0x4afc('0x10')]){_0x5e1e29[_0x4afc('0x11')]=_0x3fb54a[_0x2768bf]['id'];_0x458fde=!![];}}if(_0x458fde){logger['info'](_0x4afc('0x12'),_0x5e1e29[_0x4afc('0x11')]);_0x1e6bf5(_0x5e1e29);}else{_0x1b8981({'statusCode':0x194,'message':_0x4afc('0x13')});}}else{_0x1b8981({'statusCode':0x194,'message':_0x4afc('0x13')});}})['catch'](function(_0x4e32e8){logger[_0x4afc('0x14')]('['+[_0x31e165['toUpperCase']()]+']',_0x4e32e8[_0x4afc('0x15')]);_0x1b8981(_0x4e32e8);});});}function getUser(_0x24ed6d,_0x2b928b,_0x31eec4){return function(_0x3a306f){return new Promise(function(_0x3ebdc8,_0x22f809){var _0x3ad418={'method':_0x4afc('0x16'),'uri':_0x31eec4+_0x4afc('0xa'),'json':!![]};_0x3ad418[_0x4afc('0x17')]=_0x2b928b;logger['info'](_0x4afc('0x18'));return rp(_0x3ad418)[_0x4afc('0x19')](function(_0x32865e){if(_0x32865e){var _0x14558a=_0x32865e['users'];var _0x3bddc0=![];var _0x30eda3=null;if(_0x3a306f[_0x4afc('0x1a')]!==null){logger[_0x4afc('0xb')](_0x4afc('0x1b'),_0x3a306f[_0x4afc('0x1a')]);_0x3a306f[_0x4afc('0x1c')]=_0x3a306f['agentEmail'];for(_0x30eda3=0x0;_0x30eda3<_0x14558a[_0x4afc('0xe')];_0x30eda3++){if(_0x14558a[_0x30eda3][_0x4afc('0xf')]===_0x3a306f['agentEmail']){_0x3bddc0=!![];_0x3a306f[_0x4afc('0x1d')]=_0x14558a[_0x30eda3]['id'];logger['info'](_0x4afc('0x1e'),_0x3a306f[_0x4afc('0x1d')]);}}}if(!_0x3bddc0){logger[_0x4afc('0xb')](_0x4afc('0x1f'));_0x3a306f[_0x4afc('0x1c')]=_0x3a306f[_0x4afc('0x10')];_0x3a306f[_0x4afc('0x1d')]=_0x3a306f[_0x4afc('0x11')];_0x3bddc0=!![];}if(_0x3bddc0){_0x3ebdc8(_0x3a306f);}else{_0x22f809({'statusCode':0x194,'message':_0x4afc('0x13')});}}else{_0x22f809({'statusCode':0x194,'message':_0x4afc('0x13')});}})[_0x4afc('0x20')](function(_0x359c07){logger[_0x4afc('0x14')]('['+[_0x24ed6d['toUpperCase']()]+']',_0x359c07[_0x4afc('0x15')]);_0x22f809(_0x359c07);});});};}function searchContact(_0x244f6c,_0x2d6112,_0x4e254d,_0x52212d){return new Promise(function(_0x54433f,_0x426e9d){var _0x5db47e={'method':'GET','headers':_0x2d6112,'uri':_0x244f6c+_0x4afc('0x21')+_0x52212d+_0x4afc('0x22')+_0x4e254d+'&entities=contact','json':!![]};rp(_0x5db47e)['then'](function(_0x52e3dd){var _0x3bae1a=_[_0x4afc('0x23')](_0x52e3dd[_0x4afc('0x24')][_0x4afc('0x24')],[_0x4e254d,_0x52212d]);_0x54433f(_0x3bae1a);})[_0x4afc('0x20')](function(_0x28cd3e){_0x426e9d(_0x28cd3e);});});}function getEndUser(_0x566389,_0x290391,_0x3d1693){return function(_0x1ba6b5){return new Promise(function(_0x2f178c,_0x2b115d){logger[_0x4afc('0xb')](util[_0x4afc('0x25')](_0x4afc('0x26'),_0x1ba6b5['contactNumber']));searchContact(_0x3d1693,_0x290391,_0x4afc('0x27'),_0x1ba6b5['contactNumber'])['then'](function(_0x324a12){if(_0x324a12){_0x1ba6b5[_0x4afc('0x28')]=_0x324a12['id'];logger[_0x4afc('0xb')](_0x4afc('0x29'),_0x1ba6b5[_0x4afc('0x28')]);return _0x2f178c(_0x1ba6b5);}searchContact(_0x3d1693,_0x290391,_0x4afc('0x2a'),_0x1ba6b5['contactNumber'])[_0x4afc('0x19')](function(_0x2d0ad8){if(_0x2d0ad8){_0x1ba6b5[_0x4afc('0x28')]=_0x2d0ad8['id'];logger[_0x4afc('0xb')](_0x4afc('0x2b'),_0x1ba6b5[_0x4afc('0x28')]);return _0x2f178c(_0x1ba6b5);}createEndUser(_0x1ba6b5,_0x566389,_0x290391,_0x3d1693)['then'](function(_0x22eea2){logger[_0x4afc('0xb')](_0x4afc('0x2c'),_0x22eea2[_0x4afc('0x28')]);return _0x2f178c(_0x22eea2);});});})['catch'](function(_0x4be1e6){_0x2b115d(_0x4be1e6);});});};}function createEndUser(_0x43c341,_0x22bd75,_0x17ea03,_0x5edfe1){return new Promise(function(_0x5790a2,_0x391120){var _0x4a06cf=moment();var _0x5947bb={'method':_0x4afc('0x2d'),'uri':_0x5edfe1+_0x4afc('0x2e'),'body':{'contact':{'last_name':_0x43c341[_0x4afc('0x2f')],'work_number':_0x43c341[_0x4afc('0x2f')],'mobile_number':_0x43c341[_0x4afc('0x2f')],'owner_id':_0x43c341[_0x4afc('0x1d')],'created_at':_0x4a06cf[_0x4afc('0x25')](_0x4afc('0x30'))}},'json':!![]};_0x5947bb[_0x4afc('0x17')]=_0x17ea03;logger[_0x4afc('0xb')](_0x4afc('0x31'));return rp(_0x5947bb)[_0x4afc('0x19')](function(_0x15c6cb){_0x43c341[_0x4afc('0x28')]=_0x15c6cb[_0x4afc('0x32')]['id'];_0x5790a2(_0x43c341);})['catch'](function(_0xd48eea){logger[_0x4afc('0x14')]('['+[_0x22bd75[_0x4afc('0x33')]()]+']',_0xd48eea[_0x4afc('0x15')]);_0x391120(_0xd48eea[_0x4afc('0x15')]);});});}function getTicket(_0x260b06,_0x3e87f0,_0x50d53f,_0x5e97f4,_0x5ee5d7){return function(_0x43bd0f){logger[_0x4afc('0xb')]('Creating\x20new\x20task');return new Promise(function(_0xe62748,_0x38a1bb){var _0x8ba5e6=moment();var _0x397996={'method':'POST','uri':_0x50d53f+_0x4afc('0x34'),'body':{'title':intUtil[_0x4afc('0x35')](_0x5e97f4[_0x4afc('0x36')],_0x5ee5d7,'\x20'),'description':intUtil[_0x4afc('0x35')](_0x5e97f4[_0x4afc('0x37')],_0x5ee5d7,'\x0a'),'owner_id':_0x43bd0f[_0x4afc('0x1d')],'creater_id':_0x43bd0f['adminId'],'targetable_id':_0x43bd0f[_0x4afc('0x28')],'targetable_type':'Contact','created_at':_0x8ba5e6[_0x4afc('0x25')](_0x4afc('0x30')),'due_date':_0x8ba5e6[_0x4afc('0x38')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x397996[_0x4afc('0x17')]=_0x3e87f0;return rp(_0x397996)[_0x4afc('0x19')](function(_0x2cf64e){_0x43bd0f[_0x4afc('0x39')]=_0x2cf64e[_0x4afc('0x3a')]['id'];logger[_0x4afc('0xb')](_0x4afc('0x3b'),_0x43bd0f[_0x4afc('0x39')]);_0xe62748(_0x43bd0f);})['catch'](function(_0x658c5b){logger[_0x4afc('0x14')]('['+[_0x260b06['toUpperCase']()]+']',_0x658c5b[_0x4afc('0x15')]);_0x38a1bb(_0x658c5b['message']);});});};}function emit(_0x20a2d3,_0x24a731,_0x16c6c4){var _0x5e0ebd={'uri':_0x20a2d3+_0x4afc('0x3c')+_0x16c6c4};io['to'](util[_0x4afc('0x25')](_0x4afc('0x3d'),_0x24a731))[_0x4afc('0x3e')](_0x4afc('0x3f'),_0x5e0ebd);}exports['cs']=function(_0x19a0ac,_0x5d9d90,_0x4e470d,_0x4f4e46,_0x32f3b9,_0x1c5661,_0x42e274,_0x269c24){var _0xb5cca9={};var _0x122cbc={'Authorization':_0x4afc('0x40')+_0x1c5661[_0x4afc('0x41')]};_0x1c5661[_0x4afc('0x42')]=intUtil[_0x4afc('0x43')](_0x1c5661['remoteUri']);_0x1c5661[_0x4afc('0x44')]=intUtil['stripTrailingSlash'](_0x1c5661['serverUrl']);var _0x46599a=_0x1c5661['remoteUri'];_0xb5cca9[_0x4afc('0x10')]=_0x1c5661[_0x4afc('0x45')];_0xb5cca9[_0x4afc('0x2f')]=_0x269c24[_0x4afc('0x46')]()==='outbound'?_0x5d9d90[_0x4afc('0x47')]:_0x5d9d90['calleridnum'];_0xb5cca9[_0x4afc('0x48')]=_0x269c24===_0x4afc('0x49')||_0x269c24===_0x4afc('0x4a')?_0x4afc('0x49'):_0x4afc('0x4b');if(_0x4f4e46){_0xb5cca9[_0x4afc('0x1a')]=_0x4f4e46[_0x4afc('0xf')];}var _0x12fa43=util[_0x4afc('0x25')](_0x4afc('0x4c'),_0x1c5661[_0x4afc('0x44')],_0x5d9d90[_0x4afc('0x4d')],md5(_0x5d9d90['uniqueid']));if(_0x32f3b9&&_0x32f3b9[_0x4afc('0x4e')]){logger[_0x4afc('0xb')](_0x4afc('0x4f'),_0x4afc('0x50'));_0x5d9d90[_0x4afc('0x51')]=_0x12fa43;}else if(_0x42e274&&_0x42e274[_0x4afc('0x52')]&&_0x42e274[_0x4afc('0x52')]!==_0x4afc('0x53')){logger[_0x4afc('0xb')](_0x4afc('0x54'),_0x4afc('0x50'));_0x5d9d90[_0x4afc('0x51')]=_0x12fa43;}else{_0x5d9d90[_0x4afc('0x51')]='';}return getAdminId(_0xb5cca9,_0x269c24,_0x122cbc,_0x46599a)['then'](getUser(_0x269c24,_0x122cbc,_0x46599a))[_0x4afc('0x19')](getEndUser(_0x269c24,_0x122cbc,_0x46599a))['then'](getTicket(_0x269c24,_0x122cbc,_0x46599a,_0x4e470d,_0x5d9d90))[_0x4afc('0x19')](function(_0x2abc1b){logger[_0x4afc('0xb')](util[_0x4afc('0x25')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2abc1b['ticketId']));if(_0x269c24!==_0x4afc('0x4a')){logger[_0x4afc('0xb')]('['+[_0x269c24['toUpperCase']()]+']',_0x4afc('0x55'));emit(_0x46599a,_0x4f4e46[_0x4afc('0x56')],_0x2abc1b[_0x4afc('0x28')]);}})[_0x4afc('0x20')](function(_0x329550){logger[_0x4afc('0x14')]('['+[_0x269c24[_0x4afc('0x33')]()]+_0x4afc('0x57'),util[_0x4afc('0x58')](_0x329550,{'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 0b33134..a747c0b 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 _0x7708=['./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','servicenow','exec','data1','toLowerCase','data2','find','Configurations','queue','outbound','EVENT\x20UNKNOWN','zendesk','freshsales','log','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found','data3','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./vtiger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x7708,0x188));var _0x8770=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x7708[_0x2ef44b];return _0x2405b9;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x8770('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x8770('0x3'));var servicenow=require(_0x8770('0x4'));var dynamics365=require('./dynamics365');var freshsales=require(_0x8770('0x5'));var integrations=['zendesk',_0x8770('0x6'),_0x8770('0x7'),_0x8770('0x8'),_0x8770('0x9'),_0x8770('0xa'),_0x8770('0xb'),_0x8770('0xc'),'freshsales',_0x8770('0xd')];exports[_0x8770('0xe')]=function(_0x3f357a,_0x4e4551,_0x390af0,_0x10e4a3,_0x3bbee2,_0x3d81ab){if(_0x390af0){if(_['includes'](integrations,_0x3f357a[_0x8770('0xf')][_0x8770('0x10')]())){try{var _0x2adcbf=null;var _0x51efbc='';var _0xb52d60=_0x390af0[_0x3f357a[_0x8770('0xf')][_0x8770('0x10')]()];if(_0xb52d60){var _0x3ba999=_0xb52d60[_0x3f357a[_0x8770('0x11')]];if(_0x3ba999){var _0x12a06f=_[_0x8770('0x12')](_0x3ba999[_0x8770('0x13')],{'id':parseInt(_0x3f357a['data3'],0xa)});if(_0x12a06f){if(_0x10e4a3){if(_0x3bbee2&&_0x4e4551[_0x8770('0x14')]){_0x51efbc=_0x8770('0x14');}else if(_0x4e4551['routeId']){_0x51efbc=_0x8770('0x15');}else{console['log'](_0x8770('0x16'),_0x4e4551);}}else{_0x51efbc='unmanaged';}switch(_0x3f357a['data1']['toLowerCase']()){case _0x8770('0x17'):zendesk[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0x6'):salesforce[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0x7'):sugarcrm[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0x8'):freshdesk[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case'zoho':zoho[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case'desk':desk[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0xb'):vtiger[_0x51efbc](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab);break;case _0x8770('0x18'):freshsales['cs'](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab,_0x51efbc);break;case _0x8770('0xd'):servicenow['cs'](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab,_0x51efbc);break;case _0x8770('0xc'):dynamics365['cs'](_0x3f357a,_0x4e4551,_0x12a06f,_0x10e4a3,_0x3bbee2,_0x3ba999,_0x3d81ab,_0x51efbc);break;default:console[_0x8770('0x19')]('unknown\x20integration');}}else{_0x2adcbf=require(_0x8770('0x1a'))(_0x3f357a[_0x8770('0xf')][_0x8770('0x10')]());_0x2adcbf[_0x8770('0x1b')]('[EXEC]',util['format'](_0x8770('0x1c'),_0x3f357a[_0x8770('0xf')][_0x8770('0x10')](),_0x3f357a[_0x8770('0x1d')]));}}else{_0x2adcbf=require(_0x8770('0x1a'))(_0x3f357a[_0x8770('0xf')]['toLowerCase']());_0x2adcbf[_0x8770('0x1b')](_0x8770('0x1e'),util[_0x8770('0x1f')](_0x8770('0x20'),_0x3f357a['data1'][_0x8770('0x10')](),_0x3f357a['data2']));}}else{}}catch(_0x7b4755){console[_0x8770('0x1b')](_0x7b4755);}}}}; \ No newline at end of file +var _0xda3f=['outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','sugarcrm','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','data2','util','./zendesk','./zoho','./vtiger','./servicenow','./freshsales','zendesk','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3'];(function(_0x2c8e56,_0x420e61){var _0x3f08f3=function(_0x2b5652){while(--_0x2b5652){_0x2c8e56['push'](_0x2c8e56['shift']());}};_0x3f08f3(++_0x420e61);}(_0xda3f,0xec));var _0xfda3=function(_0x5e8138,_0x1f819f){_0x5e8138=_0x5e8138-0x0;var _0xdac491=_0xda3f[_0x5e8138];return _0xdac491;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var zendesk=require(_0xfda3('0x1'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xfda3('0x2'));var desk=require('./desk');var vtiger=require(_0xfda3('0x3'));var servicenow=require(_0xfda3('0x4'));var dynamics365=require('./dynamics365');var freshsales=require(_0xfda3('0x5'));var integrations=[_0xfda3('0x6'),'salesforce','sugarcrm',_0xfda3('0x7'),_0xfda3('0x8'),_0xfda3('0x9'),_0xfda3('0xa'),_0xfda3('0xb'),_0xfda3('0xc'),_0xfda3('0xd')];exports[_0xfda3('0xe')]=function(_0xdc5b45,_0x14d549,_0x102643,_0x4713ba,_0x4d7841,_0xe933f5){if(_0x102643){if(_[_0xfda3('0xf')](integrations,_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]())){try{var _0x1443f4=null;var _0x4b77ea='';var _0x583125=_0x102643[_0xdc5b45['data1'][_0xfda3('0x11')]()];if(_0x583125){var _0x1e7a55=_0x583125[_0xdc5b45['data2']];if(_0x1e7a55){var _0x501588=_['find'](_0x1e7a55[_0xfda3('0x12')],{'id':parseInt(_0xdc5b45[_0xfda3('0x13')],0xa)});if(_0x501588){if(_0x4713ba){if(_0x4d7841&&_0x14d549['queue']){_0x4b77ea='queue';}else if(_0x14d549['routeId']){_0x4b77ea=_0xfda3('0x14');}else{console[_0xfda3('0x15')](_0xfda3('0x16'),_0x14d549);}}else{_0x4b77ea=_0xfda3('0x17');}switch(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]()){case _0xfda3('0x6'):zendesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x18'):salesforce[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x19'):sugarcrm[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x7'):freshdesk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case'zoho':zoho[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0x9'):desk[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xa'):vtiger[_0x4b77ea](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5);break;case _0xfda3('0xc'):freshsales['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case _0xfda3('0xd'):servicenow['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;case'dynamics365':dynamics365['cs'](_0xdc5b45,_0x14d549,_0x501588,_0x4713ba,_0x4d7841,_0x1e7a55,_0xe933f5,_0x4b77ea);break;default:console[_0xfda3('0x15')](_0xfda3('0x1a'));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45['data1']['toLowerCase']());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x13')]));}}else{_0x1443f4=require(_0xfda3('0x1b'))(_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')]());_0x1443f4[_0xfda3('0x1c')](_0xfda3('0x1d'),util[_0xfda3('0x1e')]('%s\x20account\x20#%s\x20not\x20found',_0xdc5b45[_0xfda3('0x10')][_0xfda3('0x11')](),_0xdc5b45[_0xfda3('0x1f')]));}}else{}}catch(_0x4ae9b9){console[_0xfda3('0x1c')](_0x4ae9b9);}}}}; \ 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 9464bde..aceba09 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 _0x0925=['identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','execute','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','forEach','type','string','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[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',']\x20Ticket\x20%s\x20created.','toUpperCase','stringify','lodash','request-promise','moment','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','emit','Task','assign','getString','Subjects','Descriptions','ticketType','Case','ContactId','sobject','create','validateEmail','User','find','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name'];(function(_0xe9660d,_0x5801c9){var _0x167062=function(_0x35c9d7){while(--_0x35c9d7){_0xe9660d['push'](_0xe9660d['shift']());}};_0x167062(++_0x5801c9);}(_0x0925,0xbb));var _0x5092=function(_0x330584,_0x4f3687){_0x330584=_0x330584-0x0;var _0x42bf51=_0x0925[_0x330584];return _0x42bf51;};'use strict';var _=require(_0x5092('0x0'));var rp=require(_0x5092('0x1'));var moment=require(_0x5092('0x2'));var BPromise=require(_0x5092('0x3'));var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x5092('0x4'));var Redis=require(_0x5092('0x5'));var intUtil=require(_0x5092('0x6'));var config=require(_0x5092('0x7'));var logger=require(_0x5092('0x8'))(_0x5092('0x9'));config[_0x5092('0xa')]=_['defaults'](config[_0x5092('0xa')],{'host':_0x5092('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5092('0xa')]));function emit(_0x2e12a1,_0x5e8b05,_0x2d1075){io['to'](_0x2e12a1)[_0x5092('0xc')](_0x5e8b05,_0x2d1075);}function getTicket(_0x417a5d,_0x13dde9,_0x3f4c74,_0x26527c,_0x361ee3,_0x48f6bc,_0xb67ea1,_0x3532f3){var _0x551fb3={};if(_0x26527c['ticketType']===_0x5092('0xd')){_0x551fb3=Object[_0x5092('0xe')]({},{'OwnerId':_0x13dde9['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x5092('0xf')](_0x26527c[_0x5092('0x10')],_0x361ee3,'\x20'),'Description':intUtil[_0x5092('0xf')](_0x26527c[_0x5092('0x11')],_0x361ee3,'\x0a')},getCustomFields(_0x48f6bc,_0x361ee3));if(_0x3f4c74){_0x551fb3['WhoId']=_0x3f4c74['id'];}}else if(_0x26527c[_0x5092('0x12')]===_0x5092('0x13')){_0x551fb3=Object[_0x5092('0xe')]({},{'OwnerId':_0x13dde9['id'],'Subject':intUtil[_0x5092('0xf')](_0x26527c[_0x5092('0x10')],_0x361ee3,'\x20'),'Description':intUtil['getString'](_0x26527c[_0x5092('0x11')],_0x361ee3,'\x0a')},getCustomFields(_0x48f6bc,_0x361ee3));if(_0x3f4c74){_0x551fb3[_0x5092('0x14')]=_0x3f4c74['id'];}}return _0xb67ea1[_0x5092('0x15')](_0x26527c[_0x5092('0x12')])[_0x5092('0x16')](_0x551fb3);}function getUser(_0x3cfd4f,_0x14d6eb,_0x171700){if(!_['isNil'](_0x14d6eb)&&intUtil[_0x5092('0x17')](_0x14d6eb)){var _0x2dfb53={'Email':_0x14d6eb};var _0x1b3878={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x171700['sobject'](_0x5092('0x18'))[_0x5092('0x19')](_0x2dfb53,_0x1b3878)['execute']()[_0x5092('0x1a')](function(_0x488326){if(_0x488326[_0x5092('0x1b')]){var _0x45a0d=_[_0x5092('0x19')](_0x488326,function(_0x43ff5f){return _0x43ff5f[_0x5092('0x1c')]===_0x14d6eb;});if(_0x45a0d){logger[_0x5092('0x1d')](_0x5092('0x1e'),_0x14d6eb);return BPromise[_0x5092('0x1f')]({'id':_0x45a0d['Id'],'name':_0x45a0d[_0x5092('0x20')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x14d6eb);return _0x171700[_0x5092('0x21')]()[_0x5092('0x1a')](function(_0xd3c27a){return BPromise[_0x5092('0x1f')]({'id':_0xd3c27a[_0x5092('0x22')],'name':_0xd3c27a[_0x5092('0x23')]});});}});}else{logger[_0x5092('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x14d6eb);return _0x171700['identity']()[_0x5092('0x1a')](function(_0x5c4d8d){return BPromise[_0x5092('0x1f')]({'id':_0x5c4d8d[_0x5092('0x22')],'name':_0x5c4d8d[_0x5092('0x23')]});});}}function getEndUser(_0x4c3fc7,_0x2b7647,_0x530d08,_0x264fc5,_0x5cdc7a){var _0x3f21b7={'Phone':_0x264fc5};var _0x39bf0b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x5092('0x1a')](function(){if(_0x2b7647[_0x5092('0x12')]===_0x5092('0xd')){logger[_0x5092('0x1d')](_0x5092('0x24'),_0x264fc5,_0x2b7647[_0x5092('0x25')]);switch(_0x2b7647[_0x5092('0x25')]){case _0x5092('0x26'):return _0x5cdc7a[_0x5092('0x15')](_0x5092('0x27'))[_0x5092('0x19')](_0x3f21b7,_0x39bf0b)[_0x5092('0x28')]()[_0x5092('0x1a')](function(_0x18c478){if(_0x18c478&&_0x18c478[_0x5092('0x1b')]){return _0x18c478;}else{return _0x5cdc7a[_0x5092('0x15')](_0x5092('0x29'))[_0x5092('0x19')](_0x3f21b7,_0x39bf0b);}});case _0x5092('0x2a'):return _0x5cdc7a[_0x5092('0x15')](_0x5092('0x27'))[_0x5092('0x19')](_0x3f21b7,_0x39bf0b)[_0x5092('0x28')]();case _0x5092('0x2b'):return _0x5cdc7a[_0x5092('0x15')](_0x5092('0x29'))[_0x5092('0x19')](_0x3f21b7,_0x39bf0b);default:return null;}}else if(_0x2b7647[_0x5092('0x12')]===_0x5092('0x13')){logger[_0x5092('0x1d')](_0x5092('0x24'),_0x264fc5,_0x5092('0x2a'));return _0x5cdc7a[_0x5092('0x15')](_0x5092('0x27'))['find'](_0x3f21b7,_0x39bf0b)['execute']();}})[_0x5092('0x1a')](function(_0x402da1){if(_0x402da1&&_0x402da1[_0x5092('0x1b')]){var _0x419f97=_[_0x5092('0x19')](_0x402da1,function(_0x449f77){return _0x449f77[_0x5092('0x2c')]===_0x264fc5;});if(_0x419f97){return BPromise['resolve']({'id':_0x419f97['Id'],'name':_0x419f97['Name'],'phone':_0x419f97[_0x5092('0x2c')]});}}})['then'](function(_0x151cc2){if(_0x151cc2){logger[_0x5092('0x1d')](_0x5092('0x2d'),_0x264fc5);return BPromise['resolve'](_0x151cc2);}else{logger[_0x5092('0x1d')](_0x5092('0x2e'),_0x264fc5);var _0x2fda17={'LastName':_0x530d08!==_0x5092('0x2f')?_0x530d08:util[_0x5092('0x30')](_0x5092('0x31'),_0x264fc5),'Phone':_0x264fc5};if(_0x2b7647[_0x5092('0x32')]){if(_0x2b7647['moduleCreate']===_0x5092('0x2a')){logger[_0x5092('0x1d')](_0x5092('0x33'),_0x264fc5,_0x2b7647[_0x5092('0x32')]);}else if(_0x2b7647[_0x5092('0x32')]===_0x5092('0x2b')&&_0x2b7647[_0x5092('0x12')]===_0x5092('0xd')){logger[_0x5092('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x264fc5,_0x2b7647[_0x5092('0x32')]);_0x2fda17[_0x5092('0x34')]=_0x5092('0x35');}else{return null;}}return _0x5cdc7a[_0x5092('0x15')](_['upperFirst'](_0x2b7647['moduleCreate']))[_0x5092('0x16')](_0x2fda17);}});}function getCustomFields(_0x52fc27,_0x2e7ef9){var _0x4e91ee={};if(_0x52fc27[_0x5092('0x1b')]>0x0){_[_0x5092('0x36')](_0x52fc27,function(_0xaecb8){if(_0xaecb8[_0x5092('0x37')]===_0x5092('0x38')&&_0xaecb8[_0x5092('0x39')]){_0x4e91ee[_0xaecb8[_0x5092('0x39')]]=_0xaecb8['content']['toString']();}else if(_0xaecb8[_0x5092('0x37')]===_0x5092('0x3a')&&_0xaecb8[_0x5092('0x3b')]&&_0xaecb8[_0x5092('0x39')]){_0x2e7ef9[_0xaecb8['variableName']]&&(_0x4e91ee[_0xaecb8[_0x5092('0x39')]]=_0x2e7ef9[_0xaecb8[_0x5092('0x3b')]][_0x5092('0x3c')]());}else if(_0xaecb8[_0x5092('0x37')]===_0x5092('0x3d')&&_0xaecb8[_0x5092('0x3e')]&&_0xaecb8[_0x5092('0x3e')][_0x5092('0x3f')]&&_0xaecb8[_0x5092('0x39')]){_0x2e7ef9[_0xaecb8[_0x5092('0x3e')][_0x5092('0x3f')][_0x5092('0x40')]()]&&(_0x4e91ee[_0xaecb8[_0x5092('0x39')]]=_0x2e7ef9[_0xaecb8['Variable']['name'][_0x5092('0x40')]()][_0x5092('0x3c')]());}});}return _0x4e91ee;}function getConnection(_0x5e5377){var _0x43b41e=_0x5e5377[_0x5092('0x41')]['concat'](_0x5e5377['securityToken']);var _0x4a0bf8=new jsforce[(_0x5092('0x42'))]({'oauth2':{'loginUrl':_0x5e5377[_0x5092('0x43')]||_0x5092('0x44'),'clientId':_0x5e5377[_0x5092('0x45')],'clientSecret':_0x5e5377[_0x5092('0x46')]}});return _0x4a0bf8['login'](_0x5e5377[_0x5092('0x47')],_0x43b41e)[_0x5092('0x1a')](function(){logger[_0x5092('0x1d')]('Connection\x20established.');return _0x4a0bf8;});}exports[_0x5092('0x48')]=function(_0x28fc84,_0x346495,_0x1a4e49,_0x357d8f,_0x1ba8de,_0x16e463){var _0x904518,_0x273a68,_0x5982f7,_0x284372;_0x16e463[_0x5092('0x49')]=intUtil[_0x5092('0x4a')](_0x16e463[_0x5092('0x49')]);_0x16e463[_0x5092('0x43')]=intUtil[_0x5092('0x4a')](_0x16e463['remoteUri']);if(_0x1ba8de&&_0x1ba8de[_0x5092('0x4b')]){logger['info'](_0x5092('0x4c'),_0x5092('0x4d'));_0x346495[_0x5092('0x4e')]=util['format'](_0x5092('0x4f'),_0x16e463[_0x5092('0x49')],_0x346495[_0x5092('0x50')],md5(_0x346495[_0x5092('0x50')]));}else{_0x346495[_0x5092('0x4e')]='';}return getConnection(_0x16e463)[_0x5092('0x1a')](function(_0x4df38f){_0x284372=_0x4df38f;return getUser(_0x16e463,_0x357d8f['email'],_0x284372);})[_0x5092('0x1a')](function(_0x163bd1){_0x904518=_0x163bd1;return getEndUser(_0x16e463,_0x1a4e49,_0x346495[_0x5092('0x51')],_0x346495[_0x5092('0x52')],_0x284372);})[_0x5092('0x1a')](function(_0x4e3f23){_0x273a68=_0x4e3f23;return getTicket(_0x16e463,_0x904518,_0x273a68,_0x1a4e49,_0x346495,_0x1a4e49[_0x5092('0x53')],_0x284372,_0x5092('0x48'));})['then'](function(_0x104e71){_0x5982f7=_0x104e71;logger['info'](_0x5092('0x54'),_0x5982f7['id']);logger[_0x5092('0x1d')](_0x5092('0x55'),_0x5982f7['id'],_0x357d8f[_0x5092('0x3f')],_0x16e463[_0x5092('0x37')]);switch(_0x16e463[_0x5092('0x37')]){case _0x5092('0x56'):emit(util['format']('user:%s',_0x357d8f[_0x5092('0x3f')]),_0x5092('0x57'),{'recordId':_0x5982f7['id']});break;case _0x5092('0x58'):emit(util[_0x5092('0x30')](_0x5092('0x59'),_0x357d8f[_0x5092('0x3f')]),_0x5092('0x5a'),{'uri':util['format'](_0x5092('0x5b'),_0x284372[_0x5092('0x5c')],_0x5982f7['id'])});break;default:logger[_0x5092('0x5d')](_0x5092('0x5e'));}})[_0x5092('0x5f')](function(_0x45d816){logger[_0x5092('0x5d')](_0x5092('0x4c'),JSON['stringify'](_0x45d816));});};exports[_0x5092('0x60')]=function(_0x298164,_0x2dcd83,_0x3bcad8,_0x3e4d0f,_0x26f662,_0x8c30dd,_0x29c012){var _0x5688cc,_0xdc07ca,_0xe27bb2,_0x45f8e5;_0x8c30dd['serverUrl']=intUtil[_0x5092('0x4a')](_0x8c30dd[_0x5092('0x49')]);_0x8c30dd[_0x5092('0x43')]=intUtil[_0x5092('0x4a')](_0x8c30dd[_0x5092('0x43')]);if(_0x29c012&&_0x29c012['recordingFormat']&&_0x29c012[_0x5092('0x61')]!==_0x5092('0x62')){logger['info'](_0x5092('0x63'),'Recording\x20is\x20enabled!');_0x2dcd83[_0x5092('0x4e')]=util[_0x5092('0x30')](_0x5092('0x4f'),_0x8c30dd[_0x5092('0x49')],_0x2dcd83[_0x5092('0x50')],md5(_0x2dcd83['uniqueid']));}return getConnection(_0x8c30dd)[_0x5092('0x1a')](function(_0x41bd46){_0x45f8e5=_0x41bd46;return getUser(_0x8c30dd,_0x3e4d0f['email'],_0x45f8e5);})[_0x5092('0x1a')](function(_0x1050a1){_0x5688cc=_0x1050a1;return getEndUser(_0x8c30dd,_0x3bcad8,_0x2dcd83[_0x5092('0x64')],_0x2dcd83[_0x5092('0x65')],_0x45f8e5);})[_0x5092('0x1a')](function(_0x5a9e63){_0xdc07ca=_0x5a9e63;return getTicket(_0x8c30dd,_0x5688cc,_0xdc07ca,_0x3bcad8,_0x2dcd83,_0x3bcad8['Fields'],_0x45f8e5,_0x5092('0x60'));})['then'](function(_0x2c396e){_0xe27bb2=_0x2c396e;logger[_0x5092('0x1d')](_0x5092('0x66'),_0xe27bb2['id']);logger[_0x5092('0x1d')](_0x5092('0x67'),_0xe27bb2['id'],_0x3e4d0f[_0x5092('0x3f')],_0x8c30dd[_0x5092('0x37')]);switch(_0x8c30dd[_0x5092('0x37')]){case _0x5092('0x56'):emit(util[_0x5092('0x30')](_0x5092('0x59'),_0x3e4d0f['name']),'trigger:salesforce:display',{'recordId':_0xe27bb2['id']});break;case _0x5092('0x58'):emit(util['format'](_0x5092('0x59'),_0x3e4d0f['name']),_0x5092('0x5a'),{'uri':util[_0x5092('0x30')]('%s/%s/e',_0x45f8e5[_0x5092('0x5c')],_0xe27bb2['id'])});break;default:logger[_0x5092('0x5d')]('[OUTBOUND]',_0x5092('0x68'));}})['catch'](function(_0x1d3531){logger[_0x5092('0x5d')](_0x5092('0x63'),JSON['stringify'](_0x1d3531));});};exports[_0x5092('0x69')]=function(_0x179ecf,_0xaa78bf,_0x5be467,_0x4bfa8b,_0x127aef,_0x3c1e71){var _0x2b70eb,_0xc743d7,_0x36fb9b,_0x517c23;_0x3c1e71[_0x5092('0x49')]=intUtil[_0x5092('0x4a')](_0x3c1e71[_0x5092('0x49')]);_0x3c1e71[_0x5092('0x43')]=intUtil[_0x5092('0x4a')](_0x3c1e71[_0x5092('0x43')]);if(_0x127aef&&_0x127aef[_0x5092('0x4b')]){logger[_0x5092('0x1d')]('['+_0xaa78bf['lastevent']['toUpperCase']()+']',_0x5092('0x4d'));_0xaa78bf['recordingURL']=util[_0x5092('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c1e71[_0x5092('0x49')],_0xaa78bf[_0x5092('0x50')],md5(_0xaa78bf[_0x5092('0x50')]));}else{_0xaa78bf[_0x5092('0x4e')]='';}return getConnection(_0x3c1e71)['then'](function(_0x4ea451){_0x517c23=_0x4ea451;if(!_['isNil'](_0x4bfa8b)){return getUser(_0x3c1e71,_0x4bfa8b[_0x5092('0x3f')],_0x517c23);}else{return getUser(_0x3c1e71,null,_0x517c23);}})[_0x5092('0x1a')](function(_0x4f4234){_0x2b70eb=_0x4f4234;return getEndUser(_0x3c1e71,_0x5be467,_0xaa78bf[_0x5092('0x51')],_0xaa78bf[_0x5092('0x52')],_0x517c23);})[_0x5092('0x1a')](function(_0x33e4cb){_0xc743d7=_0x33e4cb;return getTicket(_0x3c1e71,_0x2b70eb,_0xc743d7,_0x5be467,_0xaa78bf,_0x5be467['Fields'],_0x517c23);})['then'](function(_0x1bd70e){_0x36fb9b=_0x1bd70e;logger[_0x5092('0x1d')]('['+_0xaa78bf[_0x5092('0x6a')]['toUpperCase']()+_0x5092('0x6b'),_0x36fb9b['id']);logger[_0x5092('0x1d')]('['+_0xaa78bf['lastevent'][_0x5092('0x6c')]()+']\x20Integration\x20account\x20type\x20%s.',_0x3c1e71[_0x5092('0x37')]);})[_0x5092('0x5f')](function(_0x3f2c73){logger['error']('['+_0xaa78bf['lastevent'][_0x5092('0x6c')]()+']',JSON[_0x5092('0x6d')](_0x3f2c73));});}; \ No newline at end of file +var _0xf3c0=['password','concat','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','isNil','lodash','request-promise','bluebird','md5','jsforce','ioredis','../../../../config/logger','localhost','socket.io-emitter','redis','ticketType','Task','utc','getString','Subjects','Descriptions','WhoId','Case','sobject','create','User','find','execute','then','Email','info','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','resolve','user_id','display_name','moduleSearch','Contact','length','contact','lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Name','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase'];(function(_0x32dca3,_0x4c3191){var _0x5b9883=function(_0x240859){while(--_0x240859){_0x32dca3['push'](_0x32dca3['shift']());}};_0x5b9883(++_0x4c3191);}(_0xf3c0,0x99));var _0x0f3c=function(_0x4b3b2e,_0xe793ed){_0x4b3b2e=_0x4b3b2e-0x0;var _0x57b7cc=_0xf3c0[_0x4b3b2e];return _0x57b7cc;};'use strict';var _=require(_0x0f3c('0x0'));var rp=require(_0x0f3c('0x1'));var moment=require('moment');var BPromise=require(_0x0f3c('0x2'));var md5=require(_0x0f3c('0x3'));var jsforce=require(_0x0f3c('0x4'));var util=require('util');var Redis=require(_0x0f3c('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x0f3c('0x6'))('salesforce');config['redis']=_['defaults'](config['redis'],{'host':_0x0f3c('0x7'),'port':0x18eb});var io=require(_0x0f3c('0x8'))(new Redis(config[_0x0f3c('0x9')]));function emit(_0x5a4d58,_0x49dead,_0x299e53){io['to'](_0x5a4d58)['emit'](_0x49dead,_0x299e53);}function getTicket(_0x4b8089,_0xa06abd,_0x5952da,_0x43da0b,_0x466609,_0x20736d,_0x31c255,_0x3cf9d1){var _0x190e96={};if(_0x43da0b[_0x0f3c('0xa')]===_0x0f3c('0xb')){_0x190e96=Object['assign']({},{'OwnerId':_0xa06abd['id'],'ActivityDate':moment[_0x0f3c('0xc')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x0f3c('0xd')](_0x43da0b[_0x0f3c('0xe')],_0x466609,'\x20'),'Description':intUtil[_0x0f3c('0xd')](_0x43da0b[_0x0f3c('0xf')],_0x466609,'\x0a')},getCustomFields(_0x20736d,_0x466609));if(_0x5952da){_0x190e96[_0x0f3c('0x10')]=_0x5952da['id'];}}else if(_0x43da0b['ticketType']===_0x0f3c('0x11')){_0x190e96=Object['assign']({},{'OwnerId':_0xa06abd['id'],'Subject':intUtil[_0x0f3c('0xd')](_0x43da0b['Subjects'],_0x466609,'\x20'),'Description':intUtil['getString'](_0x43da0b[_0x0f3c('0xf')],_0x466609,'\x0a')},getCustomFields(_0x20736d,_0x466609));if(_0x5952da){_0x190e96['ContactId']=_0x5952da['id'];}}return _0x31c255[_0x0f3c('0x12')](_0x43da0b[_0x0f3c('0xa')])[_0x0f3c('0x13')](_0x190e96);}function getUser(_0x2b037e,_0x5b92b4,_0x2f7d3c){if(!_['isNil'](_0x5b92b4)&&intUtil['validateEmail'](_0x5b92b4)){var _0x57c115={'Email':_0x5b92b4};var _0x43fad4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2f7d3c[_0x0f3c('0x12')](_0x0f3c('0x14'))[_0x0f3c('0x15')](_0x57c115,_0x43fad4)[_0x0f3c('0x16')]()[_0x0f3c('0x17')](function(_0x2bb934){if(_0x2bb934['length']){var _0xb1742b=_[_0x0f3c('0x15')](_0x2bb934,function(_0x27e8c7){return _0x27e8c7[_0x0f3c('0x18')]===_0x5b92b4;});if(_0xb1742b){logger[_0x0f3c('0x19')](_0x0f3c('0x1a'),_0x5b92b4);return BPromise['resolve']({'id':_0xb1742b['Id'],'name':_0xb1742b['Name']});}}else{logger['info'](_0x0f3c('0x1b'),_0x5b92b4);return _0x2f7d3c[_0x0f3c('0x1c')]()[_0x0f3c('0x17')](function(_0xae1f29){return BPromise[_0x0f3c('0x1d')]({'id':_0xae1f29[_0x0f3c('0x1e')],'name':_0xae1f29[_0x0f3c('0x1f')]});});}});}else{logger['info'](_0x0f3c('0x1b'),_0x5b92b4);return _0x2f7d3c[_0x0f3c('0x1c')]()['then'](function(_0x210728){return BPromise[_0x0f3c('0x1d')]({'id':_0x210728[_0x0f3c('0x1e')],'name':_0x210728['display_name']});});}}function getEndUser(_0x423fc8,_0x53d763,_0x51b307,_0x4d7802,_0x5a01df){var _0x2f078f={'Phone':_0x4d7802};var _0x478dae={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x0f3c('0x17')](function(){if(_0x53d763[_0x0f3c('0xa')]==='Task'){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x4d7802,_0x53d763[_0x0f3c('0x20')]);switch(_0x53d763[_0x0f3c('0x20')]){case'contact_lead':return _0x5a01df[_0x0f3c('0x12')](_0x0f3c('0x21'))[_0x0f3c('0x15')](_0x2f078f,_0x478dae)['execute']()[_0x0f3c('0x17')](function(_0x27380d){if(_0x27380d&&_0x27380d[_0x0f3c('0x22')]){return _0x27380d;}else{return _0x5a01df[_0x0f3c('0x12')]('Lead')[_0x0f3c('0x15')](_0x2f078f,_0x478dae);}});case _0x0f3c('0x23'):return _0x5a01df[_0x0f3c('0x12')](_0x0f3c('0x21'))[_0x0f3c('0x15')](_0x2f078f,_0x478dae)[_0x0f3c('0x16')]();case _0x0f3c('0x24'):return _0x5a01df[_0x0f3c('0x12')]('Lead')[_0x0f3c('0x15')](_0x2f078f,_0x478dae);default:return null;}}else if(_0x53d763[_0x0f3c('0xa')]==='Case'){logger[_0x0f3c('0x19')](_0x0f3c('0x25'),_0x4d7802,_0x0f3c('0x23'));return _0x5a01df['sobject'](_0x0f3c('0x21'))[_0x0f3c('0x15')](_0x2f078f,_0x478dae)[_0x0f3c('0x16')]();}})['then'](function(_0x16f92f){if(_0x16f92f&&_0x16f92f[_0x0f3c('0x22')]){var _0x171556=_[_0x0f3c('0x15')](_0x16f92f,function(_0x40a861){return _0x40a861['Phone']===_0x4d7802;});if(_0x171556){return BPromise[_0x0f3c('0x1d')]({'id':_0x171556['Id'],'name':_0x171556[_0x0f3c('0x26')],'phone':_0x171556[_0x0f3c('0x27')]});}}})[_0x0f3c('0x17')](function(_0x653884){if(_0x653884){logger[_0x0f3c('0x19')](_0x0f3c('0x28'),_0x4d7802);return BPromise[_0x0f3c('0x1d')](_0x653884);}else{logger[_0x0f3c('0x19')](_0x0f3c('0x29'),_0x4d7802);var _0x23dd96={'LastName':_0x51b307!==_0x0f3c('0x2a')?_0x51b307:util[_0x0f3c('0x2b')](_0x0f3c('0x2c'),_0x4d7802),'Phone':_0x4d7802};if(_0x53d763[_0x0f3c('0x2d')]){if(_0x53d763[_0x0f3c('0x2d')]===_0x0f3c('0x23')){logger[_0x0f3c('0x19')](_0x0f3c('0x2e'),_0x4d7802,_0x53d763[_0x0f3c('0x2d')]);}else if(_0x53d763[_0x0f3c('0x2d')]===_0x0f3c('0x24')&&_0x53d763[_0x0f3c('0xa')]===_0x0f3c('0xb')){logger[_0x0f3c('0x19')](_0x0f3c('0x2e'),_0x4d7802,_0x53d763[_0x0f3c('0x2d')]);_0x23dd96['Company']=_0x0f3c('0x2f');}else{return null;}}return _0x5a01df['sobject'](_[_0x0f3c('0x30')](_0x53d763[_0x0f3c('0x2d')]))[_0x0f3c('0x13')](_0x23dd96);}});}function getCustomFields(_0x4cbfa9,_0xf5a312){var _0x1971f8={};if(_0x4cbfa9[_0x0f3c('0x22')]>0x0){_[_0x0f3c('0x31')](_0x4cbfa9,function(_0x1e8d84){if(_0x1e8d84[_0x0f3c('0x32')]==='string'&&_0x1e8d84[_0x0f3c('0x33')]){_0x1971f8[_0x1e8d84['idField']]=_0x1e8d84[_0x0f3c('0x34')][_0x0f3c('0x35')]();}else if(_0x1e8d84[_0x0f3c('0x32')]===_0x0f3c('0x36')&&_0x1e8d84[_0x0f3c('0x37')]&&_0x1e8d84[_0x0f3c('0x33')]){_0xf5a312[_0x1e8d84[_0x0f3c('0x37')]]&&(_0x1971f8[_0x1e8d84['idField']]=_0xf5a312[_0x1e8d84[_0x0f3c('0x37')]][_0x0f3c('0x35')]());}else if(_0x1e8d84[_0x0f3c('0x32')]==='customVariable'&&_0x1e8d84['Variable']&&_0x1e8d84[_0x0f3c('0x38')][_0x0f3c('0x39')]&&_0x1e8d84[_0x0f3c('0x33')]){_0xf5a312[_0x1e8d84[_0x0f3c('0x38')]['name']['toLowerCase']()]&&(_0x1971f8[_0x1e8d84[_0x0f3c('0x33')]]=_0xf5a312[_0x1e8d84[_0x0f3c('0x38')][_0x0f3c('0x39')][_0x0f3c('0x3a')]()][_0x0f3c('0x35')]());}});}return _0x1971f8;}function getConnection(_0x312fcb){var _0x1ae876=_0x312fcb[_0x0f3c('0x3b')][_0x0f3c('0x3c')](_0x312fcb['securityToken']);var _0x31d242=new jsforce['Connection']({'oauth2':{'loginUrl':_0x312fcb[_0x0f3c('0x3d')]||_0x0f3c('0x3e'),'clientId':_0x312fcb[_0x0f3c('0x3f')],'clientSecret':_0x312fcb[_0x0f3c('0x40')]}});return _0x31d242[_0x0f3c('0x41')](_0x312fcb[_0x0f3c('0x42')],_0x1ae876)[_0x0f3c('0x17')](function(){logger[_0x0f3c('0x19')](_0x0f3c('0x43'));return _0x31d242;});}exports[_0x0f3c('0x44')]=function(_0x280e5f,_0x3825c6,_0x295d84,_0x2fc9f2,_0x2ff562,_0x32892a){var _0x5d47a7,_0x4b4a1c,_0x3ce769,_0x6226d3;_0x32892a['serverUrl']=intUtil[_0x0f3c('0x45')](_0x32892a[_0x0f3c('0x46')]);_0x32892a[_0x0f3c('0x3d')]=intUtil['stripTrailingSlash'](_0x32892a[_0x0f3c('0x3d')]);if(_0x2ff562&&_0x2ff562[_0x0f3c('0x47')]){logger[_0x0f3c('0x19')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3825c6[_0x0f3c('0x48')]=util[_0x0f3c('0x2b')](_0x0f3c('0x49'),_0x32892a[_0x0f3c('0x46')],_0x3825c6['uniqueid'],md5(_0x3825c6[_0x0f3c('0x4a')]));}else{_0x3825c6['recordingURL']='';}return getConnection(_0x32892a)['then'](function(_0x86cf55){_0x6226d3=_0x86cf55;return getUser(_0x32892a,_0x2fc9f2[_0x0f3c('0x4b')],_0x6226d3);})[_0x0f3c('0x17')](function(_0x48df57){_0x5d47a7=_0x48df57;return getEndUser(_0x32892a,_0x295d84,_0x3825c6[_0x0f3c('0x4c')],_0x3825c6[_0x0f3c('0x4d')],_0x6226d3);})[_0x0f3c('0x17')](function(_0x188fb4){_0x4b4a1c=_0x188fb4;return getTicket(_0x32892a,_0x5d47a7,_0x4b4a1c,_0x295d84,_0x3825c6,_0x295d84[_0x0f3c('0x4e')],_0x6226d3,_0x0f3c('0x44'));})[_0x0f3c('0x17')](function(_0x1e501c){_0x3ce769=_0x1e501c;logger[_0x0f3c('0x19')](_0x0f3c('0x4f'),_0x3ce769['id']);logger['info'](_0x0f3c('0x50'),_0x3ce769['id'],_0x2fc9f2['name'],_0x32892a[_0x0f3c('0x32')]);switch(_0x32892a[_0x0f3c('0x32')]){case _0x0f3c('0x51'):emit(util[_0x0f3c('0x2b')](_0x0f3c('0x52'),_0x2fc9f2[_0x0f3c('0x39')]),_0x0f3c('0x53'),{'recordId':_0x3ce769['id']});break;case _0x0f3c('0x54'):emit(util[_0x0f3c('0x2b')](_0x0f3c('0x52'),_0x2fc9f2['name']),_0x0f3c('0x55'),{'uri':util[_0x0f3c('0x2b')]('%s/%s/e',_0x6226d3[_0x0f3c('0x56')],_0x3ce769['id'])});break;default:logger[_0x0f3c('0x57')](_0x0f3c('0x58'));}})[_0x0f3c('0x59')](function(_0x585781){logger['error'](_0x0f3c('0x5a'),JSON[_0x0f3c('0x5b')](_0x585781));});};exports[_0x0f3c('0x5c')]=function(_0x202f9c,_0x3f4a0d,_0x2dac53,_0x23a2a7,_0x1b6a95,_0x1e81c9,_0x5f4b4b){var _0x40c8ba,_0x24109a,_0xe798f9,_0x2a8e86;_0x1e81c9['serverUrl']=intUtil[_0x0f3c('0x45')](_0x1e81c9['serverUrl']);_0x1e81c9[_0x0f3c('0x3d')]=intUtil[_0x0f3c('0x45')](_0x1e81c9[_0x0f3c('0x3d')]);if(_0x5f4b4b&&_0x5f4b4b['recordingFormat']&&_0x5f4b4b[_0x0f3c('0x5d')]!==_0x0f3c('0x5e')){logger[_0x0f3c('0x19')](_0x0f3c('0x5f'),_0x0f3c('0x60'));_0x3f4a0d['recordingURL']=util[_0x0f3c('0x2b')](_0x0f3c('0x49'),_0x1e81c9[_0x0f3c('0x46')],_0x3f4a0d[_0x0f3c('0x4a')],md5(_0x3f4a0d[_0x0f3c('0x4a')]));}return getConnection(_0x1e81c9)[_0x0f3c('0x17')](function(_0x25bb5d){_0x2a8e86=_0x25bb5d;return getUser(_0x1e81c9,_0x23a2a7[_0x0f3c('0x4b')],_0x2a8e86);})[_0x0f3c('0x17')](function(_0x33a6fe){_0x40c8ba=_0x33a6fe;return getEndUser(_0x1e81c9,_0x2dac53,_0x3f4a0d[_0x0f3c('0x61')],_0x3f4a0d[_0x0f3c('0x62')],_0x2a8e86);})[_0x0f3c('0x17')](function(_0x364fc7){_0x24109a=_0x364fc7;return getTicket(_0x1e81c9,_0x40c8ba,_0x24109a,_0x2dac53,_0x3f4a0d,_0x2dac53[_0x0f3c('0x4e')],_0x2a8e86,_0x0f3c('0x5c'));})[_0x0f3c('0x17')](function(_0x25d73e){_0xe798f9=_0x25d73e;logger[_0x0f3c('0x19')](_0x0f3c('0x63'),_0xe798f9['id']);logger[_0x0f3c('0x19')](_0x0f3c('0x64'),_0xe798f9['id'],_0x23a2a7[_0x0f3c('0x39')],_0x1e81c9[_0x0f3c('0x32')]);switch(_0x1e81c9[_0x0f3c('0x32')]){case _0x0f3c('0x51'):emit(util['format'](_0x0f3c('0x52'),_0x23a2a7['name']),_0x0f3c('0x53'),{'recordId':_0xe798f9['id']});break;case'newTab':emit(util[_0x0f3c('0x2b')]('user:%s',_0x23a2a7[_0x0f3c('0x39')]),'trigger:browser:url',{'uri':util[_0x0f3c('0x2b')](_0x0f3c('0x65'),_0x2a8e86[_0x0f3c('0x56')],_0xe798f9['id'])});break;default:logger['error'](_0x0f3c('0x5f'),_0x0f3c('0x66'));}})[_0x0f3c('0x59')](function(_0x213471){logger[_0x0f3c('0x57')](_0x0f3c('0x5f'),JSON['stringify'](_0x213471));});};exports['unmanaged']=function(_0x365494,_0x149769,_0x47744b,_0x492cc2,_0x3bb72f,_0x16d7f9){var _0x19f0dd,_0x2c318e,_0x45e753,_0x441f6a;_0x16d7f9[_0x0f3c('0x46')]=intUtil[_0x0f3c('0x45')](_0x16d7f9[_0x0f3c('0x46')]);_0x16d7f9[_0x0f3c('0x3d')]=intUtil[_0x0f3c('0x45')](_0x16d7f9[_0x0f3c('0x3d')]);if(_0x3bb72f&&_0x3bb72f[_0x0f3c('0x47')]){logger[_0x0f3c('0x19')]('['+_0x149769[_0x0f3c('0x67')][_0x0f3c('0x68')]()+']',_0x0f3c('0x60'));_0x149769['recordingURL']=util[_0x0f3c('0x2b')](_0x0f3c('0x49'),_0x16d7f9['serverUrl'],_0x149769[_0x0f3c('0x4a')],md5(_0x149769[_0x0f3c('0x4a')]));}else{_0x149769[_0x0f3c('0x48')]='';}return getConnection(_0x16d7f9)[_0x0f3c('0x17')](function(_0x367460){_0x441f6a=_0x367460;if(!_[_0x0f3c('0x69')](_0x492cc2)){return getUser(_0x16d7f9,_0x492cc2[_0x0f3c('0x39')],_0x441f6a);}else{return getUser(_0x16d7f9,null,_0x441f6a);}})[_0x0f3c('0x17')](function(_0x245914){_0x19f0dd=_0x245914;return getEndUser(_0x16d7f9,_0x47744b,_0x149769[_0x0f3c('0x4c')],_0x149769[_0x0f3c('0x4d')],_0x441f6a);})['then'](function(_0x29524f){_0x2c318e=_0x29524f;return getTicket(_0x16d7f9,_0x19f0dd,_0x2c318e,_0x47744b,_0x149769,_0x47744b[_0x0f3c('0x4e')],_0x441f6a);})[_0x0f3c('0x17')](function(_0x118fda){_0x45e753=_0x118fda;logger[_0x0f3c('0x19')]('['+_0x149769[_0x0f3c('0x67')][_0x0f3c('0x68')]()+']\x20Ticket\x20%s\x20created.',_0x45e753['id']);logger[_0x0f3c('0x19')]('['+_0x149769['lastevent'][_0x0f3c('0x68')]()+']\x20Integration\x20account\x20type\x20%s.',_0x16d7f9[_0x0f3c('0x32')]);})[_0x0f3c('0x59')](function(_0x2c1f26){logger[_0x0f3c('0x57')]('['+_0x149769[_0x0f3c('0x67')][_0x0f3c('0x68')]()+']',JSON[_0x0f3c('0x5b')](_0x2c1f26));});}; \ 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 7fb332d..b6e254b 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 _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x51715b,_0xe852a9){var _0x3ba2e2=function(_0x565694){while(--_0x565694){_0x51715b['push'](_0x51715b['shift']());}};_0x3ba2e2(++_0xe852a9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x44474f,_0x431580){_0x44474f=_0x44474f-0x0;var _0x427d97=_0x5fc3[_0x44474f];return _0x427d97;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5fc3=['],\x20EndUser\x20schema','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','idField','content','toString','string','toLowerCase','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','incident','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','socket.io-emitter','GET','then','length','adminId','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','userEmail','],\x20getUser\x20entity','result','active','true','sys_id','userId','message','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System'];(function(_0x49bb97,_0x4a633b){var _0x13d6aa=function(_0x328639){while(--_0x328639){_0x49bb97['push'](_0x49bb97['shift']());}};_0x13d6aa(++_0x4a633b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1406ae,_0x292395){_0x1406ae=_0x1406ae-0x0;var _0x23a076=_0x5fc3[_0x1406ae];return _0x23a076;};'use strict';var _=require(_0x35fc('0x0'));var Promise=require(_0x35fc('0x1'));var rp=require('request-promise');var util=require(_0x35fc('0x2'));var md5=require(_0x35fc('0x3'));var Redis=require(_0x35fc('0x4'));var intUtil=require(_0x35fc('0x5'));var config=require(_0x35fc('0x6'));var logger=require('../../../../config/logger')(_0x35fc('0x7'));config[_0x35fc('0x8')]=_[_0x35fc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0xa'))(new Redis(config['redis']));function getAdminUser(_0x16e153,_0x27524f,_0xc72d93,_0x1e5f90,_0x34ff19,_0xf9d3a6){return new Promise(function(_0x2051ab,_0x565f95){var _0x1083a9={'method':_0x35fc('0xb'),'uri':_0x1e5f90+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x34ff19+'&'+_0xf9d3a6,'auth':_0x27524f,'json':!![]};return rp(_0x1083a9)[_0x35fc('0xc')](function(_0x33f491){if(_0x33f491['result'][_0x35fc('0xd')]>0x0){_0xc72d93[_0x35fc('0xe')]=_0x33f491['result'][0x0]['sys_id'];}logger[_0x35fc('0xf')]('['+[_0x16e153['toUpperCase']()]+_0x35fc('0x10'),_0xc72d93);_0x2051ab(_0xc72d93);})[_0x35fc('0x11')](function(_0x2a6ad2){logger[_0x35fc('0x12')]('['+[_0x16e153[_0x35fc('0x13')]()]+']',_0x2a6ad2['message']);_0x565f95(_0x2a6ad2['message']);});});}function getUser(_0x5eac0f,_0x558364,_0x398b67,_0x229d56,_0x53b898){return function(_0x154958){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x154958);return new Promise(function(_0x26ba54,_0x45c8b7){if(intUtil['validateEmail'](_0x154958[_0x35fc('0x14')])){var _0x363e47={'method':_0x35fc('0xb'),'uri':_0x398b67+'sys_user?sysparm_query=email%3D'+_0x154958[_0x35fc('0x14')]+'&'+_0x229d56+'&'+_0x53b898,'auth':_0x558364,'json':!![]};logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20rp\x20obj',_0x363e47);return rp(_0x363e47)[_0x35fc('0xc')](function(_0x350a27){logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+_0x35fc('0x15'),_0x350a27);if(_0x350a27[_0x35fc('0x16')][_0x35fc('0xd')]>0x0&&String(_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x17')])===_0x35fc('0x18')){_0x154958['userId']=_0x350a27[_0x35fc('0x16')][0x0][_0x35fc('0x19')];}else{_0x154958[_0x35fc('0x1a')]=_0x154958[_0x35fc('0xe')];_0x154958[_0x35fc('0x14')]=_0x154958['adminEmail'];}logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+'],\x20getUser\x20crm',_0x154958);_0x26ba54(_0x154958);})[_0x35fc('0x11')](function(_0x5a93df){logger[_0x35fc('0x12')]('['+[_0x5eac0f['toUpperCase']()]+']',_0x5a93df[_0x35fc('0x1b')]);_0x45c8b7(_0x5a93df['message']);});}else{logger[_0x35fc('0xf')]('['+[_0x5eac0f[_0x35fc('0x13')]()]+']\x20using\x20admin\x20profile');_0x154958['userId']=_0x154958[_0x35fc('0xe')];_0x154958['userEmail']=_0x154958[_0x35fc('0x1c')];_0x26ba54(_0x154958);}});};}function createEndUser(_0x1a5d92,_0x57001c,_0x26b7cb,_0x645eac,_0x383837){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x1d'),_0x26b7cb);return new Promise(function(_0x11ccdb,_0x451f0c){var _0x54aedc={'method':_0x35fc('0x1e'),'uri':_0x645eac+_0x35fc('0x1f')+_0x383837,'body':{'user_name':_0x26b7cb[_0x35fc('0x20')],'roles':'user','first_name':_0x26b7cb[_0x35fc('0x20')],'active':_0x35fc('0x18'),'date_format':_0x35fc('0x21'),'phone':_0x26b7cb[_0x35fc('0x20')]},'auth':_0x57001c,'json':!![]};return rp(_0x54aedc)[_0x35fc('0xc')](function(_0x103181){logger[_0x35fc('0xf')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+_0x35fc('0x22'),_0x103181[_0x35fc('0x16')]);_0x26b7cb['endUserId']=_0x103181['result'][_0x35fc('0x19')];_0x11ccdb(_0x26b7cb);})['catch'](function(_0x37b394){logger[_0x35fc('0x12')]('['+[_0x1a5d92[_0x35fc('0x13')]()]+']',_0x37b394[_0x35fc('0x1b')]);_0x451f0c(_0x37b394[_0x35fc('0x1b')]);});});}function getEndUser(_0x12e78f,_0x4e43b4,_0x3fe193,_0x330a14,_0x46b9ef){return function(_0x4441d8){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+'],\x20getEndUser\x20input\x20crm',_0x4441d8);return new Promise(function(_0x2483be,_0x38193d){var _0x1fecdf={'method':'GET','uri':_0x3fe193+_0x35fc('0x23')+_0x4441d8['endUserNumber']+'&'+_0x330a14+'&'+_0x46b9ef,'auth':_0x4e43b4,'json':!![]};return rp(_0x1fecdf)[_0x35fc('0xc')](function(_0x33a377){if(_0x33a377[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){_0x4441d8['endUserId']=_0x33a377['result'][0x0]['sys_id'];logger[_0x35fc('0xf')]('['+[_0x12e78f['toUpperCase']()]+_0x35fc('0x24'),_0x4441d8);_0x2483be(_0x4441d8);}else{return createEndUser(_0x12e78f,_0x4e43b4,_0x4441d8,_0x3fe193,_0x330a14)['then'](function(_0x9c6b65){logger[_0x35fc('0xf')]('['+[_0x12e78f[_0x35fc('0x13')]()]+_0x35fc('0x25'),_0x9c6b65);_0x2483be(_0x9c6b65);});}})[_0x35fc('0x11')](function(_0x3313fa){logger[_0x35fc('0x12')]('['+[_0x12e78f['toUpperCase']()]+']',_0x3313fa[_0x35fc('0x1b')]);_0x38193d(_0x3313fa[_0x35fc('0x1b')]);});});};}function getCustomFields(_0x4e0ce3,_0x1feda5){var _0x1ccc41={};if(_0x4e0ce3[_0x35fc('0xd')]>0x0){_[_0x35fc('0x26')](_0x4e0ce3,function(_0x813866){if(_0x813866[_0x35fc('0x27')]==='string'&&_0x813866[_0x35fc('0x28')]&&!_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')]['toLowerCase']()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866['type']===_0x35fc('0x2d')&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866[_0x35fc('0x2a')][_0x35fc('0x2e')]()]=_0x813866[_0x35fc('0x2b')][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='variable'&&_0x813866['variableName']&&_0x813866[_0x35fc('0x2a')]&&_0x813866[_0x35fc('0x29')]){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['variableName']][_0x35fc('0x2c')]();}else if(_0x813866[_0x35fc('0x27')]==='customVariable'&&_0x813866[_0x35fc('0x2f')]&&_0x813866[_0x35fc('0x2f')][_0x35fc('0x30')]&&_0x813866[_0x35fc('0x2a')]&&_0x813866['customField']){_0x1ccc41[_0x813866['idField']['toLowerCase']()]=_0x1feda5[_0x813866['Variable']['name'][_0x35fc('0x2e')]()][_0x35fc('0x2c')]();}});}return _0x1ccc41;}function getTicket(_0x4fc5bc,_0x119925,_0x56cf1f,_0x13d16c,_0x40797d,_0x350237){return function(_0x2de5d1){logger[_0x35fc('0xf')]('['+[_0x4fc5bc['toUpperCase']()]+_0x35fc('0x31'),_0x2de5d1);return new Promise(function(_0x2c25d5,_0x4fd3d8){var _0x18181b=_0x4fc5bc[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2de5d1[_0x35fc('0x1a')]:_0x2de5d1['endUserId'];var _0x3666a5={'method':'POST','uri':_0x56cf1f+'incident'+'?'+_0x350237,'body':Object[_0x35fc('0x33')]({},{'active':_0x35fc('0x18'),'caller_id':_0x18181b,'assigned_to':_0x2de5d1[_0x35fc('0x1a')],'short_description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x35')],_0x40797d,'\x20'),'description':intUtil[_0x35fc('0x34')](_0x13d16c[_0x35fc('0x36')],_0x40797d,'\x0a')},getCustomFields(_0x13d16c[_0x35fc('0x37')],_0x40797d)),'auth':_0x119925,'json':!![]};return rp(_0x3666a5)['then'](function(_0x3e2961){logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x38'),_0x3e2961[_0x35fc('0x16')]);_0x2de5d1[_0x35fc('0x39')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x19')];_0x2de5d1[_0x35fc('0x3a')]=_0x3e2961[_0x35fc('0x16')][_0x35fc('0x3b')];logger[_0x35fc('0xf')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+_0x35fc('0x3c'),_0x2de5d1);_0x2c25d5(_0x2de5d1);})['catch'](function(_0x553ed6){logger[_0x35fc('0x12')]('['+[_0x4fc5bc[_0x35fc('0x13')]()]+']',_0x553ed6[_0x35fc('0x1b')]);_0x4fd3d8(_0x553ed6[_0x35fc('0x1b')]);});});};}function createRemoteTag(_0x3ee296,_0x3e6494,_0x4a4798,_0x4f024c){return new Promise(function(_0x388521,_0x19b2ce){var _0x395d63={'method':_0x35fc('0x1e'),'uri':_0x4a4798+'label'+'?'+_0x4f024c,'body':{'short_description':_0x3ee296,'global':!![],'active':!![],'name':_0x3ee296},'auth':_0x3e6494,'json':!![]};return rp(_0x395d63)[_0x35fc('0xc')](function(_0x13281f){var _0x4965d2=_0x13281f[_0x35fc('0x16')][_0x35fc('0x19')];_0x388521(_0x4965d2);});});}function getRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e,_0x18f18b){return new Promise(function(_0x5e4018,_0x4de34b){var _0x502a15={'method':_0x35fc('0xb'),'uri':_0x1ab472+_0x35fc('0x3d')+'?sysparm_query=name%3D'+_0x590faa+'&'+_0x26118e,'auth':_0x3e12e4,'json':!![]};return rp(_0x502a15)[_0x35fc('0xc')](function(_0x1f89b3){if(_0x1f89b3[_0x35fc('0x16')][_0x35fc('0xd')]>0x0){var _0x46c59b=_0x1f89b3['result'][0x0][_0x35fc('0x19')];_0x5e4018(_0x46c59b);}else{return createRemoteTag(_0x590faa,_0x3e12e4,_0x1ab472,_0x26118e)[_0x35fc('0xc')](function(_0x39d470){_0x5e4018(_0x39d470);});}});});}function assignTagToIncident(_0x509e77,_0x304dba,_0x1dbf5a,_0x47fb1a,_0x35a676){return new Promise(function(_0x164c7b,_0x1c46b1){var _0x1c4c33={'method':_0x35fc('0x1e'),'uri':_0x1dbf5a+_0x35fc('0x3e')+'?'+_0x35a676,'body':{'label':_0x509e77,'table':_0x35fc('0x3f'),'id_type':_0x35fc('0x40'),'table_key':_0x47fb1a['ticketId'],'title':_0x35fc('0x41')+_0x47fb1a[_0x35fc('0x3a')],'id_display':_0x47fb1a[_0x35fc('0x3a')]},'auth':_0x304dba,'json':!![]};return rp(_0x1c4c33)['then'](function(_0x243871){_0x164c7b();})['catch'](function(){_0x164c7b();});});}function manageTags(_0x4ceacc,_0x5d4a39,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c,_0x3d06b8){return new Promise(function(_0x4bbea0,_0x579f5a){var _0x5353ea=[];_0x5d4a39['forEach'](function(_0x51d231){_0x5353ea[_0x35fc('0x42')](getRemoteTag(_0x51d231,_0x23b54f,_0xb1c68a,_0x13901c,_0x3d06b8));});return Promise[_0x35fc('0x43')](_0x5353ea)[_0x35fc('0xc')](function(_0x3ef680){if(_0x3ef680['length']){logger[_0x35fc('0xf')]('['+[_0x4ceacc[_0x35fc('0x13')]()]+_0x35fc('0x44'),_0x3ef680);var _0x1b0063=[];_0x3ef680[_0x35fc('0x26')](function(_0x1d0e53){_0x1b0063[_0x35fc('0x42')](assignTagToIncident(_0x1d0e53,_0x23b54f,_0xb1c68a,_0x39a1ee,_0x13901c));});return Promise[_0x35fc('0x43')](_0x1b0063)[_0x35fc('0xc')](function(){_0x4bbea0();})['catch'](function(){_0x4bbea0();});}else{_0x4bbea0();}});});}function getTags(_0x35d7c8,_0x47c75f,_0xfbd737,_0x9029e3,_0x2ac8e1,_0x2bc76c){return function(_0x4bdde7){return new Promise(function(_0x465c14,_0x4af592){var _0x4e2835=[];var _0x5f1d4a=_0x9029e3[_0x35fc('0x45')];if(_0x5f1d4a&&_0x5f1d4a['length']>0x0){_0x4e2835=_[_0x35fc('0x46')](_0x5f1d4a,'name');}if(_0x4e2835[_0x35fc('0xd')]>0x0){return manageTags(_0x35d7c8,_0x4e2835,_0x47c75f,_0xfbd737,_0x4bdde7,_0x2ac8e1,_0x2bc76c)['then'](function(){_0x465c14(_0x4bdde7);});}else{_0x465c14(_0x4bdde7);}});};}function emit(_0x42a53a,_0x455b84,_0x3400f0){var _0x1d81a5='%26sysparm_record_target%3Dincident'+_0x35fc('0x47')+_0x35fc('0x48')+_0x35fc('0x49');var _0x5df92d={'uri':_0x42a53a+_0x35fc('0x4a')+_0x3400f0+_0x1d81a5};io['to'](util[_0x35fc('0x4b')](_0x35fc('0x4c'),_0x455b84))[_0x35fc('0x4d')](_0x35fc('0x4e'),_0x5df92d);}exports['cs']=function(_0x2c4309,_0x2ee98b,_0x4464d5,_0x5159a0,_0x28a44b,_0x2008b3,_0x2600d2,_0x4a926d){var _0x1c88d8={};var _0x1b76f0={'user':_0x2008b3['username'],'pass':_0x2008b3['password']};var _0x3969d3='sysparm_limit=1';var _0x223ad3=_0x35fc('0x4f');_0x2008b3[_0x35fc('0x50')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x50')]);_0x2008b3[_0x35fc('0x52')]=intUtil[_0x35fc('0x51')](_0x2008b3[_0x35fc('0x52')]);var _0x10b725=util[_0x35fc('0x4b')](_0x35fc('0x53'),_0x2008b3[_0x35fc('0x50')]);_0x1c88d8[_0x35fc('0x14')]=!_[_0x35fc('0x54')](_0x5159a0)?_0x5159a0[_0x35fc('0x55')]:null;_0x1c88d8[_0x35fc('0x1c')]=_0x2008b3[_0x35fc('0x55')];_0x1c88d8[_0x35fc('0x20')]=_0x4a926d[_0x35fc('0x2e')]()===_0x35fc('0x32')?_0x2ee98b['destcalleridnum']:_0x2ee98b[_0x35fc('0x56')];_0x1c88d8['callDirection']=_0x4a926d===_0x35fc('0x57')||_0x4a926d===_0x35fc('0x58')?_0x35fc('0x57'):_0x35fc('0x32');var _0x25af78=util[_0x35fc('0x4b')](_0x35fc('0x59'),_0x2008b3[_0x35fc('0x52')],_0x2ee98b[_0x35fc('0x5a')],md5(_0x2ee98b[_0x35fc('0x5a')]));if(_0x28a44b&&_0x28a44b[_0x35fc('0x5b')]){logger['info'](_0x35fc('0x5c'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else if(_0x2600d2&&_0x2600d2[_0x35fc('0x5f')]&&_0x2600d2[_0x35fc('0x5f')]!==_0x35fc('0x60')){logger['info'](_0x35fc('0x61'),_0x35fc('0x5d'));_0x2ee98b[_0x35fc('0x5e')]=_0x25af78;}else{_0x2ee98b[_0x35fc('0x5e')]='';}return getAdminUser(_0x4a926d,_0x1b76f0,_0x1c88d8,_0x10b725,_0x223ad3,_0x3969d3)[_0x35fc('0xc')](getUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getEndUser(_0x4a926d,_0x1b76f0,_0x10b725,_0x223ad3,_0x3969d3))[_0x35fc('0xc')](getTicket(_0x4a926d,_0x1b76f0,_0x10b725,_0x4464d5,_0x2ee98b,_0x223ad3))[_0x35fc('0xc')](function(_0xa92234){logger['info'](util[_0x35fc('0x4b')]('The\x20ticket\x20ID\x20is:\x20%s',_0xa92234[_0x35fc('0x39')]));logger[_0x35fc('0xf')](util['format'](_0x35fc('0x62'),_0x4a926d));if(_0x4a926d!==_0x35fc('0x58')){logger[_0x35fc('0xf')]('['+[_0x4a926d[_0x35fc('0x13')]()]+']',_0x35fc('0x63'));emit(_0x2008b3[_0x35fc('0x50')],_0x5159a0[_0x35fc('0x30')],_0xa92234[_0x35fc('0x39')]);}})[_0x35fc('0x11')](function(_0x5806bf){logger['error']('['+[_0x4a926d['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x35fc('0x64')](_0x5806bf,{'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 666d2cb..e850974 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 _0x00c2=['base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','stringify','Employees','format','user_name','then','entry_list','find','name_value_list','value','info','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','phone_home','Enduser\x20found!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','customField','nameField','content','variable','custom_fields','customVariable','Variable','toLowerCase','POST','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','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','catch','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','trigger:browser:url','unmanaged','lastevent','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','Creating\x20new\x20ticket...','name','getString','Subjects','created_by','description','Descriptions','date_start','slice','duration_hours','duration_minutes','parent_id','Contacts','length','forEach','variableName','push','idField','set_entry','JSON','Calls','Basic\x20%s','apiKey','toString'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0x00c2,0x146));var _0x200c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00c2[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var rp=require(_0x200c('0x0'));var BPromise=require(_0x200c('0x1'));var md5=require(_0x200c('0x2'));var util=require(_0x200c('0x3'));var Redis=require(_0x200c('0x4'));var intUtil=require(_0x200c('0x5'));var config=require('../../../../config/environment');var logger=require(_0x200c('0x6'))(_0x200c('0x7'));config[_0x200c('0x8')]=_[_0x200c('0x9')](config[_0x200c('0x8')],{'host':_0x200c('0xa'),'port':0x18eb});var io=require(_0x200c('0xb'))(new Redis(config[_0x200c('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x2af741,_0x404775,_0x11c98c){io['to'](_0x2af741)[_0x200c('0xc')](_0x404775,_0x11c98c);}function getTicket(_0x56cb0a,_0x45fef9,_0x3639de,_0x2ffa12,_0x3a3927,_0x58b5a0,_0x4ac72c,_0x5d0e08){logger['info'](_0x200c('0xd'));var _0x5be7ba=new Date();var _0x4fb4b3=[{'name':_0x200c('0xe'),'value':intUtil[_0x200c('0xf')](_0x2ffa12[_0x200c('0x10')],_0x3a3927,'\x20')},{'name':'assigned_user_id','value':_0x45fef9['id']},{'name':_0x200c('0x11'),'value':_0x45fef9['id']},{'name':_0x200c('0x12'),'value':intUtil[_0x200c('0xf')](_0x2ffa12[_0x200c('0x13')],_0x3a3927,'\x0a')},{'name':_0x200c('0x14'),'value':_0x5be7ba['toISOString']()[_0x200c('0x15')](0x0,0x13)['replace']('T','\x20')},{'name':_0x200c('0x16'),'value':'0'},{'name':_0x200c('0x17'),'value':'15'},{'name':_0x200c('0x18'),'value':_0x3639de['id']},{'name':'parent_type','value':_0x200c('0x19')},{'name':'parent_name','value':_0x3639de['name']},{'name':'direction','value':_0x5d0e08}];if(_0x58b5a0[_0x200c('0x1a')]){_[_0x200c('0x1b')](_0x58b5a0,function(_0x45294e){if(_0x3a3927[_0x45294e[_0x200c('0x1c')]]){_0x4fb4b3[_0x200c('0x1d')]({'name':_0x45294e[_0x200c('0x1e')],'value':_0x3a3927[_0x45294e[_0x200c('0x1c')]]});}});}return request({'form':{'method':_0x200c('0x1f'),'input_type':_0x200c('0x20'),'response_type':_0x200c('0x20'),'rest_data':JSON['stringify']({'session':_0x4ac72c['id'],'module_name':_0x200c('0x21'),'name_value_list':_0x4fb4b3})}});}function getAuth(_0x253332){return util['format'](_0x200c('0x22'),new Buffer(_0x253332[_0x200c('0x23')]+':X')[_0x200c('0x24')](_0x200c('0x25')));}function getServerInfo(_0x2324bd){return request({'form':{'method':_0x200c('0x26'),'input_type':_0x200c('0x20'),'response_type':_0x200c('0x20'),'rest_data':JSON['stringify']({'session':_0x2324bd['id']})}});}function getUser(_0x2649a6,_0x439606,_0x1f2b49){if(!_[_0x200c('0x27')](_0x439606)){logger['info'](_0x200c('0x28'),_0x439606);return request({'form':{'method':_0x200c('0x29'),'input_type':_0x200c('0x20'),'response_type':'JSON','rest_data':JSON[_0x200c('0x2a')]({'session':_0x1f2b49['id'],'module_name':_0x200c('0x2b'),'query':util[_0x200c('0x2c')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x439606),'order_by':'','offset':'0','select_fields':['id',_0x200c('0xe'),_0x200c('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x200c('0x2e')](function(_0x508399){if(_0x508399[_0x200c('0x2f')]['length']){var _0x39ac39=_[_0x200c('0x30')](_0x508399[_0x200c('0x2f')],function(_0x10b8b4){return _0x10b8b4[_0x200c('0x31')][_0x200c('0x2d')][_0x200c('0x32')]===_0x439606;});if(_0x39ac39){logger[_0x200c('0x33')](_0x200c('0x34'));return BPromise[_0x200c('0x35')]({'id':_0x39ac39[_0x200c('0x31')]['id'][_0x200c('0x32')],'name':_0x39ac39[_0x200c('0x31')][_0x200c('0xe')][_0x200c('0x32')]});}}logger[_0x200c('0x33')](_0x200c('0x36'));return BPromise['resolve']({'id':_0x1f2b49[_0x200c('0x31')][_0x200c('0x37')][_0x200c('0x32')],'name':_0x1f2b49[_0x200c('0x31')][_0x200c('0x2d')][_0x200c('0x32')]});});}else{logger[_0x200c('0x33')](_0x200c('0x38'));return BPromise['resolve']({'id':_0x1f2b49[_0x200c('0x31')]['user_id'][_0x200c('0x32')],'name':_0x1f2b49[_0x200c('0x31')]['user_name'][_0x200c('0x32')]});}}function getEndUser(_0x45af95,_0x491596,_0x12586c,_0x6644b0){logger[_0x200c('0x33')]('Searching\x20enduser\x20with\x20phone',_0x12586c);return request({'form':{'method':_0x200c('0x29'),'input_type':_0x200c('0x20'),'response_type':'JSON','rest_data':JSON[_0x200c('0x2a')]({'session':_0x6644b0['id'],'module_name':'Contacts','query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x12586c),'order_by':'','offset':'0','select_fields':['id',_0x200c('0xe'),_0x200c('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x200c('0x2e')](function(_0x161463){if(_0x161463[_0x200c('0x2f')][_0x200c('0x1a')]){var _0x5d17e4=_[_0x200c('0x30')](_0x161463[_0x200c('0x2f')],function(_0x20f7b1){return _0x20f7b1[_0x200c('0x31')][_0x200c('0x39')]['value']===_0x12586c;});if(_0x5d17e4){logger[_0x200c('0x33')](_0x200c('0x3a'));return BPromise['resolve']({'id':_0x5d17e4[_0x200c('0x31')]['id'][_0x200c('0x32')],'name':_0x5d17e4[_0x200c('0x31')][_0x200c('0xe')][_0x200c('0x32')],'phone':_0x5d17e4[_0x200c('0x31')]['phone_home'][_0x200c('0x32')]});}}else{logger[_0x200c('0x33')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x200c('0x1f'),'input_type':_0x200c('0x20'),'response_type':_0x200c('0x20'),'rest_data':JSON[_0x200c('0x2a')]({'session':_0x6644b0['id'],'module_name':_0x200c('0x19'),'name_value_list':[{'name':_0x200c('0x3b'),'value':_0x491596!==''?_0x491596:util[_0x200c('0x2c')](_0x200c('0x3c'),_0x12586c)},{'name':_0x200c('0x39'),'value':_0x12586c}]})}})['then'](function(_0x2a4695){logger[_0x200c('0x33')](_0x200c('0x3d'));return BPromise[_0x200c('0x35')]({'id':_0x2a4695['id'],'name':_0x2a4695[_0x200c('0x2f')][_0x200c('0x3b')][_0x200c('0x32')],'phone':_0x2a4695[_0x200c('0x2f')][_0x200c('0x39')]['value']});});}});}function request(_0x5b0efd){logger[_0x200c('0x3e')](_0x200c('0x3f'),JSON[_0x200c('0x2a')](_0x5b0efd));return rp(_['merge'](def,_0x5b0efd));}function getTags(_0x553f9c,_0x351862){var _0xd44e77=[];if(_0x553f9c&&_0x553f9c[_0x200c('0x1a')]>0x0){_0xd44e77=_[_0x200c('0x40')](_0x553f9c,_0x351862);}return _0xd44e77;}function getCustomFields(_0x4bdca9,_0x2b566d){var _0x1152b6=[];var _0x2f8a2f={'custom_fields':[]};if(_0x4bdca9[_0x200c('0x1a')]>0x0){_[_0x200c('0x1b')](_0x4bdca9,function(_0x52b0a2){if(_0x52b0a2[_0x200c('0x41')]===_0x200c('0x42')&&_0x52b0a2['nameField']&&!_0x52b0a2[_0x200c('0x43')]){_0x2f8a2f[_0x52b0a2[_0x200c('0x44')]['toLowerCase']()]=_0x52b0a2[_0x200c('0x45')]['toString']();}else if(_0x52b0a2['type']===_0x200c('0x42')&&_0x52b0a2[_0x200c('0x1e')]&&_0x52b0a2[_0x200c('0x43')]){_0x2f8a2f['custom_fields'][_0x200c('0x1d')]({'id':_0x52b0a2[_0x200c('0x1e')],'value':_0x52b0a2['content'][_0x200c('0x24')]()});}else if(_0x52b0a2[_0x200c('0x41')]===_0x200c('0x46')&&_0x52b0a2[_0x200c('0x1c')]&&_0x52b0a2['idField']&&_0x52b0a2[_0x200c('0x43')]){_0x2b566d[_0x52b0a2['variableName']]&&_0x2f8a2f[_0x200c('0x47')][_0x200c('0x1d')]({'id':_0x52b0a2[_0x200c('0x1e')],'value':_0x2b566d[_0x52b0a2[_0x200c('0x1c')]]['toString']()});}else if(_0x52b0a2[_0x200c('0x41')]===_0x200c('0x48')&&_0x52b0a2[_0x200c('0x49')]&&_0x52b0a2[_0x200c('0x49')][_0x200c('0xe')]&&_0x52b0a2[_0x200c('0x1e')]&&_0x52b0a2[_0x200c('0x43')]){_0x2b566d[_0x52b0a2[_0x200c('0x49')][_0x200c('0xe')][_0x200c('0x4a')]()]&&_0x2f8a2f['custom_fields']['push']({'id':_0x52b0a2[_0x200c('0x1e')],'value':_0x2b566d[_0x52b0a2[_0x200c('0x49')][_0x200c('0xe')][_0x200c('0x4a')]()][_0x200c('0x24')]()});}});}return _0x2f8a2f;}function getConnection(_0x3f7f9a){return request({'method':_0x200c('0x4b'),'form':{'method':'login','input_type':'JSON','response_type':_0x200c('0x20'),'rest_data':JSON[_0x200c('0x2a')]({'user_auth':{'user_name':_0x3f7f9a['username'],'password':_0x3f7f9a[_0x200c('0x4c')],'encryption':'PLAIN'},'application':_0x200c('0x4d')})}})['then'](function(_0x235807){var _0x19c305=_0x235807;if(_0x19c305['id']){def[_0x200c('0x4e')]=_0x19c305['id'];return BPromise[_0x200c('0x35')](_0x19c305);}else{throw new Error(util[_0x200c('0x2c')](_0x200c('0x4f'),_0x3f7f9a['id']));}});}function setRelationship(_0x4bf15a,_0x122754,_0x6ec139,_0x44d740){return request({'form':{'method':_0x200c('0x50'),'input_type':_0x200c('0x20'),'response_type':_0x200c('0x20'),'rest_data':JSON[_0x200c('0x2a')]({'session':_0x4bf15a['id'],'module_name':'Calls','module_id':_0x6ec139['id'],'link_field_name':_0x44d740,'related_ids':[_0x122754['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x200c('0x51')]=function(_0x3e4ee6,_0x88a571,_0x5aa282,_0xecdc95,_0x5eef9f,_0x5ecf92){var _0xfdc9f1,_0x4bf1a5,_0x25b594,_0x2cd1a1;_0x5ecf92[_0x200c('0x52')]=intUtil[_0x200c('0x53')](_0x5ecf92[_0x200c('0x52')]);_0x5ecf92['serverUrl']=intUtil[_0x200c('0x53')](_0x5ecf92[_0x200c('0x54')]);def[_0x200c('0x55')]=util['format'](_0x200c('0x56'),_0x5ecf92[_0x200c('0x52')]);if(_0x5eef9f&&_0x5eef9f[_0x200c('0x57')]){logger[_0x200c('0x33')]('[QUEUE]',_0x200c('0x58'));_0x88a571['recordingURL']=util[_0x200c('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ecf92[_0x200c('0x54')],_0x88a571[_0x200c('0x59')],md5(_0x88a571[_0x200c('0x59')]));}else{_0x88a571['recordingURL']='';}return getConnection(_0x5ecf92)[_0x200c('0x2e')](function(_0x317267){_0x2cd1a1=_0x317267;return getUser(_0x5ecf92,_0xecdc95[_0x200c('0xe')],_0x2cd1a1);})[_0x200c('0x2e')](function(_0x4537da){_0xfdc9f1=_0x4537da;logger[_0x200c('0x33')]('The\x20User\x20ID\x20is:',_0xfdc9f1['id']);return getEndUser(_0x5ecf92,_0x88a571[_0x200c('0x5a')],_0x88a571[_0x200c('0x5b')],_0x2cd1a1);})['then'](function(_0x4d3318){_0x4bf1a5=_0x4d3318;logger[_0x200c('0x33')](_0x200c('0x5c'),_0x4bf1a5['id']);return getTicket(_0x5ecf92,_0xfdc9f1,_0x4bf1a5,_0x5aa282,_0x88a571,_0x5aa282[_0x200c('0x5d')],_0x2cd1a1,_0x200c('0x5e'));})[_0x200c('0x2e')](function(_0x5492ae){_0x25b594=_0x5492ae;logger['info'](_0x200c('0x5f'));logger[_0x200c('0x33')](_0x200c('0x60'),_0x25b594['id']);return setRelationship(_0x2cd1a1,_0xfdc9f1,_0x25b594,_0x200c('0x61'));})['then'](function(){return setRelationship(_0x2cd1a1,_0x4bf1a5,_0x25b594,_0x200c('0x62'));})[_0x200c('0x2e')](function(){return getServerInfo(_0x2cd1a1);})[_0x200c('0x2e')](function(_0xcfdffe){var _0x550fe5=parseInt(_0xcfdffe[_0x200c('0x63')][_0x200c('0x64')](0x0));var _0xa9adfc=util[_0x200c('0x2c')](_0x200c('0x65'),_0x5ecf92[_0x200c('0x52')],_0x25b594['id']);if(_0x550fe5>0x6){_0xa9adfc=util[_0x200c('0x2c')](_0x200c('0x66'),_0x5ecf92[_0x200c('0x52')],_0x25b594['id']);}logger[_0x200c('0x33')](_0x200c('0x67'),_0x200c('0x68'));emit(util[_0x200c('0x2c')](_0x200c('0x69'),_0xecdc95[_0x200c('0xe')]),'trigger:browser:url',{'uri':_0xa9adfc});})[_0x200c('0x6a')](function(_0x3b8d17){logger[_0x200c('0x6b')](_0x200c('0x67'),JSON['stringify'](_0x3b8d17));});};exports[_0x200c('0x6c')]=function(_0x308058,_0x313184,_0x4138a5,_0x2b962a,_0x386ef8,_0x40f0d6,_0x1fb197){var _0x274e9a,_0x4b61ca,_0x576f69,_0x5271bd;_0x40f0d6['remoteUri']=intUtil[_0x200c('0x53')](_0x40f0d6[_0x200c('0x52')]);_0x40f0d6[_0x200c('0x54')]=intUtil['stripTrailingSlash'](_0x40f0d6['serverUrl']);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x40f0d6[_0x200c('0x52')]);if(_0x1fb197&&_0x1fb197['recordingFormat']&&_0x1fb197[_0x200c('0x6d')]!==_0x200c('0x6e')){logger['info'](_0x200c('0x6f'),_0x200c('0x58'));_0x313184[_0x200c('0x70')]=util['format'](_0x200c('0x71'),_0x40f0d6[_0x200c('0x54')],_0x313184[_0x200c('0x59')],md5(_0x313184[_0x200c('0x59')]));}return getConnection(_0x40f0d6)['then'](function(_0x334107){_0x5271bd=_0x334107;return getUser(_0x40f0d6,_0x2b962a[_0x200c('0xe')],_0x5271bd);})['then'](function(_0x41689a){_0x274e9a=_0x41689a;logger[_0x200c('0x33')](_0x200c('0x72'),_0x274e9a['id']);return getEndUser(_0x40f0d6,_0x313184[_0x200c('0x73')],_0x313184[_0x200c('0x74')],_0x5271bd);})['then'](function(_0x242db3){_0x4b61ca=_0x242db3;logger[_0x200c('0x33')](_0x200c('0x5c'),_0x4b61ca['id']);return getTicket(_0x40f0d6,_0x274e9a,_0x4b61ca,_0x4138a5,_0x313184,_0x4138a5[_0x200c('0x5d')],_0x5271bd,'Outbound');})[_0x200c('0x2e')](function(_0x2fbea1){_0x576f69=_0x2fbea1;logger[_0x200c('0x33')](_0x200c('0x5f'));logger[_0x200c('0x33')]('The\x20Ticket\x20ID\x20is:',_0x576f69['id']);return setRelationship(_0x5271bd,_0x274e9a,_0x576f69,_0x200c('0x61'));})['then'](function(){return setRelationship(_0x5271bd,_0x4b61ca,_0x576f69,'contacts');})['then'](function(){return getServerInfo(_0x5271bd);})[_0x200c('0x2e')](function(_0x135742){var _0x495d2b=parseInt(_0x135742[_0x200c('0x63')][_0x200c('0x64')](0x0));var _0x4678be=util[_0x200c('0x2c')](_0x200c('0x65'),_0x40f0d6[_0x200c('0x52')],_0x576f69['id']);if(_0x495d2b>0x6){_0x4678be=util[_0x200c('0x2c')](_0x200c('0x66'),_0x40f0d6[_0x200c('0x52')],_0x576f69['id']);}logger['info'](_0x200c('0x6f'),_0x200c('0x68'));emit(util[_0x200c('0x2c')](_0x200c('0x69'),_0x2b962a[_0x200c('0xe')]),_0x200c('0x75'),{'uri':_0x4678be});})['catch'](function(_0x317984){logger[_0x200c('0x6b')](_0x200c('0x6f'),JSON[_0x200c('0x2a')](_0x317984));});};exports[_0x200c('0x76')]=function(_0x2c1615,_0x20dad6,_0x2367c3,_0x5cafdb,_0x436668,_0x5d93b3){var _0x129af8,_0x30c177,_0x45a0e8,_0x3efc44;_0x5d93b3[_0x200c('0x52')]=intUtil[_0x200c('0x53')](_0x5d93b3[_0x200c('0x52')]);_0x5d93b3['serverUrl']=intUtil[_0x200c('0x53')](_0x5d93b3[_0x200c('0x54')]);def[_0x200c('0x55')]=util[_0x200c('0x2c')](_0x200c('0x56'),_0x5d93b3[_0x200c('0x52')]);if(_0x436668&&_0x436668['monitor_format']){logger[_0x200c('0x33')]('['+_0x20dad6[_0x200c('0x77')][_0x200c('0x78')]()+']',_0x200c('0x58'));_0x20dad6['recordingURL']=util[_0x200c('0x2c')](_0x200c('0x71'),_0x5d93b3[_0x200c('0x54')],_0x20dad6[_0x200c('0x59')],md5(_0x20dad6[_0x200c('0x59')]));}else{_0x20dad6['recordingURL']='';}return getConnection(_0x5d93b3)['then'](function(_0x4f52f2){_0x3efc44=_0x4f52f2;if(!_[_0x200c('0x27')](_0x5cafdb)){return getUser(_0x5d93b3,_0x5cafdb[_0x200c('0xe')],_0x3efc44);}else{return getUser(_0x5d93b3,null,_0x3efc44);}})[_0x200c('0x2e')](function(_0x131a0d){_0x129af8=_0x131a0d;logger[_0x200c('0x33')]('The\x20User\x20ID\x20is:',_0x129af8['id']);return getEndUser(_0x5d93b3,_0x20dad6[_0x200c('0x5a')],_0x20dad6[_0x200c('0x5b')],_0x3efc44);})[_0x200c('0x2e')](function(_0x3b389a){_0x30c177=_0x3b389a;logger[_0x200c('0x33')](_0x200c('0x5c'),_0x30c177['id']);return getTicket(_0x5d93b3,_0x129af8,_0x30c177,_0x2367c3,_0x20dad6,_0x2367c3[_0x200c('0x5d')],_0x3efc44,'Inbound');})[_0x200c('0x2e')](function(_0x504de2){_0x45a0e8=_0x504de2;logger[_0x200c('0x33')](_0x200c('0x5f'));logger[_0x200c('0x33')](_0x200c('0x60'),_0x45a0e8['id']);return setRelationship(_0x3efc44,_0x129af8,_0x45a0e8,'users');})['then'](function(){return setRelationship(_0x3efc44,_0x30c177,_0x45a0e8,_0x200c('0x62'));})[_0x200c('0x2e')](function(){return getServerInfo(_0x3efc44);})[_0x200c('0x6a')](function(_0xc18af7){logger[_0x200c('0x6b')]('['+_0x20dad6['lastevent'][_0x200c('0x78')]()+']',JSON[_0x200c('0x2a')](_0xc18af7));});}; \ No newline at end of file +var _0xbdb1=['name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','info','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','nameField','toLowerCase','content','custom_fields','variable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','queue','remoteUri','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','users','trigger:browser:url','unmanaged','stripTrailingSlash','lastevent','isNil','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...'];(function(_0x44fa12,_0x2296df){var _0x33adc4=function(_0x1dda0c){while(--_0x1dda0c){_0x44fa12['push'](_0x44fa12['shift']());}};_0x33adc4(++_0x2296df);}(_0xbdb1,0x6d));var _0x1bdb=function(_0x5cc556,_0x158710){_0x5cc556=_0x5cc556-0x0;var _0x12103b=_0xbdb1[_0x5cc556];return _0x12103b;};'use strict';var _=require(_0x1bdb('0x0'));var rp=require(_0x1bdb('0x1'));var BPromise=require('bluebird');var md5=require(_0x1bdb('0x2'));var util=require(_0x1bdb('0x3'));var Redis=require(_0x1bdb('0x4'));var intUtil=require('./util');var config=require(_0x1bdb('0x5'));var logger=require(_0x1bdb('0x6'))(_0x1bdb('0x7'));config[_0x1bdb('0x8')]=_[_0x1bdb('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1bdb('0xa'))(new Redis(config[_0x1bdb('0x8')]));var def={'method':_0x1bdb('0xb'),'json':!![]};function emit(_0x164764,_0x103a5b,_0xb64445){io['to'](_0x164764)[_0x1bdb('0xc')](_0x103a5b,_0xb64445);}function getTicket(_0x16c41d,_0x1d4d0c,_0x55e35e,_0x2420a3,_0x1674d1,_0x57ea0a,_0x1507a3,_0x5e1f6b){logger['info'](_0x1bdb('0xd'));var _0x5215fa=new Date();var _0x397376=[{'name':_0x1bdb('0xe'),'value':intUtil[_0x1bdb('0xf')](_0x2420a3[_0x1bdb('0x10')],_0x1674d1,'\x20')},{'name':_0x1bdb('0x11'),'value':_0x1d4d0c['id']},{'name':_0x1bdb('0x12'),'value':_0x1d4d0c['id']},{'name':_0x1bdb('0x13'),'value':intUtil[_0x1bdb('0xf')](_0x2420a3[_0x1bdb('0x14')],_0x1674d1,'\x0a')},{'name':'date_start','value':_0x5215fa[_0x1bdb('0x15')]()[_0x1bdb('0x16')](0x0,0x13)[_0x1bdb('0x17')]('T','\x20')},{'name':_0x1bdb('0x18'),'value':'0'},{'name':_0x1bdb('0x19'),'value':'15'},{'name':_0x1bdb('0x1a'),'value':_0x55e35e['id']},{'name':_0x1bdb('0x1b'),'value':_0x1bdb('0x1c')},{'name':_0x1bdb('0x1d'),'value':_0x55e35e[_0x1bdb('0xe')]},{'name':_0x1bdb('0x1e'),'value':_0x5e1f6b}];if(_0x57ea0a[_0x1bdb('0x1f')]){_[_0x1bdb('0x20')](_0x57ea0a,function(_0x2f4769){if(_0x1674d1[_0x2f4769[_0x1bdb('0x21')]]){_0x397376[_0x1bdb('0x22')]({'name':_0x2f4769[_0x1bdb('0x23')],'value':_0x1674d1[_0x2f4769[_0x1bdb('0x21')]]});}});}return request({'form':{'method':_0x1bdb('0x24'),'input_type':_0x1bdb('0x25'),'response_type':_0x1bdb('0x25'),'rest_data':JSON[_0x1bdb('0x26')]({'session':_0x1507a3['id'],'module_name':_0x1bdb('0x27'),'name_value_list':_0x397376})}});}function getAuth(_0xecbd94){return util[_0x1bdb('0x28')](_0x1bdb('0x29'),new Buffer(_0xecbd94[_0x1bdb('0x2a')]+':X')[_0x1bdb('0x2b')](_0x1bdb('0x2c')));}function getServerInfo(_0xb54c8d){return request({'form':{'method':'get_server_info','input_type':_0x1bdb('0x25'),'response_type':_0x1bdb('0x25'),'rest_data':JSON[_0x1bdb('0x26')]({'session':_0xb54c8d['id']})}});}function getUser(_0x398f65,_0x15cc05,_0x5e98ae){if(!_['isNil'](_0x15cc05)){logger['info']('Getting\x20agent\x20with\x20name',_0x15cc05);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1bdb('0x26')]({'session':_0x5e98ae['id'],'module_name':'Employees','query':util[_0x1bdb('0x28')](_0x1bdb('0x2d'),_0x15cc05),'order_by':'','offset':'0','select_fields':['id',_0x1bdb('0xe'),_0x1bdb('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1bdb('0x2f')](function(_0x9999f3){if(_0x9999f3['entry_list'][_0x1bdb('0x1f')]){var _0x27a210=_[_0x1bdb('0x30')](_0x9999f3[_0x1bdb('0x31')],function(_0xcf0690){return _0xcf0690[_0x1bdb('0x32')]['user_name'][_0x1bdb('0x33')]===_0x15cc05;});if(_0x27a210){logger[_0x1bdb('0x34')](_0x1bdb('0x35'));return BPromise[_0x1bdb('0x36')]({'id':_0x27a210['name_value_list']['id'][_0x1bdb('0x33')],'name':_0x27a210['name_value_list']['name'][_0x1bdb('0x33')]});}}logger[_0x1bdb('0x34')](_0x1bdb('0x37'));return BPromise['resolve']({'id':_0x5e98ae['name_value_list'][_0x1bdb('0x38')]['value'],'name':_0x5e98ae[_0x1bdb('0x32')][_0x1bdb('0x2e')][_0x1bdb('0x33')]});});}else{logger[_0x1bdb('0x34')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x5e98ae['name_value_list'][_0x1bdb('0x38')][_0x1bdb('0x33')],'name':_0x5e98ae[_0x1bdb('0x32')][_0x1bdb('0x2e')][_0x1bdb('0x33')]});}}function getEndUser(_0x29462e,_0x83630f,_0x289170,_0x5ebb22){logger[_0x1bdb('0x34')](_0x1bdb('0x39'),_0x289170);return request({'form':{'method':_0x1bdb('0x3a'),'input_type':_0x1bdb('0x25'),'response_type':_0x1bdb('0x25'),'rest_data':JSON['stringify']({'session':_0x5ebb22['id'],'module_name':'Contacts','query':util[_0x1bdb('0x28')](_0x1bdb('0x3b'),_0x289170),'order_by':'','offset':'0','select_fields':['id',_0x1bdb('0xe'),_0x1bdb('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1bdb('0x2f')](function(_0xc7da80){if(_0xc7da80[_0x1bdb('0x31')][_0x1bdb('0x1f')]){var _0x113465=_[_0x1bdb('0x30')](_0xc7da80[_0x1bdb('0x31')],function(_0x1de6e3){return _0x1de6e3['name_value_list']['phone_home']['value']===_0x289170;});if(_0x113465){logger['info'](_0x1bdb('0x3d'));return BPromise['resolve']({'id':_0x113465['name_value_list']['id'][_0x1bdb('0x33')],'name':_0x113465[_0x1bdb('0x32')][_0x1bdb('0xe')]['value'],'phone':_0x113465[_0x1bdb('0x32')][_0x1bdb('0x3c')][_0x1bdb('0x33')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x1bdb('0x24'),'input_type':'JSON','response_type':_0x1bdb('0x25'),'rest_data':JSON['stringify']({'session':_0x5ebb22['id'],'module_name':'Contacts','name_value_list':[{'name':_0x1bdb('0x3e'),'value':_0x83630f!==''?_0x83630f:util[_0x1bdb('0x28')](_0x1bdb('0x3f'),_0x289170)},{'name':_0x1bdb('0x3c'),'value':_0x289170}]})}})[_0x1bdb('0x2f')](function(_0x4c1231){logger[_0x1bdb('0x34')](_0x1bdb('0x40'));return BPromise['resolve']({'id':_0x4c1231['id'],'name':_0x4c1231[_0x1bdb('0x31')][_0x1bdb('0x3e')][_0x1bdb('0x33')],'phone':_0x4c1231[_0x1bdb('0x31')][_0x1bdb('0x3c')][_0x1bdb('0x33')]});});}});}function request(_0x47186c){logger[_0x1bdb('0x41')](_0x1bdb('0x42'),JSON[_0x1bdb('0x26')](_0x47186c));return rp(_[_0x1bdb('0x43')](def,_0x47186c));}function getTags(_0x59a4f0,_0x1bb9ed){var _0x1ffe2b=[];if(_0x59a4f0&&_0x59a4f0[_0x1bdb('0x1f')]>0x0){_0x1ffe2b=_[_0x1bdb('0x44')](_0x59a4f0,_0x1bb9ed);}return _0x1ffe2b;}function getCustomFields(_0x2fd6b9,_0x2f8b57){var _0x3849f0=[];var _0x138494={'custom_fields':[]};if(_0x2fd6b9[_0x1bdb('0x1f')]>0x0){_[_0x1bdb('0x20')](_0x2fd6b9,function(_0x136958){if(_0x136958[_0x1bdb('0x45')]===_0x1bdb('0x46')&&_0x136958['nameField']&&!_0x136958[_0x1bdb('0x47')]){_0x138494[_0x136958[_0x1bdb('0x48')][_0x1bdb('0x49')]()]=_0x136958[_0x1bdb('0x4a')][_0x1bdb('0x2b')]();}else if(_0x136958[_0x1bdb('0x45')]==='string'&&_0x136958['idField']&&_0x136958[_0x1bdb('0x47')]){_0x138494[_0x1bdb('0x4b')][_0x1bdb('0x22')]({'id':_0x136958[_0x1bdb('0x23')],'value':_0x136958[_0x1bdb('0x4a')][_0x1bdb('0x2b')]()});}else if(_0x136958[_0x1bdb('0x45')]===_0x1bdb('0x4c')&&_0x136958[_0x1bdb('0x21')]&&_0x136958[_0x1bdb('0x23')]&&_0x136958[_0x1bdb('0x47')]){_0x2f8b57[_0x136958[_0x1bdb('0x21')]]&&_0x138494[_0x1bdb('0x4b')]['push']({'id':_0x136958[_0x1bdb('0x23')],'value':_0x2f8b57[_0x136958[_0x1bdb('0x21')]][_0x1bdb('0x2b')]()});}else if(_0x136958[_0x1bdb('0x45')]==='customVariable'&&_0x136958[_0x1bdb('0x4d')]&&_0x136958[_0x1bdb('0x4d')][_0x1bdb('0xe')]&&_0x136958[_0x1bdb('0x23')]&&_0x136958['customField']){_0x2f8b57[_0x136958[_0x1bdb('0x4d')][_0x1bdb('0xe')]['toLowerCase']()]&&_0x138494[_0x1bdb('0x4b')][_0x1bdb('0x22')]({'id':_0x136958[_0x1bdb('0x23')],'value':_0x2f8b57[_0x136958[_0x1bdb('0x4d')]['name'][_0x1bdb('0x49')]()][_0x1bdb('0x2b')]()});}});}return _0x138494;}function getConnection(_0x3e505e){return request({'method':_0x1bdb('0xb'),'form':{'method':_0x1bdb('0x4e'),'input_type':_0x1bdb('0x25'),'response_type':_0x1bdb('0x25'),'rest_data':JSON[_0x1bdb('0x26')]({'user_auth':{'user_name':_0x3e505e[_0x1bdb('0x4f')],'password':_0x3e505e['password'],'encryption':_0x1bdb('0x50')},'application':_0x1bdb('0x51')})}})[_0x1bdb('0x2f')](function(_0x3ba4ed){var _0x29c81d=_0x3ba4ed;if(_0x29c81d['id']){def[_0x1bdb('0x52')]=_0x29c81d['id'];return BPromise[_0x1bdb('0x36')](_0x29c81d);}else{throw new Error(util[_0x1bdb('0x28')]('Account\x20%d\x20is\x20not\x20valid',_0x3e505e['id']));}});}function setRelationship(_0x5e1825,_0x2c3bbd,_0x23c1dd,_0x4849f8){return request({'form':{'method':'set_relationship','input_type':_0x1bdb('0x25'),'response_type':_0x1bdb('0x25'),'rest_data':JSON[_0x1bdb('0x26')]({'session':_0x5e1825['id'],'module_name':_0x1bdb('0x27'),'module_id':_0x23c1dd['id'],'link_field_name':_0x4849f8,'related_ids':[_0x2c3bbd['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x1bdb('0x53')]=function(_0x10c4ef,_0x1768fa,_0x4f38f9,_0x352d98,_0x437fb4,_0xa9a620){var _0x15b012,_0x12fb53,_0x299baa,_0x3b3317;_0xa9a620['remoteUri']=intUtil['stripTrailingSlash'](_0xa9a620[_0x1bdb('0x54')]);_0xa9a620[_0x1bdb('0x55')]=intUtil['stripTrailingSlash'](_0xa9a620['serverUrl']);def[_0x1bdb('0x56')]=util[_0x1bdb('0x28')]('%s/service/v4_1/rest.php',_0xa9a620[_0x1bdb('0x54')]);if(_0x437fb4&&_0x437fb4[_0x1bdb('0x57')]){logger[_0x1bdb('0x34')](_0x1bdb('0x58'),_0x1bdb('0x59'));_0x1768fa['recordingURL']=util[_0x1bdb('0x28')](_0x1bdb('0x5a'),_0xa9a620[_0x1bdb('0x55')],_0x1768fa['uniqueid'],md5(_0x1768fa[_0x1bdb('0x5b')]));}else{_0x1768fa[_0x1bdb('0x5c')]='';}return getConnection(_0xa9a620)[_0x1bdb('0x2f')](function(_0x546054){_0x3b3317=_0x546054;return getUser(_0xa9a620,_0x352d98['name'],_0x3b3317);})[_0x1bdb('0x2f')](function(_0x341ee6){_0x15b012=_0x341ee6;logger['info'](_0x1bdb('0x5d'),_0x15b012['id']);return getEndUser(_0xa9a620,_0x1768fa['calleridname'],_0x1768fa[_0x1bdb('0x5e')],_0x3b3317);})[_0x1bdb('0x2f')](function(_0x50a943){_0x12fb53=_0x50a943;logger[_0x1bdb('0x34')](_0x1bdb('0x5f'),_0x12fb53['id']);return getTicket(_0xa9a620,_0x15b012,_0x12fb53,_0x4f38f9,_0x1768fa,_0x4f38f9[_0x1bdb('0x60')],_0x3b3317,_0x1bdb('0x61'));})['then'](function(_0x164e7c){_0x299baa=_0x164e7c;logger['info'](_0x1bdb('0x62'));logger[_0x1bdb('0x34')]('The\x20Ticket\x20ID\x20is:',_0x299baa['id']);return setRelationship(_0x3b3317,_0x15b012,_0x299baa,'users');})['then'](function(){return setRelationship(_0x3b3317,_0x12fb53,_0x299baa,_0x1bdb('0x63'));})[_0x1bdb('0x2f')](function(){return getServerInfo(_0x3b3317);})[_0x1bdb('0x2f')](function(_0xc9074f){var _0x40689d=parseInt(_0xc9074f[_0x1bdb('0x64')][_0x1bdb('0x65')](0x0));var _0x2c661a=util['format'](_0x1bdb('0x66'),_0xa9a620['remoteUri'],_0x299baa['id']);if(_0x40689d>0x6){_0x2c661a=util[_0x1bdb('0x28')](_0x1bdb('0x67'),_0xa9a620[_0x1bdb('0x54')],_0x299baa['id']);}logger[_0x1bdb('0x34')]('[QUEUE]',_0x1bdb('0x68'));emit(util[_0x1bdb('0x28')](_0x1bdb('0x69'),_0x352d98[_0x1bdb('0xe')]),'trigger:browser:url',{'uri':_0x2c661a});})[_0x1bdb('0x6a')](function(_0x2ee489){logger[_0x1bdb('0x6b')](_0x1bdb('0x58'),JSON['stringify'](_0x2ee489));});};exports[_0x1bdb('0x6c')]=function(_0x3bc358,_0x38791b,_0x2238ce,_0x4ece20,_0xc56d72,_0x4e8c27,_0x23ba44){var _0x3bca62,_0x262bba,_0x38071c,_0x27447b;_0x4e8c27[_0x1bdb('0x54')]=intUtil['stripTrailingSlash'](_0x4e8c27[_0x1bdb('0x54')]);_0x4e8c27['serverUrl']=intUtil['stripTrailingSlash'](_0x4e8c27[_0x1bdb('0x55')]);def[_0x1bdb('0x56')]=util[_0x1bdb('0x28')](_0x1bdb('0x6d'),_0x4e8c27['remoteUri']);if(_0x23ba44&&_0x23ba44[_0x1bdb('0x6e')]&&_0x23ba44['recordingFormat']!==_0x1bdb('0x6f')){logger[_0x1bdb('0x34')](_0x1bdb('0x70'),'Recording\x20is\x20enabled!');_0x38791b[_0x1bdb('0x5c')]=util[_0x1bdb('0x28')](_0x1bdb('0x5a'),_0x4e8c27['serverUrl'],_0x38791b['uniqueid'],md5(_0x38791b[_0x1bdb('0x5b')]));}return getConnection(_0x4e8c27)[_0x1bdb('0x2f')](function(_0x3338a2){_0x27447b=_0x3338a2;return getUser(_0x4e8c27,_0x4ece20[_0x1bdb('0xe')],_0x27447b);})[_0x1bdb('0x2f')](function(_0x42c776){_0x3bca62=_0x42c776;logger[_0x1bdb('0x34')](_0x1bdb('0x5d'),_0x3bca62['id']);return getEndUser(_0x4e8c27,_0x38791b[_0x1bdb('0x71')],_0x38791b[_0x1bdb('0x72')],_0x27447b);})[_0x1bdb('0x2f')](function(_0x5d11c0){_0x262bba=_0x5d11c0;logger[_0x1bdb('0x34')](_0x1bdb('0x5f'),_0x262bba['id']);return getTicket(_0x4e8c27,_0x3bca62,_0x262bba,_0x2238ce,_0x38791b,_0x2238ce['Fields'],_0x27447b,'Outbound');})[_0x1bdb('0x2f')](function(_0x3eb0d4){_0x38071c=_0x3eb0d4;logger[_0x1bdb('0x34')](_0x1bdb('0x62'));logger['info'](_0x1bdb('0x73'),_0x38071c['id']);return setRelationship(_0x27447b,_0x3bca62,_0x38071c,_0x1bdb('0x74'));})[_0x1bdb('0x2f')](function(){return setRelationship(_0x27447b,_0x262bba,_0x38071c,_0x1bdb('0x63'));})[_0x1bdb('0x2f')](function(){return getServerInfo(_0x27447b);})[_0x1bdb('0x2f')](function(_0x5c28c8){var _0x21ead4=parseInt(_0x5c28c8[_0x1bdb('0x64')]['charAt'](0x0));var _0x52e6bb=util['format'](_0x1bdb('0x66'),_0x4e8c27[_0x1bdb('0x54')],_0x38071c['id']);if(_0x21ead4>0x6){_0x52e6bb=util[_0x1bdb('0x28')](_0x1bdb('0x67'),_0x4e8c27[_0x1bdb('0x54')],_0x38071c['id']);}logger['info'](_0x1bdb('0x70'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1bdb('0x28')](_0x1bdb('0x69'),_0x4ece20[_0x1bdb('0xe')]),_0x1bdb('0x75'),{'uri':_0x52e6bb});})[_0x1bdb('0x6a')](function(_0x90fd39){logger['error'](_0x1bdb('0x70'),JSON[_0x1bdb('0x26')](_0x90fd39));});};exports[_0x1bdb('0x76')]=function(_0x15d87d,_0x3385af,_0x205b0e,_0x47d410,_0x3261b9,_0x1c84a8){var _0x499776,_0x39cc06,_0x5fbe8a,_0x78155b;_0x1c84a8[_0x1bdb('0x54')]=intUtil[_0x1bdb('0x77')](_0x1c84a8[_0x1bdb('0x54')]);_0x1c84a8[_0x1bdb('0x55')]=intUtil['stripTrailingSlash'](_0x1c84a8['serverUrl']);def[_0x1bdb('0x56')]=util[_0x1bdb('0x28')](_0x1bdb('0x6d'),_0x1c84a8[_0x1bdb('0x54')]);if(_0x3261b9&&_0x3261b9[_0x1bdb('0x57')]){logger[_0x1bdb('0x34')]('['+_0x3385af[_0x1bdb('0x78')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x3385af['recordingURL']=util[_0x1bdb('0x28')](_0x1bdb('0x5a'),_0x1c84a8['serverUrl'],_0x3385af[_0x1bdb('0x5b')],md5(_0x3385af[_0x1bdb('0x5b')]));}else{_0x3385af[_0x1bdb('0x5c')]='';}return getConnection(_0x1c84a8)['then'](function(_0x23feba){_0x78155b=_0x23feba;if(!_[_0x1bdb('0x79')](_0x47d410)){return getUser(_0x1c84a8,_0x47d410[_0x1bdb('0xe')],_0x78155b);}else{return getUser(_0x1c84a8,null,_0x78155b);}})[_0x1bdb('0x2f')](function(_0x464adf){_0x499776=_0x464adf;logger[_0x1bdb('0x34')](_0x1bdb('0x5d'),_0x499776['id']);return getEndUser(_0x1c84a8,_0x3385af['calleridname'],_0x3385af[_0x1bdb('0x5e')],_0x78155b);})[_0x1bdb('0x2f')](function(_0x2920b8){_0x39cc06=_0x2920b8;logger['info'](_0x1bdb('0x5f'),_0x39cc06['id']);return getTicket(_0x1c84a8,_0x499776,_0x39cc06,_0x205b0e,_0x3385af,_0x205b0e[_0x1bdb('0x60')],_0x78155b,_0x1bdb('0x61'));})['then'](function(_0x58bc63){_0x5fbe8a=_0x58bc63;logger[_0x1bdb('0x34')](_0x1bdb('0x62'));logger[_0x1bdb('0x34')](_0x1bdb('0x73'),_0x5fbe8a['id']);return setRelationship(_0x78155b,_0x499776,_0x5fbe8a,'users');})[_0x1bdb('0x2f')](function(){return setRelationship(_0x78155b,_0x39cc06,_0x5fbe8a,'contacts');})[_0x1bdb('0x2f')](function(){return getServerInfo(_0x78155b);})[_0x1bdb('0x6a')](function(_0x9db875){logger[_0x1bdb('0x6b')]('['+_0x3385af['lastevent'][_0x1bdb('0x7a')]()+']',JSON[_0x1bdb('0x26')](_0x9db875));});}; \ 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 f9cf64d..821c49d 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 _0xe645=['key','keyContent','keyType','%s:\x20%s','stripTrailingSlash','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','format'];(function(_0x44f56d,_0x3a9a6a){var _0x2b15c7=function(_0x1e846a){while(--_0x1e846a){_0x44f56d['push'](_0x44f56d['shift']());}};_0x2b15c7(++_0x3a9a6a);}(_0xe645,0xa5));var _0x5e64=function(_0x198429,_0x43b5c1){_0x198429=_0x198429-0x0;var _0x4180b9=_0xe645[_0x198429];return _0x4180b9;};'use strict';var _=require(_0x5e64('0x0'));var util=require(_0x5e64('0x1'));exports[_0x5e64('0x2')]=function(_0x5cc4e3,_0x45621f,_0x648e22){var _0x36fce1=[];if(_0x5cc4e3[_0x5e64('0x3')]>0x0){var _0x4e9f33=_[_0x5e64('0x4')](_0x5cc4e3,['id']);for(var _0x18a3b5=0x0;_0x18a3b5<_0x4e9f33[_0x5e64('0x3')];_0x18a3b5++){var _0x3e1c5a=_0x4e9f33[_0x18a3b5];if(_0x3e1c5a[_0x5e64('0x5')]==='string'){_0x36fce1[_0x5e64('0x6')](_0x3e1c5a[_0x5e64('0x7')]);}else if(_0x3e1c5a['type']===_0x5e64('0x8')&&_0x3e1c5a[_0x5e64('0x9')]){_0x45621f[_0x3e1c5a[_0x5e64('0x9')]]&&_0x36fce1[_0x5e64('0x6')](_0x45621f[_0x3e1c5a[_0x5e64('0x9')]]['toString']());}else if(_0x3e1c5a[_0x5e64('0x5')]===_0x5e64('0xa')&&_0x3e1c5a['Variable']&&_0x3e1c5a[_0x5e64('0xb')][_0x5e64('0xc')]){_0x45621f[_0x3e1c5a[_0x5e64('0xb')][_0x5e64('0xc')]['toLowerCase']()]&&_0x36fce1[_0x5e64('0x6')](_0x45621f[_0x3e1c5a[_0x5e64('0xb')][_0x5e64('0xc')][_0x5e64('0xd')]()][_0x5e64('0xe')]());}else if(_0x3e1c5a[_0x5e64('0x5')]===_0x5e64('0xf')){if(_0x3e1c5a['keyType']==='string'&&_0x3e1c5a['key']){_0x36fce1[_0x5e64('0x6')](util[_0x5e64('0x10')]('%s:\x20%s',_0x3e1c5a[_0x5e64('0x11')],_0x3e1c5a[_0x5e64('0x12')]));}else if(_0x3e1c5a[_0x5e64('0x13')]===_0x5e64('0x8')&&_0x3e1c5a[_0x5e64('0x9')]&&_0x3e1c5a[_0x5e64('0x11')]){_0x45621f[_0x3e1c5a[_0x5e64('0x9')]]&&_0x36fce1[_0x5e64('0x6')](util[_0x5e64('0x10')](_0x5e64('0x14'),_0x3e1c5a[_0x5e64('0x11')],_0x45621f[_0x3e1c5a[_0x5e64('0x9')]]));}else if(_0x3e1c5a['keyType']===_0x5e64('0xa')&&_0x3e1c5a[_0x5e64('0xb')]&&_0x3e1c5a['Variable'][_0x5e64('0xc')]&&_0x3e1c5a['key']){_0x45621f[_0x3e1c5a[_0x5e64('0xb')][_0x5e64('0xc')]['toLowerCase']()]&&_0x36fce1[_0x5e64('0x6')](util['format']('%s:\x20%s',_0x3e1c5a[_0x5e64('0x11')],_0x45621f[_0x3e1c5a[_0x5e64('0xb')][_0x5e64('0xc')][_0x5e64('0xd')]()]));}}}}return _0x36fce1['join'](_0x648e22);};exports[_0x5e64('0x15')]=function(_0x4b0d3e){var _0x5ee647=_0x4b0d3e['slice'](-0x1);if(_0x5ee647==='/'){_0x4b0d3e=_0x4b0d3e['substring'](0x0,_0x4b0d3e[_0x5e64('0x16')](_0x5ee647));}return _0x4b0d3e;};exports[_0x5e64('0x17')]=function(_0xb04337){if(!_[_0x5e64('0x18')](_0xb04337)&&_0xb04337!==''){var _0x405703=/^(([^<>()\[\]\\.,;:\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 _0x405703[_0x5e64('0x19')](String(_0xb04337)[_0x5e64('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xc42d=['test','lodash','length','sortBy','type','string','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','push','keyValue','keyType','key','%s:\x20%s','keyContent','format','join','substring','validateEmail','isNil'];(function(_0x2225c8,_0x17bced){var _0x2a4662=function(_0x4f25b5){while(--_0x4f25b5){_0x2225c8['push'](_0x2225c8['shift']());}};_0x2a4662(++_0x17bced);}(_0xc42d,0x97));var _0xdc42=function(_0x4a37d5,_0x4512ae){_0x4a37d5=_0x4a37d5-0x0;var _0x42512f=_0xc42d[_0x4a37d5];return _0x42512f;};'use strict';var _=require(_0xdc42('0x0'));var util=require('util');exports['getString']=function(_0x1d6404,_0x587dd5,_0x3491c0){var _0x245736=[];if(_0x1d6404[_0xdc42('0x1')]>0x0){var _0x3f17f2=_[_0xdc42('0x2')](_0x1d6404,['id']);for(var _0x23f325=0x0;_0x23f325<_0x3f17f2[_0xdc42('0x1')];_0x23f325++){var _0x54d373=_0x3f17f2[_0x23f325];if(_0x54d373[_0xdc42('0x3')]===_0xdc42('0x4')){_0x245736['push'](_0x54d373[_0xdc42('0x5')]);}else if(_0x54d373[_0xdc42('0x3')]===_0xdc42('0x6')&&_0x54d373[_0xdc42('0x7')]){_0x587dd5[_0x54d373[_0xdc42('0x7')]]&&_0x245736['push'](_0x587dd5[_0x54d373['variableName']][_0xdc42('0x8')]());}else if(_0x54d373['type']===_0xdc42('0x9')&&_0x54d373['Variable']&&_0x54d373['Variable']['name']){_0x587dd5[_0x54d373[_0xdc42('0xa')][_0xdc42('0xb')][_0xdc42('0xc')]()]&&_0x245736[_0xdc42('0xd')](_0x587dd5[_0x54d373[_0xdc42('0xa')][_0xdc42('0xb')][_0xdc42('0xc')]()]['toString']());}else if(_0x54d373['type']===_0xdc42('0xe')){if(_0x54d373[_0xdc42('0xf')]===_0xdc42('0x4')&&_0x54d373[_0xdc42('0x10')]){_0x245736[_0xdc42('0xd')](util['format'](_0xdc42('0x11'),_0x54d373[_0xdc42('0x10')],_0x54d373[_0xdc42('0x12')]));}else if(_0x54d373[_0xdc42('0xf')]===_0xdc42('0x6')&&_0x54d373['variableName']&&_0x54d373[_0xdc42('0x10')]){_0x587dd5[_0x54d373[_0xdc42('0x7')]]&&_0x245736[_0xdc42('0xd')](util[_0xdc42('0x13')](_0xdc42('0x11'),_0x54d373['key'],_0x587dd5[_0x54d373[_0xdc42('0x7')]]));}else if(_0x54d373[_0xdc42('0xf')]===_0xdc42('0x9')&&_0x54d373[_0xdc42('0xa')]&&_0x54d373['Variable'][_0xdc42('0xb')]&&_0x54d373['key']){_0x587dd5[_0x54d373[_0xdc42('0xa')][_0xdc42('0xb')][_0xdc42('0xc')]()]&&_0x245736[_0xdc42('0xd')](util['format'](_0xdc42('0x11'),_0x54d373[_0xdc42('0x10')],_0x587dd5[_0x54d373[_0xdc42('0xa')]['name']['toLowerCase']()]));}}}}return _0x245736[_0xdc42('0x14')](_0x3491c0);};exports['stripTrailingSlash']=function(_0x54e41d){var _0x12e5e6=_0x54e41d['slice'](-0x1);if(_0x12e5e6==='/'){_0x54e41d=_0x54e41d[_0xdc42('0x15')](0x0,_0x54e41d['lastIndexOf'](_0x12e5e6));}return _0x54e41d;};exports[_0xdc42('0x16')]=function(_0x461eaa){if(!_[_0xdc42('0x17')](_0x461eaa)&&_0x461eaa!==''){var _0x53a33c=/^(([^<>()\[\]\\.,;:\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 _0x53a33c[_0xdc42('0x18')](String(_0x461eaa)[_0xdc42('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 19fdbe2..4ce0cc0 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 _0xf61c=['ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Descriptions','POST','format','%s/webservice.php','remoteUri','create','HelpDesk','stringify','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','GET','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','info','Agent\x20found!','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','sessionName','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','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridnum','trigger:browser:url','unmanaged','lastevent','toUpperCase','request-promise','util'];(function(_0x331c23,_0x4cb3ff){var _0x824184=function(_0x29b329){while(--_0x29b329){_0x331c23['push'](_0x331c23['shift']());}};_0x824184(++_0x4cb3ff);}(_0xf61c,0x192));var _0xcf61=function(_0x553304,_0x4dfc7c){_0x553304=_0x553304-0x0;var _0x2ea3b1=_0xf61c[_0x553304];return _0x2ea3b1;};'use strict';var _=require('lodash');var rp=require(_0xcf61('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xcf61('0x1'));var Redis=require(_0xcf61('0x2'));var intUtil=require(_0xcf61('0x3'));var config=require(_0xcf61('0x4'));var logger=require(_0xcf61('0x5'))(_0xcf61('0x6'));config[_0xcf61('0x7')]=_['defaults'](config[_0xcf61('0x7')],{'host':_0xcf61('0x8'),'port':0x18eb});var io=require(_0xcf61('0x9'))(new Redis(config[_0xcf61('0x7')]));function emit(_0x1f414f,_0x47ea7f,_0x506ae8){io['to'](_0x1f414f)[_0xcf61('0xa')](_0x47ea7f,_0x506ae8);}function getCustomFields(_0x6470e3,_0x420804){var _0x33c577={};if(_0x6470e3[_0xcf61('0xb')]>0x0){_[_0xcf61('0xc')](_0x6470e3,function(_0x4844fe){if(_0x4844fe[_0xcf61('0xd')]===_0xcf61('0xe')&&_0x4844fe[_0xcf61('0xf')]){_0x33c577[_0x4844fe[_0xcf61('0xf')]]=_0x4844fe['content']['toString']();}else if(_0x4844fe[_0xcf61('0xd')]===_0xcf61('0x10')&&_0x4844fe[_0xcf61('0x11')]&&_0x4844fe[_0xcf61('0xf')]&&_0x420804[_0x4844fe[_0xcf61('0x11')]]){_0x33c577[_0x4844fe[_0xcf61('0xf')]]=_0x420804[_0x4844fe[_0xcf61('0x11')]][_0xcf61('0x12')]();}else if(_0x4844fe[_0xcf61('0xd')]===_0xcf61('0x13')&&_0x4844fe[_0xcf61('0x14')]&&_0x4844fe[_0xcf61('0x14')][_0xcf61('0x15')]&&_0x4844fe['idField']&&_0x420804[_0x4844fe[_0xcf61('0x14')][_0xcf61('0x15')][_0xcf61('0x16')]()]){_0x33c577[_0x4844fe[_0xcf61('0xf')]]=_0x420804[_0x4844fe['Variable'][_0xcf61('0x15')][_0xcf61('0x16')]()]['toString']();}});}return _0x33c577;}function createTicket(_0x50c990,_0x429e03,_0x32d81c,_0x4d7975,_0x261b36,_0x19c0e4,_0x2eff1d){logger['info'](_0xcf61('0x17'));var _0x15098f=_[_0xcf61('0x18')]({'parent_id':'','assigned_user_id':_0x429e03['id'],'ticketpriorities':_0xcf61('0x19'),'ticketstatus':_0xcf61('0x1a'),'ticket_title':intUtil[_0xcf61('0x1b')](_0x4d7975['Subjects'],_0x261b36,'\x20'),'description':intUtil[_0xcf61('0x1b')](_0x4d7975[_0xcf61('0x1c')],_0x261b36,'\x0a'),'contact_id':_0x32d81c['id']},getCustomFields(_0x19c0e4,_0x261b36));var _0x4c800c={'method':_0xcf61('0x1d'),'uri':util[_0xcf61('0x1e')](_0xcf61('0x1f'),_0x50c990[_0xcf61('0x20')]),'form':{'operation':_0xcf61('0x21'),'username':_0x50c990['username'],'sessionName':_0x2eff1d['sessionName'],'elementType':_0xcf61('0x22'),'element':JSON[_0xcf61('0x23')](_0x15098f)},'json':!![]};return request(_0x4c800c)[_0xcf61('0x24')](function(_0x514a0b){if(_0x514a0b[_0xcf61('0x25')]){return BPromise[_0xcf61('0x26')]({'id':_0x514a0b[_0xcf61('0x27')]['id']});}else{throw new Error(util[_0xcf61('0x1e')](_0xcf61('0x28'),JSON[_0xcf61('0x23')](_0x514a0b[_0xcf61('0x29')])));}})[_0xcf61('0x2a')](function(_0x39dc94){var _0x579200=_0x39dc94[_0xcf61('0x2b')]||0x1f4;logger[_0xcf61('0x29')](_0xcf61('0x2c'),_0xcf61('0x2d'),_0x579200,JSON['stringify'](_0x39dc94));});}function getUser(_0x5db09f,_0x29639e,_0x143401){if(intUtil[_0xcf61('0x2e')](_0x29639e)){logger['info']('Getting\x20agent\x20with\x20email',_0x29639e);return request({'method':_0xcf61('0x2f'),'uri':util['format'](_0xcf61('0x1f'),_0x5db09f[_0xcf61('0x20')]),'qs':{'operation':_0xcf61('0x30'),'username':_0x5db09f[_0xcf61('0x31')],'sessionName':_0x143401['sessionName'],'query':util['format'](_0xcf61('0x32'),_0x29639e)},'json':!![]})[_0xcf61('0x24')](function(_0xe591bd){if(_0xe591bd[_0xcf61('0x25')]&&_0xe591bd['result']['length']){logger[_0xcf61('0x33')](_0xcf61('0x34'));return BPromise['resolve']({'id':_0xe591bd[_0xcf61('0x27')][0x0]['id'],'email':_0xe591bd[_0xcf61('0x27')][0x0][_0xcf61('0x35')],'name':_0xe591bd[_0xcf61('0x27')][0x0][_0xcf61('0x36')]+'\x20'+_0xe591bd[_0xcf61('0x27')]['last_name']});}else{logger[_0xcf61('0x33')](_0xcf61('0x37'));return BPromise[_0xcf61('0x26')]({'id':_0x143401[_0xcf61('0x38')],'email':_0x5db09f[_0xcf61('0x31')],'name':_0xcf61('0x39')});}})['catch'](function(_0x320027){var _0x4e1d87=_0x320027[_0xcf61('0x2b')]||0x1f4;logger[_0xcf61('0x29')](_0xcf61('0x2c'),'getUser',_0x4e1d87,JSON[_0xcf61('0x23')](_0x320027));});}else{logger[_0xcf61('0x33')](_0xcf61('0x37'));return BPromise[_0xcf61('0x26')]({'id':_0x143401[_0xcf61('0x38')],'email':_0x5db09f[_0xcf61('0x31')],'name':_0xcf61('0x39')})[_0xcf61('0x2a')](function(_0x53bdff){var _0x38c7bc=_0x53bdff['statusCode']||0x1f4;logger[_0xcf61('0x29')](_0xcf61('0x2c'),'getUser',_0x38c7bc,JSON['stringify'](_0x53bdff));});}}function getEndUser(_0x2497a5,_0x144ce1,_0x1799e4,_0x425e75){logger['info']('Searching\x20end\x20user\x20with\x20phone',_0x1799e4);return request({'method':_0xcf61('0x2f'),'uri':util[_0xcf61('0x1e')](_0xcf61('0x1f'),_0x2497a5[_0xcf61('0x20')]),'qs':{'operation':_0xcf61('0x30'),'username':_0x2497a5[_0xcf61('0x31')],'sessionName':_0x425e75[_0xcf61('0x3a')],'query':util['format'](_0xcf61('0x3b'),_0x1799e4,_0x1799e4,_0x1799e4,_0x1799e4,_0x1799e4)},'json':!![]})[_0xcf61('0x24')](function(_0x309710){if(_0x309710[_0xcf61('0x25')]&&_0x309710[_0xcf61('0x27')][_0xcf61('0xb')]){logger[_0xcf61('0x33')](_0xcf61('0x3c'));return BPromise[_0xcf61('0x26')]({'id':_0x309710[_0xcf61('0x27')][0x0]['id'],'name':_0x309710[_0xcf61('0x27')][0x0][_0xcf61('0x3d')]+'\x20'+_0x309710[_0xcf61('0x27')][0x0][_0xcf61('0x3e')],'phone':_0x1799e4});}else{logger[_0xcf61('0x33')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':_0xcf61('0x1d'),'uri':util[_0xcf61('0x1e')]('%s/webservice.php',_0x2497a5['remoteUri']),'form':{'operation':_0xcf61('0x21'),'sessionName':_0x425e75[_0xcf61('0x3a')],'elementType':_0xcf61('0x3f'),'element':JSON['stringify']({'lastname':_0x144ce1,'phone':_0x1799e4,'assigned_user_id':'\x20'})},'json':!![]})[_0xcf61('0x24')](function(_0x5121eb){logger[_0xcf61('0x33')](_0xcf61('0x40'));return BPromise[_0xcf61('0x26')]({'id':_0x5121eb[_0xcf61('0x27')]['id'],'name':_0x5121eb['result'][_0xcf61('0x3e')],'phone':_0x5121eb[_0xcf61('0x27')][_0xcf61('0x41')]});})[_0xcf61('0x2a')](function(_0x5767c5){var _0x28567d=_0x5767c5['statusCode']||0x1f4;logger[_0xcf61('0x29')](_0xcf61('0x2c'),_0xcf61('0x42'),_0x28567d,JSON['stringify'](_0x5767c5));});}});}function getConnection(_0x4bf744){var _0x3140e8=_0x4bf744['username'];var _0x35e1cc=_0x4bf744[_0xcf61('0x43')];return request({'method':'GET','uri':util[_0xcf61('0x1e')](_0xcf61('0x1f'),_0x4bf744['remoteUri']),'qs':{'operation':_0xcf61('0x44'),'username':_0x3140e8},'json':!![]})[_0xcf61('0x24')](function(_0x2aa5fa){if(_0x2aa5fa[_0xcf61('0x25')]){return request({'method':'POST','uri':util[_0xcf61('0x1e')](_0xcf61('0x1f'),_0x4bf744['remoteUri']),'form':{'operation':_0xcf61('0x45'),'username':_0x3140e8,'accessKey':md5(_0x2aa5fa[_0xcf61('0x27')]['token']+_0x35e1cc)},'json':!![]});}})['then'](function(_0x584098){if(_0x584098['success']){return BPromise[_0xcf61('0x26')](_0x584098[_0xcf61('0x27')]);}else{throw new Error(util[_0xcf61('0x1e')]('Account\x20%d\x20is\x20not\x20valid',_0x4bf744['id']));}})[_0xcf61('0x2a')](function(_0x9149de){var _0x267d9f=_0x9149de[_0xcf61('0x2b')]||0x1f4;logger[_0xcf61('0x29')](_0xcf61('0x2c'),_0xcf61('0x46'),_0x267d9f,JSON[_0xcf61('0x23')](_0x9149de));});}function request(_0x172f88){logger['info'](_0xcf61('0x47'),JSON[_0xcf61('0x23')](_0x172f88));return rp(_0x172f88);}exports[_0xcf61('0x48')]=function(_0x4b0d08,_0x4d268a,_0x409bdf,_0x104482,_0x3843df,_0x14b7f3){var _0x4654d3,_0x83cb80,_0x3f640c,_0xeddb12;_0x14b7f3[_0xcf61('0x20')]=intUtil[_0xcf61('0x49')](_0x14b7f3['remoteUri']);if(_0x3843df&&_0x3843df[_0xcf61('0x4a')]){logger[_0xcf61('0x33')](_0xcf61('0x4b'),_0xcf61('0x4c'));_0x4d268a[_0xcf61('0x4d')]=util[_0xcf61('0x1e')](_0xcf61('0x4e'),_0x14b7f3['serverUrl'],_0x4d268a[_0xcf61('0x4f')],md5(_0x4d268a[_0xcf61('0x4f')]));}else{_0x4d268a[_0xcf61('0x4d')]='';}return getConnection(_0x14b7f3)[_0xcf61('0x24')](function(_0xe18ff){_0xeddb12=_0xe18ff;return getUser(_0x14b7f3,_0x104482[_0xcf61('0x50')],_0xeddb12);})['then'](function(_0x225dfd){_0x4654d3=_0x225dfd;logger['info'](_0xcf61('0x51'),_0x4654d3['id']);return getEndUser(_0x14b7f3,_0x4d268a[_0xcf61('0x52')],_0x4d268a[_0xcf61('0x53')],_0xeddb12);})[_0xcf61('0x24')](function(_0x27c124){_0x83cb80=_0x27c124;logger[_0xcf61('0x33')](_0xcf61('0x54'),_0x83cb80['id']);return createTicket(_0x14b7f3,_0x4654d3,_0x83cb80,_0x409bdf,_0x4d268a,_0x409bdf[_0xcf61('0x55')],_0xeddb12);})[_0xcf61('0x24')](function(_0x330371){_0x3f640c=_0x330371;logger[_0xcf61('0x33')](_0xcf61('0x56'));logger[_0xcf61('0x33')](_0xcf61('0x57'),_0x3f640c['id']);var _0x47acf3=util[_0xcf61('0x1e')](_0xcf61('0x58'),_0x14b7f3[_0xcf61('0x20')],_['split'](_0x3f640c['id'],'x')[0x1]);logger['info'](_0xcf61('0x4b'),_0xcf61('0x59'));emit(util[_0xcf61('0x1e')](_0xcf61('0x5a'),_0x104482['name']),'trigger:browser:url',{'uri':_0x47acf3});})['catch'](function(_0x499d45){logger[_0xcf61('0x29')](_0xcf61('0x4b'),JSON['stringify'](_0x499d45));});};exports[_0xcf61('0x5b')]=function(_0x581df6,_0x3e243e,_0x6348db,_0x56d73a,_0x1fc96d,_0x4945b4,_0x5ce705){var _0x4e58a0,_0x40069d,_0x4cad84,_0x444a11;_0x4945b4[_0xcf61('0x20')]=intUtil[_0xcf61('0x49')](_0x4945b4[_0xcf61('0x20')]);_0x4945b4[_0xcf61('0x5c')]=intUtil[_0xcf61('0x49')](_0x4945b4[_0xcf61('0x5c')]);if(_0x5ce705&&_0x5ce705[_0xcf61('0x5d')]&&_0x5ce705[_0xcf61('0x5d')]!==_0xcf61('0x5e')){logger['info'](_0xcf61('0x5f'),_0xcf61('0x4c'));_0x3e243e[_0xcf61('0x4d')]=util[_0xcf61('0x1e')](_0xcf61('0x4e'),_0x4945b4[_0xcf61('0x5c')],_0x3e243e[_0xcf61('0x4f')],md5(_0x3e243e[_0xcf61('0x4f')]));}return getConnection(_0x4945b4)['then'](function(_0x121090){_0x444a11=_0x121090;return getUser(_0x4945b4,_0x56d73a[_0xcf61('0x50')],_0x444a11);})[_0xcf61('0x24')](function(_0x3d3e0b){_0x4e58a0=_0x3d3e0b;logger[_0xcf61('0x33')](_0xcf61('0x51'),_0x4e58a0['id']);return getEndUser(_0x4945b4,_0x3e243e['destcalleridname'],_0x3e243e[_0xcf61('0x60')],_0x444a11);})[_0xcf61('0x24')](function(_0x5d938d){_0x40069d=_0x5d938d;logger['info'](_0xcf61('0x54'),_0x40069d['id']);return createTicket(_0x4945b4,_0x4e58a0,_0x40069d,_0x6348db,_0x3e243e,_0x6348db[_0xcf61('0x55')],_0x444a11);})[_0xcf61('0x24')](function(_0x4c0c9f){_0x4cad84=_0x4c0c9f;logger[_0xcf61('0x33')](_0xcf61('0x56'));logger['info'](_0xcf61('0x57'),_0x4cad84['id']);var _0x55d8e5=util[_0xcf61('0x1e')](_0xcf61('0x58'),_0x4945b4[_0xcf61('0x20')],_['split'](_0x4cad84['id'],'x')[0x1]);logger[_0xcf61('0x33')]('[OUTBOUND]',_0xcf61('0x59'));emit(util[_0xcf61('0x1e')]('user:%s',_0x56d73a[_0xcf61('0x15')]),_0xcf61('0x61'),{'uri':_0x55d8e5});})['catch'](function(_0x428cea){logger[_0xcf61('0x29')](_0xcf61('0x5f'),JSON['stringify'](_0x428cea));});};exports[_0xcf61('0x62')]=function(_0x5d23b2,_0xc0d282,_0x4378ce,_0x29dce0,_0x57f033,_0x13efe0){var _0x2af18a,_0x123a75,_0x549c69,_0x5f2bc3;_0x13efe0['remoteUri']=intUtil['stripTrailingSlash'](_0x13efe0['remoteUri']);_0x13efe0['serverUrl']=intUtil[_0xcf61('0x49')](_0x13efe0[_0xcf61('0x5c')]);if(_0x57f033&&_0x57f033[_0xcf61('0x4a')]){logger['info']('['+_0xc0d282[_0xcf61('0x63')][_0xcf61('0x64')]()+']','Recording\x20is\x20enabled!');_0xc0d282['recordingURL']=util[_0xcf61('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x13efe0[_0xcf61('0x5c')],_0xc0d282['uniqueid'],md5(_0xc0d282['uniqueid']));}else{_0xc0d282['recordingURL']='';}return getConnection(_0x13efe0)[_0xcf61('0x24')](function(_0x120e0f){_0x5f2bc3=_0x120e0f;return getUser(_0x13efe0,'',_0x5f2bc3);})[_0xcf61('0x24')](function(_0x596f6b){_0x2af18a=_0x596f6b;logger[_0xcf61('0x33')](_0xcf61('0x51'),_0x2af18a['id']);return getEndUser(_0x13efe0,_0xc0d282['calleridname'],_0xc0d282[_0xcf61('0x53')],_0x5f2bc3);})[_0xcf61('0x24')](function(_0x49dd43){_0x123a75=_0x49dd43;logger[_0xcf61('0x33')](_0xcf61('0x54'),_0x123a75['id']);return createTicket(_0x13efe0,_0x2af18a,_0x123a75,_0x4378ce,_0xc0d282,_0x4378ce['Fields'],_0x5f2bc3);})[_0xcf61('0x24')](function(_0x9dc6e2){_0x549c69=_0x9dc6e2;logger[_0xcf61('0x33')]('Ticket\x20created!');logger['info'](_0xcf61('0x57'),_0x549c69['id']);})[_0xcf61('0x2a')](function(_0x565b6f){logger[_0xcf61('0x29')]('['+_0xc0d282['lastevent']['toUpperCase']()+']',JSON[_0xcf61('0x23')](_0x565b6f));});}; \ No newline at end of file +var _0x1f53=['bluebird','md5','util','ioredis','../../../../config/environment','vTiger','redis','localhost','socket.io-emitter','emit','length','type','string','idField','content','variableName','toString','customVariable','Variable','name','toLowerCase','merge','Open','Subjects','Descriptions','format','%s/webservice.php','remoteUri','create','username','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','info','Getting\x20agent\x20with\x20email','GET','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','Searching\x20end\x20user\x20with\x20phone','query','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!','POST','Enduser\x20created.','phone','accessKey','getchallenge','login','getConnection','queue','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','trigger:browser:url','unmanaged','monitor_format','lastevent','toUpperCase','The\x20User\x20ID\x20is:','calleridnum','lodash'];(function(_0x9abebc,_0x32e0ca){var _0x2d644b=function(_0x5e2aed){while(--_0x5e2aed){_0x9abebc['push'](_0x9abebc['shift']());}};_0x2d644b(++_0x32e0ca);}(_0x1f53,0xbd));var _0x31f5=function(_0x9c2c88,_0x313e41){_0x9c2c88=_0x9c2c88-0x0;var _0xad0ee9=_0x1f53[_0x9c2c88];return _0xad0ee9;};'use strict';var _=require(_0x31f5('0x0'));var rp=require('request-promise');var BPromise=require(_0x31f5('0x1'));var md5=require(_0x31f5('0x2'));var util=require(_0x31f5('0x3'));var Redis=require(_0x31f5('0x4'));var intUtil=require('./util');var config=require(_0x31f5('0x5'));var logger=require('../../../../config/logger')(_0x31f5('0x6'));config[_0x31f5('0x7')]=_['defaults'](config['redis'],{'host':_0x31f5('0x8'),'port':0x18eb});var io=require(_0x31f5('0x9'))(new Redis(config['redis']));function emit(_0x83ec08,_0x4f037b,_0x1aadc2){io['to'](_0x83ec08)[_0x31f5('0xa')](_0x4f037b,_0x1aadc2);}function getCustomFields(_0x41ada4,_0x54bdb8){var _0x11fd2f={};if(_0x41ada4[_0x31f5('0xb')]>0x0){_['forEach'](_0x41ada4,function(_0x80482e){if(_0x80482e[_0x31f5('0xc')]===_0x31f5('0xd')&&_0x80482e[_0x31f5('0xe')]){_0x11fd2f[_0x80482e['idField']]=_0x80482e[_0x31f5('0xf')]['toString']();}else if(_0x80482e[_0x31f5('0xc')]==='variable'&&_0x80482e[_0x31f5('0x10')]&&_0x80482e['idField']&&_0x54bdb8[_0x80482e['variableName']]){_0x11fd2f[_0x80482e[_0x31f5('0xe')]]=_0x54bdb8[_0x80482e[_0x31f5('0x10')]][_0x31f5('0x11')]();}else if(_0x80482e[_0x31f5('0xc')]===_0x31f5('0x12')&&_0x80482e[_0x31f5('0x13')]&&_0x80482e[_0x31f5('0x13')][_0x31f5('0x14')]&&_0x80482e[_0x31f5('0xe')]&&_0x54bdb8[_0x80482e[_0x31f5('0x13')][_0x31f5('0x14')][_0x31f5('0x15')]()]){_0x11fd2f[_0x80482e[_0x31f5('0xe')]]=_0x54bdb8[_0x80482e[_0x31f5('0x13')][_0x31f5('0x14')][_0x31f5('0x15')]()][_0x31f5('0x11')]();}});}return _0x11fd2f;}function createTicket(_0x5b6679,_0x4ecdce,_0x58a16c,_0x223ac1,_0x17a9e7,_0x220873,_0x26578c){logger['info']('Creating\x20new\x20ticket...');var _0xd9a8a7=_[_0x31f5('0x16')]({'parent_id':'','assigned_user_id':_0x4ecdce['id'],'ticketpriorities':'Normal','ticketstatus':_0x31f5('0x17'),'ticket_title':intUtil['getString'](_0x223ac1[_0x31f5('0x18')],_0x17a9e7,'\x20'),'description':intUtil['getString'](_0x223ac1[_0x31f5('0x19')],_0x17a9e7,'\x0a'),'contact_id':_0x58a16c['id']},getCustomFields(_0x220873,_0x17a9e7));var _0x5bb2ed={'method':'POST','uri':util[_0x31f5('0x1a')](_0x31f5('0x1b'),_0x5b6679[_0x31f5('0x1c')]),'form':{'operation':_0x31f5('0x1d'),'username':_0x5b6679[_0x31f5('0x1e')],'sessionName':_0x26578c['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0xd9a8a7)},'json':!![]};return request(_0x5bb2ed)[_0x31f5('0x1f')](function(_0x3dc987){if(_0x3dc987['success']){return BPromise[_0x31f5('0x20')]({'id':_0x3dc987[_0x31f5('0x21')]['id']});}else{throw new Error(util['format'](_0x31f5('0x22'),JSON[_0x31f5('0x23')](_0x3dc987[_0x31f5('0x24')])));}})[_0x31f5('0x25')](function(_0x9f5ba4){var _0x41da9e=_0x9f5ba4[_0x31f5('0x26')]||0x1f4;logger['error'](_0x31f5('0x27'),'createTicket',_0x41da9e,JSON['stringify'](_0x9f5ba4));});}function getUser(_0x3e4bf3,_0x4c120f,_0x4a3a76){if(intUtil[_0x31f5('0x28')](_0x4c120f)){logger[_0x31f5('0x29')](_0x31f5('0x2a'),_0x4c120f);return request({'method':_0x31f5('0x2b'),'uri':util[_0x31f5('0x1a')](_0x31f5('0x1b'),_0x3e4bf3[_0x31f5('0x1c')]),'qs':{'operation':'query','username':_0x3e4bf3['username'],'sessionName':_0x4a3a76[_0x31f5('0x2c')],'query':util['format'](_0x31f5('0x2d'),_0x4c120f)},'json':!![]})[_0x31f5('0x1f')](function(_0x559cdf){if(_0x559cdf[_0x31f5('0x2e')]&&_0x559cdf[_0x31f5('0x21')]['length']){logger[_0x31f5('0x29')](_0x31f5('0x2f'));return BPromise[_0x31f5('0x20')]({'id':_0x559cdf[_0x31f5('0x21')][0x0]['id'],'email':_0x559cdf[_0x31f5('0x21')][0x0]['email1'],'name':_0x559cdf['result'][0x0]['first_name']+'\x20'+_0x559cdf['result']['last_name']});}else{logger[_0x31f5('0x29')](_0x31f5('0x30'));return BPromise[_0x31f5('0x20')]({'id':_0x4a3a76[_0x31f5('0x31')],'email':_0x3e4bf3[_0x31f5('0x1e')],'name':_0x31f5('0x32')});}})['catch'](function(_0x228c93){var _0x298d59=_0x228c93['statusCode']||0x1f4;logger[_0x31f5('0x24')](_0x31f5('0x27'),_0x31f5('0x33'),_0x298d59,JSON[_0x31f5('0x23')](_0x228c93));});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x31f5('0x20')]({'id':_0x4a3a76[_0x31f5('0x31')],'email':_0x3e4bf3[_0x31f5('0x1e')],'name':_0x31f5('0x32')})[_0x31f5('0x25')](function(_0x18d480){var _0x14cc3c=_0x18d480[_0x31f5('0x26')]||0x1f4;logger['error'](_0x31f5('0x27'),'getUser',_0x14cc3c,JSON['stringify'](_0x18d480));});}}function getEndUser(_0xa56075,_0x2a59e3,_0x4a933b,_0x1814a6){logger[_0x31f5('0x29')](_0x31f5('0x34'),_0x4a933b);return request({'method':'GET','uri':util[_0x31f5('0x1a')](_0x31f5('0x1b'),_0xa56075['remoteUri']),'qs':{'operation':_0x31f5('0x35'),'username':_0xa56075[_0x31f5('0x1e')],'sessionName':_0x1814a6[_0x31f5('0x2c')],'query':util[_0x31f5('0x1a')](_0x31f5('0x36'),_0x4a933b,_0x4a933b,_0x4a933b,_0x4a933b,_0x4a933b)},'json':!![]})[_0x31f5('0x1f')](function(_0x4ffdd0){if(_0x4ffdd0['success']&&_0x4ffdd0['result'][_0x31f5('0xb')]){logger[_0x31f5('0x29')](_0x31f5('0x37'));return BPromise[_0x31f5('0x20')]({'id':_0x4ffdd0[_0x31f5('0x21')][0x0]['id'],'name':_0x4ffdd0[_0x31f5('0x21')][0x0][_0x31f5('0x38')]+'\x20'+_0x4ffdd0['result'][0x0][_0x31f5('0x39')],'phone':_0x4a933b});}else{logger[_0x31f5('0x29')](_0x31f5('0x3a'));return request({'method':_0x31f5('0x3b'),'uri':util[_0x31f5('0x1a')](_0x31f5('0x1b'),_0xa56075[_0x31f5('0x1c')]),'form':{'operation':_0x31f5('0x1d'),'sessionName':_0x1814a6[_0x31f5('0x2c')],'elementType':'Contacts','element':JSON['stringify']({'lastname':_0x2a59e3,'phone':_0x4a933b,'assigned_user_id':'\x20'})},'json':!![]})[_0x31f5('0x1f')](function(_0x1c178f){logger[_0x31f5('0x29')](_0x31f5('0x3c'));return BPromise[_0x31f5('0x20')]({'id':_0x1c178f[_0x31f5('0x21')]['id'],'name':_0x1c178f[_0x31f5('0x21')][_0x31f5('0x39')],'phone':_0x1c178f[_0x31f5('0x21')][_0x31f5('0x3d')]});})['catch'](function(_0x32e4a9){var _0x18e801=_0x32e4a9[_0x31f5('0x26')]||0x1f4;logger[_0x31f5('0x24')](_0x31f5('0x27'),'getEndUser',_0x18e801,JSON[_0x31f5('0x23')](_0x32e4a9));});}});}function getConnection(_0x3b43b7){var _0x5114a9=_0x3b43b7['username'];var _0x3da9f3=_0x3b43b7[_0x31f5('0x3e')];return request({'method':_0x31f5('0x2b'),'uri':util[_0x31f5('0x1a')](_0x31f5('0x1b'),_0x3b43b7['remoteUri']),'qs':{'operation':_0x31f5('0x3f'),'username':_0x5114a9},'json':!![]})[_0x31f5('0x1f')](function(_0x100083){if(_0x100083['success']){return request({'method':_0x31f5('0x3b'),'uri':util[_0x31f5('0x1a')](_0x31f5('0x1b'),_0x3b43b7['remoteUri']),'form':{'operation':_0x31f5('0x40'),'username':_0x5114a9,'accessKey':md5(_0x100083[_0x31f5('0x21')]['token']+_0x3da9f3)},'json':!![]});}})[_0x31f5('0x1f')](function(_0x144fd5){if(_0x144fd5['success']){return BPromise[_0x31f5('0x20')](_0x144fd5[_0x31f5('0x21')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x3b43b7['id']));}})[_0x31f5('0x25')](function(_0x1f25da){var _0x485dd2=_0x1f25da['statusCode']||0x1f4;logger['error'](_0x31f5('0x27'),_0x31f5('0x41'),_0x485dd2,JSON[_0x31f5('0x23')](_0x1f25da));});}function request(_0x3038ad){logger[_0x31f5('0x29')]('[HTTP]',JSON[_0x31f5('0x23')](_0x3038ad));return rp(_0x3038ad);}exports[_0x31f5('0x42')]=function(_0x7da3af,_0x24711b,_0x2e3717,_0x5a99e0,_0x3219e8,_0x45325a){var _0x4b1374,_0x39b8fc,_0x5267ee,_0x1213c6;_0x45325a[_0x31f5('0x1c')]=intUtil[_0x31f5('0x43')](_0x45325a['remoteUri']);if(_0x3219e8&&_0x3219e8['monitor_format']){logger[_0x31f5('0x29')](_0x31f5('0x44'),_0x31f5('0x45'));_0x24711b[_0x31f5('0x46')]=util[_0x31f5('0x1a')](_0x31f5('0x47'),_0x45325a[_0x31f5('0x48')],_0x24711b[_0x31f5('0x49')],md5(_0x24711b[_0x31f5('0x49')]));}else{_0x24711b[_0x31f5('0x46')]='';}return getConnection(_0x45325a)[_0x31f5('0x1f')](function(_0x3835ce){_0x1213c6=_0x3835ce;return getUser(_0x45325a,_0x5a99e0[_0x31f5('0x4a')],_0x1213c6);})[_0x31f5('0x1f')](function(_0x2f66c9){_0x4b1374=_0x2f66c9;logger[_0x31f5('0x29')]('The\x20User\x20ID\x20is:',_0x4b1374['id']);return getEndUser(_0x45325a,_0x24711b[_0x31f5('0x4b')],_0x24711b['calleridnum'],_0x1213c6);})[_0x31f5('0x1f')](function(_0x231ff0){_0x39b8fc=_0x231ff0;logger[_0x31f5('0x29')]('The\x20Enduser\x20ID\x20is:',_0x39b8fc['id']);return createTicket(_0x45325a,_0x4b1374,_0x39b8fc,_0x2e3717,_0x24711b,_0x2e3717[_0x31f5('0x4c')],_0x1213c6);})[_0x31f5('0x1f')](function(_0x3cf63e){_0x5267ee=_0x3cf63e;logger[_0x31f5('0x29')]('Ticket\x20created!');logger[_0x31f5('0x29')](_0x31f5('0x4d'),_0x5267ee['id']);var _0x218397=util[_0x31f5('0x1a')](_0x31f5('0x4e'),_0x45325a['remoteUri'],_[_0x31f5('0x4f')](_0x5267ee['id'],'x')[0x1]);logger[_0x31f5('0x29')]('[QUEUE]',_0x31f5('0x50'));emit(util[_0x31f5('0x1a')](_0x31f5('0x51'),_0x5a99e0[_0x31f5('0x14')]),'trigger:browser:url',{'uri':_0x218397});})[_0x31f5('0x25')](function(_0x18d0d5){logger[_0x31f5('0x24')](_0x31f5('0x44'),JSON['stringify'](_0x18d0d5));});};exports['outbound']=function(_0x1412d3,_0x149626,_0x244dbb,_0x4c2553,_0x3e4eaa,_0x16baf9,_0x1a63fe){var _0x297abe,_0x10fa89,_0x202ceb,_0x2517b5;_0x16baf9[_0x31f5('0x1c')]=intUtil[_0x31f5('0x43')](_0x16baf9['remoteUri']);_0x16baf9['serverUrl']=intUtil[_0x31f5('0x43')](_0x16baf9[_0x31f5('0x48')]);if(_0x1a63fe&&_0x1a63fe[_0x31f5('0x52')]&&_0x1a63fe[_0x31f5('0x52')]!==_0x31f5('0x53')){logger['info'](_0x31f5('0x54'),_0x31f5('0x45'));_0x149626[_0x31f5('0x46')]=util[_0x31f5('0x1a')](_0x31f5('0x47'),_0x16baf9[_0x31f5('0x48')],_0x149626[_0x31f5('0x49')],md5(_0x149626[_0x31f5('0x49')]));}return getConnection(_0x16baf9)[_0x31f5('0x1f')](function(_0x5e400e){_0x2517b5=_0x5e400e;return getUser(_0x16baf9,_0x4c2553['email'],_0x2517b5);})[_0x31f5('0x1f')](function(_0x2c1bf9){_0x297abe=_0x2c1bf9;logger['info']('The\x20User\x20ID\x20is:',_0x297abe['id']);return getEndUser(_0x16baf9,_0x149626['destcalleridname'],_0x149626[_0x31f5('0x55')],_0x2517b5);})[_0x31f5('0x1f')](function(_0x1116c1){_0x10fa89=_0x1116c1;logger[_0x31f5('0x29')](_0x31f5('0x56'),_0x10fa89['id']);return createTicket(_0x16baf9,_0x297abe,_0x10fa89,_0x244dbb,_0x149626,_0x244dbb[_0x31f5('0x4c')],_0x2517b5);})[_0x31f5('0x1f')](function(_0x33cc74){_0x202ceb=_0x33cc74;logger['info'](_0x31f5('0x57'));logger[_0x31f5('0x29')](_0x31f5('0x4d'),_0x202ceb['id']);var _0xf4f06d=util['format'](_0x31f5('0x4e'),_0x16baf9[_0x31f5('0x1c')],_['split'](_0x202ceb['id'],'x')[0x1]);logger[_0x31f5('0x29')](_0x31f5('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x31f5('0x1a')](_0x31f5('0x51'),_0x4c2553[_0x31f5('0x14')]),_0x31f5('0x58'),{'uri':_0xf4f06d});})[_0x31f5('0x25')](function(_0x2d6b70){logger[_0x31f5('0x24')](_0x31f5('0x54'),JSON[_0x31f5('0x23')](_0x2d6b70));});};exports[_0x31f5('0x59')]=function(_0x429635,_0x56b8d0,_0x29e985,_0x126cef,_0x1cd86d,_0x164c3a){var _0x164a12,_0x709dce,_0x5e525d,_0x53c45d;_0x164c3a[_0x31f5('0x1c')]=intUtil[_0x31f5('0x43')](_0x164c3a[_0x31f5('0x1c')]);_0x164c3a[_0x31f5('0x48')]=intUtil[_0x31f5('0x43')](_0x164c3a[_0x31f5('0x48')]);if(_0x1cd86d&&_0x1cd86d[_0x31f5('0x5a')]){logger[_0x31f5('0x29')]('['+_0x56b8d0[_0x31f5('0x5b')][_0x31f5('0x5c')]()+']',_0x31f5('0x45'));_0x56b8d0['recordingURL']=util['format'](_0x31f5('0x47'),_0x164c3a['serverUrl'],_0x56b8d0[_0x31f5('0x49')],md5(_0x56b8d0[_0x31f5('0x49')]));}else{_0x56b8d0[_0x31f5('0x46')]='';}return getConnection(_0x164c3a)[_0x31f5('0x1f')](function(_0x7b6185){_0x53c45d=_0x7b6185;return getUser(_0x164c3a,'',_0x53c45d);})[_0x31f5('0x1f')](function(_0x4b8459){_0x164a12=_0x4b8459;logger['info'](_0x31f5('0x5d'),_0x164a12['id']);return getEndUser(_0x164c3a,_0x56b8d0[_0x31f5('0x4b')],_0x56b8d0[_0x31f5('0x5e')],_0x53c45d);})['then'](function(_0x43d432){_0x709dce=_0x43d432;logger[_0x31f5('0x29')]('The\x20Enduser\x20ID\x20is:',_0x709dce['id']);return createTicket(_0x164c3a,_0x164a12,_0x709dce,_0x29e985,_0x56b8d0,_0x29e985[_0x31f5('0x4c')],_0x53c45d);})[_0x31f5('0x1f')](function(_0x5de601){_0x5e525d=_0x5de601;logger['info']('Ticket\x20created!');logger[_0x31f5('0x29')](_0x31f5('0x4d'),_0x5e525d['id']);})[_0x31f5('0x25')](function(_0x176708){logger[_0x31f5('0x24')]('['+_0x56b8d0[_0x31f5('0x5b')]['toUpperCase']()+']',JSON[_0x31f5('0x23')](_0x176708));});}; \ 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 8751219..65a1778 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 _0xfc60=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','authType','%s:%s','username','password','%s/token:%s','Basic\x20%s','toString','debug','[HTTP]','GET','forEach','type','nameField','toLowerCase','content','string','idField','customField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','calleridname','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','./util','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','count','Agent\x20found!','find','results'];(function(_0x1efe03,_0x55b566){var _0x30060c=function(_0x2fc6a6){while(--_0x2fc6a6){_0x1efe03['push'](_0x1efe03['shift']());}};_0x30060c(++_0x55b566);}(_0xfc60,0xb3));var _0x0fc6=function(_0x4e5b7c,_0x291c10){_0x4e5b7c=_0x4e5b7c-0x0;var _0x2c89af=_0xfc60[_0x4e5b7c];return _0x2c89af;};'use strict';var _=require(_0x0fc6('0x0'));var rp=require(_0x0fc6('0x1'));var md5=require('md5');var util=require(_0x0fc6('0x2'));var Redis=require(_0x0fc6('0x3'));var intUtil=require(_0x0fc6('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0fc6('0x5'))(_0x0fc6('0x6'));config['redis']=_[_0x0fc6('0x7')](config[_0x0fc6('0x8')],{'host':_0x0fc6('0x9'),'port':0x18eb});var io=require(_0x0fc6('0xa'))(new Redis(config['redis']));function emit(_0x5e4bb7,_0x12db30,_0x292ee9){io['to'](_0x5e4bb7)[_0x0fc6('0xb')](_0x12db30,_0x292ee9);}var headers={'Content-Type':_0x0fc6('0xc'),'Accept':'application/json'};function getTicket(_0x3768f9,_0x60ef83,_0x2dccf1,_0x53e321,_0x18696c){logger[_0x0fc6('0xd')](_0x0fc6('0xe'));return request({'uri':util[_0x0fc6('0xf')](_0x0fc6('0x10'),_0x3768f9['remoteUri']),'method':_0x0fc6('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x2dccf1['id'],'submitter_id':_0x60ef83?_0x60ef83['id']:undefined,'assignee_id':_0x60ef83?_0x60ef83['id']:undefined,'tags':getTags(_0x53e321['Tags'],_0x0fc6('0x12')),'subject':intUtil[_0x0fc6('0x13')](_0x53e321[_0x0fc6('0x14')],_0x18696c,'\x20'),'description':intUtil[_0x0fc6('0x13')](_0x53e321[_0x0fc6('0x15')],_0x18696c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0fc6('0x13')](_0x53e321['Descriptions'],_0x18696c,'\x0a')}},getCustomFields(_0x53e321[_0x0fc6('0x16')],_0x18696c))}})[_0x0fc6('0x17')](function(_0x12ee6d){logger[_0x0fc6('0xd')](_0x0fc6('0x18'));return _0x12ee6d['ticket'];});}function getUser(_0x1cf7fc,_0x15e2fb){if(intUtil[_0x0fc6('0x19')](_0x15e2fb)){logger['info'](_0x0fc6('0x1a'),_0x15e2fb);return request({'uri':util['format'](_0x0fc6('0x1b'),_0x1cf7fc[_0x0fc6('0x1c')]),'qs':{'query':util[_0x0fc6('0xf')]('type:user\x20role:agent\x20email:%s',_0x15e2fb)}})[_0x0fc6('0x17')](function(_0x36f029){if(_0x36f029[_0x0fc6('0x1d')]){logger[_0x0fc6('0xd')](_0x0fc6('0x1e'));return _[_0x0fc6('0x1f')](_0x36f029[_0x0fc6('0x20')],{'email':_0x15e2fb,'role':'agent'});}else{logger['info'](_0x0fc6('0x21'));return request({'uri':util[_0x0fc6('0xf')](_0x0fc6('0x22'),_0x1cf7fc['remoteUri'])})[_0x0fc6('0x17')](function(_0x1a6bbe){logger['info'](_0x0fc6('0x23'));return _0x1a6bbe[_0x0fc6('0x24')];});}});}else{logger[_0x0fc6('0xd')](_0x0fc6('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x1cf7fc[_0x0fc6('0x1c')])})[_0x0fc6('0x17')](function(_0x26662d){logger['info']('Admin\x20account\x20selected.');return _0x26662d[_0x0fc6('0x24')];});}}function getEndUser(_0x349b0b,_0x3476be,_0xbb8b47){logger[_0x0fc6('0xd')]('Searching\x20enduser\x20with\x20phone',_0xbb8b47);return request({'uri':util['format'](_0x0fc6('0x1b'),_0x349b0b[_0x0fc6('0x1c')]),'qs':{'query':util[_0x0fc6('0xf')](_0x0fc6('0x25'),_0xbb8b47)}})[_0x0fc6('0x17')](function(_0x3517ee){var _0x5f4f8c;if(_0x3517ee[_0x0fc6('0x20')][_0x0fc6('0x26')]){_0x3517ee['results']=_['filter'](_0x3517ee['results'],{'suspended':![],'role':'end-user'});if(_0x3517ee['results'][_0x0fc6('0x26')]){_0x5f4f8c=_[_0x0fc6('0x27')](_0x3517ee[_0x0fc6('0x20')]);}}if(_0x5f4f8c){logger[_0x0fc6('0xd')](_0x0fc6('0x28'));return _0x5f4f8c;}else{logger['info'](_0x0fc6('0x29'));return request({'uri':util[_0x0fc6('0xf')](_0x0fc6('0x2a'),_0x349b0b['remoteUri']),'method':_0x0fc6('0x11'),'body':{'user':{'role':_0x0fc6('0x2b'),'name':util['format'](_0x0fc6('0x2c'),_0x3476be||_0xbb8b47),'phone':_0xbb8b47}}})['then'](function(_0x1a1376){logger[_0x0fc6('0xd')]('Enduser\x20created.');return _0x1a1376[_0x0fc6('0x24')];});}});}function getAuth(_0x2146d6){var _0x53be41;if(_0x2146d6[_0x0fc6('0x2d')]==='password'){_0x53be41=util[_0x0fc6('0xf')](_0x0fc6('0x2e'),_0x2146d6[_0x0fc6('0x2f')],_0x2146d6[_0x0fc6('0x30')]);}else if(_0x2146d6[_0x0fc6('0x2d')]==='token'){_0x53be41=util[_0x0fc6('0xf')](_0x0fc6('0x31'),_0x2146d6['username'],_0x2146d6['token']);}return util[_0x0fc6('0xf')](_0x0fc6('0x32'),new Buffer(_0x53be41)[_0x0fc6('0x33')]('base64'));}function request(_0x4bb4fb){logger[_0x0fc6('0x34')](_0x0fc6('0x35'),JSON['stringify'](_0x4bb4fb));return rp(_[_0x0fc6('0x7')](_0x4bb4fb,{'method':_0x0fc6('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x23f736,_0x545e9f){var _0x3129be=[];if(_0x23f736&&_0x23f736[_0x0fc6('0x26')]>0x0){_0x3129be=_['map'](_0x23f736,_0x545e9f);}return _0x3129be;}function getCustomFields(_0x5186e6,_0x4b5f30){var _0x5e87f7=[];var _0xb1c059={'custom_fields':[]};if(_0x5186e6['length']>0x0){_[_0x0fc6('0x37')](_0x5186e6,function(_0x207103){if(_0x207103[_0x0fc6('0x38')]==='string'&&_0x207103[_0x0fc6('0x39')]&&!_0x207103['customField']){_0xb1c059[_0x207103[_0x0fc6('0x39')][_0x0fc6('0x3a')]()]=_0x207103[_0x0fc6('0x3b')]['toString']();}else if(_0x207103['type']===_0x0fc6('0x3c')&&_0x207103[_0x0fc6('0x3d')]&&_0x207103[_0x0fc6('0x3e')]){_0xb1c059[_0x0fc6('0x3f')][_0x0fc6('0x40')]({'id':_0x207103[_0x0fc6('0x3d')],'value':_0x207103[_0x0fc6('0x3b')][_0x0fc6('0x33')]()});}else if(_0x207103['type']===_0x0fc6('0x41')&&_0x207103['variableName']&&_0x207103['idField']&&_0x207103[_0x0fc6('0x3e')]){_0x4b5f30[_0x207103[_0x0fc6('0x42')]]&&_0xb1c059[_0x0fc6('0x3f')][_0x0fc6('0x40')]({'id':_0x207103[_0x0fc6('0x3d')],'value':_0x4b5f30[_0x207103['variableName']]['toString']()});}else if(_0x207103[_0x0fc6('0x38')]==='customVariable'&&_0x207103[_0x0fc6('0x43')]&&_0x207103['Variable']['name']&&_0x207103[_0x0fc6('0x3d')]&&_0x207103[_0x0fc6('0x3e')]){_0x4b5f30[_0x207103[_0x0fc6('0x43')][_0x0fc6('0x12')][_0x0fc6('0x3a')]()]&&_0xb1c059['custom_fields'][_0x0fc6('0x40')]({'id':_0x207103[_0x0fc6('0x3d')],'value':_0x4b5f30[_0x207103[_0x0fc6('0x43')][_0x0fc6('0x12')][_0x0fc6('0x3a')]()]['toString']()});}});}return _0xb1c059;}exports[_0x0fc6('0x44')]=function(_0x73a7b0,_0x4222dc,_0x79384d,_0xd19de5,_0x237a56,_0x5e7e79){var _0x2da81e,_0x2746b8;_0x5e7e79[_0x0fc6('0x1c')]=intUtil[_0x0fc6('0x45')](_0x5e7e79['remoteUri']);_0x5e7e79[_0x0fc6('0x46')]=intUtil[_0x0fc6('0x45')](_0x5e7e79[_0x0fc6('0x46')]);if(_0x237a56&&_0x237a56[_0x0fc6('0x47')]){logger['info']('[QUEUE]',_0x0fc6('0x48'));_0x4222dc[_0x0fc6('0x49')]=util[_0x0fc6('0xf')](_0x0fc6('0x4a'),_0x5e7e79[_0x0fc6('0x46')],_0x4222dc[_0x0fc6('0x4b')],md5(_0x4222dc[_0x0fc6('0x4b')]));}else{_0x4222dc[_0x0fc6('0x49')]='';}headers[_0x0fc6('0x4c')]=getAuth(_0x5e7e79);return getUser(_0x5e7e79,_0xd19de5[_0x0fc6('0x4d')])['then'](function(_0xc20e7){_0x2da81e=_0xc20e7;logger[_0x0fc6('0xd')](_0x0fc6('0x4e'),_0x2da81e['id']);return getEndUser(_0x5e7e79,_0x4222dc['calleridname'],_0x4222dc[_0x0fc6('0x4f')]);})['then'](function(_0x42f526){_0x2746b8=_0x42f526;logger[_0x0fc6('0xd')](_0x0fc6('0x50'),_0x2746b8['id']);return getTicket(_0x5e7e79,_0x2da81e,_0x2746b8,_0x79384d,_0x4222dc);})[_0x0fc6('0x17')](function(_0x571ed6){if(_0x571ed6){logger[_0x0fc6('0xd')](_0x0fc6('0x51'),_0x571ed6['id']);switch(_0x5e7e79[_0x0fc6('0x38')]){case'integrationTab':logger[_0x0fc6('0xd')](_0x0fc6('0x52'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x0fc6('0xf')](_0x0fc6('0x53'),_0x5e7e79[_0x0fc6('0x1c')],_0x2da81e['id'],_0x571ed6['id']),'method':'POST'});case _0x0fc6('0x54'):logger[_0x0fc6('0xd')](_0x0fc6('0x52'),_0x0fc6('0x55'));emit(util[_0x0fc6('0xf')]('user:%s',_0xd19de5[_0x0fc6('0x12')]),_0x0fc6('0x56'),{'uri':util[_0x0fc6('0xf')]('%s/agent/tickets/%s',_0x5e7e79['remoteUri'][_0x0fc6('0x57')](_0x0fc6('0x58'),''),_0x571ed6['id'])});break;default:logger[_0x0fc6('0x59')](_0x0fc6('0x52'),_0x0fc6('0x5a'));}}})['catch'](function(_0x3122aa){logger[_0x0fc6('0x59')](_0x0fc6('0x5b'),util['inspect'](_0x3122aa,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x471654,_0x4f1d56,_0x483cb5,_0x11c2de,_0x385315,_0x5d20b8,_0x2f82c6){var _0x391142,_0x50c64;_0x5d20b8['remoteUri']=intUtil[_0x0fc6('0x45')](_0x5d20b8[_0x0fc6('0x1c')]);_0x5d20b8[_0x0fc6('0x46')]=intUtil[_0x0fc6('0x45')](_0x5d20b8['serverUrl']);if(_0x2f82c6&&_0x2f82c6[_0x0fc6('0x5c')]&&_0x2f82c6[_0x0fc6('0x5c')]!=='none'){logger[_0x0fc6('0xd')](_0x0fc6('0x5d'),_0x0fc6('0x48'));_0x4f1d56[_0x0fc6('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d20b8[_0x0fc6('0x46')],_0x4f1d56[_0x0fc6('0x4b')],md5(_0x4f1d56[_0x0fc6('0x4b')]));}headers[_0x0fc6('0x4c')]=getAuth(_0x5d20b8);return getUser(_0x5d20b8,_0x11c2de['email'])[_0x0fc6('0x17')](function(_0x1fe327){_0x391142=_0x1fe327;logger[_0x0fc6('0xd')](_0x0fc6('0x4e'),_0x391142['id']);return getEndUser(_0x5d20b8,_0x4f1d56[_0x0fc6('0x5e')],_0x4f1d56[_0x0fc6('0x5f')]);})['then'](function(_0x52c2af){_0x50c64=_0x52c2af;logger[_0x0fc6('0xd')](_0x0fc6('0x50'),_0x50c64['id']);return getTicket(_0x5d20b8,_0x391142,_0x50c64,_0x483cb5,_0x4f1d56);})['then'](function(_0x3ba43f){if(_0x3ba43f){logger[_0x0fc6('0xd')](_0x0fc6('0x51'),_0x3ba43f['id']);switch(_0x5d20b8['type']){case _0x0fc6('0x60'):logger[_0x0fc6('0xd')](_0x0fc6('0x5d'),_0x0fc6('0x61'));return request({'uri':util[_0x0fc6('0xf')](_0x0fc6('0x53'),_0x5d20b8['remoteUri'],_0x391142['id'],_0x3ba43f['id']),'method':'POST'});case _0x0fc6('0x54'):logger[_0x0fc6('0xd')](_0x0fc6('0x5d'),_0x0fc6('0x55'));emit(util[_0x0fc6('0xf')]('user:%s',_0x11c2de[_0x0fc6('0x12')]),_0x0fc6('0x56'),{'uri':util['format'](_0x0fc6('0x62'),_0x5d20b8[_0x0fc6('0x1c')][_0x0fc6('0x57')](_0x0fc6('0x58'),''),_0x3ba43f['id'])});break;default:logger[_0x0fc6('0x59')](_0x0fc6('0x5d'),_0x0fc6('0x5a'));}}})[_0x0fc6('0x63')](function(_0x508f66){logger[_0x0fc6('0x59')](_0x0fc6('0x64'),util[_0x0fc6('0x65')](_0x508f66,{'showHidden':!![],'depth':null}));});};exports[_0x0fc6('0x66')]=function(_0x410f37,_0x84e299,_0x1d6d83,_0x2cf1bb,_0x516432,_0x14983e){var _0x36d6ea,_0x5ece02;_0x14983e[_0x0fc6('0x1c')]=intUtil['stripTrailingSlash'](_0x14983e[_0x0fc6('0x1c')]);_0x14983e['serverUrl']=intUtil['stripTrailingSlash'](_0x14983e[_0x0fc6('0x46')]);if(_0x516432&&_0x516432[_0x0fc6('0x47')]){logger[_0x0fc6('0xd')]('['+_0x84e299['lastevent']['toUpperCase']()+']',_0x0fc6('0x48'));_0x84e299[_0x0fc6('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14983e['serverUrl'],_0x84e299[_0x0fc6('0x4b')],md5(_0x84e299[_0x0fc6('0x4b')]));}else{_0x84e299['recordingURL']='';}headers[_0x0fc6('0x4c')]=getAuth(_0x14983e);return getUser(_0x14983e)[_0x0fc6('0x17')](function(_0x1a03f5){_0x36d6ea=_0x1a03f5;logger[_0x0fc6('0xd')](_0x0fc6('0x4e'),_0x36d6ea['id']);return getEndUser(_0x14983e,_0x84e299[_0x0fc6('0x67')],_0x84e299[_0x0fc6('0x4f')]);})[_0x0fc6('0x17')](function(_0x152663){_0x5ece02=_0x152663;logger[_0x0fc6('0xd')]('The\x20Enduser\x20ID\x20is:',_0x5ece02['id']);return getTicket(_0x14983e,_0x36d6ea,_0x5ece02,_0x1d6d83,_0x84e299);})['then'](function(_0x566300){if(_0x566300){logger['info'](_0x0fc6('0x51'),_0x566300['id']);}})[_0x0fc6('0x63')](function(_0x6d261a){logger[_0x0fc6('0x59')]('['+_0x84e299['lastevent'][_0x0fc6('0x68')]()+']'+_0x0fc6('0x69'),util[_0x0fc6('0x65')](_0x6d261a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x474a=['socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','Descriptions','getString','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','length','results','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','forEach','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x474a,0x69));var _0xa474=function(_0x328fe8,_0x3959b4){_0x328fe8=_0x328fe8-0x0;var _0x28eab1=_0x474a[_0x328fe8];return _0x28eab1;};'use strict';var _=require(_0xa474('0x0'));var rp=require(_0xa474('0x1'));var md5=require('md5');var util=require(_0xa474('0x2'));var Redis=require(_0xa474('0x3'));var intUtil=require('./util');var config=require(_0xa474('0x4'));var logger=require(_0xa474('0x5'))(_0xa474('0x6'));config[_0xa474('0x7')]=_[_0xa474('0x8')](config[_0xa474('0x7')],{'host':_0xa474('0x9'),'port':0x18eb});var io=require(_0xa474('0xa'))(new Redis(config[_0xa474('0x7')]));function emit(_0x25cd27,_0x2b4824,_0x14ede1){io['to'](_0x25cd27)[_0xa474('0xb')](_0x2b4824,_0x14ede1);}var headers={'Content-Type':_0xa474('0xc'),'Accept':_0xa474('0xc')};function getTicket(_0xf70963,_0x5058fc,_0x1b39f9,_0x1ef50f,_0x366df2){logger[_0xa474('0xd')](_0xa474('0xe'));return request({'uri':util[_0xa474('0xf')](_0xa474('0x10'),_0xf70963[_0xa474('0x11')]),'method':_0xa474('0x12'),'body':{'ticket':_[_0xa474('0x13')]({'requester_id':_0x1b39f9['id'],'submitter_id':_0x5058fc?_0x5058fc['id']:undefined,'assignee_id':_0x5058fc?_0x5058fc['id']:undefined,'tags':getTags(_0x1ef50f[_0xa474('0x14')],_0xa474('0x15')),'subject':intUtil['getString'](_0x1ef50f[_0xa474('0x16')],_0x366df2,'\x20'),'description':intUtil['getString'](_0x1ef50f[_0xa474('0x17')],_0x366df2,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa474('0x18')](_0x1ef50f[_0xa474('0x17')],_0x366df2,'\x0a')}},getCustomFields(_0x1ef50f[_0xa474('0x19')],_0x366df2))}})[_0xa474('0x1a')](function(_0x50f961){logger['info'](_0xa474('0x1b'));return _0x50f961[_0xa474('0x1c')];});}function getUser(_0x16db96,_0x1241f5){if(intUtil[_0xa474('0x1d')](_0x1241f5)){logger[_0xa474('0xd')](_0xa474('0x1e'),_0x1241f5);return request({'uri':util['format'](_0xa474('0x1f'),_0x16db96[_0xa474('0x11')]),'qs':{'query':util[_0xa474('0xf')](_0xa474('0x20'),_0x1241f5)}})['then'](function(_0x1f6748){if(_0x1f6748[_0xa474('0x21')]){logger[_0xa474('0xd')]('Agent\x20found!');return _[_0xa474('0x22')](_0x1f6748['results'],{'email':_0x1241f5,'role':_0xa474('0x23')});}else{logger['info'](_0xa474('0x24'));return request({'uri':util['format'](_0xa474('0x25'),_0x16db96[_0xa474('0x11')])})['then'](function(_0x4f49d3){logger['info'](_0xa474('0x26'));return _0x4f49d3[_0xa474('0x27')];});}});}else{logger[_0xa474('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x16db96[_0xa474('0x11')])})['then'](function(_0x8c41f5){logger[_0xa474('0xd')](_0xa474('0x26'));return _0x8c41f5[_0xa474('0x27')];});}}function getEndUser(_0x2b3060,_0x567e63,_0x478d71){logger[_0xa474('0xd')]('Searching\x20enduser\x20with\x20phone',_0x478d71);return request({'uri':util[_0xa474('0xf')](_0xa474('0x1f'),_0x2b3060['remoteUri']),'qs':{'query':util['format'](_0xa474('0x28'),_0x478d71)}})[_0xa474('0x1a')](function(_0x3d1ef5){var _0xc20812;if(_0x3d1ef5['results'][_0xa474('0x29')]){_0x3d1ef5[_0xa474('0x2a')]=_['filter'](_0x3d1ef5[_0xa474('0x2a')],{'suspended':![],'role':_0xa474('0x2b')});if(_0x3d1ef5[_0xa474('0x2a')][_0xa474('0x29')]){_0xc20812=_['first'](_0x3d1ef5[_0xa474('0x2a')]);}}if(_0xc20812){logger[_0xa474('0xd')](_0xa474('0x2c'));return _0xc20812;}else{logger[_0xa474('0xd')](_0xa474('0x2d'));return request({'uri':util[_0xa474('0xf')]('%s/users.json',_0x2b3060[_0xa474('0x11')]),'method':_0xa474('0x12'),'body':{'user':{'role':'end-user','name':util[_0xa474('0xf')](_0xa474('0x2e'),_0x567e63||_0x478d71),'phone':_0x478d71}}})[_0xa474('0x1a')](function(_0x33cd24){logger[_0xa474('0xd')](_0xa474('0x2f'));return _0x33cd24[_0xa474('0x27')];});}});}function getAuth(_0x53dc9d){var _0x2c9f0b;if(_0x53dc9d[_0xa474('0x30')]===_0xa474('0x31')){_0x2c9f0b=util[_0xa474('0xf')](_0xa474('0x32'),_0x53dc9d[_0xa474('0x33')],_0x53dc9d[_0xa474('0x31')]);}else if(_0x53dc9d[_0xa474('0x30')]===_0xa474('0x34')){_0x2c9f0b=util[_0xa474('0xf')]('%s/token:%s',_0x53dc9d['username'],_0x53dc9d[_0xa474('0x34')]);}return util[_0xa474('0xf')](_0xa474('0x35'),new Buffer(_0x2c9f0b)[_0xa474('0x36')](_0xa474('0x37')));}function request(_0x469f1b){logger[_0xa474('0x38')](_0xa474('0x39'),JSON[_0xa474('0x3a')](_0x469f1b));return rp(_[_0xa474('0x8')](_0x469f1b,{'method':_0xa474('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x450843,_0x578819){var _0x1cb1a7=[];if(_0x450843&&_0x450843[_0xa474('0x29')]>0x0){_0x1cb1a7=_['map'](_0x450843,_0x578819);}return _0x1cb1a7;}function getCustomFields(_0x26b0ed,_0x14b3e6){var _0x351315=[];var _0x314dfb={'custom_fields':[]};if(_0x26b0ed[_0xa474('0x29')]>0x0){_[_0xa474('0x3c')](_0x26b0ed,function(_0x1d84f4){if(_0x1d84f4[_0xa474('0x3d')]==='string'&&_0x1d84f4[_0xa474('0x3e')]&&!_0x1d84f4[_0xa474('0x3f')]){_0x314dfb[_0x1d84f4[_0xa474('0x3e')][_0xa474('0x40')]()]=_0x1d84f4[_0xa474('0x41')]['toString']();}else if(_0x1d84f4[_0xa474('0x3d')]===_0xa474('0x42')&&_0x1d84f4[_0xa474('0x43')]&&_0x1d84f4['customField']){_0x314dfb[_0xa474('0x44')][_0xa474('0x45')]({'id':_0x1d84f4['idField'],'value':_0x1d84f4[_0xa474('0x41')][_0xa474('0x36')]()});}else if(_0x1d84f4['type']===_0xa474('0x46')&&_0x1d84f4[_0xa474('0x47')]&&_0x1d84f4[_0xa474('0x43')]&&_0x1d84f4['customField']){_0x14b3e6[_0x1d84f4['variableName']]&&_0x314dfb[_0xa474('0x44')][_0xa474('0x45')]({'id':_0x1d84f4['idField'],'value':_0x14b3e6[_0x1d84f4['variableName']][_0xa474('0x36')]()});}else if(_0x1d84f4[_0xa474('0x3d')]==='customVariable'&&_0x1d84f4[_0xa474('0x48')]&&_0x1d84f4[_0xa474('0x48')]['name']&&_0x1d84f4[_0xa474('0x43')]&&_0x1d84f4[_0xa474('0x3f')]){_0x14b3e6[_0x1d84f4['Variable'][_0xa474('0x15')][_0xa474('0x40')]()]&&_0x314dfb[_0xa474('0x44')][_0xa474('0x45')]({'id':_0x1d84f4['idField'],'value':_0x14b3e6[_0x1d84f4[_0xa474('0x48')]['name'][_0xa474('0x40')]()][_0xa474('0x36')]()});}});}return _0x314dfb;}exports[_0xa474('0x49')]=function(_0x36a50a,_0x44af6b,_0x37a7a4,_0x4d1599,_0x3dfe17,_0x47c651){var _0x57a5ac,_0x3c536c;_0x47c651[_0xa474('0x11')]=intUtil[_0xa474('0x4a')](_0x47c651[_0xa474('0x11')]);_0x47c651[_0xa474('0x4b')]=intUtil[_0xa474('0x4a')](_0x47c651['serverUrl']);if(_0x3dfe17&&_0x3dfe17[_0xa474('0x4c')]){logger[_0xa474('0xd')]('[QUEUE]',_0xa474('0x4d'));_0x44af6b[_0xa474('0x4e')]=util[_0xa474('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47c651[_0xa474('0x4b')],_0x44af6b[_0xa474('0x4f')],md5(_0x44af6b[_0xa474('0x4f')]));}else{_0x44af6b[_0xa474('0x4e')]='';}headers[_0xa474('0x50')]=getAuth(_0x47c651);return getUser(_0x47c651,_0x4d1599[_0xa474('0x51')])['then'](function(_0x3bb468){_0x57a5ac=_0x3bb468;logger[_0xa474('0xd')](_0xa474('0x52'),_0x57a5ac['id']);return getEndUser(_0x47c651,_0x44af6b[_0xa474('0x53')],_0x44af6b['calleridnum']);})['then'](function(_0x25c78){_0x3c536c=_0x25c78;logger[_0xa474('0xd')]('The\x20Enduser\x20ID\x20is:',_0x3c536c['id']);return getTicket(_0x47c651,_0x57a5ac,_0x3c536c,_0x37a7a4,_0x44af6b);})[_0xa474('0x1a')](function(_0xac6b3a){if(_0xac6b3a){logger[_0xa474('0xd')](_0xa474('0x54'),_0xac6b3a['id']);switch(_0x47c651[_0xa474('0x3d')]){case _0xa474('0x55'):logger[_0xa474('0xd')](_0xa474('0x56'),_0xa474('0x57'));return request({'uri':util['format'](_0xa474('0x58'),_0x47c651['remoteUri'],_0x57a5ac['id'],_0xac6b3a['id']),'method':'POST'});case _0xa474('0x59'):logger[_0xa474('0xd')](_0xa474('0x56'),_0xa474('0x5a'));emit(util['format'](_0xa474('0x5b'),_0x4d1599[_0xa474('0x15')]),_0xa474('0x5c'),{'uri':util[_0xa474('0xf')](_0xa474('0x5d'),_0x47c651['remoteUri'][_0xa474('0x5e')](_0xa474('0x5f'),''),_0xac6b3a['id'])});break;default:logger[_0xa474('0x60')](_0xa474('0x56'),_0xa474('0x61'));}}})[_0xa474('0x62')](function(_0x1ec814){logger[_0xa474('0x60')](_0xa474('0x63'),util['inspect'](_0x1ec814,{'showHidden':!![],'depth':null}));});};exports[_0xa474('0x64')]=function(_0x1fe6ce,_0x3473cd,_0x58297d,_0x265569,_0x4fb899,_0x1ca5f7,_0x411c){var _0x139252,_0x6baac4;_0x1ca5f7['remoteUri']=intUtil[_0xa474('0x4a')](_0x1ca5f7[_0xa474('0x11')]);_0x1ca5f7['serverUrl']=intUtil['stripTrailingSlash'](_0x1ca5f7[_0xa474('0x4b')]);if(_0x411c&&_0x411c[_0xa474('0x65')]&&_0x411c[_0xa474('0x65')]!==_0xa474('0x66')){logger[_0xa474('0xd')](_0xa474('0x67'),_0xa474('0x4d'));_0x3473cd['recordingURL']=util[_0xa474('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ca5f7[_0xa474('0x4b')],_0x3473cd[_0xa474('0x4f')],md5(_0x3473cd[_0xa474('0x4f')]));}headers[_0xa474('0x50')]=getAuth(_0x1ca5f7);return getUser(_0x1ca5f7,_0x265569['email'])[_0xa474('0x1a')](function(_0x2f4276){_0x139252=_0x2f4276;logger[_0xa474('0xd')](_0xa474('0x52'),_0x139252['id']);return getEndUser(_0x1ca5f7,_0x3473cd[_0xa474('0x68')],_0x3473cd[_0xa474('0x69')]);})[_0xa474('0x1a')](function(_0x19e0b0){_0x6baac4=_0x19e0b0;logger[_0xa474('0xd')](_0xa474('0x6a'),_0x6baac4['id']);return getTicket(_0x1ca5f7,_0x139252,_0x6baac4,_0x58297d,_0x3473cd);})[_0xa474('0x1a')](function(_0x19da6d){if(_0x19da6d){logger[_0xa474('0xd')](_0xa474('0x54'),_0x19da6d['id']);switch(_0x1ca5f7[_0xa474('0x3d')]){case'integrationTab':logger[_0xa474('0xd')]('[OUTBOUND]',_0xa474('0x57'));return request({'uri':util[_0xa474('0xf')](_0xa474('0x58'),_0x1ca5f7[_0xa474('0x11')],_0x139252['id'],_0x19da6d['id']),'method':_0xa474('0x12')});case _0xa474('0x59'):logger[_0xa474('0xd')](_0xa474('0x67'),_0xa474('0x5a'));emit(util[_0xa474('0xf')](_0xa474('0x5b'),_0x265569['name']),_0xa474('0x5c'),{'uri':util[_0xa474('0xf')](_0xa474('0x5d'),_0x1ca5f7[_0xa474('0x11')][_0xa474('0x5e')](_0xa474('0x5f'),''),_0x19da6d['id'])});break;default:logger[_0xa474('0x60')](_0xa474('0x67'),_0xa474('0x61'));}}})[_0xa474('0x62')](function(_0x17cccd){logger[_0xa474('0x60')](_0xa474('0x6b'),util[_0xa474('0x6c')](_0x17cccd,{'showHidden':!![],'depth':null}));});};exports[_0xa474('0x6d')]=function(_0x4941aa,_0x26326e,_0x2434f8,_0x1fe833,_0x5c96c2,_0xfbbff3){var _0x13988b,_0x56b0d5;_0xfbbff3[_0xa474('0x11')]=intUtil[_0xa474('0x4a')](_0xfbbff3[_0xa474('0x11')]);_0xfbbff3['serverUrl']=intUtil['stripTrailingSlash'](_0xfbbff3[_0xa474('0x4b')]);if(_0x5c96c2&&_0x5c96c2[_0xa474('0x4c')]){logger[_0xa474('0xd')]('['+_0x26326e[_0xa474('0x6e')][_0xa474('0x6f')]()+']',_0xa474('0x4d'));_0x26326e[_0xa474('0x4e')]=util[_0xa474('0xf')](_0xa474('0x70'),_0xfbbff3[_0xa474('0x4b')],_0x26326e[_0xa474('0x4f')],md5(_0x26326e['uniqueid']));}else{_0x26326e[_0xa474('0x4e')]='';}headers[_0xa474('0x50')]=getAuth(_0xfbbff3);return getUser(_0xfbbff3)[_0xa474('0x1a')](function(_0x7a6583){_0x13988b=_0x7a6583;logger[_0xa474('0xd')](_0xa474('0x52'),_0x13988b['id']);return getEndUser(_0xfbbff3,_0x26326e[_0xa474('0x53')],_0x26326e[_0xa474('0x71')]);})[_0xa474('0x1a')](function(_0x3b2310){_0x56b0d5=_0x3b2310;logger[_0xa474('0xd')]('The\x20Enduser\x20ID\x20is:',_0x56b0d5['id']);return getTicket(_0xfbbff3,_0x13988b,_0x56b0d5,_0x2434f8,_0x26326e);})['then'](function(_0x2db759){if(_0x2db759){logger[_0xa474('0xd')](_0xa474('0x54'),_0x2db759['id']);}})[_0xa474('0x62')](function(_0x5ecc6a){logger[_0xa474('0x60')]('['+_0x26326e[_0xa474('0x6e')][_0xa474('0x6f')]()+']'+_0xa474('0x72'),util['inspect'](_0x5ecc6a,{'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 b052da9..0a0e413 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 _0xf4f4=['uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','administrator','Subjects','Description','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','rejected','Rejected','abandoned','Abandoned','Timeout','outbound','agentcalledAt','Call_Type','Inbound','/crm/v2/Calls','code','err','stack','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','unmanaged','toUpperCase','The\x20Call\x20ID\x20is:','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','type','string','idField','content','variableName','toString','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','data','details','Error:\x20','log','CREATE\x20ERROR','contact_lead'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x378841,_0x2998e6){_0x378841=_0x378841-0x0;var _0x192cce=_0xf4f4[_0x378841];return _0x192cce;};'use strict';var _=require(_0x4f4f('0x0'));var rp=require(_0x4f4f('0x1'));var md5=require('md5');var util=require(_0x4f4f('0x2'));var intUtil=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var Redis=require(_0x4f4f('0x5'));var BPromise=require(_0x4f4f('0x6'));var config=require('../../../../config/environment');var logger=require(_0x4f4f('0x7'))('zoho');config[_0x4f4f('0x8')]=_[_0x4f4f('0x9')](config[_0x4f4f('0x8')],{'host':_0x4f4f('0xa'),'port':0x18eb});var io=require(_0x4f4f('0xb'))(new Redis(config[_0x4f4f('0x8')]));function emit(_0x2faba9,_0x3768d7,_0x48f6b9){io['to'](_0x2faba9)[_0x4f4f('0xc')](_0x3768d7,_0x48f6b9);}function request(_0x38d110){logger[_0x4f4f('0xd')](_0x4f4f('0xe'),JSON[_0x4f4f('0xf')](_0x38d110));return rp(_0x38d110);}function getCustomFields(_0x11940f,_0x87a9a2){var _0x7a0036={};if(_0x11940f['length']>0x0){_['forEach'](_0x11940f,function(_0x855e49){if(_0x855e49[_0x4f4f('0x10')]===_0x4f4f('0x11')&&_0x855e49[_0x4f4f('0x12')]){_0x7a0036[_0x855e49[_0x4f4f('0x12')]]=_0x855e49[_0x4f4f('0x13')]['toString']();}else if(_0x855e49[_0x4f4f('0x10')]==='variable'&&_0x855e49[_0x4f4f('0x14')]&&_0x855e49[_0x4f4f('0x12')]&&_0x87a9a2[_0x855e49[_0x4f4f('0x14')]]){_0x7a0036[_0x855e49[_0x4f4f('0x12')]]=_0x87a9a2[_0x855e49['variableName']][_0x4f4f('0x15')]();}else if(_0x855e49['type']==='customVariable'&&_0x855e49['Variable']&&_0x855e49[_0x4f4f('0x16')][_0x4f4f('0x17')]&&_0x855e49[_0x4f4f('0x12')]&&_0x87a9a2[_0x855e49[_0x4f4f('0x16')][_0x4f4f('0x17')][_0x4f4f('0x18')]()]){_0x7a0036[_0x855e49[_0x4f4f('0x12')]]=_0x87a9a2[_0x855e49[_0x4f4f('0x16')][_0x4f4f('0x17')][_0x4f4f('0x18')]()][_0x4f4f('0x15')]();}});}return _0x7a0036;}function getName(_0x43f43b){if(_0x43f43b['indexOf']('\x20')>0x0){var _0x93877a=_0x43f43b[_0x4f4f('0x19')](/ (.+)/);if(_0x93877a[0x1]){return _0x93877a;}}return[_0x43f43b,_0x43f43b];}var accountsTokens={};function getAccessToken(_0x2f84e5){return new Promise(function(_0x201c60,_0x302a79){if(!_[_0x4f4f('0x1a')](accountsTokens[_0x2f84e5['id']])&&!_[_0x4f4f('0x1a')](accountsTokens[_0x2f84e5['id']][_0x4f4f('0x1b')])){if(moment()[_0x4f4f('0x1c')](accountsTokens[_0x2f84e5['id']][_0x4f4f('0x1d')])){_0x201c60(accountsTokens[_0x2f84e5['id']][_0x4f4f('0x1b')]);}}var _0x17832f;switch(_0x2f84e5[_0x4f4f('0x1e')]){case'US':_0x17832f=_0x4f4f('0x1f');break;case'AU':_0x17832f='https://accounts.zoho.com.au';break;case'EU':_0x17832f='https://accounts.zoho.eu';break;case'IN':_0x17832f='https://accounts.zoho.in';break;case'CN':_0x17832f=_0x4f4f('0x20');break;default:_0x17832f=_0x4f4f('0x21');break;}var _0x5186ac={'method':_0x4f4f('0x22'),'uri':_0x17832f+_0x4f4f('0x23'),'qs':{'refresh_token':_0x2f84e5[_0x4f4f('0x24')],'client_id':_0x2f84e5[_0x4f4f('0x25')],'client_secret':_0x2f84e5[_0x4f4f('0x26')],'grant_type':_0x4f4f('0x27')},'json':!![]};return rp(_0x5186ac)[_0x4f4f('0x28')](function(_0x50a8ce){accountsTokens[_0x2f84e5['id']]={'access_token':_0x50a8ce[_0x4f4f('0x1b')],'expires_in':moment()[_0x4f4f('0x29')](_0x50a8ce[_0x4f4f('0x1d')],_0x4f4f('0x2a'))};_0x201c60(_0x50a8ce[_0x4f4f('0x1b')]);})['catch'](function(_0x23df57){logger[_0x4f4f('0x2b')](_0x4f4f('0x2c'),_0x23df57['stack']);_0x302a79(_0x23df57);});});}function getUser(_0x534075,_0x4c2490,_0x73b8bb,_0x5b4f6a){logger[_0x4f4f('0x2d')](_0x4f4f('0x2e'));return request({'method':_0x4f4f('0x2f'),'uri':util['format'](_0x4f4f('0x30'),_0x4c2490),'qs':{'type':_0x4f4f('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x534075},'json':!![]})[_0x4f4f('0x28')](function(_0x1a551a){if(_0x1a551a[_0x4f4f('0x32')]){var _0x5b937e=-0x1;if(_[_0x4f4f('0x33')](_0x1a551a[_0x4f4f('0x32')])){if(!_['isNil'](_0x5b4f6a)){_0x5b937e=_['findIndex'](_0x1a551a[_0x4f4f('0x32')],function(_0x305bf7){return _0x305bf7[_0x4f4f('0x34')]===_0x5b4f6a;});}if(_0x5b937e>=0x0){logger[_0x4f4f('0x2d')](_0x4f4f('0x35'));}else{logger[_0x4f4f('0x2d')](_0x4f4f('0x36'));_0x5b937e=_[_0x4f4f('0x37')](_0x1a551a[_0x4f4f('0x32')],function(_0x36206f){return _0x36206f['profile']['name']===_0x4f4f('0x38');});}return _0x1a551a['users'][_0x5b937e];}else{if(_0x1a551a[_0x4f4f('0x39')][_0x4f4f('0x3a')][_0x4f4f('0x17')]===_0x4f4f('0x38')){logger[_0x4f4f('0x2d')](_0x4f4f('0x36'));user=_0x1a551a[_0x4f4f('0x39')];return user;}else{logger[_0x4f4f('0x2b')](_0x4f4f('0x3b'),JSON[_0x4f4f('0xf')](_0x1a551a));throw new Error(_0x4f4f('0x3c')+JSON[_0x4f4f('0xf')](_0x1a551a));}}}else{logger['error'](_0x4f4f('0x3b'),JSON[_0x4f4f('0xf')](_0x1a551a));throw new Error(_0x4f4f('0x3c')+JSON[_0x4f4f('0xf')](_0x1a551a));}})[_0x4f4f('0x3d')](function(_0x34fe84){console[_0x4f4f('0x2b')](_0x34fe84);});}function getZohoUser(_0x32b077,_0x1d1f4c){return new BPromise(function(_0x510cd3,_0xbd62c5){request(_0x32b077)[_0x4f4f('0x28')](function(_0x2195d7){var _0x5eb174=null;if(_0x2195d7){_0x5eb174=_0x2195d7['data'][0x0];_0x5eb174[_0x4f4f('0x3e')]=_0x1d1f4c;}_0x510cd3(_0x5eb174);})[_0x4f4f('0x3d')](function(_0x3bb91c){_0xbd62c5(_0x3bb91c);});});}function createEndUser(_0x1fd3d9,_0x1fe5ee,_0xd7bbf4,_0x1c012d,_0x1ff7f3,_0x2eb6c8){var _0xd7bbf4=getName(_0xd7bbf4);return request({'method':_0x4f4f('0x22'),'uri':_0x4f4f('0x3f')+_0x1fe5ee+'/crm/v2/'+_[_0x4f4f('0x40')](_0x2eb6c8[_0x4f4f('0x41')])+'s','body':{'data':[{'Last_Name':_0xd7bbf4[0x1],'First_Name':_0xd7bbf4[0x0],'Phone':_0x1c012d,'Owner':{'name':!_[_0x4f4f('0x1a')](_0x1ff7f3[_0x4f4f('0x42')][_0x4f4f('0x17')])?_0x1ff7f3['role']['name']:!_[_0x4f4f('0x1a')](_0x1ff7f3[_0x4f4f('0x43')])?_0x1ff7f3[_0x4f4f('0x43')]+'\x20'+_0x1ff7f3[_0x4f4f('0x44')]:_0x1ff7f3['last_name'],'id':_0x1ff7f3['id']}}]},'headers':{'Authorization':_0x4f4f('0x45')+_0x1fd3d9},'json':!![]})['then'](function(_0x10de24){if(_0x10de24&&_0x10de24['data'][0x0]['code']===_0x4f4f('0x46')){var _0x4f3a0f=_0x10de24[_0x4f4f('0x47')][0x0][_0x4f4f('0x48')];_0x4f3a0f['enduserType']=_[_0x4f4f('0x40')](_0x2eb6c8[_0x4f4f('0x41')])+'s';return _0x4f3a0f;}logger['error'](_0x4f4f('0x3b'),JSON[_0x4f4f('0xf')](data));throw new Error(_0x4f4f('0x49')+JSON[_0x4f4f('0xf')](data));})[_0x4f4f('0x3d')](function(_0x62b468){console[_0x4f4f('0x4a')](_0x4f4f('0x4b'),_0x62b468);});}function getEndUser(_0x1572b3,_0x1c029a,_0x475969,_0x3a8427,_0x1a2330,_0x416579,_0x299994){var _0x5701e6={'method':_0x4f4f('0x2f'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1572b3},'json':!![]};switch(_0x299994['moduleSearch']){case _0x4f4f('0x4c'):_0x5701e6[_0x4f4f('0x4d')]='https://www.zohoapis.'+_0x1c029a+_0x4f4f('0x4e')+_0x1a2330+'))';return getZohoUser(_0x5701e6,_0x4f4f('0x4f'))[_0x4f4f('0x28')](function(_0x2721b5){if(_0x2721b5)return _0x2721b5;_0x5701e6[_0x4f4f('0x4d')]='https://www.zohoapis.'+_0x1c029a+_0x4f4f('0x50')+_0x1a2330+'))';return getZohoUser(_0x5701e6,_0x4f4f('0x51'))[_0x4f4f('0x28')](function(_0x33cee3){if(_0x33cee3)return _0x33cee3;if(_0x299994[_0x4f4f('0x41')]!=_0x4f4f('0x52')){return createEndUser(_0x1572b3,_0x1c029a,_0x3a8427,_0x1a2330,_0x416579,_0x299994);}else{return{};}});});break;case _0x4f4f('0x53'):_0x5701e6[_0x4f4f('0x4d')]=_0x4f4f('0x3f')+_0x1c029a+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1a2330+'))';return getZohoUser(_0x5701e6,_0x4f4f('0x4f'))[_0x4f4f('0x28')](function(_0x4b33a5){if(_0x4b33a5)return _0x4b33a5;if(_0x299994['moduleCreate']!='nothing'){return createEndUser(_0x1572b3,_0x1c029a,_0x3a8427,_0x1a2330,_0x416579,_0x299994);}else{return{};}});break;case _0x4f4f('0x54'):_0x5701e6[_0x4f4f('0x4d')]=_0x4f4f('0x3f')+_0x1c029a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1a2330+'))';return getZohoUser(_0x5701e6,_0x4f4f('0x51'))['then'](function(_0xf13a0){if(_0xf13a0)return _0xf13a0;if(_0x299994[_0x4f4f('0x41')]!=_0x4f4f('0x52')){return createEndUser(_0x1572b3,_0x1c029a,_0x3a8427,_0x1a2330,_0x416579,_0x299994);}else{return{};}});break;}}function getCall(_0x15af98,_0xe03548,_0x1d0867,_0x21408b,_0x88054a,_0x17f6fb,_0x4dbce2,_0x59e207){logger[_0x4f4f('0x2d')](_0x4f4f('0x55'));var _0x4c04eb={};_0x4c04eb['Owner']={'name':!_[_0x4f4f('0x1a')](_0x21408b[_0x4f4f('0x42')][_0x4f4f('0x17')])&&!_['isNil'](_0x21408b['profile'][_0x4f4f('0x17')])&&_0x21408b[_0x4f4f('0x3a')][_0x4f4f('0x17')]===_0x4f4f('0x56')?_0x21408b[_0x4f4f('0x42')][_0x4f4f('0x17')]:!_[_0x4f4f('0x1a')](_0x21408b[_0x4f4f('0x43')])?_0x21408b[_0x4f4f('0x43')]+'\x20'+_0x21408b[_0x4f4f('0x44')]:_0x21408b[_0x4f4f('0x44')],'id':_0x21408b['id']};_0x4c04eb['Subject']=intUtil['getString'](_0x17f6fb[_0x4f4f('0x57')],_0x4dbce2,'\x20');_0x4c04eb[_0x4f4f('0x58')]=intUtil[_0x4f4f('0x59')](_0x17f6fb[_0x4f4f('0x5a')],_0x4dbce2,'\x0a');if(_0x88054a['enduserType']===_0x4f4f('0x4f')){_0x4c04eb['Who_Id']={'name':!_[_0x4f4f('0x1a')](_0x88054a[_0x4f4f('0x5b')])?_0x88054a[_0x4f4f('0x5b')]:!_['isNil'](_0x88054a[_0x4f4f('0x5c')])?_0x88054a[_0x4f4f('0x5c')]+'\x20'+_0x88054a[_0x4f4f('0x5d')]:_0x88054a['Last_Name'],'id':_0x88054a['id']};}if(_0x88054a[_0x4f4f('0x3e')]===_0x4f4f('0x51')){_0x4c04eb[_0x4f4f('0x5e')]={'name':!_['isNil'](_0x88054a[_0x4f4f('0x5b')])?_0x88054a[_0x4f4f('0x5b')]:!_[_0x4f4f('0x1a')](_0x88054a['First_Name'])?_0x88054a[_0x4f4f('0x5c')]+'\x20'+_0x88054a['Last_Name']:_0x88054a[_0x4f4f('0x5d')],'id':_0x88054a['id']};_0x4c04eb[_0x4f4f('0x5f')]=_[_0x4f4f('0x40')](_0x88054a[_0x4f4f('0x3e')]);}if(_0x4dbce2[_0x4f4f('0x60')]){_0x4c04eb[_0x4f4f('0x61')]=moment[_0x4f4f('0x62')](parseInt(_0x4dbce2[_0x4f4f('0x60')])*0x3e8)[_0x4f4f('0x63')](_0x4f4f('0x64'));}else if(_0x4dbce2[_0x4f4f('0x65')]&&_0x4dbce2['endtime']){_0x4c04eb[_0x4f4f('0x61')]=moment[_0x4f4f('0x62')](moment(_0x4dbce2[_0x4f4f('0x66')],'YYYY-MM-DDTHH:mm:ss')[_0x4f4f('0x67')](moment(_0x4dbce2[_0x4f4f('0x68')],_0x4f4f('0x69'))))[_0x4f4f('0x63')]('mm:ss');}switch(_0x4dbce2[_0x4f4f('0x6a')]){case _0x4f4f('0x6b'):_0x4c04eb[_0x4f4f('0x6c')]=_0x4f4f('0x6d');break;case _0x4f4f('0x6e'):case'connect':_0x4c04eb[_0x4f4f('0x6c')]='Answered';break;case _0x4f4f('0x6f'):_0x4c04eb[_0x4f4f('0x6c')]=_0x4f4f('0x70');break;case _0x4f4f('0x71'):_0x4c04eb[_0x4f4f('0x6c')]=_0x4f4f('0x72');break;case'timeout':_0x4c04eb['Call_Result']=_0x4f4f('0x73');default:}_0x4c04eb['Call_Start_Time']=(_0x59e207===_0x4f4f('0x74')?moment(_0x4dbce2[_0x4f4f('0x68')])[_0x4f4f('0x63')](_0x4f4f('0x69')):moment(_0x4dbce2[_0x4f4f('0x75')])[_0x4f4f('0x63')](_0x4f4f('0x69')))||moment()[_0x4f4f('0x63')](_0x4f4f('0x69'));_0x4c04eb[_0x4f4f('0x76')]=_0x59e207||_0x4f4f('0x77');_0x4c04eb=_['merge'](_0x4c04eb,getCustomFields(_0x17f6fb['Fields'],_0x4dbce2));return request({'method':'POST','uri':_0x4f4f('0x3f')+_0xe03548+_0x4f4f('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x15af98},'body':{'data':[_0x4c04eb]},'json':!![]})[_0x4f4f('0x28')](function(_0x3dfcdb){if(_0x3dfcdb&&_0x3dfcdb[_0x4f4f('0x47')][0x0][_0x4f4f('0x79')]===_0x4f4f('0x46')){logger[_0x4f4f('0x2d')]('Call\x20created!');return{'id':_0x3dfcdb[_0x4f4f('0x47')][0x0][_0x4f4f('0x48')]['id']};}})[_0x4f4f('0x3d')](function(_0x24ed71){logger[_0x4f4f('0x2d')](_0x4f4f('0x7a'),_0x24ed71[_0x4f4f('0x7b')]);console[_0x4f4f('0x4a')]('err',_0x24ed71);});}exports[_0x4f4f('0x7c')]=function(_0x297b40,_0x3c9a28,_0x38232d,_0x5f0efc,_0x627a24,_0x4a3b82){var _0xa772df,_0x5419af,_0x57ee5b;_0x4a3b82[_0x4f4f('0x7d')]=intUtil[_0x4f4f('0x7e')](_0x4a3b82[_0x4f4f('0x7d')]);_0x4a3b82[_0x4f4f('0x7f')]=intUtil['stripTrailingSlash'](_0x4a3b82[_0x4f4f('0x7f')]);if(_0x627a24&&_0x627a24['monitor_format']){logger[_0x4f4f('0x2d')]('[QUEUE]',_0x4f4f('0x80'));_0x3c9a28[_0x4f4f('0x81')]=_0x4a3b82[_0x4f4f('0x7f')]+'/api/voice/recordings/'+_0x3c9a28[_0x4f4f('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x3c9a28[_0x4f4f('0x82')]);}else{_0x3c9a28[_0x4f4f('0x81')]='';}var _0x40000d=_0x4a3b82[_0x4f4f('0x7d')]===_0x4f4f('0x83')?'eu':_0x4f4f('0x84');return getAccessToken(_0x4a3b82)[_0x4f4f('0x28')](function(_0x21d12f){_0x57ee5b=_0x21d12f;return getUser(_0x57ee5b,_0x40000d,_0x4a3b82,_0x5f0efc[_0x4f4f('0x34')]);})['then'](function(_0x6e7ab6){_0xa772df=_0x6e7ab6;logger[_0x4f4f('0x2d')](_0x4f4f('0x85'),_0xa772df['id']);return getEndUser(_0x57ee5b,_0x40000d,_0x4a3b82,_0x3c9a28[_0x4f4f('0x86')],_0x3c9a28[_0x4f4f('0x87')],_0xa772df,_0x38232d);})[_0x4f4f('0x28')](function(_0x53f496){_0x5419af=_0x53f496;return getCall(_0x57ee5b,_0x40000d,_0x4a3b82,_0xa772df,_0x5419af,_0x38232d,_0x3c9a28,_0x4f4f('0x77'));})[_0x4f4f('0x28')](function(_0x23b75d){if(_0x23b75d){logger[_0x4f4f('0x2d')]('The\x20Call\x20ID\x20is:',_0x23b75d['id']);logger[_0x4f4f('0x2d')](_0x4f4f('0x88'),_0x4f4f('0x89'));emit(util['format'](_0x4f4f('0x8a'),_0x5f0efc[_0x4f4f('0x17')]),'trigger:browser:url',{'uri':_0x4f4f('0x8b')+_0x4a3b82[_0x4f4f('0x7d')]+_0x4f4f('0x8c')+_0x23b75d['id']});}})[_0x4f4f('0x3d')](function(_0x1ff1fa){logger[_0x4f4f('0x2b')]('[QUEUE]',JSON[_0x4f4f('0xf')](_0x1ff1fa));});};exports[_0x4f4f('0x74')]=function(_0x28a6cd,_0x176ad2,_0x476403,_0x1a3379,_0x5b6633,_0x38ed6b,_0x70e457){var _0x42c5fb,_0x49b86a,_0x3e46a0;_0x38ed6b[_0x4f4f('0x7d')]=intUtil[_0x4f4f('0x7e')](_0x38ed6b[_0x4f4f('0x7d')]);_0x38ed6b[_0x4f4f('0x7f')]=intUtil['stripTrailingSlash'](_0x38ed6b[_0x4f4f('0x7f')]);if(_0x70e457&&_0x70e457['recordingFormat']&&_0x70e457['recordingFormat']!==_0x4f4f('0x8d')){logger[_0x4f4f('0x2d')](_0x4f4f('0x8e'),_0x4f4f('0x80'));_0x176ad2[_0x4f4f('0x81')]=_0x38ed6b[_0x4f4f('0x7f')]+_0x4f4f('0x8f')+_0x176ad2[_0x4f4f('0x82')]+_0x4f4f('0x90')+md5(_0x176ad2['uniqueid']);}var _0x1104b4=_0x38ed6b['host']===_0x4f4f('0x83')?'eu':_0x4f4f('0x84');return getAccessToken(_0x38ed6b)['then'](function(_0x3286b1){_0x3e46a0=_0x3286b1;return getUser(_0x3e46a0,_0x1104b4,_0x38ed6b,_0x1a3379[_0x4f4f('0x34')]);})[_0x4f4f('0x28')](function(_0xc199ac){_0x42c5fb=_0xc199ac;logger[_0x4f4f('0x2d')](_0x4f4f('0x85'),_0x42c5fb['id']);return getEndUser(_0x3e46a0,_0x1104b4,_0x38ed6b,_0x176ad2[_0x4f4f('0x91')],_0x176ad2[_0x4f4f('0x92')],_0x42c5fb,_0x476403);})['then'](function(_0x176eae){_0x49b86a=_0x176eae;return getCall(_0x3e46a0,_0x1104b4,_0x38ed6b,_0x42c5fb,_0x49b86a,_0x476403,_0x176ad2,_0x4f4f('0x93'));})[_0x4f4f('0x28')](function(_0x55ec65){if(_0x55ec65){logger[_0x4f4f('0x2d')]('The\x20Call\x20ID\x20is:',_0x55ec65['id']);logger['info'](_0x4f4f('0x8e'),_0x4f4f('0x89'));emit(util[_0x4f4f('0x63')](_0x4f4f('0x8a'),_0x1a3379['name']),_0x4f4f('0x94'),{'uri':'https://crm.'+_0x38ed6b[_0x4f4f('0x7d')]+_0x4f4f('0x8c')+_0x55ec65['id']});}})[_0x4f4f('0x3d')](function(_0x2511be){logger[_0x4f4f('0x2b')](_0x4f4f('0x8e'),JSON[_0x4f4f('0xf')](_0x2511be));});};exports[_0x4f4f('0x95')]=function(_0x30d901,_0x53cc6c,_0x596846,_0x592a26,_0x1769bb,_0x3b6ca5){var _0xbc7b5c,_0x49c6a5,_0x515d05;_0x3b6ca5['host']=intUtil[_0x4f4f('0x7e')](_0x3b6ca5[_0x4f4f('0x7d')]);_0x3b6ca5[_0x4f4f('0x7f')]=intUtil[_0x4f4f('0x7e')](_0x3b6ca5[_0x4f4f('0x7f')]);if(_0x1769bb&&_0x1769bb['monitor_format']){logger[_0x4f4f('0x2d')]('['+_0x53cc6c[_0x4f4f('0x6a')][_0x4f4f('0x96')]()+']',_0x4f4f('0x80'));_0x53cc6c[_0x4f4f('0x81')]=_0x3b6ca5['serverUrl']+_0x4f4f('0x8f')+_0x53cc6c['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x53cc6c[_0x4f4f('0x82')]);}else{_0x53cc6c[_0x4f4f('0x81')]='';}var _0x2a8331=_0x3b6ca5['host']===_0x4f4f('0x83')?'eu':_0x4f4f('0x84');return getAccessToken(_0x3b6ca5)['then'](function(_0x32a5e2){_0x515d05=_0x32a5e2;return getUser(_0x515d05,_0x2a8331,_0x3b6ca5);})[_0x4f4f('0x28')](function(_0x5554a4){_0xbc7b5c=_0x5554a4;logger[_0x4f4f('0x2d')](_0x4f4f('0x85'),_0xbc7b5c['id']);return getEndUser(_0x515d05,_0x2a8331,_0x3b6ca5,_0x53cc6c[_0x4f4f('0x86')],_0x53cc6c[_0x4f4f('0x87')],_0xbc7b5c,_0x596846);})[_0x4f4f('0x28')](function(_0x6ec076){_0x49c6a5=_0x6ec076;return getCall(_0x515d05,_0x2a8331,_0x3b6ca5,_0xbc7b5c,_0x49c6a5,_0x596846,_0x53cc6c,'Inbound');})[_0x4f4f('0x28')](function(_0x27044f){if(_0x27044f){logger[_0x4f4f('0x2d')](_0x4f4f('0x97'),_0x27044f['id']);}})[_0x4f4f('0x3d')](function(_0x3d0e57){logger[_0x4f4f('0x2b')]('['+_0x53cc6c[_0x4f4f('0x6a')][_0x4f4f('0x96')]()+']',JSON[_0x4f4f('0xf')](_0x3d0e57));});}; \ No newline at end of file +var _0xefb3=['Leads','What_Id','talktime','Call_Duration','answertime','utc','endtime','diff','YYYY-MM-DDTHH:mm:ss','mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','unmanaged','toUpperCase','util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','forEach','type','string','content','toString','variable','variableName','idField','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','refreshToken','clientSecret','then','add','catch','error','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','Using\x20the\x20admin\x20account!','findIndex','Administrator','profile','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','data','code','SUCCESS','details','Error:\x20','log','Zoho-oauthtoken\x20','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name'];(function(_0x39ec42,_0x1559fb){var _0xbfc58e=function(_0x4cc7f3){while(--_0x4cc7f3){_0x39ec42['push'](_0x39ec42['shift']());}};_0xbfc58e(++_0x1559fb);}(_0xefb3,0x167));var _0x3efb=function(_0x37d0f3,_0x567bac){_0x37d0f3=_0x37d0f3-0x0;var _0x5116b1=_0xefb3[_0x37d0f3];return _0x5116b1;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x3efb('0x0'));var intUtil=require('./util');var moment=require(_0x3efb('0x1'));var Redis=require(_0x3efb('0x2'));var BPromise=require('bluebird');var config=require(_0x3efb('0x3'));var logger=require(_0x3efb('0x4'))(_0x3efb('0x5'));config[_0x3efb('0x6')]=_[_0x3efb('0x7')](config[_0x3efb('0x6')],{'host':_0x3efb('0x8'),'port':0x18eb});var io=require(_0x3efb('0x9'))(new Redis(config['redis']));function emit(_0x2b07a6,_0x32d55b,_0x4c354b){io['to'](_0x2b07a6)[_0x3efb('0xa')](_0x32d55b,_0x4c354b);}function request(_0x4b31a3){logger[_0x3efb('0xb')]('[HTTP]',JSON[_0x3efb('0xc')](_0x4b31a3));return rp(_0x4b31a3);}function getCustomFields(_0x53b410,_0x6c62eb){var _0x204f06={};if(_0x53b410[_0x3efb('0xd')]>0x0){_[_0x3efb('0xe')](_0x53b410,function(_0x5a8506){if(_0x5a8506[_0x3efb('0xf')]===_0x3efb('0x10')&&_0x5a8506['idField']){_0x204f06[_0x5a8506['idField']]=_0x5a8506[_0x3efb('0x11')][_0x3efb('0x12')]();}else if(_0x5a8506[_0x3efb('0xf')]===_0x3efb('0x13')&&_0x5a8506[_0x3efb('0x14')]&&_0x5a8506[_0x3efb('0x15')]&&_0x6c62eb[_0x5a8506['variableName']]){_0x204f06[_0x5a8506[_0x3efb('0x15')]]=_0x6c62eb[_0x5a8506[_0x3efb('0x14')]][_0x3efb('0x12')]();}else if(_0x5a8506[_0x3efb('0xf')]===_0x3efb('0x16')&&_0x5a8506['Variable']&&_0x5a8506[_0x3efb('0x17')][_0x3efb('0x18')]&&_0x5a8506[_0x3efb('0x15')]&&_0x6c62eb[_0x5a8506[_0x3efb('0x17')][_0x3efb('0x18')][_0x3efb('0x19')]()]){_0x204f06[_0x5a8506['idField']]=_0x6c62eb[_0x5a8506[_0x3efb('0x17')][_0x3efb('0x18')][_0x3efb('0x19')]()][_0x3efb('0x12')]();}});}return _0x204f06;}function getName(_0x53e079){if(_0x53e079[_0x3efb('0x1a')]('\x20')>0x0){var _0x40dd0e=_0x53e079[_0x3efb('0x1b')](/ (.+)/);if(_0x40dd0e[0x1]){return _0x40dd0e;}}return[_0x53e079,_0x53e079];}var accountsTokens={};function getAccessToken(_0x3743b6){return new Promise(function(_0x2a063e,_0x3de27b){if(!_[_0x3efb('0x1c')](accountsTokens[_0x3743b6['id']])&&!_[_0x3efb('0x1c')](accountsTokens[_0x3743b6['id']]['access_token'])){if(moment()[_0x3efb('0x1d')](accountsTokens[_0x3743b6['id']][_0x3efb('0x1e')])){_0x2a063e(accountsTokens[_0x3743b6['id']][_0x3efb('0x1f')]);}}var _0x3c56d0;switch(_0x3743b6[_0x3efb('0x20')]){case'US':_0x3c56d0=_0x3efb('0x21');break;case'AU':_0x3c56d0=_0x3efb('0x22');break;case'EU':_0x3c56d0='https://accounts.zoho.eu';break;case'IN':_0x3c56d0=_0x3efb('0x23');break;case'CN':_0x3c56d0=_0x3efb('0x24');break;default:_0x3c56d0=_0x3efb('0x25');break;}var _0x59ceec={'method':'POST','uri':_0x3c56d0+'/oauth/v2/token','qs':{'refresh_token':_0x3743b6[_0x3efb('0x26')],'client_id':_0x3743b6['clientId'],'client_secret':_0x3743b6[_0x3efb('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x59ceec)[_0x3efb('0x28')](function(_0x332ad9){accountsTokens[_0x3743b6['id']]={'access_token':_0x332ad9[_0x3efb('0x1f')],'expires_in':moment()[_0x3efb('0x29')](_0x332ad9[_0x3efb('0x1e')],'seconds')};_0x2a063e(_0x332ad9[_0x3efb('0x1f')]);})[_0x3efb('0x2a')](function(_0x2d9850){logger[_0x3efb('0x2b')]('Failing\x20creating\x20the\x20access_token',_0x2d9850[_0x3efb('0x2c')]);_0x3de27b(_0x2d9850);});});}function getUser(_0x4613d0,_0x369acc,_0x29cea8,_0x4592c4){logger[_0x3efb('0x2d')](_0x3efb('0x2e'));return request({'method':'GET','uri':util[_0x3efb('0x2f')](_0x3efb('0x30'),_0x369acc),'qs':{'type':_0x3efb('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4613d0},'json':!![]})[_0x3efb('0x28')](function(_0x17a9a2){if(_0x17a9a2[_0x3efb('0x32')]){var _0x437872=-0x1;if(_[_0x3efb('0x33')](_0x17a9a2[_0x3efb('0x32')])){if(!_[_0x3efb('0x1c')](_0x4592c4)){_0x437872=_['findIndex'](_0x17a9a2['users'],function(_0x5762cd){return _0x5762cd['email']===_0x4592c4;});}if(_0x437872>=0x0){logger[_0x3efb('0x2d')]('Agent\x20found!');}else{logger['info'](_0x3efb('0x34'));_0x437872=_[_0x3efb('0x35')](_0x17a9a2[_0x3efb('0x32')],function(_0x514fe8){return _0x514fe8['profile'][_0x3efb('0x18')]===_0x3efb('0x36');});}return _0x17a9a2[_0x3efb('0x32')][_0x437872];}else{if(_0x17a9a2['user'][_0x3efb('0x37')][_0x3efb('0x18')]===_0x3efb('0x36')){logger['info'](_0x3efb('0x34'));user=_0x17a9a2['user'];return user;}else{logger[_0x3efb('0x2b')]('The\x20failing\x20result\x20is',JSON[_0x3efb('0xc')](_0x17a9a2));throw new Error(_0x3efb('0x38')+JSON[_0x3efb('0xc')](_0x17a9a2));}}}else{logger[_0x3efb('0x2b')](_0x3efb('0x39'),JSON[_0x3efb('0xc')](_0x17a9a2));throw new Error(_0x3efb('0x38')+JSON[_0x3efb('0xc')](_0x17a9a2));}})[_0x3efb('0x2a')](function(_0x33b9ba){console['error'](_0x33b9ba);});}function getZohoUser(_0x417380,_0x265d28){return new BPromise(function(_0x420940,_0x470f7b){request(_0x417380)[_0x3efb('0x28')](function(_0x426ff8){var _0x257c5b=null;if(_0x426ff8){_0x257c5b=_0x426ff8['data'][0x0];_0x257c5b[_0x3efb('0x3a')]=_0x265d28;}_0x420940(_0x257c5b);})[_0x3efb('0x2a')](function(_0x30ecb5){_0x470f7b(_0x30ecb5);});});}function createEndUser(_0x386064,_0x43516d,_0x1ca108,_0xb6102e,_0x3f0e32,_0x32883d){var _0x1ca108=getName(_0x1ca108);return request({'method':_0x3efb('0x3b'),'uri':_0x3efb('0x3c')+_0x43516d+_0x3efb('0x3d')+_[_0x3efb('0x3e')](_0x32883d[_0x3efb('0x3f')])+'s','body':{'data':[{'Last_Name':_0x1ca108[0x1],'First_Name':_0x1ca108[0x0],'Phone':_0xb6102e,'Owner':{'name':!_[_0x3efb('0x1c')](_0x3f0e32[_0x3efb('0x40')][_0x3efb('0x18')])?_0x3f0e32[_0x3efb('0x40')][_0x3efb('0x18')]:!_[_0x3efb('0x1c')](_0x3f0e32[_0x3efb('0x41')])?_0x3f0e32[_0x3efb('0x41')]+'\x20'+_0x3f0e32[_0x3efb('0x42')]:_0x3f0e32['last_name'],'id':_0x3f0e32['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x386064},'json':!![]})[_0x3efb('0x28')](function(_0x510da0){if(_0x510da0&&_0x510da0[_0x3efb('0x43')][0x0][_0x3efb('0x44')]===_0x3efb('0x45')){var _0x47f7f2=_0x510da0['data'][0x0][_0x3efb('0x46')];_0x47f7f2[_0x3efb('0x3a')]=_[_0x3efb('0x3e')](_0x32883d['moduleCreate'])+'s';return _0x47f7f2;}logger['error'](_0x3efb('0x39'),JSON['stringify'](data));throw new Error(_0x3efb('0x47')+JSON[_0x3efb('0xc')](data));})[_0x3efb('0x2a')](function(_0x4e88e2){console[_0x3efb('0x48')]('CREATE\x20ERROR',_0x4e88e2);});}function getEndUser(_0x8bc711,_0x13845d,_0x55460a,_0x1e465a,_0x3154da,_0x5ce575,_0x5d61a6){var _0x2efa46={'method':'GET','uri':'','headers':{'Authorization':_0x3efb('0x49')+_0x8bc711},'json':!![]};switch(_0x5d61a6['moduleSearch']){case'contact_lead':_0x2efa46[_0x3efb('0x4a')]='https://www.zohoapis.'+_0x13845d+_0x3efb('0x4b')+_0x3154da+'))';return getZohoUser(_0x2efa46,_0x3efb('0x4c'))[_0x3efb('0x28')](function(_0x166464){if(_0x166464)return _0x166464;_0x2efa46[_0x3efb('0x4a')]='https://www.zohoapis.'+_0x13845d+_0x3efb('0x4d')+_0x3154da+'))';return getZohoUser(_0x2efa46,'Leads')['then'](function(_0x450e5e){if(_0x450e5e)return _0x450e5e;if(_0x5d61a6[_0x3efb('0x3f')]!=_0x3efb('0x4e')){return createEndUser(_0x8bc711,_0x13845d,_0x1e465a,_0x3154da,_0x5ce575,_0x5d61a6);}else{return{};}});});break;case _0x3efb('0x4f'):_0x2efa46['uri']=_0x3efb('0x3c')+_0x13845d+_0x3efb('0x4b')+_0x3154da+'))';return getZohoUser(_0x2efa46,_0x3efb('0x4c'))['then'](function(_0x595b8b){if(_0x595b8b)return _0x595b8b;if(_0x5d61a6[_0x3efb('0x3f')]!=_0x3efb('0x4e')){return createEndUser(_0x8bc711,_0x13845d,_0x1e465a,_0x3154da,_0x5ce575,_0x5d61a6);}else{return{};}});break;case'lead':_0x2efa46['uri']='https://www.zohoapis.'+_0x13845d+_0x3efb('0x4d')+_0x3154da+'))';return getZohoUser(_0x2efa46,'Leads')[_0x3efb('0x28')](function(_0x794535){if(_0x794535)return _0x794535;if(_0x5d61a6[_0x3efb('0x3f')]!=_0x3efb('0x4e')){return createEndUser(_0x8bc711,_0x13845d,_0x1e465a,_0x3154da,_0x5ce575,_0x5d61a6);}else{return{};}});break;}}function getCall(_0x33da1c,_0x175460,_0x59b963,_0x16dee3,_0x3b6165,_0x1d013d,_0x1befd9,_0x562c33){logger['info']('Creating\x20new\x20call...');var _0x1c84b6={};_0x1c84b6[_0x3efb('0x50')]={'name':!_[_0x3efb('0x1c')](_0x16dee3['role'][_0x3efb('0x18')])&&!_[_0x3efb('0x1c')](_0x16dee3[_0x3efb('0x37')][_0x3efb('0x18')])&&_0x16dee3[_0x3efb('0x37')]['name']===_0x3efb('0x51')?_0x16dee3[_0x3efb('0x40')]['name']:!_['isNil'](_0x16dee3[_0x3efb('0x41')])?_0x16dee3[_0x3efb('0x41')]+'\x20'+_0x16dee3[_0x3efb('0x42')]:_0x16dee3[_0x3efb('0x42')],'id':_0x16dee3['id']};_0x1c84b6[_0x3efb('0x52')]=intUtil['getString'](_0x1d013d[_0x3efb('0x53')],_0x1befd9,'\x20');_0x1c84b6[_0x3efb('0x54')]=intUtil[_0x3efb('0x55')](_0x1d013d[_0x3efb('0x56')],_0x1befd9,'\x0a');if(_0x3b6165['enduserType']===_0x3efb('0x4c')){_0x1c84b6[_0x3efb('0x57')]={'name':!_[_0x3efb('0x1c')](_0x3b6165[_0x3efb('0x58')])?_0x3b6165['Full_Name']:!_[_0x3efb('0x1c')](_0x3b6165[_0x3efb('0x59')])?_0x3b6165[_0x3efb('0x59')]+'\x20'+_0x3b6165['Last_Name']:_0x3b6165[_0x3efb('0x5a')],'id':_0x3b6165['id']};}if(_0x3b6165[_0x3efb('0x3a')]===_0x3efb('0x5b')){_0x1c84b6[_0x3efb('0x5c')]={'name':!_[_0x3efb('0x1c')](_0x3b6165[_0x3efb('0x58')])?_0x3b6165[_0x3efb('0x58')]:!_[_0x3efb('0x1c')](_0x3b6165[_0x3efb('0x59')])?_0x3b6165['First_Name']+'\x20'+_0x3b6165['Last_Name']:_0x3b6165[_0x3efb('0x5a')],'id':_0x3b6165['id']};_0x1c84b6['$se_module']=_[_0x3efb('0x3e')](_0x3b6165[_0x3efb('0x3a')]);}if(_0x1befd9[_0x3efb('0x5d')]){_0x1c84b6[_0x3efb('0x5e')]=moment['utc'](parseInt(_0x1befd9[_0x3efb('0x5d')])*0x3e8)[_0x3efb('0x2f')]('mm:ss');}else if(_0x1befd9[_0x3efb('0x5f')]&&_0x1befd9['endtime']){_0x1c84b6[_0x3efb('0x5e')]=moment[_0x3efb('0x60')](moment(_0x1befd9[_0x3efb('0x61')],'YYYY-MM-DDTHH:mm:ss')[_0x3efb('0x62')](moment(_0x1befd9['starttime'],_0x3efb('0x63'))))[_0x3efb('0x2f')](_0x3efb('0x64'));}switch(_0x1befd9[_0x3efb('0x65')]){case _0x3efb('0x66'):_0x1c84b6[_0x3efb('0x67')]=_0x3efb('0x68');break;case _0x3efb('0x69'):case _0x3efb('0x6a'):_0x1c84b6[_0x3efb('0x67')]='Answered';break;case _0x3efb('0x6b'):_0x1c84b6[_0x3efb('0x67')]=_0x3efb('0x6c');break;case _0x3efb('0x6d'):_0x1c84b6[_0x3efb('0x67')]=_0x3efb('0x6e');break;case _0x3efb('0x6f'):_0x1c84b6[_0x3efb('0x67')]=_0x3efb('0x70');default:}_0x1c84b6[_0x3efb('0x71')]=(_0x562c33===_0x3efb('0x72')?moment(_0x1befd9[_0x3efb('0x73')])[_0x3efb('0x2f')](_0x3efb('0x63')):moment(_0x1befd9[_0x3efb('0x74')])[_0x3efb('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3efb('0x2f')]('YYYY-MM-DDTHH:mm:ss');_0x1c84b6[_0x3efb('0x75')]=_0x562c33||_0x3efb('0x76');_0x1c84b6=_[_0x3efb('0x77')](_0x1c84b6,getCustomFields(_0x1d013d['Fields'],_0x1befd9));return request({'method':_0x3efb('0x3b'),'uri':'https://www.zohoapis.'+_0x175460+_0x3efb('0x78'),'headers':{'Authorization':_0x3efb('0x49')+_0x33da1c},'body':{'data':[_0x1c84b6]},'json':!![]})[_0x3efb('0x28')](function(_0x3883cb){if(_0x3883cb&&_0x3883cb[_0x3efb('0x43')][0x0][_0x3efb('0x44')]==='SUCCESS'){logger[_0x3efb('0x2d')]('Call\x20created!');return{'id':_0x3883cb['data'][0x0][_0x3efb('0x46')]['id']};}})[_0x3efb('0x2a')](function(_0x42c420){logger[_0x3efb('0x2d')](_0x3efb('0x79'),_0x42c420[_0x3efb('0x2c')]);console[_0x3efb('0x48')]('err',_0x42c420);});}exports[_0x3efb('0x7a')]=function(_0x24ad68,_0x5177f9,_0x24c274,_0x6800a1,_0x438745,_0x455d04){var _0x40e803,_0x30bb9f,_0x34eab8;_0x455d04[_0x3efb('0x7b')]=intUtil[_0x3efb('0x7c')](_0x455d04[_0x3efb('0x7b')]);_0x455d04[_0x3efb('0x7d')]=intUtil['stripTrailingSlash'](_0x455d04[_0x3efb('0x7d')]);if(_0x438745&&_0x438745[_0x3efb('0x7e')]){logger['info'](_0x3efb('0x7f'),'Recording\x20is\x20enabled!');_0x5177f9['recordingURL']=_0x455d04[_0x3efb('0x7d')]+_0x3efb('0x80')+_0x5177f9[_0x3efb('0x81')]+_0x3efb('0x82')+md5(_0x5177f9[_0x3efb('0x81')]);}else{_0x5177f9[_0x3efb('0x83')]='';}var _0x34ec49=_0x455d04[_0x3efb('0x7b')]===_0x3efb('0x84')?'eu':_0x3efb('0x85');return getAccessToken(_0x455d04)[_0x3efb('0x28')](function(_0x155195){_0x34eab8=_0x155195;return getUser(_0x34eab8,_0x34ec49,_0x455d04,_0x6800a1['email']);})['then'](function(_0x1975ea){_0x40e803=_0x1975ea;logger['info'](_0x3efb('0x86'),_0x40e803['id']);return getEndUser(_0x34eab8,_0x34ec49,_0x455d04,_0x5177f9[_0x3efb('0x87')],_0x5177f9[_0x3efb('0x88')],_0x40e803,_0x24c274);})[_0x3efb('0x28')](function(_0x433363){_0x30bb9f=_0x433363;return getCall(_0x34eab8,_0x34ec49,_0x455d04,_0x40e803,_0x30bb9f,_0x24c274,_0x5177f9,_0x3efb('0x76'));})['then'](function(_0x511695){if(_0x511695){logger[_0x3efb('0x2d')](_0x3efb('0x89'),_0x511695['id']);logger[_0x3efb('0x2d')](_0x3efb('0x7f'),_0x3efb('0x8a'));emit(util[_0x3efb('0x2f')](_0x3efb('0x8b'),_0x6800a1[_0x3efb('0x18')]),'trigger:browser:url',{'uri':_0x3efb('0x8c')+_0x455d04['host']+_0x3efb('0x8d')+_0x511695['id']});}})[_0x3efb('0x2a')](function(_0x1a646d){logger[_0x3efb('0x2b')]('[QUEUE]',JSON[_0x3efb('0xc')](_0x1a646d));});};exports[_0x3efb('0x72')]=function(_0x4c39b6,_0x18fc1f,_0x5054c7,_0x3c644d,_0x2c775e,_0x3f00a6,_0x176d5a){var _0xbec515,_0x7344a9,_0x57db5b;_0x3f00a6[_0x3efb('0x7b')]=intUtil[_0x3efb('0x7c')](_0x3f00a6['host']);_0x3f00a6[_0x3efb('0x7d')]=intUtil[_0x3efb('0x7c')](_0x3f00a6[_0x3efb('0x7d')]);if(_0x176d5a&&_0x176d5a[_0x3efb('0x8e')]&&_0x176d5a[_0x3efb('0x8e')]!==_0x3efb('0x8f')){logger[_0x3efb('0x2d')](_0x3efb('0x90'),_0x3efb('0x91'));_0x18fc1f['recordingURL']=_0x3f00a6['serverUrl']+_0x3efb('0x80')+_0x18fc1f[_0x3efb('0x81')]+_0x3efb('0x82')+md5(_0x18fc1f[_0x3efb('0x81')]);}var _0x482fcc=_0x3f00a6[_0x3efb('0x7b')]==='zoho.eu'?'eu':_0x3efb('0x85');return getAccessToken(_0x3f00a6)[_0x3efb('0x28')](function(_0x5da5a4){_0x57db5b=_0x5da5a4;return getUser(_0x57db5b,_0x482fcc,_0x3f00a6,_0x3c644d['email']);})['then'](function(_0xa8c08a){_0xbec515=_0xa8c08a;logger[_0x3efb('0x2d')](_0x3efb('0x86'),_0xbec515['id']);return getEndUser(_0x57db5b,_0x482fcc,_0x3f00a6,_0x18fc1f[_0x3efb('0x92')],_0x18fc1f[_0x3efb('0x93')],_0xbec515,_0x5054c7);})[_0x3efb('0x28')](function(_0x265028){_0x7344a9=_0x265028;return getCall(_0x57db5b,_0x482fcc,_0x3f00a6,_0xbec515,_0x7344a9,_0x5054c7,_0x18fc1f,'Outbound');})[_0x3efb('0x28')](function(_0x231333){if(_0x231333){logger[_0x3efb('0x2d')]('The\x20Call\x20ID\x20is:',_0x231333['id']);logger[_0x3efb('0x2d')]('[OUTBOUND]',_0x3efb('0x8a'));emit(util['format']('user:%s',_0x3c644d[_0x3efb('0x18')]),'trigger:browser:url',{'uri':_0x3efb('0x8c')+_0x3f00a6[_0x3efb('0x7b')]+'/crm/EntityInfo.do?module=Calls&id='+_0x231333['id']});}})[_0x3efb('0x2a')](function(_0x221aa3){logger[_0x3efb('0x2b')](_0x3efb('0x90'),JSON[_0x3efb('0xc')](_0x221aa3));});};exports[_0x3efb('0x94')]=function(_0x44cbb8,_0x5a9efe,_0x287c7f,_0x577dec,_0x42d3b3,_0x1333f5){var _0x2ac4b3,_0x1ac7da,_0x398d76;_0x1333f5['host']=intUtil[_0x3efb('0x7c')](_0x1333f5['host']);_0x1333f5[_0x3efb('0x7d')]=intUtil[_0x3efb('0x7c')](_0x1333f5[_0x3efb('0x7d')]);if(_0x42d3b3&&_0x42d3b3[_0x3efb('0x7e')]){logger[_0x3efb('0x2d')]('['+_0x5a9efe['lastevent'][_0x3efb('0x95')]()+']',_0x3efb('0x91'));_0x5a9efe[_0x3efb('0x83')]=_0x1333f5[_0x3efb('0x7d')]+_0x3efb('0x80')+_0x5a9efe[_0x3efb('0x81')]+'/downloads?type=uniqueid&token='+md5(_0x5a9efe[_0x3efb('0x81')]);}else{_0x5a9efe[_0x3efb('0x83')]='';}var _0x5f5170=_0x1333f5[_0x3efb('0x7b')]===_0x3efb('0x84')?'eu':_0x3efb('0x85');return getAccessToken(_0x1333f5)['then'](function(_0x321e91){_0x398d76=_0x321e91;return getUser(_0x398d76,_0x5f5170,_0x1333f5);})[_0x3efb('0x28')](function(_0x1e5c17){_0x2ac4b3=_0x1e5c17;logger[_0x3efb('0x2d')](_0x3efb('0x86'),_0x2ac4b3['id']);return getEndUser(_0x398d76,_0x5f5170,_0x1333f5,_0x5a9efe[_0x3efb('0x87')],_0x5a9efe[_0x3efb('0x88')],_0x2ac4b3,_0x287c7f);})[_0x3efb('0x28')](function(_0xebc833){_0x1ac7da=_0xebc833;return getCall(_0x398d76,_0x5f5170,_0x1333f5,_0x2ac4b3,_0x1ac7da,_0x287c7f,_0x5a9efe,'Inbound');})[_0x3efb('0x28')](function(_0x5d2426){if(_0x5d2426){logger[_0x3efb('0x2d')](_0x3efb('0x89'),_0x5d2426['id']);}})[_0x3efb('0x2a')](function(_0x5d96ff){logger[_0x3efb('0x2b')]('['+_0x5a9efe['lastevent'][_0x3efb('0x95')]()+']',JSON[_0x3efb('0xc')](_0x5d96ff));});}; \ 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 24f8401..165355d 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 _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x54d371,_0x936bb8){var _0x14ccc7=function(_0x44fd6c){while(--_0x44fd6c){_0x54d371['push'](_0x54d371['shift']());}};_0x14ccc7(++_0x936bb8);}(_0x7a54,0x106));var _0x47a5=function(_0x283187,_0x3e2fec){_0x283187=_0x283187-0x0;var _0x3fbc26=_0x7a54[_0x283187];return _0x3fbc26;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x44edad,_0x437e2a){var _0xa3e5=function(_0x196ca2){while(--_0x196ca2){_0x44edad['push'](_0x44edad['shift']());}};_0xa3e5(++_0x437e2a);}(_0x7a54,0x106));var _0x47a5=function(_0x9b1145,_0x3be48c){_0x9b1145=_0x9b1145-0x0;var _0x54d260=_0x7a54[_0x9b1145];return _0x54d260;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ 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 c9de4cb..b9e3066 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 _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','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','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x27f04b,_0x3af9f5){var _0x5aa174=function(_0x2d7577){while(--_0x2d7577){_0x27f04b['push'](_0x27f04b['shift']());}};_0x5aa174(++_0x3af9f5);}(_0x7a54,0x106));var _0x47a5=function(_0x17d4ab,_0x2d373b){_0x17d4ab=_0x17d4ab-0x0;var _0x1c440c=_0x7a54[_0x17d4ab];return _0x1c440c;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x29545f,_0x104264){var _0x56882e=function(_0x37b87d){while(--_0x37b87d){_0x29545f['push'](_0x29545f['shift']());}};_0x56882e(++_0x104264);}(_0x5f2f,0x73));var _0xf5f2=function(_0x45c4cb,_0x5207c3){_0x45c4cb=_0x45c4cb-0x0;var _0x26a956=_0x5f2f[_0x45c4cb];return _0x26a956;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1d6c121..f7358ec 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 _0x37cc=['bluebird','../../config/logger','routing','client','http','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise'];(function(_0x587cb6,_0x3089b6){var _0x458102=function(_0x513f58){while(--_0x513f58){_0x587cb6['push'](_0x587cb6['shift']());}};_0x458102(++_0x3089b6);}(_0x37cc,0x185));var _0xc37c=function(_0x327cbf,_0x114362){_0x327cbf=_0x327cbf-0x0;var _0x409cb8=_0x37cc[_0x327cbf];return _0x409cb8;};'use strict';var jayson=require(_0xc37c('0x0'));var BPromise=require(_0xc37c('0x1'));var logger=require(_0xc37c('0x2'))(_0xc37c('0x3'));var client=jayson[_0xc37c('0x4')][_0xc37c('0x5')]({'port':0x2329});client['Request']=function(_0x55b158,_0x334d3c){return new BPromise(function(_0x946e3b,_0x310b02){return client[_0xc37c('0x6')](_0x55b158,_0x334d3c)[_0xc37c('0x7')](function(_0x582100){logger[_0xc37c('0x8')](_0xc37c('0x9'),_0xc37c('0x3'),_0x55b158,_0x334d3c,_0x582100);if(_0x582100['error']){logger[_0xc37c('0xa')](_0xc37c('0x9'),_0xc37c('0x3'),_0x55b158,_0x582100[_0xc37c('0xa')][_0xc37c('0xb')],_0x334d3c);return _0x310b02(_0x582100['error'][_0xc37c('0xb')]);}else{return _0x946e3b(_0x582100[_0xc37c('0xc')]);}})[_0xc37c('0xd')](function(_0x262372){logger[_0xc37c('0xa')](_0xc37c('0x9'),_0xc37c('0x3'),_0x55b158,_0x262372,_0x334d3c);return _0x310b02(_0x262372);});});};module[_0xc37c('0xe')]=client; \ No newline at end of file +var _0x8d97=['bluebird','../../config/logger','client','http','Request','request','then','routing','error','rpc','message','result','exports'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x8d97,0x82));var _0x78d9=function(_0x1b4a36,_0x3a5a57){_0x1b4a36=_0x1b4a36-0x0;var _0x3477a9=_0x8d97[_0x1b4a36];return _0x3477a9;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x78d9('0x0'));var logger=require(_0x78d9('0x1'))('routing');var client=jayson[_0x78d9('0x2')][_0x78d9('0x3')]({'port':0x2329});client[_0x78d9('0x4')]=function(_0xba5b3,_0x1b690f){return new BPromise(function(_0x5f4582,_0x2125d0){return client[_0x78d9('0x5')](_0xba5b3,_0x1b690f)[_0x78d9('0x6')](function(_0x59b38c){logger['debug']('rpc',_0x78d9('0x7'),_0xba5b3,_0x1b690f,_0x59b38c);if(_0x59b38c[_0x78d9('0x8')]){logger[_0x78d9('0x8')](_0x78d9('0x9'),_0x78d9('0x7'),_0xba5b3,_0x59b38c[_0x78d9('0x8')]['message'],_0x1b690f);return _0x2125d0(_0x59b38c[_0x78d9('0x8')][_0x78d9('0xa')]);}else{return _0x5f4582(_0x59b38c[_0x78d9('0xb')]);}})['catch'](function(_0x5e6ffe){logger[_0x78d9('0x8')](_0x78d9('0x9'),_0x78d9('0x7'),_0xba5b3,_0x5e6ffe,_0x1b690f);return _0x2125d0(_0x5e6ffe);});});};module[_0x78d9('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 59b3a5f..415f028 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 _0xd8fb=['mailAccounts','loginMailFrequency','catch','bluebird','./server','./realtime','./lib/email','then','getMailAccounts','initMailAccounts'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xd8fb,0x99));var _0xbd8f=function(_0x22109d,_0x1aaf9d){_0x22109d=_0x22109d-0x0;var _0x118ed3=_0xd8fb[_0x22109d];return _0x118ed3;};'use strict';var BPromise=require(_0xbd8f('0x0'));var server=require(_0xbd8f('0x1'));var Realtime=require(_0xbd8f('0x2'));var EmailChannel=require(_0xbd8f('0x3'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise['resolve']()[_0xbd8f('0x4')](mailAccount[_0xbd8f('0x5')]())['then'](realtime[_0xbd8f('0x6')]())[_0xbd8f('0x4')](function(){email['refresh'](realtime[_0xbd8f('0x7')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xbd8f('0x4')](function(_0x578499){return initRealtime();})[_0xbd8f('0x4')](function(_0x403edc){return db['Setting']['findOne']({'attributes':['id',_0xbd8f('0x8')],'raw':!![]});})[_0xbd8f('0x4')](function(_0x2a55b5){return setInterval(initRealtime,_0x2a55b5['loginMailFrequency']*0x3e8);})[_0xbd8f('0x9')](function(_0x42ae20){console['log'](_0x42ae20);});}main(); \ No newline at end of file +var _0xef8b=['../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','loginMailFrequency','catch','log','./server','./realtime','./lib/email','./rpc/mailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef8b,0x192));var _0xbef8=function(_0x4932a6,_0x530e29){_0x4932a6=_0x4932a6-0x0;var _0x3b45b9=_0xef8b[_0x4932a6];return _0x3b45b9;};'use strict';var BPromise=require('bluebird');var server=require(_0xbef8('0x0'));var Realtime=require(_0xbef8('0x1'));var EmailChannel=require(_0xbef8('0x2'));var mailAccount=require(_0xbef8('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xbef8('0x4'))['db'];function initRealtime(){return BPromise[_0xbef8('0x5')]()[_0xbef8('0x6')](mailAccount[_0xbef8('0x7')]())[_0xbef8('0x6')](realtime[_0xbef8('0x8')]())[_0xbef8('0x6')](function(){email['refresh'](realtime[_0xbef8('0x9')]);return realtime;});}function main(){return server[_0xbef8('0xa')](realtime,email)[_0xbef8('0x6')](function(_0x5d2773){return initRealtime();})[_0xbef8('0x6')](function(_0x1a6d83){return db['Setting']['findOne']({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0xbef8('0x6')](function(_0x455b29){return setInterval(initRealtime,_0x455b29[_0xbef8('0xb')]*0x3e8);})[_0xbef8('0xc')](function(_0x257a3c){console[_0xbef8('0xd')](_0x257a3c);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 72aff57..ffc47bd 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 _0x809c=['New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','notify','Mail\x20accepted\x20from\x20routing','catch','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','ioredis','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','status','Imap','messageStatus','total','isNil','stringify','md5','mailAccount:update','refresh','hasOwnProperty','active','box','bind','handleImapEmail','end','handleImapEnd','error','connected'];(function(_0x39bb96,_0x4f8895){var _0x2eec04=function(_0x5ba53e){while(--_0x5ba53e){_0x39bb96['push'](_0x39bb96['shift']());}};_0x2eec04(++_0x4f8895);}(_0x809c,0x1b7));var _0xc809=function(_0x46f6b3,_0x85ab3d){_0x46f6b3=_0x46f6b3-0x0;var _0x1f08b5=_0x809c[_0x46f6b3];return _0x1f08b5;};'use strict';var _=require(_0xc809('0x0'));var moment=require(_0xc809('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xc809('0x2'));var config=require('../../../config/environment');var logger=require(_0xc809('0x3'))(_0xc809('0x4'));config[_0xc809('0x5')]=_[_0xc809('0x6')](config[_0xc809('0x5')],{'host':_0xc809('0x7'),'port':0x18eb});var io=require(_0xc809('0x8'))(new Redis(config[_0xc809('0x5')]));var EmailImap=require(_0xc809('0x9'));var EmailSmtp=require(_0xc809('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4ed18a){logger[_0xc809('0xb')](_0xc809('0xc'));this['mailAccounts']=_0x4ed18a[_0xc809('0xd')];this[_0xc809('0xe')]={};this[_0xc809('0xf')]=new EmailSmtp();}EmailChannel[_0xc809('0x10')][_0xc809('0x11')]=function(_0x2e70b6){var _0x144702=this[_0xc809('0xd')][_0x2e70b6];var _0x10fddd={'id':_0x144702['id'],'name':_0x144702[_0xc809('0x12')],'key':_0x144702[_0xc809('0x13')],'active':_0x144702['active'],'Imap':{'status':_0x144702['Imap'][_0xc809('0x14')],'messageStatus':_0x144702[_0xc809('0x15')][_0xc809('0x16')],'total':_0x144702[_0xc809('0x15')][_0xc809('0x17')]}};if(_[_0xc809('0x18')](md5Accounts[_0x2e70b6])){md5Accounts[_0x2e70b6]={};}var _0x4a01bb=md5(JSON[_0xc809('0x19')](_0x10fddd));if(md5Accounts[_0x2e70b6]['md5']!==_0x4a01bb){md5Accounts[_0x2e70b6][_0xc809('0x1a')]=_0x4a01bb;io[_0xc809('0x11')](_0xc809('0x1b'),_0x10fddd);}};EmailChannel[_0xc809('0x10')][_0xc809('0x1c')]=function(_0x2d06d4){for(var _0x414c5f in _0x2d06d4){if(_0x2d06d4[_0xc809('0x1d')](_0x414c5f)){if(_0x2d06d4[_0x414c5f][_0xc809('0x15')]&&_0x2d06d4[_0x414c5f][_0xc809('0x1e')]){var _0x495654=_0x2d06d4[_0x414c5f][_0xc809('0x15')];if(!this[_0xc809('0xe')][_0xc809('0x1d')](_0x495654['id'])){this[_0xc809('0xe')][_0x495654['id']]=new EmailImap(_0x495654,_0x2d06d4[_0x414c5f][_0xc809('0x4')]);this[_0xc809('0xe')][_0x495654['id']]['on'](_0xc809('0x1f'),this['handleImapBox'][_0xc809('0x20')](this,_0x414c5f));this[_0xc809('0xe')][_0x495654['id']]['on'](_0xc809('0x4'),this[_0xc809('0x21')][_0xc809('0x20')](this,_0x414c5f));this['imapAccounts'][_0x495654['id']]['on'](_0xc809('0x22'),this[_0xc809('0x23')][_0xc809('0x20')](this,_0x414c5f));this[_0xc809('0xe')][_0x495654['id']]['on'](_0xc809('0x24'),this['handleImapError'][_0xc809('0x20')](this,_0x414c5f));}}else{if(_[_0xc809('0x18')](this[_0xc809('0xd')][_0x414c5f][_0xc809('0x15')])){this[_0xc809('0xd')][_0x414c5f][_0xc809('0x15')]={};}this[_0xc809('0xd')][_0x414c5f][_0xc809('0x15')][_0xc809('0x14')]='disabled';this[_0xc809('0xd')][_0x414c5f]['Imap'][_0xc809('0x16')]='';this[_0xc809('0x11')](_0x414c5f);}}}};EmailChannel[_0xc809('0x10')]['handleImapBox']=function(_0x399c6b,_0x1d178d){if(this[_0xc809('0xd')][_0x399c6b]){this[_0xc809('0xd')][_0x399c6b][_0xc809('0x15')][_0xc809('0x14')]=_0xc809('0x25');this[_0xc809('0xd')][_0x399c6b][_0xc809('0x15')][_0xc809('0x16')]=_0x1d178d[_0xc809('0x12')];if(_0x1d178d['messages']){this['mailAccounts'][_0x399c6b][_0xc809('0x15')]['total']=_0x1d178d['messages'][_0xc809('0x17')];}return this['emit'](_0x399c6b);}};EmailChannel[_0xc809('0x10')][_0xc809('0x21')]=function(_0x384589,_0x248a2e){logger[_0xc809('0xb')](_0xc809('0x26'),_0x248a2e[_0xc809('0x27')],_0x248a2e['lastName'],_0x248a2e['from'],_0x384589);if(this['mailAccounts'][_0x384589]){return mailAccount[_0xc809('0x28')](_0x384589,_0x248a2e)['then'](function(_0x35fad3){if(_0x35fad3){logger[_0xc809('0xb')](_0xc809('0x29'));}})[_0xc809('0x2a')](function(_0x5e4926){logger[_0xc809('0x24')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x5e4926));});}};EmailChannel[_0xc809('0x10')][_0xc809('0x23')]=function(_0x41cf3d){if(this[_0xc809('0xd')][_0x41cf3d]&&this[_0xc809('0xd')][_0x41cf3d][_0xc809('0x15')]){if(this[_0xc809('0xe')][this['mailAccounts'][_0x41cf3d]['Imap']['id']]){delete this[_0xc809('0xe')][this['mailAccounts'][_0x41cf3d][_0xc809('0x15')]['id']];}this[_0xc809('0xd')][_0x41cf3d][_0xc809('0x15')][_0xc809('0x2b')]=moment();this[_0xc809('0x11')](_0x41cf3d);}};EmailChannel['prototype'][_0xc809('0x2c')]=function(_0x4df8e2,_0x39d353){if(this[_0xc809('0xd')][_0x4df8e2]){this['mailAccounts'][_0x4df8e2][_0xc809('0x15')][_0xc809('0x14')]=_0xc809('0x24');this[_0xc809('0xd')][_0x4df8e2][_0xc809('0x15')]['messageStatus']=_0x39d353;return this[_0xc809('0x11')](_0x4df8e2);}};EmailChannel['prototype'][_0xc809('0x2d')]=function(_0x26091c,_0x557532){return this[_0xc809('0xf')][_0xc809('0x2e')](_0x26091c,_0x557532);};EmailChannel[_0xc809('0x10')][_0xc809('0x2f')]=function(_0x3397bb){var _0x26b52e=this;if(this[_0xc809('0xd')][_0x3397bb['id']]){if(_[_0xc809('0x18')](this[_0xc809('0xd')][_0x3397bb['id']]['Smtp'])){this['mailAccounts'][_0x3397bb['id']][_0xc809('0x30')]={};}this[_0xc809('0xd')][_0x3397bb['id']]['Smtp'][_0xc809('0x2b')]=moment();return new BPromise(function(_0x57a783,_0x50a0f4){return _0x26b52e[_0xc809('0xf')][_0xc809('0x31')](_0x3397bb)[_0xc809('0x32')](function(_0x20ba24){_0x26b52e[_0xc809('0xd')][_0x3397bb['id']][_0xc809('0x30')][_0xc809('0x14')]=_0xc809('0x33');_0x26b52e[_0xc809('0xd')][_0x3397bb['id']][_0xc809('0x30')]['messageStatus']='';_0x26b52e[_0xc809('0x11')](_0x3397bb['id']);_0x57a783(_0x20ba24);})[_0xc809('0x2a')](function(_0x215c02){_0x26b52e['mailAccounts'][_0x3397bb['id']][_0xc809('0x30')][_0xc809('0x14')]=_0xc809('0x24');_0x26b52e[_0xc809('0xd')][_0x3397bb['id']][_0xc809('0x30')]['messageStatus']=_0x215c02;_0x26b52e[_0xc809('0x11')](_0x3397bb['id']);_0x50a0f4(_0x215c02);});});}return this['smtp']['verify'](_0x3397bb);};module[_0xc809('0x34')]=EmailChannel; \ No newline at end of file +var _0xad16=['../../../config/logger','email','redis','defaults','localhost','./imap','../rpc/mailAccount','start\x20email\x20channel','smtp','prototype','name','key','Imap','status','messageStatus','total','isNil','stringify','emit','refresh','active','imapAccounts','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','mailAccounts','connected','messages','info','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verified','bluebird','md5','../../../config/environment'];(function(_0x422a90,_0x5a004c){var _0x56bcd1=function(_0x381a69){while(--_0x381a69){_0x422a90['push'](_0x422a90['shift']());}};_0x56bcd1(++_0x5a004c);}(_0xad16,0x90));var _0x6ad1=function(_0x3e7731,_0x1ed79f){_0x3e7731=_0x3e7731-0x0;var _0x439577=_0xad16[_0x3e7731];return _0x439577;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x6ad1('0x0'));var md5=require(_0x6ad1('0x1'));var Redis=require('ioredis');var config=require(_0x6ad1('0x2'));var logger=require(_0x6ad1('0x3'))(_0x6ad1('0x4'));config[_0x6ad1('0x5')]=_[_0x6ad1('0x6')](config[_0x6ad1('0x5')],{'host':_0x6ad1('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6ad1('0x5')]));var EmailImap=require(_0x6ad1('0x8'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x6ad1('0x9'));var md5Accounts={};function EmailChannel(_0x52a64a){logger['info'](_0x6ad1('0xa'));this['mailAccounts']=_0x52a64a['mailAccounts'];this['imapAccounts']={};this[_0x6ad1('0xb')]=new EmailSmtp();}EmailChannel[_0x6ad1('0xc')]['emit']=function(_0x210a42){var _0x1e273e=this['mailAccounts'][_0x210a42];var _0x3d9703={'id':_0x1e273e['id'],'name':_0x1e273e[_0x6ad1('0xd')],'key':_0x1e273e[_0x6ad1('0xe')],'active':_0x1e273e['active'],'Imap':{'status':_0x1e273e[_0x6ad1('0xf')][_0x6ad1('0x10')],'messageStatus':_0x1e273e[_0x6ad1('0xf')][_0x6ad1('0x11')],'total':_0x1e273e[_0x6ad1('0xf')][_0x6ad1('0x12')]}};if(_[_0x6ad1('0x13')](md5Accounts[_0x210a42])){md5Accounts[_0x210a42]={};}var _0x42b83a=md5(JSON[_0x6ad1('0x14')](_0x3d9703));if(md5Accounts[_0x210a42]['md5']!==_0x42b83a){md5Accounts[_0x210a42][_0x6ad1('0x1')]=_0x42b83a;io[_0x6ad1('0x15')]('mailAccount:update',_0x3d9703);}};EmailChannel[_0x6ad1('0xc')][_0x6ad1('0x16')]=function(_0x7fec8c){for(var _0x447221 in _0x7fec8c){if(_0x7fec8c['hasOwnProperty'](_0x447221)){if(_0x7fec8c[_0x447221][_0x6ad1('0xf')]&&_0x7fec8c[_0x447221][_0x6ad1('0x17')]){var _0x59f30b=_0x7fec8c[_0x447221][_0x6ad1('0xf')];if(!this[_0x6ad1('0x18')][_0x6ad1('0x19')](_0x59f30b['id'])){this[_0x6ad1('0x18')][_0x59f30b['id']]=new EmailImap(_0x59f30b,_0x7fec8c[_0x447221][_0x6ad1('0x4')]);this[_0x6ad1('0x18')][_0x59f30b['id']]['on'](_0x6ad1('0x1a'),this[_0x6ad1('0x1b')][_0x6ad1('0x1c')](this,_0x447221));this[_0x6ad1('0x18')][_0x59f30b['id']]['on'](_0x6ad1('0x4'),this[_0x6ad1('0x1d')][_0x6ad1('0x1c')](this,_0x447221));this['imapAccounts'][_0x59f30b['id']]['on'](_0x6ad1('0x1e'),this[_0x6ad1('0x1f')][_0x6ad1('0x1c')](this,_0x447221));this[_0x6ad1('0x18')][_0x59f30b['id']]['on']('error',this[_0x6ad1('0x20')][_0x6ad1('0x1c')](this,_0x447221));}}else{if(_[_0x6ad1('0x13')](this['mailAccounts'][_0x447221][_0x6ad1('0xf')])){this[_0x6ad1('0x21')][_0x447221][_0x6ad1('0xf')]={};}this[_0x6ad1('0x21')][_0x447221]['Imap'][_0x6ad1('0x10')]='disabled';this[_0x6ad1('0x21')][_0x447221][_0x6ad1('0xf')]['messageStatus']='';this[_0x6ad1('0x15')](_0x447221);}}}};EmailChannel['prototype'][_0x6ad1('0x1b')]=function(_0x41b8c2,_0x19bb5c){if(this[_0x6ad1('0x21')][_0x41b8c2]){this[_0x6ad1('0x21')][_0x41b8c2]['Imap']['status']=_0x6ad1('0x22');this[_0x6ad1('0x21')][_0x41b8c2]['Imap'][_0x6ad1('0x11')]=_0x19bb5c[_0x6ad1('0xd')];if(_0x19bb5c['messages']){this[_0x6ad1('0x21')][_0x41b8c2][_0x6ad1('0xf')][_0x6ad1('0x12')]=_0x19bb5c[_0x6ad1('0x23')][_0x6ad1('0x12')];}return this['emit'](_0x41b8c2);}};EmailChannel[_0x6ad1('0xc')][_0x6ad1('0x1d')]=function(_0x26babd,_0x3730ae){logger[_0x6ad1('0x24')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3730ae['firstName'],_0x3730ae[_0x6ad1('0x25')],_0x3730ae[_0x6ad1('0x26')],_0x26babd);if(this[_0x6ad1('0x21')][_0x26babd]){return mailAccount[_0x6ad1('0x27')](_0x26babd,_0x3730ae)[_0x6ad1('0x28')](function(_0x514a5e){if(_0x514a5e){logger['info'](_0x6ad1('0x29'));}})['catch'](function(_0x3ee7fb){logger[_0x6ad1('0x2a')](_0x6ad1('0x2b'),JSON[_0x6ad1('0x14')](_0x3ee7fb));});}};EmailChannel[_0x6ad1('0xc')][_0x6ad1('0x1f')]=function(_0x5907c9){if(this[_0x6ad1('0x21')][_0x5907c9]&&this['mailAccounts'][_0x5907c9][_0x6ad1('0xf')]){if(this[_0x6ad1('0x18')][this[_0x6ad1('0x21')][_0x5907c9][_0x6ad1('0xf')]['id']]){delete this[_0x6ad1('0x18')][this[_0x6ad1('0x21')][_0x5907c9][_0x6ad1('0xf')]['id']];}this[_0x6ad1('0x21')][_0x5907c9][_0x6ad1('0xf')][_0x6ad1('0x2c')]=moment();this[_0x6ad1('0x15')](_0x5907c9);}};EmailChannel['prototype'][_0x6ad1('0x20')]=function(_0x5533ad,_0x55a0aa){if(this[_0x6ad1('0x21')][_0x5533ad]){this[_0x6ad1('0x21')][_0x5533ad][_0x6ad1('0xf')][_0x6ad1('0x10')]=_0x6ad1('0x2a');this[_0x6ad1('0x21')][_0x5533ad][_0x6ad1('0xf')][_0x6ad1('0x11')]=_0x55a0aa;return this[_0x6ad1('0x15')](_0x5533ad);}};EmailChannel[_0x6ad1('0xc')][_0x6ad1('0x2d')]=function(_0x4aef31,_0x57fef9){return this['smtp'][_0x6ad1('0x2e')](_0x4aef31,_0x57fef9);};EmailChannel[_0x6ad1('0xc')]['verifySmtp']=function(_0x41b250){var _0x5e3650=this;if(this[_0x6ad1('0x21')][_0x41b250['id']]){if(_[_0x6ad1('0x13')](this['mailAccounts'][_0x41b250['id']][_0x6ad1('0x2f')])){this[_0x6ad1('0x21')][_0x41b250['id']][_0x6ad1('0x2f')]={};}this[_0x6ad1('0x21')][_0x41b250['id']][_0x6ad1('0x2f')][_0x6ad1('0x2c')]=moment();return new BPromise(function(_0x574012,_0x4468e6){return _0x5e3650[_0x6ad1('0xb')]['verify'](_0x41b250)[_0x6ad1('0x28')](function(_0xf7e8a1){_0x5e3650[_0x6ad1('0x21')][_0x41b250['id']][_0x6ad1('0x2f')][_0x6ad1('0x10')]=_0x6ad1('0x30');_0x5e3650[_0x6ad1('0x21')][_0x41b250['id']][_0x6ad1('0x2f')][_0x6ad1('0x11')]='';_0x5e3650[_0x6ad1('0x15')](_0x41b250['id']);_0x574012(_0xf7e8a1);})['catch'](function(_0x257ffe){_0x5e3650['mailAccounts'][_0x41b250['id']]['Smtp'][_0x6ad1('0x10')]=_0x6ad1('0x2a');_0x5e3650['mailAccounts'][_0x41b250['id']][_0x6ad1('0x2f')][_0x6ad1('0x11')]=_0x257ffe;_0x5e3650[_0x6ad1('0x15')](_0x41b250['id']);_0x4468e6(_0x257ffe);});});}return this['smtp']['verify'](_0x41b250);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ee34b88..1b20d2a 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 _0xdac5=['authentication','user','password','host','port','tls','autotls','required','getHost','handleOpenBox','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchEnd','error','handleMessageBody','attributes','handleMessageAttributes','parser','closeBox','handleFetchError','handleEnd','emit','textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','./utils','email','mailbox','account','once','ready','handleReady','bind','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','service'];(function(_0x5600ba,_0xe51f7c){var _0x2db0f1=function(_0x4a5896){while(--_0x4a5896){_0x5600ba['push'](_0x5600ba['shift']());}};_0x2db0f1(++_0xe51f7c);}(_0xdac5,0x96));var _0x5dac=function(_0xdd49d4,_0x4c0ab5){_0xdd49d4=_0xdd49d4-0x0;var _0x3ea833=_0xdac5[_0xdd49d4];return _0x3ea833;};'use strict';var fs=require('fs');var path=require(_0x5dac('0x0'));var util=require(_0x5dac('0x1'));var Imap=require(_0x5dac('0x2'));var _=require(_0x5dac('0x3'));var rs=require(_0x5dac('0x4'));var simpleParser=require(_0x5dac('0x5'))[_0x5dac('0x6')];var Iconv=require(_0x5dac('0x7'))[_0x5dac('0x8')];var EventEmitter=require(_0x5dac('0x9'))['EventEmitter'];var utils=require(_0x5dac('0xa'));var logger=require('../../../config/logger')(_0x5dac('0xb'));function EmailImap(_0x28d8a6,_0x472553){this[_0x5dac('0xc')]='INBOX';this[_0x5dac('0xd')]=this['getAccount'](_0x28d8a6,_0x472553);this[_0x5dac('0x2')]=new Imap(this[_0x5dac('0xd')]);this[_0x5dac('0x2')][_0x5dac('0xe')](_0x5dac('0xf'),this[_0x5dac('0x10')][_0x5dac('0x11')](this));this[_0x5dac('0x2')][_0x5dac('0xe')]('end',this['handleEnd']['bind'](this));this[_0x5dac('0x2')]['on']('error',this[_0x5dac('0x12')][_0x5dac('0x11')](this));this['imap'][_0x5dac('0x13')]();}util[_0x5dac('0x14')](EmailImap,EventEmitter);EmailImap[_0x5dac('0x15')][_0x5dac('0x16')]=function(_0x24c81a,_0x503d83){var _0x1dabf1={'connTimeout':_0x24c81a[_0x5dac('0x17')]?_0x24c81a[_0x5dac('0x17')]*0x3e8:0x2710,'authTimeout':_0x24c81a[_0x5dac('0x18')]?_0x24c81a[_0x5dac('0x18')]*0x3e8:0x1388};if(_[_0x5dac('0x19')](_0x24c81a[_0x5dac('0x1a')])){if(_0x24c81a[_0x5dac('0x1b')]){_0x1dabf1[_0x5dac('0x1c')]=_0x24c81a[_0x5dac('0x1c')];_0x1dabf1[_0x5dac('0x1d')]=_0x24c81a[_0x5dac('0x1d')];}_0x1dabf1[_0x5dac('0x1e')]=_0x24c81a[_0x5dac('0x1e')];_0x1dabf1[_0x5dac('0x1f')]=_0x24c81a['port']||0x3e1;if(_0x24c81a['tls']){_0x1dabf1[_0x5dac('0x20')]=!![];}else{_0x1dabf1[_0x5dac('0x20')]=![];_0x1dabf1[_0x5dac('0x21')]=_0x5dac('0x22');}}else{_0x1dabf1[_0x5dac('0x1c')]=_0x24c81a['user'];_0x1dabf1['password']=_0x24c81a[_0x5dac('0x1d')];_0x1dabf1[_0x5dac('0x1e')]=utils[_0x5dac('0x23')](_0x24c81a[_0x5dac('0x1a')]);_0x1dabf1[_0x5dac('0x1f')]=0x3e1;_0x1dabf1[_0x5dac('0x20')]=!![];}_0x1dabf1['email']=_0x503d83||_0x24c81a[_0x5dac('0x1c')]||'anonymous@xcally.com';return _0x1dabf1;};EmailImap[_0x5dac('0x15')][_0x5dac('0x10')]=function(){this['imap']['openBox'](this[_0x5dac('0xc')],![],this[_0x5dac('0x24')]['bind'](this));};EmailImap[_0x5dac('0x15')][_0x5dac('0x24')]=function(_0x970180,_0x263072){if(_0x970180){this[_0x5dac('0x12')](_0x970180,!![]);}else{this['emit']('box',_0x263072);this[_0x5dac('0x25')]();}};EmailImap[_0x5dac('0x15')][_0x5dac('0x26')]=function(_0x501af5){if(_0x501af5){this[_0x5dac('0x12')](_0x501af5,!![]);}else{this[_0x5dac('0x2')][_0x5dac('0x27')]();}};EmailImap[_0x5dac('0x15')][_0x5dac('0x25')]=function(){this[_0x5dac('0x2')][_0x5dac('0x28')]([_0x5dac('0x29')],this[_0x5dac('0x2a')][_0x5dac('0x11')](this));};EmailImap[_0x5dac('0x15')][_0x5dac('0x2a')]=function(_0x3c05c8,_0x2013d2){if(_0x3c05c8){this['handleError'](_0x3c05c8,!![]);}else{if(_0x2013d2['length']){try{var _0x52779e=this['imap'][_0x5dac('0x2b')](_0x2013d2,{'bodies':'','markSeen':!![]});_0x52779e['on'](_0x5dac('0x2c'),this[_0x5dac('0x2d')][_0x5dac('0x11')](this));_0x52779e[_0x5dac('0xe')]('error',this['handleFetchError'][_0x5dac('0x11')](this));_0x52779e[_0x5dac('0xe')](_0x5dac('0x27'),this[_0x5dac('0x2e')][_0x5dac('0x11')](this));}catch(_0x16dec5){logger[_0x5dac('0x2f')](_0x16dec5);}}else{this['imap']['closeBox'](!![],this[_0x5dac('0x26')][_0x5dac('0x11')](this));}}};EmailImap[_0x5dac('0x15')][_0x5dac('0x2d')]=function(_0x89d3ce,_0x42f2fc){_0x89d3ce['on']('body',this[_0x5dac('0x30')][_0x5dac('0x11')](this));_0x89d3ce[_0x5dac('0xe')](_0x5dac('0x31'),this[_0x5dac('0x32')][_0x5dac('0x11')](this));_0x89d3ce['once'](_0x5dac('0x27'),this['handleMessageEnd'][_0x5dac('0x11')](this));};EmailImap[_0x5dac('0x15')][_0x5dac('0x30')]=function(_0x2d898e,_0x1031c0){simpleParser(_0x2d898e,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(_0x41eb19){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x5dac('0x15')]['handleSimpleParser']=function(_0x5b4dde,_0x3a28b1){if(_0x5b4dde){logger[_0x5dac('0x2f')](_0x5b4dde);}else{var _0x5c3e0d=this;utils[_0x5dac('0x33')](this[_0x5dac('0xd')],_0x3a28b1,function(_0x377acc){_0x5c3e0d['emit'](_0x5dac('0xb'),_0x377acc);});}};EmailImap[_0x5dac('0x15')][_0x5dac('0x2e')]=function(){this[_0x5dac('0x2')][_0x5dac('0x34')](!![],this['handleCloseBox'][_0x5dac('0x11')](this));};EmailImap[_0x5dac('0x15')][_0x5dac('0x35')]=function(_0x13c068){this[_0x5dac('0x12')](_0x13c068);this[_0x5dac('0x2')]['closeBox'](!![],this[_0x5dac('0x26')][_0x5dac('0x11')](this));};EmailImap[_0x5dac('0x15')][_0x5dac('0x36')]=function(){this[_0x5dac('0x37')](_0x5dac('0x27'));};EmailImap[_0x5dac('0x15')][_0x5dac('0x12')]=function(_0x536205,_0x564020){logger[_0x5dac('0x2f')](_0x5dac('0x12'),this[_0x5dac('0xd')][_0x5dac('0xb')],JSON['stringify'](_0x536205));var _0x438650='';if(_0x536205){if(_0x536205[_0x5dac('0x38')]){_0x438650=_0x536205['textCode'];}else{for(var _0xc21ebd in _0x536205){if(_0x536205[_0x5dac('0x39')](_0xc21ebd)){_0x438650+=_['upperFirst'](_0xc21ebd)+':\x20'+_0x536205[_0xc21ebd]+'\x0a';}}}}if(_0x564020){this[_0x5dac('0x2')]['end']();}else{this[_0x5dac('0x37')]('error',_0x438650);this[_0x5dac('0x37')]('end');}};module[_0x5dac('0x3a')]=EmailImap; \ No newline at end of file +var _0x5bb1=['tls','required','user','getHost','service','anonymous@xcally.com','prototype','openBox','handleOpenBox','handleError','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','closeBox','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','parser','account','handleFetchEnd','stringify','textCode','hasOwnProperty','upperFirst','emit','exports','path','util','imap','lodash','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','email','mailbox','getAccount','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','connTimeout','authTimeout','password','host','port'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5bb1,0x1d6));var _0x15bb=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x5bb1[_0x4a3898];return _0x25ceb0;};'use strict';var fs=require('fs');var path=require(_0x15bb('0x0'));var util=require(_0x15bb('0x1'));var Imap=require(_0x15bb('0x2'));var _=require(_0x15bb('0x3'));var rs=require('randomstring');var simpleParser=require('mailparser')[_0x15bb('0x4')];var Iconv=require(_0x15bb('0x5'))[_0x15bb('0x6')];var EventEmitter=require('events')[_0x15bb('0x7')];var utils=require('./utils');var logger=require(_0x15bb('0x8'))(_0x15bb('0x9'));function EmailImap(_0x25b468,_0x15c0b4){this[_0x15bb('0xa')]='INBOX';this['account']=this[_0x15bb('0xb')](_0x25b468,_0x15c0b4);this[_0x15bb('0x2')]=new Imap(this['account']);this[_0x15bb('0x2')][_0x15bb('0xc')](_0x15bb('0xd'),this[_0x15bb('0xe')][_0x15bb('0xf')](this));this[_0x15bb('0x2')][_0x15bb('0xc')](_0x15bb('0x10'),this[_0x15bb('0x11')][_0x15bb('0xf')](this));this[_0x15bb('0x2')]['on'](_0x15bb('0x12'),this['handleError'][_0x15bb('0xf')](this));this[_0x15bb('0x2')][_0x15bb('0x13')]();}util[_0x15bb('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x15bb('0xb')]=function(_0x128863,_0x278109){var _0x3d3325={'connTimeout':_0x128863[_0x15bb('0x15')]?_0x128863[_0x15bb('0x15')]*0x3e8:0x2710,'authTimeout':_0x128863['authTimeout']?_0x128863[_0x15bb('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x128863['service'])){if(_0x128863['authentication']){_0x3d3325['user']=_0x128863['user'];_0x3d3325[_0x15bb('0x17')]=_0x128863[_0x15bb('0x17')];}_0x3d3325[_0x15bb('0x18')]=_0x128863[_0x15bb('0x18')];_0x3d3325[_0x15bb('0x19')]=_0x128863[_0x15bb('0x19')]||0x3e1;if(_0x128863[_0x15bb('0x1a')]){_0x3d3325[_0x15bb('0x1a')]=!![];}else{_0x3d3325[_0x15bb('0x1a')]=![];_0x3d3325['autotls']=_0x15bb('0x1b');}}else{_0x3d3325['user']=_0x128863[_0x15bb('0x1c')];_0x3d3325[_0x15bb('0x17')]=_0x128863[_0x15bb('0x17')];_0x3d3325['host']=utils[_0x15bb('0x1d')](_0x128863[_0x15bb('0x1e')]);_0x3d3325['port']=0x3e1;_0x3d3325[_0x15bb('0x1a')]=!![];}_0x3d3325[_0x15bb('0x9')]=_0x278109||_0x128863[_0x15bb('0x1c')]||_0x15bb('0x1f');return _0x3d3325;};EmailImap[_0x15bb('0x20')][_0x15bb('0xe')]=function(){this[_0x15bb('0x2')][_0x15bb('0x21')](this[_0x15bb('0xa')],![],this[_0x15bb('0x22')]['bind'](this));};EmailImap[_0x15bb('0x20')]['handleOpenBox']=function(_0x3b2504,_0x50c978){if(_0x3b2504){this[_0x15bb('0x23')](_0x3b2504,!![]);}else{this['emit'](_0x15bb('0x24'),_0x50c978);this[_0x15bb('0x25')]();}};EmailImap[_0x15bb('0x20')][_0x15bb('0x26')]=function(_0x4841a5){if(_0x4841a5){this[_0x15bb('0x23')](_0x4841a5,!![]);}else{this[_0x15bb('0x2')]['end']();}};EmailImap[_0x15bb('0x20')][_0x15bb('0x25')]=function(){this[_0x15bb('0x2')][_0x15bb('0x27')]([_0x15bb('0x28')],this['handleReadUnseen'][_0x15bb('0xf')](this));};EmailImap['prototype'][_0x15bb('0x29')]=function(_0x61800b,_0x4e9e95){if(_0x61800b){this['handleError'](_0x61800b,!![]);}else{if(_0x4e9e95[_0x15bb('0x2a')]){try{var _0x288d6c=this[_0x15bb('0x2')][_0x15bb('0x2b')](_0x4e9e95,{'bodies':'','markSeen':!![]});_0x288d6c['on'](_0x15bb('0x2c'),this[_0x15bb('0x2d')]['bind'](this));_0x288d6c[_0x15bb('0xc')](_0x15bb('0x12'),this['handleFetchError']['bind'](this));_0x288d6c[_0x15bb('0xc')](_0x15bb('0x10'),this['handleFetchEnd'][_0x15bb('0xf')](this));}catch(_0x4a2f5f){logger[_0x15bb('0x12')](_0x4a2f5f);}}else{this[_0x15bb('0x2')][_0x15bb('0x2e')](!![],this[_0x15bb('0x26')][_0x15bb('0xf')](this));}}};EmailImap[_0x15bb('0x20')][_0x15bb('0x2d')]=function(_0x14cef5,_0x40ef0f){_0x14cef5['on'](_0x15bb('0x2f'),this[_0x15bb('0x30')][_0x15bb('0xf')](this));_0x14cef5['once'](_0x15bb('0x31'),this['handleMessageAttributes'][_0x15bb('0xf')](this));_0x14cef5[_0x15bb('0xc')]('end',this[_0x15bb('0x32')][_0x15bb('0xf')](this));};EmailImap[_0x15bb('0x20')][_0x15bb('0x30')]=function(_0x3975ca,_0x478d09){simpleParser(_0x3975ca,{'Iconv':Iconv},this[_0x15bb('0x33')]['bind'](this));};EmailImap['prototype'][_0x15bb('0x34')]=function(_0x1937a2){};EmailImap[_0x15bb('0x20')][_0x15bb('0x32')]=function(){};EmailImap[_0x15bb('0x20')][_0x15bb('0x33')]=function(_0x534924,_0x57a8bd){if(_0x534924){logger[_0x15bb('0x12')](_0x534924);}else{var _0x4f9fb4=this;utils[_0x15bb('0x35')](this[_0x15bb('0x36')],_0x57a8bd,function(_0x38030b){_0x4f9fb4['emit'](_0x15bb('0x9'),_0x38030b);});}};EmailImap[_0x15bb('0x20')][_0x15bb('0x37')]=function(){this[_0x15bb('0x2')][_0x15bb('0x2e')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x15bb('0x20')]['handleFetchError']=function(_0x682efb){this['handleError'](_0x682efb);this[_0x15bb('0x2')][_0x15bb('0x2e')](!![],this[_0x15bb('0x26')][_0x15bb('0xf')](this));};EmailImap[_0x15bb('0x20')][_0x15bb('0x11')]=function(){this['emit'](_0x15bb('0x10'));};EmailImap[_0x15bb('0x20')]['handleError']=function(_0x324688,_0x37b488){logger[_0x15bb('0x12')](_0x15bb('0x23'),this['account'][_0x15bb('0x9')],JSON[_0x15bb('0x38')](_0x324688));var _0x2f0d66='';if(_0x324688){if(_0x324688[_0x15bb('0x39')]){_0x2f0d66=_0x324688[_0x15bb('0x39')];}else{for(var _0x1a13d6 in _0x324688){if(_0x324688[_0x15bb('0x3a')](_0x1a13d6)){_0x2f0d66+=_[_0x15bb('0x3b')](_0x1a13d6)+':\x20'+_0x324688[_0x1a13d6]+'\x0a';}}}}if(_0x37b488){this[_0x15bb('0x2')][_0x15bb('0x10')]();}else{this[_0x15bb('0x3c')]('error',_0x2f0d66);this[_0x15bb('0x3c')](_0x15bb('0x10'));}};module[_0x15bb('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 53f254d..29848d7 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 _0xf5d6=['verify','Not\x20verifired','exports','nodemailer','bluebird','prototype','createTransport','use','sendMail'];(function(_0x339dcf,_0x4cc8d9){var _0x37ed68=function(_0x1e8137){while(--_0x1e8137){_0x339dcf['push'](_0x339dcf['shift']());}};_0x37ed68(++_0x4cc8d9);}(_0xf5d6,0xc9));var _0x6f5d=function(_0xce03e1,_0x67d8c8){_0xce03e1=_0xce03e1-0x0;var _0x1a4756=_0xf5d6[_0xce03e1];return _0x1a4756;};'use strict';var nodemailer=require(_0x6f5d('0x0'));var BPromise=require(_0x6f5d('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x6f5d('0x2')]['send']=function(_0x44861b,_0x27384e){return new BPromise(function(_0x2e6151,_0x1da592){var _0x3d1806=nodemailer[_0x6f5d('0x3')](_0x44861b);_0x3d1806[_0x6f5d('0x4')]('compile',inlineBase64());_0x3d1806[_0x6f5d('0x5')](_0x27384e,function(_0x45ef43,_0x246982){if(_0x45ef43){_0x1da592(_0x45ef43['toString']());}else{_0x2e6151(_0x246982);}});});};EmailSmtp[_0x6f5d('0x2')][_0x6f5d('0x6')]=function(_0x387b9e){return new BPromise(function(_0x1a1d5a,_0x1452cf){var _0xa430c7=nodemailer[_0x6f5d('0x3')](_0x387b9e);_0xa430c7['verify'](function(_0x3e292e,_0x36a766){if(_0x3e292e){_0x1452cf(_0x3e292e['toString']());}else{if(_0x36a766){_0x1a1d5a(_0x36a766);}else{_0x1452cf(_0x6f5d('0x7'));}}});});};module[_0x6f5d('0x8')]=EmailSmtp; \ No newline at end of file +var _0xd4e2=['verify','toString','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use','sendMail'];(function(_0x18b9d0,_0x2a4981){var _0x14984b=function(_0x199c07){while(--_0x199c07){_0x18b9d0['push'](_0x18b9d0['shift']());}};_0x14984b(++_0x2a4981);}(_0xd4e2,0x90));var _0x2d4e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd4e2[_0x3bf83f];return _0x22c4a9;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x2d4e('0x0'));var inlineBase64=require(_0x2d4e('0x1'));function EmailSmtp(){}EmailSmtp[_0x2d4e('0x2')]['send']=function(_0x5411c4,_0x51fd21){return new BPromise(function(_0xe35524,_0x5008c6){var _0x449b92=nodemailer[_0x2d4e('0x3')](_0x5411c4);_0x449b92[_0x2d4e('0x4')]('compile',inlineBase64());_0x449b92[_0x2d4e('0x5')](_0x51fd21,function(_0x1a559c,_0x14534a){if(_0x1a559c){_0x5008c6(_0x1a559c['toString']());}else{_0xe35524(_0x14534a);}});});};EmailSmtp[_0x2d4e('0x2')][_0x2d4e('0x6')]=function(_0x5d68fb){return new BPromise(function(_0x2c6ef1,_0x46777e){var _0x61fb4=nodemailer[_0x2d4e('0x3')](_0x5d68fb);_0x61fb4[_0x2d4e('0x6')](function(_0x5d729e,_0x781992){if(_0x5d729e){_0x46777e(_0x5d729e[_0x2d4e('0x7')]());}else{if(_0x781992){_0x2c6ef1(_0x781992);}else{_0x46777e(_0x2d4e('0x8'));}}});});};module[_0x2d4e('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 399fc94..8e15d81 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 _0x17a7=['Anonymous','pop','isEmpty','@xcally.com','html','test','body','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook.office365.com','lodash','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','value','name','split','length'];(function(_0x468732,_0x3398b6){var _0x308118=function(_0x744eaf){while(--_0x744eaf){_0x468732['push'](_0x468732['shift']());}};_0x308118(++_0x3398b6);}(_0x17a7,0x1b8));var _0x717a=function(_0x413af5,_0x320df1){_0x413af5=_0x413af5-0x0;var _0x51a0cf=_0x17a7[_0x413af5];return _0x51a0cf;};'use strict';var _=require(_0x717a('0x0'));var moment=require('moment');var random=require(_0x717a('0x1'));var fs=require('fs');var path=require('path');var util=require(_0x717a('0x2'));var tnef=require(_0x717a('0x3'));var logger=require(_0x717a('0x4'))(_0x717a('0x5'));var config=require(_0x717a('0x6'));function getAddress(_0x3b1a1e){var _0x3bb1f6=_[_0x717a('0x7')](_0x3b1a1e['value']);return _0x3bb1f6&&_0x3bb1f6[_0x717a('0x8')]?_0x3bb1f6[_0x717a('0x8')]:_0x717a('0x9')+random[_0x717a('0xa')](0x6)+'@xcally.com';}function getFirstName(_0x48efc4){var _0x42480b=_['head'](_0x48efc4[_0x717a('0xb')]);if(_0x42480b&&_0x42480b[_0x717a('0xc')]){var _0x4fae32=_0x42480b[_0x717a('0xc')][_0x717a('0xd')](/\s+/);return _0x4fae32[_0x717a('0xe')]?_0x4fae32['slice'](0x0,-0x1)['join']('\x20'):_0x42480b[_0x717a('0xc')];}return _0x717a('0xf');}function getLastName(_0x240cd6){var _0x4b2cd7=_[_0x717a('0x7')](_0x240cd6[_0x717a('0xb')]);if(_0x4b2cd7&&_0x4b2cd7[_0x717a('0xc')]){var _0x263671=_0x4b2cd7[_0x717a('0xc')][_0x717a('0xd')](/\s+/);return _0x263671[_0x717a('0xe')]>0x1?_0x263671[_0x717a('0x10')]():'';}return'';}function getMails(_0x3df3d7,_0xe8e22f){var _0x57fc38='';for(var _0x412ef5=0x0;_0x412ef5<_0xe8e22f[_0x717a('0xb')]['length'];_0x412ef5+=0x1){if(_0xe8e22f['value'][_0x412ef5][_0x717a('0x8')]!==_0x3df3d7){if(!_[_0x717a('0x11')](_0x57fc38)){_0x57fc38+=',';}_0x57fc38+=_0xe8e22f['value'][_0x412ef5][_0x717a('0xc')]||_0xe8e22f[_0x717a('0xb')][_0x412ef5][_0x717a('0x8')]||'';_0x57fc38+='\x20<';_0x57fc38+=_0xe8e22f[_0x717a('0xb')][_0x412ef5][_0x717a('0x8')]?_0xe8e22f[_0x717a('0xb')][_0x412ef5]['address']:_0x717a('0x9')+random[_0x717a('0xa')](0x6)+_0x717a('0x12');_0x57fc38+='>';}}return _0x57fc38;}function parseEmail(_0x2397b8,_0x366953,_0x30a174){if(_0x366953[_0x717a('0x13')]){var _0x8c74ee=/)<[^<]*)*<\/script>/gi;while(_0x8c74ee[_0x717a('0x14')](_0x366953[_0x717a('0x13')])){_0x366953[_0x717a('0x13')]=_0x366953[_0x717a('0x13')]['replace'](_0x8c74ee,'');}_0x30a174[_0x717a('0x15')]=_0x366953[_0x717a('0x13')];}else{_0x30a174['body']=_0x366953['textAsHtml'];}if(_0x30a174['body']){_0x30a174[_0x717a('0x15')]=_0x30a174[_0x717a('0x15')]['replace'](/Empty\x20message

','Attachments','push','Title','Data','getHost','imap.gmail.com','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','moment','randomstring','path','../../../config/logger','email','head','address','generate','value','name','length','slice','Anonymous','pop','isEmpty','anonymous','@xcally.com','test','html','replace','body','0x1?_0x1f4ad8[_0x9aa5('0xd')]():'';}return'';}function getMails(_0x45e396,_0x35b95a){var _0x55fc4e='';for(var _0x1c00f3=0x0;_0x1c00f3<_0x35b95a[_0x9aa5('0x8')][_0x9aa5('0xa')];_0x1c00f3+=0x1){if(_0x35b95a[_0x9aa5('0x8')][_0x1c00f3][_0x9aa5('0x6')]!==_0x45e396){if(!_[_0x9aa5('0xe')](_0x55fc4e)){_0x55fc4e+=',';}_0x55fc4e+=_0x35b95a['value'][_0x1c00f3][_0x9aa5('0x9')]||_0x35b95a[_0x9aa5('0x8')][_0x1c00f3][_0x9aa5('0x6')]||'';_0x55fc4e+='\x20<';_0x55fc4e+=_0x35b95a['value'][_0x1c00f3][_0x9aa5('0x6')]?_0x35b95a[_0x9aa5('0x8')][_0x1c00f3][_0x9aa5('0x6')]:_0x9aa5('0xf')+random[_0x9aa5('0x7')](0x6)+_0x9aa5('0x10');_0x55fc4e+='>';}}return _0x55fc4e;}function parseEmail(_0x348ad3,_0x153dab,_0x1a80a1){if(_0x153dab['html']){var _0xd901c9=/)<[^<]*)*<\/script>/gi;while(_0xd901c9[_0x9aa5('0x11')](_0x153dab['html'])){_0x153dab['html']=_0x153dab[_0x9aa5('0x12')][_0x9aa5('0x13')](_0xd901c9,'');}_0x1a80a1[_0x9aa5('0x14')]=_0x153dab[_0x9aa5('0x12')];}else{_0x1a80a1[_0x9aa5('0x14')]=_0x153dab['textAsHtml'];}if(_0x1a80a1[_0x9aa5('0x14')]){_0x1a80a1[_0x9aa5('0x14')]=_0x1a80a1['body']['replace'](/0x0){if(this[_0xa5b12b+'Capacity']>0x0&&this[_0xa5b12b+'CurrentCapacity']>=this[_0xa5b12b+_0x3e49('0x29')]){return'maxcapacity';}else{return _0x3e49('0x2a');}}else{return _0x3e49('0x2b');}};Agent['prototype']['updateRealtime']=function(){var _0xdfb7b7=['mail',_0x3e49('0x2c'),_0x3e49('0x2d'),_0x3e49('0x2e'),_0x3e49('0x2f'),'whatsapp'];for(var _0xb4a615=0x0;_0xb4a615<_0xdfb7b7[_0x3e49('0x30')];_0xb4a615+=0x1){var _0xd573d7=this[_0x3e49('0x27')](_0xdfb7b7[_0xb4a615]);if(this[_0xdfb7b7[_0xb4a615]+_0x3e49('0x31')]!==_0xd573d7){this[_0xdfb7b7[_0xb4a615]+_0x3e49('0x32')]=_[_0x3e49('0x33')](moment()[_0x3e49('0x34')]('x'));}this[_0xdfb7b7[_0xb4a615]+_0x3e49('0x31')]=_0xd573d7;}var _0x572811={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x3e49('0xa')],'chatPause':this[_0x3e49('0x35')],'mailPause':this['mailPause'],'smsPause':this[_0x3e49('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x3e49('0xe')],'chatStatus':this[_0x3e49('0xf')],'chatStatusTime':this[_0x3e49('0x11')],'chatCapacity':this[_0x3e49('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x3e49('0x36')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x3e49('0x16')],'faxStatus':this[_0x3e49('0x37')],'faxStatusTime':this[_0x3e49('0x17')],'faxCapacity':this[_0x3e49('0x18')],'faxCurrentCapacity':this[_0x3e49('0x19')],'smsStatus':this[_0x3e49('0x1a')],'smsStatusTime':this[_0x3e49('0x1b')],'smsCapacity':this[_0x3e49('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x3e49('0x1e')],'whatsappStatusTime':this[_0x3e49('0x1f')],'whatsappCapacity':this[_0x3e49('0x20')],'whatsappCurrentCapacity':this[_0x3e49('0x21')],'openchannelStatus':this[_0x3e49('0x38')],'openchannelStatusTime':this[_0x3e49('0x39')],'openchannelCapacity':this[_0x3e49('0x22')],'openchannelCurrentCapacity':this[_0x3e49('0x23')],'busy':this[_0x3e49('0x24')],'busyQueue':this[_0x3e49('0x25')]};var _0x56f043=md5(JSON[_0x3e49('0x3a')](_0x572811));if(this[_0x3e49('0x2')]!==_0x56f043){this[_0x3e49('0x2')]=_0x56f043;io[_0x3e49('0x3b')](_0x3e49('0x3c'),_0x572811);}};module[_0x3e49('0x3d')]=Agent; \ No newline at end of file +var _0x676c=['chatCurrentCapacity','faxCapacity','smsStatusTime','whatsappCurrentCapacity','openchannelStatusTime','stringify','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','mailPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','Capacity','idle','mail','chat','openchannel','sms','whatsapp','Status','StatusTime','format','faxPause','chatStatus'];(function(_0x408145,_0x202db1){var _0x4a9205=function(_0x26904b){while(--_0x26904b){_0x408145['push'](_0x408145['shift']());}};_0x4a9205(++_0x202db1);}(_0x676c,0x198));var _0xc676=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x676c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc676('0x0'));var moment=require(_0xc676('0x1'));var md5=require(_0xc676('0x2'));var Redis=require('ioredis');var config=require(_0xc676('0x3'));config[_0xc676('0x4')]=_[_0xc676('0x5')](config[_0xc676('0x4')],{'host':_0xc676('0x6'),'port':0x18eb});var io=require(_0xc676('0x7'))(new Redis(config['redis']));function Agent(_0x11eec5){this['id']=_0x11eec5['id']||0x0;this[_0xc676('0x8')]=_0x11eec5[_0xc676('0x8')]||'';this[_0xc676('0x9')]=_0x11eec5[_0xc676('0x9')]||!![];this['voicePause']=_0x11eec5[_0xc676('0xa')]||![];this['chatPause']=_0x11eec5['chatPause']||![];this[_0xc676('0xb')]=_0x11eec5[_0xc676('0xb')]||![];this['faxPause']=_0x11eec5['faxPause']||![];this[_0xc676('0xc')]=_0x11eec5[_0xc676('0xc')]||![];this[_0xc676('0xd')]=_0x11eec5['openchannelPause']||![];this['chatStatus']=_0xc676('0xe');this[_0xc676('0xf')]=0x0;this[_0xc676('0x10')]=_0x11eec5[_0xc676('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xc676('0x11')]=_0xc676('0xe');this[_0xc676('0x12')]=0x0;this[_0xc676('0x13')]=_0x11eec5[_0xc676('0x13')]||0x0;this[_0xc676('0x14')]=0x0;this[_0xc676('0x15')]='unknown';this[_0xc676('0x16')]=0x0;this['faxCapacity']=_0x11eec5['faxCapacity']||0x0;this[_0xc676('0x17')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0xc676('0x18')]=_0x11eec5['smsCapacity']||0x0;this[_0xc676('0x19')]=0x0;this[_0xc676('0x1a')]=_0xc676('0xe');this[_0xc676('0x1b')]=0x0;this[_0xc676('0x1c')]=_0x11eec5[_0xc676('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xc676('0x1d')]=_0xc676('0xe');this['openchannelStatusTime']=0x0;this[_0xc676('0x1e')]=_0x11eec5[_0xc676('0x1e')]||0x0;this[_0xc676('0x1f')]=0x0;this[_0xc676('0x20')]=![];this[_0xc676('0x21')]=undefined;this[_0xc676('0x2')]='';this[_0xc676('0x22')]();}Agent[_0xc676('0x23')]['getChannelStatus']=function(_0x5ed353){if(this[_0x5ed353+'CurrentCapacity']>0x0){if(this[_0x5ed353+_0xc676('0x24')]>0x0&&this[_0x5ed353+'CurrentCapacity']>=this[_0x5ed353+_0xc676('0x24')]){return'maxcapacity';}else{return'working';}}else{return _0xc676('0x25');}};Agent['prototype'][_0xc676('0x22')]=function(){var _0x16f78d=[_0xc676('0x26'),_0xc676('0x27'),_0xc676('0x28'),'fax',_0xc676('0x29'),_0xc676('0x2a')];for(var _0x2f474a=0x0;_0x2f474a<_0x16f78d['length'];_0x2f474a+=0x1){var _0x36bd5b=this['getChannelStatus'](_0x16f78d[_0x2f474a]);if(this[_0x16f78d[_0x2f474a]+_0xc676('0x2b')]!==_0x36bd5b){this[_0x16f78d[_0x2f474a]+_0xc676('0x2c')]=_['toNumber'](moment()[_0xc676('0x2d')]('x'));}this[_0x16f78d[_0x2f474a]+_0xc676('0x2b')]=_0x36bd5b;}var _0x54e185={'id':this['id'],'name':this[_0xc676('0x8')],'online':this[_0xc676('0x9')],'voicePause':this[_0xc676('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0xc676('0xb')],'smsPause':this[_0xc676('0xc')],'faxPause':this[_0xc676('0x2e')],'openchannelPause':this[_0xc676('0xd')],'chatStatus':this[_0xc676('0x2f')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xc676('0x10')],'chatCurrentCapacity':this[_0xc676('0x30')],'mailStatus':this[_0xc676('0x11')],'mailStatusTime':this[_0xc676('0x12')],'mailCapacity':this[_0xc676('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xc676('0x15')],'faxStatusTime':this[_0xc676('0x16')],'faxCapacity':this[_0xc676('0x31')],'faxCurrentCapacity':this[_0xc676('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xc676('0x32')],'smsCapacity':this[_0xc676('0x18')],'smsCurrentCapacity':this[_0xc676('0x19')],'whatsappStatus':this[_0xc676('0x1a')],'whatsappStatusTime':this[_0xc676('0x1b')],'whatsappCapacity':this[_0xc676('0x1c')],'whatsappCurrentCapacity':this[_0xc676('0x33')],'openchannelStatus':this[_0xc676('0x1d')],'openchannelStatusTime':this[_0xc676('0x34')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0xc676('0x21')]};var _0x3cd065=md5(JSON[_0xc676('0x35')](_0x54e185));if(this[_0xc676('0x2')]!==_0x3cd065){this['md5']=_0x3cd065;io[_0xc676('0x36')](_0xc676('0x37'),_0x54e185);}};module[_0xc676('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 5719055..d477d5b 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 _0x826d=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRealtime','updateRouting','_rr','map','prototype','loggedIn','online','chatPause','paused','available','waiting','stringify','format','chat:queue:%s','emit','lodash','ioredis'];(function(_0x2284e0,_0x3f77e1){var _0x263eb7=function(_0x243776){while(--_0x243776){_0x2284e0['push'](_0x2284e0['shift']());}};_0x263eb7(++_0x3f77e1);}(_0x826d,0xac));var _0xd826=function(_0x233309,_0x5b1d5a){_0x233309=_0x233309-0x0;var _0x441b18=_0x826d[_0x233309];return _0x441b18;};'use strict';var _=require(_0xd826('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xd826('0x1'));var config=require(_0xd826('0x2'));config[_0xd826('0x3')]=_[_0xd826('0x4')](config['redis'],{'host':_0xd826('0x5'),'port':0x18eb});var io=require(_0xd826('0x6'))(new Redis(config[_0xd826('0x3')]));function ChatQueue(_0x1a3953){this['id']=_0x1a3953['id']||0x0;this[_0xd826('0x7')]=_0x1a3953[_0xd826('0x7')]||'';this[_0xd826('0x8')]=_0x1a3953[_0xd826('0x8')]||0xa;this['strategy']=_0x1a3953[_0xd826('0x9')]||_0xd826('0xa');this[_0xd826('0xb')]=_0x1a3953[_0xd826('0xb')];this[_0xd826('0xc')]={};this['waiting']=0x0;this[_0xd826('0xd')]='';this['updateRouting']();this[_0xd826('0xe')]();}ChatQueue['prototype'][_0xd826('0xf')]=function(){var _0x225494=this['mapAgentsId'][_0xd826('0x10')];this[_0xd826('0xc')]=_[_0xd826('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x225494;};ChatQueue[_0xd826('0x12')][_0xd826('0xe')]=function(){this[_0xd826('0x13')]=0x0;this['paused']=0x0;for(var _0x2919b0=0x0;_0x2919b0=0x0?this['available']:0x0;var _0x3dcdf4={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xd826('0x16')],'waiting':this[_0xd826('0x18')]};var _0x29b01c=md5(JSON[_0xd826('0x19')](_0x3dcdf4));if(this[_0xd826('0xd')]!==_0x29b01c){this[_0xd826('0xd')]=_0x29b01c;io['to'](util[_0xd826('0x1a')](_0xd826('0x1b'),_0x3dcdf4['name']))[_0xd826('0x1c')]('chat_queue:save',_0x3dcdf4);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xd135=['available','stringify','format','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','chatPause'];(function(_0x2c7b86,_0x59ef3c){var _0x256735=function(_0x352e33){while(--_0x352e33){_0x2c7b86['push'](_0x2c7b86['shift']());}};_0x256735(++_0x59ef3c);}(_0xd135,0x1b8));var _0x5d13=function(_0x52c5c6,_0x188d8b){_0x52c5c6=_0x52c5c6-0x0;var _0x5d7f9e=_0xd135[_0x52c5c6];return _0x5d7f9e;};'use strict';var _=require(_0x5d13('0x0'));var md5=require(_0x5d13('0x1'));var util=require(_0x5d13('0x2'));var Redis=require(_0x5d13('0x3'));var config=require(_0x5d13('0x4'));config[_0x5d13('0x5')]=_[_0x5d13('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5d13('0x7'))(new Redis(config[_0x5d13('0x5')]));function ChatQueue(_0x5bf1a5){this['id']=_0x5bf1a5['id']||0x0;this[_0x5d13('0x8')]=_0x5bf1a5[_0x5d13('0x8')]||'';this[_0x5d13('0x9')]=_0x5bf1a5[_0x5d13('0x9')]||0xa;this['strategy']=_0x5bf1a5[_0x5d13('0xa')]||_0x5d13('0xb');this[_0x5d13('0xc')]=_0x5bf1a5[_0x5d13('0xc')];this[_0x5d13('0xd')]={};this[_0x5d13('0xe')]=0x0;this['md5']='';this[_0x5d13('0xf')]();this[_0x5d13('0x10')]();}ChatQueue[_0x5d13('0x11')]['updateRouting']=function(){var _0x1d9551=this['mapAgentsId'][_0x5d13('0x12')];this[_0x5d13('0xd')]=_[_0x5d13('0x13')](this[_0x5d13('0xc')],'id');this[_0x5d13('0xd')][_0x5d13('0x12')]=_0x1d9551;};ChatQueue['prototype'][_0x5d13('0x10')]=function(){this[_0x5d13('0x14')]=0x0;this[_0x5d13('0x15')]=0x0;for(var _0x5a7695=0x0;_0x5a7695=0x0?this[_0x5d13('0x18')]:0x0;var _0x31257b={'id':this['id'],'available':this[_0x5d13('0x18')],'loggedIn':this[_0x5d13('0x14')],'name':this[_0x5d13('0x8')],'paused':this['paused'],'waiting':this[_0x5d13('0xe')]};var _0x59ba71=md5(JSON[_0x5d13('0x19')](_0x31257b));if(this[_0x5d13('0x1')]!==_0x59ba71){this[_0x5d13('0x1')]=_0x59ba71;io['to'](util[_0x5d13('0x1a')]('chat:queue:%s',_0x31257b[_0x5d13('0x8')]))[_0x5d13('0x1b')]('chat_queue:save',_0x31257b);}};module[_0x5d13('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 3a8899f..dd0a3a2 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 _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x369424,_0x5eff1d){var _0x296b3c=function(_0x490808){while(--_0x490808){_0x369424['push'](_0x369424['shift']());}};_0x296b3c(++_0x5eff1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x25649b,_0x45a212){var _0x4cf2ba=function(_0x4a4955){while(--_0x4a4955){_0x25649b['push'](_0x25649b['shift']());}};_0x4cf2ba(++_0x45a212);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('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 39481ad..8456b99 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 _0x1ddc=['exports','name','Intervals'];(function(_0x47bbec,_0xbd45f8){var _0x2425be=function(_0x39621c){while(--_0x39621c){_0x47bbec['push'](_0x47bbec['shift']());}};_0x2425be(++_0xbd45f8);}(_0x1ddc,0x1e7));var _0xc1dd=function(_0x528649,_0x11b1d4){_0x528649=_0x528649-0x0;var _0xf5b398=_0x1ddc[_0x528649];return _0xf5b398;};'use strict';function Interval(_0x519a9a){this['id']=_0x519a9a['id']||0x0;this['name']=_0x519a9a[_0xc1dd('0x0')]||'';this[_0xc1dd('0x1')]=_0x519a9a[_0xc1dd('0x1')]||{};}module[_0xc1dd('0x2')]=Interval; \ No newline at end of file +var _0xe3e4=['name','Intervals'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0xe3e4,0x1b2));var _0x4e3e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe3e4[_0x14add3];return _0x4a174f;};'use strict';function Interval(_0x35f0bf){this['id']=_0x35f0bf['id']||0x0;this[_0x4e3e('0x0')]=_0x35f0bf['name']||'';this['Intervals']=_0x35f0bf[_0x4e3e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 0873568..21fe399 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 _0x5a41=['updateRealtime','prototype','map','_rr','paused','online','mailPause','available','loggedIn','stringify','mail:queue:%s','emit','mail_queue:save','lodash','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x5a41,0x1b1));var _0x15a4=function(_0x8d3262,_0x439e73){_0x8d3262=_0x8d3262-0x0;var _0x45561c=_0x5a41[_0x8d3262];return _0x45561c;};'use strict';var _=require(_0x15a4('0x0'));var md5=require(_0x15a4('0x1'));var util=require(_0x15a4('0x2'));var Redis=require(_0x15a4('0x3'));var config=require(_0x15a4('0x4'));config['redis']=_[_0x15a4('0x5')](config[_0x15a4('0x6')],{'host':_0x15a4('0x7'),'port':0x18eb});var io=require(_0x15a4('0x8'))(new Redis(config[_0x15a4('0x6')]));function MailQueue(_0x5c03a6){this['id']=_0x5c03a6['id']||0x0;this[_0x15a4('0x9')]=_0x5c03a6[_0x15a4('0x9')]||'';this[_0x15a4('0xa')]=_0x5c03a6['timeout']||0xa;this[_0x15a4('0xb')]=_0x5c03a6[_0x15a4('0xb')]||_0x15a4('0xc');this[_0x15a4('0xd')]=_0x5c03a6[_0x15a4('0xd')];this[_0x15a4('0xe')]={};this[_0x15a4('0xf')]=0x0;this['md5']='';this[_0x15a4('0x10')]();this[_0x15a4('0x11')]();}MailQueue[_0x15a4('0x12')]['updateRouting']=function(){var _0x2f042e=this[_0x15a4('0xe')]['_rr'];this['mapAgentsId']=_[_0x15a4('0x13')](this[_0x15a4('0xd')],'id');this[_0x15a4('0xe')][_0x15a4('0x14')]=_0x2f042e;};MailQueue['prototype'][_0x15a4('0x11')]=function(){this['loggedIn']=0x0;this[_0x15a4('0x15')]=0x0;for(var _0x12af39=0x0;_0x12af39=0x0?this['available']:0x0;var _0x257a0c={'id':this['id'],'available':this['available'],'loggedIn':this[_0x15a4('0x19')],'name':this[_0x15a4('0x9')],'paused':this[_0x15a4('0x15')],'waiting':this[_0x15a4('0xf')]};var _0x51301a=md5(JSON[_0x15a4('0x1a')](_0x257a0c));if(this[_0x15a4('0x1')]!==_0x51301a){this['md5']=_0x51301a;io['to'](util['format'](_0x15a4('0x1b'),_0x257a0c[_0x15a4('0x9')]))[_0x15a4('0x1c')](_0x15a4('0x1d'),_0x257a0c);}};module['exports']=MailQueue; \ No newline at end of file +var _0xb827=['name','timeout','strategy','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','emit','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter'];(function(_0xaf1c01,_0x32df03){var _0x2f2fe8=function(_0x374ffc){while(--_0x374ffc){_0xaf1c01['push'](_0xaf1c01['shift']());}};_0x2f2fe8(++_0x32df03);}(_0xb827,0x1ab));var _0x7b82=function(_0xad1f42,_0x2df520){_0xad1f42=_0xad1f42-0x0;var _0x109709=_0xb827[_0xad1f42];return _0x109709;};'use strict';var _=require(_0x7b82('0x0'));var md5=require(_0x7b82('0x1'));var util=require(_0x7b82('0x2'));var Redis=require(_0x7b82('0x3'));var config=require('../../../config/environment');config[_0x7b82('0x4')]=_[_0x7b82('0x5')](config[_0x7b82('0x4')],{'host':_0x7b82('0x6'),'port':0x18eb});var io=require(_0x7b82('0x7'))(new Redis(config['redis']));function MailQueue(_0x22deb7){this['id']=_0x22deb7['id']||0x0;this[_0x7b82('0x8')]=_0x22deb7[_0x7b82('0x8')]||'';this[_0x7b82('0x9')]=_0x22deb7[_0x7b82('0x9')]||0xa;this['strategy']=_0x22deb7[_0x7b82('0xa')]||'beepall';this['Agents']=_0x22deb7['Agents'];this[_0x7b82('0xb')]={};this[_0x7b82('0xc')]=0x0;this[_0x7b82('0x1')]='';this[_0x7b82('0xd')]();this[_0x7b82('0xe')]();}MailQueue[_0x7b82('0xf')][_0x7b82('0xd')]=function(){var _0x379982=this[_0x7b82('0xb')][_0x7b82('0x10')];this[_0x7b82('0xb')]=_[_0x7b82('0x11')](this[_0x7b82('0x12')],'id');this[_0x7b82('0xb')]['_rr']=_0x379982;};MailQueue['prototype']['updateRealtime']=function(){this[_0x7b82('0x13')]=0x0;this[_0x7b82('0x14')]=0x0;for(var _0x13dfc3=0x0;_0x13dfc3=0x0?this[_0x7b82('0x18')]:0x0;var _0x4d1b34={'id':this['id'],'available':this[_0x7b82('0x18')],'loggedIn':this[_0x7b82('0x13')],'name':this[_0x7b82('0x8')],'paused':this[_0x7b82('0x14')],'waiting':this[_0x7b82('0xc')]};var _0x12dea8=md5(JSON['stringify'](_0x4d1b34));if(this[_0x7b82('0x1')]!==_0x12dea8){this[_0x7b82('0x1')]=_0x12dea8;io['to'](util[_0x7b82('0x19')](_0x7b82('0x1a'),_0x4d1b34[_0x7b82('0x8')]))[_0x7b82('0x1b')]('mail_queue:save',_0x4d1b34);}};module[_0x7b82('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 0189742..393c608 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 _0xbd02=['map','prototype','loggedIn','paused','length','online','openchannelPause','available','stringify','format','emit','openchannel_queue:save','lodash','md5','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr'];(function(_0x5e1bca,_0xa95e2b){var _0x44aed8=function(_0x31f682){while(--_0x31f682){_0x5e1bca['push'](_0x5e1bca['shift']());}};_0x44aed8(++_0xa95e2b);}(_0xbd02,0x93));var _0x2bd0=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xbd02[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x2bd0('0x0'));var md5=require(_0x2bd0('0x1'));var util=require('util');var Redis=require(_0x2bd0('0x2'));var config=require(_0x2bd0('0x3'));config[_0x2bd0('0x4')]=_['defaults'](config['redis'],{'host':_0x2bd0('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2bd0('0x4')]));function OpenchannelQueue(_0x8eb67d){this['id']=_0x8eb67d['id']||0x0;this[_0x2bd0('0x6')]=_0x8eb67d[_0x2bd0('0x6')]||'';this[_0x2bd0('0x7')]=_0x8eb67d[_0x2bd0('0x7')]||0xa;this[_0x2bd0('0x8')]=_0x8eb67d[_0x2bd0('0x8')]||'beepall';this[_0x2bd0('0x9')]=_0x8eb67d[_0x2bd0('0x9')];this['mapAgentsId']={};this[_0x2bd0('0xa')]=0x0;this[_0x2bd0('0x1')]='';this[_0x2bd0('0xb')]();this[_0x2bd0('0xc')]();}OpenchannelQueue['prototype'][_0x2bd0('0xb')]=function(){var _0xc3c98a=this[_0x2bd0('0xd')][_0x2bd0('0xe')];this[_0x2bd0('0xd')]=_[_0x2bd0('0xf')](this[_0x2bd0('0x9')],'id');this[_0x2bd0('0xd')][_0x2bd0('0xe')]=_0xc3c98a;};OpenchannelQueue[_0x2bd0('0x10')][_0x2bd0('0xc')]=function(){this[_0x2bd0('0x11')]=0x0;this[_0x2bd0('0x12')]=0x0;for(var _0x4bdeb6=0x0;_0x4bdeb6=0x0?this['available']:0x0;var _0x53789b={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2bd0('0x11')],'name':this[_0x2bd0('0x6')],'paused':this['paused'],'waiting':this[_0x2bd0('0xa')]};var _0x311344=md5(JSON[_0x2bd0('0x17')](_0x53789b));if(this[_0x2bd0('0x1')]!==_0x311344){this[_0x2bd0('0x1')]=_0x311344;io['to'](util[_0x2bd0('0x18')]('openchannel:queue:%s',_0x53789b[_0x2bd0('0x6')]))[_0x2bd0('0x19')](_0x2bd0('0x1a'),_0x53789b);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xe650=['lodash','md5','util','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','available','name','format','openchannel:queue:%s','emit','exports'];(function(_0x4573bd,_0x19b9b5){var _0xc07bb9=function(_0x36a36a){while(--_0x36a36a){_0x4573bd['push'](_0x4573bd['shift']());}};_0xc07bb9(++_0x19b9b5);}(_0xe650,0x6c));var _0x0e65=function(_0x7e3bb8,_0x27c048){_0x7e3bb8=_0x7e3bb8-0x0;var _0x44c887=_0xe650[_0x7e3bb8];return _0x44c887;};'use strict';var _=require(_0x0e65('0x0'));var md5=require(_0x0e65('0x1'));var util=require(_0x0e65('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0e65('0x3')]=_[_0x0e65('0x4')](config[_0x0e65('0x3')],{'host':_0x0e65('0x5'),'port':0x18eb});var io=require(_0x0e65('0x6'))(new Redis(config[_0x0e65('0x3')]));function OpenchannelQueue(_0xfe2a86){this['id']=_0xfe2a86['id']||0x0;this['name']=_0xfe2a86['name']||'';this['timeout']=_0xfe2a86[_0x0e65('0x7')]||0xa;this[_0x0e65('0x8')]=_0xfe2a86[_0x0e65('0x8')]||_0x0e65('0x9');this[_0x0e65('0xa')]=_0xfe2a86['Agents'];this[_0x0e65('0xb')]={};this[_0x0e65('0xc')]=0x0;this[_0x0e65('0x1')]='';this[_0x0e65('0xd')]();this[_0x0e65('0xe')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x6ca3c9=this[_0x0e65('0xb')][_0x0e65('0xf')];this[_0x0e65('0xb')]=_[_0x0e65('0x10')](this[_0x0e65('0xa')],'id');this[_0x0e65('0xb')][_0x0e65('0xf')]=_0x6ca3c9;};OpenchannelQueue[_0x0e65('0x11')][_0x0e65('0xe')]=function(){this[_0x0e65('0x12')]=0x0;this[_0x0e65('0x13')]=0x0;for(var _0x1338f7=0x0;_0x1338f7=0x0?this[_0x0e65('0x15')]:0x0;var _0x1f50d2={'id':this['id'],'available':this[_0x0e65('0x15')],'loggedIn':this[_0x0e65('0x12')],'name':this[_0x0e65('0x16')],'paused':this[_0x0e65('0x13')],'waiting':this[_0x0e65('0xc')]};var _0x287776=md5(JSON['stringify'](_0x1f50d2));if(this[_0x0e65('0x1')]!==_0x287776){this[_0x0e65('0x1')]=_0x287776;io['to'](util[_0x0e65('0x17')](_0x0e65('0x18'),_0x1f50d2[_0x0e65('0x16')]))[_0x0e65('0x19')]('openchannel_queue:save',_0x1f50d2);}};module[_0x0e65('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index ae09eed..534cdb0 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 _0xbaf0=['online','paused','available','format','sms:queue:%s','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','length'];(function(_0x11f226,_0x491e30){var _0x30be77=function(_0x2049bd){while(--_0x2049bd){_0x11f226['push'](_0x11f226['shift']());}};_0x30be77(++_0x491e30);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var md5=require(_0x0baf('0x0'));var util=require(_0x0baf('0x1'));var Redis=require(_0x0baf('0x2'));var config=require(_0x0baf('0x3'));config[_0x0baf('0x4')]=_[_0x0baf('0x5')](config['redis'],{'host':_0x0baf('0x6'),'port':0x18eb});var io=require(_0x0baf('0x7'))(new Redis(config[_0x0baf('0x4')]));function SmsQueue(_0x39b8f3){this['id']=_0x39b8f3['id']||0x0;this[_0x0baf('0x8')]=_0x39b8f3[_0x0baf('0x8')]||'';this[_0x0baf('0x9')]=_0x39b8f3[_0x0baf('0x9')]||0xa;this[_0x0baf('0xa')]=_0x39b8f3['strategy']||_0x0baf('0xb');this['Agents']=_0x39b8f3[_0x0baf('0xc')];this[_0x0baf('0xd')]={};this[_0x0baf('0xe')]=0x0;this[_0x0baf('0x0')]='';this[_0x0baf('0xf')]();this[_0x0baf('0x10')]();}SmsQueue[_0x0baf('0x11')][_0x0baf('0xf')]=function(){var _0x1fc6b2=this[_0x0baf('0xd')][_0x0baf('0x12')];this['mapAgentsId']=_['map'](this[_0x0baf('0xc')],'id');this[_0x0baf('0xd')][_0x0baf('0x12')]=_0x1fc6b2;};SmsQueue[_0x0baf('0x11')]['updateRealtime']=function(){this[_0x0baf('0x13')]=0x0;this['paused']=0x0;for(var _0x1c76a8=0x0;_0x1c76a8=0x0?this['available']:0x0;var _0x63c820={'id':this['id'],'available':this[_0x0baf('0x17')],'loggedIn':this[_0x0baf('0x13')],'name':this[_0x0baf('0x8')],'paused':this[_0x0baf('0x16')],'waiting':this[_0x0baf('0xe')]};var _0x4ff793=md5(JSON['stringify'](_0x63c820));if(this[_0x0baf('0x0')]!==_0x4ff793){this[_0x0baf('0x0')]=_0x4ff793;io['to'](util[_0x0baf('0x18')](_0x0baf('0x19'),_0x63c820[_0x0baf('0x8')]))[_0x0baf('0x1a')](_0x0baf('0x1b'),_0x63c820);}};module[_0x0baf('0x1c')]=SmsQueue; \ No newline at end of file +var _0xcb91=['loggedIn','paused','length','online','available','stringify','sms:queue:%s','emit','sms_queue:save','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x281c11,_0x461c95){var _0x6f48d0=function(_0x3196fd){while(--_0x3196fd){_0x281c11['push'](_0x281c11['shift']());}};_0x6f48d0(++_0x461c95);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x43e4b3,_0x1444de){_0x43e4b3=_0x43e4b3-0x0;var _0x10c655=_0xcb91[_0x43e4b3];return _0x10c655;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1cb9('0x0'));var Redis=require(_0x1cb9('0x1'));var config=require(_0x1cb9('0x2'));config[_0x1cb9('0x3')]=_['defaults'](config[_0x1cb9('0x3')],{'host':_0x1cb9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x3')]));function SmsQueue(_0x1b26cd){this['id']=_0x1b26cd['id']||0x0;this['name']=_0x1b26cd[_0x1cb9('0x5')]||'';this[_0x1cb9('0x6')]=_0x1b26cd['timeout']||0xa;this[_0x1cb9('0x7')]=_0x1b26cd[_0x1cb9('0x7')]||'beepall';this[_0x1cb9('0x8')]=_0x1b26cd['Agents'];this['mapAgentsId']={};this[_0x1cb9('0x9')]=0x0;this[_0x1cb9('0xa')]='';this[_0x1cb9('0xb')]();this[_0x1cb9('0xc')]();}SmsQueue[_0x1cb9('0xd')]['updateRouting']=function(){var _0x9b58f1=this[_0x1cb9('0xe')][_0x1cb9('0xf')];this[_0x1cb9('0xe')]=_[_0x1cb9('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x9b58f1;};SmsQueue[_0x1cb9('0xd')][_0x1cb9('0xc')]=function(){this[_0x1cb9('0x11')]=0x0;this[_0x1cb9('0x12')]=0x0;for(var _0x56884d=0x0;_0x56884d=0x0?this[_0x1cb9('0x15')]:0x0;var _0x4e1340={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1cb9('0x11')],'name':this[_0x1cb9('0x5')],'paused':this[_0x1cb9('0x12')],'waiting':this[_0x1cb9('0x9')]};var _0x280a84=md5(JSON[_0x1cb9('0x16')](_0x4e1340));if(this[_0x1cb9('0xa')]!==_0x280a84){this['md5']=_0x280a84;io['to'](util['format'](_0x1cb9('0x17'),_0x4e1340['name']))[_0x1cb9('0x18')](_0x1cb9('0x19'),_0x4e1340);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 1bfdc63..e1d3ef4 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 _0x0071=['loggedIn','length','whatsappPause','paused','available','stringify','whatsapp:queue:%s','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','updateRealtime'];(function(_0x1f3fa6,_0x3d1ae8){var _0x172879=function(_0x357b52){while(--_0x357b52){_0x1f3fa6['push'](_0x1f3fa6['shift']());}};_0x172879(++_0x3d1ae8);}(_0x0071,0x11a));var _0x1007=function(_0x250801,_0x1f3f7a){_0x250801=_0x250801-0x0;var _0x25648b=_0x0071[_0x250801];return _0x25648b;};'use strict';var _=require('lodash');var md5=require(_0x1007('0x0'));var util=require(_0x1007('0x1'));var Redis=require(_0x1007('0x2'));var config=require(_0x1007('0x3'));config['redis']=_[_0x1007('0x4')](config[_0x1007('0x5')],{'host':_0x1007('0x6'),'port':0x18eb});var io=require(_0x1007('0x7'))(new Redis(config[_0x1007('0x5')]));function WhatsappQueue(_0x5184e2){this['id']=_0x5184e2['id']||0x0;this[_0x1007('0x8')]=_0x5184e2[_0x1007('0x8')]||'';this[_0x1007('0x9')]=_0x5184e2[_0x1007('0x9')]||0xa;this[_0x1007('0xa')]=_0x5184e2[_0x1007('0xa')]||_0x1007('0xb');this[_0x1007('0xc')]=_0x5184e2['Agents'];this[_0x1007('0xd')]={};this['waiting']=0x0;this[_0x1007('0x0')]='';this[_0x1007('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x1007('0xf')][_0x1007('0xe')]=function(){var _0x22b72b=this[_0x1007('0xd')]['_rr'];this[_0x1007('0xd')]=_['map'](this[_0x1007('0xc')],'id');this['mapAgentsId'][_0x1007('0x10')]=_0x22b72b;};WhatsappQueue['prototype'][_0x1007('0x11')]=function(){this[_0x1007('0x12')]=0x0;this['paused']=0x0;for(var _0x2cc1d3=0x0;_0x2cc1d3=0x0?this[_0x1007('0x16')]:0x0;var _0x7c6f2e={'id':this['id'],'available':this[_0x1007('0x16')],'loggedIn':this[_0x1007('0x12')],'name':this[_0x1007('0x8')],'paused':this[_0x1007('0x15')],'waiting':this['waiting']};var _0x5a51a6=md5(JSON[_0x1007('0x17')](_0x7c6f2e));if(this['md5']!==_0x5a51a6){this[_0x1007('0x0')]=_0x5a51a6;io['to'](util['format'](_0x1007('0x18'),_0x7c6f2e[_0x1007('0x8')]))['emit']('whatsapp_queue:save',_0x7c6f2e);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x1ee0=['Agents','waiting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','defaults','redis','name','timeout','strategy','beepall'];(function(_0x1924dd,_0x427dfe){var _0x3ffad8=function(_0x20bfe9){while(--_0x20bfe9){_0x1924dd['push'](_0x1924dd['shift']());}};_0x3ffad8(++_0x427dfe);}(_0x1ee0,0xfb));var _0x01ee=function(_0x44ae1c,_0x45b288){_0x44ae1c=_0x44ae1c-0x0;var _0x5db685=_0x1ee0[_0x44ae1c];return _0x5db685;};'use strict';var _=require(_0x01ee('0x0'));var md5=require(_0x01ee('0x1'));var util=require(_0x01ee('0x2'));var Redis=require(_0x01ee('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x01ee('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x01ee('0x5')]));function WhatsappQueue(_0x49e49e){this['id']=_0x49e49e['id']||0x0;this[_0x01ee('0x6')]=_0x49e49e['name']||'';this[_0x01ee('0x7')]=_0x49e49e[_0x01ee('0x7')]||0xa;this[_0x01ee('0x8')]=_0x49e49e[_0x01ee('0x8')]||_0x01ee('0x9');this[_0x01ee('0xa')]=_0x49e49e[_0x01ee('0xa')];this['mapAgentsId']={};this[_0x01ee('0xb')]=0x0;this[_0x01ee('0x1')]='';this['updateRouting']();this[_0x01ee('0xc')]();}WhatsappQueue[_0x01ee('0xd')]['updateRouting']=function(){var _0xe50c95=this[_0x01ee('0xe')][_0x01ee('0xf')];this[_0x01ee('0xe')]=_[_0x01ee('0x10')](this[_0x01ee('0xa')],'id');this[_0x01ee('0xe')][_0x01ee('0xf')]=_0xe50c95;};WhatsappQueue[_0x01ee('0xd')][_0x01ee('0xc')]=function(){this[_0x01ee('0x11')]=0x0;this[_0x01ee('0x12')]=0x0;for(var _0x1a21f3=0x0;_0x1a21f3=0x0?this[_0x01ee('0x16')]:0x0;var _0x34497d={'id':this['id'],'available':this[_0x01ee('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x01ee('0x12')],'waiting':this['waiting']};var _0xf9361e=md5(JSON[_0x01ee('0x17')](_0x34497d));if(this[_0x01ee('0x1')]!==_0xf9361e){this['md5']=_0xf9361e;io['to'](util[_0x01ee('0x18')](_0x01ee('0x19'),_0x34497d['name']))[_0x01ee('0x1a')](_0x01ee('0x1b'),_0x34497d);}};module[_0x01ee('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index fb0be1a..b4828ac 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 _0x7fbe=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','lodash','moment'];(function(_0x4cec5d,_0x5f5ba1){var _0x3f47e4=function(_0x56b8ff){while(--_0x56b8ff){_0x4cec5d['push'](_0x4cec5d['shift']());}};_0x3f47e4(++_0x5f5ba1);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x334ad2,_0xcd1829){_0x334ad2=_0x334ad2-0x0;var _0x1560eb=_0x7fbe[_0x334ad2];return _0x1560eb;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe7fb('0x0'));var moment=require(_0xe7fb('0x1'));var Agent=require(_0xe7fb('0x2'));var Interval=require(_0xe7fb('0x3'));var OpenchannelQueue=require(_0xe7fb('0x4'));var ChatQueue=require(_0xe7fb('0x5'));var SmsQueue=require(_0xe7fb('0x6'));var MailQueue=require(_0xe7fb('0x7'));var FaxQueue=require(_0xe7fb('0x8'));var WhatsappQueue=require(_0xe7fb('0x9'));var Realtime=function(){this[_0xe7fb('0xa')]={};this[_0xe7fb('0xb')]={};this[_0xe7fb('0xc')]={};this[_0xe7fb('0xd')]={};this['smsQueues']={};this[_0xe7fb('0xe')]={};this[_0xe7fb('0xf')]={};this[_0xe7fb('0x10')]={};this[_0xe7fb('0x11')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xe7fb('0x12')]={};this[_0xe7fb('0x13')]={};this[_0xe7fb('0x14')]={};};function freeIsNotKey(_0x348a73,_0x2a2223,_0x42435c){var _0x3e934b=_[_0xe7fb('0x15')](_0x348a73,function(_0x325035,_0x2fe8ab){return _0x325035[_0x42435c];});for(var _0x2437d4 in _0x2a2223){if(_0x2a2223[_0xe7fb('0x16')](_0x2437d4)){if(!_0x3e934b[_0x2437d4]){delete _0x2a2223[_0x2437d4];}}}}Realtime[_0xe7fb('0x17')][_0xe7fb('0x18')]=function(_0x7fe4d3,_0x598729){for(var _0x278b75 in _0x598729){if(_0x7fe4d3[_0xe7fb('0x16')](_0x278b75)){_0x7fe4d3[_0x278b75]=_0x598729[_0x278b75];}}};Realtime['prototype'][_0xe7fb('0x19')]=function(){var _0x37eb9f=this;return function(_0x482f7d){if(_0x482f7d){freeIsNotKey(_0x482f7d,_0x37eb9f[_0xe7fb('0xa')],'id');for(var _0x559129=0x0,_0x12fff6={},_0x18d23c={};_0x559129<_0x482f7d[_0xe7fb('0x1a')];_0x559129+=0x1){_0x12fff6=_0x482f7d[_0x559129];if(_[_0xe7fb('0x1b')](_0x37eb9f['agents'][_0x12fff6['id']])){_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']]=new Agent(_0x12fff6);}else{_0x37eb9f['mergeFromDatabase'](_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']],_0x12fff6);}}}return _0x37eb9f['agents'];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1c')]=function(){var _0x3f96a7=this;return function(_0x182269){if(_0x182269){freeIsNotKey(_0x182269,_0x3f96a7['intervals'],'id');for(var _0x44466e=0x0,_0x5d1c87={},_0x11cae0={};_0x44466e<_0x182269['length'];_0x44466e+=0x1){_0x5d1c87=_0x182269[_0x44466e];if(_[_0xe7fb('0x1b')](_0x3f96a7['intervals'][_0x5d1c87['id']])){_0x3f96a7[_0xe7fb('0xb')][_0x5d1c87['id']]=new Interval(_0x5d1c87);}else{_0x3f96a7[_0xe7fb('0x18')](_0x3f96a7['intervals'][_0x5d1c87['id']],_0x5d1c87);}}}return _0x3f96a7[_0xe7fb('0xb')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1d')]=function(){var _0x4dcb4b=this;return function(_0x469d50){if(_0x469d50){freeIsNotKey(_0x469d50,_0x4dcb4b[_0xe7fb('0xc')],'id');for(var _0x5da3d9=0x0,_0x5bea27={},_0x52f08b={};_0x5da3d9<_0x469d50[_0xe7fb('0x1a')];_0x5da3d9+=0x1){_0x5bea27=_0x469d50[_0x5da3d9];if(_['isUndefined'](_0x4dcb4b['openchannelQueues'][_0x5bea27['id']])){_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']]=new OpenchannelQueue(_0x5bea27);}else{_0x4dcb4b[_0xe7fb('0x18')](_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']],_0x5bea27);}_0x4dcb4b['openchannelQueues'][_0x5bea27['id']][_0xe7fb('0x1e')]();_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']][_0xe7fb('0x1f')]();}}return _0x4dcb4b[_0xe7fb('0xc')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x20')]=function(){var _0x380130=this;return function(_0x59e015){if(_0x59e015){freeIsNotKey(_0x59e015,_0x380130['chatQueues'],'id');for(var _0x1086e6=0x0,_0x3bdee9={},_0xead63={};_0x1086e6<_0x59e015['length'];_0x1086e6+=0x1){_0x3bdee9=_0x59e015[_0x1086e6];if(_[_0xe7fb('0x1b')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']])){_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]=new ChatQueue(_0x3bdee9);}else{_0x380130[_0xe7fb('0x18')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']],_0x3bdee9);}_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']][_0xe7fb('0x1e')]();_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]['updateRealtime']();}}return _0x380130[_0xe7fb('0xd')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x21')]=function(){var _0x547a04=this;return function(_0x517d70){if(_0x517d70){freeIsNotKey(_0x517d70,_0x547a04[_0xe7fb('0x22')],'id');for(var _0x4a9fea=0x0,_0xac56b4={},_0x2f8774={};_0x4a9fea<_0x517d70[_0xe7fb('0x1a')];_0x4a9fea+=0x1){_0xac56b4=_0x517d70[_0x4a9fea];if(_[_0xe7fb('0x1b')](_0x547a04['smsQueues'][_0xac56b4['id']])){_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']]=new SmsQueue(_0xac56b4);}else{_0x547a04[_0xe7fb('0x18')](_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']],_0xac56b4);}_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']][_0xe7fb('0x1e')]();_0x547a04['smsQueues'][_0xac56b4['id']][_0xe7fb('0x1f')]();}}return _0x547a04[_0xe7fb('0x22')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x23')]=function(){var _0x46f430=this;return function(_0x25e925){if(_0x25e925){freeIsNotKey(_0x25e925,_0x46f430[_0xe7fb('0xe')],'id');for(var _0x147eb1=0x0,_0x389903={},_0x59f9df={};_0x147eb1<_0x25e925[_0xe7fb('0x1a')];_0x147eb1+=0x1){_0x389903=_0x25e925[_0x147eb1];if(_[_0xe7fb('0x1b')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']])){_0x46f430['mailQueues'][_0x389903['id']]=new MailQueue(_0x389903);}else{_0x46f430[_0xe7fb('0x18')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']],_0x389903);}_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1e')]();_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1f')]();}}return _0x46f430[_0xe7fb('0xe')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x24')]=function(){var _0xebfe1d=this;return function(_0x29c34a){if(_0x29c34a){freeIsNotKey(_0x29c34a,_0xebfe1d[_0xe7fb('0xf')],'id');for(var _0x1544f2=0x0,_0x1c81fe={},_0xeb7c29={};_0x1544f2<_0x29c34a[_0xe7fb('0x1a')];_0x1544f2+=0x1){_0x1c81fe=_0x29c34a[_0x1544f2];if(_[_0xe7fb('0x1b')](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']])){_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]=new FaxQueue(_0x1c81fe);}else{_0xebfe1d['mergeFromDatabase'](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']],_0x1c81fe);}_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']][_0xe7fb('0x1e')]();_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]['updateRealtime']();}}return _0xebfe1d[_0xe7fb('0xf')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x25')]=function(){var _0x413a13=this;return function(_0x49fe9d){if(_0x49fe9d){freeIsNotKey(_0x49fe9d,_0x413a13[_0xe7fb('0x10')],'id');for(var _0x451a6c=0x0,_0x34265f={},_0x62a8a1={};_0x451a6c<_0x49fe9d[_0xe7fb('0x1a')];_0x451a6c+=0x1){_0x34265f=_0x49fe9d[_0x451a6c];if(_[_0xe7fb('0x1b')](_0x413a13['whatsappQueues'][_0x34265f['id']])){_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]=new WhatsappQueue(_0x34265f);}else{_0x413a13[_0xe7fb('0x18')](_0x413a13[_0xe7fb('0x10')][_0x34265f['id']],_0x34265f);}_0x413a13['whatsappQueues'][_0x34265f['id']][_0xe7fb('0x1e')]();_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]['updateRealtime']();}}return _0x413a13['whatsappQueues'];};};module['exports']=Realtime; \ No newline at end of file +var _0x34e8=['smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','mergeFromDatabase','prototype','initAgents','length','isUndefined','agents','initIntervals','openchannelQueues','updateRealtime','initChatQueues','updateRouting','initSmsQueues','initMailQueues','initWhatsappQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions'];(function(_0x45406f,_0x4f3882){var _0x29b7f7=function(_0x347f86){while(--_0x347f86){_0x45406f['push'](_0x45406f['shift']());}};_0x29b7f7(++_0x4f3882);}(_0x34e8,0x12c));var _0x834e=function(_0x6b91b9,_0x2bf0b4){_0x6b91b9=_0x6b91b9-0x0;var _0x18221a=_0x34e8[_0x6b91b9];return _0x18221a;};'use strict';var BPromise=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var _=require(_0x834e('0x2'));var moment=require(_0x834e('0x3'));var Agent=require('../model/agent');var Interval=require(_0x834e('0x4'));var OpenchannelQueue=require(_0x834e('0x5'));var ChatQueue=require(_0x834e('0x6'));var SmsQueue=require(_0x834e('0x7'));var MailQueue=require(_0x834e('0x8'));var FaxQueue=require(_0x834e('0x9'));var WhatsappQueue=require(_0x834e('0xa'));var Realtime=function(){this['agents']={};this[_0x834e('0xb')]={};this['openchannelQueues']={};this[_0x834e('0xc')]={};this[_0x834e('0xd')]={};this[_0x834e('0xe')]={};this[_0x834e('0xf')]={};this[_0x834e('0x10')]={};this[_0x834e('0x11')]={};this[_0x834e('0x12')]={};this[_0x834e('0x13')]={};this[_0x834e('0x14')]={};this[_0x834e('0x15')]={};this[_0x834e('0x16')]={};};function freeIsNotKey(_0x36e124,_0x14038b,_0x2e1a37){var _0x293514=_[_0x834e('0x17')](_0x36e124,function(_0x2fd95c,_0x538bb3){return _0x2fd95c[_0x2e1a37];});for(var _0x5e5b6d in _0x14038b){if(_0x14038b[_0x834e('0x18')](_0x5e5b6d)){if(!_0x293514[_0x5e5b6d]){delete _0x14038b[_0x5e5b6d];}}}}Realtime['prototype'][_0x834e('0x19')]=function(_0x2d95f2,_0x28e659){for(var _0x21cc0a in _0x28e659){if(_0x2d95f2['hasOwnProperty'](_0x21cc0a)){_0x2d95f2[_0x21cc0a]=_0x28e659[_0x21cc0a];}}};Realtime[_0x834e('0x1a')][_0x834e('0x1b')]=function(){var _0x57274a=this;return function(_0x316205){if(_0x316205){freeIsNotKey(_0x316205,_0x57274a['agents'],'id');for(var _0x38a8cd=0x0,_0x36d443={},_0x478afe={};_0x38a8cd<_0x316205[_0x834e('0x1c')];_0x38a8cd+=0x1){_0x36d443=_0x316205[_0x38a8cd];if(_[_0x834e('0x1d')](_0x57274a[_0x834e('0x1e')][_0x36d443['id']])){_0x57274a['agents'][_0x36d443['id']]=new Agent(_0x36d443);}else{_0x57274a[_0x834e('0x19')](_0x57274a[_0x834e('0x1e')][_0x36d443['id']],_0x36d443);}}}return _0x57274a[_0x834e('0x1e')];};};Realtime[_0x834e('0x1a')][_0x834e('0x1f')]=function(){var _0x254677=this;return function(_0x1dd214){if(_0x1dd214){freeIsNotKey(_0x1dd214,_0x254677['intervals'],'id');for(var _0x2545b4=0x0,_0x1fd2c6={},_0x113ff4={};_0x2545b4<_0x1dd214[_0x834e('0x1c')];_0x2545b4+=0x1){_0x1fd2c6=_0x1dd214[_0x2545b4];if(_['isUndefined'](_0x254677[_0x834e('0xb')][_0x1fd2c6['id']])){_0x254677[_0x834e('0xb')][_0x1fd2c6['id']]=new Interval(_0x1fd2c6);}else{_0x254677['mergeFromDatabase'](_0x254677[_0x834e('0xb')][_0x1fd2c6['id']],_0x1fd2c6);}}}return _0x254677[_0x834e('0xb')];};};Realtime[_0x834e('0x1a')]['initOpenchannelQueues']=function(){var _0x4e3f48=this;return function(_0x231619){if(_0x231619){freeIsNotKey(_0x231619,_0x4e3f48[_0x834e('0x20')],'id');for(var _0x589dde=0x0,_0x25ee1d={},_0x1dc1e0={};_0x589dde<_0x231619['length'];_0x589dde+=0x1){_0x25ee1d=_0x231619[_0x589dde];if(_[_0x834e('0x1d')](_0x4e3f48[_0x834e('0x20')][_0x25ee1d['id']])){_0x4e3f48[_0x834e('0x20')][_0x25ee1d['id']]=new OpenchannelQueue(_0x25ee1d);}else{_0x4e3f48['mergeFromDatabase'](_0x4e3f48[_0x834e('0x20')][_0x25ee1d['id']],_0x25ee1d);}_0x4e3f48[_0x834e('0x20')][_0x25ee1d['id']]['updateRouting']();_0x4e3f48['openchannelQueues'][_0x25ee1d['id']][_0x834e('0x21')]();}}return _0x4e3f48['openchannelQueues'];};};Realtime[_0x834e('0x1a')][_0x834e('0x22')]=function(){var _0x3db026=this;return function(_0x2cc2eb){if(_0x2cc2eb){freeIsNotKey(_0x2cc2eb,_0x3db026[_0x834e('0xc')],'id');for(var _0x130cc5=0x0,_0x491919={},_0x510780={};_0x130cc5<_0x2cc2eb['length'];_0x130cc5+=0x1){_0x491919=_0x2cc2eb[_0x130cc5];if(_['isUndefined'](_0x3db026[_0x834e('0xc')][_0x491919['id']])){_0x3db026[_0x834e('0xc')][_0x491919['id']]=new ChatQueue(_0x491919);}else{_0x3db026[_0x834e('0x19')](_0x3db026['chatQueues'][_0x491919['id']],_0x491919);}_0x3db026[_0x834e('0xc')][_0x491919['id']][_0x834e('0x23')]();_0x3db026[_0x834e('0xc')][_0x491919['id']][_0x834e('0x21')]();}}return _0x3db026[_0x834e('0xc')];};};Realtime[_0x834e('0x1a')][_0x834e('0x24')]=function(){var _0xfaf716=this;return function(_0x278db3){if(_0x278db3){freeIsNotKey(_0x278db3,_0xfaf716['smsQueues'],'id');for(var _0xef9ec2=0x0,_0x5cad11={},_0x2c75c2={};_0xef9ec2<_0x278db3[_0x834e('0x1c')];_0xef9ec2+=0x1){_0x5cad11=_0x278db3[_0xef9ec2];if(_[_0x834e('0x1d')](_0xfaf716[_0x834e('0xd')][_0x5cad11['id']])){_0xfaf716[_0x834e('0xd')][_0x5cad11['id']]=new SmsQueue(_0x5cad11);}else{_0xfaf716[_0x834e('0x19')](_0xfaf716[_0x834e('0xd')][_0x5cad11['id']],_0x5cad11);}_0xfaf716[_0x834e('0xd')][_0x5cad11['id']][_0x834e('0x23')]();_0xfaf716[_0x834e('0xd')][_0x5cad11['id']]['updateRealtime']();}}return _0xfaf716[_0x834e('0xd')];};};Realtime[_0x834e('0x1a')][_0x834e('0x25')]=function(){var _0xaf01f4=this;return function(_0x595cc0){if(_0x595cc0){freeIsNotKey(_0x595cc0,_0xaf01f4[_0x834e('0xe')],'id');for(var _0x379d60=0x0,_0x4b12f5={},_0x496533={};_0x379d60<_0x595cc0['length'];_0x379d60+=0x1){_0x4b12f5=_0x595cc0[_0x379d60];if(_[_0x834e('0x1d')](_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']])){_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']]=new MailQueue(_0x4b12f5);}else{_0xaf01f4[_0x834e('0x19')](_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']],_0x4b12f5);}_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']]['updateRouting']();_0xaf01f4[_0x834e('0xe')][_0x4b12f5['id']]['updateRealtime']();}}return _0xaf01f4[_0x834e('0xe')];};};Realtime[_0x834e('0x1a')]['initFaxQueues']=function(){var _0x18ac3b=this;return function(_0x2f56c7){if(_0x2f56c7){freeIsNotKey(_0x2f56c7,_0x18ac3b['faxQueues'],'id');for(var _0x481f70=0x0,_0x388711={},_0xd0d43a={};_0x481f70<_0x2f56c7[_0x834e('0x1c')];_0x481f70+=0x1){_0x388711=_0x2f56c7[_0x481f70];if(_[_0x834e('0x1d')](_0x18ac3b[_0x834e('0xf')][_0x388711['id']])){_0x18ac3b['faxQueues'][_0x388711['id']]=new FaxQueue(_0x388711);}else{_0x18ac3b[_0x834e('0x19')](_0x18ac3b['faxQueues'][_0x388711['id']],_0x388711);}_0x18ac3b['faxQueues'][_0x388711['id']][_0x834e('0x23')]();_0x18ac3b['faxQueues'][_0x388711['id']][_0x834e('0x21')]();}}return _0x18ac3b[_0x834e('0xf')];};};Realtime[_0x834e('0x1a')][_0x834e('0x26')]=function(){var _0x2b7933=this;return function(_0x574ea8){if(_0x574ea8){freeIsNotKey(_0x574ea8,_0x2b7933[_0x834e('0x10')],'id');for(var _0x26b847=0x0,_0x38f266={},_0x58c5fb={};_0x26b847<_0x574ea8[_0x834e('0x1c')];_0x26b847+=0x1){_0x38f266=_0x574ea8[_0x26b847];if(_[_0x834e('0x1d')](_0x2b7933['whatsappQueues'][_0x38f266['id']])){_0x2b7933[_0x834e('0x10')][_0x38f266['id']]=new WhatsappQueue(_0x38f266);}else{_0x2b7933['mergeFromDatabase'](_0x2b7933[_0x834e('0x10')][_0x38f266['id']],_0x38f266);}_0x2b7933[_0x834e('0x10')][_0x38f266['id']]['updateRouting']();_0x2b7933['whatsappQueues'][_0x38f266['id']][_0x834e('0x21')]();}}return _0x2b7933[_0x834e('0x10')];};};module[_0x834e('0x27')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 861d40f..f582fb0 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 _0x70b9=['Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x70b9,0xb4));var _0x970b=function(_0x45c7ac,_0x6f7f97){_0x45c7ac=_0x45c7ac-0x0;var _0x18f6aa=_0x70b9[_0x45c7ac];return _0x18f6aa;};'use strict';var client=require(_0x970b('0x0'));exports[_0x970b('0x1')]=function(_0x12b045,_0x48f845){return client[_0x970b('0x2')](_0x970b('0x3'),{'body':_0x48f845,'options':{'where':{'id':_0x12b045}},'log':_0x970b('0x4')});};exports[_0x970b('0x5')]=function(_0x3e65e2,_0x1f7f8e){return client['Request']('AddTagsToChatInteraction',{'body':_0x1f7f8e,'options':{'where':{'id':_0x3e65e2}},'log':_0x970b('0x6')});}; \ No newline at end of file +var _0xb7ae=['Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x4c340b,_0x1d5df0){var _0x4b90c6=function(_0x432ca8){while(--_0x432ca8){_0x4c340b['push'](_0x4c340b['shift']());}};_0x4b90c6(++_0x1d5df0);}(_0xb7ae,0xdc));var _0xeb7a=function(_0x3bb5d2,_0x3b6e95){_0x3bb5d2=_0x3bb5d2-0x0;var _0x2ab37b=_0xb7ae[_0x3bb5d2];return _0x2ab37b;};'use strict';var client=require(_0xeb7a('0x0'));exports[_0xeb7a('0x1')]=function(_0xbb4b1b,_0x2743c7){return client[_0xeb7a('0x2')](_0xeb7a('0x3'),{'body':_0x2743c7,'options':{'where':{'id':_0xbb4b1b}},'log':'updateChatInteraction'});};exports[_0xeb7a('0x4')]=function(_0x1230aa,_0x2bb41a){return client['Request']('AddTagsToChatInteraction',{'body':_0x2bb41a,'options':{'where':{'id':_0x1230aa}},'log':_0xeb7a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 86f8b10..ae3f408 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 _0x8e51=['createChatMessage'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x8e51,0x99));var _0x18e5=function(_0xc1de01,_0x4d88ce){_0xc1de01=_0xc1de01-0x0;var _0x5cdbdc=_0x8e51[_0xc1de01];return _0x5cdbdc;};'use strict';var client=require('../client');exports['create']=function(_0x1d1c8a){return client['Request']('CreateChatMessage',{'body':_0x1d1c8a,'log':_0x18e5('0x0')});}; \ No newline at end of file +var _0xf7a8=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x513549,_0x1b16ad){var _0x4f0334=function(_0xd86f06){while(--_0xd86f06){_0x513549['push'](_0x513549['shift']());}};_0x4f0334(++_0x1b16ad);}(_0xf7a8,0xcc));var _0x8f7a=function(_0x5eb574,_0x2ddd49){_0x5eb574=_0x5eb574-0x0;var _0x389fd0=_0xf7a8[_0x5eb574];return _0x389fd0;};'use strict';var client=require('../client');exports[_0x8f7a('0x0')]=function(_0x36f532){return client[_0x8f7a('0x1')](_0x8f7a('0x2'),{'body':_0x36f532,'log':_0x8f7a('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index ef02e50..b7dad0a 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 _0x6547=['../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','Agents'];(function(_0x22c2da,_0x569b31){var _0x65a816=function(_0x42c4ef){while(--_0x42c4ef){_0x22c2da['push'](_0x22c2da['shift']());}};_0x65a816(++_0x569b31);}(_0x6547,0x105));var _0x7654=function(_0x1b4c42,_0x4bf57b){_0x1b4c42=_0x1b4c42-0x0;var _0x28aded=_0x6547[_0x1b4c42];return _0x28aded;};'use strict';var client=require(_0x7654('0x0'));exports[_0x7654('0x1')]=function(){return function(){return client[_0x7654('0x2')](_0x7654('0x3'),{'options':{'raw':![],'attributes':['id',_0x7654('0x4'),_0x7654('0x5'),_0x7654('0x6')],'include':[{'model':_0x7654('0x7'),'as':_0x7654('0x8'),'attributes':['id',_0x7654('0x4'),'online','chatPause']}]},'log':_0x7654('0x1')});};}; \ No newline at end of file +var _0x5f09=['online','../client','getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f09,0x7f));var _0x95f0=function(_0x5b0013,_0x42578e){_0x5b0013=_0x5b0013-0x0;var _0x34dd4f=_0x5f09[_0x5b0013];return _0x34dd4f;};'use strict';var client=require(_0x95f0('0x0'));exports[_0x95f0('0x1')]=function(){return function(){return client[_0x95f0('0x2')](_0x95f0('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x95f0('0x4'),_0x95f0('0x5')],'include':[{'model':_0x95f0('0x6'),'as':_0x95f0('0x7'),'attributes':['id','name',_0x95f0('0x8'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index e72700c..19da6f4 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 _0xbc82=['../client','CreateChatQueueReport','UpdateChatQueueReport'];(function(_0x34e830,_0x3c3620){var _0x462e4b=function(_0x113845){while(--_0x113845){_0x34e830['push'](_0x34e830['shift']());}};_0x462e4b(++_0x3c3620);}(_0xbc82,0x13e));var _0x2bc8=function(_0xde8111,_0x15702c){_0xde8111=_0xde8111-0x0;var _0x29af0b=_0xbc82[_0xde8111];return _0x29af0b;};'use strict';var client=require(_0x2bc8('0x0'));exports['create']=function(_0x5cd5de){return client['Request'](_0x2bc8('0x1'),{'body':_0x5cd5de,'log':'CreateChatQueueReport'});};exports['update']=function(_0x1320a5,_0x5c8329){return client['Request'](_0x2bc8('0x2'),{'body':_0x5c8329,'options':{'where':{'uniqueid':_0x1320a5},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xc17f=['create','Request','CreateChatQueueReport','UpdateChatQueueReport','../client'];(function(_0x32bb8f,_0x3d4dfa){var _0x4c5327=function(_0x76d066){while(--_0x76d066){_0x32bb8f['push'](_0x32bb8f['shift']());}};_0x4c5327(++_0x3d4dfa);}(_0xc17f,0xb8));var _0xfc17=function(_0x436b41,_0x26e3d3){_0x436b41=_0x436b41-0x0;var _0xfaa7d0=_0xc17f[_0x436b41];return _0xfaa7d0;};'use strict';var client=require(_0xfc17('0x0'));exports[_0xfc17('0x1')]=function(_0x45c778){return client[_0xfc17('0x2')](_0xfc17('0x3'),{'body':_0x45c778,'log':_0xfc17('0x3')});};exports['update']=function(_0x224edf,_0x5f2b93){return client[_0xfc17('0x2')](_0xfc17('0x4'),{'body':_0x5f2b93,'options':{'where':{'uniqueid':_0x224edf},'order':[['id','DESC']],'limit':0x1},'log':_0xfc17('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8b6ace9..a00be38 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 _0x0cc7=['addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','addTags','Request'];(function(_0x46800d,_0x588500){var _0x3824cd=function(_0x14b132){while(--_0x14b132){_0x46800d['push'](_0x46800d['shift']());}};_0x3824cd(++_0x588500);}(_0x0cc7,0x9d));var _0x70cc=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x0cc7[_0x1573ea];return _0x51c0e2;};'use strict';var client=require(_0x70cc('0x0'));exports[_0x70cc('0x1')]=function(_0x1a3ed8,_0x9bc496){return client['Request'](_0x70cc('0x2'),{'body':_0x9bc496,'options':{'where':{'id':_0x1a3ed8}},'log':'updateFaxInteraction'});};exports[_0x70cc('0x3')]=function(_0x669c17,_0x5f278d){return client[_0x70cc('0x4')]('AddTagsToFaxInteraction',{'body':_0x5f278d,'options':{'where':{'id':_0x669c17}},'log':_0x70cc('0x5')});}; \ No newline at end of file +var _0x433e=['AddTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x23199d,_0x3e9ad6){var _0x2ff1a3=function(_0x2d4cbe){while(--_0x2d4cbe){_0x23199d['push'](_0x23199d['shift']());}};_0x2ff1a3(++_0x3e9ad6);}(_0x433e,0x9d));var _0xe433=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x433e[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xe433('0x0'));exports[_0xe433('0x1')]=function(_0x2a6fca,_0x588f82){return client['Request'](_0xe433('0x2'),{'body':_0x588f82,'options':{'where':{'id':_0x2a6fca}},'log':_0xe433('0x3')});};exports[_0xe433('0x4')]=function(_0x14d130,_0x1819a2){return client['Request'](_0xe433('0x5'),{'body':_0x1819a2,'options':{'where':{'id':_0x14d130}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index ab16726..fea82e3 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 _0x8b68=['Request','CreateFaxMessage','../client','create'];(function(_0x115b0a,_0x5c5982){var _0x4421de=function(_0x144f05){while(--_0x144f05){_0x115b0a['push'](_0x115b0a['shift']());}};_0x4421de(++_0x5c5982);}(_0x8b68,0x82));var _0x88b6=function(_0x45873c,_0x200a54){_0x45873c=_0x45873c-0x0;var _0x352992=_0x8b68[_0x45873c];return _0x352992;};'use strict';var client=require(_0x88b6('0x0'));exports[_0x88b6('0x1')]=function(_0x36ac63){return client[_0x88b6('0x2')](_0x88b6('0x3'),{'body':_0x36ac63,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x263a=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x4c213c,_0x5154c4){var _0x55ee44=function(_0x57f89f){while(--_0x57f89f){_0x4c213c['push'](_0x4c213c['shift']());}};_0x55ee44(++_0x5154c4);}(_0x263a,0x119));var _0xa263=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x263a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xa263('0x0'));exports[_0xa263('0x1')]=function(_0x8bec5a){return client['Request'](_0xa263('0x2'),{'body':_0x8bec5a,'log':_0xa263('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 453d145..1795a08 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 _0xeada=['Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','User'];(function(_0x3bae43,_0x45b347){var _0x3eb1aa=function(_0x3da9ef){while(--_0x3da9ef){_0x3bae43['push'](_0x3bae43['shift']());}};_0x3eb1aa(++_0x45b347);}(_0xeada,0x1d9));var _0xaead=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xeada[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xaead('0x0'));exports[_0xaead('0x1')]=function(){return function(){return client[_0xaead('0x2')](_0xaead('0x3'),{'options':{'raw':![],'attributes':['id',_0xaead('0x4'),_0xaead('0x5'),'strategy'],'include':[{'model':_0xaead('0x6'),'as':_0xaead('0x7'),'attributes':['id',_0xaead('0x4'),_0xaead('0x8'),_0xaead('0x9')]}]},'log':_0xaead('0x1')});};}; \ No newline at end of file +var _0x6d8e=['../client','getFaxQueues','GetFaxQueue','timeout','User','Agents','name','online'];(function(_0xfd86d8,_0x391bce){var _0x837fa5=function(_0x3cfdf7){while(--_0x3cfdf7){_0xfd86d8['push'](_0xfd86d8['shift']());}};_0x837fa5(++_0x391bce);}(_0x6d8e,0x1b8));var _0xe6d8=function(_0x1dc80f,_0x8b512f){_0x1dc80f=_0x1dc80f-0x0;var _0x53b0ad=_0x6d8e[_0x1dc80f];return _0x53b0ad;};'use strict';var client=require(_0xe6d8('0x0'));exports[_0xe6d8('0x1')]=function(){return function(){return client['Request'](_0xe6d8('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe6d8('0x3'),'strategy'],'include':[{'model':_0xe6d8('0x4'),'as':_0xe6d8('0x5'),'attributes':['id',_0xe6d8('0x6'),_0xe6d8('0x7'),'faxPause']}]},'log':_0xe6d8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index ce3616c..0c05f1b 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 _0x0ae6=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0xf75dda,_0x18f7ed){var _0x5e0ca1=function(_0x12ecda){while(--_0x12ecda){_0xf75dda['push'](_0xf75dda['shift']());}};_0x5e0ca1(++_0x18f7ed);}(_0x0ae6,0x15e));var _0x60ae=function(_0xea745b,_0x49ccfa){_0xea745b=_0xea745b-0x0;var _0xd4052c=_0x0ae6[_0xea745b];return _0xd4052c;};'use strict';var client=require('../client');exports[_0x60ae('0x0')]=function(_0x2d94e4){return client[_0x60ae('0x1')](_0x60ae('0x2'),{'body':_0x2d94e4,'log':_0x60ae('0x2')});};exports[_0x60ae('0x3')]=function(_0x2ebd81,_0x519d66){return client['Request'](_0x60ae('0x4'),{'body':_0x519d66,'options':{'where':{'uniqueid':_0x2ebd81},'order':[['id','DESC']],'limit':0x1},'log':_0x60ae('0x4')});}; \ No newline at end of file +var _0x1154=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0x3e038b,_0x109289){var _0x59a2ba=function(_0x3851b1){while(--_0x3851b1){_0x3e038b['push'](_0x3e038b['shift']());}};_0x59a2ba(++_0x109289);}(_0x1154,0x131));var _0x4115=function(_0x57b43a,_0x2b31a3){_0x57b43a=_0x57b43a-0x0;var _0x384eea=_0x1154[_0x57b43a];return _0x384eea;};'use strict';var client=require('../client');exports[_0x4115('0x0')]=function(_0x5ba7d8){return client[_0x4115('0x1')](_0x4115('0x2'),{'body':_0x5ba7d8,'log':_0x4115('0x2')});};exports[_0x4115('0x3')]=function(_0x4c3abd,_0x10a885){return client['Request'](_0x4115('0x4'),{'body':_0x10a885,'options':{'where':{'uniqueid':_0x4c3abd},'order':[['id',_0x4115('0x5')]],'limit':0x1},'log':_0x4115('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 9b8280b..4a0ad76 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 _0xa7fa=['../client','GetInterval','name','Interval','Intervals','interval','getIntervals'];(function(_0x3895eb,_0x5bbea7){var _0x3bfa1b=function(_0x38619c){while(--_0x38619c){_0x3895eb['push'](_0x3895eb['shift']());}};_0x3bfa1b(++_0x5bbea7);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa7fa[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xaa7f('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0xaa7f('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xaa7f('0x2')],'include':[{'model':_0xaa7f('0x3'),'as':_0xaa7f('0x4'),'attributes':['id','name',_0xaa7f('0x5')]}]},'log':_0xaa7f('0x6')});};}; \ No newline at end of file +var _0x4f7b=['Request','GetInterval','Interval','Intervals','name','interval','../client','getIntervals'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x39b011,_0x2fb123){_0x39b011=_0x39b011-0x0;var _0x5b422e=_0x4f7b[_0x39b011];return _0x5b422e;};'use strict';var client=require(_0xb4f7('0x0'));exports[_0xb4f7('0x1')]=function(){return function(){return client[_0xb4f7('0x2')](_0xb4f7('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xb4f7('0x4'),'as':_0xb4f7('0x5'),'attributes':['id',_0xb4f7('0x6'),_0xb4f7('0x7')]}]},'log':_0xb4f7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c34bf5f..ce742d1 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 _0x3a16=['../client','update','Request','UpdateMailInteraction','addTags','addTagsToChatInteraction'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x3a16,0xae));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x63a1('0x0'));exports[_0x63a1('0x1')]=function(_0x16f56e,_0x11466c){return client[_0x63a1('0x2')](_0x63a1('0x3'),{'body':_0x11466c,'options':{'where':{'id':_0x16f56e}},'log':'updateMailInteraction'});};exports[_0x63a1('0x4')]=function(_0x159439,_0x3ade68){return client[_0x63a1('0x2')]('AddTagsToMailInteraction',{'body':_0x3ade68,'options':{'where':{'id':_0x159439}},'log':_0x63a1('0x5')});}; \ No newline at end of file +var _0xd1c9=['Request','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x3ab47f,_0x441b32){var _0x1221fe=function(_0x5176b6){while(--_0x5176b6){_0x3ab47f['push'](_0x3ab47f['shift']());}};_0x1221fe(++_0x441b32);}(_0xd1c9,0x103));var _0x9d1c=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0xd1c9[_0x547add];return _0x2ed1f3;};'use strict';var client=require(_0x9d1c('0x0'));exports[_0x9d1c('0x1')]=function(_0x348fc2,_0x54702d){return client['Request'](_0x9d1c('0x2'),{'body':_0x54702d,'options':{'where':{'id':_0x348fc2}},'log':_0x9d1c('0x3')});};exports[_0x9d1c('0x4')]=function(_0xffeb4b,_0x23c95e){return client[_0x9d1c('0x5')](_0x9d1c('0x6'),{'body':_0x23c95e,'options':{'where':{'id':_0xffeb4b}},'log':_0x9d1c('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 5c796f7..06381b2 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 _0xdf35=['create','Request','createMailMessage','../client'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xdf35,0xcb));var _0x5df3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdf35[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x5df3('0x0'));exports[_0x5df3('0x1')]=function(_0xcbfa57){return client[_0x5df3('0x2')]('CreateMailMessage',{'body':_0xcbfa57,'log':_0x5df3('0x3')});}; \ No newline at end of file +var _0x3ed6=['Request','createMailMessage','create'];(function(_0x5b0329,_0x36c2a2){var _0x38c925=function(_0x1b9c70){while(--_0x1b9c70){_0x5b0329['push'](_0x5b0329['shift']());}};_0x38c925(++_0x36c2a2);}(_0x3ed6,0xb0));var _0x63ed=function(_0x1d069f,_0x181188){_0x1d069f=_0x1d069f-0x0;var _0x30c238=_0x3ed6[_0x1d069f];return _0x30c238;};'use strict';var client=require('../client');exports[_0x63ed('0x0')]=function(_0x296e8b){return client[_0x63ed('0x1')]('CreateMailMessage',{'body':_0x296e8b,'log':_0x63ed('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 2ccb0ef..eae99cb 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 _0x9002=['mailPause','getMailQueues','Request','strategy','Agents','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9002,0xaf));var _0x2900=function(_0x27a3d1,_0x40d76b){_0x27a3d1=_0x27a3d1-0x0;var _0x267abc=_0x9002[_0x27a3d1];return _0x267abc;};'use strict';var client=require('../client');exports[_0x2900('0x0')]=function(){return function(){return client[_0x2900('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0x2900('0x2')],'include':[{'model':'User','as':_0x2900('0x3'),'attributes':['id',_0x2900('0x4'),'online',_0x2900('0x5')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xbba4=['name','strategy','User','Agents','online','mailPause','getMailQueues'];(function(_0x4d319c,_0x446ee7){var _0x5e3419=function(_0x46e059){while(--_0x46e059){_0x4d319c['push'](_0x4d319c['shift']());}};_0x5e3419(++_0x446ee7);}(_0xbba4,0x187));var _0x4bba=function(_0x22a75f,_0x29c20e){_0x22a75f=_0x22a75f-0x0;var _0x578d97=_0xbba4[_0x22a75f];return _0x578d97;};'use strict';var client=require('../client');exports[_0x4bba('0x0')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x4bba('0x1'),'timeout',_0x4bba('0x2')],'include':[{'model':_0x4bba('0x3'),'as':_0x4bba('0x4'),'attributes':['id',_0x4bba('0x1'),_0x4bba('0x5'),_0x4bba('0x6')]}]},'log':_0x4bba('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 8c5ced1..7eff933 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 _0xd24a=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x4fd97f,_0x3c77e0){var _0x5de116=function(_0x469fb0){while(--_0x469fb0){_0x4fd97f['push'](_0x4fd97f['shift']());}};_0x5de116(++_0x3c77e0);}(_0xd24a,0xe0));var _0xad24=function(_0x4dc1d5,_0x195206){_0x4dc1d5=_0x4dc1d5-0x0;var _0x2f963b=_0xd24a[_0x4dc1d5];return _0x2f963b;};'use strict';var client=require(_0xad24('0x0'));exports[_0xad24('0x1')]=function(_0x19e001){return client[_0xad24('0x2')]('CreateMailQueueReport',{'body':_0x19e001,'log':_0xad24('0x3')});};exports[_0xad24('0x4')]=function(_0x2a6f88,_0x2b2fed){return client[_0xad24('0x2')](_0xad24('0x5'),{'body':_0x2b2fed,'options':{'where':{'uniqueid':_0x2a6f88},'order':[['id',_0xad24('0x6')]],'limit':0x1},'log':_0xad24('0x5')});}; \ No newline at end of file +var _0x678d=['CreateMailQueueReport','Request','UpdateMailQueueReport','../client','create'];(function(_0x310280,_0x2a5d1b){var _0x4297d4=function(_0x5ae379){while(--_0x5ae379){_0x310280['push'](_0x310280['shift']());}};_0x4297d4(++_0x2a5d1b);}(_0x678d,0x1cf));var _0xd678=function(_0x1852a0,_0x578ef8){_0x1852a0=_0x1852a0-0x0;var _0x640c23=_0x678d[_0x1852a0];return _0x640c23;};'use strict';var client=require(_0xd678('0x0'));exports[_0xd678('0x1')]=function(_0x4d9fac){return client['Request'](_0xd678('0x2'),{'body':_0x4d9fac,'log':_0xd678('0x2')});};exports['update']=function(_0x46615f,_0x29220e){return client[_0xd678('0x3')]('UpdateMailQueueReport',{'body':_0x29220e,'options':{'where':{'uniqueid':_0x46615f},'order':[['id','DESC']],'limit':0x1},'log':_0xd678('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c73b815..bfc0f9e 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 _0x8aaf=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x8c6105,_0x530644){var _0x6f46be=function(_0x4ad93c){while(--_0x4ad93c){_0x8c6105['push'](_0x8c6105['shift']());}};_0x6f46be(++_0x530644);}(_0x8aaf,0x110));var _0xf8aa=function(_0x537a5c,_0x2ea976){_0x537a5c=_0x537a5c-0x0;var _0x55e685=_0x8aaf[_0x537a5c];return _0x55e685;};'use strict';var client=require(_0xf8aa('0x0'));exports[_0xf8aa('0x1')]=function(_0x38d275,_0x3ead57){return client[_0xf8aa('0x2')](_0xf8aa('0x3'),{'body':_0x3ead57,'options':{'where':{'id':_0x38d275}},'log':_0xf8aa('0x4')});};exports[_0xf8aa('0x5')]=function(_0x5c0d23,_0x535eb3){return client[_0xf8aa('0x2')](_0xf8aa('0x6'),{'body':_0x535eb3,'options':{'where':{'id':_0x5c0d23}},'log':_0xf8aa('0x7')});}; \ No newline at end of file +var _0x705f=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x462000,_0x4e47c8){var _0x33f58c=function(_0x4c6e66){while(--_0x4c6e66){_0x462000['push'](_0x462000['shift']());}};_0x33f58c(++_0x4e47c8);}(_0x705f,0xa4));var _0xf705=function(_0x3340c8,_0x3d67d7){_0x3340c8=_0x3340c8-0x0;var _0x30ca8a=_0x705f[_0x3340c8];return _0x30ca8a;};'use strict';var client=require(_0xf705('0x0'));exports[_0xf705('0x1')]=function(_0x14acd4,_0x5a0864){return client[_0xf705('0x2')](_0xf705('0x3'),{'body':_0x5a0864,'options':{'where':{'id':_0x14acd4}},'log':_0xf705('0x4')});};exports[_0xf705('0x5')]=function(_0x476348,_0x1d7b07){return client[_0xf705('0x2')](_0xf705('0x6'),{'body':_0x1d7b07,'options':{'where':{'id':_0x476348}},'log':_0xf705('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index be8586d..7ffe72b 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 _0xf4eb=['../client','createOpenchannelMessage'];(function(_0x40271a,_0x3840ee){var _0x1df986=function(_0xe46730){while(--_0xe46730){_0x40271a['push'](_0x40271a['shift']());}};_0x1df986(++_0x3840ee);}(_0xf4eb,0xec));var _0xbf4e=function(_0x599c36,_0x25ce43){_0x599c36=_0x599c36-0x0;var _0x44a4a6=_0xf4eb[_0x599c36];return _0x44a4a6;};'use strict';var client=require(_0xbf4e('0x0'));exports['create']=function(_0x50f2fc){return client['Request']('CreateOpenchannelMessage',{'body':_0x50f2fc,'log':_0xbf4e('0x1')});}; \ No newline at end of file +var _0x54ef=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x24e2f5,_0xf4105f){var _0x354138=function(_0x5c437d){while(--_0x5c437d){_0x24e2f5['push'](_0x24e2f5['shift']());}};_0x354138(++_0xf4105f);}(_0x54ef,0x112));var _0xf54e=function(_0x5ab207,_0x3a387a){_0x5ab207=_0x5ab207-0x0;var _0x3ac0b9=_0x54ef[_0x5ab207];return _0x3ac0b9;};'use strict';var client=require(_0xf54e('0x0'));exports[_0xf54e('0x1')]=function(_0x12c070){return client['Request'](_0xf54e('0x2'),{'body':_0x12c070,'log':_0xf54e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index ce2781a..4d53b8d 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 _0x80c7=['Agents','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x658a30,_0x492ba9){var _0x2bb962=function(_0x2532b3){while(--_0x2532b3){_0x658a30['push'](_0x658a30['shift']());}};_0x2bb962(++_0x492ba9);}(_0x80c7,0xb7));var _0x780c=function(_0x4561cf,_0x1fe710){_0x4561cf=_0x4561cf-0x0;var _0x2505d1=_0x80c7[_0x4561cf];return _0x2505d1;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x780c('0x0')](_0x780c('0x1'),{'options':{'raw':![],'attributes':['id',_0x780c('0x2'),_0x780c('0x3'),_0x780c('0x4')],'include':[{'model':_0x780c('0x5'),'as':_0x780c('0x6'),'attributes':['id',_0x780c('0x2'),'online',_0x780c('0x7')]}]},'log':_0x780c('0x8')});};}; \ No newline at end of file +var _0x1070=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents','online'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x1070,0x197));var _0x0107=function(_0x2e9232,_0x50528a){_0x2e9232=_0x2e9232-0x0;var _0x377122=_0x1070[_0x2e9232];return _0x377122;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0x0107('0x0')](_0x0107('0x1'),{'options':{'raw':![],'attributes':['id',_0x0107('0x2'),'timeout',_0x0107('0x3')],'include':[{'model':_0x0107('0x4'),'as':_0x0107('0x5'),'attributes':['id',_0x0107('0x2'),_0x0107('0x6'),_0x0107('0x7')]}]},'log':_0x0107('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 095fc6b..e3cfb65 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 _0x4b26=['DESC','UpdateOpenchannelQueueReport','../client','create','CreateOpenchannelQueueReport','update','Request'];(function(_0x197dd7,_0x343460){var _0x42b03a=function(_0x4c5e4e){while(--_0x4c5e4e){_0x197dd7['push'](_0x197dd7['shift']());}};_0x42b03a(++_0x343460);}(_0x4b26,0xe2));var _0x64b2=function(_0x5311d7,_0x148bc4){_0x5311d7=_0x5311d7-0x0;var _0x339131=_0x4b26[_0x5311d7];return _0x339131;};'use strict';var client=require(_0x64b2('0x0'));exports[_0x64b2('0x1')]=function(_0x35bef0){return client['Request'](_0x64b2('0x2'),{'body':_0x35bef0,'log':_0x64b2('0x2')});};exports[_0x64b2('0x3')]=function(_0x2ec661,_0x227805){return client[_0x64b2('0x4')]('UpdateOpenchannelQueueReport',{'body':_0x227805,'options':{'where':{'uniqueid':_0x2ec661},'order':[['id',_0x64b2('0x5')]],'limit':0x1},'log':_0x64b2('0x6')});}; \ No newline at end of file +var _0x1d44=['DESC','../client','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x10a13f,_0x5373d5){var _0x173fcc=function(_0x5f458c){while(--_0x5f458c){_0x10a13f['push'](_0x10a13f['shift']());}};_0x173fcc(++_0x5373d5);}(_0x1d44,0x16e));var _0x41d4=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0x1d44[_0xf10840];return _0x1fdf7e;};'use strict';var client=require(_0x41d4('0x0'));exports['create']=function(_0x23b69e){return client[_0x41d4('0x1')]('CreateOpenchannelQueueReport',{'body':_0x23b69e,'log':_0x41d4('0x2')});};exports['update']=function(_0x106424,_0x5d04bd){return client[_0x41d4('0x1')](_0x41d4('0x3'),{'body':_0x5d04bd,'options':{'where':{'uniqueid':_0x106424},'order':[['id',_0x41d4('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 7c1cacc..ab59085 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 _0x965d=['addTags','../client','update','Request','UpdateSmsInteraction'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x965d,0x1be));var _0xd965=function(_0x323b7a,_0x2fac68){_0x323b7a=_0x323b7a-0x0;var _0xb13ae4=_0x965d[_0x323b7a];return _0xb13ae4;};'use strict';var client=require(_0xd965('0x0'));exports[_0xd965('0x1')]=function(_0x4de48c,_0x1e6958){return client[_0xd965('0x2')](_0xd965('0x3'),{'body':_0x1e6958,'options':{'where':{'id':_0x4de48c}},'log':'updateSmsInteraction'});};exports[_0xd965('0x4')]=function(_0x10fc54,_0x2c2b60){return client['Request']('AddTagsToSmsInteraction',{'body':_0x2c2b60,'options':{'where':{'id':_0x10fc54}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x5c7b=['AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags'];(function(_0x21ad60,_0x181dd2){var _0x531c8e=function(_0x9f9f91){while(--_0x9f9f91){_0x21ad60['push'](_0x21ad60['shift']());}};_0x531c8e(++_0x181dd2);}(_0x5c7b,0x9c));var _0xb5c7=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5c7b[_0x138adb];return _0x1b27f2;};'use strict';var client=require('../client');exports[_0xb5c7('0x0')]=function(_0x18f11c,_0x245289){return client[_0xb5c7('0x1')](_0xb5c7('0x2'),{'body':_0x245289,'options':{'where':{'id':_0x18f11c}},'log':_0xb5c7('0x3')});};exports[_0xb5c7('0x4')]=function(_0x10d8c8,_0x199193){return client[_0xb5c7('0x1')](_0xb5c7('0x5'),{'body':_0x199193,'options':{'where':{'id':_0x10d8c8}},'log':_0xb5c7('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ac715ce..b4c75fa 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 _0xfdb1=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x56d191,_0xf17feb){var _0x2cb35b=function(_0xbd1e01){while(--_0xbd1e01){_0x56d191['push'](_0x56d191['shift']());}};_0x2cb35b(++_0xf17feb);}(_0xfdb1,0x1cc));var _0x1fdb=function(_0x1170f9,_0x4f6351){_0x1170f9=_0x1170f9-0x0;var _0x1c3b2f=_0xfdb1[_0x1170f9];return _0x1c3b2f;};'use strict';var client=require(_0x1fdb('0x0'));exports[_0x1fdb('0x1')]=function(_0x3d31e4){return client[_0x1fdb('0x2')](_0x1fdb('0x3'),{'body':_0x3d31e4,'log':_0x1fdb('0x4')});}; \ No newline at end of file +var _0x330c=['Request','createSmsMessage','../client','create'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x330c,0x186));var _0xc330=function(_0x175887,_0x3b4d06){_0x175887=_0x175887-0x0;var _0x418dbe=_0x330c[_0x175887];return _0x418dbe;};'use strict';var client=require(_0xc330('0x0'));exports[_0xc330('0x1')]=function(_0x38be68){return client[_0xc330('0x2')]('CreateSmsMessage',{'body':_0x38be68,'log':_0xc330('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1d85596..83377be 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 _0x2cb1=['smsPause','../client','getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','User','Agents'];(function(_0x4de226,_0xf589ec){var _0x2fb276=function(_0x3f99ed){while(--_0x3f99ed){_0x4de226['push'](_0x4de226['shift']());}};_0x2fb276(++_0xf589ec);}(_0x2cb1,0x137));var _0x12cb=function(_0x4f0ec4,_0x5dd603){_0x4f0ec4=_0x4f0ec4-0x0;var _0x4ff495=_0x2cb1[_0x4f0ec4];return _0x4ff495;};'use strict';var client=require(_0x12cb('0x0'));exports[_0x12cb('0x1')]=function(){return function(){return client[_0x12cb('0x2')](_0x12cb('0x3'),{'options':{'raw':![],'attributes':['id',_0x12cb('0x4'),_0x12cb('0x5'),_0x12cb('0x6')],'include':[{'model':_0x12cb('0x7'),'as':_0x12cb('0x8'),'attributes':['id',_0x12cb('0x4'),'online',_0x12cb('0x9')]}]},'log':_0x12cb('0x1')});};}; \ No newline at end of file +var _0x3514=['name','timeout','strategy','Agents','online','smsPause','getSmsQueues','../client'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x3514,0xe7));var _0x4351=function(_0x2ac120,_0x22b4d9){_0x2ac120=_0x2ac120-0x0;var _0x3c5d9e=_0x3514[_0x2ac120];return _0x3c5d9e;};'use strict';var client=require(_0x4351('0x0'));exports['getSmsQueues']=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x4351('0x1'),_0x4351('0x2'),_0x4351('0x3')],'include':[{'model':'User','as':_0x4351('0x4'),'attributes':['id',_0x4351('0x1'),_0x4351('0x5'),_0x4351('0x6')]}]},'log':_0x4351('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 4edcfd6..8adc48c 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 _0xe884=['update','UpdateSmsQueueReport','create','Request','CreateSmsQueueReport'];(function(_0x5071ce,_0x4c4466){var _0x301b9a=function(_0x278ece){while(--_0x278ece){_0x5071ce['push'](_0x5071ce['shift']());}};_0x301b9a(++_0x4c4466);}(_0xe884,0x11f));var _0x4e88=function(_0x3c7865,_0x36ea43){_0x3c7865=_0x3c7865-0x0;var _0x1ea4c5=_0xe884[_0x3c7865];return _0x1ea4c5;};'use strict';var client=require('../client');exports[_0x4e88('0x0')]=function(_0x3d0b07){return client[_0x4e88('0x1')]('CreateSmsQueueReport',{'body':_0x3d0b07,'log':_0x4e88('0x2')});};exports[_0x4e88('0x3')]=function(_0x36ef1a,_0xaf7b72){return client[_0x4e88('0x1')](_0x4e88('0x4'),{'body':_0xaf7b72,'options':{'where':{'uniqueid':_0x36ef1a},'order':[['id','DESC']],'limit':0x1},'log':_0x4e88('0x4')});}; \ No newline at end of file +var _0xd709=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x146484,_0x27a7f0){var _0x4c7aa3=function(_0x481b98){while(--_0x481b98){_0x146484['push'](_0x146484['shift']());}};_0x4c7aa3(++_0x27a7f0);}(_0xd709,0x104));var _0x9d70=function(_0x467be9,_0x23471d){_0x467be9=_0x467be9-0x0;var _0x47cbf5=_0xd709[_0x467be9];return _0x47cbf5;};'use strict';var client=require('../client');exports['create']=function(_0x2cb952){return client[_0x9d70('0x0')]('CreateSmsQueueReport',{'body':_0x2cb952,'log':_0x9d70('0x1')});};exports[_0x9d70('0x2')]=function(_0x4bdb69,_0x587d75){return client[_0x9d70('0x0')](_0x9d70('0x3'),{'body':_0x587d75,'options':{'where':{'uniqueid':_0x4bdb69},'order':[['id',_0x9d70('0x4')]],'limit':0x1},'log':_0x9d70('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 21cd9ba..8f038b7 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 _0x4100=['mailPause','faxPause','smsPause','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','Request','GetUser','agent','name','pauseType','lastPauseAt','voicePause','chatPause'];(function(_0x41c381,_0x1176bd){var _0x427981=function(_0x508843){while(--_0x508843){_0x41c381['push'](_0x41c381['shift']());}};_0x427981(++_0x1176bd);}(_0x4100,0x18f));var _0x0410=function(_0x353fe9,_0x288f7a){_0x353fe9=_0x353fe9-0x0;var _0x3d3ec1=_0x4100[_0x353fe9];return _0x3d3ec1;};'use strict';var client=require('../client');exports[_0x0410('0x0')]=function(){return function(){return client[_0x0410('0x1')](_0x0410('0x2'),{'options':{'raw':!![],'where':{'role':_0x0410('0x3')},'attributes':['id',_0x0410('0x4'),'online',_0x0410('0x5'),_0x0410('0x6'),_0x0410('0x7'),_0x0410('0x8'),_0x0410('0x9'),_0x0410('0xa'),_0x0410('0xb'),'whatsappPause','openchannelPause','chatCapacity',_0x0410('0xc'),_0x0410('0xd'),_0x0410('0xe'),_0x0410('0xf'),_0x0410('0x10')]},'log':_0x0410('0x0')});};}; \ No newline at end of file +var _0x7088=['smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request','agent','name','online','pauseType','voicePause','chatPause','mailPause','faxPause'];(function(_0x1b66e8,_0x378cb7){var _0x48deed=function(_0x486cfe){while(--_0x486cfe){_0x1b66e8['push'](_0x1b66e8['shift']());}};_0x48deed(++_0x378cb7);}(_0x7088,0x127));var _0x8708=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7088[_0x56482c];return _0x5aae7a;};'use strict';var client=require(_0x8708('0x0'));exports[_0x8708('0x1')]=function(){return function(){return client[_0x8708('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x8708('0x3')},'attributes':['id',_0x8708('0x4'),_0x8708('0x5'),_0x8708('0x6'),'lastPauseAt',_0x8708('0x7'),_0x8708('0x8'),_0x8708('0x9'),_0x8708('0xa'),_0x8708('0xb'),'whatsappPause',_0x8708('0xc'),_0x8708('0xd'),_0x8708('0xe'),_0x8708('0xf'),_0x8708('0x10'),_0x8708('0x11'),'openchannelCapacity']},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 6bf1e21..2d29ff8 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 _0x782e=['AddTagsToWhatsappInteraction','UpdateWhatsappInteraction','updateWhatsappInteraction','Request'];(function(_0x551022,_0x83d9c6){var _0x3778be=function(_0x5abf9f){while(--_0x5abf9f){_0x551022['push'](_0x551022['shift']());}};_0x3778be(++_0x83d9c6);}(_0x782e,0xb9));var _0xe782=function(_0x581db6,_0x3f053d){_0x581db6=_0x581db6-0x0;var _0x13931c=_0x782e[_0x581db6];return _0x13931c;};'use strict';var client=require('../client');exports['update']=function(_0x120c31,_0x15b01d){return client['Request'](_0xe782('0x0'),{'body':_0x15b01d,'options':{'where':{'id':_0x120c31}},'log':_0xe782('0x1')});};exports['addTags']=function(_0x26f960,_0x6726f){return client[_0xe782('0x2')](_0xe782('0x3'),{'body':_0x6726f,'options':{'where':{'id':_0x26f960}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x98b8=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98b8,0x93));var _0x898b=function(_0x1599bf,_0x3cc1fb){_0x1599bf=_0x1599bf-0x0;var _0x2470f2=_0x98b8[_0x1599bf];return _0x2470f2;};'use strict';var client=require(_0x898b('0x0'));exports[_0x898b('0x1')]=function(_0x43dfc2,_0x45d860){return client[_0x898b('0x2')](_0x898b('0x3'),{'body':_0x45d860,'options':{'where':{'id':_0x43dfc2}},'log':_0x898b('0x4')});};exports[_0x898b('0x5')]=function(_0xc90f04,_0x7aea2f){return client[_0x898b('0x2')](_0x898b('0x6'),{'body':_0x7aea2f,'options':{'where':{'id':_0xc90f04}},'log':_0x898b('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index dc3e5b3..d2f170e 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 _0xc025=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x5304d4,_0x11abd6){var _0x492906=function(_0xf90e3b){while(--_0xf90e3b){_0x5304d4['push'](_0x5304d4['shift']());}};_0x492906(++_0x11abd6);}(_0xc025,0x18a));var _0x5c02=function(_0xa014a7,_0x4b8c12){_0xa014a7=_0xa014a7-0x0;var _0x41c8e3=_0xc025[_0xa014a7];return _0x41c8e3;};'use strict';var client=require(_0x5c02('0x0'));exports[_0x5c02('0x1')]=function(_0x58424b){return client['Request'](_0x5c02('0x2'),{'body':_0x58424b,'log':_0x5c02('0x3')});}; \ No newline at end of file +var _0xbc05=['createWhatsappMessage','../client','create','CreateWhatsappMessage'];(function(_0x2a2009,_0x2c38b4){var _0x3b9c7d=function(_0xf7222f){while(--_0xf7222f){_0x2a2009['push'](_0x2a2009['shift']());}};_0x3b9c7d(++_0x2c38b4);}(_0xbc05,0x85));var _0x5bc0=function(_0x3deb6b,_0x19df64){_0x3deb6b=_0x3deb6b-0x0;var _0x855b91=_0xbc05[_0x3deb6b];return _0x855b91;};'use strict';var client=require(_0x5bc0('0x0'));exports[_0x5bc0('0x1')]=function(_0x56a321){return client['Request'](_0x5bc0('0x2'),{'body':_0x56a321,'log':_0x5bc0('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 0bdc4c9..21391b0 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 _0xa45c=['whatsappPause','../client','getWhatsappQueues','name','strategy','Agents'];(function(_0x3e8cae,_0x4cb96a){var _0x45c4d6=function(_0x4bf3a5){while(--_0x4bf3a5){_0x3e8cae['push'](_0x3e8cae['shift']());}};_0x45c4d6(++_0x4cb96a);}(_0xa45c,0x6d));var _0xca45=function(_0x56f4d9,_0x5d3673){_0x56f4d9=_0x56f4d9-0x0;var _0x5abeff=_0xa45c[_0x56f4d9];return _0x5abeff;};'use strict';var client=require(_0xca45('0x0'));exports[_0xca45('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xca45('0x2'),'timeout',_0xca45('0x3')],'include':[{'model':'User','as':_0xca45('0x4'),'attributes':['id','name','online',_0xca45('0x5')]}]},'log':_0xca45('0x1')});};}; \ No newline at end of file +var _0x42f4=['name','timeout','strategy','online','whatsappPause','../client','Request','GetWhatsappQueue'];(function(_0x4eee10,_0x256a93){var _0x1bb3cb=function(_0x267d14){while(--_0x267d14){_0x4eee10['push'](_0x4eee10['shift']());}};_0x1bb3cb(++_0x256a93);}(_0x42f4,0x19d));var _0x442f=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0x42f4[_0xffa198];return _0x1e4b50;};'use strict';var client=require(_0x442f('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x442f('0x1')](_0x442f('0x2'),{'options':{'raw':![],'attributes':['id',_0x442f('0x3'),_0x442f('0x4'),_0x442f('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x442f('0x6'),_0x442f('0x7')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 04aabad..bf7fef6 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 _0x0877=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x5a87a8,_0xa245f9){var _0x1c8809=function(_0x3c4bb6){while(--_0x3c4bb6){_0x5a87a8['push'](_0x5a87a8['shift']());}};_0x1c8809(++_0xa245f9);}(_0x0877,0x125));var _0x7087=function(_0x5e7f24,_0x7b595){_0x5e7f24=_0x5e7f24-0x0;var _0x11d440=_0x0877[_0x5e7f24];return _0x11d440;};'use strict';var client=require(_0x7087('0x0'));exports[_0x7087('0x1')]=function(_0x27ccc9){return client[_0x7087('0x2')](_0x7087('0x3'),{'body':_0x27ccc9,'log':'CreateWhatsappQueueReport'});};exports[_0x7087('0x4')]=function(_0x729041,_0x2782c8){return client[_0x7087('0x2')]('UpdateWhatsappQueueReport',{'body':_0x2782c8,'options':{'where':{'uniqueid':_0x729041},'order':[['id','DESC']],'limit':0x1},'log':_0x7087('0x5')});}; \ No newline at end of file +var _0xe710=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','../client','create','Request'];(function(_0x1b6c81,_0x3799d2){var _0x2ae44b=function(_0x483b52){while(--_0x483b52){_0x1b6c81['push'](_0x1b6c81['shift']());}};_0x2ae44b(++_0x3799d2);}(_0xe710,0xd4));var _0x0e71=function(_0x33cb3d,_0x4d4418){_0x33cb3d=_0x33cb3d-0x0;var _0x1d9557=_0xe710[_0x33cb3d];return _0x1d9557;};'use strict';var client=require(_0x0e71('0x0'));exports[_0x0e71('0x1')]=function(_0x3af51f){return client[_0x0e71('0x2')](_0x0e71('0x3'),{'body':_0x3af51f,'log':_0x0e71('0x3')});};exports['update']=function(_0x4a3b3a,_0x14725d){return client['Request'](_0x0e71('0x4'),{'body':_0x14725d,'options':{'where':{'uniqueid':_0x4a3b3a},'order':[['id','DESC']],'limit':0x1},'log':_0x0e71('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 816d217..8055d9b 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 _0x0cb2=['[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','util','seq-queue','../../../../config/logger','./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','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete'];(function(_0x4fde18,_0x11fe3e){var _0x3184a3=function(_0x166723){while(--_0x166723){_0x4fde18['push'](_0x4fde18['shift']());}};_0x3184a3(++_0x11fe3e);}(_0x0cb2,0xe3));var _0x20cb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0cb2[_0x20a584];return _0x4b41a8;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x20cb('0x0'));var seqqueue=require(_0x20cb('0x1'));var logger=require(_0x20cb('0x2'))('routing');var strategy=require(_0x20cb('0x3'));var queue=schema({'name':{'type':_0x20cb('0x4'),'required':!![],'message':_0x20cb('0x5')},'timeout':{'type':_0x20cb('0x6'),'message':_0x20cb('0x7')}});function writeLog(_0xcc9568,_0x1a417b,_0x22191a){return logger[_0x20cb('0x8')](util[_0x20cb('0x9')](_0x20cb('0xa'),_0xcc9568,_0x1a417b[_0x20cb('0xb')],_0x22191a));}function handleFindAgent(_0x138cb8){return function(_0x5c306b){return _0x5c306b[_0x20cb('0xb')][_0x20cb('0xc')]()===_0x138cb8['toLowerCase']();};}exports[_0x20cb('0xd')]=function(_0x12f8c2,_0x5872b6,_0xe0593f,_0x15c319){return function(_0x39f32d){try{var _0x8b6a6={'name':_0x5872b6[0x0],'timeout':_0x5872b6[0x1]};var _0x44e169=queue['validate'](_0x8b6a6,{'typecast':!![]});if(_0x44e169[_0x20cb('0xe')]){logger[_0x20cb('0xf')](_0x20cb('0x10'),_0x12f8c2,_[_0x20cb('0x11')](_0x44e169,_0x20cb('0x12'))['join'](',\x20'));_0x39f32d[_0x20cb('0x13')]();}else{var _0x11fcbb=_[_0x20cb('0x14')](_0xe0593f[_0x20cb('0x15')],handleFindAgent(_0x8b6a6[_0x20cb('0xb')]));if(_0x11fcbb){var _0x4cd2df=(_0x8b6a6[_0x20cb('0x16')]||0xa)*0x3e8;var _0x3901ef,_0x3c4e5d;var _0x809650=seqqueue[_0x20cb('0x17')](_0x4cd2df);_0x809650['id']=_0x12f8c2;_0x809650[_0x20cb('0x18')]=_0x4cd2df;_0x809650[_0x20cb('0x19')]=_0x15c319['channel'];writeLog(_0x12f8c2,_0x11fcbb,util[_0x20cb('0x9')](_0x20cb('0x1a'),_0x4cd2df));_0xe0593f[_0x20cb('0x1b')][_0x12f8c2]['on'](_0x20cb('0x1c'),function(){logger[_0x20cb('0x8')](_0x20cb('0x1d'),_0x12f8c2);clearTimeout(_0x3c4e5d);_0x3c4e5d=undefined;_0x809650[_0x20cb('0x1e')]();if(_0xe0593f[_0x20cb('0x1b')][_0x12f8c2]){delete _0xe0593f[_0x20cb('0x1b')][_0x12f8c2];}_0x39f32d['stop']();});_0xe0593f['rules'][_0x12f8c2]['on'](_0x20cb('0x1f'),function(){if(_0xe0593f[_0x20cb('0x1b')][_0x12f8c2]){delete _0xe0593f[_0x20cb('0x1b')][_0x12f8c2];}});_0x3c4e5d=setTimeout(function(){logger[_0x20cb('0x8')](_0x20cb('0x20'),_0x12f8c2);clearTimeout(_0x3c4e5d);_0x809650['close']();_0x39f32d[_0x20cb('0x21')]();},_0x4cd2df);strategy[_0x20cb('0x22')](_0x809650,_0x11fcbb,_0xe0593f,_0x15c319);}else{logger[_0x20cb('0xf')](_0x20cb('0x23'),_0x12f8c2,_0x8b6a6['name']);_0x39f32d['stop']();}}}catch(_0x5bc327){console['log'](_0x5bc327);logger[_0x20cb('0xf')](_0x20cb('0x24'),_0x12f8c2,_0x5bc327['stack']);_0x39f32d[_0x20cb('0x13')]();}};}; \ No newline at end of file +var _0x9c5f=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','routing','string','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','[%s][AGENT]\x20%s','map','stop','find','agents','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','error'];(function(_0x3f56ed,_0xd8f0be){var _0x32cad8=function(_0x9ff1f7){while(--_0x9ff1f7){_0x3f56ed['push'](_0x3f56ed['shift']());}};_0x32cad8(++_0xd8f0be);}(_0x9c5f,0x13b));var _0xf9c5=function(_0x534eb2,_0x2b9f02){_0x534eb2=_0x534eb2-0x0;var _0xfae93b=_0x9c5f[_0x534eb2];return _0xfae93b;};'use strict';var schema=require(_0xf9c5('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0xf9c5('0x1'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xf9c5('0x2'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x1e7219,_0x426878,_0x15e717){return logger[_0xf9c5('0x3')](util[_0xf9c5('0x4')](_0xf9c5('0x5'),_0x1e7219,_0x426878[_0xf9c5('0x6')],_0x15e717));}function handleFindAgent(_0x32217a){return function(_0x17671a){return _0x17671a[_0xf9c5('0x6')][_0xf9c5('0x7')]()===_0x32217a['toLowerCase']();};}exports['consequence']=function(_0x1ddbe5,_0x2005ed,_0x502743,_0x434e3d){return function(_0x5c7ae1){try{var _0x8c436={'name':_0x2005ed[0x0],'timeout':_0x2005ed[0x1]};var _0x1c0b51=queue['validate'](_0x8c436,{'typecast':!![]});if(_0x1c0b51['length']){logger['error'](_0xf9c5('0x8'),_0x1ddbe5,_[_0xf9c5('0x9')](_0x1c0b51,'message')['join'](',\x20'));_0x5c7ae1[_0xf9c5('0xa')]();}else{var _0x50c54b=_[_0xf9c5('0xb')](_0x502743[_0xf9c5('0xc')],handleFindAgent(_0x8c436[_0xf9c5('0x6')]));if(_0x50c54b){var _0x3c97c5=(_0x8c436['timeout']||0xa)*0x3e8;var _0x132110,_0x474d00;var _0x169d92=seqqueue[_0xf9c5('0xd')](_0x3c97c5);_0x169d92['id']=_0x1ddbe5;_0x169d92[_0xf9c5('0xe')]=_0x3c97c5;_0x169d92['channel']=_0x434e3d[_0xf9c5('0xf')];writeLog(_0x1ddbe5,_0x50c54b,util[_0xf9c5('0x4')](_0xf9c5('0x10'),_0x3c97c5));_0x502743[_0xf9c5('0x11')][_0x1ddbe5]['on'](_0xf9c5('0x12'),function(){logger[_0xf9c5('0x3')](_0xf9c5('0x13'),_0x1ddbe5);clearTimeout(_0x474d00);_0x474d00=undefined;_0x169d92[_0xf9c5('0x14')]();if(_0x502743[_0xf9c5('0x11')][_0x1ddbe5]){delete _0x502743['rules'][_0x1ddbe5];}_0x5c7ae1[_0xf9c5('0xa')]();});_0x502743[_0xf9c5('0x11')][_0x1ddbe5]['on']('complete',function(){if(_0x502743['rules'][_0x1ddbe5]){delete _0x502743['rules'][_0x1ddbe5];}});_0x474d00=setTimeout(function(){logger[_0xf9c5('0x3')]('[%s][AGENT]\x20ROUTING\x20END',_0x1ddbe5);clearTimeout(_0x474d00);_0x169d92['close']();_0x5c7ae1[_0xf9c5('0x15')]();},_0x3c97c5);strategy['agent'](_0x169d92,_0x50c54b,_0x502743,_0x434e3d);}else{logger[_0xf9c5('0x16')](_0xf9c5('0x17'),_0x1ddbe5,_0x8c436['name']);_0x5c7ae1[_0xf9c5('0xa')]();}}}catch(_0x2ae394){console[_0xf9c5('0x18')](_0x2ae394);logger[_0xf9c5('0x16')]('[%s][QUEUE]\x20%s',_0x1ddbe5,_0x2ae394[_0xf9c5('0x19')]);_0x5c7ae1[_0xf9c5('0xa')]();}};}; \ 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 e8da736..7d91886 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 _0xb0e6=['upperFirst','created','isEmpty','body','getMustacheRender','Message','create','then','info','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','postText','message','amazonlex','providerResponse','dialogState','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','channel','whatsapp','phone','chat','ChatWebsiteId','AccountId'];(function(_0x13d766,_0x3b22b1){var _0x33e514=function(_0x29dea0){while(--_0x29dea0){_0x13d766['push'](_0x13d766['shift']());}};_0x33e514(++_0x3b22b1);}(_0xb0e6,0x1c8));var _0x6b0e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb0e6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6b0e('0x0'));var moment=require('moment');var AWS=require(_0x6b0e('0x1'));var utils=require(_0x6b0e('0x2'));var logger=require(_0x6b0e('0x3'))(_0x6b0e('0x4'));var rpc={'chatMessage':require(_0x6b0e('0x5')),'openchannelMessage':require(_0x6b0e('0x6')),'mailMessage':require(_0x6b0e('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x6b0e('0x8')),'whatsappMessage':require(_0x6b0e('0x9'))};exports[_0x6b0e('0xa')]=function(_0x374080,_0x47d844){return function(_0x259cbb){try{if(!_[_0x6b0e('0xb')](this[_0x6b0e('0xc')][_0x6b0e('0xd')])){logger['info'](_0x6b0e('0xe'),_0x374080,_0x6b0e('0xf'));return _0x259cbb[_0x6b0e('0x10')]();}var _0x57ecae={'ContactId':this['contact']['id'],'sentAt':moment()[_0x6b0e('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x6b0e('0x12')]==='sms'||this[_0x6b0e('0x12')]===_0x6b0e('0x13')){_0x57ecae['phone']=this[_0x6b0e('0xc')][_0x6b0e('0x14')];}var _0x1f6cab=this[_0x6b0e('0x12')];if(_0x1f6cab===_0x6b0e('0x15')){_0x57ecae[_0x6b0e('0x16')]=this['account']['id'];}else{_0x57ecae[_['upperFirst'](_0x1f6cab)+_0x6b0e('0x17')]=this['account']['id'];}_0x57ecae[_[_0x6b0e('0x18')](_0x1f6cab)+'InteractionId']=this[_0x6b0e('0xc')]['id'];if(this[_0x6b0e('0xc')][_0x6b0e('0x19')]){var _0x4f91f4=_0x47d844[0x4];if(!_[_0x6b0e('0x1a')](_0x4f91f4)){_0x57ecae[_0x6b0e('0x1b')]=utils[_0x6b0e('0x1c')](_0x4f91f4,this);return rpc[_0x1f6cab+_0x6b0e('0x1d')][_0x6b0e('0x1e')](_0x57ecae)[_0x6b0e('0x1f')](function(_0x4d575b){logger[_0x6b0e('0x20')](_0x6b0e('0xe'),_0x374080,_0x57ecae[_0x6b0e('0x1b')]);})[_0x6b0e('0x21')](function(_0x582bec){logger[_0x6b0e('0x22')](_0x6b0e('0xe'),_0x374080,JSON[_0x6b0e('0x23')](_0x582bec));})[_0x6b0e('0x24')](function(){logger[_0x6b0e('0x20')](_0x6b0e('0x25'),_0x374080);_0x259cbb[_0x6b0e('0x26')]();});}else{logger[_0x6b0e('0x20')](_0x6b0e('0x27'),_0x374080);_0x259cbb[_0x6b0e('0x26')]();}}else{var _0x344fb8=this;var _0xc03355=new AWS[(_0x6b0e('0x28'))]({'accessKeyId':_0x47d844[0x0],'secretAccessKey':_0x47d844[0x1],'region':_0x47d844[0x2]});var _0x3de57f={'botAlias':_0x6b0e('0x29'),'botName':_0x47d844[0x3],'inputText':this['message']['body'],'userId':this[_0x6b0e('0x12')]+':'+this[_0x6b0e('0xc')]['id']['toString']()};_0xc03355[_0x6b0e('0x2a')](_0x3de57f,function(_0x21a2a9,_0x4968d5){if(_0x21a2a9){logger[_0x6b0e('0x22')](_0x6b0e('0xe'),_0x374080,_0x21a2a9[_0x6b0e('0x2b')]);_0x259cbb['next']();}else if(_0x4968d5&&_0x4968d5['message']){_0x344fb8[_0x6b0e('0x1b')][_0x6b0e('0x2c')]=_0x4968d5;_0x57ecae[_0x6b0e('0x1b')]=_0x4968d5['message'];_0x57ecae['providerName']=_0x6b0e('0x2c');_0x57ecae[_0x6b0e('0x2d')]=JSON['stringify'](_0x4968d5);return rpc[_0x1f6cab+_0x6b0e('0x1d')][_0x6b0e('0x1e')](_0x57ecae)[_0x6b0e('0x1f')](function(_0x11cb1d){logger[_0x6b0e('0x20')](_0x6b0e('0xe'),_0x374080,_0x57ecae[_0x6b0e('0x1b')]);if(_0x4968d5[_0x6b0e('0x2e')]==_0x6b0e('0x2f')){_0x259cbb['next']();}else{_0x259cbb['stop']();}})[_0x6b0e('0x21')](function(_0x184b41){logger[_0x6b0e('0x22')](_0x6b0e('0xe'),_0x374080,JSON['stringify'](_0x184b41));_0x259cbb['next']();});}else{_0x259cbb[_0x6b0e('0x10')]();}});}}catch(_0x30eb62){logger[_0x6b0e('0x22')](_0x6b0e('0xe'),_0x374080,JSON[_0x6b0e('0x23')](_0x30eb62));_0x259cbb[_0x6b0e('0x26')]();}};}; \ No newline at end of file +var _0x3c9e=['out','channel','sms','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','toString','postText','error','message','providerName','providerResponse','dialogState','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x205401,_0x3832c4){var _0x569ec1=function(_0x21d59f){while(--_0x21d59f){_0x205401['push'](_0x205401['shift']());}};_0x569ec1(++_0x3832c4);}(_0x3c9e,0xb6));var _0xe3c9=function(_0x28ba9c,_0x34d729){_0x28ba9c=_0x28ba9c-0x0;var _0x50c9c4=_0x3c9e[_0x28ba9c];return _0x50c9c4;};'use strict';var _=require(_0xe3c9('0x0'));var moment=require(_0xe3c9('0x1'));var AWS=require('aws-sdk');var utils=require(_0xe3c9('0x2'));var logger=require(_0xe3c9('0x3'))(_0xe3c9('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe3c9('0x5')),'mailMessage':require(_0xe3c9('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe3c9('0x7')),'whatsappMessage':require(_0xe3c9('0x8'))};exports['consequence']=function(_0x75796,_0x558ee2){return function(_0x20ca68){try{if(!_[_0xe3c9('0x9')](this['interaction'][_0xe3c9('0xa')])){logger[_0xe3c9('0xb')](_0xe3c9('0xc'),_0x75796,_0xe3c9('0xd'));return _0x20ca68[_0xe3c9('0xe')]();}var _0x49104c={'ContactId':this[_0xe3c9('0xf')]['id'],'sentAt':moment()[_0xe3c9('0x10')](_0xe3c9('0x11')),'direction':_0xe3c9('0x12')};if(this[_0xe3c9('0x13')]===_0xe3c9('0x14')||this[_0xe3c9('0x13')]===_0xe3c9('0x15')){_0x49104c['phone']=this[_0xe3c9('0x16')][_0xe3c9('0x17')];}var _0x21b99c=this[_0xe3c9('0x13')];if(_0x21b99c===_0xe3c9('0x18')){_0x49104c[_0xe3c9('0x19')]=this[_0xe3c9('0x1a')]['id'];}else{_0x49104c[_[_0xe3c9('0x1b')](_0x21b99c)+_0xe3c9('0x1c')]=this[_0xe3c9('0x1a')]['id'];}_0x49104c[_[_0xe3c9('0x1b')](_0x21b99c)+_0xe3c9('0x1d')]=this[_0xe3c9('0x16')]['id'];if(this[_0xe3c9('0x16')]['created']){var _0x40b784=_0x558ee2[0x4];if(!_[_0xe3c9('0x1e')](_0x40b784)){_0x49104c[_0xe3c9('0x1f')]=utils[_0xe3c9('0x20')](_0x40b784,this);return rpc[_0x21b99c+_0xe3c9('0x21')][_0xe3c9('0x22')](_0x49104c)[_0xe3c9('0x23')](function(_0x2be7da){logger[_0xe3c9('0xb')]('[%s][AMAZONLEX]\x20%s',_0x75796,_0x49104c[_0xe3c9('0x1f')]);})[_0xe3c9('0x24')](function(_0x3b0267){logger['error'](_0xe3c9('0xc'),_0x75796,JSON[_0xe3c9('0x25')](_0x3b0267));})[_0xe3c9('0x26')](function(){logger[_0xe3c9('0xb')](_0xe3c9('0x27'),_0x75796);_0x20ca68[_0xe3c9('0x28')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x75796);_0x20ca68[_0xe3c9('0x28')]();}}else{var _0xcc7488=this;var _0x56c1b9=new AWS[(_0xe3c9('0x29'))]({'accessKeyId':_0x558ee2[0x0],'secretAccessKey':_0x558ee2[0x1],'region':_0x558ee2[0x2]});var _0x2fb611={'botAlias':_0xe3c9('0x2a'),'botName':_0x558ee2[0x3],'inputText':this['message'][_0xe3c9('0x1f')],'userId':this['channel']+':'+this[_0xe3c9('0x16')]['id'][_0xe3c9('0x2b')]()};_0x56c1b9[_0xe3c9('0x2c')](_0x2fb611,function(_0xdb709f,_0xd3dbe0){if(_0xdb709f){logger[_0xe3c9('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x75796,_0xdb709f[_0xe3c9('0x2e')]);_0x20ca68[_0xe3c9('0xe')]();}else if(_0xd3dbe0&&_0xd3dbe0[_0xe3c9('0x2e')]){_0xcc7488['body']['amazonlex']=_0xd3dbe0;_0x49104c[_0xe3c9('0x1f')]=_0xd3dbe0[_0xe3c9('0x2e')];_0x49104c[_0xe3c9('0x2f')]='amazonlex';_0x49104c[_0xe3c9('0x30')]=JSON['stringify'](_0xd3dbe0);return rpc[_0x21b99c+_0xe3c9('0x21')]['create'](_0x49104c)[_0xe3c9('0x23')](function(_0x4c26e4){logger[_0xe3c9('0xb')](_0xe3c9('0xc'),_0x75796,_0x49104c[_0xe3c9('0x1f')]);if(_0xd3dbe0[_0xe3c9('0x31')]=='Failed'){_0x20ca68[_0xe3c9('0xe')]();}else{_0x20ca68[_0xe3c9('0x28')]();}})['catch'](function(_0x2ff6da){logger[_0xe3c9('0x2d')](_0xe3c9('0xc'),_0x75796,JSON[_0xe3c9('0x25')](_0x2ff6da));_0x20ca68[_0xe3c9('0xe')]();});}else{_0x20ca68[_0xe3c9('0xe')]();}});}}catch(_0x236a23){logger[_0xe3c9('0x2d')](_0xe3c9('0xc'),_0x75796,JSON[_0xe3c9('0x25')](_0x236a23));_0x20ca68[_0xe3c9('0x28')]();}};}; \ 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 4f49d93..bde9c29 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 _0xca8c=['error','finally','lodash','./utils','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','InteractionId','mail','service','Smtp','host','port','secure','user','inReplyTo','messageId','html','','replace','body','','sendMailMessage','then','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s'];(function(_0xd352a3,_0x35c04f){var _0x1fd931=function(_0x44e6c5){while(--_0x44e6c5){_0xd352a3['push'](_0xd352a3['shift']());}};_0x1fd931(++_0x35c04f);}(_0xca8c,0xa7));var _0xcca8=function(_0x11eab4,_0x543aac){_0x11eab4=_0x11eab4-0x0;var _0x2227ac=_0xca8c[_0x11eab4];return _0x2227ac;};'use strict';var _=require(_0xcca8('0x0'));var moment=require('moment');var utils=require(_0xcca8('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0xcca8('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xcca8('0x3')),'faxMessage':require(_0xcca8('0x4')),'whatsappMessage':require(_0xcca8('0x5'))};var mailRpc=require('../../mailRpc');exports[_0xcca8('0x6')]=function(_0x3c328b,_0x568cdd){return function(_0x5cf863){try{if(_0x568cdd[0x0]==='1'&&(_['isNil'](this[_0xcca8('0x7')]['created'])||!this[_0xcca8('0x7')]['created'])){logger[_0xcca8('0x8')](_0xcca8('0x9'),_0x3c328b,_0xcca8('0xa'));return _0x5cf863[_0xcca8('0xb')]();}var _0x237ae7=this[_0xcca8('0xc')];var _0x1c2290={'body':utils['getMustacheRender'](_0x568cdd[0x1],this),'ContactId':this[_0xcca8('0xd')]['id'],'sentAt':moment()[_0xcca8('0xe')](_0xcca8('0xf')),'direction':_0xcca8('0x10')};if(this[_0xcca8('0x11')]){_0x1c2290['to']=this[_0xcca8('0x11')][_0xcca8('0x12')]||'';_0x1c2290['cc']=this[_0xcca8('0x11')]['cc']||'';_0x1c2290[_0xcca8('0x12')]=this[_0xcca8('0x11')]['to']||'';_0x1c2290['phone']=this['message'][_0xcca8('0x13')]||'';_0x1c2290[_0xcca8('0x14')]=!![];if(this[_0xcca8('0x11')][_0xcca8('0x15')]){_0x1c2290['subject']='';_0x1c2290[_0xcca8('0x15')]+=_[_0xcca8('0x16')](this['message'][_0xcca8('0x15')],_0xcca8('0x17'))?'':_0xcca8('0x18');_0x1c2290[_0xcca8('0x15')]+=this[_0xcca8('0x11')]['subject'];}}if(this[_0xcca8('0xc')]===_0xcca8('0x19')){_0x1c2290[_0xcca8('0x1a')]=this[_0xcca8('0x1b')]['id'];}else{_0x1c2290[_['upperFirst'](this[_0xcca8('0xc')])+_0xcca8('0x1c')]=this[_0xcca8('0x1b')]['id'];}_0x1c2290[_['upperFirst'](this[_0xcca8('0xc')])+_0xcca8('0x1d')]=this[_0xcca8('0x7')]['id'];if(rpc[this[_0xcca8('0xc')]+'Message']){if(this[_0xcca8('0xc')]===_0xcca8('0x1e')){var _0x2cabea={'tls':{'rejectUnauthorized':![]}};if(this[_0xcca8('0x1b')]['Smtp'][_0xcca8('0x1f')]){_0x2cabea['service']=this[_0xcca8('0x1b')][_0xcca8('0x20')]['service'];}else{_0x2cabea[_0xcca8('0x21')]=this[_0xcca8('0x1b')]['Smtp'][_0xcca8('0x21')];_0x2cabea[_0xcca8('0x22')]=this['account'][_0xcca8('0x20')]['port'];_0x2cabea[_0xcca8('0x23')]=this['account']['Smtp']['secure'];}if(this['account']['Smtp']['authentication']){_0x2cabea['auth']={'user':this[_0xcca8('0x1b')]['Smtp'][_0xcca8('0x24')],'pass':this['account']['Smtp']['pass']};}_0x1c2290[_0xcca8('0x25')]=this[_0xcca8('0x11')][_0xcca8('0x26')];_0x1c2290[_0xcca8('0x27')]=_0xcca8('0x28')+_[_0xcca8('0x29')](_0x1c2290[_0xcca8('0x2a')],_0xcca8('0x2b'),_0xcca8('0x2c'))+_0xcca8('0x2d');return mailRpc[_0xcca8('0x2e')](_0x2cabea,_0x1c2290)[_0xcca8('0x2f')](function(_0x1291b9){logger[_0xcca8('0x8')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3c328b);_0x1c2290[_0xcca8('0x26')]=_0x1291b9[_0xcca8('0x11')]['messageId'];return rpc[_0x237ae7+_0xcca8('0x30')][_0xcca8('0x31')](_0x1c2290);})[_0xcca8('0x2f')](function(_0x8485e4){logger[_0xcca8('0x8')](_0xcca8('0x9'),_0x3c328b,JSON[_0xcca8('0x32')](_0x8485e4));})[_0xcca8('0x33')](function(_0x154229){logger['error'](_0xcca8('0x34'),_0x3c328b,JSON['stringify'](_0x154229));})['finally'](function(){_0x5cf863[_0xcca8('0xb')]();});}else{return rpc[this[_0xcca8('0xc')]+_0xcca8('0x30')]['create'](_0x1c2290)[_0xcca8('0x2f')](function(_0x499f45){logger[_0xcca8('0x8')]('[%s][AUTOREPLY]\x20%s',_0x3c328b,_0x1c2290['body']);})[_0xcca8('0x33')](function(_0x54126e){logger[_0xcca8('0x35')]('[%s][AUTOREPLY]\x20%s',_0x3c328b,JSON['stringify'](_0x54126e));})[_0xcca8('0x36')](function(){_0x5cf863[_0xcca8('0xb')]();});}}}catch(_0x41994a){logger[_0xcca8('0x35')](_0xcca8('0x9'),_0x3c328b,JSON[_0xcca8('0x32')](_0x41994a));_0x5cf863['stop']();}};}; \ No newline at end of file +var _0x5a66=['stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','getMustacheRender','format','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass','inReplyTo','html','body','','sendMailMessage','then','messageId','create','stringify','catch','error'];(function(_0x1ec7a7,_0x31afbc){var _0x3f9919=function(_0x5717c2){while(--_0x5717c2){_0x1ec7a7['push'](_0x1ec7a7['shift']());}};_0x3f9919(++_0x31afbc);}(_0x5a66,0x169));var _0x65a6=function(_0x5571aa,_0x3446bc){_0x5571aa=_0x5571aa-0x0;var _0xbf4c5f=_0x5a66[_0x5571aa];return _0xbf4c5f;};'use strict';var _=require('lodash');var moment=require(_0x65a6('0x0'));var utils=require(_0x65a6('0x1'));var logger=require(_0x65a6('0x2'))('routing');var rpc={'chatMessage':require(_0x65a6('0x3')),'openchannelMessage':require(_0x65a6('0x4')),'mailMessage':require(_0x65a6('0x5')),'smsMessage':require(_0x65a6('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x65a6('0x7'))};var mailRpc=require('../../mailRpc');exports[_0x65a6('0x8')]=function(_0x317d25,_0xb53c43){return function(_0x59b12f){try{if(_0xb53c43[0x0]==='1'&&(_[_0x65a6('0x9')](this[_0x65a6('0xa')]['created'])||!this[_0x65a6('0xa')][_0x65a6('0xb')])){logger[_0x65a6('0xc')](_0x65a6('0xd'),_0x317d25,_0x65a6('0xe'));return _0x59b12f[_0x65a6('0xf')]();}var _0x17bcd3=this[_0x65a6('0x10')];var _0x44b721={'body':utils[_0x65a6('0x11')](_0xb53c43[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()[_0x65a6('0x12')](_0x65a6('0x13')),'direction':_0x65a6('0x14')};if(this[_0x65a6('0x15')]){_0x44b721['to']=this[_0x65a6('0x15')][_0x65a6('0x16')]||'';_0x44b721['cc']=this[_0x65a6('0x15')]['cc']||'';_0x44b721[_0x65a6('0x16')]=this['message']['to']||'';_0x44b721['phone']=this['message'][_0x65a6('0x17')]||'';_0x44b721[_0x65a6('0x18')]=!![];if(this[_0x65a6('0x15')][_0x65a6('0x19')]){_0x44b721['subject']='';_0x44b721['subject']+=_[_0x65a6('0x1a')](this[_0x65a6('0x15')][_0x65a6('0x19')],_0x65a6('0x1b'))?'':_0x65a6('0x1c');_0x44b721[_0x65a6('0x19')]+=this['message'][_0x65a6('0x19')];}}if(this[_0x65a6('0x10')]===_0x65a6('0x1d')){_0x44b721[_0x65a6('0x1e')]=this[_0x65a6('0x1f')]['id'];}else{_0x44b721[_[_0x65a6('0x20')](this[_0x65a6('0x10')])+_0x65a6('0x21')]=this['account']['id'];}_0x44b721[_[_0x65a6('0x20')](this[_0x65a6('0x10')])+_0x65a6('0x22')]=this[_0x65a6('0xa')]['id'];if(rpc[this['channel']+_0x65a6('0x23')]){if(this['channel']===_0x65a6('0x24')){var _0x19595e={'tls':{'rejectUnauthorized':![]}};if(this[_0x65a6('0x1f')][_0x65a6('0x25')][_0x65a6('0x26')]){_0x19595e[_0x65a6('0x26')]=this[_0x65a6('0x1f')]['Smtp'][_0x65a6('0x26')];}else{_0x19595e[_0x65a6('0x27')]=this[_0x65a6('0x1f')][_0x65a6('0x25')][_0x65a6('0x27')];_0x19595e[_0x65a6('0x28')]=this['account']['Smtp']['port'];_0x19595e[_0x65a6('0x29')]=this[_0x65a6('0x1f')][_0x65a6('0x25')][_0x65a6('0x29')];}if(this[_0x65a6('0x1f')]['Smtp'][_0x65a6('0x2a')]){_0x19595e[_0x65a6('0x2b')]={'user':this[_0x65a6('0x1f')][_0x65a6('0x25')][_0x65a6('0x2c')],'pass':this['account'][_0x65a6('0x25')][_0x65a6('0x2d')]};}_0x44b721[_0x65a6('0x2e')]=this[_0x65a6('0x15')]['messageId'];_0x44b721[_0x65a6('0x2f')]=''+_['replace'](_0x44b721[_0x65a6('0x30')],_0x65a6('0x31'),_0x65a6('0x32'))+_0x65a6('0x33');return mailRpc[_0x65a6('0x34')](_0x19595e,_0x44b721)[_0x65a6('0x35')](function(_0x576e89){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x317d25);_0x44b721[_0x65a6('0x36')]=_0x576e89[_0x65a6('0x15')][_0x65a6('0x36')];return rpc[_0x17bcd3+'Message'][_0x65a6('0x37')](_0x44b721);})['then'](function(_0x4a73a7){logger[_0x65a6('0xc')](_0x65a6('0xd'),_0x317d25,JSON[_0x65a6('0x38')](_0x4a73a7));})[_0x65a6('0x39')](function(_0x3184f0){logger[_0x65a6('0x3a')]('[RPC][%s][AUTOREPLY]\x20%s',_0x317d25,JSON[_0x65a6('0x38')](_0x3184f0));})['finally'](function(){_0x59b12f[_0x65a6('0xf')]();});}else{return rpc[this['channel']+_0x65a6('0x23')][_0x65a6('0x37')](_0x44b721)[_0x65a6('0x35')](function(_0x4643d3){logger['info'](_0x65a6('0xd'),_0x317d25,_0x44b721[_0x65a6('0x30')]);})[_0x65a6('0x39')](function(_0x5c739a){logger[_0x65a6('0x3a')](_0x65a6('0xd'),_0x317d25,JSON[_0x65a6('0x38')](_0x5c739a));})['finally'](function(){_0x59b12f[_0x65a6('0xf')]();});}}}catch(_0x485b2e){logger[_0x65a6('0x3a')](_0x65a6('0xd'),_0x317d25,JSON['stringify'](_0x485b2e));_0x59b12f[_0x65a6('0x3b')]();}};}; \ 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 5473bd2..e79a794 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 _0xcf71=['system','channel','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','[%s][CLOSE]\x20%s','finally','stop','error','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x218397,_0x57f604){var _0x2f8ac6=function(_0x5cfeb7){while(--_0x5cfeb7){_0x218397['push'](_0x218397['shift']());}};_0x2f8ac6(++_0x57f604);}(_0xcf71,0xba));var _0x1cf7=function(_0x1a80da,_0x1b532b){_0x1a80da=_0x1a80da-0x0;var _0x1c1df0=_0xcf71[_0x1a80da];return _0x1c1df0;};'use strict';var moment=require(_0x1cf7('0x0'));var logger=require(_0x1cf7('0x1'))(_0x1cf7('0x2'));var rpc={'chatInteraction':require(_0x1cf7('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1cf7('0x4')),'mailInteraction':require(_0x1cf7('0x5')),'faxInteraction':require(_0x1cf7('0x6')),'whatsappInteraction':require(_0x1cf7('0x7'))};exports[_0x1cf7('0x8')]=function(_0x14d074,_0x296703,_0x20e097,_0x314796){return function(_0x45ee6b){try{logger[_0x1cf7('0x9')](_0x1cf7('0xa'),_0x14d074,_0x296703[0x0]);var _0x4f908a={'closed':0x1,'closedAt':moment()['format'](_0x1cf7('0xb')),'closeReason':_0x1cf7('0xc'),'disposition':_0x296703[0x0]};if(rpc[_0x314796[_0x1cf7('0xd')]+'Interaction']){rpc[_0x314796[_0x1cf7('0xd')]+'Interaction']['update'](_0x314796[_0x1cf7('0xe')]['id'],_0x4f908a)[_0x1cf7('0xf')](function(_0x41ddc8){logger[_0x1cf7('0x9')](_0x1cf7('0x10'),_0x14d074,_0x314796[_0x1cf7('0xe')]['id']);})['catch'](function(_0x18dc3b){logger['error'](_0x1cf7('0x11'),_0x14d074,JSON['stringify'](_0x18dc3b));})[_0x1cf7('0x12')](function(){_0x45ee6b[_0x1cf7('0x13')]();});}}catch(_0x5a1b77){logger[_0x1cf7('0x14')](_0x1cf7('0x11'),_0x14d074,JSON[_0x1cf7('0x15')](_0x5a1b77));_0x45ee6b[_0x1cf7('0x13')]();}};}; \ No newline at end of file +var _0xa1aa=['error','[%s][CLOSE]\x20%s','stop','stringify','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch'];(function(_0x466275,_0x391ce3){var _0xa80f8d=function(_0x4fb46c){while(--_0x4fb46c){_0x466275['push'](_0x466275['shift']());}};_0xa80f8d(++_0x391ce3);}(_0xa1aa,0x88));var _0xaa1a=function(_0x2ef42b,_0x528ad2){_0x2ef42b=_0x2ef42b-0x0;var _0x5957a3=_0xa1aa[_0x2ef42b];return _0x5957a3;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0xaa1a('0x0'));var rpc={'chatInteraction':require(_0xaa1a('0x1')),'openchannelInteraction':require(_0xaa1a('0x2')),'smsInteraction':require(_0xaa1a('0x3')),'mailInteraction':require(_0xaa1a('0x4')),'faxInteraction':require(_0xaa1a('0x5')),'whatsappInteraction':require(_0xaa1a('0x6'))};exports['consequence']=function(_0x186c2b,_0x3193c6,_0x4934e6,_0x3500c9){return function(_0x15b767){try{logger[_0xaa1a('0x7')](_0xaa1a('0x8'),_0x186c2b,_0x3193c6[0x0]);var _0x253dc7={'closed':0x1,'closedAt':moment()[_0xaa1a('0x9')](_0xaa1a('0xa')),'closeReason':_0xaa1a('0xb'),'disposition':_0x3193c6[0x0]};if(rpc[_0x3500c9[_0xaa1a('0xc')]+'Interaction']){rpc[_0x3500c9[_0xaa1a('0xc')]+'Interaction'][_0xaa1a('0xd')](_0x3500c9[_0xaa1a('0xe')]['id'],_0x253dc7)[_0xaa1a('0xf')](function(_0x4578e8){logger[_0xaa1a('0x7')](_0xaa1a('0x10'),_0x186c2b,_0x3500c9[_0xaa1a('0xe')]['id']);})[_0xaa1a('0x11')](function(_0x41640e){logger[_0xaa1a('0x12')](_0xaa1a('0x13'),_0x186c2b,JSON['stringify'](_0x41640e));})['finally'](function(){_0x15b767[_0xaa1a('0x14')]();});}}catch(_0x3b211d){logger[_0xaa1a('0x12')](_0xaa1a('0x13'),_0x186c2b,JSON[_0xaa1a('0x15')](_0x3b211d));_0x15b767[_0xaa1a('0x14')]();}};}; \ 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 bde9a87..6ae8a8d 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 _0xab8f=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','Message','then','info','[%s][DIALOGFLOW]\x20%s','stringify','finally','stop','textRequest','message','body','dialogflow','fulfillment','speech','providerName','providerResponse','create','metadata','endConversation','catch','error','next','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0xab8f,0x12b));var _0xfab8=function(_0x2b8041,_0x43be76){_0x2b8041=_0x2b8041-0x0;var _0x10c418=_0xab8f[_0x2b8041];return _0x10c418;};'use strict';var _=require(_0xfab8('0x0'));var moment=require(_0xfab8('0x1'));var apiai=require(_0xfab8('0x2'));var md5=require(_0xfab8('0x3'));var utils=require(_0xfab8('0x4'));var logger=require(_0xfab8('0x5'))(_0xfab8('0x6'));var rpc={'chatMessage':require(_0xfab8('0x7')),'openchannelMessage':require(_0xfab8('0x8')),'mailMessage':require(_0xfab8('0x9')),'smsMessage':require(_0xfab8('0xa')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfab8('0xb'))};exports[_0xfab8('0xc')]=function(_0x2ca3c7,_0x2da4ab){return function(_0x378fb6){try{if(!_[_0xfab8('0xd')](this[_0xfab8('0xe')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x2ca3c7,_0xfab8('0xf'));return _0x378fb6['next']();}var _0xbfe125={'ContactId':this[_0xfab8('0x10')]['id'],'sentAt':moment()['format'](_0xfab8('0x11')),'direction':_0xfab8('0x12')};if(this[_0xfab8('0x13')]===_0xfab8('0x14')||this[_0xfab8('0x13')]==='whatsapp'){_0xbfe125[_0xfab8('0x15')]=this['interaction'][_0xfab8('0x15')];}var _0x3c5268=this[_0xfab8('0x13')];if(_0x3c5268==='chat'){_0xbfe125[_0xfab8('0x16')]=this[_0xfab8('0x17')]['id'];}else{_0xbfe125[_[_0xfab8('0x18')](_0x3c5268)+_0xfab8('0x19')]=this[_0xfab8('0x17')]['id'];}_0xbfe125[_[_0xfab8('0x18')](_0x3c5268)+_0xfab8('0x1a')]=this[_0xfab8('0xe')]['id'];if(this[_0xfab8('0xe')][_0xfab8('0x1b')]){var _0x2f87d4=_0x2da4ab[0x2];if(!_[_0xfab8('0x1c')](_0x2f87d4)){_0xbfe125['body']=utils[_0xfab8('0x1d')](_0x2f87d4,this);return rpc[_0x3c5268+_0xfab8('0x1e')]['create'](_0xbfe125)[_0xfab8('0x1f')](function(_0x5f4411){logger[_0xfab8('0x20')](_0xfab8('0x21'),_0x2ca3c7,_0xbfe125['body']);})['catch'](function(_0x1b1460){logger['error'](_0xfab8('0x21'),_0x2ca3c7,JSON[_0xfab8('0x22')](_0x1b1460));})[_0xfab8('0x23')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2ca3c7);_0x378fb6['stop']();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2ca3c7);_0x378fb6[_0xfab8('0x24')]();}}else{var _0x4792f4=this;var _0x1a28b8=apiai(_0x2da4ab[0x0],{'language':_0x2da4ab[0x1]||'en'});return _0x1a28b8[_0xfab8('0x25')](this[_0xfab8('0x26')][_0xfab8('0x27')],{'sessionId':md5(this['interaction']['id'])})[_0xfab8('0x1f')](function(_0x4ff9ad){_0x4792f4['body'][_0xfab8('0x28')]=_0x4ff9ad;_0xbfe125['body']=_0x4ff9ad['result'][_0xfab8('0x29')][_0xfab8('0x2a')];_0xbfe125[_0xfab8('0x2b')]=_0xfab8('0x28');_0xbfe125[_0xfab8('0x2c')]=JSON['stringify'](_0x4ff9ad);return rpc[_0x3c5268+_0xfab8('0x1e')][_0xfab8('0x2d')](_0xbfe125)['then'](function(_0x3f2aaa){logger[_0xfab8('0x20')](_0xfab8('0x21'),_0x2ca3c7,_0xbfe125[_0xfab8('0x27')]);if(_0x4ff9ad['result'][_0xfab8('0x2e')][_0xfab8('0x2f')]){_0x378fb6['next']();}else{_0x378fb6['stop']();}})[_0xfab8('0x30')](function(_0xdfd783){logger[_0xfab8('0x31')](_0xfab8('0x21'),_0x2ca3c7,JSON[_0xfab8('0x22')](_0xdfd783));_0x378fb6[_0xfab8('0x32')]();});})[_0xfab8('0x30')](function(_0x4443ca){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x2ca3c7,_0x4443ca[_0xfab8('0x26')]);_0x378fb6[_0xfab8('0x32')]();});}}catch(_0x169fed){logger[_0xfab8('0x31')]('[%s][DIALOGFLOW]\x20%s',_0x2ca3c7,JSON['stringify'](_0x169fed));_0x378fb6[_0xfab8('0x24')]();}};}; \ No newline at end of file +var _0x4d30=['chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','fulfillment','speech','providerName','result','metadata','endConversation','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone'];(function(_0x29af9d,_0x3e0113){var _0x59a41b=function(_0x134e47){while(--_0x134e47){_0x29af9d['push'](_0x29af9d['shift']());}};_0x59a41b(++_0x3e0113);}(_0x4d30,0x1da));var _0x04d3=function(_0x1520f2,_0x44bacb){_0x1520f2=_0x1520f2-0x0;var _0x391188=_0x4d30[_0x1520f2];return _0x391188;};'use strict';var _=require(_0x04d3('0x0'));var moment=require(_0x04d3('0x1'));var apiai=require(_0x04d3('0x2'));var md5=require(_0x04d3('0x3'));var utils=require('./utils');var logger=require(_0x04d3('0x4'))(_0x04d3('0x5'));var rpc={'chatMessage':require(_0x04d3('0x6')),'openchannelMessage':require(_0x04d3('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x04d3('0x8')),'faxMessage':require(_0x04d3('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x04d3('0xa')]=function(_0x411be2,_0x332112){return function(_0x3be50f){try{if(!_[_0x04d3('0xb')](this[_0x04d3('0xc')][_0x04d3('0xd')])){logger[_0x04d3('0xe')](_0x04d3('0xf'),_0x411be2,_0x04d3('0x10'));return _0x3be50f[_0x04d3('0x11')]();}var _0x32e765={'ContactId':this[_0x04d3('0x12')]['id'],'sentAt':moment()[_0x04d3('0x13')](_0x04d3('0x14')),'direction':_0x04d3('0x15')};if(this[_0x04d3('0x16')]===_0x04d3('0x17')||this[_0x04d3('0x16')]===_0x04d3('0x18')){_0x32e765['phone']=this[_0x04d3('0xc')][_0x04d3('0x19')];}var _0x166df4=this[_0x04d3('0x16')];if(_0x166df4===_0x04d3('0x1a')){_0x32e765[_0x04d3('0x1b')]=this[_0x04d3('0x1c')]['id'];}else{_0x32e765[_[_0x04d3('0x1d')](_0x166df4)+_0x04d3('0x1e')]=this[_0x04d3('0x1c')]['id'];}_0x32e765[_[_0x04d3('0x1d')](_0x166df4)+_0x04d3('0x1f')]=this[_0x04d3('0xc')]['id'];if(this[_0x04d3('0xc')]['created']){var _0x5f1596=_0x332112[0x2];if(!_[_0x04d3('0x20')](_0x5f1596)){_0x32e765[_0x04d3('0x21')]=utils['getMustacheRender'](_0x5f1596,this);return rpc[_0x166df4+_0x04d3('0x22')][_0x04d3('0x23')](_0x32e765)[_0x04d3('0x24')](function(_0x31ce4e){logger[_0x04d3('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x411be2,_0x32e765[_0x04d3('0x21')]);})[_0x04d3('0x25')](function(_0xbb2e4c){logger[_0x04d3('0x26')](_0x04d3('0xf'),_0x411be2,JSON[_0x04d3('0x27')](_0xbb2e4c));})['finally'](function(){logger[_0x04d3('0xe')](_0x04d3('0x28'),_0x411be2);_0x3be50f['stop']();});}else{logger[_0x04d3('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x411be2);_0x3be50f[_0x04d3('0x29')]();}}else{var _0x5e8d86=this;var _0x4ee77c=apiai(_0x332112[0x0],{'language':_0x332112[0x1]||'en'});return _0x4ee77c[_0x04d3('0x2a')](this['message'][_0x04d3('0x21')],{'sessionId':md5(this[_0x04d3('0xc')]['id'])})[_0x04d3('0x24')](function(_0x5bcb56){_0x5e8d86[_0x04d3('0x21')][_0x04d3('0x2b')]=_0x5bcb56;_0x32e765[_0x04d3('0x21')]=_0x5bcb56['result'][_0x04d3('0x2c')][_0x04d3('0x2d')];_0x32e765[_0x04d3('0x2e')]=_0x04d3('0x2b');_0x32e765['providerResponse']=JSON[_0x04d3('0x27')](_0x5bcb56);return rpc[_0x166df4+'Message'][_0x04d3('0x23')](_0x32e765)['then'](function(_0x4b4165){logger[_0x04d3('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x411be2,_0x32e765[_0x04d3('0x21')]);if(_0x5bcb56[_0x04d3('0x2f')][_0x04d3('0x30')][_0x04d3('0x31')]){_0x3be50f[_0x04d3('0x11')]();}else{_0x3be50f[_0x04d3('0x29')]();}})[_0x04d3('0x25')](function(_0x1d4bb8){logger['error'](_0x04d3('0xf'),_0x411be2,JSON[_0x04d3('0x27')](_0x1d4bb8));_0x3be50f[_0x04d3('0x11')]();});})[_0x04d3('0x25')](function(_0x2bfa7c){logger[_0x04d3('0x26')](_0x04d3('0xf'),_0x411be2,_0x2bfa7c['message']);_0x3be50f['next']();});}}catch(_0x1864db){logger[_0x04d3('0x26')](_0x04d3('0xf'),_0x411be2,JSON[_0x04d3('0x27')](_0x1864db));_0x3be50f[_0x04d3('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 a4c637d..4b7a4b2 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 _0x8149=['dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','stringify','fulfillmentText','push','all','next','error','lodash','dialogflow','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','then','[%s][DIALOGFLOWV2]\x20%s','catch','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','create','info','finally','stop','SessionsClient','sessionPath','message','detectIntent','length'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8149,0xe6));var _0x9814=function(_0x3dea76,_0x13aafc){_0x3dea76=_0x3dea76-0x0;var _0x2a2dd5=_0x8149[_0x3dea76];return _0x2a2dd5;};'use strict';var _=require(_0x9814('0x0'));var dialogflow=require(_0x9814('0x1'));var md5=require('md5');var moment=require(_0x9814('0x2'));var Promise=require(_0x9814('0x3'));var logger=require(_0x9814('0x4'))(_0x9814('0x5'));var utils=require(_0x9814('0x6'));var rpc={'chatMessage':require(_0x9814('0x7')),'openchannelMessage':require(_0x9814('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x9814('0x9')),'whatsappMessage':require(_0x9814('0xa'))};function createMessage(_0x3f9417,_0x2bc514,_0x300acc,_0x74c0fd){return new Promise(function(_0x519425,_0x5a9e88){var _0x2a3762=_['clone'](_0x300acc);_0x2a3762[_0x9814('0xb')]=_0x74c0fd;return rpc[_0x2bc514+_0x9814('0xc')]['create'](_0x2a3762)[_0x9814('0xd')](function(){logger['info'](_0x9814('0xe'),_0x3f9417,_0x2a3762['body']);_0x519425();})[_0x9814('0xf')](function(_0x13dd0d){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x3f9417,JSON['stringify'](_0x13dd0d));_0x5a9e88(_0x13dd0d);});});}exports[_0x9814('0x10')]=function(_0x131014,_0x35a1ff){return function(_0x111c3c){try{if(!_[_0x9814('0x11')](this[_0x9814('0x12')]['UserId'])){logger['info'](_0x9814('0xe'),_0x131014,_0x9814('0x13'));return _0x111c3c['next']();}var _0x30d613={'ContactId':this[_0x9814('0x14')]['id'],'sentAt':moment()['format'](_0x9814('0x15')),'direction':_0x9814('0x16')};if(this[_0x9814('0x17')]===_0x9814('0x18')||this['channel']===_0x9814('0x19')){_0x30d613[_0x9814('0x1a')]=this['interaction'][_0x9814('0x1a')];}var _0x38441d=this[_0x9814('0x17')];if(_0x38441d==='chat'){_0x30d613[_0x9814('0x1b')]=this[_0x9814('0x1c')]['id'];}else{_0x30d613[_[_0x9814('0x1d')](_0x38441d)+_0x9814('0x1e')]=this[_0x9814('0x1c')]['id'];}_0x30d613[_['upperFirst'](_0x38441d)+_0x9814('0x1f')]=this[_0x9814('0x12')]['id'];if(this[_0x9814('0x12')]['created']){var _0x440e17=_0x35a1ff[0x4];if(!_[_0x9814('0x20')](_0x440e17)){_0x30d613[_0x9814('0xb')]=utils['getMustacheRender'](_0x440e17,this);return rpc[_0x38441d+_0x9814('0xc')][_0x9814('0x21')](_0x30d613)[_0x9814('0xd')](function(_0x4d526e){logger[_0x9814('0x22')](_0x9814('0xe'),_0x131014,_0x30d613[_0x9814('0xb')]);})[_0x9814('0xf')](function(_0x4fdcc2){logger['error'](_0x9814('0xe'),_0x131014,JSON['stringify'](_0x4fdcc2));})[_0x9814('0x23')](function(){logger[_0x9814('0x22')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x131014);_0x111c3c[_0x9814('0x24')]();});}else{logger[_0x9814('0x22')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x131014);_0x111c3c[_0x9814('0x24')]();}}else{var _0x20a5da=this;var _0x23eda5=_0x35a1ff[0x2]['replace'](/\\n/g,'\x0a');var _0x36ac37={'credentials':{'private_key':_0x23eda5,'client_email':_0x35a1ff[0x1]}};var _0x37e765=new dialogflow[(_0x9814('0x25'))](_0x36ac37);var _0x26f3e3=_0x37e765[_0x9814('0x26')](_0x35a1ff[0x0],md5(_0x20a5da[_0x9814('0x12')]['id']));var _0xbb659c={'session':_0x26f3e3,'queryInput':{'text':{'text':_0x20a5da[_0x9814('0x27')][_0x9814('0xb')],'languageCode':_0x35a1ff[0x3]||'en'}}};return _0x37e765[_0x9814('0x28')](_0xbb659c)[_0x9814('0xd')](function(_0x3d21ce){if(_0x3d21ce&&_0x3d21ce[_0x9814('0x29')]){_0x20a5da[_0x9814('0xb')][_0x9814('0x2a')]=_0x3d21ce;var _0x5d0ad7=_0x3d21ce[0x0];var _0x328e27=_0x5d0ad7[_0x9814('0x2b')][_0x9814('0x2c')]&&_0x5d0ad7[_0x9814('0x2b')]['diagnosticInfo'][_0x9814('0x2d')]?_0x5d0ad7['queryResult'][_0x9814('0x2c')]['fields'][_0x9814('0x2e')][_0x9814('0x2f')]:![];_0x20a5da[_0x9814('0xb')][_0x9814('0x30')]=_0x5d0ad7['queryResult'][_0x9814('0x31')];_0x20a5da[_0x9814('0xb')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x5d0ad7[_0x9814('0x2b')]['allRequiredParamsPresent'];_0x20a5da[_0x9814('0xb')][_0x9814('0x32')]=_0x5d0ad7[_0x9814('0x2b')]['diagnosticInfo']&&_0x5d0ad7[_0x9814('0x2b')]['diagnosticInfo'][_0x9814('0x2d')]?_0x5d0ad7[_0x9814('0x2b')]['diagnosticInfo'][_0x9814('0x2d')][_0x9814('0x2e')][_0x9814('0x2f')]:![];_0x20a5da['body'][_0x9814('0x33')]=_0x5d0ad7[_0x9814('0x2b')][_0x9814('0x34')]['name'];_0x20a5da[_0x9814('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x5d0ad7['queryResult'][_0x9814('0x34')][_0x9814('0x35')];_0x20a5da[_0x9814('0xb')][_0x9814('0x36')]=_0x5d0ad7['queryResult'][_0x9814('0x34')][_0x9814('0x37')];_0x20a5da[_0x9814('0xb')][_0x9814('0x38')]=_0x5d0ad7[_0x9814('0x2b')]['languageCode'];_0x20a5da[_0x9814('0xb')][_0x9814('0x39')]=_0x5d0ad7[_0x9814('0x2b')][_0x9814('0x3a')];_0x20a5da[_0x9814('0xb')][_0x9814('0x3b')]=_0x5d0ad7[_0x9814('0x2b')][_0x9814('0x3c')];_0x30d613[_0x9814('0x3d')]=_0x9814('0x2a');_0x30d613['providerResponse']=JSON[_0x9814('0x3e')](_0x3d21ce);var _0xb8c1a3=[];for(var _0x59b90e=0x0;_0x59b90e<_0x3d21ce[_0x9814('0x29')];_0x59b90e++){var _0x3d3677=_0x3d21ce[_0x59b90e];if(_0x3d3677&&_0x3d3677[_0x9814('0x2b')]&&_0x3d3677[_0x9814('0x2b')][_0x9814('0x3f')]){_0xb8c1a3[_0x9814('0x40')](createMessage(_0x131014,_0x38441d,_0x30d613,_0x3d3677[_0x9814('0x2b')][_0x9814('0x3f')]));}}return Promise[_0x9814('0x41')](_0xb8c1a3)['then'](function(){if(_0x328e27){_0x111c3c[_0x9814('0x42')]();}else{_0x111c3c[_0x9814('0x24')]();}})[_0x9814('0xf')](function(_0x21e4a5){logger[_0x9814('0x43')]('[%s][DIALOGFLOWV2]\x20%s',_0x131014,JSON[_0x9814('0x3e')](_0x21e4a5));_0x111c3c[_0x9814('0x42')]();});}})['catch'](function(_0x4dcbcc){logger[_0x9814('0x43')](_0x9814('0xe'),_0x131014,_0x4dcbcc[_0x9814('0x27')]);_0x111c3c[_0x9814('0x42')]();});}}catch(_0x5493db){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x131014,JSON['stringify'](_0x5493db));_0x111c3c['stop']();}};}; \ No newline at end of file +var _0x9fb9=['DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','push','all','next','stop','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','Message','create','then','info','body','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','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','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x9fb9,0xef));var _0x99fb=function(_0x6060dc,_0x5bc649){_0x6060dc=_0x6060dc-0x0;var _0x45edcc=_0x9fb9[_0x6060dc];return _0x45edcc;};'use strict';var _=require(_0x99fb('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x99fb('0x1'));var moment=require(_0x99fb('0x2'));var Promise=require(_0x99fb('0x3'));var logger=require(_0x99fb('0x4'))(_0x99fb('0x5'));var utils=require(_0x99fb('0x6'));var rpc={'chatMessage':require(_0x99fb('0x7')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x99fb('0x8')),'smsMessage':require(_0x99fb('0x9')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x99fb('0xa'))};function createMessage(_0x165f53,_0x2efc03,_0x514052,_0x21f9bf){return new Promise(function(_0xfafb2a,_0x3d1136){var _0x496570=_[_0x99fb('0xb')](_0x514052);_0x496570['body']=_0x21f9bf;return rpc[_0x2efc03+_0x99fb('0xc')][_0x99fb('0xd')](_0x496570)[_0x99fb('0xe')](function(){logger[_0x99fb('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x165f53,_0x496570[_0x99fb('0x10')]);_0xfafb2a();})[_0x99fb('0x11')](function(_0x5b14a7){logger[_0x99fb('0x12')](_0x99fb('0x13'),_0x165f53,JSON[_0x99fb('0x14')](_0x5b14a7));_0x3d1136(_0x5b14a7);});});}exports[_0x99fb('0x15')]=function(_0x1158c1,_0x35f489){return function(_0x3fb6b9){try{if(!_[_0x99fb('0x16')](this[_0x99fb('0x17')][_0x99fb('0x18')])){logger[_0x99fb('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x1158c1,_0x99fb('0x19'));return _0x3fb6b9['next']();}var _0x4c4a67={'ContactId':this[_0x99fb('0x1a')]['id'],'sentAt':moment()['format'](_0x99fb('0x1b')),'direction':'out'};if(this[_0x99fb('0x1c')]==='sms'||this[_0x99fb('0x1c')]===_0x99fb('0x1d')){_0x4c4a67[_0x99fb('0x1e')]=this[_0x99fb('0x17')][_0x99fb('0x1e')];}var _0x302cb6=this[_0x99fb('0x1c')];if(_0x302cb6===_0x99fb('0x1f')){_0x4c4a67[_0x99fb('0x20')]=this[_0x99fb('0x21')]['id'];}else{_0x4c4a67[_[_0x99fb('0x22')](_0x302cb6)+_0x99fb('0x23')]=this[_0x99fb('0x21')]['id'];}_0x4c4a67[_[_0x99fb('0x22')](_0x302cb6)+'InteractionId']=this['interaction']['id'];if(this[_0x99fb('0x17')][_0x99fb('0x24')]){var _0x33c127=_0x35f489[0x4];if(!_['isEmpty'](_0x33c127)){_0x4c4a67['body']=utils[_0x99fb('0x25')](_0x33c127,this);return rpc[_0x302cb6+_0x99fb('0xc')]['create'](_0x4c4a67)[_0x99fb('0xe')](function(_0xa7733a){logger['info'](_0x99fb('0x13'),_0x1158c1,_0x4c4a67['body']);})['catch'](function(_0x2e172e){logger[_0x99fb('0x12')](_0x99fb('0x13'),_0x1158c1,JSON[_0x99fb('0x14')](_0x2e172e));})['finally'](function(){logger['info'](_0x99fb('0x26'),_0x1158c1);_0x3fb6b9['stop']();});}else{logger[_0x99fb('0xf')](_0x99fb('0x27'),_0x1158c1);_0x3fb6b9['stop']();}}else{var _0x3fb3a3=this;var _0x365404=_0x35f489[0x2][_0x99fb('0x28')](/\\n/g,'\x0a');var _0x4269a7={'credentials':{'private_key':_0x365404,'client_email':_0x35f489[0x1]}};var _0x57763b=new dialogflow[(_0x99fb('0x29'))](_0x4269a7);var _0x2513eb=_0x57763b['sessionPath'](_0x35f489[0x0],md5(_0x3fb3a3['interaction']['id']));var _0x364572={'session':_0x2513eb,'queryInput':{'text':{'text':_0x3fb3a3[_0x99fb('0x2a')][_0x99fb('0x10')],'languageCode':_0x35f489[0x3]||'en'}}};return _0x57763b['detectIntent'](_0x364572)[_0x99fb('0xe')](function(_0x4406b8){if(_0x4406b8&&_0x4406b8[_0x99fb('0x2b')]){_0x3fb3a3['body']['dialogflowV2']=_0x4406b8;var _0x4b7461=_0x4406b8[0x0];var _0x262caa=_0x4b7461[_0x99fb('0x2c')][_0x99fb('0x2d')]&&_0x4b7461[_0x99fb('0x2c')][_0x99fb('0x2d')][_0x99fb('0x2e')]?_0x4b7461[_0x99fb('0x2c')]['diagnosticInfo']['fields'][_0x99fb('0x2f')][_0x99fb('0x30')]:![];_0x3fb3a3[_0x99fb('0x10')][_0x99fb('0x31')]=_0x4b7461[_0x99fb('0x2c')][_0x99fb('0x32')];_0x3fb3a3[_0x99fb('0x10')][_0x99fb('0x33')]=_0x4b7461['queryResult'][_0x99fb('0x34')];_0x3fb3a3['body'][_0x99fb('0x35')]=_0x4b7461[_0x99fb('0x2c')][_0x99fb('0x2d')]&&_0x4b7461[_0x99fb('0x2c')][_0x99fb('0x2d')]['fields']?_0x4b7461['queryResult'][_0x99fb('0x2d')][_0x99fb('0x2e')]['end_conversation'][_0x99fb('0x30')]:![];_0x3fb3a3[_0x99fb('0x10')][_0x99fb('0x36')]=_0x4b7461[_0x99fb('0x2c')]['intent'][_0x99fb('0x37')];_0x3fb3a3['body'][_0x99fb('0x38')]=_0x4b7461[_0x99fb('0x2c')][_0x99fb('0x39')]['displayName'];_0x3fb3a3['body'][_0x99fb('0x3a')]=_0x4b7461[_0x99fb('0x2c')][_0x99fb('0x39')][_0x99fb('0x3b')];_0x3fb3a3[_0x99fb('0x10')][_0x99fb('0x3c')]=_0x4b7461[_0x99fb('0x2c')][_0x99fb('0x3d')];_0x3fb3a3[_0x99fb('0x10')][_0x99fb('0x3e')]=_0x4b7461['queryResult'][_0x99fb('0x3f')];_0x3fb3a3[_0x99fb('0x10')][_0x99fb('0x40')]=_0x4b7461[_0x99fb('0x2c')]['intentDetectionConfidence'];_0x4c4a67[_0x99fb('0x41')]='dialogflowV2';_0x4c4a67[_0x99fb('0x42')]=JSON[_0x99fb('0x14')](_0x4406b8);var _0xe73790=[];for(var _0xf5398=0x0;_0xf5398<_0x4406b8[_0x99fb('0x2b')];_0xf5398++){var _0x56539d=_0x4406b8[_0xf5398];if(_0x56539d&&_0x56539d['queryResult']&&_0x56539d[_0x99fb('0x2c')][_0x99fb('0x43')]){_0xe73790[_0x99fb('0x44')](createMessage(_0x1158c1,_0x302cb6,_0x4c4a67,_0x56539d[_0x99fb('0x2c')][_0x99fb('0x43')]));}}return Promise[_0x99fb('0x45')](_0xe73790)['then'](function(){if(_0x262caa){_0x3fb6b9[_0x99fb('0x46')]();}else{_0x3fb6b9[_0x99fb('0x47')]();}})[_0x99fb('0x11')](function(_0x37218c){logger[_0x99fb('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x1158c1,JSON[_0x99fb('0x14')](_0x37218c));_0x3fb6b9['next']();});}})['catch'](function(_0x2f13f1){logger[_0x99fb('0x12')](_0x99fb('0x13'),_0x1158c1,_0x2f13f1[_0x99fb('0x2a')]);_0x3fb6b9[_0x99fb('0x46')]();});}}catch(_0x33a88c){logger[_0x99fb('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x1158c1,JSON[_0x99fb('0x14')](_0x33a88c));_0x3fb6b9['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 599441e..cb6704c 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 _0x4034=['priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','[%s][GOTOIF]\x20%s','map','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x4034,0x136));var _0x4403=function(_0x17bcce,_0x39ec4a){_0x17bcce=_0x17bcce-0x0;var _0x47fccb=_0x4034[_0x17bcce];return _0x47fccb;};'use strict';var schema=require(_0x4403('0x0'));var _=require(_0x4403('0x1'));var htmlToText=require(_0x4403('0x2'));var utils=require('./utils');var logger=require(_0x4403('0x3'))(_0x4403('0x4'));var gotoif=schema({'condition':{'type':_0x4403('0x5'),'required':!![],'message':_0x4403('0x6')},'priorityTrue':{'type':_0x4403('0x7'),'message':_0x4403('0x8')},'priorityFalse':{'type':_0x4403('0x7'),'message':_0x4403('0x9')}});exports[_0x4403('0xa')]=function(_0xe58756,_0x536b7e){return function(_0x3af9d7){try{var _0x316ac2={'condition':htmlToText[_0x4403('0xb')](utils['getMustacheRender'](_0x536b7e[0x0],this),{'wordwrap':![]})[_0x4403('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x536b7e[0x1],'priorityFalse':_0x536b7e[0x2]};var _0x5bfc2f=gotoif[_0x4403('0x0')](_0x316ac2,{'typecast':!![]});if(_0x5bfc2f[_0x4403('0xd')]){logger[_0x4403('0xe')](_0x4403('0xf'),_0xe58756,_[_0x4403('0x10')](_0x5bfc2f,'message')['join'](',\x20'));_0x3af9d7[_0x4403('0x11')]();}else{try{var _0x539b16=eval('('+_0x316ac2['condition']+')');var _0xaef824=_0x539b16?_0x316ac2[_0x4403('0x12')]:_0x316ac2[_0x4403('0x13')];logger[_0x4403('0x14')](_0x4403('0x15'),_0xe58756,_0x316ac2[_0x4403('0x16')],_0x539b16,_0xaef824||_0x4403('0x17'));if(_0xaef824){var _0x15fb96=_['findIndex'](_0x3af9d7[_0x4403('0x18')](),{'p':_0xaef824});if(_0x15fb96>=0x0){logger[_0x4403('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xe58756,_0xaef824||_0x4403('0x17'),_0x15fb96);_0x3af9d7[_0x4403('0x17')](_0x15fb96);}else{logger[_0x4403('0x14')](_0x4403('0x19'),_0xe58756,_0xaef824||_0x4403('0x17'));_0x3af9d7[_0x4403('0x11')]();}}else{_0x3af9d7[_0x4403('0x17')]();}}catch(_0x45bad6){logger[_0x4403('0xe')](_0x4403('0x1a'),_0xe58756,_0x45bad6[_0x4403('0x1b')]);_0x3af9d7[_0x4403('0x11')]();}}}catch(_0x2639b3){logger[_0x4403('0xe')]('[%s][GOTOIF]\x20%s',_0xe58756,JSON[_0x4403('0x1c')](_0x2639b3));_0x3af9d7[_0x4403('0x11')]();}};}; \ No newline at end of file +var _0xf8d1=['[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','condition','priorityTrue','priorityFalse','info'];(function(_0x206dc5,_0x5819bb){var _0x30f9d0=function(_0x25d010){while(--_0x25d010){_0x206dc5['push'](_0x206dc5['shift']());}};_0x30f9d0(++_0x5819bb);}(_0xf8d1,0x19b));var _0x1f8d=function(_0x2b6c06,_0x4ef67c){_0x2b6c06=_0x2b6c06-0x0;var _0x25a792=_0xf8d1[_0x2b6c06];return _0x25a792;};'use strict';var schema=require(_0x1f8d('0x0'));var _=require(_0x1f8d('0x1'));var htmlToText=require(_0x1f8d('0x2'));var utils=require(_0x1f8d('0x3'));var logger=require(_0x1f8d('0x4'))(_0x1f8d('0x5'));var gotoif=schema({'condition':{'type':_0x1f8d('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x1f8d('0x7'),'message':_0x1f8d('0x8')},'priorityFalse':{'type':_0x1f8d('0x7'),'message':_0x1f8d('0x9')}});exports[_0x1f8d('0xa')]=function(_0x287f6f,_0x5811dd){return function(_0x140441){try{var _0xd1a64d={'condition':htmlToText[_0x1f8d('0xb')](utils[_0x1f8d('0xc')](_0x5811dd[0x0],this),{'wordwrap':![]})[_0x1f8d('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5811dd[0x1],'priorityFalse':_0x5811dd[0x2]};var _0x4aae29=gotoif['validate'](_0xd1a64d,{'typecast':!![]});if(_0x4aae29[_0x1f8d('0xe')]){logger[_0x1f8d('0xf')](_0x1f8d('0x10'),_0x287f6f,_['map'](_0x4aae29,_0x1f8d('0x11'))[_0x1f8d('0x12')](',\x20'));_0x140441['stop']();}else{try{var _0x3c4345=eval('('+_0xd1a64d[_0x1f8d('0x13')]+')');var _0x14926f=_0x3c4345?_0xd1a64d[_0x1f8d('0x14')]:_0xd1a64d[_0x1f8d('0x15')];logger[_0x1f8d('0x16')](_0x1f8d('0x17'),_0x287f6f,_0xd1a64d[_0x1f8d('0x13')],_0x3c4345,_0x14926f||_0x1f8d('0x18'));if(_0x14926f){var _0x260d8d=_[_0x1f8d('0x19')](_0x140441['rules'](),{'p':_0x14926f});if(_0x260d8d>=0x0){logger[_0x1f8d('0x16')](_0x1f8d('0x1a'),_0x287f6f,_0x14926f||'next',_0x260d8d);_0x140441[_0x1f8d('0x18')](_0x260d8d);}else{logger[_0x1f8d('0x16')](_0x1f8d('0x1b'),_0x287f6f,_0x14926f||_0x1f8d('0x18'));_0x140441[_0x1f8d('0x1c')]();}}else{_0x140441['next']();}}catch(_0x197f60){logger['error'](_0x1f8d('0x1d'),_0x287f6f,_0x197f60[_0x1f8d('0x11')]);_0x140441[_0x1f8d('0x1c')]();}}}catch(_0x543c11){logger[_0x1f8d('0xf')]('[%s][GOTOIF]\x20%s',_0x287f6f,JSON[_0x1f8d('0x1e')](_0x543c11));_0x140441[_0x1f8d('0x1c')]();}};}; \ 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 145282a..a16f1ca 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 _0xb9a4=['info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','join','stop'];(function(_0x73354f,_0x347302){var _0x1197d3=function(_0x515e23){while(--_0x515e23){_0x73354f['push'](_0x73354f['shift']());}};_0x1197d3(++_0x347302);}(_0xb9a4,0x196));var _0x4b9a=function(_0xebba26,_0x2b213d){_0xebba26=_0xebba26-0x0;var _0x1e574c=_0xb9a4[_0xebba26];return _0x1e574c;};'use strict';var schema=require(_0x4b9a('0x0'));var _=require('lodash');var logger=require(_0x4b9a('0x1'))(_0x4b9a('0x2'));var gotop=schema({'priority':{'type':_0x4b9a('0x3'),'required':!![],'message':_0x4b9a('0x4')}});exports['consequence']=function(_0x5b20a0,_0x391d49){return function(_0x17a6c8){try{var _0x2fad2d={'priority':_0x391d49[0x0]};var _0x275221=gotop[_0x4b9a('0x0')](_0x2fad2d,{'typecast':!![]});if(_0x275221[_0x4b9a('0x5')]){logger[_0x4b9a('0x6')](_0x4b9a('0x7'),_0x5b20a0,_[_0x4b9a('0x8')](_0x275221,_0x4b9a('0x9'))[_0x4b9a('0xa')](',\x20'));_0x17a6c8[_0x4b9a('0xb')]();}else{logger[_0x4b9a('0xc')](_0x4b9a('0xd'),_0x5b20a0,_0x2fad2d[_0x4b9a('0xe')]);if(_0x2fad2d[_0x4b9a('0xe')]){var _0x708070=_[_0x4b9a('0xf')](_0x17a6c8[_0x4b9a('0x10')](),{'p':_0x2fad2d[_0x4b9a('0xe')]});if(_0x708070>=0x0){logger[_0x4b9a('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5b20a0,_0x2fad2d[_0x4b9a('0xe')]||'next',_0x708070);_0x17a6c8[_0x4b9a('0x11')](_0x708070);}else{logger[_0x4b9a('0xc')](_0x4b9a('0x12'),_0x5b20a0,_0x2fad2d['priority']||_0x4b9a('0x11'));_0x17a6c8['stop']();}}else{_0x17a6c8['next']();}}}catch(_0x441009){logger['error'](_0x4b9a('0x7'),_0x5b20a0,JSON['stringify'](_0x441009));_0x17a6c8[_0x4b9a('0xb')]();}};}; \ No newline at end of file +var _0x7503=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x290c7c,_0x33c9d6){var _0x461316=function(_0x1d288b){while(--_0x1d288b){_0x290c7c['push'](_0x290c7c['shift']());}};_0x461316(++_0x33c9d6);}(_0x7503,0x1bc));var _0x3750=function(_0x22ee1e,_0x3eff80){_0x22ee1e=_0x22ee1e-0x0;var _0x49a5c9=_0x7503[_0x22ee1e];return _0x49a5c9;};'use strict';var schema=require(_0x3750('0x0'));var _=require(_0x3750('0x1'));var logger=require(_0x3750('0x2'))(_0x3750('0x3'));var gotop=schema({'priority':{'type':_0x3750('0x4'),'required':!![],'message':_0x3750('0x5')}});exports[_0x3750('0x6')]=function(_0x21c95c,_0x4d3323){return function(_0x37937c){try{var _0x23acf4={'priority':_0x4d3323[0x0]};var _0x560c75=gotop[_0x3750('0x0')](_0x23acf4,{'typecast':!![]});if(_0x560c75[_0x3750('0x7')]){logger[_0x3750('0x8')](_0x3750('0x9'),_0x21c95c,_['map'](_0x560c75,_0x3750('0xa'))[_0x3750('0xb')](',\x20'));_0x37937c[_0x3750('0xc')]();}else{logger[_0x3750('0xd')](_0x3750('0xe'),_0x21c95c,_0x23acf4[_0x3750('0xf')]);if(_0x23acf4['priority']){var _0x2a98f7=_['findIndex'](_0x37937c[_0x3750('0x10')](),{'p':_0x23acf4['priority']});if(_0x2a98f7>=0x0){logger[_0x3750('0xd')](_0x3750('0x11'),_0x21c95c,_0x23acf4['priority']||_0x3750('0x12'),_0x2a98f7);_0x37937c['next'](_0x2a98f7);}else{logger[_0x3750('0xd')](_0x3750('0x13'),_0x21c95c,_0x23acf4['priority']||_0x3750('0x12'));_0x37937c[_0x3750('0xc')]();}}else{_0x37937c[_0x3750('0x12')]();}}}catch(_0x38e1f9){logger['error'](_0x3750('0x9'),_0x21c95c,JSON[_0x3750('0x14')](_0x38e1f9));_0x37937c[_0x3750('0xc')]();}};}; \ 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 3905b85..cddd92c 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 _0xf91a=['consequence','contact','chat','ChatWebsiteId','account','channel','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf91a,0x68));var _0xaf91=function(_0x275ed4,_0x312056){_0x275ed4=_0x275ed4-0x0;var _0x1538ab=_0xf91a[_0x275ed4];return _0x1538ab;};'use strict';var _=require('lodash');var utils=require(_0xaf91('0x0'));var logger=require(_0xaf91('0x1'))(_0xaf91('0x2'));var rpc={'chatMessage':require(_0xaf91('0x3')),'openchannelMessage':require(_0xaf91('0x4')),'mailMessage':require(_0xaf91('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xaf91('0x6')),'whatsappMessage':require(_0xaf91('0x7'))};exports[_0xaf91('0x8')]=function(_0x23b354,_0x12276b){return function(_0x291e4f){try{var _0x2aee5e={'body':utils['getMustacheRender'](_0x12276b[0x0],this),'ContactId':this[_0xaf91('0x9')]['id']};if(this['channel']===_0xaf91('0xa')){_0x2aee5e[_0xaf91('0xb')]=this[_0xaf91('0xc')]['id'];}else{_0x2aee5e[_['upperFirst'](this[_0xaf91('0xd')])+_0xaf91('0xe')]=this[_0xaf91('0xc')]['id'];}_0x2aee5e[_['upperFirst'](this[_0xaf91('0xd')])+_0xaf91('0xf')]=this[_0xaf91('0x10')]['id'];if(rpc[this['channel']+'Message']){return rpc[this['channel']+_0xaf91('0x11')][_0xaf91('0x12')](_0x2aee5e)[_0xaf91('0x13')](function(_0x10f37f){logger[_0xaf91('0x14')](_0xaf91('0x15'),_0x23b354,_0x2aee5e[_0xaf91('0x16')]);_0x291e4f[_0xaf91('0x17')]();})[_0xaf91('0x18')](function(_0x105e75){logger[_0xaf91('0x19')](_0xaf91('0x15'),_0x23b354,JSON[_0xaf91('0x1a')](_0x105e75));_0x291e4f[_0xaf91('0x1b')]();});}}catch(_0x29ff86){logger['error'](_0xaf91('0x15'),_0x23b354,JSON['stringify'](_0x29ff86));_0x291e4f[_0xaf91('0x1b')]();}};}; \ No newline at end of file +var _0x5702=['./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stop','stringify','lodash'];(function(_0x2086fc,_0x58b8c6){var _0x473309=function(_0x57b9bb){while(--_0x57b9bb){_0x2086fc['push'](_0x2086fc['shift']());}};_0x473309(++_0x58b8c6);}(_0x5702,0xca));var _0x2570=function(_0x4c64dd,_0x5e0d93){_0x4c64dd=_0x4c64dd-0x0;var _0x21af97=_0x5702[_0x4c64dd];return _0x21af97;};'use strict';var _=require(_0x2570('0x0'));var utils=require(_0x2570('0x1'));var logger=require(_0x2570('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2570('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2570('0x4')),'faxMessage':require(_0x2570('0x5')),'whatsappMessage':require(_0x2570('0x6'))};exports[_0x2570('0x7')]=function(_0x18a575,_0x5e10ba){return function(_0x4c5f23){try{var _0x173dab={'body':utils[_0x2570('0x8')](_0x5e10ba[0x0],this),'ContactId':this[_0x2570('0x9')]['id']};if(this[_0x2570('0xa')]===_0x2570('0xb')){_0x173dab[_0x2570('0xc')]=this[_0x2570('0xd')]['id'];}else{_0x173dab[_[_0x2570('0xe')](this[_0x2570('0xa')])+_0x2570('0xf')]=this['account']['id'];}_0x173dab[_[_0x2570('0xe')](this[_0x2570('0xa')])+_0x2570('0x10')]=this[_0x2570('0x11')]['id'];if(rpc[this[_0x2570('0xa')]+_0x2570('0x12')]){return rpc[this[_0x2570('0xa')]+'Message'][_0x2570('0x13')](_0x173dab)[_0x2570('0x14')](function(_0x557ab9){logger[_0x2570('0x15')](_0x2570('0x16'),_0x18a575,_0x173dab[_0x2570('0x17')]);_0x4c5f23[_0x2570('0x18')]();})[_0x2570('0x19')](function(_0x4c7672){logger[_0x2570('0x1a')](_0x2570('0x16'),_0x18a575,JSON['stringify'](_0x4c7672));_0x4c5f23[_0x2570('0x1b')]();});}}catch(_0x1903e2){logger[_0x2570('0x1a')]('[%s][MESSAGE]\x20%s',_0x18a575,JSON[_0x2570('0x1c')](_0x1903e2));_0x4c5f23[_0x2570('0x1b')]();}};}; \ 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 2dd34a7..8ae8d56 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 _0xd353=['stop','./utils','../../../../config/logger','routing','info','getMustacheRender','next','[%s][NOOP]\x20%s'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xd353,0x179));var _0x3d35=function(_0x1b8ce9,_0x225bf7){_0x1b8ce9=_0x1b8ce9-0x0;var _0x1304ad=_0xd353[_0x1b8ce9];return _0x1304ad;};'use strict';var utils=require(_0x3d35('0x0'));var logger=require(_0x3d35('0x1'))(_0x3d35('0x2'));exports['consequence']=function(_0x66c4c6,_0x2dfb56){return function(_0x531b27){try{logger[_0x3d35('0x3')]('[%s][NOOP]\x20%s',_0x66c4c6,utils[_0x3d35('0x4')](_0x2dfb56[0x0],this));_0x531b27[_0x3d35('0x5')]();}catch(_0x1b2f6f){logger['error'](_0x3d35('0x6'),_0x66c4c6,JSON['stringify'](_0x1b2f6f));_0x531b27[_0x3d35('0x7')]();}};}; \ No newline at end of file +var _0x7f6d=['next','error','stringify','stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s'];(function(_0x31ae59,_0x3d9eb4){var _0x52bc38=function(_0x48d4b0){while(--_0x48d4b0){_0x31ae59['push'](_0x31ae59['shift']());}};_0x52bc38(++_0x3d9eb4);}(_0x7f6d,0x100));var _0xd7f6=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x7f6d[_0xd0b415];return _0x2bdf2c;};'use strict';var utils=require(_0xd7f6('0x0'));var logger=require(_0xd7f6('0x1'))('routing');exports[_0xd7f6('0x2')]=function(_0x2f0cc8,_0x36a58b){return function(_0x77157d){try{logger[_0xd7f6('0x3')](_0xd7f6('0x4'),_0x2f0cc8,utils['getMustacheRender'](_0x36a58b[0x0],this));_0x77157d[_0xd7f6('0x5')]();}catch(_0xf5ccd4){logger[_0xd7f6('0x6')](_0xd7f6('0x4'),_0x2f0cc8,JSON[_0xd7f6('0x7')](_0xf5ccd4));_0x77157d[_0xd7f6('0x8')]();}};}; \ 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 f49b39d..af246f5 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 _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0x244427,_0x577ae6){var _0x383b49=function(_0x592d7c){while(--_0x592d7c){_0x244427['push'](_0x244427['shift']());}};_0x383b49(++_0x577ae6);}(_0xedd9,0xfc));var _0x9edd=function(_0x3ae1c8,_0x4f1c21){_0x3ae1c8=_0x3ae1c8-0x0;var _0x5a2621=_0xedd9[_0x3ae1c8];return _0x5a2621;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ No newline at end of file +var _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0xa79845,_0x523981){var _0x462c48=function(_0x119664){while(--_0x119664){_0xa79845['push'](_0xa79845['shift']());}};_0x462c48(++_0x523981);}(_0x34e8,0x12c));var _0x834e=function(_0x34ce54,_0x5917da){_0x34ce54=_0x34ce54-0x0;var _0x396094=_0x34e8[_0x34ce54];return _0x396094;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_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')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ 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 9f66ea6..9569468 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 _0xb2ed=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','info'];(function(_0x75e852,_0x2171f){var _0x307f14=function(_0x8af979){while(--_0x8af979){_0x75e852['push'](_0x75e852['shift']());}};_0x307f14(++_0x2171f);}(_0xb2ed,0x127));var _0xdb2e=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0xb2ed[_0x22431e];return _0xd978e9;};'use strict';var _=require(_0xdb2e('0x0'));var uuid=require(_0xdb2e('0x1'));var util=require(_0xdb2e('0x2'));var logger=require(_0xdb2e('0x3'))('routing');var Agent=function(_0x367ea6,_0x1b8b66,_0x55bb5f,_0x325f03){this[_0xdb2e('0x4')]=uuid['v4']();this[_0xdb2e('0x5')]=_0x367ea6;this[_0xdb2e('0x6')]=_0x1b8b66;this[_0xdb2e('0x7')]=_0x55bb5f;this[_0xdb2e('0x8')]=_0x325f03;this['squeue'][_0xdb2e('0x9')](this['handleRun'][_0xdb2e('0xa')](this),this[_0xdb2e('0xb')][_0xdb2e('0xa')](this));this[_0xdb2e('0x5')]['on'](_0xdb2e('0xc'),this[_0xdb2e('0xb')][_0xdb2e('0xa')](this));this[_0xdb2e('0x5')]['on'](_0xdb2e('0xd'),this[_0xdb2e('0xe')][_0xdb2e('0xa')](this));};Agent[_0xdb2e('0xf')][_0xdb2e('0x9')]=function(){this[_0xdb2e('0x5')][_0xdb2e('0x9')](this[_0xdb2e('0x10')]['bind'](this),this[_0xdb2e('0xb')][_0xdb2e('0xa')](this));};Agent[_0xdb2e('0xf')]['handleDrained']=function(){this[_0xdb2e('0xb')](!![]);};Agent[_0xdb2e('0xf')]['handleRun']=function(_0x3bbf94){logger['info'](_0xdb2e('0x11'),this[_0xdb2e('0x5')]['id'],this[_0xdb2e('0x6')]['id']);if(_[_0xdb2e('0x12')](this[_0xdb2e('0x7')]['agents'][this[_0xdb2e('0x6')]['id']])){logger[_0xdb2e('0x13')](_0xdb2e('0x14'),this['squeue']['id'],this[_0xdb2e('0x6')]['id']);setTimeout(this[_0xdb2e('0x9')]['bind'](this),0x3e8);}else{if(this['routing'][_0xdb2e('0x15')]||util['isAgentAvailable'](this[_0xdb2e('0x5')]['id'],this[_0xdb2e('0x7')][_0xdb2e('0x16')][this[_0xdb2e('0x6')]['id']],this[_0xdb2e('0x5')][_0xdb2e('0x17')],![])){this[_0xdb2e('0x7')]['agents'][this['agent']['id']][_0xdb2e('0x18')]=!![];this[_0xdb2e('0x7')][_0xdb2e('0x16')][this[_0xdb2e('0x6')]['id']][_0xdb2e('0x19')]=undefined;util[_0xdb2e('0x1a')](this['notificationId'],this[_0xdb2e('0x5')]['id'],this[_0xdb2e('0x7')][_0xdb2e('0x16')][this['agent']['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this[_0xdb2e('0x7')][_0xdb2e('0x16')][this[_0xdb2e('0x6')]['id']],_0xdb2e('0x1b')+(this['routing']['forcedOwnership']?_0xdb2e('0x1c'):''));}else{logger[_0xdb2e('0x13')](_0xdb2e('0x1d'),this[_0xdb2e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xdb2e('0x9')]['bind'](this),0x3e8);}}};Agent[_0xdb2e('0xf')][_0xdb2e('0xb')]=function(_0x553050){if(_[_0xdb2e('0x12')](this[_0xdb2e('0x7')][_0xdb2e('0x16')][this[_0xdb2e('0x6')]['id']])){return logger[_0xdb2e('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xdb2e('0x5')]['id'],this['agent']['id']);}else{logger[_0xdb2e('0x13')](_0xdb2e('0x1e'),this[_0xdb2e('0x5')]['id'],this[_0xdb2e('0x6')]['id']);util['hideNotification'](this[_0xdb2e('0x4')],this['squeue']['id'],this['realtime'][_0xdb2e('0x16')][this[_0xdb2e('0x6')]['id']],null,this[_0xdb2e('0x8')]);this['realtime'][_0xdb2e('0x16')][this[_0xdb2e('0x6')]['id']][_0xdb2e('0x18')]=![];this['realtime']['agents'][this[_0xdb2e('0x6')]['id']][_0xdb2e('0x19')]=undefined;util[_0xdb2e('0x1f')](this[_0xdb2e('0x5')]['id'],this['realtime'][_0xdb2e('0x16')][this[_0xdb2e('0x6')]['id']],_0x553050?_0xdb2e('0x20'):_0xdb2e('0x21'));}if(!_0x553050){setTimeout(this[_0xdb2e('0x9')][_0xdb2e('0xa')](this),0x3e8);}};function agent(_0x3173ad,_0xcf1f88,_0x1c1ebf,_0x5485d3){return new Agent(_0x3173ad,_0xcf1f88,_0x1c1ebf,_0x5485d3);}module[_0xdb2e('0x22')]=agent; \ No newline at end of file +var _0xcf7d=['prototype','handleRun','info','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','bind','timeout','handleTimeout','handleDrained'];(function(_0x4c25a3,_0x464461){var _0x3dc49d=function(_0x5a8fc7){while(--_0x5a8fc7){_0x4c25a3['push'](_0x4c25a3['shift']());}};_0x3dc49d(++_0x464461);}(_0xcf7d,0x8a));var _0xdcf7=function(_0x3e2f66,_0xcfe66d){_0x3e2f66=_0x3e2f66-0x0;var _0x98a963=_0xcf7d[_0x3e2f66];return _0x98a963;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xdcf7('0x0'));var logger=require(_0xdcf7('0x1'))('routing');var Agent=function(_0x202193,_0x47ba89,_0x13821d,_0x5502a8){this[_0xdcf7('0x2')]=uuid['v4']();this[_0xdcf7('0x3')]=_0x202193;this[_0xdcf7('0x4')]=_0x47ba89;this[_0xdcf7('0x5')]=_0x13821d;this[_0xdcf7('0x6')]=_0x5502a8;this[_0xdcf7('0x3')][_0xdcf7('0x7')](this['handleRun'][_0xdcf7('0x8')](this),this['handleTimeout'][_0xdcf7('0x8')](this));this[_0xdcf7('0x3')]['on'](_0xdcf7('0x9'),this[_0xdcf7('0xa')]['bind'](this));this['squeue']['on']('drained',this[_0xdcf7('0xb')][_0xdcf7('0x8')](this));};Agent[_0xdcf7('0xc')][_0xdcf7('0x7')]=function(){this['squeue'][_0xdcf7('0x7')](this[_0xdcf7('0xd')][_0xdcf7('0x8')](this),this['handleTimeout'][_0xdcf7('0x8')](this));};Agent['prototype'][_0xdcf7('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0xdcf7('0xc')]['handleRun']=function(_0x6a8cee){logger[_0xdcf7('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xdcf7('0x4')]['id']);if(_[_0xdcf7('0xf')](this[_0xdcf7('0x5')][_0xdcf7('0x10')][this[_0xdcf7('0x4')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xdcf7('0x4')]['id']);setTimeout(this['push'][_0xdcf7('0x8')](this),0x3e8);}else{if(this[_0xdcf7('0x6')][_0xdcf7('0x11')]||util[_0xdcf7('0x12')](this['squeue']['id'],this[_0xdcf7('0x5')]['agents'][this[_0xdcf7('0x4')]['id']],this[_0xdcf7('0x3')][_0xdcf7('0x13')],![])){this[_0xdcf7('0x5')][_0xdcf7('0x10')][this[_0xdcf7('0x4')]['id']][_0xdcf7('0x14')]=!![];this[_0xdcf7('0x5')][_0xdcf7('0x10')][this[_0xdcf7('0x4')]['id']][_0xdcf7('0x15')]=undefined;util[_0xdcf7('0x16')](this[_0xdcf7('0x2')],this[_0xdcf7('0x3')]['id'],this[_0xdcf7('0x5')][_0xdcf7('0x10')][this[_0xdcf7('0x4')]['id']],null,this['routing']);util[_0xdcf7('0x17')](this[_0xdcf7('0x3')]['id'],this['realtime'][_0xdcf7('0x10')][this[_0xdcf7('0x4')]['id']],_0xdcf7('0x18')+(this[_0xdcf7('0x6')][_0xdcf7('0x11')]?':FORCED':''));}else{logger[_0xdcf7('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0xdcf7('0x4')]['id']);setTimeout(this[_0xdcf7('0x7')][_0xdcf7('0x8')](this),0x3e8);}}};Agent[_0xdcf7('0xc')][_0xdcf7('0xa')]=function(_0x10df36){if(_['isNil'](this['realtime'][_0xdcf7('0x10')][this[_0xdcf7('0x4')]['id']])){return logger['info'](_0xdcf7('0x19'),this['squeue']['id'],this[_0xdcf7('0x4')]['id']);}else{logger[_0xdcf7('0xe')](_0xdcf7('0x1a'),this[_0xdcf7('0x3')]['id'],this[_0xdcf7('0x4')]['id']);util[_0xdcf7('0x1b')](this[_0xdcf7('0x2')],this[_0xdcf7('0x3')]['id'],this[_0xdcf7('0x5')]['agents'][this[_0xdcf7('0x4')]['id']],null,this[_0xdcf7('0x6')]);this[_0xdcf7('0x5')]['agents'][this[_0xdcf7('0x4')]['id']][_0xdcf7('0x14')]=![];this[_0xdcf7('0x5')][_0xdcf7('0x10')][this[_0xdcf7('0x4')]['id']][_0xdcf7('0x15')]=undefined;util['writeLog'](this[_0xdcf7('0x3')]['id'],this[_0xdcf7('0x5')]['agents'][this['agent']['id']],_0x10df36?'STOP':_0xdcf7('0x1c'));}if(!_0x10df36){setTimeout(this[_0xdcf7('0x7')][_0xdcf7('0x8')](this),0x3e8);}};function agent(_0x147276,_0x4cccf6,_0x20de7c,_0x4a23de){return new Agent(_0x147276,_0x4cccf6,_0x20de7c,_0x4a23de);}module[_0xdcf7('0x1d')]=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 4359d29..9efd9c8 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 _0x62bb=['STOP','busyQueue','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','realtime','push','handleRun','bind','handleTimeout','squeue','drained','handleDrained','prototype','queue','isNil','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','agents','busy','name','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog'];(function(_0x1b76e6,_0x598520){var _0x333b53=function(_0x106e6a){while(--_0x106e6a){_0x1b76e6['push'](_0x1b76e6['shift']());}};_0x333b53(++_0x598520);}(_0x62bb,0x1a3));var _0xb62b=function(_0x234f0b,_0x5408f5){_0x234f0b=_0x234f0b-0x0;var _0x18dea2=_0x62bb[_0x234f0b];return _0x18dea2;};'use strict';var _=require(_0xb62b('0x0'));var uuid=require(_0xb62b('0x1'));var util=require('./util');var logger=require(_0xb62b('0x2'))(_0xb62b('0x3'));var Beepall=function(_0x5dd6cd,_0x5534f3,_0x5cfddf,_0x2c246d){this[_0xb62b('0x4')]=uuid['v4']();this['squeue']=_0x5dd6cd;this['queue']=_0x5534f3;this[_0xb62b('0x5')]=_0x5cfddf;this[_0xb62b('0x3')]=_0x2c246d;this['squeue'][_0xb62b('0x6')](this[_0xb62b('0x7')][_0xb62b('0x8')](this),this[_0xb62b('0x9')][_0xb62b('0x8')](this));this[_0xb62b('0xa')]['on']('timeout',this[_0xb62b('0x9')][_0xb62b('0x8')](this));this[_0xb62b('0xa')]['on'](_0xb62b('0xb'),this[_0xb62b('0xc')][_0xb62b('0x8')](this));};Beepall[_0xb62b('0xd')][_0xb62b('0x6')]=function(){this[_0xb62b('0xa')][_0xb62b('0x6')](this[_0xb62b('0x7')]['bind'](this),this[_0xb62b('0x9')][_0xb62b('0x8')](this));};Beepall[_0xb62b('0xd')]['handleDrained']=function(_0x4ba50d){this[_0xb62b('0x9')](!![]);};Beepall[_0xb62b('0xd')][_0xb62b('0x7')]=function(_0x27e53c){var _0x40db62=!![];if(!_['isNil'](this[_0xb62b('0xe')])&&!_[_0xb62b('0xf')](this[_0xb62b('0xe')][_0xb62b('0x10')])&&this[_0xb62b('0xe')][_0xb62b('0x10')][_0xb62b('0x11')]>0x0){for(var _0x4e863a=0x0,_0x5873ae;_0x4e863a0x0){for(var _0xafd3de=0x0,_0x375d46;_0xafd3de0x0&&_0x4d39a3[_0x923475+'CurrentCapacity']>=_0x4d39a3[_0x923475+_0xc52f('0x23')]){writeLog(_0x2a3009,_0x4d39a3,_0x923475[_0xc52f('0x25')]()+_0xc52f('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x414025,_0x482fe1,_0x1f2b8e,_0xd4e6a9,_0x3382de){return sendNotification(!![],_0x414025,_0x482fe1,_0x1f2b8e,_0xd4e6a9,_0x3382de);};exports[_0xc52f('0x27')]=function(_0x1a972f,_0x4e4626,_0x32a81a,_0x2d8553,_0x15e67e){return sendNotification(![],_0x1a972f,_0x4e4626,_0x32a81a,_0x2d8553,_0x15e67e);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x0102=['socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','remove','info','isAgentAvailable','BUSY','Pause','PAUSE','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','util','../utils','mustache','ioredis','redis','localhost'];(function(_0x2f9d3e,_0x29345f){var _0x32d8e6=function(_0x9f63fc){while(--_0x9f63fc){_0x2f9d3e['push'](_0x2f9d3e['shift']());}};_0x32d8e6(++_0x29345f);}(_0x0102,0x186));var _0x2010=function(_0xb9c0ea,_0x38f07a){_0xb9c0ea=_0xb9c0ea-0x0;var _0x2b9309=_0x0102[_0xb9c0ea];return _0x2b9309;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var utils=require(_0x2010('0x1'));var Mustache=require(_0x2010('0x2'));var Redis=require(_0x2010('0x3'));var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')('routing');config['redis']=_['defaults'](config[_0x2010('0x4')],{'host':_0x2010('0x5'),'port':0x18eb});var io=require(_0x2010('0x6'))(new Redis(config[_0x2010('0x4')]));function emit(_0x4eeb67,_0x453fc0,_0x495d98){io['to'](_0x4eeb67)[_0x2010('0x7')](_0x453fc0,_0x495d98);}function sendNotification(_0x160e41,_0x48dd91,_0x1f94ca,_0x3c2d98,_0x3d34d4,_0x3acdbb){io['to'](util[_0x2010('0x8')](_0x2010('0x9'),_0x3c2d98[_0x2010('0xa')]))[_0x2010('0x7')](_0x2010('0xb'),_0x3c2d98);var _0x39a821=_0x3acdbb||{};var _0x1d3b39=_0x1f94ca[_0x2010('0xc')]('.');var _0x2d09c5={'uniqueid':_0x48dd91,'channel':_0x1d3b39[0x0],'id':_0x1d3b39[0x1],'title':_0x1d3b39[0x0]+_0x2010('0xd'),'interactionId':_0x1d3b39[0x2],'queue':_0x3d34d4?_0x3d34d4[_0x2010('0xa')]:null,'sound':_0x39a821[_0x2010('0xe')]['notificationSound'],'shake':_0x39a821['account'][_0x2010('0xf')]};try{if(!_0x39a821[_0x2010('0x10')]){_0x39a821[_0x2010('0x10')]={};}if(_0x3d34d4){_0x39a821[_0x2010('0x10')][_0x2010('0x11')]=_0x3d34d4;}else if(_0x39a821[_0x2010('0x10')]['queue']){delete _0x39a821[_0x2010('0x10')][_0x2010('0x11')];}_0x2d09c5['msg']=utils[_0x2010('0x12')](_0x39a821[_0x2010('0xe')][_0x2010('0x13')],_0x39a821);}catch(_0x2b403a){_0x2d09c5[_0x2010('0x14')]=_0x2010('0x15');logger[_0x2010('0x16')](util[_0x2010('0x8')](_0x2010('0x17'),_0x48dd91,_0x2b403a['message']));}io['to'](util['format'](_0x2010('0x9'),_0x3c2d98[_0x2010('0xa')]))[_0x2010('0x7')](util[_0x2010('0x8')]('notification:%s',_0x160e41?'save':_0x2010('0x18')),_0x2d09c5);}function writeLog(_0x171e45,_0x37b51b,_0x26facc){return logger[_0x2010('0x19')](util[_0x2010('0x8')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x171e45,_0x37b51b[_0x2010('0xa')],_0x26facc));}exports[_0x2010('0x1a')]=function(_0x58ff30,_0x499eee,_0x50aecc,_0x424453){if(_0x499eee['busy']){writeLog(_0x58ff30,_0x499eee,_0x2010('0x1b'));return![];}if(!_0x499eee['online']){writeLog(_0x58ff30,_0x499eee,'OFFLINE');return![];}if(_0x499eee[_0x50aecc+_0x2010('0x1c')]){writeLog(_0x58ff30,_0x499eee,_0x2010('0x1d'));return![];}if(_0x424453&&_0x499eee['hasOwnProperty'](_0x50aecc+_0x2010('0x1e'))&&_0x499eee['hasOwnProperty'](_0x50aecc+_0x2010('0x1f'))){if(_0x499eee[_0x50aecc+_0x2010('0x1e')]>0x0&&_0x499eee[_0x50aecc+_0x2010('0x1f')]>=_0x499eee[_0x50aecc+_0x2010('0x1e')]){writeLog(_0x58ff30,_0x499eee,_0x50aecc[_0x2010('0x20')]()+_0x2010('0x21'));return![];}}return!![];};exports[_0x2010('0x22')]=function(_0x3eb4dc,_0x405f04,_0x103460,_0x122ee3,_0x2ebdbb){return sendNotification(!![],_0x3eb4dc,_0x405f04,_0x103460,_0x122ee3,_0x2ebdbb);};exports['hideNotification']=function(_0x2a4691,_0x52fe5e,_0x5b52fb,_0x147a5a,_0xd16c04){return sendNotification(![],_0x2a4691,_0x52fe5e,_0x5b52fb,_0x147a5a,_0xd16c04);};exports[_0x2010('0x23')]=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 21e09f7..6192f90 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 _0xa225=['[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty'];(function(_0x2b966e,_0x48f12d){var _0xfdf7fb=function(_0x58a9b0){while(--_0x58a9b0){_0x2b966e['push'](_0x2b966e['shift']());}};_0xfdf7fb(++_0x48f12d);}(_0xa225,0xe6));var _0x5a22=function(_0x5ababe,_0x54b6a7){_0x5ababe=_0x5ababe-0x0;var _0x26ea83=_0xa225[_0x5ababe];return _0x26ea83;};'use strict';var schema=require(_0x5a22('0x0'));var sh=require(_0x5a22('0x1'));var _=require(_0x5a22('0x2'));var utils=require(_0x5a22('0x3'));var logger=require(_0x5a22('0x4'))(_0x5a22('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x5a22('0x6')}});exports[_0x5a22('0x7')]=function(_0x17808d,_0x47a4a1){return function(_0x524d53){try{var _0x4dd93d={'command':_0x47a4a1[0x0]};var _0x3edd86=system[_0x5a22('0x0')](_0x4dd93d,{'typecast':!![]});if(_0x3edd86['length']){logger['error'](_0x5a22('0x8'),_0x17808d,_[_0x5a22('0x9')](_0x3edd86,_0x5a22('0xa'))[_0x5a22('0xb')](',\x20'));logger[_0x5a22('0xc')](_0x5a22('0xd'),_0x17808d);_0x524d53[_0x5a22('0xe')]();}else{var _0x2646a7=this;var _0x2b7b1d=utils[_0x5a22('0xf')](_0x47a4a1[0x0],this);logger[_0x5a22('0xc')](_0x5a22('0x10'),_0x17808d,_0x2b7b1d);sh[_0x5a22('0x11')](_[_0x5a22('0x12')](_0x2b7b1d),function(_0x318668,_0x2a4523){logger[_0x5a22('0xc')](_0x5a22('0x13'),_0x17808d,_0x318668);if(_0x318668==0x0){var _0x3b0e9d=_0x2a4523[_0x5a22('0x14')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x47a4a1[0x1])||_[_0x5a22('0x15')](_0x47a4a1[0x1])){logger[_0x5a22('0xc')](_0x5a22('0x16'),_0x17808d);_0x2646a7[_0x5a22('0x17')][_0x47a4a1[0x1]]=_0x3b0e9d;}else{logger['info'](_0x5a22('0x18'),_0x17808d,_0x47a4a1[0x1],_0x3b0e9d);_0x2646a7['body'][_0x47a4a1[0x1]]=_0x3b0e9d;}}_0x524d53['next']();});}}catch(_0x4ba213){logger[_0x5a22('0x19')](_0x5a22('0x8'),_0x17808d,_[_0x5a22('0x1a')](_0x4ba213)?JSON[_0x5a22('0x1b')](_0x4ba213):_0x4ba213);logger[_0x5a22('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x17808d);_0x524d53['next']();}};}; \ No newline at end of file +var _0x7820=['[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','[%s][SYSTEM]\x20no\x20variable','body','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender'];(function(_0x40dc8f,_0x910e35){var _0x3f08d3=function(_0x4cbb33){while(--_0x4cbb33){_0x40dc8f['push'](_0x40dc8f['shift']());}};_0x3f08d3(++_0x910e35);}(_0x7820,0x1c2));var _0x0782=function(_0x356fa3,_0x1e6c2b){_0x356fa3=_0x356fa3-0x0;var _0x257ae7=_0x7820[_0x356fa3];return _0x257ae7;};'use strict';var schema=require(_0x0782('0x0'));var sh=require(_0x0782('0x1'));var _=require(_0x0782('0x2'));var utils=require(_0x0782('0x3'));var logger=require(_0x0782('0x4'))(_0x0782('0x5'));var system=schema({'command':{'type':_0x0782('0x6'),'required':!![],'message':_0x0782('0x7')}});exports[_0x0782('0x8')]=function(_0x590fca,_0x3e99bc){return function(_0x1a87c3){try{var _0x197a8c={'command':_0x3e99bc[0x0]};var _0x900e3e=system[_0x0782('0x0')](_0x197a8c,{'typecast':!![]});if(_0x900e3e[_0x0782('0x9')]){logger[_0x0782('0xa')](_0x0782('0xb'),_0x590fca,_[_0x0782('0xc')](_0x900e3e,_0x0782('0xd'))[_0x0782('0xe')](',\x20'));logger[_0x0782('0xf')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x590fca);_0x1a87c3[_0x0782('0x10')]();}else{var _0x1cd48c=this;var _0xa85fdf=utils[_0x0782('0x11')](_0x3e99bc[0x0],this);logger[_0x0782('0xf')](_0x0782('0x12'),_0x590fca,_0xa85fdf);sh[_0x0782('0x13')](_[_0x0782('0x14')](_0xa85fdf),function(_0x52c7a7,_0x19575b){logger[_0x0782('0xf')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x590fca,_0x52c7a7);if(_0x52c7a7==0x0){var _0x26bbde=_0x19575b['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x0782('0x15')](_0x3e99bc[0x1])||_['isEmpty'](_0x3e99bc[0x1])){logger['info'](_0x0782('0x16'),_0x590fca);_0x1cd48c[_0x0782('0x17')][_0x3e99bc[0x1]]=_0x26bbde;}else{logger[_0x0782('0xf')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x590fca,_0x3e99bc[0x1],_0x26bbde);_0x1cd48c[_0x0782('0x17')][_0x3e99bc[0x1]]=_0x26bbde;}}_0x1a87c3[_0x0782('0x10')]();});}}catch(_0x85eb54){logger['error'](_0x0782('0xb'),_0x590fca,_['isObject'](_0x85eb54)?JSON[_0x0782('0x18')](_0x85eb54):_0x85eb54);logger[_0x0782('0xf')](_0x0782('0x19'),_0x590fca);_0x1a87c3['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 8c600e5..e48a856 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 _0x01de=['../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction'];(function(_0x19b9de,_0x4e54c6){var _0x1cd9ec=function(_0x48678c){while(--_0x48678c){_0x19b9de['push'](_0x19b9de['shift']());}};_0x1cd9ec(++_0x4e54c6);}(_0x01de,0x19d));var _0xe01d=function(_0x24a79c,_0x5da1d9){_0x24a79c=_0x24a79c-0x0;var _0x3a7c58=_0x01de[_0x24a79c];return _0x3a7c58;};'use strict';var schema=require(_0xe01d('0x0'));var _=require(_0xe01d('0x1'));var rpc={'chatInteraction':require(_0xe01d('0x2')),'openchannelInteraction':require(_0xe01d('0x3')),'smsInteraction':require(_0xe01d('0x4')),'mailInteraction':require(_0xe01d('0x5')),'faxInteraction':require(_0xe01d('0x6')),'whatsappInteraction':require(_0xe01d('0x7'))};var logger=require(_0xe01d('0x8'))(_0xe01d('0x9'));var tag=schema({'tag':{'type':_0xe01d('0xa'),'required':!![],'message':_0xe01d('0xb')}});exports[_0xe01d('0xc')]=function(_0x470cd3,_0x50a7bd,_0x355bdf,_0x46ea30){return function(_0x3b00f2){try{var _0x2fe769={'tag':_0x50a7bd[0x0]};var _0x4c2f76=tag['validate'](_0x2fe769,{'typecast':!![]});if(_0x4c2f76['length']){logger[_0xe01d('0xd')]('[%s][TAG]\x20%s',_0x470cd3,_['map'](_0x4c2f76,'message')[_0xe01d('0xe')](',\x20'));logger[_0xe01d('0xf')](_0xe01d('0x10'),_0x470cd3);_0x3b00f2[_0xe01d('0x11')]();}else{var _0x234986={'ids':[_0x50a7bd[0x0]]};if(rpc[_0x46ea30['channel']+_0xe01d('0x12')]){rpc[_0x46ea30[_0xe01d('0x13')]+_0xe01d('0x12')][_0xe01d('0x14')](_0x46ea30[_0xe01d('0x15')]['id'],_0x234986)[_0xe01d('0x16')](function(_0xedaa94){logger[_0xe01d('0xf')](_0xe01d('0x17'),_0x470cd3,_0x50a7bd[0x1],_0x46ea30[_0xe01d('0x13')],_0x46ea30[_0xe01d('0x15')]['id']);})[_0xe01d('0x18')](function(_0x5c5755){logger[_0xe01d('0xd')](_0xe01d('0x19'),_0x470cd3,JSON[_0xe01d('0x1a')](_0x5c5755));logger[_0xe01d('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x470cd3);})['finally'](function(){_0x3b00f2['next']();});}}}catch(_0xb3bdce){logger[_0xe01d('0xd')](_0xe01d('0x19'),_0x470cd3,_[_0xe01d('0x1b')](_0xb3bdce)?JSON[_0xe01d('0x1a')](_0xb3bdce):_0xb3bdce);logger[_0xe01d('0xf')](_0xe01d('0x10'),_0x470cd3);_0x3b00f2[_0xe01d('0x11')]();}};}; \ No newline at end of file +var _0x44de=['channel','Interaction','interaction','stringify','finally','next','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0x44de,0x15a));var _0xe44d=function(_0x3993f0,_0x40c90e){_0x3993f0=_0x3993f0-0x0;var _0x4545d9=_0x44de[_0x3993f0];return _0x4545d9;};'use strict';var schema=require(_0xe44d('0x0'));var _=require(_0xe44d('0x1'));var rpc={'chatInteraction':require(_0xe44d('0x2')),'openchannelInteraction':require(_0xe44d('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xe44d('0x4')),'whatsappInteraction':require(_0xe44d('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0xe44d('0x6'),'required':!![],'message':_0xe44d('0x7')}});exports['consequence']=function(_0x405c31,_0xded4e8,_0x101c09,_0x6facdb){return function(_0x52e86a){try{var _0xa8b2e1={'tag':_0xded4e8[0x0]};var _0xd58869=tag[_0xe44d('0x0')](_0xa8b2e1,{'typecast':!![]});if(_0xd58869['length']){logger[_0xe44d('0x8')](_0xe44d('0x9'),_0x405c31,_['map'](_0xd58869,_0xe44d('0xa'))[_0xe44d('0xb')](',\x20'));logger[_0xe44d('0xc')](_0xe44d('0xd'),_0x405c31);_0x52e86a['next']();}else{var _0x2fad6f={'ids':[_0xded4e8[0x0]]};if(rpc[_0x6facdb[_0xe44d('0xe')]+_0xe44d('0xf')]){rpc[_0x6facdb[_0xe44d('0xe')]+_0xe44d('0xf')]['addTags'](_0x6facdb[_0xe44d('0x10')]['id'],_0x2fad6f)['then'](function(_0x22de08){logger[_0xe44d('0xc')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x405c31,_0xded4e8[0x1],_0x6facdb['channel'],_0x6facdb[_0xe44d('0x10')]['id']);})['catch'](function(_0x32a6fd){logger[_0xe44d('0x8')]('[%s][TAG]\x20%s',_0x405c31,JSON[_0xe44d('0x11')](_0x32a6fd));logger[_0xe44d('0xc')](_0xe44d('0xd'),_0x405c31);})[_0xe44d('0x12')](function(){_0x52e86a['next']();});}}}catch(_0x2e09ea){logger[_0xe44d('0x8')](_0xe44d('0x9'),_0x405c31,_['isObject'](_0x2e09ea)?JSON['stringify'](_0x2e09ea):_0x2e09ea);logger[_0xe44d('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x405c31);_0x52e86a[_0xe44d('0x13')]();}};}; \ 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 568eab1..0911655 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 _0x616c=['render','merge','body','account','interaction','list','lodash','exports'];(function(_0x10a27c,_0x29beff){var _0x22c955=function(_0x1b956d){while(--_0x1b956d){_0x10a27c['push'](_0x10a27c['shift']());}};_0x22c955(++_0x29beff);}(_0x616c,0x1b6));var _0xc616=function(_0x32d846,_0x3fc7c9){_0x32d846=_0x32d846-0x0;var _0x2d8b02=_0x616c[_0x32d846];return _0x2d8b02;};'use strict';var Mustache=require('mustache');var _=require(_0xc616('0x0'));module[_0xc616('0x1')]={'getMustacheRender':function(_0x5a267e,_0x16e652){return Mustache[_0xc616('0x2')](_0x5a267e,_[_0xc616('0x3')](_0x16e652[_0xc616('0x4')],{'contact':_0x16e652['contact'],'message':_0x16e652['message'],'account':_0x16e652[_0xc616('0x5')],'interaction':_0x16e652[_0xc616('0x6')],'list':_0x16e652[_0xc616('0x7')]}))||'';}}; \ No newline at end of file +var _0x3402=['exports','body','contact','message','account','interaction','mustache'];(function(_0x20dd77,_0x522b67){var _0x492a95=function(_0x53b08b){while(--_0x53b08b){_0x20dd77['push'](_0x20dd77['shift']());}};_0x492a95(++_0x522b67);}(_0x3402,0x1f0));var _0x2340=function(_0x3dd0aa,_0x3eb9b7){_0x3dd0aa=_0x3dd0aa-0x0;var _0x26cd4c=_0x3402[_0x3dd0aa];return _0x26cd4c;};'use strict';var Mustache=require(_0x2340('0x0'));var _=require('lodash');module[_0x2340('0x1')]={'getMustacheRender':function(_0x2f1b72,_0x3a90e1){return Mustache['render'](_0x2f1b72,_['merge'](_0x3a90e1[_0x2340('0x2')],{'contact':_0x3a90e1[_0x2340('0x3')],'message':_0x3a90e1[_0x2340('0x4')],'account':_0x3a90e1[_0x2340('0x5')],'interaction':_0x3a90e1[_0x2340('0x6')],'list':_0x3a90e1['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 38d2c2e..415287f 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 _0x22bb=['uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','push','dialogflow','appdata','slice','dialogflowv2','amazonlex','tag','TagId','format','./interval','./applications/','consequence','priority','Push\x20new\x20rule','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','matchPath','emit','error','stack','channel','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','end','hasOwnProperty','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','path','jayson/promise','bluebird'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x22bb,0x170));var _0xb22b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x22bb[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xb22b('0x0'));var path=require(_0xb22b('0x1'));var fs=require('fs');var jayson=require(_0xb22b('0x2'));var BPromise=require(_0xb22b('0x3'));var uuid=require(_0xb22b('0x4'));var config=require(_0xb22b('0x5'));var logger=require(_0xb22b('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0xb22b('0x7')),'mailQueueReport':require(_0xb22b('0x8')),'chatQueueReport':require(_0xb22b('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xb22b('0xa')),'whatsappQueueReport':require(_0xb22b('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x8762d7,_0x2557cc,_0x170be6){return util['format'](_0xb22b('0xc'),_0x8762d7,_0x2557cc||0x0,_0x170be6||0x0);}function getIntervals(_0x2ab0f4,_0x4552ff){var _0x3e0c64=[];if(!_['isNil'](_0x4552ff[_0xb22b('0xd')])&&!_[_0xb22b('0xe')](_0x2ab0f4[_0x4552ff[_0xb22b('0xd')]])&&!_[_0xb22b('0xe')](_0x2ab0f4[_0x4552ff[_0xb22b('0xd')]][_0xb22b('0xf')])){_0x3e0c64=_[_0xb22b('0x10')](_0x2ab0f4[_0x4552ff[_0xb22b('0xd')]][_0xb22b('0xf')],_0xb22b('0x11'));}else if(!_[_0xb22b('0xe')](_0x4552ff['interval'])){_0x3e0c64=[_0x4552ff[_0xb22b('0x11')]];}return _0x3e0c64;}exports['listen']=function(_0x3ce122){_0x3ce122[_0xb22b('0x12')]={};return new BPromise(function(_0x4d7092,_0x2a6179){var _0x4946cf={'Start':function(_0x554696){var _0x5f357c=this;return new Promise(function(_0x26e8bb,_0x2c9fa6){if(_0x554696){try{var _0x1295fd=[];var _0x45e65c=getId(_0x554696['channel'],_0x554696[_0xb22b('0x13')]?_0x554696[_0xb22b('0x13')]['id']:0x0,_0x554696[_0xb22b('0x14')]?_0x554696['interaction']['id']:0x0);if(_0x554696[_0xb22b('0x15')]&&_[_0xb22b('0x16')](_0x554696[_0xb22b('0x15')])&&_0x554696[_0xb22b('0x15')]['length']){for(var _0x323133=0x0;_0x323133<_0x554696[_0xb22b('0x15')][_0xb22b('0x17')];_0x323133+=0x1){var _0x4ef81c=_0x554696[_0xb22b('0x15')][_0x323133];if(fs[_0xb22b('0x18')](path[_0xb22b('0x19')](__dirname,'applications',_0x4ef81c[_0xb22b('0x1a')]+_0xb22b('0x1b')))){var _0x5f4183=[];switch(_0x4ef81c[_0xb22b('0x1a')][_0xb22b('0x1c')]()){case _0xb22b('0x1d'):var _0x3a73c3=_0x4ef81c['appdata'][_0xb22b('0x1e')](',');_0x5f4183[_0xb22b('0x1f')](_0x3a73c3[0x0]);_0x5f4183[_0xb22b('0x1f')](_0x3a73c3['slice'](0x1,_0x3a73c3[_0xb22b('0x17')])[_0xb22b('0x19')](','));break;case _0xb22b('0x20'):var _0x4fdc3f=_0x4ef81c[_0xb22b('0x21')]['split'](',');_0x5f4183[_0xb22b('0x1f')](_0x4fdc3f[0x0]);_0x5f4183['push'](_0x4fdc3f[0x1]);_0x5f4183[_0xb22b('0x1f')](_0x4fdc3f[_0xb22b('0x22')](0x2,_0x4fdc3f[_0xb22b('0x17')])[_0xb22b('0x19')](','));break;case _0xb22b('0x23'):var _0x49b481=_0x4ef81c[_0xb22b('0x21')][_0xb22b('0x1e')](',');_0x5f4183[_0xb22b('0x1f')](_0x49b481[0x0]);_0x5f4183[_0xb22b('0x1f')](_0x49b481[0x1]);_0x5f4183['push'](_0x49b481[0x2]);_0x5f4183[_0xb22b('0x1f')](_0x49b481[0x3]);_0x5f4183['push'](_0x49b481[_0xb22b('0x22')](0x4,_0x49b481[_0xb22b('0x17')])[_0xb22b('0x19')](','));break;case _0xb22b('0x24'):var _0x30c0fe=_0x4ef81c[_0xb22b('0x21')][_0xb22b('0x1e')](',');_0x5f4183[_0xb22b('0x1f')](_0x30c0fe[0x0]);_0x5f4183[_0xb22b('0x1f')](_0x30c0fe[0x1]);_0x5f4183[_0xb22b('0x1f')](_0x30c0fe[0x2]);_0x5f4183[_0xb22b('0x1f')](_0x30c0fe[0x3]);_0x5f4183[_0xb22b('0x1f')](_0x30c0fe[_0xb22b('0x22')](0x4,_0x30c0fe[_0xb22b('0x17')])['join'](','));break;case _0xb22b('0x13'):_0x5f4183['push'](_0x4ef81c['appdata']);break;case _0xb22b('0x25'):_0x5f4183[_0xb22b('0x1f')](_0x4ef81c[_0xb22b('0x26')]);_0x5f4183[_0xb22b('0x1f')](_0x4ef81c[_0xb22b('0x21')]);break;default:_0x5f4183=_['isNil'](_0x4ef81c[_0xb22b('0x21')])?[]:_0x4ef81c[_0xb22b('0x21')][_0xb22b('0x1e')](',');}var _0x17b80e={'id':util[_0xb22b('0x27')]('%s:%s:%s',_0x45e65c,_0x4ef81c['id'],_0x4ef81c[_0xb22b('0x1a')]),'condition':require(_0xb22b('0x28'))['condition'](_0x45e65c,getIntervals(_0x3ce122['intervals'],_0x4ef81c),_0x3ce122),'consequence':require(_0xb22b('0x29')+_0x4ef81c[_0xb22b('0x1a')])[_0xb22b('0x2a')](_0x45e65c,_0x5f4183,_0x3ce122,_0x554696),'p':_0x4ef81c[_0xb22b('0x2b')]||0x0};logger['info'](_0xb22b('0x2c'),_0x17b80e['id'],'on\x20interval',getIntervals(_0x3ce122[_0xb22b('0x2d')],_0x4ef81c)[_0xb22b('0x19')](_0xb22b('0x2e')));_0x1295fd[_0xb22b('0x1f')](_0x17b80e);}else{logger['error'](_0xb22b('0x2f'),path[_0xb22b('0x19')](__dirname,_0xb22b('0x15'),_0x4ef81c[_0xb22b('0x1a')]+_0xb22b('0x1b')));}}_0x3ce122[_0xb22b('0x12')][_0x45e65c]=new RuleEngine(_0x1295fd);_0x3ce122[_0xb22b('0x12')][_0x45e65c][_0xb22b('0x30')](_0x554696,function(_0x21df0b){logger[_0xb22b('0x31')](_0xb22b('0x32'),JSON[_0xb22b('0x33')](_0x21df0b[_0xb22b('0x34')]));if(_0x3ce122['rules'][_0x45e65c]){_0x3ce122[_0xb22b('0x12')][_0x45e65c][_0xb22b('0x35')]('complete');}});return _0x26e8bb({'code':0xc8,'message':_0x554696});}else{logger[_0xb22b('0x31')]('No\x20applications\x20to\x20execute');return _0x26e8bb({'code':0xc8,'message':_0x554696});}}catch(_0x311ccd){logger[_0xb22b('0x36')](_0x311ccd[_0xb22b('0x37')]);return _0x2c9fa6(_0x5f357c[_0xb22b('0x36')](0x1f4,_0x311ccd));}}return _0x2c9fa6('routing\x20is\x20empty');});},'AcceptMessage':function(_0x280f7e){var _0x6b31f2=this;return new Promise(function(_0x28dfe6,_0x36934d){if(_0x280f7e['message']&&_0x280f7e[_0xb22b('0x13')]['id']){try{var _0x4573ec=getId(_0x280f7e[_0xb22b('0x38')],_0x280f7e[_0xb22b('0x13')]?_0x280f7e[_0xb22b('0x13')]['id']:0x0,_0x280f7e[_0xb22b('0x14')]?_0x280f7e[_0xb22b('0x14')]['id']:0x0);if(_0x3ce122[_0xb22b('0x12')][_0x4573ec]){_0x3ce122['rules'][_0x4573ec][_0xb22b('0x35')]('end');if(rpc[_0x280f7e[_0xb22b('0x38')]+'QueueReport']){rpc[_0x280f7e[_0xb22b('0x38')]+_0xb22b('0x39')][_0xb22b('0x3a')](_0x4573ec,{'UserId':_0x280f7e[_0xb22b('0x13')][_0xb22b('0x3b')]})[_0xb22b('0x3c')](function(_0x8e4aca){logger['error'](_0xb22b('0x3d'));});}}return _0x28dfe6({'code':0xc8,'message':_0x280f7e});}catch(_0x4e1fc2){logger['error'](_0x4e1fc2[_0xb22b('0x37')]);return _0x36934d(_0x6b31f2[_0xb22b('0x36')](0x1f4,_0x4e1fc2));}}logger[_0xb22b('0x36')](_0xb22b('0x3e'));return _0x36934d(_0x6b31f2[_0xb22b('0x36')](0x1f4,_0xb22b('0x3e')));});},'RejectMessage':function(_0x488220){var _0x3a01e2=this;return new Promise(function(_0x5f1a79,_0xef7bf6){if(_0x488220[_0xb22b('0x3f')]&&_0x488220[_0xb22b('0x3f')]['id']){try{if(_0x3ce122[_0xb22b('0x40')][_0x488220['agent']['id']]){_0x3ce122[_0xb22b('0x40')][_0x488220[_0xb22b('0x3f')]['id']][_0xb22b('0x41')]=![];_0x3ce122[_0xb22b('0x40')][_0x488220[_0xb22b('0x3f')]['id']][_0xb22b('0x42')]=undefined;}return _0x5f1a79({'code':0xc8,'message':_0x488220});}catch(_0x32b3a6){logger[_0xb22b('0x36')](_0x32b3a6['stack']);return _0xef7bf6(_0x3a01e2[_0xb22b('0x36')](0x1f4,_0x32b3a6));}}logger['error']('message\x20is\x20empty');return _0xef7bf6(_0x3a01e2['error'](0x1f4,_0xb22b('0x3e')));});},'AbandonInteraction':function(_0x34f675){var _0x305dcf=this;return new Promise(function(_0x14d840,_0x1ac494){if(_0x34f675[_0xb22b('0x38')]&&_0x34f675[_0xb22b('0x14')]&&_0x34f675[_0xb22b('0x14')]['id']){try{var _0x5c46a8=getId(_0x34f675[_0xb22b('0x38')],_0x34f675['message']?_0x34f675[_0xb22b('0x13')]['id']:0x0,_0x34f675[_0xb22b('0x14')]?_0x34f675[_0xb22b('0x14')]['id']:0x0);if(_0x3ce122['rules'][_0x5c46a8]){_0x3ce122[_0xb22b('0x12')][_0x5c46a8][_0xb22b('0x35')](_0xb22b('0x43'));}return _0x14d840({'code':0xc8,'message':_0x34f675});}catch(_0xb89db1){logger[_0xb22b('0x36')](_0xb89db1[_0xb22b('0x37')]);return _0x1ac494(_0x305dcf[_0xb22b('0x36')](0x1f4,_0xb89db1));}}logger[_0xb22b('0x36')]('message\x20is\x20empty');return _0x1ac494(_0x305dcf['error'](0x1f4,_0xb22b('0x3e')));});},'AgentCapacity':function(_0x73011b){var _0x983936=this;return new Promise(function(_0x4b3d5b,_0x5c9b1f){if(_0x3ce122[_0xb22b('0x40')][_0xb22b('0x44')](_0x73011b['id'])){for(var _0x20e9a6 in _0x73011b[_0xb22b('0x45')]){if(_0x73011b[_0xb22b('0x45')][_0xb22b('0x44')](_0x20e9a6)){if(_0x3ce122[_0xb22b('0x40')][_0x73011b['id']]['hasOwnProperty'](_0x20e9a6+'CurrentCapacity')){_0x3ce122[_0xb22b('0x40')][_0x73011b['id']][_0x20e9a6+'CurrentCapacity']=parseInt(_0x73011b['capacity'][_0x20e9a6],0xa);}}}_0x3ce122[_0xb22b('0x40')][_0x73011b['id']][_0xb22b('0x46')]();return _0x4b3d5b({'code':0xc8,'message':_0x3ce122[_0xb22b('0x40')][_0x73011b['id']]});}else{return _0x5c9b1f(_0x983936[_0xb22b('0x36')](0x1f4,_0xb22b('0x47')));}});},'Agents':function(_0xdc54ca){return new Promise(function(_0x2258db,_0x3fb7af){var _0x2bc6f5=_[_0xb22b('0x48')](_0x3ce122['agents']);_0x2258db({'count':_0x2bc6f5[_0xb22b('0x17')],'rows':_0x2bc6f5});});},'ChatQueues':function(_0x41a10f){return new Promise(function(_0x2f505a,_0x31e756){var _0x54a173=[];for(var _0x168c36 in _0x3ce122['chatQueues']){if(_0x3ce122[_0xb22b('0x49')][_0xb22b('0x44')](_0x168c36)){var _0x214d52=_0x3ce122['chatQueues'][_0x168c36];var _0x387081={'id':_0x214d52['id'],'available':_0x214d52['available'],'loggedIn':_0x214d52[_0xb22b('0x4a')],'name':_0x214d52[_0xb22b('0x4b')],'paused':_0x214d52[_0xb22b('0x4c')],'waiting':_0x214d52[_0xb22b('0x4d')]};_0x54a173[_0xb22b('0x1f')](_0x387081);}}_0x2f505a({'count':_0x54a173[_0xb22b('0x17')],'rows':_0x54a173});});},'MailQueues':function(_0x42c121){return new Promise(function(_0x2642d3,_0x2a301d){var _0x27bfcb=[];for(var _0x3b5596 in _0x3ce122[_0xb22b('0x4e')]){if(_0x3ce122[_0xb22b('0x4e')][_0xb22b('0x44')](_0x3b5596)){var _0xf5b35f=_0x3ce122[_0xb22b('0x4e')][_0x3b5596];var _0xe9cd5={'id':_0xf5b35f['id'],'available':_0xf5b35f[_0xb22b('0x4f')],'loggedIn':_0xf5b35f[_0xb22b('0x4a')],'name':_0xf5b35f[_0xb22b('0x4b')],'paused':_0xf5b35f[_0xb22b('0x4c')],'waiting':_0xf5b35f[_0xb22b('0x4d')]};_0x27bfcb[_0xb22b('0x1f')](_0xe9cd5);}}_0x2642d3({'count':_0x27bfcb[_0xb22b('0x17')],'rows':_0x27bfcb});});},'OpenchannelQueues':function(_0x54b319){return new Promise(function(_0x1adb3c,_0x47d8fc){var _0x36ceb5=[];for(var _0x43275e in _0x3ce122[_0xb22b('0x50')]){if(_0x3ce122[_0xb22b('0x50')][_0xb22b('0x44')](_0x43275e)){var _0x33aaf5=_0x3ce122['openchannelQueues'][_0x43275e];var _0x5b4c41={'id':_0x33aaf5['id'],'available':_0x33aaf5[_0xb22b('0x4f')],'loggedIn':_0x33aaf5[_0xb22b('0x4a')],'name':_0x33aaf5[_0xb22b('0x4b')],'paused':_0x33aaf5['paused'],'waiting':_0x33aaf5[_0xb22b('0x4d')]};_0x36ceb5['push'](_0x5b4c41);}}_0x1adb3c({'count':_0x36ceb5[_0xb22b('0x17')],'rows':_0x36ceb5});});},'SmsQueues':function(_0x20ad3e){return new Promise(function(_0x35f499,_0x4cb363){var _0x4dee0d=[];for(var _0x5e35fb in _0x3ce122[_0xb22b('0x51')]){if(_0x3ce122[_0xb22b('0x51')][_0xb22b('0x44')](_0x5e35fb)){var _0x3762ae=_0x3ce122[_0xb22b('0x51')][_0x5e35fb];var _0x48e371={'id':_0x3762ae['id'],'available':_0x3762ae[_0xb22b('0x4f')],'loggedIn':_0x3762ae['loggedIn'],'name':_0x3762ae[_0xb22b('0x4b')],'paused':_0x3762ae[_0xb22b('0x4c')],'waiting':_0x3762ae[_0xb22b('0x4d')]};_0x4dee0d[_0xb22b('0x1f')](_0x48e371);}}_0x35f499({'count':_0x4dee0d[_0xb22b('0x17')],'rows':_0x4dee0d});});},'FaxQueues':function(_0x3b2ffc){return new Promise(function(_0x137016,_0x1463f6){var _0x1599fc=[];for(var _0x507b71 in _0x3ce122['faxQueues']){if(_0x3ce122[_0xb22b('0x52')][_0xb22b('0x44')](_0x507b71)){var _0x3d023d=_0x3ce122[_0xb22b('0x52')][_0x507b71];var _0x535cdb={'id':_0x3d023d['id'],'available':_0x3d023d[_0xb22b('0x4f')],'loggedIn':_0x3d023d[_0xb22b('0x4a')],'name':_0x3d023d[_0xb22b('0x4b')],'paused':_0x3d023d['paused'],'waiting':_0x3d023d['waiting']};_0x1599fc[_0xb22b('0x1f')](_0x535cdb);}}_0x137016({'count':_0x1599fc[_0xb22b('0x17')],'rows':_0x1599fc});});},'WhatsappQueues':function(_0x39a8bc){return new Promise(function(_0xfc60d8,_0x196a8c){var _0x3db231=[];for(var _0x1f346e in _0x3ce122[_0xb22b('0x53')]){if(_0x3ce122[_0xb22b('0x53')][_0xb22b('0x44')](_0x1f346e)){var _0xe81272=_0x3ce122[_0xb22b('0x53')][_0x1f346e];var _0x1ece34={'id':_0xe81272['id'],'available':_0xe81272[_0xb22b('0x4f')],'loggedIn':_0xe81272[_0xb22b('0x4a')],'name':_0xe81272[_0xb22b('0x4b')],'paused':_0xe81272[_0xb22b('0x4c')],'waiting':_0xe81272[_0xb22b('0x4d')]};_0x3db231[_0xb22b('0x1f')](_0x1ece34);}}_0xfc60d8({'count':_0x3db231[_0xb22b('0x17')],'rows':_0x3db231});});},'ChatQueuesWaitingInteractions':function(_0x4a5ee8){return new Promise(function(_0x53669f,_0x754de6){var _0x2ede34=_[_0xb22b('0x48')](_0x3ce122[_0xb22b('0x54')]);_0x53669f({'count':_0x2ede34[_0xb22b('0x17')],'rows':_0x2ede34});});},'MailQueuesWaitingInteractions':function(_0x35d589){return new Promise(function(_0x4a40ad,_0x2795ca){var _0x3fe33c=_[_0xb22b('0x48')](_0x3ce122['mailQueuesWaitingInteractions']);_0x4a40ad({'count':_0x3fe33c[_0xb22b('0x17')],'rows':_0x3fe33c});});},'OpenchannelQueuesWaitingInteractions':function(_0x56b6a4){return new Promise(function(_0x20707e,_0x5241f2){var _0x12de33=_[_0xb22b('0x48')](_0x3ce122[_0xb22b('0x55')]);_0x20707e({'count':_0x12de33['length'],'rows':_0x12de33});});},'SmsQueuesWaitingInteractions':function(_0x2d23ee){return new Promise(function(_0x568198,_0x49cebf){var _0x485c65=_['values'](_0x3ce122[_0xb22b('0x56')]);_0x568198({'count':_0x485c65[_0xb22b('0x17')],'rows':_0x485c65});});},'FaxQueuesWaitingInteractions':function(_0x503f71){return new Promise(function(_0x92893c,_0x1b637b){var _0x4abb97=_[_0xb22b('0x48')](_0x3ce122['faxQueuesWaitingInteractions']);_0x92893c({'count':_0x4abb97[_0xb22b('0x17')],'rows':_0x4abb97});});},'WhatsappQueuesWaitingInteractions':function(_0x419873){return new Promise(function(_0x33a4cb,_0x5a0047){var _0x1409c5=_[_0xb22b('0x48')](_0x3ce122[_0xb22b('0x57')]);_0x33a4cb({'count':_0x1409c5['length'],'rows':_0x1409c5});});}};var _0x1fa86a=jayson[_0xb22b('0x58')](_0x4946cf)['http']();_0x1fa86a['on'](_0xb22b('0x36'),function(_0x1bd6af){logger[_0xb22b('0x36')](JSON['stringify'](_0x1bd6af));return _0x2a6179(_0x1bd6af);});_0x1fa86a[_0xb22b('0x59')](0x232c,_0xb22b('0x5a'),function(){console[_0xb22b('0x5b')](_0xb22b('0x5c'),0x232c);return _0x4d7092('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x9f76=['channel','message','interaction','isArray','applications','length','existsSync','join','app','toLowerCase','autoreply','split','push','slice','dialogflow','appdata','amazonlex','tag','%s:%s:%s','condition','./applications/','consequence','priority','info','on\x20interval','intervals','\x20|\x20','.js','rules','Applications\x20executed','stringify','matchPath','emit','complete','error','stack','routing\x20is\x20empty','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen'];(function(_0x17c030,_0x23f9f5){var _0x573b32=function(_0x2f702e){while(--_0x2f702e){_0x17c030['push'](_0x17c030['shift']());}};_0x573b32(++_0x23f9f5);}(_0x9f76,0x1bc));var _0x69f7=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x9f76[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x69f7('0x0'));var util=require(_0x69f7('0x1'));var path=require(_0x69f7('0x2'));var fs=require('fs');var jayson=require(_0x69f7('0x3'));var BPromise=require(_0x69f7('0x4'));var uuid=require('uuid');var config=require(_0x69f7('0x5'));var logger=require(_0x69f7('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x69f7('0x7')),'mailQueueReport':require(_0x69f7('0x8')),'chatQueueReport':require(_0x69f7('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x69f7('0xa')),'whatsappQueueReport':require(_0x69f7('0xb'))};var RuleEngine=require(_0x69f7('0xc'));function getId(_0x3955bb,_0x1a9d50,_0x15552d){return util[_0x69f7('0xd')](_0x69f7('0xe'),_0x3955bb,_0x1a9d50||0x0,_0x15552d||0x0);}function getIntervals(_0x441383,_0x3f05e0){var _0x569363=[];if(!_['isNil'](_0x3f05e0['IntervalId'])&&!_[_0x69f7('0xf')](_0x441383[_0x3f05e0[_0x69f7('0x10')]])&&!_[_0x69f7('0xf')](_0x441383[_0x3f05e0['IntervalId']][_0x69f7('0x11')])){_0x569363=_[_0x69f7('0x12')](_0x441383[_0x3f05e0[_0x69f7('0x10')]][_0x69f7('0x11')],_0x69f7('0x13'));}else if(!_[_0x69f7('0xf')](_0x3f05e0[_0x69f7('0x13')])){_0x569363=[_0x3f05e0[_0x69f7('0x13')]];}return _0x569363;}exports[_0x69f7('0x14')]=function(_0x3acdbe){_0x3acdbe['rules']={};return new BPromise(function(_0xda6988,_0x47d9fc){var _0x1eea31={'Start':function(_0x499ead){var _0x1b0dfc=this;return new Promise(function(_0x1d060b,_0x589976){if(_0x499ead){try{var _0x1f6f53=[];var _0xddc318=getId(_0x499ead[_0x69f7('0x15')],_0x499ead['message']?_0x499ead[_0x69f7('0x16')]['id']:0x0,_0x499ead[_0x69f7('0x17')]?_0x499ead['interaction']['id']:0x0);if(_0x499ead['applications']&&_[_0x69f7('0x18')](_0x499ead[_0x69f7('0x19')])&&_0x499ead[_0x69f7('0x19')][_0x69f7('0x1a')]){for(var _0x5b7d63=0x0;_0x5b7d63<_0x499ead['applications'][_0x69f7('0x1a')];_0x5b7d63+=0x1){var _0x586693=_0x499ead[_0x69f7('0x19')][_0x5b7d63];if(fs[_0x69f7('0x1b')](path[_0x69f7('0x1c')](__dirname,_0x69f7('0x19'),_0x586693[_0x69f7('0x1d')]+'.js'))){var _0x5c8b45=[];switch(_0x586693['app'][_0x69f7('0x1e')]()){case _0x69f7('0x1f'):var _0x4d27ac=_0x586693['appdata'][_0x69f7('0x20')](',');_0x5c8b45['push'](_0x4d27ac[0x0]);_0x5c8b45[_0x69f7('0x21')](_0x4d27ac[_0x69f7('0x22')](0x1,_0x4d27ac['length'])[_0x69f7('0x1c')](','));break;case _0x69f7('0x23'):var _0x1531b3=_0x586693[_0x69f7('0x24')][_0x69f7('0x20')](',');_0x5c8b45[_0x69f7('0x21')](_0x1531b3[0x0]);_0x5c8b45[_0x69f7('0x21')](_0x1531b3[0x1]);_0x5c8b45[_0x69f7('0x21')](_0x1531b3[_0x69f7('0x22')](0x2,_0x1531b3[_0x69f7('0x1a')])[_0x69f7('0x1c')](','));break;case'dialogflowv2':var _0xb565df=_0x586693[_0x69f7('0x24')][_0x69f7('0x20')](',');_0x5c8b45['push'](_0xb565df[0x0]);_0x5c8b45[_0x69f7('0x21')](_0xb565df[0x1]);_0x5c8b45[_0x69f7('0x21')](_0xb565df[0x2]);_0x5c8b45[_0x69f7('0x21')](_0xb565df[0x3]);_0x5c8b45['push'](_0xb565df[_0x69f7('0x22')](0x4,_0xb565df[_0x69f7('0x1a')])[_0x69f7('0x1c')](','));break;case _0x69f7('0x25'):var _0x579828=_0x586693[_0x69f7('0x24')][_0x69f7('0x20')](',');_0x5c8b45[_0x69f7('0x21')](_0x579828[0x0]);_0x5c8b45[_0x69f7('0x21')](_0x579828[0x1]);_0x5c8b45[_0x69f7('0x21')](_0x579828[0x2]);_0x5c8b45['push'](_0x579828[0x3]);_0x5c8b45[_0x69f7('0x21')](_0x579828[_0x69f7('0x22')](0x4,_0x579828[_0x69f7('0x1a')])[_0x69f7('0x1c')](','));break;case _0x69f7('0x16'):_0x5c8b45[_0x69f7('0x21')](_0x586693[_0x69f7('0x24')]);break;case _0x69f7('0x26'):_0x5c8b45['push'](_0x586693['TagId']);_0x5c8b45[_0x69f7('0x21')](_0x586693[_0x69f7('0x24')]);break;default:_0x5c8b45=_[_0x69f7('0xf')](_0x586693[_0x69f7('0x24')])?[]:_0x586693[_0x69f7('0x24')]['split'](',');}var _0xdf66fa={'id':util[_0x69f7('0xd')](_0x69f7('0x27'),_0xddc318,_0x586693['id'],_0x586693[_0x69f7('0x1d')]),'condition':require('./interval')[_0x69f7('0x28')](_0xddc318,getIntervals(_0x3acdbe['intervals'],_0x586693),_0x3acdbe),'consequence':require(_0x69f7('0x29')+_0x586693[_0x69f7('0x1d')])[_0x69f7('0x2a')](_0xddc318,_0x5c8b45,_0x3acdbe,_0x499ead),'p':_0x586693[_0x69f7('0x2b')]||0x0};logger[_0x69f7('0x2c')]('Push\x20new\x20rule',_0xdf66fa['id'],_0x69f7('0x2d'),getIntervals(_0x3acdbe[_0x69f7('0x2e')],_0x586693)[_0x69f7('0x1c')](_0x69f7('0x2f')));_0x1f6f53[_0x69f7('0x21')](_0xdf66fa);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x69f7('0x19'),_0x586693[_0x69f7('0x1d')]+_0x69f7('0x30')));}}_0x3acdbe[_0x69f7('0x31')][_0xddc318]=new RuleEngine(_0x1f6f53);_0x3acdbe['rules'][_0xddc318]['execute'](_0x499ead,function(_0x5d9de9){logger['info'](_0x69f7('0x32'),JSON[_0x69f7('0x33')](_0x5d9de9[_0x69f7('0x34')]));if(_0x3acdbe[_0x69f7('0x31')][_0xddc318]){_0x3acdbe[_0x69f7('0x31')][_0xddc318][_0x69f7('0x35')](_0x69f7('0x36'));}});return _0x1d060b({'code':0xc8,'message':_0x499ead});}else{logger[_0x69f7('0x2c')]('No\x20applications\x20to\x20execute');return _0x1d060b({'code':0xc8,'message':_0x499ead});}}catch(_0x574796){logger[_0x69f7('0x37')](_0x574796[_0x69f7('0x38')]);return _0x589976(_0x1b0dfc['error'](0x1f4,_0x574796));}}return _0x589976(_0x69f7('0x39'));});},'AcceptMessage':function(_0x3fcf6b){var _0x3c8dd8=this;return new Promise(function(_0x2f1f2a,_0x112ac9){if(_0x3fcf6b[_0x69f7('0x16')]&&_0x3fcf6b[_0x69f7('0x16')]['id']){try{var _0x590128=getId(_0x3fcf6b[_0x69f7('0x15')],_0x3fcf6b[_0x69f7('0x16')]?_0x3fcf6b[_0x69f7('0x16')]['id']:0x0,_0x3fcf6b[_0x69f7('0x17')]?_0x3fcf6b['interaction']['id']:0x0);if(_0x3acdbe['rules'][_0x590128]){_0x3acdbe[_0x69f7('0x31')][_0x590128][_0x69f7('0x35')](_0x69f7('0x3a'));if(rpc[_0x3fcf6b[_0x69f7('0x15')]+_0x69f7('0x3b')]){rpc[_0x3fcf6b[_0x69f7('0x15')]+'QueueReport']['update'](_0x590128,{'UserId':_0x3fcf6b[_0x69f7('0x16')][_0x69f7('0x3c')]})[_0x69f7('0x3d')](function(_0x2a81fd){logger[_0x69f7('0x37')](_0x69f7('0x3e'));});}}return _0x2f1f2a({'code':0xc8,'message':_0x3fcf6b});}catch(_0x1cc653){logger[_0x69f7('0x37')](_0x1cc653[_0x69f7('0x38')]);return _0x112ac9(_0x3c8dd8[_0x69f7('0x37')](0x1f4,_0x1cc653));}}logger[_0x69f7('0x37')](_0x69f7('0x3f'));return _0x112ac9(_0x3c8dd8[_0x69f7('0x37')](0x1f4,_0x69f7('0x3f')));});},'RejectMessage':function(_0x429ae0){var _0x1e5dec=this;return new Promise(function(_0x29f1ab,_0x39f083){if(_0x429ae0[_0x69f7('0x40')]&&_0x429ae0[_0x69f7('0x40')]['id']){try{if(_0x3acdbe[_0x69f7('0x41')][_0x429ae0['agent']['id']]){_0x3acdbe['agents'][_0x429ae0['agent']['id']]['busy']=![];_0x3acdbe[_0x69f7('0x41')][_0x429ae0[_0x69f7('0x40')]['id']]['busyQueue']=undefined;}return _0x29f1ab({'code':0xc8,'message':_0x429ae0});}catch(_0x31f65d){logger['error'](_0x31f65d[_0x69f7('0x38')]);return _0x39f083(_0x1e5dec[_0x69f7('0x37')](0x1f4,_0x31f65d));}}logger[_0x69f7('0x37')](_0x69f7('0x3f'));return _0x39f083(_0x1e5dec[_0x69f7('0x37')](0x1f4,_0x69f7('0x3f')));});},'AbandonInteraction':function(_0x4c4315){var _0x4d490d=this;return new Promise(function(_0x1ec648,_0x4fc0f4){if(_0x4c4315['channel']&&_0x4c4315[_0x69f7('0x17')]&&_0x4c4315[_0x69f7('0x17')]['id']){try{var _0x477b97=getId(_0x4c4315[_0x69f7('0x15')],_0x4c4315[_0x69f7('0x16')]?_0x4c4315[_0x69f7('0x16')]['id']:0x0,_0x4c4315[_0x69f7('0x17')]?_0x4c4315['interaction']['id']:0x0);if(_0x3acdbe[_0x69f7('0x31')][_0x477b97]){_0x3acdbe['rules'][_0x477b97][_0x69f7('0x35')](_0x69f7('0x3a'));}return _0x1ec648({'code':0xc8,'message':_0x4c4315});}catch(_0x1b8aef){logger['error'](_0x1b8aef[_0x69f7('0x38')]);return _0x4fc0f4(_0x4d490d[_0x69f7('0x37')](0x1f4,_0x1b8aef));}}logger[_0x69f7('0x37')](_0x69f7('0x3f'));return _0x4fc0f4(_0x4d490d[_0x69f7('0x37')](0x1f4,_0x69f7('0x3f')));});},'AgentCapacity':function(_0x562c58){var _0x2635b5=this;return new Promise(function(_0x54b2bd,_0xfac5c2){if(_0x3acdbe['agents'][_0x69f7('0x42')](_0x562c58['id'])){for(var _0x59d8d6 in _0x562c58[_0x69f7('0x43')]){if(_0x562c58[_0x69f7('0x43')][_0x69f7('0x42')](_0x59d8d6)){if(_0x3acdbe[_0x69f7('0x41')][_0x562c58['id']][_0x69f7('0x42')](_0x59d8d6+_0x69f7('0x44'))){_0x3acdbe['agents'][_0x562c58['id']][_0x59d8d6+_0x69f7('0x44')]=parseInt(_0x562c58[_0x69f7('0x43')][_0x59d8d6],0xa);}}}_0x3acdbe['agents'][_0x562c58['id']]['updateRealtime']();return _0x54b2bd({'code':0xc8,'message':_0x3acdbe[_0x69f7('0x41')][_0x562c58['id']]});}else{return _0xfac5c2(_0x2635b5['error'](0x1f4,_0x69f7('0x45')));}});},'Agents':function(_0x40cd40){return new Promise(function(_0x4eed73,_0x3210be){var _0x5e7a73=_[_0x69f7('0x46')](_0x3acdbe[_0x69f7('0x41')]);_0x4eed73({'count':_0x5e7a73[_0x69f7('0x1a')],'rows':_0x5e7a73});});},'ChatQueues':function(_0x3757ca){return new Promise(function(_0x24743b,_0xaf4265){var _0x3e2ee5=[];for(var _0x49760b in _0x3acdbe[_0x69f7('0x47')]){if(_0x3acdbe[_0x69f7('0x47')][_0x69f7('0x42')](_0x49760b)){var _0x3e4421=_0x3acdbe[_0x69f7('0x47')][_0x49760b];var _0x30e2c9={'id':_0x3e4421['id'],'available':_0x3e4421[_0x69f7('0x48')],'loggedIn':_0x3e4421[_0x69f7('0x49')],'name':_0x3e4421[_0x69f7('0x4a')],'paused':_0x3e4421[_0x69f7('0x4b')],'waiting':_0x3e4421[_0x69f7('0x4c')]};_0x3e2ee5[_0x69f7('0x21')](_0x30e2c9);}}_0x24743b({'count':_0x3e2ee5[_0x69f7('0x1a')],'rows':_0x3e2ee5});});},'MailQueues':function(_0x1faac9){return new Promise(function(_0x1400d1,_0x124973){var _0x585c0e=[];for(var _0x2955df in _0x3acdbe[_0x69f7('0x4d')]){if(_0x3acdbe['mailQueues'][_0x69f7('0x42')](_0x2955df)){var _0x17060b=_0x3acdbe[_0x69f7('0x4d')][_0x2955df];var _0x1e83c9={'id':_0x17060b['id'],'available':_0x17060b[_0x69f7('0x48')],'loggedIn':_0x17060b['loggedIn'],'name':_0x17060b[_0x69f7('0x4a')],'paused':_0x17060b[_0x69f7('0x4b')],'waiting':_0x17060b['waiting']};_0x585c0e['push'](_0x1e83c9);}}_0x1400d1({'count':_0x585c0e['length'],'rows':_0x585c0e});});},'OpenchannelQueues':function(_0x578f5b){return new Promise(function(_0x153b60,_0x37f7e4){var _0x40b51b=[];for(var _0x50cf67 in _0x3acdbe[_0x69f7('0x4e')]){if(_0x3acdbe[_0x69f7('0x4e')][_0x69f7('0x42')](_0x50cf67)){var _0x18be70=_0x3acdbe[_0x69f7('0x4e')][_0x50cf67];var _0x4d4a91={'id':_0x18be70['id'],'available':_0x18be70[_0x69f7('0x48')],'loggedIn':_0x18be70[_0x69f7('0x49')],'name':_0x18be70[_0x69f7('0x4a')],'paused':_0x18be70[_0x69f7('0x4b')],'waiting':_0x18be70[_0x69f7('0x4c')]};_0x40b51b[_0x69f7('0x21')](_0x4d4a91);}}_0x153b60({'count':_0x40b51b[_0x69f7('0x1a')],'rows':_0x40b51b});});},'SmsQueues':function(_0x7678fa){return new Promise(function(_0x213969,_0x4cb272){var _0x5df72f=[];for(var _0xfa37a3 in _0x3acdbe[_0x69f7('0x4f')]){if(_0x3acdbe[_0x69f7('0x4f')][_0x69f7('0x42')](_0xfa37a3)){var _0x445093=_0x3acdbe[_0x69f7('0x4f')][_0xfa37a3];var _0x2892bf={'id':_0x445093['id'],'available':_0x445093[_0x69f7('0x48')],'loggedIn':_0x445093['loggedIn'],'name':_0x445093[_0x69f7('0x4a')],'paused':_0x445093['paused'],'waiting':_0x445093[_0x69f7('0x4c')]};_0x5df72f[_0x69f7('0x21')](_0x2892bf);}}_0x213969({'count':_0x5df72f[_0x69f7('0x1a')],'rows':_0x5df72f});});},'FaxQueues':function(_0x4ff5ff){return new Promise(function(_0x1a2b90,_0x3d3a67){var _0x278e43=[];for(var _0x212110 in _0x3acdbe['faxQueues']){if(_0x3acdbe[_0x69f7('0x50')][_0x69f7('0x42')](_0x212110)){var _0x3649ee=_0x3acdbe[_0x69f7('0x50')][_0x212110];var _0x6efbff={'id':_0x3649ee['id'],'available':_0x3649ee[_0x69f7('0x48')],'loggedIn':_0x3649ee['loggedIn'],'name':_0x3649ee[_0x69f7('0x4a')],'paused':_0x3649ee[_0x69f7('0x4b')],'waiting':_0x3649ee[_0x69f7('0x4c')]};_0x278e43[_0x69f7('0x21')](_0x6efbff);}}_0x1a2b90({'count':_0x278e43[_0x69f7('0x1a')],'rows':_0x278e43});});},'WhatsappQueues':function(_0x291c50){return new Promise(function(_0x4e1f61,_0x1ff1e3){var _0x50f530=[];for(var _0x23d2f2 in _0x3acdbe['whatsappQueues']){if(_0x3acdbe[_0x69f7('0x51')]['hasOwnProperty'](_0x23d2f2)){var _0x4a51b7=_0x3acdbe[_0x69f7('0x51')][_0x23d2f2];var _0x4c501d={'id':_0x4a51b7['id'],'available':_0x4a51b7[_0x69f7('0x48')],'loggedIn':_0x4a51b7['loggedIn'],'name':_0x4a51b7[_0x69f7('0x4a')],'paused':_0x4a51b7[_0x69f7('0x4b')],'waiting':_0x4a51b7[_0x69f7('0x4c')]};_0x50f530[_0x69f7('0x21')](_0x4c501d);}}_0x4e1f61({'count':_0x50f530[_0x69f7('0x1a')],'rows':_0x50f530});});},'ChatQueuesWaitingInteractions':function(_0x30a4b4){return new Promise(function(_0x528dc7,_0x3f2c8b){var _0x7e9367=_['values'](_0x3acdbe[_0x69f7('0x52')]);_0x528dc7({'count':_0x7e9367[_0x69f7('0x1a')],'rows':_0x7e9367});});},'MailQueuesWaitingInteractions':function(_0x187c66){return new Promise(function(_0x37c616,_0x405601){var _0x31bf05=_[_0x69f7('0x46')](_0x3acdbe[_0x69f7('0x53')]);_0x37c616({'count':_0x31bf05[_0x69f7('0x1a')],'rows':_0x31bf05});});},'OpenchannelQueuesWaitingInteractions':function(_0x16ee57){return new Promise(function(_0x517a79,_0x42d6b2){var _0x3177c7=_['values'](_0x3acdbe[_0x69f7('0x54')]);_0x517a79({'count':_0x3177c7['length'],'rows':_0x3177c7});});},'SmsQueuesWaitingInteractions':function(_0x2b36ce){return new Promise(function(_0x427317,_0x5cef05){var _0x4b7b65=_[_0x69f7('0x46')](_0x3acdbe[_0x69f7('0x55')]);_0x427317({'count':_0x4b7b65[_0x69f7('0x1a')],'rows':_0x4b7b65});});},'FaxQueuesWaitingInteractions':function(_0x9bdd96){return new Promise(function(_0x189bdc,_0x41e40b){var _0x164881=_['values'](_0x3acdbe[_0x69f7('0x56')]);_0x189bdc({'count':_0x164881[_0x69f7('0x1a')],'rows':_0x164881});});},'WhatsappQueuesWaitingInteractions':function(_0x38a55d){return new Promise(function(_0x3f534c,_0x53411f){var _0x167a50=_['values'](_0x3acdbe['whatsappQueuesWaitingInteractions']);_0x3f534c({'count':_0x167a50[_0x69f7('0x1a')],'rows':_0x167a50});});}};var _0x3377b1=jayson[_0x69f7('0x57')](_0x1eea31)[_0x69f7('0x58')]();_0x3377b1['on']('error',function(_0x8b981c){logger['error'](JSON['stringify'](_0x8b981c));return _0x47d9fc(_0x8b981c);});_0x3377b1[_0x69f7('0x14')](0x232c,_0x69f7('0x59'),function(){console[_0x69f7('0x5a')](_0x69f7('0x5b'),0x232c);return _0xda6988(_0x69f7('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index f99985b..a3f98ee 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 _0xbc2f=['indexOf','true','all','some','info','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format'];(function(_0xb03766,_0xd212bb){var _0x4f235b=function(_0x408dc8){while(--_0x408dc8){_0xb03766['push'](_0xb03766['shift']());}};_0x4f235b(++_0xd212bb);}(_0xbc2f,0x1eb));var _0xfbc2=function(_0x34b60a,_0x3cfe4c){_0x34b60a=_0x34b60a-0x0;var _0x319fd5=_0xbc2f[_0x34b60a];return _0x319fd5;};'use strict';var util=require(_0xfbc2('0x0'));var BPromise=require(_0xfbc2('0x1'));var jayson=require('jayson/promise');var _=require(_0xfbc2('0x2'));var logger=require(_0xfbc2('0x3'))(_0xfbc2('0x4'));var client=jayson[_0xfbc2('0x5')][_0xfbc2('0x6')]({'port':0x232a});function request(_0x242872,_0x37ba26){return new BPromise(function(_0x10f530,_0x6f0d04){return client[_0xfbc2('0x7')](_0x242872,_0x37ba26)[_0xfbc2('0x8')](function(_0x5139aa){if(_0x5139aa[_0xfbc2('0x9')]){return _0x6f0d04(_0x5139aa[_0xfbc2('0x9')][_0xfbc2('0xa')]);}else{return _0x10f530(_0x5139aa[_0xfbc2('0xb')]);}})[_0xfbc2('0xc')](function(_0x2e6bd5){return _0x6f0d04(_0x2e6bd5);});});}exports['condition']=function(_0x153d11,_0xc7fee2,_0x4e11b1){return function(_0x131391){if(_0x4e11b1[_0xfbc2('0xd')]&&!_0x4e11b1['rules'][_0x153d11]){logger['info'](_0xfbc2('0xe'),_0x153d11);return _0x131391[_0xfbc2('0xf')]();}var _0x403163=[];for(var _0x3e2324=0x0;_0x3e2324<_0xc7fee2['length'];_0x3e2324+=0x1){_0x403163[_0xfbc2('0x10')](request(_0xfbc2('0x11'),{'command':util[_0xfbc2('0x12')]('iftime\x20%s',_0xc7fee2[_0x3e2324])})['then'](function(_0x2d0372){return _0x2d0372&&_0x2d0372[_0xfbc2('0xa')]&&_0x2d0372[_0xfbc2('0xa')][_0xfbc2('0x13')](_0xfbc2('0x14'))>=0x0?!![]:![];})[_0xfbc2('0xc')](function(_0x3f6518){logger[_0xfbc2('0x9')]('[%s][INTERVAL]\x20%s',_0x153d11,_0xc7fee2[_0x3e2324]);}));}BPromise[_0xfbc2('0x15')](_0x403163)[_0xfbc2('0x8')](function(_0x2a9102){var _0x2a6600=_[_0xfbc2('0x16')](_0x2a9102);logger[_0xfbc2('0x17')]('[%s][INTERVAL]\x20%s\x20%s',_0x153d11,_0xc7fee2[_0xfbc2('0x18')](_0xfbc2('0x19')),_0x2a6600);_0x131391[_0xfbc2('0x1a')](_0x2a6600);})['catch'](function(_0x461e1d){console[_0xfbc2('0x1b')](_0x461e1d);logger['error'](_0xfbc2('0x1c'),_0x153d11,_0xc7fee2[_0xfbc2('0x18')](_0xfbc2('0x19')),_0x461e1d[_0xfbc2('0x1d')]);_0x131391[_0xfbc2('0xf')]();});};}; \ No newline at end of file +var _0xe5b6=['catch','\x20|\x20','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','message','[%s][INTERVAL]\x20%s','[%s][INTERVAL]\x20%s\x20%s','join','when'];(function(_0x3e870c,_0x27d7d4){var _0x2f6bb4=function(_0xa6c163){while(--_0xa6c163){_0x3e870c['push'](_0x3e870c['shift']());}};_0x2f6bb4(++_0x27d7d4);}(_0xe5b6,0xc3));var _0x6e5b=function(_0x5075c4,_0x61dbfc){_0x5075c4=_0x5075c4-0x0;var _0x44536b=_0xe5b6[_0x5075c4];return _0x44536b;};'use strict';var util=require(_0x6e5b('0x0'));var BPromise=require(_0x6e5b('0x1'));var jayson=require(_0x6e5b('0x2'));var _=require(_0x6e5b('0x3'));var logger=require(_0x6e5b('0x4'))(_0x6e5b('0x5'));var client=jayson[_0x6e5b('0x6')]['http']({'port':0x232a});function request(_0x27546e,_0x3134b3){return new BPromise(function(_0x123ee9,_0x5c4f97){return client[_0x6e5b('0x7')](_0x27546e,_0x3134b3)[_0x6e5b('0x8')](function(_0x5b72bf){if(_0x5b72bf[_0x6e5b('0x9')]){return _0x5c4f97(_0x5b72bf[_0x6e5b('0x9')]['message']);}else{return _0x123ee9(_0x5b72bf['result']);}})['catch'](function(_0x383940){return _0x5c4f97(_0x383940);});});}exports[_0x6e5b('0xa')]=function(_0x51ab36,_0x143430,_0x4e05fe){return function(_0x223065){if(_0x4e05fe[_0x6e5b('0xb')]&&!_0x4e05fe[_0x6e5b('0xb')][_0x51ab36]){logger[_0x6e5b('0xc')](_0x6e5b('0xd'),_0x51ab36);return _0x223065['stop']();}var _0x37ac1c=[];for(var _0x2462df=0x0;_0x2462df<_0x143430[_0x6e5b('0xe')];_0x2462df+=0x1){_0x37ac1c[_0x6e5b('0xf')](request('Command',{'command':util['format']('iftime\x20%s',_0x143430[_0x2462df])})['then'](function(_0x2c0c4a){return _0x2c0c4a&&_0x2c0c4a[_0x6e5b('0x10')]&&_0x2c0c4a[_0x6e5b('0x10')]['indexOf']('true')>=0x0?!![]:![];})['catch'](function(_0xc2088b){logger[_0x6e5b('0x9')](_0x6e5b('0x11'),_0x51ab36,_0x143430[_0x2462df]);}));}BPromise['all'](_0x37ac1c)['then'](function(_0x5e9a52){var _0x16348d=_['some'](_0x5e9a52);logger[_0x6e5b('0xc')](_0x6e5b('0x12'),_0x51ab36,_0x143430[_0x6e5b('0x13')]('\x20|\x20'),_0x16348d);_0x223065[_0x6e5b('0x14')](_0x16348d);})[_0x6e5b('0x15')](function(_0x3df0af){console['log'](_0x3df0af);logger[_0x6e5b('0x9')](_0x6e5b('0x12'),_0x51ab36,_0x143430['join'](_0x6e5b('0x16')),_0x3df0af['stack']);_0x223065[_0x6e5b('0x17')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 711a932..662c7dd 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 _0xbdfe=['agententerreason','secondtransfererlinkedid','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcomplete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname'];(function(_0x521da0,_0x4986a4){var _0x159674=function(_0x59ae8a){while(--_0x59ae8a){_0x521da0['push'](_0x521da0['shift']());}};_0x159674(++_0x4986a4);}(_0xbdfe,0x17f));var _0xebdf=function(_0x40e854,_0x42f1f6){_0x40e854=_0x40e854-0x0;var _0x1463b3=_0xbdfe[_0x40e854];return _0x1463b3;};'use strict';var _=require(_0xebdf('0x0'));var util=require(_0xebdf('0x1'));var utils=require(_0xebdf('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x2bdb0a,_0x482fce){utils[_0xebdf('0x3')](util[_0xebdf('0x4')](_0xebdf('0x5'),_0x2bdb0a[_0xebdf('0x6')],_0x2bdb0a[_0xebdf('0x7')],_0x2bdb0a[_0xebdf('0x8')],_0x2bdb0a[_0xebdf('0x9')],_0x2bdb0a[_0xebdf('0xa')],_0x2bdb0a[_0xebdf('0xb')],_0x2bdb0a[_0xebdf('0xc')],_0x2bdb0a[_0xebdf('0xd')]));if(_0x2bdb0a['queue']){utils[_0xebdf('0xe')](_0x2bdb0a['queue'])[_0xebdf('0xf')](function(_0x1d369c){if(_0x1d369c){_0x2bdb0a[_0xebdf('0x10')]=_0x1d369c[_0xebdf('0x10')];_0x2bdb0a['agentacw']=_0x2bdb0a['agentcomplete']?_0x1d369c[_0xebdf('0x11')]:![];_0x2bdb0a[_0xebdf('0x12')]=_0x2bdb0a[_0xebdf('0x13')]?_0x1d369c[_0xebdf('0x14')]:0x0;}utils[_0xebdf('0x15')](_0xebdf('0x16'),_0x2bdb0a);});}else{utils[_0xebdf('0x15')]('CreateVoiceAgentReport',_0x2bdb0a);}if(_0x482fce){delete transfers[_0x2bdb0a[_0xebdf('0x6')]];}else{delete agents[_0x2bdb0a[_0xebdf('0x17')]];}}exports[_0xebdf('0x18')]=function(_0x36a1ef){try{utils[_0xebdf('0x19')](util[_0xebdf('0x4')](_0xebdf('0x1a'),_0x36a1ef['uniqueid']),_0x36a1ef);agents[_0x36a1ef[_0xebdf('0x17')]]=_0x36a1ef;agents[_0x36a1ef[_0xebdf('0x17')]][_0xebdf('0x1b')]=utils[_0xebdf('0x1c')]();agents[_0x36a1ef['destuniqueid']]['lastevent']=_0xebdf('0x1d');agents[_0x36a1ef[_0xebdf('0x17')]][_0xebdf('0xc')]=null;agents[_0x36a1ef['destuniqueid']][_0xebdf('0x1e')]=null;utils[_0xebdf('0x3')](util[_0xebdf('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x36a1ef[_0xebdf('0x6')],agents[_0x36a1ef[_0xebdf('0x17')]][_0xebdf('0x9')],_0x36a1ef[_0xebdf('0x17')]));}catch(_0x151cb2){utils[_0xebdf('0x1f')](util[_0xebdf('0x4')](_0xebdf('0x1a'),_0x36a1ef['uniqueid']),_0x151cb2);}};exports[_0xebdf('0x20')]=function(_0x2eb532){try{if(!_[_0xebdf('0x21')](agents[_0x2eb532[_0xebdf('0x17')]])){utils[_0xebdf('0x19')](util[_0xebdf('0x4')](_0xebdf('0x22'),_0x2eb532[_0xebdf('0x6')]),_0x2eb532);utils[_0xebdf('0x3')](util[_0xebdf('0x4')](_0xebdf('0x23'),_0x2eb532[_0xebdf('0x6')],agents[_0x2eb532[_0xebdf('0x17')]][_0xebdf('0x9')],_0x2eb532[_0xebdf('0x17')]));agents[_0x2eb532[_0xebdf('0x17')]][_0xebdf('0x20')]=!![];agents[_0x2eb532[_0xebdf('0x17')]][_0xebdf('0x24')]=utils[_0xebdf('0x1c')]();agents[_0x2eb532['destuniqueid']][_0xebdf('0xd')]=_0xebdf('0x25');agents[_0x2eb532[_0xebdf('0x17')]][_0xebdf('0x26')]=_0xebdf('0x25');agents[_0x2eb532['destuniqueid']]['holdtime']=_0x2eb532[_0xebdf('0x27')]?parseInt(_0x2eb532[_0xebdf('0x27')])/0x3e8:0x0;agents[_0x2eb532['destuniqueid']][_0xebdf('0x28')]=0x0;unanswered[_0xebdf('0x29')](_0x2eb532[_0xebdf('0x17')]);}}catch(_0x1a7726){utils[_0xebdf('0x1f')](util[_0xebdf('0x4')](_0xebdf('0x22'),_0x2eb532[_0xebdf('0x6')]),_0x1a7726);}};exports[_0xebdf('0x2a')]=function(_0x32b34b){try{_[_0xebdf('0x2b')](agents,function(_0x2d43a6,_0x158605){if(_0x2d43a6[_0xebdf('0x6')]==_0x32b34b[_0xebdf('0x6')]&&!_[_0xebdf('0x2c')](unanswered,_0x2d43a6[_0xebdf('0x17')])){utils[_0xebdf('0x19')](util['format'](_0xebdf('0x2d'),_0x32b34b[_0xebdf('0x6')]),_0x32b34b);utils['info'](util[_0xebdf('0x4')](_0xebdf('0x2e'),_0x32b34b['uniqueid'],_0x2d43a6[_0xebdf('0x9')],_0x2d43a6[_0xebdf('0x17')]));_0x2d43a6['agentringnoanswer']=!![];_0x2d43a6[_0xebdf('0x24')]=utils[_0xebdf('0x1c')]();_0x2d43a6[_0xebdf('0xd')]=_0xebdf('0x2f');_0x2d43a6[_0xebdf('0x26')]=_0xebdf('0x2f');_0x2d43a6[_0xebdf('0x30')]=_0x32b34b[_0xebdf('0x30')];_0x2d43a6['talktime']=0x0;writeDB(_0x2d43a6);}});}catch(_0x46b1a6){utils[_0xebdf('0x1f')](util[_0xebdf('0x4')](_0xebdf('0x2d'),_0x32b34b[_0xebdf('0x6')]),_0x46b1a6);}};exports[_0xebdf('0x31')]=function(_0x1b5803){try{if(agents[_0x1b5803[_0xebdf('0x17')]]){utils['debug'](util[_0xebdf('0x4')](_0xebdf('0x32'),_0x1b5803[_0xebdf('0x6')]),_0x1b5803);utils[_0xebdf('0x3')](util[_0xebdf('0x4')](_0xebdf('0x33'),_0x1b5803[_0xebdf('0x6')],agents[_0x1b5803[_0xebdf('0x17')]][_0xebdf('0x9')],_0x1b5803[_0xebdf('0x17')]));agents[_0x1b5803[_0xebdf('0x17')]]['agentconnectAt']=utils[_0xebdf('0x1c')]();agents[_0x1b5803[_0xebdf('0x17')]][_0xebdf('0xc')]=_0x1b5803[_0xebdf('0xc')];agents[_0x1b5803[_0xebdf('0x17')]][_0xebdf('0x1e')]=_0x1b5803[_0xebdf('0x1e')];agents[_0x1b5803['destuniqueid']][_0xebdf('0x30')]=_0x1b5803['ringtime'];agents[_0x1b5803[_0xebdf('0x17')]][_0xebdf('0xd')]=_0xebdf('0x34');_[_0xebdf('0x2b')](agents,function(_0x196933,_0x59d048){if(_0x196933['destuniqueid']!=_0x1b5803[_0xebdf('0x17')]&&_0x196933['uniqueid']==_0x1b5803[_0xebdf('0x6')]){_0x196933[_0xebdf('0x28')]=0x0;_0x196933[_0xebdf('0x30')]=_0x1b5803[_0xebdf('0x27')];_0x196933[_0xebdf('0x20')]=!![];_0x196933[_0xebdf('0x24')]=utils['now']();_0x196933[_0xebdf('0xd')]=_0xebdf('0x35');_0x196933[_0xebdf('0x26')]='answered_elsewhere';_0x196933[_0xebdf('0x36')]=_0x1b5803[_0xebdf('0x17')];_0x196933[_0xebdf('0x37')]=_0x1b5803['membername'];writeDB(_0x196933);}});}}catch(_0x21a4c7){utils[_0xebdf('0x1f')](util[_0xebdf('0x4')]('[%s][agents][agentconnect]',_0x1b5803[_0xebdf('0x6')]),_0x21a4c7);}};exports['agentcomplete']=function(_0x1b7b28){try{if(!_['isNil'](agents[_0x1b7b28[_0xebdf('0x17')]])){utils[_0xebdf('0x19')](util[_0xebdf('0x4')](_0xebdf('0x38'),_0x1b7b28[_0xebdf('0x6')]),_0x1b7b28);utils[_0xebdf('0x3')](util[_0xebdf('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1b7b28['uniqueid'],agents[_0x1b7b28[_0xebdf('0x17')]]['membername'],_0x1b7b28[_0xebdf('0x17')]));agents[_0x1b7b28[_0xebdf('0x17')]][_0xebdf('0x39')]=!![];agents[_0x1b7b28[_0xebdf('0x17')]][_0xebdf('0x3a')]=utils[_0xebdf('0x1c')]();agents[_0x1b7b28[_0xebdf('0x17')]][_0xebdf('0x28')]=utils[_0xebdf('0x3b')](agents[_0x1b7b28['destuniqueid']][_0xebdf('0x3a')],agents[_0x1b7b28[_0xebdf('0x17')]][_0xebdf('0x3c')]);agents[_0x1b7b28['destuniqueid']][_0xebdf('0x26')]=_0x1b7b28[_0xebdf('0x26')];agents[_0x1b7b28[_0xebdf('0x17')]][_0xebdf('0xd')]=_0xebdf('0x3d');writeDB(agents[_0x1b7b28[_0xebdf('0x17')]]);}}catch(_0x5c2c80){utils[_0xebdf('0x1f')](util['format'](_0xebdf('0x38'),_0x1b7b28[_0xebdf('0x6')]),_0x5c2c80);}};exports[_0xebdf('0x3e')]=function(_0x1b8412){try{if(!_['isNil'](agents[_0x1b8412[_0xebdf('0x3f')]])){utils[_0xebdf('0x19')](util[_0xebdf('0x4')](_0xebdf('0x40'),_0x1b8412[_0xebdf('0x6')]),_0x1b8412);utils['info'](util[_0xebdf('0x4')](_0xebdf('0x41'),_0x1b8412[_0xebdf('0x6')],agents[_0x1b8412['transfereruniqueid']]['membername'],agents[_0x1b8412[_0xebdf('0x3f')]][_0xebdf('0x6')]));agents[_0x1b8412[_0xebdf('0x3f')]]['transfer']=!![];agents[_0x1b8412[_0xebdf('0x3f')]]['transfertype']=_0xebdf('0x42');agents[_0x1b8412[_0xebdf('0x3f')]][_0xebdf('0x43')]=_0x1b8412[_0xebdf('0x44')];agents[_0x1b8412['transfereruniqueid']][_0xebdf('0x45')]=agents[_0x1b8412['transfereruniqueid']][_0xebdf('0x6')];}}catch(_0x454750){utils['error'](util[_0xebdf('0x4')](_0xebdf('0x40'),_0x1b8412['uniqueid']),_0x454750);}};exports[_0xebdf('0x46')]=function(_0x13efbe){try{utils['debug'](util[_0xebdf('0x4')]('[%s][agents][attendedtransfer]',_0x13efbe['origtransfereruniqueid']),_0x13efbe);if(_0x13efbe[_0xebdf('0x47')]==_0x13efbe[_0xebdf('0x48')]){if(!_[_0xebdf('0x21')](agents[_0x13efbe[_0xebdf('0x49')]])){utils[_0xebdf('0x3')](util[_0xebdf('0x4')](_0xebdf('0x4a'),_0x13efbe['origtransfereruniqueid'],agents[_0x13efbe[_0xebdf('0x49')]]['membername']));agents[_0x13efbe['secondtransfereruniqueid']][_0xebdf('0x4b')]=!![];agents[_0x13efbe[_0xebdf('0x49')]][_0xebdf('0x4c')]=_0xebdf('0x4d');agents[_0x13efbe[_0xebdf('0x49')]][_0xebdf('0x43')]=_0x13efbe[_0xebdf('0x4e')];agents[_0x13efbe[_0xebdf('0x49')]][_0xebdf('0x45')]=_0x13efbe['origtransfereruniqueid'];}if(_0x13efbe['transfereeuniqueid']&&agents[_0x13efbe[_0xebdf('0x4f')]]){agents[_0x13efbe[_0xebdf('0x4f')]]['agententerreason']=0x1;transfers[_0x13efbe[_0xebdf('0x4f')]]=_[_0xebdf('0x50')](agents[_0x13efbe[_0xebdf('0x4f')]]);transfers[_0x13efbe[_0xebdf('0x4f')]][_0xebdf('0xb')]=agents[_0x13efbe['secondtransfereruniqueid']]['calleridnum'];transfers[_0x13efbe[_0xebdf('0x4f')]][_0xebdf('0x51')]=agents[_0x13efbe[_0xebdf('0x49')]][_0xebdf('0x51')];transfers[_0x13efbe[_0xebdf('0x4f')]][_0xebdf('0x1b')]=utils[_0xebdf('0x1c')]();transfers[_0x13efbe['transfereeuniqueid']][_0xebdf('0x3c')]=utils['now']();transfers[_0x13efbe[_0xebdf('0x4f')]][_0xebdf('0x30')]=0x0;transfers[_0x13efbe[_0xebdf('0x4f')]][_0xebdf('0x52')]=0x2;}}else if(_0x13efbe[_0xebdf('0x49')]==_0x13efbe[_0xebdf('0x53')]){if(!_[_0xebdf('0x21')](agents[_0x13efbe[_0xebdf('0x47')]])){utils[_0xebdf('0x3')](util[_0xebdf('0x4')](_0xebdf('0x4a'),_0x13efbe[_0xebdf('0x47')],agents[_0x13efbe['origtransfereruniqueid']][_0xebdf('0x9')]));agents[_0x13efbe[_0xebdf('0x47')]]['transfer']=!![];agents[_0x13efbe[_0xebdf('0x47')]][_0xebdf('0x4c')]=_0xebdf('0x4d');agents[_0x13efbe['origtransfereruniqueid']][_0xebdf('0x43')]=_0x13efbe['secondtransfererexten'];agents[_0x13efbe[_0xebdf('0x47')]][_0xebdf('0x45')]=_0x13efbe[_0xebdf('0x49')];}if(_0x13efbe[_0xebdf('0x54')]&&agents[_0x13efbe[_0xebdf('0x54')]]){agents[_0x13efbe[_0xebdf('0x54')]]['agententerreason']=0x1;transfers[_0x13efbe[_0xebdf('0x54')]]=_[_0xebdf('0x50')](agents[_0x13efbe[_0xebdf('0x54')]]);transfers[_0x13efbe[_0xebdf('0x54')]][_0xebdf('0xb')]=agents[_0x13efbe[_0xebdf('0x47')]][_0xebdf('0xb')];transfers[_0x13efbe[_0xebdf('0x54')]][_0xebdf('0x51')]=agents[_0x13efbe[_0xebdf('0x47')]][_0xebdf('0x51')];transfers[_0x13efbe['transfertargetuniqueid']]['agentcalledAt']=utils[_0xebdf('0x1c')]();transfers[_0x13efbe[_0xebdf('0x54')]][_0xebdf('0x3c')]=utils[_0xebdf('0x1c')]();transfers[_0x13efbe['transfertargetuniqueid']][_0xebdf('0x30')]=0x0;transfers[_0x13efbe[_0xebdf('0x54')]][_0xebdf('0x52')]=0x2;}}}catch(_0x23c553){utils[_0xebdf('0x1f')](util['format'](_0xebdf('0x55'),_0x13efbe[_0xebdf('0x47')]),_0x23c553);}};exports[_0xebdf('0x56')]=function(_0x1c3b04){try{utils['debug'](util['format'](_0xebdf('0x57'),_0x1c3b04['uniqueid']),_0x1c3b04);if(agents[_0x1c3b04[_0xebdf('0x6')]]&&agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x26')]==='timeout'){if(_0x1c3b04['cause']==='21'){agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x26')]=_0xebdf('0x58');agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0xd')]=_0xebdf('0x58');}utils[_0xebdf('0x3')](util[_0xebdf('0x4')](_0xebdf('0x59'),_0x1c3b04['uniqueid'],agents[_0x1c3b04[_0xebdf('0x6')]]['membername'],agents[_0x1c3b04[_0xebdf('0x6')]]['reason'],agents[_0x1c3b04['uniqueid']][_0xebdf('0xd')]));writeDB(agents[_0x1c3b04[_0xebdf('0x6')]]);var _0x2e805d=unanswered[_0xebdf('0x5a')](_0x1c3b04[_0xebdf('0x6')]);if(_0x2e805d>-0x1){unanswered[_0xebdf('0x5b')](_0x2e805d,0x1);}}if(transfers[_0x1c3b04[_0xebdf('0x6')]]){transfers[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x39')]=!![];transfers[_0x1c3b04['uniqueid']]['agentcompleteAt']=utils['now']();transfers[_0x1c3b04[_0xebdf('0x6')]]['talktime']=utils[_0xebdf('0x3b')](transfers[_0x1c3b04[_0xebdf('0x6')]]['agentcompleteAt'],transfers[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x3c')]);transfers[_0x1c3b04['uniqueid']][_0xebdf('0x26')]=_0xebdf('0x5c');transfers[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0xd')]=_0xebdf('0x3d');utils[_0xebdf('0x3')](util[_0xebdf('0x4')](_0xebdf('0x59'),_0x1c3b04[_0xebdf('0x6')],transfers[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x9')],transfers[_0x1c3b04['uniqueid']][_0xebdf('0x26')],transfers[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0xd')]));writeDB(transfers[_0x1c3b04['uniqueid']],!![]);}if(agents[_0x1c3b04[_0xebdf('0x6')]]&&agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x3c')]){agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x39')]=!![];agents[_0x1c3b04[_0xebdf('0x6')]]['agentcompleteAt']=utils[_0xebdf('0x1c')]();agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x28')]=utils[_0xebdf('0x3b')](agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x3a')],agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x3c')]);agents[_0x1c3b04[_0xebdf('0x6')]]['reason']=agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x4b')]?_0xebdf('0x4b'):_0xebdf('0x5c');agents[_0x1c3b04[_0xebdf('0x6')]]['lastevent']='complete';utils[_0xebdf('0x3')](util[_0xebdf('0x4')](_0xebdf('0x59'),_0x1c3b04[_0xebdf('0x6')],agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x9')],agents[_0x1c3b04[_0xebdf('0x6')]][_0xebdf('0x26')],agents[_0x1c3b04[_0xebdf('0x6')]]['lastevent']));writeDB(agents[_0x1c3b04[_0xebdf('0x6')]]);}}catch(_0x180e60){utils['error'](util[_0xebdf('0x4')](_0xebdf('0x57'),_0x1c3b04[_0xebdf('0x6')]),_0x180e60);}}; \ No newline at end of file +var _0x7a68=['[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','complete','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','lastevent','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','error','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','holdtime'];(function(_0x15e133,_0x1d72b3){var _0x2badc4=function(_0x2c1566){while(--_0x2c1566){_0x15e133['push'](_0x15e133['shift']());}};_0x2badc4(++_0x1d72b3);}(_0x7a68,0x129));var _0x87a6=function(_0x5e0e1e,_0x1b67fc){_0x5e0e1e=_0x5e0e1e-0x0;var _0x599059=_0x7a68[_0x5e0e1e];return _0x599059;};'use strict';var _=require(_0x87a6('0x0'));var util=require(_0x87a6('0x1'));var utils=require(_0x87a6('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24538a,_0x233d34){utils[_0x87a6('0x3')](util[_0x87a6('0x4')](_0x87a6('0x5'),_0x24538a[_0x87a6('0x6')],_0x24538a[_0x87a6('0x7')],_0x24538a[_0x87a6('0x8')],_0x24538a[_0x87a6('0x9')],_0x24538a[_0x87a6('0xa')],_0x24538a[_0x87a6('0xb')],_0x24538a[_0x87a6('0xc')],_0x24538a['lastevent']));if(_0x24538a[_0x87a6('0x8')]){utils[_0x87a6('0xd')](_0x24538a[_0x87a6('0x8')])[_0x87a6('0xe')](function(_0x177e1c){if(_0x177e1c){_0x24538a[_0x87a6('0xf')]=_0x177e1c['type'];_0x24538a[_0x87a6('0x10')]=_0x24538a[_0x87a6('0x11')]?_0x177e1c['acw']:![];_0x24538a['acwtime']=_0x24538a[_0x87a6('0x10')]?_0x177e1c[_0x87a6('0x12')]:0x0;}utils[_0x87a6('0x13')]('CreateVoiceAgentReport',_0x24538a);});}else{utils[_0x87a6('0x13')](_0x87a6('0x14'),_0x24538a);}if(_0x233d34){delete transfers[_0x24538a[_0x87a6('0x6')]];}else{delete agents[_0x24538a[_0x87a6('0x15')]];}}exports[_0x87a6('0x16')]=function(_0x3aef2f){try{utils['debug'](util['format'](_0x87a6('0x17'),_0x3aef2f[_0x87a6('0x6')]),_0x3aef2f);agents[_0x3aef2f[_0x87a6('0x15')]]=_0x3aef2f;agents[_0x3aef2f[_0x87a6('0x15')]]['agentcalledAt']=utils[_0x87a6('0x18')]();agents[_0x3aef2f[_0x87a6('0x15')]][_0x87a6('0x19')]='called';agents[_0x3aef2f[_0x87a6('0x15')]]['connectedlinenum']=null;agents[_0x3aef2f[_0x87a6('0x15')]][_0x87a6('0x1a')]=null;utils['info'](util['format'](_0x87a6('0x1b'),_0x3aef2f[_0x87a6('0x6')],agents[_0x3aef2f[_0x87a6('0x15')]][_0x87a6('0x9')],_0x3aef2f['destuniqueid']));}catch(_0x4aaf69){utils['error'](util['format']('[%s][agents][agentcalled]',_0x3aef2f[_0x87a6('0x6')]),_0x4aaf69);}};exports[_0x87a6('0x1c')]=function(_0x2058c7){try{if(!_[_0x87a6('0x1d')](agents[_0x2058c7[_0x87a6('0x15')]])){utils[_0x87a6('0x1e')](util[_0x87a6('0x4')](_0x87a6('0x1f'),_0x2058c7[_0x87a6('0x6')]),_0x2058c7);utils[_0x87a6('0x3')](util[_0x87a6('0x4')](_0x87a6('0x20'),_0x2058c7[_0x87a6('0x6')],agents[_0x2058c7[_0x87a6('0x15')]][_0x87a6('0x9')],_0x2058c7[_0x87a6('0x15')]));agents[_0x2058c7[_0x87a6('0x15')]][_0x87a6('0x1c')]=!![];agents[_0x2058c7[_0x87a6('0x15')]][_0x87a6('0x21')]=utils['now']();agents[_0x2058c7['destuniqueid']][_0x87a6('0x19')]=_0x87a6('0x22');agents[_0x2058c7[_0x87a6('0x15')]][_0x87a6('0x23')]='timeout';agents[_0x2058c7[_0x87a6('0x15')]]['holdtime']=_0x2058c7[_0x87a6('0x24')]?parseInt(_0x2058c7['ringtime'])/0x3e8:0x0;agents[_0x2058c7[_0x87a6('0x15')]][_0x87a6('0x25')]=0x0;unanswered[_0x87a6('0x26')](_0x2058c7['destuniqueid']);}}catch(_0x4d7159){utils[_0x87a6('0x27')](util[_0x87a6('0x4')]('[%s][agents][agentringnoanswer]',_0x2058c7['uniqueid']),_0x4d7159);}};exports['queuecallerabandon']=function(_0x52e0f5){try{_[_0x87a6('0x28')](agents,function(_0x27f1ce,_0x1998c3){if(_0x27f1ce[_0x87a6('0x6')]==_0x52e0f5[_0x87a6('0x6')]&&!_['includes'](unanswered,_0x27f1ce['destuniqueid'])){utils[_0x87a6('0x1e')](util[_0x87a6('0x4')]('[%s][agents][queuecallerabandon]',_0x52e0f5[_0x87a6('0x6')]),_0x52e0f5);utils[_0x87a6('0x3')](util[_0x87a6('0x4')](_0x87a6('0x29'),_0x52e0f5[_0x87a6('0x6')],_0x27f1ce[_0x87a6('0x9')],_0x27f1ce[_0x87a6('0x15')]));_0x27f1ce[_0x87a6('0x1c')]=!![];_0x27f1ce['agentringnoanswerAt']=utils[_0x87a6('0x18')]();_0x27f1ce['lastevent']='abandoned';_0x27f1ce[_0x87a6('0x23')]='abandoned';_0x27f1ce[_0x87a6('0x2a')]=_0x52e0f5['holdtime'];_0x27f1ce[_0x87a6('0x25')]=0x0;writeDB(_0x27f1ce);}});}catch(_0x46c67e){utils['error'](util[_0x87a6('0x4')](_0x87a6('0x2b'),_0x52e0f5[_0x87a6('0x6')]),_0x46c67e);}};exports['agentconnect']=function(_0x5997c4){try{if(agents[_0x5997c4[_0x87a6('0x15')]]){utils[_0x87a6('0x1e')](util[_0x87a6('0x4')](_0x87a6('0x2c'),_0x5997c4['uniqueid']),_0x5997c4);utils['info'](util['format'](_0x87a6('0x2d'),_0x5997c4[_0x87a6('0x6')],agents[_0x5997c4[_0x87a6('0x15')]][_0x87a6('0x9')],_0x5997c4[_0x87a6('0x15')]));agents[_0x5997c4[_0x87a6('0x15')]][_0x87a6('0x2e')]=utils[_0x87a6('0x18')]();agents[_0x5997c4[_0x87a6('0x15')]][_0x87a6('0xc')]=_0x5997c4[_0x87a6('0xc')];agents[_0x5997c4[_0x87a6('0x15')]][_0x87a6('0x1a')]=_0x5997c4[_0x87a6('0x1a')];agents[_0x5997c4[_0x87a6('0x15')]][_0x87a6('0x2a')]=_0x5997c4[_0x87a6('0x24')];agents[_0x5997c4['destuniqueid']][_0x87a6('0x19')]=_0x87a6('0x2f');_[_0x87a6('0x28')](agents,function(_0x3ada7f,_0x5aa5e4){if(_0x3ada7f[_0x87a6('0x15')]!=_0x5997c4[_0x87a6('0x15')]&&_0x3ada7f[_0x87a6('0x6')]==_0x5997c4[_0x87a6('0x6')]){_0x3ada7f[_0x87a6('0x25')]=0x0;_0x3ada7f[_0x87a6('0x2a')]=_0x5997c4[_0x87a6('0x24')];_0x3ada7f[_0x87a6('0x1c')]=!![];_0x3ada7f[_0x87a6('0x21')]=utils[_0x87a6('0x18')]();_0x3ada7f['lastevent']='answered_elsewhere';_0x3ada7f[_0x87a6('0x23')]=_0x87a6('0x30');_0x3ada7f['answeredelsewheredestinationuniqueid']=_0x5997c4[_0x87a6('0x15')];_0x3ada7f[_0x87a6('0x31')]=_0x5997c4[_0x87a6('0x9')];writeDB(_0x3ada7f);}});}}catch(_0x22087f){utils[_0x87a6('0x27')](util[_0x87a6('0x4')](_0x87a6('0x2c'),_0x5997c4[_0x87a6('0x6')]),_0x22087f);}};exports[_0x87a6('0x11')]=function(_0x148347){try{if(!_[_0x87a6('0x1d')](agents[_0x148347[_0x87a6('0x15')]])){utils['debug'](util[_0x87a6('0x4')](_0x87a6('0x32'),_0x148347[_0x87a6('0x6')]),_0x148347);utils[_0x87a6('0x3')](util[_0x87a6('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x148347['uniqueid'],agents[_0x148347[_0x87a6('0x15')]][_0x87a6('0x9')],_0x148347['destuniqueid']));agents[_0x148347[_0x87a6('0x15')]][_0x87a6('0x11')]=!![];agents[_0x148347[_0x87a6('0x15')]]['agentcompleteAt']=utils[_0x87a6('0x18')]();agents[_0x148347[_0x87a6('0x15')]][_0x87a6('0x25')]=utils['diffTime'](agents[_0x148347[_0x87a6('0x15')]][_0x87a6('0x33')],agents[_0x148347[_0x87a6('0x15')]]['agentconnectAt']);agents[_0x148347['destuniqueid']]['reason']=_0x148347[_0x87a6('0x23')];agents[_0x148347['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x148347[_0x87a6('0x15')]]);}}catch(_0x387ad7){utils[_0x87a6('0x27')](util[_0x87a6('0x4')](_0x87a6('0x32'),_0x148347[_0x87a6('0x6')]),_0x387ad7);}};exports['blindtransfer']=function(_0x327a3e){try{if(!_[_0x87a6('0x1d')](agents[_0x327a3e[_0x87a6('0x34')]])){utils[_0x87a6('0x1e')](util['format'](_0x87a6('0x35'),_0x327a3e[_0x87a6('0x6')]),_0x327a3e);utils[_0x87a6('0x3')](util['format'](_0x87a6('0x36'),_0x327a3e[_0x87a6('0x6')],agents[_0x327a3e['transfereruniqueid']][_0x87a6('0x9')],agents[_0x327a3e[_0x87a6('0x34')]][_0x87a6('0x6')]));agents[_0x327a3e['transfereruniqueid']][_0x87a6('0x37')]=!![];agents[_0x327a3e['transfereruniqueid']][_0x87a6('0x38')]='blind';agents[_0x327a3e[_0x87a6('0x34')]]['transferexten']=_0x327a3e[_0x87a6('0x39')];agents[_0x327a3e[_0x87a6('0x34')]][_0x87a6('0x3a')]=agents[_0x327a3e[_0x87a6('0x34')]]['uniqueid'];}}catch(_0x106041){utils[_0x87a6('0x27')](util['format'](_0x87a6('0x35'),_0x327a3e['uniqueid']),_0x106041);}};exports[_0x87a6('0x3b')]=function(_0x298f9c){try{utils[_0x87a6('0x1e')](util[_0x87a6('0x4')](_0x87a6('0x3c'),_0x298f9c[_0x87a6('0x3d')]),_0x298f9c);if(_0x298f9c['origtransfereruniqueid']==_0x298f9c[_0x87a6('0x3e')]){if(!_['isNil'](agents[_0x298f9c[_0x87a6('0x3f')]])){utils[_0x87a6('0x3')](util[_0x87a6('0x4')](_0x87a6('0x40'),_0x298f9c[_0x87a6('0x3d')],agents[_0x298f9c[_0x87a6('0x3f')]]['membername']));agents[_0x298f9c[_0x87a6('0x3f')]][_0x87a6('0x37')]=!![];agents[_0x298f9c[_0x87a6('0x3f')]][_0x87a6('0x38')]=_0x87a6('0x41');agents[_0x298f9c['secondtransfereruniqueid']][_0x87a6('0x42')]=_0x298f9c[_0x87a6('0x43')];agents[_0x298f9c['secondtransfereruniqueid']]['transferuniqueid']=_0x298f9c['origtransfereruniqueid'];}if(_0x298f9c[_0x87a6('0x44')]&&agents[_0x298f9c[_0x87a6('0x44')]]){agents[_0x298f9c[_0x87a6('0x44')]][_0x87a6('0x45')]=0x1;transfers[_0x298f9c[_0x87a6('0x44')]]=_[_0x87a6('0x46')](agents[_0x298f9c[_0x87a6('0x44')]]);transfers[_0x298f9c[_0x87a6('0x44')]]['calleridnum']=agents[_0x298f9c[_0x87a6('0x3f')]][_0x87a6('0xb')];transfers[_0x298f9c[_0x87a6('0x44')]][_0x87a6('0x47')]=agents[_0x298f9c[_0x87a6('0x3f')]][_0x87a6('0x47')];transfers[_0x298f9c['transfereeuniqueid']][_0x87a6('0x48')]=utils[_0x87a6('0x18')]();transfers[_0x298f9c[_0x87a6('0x44')]]['agentconnectAt']=utils[_0x87a6('0x18')]();transfers[_0x298f9c[_0x87a6('0x44')]][_0x87a6('0x2a')]=0x0;transfers[_0x298f9c['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x298f9c[_0x87a6('0x3f')]==_0x298f9c['secondtransfererlinkedid']){if(!_[_0x87a6('0x1d')](agents[_0x298f9c[_0x87a6('0x3d')]])){utils['info'](util[_0x87a6('0x4')](_0x87a6('0x40'),_0x298f9c[_0x87a6('0x3d')],agents[_0x298f9c[_0x87a6('0x3d')]]['membername']));agents[_0x298f9c[_0x87a6('0x3d')]][_0x87a6('0x37')]=!![];agents[_0x298f9c[_0x87a6('0x3d')]][_0x87a6('0x38')]='ATTENDED';agents[_0x298f9c['origtransfereruniqueid']][_0x87a6('0x42')]=_0x298f9c[_0x87a6('0x49')];agents[_0x298f9c[_0x87a6('0x3d')]][_0x87a6('0x3a')]=_0x298f9c['secondtransfereruniqueid'];}if(_0x298f9c[_0x87a6('0x4a')]&&agents[_0x298f9c[_0x87a6('0x4a')]]){agents[_0x298f9c[_0x87a6('0x4a')]][_0x87a6('0x45')]=0x1;transfers[_0x298f9c[_0x87a6('0x4a')]]=_[_0x87a6('0x46')](agents[_0x298f9c[_0x87a6('0x4a')]]);transfers[_0x298f9c[_0x87a6('0x4a')]]['calleridnum']=agents[_0x298f9c[_0x87a6('0x3d')]][_0x87a6('0xb')];transfers[_0x298f9c[_0x87a6('0x4a')]][_0x87a6('0x47')]=agents[_0x298f9c['origtransfereruniqueid']][_0x87a6('0x47')];transfers[_0x298f9c['transfertargetuniqueid']][_0x87a6('0x48')]=utils[_0x87a6('0x18')]();transfers[_0x298f9c[_0x87a6('0x4a')]][_0x87a6('0x2e')]=utils[_0x87a6('0x18')]();transfers[_0x298f9c[_0x87a6('0x4a')]][_0x87a6('0x2a')]=0x0;transfers[_0x298f9c[_0x87a6('0x4a')]][_0x87a6('0x45')]=0x2;}}}catch(_0x18ecaf){utils['error'](util[_0x87a6('0x4')](_0x87a6('0x3c'),_0x298f9c[_0x87a6('0x3d')]),_0x18ecaf);}};exports[_0x87a6('0x4b')]=function(_0x4c4d4){try{utils[_0x87a6('0x1e')](util[_0x87a6('0x4')](_0x87a6('0x4c'),_0x4c4d4[_0x87a6('0x6')]),_0x4c4d4);if(agents[_0x4c4d4[_0x87a6('0x6')]]&&agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x23')]===_0x87a6('0x22')){if(_0x4c4d4[_0x87a6('0x4d')]==='21'){agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x23')]=_0x87a6('0x4e');agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x19')]=_0x87a6('0x4e');}utils[_0x87a6('0x3')](util[_0x87a6('0x4')](_0x87a6('0x4f'),_0x4c4d4[_0x87a6('0x6')],agents[_0x4c4d4[_0x87a6('0x6')]]['membername'],agents[_0x4c4d4['uniqueid']]['reason'],agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x19')]));writeDB(agents[_0x4c4d4[_0x87a6('0x6')]]);var _0x58ef3f=unanswered[_0x87a6('0x50')](_0x4c4d4['uniqueid']);if(_0x58ef3f>-0x1){unanswered[_0x87a6('0x51')](_0x58ef3f,0x1);}}if(transfers[_0x4c4d4[_0x87a6('0x6')]]){transfers[_0x4c4d4['uniqueid']]['agentcomplete']=!![];transfers[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x33')]=utils[_0x87a6('0x18')]();transfers[_0x4c4d4['uniqueid']][_0x87a6('0x25')]=utils[_0x87a6('0x52')](transfers[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x33')],transfers[_0x4c4d4['uniqueid']][_0x87a6('0x2e')]);transfers[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x23')]=_0x87a6('0x53');transfers[_0x4c4d4[_0x87a6('0x6')]]['lastevent']='complete';utils[_0x87a6('0x3')](util[_0x87a6('0x4')](_0x87a6('0x4f'),_0x4c4d4[_0x87a6('0x6')],transfers[_0x4c4d4['uniqueid']][_0x87a6('0x9')],transfers[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x23')],transfers[_0x4c4d4[_0x87a6('0x6')]]['lastevent']));writeDB(transfers[_0x4c4d4[_0x87a6('0x6')]],!![]);}if(agents[_0x4c4d4[_0x87a6('0x6')]]&&agents[_0x4c4d4['uniqueid']][_0x87a6('0x2e')]){agents[_0x4c4d4['uniqueid']]['agentcomplete']=!![];agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x33')]=utils[_0x87a6('0x18')]();agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x25')]=utils[_0x87a6('0x52')](agents[_0x4c4d4[_0x87a6('0x6')]]['agentcompleteAt'],agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x2e')]);agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x23')]=agents[_0x4c4d4['uniqueid']][_0x87a6('0x37')]?_0x87a6('0x37'):_0x87a6('0x53');agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x19')]=_0x87a6('0x54');utils[_0x87a6('0x3')](util[_0x87a6('0x4')](_0x87a6('0x4f'),_0x4c4d4[_0x87a6('0x6')],agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x9')],agents[_0x4c4d4['uniqueid']][_0x87a6('0x23')],agents[_0x4c4d4[_0x87a6('0x6')]][_0x87a6('0x19')]));writeDB(agents[_0x4c4d4[_0x87a6('0x6')]]);}}catch(_0x13eed7){utils[_0x87a6('0x27')](util['format'](_0x87a6('0x4c'),_0x4c4d4[_0x87a6('0x6')]),_0x13eed7);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ed18742..8b5fc24 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 _0x4b71=['context','exten','now','error','[%s][calls][newchannel]','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','hangup','[%s][calls][hangup]','callerid','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','destinationchannel','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','sipcallid','newexten','appdata','application','set','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','gotoif','[%s][calls][newexten]','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','interface','connectedlinenum','lastevent','accountcode','then','UserId','CreateVoiceCallReport','request','debug','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s'];(function(_0x47db58,_0xa2085b){var _0x19b171=function(_0x2e8868){while(--_0x2e8868){_0x47db58['push'](_0x47db58['shift']());}};_0x19b171(++_0xa2085b);}(_0x4b71,0x11e));var _0x14b7=function(_0xa06ce4,_0x51332a){_0xa06ce4=_0xa06ce4-0x0;var _0x38d5b0=_0x4b71[_0xa06ce4];return _0x38d5b0;};'use strict';var _=require('lodash');var util=require(_0x14b7('0x0'));var utils=require('./utils');var dispositions=[_0x14b7('0x1'),_0x14b7('0x2'),'FAILED',_0x14b7('0x1'),'NO\x20ANSWER',_0x14b7('0x1'),_0x14b7('0x3'),_0x14b7('0x4'),_0x14b7('0x2'),'FAILED',_0x14b7('0x2')];var channels={};function writeDB(_0x43d40d){utils[_0x14b7('0x5')](util[_0x14b7('0x6')](_0x14b7('0x7'),_0x43d40d[_0x14b7('0x8')],_0x43d40d[_0x14b7('0x9')],_0x43d40d[_0x14b7('0xa')],_0x43d40d['membername'],_0x43d40d[_0x14b7('0xb')],_0x43d40d['calleridnum'],_0x43d40d[_0x14b7('0xc')],_0x43d40d[_0x14b7('0xd')]));if(_0x43d40d[_0x14b7('0xe')]){utils['getUserByInternal'](_0x43d40d[_0x14b7('0xe')])[_0x14b7('0xf')](function(_0x57a03a){if(_0x57a03a){_0x43d40d[_0x14b7('0x10')]=_0x57a03a['id'];}utils['request'](_0x14b7('0x11'),_0x43d40d);});}else{utils[_0x14b7('0x12')]('CreateVoiceCallReport',_0x43d40d);}if(channels[_0x43d40d['uniqueid']]){delete channels[_0x43d40d[_0x14b7('0x8')]];}}exports['newchannel']=function(_0xab7706){try{utils[_0x14b7('0x13')](util['format']('[%s][calls][newchannel]',_0xab7706['uniqueid']),_0xab7706);if(_0xab7706[_0x14b7('0x8')]==_0xab7706[_0x14b7('0x14')]&&_0xab7706[_0x14b7('0x9')]!=_0x14b7('0x15')){utils[_0x14b7('0x5')](util[_0x14b7('0x6')](_0x14b7('0x16'),_0xab7706[_0x14b7('0x8')],_0xab7706[_0x14b7('0x17')],_0xab7706[_0x14b7('0x18')]));channels[_0xab7706[_0x14b7('0x8')]]={'uniqueid':_0xab7706['uniqueid'],'accountcode':_0xab7706[_0x14b7('0xe')],'source':_0xab7706['calleridnum'],'destination':_0xab7706[_0x14b7('0x18')],'destinationcontext':_0xab7706[_0x14b7('0x17')],'channel':_0xab7706[_0x14b7('0x9')],'starttime':utils[_0x14b7('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x14b7('0x1'),'amaflags':'DOCUMENTATION'};}}catch(_0x1f5dc6){utils[_0x14b7('0x1a')](util[_0x14b7('0x6')](_0x14b7('0x1b'),_0xab7706[_0x14b7('0x8')]),_0x1f5dc6);}};exports['newstate']=function(_0x521bea){try{utils[_0x14b7('0x13')](util[_0x14b7('0x6')](_0x14b7('0x1c'),_0x521bea[_0x14b7('0x8')]),_0x521bea);if(!_[_0x14b7('0x1d')](channels[_0x521bea[_0x14b7('0x8')]])&&_0x521bea['channelstate']==0x6){utils[_0x14b7('0x5')](util[_0x14b7('0x6')](_0x14b7('0x1e'),_0x521bea[_0x14b7('0x8')],_0x521bea[_0x14b7('0x17')],_0x521bea[_0x14b7('0x9')]));if(_[_0x14b7('0x1d')](channels[_0x521bea[_0x14b7('0x8')]][_0x14b7('0x1f')])){channels[_0x521bea[_0x14b7('0x8')]][_0x14b7('0x1f')]=utils[_0x14b7('0x19')]();}}else if(!_[_0x14b7('0x1d')](channels[_0x521bea[_0x14b7('0x14')]])&&_0x521bea[_0x14b7('0x20')]==0x6&&_0x521bea[_0x14b7('0x17')]!=_0x14b7('0x21')){utils[_0x14b7('0x5')](util[_0x14b7('0x6')](_0x14b7('0x22'),_0x521bea[_0x14b7('0x8')],_0x521bea[_0x14b7('0x14')],_0x521bea['context'],_0x521bea['channel']));channels[_0x521bea[_0x14b7('0x14')]][_0x14b7('0xe')]=_0x521bea[_0x14b7('0xe')];channels[_0x521bea[_0x14b7('0x14')]]['destinationchannel']=_0x521bea['channel'];if(_[_0x14b7('0x1d')](channels[_0x521bea[_0x14b7('0x14')]][_0x14b7('0x23')])){channels[_0x521bea[_0x14b7('0x14')]]['answertime']=utils[_0x14b7('0x19')]();}channels[_0x521bea[_0x14b7('0x14')]][_0x14b7('0x24')]=dispositions[_['toNumber'](_0x521bea['channelstate'])]||_0x14b7('0x3');}}catch(_0x18b4ea){utils['error'](util['format'](_0x14b7('0x1c'),_0x521bea[_0x14b7('0x8')]),_0x18b4ea);}};exports[_0x14b7('0x25')]=function(_0x51ac8a){try{if(!_['isNil'](channels[_0x51ac8a['uniqueid']])){utils[_0x14b7('0x13')](util[_0x14b7('0x6')](_0x14b7('0x26'),_0x51ac8a[_0x14b7('0x8')]),_0x51ac8a);if(_[_0x14b7('0x1d')](channels[_0x51ac8a[_0x14b7('0x8')]][_0x14b7('0x27')])){channels[_0x51ac8a[_0x14b7('0x8')]][_0x14b7('0x27')]=_0x51ac8a['calleridname']+'\x20<'+_0x51ac8a[_0x14b7('0x28')]+'>';}utils[_0x14b7('0x5')](util[_0x14b7('0x6')](_0x14b7('0x29'),_0x51ac8a[_0x14b7('0x8')],channels[_0x51ac8a[_0x14b7('0x8')]][_0x14b7('0x27')],_0x51ac8a[_0x14b7('0x2a')]));channels[_0x51ac8a[_0x14b7('0x8')]][_0x14b7('0x2b')]=utils[_0x14b7('0x19')]();channels[_0x51ac8a[_0x14b7('0x8')]]['duration']=utils[_0x14b7('0x2c')](channels[_0x51ac8a[_0x14b7('0x8')]][_0x14b7('0x2b')],channels[_0x51ac8a['uniqueid']][_0x14b7('0x2d')]);channels[_0x51ac8a[_0x14b7('0x8')]][_0x14b7('0x2e')]=channels[_0x51ac8a[_0x14b7('0x8')]]['answertime']?utils[_0x14b7('0x2c')](channels[_0x51ac8a[_0x14b7('0x8')]][_0x14b7('0x2b')],channels[_0x51ac8a[_0x14b7('0x8')]][_0x14b7('0x23')]):0x0;writeDB(channels[_0x51ac8a[_0x14b7('0x8')]]);}}catch(_0x87e137){utils[_0x14b7('0x1a')](util[_0x14b7('0x6')]('[%s][calls][hangup]',_0x51ac8a[_0x14b7('0x8')]),_0x87e137);}};exports[_0x14b7('0x2f')]=function(_0x101396){try{if(!_[_0x14b7('0x1d')](channels[_0x101396[_0x14b7('0x30')]])){utils[_0x14b7('0x13')](util[_0x14b7('0x6')](_0x14b7('0x31'),_0x101396[_0x14b7('0x32')]),_0x101396);if(channels[_0x101396[_0x14b7('0x30')]][_0x14b7('0x9')]==_0x101396[_0x14b7('0x33')]){utils['info'](util[_0x14b7('0x6')](_0x14b7('0x34'),_0x101396['origtransfereruniqueid'],_0x101396[_0x14b7('0x30')],_0x101396['secondtransfererchannel']));channels[_0x101396[_0x14b7('0x30')]][_0x14b7('0x35')]=_0x101396[_0x14b7('0x36')];channels[_0x101396[_0x14b7('0x30')]][_0x14b7('0x37')]='_attended';}else if(channels[_0x101396['localtwolinkedid']][_0x14b7('0x9')]=_0x101396[_0x14b7('0x38')]){utils[_0x14b7('0x5')](util[_0x14b7('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x101396['origtransfereruniqueid'],_0x101396[_0x14b7('0x30')],_0x101396[_0x14b7('0x39')]));channels[_0x101396[_0x14b7('0x30')]][_0x14b7('0x35')]=_0x101396[_0x14b7('0x39')];channels[_0x101396[_0x14b7('0x30')]][_0x14b7('0x37')]=_0x14b7('0x3a');}}}catch(_0x383a9d){utils[_0x14b7('0x1a')](util[_0x14b7('0x6')](_0x14b7('0x31'),_0x101396[_0x14b7('0x32')]),_0x383a9d);}};exports[_0x14b7('0x3b')]=function(_0x368883){try{if(!_[_0x14b7('0x1d')](channels[_0x368883[_0x14b7('0x8')]])){utils['debug'](util[_0x14b7('0x6')](_0x14b7('0x3c'),_0x368883['uniqueid']),_0x368883);channels[_0x368883['uniqueid']][_0x14b7('0x3d')]=utils['now']();utils[_0x14b7('0x5')](util[_0x14b7('0x6')](_0x14b7('0x3e'),_0x368883[_0x14b7('0x8')],channels[_0x368883['uniqueid']][_0x14b7('0x3d')]));}}catch(_0x179379){utils[_0x14b7('0x1a')](util[_0x14b7('0x6')](_0x14b7('0x3c'),_0x368883[_0x14b7('0x8')]),_0x179379);}};exports[_0x14b7('0x3f')]=function(_0xdba9ba){try{if(!_[_0x14b7('0x1d')](channels[_0xdba9ba['uniqueid']])){utils[_0x14b7('0x13')](util['format'](_0x14b7('0x40'),_0xdba9ba[_0x14b7('0x8')]),_0xdba9ba);if(!_[_0x14b7('0x1d')](channels[_0xdba9ba[_0x14b7('0x8')]][_0x14b7('0x3d')])){channels[_0xdba9ba['uniqueid']][_0x14b7('0x41')]+=utils[_0x14b7('0x2c')](utils[_0x14b7('0x19')](),channels[_0xdba9ba[_0x14b7('0x8')]]['musiconholdstartAt']);utils[_0x14b7('0x5')](util[_0x14b7('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0xdba9ba[_0x14b7('0x8')],channels[_0xdba9ba[_0x14b7('0x8')]][_0x14b7('0x41')]));delete channels[_0xdba9ba[_0x14b7('0x8')]][_0x14b7('0x3d')];}}}catch(_0x5cf4de){utils[_0x14b7('0x1a')](util[_0x14b7('0x6')](_0x14b7('0x40'),_0xdba9ba[_0x14b7('0x8')]),_0x5cf4de);}};exports['varset']=function(_0x4e6df5){try{if(!_[_0x14b7('0x1d')](channels[_0x4e6df5[_0x14b7('0x8')]])){utils[_0x14b7('0x13')](util[_0x14b7('0x6')](_0x14b7('0x42'),_0x4e6df5[_0x14b7('0x8')]),_0x4e6df5);if(!_['isNil'](_0x4e6df5[_0x14b7('0x43')][_0x14b7('0x44')])){utils[_0x14b7('0x5')](util[_0x14b7('0x6')](_0x14b7('0x45'),_0x4e6df5[_0x14b7('0x8')],_0x4e6df5[_0x14b7('0x46')]));channels[_0x4e6df5[_0x14b7('0x8')]][_0x14b7('0x47')]=_0x4e6df5[_0x14b7('0x46')];}if(!_[_0x14b7('0x1d')](_0x4e6df5[_0x14b7('0x43')]['xmd-phone'])){utils['info'](util[_0x14b7('0x6')](_0x14b7('0x48'),_0x4e6df5[_0x14b7('0x8')],_0x4e6df5[_0x14b7('0x46')]));channels[_0x4e6df5['uniqueid']][_0x14b7('0x49')]=_0x4e6df5[_0x14b7('0x46')];channels[_0x4e6df5['uniqueid']][_0x14b7('0x27')]='\x22'+_0x4e6df5[_0x14b7('0x46')]+_0x14b7('0x4a')+_0x4e6df5[_0x14b7('0x46')]+'>';}if(!_[_0x14b7('0x1d')](_0x4e6df5[_0x14b7('0x43')][_0x14b7('0x4b')])||!_[_0x14b7('0x1d')](_0x4e6df5[_0x14b7('0x43')][_0x14b7('0x4c')])){utils[_0x14b7('0x5')](util['format'](_0x14b7('0x4d'),_0x4e6df5[_0x14b7('0x8')],!_[_0x14b7('0x1d')](_0x4e6df5[_0x14b7('0x43')][_0x14b7('0x4b')])?'xmd-callerid-preview':_0x14b7('0x4c'),_0x4e6df5[_0x14b7('0x46')]));channels[_0x4e6df5[_0x14b7('0x8')]]['callerid']=_0x4e6df5[_0x14b7('0x46')];}if(!_['isNil'](_0x4e6df5['variable'][_0x14b7('0x4e')])||!_[_0x14b7('0x1d')](_0x4e6df5['variable']['xmcs-queue'])){utils[_0x14b7('0x5')](util[_0x14b7('0x6')](_0x14b7('0x4d'),_0x4e6df5[_0x14b7('0x8')],!_[_0x14b7('0x1d')](_0x4e6df5[_0x14b7('0x43')][_0x14b7('0x4e')])?'xmd-queue':_0x14b7('0x4f'),_0x4e6df5[_0x14b7('0x46')]));channels[_0x4e6df5[_0x14b7('0x8')]][_0x14b7('0x50')]=_0x14b7('0x51');channels[_0x4e6df5[_0x14b7('0x8')]][_0x14b7('0x52')]=_0x4e6df5[_0x14b7('0x46')];channels[_0x4e6df5['uniqueid']][_0x14b7('0xa')]=!![];}if(!_[_0x14b7('0x1d')](_0x4e6df5[_0x14b7('0x43')]['xmd-contactid'])){utils[_0x14b7('0x5')](util[_0x14b7('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4e6df5['uniqueid'],_0x4e6df5['value']));channels[_0x4e6df5[_0x14b7('0x8')]][_0x14b7('0x53')]=_0x4e6df5['value'];}if(!_['isNil'](_0x4e6df5[_0x14b7('0x43')][_0x14b7('0x54')])){utils[_0x14b7('0x5')](util[_0x14b7('0x6')](_0x14b7('0x55'),_0x4e6df5[_0x14b7('0x8')],_0x4e6df5[_0x14b7('0x46')]));channels[_0x4e6df5[_0x14b7('0x8')]][_0x14b7('0x56')]=_0x4e6df5[_0x14b7('0x46')];}if(!_[_0x14b7('0x1d')](_0x4e6df5[_0x14b7('0x43')][_0x14b7('0x57')])){utils[_0x14b7('0x5')](util[_0x14b7('0x6')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x4e6df5['uniqueid'],_0x4e6df5['value']));channels[_0x4e6df5['uniqueid']]['routeid']=_0x4e6df5[_0x14b7('0x46')];}if(!_[_0x14b7('0x1d')](_0x4e6df5[_0x14b7('0x43')][_0x14b7('0x58')])){utils['info'](util[_0x14b7('0x6')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x4e6df5[_0x14b7('0x8')],_0x4e6df5[_0x14b7('0x46')]));channels[_0x4e6df5[_0x14b7('0x8')]]['sipcallid']=_0x4e6df5[_0x14b7('0x46')];}}}catch(_0x12501f){utils[_0x14b7('0x1a')](util['format']('[%s][calls][varset]',_0x4e6df5[_0x14b7('0x8')]),_0x12501f);}};exports[_0x14b7('0x59')]=function(_0x3feeea){try{if(!_['isNil'](channels[_0x3feeea[_0x14b7('0x8')]])){utils['debug'](util['format']('[%s][calls][newexten]',_0x3feeea[_0x14b7('0x8')]),_0x3feeea);utils[_0x14b7('0x5')](util[_0x14b7('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x3feeea[_0x14b7('0x8')],_0x3feeea['application'],_0x3feeea[_0x14b7('0x5a')]));if(_0x3feeea[_0x14b7('0x5b')]['toLowerCase']()==_0x14b7('0x5c')&&_[_0x14b7('0x5d')](_0x3feeea[_0x14b7('0x5a')][_0x14b7('0x5e')](),_0x14b7('0x5f'))){var _0x426fd2=_0x3feeea[_0x14b7('0x5a')][_0x14b7('0x60')]('=');var _0x2d7a69=_0x426fd2[0x0][_0x14b7('0x61')](_0x426fd2[0x0]['lastIndexOf']('(')+0x1,_0x426fd2[0x0][_0x14b7('0x62')](')'));var _0x96540=_0x426fd2[0x1];channels[_0x3feeea[_0x14b7('0x8')]][_0x2d7a69]=_0x96540;}if(!_[_0x14b7('0x63')]([_0x14b7('0x25'),_0x14b7('0x64'),'execif',_0x14b7('0x5c'),_0x14b7('0x65')],_0x3feeea['application']['toLowerCase']())){channels[_0x3feeea[_0x14b7('0x8')]][_0x14b7('0x50')]=_0x3feeea[_0x14b7('0x5b')];channels[_0x3feeea[_0x14b7('0x8')]][_0x14b7('0x52')]=_0x3feeea['appdata'];}}}catch(_0x5475fb){utils[_0x14b7('0x1a')](util[_0x14b7('0x6')](_0x14b7('0x66'),_0x3feeea[_0x14b7('0x8')]),_0x5475fb);}}; \ No newline at end of file +var _0xfb3f=['util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','debug','[%s][calls][newstate]','isNil','channelstate','systemanswertime','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','toNumber','error','hangup','[%s][calls][hangup]','callerid','duration','diffTime','endtime','billableseconds','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','xmd-originatecalleridnum','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','set','startsWith','cdr','appdata','split','lastIndexOf','includes','noop','execif','toLowerCase','lodash'];(function(_0x17197d,_0x25a479){var _0x3e0f44=function(_0x495142){while(--_0x495142){_0x17197d['push'](_0x17197d['shift']());}};_0x3e0f44(++_0x25a479);}(_0xfb3f,0x1a3));var _0xffb3=function(_0xd8d0be,_0x5ceb12){_0xd8d0be=_0xd8d0be-0x0;var _0x410c1d=_0xfb3f[_0xd8d0be];return _0x410c1d;};'use strict';var _=require(_0xffb3('0x0'));var util=require(_0xffb3('0x1'));var utils=require(_0xffb3('0x2'));var dispositions=[_0xffb3('0x3'),_0xffb3('0x4'),_0xffb3('0x4'),_0xffb3('0x3'),_0xffb3('0x3'),_0xffb3('0x3'),_0xffb3('0x5'),_0xffb3('0x6'),'FAILED',_0xffb3('0x4'),_0xffb3('0x4')];var channels={};function writeDB(_0x4d00ce){utils[_0xffb3('0x7')](util[_0xffb3('0x8')](_0xffb3('0x9'),_0x4d00ce[_0xffb3('0xa')],_0x4d00ce[_0xffb3('0xb')],_0x4d00ce[_0xffb3('0xc')],_0x4d00ce[_0xffb3('0xd')],_0x4d00ce[_0xffb3('0xe')],_0x4d00ce[_0xffb3('0xf')],_0x4d00ce['connectedlinenum'],_0x4d00ce[_0xffb3('0x10')]));if(_0x4d00ce[_0xffb3('0x11')]){utils[_0xffb3('0x12')](_0x4d00ce['accountcode'])[_0xffb3('0x13')](function(_0x28f05e){if(_0x28f05e){_0x4d00ce[_0xffb3('0x14')]=_0x28f05e['id'];}utils[_0xffb3('0x15')]('CreateVoiceCallReport',_0x4d00ce);});}else{utils[_0xffb3('0x15')](_0xffb3('0x16'),_0x4d00ce);}if(channels[_0x4d00ce['uniqueid']]){delete channels[_0x4d00ce[_0xffb3('0xa')]];}}exports[_0xffb3('0x17')]=function(_0x2c2694){try{utils['debug'](util['format'](_0xffb3('0x18'),_0x2c2694['uniqueid']),_0x2c2694);if(_0x2c2694['uniqueid']==_0x2c2694['linkedid']&&_0x2c2694['channel']!=_0xffb3('0x19')){utils[_0xffb3('0x7')](util[_0xffb3('0x8')](_0xffb3('0x1a'),_0x2c2694[_0xffb3('0xa')],_0x2c2694[_0xffb3('0x1b')],_0x2c2694['exten']));channels[_0x2c2694['uniqueid']]={'uniqueid':_0x2c2694['uniqueid'],'accountcode':_0x2c2694['accountcode'],'source':_0x2c2694[_0xffb3('0xf')],'destination':_0x2c2694[_0xffb3('0x1c')],'destinationcontext':_0x2c2694[_0xffb3('0x1b')],'channel':_0x2c2694[_0xffb3('0xb')],'starttime':utils[_0xffb3('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xffb3('0x3'),'amaflags':_0xffb3('0x1e')};}}catch(_0x297f3e){utils['error'](util[_0xffb3('0x8')](_0xffb3('0x18'),_0x2c2694[_0xffb3('0xa')]),_0x297f3e);}};exports[_0xffb3('0x1f')]=function(_0x18dd07){try{utils[_0xffb3('0x20')](util[_0xffb3('0x8')](_0xffb3('0x21'),_0x18dd07[_0xffb3('0xa')]),_0x18dd07);if(!_[_0xffb3('0x22')](channels[_0x18dd07['uniqueid']])&&_0x18dd07[_0xffb3('0x23')]==0x6){utils['info'](util[_0xffb3('0x8')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x18dd07[_0xffb3('0xa')],_0x18dd07[_0xffb3('0x1b')],_0x18dd07[_0xffb3('0xb')]));if(_[_0xffb3('0x22')](channels[_0x18dd07[_0xffb3('0xa')]][_0xffb3('0x24')])){channels[_0x18dd07[_0xffb3('0xa')]][_0xffb3('0x24')]=utils[_0xffb3('0x1d')]();}}else if(!_[_0xffb3('0x22')](channels[_0x18dd07[_0xffb3('0x25')]])&&_0x18dd07['channelstate']==0x6&&_0x18dd07[_0xffb3('0x1b')]!=_0xffb3('0x26')){utils['info'](util[_0xffb3('0x8')](_0xffb3('0x27'),_0x18dd07[_0xffb3('0xa')],_0x18dd07[_0xffb3('0x25')],_0x18dd07[_0xffb3('0x1b')],_0x18dd07[_0xffb3('0xb')]));channels[_0x18dd07[_0xffb3('0x25')]][_0xffb3('0x11')]=_0x18dd07['accountcode'];channels[_0x18dd07[_0xffb3('0x25')]]['destinationchannel']=_0x18dd07[_0xffb3('0xb')];if(_[_0xffb3('0x22')](channels[_0x18dd07['linkedid']][_0xffb3('0x28')])){channels[_0x18dd07[_0xffb3('0x25')]][_0xffb3('0x28')]=utils[_0xffb3('0x1d')]();}channels[_0x18dd07[_0xffb3('0x25')]]['disposition']=dispositions[_[_0xffb3('0x29')](_0x18dd07['channelstate'])]||_0xffb3('0x5');}}catch(_0x44fc1e){utils[_0xffb3('0x2a')](util[_0xffb3('0x8')]('[%s][calls][newstate]',_0x18dd07[_0xffb3('0xa')]),_0x44fc1e);}};exports[_0xffb3('0x2b')]=function(_0x5ee8fe){try{if(!_[_0xffb3('0x22')](channels[_0x5ee8fe[_0xffb3('0xa')]])){utils[_0xffb3('0x20')](util[_0xffb3('0x8')](_0xffb3('0x2c'),_0x5ee8fe[_0xffb3('0xa')]),_0x5ee8fe);if(_[_0xffb3('0x22')](channels[_0x5ee8fe[_0xffb3('0xa')]][_0xffb3('0x2d')])){channels[_0x5ee8fe[_0xffb3('0xa')]]['callerid']=_0x5ee8fe['calleridname']+'\x20<'+_0x5ee8fe[_0xffb3('0xf')]+'>';}utils[_0xffb3('0x7')](util[_0xffb3('0x8')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x5ee8fe[_0xffb3('0xa')],channels[_0x5ee8fe[_0xffb3('0xa')]][_0xffb3('0x2d')],_0x5ee8fe['cause-txt']));channels[_0x5ee8fe[_0xffb3('0xa')]]['endtime']=utils[_0xffb3('0x1d')]();channels[_0x5ee8fe[_0xffb3('0xa')]][_0xffb3('0x2e')]=utils[_0xffb3('0x2f')](channels[_0x5ee8fe['uniqueid']][_0xffb3('0x30')],channels[_0x5ee8fe[_0xffb3('0xa')]]['starttime']);channels[_0x5ee8fe[_0xffb3('0xa')]][_0xffb3('0x31')]=channels[_0x5ee8fe['uniqueid']][_0xffb3('0x28')]?utils[_0xffb3('0x2f')](channels[_0x5ee8fe[_0xffb3('0xa')]][_0xffb3('0x30')],channels[_0x5ee8fe[_0xffb3('0xa')]][_0xffb3('0x28')]):0x0;writeDB(channels[_0x5ee8fe[_0xffb3('0xa')]]);}}catch(_0x2883e4){utils[_0xffb3('0x2a')](util[_0xffb3('0x8')](_0xffb3('0x2c'),_0x5ee8fe[_0xffb3('0xa')]),_0x2883e4);}};exports['attendedtransfer']=function(_0x4090c5){try{if(!_[_0xffb3('0x22')](channels[_0x4090c5[_0xffb3('0x32')]])){utils[_0xffb3('0x20')](util[_0xffb3('0x8')]('[%s][calls][attendedtransfer]',_0x4090c5[_0xffb3('0x33')]),_0x4090c5);if(channels[_0x4090c5[_0xffb3('0x32')]][_0xffb3('0xb')]==_0x4090c5[_0xffb3('0x34')]){utils[_0xffb3('0x7')](util['format'](_0xffb3('0x35'),_0x4090c5[_0xffb3('0x33')],_0x4090c5['localtwolinkedid'],_0x4090c5[_0xffb3('0x36')]));channels[_0x4090c5['localtwolinkedid']][_0xffb3('0x37')]=_0x4090c5[_0xffb3('0x36')];channels[_0x4090c5[_0xffb3('0x32')]][_0xffb3('0x38')]=_0xffb3('0x39');}else if(channels[_0x4090c5[_0xffb3('0x32')]][_0xffb3('0xb')]=_0x4090c5[_0xffb3('0x3a')]){utils[_0xffb3('0x7')](util[_0xffb3('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4090c5[_0xffb3('0x33')],_0x4090c5[_0xffb3('0x32')],_0x4090c5[_0xffb3('0x3b')]));channels[_0x4090c5[_0xffb3('0x32')]][_0xffb3('0x37')]=_0x4090c5[_0xffb3('0x3b')];channels[_0x4090c5[_0xffb3('0x32')]][_0xffb3('0x38')]=_0xffb3('0x39');}}}catch(_0xadf0b1){utils['error'](util[_0xffb3('0x8')]('[%s][calls][attendedtransfer]',_0x4090c5[_0xffb3('0x33')]),_0xadf0b1);}};exports['musiconholdstart']=function(_0x4b7fd2){try{if(!_[_0xffb3('0x22')](channels[_0x4b7fd2[_0xffb3('0xa')]])){utils[_0xffb3('0x20')](util[_0xffb3('0x8')](_0xffb3('0x3c'),_0x4b7fd2[_0xffb3('0xa')]),_0x4b7fd2);channels[_0x4b7fd2['uniqueid']][_0xffb3('0x3d')]=utils[_0xffb3('0x1d')]();utils['info'](util['format'](_0xffb3('0x3e'),_0x4b7fd2[_0xffb3('0xa')],channels[_0x4b7fd2[_0xffb3('0xa')]][_0xffb3('0x3d')]));}}catch(_0x581791){utils[_0xffb3('0x2a')](util[_0xffb3('0x8')](_0xffb3('0x3c'),_0x4b7fd2[_0xffb3('0xa')]),_0x581791);}};exports[_0xffb3('0x3f')]=function(_0x3a953e){try{if(!_[_0xffb3('0x22')](channels[_0x3a953e[_0xffb3('0xa')]])){utils['debug'](util[_0xffb3('0x8')](_0xffb3('0x40'),_0x3a953e[_0xffb3('0xa')]),_0x3a953e);if(!_[_0xffb3('0x22')](channels[_0x3a953e[_0xffb3('0xa')]][_0xffb3('0x3d')])){channels[_0x3a953e[_0xffb3('0xa')]]['mohtime']+=utils['diffTime'](utils['now'](),channels[_0x3a953e[_0xffb3('0xa')]][_0xffb3('0x3d')]);utils['info'](util[_0xffb3('0x8')](_0xffb3('0x41'),_0x3a953e[_0xffb3('0xa')],channels[_0x3a953e[_0xffb3('0xa')]][_0xffb3('0x42')]));delete channels[_0x3a953e[_0xffb3('0xa')]][_0xffb3('0x3d')];}}}catch(_0x3cd346){utils[_0xffb3('0x2a')](util[_0xffb3('0x8')](_0xffb3('0x40'),_0x3a953e[_0xffb3('0xa')]),_0x3cd346);}};exports[_0xffb3('0x43')]=function(_0xf59086){try{if(!_[_0xffb3('0x22')](channels[_0xf59086['uniqueid']])){utils[_0xffb3('0x20')](util[_0xffb3('0x8')]('[%s][calls][varset]',_0xf59086[_0xffb3('0xa')]),_0xf59086);if(!_[_0xffb3('0x22')](_0xf59086[_0xffb3('0x44')][_0xffb3('0x45')])){utils[_0xffb3('0x7')](util[_0xffb3('0x8')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0xf59086[_0xffb3('0xa')],_0xf59086[_0xffb3('0x46')]));channels[_0xf59086[_0xffb3('0xa')]][_0xffb3('0x47')]=_0xf59086[_0xffb3('0x46')];}if(!_['isNil'](_0xf59086[_0xffb3('0x44')]['xmd-phone'])){utils['info'](util[_0xffb3('0x8')](_0xffb3('0x48'),_0xf59086[_0xffb3('0xa')],_0xf59086[_0xffb3('0x46')]));channels[_0xf59086[_0xffb3('0xa')]][_0xffb3('0x49')]=_0xf59086['value'];channels[_0xf59086['uniqueid']][_0xffb3('0x2d')]='\x22'+_0xf59086[_0xffb3('0x46')]+'\x22\x20<'+_0xf59086[_0xffb3('0x46')]+'>';}if(!_[_0xffb3('0x22')](_0xf59086[_0xffb3('0x44')][_0xffb3('0x4a')])||!_['isNil'](_0xf59086['variable'][_0xffb3('0x4b')])){utils[_0xffb3('0x7')](util[_0xffb3('0x8')](_0xffb3('0x4c'),_0xf59086[_0xffb3('0xa')],!_[_0xffb3('0x22')](_0xf59086[_0xffb3('0x44')]['xmd-callerid-preview'])?_0xffb3('0x4a'):'xmd-callerid',_0xf59086[_0xffb3('0x46')]));channels[_0xf59086[_0xffb3('0xa')]][_0xffb3('0x2d')]=_0xf59086[_0xffb3('0x46')];}if(!_['isNil'](_0xf59086[_0xffb3('0x44')][_0xffb3('0x4d')])||!_[_0xffb3('0x22')](_0xf59086[_0xffb3('0x44')][_0xffb3('0x4e')])){utils[_0xffb3('0x7')](util[_0xffb3('0x8')](_0xffb3('0x4c'),_0xf59086[_0xffb3('0xa')],!_['isNil'](_0xf59086[_0xffb3('0x44')][_0xffb3('0x4d')])?_0xffb3('0x4d'):_0xffb3('0x4e'),_0xf59086[_0xffb3('0x46')]));channels[_0xf59086['uniqueid']][_0xffb3('0x4f')]=_0xffb3('0x50');channels[_0xf59086[_0xffb3('0xa')]]['lastdata']=_0xf59086[_0xffb3('0x46')];channels[_0xf59086[_0xffb3('0xa')]]['queue']=!![];}if(!_['isNil'](_0xf59086[_0xffb3('0x44')][_0xffb3('0x51')])){utils['info'](util['format'](_0xffb3('0x52'),_0xf59086[_0xffb3('0xa')],_0xf59086[_0xffb3('0x46')]));channels[_0xf59086[_0xffb3('0xa')]][_0xffb3('0x53')]=_0xf59086[_0xffb3('0x46')];}if(!_[_0xffb3('0x22')](_0xf59086[_0xffb3('0x44')][_0xffb3('0x54')])){utils['info'](util[_0xffb3('0x8')](_0xffb3('0x55'),_0xf59086[_0xffb3('0xa')],_0xf59086[_0xffb3('0x46')]));channels[_0xf59086[_0xffb3('0xa')]][_0xffb3('0x56')]=_0xf59086[_0xffb3('0x46')];}if(!_['isNil'](_0xf59086[_0xffb3('0x44')][_0xffb3('0x57')])){utils[_0xffb3('0x7')](util[_0xffb3('0x8')](_0xffb3('0x58'),_0xf59086[_0xffb3('0xa')],_0xf59086[_0xffb3('0x46')]));channels[_0xf59086[_0xffb3('0xa')]][_0xffb3('0x59')]=_0xf59086[_0xffb3('0x46')];}if(!_[_0xffb3('0x22')](_0xf59086[_0xffb3('0x44')]['sipcallid'])){utils[_0xffb3('0x7')](util[_0xffb3('0x8')](_0xffb3('0x5a'),_0xf59086[_0xffb3('0xa')],_0xf59086[_0xffb3('0x46')]));channels[_0xf59086[_0xffb3('0xa')]]['sipcallid']=_0xf59086[_0xffb3('0x46')];}}}catch(_0x62bdb3){utils[_0xffb3('0x2a')](util[_0xffb3('0x8')](_0xffb3('0x5b'),_0xf59086[_0xffb3('0xa')]),_0x62bdb3);}};exports[_0xffb3('0x5c')]=function(_0x33f9d2){try{if(!_[_0xffb3('0x22')](channels[_0x33f9d2[_0xffb3('0xa')]])){utils[_0xffb3('0x20')](util[_0xffb3('0x8')](_0xffb3('0x5d'),_0x33f9d2[_0xffb3('0xa')]),_0x33f9d2);utils[_0xffb3('0x7')](util[_0xffb3('0x8')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x33f9d2[_0xffb3('0xa')],_0x33f9d2[_0xffb3('0x5e')],_0x33f9d2['appdata']));if(_0x33f9d2[_0xffb3('0x5e')]['toLowerCase']()==_0xffb3('0x5f')&&_[_0xffb3('0x60')](_0x33f9d2['appdata']['toLowerCase'](),_0xffb3('0x61'))){var _0x435d92=_0x33f9d2[_0xffb3('0x62')][_0xffb3('0x63')]('=');var _0x5b7bcc=_0x435d92[0x0]['substring'](_0x435d92[0x0][_0xffb3('0x64')]('(')+0x1,_0x435d92[0x0][_0xffb3('0x64')](')'));var _0x27a3a0=_0x435d92[0x1];channels[_0x33f9d2[_0xffb3('0xa')]][_0x5b7bcc]=_0x27a3a0;}if(!_[_0xffb3('0x65')]([_0xffb3('0x2b'),_0xffb3('0x66'),_0xffb3('0x67'),_0xffb3('0x5f'),'gotoif'],_0x33f9d2['application'][_0xffb3('0x68')]())){channels[_0x33f9d2[_0xffb3('0xa')]]['lastapplication']=_0x33f9d2['application'];channels[_0x33f9d2[_0xffb3('0xa')]]['lastdata']=_0x33f9d2[_0xffb3('0x62')];}}}catch(_0x5d05c0){utils[_0xffb3('0x2a')](util[_0xffb3('0x8')](_0xffb3('0x5d'),_0x33f9d2['uniqueid']),_0x5d05c0);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 10515e9..93d4288 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 _0xc76d=['managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close'];(function(_0x32cf88,_0x36a238){var _0x5e211c=function(_0x2a0ade){while(--_0x2a0ade){_0x32cf88['push'](_0x32cf88['shift']());}};_0x5e211c(++_0x36a238);}(_0xc76d,0xdd));var _0xdc76=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0xc76d[_0x5c2e5e];return _0x46a5da;};'use strict';var utils=require(_0xdc76('0x0'));exports[_0xdc76('0x1')]=function(){utils[_0xdc76('0x2')](_0xdc76('0x3'));};exports['shutdown']=function(){utils[_0xdc76('0x2')](_0xdc76('0x4'));};exports[_0xdc76('0x5')]=function(){utils[_0xdc76('0x2')](_0xdc76('0x6'));};exports[_0xdc76('0x7')]=function(_0x3ae8c6){utils[_0xdc76('0x7')]('[core]\x20error',_0x3ae8c6);};exports[_0xdc76('0x8')]=function(){utils[_0xdc76('0x2')](_0xdc76('0x9'));};exports[_0xdc76('0xa')]=function(_0x1e2777){}; \ No newline at end of file +var _0xf7b3=['connect','info','[core]\x20shutdown','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils'];(function(_0x3b3f1f,_0x4f454c){var _0x1814c3=function(_0x550005){while(--_0x550005){_0x3b3f1f['push'](_0x3b3f1f['shift']());}};_0x1814c3(++_0x4f454c);}(_0xf7b3,0x12b));var _0x3f7b=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0xf7b3[_0x25d2fb];return _0x1ded53;};'use strict';var utils=require(_0x3f7b('0x0'));exports[_0x3f7b('0x1')]=function(){utils[_0x3f7b('0x2')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x3f7b('0x2')](_0x3f7b('0x3'));};exports['fullybooted']=function(){utils[_0x3f7b('0x2')](_0x3f7b('0x4'));};exports[_0x3f7b('0x5')]=function(_0x4baa63){utils[_0x3f7b('0x5')](_0x3f7b('0x6'),_0x4baa63);};exports[_0x3f7b('0x7')]=function(){utils[_0x3f7b('0x2')](_0x3f7b('0x8'));};exports[_0x3f7b('0x9')]=function(_0x256e97){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 3ceca72..1301f2c 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 _0x9bbe=['set','startsWith','appdata','error','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','application','toLowerCase'];(function(_0x50ca47,_0x123352){var _0x5815ed=function(_0x559690){while(--_0x559690){_0x50ca47['push'](_0x50ca47['shift']());}};_0x5815ed(++_0x123352);}(_0x9bbe,0xac));var _0xe9bb=function(_0x410846,_0x178b5b){_0x410846=_0x410846-0x0;var _0x2fc941=_0x9bbe[_0x410846];return _0x2fc941;};'use strict';var _=require(_0xe9bb('0x0'));var util=require('util');var utils=require(_0xe9bb('0x1'));var dials={};function writeDB(_0xb4e5b5){utils[_0xe9bb('0x2')](util['format'](_0xe9bb('0x3'),_0xb4e5b5[_0xe9bb('0x4')],_0xb4e5b5['channel'],_0xb4e5b5[_0xe9bb('0x5')],_0xb4e5b5[_0xe9bb('0x6')],_0xb4e5b5['connectedlinenum'],_0xb4e5b5[_0xe9bb('0x7')]));utils[_0xe9bb('0x8')](_0xe9bb('0x9'),_0xb4e5b5);delete dials[_0xb4e5b5[_0xe9bb('0x4')]];}exports[_0xe9bb('0xa')]=function(_0x58d49d){try{utils[_0xe9bb('0xb')](util[_0xe9bb('0xc')](_0xe9bb('0xd'),_0x58d49d['uniqueid']),_0x58d49d);utils[_0xe9bb('0x2')](util[_0xe9bb('0xc')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x58d49d['uniqueid'],_0x58d49d[_0xe9bb('0xe')],_0x58d49d['appdata']));if(_0x58d49d[_0xe9bb('0xe')][_0xe9bb('0xf')]()==_0xe9bb('0x10')&&_[_0xe9bb('0x11')](_0x58d49d[_0xe9bb('0x12')][_0xe9bb('0xf')](),'cdr(routeid)')){var _0x4eb8f0=_0x58d49d[_0xe9bb('0x12')]['split']('=');dials[_0x58d49d[_0xe9bb('0x4')]]={'routeId':_0x4eb8f0[0x1]};}}catch(_0x300399){utils[_0xe9bb('0x13')](util[_0xe9bb('0xc')]('[%s][dials][newexten]',_0x58d49d['uniqueid']),_0x300399);}};exports['varset']=function(_0x33e7ba){try{utils['debug'](util[_0xe9bb('0xc')](_0xe9bb('0x14'),_0x33e7ba[_0xe9bb('0x4')]),_0x33e7ba);if(!_[_0xe9bb('0x15')](_0x33e7ba[_0xe9bb('0x16')][_0xe9bb('0x17')])){utils[_0xe9bb('0x2')](util['format'](_0xe9bb('0x18'),_0x33e7ba['uniqueid'],_0x33e7ba['value']));dials[_0x33e7ba[_0xe9bb('0x4')]]={'routeId':_0x33e7ba[_0xe9bb('0x19')]};}}catch(_0x455aa6){utils[_0xe9bb('0x13')](util[_0xe9bb('0xc')](_0xe9bb('0x14'),_0x33e7ba[_0xe9bb('0x4')]),_0x455aa6);}};exports[_0xe9bb('0x1a')]=function(_0x5ee2cd){try{if(!_[_0xe9bb('0x15')](dials[_0x5ee2cd[_0xe9bb('0x4')]])){utils[_0xe9bb('0xb')](util[_0xe9bb('0xc')]('[%s][dials][dialbegin]',_0x5ee2cd[_0xe9bb('0x4')]),_0x5ee2cd);dials[_0x5ee2cd[_0xe9bb('0x4')]]=_[_0xe9bb('0x1b')](dials[_0x5ee2cd[_0xe9bb('0x4')]],_0x5ee2cd);dials[_0x5ee2cd[_0xe9bb('0x4')]][_0xe9bb('0x1c')]=utils[_0xe9bb('0x1d')]();dials[_0x5ee2cd[_0xe9bb('0x4')]]['lastevent']=_0xe9bb('0x1e');utils[_0xe9bb('0x2')](util[_0xe9bb('0xc')](_0xe9bb('0x1f'),_0x5ee2cd['uniqueid'],dials[_0x5ee2cd[_0xe9bb('0x4')]][_0xe9bb('0x1c')]));}}catch(_0x41399e){utils['error'](util[_0xe9bb('0xc')]('[%s][dials][dialbegin]',_0x5ee2cd[_0xe9bb('0x4')]),_0x41399e);}};exports['dialend']=function(_0xe886a5){try{if(!_[_0xe9bb('0x15')](dials[_0xe886a5[_0xe9bb('0x4')]])){utils[_0xe9bb('0xb')](util[_0xe9bb('0xc')](_0xe9bb('0x20'),_0xe886a5[_0xe9bb('0x4')]),_0xe886a5);dials[_0xe886a5[_0xe9bb('0x4')]][_0xe9bb('0x7')]=_0xe886a5[_0xe9bb('0x7')];if(_0xe886a5[_0xe9bb('0x7')]==_0xe9bb('0x21')){dials[_0xe886a5[_0xe9bb('0x4')]]=_['assign'](dials[_0xe886a5[_0xe9bb('0x4')]],_0xe886a5);dials[_0xe886a5['uniqueid']][_0xe9bb('0x22')]=utils[_0xe9bb('0x1d')]();dials[_0xe886a5[_0xe9bb('0x4')]]['lastevent']=_0xe9bb('0x23');utils[_0xe9bb('0x2')](util[_0xe9bb('0xc')](_0xe9bb('0x24'),_0xe886a5[_0xe9bb('0x4')],_0xe886a5[_0xe9bb('0x7')],dials[_0xe886a5[_0xe9bb('0x4')]][_0xe9bb('0x22')]));}else{utils[_0xe9bb('0x2')](util[_0xe9bb('0xc')](_0xe9bb('0x25'),_0xe886a5[_0xe9bb('0x4')],_0xe886a5[_0xe9bb('0x7')]));}}}catch(_0x4c1168){utils[_0xe9bb('0x13')](util['format'](_0xe9bb('0x20'),_0xe886a5[_0xe9bb('0x4')]),_0x4c1168);}};exports[_0xe9bb('0x26')]=function(_0x2e5c7f){try{if(!_[_0xe9bb('0x15')](dials[_0x2e5c7f[_0xe9bb('0x4')]])){utils[_0xe9bb('0xb')](util[_0xe9bb('0xc')](_0xe9bb('0x27'),_0x2e5c7f[_0xe9bb('0x4')]),_0x2e5c7f);utils[_0xe9bb('0x2')](util[_0xe9bb('0xc')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2e5c7f[_0xe9bb('0x4')],_0x2e5c7f['calleridnum'],_0x2e5c7f[_0xe9bb('0x28')],_0x2e5c7f[_0xe9bb('0x29')]));dials[_0x2e5c7f['uniqueid']]=_[_0xe9bb('0x1b')](dials[_0x2e5c7f[_0xe9bb('0x4')]],{'endtime':utils[_0xe9bb('0x1d')](),'lastevent':_0xe9bb('0x2a')});dials[_0x2e5c7f['uniqueid']][_0xe9bb('0x2b')]=utils[_0xe9bb('0x2c')](dials[_0x2e5c7f['uniqueid']][_0xe9bb('0x2d')],dials[_0x2e5c7f[_0xe9bb('0x4')]]['starttime']);dials[_0x2e5c7f['uniqueid']][_0xe9bb('0x2e')]=utils[_0xe9bb('0x2c')](dials[_0x2e5c7f[_0xe9bb('0x4')]][_0xe9bb('0x22')]||dials[_0x2e5c7f['uniqueid']]['endtime'],dials[_0x2e5c7f[_0xe9bb('0x4')]]['starttime']);dials[_0x2e5c7f[_0xe9bb('0x4')]]['billableseconds']=dials[_0x2e5c7f[_0xe9bb('0x4')]][_0xe9bb('0x22')]?utils[_0xe9bb('0x2c')](dials[_0x2e5c7f[_0xe9bb('0x4')]][_0xe9bb('0x2d')],dials[_0x2e5c7f[_0xe9bb('0x4')]]['answertime']):0x0;writeDB(dials[_0x2e5c7f[_0xe9bb('0x4')]]);}}catch(_0x3c7fd4){utils[_0xe9bb('0x13')](util['format'](_0xe9bb('0x27'),_0x2e5c7f['uniqueid']),_0x3c7fd4);}}; \ No newline at end of file +var _0x27a6=['cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','debug','application','set','startsWith','appdata','toLowerCase'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x27a6,0x17e));var _0x627a=function(_0xaeff8a,_0x506724){_0xaeff8a=_0xaeff8a-0x0;var _0x8a6ce3=_0x27a6[_0xaeff8a];return _0x8a6ce3;};'use strict';var _=require(_0x627a('0x0'));var util=require('util');var utils=require(_0x627a('0x1'));var dials={};function writeDB(_0x5b03de){utils[_0x627a('0x2')](util[_0x627a('0x3')](_0x627a('0x4'),_0x5b03de[_0x627a('0x5')],_0x5b03de[_0x627a('0x6')],_0x5b03de['dialstring'],_0x5b03de[_0x627a('0x7')],_0x5b03de['connectedlinenum'],_0x5b03de[_0x627a('0x8')]));utils[_0x627a('0x9')](_0x627a('0xa'),_0x5b03de);delete dials[_0x5b03de[_0x627a('0x5')]];}exports[_0x627a('0xb')]=function(_0x436497){try{utils[_0x627a('0xc')](util[_0x627a('0x3')]('[%s][dials][newexten]',_0x436497[_0x627a('0x5')]),_0x436497);utils[_0x627a('0x2')](util[_0x627a('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x436497[_0x627a('0x5')],_0x436497[_0x627a('0xd')],_0x436497['appdata']));if(_0x436497[_0x627a('0xd')]['toLowerCase']()==_0x627a('0xe')&&_[_0x627a('0xf')](_0x436497[_0x627a('0x10')][_0x627a('0x11')](),_0x627a('0x12'))){var _0x105ec2=_0x436497['appdata'][_0x627a('0x13')]('=');dials[_0x436497['uniqueid']]={'routeId':_0x105ec2[0x1]};}}catch(_0x1907ac){utils[_0x627a('0x14')](util[_0x627a('0x3')](_0x627a('0x15'),_0x436497[_0x627a('0x5')]),_0x1907ac);}};exports[_0x627a('0x16')]=function(_0x4cffcb){try{utils[_0x627a('0xc')](util[_0x627a('0x3')](_0x627a('0x17'),_0x4cffcb[_0x627a('0x5')]),_0x4cffcb);if(!_['isNil'](_0x4cffcb[_0x627a('0x18')]['outboundrouteid'])){utils['info'](util[_0x627a('0x3')](_0x627a('0x19'),_0x4cffcb[_0x627a('0x5')],_0x4cffcb[_0x627a('0x1a')]));dials[_0x4cffcb[_0x627a('0x5')]]={'routeId':_0x4cffcb[_0x627a('0x1a')]};}}catch(_0x5d6467){utils[_0x627a('0x14')](util['format'](_0x627a('0x17'),_0x4cffcb[_0x627a('0x5')]),_0x5d6467);}};exports[_0x627a('0x1b')]=function(_0x2bddd6){try{if(!_[_0x627a('0x1c')](dials[_0x2bddd6['uniqueid']])){utils[_0x627a('0xc')](util[_0x627a('0x3')]('[%s][dials][dialbegin]',_0x2bddd6[_0x627a('0x5')]),_0x2bddd6);dials[_0x2bddd6[_0x627a('0x5')]]=_[_0x627a('0x1d')](dials[_0x2bddd6[_0x627a('0x5')]],_0x2bddd6);dials[_0x2bddd6['uniqueid']][_0x627a('0x1e')]=utils[_0x627a('0x1f')]();dials[_0x2bddd6[_0x627a('0x5')]][_0x627a('0x20')]=_0x627a('0x21');utils[_0x627a('0x2')](util[_0x627a('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2bddd6[_0x627a('0x5')],dials[_0x2bddd6['uniqueid']][_0x627a('0x1e')]));}}catch(_0x14bc7d){utils[_0x627a('0x14')](util[_0x627a('0x3')](_0x627a('0x22'),_0x2bddd6['uniqueid']),_0x14bc7d);}};exports['dialend']=function(_0x3629f4){try{if(!_[_0x627a('0x1c')](dials[_0x3629f4[_0x627a('0x5')]])){utils['debug'](util[_0x627a('0x3')]('[%s][dials][dialend]',_0x3629f4[_0x627a('0x5')]),_0x3629f4);dials[_0x3629f4[_0x627a('0x5')]][_0x627a('0x8')]=_0x3629f4[_0x627a('0x8')];if(_0x3629f4['dialstatus']==_0x627a('0x23')){dials[_0x3629f4[_0x627a('0x5')]]=_[_0x627a('0x1d')](dials[_0x3629f4['uniqueid']],_0x3629f4);dials[_0x3629f4[_0x627a('0x5')]]['answertime']=utils[_0x627a('0x1f')]();dials[_0x3629f4[_0x627a('0x5')]][_0x627a('0x20')]=_0x627a('0x24');utils[_0x627a('0x2')](util[_0x627a('0x3')](_0x627a('0x25'),_0x3629f4[_0x627a('0x5')],_0x3629f4[_0x627a('0x8')],dials[_0x3629f4['uniqueid']][_0x627a('0x26')]));}else{utils[_0x627a('0x2')](util[_0x627a('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x3629f4[_0x627a('0x5')],_0x3629f4['dialstatus']));}}}catch(_0x460b7f){utils[_0x627a('0x14')](util['format'](_0x627a('0x27'),_0x3629f4['uniqueid']),_0x460b7f);}};exports[_0x627a('0x28')]=function(_0x32c705){try{if(!_[_0x627a('0x1c')](dials[_0x32c705['uniqueid']])){utils[_0x627a('0xc')](util['format'](_0x627a('0x29'),_0x32c705[_0x627a('0x5')]),_0x32c705);utils[_0x627a('0x2')](util[_0x627a('0x3')](_0x627a('0x2a'),_0x32c705[_0x627a('0x5')],_0x32c705[_0x627a('0x7')],_0x32c705['calleridname'],_0x32c705[_0x627a('0x2b')]));dials[_0x32c705['uniqueid']]=_[_0x627a('0x1d')](dials[_0x32c705[_0x627a('0x5')]],{'endtime':utils['now'](),'lastevent':_0x627a('0x2c')});dials[_0x32c705[_0x627a('0x5')]][_0x627a('0x2d')]=utils[_0x627a('0x2e')](dials[_0x32c705[_0x627a('0x5')]][_0x627a('0x2f')],dials[_0x32c705[_0x627a('0x5')]]['starttime']);dials[_0x32c705[_0x627a('0x5')]][_0x627a('0x30')]=utils[_0x627a('0x2e')](dials[_0x32c705[_0x627a('0x5')]][_0x627a('0x26')]||dials[_0x32c705[_0x627a('0x5')]][_0x627a('0x2f')],dials[_0x32c705[_0x627a('0x5')]][_0x627a('0x1e')]);dials[_0x32c705[_0x627a('0x5')]][_0x627a('0x31')]=dials[_0x32c705[_0x627a('0x5')]][_0x627a('0x26')]?utils['diffTime'](dials[_0x32c705[_0x627a('0x5')]][_0x627a('0x2f')],dials[_0x32c705['uniqueid']][_0x627a('0x26')]):0x0;writeDB(dials[_0x32c705[_0x627a('0x5')]]);}}catch(_0x1ab388){utils[_0x627a('0x14')](util[_0x627a('0x3')](_0x627a('0x29'),_0x32c705[_0x627a('0x5')]),_0x1ab388);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index ffec556..039f24c 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 _0xf21d=['asterisk','username','password','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','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]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util'];(function(_0x396952,_0x56b463){var _0x53d27c=function(_0xe5d83f){while(--_0xe5d83f){_0x396952['push'](_0x396952['shift']());}};_0x53d27c(++_0x56b463);}(_0xf21d,0x10c));var _0xdf21=function(_0x22a6b6,_0x19b85c){_0x22a6b6=_0x22a6b6-0x0;var _0x111ca3=_0xf21d[_0x22a6b6];return _0x111ca3;};var AsteriskManager=require(_0xdf21('0x0'));var config=require(_0xdf21('0x1'));var utils=require(_0xdf21('0x2'));var util=require(_0xdf21('0x3'));var ami=new AsteriskManager(config[_0xdf21('0x4')]['port'],config[_0xdf21('0x4')]['ip'],config[_0xdf21('0x4')][_0xdf21('0x5')],config[_0xdf21('0x4')][_0xdf21('0x6')],!![]);ami['keepConnected']();if(config[_0xdf21('0x7')]&&config[_0xdf21('0x7')]['disabled']){utils[_0xdf21('0x8')](_0xdf21('0x9'));}else{var agents=require(_0xdf21('0xa'));var calls=require(_0xdf21('0xb'));var queues=require(_0xdf21('0xc'));var recordings=require(_0xdf21('0xd'));var members=require(_0xdf21('0xe'));var dials=require(_0xdf21('0xf'));var transfers=require(_0xdf21('0x10'));var core=require(_0xdf21('0x11'));ami['on'](_0xdf21('0x12'),core[_0xdf21('0x12')]);ami['on'](_0xdf21('0x13'),core[_0xdf21('0x13')]);ami['on'](_0xdf21('0x14'),core['fullybooted']);ami['on'](_0xdf21('0x15'),core['error']);ami['on']('close',core[_0xdf21('0x16')]);ami['on'](_0xdf21('0x17'),core[_0xdf21('0x17')]);ami['on']('devicestatechange',function(_0x3e26ac){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x1a'),_0x3e26ac[_0xdf21('0x1b')]),_0x3e26ac);members['devicestatechange'](_0x3e26ac);}catch(_0x1fb592){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x1a'),_0x3e26ac[_0xdf21('0x1b')]),_0x1fb592);}});ami['on'](_0xdf21('0x1c'),function(_0x1e8f72){try{utils[_0xdf21('0x18')](util['format'](_0xdf21('0x1d'),_0x1e8f72[_0xdf21('0x1e')]),_0x1e8f72);agents[_0xdf21('0x1c')](_0x1e8f72);}catch(_0x290669){utils[_0xdf21('0x15')](util[_0xdf21('0x19')]('[%s][index][agentcalled]',_0x1e8f72[_0xdf21('0x1e')]),_0x290669);}});ami['on'](_0xdf21('0x1f'),function(_0x590244){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x20'),_0x590244[_0xdf21('0x1e')]),_0x590244);agents[_0xdf21('0x1f')](_0x590244);}catch(_0xcbdf51){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x20'),_0x590244[_0xdf21('0x1e')]),_0xcbdf51);}});ami['on']('agentconnect',function(_0xca01f5){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x21'),_0xca01f5[_0xdf21('0x1e')]),_0xca01f5);agents[_0xdf21('0x22')](_0xca01f5);queues[_0xdf21('0x22')](_0xca01f5);}catch(_0x26e548){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x21'),_0xca01f5['uniqueid']),_0x26e548);}});ami['on'](_0xdf21('0x23'),function(_0x1b9ecb){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x24'),_0x1b9ecb[_0xdf21('0x1e')]),_0x1b9ecb);agents[_0xdf21('0x23')](_0x1b9ecb);queues['agentcomplete'](_0x1b9ecb);members[_0xdf21('0x23')](_0x1b9ecb);}catch(_0x2aaf3f){utils['error'](util['format'](_0xdf21('0x24'),_0x1b9ecb[_0xdf21('0x1e')]),_0x2aaf3f);}});ami['on'](_0xdf21('0x25'),function(_0x336bdf){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x26'),_0x336bdf['uniqueid']),_0x336bdf);agents[_0xdf21('0x25')](_0x336bdf);queues[_0xdf21('0x25')](_0x336bdf);}catch(_0x59f4bb){utils[_0xdf21('0x15')](util[_0xdf21('0x19')]('[%s][index][queuecallerabandon]',_0x336bdf['uniqueid']),_0x59f4bb);}});ami['on']('queuecallerjoin',function(_0x209a73){try{utils['debug'](util[_0xdf21('0x19')](_0xdf21('0x27'),_0x209a73[_0xdf21('0x1e')]),_0x209a73);queues[_0xdf21('0x28')](_0x209a73);recordings[_0xdf21('0x28')](_0x209a73);}catch(_0x1b2b62){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x27'),_0x209a73[_0xdf21('0x1e')]),_0x1b2b62);}});ami['on'](_0xdf21('0x29'),function(_0x3d1944){try{utils['debug'](util['format'](_0xdf21('0x2a'),_0x3d1944[_0xdf21('0x1e')]),_0x3d1944);queues[_0xdf21('0x29')](_0x3d1944);}catch(_0x404599){utils['error'](util[_0xdf21('0x19')](_0xdf21('0x2a'),_0x3d1944[_0xdf21('0x1e')]),_0x404599);}});ami['on']('musiconholdstart',function(_0x5d0bee){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')]('[%s][index][musiconholdstart]',_0x5d0bee['uniqueid']),_0x5d0bee);queues[_0xdf21('0x2b')](_0x5d0bee);calls[_0xdf21('0x2b')](_0x5d0bee);}catch(_0x56cbb0){utils['error'](util[_0xdf21('0x19')](_0xdf21('0x2c'),_0x5d0bee['uniqueid']),_0x56cbb0);}});ami['on']('musiconholdstop',function(_0x4e6d77){try{utils[_0xdf21('0x18')](util['format'](_0xdf21('0x2d'),_0x4e6d77[_0xdf21('0x1e')]),_0x4e6d77);queues[_0xdf21('0x2e')](_0x4e6d77);calls[_0xdf21('0x2e')](_0x4e6d77);}catch(_0x36b30c){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x2d'),_0x4e6d77[_0xdf21('0x1e')]),_0x36b30c);}});ami['on'](_0xdf21('0x2f'),function(_0x2d0368){try{utils['debug'](util[_0xdf21('0x19')](_0xdf21('0x30'),_0x2d0368[_0xdf21('0x1e')]),_0x2d0368);calls[_0xdf21('0x2f')](_0x2d0368);recordings[_0xdf21('0x2f')](_0x2d0368);}catch(_0x9c7761){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x30'),_0x2d0368[_0xdf21('0x1e')]),_0x9c7761);}});ami['on'](_0xdf21('0x31'),function(_0x48e00f){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')]('[%s][index][hangup]',_0x48e00f[_0xdf21('0x1e')]),_0x48e00f);calls['hangup'](_0x48e00f);recordings[_0xdf21('0x31')](_0x48e00f);dials[_0xdf21('0x31')](_0x48e00f);agents[_0xdf21('0x31')](_0x48e00f);queues[_0xdf21('0x31')](_0x48e00f);}catch(_0x2a0eae){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x32'),_0x48e00f[_0xdf21('0x1e')]),_0x2a0eae);}});ami['on'](_0xdf21('0x33'),function(_0x4b54bf){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x34'),_0x4b54bf[_0xdf21('0x1e')]),_0x4b54bf);members[_0xdf21('0x33')](_0x4b54bf);}catch(_0x35b703){utils['error'](util['format']('[%s][index][cdr]',_0x4b54bf[_0xdf21('0x1e')]),_0x35b703);}});ami['on'](_0xdf21('0x35'),function(_0xc199fb){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x36'),_0xc199fb['uniqueid']),_0xc199fb);queues[_0xdf21('0x35')](_0xc199fb);agents[_0xdf21('0x35')](_0xc199fb);transfers['blindtransfer'](_0xc199fb);}catch(_0x499e90){utils['error'](util[_0xdf21('0x19')](_0xdf21('0x36'),_0xc199fb['uniqueid']),_0x499e90);}});ami['on']('attendedtransfer',function(_0x5ad530){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')]('[%s][index][attendedtransfer]',_0x5ad530[_0xdf21('0x37')]),_0x5ad530);queues['attendedtransfer'](_0x5ad530);transfers[_0xdf21('0x38')](_0x5ad530);agents['attendedtransfer'](_0x5ad530);calls[_0xdf21('0x38')](_0x5ad530);}catch(_0x33b4d2){utils[_0xdf21('0x15')](util[_0xdf21('0x19')]('[%s][index][attendedtransfer]',_0x5ad530[_0xdf21('0x37')]),_0x33b4d2);}});ami['on'](_0xdf21('0x39'),function(_0x440778){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x3a'),_0x440778[_0xdf21('0x1e')]),_0x440778);queues[_0xdf21('0x39')](_0x440778);recordings['varset'](_0x440778);calls['varset'](_0x440778);dials[_0xdf21('0x39')](_0x440778);}catch(_0x4b7578){utils[_0xdf21('0x15')](util['format']('[%s][index][varset]',_0x440778[_0xdf21('0x1e')]),_0x4b7578);}});ami['on'](_0xdf21('0x3b'),function(_0x3d7eaa){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')]('[%s][index][newexten]',_0x3d7eaa['uniqueid']),_0x3d7eaa);calls[_0xdf21('0x3b')](_0x3d7eaa);recordings[_0xdf21('0x3b')](_0x3d7eaa);dials[_0xdf21('0x3b')](_0x3d7eaa);}catch(_0x11a93f){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x3c'),_0x3d7eaa[_0xdf21('0x1e')]),_0x11a93f);}});ami['on'](_0xdf21('0x3d'),function(_0x543787){try{utils[_0xdf21('0x18')](util['format']('[%s][index][newchannel]',_0x543787[_0xdf21('0x1e')]),_0x543787);calls[_0xdf21('0x3d')](_0x543787);recordings[_0xdf21('0x3d')](_0x543787);}catch(_0x5d8a59){utils['error'](util[_0xdf21('0x19')](_0xdf21('0x3e'),_0x543787[_0xdf21('0x1e')]),_0x5d8a59);}});ami['on'](_0xdf21('0x3f'),function(_0x4215c7){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x40'),_0x4215c7[_0xdf21('0x1e')]),_0x4215c7);dials[_0xdf21('0x3f')](_0x4215c7);}catch(_0x1f100e){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x41'),_0x4215c7[_0xdf21('0x1e')]),_0x1f100e);}});ami['on'](_0xdf21('0x42'),function(_0x17a9a4){try{utils[_0xdf21('0x18')](util[_0xdf21('0x19')](_0xdf21('0x43'),_0x17a9a4[_0xdf21('0x1e')]),_0x17a9a4);dials[_0xdf21('0x42')](_0x17a9a4);}catch(_0x1ea1ff){utils[_0xdf21('0x15')](util[_0xdf21('0x19')](_0xdf21('0x43'),_0x17a9a4[_0xdf21('0x1e')]),_0x1ea1ff);}});} \ No newline at end of file +var _0xea1c=['close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','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]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][cdr]','cdr','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','asterisk','port','password','keepConnected','xdr','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error'];(function(_0x4389d6,_0x58768d){var _0x3f279b=function(_0x1a4764){while(--_0x1a4764){_0x4389d6['push'](_0x4389d6['shift']());}};_0x3f279b(++_0x58768d);}(_0xea1c,0xeb));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};var AsteriskManager=require(_0xcea1('0x0'));var config=require(_0xcea1('0x1'));var utils=require('./utils');var util=require('util');var ami=new AsteriskManager(config[_0xcea1('0x2')][_0xcea1('0x3')],config[_0xcea1('0x2')]['ip'],config[_0xcea1('0x2')]['username'],config[_0xcea1('0x2')][_0xcea1('0x4')],!![]);ami[_0xcea1('0x5')]();if(config[_0xcea1('0x6')]&&config['xdr']['disabled']){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0xcea1('0x7'));var calls=require(_0xcea1('0x8'));var queues=require('./queues.controller');var recordings=require(_0xcea1('0x9'));var members=require(_0xcea1('0xa'));var dials=require(_0xcea1('0xb'));var transfers=require(_0xcea1('0xc'));var core=require('./core.controller');ami['on'](_0xcea1('0xd'),core[_0xcea1('0xd')]);ami['on'](_0xcea1('0xe'),core['shutdown']);ami['on'](_0xcea1('0xf'),core['fullybooted']);ami['on'](_0xcea1('0x10'),core[_0xcea1('0x10')]);ami['on']('close',core[_0xcea1('0x11')]);ami['on'](_0xcea1('0x12'),core[_0xcea1('0x12')]);ami['on'](_0xcea1('0x13'),function(_0x51fcd1){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')](_0xcea1('0x16'),_0x51fcd1[_0xcea1('0x17')]),_0x51fcd1);members['devicestatechange'](_0x51fcd1);}catch(_0x20a503){utils[_0xcea1('0x10')](util[_0xcea1('0x15')]('[%s][index][devicestatechange]',_0x51fcd1[_0xcea1('0x17')]),_0x20a503);}});ami['on'](_0xcea1('0x18'),function(_0xc5d522){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')]('[%s][index][agentcalled]',_0xc5d522[_0xcea1('0x19')]),_0xc5d522);agents['agentcalled'](_0xc5d522);}catch(_0x25df87){utils[_0xcea1('0x10')](util[_0xcea1('0x15')]('[%s][index][agentcalled]',_0xc5d522[_0xcea1('0x19')]),_0x25df87);}});ami['on'](_0xcea1('0x1a'),function(_0x2373e3){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')](_0xcea1('0x1b'),_0x2373e3[_0xcea1('0x19')]),_0x2373e3);agents[_0xcea1('0x1a')](_0x2373e3);}catch(_0x58fa87){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x1b'),_0x2373e3[_0xcea1('0x19')]),_0x58fa87);}});ami['on'](_0xcea1('0x1c'),function(_0x41e2d9){try{utils['debug'](util['format'](_0xcea1('0x1d'),_0x41e2d9[_0xcea1('0x19')]),_0x41e2d9);agents[_0xcea1('0x1c')](_0x41e2d9);queues[_0xcea1('0x1c')](_0x41e2d9);}catch(_0x19b606){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x1d'),_0x41e2d9[_0xcea1('0x19')]),_0x19b606);}});ami['on']('agentcomplete',function(_0x20522e){try{utils['debug'](util[_0xcea1('0x15')](_0xcea1('0x1e'),_0x20522e[_0xcea1('0x19')]),_0x20522e);agents[_0xcea1('0x1f')](_0x20522e);queues['agentcomplete'](_0x20522e);members['agentcomplete'](_0x20522e);}catch(_0x496bf8){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x1e'),_0x20522e[_0xcea1('0x19')]),_0x496bf8);}});ami['on'](_0xcea1('0x20'),function(_0x12ab6c){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')](_0xcea1('0x21'),_0x12ab6c['uniqueid']),_0x12ab6c);agents[_0xcea1('0x20')](_0x12ab6c);queues[_0xcea1('0x20')](_0x12ab6c);}catch(_0x594d64){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x21'),_0x12ab6c[_0xcea1('0x19')]),_0x594d64);}});ami['on'](_0xcea1('0x22'),function(_0x510e95){try{utils['debug'](util['format'](_0xcea1('0x23'),_0x510e95[_0xcea1('0x19')]),_0x510e95);queues[_0xcea1('0x22')](_0x510e95);recordings[_0xcea1('0x22')](_0x510e95);}catch(_0x268978){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x23'),_0x510e95[_0xcea1('0x19')]),_0x268978);}});ami['on'](_0xcea1('0x24'),function(_0x56678f){try{utils['debug'](util['format'](_0xcea1('0x25'),_0x56678f[_0xcea1('0x19')]),_0x56678f);queues[_0xcea1('0x24')](_0x56678f);}catch(_0x2da2f2){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x25'),_0x56678f[_0xcea1('0x19')]),_0x2da2f2);}});ami['on'](_0xcea1('0x26'),function(_0x164782){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')](_0xcea1('0x27'),_0x164782[_0xcea1('0x19')]),_0x164782);queues['musiconholdstart'](_0x164782);calls['musiconholdstart'](_0x164782);}catch(_0x45c45e){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x27'),_0x164782['uniqueid']),_0x45c45e);}});ami['on'](_0xcea1('0x28'),function(_0x255044){try{utils['debug'](util[_0xcea1('0x15')]('[%s][index][musiconholdstop]',_0x255044[_0xcea1('0x19')]),_0x255044);queues[_0xcea1('0x28')](_0x255044);calls['musiconholdstop'](_0x255044);}catch(_0x530080){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x29'),_0x255044[_0xcea1('0x19')]),_0x530080);}});ami['on'](_0xcea1('0x2a'),function(_0x291ef2){try{utils[_0xcea1('0x14')](util['format'](_0xcea1('0x2b'),_0x291ef2[_0xcea1('0x19')]),_0x291ef2);calls[_0xcea1('0x2a')](_0x291ef2);recordings[_0xcea1('0x2a')](_0x291ef2);}catch(_0x464c7c){utils[_0xcea1('0x10')](util[_0xcea1('0x15')]('[%s][index][newstate]',_0x291ef2[_0xcea1('0x19')]),_0x464c7c);}});ami['on'](_0xcea1('0x2c'),function(_0xa0db3){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')]('[%s][index][hangup]',_0xa0db3['uniqueid']),_0xa0db3);calls['hangup'](_0xa0db3);recordings['hangup'](_0xa0db3);dials[_0xcea1('0x2c')](_0xa0db3);agents[_0xcea1('0x2c')](_0xa0db3);queues[_0xcea1('0x2c')](_0xa0db3);}catch(_0x5102e7){utils['error'](util[_0xcea1('0x15')]('[%s][index][hangup]',_0xa0db3['uniqueid']),_0x5102e7);}});ami['on']('cdr',function(_0x145819){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')](_0xcea1('0x2d'),_0x145819['uniqueid']),_0x145819);members[_0xcea1('0x2e')](_0x145819);}catch(_0x24cb00){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x2d'),_0x145819[_0xcea1('0x19')]),_0x24cb00);}});ami['on']('blindtransfer',function(_0x35cdb7){try{utils['debug'](util[_0xcea1('0x15')](_0xcea1('0x2f'),_0x35cdb7['uniqueid']),_0x35cdb7);queues['blindtransfer'](_0x35cdb7);agents['blindtransfer'](_0x35cdb7);transfers[_0xcea1('0x30')](_0x35cdb7);}catch(_0x486d0f){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x2f'),_0x35cdb7[_0xcea1('0x19')]),_0x486d0f);}});ami['on']('attendedtransfer',function(_0x101dbb){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')](_0xcea1('0x31'),_0x101dbb['origtransfereruniqueid']),_0x101dbb);queues[_0xcea1('0x32')](_0x101dbb);transfers[_0xcea1('0x32')](_0x101dbb);agents['attendedtransfer'](_0x101dbb);calls[_0xcea1('0x32')](_0x101dbb);}catch(_0x401142){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x31'),_0x101dbb[_0xcea1('0x33')]),_0x401142);}});ami['on'](_0xcea1('0x34'),function(_0x251e67){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')]('[%s][index][varset]',_0x251e67['uniqueid']),_0x251e67);queues['varset'](_0x251e67);recordings[_0xcea1('0x34')](_0x251e67);calls[_0xcea1('0x34')](_0x251e67);dials[_0xcea1('0x34')](_0x251e67);}catch(_0x50209f){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x35'),_0x251e67[_0xcea1('0x19')]),_0x50209f);}});ami['on']('newexten',function(_0x36c410){try{utils['debug'](util[_0xcea1('0x15')](_0xcea1('0x36'),_0x36c410[_0xcea1('0x19')]),_0x36c410);calls['newexten'](_0x36c410);recordings[_0xcea1('0x37')](_0x36c410);dials[_0xcea1('0x37')](_0x36c410);}catch(_0x24cba7){utils[_0xcea1('0x10')](util['format'](_0xcea1('0x36'),_0x36c410[_0xcea1('0x19')]),_0x24cba7);}});ami['on'](_0xcea1('0x38'),function(_0x47fbae){try{utils[_0xcea1('0x14')](util[_0xcea1('0x15')]('[%s][index][newchannel]',_0x47fbae['uniqueid']),_0x47fbae);calls['newchannel'](_0x47fbae);recordings[_0xcea1('0x38')](_0x47fbae);}catch(_0x62e63f){utils[_0xcea1('0x10')](util[_0xcea1('0x15')](_0xcea1('0x39'),_0x47fbae[_0xcea1('0x19')]),_0x62e63f);}});ami['on'](_0xcea1('0x3a'),function(_0x58d4e7){try{utils[_0xcea1('0x14')](util['format'](_0xcea1('0x3b'),_0x58d4e7[_0xcea1('0x19')]),_0x58d4e7);dials['dialbegin'](_0x58d4e7);}catch(_0x35d5ba){utils['error'](util[_0xcea1('0x15')](_0xcea1('0x3c'),_0x58d4e7[_0xcea1('0x19')]),_0x35d5ba);}});ami['on']('dialend',function(_0x4bedb7){try{utils['debug'](util[_0xcea1('0x15')](_0xcea1('0x3d'),_0x4bedb7['uniqueid']),_0x4bedb7);dials[_0xcea1('0x3e')](_0x4bedb7);}catch(_0x35bfbe){utils[_0xcea1('0x10')](util[_0xcea1('0x15')]('[%s][index][dialend]',_0x4bedb7['uniqueid']),_0x35bfbe);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index dca75f0..98fdc9b 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 _0x8509=['getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','catch','error','format','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','split','[%s][members][cdr]','lodash','util','./utils','Queue:','info','interface','channel','data2','membername','type'];(function(_0x211867,_0x362d2d){var _0xbc47c0=function(_0x19c01d){while(--_0x19c01d){_0x211867['push'](_0x211867['shift']());}};_0xbc47c0(++_0x362d2d);}(_0x8509,0x1c1));var _0x9850=function(_0x2a0c21,_0x51ad5e){_0x2a0c21=_0x2a0c21-0x0;var _0x28f2ff=_0x8509[_0x2a0c21];return _0x28f2ff;};'use strict';var _=require(_0x9850('0x0'));var util=require(_0x9850('0x1'));var utils=require(_0x9850('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x9850('0x3')];function writeDB(_0x35e04e){utils[_0x9850('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x35e04e['uniqueid'],_0x35e04e[_0x9850('0x5')],_0x35e04e[_0x9850('0x6')],_0x35e04e[_0x9850('0x7')],_0x35e04e[_0x9850('0x8')],_0x35e04e[_0x9850('0x9')]));if(_0x35e04e[_0x9850('0x5')]){utils[_0x9850('0xa')](_0x35e04e[_0x9850('0x5')])[_0x9850('0xb')](function(_0x4a0c4a){if(_0x4a0c4a){_0x35e04e[_0x9850('0x8')]=_0x4a0c4a['name'];_0x35e04e['internal']=_0x4a0c4a[_0x9850('0xc')];utils[_0x9850('0xd')](_0x9850('0xe'),_0x35e04e);}else{utils[_0x9850('0xf')](_0x35e04e['interface']['split']('/')[0x1])['then'](function(_0x30a40f){if(_0x30a40f){_0x35e04e[_0x9850('0x8')]=_0x30a40f['name'];_0x35e04e[_0x9850('0xc')]=_0x30a40f['internal'];utils[_0x9850('0xd')](_0x9850('0xe'),_0x35e04e);}});}})[_0x9850('0x10')](function(_0x2478b7){utils[_0x9850('0x11')](util[_0x9850('0x12')](_0x9850('0x13'),_0x35e04e[_0x9850('0x14')]),_0x2478b7);});}delete members[_0x35e04e[_0x9850('0x5')]];}function startsWith(_0x3941c0,_0x3d4933){return _[_0x9850('0x15')](_0x3941c0,function(_0x1e0fc9){return _[_0x9850('0x16')](_0x3d4933,_0x1e0fc9);});}exports[_0x9850('0x17')]=function(_0x65807a){try{utils[_0x9850('0x18')](util[_0x9850('0x12')](_0x9850('0x19'),members[_0x65807a[_0x9850('0x1a')]]?members[_0x65807a[_0x9850('0x1a')]][_0x9850('0x14')]:_0x65807a['device']),_0x65807a);utils[_0x9850('0x4')](util[_0x9850('0x12')](_0x9850('0x1b'),members[_0x65807a[_0x9850('0x1a')]]?members[_0x65807a[_0x9850('0x1a')]][_0x9850('0x14')]:_0x65807a[_0x9850('0x1a')],_0x65807a['state'],_0x65807a['device']));switch(_0x65807a[_0x9850('0x1c')]){case _0x9850('0x1d'):case _0x9850('0x1e'):if(!startsWith(exclude,_0x65807a[_0x9850('0x1a')])){members[_0x65807a[_0x9850('0x1a')]]={'channel':_0x9850('0x1f'),'interface':_0x65807a[_0x9850('0x1a')],'type':'TALKING','enterAt':utils[_0x9850('0x20')](),'role':_0x9850('0x21')};}break;case _0x9850('0x22'):if(!_[_0x9850('0x23')](members[_0x65807a[_0x9850('0x1a')]])){members[_0x65807a[_0x9850('0x1a')]][_0x9850('0x24')]=utils['now']();members[_0x65807a[_0x9850('0x1a')]]['duration']=utils[_0x9850('0x25')](members[_0x65807a[_0x9850('0x1a')]]['exitAt'],members[_0x65807a[_0x9850('0x1a')]][_0x9850('0x26')]);if(members[_0x65807a[_0x9850('0x1a')]][_0x9850('0x14')]){writeDB(members[_0x65807a[_0x9850('0x1a')]]);}}break;default:break;}}catch(_0x50c71a){utils[_0x9850('0x11')](util[_0x9850('0x12')](_0x9850('0x19'),members[_0x65807a[_0x9850('0x1a')]]?members[_0x65807a[_0x9850('0x1a')]][_0x9850('0x14')]:_0x65807a[_0x9850('0x1a')]),_0x50c71a);}};exports['agentcomplete']=function(_0x4060f5){try{if(!_[_0x9850('0x23')](members[_0x4060f5[_0x9850('0x5')]])){utils[_0x9850('0x18')](util[_0x9850('0x12')](_0x9850('0x27'),_0x4060f5[_0x9850('0x14')]),_0x4060f5);utils[_0x9850('0x4')](util['format'](_0x9850('0x28'),_0x4060f5[_0x9850('0x14')],_0x4060f5['interface'],_0x4060f5[_0x9850('0x29')]));members[_0x4060f5[_0x9850('0x5')]]=_[_0x9850('0x2a')](members[_0x4060f5[_0x9850('0x5')]],{'data4':_0x4060f5[_0x9850('0x29')],'uniqueid':_0x4060f5[_0x9850('0x14')]});}}catch(_0x1e7bd3){utils[_0x9850('0x11')](util['format'](_0x9850('0x27'),_0x4060f5[_0x9850('0x14')]),_0x1e7bd3);}};exports[_0x9850('0x2b')]=function(_0x55b45e){try{utils[_0x9850('0x18')](util[_0x9850('0x12')]('[%s][members][cdr]',_0x55b45e['uniqueid']),_0x55b45e);if(_0x55b45e[_0x9850('0x6')]){var _0x24b8c3=_0x55b45e[_0x9850('0x6')]['split']('-')[0x0];if(!_[_0x9850('0x23')](members[_0x24b8c3])){members[_0x24b8c3]=_[_0x9850('0x2a')](members[_0x24b8c3],{'data1':members[_0x24b8c3][_0x9850('0x2c')]||_0x55b45e[_0x9850('0x9')],'data2':members[_0x24b8c3][_0x9850('0x7')]||_0x55b45e['source'],'data3':members[_0x24b8c3][_0x9850('0x2d')]||_0x55b45e[_0x9850('0x2e')],'uniqueid':members[_0x24b8c3][_0x9850('0x14')]||_0x55b45e[_0x9850('0x14')]});utils[_0x9850('0x4')](util[_0x9850('0x12')](_0x9850('0x2f'),_0x55b45e[_0x9850('0x14')],members[_0x24b8c3][_0x9850('0x2c')],members[_0x24b8c3][_0x9850('0x7')],members[_0x24b8c3]['data3']));if(members[_0x24b8c3][_0x9850('0x24')]){writeDB(members[_0x24b8c3]);}}}if(_0x55b45e[_0x9850('0x30')]){var _0x354f79=_0x55b45e[_0x9850('0x30')][_0x9850('0x31')]('-')[0x0];if(!_['isNil'](members[_0x354f79])){members[_0x354f79]=_['assign'](members[_0x354f79],{'data1':members[_0x354f79][_0x9850('0x2c')]||_0x55b45e['type'],'data2':members[_0x354f79][_0x9850('0x7')]||_0x55b45e['source'],'data3':members[_0x354f79][_0x9850('0x2d')]||_0x55b45e[_0x9850('0x2e')],'uniqueid':members[_0x354f79][_0x9850('0x14')]||_0x55b45e[_0x9850('0x14')]});utils[_0x9850('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x55b45e[_0x9850('0x14')],members[_0x354f79][_0x9850('0x2c')],members[_0x354f79]['data2'],members[_0x354f79][_0x9850('0x2d')]));if(members[_0x354f79][_0x9850('0x24')]){writeDB(members[_0x354f79]);}}}}catch(_0x3cfbc5){utils[_0x9850('0x11')](util[_0x9850('0x12')](_0x9850('0x32'),_0x55b45e[_0x9850('0x14')]),_0x3cfbc5);}}; \ No newline at end of file +var _0x7539=['lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','name','internal','request','CreateMemberReport','getUserByName','split','then','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','error','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','type'];(function(_0x235356,_0x523789){var _0x1ecede=function(_0x14ad63){while(--_0x14ad63){_0x235356['push'](_0x235356['shift']());}};_0x1ecede(++_0x523789);}(_0x7539,0x1cb));var _0x9753=function(_0x5bf8be,_0x1a37ea){_0x5bf8be=_0x5bf8be-0x0;var _0x5c74d1=_0x7539[_0x5bf8be];return _0x5c74d1;};'use strict';var _=require(_0x9753('0x0'));var util=require(_0x9753('0x1'));var utils=require(_0x9753('0x2'));var members={};var exclude=[_0x9753('0x3'),'Queue:'];function writeDB(_0x356e7f){utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x6'),_0x356e7f[_0x9753('0x7')],_0x356e7f[_0x9753('0x8')],_0x356e7f['channel'],_0x356e7f[_0x9753('0x9')],_0x356e7f[_0x9753('0xa')],_0x356e7f['type']));if(_0x356e7f[_0x9753('0x8')]){utils['getUserByInterface'](_0x356e7f['interface'])['then'](function(_0x18e958){if(_0x18e958){_0x356e7f['membername']=_0x18e958[_0x9753('0xb')];_0x356e7f['internal']=_0x18e958[_0x9753('0xc')];utils[_0x9753('0xd')](_0x9753('0xe'),_0x356e7f);}else{utils[_0x9753('0xf')](_0x356e7f[_0x9753('0x8')][_0x9753('0x10')]('/')[0x1])[_0x9753('0x11')](function(_0x58cd90){if(_0x58cd90){_0x356e7f[_0x9753('0xa')]=_0x58cd90[_0x9753('0xb')];_0x356e7f[_0x9753('0xc')]=_0x58cd90['internal'];utils[_0x9753('0xd')](_0x9753('0xe'),_0x356e7f);}});}})['catch'](function(_0x4a7355){utils['error'](util['format']('[%s][members][writeDB]',_0x356e7f[_0x9753('0x7')]),_0x4a7355);});}delete members[_0x356e7f[_0x9753('0x8')]];}function startsWith(_0x41a2f8,_0x33d341){return _['some'](_0x41a2f8,function(_0x3425f6){return _[_0x9753('0x12')](_0x33d341,_0x3425f6);});}exports[_0x9753('0x13')]=function(_0x200ae8){try{utils['debug'](util[_0x9753('0x5')](_0x9753('0x14'),members[_0x200ae8['device']]?members[_0x200ae8[_0x9753('0x15')]][_0x9753('0x7')]:_0x200ae8[_0x9753('0x15')]),_0x200ae8);utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x16'),members[_0x200ae8[_0x9753('0x15')]]?members[_0x200ae8[_0x9753('0x15')]][_0x9753('0x7')]:_0x200ae8[_0x9753('0x15')],_0x200ae8[_0x9753('0x17')],_0x200ae8[_0x9753('0x15')]));switch(_0x200ae8[_0x9753('0x17')]){case _0x9753('0x18'):case'BUSY':if(!startsWith(exclude,_0x200ae8[_0x9753('0x15')])){members[_0x200ae8['device']]={'channel':_0x9753('0x19'),'interface':_0x200ae8[_0x9753('0x15')],'type':_0x9753('0x1a'),'enterAt':utils[_0x9753('0x1b')](),'role':_0x9753('0x1c')};}break;case _0x9753('0x1d'):if(!_[_0x9753('0x1e')](members[_0x200ae8[_0x9753('0x15')]])){members[_0x200ae8['device']][_0x9753('0x1f')]=utils['now']();members[_0x200ae8[_0x9753('0x15')]][_0x9753('0x20')]=utils[_0x9753('0x21')](members[_0x200ae8['device']][_0x9753('0x1f')],members[_0x200ae8['device']][_0x9753('0x22')]);if(members[_0x200ae8[_0x9753('0x15')]][_0x9753('0x7')]){writeDB(members[_0x200ae8[_0x9753('0x15')]]);}}break;default:break;}}catch(_0x5aa6af){utils[_0x9753('0x23')](util['format'](_0x9753('0x14'),members[_0x200ae8[_0x9753('0x15')]]?members[_0x200ae8['device']][_0x9753('0x7')]:_0x200ae8[_0x9753('0x15')]),_0x5aa6af);}};exports[_0x9753('0x24')]=function(_0x3ab91a){try{if(!_[_0x9753('0x1e')](members[_0x3ab91a['interface']])){utils['debug'](util[_0x9753('0x5')](_0x9753('0x25'),_0x3ab91a[_0x9753('0x7')]),_0x3ab91a);utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x26'),_0x3ab91a['uniqueid'],_0x3ab91a['interface'],_0x3ab91a[_0x9753('0x27')]));members[_0x3ab91a[_0x9753('0x8')]]=_[_0x9753('0x28')](members[_0x3ab91a[_0x9753('0x8')]],{'data4':_0x3ab91a[_0x9753('0x27')],'uniqueid':_0x3ab91a['uniqueid']});}}catch(_0x1e1d71){utils[_0x9753('0x23')](util[_0x9753('0x5')](_0x9753('0x25'),_0x3ab91a[_0x9753('0x7')]),_0x1e1d71);}};exports[_0x9753('0x29')]=function(_0x5b25ac){try{utils['debug'](util[_0x9753('0x5')](_0x9753('0x2a'),_0x5b25ac[_0x9753('0x7')]),_0x5b25ac);if(_0x5b25ac[_0x9753('0x2b')]){var _0x1c4a25=_0x5b25ac['channel'][_0x9753('0x10')]('-')[0x0];if(!_[_0x9753('0x1e')](members[_0x1c4a25])){members[_0x1c4a25]=_['assign'](members[_0x1c4a25],{'data1':members[_0x1c4a25]['data1']||_0x5b25ac['type'],'data2':members[_0x1c4a25][_0x9753('0x9')]||_0x5b25ac[_0x9753('0x2c')],'data3':members[_0x1c4a25][_0x9753('0x2d')]||_0x5b25ac[_0x9753('0x2e')],'uniqueid':members[_0x1c4a25][_0x9753('0x7')]||_0x5b25ac['uniqueid']});utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x2f'),_0x5b25ac['uniqueid'],members[_0x1c4a25][_0x9753('0x30')],members[_0x1c4a25]['data2'],members[_0x1c4a25][_0x9753('0x2d')]));if(members[_0x1c4a25][_0x9753('0x1f')]){writeDB(members[_0x1c4a25]);}}}if(_0x5b25ac[_0x9753('0x31')]){var _0x287268=_0x5b25ac['destinationchannel'][_0x9753('0x10')]('-')[0x0];if(!_['isNil'](members[_0x287268])){members[_0x287268]=_[_0x9753('0x28')](members[_0x287268],{'data1':members[_0x287268][_0x9753('0x30')]||_0x5b25ac[_0x9753('0x32')],'data2':members[_0x287268][_0x9753('0x9')]||_0x5b25ac[_0x9753('0x2c')],'data3':members[_0x287268][_0x9753('0x2d')]||_0x5b25ac[_0x9753('0x2e')],'uniqueid':members[_0x287268][_0x9753('0x7')]||_0x5b25ac['uniqueid']});utils[_0x9753('0x4')](util[_0x9753('0x5')](_0x9753('0x2f'),_0x5b25ac[_0x9753('0x7')],members[_0x287268]['data1'],members[_0x287268][_0x9753('0x9')],members[_0x287268][_0x9753('0x2d')]));if(members[_0x287268][_0x9753('0x1f')]){writeDB(members[_0x287268]);}}}}catch(_0x4b2c25){utils['error'](util[_0x9753('0x5')](_0x9753('0x2a'),_0x5b25ac[_0x9753('0x7')]),_0x4b2c25);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 407b995..158cc9b 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 _0x6df9=['origtransfererexten','ATTENDED','transferexten','transfereelinkedid','clone','transfertargetuniqueid','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','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','request','transfereduniqueid','debug','format','[%s][queues][queuecallerjoin]','uniqueid','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfereruniqueid'];(function(_0xc4ab4,_0x36aa19){var _0x12e925=function(_0x490cda){while(--_0x490cda){_0xc4ab4['push'](_0xc4ab4['shift']());}};_0x12e925(++_0x36aa19);}(_0x6df9,0x84));var _0x96df=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6df9[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x96df('0x0'));var util=require(_0x96df('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x2fcbd1){utils['info'](util['format'](_0x96df('0x2'),_0x2fcbd1['uniqueid'],_0x2fcbd1[_0x96df('0x3')],_0x2fcbd1['queue'],_0x2fcbd1[_0x96df('0x4')],_0x2fcbd1['calleridnum'],_0x2fcbd1[_0x96df('0x5')],_0x2fcbd1[_0x96df('0x6')]));if(_0x2fcbd1['queue']){utils[_0x96df('0x7')](_0x2fcbd1[_0x96df('0x8')])[_0x96df('0x9')](function(_0x6efa54){if(_0x6efa54){_0x2fcbd1['type']=_0x6efa54[_0x96df('0xa')];}utils[_0x96df('0xb')]('CreateVoiceQueueReport',_0x2fcbd1);});}else{utils[_0x96df('0xb')]('CreateVoiceQueueReport',_0x2fcbd1);}if(_0x2fcbd1[_0x96df('0xc')]){delete queues[_0x2fcbd1['transfereduniqueid']];}else{delete queues[_0x2fcbd1['uniqueid']];}}exports['queuecallerjoin']=function(_0x36ab65){try{utils[_0x96df('0xd')](util[_0x96df('0xe')](_0x96df('0xf'),_0x36ab65[_0x96df('0x10')]),_0x36ab65);utils[_0x96df('0x11')](util['format'](_0x96df('0x12'),_0x36ab65[_0x96df('0x10')],_0x36ab65[_0x96df('0x8')],_0x36ab65[_0x96df('0x13')]));queues[_0x36ab65[_0x96df('0x10')]]=_[_0x96df('0x14')](_0x36ab65,{'originalposition':_0x36ab65['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5c96a6){utils[_0x96df('0x15')](util[_0x96df('0xe')](_0x96df('0xf'),_0x36ab65[_0x96df('0x10')]),_0x5c96a6);}};exports[_0x96df('0x16')]=function(_0x1212c1){try{if(!_[_0x96df('0x17')](queues[_0x1212c1[_0x96df('0x10')]])){utils[_0x96df('0xd')](util[_0x96df('0xe')](_0x96df('0x18'),_0x1212c1[_0x96df('0x10')]),_0x1212c1);if(queues[_0x1212c1[_0x96df('0x10')]]['queuecallerleaveAt']){if(!queues[_0x1212c1[_0x96df('0x10')]][_0x96df('0x19')]&&!queues[_0x1212c1[_0x96df('0x10')]]['queuecallerexit']){queues[_0x1212c1[_0x96df('0x10')]][_0x96df('0x1a')]=!![];queues[_0x1212c1[_0x96df('0x10')]][_0x96df('0x1b')]=utils[_0x96df('0x1c')]();queues[_0x1212c1['uniqueid']][_0x96df('0x6')]=_0x96df('0x1d');}utils[_0x96df('0x11')](util[_0x96df('0xe')](_0x96df('0x1e'),_0x1212c1[_0x96df('0x10')],queues[_0x1212c1['uniqueid']]['name'],queues[_0x1212c1[_0x96df('0x10')]][_0x96df('0x6')]));writeDB(queues[_0x1212c1[_0x96df('0x10')]]);}else if(queues[_0x1212c1['uniqueid']][_0x96df('0xc')]){utils[_0x96df('0x11')](util[_0x96df('0xe')](_0x96df('0x1f'),_0x1212c1[_0x96df('0x10')],queues[_0x1212c1[_0x96df('0x10')]][_0x96df('0x20')],queues[_0x1212c1[_0x96df('0x10')]][_0x96df('0xc')]));queues[queues[_0x1212c1[_0x96df('0x10')]]['transfereduniqueid']]=queues[_0x1212c1['uniqueid']];queues[queues[_0x1212c1['uniqueid']][_0x96df('0xc')]][_0x96df('0x21')]=0x2;delete queues[_0x1212c1['uniqueid']];}}}catch(_0x1cee9c){utils[_0x96df('0x15')](util[_0x96df('0xe')](_0x96df('0x18'),_0x1212c1[_0x96df('0x10')]),_0x1cee9c);}};exports[_0x96df('0x22')]=function(_0xa98d69){try{utils[_0x96df('0xd')](util[_0x96df('0xe')](_0x96df('0x23'),_0xa98d69[_0x96df('0x10')]),_0xa98d69);if(!_[_0x96df('0x17')](_0xa98d69[_0x96df('0x24')][_0x96df('0x25')])&&_0xa98d69[_0x96df('0x26')][_0x96df('0x27')]()!==_0x96df('0x28')){if(!_[_0x96df('0x17')](queues[_0xa98d69[_0x96df('0x10')]])){queues[_0xa98d69[_0x96df('0x10')]][_0x96df('0x19')]=![];queues[_0xa98d69['uniqueid']][_0x96df('0x29')]=null;queues[_0xa98d69[_0x96df('0x10')]]['queuecallerexit']=!![];queues[_0xa98d69['uniqueid']][_0x96df('0x2a')]=utils['now']();queues[_0xa98d69[_0x96df('0x10')]][_0x96df('0x6')]=_0xa98d69[_0x96df('0x26')][_0x96df('0x27')]();utils[_0x96df('0x11')](util[_0x96df('0xe')](_0x96df('0x2b'),_0xa98d69[_0x96df('0x10')],queues[_0xa98d69['uniqueid']][_0x96df('0x20')],_0xa98d69[_0x96df('0x26')],queues[_0xa98d69[_0x96df('0x10')]][_0x96df('0x6')]));writeDB(queues[_0xa98d69[_0x96df('0x10')]]);}}else if(!_[_0x96df('0x17')](_0xa98d69[_0x96df('0x24')][_0x96df('0x2c')])){if(!_[_0x96df('0x17')](queues[_0xa98d69['uniqueid']])&&!queues[_0xa98d69[_0x96df('0x10')]][_0x96df('0x19')]){queues[_0xa98d69[_0x96df('0x10')]][_0x96df('0x19')]=![];queues[_0xa98d69[_0x96df('0x10')]][_0x96df('0x29')]=null;queues[_0xa98d69['uniqueid']][_0x96df('0x2d')]=!![];queues[_0xa98d69[_0x96df('0x10')]][_0x96df('0x2a')]=utils[_0x96df('0x1c')]();queues[_0xa98d69[_0x96df('0x10')]][_0x96df('0x6')]='EXITWITHKEY';utils[_0x96df('0x11')](util['format'](_0x96df('0x2e'),_0xa98d69['uniqueid'],queues[_0xa98d69[_0x96df('0x10')]][_0x96df('0x20')],_0xa98d69[_0x96df('0x26')],queues[_0xa98d69['uniqueid']]['queuecallerexitreason']));}}}catch(_0x13e071){utils['error'](util[_0x96df('0xe')](_0x96df('0x23'),_0xa98d69[_0x96df('0x10')]),_0x13e071);}};exports[_0x96df('0x19')]=function(_0x1bd65d){try{if(!_['isNil'](queues[_0x1bd65d['uniqueid']])){utils['debug'](util[_0x96df('0xe')]('[%s][queues][queuecallerabandon]',_0x1bd65d[_0x96df('0x10')]),_0x1bd65d);queues[_0x1bd65d[_0x96df('0x10')]]['queuecallerexit']=![];queues[_0x1bd65d[_0x96df('0x10')]][_0x96df('0x2a')]=null;queues[_0x1bd65d[_0x96df('0x10')]][_0x96df('0x19')]=!![];queues[_0x1bd65d[_0x96df('0x10')]]['queuecallerabandonAt']=utils[_0x96df('0x1c')]();queues[_0x1bd65d[_0x96df('0x10')]][_0x96df('0x6')]=_0x96df('0x2f');utils[_0x96df('0x11')](util[_0x96df('0xe')](_0x96df('0x30'),_0x1bd65d['uniqueid'],queues[_0x1bd65d['uniqueid']][_0x96df('0x20')],queues[_0x1bd65d[_0x96df('0x10')]]['queuecallerexitreason']));}}catch(_0x1f100d){utils[_0x96df('0x15')](util[_0x96df('0xe')](_0x96df('0x31'),_0x1bd65d[_0x96df('0x10')]),_0x1f100d);}};exports[_0x96df('0x32')]=function(_0x14b456){try{if(!_[_0x96df('0x17')](queues[_0x14b456['uniqueid']])){utils[_0x96df('0xd')](util[_0x96df('0xe')](_0x96df('0x33'),_0x14b456[_0x96df('0x10')]),_0x14b456);utils[_0x96df('0x11')](util['format'](_0x96df('0x34'),_0x14b456[_0x96df('0x10')],queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x20')],_0x14b456[_0x96df('0x35')],_0x14b456['connectedlinename']));queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x32')]=!![];queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x36')]=utils[_0x96df('0x1c')]();queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x37')]=utils[_0x96df('0x38')](queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x36')],queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x39')]);queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x13')]=_0x14b456[_0x96df('0x13')];queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x3a')]=_0x14b456[_0x96df('0x3a')];queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x35')]=_0x14b456[_0x96df('0x35')];queues[_0x14b456[_0x96df('0x10')]][_0x96df('0x3b')]=_0x14b456[_0x96df('0x3b')];}}catch(_0x33f1d3){utils[_0x96df('0x15')](util[_0x96df('0xe')](_0x96df('0x33'),_0x14b456[_0x96df('0x10')]),_0x33f1d3);}};exports[_0x96df('0x3c')]=function(_0x17c55f){try{if(!_['isNil'](queues[_0x17c55f['uniqueid']])){utils[_0x96df('0xd')](util[_0x96df('0xe')](_0x96df('0x3d'),_0x17c55f[_0x96df('0x10')]),_0x17c55f);utils[_0x96df('0x11')](util[_0x96df('0xe')](_0x96df('0x3e'),_0x17c55f['uniqueid'],queues[_0x17c55f[_0x96df('0x10')]]['name'],_0x17c55f[_0x96df('0x3f')],_0x17c55f[_0x96df('0x40')]));queues[_0x17c55f[_0x96df('0x10')]]['queuecallerabandon']=![];queues[_0x17c55f['uniqueid']][_0x96df('0x19')]=![];queues[_0x17c55f[_0x96df('0x10')]][_0x96df('0x29')]=null;queues[_0x17c55f[_0x96df('0x10')]][_0x96df('0x2d')]=![];queues[_0x17c55f['uniqueid']]['queuecallerexitreason']=null;queues[_0x17c55f[_0x96df('0x10')]]['queuecallerexitAt']=null;queues[_0x17c55f[_0x96df('0x10')]][_0x96df('0x41')]=!![];queues[_0x17c55f[_0x96df('0x10')]][_0x96df('0x5')]=_0x17c55f[_0x96df('0x40')];queues[_0x17c55f[_0x96df('0x10')]][_0x96df('0x4')]=_0x17c55f[_0x96df('0x3f')];}}catch(_0x5e7474){utils['error'](util['format'](_0x96df('0x3d'),_0x17c55f[_0x96df('0x10')]),_0x5e7474);}};exports[_0x96df('0x42')]=function(_0x1fde4e){try{if(!_[_0x96df('0x17')](queues[_0x1fde4e[_0x96df('0x10')]])){if(queues[_0x1fde4e[_0x96df('0x10')]]['queuecallerleaveAt']){utils[_0x96df('0xd')](util[_0x96df('0xe')](_0x96df('0x43'),_0x1fde4e[_0x96df('0x10')]),_0x1fde4e);queues[_0x1fde4e['uniqueid']][_0x96df('0x19')]=![];queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x19')]=![];queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x29')]=null;queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x2d')]=![];queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x2a')]=null;queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x41')]=!![];queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x4')]=_0x1fde4e[_0x96df('0x3f')];queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x1a')]=!![];queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x1b')]=utils[_0x96df('0x1c')]();if(_0x1fde4e[_0x96df('0x44')]==_0x96df('0x45')){if(!queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x45')]){queues[_0x1fde4e['uniqueid']][_0x96df('0x6')]=_0x96df('0x46');}}else{queues[_0x1fde4e['uniqueid']]['queuecallerexitreason']='COMPLETEDBY'+_0x1fde4e[_0x96df('0x44')][_0x96df('0x27')]();}utils[_0x96df('0x11')](util[_0x96df('0xe')](_0x96df('0x47'),_0x1fde4e['uniqueid'],queues[_0x1fde4e[_0x96df('0x10')]][_0x96df('0x20')],_0x1fde4e['membername'],queues[_0x1fde4e[_0x96df('0x10')]]['queuecallerexitreason']));writeDB(queues[_0x1fde4e['uniqueid']]);}}}catch(_0x316814){utils[_0x96df('0x15')](util[_0x96df('0xe')](_0x96df('0x43'),_0x1fde4e[_0x96df('0x10')]),_0x316814);}};exports[_0x96df('0x48')]=function(_0x16e34b){try{if(!_[_0x96df('0x17')](queues[_0x16e34b['transfereeuniqueid']])){utils['debug'](util[_0x96df('0xe')](_0x96df('0x49'),_0x16e34b[_0x96df('0x10')]),_0x16e34b);queues[_0x16e34b[_0x96df('0x4a')]]['transfer']=!![];queues[_0x16e34b['transfereeuniqueid']][_0x96df('0x4b')]=_0x96df('0x4c');queues[_0x16e34b[_0x96df('0x4a')]]['transferexten']=_0x16e34b['extension'];queues[_0x16e34b[_0x96df('0x4a')]][_0x96df('0x4d')]=_0x16e34b[_0x96df('0x4a')];queues[_0x16e34b[_0x96df('0x4a')]]['queuecallerexitreason']=_0x96df('0x4e');utils[_0x96df('0x11')](util['format'](_0x96df('0x4f'),_0x16e34b[_0x96df('0x10')],queues[_0x16e34b['transfereeuniqueid']]['name'],_0x16e34b[_0x96df('0x4a')],_0x16e34b[_0x96df('0x50')]));}}catch(_0x518613){utils['error'](util[_0x96df('0xe')](_0x96df('0x49'),_0x16e34b[_0x96df('0x10')]),_0x518613);}};exports['attendedtransfer']=function(_0x14732a){try{utils[_0x96df('0xd')](util[_0x96df('0xe')](_0x96df('0x51'),_0x14732a['origtransfereruniqueid']),_0x14732a);if(_0x14732a['origtransfereruniqueid']==_0x14732a[_0x96df('0x52')]){if(!_['isNil'](queues[_0x14732a[_0x96df('0x53')]])){utils[_0x96df('0x11')](util['format'](_0x96df('0x54'),_0x14732a[_0x96df('0x55')],queues[_0x14732a[_0x96df('0x53')]][_0x96df('0x20')],_0x14732a[_0x96df('0x56')]));queues[_0x14732a[_0x96df('0x53')]][_0x96df('0x45')]=!![];queues[_0x14732a['secondtransfererlinkedid']]['transfertype']=_0x96df('0x57');queues[_0x14732a['secondtransfererlinkedid']][_0x96df('0x58')]=_0x14732a[_0x96df('0x56')];queues[_0x14732a[_0x96df('0x53')]][_0x96df('0x4d')]=_0x14732a[_0x96df('0x55')];queues[_0x14732a[_0x96df('0x53')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x96df('0x17')](queues[_0x14732a['origtransfererlinkedid']])){if(_0x14732a[_0x96df('0x59')]&&queues[_0x14732a[_0x96df('0x59')]]){queues[_0x14732a['transfereelinkedid']][_0x96df('0x21')]=0x1;queues[_0x14732a[_0x96df('0x4a')]]=_[_0x96df('0x5a')](queues[_0x14732a[_0x96df('0x59')]]);queues[_0x14732a[_0x96df('0x4a')]]['transfereduniqueid']=_0x14732a[_0x96df('0x5b')];queues[_0x14732a['transfereeuniqueid']][_0x96df('0x21')]=0x2;queues[_0x14732a['transfereeuniqueid']][_0x96df('0x5c')]=queues[_0x14732a['secondtransfererlinkedid']][_0x96df('0x5c')];queues[_0x14732a[_0x96df('0x4a')]]['calleridname']=queues[_0x14732a[_0x96df('0x53')]][_0x96df('0x5d')];queues[_0x14732a['transfereeuniqueid']][_0x96df('0x39')]=utils[_0x96df('0x1c')]();queues[_0x14732a['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x96df('0x1c')]();queues[_0x14732a['transfereeuniqueid']][_0x96df('0x37')]=0x0;queues[_0x14732a[_0x96df('0x4a')]][_0x96df('0x5e')]=0x0;utils[_0x96df('0x11')](util['format'](_0x96df('0x5f'),_0x14732a[_0x96df('0x55')],queues[_0x14732a['transfereeuniqueid']][_0x96df('0x20')],queues[_0x14732a['transfereeuniqueid']]['calleridnum'],queues[_0x14732a[_0x96df('0x4a')]][_0x96df('0x5d')]));}else{utils['info'](util['format'](_0x96df('0x60'),_0x14732a[_0x96df('0x55')],queues[_0x14732a[_0x96df('0x52')]][_0x96df('0x20')],_0x14732a[_0x96df('0x53')]));queues[_0x14732a['origtransfererlinkedid']][_0x96df('0xc')]=_0x14732a['secondtransfererlinkedid'];}}}else if(_0x14732a[_0x96df('0x61')]==_0x14732a['secondtransfererlinkedid']){if(!_[_0x96df('0x17')](queues[_0x14732a['origtransfererlinkedid']])){utils[_0x96df('0x11')](util['format'](_0x96df('0x62'),_0x14732a['origtransfereruniqueid'],queues[_0x14732a[_0x96df('0x52')]][_0x96df('0x20')],_0x14732a[_0x96df('0x61')],_0x14732a[_0x96df('0x63')]));queues[_0x14732a[_0x96df('0x52')]][_0x96df('0x45')]=!![];queues[_0x14732a[_0x96df('0x52')]][_0x96df('0x4b')]=_0x96df('0x57');queues[_0x14732a[_0x96df('0x52')]][_0x96df('0x58')]=_0x14732a[_0x96df('0x63')];queues[_0x14732a[_0x96df('0x52')]]['transferuniqueid']=_0x14732a[_0x96df('0x61')];queues[_0x14732a[_0x96df('0x52')]][_0x96df('0x6')]=_0x96df('0x64');}if(!_[_0x96df('0x17')](queues[_0x14732a[_0x96df('0x53')]])){if(_0x14732a[_0x96df('0x65')]&&queues[_0x14732a['transfertargetlinkedid']]){queues[_0x14732a['transfertargetlinkedid']][_0x96df('0x21')]=0x1;queues[_0x14732a[_0x96df('0x5b')]]=_[_0x96df('0x5a')](queues[_0x14732a[_0x96df('0x65')]]);queues[_0x14732a['transfertargetuniqueid']][_0x96df('0xc')]=_0x14732a[_0x96df('0x5b')];queues[_0x14732a[_0x96df('0x5b')]][_0x96df('0x21')]=0x2;queues[_0x14732a[_0x96df('0x5b')]][_0x96df('0x5c')]=queues[_0x14732a[_0x96df('0x52')]]['calleridnum'];queues[_0x14732a['transfertargetuniqueid']][_0x96df('0x5d')]=queues[_0x14732a[_0x96df('0x52')]][_0x96df('0x5d')];queues[_0x14732a['transfertargetuniqueid']][_0x96df('0x39')]=utils[_0x96df('0x1c')]();queues[_0x14732a[_0x96df('0x5b')]][_0x96df('0x36')]=utils['now']();queues[_0x14732a['transfertargetuniqueid']][_0x96df('0x37')]=0x0;queues[_0x14732a[_0x96df('0x5b')]]['mohtime']=0x0;utils[_0x96df('0x11')](util[_0x96df('0xe')](_0x96df('0x66'),_0x14732a[_0x96df('0x55')],queues[_0x14732a[_0x96df('0x5b')]][_0x96df('0x20')],queues[_0x14732a[_0x96df('0x5b')]][_0x96df('0xc')],queues[_0x14732a[_0x96df('0x5b')]][_0x96df('0x5c')],queues[_0x14732a[_0x96df('0x5b')]][_0x96df('0x5d')]));}else{utils[_0x96df('0x11')](util['format'](_0x96df('0x60'),_0x14732a[_0x96df('0x55')],queues[_0x14732a['secondtransfererlinkedid']][_0x96df('0x20')],_0x14732a[_0x96df('0x52')]));queues[_0x14732a['secondtransfererlinkedid']]['transfereduniqueid']=_0x14732a[_0x96df('0x52')];}}}}catch(_0x4f90e9){utils['error'](util[_0x96df('0xe')](_0x96df('0x51'),_0x14732a[_0x96df('0x55')]),_0x4f90e9);}};exports[_0x96df('0x67')]=function(_0x4713a8){try{if(!_[_0x96df('0x17')](queues[_0x4713a8[_0x96df('0x10')]])){utils[_0x96df('0xd')](util[_0x96df('0xe')](_0x96df('0x68'),_0x4713a8[_0x96df('0x10')]),_0x4713a8);queues[_0x4713a8[_0x96df('0x10')]]['musiconholdstartAt']=utils['now']();utils['info'](util[_0x96df('0xe')](_0x96df('0x69'),_0x4713a8['uniqueid'],queues[_0x4713a8[_0x96df('0x10')]][_0x96df('0x20')],queues[_0x4713a8[_0x96df('0x10')]][_0x96df('0x6a')]));}}catch(_0x3cdbfa){utils['error'](util[_0x96df('0xe')]('[%s][queues][musiconholdstart]',_0x4713a8[_0x96df('0x10')]),_0x3cdbfa);}};exports['musiconholdstop']=function(_0x228df4){try{if(!_[_0x96df('0x17')](queues[_0x228df4[_0x96df('0x10')]])){if(!_[_0x96df('0x17')](queues[_0x228df4[_0x96df('0x10')]][_0x96df('0x6a')])){utils[_0x96df('0xd')](util[_0x96df('0xe')]('[%s][queues][musiconholdstop]',_0x228df4[_0x96df('0x10')]),_0x228df4);queues[_0x228df4['uniqueid']][_0x96df('0x5e')]+=utils[_0x96df('0x38')](utils[_0x96df('0x1c')](),queues[_0x228df4[_0x96df('0x10')]][_0x96df('0x6a')]);utils['info'](util[_0x96df('0xe')](_0x96df('0x6b'),_0x228df4[_0x96df('0x10')],queues[_0x228df4[_0x96df('0x10')]]['name'],queues[_0x228df4[_0x96df('0x10')]][_0x96df('0x5e')]));delete queues[_0x228df4[_0x96df('0x10')]][_0x96df('0x6a')];}}}catch(_0x1147e3){utils[_0x96df('0x15')](util[_0x96df('0xe')](_0x96df('0x6c'),_0x228df4[_0x96df('0x10')]),_0x1147e3);}}; \ No newline at end of file +var _0x22b4=['[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','queuecallerjoinAt','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','assigned','destaccountcode','membername','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER'];(function(_0x1c6622,_0x5e8182){var _0x57af43=function(_0x4c7ec6){while(--_0x4c7ec6){_0x1c6622['push'](_0x1c6622['shift']());}};_0x57af43(++_0x5e8182);}(_0x22b4,0x8b));var _0x422b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x22b4[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x422b('0x0'));var util=require(_0x422b('0x1'));var utils=require(_0x422b('0x2'));var queues={};function writeDB(_0x1f180d){utils[_0x422b('0x3')](util[_0x422b('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x1f180d[_0x422b('0x5')],_0x1f180d[_0x422b('0x6')],_0x1f180d['queue'],_0x1f180d[_0x422b('0x7')],_0x1f180d[_0x422b('0x8')],_0x1f180d[_0x422b('0x9')],_0x1f180d[_0x422b('0xa')]));if(_0x1f180d[_0x422b('0xb')]){utils[_0x422b('0xc')](_0x1f180d['queue'])[_0x422b('0xd')](function(_0x4e6253){if(_0x4e6253){_0x1f180d[_0x422b('0xe')]=_0x4e6253[_0x422b('0xe')];}utils[_0x422b('0xf')](_0x422b('0x10'),_0x1f180d);});}else{utils[_0x422b('0xf')](_0x422b('0x10'),_0x1f180d);}if(_0x1f180d['transfereduniqueid']){delete queues[_0x1f180d[_0x422b('0x11')]];}else{delete queues[_0x1f180d[_0x422b('0x5')]];}}exports[_0x422b('0x12')]=function(_0x419b65){try{utils[_0x422b('0x13')](util[_0x422b('0x4')](_0x422b('0x14'),_0x419b65[_0x422b('0x5')]),_0x419b65);utils['info'](util['format'](_0x422b('0x15'),_0x419b65[_0x422b('0x5')],_0x419b65[_0x422b('0xb')],_0x419b65[_0x422b('0x16')]));queues[_0x419b65[_0x422b('0x5')]]=_[_0x422b('0x17')](_0x419b65,{'originalposition':_0x419b65[_0x422b('0x16')],'queuecallerjoinAt':utils[_0x422b('0x18')](),'mohtime':0x0});}catch(_0x52a967){utils[_0x422b('0x19')](util['format'](_0x422b('0x14'),_0x419b65[_0x422b('0x5')]),_0x52a967);}};exports[_0x422b('0x1a')]=function(_0x2718e3){try{if(!_[_0x422b('0x1b')](queues[_0x2718e3[_0x422b('0x5')]])){utils['debug'](util[_0x422b('0x4')](_0x422b('0x1c'),_0x2718e3[_0x422b('0x5')]),_0x2718e3);if(queues[_0x2718e3['uniqueid']][_0x422b('0x1d')]){if(!queues[_0x2718e3[_0x422b('0x5')]][_0x422b('0x1e')]&&!queues[_0x2718e3[_0x422b('0x5')]][_0x422b('0x1f')]){queues[_0x2718e3[_0x422b('0x5')]][_0x422b('0x20')]=!![];queues[_0x2718e3['uniqueid']][_0x422b('0x21')]=utils['now']();queues[_0x2718e3['uniqueid']][_0x422b('0xa')]='COMPLETEDBYAGENT';}utils[_0x422b('0x3')](util['format'](_0x422b('0x22'),_0x2718e3[_0x422b('0x5')],queues[_0x2718e3[_0x422b('0x5')]]['name'],queues[_0x2718e3[_0x422b('0x5')]][_0x422b('0xa')]));writeDB(queues[_0x2718e3[_0x422b('0x5')]]);}else if(queues[_0x2718e3[_0x422b('0x5')]][_0x422b('0x11')]){utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x23'),_0x2718e3[_0x422b('0x5')],queues[_0x2718e3[_0x422b('0x5')]][_0x422b('0x24')],queues[_0x2718e3['uniqueid']][_0x422b('0x11')]));queues[queues[_0x2718e3[_0x422b('0x5')]][_0x422b('0x11')]]=queues[_0x2718e3['uniqueid']];queues[queues[_0x2718e3['uniqueid']]['transfereduniqueid']][_0x422b('0x25')]=0x2;delete queues[_0x2718e3[_0x422b('0x5')]];}}}catch(_0x556d53){utils[_0x422b('0x19')](util[_0x422b('0x4')](_0x422b('0x1c'),_0x2718e3[_0x422b('0x5')]),_0x556d53);}};exports[_0x422b('0x26')]=function(_0x19a4e8){try{utils[_0x422b('0x13')](util[_0x422b('0x4')]('[%s][queues][varset]',_0x19a4e8['uniqueid']),_0x19a4e8);if(!_[_0x422b('0x1b')](_0x19a4e8[_0x422b('0x27')][_0x422b('0x28')])&&_0x19a4e8['value'][_0x422b('0x29')]()!==_0x422b('0x2a')){if(!_['isNil'](queues[_0x19a4e8[_0x422b('0x5')]])){queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x1e')]=![];queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x2b')]=null;queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x1f')]=!![];queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x2c')]=utils[_0x422b('0x18')]();queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0xa')]=_0x19a4e8['value'][_0x422b('0x29')]();utils[_0x422b('0x3')](util['format'](_0x422b('0x2d'),_0x19a4e8[_0x422b('0x5')],queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x24')],_0x19a4e8[_0x422b('0x2e')],queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0xa')]));writeDB(queues[_0x19a4e8[_0x422b('0x5')]]);}}else if(!_[_0x422b('0x1b')](_0x19a4e8[_0x422b('0x27')]['queueposition'])){if(!_[_0x422b('0x1b')](queues[_0x19a4e8[_0x422b('0x5')]])&&!queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x1e')]){queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x1e')]=![];queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x2b')]=null;queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x1f')]=!![];queues[_0x19a4e8['uniqueid']][_0x422b('0x2c')]=utils[_0x422b('0x18')]();queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0xa')]=_0x422b('0x2f');utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x30'),_0x19a4e8['uniqueid'],queues[_0x19a4e8[_0x422b('0x5')]][_0x422b('0x24')],_0x19a4e8[_0x422b('0x2e')],queues[_0x19a4e8['uniqueid']][_0x422b('0xa')]));}}}catch(_0x1479fe){utils[_0x422b('0x19')](util[_0x422b('0x4')](_0x422b('0x31'),_0x19a4e8[_0x422b('0x5')]),_0x1479fe);}};exports[_0x422b('0x1e')]=function(_0x23a0b3){try{if(!_[_0x422b('0x1b')](queues[_0x23a0b3[_0x422b('0x5')]])){utils[_0x422b('0x13')](util[_0x422b('0x4')](_0x422b('0x32'),_0x23a0b3[_0x422b('0x5')]),_0x23a0b3);queues[_0x23a0b3[_0x422b('0x5')]][_0x422b('0x1f')]=![];queues[_0x23a0b3[_0x422b('0x5')]][_0x422b('0x2c')]=null;queues[_0x23a0b3[_0x422b('0x5')]]['queuecallerabandon']=!![];queues[_0x23a0b3[_0x422b('0x5')]][_0x422b('0x2b')]=utils[_0x422b('0x18')]();queues[_0x23a0b3[_0x422b('0x5')]][_0x422b('0xa')]=_0x422b('0x33');utils[_0x422b('0x3')](util[_0x422b('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x23a0b3[_0x422b('0x5')],queues[_0x23a0b3[_0x422b('0x5')]][_0x422b('0x24')],queues[_0x23a0b3[_0x422b('0x5')]][_0x422b('0xa')]));}}catch(_0x37749f){utils['error'](util[_0x422b('0x4')](_0x422b('0x32'),_0x23a0b3[_0x422b('0x5')]),_0x37749f);}};exports[_0x422b('0x34')]=function(_0x1693b3){try{if(!_[_0x422b('0x1b')](queues[_0x1693b3[_0x422b('0x5')]])){utils[_0x422b('0x13')](util[_0x422b('0x4')](_0x422b('0x35'),_0x1693b3[_0x422b('0x5')]),_0x1693b3);utils['info'](util[_0x422b('0x4')](_0x422b('0x36'),_0x1693b3[_0x422b('0x5')],queues[_0x1693b3['uniqueid']][_0x422b('0x24')],_0x1693b3[_0x422b('0x37')],_0x1693b3[_0x422b('0x38')]));queues[_0x1693b3[_0x422b('0x5')]]['queuecallerleave']=!![];queues[_0x1693b3['uniqueid']][_0x422b('0x1d')]=utils[_0x422b('0x18')]();queues[_0x1693b3[_0x422b('0x5')]]['holdtime']=utils[_0x422b('0x39')](queues[_0x1693b3[_0x422b('0x5')]][_0x422b('0x1d')],queues[_0x1693b3[_0x422b('0x5')]]['queuecallerjoinAt']);queues[_0x1693b3[_0x422b('0x5')]][_0x422b('0x16')]=_0x1693b3['position'];queues[_0x1693b3[_0x422b('0x5')]][_0x422b('0x3a')]=_0x1693b3[_0x422b('0x3a')];queues[_0x1693b3[_0x422b('0x5')]][_0x422b('0x37')]=_0x1693b3['connectedlinenum'];queues[_0x1693b3['uniqueid']][_0x422b('0x38')]=_0x1693b3[_0x422b('0x38')];}}catch(_0x256cc6){utils['error'](util[_0x422b('0x4')](_0x422b('0x35'),_0x1693b3[_0x422b('0x5')]),_0x256cc6);}};exports[_0x422b('0x3b')]=function(_0x19f138){try{if(!_['isNil'](queues[_0x19f138['uniqueid']])){utils[_0x422b('0x13')](util[_0x422b('0x4')](_0x422b('0x3c'),_0x19f138[_0x422b('0x5')]),_0x19f138);utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x3d'),_0x19f138[_0x422b('0x5')],queues[_0x19f138[_0x422b('0x5')]]['name'],_0x19f138['membername'],_0x19f138['destaccountcode']));queues[_0x19f138[_0x422b('0x5')]]['queuecallerabandon']=![];queues[_0x19f138['uniqueid']][_0x422b('0x1e')]=![];queues[_0x19f138[_0x422b('0x5')]][_0x422b('0x2b')]=null;queues[_0x19f138[_0x422b('0x5')]][_0x422b('0x1f')]=![];queues[_0x19f138[_0x422b('0x5')]][_0x422b('0xa')]=null;queues[_0x19f138[_0x422b('0x5')]][_0x422b('0x2c')]=null;queues[_0x19f138[_0x422b('0x5')]][_0x422b('0x3e')]=!![];queues[_0x19f138['uniqueid']][_0x422b('0x9')]=_0x19f138[_0x422b('0x3f')];queues[_0x19f138[_0x422b('0x5')]][_0x422b('0x7')]=_0x19f138[_0x422b('0x40')];}}catch(_0x1c0ca2){utils[_0x422b('0x19')](util[_0x422b('0x4')](_0x422b('0x3c'),_0x19f138['uniqueid']),_0x1c0ca2);}};exports[_0x422b('0x41')]=function(_0x1536a8){try{if(!_[_0x422b('0x1b')](queues[_0x1536a8['uniqueid']])){if(queues[_0x1536a8[_0x422b('0x5')]][_0x422b('0x1d')]){utils['debug'](util[_0x422b('0x4')](_0x422b('0x42'),_0x1536a8[_0x422b('0x5')]),_0x1536a8);queues[_0x1536a8[_0x422b('0x5')]][_0x422b('0x1e')]=![];queues[_0x1536a8['uniqueid']][_0x422b('0x1e')]=![];queues[_0x1536a8['uniqueid']][_0x422b('0x2b')]=null;queues[_0x1536a8[_0x422b('0x5')]][_0x422b('0x1f')]=![];queues[_0x1536a8[_0x422b('0x5')]]['queuecallerexitAt']=null;queues[_0x1536a8[_0x422b('0x5')]][_0x422b('0x3e')]=!![];queues[_0x1536a8[_0x422b('0x5')]][_0x422b('0x7')]=_0x1536a8[_0x422b('0x40')];queues[_0x1536a8['uniqueid']][_0x422b('0x20')]=!![];queues[_0x1536a8['uniqueid']]['queuecallercompleteAt']=utils[_0x422b('0x18')]();if(_0x1536a8['reason']=='transfer'){if(!queues[_0x1536a8[_0x422b('0x5')]][_0x422b('0x43')]){queues[_0x1536a8['uniqueid']][_0x422b('0xa')]=_0x422b('0x44');}}else{queues[_0x1536a8['uniqueid']][_0x422b('0xa')]='COMPLETEDBY'+_0x1536a8[_0x422b('0x45')][_0x422b('0x29')]();}utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x46'),_0x1536a8['uniqueid'],queues[_0x1536a8[_0x422b('0x5')]][_0x422b('0x24')],_0x1536a8[_0x422b('0x40')],queues[_0x1536a8[_0x422b('0x5')]][_0x422b('0xa')]));writeDB(queues[_0x1536a8['uniqueid']]);}}}catch(_0x3d7234){utils[_0x422b('0x19')](util[_0x422b('0x4')](_0x422b('0x42'),_0x1536a8[_0x422b('0x5')]),_0x3d7234);}};exports['blindtransfer']=function(_0x1d3865){try{if(!_[_0x422b('0x1b')](queues[_0x1d3865[_0x422b('0x47')]])){utils[_0x422b('0x13')](util[_0x422b('0x4')](_0x422b('0x48'),_0x1d3865[_0x422b('0x5')]),_0x1d3865);queues[_0x1d3865[_0x422b('0x47')]]['transfer']=!![];queues[_0x1d3865[_0x422b('0x47')]][_0x422b('0x49')]=_0x422b('0x4a');queues[_0x1d3865[_0x422b('0x47')]][_0x422b('0x4b')]=_0x1d3865[_0x422b('0x4c')];queues[_0x1d3865[_0x422b('0x47')]][_0x422b('0x4d')]=_0x1d3865[_0x422b('0x47')];queues[_0x1d3865[_0x422b('0x47')]][_0x422b('0xa')]=_0x422b('0x4e');utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x4f'),_0x1d3865[_0x422b('0x5')],queues[_0x1d3865[_0x422b('0x47')]][_0x422b('0x24')],_0x1d3865['transfereeuniqueid'],_0x1d3865[_0x422b('0x4c')]));}}catch(_0x1e6683){utils[_0x422b('0x19')](util[_0x422b('0x4')]('[%s][queues][blindtransfer]',_0x1d3865['uniqueid']),_0x1e6683);}};exports[_0x422b('0x50')]=function(_0xa76faf){try{utils[_0x422b('0x13')](util['format'](_0x422b('0x51'),_0xa76faf['origtransfereruniqueid']),_0xa76faf);if(_0xa76faf[_0x422b('0x52')]==_0xa76faf['origtransfererlinkedid']){if(!_['isNil'](queues[_0xa76faf[_0x422b('0x53')]])){utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x54'),_0xa76faf[_0x422b('0x52')],queues[_0xa76faf[_0x422b('0x53')]]['name'],_0xa76faf['origtransfererexten']));queues[_0xa76faf[_0x422b('0x53')]][_0x422b('0x43')]=!![];queues[_0xa76faf['secondtransfererlinkedid']][_0x422b('0x49')]='ATTENDED';queues[_0xa76faf[_0x422b('0x53')]]['transferexten']=_0xa76faf[_0x422b('0x55')];queues[_0xa76faf['secondtransfererlinkedid']][_0x422b('0x4d')]=_0xa76faf['origtransfereruniqueid'];queues[_0xa76faf[_0x422b('0x53')]][_0x422b('0xa')]=_0x422b('0x56');}if(!_[_0x422b('0x1b')](queues[_0xa76faf[_0x422b('0x57')]])){if(_0xa76faf[_0x422b('0x58')]&&queues[_0xa76faf[_0x422b('0x58')]]){queues[_0xa76faf[_0x422b('0x58')]][_0x422b('0x25')]=0x1;queues[_0xa76faf[_0x422b('0x47')]]=_['clone'](queues[_0xa76faf['transfereelinkedid']]);queues[_0xa76faf[_0x422b('0x47')]][_0x422b('0x11')]=_0xa76faf[_0x422b('0x59')];queues[_0xa76faf[_0x422b('0x47')]][_0x422b('0x25')]=0x2;queues[_0xa76faf[_0x422b('0x47')]]['calleridnum']=queues[_0xa76faf[_0x422b('0x53')]][_0x422b('0x8')];queues[_0xa76faf['transfereeuniqueid']]['calleridname']=queues[_0xa76faf[_0x422b('0x53')]]['calleridname'];queues[_0xa76faf[_0x422b('0x47')]][_0x422b('0x5a')]=utils[_0x422b('0x18')]();queues[_0xa76faf[_0x422b('0x47')]][_0x422b('0x1d')]=utils['now']();queues[_0xa76faf[_0x422b('0x47')]][_0x422b('0x5b')]=0x0;queues[_0xa76faf[_0x422b('0x47')]][_0x422b('0x5c')]=0x0;utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x5d'),_0xa76faf[_0x422b('0x52')],queues[_0xa76faf[_0x422b('0x47')]][_0x422b('0x24')],queues[_0xa76faf[_0x422b('0x47')]][_0x422b('0x8')],queues[_0xa76faf['transfereeuniqueid']][_0x422b('0x5e')]));}else{utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x5f'),_0xa76faf[_0x422b('0x52')],queues[_0xa76faf[_0x422b('0x57')]][_0x422b('0x24')],_0xa76faf[_0x422b('0x53')]));queues[_0xa76faf[_0x422b('0x57')]][_0x422b('0x11')]=_0xa76faf[_0x422b('0x53')];}}}else if(_0xa76faf[_0x422b('0x60')]==_0xa76faf[_0x422b('0x53')]){if(!_[_0x422b('0x1b')](queues[_0xa76faf[_0x422b('0x57')]])){utils[_0x422b('0x3')](util['format'](_0x422b('0x61'),_0xa76faf[_0x422b('0x52')],queues[_0xa76faf['origtransfererlinkedid']][_0x422b('0x24')],_0xa76faf[_0x422b('0x60')],_0xa76faf[_0x422b('0x62')]));queues[_0xa76faf[_0x422b('0x57')]][_0x422b('0x43')]=!![];queues[_0xa76faf[_0x422b('0x57')]][_0x422b('0x49')]=_0x422b('0x63');queues[_0xa76faf['origtransfererlinkedid']][_0x422b('0x4b')]=_0xa76faf[_0x422b('0x62')];queues[_0xa76faf[_0x422b('0x57')]][_0x422b('0x4d')]=_0xa76faf[_0x422b('0x60')];queues[_0xa76faf[_0x422b('0x57')]][_0x422b('0xa')]=_0x422b('0x56');}if(!_['isNil'](queues[_0xa76faf['secondtransfererlinkedid']])){if(_0xa76faf[_0x422b('0x64')]&&queues[_0xa76faf[_0x422b('0x64')]]){queues[_0xa76faf[_0x422b('0x64')]]['queuecallerenterreason']=0x1;queues[_0xa76faf['transfertargetuniqueid']]=_[_0x422b('0x65')](queues[_0xa76faf[_0x422b('0x64')]]);queues[_0xa76faf[_0x422b('0x59')]]['transfereduniqueid']=_0xa76faf['transfertargetuniqueid'];queues[_0xa76faf[_0x422b('0x59')]]['queuecallerenterreason']=0x2;queues[_0xa76faf[_0x422b('0x59')]][_0x422b('0x8')]=queues[_0xa76faf[_0x422b('0x57')]][_0x422b('0x8')];queues[_0xa76faf[_0x422b('0x59')]][_0x422b('0x5e')]=queues[_0xa76faf['origtransfererlinkedid']][_0x422b('0x5e')];queues[_0xa76faf[_0x422b('0x59')]][_0x422b('0x5a')]=utils[_0x422b('0x18')]();queues[_0xa76faf[_0x422b('0x59')]]['queuecallerleaveAt']=utils[_0x422b('0x18')]();queues[_0xa76faf[_0x422b('0x59')]]['holdtime']=0x0;queues[_0xa76faf[_0x422b('0x59')]][_0x422b('0x5c')]=0x0;utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x66'),_0xa76faf[_0x422b('0x52')],queues[_0xa76faf['transfertargetuniqueid']][_0x422b('0x24')],queues[_0xa76faf[_0x422b('0x59')]]['transfereduniqueid'],queues[_0xa76faf['transfertargetuniqueid']]['calleridnum'],queues[_0xa76faf['transfertargetuniqueid']][_0x422b('0x5e')]));}else{utils[_0x422b('0x3')](util[_0x422b('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0xa76faf['origtransfereruniqueid'],queues[_0xa76faf[_0x422b('0x53')]][_0x422b('0x24')],_0xa76faf[_0x422b('0x57')]));queues[_0xa76faf[_0x422b('0x53')]][_0x422b('0x11')]=_0xa76faf[_0x422b('0x57')];}}}}catch(_0x3d488b){utils[_0x422b('0x19')](util[_0x422b('0x4')](_0x422b('0x51'),_0xa76faf[_0x422b('0x52')]),_0x3d488b);}};exports['musiconholdstart']=function(_0x11518b){try{if(!_['isNil'](queues[_0x11518b['uniqueid']])){utils['debug'](util[_0x422b('0x4')](_0x422b('0x67'),_0x11518b[_0x422b('0x5')]),_0x11518b);queues[_0x11518b[_0x422b('0x5')]]['musiconholdstartAt']=utils['now']();utils[_0x422b('0x3')](util[_0x422b('0x4')](_0x422b('0x68'),_0x11518b[_0x422b('0x5')],queues[_0x11518b[_0x422b('0x5')]][_0x422b('0x24')],queues[_0x11518b[_0x422b('0x5')]][_0x422b('0x69')]));}}catch(_0x5d0ffc){utils[_0x422b('0x19')](util[_0x422b('0x4')](_0x422b('0x67'),_0x11518b[_0x422b('0x5')]),_0x5d0ffc);}};exports[_0x422b('0x6a')]=function(_0x2e779b){try{if(!_[_0x422b('0x1b')](queues[_0x2e779b[_0x422b('0x5')]])){if(!_[_0x422b('0x1b')](queues[_0x2e779b[_0x422b('0x5')]][_0x422b('0x69')])){utils['debug'](util[_0x422b('0x4')]('[%s][queues][musiconholdstop]',_0x2e779b[_0x422b('0x5')]),_0x2e779b);queues[_0x2e779b[_0x422b('0x5')]][_0x422b('0x5c')]+=utils[_0x422b('0x39')](utils[_0x422b('0x18')](),queues[_0x2e779b['uniqueid']][_0x422b('0x69')]);utils['info'](util[_0x422b('0x4')](_0x422b('0x6b'),_0x2e779b[_0x422b('0x5')],queues[_0x2e779b[_0x422b('0x5')]][_0x422b('0x24')],queues[_0x2e779b[_0x422b('0x5')]]['mohtime']));delete queues[_0x2e779b[_0x422b('0x5')]][_0x422b('0x69')];}}}catch(_0x3aca09){utils[_0x422b('0x19')](util[_0x422b('0x4')](_0x422b('0x6c'),_0x2e779b[_0x422b('0x5')]),_0x3aca09);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c62b56c..2e133f5 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 _0xcbe1=['uniqueid','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','format','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','accountcode','channel','error','[%s][recordings][newchannel]','newstate','debug','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.WAV','find','monitors','push','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','application','appdata','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','util','[%s][recordings][writeDB]'];(function(_0x3afad3,_0x5266f8){var _0x4e55c6=function(_0x1100d7){while(--_0x1100d7){_0x3afad3['push'](_0x3afad3['shift']());}};_0x4e55c6(++_0x5266f8);}(_0xcbe1,0x1a2));var _0x1cbe=function(_0x4612df,_0x37a8f7){_0x4612df=_0x4612df-0x0;var _0x2804c6=_0xcbe1[_0x4612df];return _0x2804c6;};'use strict';var _=require('lodash');var util=require(_0x1cbe('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x5b6f45){utils['info'](util['format'](_0x1cbe('0x1'),_0x5b6f45[_0x1cbe('0x2')]));if(_0x5b6f45['accountcode']){utils[_0x1cbe('0x3')](_0x5b6f45['accountcode'])[_0x1cbe('0x4')](function(_0x168121){if(_0x168121){_0x5b6f45['membername']=_0x168121[_0x1cbe('0x5')];_0x5b6f45[_0x1cbe('0x6')]=_0x168121['id'];}utils[_0x1cbe('0x7')](_0x1cbe('0x8'),_0x5b6f45);});}else{utils[_0x1cbe('0x7')](_0x1cbe('0x8'),_0x5b6f45);}}exports[_0x1cbe('0x9')]=function(_0x42232d){try{utils['debug'](util[_0x1cbe('0xa')]('[%s][recordings][newchannel]',_0x42232d[_0x1cbe('0x2')]),_0x42232d);if(_0x42232d[_0x1cbe('0x2')]==_0x42232d[_0x1cbe('0xb')]){utils[_0x1cbe('0xc')](util['format'](_0x1cbe('0xd'),_0x42232d['uniqueid'],_0x42232d[_0x1cbe('0xe')],_0x42232d[_0x1cbe('0xf')]));recordings[_0x42232d['uniqueid']]={'uniqueid':_0x42232d[_0x1cbe('0x2')],'accountcode':_0x42232d[_0x1cbe('0x10')],'exten':_0x42232d[_0x1cbe('0xf')],'context':_0x42232d['context'],'channel':_0x42232d[_0x1cbe('0x11')],'monitors':[]};}}catch(_0x42a345){utils[_0x1cbe('0x12')](util[_0x1cbe('0xa')](_0x1cbe('0x13'),_0x42232d[_0x1cbe('0x2')]),_0x42a345);}};exports[_0x1cbe('0x14')]=function(_0x25093a){try{utils[_0x1cbe('0x15')](util[_0x1cbe('0xa')]('[%s][recordings][newstate]',_0x25093a[_0x1cbe('0x2')]),_0x25093a);if(!_[_0x1cbe('0x16')](recordings[_0x25093a[_0x1cbe('0x2')]])&&_0x25093a['channelstate']==0x6){utils[_0x1cbe('0xc')](util[_0x1cbe('0xa')](_0x1cbe('0x17'),_0x25093a['uniqueid'],_0x25093a['context'],_0x25093a[_0x1cbe('0x11')]));}else if(!_[_0x1cbe('0x16')](recordings[_0x25093a[_0x1cbe('0xb')]])&&_0x25093a[_0x1cbe('0x18')]==0x6&&_0x25093a['context']!='transfer'){utils[_0x1cbe('0xc')](util[_0x1cbe('0xa')](_0x1cbe('0x19'),_0x25093a['uniqueid'],_0x25093a['linkedid'],_0x25093a[_0x1cbe('0xe')],_0x25093a['channel']));recordings[_0x25093a[_0x1cbe('0xb')]][_0x1cbe('0x10')]=_0x25093a[_0x1cbe('0x10')];}}catch(_0x1790b1){utils[_0x1cbe('0x12')](util[_0x1cbe('0xa')](_0x1cbe('0x1a'),_0x25093a[_0x1cbe('0x2')]),_0x1790b1);}};exports[_0x1cbe('0x1b')]=function(_0x4c7a82){try{if(!_[_0x1cbe('0x16')](_0x4c7a82['variable'])&&!_[_0x1cbe('0x16')](_0x4c7a82[_0x1cbe('0x1c')][_0x1cbe('0x1d')])){utils['debug'](util[_0x1cbe('0xa')](_0x1cbe('0x1e'),_0x4c7a82[_0x1cbe('0x2')]),_0x4c7a82);utils[_0x1cbe('0xc')](util[_0x1cbe('0xa')](_0x1cbe('0x1f'),_0x4c7a82['uniqueid'],_0x4c7a82[_0x1cbe('0x1c')],_0x4c7a82[_0x1cbe('0x20')]));if(_[_0x1cbe('0x21')](_0x4c7a82['value'],'.wav49')){_0x4c7a82[_0x1cbe('0x20')]=_0x4c7a82['value'][_0x1cbe('0x22')]('.wav49',_0x1cbe('0x23'));}if(recordings[_0x4c7a82[_0x1cbe('0xb')]]){var _0x3a937e=_[_0x1cbe('0x24')](recordings[_0x4c7a82['linkedid']][_0x1cbe('0x25')],{'value':_0x4c7a82[_0x1cbe('0x20')]});if(_[_0x1cbe('0x16')](_0x3a937e)){recordings[_0x4c7a82[_0x1cbe('0xb')]][_0x1cbe('0x25')][_0x1cbe('0x26')]({'value':_0x4c7a82['value']});}}}}catch(_0x509a42){utils[_0x1cbe('0x12')](util['format'](_0x1cbe('0x1e'),_0x4c7a82[_0x1cbe('0x2')]),_0x509a42);}};exports['hangup']=function(_0x287e7d){try{if(!_['isNil'](recordings[_0x287e7d[_0x1cbe('0x2')]])){utils[_0x1cbe('0x15')](util[_0x1cbe('0xa')](_0x1cbe('0x27'),_0x287e7d['uniqueid']),_0x287e7d);utils['info'](util[_0x1cbe('0xa')](_0x1cbe('0x28'),_0x287e7d[_0x1cbe('0x2')],_0x287e7d[_0x1cbe('0x29')],_0x287e7d[_0x1cbe('0x2a')],_0x287e7d['cause-txt']));recordings[_0x287e7d[_0x1cbe('0x2')]][_0x1cbe('0x29')]=_0x287e7d['calleridnum'];recordings[_0x287e7d[_0x1cbe('0x2')]][_0x1cbe('0x2a')]=_0x287e7d[_0x1cbe('0x2a')];recordings[_0x287e7d['uniqueid']]['connectedlinenum']=_0x287e7d[_0x1cbe('0x2b')];recordings[_0x287e7d[_0x1cbe('0x2')]][_0x1cbe('0x2c')]=_0x287e7d[_0x1cbe('0x2c')];if(recordings[_0x287e7d[_0x1cbe('0x2')]][_0x1cbe('0x2d')]==_0x1cbe('0x2e')&&recordings[_0x287e7d[_0x1cbe('0x2')]]['accountcode']){recordings[_0x287e7d[_0x1cbe('0x2')]]['connectedlinenum']=recordings[_0x287e7d[_0x1cbe('0x2')]]['accountcode'];recordings[_0x287e7d[_0x1cbe('0x2')]]['connectedlinename']='';}recordings[_0x287e7d[_0x1cbe('0x2')]]['monitors'][_0x1cbe('0x2f')](function(_0x2c83e1){var _0x532b1e=_[_0x1cbe('0x30')](recordings[_0x287e7d[_0x1cbe('0x2')]]);_0x532b1e[_0x1cbe('0x20')]=_0x2c83e1[_0x1cbe('0x20')];writeDB(_0x532b1e);});delete recordings[_0x287e7d[_0x1cbe('0x2')]];}}catch(_0x3d8398){utils[_0x1cbe('0x12')](util[_0x1cbe('0xa')](_0x1cbe('0x27'),_0x287e7d[_0x1cbe('0x2')]),_0x3d8398);}};exports['newexten']=function(_0x2842b0){try{if(!_[_0x1cbe('0x16')](recordings[_0x2842b0[_0x1cbe('0x2')]])){utils[_0x1cbe('0x15')](util[_0x1cbe('0xa')](_0x1cbe('0x31'),_0x2842b0[_0x1cbe('0x2')]),_0x2842b0);utils[_0x1cbe('0xc')](util[_0x1cbe('0xa')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x2842b0[_0x1cbe('0x2')],_0x2842b0[_0x1cbe('0x32')],_0x2842b0[_0x1cbe('0x33')]));if(_0x2842b0[_0x1cbe('0x32')]['toLowerCase']()=='set'&&_[_0x1cbe('0x34')](_0x2842b0['appdata']['toLowerCase'](),_0x1cbe('0x35'))){var _0x169530=_0x2842b0[_0x1cbe('0x33')][_0x1cbe('0x36')]('=');var _0x44f4a4=_0x169530[0x0][_0x1cbe('0x37')](_0x169530[0x0][_0x1cbe('0x38')]('(')+0x1,_0x169530[0x0][_0x1cbe('0x38')](')'));var _0x50284b=_0x169530[0x1];recordings[_0x2842b0[_0x1cbe('0x2')]][_0x44f4a4]=_0x50284b;}}}catch(_0x47ae56){utils[_0x1cbe('0x12')](util[_0x1cbe('0xa')](_0x1cbe('0x31'),_0x2842b0['uniqueid']),_0x47ae56);}};exports[_0x1cbe('0x39')]=function(_0x438ed9){try{if(!_[_0x1cbe('0x16')](recordings[_0x438ed9[_0x1cbe('0x2')]])){utils[_0x1cbe('0x15')](util[_0x1cbe('0xa')](_0x1cbe('0x3a'),_0x438ed9[_0x1cbe('0x2')]),_0x438ed9);utils[_0x1cbe('0xc')](util[_0x1cbe('0xa')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x438ed9[_0x1cbe('0x2')],_0x438ed9[_0x1cbe('0x3b')]));recordings[_0x438ed9[_0x1cbe('0x2')]][_0x1cbe('0x3b')]=_0x438ed9[_0x1cbe('0x3b')];}}catch(_0x49b406){utils[_0x1cbe('0x12')](util[_0x1cbe('0xa')]('[%s][recordings][queuecallerjoin]',_0x438ed9['uniqueid']),_0x49b406);}}; \ No newline at end of file +var _0xeefb=['forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','debug','format','[%s][recordings][newchannel]','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','linkedid','variable','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound'];(function(_0x15cf23,_0x4f90d5){var _0x19cf58=function(_0x33c23e){while(--_0x33c23e){_0x15cf23['push'](_0x15cf23['shift']());}};_0x19cf58(++_0x4f90d5);}(_0xeefb,0xcd));var _0xbeef=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xeefb[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xbeef('0x0'));var util=require(_0xbeef('0x1'));var utils=require(_0xbeef('0x2'));var recordings={};function writeDB(_0x5f0190){utils[_0xbeef('0x3')](util['format'](_0xbeef('0x4'),_0x5f0190[_0xbeef('0x5')]));if(_0x5f0190[_0xbeef('0x6')]){utils[_0xbeef('0x7')](_0x5f0190[_0xbeef('0x6')])[_0xbeef('0x8')](function(_0x57357c){if(_0x57357c){_0x5f0190['membername']=_0x57357c[_0xbeef('0x9')];_0x5f0190[_0xbeef('0xa')]=_0x57357c['id'];}utils[_0xbeef('0xb')](_0xbeef('0xc'),_0x5f0190);});}else{utils['request'](_0xbeef('0xc'),_0x5f0190);}}exports['newchannel']=function(_0x1a53a8){try{utils[_0xbeef('0xd')](util[_0xbeef('0xe')](_0xbeef('0xf'),_0x1a53a8[_0xbeef('0x5')]),_0x1a53a8);if(_0x1a53a8['uniqueid']==_0x1a53a8['linkedid']){utils['info'](util['format']('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x1a53a8[_0xbeef('0x5')],_0x1a53a8[_0xbeef('0x10')],_0x1a53a8['exten']));recordings[_0x1a53a8[_0xbeef('0x5')]]={'uniqueid':_0x1a53a8['uniqueid'],'accountcode':_0x1a53a8[_0xbeef('0x6')],'exten':_0x1a53a8[_0xbeef('0x11')],'context':_0x1a53a8[_0xbeef('0x10')],'channel':_0x1a53a8[_0xbeef('0x12')],'monitors':[]};}}catch(_0x2441ec){utils[_0xbeef('0x13')](util[_0xbeef('0xe')](_0xbeef('0xf'),_0x1a53a8[_0xbeef('0x5')]),_0x2441ec);}};exports[_0xbeef('0x14')]=function(_0x377a30){try{utils['debug'](util[_0xbeef('0xe')](_0xbeef('0x15'),_0x377a30['uniqueid']),_0x377a30);if(!_[_0xbeef('0x16')](recordings[_0x377a30['uniqueid']])&&_0x377a30[_0xbeef('0x17')]==0x6){utils[_0xbeef('0x3')](util[_0xbeef('0xe')](_0xbeef('0x18'),_0x377a30['uniqueid'],_0x377a30['context'],_0x377a30[_0xbeef('0x12')]));}else if(!_[_0xbeef('0x16')](recordings[_0x377a30['linkedid']])&&_0x377a30['channelstate']==0x6&&_0x377a30[_0xbeef('0x10')]!=_0xbeef('0x19')){utils[_0xbeef('0x3')](util[_0xbeef('0xe')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x377a30['uniqueid'],_0x377a30[_0xbeef('0x1a')],_0x377a30[_0xbeef('0x10')],_0x377a30['channel']));recordings[_0x377a30[_0xbeef('0x1a')]][_0xbeef('0x6')]=_0x377a30[_0xbeef('0x6')];}}catch(_0x25dee8){utils[_0xbeef('0x13')](util['format'](_0xbeef('0x15'),_0x377a30['uniqueid']),_0x25dee8);}};exports['varset']=function(_0xd13be1){try{if(!_[_0xbeef('0x16')](_0xd13be1[_0xbeef('0x1b')])&&!_[_0xbeef('0x16')](_0xd13be1[_0xbeef('0x1b')]['mixmonitor_filename'])){utils[_0xbeef('0xd')](util['format']('[%s][recordings][varset]',_0xd13be1[_0xbeef('0x5')]),_0xd13be1);utils[_0xbeef('0x3')](util[_0xbeef('0xe')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0xd13be1[_0xbeef('0x5')],_0xd13be1[_0xbeef('0x1b')],_0xd13be1[_0xbeef('0x1c')]));if(_[_0xbeef('0x1d')](_0xd13be1[_0xbeef('0x1c')],_0xbeef('0x1e'))){_0xd13be1[_0xbeef('0x1c')]=_0xd13be1[_0xbeef('0x1c')][_0xbeef('0x1f')](_0xbeef('0x1e'),_0xbeef('0x20'));}if(recordings[_0xd13be1[_0xbeef('0x1a')]]){var _0x507b28=_[_0xbeef('0x21')](recordings[_0xd13be1[_0xbeef('0x1a')]][_0xbeef('0x22')],{'value':_0xd13be1['value']});if(_[_0xbeef('0x16')](_0x507b28)){recordings[_0xd13be1[_0xbeef('0x1a')]]['monitors'][_0xbeef('0x23')]({'value':_0xd13be1[_0xbeef('0x1c')]});}}}}catch(_0x5e2a34){utils[_0xbeef('0x13')](util[_0xbeef('0xe')](_0xbeef('0x24'),_0xd13be1[_0xbeef('0x5')]),_0x5e2a34);}};exports[_0xbeef('0x25')]=function(_0x412037){try{if(!_[_0xbeef('0x16')](recordings[_0x412037['uniqueid']])){utils['debug'](util[_0xbeef('0xe')](_0xbeef('0x26'),_0x412037['uniqueid']),_0x412037);utils[_0xbeef('0x3')](util[_0xbeef('0xe')](_0xbeef('0x27'),_0x412037[_0xbeef('0x5')],_0x412037[_0xbeef('0x28')],_0x412037[_0xbeef('0x29')],_0x412037[_0xbeef('0x2a')]));recordings[_0x412037[_0xbeef('0x5')]][_0xbeef('0x28')]=_0x412037[_0xbeef('0x28')];recordings[_0x412037[_0xbeef('0x5')]][_0xbeef('0x29')]=_0x412037[_0xbeef('0x29')];recordings[_0x412037[_0xbeef('0x5')]][_0xbeef('0x2b')]=_0x412037[_0xbeef('0x2b')];recordings[_0x412037[_0xbeef('0x5')]][_0xbeef('0x2c')]=_0x412037[_0xbeef('0x2c')];if(recordings[_0x412037['uniqueid']][_0xbeef('0x2d')]==_0xbeef('0x2e')&&recordings[_0x412037['uniqueid']][_0xbeef('0x6')]){recordings[_0x412037[_0xbeef('0x5')]][_0xbeef('0x2b')]=recordings[_0x412037[_0xbeef('0x5')]][_0xbeef('0x6')];recordings[_0x412037[_0xbeef('0x5')]]['connectedlinename']='';}recordings[_0x412037[_0xbeef('0x5')]]['monitors'][_0xbeef('0x2f')](function(_0x4eeb65){var _0x3d909c=_[_0xbeef('0x30')](recordings[_0x412037[_0xbeef('0x5')]]);_0x3d909c[_0xbeef('0x1c')]=_0x4eeb65[_0xbeef('0x1c')];writeDB(_0x3d909c);});delete recordings[_0x412037[_0xbeef('0x5')]];}}catch(_0xfa85dc){utils['error'](util[_0xbeef('0xe')](_0xbeef('0x26'),_0x412037['uniqueid']),_0xfa85dc);}};exports[_0xbeef('0x31')]=function(_0x25c1e6){try{if(!_[_0xbeef('0x16')](recordings[_0x25c1e6[_0xbeef('0x5')]])){utils['debug'](util[_0xbeef('0xe')](_0xbeef('0x32'),_0x25c1e6[_0xbeef('0x5')]),_0x25c1e6);utils[_0xbeef('0x3')](util[_0xbeef('0xe')](_0xbeef('0x33'),_0x25c1e6[_0xbeef('0x5')],_0x25c1e6[_0xbeef('0x34')],_0x25c1e6[_0xbeef('0x35')]));if(_0x25c1e6[_0xbeef('0x34')]['toLowerCase']()=='set'&&_[_0xbeef('0x36')](_0x25c1e6[_0xbeef('0x35')][_0xbeef('0x37')](),_0xbeef('0x38'))){var _0x41570b=_0x25c1e6[_0xbeef('0x35')]['split']('=');var _0x85ae2e=_0x41570b[0x0][_0xbeef('0x39')](_0x41570b[0x0][_0xbeef('0x3a')]('(')+0x1,_0x41570b[0x0]['lastIndexOf'](')'));var _0x391aac=_0x41570b[0x1];recordings[_0x25c1e6[_0xbeef('0x5')]][_0x85ae2e]=_0x391aac;}}}catch(_0x2f9771){utils[_0xbeef('0x13')](util['format'](_0xbeef('0x32'),_0x25c1e6[_0xbeef('0x5')]),_0x2f9771);}};exports[_0xbeef('0x3b')]=function(_0xcd05b8){try{if(!_[_0xbeef('0x16')](recordings[_0xcd05b8[_0xbeef('0x5')]])){utils['debug'](util['format'](_0xbeef('0x3c'),_0xcd05b8['uniqueid']),_0xcd05b8);utils['info'](util[_0xbeef('0xe')](_0xbeef('0x3d'),_0xcd05b8[_0xbeef('0x5')],_0xcd05b8[_0xbeef('0x3e')]));recordings[_0xcd05b8[_0xbeef('0x5')]][_0xbeef('0x3e')]=_0xcd05b8[_0xbeef('0x3e')];}}catch(_0x934854){utils['error'](util[_0xbeef('0xe')](_0xbeef('0x3c'),_0xcd05b8[_0xbeef('0x5')]),_0x934854);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index b941824..d0f70b9 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 _0xeed9=['format','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils'];(function(_0x10b4f2,_0x2d4ec8){var _0x1d9640=function(_0x5a55ab){while(--_0x5a55ab){_0x10b4f2['push'](_0x10b4f2['shift']());}};_0x1d9640(++_0x2d4ec8);}(_0xeed9,0x12e));var _0x9eed=function(_0x2a4da6,_0x5e7f66){_0x2a4da6=_0x2a4da6-0x0;var _0x21f384=_0xeed9[_0x2a4da6];return _0x21f384;};'use strict';var _=require(_0x9eed('0x0'));var util=require('util');var utils=require(_0x9eed('0x1'));function writeDB(_0x10bdf3){utils['info'](util[_0x9eed('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x10bdf3[_0x9eed('0x3')]===_0x9eed('0x4')?_0x10bdf3['origtransfereruniqueid']:_0x10bdf3[_0x9eed('0x5')],_0x10bdf3[_0x9eed('0x3')]));utils[_0x9eed('0x6')](_0x9eed('0x7'),_0x10bdf3);}exports[_0x9eed('0x8')]=function(_0x17c736){try{utils['debug'](util[_0x9eed('0x2')](_0x9eed('0x9'),_0x17c736[_0x9eed('0x5')]),_0x17c736);utils['info'](util['format'](_0x9eed('0xa'),_0x17c736[_0x9eed('0x5')],_0x17c736[_0x9eed('0xb')],_0x17c736[_0x9eed('0xc')],_0x17c736['transfereecalleridnum'],_0x17c736[_0x9eed('0xd')]));_0x17c736['type']='blind';writeDB(_0x17c736);}catch(_0x2b93c2){utils[_0x9eed('0xe')](util[_0x9eed('0x2')](_0x9eed('0x9'),_0x17c736[_0x9eed('0x5')]),_0x2b93c2);}};exports[_0x9eed('0xf')]=function(_0x177f80){try{utils[_0x9eed('0x10')](util['format'](_0x9eed('0x11'),_0x177f80[_0x9eed('0x12')]),_0x177f80);utils[_0x9eed('0x13')](util[_0x9eed('0x2')](_0x9eed('0x14'),_0x177f80[_0x9eed('0x12')],_0x177f80[_0x9eed('0x15')],_0x177f80['origtransferercalleridname'],_0x177f80[_0x9eed('0x16')],_0x177f80[_0x9eed('0x17')]));_0x177f80=_[_0x9eed('0x18')](_0x177f80,{'transfererchannel':_0x177f80['origtransfererchannel'],'transferercalleridnum':_0x177f80[_0x9eed('0x15')],'transferercalleridname':_0x177f80[_0x9eed('0x19')],'transfererconnectedlinenum':_0x177f80['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x177f80[_0x9eed('0x1a')],'transfereraccountcode':_0x177f80[_0x9eed('0x1b')],'transferercontext':_0x177f80[_0x9eed('0x1c')],'transfererexten':_0x177f80[_0x9eed('0x1d')],'transfererlinkedid':_0x177f80[_0x9eed('0x1e')],'context':_0x177f80['origtransferercontext'],'extension':_0x177f80['origtransfererexten'],'type':_0x9eed('0x4')});if(_[_0x9eed('0x1f')](_0x177f80['transfereechannel'])){_0x177f80=_[_0x9eed('0x18')](_0x177f80,{'transfereechannel':_0x177f80[_0x9eed('0x20')],'transfereecalleridnum':_0x177f80[_0x9eed('0x16')],'transfereecalleridname':_0x177f80['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x177f80[_0x9eed('0x21')],'transfereeconnectedlinename':_0x177f80[_0x9eed('0x22')],'transfereeaccountcode':_0x177f80['transfertargetaccountcode'],'transfereecontext':_0x177f80[_0x9eed('0x23')],'transfereeexten':_0x177f80[_0x9eed('0x24')],'transfereelinkedid':_0x177f80[_0x9eed('0x25')]});}writeDB(_0x177f80);}catch(_0x5790df){utils['error'](util[_0x9eed('0x2')](_0x9eed('0x11'),_0x177f80[_0x9eed('0x12')]),_0x5790df);}}; \ No newline at end of file +var _0x90d3=['transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','request','CreateVoiceTransferReport','debug','uniqueid','transferercalleridname'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x90d3,0x14a));var _0x390d=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0x90d3[_0xfb0cfd];return _0x2fd8aa;};'use strict';var _=require('lodash');var util=require(_0x390d('0x0'));var utils=require(_0x390d('0x1'));function writeDB(_0x165eae){utils[_0x390d('0x2')](util[_0x390d('0x3')](_0x390d('0x4'),_0x165eae[_0x390d('0x5')]==='attended'?_0x165eae[_0x390d('0x6')]:_0x165eae['uniqueid'],_0x165eae['type']));utils[_0x390d('0x7')](_0x390d('0x8'),_0x165eae);}exports['blindtransfer']=function(_0x43d25f){try{utils[_0x390d('0x9')](util['format']('[%s][transfers][blindtransfer]',_0x43d25f[_0x390d('0xa')]),_0x43d25f);utils[_0x390d('0x2')](util[_0x390d('0x3')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x43d25f[_0x390d('0xa')],_0x43d25f['transferercalleridnum'],_0x43d25f[_0x390d('0xb')],_0x43d25f[_0x390d('0xc')],_0x43d25f[_0x390d('0xd')]));_0x43d25f[_0x390d('0x5')]=_0x390d('0xe');writeDB(_0x43d25f);}catch(_0x41522b){utils[_0x390d('0xf')](util[_0x390d('0x3')](_0x390d('0x10'),_0x43d25f[_0x390d('0xa')]),_0x41522b);}};exports[_0x390d('0x11')]=function(_0x3985d4){try{utils['debug'](util[_0x390d('0x3')](_0x390d('0x12'),_0x3985d4['origtransfereruniqueid']),_0x3985d4);utils['info'](util[_0x390d('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3985d4[_0x390d('0x6')],_0x3985d4['origtransferercalleridnum'],_0x3985d4[_0x390d('0x13')],_0x3985d4[_0x390d('0x14')],_0x3985d4[_0x390d('0x15')]));_0x3985d4=_[_0x390d('0x16')](_0x3985d4,{'transfererchannel':_0x3985d4['origtransfererchannel'],'transferercalleridnum':_0x3985d4['origtransferercalleridnum'],'transferercalleridname':_0x3985d4['origtransferercalleridname'],'transfererconnectedlinenum':_0x3985d4[_0x390d('0x17')],'transfererconnectedlinename':_0x3985d4[_0x390d('0x18')],'transfereraccountcode':_0x3985d4['origtransfereraccountcode'],'transferercontext':_0x3985d4[_0x390d('0x19')],'transfererexten':_0x3985d4[_0x390d('0x1a')],'transfererlinkedid':_0x3985d4[_0x390d('0x1b')],'context':_0x3985d4['origtransferercontext'],'extension':_0x3985d4[_0x390d('0x1c')],'type':_0x390d('0x1d')});if(_[_0x390d('0x1e')](_0x3985d4[_0x390d('0x1f')])){_0x3985d4=_[_0x390d('0x16')](_0x3985d4,{'transfereechannel':_0x3985d4[_0x390d('0x20')],'transfereecalleridnum':_0x3985d4[_0x390d('0x14')],'transfereecalleridname':_0x3985d4[_0x390d('0x15')],'transfereeconnectedlinenum':_0x3985d4[_0x390d('0x21')],'transfereeconnectedlinename':_0x3985d4[_0x390d('0x22')],'transfereeaccountcode':_0x3985d4[_0x390d('0x23')],'transfereecontext':_0x3985d4['transfertargetcontext'],'transfereeexten':_0x3985d4[_0x390d('0x24')],'transfereelinkedid':_0x3985d4[_0x390d('0x25')]});}writeDB(_0x3985d4);}catch(_0x53e28b){utils['error'](util[_0x390d('0x3')](_0x390d('0x12'),_0x3985d4[_0x390d('0x6')]),_0x53e28b);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 8bf1e3e..350d258 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 _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f2540,_0x10e19b){_0x4f2540=_0x4f2540-0x0;var _0x151dd6=_0xb10b[_0x4f2540];return _0x151dd6;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb10b,0x12a));var _0xbb10=function(_0x24124d,_0x26ae83){_0x24124d=_0x24124d-0x0;var _0x56df41=_0xb10b[_0x24124d];return _0x56df41;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file